llvm.org GIT mirror llvm / cd12a17
[NFC][CodeGen] Add unary FNeg tests to some X86/ and XCore/ tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362987 91177308-0d34-0410-b5e6-96231b3b80d8 Cameron McInally 4 months ago
5 changed file(s) with 401 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
6060 ret <4 x float> %0
6161 }
6262
63 define <4 x float> @test_mm_fmsub_ps_unary_fneg(<4 x float> %a, <4 x float> %b, <4 x float> %c) {
64 ; CHECK-LABEL: test_mm_fmsub_ps_unary_fneg:
65 ; CHECK: # %bb.0: # %entry
66 ; CHECK-NEXT: vxorps {{.*}}(%rip), %xmm2, %xmm2
67 ; CHECK-NEXT: vfmadd213ps {{.*#+}} xmm0 = (xmm1 * xmm0) + xmm2
68 ; CHECK-NEXT: retq
69 entry:
70 %neg.i = fneg <4 x float> %c
71 %0 = tail call <4 x float> @llvm.fma.v4f32(<4 x float> %a, <4 x float> %b, <4 x float> %neg.i) #2
72 ret <4 x float> %0
73 }
74
6375 define <2 x double> @test_mm_fmsub_pd(<2 x double> %a, <2 x double> %b, <2 x double> %c) {
6476 ; CHECK-LABEL: test_mm_fmsub_pd:
6577 ; CHECK: # %bb.0: # %entry
6981 entry:
7082 %sub.i = fsub <2 x double> , %c
7183 %0 = tail call <2 x double> @llvm.fma.v2f64(<2 x double> %a, <2 x double> %b, <2 x double> %sub.i) #2
84 ret <2 x double> %0
85 }
86
87 define <2 x double> @test_mm_fmsub_pd_unary_fneg(<2 x double> %a, <2 x double> %b, <2 x double> %c) {
88 ; CHECK-LABEL: test_mm_fmsub_pd_unary_fneg:
89 ; CHECK: # %bb.0: # %entry
90 ; CHECK-NEXT: vxorpd {{.*}}(%rip), %xmm2, %xmm2
91 ; CHECK-NEXT: vfmadd213pd {{.*#+}} xmm0 = (xmm1 * xmm0) + xmm2
92 ; CHECK-NEXT: retq
93 entry:
94 %neg.i = fneg <2 x double> %c
95 %0 = tail call <2 x double> @llvm.fma.v2f64(<2 x double> %a, <2 x double> %b, <2 x double> %neg.i) #2
7296 ret <2 x double> %0
7397 }
7498
87111 ret <4 x float> %4
88112 }
89113
114 define <4 x float> @test_mm_fmsub_ss_unary_fneg(<4 x float> %a, <4 x float> %b, <4 x float> %c) {
115 ; CHECK-LABEL: test_mm_fmsub_ss_unary_fneg:
116 ; CHECK: # %bb.0: # %entry
117 ; CHECK-NEXT: vfmsub213ss {{.*#+}} xmm0 = (xmm1 * xmm0) - xmm2
118 ; CHECK-NEXT: retq
119 entry:
120 %0 = extractelement <4 x float> %a, i64 0
121 %1 = extractelement <4 x float> %b, i64 0
122 %.rhs.i = extractelement <4 x float> %c, i64 0
123 %2 = fneg float %.rhs.i
124 %3 = tail call float @llvm.fma.f32(float %0, float %1, float %2) #2
125 %4 = insertelement <4 x float> %a, float %3, i64 0
126 ret <4 x float> %4
127 }
128
90129 define <2 x double> @test_mm_fmsub_sd(<2 x double> %a, <2 x double> %b, <2 x double> %c) {
91130 ; CHECK-LABEL: test_mm_fmsub_sd:
92131 ; CHECK: # %bb.0: # %entry
102141 ret <2 x double> %4
103142 }
104143
144 define <2 x double> @test_mm_fmsub_sd_unary_fneg(<2 x double> %a, <2 x double> %b, <2 x double> %c) {
145 ; CHECK-LABEL: test_mm_fmsub_sd_unary_fneg:
146 ; CHECK: # %bb.0: # %entry
147 ; CHECK-NEXT: vfmsub213sd {{.*#+}} xmm0 = (xmm1 * xmm0) - xmm2
148 ; CHECK-NEXT: retq
149 entry:
150 %0 = extractelement <2 x double> %a, i64 0
151 %1 = extractelement <2 x double> %b, i64 0
152 %.rhs.i = extractelement <2 x double> %c, i64 0
153 %2 = fneg double %.rhs.i
154 %3 = tail call double @llvm.fma.f64(double %0, double %1, double %2) #2
155 %4 = insertelement <2 x double> %a, double %3, i64 0
156 ret <2 x double> %4
157 }
158
105159 define <4 x float> @test_mm_fnmadd_ps(<4 x float> %a, <4 x float> %b, <4 x float> %c) {
106160 ; CHECK-LABEL: test_mm_fnmadd_ps:
107161 ; CHECK: # %bb.0: # %entry
114168 ret <4 x float> %0
115169 }
116170
171 define <4 x float> @test_mm_fnmadd_ps_unary_fneg(<4 x float> %a, <4 x float> %b, <4 x float> %c) {
172 ; CHECK-LABEL: test_mm_fnmadd_ps_unary_fneg:
173 ; CHECK: # %bb.0: # %entry
174 ; CHECK-NEXT: vxorps {{.*}}(%rip), %xmm0, %xmm0
175 ; CHECK-NEXT: vfmadd213ps {{.*#+}} xmm0 = (xmm1 * xmm0) + xmm2
176 ; CHECK-NEXT: retq
177 entry:
178 %neg.i = fneg <4 x float> %a
179 %0 = tail call <4 x float> @llvm.fma.v4f32(<4 x float> %neg.i, <4 x float> %b, <4 x float> %c) #2
180 ret <4 x float> %0
181 }
182
117183 define <2 x double> @test_mm_fnmadd_pd(<2 x double> %a, <2 x double> %b, <2 x double> %c) {
118184 ; CHECK-LABEL: test_mm_fnmadd_pd:
119185 ; CHECK: # %bb.0: # %entry
123189 entry:
124190 %sub.i = fsub <2 x double> , %a
125191 %0 = tail call <2 x double> @llvm.fma.v2f64(<2 x double> %sub.i, <2 x double> %b, <2 x double> %c) #2
192 ret <2 x double> %0
193 }
194
195 define <2 x double> @test_mm_fnmadd_pd_unary_fneg(<2 x double> %a, <2 x double> %b, <2 x double> %c) {
196 ; CHECK-LABEL: test_mm_fnmadd_pd_unary_fneg:
197 ; CHECK: # %bb.0: # %entry
198 ; CHECK-NEXT: vxorpd {{.*}}(%rip), %xmm0, %xmm0
199 ; CHECK-NEXT: vfmadd213pd {{.*#+}} xmm0 = (xmm1 * xmm0) + xmm2
200 ; CHECK-NEXT: retq
201 entry:
202 %neg.i = fneg <2 x double> %a
203 %0 = tail call <2 x double> @llvm.fma.v2f64(<2 x double> %neg.i, <2 x double> %b, <2 x double> %c) #2
126204 ret <2 x double> %0
127205 }
128206
141219 ret <4 x float> %4
142220 }
143221
222 define <4 x float> @test_mm_fnmadd_ss_unary_fneg(<4 x float> %a, <4 x float> %b, <4 x float> %c) {
223 ; CHECK-LABEL: test_mm_fnmadd_ss_unary_fneg:
224 ; CHECK: # %bb.0: # %entry
225 ; CHECK-NEXT: vfnmadd213ss {{.*#+}} xmm0 = -(xmm1 * xmm0) + xmm2
226 ; CHECK-NEXT: retq
227 entry:
228 %0 = extractelement <4 x float> %a, i64 0
229 %.rhs.i = extractelement <4 x float> %b, i64 0
230 %1 = fneg float %.rhs.i
231 %2 = extractelement <4 x float> %c, i64 0
232 %3 = tail call float @llvm.fma.f32(float %0, float %1, float %2) #2
233 %4 = insertelement <4 x float> %a, float %3, i64 0
234 ret <4 x float> %4
235 }
236
144237 define <2 x double> @test_mm_fnmadd_sd(<2 x double> %a, <2 x double> %b, <2 x double> %c) {
145238 ; CHECK-LABEL: test_mm_fnmadd_sd:
146239 ; CHECK: # %bb.0: # %entry
156249 ret <2 x double> %4
157250 }
158251
252 define <2 x double> @test_mm_fnmadd_sd_unary_fneg(<2 x double> %a, <2 x double> %b, <2 x double> %c) {
253 ; CHECK-LABEL: test_mm_fnmadd_sd_unary_fneg:
254 ; CHECK: # %bb.0: # %entry
255 ; CHECK-NEXT: vfnmadd213sd {{.*#+}} xmm0 = -(xmm1 * xmm0) + xmm2
256 ; CHECK-NEXT: retq
257 entry:
258 %0 = extractelement <2 x double> %a, i64 0
259 %.rhs.i = extractelement <2 x double> %b, i64 0
260 %1 = fneg double %.rhs.i
261 %2 = extractelement <2 x double> %c, i64 0
262 %3 = tail call double @llvm.fma.f64(double %0, double %1, double %2) #2
263 %4 = insertelement <2 x double> %a, double %3, i64 0
264 ret <2 x double> %4
265 }
266
159267 define <4 x float> @test_mm_fnmsub_ps(<4 x float> %a, <4 x float> %b, <4 x float> %c) {
160268 ; CHECK-LABEL: test_mm_fnmsub_ps:
161269 ; CHECK: # %bb.0: # %entry
171279 ret <4 x float> %0
172280 }
173281
282 define <4 x float> @test_mm_fnmsub_ps_unary_fneg(<4 x float> %a, <4 x float> %b, <4 x float> %c) {
283 ; CHECK-LABEL: test_mm_fnmsub_ps_unary_fneg:
284 ; CHECK: # %bb.0: # %entry
285 ; CHECK-NEXT: vmovaps {{.*#+}} xmm3 = [-0.0E+0,-0.0E+0,-0.0E+0,-0.0E+0]
286 ; CHECK-NEXT: vxorps %xmm3, %xmm0, %xmm4
287 ; CHECK-NEXT: vxorps %xmm3, %xmm2, %xmm0
288 ; CHECK-NEXT: vfmadd231ps {{.*#+}} xmm0 = (xmm1 * xmm4) + xmm0
289 ; CHECK-NEXT: retq
290 entry:
291 %neg.i = fneg <4 x float> %a
292 %neg1.i = fneg <4 x float> %c
293 %0 = tail call <4 x float> @llvm.fma.v4f32(<4 x float> %neg.i, <4 x float> %b, <4 x float> %neg1.i) #2
294 ret <4 x float> %0
295 }
296
174297 define <2 x double> @test_mm_fnmsub_pd(<2 x double> %a, <2 x double> %b, <2 x double> %c) {
175298 ; CHECK-LABEL: test_mm_fnmsub_pd:
176299 ; CHECK: # %bb.0: # %entry
183306 %sub.i = fsub <2 x double> , %a
184307 %sub1.i = fsub <2 x double> , %c
185308 %0 = tail call <2 x double> @llvm.fma.v2f64(<2 x double> %sub.i, <2 x double> %b, <2 x double> %sub1.i) #2
309 ret <2 x double> %0
310 }
311
312 define <2 x double> @test_mm_fnmsub_pd_unary_fneg(<2 x double> %a, <2 x double> %b, <2 x double> %c) {
313 ; CHECK-LABEL: test_mm_fnmsub_pd_unary_fneg:
314 ; CHECK: # %bb.0: # %entry
315 ; CHECK-NEXT: vmovapd {{.*#+}} xmm3 = [-0.0E+0,-0.0E+0]
316 ; CHECK-NEXT: vxorpd %xmm3, %xmm0, %xmm4
317 ; CHECK-NEXT: vxorpd %xmm3, %xmm2, %xmm0
318 ; CHECK-NEXT: vfmadd231pd {{.*#+}} xmm0 = (xmm1 * xmm4) + xmm0
319 ; CHECK-NEXT: retq
320 entry:
321 %neg.i = fneg <2 x double> %a
322 %neg1.i = fneg <2 x double> %c
323 %0 = tail call <2 x double> @llvm.fma.v2f64(<2 x double> %neg.i, <2 x double> %b, <2 x double> %neg1.i) #2
186324 ret <2 x double> %0
187325 }
188326
202340 ret <4 x float> %4
203341 }
204342
343 define <4 x float> @test_mm_fnmsub_ss_unary_fneg(<4 x float> %a, <4 x float> %b, <4 x float> %c) {
344 ; CHECK-LABEL: test_mm_fnmsub_ss_unary_fneg:
345 ; CHECK: # %bb.0: # %entry
346 ; CHECK-NEXT: vfnmsub213ss {{.*#+}} xmm0 = -(xmm1 * xmm0) - xmm2
347 ; CHECK-NEXT: retq
348 entry:
349 %0 = extractelement <4 x float> %a, i64 0
350 %.rhs.i = extractelement <4 x float> %b, i64 0
351 %1 = fneg float %.rhs.i
352 %.rhs2.i = extractelement <4 x float> %c, i64 0
353 %2 = fneg float %.rhs2.i
354 %3 = tail call float @llvm.fma.f32(float %0, float %1, float %2) #2
355 %4 = insertelement <4 x float> %a, float %3, i64 0
356 ret <4 x float> %4
357 }
358
205359 define <2 x double> @test_mm_fnmsub_sd(<2 x double> %a, <2 x double> %b, <2 x double> %c) {
206360 ; CHECK-LABEL: test_mm_fnmsub_sd:
207361 ; CHECK: # %bb.0: # %entry
218372 ret <2 x double> %4
219373 }
220374
375 define <2 x double> @test_mm_fnmsub_sd_unary_fneg(<2 x double> %a, <2 x double> %b, <2 x double> %c) {
376 ; CHECK-LABEL: test_mm_fnmsub_sd_unary_fneg:
377 ; CHECK: # %bb.0: # %entry
378 ; CHECK-NEXT: vfnmsub213sd {{.*#+}} xmm0 = -(xmm1 * xmm0) - xmm2
379 ; CHECK-NEXT: retq
380 entry:
381 %0 = extractelement <2 x double> %a, i64 0
382 %.rhs.i = extractelement <2 x double> %b, i64 0
383 %1 = fneg double %.rhs.i
384 %.rhs2.i = extractelement <2 x double> %c, i64 0
385 %2 = fneg double %.rhs2.i
386 %3 = tail call double @llvm.fma.f64(double %0, double %1, double %2) #2
387 %4 = insertelement <2 x double> %a, double %3, i64 0
388 ret <2 x double> %4
389 }
390
221391 define <4 x float> @test_mm_fmaddsub_ps(<4 x float> %a, <4 x float> %b, <4 x float> %c) {
222392 ; CHECK-LABEL: test_mm_fmaddsub_ps:
223393 ; CHECK: # %bb.0: # %entry
231401 ret <4 x float> %3
232402 }
233403
404 define <4 x float> @test_mm_fmaddsub_ps_unary_fneg(<4 x float> %a, <4 x float> %b, <4 x float> %c) {
405 ; CHECK-LABEL: test_mm_fmaddsub_ps_unary_fneg:
406 ; CHECK: # %bb.0: # %entry
407 ; CHECK-NEXT: vfmaddsub213ps {{.*#+}} xmm0 = (xmm1 * xmm0) +/- xmm2
408 ; CHECK-NEXT: retq
409 entry:
410 %0 = tail call <4 x float> @llvm.fma.v4f32(<4 x float> %a, <4 x float> %b, <4 x float> %c) #2
411 %1 = fneg <4 x float> %c
412 %2 = tail call <4 x float> @llvm.fma.v4f32(<4 x float> %a, <4 x float> %b, <4 x float> %1) #2
413 %3 = shufflevector <4 x float> %2, <4 x float> %0, <4 x i32>
414 ret <4 x float> %3
415 }
416
234417 define <2 x double> @test_mm_fmaddsub_pd(<2 x double> %a, <2 x double> %b, <2 x double> %c) {
235418 ; CHECK-LABEL: test_mm_fmaddsub_pd:
236419 ; CHECK: # %bb.0: # %entry
244427 ret <2 x double> %3
245428 }
246429
430 define <2 x double> @test_mm_fmaddsub_pd_unary_fneg(<2 x double> %a, <2 x double> %b, <2 x double> %c) {
431 ; CHECK-LABEL: test_mm_fmaddsub_pd_unary_fneg:
432 ; CHECK: # %bb.0: # %entry
433 ; CHECK-NEXT: vfmaddsub213pd {{.*#+}} xmm0 = (xmm1 * xmm0) +/- xmm2
434 ; CHECK-NEXT: retq
435 entry:
436 %0 = tail call <2 x double> @llvm.fma.v2f64(<2 x double> %a, <2 x double> %b, <2 x double> %c) #2
437 %1 = fneg <2 x double> %c
438 %2 = tail call <2 x double> @llvm.fma.v2f64(<2 x double> %a, <2 x double> %b, <2 x double> %1) #2
439 %3 = shufflevector <2 x double> %2, <2 x double> %0, <2 x i32>
440 ret <2 x double> %3
441 }
442
247443 define <4 x float> @test_mm_fmsubadd_ps(<4 x float> %a, <4 x float> %b, <4 x float> %c) {
248444 ; CHECK-LABEL: test_mm_fmsubadd_ps:
249445 ; CHECK: # %bb.0: # %entry
257453 ret <4 x float> %2
258454 }
259455
456 define <4 x float> @test_mm_fmsubadd_ps_unary_fneg(<4 x float> %a, <4 x float> %b, <4 x float> %c) {
457 ; CHECK-LABEL: test_mm_fmsubadd_ps_unary_fneg:
458 ; CHECK: # %bb.0: # %entry
459 ; CHECK-NEXT: vfmsubadd213ps {{.*#+}} xmm0 = (xmm1 * xmm0) -/+ xmm2
460 ; CHECK-NEXT: retq
461 entry:
462 %neg.i = fneg <4 x float> %c
463 %0 = tail call <4 x float> @llvm.fma.v4f32(<4 x float> %a, <4 x float> %b, <4 x float> %neg.i) #2
464 %1 = tail call <4 x float> @llvm.fma.v4f32(<4 x float> %a, <4 x float> %b, <4 x float> %c) #2
465 %2 = shufflevector <4 x float> %1, <4 x float> %0, <4 x i32>
466 ret <4 x float> %2
467 }
468
260469 define <2 x double> @test_mm_fmsubadd_pd(<2 x double> %a, <2 x double> %b, <2 x double> %c) {
261470 ; CHECK-LABEL: test_mm_fmsubadd_pd:
262471 ; CHECK: # %bb.0: # %entry
270479 ret <2 x double> %2
271480 }
272481
482 define <2 x double> @test_mm_fmsubadd_pd_unary_fneg(<2 x double> %a, <2 x double> %b, <2 x double> %c) {
483 ; CHECK-LABEL: test_mm_fmsubadd_pd_unary_fneg:
484 ; CHECK: # %bb.0: # %entry
485 ; CHECK-NEXT: vfmsubadd213pd {{.*#+}} xmm0 = (xmm1 * xmm0) -/+ xmm2
486 ; CHECK-NEXT: retq
487 entry:
488 %neg.i = fneg <2 x double> %c
489 %0 = tail call <2 x double> @llvm.fma.v2f64(<2 x double> %a, <2 x double> %b, <2 x double> %neg.i) #2
490 %1 = tail call <2 x double> @llvm.fma.v2f64(<2 x double> %a, <2 x double> %b, <2 x double> %c) #2
491 %2 = shufflevector <2 x double> %1, <2 x double> %0, <2 x i32>
492 ret <2 x double> %2
493 }
494
273495 define <8 x float> @test_mm256_fmadd_ps(<8 x float> %a, <8 x float> %b, <8 x float> %c) {
274496 ; CHECK-LABEL: test_mm256_fmadd_ps:
275497 ; CHECK: # %bb.0: # %entry
302524 ret <8 x float> %0
303525 }
304526
527 define <8 x float> @test_mm256_fmsub_ps_unary_fneg(<8 x float> %a, <8 x float> %b, <8 x float> %c) {
528 ; CHECK-LABEL: test_mm256_fmsub_ps_unary_fneg:
529 ; CHECK: # %bb.0: # %entry
530 ; CHECK-NEXT: vxorps {{.*}}(%rip), %ymm2, %ymm2
531 ; CHECK-NEXT: vfmadd213ps {{.*#+}} ymm0 = (ymm1 * ymm0) + ymm2
532 ; CHECK-NEXT: retq
533 entry:
534 %neg.i = fneg <8 x float> %c
535 %0 = tail call <8 x float> @llvm.fma.v8f32(<8 x float> %a, <8 x float> %b, <8 x float> %neg.i) #2
536 ret <8 x float> %0
537 }
538
305539 define <4 x double> @test_mm256_fmsub_pd(<4 x double> %a, <4 x double> %b, <4 x double> %c) {
306540 ; CHECK-LABEL: test_mm256_fmsub_pd:
307541 ; CHECK: # %bb.0: # %entry
314548 ret <4 x double> %0
315549 }
316550
551 define <4 x double> @test_mm256_fmsub_pd_unary_fneg(<4 x double> %a, <4 x double> %b, <4 x double> %c) {
552 ; CHECK-LABEL: test_mm256_fmsub_pd_unary_fneg:
553 ; CHECK: # %bb.0: # %entry
554 ; CHECK-NEXT: vxorpd {{.*}}(%rip), %ymm2, %ymm2
555 ; CHECK-NEXT: vfmadd213pd {{.*#+}} ymm0 = (ymm1 * ymm0) + ymm2
556 ; CHECK-NEXT: retq
557 entry:
558 %neg.i = fneg <4 x double> %c
559 %0 = tail call <4 x double> @llvm.fma.v4f64(<4 x double> %a, <4 x double> %b, <4 x double> %neg.i) #2
560 ret <4 x double> %0
561 }
562
317563 define <8 x float> @test_mm256_fnmadd_ps(<8 x float> %a, <8 x float> %b, <8 x float> %c) {
318564 ; CHECK-LABEL: test_mm256_fnmadd_ps:
319565 ; CHECK: # %bb.0: # %entry
326572 ret <8 x float> %0
327573 }
328574
575 define <8 x float> @test_mm256_fnmadd_ps_unary_fneg(<8 x float> %a, <8 x float> %b, <8 x float> %c) {
576 ; CHECK-LABEL: test_mm256_fnmadd_ps_unary_fneg:
577 ; CHECK: # %bb.0: # %entry
578 ; CHECK-NEXT: vxorps {{.*}}(%rip), %ymm0, %ymm0
579 ; CHECK-NEXT: vfmadd213ps {{.*#+}} ymm0 = (ymm1 * ymm0) + ymm2
580 ; CHECK-NEXT: retq
581 entry:
582 %neg.i = fneg <8 x float> %a
583 %0 = tail call <8 x float> @llvm.fma.v8f32(<8 x float> %neg.i, <8 x float> %b, <8 x float> %c) #2
584 ret <8 x float> %0
585 }
586
329587 define <4 x double> @test_mm256_fnmadd_pd(<4 x double> %a, <4 x double> %b, <4 x double> %c) {
330588 ; CHECK-LABEL: test_mm256_fnmadd_pd:
331589 ; CHECK: # %bb.0: # %entry
335593 entry:
336594 %sub.i = fsub <4 x double> , %a
337595 %0 = tail call <4 x double> @llvm.fma.v4f64(<4 x double> %sub.i, <4 x double> %b, <4 x double> %c) #2
596 ret <4 x double> %0
597 }
598
599 define <4 x double> @test_mm256_fnmadd_pd_unary_fneg(<4 x double> %a, <4 x double> %b, <4 x double> %c) {
600 ; CHECK-LABEL: test_mm256_fnmadd_pd_unary_fneg:
601 ; CHECK: # %bb.0: # %entry
602 ; CHECK-NEXT: vxorpd {{.*}}(%rip), %ymm0, %ymm0
603 ; CHECK-NEXT: vfmadd213pd {{.*#+}} ymm0 = (ymm1 * ymm0) + ymm2
604 ; CHECK-NEXT: retq
605 entry:
606 %neg.i = fneg <4 x double> %a
607 %0 = tail call <4 x double> @llvm.fma.v4f64(<4 x double> %neg.i, <4 x double> %b, <4 x double> %c) #2
338608 ret <4 x double> %0
339609 }
340610
353623 ret <8 x float> %0
354624 }
355625
626 define <8 x float> @test_mm256_fnmsub_ps_unary_fneg(<8 x float> %a, <8 x float> %b, <8 x float> %c) {
627 ; CHECK-LABEL: test_mm256_fnmsub_ps_unary_fneg:
628 ; CHECK: # %bb.0: # %entry
629 ; CHECK-NEXT: vmovaps {{.*#+}} ymm3 = [-0.0E+0,-0.0E+0,-0.0E+0,-0.0E+0,-0.0E+0,-0.0E+0,-0.0E+0,-0.0E+0]
630 ; CHECK-NEXT: vxorps %ymm3, %ymm0, %ymm4
631 ; CHECK-NEXT: vxorps %ymm3, %ymm2, %ymm0
632 ; CHECK-NEXT: vfmadd231ps {{.*#+}} ymm0 = (ymm1 * ymm4) + ymm0
633 ; CHECK-NEXT: retq
634 entry:
635 %neg.i = fneg <8 x float> %a
636 %neg1.i = fneg <8 x float> %c
637 %0 = tail call <8 x float> @llvm.fma.v8f32(<8 x float> %neg.i, <8 x float> %b, <8 x float> %neg1.i) #2
638 ret <8 x float> %0
639 }
640
356641 define <4 x double> @test_mm256_fnmsub_pd(<4 x double> %a, <4 x double> %b, <4 x double> %c) {
357642 ; CHECK-LABEL: test_mm256_fnmsub_pd:
358643 ; CHECK: # %bb.0: # %entry
365650 %sub.i = fsub <4 x double> , %a
366651 %sub1.i = fsub <4 x double> , %c
367652 %0 = tail call <4 x double> @llvm.fma.v4f64(<4 x double> %sub.i, <4 x double> %b, <4 x double> %sub1.i) #2
653 ret <4 x double> %0
654 }
655
656 define <4 x double> @test_mm256_fnmsub_pd_unary_fneg(<4 x double> %a, <4 x double> %b, <4 x double> %c) {
657 ; CHECK-LABEL: test_mm256_fnmsub_pd_unary_fneg:
658 ; CHECK: # %bb.0: # %entry
659 ; CHECK-NEXT: vmovapd {{.*#+}} ymm3 = [-0.0E+0,-0.0E+0,-0.0E+0,-0.0E+0]
660 ; CHECK-NEXT: vxorpd %ymm3, %ymm0, %ymm4
661 ; CHECK-NEXT: vxorpd %ymm3, %ymm2, %ymm0
662 ; CHECK-NEXT: vfmadd231pd {{.*#+}} ymm0 = (ymm1 * ymm4) + ymm0
663 ; CHECK-NEXT: retq
664 entry:
665 %neg.i = fneg <4 x double> %a
666 %neg1.i = fneg <4 x double> %c
667 %0 = tail call <4 x double> @llvm.fma.v4f64(<4 x double> %neg.i, <4 x double> %b, <4 x double> %neg1.i) #2
368668 ret <4 x double> %0
369669 }
370670
381681 ret <8 x float> %3
382682 }
383683
684 define <8 x float> @test_mm256_fmaddsub_ps_unary_fneg(<8 x float> %a, <8 x float> %b, <8 x float> %c) {
685 ; CHECK-LABEL: test_mm256_fmaddsub_ps_unary_fneg:
686 ; CHECK: # %bb.0: # %entry
687 ; CHECK-NEXT: vfmaddsub213ps {{.*#+}} ymm0 = (ymm1 * ymm0) +/- ymm2
688 ; CHECK-NEXT: retq
689 entry:
690 %0 = tail call <8 x float> @llvm.fma.v8f32(<8 x float> %a, <8 x float> %b, <8 x float> %c) #2
691 %1 = fneg <8 x float> %c
692 %2 = tail call <8 x float> @llvm.fma.v8f32(<8 x float> %a, <8 x float> %b, <8 x float> %1) #2
693 %3 = shufflevector <8 x float> %2, <8 x float> %0, <8 x i32>
694 ret <8 x float> %3
695 }
696
384697 define <4 x double> @test_mm256_fmaddsub_pd(<4 x double> %a, <4 x double> %b, <4 x double> %c) {
385698 ; CHECK-LABEL: test_mm256_fmaddsub_pd:
386699 ; CHECK: # %bb.0: # %entry
394707 ret <4 x double> %3
395708 }
396709
710 define <4 x double> @test_mm256_fmaddsub_pd_unary_fneg(<4 x double> %a, <4 x double> %b, <4 x double> %c) {
711 ; CHECK-LABEL: test_mm256_fmaddsub_pd_unary_fneg:
712 ; CHECK: # %bb.0: # %entry
713 ; CHECK-NEXT: vfmaddsub213pd {{.*#+}} ymm0 = (ymm1 * ymm0) +/- ymm2
714 ; CHECK-NEXT: retq
715 entry:
716 %0 = tail call <4 x double> @llvm.fma.v4f64(<4 x double> %a, <4 x double> %b, <4 x double> %c) #2
717 %1 = fneg <4 x double> %c
718 %2 = tail call <4 x double> @llvm.fma.v4f64(<4 x double> %a, <4 x double> %b, <4 x double> %1) #2
719 %3 = shufflevector <4 x double> %2, <4 x double> %0, <4 x i32>
720 ret <4 x double> %3
721 }
722
397723 define <8 x float> @test_mm256_fmsubadd_ps(<8 x float> %a, <8 x float> %b, <8 x float> %c) {
398724 ; CHECK-LABEL: test_mm256_fmsubadd_ps:
399725 ; CHECK: # %bb.0: # %entry
407733 ret <8 x float> %2
408734 }
409735
736 define <8 x float> @test_mm256_fmsubadd_ps_unary_fneg(<8 x float> %a, <8 x float> %b, <8 x float> %c) {
737 ; CHECK-LABEL: test_mm256_fmsubadd_ps_unary_fneg:
738 ; CHECK: # %bb.0: # %entry
739 ; CHECK-NEXT: vfmsubadd213ps {{.*#+}} ymm0 = (ymm1 * ymm0) -/+ ymm2
740 ; CHECK-NEXT: retq
741 entry:
742 %neg.i = fneg <8 x float> %c
743 %0 = tail call <8 x float> @llvm.fma.v8f32(<8 x float> %a, <8 x float> %b, <8 x float> %neg.i) #2
744 %1 = tail call <8 x float> @llvm.fma.v8f32(<8 x float> %a, <8 x float> %b, <8 x float> %c) #2
745 %2 = shufflevector <8 x float> %1, <8 x float> %0, <8 x i32>
746 ret <8 x float> %2
747 }
748
410749 define <4 x double> @test_mm256_fmsubadd_pd(<4 x double> %a, <4 x double> %b, <4 x double> %c) {
411750 ; CHECK-LABEL: test_mm256_fmsubadd_pd:
412751 ; CHECK: # %bb.0: # %entry
415754 entry:
416755 %sub.i = fsub <4 x double> , %c
417756 %0 = tail call <4 x double> @llvm.fma.v4f64(<4 x double> %a, <4 x double> %b, <4 x double> %sub.i) #2
757 %1 = tail call <4 x double> @llvm.fma.v4f64(<4 x double> %a, <4 x double> %b, <4 x double> %c) #2
758 %2 = shufflevector <4 x double> %1, <4 x double> %0, <4 x i32>
759 ret <4 x double> %2
760 }
761
762 define <4 x double> @test_mm256_fmsubadd_pd_unary_fneg(<4 x double> %a, <4 x double> %b, <4 x double> %c) {
763 ; CHECK-LABEL: test_mm256_fmsubadd_pd_unary_fneg:
764 ; CHECK: # %bb.0: # %entry
765 ; CHECK-NEXT: vfmsubadd213pd {{.*#+}} ymm0 = (ymm1 * ymm0) -/+ ymm2
766 ; CHECK-NEXT: retq
767 entry:
768 %neg.i = fneg <4 x double> %c
769 %0 = tail call <4 x double> @llvm.fma.v4f64(<4 x double> %a, <4 x double> %b, <4 x double> %neg.i) #2
418770 %1 = tail call <4 x double> @llvm.fma.v4f64(<4 x double> %a, <4 x double> %b, <4 x double> %c) #2
419771 %2 = shufflevector <4 x double> %1, <4 x double> %0, <4 x i32>
420772 ret <4 x double> %2
0 ; RUN: llc < %s -mtriple=i686-- -mattr=+sse4.1 -o %t
1 ; RUN: grep xorps %t | count 1
1 ; RUN: grep xorps %t | count 2
22
33 ; Test that when we don't -enable-unsafe-fp-math, we don't do the optimization
44 ; -0 - (A - B) to (B - A) because A==B, -0 != 0
99 %neg = fsub float -0.000000e+00, %sub ; [#uses=1]
1010 ret float %neg
1111 }
12
13 define float @unary_negfp(float %a, float %b) {
14 entry:
15 %sub = fsub float %a, %b ; [#uses=1]
16 %neg = fneg float %sub ; [#uses=1]
17 ret float %neg
18 }
1717 ; X64-SSE-NEXT: xorps {{.*}}(%rip), %xmm0
1818 ; X64-SSE-NEXT: retq
1919 %tmp = fsub <4 x float> , %Q
20 ret <4 x float> %tmp
21 }
22
23 define <4 x float> @t1_unary(<4 x float> %Q) nounwind {
24 ; X32-SSE-LABEL: t1_unary:
25 ; X32-SSE: # %bb.0:
26 ; X32-SSE-NEXT: xorps {{\.LCPI.*}}, %xmm0
27 ; X32-SSE-NEXT: retl
28 ;
29 ; X64-SSE-LABEL: t1_unary:
30 ; X64-SSE: # %bb.0:
31 ; X64-SSE-NEXT: xorps {{.*}}(%rip), %xmm0
32 ; X64-SSE-NEXT: retq
33 %tmp = fneg <4 x float> %Q
2034 ret <4 x float> %tmp
2135 }
2236
1414 ; AVX-NEXT: vmovaps %xmm0, 0
1515 ; AVX-NEXT: retl
1616 %tmp1277 = fsub <4 x float> < float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00 >, %A
17 store <4 x float> %tmp1277, <4 x float>* null
18 ret void
19 }
20
21 define void @t_unary(<4 x float> %A) {
22 ; SSE-LABEL: t_unary:
23 ; SSE: # %bb.0:
24 ; SSE-NEXT: xorps {{\.LCPI.*}}, %xmm0
25 ; SSE-NEXT: movaps %xmm0, 0
26 ; SSE-NEXT: retl
27 ;
28 ; AVX-LABEL: t_unary:
29 ; AVX: # %bb.0:
30 ; AVX-NEXT: vxorps {{\.LCPI.*}}, %xmm0, %xmm0
31 ; AVX-NEXT: vmovaps %xmm0, 0
32 ; AVX-NEXT: retl
33 %tmp1277 = fneg <4 x float> %A
1734 store <4 x float> %tmp1277, <4 x float>* null
1835 ret void
1936 }
0 ; RUN: llc < %s -march=xcore | FileCheck %s
1
12 define i1 @test(double %F, double %G) nounwind {
23 entry:
34 ; CHECK-LABEL: test:
67 %1 = fcmp olt double %G, %0
78 ret i1 %1
89 }
10
11 define i1 @test_unary(double %F, double %G) nounwind {
12 entry:
13 ; CHECK-LABEL: test_unary:
14 ; CHECK: xor
15 %0 = fneg double %F
16 %1 = fcmp olt double %G, %0
17 ret i1 %1
18 }