]> git.unchartedbackwaters.co.uk Git - francis/libjit.git/commitdiff
Fix the sign opcode on x86 for integers and the constant case for longs.
authorKlaus Treichel <ktreichel@web.de>
Mon, 31 Mar 2008 19:31:41 +0000 (19:31 +0000)
committerKlaus Treichel <ktreichel@web.de>
Mon, 31 Mar 2008 19:31:41 +0000 (19:31 +0000)
ChangeLog
jit/jit-rules-x86.ins

index a76d98a95323f7fd3050de699ed91492603ac307..974e61eb3de0c3a918c25fff28ff4ea312c8c0f3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-03-31  Klaus Treichel  <ktreichel@web.de>
+
+       * jit/jit-rules-x86.ins: Fix the sign opcode for integers and the
+       constant case for longs.
+
 2008-03-30  Klaus Treichel  <ktreichel@web.de>
 
        * jit/jit-gen-x86-64.h: Add macros for the test, imul, cdw/cdq/cqo
index 57fa4a054d24d7ff1ce3ae440b3ae98c5c83bc38..f9017cb7524d72b556a89279b77a4a9d063a0cd4 100644 (file)
@@ -1472,13 +1472,21 @@ JIT_OP_ISIGN:
                {
                        x86_mov_reg_imm(inst, $1, -1);
                }
+               else if($2 > 0)
+               {
+                       x86_mov_reg_imm(inst, $1, 1);
+               }
                else
                {
                        x86_clear_reg(inst, $1);
                }
        }
-       [reg] -> {
+       [reg, scratch reg] -> {
+               x86_clear_reg(inst, $2);
+               x86_test_reg_reg(inst, $1, $1);
+               x86_set_reg(inst,X86_CC_GT, $2, 1);
                x86_shift_reg_imm(inst, X86_SAR, $1, 31);
+               x86_alu_reg_reg(inst, X86_ADD, $1, $2);
        }
 
 JIT_OP_LSIGN:
@@ -1488,6 +1496,10 @@ JIT_OP_LSIGN:
                {
                        x86_mov_reg_imm(inst, $1, -1);
                }
+               else if(value > 0)
+               {
+                       x86_mov_reg_imm(inst, $1, 1);
+               }
                else
                {
                        x86_clear_reg(inst, $1);