graal/com.oracle.graal.compiler.hsail/src/com/oracle/graal/compiler/hsail/HSAILLIRGenerator.java

Print this page
rev 13953 : Changes to remove the enum in HSAILMathIntrinsicsNode.

@@ -646,15 +646,65 @@
     @Override
     public void emitBitScanReverse(Variable result, Value value) {
         throw GraalInternalError.unimplemented();
     }
 
+    /**
+     * Emit the LIR code for the Math.Abs intrinsic.
+     * 
+     * @param input the source operand
+     * @return Value representing the result of the operation
+     */
     @Override
     public Value emitMathAbs(Value input) {
-        throw GraalInternalError.unimplemented();
+        Variable result = newVariable(input.getPlatformKind());
+        append(new Op1Stack(ABS, result, input));
+        return result;
+    }
+
+    /**
+     * Emit the LIR code for the Math.Ceil intrinsic.
+     * 
+     * @param input the source operand
+     * @return Value representing the result of the operation
+     */
+    public Value emitMathCeil(Value input) {
+        Variable result = newVariable(input.getPlatformKind());
+        append(new Op1Stack(CEIL, result, input));
+        return result;
     }
 
+    /**
+     * Emit the LIR code for the Math.Floor intrinsic.
+     * 
+     * @param input the source operand
+     * @return Value representing the result of the operation
+     */
+    public Value emitMathFloor(Value input) {
+        Variable result = newVariable(input.getPlatformKind());
+        append(new Op1Stack(FLOOR, result, input));
+        return result;
+    }
+
+    /**
+     * Emit the LIR code for the Math.Rint intrinsic.
+     * 
+     * @param input the source operand
+     * @return Value representing the result of the operation
+     */
+    public Value emitMathRint(Value input) {
+        Variable result = newVariable(input.getPlatformKind());
+        append(new Op1Stack(RINT, result, input));
+        return result;
+    }
+
+    /**
+     * Emit the LIR code for the Math.sqrt intrinsic.
+     * 
+     * @param input the source operand
+     * @return value representing the result of the operation
+     */
     @Override
     public Value emitMathSqrt(Value input) {
         Variable result = newVariable(input.getPlatformKind());
         append(new Op1Stack(SQRT, result, input));
         return result;

@@ -782,6 +832,7 @@
 
     @Override
     public void visitInfopointNode(InfopointNode i) {
         throw GraalInternalError.unimplemented();
     }
+
 }