brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.4 KiB · 32c436e Raw
99 lines · c
1// RUN: %clang_cc1 -triple s390x-linux-gnu -O1 -emit-llvm %s -o - | FileCheck %s2//3// Test __atomic_is_lock_free() and friends.4 5#include <stdatomic.h>6#include <stdint.h>7 8typedef __attribute__((aligned(16))) __int128 __int128_Al16;9 10_Atomic __int128 Int128_Atomic;11__int128_Al16    Int128_Al16;12__int128         Int128;13struct { int I[3]; } _Atomic AtomicStruct;14_Atomic long double Atomic_fp128; // Also check the alignment of this.15 16// Check alignments of the variables. @AtomicStruct gets padded and its size17// and alignment becomes 16. Only a power-of-2 size is considered, so 16 (not18// 12) needs to be specified with the intrinsics below.19//20// CHECK: %struct.anon = type { [3 x i32] }21// CHECK: @Int128 = {{.*}} i128 0, align 822// CHECK: @Int128_Atomic = {{.*}} i128 0, align 1623// CHECK: @Int128_Al16 = {{.*}} i128 0, align 1624// CHECK: @AtomicStruct = {{.*}} { %struct.anon, [4 x i8] } zeroinitializer, align 1625// CHECK: @Atomic_fp128 = {{.*}} fp128 0xL00000000000000000000000000000000, align 1626 27 28// CHECK-LABEL: @fun029// CHECK:       ret i1 true30_Bool fun0() {31  return __atomic_is_lock_free(16, &Int128_Atomic);32}33 34// CHECK-LABEL: @fun135// CHECK:       ret i1 true36_Bool fun1() {37  return __atomic_always_lock_free(16, &Int128_Atomic);38}39 40// CHECK-LABEL: @fun241// CHECK:       ret i1 true42_Bool fun2() {43  return __atomic_is_lock_free(16, &Int128_Al16);44}45 46// CHECK-LABEL: @fun347// CHECK:       ret i1 true48_Bool fun3() {49  return __atomic_always_lock_free(16, &Int128_Al16);50}51 52// CHECK-LABEL: @fun453// CHECK:    call zeroext i1 @__atomic_is_lock_free54_Bool fun4() {55  return __atomic_is_lock_free(16, &Int128);56}57 58// CHECK-LABEL: @fun559// CHECK:    ret i1 false60_Bool fun5() {61  return __atomic_always_lock_free(16, &Int128);62}63 64// CHECK-LABEL: @fun665// CHECK:       ret i1 true66_Bool fun6() {67  return __atomic_is_lock_free(16, 0);68}69 70// CHECK-LABEL: @fun771// CHECK:       ret i1 true72_Bool fun7() {73  return __atomic_always_lock_free(16, 0);74}75 76// CHECK-LABEL: @fun877// CHECK:       ret i1 true78_Bool fun8() {79  return __atomic_is_lock_free(16, &AtomicStruct);80}81 82// CHECK-LABEL: @fun983// CHECK:       ret i1 true84_Bool fun9() {85  return __atomic_always_lock_free(16, &AtomicStruct);86}87 88// CHECK-LABEL: @fun1089// CHECK:       ret i1 true90_Bool fun10() {91  return atomic_is_lock_free(&Int128_Atomic);92}93 94// CHECK-LABEL: @fun1195// CHECK:       ret i1 true96_Bool fun11() {97  return __c11_atomic_is_lock_free(16);98}99