[libc][test] Adjust header paths in tests (#119623)
[llvm-project.git] / clang / test / CodeGen / X86 / x86-atomic-double.c
blob09c8f70c3db8547dbcf0f1e5364ffe7a3f74d1b5
1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 4
2 // RUN: %clang_cc1 -triple x86_64-linux-gnu -target-cpu core2 %s -emit-llvm -o - | FileCheck -check-prefixes=X64 %s
3 // RUN: %clang_cc1 -triple i686-linux-gnu -target-cpu core2 %s -emit-llvm -o - | FileCheck -check-prefixes=X86 %s
6 // X64-LABEL: define dso_local double @test_double_post_inc(
7 // X64-SAME: ) #[[ATTR0:[0-9]+]] {
8 // X64-NEXT: entry:
9 // X64-NEXT: [[TMP0:%.*]] = atomicrmw fadd ptr @test_double_post_inc.n, double 1.000000e+00 seq_cst, align 8
10 // X64-NEXT: ret double [[TMP0]]
12 // X86-LABEL: define dso_local double @test_double_post_inc(
13 // X86-SAME: ) #[[ATTR0:[0-9]+]] {
14 // X86-NEXT: entry:
15 // X86-NEXT: [[TMP0:%.*]] = atomicrmw fadd ptr @test_double_post_inc.n, double 1.000000e+00 seq_cst, align 8
16 // X86-NEXT: ret double [[TMP0]]
18 double test_double_post_inc()
20 static _Atomic double n;
21 return n++;
24 // X64-LABEL: define dso_local double @test_double_post_dc(
25 // X64-SAME: ) #[[ATTR0]] {
26 // X64-NEXT: entry:
27 // X64-NEXT: [[TMP0:%.*]] = atomicrmw fsub ptr @test_double_post_dc.n, double 1.000000e+00 seq_cst, align 8
28 // X64-NEXT: ret double [[TMP0]]
30 // X86-LABEL: define dso_local double @test_double_post_dc(
31 // X86-SAME: ) #[[ATTR0]] {
32 // X86-NEXT: entry:
33 // X86-NEXT: [[TMP0:%.*]] = atomicrmw fsub ptr @test_double_post_dc.n, double 1.000000e+00 seq_cst, align 8
34 // X86-NEXT: ret double [[TMP0]]
36 double test_double_post_dc()
38 static _Atomic double n;
39 return n--;
42 // X64-LABEL: define dso_local double @test_double_pre_dc(
43 // X64-SAME: ) #[[ATTR0]] {
44 // X64-NEXT: entry:
45 // X64-NEXT: [[TMP0:%.*]] = atomicrmw fsub ptr @test_double_pre_dc.n, double 1.000000e+00 seq_cst, align 8
46 // X64-NEXT: [[TMP1:%.*]] = fsub double [[TMP0]], 1.000000e+00
47 // X64-NEXT: ret double [[TMP1]]
49 // X86-LABEL: define dso_local double @test_double_pre_dc(
50 // X86-SAME: ) #[[ATTR0]] {
51 // X86-NEXT: entry:
52 // X86-NEXT: [[TMP0:%.*]] = atomicrmw fsub ptr @test_double_pre_dc.n, double 1.000000e+00 seq_cst, align 8
53 // X86-NEXT: [[TMP1:%.*]] = fsub double [[TMP0]], 1.000000e+00
54 // X86-NEXT: ret double [[TMP1]]
56 double test_double_pre_dc()
58 static _Atomic double n;
59 return --n;
62 // X64-LABEL: define dso_local double @test_double_pre_inc(
63 // X64-SAME: ) #[[ATTR0]] {
64 // X64-NEXT: entry:
65 // X64-NEXT: [[TMP0:%.*]] = atomicrmw fadd ptr @test_double_pre_inc.n, double 1.000000e+00 seq_cst, align 8
66 // X64-NEXT: [[TMP1:%.*]] = fadd double [[TMP0]], 1.000000e+00
67 // X64-NEXT: ret double [[TMP1]]
69 // X86-LABEL: define dso_local double @test_double_pre_inc(
70 // X86-SAME: ) #[[ATTR0]] {
71 // X86-NEXT: entry:
72 // X86-NEXT: [[TMP0:%.*]] = atomicrmw fadd ptr @test_double_pre_inc.n, double 1.000000e+00 seq_cst, align 8
73 // X86-NEXT: [[TMP1:%.*]] = fadd double [[TMP0]], 1.000000e+00
74 // X86-NEXT: ret double [[TMP1]]
76 double test_double_pre_inc()
78 static _Atomic double n;
79 return ++n;
82 // X64-LABEL: define dso_local i32 @pr107054(
83 // X64-SAME: ) #[[ATTR0]] {
84 // X64-NEXT: entry:
85 // X64-NEXT: [[TMP0:%.*]] = atomicrmw fadd ptr @pr107054.n, double 1.000000e+00 seq_cst, align 8
86 // X64-NEXT: [[TMP1:%.*]] = fadd double [[TMP0]], 1.000000e+00
87 // X64-NEXT: [[CMP:%.*]] = fcmp oeq double [[TMP1]], 1.000000e+00
88 // X64-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
89 // X64-NEXT: ret i32 [[CONV]]
91 // X86-LABEL: define dso_local i32 @pr107054(
92 // X86-SAME: ) #[[ATTR0]] {
93 // X86-NEXT: entry:
94 // X86-NEXT: [[TMP0:%.*]] = atomicrmw fadd ptr @pr107054.n, double 1.000000e+00 seq_cst, align 8
95 // X86-NEXT: [[TMP1:%.*]] = fadd double [[TMP0]], 1.000000e+00
96 // X86-NEXT: [[CMP:%.*]] = fcmp oeq double [[TMP1]], 1.000000e+00
97 // X86-NEXT: [[CONV:%.*]] = zext i1 [[CMP]] to i32
98 // X86-NEXT: ret i32 [[CONV]]
100 int pr107054()
102 static _Atomic double n;
103 return (++n) == 1;