Skip to content

Commit 97e958a

Browse files
committed
Merge commit '9d37e61fc77d' into amd-staging
2 parents 374089a + 9d37e61 commit 97e958a

31 files changed

+1638
-434
lines changed

llvm/include/llvm/Analysis/TargetTransformInfo.h

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

1774+
/// \returns True if target prefers SLP vectorizer with altermate opcode
1775+
/// vectorization, false - otherwise.
1776+
bool preferAlternateOpcodeVectorization() const;
1777+
17741778
/// \returns True if the target prefers reductions in loop.
17751779
bool preferInLoopReduction(unsigned Opcode, Type *Ty) const;
17761780

@@ -2325,6 +2329,7 @@ class TargetTransformInfo::Concept {
23252329
virtual bool preferInLoopReduction(unsigned Opcode, Type *Ty) const = 0;
23262330
virtual bool preferPredicatedReductionSelect(unsigned Opcode,
23272331
Type *Ty) const = 0;
2332+
virtual bool preferAlternateOpcodeVectorization() const = 0;
23282333
virtual bool preferEpilogueVectorization() const = 0;
23292334

23302335
virtual bool shouldExpandReduction(const IntrinsicInst *II) const = 0;
@@ -3135,6 +3140,9 @@ class TargetTransformInfo::Model final : public TargetTransformInfo::Concept {
31353140
bool preferInLoopReduction(unsigned Opcode, Type *Ty) const override {
31363141
return Impl.preferInLoopReduction(Opcode, Ty);
31373142
}
3143+
bool preferAlternateOpcodeVectorization() const override {
3144+
return Impl.preferAlternateOpcodeVectorization();
3145+
}
31383146
bool preferPredicatedReductionSelect(unsigned Opcode,
31393147
Type *Ty) const override {
31403148
return Impl.preferPredicatedReductionSelect(Opcode, Ty);

llvm/include/llvm/Analysis/TargetTransformInfoImpl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,6 +1007,7 @@ class TargetTransformInfoImplBase {
10071007
bool preferFixedOverScalableIfEqualCost() const { return false; }
10081008

10091009
bool preferInLoopReduction(unsigned Opcode, Type *Ty) const { return false; }
1010+
bool preferAlternateOpcodeVectorization() const { return true; }
10101011

10111012
bool preferPredicatedReductionSelect(unsigned Opcode, Type *Ty) const {
10121013
return false;

llvm/lib/Analysis/TargetTransformInfo.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,6 +1384,10 @@ bool TargetTransformInfo::preferInLoopReduction(unsigned Opcode,
13841384
return TTIImpl->preferInLoopReduction(Opcode, Ty);
13851385
}
13861386

1387+
bool TargetTransformInfo::preferAlternateOpcodeVectorization() const {
1388+
return TTIImpl->preferAlternateOpcodeVectorization();
1389+
}
1390+
13871391
bool TargetTransformInfo::preferPredicatedReductionSelect(unsigned Opcode,
13881392
Type *Ty) const {
13891393
return TTIImpl->preferPredicatedReductionSelect(Opcode, Ty);

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h

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

126126
unsigned getMaximumVF(unsigned ElemWidth, unsigned Opcode) const;
127127

128+
bool preferAlternateOpcodeVectorization() const { return false; }
129+
128130
bool preferEpilogueVectorization() const {
129131
// Epilogue vectorization is usually unprofitable - tail folding or
130132
// 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)