[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / CodeGen / ffp-model.c
blob780603284a99f7a80b655a7ef12bbabe1b0306bf
1 // REQUIRES: x86-registered-target
2 // RUN: %clang -S -emit-llvm -fenable-matrix -ffp-model=fast %s -o - \
3 // RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-FAST
5 // RUN: %clang -S -emit-llvm -fenable-matrix -ffp-model=precise %s -o - \
6 // RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-PRECISE
8 // RUN: %clang -S -emit-llvm -fenable-matrix -ffp-model=strict %s -o - \
9 // RUN: -target x86_64 | FileCheck %s --check-prefixes=CHECK,CHECK-STRICT
11 // RUN: %clang -S -emit-llvm -fenable-matrix -ffp-model=strict -ffast-math \
12 // RUN: -target x86_64 %s -o - | FileCheck %s \
13 // RUN: --check-prefixes CHECK,CHECK-STRICT-FAST
15 // RUN: %clang -S -emit-llvm -fenable-matrix -ffp-model=precise -ffast-math \
16 // RUN: %s -o - | FileCheck %s --check-prefixes CHECK,CHECK-FAST1
18 float mymuladd(float x, float y, float z) {
19 // CHECK: define{{.*}} float @mymuladd
20 return x * y + z;
22 // CHECK-FAST: fmul fast float
23 // CHECK-FAST: load float, ptr
24 // CHECK-FAST: fadd fast float
26 // CHECK-PRECISE: load float, ptr
27 // CHECK-PRECISE: load float, ptr
28 // CHECK-PRECISE: load float, ptr
29 // CHECK-PRECISE: call float @llvm.fmuladd.f32(float {{.*}}, float {{.*}}, float {{.*}})
31 // CHECK-STRICT: load float, ptr
32 // CHECK-STRICT: load float, ptr
33 // CHECK-STRICT: call float @llvm.experimental.constrained.fmul.f32(float {{.*}}, float {{.*}}, {{.*}})
34 // CHECK-STRICT: load float, ptr
35 // CHECK-STRICT: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, {{.*}})
37 // CHECK-STRICT-FAST: load float, ptr
38 // CHECK-STRICT-FAST: load float, ptr
39 // CHECK-STRICT-FAST: fmul fast float {{.*}}, {{.*}}
40 // CHECK-STRICT-FAST: load float, ptr
41 // CHECK-STRICT-FAST: fadd fast float {{.*}}, {{.*}}
43 // CHECK-FAST1: load float, ptr
44 // CHECK-FAST1: load float, ptr
45 // CHECK-FAST1: fmul fast float {{.*}}, {{.*}}
46 // CHECK-FAST1: load float, ptr {{.*}}
47 // CHECK-FAST1: fadd fast float {{.*}}, {{.*}}
50 typedef float __attribute__((ext_vector_type(2))) v2f;
52 void my_vec_muladd(v2f x, float y, v2f z, v2f *res) {
53 // CHECK: define{{.*}}@my_vec_muladd
54 *res = x * y + z;
56 // CHECK-FAST: fmul fast <2 x float>
57 // CHECK-FAST: load <2 x float>, ptr
58 // CHECK-FAST: fadd fast <2 x float>
60 // CHECK-PRECISE: load <2 x float>, ptr
61 // CHECK-PRECISE: load float, ptr
62 // CHECK-PRECISE: load <2 x float>, ptr
63 // CHECK-PRECISE: call <2 x float> @llvm.fmuladd.v2f32(<2 x float> {{.*}}, <2 x float> {{.*}}, <2 x float> {{.*}})
65 // CHECK-STRICT: load <2 x float>, ptr
66 // CHECK-STRICT: load float, ptr
67 // CHECK-STRICT: call <2 x float> @llvm.experimental.constrained.fmul.v2f32(<2 x float> {{.*}}, <2 x float> {{.*}}, {{.*}})
68 // CHECK-STRICT: load <2 x float>, ptr
69 // CHECK-STRICT: call <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float> {{.*}}, <2 x float> {{.*}}, {{.*}})
71 // CHECK-STRICT-FAST: load <2 x float>, ptr
72 // CHECK-STRICT-FAST: load float, ptr
73 // CHECK-STRICT-FAST: fmul fast <2 x float> {{.*}}, {{.*}}
74 // CHECK-STRICT-FAST: load <2 x float>, ptr
75 // CHECK-STRICT-FAST: fadd fast <2 x float> {{.*}}, {{.*}}
77 // CHECK-FAST1: load <2 x float>, ptr
78 // CHECK-FAST1: load float, ptr
79 // CHECK-FAST1: fmul fast <2 x float> {{.*}}, {{.*}}
80 // CHECK-FAST1: load <2 x float>, ptr {{.*}}
81 // CHECK-FAST1: fadd fast <2 x float> {{.*}}, {{.*}}
84 typedef float __attribute__((matrix_type(2, 1))) m21f;
86 void my_m21_muladd(m21f x, float y, m21f z, m21f *res) {
87 // CHECK: define{{.*}}@my_m21_muladd
88 *res = x * y + z;
90 // CHECK-FAST: fmul fast <2 x float>
91 // CHECK-FAST: load <2 x float>, ptr
92 // CHECK-FAST: fadd fast <2 x float>
94 // CHECK-PRECISE: load <2 x float>, ptr
95 // CHECK-PRECISE: load float, ptr
96 // CHECK-PRECISE: load <2 x float>, ptr
97 // CHECK-PRECISE: call <2 x float> @llvm.fmuladd.v2f32(<2 x float> {{.*}}, <2 x float> {{.*}}, <2 x float> {{.*}})
99 // CHECK-STRICT: load <2 x float>, ptr
100 // CHECK-STRICT: load float, ptr
101 // CHECK-STRICT: call <2 x float> @llvm.experimental.constrained.fmul.v2f32(<2 x float> {{.*}}, <2 x float> {{.*}}, {{.*}})
102 // CHECK-STRICT: load <2 x float>, ptr
103 // CHECK-STRICT: call <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float> {{.*}}, <2 x float> {{.*}}, {{.*}})
105 // CHECK-STRICT-FAST: load <2 x float>, ptr
106 // CHECK-STRICT-FAST: load float, ptr
107 // CHECK-STRICT-FAST: fmul fast <2 x float> {{.*}}, {{.*}}
108 // CHECK-STRICT-FAST: load <2 x float>, ptr
109 // CHECK-STRICT-FAST: fadd fast <2 x float> {{.*}}, {{.*}}
111 // CHECK-FAST1: load <2 x float>, ptr
112 // CHECK-FAST1: load float, ptr
113 // CHECK-FAST1: fmul fast <2 x float> {{.*}}, {{.*}}
114 // CHECK-FAST1: load <2 x float>, ptr {{.*}}
115 // CHECK-FAST1: fadd fast <2 x float> {{.*}}, {{.*}}
118 typedef float __attribute__((matrix_type(2, 2))) m22f;
120 void my_m22_muladd(m22f x, float y, m22f z, m22f *res) {
121 // CHECK: define{{.*}}@my_m22_muladd
122 *res = x * y + z;
124 // CHECK-FAST: fmul fast <4 x float>
125 // CHECK-FAST: load <4 x float>, ptr
126 // CHECK-FAST: fadd fast <4 x float>
128 // CHECK-PRECISE: load <4 x float>, ptr
129 // CHECK-PRECISE: load float, ptr
130 // CHECK-PRECISE: load <4 x float>, ptr
131 // CHECK-PRECISE: call <4 x float> @llvm.fmuladd.v4f32(<4 x float> {{.*}}, <4 x float> {{.*}}, <4 x float> {{.*}})
133 // CHECK-STRICT: load <4 x float>, ptr
134 // CHECK-STRICT: load float, ptr
135 // CHECK-STRICT: call <4 x float> @llvm.experimental.constrained.fmul.v4f32(<4 x float> {{.*}}, <4 x float> {{.*}}, {{.*}})
136 // CHECK-STRICT: load <4 x float>, ptr
137 // CHECK-STRICT: call <4 x float> @llvm.experimental.constrained.fadd.v4f32(<4 x float> {{.*}}, <4 x float> {{.*}}, {{.*}})
139 // CHECK-STRICT-FAST: load <4 x float>, ptr
140 // CHECK-STRICT-FAST: load float, ptr
141 // CHECK-STRICT-FAST: fmul fast <4 x float> {{.*}}, {{.*}}
142 // CHECK-STRICT-FAST: load <4 x float>, ptr
143 // CHECK-STRICT-FAST: fadd fast <4 x float> {{.*}}, {{.*}}
145 // CHECK-FAST1: load <4 x float>, ptr
146 // CHECK-FAST1: load float, ptr
147 // CHECK-FAST1: fmul fast <4 x float> {{.*}}, {{.*}}
148 // CHECK-FAST1: load <4 x float>, ptr {{.*}}
149 // CHECK-FAST1: fadd fast <4 x float> {{.*}}, {{.*}}