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