diff options
author | Mike Pall <mike> | 2011-01-03 02:35:30 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2011-01-03 02:35:30 +0100 |
commit | 593821f7d9a70208105e878e615d1e67eb7b0c16 (patch) | |
tree | 63de7fb528a060790297961aa4f6c4881a43048e /src | |
parent | 3291bb62e0052df598a7fcf4138ae3973c08982e (diff) | |
download | luajit-593821f7d9a70208105e878e615d1e67eb7b0c16.tar.gz luajit-593821f7d9a70208105e878e615d1e67eb7b0c16.tar.bz2 luajit-593821f7d9a70208105e878e615d1e67eb7b0c16.zip |
Add support for integer IR_NEG to backend.
Diffstat (limited to 'src')
-rw-r--r-- | src/lj_asm.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/lj_asm.c b/src/lj_asm.c index 18944da4..b2459e59 100644 --- a/src/lj_asm.c +++ b/src/lj_asm.c | |||
@@ -2831,10 +2831,10 @@ static void asm_add(ASMState *as, IRIns *ir) | |||
2831 | asm_intarith(as, ir, XOg_ADD); | 2831 | asm_intarith(as, ir, XOg_ADD); |
2832 | } | 2832 | } |
2833 | 2833 | ||
2834 | static void asm_bitnot(ASMState *as, IRIns *ir) | 2834 | static void asm_neg_not(ASMState *as, IRIns *ir, x86Group3 xg) |
2835 | { | 2835 | { |
2836 | Reg dest = ra_dest(as, ir, RSET_GPR); | 2836 | Reg dest = ra_dest(as, ir, RSET_GPR); |
2837 | emit_rr(as, XO_GROUP3, REX_64IR(ir, XOg_NOT), dest); | 2837 | emit_rr(as, XO_GROUP3, REX_64IR(ir, xg), dest); |
2838 | ra_left(as, dest, ir->op1); | 2838 | ra_left(as, dest, ir->op1); |
2839 | } | 2839 | } |
2840 | 2840 | ||
@@ -3691,7 +3691,7 @@ static void asm_ir(ASMState *as, IRIns *ir) | |||
3691 | case IR_RETF: asm_retf(as, ir); break; | 3691 | case IR_RETF: asm_retf(as, ir); break; |
3692 | 3692 | ||
3693 | /* Bit ops. */ | 3693 | /* Bit ops. */ |
3694 | case IR_BNOT: asm_bitnot(as, ir); break; | 3694 | case IR_BNOT: asm_neg_not(as, ir, XOg_NOT); |
3695 | case IR_BSWAP: asm_bitswap(as, ir); break; | 3695 | case IR_BSWAP: asm_bitswap(as, ir); break; |
3696 | 3696 | ||
3697 | case IR_BAND: asm_intarith(as, ir, XOg_AND); break; | 3697 | case IR_BAND: asm_intarith(as, ir, XOg_AND); break; |
@@ -3720,7 +3720,12 @@ static void asm_ir(ASMState *as, IRIns *ir) | |||
3720 | break; | 3720 | break; |
3721 | case IR_DIV: asm_fparith(as, ir, XO_DIVSD); break; | 3721 | case IR_DIV: asm_fparith(as, ir, XO_DIVSD); break; |
3722 | 3722 | ||
3723 | case IR_NEG: asm_fparith(as, ir, XO_XORPS); break; | 3723 | case IR_NEG: |
3724 | if (irt_isnum(ir->t)) | ||
3725 | asm_fparith(as, ir, XO_XORPS); | ||
3726 | else | ||
3727 | asm_neg_not(as, ir, XOg_NEG); | ||
3728 | break; | ||
3724 | case IR_ABS: asm_fparith(as, ir, XO_ANDPS); break; | 3729 | case IR_ABS: asm_fparith(as, ir, XO_ANDPS); break; |
3725 | 3730 | ||
3726 | case IR_MIN: asm_fparith(as, ir, XO_MINSD); break; | 3731 | case IR_MIN: asm_fparith(as, ir, XO_MINSD); break; |