1 // REQUIRES: x86-registered-target
2 // RUN: %clang_cc1 -triple=x86_64 %s -emit-llvm -o - \
3 // RUN:| FileCheck --check-prefixes CHECK,CHECK-DEFAULT %s
5 // RUN: %clang_cc1 -triple=x86_64 -ffp-contract=off %s -emit-llvm -o - \
6 // RUN:| FileCheck --check-prefixes CHECK,CHECK-DEFAULT %s
8 // RUN: %clang_cc1 -triple=x86_64 -ffp-contract=on %s -emit-llvm -o - \
9 // RUN:| FileCheck --check-prefixes CHECK,CHECK-ON %s
11 // RUN: %clang_cc1 -triple=x86_64 -ffp-contract=fast %s -emit-llvm -o - \
12 // RUN:| FileCheck --check-prefixes CHECK,CHECK-CONTRACTFAST %s
14 // RUN: %clang_cc1 -triple=x86_64 -ffast-math %s -emit-llvm -o - \
15 // RUN:| FileCheck --check-prefixes CHECK,CHECK-CONTRACTOFF %s
17 // RUN: %clang_cc1 -triple=x86_64 -ffast-math -ffp-contract=off %s -emit-llvm \
18 // RUN: -o - | FileCheck --check-prefixes CHECK,CHECK-CONTRACTOFF %s
20 // RUN: %clang_cc1 -triple=x86_64 -ffast-math -ffp-contract=on %s -emit-llvm \
21 // RUN: -o - | FileCheck --check-prefixes CHECK,CHECK-ONFAST %s
23 // RUN: %clang_cc1 -triple=x86_64 -ffast-math -ffp-contract=fast %s -emit-llvm \
24 // RUN: -o - | FileCheck --check-prefixes CHECK,CHECK-FASTFAST %s
26 // RUN: %clang_cc1 -triple=x86_64 -ffp-contract=fast -ffast-math %s \
28 // RUN: -o - | FileCheck --check-prefixes CHECK,CHECK-FASTFAST %s
30 // RUN: %clang_cc1 -triple=x86_64 -ffp-contract=off -fmath-errno \
31 // RUN: -fno-rounding-math %s -emit-llvm -o - \
32 // RUN: -o - | FileCheck --check-prefixes CHECK,CHECK-NOFAST %s
34 // RUN: %clang -S -emit-llvm -fno-fast-math %s -o - \
35 // RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-FPC-ON
37 // RUN: %clang -S -emit-llvm -ffp-contract=fast -fno-fast-math \
38 // RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-CONTRACTFAST
40 // RUN: %clang -S -emit-llvm -ffp-contract=on -fno-fast-math \
41 // RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-FPC-ON
43 // RUN: %clang -S -emit-llvm -ffp-contract=off -fno-fast-math \
44 // RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-FPC-OFF
46 // RUN: %clang -S -emit-llvm -ffp-model=fast -fno-fast-math \
47 // RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-FPC-ON
49 // RUN: %clang -S -emit-llvm -ffp-model=precise -fno-fast-math \
50 // RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-FPC-ON
52 // RUN: %clang -S -emit-llvm -ffp-model=strict -fno-fast-math \
53 // RUN: -target x86_64 %s -o - | FileCheck %s \
54 // RUN: --check-prefixes=CHECK,CHECK-FPSC-OFF
56 // RUN: %clang -S -emit-llvm -ffast-math -fno-fast-math \
57 // RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-FPC-ON
59 float mymuladd(float x
, float y
, float z
) {
60 // CHECK: define{{.*}} float @mymuladd
62 // expected-warning{{overriding '-ffp-contract=fast' option with '-ffp-contract=on'}}
64 // CHECK-DEFAULT: load float, ptr
65 // CHECK-DEFAULT: fmul float
66 // CHECK-DEFAULT: load float, ptr
67 // CHECK-DEFAULT: fadd float
69 // CHECK-ON: load float, ptr
70 // CHECK-ON: load float, ptr
71 // CHECK-ON: load float, ptr
72 // CHECK-ON: call float @llvm.fmuladd.f32(float {{.*}}, float {{.*}}, float {{.*}})
74 // CHECK-CONTRACTFAST: load float, ptr
75 // CHECK-CONTRACTFAST: load float, ptr
76 // CHECK-CONTRACTFAST: fmul contract float
77 // CHECK-CONTRACTFAST: load float, ptr
78 // CHECK-CONTRACTFAST: fadd contract float
80 // CHECK-CONTRACTOFF: load float, ptr
81 // CHECK-CONTRACTOFF: load float, ptr
82 // CHECK-CONTRACTOFF: fmul reassoc nnan ninf nsz arcp afn float
83 // CHECK-CONTRACTOFF: load float, ptr
84 // CHECK-CONTRACTOFF: fadd reassoc nnan ninf nsz arcp afn float {{.*}}, {{.*}}
86 // CHECK-ONFAST: load float, ptr
87 // CHECK-ONFAST: load float, ptr
88 // CHECK-ONFAST: load float, ptr
89 // CHECK-ONFAST: call reassoc nnan ninf nsz arcp afn float @llvm.fmuladd.f32(float {{.*}}, float {{.*}}, float {{.*}})
91 // CHECK-FASTFAST: load float, ptr
92 // CHECK-FASTFAST: load float, ptr
93 // CHECK-FASTFAST: fmul fast float
94 // CHECK-FASTFAST: load float, ptr
95 // CHECK-FASTFAST: fadd fast float {{.*}}, {{.*}}
97 // CHECK-NOFAST: load float, ptr
98 // CHECK-NOFAST: load float, ptr
99 // CHECK-NOFAST: fmul float {{.*}}, {{.*}}
100 // CHECK-NOFAST: load float, ptr
101 // CHECK-NOFAST: fadd float {{.*}}, {{.*}}
103 // CHECK-FPC-ON: load float, ptr
104 // CHECK-FPC-ON: load float, ptr
105 // CHECK-FPC-ON: load float, ptr
106 // CHECK-FPC-ON: call float @llvm.fmuladd.f32(float {{.*}}, float {{.*}}, float {{.*}})
108 // CHECK-FPC-OFF: load float, ptr
109 // CHECK-FPC-OFF: load float, ptr
110 // CHECK-FPC-OFF: fmul float
111 // CHECK-FPC-OFF: load float, ptr
112 // CHECK-FPC-OFF: fadd float {{.*}}, {{.*}}
114 // CHECK-FFPC-OFF: load float, ptr
115 // CHECK-FFPC-OFF: load float, ptr
116 // CHECK-FPSC-OFF: call float @llvm.experimental.constrained.fmul.f32(float {{.*}}, float {{.*}}, {{.*}})
117 // CHECK-FPSC-OFF: load float, ptr
118 // CHECK-FPSC-OFF: [[RES:%.*]] = call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, {{.*}})