[Clang] replace 'bitfield' with 'bit-field' for consistency (#117881)
[llvm-project.git] / llvm / test / CodeGen / LoongArch / double-fma.ll
blob58d20c62a668aec4c0bbfac075aa5166416f38c1
1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc --mtriple=loongarch32 --mattr=+d --fp-contract=fast < %s \
3 ; RUN:   | FileCheck %s --check-prefix=LA32-CONTRACT-FAST
4 ; RUN: llc --mtriple=loongarch32 --mattr=+d --fp-contract=on < %s \
5 ; RUN:   | FileCheck %s --check-prefix=LA32-CONTRACT-ON
6 ; RUN: llc --mtriple=loongarch32 --mattr=+d --fp-contract=off < %s \
7 ; RUN:   | FileCheck %s --check-prefix=LA32-CONTRACT-OFF
8 ; RUN: llc --mtriple=loongarch64 --mattr=+d --fp-contract=fast < %s \
9 ; RUN:   | FileCheck %s --check-prefix=LA64-CONTRACT-FAST
10 ; RUN: llc --mtriple=loongarch64 --mattr=+d --fp-contract=on < %s \
11 ; RUN:   | FileCheck %s --check-prefix=LA64-CONTRACT-ON
12 ; RUN: llc --mtriple=loongarch64 --mattr=+d --fp-contract=off < %s \
13 ; RUN:   | FileCheck %s --check-prefix=LA64-CONTRACT-OFF
15 define double @fmadd_d(double %a, double %b, double %c) nounwind {
16 ; LA32-CONTRACT-FAST-LABEL: fmadd_d:
17 ; LA32-CONTRACT-FAST:       # %bb.0:
18 ; LA32-CONTRACT-FAST-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
19 ; LA32-CONTRACT-FAST-NEXT:    ret
21 ; LA32-CONTRACT-ON-LABEL: fmadd_d:
22 ; LA32-CONTRACT-ON:       # %bb.0:
23 ; LA32-CONTRACT-ON-NEXT:    fmul.d $fa0, $fa0, $fa1
24 ; LA32-CONTRACT-ON-NEXT:    fadd.d $fa0, $fa0, $fa2
25 ; LA32-CONTRACT-ON-NEXT:    ret
27 ; LA32-CONTRACT-OFF-LABEL: fmadd_d:
28 ; LA32-CONTRACT-OFF:       # %bb.0:
29 ; LA32-CONTRACT-OFF-NEXT:    fmul.d $fa0, $fa0, $fa1
30 ; LA32-CONTRACT-OFF-NEXT:    fadd.d $fa0, $fa0, $fa2
31 ; LA32-CONTRACT-OFF-NEXT:    ret
33 ; LA64-CONTRACT-FAST-LABEL: fmadd_d:
34 ; LA64-CONTRACT-FAST:       # %bb.0:
35 ; LA64-CONTRACT-FAST-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
36 ; LA64-CONTRACT-FAST-NEXT:    ret
38 ; LA64-CONTRACT-ON-LABEL: fmadd_d:
39 ; LA64-CONTRACT-ON:       # %bb.0:
40 ; LA64-CONTRACT-ON-NEXT:    fmul.d $fa0, $fa0, $fa1
41 ; LA64-CONTRACT-ON-NEXT:    fadd.d $fa0, $fa0, $fa2
42 ; LA64-CONTRACT-ON-NEXT:    ret
44 ; LA64-CONTRACT-OFF-LABEL: fmadd_d:
45 ; LA64-CONTRACT-OFF:       # %bb.0:
46 ; LA64-CONTRACT-OFF-NEXT:    fmul.d $fa0, $fa0, $fa1
47 ; LA64-CONTRACT-OFF-NEXT:    fadd.d $fa0, $fa0, $fa2
48 ; LA64-CONTRACT-OFF-NEXT:    ret
49   %mul = fmul double %a, %b
50   %add = fadd double %mul, %c
51   ret double %add
54 define double @fmsub_d(double %a, double %b, double %c) nounwind {
55 ; LA32-CONTRACT-FAST-LABEL: fmsub_d:
56 ; LA32-CONTRACT-FAST:       # %bb.0:
57 ; LA32-CONTRACT-FAST-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
58 ; LA32-CONTRACT-FAST-NEXT:    ret
60 ; LA32-CONTRACT-ON-LABEL: fmsub_d:
61 ; LA32-CONTRACT-ON:       # %bb.0:
62 ; LA32-CONTRACT-ON-NEXT:    fmul.d $fa0, $fa0, $fa1
63 ; LA32-CONTRACT-ON-NEXT:    fsub.d $fa0, $fa0, $fa2
64 ; LA32-CONTRACT-ON-NEXT:    ret
66 ; LA32-CONTRACT-OFF-LABEL: fmsub_d:
67 ; LA32-CONTRACT-OFF:       # %bb.0:
68 ; LA32-CONTRACT-OFF-NEXT:    fmul.d $fa0, $fa0, $fa1
69 ; LA32-CONTRACT-OFF-NEXT:    fsub.d $fa0, $fa0, $fa2
70 ; LA32-CONTRACT-OFF-NEXT:    ret
72 ; LA64-CONTRACT-FAST-LABEL: fmsub_d:
73 ; LA64-CONTRACT-FAST:       # %bb.0:
74 ; LA64-CONTRACT-FAST-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
75 ; LA64-CONTRACT-FAST-NEXT:    ret
77 ; LA64-CONTRACT-ON-LABEL: fmsub_d:
78 ; LA64-CONTRACT-ON:       # %bb.0:
79 ; LA64-CONTRACT-ON-NEXT:    fmul.d $fa0, $fa0, $fa1
80 ; LA64-CONTRACT-ON-NEXT:    fsub.d $fa0, $fa0, $fa2
81 ; LA64-CONTRACT-ON-NEXT:    ret
83 ; LA64-CONTRACT-OFF-LABEL: fmsub_d:
84 ; LA64-CONTRACT-OFF:       # %bb.0:
85 ; LA64-CONTRACT-OFF-NEXT:    fmul.d $fa0, $fa0, $fa1
86 ; LA64-CONTRACT-OFF-NEXT:    fsub.d $fa0, $fa0, $fa2
87 ; LA64-CONTRACT-OFF-NEXT:    ret
88   %mul = fmul double %a, %b
89   %sub = fsub double %mul, %c
90   ret double %sub
93 define double @fnmadd_d(double %a, double %b, double %c) nounwind {
94 ; LA32-CONTRACT-FAST-LABEL: fnmadd_d:
95 ; LA32-CONTRACT-FAST:       # %bb.0:
96 ; LA32-CONTRACT-FAST-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
97 ; LA32-CONTRACT-FAST-NEXT:    ret
99 ; LA32-CONTRACT-ON-LABEL: fnmadd_d:
100 ; LA32-CONTRACT-ON:       # %bb.0:
101 ; LA32-CONTRACT-ON-NEXT:    fmul.d $fa0, $fa0, $fa1
102 ; LA32-CONTRACT-ON-NEXT:    fadd.d $fa0, $fa0, $fa2
103 ; LA32-CONTRACT-ON-NEXT:    fneg.d $fa0, $fa0
104 ; LA32-CONTRACT-ON-NEXT:    ret
106 ; LA32-CONTRACT-OFF-LABEL: fnmadd_d:
107 ; LA32-CONTRACT-OFF:       # %bb.0:
108 ; LA32-CONTRACT-OFF-NEXT:    fmul.d $fa0, $fa0, $fa1
109 ; LA32-CONTRACT-OFF-NEXT:    fadd.d $fa0, $fa0, $fa2
110 ; LA32-CONTRACT-OFF-NEXT:    fneg.d $fa0, $fa0
111 ; LA32-CONTRACT-OFF-NEXT:    ret
113 ; LA64-CONTRACT-FAST-LABEL: fnmadd_d:
114 ; LA64-CONTRACT-FAST:       # %bb.0:
115 ; LA64-CONTRACT-FAST-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
116 ; LA64-CONTRACT-FAST-NEXT:    ret
118 ; LA64-CONTRACT-ON-LABEL: fnmadd_d:
119 ; LA64-CONTRACT-ON:       # %bb.0:
120 ; LA64-CONTRACT-ON-NEXT:    fmul.d $fa0, $fa0, $fa1
121 ; LA64-CONTRACT-ON-NEXT:    fadd.d $fa0, $fa0, $fa2
122 ; LA64-CONTRACT-ON-NEXT:    fneg.d $fa0, $fa0
123 ; LA64-CONTRACT-ON-NEXT:    ret
125 ; LA64-CONTRACT-OFF-LABEL: fnmadd_d:
126 ; LA64-CONTRACT-OFF:       # %bb.0:
127 ; LA64-CONTRACT-OFF-NEXT:    fmul.d $fa0, $fa0, $fa1
128 ; LA64-CONTRACT-OFF-NEXT:    fadd.d $fa0, $fa0, $fa2
129 ; LA64-CONTRACT-OFF-NEXT:    fneg.d $fa0, $fa0
130 ; LA64-CONTRACT-OFF-NEXT:    ret
131   %mul = fmul double %a, %b
132   %add = fadd double %mul, %c
133   %negadd = fneg double %add
134   ret double %negadd
137 define double @fnmadd_d_nsz(double %a, double %b, double %c) nounwind {
138 ; LA32-CONTRACT-FAST-LABEL: fnmadd_d_nsz:
139 ; LA32-CONTRACT-FAST:       # %bb.0:
140 ; LA32-CONTRACT-FAST-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
141 ; LA32-CONTRACT-FAST-NEXT:    ret
143 ; LA32-CONTRACT-ON-LABEL: fnmadd_d_nsz:
144 ; LA32-CONTRACT-ON:       # %bb.0:
145 ; LA32-CONTRACT-ON-NEXT:    fneg.d $fa0, $fa0
146 ; LA32-CONTRACT-ON-NEXT:    fmul.d $fa0, $fa0, $fa1
147 ; LA32-CONTRACT-ON-NEXT:    fsub.d $fa0, $fa0, $fa2
148 ; LA32-CONTRACT-ON-NEXT:    ret
150 ; LA32-CONTRACT-OFF-LABEL: fnmadd_d_nsz:
151 ; LA32-CONTRACT-OFF:       # %bb.0:
152 ; LA32-CONTRACT-OFF-NEXT:    fneg.d $fa0, $fa0
153 ; LA32-CONTRACT-OFF-NEXT:    fmul.d $fa0, $fa0, $fa1
154 ; LA32-CONTRACT-OFF-NEXT:    fsub.d $fa0, $fa0, $fa2
155 ; LA32-CONTRACT-OFF-NEXT:    ret
157 ; LA64-CONTRACT-FAST-LABEL: fnmadd_d_nsz:
158 ; LA64-CONTRACT-FAST:       # %bb.0:
159 ; LA64-CONTRACT-FAST-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
160 ; LA64-CONTRACT-FAST-NEXT:    ret
162 ; LA64-CONTRACT-ON-LABEL: fnmadd_d_nsz:
163 ; LA64-CONTRACT-ON:       # %bb.0:
164 ; LA64-CONTRACT-ON-NEXT:    fneg.d $fa0, $fa0
165 ; LA64-CONTRACT-ON-NEXT:    fmul.d $fa0, $fa0, $fa1
166 ; LA64-CONTRACT-ON-NEXT:    fsub.d $fa0, $fa0, $fa2
167 ; LA64-CONTRACT-ON-NEXT:    ret
169 ; LA64-CONTRACT-OFF-LABEL: fnmadd_d_nsz:
170 ; LA64-CONTRACT-OFF:       # %bb.0:
171 ; LA64-CONTRACT-OFF-NEXT:    fneg.d $fa0, $fa0
172 ; LA64-CONTRACT-OFF-NEXT:    fmul.d $fa0, $fa0, $fa1
173 ; LA64-CONTRACT-OFF-NEXT:    fsub.d $fa0, $fa0, $fa2
174 ; LA64-CONTRACT-OFF-NEXT:    ret
175   %nega = fneg nsz double %a
176   %negc = fneg nsz double %c
177   %mul = fmul nsz double %nega, %b
178   %add = fadd nsz double %mul, %negc
179   ret double %add
182 ;; Check that fnmadd.d is not emitted.
183 define double @not_fnmadd_d(double %a, double %b, double %c) nounwind {
184 ; LA32-CONTRACT-FAST-LABEL: not_fnmadd_d:
185 ; LA32-CONTRACT-FAST:       # %bb.0:
186 ; LA32-CONTRACT-FAST-NEXT:    fneg.d $fa0, $fa0
187 ; LA32-CONTRACT-FAST-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
188 ; LA32-CONTRACT-FAST-NEXT:    ret
190 ; LA32-CONTRACT-ON-LABEL: not_fnmadd_d:
191 ; LA32-CONTRACT-ON:       # %bb.0:
192 ; LA32-CONTRACT-ON-NEXT:    fneg.d $fa0, $fa0
193 ; LA32-CONTRACT-ON-NEXT:    fmul.d $fa0, $fa0, $fa1
194 ; LA32-CONTRACT-ON-NEXT:    fsub.d $fa0, $fa0, $fa2
195 ; LA32-CONTRACT-ON-NEXT:    ret
197 ; LA32-CONTRACT-OFF-LABEL: not_fnmadd_d:
198 ; LA32-CONTRACT-OFF:       # %bb.0:
199 ; LA32-CONTRACT-OFF-NEXT:    fneg.d $fa0, $fa0
200 ; LA32-CONTRACT-OFF-NEXT:    fmul.d $fa0, $fa0, $fa1
201 ; LA32-CONTRACT-OFF-NEXT:    fsub.d $fa0, $fa0, $fa2
202 ; LA32-CONTRACT-OFF-NEXT:    ret
204 ; LA64-CONTRACT-FAST-LABEL: not_fnmadd_d:
205 ; LA64-CONTRACT-FAST:       # %bb.0:
206 ; LA64-CONTRACT-FAST-NEXT:    fneg.d $fa0, $fa0
207 ; LA64-CONTRACT-FAST-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
208 ; LA64-CONTRACT-FAST-NEXT:    ret
210 ; LA64-CONTRACT-ON-LABEL: not_fnmadd_d:
211 ; LA64-CONTRACT-ON:       # %bb.0:
212 ; LA64-CONTRACT-ON-NEXT:    fneg.d $fa0, $fa0
213 ; LA64-CONTRACT-ON-NEXT:    fmul.d $fa0, $fa0, $fa1
214 ; LA64-CONTRACT-ON-NEXT:    fsub.d $fa0, $fa0, $fa2
215 ; LA64-CONTRACT-ON-NEXT:    ret
217 ; LA64-CONTRACT-OFF-LABEL: not_fnmadd_d:
218 ; LA64-CONTRACT-OFF:       # %bb.0:
219 ; LA64-CONTRACT-OFF-NEXT:    fneg.d $fa0, $fa0
220 ; LA64-CONTRACT-OFF-NEXT:    fmul.d $fa0, $fa0, $fa1
221 ; LA64-CONTRACT-OFF-NEXT:    fsub.d $fa0, $fa0, $fa2
222 ; LA64-CONTRACT-OFF-NEXT:    ret
223   %nega = fneg double %a
224   %negc = fneg double %c
225   %mul = fmul double %nega, %b
226   %add = fadd double %mul, %negc
227   ret double %add
230 define double @fnmsub_d(double %a, double %b, double %c) nounwind {
231 ; LA32-CONTRACT-FAST-LABEL: fnmsub_d:
232 ; LA32-CONTRACT-FAST:       # %bb.0:
233 ; LA32-CONTRACT-FAST-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
234 ; LA32-CONTRACT-FAST-NEXT:    ret
236 ; LA32-CONTRACT-ON-LABEL: fnmsub_d:
237 ; LA32-CONTRACT-ON:       # %bb.0:
238 ; LA32-CONTRACT-ON-NEXT:    fmul.d $fa0, $fa0, $fa1
239 ; LA32-CONTRACT-ON-NEXT:    fsub.d $fa0, $fa0, $fa2
240 ; LA32-CONTRACT-ON-NEXT:    fneg.d $fa0, $fa0
241 ; LA32-CONTRACT-ON-NEXT:    ret
243 ; LA32-CONTRACT-OFF-LABEL: fnmsub_d:
244 ; LA32-CONTRACT-OFF:       # %bb.0:
245 ; LA32-CONTRACT-OFF-NEXT:    fmul.d $fa0, $fa0, $fa1
246 ; LA32-CONTRACT-OFF-NEXT:    fsub.d $fa0, $fa0, $fa2
247 ; LA32-CONTRACT-OFF-NEXT:    fneg.d $fa0, $fa0
248 ; LA32-CONTRACT-OFF-NEXT:    ret
250 ; LA64-CONTRACT-FAST-LABEL: fnmsub_d:
251 ; LA64-CONTRACT-FAST:       # %bb.0:
252 ; LA64-CONTRACT-FAST-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
253 ; LA64-CONTRACT-FAST-NEXT:    ret
255 ; LA64-CONTRACT-ON-LABEL: fnmsub_d:
256 ; LA64-CONTRACT-ON:       # %bb.0:
257 ; LA64-CONTRACT-ON-NEXT:    fmul.d $fa0, $fa0, $fa1
258 ; LA64-CONTRACT-ON-NEXT:    fsub.d $fa0, $fa0, $fa2
259 ; LA64-CONTRACT-ON-NEXT:    fneg.d $fa0, $fa0
260 ; LA64-CONTRACT-ON-NEXT:    ret
262 ; LA64-CONTRACT-OFF-LABEL: fnmsub_d:
263 ; LA64-CONTRACT-OFF:       # %bb.0:
264 ; LA64-CONTRACT-OFF-NEXT:    fmul.d $fa0, $fa0, $fa1
265 ; LA64-CONTRACT-OFF-NEXT:    fsub.d $fa0, $fa0, $fa2
266 ; LA64-CONTRACT-OFF-NEXT:    fneg.d $fa0, $fa0
267 ; LA64-CONTRACT-OFF-NEXT:    ret
268   %negc = fneg double %c
269   %mul = fmul double %a, %b
270   %add = fadd double %mul, %negc
271   %neg = fneg double %add
272   ret double %neg
275 define double @fnmsub_d_nsz(double %a, double %b, double %c) nounwind {
276 ; LA32-CONTRACT-FAST-LABEL: fnmsub_d_nsz:
277 ; LA32-CONTRACT-FAST:       # %bb.0:
278 ; LA32-CONTRACT-FAST-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
279 ; LA32-CONTRACT-FAST-NEXT:    ret
281 ; LA32-CONTRACT-ON-LABEL: fnmsub_d_nsz:
282 ; LA32-CONTRACT-ON:       # %bb.0:
283 ; LA32-CONTRACT-ON-NEXT:    fmul.d $fa0, $fa0, $fa1
284 ; LA32-CONTRACT-ON-NEXT:    fsub.d $fa0, $fa2, $fa0
285 ; LA32-CONTRACT-ON-NEXT:    ret
287 ; LA32-CONTRACT-OFF-LABEL: fnmsub_d_nsz:
288 ; LA32-CONTRACT-OFF:       # %bb.0:
289 ; LA32-CONTRACT-OFF-NEXT:    fmul.d $fa0, $fa0, $fa1
290 ; LA32-CONTRACT-OFF-NEXT:    fsub.d $fa0, $fa2, $fa0
291 ; LA32-CONTRACT-OFF-NEXT:    ret
293 ; LA64-CONTRACT-FAST-LABEL: fnmsub_d_nsz:
294 ; LA64-CONTRACT-FAST:       # %bb.0:
295 ; LA64-CONTRACT-FAST-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
296 ; LA64-CONTRACT-FAST-NEXT:    ret
298 ; LA64-CONTRACT-ON-LABEL: fnmsub_d_nsz:
299 ; LA64-CONTRACT-ON:       # %bb.0:
300 ; LA64-CONTRACT-ON-NEXT:    fmul.d $fa0, $fa0, $fa1
301 ; LA64-CONTRACT-ON-NEXT:    fsub.d $fa0, $fa2, $fa0
302 ; LA64-CONTRACT-ON-NEXT:    ret
304 ; LA64-CONTRACT-OFF-LABEL: fnmsub_d_nsz:
305 ; LA64-CONTRACT-OFF:       # %bb.0:
306 ; LA64-CONTRACT-OFF-NEXT:    fmul.d $fa0, $fa0, $fa1
307 ; LA64-CONTRACT-OFF-NEXT:    fsub.d $fa0, $fa2, $fa0
308 ; LA64-CONTRACT-OFF-NEXT:    ret
309   %nega = fneg nsz double %a
310   %mul = fmul nsz double %nega, %b
311   %add = fadd nsz double %mul, %c
312   ret double %add
315 ;; Check that fnmsub.d is not emitted.
316 define double @not_fnmsub_d(double %a, double %b, double %c) nounwind {
317 ; LA32-CONTRACT-FAST-LABEL: not_fnmsub_d:
318 ; LA32-CONTRACT-FAST:       # %bb.0:
319 ; LA32-CONTRACT-FAST-NEXT:    fneg.d $fa0, $fa0
320 ; LA32-CONTRACT-FAST-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
321 ; LA32-CONTRACT-FAST-NEXT:    ret
323 ; LA32-CONTRACT-ON-LABEL: not_fnmsub_d:
324 ; LA32-CONTRACT-ON:       # %bb.0:
325 ; LA32-CONTRACT-ON-NEXT:    fmul.d $fa0, $fa0, $fa1
326 ; LA32-CONTRACT-ON-NEXT:    fsub.d $fa0, $fa2, $fa0
327 ; LA32-CONTRACT-ON-NEXT:    ret
329 ; LA32-CONTRACT-OFF-LABEL: not_fnmsub_d:
330 ; LA32-CONTRACT-OFF:       # %bb.0:
331 ; LA32-CONTRACT-OFF-NEXT:    fmul.d $fa0, $fa0, $fa1
332 ; LA32-CONTRACT-OFF-NEXT:    fsub.d $fa0, $fa2, $fa0
333 ; LA32-CONTRACT-OFF-NEXT:    ret
335 ; LA64-CONTRACT-FAST-LABEL: not_fnmsub_d:
336 ; LA64-CONTRACT-FAST:       # %bb.0:
337 ; LA64-CONTRACT-FAST-NEXT:    fneg.d $fa0, $fa0
338 ; LA64-CONTRACT-FAST-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
339 ; LA64-CONTRACT-FAST-NEXT:    ret
341 ; LA64-CONTRACT-ON-LABEL: not_fnmsub_d:
342 ; LA64-CONTRACT-ON:       # %bb.0:
343 ; LA64-CONTRACT-ON-NEXT:    fmul.d $fa0, $fa0, $fa1
344 ; LA64-CONTRACT-ON-NEXT:    fsub.d $fa0, $fa2, $fa0
345 ; LA64-CONTRACT-ON-NEXT:    ret
347 ; LA64-CONTRACT-OFF-LABEL: not_fnmsub_d:
348 ; LA64-CONTRACT-OFF:       # %bb.0:
349 ; LA64-CONTRACT-OFF-NEXT:    fmul.d $fa0, $fa0, $fa1
350 ; LA64-CONTRACT-OFF-NEXT:    fsub.d $fa0, $fa2, $fa0
351 ; LA64-CONTRACT-OFF-NEXT:    ret
352   %nega = fneg double %a
353   %mul = fmul double %nega, %b
354   %add = fadd double %mul, %c
355   ret double %add
358 define double @contract_fmadd_d(double %a, double %b, double %c) nounwind {
359 ; LA32-CONTRACT-FAST-LABEL: contract_fmadd_d:
360 ; LA32-CONTRACT-FAST:       # %bb.0:
361 ; LA32-CONTRACT-FAST-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
362 ; LA32-CONTRACT-FAST-NEXT:    ret
364 ; LA32-CONTRACT-ON-LABEL: contract_fmadd_d:
365 ; LA32-CONTRACT-ON:       # %bb.0:
366 ; LA32-CONTRACT-ON-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
367 ; LA32-CONTRACT-ON-NEXT:    ret
369 ; LA32-CONTRACT-OFF-LABEL: contract_fmadd_d:
370 ; LA32-CONTRACT-OFF:       # %bb.0:
371 ; LA32-CONTRACT-OFF-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
372 ; LA32-CONTRACT-OFF-NEXT:    ret
374 ; LA64-CONTRACT-FAST-LABEL: contract_fmadd_d:
375 ; LA64-CONTRACT-FAST:       # %bb.0:
376 ; LA64-CONTRACT-FAST-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
377 ; LA64-CONTRACT-FAST-NEXT:    ret
379 ; LA64-CONTRACT-ON-LABEL: contract_fmadd_d:
380 ; LA64-CONTRACT-ON:       # %bb.0:
381 ; LA64-CONTRACT-ON-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
382 ; LA64-CONTRACT-ON-NEXT:    ret
384 ; LA64-CONTRACT-OFF-LABEL: contract_fmadd_d:
385 ; LA64-CONTRACT-OFF:       # %bb.0:
386 ; LA64-CONTRACT-OFF-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
387 ; LA64-CONTRACT-OFF-NEXT:    ret
388   %mul = fmul contract double %a, %b
389   %add = fadd contract double %mul, %c
390   ret double %add
393 define double @contract_fmsub_d(double %a, double %b, double %c) nounwind {
394 ; LA32-CONTRACT-FAST-LABEL: contract_fmsub_d:
395 ; LA32-CONTRACT-FAST:       # %bb.0:
396 ; LA32-CONTRACT-FAST-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
397 ; LA32-CONTRACT-FAST-NEXT:    ret
399 ; LA32-CONTRACT-ON-LABEL: contract_fmsub_d:
400 ; LA32-CONTRACT-ON:       # %bb.0:
401 ; LA32-CONTRACT-ON-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
402 ; LA32-CONTRACT-ON-NEXT:    ret
404 ; LA32-CONTRACT-OFF-LABEL: contract_fmsub_d:
405 ; LA32-CONTRACT-OFF:       # %bb.0:
406 ; LA32-CONTRACT-OFF-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
407 ; LA32-CONTRACT-OFF-NEXT:    ret
409 ; LA64-CONTRACT-FAST-LABEL: contract_fmsub_d:
410 ; LA64-CONTRACT-FAST:       # %bb.0:
411 ; LA64-CONTRACT-FAST-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
412 ; LA64-CONTRACT-FAST-NEXT:    ret
414 ; LA64-CONTRACT-ON-LABEL: contract_fmsub_d:
415 ; LA64-CONTRACT-ON:       # %bb.0:
416 ; LA64-CONTRACT-ON-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
417 ; LA64-CONTRACT-ON-NEXT:    ret
419 ; LA64-CONTRACT-OFF-LABEL: contract_fmsub_d:
420 ; LA64-CONTRACT-OFF:       # %bb.0:
421 ; LA64-CONTRACT-OFF-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
422 ; LA64-CONTRACT-OFF-NEXT:    ret
423   %mul = fmul contract double %a, %b
424   %sub = fsub contract double %mul, %c
425   ret double %sub
428 define double @contract_fnmadd_d(double %a, double %b, double %c) nounwind {
429 ; LA32-CONTRACT-FAST-LABEL: contract_fnmadd_d:
430 ; LA32-CONTRACT-FAST:       # %bb.0:
431 ; LA32-CONTRACT-FAST-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
432 ; LA32-CONTRACT-FAST-NEXT:    ret
434 ; LA32-CONTRACT-ON-LABEL: contract_fnmadd_d:
435 ; LA32-CONTRACT-ON:       # %bb.0:
436 ; LA32-CONTRACT-ON-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
437 ; LA32-CONTRACT-ON-NEXT:    ret
439 ; LA32-CONTRACT-OFF-LABEL: contract_fnmadd_d:
440 ; LA32-CONTRACT-OFF:       # %bb.0:
441 ; LA32-CONTRACT-OFF-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
442 ; LA32-CONTRACT-OFF-NEXT:    ret
444 ; LA64-CONTRACT-FAST-LABEL: contract_fnmadd_d:
445 ; LA64-CONTRACT-FAST:       # %bb.0:
446 ; LA64-CONTRACT-FAST-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
447 ; LA64-CONTRACT-FAST-NEXT:    ret
449 ; LA64-CONTRACT-ON-LABEL: contract_fnmadd_d:
450 ; LA64-CONTRACT-ON:       # %bb.0:
451 ; LA64-CONTRACT-ON-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
452 ; LA64-CONTRACT-ON-NEXT:    ret
454 ; LA64-CONTRACT-OFF-LABEL: contract_fnmadd_d:
455 ; LA64-CONTRACT-OFF:       # %bb.0:
456 ; LA64-CONTRACT-OFF-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
457 ; LA64-CONTRACT-OFF-NEXT:    ret
458   %mul = fmul contract double %a, %b
459   %add = fadd contract double %mul, %c
460   %negadd = fneg contract double %add
461   ret double %negadd
464 define double @contract_fnmadd_d_nsz(double %a, double %b, double %c) nounwind {
465 ; LA32-CONTRACT-FAST-LABEL: contract_fnmadd_d_nsz:
466 ; LA32-CONTRACT-FAST:       # %bb.0:
467 ; LA32-CONTRACT-FAST-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
468 ; LA32-CONTRACT-FAST-NEXT:    ret
470 ; LA32-CONTRACT-ON-LABEL: contract_fnmadd_d_nsz:
471 ; LA32-CONTRACT-ON:       # %bb.0:
472 ; LA32-CONTRACT-ON-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
473 ; LA32-CONTRACT-ON-NEXT:    ret
475 ; LA32-CONTRACT-OFF-LABEL: contract_fnmadd_d_nsz:
476 ; LA32-CONTRACT-OFF:       # %bb.0:
477 ; LA32-CONTRACT-OFF-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
478 ; LA32-CONTRACT-OFF-NEXT:    ret
480 ; LA64-CONTRACT-FAST-LABEL: contract_fnmadd_d_nsz:
481 ; LA64-CONTRACT-FAST:       # %bb.0:
482 ; LA64-CONTRACT-FAST-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
483 ; LA64-CONTRACT-FAST-NEXT:    ret
485 ; LA64-CONTRACT-ON-LABEL: contract_fnmadd_d_nsz:
486 ; LA64-CONTRACT-ON:       # %bb.0:
487 ; LA64-CONTRACT-ON-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
488 ; LA64-CONTRACT-ON-NEXT:    ret
490 ; LA64-CONTRACT-OFF-LABEL: contract_fnmadd_d_nsz:
491 ; LA64-CONTRACT-OFF:       # %bb.0:
492 ; LA64-CONTRACT-OFF-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
493 ; LA64-CONTRACT-OFF-NEXT:    ret
494   %nega = fneg contract nsz double %a
495   %negc = fneg contract nsz double %c
496   %mul = fmul contract nsz double %nega, %b
497   %add = fadd contract nsz double %mul, %negc
498   ret double %add
501 ;; Check that fnmadd.d is not emitted.
502 define double @not_contract_fnmadd_d(double %a, double %b, double %c) nounwind {
503 ; LA32-CONTRACT-FAST-LABEL: not_contract_fnmadd_d:
504 ; LA32-CONTRACT-FAST:       # %bb.0:
505 ; LA32-CONTRACT-FAST-NEXT:    fneg.d $fa0, $fa0
506 ; LA32-CONTRACT-FAST-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
507 ; LA32-CONTRACT-FAST-NEXT:    ret
509 ; LA32-CONTRACT-ON-LABEL: not_contract_fnmadd_d:
510 ; LA32-CONTRACT-ON:       # %bb.0:
511 ; LA32-CONTRACT-ON-NEXT:    fneg.d $fa0, $fa0
512 ; LA32-CONTRACT-ON-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
513 ; LA32-CONTRACT-ON-NEXT:    ret
515 ; LA32-CONTRACT-OFF-LABEL: not_contract_fnmadd_d:
516 ; LA32-CONTRACT-OFF:       # %bb.0:
517 ; LA32-CONTRACT-OFF-NEXT:    fneg.d $fa0, $fa0
518 ; LA32-CONTRACT-OFF-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
519 ; LA32-CONTRACT-OFF-NEXT:    ret
521 ; LA64-CONTRACT-FAST-LABEL: not_contract_fnmadd_d:
522 ; LA64-CONTRACT-FAST:       # %bb.0:
523 ; LA64-CONTRACT-FAST-NEXT:    fneg.d $fa0, $fa0
524 ; LA64-CONTRACT-FAST-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
525 ; LA64-CONTRACT-FAST-NEXT:    ret
527 ; LA64-CONTRACT-ON-LABEL: not_contract_fnmadd_d:
528 ; LA64-CONTRACT-ON:       # %bb.0:
529 ; LA64-CONTRACT-ON-NEXT:    fneg.d $fa0, $fa0
530 ; LA64-CONTRACT-ON-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
531 ; LA64-CONTRACT-ON-NEXT:    ret
533 ; LA64-CONTRACT-OFF-LABEL: not_contract_fnmadd_d:
534 ; LA64-CONTRACT-OFF:       # %bb.0:
535 ; LA64-CONTRACT-OFF-NEXT:    fneg.d $fa0, $fa0
536 ; LA64-CONTRACT-OFF-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
537 ; LA64-CONTRACT-OFF-NEXT:    ret
538   %nega = fneg contract double %a
539   %negc = fneg contract double %c
540   %mul = fmul contract double %nega, %b
541   %add = fadd contract double %mul, %negc
542   ret double %add
545 define double @contract_fnmsub_d(double %a, double %b, double %c) nounwind {
546 ; LA32-CONTRACT-FAST-LABEL: contract_fnmsub_d:
547 ; LA32-CONTRACT-FAST:       # %bb.0:
548 ; LA32-CONTRACT-FAST-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
549 ; LA32-CONTRACT-FAST-NEXT:    ret
551 ; LA32-CONTRACT-ON-LABEL: contract_fnmsub_d:
552 ; LA32-CONTRACT-ON:       # %bb.0:
553 ; LA32-CONTRACT-ON-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
554 ; LA32-CONTRACT-ON-NEXT:    ret
556 ; LA32-CONTRACT-OFF-LABEL: contract_fnmsub_d:
557 ; LA32-CONTRACT-OFF:       # %bb.0:
558 ; LA32-CONTRACT-OFF-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
559 ; LA32-CONTRACT-OFF-NEXT:    ret
561 ; LA64-CONTRACT-FAST-LABEL: contract_fnmsub_d:
562 ; LA64-CONTRACT-FAST:       # %bb.0:
563 ; LA64-CONTRACT-FAST-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
564 ; LA64-CONTRACT-FAST-NEXT:    ret
566 ; LA64-CONTRACT-ON-LABEL: contract_fnmsub_d:
567 ; LA64-CONTRACT-ON:       # %bb.0:
568 ; LA64-CONTRACT-ON-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
569 ; LA64-CONTRACT-ON-NEXT:    ret
571 ; LA64-CONTRACT-OFF-LABEL: contract_fnmsub_d:
572 ; LA64-CONTRACT-OFF:       # %bb.0:
573 ; LA64-CONTRACT-OFF-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
574 ; LA64-CONTRACT-OFF-NEXT:    ret
575   %negc = fneg contract double %c
576   %mul = fmul contract double %a, %b
577   %add = fadd contract double %mul, %negc
578   %neg = fneg contract double %add
579   ret double %neg
582 define double @contract_fnmsub_d_nsz(double %a, double %b, double %c) nounwind {
583 ; LA32-CONTRACT-FAST-LABEL: contract_fnmsub_d_nsz:
584 ; LA32-CONTRACT-FAST:       # %bb.0:
585 ; LA32-CONTRACT-FAST-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
586 ; LA32-CONTRACT-FAST-NEXT:    ret
588 ; LA32-CONTRACT-ON-LABEL: contract_fnmsub_d_nsz:
589 ; LA32-CONTRACT-ON:       # %bb.0:
590 ; LA32-CONTRACT-ON-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
591 ; LA32-CONTRACT-ON-NEXT:    ret
593 ; LA32-CONTRACT-OFF-LABEL: contract_fnmsub_d_nsz:
594 ; LA32-CONTRACT-OFF:       # %bb.0:
595 ; LA32-CONTRACT-OFF-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
596 ; LA32-CONTRACT-OFF-NEXT:    ret
598 ; LA64-CONTRACT-FAST-LABEL: contract_fnmsub_d_nsz:
599 ; LA64-CONTRACT-FAST:       # %bb.0:
600 ; LA64-CONTRACT-FAST-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
601 ; LA64-CONTRACT-FAST-NEXT:    ret
603 ; LA64-CONTRACT-ON-LABEL: contract_fnmsub_d_nsz:
604 ; LA64-CONTRACT-ON:       # %bb.0:
605 ; LA64-CONTRACT-ON-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
606 ; LA64-CONTRACT-ON-NEXT:    ret
608 ; LA64-CONTRACT-OFF-LABEL: contract_fnmsub_d_nsz:
609 ; LA64-CONTRACT-OFF:       # %bb.0:
610 ; LA64-CONTRACT-OFF-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
611 ; LA64-CONTRACT-OFF-NEXT:    ret
612   %nega = fneg contract nsz double %a
613   %mul = fmul contract nsz double %nega, %b
614   %add = fadd contract nsz double %mul, %c
615   ret double %add
618 ;; Check that fnmsub.d is not emitted.
619 define double @not_contract_fnmsub_d(double %a, double %b, double %c) nounwind {
620 ; LA32-CONTRACT-FAST-LABEL: not_contract_fnmsub_d:
621 ; LA32-CONTRACT-FAST:       # %bb.0:
622 ; LA32-CONTRACT-FAST-NEXT:    fneg.d $fa0, $fa0
623 ; LA32-CONTRACT-FAST-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
624 ; LA32-CONTRACT-FAST-NEXT:    ret
626 ; LA32-CONTRACT-ON-LABEL: not_contract_fnmsub_d:
627 ; LA32-CONTRACT-ON:       # %bb.0:
628 ; LA32-CONTRACT-ON-NEXT:    fneg.d $fa0, $fa0
629 ; LA32-CONTRACT-ON-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
630 ; LA32-CONTRACT-ON-NEXT:    ret
632 ; LA32-CONTRACT-OFF-LABEL: not_contract_fnmsub_d:
633 ; LA32-CONTRACT-OFF:       # %bb.0:
634 ; LA32-CONTRACT-OFF-NEXT:    fneg.d $fa0, $fa0
635 ; LA32-CONTRACT-OFF-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
636 ; LA32-CONTRACT-OFF-NEXT:    ret
638 ; LA64-CONTRACT-FAST-LABEL: not_contract_fnmsub_d:
639 ; LA64-CONTRACT-FAST:       # %bb.0:
640 ; LA64-CONTRACT-FAST-NEXT:    fneg.d $fa0, $fa0
641 ; LA64-CONTRACT-FAST-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
642 ; LA64-CONTRACT-FAST-NEXT:    ret
644 ; LA64-CONTRACT-ON-LABEL: not_contract_fnmsub_d:
645 ; LA64-CONTRACT-ON:       # %bb.0:
646 ; LA64-CONTRACT-ON-NEXT:    fneg.d $fa0, $fa0
647 ; LA64-CONTRACT-ON-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
648 ; LA64-CONTRACT-ON-NEXT:    ret
650 ; LA64-CONTRACT-OFF-LABEL: not_contract_fnmsub_d:
651 ; LA64-CONTRACT-OFF:       # %bb.0:
652 ; LA64-CONTRACT-OFF-NEXT:    fneg.d $fa0, $fa0
653 ; LA64-CONTRACT-OFF-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
654 ; LA64-CONTRACT-OFF-NEXT:    ret
655   %nega = fneg contract double %a
656   %mul = fmul contract double %nega, %b
657   %add = fadd contract double %mul, %c
658   ret double %add
661 declare double @llvm.fma.f64(double, double, double)
663 define double @fmadd_d_intrinsics(double %a, double %b, double %c) nounwind {
664 ; LA32-CONTRACT-FAST-LABEL: fmadd_d_intrinsics:
665 ; LA32-CONTRACT-FAST:       # %bb.0:
666 ; LA32-CONTRACT-FAST-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
667 ; LA32-CONTRACT-FAST-NEXT:    ret
669 ; LA32-CONTRACT-ON-LABEL: fmadd_d_intrinsics:
670 ; LA32-CONTRACT-ON:       # %bb.0:
671 ; LA32-CONTRACT-ON-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
672 ; LA32-CONTRACT-ON-NEXT:    ret
674 ; LA32-CONTRACT-OFF-LABEL: fmadd_d_intrinsics:
675 ; LA32-CONTRACT-OFF:       # %bb.0:
676 ; LA32-CONTRACT-OFF-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
677 ; LA32-CONTRACT-OFF-NEXT:    ret
679 ; LA64-CONTRACT-FAST-LABEL: fmadd_d_intrinsics:
680 ; LA64-CONTRACT-FAST:       # %bb.0:
681 ; LA64-CONTRACT-FAST-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
682 ; LA64-CONTRACT-FAST-NEXT:    ret
684 ; LA64-CONTRACT-ON-LABEL: fmadd_d_intrinsics:
685 ; LA64-CONTRACT-ON:       # %bb.0:
686 ; LA64-CONTRACT-ON-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
687 ; LA64-CONTRACT-ON-NEXT:    ret
689 ; LA64-CONTRACT-OFF-LABEL: fmadd_d_intrinsics:
690 ; LA64-CONTRACT-OFF:       # %bb.0:
691 ; LA64-CONTRACT-OFF-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
692 ; LA64-CONTRACT-OFF-NEXT:    ret
693   %fma = call double @llvm.fma.f64(double %a, double %b, double %c)
694   ret double %fma
697 define double @fmsub_d_intrinsics(double %a, double %b, double %c) nounwind {
698 ; LA32-CONTRACT-FAST-LABEL: fmsub_d_intrinsics:
699 ; LA32-CONTRACT-FAST:       # %bb.0:
700 ; LA32-CONTRACT-FAST-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
701 ; LA32-CONTRACT-FAST-NEXT:    ret
703 ; LA32-CONTRACT-ON-LABEL: fmsub_d_intrinsics:
704 ; LA32-CONTRACT-ON:       # %bb.0:
705 ; LA32-CONTRACT-ON-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
706 ; LA32-CONTRACT-ON-NEXT:    ret
708 ; LA32-CONTRACT-OFF-LABEL: fmsub_d_intrinsics:
709 ; LA32-CONTRACT-OFF:       # %bb.0:
710 ; LA32-CONTRACT-OFF-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
711 ; LA32-CONTRACT-OFF-NEXT:    ret
713 ; LA64-CONTRACT-FAST-LABEL: fmsub_d_intrinsics:
714 ; LA64-CONTRACT-FAST:       # %bb.0:
715 ; LA64-CONTRACT-FAST-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
716 ; LA64-CONTRACT-FAST-NEXT:    ret
718 ; LA64-CONTRACT-ON-LABEL: fmsub_d_intrinsics:
719 ; LA64-CONTRACT-ON:       # %bb.0:
720 ; LA64-CONTRACT-ON-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
721 ; LA64-CONTRACT-ON-NEXT:    ret
723 ; LA64-CONTRACT-OFF-LABEL: fmsub_d_intrinsics:
724 ; LA64-CONTRACT-OFF:       # %bb.0:
725 ; LA64-CONTRACT-OFF-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
726 ; LA64-CONTRACT-OFF-NEXT:    ret
727   %negc = fneg double %c
728   %fma = call double @llvm.fma.f64(double %a, double %b, double %negc)
729   ret double %fma
732 define double @fnmadd_d_intrinsics(double %a, double %b, double %c) nounwind {
733 ; LA32-CONTRACT-FAST-LABEL: fnmadd_d_intrinsics:
734 ; LA32-CONTRACT-FAST:       # %bb.0:
735 ; LA32-CONTRACT-FAST-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
736 ; LA32-CONTRACT-FAST-NEXT:    ret
738 ; LA32-CONTRACT-ON-LABEL: fnmadd_d_intrinsics:
739 ; LA32-CONTRACT-ON:       # %bb.0:
740 ; LA32-CONTRACT-ON-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
741 ; LA32-CONTRACT-ON-NEXT:    ret
743 ; LA32-CONTRACT-OFF-LABEL: fnmadd_d_intrinsics:
744 ; LA32-CONTRACT-OFF:       # %bb.0:
745 ; LA32-CONTRACT-OFF-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
746 ; LA32-CONTRACT-OFF-NEXT:    ret
748 ; LA64-CONTRACT-FAST-LABEL: fnmadd_d_intrinsics:
749 ; LA64-CONTRACT-FAST:       # %bb.0:
750 ; LA64-CONTRACT-FAST-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
751 ; LA64-CONTRACT-FAST-NEXT:    ret
753 ; LA64-CONTRACT-ON-LABEL: fnmadd_d_intrinsics:
754 ; LA64-CONTRACT-ON:       # %bb.0:
755 ; LA64-CONTRACT-ON-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
756 ; LA64-CONTRACT-ON-NEXT:    ret
758 ; LA64-CONTRACT-OFF-LABEL: fnmadd_d_intrinsics:
759 ; LA64-CONTRACT-OFF:       # %bb.0:
760 ; LA64-CONTRACT-OFF-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
761 ; LA64-CONTRACT-OFF-NEXT:    ret
762   %fma = call double @llvm.fma.f64(double %a, double %b, double %c)
763   %negfma = fneg double %fma
764   ret double %negfma
767 define double @fnmadd_d_nsz_intrinsics(double %a, double %b, double %c) nounwind {
768 ; LA32-CONTRACT-FAST-LABEL: fnmadd_d_nsz_intrinsics:
769 ; LA32-CONTRACT-FAST:       # %bb.0:
770 ; LA32-CONTRACT-FAST-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
771 ; LA32-CONTRACT-FAST-NEXT:    ret
773 ; LA32-CONTRACT-ON-LABEL: fnmadd_d_nsz_intrinsics:
774 ; LA32-CONTRACT-ON:       # %bb.0:
775 ; LA32-CONTRACT-ON-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
776 ; LA32-CONTRACT-ON-NEXT:    ret
778 ; LA32-CONTRACT-OFF-LABEL: fnmadd_d_nsz_intrinsics:
779 ; LA32-CONTRACT-OFF:       # %bb.0:
780 ; LA32-CONTRACT-OFF-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
781 ; LA32-CONTRACT-OFF-NEXT:    ret
783 ; LA64-CONTRACT-FAST-LABEL: fnmadd_d_nsz_intrinsics:
784 ; LA64-CONTRACT-FAST:       # %bb.0:
785 ; LA64-CONTRACT-FAST-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
786 ; LA64-CONTRACT-FAST-NEXT:    ret
788 ; LA64-CONTRACT-ON-LABEL: fnmadd_d_nsz_intrinsics:
789 ; LA64-CONTRACT-ON:       # %bb.0:
790 ; LA64-CONTRACT-ON-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
791 ; LA64-CONTRACT-ON-NEXT:    ret
793 ; LA64-CONTRACT-OFF-LABEL: fnmadd_d_nsz_intrinsics:
794 ; LA64-CONTRACT-OFF:       # %bb.0:
795 ; LA64-CONTRACT-OFF-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
796 ; LA64-CONTRACT-OFF-NEXT:    ret
797   %nega = fneg double %a
798   %negc = fneg double %c
799   %fma = call nsz double @llvm.fma.f64(double %nega, double %b, double %negc)
800   ret double %fma
803 ;; Check that fnmadd.d is not emitted.
804 define double @not_fnmadd_d_intrinsics(double %a, double %b, double %c) nounwind {
805 ; LA32-CONTRACT-FAST-LABEL: not_fnmadd_d_intrinsics:
806 ; LA32-CONTRACT-FAST:       # %bb.0:
807 ; LA32-CONTRACT-FAST-NEXT:    fneg.d $fa0, $fa0
808 ; LA32-CONTRACT-FAST-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
809 ; LA32-CONTRACT-FAST-NEXT:    ret
811 ; LA32-CONTRACT-ON-LABEL: not_fnmadd_d_intrinsics:
812 ; LA32-CONTRACT-ON:       # %bb.0:
813 ; LA32-CONTRACT-ON-NEXT:    fneg.d $fa0, $fa0
814 ; LA32-CONTRACT-ON-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
815 ; LA32-CONTRACT-ON-NEXT:    ret
817 ; LA32-CONTRACT-OFF-LABEL: not_fnmadd_d_intrinsics:
818 ; LA32-CONTRACT-OFF:       # %bb.0:
819 ; LA32-CONTRACT-OFF-NEXT:    fneg.d $fa0, $fa0
820 ; LA32-CONTRACT-OFF-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
821 ; LA32-CONTRACT-OFF-NEXT:    ret
823 ; LA64-CONTRACT-FAST-LABEL: not_fnmadd_d_intrinsics:
824 ; LA64-CONTRACT-FAST:       # %bb.0:
825 ; LA64-CONTRACT-FAST-NEXT:    fneg.d $fa0, $fa0
826 ; LA64-CONTRACT-FAST-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
827 ; LA64-CONTRACT-FAST-NEXT:    ret
829 ; LA64-CONTRACT-ON-LABEL: not_fnmadd_d_intrinsics:
830 ; LA64-CONTRACT-ON:       # %bb.0:
831 ; LA64-CONTRACT-ON-NEXT:    fneg.d $fa0, $fa0
832 ; LA64-CONTRACT-ON-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
833 ; LA64-CONTRACT-ON-NEXT:    ret
835 ; LA64-CONTRACT-OFF-LABEL: not_fnmadd_d_intrinsics:
836 ; LA64-CONTRACT-OFF:       # %bb.0:
837 ; LA64-CONTRACT-OFF-NEXT:    fneg.d $fa0, $fa0
838 ; LA64-CONTRACT-OFF-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
839 ; LA64-CONTRACT-OFF-NEXT:    ret
840   %nega = fneg double %a
841   %negc = fneg double %c
842   %fma = call double @llvm.fma.f64(double %nega, double %b, double %negc)
843   ret double %fma
846 define double @fnmsub_d_intrinsics(double %a, double %b, double %c) nounwind {
847 ; LA32-CONTRACT-FAST-LABEL: fnmsub_d_intrinsics:
848 ; LA32-CONTRACT-FAST:       # %bb.0:
849 ; LA32-CONTRACT-FAST-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
850 ; LA32-CONTRACT-FAST-NEXT:    ret
852 ; LA32-CONTRACT-ON-LABEL: fnmsub_d_intrinsics:
853 ; LA32-CONTRACT-ON:       # %bb.0:
854 ; LA32-CONTRACT-ON-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
855 ; LA32-CONTRACT-ON-NEXT:    ret
857 ; LA32-CONTRACT-OFF-LABEL: fnmsub_d_intrinsics:
858 ; LA32-CONTRACT-OFF:       # %bb.0:
859 ; LA32-CONTRACT-OFF-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
860 ; LA32-CONTRACT-OFF-NEXT:    ret
862 ; LA64-CONTRACT-FAST-LABEL: fnmsub_d_intrinsics:
863 ; LA64-CONTRACT-FAST:       # %bb.0:
864 ; LA64-CONTRACT-FAST-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
865 ; LA64-CONTRACT-FAST-NEXT:    ret
867 ; LA64-CONTRACT-ON-LABEL: fnmsub_d_intrinsics:
868 ; LA64-CONTRACT-ON:       # %bb.0:
869 ; LA64-CONTRACT-ON-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
870 ; LA64-CONTRACT-ON-NEXT:    ret
872 ; LA64-CONTRACT-OFF-LABEL: fnmsub_d_intrinsics:
873 ; LA64-CONTRACT-OFF:       # %bb.0:
874 ; LA64-CONTRACT-OFF-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
875 ; LA64-CONTRACT-OFF-NEXT:    ret
876   %negc = fneg double %c
877   %fma = call double @llvm.fma.f64(double %a, double %b, double %negc)
878   %negfma = fneg double %fma
879   ret double %negfma
882 define double @fnmsub_d_nsz_intrinsics(double %a, double %b, double %c) nounwind {
883 ; LA32-CONTRACT-FAST-LABEL: fnmsub_d_nsz_intrinsics:
884 ; LA32-CONTRACT-FAST:       # %bb.0:
885 ; LA32-CONTRACT-FAST-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
886 ; LA32-CONTRACT-FAST-NEXT:    ret
888 ; LA32-CONTRACT-ON-LABEL: fnmsub_d_nsz_intrinsics:
889 ; LA32-CONTRACT-ON:       # %bb.0:
890 ; LA32-CONTRACT-ON-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
891 ; LA32-CONTRACT-ON-NEXT:    ret
893 ; LA32-CONTRACT-OFF-LABEL: fnmsub_d_nsz_intrinsics:
894 ; LA32-CONTRACT-OFF:       # %bb.0:
895 ; LA32-CONTRACT-OFF-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
896 ; LA32-CONTRACT-OFF-NEXT:    ret
898 ; LA64-CONTRACT-FAST-LABEL: fnmsub_d_nsz_intrinsics:
899 ; LA64-CONTRACT-FAST:       # %bb.0:
900 ; LA64-CONTRACT-FAST-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
901 ; LA64-CONTRACT-FAST-NEXT:    ret
903 ; LA64-CONTRACT-ON-LABEL: fnmsub_d_nsz_intrinsics:
904 ; LA64-CONTRACT-ON:       # %bb.0:
905 ; LA64-CONTRACT-ON-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
906 ; LA64-CONTRACT-ON-NEXT:    ret
908 ; LA64-CONTRACT-OFF-LABEL: fnmsub_d_nsz_intrinsics:
909 ; LA64-CONTRACT-OFF:       # %bb.0:
910 ; LA64-CONTRACT-OFF-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
911 ; LA64-CONTRACT-OFF-NEXT:    ret
912   %nega = fneg double %a
913   %fma = call nsz double @llvm.fma.f64(double %nega, double %b, double %c)
914   ret double %fma
917 ;; Check that fnmsub.d is not emitted.
918 define double @not_fnmsub_d_intrinsics(double %a, double %b, double %c) nounwind {
919 ; LA32-CONTRACT-FAST-LABEL: not_fnmsub_d_intrinsics:
920 ; LA32-CONTRACT-FAST:       # %bb.0:
921 ; LA32-CONTRACT-FAST-NEXT:    fneg.d $fa0, $fa0
922 ; LA32-CONTRACT-FAST-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
923 ; LA32-CONTRACT-FAST-NEXT:    ret
925 ; LA32-CONTRACT-ON-LABEL: not_fnmsub_d_intrinsics:
926 ; LA32-CONTRACT-ON:       # %bb.0:
927 ; LA32-CONTRACT-ON-NEXT:    fneg.d $fa0, $fa0
928 ; LA32-CONTRACT-ON-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
929 ; LA32-CONTRACT-ON-NEXT:    ret
931 ; LA32-CONTRACT-OFF-LABEL: not_fnmsub_d_intrinsics:
932 ; LA32-CONTRACT-OFF:       # %bb.0:
933 ; LA32-CONTRACT-OFF-NEXT:    fneg.d $fa0, $fa0
934 ; LA32-CONTRACT-OFF-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
935 ; LA32-CONTRACT-OFF-NEXT:    ret
937 ; LA64-CONTRACT-FAST-LABEL: not_fnmsub_d_intrinsics:
938 ; LA64-CONTRACT-FAST:       # %bb.0:
939 ; LA64-CONTRACT-FAST-NEXT:    fneg.d $fa0, $fa0
940 ; LA64-CONTRACT-FAST-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
941 ; LA64-CONTRACT-FAST-NEXT:    ret
943 ; LA64-CONTRACT-ON-LABEL: not_fnmsub_d_intrinsics:
944 ; LA64-CONTRACT-ON:       # %bb.0:
945 ; LA64-CONTRACT-ON-NEXT:    fneg.d $fa0, $fa0
946 ; LA64-CONTRACT-ON-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
947 ; LA64-CONTRACT-ON-NEXT:    ret
949 ; LA64-CONTRACT-OFF-LABEL: not_fnmsub_d_intrinsics:
950 ; LA64-CONTRACT-OFF:       # %bb.0:
951 ; LA64-CONTRACT-OFF-NEXT:    fneg.d $fa0, $fa0
952 ; LA64-CONTRACT-OFF-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
953 ; LA64-CONTRACT-OFF-NEXT:    ret
954   %nega = fneg double %a
955   %fma = call double @llvm.fma.f64(double %nega, double %b, double %c)
956   ret double %fma
959 define double @fmadd_d_contract(double %a, double %b, double %c) nounwind {
960 ; LA32-CONTRACT-FAST-LABEL: fmadd_d_contract:
961 ; LA32-CONTRACT-FAST:       # %bb.0:
962 ; LA32-CONTRACT-FAST-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
963 ; LA32-CONTRACT-FAST-NEXT:    ret
965 ; LA32-CONTRACT-ON-LABEL: fmadd_d_contract:
966 ; LA32-CONTRACT-ON:       # %bb.0:
967 ; LA32-CONTRACT-ON-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
968 ; LA32-CONTRACT-ON-NEXT:    ret
970 ; LA32-CONTRACT-OFF-LABEL: fmadd_d_contract:
971 ; LA32-CONTRACT-OFF:       # %bb.0:
972 ; LA32-CONTRACT-OFF-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
973 ; LA32-CONTRACT-OFF-NEXT:    ret
975 ; LA64-CONTRACT-FAST-LABEL: fmadd_d_contract:
976 ; LA64-CONTRACT-FAST:       # %bb.0:
977 ; LA64-CONTRACT-FAST-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
978 ; LA64-CONTRACT-FAST-NEXT:    ret
980 ; LA64-CONTRACT-ON-LABEL: fmadd_d_contract:
981 ; LA64-CONTRACT-ON:       # %bb.0:
982 ; LA64-CONTRACT-ON-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
983 ; LA64-CONTRACT-ON-NEXT:    ret
985 ; LA64-CONTRACT-OFF-LABEL: fmadd_d_contract:
986 ; LA64-CONTRACT-OFF:       # %bb.0:
987 ; LA64-CONTRACT-OFF-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
988 ; LA64-CONTRACT-OFF-NEXT:    ret
989   %mul = fmul contract double %a, %b
990   %add = fadd contract double %mul, %c
991   ret double %add
994 define double @fmsub_d_contract(double %a, double %b, double %c) nounwind {
995 ; LA32-CONTRACT-FAST-LABEL: fmsub_d_contract:
996 ; LA32-CONTRACT-FAST:       # %bb.0:
997 ; LA32-CONTRACT-FAST-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
998 ; LA32-CONTRACT-FAST-NEXT:    ret
1000 ; LA32-CONTRACT-ON-LABEL: fmsub_d_contract:
1001 ; LA32-CONTRACT-ON:       # %bb.0:
1002 ; LA32-CONTRACT-ON-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
1003 ; LA32-CONTRACT-ON-NEXT:    ret
1005 ; LA32-CONTRACT-OFF-LABEL: fmsub_d_contract:
1006 ; LA32-CONTRACT-OFF:       # %bb.0:
1007 ; LA32-CONTRACT-OFF-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
1008 ; LA32-CONTRACT-OFF-NEXT:    ret
1010 ; LA64-CONTRACT-FAST-LABEL: fmsub_d_contract:
1011 ; LA64-CONTRACT-FAST:       # %bb.0:
1012 ; LA64-CONTRACT-FAST-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
1013 ; LA64-CONTRACT-FAST-NEXT:    ret
1015 ; LA64-CONTRACT-ON-LABEL: fmsub_d_contract:
1016 ; LA64-CONTRACT-ON:       # %bb.0:
1017 ; LA64-CONTRACT-ON-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
1018 ; LA64-CONTRACT-ON-NEXT:    ret
1020 ; LA64-CONTRACT-OFF-LABEL: fmsub_d_contract:
1021 ; LA64-CONTRACT-OFF:       # %bb.0:
1022 ; LA64-CONTRACT-OFF-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
1023 ; LA64-CONTRACT-OFF-NEXT:    ret
1024   %mul = fmul contract double %a, %b
1025   %sub = fsub contract double %mul, %c
1026   ret double %sub
1029 define double @fnmadd_d_contract(double %a, double %b, double %c) nounwind {
1030 ; LA32-CONTRACT-FAST-LABEL: fnmadd_d_contract:
1031 ; LA32-CONTRACT-FAST:       # %bb.0:
1032 ; LA32-CONTRACT-FAST-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
1033 ; LA32-CONTRACT-FAST-NEXT:    ret
1035 ; LA32-CONTRACT-ON-LABEL: fnmadd_d_contract:
1036 ; LA32-CONTRACT-ON:       # %bb.0:
1037 ; LA32-CONTRACT-ON-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
1038 ; LA32-CONTRACT-ON-NEXT:    ret
1040 ; LA32-CONTRACT-OFF-LABEL: fnmadd_d_contract:
1041 ; LA32-CONTRACT-OFF:       # %bb.0:
1042 ; LA32-CONTRACT-OFF-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
1043 ; LA32-CONTRACT-OFF-NEXT:    ret
1045 ; LA64-CONTRACT-FAST-LABEL: fnmadd_d_contract:
1046 ; LA64-CONTRACT-FAST:       # %bb.0:
1047 ; LA64-CONTRACT-FAST-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
1048 ; LA64-CONTRACT-FAST-NEXT:    ret
1050 ; LA64-CONTRACT-ON-LABEL: fnmadd_d_contract:
1051 ; LA64-CONTRACT-ON:       # %bb.0:
1052 ; LA64-CONTRACT-ON-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
1053 ; LA64-CONTRACT-ON-NEXT:    ret
1055 ; LA64-CONTRACT-OFF-LABEL: fnmadd_d_contract:
1056 ; LA64-CONTRACT-OFF:       # %bb.0:
1057 ; LA64-CONTRACT-OFF-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
1058 ; LA64-CONTRACT-OFF-NEXT:    ret
1059   %mul = fmul contract double %a, %b
1060   %add = fadd contract double %mul, %c
1061   %negadd = fneg contract double %add
1062   ret double %negadd
1065 define double @fnmsub_d_contract(double %a, double %b, double %c) nounwind {
1066 ; LA32-CONTRACT-FAST-LABEL: fnmsub_d_contract:
1067 ; LA32-CONTRACT-FAST:       # %bb.0:
1068 ; LA32-CONTRACT-FAST-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
1069 ; LA32-CONTRACT-FAST-NEXT:    ret
1071 ; LA32-CONTRACT-ON-LABEL: fnmsub_d_contract:
1072 ; LA32-CONTRACT-ON:       # %bb.0:
1073 ; LA32-CONTRACT-ON-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
1074 ; LA32-CONTRACT-ON-NEXT:    ret
1076 ; LA32-CONTRACT-OFF-LABEL: fnmsub_d_contract:
1077 ; LA32-CONTRACT-OFF:       # %bb.0:
1078 ; LA32-CONTRACT-OFF-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
1079 ; LA32-CONTRACT-OFF-NEXT:    ret
1081 ; LA64-CONTRACT-FAST-LABEL: fnmsub_d_contract:
1082 ; LA64-CONTRACT-FAST:       # %bb.0:
1083 ; LA64-CONTRACT-FAST-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
1084 ; LA64-CONTRACT-FAST-NEXT:    ret
1086 ; LA64-CONTRACT-ON-LABEL: fnmsub_d_contract:
1087 ; LA64-CONTRACT-ON:       # %bb.0:
1088 ; LA64-CONTRACT-ON-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
1089 ; LA64-CONTRACT-ON-NEXT:    ret
1091 ; LA64-CONTRACT-OFF-LABEL: fnmsub_d_contract:
1092 ; LA64-CONTRACT-OFF:       # %bb.0:
1093 ; LA64-CONTRACT-OFF-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
1094 ; LA64-CONTRACT-OFF-NEXT:    ret
1095   %mul = fmul contract double %a, %b
1096   %negc = fneg contract double %c
1097   %add = fadd contract double %negc, %mul
1098   %negadd = fneg contract double %add
1099   ret double %negadd