diff options
Diffstat (limited to 'src/lj_emit_x86.h')
-rw-r--r-- | src/lj_emit_x86.h | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/lj_emit_x86.h b/src/lj_emit_x86.h index cbaf4e85..3d6f13f4 100644 --- a/src/lj_emit_x86.h +++ b/src/lj_emit_x86.h | |||
@@ -313,13 +313,23 @@ static void emit_loadu64(ASMState *as, Reg r, uint64_t u64) | |||
313 | } | 313 | } |
314 | #endif | 314 | #endif |
315 | 315 | ||
316 | /* movsd r, [&tv->n] / xorps r, r */ | 316 | /* Load 64 bit IR constant into register. */ |
317 | static void emit_loadn(ASMState *as, Reg r, cTValue *tv) | 317 | static void emit_loadk64(ASMState *as, Reg r, IRIns *ir) |
318 | { | 318 | { |
319 | if (tvispzero(tv)) /* Use xor only for +0. */ | 319 | const uint64_t *k = &ir_k64(ir)->u64; |
320 | emit_rr(as, XO_XORPS, r, r); | 320 | if (rset_test(RSET_FPR, r)) { |
321 | else | 321 | if (*k == 0) { |
322 | emit_rma(as, XO_MOVSD, r, &tv->n); | 322 | emit_rr(as, XO_XORPS, r, r); |
323 | } else { | ||
324 | emit_rma(as, XO_MOVSD, r, k); | ||
325 | } | ||
326 | } else { | ||
327 | if (*k == 0) { | ||
328 | emit_rr(as, XO_ARITH(XOg_XOR), r, r); | ||
329 | } else { | ||
330 | emit_rma(as, XO_MOV, r | REX_64, k); | ||
331 | } | ||
332 | } | ||
323 | } | 333 | } |
324 | 334 | ||
325 | /* -- Emit control-flow instructions -------------------------------------- */ | 335 | /* -- Emit control-flow instructions -------------------------------------- */ |