Skip to content

Commit 95d2d1c

Browse files
authored
Move stepvector intrinsic out of experimental namespace (#98043)
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 77d63cf commit 95d2d1c

File tree

64 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.

64 files changed

+504
-471
lines changed

llvm/docs/LangRef.rst

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

19584-
'``llvm.experimental.stepvector``' Intrinsic
19585-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19584+
'``llvm.stepvector``' Intrinsic
19585+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1958619586

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

1959119591
::
1959219592

19593-
declare <vscale x 4 x i32> @llvm.experimental.stepvector.nxv4i32()
19594-
declare <vscale x 8 x i16> @llvm.experimental.stepvector.nxv8i16()
19593+
declare <vscale x 4 x i32> @llvm.stepvector.nxv4i32()
19594+
declare <vscale x 8 x i16> @llvm.stepvector.nxv8i16()
1959519595

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

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

1960719607

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
@@ -6097,11 +6097,11 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
60976097
&Call);
60986098
break;
60996099
}
6100-
case Intrinsic::experimental_stepvector: {
6100+
case Intrinsic::stepvector: {
61016101
VectorType *VecTy = dyn_cast<VectorType>(Call.getType());
61026102
Check(VecTy && VecTy->getScalarType()->isIntegerTy() &&
61036103
VecTy->getScalarSizeInBits() >= 8,
6104-
"experimental_stepvector only supported for vectors of integers "
6104+
"stepvector only supported for vectors of integers "
61056105
"with a bitwidth of at least 8.",
61066106
&Call);
61076107
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
}

0 commit comments

Comments
 (0)