use of org.graalvm.compiler.nodes.calc.CopySignNode in project graal by oracle.
the class AArch64GraphBuilderPlugins method registerMathPlugins.
private static void registerMathPlugins(InvocationPlugins plugins, boolean registerForeignCallMath) {
Registration r = new Registration(plugins, Math.class);
if (registerForeignCallMath) {
registerUnaryMath(r, "sin", SIN);
registerUnaryMath(r, "cos", COS);
registerUnaryMath(r, "tan", TAN);
registerUnaryMath(r, "exp", EXP);
registerUnaryMath(r, "log", LOG);
registerUnaryMath(r, "log10", LOG10);
r.register(new InlineOnlyInvocationPlugin("pow", double.class, double.class) {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode x, ValueNode y) {
b.push(JavaKind.Double, b.append(BinaryMathIntrinsicNode.create(x, y, BinaryMathIntrinsicNode.BinaryOperation.POW)));
return true;
}
});
}
registerFMA(r);
registerIntegerAbs(r);
r.register(new InvocationPlugin("multiplyHigh", long.class, long.class) {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode x, ValueNode y) {
b.push(JavaKind.Long, b.append(new IntegerMulHighNode(x, y)));
return true;
}
});
registerMinMax(r);
r.register(new InvocationPlugin("copySign", float.class, float.class) {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode magnitude, ValueNode sign) {
b.addPush(JavaKind.Float, new CopySignNode(magnitude, sign));
return true;
}
});
r.register(new InvocationPlugin("copySign", double.class, double.class) {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode magnitude, ValueNode sign) {
b.addPush(JavaKind.Double, new CopySignNode(magnitude, sign));
return true;
}
});
}
use of org.graalvm.compiler.nodes.calc.CopySignNode in project graal by oracle.
the class AMD64GraphBuilderPlugins method registerMathPlugins.
private static void registerMathPlugins(InvocationPlugins plugins, AMD64 arch, Replacements replacements) {
Registration r = new Registration(plugins, Math.class, replacements);
registerUnaryMath(r, "log", LOG);
registerUnaryMath(r, "log10", LOG10);
registerUnaryMath(r, "exp", EXP);
registerBinaryMath(r, "pow", POW);
registerUnaryMath(r, "sin", SIN);
registerUnaryMath(r, "cos", COS);
registerUnaryMath(r, "tan", TAN);
registerFMA(r, arch);
registerMinMax(r, arch);
r.registerConditional(arch.getFeatures().contains(CPUFeature.AVX512VL), new InvocationPlugin("copySign", float.class, float.class) {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode magnitude, ValueNode sign) {
b.addPush(JavaKind.Float, new CopySignNode(magnitude, sign));
return true;
}
});
r.registerConditional(arch.getFeatures().contains(CPUFeature.AVX512VL), new InvocationPlugin("copySign", double.class, double.class) {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode magnitude, ValueNode sign) {
b.addPush(JavaKind.Double, new CopySignNode(magnitude, sign));
return true;
}
});
}
Aggregations