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

Kerry McLaughlin via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 11 09:04:51 PST 2026


================
@@ -2660,6 +2660,56 @@ static Value *EmitSpecialRegisterBuiltin(CodeGenFunction &CGF,
   return Builder.CreateCall(F, { Metadata, ArgValue });
 }
 
+static Value *EmitRangePrefetchBuiltin(CodeGenFunction &CGF, unsigned BuiltinID,
+                                       const CallExpr *E) {
+  CodeGen::CGBuilderTy &Builder = CGF.Builder;
+  CodeGen::CodeGenModule &CGM = CGF.CGM;
+  SmallVector<llvm::Value *, 4> Ops;
+
+  auto getIntArg = [&](unsigned ArgNo) {
+    Expr::EvalResult Result;
+    if (!E->getArg(ArgNo)->EvaluateAsInt(Result, CGM.getContext()))
+      llvm_unreachable("Expected constant argument to range prefetch.");
+    return Result.Val.getInt().getExtValue();
----------------
kmclaughlin-arm wrote:

Hi @shafik, I used `getExtValue()` because some of the arguments to the builtin are signed (`Length` and `Stride`). I realise that given how the values are used below that this doesn't change the result though, so I'm happy to change this to `getZExtValue()` if that's preferred?

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


More information about the cfe-commits mailing list