[PATCH] D140498: [SLP]Fix cost of the broadcast buildvector/gather.
Simon Pilgrim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 4 03:24:43 PST 2023
RKSimon added inline comments.
================
Comment at: llvm/lib/Target/X86/X86TargetTransformInfo.cpp:4346
+ return RegisterFileMoveCost;
+ // mov constang-to-GPR + movd/movq GPR -> XMM.
+ if (Op1->getType()->isIntegerTy() && isa_and_nonnull<Constant>(Op1))
----------------
constang -> constant
================
Comment at: llvm/lib/Target/X86/X86TargetTransformInfo.cpp:4347
+ // mov constang-to-GPR + movd/movq GPR -> XMM.
+ if (Op1->getType()->isIntegerTy() && isa_and_nonnull<Constant>(Op1))
+ return 2 + RegisterFileMoveCost;
----------------
Switch order in case Op1 is null:
```
if ( isa_and_nonnull<Constant>(Op1) && Op1->getType()->isIntegerTy())
```
================
Comment at: llvm/test/Analysis/CostModel/X86/vector-insert-inseltpoison.ll:297
; SSE4-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %v2i64_a = insertelement <2 x i64> poison, i64 undef, i32 %arg
-; SSE4-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v2i64_0 = insertelement <2 x i64> poison, i64 undef, i32 0
+; SSE4-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %v2i64_0 = insertelement <2 x i64> poison, i64 undef, i32 0
; SSE4-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v2i64_1 = insertelement <2 x i64> poison, i64 undef, i32 1
----------------
Something is still wrong - you have a more expensive cost to insert a i64 into [0] than [1] - for SSE4 they should both be cost = 1
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D140498/new/
https://reviews.llvm.org/D140498
More information about the llvm-commits
mailing list