1 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=core-avx2 -mattr=avx2,+fma -fp-contract=fast | FileCheck %s
\r
3 ; CHECK: test_x86_fmadd_ps
\r
4 ; CHECK: vfmadd213ps %xmm2, %xmm0, %xmm1
\r
6 define <4 x float> @test_x86_fmadd_ps(<4 x float> %a0, <4 x float> %a1, <4 x float> %a2) {
\r
7 %x = fmul <4 x float> %a0, %a1
\r
8 %res = fadd <4 x float> %x, %a2
\r
12 ; CHECK: test_x86_fmsub_ps
\r
13 ; CHECK: fmsub213ps %xmm2, %xmm0, %xmm1
\r
15 define <4 x float> @test_x86_fmsub_ps(<4 x float> %a0, <4 x float> %a1, <4 x float> %a2) {
\r
16 %x = fmul <4 x float> %a0, %a1
\r
17 %res = fsub <4 x float> %x, %a2
\r
18 ret <4 x float> %res
\r
21 ; CHECK: test_x86_fnmadd_ps
\r
22 ; CHECK: fnmadd213ps %xmm2, %xmm0, %xmm1
\r
24 define <4 x float> @test_x86_fnmadd_ps(<4 x float> %a0, <4 x float> %a1, <4 x float> %a2) {
\r
25 %x = fmul <4 x float> %a0, %a1
\r
26 %res = fsub <4 x float> %a2, %x
\r
27 ret <4 x float> %res
\r
30 ; CHECK: test_x86_fnmsub_ps
\r
31 ; CHECK: fnmsub213ps %xmm2, %xmm0, %xmm1
\r
33 define <4 x float> @test_x86_fnmsub_ps(<4 x float> %a0, <4 x float> %a1, <4 x float> %a2) {
\r
34 %x = fmul <4 x float> %a0, %a1
\r
35 %y = fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %x
\r
36 %res = fsub <4 x float> %y, %a2
\r
37 ret <4 x float> %res
\r
40 ; CHECK: test_x86_fmadd_ps_y
\r
41 ; CHECK: vfmadd213ps %ymm2, %ymm0, %ymm1
\r
43 define <8 x float> @test_x86_fmadd_ps_y(<8 x float> %a0, <8 x float> %a1, <8 x float> %a2) {
\r
44 %x = fmul <8 x float> %a0, %a1
\r
45 %res = fadd <8 x float> %x, %a2
\r
46 ret <8 x float> %res
\r
49 ; CHECK: test_x86_fmsub_ps_y
\r
50 ; CHECK: vfmsub213ps %ymm2, %ymm0, %ymm1
\r
52 define <8 x float> @test_x86_fmsub_ps_y(<8 x float> %a0, <8 x float> %a1, <8 x float> %a2) {
\r
53 %x = fmul <8 x float> %a0, %a1
\r
54 %res = fsub <8 x float> %x, %a2
\r
55 ret <8 x float> %res
\r
58 ; CHECK: test_x86_fnmadd_ps_y
\r
59 ; CHECK: vfnmadd213ps %ymm2, %ymm0, %ymm1
\r
61 define <8 x float> @test_x86_fnmadd_ps_y(<8 x float> %a0, <8 x float> %a1, <8 x float> %a2) {
\r
62 %x = fmul <8 x float> %a0, %a1
\r
63 %res = fsub <8 x float> %a2, %x
\r
64 ret <8 x float> %res
\r
67 ; CHECK: test_x86_fnmsub_ps_y
\r
68 ; CHECK: vfnmsub213ps %ymm2, %ymm0, %ymm1
\r
70 define <8 x float> @test_x86_fnmsub_ps_y(<8 x float> %a0, <8 x float> %a1, <8 x float> %a2) {
\r
71 %x = fmul <8 x float> %a0, %a1
\r
72 %y = fsub <8 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %x
\r
73 %res = fsub <8 x float> %y, %a2
\r
74 ret <8 x float> %res
\r
77 ; CHECK: test_x86_fmadd_pd_y
\r
78 ; CHECK: vfmadd213pd %ymm2, %ymm0, %ymm1
\r
80 define <4 x double> @test_x86_fmadd_pd_y(<4 x double> %a0, <4 x double> %a1, <4 x double> %a2) {
\r
81 %x = fmul <4 x double> %a0, %a1
\r
82 %res = fadd <4 x double> %x, %a2
\r
83 ret <4 x double> %res
\r
86 ; CHECK: test_x86_fmsub_pd_y
\r
87 ; CHECK: vfmsub213pd %ymm2, %ymm0, %ymm1
\r
89 define <4 x double> @test_x86_fmsub_pd_y(<4 x double> %a0, <4 x double> %a1, <4 x double> %a2) {
\r
90 %x = fmul <4 x double> %a0, %a1
\r
91 %res = fsub <4 x double> %x, %a2
\r
92 ret <4 x double> %res
\r
95 ; CHECK: test_x86_fmsub_pd
\r
96 ; CHECK: vfmsub213pd %xmm2, %xmm0, %xmm1
\r
98 define <2 x double> @test_x86_fmsub_pd(<2 x double> %a0, <2 x double> %a1, <2 x double> %a2) {
\r
99 %x = fmul <2 x double> %a0, %a1
\r
100 %res = fsub <2 x double> %x, %a2
\r
101 ret <2 x double> %res
\r
104 ; CHECK: test_x86_fnmadd_ss
\r
105 ; CHECK: vfnmadd213ss %xmm2, %xmm0, %xmm1
\r
107 define float @test_x86_fnmadd_ss(float %a0, float %a1, float %a2) {
\r
108 %x = fmul float %a0, %a1
\r
109 %res = fsub float %a2, %x
\r
113 ; CHECK: test_x86_fnmadd_sd
\r
114 ; CHECK: vfnmadd213sd %xmm2, %xmm0, %xmm1
\r
116 define double @test_x86_fnmadd_sd(double %a0, double %a1, double %a2) {
\r
117 %x = fmul double %a0, %a1
\r
118 %res = fsub double %a2, %x
\r
122 ; CHECK: test_x86_fmsub_sd
\r
123 ; CHECK: vfmsub213sd %xmm2, %xmm0, %xmm1
\r
125 define double @test_x86_fmsub_sd(double %a0, double %a1, double %a2) {
\r
126 %x = fmul double %a0, %a1
\r
127 %res = fsub double %x, %a2
\r
131 ; CHECK: test_x86_fnmsub_ss
\r
132 ; CHECK: vfnmsub213ss %xmm2, %xmm0, %xmm1
\r
134 define float @test_x86_fnmsub_ss(float %a0, float %a1, float %a2) {
\r
135 %x = fsub float -0.000000e+00, %a0
\r
136 %y = fmul float %x, %a1
\r
137 %res = fsub float %y, %a2
\r