[clang] 34f8fbd - [Clang][AArch64] svadda is not available in streaming mode

Sander de Smalen via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 11 00:54:55 PST 2024


Author: Sander de Smalen
Date: 2024-11-11T08:53:36Z
New Revision: 34f8fbd269fc0d2d7d527d3661faea3eeb4587ac

URL: https://github.com/llvm/llvm-project/commit/34f8fbd269fc0d2d7d527d3661faea3eeb4587ac
DIFF: https://github.com/llvm/llvm-project/commit/34f8fbd269fc0d2d7d527d3661faea3eeb4587ac.diff

LOG: [Clang][AArch64] svadda is not available in streaming mode

And Clang should give a diagnostic when it is used in a streaming
context.

Added: 
    

Modified: 
    clang/include/clang/Basic/arm_sve.td
    clang/test/Sema/aarch64-incompat-sm-builtin-calls.c

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Basic/arm_sve.td b/clang/include/clang/Basic/arm_sve.td
index 90b1ec242e6bae..1f74e11ab06231 100644
--- a/clang/include/clang/Basic/arm_sve.td
+++ b/clang/include/clang/Basic/arm_sve.td
@@ -880,7 +880,9 @@ def SVRSQRTS : SInst<"svrsqrts[_{d}]", "ddd", "hfd", MergeNone, "aarch64_sve_frs
 ////////////////////////////////////////////////////////////////////////////////
 // Floating-point reductions
 
-def SVFADDA   : SInst<"svadda[_{d}]",   "sPsd", "hfd", MergeNone, "aarch64_sve_fadda", [VerifyRuntimeMode]>;
+let SVETargetGuard = "sve", SMETargetGuard = InvalidMode in {
+def SVFADDA   : SInst<"svadda[_{d}]",   "sPsd", "hfd", MergeNone, "aarch64_sve_fadda">;
+}
 def SVFADDV   : SInst<"svaddv[_{d}]",   "sPd",  "hfd", MergeNone, "aarch64_sve_faddv", [VerifyRuntimeMode]>;
 def SVFMAXV   : SInst<"svmaxv[_{d}]",   "sPd",  "hfd", MergeNone, "aarch64_sve_fmaxv", [VerifyRuntimeMode]>;
 def SVFMAXNMV : SInst<"svmaxnmv[_{d}]", "sPd",  "hfd", MergeNone, "aarch64_sve_fmaxnmv", [VerifyRuntimeMode]>;

diff  --git a/clang/test/Sema/aarch64-incompat-sm-builtin-calls.c b/clang/test/Sema/aarch64-incompat-sm-builtin-calls.c
index 381a21be7bbb9d..27fa8f7c9dccb2 100644
--- a/clang/test/Sema/aarch64-incompat-sm-builtin-calls.c
+++ b/clang/test/Sema/aarch64-incompat-sm-builtin-calls.c
@@ -28,6 +28,16 @@ void incompat_sme_smc(svbool_t pg, void const *ptr) __arm_streaming_compatible _
   return __builtin_sme_svld1_hor_za128(0, 0, pg, ptr);
 }
 
+float incomp_sve_sm_fadda_sm(void) __arm_streaming {
+  // expected-error at +1 {{builtin can only be called from a non-streaming function}}
+  return svadda(svptrue_b32(), 0, svdup_f32(1));
+}
+
+float incomp_sve_sm_fadda_smc(void) __arm_streaming_compatible {
+  // expected-error at +1 {{builtin can only be called from a non-streaming function}}
+  return svadda(svptrue_b32(), 0, svdup_f32(1));
+}
+
 svuint32_t incompat_sve_sm(svbool_t pg, svuint32_t a, int16_t b) __arm_streaming {
   // expected-error at +1 {{builtin can only be called from a non-streaming function}}
   return __builtin_sve_svld1_gather_u32base_index_u32(pg, a, b);


        


More information about the cfe-commits mailing list