From 04b4c8b0cffc5ddbae0a4f6c9a16dd61d24afe47 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 21 Jul 2018 20:26:01 -0400 Subject: [PATCH] emit_x64_aes: Eliminate extraneous usage of a scratch register in EmitAESInverseMixColumns() We can just use the same register the data is in as the result register, eliminating the need to use a completely separate register to store the result. --- src/backend_x64/emit_x64_aes.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/backend_x64/emit_x64_aes.cpp b/src/backend_x64/emit_x64_aes.cpp index 74980199..e24b4938 100644 --- a/src/backend_x64/emit_x64_aes.cpp +++ b/src/backend_x64/emit_x64_aes.cpp @@ -57,12 +57,11 @@ void EmitX64::EmitAESInverseMixColumns(EmitContext& ctx, IR::Inst* inst) { auto args = ctx.reg_alloc.GetArgumentInfo(inst); if (code.DoesCpuSupport(Xbyak::util::Cpu::tAESNI)) { - const Xbyak::Xmm operand = ctx.reg_alloc.UseXmm(args[0]); - const Xbyak::Xmm result = ctx.reg_alloc.ScratchXmm(); + const Xbyak::Xmm data = ctx.reg_alloc.UseScratchXmm(args[0]); - code.aesimc(result, operand); + code.aesimc(data, data); - ctx.reg_alloc.DefineValue(inst, result); + ctx.reg_alloc.DefineValue(inst, data); } else { EmitAESFunction(args, ctx, code, inst, Common::AES::InverseMixColumns); }