[clang] [RISCV] Support XSfmm C intrinsics (PR #143070)

Craig Topper via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 20 09:45:37 PDT 2025


================
@@ -708,8 +708,37 @@ bool SemaRISCV::CheckBuiltinFunctionCall(const TargetInfo &TI,
     return SemaRef.BuiltinConstantArgRange(TheCall, 0, 0, 15) ||
            SemaRef.BuiltinConstantArgMultiple(TheCall, 0, 4);
   }
-  case RISCVVector::BI__builtin_rvv_sf_vtzero_t:
-    return SemaRef.BuiltinConstantArgRange(TheCall, 0, 0, 15);
+  case RISCVVector::BI__builtin_rvv_sf_vtzero_t: {
+    llvm::APSInt Log2SEWResult;
+    llvm::APSInt TWidenResult;
+    if (SemaRef.BuiltinConstantArg(TheCall, 3, Log2SEWResult) ||
+        SemaRef.BuiltinConstantArg(TheCall, 4, TWidenResult))
+      return true;
+
+    int Log2SEW = Log2SEWResult.getSExtValue();
----------------
topperc wrote:

Should we check for valid values before we use them?

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


More information about the cfe-commits mailing list