From: Klaus Treichel Date: Mon, 31 Mar 2008 19:31:41 +0000 (+0000) Subject: Fix the sign opcode on x86 for integers and the constant case for longs. X-Git-Tag: before.move.to.git~92 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=126a4c708895ce7f6f86011ba8b5c711250d1593;p=francis%2Flibjit.git Fix the sign opcode on x86 for integers and the constant case for longs. --- diff --git a/ChangeLog b/ChangeLog index a76d98a..974e61e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-03-31 Klaus Treichel + + * jit/jit-rules-x86.ins: Fix the sign opcode for integers and the + constant case for longs. + 2008-03-30 Klaus Treichel * jit/jit-gen-x86-64.h: Add macros for the test, imul, cdw/cdq/cqo diff --git a/jit/jit-rules-x86.ins b/jit/jit-rules-x86.ins index 57fa4a0..f9017cb 100644 --- a/jit/jit-rules-x86.ins +++ b/jit/jit-rules-x86.ins @@ -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);