[llvm] [SLP] Fix canConvertToFMA fmul costing (PR #216425)

Dmitry Sidorov via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 19 15:52:42 PDT 2026


================
@@ -126,12 +126,42 @@ define void @contract_mul(ptr noalias %d, ptr noalias %a, ptr noalias %b, ptr no
 ; THR15-NEXT:    [[BP0:%.*]] = getelementptr inbounds float, ptr [[B]], i64 0
 ; THR15-NEXT:    [[CP0:%.*]] = getelementptr inbounds float, ptr [[C]], i64 0
 ; THR15-NEXT:    [[DP0:%.*]] = getelementptr inbounds float, ptr [[D]], i64 0
-; THR15-NEXT:    [[TMP0:%.*]] = load <4 x float>, ptr [[AP0]], align 4
-; THR15-NEXT:    [[TMP1:%.*]] = load <4 x float>, ptr [[BP0]], align 4
-; THR15-NEXT:    [[TMP2:%.*]] = load <4 x float>, ptr [[CP0]], align 4
-; THR15-NEXT:    [[TMP3:%.*]] = fmul contract <4 x float> [[TMP0]], [[TMP1]]
-; THR15-NEXT:    [[TMP4:%.*]] = fadd contract <4 x float> [[TMP3]], [[TMP2]]
-; THR15-NEXT:    store <4 x float> [[TMP4]], ptr [[DP0]], align 4
+; THR15-NEXT:    [[A0:%.*]] = load float, ptr [[AP0]], align 4
----------------
MrSidims wrote:

Basically, all of this activity you see from me comes from the fact, that there are set of samples, where having fma at codegen would be more profitable, and for these samples disabling slp-vectorizer gives better performance. So I'm fixing it on 2 ends: 1. fixing cost model on AMDGPU TTI; 2. making sure, that fma discount is accounted properly in the SLP.

https://github.com/llvm/llvm-project/pull/216425


More information about the llvm-commits mailing list