Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / CodeGen / X86 / fexcess-precision.c
blob68c2f76260918e5b737ec00483e5b54b41be8fda
1 // RUN: %clang_cc1 -triple x86_64-unknown-unknown \
2 // RUN: -ffloat16-excess-precision=fast -emit-llvm -o - %s \
3 // RUN: | FileCheck -check-prefixes=CHECK-EXT %s
5 // RUN: %clang_cc1 -triple x86_64-unknown-unknown \
6 // RUN: -ffloat16-excess-precision=fast -target-feature +avx512fp16 \
7 // RUN: -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-NO-EXT %s
9 // RUN: %clang_cc1 -triple x86_64-unknown-unknown \
10 // RUN: -ffloat16-excess-precision=standard -emit-llvm -o - %s \
11 // RUN: | FileCheck -check-prefixes=CHECK-EXT %s
13 // RUN: %clang_cc1 -triple x86_64-unknown-unknown \
14 // RUN: -ffloat16-excess-precision=standard -target-feature +avx512fp16 \
15 // RUN: -emit-llvm -o - %s | FileCheck -check-prefixes=CHECK-NO-EXT %s
17 // RUN: %clang_cc1 -triple x86_64-unknown-unknown \
18 // RUN: -ffloat16-excess-precision=none -emit-llvm -o - %s \
19 // RUN: | FileCheck -check-prefixes=CHECK-NO-EXT %s
21 // RUN: %clang_cc1 -triple x86_64-unknown-unknown \
22 // RUN: -ffloat16-excess-precision=none -target-feature +avx512fp16 \
23 // RUN: -emit-llvm -o - %s \
24 // RUN: | FileCheck -check-prefixes=CHECK-NO-EXT %s
26 // RUN: %clang_cc1 -triple x86_64-unknown-unknown \
27 // RUN: -ffloat16-excess-precision=fast \
28 // RUN: -emit-llvm -ffp-eval-method=source -o - %s \
29 // RUN: | FileCheck -check-prefixes=CHECK-EXT %s
31 // RUN: %clang_cc1 -triple x86_64-unknown-unknown \
32 // RUN: -ffloat16-excess-precision=fast -target-feature +avx512fp16 \
33 // RUN: -emit-llvm -ffp-eval-method=source -o - %s \
34 // RUN: | FileCheck -check-prefixes=CHECK-NO-EXT %s
36 // RUN: %clang_cc1 -triple x86_64-unknown-unknown \
37 // RUN: -ffloat16-excess-precision=standard \
38 // RUN: -emit-llvm -ffp-eval-method=source -o - %s \
39 // RUN: | FileCheck -check-prefixes=CHECK-EXT %s
41 // RUN: %clang_cc1 -triple x86_64-unknown-unknown \
42 // RUN: -ffloat16-excess-precision=standard -target-feature +avx512fp16 \
43 // RUN: -emit-llvm -ffp-eval-method=source -o - %s \
44 // RUN: | FileCheck -check-prefixes=CHECK-NO-EXT %s
46 // RUN: %clang_cc1 -triple x86_64-unknown-unknown \
47 // RUN: -ffloat16-excess-precision=none \
48 // RUN: -emit-llvm -ffp-eval-method=source -o - %s \
49 // RUN: | FileCheck -check-prefixes=CHECK-NO-EXT %s
51 // RUN: %clang_cc1 -triple x86_64-unknown-unknown \
52 // RUN: -ffloat16-excess-precision=none -target-feature +avx512fp16 \
53 // RUN: -emit-llvm -ffp-eval-method=source -o - %s \
54 // RUN: | FileCheck -check-prefixes=CHECK-NO-EXT %s
56 // RUN: %clang_cc1 -triple x86_64-unknown-unknown \
57 // RUN: -ffloat16-excess-precision=fast \
58 // RUN: -emit-llvm -ffp-eval-method=double -o - %s \
59 // RUN: | FileCheck -check-prefixes=CHECK-EXT-DBL %s
61 // RUN: %clang_cc1 -triple x86_64-unknown-unknown \
62 // RUN: -ffloat16-excess-precision=fast -target-feature +avx512fp16 \
63 // RUN: -emit-llvm -ffp-eval-method=double -o - %s \
64 // RUN: | FileCheck -check-prefixes=CHECK-EXT-DBL %s
66 // RUN: %clang_cc1 -triple x86_64-unknown-unknown \
67 // RUN: -ffloat16-excess-precision=standard \
68 // RUN: -emit-llvm -ffp-eval-method=double -o - %s \
69 // RUN: | FileCheck -check-prefixes=CHECK-EXT-DBL %s
71 // RUN: %clang_cc1 -triple x86_64-unknown-unknown \
72 // RUN: -ffloat16-excess-precision=standard -target-feature +avx512fp16 \
73 // RUN: -emit-llvm -ffp-eval-method=double -o - %s \
74 // RUN: | FileCheck -check-prefixes=CHECK-EXT-DBL %s
76 // RUN: %clang_cc1 -triple x86_64-unknown-unknown \
77 // RUN: -ffloat16-excess-precision=none \
78 // RUN: -emit-llvm -ffp-eval-method=double -o - %s \
79 // RUN: | FileCheck -check-prefixes=CHECK-EXT-DBL %s
81 // RUN: %clang_cc1 -triple x86_64-unknown-unknown \
82 // RUN: -ffloat16-excess-precision=none -target-feature +avx512fp16 \
83 // RUN: -emit-llvm -ffp-eval-method=double -o - %s \
84 // RUN: | FileCheck -check-prefixes=CHECK-EXT-DBL %s
86 // RUN: %clang_cc1 -triple x86_64-unknown-unknown \
87 // RUN: -ffloat16-excess-precision=fast \
88 // RUN: -emit-llvm -ffp-eval-method=extended -o - %s \
89 // RUN: | FileCheck -check-prefixes=CHECK-EXT-FP80 %s
91 // RUN: %clang_cc1 -triple x86_64-unknown-unknown \
92 // RUN: -ffloat16-excess-precision=fast -target-feature +avx512fp16 \
93 // RUN: -emit-llvm -ffp-eval-method=extended -o - %s \
94 // RUN: | FileCheck -check-prefixes=CHECK-EXT-FP80 %s
96 // RUN: %clang_cc1 -triple x86_64-unknown-unknown \
97 // RUN: -ffloat16-excess-precision=standard \
98 // RUN: -emit-llvm -ffp-eval-method=extended -o - %s \
99 // RUN: | FileCheck -check-prefixes=CHECK-EXT-FP80 %s
101 // RUN: %clang_cc1 -triple x86_64-unknown-unknown \
102 // RUN: -ffloat16-excess-precision=standard -target-feature +avx512fp16 \
103 // RUN: -emit-llvm -ffp-eval-method=extended -o - %s \
104 // RUN: | FileCheck -check-prefixes=CHECK-EXT-FP80 %s
106 // RUN: %clang_cc1 -triple x86_64-unknown-unknown \
107 // RUN: -ffloat16-excess-precision=none \
108 // RUN: -emit-llvm -ffp-eval-method=extended -o - %s \
109 // RUN: | FileCheck -check-prefixes=CHECK-EXT-FP80 %s
111 // RUN: %clang_cc1 -triple x86_64-unknown-unknown \
112 // RUN: -ffloat16-excess-precision=none -target-feature +avx512fp16 \
113 // RUN: -emit-llvm -ffp-eval-method=extended -o - %s \
114 // RUN: | FileCheck -check-prefixes=CHECK-EXT-FP80 %s
116 // RUN: %clang_cc1 -triple x86_64-unknown-unknown \
117 // RUN: -ffloat16-excess-precision=none \
118 // RUN: -ffp-contract=on -emit-llvm -o - %s \
119 // RUN: | FileCheck -check-prefixes=CHECK-CONTRACT %s
121 // RUN: %clang_cc1 -triple x86_64-unknown-unknown \
122 // RUN: -ffloat16-excess-precision=none -target-feature +avx512fp16 \
123 // RUN: -ffp-contract=on -emit-llvm -o - %s \
124 // RUN: | FileCheck -check-prefixes=CHECK-CONTRACT %s
126 // RUN: %clang_cc1 -triple x86_64-unknown-unknown \
127 // RUN: -ffloat16-excess-precision=none \
128 // RUN: -fmath-errno -ffp-contract=on -fno-rounding-math \
129 // RUN: -ffp-eval-method=source -emit-llvm -o - %s \
130 // RUN: | FileCheck -check-prefixes=CHECK-CONTRACT %s
132 // RUN: %clang_cc1 -triple x86_64-unknown-unknown \
133 // RUN: -ffloat16-excess-precision=none -target-feature +avx512fp16 \
134 // RUN: -fmath-errno -ffp-contract=on -fno-rounding-math \
135 // RUN: -ffp-eval-method=source -emit-llvm -o - %s \
136 // RUN: | FileCheck -check-prefixes=CHECK-CONTRACT %s
138 // RUN: %clang_cc1 -triple x86_64-unknown-unknown \
139 // RUN: -ffloat16-excess-precision=none \
140 // RUN: -fmath-errno -ffp-contract=on -fno-rounding-math \
141 // RUN: -ffp-eval-method=double -emit-llvm -o - %s \
142 // RUN: | FileCheck -check-prefixes=CHECK-CONTRACT-DBL %s
144 // RUN: %clang_cc1 -triple x86_64-unknown-unknown \
145 // RUN: -ffloat16-excess-precision=none -target-feature +avx512fp16 \
146 // RUN: -fmath-errno -ffp-contract=on -fno-rounding-math \
147 // RUN: -ffp-eval-method=double -emit-llvm -o - %s \
148 // RUN: | FileCheck -check-prefixes=CHECK-CONTRACT-DBL %s
150 // RUN: %clang_cc1 -triple x86_64-unknown-unknown \
151 // RUN: -ffloat16-excess-precision=none \
152 // RUN: -fmath-errno -ffp-contract=on -fno-rounding-math \
153 // RUN: -ffp-eval-method=extended -emit-llvm -o - %s \
154 // RUN: | FileCheck -check-prefixes=CHECK-CONTRACT-EXT %s
156 // RUN: %clang_cc1 -triple x86_64-unknown-unknown \
157 // RUN: -ffloat16-excess-precision=none -target-feature +avx512fp16 \
158 // RUN: -fmath-errno -ffp-contract=on -fno-rounding-math \
159 // RUN: -ffp-eval-method=extended -emit-llvm -o - %s \
160 // RUN: | FileCheck -check-prefixes=CHECK-CONTRACT-EXT %s
162 // RUN: %clang_cc1 -triple x86_64-unknown-unknown \
163 // RUN: -ffloat16-excess-precision=none \
164 // RUN: -fapprox-func -fmath-errno -fno-signed-zeros -mreassociate \
165 // RUN: -freciprocal-math -ffp-contract=on -fno-rounding-math \
166 // RUN: -funsafe-math-optimizations -emit-llvm -o - %s \
167 // RUN: | FileCheck -check-prefixes=CHECK-UNSAFE %s
169 // RUN: %clang_cc1 -triple x86_64-unknown-unknown \
170 // RUN: -ffloat16-excess-precision=none -target-feature +avx512fp16 \
171 // RUN: -fapprox-func -fmath-errno -fno-signed-zeros -mreassociate \
172 // RUN: -freciprocal-math -ffp-contract=on -fno-rounding-math \
173 // RUN: -funsafe-math-optimizations -emit-llvm -o - %s \
174 // RUN: | FileCheck -check-prefixes=CHECK-UNSAFE %s
176 // CHECK-EXT-LABEL: @f(
177 // CHECK-EXT-NEXT: entry:
178 // CHECK-EXT-NEXT: [[A_ADDR:%.*]] = alloca half
179 // CHECK-EXT-NEXT: [[B_ADDR:%.*]] = alloca half
180 // CHECK-EXT-NEXT: [[C_ADDR:%.*]] = alloca half
181 // CHECK-EXT-NEXT: [[D_ADDR:%.*]] = alloca half
182 // CHECK-EXT-NEXT: store half [[A:%.*]], ptr [[A_ADDR]]
183 // CHECK-EXT-NEXT: store half [[B:%.*]], ptr [[B_ADDR]]
184 // CHECK-EXT-NEXT: store half [[C:%.*]], ptr [[C_ADDR]]
185 // CHECK-EXT-NEXT: store half [[D:%.*]], ptr [[D_ADDR]]
186 // CHECK-EXT-NEXT: [[TMP0:%.*]] = load half, ptr [[A_ADDR]]
187 // CHECK-EXT-NEXT: [[EXT:%.*]] = fpext half [[TMP0]] to float
188 // CHECK-EXT-NEXT: [[TMP1:%.*]] = load half, ptr [[B_ADDR]]
189 // CHECK-EXT-NEXT: [[EXT1:%.*]] = fpext half [[TMP1]] to float
190 // CHECK-EXT-NEXT: [[MUL:%.*]] = fmul float [[EXT]], [[EXT1]]
191 // CHECK-EXT-NEXT: [[TMP2:%.*]] = load half, ptr [[C_ADDR]]
192 // CHECK-EXT-NEXT: [[EXT2:%.*]] = fpext half [[TMP2]] to float
193 // CHECK-EXT-NEXT: [[TMP3:%.*]] = load half, ptr [[D_ADDR]]
194 // CHECK-EXT-NEXT: [[EXT3:%.*]] = fpext half [[TMP3]] to float
195 // CHECK-EXT-NEXT: [[MUL4:%.*]] = fmul float [[EXT2]], [[EXT3]]
196 // CHECK-EXT-NEXT: [[ADD:%.*]] = fadd float [[MUL]], [[MUL4]]
197 // CHECK-EXT-NEXT: [[UNPROMOTION:%.*]] = fptrunc float [[ADD]] to half
198 // CHECK-EXT-NEXT: ret half [[UNPROMOTION]]
200 // CHECK-NO-EXT-LABEL: @f(
201 // CHECK-NO-EXT-NEXT: entry:
202 // CHECK-NO-EXT-NEXT: [[A_ADDR:%.*]] = alloca half
203 // CHECK-NO-EXT-NEXT: [[B_ADDR:%.*]] = alloca half
204 // CHECK-NO-EXT-NEXT: [[C_ADDR:%.*]] = alloca half
205 // CHECK-NO-EXT-NEXT: [[D_ADDR:%.*]] = alloca half
206 // CHECK-NO-EXT-NEXT: store half [[A:%.*]], ptr [[A_ADDR]]
207 // CHECK-NO-EXT-NEXT: store half [[B:%.*]], ptr [[B_ADDR]]
208 // CHECK-NO-EXT-NEXT: store half [[C:%.*]], ptr [[C_ADDR]]
209 // CHECK-NO-EXT-NEXT: store half [[D:%.*]], ptr [[D_ADDR]]
210 // CHECK-NO-EXT-NEXT: [[TMP0:%.*]] = load half, ptr [[A_ADDR]]
211 // CHECK-NO-EXT-NEXT: [[TMP1:%.*]] = load half, ptr [[B_ADDR]]
212 // CHECK-NO-EXT-NEXT: [[MUL:%.*]] = fmul half [[TMP0]], [[TMP1]]
213 // CHECK-NO-EXT-NEXT: [[TMP2:%.*]] = load half, ptr [[C_ADDR]]
214 // CHECK-NO-EXT-NEXT: [[TMP3:%.*]] = load half, ptr [[D_ADDR]]
215 // CHECK-NO-EXT-NEXT: [[MUL1:%.*]] = fmul half [[TMP2]], [[TMP3]]
216 // CHECK-NO-EXT-NEXT: [[ADD:%.*]] = fadd half [[MUL]], [[MUL1]]
217 // CHECK-NO-EXT-NEXT: ret half [[ADD]]
219 // CHECK-EXT-DBL-LABEL: @f(
220 // CHECK-EXT-DBL-NEXT: entry:
221 // CHECK-EXT-DBL-NEXT: [[A_ADDR:%.*]] = alloca half
222 // CHECK-EXT-DBL-NEXT: [[B_ADDR:%.*]] = alloca half
223 // CHECK-EXT-DBL-NEXT: [[C_ADDR:%.*]] = alloca half
224 // CHECK-EXT-DBL-NEXT: [[D_ADDR:%.*]] = alloca half
225 // CHECK-EXT-DBL-NEXT: store half [[A:%.*]], ptr [[A_ADDR]]
226 // CHECK-EXT-DBL-NEXT: store half [[B:%.*]], ptr [[B_ADDR]]
227 // CHECK-EXT-DBL-NEXT: store half [[C:%.*]], ptr [[C_ADDR]]
228 // CHECK-EXT-DBL-NEXT: store half [[D:%.*]], ptr [[D_ADDR]]
229 // CHECK-EXT-DBL-NEXT: [[TMP0:%.*]] = load half, ptr [[A_ADDR]]
230 // CHECK-EXT-DBL-NEXT: [[CONV:%.*]] = fpext half [[TMP0]] to double
231 // CHECK-EXT-DBL-NEXT: [[TMP1:%.*]] = load half, ptr [[B_ADDR]]
232 // CHECK-EXT-DBL-NEXT: [[CONV1:%.*]] = fpext half [[TMP1]] to double
233 // CHECK-EXT-DBL-NEXT: [[MUL:%.*]] = fmul double [[CONV]], [[CONV1]]
234 // CHECK-EXT-DBL-NEXT: [[TMP2:%.*]] = load half, ptr [[C_ADDR]]
235 // CHECK-EXT-DBL-NEXT: [[CONV2:%.*]] = fpext half [[TMP2]] to double
236 // CHECK-EXT-DBL-NEXT: [[TMP3:%.*]] = load half, ptr [[D_ADDR]]
237 // CHECK-EXT-DBL-NEXT: [[CONV3:%.*]] = fpext half [[TMP3]] to double
238 // CHECK-EXT-DBL-NEXT: [[MUL4:%.*]] = fmul double [[CONV2]], [[CONV3]]
239 // CHECK-EXT-DBL-NEXT: [[ADD:%.*]] = fadd double [[MUL]], [[MUL4]]
240 // CHECK-EXT-DBL-NEXT: [[CONV5:%.*]] = fptrunc double [[ADD]] to half
241 // CHECK-EXT-DBL-NEXT: ret half [[CONV5]]
243 // CHECK-EXT-FP80-LABEL: @f(
244 // CHECK-EXT-FP80-NEXT: entry:
245 // CHECK-EXT-FP80-NEXT: [[A_ADDR:%.*]] = alloca half
246 // CHECK-EXT-FP80-NEXT: [[B_ADDR:%.*]] = alloca half
247 // CHECK-EXT-FP80-NEXT: [[C_ADDR:%.*]] = alloca half
248 // CHECK-EXT-FP80-NEXT: [[D_ADDR:%.*]] = alloca half
249 // CHECK-EXT-FP80-NEXT: store half [[A:%.*]], ptr [[A_ADDR]]
250 // CHECK-EXT-FP80-NEXT: store half [[B:%.*]], ptr [[B_ADDR]]
251 // CHECK-EXT-FP80-NEXT: store half [[C:%.*]], ptr [[C_ADDR]]
252 // CHECK-EXT-FP80-NEXT: store half [[D:%.*]], ptr [[D_ADDR]]
253 // CHECK-EXT-FP80-NEXT: [[TMP0:%.*]] = load half, ptr [[A_ADDR]]
254 // CHECK-EXT-FP80-NEXT: [[CONV:%.*]] = fpext half [[TMP0]] to x86_fp80
255 // CHECK-EXT-FP80-NEXT: [[TMP1:%.*]] = load half, ptr [[B_ADDR]]
256 // CHECK-EXT-FP80-NEXT: [[CONV1:%.*]] = fpext half [[TMP1]] to x86_fp80
257 // CHECK-EXT-FP80-NEXT: [[MUL:%.*]] = fmul x86_fp80 [[CONV]], [[CONV1]]
258 // CHECK-EXT-FP80-NEXT: [[TMP2:%.*]] = load half, ptr [[C_ADDR]]
259 // CHECK-EXT-FP80-NEXT: [[CONV2:%.*]] = fpext half [[TMP2]] to x86_fp80
260 // CHECK-EXT-FP80-NEXT: [[TMP3:%.*]] = load half, ptr [[D_ADDR]]
261 // CHECK-EXT-FP80-NEXT: [[CONV3:%.*]] = fpext half [[TMP3]] to x86_fp80
262 // CHECK-EXT-FP80-NEXT: [[MUL4:%.*]] = fmul x86_fp80 [[CONV2]], [[CONV3]]
263 // CHECK-EXT-FP80-NEXT: [[ADD:%.*]] = fadd x86_fp80 [[MUL]], [[MUL4]]
264 // CHECK-EXT-FP80-NEXT: [[CONV5:%.*]] = fptrunc x86_fp80 [[ADD]] to half
265 // CHECK-EXT-FP80-NEXT: ret half [[CONV5]]
267 // CHECK-CONTRACT-LABEL: @f(
268 // CHECK-CONTRACT-NEXT: entry:
269 // CHECK-CONTRACT-NEXT: [[A_ADDR:%.*]] = alloca half
270 // CHECK-CONTRACT-NEXT: [[B_ADDR:%.*]] = alloca half
271 // CHECK-CONTRACT-NEXT: [[C_ADDR:%.*]] = alloca half
272 // CHECK-CONTRACT-NEXT: [[D_ADDR:%.*]] = alloca half
273 // CHECK-CONTRACT-NEXT: store half [[A:%.*]], ptr [[A_ADDR]]
274 // CHECK-CONTRACT-NEXT: store half [[B:%.*]], ptr [[B_ADDR]]
275 // CHECK-CONTRACT-NEXT: store half [[C:%.*]], ptr [[C_ADDR]]
276 // CHECK-CONTRACT-NEXT: store half [[D:%.*]], ptr [[D_ADDR]]
277 // CHECK-CONTRACT-NEXT: [[TMP0:%.*]] = load half, ptr [[A_ADDR]]
278 // CHECK-CONTRACT-NEXT: [[TMP1:%.*]] = load half, ptr [[B_ADDR]]
279 // CHECK-CONTRACT-NEXT: [[TMP2:%.*]] = load half, ptr [[C_ADDR]]
280 // CHECK-CONTRACT-NEXT: [[TMP3:%.*]] = load half, ptr [[D_ADDR]]
281 // CHECK-CONTRACT-NEXT: [[MUL1:%.*]] = fmul half [[TMP2]], [[TMP3]]
282 // CHECK-CONTRACT-NEXT: [[TMP4:%.*]] = call half @llvm.fmuladd.f16(half [[TMP0]], half [[TMP1]], half [[MUL1]])
283 // CHECK-CONTRACT-NEXT: ret half [[TMP4]]
285 // CHECK-CONTRACT-DBL-LABEL: @f(
286 // CHECK-CONTRACT-DBL-NEXT: entry:
287 // CHECK-CONTRACT-DBL-NEXT: [[A_ADDR:%.*]] = alloca half
288 // CHECK-CONTRACT-DBL-NEXT: [[B_ADDR:%.*]] = alloca half
289 // CHECK-CONTRACT-DBL-NEXT: [[C_ADDR:%.*]] = alloca half
290 // CHECK-CONTRACT-DBL-NEXT: [[D_ADDR:%.*]] = alloca half
291 // CHECK-CONTRACT-DBL-NEXT: store half [[A:%.*]], ptr [[A_ADDR]]
292 // CHECK-CONTRACT-DBL-NEXT: store half [[B:%.*]], ptr [[B_ADDR]]
293 // CHECK-CONTRACT-DBL-NEXT: store half [[C:%.*]], ptr [[C_ADDR]]
294 // CHECK-CONTRACT-DBL-NEXT: store half [[D:%.*]], ptr [[D_ADDR]]
295 // CHECK-CONTRACT-DBL-NEXT: [[TMP0:%.*]] = load half, ptr [[A_ADDR]]
296 // CHECK-CONTRACT-DBL-NEXT: [[CONV:%.*]] = fpext half [[TMP0]] to double
297 // CHECK-CONTRACT-DBL-NEXT: [[TMP1:%.*]] = load half, ptr [[B_ADDR]]
298 // CHECK-CONTRACT-DBL-NEXT: [[CONV1:%.*]] = fpext half [[TMP1]] to double
299 // CHECK-CONTRACT-DBL-NEXT: [[TMP2:%.*]] = load half, ptr [[C_ADDR]]
300 // CHECK-CONTRACT-DBL-NEXT: [[CONV2:%.*]] = fpext half [[TMP2]] to double
301 // CHECK-CONTRACT-DBL-NEXT: [[TMP3:%.*]] = load half, ptr [[D_ADDR]]
302 // CHECK-CONTRACT-DBL-NEXT: [[CONV3:%.*]] = fpext half [[TMP3]] to double
303 // CHECK-CONTRACT-DBL-NEXT: [[MUL4:%.*]] = fmul double [[CONV2]], [[CONV3]]
304 // CHECK-CONTRACT-DBL-NEXT: [[TMP4:%.*]] = call double @llvm.fmuladd.f64(double [[CONV]], double [[CONV1]], double [[MUL4]])
305 // CHECK-CONTRACT-DBL-NEXT: [[CONV5:%.*]] = fptrunc double [[TMP4]] to half
306 // CHECK-CONTRACT-DBL-NEXT: ret half [[CONV5]]
308 // CHECK-CONTRACT-EXT-LABEL: @f(
309 // CHECK-CONTRACT-EXT-NEXT: entry:
310 // CHECK-CONTRACT-EXT-NEXT: [[A_ADDR:%.*]] = alloca half
311 // CHECK-CONTRACT-EXT-NEXT: [[B_ADDR:%.*]] = alloca half
312 // CHECK-CONTRACT-EXT-NEXT: [[C_ADDR:%.*]] = alloca half
313 // CHECK-CONTRACT-EXT-NEXT: [[D_ADDR:%.*]] = alloca half
314 // CHECK-CONTRACT-EXT-NEXT: store half [[A:%.*]], ptr [[A_ADDR]]
315 // CHECK-CONTRACT-EXT-NEXT: store half [[B:%.*]], ptr [[B_ADDR]]
316 // CHECK-CONTRACT-EXT-NEXT: store half [[C:%.*]], ptr [[C_ADDR]]
317 // CHECK-CONTRACT-EXT-NEXT: store half [[D:%.*]], ptr [[D_ADDR]]
318 // CHECK-CONTRACT-EXT-NEXT: [[TMP0:%.*]] = load half, ptr [[A_ADDR]]
319 // CHECK-CONTRACT-EXT-NEXT: [[CONV:%.*]] = fpext half [[TMP0]] to x86_fp80
320 // CHECK-CONTRACT-EXT-NEXT: [[TMP1:%.*]] = load half, ptr [[B_ADDR]]
321 // CHECK-CONTRACT-EXT-NEXT: [[CONV1:%.*]] = fpext half [[TMP1]] to x86_fp80
322 // CHECK-CONTRACT-EXT-NEXT: [[TMP2:%.*]] = load half, ptr [[C_ADDR]]
323 // CHECK-CONTRACT-EXT-NEXT: [[CONV2:%.*]] = fpext half [[TMP2]] to x86_fp80
324 // CHECK-CONTRACT-EXT-NEXT: [[TMP3:%.*]] = load half, ptr [[D_ADDR]]
325 // CHECK-CONTRACT-EXT-NEXT: [[CONV3:%.*]] = fpext half [[TMP3]] to x86_fp80
326 // CHECK-CONTRACT-EXT-NEXT: [[MUL4:%.*]] = fmul x86_fp80 [[CONV2]], [[CONV3]]
327 // CHECK-CONTRACT-EXT-NEXT: [[TMP4:%.*]] = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 [[CONV]], x86_fp80 [[CONV1]], x86_fp80 [[MUL4]])
328 // CHECK-CONTRACT-EXT-NEXT: [[CONV5:%.*]] = fptrunc x86_fp80 [[TMP4]] to half
329 // CHECK-CONTRACT-EXT-NEXT: ret half [[CONV5]]
331 // CHECK-UNSAFE-LABEL: @f(
332 // CHECK-UNSAFE-NEXT: entry:
333 // CHECK-UNSAFE-NEXT: [[A_ADDR:%.*]] = alloca half
334 // CHECK-UNSAFE-NEXT: [[B_ADDR:%.*]] = alloca half
335 // CHECK-UNSAFE-NEXT: [[C_ADDR:%.*]] = alloca half
336 // CHECK-UNSAFE-NEXT: [[D_ADDR:%.*]] = alloca half
337 // CHECK-UNSAFE-NEXT: store half [[A:%.*]], ptr [[A_ADDR]]
338 // CHECK-UNSAFE-NEXT: store half [[B:%.*]], ptr [[B_ADDR]]
339 // CHECK-UNSAFE-NEXT: store half [[C:%.*]], ptr [[C_ADDR]]
340 // CHECK-UNSAFE-NEXT: store half [[D:%.*]], ptr [[D_ADDR]]
341 // CHECK-UNSAFE-NEXT: [[TMP0:%.*]] = load half, ptr [[A_ADDR]]
342 // CHECK-UNSAFE-NEXT: [[TMP1:%.*]] = load half, ptr [[B_ADDR]]
343 // CHECK-UNSAFE-NEXT: [[TMP2:%.*]] = load half, ptr [[C_ADDR]]
344 // CHECK-UNSAFE-NEXT: [[TMP3:%.*]] = load half, ptr [[D_ADDR]]
345 // CHECK-UNSAFE-NEXT: [[MUL1:%.*]] = fmul reassoc nsz arcp afn half [[TMP2]], [[TMP3]]
346 // CHECK-UNSAFE-NEXT: [[TMP4:%.*]] = call reassoc nsz arcp afn half @llvm.fmuladd.f16(half [[TMP0]], half [[TMP1]], half [[MUL1]])
347 // CHECK-UNSAFE-NEXT: ret half [[TMP4]]
349 _Float16 f(_Float16 a, _Float16 b, _Float16 c, _Float16 d) {
350 return a * b + c * d;
353 // CHECK-EXT-LABEL: @getFEM(
354 // CHECK-EXT-NEXT: entry:
355 // CHECK-EXT-NEXT: ret i32 0
357 // CHECK-NO-EXT-LABEL: @getFEM(
358 // CHECK-NO-EXT-NEXT: entry:
359 // CHECK-NO-EXT-NEXT: ret i32 0
361 // CHECK-EXT-DBL-LABEL: @getFEM(
362 // CHECK-EXT-DBL-NEXT: entry:
363 // CHECK-EXT-DBL-NEXT: ret i32 1
365 // CHECK-EXT-FP80-LABEL: @getFEM(
366 // CHECK-EXT-FP80-NEXT: entry:
367 // CHECK-EXT-FP80-NEXT: ret i32 2
369 // CHECK-CONTRACT-LABEL: @getFEM(
370 // CHECK-CONTRACT-NEXT: entry:
371 // CHECK-CONTRACT-NEXT: ret i32 0
373 // CHECK-CONTRACT-DBL-LABEL: @getFEM(
374 // CHECK-CONTRACT-DBL-NEXT: entry:
375 // CHECK-CONTRACT-DBL-NEXT: ret i32 1
377 // CHECK-CONTRACT-EXT-LABEL: @getFEM(
378 // CHECK-CONTRACT-EXT-NEXT: entry:
379 // CHECK-CONTRACT-EXT-NEXT: ret i32 2
381 // CHECK-UNSAFE-LABEL: @getFEM(
382 // CHECK-UNSAFE-NEXT: entry:
383 // CHECK-UNSAFE-NEXT: ret i32 0
385 int getFEM() {
386 return __FLT_EVAL_METHOD__;