[llvm] [GlobalISel] Import llvm.stepvector (PR #115721)

Thorsten Schütt via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 11 12:15:46 PST 2024


================
@@ -2597,6 +2597,10 @@ bool IRTranslator::translateKnownIntrinsic(const CallInst &CI, Intrinsic::ID ID,
     return translateExtractVector(CI, MIRBuilder);
   case Intrinsic::vector_insert:
     return translateInsertVector(CI, MIRBuilder);
+  case Intrinsic::stepvector: {
+    MIRBuilder.buildStepVector(getOrCreateVReg(CI), 1);
----------------
tschuett wrote:

The LLVM-IR intrinsics has an implicit factor of one:
https://llvm.org/docs/LangRef.html#llvm-stepvector-intrinsic
For GlobalISel, we have a real factor:
https://github.com/llvm/llvm-project/pull/115598

G_STEP_VECTOR is a cheap name for the AArch64 
INDEX (immediates)
instruction.

We and the DAG did the same for the vscale intrinsic:
https://llvm.org/docs/GlobalISel/GenericOpcode.html#g-vscale
The standard vscale pattern takes a scale, while the LLVM-IR intrinsic doesn't:
`def : Pat<(vscale GPR64:$scale), (MADDXrrr (UBFMXri (RDVLI_XI 1), 4, 63), $scale, XZR)>;`


https://github.com/llvm/llvm-project/pull/115721


More information about the llvm-commits mailing list