sh2 drc, x86 backend, optimize move #0 with xor
authorkub <derkub@gmail.com>
Tue, 16 Mar 2021 20:31:45 +0000 (21:31 +0100)
committerkub <derkub@gmail.com>
Tue, 16 Mar 2021 20:42:50 +0000 (21:42 +0100)
cpu/drc/emit_x86.c

index 94111e0..4712449 100644 (file)
@@ -383,9 +383,12 @@ enum { xAX = 0, xCX, xDX, xBX, xSP, xBP, xSI, xDI, // x86-64,i386 common
 
 // _r_imm
 #define emith_move_r_imm(r, imm) do { \
-       EMIT_REX_IF(0, 0, r); \
-       EMIT_OP(0xb8 + ((r)&7)); \
-       EMIT(imm, u32); \
+       if (imm) { \
+               EMIT_REX_IF(0, 0, r); \
+               EMIT_OP(0xb8 + ((r)&7)); \
+               EMIT(imm, u32); \
+       } else \
+               emith_eor_r_r(r, r); \
 } while (0)
 
 #define emith_move_r_ptr_imm(r, imm) do { \