[clang] 1003f5b - [Clang][AArch64] Use 'uint64_t*' for _arm_get_sme_state builtin. (#95982)

via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 19 08:38:50 PDT 2024


Author: Sander de Smalen
Date: 2024-06-19T16:38:46+01:00
New Revision: 1003f5b93e0ab0518e285b861573181942e41930

URL: https://github.com/llvm/llvm-project/commit/1003f5b93e0ab0518e285b861573181942e41930
DIFF: https://github.com/llvm/llvm-project/commit/1003f5b93e0ab0518e285b861573181942e41930.diff

LOG: [Clang][AArch64] Use 'uint64_t*' for _arm_get_sme_state builtin. (#95982)

Depending on the platform, the parameter for __arm_get_sme_state
requires a `unsigned long long*` instead of a `unsigned long*`.

>From ASTContext.cpp:

  case 'W':
    // This modifier represents int64 type.

Added: 
    clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_state_builtin.c

Modified: 
    clang/include/clang/Basic/BuiltinsAArch64.def

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Basic/BuiltinsAArch64.def b/clang/include/clang/Basic/BuiltinsAArch64.def
index 5f53c98167dfb..5fb199b1b2b03 100644
--- a/clang/include/clang/Basic/BuiltinsAArch64.def
+++ b/clang/include/clang/Basic/BuiltinsAArch64.def
@@ -72,7 +72,7 @@ TARGET_BUILTIN(__builtin_arm_stg, "vv*", "t", "mte")
 TARGET_BUILTIN(__builtin_arm_subp, "Uiv*v*", "t", "mte")
 
 // SME state function
-BUILTIN(__builtin_arm_get_sme_state, "vULi*ULi*", "n")
+BUILTIN(__builtin_arm_get_sme_state, "vWUi*WUi*", "n")
 
 // Memory Operations
 TARGET_BUILTIN(__builtin_arm_mops_memset_tag, "v*v*iz", "", "mte,mops")

diff  --git a/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_state_builtin.c b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_state_builtin.c
new file mode 100644
index 0000000000000..f2ef0b3c1a3b5
--- /dev/null
+++ b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_state_builtin.c
@@ -0,0 +1,14 @@
+// REQUIRES: aarch64-registered-target
+// RUN: %clang_cc1 -triple aarch64-linux -S -disable-O0-optnone -Werror -Wall -o /dev/null %s
+// RUN: %clang_cc1 -triple aarch64-windows -S -disable-O0-optnone -Werror -Wall -o /dev/null %s
+// RUN: %clang_cc1 -triple aarch64-darwin -S -disable-O0-optnone -Werror -Wall -o /dev/null %s
+
+#include <stdint.h>
+
+// Ensure that the builtin is defined to take a uint64_t * rather than relying
+// on the size of 'unsigned long' which may have 
diff erent meanings on 
diff erent
+// targets depending on LP64/LLP64.
+void test_sme_state_builtin(uint64_t *a,
+                            uint64_t *b) __arm_streaming_compatible {
+  __builtin_arm_get_sme_state(a, b);
+}


        


More information about the cfe-commits mailing list