[llvm] [AArch64][TTI] Fix extract cost for scalar fmul users (PR #212739)
Anutosh Bhat via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 29 04:15:03 PDT 2026
anutosh491 wrote:
On Branch
```
anutosh491 at Anutoshs-MacBook-Air llvm-project % TEST=llvm/test/Transforms/SLPVectorizer/AArch64/extract-fmul-cost.ll
anutosh491 at Anutoshs-MacBook-Air llvm-project % build-assert/bin/opt \
-passes=slp-vectorizer \
-mtriple=aarch64-unknown-linux \
-debug-only=SLP \
-disable-output \
"$TEST" 2>&1 |
grep -A6 -B2 "Use: x1"
SLP: Computing cost for external use of TreeEntry 1 in lane 1
User: %mul = fmul double %x1, %x2
Use: x1
ExtractElement cost for double from <2 x double>: 0
SLP: Spill Cost = 0.
SLP: Extract Cost = 0.
SLP: Total Cost = -4.
SLP: Found cost = -4 for VF=2
SLP: Decided to vectorize cost = -4
anutosh491 at Anutoshs-MacBook-Air llvm-project % build-assert/bin/opt \
-passes=slp-vectorizer \
-slp-threshold=3 \
-mtriple=aarch64-unknown-linux \
-S \
"$TEST" |
grep -E "fadd <2 x double>|store <2 x double>"
%2 = fadd <2 x double> %0, %1
%5 = fadd <2 x double> %3, %4
store <2 x double> %2, ptr %o0, align 8
store <2 x double> %5, ptr %o2, align 8
```
On Main
```
anutosh491 at Anutoshs-MacBook-Air llvm-project % build-assert/bin/opt \
-passes=slp-vectorizer \
-mtriple=aarch64-unknown-linux \
-debug-only=SLP \
-disable-output \
"$TEST" 2>&1 |
grep -A6 -B2 "Use: x1"
SLP: Computing cost for external use of TreeEntry 1 in lane 1
User: %mul = fmul double %x1, %x2
Use: x1
ExtractElement cost for double from <2 x double>: 2
SLP: Spill Cost = 0.
SLP: Extract Cost = 2.
SLP: Total Cost = -2.
SLP: Found cost = -2 for VF=2
SLP: Decided to vectorize cost = -2
anutosh491 at Anutoshs-MacBook-Air llvm-project % build-assert/bin/opt \
-passes=slp-vectorizer \
-slp-threshold=3 \
-mtriple=aarch64-unknown-linux \
-S \
"$TEST" |
grep -E "fadd <2 x double>|store <2 x double>"
%2 = fadd <2 x double> %0, %1
store <2 x double> %2, ptr %o2, align 8
```
https://github.com/llvm/llvm-project/pull/212739
More information about the llvm-commits
mailing list