[clang] [llvm] [AArch64] Implement GCS ACLE intrinsics (PR #96903)

Sam Elliott via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 27 06:50:19 PDT 2024


================
@@ -855,6 +863,25 @@ __rndrrs(uint64_t *__p) {
 }
 #endif
 
+/* 11.2 Guarded Control Stack intrinsics */
+#if defined(__ARM_64BIT_STATE) && __ARM_64BIT_STATE
+static __inline__ void * __attribute__((__always_inline__, __nodebug__))
+__gcspr() {
+  return (void *)__builtin_arm_rsr64("gcspr_el0");
+}
+
+static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__, target("gcs")))
+__gcspopm() {
+  return __builtin_arm_gcspopm(0);
+}
+
+static __inline__ const void * __attribute__((__always_inline__, __nodebug__, target("gcs")))
+__gcsss(const void *__stack) {
+  __builtin_arm_gcsss1(__stack);
+  return __builtin_arm_gcsss2(0);
+}
----------------
lenary wrote:

Would we ever expect these builtins to be called separately? If not, what's the rationale for having two of them, rather than one that does both operations?

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


More information about the cfe-commits mailing list