Skip to content

Commit fa1810f

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 2ef7cbf commit fa1810f

File tree

62 files changed

+494
-461
lines changed

Some content is hidden

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

62 files changed

+494
-461
lines changed

llvm/docs/LangRef.rst

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

19365-
'``llvm.experimental.stepvector``' Intrinsic
19366-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19365+
'``llvm.stepvector``' Intrinsic
19366+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1936719367

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

1937219372
::
1937319373

19374-
declare <vscale x 4 x i32> @llvm.experimental.stepvector.nxv4i32()
19375-
declare <vscale x 8 x i16> @llvm.experimental.stepvector.nxv8i16()
19374+
declare <vscale x 4 x i32> @llvm.stepvector.nxv4i32()
19375+
declare <vscale x 8 x i16> @llvm.stepvector.nxv8i16()
1937619376

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

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

1938819388

llvm/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ Changes to the LLVM IR
6161
* Renamed ``llvm.experimental.vector.splice`` intrinsic to ``llvm.vector.splice``.
6262
* Renamed ``llvm.experimental.vector.interleave2`` intrinsic to ``llvm.vector.interleave2``.
6363
* Renamed ``llvm.experimental.vector.deinterleave2`` intrinsic to ``llvm.vector.deinterleave2``.
64+
* Renamed ``llvm.experimental.stepvector`` intrinsic to ``llvm.stepvector``.
6465
* The constant expression variants of the following instructions have been
6566
removed:
6667

llvm/include/llvm/CodeGen/BasicTTIImpl.h

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

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

llvm/include/llvm/IR/Intrinsics.td

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

1841-
def int_experimental_stepvector : DefaultAttrsIntrinsic<[llvm_anyvector_ty],
1842-
[], [IntrNoMem]>;
1841+
def int_stepvector : DefaultAttrsIntrinsic<[llvm_anyvector_ty],
1842+
[], [IntrNoMem]>;
18431843

18441844
//===---------------- Vector Predication Intrinsics --------------===//
18451845
// Memory Intrinsics

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7764,7 +7764,7 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
77647764
case Intrinsic::experimental_deoptimize:
77657765
LowerDeoptimizeCall(&I);
77667766
return;
7767-
case Intrinsic::experimental_stepvector:
7767+
case Intrinsic::stepvector:
77687768
visitStepVector(I);
77697769
return;
77707770
case Intrinsic::vector_reduce_fadd:

llvm/lib/IR/AutoUpgrade.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,6 +1166,13 @@ static bool upgradeIntrinsicFunction1(Function *F, Function *&NewFn,
11661166
}
11671167
break; // No other 'experimental.vector.*'.
11681168
}
1169+
if (Name.consume_front("experimental.stepvector.")) {
1170+
Intrinsic::ID ID = Intrinsic::stepvector;
1171+
rename(F);
1172+
NewFn = Intrinsic::getDeclaration(F->getParent(), ID,
1173+
F->getFunctionType()->getReturnType());
1174+
return true;
1175+
}
11691176
break; // No other 'e*'.
11701177
case 'f':
11711178
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
@@ -6086,11 +6086,11 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
60866086
&Call);
60876087
break;
60886088
}
6089-
case Intrinsic::experimental_stepvector: {
6089+
case Intrinsic::stepvector: {
60906090
VectorType *VecTy = dyn_cast<VectorType>(Call.getType());
60916091
Check(VecTy && VecTy->getScalarType()->isIntegerTy() &&
60926092
VecTy->getScalarSizeInBits() >= 8,
6093-
"experimental_stepvector only supported for vectors of integers "
6093+
"stepvector only supported for vectors of integers "
60946094
"with a bitwidth of at least 8.",
60956095
&Call);
60966096
break;

llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ AArch64TTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
596596
return LT.first;
597597
break;
598598
}
599-
case Intrinsic::experimental_stepvector: {
599+
case Intrinsic::stepvector: {
600600
InstructionCost Cost = 1; // Cost of the `index' instruction
601601
auto LT = getTypeLegalizationCost(RetTy);
602602
// 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)