1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mattr=+fma | FileCheck %s
4 ; This test checks that (fneg (fma (fneg x), y, (fneg z))) can't be folded to (fma x, y, z)
5 ; without no signed zeros flag (nsz).
7 declare float @llvm.fma.f32(float, float, float)
9 define float @fneg_fma32(float %x, float %y, float %z) {
10 ; CHECK-LABEL: fneg_fma32:
12 ; CHECK-NEXT: vfnmsub213ss {{.*#+}} xmm0 = -(xmm1 * xmm0) - xmm2
13 ; CHECK-NEXT: vxorps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
17 %fma = call float @llvm.fma.f32(float %negx, float %y, float %negz)
22 define float @fneg_fma32_nsz(float %x, float %y, float %z) {
23 ; CHECK-LABEL: fneg_fma32_nsz:
25 ; CHECK-NEXT: vfmadd213ss {{.*#+}} xmm0 = (xmm1 * xmm0) + xmm2
29 %fma = call nsz float @llvm.fma.f32(float %negx, float %y, float %negz)
34 declare double @llvm.fma.f64(double, double, double)
36 define double @fneg_fma64(double %x, double %y, double %z) {
37 ; CHECK-LABEL: fneg_fma64:
39 ; CHECK-NEXT: vfnmsub213sd {{.*#+}} xmm0 = -(xmm1 * xmm0) - xmm2
40 ; CHECK-NEXT: vxorpd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
42 %negx = fneg double %x
43 %negz = fneg double %z
44 %fma = call double @llvm.fma.f64(double %negx, double %y, double %negz)
49 define double @fneg_fma64_nsz(double %x, double %y, double %z) {
50 ; CHECK-LABEL: fneg_fma64_nsz:
52 ; CHECK-NEXT: vfmadd213sd {{.*#+}} xmm0 = (xmm1 * xmm0) + xmm2
54 %negx = fneg double %x
55 %negz = fneg double %z
56 %fma = call nsz double @llvm.fma.f64(double %negx, double %y, double %negz)