[llvm] [IR] Split vector.splice into vector.splice.down and vector.splice.up (PR #170796)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 5 02:09:37 PST 2025
================
@@ -20738,21 +20738,70 @@ This is an overloaded intrinsic.
::
- declare <2 x double> @llvm.vector.splice.v2f64(<2 x double> %vec1, <2 x double> %vec2, i32 %imm)
- declare <vscale x 4 x i32> @llvm.vector.splice.nxv4i32(<vscale x 4 x i32> %vec1, <vscale x 4 x i32> %vec2, i32 %imm)
+ declare <2 x double> @llvm.vector.splice.down.v2f64(<2 x double> %vec1, <2 x double> %vec2, i32 %imm)
+ declare <vscale x 4 x i32> @llvm.vector.splice.down.nxv4i32(<vscale x 4 x i32> %vec1, <vscale x 4 x i32> %vec2, i32 %imm)
Overview:
"""""""""
-The '``llvm.vector.splice.*``' intrinsics construct a vector by
-concatenating elements from the first input vector with elements of the second
-input vector, returning a vector of the same type as the input vectors. The
-signed immediate, modulo the number of elements in the vector, is the index
-into the first vector from which to extract the result value. This means
-conceptually that for a positive immediate, a vector is extracted from
-``concat(%vec1, %vec2)`` starting at index ``imm``, whereas for a negative
-immediate, it extracts ``-imm`` trailing elements from the first vector, and
-the remaining elements from ``%vec2``.
+The '``llvm.vector.splice.down.*``' intrinsics construct a vector by
+concatenating two vectors together, shifting the elements down by ``imm``, and
----------------
lukel97 wrote:
I guess up/down comes from up moving elements to higher indices, and down to lower indices. And I may be a bit biased coming from the RISC-V side of things where we have the vslideup/vslidedown instructions.
So happy to go with a more target agnostic term, left/right sounds good to me.
The one caveat to be aware of though is that IIUC we write vectors with the lowest indexed element on the left. Integers are written with the least signifcant digit on the right. So I think the left and right get swapped when comparing to a funnel shift:
```
llvm.vector.shift.left(<0, 1, 2, 3>, <4, 5, 6, 7>, 1) => <1,2,3,4>
llvm.fshr(0b7654, 0b3210, 1) => 0b4321
```
I don't think that's a major concern though.
https://github.com/llvm/llvm-project/pull/170796
More information about the llvm-commits
mailing list