Index: llvm/docs/LangRef.rst =================================================================== --- llvm/docs/LangRef.rst +++ llvm/docs/LangRef.rst @@ -17223,9 +17223,8 @@ The '``llvm.experimental.stepvector``' intrinsics are used to create vectors of integers whose elements contain a linear sequence of values starting from 0 with a step of 1. This experimental intrinsic can only be used for vectors -with integer elements that are at least 8 bits in size. If the sequence value -exceeds the allowed limit for the element type then the result for that lane is -undefined. +with integer elements. If the sequence value exceeds the allowed limit for +the element type then the result for that lane is undefined. These intrinsics work for both fixed and scalable vectors. While this intrinsic is marked as experimental, the recommended way to express this operation for Index: llvm/lib/IR/Verifier.cpp =================================================================== --- llvm/lib/IR/Verifier.cpp +++ llvm/lib/IR/Verifier.cpp @@ -5316,10 +5316,8 @@ } case Intrinsic::experimental_stepvector: { VectorType *VecTy = dyn_cast(Call.getType()); - Assert(VecTy && VecTy->getScalarType()->isIntegerTy() && - VecTy->getScalarSizeInBits() >= 8, - "experimental_stepvector only supported for vectors of integers " - "with a bitwidth of at least 8.", + Assert(VecTy && VecTy->getScalarType()->isIntegerTy(), + "experimental_stepvector only supported for vectors of integers.", &Call); break; } Index: llvm/test/CodeGen/AArch64/sve-stepvector.ll =================================================================== --- llvm/test/CodeGen/AArch64/sve-stepvector.ll +++ llvm/test/CodeGen/AArch64/sve-stepvector.ll @@ -43,6 +43,27 @@ ret %0 } +; Integer element types that need promoting +define @stepvector_nxv2i3() { +; CHECK-LABEL: stepvector_nxv2i3: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: index z0.d, #0, #1 +; CHECK-NEXT: ret +entry: + %0 = call @llvm.experimental.stepvector.nxv2i3() + ret %0 +} + +define @stepvector_nxv4i31() { +; CHECK-LABEL: stepvector_nxv4i31: +; CHECK: // %bb.0: // %entry +; CHECK-NEXT: index z0.s, #0, #1 +; CHECK-NEXT: ret +entry: + %0 = call @llvm.experimental.stepvector.nxv4i31() + ret %0 +} + ; ILLEGAL INTEGER TYPES define @stepvector_nxv4i64() { @@ -405,6 +426,8 @@ declare @llvm.experimental.stepvector.nxv4i32() declare @llvm.experimental.stepvector.nxv8i16() declare @llvm.experimental.stepvector.nxv16i8() +declare @llvm.experimental.stepvector.nxv2i3() +declare @llvm.experimental.stepvector.nxv4i31() declare @llvm.experimental.stepvector.nxv4i64() declare @llvm.experimental.stepvector.nxv16i32() Index: llvm/test/Verifier/stepvector-intrinsic.ll =================================================================== --- llvm/test/Verifier/stepvector-intrinsic.ll +++ llvm/test/Verifier/stepvector-intrinsic.ll @@ -11,19 +11,10 @@ ; Reject vectors with non-integer elements define @stepvector_float() { -; CHECK: experimental_stepvector only supported for vectors of integers with a bitwidth of at least 8 +; CHECK: experimental_stepvector only supported for vectors of integers. %1 = call @llvm.experimental.stepvector.nxv4f32() ret %1 } -; Reject vectors of integers less than 8 bits in width - -define @stepvector_i1() { -; CHECK: experimental_stepvector only supported for vectors of integers with a bitwidth of at least 8 - %1 = call @llvm.experimental.stepvector.nxv16i1() - ret %1 -} - declare i32 @llvm.experimental.stepvector.i32() declare @llvm.experimental.stepvector.nxv4f32() -declare @llvm.experimental.stepvector.nxv16i1()