From d7052281d57e7d0124e7386b18a54acaf86d449f Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Thu, 29 Feb 2024 17:01:58 -0800 Subject: [PATCH] Add a/a and a-a cases as well --- CodeGen/src/IrLoweringX64.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CodeGen/src/IrLoweringX64.cpp b/CodeGen/src/IrLoweringX64.cpp index cc29e42f..b2b0ced2 100644 --- a/CodeGen/src/IrLoweringX64.cpp +++ b/CodeGen/src/IrLoweringX64.cpp @@ -624,7 +624,7 @@ void IrLoweringX64::lowerInst(IrInst& inst, uint32_t index, const IrBlock& next) ScopedRegX64 tmp2{regs}; RegisterX64 tmpa = vecOp(inst.a, tmp1); - RegisterX64 tmpb = vecOp(inst.b, tmp2); + RegisterX64 tmpb = (inst.a == inst.b) ? tmpa : vecOp(inst.b, tmp2); build.vsubps(inst.regX64, tmpa, tmpb); if (!FFlag::LuauCodegenVectorTag) @@ -654,7 +654,7 @@ void IrLoweringX64::lowerInst(IrInst& inst, uint32_t index, const IrBlock& next) ScopedRegX64 tmp2{regs}; RegisterX64 tmpa = vecOp(inst.a, tmp1); - RegisterX64 tmpb = vecOp(inst.b, tmp2); + RegisterX64 tmpb = (inst.a == inst.b) ? tmpa : vecOp(inst.b, tmp2); build.vdivps(inst.regX64, tmpa, tmpb); if (!FFlag::LuauCodegenVectorTag)