Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / llvm / test / CodeGen / LoongArch / double-fma.ll
blob6dd62847943375325952d10159ca8468f864ff04
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, $fa2, $fa0
240 ; LA32-CONTRACT-ON-NEXT:    ret
242 ; LA32-CONTRACT-OFF-LABEL: fnmsub_d:
243 ; LA32-CONTRACT-OFF:       # %bb.0:
244 ; LA32-CONTRACT-OFF-NEXT:    fmul.d $fa0, $fa0, $fa1
245 ; LA32-CONTRACT-OFF-NEXT:    fsub.d $fa0, $fa2, $fa0
246 ; LA32-CONTRACT-OFF-NEXT:    ret
248 ; LA64-CONTRACT-FAST-LABEL: fnmsub_d:
249 ; LA64-CONTRACT-FAST:       # %bb.0:
250 ; LA64-CONTRACT-FAST-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
251 ; LA64-CONTRACT-FAST-NEXT:    ret
253 ; LA64-CONTRACT-ON-LABEL: fnmsub_d:
254 ; LA64-CONTRACT-ON:       # %bb.0:
255 ; LA64-CONTRACT-ON-NEXT:    fmul.d $fa0, $fa0, $fa1
256 ; LA64-CONTRACT-ON-NEXT:    fsub.d $fa0, $fa2, $fa0
257 ; LA64-CONTRACT-ON-NEXT:    ret
259 ; LA64-CONTRACT-OFF-LABEL: fnmsub_d:
260 ; LA64-CONTRACT-OFF:       # %bb.0:
261 ; LA64-CONTRACT-OFF-NEXT:    fmul.d $fa0, $fa0, $fa1
262 ; LA64-CONTRACT-OFF-NEXT:    fsub.d $fa0, $fa2, $fa0
263 ; LA64-CONTRACT-OFF-NEXT:    ret
264   %nega = fneg double %a
265   %mul = fmul double %nega, %b
266   %add = fadd double %mul, %c
267   ret double %add
270 define double @contract_fmadd_d(double %a, double %b, double %c) nounwind {
271 ; LA32-CONTRACT-FAST-LABEL: contract_fmadd_d:
272 ; LA32-CONTRACT-FAST:       # %bb.0:
273 ; LA32-CONTRACT-FAST-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
274 ; LA32-CONTRACT-FAST-NEXT:    ret
276 ; LA32-CONTRACT-ON-LABEL: contract_fmadd_d:
277 ; LA32-CONTRACT-ON:       # %bb.0:
278 ; LA32-CONTRACT-ON-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
279 ; LA32-CONTRACT-ON-NEXT:    ret
281 ; LA32-CONTRACT-OFF-LABEL: contract_fmadd_d:
282 ; LA32-CONTRACT-OFF:       # %bb.0:
283 ; LA32-CONTRACT-OFF-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
284 ; LA32-CONTRACT-OFF-NEXT:    ret
286 ; LA64-CONTRACT-FAST-LABEL: contract_fmadd_d:
287 ; LA64-CONTRACT-FAST:       # %bb.0:
288 ; LA64-CONTRACT-FAST-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
289 ; LA64-CONTRACT-FAST-NEXT:    ret
291 ; LA64-CONTRACT-ON-LABEL: contract_fmadd_d:
292 ; LA64-CONTRACT-ON:       # %bb.0:
293 ; LA64-CONTRACT-ON-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
294 ; LA64-CONTRACT-ON-NEXT:    ret
296 ; LA64-CONTRACT-OFF-LABEL: contract_fmadd_d:
297 ; LA64-CONTRACT-OFF:       # %bb.0:
298 ; LA64-CONTRACT-OFF-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
299 ; LA64-CONTRACT-OFF-NEXT:    ret
300   %mul = fmul contract double %a, %b
301   %add = fadd contract double %mul, %c
302   ret double %add
305 define double @contract_fmsub_d(double %a, double %b, double %c) nounwind {
306 ; LA32-CONTRACT-FAST-LABEL: contract_fmsub_d:
307 ; LA32-CONTRACT-FAST:       # %bb.0:
308 ; LA32-CONTRACT-FAST-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
309 ; LA32-CONTRACT-FAST-NEXT:    ret
311 ; LA32-CONTRACT-ON-LABEL: contract_fmsub_d:
312 ; LA32-CONTRACT-ON:       # %bb.0:
313 ; LA32-CONTRACT-ON-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
314 ; LA32-CONTRACT-ON-NEXT:    ret
316 ; LA32-CONTRACT-OFF-LABEL: contract_fmsub_d:
317 ; LA32-CONTRACT-OFF:       # %bb.0:
318 ; LA32-CONTRACT-OFF-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
319 ; LA32-CONTRACT-OFF-NEXT:    ret
321 ; LA64-CONTRACT-FAST-LABEL: contract_fmsub_d:
322 ; LA64-CONTRACT-FAST:       # %bb.0:
323 ; LA64-CONTRACT-FAST-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
324 ; LA64-CONTRACT-FAST-NEXT:    ret
326 ; LA64-CONTRACT-ON-LABEL: contract_fmsub_d:
327 ; LA64-CONTRACT-ON:       # %bb.0:
328 ; LA64-CONTRACT-ON-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
329 ; LA64-CONTRACT-ON-NEXT:    ret
331 ; LA64-CONTRACT-OFF-LABEL: contract_fmsub_d:
332 ; LA64-CONTRACT-OFF:       # %bb.0:
333 ; LA64-CONTRACT-OFF-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
334 ; LA64-CONTRACT-OFF-NEXT:    ret
335   %mul = fmul contract double %a, %b
336   %sub = fsub contract double %mul, %c
337   ret double %sub
340 define double @contract_fnmadd_d(double %a, double %b, double %c) nounwind {
341 ; LA32-CONTRACT-FAST-LABEL: contract_fnmadd_d:
342 ; LA32-CONTRACT-FAST:       # %bb.0:
343 ; LA32-CONTRACT-FAST-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
344 ; LA32-CONTRACT-FAST-NEXT:    ret
346 ; LA32-CONTRACT-ON-LABEL: contract_fnmadd_d:
347 ; LA32-CONTRACT-ON:       # %bb.0:
348 ; LA32-CONTRACT-ON-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
349 ; LA32-CONTRACT-ON-NEXT:    ret
351 ; LA32-CONTRACT-OFF-LABEL: contract_fnmadd_d:
352 ; LA32-CONTRACT-OFF:       # %bb.0:
353 ; LA32-CONTRACT-OFF-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
354 ; LA32-CONTRACT-OFF-NEXT:    ret
356 ; LA64-CONTRACT-FAST-LABEL: contract_fnmadd_d:
357 ; LA64-CONTRACT-FAST:       # %bb.0:
358 ; LA64-CONTRACT-FAST-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
359 ; LA64-CONTRACT-FAST-NEXT:    ret
361 ; LA64-CONTRACT-ON-LABEL: contract_fnmadd_d:
362 ; LA64-CONTRACT-ON:       # %bb.0:
363 ; LA64-CONTRACT-ON-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
364 ; LA64-CONTRACT-ON-NEXT:    ret
366 ; LA64-CONTRACT-OFF-LABEL: contract_fnmadd_d:
367 ; LA64-CONTRACT-OFF:       # %bb.0:
368 ; LA64-CONTRACT-OFF-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
369 ; LA64-CONTRACT-OFF-NEXT:    ret
370   %mul = fmul contract double %a, %b
371   %add = fadd contract double %mul, %c
372   %negadd = fneg contract double %add
373   ret double %negadd
376 define double @contract_fnmadd_d_nsz(double %a, double %b, double %c) nounwind {
377 ; LA32-CONTRACT-FAST-LABEL: contract_fnmadd_d_nsz:
378 ; LA32-CONTRACT-FAST:       # %bb.0:
379 ; LA32-CONTRACT-FAST-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
380 ; LA32-CONTRACT-FAST-NEXT:    ret
382 ; LA32-CONTRACT-ON-LABEL: contract_fnmadd_d_nsz:
383 ; LA32-CONTRACT-ON:       # %bb.0:
384 ; LA32-CONTRACT-ON-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
385 ; LA32-CONTRACT-ON-NEXT:    ret
387 ; LA32-CONTRACT-OFF-LABEL: contract_fnmadd_d_nsz:
388 ; LA32-CONTRACT-OFF:       # %bb.0:
389 ; LA32-CONTRACT-OFF-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
390 ; LA32-CONTRACT-OFF-NEXT:    ret
392 ; LA64-CONTRACT-FAST-LABEL: contract_fnmadd_d_nsz:
393 ; LA64-CONTRACT-FAST:       # %bb.0:
394 ; LA64-CONTRACT-FAST-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
395 ; LA64-CONTRACT-FAST-NEXT:    ret
397 ; LA64-CONTRACT-ON-LABEL: contract_fnmadd_d_nsz:
398 ; LA64-CONTRACT-ON:       # %bb.0:
399 ; LA64-CONTRACT-ON-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
400 ; LA64-CONTRACT-ON-NEXT:    ret
402 ; LA64-CONTRACT-OFF-LABEL: contract_fnmadd_d_nsz:
403 ; LA64-CONTRACT-OFF:       # %bb.0:
404 ; LA64-CONTRACT-OFF-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
405 ; LA64-CONTRACT-OFF-NEXT:    ret
406   %nega = fneg contract nsz double %a
407   %negc = fneg contract nsz double %c
408   %mul = fmul contract nsz double %nega, %b
409   %add = fadd contract nsz double %mul, %negc
410   ret double %add
413 ;; Check that fnmadd.d is not emitted.
414 define double @not_contract_fnmadd_d(double %a, double %b, double %c) nounwind {
415 ; LA32-CONTRACT-FAST-LABEL: not_contract_fnmadd_d:
416 ; LA32-CONTRACT-FAST:       # %bb.0:
417 ; LA32-CONTRACT-FAST-NEXT:    fneg.d $fa0, $fa0
418 ; LA32-CONTRACT-FAST-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
419 ; LA32-CONTRACT-FAST-NEXT:    ret
421 ; LA32-CONTRACT-ON-LABEL: not_contract_fnmadd_d:
422 ; LA32-CONTRACT-ON:       # %bb.0:
423 ; LA32-CONTRACT-ON-NEXT:    fneg.d $fa0, $fa0
424 ; LA32-CONTRACT-ON-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
425 ; LA32-CONTRACT-ON-NEXT:    ret
427 ; LA32-CONTRACT-OFF-LABEL: not_contract_fnmadd_d:
428 ; LA32-CONTRACT-OFF:       # %bb.0:
429 ; LA32-CONTRACT-OFF-NEXT:    fneg.d $fa0, $fa0
430 ; LA32-CONTRACT-OFF-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
431 ; LA32-CONTRACT-OFF-NEXT:    ret
433 ; LA64-CONTRACT-FAST-LABEL: not_contract_fnmadd_d:
434 ; LA64-CONTRACT-FAST:       # %bb.0:
435 ; LA64-CONTRACT-FAST-NEXT:    fneg.d $fa0, $fa0
436 ; LA64-CONTRACT-FAST-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
437 ; LA64-CONTRACT-FAST-NEXT:    ret
439 ; LA64-CONTRACT-ON-LABEL: not_contract_fnmadd_d:
440 ; LA64-CONTRACT-ON:       # %bb.0:
441 ; LA64-CONTRACT-ON-NEXT:    fneg.d $fa0, $fa0
442 ; LA64-CONTRACT-ON-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
443 ; LA64-CONTRACT-ON-NEXT:    ret
445 ; LA64-CONTRACT-OFF-LABEL: not_contract_fnmadd_d:
446 ; LA64-CONTRACT-OFF:       # %bb.0:
447 ; LA64-CONTRACT-OFF-NEXT:    fneg.d $fa0, $fa0
448 ; LA64-CONTRACT-OFF-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
449 ; LA64-CONTRACT-OFF-NEXT:    ret
450   %nega = fneg contract double %a
451   %negc = fneg contract double %c
452   %mul = fmul contract double %nega, %b
453   %add = fadd contract double %mul, %negc
454   ret double %add
457 define double @contract_fnmsub_d(double %a, double %b, double %c) nounwind {
458 ; LA32-CONTRACT-FAST-LABEL: contract_fnmsub_d:
459 ; LA32-CONTRACT-FAST:       # %bb.0:
460 ; LA32-CONTRACT-FAST-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
461 ; LA32-CONTRACT-FAST-NEXT:    ret
463 ; LA32-CONTRACT-ON-LABEL: contract_fnmsub_d:
464 ; LA32-CONTRACT-ON:       # %bb.0:
465 ; LA32-CONTRACT-ON-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
466 ; LA32-CONTRACT-ON-NEXT:    ret
468 ; LA32-CONTRACT-OFF-LABEL: contract_fnmsub_d:
469 ; LA32-CONTRACT-OFF:       # %bb.0:
470 ; LA32-CONTRACT-OFF-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
471 ; LA32-CONTRACT-OFF-NEXT:    ret
473 ; LA64-CONTRACT-FAST-LABEL: contract_fnmsub_d:
474 ; LA64-CONTRACT-FAST:       # %bb.0:
475 ; LA64-CONTRACT-FAST-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
476 ; LA64-CONTRACT-FAST-NEXT:    ret
478 ; LA64-CONTRACT-ON-LABEL: contract_fnmsub_d:
479 ; LA64-CONTRACT-ON:       # %bb.0:
480 ; LA64-CONTRACT-ON-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
481 ; LA64-CONTRACT-ON-NEXT:    ret
483 ; LA64-CONTRACT-OFF-LABEL: contract_fnmsub_d:
484 ; LA64-CONTRACT-OFF:       # %bb.0:
485 ; LA64-CONTRACT-OFF-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
486 ; LA64-CONTRACT-OFF-NEXT:    ret
487   %nega = fneg contract double %a
488   %mul = fmul contract double %nega, %b
489   %add = fadd contract double %mul, %c
490   ret double %add
493 declare double @llvm.fma.f64(double, double, double)
495 define double @fmadd_d_intrinsics(double %a, double %b, double %c) nounwind {
496 ; LA32-CONTRACT-FAST-LABEL: fmadd_d_intrinsics:
497 ; LA32-CONTRACT-FAST:       # %bb.0:
498 ; LA32-CONTRACT-FAST-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
499 ; LA32-CONTRACT-FAST-NEXT:    ret
501 ; LA32-CONTRACT-ON-LABEL: fmadd_d_intrinsics:
502 ; LA32-CONTRACT-ON:       # %bb.0:
503 ; LA32-CONTRACT-ON-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
504 ; LA32-CONTRACT-ON-NEXT:    ret
506 ; LA32-CONTRACT-OFF-LABEL: fmadd_d_intrinsics:
507 ; LA32-CONTRACT-OFF:       # %bb.0:
508 ; LA32-CONTRACT-OFF-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
509 ; LA32-CONTRACT-OFF-NEXT:    ret
511 ; LA64-CONTRACT-FAST-LABEL: fmadd_d_intrinsics:
512 ; LA64-CONTRACT-FAST:       # %bb.0:
513 ; LA64-CONTRACT-FAST-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
514 ; LA64-CONTRACT-FAST-NEXT:    ret
516 ; LA64-CONTRACT-ON-LABEL: fmadd_d_intrinsics:
517 ; LA64-CONTRACT-ON:       # %bb.0:
518 ; LA64-CONTRACT-ON-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
519 ; LA64-CONTRACT-ON-NEXT:    ret
521 ; LA64-CONTRACT-OFF-LABEL: fmadd_d_intrinsics:
522 ; LA64-CONTRACT-OFF:       # %bb.0:
523 ; LA64-CONTRACT-OFF-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
524 ; LA64-CONTRACT-OFF-NEXT:    ret
525   %fma = call double @llvm.fma.f64(double %a, double %b, double %c)
526   ret double %fma
529 define double @fmsub_d_intrinsics(double %a, double %b, double %c) nounwind {
530 ; LA32-CONTRACT-FAST-LABEL: fmsub_d_intrinsics:
531 ; LA32-CONTRACT-FAST:       # %bb.0:
532 ; LA32-CONTRACT-FAST-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
533 ; LA32-CONTRACT-FAST-NEXT:    ret
535 ; LA32-CONTRACT-ON-LABEL: fmsub_d_intrinsics:
536 ; LA32-CONTRACT-ON:       # %bb.0:
537 ; LA32-CONTRACT-ON-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
538 ; LA32-CONTRACT-ON-NEXT:    ret
540 ; LA32-CONTRACT-OFF-LABEL: fmsub_d_intrinsics:
541 ; LA32-CONTRACT-OFF:       # %bb.0:
542 ; LA32-CONTRACT-OFF-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
543 ; LA32-CONTRACT-OFF-NEXT:    ret
545 ; LA64-CONTRACT-FAST-LABEL: fmsub_d_intrinsics:
546 ; LA64-CONTRACT-FAST:       # %bb.0:
547 ; LA64-CONTRACT-FAST-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
548 ; LA64-CONTRACT-FAST-NEXT:    ret
550 ; LA64-CONTRACT-ON-LABEL: fmsub_d_intrinsics:
551 ; LA64-CONTRACT-ON:       # %bb.0:
552 ; LA64-CONTRACT-ON-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
553 ; LA64-CONTRACT-ON-NEXT:    ret
555 ; LA64-CONTRACT-OFF-LABEL: fmsub_d_intrinsics:
556 ; LA64-CONTRACT-OFF:       # %bb.0:
557 ; LA64-CONTRACT-OFF-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
558 ; LA64-CONTRACT-OFF-NEXT:    ret
559   %negc = fneg double %c
560   %fma = call double @llvm.fma.f64(double %a, double %b, double %negc)
561   ret double %fma
564 define double @fnmadd_d_intrinsics(double %a, double %b, double %c) nounwind {
565 ; LA32-CONTRACT-FAST-LABEL: fnmadd_d_intrinsics:
566 ; LA32-CONTRACT-FAST:       # %bb.0:
567 ; LA32-CONTRACT-FAST-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
568 ; LA32-CONTRACT-FAST-NEXT:    ret
570 ; LA32-CONTRACT-ON-LABEL: fnmadd_d_intrinsics:
571 ; LA32-CONTRACT-ON:       # %bb.0:
572 ; LA32-CONTRACT-ON-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
573 ; LA32-CONTRACT-ON-NEXT:    ret
575 ; LA32-CONTRACT-OFF-LABEL: fnmadd_d_intrinsics:
576 ; LA32-CONTRACT-OFF:       # %bb.0:
577 ; LA32-CONTRACT-OFF-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
578 ; LA32-CONTRACT-OFF-NEXT:    ret
580 ; LA64-CONTRACT-FAST-LABEL: fnmadd_d_intrinsics:
581 ; LA64-CONTRACT-FAST:       # %bb.0:
582 ; LA64-CONTRACT-FAST-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
583 ; LA64-CONTRACT-FAST-NEXT:    ret
585 ; LA64-CONTRACT-ON-LABEL: fnmadd_d_intrinsics:
586 ; LA64-CONTRACT-ON:       # %bb.0:
587 ; LA64-CONTRACT-ON-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
588 ; LA64-CONTRACT-ON-NEXT:    ret
590 ; LA64-CONTRACT-OFF-LABEL: fnmadd_d_intrinsics:
591 ; LA64-CONTRACT-OFF:       # %bb.0:
592 ; LA64-CONTRACT-OFF-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
593 ; LA64-CONTRACT-OFF-NEXT:    ret
594   %fma = call double @llvm.fma.f64(double %a, double %b, double %c)
595   %neg = fneg double %fma
596   ret double %neg
599 define double @fnmadd_d_nsz_intrinsics(double %a, double %b, double %c) nounwind {
600 ; LA32-CONTRACT-FAST-LABEL: fnmadd_d_nsz_intrinsics:
601 ; LA32-CONTRACT-FAST:       # %bb.0:
602 ; LA32-CONTRACT-FAST-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
603 ; LA32-CONTRACT-FAST-NEXT:    ret
605 ; LA32-CONTRACT-ON-LABEL: fnmadd_d_nsz_intrinsics:
606 ; LA32-CONTRACT-ON:       # %bb.0:
607 ; LA32-CONTRACT-ON-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
608 ; LA32-CONTRACT-ON-NEXT:    ret
610 ; LA32-CONTRACT-OFF-LABEL: fnmadd_d_nsz_intrinsics:
611 ; LA32-CONTRACT-OFF:       # %bb.0:
612 ; LA32-CONTRACT-OFF-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
613 ; LA32-CONTRACT-OFF-NEXT:    ret
615 ; LA64-CONTRACT-FAST-LABEL: fnmadd_d_nsz_intrinsics:
616 ; LA64-CONTRACT-FAST:       # %bb.0:
617 ; LA64-CONTRACT-FAST-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
618 ; LA64-CONTRACT-FAST-NEXT:    ret
620 ; LA64-CONTRACT-ON-LABEL: fnmadd_d_nsz_intrinsics:
621 ; LA64-CONTRACT-ON:       # %bb.0:
622 ; LA64-CONTRACT-ON-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
623 ; LA64-CONTRACT-ON-NEXT:    ret
625 ; LA64-CONTRACT-OFF-LABEL: fnmadd_d_nsz_intrinsics:
626 ; LA64-CONTRACT-OFF:       # %bb.0:
627 ; LA64-CONTRACT-OFF-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
628 ; LA64-CONTRACT-OFF-NEXT:    ret
629   %nega = fneg double %a
630   %negc = fneg double %c
631   %fma = call nsz double @llvm.fma.f64(double %nega, double %b, double %negc)
632   ret double %fma
635 ;; Check that fnmadd.d is not emitted.
636 define double @not_fnmadd_d_intrinsics(double %a, double %b, double %c) nounwind {
637 ; LA32-CONTRACT-FAST-LABEL: not_fnmadd_d_intrinsics:
638 ; LA32-CONTRACT-FAST:       # %bb.0:
639 ; LA32-CONTRACT-FAST-NEXT:    fneg.d $fa0, $fa0
640 ; LA32-CONTRACT-FAST-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
641 ; LA32-CONTRACT-FAST-NEXT:    ret
643 ; LA32-CONTRACT-ON-LABEL: not_fnmadd_d_intrinsics:
644 ; LA32-CONTRACT-ON:       # %bb.0:
645 ; LA32-CONTRACT-ON-NEXT:    fneg.d $fa0, $fa0
646 ; LA32-CONTRACT-ON-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
647 ; LA32-CONTRACT-ON-NEXT:    ret
649 ; LA32-CONTRACT-OFF-LABEL: not_fnmadd_d_intrinsics:
650 ; LA32-CONTRACT-OFF:       # %bb.0:
651 ; LA32-CONTRACT-OFF-NEXT:    fneg.d $fa0, $fa0
652 ; LA32-CONTRACT-OFF-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
653 ; LA32-CONTRACT-OFF-NEXT:    ret
655 ; LA64-CONTRACT-FAST-LABEL: not_fnmadd_d_intrinsics:
656 ; LA64-CONTRACT-FAST:       # %bb.0:
657 ; LA64-CONTRACT-FAST-NEXT:    fneg.d $fa0, $fa0
658 ; LA64-CONTRACT-FAST-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
659 ; LA64-CONTRACT-FAST-NEXT:    ret
661 ; LA64-CONTRACT-ON-LABEL: not_fnmadd_d_intrinsics:
662 ; LA64-CONTRACT-ON:       # %bb.0:
663 ; LA64-CONTRACT-ON-NEXT:    fneg.d $fa0, $fa0
664 ; LA64-CONTRACT-ON-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
665 ; LA64-CONTRACT-ON-NEXT:    ret
667 ; LA64-CONTRACT-OFF-LABEL: not_fnmadd_d_intrinsics:
668 ; LA64-CONTRACT-OFF:       # %bb.0:
669 ; LA64-CONTRACT-OFF-NEXT:    fneg.d $fa0, $fa0
670 ; LA64-CONTRACT-OFF-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
671 ; LA64-CONTRACT-OFF-NEXT:    ret
672   %nega = fneg double %a
673   %negc = fneg double %c
674   %fma = call double @llvm.fma.f64(double %nega, double %b, double %negc)
675   ret double %fma
678 define double @fnmsub_d_intrinsics(double %a, double %b, double %c) nounwind {
679 ; LA32-CONTRACT-FAST-LABEL: fnmsub_d_intrinsics:
680 ; LA32-CONTRACT-FAST:       # %bb.0:
681 ; LA32-CONTRACT-FAST-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
682 ; LA32-CONTRACT-FAST-NEXT:    ret
684 ; LA32-CONTRACT-ON-LABEL: fnmsub_d_intrinsics:
685 ; LA32-CONTRACT-ON:       # %bb.0:
686 ; LA32-CONTRACT-ON-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
687 ; LA32-CONTRACT-ON-NEXT:    ret
689 ; LA32-CONTRACT-OFF-LABEL: fnmsub_d_intrinsics:
690 ; LA32-CONTRACT-OFF:       # %bb.0:
691 ; LA32-CONTRACT-OFF-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
692 ; LA32-CONTRACT-OFF-NEXT:    ret
694 ; LA64-CONTRACT-FAST-LABEL: fnmsub_d_intrinsics:
695 ; LA64-CONTRACT-FAST:       # %bb.0:
696 ; LA64-CONTRACT-FAST-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
697 ; LA64-CONTRACT-FAST-NEXT:    ret
699 ; LA64-CONTRACT-ON-LABEL: fnmsub_d_intrinsics:
700 ; LA64-CONTRACT-ON:       # %bb.0:
701 ; LA64-CONTRACT-ON-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
702 ; LA64-CONTRACT-ON-NEXT:    ret
704 ; LA64-CONTRACT-OFF-LABEL: fnmsub_d_intrinsics:
705 ; LA64-CONTRACT-OFF:       # %bb.0:
706 ; LA64-CONTRACT-OFF-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
707 ; LA64-CONTRACT-OFF-NEXT:    ret
708   %nega = fneg double %a
709   %fma = call double @llvm.fma.f64(double %nega, double %b, double %c)
710   ret double %fma
713 define double @fnmsub_d_swap_intrinsics(double %a, double %b, double %c) nounwind {
714 ; LA32-CONTRACT-FAST-LABEL: fnmsub_d_swap_intrinsics:
715 ; LA32-CONTRACT-FAST:       # %bb.0:
716 ; LA32-CONTRACT-FAST-NEXT:    fnmsub.d $fa0, $fa1, $fa0, $fa2
717 ; LA32-CONTRACT-FAST-NEXT:    ret
719 ; LA32-CONTRACT-ON-LABEL: fnmsub_d_swap_intrinsics:
720 ; LA32-CONTRACT-ON:       # %bb.0:
721 ; LA32-CONTRACT-ON-NEXT:    fnmsub.d $fa0, $fa1, $fa0, $fa2
722 ; LA32-CONTRACT-ON-NEXT:    ret
724 ; LA32-CONTRACT-OFF-LABEL: fnmsub_d_swap_intrinsics:
725 ; LA32-CONTRACT-OFF:       # %bb.0:
726 ; LA32-CONTRACT-OFF-NEXT:    fnmsub.d $fa0, $fa1, $fa0, $fa2
727 ; LA32-CONTRACT-OFF-NEXT:    ret
729 ; LA64-CONTRACT-FAST-LABEL: fnmsub_d_swap_intrinsics:
730 ; LA64-CONTRACT-FAST:       # %bb.0:
731 ; LA64-CONTRACT-FAST-NEXT:    fnmsub.d $fa0, $fa1, $fa0, $fa2
732 ; LA64-CONTRACT-FAST-NEXT:    ret
734 ; LA64-CONTRACT-ON-LABEL: fnmsub_d_swap_intrinsics:
735 ; LA64-CONTRACT-ON:       # %bb.0:
736 ; LA64-CONTRACT-ON-NEXT:    fnmsub.d $fa0, $fa1, $fa0, $fa2
737 ; LA64-CONTRACT-ON-NEXT:    ret
739 ; LA64-CONTRACT-OFF-LABEL: fnmsub_d_swap_intrinsics:
740 ; LA64-CONTRACT-OFF:       # %bb.0:
741 ; LA64-CONTRACT-OFF-NEXT:    fnmsub.d $fa0, $fa1, $fa0, $fa2
742 ; LA64-CONTRACT-OFF-NEXT:    ret
743   %negb = fneg double %b
744   %fma = call double @llvm.fma.f64(double %a, double %negb, double %c)
745   ret double %fma
748 define double @fmadd_d_contract(double %a, double %b, double %c) nounwind {
749 ; LA32-CONTRACT-FAST-LABEL: fmadd_d_contract:
750 ; LA32-CONTRACT-FAST:       # %bb.0:
751 ; LA32-CONTRACT-FAST-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
752 ; LA32-CONTRACT-FAST-NEXT:    ret
754 ; LA32-CONTRACT-ON-LABEL: fmadd_d_contract:
755 ; LA32-CONTRACT-ON:       # %bb.0:
756 ; LA32-CONTRACT-ON-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
757 ; LA32-CONTRACT-ON-NEXT:    ret
759 ; LA32-CONTRACT-OFF-LABEL: fmadd_d_contract:
760 ; LA32-CONTRACT-OFF:       # %bb.0:
761 ; LA32-CONTRACT-OFF-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
762 ; LA32-CONTRACT-OFF-NEXT:    ret
764 ; LA64-CONTRACT-FAST-LABEL: fmadd_d_contract:
765 ; LA64-CONTRACT-FAST:       # %bb.0:
766 ; LA64-CONTRACT-FAST-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
767 ; LA64-CONTRACT-FAST-NEXT:    ret
769 ; LA64-CONTRACT-ON-LABEL: fmadd_d_contract:
770 ; LA64-CONTRACT-ON:       # %bb.0:
771 ; LA64-CONTRACT-ON-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
772 ; LA64-CONTRACT-ON-NEXT:    ret
774 ; LA64-CONTRACT-OFF-LABEL: fmadd_d_contract:
775 ; LA64-CONTRACT-OFF:       # %bb.0:
776 ; LA64-CONTRACT-OFF-NEXT:    fmadd.d $fa0, $fa0, $fa1, $fa2
777 ; LA64-CONTRACT-OFF-NEXT:    ret
778   %mul = fmul contract double %a, %b
779   %add = fadd contract double %mul, %c
780   ret double %add
783 define double @fmsub_d_contract(double %a, double %b, double %c) nounwind {
784 ; LA32-CONTRACT-FAST-LABEL: fmsub_d_contract:
785 ; LA32-CONTRACT-FAST:       # %bb.0:
786 ; LA32-CONTRACT-FAST-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
787 ; LA32-CONTRACT-FAST-NEXT:    ret
789 ; LA32-CONTRACT-ON-LABEL: fmsub_d_contract:
790 ; LA32-CONTRACT-ON:       # %bb.0:
791 ; LA32-CONTRACT-ON-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
792 ; LA32-CONTRACT-ON-NEXT:    ret
794 ; LA32-CONTRACT-OFF-LABEL: fmsub_d_contract:
795 ; LA32-CONTRACT-OFF:       # %bb.0:
796 ; LA32-CONTRACT-OFF-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
797 ; LA32-CONTRACT-OFF-NEXT:    ret
799 ; LA64-CONTRACT-FAST-LABEL: fmsub_d_contract:
800 ; LA64-CONTRACT-FAST:       # %bb.0:
801 ; LA64-CONTRACT-FAST-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
802 ; LA64-CONTRACT-FAST-NEXT:    ret
804 ; LA64-CONTRACT-ON-LABEL: fmsub_d_contract:
805 ; LA64-CONTRACT-ON:       # %bb.0:
806 ; LA64-CONTRACT-ON-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
807 ; LA64-CONTRACT-ON-NEXT:    ret
809 ; LA64-CONTRACT-OFF-LABEL: fmsub_d_contract:
810 ; LA64-CONTRACT-OFF:       # %bb.0:
811 ; LA64-CONTRACT-OFF-NEXT:    fmsub.d $fa0, $fa0, $fa1, $fa2
812 ; LA64-CONTRACT-OFF-NEXT:    ret
813   %mul = fmul contract double %a, %b
814   %sub = fsub contract double %mul, %c
815   ret double %sub
818 define double @fnmadd_d_contract(double %a, double %b, double %c) nounwind {
819 ; LA32-CONTRACT-FAST-LABEL: fnmadd_d_contract:
820 ; LA32-CONTRACT-FAST:       # %bb.0:
821 ; LA32-CONTRACT-FAST-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
822 ; LA32-CONTRACT-FAST-NEXT:    ret
824 ; LA32-CONTRACT-ON-LABEL: fnmadd_d_contract:
825 ; LA32-CONTRACT-ON:       # %bb.0:
826 ; LA32-CONTRACT-ON-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
827 ; LA32-CONTRACT-ON-NEXT:    ret
829 ; LA32-CONTRACT-OFF-LABEL: fnmadd_d_contract:
830 ; LA32-CONTRACT-OFF:       # %bb.0:
831 ; LA32-CONTRACT-OFF-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
832 ; LA32-CONTRACT-OFF-NEXT:    ret
834 ; LA64-CONTRACT-FAST-LABEL: fnmadd_d_contract:
835 ; LA64-CONTRACT-FAST:       # %bb.0:
836 ; LA64-CONTRACT-FAST-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
837 ; LA64-CONTRACT-FAST-NEXT:    ret
839 ; LA64-CONTRACT-ON-LABEL: fnmadd_d_contract:
840 ; LA64-CONTRACT-ON:       # %bb.0:
841 ; LA64-CONTRACT-ON-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
842 ; LA64-CONTRACT-ON-NEXT:    ret
844 ; LA64-CONTRACT-OFF-LABEL: fnmadd_d_contract:
845 ; LA64-CONTRACT-OFF:       # %bb.0:
846 ; LA64-CONTRACT-OFF-NEXT:    fnmadd.d $fa0, $fa0, $fa1, $fa2
847 ; LA64-CONTRACT-OFF-NEXT:    ret
848   %mul = fmul contract double %a, %b
849   %add = fadd contract double %mul, %c
850   %negadd = fneg contract double %add
851   ret double %negadd
854 define double @fnmsub_d_contract(double %a, double %b, double %c) nounwind {
855 ; LA32-CONTRACT-FAST-LABEL: fnmsub_d_contract:
856 ; LA32-CONTRACT-FAST:       # %bb.0:
857 ; LA32-CONTRACT-FAST-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
858 ; LA32-CONTRACT-FAST-NEXT:    ret
860 ; LA32-CONTRACT-ON-LABEL: fnmsub_d_contract:
861 ; LA32-CONTRACT-ON:       # %bb.0:
862 ; LA32-CONTRACT-ON-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
863 ; LA32-CONTRACT-ON-NEXT:    ret
865 ; LA32-CONTRACT-OFF-LABEL: fnmsub_d_contract:
866 ; LA32-CONTRACT-OFF:       # %bb.0:
867 ; LA32-CONTRACT-OFF-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
868 ; LA32-CONTRACT-OFF-NEXT:    ret
870 ; LA64-CONTRACT-FAST-LABEL: fnmsub_d_contract:
871 ; LA64-CONTRACT-FAST:       # %bb.0:
872 ; LA64-CONTRACT-FAST-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
873 ; LA64-CONTRACT-FAST-NEXT:    ret
875 ; LA64-CONTRACT-ON-LABEL: fnmsub_d_contract:
876 ; LA64-CONTRACT-ON:       # %bb.0:
877 ; LA64-CONTRACT-ON-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
878 ; LA64-CONTRACT-ON-NEXT:    ret
880 ; LA64-CONTRACT-OFF-LABEL: fnmsub_d_contract:
881 ; LA64-CONTRACT-OFF:       # %bb.0:
882 ; LA64-CONTRACT-OFF-NEXT:    fnmsub.d $fa0, $fa0, $fa1, $fa2
883 ; LA64-CONTRACT-OFF-NEXT:    ret
884   %mul = fmul contract double %a, %b
885   %sub = fsub contract double %c, %mul
886   ret double %sub