Skip to content

Commit 57a6b05

Browse files
committed
[𝘀𝗽𝗿] initial version
Created using spr 1.3.5
1 parent a88167a commit 57a6b05

31 files changed

+1446
-907
lines changed

llvm/include/llvm/Analysis/TargetTransformInfo.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1778,6 +1778,10 @@ class TargetTransformInfo {
17781778
/// scalable version of the vectorized loop.
17791779
bool preferFixedOverScalableIfEqualCost() const;
17801780

1781+
/// \returns True if target prefers SLP vectorizer with altermate opcode
1782+
/// vectorization, false - otherwise.
1783+
bool preferAlternateOpcodeVectorization() const;
1784+
17811785
/// \returns True if the target prefers reductions in loop.
17821786
bool preferInLoopReduction(unsigned Opcode, Type *Ty,
17831787
ReductionFlags Flags) const;
@@ -2331,6 +2335,7 @@ class TargetTransformInfo::Concept {
23312335
unsigned ChainSizeInBytes,
23322336
VectorType *VecTy) const = 0;
23332337
virtual bool preferFixedOverScalableIfEqualCost() const = 0;
2338+
virtual bool preferAlternateOpcodeVectorization() const = 0;
23342339
virtual bool preferInLoopReduction(unsigned Opcode, Type *Ty,
23352340
ReductionFlags) const = 0;
23362341
virtual bool preferPredicatedReductionSelect(unsigned Opcode, Type *Ty,
@@ -3142,6 +3147,9 @@ class TargetTransformInfo::Model final : public TargetTransformInfo::Concept {
31423147
bool preferFixedOverScalableIfEqualCost() const override {
31433148
return Impl.preferFixedOverScalableIfEqualCost();
31443149
}
3150+
bool preferAlternateOpcodeVectorization() const override {
3151+
return Impl.preferAlternateOpcodeVectorization();
3152+
}
31453153
bool preferInLoopReduction(unsigned Opcode, Type *Ty,
31463154
ReductionFlags Flags) const override {
31473155
return Impl.preferInLoopReduction(Opcode, Ty, Flags);

llvm/include/llvm/Analysis/TargetTransformInfoImpl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,6 +1006,8 @@ class TargetTransformInfoImplBase {
10061006

10071007
bool preferFixedOverScalableIfEqualCost() const { return false; }
10081008

1009+
bool preferAlternateOpcodeVectorization() const { return true; }
1010+
10091011
bool preferInLoopReduction(unsigned Opcode, Type *Ty,
10101012
TTI::ReductionFlags Flags) const {
10111013
return false;

llvm/lib/Analysis/TargetTransformInfo.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,6 +1380,10 @@ bool TargetTransformInfo::preferFixedOverScalableIfEqualCost() const {
13801380
return TTIImpl->preferFixedOverScalableIfEqualCost();
13811381
}
13821382

1383+
bool TargetTransformInfo::preferAlternateOpcodeVectorization() const {
1384+
return TTIImpl->preferAlternateOpcodeVectorization();
1385+
}
1386+
13831387
bool TargetTransformInfo::preferInLoopReduction(unsigned Opcode, Type *Ty,
13841388
ReductionFlags Flags) const {
13851389
return TTIImpl->preferInLoopReduction(Opcode, Ty, Flags);

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ class RISCVTTIImpl : public BasicTTIImplBase<RISCVTTIImpl> {
119119

120120
unsigned getMaximumVF(unsigned ElemWidth, unsigned Opcode) const;
121121

122+
bool preferAlternateOpcodeVectorization() const { return false; }
123+
122124
bool preferEpilogueVectorization() const {
123125
// Epilogue vectorization is usually unprofitable - tail folding or
124126
// a smaller VF would have been better. This a blunt hammer - we

llvm/lib/Target/X86/X86TargetTransformInfo.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ class X86TTIImpl : public BasicTTIImplBase<X86TTIImpl> {
292292

293293
TTI::MemCmpExpansionOptions enableMemCmpExpansion(bool OptSize,
294294
bool IsZeroCmp) const;
295+
bool preferAlternateOpcodeVectorization() const { return false; }
295296
bool prefersVectorizedAddressing() const;
296297
bool supportsEfficientVectorElementLoadStore() const;
297298
bool enableInterleavedAccessVectorization();

0 commit comments

Comments
 (0)