[clang] [Clang][AArch64] Diagnose invalid FPM scale arguments (PR #227722)

Martin Wehking via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 1 03:19:10 PDT 2026


================
@@ -1345,6 +1364,15 @@ bool SemaARM::CheckAArch64BuiltinFunctionCall(const TargetInfo &TI,
   if (CheckSMEBuiltinFunctionCall(BuiltinID, TheCall))
     return true;
 
+  if (BuiltinID == AArch64::BI__arm_set_fpm_lscale)
+    return checkFPMScaleIfConstant(SemaRef, TheCall, 1, 0, 127);
+
+  if (BuiltinID == AArch64::BI__arm_set_fpm_nscale)
+    return checkFPMScaleIfConstant(SemaRef, TheCall, 1, -128, 127);
+
+  if (BuiltinID == AArch64::BI__arm_set_fpm_lscale2)
+    return checkFPMScaleIfConstant(SemaRef, TheCall, 1, 0, UINT32_MAX);
----------------
MartinWehking wrote:

The ACLE says that the range for `scale` for lscale 2 is: [0, 63].
Is there a reason vals > 63 are accepted by your patch?

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


More information about the cfe-commits mailing list