Skip to content

Commit 7eb3110

Browse files
authored
Merge branch 'main' into fix-up-for-vop3p-gisel
2 parents 893bd29 + 497382e commit 7eb3110

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+481
-397
lines changed

clang/test/Driver/print-supported-extensions-riscv.c

+1
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@
123123
// CHECK-NEXT: shvstvecd 1.0 'Shvstvecd' (vstvec supports Direct mode)
124124
// CHECK-NEXT: smaia 1.0 'Smaia' (Advanced Interrupt Architecture Machine Level)
125125
// CHECK-NEXT: smcdeleg 1.0 'Smcdeleg' (Counter Delegation Machine Level)
126+
// CHECK-NEXT: smcntrpmf 1.0 'Smcntrpmf' (Cycle and Instret Privilege Mode Filtering)
126127
// CHECK-NEXT: smcsrind 1.0 'Smcsrind' (Indirect CSR Access Machine Level)
127128
// CHECK-NEXT: smdbltrp 1.0 'Smdbltrp' (Double Trap Machine Level)
128129
// CHECK-NEXT: smepmp 1.0 'Smepmp' (Enhanced Physical Memory Protection)

clang/test/Preprocessor/riscv-target-features.c

+9
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
// CHECK-NOT: __riscv_shvstvecd {{.*$}}
3030
// CHECK-NOT: __riscv_smaia {{.*$}}
3131
// CHECK-NOT: __riscv_smcdeleg {{.*$}}
32+
// CHECK-NOT: __riscv_smcntrpmf {{.*$}}
3233
// CHECK-NOT: __riscv_smcsrind {{.*$}}
3334
// CHECK-NOT: __riscv_smdbltrp {{.*$}}
3435
// CHECK-NOT: __riscv_smepmp {{.*$}}
@@ -1445,6 +1446,14 @@
14451446
// RUN: -o - | FileCheck --check-prefix=CHECK-SSAIA-EXT %s
14461447
// CHECK-SSAIA-EXT: __riscv_ssaia 1000000{{$}}
14471448

1449+
// RUN: %clang --target=riscv32 \
1450+
// RUN: -march=rv32ismcntrpmf1p0 -E -dM %s \
1451+
// RUN: -o - | FileCheck --check-prefix=CHECK-SMCNTRPMF-EXT %s
1452+
// RUN: %clang --target=riscv64 \
1453+
// RUN: -march=rv64ismcntrpmf1p0 -E -dM %s \
1454+
// RUN: -o - | FileCheck --check-prefix=CHECK-SMCNTRPMF-EXT %s
1455+
// CHECK-SMCNTRPMF-EXT: __riscv_smcntrpmf 1000000{{$}}
1456+
14481457
// RUN: %clang --target=riscv32 \
14491458
// RUN: -march=rv32ismcsrind1p0 -E -dM %s \
14501459
// RUN: -o - | FileCheck --check-prefix=CHECK-SMCSRIND-EXT %s

llvm/docs/RISCVUsage.rst

+1
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ on support follow.
128128
``Shvstvecd`` Assembly Support (`See note <#riscv-profiles-extensions-note>`__)
129129
``Smaia`` Supported
130130
``Smcdeleg`` Supported
131+
``Smcntrpmf`` Supported
131132
``Smcsrind`` Supported
132133
``Smdbltrp`` Supported
133134
``Smepmp`` Supported

