[clang] [CIR][AArch64] add vshr_* builtins (PR #186693)

Andrzej WarzyƄski via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 16 08:19:56 PDT 2026


================
@@ -831,6 +831,69 @@ static cir::VectorType getNeonType(CIRGenFunction *cgf, NeonTypeFlags typeFlags,
   llvm_unreachable("Unknown vector element type!");
 }
 
+// Get integer from a mlir::Value that is an int constant or a constant op.
+static int64_t getIntValueFromConstOp(mlir::Value val) {
+  return val.getDefiningOp<cir::ConstantOp>().getIntValue().getSExtValue();
+}
+
+// Build a constant shift amount vector of `vecTy` to shift a vector
+// Here `shitfVal` is a constant integer that will be splated into a
+// a const vector of `vecTy` which is the return of this function
+static mlir::Value emitNeonShiftVector(CIRGenBuilderTy &builder,
+                                       mlir::Value shiftVal,
+                                       cir::VectorType vecTy,
+                                       mlir::Location loc, bool neg) {
+  int shiftAmt = getIntValueFromConstOp(shiftVal);
+  if (neg)
+    shiftAmt = -shiftAmt;
----------------
banach-space wrote:

Looks like `neg` can be skipped entirely in this PR.

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


More information about the cfe-commits mailing list