diff graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCBitManipulationOp.java @ 16518:3eb13b910134

[SPARC] Fixing LongBits tests and some implicit exceptions
author Stefan Anzinger <stefan.anzinger@gmail.com>
date Fri, 11 Jul 2014 18:22:12 -0700
parents bbf051d717f5
children 2b91702c4e69
line wrap: on
line diff
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCBitManipulationOp.java	Wed Jul 09 09:36:13 2014 -0700
+++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCBitManipulationOp.java	Fri Jul 11 18:22:12 2014 -0700
@@ -54,16 +54,14 @@
 
     @Opcode private final IntrinsicOpcode opcode;
     @Def protected AllocatableValue result;
-    @Use({REG}) protected AllocatableValue input;
-    @Def({REG}) protected Value scratch;
+    @Alive({REG}) protected AllocatableValue input;
+    @Temp({REG}) protected Value scratch;
 
     public SPARCBitManipulationOp(IntrinsicOpcode opcode, AllocatableValue result, AllocatableValue input, LIRGeneratorTool gen) {
         this.opcode = opcode;
         this.result = result;
         this.input = input;
-        if (opcode == IntrinsicOpcode.IBSR || opcode == IntrinsicOpcode.LBSR) {
-            scratch = gen.newVariable(LIRKind.derive(input));
-        }
+        scratch = gen.newVariable(LIRKind.derive(input));
     }
 
     @Override
@@ -117,7 +115,7 @@
                 }
                 case LBSR: {
                     Kind lkind = input.getKind();
-                    assert lkind == Kind.Int;
+                    assert lkind == Kind.Long;
                     Register tmp = asRegister(scratch);
                     new Srlx(src, 1, tmp).emit(masm);
                     new Or(src, tmp, dst).emit(masm);
@@ -132,8 +130,7 @@
                     new Srlx(dst, 32, tmp).emit(masm);
                     new Or(dst, tmp, dst).emit(masm);
                     new Popc(dst, dst).emit(masm);
-                    new Mov(lkind.getBitCount(), tmp).emit(masm);
-                    new Sub(tmp, dst, dst).emit(masm);
+                    new Sub(dst, 1, dst).emit(masm); // This is required to fit the given structure.
                     break;
                 }
                 default: