[clang] [llvm] [AArch64] Add support for range prefetch intrinsic (PR #170490)

Paul Walker via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 17 05:40:02 PST 2025


================
@@ -6701,6 +6701,38 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
           "isdata argument to llvm.aarch64.prefetch must be 0 or 1", Call);
     break;
   }
+  case Intrinsic::aarch64_range_prefetch_reg: {
+    Check(cast<ConstantInt>(Call.getArgOperand(1))->getZExtValue() < 2,
+          "write argument to llvm.aarch64.range.prefetch.reg must be 0 or 1",
+          Call);
+    Check(cast<ConstantInt>(Call.getArgOperand(2))->getZExtValue() < 2,
+          "stream argument to llvm.aarch64.range.prefetch.reg must be 0 or 1",
+          Call);
+    break;
+  }
+  case Intrinsic::aarch64_range_prefetch_imm: {
+    Check(cast<ConstantInt>(Call.getArgOperand(1))->getZExtValue() < 2,
+          "write argument to llvm.aarch64.range.prefetch.imm must be 0 or 1",
+          Call);
+    Check(cast<ConstantInt>(Call.getArgOperand(2))->getZExtValue() < 2,
+          "stream argument to llvm.aarch64.range.prefetch.imm must be 0 or 1",
+          Call);
+    int Length = cast<ConstantInt>(Call.getArgOperand(3))->getZExtValue();
+    Check(Length > -2049 && Length < 2041,
+          "length argument to llvm.aarch64.range.prefetch.imm must be -2048 - "
+          "2040",
+          Call);
----------------
paulwalker-arm wrote:

As above, I think the range here is too small.  Up to you but perhaps using `isIntN` will make the range more obvious, likewise you could just say "must be a signed 21-bit integer". 

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


More information about the cfe-commits mailing list