From 3985f7bf8461b683c7b11922c1c4643144a07818 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 29 Mar 2018 14:56:31 -0400 Subject: [PATCH] emit_x64_data_processing: Deduplicate some code in zero-extension functions EmitZeroExtendByteToLong() can be implemented in terms of EmitZeroExtendByteToWord() and EmitZeroExtendHalfToLong() can be implemented in terms of EmitZeroExtendHalfToWord(). --- src/backend_x64/emit_x64_data_processing.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/backend_x64/emit_x64_data_processing.cpp b/src/backend_x64/emit_x64_data_processing.cpp index 8746ca09..97019a56 100644 --- a/src/backend_x64/emit_x64_data_processing.cpp +++ b/src/backend_x64/emit_x64_data_processing.cpp @@ -1218,17 +1218,13 @@ void EmitX64::EmitZeroExtendHalfToWord(EmitContext& ctx, IR::Inst* inst) { } void EmitX64::EmitZeroExtendByteToLong(EmitContext& ctx, IR::Inst* inst) { - auto args = ctx.reg_alloc.GetArgumentInfo(inst); - Xbyak::Reg64 result = ctx.reg_alloc.UseScratchGpr(args[0]); - code.movzx(result.cvt32(), result.cvt8()); // x64 zeros upper 32 bits on a 32-bit move - ctx.reg_alloc.DefineValue(inst, result); + // x64 zeros upper 32 bits on a 32-bit move + EmitZeroExtendByteToWord(ctx, inst); } void EmitX64::EmitZeroExtendHalfToLong(EmitContext& ctx, IR::Inst* inst) { - auto args = ctx.reg_alloc.GetArgumentInfo(inst); - Xbyak::Reg64 result = ctx.reg_alloc.UseScratchGpr(args[0]); - code.movzx(result.cvt32(), result.cvt16()); // x64 zeros upper 32 bits on a 32-bit move - ctx.reg_alloc.DefineValue(inst, result); + // x64 zeros upper 32 bits on a 32-bit move + EmitZeroExtendHalfToWord(ctx, inst); } void EmitX64::EmitZeroExtendWordToLong(EmitContext& ctx, IR::Inst* inst) {