[LLVM][IR] Use splat syntax when printing ConstantExpr based splats. (#116856)
[llvm-project.git] / clang / test / CodeGen / ffp-contract-option.c
blob2a6443032a4e64725d48e62101f789fa7c0e045b
1 // REQUIRES: x86-registered-target
2 // UNSUPPORTED: target={{.*}}-zos{{.*}}
3 // RUN: %clang_cc1 -triple=x86_64 %s -emit-llvm -o - \
4 // RUN:| FileCheck --check-prefixes CHECK,CHECK-DEFAULT %s
6 // RUN: %clang_cc1 -triple=x86_64 -ffp-contract=off %s -emit-llvm -o - \
7 // RUN:| FileCheck --check-prefixes CHECK,CHECK-DEFAULT %s
9 // RUN: %clang_cc1 -triple=x86_64 -ffp-contract=on %s -emit-llvm -o - \
10 // RUN:| FileCheck --check-prefixes CHECK,CHECK-ON %s
12 // RUN: %clang_cc1 -triple=x86_64 -ffp-contract=fast %s -emit-llvm -o - \
13 // RUN:| FileCheck --check-prefixes CHECK,CHECK-CONTRACTFAST %s
15 // RUN: %clang_cc1 -triple=x86_64 -ffast-math %s -emit-llvm -o - \
16 // RUN:| FileCheck --check-prefixes CHECK,CHECK-CONTRACTOFF %s
18 // RUN: %clang_cc1 -triple=x86_64 -ffast-math -ffp-contract=off %s -emit-llvm \
19 // RUN: -o - | FileCheck --check-prefixes CHECK,CHECK-CONTRACTOFF %s
21 // RUN: %clang_cc1 -triple=x86_64 -ffast-math -ffp-contract=on %s -emit-llvm \
22 // RUN: -o - | FileCheck --check-prefixes CHECK,CHECK-ONFAST %s
24 // RUN: %clang_cc1 -triple=x86_64 -ffast-math -ffp-contract=fast %s -emit-llvm \
25 // RUN: -o - | FileCheck --check-prefixes CHECK,CHECK-FASTFAST %s
27 // RUN: %clang_cc1 -triple=x86_64 -ffp-contract=fast -ffast-math %s \
28 // RUN: -emit-llvm \
29 // RUN: -o - | FileCheck --check-prefixes CHECK,CHECK-FASTFAST %s
31 // RUN: %clang_cc1 -triple=x86_64 -ffp-contract=off -fmath-errno \
32 // RUN: -fno-rounding-math %s -emit-llvm -o - \
33 // RUN: -o - | FileCheck --check-prefixes CHECK,CHECK-NOFAST %s
35 // RUN: %clang -S -emit-llvm -fno-fast-math %s -o - \
36 // RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-FPC-ON
38 // RUN: %clang -S -emit-llvm -ffp-contract=fast -fno-fast-math \
39 // RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-CONTRACTFAST
41 // RUN: %clang -S -emit-llvm -ffp-contract=on -fno-fast-math \
42 // RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-FPC-ON
44 // RUN: %clang -S -emit-llvm -ffp-contract=off -fno-fast-math \
45 // RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-FPC-OFF
47 // RUN: %clang -S -emit-llvm -ffp-model=fast -fno-fast-math \
48 // RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-FPC-ON
50 // RUN: %clang -S -emit-llvm -ffp-model=precise -fno-fast-math \
51 // RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-FPC-ON
53 // RUN: %clang -S -emit-llvm -ffp-model=strict -fno-fast-math \
54 // RUN: -target x86_64 %s -o - | FileCheck %s \
55 // RUN: --check-prefixes=CHECK,CHECK-FPSC-OFF
57 // RUN: %clang -S -emit-llvm -ffast-math -fno-fast-math \
58 // RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-FPC-ON
60 float mymuladd(float x, float y, float z) {
61 // CHECK: define{{.*}} float @mymuladd
62 return x * y + z;
63 // expected-warning{{overriding '-ffp-contract=fast' option with '-ffp-contract=on'}}
65 // CHECK-DEFAULT: load float, ptr
66 // CHECK-DEFAULT: fmul float
67 // CHECK-DEFAULT: load float, ptr
68 // CHECK-DEFAULT: fadd float
70 // CHECK-ON: load float, ptr
71 // CHECK-ON: load float, ptr
72 // CHECK-ON: load float, ptr
73 // CHECK-ON: call float @llvm.fmuladd.f32(float {{.*}}, float {{.*}}, float {{.*}})
75 // CHECK-CONTRACTFAST: load float, ptr
76 // CHECK-CONTRACTFAST: load float, ptr
77 // CHECK-CONTRACTFAST: fmul contract float
78 // CHECK-CONTRACTFAST: load float, ptr
79 // CHECK-CONTRACTFAST: fadd contract float
81 // CHECK-CONTRACTOFF: load float, ptr
82 // CHECK-CONTRACTOFF: load float, ptr
83 // CHECK-CONTRACTOFF: fmul reassoc nnan ninf nsz arcp afn float
84 // CHECK-CONTRACTOFF: load float, ptr
85 // CHECK-CONTRACTOFF: fadd reassoc nnan ninf nsz arcp afn float {{.*}}, {{.*}}
87 // CHECK-ONFAST: load float, ptr
88 // CHECK-ONFAST: load float, ptr
89 // CHECK-ONFAST: load float, ptr
90 // CHECK-ONFAST: call reassoc nnan ninf nsz arcp afn float @llvm.fmuladd.f32(float {{.*}}, float {{.*}}, float {{.*}})
92 // CHECK-FASTFAST: load float, ptr
93 // CHECK-FASTFAST: load float, ptr
94 // CHECK-FASTFAST: fmul fast float
95 // CHECK-FASTFAST: load float, ptr
96 // CHECK-FASTFAST: fadd fast float {{.*}}, {{.*}}
98 // CHECK-NOFAST: load float, ptr
99 // CHECK-NOFAST: load float, ptr
100 // CHECK-NOFAST: fmul float {{.*}}, {{.*}}
101 // CHECK-NOFAST: load float, ptr
102 // CHECK-NOFAST: fadd float {{.*}}, {{.*}}
104 // CHECK-FPC-ON: load float, ptr
105 // CHECK-FPC-ON: load float, ptr
106 // CHECK-FPC-ON: load float, ptr
107 // CHECK-FPC-ON: call float @llvm.fmuladd.f32(float {{.*}}, float {{.*}}, float {{.*}})
109 // CHECK-FPC-OFF: load float, ptr
110 // CHECK-FPC-OFF: load float, ptr
111 // CHECK-FPC-OFF: fmul float
112 // CHECK-FPC-OFF: load float, ptr
113 // CHECK-FPC-OFF: fadd float {{.*}}, {{.*}}
115 // CHECK-FFPC-OFF: load float, ptr
116 // CHECK-FFPC-OFF: load float, ptr
117 // CHECK-FPSC-OFF: call float @llvm.experimental.constrained.fmul.f32(float {{.*}}, float {{.*}}, {{.*}})
118 // CHECK-FPSC-OFF: load float, ptr
119 // CHECK-FPSC-OFF: [[RES:%.*]] = call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, {{.*}})