[clang] [CIR] Upstream shift operators for VectorType (PR #139465)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Mon May 12 10:19:53 PDT 2025
================
@@ -1401,18 +1401,19 @@ def ShiftOp : CIR_Op<"shift", [Pure]> {
The `cir.shift` operation performs a bitwise shift, either to the left or to
the right, based on the first operand. The second operand specifies the
value to be shifted, and the third operand determines the number of
- positions by which the shift is applied. Both the second and third operands
- are required to be integers.
+ positions by which the shift is applied, they must be either all vector of
+ integer type, or all integer type. If they are vectors, each vector element of
+ the shift target is shifted by the corresponding shift amount in
+ the shift amount vector.
```mlir
- %7 = cir.shift(left, %1 : !u64i, %4 : !s32i) -> !u64i
+ %res = cir.shift(left, %lhs : !u64i, %amount : !s32i) -> !u64i
+ %new_vec = cir.shift(left, %lhs : !cir.vector<2 x !s32i>, %rhs : !cir.vector<2 x !s32i>) -> !cir.vector<2 x !s32i>
----------------
andykaylor wrote:
Can you reformat this to fit in 80 columns?
https://github.com/llvm/llvm-project/pull/139465
More information about the cfe-commits
mailing list