Skip to content

Commit cca6465

Browse files
committed
Move stepvector intrinsic out of experimental namespace
This patch is moving out stepvector intrinsic from the experimental namespace. This intrinsic exists in LLVM for several years now, and is widely used.
1 parent f673882 commit cca6465

File tree

65 files changed

+504
-471
lines changed

Some content is hidden

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

65 files changed

+504
-471
lines changed

llvm/docs/LangRef.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19576,27 +19576,27 @@ vector <N x eltty>, imm is a signed integer constant in the range
1957619576
-N <= imm < N. For a scalable vector <vscale x N x eltty>, imm is a signed
1957719577
integer constant in the range -X <= imm < X where X=vscale_range_min * N.
1957819578

19579-
'``llvm.experimental.stepvector``' Intrinsic
19580-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19579+
'``llvm.stepvector``' Intrinsic
19580+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1958119581

19582-
This is an overloaded intrinsic. You can use ``llvm.experimental.stepvector``
19582+
This is an overloaded intrinsic. You can use ``llvm.stepvector``
1958319583
to generate a vector whose lane values comprise the linear sequence
1958419584
<0, 1, 2, ...>. It is primarily intended for scalable vectors.
1958519585

1958619586
::
1958719587

19588-
declare <vscale x 4 x i32> @llvm.experimental.stepvector.nxv4i32()
19589-
declare <vscale x 8 x i16> @llvm.experimental.stepvector.nxv8i16()
19588+
declare <vscale x 4 x i32> @llvm.stepvector.nxv4i32()
19589+
declare <vscale x 8 x i16> @llvm.stepvector.nxv8i16()
1959019590

19591-
The '``llvm.experimental.stepvector``' intrinsics are used to create vectors
19591+
The '``llvm.stepvector``' intrinsics are used to create vectors
1959219592
of integers whose elements contain a linear sequence of values starting from 0
19593-
with a step of 1. This experimental intrinsic can only be used for vectors
19594-
with integer elements that are at least 8 bits in size. If the sequence value
19595-
exceeds the allowed limit for the element type then the result for that lane is
19596-
undefined.
19593+
with a step of 1. This intrinsic can only be used for vectors with integer
19594+
elements that are at least 8 bits in size. If the sequence value exceeds
19595+
the allowed limit for the element type then the result for that lane is
19596+
a poison value.
1959719597

1959819598
These intrinsics work for both fixed and scalable vectors. While this intrinsic
19599-
is marked as experimental, the recommended way to express this operation for
19599+
supports all vector types, the recommended way to express this operation for
1960019600
fixed-width vectors is still to generate a constant vector instead.
1960119601

1960219602

llvm/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ Changes to the LLVM IR
5252

5353
* The ``x86_mmx`` IR type has been removed. It will be translated to
5454
the standard vector type ``<1 x i64>`` in bitcode upgrade.
55+
* Renamed ``llvm.experimental.stepvector`` intrinsic to ``llvm.stepvector``.
5556

5657
Changes to LLVM infrastructure
5758
------------------------------

