A64: Add unsafe_optimizations option

* Strength reduce FMA unsafely
This commit is contained in:
MerryMage
2020-07-06 21:01:24 +01:00
parent 82868034d3
commit 761e95eec0
5 changed files with 35 additions and 0 deletions

View File

@@ -637,6 +637,20 @@ static void EmitFPMulAdd(BlockOfCode& code, EmitContext& ctx, IR::Inst* inst) {
ctx.reg_alloc.DefineValue(inst, result);
return;
}
if (ctx.UnsafeOptimizations()) {
auto args = ctx.reg_alloc.GetArgumentInfo(inst);
const Xbyak::Xmm operand1 = ctx.reg_alloc.UseScratchXmm(args[0]);
const Xbyak::Xmm operand2 = ctx.reg_alloc.UseScratchXmm(args[1]);
const Xbyak::Xmm operand3 = ctx.reg_alloc.UseXmm(args[2]);
FCODE(muls)(operand2, operand3);
FCODE(adds)(operand1, operand2);
ctx.reg_alloc.DefineValue(inst, operand1);
return;
}
}
auto args = ctx.reg_alloc.GetArgumentInfo(inst);