[llvm] [clang] [SystemZ] Properly support 16 byte atomic int/fp types and ops. (PR #73134)

Jonas Paulsson via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 24 06:18:20 PST 2023


================
@@ -0,0 +1,42 @@
+// RUN: %clang_cc1 -triple s390x-linux-gnu -O1 -emit-llvm %s -o - | FileCheck %s
+//
+// Test __atomic_is_lock_free() and __atomic_always_lock_free() for __int128
+// with 16 byte alignment.
+
+#include <stdatomic.h>
+#include <stdint.h>
+
+__int128 Int128_Al16 __attribute__((aligned(16)));
+
+// CHECK-LABEL: @fun0
+// CHECK:       tail call zeroext i1 @__atomic_is_lock_free
+_Bool fun0() {
+  return __atomic_is_lock_free(16, &Int128_Al16);
+}
+
+// CHECK-LABEL: @fun1
+// CHECK:       ret i1 false
+_Bool fun1() {
+  return __atomic_always_lock_free(16, &Int128_Al16);
+}
+
+// Also test these with a 16 byte size and null-pointer.
+// CHECK-LABEL: @fun2
+// CHECK:       ret i1 true
+_Bool fun2() {
+  return __atomic_is_lock_free(16, 0);
----------------
JonPsson1 wrote:

> But this seems actually incorrect - when using default assumptions, the operation should not be lock-free ...

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


More information about the cfe-commits mailing list