Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / CodeGen / arithmetic-fence-builtin.cpp
bloba8f434c1d60c38a127e99b889c2ef0f6d2154705
1 // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -mreassociate -o - %s \
2 // RUN: | FileCheck --check-prefix CHECK %s
4 // RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -mreassociate -o - %s \
5 // RUN: | FileCheck --check-prefix CHECK %s
7 // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -mreassociate \
8 // RUN: -fprotect-parens -ffp-contract=on -o - %s \
9 // RUN: | FileCheck --check-prefix CHECK %s
11 template <typename T> T addAF(T a, T b) {
12 return __arithmetic_fence(a + b);
15 int addit(float a, float b) {
16 // CHECK-LABEL: define {{.*}} @{{.*}}additff(float {{.*}}, float {{.*}}) #0 {
17 float af = addAF(a,b);
19 // CHECK: [[ADDR_A:%.*]] = alloca float, align 4
20 // CHECK-NEXT: [[ADDR_B:%.*]] = alloca float, align 4
21 // CHECK-NEXT: [[AF:%.*]] = alloca float, align 4
22 // CHECK-NEXT: store float {{.*}}, ptr [[ADDR_A]], align 4
23 // CHECK-NEXT: store float {{.*}}, ptr [[ADDR_B]], align 4
24 // CHECK-NEXT: [[TEMP_A:%.*]] = load float, ptr [[ADDR_A]], align 4
25 // CHECK-NEXT: [[TEMP_B:%.*]] = load float, ptr [[ADDR_B]], align 4
26 // CHECK-NEXT: [[CALL2:%.*]] = call reassoc noundef float @_Z5addAFIfET_S0_S0_(float noundef [[TEMP_A]], float noundef [[TEMP_B]])
27 // CHECK-NEXT: store float [[CALL2]], ptr [[AF]], align 4
29 return 0;
30 // CHECK-NEXT ret i32 0
33 // CHECK-LABEL: define linkonce_odr noundef float @_Z5addAFIfET_S0_S0_(float noundef {{.*}}, float noundef {{.*}})
34 // CHECK: [[A:%.*]] = alloca float, align 4
35 // CHECK-NEXT: [[B:%.*]] = alloca float, align 4
36 // CHECK-NEXT: store float {{.*}}, ptr [[A]], align 4
37 // CHECK-NEXT: store float {{.*}}, ptr [[B]], align 4
38 // CHECK-NEXT: [[Z1:%.*]] = load float, ptr [[A]], align 4
39 // CHECK-NEXT: [[Z2:%.*]] = load float, ptr [[B]], align 4
40 // CHECK-NEXT: [[ADD:%.*]] = fadd reassoc float [[Z1]], [[Z2]]
41 // CHECK-NEXT: [[RES:%.*]] = call reassoc float @llvm.arithmetic.fence.f32(float [[ADD]])
42 // CHECK: ret float [[RES]]