annotate clang/test/CodeGen/fp-atomic-ops.c @ 207:2e18cbf3894f

LLVM12
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:07:14 +0900
parents
children c4bab56944e8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
207
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 // RUN: %clang_cc1 %s -emit-llvm -DDOUBLE -O0 -o - -triple=amdgcn-amd-amdhsa \
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 // RUN: | opt -instnamer -S | FileCheck -check-prefixes=FLOAT,DOUBLE %s
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 // RUN: %clang_cc1 %s -emit-llvm -DDOUBLE -O0 -o - -triple=aarch64-linux-gnu \
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 // RUN: | opt -instnamer -S | FileCheck -check-prefixes=FLOAT,DOUBLE %s
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 // RUN: %clang_cc1 %s -emit-llvm -O0 -o - -triple=armv8-apple-ios7.0 \
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 // RUN: | opt -instnamer -S | FileCheck -check-prefixes=FLOAT %s
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 // RUN: %clang_cc1 %s -emit-llvm -DDOUBLE -O0 -o - -triple=hexagon \
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 // RUN: | opt -instnamer -S | FileCheck -check-prefixes=FLOAT,DOUBLE %s
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 // RUN: %clang_cc1 %s -emit-llvm -DDOUBLE -O0 -o - -triple=mips64-mti-linux-gnu \
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 // RUN: | opt -instnamer -S | FileCheck -check-prefixes=FLOAT,DOUBLE %s
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 // RUN: %clang_cc1 %s -emit-llvm -O0 -o - -triple=i686-linux-gnu \
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 // RUN: | opt -instnamer -S | FileCheck -check-prefixes=FLOAT %s
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 // RUN: %clang_cc1 %s -emit-llvm -DDOUBLE -O0 -o - -triple=x86_64-linux-gnu \
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 // RUN: | opt -instnamer -S | FileCheck -check-prefixes=FLOAT,DOUBLE %s
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 typedef enum memory_order {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 memory_order_relaxed = __ATOMIC_RELAXED,
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 memory_order_acquire = __ATOMIC_ACQUIRE,
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 memory_order_release = __ATOMIC_RELEASE,
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 memory_order_acq_rel = __ATOMIC_ACQ_REL,
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 memory_order_seq_cst = __ATOMIC_SEQ_CST
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 } memory_order;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 void test(float *f, float ff, double *d, double dd) {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 // FLOAT: atomicrmw fadd float* {{.*}} monotonic
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 __atomic_fetch_add(f, ff, memory_order_relaxed);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
33
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 // FLOAT: atomicrmw fsub float* {{.*}} monotonic
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 __atomic_fetch_sub(f, ff, memory_order_relaxed);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
36
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 #ifdef DOUBLE
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 // DOUBLE: atomicrmw fadd double* {{.*}} monotonic
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 __atomic_fetch_add(d, dd, memory_order_relaxed);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
40
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 // DOUBLE: atomicrmw fsub double* {{.*}} monotonic
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 __atomic_fetch_sub(d, dd, memory_order_relaxed);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 #endif
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 }