llvm/include/llvm/CodeGen/BasicTTIImpl.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1641,7 +1641,7 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
16411641
return thisT()->getStridedMemoryOpCost(Instruction::Load, RetTy, Ptr,
16421642
VarMask, Alignment, CostKind, I);
16431643
}
1644-
case Intrinsic::experimental_stepvector: {
1644+
case Intrinsic::stepvector: {
16451645
if (isa<ScalableVectorType>(RetTy))
16461646
return BaseT::getIntrinsicInstrCost(ICA, CostKind);
16471647
// The cost of materialising a constant integer vector.
@@ -1789,8 +1789,8 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
17891789
Type *NewVecTy = VectorType::get(
17901790
NewEltTy, cast<VectorType>(Args[0]->getType())->getElementCount());
17911791

1792-
IntrinsicCostAttributes StepVecAttrs(Intrinsic::experimental_stepvector,
1793-
NewVecTy, {}, FMF);
1792+
IntrinsicCostAttributes StepVecAttrs(Intrinsic::stepvector, NewVecTy, {},
1793+
FMF);
17941794
InstructionCost Cost =
17951795
thisT()->getIntrinsicInstrCost(StepVecAttrs, CostKind);
17961796

llvm/include/llvm/IR/Intrinsics.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1846,8 +1846,8 @@ def int_threadlocal_address : DefaultAttrsIntrinsic<[llvm_anyptr_ty], [LLVMMatch
18461846
[NonNull<RetIndex>, NonNull<ArgIndex<0>>,
18471847
IntrNoMem, IntrSpeculatable, IntrWillReturn]>;
18481848

1849-
def int_experimental_stepvector : DefaultAttrsIntrinsic<[llvm_anyvector_ty],
1850-
[], [IntrNoMem]>;
1849+
def int_stepvector : DefaultAttrsIntrinsic<[llvm_anyvector_ty],
1850+
[], [IntrNoMem]>;
18511851

18521852
//===---------------- Vector Predication Intrinsics --------------===//
18531853
// Memory Intrinsics

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7781,7 +7781,7 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
77817781
case Intrinsic::experimental_deoptimize:
77827782
LowerDeoptimizeCall(&I);
77837783
return;
7784-
case Intrinsic::experimental_stepvector:
7784+
case Intrinsic::stepvector:
77857785
visitStepVector(I);
77867786
return;
77877787
case Intrinsic::vector_reduce_fadd:

llvm/lib/IR/AutoUpgrade.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,6 +1168,13 @@ static bool upgradeIntrinsicFunction1(Function *F, Function *&NewFn,
11681168
}
11691169
break; // No other 'experimental.vector.*'.
11701170
}
1171+
if (Name.consume_front("experimental.stepvector.")) {
1172+
Intrinsic::ID ID = Intrinsic::stepvector;
1173+
rename(F);
1174+
NewFn = Intrinsic::getDeclaration(F->getParent(), ID,
1175+
F->getFunctionType()->getReturnType());
1176+
return true;
1177+
}
11711178
break; // No other 'e*'.
11721179
case 'f':
11731180
if (Name.starts_with("flt.rounds")) {

llvm/lib/IR/IRBuilder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ Value *IRBuilderBase::CreateStepVector(Type *DstType, const Twine &Name) {
117117
if (STy->getScalarSizeInBits() < 8)
118118
StepVecType =
119119
VectorType::get(getInt8Ty(), cast<ScalableVectorType>(DstType));
120-
Value *Res = CreateIntrinsic(Intrinsic::experimental_stepvector,
121-
{StepVecType}, {}, nullptr, Name);
120+
Value *Res = CreateIntrinsic(Intrinsic::stepvector, {StepVecType}, {},
121+
nullptr, Name);
122122
if (StepVecType != DstType)
123123
Res = CreateTrunc(Res, DstType);
124124
return Res;

llvm/lib/IR/Verifier.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6112,11 +6112,11 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
61126112
&Call);
61136113
break;
61146114
}
6115-
case Intrinsic::experimental_stepvector: {
6115+
case Intrinsic::stepvector: {
61166116
VectorType *VecTy = dyn_cast<VectorType>(Call.getType());
61176117
Check(VecTy && VecTy->getScalarType()->isIntegerTy() &&
61186118
VecTy->getScalarSizeInBits() >= 8,
6119-
"experimental_stepvector only supported for vectors of integers "
6119+
"stepvector only supported for vectors of integers "
61206120
"with a bitwidth of at least 8.",
61216121
&Call);
61226122
break;

llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ AArch64TTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
605605
return LT.first;
606606
break;
607607
}
608-
case Intrinsic::experimental_stepvector: {
608+
case Intrinsic::stepvector: {
609609
InstructionCost Cost = 1; // Cost of the `index' instruction
610610
auto LT = getTypeLegalizationCost(RetTy);
611611
// Legalisation of illegal vectors involves an `index' instruction plus

llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ static std::pair<Value *, Value *> matchStridedStart(Value *Start,
127127
return matchStridedConstant(StartC);
128128

129129
// Base case, start is a stepvector
130-
if (match(Start, m_Intrinsic<Intrinsic::experimental_stepvector>())) {
130+
if (match(Start, m_Intrinsic<Intrinsic::stepvector>())) {
131131
auto *Ty = Start->getType()->getScalarType();
132132
return std::make_pair(ConstantInt::get(Ty, 0), ConstantInt::get(Ty, 1));
133133
}

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ RISCVTTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
920920
break;
921921
}
922922
// TODO: add more intrinsic
923-
case Intrinsic::experimental_stepvector: {
923+
case Intrinsic::stepvector: {
924924
auto LT = getTypeLegalizationCost(RetTy);
925925
// Legalisation of illegal types involves an `index' instruction plus
926926
// (LT.first - 1) vector adds.

llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static bool cheapToScalarize(Value *V, Value *EI) {
6262
if (auto *C = dyn_cast<Constant>(V))
6363
return CEI || C->getSplatValue();
6464

65-
if (CEI && match(V, m_Intrinsic<Intrinsic::experimental_stepvector>())) {
65+
if (CEI && match(V, m_Intrinsic<Intrinsic::stepvector>())) {
6666
ElementCount EC = cast<VectorType>(V->getType())->getElementCount();
6767
// Index needs to be lower than the minimum size of the vector, because
6868
// for scalable vector, the vector size is known at run time.
@@ -433,8 +433,7 @@ Instruction *InstCombinerImpl::visitExtractElementInst(ExtractElementInst &EI) {
433433
Intrinsic::ID IID = II->getIntrinsicID();
434434
// Index needs to be lower than the minimum size of the vector, because
435435
// for scalable vector, the vector size is known at run time.
436-
if (IID == Intrinsic::experimental_stepvector &&
437-
IndexC->getValue().ult(NumElts)) {
436+
if (IID == Intrinsic::stepvector && IndexC->getValue().ult(NumElts)) {
438437
Type *Ty = EI.getType();
439438
unsigned BitWidth = Ty->getIntegerBitWidth();
440439
Value *Idx;

llvm/test/Analysis/CostModel/AArch64/neon-stepvector.ll

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,36 @@ target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
66
; Check icmp for legal integer vectors.
77
define void @stepvector_legal_int() {
88
; CHECK-LABEL: 'stepvector_legal_int'
9-
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = call <2 x i64> @llvm.experimental.stepvector.v2i64()
10-
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %2 = call <4 x i32> @llvm.experimental.stepvector.v4i32()
11-
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %3 = call <8 x i16> @llvm.experimental.stepvector.v8i16()
12-
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %4 = call <16 x i8> @llvm.experimental.stepvector.v16i8()
9+
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = call <2 x i64> @llvm.stepvector.v2i64()
10+
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %2 = call <4 x i32> @llvm.stepvector.v4i32()
11+
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %3 = call <8 x i16> @llvm.stepvector.v8i16()
12+
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %4 = call <16 x i8> @llvm.stepvector.v16i8()
1313
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
1414
;
15-
%1 = call <2 x i64> @llvm.experimental.stepvector.v2i64()
16-
%2 = call <4 x i32> @llvm.experimental.stepvector.v4i32()
17-
%3 = call <8 x i16> @llvm.experimental.stepvector.v8i16()
18-
%4 = call <16 x i8> @llvm.experimental.stepvector.v16i8()
15+
%1 = call <2 x i64> @llvm.stepvector.v2i64()
16+
%2 = call <4 x i32> @llvm.stepvector.v4i32()
17+
%3 = call <8 x i16> @llvm.stepvector.v8i16()
18+
%4 = call <16 x i8> @llvm.stepvector.v16i8()
1919
ret void
2020
}
2121

2222
; Check icmp for an illegal integer vector.
2323
define void @stepvector_illegal_int() {
2424
; CHECK-LABEL: 'stepvector_illegal_int'
25-
; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %1 = call <4 x i64> @llvm.experimental.stepvector.v4i64()
26-
; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %2 = call <16 x i32> @llvm.experimental.stepvector.v16i32()
25+
; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %1 = call <4 x i64> @llvm.stepvector.v4i64()
26+
; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %2 = call <16 x i32> @llvm.stepvector.v16i32()
2727
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
2828
;
29-
%1 = call <4 x i64> @llvm.experimental.stepvector.v4i64()
30-
%2 = call <16 x i32> @llvm.experimental.stepvector.v16i32()
29+
%1 = call <4 x i64> @llvm.stepvector.v4i64()
30+
%2 = call <16 x i32> @llvm.stepvector.v16i32()
3131
ret void
3232
}
3333

3434

35-
declare <2 x i64> @llvm.experimental.stepvector.v2i64()
36-
declare <4 x i32> @llvm.experimental.stepvector.v4i32()
37-
declare <8 x i16> @llvm.experimental.stepvector.v8i16()
38-
declare <16 x i8> @llvm.experimental.stepvector.v16i8()
35+
declare <2 x i64> @llvm.stepvector.v2i64()
36+
declare <4 x i32> @llvm.stepvector.v4i32()
37+
declare <8 x i16> @llvm.stepvector.v8i16()
38+
declare <16 x i8> @llvm.stepvector.v16i8()
3939

40-
declare <4 x i64> @llvm.experimental.stepvector.v4i64()
41-
declare <16 x i32> @llvm.experimental.stepvector.v16i32()
40+
declare <4 x i64> @llvm.stepvector.v4i64()
41+
declare <16 x i32> @llvm.stepvector.v16i32()

llvm/test/Analysis/CostModel/AArch64/sve-stepvector.ll

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,32 @@ target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
55
; Check icmp for legal integer vectors.
66
define void @stepvector_legal_int() {
77
; CHECK-LABEL: 'stepvector_legal_int'
8-
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %1 = call <vscale x 2 x i64> @llvm.experimental.stepvector.nxv2i64()
9-
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %2 = call <vscale x 4 x i32> @llvm.experimental.stepvector.nxv4i32()
10-
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %3 = call <vscale x 8 x i16> @llvm.experimental.stepvector.nxv8i16()
11-
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %4 = call <vscale x 16 x i8> @llvm.experimental.stepvector.nxv16i8()
12-
%1 = call <vscale x 2 x i64> @llvm.experimental.stepvector.nxv2i64()
13-
%2 = call <vscale x 4 x i32> @llvm.experimental.stepvector.nxv4i32()
14-
%3 = call <vscale x 8 x i16> @llvm.experimental.stepvector.nxv8i16()
15-
%4 = call <vscale x 16 x i8> @llvm.experimental.stepvector.nxv16i8()
8+
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %1 = call <vscale x 2 x i64> @llvm.stepvector.nxv2i64()
9+
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %2 = call <vscale x 4 x i32> @llvm.stepvector.nxv4i32()
10+
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %3 = call <vscale x 8 x i16> @llvm.stepvector.nxv8i16()
11+
; CHECK: Cost Model: Found an estimated cost of 1 for instruction: %4 = call <vscale x 16 x i8> @llvm.stepvector.nxv16i8()
12+
%1 = call <vscale x 2 x i64> @llvm.stepvector.nxv2i64()
13+
%2 = call <vscale x 4 x i32> @llvm.stepvector.nxv4i32()
14+
%3 = call <vscale x 8 x i16> @llvm.stepvector.nxv8i16()
15+
%4 = call <vscale x 16 x i8> @llvm.stepvector.nxv16i8()
1616
ret void
1717
}
1818

1919
; Check icmp for an illegal integer vector.
2020
define void @stepvector_illegal_int() {
2121
; CHECK-LABEL: 'stepvector_illegal_int'
22-
; CHECK: Cost Model: Found an estimated cost of 2 for instruction: %1 = call <vscale x 4 x i64> @llvm.experimental.stepvector.nxv4i64()
23-
; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %2 = call <vscale x 16 x i32> @llvm.experimental.stepvector.nxv16i32()
24-
%1 = call <vscale x 4 x i64> @llvm.experimental.stepvector.nxv4i64()
25-
%2 = call <vscale x 16 x i32> @llvm.experimental.stepvector.nxv16i32()
22+
; CHECK: Cost Model: Found an estimated cost of 2 for instruction: %1 = call <vscale x 4 x i64> @llvm.stepvector.nxv4i64()
23+
; CHECK: Cost Model: Found an estimated cost of 4 for instruction: %2 = call <vscale x 16 x i32> @llvm.stepvector.nxv16i32()
24+
%1 = call <vscale x 4 x i64> @llvm.stepvector.nxv4i64()
25+
%2 = call <vscale x 16 x i32> @llvm.stepvector.nxv16i32()
2626
ret void
2727
}
2828

2929

30-
declare <vscale x 2 x i64> @llvm.experimental.stepvector.nxv2i64()
31-
declare <vscale x 4 x i32> @llvm.experimental.stepvector.nxv4i32()
32-
declare <vscale x 8 x i16> @llvm.experimental.stepvector.nxv8i16()
33-
declare <vscale x 16 x i8> @llvm.experimental.stepvector.nxv16i8()
30+
declare <vscale x 2 x i64> @llvm.stepvector.nxv2i64()
31+
declare <vscale x 4 x i32> @llvm.stepvector.nxv4i32()
32+
declare <vscale x 8 x i16> @llvm.stepvector.nxv8i16()
33+
declare <vscale x 16 x i8> @llvm.stepvector.nxv16i8()
3434

35-
declare <vscale x 4 x i64> @llvm.experimental.stepvector.nxv4i64()
36-
declare <vscale x 16 x i32> @llvm.experimental.stepvector.nxv16i32()
35+
declare <vscale x 4 x i64> @llvm.stepvector.nxv4i64()
36+
declare <vscale x 16 x i32> @llvm.stepvector.nxv16i32()

0 commit comments

Comments
 (0)