[llvm] [AMDGPU] Price only the fmul that fuses into an fadd/fsub as free (PR #226009)
Dmitry Sidorov via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 24 03:12:04 PDT 2026
================
@@ -251,6 +251,90 @@ define void @fmul_fadd_f64(double %a, double %b, double %c, <2 x double> %va, <2
ret void
}
+define void @fmul_fmul_fadd_f32(float %a, float %b, float %c, float %d) #0 {
----------------
MrSidims wrote:
I believe we are missing tests for reassoc, something like this:
```
define float @foo(float %a, float %b, float %c, float %d, float %e) {
%m0 = fmul contract float %a, %b
%m1 = fmul contract float %c, %d
%sum = fadd contact float %m0, %m1
%ret = fadd reassoc contract float %sum, %val
ret float %ret
}
```
this should have been fused into 2 x fma therefore the cost is 2. But (per my understanding) the patch will put a cost of 3 on this.
https://github.com/llvm/llvm-project/pull/226009
More information about the llvm-commits
mailing list