From 68088c277c27791ed02358b913d48d5edfb2b913 Mon Sep 17 00:00:00 2001 From: MerryMage Date: Mon, 26 Apr 2021 21:57:22 +0100 Subject: [PATCH] emit_x64_data_processing: Reduce codesize of RotateRight32 for carry case --- src/backend/x64/emit_x64_data_processing.cpp | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/backend/x64/emit_x64_data_processing.cpp b/src/backend/x64/emit_x64_data_processing.cpp index 6d12637f..58f97faa 100644 --- a/src/backend/x64/emit_x64_data_processing.cpp +++ b/src/backend/x64/emit_x64_data_processing.cpp @@ -745,28 +745,16 @@ void EmitX64::EmitRotateRight32(EmitContext& ctx, IR::Inst* inst) { const Xbyak::Reg32 result = ctx.reg_alloc.UseScratchGpr(operand_arg).cvt32(); const Xbyak::Reg8 carry = ctx.reg_alloc.UseScratchGpr(carry_arg).cvt8(); - // TODO: Optimize + Xbyak::Label end; - code.inLocalLabel(); - - // if (Rs & 0xFF == 0) goto end; code.test(code.cl, code.cl); - code.jz(".end"); + code.jz(end); - code.and_(code.ecx, u32(0x1F)); - code.jz(".zero_1F"); - // if (Rs & 0x1F != 0) { code.ror(result, code.cl); - code.setc(carry); - code.jmp(".end"); - // } else { - code.L(".zero_1F"); code.bt(result, u8(31)); code.setc(carry); - // } - code.L(".end"); - code.outLocalLabel(); + code.L(end); ctx.reg_alloc.DefineValue(carry_inst, carry); ctx.EraseInstruction(carry_inst);