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)