1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mattr=+avx512bw -mattr=+avx512vl -mattr=+avx512dq | FileCheck %s --check-prefix=CHECK --check-prefix=SKX
3 ; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mattr=+avx512f -mattr=+fma | FileCheck %s --check-prefix=CHECK --check-prefix=KNL
5 ; This test checks combinations of FNEG and FMA intrinsics on AVX-512 target
8 declare <8 x float> @llvm.fma.v8f32(<8 x float>, <8 x float>, <8 x float>)
9 declare <16 x float> @llvm.fma.v16f32(<16 x float>, <16 x float>, <16 x float>)
10 declare <16 x float> @llvm.x86.avx512.vfmadd.ps.512(<16 x float>, <16 x float>, <16 x float>, i32)
11 declare <16 x float> @llvm.x86.avx512.mask.vfnmadd.ps.512(<16 x float>, <16 x float>, <16 x float>, i16, i32)
12 declare <16 x float> @llvm.x86.avx512.mask.vfnmsub.ps.512(<16 x float>, <16 x float>, <16 x float>, i16, i32)
13 declare <8 x float> @llvm.x86.fma.vfmsub.ps.256(<8 x float>, <8 x float>, <8 x float>)
14 declare <8 x double> @llvm.x86.avx512.vfmadd.pd.512(<8 x double> %a, <8 x double> %b, <8 x double> %c, i32)
15 declare <2 x double> @llvm.x86.avx512.mask.vfmadd.sd(<2 x double> %a, <2 x double> %b, <2 x double> %c, i8, i32)
16 declare <4 x float> @llvm.x86.avx512.mask3.vfmadd.ss(<4 x float>, <4 x float>, <4 x float>, i8, i32)
17 declare <4 x float> @llvm.x86.avx512.mask.vfmadd.ss(<4 x float>, <4 x float>, <4 x float>, i8, i32)
18 declare <16 x float> @llvm.x86.avx512.vfmaddsub.ps.512(<16 x float>, <16 x float>, <16 x float>, i32)
19 declare <8 x double> @llvm.x86.avx512.vfmaddsub.pd.512(<8 x double>, <8 x double>, <8 x double>, i32)
21 define <16 x float> @test1(<16 x float> %a, <16 x float> %b, <16 x float> %c) {
24 ; CHECK-NEXT: vfmsub213ps {{.*#+}} zmm0 = (zmm1 * zmm0) - zmm2
26 %sub.i = fneg <16 x float> %c
27 %t0 = tail call <16 x float> @llvm.x86.avx512.vfmadd.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> %sub.i, i32 4)
31 define <16 x float> @test2(<16 x float> %a, <16 x float> %b, <16 x float> %c) {
34 ; SKX-NEXT: vfmadd213ps {{.*#+}} zmm0 = (zmm1 * zmm0) + zmm2
35 ; SKX-NEXT: vxorps {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to16}, %zmm0, %zmm0
40 ; KNL-NEXT: vfmadd213ps {{.*#+}} zmm0 = (zmm1 * zmm0) + zmm2
41 ; KNL-NEXT: vpxord {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to16}, %zmm0, %zmm0
43 %fma = call <16 x float> @llvm.fma.v16f32(<16 x float> %a, <16 x float> %b, <16 x float> %c)
44 %neg = fneg <16 x float> %fma
48 define <16 x float> @test2_nsz(<16 x float> %a, <16 x float> %b, <16 x float> %c) {
49 ; CHECK-LABEL: test2_nsz:
51 ; CHECK-NEXT: vfnmsub213ps {{.*#+}} zmm0 = -(zmm1 * zmm0) - zmm2
53 %fma = call nsz <16 x float> @llvm.fma.v16f32(<16 x float> %a, <16 x float> %b, <16 x float> %c)
54 %neg = fneg <16 x float> %fma
58 define <16 x float> @test3(<16 x float> %a, <16 x float> %b, <16 x float> %c) {
61 ; SKX-NEXT: vfnmadd213ps {{.*#+}} zmm0 = -(zmm1 * zmm0) + zmm2
62 ; SKX-NEXT: vxorps {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to16}, %zmm0, %zmm0
67 ; KNL-NEXT: vfnmadd213ps {{.*#+}} zmm0 = -(zmm1 * zmm0) + zmm2
68 ; KNL-NEXT: vpxord {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to16}, %zmm0, %zmm0
70 %t0 = fneg <16 x float> %b
71 %t1 = call <16 x float> @llvm.fma.v16f32(<16 x float> %a, <16 x float> %t0, <16 x float> %c)
72 %sub.i = fneg <16 x float> %t1
73 ret <16 x float> %sub.i
76 define <16 x float> @test3_nsz(<16 x float> %a, <16 x float> %b, <16 x float> %c) {
77 ; CHECK-LABEL: test3_nsz:
79 ; CHECK-NEXT: vfmsub213ps {{.*#+}} zmm0 = (zmm1 * zmm0) - zmm2
81 %t0 = fneg <16 x float> %b
82 %t1 = call nsz <16 x float> @llvm.fma.v16f32(<16 x float> %a, <16 x float> %t0, <16 x float> %c)
83 %sub.i = fneg <16 x float> %t1
84 ret <16 x float> %sub.i
87 define <16 x float> @test4(<16 x float> %a, <16 x float> %b, <16 x float> %c) {
90 ; SKX-NEXT: vfnmsub213ps {{.*#+}} zmm0 = -(zmm1 * zmm0) - zmm2
91 ; SKX-NEXT: vxorps {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to16}, %zmm0, %zmm0
96 ; KNL-NEXT: vfnmsub213ps {{.*#+}} zmm0 = -(zmm1 * zmm0) - zmm2
97 ; KNL-NEXT: vpxord {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to16}, %zmm0, %zmm0
99 %t0 = fneg <16 x float> %b
100 %t1 = fneg <16 x float> %c
101 %t2 = call <16 x float> @llvm.fma.v16f32(<16 x float> %a, <16 x float> %t0, <16 x float> %t1)
102 %sub.i = fsub <16 x float> <float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0>, %t2
103 ret <16 x float> %sub.i
106 define <16 x float> @test4_nsz(<16 x float> %a, <16 x float> %b, <16 x float> %c) {
107 ; CHECK-LABEL: test4_nsz:
109 ; CHECK-NEXT: vfmadd213ps {{.*#+}} zmm0 = (zmm1 * zmm0) + zmm2
111 %t0 = fneg <16 x float> %b
112 %t1 = fneg <16 x float> %c
113 %t2 = call nsz <16 x float> @llvm.fma.v16f32(<16 x float> %a, <16 x float> %t0, <16 x float> %t1)
114 %sub.i = fsub <16 x float> <float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0>, %t2
115 ret <16 x float> %sub.i
118 define <16 x float> @test5(<16 x float> %a, <16 x float> %b, <16 x float> %c) {
119 ; CHECK-LABEL: test5:
120 ; CHECK: # %bb.0: # %entry
121 ; CHECK-NEXT: vfmsub213ps {ru-sae}, %zmm2, %zmm1, %zmm0
124 %sub.i = fsub <16 x float> <float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0>, %c
125 %0 = tail call <16 x float> @llvm.x86.avx512.vfmadd.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> %sub.i, i32 10) #2
129 define <16 x float> @test6(<16 x float> %a, <16 x float> %b, <16 x float> %c) {
132 ; SKX-NEXT: vfnmsub213ps {ru-sae}, %zmm2, %zmm1, %zmm0
133 ; SKX-NEXT: vxorps {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to16}, %zmm0, %zmm0
138 ; KNL-NEXT: vfnmsub213ps {ru-sae}, %zmm2, %zmm1, %zmm0
139 ; KNL-NEXT: vpxord {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to16}, %zmm0, %zmm0
141 %t0 = fneg <16 x float> %b
142 %t1 = fneg <16 x float> %c
143 %t2 = call <16 x float> @llvm.x86.avx512.vfmadd.ps.512(<16 x float> %a, <16 x float> %t0, <16 x float> %t1, i32 10)
144 %sub.i = fsub <16 x float> <float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0>, %t2
145 ret <16 x float> %sub.i
148 define <16 x float> @test6_nsz(<16 x float> %a, <16 x float> %b, <16 x float> %c) {
149 ; CHECK-LABEL: test6_nsz:
151 ; CHECK-NEXT: vfmadd213ps {ru-sae}, %zmm2, %zmm1, %zmm0
153 %t0 = fneg <16 x float> %b
154 %t1 = fneg <16 x float> %c
155 %t2 = call nsz <16 x float> @llvm.x86.avx512.vfmadd.ps.512(<16 x float> %a, <16 x float> %t0, <16 x float> %t1, i32 10)
156 %sub.i = fsub <16 x float> <float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0>, %t2
157 ret <16 x float> %sub.i
160 define <8 x float> @test7(<8 x float> %a, <8 x float> %b, <8 x float> %c) {
163 ; SKX-NEXT: vfmsub213ps {{.*#+}} ymm0 = (ymm1 * ymm0) - ymm2
164 ; SKX-NEXT: vxorps {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to8}, %ymm0, %ymm0
169 ; KNL-NEXT: vfmsub213ps {{.*#+}} ymm0 = (ymm1 * ymm0) - ymm2
170 ; KNL-NEXT: vbroadcastss {{.*#+}} ymm1 = [-0.0E+0,-0.0E+0,-0.0E+0,-0.0E+0,-0.0E+0,-0.0E+0,-0.0E+0,-0.0E+0]
171 ; KNL-NEXT: vxorps %ymm1, %ymm0, %ymm0
173 %t0 = fneg <8 x float> %c
174 %t1 = call <8 x float> @llvm.fma.v8f32(<8 x float> %a, <8 x float> %b, <8 x float> %t0)
175 %sub.i = fsub <8 x float> <float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0>, %t1
176 ret <8 x float> %sub.i
179 define <8 x float> @test7_nsz(<8 x float> %a, <8 x float> %b, <8 x float> %c) {
180 ; CHECK-LABEL: test7_nsz:
182 ; CHECK-NEXT: vfnmadd213ps {{.*#+}} ymm0 = -(ymm1 * ymm0) + ymm2
184 %t0 = fneg <8 x float> %c
185 %t1 = call nsz <8 x float> @llvm.fma.v8f32(<8 x float> %a, <8 x float> %b, <8 x float> %t0)
186 %sub.i = fsub <8 x float> <float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0>, %t1
187 ret <8 x float> %sub.i
190 define <8 x float> @test8(<8 x float> %a, <8 x float> %b, <8 x float> %c) {
191 ; CHECK-LABEL: test8:
192 ; CHECK: # %bb.0: # %entry
193 ; CHECK-NEXT: vfmadd213ps {{.*#+}} ymm0 = (ymm1 * ymm0) + ymm2
196 %sub.c = fsub <8 x float> <float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0>, %c
197 %0 = tail call <8 x float> @llvm.x86.fma.vfmsub.ps.256(<8 x float> %a, <8 x float> %b, <8 x float> %sub.c) #2
201 define <8 x double> @test9(<8 x double> %a, <8 x double> %b, <8 x double> %c) {
204 ; SKX-NEXT: vfmadd213pd {{.*#+}} zmm0 = (zmm1 * zmm0) + zmm2
205 ; SKX-NEXT: vxorpd {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to8}, %zmm0, %zmm0
210 ; KNL-NEXT: vfmadd213pd {{.*#+}} zmm0 = (zmm1 * zmm0) + zmm2
211 ; KNL-NEXT: vpxorq {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to8}, %zmm0, %zmm0
213 %t0 = tail call <8 x double> @llvm.x86.avx512.vfmadd.pd.512(<8 x double> %a, <8 x double> %b, <8 x double> %c, i32 4)
214 %sub.i = fneg <8 x double> %t0
215 ret <8 x double> %sub.i
218 define <8 x double> @test9_nsz(<8 x double> %a, <8 x double> %b, <8 x double> %c) {
219 ; CHECK-LABEL: test9_nsz:
221 ; CHECK-NEXT: vfnmsub213pd {{.*#+}} zmm0 = -(zmm1 * zmm0) - zmm2
223 %t0 = tail call nsz <8 x double> @llvm.x86.avx512.vfmadd.pd.512(<8 x double> %a, <8 x double> %b, <8 x double> %c, i32 4)
224 %sub.i = fneg <8 x double> %t0
225 ret <8 x double> %sub.i
228 define <2 x double> @test10(<2 x double> %a, <2 x double> %b, <2 x double> %c) {
229 ; CHECK-LABEL: test10:
230 ; CHECK: # %bb.0: # %entry
231 ; CHECK-NEXT: vfmadd213sd {{.*#+}} xmm0 = (xmm1 * xmm0) + xmm2
232 ; CHECK-NEXT: vxorpd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
235 %0 = tail call <2 x double> @llvm.x86.avx512.mask.vfmadd.sd(<2 x double> %a, <2 x double> %b, <2 x double> %c, i8 -1, i32 4) #2
236 %sub.i = fsub <2 x double> <double -0.0, double -0.0>, %0
237 ret <2 x double> %sub.i
240 define <4 x float> @test11(<4 x float> %a, <4 x float> %b, <4 x float> %c, i8 zeroext %mask) local_unnamed_addr #0 {
242 ; SKX: # %bb.0: # %entry
243 ; SKX-NEXT: vxorps {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %xmm2, %xmm3
244 ; SKX-NEXT: vfmsub213ss {{.*#+}} xmm0 = (xmm1 * xmm0) - xmm2
245 ; SKX-NEXT: kmovd %edi, %k1
246 ; SKX-NEXT: vmovss %xmm0, %xmm3, %xmm3 {%k1}
247 ; SKX-NEXT: vmovaps %xmm3, %xmm0
251 ; KNL: # %bb.0: # %entry
252 ; KNL-NEXT: vbroadcastss {{.*#+}} xmm3 = [-0.0E+0,-0.0E+0,-0.0E+0,-0.0E+0]
253 ; KNL-NEXT: vxorps %xmm3, %xmm2, %xmm3
254 ; KNL-NEXT: vfmsub213ss {{.*#+}} xmm0 = (xmm1 * xmm0) - xmm2
255 ; KNL-NEXT: kmovw %edi, %k1
256 ; KNL-NEXT: vmovss %xmm0, %xmm3, %xmm3 {%k1}
257 ; KNL-NEXT: vmovaps %xmm3, %xmm0
260 %sub.i = fsub <4 x float> <float -0.0, float -0.0, float -0.0, float -0.0>, %c
261 %0 = tail call <4 x float> @llvm.x86.avx512.mask3.vfmadd.ss(<4 x float> %a, <4 x float> %b, <4 x float> %sub.i, i8 %mask, i32 4) #10
265 define <4 x float> @test11b(<4 x float> %a, <4 x float> %b, <4 x float> %c, i8 zeroext %mask) local_unnamed_addr #0 {
266 ; SKX-LABEL: test11b:
267 ; SKX: # %bb.0: # %entry
268 ; SKX-NEXT: kmovd %edi, %k1
269 ; SKX-NEXT: vfmsub213ss {{.*#+}} xmm0 {%k1} = (xmm1 * xmm0) - xmm2
272 ; KNL-LABEL: test11b:
273 ; KNL: # %bb.0: # %entry
274 ; KNL-NEXT: kmovw %edi, %k1
275 ; KNL-NEXT: vfmsub213ss {{.*#+}} xmm0 {%k1} = (xmm1 * xmm0) - xmm2
278 %sub.i = fsub <4 x float> <float -0.0, float -0.0, float -0.0, float -0.0>, %c
279 %0 = tail call <4 x float> @llvm.x86.avx512.mask.vfmadd.ss(<4 x float> %a, <4 x float> %b, <4 x float> %sub.i, i8 %mask, i32 4) #10
283 define <8 x double> @test12(<8 x double> %a, <8 x double> %b, <8 x double> %c, i8 %mask) {
285 ; SKX: # %bb.0: # %entry
286 ; SKX-NEXT: kmovd %edi, %k1
287 ; SKX-NEXT: vfmadd132pd {{.*#+}} zmm0 {%k1} = (zmm0 * zmm1) + zmm2
288 ; SKX-NEXT: vxorpd {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to8}, %zmm0, %zmm0
292 ; KNL: # %bb.0: # %entry
293 ; KNL-NEXT: kmovw %edi, %k1
294 ; KNL-NEXT: vfmadd132pd {{.*#+}} zmm0 {%k1} = (zmm0 * zmm1) + zmm2
295 ; KNL-NEXT: vpxorq {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to8}, %zmm0, %zmm0
298 %0 = tail call <8 x double> @llvm.x86.avx512.vfmadd.pd.512(<8 x double> %a, <8 x double> %b, <8 x double> %c, i32 4) #2
299 %bc = bitcast i8 %mask to <8 x i1>
300 %sel = select <8 x i1> %bc, <8 x double> %0, <8 x double> %a
301 %sub.i = fsub <8 x double> <double -0.0, double -0.0, double -0.0, double -0.0, double -0.0, double -0.0, double -0.0, double -0.0>, %sel
302 ret <8 x double> %sub.i
305 define <2 x double> @test13(<2 x double> %a, <2 x double> %b, <2 x double> %c, i8 %mask) {
307 ; SKX: # %bb.0: # %entry
308 ; SKX-NEXT: vxorpd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm3
309 ; SKX-NEXT: vfnmadd213sd {{.*#+}} xmm1 = -(xmm0 * xmm1) + xmm2
310 ; SKX-NEXT: kmovd %edi, %k1
311 ; SKX-NEXT: vmovsd %xmm1, %xmm3, %xmm3 {%k1}
312 ; SKX-NEXT: vmovapd %xmm3, %xmm0
316 ; KNL: # %bb.0: # %entry
317 ; KNL-NEXT: vxorpd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm3
318 ; KNL-NEXT: vfnmadd213sd {{.*#+}} xmm1 = -(xmm0 * xmm1) + xmm2
319 ; KNL-NEXT: kmovw %edi, %k1
320 ; KNL-NEXT: vmovsd %xmm1, %xmm3, %xmm3 {%k1}
321 ; KNL-NEXT: vmovapd %xmm3, %xmm0
324 %sub.i = fsub <2 x double> <double -0.0, double -0.0>, %a
325 %0 = tail call <2 x double> @llvm.x86.avx512.mask.vfmadd.sd(<2 x double> %sub.i, <2 x double> %b, <2 x double> %c, i8 %mask, i32 4)
329 define <16 x float> @test14(<16 x float> %a, <16 x float> %b, <16 x float> %c, i16 %mask) {
331 ; SKX: # %bb.0: # %entry
332 ; SKX-NEXT: kmovd %edi, %k1
333 ; SKX-NEXT: vfnmsub132ps {ru-sae}, %zmm1, %zmm2, %zmm0 {%k1}
334 ; SKX-NEXT: vxorps {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to16}, %zmm0, %zmm0
338 ; KNL: # %bb.0: # %entry
339 ; KNL-NEXT: kmovw %edi, %k1
340 ; KNL-NEXT: vfnmsub132ps {ru-sae}, %zmm1, %zmm2, %zmm0 {%k1}
341 ; KNL-NEXT: vpxord {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to16}, %zmm0, %zmm0
344 %0 = tail call <16 x float> @llvm.x86.avx512.mask.vfnmsub.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> %c, i16 %mask, i32 10) #2
345 %sub.i = fsub <16 x float> <float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0>, %0
346 ret <16 x float> %sub.i
349 define <16 x float> @test15(<16 x float> %a, <16 x float> %b, <16 x float> %c, i16 %mask) {
351 ; SKX: # %bb.0: # %entry
352 ; SKX-NEXT: kmovd %edi, %k1
353 ; SKX-NEXT: vxorps {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to16}, %zmm0, %zmm3
354 ; SKX-NEXT: vfnmadd213ps {ru-sae}, %zmm2, %zmm0, %zmm1
355 ; SKX-NEXT: vmovaps %zmm1, %zmm3 {%k1}
356 ; SKX-NEXT: vfnmadd132ps {rd-sae}, %zmm0, %zmm2, %zmm3 {%k1}
357 ; SKX-NEXT: vmovaps %zmm3, %zmm0
361 ; KNL: # %bb.0: # %entry
362 ; KNL-NEXT: kmovw %edi, %k1
363 ; KNL-NEXT: vpxord {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to16}, %zmm0, %zmm3
364 ; KNL-NEXT: vfnmadd213ps {ru-sae}, %zmm2, %zmm0, %zmm1
365 ; KNL-NEXT: vmovaps %zmm1, %zmm3 {%k1}
366 ; KNL-NEXT: vfnmadd132ps {rd-sae}, %zmm0, %zmm2, %zmm3 {%k1}
367 ; KNL-NEXT: vmovaps %zmm3, %zmm0
370 %bc = bitcast i16 %mask to <16 x i1>
371 %sub.i = fsub <16 x float> <float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0>, %a
372 %0 = tail call <16 x float> @llvm.x86.avx512.vfmadd.ps.512(<16 x float> %sub.i, <16 x float> %b, <16 x float> %c, i32 10)
373 %sel = select <16 x i1> %bc, <16 x float> %0, <16 x float> %sub.i
374 %1 = tail call <16 x float> @llvm.x86.avx512.vfmadd.ps.512(<16 x float> %sel, <16 x float> %sub.i, <16 x float> %c, i32 9)
375 %sel2 = select <16 x i1> %bc, <16 x float> %1, <16 x float> %sel
376 ret <16 x float> %sel2
379 define <16 x float> @test16(<16 x float> %a, <16 x float> %b, <16 x float> %c, i16 %mask) {
382 ; SKX-NEXT: kmovd %edi, %k1
383 ; SKX-NEXT: vfmsubadd132ps {rd-sae}, %zmm1, %zmm2, %zmm0 {%k1}
388 ; KNL-NEXT: kmovw %edi, %k1
389 ; KNL-NEXT: vfmsubadd132ps {rd-sae}, %zmm1, %zmm2, %zmm0 {%k1}
391 %sub.i = fsub <16 x float> <float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0>, %c
392 %res = call <16 x float> @llvm.x86.avx512.vfmaddsub.ps.512(<16 x float> %a, <16 x float> %b, <16 x float> %sub.i, i32 9)
393 %bc = bitcast i16 %mask to <16 x i1>
394 %sel = select <16 x i1> %bc, <16 x float> %res, <16 x float> %a
395 ret <16 x float> %sel
398 define <8 x double> @test17(<8 x double> %a, <8 x double> %b, <8 x double> %c, i8 %mask) {
401 ; SKX-NEXT: kmovd %edi, %k1
402 ; SKX-NEXT: vfmsubadd132pd {{.*#+}} zmm0 {%k1} = (zmm0 * zmm1) -/+ zmm2
407 ; KNL-NEXT: kmovw %edi, %k1
408 ; KNL-NEXT: vfmsubadd132pd {{.*#+}} zmm0 {%k1} = (zmm0 * zmm1) -/+ zmm2
410 %sub.i = fsub <8 x double> <double -0.0, double -0.0, double -0.0, double -0.0, double -0.0, double -0.0, double -0.0, double -0.0>, %c
411 %res = call <8 x double> @llvm.x86.avx512.vfmaddsub.pd.512(<8 x double> %a, <8 x double> %b, <8 x double> %sub.i, i32 4)
412 %bc = bitcast i8 %mask to <8 x i1>
413 %sel = select <8 x i1> %bc, <8 x double> %res, <8 x double> %a
414 ret <8 x double> %sel
417 define <4 x float> @test18(<4 x float> %a, <4 x float> %b, <4 x float> %c, i8 zeroext %mask) local_unnamed_addr #0 {
419 ; SKX: # %bb.0: # %entry
420 ; SKX-NEXT: kmovd %edi, %k1
421 ; SKX-NEXT: vfnmadd213ss {{.*#+}} xmm0 {%k1} = -(xmm1 * xmm0) + xmm2
425 ; KNL: # %bb.0: # %entry
426 ; KNL-NEXT: kmovw %edi, %k1
427 ; KNL-NEXT: vfnmadd213ss {{.*#+}} xmm0 {%k1} = -(xmm1 * xmm0) + xmm2
430 %sub.i = fsub <4 x float> <float -0.0, float -0.0, float -0.0, float -0.0>, %b
431 %0 = tail call <4 x float> @llvm.x86.avx512.mask.vfmadd.ss(<4 x float> %a, <4 x float> %sub.i, <4 x float> %c, i8 %mask, i32 4) #10
435 define <4 x float> @test19(<4 x float> %a, <4 x float> %b, <4 x float> %c, i8 zeroext %mask) local_unnamed_addr #0 {
437 ; SKX: # %bb.0: # %entry
438 ; SKX-NEXT: kmovd %edi, %k1
439 ; SKX-NEXT: vfnmsub213ss {{.*#+}} xmm0 {%k1} = -(xmm1 * xmm0) - xmm2
443 ; KNL: # %bb.0: # %entry
444 ; KNL-NEXT: kmovw %edi, %k1
445 ; KNL-NEXT: vfnmsub213ss {{.*#+}} xmm0 {%k1} = -(xmm1 * xmm0) - xmm2
448 %sub.i = fsub <4 x float> <float -0.0, float -0.0, float -0.0, float -0.0>, %b
449 %sub.i.2 = fsub <4 x float> <float -0.0, float -0.0, float -0.0, float -0.0>, %c
450 %0 = tail call <4 x float> @llvm.x86.avx512.mask.vfmadd.ss(<4 x float> %a, <4 x float> %sub.i, <4 x float> %sub.i.2, i8 %mask, i32 4) #10
454 define <4 x float> @test20(<4 x float> %a, <4 x float> %b, <4 x float> %c, i8 zeroext %mask) local_unnamed_addr #0 {
456 ; SKX: # %bb.0: # %entry
457 ; SKX-NEXT: kmovd %edi, %k1
458 ; SKX-NEXT: vfnmadd231ss {{.*#+}} xmm2 {%k1} = -(xmm0 * xmm1) + xmm2
459 ; SKX-NEXT: vmovaps %xmm2, %xmm0
463 ; KNL: # %bb.0: # %entry
464 ; KNL-NEXT: kmovw %edi, %k1
465 ; KNL-NEXT: vfnmadd231ss {{.*#+}} xmm2 {%k1} = -(xmm0 * xmm1) + xmm2
466 ; KNL-NEXT: vmovaps %xmm2, %xmm0
469 %sub.i = fsub <4 x float> <float -0.0, float -0.0, float -0.0, float -0.0>, %b
470 %0 = tail call <4 x float> @llvm.x86.avx512.mask3.vfmadd.ss(<4 x float> %a, <4 x float> %sub.i, <4 x float> %c, i8 %mask, i32 4) #10
474 define <4 x float> @test21(<4 x float> %a, <4 x float> %b, <4 x float> %c, i8 zeroext %mask) local_unnamed_addr #0 {
476 ; SKX: # %bb.0: # %entry
477 ; SKX-NEXT: kmovd %edi, %k1
478 ; SKX-NEXT: vfnmadd213ss {rn-sae}, %xmm2, %xmm1, %xmm0 {%k1}
482 ; KNL: # %bb.0: # %entry
483 ; KNL-NEXT: kmovw %edi, %k1
484 ; KNL-NEXT: vfnmadd213ss {rn-sae}, %xmm2, %xmm1, %xmm0 {%k1}
487 %sub.i = fsub <4 x float> <float -0.0, float -0.0, float -0.0, float -0.0>, %b
488 %0 = tail call <4 x float> @llvm.x86.avx512.mask.vfmadd.ss(<4 x float> %a, <4 x float> %sub.i, <4 x float> %c, i8 %mask, i32 8) #10
492 define <4 x float> @test22(<4 x float> %a, <4 x float> %b, <4 x float> %c, i8 zeroext %mask) local_unnamed_addr #0 {
494 ; SKX: # %bb.0: # %entry
495 ; SKX-NEXT: kmovd %edi, %k1
496 ; SKX-NEXT: vfnmsub213ss {rn-sae}, %xmm2, %xmm1, %xmm0 {%k1}
500 ; KNL: # %bb.0: # %entry
501 ; KNL-NEXT: kmovw %edi, %k1
502 ; KNL-NEXT: vfnmsub213ss {rn-sae}, %xmm2, %xmm1, %xmm0 {%k1}
505 %sub.i = fsub <4 x float> <float -0.0, float -0.0, float -0.0, float -0.0>, %b
506 %sub.i.2 = fsub <4 x float> <float -0.0, float -0.0, float -0.0, float -0.0>, %c
507 %0 = tail call <4 x float> @llvm.x86.avx512.mask.vfmadd.ss(<4 x float> %a, <4 x float> %sub.i, <4 x float> %sub.i.2, i8 %mask, i32 8) #10
511 define <4 x float> @test23(<4 x float> %a, <4 x float> %b, <4 x float> %c, i8 zeroext %mask) local_unnamed_addr #0 {
513 ; SKX: # %bb.0: # %entry
514 ; SKX-NEXT: kmovd %edi, %k1
515 ; SKX-NEXT: vfnmadd231ss {rn-sae}, %xmm1, %xmm0, %xmm2 {%k1}
516 ; SKX-NEXT: vmovaps %xmm2, %xmm0
520 ; KNL: # %bb.0: # %entry
521 ; KNL-NEXT: kmovw %edi, %k1
522 ; KNL-NEXT: vfnmadd231ss {rn-sae}, %xmm1, %xmm0, %xmm2 {%k1}
523 ; KNL-NEXT: vmovaps %xmm2, %xmm0
526 %sub.i = fsub <4 x float> <float -0.0, float -0.0, float -0.0, float -0.0>, %b
527 %0 = tail call <4 x float> @llvm.x86.avx512.mask3.vfmadd.ss(<4 x float> %a, <4 x float> %sub.i, <4 x float> %c, i8 %mask, i32 8) #10
531 define <4 x float> @test24(<4 x float> %a, <4 x float> %b, <4 x float> %c, i8 zeroext %mask) local_unnamed_addr #0 {
533 ; SKX: # %bb.0: # %entry
534 ; SKX-NEXT: kmovd %edi, %k1
535 ; SKX-NEXT: vfmsub213ss {rn-sae}, %xmm2, %xmm1, %xmm0 {%k1}
539 ; KNL: # %bb.0: # %entry
540 ; KNL-NEXT: kmovw %edi, %k1
541 ; KNL-NEXT: vfmsub213ss {rn-sae}, %xmm2, %xmm1, %xmm0 {%k1}
544 %sub.i = fsub <4 x float> <float -0.0, float -0.0, float -0.0, float -0.0>, %c
545 %0 = tail call <4 x float> @llvm.x86.avx512.mask.vfmadd.ss(<4 x float> %a, <4 x float> %b, <4 x float> %sub.i, i8 %mask, i32 8) #10
549 define <16 x float> @test25(<16 x float> %a, <16 x float> %b, <16 x float> %c) {
550 ; CHECK-LABEL: test25:
551 ; CHECK: # %bb.0: # %entry
552 ; CHECK-NEXT: vfnmsub213ps {rn-sae}, %zmm2, %zmm1, %zmm0
555 %sub.i = fsub <16 x float> <float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0>, %b
556 %sub.i.2 = fsub <16 x float> <float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0, float -0.0>, %c
557 %0 = tail call <16 x float> @llvm.x86.avx512.vfmadd.ps.512(<16 x float> %a, <16 x float> %sub.i, <16 x float> %sub.i.2, i32 8) #2