207
|
1 // RUN: %clang_cc1 %s -emit-llvm -DDOUBLE -O0 -o - -triple=amdgcn-amd-amdhsa \
|
|
2 // RUN: | opt -instnamer -S | FileCheck -check-prefixes=FLOAT,DOUBLE %s
|
|
3
|
|
4 // RUN: %clang_cc1 %s -emit-llvm -DDOUBLE -O0 -o - -triple=aarch64-linux-gnu \
|
|
5 // RUN: | opt -instnamer -S | FileCheck -check-prefixes=FLOAT,DOUBLE %s
|
|
6
|
|
7 // RUN: %clang_cc1 %s -emit-llvm -O0 -o - -triple=armv8-apple-ios7.0 \
|
|
8 // RUN: | opt -instnamer -S | FileCheck -check-prefixes=FLOAT %s
|
|
9
|
|
10 // RUN: %clang_cc1 %s -emit-llvm -DDOUBLE -O0 -o - -triple=hexagon \
|
|
11 // RUN: | opt -instnamer -S | FileCheck -check-prefixes=FLOAT,DOUBLE %s
|
|
12
|
|
13 // RUN: %clang_cc1 %s -emit-llvm -DDOUBLE -O0 -o - -triple=mips64-mti-linux-gnu \
|
|
14 // RUN: | opt -instnamer -S | FileCheck -check-prefixes=FLOAT,DOUBLE %s
|
|
15
|
|
16 // RUN: %clang_cc1 %s -emit-llvm -O0 -o - -triple=i686-linux-gnu \
|
|
17 // RUN: | opt -instnamer -S | FileCheck -check-prefixes=FLOAT %s
|
|
18
|
|
19 // RUN: %clang_cc1 %s -emit-llvm -DDOUBLE -O0 -o - -triple=x86_64-linux-gnu \
|
|
20 // RUN: | opt -instnamer -S | FileCheck -check-prefixes=FLOAT,DOUBLE %s
|
|
21
|
|
22 typedef enum memory_order {
|
|
23 memory_order_relaxed = __ATOMIC_RELAXED,
|
|
24 memory_order_acquire = __ATOMIC_ACQUIRE,
|
|
25 memory_order_release = __ATOMIC_RELEASE,
|
|
26 memory_order_acq_rel = __ATOMIC_ACQ_REL,
|
|
27 memory_order_seq_cst = __ATOMIC_SEQ_CST
|
|
28 } memory_order;
|
|
29
|
|
30 void test(float *f, float ff, double *d, double dd) {
|
|
31 // FLOAT: atomicrmw fadd float* {{.*}} monotonic
|
|
32 __atomic_fetch_add(f, ff, memory_order_relaxed);
|
|
33
|
|
34 // FLOAT: atomicrmw fsub float* {{.*}} monotonic
|
|
35 __atomic_fetch_sub(f, ff, memory_order_relaxed);
|
|
36
|
|
37 #ifdef DOUBLE
|
|
38 // DOUBLE: atomicrmw fadd double* {{.*}} monotonic
|
|
39 __atomic_fetch_add(d, dd, memory_order_relaxed);
|
|
40
|
|
41 // DOUBLE: atomicrmw fsub double* {{.*}} monotonic
|
|
42 __atomic_fetch_sub(d, dd, memory_order_relaxed);
|
|
43 #endif
|
|
44 }
|