1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mattr=+fma4,-fma | FileCheck %s 3; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mattr=+fma4,+fma | FileCheck %s 4 5declare <4 x float> @llvm.x86.fma4.vfmadd.ss(<4 x float> %a, <4 x float> %b, <4 x float> %c) 6declare <2 x double> @llvm.x86.fma4.vfmadd.sd(<2 x double> %a, <2 x double> %b, <2 x double> %c) 7 8; TODO this can be negated 9define <4 x float> @test1(<4 x float> %a, <4 x float> %b, <4 x float> %c) { 10; CHECK-LABEL: test1: 11; CHECK: # %bb.0: 12; CHECK-NEXT: vfmaddss {{.*#+}} xmm0 = (xmm0 * xmm1) + xmm2 13; CHECK-NEXT: vxorps {{.*}}(%rip), %xmm0, %xmm0 14; CHECK-NEXT: retq 15 %res = tail call <4 x float> @llvm.x86.fma4.vfmadd.ss(<4 x float> %a, <4 x float> %b, <4 x float> %c) 16 %sub.i = fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %res 17 ret <4 x float> %sub.i 18} 19 20define <4 x float> @test2(<4 x float> %a, <4 x float> %b, <4 x float> %c) { 21; CHECK-LABEL: test2: 22; CHECK: # %bb.0: 23; CHECK-NEXT: vfmsubss {{.*#+}} xmm0 = (xmm0 * xmm1) - xmm2 24; CHECK-NEXT: retq 25 %sub.i = fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %c 26 %res = tail call <4 x float> @llvm.x86.fma4.vfmadd.ss(<4 x float> %a, <4 x float> %b, <4 x float> %sub.i) 27 ret <4 x float> %res 28} 29 30define <4 x float> @test3(<4 x float> %a, <4 x float> %b, <4 x float> %c) { 31; CHECK-LABEL: test3: 32; CHECK: # %bb.0: 33; CHECK-NEXT: vfnmaddss {{.*#+}} xmm0 = -(xmm0 * xmm1) + xmm2 34; CHECK-NEXT: retq 35 %sub.i = fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %b 36 %res = tail call <4 x float> @llvm.x86.fma4.vfmadd.ss(<4 x float> %a, <4 x float> %sub.i, <4 x float> %c) 37 ret <4 x float> %res 38} 39 40define <4 x float> @test4(<4 x float> %a, <4 x float> %b, <4 x float> %c) { 41; CHECK-LABEL: test4: 42; CHECK: # %bb.0: 43; CHECK-NEXT: vfnmaddss {{.*#+}} xmm0 = -(xmm0 * xmm1) + xmm2 44; CHECK-NEXT: retq 45 %sub.i = fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %a 46 %res = tail call <4 x float> @llvm.x86.fma4.vfmadd.ss(<4 x float> %sub.i, <4 x float> %b, <4 x float> %c) 47 ret <4 x float> %res 48} 49 50define <4 x float> @test5(<4 x float> %a, <4 x float> %b, <4 x float> %c) { 51; CHECK-LABEL: test5: 52; CHECK: # %bb.0: 53; CHECK-NEXT: vfnmsubss {{.*#+}} xmm0 = -(xmm0 * xmm1) - xmm2 54; CHECK-NEXT: retq 55 %sub.i = fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %a 56 %sub.i.2 = fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %c 57 %res = tail call <4 x float> @llvm.x86.fma4.vfmadd.ss(<4 x float> %sub.i, <4 x float> %b, <4 x float> %sub.i.2) 58 ret <4 x float> %res 59} 60 61define <2 x double> @test6(<2 x double> %a, <2 x double> %b, <2 x double> %c) { 62; CHECK-LABEL: test6: 63; CHECK: # %bb.0: 64; CHECK-NEXT: vfmaddsd {{.*#+}} xmm0 = (xmm0 * xmm1) + xmm2 65; CHECK-NEXT: vxorpd {{.*}}(%rip), %xmm0, %xmm0 66; CHECK-NEXT: retq 67 %res = tail call <2 x double> @llvm.x86.fma4.vfmadd.sd(<2 x double> %a, <2 x double> %b, <2 x double> %c) 68 %sub.i = fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, %res 69 ret <2 x double> %sub.i 70} 71 72define <2 x double> @test7(<2 x double> %a, <2 x double> %b, <2 x double> %c) { 73; CHECK-LABEL: test7: 74; CHECK: # %bb.0: 75; CHECK-NEXT: vfmsubsd {{.*#+}} xmm0 = (xmm0 * xmm1) - xmm2 76; CHECK-NEXT: retq 77 %sub.i = fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, %c 78 %res = tail call <2 x double> @llvm.x86.fma4.vfmadd.sd(<2 x double> %a, <2 x double> %b, <2 x double> %sub.i) 79 ret <2 x double> %res 80} 81 82define <2 x double> @test8(<2 x double> %a, <2 x double> %b, <2 x double> %c) { 83; CHECK-LABEL: test8: 84; CHECK: # %bb.0: 85; CHECK-NEXT: vfnmaddsd {{.*#+}} xmm0 = -(xmm0 * xmm1) + xmm2 86; CHECK-NEXT: retq 87 %sub.i = fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, %b 88 %res = tail call <2 x double> @llvm.x86.fma4.vfmadd.sd(<2 x double> %a, <2 x double> %sub.i, <2 x double> %c) 89 ret <2 x double> %res 90} 91 92define <2 x double> @test9(<2 x double> %a, <2 x double> %b, <2 x double> %c) { 93; CHECK-LABEL: test9: 94; CHECK: # %bb.0: 95; CHECK-NEXT: vfnmaddsd {{.*#+}} xmm0 = -(xmm0 * xmm1) + xmm2 96; CHECK-NEXT: retq 97 %sub.i = fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, %a 98 %res = tail call <2 x double> @llvm.x86.fma4.vfmadd.sd(<2 x double> %sub.i, <2 x double> %b, <2 x double> %c) 99 ret <2 x double> %res 100} 101 102define <2 x double> @test10(<2 x double> %a, <2 x double> %b, <2 x double> %c) { 103; CHECK-LABEL: test10: 104; CHECK: # %bb.0: 105; CHECK-NEXT: vfnmsubsd {{.*#+}} xmm0 = -(xmm0 * xmm1) - xmm2 106; CHECK-NEXT: retq 107 %sub.i = fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, %a 108 %sub.i.2 = fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, %c 109 %res = tail call <2 x double> @llvm.x86.fma4.vfmadd.sd(<2 x double> %sub.i, <2 x double> %b, <2 x double> %sub.i.2) 110 ret <2 x double> %res 111} 112