llvm/include/llvm/Analysis/TargetTransformInfo.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -2367,7 +2367,7 @@ class TargetTransformInfo::Concept {
23672367

23682368
template <typename T>
23692369
class TargetTransformInfo::Model final : public TargetTransformInfo::Concept {
2370-
T Impl;
2370+
const T Impl;
23712371

23722372
public:
23732373
Model(T Impl) : Impl(std::move(Impl)) {}

llvm/include/llvm/Analysis/TargetTransformInfoImpl.h

+14-14
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ class TargetTransformInfoImplBase {
341341
}
342342

343343
bool isLegalInterleavedAccessType(VectorType *VTy, unsigned Factor,
344-
Align Alignment, unsigned AddrSpace) {
344+
Align Alignment, unsigned AddrSpace) const {
345345
return false;
346346
}
347347

@@ -440,7 +440,7 @@ class TargetTransformInfoImplBase {
440440

441441
bool enableSelectOptimize() const { return true; }
442442

443-
bool shouldTreatInstructionLikeSelect(const Instruction *I) {
443+
bool shouldTreatInstructionLikeSelect(const Instruction *I) const {
444444
// A select with two constant operands will usually be better left as a
445445
// select.
446446
using namespace llvm::PatternMatch;
@@ -747,7 +747,7 @@ class TargetTransformInfoImplBase {
747747

748748
unsigned getReplicationShuffleCost(Type *EltTy, int ReplicationFactor, int VF,
749749
const APInt &DemandedDstElts,
750-
TTI::TargetCostKind CostKind) {
750+
TTI::TargetCostKind CostKind) const {
751751
return 1;
752752
}
753753

@@ -1170,7 +1170,7 @@ class TargetTransformInfoImplCRTPBase : public TargetTransformInfoImplBase {
11701170

11711171
InstructionCost getGEPCost(Type *PointeeType, const Value *Ptr,
11721172
ArrayRef<const Value *> Operands, Type *AccessType,
1173-
TTI::TargetCostKind CostKind) {
1173+
TTI::TargetCostKind CostKind) const {
11741174
assert(PointeeType && Ptr && "can't get GEPCost of nullptr");
11751175
auto *BaseGV = dyn_cast<GlobalValue>(Ptr->stripPointerCasts());
11761176
bool HasBaseReg = (BaseGV == nullptr);
@@ -1234,7 +1234,7 @@ class TargetTransformInfoImplCRTPBase : public TargetTransformInfoImplBase {
12341234

12351235
// If the final address of the GEP is a legal addressing mode for the given
12361236
// access type, then we can fold it into its users.
1237-
if (static_cast<T *>(this)->isLegalAddressingMode(
1237+
if (static_cast<const T *>(this)->isLegalAddressingMode(
12381238
AccessType, const_cast<GlobalValue *>(BaseGV),
12391239
BaseOffset.sextOrTrunc(64).getSExtValue(), HasBaseReg, Scale,
12401240
Ptr->getType()->getPointerAddressSpace()))
@@ -1250,7 +1250,7 @@ class TargetTransformInfoImplCRTPBase : public TargetTransformInfoImplBase {
12501250
const Value *Base,
12511251
const TTI::PointersChainInfo &Info,
12521252
Type *AccessTy,
1253-
TTI::TargetCostKind CostKind) {
1253+
TTI::TargetCostKind CostKind) const {
12541254
InstructionCost Cost = TTI::TCC_Free;
12551255
// In the basic model we take into account GEP instructions only
12561256
// (although here can come alloca instruction, a value, constants and/or
@@ -1269,26 +1269,26 @@ class TargetTransformInfoImplCRTPBase : public TargetTransformInfoImplBase {
12691269
if (Info.isSameBase() && V != Base) {
12701270
if (GEP->hasAllConstantIndices())
12711271
continue;
1272-
Cost += static_cast<T *>(this)->getArithmeticInstrCost(
1272+
Cost += static_cast<const T *>(this)->getArithmeticInstrCost(
12731273
Instruction::Add, GEP->getType(), CostKind,
12741274
{TTI::OK_AnyValue, TTI::OP_None}, {TTI::OK_AnyValue, TTI::OP_None},
12751275
{});
12761276
} else {
12771277
SmallVector<const Value *> Indices(GEP->indices());
1278-
Cost += static_cast<T *>(this)->getGEPCost(GEP->getSourceElementType(),
1279-
GEP->getPointerOperand(),
1280-
Indices, AccessTy, CostKind);
1278+
Cost += static_cast<const T *>(this)->getGEPCost(
1279+
GEP->getSourceElementType(), GEP->getPointerOperand(), Indices,
1280+
AccessTy, CostKind);
12811281
}
12821282
}
12831283
return Cost;
12841284
}
12851285

12861286
InstructionCost getInstructionCost(const User *U,
12871287
ArrayRef<const Value *> Operands,
1288-
TTI::TargetCostKind CostKind) {
1288+
TTI::TargetCostKind CostKind) const {
12891289
using namespace llvm::PatternMatch;
12901290

1291-
auto *TargetTTI = static_cast<T *>(this);
1291+
auto *TargetTTI = static_cast<const T *>(this);
12921292
// Handle non-intrinsic calls, invokes, and callbr.
12931293
// FIXME: Unlikely to be true for anything but CodeSize.
12941294
auto *CB = dyn_cast<CallBase>(U);
@@ -1585,8 +1585,8 @@ class TargetTransformInfoImplCRTPBase : public TargetTransformInfoImplBase {
15851585
return CostKind == TTI::TCK_RecipThroughput ? -1 : TTI::TCC_Basic;
15861586
}
15871587

1588-
bool isExpensiveToSpeculativelyExecute(const Instruction *I) {
1589-
auto *TargetTTI = static_cast<T *>(this);
1588+
bool isExpensiveToSpeculativelyExecute(const Instruction *I) const {
1589+
auto *TargetTTI = static_cast<const T *>(this);
15901590
SmallVector<const Value *, 4> Ops(I->operand_values());
15911591
InstructionCost Cost = TargetTTI->getInstructionCost(
15921592
I, Ops, TargetTransformInfo::TCK_SizeAndLatency);

0 commit comments

Comments
 (0)