-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Improve Math(F).FusedMultiplyAdd codegen #27060
Conversation
|
This PR doesn't improve: float t = MathF.FusedMultiplyAdd(x, y, y);It's expected to be vfmadd213ss xmm0 xmm1 xmm1but it emits a redundant mov: vmovaps xmm2, xmm1
vfmadd213ss xmm0, xmm2, xmm1The goal was to make this func: static float Lerp(float v0, float v1, float t) =>
MathF.FusedMultiplyAdd(t, v1, MathF.FusedMultiplyAdd(-t, v0, v0));to have a perfect codegen |
|
PTAL @dotnet/jit-contrib |
sandreenko
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, nice improvement, thank you.
echesakov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thank you!
|
Could you please add your test cases to https://github.com/dotnet/coreclr/tree/master/tests/src/JIT/HardwareIntrinsics/X86? |
|
/azp run coreclr-outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
sandreenko
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, ADO shows no failures (1 queued job is a github glitch, it has passed already), so I am going to merge that soon.
Fixes https://github.com/dotnet/coreclr/issues/25829 (currently
Math(F).FusedMultiplyAddalways emitsvfmadd213ss\dandxors if there are negations)Test cases:
Was:
Now:
Diff.
/cc @tannergooding