* src/vm/jit/sparc64/codegen.c (codegen_emit): Fixed ICMD_IREMPOW2.
authorajordan <none@none>
Thu, 29 Mar 2007 23:01:58 +0000 (23:01 +0000)
committerajordan <none@none>
Thu, 29 Mar 2007 23:01:58 +0000 (23:01 +0000)
Added ICMD_L2F and ICMD_L2D.
Fixed constant creation in IF_L* compares.

src/vm/jit/sparc64/codegen.c

index 6e66c009a169de0afa461f16c85e188cce16d7c9..8006002b0b7a3498dbe57be0b7bb4248d676529b 100644 (file)
@@ -856,26 +856,27 @@ bool codegen_emit(jitdata *jd)
                        emit_store_dst(jd, iptr, d);
                        break;
 
-               case ICMD_IREMPOW2:   /* ..., value  ==> ..., value % constant        */
+               case ICMD_IREMPOW2:   /* ..., value  ==> ..., value % constant           */
                                      /* sx.val.i = constant                             */
+                                     /* constant is actually constant - 1               */
 
                        s1 = emit_load_s1(jd, iptr, REG_ITMP1);
                        d = codegen_reg_of_dst(jd, iptr, REG_ITMP2);
-                       M_ISEXT(s1, s1); /* trim for 32-bit compare (BGEZ) */
                        if (s1 == d) {
                                M_MOV(s1, REG_ITMP1);
                                s1 = REG_ITMP1;
                        }
-                       if ((iptr->sx.val.i >= 0) && (iptr->sx.val.i <= 0xffff)) {
+                       M_ISEXT(s1, s1); /* trim for 32-bit compare (BGEZ) */
+                       if ((iptr->sx.val.i >= 0) && (iptr->sx.val.i <= 4095)) {
                                M_AND_IMM(s1, iptr->sx.val.i, d);
-                               M_BGEZ(s1, 4);
+                               M_BGEZ(s1, 5);
                                M_NOP;
                                M_SUB(REG_ZERO, s1, d);
                                M_AND_IMM(d, iptr->sx.val.i, d);
                        } else {
                                ICONST(REG_ITMP2, iptr->sx.val.i);
                                M_AND(s1, REG_ITMP2, d);
-                               M_BGEZ(s1, 4);
+                               M_BGEZ(s1, 5);
                                M_NOP;
                                M_SUB(REG_ZERO, s1, d);
                                M_AND(d, REG_ITMP2, d);
@@ -1119,11 +1120,31 @@ bool codegen_emit(jitdata *jd)
                        s1 = emit_load_s1(jd, iptr, REG_ITMP1);
                        d = codegen_reg_of_dst(jd, iptr, REG_FTMP3);
                        disp = dseg_add_float(cd, 0.0);
-                       M_IST (s1, REG_PV_CALLEE, disp);
-                       M_FLD (REG_FTMP2, REG_PV_CALLEE, disp); /* REG_FTMP2 needs to be a double temp */
+                       M_IST(s1, REG_PV_CALLEE, disp);
+                       M_FLD(REG_FTMP2, REG_PV_CALLEE, disp); /* REG_FTMP2 needs to be a double temp */
                        M_CVTID (REG_FTMP2, d); /* rd gets translated to double target register */
                        emit_store_dst(jd, iptr, d);
                        break;
+                       
+               case ICMD_L2F:
+                       s1 = emit_load_s1(jd, iptr, REG_ITMP1);
+                       d = codegen_reg_of_dst(jd, iptr, REG_FTMP3);
+                       disp = dseg_add_double(cd, 0.0);
+                       M_STX(s1, REG_PV_CALLEE, disp);
+                       M_DLD(REG_FTMP3, REG_PV_CALLEE, disp);
+                       M_CVTLF(REG_FTMP3, d);
+                       emit_store_dst(jd, iptr, d);
+                       break;
+                       
+               case ICMD_L2D:
+                       s1 = emit_load_s1(jd, iptr, REG_ITMP1);
+                       d = codegen_reg_of_dst(jd, iptr, REG_FTMP3);
+                       disp = dseg_add_double(cd, 0.0);
+                       M_STX(s1, REG_PV_CALLEE, disp);
+                       M_DLD(d, REG_PV_CALLEE, disp);
+                       M_CVTLD(d, d);
+                       emit_store_dst(jd, iptr, d);
+                       break;
 
                case ICMD_F2I:       /* ..., value  ==> ..., (int) value              */
                        s1 = emit_load_s1(jd, iptr, REG_FTMP1);
@@ -1936,7 +1957,7 @@ bool codegen_emit(jitdata *jd)
                                        M_CMP_IMM(s1, iptr->sx.val.l);
                                } 
                                else {
-                                       ICONST(REG_ITMP2, iptr->sx.val.l);
+                                       LCONST(REG_ITMP2, iptr->sx.val.l);
                                        M_CMP(s1, REG_ITMP2);
                                }
                                emit_blt_xcc(cd, iptr->dst.block);
@@ -1953,7 +1974,7 @@ bool codegen_emit(jitdata *jd)
                                        M_CMP_IMM(s1, iptr->sx.val.l);
                                }
                                else {
-                                       ICONST(REG_ITMP2, iptr->sx.val.l);
+                                       LCONST(REG_ITMP2, iptr->sx.val.l);
                                        M_CMP(s1, REG_ITMP2);
                                }
                                emit_ble_xcc(cd, iptr->dst.block);
@@ -1970,7 +1991,7 @@ bool codegen_emit(jitdata *jd)
                                        M_CMP_IMM(s1, iptr->sx.val.l);
                                }
                                else {
-                                       ICONST(REG_ITMP2, iptr->sx.val.l);
+                                       LCONST(REG_ITMP2, iptr->sx.val.l);
                                        M_CMP(s1, REG_ITMP2);
                                }
                                emit_bne_xcc(cd, iptr->dst.block);
@@ -1987,7 +2008,7 @@ bool codegen_emit(jitdata *jd)
                                        M_CMP_IMM(s1, iptr->sx.val.l);
                                } 
                                else {
-                                       ICONST(REG_ITMP2, iptr->sx.val.l);
+                                       LCONST(REG_ITMP2, iptr->sx.val.l);
                                        M_CMP(s1, REG_ITMP2);
                                }
                                emit_bgt_xcc(cd, iptr->dst.block);
@@ -2004,7 +2025,7 @@ bool codegen_emit(jitdata *jd)
                                        M_CMP_IMM(s1, iptr->sx.val.l);
                                }
                                else {
-                                       ICONST(REG_ITMP2, iptr->sx.val.l);
+                                       LCONST(REG_ITMP2, iptr->sx.val.l);
                                        M_CMP(s1, REG_ITMP2);
                                }
                                emit_bge_xcc(cd, iptr->dst.block);