diff options
author | Mike Pall <mike> | 2018-05-20 12:40:33 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2018-05-20 12:40:33 +0200 |
commit | fb5e522fbc0750c838ef6a926b11c5d870826183 (patch) | |
tree | b4684c8cf9c4bab1b595a848edf46cee16cb3bcc /src | |
parent | f5d424afe8b9395f0df05aba905e0e1f6a2262b8 (diff) | |
download | luajit-fb5e522fbc0750c838ef6a926b11c5d870826183.tar.gz luajit-fb5e522fbc0750c838ef6a926b11c5d870826183.tar.bz2 luajit-fb5e522fbc0750c838ef6a926b11c5d870826183.zip |
x86/x64: Check for jcc when using xor r,r in emit_loadi().
Thanks to Peter Cawley.
Diffstat (limited to 'src')
-rw-r--r-- | src/lj_emit_x86.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lj_emit_x86.h b/src/lj_emit_x86.h index bcceb93e..9c371a95 100644 --- a/src/lj_emit_x86.h +++ b/src/lj_emit_x86.h | |||
@@ -268,10 +268,12 @@ static void emit_movmroi(ASMState *as, Reg base, int32_t ofs, int32_t i) | |||
268 | /* mov r, i / xor r, r */ | 268 | /* mov r, i / xor r, r */ |
269 | static void emit_loadi(ASMState *as, Reg r, int32_t i) | 269 | static void emit_loadi(ASMState *as, Reg r, int32_t i) |
270 | { | 270 | { |
271 | /* XOR r,r is shorter, but modifies the flags. This is bad for HIOP. */ | 271 | /* XOR r,r is shorter, but modifies the flags. This is bad for HIOP/jcc. */ |
272 | if (i == 0 && !(LJ_32 && (IR(as->curins)->o == IR_HIOP || | 272 | if (i == 0 && !(LJ_32 && (IR(as->curins)->o == IR_HIOP || |
273 | (as->curins+1 < as->T->nins && | 273 | (as->curins+1 < as->T->nins && |
274 | IR(as->curins+1)->o == IR_HIOP)))) { | 274 | IR(as->curins+1)->o == IR_HIOP))) && |
275 | !((*as->mcp == 0x0f && (as->mcp[1] & 0xf0) == XI_JCCn) || | ||
276 | (*as->mcp & 0xf0) == XI_JCCs)) { | ||
275 | emit_rr(as, XO_ARITH(XOg_XOR), r, r); | 277 | emit_rr(as, XO_ARITH(XOg_XOR), r, r); |
276 | } else { | 278 | } else { |
277 | MCode *p = as->mcp; | 279 | MCode *p = as->mcp; |