Skip to content

Commit eb764a7

Browse files
committed
[AArch64] Increase the cost of i1 inserts / extracts
i1 inserts will need an extra cset, and i1 extracts need a cmp (or tst) in order to be used. This increase the cost of them a little to account for those extra instructions. https://godbolt.org/z/3c5z4G7Mh Differential Revision: https://reviews.llvm.org/D151189
1 parent b9e328f commit eb764a7

File tree

6 files changed

+80
-75
lines changed

6 files changed

+80
-75
lines changed

llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2349,6 +2349,11 @@ InstructionCost AArch64TTIImpl::getVectorInstrCostHelper(const Instruction *I,
23492349
if (I && dyn_cast<LoadInst>(I->getOperand(1)))
23502350
return ST->getVectorInsertExtractBaseCost() + 1;
23512351

2352+
// i1 inserts and extract will include an extra cset or cmp of the vector
2353+
// value. Increase the cost by 1 to account.
2354+
if (Val->getScalarSizeInBits() == 1)
2355+
return ST->getVectorInsertExtractBaseCost() + 1;
2356+
23522357
// FIXME:
23532358
// If the extract-element and insert-element instructions could be
23542359
// simplified away (e.g., could be combined into users by looking at use-def

0 commit comments

Comments
 (0)