Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / CodeGen / X86 / x86-atomic-float.c
blob6ee441c2dd7a8c8499f07d376648583d25eeda7e
1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5
2 // RUN: %clang_cc1 -triple x86_64-linux-gnu -target-cpu core2 %s -emit-llvm -o - | FileCheck %s
3 // RUN: %clang_cc1 -triple i686-linux-gnu -target-cpu core2 %s -emit-llvm -o - | FileCheck %s
6 // CHECK-LABEL: define dso_local i32 @test_int_inc(
7 // CHECK-SAME: ) #[[ATTR0:[0-9]+]] {
8 // CHECK-NEXT: [[ENTRY:.*:]]
9 // CHECK-NEXT: [[TMP0:%.*]] = atomicrmw add ptr @test_int_inc.n, i32 1 seq_cst, align 4
10 // CHECK-NEXT: ret i32 [[TMP0]]
12 int test_int_inc()
14 static _Atomic int n;
15 return n++;
18 // CHECK-LABEL: define dso_local float @test_float_post_inc(
19 // CHECK-SAME: ) #[[ATTR0]] {
20 // CHECK-NEXT: [[ENTRY:.*:]]
21 // CHECK-NEXT: [[TMP0:%.*]] = atomicrmw fadd ptr @test_float_post_inc.n, float 1.000000e+00 seq_cst, align 4
22 // CHECK-NEXT: ret float [[TMP0]]
24 float test_float_post_inc()
26 static _Atomic float n;
27 return n++;
30 // CHECK-LABEL: define dso_local float @test_float_post_dc(
31 // CHECK-SAME: ) #[[ATTR0]] {
32 // CHECK-NEXT: [[ENTRY:.*:]]
33 // CHECK-NEXT: [[TMP0:%.*]] = atomicrmw fsub ptr @test_float_post_dc.n, float 1.000000e+00 seq_cst, align 4
34 // CHECK-NEXT: ret float [[TMP0]]
36 float test_float_post_dc()
38 static _Atomic float n;
39 return n--;
42 // CHECK-LABEL: define dso_local float @test_float_pre_dc(
43 // CHECK-SAME: ) #[[ATTR0]] {
44 // CHECK-NEXT: [[ENTRY:.*:]]
45 // CHECK-NEXT: [[TMP0:%.*]] = atomicrmw fsub ptr @test_float_pre_dc.n, float 1.000000e+00 seq_cst, align 4
46 // CHECK-NEXT: [[TMP1:%.*]] = fsub float [[TMP0]], 1.000000e+00
47 // CHECK-NEXT: ret float [[TMP1]]
49 float test_float_pre_dc()
51 static _Atomic float n;
52 return --n;
55 // CHECK-LABEL: define dso_local float @test_float_pre_inc(
56 // CHECK-SAME: ) #[[ATTR0]] {
57 // CHECK-NEXT: [[ENTRY:.*:]]
58 // CHECK-NEXT: [[TMP0:%.*]] = atomicrmw fadd ptr @test_float_pre_inc.n, float 1.000000e+00 seq_cst, align 4
59 // CHECK-NEXT: [[TMP1:%.*]] = fadd float [[TMP0]], 1.000000e+00
60 // CHECK-NEXT: ret float [[TMP1]]
62 float test_float_pre_inc()
64 static _Atomic float n;
65 return ++n;