1 ;; GCC machine description for SSE instructions
2 ;; Copyright (C) 2005-2016 Free Software Foundation, Inc.
4 ;; This file is part of GCC.
6 ;; GCC is free software; you can redistribute it and/or modify
7 ;; it under the terms of the GNU General Public License as published by
8 ;; the Free Software Foundation; either version 3, or (at your option)
11 ;; GCC is distributed in the hope that it will be useful,
12 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;; GNU General Public License for more details.
16 ;; You should have received a copy of the GNU General Public License
17 ;; along with GCC; see the file COPYING3. If not see
18 ;; <http://www.gnu.org/licenses/>.
20 (define_c_enum "unspec" [
55 UNSPEC_XOP_UNSIGNED_CMP
66 UNSPEC_AESKEYGENASSIST
87 ;; For AVX512F support
91 UNSPEC_UNSIGNED_FIX_NOTRUNC
106 UNSPEC_COMPRESS_STORE
111 ;; For embed. rounding feature
112 UNSPEC_EMBEDDED_ROUNDING
114 ;; For AVX512PF support
115 UNSPEC_GATHER_PREFETCH
116 UNSPEC_SCATTER_PREFETCH
118 ;; For AVX512ER support
132 ;; For AVX512BW support
140 ;; For AVX512DQ support
145 ;; For AVX512IFMA support
149 ;; For AVX512VBMI support
153 (define_c_enum "unspecv" [
163 ;; All vector modes including V?TImode, used in move patterns.
164 (define_mode_iterator VMOVE
165 [(V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI
166 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX") V8HI
167 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
168 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI
169 (V4TI "TARGET_AVX512BW") (V2TI "TARGET_AVX") V1TI
170 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
171 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") V2DF])
173 ;; All AVX-512{F,VL} vector modes. Supposed TARGET_AVX512F baseline.
174 (define_mode_iterator V48_AVX512VL
175 [V16SI (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")
176 V8DI (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")
177 V16SF (V8SF "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
178 V8DF (V4DF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
180 ;; 1,2 byte AVX-512{BW,VL} vector modes. Supposed TARGET_AVX512BW baseline.
181 (define_mode_iterator VI12_AVX512VL
182 [V64QI (V16QI "TARGET_AVX512VL") (V32QI "TARGET_AVX512VL")
183 V32HI (V16HI "TARGET_AVX512VL") (V8HI "TARGET_AVX512VL")])
185 (define_mode_iterator VI1_AVX512VL
186 [V64QI (V16QI "TARGET_AVX512VL") (V32QI "TARGET_AVX512VL")])
189 (define_mode_iterator V
190 [(V32QI "TARGET_AVX") V16QI
191 (V16HI "TARGET_AVX") V8HI
192 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
193 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI
194 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
195 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
197 ;; All 128bit vector modes
198 (define_mode_iterator V_128
199 [V16QI V8HI V4SI V2DI V4SF (V2DF "TARGET_SSE2")])
201 ;; All 256bit vector modes
202 (define_mode_iterator V_256
203 [V32QI V16HI V8SI V4DI V8SF V4DF])
205 ;; All 512bit vector modes
206 (define_mode_iterator V_512 [V64QI V32HI V16SI V8DI V16SF V8DF])
208 ;; All 256bit and 512bit vector modes
209 (define_mode_iterator V_256_512
210 [V32QI V16HI V8SI V4DI V8SF V4DF
211 (V64QI "TARGET_AVX512F") (V32HI "TARGET_AVX512F") (V16SI "TARGET_AVX512F")
212 (V8DI "TARGET_AVX512F") (V16SF "TARGET_AVX512F") (V8DF "TARGET_AVX512F")])
214 ;; All vector float modes
215 (define_mode_iterator VF
216 [(V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
217 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
219 ;; 128- and 256-bit float vector modes
220 (define_mode_iterator VF_128_256
221 [(V8SF "TARGET_AVX") V4SF
222 (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
224 ;; All SFmode vector float modes
225 (define_mode_iterator VF1
226 [(V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF])
228 ;; 128- and 256-bit SF vector modes
229 (define_mode_iterator VF1_128_256
230 [(V8SF "TARGET_AVX") V4SF])
232 (define_mode_iterator VF1_128_256VL
233 [V8SF (V4SF "TARGET_AVX512VL")])
235 ;; All DFmode vector float modes
236 (define_mode_iterator VF2
237 [(V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") V2DF])
239 ;; 128- and 256-bit DF vector modes
240 (define_mode_iterator VF2_128_256
241 [(V4DF "TARGET_AVX") V2DF])
243 (define_mode_iterator VF2_512_256
244 [(V8DF "TARGET_AVX512F") V4DF])
246 (define_mode_iterator VF2_512_256VL
247 [V8DF (V4DF "TARGET_AVX512VL")])
249 ;; All 128bit vector float modes
250 (define_mode_iterator VF_128
251 [V4SF (V2DF "TARGET_SSE2")])
253 ;; All 256bit vector float modes
254 (define_mode_iterator VF_256
257 ;; All 512bit vector float modes
258 (define_mode_iterator VF_512
261 (define_mode_iterator VI48_AVX512VL
262 [V16SI (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")
263 V8DI (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")])
265 (define_mode_iterator VF_AVX512VL
266 [V16SF (V8SF "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
267 V8DF (V4DF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
269 (define_mode_iterator VF2_AVX512VL
270 [V8DF (V4DF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
272 (define_mode_iterator VF1_AVX512VL
273 [V16SF (V8SF "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")])
275 ;; All vector integer modes
276 (define_mode_iterator VI
277 [(V16SI "TARGET_AVX512F") (V8DI "TARGET_AVX512F")
278 (V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX") V16QI
279 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX") V8HI
280 (V8SI "TARGET_AVX") V4SI
281 (V4DI "TARGET_AVX") V2DI])
283 (define_mode_iterator VI_AVX2
284 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI
285 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI
286 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX2") V4SI
287 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX2") V2DI])
289 ;; All QImode vector integer modes
290 (define_mode_iterator VI1
291 [(V32QI "TARGET_AVX") V16QI])
293 (define_mode_iterator VI_ULOADSTORE_BW_AVX512VL
295 V32HI (V8HI "TARGET_AVX512VL") (V16HI "TARGET_AVX512VL")])
297 (define_mode_iterator VI_ULOADSTORE_F_AVX512VL
298 [V16SI (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")
299 V8DI (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")])
301 ;; All DImode vector integer modes
302 (define_mode_iterator V_AVX
303 [V16QI V8HI V4SI V2DI V4SF V2DF
304 (V32QI "TARGET_AVX") (V16HI "TARGET_AVX")
305 (V8SI "TARGET_AVX") (V4DI "TARGET_AVX")
306 (V8SF "TARGET_AVX") (V4DF"TARGET_AVX")])
308 (define_mode_iterator VI48_AVX
310 (V8SI "TARGET_AVX") (V4DI "TARGET_AVX")])
312 (define_mode_iterator VI8
313 [(V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI])
315 (define_mode_iterator VI8_AVX512VL
316 [V8DI (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")])
318 (define_mode_iterator VI8_256_512
319 [V8DI (V4DI "TARGET_AVX512VL")])
321 (define_mode_iterator VI1_AVX2
322 [(V32QI "TARGET_AVX2") V16QI])
324 (define_mode_iterator VI1_AVX512
325 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI])
327 (define_mode_iterator VI2_AVX2
328 [(V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI])
330 (define_mode_iterator VI2_AVX512F
331 [(V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX2") V8HI])
333 (define_mode_iterator VI4_AVX
334 [(V8SI "TARGET_AVX") V4SI])
336 (define_mode_iterator VI4_AVX2
337 [(V8SI "TARGET_AVX2") V4SI])
339 (define_mode_iterator VI4_AVX512F
340 [(V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX2") V4SI])
342 (define_mode_iterator VI4_AVX512VL
343 [V16SI (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")])
345 (define_mode_iterator VI48_AVX512F_AVX512VL
346 [V4SI V8SI (V16SI "TARGET_AVX512F")
347 (V2DI "TARGET_AVX512VL") (V4DI "TARGET_AVX512VL") (V8DI "TARGET_AVX512F")])
349 (define_mode_iterator VI2_AVX512VL
350 [(V8HI "TARGET_AVX512VL") (V16HI "TARGET_AVX512VL") V32HI])
352 (define_mode_iterator VI8_AVX2_AVX512BW
353 [(V8DI "TARGET_AVX512BW") (V4DI "TARGET_AVX2") V2DI])
355 (define_mode_iterator VI8_AVX2
356 [(V4DI "TARGET_AVX2") V2DI])
358 (define_mode_iterator VI8_AVX2_AVX512F
359 [(V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX2") V2DI])
361 (define_mode_iterator VI4_128_8_256
365 (define_mode_iterator V8FI
369 (define_mode_iterator V16FI
372 ;; ??? We should probably use TImode instead.
373 (define_mode_iterator VIMAX_AVX2
374 [(V4TI "TARGET_AVX512BW") (V2TI "TARGET_AVX2") V1TI])
376 ;; ??? This should probably be dropped in favor of VIMAX_AVX2.
377 (define_mode_iterator SSESCALARMODE
378 [(V4TI "TARGET_AVX512BW") (V2TI "TARGET_AVX2") TI])
380 (define_mode_iterator VI12_AVX2
381 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI
382 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI])
384 (define_mode_iterator VI24_AVX2
385 [(V16HI "TARGET_AVX2") V8HI
386 (V8SI "TARGET_AVX2") V4SI])
388 (define_mode_iterator VI124_AVX2_24_AVX512F_1_AVX512BW
389 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI
390 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX2") V8HI
391 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX2") V4SI])
393 (define_mode_iterator VI124_AVX2
394 [(V32QI "TARGET_AVX2") V16QI
395 (V16HI "TARGET_AVX2") V8HI
396 (V8SI "TARGET_AVX2") V4SI])
398 (define_mode_iterator VI2_AVX2_AVX512BW
399 [(V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI])
401 (define_mode_iterator VI48_AVX2
402 [(V8SI "TARGET_AVX2") V4SI
403 (V4DI "TARGET_AVX2") V2DI])
405 (define_mode_iterator VI248_AVX2_8_AVX512F_24_AVX512BW
406 [(V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI
407 (V16SI "TARGET_AVX512BW") (V8SI "TARGET_AVX2") V4SI
408 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX2") V2DI])
410 (define_mode_iterator VI248_AVX512BW_AVX512VL
411 [(V32HI "TARGET_AVX512BW")
412 (V4DI "TARGET_AVX512VL") V16SI V8DI])
414 ;; Suppose TARGET_AVX512VL as baseline
415 (define_mode_iterator VI24_AVX512BW_1
416 [(V16HI "TARGET_AVX512BW") (V8HI "TARGET_AVX512BW")
419 (define_mode_iterator VI48_AVX512F
420 [(V16SI "TARGET_AVX512F") V8SI V4SI
421 (V8DI "TARGET_AVX512F") V4DI V2DI])
423 (define_mode_iterator VI48_AVX_AVX512F
424 [(V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
425 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI])
427 (define_mode_iterator VI12_AVX_AVX512F
428 [ (V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI
429 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX") V8HI])
431 (define_mode_iterator V48_AVX2
434 (V4SI "TARGET_AVX2") (V2DI "TARGET_AVX2")
435 (V8SI "TARGET_AVX2") (V4DI "TARGET_AVX2")])
437 (define_mode_attr avx512
438 [(V16QI "avx512vl") (V32QI "avx512vl") (V64QI "avx512bw")
439 (V8HI "avx512vl") (V16HI "avx512vl") (V32HI "avx512bw")
440 (V4SI "avx512vl") (V8SI "avx512vl") (V16SI "avx512f")
441 (V2DI "avx512vl") (V4DI "avx512vl") (V8DI "avx512f")
442 (V4SF "avx512vl") (V8SF "avx512vl") (V16SF "avx512f")
443 (V2DF "avx512vl") (V4DF "avx512vl") (V8DF "avx512f")])
445 (define_mode_attr sse2_avx_avx512f
446 [(V16QI "sse2") (V32QI "avx") (V64QI "avx512f")
447 (V8HI "avx512vl") (V16HI "avx512vl") (V32HI "avx512bw")
448 (V4SI "sse2") (V8SI "avx") (V16SI "avx512f")
449 (V2DI "avx512vl") (V4DI "avx512vl") (V8DI "avx512f")
450 (V16SF "avx512f") (V8SF "avx") (V4SF "avx")
451 (V8DF "avx512f") (V4DF "avx") (V2DF "avx")])
453 (define_mode_attr sse2_avx2
454 [(V16QI "sse2") (V32QI "avx2") (V64QI "avx512bw")
455 (V8HI "sse2") (V16HI "avx2") (V32HI "avx512bw")
456 (V4SI "sse2") (V8SI "avx2") (V16SI "avx512f")
457 (V2DI "sse2") (V4DI "avx2") (V8DI "avx512f")
458 (V1TI "sse2") (V2TI "avx2") (V4TI "avx512bw")])
460 (define_mode_attr ssse3_avx2
461 [(V16QI "ssse3") (V32QI "avx2") (V64QI "avx512bw")
462 (V4HI "ssse3") (V8HI "ssse3") (V16HI "avx2") (V32HI "avx512bw")
463 (V4SI "ssse3") (V8SI "avx2")
464 (V2DI "ssse3") (V4DI "avx2")
465 (TI "ssse3") (V2TI "avx2") (V4TI "avx512bw")])
467 (define_mode_attr sse4_1_avx2
468 [(V16QI "sse4_1") (V32QI "avx2") (V64QI "avx512bw")
469 (V8HI "sse4_1") (V16HI "avx2") (V32HI "avx512bw")
470 (V4SI "sse4_1") (V8SI "avx2") (V16SI "avx512f")
471 (V2DI "sse4_1") (V4DI "avx2") (V8DI "avx512dq")])
473 (define_mode_attr avx_avx2
474 [(V4SF "avx") (V2DF "avx")
475 (V8SF "avx") (V4DF "avx")
476 (V4SI "avx2") (V2DI "avx2")
477 (V8SI "avx2") (V4DI "avx2")])
479 (define_mode_attr vec_avx2
480 [(V16QI "vec") (V32QI "avx2")
481 (V8HI "vec") (V16HI "avx2")
482 (V4SI "vec") (V8SI "avx2")
483 (V2DI "vec") (V4DI "avx2")])
485 (define_mode_attr avx2_avx512
486 [(V4SI "avx2") (V8SI "avx2") (V16SI "avx512f")
487 (V2DI "avx2") (V4DI "avx2") (V8DI "avx512f")
488 (V4SF "avx2") (V8SF "avx2") (V16SF "avx512f")
489 (V2DF "avx2") (V4DF "avx2") (V8DF "avx512f")
490 (V8HI "avx512vl") (V16HI "avx512vl") (V32HI "avx512bw")])
492 (define_mode_attr shuffletype
493 [(V16SF "f") (V16SI "i") (V8DF "f") (V8DI "i")
494 (V8SF "f") (V8SI "i") (V4DF "f") (V4DI "i")
495 (V4SF "f") (V4SI "i") (V2DF "f") (V2DI "i")
496 (V32QI "i") (V16HI "i") (V16QI "i") (V8HI "i")
497 (V64QI "i") (V1TI "i") (V2TI "i")])
499 (define_mode_attr ssequartermode
500 [(V16SF "V4SF") (V8DF "V2DF") (V16SI "V4SI") (V8DI "V2DI")])
502 (define_mode_attr ssedoublemodelower
503 [(V16QI "v16hi") (V32QI "v32hi") (V64QI "v64hi")
504 (V8HI "v8si") (V16HI "v16si") (V32HI "v32si")
505 (V4SI "v4di") (V8SI "v8di") (V16SI "v16di")])
507 (define_mode_attr ssedoublemode
508 [(V4SF "V8SF") (V8SF "V16SF") (V16SF "V32SF")
509 (V2DF "V4DF") (V4DF "V8DF") (V8DF "V16DF")
510 (V16QI "V16HI") (V32QI "V32HI") (V64QI "V64HI")
511 (V4HI "V4SI") (V8HI "V8SI") (V16HI "V16SI") (V32HI "V32SI")
512 (V4SI "V4DI") (V8SI "V16SI") (V16SI "V32SI")
513 (V4DI "V8DI") (V8DI "V16DI")])
515 (define_mode_attr ssebytemode
516 [(V8DI "V64QI") (V4DI "V32QI") (V2DI "V16QI")])
518 ;; All 128bit vector integer modes
519 (define_mode_iterator VI_128 [V16QI V8HI V4SI V2DI])
521 ;; All 256bit vector integer modes
522 (define_mode_iterator VI_256 [V32QI V16HI V8SI V4DI])
524 ;; All 512bit vector integer modes
525 (define_mode_iterator VI_512
526 [(V64QI "TARGET_AVX512BW")
527 (V32HI "TARGET_AVX512BW")
530 ;; Various 128bit vector integer mode combinations
531 (define_mode_iterator VI12_128 [V16QI V8HI])
532 (define_mode_iterator VI14_128 [V16QI V4SI])
533 (define_mode_iterator VI124_128 [V16QI V8HI V4SI])
534 (define_mode_iterator VI24_128 [V8HI V4SI])
535 (define_mode_iterator VI248_128 [V8HI V4SI V2DI])
536 (define_mode_iterator VI48_128 [V4SI V2DI])
538 ;; Various 256bit and 512 vector integer mode combinations
539 (define_mode_iterator VI124_256 [V32QI V16HI V8SI])
540 (define_mode_iterator VI124_256_AVX512F_AVX512BW
542 (V64QI "TARGET_AVX512BW")
543 (V32HI "TARGET_AVX512BW")
544 (V16SI "TARGET_AVX512F")])
545 (define_mode_iterator VI48_256 [V8SI V4DI])
546 (define_mode_iterator VI48_512 [V16SI V8DI])
547 (define_mode_iterator VI4_256_8_512 [V8SI V8DI])
548 (define_mode_iterator VI_AVX512BW
549 [V16SI V8DI (V32HI "TARGET_AVX512BW") (V64QI "TARGET_AVX512BW")])
551 ;; Int-float size matches
552 (define_mode_iterator VI4F_128 [V4SI V4SF])
553 (define_mode_iterator VI8F_128 [V2DI V2DF])
554 (define_mode_iterator VI4F_256 [V8SI V8SF])
555 (define_mode_iterator VI8F_256 [V4DI V4DF])
556 (define_mode_iterator VI8F_256_512
557 [V4DI V4DF (V8DI "TARGET_AVX512F") (V8DF "TARGET_AVX512F")])
558 (define_mode_iterator VI48F_256_512
560 (V16SI "TARGET_AVX512F") (V16SF "TARGET_AVX512F")
561 (V8DI "TARGET_AVX512F") (V8DF "TARGET_AVX512F")
562 (V4DI "TARGET_AVX512VL") (V4DF "TARGET_AVX512VL")])
563 (define_mode_iterator VF48_I1248
564 [V16SI V16SF V8DI V8DF V32HI V64QI])
565 (define_mode_iterator VI48F
566 [V16SI V16SF V8DI V8DF
567 (V8SI "TARGET_AVX512VL") (V8SF "TARGET_AVX512VL")
568 (V4DI "TARGET_AVX512VL") (V4DF "TARGET_AVX512VL")
569 (V4SI "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
570 (V2DI "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
571 (define_mode_iterator VI48F_256 [V8SI V8SF V4DI V4DF])
573 ;; Mapping from float mode to required SSE level
574 (define_mode_attr sse
575 [(SF "sse") (DF "sse2")
576 (V4SF "sse") (V2DF "sse2")
577 (V16SF "avx512f") (V8SF "avx")
578 (V8DF "avx512f") (V4DF "avx")])
580 (define_mode_attr sse2
581 [(V16QI "sse2") (V32QI "avx") (V64QI "avx512f")
582 (V2DI "sse2") (V4DI "avx") (V8DI "avx512f")])
584 (define_mode_attr sse3
585 [(V16QI "sse3") (V32QI "avx")])
587 (define_mode_attr sse4_1
588 [(V4SF "sse4_1") (V2DF "sse4_1")
589 (V8SF "avx") (V4DF "avx")
591 (V4DI "avx") (V2DI "sse4_1")
592 (V8SI "avx") (V4SI "sse4_1")
593 (V16QI "sse4_1") (V32QI "avx")
594 (V8HI "sse4_1") (V16HI "avx")])
596 (define_mode_attr avxsizesuffix
597 [(V64QI "512") (V32HI "512") (V16SI "512") (V8DI "512")
598 (V32QI "256") (V16HI "256") (V8SI "256") (V4DI "256")
599 (V16QI "") (V8HI "") (V4SI "") (V2DI "")
600 (V16SF "512") (V8DF "512")
601 (V8SF "256") (V4DF "256")
602 (V4SF "") (V2DF "")])
604 ;; SSE instruction mode
605 (define_mode_attr sseinsnmode
606 [(V64QI "XI") (V32HI "XI") (V16SI "XI") (V8DI "XI") (V4TI "XI")
607 (V32QI "OI") (V16HI "OI") (V8SI "OI") (V4DI "OI") (V2TI "OI")
608 (V16QI "TI") (V8HI "TI") (V4SI "TI") (V2DI "TI") (V1TI "TI")
609 (V16SF "V16SF") (V8DF "V8DF")
610 (V8SF "V8SF") (V4DF "V4DF")
611 (V4SF "V4SF") (V2DF "V2DF")
614 ;; Mapping of vector modes to corresponding mask size
615 (define_mode_attr avx512fmaskmode
616 [(V64QI "DI") (V32QI "SI") (V16QI "HI")
617 (V32HI "SI") (V16HI "HI") (V8HI "QI") (V4HI "QI")
618 (V16SI "HI") (V8SI "QI") (V4SI "QI")
619 (V8DI "QI") (V4DI "QI") (V2DI "QI")
620 (V16SF "HI") (V8SF "QI") (V4SF "QI")
621 (V8DF "QI") (V4DF "QI") (V2DF "QI")])
623 ;; Mapping of vector modes to corresponding mask size
624 (define_mode_attr avx512fmaskmodelower
625 [(V64QI "di") (V32QI "si") (V16QI "hi")
626 (V32HI "si") (V16HI "hi") (V8HI "qi") (V4HI "qi")
627 (V16SI "hi") (V8SI "qi") (V4SI "qi")
628 (V8DI "qi") (V4DI "qi") (V2DI "qi")
629 (V16SF "hi") (V8SF "qi") (V4SF "qi")
630 (V8DF "qi") (V4DF "qi") (V2DF "qi")])
632 ;; Mapping of vector float modes to an integer mode of the same size
633 (define_mode_attr sseintvecmode
634 [(V16SF "V16SI") (V8DF "V8DI")
635 (V8SF "V8SI") (V4DF "V4DI")
636 (V4SF "V4SI") (V2DF "V2DI")
637 (V16SI "V16SI") (V8DI "V8DI")
638 (V8SI "V8SI") (V4DI "V4DI")
639 (V4SI "V4SI") (V2DI "V2DI")
640 (V16HI "V16HI") (V8HI "V8HI")
641 (V32HI "V32HI") (V64QI "V64QI")
642 (V32QI "V32QI") (V16QI "V16QI")])
644 (define_mode_attr sseintvecmode2
645 [(V8DF "XI") (V4DF "OI") (V2DF "TI")
646 (V8SF "OI") (V4SF "TI")])
648 (define_mode_attr sseintvecmodelower
649 [(V16SF "v16si") (V8DF "v8di")
650 (V8SF "v8si") (V4DF "v4di")
651 (V4SF "v4si") (V2DF "v2di")
652 (V8SI "v8si") (V4DI "v4di")
653 (V4SI "v4si") (V2DI "v2di")
654 (V16HI "v16hi") (V8HI "v8hi")
655 (V32QI "v32qi") (V16QI "v16qi")])
657 ;; Mapping of vector modes to a vector mode of double size
658 (define_mode_attr ssedoublevecmode
659 [(V32QI "V64QI") (V16HI "V32HI") (V8SI "V16SI") (V4DI "V8DI")
660 (V16QI "V32QI") (V8HI "V16HI") (V4SI "V8SI") (V2DI "V4DI")
661 (V8SF "V16SF") (V4DF "V8DF")
662 (V4SF "V8SF") (V2DF "V4DF")])
664 ;; Mapping of vector modes to a vector mode of half size
665 (define_mode_attr ssehalfvecmode
666 [(V64QI "V32QI") (V32HI "V16HI") (V16SI "V8SI") (V8DI "V4DI")
667 (V32QI "V16QI") (V16HI "V8HI") (V8SI "V4SI") (V4DI "V2DI")
668 (V16QI "V8QI") (V8HI "V4HI") (V4SI "V2SI")
669 (V16SF "V8SF") (V8DF "V4DF")
670 (V8SF "V4SF") (V4DF "V2DF")
673 ;; Mapping of vector modes ti packed single mode of the same size
674 (define_mode_attr ssePSmode
675 [(V16SI "V16SF") (V8DF "V16SF")
676 (V16SF "V16SF") (V8DI "V16SF")
677 (V64QI "V16SF") (V32QI "V8SF") (V16QI "V4SF")
678 (V32HI "V16SF") (V16HI "V8SF") (V8HI "V4SF")
679 (V8SI "V8SF") (V4SI "V4SF")
680 (V4DI "V8SF") (V2DI "V4SF")
681 (V4TI "V16SF") (V2TI "V8SF") (V1TI "V4SF")
682 (V8SF "V8SF") (V4SF "V4SF")
683 (V4DF "V8SF") (V2DF "V4SF")])
685 (define_mode_attr ssePSmode2
686 [(V8DI "V8SF") (V4DI "V4SF")])
688 ;; Mapping of vector modes back to the scalar modes
689 (define_mode_attr ssescalarmode
690 [(V64QI "QI") (V32QI "QI") (V16QI "QI")
691 (V32HI "HI") (V16HI "HI") (V8HI "HI")
692 (V16SI "SI") (V8SI "SI") (V4SI "SI")
693 (V8DI "DI") (V4DI "DI") (V2DI "DI")
694 (V16SF "SF") (V8SF "SF") (V4SF "SF")
695 (V8DF "DF") (V4DF "DF") (V2DF "DF")])
697 ;; Mapping of vector modes to the 128bit modes
698 (define_mode_attr ssexmmmode
699 [(V64QI "V16QI") (V32QI "V16QI") (V16QI "V16QI")
700 (V32HI "V8HI") (V16HI "V8HI") (V8HI "V8HI")
701 (V16SI "V4SI") (V8SI "V4SI") (V4SI "V4SI")
702 (V8DI "V2DI") (V4DI "V2DI") (V2DI "V2DI")
703 (V16SF "V4SF") (V8SF "V4SF") (V4SF "V4SF")
704 (V8DF "V2DF") (V4DF "V2DF") (V2DF "V2DF")])
706 ;; Pointer size override for scalar modes (Intel asm dialect)
707 (define_mode_attr iptr
708 [(V32QI "b") (V16HI "w") (V8SI "k") (V4DI "q")
709 (V16QI "b") (V8HI "w") (V4SI "k") (V2DI "q")
710 (V8SF "k") (V4DF "q")
711 (V4SF "k") (V2DF "q")
714 ;; Number of scalar elements in each vector type
715 (define_mode_attr ssescalarnum
716 [(V64QI "64") (V16SI "16") (V8DI "8")
717 (V32QI "32") (V16HI "16") (V8SI "8") (V4DI "4")
718 (V16QI "16") (V8HI "8") (V4SI "4") (V2DI "2")
719 (V16SF "16") (V8DF "8")
720 (V8SF "8") (V4DF "4")
721 (V4SF "4") (V2DF "2")])
723 ;; Mask of scalar elements in each vector type
724 (define_mode_attr ssescalarnummask
725 [(V32QI "31") (V16HI "15") (V8SI "7") (V4DI "3")
726 (V16QI "15") (V8HI "7") (V4SI "3") (V2DI "1")
727 (V8SF "7") (V4DF "3")
728 (V4SF "3") (V2DF "1")])
730 (define_mode_attr ssescalarsize
731 [(V8DI "64") (V4DI "64") (V2DI "64")
732 (V64QI "8") (V32QI "8") (V16QI "8")
733 (V32HI "16") (V16HI "16") (V8HI "16")
734 (V16SI "32") (V8SI "32") (V4SI "32")
735 (V16SF "32") (V8DF "64")])
737 ;; SSE prefix for integer vector modes
738 (define_mode_attr sseintprefix
739 [(V2DI "p") (V2DF "")
744 (V16SI "p") (V16SF "")
745 (V16QI "p") (V8HI "p")
746 (V32QI "p") (V16HI "p")
747 (V64QI "p") (V32HI "p")])
749 ;; SSE scalar suffix for vector modes
750 (define_mode_attr ssescalarmodesuffix
752 (V8SF "ss") (V4DF "sd")
753 (V4SF "ss") (V2DF "sd")
754 (V8SI "ss") (V4DI "sd")
757 ;; Pack/unpack vector modes
758 (define_mode_attr sseunpackmode
759 [(V16QI "V8HI") (V8HI "V4SI") (V4SI "V2DI")
760 (V32QI "V16HI") (V16HI "V8SI") (V8SI "V4DI")
761 (V32HI "V16SI") (V64QI "V32HI") (V16SI "V8DI")])
763 (define_mode_attr ssepackmode
764 [(V8HI "V16QI") (V4SI "V8HI") (V2DI "V4SI")
765 (V16HI "V32QI") (V8SI "V16HI") (V4DI "V8SI")
766 (V32HI "V64QI") (V16SI "V32HI") (V8DI "V16SI")])
768 ;; Mapping of the max integer size for xop rotate immediate constraint
769 (define_mode_attr sserotatemax
770 [(V16QI "7") (V8HI "15") (V4SI "31") (V2DI "63")])
772 ;; Mapping of mode to cast intrinsic name
773 (define_mode_attr castmode
774 [(V8SI "si") (V8SF "ps") (V4DF "pd")
775 (V16SI "si") (V16SF "ps") (V8DF "pd")])
777 ;; Instruction suffix for sign and zero extensions.
778 (define_code_attr extsuffix [(sign_extend "sx") (zero_extend "zx")])
780 ;; i128 for integer vectors and TARGET_AVX2, f128 otherwise.
781 ;; i64x4 or f64x4 for 512bit modes.
782 (define_mode_attr i128
783 [(V16SF "f64x4") (V8SF "f128") (V8DF "f64x4") (V4DF "f128")
784 (V64QI "i64x4") (V32QI "%~128") (V32HI "i64x4") (V16HI "%~128")
785 (V16SI "i64x4") (V8SI "%~128") (V8DI "i64x4") (V4DI "%~128")])
788 (define_mode_iterator AVX256MODE2P [V8SI V8SF V4DF])
789 (define_mode_iterator AVX512MODE2P [V16SI V16SF V8DF])
791 ;; Mapping for dbpsabbw modes
792 (define_mode_attr dbpsadbwmode
793 [(V32HI "V64QI") (V16HI "V32QI") (V8HI "V16QI")])
795 ;; Mapping suffixes for broadcast
796 (define_mode_attr bcstscalarsuff
797 [(V64QI "b") (V32QI "b") (V16QI "b")
798 (V32HI "w") (V16HI "w") (V8HI "w")
799 (V16SI "d") (V8SI "d") (V4SI "d")
800 (V8DI "q") (V4DI "q") (V2DI "q")
801 (V16SF "ss") (V8SF "ss") (V4SF "ss")
802 (V8DF "sd") (V4DF "sd") (V2DF "sd")])
804 ;; Tie mode of assembler operand to mode iterator
805 (define_mode_attr concat_tg_mode
806 [(V32QI "t") (V16HI "t") (V8SI "t") (V4DI "t") (V8SF "t") (V4DF "t")
807 (V64QI "g") (V32HI "g") (V16SI "g") (V8DI "g") (V16SF "g") (V8DF "g")])
809 ;; Half mask mode for unpacks
810 (define_mode_attr HALFMASKMODE
811 [(DI "SI") (SI "HI")])
813 ;; Double mask mode for packs
814 (define_mode_attr DOUBLEMASKMODE
815 [(HI "SI") (SI "DI")])
818 ;; Include define_subst patterns for instructions with mask
821 ;; Patterns whose name begins with "sse{,2,3}_" are invoked by intrinsics.
823 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
827 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
829 ;; All of these patterns are enabled for SSE1 as well as SSE2.
830 ;; This is essential for maintaining stable calling conventions.
832 (define_expand "mov<mode>"
833 [(set (match_operand:VMOVE 0 "nonimmediate_operand")
834 (match_operand:VMOVE 1 "nonimmediate_operand"))]
837 ix86_expand_vector_move (<MODE>mode, operands);
841 (define_insn "*mov<mode>_internal"
842 [(set (match_operand:VMOVE 0 "nonimmediate_operand" "=v,v ,m")
843 (match_operand:VMOVE 1 "nonimmediate_or_sse_const_operand" "BC,vm,v"))]
845 && (register_operand (operands[0], <MODE>mode)
846 || register_operand (operands[1], <MODE>mode))"
848 int mode = get_attr_mode (insn);
849 switch (which_alternative)
852 return standard_sse_constant_opcode (insn, operands[1]);
855 /* There is no evex-encoded vmov* for sizes smaller than 64-bytes
856 in avx512f, so we need to use workarounds, to access sse registers
857 16-31, which are evex-only. In avx512vl we don't need workarounds. */
858 if (TARGET_AVX512F && <MODE_SIZE> < 64 && !TARGET_AVX512VL
859 && ((REG_P (operands[0]) && EXT_REX_SSE_REGNO_P (REGNO (operands[0])))
860 || (REG_P (operands[1]) && EXT_REX_SSE_REGNO_P (REGNO (operands[1])))))
862 if (memory_operand (operands[0], <MODE>mode))
864 if (<MODE_SIZE> == 32)
865 return "vextract<shuffletype>64x4\t{$0x0, %g1, %0|%0, %g1, 0x0}";
866 else if (<MODE_SIZE> == 16)
867 return "vextract<shuffletype>32x4\t{$0x0, %g1, %0|%0, %g1, 0x0}";
871 else if (memory_operand (operands[1], <MODE>mode))
873 if (<MODE_SIZE> == 32)
874 return "vbroadcast<shuffletype>64x4\t{%1, %g0|%g0, %1}";
875 else if (<MODE_SIZE> == 16)
876 return "vbroadcast<shuffletype>32x4\t{%1, %g0|%g0, %1}";
881 /* Reg -> reg move is always aligned. Just use wider move. */
886 return "vmovaps\t{%g1, %g0|%g0, %g1}";
889 return "vmovapd\t{%g1, %g0|%g0, %g1}";
892 return "vmovdqa64\t{%g1, %g0|%g0, %g1}";
902 if ((TARGET_AVX || TARGET_IAMCU)
903 && (misaligned_operand (operands[0], <MODE>mode)
904 || misaligned_operand (operands[1], <MODE>mode)))
905 return "%vmovups\t{%1, %0|%0, %1}";
907 return "%vmovaps\t{%1, %0|%0, %1}";
912 if ((TARGET_AVX || TARGET_IAMCU)
913 && (misaligned_operand (operands[0], <MODE>mode)
914 || misaligned_operand (operands[1], <MODE>mode)))
915 return "%vmovupd\t{%1, %0|%0, %1}";
917 return "%vmovapd\t{%1, %0|%0, %1}";
921 if ((TARGET_AVX || TARGET_IAMCU)
922 && (misaligned_operand (operands[0], <MODE>mode)
923 || misaligned_operand (operands[1], <MODE>mode)))
924 return TARGET_AVX512VL ? "vmovdqu64\t{%1, %0|%0, %1}"
925 : "%vmovdqu\t{%1, %0|%0, %1}";
927 return TARGET_AVX512VL ? "vmovdqa64\t{%1, %0|%0, %1}"
928 : "%vmovdqa\t{%1, %0|%0, %1}";
930 if (misaligned_operand (operands[0], <MODE>mode)
931 || misaligned_operand (operands[1], <MODE>mode))
932 return "vmovdqu64\t{%1, %0|%0, %1}";
934 return "vmovdqa64\t{%1, %0|%0, %1}";
943 [(set_attr "type" "sselog1,ssemov,ssemov")
944 (set_attr "prefix" "maybe_vex")
946 (cond [(and (match_test "<MODE_SIZE> == 16")
947 (ior (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
948 (and (eq_attr "alternative" "2")
949 (match_test "TARGET_SSE_TYPELESS_STORES"))))
950 (const_string "<ssePSmode>")
951 (match_test "TARGET_AVX")
952 (const_string "<sseinsnmode>")
953 (ior (not (match_test "TARGET_SSE2"))
954 (match_test "optimize_function_for_size_p (cfun)"))
955 (const_string "V4SF")
956 (and (eq_attr "alternative" "0")
957 (match_test "TARGET_SSE_LOAD0_BY_PXOR"))
960 (const_string "<sseinsnmode>")))])
962 (define_insn "<avx512>_load<mode>_mask"
963 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v,v")
964 (vec_merge:V48_AVX512VL
965 (match_operand:V48_AVX512VL 1 "nonimmediate_operand" "v,m")
966 (match_operand:V48_AVX512VL 2 "vector_move_operand" "0C,0C")
967 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
970 if (FLOAT_MODE_P (GET_MODE_INNER (<MODE>mode)))
972 if (misaligned_operand (operands[1], <MODE>mode))
973 return "vmovu<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
975 return "vmova<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
979 if (misaligned_operand (operands[1], <MODE>mode))
980 return "vmovdqu<ssescalarsize>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
982 return "vmovdqa<ssescalarsize>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
985 [(set_attr "type" "ssemov")
986 (set_attr "prefix" "evex")
987 (set_attr "memory" "none,load")
988 (set_attr "mode" "<sseinsnmode>")])
990 (define_insn "<avx512>_load<mode>_mask"
991 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v,v")
992 (vec_merge:VI12_AVX512VL
993 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "v,m")
994 (match_operand:VI12_AVX512VL 2 "vector_move_operand" "0C,0C")
995 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
997 "vmovdqu<ssescalarsize>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
998 [(set_attr "type" "ssemov")
999 (set_attr "prefix" "evex")
1000 (set_attr "memory" "none,load")
1001 (set_attr "mode" "<sseinsnmode>")])
1003 (define_insn "<avx512>_blendm<mode>"
1004 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v")
1005 (vec_merge:V48_AVX512VL
1006 (match_operand:V48_AVX512VL 2 "nonimmediate_operand" "vm")
1007 (match_operand:V48_AVX512VL 1 "register_operand" "v")
1008 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
1010 "vblendm<ssemodesuffix>\t{%2, %1, %0%{%3%}|%0%{%3%}, %1, %2}"
1011 [(set_attr "type" "ssemov")
1012 (set_attr "prefix" "evex")
1013 (set_attr "mode" "<sseinsnmode>")])
1015 (define_insn "<avx512>_blendm<mode>"
1016 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
1017 (vec_merge:VI12_AVX512VL
1018 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")
1019 (match_operand:VI12_AVX512VL 1 "register_operand" "v")
1020 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
1022 "vpblendm<ssemodesuffix>\t{%2, %1, %0%{%3%}|%0%{%3%}, %1, %2}"
1023 [(set_attr "type" "ssemov")
1024 (set_attr "prefix" "evex")
1025 (set_attr "mode" "<sseinsnmode>")])
1027 (define_insn "<avx512>_store<mode>_mask"
1028 [(set (match_operand:V48_AVX512VL 0 "memory_operand" "=m")
1029 (vec_merge:V48_AVX512VL
1030 (match_operand:V48_AVX512VL 1 "register_operand" "v")
1032 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")))]
1035 if (FLOAT_MODE_P (GET_MODE_INNER (<MODE>mode)))
1037 if (misaligned_operand (operands[0], <MODE>mode))
1038 return "vmovu<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1040 return "vmova<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1044 if (misaligned_operand (operands[0], <MODE>mode))
1045 return "vmovdqu<ssescalarsize>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1047 return "vmovdqa<ssescalarsize>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1050 [(set_attr "type" "ssemov")
1051 (set_attr "prefix" "evex")
1052 (set_attr "memory" "store")
1053 (set_attr "mode" "<sseinsnmode>")])
1055 (define_insn "<avx512>_store<mode>_mask"
1056 [(set (match_operand:VI12_AVX512VL 0 "memory_operand" "=m")
1057 (vec_merge:VI12_AVX512VL
1058 (match_operand:VI12_AVX512VL 1 "register_operand" "v")
1060 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")))]
1062 "vmovdqu<ssescalarsize>\t{%1, %0%{%2%}|%0%{%2%}, %1}"
1063 [(set_attr "type" "ssemov")
1064 (set_attr "prefix" "evex")
1065 (set_attr "memory" "store")
1066 (set_attr "mode" "<sseinsnmode>")])
1068 (define_insn "sse2_movq128"
1069 [(set (match_operand:V2DI 0 "register_operand" "=x")
1072 (match_operand:V2DI 1 "nonimmediate_operand" "xm")
1073 (parallel [(const_int 0)]))
1076 "%vmovq\t{%1, %0|%0, %q1}"
1077 [(set_attr "type" "ssemov")
1078 (set_attr "prefix" "maybe_vex")
1079 (set_attr "mode" "TI")])
1081 ;; Move a DI from a 32-bit register pair (e.g. %edx:%eax) to an xmm.
1082 ;; We'd rather avoid this entirely; if the 32-bit reg pair was loaded
1083 ;; from memory, we'd prefer to load the memory directly into the %xmm
1084 ;; register. To facilitate this happy circumstance, this pattern won't
1085 ;; split until after register allocation. If the 64-bit value didn't
1086 ;; come from memory, this is the best we can do. This is much better
1087 ;; than storing %edx:%eax into a stack temporary and loading an %xmm
1090 (define_insn_and_split "movdi_to_sse"
1092 [(set (match_operand:V4SI 0 "register_operand" "=?x,x")
1093 (subreg:V4SI (match_operand:DI 1 "nonimmediate_operand" "r,m") 0))
1094 (clobber (match_scratch:V4SI 2 "=&x,X"))])]
1095 "!TARGET_64BIT && TARGET_SSE2 && TARGET_INTER_UNIT_MOVES_TO_VEC"
1097 "&& reload_completed"
1100 if (register_operand (operands[1], DImode))
1102 /* The DImode arrived in a pair of integral registers (e.g. %edx:%eax).
1103 Assemble the 64-bit DImode value in an xmm register. */
1104 emit_insn (gen_sse2_loadld (operands[0], CONST0_RTX (V4SImode),
1105 gen_lowpart (SImode, operands[1])));
1106 emit_insn (gen_sse2_loadld (operands[2], CONST0_RTX (V4SImode),
1107 gen_highpart (SImode, operands[1])));
1108 emit_insn (gen_vec_interleave_lowv4si (operands[0], operands[0],
1111 else if (memory_operand (operands[1], DImode))
1113 rtx tmp = gen_reg_rtx (V2DImode);
1114 emit_insn (gen_vec_concatv2di (tmp, operands[1], const0_rtx));
1115 emit_move_insn (operands[0], gen_lowpart (V4SImode, tmp));
1122 [(set (match_operand:V4SF 0 "register_operand")
1123 (match_operand:V4SF 1 "zero_extended_scalar_load_operand"))]
1124 "TARGET_SSE && reload_completed"
1127 (vec_duplicate:V4SF (match_dup 1))
1131 operands[1] = simplify_gen_subreg (SFmode, operands[1], V4SFmode, 0);
1132 operands[2] = CONST0_RTX (V4SFmode);
1136 [(set (match_operand:V2DF 0 "register_operand")
1137 (match_operand:V2DF 1 "zero_extended_scalar_load_operand"))]
1138 "TARGET_SSE2 && reload_completed"
1139 [(set (match_dup 0) (vec_concat:V2DF (match_dup 1) (match_dup 2)))]
1141 operands[1] = simplify_gen_subreg (DFmode, operands[1], V2DFmode, 0);
1142 operands[2] = CONST0_RTX (DFmode);
1145 (define_expand "movmisalign<mode>"
1146 [(set (match_operand:VMOVE 0 "nonimmediate_operand")
1147 (match_operand:VMOVE 1 "nonimmediate_operand"))]
1150 ix86_expand_vector_move_misalign (<MODE>mode, operands);
1154 (define_expand "<sse>_loadu<ssemodesuffix><avxsizesuffix><mask_name>"
1155 [(set (match_operand:VF 0 "register_operand")
1156 (unspec:VF [(match_operand:VF 1 "nonimmediate_operand")]
1158 "TARGET_SSE && <mask_mode512bit_condition>"
1160 /* For AVX, normal *mov<mode>_internal pattern will handle unaligned loads
1161 just fine if misaligned_operand is true, and without the UNSPEC it can
1162 be combined with arithmetic instructions. If misaligned_operand is
1163 false, still emit UNSPEC_LOADU insn to honor user's request for
1166 && misaligned_operand (operands[1], <MODE>mode))
1168 rtx src = operands[1];
1170 src = gen_rtx_VEC_MERGE (<MODE>mode, operands[1],
1171 operands[2 * <mask_applied>],
1172 operands[3 * <mask_applied>]);
1173 emit_insn (gen_rtx_SET (operands[0], src));
1178 (define_insn "*<sse>_loadu<ssemodesuffix><avxsizesuffix><mask_name>"
1179 [(set (match_operand:VF 0 "register_operand" "=v")
1181 [(match_operand:VF 1 "nonimmediate_operand" "vm")]
1183 "TARGET_SSE && <mask_mode512bit_condition>"
1185 switch (get_attr_mode (insn))
1190 return "%vmovups\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}";
1192 return "%vmovu<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}";
1195 [(set_attr "type" "ssemov")
1196 (set_attr "movu" "1")
1197 (set_attr "ssememalign" "8")
1198 (set_attr "prefix" "maybe_vex")
1200 (cond [(and (match_test "<MODE_SIZE> == 16")
1201 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
1202 (const_string "<ssePSmode>")
1203 (match_test "TARGET_AVX")
1204 (const_string "<MODE>")
1205 (match_test "optimize_function_for_size_p (cfun)")
1206 (const_string "V4SF")
1208 (const_string "<MODE>")))])
1210 ;; Merge movsd/movhpd to movupd for TARGET_SSE_UNALIGNED_LOAD_OPTIMAL targets.
1212 [(set (match_operand:V2DF 0 "register_operand")
1213 (vec_concat:V2DF (match_operand:DF 1 "memory_operand")
1214 (match_operand:DF 4 "const0_operand")))
1215 (set (match_operand:V2DF 2 "register_operand")
1216 (vec_concat:V2DF (vec_select:DF (match_dup 2)
1217 (parallel [(const_int 0)]))
1218 (match_operand:DF 3 "memory_operand")))]
1219 "TARGET_SSE2 && TARGET_SSE_UNALIGNED_LOAD_OPTIMAL
1220 && ix86_operands_ok_for_move_multiple (operands, true, DFmode)"
1222 (unspec:V2DF [(match_dup 4)] UNSPEC_LOADU))]
1223 "operands[4] = adjust_address (operands[1], V2DFmode, 0);")
1225 (define_insn "<sse>_storeu<ssemodesuffix><avxsizesuffix>"
1226 [(set (match_operand:VF 0 "memory_operand" "=m")
1228 [(match_operand:VF 1 "register_operand" "v")]
1232 switch (get_attr_mode (insn))
1237 return "%vmovups\t{%1, %0|%0, %1}";
1239 return "%vmovu<ssemodesuffix>\t{%1, %0|%0, %1}";
1242 [(set_attr "type" "ssemov")
1243 (set_attr "movu" "1")
1244 (set_attr "ssememalign" "8")
1245 (set_attr "prefix" "maybe_vex")
1247 (cond [(and (match_test "<MODE_SIZE> == 16")
1248 (ior (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
1249 (match_test "TARGET_SSE_TYPELESS_STORES")))
1250 (const_string "<ssePSmode>")
1251 (match_test "TARGET_AVX")
1252 (const_string "<MODE>")
1253 (match_test "optimize_function_for_size_p (cfun)")
1254 (const_string "V4SF")
1256 (const_string "<MODE>")))])
1258 (define_insn "<avx512>_storeu<ssemodesuffix><avxsizesuffix>_mask"
1259 [(set (match_operand:VF_AVX512VL 0 "memory_operand" "=m")
1260 (vec_merge:VF_AVX512VL
1262 [(match_operand:VF_AVX512VL 1 "register_operand" "v")]
1265 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")))]
1268 switch (get_attr_mode (insn))
1273 return "vmovups\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1275 return "vmovu<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1278 [(set_attr "type" "ssemov")
1279 (set_attr "movu" "1")
1280 (set_attr "memory" "store")
1281 (set_attr "prefix" "evex")
1282 (set_attr "mode" "<sseinsnmode>")])
1284 ;; Merge movlpd/movhpd to movupd for TARGET_SSE_UNALIGNED_STORE_OPTIMAL targets.
1286 [(set (match_operand:DF 0 "memory_operand")
1287 (vec_select:DF (match_operand:V2DF 1 "register_operand")
1288 (parallel [(const_int 0)])))
1289 (set (match_operand:DF 2 "memory_operand")
1290 (vec_select:DF (match_operand:V2DF 3 "register_operand")
1291 (parallel [(const_int 1)])))]
1292 "TARGET_SSE2 && TARGET_SSE_UNALIGNED_STORE_OPTIMAL
1293 && ix86_operands_ok_for_move_multiple (operands, false, DFmode)"
1295 (unspec:V2DF [(match_dup 1)] UNSPEC_STOREU))]
1296 "operands[4] = adjust_address (operands[0], V2DFmode, 0);")
1298 /* For AVX, normal *mov<mode>_internal pattern will handle unaligned loads
1299 just fine if misaligned_operand is true, and without the UNSPEC it can
1300 be combined with arithmetic instructions. If misaligned_operand is
1301 false, still emit UNSPEC_LOADU insn to honor user's request for
1303 (define_expand "<sse2_avx_avx512f>_loaddqu<mode><mask_name>"
1304 [(set (match_operand:VI1 0 "register_operand")
1306 [(match_operand:VI1 1 "nonimmediate_operand")]
1308 "TARGET_SSE2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
1311 && misaligned_operand (operands[1], <MODE>mode))
1313 rtx src = operands[1];
1315 src = gen_rtx_VEC_MERGE (<MODE>mode, operands[1],
1316 operands[2 * <mask_applied>],
1317 operands[3 * <mask_applied>]);
1318 emit_insn (gen_rtx_SET (operands[0], src));
1323 (define_expand "<sse2_avx_avx512f>_loaddqu<mode><mask_name>"
1324 [(set (match_operand:VI_ULOADSTORE_BW_AVX512VL 0 "register_operand")
1325 (unspec:VI_ULOADSTORE_BW_AVX512VL
1326 [(match_operand:VI_ULOADSTORE_BW_AVX512VL 1 "nonimmediate_operand")]
1330 if (misaligned_operand (operands[1], <MODE>mode))
1332 rtx src = operands[1];
1334 src = gen_rtx_VEC_MERGE (<MODE>mode, operands[1],
1335 operands[2 * <mask_applied>],
1336 operands[3 * <mask_applied>]);
1337 emit_insn (gen_rtx_SET (operands[0], src));
1342 (define_expand "<sse2_avx_avx512f>_loaddqu<mode><mask_name>"
1343 [(set (match_operand:VI_ULOADSTORE_F_AVX512VL 0 "register_operand")
1344 (unspec:VI_ULOADSTORE_F_AVX512VL
1345 [(match_operand:VI_ULOADSTORE_F_AVX512VL 1 "nonimmediate_operand")]
1349 if (misaligned_operand (operands[1], <MODE>mode))
1351 rtx src = operands[1];
1353 src = gen_rtx_VEC_MERGE (<MODE>mode, operands[1],
1354 operands[2 * <mask_applied>],
1355 operands[3 * <mask_applied>]);
1356 emit_insn (gen_rtx_SET (operands[0], src));
1361 (define_insn "*<sse2_avx_avx512f>_loaddqu<mode><mask_name>"
1362 [(set (match_operand:VI1 0 "register_operand" "=v")
1364 [(match_operand:VI1 1 "nonimmediate_operand" "vm")]
1366 "TARGET_SSE2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
1368 switch (get_attr_mode (insn))
1372 return "%vmovups\t{%1, %0|%0, %1}";
1374 if (!(TARGET_AVX512VL && TARGET_AVX512BW))
1375 return "%vmovdqu\t{%1, %0|%0, %1}";
1377 return "vmovdqu<ssescalarsize>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}";
1380 [(set_attr "type" "ssemov")
1381 (set_attr "movu" "1")
1382 (set_attr "ssememalign" "8")
1383 (set (attr "prefix_data16")
1385 (match_test "TARGET_AVX")
1387 (const_string "1")))
1388 (set_attr "prefix" "maybe_vex")
1390 (cond [(and (match_test "<MODE_SIZE> == 16")
1391 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
1392 (const_string "<ssePSmode>")
1393 (match_test "TARGET_AVX")
1394 (const_string "<sseinsnmode>")
1395 (match_test "optimize_function_for_size_p (cfun)")
1396 (const_string "V4SF")
1398 (const_string "<sseinsnmode>")))])
1400 (define_insn "*<sse2_avx_avx512f>_loaddqu<mode><mask_name>"
1401 [(set (match_operand:VI_ULOADSTORE_BW_AVX512VL 0 "register_operand" "=v")
1402 (unspec:VI_ULOADSTORE_BW_AVX512VL
1403 [(match_operand:VI_ULOADSTORE_BW_AVX512VL 1 "nonimmediate_operand" "vm")]
1406 "vmovdqu<ssescalarsize>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}";
1407 [(set_attr "type" "ssemov")
1408 (set_attr "movu" "1")
1409 (set_attr "ssememalign" "8")
1410 (set_attr "prefix" "maybe_evex")])
1412 (define_insn "*<sse2_avx_avx512f>_loaddqu<mode><mask_name>"
1413 [(set (match_operand:VI_ULOADSTORE_F_AVX512VL 0 "register_operand" "=v")
1414 (unspec:VI_ULOADSTORE_F_AVX512VL
1415 [(match_operand:VI_ULOADSTORE_F_AVX512VL 1 "nonimmediate_operand" "vm")]
1418 "vmovdqu<ssescalarsize>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}";
1419 [(set_attr "type" "ssemov")
1420 (set_attr "movu" "1")
1421 (set_attr "ssememalign" "8")
1422 (set_attr "prefix" "maybe_evex")])
1424 (define_insn "<sse2_avx_avx512f>_storedqu<mode>"
1425 [(set (match_operand:VI1 0 "memory_operand" "=m")
1427 [(match_operand:VI1 1 "register_operand" "v")]
1431 switch (get_attr_mode (insn))
1436 return "%vmovups\t{%1, %0|%0, %1}";
1442 if (!(TARGET_AVX512VL && TARGET_AVX512BW))
1443 return "%vmovdqu\t{%1, %0|%0, %1}";
1445 return "vmovdqu<ssescalarsize>\t{%1, %0|%0, %1}";
1449 [(set_attr "type" "ssemov")
1450 (set_attr "movu" "1")
1451 (set_attr "ssememalign" "8")
1452 (set (attr "prefix_data16")
1454 (match_test "TARGET_AVX")
1456 (const_string "1")))
1457 (set_attr "prefix" "maybe_vex")
1459 (cond [(and (match_test "<MODE_SIZE> == 16")
1460 (ior (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
1461 (match_test "TARGET_SSE_TYPELESS_STORES")))
1462 (const_string "<ssePSmode>")
1463 (match_test "TARGET_AVX")
1464 (const_string "<sseinsnmode>")
1465 (match_test "optimize_function_for_size_p (cfun)")
1466 (const_string "V4SF")
1468 (const_string "<sseinsnmode>")))])
1470 (define_insn "<sse2_avx_avx512f>_storedqu<mode>"
1471 [(set (match_operand:VI_ULOADSTORE_BW_AVX512VL 0 "memory_operand" "=m")
1472 (unspec:VI_ULOADSTORE_BW_AVX512VL
1473 [(match_operand:VI_ULOADSTORE_BW_AVX512VL 1 "register_operand" "v")]
1476 "vmovdqu<ssescalarsize>\t{%1, %0|%0, %1}"
1477 [(set_attr "type" "ssemov")
1478 (set_attr "movu" "1")
1479 (set_attr "ssememalign" "8")
1480 (set_attr "prefix" "maybe_evex")])
1482 (define_insn "<sse2_avx_avx512f>_storedqu<mode>"
1483 [(set (match_operand:VI_ULOADSTORE_F_AVX512VL 0 "memory_operand" "=m")
1484 (unspec:VI_ULOADSTORE_F_AVX512VL
1485 [(match_operand:VI_ULOADSTORE_F_AVX512VL 1 "register_operand" "v")]
1488 "vmovdqu<ssescalarsize>\t{%1, %0|%0, %1}"
1489 [(set_attr "type" "ssemov")
1490 (set_attr "movu" "1")
1491 (set_attr "ssememalign" "8")
1492 (set_attr "prefix" "maybe_vex")])
1494 (define_insn "<avx512>_storedqu<mode>_mask"
1495 [(set (match_operand:VI48_AVX512VL 0 "memory_operand" "=m")
1496 (vec_merge:VI48_AVX512VL
1497 (unspec:VI48_AVX512VL
1498 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")]
1501 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")))]
1503 "vmovdqu<ssescalarsize>\t{%1, %0%{%2%}|%0%{%2%}, %1}"
1504 [(set_attr "type" "ssemov")
1505 (set_attr "movu" "1")
1506 (set_attr "memory" "store")
1507 (set_attr "prefix" "evex")
1508 (set_attr "mode" "<sseinsnmode>")])
1510 (define_insn "<avx512>_storedqu<mode>_mask"
1511 [(set (match_operand:VI12_AVX512VL 0 "memory_operand" "=m")
1512 (vec_merge:VI12_AVX512VL
1513 (unspec:VI12_AVX512VL
1514 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")]
1517 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")))]
1519 "vmovdqu<ssescalarsize>\t{%1, %0%{%2%}|%0%{%2%}, %1}"
1520 [(set_attr "type" "ssemov")
1521 (set_attr "movu" "1")
1522 (set_attr "memory" "store")
1523 (set_attr "prefix" "evex")
1524 (set_attr "mode" "<sseinsnmode>")])
1526 (define_insn "<sse3>_lddqu<avxsizesuffix>"
1527 [(set (match_operand:VI1 0 "register_operand" "=x")
1528 (unspec:VI1 [(match_operand:VI1 1 "memory_operand" "m")]
1531 "%vlddqu\t{%1, %0|%0, %1}"
1532 [(set_attr "type" "ssemov")
1533 (set_attr "movu" "1")
1534 (set_attr "ssememalign" "8")
1535 (set (attr "prefix_data16")
1537 (match_test "TARGET_AVX")
1539 (const_string "0")))
1540 (set (attr "prefix_rep")
1542 (match_test "TARGET_AVX")
1544 (const_string "1")))
1545 (set_attr "prefix" "maybe_vex")
1546 (set_attr "mode" "<sseinsnmode>")])
1548 (define_insn "sse2_movnti<mode>"
1549 [(set (match_operand:SWI48 0 "memory_operand" "=m")
1550 (unspec:SWI48 [(match_operand:SWI48 1 "register_operand" "r")]
1553 "movnti\t{%1, %0|%0, %1}"
1554 [(set_attr "type" "ssemov")
1555 (set_attr "prefix_data16" "0")
1556 (set_attr "mode" "<MODE>")])
1558 (define_insn "<sse>_movnt<mode>"
1559 [(set (match_operand:VF 0 "memory_operand" "=m")
1561 [(match_operand:VF 1 "register_operand" "v")]
1564 "%vmovnt<ssemodesuffix>\t{%1, %0|%0, %1}"
1565 [(set_attr "type" "ssemov")
1566 (set_attr "prefix" "maybe_vex")
1567 (set_attr "mode" "<MODE>")])
1569 (define_insn "<sse2>_movnt<mode>"
1570 [(set (match_operand:VI8 0 "memory_operand" "=m")
1571 (unspec:VI8 [(match_operand:VI8 1 "register_operand" "v")]
1574 "%vmovntdq\t{%1, %0|%0, %1}"
1575 [(set_attr "type" "ssecvt")
1576 (set (attr "prefix_data16")
1578 (match_test "TARGET_AVX")
1580 (const_string "1")))
1581 (set_attr "prefix" "maybe_vex")
1582 (set_attr "mode" "<sseinsnmode>")])
1584 ; Expand patterns for non-temporal stores. At the moment, only those
1585 ; that directly map to insns are defined; it would be possible to
1586 ; define patterns for other modes that would expand to several insns.
1588 ;; Modes handled by storent patterns.
1589 (define_mode_iterator STORENT_MODE
1590 [(DI "TARGET_SSE2 && TARGET_64BIT") (SI "TARGET_SSE2")
1591 (SF "TARGET_SSE4A") (DF "TARGET_SSE4A")
1592 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") (V2DI "TARGET_SSE2")
1593 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
1594 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
1596 (define_expand "storent<mode>"
1597 [(set (match_operand:STORENT_MODE 0 "memory_operand")
1598 (unspec:STORENT_MODE
1599 [(match_operand:STORENT_MODE 1 "register_operand")]
1603 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1605 ;; Parallel floating point arithmetic
1607 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1609 (define_expand "<code><mode>2"
1610 [(set (match_operand:VF 0 "register_operand")
1612 (match_operand:VF 1 "register_operand")))]
1614 "ix86_expand_fp_absneg_operator (<CODE>, <MODE>mode, operands); DONE;")
1616 (define_insn_and_split "*absneg<mode>2"
1617 [(set (match_operand:VF 0 "register_operand" "=x,x,v,v")
1618 (match_operator:VF 3 "absneg_operator"
1619 [(match_operand:VF 1 "vector_operand" "0, xBm,v, m")]))
1620 (use (match_operand:VF 2 "vector_operand" "xBm,0, vm,v"))]
1623 "&& reload_completed"
1626 enum rtx_code absneg_op;
1632 if (MEM_P (operands[1]))
1633 op1 = operands[2], op2 = operands[1];
1635 op1 = operands[1], op2 = operands[2];
1640 if (rtx_equal_p (operands[0], operands[1]))
1646 absneg_op = GET_CODE (operands[3]) == NEG ? XOR : AND;
1647 t = gen_rtx_fmt_ee (absneg_op, <MODE>mode, op1, op2);
1648 t = gen_rtx_SET (operands[0], t);
1652 [(set_attr "isa" "noavx,noavx,avx,avx")])
1654 (define_expand "<plusminus_insn><mode>3<mask_name><round_name>"
1655 [(set (match_operand:VF 0 "register_operand")
1657 (match_operand:VF 1 "<round_nimm_predicate>")
1658 (match_operand:VF 2 "<round_nimm_predicate>")))]
1659 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1660 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
1662 (define_insn "*<plusminus_insn><mode>3<mask_name><round_name>"
1663 [(set (match_operand:VF 0 "register_operand" "=x,v")
1665 (match_operand:VF 1 "<round_nimm_predicate>" "<comm>0,v")
1666 (match_operand:VF 2 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
1667 "TARGET_SSE && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands) && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1669 <plusminus_mnemonic><ssemodesuffix>\t{%2, %0|%0, %2}
1670 v<plusminus_mnemonic><ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
1671 [(set_attr "isa" "noavx,avx")
1672 (set_attr "type" "sseadd")
1673 (set_attr "prefix" "<mask_prefix3>")
1674 (set_attr "mode" "<MODE>")])
1676 (define_insn "<sse>_vm<plusminus_insn><mode>3<round_name>"
1677 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
1680 (match_operand:VF_128 1 "register_operand" "0,v")
1681 (match_operand:VF_128 2 "vector_operand" "xBm,<round_constraint>"))
1686 <plusminus_mnemonic><ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
1687 v<plusminus_mnemonic><ssescalarmodesuffix>\t{<round_op3>%2, %1, %0|%0, %1, %<iptr>2<round_op3>}"
1688 [(set_attr "isa" "noavx,avx")
1689 (set_attr "type" "sseadd")
1690 (set_attr "prefix" "<round_prefix>")
1691 (set_attr "mode" "<ssescalarmode>")])
1693 (define_expand "mul<mode>3<mask_name><round_name>"
1694 [(set (match_operand:VF 0 "register_operand")
1696 (match_operand:VF 1 "<round_nimm_predicate>")
1697 (match_operand:VF 2 "<round_nimm_predicate>")))]
1698 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1699 "ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);")
1701 (define_insn "*mul<mode>3<mask_name><round_name>"
1702 [(set (match_operand:VF 0 "register_operand" "=x,v")
1704 (match_operand:VF 1 "<round_nimm_predicate>" "%0,v")
1705 (match_operand:VF 2 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
1706 "TARGET_SSE && ix86_binary_operator_ok (MULT, <MODE>mode, operands) && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1708 mul<ssemodesuffix>\t{%2, %0|%0, %2}
1709 vmul<ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
1710 [(set_attr "isa" "noavx,avx")
1711 (set_attr "type" "ssemul")
1712 (set_attr "prefix" "<mask_prefix3>")
1713 (set_attr "btver2_decode" "direct,double")
1714 (set_attr "mode" "<MODE>")])
1716 (define_insn "<sse>_vm<multdiv_mnemonic><mode>3<round_name>"
1717 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
1720 (match_operand:VF_128 1 "register_operand" "0,v")
1721 (match_operand:VF_128 2 "vector_operand" "xBm,<round_constraint>"))
1726 <multdiv_mnemonic><ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
1727 v<multdiv_mnemonic><ssescalarmodesuffix>\t{<round_op3>%2, %1, %0|%0, %1, %<iptr>2<round_op3>}"
1728 [(set_attr "isa" "noavx,avx")
1729 (set_attr "type" "sse<multdiv_mnemonic>")
1730 (set_attr "prefix" "<round_prefix>")
1731 (set_attr "btver2_decode" "direct,double")
1732 (set_attr "mode" "<ssescalarmode>")])
1734 (define_expand "div<mode>3"
1735 [(set (match_operand:VF2 0 "register_operand")
1736 (div:VF2 (match_operand:VF2 1 "register_operand")
1737 (match_operand:VF2 2 "vector_operand")))]
1739 "ix86_fixup_binary_operands_no_copy (DIV, <MODE>mode, operands);")
1741 (define_expand "div<mode>3"
1742 [(set (match_operand:VF1 0 "register_operand")
1743 (div:VF1 (match_operand:VF1 1 "register_operand")
1744 (match_operand:VF1 2 "vector_operand")))]
1747 ix86_fixup_binary_operands_no_copy (DIV, <MODE>mode, operands);
1750 && TARGET_RECIP_VEC_DIV
1751 && !optimize_insn_for_size_p ()
1752 && flag_finite_math_only && !flag_trapping_math
1753 && flag_unsafe_math_optimizations)
1755 ix86_emit_swdivsf (operands[0], operands[1], operands[2], <MODE>mode);
1760 (define_insn "<sse>_div<mode>3<mask_name><round_name>"
1761 [(set (match_operand:VF 0 "register_operand" "=x,v")
1763 (match_operand:VF 1 "register_operand" "0,v")
1764 (match_operand:VF 2 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
1765 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1767 div<ssemodesuffix>\t{%2, %0|%0, %2}
1768 vdiv<ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
1769 [(set_attr "isa" "noavx,avx")
1770 (set_attr "type" "ssediv")
1771 (set_attr "prefix" "<mask_prefix3>")
1772 (set_attr "mode" "<MODE>")])
1774 (define_insn "<sse>_rcp<mode>2"
1775 [(set (match_operand:VF1_128_256 0 "register_operand" "=x")
1777 [(match_operand:VF1_128_256 1 "vector_operand" "xBm")] UNSPEC_RCP))]
1779 "%vrcpps\t{%1, %0|%0, %1}"
1780 [(set_attr "type" "sse")
1781 (set_attr "atom_sse_attr" "rcp")
1782 (set_attr "btver2_sse_attr" "rcp")
1783 (set_attr "prefix" "maybe_vex")
1784 (set_attr "mode" "<MODE>")])
1786 (define_insn "sse_vmrcpv4sf2"
1787 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
1789 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm,xm")]
1791 (match_operand:V4SF 2 "register_operand" "0,x")
1795 rcpss\t{%1, %0|%0, %k1}
1796 vrcpss\t{%1, %2, %0|%0, %2, %k1}"
1797 [(set_attr "isa" "noavx,avx")
1798 (set_attr "type" "sse")
1799 (set_attr "ssememalign" "32")
1800 (set_attr "atom_sse_attr" "rcp")
1801 (set_attr "btver2_sse_attr" "rcp")
1802 (set_attr "prefix" "orig,vex")
1803 (set_attr "mode" "SF")])
1805 (define_insn "<mask_codefor>rcp14<mode><mask_name>"
1806 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
1808 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "vm")]
1811 "vrcp14<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
1812 [(set_attr "type" "sse")
1813 (set_attr "prefix" "evex")
1814 (set_attr "mode" "<MODE>")])
1816 (define_insn "srcp14<mode>"
1817 [(set (match_operand:VF_128 0 "register_operand" "=v")
1820 [(match_operand:VF_128 1 "nonimmediate_operand" "vm")]
1822 (match_operand:VF_128 2 "register_operand" "v")
1825 "vrcp14<ssescalarmodesuffix>\t{%1, %2, %0|%0, %2, %1}"
1826 [(set_attr "type" "sse")
1827 (set_attr "prefix" "evex")
1828 (set_attr "mode" "<MODE>")])
1830 (define_expand "sqrt<mode>2"
1831 [(set (match_operand:VF2 0 "register_operand")
1832 (sqrt:VF2 (match_operand:VF2 1 "vector_operand")))]
1835 (define_expand "sqrt<mode>2"
1836 [(set (match_operand:VF1 0 "register_operand")
1837 (sqrt:VF1 (match_operand:VF1 1 "vector_operand")))]
1841 && TARGET_RECIP_VEC_SQRT
1842 && !optimize_insn_for_size_p ()
1843 && flag_finite_math_only && !flag_trapping_math
1844 && flag_unsafe_math_optimizations)
1846 ix86_emit_swsqrtsf (operands[0], operands[1], <MODE>mode, false);
1851 (define_insn "<sse>_sqrt<mode>2<mask_name><round_name>"
1852 [(set (match_operand:VF 0 "register_operand" "=x,v")
1853 (sqrt:VF (match_operand:VF 1 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
1854 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1856 sqrt<ssemodesuffix>\t{%1, %0|%0, %1}
1857 vsqrt<ssemodesuffix>\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
1858 [(set_attr "isa" "noavx,avx")
1859 (set_attr "type" "sse")
1860 (set_attr "atom_sse_attr" "sqrt")
1861 (set_attr "btver2_sse_attr" "sqrt")
1862 (set_attr "prefix" "maybe_vex")
1863 (set_attr "mode" "<MODE>")])
1865 (define_insn "<sse>_vmsqrt<mode>2<round_name>"
1866 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
1869 (match_operand:VF_128 1 "vector_operand" "xBm,<round_constraint>"))
1870 (match_operand:VF_128 2 "register_operand" "0,v")
1874 sqrt<ssescalarmodesuffix>\t{%1, %0|%0, %<iptr>1}
1875 vsqrt<ssescalarmodesuffix>\t{<round_op3>%1, %2, %0|%0, %2, %<iptr>1<round_op3>}"
1876 [(set_attr "isa" "noavx,avx")
1877 (set_attr "type" "sse")
1878 (set_attr "atom_sse_attr" "sqrt")
1879 (set_attr "prefix" "<round_prefix>")
1880 (set_attr "btver2_sse_attr" "sqrt")
1881 (set_attr "mode" "<ssescalarmode>")])
1883 (define_expand "rsqrt<mode>2"
1884 [(set (match_operand:VF1_128_256 0 "register_operand")
1886 [(match_operand:VF1_128_256 1 "vector_operand")] UNSPEC_RSQRT))]
1889 ix86_emit_swsqrtsf (operands[0], operands[1], <MODE>mode, true);
1893 (define_insn "<sse>_rsqrt<mode>2"
1894 [(set (match_operand:VF1_128_256 0 "register_operand" "=x")
1896 [(match_operand:VF1_128_256 1 "vector_operand" "xBm")] UNSPEC_RSQRT))]
1898 "%vrsqrtps\t{%1, %0|%0, %1}"
1899 [(set_attr "type" "sse")
1900 (set_attr "prefix" "maybe_vex")
1901 (set_attr "mode" "<MODE>")])
1903 (define_insn "<mask_codefor>rsqrt14<mode><mask_name>"
1904 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
1906 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "vm")]
1909 "vrsqrt14<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
1910 [(set_attr "type" "sse")
1911 (set_attr "prefix" "evex")
1912 (set_attr "mode" "<MODE>")])
1914 (define_insn "rsqrt14<mode>"
1915 [(set (match_operand:VF_128 0 "register_operand" "=v")
1918 [(match_operand:VF_128 1 "nonimmediate_operand" "vm")]
1920 (match_operand:VF_128 2 "register_operand" "v")
1923 "vrsqrt14<ssescalarmodesuffix>\t{%1, %2, %0|%0, %2, %1}"
1924 [(set_attr "type" "sse")
1925 (set_attr "prefix" "evex")
1926 (set_attr "mode" "<MODE>")])
1928 (define_insn "sse_vmrsqrtv4sf2"
1929 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
1931 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm,xm")]
1933 (match_operand:V4SF 2 "register_operand" "0,x")
1937 rsqrtss\t{%1, %0|%0, %k1}
1938 vrsqrtss\t{%1, %2, %0|%0, %2, %k1}"
1939 [(set_attr "isa" "noavx,avx")
1940 (set_attr "type" "sse")
1941 (set_attr "ssememalign" "32")
1942 (set_attr "prefix" "orig,vex")
1943 (set_attr "mode" "SF")])
1945 ;; ??? For !flag_finite_math_only, the representation with SMIN/SMAX
1946 ;; isn't really correct, as those rtl operators aren't defined when
1947 ;; applied to NaNs. Hopefully the optimizers won't get too smart on us.
1949 (define_expand "<code><mode>3<mask_name><round_saeonly_name>"
1950 [(set (match_operand:VF 0 "register_operand")
1952 (match_operand:VF 1 "<round_saeonly_nimm_predicate>")
1953 (match_operand:VF 2 "<round_saeonly_nimm_predicate>")))]
1954 "TARGET_SSE && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
1956 if (!flag_finite_math_only)
1957 operands[1] = force_reg (<MODE>mode, operands[1]);
1958 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
1961 (define_insn "*<code><mode>3_finite<mask_name><round_saeonly_name>"
1962 [(set (match_operand:VF 0 "register_operand" "=x,v")
1964 (match_operand:VF 1 "<round_saeonly_nimm_predicate>" "%0,v")
1965 (match_operand:VF 2 "<round_saeonly_nimm_predicate>" "xBm,<round_saeonly_constraint>")))]
1966 "TARGET_SSE && flag_finite_math_only
1967 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)
1968 && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
1970 <maxmin_float><ssemodesuffix>\t{%2, %0|%0, %2}
1971 v<maxmin_float><ssemodesuffix>\t{<round_saeonly_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_saeonly_mask_op3>}"
1972 [(set_attr "isa" "noavx,avx")
1973 (set_attr "type" "sseadd")
1974 (set_attr "btver2_sse_attr" "maxmin")
1975 (set_attr "prefix" "<mask_prefix3>")
1976 (set_attr "mode" "<MODE>")])
1978 (define_insn "*<code><mode>3<mask_name><round_saeonly_name>"
1979 [(set (match_operand:VF 0 "register_operand" "=x,v")
1981 (match_operand:VF 1 "register_operand" "0,v")
1982 (match_operand:VF 2 "<round_saeonly_nimm_predicate>" "xBm,<round_saeonly_constraint>")))]
1983 "TARGET_SSE && !flag_finite_math_only
1984 && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
1986 <maxmin_float><ssemodesuffix>\t{%2, %0|%0, %2}
1987 v<maxmin_float><ssemodesuffix>\t{<round_saeonly_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_saeonly_mask_op3>}"
1988 [(set_attr "isa" "noavx,avx")
1989 (set_attr "type" "sseadd")
1990 (set_attr "btver2_sse_attr" "maxmin")
1991 (set_attr "prefix" "<mask_prefix3>")
1992 (set_attr "mode" "<MODE>")])
1994 (define_insn "<sse>_vm<code><mode>3<round_saeonly_name>"
1995 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
1998 (match_operand:VF_128 1 "register_operand" "0,v")
1999 (match_operand:VF_128 2 "vector_operand" "xBm,<round_saeonly_constraint>"))
2004 <maxmin_float><ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
2005 v<maxmin_float><ssescalarmodesuffix>\t{<round_saeonly_op3>%2, %1, %0|%0, %1, %<iptr>2<round_saeonly_op3>}"
2006 [(set_attr "isa" "noavx,avx")
2007 (set_attr "type" "sse")
2008 (set_attr "btver2_sse_attr" "maxmin")
2009 (set_attr "prefix" "<round_saeonly_prefix>")
2010 (set_attr "mode" "<ssescalarmode>")])
2012 ;; These versions of the min/max patterns implement exactly the operations
2013 ;; min = (op1 < op2 ? op1 : op2)
2014 ;; max = (!(op1 < op2) ? op1 : op2)
2015 ;; Their operands are not commutative, and thus they may be used in the
2016 ;; presence of -0.0 and NaN.
2018 (define_insn "*ieee_smin<mode>3"
2019 [(set (match_operand:VF 0 "register_operand" "=x,v")
2021 [(match_operand:VF 1 "register_operand" "0,v")
2022 (match_operand:VF 2 "vector_operand" "xBm,vm")]
2026 min<ssemodesuffix>\t{%2, %0|%0, %2}
2027 vmin<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
2028 [(set_attr "isa" "noavx,avx")
2029 (set_attr "type" "sseadd")
2030 (set_attr "prefix" "orig,vex")
2031 (set_attr "mode" "<MODE>")])
2033 (define_insn "*ieee_smax<mode>3"
2034 [(set (match_operand:VF 0 "register_operand" "=x,v")
2036 [(match_operand:VF 1 "register_operand" "0,v")
2037 (match_operand:VF 2 "vector_operand" "xBm,vm")]
2041 max<ssemodesuffix>\t{%2, %0|%0, %2}
2042 vmax<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
2043 [(set_attr "isa" "noavx,avx")
2044 (set_attr "type" "sseadd")
2045 (set_attr "prefix" "orig,vex")
2046 (set_attr "mode" "<MODE>")])
2048 (define_insn "avx_addsubv4df3"
2049 [(set (match_operand:V4DF 0 "register_operand" "=x")
2052 (match_operand:V4DF 1 "register_operand" "x")
2053 (match_operand:V4DF 2 "nonimmediate_operand" "xm"))
2054 (plus:V4DF (match_dup 1) (match_dup 2))
2057 "vaddsubpd\t{%2, %1, %0|%0, %1, %2}"
2058 [(set_attr "type" "sseadd")
2059 (set_attr "prefix" "vex")
2060 (set_attr "mode" "V4DF")])
2062 (define_insn "sse3_addsubv2df3"
2063 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
2066 (match_operand:V2DF 1 "register_operand" "0,x")
2067 (match_operand:V2DF 2 "vector_operand" "xBm,xm"))
2068 (plus:V2DF (match_dup 1) (match_dup 2))
2072 addsubpd\t{%2, %0|%0, %2}
2073 vaddsubpd\t{%2, %1, %0|%0, %1, %2}"
2074 [(set_attr "isa" "noavx,avx")
2075 (set_attr "type" "sseadd")
2076 (set_attr "atom_unit" "complex")
2077 (set_attr "prefix" "orig,vex")
2078 (set_attr "mode" "V2DF")])
2080 (define_insn "avx_addsubv8sf3"
2081 [(set (match_operand:V8SF 0 "register_operand" "=x")
2084 (match_operand:V8SF 1 "register_operand" "x")
2085 (match_operand:V8SF 2 "nonimmediate_operand" "xm"))
2086 (plus:V8SF (match_dup 1) (match_dup 2))
2089 "vaddsubps\t{%2, %1, %0|%0, %1, %2}"
2090 [(set_attr "type" "sseadd")
2091 (set_attr "prefix" "vex")
2092 (set_attr "mode" "V8SF")])
2094 (define_insn "sse3_addsubv4sf3"
2095 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
2098 (match_operand:V4SF 1 "register_operand" "0,x")
2099 (match_operand:V4SF 2 "vector_operand" "xBm,xm"))
2100 (plus:V4SF (match_dup 1) (match_dup 2))
2104 addsubps\t{%2, %0|%0, %2}
2105 vaddsubps\t{%2, %1, %0|%0, %1, %2}"
2106 [(set_attr "isa" "noavx,avx")
2107 (set_attr "type" "sseadd")
2108 (set_attr "prefix" "orig,vex")
2109 (set_attr "prefix_rep" "1,*")
2110 (set_attr "mode" "V4SF")])
2113 [(set (match_operand:VF_128_256 0 "register_operand")
2114 (match_operator:VF_128_256 6 "addsub_vm_operator"
2116 (match_operand:VF_128_256 1 "register_operand")
2117 (match_operand:VF_128_256 2 "vector_operand"))
2119 (match_operand:VF_128_256 3 "vector_operand")
2120 (match_operand:VF_128_256 4 "vector_operand"))
2121 (match_operand 5 "const_int_operand")]))]
2123 && can_create_pseudo_p ()
2124 && ((rtx_equal_p (operands[1], operands[3])
2125 && rtx_equal_p (operands[2], operands[4]))
2126 || (rtx_equal_p (operands[1], operands[4])
2127 && rtx_equal_p (operands[2], operands[3])))"
2129 (vec_merge:VF_128_256
2130 (minus:VF_128_256 (match_dup 1) (match_dup 2))
2131 (plus:VF_128_256 (match_dup 1) (match_dup 2))
2135 [(set (match_operand:VF_128_256 0 "register_operand")
2136 (match_operator:VF_128_256 6 "addsub_vm_operator"
2138 (match_operand:VF_128_256 1 "vector_operand")
2139 (match_operand:VF_128_256 2 "vector_operand"))
2141 (match_operand:VF_128_256 3 "register_operand")
2142 (match_operand:VF_128_256 4 "vector_operand"))
2143 (match_operand 5 "const_int_operand")]))]
2145 && can_create_pseudo_p ()
2146 && ((rtx_equal_p (operands[1], operands[3])
2147 && rtx_equal_p (operands[2], operands[4]))
2148 || (rtx_equal_p (operands[1], operands[4])
2149 && rtx_equal_p (operands[2], operands[3])))"
2151 (vec_merge:VF_128_256
2152 (minus:VF_128_256 (match_dup 3) (match_dup 4))
2153 (plus:VF_128_256 (match_dup 3) (match_dup 4))
2156 /* Negate mask bits to compensate for swapped PLUS and MINUS RTXes. */
2158 = GEN_INT (~INTVAL (operands[5])
2159 & ((HOST_WIDE_INT_1U << GET_MODE_NUNITS (<MODE>mode)) - 1));
2163 [(set (match_operand:VF_128_256 0 "register_operand")
2164 (match_operator:VF_128_256 7 "addsub_vs_operator"
2165 [(vec_concat:<ssedoublemode>
2167 (match_operand:VF_128_256 1 "register_operand")
2168 (match_operand:VF_128_256 2 "vector_operand"))
2170 (match_operand:VF_128_256 3 "vector_operand")
2171 (match_operand:VF_128_256 4 "vector_operand")))
2172 (match_parallel 5 "addsub_vs_parallel"
2173 [(match_operand 6 "const_int_operand")])]))]
2175 && can_create_pseudo_p ()
2176 && ((rtx_equal_p (operands[1], operands[3])
2177 && rtx_equal_p (operands[2], operands[4]))
2178 || (rtx_equal_p (operands[1], operands[4])
2179 && rtx_equal_p (operands[2], operands[3])))"
2181 (vec_merge:VF_128_256
2182 (minus:VF_128_256 (match_dup 1) (match_dup 2))
2183 (plus:VF_128_256 (match_dup 1) (match_dup 2))
2186 int i, nelt = XVECLEN (operands[5], 0);
2187 HOST_WIDE_INT ival = 0;
2189 for (i = 0; i < nelt; i++)
2190 if (INTVAL (XVECEXP (operands[5], 0, i)) < GET_MODE_NUNITS (<MODE>mode))
2191 ival |= HOST_WIDE_INT_1 << i;
2193 operands[5] = GEN_INT (ival);
2197 [(set (match_operand:VF_128_256 0 "register_operand")
2198 (match_operator:VF_128_256 7 "addsub_vs_operator"
2199 [(vec_concat:<ssedoublemode>
2201 (match_operand:VF_128_256 1 "vector_operand")
2202 (match_operand:VF_128_256 2 "vector_operand"))
2204 (match_operand:VF_128_256 3 "register_operand")
2205 (match_operand:VF_128_256 4 "vector_operand")))
2206 (match_parallel 5 "addsub_vs_parallel"
2207 [(match_operand 6 "const_int_operand")])]))]
2209 && can_create_pseudo_p ()
2210 && ((rtx_equal_p (operands[1], operands[3])
2211 && rtx_equal_p (operands[2], operands[4]))
2212 || (rtx_equal_p (operands[1], operands[4])
2213 && rtx_equal_p (operands[2], operands[3])))"
2215 (vec_merge:VF_128_256
2216 (minus:VF_128_256 (match_dup 3) (match_dup 4))
2217 (plus:VF_128_256 (match_dup 3) (match_dup 4))
2220 int i, nelt = XVECLEN (operands[5], 0);
2221 HOST_WIDE_INT ival = 0;
2223 for (i = 0; i < nelt; i++)
2224 if (INTVAL (XVECEXP (operands[5], 0, i)) >= GET_MODE_NUNITS (<MODE>mode))
2225 ival |= HOST_WIDE_INT_1 << i;
2227 operands[5] = GEN_INT (ival);
2230 (define_insn "avx_h<plusminus_insn>v4df3"
2231 [(set (match_operand:V4DF 0 "register_operand" "=x")
2236 (match_operand:V4DF 1 "register_operand" "x")
2237 (parallel [(const_int 0)]))
2238 (vec_select:DF (match_dup 1) (parallel [(const_int 1)])))
2241 (match_operand:V4DF 2 "nonimmediate_operand" "xm")
2242 (parallel [(const_int 0)]))
2243 (vec_select:DF (match_dup 2) (parallel [(const_int 1)]))))
2246 (vec_select:DF (match_dup 1) (parallel [(const_int 2)]))
2247 (vec_select:DF (match_dup 1) (parallel [(const_int 3)])))
2249 (vec_select:DF (match_dup 2) (parallel [(const_int 2)]))
2250 (vec_select:DF (match_dup 2) (parallel [(const_int 3)]))))))]
2252 "vh<plusminus_mnemonic>pd\t{%2, %1, %0|%0, %1, %2}"
2253 [(set_attr "type" "sseadd")
2254 (set_attr "prefix" "vex")
2255 (set_attr "mode" "V4DF")])
2257 (define_expand "sse3_haddv2df3"
2258 [(set (match_operand:V2DF 0 "register_operand")
2262 (match_operand:V2DF 1 "register_operand")
2263 (parallel [(const_int 0)]))
2264 (vec_select:DF (match_dup 1) (parallel [(const_int 1)])))
2267 (match_operand:V2DF 2 "vector_operand")
2268 (parallel [(const_int 0)]))
2269 (vec_select:DF (match_dup 2) (parallel [(const_int 1)])))))]
2272 (define_insn "*sse3_haddv2df3"
2273 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
2277 (match_operand:V2DF 1 "register_operand" "0,x")
2278 (parallel [(match_operand:SI 3 "const_0_to_1_operand")]))
2281 (parallel [(match_operand:SI 4 "const_0_to_1_operand")])))
2284 (match_operand:V2DF 2 "vector_operand" "xBm,xm")
2285 (parallel [(match_operand:SI 5 "const_0_to_1_operand")]))
2288 (parallel [(match_operand:SI 6 "const_0_to_1_operand")])))))]
2290 && INTVAL (operands[3]) != INTVAL (operands[4])
2291 && INTVAL (operands[5]) != INTVAL (operands[6])"
2293 haddpd\t{%2, %0|%0, %2}
2294 vhaddpd\t{%2, %1, %0|%0, %1, %2}"
2295 [(set_attr "isa" "noavx,avx")
2296 (set_attr "type" "sseadd")
2297 (set_attr "prefix" "orig,vex")
2298 (set_attr "mode" "V2DF")])
2300 (define_insn "sse3_hsubv2df3"
2301 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
2305 (match_operand:V2DF 1 "register_operand" "0,x")
2306 (parallel [(const_int 0)]))
2307 (vec_select:DF (match_dup 1) (parallel [(const_int 1)])))
2310 (match_operand:V2DF 2 "vector_operand" "xBm,xm")
2311 (parallel [(const_int 0)]))
2312 (vec_select:DF (match_dup 2) (parallel [(const_int 1)])))))]
2315 hsubpd\t{%2, %0|%0, %2}
2316 vhsubpd\t{%2, %1, %0|%0, %1, %2}"
2317 [(set_attr "isa" "noavx,avx")
2318 (set_attr "type" "sseadd")
2319 (set_attr "prefix" "orig,vex")
2320 (set_attr "mode" "V2DF")])
2322 (define_insn "*sse3_haddv2df3_low"
2323 [(set (match_operand:DF 0 "register_operand" "=x,x")
2326 (match_operand:V2DF 1 "register_operand" "0,x")
2327 (parallel [(match_operand:SI 2 "const_0_to_1_operand")]))
2330 (parallel [(match_operand:SI 3 "const_0_to_1_operand")]))))]
2332 && INTVAL (operands[2]) != INTVAL (operands[3])"
2334 haddpd\t{%0, %0|%0, %0}
2335 vhaddpd\t{%1, %1, %0|%0, %1, %1}"
2336 [(set_attr "isa" "noavx,avx")
2337 (set_attr "type" "sseadd1")
2338 (set_attr "prefix" "orig,vex")
2339 (set_attr "mode" "V2DF")])
2341 (define_insn "*sse3_hsubv2df3_low"
2342 [(set (match_operand:DF 0 "register_operand" "=x,x")
2345 (match_operand:V2DF 1 "register_operand" "0,x")
2346 (parallel [(const_int 0)]))
2349 (parallel [(const_int 1)]))))]
2352 hsubpd\t{%0, %0|%0, %0}
2353 vhsubpd\t{%1, %1, %0|%0, %1, %1}"
2354 [(set_attr "isa" "noavx,avx")
2355 (set_attr "type" "sseadd1")
2356 (set_attr "prefix" "orig,vex")
2357 (set_attr "mode" "V2DF")])
2359 (define_insn "avx_h<plusminus_insn>v8sf3"
2360 [(set (match_operand:V8SF 0 "register_operand" "=x")
2366 (match_operand:V8SF 1 "register_operand" "x")
2367 (parallel [(const_int 0)]))
2368 (vec_select:SF (match_dup 1) (parallel [(const_int 1)])))
2370 (vec_select:SF (match_dup 1) (parallel [(const_int 2)]))
2371 (vec_select:SF (match_dup 1) (parallel [(const_int 3)]))))
2375 (match_operand:V8SF 2 "nonimmediate_operand" "xm")
2376 (parallel [(const_int 0)]))
2377 (vec_select:SF (match_dup 2) (parallel [(const_int 1)])))
2379 (vec_select:SF (match_dup 2) (parallel [(const_int 2)]))
2380 (vec_select:SF (match_dup 2) (parallel [(const_int 3)])))))
2384 (vec_select:SF (match_dup 1) (parallel [(const_int 4)]))
2385 (vec_select:SF (match_dup 1) (parallel [(const_int 5)])))
2387 (vec_select:SF (match_dup 1) (parallel [(const_int 6)]))
2388 (vec_select:SF (match_dup 1) (parallel [(const_int 7)]))))
2391 (vec_select:SF (match_dup 2) (parallel [(const_int 4)]))
2392 (vec_select:SF (match_dup 2) (parallel [(const_int 5)])))
2394 (vec_select:SF (match_dup 2) (parallel [(const_int 6)]))
2395 (vec_select:SF (match_dup 2) (parallel [(const_int 7)])))))))]
2397 "vh<plusminus_mnemonic>ps\t{%2, %1, %0|%0, %1, %2}"
2398 [(set_attr "type" "sseadd")
2399 (set_attr "prefix" "vex")
2400 (set_attr "mode" "V8SF")])
2402 (define_insn "sse3_h<plusminus_insn>v4sf3"
2403 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
2408 (match_operand:V4SF 1 "register_operand" "0,x")
2409 (parallel [(const_int 0)]))
2410 (vec_select:SF (match_dup 1) (parallel [(const_int 1)])))
2412 (vec_select:SF (match_dup 1) (parallel [(const_int 2)]))
2413 (vec_select:SF (match_dup 1) (parallel [(const_int 3)]))))
2417 (match_operand:V4SF 2 "vector_operand" "xBm,xm")
2418 (parallel [(const_int 0)]))
2419 (vec_select:SF (match_dup 2) (parallel [(const_int 1)])))
2421 (vec_select:SF (match_dup 2) (parallel [(const_int 2)]))
2422 (vec_select:SF (match_dup 2) (parallel [(const_int 3)]))))))]
2425 h<plusminus_mnemonic>ps\t{%2, %0|%0, %2}
2426 vh<plusminus_mnemonic>ps\t{%2, %1, %0|%0, %1, %2}"
2427 [(set_attr "isa" "noavx,avx")
2428 (set_attr "type" "sseadd")
2429 (set_attr "atom_unit" "complex")
2430 (set_attr "prefix" "orig,vex")
2431 (set_attr "prefix_rep" "1,*")
2432 (set_attr "mode" "V4SF")])
2434 (define_expand "reduc_plus_scal_v8df"
2435 [(match_operand:DF 0 "register_operand")
2436 (match_operand:V8DF 1 "register_operand")]
2439 rtx tmp = gen_reg_rtx (V8DFmode);
2440 ix86_expand_reduc (gen_addv8df3, tmp, operands[1]);
2441 emit_insn (gen_vec_extractv8df (operands[0], tmp, const0_rtx));
2445 (define_expand "reduc_plus_scal_v4df"
2446 [(match_operand:DF 0 "register_operand")
2447 (match_operand:V4DF 1 "register_operand")]
2450 rtx tmp = gen_reg_rtx (V4DFmode);
2451 rtx tmp2 = gen_reg_rtx (V4DFmode);
2452 rtx vec_res = gen_reg_rtx (V4DFmode);
2453 emit_insn (gen_avx_haddv4df3 (tmp, operands[1], operands[1]));
2454 emit_insn (gen_avx_vperm2f128v4df3 (tmp2, tmp, tmp, GEN_INT (1)));
2455 emit_insn (gen_addv4df3 (vec_res, tmp, tmp2));
2456 emit_insn (gen_vec_extractv4df (operands[0], vec_res, const0_rtx));
2460 (define_expand "reduc_plus_scal_v2df"
2461 [(match_operand:DF 0 "register_operand")
2462 (match_operand:V2DF 1 "register_operand")]
2465 rtx tmp = gen_reg_rtx (V2DFmode);
2466 emit_insn (gen_sse3_haddv2df3 (tmp, operands[1], operands[1]));
2467 emit_insn (gen_vec_extractv2df (operands[0], tmp, const0_rtx));
2471 (define_expand "reduc_plus_scal_v16sf"
2472 [(match_operand:SF 0 "register_operand")
2473 (match_operand:V16SF 1 "register_operand")]
2476 rtx tmp = gen_reg_rtx (V16SFmode);
2477 ix86_expand_reduc (gen_addv16sf3, tmp, operands[1]);
2478 emit_insn (gen_vec_extractv16sf (operands[0], tmp, const0_rtx));
2482 (define_expand "reduc_plus_scal_v8sf"
2483 [(match_operand:SF 0 "register_operand")
2484 (match_operand:V8SF 1 "register_operand")]
2487 rtx tmp = gen_reg_rtx (V8SFmode);
2488 rtx tmp2 = gen_reg_rtx (V8SFmode);
2489 rtx vec_res = gen_reg_rtx (V8SFmode);
2490 emit_insn (gen_avx_haddv8sf3 (tmp, operands[1], operands[1]));
2491 emit_insn (gen_avx_haddv8sf3 (tmp2, tmp, tmp));
2492 emit_insn (gen_avx_vperm2f128v8sf3 (tmp, tmp2, tmp2, GEN_INT (1)));
2493 emit_insn (gen_addv8sf3 (vec_res, tmp, tmp2));
2494 emit_insn (gen_vec_extractv8sf (operands[0], vec_res, const0_rtx));
2498 (define_expand "reduc_plus_scal_v4sf"
2499 [(match_operand:SF 0 "register_operand")
2500 (match_operand:V4SF 1 "register_operand")]
2503 rtx vec_res = gen_reg_rtx (V4SFmode);
2506 rtx tmp = gen_reg_rtx (V4SFmode);
2507 emit_insn (gen_sse3_haddv4sf3 (tmp, operands[1], operands[1]));
2508 emit_insn (gen_sse3_haddv4sf3 (vec_res, tmp, tmp));
2511 ix86_expand_reduc (gen_addv4sf3, vec_res, operands[1]);
2512 emit_insn (gen_vec_extractv4sf (operands[0], vec_res, const0_rtx));
2516 ;; Modes handled by reduc_sm{in,ax}* patterns.
2517 (define_mode_iterator REDUC_SMINMAX_MODE
2518 [(V32QI "TARGET_AVX2") (V16HI "TARGET_AVX2")
2519 (V8SI "TARGET_AVX2") (V4DI "TARGET_AVX2")
2520 (V8SF "TARGET_AVX") (V4DF "TARGET_AVX")
2521 (V4SF "TARGET_SSE") (V64QI "TARGET_AVX512BW")
2522 (V32HI "TARGET_AVX512BW") (V16SI "TARGET_AVX512F")
2523 (V8DI "TARGET_AVX512F") (V16SF "TARGET_AVX512F")
2524 (V8DF "TARGET_AVX512F")])
2526 (define_expand "reduc_<code>_scal_<mode>"
2527 [(smaxmin:REDUC_SMINMAX_MODE
2528 (match_operand:<ssescalarmode> 0 "register_operand")
2529 (match_operand:REDUC_SMINMAX_MODE 1 "register_operand"))]
2532 rtx tmp = gen_reg_rtx (<MODE>mode);
2533 ix86_expand_reduc (gen_<code><mode>3, tmp, operands[1]);
2534 emit_insn (gen_vec_extract<mode> (operands[0], tmp, const0_rtx));
2538 (define_expand "reduc_<code>_scal_<mode>"
2539 [(umaxmin:VI_AVX512BW
2540 (match_operand:<ssescalarmode> 0 "register_operand")
2541 (match_operand:VI_AVX512BW 1 "register_operand"))]
2544 rtx tmp = gen_reg_rtx (<MODE>mode);
2545 ix86_expand_reduc (gen_<code><mode>3, tmp, operands[1]);
2546 emit_insn (gen_vec_extract<mode> (operands[0], tmp, const0_rtx));
2550 (define_expand "reduc_<code>_scal_<mode>"
2552 (match_operand:<ssescalarmode> 0 "register_operand")
2553 (match_operand:VI_256 1 "register_operand"))]
2556 rtx tmp = gen_reg_rtx (<MODE>mode);
2557 ix86_expand_reduc (gen_<code><mode>3, tmp, operands[1]);
2558 emit_insn (gen_vec_extract<mode> (operands[0], tmp, const0_rtx));
2562 (define_expand "reduc_umin_scal_v8hi"
2564 (match_operand:HI 0 "register_operand")
2565 (match_operand:V8HI 1 "register_operand"))]
2568 rtx tmp = gen_reg_rtx (V8HImode);
2569 ix86_expand_reduc (gen_uminv8hi3, tmp, operands[1]);
2570 emit_insn (gen_vec_extractv8hi (operands[0], tmp, const0_rtx));
2574 (define_insn "<mask_codefor>reducep<mode><mask_name>"
2575 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
2577 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "vm")
2578 (match_operand:SI 2 "const_0_to_255_operand")]
2581 "vreduce<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
2582 [(set_attr "type" "sse")
2583 (set_attr "prefix" "evex")
2584 (set_attr "mode" "<MODE>")])
2586 (define_insn "reduces<mode>"
2587 [(set (match_operand:VF_128 0 "register_operand" "=v")
2590 [(match_operand:VF_128 1 "register_operand" "v")
2591 (match_operand:VF_128 2 "nonimmediate_operand" "vm")
2592 (match_operand:SI 3 "const_0_to_255_operand")]
2597 "vreduce<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
2598 [(set_attr "type" "sse")
2599 (set_attr "prefix" "evex")
2600 (set_attr "mode" "<MODE>")])
2602 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2604 ;; Parallel floating point comparisons
2606 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2608 (define_insn "avx_cmp<mode>3"
2609 [(set (match_operand:VF_128_256 0 "register_operand" "=x")
2611 [(match_operand:VF_128_256 1 "register_operand" "x")
2612 (match_operand:VF_128_256 2 "nonimmediate_operand" "xm")
2613 (match_operand:SI 3 "const_0_to_31_operand" "n")]
2616 "vcmp<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
2617 [(set_attr "type" "ssecmp")
2618 (set_attr "length_immediate" "1")
2619 (set_attr "prefix" "vex")
2620 (set_attr "mode" "<MODE>")])
2622 (define_insn "avx_vmcmp<mode>3"
2623 [(set (match_operand:VF_128 0 "register_operand" "=x")
2626 [(match_operand:VF_128 1 "register_operand" "x")
2627 (match_operand:VF_128 2 "nonimmediate_operand" "xm")
2628 (match_operand:SI 3 "const_0_to_31_operand" "n")]
2633 "vcmp<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %3}"
2634 [(set_attr "type" "ssecmp")
2635 (set_attr "length_immediate" "1")
2636 (set_attr "prefix" "vex")
2637 (set_attr "mode" "<ssescalarmode>")])
2639 (define_insn "*<sse>_maskcmp<mode>3_comm"
2640 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x")
2641 (match_operator:VF_128_256 3 "sse_comparison_operator"
2642 [(match_operand:VF_128_256 1 "register_operand" "%0,x")
2643 (match_operand:VF_128_256 2 "vector_operand" "xBm,xm")]))]
2645 && GET_RTX_CLASS (GET_CODE (operands[3])) == RTX_COMM_COMPARE"
2647 cmp%D3<ssemodesuffix>\t{%2, %0|%0, %2}
2648 vcmp%D3<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
2649 [(set_attr "isa" "noavx,avx")
2650 (set_attr "type" "ssecmp")
2651 (set_attr "length_immediate" "1")
2652 (set_attr "prefix" "orig,vex")
2653 (set_attr "mode" "<MODE>")])
2655 (define_insn "<sse>_maskcmp<mode>3"
2656 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x")
2657 (match_operator:VF_128_256 3 "sse_comparison_operator"
2658 [(match_operand:VF_128_256 1 "register_operand" "0,x")
2659 (match_operand:VF_128_256 2 "vector_operand" "xBm,xm")]))]
2662 cmp%D3<ssemodesuffix>\t{%2, %0|%0, %2}
2663 vcmp%D3<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
2664 [(set_attr "isa" "noavx,avx")
2665 (set_attr "type" "ssecmp")
2666 (set_attr "length_immediate" "1")
2667 (set_attr "prefix" "orig,vex")
2668 (set_attr "mode" "<MODE>")])
2670 (define_insn "<sse>_vmmaskcmp<mode>3"
2671 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
2673 (match_operator:VF_128 3 "sse_comparison_operator"
2674 [(match_operand:VF_128 1 "register_operand" "0,x")
2675 (match_operand:VF_128 2 "vector_operand" "xBm,xm")])
2680 cmp%D3<ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
2681 vcmp%D3<ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %<iptr>2}"
2682 [(set_attr "isa" "noavx,avx")
2683 (set_attr "type" "ssecmp")
2684 (set_attr "length_immediate" "1,*")
2685 (set_attr "prefix" "orig,vex")
2686 (set_attr "mode" "<ssescalarmode>")])
2688 (define_mode_attr cmp_imm_predicate
2689 [(V16SF "const_0_to_31_operand") (V8DF "const_0_to_31_operand")
2690 (V16SI "const_0_to_7_operand") (V8DI "const_0_to_7_operand")
2691 (V8SF "const_0_to_31_operand") (V4DF "const_0_to_31_operand")
2692 (V8SI "const_0_to_7_operand") (V4DI "const_0_to_7_operand")
2693 (V4SF "const_0_to_31_operand") (V2DF "const_0_to_31_operand")
2694 (V4SI "const_0_to_7_operand") (V2DI "const_0_to_7_operand")
2695 (V32HI "const_0_to_7_operand") (V64QI "const_0_to_7_operand")
2696 (V16HI "const_0_to_7_operand") (V32QI "const_0_to_7_operand")
2697 (V8HI "const_0_to_7_operand") (V16QI "const_0_to_7_operand")])
2699 (define_insn "<avx512>_cmp<mode>3<mask_scalar_merge_name><round_saeonly_name>"
2700 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2701 (unspec:<avx512fmaskmode>
2702 [(match_operand:V48_AVX512VL 1 "register_operand" "v")
2703 (match_operand:V48_AVX512VL 2 "nonimmediate_operand" "<round_saeonly_constraint>")
2704 (match_operand:SI 3 "<cmp_imm_predicate>" "n")]
2706 "TARGET_AVX512F && <round_saeonly_mode512bit_condition>"
2707 "v<sseintprefix>cmp<ssemodesuffix>\t{%3, <round_saeonly_mask_scalar_merge_op4>%2, %1, %0<mask_scalar_merge_operand4>|%0<mask_scalar_merge_operand4>, %1, %2<round_saeonly_mask_scalar_merge_op4>, %3}"
2708 [(set_attr "type" "ssecmp")
2709 (set_attr "length_immediate" "1")
2710 (set_attr "prefix" "evex")
2711 (set_attr "mode" "<sseinsnmode>")])
2713 (define_insn "<avx512>_cmp<mode>3<mask_scalar_merge_name>"
2714 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2715 (unspec:<avx512fmaskmode>
2716 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
2717 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")
2718 (match_operand:SI 3 "<cmp_imm_predicate>" "n")]
2721 "vpcmp<ssemodesuffix>\t{%3, %2, %1, %0<mask_scalar_merge_operand4>|%0<mask_scalar_merge_operand4>, %1, %2, %3}"
2722 [(set_attr "type" "ssecmp")
2723 (set_attr "length_immediate" "1")
2724 (set_attr "prefix" "evex")
2725 (set_attr "mode" "<sseinsnmode>")])
2727 (define_insn "<avx512>_ucmp<mode>3<mask_scalar_merge_name>"
2728 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2729 (unspec:<avx512fmaskmode>
2730 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
2731 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")
2732 (match_operand:SI 3 "const_0_to_7_operand" "n")]
2733 UNSPEC_UNSIGNED_PCMP))]
2735 "vpcmpu<ssemodesuffix>\t{%3, %2, %1, %0<mask_scalar_merge_operand4>|%0<mask_scalar_merge_operand4>, %1, %2, %3}"
2736 [(set_attr "type" "ssecmp")
2737 (set_attr "length_immediate" "1")
2738 (set_attr "prefix" "evex")
2739 (set_attr "mode" "<sseinsnmode>")])
2741 (define_insn "<avx512>_ucmp<mode>3<mask_scalar_merge_name>"
2742 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2743 (unspec:<avx512fmaskmode>
2744 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
2745 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")
2746 (match_operand:SI 3 "const_0_to_7_operand" "n")]
2747 UNSPEC_UNSIGNED_PCMP))]
2749 "vpcmpu<ssemodesuffix>\t{%3, %2, %1, %0<mask_scalar_merge_operand4>|%0<mask_scalar_merge_operand4>, %1, %2, %3}"
2750 [(set_attr "type" "ssecmp")
2751 (set_attr "length_immediate" "1")
2752 (set_attr "prefix" "evex")
2753 (set_attr "mode" "<sseinsnmode>")])
2755 (define_insn "avx512f_vmcmp<mode>3<round_saeonly_name>"
2756 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2757 (and:<avx512fmaskmode>
2758 (unspec:<avx512fmaskmode>
2759 [(match_operand:VF_128 1 "register_operand" "v")
2760 (match_operand:VF_128 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
2761 (match_operand:SI 3 "const_0_to_31_operand" "n")]
2765 "vcmp<ssescalarmodesuffix>\t{%3, <round_saeonly_op4>%2, %1, %0|%0, %1, %2<round_saeonly_op4>, %3}"
2766 [(set_attr "type" "ssecmp")
2767 (set_attr "length_immediate" "1")
2768 (set_attr "prefix" "evex")
2769 (set_attr "mode" "<ssescalarmode>")])
2771 (define_insn "avx512f_vmcmp<mode>3_mask<round_saeonly_name>"
2772 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2773 (and:<avx512fmaskmode>
2774 (unspec:<avx512fmaskmode>
2775 [(match_operand:VF_128 1 "register_operand" "v")
2776 (match_operand:VF_128 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
2777 (match_operand:SI 3 "const_0_to_31_operand" "n")]
2779 (and:<avx512fmaskmode>
2780 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")
2783 "vcmp<ssescalarmodesuffix>\t{%3, <round_saeonly_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_saeonly_op5>, %3}"
2784 [(set_attr "type" "ssecmp")
2785 (set_attr "length_immediate" "1")
2786 (set_attr "prefix" "evex")
2787 (set_attr "mode" "<ssescalarmode>")])
2789 (define_insn "avx512f_maskcmp<mode>3"
2790 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2791 (match_operator:<avx512fmaskmode> 3 "sse_comparison_operator"
2792 [(match_operand:VF 1 "register_operand" "v")
2793 (match_operand:VF 2 "nonimmediate_operand" "vm")]))]
2795 "vcmp%D3<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
2796 [(set_attr "type" "ssecmp")
2797 (set_attr "length_immediate" "1")
2798 (set_attr "prefix" "evex")
2799 (set_attr "mode" "<sseinsnmode>")])
2801 (define_insn "<sse>_comi<round_saeonly_name>"
2802 [(set (reg:CCFP FLAGS_REG)
2805 (match_operand:<ssevecmode> 0 "register_operand" "v")
2806 (parallel [(const_int 0)]))
2808 (match_operand:<ssevecmode> 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
2809 (parallel [(const_int 0)]))))]
2810 "SSE_FLOAT_MODE_P (<MODE>mode)"
2811 "%vcomi<ssemodesuffix>\t{<round_saeonly_op2>%1, %0|%0, %<iptr>1<round_saeonly_op2>}"
2812 [(set_attr "type" "ssecomi")
2813 (set_attr "prefix" "maybe_vex")
2814 (set_attr "prefix_rep" "0")
2815 (set (attr "prefix_data16")
2816 (if_then_else (eq_attr "mode" "DF")
2818 (const_string "0")))
2819 (set_attr "mode" "<MODE>")])
2821 (define_insn "<sse>_ucomi<round_saeonly_name>"
2822 [(set (reg:CCFPU FLAGS_REG)
2825 (match_operand:<ssevecmode> 0 "register_operand" "v")
2826 (parallel [(const_int 0)]))
2828 (match_operand:<ssevecmode> 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
2829 (parallel [(const_int 0)]))))]
2830 "SSE_FLOAT_MODE_P (<MODE>mode)"
2831 "%vucomi<ssemodesuffix>\t{<round_saeonly_op2>%1, %0|%0, %<iptr>1<round_saeonly_op2>}"
2832 [(set_attr "type" "ssecomi")
2833 (set_attr "prefix" "maybe_vex")
2834 (set_attr "prefix_rep" "0")
2835 (set (attr "prefix_data16")
2836 (if_then_else (eq_attr "mode" "DF")
2838 (const_string "0")))
2839 (set_attr "mode" "<MODE>")])
2841 (define_expand "vec_cmp<mode><avx512fmaskmodelower>"
2842 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
2843 (match_operator:<avx512fmaskmode> 1 ""
2844 [(match_operand:V48_AVX512VL 2 "register_operand")
2845 (match_operand:V48_AVX512VL 3 "nonimmediate_operand")]))]
2848 bool ok = ix86_expand_mask_vec_cmp (operands);
2853 (define_expand "vec_cmp<mode><avx512fmaskmodelower>"
2854 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
2855 (match_operator:<avx512fmaskmode> 1 ""
2856 [(match_operand:VI12_AVX512VL 2 "register_operand")
2857 (match_operand:VI12_AVX512VL 3 "nonimmediate_operand")]))]
2860 bool ok = ix86_expand_mask_vec_cmp (operands);
2865 (define_expand "vec_cmp<mode><sseintvecmodelower>"
2866 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2867 (match_operator:<sseintvecmode> 1 ""
2868 [(match_operand:VI_256 2 "register_operand")
2869 (match_operand:VI_256 3 "nonimmediate_operand")]))]
2872 bool ok = ix86_expand_int_vec_cmp (operands);
2877 (define_expand "vec_cmp<mode><sseintvecmodelower>"
2878 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2879 (match_operator:<sseintvecmode> 1 ""
2880 [(match_operand:VI124_128 2 "register_operand")
2881 (match_operand:VI124_128 3 "vector_operand")]))]
2884 bool ok = ix86_expand_int_vec_cmp (operands);
2889 (define_expand "vec_cmpv2div2di"
2890 [(set (match_operand:V2DI 0 "register_operand")
2891 (match_operator:V2DI 1 ""
2892 [(match_operand:V2DI 2 "register_operand")
2893 (match_operand:V2DI 3 "vector_operand")]))]
2896 bool ok = ix86_expand_int_vec_cmp (operands);
2901 (define_expand "vec_cmp<mode><sseintvecmodelower>"
2902 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2903 (match_operator:<sseintvecmode> 1 ""
2904 [(match_operand:VF_256 2 "register_operand")
2905 (match_operand:VF_256 3 "nonimmediate_operand")]))]
2908 bool ok = ix86_expand_fp_vec_cmp (operands);
2913 (define_expand "vec_cmp<mode><sseintvecmodelower>"
2914 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2915 (match_operator:<sseintvecmode> 1 ""
2916 [(match_operand:VF_128 2 "register_operand")
2917 (match_operand:VF_128 3 "vector_operand")]))]
2920 bool ok = ix86_expand_fp_vec_cmp (operands);
2925 (define_expand "vec_cmpu<mode><avx512fmaskmodelower>"
2926 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
2927 (match_operator:<avx512fmaskmode> 1 ""
2928 [(match_operand:VI48_AVX512VL 2 "register_operand")
2929 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand")]))]
2932 bool ok = ix86_expand_mask_vec_cmp (operands);
2937 (define_expand "vec_cmpu<mode><avx512fmaskmodelower>"
2938 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
2939 (match_operator:<avx512fmaskmode> 1 ""
2940 [(match_operand:VI12_AVX512VL 2 "register_operand")
2941 (match_operand:VI12_AVX512VL 3 "nonimmediate_operand")]))]
2944 bool ok = ix86_expand_mask_vec_cmp (operands);
2949 (define_expand "vec_cmpu<mode><sseintvecmodelower>"
2950 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2951 (match_operator:<sseintvecmode> 1 ""
2952 [(match_operand:VI_256 2 "register_operand")
2953 (match_operand:VI_256 3 "nonimmediate_operand")]))]
2956 bool ok = ix86_expand_int_vec_cmp (operands);
2961 (define_expand "vec_cmpu<mode><sseintvecmodelower>"
2962 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2963 (match_operator:<sseintvecmode> 1 ""
2964 [(match_operand:VI124_128 2 "register_operand")
2965 (match_operand:VI124_128 3 "vector_operand")]))]
2968 bool ok = ix86_expand_int_vec_cmp (operands);
2973 (define_expand "vec_cmpuv2div2di"
2974 [(set (match_operand:V2DI 0 "register_operand")
2975 (match_operator:V2DI 1 ""
2976 [(match_operand:V2DI 2 "register_operand")
2977 (match_operand:V2DI 3 "vector_operand")]))]
2980 bool ok = ix86_expand_int_vec_cmp (operands);
2985 (define_expand "vcond<V_512:mode><VF_512:mode>"
2986 [(set (match_operand:V_512 0 "register_operand")
2988 (match_operator 3 ""
2989 [(match_operand:VF_512 4 "nonimmediate_operand")
2990 (match_operand:VF_512 5 "nonimmediate_operand")])
2991 (match_operand:V_512 1 "general_operand")
2992 (match_operand:V_512 2 "general_operand")))]
2994 && (GET_MODE_NUNITS (<V_512:MODE>mode)
2995 == GET_MODE_NUNITS (<VF_512:MODE>mode))"
2997 bool ok = ix86_expand_fp_vcond (operands);
3002 (define_expand "vcond<V_256:mode><VF_256:mode>"
3003 [(set (match_operand:V_256 0 "register_operand")
3005 (match_operator 3 ""
3006 [(match_operand:VF_256 4 "nonimmediate_operand")
3007 (match_operand:VF_256 5 "nonimmediate_operand")])
3008 (match_operand:V_256 1 "general_operand")
3009 (match_operand:V_256 2 "general_operand")))]
3011 && (GET_MODE_NUNITS (<V_256:MODE>mode)
3012 == GET_MODE_NUNITS (<VF_256:MODE>mode))"
3014 bool ok = ix86_expand_fp_vcond (operands);
3019 (define_expand "vcond<V_128:mode><VF_128:mode>"
3020 [(set (match_operand:V_128 0 "register_operand")
3022 (match_operator 3 ""
3023 [(match_operand:VF_128 4 "vector_operand")
3024 (match_operand:VF_128 5 "vector_operand")])
3025 (match_operand:V_128 1 "general_operand")
3026 (match_operand:V_128 2 "general_operand")))]
3028 && (GET_MODE_NUNITS (<V_128:MODE>mode)
3029 == GET_MODE_NUNITS (<VF_128:MODE>mode))"
3031 bool ok = ix86_expand_fp_vcond (operands);
3036 (define_expand "vcond_mask_<mode><avx512fmaskmodelower>"
3037 [(set (match_operand:V48_AVX512VL 0 "register_operand")
3038 (vec_merge:V48_AVX512VL
3039 (match_operand:V48_AVX512VL 1 "nonimmediate_operand")
3040 (match_operand:V48_AVX512VL 2 "vector_move_operand")
3041 (match_operand:<avx512fmaskmode> 3 "register_operand")))]
3044 (define_expand "vcond_mask_<mode><avx512fmaskmodelower>"
3045 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
3046 (vec_merge:VI12_AVX512VL
3047 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand")
3048 (match_operand:VI12_AVX512VL 2 "vector_move_operand")
3049 (match_operand:<avx512fmaskmode> 3 "register_operand")))]
3052 (define_expand "vcond_mask_<mode><sseintvecmodelower>"
3053 [(set (match_operand:VI_256 0 "register_operand")
3055 (match_operand:VI_256 1 "nonimmediate_operand")
3056 (match_operand:VI_256 2 "vector_move_operand")
3057 (match_operand:<sseintvecmode> 3 "register_operand")))]
3060 ix86_expand_sse_movcc (operands[0], operands[3],
3061 operands[1], operands[2]);
3065 (define_expand "vcond_mask_<mode><sseintvecmodelower>"
3066 [(set (match_operand:VI124_128 0 "register_operand")
3067 (vec_merge:VI124_128
3068 (match_operand:VI124_128 1 "vector_operand")
3069 (match_operand:VI124_128 2 "vector_move_operand")
3070 (match_operand:<sseintvecmode> 3 "register_operand")))]
3073 ix86_expand_sse_movcc (operands[0], operands[3],
3074 operands[1], operands[2]);
3078 (define_expand "vcond_mask_v2div2di"
3079 [(set (match_operand:V2DI 0 "register_operand")
3081 (match_operand:V2DI 1 "vector_operand")
3082 (match_operand:V2DI 2 "vector_move_operand")
3083 (match_operand:V2DI 3 "register_operand")))]
3086 ix86_expand_sse_movcc (operands[0], operands[3],
3087 operands[1], operands[2]);
3091 (define_expand "vcond_mask_<mode><sseintvecmodelower>"
3092 [(set (match_operand:VF_256 0 "register_operand")
3094 (match_operand:VF_256 1 "nonimmediate_operand")
3095 (match_operand:VF_256 2 "vector_move_operand")
3096 (match_operand:<sseintvecmode> 3 "register_operand")))]
3099 ix86_expand_sse_movcc (operands[0], operands[3],
3100 operands[1], operands[2]);
3104 (define_expand "vcond_mask_<mode><sseintvecmodelower>"
3105 [(set (match_operand:VF_128 0 "register_operand")
3107 (match_operand:VF_128 1 "vector_operand")
3108 (match_operand:VF_128 2 "vector_move_operand")
3109 (match_operand:<sseintvecmode> 3 "register_operand")))]
3112 ix86_expand_sse_movcc (operands[0], operands[3],
3113 operands[1], operands[2]);
3117 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3119 ;; Parallel floating point logical operations
3121 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3123 (define_insn "<sse>_andnot<mode>3<mask_name>"
3124 [(set (match_operand:VF_128_256 0 "register_operand" "=x,v")
3127 (match_operand:VF_128_256 1 "register_operand" "0,v"))
3128 (match_operand:VF_128_256 2 "vector_operand" "xBm,vm")))]
3129 "TARGET_SSE && <mask_avx512vl_condition>"
3131 static char buf[128];
3135 switch (get_attr_mode (insn))
3142 suffix = "<ssemodesuffix>";
3145 switch (which_alternative)
3148 ops = "andn%s\t{%%2, %%0|%%0, %%2}";
3151 ops = "vandn%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
3157 /* There is no vandnp[sd] in avx512f. Use vpandn[qd]. */
3158 if (<mask_applied> && !TARGET_AVX512DQ)
3160 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
3161 ops = "vpandn%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
3164 snprintf (buf, sizeof (buf), ops, suffix);
3167 [(set_attr "isa" "noavx,avx")
3168 (set_attr "type" "sselog")
3169 (set_attr "prefix" "orig,maybe_evex")
3171 (cond [(and (match_test "<MODE_SIZE> == 16")
3172 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
3173 (const_string "<ssePSmode>")
3174 (match_test "TARGET_AVX")
3175 (const_string "<MODE>")
3176 (match_test "optimize_function_for_size_p (cfun)")
3177 (const_string "V4SF")
3179 (const_string "<MODE>")))])
3182 (define_insn "<sse>_andnot<mode>3<mask_name>"
3183 [(set (match_operand:VF_512 0 "register_operand" "=v")
3186 (match_operand:VF_512 1 "register_operand" "v"))
3187 (match_operand:VF_512 2 "nonimmediate_operand" "vm")))]
3190 static char buf[128];
3194 suffix = "<ssemodesuffix>";
3197 /* There is no vandnp[sd] in avx512f. Use vpandn[qd]. */
3198 if (!TARGET_AVX512DQ)
3200 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
3204 snprintf (buf, sizeof (buf),
3205 "v%sandn%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}",
3209 [(set_attr "type" "sselog")
3210 (set_attr "prefix" "evex")
3211 (set_attr "mode" "<sseinsnmode>")])
3213 (define_expand "<code><mode>3<mask_name>"
3214 [(set (match_operand:VF_128_256 0 "register_operand")
3215 (any_logic:VF_128_256
3216 (match_operand:VF_128_256 1 "vector_operand")
3217 (match_operand:VF_128_256 2 "vector_operand")))]
3218 "TARGET_SSE && <mask_avx512vl_condition>"
3219 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
3221 (define_expand "<code><mode>3<mask_name>"
3222 [(set (match_operand:VF_512 0 "register_operand")
3224 (match_operand:VF_512 1 "nonimmediate_operand")
3225 (match_operand:VF_512 2 "nonimmediate_operand")))]
3227 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
3229 (define_insn "*<code><mode>3<mask_name>"
3230 [(set (match_operand:VF_128_256 0 "register_operand" "=x,v")
3231 (any_logic:VF_128_256
3232 (match_operand:VF_128_256 1 "vector_operand" "%0,v")
3233 (match_operand:VF_128_256 2 "vector_operand" "xBm,vm")))]
3234 "TARGET_SSE && <mask_avx512vl_condition>
3235 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
3237 static char buf[128];
3241 switch (get_attr_mode (insn))
3248 suffix = "<ssemodesuffix>";
3251 switch (which_alternative)
3254 ops = "<logic>%s\t{%%2, %%0|%%0, %%2}";
3257 ops = "v<logic>%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
3263 /* There is no v<logic>p[sd] in avx512f. Use vp<logic>[dq]. */
3264 if (<mask_applied> && !TARGET_AVX512DQ)
3266 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
3267 ops = "vp<logic>%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
3270 snprintf (buf, sizeof (buf), ops, suffix);
3273 [(set_attr "isa" "noavx,avx")
3274 (set_attr "type" "sselog")
3275 (set_attr "prefix" "orig,maybe_evex")
3277 (cond [(and (match_test "<MODE_SIZE> == 16")
3278 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
3279 (const_string "<ssePSmode>")
3280 (match_test "TARGET_AVX")
3281 (const_string "<MODE>")
3282 (match_test "optimize_function_for_size_p (cfun)")
3283 (const_string "V4SF")
3285 (const_string "<MODE>")))])
3287 (define_insn "*<code><mode>3<mask_name>"
3288 [(set (match_operand:VF_512 0 "register_operand" "=v")
3290 (match_operand:VF_512 1 "nonimmediate_operand" "%v")
3291 (match_operand:VF_512 2 "nonimmediate_operand" "vm")))]
3292 "TARGET_AVX512F && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
3294 static char buf[128];
3298 suffix = "<ssemodesuffix>";
3301 /* There is no v<logic>p[sd] in avx512f. Use vp<logic>[dq]. */
3302 if ((<MODE_SIZE> == 64 || <mask_applied>) && !TARGET_AVX512DQ)
3304 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
3308 snprintf (buf, sizeof (buf),
3309 "v%s<logic>%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}",
3313 [(set_attr "type" "sselog")
3314 (set_attr "prefix" "evex")
3315 (set_attr "mode" "<sseinsnmode>")])
3317 (define_expand "copysign<mode>3"
3320 (not:VF (match_dup 3))
3321 (match_operand:VF 1 "vector_operand")))
3323 (and:VF (match_dup 3)
3324 (match_operand:VF 2 "vector_operand")))
3325 (set (match_operand:VF 0 "register_operand")
3326 (ior:VF (match_dup 4) (match_dup 5)))]
3329 operands[3] = ix86_build_signbit_mask (<MODE>mode, 1, 0);
3331 operands[4] = gen_reg_rtx (<MODE>mode);
3332 operands[5] = gen_reg_rtx (<MODE>mode);
3335 ;; Also define scalar versions. These are used for abs, neg, and
3336 ;; conditional move. Using subregs into vector modes causes register
3337 ;; allocation lossage. These patterns do not allow memory operands
3338 ;; because the native instructions read the full 128-bits.
3340 (define_insn "*andnot<mode>3"
3341 [(set (match_operand:MODEF 0 "register_operand" "=x,x")
3344 (match_operand:MODEF 1 "register_operand" "0,x"))
3345 (match_operand:MODEF 2 "register_operand" "x,x")))]
3346 "SSE_FLOAT_MODE_P (<MODE>mode)"
3348 static char buf[32];
3351 = (get_attr_mode (insn) == MODE_V4SF) ? "ps" : "<ssevecmodesuffix>";
3353 switch (which_alternative)
3356 ops = "andn%s\t{%%2, %%0|%%0, %%2}";
3359 ops = "vandn%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3365 snprintf (buf, sizeof (buf), ops, suffix);
3368 [(set_attr "isa" "noavx,avx")
3369 (set_attr "type" "sselog")
3370 (set_attr "prefix" "orig,vex")
3372 (cond [(and (match_test "<MODE_SIZE> == 16")
3373 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
3374 (const_string "V4SF")
3375 (match_test "TARGET_AVX")
3376 (const_string "<ssevecmode>")
3377 (match_test "optimize_function_for_size_p (cfun)")
3378 (const_string "V4SF")
3380 (const_string "<ssevecmode>")))])
3382 (define_insn "*andnottf3"
3383 [(set (match_operand:TF 0 "register_operand" "=x,x")
3385 (not:TF (match_operand:TF 1 "register_operand" "0,x"))
3386 (match_operand:TF 2 "vector_operand" "xBm,xm")))]
3389 static char buf[32];
3392 = (get_attr_mode (insn) == MODE_V4SF) ? "andnps" : "pandn";
3394 switch (which_alternative)
3397 ops = "%s\t{%%2, %%0|%%0, %%2}";
3400 ops = "v%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3406 snprintf (buf, sizeof (buf), ops, tmp);
3409 [(set_attr "isa" "noavx,avx")
3410 (set_attr "type" "sselog")
3411 (set (attr "prefix_data16")
3413 (and (eq_attr "alternative" "0")
3414 (eq_attr "mode" "TI"))
3416 (const_string "*")))
3417 (set_attr "prefix" "orig,vex")
3419 (cond [(match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
3420 (const_string "V4SF")
3421 (match_test "TARGET_AVX")
3423 (ior (not (match_test "TARGET_SSE2"))
3424 (match_test "optimize_function_for_size_p (cfun)"))
3425 (const_string "V4SF")
3427 (const_string "TI")))])
3429 (define_insn "*<code><mode>3"
3430 [(set (match_operand:MODEF 0 "register_operand" "=x,x")
3432 (match_operand:MODEF 1 "register_operand" "%0,x")
3433 (match_operand:MODEF 2 "register_operand" "x,x")))]
3434 "SSE_FLOAT_MODE_P (<MODE>mode)"
3436 static char buf[32];
3439 = (get_attr_mode (insn) == MODE_V4SF) ? "ps" : "<ssevecmodesuffix>";
3441 switch (which_alternative)
3444 ops = "<logic>%s\t{%%2, %%0|%%0, %%2}";
3447 ops = "v<logic>%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3453 snprintf (buf, sizeof (buf), ops, suffix);
3456 [(set_attr "isa" "noavx,avx")
3457 (set_attr "type" "sselog")
3458 (set_attr "prefix" "orig,vex")
3460 (cond [(and (match_test "<MODE_SIZE> == 16")
3461 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
3462 (const_string "V4SF")
3463 (match_test "TARGET_AVX")
3464 (const_string "<ssevecmode>")
3465 (match_test "optimize_function_for_size_p (cfun)")
3466 (const_string "V4SF")
3468 (const_string "<ssevecmode>")))])
3470 (define_expand "<code>tf3"
3471 [(set (match_operand:TF 0 "register_operand")
3473 (match_operand:TF 1 "vector_operand")
3474 (match_operand:TF 2 "vector_operand")))]
3476 "ix86_fixup_binary_operands_no_copy (<CODE>, TFmode, operands);")
3478 (define_insn "*<code>tf3"
3479 [(set (match_operand:TF 0 "register_operand" "=x,x")
3481 (match_operand:TF 1 "vector_operand" "%0,x")
3482 (match_operand:TF 2 "vector_operand" "xBm,xm")))]
3484 && ix86_binary_operator_ok (<CODE>, TFmode, operands)"
3486 static char buf[32];
3489 = (get_attr_mode (insn) == MODE_V4SF) ? "<logic>ps" : "p<logic>";
3491 switch (which_alternative)
3494 ops = "%s\t{%%2, %%0|%%0, %%2}";
3497 ops = "v%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3503 snprintf (buf, sizeof (buf), ops, tmp);
3506 [(set_attr "isa" "noavx,avx")
3507 (set_attr "type" "sselog")
3508 (set (attr "prefix_data16")
3510 (and (eq_attr "alternative" "0")
3511 (eq_attr "mode" "TI"))
3513 (const_string "*")))
3514 (set_attr "prefix" "orig,vex")
3516 (cond [(match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
3517 (const_string "V4SF")
3518 (match_test "TARGET_AVX")
3520 (ior (not (match_test "TARGET_SSE2"))
3521 (match_test "optimize_function_for_size_p (cfun)"))
3522 (const_string "V4SF")
3524 (const_string "TI")))])
3526 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3528 ;; FMA floating point multiply/accumulate instructions. These include
3529 ;; scalar versions of the instructions as well as vector versions.
3531 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3533 ;; The standard names for scalar FMA are only available with SSE math enabled.
3534 ;; CPUID bit AVX512F enables evex encoded scalar and 512-bit fma. It doesn't
3535 ;; care about FMA bit, so we enable fma for TARGET_AVX512F even when TARGET_FMA
3536 ;; and TARGET_FMA4 are both false.
3537 ;; TODO: In theory AVX512F does not automatically imply FMA, and without FMA
3538 ;; one must force the EVEX encoding of the fma insns. Ideally we'd improve
3539 ;; GAS to allow proper prefix selection. However, for the moment all hardware
3540 ;; that supports AVX512F also supports FMA so we can ignore this for now.
3541 (define_mode_iterator FMAMODEM
3542 [(SF "TARGET_SSE_MATH && (TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F)")
3543 (DF "TARGET_SSE_MATH && (TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F)")
3544 (V4SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3545 (V2DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3546 (V8SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3547 (V4DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3548 (V16SF "TARGET_AVX512F")
3549 (V8DF "TARGET_AVX512F")])
3551 (define_expand "fma<mode>4"
3552 [(set (match_operand:FMAMODEM 0 "register_operand")
3554 (match_operand:FMAMODEM 1 "nonimmediate_operand")
3555 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3556 (match_operand:FMAMODEM 3 "nonimmediate_operand")))])
3558 (define_expand "fms<mode>4"
3559 [(set (match_operand:FMAMODEM 0 "register_operand")
3561 (match_operand:FMAMODEM 1 "nonimmediate_operand")
3562 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3563 (neg:FMAMODEM (match_operand:FMAMODEM 3 "nonimmediate_operand"))))])
3565 (define_expand "fnma<mode>4"
3566 [(set (match_operand:FMAMODEM 0 "register_operand")
3568 (neg:FMAMODEM (match_operand:FMAMODEM 1 "nonimmediate_operand"))
3569 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3570 (match_operand:FMAMODEM 3 "nonimmediate_operand")))])
3572 (define_expand "fnms<mode>4"
3573 [(set (match_operand:FMAMODEM 0 "register_operand")
3575 (neg:FMAMODEM (match_operand:FMAMODEM 1 "nonimmediate_operand"))
3576 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3577 (neg:FMAMODEM (match_operand:FMAMODEM 3 "nonimmediate_operand"))))])
3579 ;; The builtins for intrinsics are not constrained by SSE math enabled.
3580 (define_mode_iterator FMAMODE_AVX512
3581 [(SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F")
3582 (DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F")
3583 (V4SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3584 (V2DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3585 (V8SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3586 (V4DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3587 (V16SF "TARGET_AVX512F")
3588 (V8DF "TARGET_AVX512F")])
3590 (define_mode_iterator FMAMODE
3591 [SF DF V4SF V2DF V8SF V4DF])
3593 (define_expand "fma4i_fmadd_<mode>"
3594 [(set (match_operand:FMAMODE_AVX512 0 "register_operand")
3596 (match_operand:FMAMODE_AVX512 1 "nonimmediate_operand")
3597 (match_operand:FMAMODE_AVX512 2 "nonimmediate_operand")
3598 (match_operand:FMAMODE_AVX512 3 "nonimmediate_operand")))])
3600 (define_expand "<avx512>_fmadd_<mode>_maskz<round_expand_name>"
3601 [(match_operand:VF_AVX512VL 0 "register_operand")
3602 (match_operand:VF_AVX512VL 1 "<round_expand_nimm_predicate>")
3603 (match_operand:VF_AVX512VL 2 "<round_expand_nimm_predicate>")
3604 (match_operand:VF_AVX512VL 3 "<round_expand_nimm_predicate>")
3605 (match_operand:<avx512fmaskmode> 4 "register_operand")]
3606 "TARGET_AVX512F && <round_mode512bit_condition>"
3608 emit_insn (gen_fma_fmadd_<mode>_maskz_1<round_expand_name> (
3609 operands[0], operands[1], operands[2], operands[3],
3610 CONST0_RTX (<MODE>mode), operands[4]<round_expand_operand>));
3614 (define_insn "*fma_fmadd_<mode>"
3615 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
3617 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x")
3618 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
3619 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x")))]
3620 "TARGET_FMA || TARGET_FMA4"
3622 vfmadd132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
3623 vfmadd213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
3624 vfmadd231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
3625 vfmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3626 vfmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3627 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3628 (set_attr "type" "ssemuladd")
3629 (set_attr "mode" "<MODE>")])
3631 ;; Suppose AVX-512F as baseline
3632 (define_mode_iterator VF_SF_AVX512VL
3633 [SF V16SF (V8SF "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
3634 DF V8DF (V4DF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
3636 (define_insn "<sd_mask_codefor>fma_fmadd_<mode><sd_maskz_name><round_name>"
3637 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3639 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
3640 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3641 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0")))]
3642 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3644 vfmadd132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3645 vfmadd213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3646 vfmadd231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
3647 [(set_attr "type" "ssemuladd")
3648 (set_attr "mode" "<MODE>")])
3650 (define_insn "<avx512>_fmadd_<mode>_mask<round_name>"
3651 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
3652 (vec_merge:VF_AVX512VL
3654 (match_operand:VF_AVX512VL 1 "register_operand" "0,0")
3655 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
3656 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>"))
3658 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
3659 "TARGET_AVX512F && <round_mode512bit_condition>"
3661 vfmadd132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
3662 vfmadd213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
3663 [(set_attr "isa" "fma_avx512f,fma_avx512f")
3664 (set_attr "type" "ssemuladd")
3665 (set_attr "mode" "<MODE>")])
3667 (define_insn "<avx512>_fmadd_<mode>_mask3<round_name>"
3668 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=x")
3669 (vec_merge:VF_AVX512VL
3671 (match_operand:VF_AVX512VL 1 "register_operand" "x")
3672 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
3673 (match_operand:VF_AVX512VL 3 "register_operand" "0"))
3675 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
3677 "vfmadd231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
3678 [(set_attr "isa" "fma_avx512f")
3679 (set_attr "type" "ssemuladd")
3680 (set_attr "mode" "<MODE>")])
3682 (define_insn "*fma_fmsub_<mode>"
3683 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
3685 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x")
3686 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
3688 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x"))))]
3689 "TARGET_FMA || TARGET_FMA4"
3691 vfmsub132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
3692 vfmsub213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
3693 vfmsub231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
3694 vfmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3695 vfmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3696 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3697 (set_attr "type" "ssemuladd")
3698 (set_attr "mode" "<MODE>")])
3700 (define_insn "<sd_mask_codefor>fma_fmsub_<mode><sd_maskz_name><round_name>"
3701 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3703 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
3704 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3706 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0"))))]
3707 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3709 vfmsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3710 vfmsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3711 vfmsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
3712 [(set_attr "type" "ssemuladd")
3713 (set_attr "mode" "<MODE>")])
3715 (define_insn "<avx512>_fmsub_<mode>_mask<round_name>"
3716 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
3717 (vec_merge:VF_AVX512VL
3719 (match_operand:VF_AVX512VL 1 "register_operand" "0,0")
3720 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
3722 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>")))
3724 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
3727 vfmsub132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
3728 vfmsub213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
3729 [(set_attr "isa" "fma_avx512f,fma_avx512f")
3730 (set_attr "type" "ssemuladd")
3731 (set_attr "mode" "<MODE>")])
3733 (define_insn "<avx512>_fmsub_<mode>_mask3<round_name>"
3734 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
3735 (vec_merge:VF_AVX512VL
3737 (match_operand:VF_AVX512VL 1 "register_operand" "v")
3738 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
3740 (match_operand:VF_AVX512VL 3 "register_operand" "0")))
3742 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
3743 "TARGET_AVX512F && <round_mode512bit_condition>"
3744 "vfmsub231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
3745 [(set_attr "isa" "fma_avx512f")
3746 (set_attr "type" "ssemuladd")
3747 (set_attr "mode" "<MODE>")])
3749 (define_insn "*fma_fnmadd_<mode>"
3750 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
3753 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x"))
3754 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
3755 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x")))]
3756 "TARGET_FMA || TARGET_FMA4"
3758 vfnmadd132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
3759 vfnmadd213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
3760 vfnmadd231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
3761 vfnmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3762 vfnmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3763 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3764 (set_attr "type" "ssemuladd")
3765 (set_attr "mode" "<MODE>")])
3767 (define_insn "<sd_mask_codefor>fma_fnmadd_<mode><sd_maskz_name><round_name>"
3768 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3771 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v"))
3772 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3773 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0")))]
3774 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3776 vfnmadd132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3777 vfnmadd213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3778 vfnmadd231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
3779 [(set_attr "type" "ssemuladd")
3780 (set_attr "mode" "<MODE>")])
3782 (define_insn "<avx512>_fnmadd_<mode>_mask<round_name>"
3783 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
3784 (vec_merge:VF_AVX512VL
3787 (match_operand:VF_AVX512VL 1 "register_operand" "0,0"))
3788 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
3789 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>"))
3791 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
3792 "TARGET_AVX512F && <round_mode512bit_condition>"
3794 vfnmadd132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
3795 vfnmadd213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
3796 [(set_attr "isa" "fma_avx512f,fma_avx512f")
3797 (set_attr "type" "ssemuladd")
3798 (set_attr "mode" "<MODE>")])
3800 (define_insn "<avx512>_fnmadd_<mode>_mask3<round_name>"
3801 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
3802 (vec_merge:VF_AVX512VL
3805 (match_operand:VF_AVX512VL 1 "register_operand" "v"))
3806 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
3807 (match_operand:VF_AVX512VL 3 "register_operand" "0"))
3809 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
3810 "TARGET_AVX512F && <round_mode512bit_condition>"
3811 "vfnmadd231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
3812 [(set_attr "isa" "fma_avx512f")
3813 (set_attr "type" "ssemuladd")
3814 (set_attr "mode" "<MODE>")])
3816 (define_insn "*fma_fnmsub_<mode>"
3817 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
3820 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x"))
3821 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
3823 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x"))))]
3824 "TARGET_FMA || TARGET_FMA4"
3826 vfnmsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3827 vfnmsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3828 vfnmsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}
3829 vfnmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3830 vfnmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3831 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3832 (set_attr "type" "ssemuladd")
3833 (set_attr "mode" "<MODE>")])
3835 (define_insn "<sd_mask_codefor>fma_fnmsub_<mode><sd_maskz_name><round_name>"
3836 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3839 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v"))
3840 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3842 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0"))))]
3843 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3845 vfnmsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3846 vfnmsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3847 vfnmsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
3848 [(set_attr "type" "ssemuladd")
3849 (set_attr "mode" "<MODE>")])
3851 (define_insn "<avx512>_fnmsub_<mode>_mask<round_name>"
3852 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
3853 (vec_merge:VF_AVX512VL
3856 (match_operand:VF_AVX512VL 1 "register_operand" "0,0"))
3857 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
3859 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>")))
3861 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
3862 "TARGET_AVX512F && <round_mode512bit_condition>"
3864 vfnmsub132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
3865 vfnmsub213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
3866 [(set_attr "isa" "fma_avx512f,fma_avx512f")
3867 (set_attr "type" "ssemuladd")
3868 (set_attr "mode" "<MODE>")])
3870 (define_insn "<avx512>_fnmsub_<mode>_mask3<round_name>"
3871 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
3872 (vec_merge:VF_AVX512VL
3875 (match_operand:VF_AVX512VL 1 "register_operand" "v"))
3876 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
3878 (match_operand:VF_AVX512VL 3 "register_operand" "0")))
3880 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
3882 "vfnmsub231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
3883 [(set_attr "isa" "fma_avx512f")
3884 (set_attr "type" "ssemuladd")
3885 (set_attr "mode" "<MODE>")])
3887 ;; FMA parallel floating point multiply addsub and subadd operations.
3889 ;; It would be possible to represent these without the UNSPEC as
3892 ;; (fma op1 op2 op3)
3893 ;; (fma op1 op2 (neg op3))
3896 ;; But this doesn't seem useful in practice.
3898 (define_expand "fmaddsub_<mode>"
3899 [(set (match_operand:VF 0 "register_operand")
3901 [(match_operand:VF 1 "nonimmediate_operand")
3902 (match_operand:VF 2 "nonimmediate_operand")
3903 (match_operand:VF 3 "nonimmediate_operand")]
3905 "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F")
3907 (define_expand "<avx512>_fmaddsub_<mode>_maskz<round_expand_name>"
3908 [(match_operand:VF_AVX512VL 0 "register_operand")
3909 (match_operand:VF_AVX512VL 1 "<round_expand_nimm_predicate>")
3910 (match_operand:VF_AVX512VL 2 "<round_expand_nimm_predicate>")
3911 (match_operand:VF_AVX512VL 3 "<round_expand_nimm_predicate>")
3912 (match_operand:<avx512fmaskmode> 4 "register_operand")]
3915 emit_insn (gen_fma_fmaddsub_<mode>_maskz_1<round_expand_name> (
3916 operands[0], operands[1], operands[2], operands[3],
3917 CONST0_RTX (<MODE>mode), operands[4]<round_expand_operand>));
3921 (define_insn "*fma_fmaddsub_<mode>"
3922 [(set (match_operand:VF_128_256 0 "register_operand" "=v,v,v,x,x")
3924 [(match_operand:VF_128_256 1 "nonimmediate_operand" "%0,0,v,x,x")
3925 (match_operand:VF_128_256 2 "nonimmediate_operand" "vm,v,vm,x,m")
3926 (match_operand:VF_128_256 3 "nonimmediate_operand" "v,vm,0,xm,x")]
3928 "TARGET_FMA || TARGET_FMA4"
3930 vfmaddsub132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
3931 vfmaddsub213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
3932 vfmaddsub231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
3933 vfmaddsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3934 vfmaddsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3935 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3936 (set_attr "type" "ssemuladd")
3937 (set_attr "mode" "<MODE>")])
3939 (define_insn "<sd_mask_codefor>fma_fmaddsub_<mode><sd_maskz_name><round_name>"
3940 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3941 (unspec:VF_SF_AVX512VL
3942 [(match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
3943 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3944 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0")]
3946 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3948 vfmaddsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3949 vfmaddsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3950 vfmaddsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
3951 [(set_attr "type" "ssemuladd")
3952 (set_attr "mode" "<MODE>")])
3954 (define_insn "<avx512>_fmaddsub_<mode>_mask<round_name>"
3955 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
3956 (vec_merge:VF_AVX512VL
3958 [(match_operand:VF_AVX512VL 1 "register_operand" "0,0")
3959 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
3960 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>")]
3963 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
3966 vfmaddsub132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
3967 vfmaddsub213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
3968 [(set_attr "isa" "fma_avx512f,fma_avx512f")
3969 (set_attr "type" "ssemuladd")
3970 (set_attr "mode" "<MODE>")])
3972 (define_insn "<avx512>_fmaddsub_<mode>_mask3<round_name>"
3973 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
3974 (vec_merge:VF_AVX512VL
3976 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
3977 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
3978 (match_operand:VF_AVX512VL 3 "register_operand" "0")]
3981 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
3983 "vfmaddsub231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
3984 [(set_attr "isa" "fma_avx512f")
3985 (set_attr "type" "ssemuladd")
3986 (set_attr "mode" "<MODE>")])
3988 (define_insn "*fma_fmsubadd_<mode>"
3989 [(set (match_operand:VF_128_256 0 "register_operand" "=v,v,v,x,x")
3991 [(match_operand:VF_128_256 1 "nonimmediate_operand" "%0,0,v,x,x")
3992 (match_operand:VF_128_256 2 "nonimmediate_operand" "vm,v,vm,x,m")
3994 (match_operand:VF_128_256 3 "nonimmediate_operand" "v,vm,0,xm,x"))]
3996 "TARGET_FMA || TARGET_FMA4"
3998 vfmsubadd132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
3999 vfmsubadd213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
4000 vfmsubadd231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
4001 vfmsubadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
4002 vfmsubadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
4003 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
4004 (set_attr "type" "ssemuladd")
4005 (set_attr "mode" "<MODE>")])
4007 (define_insn "<sd_mask_codefor>fma_fmsubadd_<mode><sd_maskz_name><round_name>"
4008 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
4009 (unspec:VF_SF_AVX512VL
4010 [(match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
4011 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
4013 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0"))]
4015 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
4017 vfmsubadd132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
4018 vfmsubadd213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
4019 vfmsubadd231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
4020 [(set_attr "type" "ssemuladd")
4021 (set_attr "mode" "<MODE>")])
4023 (define_insn "<avx512>_fmsubadd_<mode>_mask<round_name>"
4024 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
4025 (vec_merge:VF_AVX512VL
4027 [(match_operand:VF_AVX512VL 1 "register_operand" "0,0")
4028 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
4030 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>"))]
4033 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
4036 vfmsubadd132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
4037 vfmsubadd213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
4038 [(set_attr "isa" "fma_avx512f,fma_avx512f")
4039 (set_attr "type" "ssemuladd")
4040 (set_attr "mode" "<MODE>")])
4042 (define_insn "<avx512>_fmsubadd_<mode>_mask3<round_name>"
4043 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
4044 (vec_merge:VF_AVX512VL
4046 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
4047 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
4049 (match_operand:VF_AVX512VL 3 "register_operand" "0"))]
4052 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
4054 "vfmsubadd231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
4055 [(set_attr "isa" "fma_avx512f")
4056 (set_attr "type" "ssemuladd")
4057 (set_attr "mode" "<MODE>")])
4059 ;; FMA3 floating point scalar intrinsics. These merge result with
4060 ;; high-order elements from the destination register.
4062 (define_expand "fmai_vmfmadd_<mode><round_name>"
4063 [(set (match_operand:VF_128 0 "register_operand")
4066 (match_operand:VF_128 1 "<round_nimm_predicate>")
4067 (match_operand:VF_128 2 "<round_nimm_predicate>")
4068 (match_operand:VF_128 3 "<round_nimm_predicate>"))
4073 (define_insn "*fmai_fmadd_<mode>"
4074 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4077 (match_operand:VF_128 1 "<round_nimm_predicate>" " 0, 0")
4078 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>, v")
4079 (match_operand:VF_128 3 "<round_nimm_predicate>" " v,<round_constraint>"))
4082 "TARGET_FMA || TARGET_AVX512F"
4084 vfmadd132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
4085 vfmadd213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
4086 [(set_attr "type" "ssemuladd")
4087 (set_attr "mode" "<MODE>")])
4089 (define_insn "*fmai_fmsub_<mode>"
4090 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4093 (match_operand:VF_128 1 "<round_nimm_predicate>" "0,0")
4094 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>,v")
4096 (match_operand:VF_128 3 "<round_nimm_predicate>" " v,<round_constraint>")))
4099 "TARGET_FMA || TARGET_AVX512F"
4101 vfmsub132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
4102 vfmsub213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
4103 [(set_attr "type" "ssemuladd")
4104 (set_attr "mode" "<MODE>")])
4106 (define_insn "*fmai_fnmadd_<mode><round_name>"
4107 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4111 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>,v"))
4112 (match_operand:VF_128 1 "<round_nimm_predicate>" "0,0")
4113 (match_operand:VF_128 3 "<round_nimm_predicate>" "v,<round_constraint>"))
4116 "TARGET_FMA || TARGET_AVX512F"
4118 vfnmadd132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
4119 vfnmadd213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
4120 [(set_attr "type" "ssemuladd")
4121 (set_attr "mode" "<MODE>")])
4123 (define_insn "*fmai_fnmsub_<mode><round_name>"
4124 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4128 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>, v"))
4129 (match_operand:VF_128 1 "<round_nimm_predicate>" " 0, 0")
4131 (match_operand:VF_128 3 "<round_nimm_predicate>" " v,<round_constraint>")))
4134 "TARGET_FMA || TARGET_AVX512F"
4136 vfnmsub132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
4137 vfnmsub213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
4138 [(set_attr "type" "ssemuladd")
4139 (set_attr "mode" "<MODE>")])
4141 ;; FMA4 floating point scalar intrinsics. These write the
4142 ;; entire destination register, with the high-order elements zeroed.
4144 (define_expand "fma4i_vmfmadd_<mode>"
4145 [(set (match_operand:VF_128 0 "register_operand")
4148 (match_operand:VF_128 1 "nonimmediate_operand")
4149 (match_operand:VF_128 2 "nonimmediate_operand")
4150 (match_operand:VF_128 3 "nonimmediate_operand"))
4154 "operands[4] = CONST0_RTX (<MODE>mode);")
4156 (define_insn "*fma4i_vmfmadd_<mode>"
4157 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
4160 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x")
4161 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
4162 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x"))
4163 (match_operand:VF_128 4 "const0_operand")
4166 "vfmadd<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
4167 [(set_attr "type" "ssemuladd")
4168 (set_attr "mode" "<MODE>")])
4170 (define_insn "*fma4i_vmfmsub_<mode>"
4171 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
4174 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x")
4175 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
4177 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x")))
4178 (match_operand:VF_128 4 "const0_operand")
4181 "vfmsub<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
4182 [(set_attr "type" "ssemuladd")
4183 (set_attr "mode" "<MODE>")])
4185 (define_insn "*fma4i_vmfnmadd_<mode>"
4186 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
4190 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x"))
4191 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
4192 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x"))
4193 (match_operand:VF_128 4 "const0_operand")
4196 "vfnmadd<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
4197 [(set_attr "type" "ssemuladd")
4198 (set_attr "mode" "<MODE>")])
4200 (define_insn "*fma4i_vmfnmsub_<mode>"
4201 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
4205 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x"))
4206 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
4208 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x")))
4209 (match_operand:VF_128 4 "const0_operand")
4212 "vfnmsub<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
4213 [(set_attr "type" "ssemuladd")
4214 (set_attr "mode" "<MODE>")])
4216 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4218 ;; Parallel single-precision floating point conversion operations
4220 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4222 (define_insn "sse_cvtpi2ps"
4223 [(set (match_operand:V4SF 0 "register_operand" "=x")
4226 (float:V2SF (match_operand:V2SI 2 "nonimmediate_operand" "ym")))
4227 (match_operand:V4SF 1 "register_operand" "0")
4230 "cvtpi2ps\t{%2, %0|%0, %2}"
4231 [(set_attr "type" "ssecvt")
4232 (set_attr "mode" "V4SF")])
4234 (define_insn "sse_cvtps2pi"
4235 [(set (match_operand:V2SI 0 "register_operand" "=y")
4237 (unspec:V4SI [(match_operand:V4SF 1 "nonimmediate_operand" "xm")]
4239 (parallel [(const_int 0) (const_int 1)])))]
4241 "cvtps2pi\t{%1, %0|%0, %q1}"
4242 [(set_attr "type" "ssecvt")
4243 (set_attr "unit" "mmx")
4244 (set_attr "mode" "DI")])
4246 (define_insn "sse_cvttps2pi"
4247 [(set (match_operand:V2SI 0 "register_operand" "=y")
4249 (fix:V4SI (match_operand:V4SF 1 "nonimmediate_operand" "xm"))
4250 (parallel [(const_int 0) (const_int 1)])))]
4252 "cvttps2pi\t{%1, %0|%0, %q1}"
4253 [(set_attr "type" "ssecvt")
4254 (set_attr "unit" "mmx")
4255 (set_attr "prefix_rep" "0")
4256 (set_attr "mode" "SF")])
4258 (define_insn "sse_cvtsi2ss<round_name>"
4259 [(set (match_operand:V4SF 0 "register_operand" "=x,x,v")
4262 (float:SF (match_operand:SI 2 "<round_nimm_scalar_predicate>" "r,m,<round_constraint3>")))
4263 (match_operand:V4SF 1 "register_operand" "0,0,v")
4267 cvtsi2ss\t{%2, %0|%0, %2}
4268 cvtsi2ss\t{%2, %0|%0, %2}
4269 vcvtsi2ss\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4270 [(set_attr "isa" "noavx,noavx,avx")
4271 (set_attr "type" "sseicvt")
4272 (set_attr "athlon_decode" "vector,double,*")
4273 (set_attr "amdfam10_decode" "vector,double,*")
4274 (set_attr "bdver1_decode" "double,direct,*")
4275 (set_attr "btver2_decode" "double,double,double")
4276 (set_attr "znver1_decode" "double,double,double")
4277 (set_attr "prefix" "orig,orig,maybe_evex")
4278 (set_attr "mode" "SF")])
4280 (define_insn "sse_cvtsi2ssq<round_name>"
4281 [(set (match_operand:V4SF 0 "register_operand" "=x,x,v")
4284 (float:SF (match_operand:DI 2 "<round_nimm_scalar_predicate>" "r,m,<round_constraint3>")))
4285 (match_operand:V4SF 1 "register_operand" "0,0,v")
4287 "TARGET_SSE && TARGET_64BIT"
4289 cvtsi2ssq\t{%2, %0|%0, %2}
4290 cvtsi2ssq\t{%2, %0|%0, %2}
4291 vcvtsi2ssq\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4292 [(set_attr "isa" "noavx,noavx,avx")
4293 (set_attr "type" "sseicvt")
4294 (set_attr "athlon_decode" "vector,double,*")
4295 (set_attr "amdfam10_decode" "vector,double,*")
4296 (set_attr "bdver1_decode" "double,direct,*")
4297 (set_attr "btver2_decode" "double,double,double")
4298 (set_attr "length_vex" "*,*,4")
4299 (set_attr "prefix_rex" "1,1,*")
4300 (set_attr "prefix" "orig,orig,maybe_evex")
4301 (set_attr "mode" "SF")])
4303 (define_insn "sse_cvtss2si<round_name>"
4304 [(set (match_operand:SI 0 "register_operand" "=r,r")
4307 (match_operand:V4SF 1 "<round_nimm_scalar_predicate>" "v,<round_constraint2>")
4308 (parallel [(const_int 0)]))]
4309 UNSPEC_FIX_NOTRUNC))]
4311 "%vcvtss2si\t{<round_op2>%1, %0|%0, %k1<round_op2>}"
4312 [(set_attr "type" "sseicvt")
4313 (set_attr "athlon_decode" "double,vector")
4314 (set_attr "bdver1_decode" "double,double")
4315 (set_attr "prefix_rep" "1")
4316 (set_attr "prefix" "maybe_vex")
4317 (set_attr "mode" "SI")])
4319 (define_insn "sse_cvtss2si_2"
4320 [(set (match_operand:SI 0 "register_operand" "=r,r")
4321 (unspec:SI [(match_operand:SF 1 "nonimmediate_operand" "v,m")]
4322 UNSPEC_FIX_NOTRUNC))]
4324 "%vcvtss2si\t{%1, %0|%0, %k1}"
4325 [(set_attr "type" "sseicvt")
4326 (set_attr "athlon_decode" "double,vector")
4327 (set_attr "amdfam10_decode" "double,double")
4328 (set_attr "bdver1_decode" "double,double")
4329 (set_attr "prefix_rep" "1")
4330 (set_attr "prefix" "maybe_vex")
4331 (set_attr "mode" "SI")])
4333 (define_insn "sse_cvtss2siq<round_name>"
4334 [(set (match_operand:DI 0 "register_operand" "=r,r")
4337 (match_operand:V4SF 1 "<round_nimm_scalar_predicate>" "v,<round_constraint2>")
4338 (parallel [(const_int 0)]))]
4339 UNSPEC_FIX_NOTRUNC))]
4340 "TARGET_SSE && TARGET_64BIT"
4341 "%vcvtss2si{q}\t{<round_op2>%1, %0|%0, %k1<round_op2>}"
4342 [(set_attr "type" "sseicvt")
4343 (set_attr "athlon_decode" "double,vector")
4344 (set_attr "bdver1_decode" "double,double")
4345 (set_attr "prefix_rep" "1")
4346 (set_attr "prefix" "maybe_vex")
4347 (set_attr "mode" "DI")])
4349 (define_insn "sse_cvtss2siq_2"
4350 [(set (match_operand:DI 0 "register_operand" "=r,r")
4351 (unspec:DI [(match_operand:SF 1 "nonimmediate_operand" "v,m")]
4352 UNSPEC_FIX_NOTRUNC))]
4353 "TARGET_SSE && TARGET_64BIT"
4354 "%vcvtss2si{q}\t{%1, %0|%0, %k1}"
4355 [(set_attr "type" "sseicvt")
4356 (set_attr "athlon_decode" "double,vector")
4357 (set_attr "amdfam10_decode" "double,double")
4358 (set_attr "bdver1_decode" "double,double")
4359 (set_attr "prefix_rep" "1")
4360 (set_attr "prefix" "maybe_vex")
4361 (set_attr "mode" "DI")])
4363 (define_insn "sse_cvttss2si<round_saeonly_name>"
4364 [(set (match_operand:SI 0 "register_operand" "=r,r")
4367 (match_operand:V4SF 1 "<round_saeonly_nimm_scalar_predicate>" "v,<round_saeonly_constraint2>")
4368 (parallel [(const_int 0)]))))]
4370 "%vcvttss2si\t{<round_saeonly_op2>%1, %0|%0, %k1<round_saeonly_op2>}"
4371 [(set_attr "type" "sseicvt")
4372 (set_attr "athlon_decode" "double,vector")
4373 (set_attr "amdfam10_decode" "double,double")
4374 (set_attr "bdver1_decode" "double,double")
4375 (set_attr "prefix_rep" "1")
4376 (set_attr "prefix" "maybe_vex")
4377 (set_attr "mode" "SI")])
4379 (define_insn "sse_cvttss2siq<round_saeonly_name>"
4380 [(set (match_operand:DI 0 "register_operand" "=r,r")
4383 (match_operand:V4SF 1 "<round_saeonly_nimm_scalar_predicate>" "v,<round_saeonly_constraint>")
4384 (parallel [(const_int 0)]))))]
4385 "TARGET_SSE && TARGET_64BIT"
4386 "%vcvttss2si{q}\t{<round_saeonly_op2>%1, %0|%0, %k1<round_saeonly_op2>}"
4387 [(set_attr "type" "sseicvt")
4388 (set_attr "athlon_decode" "double,vector")
4389 (set_attr "amdfam10_decode" "double,double")
4390 (set_attr "bdver1_decode" "double,double")
4391 (set_attr "prefix_rep" "1")
4392 (set_attr "prefix" "maybe_vex")
4393 (set_attr "mode" "DI")])
4395 (define_insn "cvtusi2<ssescalarmodesuffix>32<round_name>"
4396 [(set (match_operand:VF_128 0 "register_operand" "=v")
4398 (vec_duplicate:VF_128
4399 (unsigned_float:<ssescalarmode>
4400 (match_operand:SI 2 "<round_nimm_predicate>" "<round_constraint3>")))
4401 (match_operand:VF_128 1 "register_operand" "v")
4403 "TARGET_AVX512F && <round_modev4sf_condition>"
4404 "vcvtusi2<ssescalarmodesuffix>\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4405 [(set_attr "type" "sseicvt")
4406 (set_attr "prefix" "evex")
4407 (set_attr "mode" "<ssescalarmode>")])
4409 (define_insn "cvtusi2<ssescalarmodesuffix>64<round_name>"
4410 [(set (match_operand:VF_128 0 "register_operand" "=v")
4412 (vec_duplicate:VF_128
4413 (unsigned_float:<ssescalarmode>
4414 (match_operand:DI 2 "<round_nimm_predicate>" "<round_constraint3>")))
4415 (match_operand:VF_128 1 "register_operand" "v")
4417 "TARGET_AVX512F && TARGET_64BIT"
4418 "vcvtusi2<ssescalarmodesuffix>\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4419 [(set_attr "type" "sseicvt")
4420 (set_attr "prefix" "evex")
4421 (set_attr "mode" "<ssescalarmode>")])
4423 (define_insn "float<sseintvecmodelower><mode>2<mask_name><round_name>"
4424 [(set (match_operand:VF1 0 "register_operand" "=x,v")
4426 (match_operand:<sseintvecmode> 1 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
4427 "TARGET_SSE2 && <mask_mode512bit_condition> && <round_mode512bit_condition>"
4429 cvtdq2ps\t{%1, %0|%0, %1}
4430 vcvtdq2ps\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4431 [(set_attr "isa" "noavx,avx")
4432 (set_attr "type" "ssecvt")
4433 (set_attr "prefix" "maybe_vex")
4434 (set_attr "mode" "<sseinsnmode>")])
4436 (define_insn "ufloat<sseintvecmodelower><mode>2<mask_name><round_name>"
4437 [(set (match_operand:VF1_AVX512VL 0 "register_operand" "=v")
4438 (unsigned_float:VF1_AVX512VL
4439 (match_operand:<sseintvecmode> 1 "nonimmediate_operand" "<round_constraint>")))]
4441 "vcvtudq2ps\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4442 [(set_attr "type" "ssecvt")
4443 (set_attr "prefix" "evex")
4444 (set_attr "mode" "<MODE>")])
4446 (define_expand "floatuns<sseintvecmodelower><mode>2"
4447 [(match_operand:VF1 0 "register_operand")
4448 (match_operand:<sseintvecmode> 1 "register_operand")]
4449 "TARGET_SSE2 && (<MODE>mode == V4SFmode || TARGET_AVX2)"
4451 if (<MODE>mode == V16SFmode)
4452 emit_insn (gen_ufloatv16siv16sf2 (operands[0], operands[1]));
4454 if (TARGET_AVX512VL)
4456 if (<MODE>mode == V4SFmode)
4457 emit_insn (gen_ufloatv4siv4sf2 (operands[0], operands[1]));
4459 emit_insn (gen_ufloatv8siv8sf2 (operands[0], operands[1]));
4462 ix86_expand_vector_convert_uns_vsivsf (operands[0], operands[1]);
4468 ;; For <sse2_avx_avx512f>_fix_notrunc<sf2simodelower><mode> insn pattern
4469 (define_mode_attr sf2simodelower
4470 [(V16SI "v16sf") (V8SI "v8sf") (V4SI "v4sf")])
4472 (define_insn "<sse2_avx_avx512f>_fix_notrunc<sf2simodelower><mode><mask_name>"
4473 [(set (match_operand:VI4_AVX 0 "register_operand" "=v")
4475 [(match_operand:<ssePSmode> 1 "vector_operand" "vBm")]
4476 UNSPEC_FIX_NOTRUNC))]
4477 "TARGET_SSE2 && <mask_mode512bit_condition>"
4478 "%vcvtps2dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4479 [(set_attr "type" "ssecvt")
4480 (set (attr "prefix_data16")
4482 (match_test "TARGET_AVX")
4484 (const_string "1")))
4485 (set_attr "prefix" "maybe_vex")
4486 (set_attr "mode" "<sseinsnmode>")])
4488 (define_insn "<mask_codefor>avx512f_fix_notruncv16sfv16si<mask_name><round_name>"
4489 [(set (match_operand:V16SI 0 "register_operand" "=v")
4491 [(match_operand:V16SF 1 "<round_nimm_predicate>" "<round_constraint>")]
4492 UNSPEC_FIX_NOTRUNC))]
4494 "vcvtps2dq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4495 [(set_attr "type" "ssecvt")
4496 (set_attr "prefix" "evex")
4497 (set_attr "mode" "XI")])
4499 (define_insn "<mask_codefor><avx512>_ufix_notrunc<sf2simodelower><mode><mask_name><round_name>"
4500 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
4501 (unspec:VI4_AVX512VL
4502 [(match_operand:<ssePSmode> 1 "nonimmediate_operand" "<round_constraint>")]
4503 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4505 "vcvtps2udq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4506 [(set_attr "type" "ssecvt")
4507 (set_attr "prefix" "evex")
4508 (set_attr "mode" "<sseinsnmode>")])
4510 (define_insn "<mask_codefor>avx512dq_cvtps2qq<mode><mask_name><round_name>"
4511 [(set (match_operand:VI8_256_512 0 "register_operand" "=v")
4512 (unspec:VI8_256_512 [(match_operand:<ssePSmode2> 1 "nonimmediate_operand" "<round_constraint>")]
4513 UNSPEC_FIX_NOTRUNC))]
4514 "TARGET_AVX512DQ && <round_mode512bit_condition>"
4515 "vcvtps2qq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4516 [(set_attr "type" "ssecvt")
4517 (set_attr "prefix" "evex")
4518 (set_attr "mode" "<sseinsnmode>")])
4520 (define_insn "<mask_codefor>avx512dq_cvtps2qqv2di<mask_name>"
4521 [(set (match_operand:V2DI 0 "register_operand" "=v")
4524 (match_operand:V4SF 1 "nonimmediate_operand" "vm")
4525 (parallel [(const_int 0) (const_int 1)]))]
4526 UNSPEC_FIX_NOTRUNC))]
4527 "TARGET_AVX512DQ && TARGET_AVX512VL"
4528 "vcvtps2qq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4529 [(set_attr "type" "ssecvt")
4530 (set_attr "prefix" "evex")
4531 (set_attr "mode" "TI")])
4533 (define_insn "<mask_codefor>avx512dq_cvtps2uqq<mode><mask_name><round_name>"
4534 [(set (match_operand:VI8_256_512 0 "register_operand" "=v")
4535 (unspec:VI8_256_512 [(match_operand:<ssePSmode2> 1 "nonimmediate_operand" "<round_constraint>")]
4536 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4537 "TARGET_AVX512DQ && <round_mode512bit_condition>"
4538 "vcvtps2uqq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4539 [(set_attr "type" "ssecvt")
4540 (set_attr "prefix" "evex")
4541 (set_attr "mode" "<sseinsnmode>")])
4543 (define_insn "<mask_codefor>avx512dq_cvtps2uqqv2di<mask_name>"
4544 [(set (match_operand:V2DI 0 "register_operand" "=v")
4547 (match_operand:V4SF 1 "nonimmediate_operand" "vm")
4548 (parallel [(const_int 0) (const_int 1)]))]
4549 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4550 "TARGET_AVX512DQ && TARGET_AVX512VL"
4551 "vcvtps2uqq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4552 [(set_attr "type" "ssecvt")
4553 (set_attr "prefix" "evex")
4554 (set_attr "mode" "TI")])
4556 (define_insn "<fixsuffix>fix_truncv16sfv16si2<mask_name><round_saeonly_name>"
4557 [(set (match_operand:V16SI 0 "register_operand" "=v")
4559 (match_operand:V16SF 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
4561 "vcvttps2<fixsuffix>dq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
4562 [(set_attr "type" "ssecvt")
4563 (set_attr "prefix" "evex")
4564 (set_attr "mode" "XI")])
4566 (define_insn "fix_truncv8sfv8si2<mask_name>"
4567 [(set (match_operand:V8SI 0 "register_operand" "=v")
4568 (fix:V8SI (match_operand:V8SF 1 "nonimmediate_operand" "vm")))]
4569 "TARGET_AVX && <mask_avx512vl_condition>"
4570 "vcvttps2dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4571 [(set_attr "type" "ssecvt")
4572 (set_attr "prefix" "<mask_prefix>")
4573 (set_attr "mode" "OI")])
4575 (define_insn "fix_truncv4sfv4si2<mask_name>"
4576 [(set (match_operand:V4SI 0 "register_operand" "=v")
4577 (fix:V4SI (match_operand:V4SF 1 "vector_operand" "vBm")))]
4578 "TARGET_SSE2 && <mask_avx512vl_condition>"
4579 "%vcvttps2dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4580 [(set_attr "type" "ssecvt")
4581 (set (attr "prefix_rep")
4583 (match_test "TARGET_AVX")
4585 (const_string "1")))
4586 (set (attr "prefix_data16")
4588 (match_test "TARGET_AVX")
4590 (const_string "0")))
4591 (set_attr "prefix_data16" "0")
4592 (set_attr "prefix" "<mask_prefix2>")
4593 (set_attr "mode" "TI")])
4595 (define_expand "fixuns_trunc<mode><sseintvecmodelower>2"
4596 [(match_operand:<sseintvecmode> 0 "register_operand")
4597 (match_operand:VF1 1 "register_operand")]
4600 if (<MODE>mode == V16SFmode)
4601 emit_insn (gen_ufix_truncv16sfv16si2 (operands[0],
4606 tmp[0] = ix86_expand_adjust_ufix_to_sfix_si (operands[1], &tmp[2]);
4607 tmp[1] = gen_reg_rtx (<sseintvecmode>mode);
4608 emit_insn (gen_fix_trunc<mode><sseintvecmodelower>2 (tmp[1], tmp[0]));
4609 emit_insn (gen_xor<sseintvecmodelower>3 (operands[0], tmp[1], tmp[2]));
4614 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4616 ;; Parallel double-precision floating point conversion operations
4618 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4620 (define_insn "sse2_cvtpi2pd"
4621 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
4622 (float:V2DF (match_operand:V2SI 1 "nonimmediate_operand" "y,m")))]
4624 "cvtpi2pd\t{%1, %0|%0, %1}"
4625 [(set_attr "type" "ssecvt")
4626 (set_attr "unit" "mmx,*")
4627 (set_attr "prefix_data16" "1,*")
4628 (set_attr "mode" "V2DF")])
4630 (define_insn "sse2_cvtpd2pi"
4631 [(set (match_operand:V2SI 0 "register_operand" "=y")
4632 (unspec:V2SI [(match_operand:V2DF 1 "nonimmediate_operand" "xm")]
4633 UNSPEC_FIX_NOTRUNC))]
4635 "cvtpd2pi\t{%1, %0|%0, %1}"
4636 [(set_attr "type" "ssecvt")
4637 (set_attr "unit" "mmx")
4638 (set_attr "bdver1_decode" "double")
4639 (set_attr "btver2_decode" "direct")
4640 (set_attr "prefix_data16" "1")
4641 (set_attr "mode" "DI")])
4643 (define_insn "sse2_cvttpd2pi"
4644 [(set (match_operand:V2SI 0 "register_operand" "=y")
4645 (fix:V2SI (match_operand:V2DF 1 "nonimmediate_operand" "xm")))]
4647 "cvttpd2pi\t{%1, %0|%0, %1}"
4648 [(set_attr "type" "ssecvt")
4649 (set_attr "unit" "mmx")
4650 (set_attr "bdver1_decode" "double")
4651 (set_attr "prefix_data16" "1")
4652 (set_attr "mode" "TI")])
4654 (define_insn "sse2_cvtsi2sd"
4655 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
4658 (float:DF (match_operand:SI 2 "nonimmediate_operand" "r,m,rm")))
4659 (match_operand:V2DF 1 "register_operand" "0,0,v")
4663 cvtsi2sd\t{%2, %0|%0, %2}
4664 cvtsi2sd\t{%2, %0|%0, %2}
4665 vcvtsi2sd\t{%2, %1, %0|%0, %1, %2}"
4666 [(set_attr "isa" "noavx,noavx,avx")
4667 (set_attr "type" "sseicvt")
4668 (set_attr "athlon_decode" "double,direct,*")
4669 (set_attr "amdfam10_decode" "vector,double,*")
4670 (set_attr "bdver1_decode" "double,direct,*")
4671 (set_attr "btver2_decode" "double,double,double")
4672 (set_attr "znver1_decode" "double,double,double")
4673 (set_attr "prefix" "orig,orig,maybe_evex")
4674 (set_attr "mode" "DF")])
4676 (define_insn "sse2_cvtsi2sdq<round_name>"
4677 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
4680 (float:DF (match_operand:DI 2 "<round_nimm_scalar_predicate>" "r,m,<round_constraint3>")))
4681 (match_operand:V2DF 1 "register_operand" "0,0,v")
4683 "TARGET_SSE2 && TARGET_64BIT"
4685 cvtsi2sdq\t{%2, %0|%0, %2}
4686 cvtsi2sdq\t{%2, %0|%0, %2}
4687 vcvtsi2sdq\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4688 [(set_attr "isa" "noavx,noavx,avx")
4689 (set_attr "type" "sseicvt")
4690 (set_attr "athlon_decode" "double,direct,*")
4691 (set_attr "amdfam10_decode" "vector,double,*")
4692 (set_attr "bdver1_decode" "double,direct,*")
4693 (set_attr "length_vex" "*,*,4")
4694 (set_attr "prefix_rex" "1,1,*")
4695 (set_attr "prefix" "orig,orig,maybe_evex")
4696 (set_attr "mode" "DF")])
4698 (define_insn "avx512f_vcvtss2usi<round_name>"
4699 [(set (match_operand:SI 0 "register_operand" "=r")
4702 (match_operand:V4SF 1 "<round_nimm_predicate>" "<round_constraint>")
4703 (parallel [(const_int 0)]))]
4704 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4706 "vcvtss2usi\t{<round_op2>%1, %0|%0, %1<round_op2>}"
4707 [(set_attr "type" "sseicvt")
4708 (set_attr "prefix" "evex")
4709 (set_attr "mode" "SI")])
4711 (define_insn "avx512f_vcvtss2usiq<round_name>"
4712 [(set (match_operand:DI 0 "register_operand" "=r")
4715 (match_operand:V4SF 1 "<round_nimm_predicate>" "<round_constraint>")
4716 (parallel [(const_int 0)]))]
4717 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4718 "TARGET_AVX512F && TARGET_64BIT"
4719 "vcvtss2usi\t{<round_op2>%1, %0|%0, %1<round_op2>}"
4720 [(set_attr "type" "sseicvt")
4721 (set_attr "prefix" "evex")
4722 (set_attr "mode" "DI")])
4724 (define_insn "avx512f_vcvttss2usi<round_saeonly_name>"
4725 [(set (match_operand:SI 0 "register_operand" "=r")
4728 (match_operand:V4SF 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
4729 (parallel [(const_int 0)]))))]
4731 "vcvttss2usi\t{<round_saeonly_op2>%1, %0|%0, %1<round_saeonly_op2>}"
4732 [(set_attr "type" "sseicvt")
4733 (set_attr "prefix" "evex")
4734 (set_attr "mode" "SI")])
4736 (define_insn "avx512f_vcvttss2usiq<round_saeonly_name>"
4737 [(set (match_operand:DI 0 "register_operand" "=r")
4740 (match_operand:V4SF 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
4741 (parallel [(const_int 0)]))))]
4742 "TARGET_AVX512F && TARGET_64BIT"
4743 "vcvttss2usi\t{<round_saeonly_op2>%1, %0|%0, %1<round_saeonly_op2>}"
4744 [(set_attr "type" "sseicvt")
4745 (set_attr "prefix" "evex")
4746 (set_attr "mode" "DI")])
4748 (define_insn "avx512f_vcvtsd2usi<round_name>"
4749 [(set (match_operand:SI 0 "register_operand" "=r")
4752 (match_operand:V2DF 1 "<round_nimm_predicate>" "<round_constraint>")
4753 (parallel [(const_int 0)]))]
4754 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4756 "vcvtsd2usi\t{<round_op2>%1, %0|%0, %1<round_op2>}"
4757 [(set_attr "type" "sseicvt")
4758 (set_attr "prefix" "evex")
4759 (set_attr "mode" "SI")])
4761 (define_insn "avx512f_vcvtsd2usiq<round_name>"
4762 [(set (match_operand:DI 0 "register_operand" "=r")
4765 (match_operand:V2DF 1 "<round_nimm_predicate>" "<round_constraint>")
4766 (parallel [(const_int 0)]))]
4767 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4768 "TARGET_AVX512F && TARGET_64BIT"
4769 "vcvtsd2usi\t{<round_op2>%1, %0|%0, %1<round_op2>}"
4770 [(set_attr "type" "sseicvt")
4771 (set_attr "prefix" "evex")
4772 (set_attr "mode" "DI")])
4774 (define_insn "avx512f_vcvttsd2usi<round_saeonly_name>"
4775 [(set (match_operand:SI 0 "register_operand" "=r")
4778 (match_operand:V2DF 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
4779 (parallel [(const_int 0)]))))]
4781 "vcvttsd2usi\t{<round_saeonly_op2>%1, %0|%0, %1<round_saeonly_op2>}"
4782 [(set_attr "type" "sseicvt")
4783 (set_attr "prefix" "evex")
4784 (set_attr "mode" "SI")])
4786 (define_insn "avx512f_vcvttsd2usiq<round_saeonly_name>"
4787 [(set (match_operand:DI 0 "register_operand" "=r")
4790 (match_operand:V2DF 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
4791 (parallel [(const_int 0)]))))]
4792 "TARGET_AVX512F && TARGET_64BIT"
4793 "vcvttsd2usi\t{<round_saeonly_op2>%1, %0|%0, %1<round_saeonly_op2>}"
4794 [(set_attr "type" "sseicvt")
4795 (set_attr "prefix" "evex")
4796 (set_attr "mode" "DI")])
4798 (define_insn "sse2_cvtsd2si<round_name>"
4799 [(set (match_operand:SI 0 "register_operand" "=r,r")
4802 (match_operand:V2DF 1 "<round_nimm_scalar_predicate>" "v,<round_constraint2>")
4803 (parallel [(const_int 0)]))]
4804 UNSPEC_FIX_NOTRUNC))]
4806 "%vcvtsd2si\t{<round_op2>%1, %0|%0, %q1<round_op2>}"
4807 [(set_attr "type" "sseicvt")
4808 (set_attr "athlon_decode" "double,vector")
4809 (set_attr "bdver1_decode" "double,double")
4810 (set_attr "btver2_decode" "double,double")
4811 (set_attr "prefix_rep" "1")
4812 (set_attr "prefix" "maybe_vex")
4813 (set_attr "mode" "SI")])
4815 (define_insn "sse2_cvtsd2si_2"
4816 [(set (match_operand:SI 0 "register_operand" "=r,r")
4817 (unspec:SI [(match_operand:DF 1 "nonimmediate_operand" "v,m")]
4818 UNSPEC_FIX_NOTRUNC))]
4820 "%vcvtsd2si\t{%1, %0|%0, %q1}"
4821 [(set_attr "type" "sseicvt")
4822 (set_attr "athlon_decode" "double,vector")
4823 (set_attr "amdfam10_decode" "double,double")
4824 (set_attr "bdver1_decode" "double,double")
4825 (set_attr "prefix_rep" "1")
4826 (set_attr "prefix" "maybe_vex")
4827 (set_attr "mode" "SI")])
4829 (define_insn "sse2_cvtsd2siq<round_name>"
4830 [(set (match_operand:DI 0 "register_operand" "=r,r")
4833 (match_operand:V2DF 1 "<round_nimm_scalar_predicate>" "v,<round_constraint2>")
4834 (parallel [(const_int 0)]))]
4835 UNSPEC_FIX_NOTRUNC))]
4836 "TARGET_SSE2 && TARGET_64BIT"
4837 "%vcvtsd2si{q}\t{<round_op2>%1, %0|%0, %q1<round_op2>}"
4838 [(set_attr "type" "sseicvt")
4839 (set_attr "athlon_decode" "double,vector")
4840 (set_attr "bdver1_decode" "double,double")
4841 (set_attr "prefix_rep" "1")
4842 (set_attr "prefix" "maybe_vex")
4843 (set_attr "mode" "DI")])
4845 (define_insn "sse2_cvtsd2siq_2"
4846 [(set (match_operand:DI 0 "register_operand" "=r,r")
4847 (unspec:DI [(match_operand:DF 1 "nonimmediate_operand" "v,m")]
4848 UNSPEC_FIX_NOTRUNC))]
4849 "TARGET_SSE2 && TARGET_64BIT"
4850 "%vcvtsd2si{q}\t{%1, %0|%0, %q1}"
4851 [(set_attr "type" "sseicvt")
4852 (set_attr "athlon_decode" "double,vector")
4853 (set_attr "amdfam10_decode" "double,double")
4854 (set_attr "bdver1_decode" "double,double")
4855 (set_attr "prefix_rep" "1")
4856 (set_attr "prefix" "maybe_vex")
4857 (set_attr "mode" "DI")])
4859 (define_insn "sse2_cvttsd2si<round_saeonly_name>"
4860 [(set (match_operand:SI 0 "register_operand" "=r,r")
4863 (match_operand:V2DF 1 "<round_saeonly_nimm_scalar_predicate>" "v,<round_saeonly_constraint2>")
4864 (parallel [(const_int 0)]))))]
4866 "%vcvttsd2si\t{<round_saeonly_op2>%1, %0|%0, %q1<round_saeonly_op2>}"
4867 [(set_attr "type" "sseicvt")
4868 (set_attr "athlon_decode" "double,vector")
4869 (set_attr "amdfam10_decode" "double,double")
4870 (set_attr "bdver1_decode" "double,double")
4871 (set_attr "btver2_decode" "double,double")
4872 (set_attr "prefix_rep" "1")
4873 (set_attr "prefix" "maybe_vex")
4874 (set_attr "mode" "SI")])
4876 (define_insn "sse2_cvttsd2siq<round_saeonly_name>"
4877 [(set (match_operand:DI 0 "register_operand" "=r,r")
4880 (match_operand:V2DF 1 "<round_saeonly_nimm_scalar_predicate>" "v,<round_saeonly_constraint2>")
4881 (parallel [(const_int 0)]))))]
4882 "TARGET_SSE2 && TARGET_64BIT"
4883 "%vcvttsd2si{q}\t{<round_saeonly_op2>%1, %0|%0, %q1<round_saeonly_op2>}"
4884 [(set_attr "type" "sseicvt")
4885 (set_attr "athlon_decode" "double,vector")
4886 (set_attr "amdfam10_decode" "double,double")
4887 (set_attr "bdver1_decode" "double,double")
4888 (set_attr "prefix_rep" "1")
4889 (set_attr "prefix" "maybe_vex")
4890 (set_attr "mode" "DI")])
4892 ;; For float<si2dfmode><mode>2 insn pattern
4893 (define_mode_attr si2dfmode
4894 [(V8DF "V8SI") (V4DF "V4SI")])
4895 (define_mode_attr si2dfmodelower
4896 [(V8DF "v8si") (V4DF "v4si")])
4898 (define_insn "float<si2dfmodelower><mode>2<mask_name>"
4899 [(set (match_operand:VF2_512_256 0 "register_operand" "=v")
4900 (float:VF2_512_256 (match_operand:<si2dfmode> 1 "nonimmediate_operand" "vm")))]
4901 "TARGET_AVX && <mask_mode512bit_condition>"
4902 "vcvtdq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4903 [(set_attr "type" "ssecvt")
4904 (set_attr "prefix" "maybe_vex")
4905 (set_attr "mode" "<MODE>")])
4907 (define_insn "<floatsuffix>float<sseintvecmodelower><mode>2<mask_name><round_name>"
4908 [(set (match_operand:VF2_AVX512VL 0 "register_operand" "=v")
4909 (any_float:VF2_AVX512VL
4910 (match_operand:<sseintvecmode> 1 "nonimmediate_operand" "vm")))]
4912 "vcvt<floatsuffix>qq2pd\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4913 [(set_attr "type" "ssecvt")
4914 (set_attr "prefix" "evex")
4915 (set_attr "mode" "<MODE>")])
4917 ;; For <floatsuffix>float<sselondveclower><mode> insn patterns
4918 (define_mode_attr qq2pssuff
4919 [(V8SF "") (V4SF "{y}")])
4921 (define_mode_attr sselongvecmode
4922 [(V8SF "V8DI") (V4SF "V4DI")])
4924 (define_mode_attr sselongvecmodelower
4925 [(V8SF "v8di") (V4SF "v4di")])
4927 (define_mode_attr sseintvecmode3
4928 [(V8SF "XI") (V4SF "OI")
4929 (V8DF "OI") (V4DF "TI")])
4931 (define_insn "<floatsuffix>float<sselongvecmodelower><mode>2<mask_name><round_name>"
4932 [(set (match_operand:VF1_128_256VL 0 "register_operand" "=v")
4933 (any_float:VF1_128_256VL
4934 (match_operand:<sselongvecmode> 1 "nonimmediate_operand" "<round_constraint>")))]
4935 "TARGET_AVX512DQ && <round_modev8sf_condition>"
4936 "vcvt<floatsuffix>qq2ps<qq2pssuff>\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4937 [(set_attr "type" "ssecvt")
4938 (set_attr "prefix" "evex")
4939 (set_attr "mode" "<MODE>")])
4941 (define_insn "*<floatsuffix>floatv2div2sf2"
4942 [(set (match_operand:V4SF 0 "register_operand" "=v")
4944 (any_float:V2SF (match_operand:V2DI 1 "nonimmediate_operand" "vm"))
4945 (const_vector:V2SF [(const_int 0) (const_int 0)])))]
4946 "TARGET_AVX512DQ && TARGET_AVX512VL"
4947 "vcvt<floatsuffix>qq2ps{x}\t{%1, %0|%0, %1}"
4948 [(set_attr "type" "ssecvt")
4949 (set_attr "prefix" "evex")
4950 (set_attr "mode" "V4SF")])
4952 (define_insn "<floatsuffix>floatv2div2sf2_mask"
4953 [(set (match_operand:V4SF 0 "register_operand" "=v")
4956 (any_float:V2SF (match_operand:V2DI 1 "nonimmediate_operand" "vm"))
4958 (match_operand:V4SF 2 "vector_move_operand" "0C")
4959 (parallel [(const_int 0) (const_int 1)]))
4960 (match_operand:QI 3 "register_operand" "Yk"))
4961 (const_vector:V2SF [(const_int 0) (const_int 0)])))]
4962 "TARGET_AVX512DQ && TARGET_AVX512VL"
4963 "vcvt<floatsuffix>qq2ps{x}\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
4964 [(set_attr "type" "ssecvt")
4965 (set_attr "prefix" "evex")
4966 (set_attr "mode" "V4SF")])
4968 (define_insn "*<floatsuffix>floatv2div2sf2_mask_1"
4969 [(set (match_operand:V4SF 0 "register_operand" "=v")
4972 (any_float:V2SF (match_operand:V2DI 1
4973 "nonimmediate_operand" "vm"))
4974 (const_vector:V2SF [(const_int 0) (const_int 0)])
4975 (match_operand:QI 2 "register_operand" "Yk"))
4976 (const_vector:V2SF [(const_int 0) (const_int 0)])))]
4977 "TARGET_AVX512DQ && TARGET_AVX512VL"
4978 "vcvt<floatsuffix>qq2ps{x}\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
4979 [(set_attr "type" "ssecvt")
4980 (set_attr "prefix" "evex")
4981 (set_attr "mode" "V4SF")])
4983 (define_insn "ufloat<si2dfmodelower><mode>2<mask_name>"
4984 [(set (match_operand:VF2_512_256VL 0 "register_operand" "=v")
4985 (unsigned_float:VF2_512_256VL
4986 (match_operand:<si2dfmode> 1 "nonimmediate_operand" "vm")))]
4988 "vcvtudq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4989 [(set_attr "type" "ssecvt")
4990 (set_attr "prefix" "evex")
4991 (set_attr "mode" "<MODE>")])
4993 (define_insn "ufloatv2siv2df2<mask_name>"
4994 [(set (match_operand:V2DF 0 "register_operand" "=v")
4995 (unsigned_float:V2DF
4997 (match_operand:V4SI 1 "nonimmediate_operand" "vm")
4998 (parallel [(const_int 0) (const_int 1)]))))]
5000 "vcvtudq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5001 [(set_attr "type" "ssecvt")
5002 (set_attr "prefix" "evex")
5003 (set_attr "mode" "V2DF")])
5005 (define_insn "avx512f_cvtdq2pd512_2"
5006 [(set (match_operand:V8DF 0 "register_operand" "=v")
5009 (match_operand:V16SI 1 "nonimmediate_operand" "vm")
5010 (parallel [(const_int 0) (const_int 1)
5011 (const_int 2) (const_int 3)
5012 (const_int 4) (const_int 5)
5013 (const_int 6) (const_int 7)]))))]
5015 "vcvtdq2pd\t{%t1, %0|%0, %t1}"
5016 [(set_attr "type" "ssecvt")
5017 (set_attr "prefix" "evex")
5018 (set_attr "mode" "V8DF")])
5020 (define_insn "avx_cvtdq2pd256_2"
5021 [(set (match_operand:V4DF 0 "register_operand" "=v")
5024 (match_operand:V8SI 1 "nonimmediate_operand" "vm")
5025 (parallel [(const_int 0) (const_int 1)
5026 (const_int 2) (const_int 3)]))))]
5028 "vcvtdq2pd\t{%x1, %0|%0, %x1}"
5029 [(set_attr "type" "ssecvt")
5030 (set_attr "prefix" "maybe_evex")
5031 (set_attr "mode" "V4DF")])
5033 (define_insn "sse2_cvtdq2pd<mask_name>"
5034 [(set (match_operand:V2DF 0 "register_operand" "=v")
5037 (match_operand:V4SI 1 "nonimmediate_operand" "vm")
5038 (parallel [(const_int 0) (const_int 1)]))))]
5039 "TARGET_SSE2 && <mask_avx512vl_condition>"
5040 "%vcvtdq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
5041 [(set_attr "type" "ssecvt")
5042 (set_attr "prefix" "maybe_vex")
5043 (set_attr "ssememalign" "64")
5044 (set_attr "mode" "V2DF")])
5046 (define_insn "<mask_codefor>avx512f_cvtpd2dq512<mask_name><round_name>"
5047 [(set (match_operand:V8SI 0 "register_operand" "=v")
5049 [(match_operand:V8DF 1 "<round_nimm_predicate>" "<round_constraint>")]
5050 UNSPEC_FIX_NOTRUNC))]
5052 "vcvtpd2dq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5053 [(set_attr "type" "ssecvt")
5054 (set_attr "prefix" "evex")
5055 (set_attr "mode" "OI")])
5057 (define_insn "avx_cvtpd2dq256<mask_name>"
5058 [(set (match_operand:V4SI 0 "register_operand" "=v")
5059 (unspec:V4SI [(match_operand:V4DF 1 "nonimmediate_operand" "vm")]
5060 UNSPEC_FIX_NOTRUNC))]
5061 "TARGET_AVX && <mask_avx512vl_condition>"
5062 "vcvtpd2dq{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5063 [(set_attr "type" "ssecvt")
5064 (set_attr "prefix" "<mask_prefix>")
5065 (set_attr "mode" "OI")])
5067 (define_expand "avx_cvtpd2dq256_2"
5068 [(set (match_operand:V8SI 0 "register_operand")
5070 (unspec:V4SI [(match_operand:V4DF 1 "nonimmediate_operand")]
5074 "operands[2] = CONST0_RTX (V4SImode);")
5076 (define_insn "*avx_cvtpd2dq256_2"
5077 [(set (match_operand:V8SI 0 "register_operand" "=x")
5079 (unspec:V4SI [(match_operand:V4DF 1 "nonimmediate_operand" "xm")]
5081 (match_operand:V4SI 2 "const0_operand")))]
5083 "vcvtpd2dq{y}\t{%1, %x0|%x0, %1}"
5084 [(set_attr "type" "ssecvt")
5085 (set_attr "prefix" "vex")
5086 (set_attr "btver2_decode" "vector")
5087 (set_attr "mode" "OI")])
5089 (define_insn "sse2_cvtpd2dq<mask_name>"
5090 [(set (match_operand:V4SI 0 "register_operand" "=v")
5092 (unspec:V2SI [(match_operand:V2DF 1 "vector_operand" "vBm")]
5094 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
5095 "TARGET_SSE2 && <mask_avx512vl_condition>"
5098 return "vcvtpd2dq{x}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}";
5100 return "cvtpd2dq\t{%1, %0|%0, %1}";
5102 [(set_attr "type" "ssecvt")
5103 (set_attr "prefix_rep" "1")
5104 (set_attr "prefix_data16" "0")
5105 (set_attr "prefix" "maybe_vex")
5106 (set_attr "mode" "TI")
5107 (set_attr "amdfam10_decode" "double")
5108 (set_attr "athlon_decode" "vector")
5109 (set_attr "bdver1_decode" "double")])
5111 ;; For ufix_notrunc* insn patterns
5112 (define_mode_attr pd2udqsuff
5113 [(V8DF "") (V4DF "{y}")])
5115 (define_insn "ufix_notrunc<mode><si2dfmodelower>2<mask_name><round_name>"
5116 [(set (match_operand:<si2dfmode> 0 "register_operand" "=v")
5118 [(match_operand:VF2_512_256VL 1 "nonimmediate_operand" "<round_constraint>")]
5119 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
5121 "vcvtpd2udq<pd2udqsuff>\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5122 [(set_attr "type" "ssecvt")
5123 (set_attr "prefix" "evex")
5124 (set_attr "mode" "<sseinsnmode>")])
5126 (define_insn "ufix_notruncv2dfv2si2<mask_name>"
5127 [(set (match_operand:V4SI 0 "register_operand" "=v")
5130 [(match_operand:V2DF 1 "nonimmediate_operand" "vm")]
5131 UNSPEC_UNSIGNED_FIX_NOTRUNC)
5132 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
5134 "vcvtpd2udq{x}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5135 [(set_attr "type" "ssecvt")
5136 (set_attr "prefix" "evex")
5137 (set_attr "mode" "TI")])
5139 (define_insn "<fixsuffix>fix_truncv8dfv8si2<mask_name><round_saeonly_name>"
5140 [(set (match_operand:V8SI 0 "register_operand" "=v")
5142 (match_operand:V8DF 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
5144 "vcvttpd2<fixsuffix>dq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
5145 [(set_attr "type" "ssecvt")
5146 (set_attr "prefix" "evex")
5147 (set_attr "mode" "OI")])
5149 (define_insn "ufix_truncv2dfv2si2<mask_name>"
5150 [(set (match_operand:V4SI 0 "register_operand" "=v")
5152 (unsigned_fix:V2SI (match_operand:V2DF 1 "nonimmediate_operand" "vm"))
5153 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
5155 "vcvttpd2udq{x}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5156 [(set_attr "type" "ssecvt")
5157 (set_attr "prefix" "evex")
5158 (set_attr "mode" "TI")])
5160 (define_insn "fix_truncv4dfv4si2<mask_name>"
5161 [(set (match_operand:V4SI 0 "register_operand" "=v")
5162 (fix:V4SI (match_operand:V4DF 1 "nonimmediate_operand" "vm")))]
5163 "TARGET_AVX || (TARGET_AVX512VL && TARGET_AVX512F)"
5164 "vcvttpd2dq{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5165 [(set_attr "type" "ssecvt")
5166 (set_attr "prefix" "maybe_evex")
5167 (set_attr "mode" "OI")])
5169 (define_insn "ufix_truncv4dfv4si2<mask_name>"
5170 [(set (match_operand:V4SI 0 "register_operand" "=v")
5171 (unsigned_fix:V4SI (match_operand:V4DF 1 "nonimmediate_operand" "vm")))]
5172 "TARGET_AVX512VL && TARGET_AVX512F"
5173 "vcvttpd2udq{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5174 [(set_attr "type" "ssecvt")
5175 (set_attr "prefix" "maybe_evex")
5176 (set_attr "mode" "OI")])
5178 (define_insn "<fixsuffix>fix_trunc<mode><sseintvecmodelower>2<mask_name><round_saeonly_name>"
5179 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
5180 (any_fix:<sseintvecmode>
5181 (match_operand:VF2_AVX512VL 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
5182 "TARGET_AVX512DQ && <round_saeonly_mode512bit_condition>"
5183 "vcvttpd2<fixsuffix>qq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
5184 [(set_attr "type" "ssecvt")
5185 (set_attr "prefix" "evex")
5186 (set_attr "mode" "<sseintvecmode2>")])
5188 (define_insn "fix_notrunc<mode><sseintvecmodelower>2<mask_name><round_name>"
5189 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
5190 (unspec:<sseintvecmode>
5191 [(match_operand:VF2_AVX512VL 1 "<round_nimm_predicate>" "<round_constraint>")]
5192 UNSPEC_FIX_NOTRUNC))]
5193 "TARGET_AVX512DQ && <round_mode512bit_condition>"
5194 "vcvtpd2qq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5195 [(set_attr "type" "ssecvt")
5196 (set_attr "prefix" "evex")
5197 (set_attr "mode" "<sseintvecmode2>")])
5199 (define_insn "ufix_notrunc<mode><sseintvecmodelower>2<mask_name><round_name>"
5200 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
5201 (unspec:<sseintvecmode>
5202 [(match_operand:VF2_AVX512VL 1 "nonimmediate_operand" "<round_constraint>")]
5203 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
5204 "TARGET_AVX512DQ && <round_mode512bit_condition>"
5205 "vcvtpd2uqq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5206 [(set_attr "type" "ssecvt")
5207 (set_attr "prefix" "evex")
5208 (set_attr "mode" "<sseintvecmode2>")])
5210 (define_insn "<fixsuffix>fix_trunc<mode><sselongvecmodelower>2<mask_name><round_saeonly_name>"
5211 [(set (match_operand:<sselongvecmode> 0 "register_operand" "=v")
5212 (any_fix:<sselongvecmode>
5213 (match_operand:VF1_128_256VL 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
5214 "TARGET_AVX512DQ && <round_saeonly_modev8sf_condition>"
5215 "vcvttps2<fixsuffix>qq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
5216 [(set_attr "type" "ssecvt")
5217 (set_attr "prefix" "evex")
5218 (set_attr "mode" "<sseintvecmode3>")])
5220 (define_insn "<fixsuffix>fix_truncv2sfv2di2<mask_name>"
5221 [(set (match_operand:V2DI 0 "register_operand" "=v")
5224 (match_operand:V4SF 1 "nonimmediate_operand" "vm")
5225 (parallel [(const_int 0) (const_int 1)]))))]
5226 "TARGET_AVX512DQ && TARGET_AVX512VL"
5227 "vcvttps2<fixsuffix>qq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5228 [(set_attr "type" "ssecvt")
5229 (set_attr "prefix" "evex")
5230 (set_attr "mode" "TI")])
5232 (define_insn "ufix_trunc<mode><sseintvecmodelower>2<mask_name>"
5233 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
5234 (unsigned_fix:<sseintvecmode>
5235 (match_operand:VF1_128_256VL 1 "nonimmediate_operand" "vm")))]
5237 "vcvttps2udq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5238 [(set_attr "type" "ssecvt")
5239 (set_attr "prefix" "evex")
5240 (set_attr "mode" "<sseintvecmode2>")])
5242 (define_expand "avx_cvttpd2dq256_2"
5243 [(set (match_operand:V8SI 0 "register_operand")
5245 (fix:V4SI (match_operand:V4DF 1 "nonimmediate_operand"))
5248 "operands[2] = CONST0_RTX (V4SImode);")
5250 (define_insn "sse2_cvttpd2dq<mask_name>"
5251 [(set (match_operand:V4SI 0 "register_operand" "=v")
5253 (fix:V2SI (match_operand:V2DF 1 "vector_operand" "vBm"))
5254 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
5255 "TARGET_SSE2 && <mask_avx512vl_condition>"
5258 return "vcvttpd2dq{x}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}";
5260 return "cvttpd2dq\t{%1, %0|%0, %1}";
5262 [(set_attr "type" "ssecvt")
5263 (set_attr "amdfam10_decode" "double")
5264 (set_attr "athlon_decode" "vector")
5265 (set_attr "bdver1_decode" "double")
5266 (set_attr "prefix" "maybe_vex")
5267 (set_attr "mode" "TI")])
5269 (define_insn "sse2_cvtsd2ss<round_name>"
5270 [(set (match_operand:V4SF 0 "register_operand" "=x,x,v")
5273 (float_truncate:V2SF
5274 (match_operand:V2DF 2 "nonimmediate_operand" "x,m,<round_constraint>")))
5275 (match_operand:V4SF 1 "register_operand" "0,0,v")
5279 cvtsd2ss\t{%2, %0|%0, %2}
5280 cvtsd2ss\t{%2, %0|%0, %q2}
5281 vcvtsd2ss\t{<round_op3>%2, %1, %0|%0, %1, %q2<round_op3>}"
5282 [(set_attr "isa" "noavx,noavx,avx")
5283 (set_attr "type" "ssecvt")
5284 (set_attr "athlon_decode" "vector,double,*")
5285 (set_attr "amdfam10_decode" "vector,double,*")
5286 (set_attr "bdver1_decode" "direct,direct,*")
5287 (set_attr "btver2_decode" "double,double,double")
5288 (set_attr "prefix" "orig,orig,<round_prefix>")
5289 (set_attr "mode" "SF")])
5291 (define_insn "sse2_cvtss2sd<round_saeonly_name>"
5292 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
5296 (match_operand:V4SF 2 "<round_saeonly_nimm_scalar_predicate>" "x,m,<round_saeonly_constraint>")
5297 (parallel [(const_int 0) (const_int 1)])))
5298 (match_operand:V2DF 1 "register_operand" "0,0,v")
5302 cvtss2sd\t{%2, %0|%0, %2}
5303 cvtss2sd\t{%2, %0|%0, %k2}
5304 vcvtss2sd\t{<round_saeonly_op3>%2, %1, %0|%0, %1, %k2<round_saeonly_op3>}"
5305 [(set_attr "isa" "noavx,noavx,avx")
5306 (set_attr "type" "ssecvt")
5307 (set_attr "amdfam10_decode" "vector,double,*")
5308 (set_attr "athlon_decode" "direct,direct,*")
5309 (set_attr "bdver1_decode" "direct,direct,*")
5310 (set_attr "btver2_decode" "double,double,double")
5311 (set_attr "prefix" "orig,orig,<round_saeonly_prefix>")
5312 (set_attr "mode" "DF")])
5314 (define_insn "<mask_codefor>avx512f_cvtpd2ps512<mask_name><round_name>"
5315 [(set (match_operand:V8SF 0 "register_operand" "=v")
5316 (float_truncate:V8SF
5317 (match_operand:V8DF 1 "<round_nimm_predicate>" "<round_constraint>")))]
5319 "vcvtpd2ps\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5320 [(set_attr "type" "ssecvt")
5321 (set_attr "prefix" "evex")
5322 (set_attr "mode" "V8SF")])
5324 (define_insn "avx_cvtpd2ps256<mask_name>"
5325 [(set (match_operand:V4SF 0 "register_operand" "=v")
5326 (float_truncate:V4SF
5327 (match_operand:V4DF 1 "nonimmediate_operand" "vm")))]
5328 "TARGET_AVX && <mask_avx512vl_condition>"
5329 "vcvtpd2ps{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5330 [(set_attr "type" "ssecvt")
5331 (set_attr "prefix" "maybe_evex")
5332 (set_attr "btver2_decode" "vector")
5333 (set_attr "mode" "V4SF")])
5335 (define_expand "sse2_cvtpd2ps"
5336 [(set (match_operand:V4SF 0 "register_operand")
5338 (float_truncate:V2SF
5339 (match_operand:V2DF 1 "vector_operand"))
5342 "operands[2] = CONST0_RTX (V2SFmode);")
5344 (define_expand "sse2_cvtpd2ps_mask"
5345 [(set (match_operand:V4SF 0 "register_operand")
5348 (float_truncate:V2SF
5349 (match_operand:V2DF 1 "vector_operand"))
5351 (match_operand:V4SF 2 "register_operand")
5352 (match_operand:QI 3 "register_operand")))]
5354 "operands[4] = CONST0_RTX (V2SFmode);")
5356 (define_insn "*sse2_cvtpd2ps<mask_name>"
5357 [(set (match_operand:V4SF 0 "register_operand" "=v")
5359 (float_truncate:V2SF
5360 (match_operand:V2DF 1 "vector_operand" "vBm"))
5361 (match_operand:V2SF 2 "const0_operand")))]
5362 "TARGET_SSE2 && <mask_avx512vl_condition>"
5365 return "vcvtpd2ps{x}\t{%1, %0<mask_operand3>|%0<mask_operand3>, %1}";
5367 return "cvtpd2ps\t{%1, %0|%0, %1}";
5369 [(set_attr "type" "ssecvt")
5370 (set_attr "amdfam10_decode" "double")
5371 (set_attr "athlon_decode" "vector")
5372 (set_attr "bdver1_decode" "double")
5373 (set_attr "prefix_data16" "1")
5374 (set_attr "prefix" "maybe_vex")
5375 (set_attr "mode" "V4SF")])
5377 ;; For <sse2_avx_avx512f>_cvtps2pd<avxsizesuffix> insn pattern
5378 (define_mode_attr sf2dfmode
5379 [(V8DF "V8SF") (V4DF "V4SF")])
5381 (define_insn "<sse2_avx_avx512f>_cvtps2pd<avxsizesuffix><mask_name><round_saeonly_name>"
5382 [(set (match_operand:VF2_512_256 0 "register_operand" "=v")
5383 (float_extend:VF2_512_256
5384 (match_operand:<sf2dfmode> 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
5385 "TARGET_AVX && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
5386 "vcvtps2pd\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
5387 [(set_attr "type" "ssecvt")
5388 (set_attr "prefix" "maybe_vex")
5389 (set_attr "mode" "<MODE>")])
5391 (define_insn "*avx_cvtps2pd256_2"
5392 [(set (match_operand:V4DF 0 "register_operand" "=x")
5395 (match_operand:V8SF 1 "nonimmediate_operand" "xm")
5396 (parallel [(const_int 0) (const_int 1)
5397 (const_int 2) (const_int 3)]))))]
5399 "vcvtps2pd\t{%x1, %0|%0, %x1}"
5400 [(set_attr "type" "ssecvt")
5401 (set_attr "prefix" "vex")
5402 (set_attr "mode" "V4DF")])
5404 (define_insn "vec_unpacks_lo_v16sf"
5405 [(set (match_operand:V8DF 0 "register_operand" "=v")
5408 (match_operand:V16SF 1 "nonimmediate_operand" "vm")
5409 (parallel [(const_int 0) (const_int 1)
5410 (const_int 2) (const_int 3)
5411 (const_int 4) (const_int 5)
5412 (const_int 6) (const_int 7)]))))]
5414 "vcvtps2pd\t{%t1, %0|%0, %t1}"
5415 [(set_attr "type" "ssecvt")
5416 (set_attr "prefix" "evex")
5417 (set_attr "mode" "V8DF")])
5419 (define_insn "<avx512>_cvt<ssemodesuffix>2mask<mode>"
5420 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
5421 (unspec:<avx512fmaskmode>
5422 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")]
5423 UNSPEC_CVTINT2MASK))]
5425 "vpmov<ssemodesuffix>2m\t{%1, %0|%0, %1}"
5426 [(set_attr "prefix" "evex")
5427 (set_attr "mode" "<sseinsnmode>")])
5429 (define_insn "<avx512>_cvt<ssemodesuffix>2mask<mode>"
5430 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
5431 (unspec:<avx512fmaskmode>
5432 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")]
5433 UNSPEC_CVTINT2MASK))]
5435 "vpmov<ssemodesuffix>2m\t{%1, %0|%0, %1}"
5436 [(set_attr "prefix" "evex")
5437 (set_attr "mode" "<sseinsnmode>")])
5439 (define_expand "<avx512>_cvtmask2<ssemodesuffix><mode>"
5440 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
5441 (vec_merge:VI12_AVX512VL
5444 (match_operand:<avx512fmaskmode> 1 "register_operand")))]
5447 operands[2] = CONSTM1_RTX (<MODE>mode);
5448 operands[3] = CONST0_RTX (<MODE>mode);
5451 (define_insn "*<avx512>_cvtmask2<ssemodesuffix><mode>"
5452 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
5453 (vec_merge:VI12_AVX512VL
5454 (match_operand:VI12_AVX512VL 2 "constm1_operand")
5455 (match_operand:VI12_AVX512VL 3 "const0_operand")
5456 (match_operand:<avx512fmaskmode> 1 "register_operand" "Yk")))]
5458 "vpmovm2<ssemodesuffix>\t{%1, %0|%0, %1}"
5459 [(set_attr "prefix" "evex")
5460 (set_attr "mode" "<sseinsnmode>")])
5462 (define_expand "<avx512>_cvtmask2<ssemodesuffix><mode>"
5463 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
5464 (vec_merge:VI48_AVX512VL
5467 (match_operand:<avx512fmaskmode> 1 "register_operand")))]
5470 operands[2] = CONSTM1_RTX (<MODE>mode);
5471 operands[3] = CONST0_RTX (<MODE>mode);
5474 (define_insn "*<avx512>_cvtmask2<ssemodesuffix><mode>"
5475 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
5476 (vec_merge:VI48_AVX512VL
5477 (match_operand:VI48_AVX512VL 2 "constm1_operand")
5478 (match_operand:VI48_AVX512VL 3 "const0_operand")
5479 (match_operand:<avx512fmaskmode> 1 "register_operand" "Yk")))]
5481 "vpmovm2<ssemodesuffix>\t{%1, %0|%0, %1}"
5482 [(set_attr "prefix" "evex")
5483 (set_attr "mode" "<sseinsnmode>")])
5485 (define_insn "sse2_cvtps2pd<mask_name>"
5486 [(set (match_operand:V2DF 0 "register_operand" "=v")
5489 (match_operand:V4SF 1 "vector_operand" "vm")
5490 (parallel [(const_int 0) (const_int 1)]))))]
5491 "TARGET_SSE2 && <mask_avx512vl_condition>"
5492 "%vcvtps2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
5493 [(set_attr "type" "ssecvt")
5494 (set_attr "amdfam10_decode" "direct")
5495 (set_attr "athlon_decode" "double")
5496 (set_attr "bdver1_decode" "double")
5497 (set_attr "prefix_data16" "0")
5498 (set_attr "prefix" "maybe_vex")
5499 (set_attr "mode" "V2DF")])
5501 (define_expand "vec_unpacks_hi_v4sf"
5506 (match_operand:V4SF 1 "vector_operand"))
5507 (parallel [(const_int 6) (const_int 7)
5508 (const_int 2) (const_int 3)])))
5509 (set (match_operand:V2DF 0 "register_operand")
5513 (parallel [(const_int 0) (const_int 1)]))))]
5515 "operands[2] = gen_reg_rtx (V4SFmode);")
5517 (define_expand "vec_unpacks_hi_v8sf"
5520 (match_operand:V8SF 1 "register_operand")
5521 (parallel [(const_int 4) (const_int 5)
5522 (const_int 6) (const_int 7)])))
5523 (set (match_operand:V4DF 0 "register_operand")
5527 "operands[2] = gen_reg_rtx (V4SFmode);")
5529 (define_expand "vec_unpacks_hi_v16sf"
5532 (match_operand:V16SF 1 "register_operand")
5533 (parallel [(const_int 8) (const_int 9)
5534 (const_int 10) (const_int 11)
5535 (const_int 12) (const_int 13)
5536 (const_int 14) (const_int 15)])))
5537 (set (match_operand:V8DF 0 "register_operand")
5541 "operands[2] = gen_reg_rtx (V8SFmode);")
5543 (define_expand "vec_unpacks_lo_v4sf"
5544 [(set (match_operand:V2DF 0 "register_operand")
5547 (match_operand:V4SF 1 "vector_operand")
5548 (parallel [(const_int 0) (const_int 1)]))))]
5551 (define_expand "vec_unpacks_lo_v8sf"
5552 [(set (match_operand:V4DF 0 "register_operand")
5555 (match_operand:V8SF 1 "nonimmediate_operand")
5556 (parallel [(const_int 0) (const_int 1)
5557 (const_int 2) (const_int 3)]))))]
5560 (define_mode_attr sseunpackfltmode
5561 [(V8HI "V4SF") (V4SI "V2DF") (V16HI "V8SF")
5562 (V8SI "V4DF") (V32HI "V16SF") (V16SI "V8DF")])
5564 (define_expand "vec_unpacks_float_hi_<mode>"
5565 [(match_operand:<sseunpackfltmode> 0 "register_operand")
5566 (match_operand:VI2_AVX512F 1 "register_operand")]
5569 rtx tmp = gen_reg_rtx (<sseunpackmode>mode);
5571 emit_insn (gen_vec_unpacks_hi_<mode> (tmp, operands[1]));
5572 emit_insn (gen_rtx_SET (operands[0],
5573 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
5577 (define_expand "vec_unpacks_float_lo_<mode>"
5578 [(match_operand:<sseunpackfltmode> 0 "register_operand")
5579 (match_operand:VI2_AVX512F 1 "register_operand")]
5582 rtx tmp = gen_reg_rtx (<sseunpackmode>mode);
5584 emit_insn (gen_vec_unpacks_lo_<mode> (tmp, operands[1]));
5585 emit_insn (gen_rtx_SET (operands[0],
5586 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
5590 (define_expand "vec_unpacku_float_hi_<mode>"
5591 [(match_operand:<sseunpackfltmode> 0 "register_operand")
5592 (match_operand:VI2_AVX512F 1 "register_operand")]
5595 rtx tmp = gen_reg_rtx (<sseunpackmode>mode);
5597 emit_insn (gen_vec_unpacku_hi_<mode> (tmp, operands[1]));
5598 emit_insn (gen_rtx_SET (operands[0],
5599 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
5603 (define_expand "vec_unpacku_float_lo_<mode>"
5604 [(match_operand:<sseunpackfltmode> 0 "register_operand")
5605 (match_operand:VI2_AVX512F 1 "register_operand")]
5608 rtx tmp = gen_reg_rtx (<sseunpackmode>mode);
5610 emit_insn (gen_vec_unpacku_lo_<mode> (tmp, operands[1]));
5611 emit_insn (gen_rtx_SET (operands[0],
5612 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
5616 (define_expand "vec_unpacks_float_hi_v4si"
5619 (match_operand:V4SI 1 "vector_operand")
5620 (parallel [(const_int 2) (const_int 3)
5621 (const_int 2) (const_int 3)])))
5622 (set (match_operand:V2DF 0 "register_operand")
5626 (parallel [(const_int 0) (const_int 1)]))))]
5628 "operands[2] = gen_reg_rtx (V4SImode);")
5630 (define_expand "vec_unpacks_float_lo_v4si"
5631 [(set (match_operand:V2DF 0 "register_operand")
5634 (match_operand:V4SI 1 "vector_operand")
5635 (parallel [(const_int 0) (const_int 1)]))))]
5638 (define_expand "vec_unpacks_float_hi_v8si"
5641 (match_operand:V8SI 1 "vector_operand")
5642 (parallel [(const_int 4) (const_int 5)
5643 (const_int 6) (const_int 7)])))
5644 (set (match_operand:V4DF 0 "register_operand")
5648 "operands[2] = gen_reg_rtx (V4SImode);")
5650 (define_expand "vec_unpacks_float_lo_v8si"
5651 [(set (match_operand:V4DF 0 "register_operand")
5654 (match_operand:V8SI 1 "nonimmediate_operand")
5655 (parallel [(const_int 0) (const_int 1)
5656 (const_int 2) (const_int 3)]))))]
5659 (define_expand "vec_unpacks_float_hi_v16si"
5662 (match_operand:V16SI 1 "nonimmediate_operand")
5663 (parallel [(const_int 8) (const_int 9)
5664 (const_int 10) (const_int 11)
5665 (const_int 12) (const_int 13)
5666 (const_int 14) (const_int 15)])))
5667 (set (match_operand:V8DF 0 "register_operand")
5671 "operands[2] = gen_reg_rtx (V8SImode);")
5673 (define_expand "vec_unpacks_float_lo_v16si"
5674 [(set (match_operand:V8DF 0 "register_operand")
5677 (match_operand:V16SI 1 "nonimmediate_operand")
5678 (parallel [(const_int 0) (const_int 1)
5679 (const_int 2) (const_int 3)
5680 (const_int 4) (const_int 5)
5681 (const_int 6) (const_int 7)]))))]
5684 (define_expand "vec_unpacku_float_hi_v4si"
5687 (match_operand:V4SI 1 "vector_operand")
5688 (parallel [(const_int 2) (const_int 3)
5689 (const_int 2) (const_int 3)])))
5694 (parallel [(const_int 0) (const_int 1)]))))
5696 (lt:V2DF (match_dup 6) (match_dup 3)))
5698 (and:V2DF (match_dup 7) (match_dup 4)))
5699 (set (match_operand:V2DF 0 "register_operand")
5700 (plus:V2DF (match_dup 6) (match_dup 8)))]
5703 REAL_VALUE_TYPE TWO32r;
5707 real_ldexp (&TWO32r, &dconst1, 32);
5708 x = const_double_from_real_value (TWO32r, DFmode);
5710 operands[3] = force_reg (V2DFmode, CONST0_RTX (V2DFmode));
5711 operands[4] = force_reg (V2DFmode,
5712 ix86_build_const_vector (V2DFmode, 1, x));
5714 operands[5] = gen_reg_rtx (V4SImode);
5716 for (i = 6; i < 9; i++)
5717 operands[i] = gen_reg_rtx (V2DFmode);
5720 (define_expand "vec_unpacku_float_lo_v4si"
5724 (match_operand:V4SI 1 "vector_operand")
5725 (parallel [(const_int 0) (const_int 1)]))))
5727 (lt:V2DF (match_dup 5) (match_dup 3)))
5729 (and:V2DF (match_dup 6) (match_dup 4)))
5730 (set (match_operand:V2DF 0 "register_operand")
5731 (plus:V2DF (match_dup 5) (match_dup 7)))]
5734 REAL_VALUE_TYPE TWO32r;
5738 real_ldexp (&TWO32r, &dconst1, 32);
5739 x = const_double_from_real_value (TWO32r, DFmode);
5741 operands[3] = force_reg (V2DFmode, CONST0_RTX (V2DFmode));
5742 operands[4] = force_reg (V2DFmode,
5743 ix86_build_const_vector (V2DFmode, 1, x));
5745 for (i = 5; i < 8; i++)
5746 operands[i] = gen_reg_rtx (V2DFmode);
5749 (define_expand "vec_unpacku_float_hi_v8si"
5750 [(match_operand:V4DF 0 "register_operand")
5751 (match_operand:V8SI 1 "register_operand")]
5754 REAL_VALUE_TYPE TWO32r;
5758 real_ldexp (&TWO32r, &dconst1, 32);
5759 x = const_double_from_real_value (TWO32r, DFmode);
5761 tmp[0] = force_reg (V4DFmode, CONST0_RTX (V4DFmode));
5762 tmp[1] = force_reg (V4DFmode, ix86_build_const_vector (V4DFmode, 1, x));
5763 tmp[5] = gen_reg_rtx (V4SImode);
5765 for (i = 2; i < 5; i++)
5766 tmp[i] = gen_reg_rtx (V4DFmode);
5767 emit_insn (gen_vec_extract_hi_v8si (tmp[5], operands[1]));
5768 emit_insn (gen_floatv4siv4df2 (tmp[2], tmp[5]));
5769 emit_insn (gen_rtx_SET (tmp[3], gen_rtx_LT (V4DFmode, tmp[2], tmp[0])));
5770 emit_insn (gen_andv4df3 (tmp[4], tmp[3], tmp[1]));
5771 emit_insn (gen_addv4df3 (operands[0], tmp[2], tmp[4]));
5775 (define_expand "vec_unpacku_float_hi_v16si"
5776 [(match_operand:V8DF 0 "register_operand")
5777 (match_operand:V16SI 1 "register_operand")]
5780 REAL_VALUE_TYPE TWO32r;
5783 real_ldexp (&TWO32r, &dconst1, 32);
5784 x = const_double_from_real_value (TWO32r, DFmode);
5786 tmp[0] = force_reg (V8DFmode, CONST0_RTX (V8DFmode));
5787 tmp[1] = force_reg (V8DFmode, ix86_build_const_vector (V8DFmode, 1, x));
5788 tmp[2] = gen_reg_rtx (V8DFmode);
5789 tmp[3] = gen_reg_rtx (V8SImode);
5790 k = gen_reg_rtx (QImode);
5792 emit_insn (gen_vec_extract_hi_v16si (tmp[3], operands[1]));
5793 emit_insn (gen_floatv8siv8df2 (tmp[2], tmp[3]));
5794 emit_insn (gen_rtx_SET (k, gen_rtx_LT (QImode, tmp[2], tmp[0])));
5795 emit_insn (gen_addv8df3_mask (tmp[2], tmp[2], tmp[1], tmp[2], k));
5796 emit_move_insn (operands[0], tmp[2]);
5800 (define_expand "vec_unpacku_float_lo_v8si"
5801 [(match_operand:V4DF 0 "register_operand")
5802 (match_operand:V8SI 1 "nonimmediate_operand")]
5805 REAL_VALUE_TYPE TWO32r;
5809 real_ldexp (&TWO32r, &dconst1, 32);
5810 x = const_double_from_real_value (TWO32r, DFmode);
5812 tmp[0] = force_reg (V4DFmode, CONST0_RTX (V4DFmode));
5813 tmp[1] = force_reg (V4DFmode, ix86_build_const_vector (V4DFmode, 1, x));
5815 for (i = 2; i < 5; i++)
5816 tmp[i] = gen_reg_rtx (V4DFmode);
5817 emit_insn (gen_avx_cvtdq2pd256_2 (tmp[2], operands[1]));
5818 emit_insn (gen_rtx_SET (tmp[3], gen_rtx_LT (V4DFmode, tmp[2], tmp[0])));
5819 emit_insn (gen_andv4df3 (tmp[4], tmp[3], tmp[1]));
5820 emit_insn (gen_addv4df3 (operands[0], tmp[2], tmp[4]));
5824 (define_expand "vec_unpacku_float_lo_v16si"
5825 [(match_operand:V8DF 0 "register_operand")
5826 (match_operand:V16SI 1 "nonimmediate_operand")]
5829 REAL_VALUE_TYPE TWO32r;
5832 real_ldexp (&TWO32r, &dconst1, 32);
5833 x = const_double_from_real_value (TWO32r, DFmode);
5835 tmp[0] = force_reg (V8DFmode, CONST0_RTX (V8DFmode));
5836 tmp[1] = force_reg (V8DFmode, ix86_build_const_vector (V8DFmode, 1, x));
5837 tmp[2] = gen_reg_rtx (V8DFmode);
5838 k = gen_reg_rtx (QImode);
5840 emit_insn (gen_avx512f_cvtdq2pd512_2 (tmp[2], operands[1]));
5841 emit_insn (gen_rtx_SET (k, gen_rtx_LT (QImode, tmp[2], tmp[0])));
5842 emit_insn (gen_addv8df3_mask (tmp[2], tmp[2], tmp[1], tmp[2], k));
5843 emit_move_insn (operands[0], tmp[2]);
5847 (define_expand "vec_pack_trunc_<mode>"
5849 (float_truncate:<sf2dfmode>
5850 (match_operand:VF2_512_256 1 "nonimmediate_operand")))
5852 (float_truncate:<sf2dfmode>
5853 (match_operand:VF2_512_256 2 "nonimmediate_operand")))
5854 (set (match_operand:<ssePSmode> 0 "register_operand")
5855 (vec_concat:<ssePSmode>
5860 operands[3] = gen_reg_rtx (<sf2dfmode>mode);
5861 operands[4] = gen_reg_rtx (<sf2dfmode>mode);
5864 (define_expand "vec_pack_trunc_v2df"
5865 [(match_operand:V4SF 0 "register_operand")
5866 (match_operand:V2DF 1 "vector_operand")
5867 (match_operand:V2DF 2 "vector_operand")]
5872 if (TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
5874 tmp0 = gen_reg_rtx (V4DFmode);
5875 tmp1 = force_reg (V2DFmode, operands[1]);
5877 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
5878 emit_insn (gen_avx_cvtpd2ps256 (operands[0], tmp0));
5882 tmp0 = gen_reg_rtx (V4SFmode);
5883 tmp1 = gen_reg_rtx (V4SFmode);
5885 emit_insn (gen_sse2_cvtpd2ps (tmp0, operands[1]));
5886 emit_insn (gen_sse2_cvtpd2ps (tmp1, operands[2]));
5887 emit_insn (gen_sse_movlhps (operands[0], tmp0, tmp1));
5892 (define_expand "vec_pack_sfix_trunc_v8df"
5893 [(match_operand:V16SI 0 "register_operand")
5894 (match_operand:V8DF 1 "nonimmediate_operand")
5895 (match_operand:V8DF 2 "nonimmediate_operand")]
5900 r1 = gen_reg_rtx (V8SImode);
5901 r2 = gen_reg_rtx (V8SImode);
5903 emit_insn (gen_fix_truncv8dfv8si2 (r1, operands[1]));
5904 emit_insn (gen_fix_truncv8dfv8si2 (r2, operands[2]));
5905 emit_insn (gen_avx_vec_concatv16si (operands[0], r1, r2));
5909 (define_expand "vec_pack_sfix_trunc_v4df"
5910 [(match_operand:V8SI 0 "register_operand")
5911 (match_operand:V4DF 1 "nonimmediate_operand")
5912 (match_operand:V4DF 2 "nonimmediate_operand")]
5917 r1 = gen_reg_rtx (V4SImode);
5918 r2 = gen_reg_rtx (V4SImode);
5920 emit_insn (gen_fix_truncv4dfv4si2 (r1, operands[1]));
5921 emit_insn (gen_fix_truncv4dfv4si2 (r2, operands[2]));
5922 emit_insn (gen_avx_vec_concatv8si (operands[0], r1, r2));
5926 (define_expand "vec_pack_sfix_trunc_v2df"
5927 [(match_operand:V4SI 0 "register_operand")
5928 (match_operand:V2DF 1 "vector_operand")
5929 (match_operand:V2DF 2 "vector_operand")]
5932 rtx tmp0, tmp1, tmp2;
5934 if (TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
5936 tmp0 = gen_reg_rtx (V4DFmode);
5937 tmp1 = force_reg (V2DFmode, operands[1]);
5939 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
5940 emit_insn (gen_fix_truncv4dfv4si2 (operands[0], tmp0));
5944 tmp0 = gen_reg_rtx (V4SImode);
5945 tmp1 = gen_reg_rtx (V4SImode);
5946 tmp2 = gen_reg_rtx (V2DImode);
5948 emit_insn (gen_sse2_cvttpd2dq (tmp0, operands[1]));
5949 emit_insn (gen_sse2_cvttpd2dq (tmp1, operands[2]));
5950 emit_insn (gen_vec_interleave_lowv2di (tmp2,
5951 gen_lowpart (V2DImode, tmp0),
5952 gen_lowpart (V2DImode, tmp1)));
5953 emit_move_insn (operands[0], gen_lowpart (V4SImode, tmp2));
5958 (define_mode_attr ssepackfltmode
5959 [(V8DF "V16SI") (V4DF "V8SI") (V2DF "V4SI")])
5961 (define_expand "vec_pack_ufix_trunc_<mode>"
5962 [(match_operand:<ssepackfltmode> 0 "register_operand")
5963 (match_operand:VF2 1 "register_operand")
5964 (match_operand:VF2 2 "register_operand")]
5967 if (<MODE>mode == V8DFmode)
5971 r1 = gen_reg_rtx (V8SImode);
5972 r2 = gen_reg_rtx (V8SImode);
5974 emit_insn (gen_ufix_truncv8dfv8si2 (r1, operands[1]));
5975 emit_insn (gen_ufix_truncv8dfv8si2 (r2, operands[2]));
5976 emit_insn (gen_avx_vec_concatv16si (operands[0], r1, r2));
5981 tmp[0] = ix86_expand_adjust_ufix_to_sfix_si (operands[1], &tmp[2]);
5982 tmp[1] = ix86_expand_adjust_ufix_to_sfix_si (operands[2], &tmp[3]);
5983 tmp[4] = gen_reg_rtx (<ssepackfltmode>mode);
5984 emit_insn (gen_vec_pack_sfix_trunc_<mode> (tmp[4], tmp[0], tmp[1]));
5985 if (<ssepackfltmode>mode == V4SImode || TARGET_AVX2)
5987 tmp[5] = gen_reg_rtx (<ssepackfltmode>mode);
5988 ix86_expand_vec_extract_even_odd (tmp[5], tmp[2], tmp[3], 0);
5992 tmp[5] = gen_reg_rtx (V8SFmode);
5993 ix86_expand_vec_extract_even_odd (tmp[5], gen_lowpart (V8SFmode, tmp[2]),
5994 gen_lowpart (V8SFmode, tmp[3]), 0);
5995 tmp[5] = gen_lowpart (V8SImode, tmp[5]);
5997 tmp[6] = expand_simple_binop (<ssepackfltmode>mode, XOR, tmp[4], tmp[5],
5998 operands[0], 0, OPTAB_DIRECT);
5999 if (tmp[6] != operands[0])
6000 emit_move_insn (operands[0], tmp[6]);
6006 (define_expand "vec_pack_sfix_v4df"
6007 [(match_operand:V8SI 0 "register_operand")
6008 (match_operand:V4DF 1 "nonimmediate_operand")
6009 (match_operand:V4DF 2 "nonimmediate_operand")]
6014 r1 = gen_reg_rtx (V4SImode);
6015 r2 = gen_reg_rtx (V4SImode);
6017 emit_insn (gen_avx_cvtpd2dq256 (r1, operands[1]));
6018 emit_insn (gen_avx_cvtpd2dq256 (r2, operands[2]));
6019 emit_insn (gen_avx_vec_concatv8si (operands[0], r1, r2));
6023 (define_expand "vec_pack_sfix_v2df"
6024 [(match_operand:V4SI 0 "register_operand")
6025 (match_operand:V2DF 1 "vector_operand")
6026 (match_operand:V2DF 2 "vector_operand")]
6029 rtx tmp0, tmp1, tmp2;
6031 if (TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
6033 tmp0 = gen_reg_rtx (V4DFmode);
6034 tmp1 = force_reg (V2DFmode, operands[1]);
6036 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
6037 emit_insn (gen_avx_cvtpd2dq256 (operands[0], tmp0));
6041 tmp0 = gen_reg_rtx (V4SImode);
6042 tmp1 = gen_reg_rtx (V4SImode);
6043 tmp2 = gen_reg_rtx (V2DImode);
6045 emit_insn (gen_sse2_cvtpd2dq (tmp0, operands[1]));
6046 emit_insn (gen_sse2_cvtpd2dq (tmp1, operands[2]));
6047 emit_insn (gen_vec_interleave_lowv2di (tmp2,
6048 gen_lowpart (V2DImode, tmp0),
6049 gen_lowpart (V2DImode, tmp1)));
6050 emit_move_insn (operands[0], gen_lowpart (V4SImode, tmp2));
6055 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6057 ;; Parallel single-precision floating point element swizzling
6059 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6061 (define_expand "sse_movhlps_exp"
6062 [(set (match_operand:V4SF 0 "nonimmediate_operand")
6065 (match_operand:V4SF 1 "nonimmediate_operand")
6066 (match_operand:V4SF 2 "nonimmediate_operand"))
6067 (parallel [(const_int 6)
6073 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
6075 emit_insn (gen_sse_movhlps (dst, operands[1], operands[2]));
6077 /* Fix up the destination if needed. */
6078 if (dst != operands[0])
6079 emit_move_insn (operands[0], dst);
6084 (define_insn "sse_movhlps"
6085 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,x,x,x,m")
6088 (match_operand:V4SF 1 "nonimmediate_operand" " 0,x,0,x,0")
6089 (match_operand:V4SF 2 "nonimmediate_operand" " x,x,o,o,x"))
6090 (parallel [(const_int 6)
6094 "TARGET_SSE && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
6096 movhlps\t{%2, %0|%0, %2}
6097 vmovhlps\t{%2, %1, %0|%0, %1, %2}
6098 movlps\t{%H2, %0|%0, %H2}
6099 vmovlps\t{%H2, %1, %0|%0, %1, %H2}
6100 %vmovhps\t{%2, %0|%q0, %2}"
6101 [(set_attr "isa" "noavx,avx,noavx,avx,*")
6102 (set_attr "type" "ssemov")
6103 (set_attr "ssememalign" "64")
6104 (set_attr "prefix" "orig,vex,orig,vex,maybe_vex")
6105 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF,V2SF")])
6107 (define_expand "sse_movlhps_exp"
6108 [(set (match_operand:V4SF 0 "nonimmediate_operand")
6111 (match_operand:V4SF 1 "nonimmediate_operand")
6112 (match_operand:V4SF 2 "nonimmediate_operand"))
6113 (parallel [(const_int 0)
6119 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
6121 emit_insn (gen_sse_movlhps (dst, operands[1], operands[2]));
6123 /* Fix up the destination if needed. */
6124 if (dst != operands[0])
6125 emit_move_insn (operands[0], dst);
6130 (define_insn "sse_movlhps"
6131 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,x,x,x,o")
6134 (match_operand:V4SF 1 "nonimmediate_operand" " 0,x,0,x,0")
6135 (match_operand:V4SF 2 "nonimmediate_operand" " x,x,m,m,x"))
6136 (parallel [(const_int 0)
6140 "TARGET_SSE && ix86_binary_operator_ok (UNKNOWN, V4SFmode, operands)"
6142 movlhps\t{%2, %0|%0, %2}
6143 vmovlhps\t{%2, %1, %0|%0, %1, %2}
6144 movhps\t{%2, %0|%0, %q2}
6145 vmovhps\t{%2, %1, %0|%0, %1, %q2}
6146 %vmovlps\t{%2, %H0|%H0, %2}"
6147 [(set_attr "isa" "noavx,avx,noavx,avx,*")
6148 (set_attr "type" "ssemov")
6149 (set_attr "ssememalign" "64")
6150 (set_attr "prefix" "orig,vex,orig,vex,maybe_vex")
6151 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF,V2SF")])
6153 (define_insn "<mask_codefor>avx512f_unpckhps512<mask_name>"
6154 [(set (match_operand:V16SF 0 "register_operand" "=v")
6157 (match_operand:V16SF 1 "register_operand" "v")
6158 (match_operand:V16SF 2 "nonimmediate_operand" "vm"))
6159 (parallel [(const_int 2) (const_int 18)
6160 (const_int 3) (const_int 19)
6161 (const_int 6) (const_int 22)
6162 (const_int 7) (const_int 23)
6163 (const_int 10) (const_int 26)
6164 (const_int 11) (const_int 27)
6165 (const_int 14) (const_int 30)
6166 (const_int 15) (const_int 31)])))]
6168 "vunpckhps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6169 [(set_attr "type" "sselog")
6170 (set_attr "prefix" "evex")
6171 (set_attr "mode" "V16SF")])
6173 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
6174 (define_insn "avx_unpckhps256<mask_name>"
6175 [(set (match_operand:V8SF 0 "register_operand" "=v")
6178 (match_operand:V8SF 1 "register_operand" "v")
6179 (match_operand:V8SF 2 "nonimmediate_operand" "vm"))
6180 (parallel [(const_int 2) (const_int 10)
6181 (const_int 3) (const_int 11)
6182 (const_int 6) (const_int 14)
6183 (const_int 7) (const_int 15)])))]
6184 "TARGET_AVX && <mask_avx512vl_condition>"
6185 "vunpckhps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6186 [(set_attr "type" "sselog")
6187 (set_attr "prefix" "vex")
6188 (set_attr "mode" "V8SF")])
6190 (define_expand "vec_interleave_highv8sf"
6194 (match_operand:V8SF 1 "register_operand" "x")
6195 (match_operand:V8SF 2 "nonimmediate_operand" "xm"))
6196 (parallel [(const_int 0) (const_int 8)
6197 (const_int 1) (const_int 9)
6198 (const_int 4) (const_int 12)
6199 (const_int 5) (const_int 13)])))
6205 (parallel [(const_int 2) (const_int 10)
6206 (const_int 3) (const_int 11)
6207 (const_int 6) (const_int 14)
6208 (const_int 7) (const_int 15)])))
6209 (set (match_operand:V8SF 0 "register_operand")
6214 (parallel [(const_int 4) (const_int 5)
6215 (const_int 6) (const_int 7)
6216 (const_int 12) (const_int 13)
6217 (const_int 14) (const_int 15)])))]
6220 operands[3] = gen_reg_rtx (V8SFmode);
6221 operands[4] = gen_reg_rtx (V8SFmode);
6224 (define_insn "vec_interleave_highv4sf<mask_name>"
6225 [(set (match_operand:V4SF 0 "register_operand" "=x,v")
6228 (match_operand:V4SF 1 "register_operand" "0,v")
6229 (match_operand:V4SF 2 "vector_operand" "xBm,vm"))
6230 (parallel [(const_int 2) (const_int 6)
6231 (const_int 3) (const_int 7)])))]
6232 "TARGET_SSE && <mask_avx512vl_condition>"
6234 unpckhps\t{%2, %0|%0, %2}
6235 vunpckhps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6236 [(set_attr "isa" "noavx,avx")
6237 (set_attr "type" "sselog")
6238 (set_attr "prefix" "orig,vex")
6239 (set_attr "mode" "V4SF")])
6241 (define_insn "<mask_codefor>avx512f_unpcklps512<mask_name>"
6242 [(set (match_operand:V16SF 0 "register_operand" "=v")
6245 (match_operand:V16SF 1 "register_operand" "v")
6246 (match_operand:V16SF 2 "nonimmediate_operand" "vm"))
6247 (parallel [(const_int 0) (const_int 16)
6248 (const_int 1) (const_int 17)
6249 (const_int 4) (const_int 20)
6250 (const_int 5) (const_int 21)
6251 (const_int 8) (const_int 24)
6252 (const_int 9) (const_int 25)
6253 (const_int 12) (const_int 28)
6254 (const_int 13) (const_int 29)])))]
6256 "vunpcklps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6257 [(set_attr "type" "sselog")
6258 (set_attr "prefix" "evex")
6259 (set_attr "mode" "V16SF")])
6261 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
6262 (define_insn "avx_unpcklps256<mask_name>"
6263 [(set (match_operand:V8SF 0 "register_operand" "=v")
6266 (match_operand:V8SF 1 "register_operand" "v")
6267 (match_operand:V8SF 2 "nonimmediate_operand" "vm"))
6268 (parallel [(const_int 0) (const_int 8)
6269 (const_int 1) (const_int 9)
6270 (const_int 4) (const_int 12)
6271 (const_int 5) (const_int 13)])))]
6272 "TARGET_AVX && <mask_avx512vl_condition>"
6273 "vunpcklps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6274 [(set_attr "type" "sselog")
6275 (set_attr "prefix" "vex")
6276 (set_attr "mode" "V8SF")])
6278 (define_insn "unpcklps128_mask"
6279 [(set (match_operand:V4SF 0 "register_operand" "=v")
6283 (match_operand:V4SF 1 "register_operand" "v")
6284 (match_operand:V4SF 2 "nonimmediate_operand" "vm"))
6285 (parallel [(const_int 0) (const_int 4)
6286 (const_int 1) (const_int 5)]))
6287 (match_operand:V4SF 3 "vector_move_operand" "0C")
6288 (match_operand:QI 4 "register_operand" "Yk")))]
6290 "vunpcklps\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
6291 [(set_attr "type" "sselog")
6292 (set_attr "prefix" "evex")
6293 (set_attr "mode" "V4SF")])
6295 (define_expand "vec_interleave_lowv8sf"
6299 (match_operand:V8SF 1 "register_operand" "x")
6300 (match_operand:V8SF 2 "nonimmediate_operand" "xm"))
6301 (parallel [(const_int 0) (const_int 8)
6302 (const_int 1) (const_int 9)
6303 (const_int 4) (const_int 12)
6304 (const_int 5) (const_int 13)])))
6310 (parallel [(const_int 2) (const_int 10)
6311 (const_int 3) (const_int 11)
6312 (const_int 6) (const_int 14)
6313 (const_int 7) (const_int 15)])))
6314 (set (match_operand:V8SF 0 "register_operand")
6319 (parallel [(const_int 0) (const_int 1)
6320 (const_int 2) (const_int 3)
6321 (const_int 8) (const_int 9)
6322 (const_int 10) (const_int 11)])))]
6325 operands[3] = gen_reg_rtx (V8SFmode);
6326 operands[4] = gen_reg_rtx (V8SFmode);
6329 (define_insn "vec_interleave_lowv4sf"
6330 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
6333 (match_operand:V4SF 1 "register_operand" "0,x")
6334 (match_operand:V4SF 2 "vector_operand" "xBm,xm"))
6335 (parallel [(const_int 0) (const_int 4)
6336 (const_int 1) (const_int 5)])))]
6339 unpcklps\t{%2, %0|%0, %2}
6340 vunpcklps\t{%2, %1, %0|%0, %1, %2}"
6341 [(set_attr "isa" "noavx,avx")
6342 (set_attr "type" "sselog")
6343 (set_attr "prefix" "orig,vex")
6344 (set_attr "mode" "V4SF")])
6346 ;; These are modeled with the same vec_concat as the others so that we
6347 ;; capture users of shufps that can use the new instructions
6348 (define_insn "avx_movshdup256<mask_name>"
6349 [(set (match_operand:V8SF 0 "register_operand" "=v")
6352 (match_operand:V8SF 1 "nonimmediate_operand" "vm")
6354 (parallel [(const_int 1) (const_int 1)
6355 (const_int 3) (const_int 3)
6356 (const_int 5) (const_int 5)
6357 (const_int 7) (const_int 7)])))]
6358 "TARGET_AVX && <mask_avx512vl_condition>"
6359 "vmovshdup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6360 [(set_attr "type" "sse")
6361 (set_attr "prefix" "vex")
6362 (set_attr "mode" "V8SF")])
6364 (define_insn "sse3_movshdup<mask_name>"
6365 [(set (match_operand:V4SF 0 "register_operand" "=v")
6368 (match_operand:V4SF 1 "vector_operand" "vBm")
6370 (parallel [(const_int 1)
6374 "TARGET_SSE3 && <mask_avx512vl_condition>"
6375 "%vmovshdup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6376 [(set_attr "type" "sse")
6377 (set_attr "prefix_rep" "1")
6378 (set_attr "prefix" "maybe_vex")
6379 (set_attr "mode" "V4SF")])
6381 (define_insn "<mask_codefor>avx512f_movshdup512<mask_name>"
6382 [(set (match_operand:V16SF 0 "register_operand" "=v")
6385 (match_operand:V16SF 1 "nonimmediate_operand" "vm")
6387 (parallel [(const_int 1) (const_int 1)
6388 (const_int 3) (const_int 3)
6389 (const_int 5) (const_int 5)
6390 (const_int 7) (const_int 7)
6391 (const_int 9) (const_int 9)
6392 (const_int 11) (const_int 11)
6393 (const_int 13) (const_int 13)
6394 (const_int 15) (const_int 15)])))]
6396 "vmovshdup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6397 [(set_attr "type" "sse")
6398 (set_attr "prefix" "evex")
6399 (set_attr "mode" "V16SF")])
6401 (define_insn "avx_movsldup256<mask_name>"
6402 [(set (match_operand:V8SF 0 "register_operand" "=v")
6405 (match_operand:V8SF 1 "nonimmediate_operand" "vm")
6407 (parallel [(const_int 0) (const_int 0)
6408 (const_int 2) (const_int 2)
6409 (const_int 4) (const_int 4)
6410 (const_int 6) (const_int 6)])))]
6411 "TARGET_AVX && <mask_avx512vl_condition>"
6412 "vmovsldup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6413 [(set_attr "type" "sse")
6414 (set_attr "prefix" "vex")
6415 (set_attr "mode" "V8SF")])
6417 (define_insn "sse3_movsldup<mask_name>"
6418 [(set (match_operand:V4SF 0 "register_operand" "=v")
6421 (match_operand:V4SF 1 "vector_operand" "vBm")
6423 (parallel [(const_int 0)
6427 "TARGET_SSE3 && <mask_avx512vl_condition>"
6428 "%vmovsldup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6429 [(set_attr "type" "sse")
6430 (set_attr "prefix_rep" "1")
6431 (set_attr "prefix" "maybe_vex")
6432 (set_attr "mode" "V4SF")])
6434 (define_insn "<mask_codefor>avx512f_movsldup512<mask_name>"
6435 [(set (match_operand:V16SF 0 "register_operand" "=v")
6438 (match_operand:V16SF 1 "nonimmediate_operand" "vm")
6440 (parallel [(const_int 0) (const_int 0)
6441 (const_int 2) (const_int 2)
6442 (const_int 4) (const_int 4)
6443 (const_int 6) (const_int 6)
6444 (const_int 8) (const_int 8)
6445 (const_int 10) (const_int 10)
6446 (const_int 12) (const_int 12)
6447 (const_int 14) (const_int 14)])))]
6449 "vmovsldup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6450 [(set_attr "type" "sse")
6451 (set_attr "prefix" "evex")
6452 (set_attr "mode" "V16SF")])
6454 (define_expand "avx_shufps256<mask_expand4_name>"
6455 [(match_operand:V8SF 0 "register_operand")
6456 (match_operand:V8SF 1 "register_operand")
6457 (match_operand:V8SF 2 "nonimmediate_operand")
6458 (match_operand:SI 3 "const_int_operand")]
6461 int mask = INTVAL (operands[3]);
6462 emit_insn (gen_avx_shufps256_1<mask_expand4_name> (operands[0],
6465 GEN_INT ((mask >> 0) & 3),
6466 GEN_INT ((mask >> 2) & 3),
6467 GEN_INT (((mask >> 4) & 3) + 8),
6468 GEN_INT (((mask >> 6) & 3) + 8),
6469 GEN_INT (((mask >> 0) & 3) + 4),
6470 GEN_INT (((mask >> 2) & 3) + 4),
6471 GEN_INT (((mask >> 4) & 3) + 12),
6472 GEN_INT (((mask >> 6) & 3) + 12)
6473 <mask_expand4_args>));
6477 ;; One bit in mask selects 2 elements.
6478 (define_insn "avx_shufps256_1<mask_name>"
6479 [(set (match_operand:V8SF 0 "register_operand" "=v")
6482 (match_operand:V8SF 1 "register_operand" "v")
6483 (match_operand:V8SF 2 "nonimmediate_operand" "vm"))
6484 (parallel [(match_operand 3 "const_0_to_3_operand" )
6485 (match_operand 4 "const_0_to_3_operand" )
6486 (match_operand 5 "const_8_to_11_operand" )
6487 (match_operand 6 "const_8_to_11_operand" )
6488 (match_operand 7 "const_4_to_7_operand" )
6489 (match_operand 8 "const_4_to_7_operand" )
6490 (match_operand 9 "const_12_to_15_operand")
6491 (match_operand 10 "const_12_to_15_operand")])))]
6493 && <mask_avx512vl_condition>
6494 && (INTVAL (operands[3]) == (INTVAL (operands[7]) - 4)
6495 && INTVAL (operands[4]) == (INTVAL (operands[8]) - 4)
6496 && INTVAL (operands[5]) == (INTVAL (operands[9]) - 4)
6497 && INTVAL (operands[6]) == (INTVAL (operands[10]) - 4))"
6500 mask = INTVAL (operands[3]);
6501 mask |= INTVAL (operands[4]) << 2;
6502 mask |= (INTVAL (operands[5]) - 8) << 4;
6503 mask |= (INTVAL (operands[6]) - 8) << 6;
6504 operands[3] = GEN_INT (mask);
6506 return "vshufps\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
6508 [(set_attr "type" "sseshuf")
6509 (set_attr "length_immediate" "1")
6510 (set_attr "prefix" "<mask_prefix>")
6511 (set_attr "mode" "V8SF")])
6513 (define_expand "sse_shufps<mask_expand4_name>"
6514 [(match_operand:V4SF 0 "register_operand")
6515 (match_operand:V4SF 1 "register_operand")
6516 (match_operand:V4SF 2 "vector_operand")
6517 (match_operand:SI 3 "const_int_operand")]
6520 int mask = INTVAL (operands[3]);
6521 emit_insn (gen_sse_shufps_v4sf<mask_expand4_name> (operands[0],
6524 GEN_INT ((mask >> 0) & 3),
6525 GEN_INT ((mask >> 2) & 3),
6526 GEN_INT (((mask >> 4) & 3) + 4),
6527 GEN_INT (((mask >> 6) & 3) + 4)
6528 <mask_expand4_args>));
6532 (define_insn "sse_shufps_v4sf_mask"
6533 [(set (match_operand:V4SF 0 "register_operand" "=v")
6537 (match_operand:V4SF 1 "register_operand" "v")
6538 (match_operand:V4SF 2 "nonimmediate_operand" "vm"))
6539 (parallel [(match_operand 3 "const_0_to_3_operand")
6540 (match_operand 4 "const_0_to_3_operand")
6541 (match_operand 5 "const_4_to_7_operand")
6542 (match_operand 6 "const_4_to_7_operand")]))
6543 (match_operand:V4SF 7 "vector_move_operand" "0C")
6544 (match_operand:QI 8 "register_operand" "Yk")))]
6548 mask |= INTVAL (operands[3]) << 0;
6549 mask |= INTVAL (operands[4]) << 2;
6550 mask |= (INTVAL (operands[5]) - 4) << 4;
6551 mask |= (INTVAL (operands[6]) - 4) << 6;
6552 operands[3] = GEN_INT (mask);
6554 return "vshufps\t{%3, %2, %1, %0%{%8%}%N7|%0%{%8%}%N7, %1, %2, %3}";
6556 [(set_attr "type" "sseshuf")
6557 (set_attr "length_immediate" "1")
6558 (set_attr "prefix" "evex")
6559 (set_attr "mode" "V4SF")])
6561 (define_insn "sse_shufps_<mode>"
6562 [(set (match_operand:VI4F_128 0 "register_operand" "=x,x")
6563 (vec_select:VI4F_128
6564 (vec_concat:<ssedoublevecmode>
6565 (match_operand:VI4F_128 1 "register_operand" "0,x")
6566 (match_operand:VI4F_128 2 "vector_operand" "xBm,xm"))
6567 (parallel [(match_operand 3 "const_0_to_3_operand")
6568 (match_operand 4 "const_0_to_3_operand")
6569 (match_operand 5 "const_4_to_7_operand")
6570 (match_operand 6 "const_4_to_7_operand")])))]
6574 mask |= INTVAL (operands[3]) << 0;
6575 mask |= INTVAL (operands[4]) << 2;
6576 mask |= (INTVAL (operands[5]) - 4) << 4;
6577 mask |= (INTVAL (operands[6]) - 4) << 6;
6578 operands[3] = GEN_INT (mask);
6580 switch (which_alternative)
6583 return "shufps\t{%3, %2, %0|%0, %2, %3}";
6585 return "vshufps\t{%3, %2, %1, %0|%0, %1, %2, %3}";
6590 [(set_attr "isa" "noavx,avx")
6591 (set_attr "type" "sseshuf")
6592 (set_attr "length_immediate" "1")
6593 (set_attr "prefix" "orig,vex")
6594 (set_attr "mode" "V4SF")])
6596 (define_insn "sse_storehps"
6597 [(set (match_operand:V2SF 0 "nonimmediate_operand" "=m,x,x")
6599 (match_operand:V4SF 1 "nonimmediate_operand" "x,x,o")
6600 (parallel [(const_int 2) (const_int 3)])))]
6603 %vmovhps\t{%1, %0|%q0, %1}
6604 %vmovhlps\t{%1, %d0|%d0, %1}
6605 %vmovlps\t{%H1, %d0|%d0, %H1}"
6606 [(set_attr "type" "ssemov")
6607 (set_attr "ssememalign" "64")
6608 (set_attr "prefix" "maybe_vex")
6609 (set_attr "mode" "V2SF,V4SF,V2SF")])
6611 (define_expand "sse_loadhps_exp"
6612 [(set (match_operand:V4SF 0 "nonimmediate_operand")
6615 (match_operand:V4SF 1 "nonimmediate_operand")
6616 (parallel [(const_int 0) (const_int 1)]))
6617 (match_operand:V2SF 2 "nonimmediate_operand")))]
6620 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
6622 emit_insn (gen_sse_loadhps (dst, operands[1], operands[2]));
6624 /* Fix up the destination if needed. */
6625 if (dst != operands[0])
6626 emit_move_insn (operands[0], dst);
6631 (define_insn "sse_loadhps"
6632 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,x,x,x,o")
6635 (match_operand:V4SF 1 "nonimmediate_operand" " 0,x,0,x,0")
6636 (parallel [(const_int 0) (const_int 1)]))
6637 (match_operand:V2SF 2 "nonimmediate_operand" " m,m,x,x,x")))]
6640 movhps\t{%2, %0|%0, %q2}
6641 vmovhps\t{%2, %1, %0|%0, %1, %q2}
6642 movlhps\t{%2, %0|%0, %2}
6643 vmovlhps\t{%2, %1, %0|%0, %1, %2}
6644 %vmovlps\t{%2, %H0|%H0, %2}"
6645 [(set_attr "isa" "noavx,avx,noavx,avx,*")
6646 (set_attr "type" "ssemov")
6647 (set_attr "ssememalign" "64")
6648 (set_attr "prefix" "orig,vex,orig,vex,maybe_vex")
6649 (set_attr "mode" "V2SF,V2SF,V4SF,V4SF,V2SF")])
6651 (define_insn "sse_storelps"
6652 [(set (match_operand:V2SF 0 "nonimmediate_operand" "=m,x,x")
6654 (match_operand:V4SF 1 "nonimmediate_operand" " x,x,m")
6655 (parallel [(const_int 0) (const_int 1)])))]
6658 %vmovlps\t{%1, %0|%q0, %1}
6659 %vmovaps\t{%1, %0|%0, %1}
6660 %vmovlps\t{%1, %d0|%d0, %q1}"
6661 [(set_attr "type" "ssemov")
6662 (set_attr "ssememalign" "64")
6663 (set_attr "prefix" "maybe_vex")
6664 (set_attr "mode" "V2SF,V4SF,V2SF")])
6666 (define_expand "sse_loadlps_exp"
6667 [(set (match_operand:V4SF 0 "nonimmediate_operand")
6669 (match_operand:V2SF 2 "nonimmediate_operand")
6671 (match_operand:V4SF 1 "nonimmediate_operand")
6672 (parallel [(const_int 2) (const_int 3)]))))]
6675 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
6677 emit_insn (gen_sse_loadlps (dst, operands[1], operands[2]));
6679 /* Fix up the destination if needed. */
6680 if (dst != operands[0])
6681 emit_move_insn (operands[0], dst);
6686 (define_insn "sse_loadlps"
6687 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,x,x,x,m")
6689 (match_operand:V2SF 2 "nonimmediate_operand" " 0,x,m,m,x")
6691 (match_operand:V4SF 1 "nonimmediate_operand" " x,x,0,x,0")
6692 (parallel [(const_int 2) (const_int 3)]))))]
6695 shufps\t{$0xe4, %1, %0|%0, %1, 0xe4}
6696 vshufps\t{$0xe4, %1, %2, %0|%0, %2, %1, 0xe4}
6697 movlps\t{%2, %0|%0, %q2}
6698 vmovlps\t{%2, %1, %0|%0, %1, %q2}
6699 %vmovlps\t{%2, %0|%q0, %2}"
6700 [(set_attr "isa" "noavx,avx,noavx,avx,*")
6701 (set_attr "type" "sseshuf,sseshuf,ssemov,ssemov,ssemov")
6702 (set_attr "ssememalign" "64")
6703 (set_attr "length_immediate" "1,1,*,*,*")
6704 (set_attr "prefix" "orig,vex,orig,vex,maybe_vex")
6705 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF,V2SF")])
6707 (define_insn "sse_movss"
6708 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
6710 (match_operand:V4SF 2 "register_operand" " x,x")
6711 (match_operand:V4SF 1 "register_operand" " 0,x")
6715 movss\t{%2, %0|%0, %2}
6716 vmovss\t{%2, %1, %0|%0, %1, %2}"
6717 [(set_attr "isa" "noavx,avx")
6718 (set_attr "type" "ssemov")
6719 (set_attr "prefix" "orig,vex")
6720 (set_attr "mode" "SF")])
6722 (define_insn "avx2_vec_dup<mode>"
6723 [(set (match_operand:VF1_128_256 0 "register_operand" "=x")
6724 (vec_duplicate:VF1_128_256
6726 (match_operand:V4SF 1 "register_operand" "x")
6727 (parallel [(const_int 0)]))))]
6729 "vbroadcastss\t{%1, %0|%0, %1}"
6730 [(set_attr "type" "sselog1")
6731 (set_attr "prefix" "vex")
6732 (set_attr "mode" "<MODE>")])
6734 (define_insn "avx2_vec_dupv8sf_1"
6735 [(set (match_operand:V8SF 0 "register_operand" "=x")
6738 (match_operand:V8SF 1 "register_operand" "x")
6739 (parallel [(const_int 0)]))))]
6741 "vbroadcastss\t{%x1, %0|%0, %x1}"
6742 [(set_attr "type" "sselog1")
6743 (set_attr "prefix" "vex")
6744 (set_attr "mode" "V8SF")])
6746 (define_insn "avx512f_vec_dup<mode>_1"
6747 [(set (match_operand:VF_512 0 "register_operand" "=v")
6748 (vec_duplicate:VF_512
6749 (vec_select:<ssescalarmode>
6750 (match_operand:VF_512 1 "register_operand" "v")
6751 (parallel [(const_int 0)]))))]
6753 "vbroadcast<bcstscalarsuff>\t{%x1, %0|%0, %x1}"
6754 [(set_attr "type" "sselog1")
6755 (set_attr "prefix" "evex")
6756 (set_attr "mode" "<MODE>")])
6758 ;; Although insertps takes register source, we prefer
6759 ;; unpcklps with register source since it is shorter.
6760 (define_insn "*vec_concatv2sf_sse4_1"
6761 [(set (match_operand:V2SF 0 "register_operand"
6762 "=Yr,*x,x,Yr,*x,x,x,*y ,*y")
6764 (match_operand:SF 1 "nonimmediate_operand"
6765 " 0, 0,x, 0,0, x,m, 0 , m")
6766 (match_operand:SF 2 "vector_move_operand"
6767 " Yr,*x,x, m,m, m,C,*ym, C")))]
6768 "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
6770 unpcklps\t{%2, %0|%0, %2}
6771 unpcklps\t{%2, %0|%0, %2}
6772 vunpcklps\t{%2, %1, %0|%0, %1, %2}
6773 insertps\t{$0x10, %2, %0|%0, %2, 0x10}
6774 insertps\t{$0x10, %2, %0|%0, %2, 0x10}
6775 vinsertps\t{$0x10, %2, %1, %0|%0, %1, %2, 0x10}
6776 %vmovss\t{%1, %0|%0, %1}
6777 punpckldq\t{%2, %0|%0, %2}
6778 movd\t{%1, %0|%0, %1}"
6779 [(set_attr "isa" "noavx,noavx,avx,noavx,noavx,avx,*,*,*")
6780 (set_attr "type" "sselog,sselog,sselog,sselog,sselog,sselog,ssemov,mmxcvt,mmxmov")
6781 (set_attr "prefix_data16" "*,*,*,1,1,*,*,*,*")
6782 (set_attr "prefix_extra" "*,*,*,1,1,1,*,*,*")
6783 (set_attr "length_immediate" "*,*,*,1,1,1,*,*,*")
6784 (set_attr "prefix" "orig,orig,vex,orig,orig,vex,maybe_vex,orig,orig")
6785 (set_attr "mode" "V4SF,V4SF,V4SF,V4SF,V4SF,V4SF,SF,DI,DI")])
6787 ;; ??? In theory we can match memory for the MMX alternative, but allowing
6788 ;; vector_operand for operand 2 and *not* allowing memory for the SSE
6789 ;; alternatives pretty much forces the MMX alternative to be chosen.
6790 (define_insn "*vec_concatv2sf_sse"
6791 [(set (match_operand:V2SF 0 "register_operand" "=x,x,*y,*y")
6793 (match_operand:SF 1 "nonimmediate_operand" " 0,m, 0, m")
6794 (match_operand:SF 2 "reg_or_0_operand" " x,C,*y, C")))]
6797 unpcklps\t{%2, %0|%0, %2}
6798 movss\t{%1, %0|%0, %1}
6799 punpckldq\t{%2, %0|%0, %2}
6800 movd\t{%1, %0|%0, %1}"
6801 [(set_attr "type" "sselog,ssemov,mmxcvt,mmxmov")
6802 (set_attr "mode" "V4SF,SF,DI,DI")])
6804 (define_insn "*vec_concatv4sf"
6805 [(set (match_operand:V4SF 0 "register_operand" "=x,x,x,x")
6807 (match_operand:V2SF 1 "register_operand" " 0,x,0,x")
6808 (match_operand:V2SF 2 "nonimmediate_operand" " x,x,m,m")))]
6811 movlhps\t{%2, %0|%0, %2}
6812 vmovlhps\t{%2, %1, %0|%0, %1, %2}
6813 movhps\t{%2, %0|%0, %q2}
6814 vmovhps\t{%2, %1, %0|%0, %1, %q2}"
6815 [(set_attr "isa" "noavx,avx,noavx,avx")
6816 (set_attr "type" "ssemov")
6817 (set_attr "prefix" "orig,vex,orig,vex")
6818 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF")])
6820 (define_expand "vec_init<mode>"
6821 [(match_operand:V_128 0 "register_operand")
6825 ix86_expand_vector_init (false, operands[0], operands[1]);
6829 ;; Avoid combining registers from different units in a single alternative,
6830 ;; see comment above inline_secondary_memory_needed function in i386.c
6831 (define_insn "vec_set<mode>_0"
6832 [(set (match_operand:VI4F_128 0 "nonimmediate_operand"
6833 "=Yr,*v,v,Yi,x,x,v,Yr ,*x ,x ,m ,m ,m")
6835 (vec_duplicate:VI4F_128
6836 (match_operand:<ssescalarmode> 2 "general_operand"
6837 " Yr,*v,m,r ,m,x,v,*rm,*rm,*rm,!x,!*re,!*fF"))
6838 (match_operand:VI4F_128 1 "vector_move_operand"
6839 " C , C,C,C ,C,0,v,0 ,0 ,x ,0 ,0 ,0")
6843 %vinsertps\t{$0xe, %d2, %0|%0, %d2, 0xe}
6844 %vinsertps\t{$0xe, %d2, %0|%0, %d2, 0xe}
6845 %vmov<ssescalarmodesuffix>\t{%2, %0|%0, %2}
6846 %vmovd\t{%2, %0|%0, %2}
6847 movss\t{%2, %0|%0, %2}
6848 movss\t{%2, %0|%0, %2}
6849 vmovss\t{%2, %1, %0|%0, %1, %2}
6850 pinsrd\t{$0, %2, %0|%0, %2, 0}
6851 pinsrd\t{$0, %2, %0|%0, %2, 0}
6852 vpinsrd\t{$0, %2, %1, %0|%0, %1, %2, 0}
6856 [(set_attr "isa" "sse4,sse4,sse2,sse2,noavx,noavx,avx,sse4_noavx,sse4_noavx,avx,*,*,*")
6858 (cond [(eq_attr "alternative" "0,1,7,8,9")
6859 (const_string "sselog")
6860 (eq_attr "alternative" "11")
6861 (const_string "imov")
6862 (eq_attr "alternative" "12")
6863 (const_string "fmov")
6865 (const_string "ssemov")))
6866 (set_attr "prefix_extra" "*,*,*,*,*,*,*,1,1,1,*,*,*")
6867 (set_attr "length_immediate" "*,*,*,*,*,*,*,1,1,1,*,*,*")
6868 (set_attr "prefix" "maybe_vex,maybe_vex,maybe_vex,maybe_vex,orig,orig,vex,orig,orig,vex,*,*,*")
6869 (set_attr "mode" "SF,SF,<ssescalarmode>,SI,SF,SF,SF,TI,TI,TI,*,*,*")])
6871 ;; A subset is vec_setv4sf.
6872 (define_insn "*vec_setv4sf_sse4_1"
6873 [(set (match_operand:V4SF 0 "register_operand" "=Yr,*x,x")
6876 (match_operand:SF 2 "nonimmediate_operand" "Yrm,*xm,xm"))
6877 (match_operand:V4SF 1 "register_operand" "0,0,x")
6878 (match_operand:SI 3 "const_int_operand")))]
6880 && ((unsigned) exact_log2 (INTVAL (operands[3]))
6881 < GET_MODE_NUNITS (V4SFmode))"
6883 operands[3] = GEN_INT (exact_log2 (INTVAL (operands[3])) << 4);
6884 switch (which_alternative)
6888 return "insertps\t{%3, %2, %0|%0, %2, %3}";
6890 return "vinsertps\t{%3, %2, %1, %0|%0, %1, %2, %3}";
6895 [(set_attr "isa" "noavx,noavx,avx")
6896 (set_attr "type" "sselog")
6897 (set_attr "prefix_data16" "1,1,*")
6898 (set_attr "prefix_extra" "1")
6899 (set_attr "length_immediate" "1")
6900 (set_attr "prefix" "orig,orig,vex")
6901 (set_attr "mode" "V4SF")])
6903 (define_insn "sse4_1_insertps"
6904 [(set (match_operand:V4SF 0 "register_operand" "=Yr,*x,x")
6905 (unspec:V4SF [(match_operand:V4SF 2 "nonimmediate_operand" "Yrm,*xm,xm")
6906 (match_operand:V4SF 1 "register_operand" "0,0,x")
6907 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")]
6911 if (MEM_P (operands[2]))
6913 unsigned count_s = INTVAL (operands[3]) >> 6;
6915 operands[3] = GEN_INT (INTVAL (operands[3]) & 0x3f);
6916 operands[2] = adjust_address_nv (operands[2], SFmode, count_s * 4);
6918 switch (which_alternative)
6922 return "insertps\t{%3, %2, %0|%0, %2, %3}";
6924 return "vinsertps\t{%3, %2, %1, %0|%0, %1, %2, %3}";
6929 [(set_attr "isa" "noavx,noavx,avx")
6930 (set_attr "type" "sselog")
6931 (set_attr "prefix_data16" "1,1,*")
6932 (set_attr "prefix_extra" "1")
6933 (set_attr "length_immediate" "1")
6934 (set_attr "prefix" "orig,orig,vex")
6935 (set_attr "mode" "V4SF")])
6938 [(set (match_operand:VI4F_128 0 "memory_operand")
6940 (vec_duplicate:VI4F_128
6941 (match_operand:<ssescalarmode> 1 "nonmemory_operand"))
6944 "TARGET_SSE && reload_completed"
6945 [(set (match_dup 0) (match_dup 1))]
6946 "operands[0] = adjust_address (operands[0], <ssescalarmode>mode, 0);")
6948 (define_expand "vec_set<mode>"
6949 [(match_operand:V 0 "register_operand")
6950 (match_operand:<ssescalarmode> 1 "register_operand")
6951 (match_operand 2 "const_int_operand")]
6954 ix86_expand_vector_set (false, operands[0], operands[1],
6955 INTVAL (operands[2]));
6959 (define_insn_and_split "*vec_extractv4sf_0"
6960 [(set (match_operand:SF 0 "nonimmediate_operand" "=x,m,f,r")
6962 (match_operand:V4SF 1 "nonimmediate_operand" "xm,x,m,m")
6963 (parallel [(const_int 0)])))]
6964 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
6966 "&& reload_completed"
6967 [(set (match_dup 0) (match_dup 1))]
6969 if (REG_P (operands[1]))
6970 operands[1] = gen_rtx_REG (SFmode, REGNO (operands[1]));
6972 operands[1] = adjust_address (operands[1], SFmode, 0);
6975 (define_insn_and_split "*sse4_1_extractps"
6976 [(set (match_operand:SF 0 "nonimmediate_operand" "=rm,rm,x,x")
6978 (match_operand:V4SF 1 "register_operand" "Yr,*x,0,x")
6979 (parallel [(match_operand:SI 2 "const_0_to_3_operand" "n,n,n,n")])))]
6982 %vextractps\t{%2, %1, %0|%0, %1, %2}
6983 %vextractps\t{%2, %1, %0|%0, %1, %2}
6986 "&& reload_completed && SSE_REG_P (operands[0])"
6989 rtx dest = gen_rtx_REG (V4SFmode, REGNO (operands[0]));
6990 switch (INTVAL (operands[2]))
6994 emit_insn (gen_sse_shufps_v4sf (dest, operands[1], operands[1],
6995 operands[2], operands[2],
6996 GEN_INT (INTVAL (operands[2]) + 4),
6997 GEN_INT (INTVAL (operands[2]) + 4)));
7000 emit_insn (gen_vec_interleave_highv4sf (dest, operands[1], operands[1]));
7003 /* 0 should be handled by the *vec_extractv4sf_0 pattern above. */
7008 [(set_attr "isa" "*,*,noavx,avx")
7009 (set_attr "type" "sselog,sselog,*,*")
7010 (set_attr "prefix_data16" "1,1,*,*")
7011 (set_attr "prefix_extra" "1,1,*,*")
7012 (set_attr "length_immediate" "1,1,*,*")
7013 (set_attr "prefix" "maybe_vex,maybe_vex,*,*")
7014 (set_attr "mode" "V4SF,V4SF,*,*")])
7016 (define_insn_and_split "*vec_extractv4sf_mem"
7017 [(set (match_operand:SF 0 "register_operand" "=x,*r,f")
7019 (match_operand:V4SF 1 "memory_operand" "o,o,o")
7020 (parallel [(match_operand 2 "const_0_to_3_operand" "n,n,n")])))]
7023 "&& reload_completed"
7024 [(set (match_dup 0) (match_dup 1))]
7026 operands[1] = adjust_address (operands[1], SFmode, INTVAL (operands[2]) * 4);
7029 (define_mode_attr extract_type
7030 [(V16SF "avx512f") (V16SI "avx512f") (V8DF "avx512dq") (V8DI "avx512dq")])
7032 (define_mode_attr extract_suf
7033 [(V16SF "32x4") (V16SI "32x4") (V8DF "64x2") (V8DI "64x2")])
7035 (define_mode_iterator AVX512_VEC
7036 [(V8DF "TARGET_AVX512DQ") (V8DI "TARGET_AVX512DQ") V16SF V16SI])
7038 (define_expand "<extract_type>_vextract<shuffletype><extract_suf>_mask"
7039 [(match_operand:<ssequartermode> 0 "nonimmediate_operand")
7040 (match_operand:AVX512_VEC 1 "register_operand")
7041 (match_operand:SI 2 "const_0_to_3_operand")
7042 (match_operand:<ssequartermode> 3 "nonimmediate_operand")
7043 (match_operand:QI 4 "register_operand")]
7047 mask = INTVAL (operands[2]);
7049 if (MEM_P (operands[0]) && GET_CODE (operands[3]) == CONST_VECTOR)
7050 operands[0] = force_reg (<ssequartermode>mode, operands[0]);
7052 if (<MODE>mode == V16SImode || <MODE>mode == V16SFmode)
7053 emit_insn (gen_avx512f_vextract<shuffletype>32x4_1_mask (operands[0],
7054 operands[1], GEN_INT (mask * 4), GEN_INT (mask * 4 + 1),
7055 GEN_INT (mask * 4 + 2), GEN_INT (mask * 4 + 3), operands[3],
7058 emit_insn (gen_avx512dq_vextract<shuffletype>64x2_1_mask (operands[0],
7059 operands[1], GEN_INT (mask * 2), GEN_INT (mask * 2 + 1), operands[3],
7064 (define_insn "avx512dq_vextract<shuffletype>64x2_1_maskm"
7065 [(set (match_operand:<ssequartermode> 0 "memory_operand" "=m")
7066 (vec_merge:<ssequartermode>
7067 (vec_select:<ssequartermode>
7068 (match_operand:V8FI 1 "register_operand" "v")
7069 (parallel [(match_operand 2 "const_0_to_7_operand")
7070 (match_operand 3 "const_0_to_7_operand")]))
7071 (match_operand:<ssequartermode> 4 "memory_operand" "0")
7072 (match_operand:QI 5 "register_operand" "k")))]
7074 && (INTVAL (operands[2]) % 2 == 0)
7075 && (INTVAL (operands[2]) == INTVAL (operands[3]) - 1)
7076 && rtx_equal_p (operands[4], operands[0])"
7078 operands[2] = GEN_INT ((INTVAL (operands[2])) >> 1);
7079 return "vextract<shuffletype>64x2\t{%2, %1, %0%{%5%}|%0%{%5%}, %1, %2}";
7081 [(set_attr "type" "sselog")
7082 (set_attr "prefix_extra" "1")
7083 (set_attr "length_immediate" "1")
7084 (set_attr "memory" "store")
7085 (set_attr "prefix" "evex")
7086 (set_attr "mode" "<sseinsnmode>")])
7088 (define_insn "avx512f_vextract<shuffletype>32x4_1_maskm"
7089 [(set (match_operand:<ssequartermode> 0 "memory_operand" "=m")
7090 (vec_merge:<ssequartermode>
7091 (vec_select:<ssequartermode>
7092 (match_operand:V16FI 1 "register_operand" "v")
7093 (parallel [(match_operand 2 "const_0_to_15_operand")
7094 (match_operand 3 "const_0_to_15_operand")
7095 (match_operand 4 "const_0_to_15_operand")
7096 (match_operand 5 "const_0_to_15_operand")]))
7097 (match_operand:<ssequartermode> 6 "memory_operand" "0")
7098 (match_operand:QI 7 "register_operand" "Yk")))]
7100 && ((INTVAL (operands[2]) % 4 == 0)
7101 && INTVAL (operands[2]) == (INTVAL (operands[3]) - 1)
7102 && INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
7103 && INTVAL (operands[4]) == (INTVAL (operands[5]) - 1))
7104 && rtx_equal_p (operands[6], operands[0])"
7106 operands[2] = GEN_INT ((INTVAL (operands[2])) >> 2);
7107 return "vextract<shuffletype>32x4\t{%2, %1, %0%{%7%}|%0%{%7%}, %1, %2}";
7109 [(set_attr "type" "sselog")
7110 (set_attr "prefix_extra" "1")
7111 (set_attr "length_immediate" "1")
7112 (set_attr "memory" "store")
7113 (set_attr "prefix" "evex")
7114 (set_attr "mode" "<sseinsnmode>")])
7116 (define_insn "<mask_codefor>avx512dq_vextract<shuffletype>64x2_1<mask_name>"
7117 [(set (match_operand:<ssequartermode> 0 "<store_mask_predicate>" "=<store_mask_constraint>")
7118 (vec_select:<ssequartermode>
7119 (match_operand:V8FI 1 "register_operand" "v")
7120 (parallel [(match_operand 2 "const_0_to_7_operand")
7121 (match_operand 3 "const_0_to_7_operand")])))]
7122 "TARGET_AVX512DQ && (INTVAL (operands[2]) == INTVAL (operands[3]) - 1)"
7124 operands[2] = GEN_INT ((INTVAL (operands[2])) >> 1);
7125 return "vextract<shuffletype>64x2\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}";
7127 [(set_attr "type" "sselog1")
7128 (set_attr "prefix_extra" "1")
7129 (set_attr "length_immediate" "1")
7130 (set_attr "prefix" "evex")
7131 (set_attr "mode" "<sseinsnmode>")])
7133 (define_insn "<mask_codefor>avx512f_vextract<shuffletype>32x4_1<mask_name>"
7134 [(set (match_operand:<ssequartermode> 0 "<store_mask_predicate>" "=<store_mask_constraint>")
7135 (vec_select:<ssequartermode>
7136 (match_operand:V16FI 1 "register_operand" "v")
7137 (parallel [(match_operand 2 "const_0_to_15_operand")
7138 (match_operand 3 "const_0_to_15_operand")
7139 (match_operand 4 "const_0_to_15_operand")
7140 (match_operand 5 "const_0_to_15_operand")])))]
7142 && (INTVAL (operands[2]) == (INTVAL (operands[3]) - 1)
7143 && INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
7144 && INTVAL (operands[4]) == (INTVAL (operands[5]) - 1))"
7146 operands[2] = GEN_INT ((INTVAL (operands[2])) >> 2);
7147 return "vextract<shuffletype>32x4\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
7149 [(set_attr "type" "sselog1")
7150 (set_attr "prefix_extra" "1")
7151 (set_attr "length_immediate" "1")
7152 (set_attr "prefix" "evex")
7153 (set_attr "mode" "<sseinsnmode>")])
7155 (define_mode_attr extract_type_2
7156 [(V16SF "avx512dq") (V16SI "avx512dq") (V8DF "avx512f") (V8DI "avx512f")])
7158 (define_mode_attr extract_suf_2
7159 [(V16SF "32x8") (V16SI "32x8") (V8DF "64x4") (V8DI "64x4")])
7161 (define_mode_iterator AVX512_VEC_2
7162 [(V16SF "TARGET_AVX512DQ") (V16SI "TARGET_AVX512DQ") V8DF V8DI])
7164 (define_expand "<extract_type_2>_vextract<shuffletype><extract_suf_2>_mask"
7165 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7166 (match_operand:AVX512_VEC_2 1 "register_operand")
7167 (match_operand:SI 2 "const_0_to_1_operand")
7168 (match_operand:<ssehalfvecmode> 3 "nonimmediate_operand")
7169 (match_operand:QI 4 "register_operand")]
7172 rtx (*insn)(rtx, rtx, rtx, rtx);
7174 if (MEM_P (operands[0]) && GET_CODE (operands[3]) == CONST_VECTOR)
7175 operands[0] = force_reg (<ssequartermode>mode, operands[0]);
7177 switch (INTVAL (operands[2]))
7180 insn = gen_vec_extract_lo_<mode>_mask;
7183 insn = gen_vec_extract_hi_<mode>_mask;
7189 emit_insn (insn (operands[0], operands[1], operands[3], operands[4]));
7194 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7195 (vec_select:<ssehalfvecmode>
7196 (match_operand:V8FI 1 "nonimmediate_operand")
7197 (parallel [(const_int 0) (const_int 1)
7198 (const_int 2) (const_int 3)])))]
7199 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))
7201 && (TARGET_AVX512VL || (REG_P (operands[0]) && !EXT_REX_SSE_REG_P (operands[1])))"
7204 rtx op1 = operands[1];
7206 op1 = gen_rtx_REG (<ssehalfvecmode>mode, REGNO (op1));
7208 op1 = gen_lowpart (<ssehalfvecmode>mode, op1);
7209 emit_move_insn (operands[0], op1);
7213 (define_insn "vec_extract_lo_<mode>_maskm"
7214 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7215 (vec_merge:<ssehalfvecmode>
7216 (vec_select:<ssehalfvecmode>
7217 (match_operand:V8FI 1 "register_operand" "v")
7218 (parallel [(const_int 0) (const_int 1)
7219 (const_int 2) (const_int 3)]))
7220 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7221 (match_operand:QI 3 "register_operand" "Yk")))]
7223 && rtx_equal_p (operands[2], operands[0])"
7224 "vextract<shuffletype>64x4\t{$0x0, %1, %0%{%3%}|%0%{%3%}, %1, 0x0}"
7225 [(set_attr "type" "sselog1")
7226 (set_attr "prefix_extra" "1")
7227 (set_attr "length_immediate" "1")
7228 (set_attr "prefix" "evex")
7229 (set_attr "mode" "<sseinsnmode>")])
7231 (define_insn "vec_extract_lo_<mode><mask_name>"
7232 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=<store_mask_constraint>,v")
7233 (vec_select:<ssehalfvecmode>
7234 (match_operand:V8FI 1 "nonimmediate_operand" "v,m")
7235 (parallel [(const_int 0) (const_int 1)
7236 (const_int 2) (const_int 3)])))]
7237 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7239 if (<mask_applied> || !TARGET_AVX512VL)
7240 return "vextract<shuffletype>64x4\t{$0x0, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x0}";
7244 [(set_attr "type" "sselog1")
7245 (set_attr "prefix_extra" "1")
7246 (set_attr "length_immediate" "1")
7247 (set_attr "prefix" "evex")
7248 (set_attr "mode" "<sseinsnmode>")])
7250 (define_insn "vec_extract_hi_<mode>_maskm"
7251 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7252 (vec_merge:<ssehalfvecmode>
7253 (vec_select:<ssehalfvecmode>
7254 (match_operand:V8FI 1 "register_operand" "v")
7255 (parallel [(const_int 4) (const_int 5)
7256 (const_int 6) (const_int 7)]))
7257 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7258 (match_operand:QI 3 "register_operand" "Yk")))]
7260 && rtx_equal_p (operands[2], operands[0])"
7261 "vextract<shuffletype>64x4\t{$0x1, %1, %0%{%3%}|%0%{%3%}, %1, 0x1}"
7262 [(set_attr "type" "sselog")
7263 (set_attr "prefix_extra" "1")
7264 (set_attr "length_immediate" "1")
7265 (set_attr "memory" "store")
7266 (set_attr "prefix" "evex")
7267 (set_attr "mode" "<sseinsnmode>")])
7269 (define_insn "vec_extract_hi_<mode><mask_name>"
7270 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=<store_mask_constraint>")
7271 (vec_select:<ssehalfvecmode>
7272 (match_operand:V8FI 1 "register_operand" "v")
7273 (parallel [(const_int 4) (const_int 5)
7274 (const_int 6) (const_int 7)])))]
7276 "vextract<shuffletype>64x4\t{$0x1, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x1}"
7277 [(set_attr "type" "sselog1")
7278 (set_attr "prefix_extra" "1")
7279 (set_attr "length_immediate" "1")
7280 (set_attr "prefix" "evex")
7281 (set_attr "mode" "<sseinsnmode>")])
7283 (define_insn "vec_extract_hi_<mode>_maskm"
7284 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7285 (vec_merge:<ssehalfvecmode>
7286 (vec_select:<ssehalfvecmode>
7287 (match_operand:V16FI 1 "register_operand" "v")
7288 (parallel [(const_int 8) (const_int 9)
7289 (const_int 10) (const_int 11)
7290 (const_int 12) (const_int 13)
7291 (const_int 14) (const_int 15)]))
7292 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7293 (match_operand:QI 3 "register_operand" "k")))]
7295 && rtx_equal_p (operands[2], operands[0])"
7296 "vextract<shuffletype>32x8\t{$0x1, %1, %0%{%3%}|%0%{%3%}, %1, 0x1}"
7297 [(set_attr "type" "sselog1")
7298 (set_attr "prefix_extra" "1")
7299 (set_attr "length_immediate" "1")
7300 (set_attr "prefix" "evex")
7301 (set_attr "mode" "<sseinsnmode>")])
7303 (define_insn "vec_extract_hi_<mode><mask_name>"
7304 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=<store_mask_constraint>,vm")
7305 (vec_select:<ssehalfvecmode>
7306 (match_operand:V16FI 1 "register_operand" "v,v")
7307 (parallel [(const_int 8) (const_int 9)
7308 (const_int 10) (const_int 11)
7309 (const_int 12) (const_int 13)
7310 (const_int 14) (const_int 15)])))]
7311 "TARGET_AVX512F && <mask_avx512dq_condition>"
7313 vextract<shuffletype>32x8\t{$0x1, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x1}
7314 vextracti64x4\t{$0x1, %1, %0|%0, %1, 0x1}"
7315 [(set_attr "type" "sselog1")
7316 (set_attr "prefix_extra" "1")
7317 (set_attr "isa" "avx512dq,noavx512dq")
7318 (set_attr "length_immediate" "1")
7319 (set_attr "prefix" "evex")
7320 (set_attr "mode" "<sseinsnmode>")])
7322 (define_expand "avx512vl_vextractf128<mode>"
7323 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7324 (match_operand:VI48F_256 1 "register_operand")
7325 (match_operand:SI 2 "const_0_to_1_operand")
7326 (match_operand:<ssehalfvecmode> 3 "vector_move_operand")
7327 (match_operand:QI 4 "register_operand")]
7328 "TARGET_AVX512DQ && TARGET_AVX512VL"
7330 rtx (*insn)(rtx, rtx, rtx, rtx);
7332 if (MEM_P (operands[0]) && GET_CODE (operands[3]) == CONST_VECTOR)
7333 operands[0] = force_reg (<ssehalfvecmode>mode, operands[0]);
7335 switch (INTVAL (operands[2]))
7338 insn = gen_vec_extract_lo_<mode>_mask;
7341 insn = gen_vec_extract_hi_<mode>_mask;
7347 emit_insn (insn (operands[0], operands[1], operands[3], operands[4]));
7351 (define_expand "avx_vextractf128<mode>"
7352 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7353 (match_operand:V_256 1 "register_operand")
7354 (match_operand:SI 2 "const_0_to_1_operand")]
7357 rtx (*insn)(rtx, rtx);
7359 switch (INTVAL (operands[2]))
7362 insn = gen_vec_extract_lo_<mode>;
7365 insn = gen_vec_extract_hi_<mode>;
7371 emit_insn (insn (operands[0], operands[1]));
7375 (define_insn "vec_extract_lo_<mode><mask_name>"
7376 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand" "=v,m")
7377 (vec_select:<ssehalfvecmode>
7378 (match_operand:V16FI 1 "nonimmediate_operand" "vm,v")
7379 (parallel [(const_int 0) (const_int 1)
7380 (const_int 2) (const_int 3)
7381 (const_int 4) (const_int 5)
7382 (const_int 6) (const_int 7)])))]
7384 && <mask_mode512bit_condition>
7385 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7388 return "vextract<shuffletype>32x8\t{$0x0, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x0}";
7394 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7395 (vec_select:<ssehalfvecmode>
7396 (match_operand:V16FI 1 "nonimmediate_operand")
7397 (parallel [(const_int 0) (const_int 1)
7398 (const_int 2) (const_int 3)
7399 (const_int 4) (const_int 5)
7400 (const_int 6) (const_int 7)])))]
7401 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))
7402 && reload_completed"
7405 rtx op1 = operands[1];
7407 op1 = gen_rtx_REG (<ssehalfvecmode>mode, REGNO (op1));
7409 op1 = gen_lowpart (<ssehalfvecmode>mode, op1);
7410 emit_move_insn (operands[0], op1);
7414 (define_insn "vec_extract_lo_<mode><mask_name>"
7415 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=v,m")
7416 (vec_select:<ssehalfvecmode>
7417 (match_operand:VI8F_256 1 "nonimmediate_operand" "vm,v")
7418 (parallel [(const_int 0) (const_int 1)])))]
7420 && <mask_avx512vl_condition> && <mask_avx512dq_condition>
7421 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7424 return "vextract<shuffletype>64x2\t{$0x0, %1, %0%{%3%}|%0%{%3%}, %1, 0x0}";
7428 [(set_attr "type" "sselog")
7429 (set_attr "prefix_extra" "1")
7430 (set_attr "length_immediate" "1")
7431 (set_attr "memory" "none,store")
7432 (set_attr "prefix" "evex")
7433 (set_attr "mode" "XI")])
7436 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7437 (vec_select:<ssehalfvecmode>
7438 (match_operand:VI8F_256 1 "nonimmediate_operand")
7439 (parallel [(const_int 0) (const_int 1)])))]
7440 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))
7441 && reload_completed"
7444 rtx op1 = operands[1];
7446 op1 = gen_rtx_REG (<ssehalfvecmode>mode, REGNO (op1));
7448 op1 = gen_lowpart (<ssehalfvecmode>mode, op1);
7449 emit_move_insn (operands[0], op1);
7453 (define_insn "vec_extract_hi_<mode><mask_name>"
7454 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=v,<store_mask_constraint>")
7455 (vec_select:<ssehalfvecmode>
7456 (match_operand:VI8F_256 1 "register_operand" "v,v")
7457 (parallel [(const_int 2) (const_int 3)])))]
7458 "TARGET_AVX && <mask_avx512vl_condition> && <mask_avx512dq_condition>"
7460 if (TARGET_AVX512VL)
7462 if (TARGET_AVX512DQ)
7463 return "vextract<shuffletype>64x2\t{$0x1, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x1}";
7465 return "vextract<shuffletype>32x4\t{$0x1, %1, %0|%0, %1, 0x1}";
7468 return "vextract<i128>\t{$0x1, %1, %0|%0, %1, 0x1}";
7470 [(set_attr "type" "sselog")
7471 (set_attr "prefix_extra" "1")
7472 (set_attr "length_immediate" "1")
7473 (set_attr "memory" "none,store")
7474 (set_attr "prefix" "vex")
7475 (set_attr "mode" "<sseinsnmode>")])
7478 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7479 (vec_select:<ssehalfvecmode>
7480 (match_operand:VI4F_256 1 "nonimmediate_operand")
7481 (parallel [(const_int 0) (const_int 1)
7482 (const_int 2) (const_int 3)])))]
7483 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1])) && reload_completed"
7486 rtx op1 = operands[1];
7488 op1 = gen_rtx_REG (<ssehalfvecmode>mode, REGNO (op1));
7490 op1 = gen_lowpart (<ssehalfvecmode>mode, op1);
7491 emit_move_insn (operands[0], op1);
7496 (define_insn "vec_extract_lo_<mode><mask_name>"
7497 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=<store_mask_constraint>")
7498 (vec_select:<ssehalfvecmode>
7499 (match_operand:VI4F_256 1 "register_operand" "v")
7500 (parallel [(const_int 0) (const_int 1)
7501 (const_int 2) (const_int 3)])))]
7502 "TARGET_AVX && <mask_avx512vl_condition> && <mask_avx512dq_condition>"
7505 return "vextract<shuffletype>32x4\t{$0x0, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x0}";
7509 [(set_attr "type" "sselog1")
7510 (set_attr "prefix_extra" "1")
7511 (set_attr "length_immediate" "1")
7512 (set_attr "prefix" "evex")
7513 (set_attr "mode" "<sseinsnmode>")])
7515 (define_insn "vec_extract_lo_<mode>_maskm"
7516 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7517 (vec_merge:<ssehalfvecmode>
7518 (vec_select:<ssehalfvecmode>
7519 (match_operand:VI4F_256 1 "register_operand" "v")
7520 (parallel [(const_int 0) (const_int 1)
7521 (const_int 2) (const_int 3)]))
7522 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7523 (match_operand:QI 3 "register_operand" "k")))]
7524 "TARGET_AVX512VL && TARGET_AVX512F
7525 && rtx_equal_p (operands[2], operands[0])"
7526 "vextract<shuffletype>32x4\t{$0x0, %1, %0%{%3%}|%0%{%3%}, %1, 0x0}"
7527 [(set_attr "type" "sselog1")
7528 (set_attr "prefix_extra" "1")
7529 (set_attr "length_immediate" "1")
7530 (set_attr "prefix" "evex")
7531 (set_attr "mode" "<sseinsnmode>")])
7533 (define_insn "vec_extract_hi_<mode>_maskm"
7534 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7535 (vec_merge:<ssehalfvecmode>
7536 (vec_select:<ssehalfvecmode>
7537 (match_operand:VI4F_256 1 "register_operand" "v")
7538 (parallel [(const_int 4) (const_int 5)
7539 (const_int 6) (const_int 7)]))
7540 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7541 (match_operand:<ssehalfvecmode> 3 "register_operand" "k")))]
7542 "TARGET_AVX512F && TARGET_AVX512VL
7543 && rtx_equal_p (operands[2], operands[0])"
7544 "vextract<shuffletype>32x4\t{$0x1, %1, %0%{%3%}|%0%{%3%}, %1, 0x1}"
7545 [(set_attr "type" "sselog1")
7546 (set_attr "length_immediate" "1")
7547 (set_attr "prefix" "evex")
7548 (set_attr "mode" "<sseinsnmode>")])
7550 (define_insn "vec_extract_hi_<mode>_mask"
7551 [(set (match_operand:<ssehalfvecmode> 0 "register_operand" "=v")
7552 (vec_merge:<ssehalfvecmode>
7553 (vec_select:<ssehalfvecmode>
7554 (match_operand:VI4F_256 1 "register_operand" "v")
7555 (parallel [(const_int 4) (const_int 5)
7556 (const_int 6) (const_int 7)]))
7557 (match_operand:<ssehalfvecmode> 2 "vector_move_operand" "0C")
7558 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
7560 "vextract<shuffletype>32x4\t{$0x1, %1, %0%{%3%}%N2|%0%{%3%}%N2, %1, 0x1}"
7561 [(set_attr "type" "sselog1")
7562 (set_attr "length_immediate" "1")
7563 (set_attr "prefix" "evex")
7564 (set_attr "mode" "<sseinsnmode>")])
7566 (define_insn "vec_extract_hi_<mode>"
7567 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand" "=xm, vm")
7568 (vec_select:<ssehalfvecmode>
7569 (match_operand:VI4F_256 1 "register_operand" "x, v")
7570 (parallel [(const_int 4) (const_int 5)
7571 (const_int 6) (const_int 7)])))]
7574 vextract<i128>\t{$0x1, %1, %0|%0, %1, 0x1}
7575 vextract<shuffletype>32x4\t{$0x1, %1, %0|%0, %1, 0x1}"
7576 [(set_attr "isa" "*, avx512vl")
7577 (set_attr "prefix" "vex, evex")
7578 (set_attr "type" "sselog1")
7579 (set_attr "length_immediate" "1")
7580 (set_attr "mode" "<sseinsnmode>")])
7582 (define_insn_and_split "vec_extract_lo_v32hi"
7583 [(set (match_operand:V16HI 0 "nonimmediate_operand" "=v,m")
7585 (match_operand:V32HI 1 "nonimmediate_operand" "vm,v")
7586 (parallel [(const_int 0) (const_int 1)
7587 (const_int 2) (const_int 3)
7588 (const_int 4) (const_int 5)
7589 (const_int 6) (const_int 7)
7590 (const_int 8) (const_int 9)
7591 (const_int 10) (const_int 11)
7592 (const_int 12) (const_int 13)
7593 (const_int 14) (const_int 15)])))]
7594 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7596 "&& reload_completed"
7597 [(set (match_dup 0) (match_dup 1))]
7599 if (REG_P (operands[1]))
7600 operands[1] = gen_rtx_REG (V16HImode, REGNO (operands[1]));
7602 operands[1] = adjust_address (operands[1], V16HImode, 0);
7605 (define_insn "vec_extract_hi_v32hi"
7606 [(set (match_operand:V16HI 0 "nonimmediate_operand" "=v,m")
7608 (match_operand:V32HI 1 "register_operand" "v,v")
7609 (parallel [(const_int 16) (const_int 17)
7610 (const_int 18) (const_int 19)
7611 (const_int 20) (const_int 21)
7612 (const_int 22) (const_int 23)
7613 (const_int 24) (const_int 25)
7614 (const_int 26) (const_int 27)
7615 (const_int 28) (const_int 29)
7616 (const_int 30) (const_int 31)])))]
7618 "vextracti64x4\t{$0x1, %1, %0|%0, %1, 0x1}"
7619 [(set_attr "type" "sselog")
7620 (set_attr "prefix_extra" "1")
7621 (set_attr "length_immediate" "1")
7622 (set_attr "memory" "none,store")
7623 (set_attr "prefix" "evex")
7624 (set_attr "mode" "XI")])
7626 (define_insn_and_split "vec_extract_lo_v16hi"
7627 [(set (match_operand:V8HI 0 "nonimmediate_operand" "=x,m")
7629 (match_operand:V16HI 1 "nonimmediate_operand" "xm,x")
7630 (parallel [(const_int 0) (const_int 1)
7631 (const_int 2) (const_int 3)
7632 (const_int 4) (const_int 5)
7633 (const_int 6) (const_int 7)])))]
7634 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7636 "&& reload_completed"
7637 [(set (match_dup 0) (match_dup 1))]
7639 if (REG_P (operands[1]))
7640 operands[1] = gen_rtx_REG (V8HImode, REGNO (operands[1]));
7642 operands[1] = adjust_address (operands[1], V8HImode, 0);
7645 (define_insn "vec_extract_hi_v16hi"
7646 [(set (match_operand:V8HI 0 "nonimmediate_operand" "=x,m")
7648 (match_operand:V16HI 1 "register_operand" "x,x")
7649 (parallel [(const_int 8) (const_int 9)
7650 (const_int 10) (const_int 11)
7651 (const_int 12) (const_int 13)
7652 (const_int 14) (const_int 15)])))]
7654 "vextract%~128\t{$0x1, %1, %0|%0, %1, 0x1}"
7655 [(set_attr "type" "sselog")
7656 (set_attr "prefix_extra" "1")
7657 (set_attr "length_immediate" "1")
7658 (set_attr "memory" "none,store")
7659 (set_attr "prefix" "vex")
7660 (set_attr "mode" "OI")])
7662 (define_insn_and_split "vec_extract_lo_v64qi"
7663 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=v,m")
7665 (match_operand:V64QI 1 "nonimmediate_operand" "vm,v")
7666 (parallel [(const_int 0) (const_int 1)
7667 (const_int 2) (const_int 3)
7668 (const_int 4) (const_int 5)
7669 (const_int 6) (const_int 7)
7670 (const_int 8) (const_int 9)
7671 (const_int 10) (const_int 11)
7672 (const_int 12) (const_int 13)
7673 (const_int 14) (const_int 15)
7674 (const_int 16) (const_int 17)
7675 (const_int 18) (const_int 19)
7676 (const_int 20) (const_int 21)
7677 (const_int 22) (const_int 23)
7678 (const_int 24) (const_int 25)
7679 (const_int 26) (const_int 27)
7680 (const_int 28) (const_int 29)
7681 (const_int 30) (const_int 31)])))]
7682 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7684 "&& reload_completed"
7685 [(set (match_dup 0) (match_dup 1))]
7687 if (REG_P (operands[1]))
7688 operands[1] = gen_rtx_REG (V32QImode, REGNO (operands[1]));
7690 operands[1] = adjust_address (operands[1], V32QImode, 0);
7693 (define_insn "vec_extract_hi_v64qi"
7694 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=v,m")
7696 (match_operand:V64QI 1 "register_operand" "v,v")
7697 (parallel [(const_int 32) (const_int 33)
7698 (const_int 34) (const_int 35)
7699 (const_int 36) (const_int 37)
7700 (const_int 38) (const_int 39)
7701 (const_int 40) (const_int 41)
7702 (const_int 42) (const_int 43)
7703 (const_int 44) (const_int 45)
7704 (const_int 46) (const_int 47)
7705 (const_int 48) (const_int 49)
7706 (const_int 50) (const_int 51)
7707 (const_int 52) (const_int 53)
7708 (const_int 54) (const_int 55)
7709 (const_int 56) (const_int 57)
7710 (const_int 58) (const_int 59)
7711 (const_int 60) (const_int 61)
7712 (const_int 62) (const_int 63)])))]
7714 "vextracti64x4\t{$0x1, %1, %0|%0, %1, 0x1}"
7715 [(set_attr "type" "sselog")
7716 (set_attr "prefix_extra" "1")
7717 (set_attr "length_immediate" "1")
7718 (set_attr "memory" "none,store")
7719 (set_attr "prefix" "evex")
7720 (set_attr "mode" "XI")])
7722 (define_insn_and_split "vec_extract_lo_v32qi"
7723 [(set (match_operand:V16QI 0 "nonimmediate_operand" "=x,m")
7725 (match_operand:V32QI 1 "nonimmediate_operand" "xm,x")
7726 (parallel [(const_int 0) (const_int 1)
7727 (const_int 2) (const_int 3)
7728 (const_int 4) (const_int 5)
7729 (const_int 6) (const_int 7)
7730 (const_int 8) (const_int 9)
7731 (const_int 10) (const_int 11)
7732 (const_int 12) (const_int 13)
7733 (const_int 14) (const_int 15)])))]
7734 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7736 "&& reload_completed"
7737 [(set (match_dup 0) (match_dup 1))]
7739 if (REG_P (operands[1]))
7740 operands[1] = gen_rtx_REG (V16QImode, REGNO (operands[1]));
7742 operands[1] = adjust_address (operands[1], V16QImode, 0);
7745 (define_insn "vec_extract_hi_v32qi"
7746 [(set (match_operand:V16QI 0 "nonimmediate_operand" "=x,m")
7748 (match_operand:V32QI 1 "register_operand" "x,x")
7749 (parallel [(const_int 16) (const_int 17)
7750 (const_int 18) (const_int 19)
7751 (const_int 20) (const_int 21)
7752 (const_int 22) (const_int 23)
7753 (const_int 24) (const_int 25)
7754 (const_int 26) (const_int 27)
7755 (const_int 28) (const_int 29)
7756 (const_int 30) (const_int 31)])))]
7758 "vextract%~128\t{$0x1, %1, %0|%0, %1, 0x1}"
7759 [(set_attr "type" "sselog")
7760 (set_attr "prefix_extra" "1")
7761 (set_attr "length_immediate" "1")
7762 (set_attr "memory" "none,store")
7763 (set_attr "prefix" "vex")
7764 (set_attr "mode" "OI")])
7766 ;; Modes handled by vec_extract patterns.
7767 (define_mode_iterator VEC_EXTRACT_MODE
7768 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX") V16QI
7769 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX") V8HI
7770 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
7771 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI
7772 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
7773 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") V2DF])
7775 (define_expand "vec_extract<mode>"
7776 [(match_operand:<ssescalarmode> 0 "register_operand")
7777 (match_operand:VEC_EXTRACT_MODE 1 "register_operand")
7778 (match_operand 2 "const_int_operand")]
7781 ix86_expand_vector_extract (false, operands[0], operands[1],
7782 INTVAL (operands[2]));
7786 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7788 ;; Parallel double-precision floating point element swizzling
7790 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7792 (define_insn "<mask_codefor>avx512f_unpckhpd512<mask_name>"
7793 [(set (match_operand:V8DF 0 "register_operand" "=v")
7796 (match_operand:V8DF 1 "register_operand" "v")
7797 (match_operand:V8DF 2 "nonimmediate_operand" "vm"))
7798 (parallel [(const_int 1) (const_int 9)
7799 (const_int 3) (const_int 11)
7800 (const_int 5) (const_int 13)
7801 (const_int 7) (const_int 15)])))]
7803 "vunpckhpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
7804 [(set_attr "type" "sselog")
7805 (set_attr "prefix" "evex")
7806 (set_attr "mode" "V8DF")])
7808 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
7809 (define_insn "avx_unpckhpd256<mask_name>"
7810 [(set (match_operand:V4DF 0 "register_operand" "=v")
7813 (match_operand:V4DF 1 "register_operand" "v")
7814 (match_operand:V4DF 2 "nonimmediate_operand" "vm"))
7815 (parallel [(const_int 1) (const_int 5)
7816 (const_int 3) (const_int 7)])))]
7817 "TARGET_AVX && <mask_avx512vl_condition>"
7818 "vunpckhpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
7819 [(set_attr "type" "sselog")
7820 (set_attr "prefix" "vex")
7821 (set_attr "mode" "V4DF")])
7823 (define_expand "vec_interleave_highv4df"
7827 (match_operand:V4DF 1 "register_operand" "x")
7828 (match_operand:V4DF 2 "nonimmediate_operand" "xm"))
7829 (parallel [(const_int 0) (const_int 4)
7830 (const_int 2) (const_int 6)])))
7836 (parallel [(const_int 1) (const_int 5)
7837 (const_int 3) (const_int 7)])))
7838 (set (match_operand:V4DF 0 "register_operand")
7843 (parallel [(const_int 2) (const_int 3)
7844 (const_int 6) (const_int 7)])))]
7847 operands[3] = gen_reg_rtx (V4DFmode);
7848 operands[4] = gen_reg_rtx (V4DFmode);
7852 (define_insn "avx512vl_unpckhpd128_mask"
7853 [(set (match_operand:V2DF 0 "register_operand" "=v")
7857 (match_operand:V2DF 1 "register_operand" "v")
7858 (match_operand:V2DF 2 "nonimmediate_operand" "vm"))
7859 (parallel [(const_int 1) (const_int 3)]))
7860 (match_operand:V2DF 3 "vector_move_operand" "0C")
7861 (match_operand:QI 4 "register_operand" "Yk")))]
7863 "vunpckhpd\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
7864 [(set_attr "type" "sselog")
7865 (set_attr "prefix" "evex")
7866 (set_attr "mode" "V2DF")])
7868 (define_expand "vec_interleave_highv2df"
7869 [(set (match_operand:V2DF 0 "register_operand")
7872 (match_operand:V2DF 1 "nonimmediate_operand")
7873 (match_operand:V2DF 2 "nonimmediate_operand"))
7874 (parallel [(const_int 1)
7878 if (!ix86_vec_interleave_v2df_operator_ok (operands, 1))
7879 operands[2] = force_reg (V2DFmode, operands[2]);
7882 (define_insn "*vec_interleave_highv2df"
7883 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,x,x,x,x,m")
7886 (match_operand:V2DF 1 "nonimmediate_operand" " 0,x,o,o,o,x")
7887 (match_operand:V2DF 2 "nonimmediate_operand" " x,x,1,0,x,0"))
7888 (parallel [(const_int 1)
7890 "TARGET_SSE2 && ix86_vec_interleave_v2df_operator_ok (operands, 1)"
7892 unpckhpd\t{%2, %0|%0, %2}
7893 vunpckhpd\t{%2, %1, %0|%0, %1, %2}
7894 %vmovddup\t{%H1, %0|%0, %H1}
7895 movlpd\t{%H1, %0|%0, %H1}
7896 vmovlpd\t{%H1, %2, %0|%0, %2, %H1}
7897 %vmovhpd\t{%1, %0|%q0, %1}"
7898 [(set_attr "isa" "noavx,avx,sse3,noavx,avx,*")
7899 (set_attr "type" "sselog,sselog,sselog,ssemov,ssemov,ssemov")
7900 (set_attr "ssememalign" "64")
7901 (set_attr "prefix_data16" "*,*,*,1,*,1")
7902 (set_attr "prefix" "orig,vex,maybe_vex,orig,vex,maybe_vex")
7903 (set_attr "mode" "V2DF,V2DF,DF,V1DF,V1DF,V1DF")])
7905 (define_expand "avx512f_movddup512<mask_name>"
7906 [(set (match_operand:V8DF 0 "register_operand")
7909 (match_operand:V8DF 1 "nonimmediate_operand")
7911 (parallel [(const_int 0) (const_int 8)
7912 (const_int 2) (const_int 10)
7913 (const_int 4) (const_int 12)
7914 (const_int 6) (const_int 14)])))]
7917 (define_expand "avx512f_unpcklpd512<mask_name>"
7918 [(set (match_operand:V8DF 0 "register_operand")
7921 (match_operand:V8DF 1 "register_operand")
7922 (match_operand:V8DF 2 "nonimmediate_operand"))
7923 (parallel [(const_int 0) (const_int 8)
7924 (const_int 2) (const_int 10)
7925 (const_int 4) (const_int 12)
7926 (const_int 6) (const_int 14)])))]
7929 (define_insn "*avx512f_unpcklpd512<mask_name>"
7930 [(set (match_operand:V8DF 0 "register_operand" "=v,v")
7933 (match_operand:V8DF 1 "nonimmediate_operand" "vm, v")
7934 (match_operand:V8DF 2 "nonimmediate_operand" "1 ,vm"))
7935 (parallel [(const_int 0) (const_int 8)
7936 (const_int 2) (const_int 10)
7937 (const_int 4) (const_int 12)
7938 (const_int 6) (const_int 14)])))]
7941 vmovddup\t{%1, %0<mask_operand3>|%0<mask_operand3>, %1}
7942 vunpcklpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
7943 [(set_attr "type" "sselog")
7944 (set_attr "prefix" "evex")
7945 (set_attr "mode" "V8DF")])
7947 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
7948 (define_expand "avx_movddup256<mask_name>"
7949 [(set (match_operand:V4DF 0 "register_operand")
7952 (match_operand:V4DF 1 "nonimmediate_operand")
7954 (parallel [(const_int 0) (const_int 4)
7955 (const_int 2) (const_int 6)])))]
7956 "TARGET_AVX && <mask_avx512vl_condition>")
7958 (define_expand "avx_unpcklpd256<mask_name>"
7959 [(set (match_operand:V4DF 0 "register_operand")
7962 (match_operand:V4DF 1 "register_operand")
7963 (match_operand:V4DF 2 "nonimmediate_operand"))
7964 (parallel [(const_int 0) (const_int 4)
7965 (const_int 2) (const_int 6)])))]
7966 "TARGET_AVX && <mask_avx512vl_condition>")
7968 (define_insn "*avx_unpcklpd256<mask_name>"
7969 [(set (match_operand:V4DF 0 "register_operand" "=v,v")
7972 (match_operand:V4DF 1 "nonimmediate_operand" " v,m")
7973 (match_operand:V4DF 2 "nonimmediate_operand" "vm,1"))
7974 (parallel [(const_int 0) (const_int 4)
7975 (const_int 2) (const_int 6)])))]
7976 "TARGET_AVX && <mask_avx512vl_condition>"
7978 vunpcklpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
7979 vmovddup\t{%1, %0<mask_operand3>|%0<mask_operand3>, %1}"
7980 [(set_attr "type" "sselog")
7981 (set_attr "prefix" "vex")
7982 (set_attr "mode" "V4DF")])
7984 (define_expand "vec_interleave_lowv4df"
7988 (match_operand:V4DF 1 "register_operand" "x")
7989 (match_operand:V4DF 2 "nonimmediate_operand" "xm"))
7990 (parallel [(const_int 0) (const_int 4)
7991 (const_int 2) (const_int 6)])))
7997 (parallel [(const_int 1) (const_int 5)
7998 (const_int 3) (const_int 7)])))
7999 (set (match_operand:V4DF 0 "register_operand")
8004 (parallel [(const_int 0) (const_int 1)
8005 (const_int 4) (const_int 5)])))]
8008 operands[3] = gen_reg_rtx (V4DFmode);
8009 operands[4] = gen_reg_rtx (V4DFmode);
8012 (define_insn "avx512vl_unpcklpd128_mask"
8013 [(set (match_operand:V2DF 0 "register_operand" "=v")
8017 (match_operand:V2DF 1 "register_operand" "v")
8018 (match_operand:V2DF 2 "nonimmediate_operand" "vm"))
8019 (parallel [(const_int 0) (const_int 2)]))
8020 (match_operand:V2DF 3 "vector_move_operand" "0C")
8021 (match_operand:QI 4 "register_operand" "Yk")))]
8023 "vunpcklpd\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
8024 [(set_attr "type" "sselog")
8025 (set_attr "prefix" "evex")
8026 (set_attr "mode" "V2DF")])
8028 (define_expand "vec_interleave_lowv2df"
8029 [(set (match_operand:V2DF 0 "register_operand")
8032 (match_operand:V2DF 1 "nonimmediate_operand")
8033 (match_operand:V2DF 2 "nonimmediate_operand"))
8034 (parallel [(const_int 0)
8038 if (!ix86_vec_interleave_v2df_operator_ok (operands, 0))
8039 operands[1] = force_reg (V2DFmode, operands[1]);
8042 (define_insn "*vec_interleave_lowv2df"
8043 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,x,x,x,x,o")
8046 (match_operand:V2DF 1 "nonimmediate_operand" " 0,x,m,0,x,0")
8047 (match_operand:V2DF 2 "nonimmediate_operand" " x,x,1,m,m,x"))
8048 (parallel [(const_int 0)
8050 "TARGET_SSE2 && ix86_vec_interleave_v2df_operator_ok (operands, 0)"
8052 unpcklpd\t{%2, %0|%0, %2}
8053 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
8054 %vmovddup\t{%1, %0|%0, %q1}
8055 movhpd\t{%2, %0|%0, %q2}
8056 vmovhpd\t{%2, %1, %0|%0, %1, %q2}
8057 %vmovlpd\t{%2, %H0|%H0, %2}"
8058 [(set_attr "isa" "noavx,avx,sse3,noavx,avx,*")
8059 (set_attr "type" "sselog,sselog,sselog,ssemov,ssemov,ssemov")
8060 (set_attr "ssememalign" "64")
8061 (set_attr "prefix_data16" "*,*,*,1,*,1")
8062 (set_attr "prefix" "orig,vex,maybe_vex,orig,vex,maybe_vex")
8063 (set_attr "mode" "V2DF,V2DF,DF,V1DF,V1DF,V1DF")])
8066 [(set (match_operand:V2DF 0 "memory_operand")
8069 (match_operand:V2DF 1 "register_operand")
8071 (parallel [(const_int 0)
8073 "TARGET_SSE3 && reload_completed"
8076 rtx low = gen_rtx_REG (DFmode, REGNO (operands[1]));
8077 emit_move_insn (adjust_address (operands[0], DFmode, 0), low);
8078 emit_move_insn (adjust_address (operands[0], DFmode, 8), low);
8083 [(set (match_operand:V2DF 0 "register_operand")
8086 (match_operand:V2DF 1 "memory_operand")
8088 (parallel [(match_operand:SI 2 "const_0_to_1_operand")
8089 (match_operand:SI 3 "const_int_operand")])))]
8090 "TARGET_SSE3 && INTVAL (operands[2]) + 2 == INTVAL (operands[3])"
8091 [(set (match_dup 0) (vec_duplicate:V2DF (match_dup 1)))]
8093 operands[1] = adjust_address (operands[1], DFmode, INTVAL (operands[2]) * 8);
8096 (define_insn "avx512f_vmscalef<mode><round_name>"
8097 [(set (match_operand:VF_128 0 "register_operand" "=v")
8100 [(match_operand:VF_128 1 "register_operand" "v")
8101 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>")]
8106 "vscalef<ssescalarmodesuffix>\t{<round_op3>%2, %1, %0|%0, %1, %2<round_op3>}"
8107 [(set_attr "prefix" "evex")
8108 (set_attr "mode" "<ssescalarmode>")])
8110 (define_insn "<avx512>_scalef<mode><mask_name><round_name>"
8111 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8113 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
8114 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")]
8117 "vscalef<ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
8118 [(set_attr "prefix" "evex")
8119 (set_attr "mode" "<MODE>")])
8121 (define_expand "<avx512>_vternlog<mode>_maskz"
8122 [(match_operand:VI48_AVX512VL 0 "register_operand")
8123 (match_operand:VI48_AVX512VL 1 "register_operand")
8124 (match_operand:VI48_AVX512VL 2 "register_operand")
8125 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand")
8126 (match_operand:SI 4 "const_0_to_255_operand")
8127 (match_operand:<avx512fmaskmode> 5 "register_operand")]
8130 emit_insn (gen_<avx512>_vternlog<mode>_maskz_1 (
8131 operands[0], operands[1], operands[2], operands[3],
8132 operands[4], CONST0_RTX (<MODE>mode), operands[5]));
8136 (define_insn "<avx512>_vternlog<mode><sd_maskz_name>"
8137 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
8138 (unspec:VI48_AVX512VL
8139 [(match_operand:VI48_AVX512VL 1 "register_operand" "0")
8140 (match_operand:VI48_AVX512VL 2 "register_operand" "v")
8141 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand" "vm")
8142 (match_operand:SI 4 "const_0_to_255_operand")]
8145 "vpternlog<ssemodesuffix>\t{%4, %3, %2, %0<sd_mask_op5>|%0<sd_mask_op5>, %2, %3, %4}"
8146 [(set_attr "type" "sselog")
8147 (set_attr "prefix" "evex")
8148 (set_attr "mode" "<sseinsnmode>")])
8150 (define_insn "<avx512>_vternlog<mode>_mask"
8151 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
8152 (vec_merge:VI48_AVX512VL
8153 (unspec:VI48_AVX512VL
8154 [(match_operand:VI48_AVX512VL 1 "register_operand" "0")
8155 (match_operand:VI48_AVX512VL 2 "register_operand" "v")
8156 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand" "vm")
8157 (match_operand:SI 4 "const_0_to_255_operand")]
8160 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
8162 "vpternlog<ssemodesuffix>\t{%4, %3, %2, %0%{%5%}|%0%{%5%}, %2, %3, %4}"
8163 [(set_attr "type" "sselog")
8164 (set_attr "prefix" "evex")
8165 (set_attr "mode" "<sseinsnmode>")])
8167 (define_insn "<avx512>_getexp<mode><mask_name><round_saeonly_name>"
8168 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8169 (unspec:VF_AVX512VL [(match_operand:VF_AVX512VL 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
8172 "vgetexp<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}";
8173 [(set_attr "prefix" "evex")
8174 (set_attr "mode" "<MODE>")])
8176 (define_insn "avx512f_sgetexp<mode><round_saeonly_name>"
8177 [(set (match_operand:VF_128 0 "register_operand" "=v")
8180 [(match_operand:VF_128 1 "register_operand" "v")
8181 (match_operand:VF_128 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
8186 "vgetexp<ssescalarmodesuffix>\t{<round_saeonly_op3>%2, %1, %0|%0, %1, %2<round_saeonly_op3>}";
8187 [(set_attr "prefix" "evex")
8188 (set_attr "mode" "<ssescalarmode>")])
8190 (define_insn "<mask_codefor><avx512>_align<mode><mask_name>"
8191 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
8192 (unspec:VI48_AVX512VL [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
8193 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")
8194 (match_operand:SI 3 "const_0_to_255_operand")]
8197 "valign<ssemodesuffix>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3}";
8198 [(set_attr "prefix" "evex")
8199 (set_attr "mode" "<sseinsnmode>")])
8201 (define_expand "avx512f_shufps512_mask"
8202 [(match_operand:V16SF 0 "register_operand")
8203 (match_operand:V16SF 1 "register_operand")
8204 (match_operand:V16SF 2 "nonimmediate_operand")
8205 (match_operand:SI 3 "const_0_to_255_operand")
8206 (match_operand:V16SF 4 "register_operand")
8207 (match_operand:HI 5 "register_operand")]
8210 int mask = INTVAL (operands[3]);
8211 emit_insn (gen_avx512f_shufps512_1_mask (operands[0], operands[1], operands[2],
8212 GEN_INT ((mask >> 0) & 3),
8213 GEN_INT ((mask >> 2) & 3),
8214 GEN_INT (((mask >> 4) & 3) + 16),
8215 GEN_INT (((mask >> 6) & 3) + 16),
8216 GEN_INT (((mask >> 0) & 3) + 4),
8217 GEN_INT (((mask >> 2) & 3) + 4),
8218 GEN_INT (((mask >> 4) & 3) + 20),
8219 GEN_INT (((mask >> 6) & 3) + 20),
8220 GEN_INT (((mask >> 0) & 3) + 8),
8221 GEN_INT (((mask >> 2) & 3) + 8),
8222 GEN_INT (((mask >> 4) & 3) + 24),
8223 GEN_INT (((mask >> 6) & 3) + 24),
8224 GEN_INT (((mask >> 0) & 3) + 12),
8225 GEN_INT (((mask >> 2) & 3) + 12),
8226 GEN_INT (((mask >> 4) & 3) + 28),
8227 GEN_INT (((mask >> 6) & 3) + 28),
8228 operands[4], operands[5]));
8233 (define_expand "<avx512>_fixupimm<mode>_maskz<round_saeonly_expand_name>"
8234 [(match_operand:VF_AVX512VL 0 "register_operand")
8235 (match_operand:VF_AVX512VL 1 "register_operand")
8236 (match_operand:VF_AVX512VL 2 "register_operand")
8237 (match_operand:<sseintvecmode> 3 "<round_saeonly_expand_nimm_predicate>")
8238 (match_operand:SI 4 "const_0_to_255_operand")
8239 (match_operand:<avx512fmaskmode> 5 "register_operand")]
8242 emit_insn (gen_<avx512>_fixupimm<mode>_maskz_1<round_saeonly_expand_name> (
8243 operands[0], operands[1], operands[2], operands[3],
8244 operands[4], CONST0_RTX (<MODE>mode), operands[5]
8245 <round_saeonly_expand_operand6>));
8249 (define_insn "<avx512>_fixupimm<mode><sd_maskz_name><round_saeonly_name>"
8250 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8252 [(match_operand:VF_AVX512VL 1 "register_operand" "0")
8253 (match_operand:VF_AVX512VL 2 "register_operand" "v")
8254 (match_operand:<sseintvecmode> 3 "nonimmediate_operand" "<round_saeonly_constraint>")
8255 (match_operand:SI 4 "const_0_to_255_operand")]
8258 "vfixupimm<ssemodesuffix>\t{%4, <round_saeonly_sd_mask_op5>%3, %2, %0<sd_mask_op5>|%0<sd_mask_op5>, %2, %3<round_saeonly_sd_mask_op5>, %4}";
8259 [(set_attr "prefix" "evex")
8260 (set_attr "mode" "<MODE>")])
8262 (define_insn "<avx512>_fixupimm<mode>_mask<round_saeonly_name>"
8263 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8264 (vec_merge:VF_AVX512VL
8266 [(match_operand:VF_AVX512VL 1 "register_operand" "0")
8267 (match_operand:VF_AVX512VL 2 "register_operand" "v")
8268 (match_operand:<sseintvecmode> 3 "nonimmediate_operand" "<round_saeonly_constraint>")
8269 (match_operand:SI 4 "const_0_to_255_operand")]
8272 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
8274 "vfixupimm<ssemodesuffix>\t{%4, <round_saeonly_op6>%3, %2, %0%{%5%}|%0%{%5%}, %2, %3<round_saeonly_op6>, %4}";
8275 [(set_attr "prefix" "evex")
8276 (set_attr "mode" "<MODE>")])
8278 (define_expand "avx512f_sfixupimm<mode>_maskz<round_saeonly_expand_name>"
8279 [(match_operand:VF_128 0 "register_operand")
8280 (match_operand:VF_128 1 "register_operand")
8281 (match_operand:VF_128 2 "register_operand")
8282 (match_operand:<sseintvecmode> 3 "<round_saeonly_expand_nimm_predicate>")
8283 (match_operand:SI 4 "const_0_to_255_operand")
8284 (match_operand:<avx512fmaskmode> 5 "register_operand")]
8287 emit_insn (gen_avx512f_sfixupimm<mode>_maskz_1<round_saeonly_expand_name> (
8288 operands[0], operands[1], operands[2], operands[3],
8289 operands[4], CONST0_RTX (<MODE>mode), operands[5]
8290 <round_saeonly_expand_operand6>));
8294 (define_insn "avx512f_sfixupimm<mode><sd_maskz_name><round_saeonly_name>"
8295 [(set (match_operand:VF_128 0 "register_operand" "=v")
8298 [(match_operand:VF_128 1 "register_operand" "0")
8299 (match_operand:VF_128 2 "register_operand" "v")
8300 (match_operand:<sseintvecmode> 3 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
8301 (match_operand:SI 4 "const_0_to_255_operand")]
8306 "vfixupimm<ssescalarmodesuffix>\t{%4, <round_saeonly_sd_mask_op5>%3, %2, %0<sd_mask_op5>|%0<sd_mask_op5>, %2, %3<round_saeonly_sd_mask_op5>, %4}";
8307 [(set_attr "prefix" "evex")
8308 (set_attr "mode" "<ssescalarmode>")])
8310 (define_insn "avx512f_sfixupimm<mode>_mask<round_saeonly_name>"
8311 [(set (match_operand:VF_128 0 "register_operand" "=v")
8315 [(match_operand:VF_128 1 "register_operand" "0")
8316 (match_operand:VF_128 2 "register_operand" "v")
8317 (match_operand:<sseintvecmode> 3 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
8318 (match_operand:SI 4 "const_0_to_255_operand")]
8323 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
8325 "vfixupimm<ssescalarmodesuffix>\t{%4, <round_saeonly_op6>%3, %2, %0%{%5%}|%0%{%5%}, %2, %3<round_saeonly_op6>, %4}";
8326 [(set_attr "prefix" "evex")
8327 (set_attr "mode" "<ssescalarmode>")])
8329 (define_insn "<avx512>_rndscale<mode><mask_name><round_saeonly_name>"
8330 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8332 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "<round_saeonly_constraint>")
8333 (match_operand:SI 2 "const_0_to_255_operand")]
8336 "vrndscale<ssemodesuffix>\t{%2, <round_saeonly_mask_op3>%1, %0<mask_operand3>|%0<mask_operand3>, %1<round_saeonly_mask_op3>, %2}"
8337 [(set_attr "length_immediate" "1")
8338 (set_attr "prefix" "evex")
8339 (set_attr "mode" "<MODE>")])
8341 (define_insn "avx512f_rndscale<mode><round_saeonly_name>"
8342 [(set (match_operand:VF_128 0 "register_operand" "=v")
8345 [(match_operand:VF_128 1 "register_operand" "v")
8346 (match_operand:VF_128 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
8347 (match_operand:SI 3 "const_0_to_255_operand")]
8352 "vrndscale<ssescalarmodesuffix>\t{%3, <round_saeonly_op4>%2, %1, %0|%0, %1, %2<round_saeonly_op4>, %3}"
8353 [(set_attr "length_immediate" "1")
8354 (set_attr "prefix" "evex")
8355 (set_attr "mode" "<MODE>")])
8357 ;; One bit in mask selects 2 elements.
8358 (define_insn "avx512f_shufps512_1<mask_name>"
8359 [(set (match_operand:V16SF 0 "register_operand" "=v")
8362 (match_operand:V16SF 1 "register_operand" "v")
8363 (match_operand:V16SF 2 "nonimmediate_operand" "vm"))
8364 (parallel [(match_operand 3 "const_0_to_3_operand")
8365 (match_operand 4 "const_0_to_3_operand")
8366 (match_operand 5 "const_16_to_19_operand")
8367 (match_operand 6 "const_16_to_19_operand")
8368 (match_operand 7 "const_4_to_7_operand")
8369 (match_operand 8 "const_4_to_7_operand")
8370 (match_operand 9 "const_20_to_23_operand")
8371 (match_operand 10 "const_20_to_23_operand")
8372 (match_operand 11 "const_8_to_11_operand")
8373 (match_operand 12 "const_8_to_11_operand")
8374 (match_operand 13 "const_24_to_27_operand")
8375 (match_operand 14 "const_24_to_27_operand")
8376 (match_operand 15 "const_12_to_15_operand")
8377 (match_operand 16 "const_12_to_15_operand")
8378 (match_operand 17 "const_28_to_31_operand")
8379 (match_operand 18 "const_28_to_31_operand")])))]
8381 && (INTVAL (operands[3]) == (INTVAL (operands[7]) - 4)
8382 && INTVAL (operands[4]) == (INTVAL (operands[8]) - 4)
8383 && INTVAL (operands[5]) == (INTVAL (operands[9]) - 4)
8384 && INTVAL (operands[6]) == (INTVAL (operands[10]) - 4)
8385 && INTVAL (operands[3]) == (INTVAL (operands[11]) - 8)
8386 && INTVAL (operands[4]) == (INTVAL (operands[12]) - 8)
8387 && INTVAL (operands[5]) == (INTVAL (operands[13]) - 8)
8388 && INTVAL (operands[6]) == (INTVAL (operands[14]) - 8)
8389 && INTVAL (operands[3]) == (INTVAL (operands[15]) - 12)
8390 && INTVAL (operands[4]) == (INTVAL (operands[16]) - 12)
8391 && INTVAL (operands[5]) == (INTVAL (operands[17]) - 12)
8392 && INTVAL (operands[6]) == (INTVAL (operands[18]) - 12))"
8395 mask = INTVAL (operands[3]);
8396 mask |= INTVAL (operands[4]) << 2;
8397 mask |= (INTVAL (operands[5]) - 16) << 4;
8398 mask |= (INTVAL (operands[6]) - 16) << 6;
8399 operands[3] = GEN_INT (mask);
8401 return "vshufps\t{%3, %2, %1, %0<mask_operand19>|%0<mask_operand19>, %1, %2, %3}";
8403 [(set_attr "type" "sselog")
8404 (set_attr "length_immediate" "1")
8405 (set_attr "prefix" "evex")
8406 (set_attr "mode" "V16SF")])
8408 (define_expand "avx512f_shufpd512_mask"
8409 [(match_operand:V8DF 0 "register_operand")
8410 (match_operand:V8DF 1 "register_operand")
8411 (match_operand:V8DF 2 "nonimmediate_operand")
8412 (match_operand:SI 3 "const_0_to_255_operand")
8413 (match_operand:V8DF 4 "register_operand")
8414 (match_operand:QI 5 "register_operand")]
8417 int mask = INTVAL (operands[3]);
8418 emit_insn (gen_avx512f_shufpd512_1_mask (operands[0], operands[1], operands[2],
8420 GEN_INT (mask & 2 ? 9 : 8),
8421 GEN_INT (mask & 4 ? 3 : 2),
8422 GEN_INT (mask & 8 ? 11 : 10),
8423 GEN_INT (mask & 16 ? 5 : 4),
8424 GEN_INT (mask & 32 ? 13 : 12),
8425 GEN_INT (mask & 64 ? 7 : 6),
8426 GEN_INT (mask & 128 ? 15 : 14),
8427 operands[4], operands[5]));
8431 (define_insn "avx512f_shufpd512_1<mask_name>"
8432 [(set (match_operand:V8DF 0 "register_operand" "=v")
8435 (match_operand:V8DF 1 "register_operand" "v")
8436 (match_operand:V8DF 2 "nonimmediate_operand" "vm"))
8437 (parallel [(match_operand 3 "const_0_to_1_operand")
8438 (match_operand 4 "const_8_to_9_operand")
8439 (match_operand 5 "const_2_to_3_operand")
8440 (match_operand 6 "const_10_to_11_operand")
8441 (match_operand 7 "const_4_to_5_operand")
8442 (match_operand 8 "const_12_to_13_operand")
8443 (match_operand 9 "const_6_to_7_operand")
8444 (match_operand 10 "const_14_to_15_operand")])))]
8448 mask = INTVAL (operands[3]);
8449 mask |= (INTVAL (operands[4]) - 8) << 1;
8450 mask |= (INTVAL (operands[5]) - 2) << 2;
8451 mask |= (INTVAL (operands[6]) - 10) << 3;
8452 mask |= (INTVAL (operands[7]) - 4) << 4;
8453 mask |= (INTVAL (operands[8]) - 12) << 5;
8454 mask |= (INTVAL (operands[9]) - 6) << 6;
8455 mask |= (INTVAL (operands[10]) - 14) << 7;
8456 operands[3] = GEN_INT (mask);
8458 return "vshufpd\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
8460 [(set_attr "type" "sselog")
8461 (set_attr "length_immediate" "1")
8462 (set_attr "prefix" "evex")
8463 (set_attr "mode" "V8DF")])
8465 (define_expand "avx_shufpd256<mask_expand4_name>"
8466 [(match_operand:V4DF 0 "register_operand")
8467 (match_operand:V4DF 1 "register_operand")
8468 (match_operand:V4DF 2 "nonimmediate_operand")
8469 (match_operand:SI 3 "const_int_operand")]
8472 int mask = INTVAL (operands[3]);
8473 emit_insn (gen_avx_shufpd256_1<mask_expand4_name> (operands[0],
8477 GEN_INT (mask & 2 ? 5 : 4),
8478 GEN_INT (mask & 4 ? 3 : 2),
8479 GEN_INT (mask & 8 ? 7 : 6)
8480 <mask_expand4_args>));
8484 (define_insn "avx_shufpd256_1<mask_name>"
8485 [(set (match_operand:V4DF 0 "register_operand" "=v")
8488 (match_operand:V4DF 1 "register_operand" "v")
8489 (match_operand:V4DF 2 "nonimmediate_operand" "vm"))
8490 (parallel [(match_operand 3 "const_0_to_1_operand")
8491 (match_operand 4 "const_4_to_5_operand")
8492 (match_operand 5 "const_2_to_3_operand")
8493 (match_operand 6 "const_6_to_7_operand")])))]
8494 "TARGET_AVX && <mask_avx512vl_condition>"
8497 mask = INTVAL (operands[3]);
8498 mask |= (INTVAL (operands[4]) - 4) << 1;
8499 mask |= (INTVAL (operands[5]) - 2) << 2;
8500 mask |= (INTVAL (operands[6]) - 6) << 3;
8501 operands[3] = GEN_INT (mask);
8503 return "vshufpd\t{%3, %2, %1, %0<mask_operand7>|%0<mask_operand7>, %1, %2, %3}";
8505 [(set_attr "type" "sseshuf")
8506 (set_attr "length_immediate" "1")
8507 (set_attr "prefix" "vex")
8508 (set_attr "mode" "V4DF")])
8510 (define_expand "sse2_shufpd<mask_expand4_name>"
8511 [(match_operand:V2DF 0 "register_operand")
8512 (match_operand:V2DF 1 "register_operand")
8513 (match_operand:V2DF 2 "vector_operand")
8514 (match_operand:SI 3 "const_int_operand")]
8517 int mask = INTVAL (operands[3]);
8518 emit_insn (gen_sse2_shufpd_v2df<mask_expand4_name> (operands[0], operands[1],
8519 operands[2], GEN_INT (mask & 1),
8520 GEN_INT (mask & 2 ? 3 : 2)
8521 <mask_expand4_args>));
8525 (define_insn "sse2_shufpd_v2df_mask"
8526 [(set (match_operand:V2DF 0 "register_operand" "=v")
8530 (match_operand:V2DF 1 "register_operand" "v")
8531 (match_operand:V2DF 2 "nonimmediate_operand" "vm"))
8532 (parallel [(match_operand 3 "const_0_to_1_operand")
8533 (match_operand 4 "const_2_to_3_operand")]))
8534 (match_operand:V2DF 5 "vector_move_operand" "0C")
8535 (match_operand:QI 6 "register_operand" "Yk")))]
8539 mask = INTVAL (operands[3]);
8540 mask |= (INTVAL (operands[4]) - 2) << 1;
8541 operands[3] = GEN_INT (mask);
8543 return "vshufpd\t{%3, %2, %1, %0%{%6%}%N5|%0%{6%}%N5, %1, %2, %3}";
8545 [(set_attr "type" "sseshuf")
8546 (set_attr "length_immediate" "1")
8547 (set_attr "prefix" "evex")
8548 (set_attr "mode" "V2DF")])
8550 ;; punpcklqdq and punpckhqdq are shorter than shufpd.
8551 (define_insn "avx2_interleave_highv4di<mask_name>"
8552 [(set (match_operand:V4DI 0 "register_operand" "=v")
8555 (match_operand:V4DI 1 "register_operand" "v")
8556 (match_operand:V4DI 2 "nonimmediate_operand" "vm"))
8557 (parallel [(const_int 1)
8561 "TARGET_AVX2 && <mask_avx512vl_condition>"
8562 "vpunpckhqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8563 [(set_attr "type" "sselog")
8564 (set_attr "prefix" "vex")
8565 (set_attr "mode" "OI")])
8567 (define_insn "<mask_codefor>avx512f_interleave_highv8di<mask_name>"
8568 [(set (match_operand:V8DI 0 "register_operand" "=v")
8571 (match_operand:V8DI 1 "register_operand" "v")
8572 (match_operand:V8DI 2 "nonimmediate_operand" "vm"))
8573 (parallel [(const_int 1) (const_int 9)
8574 (const_int 3) (const_int 11)
8575 (const_int 5) (const_int 13)
8576 (const_int 7) (const_int 15)])))]
8578 "vpunpckhqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8579 [(set_attr "type" "sselog")
8580 (set_attr "prefix" "evex")
8581 (set_attr "mode" "XI")])
8583 (define_insn "vec_interleave_highv2di<mask_name>"
8584 [(set (match_operand:V2DI 0 "register_operand" "=x,v")
8587 (match_operand:V2DI 1 "register_operand" "0,v")
8588 (match_operand:V2DI 2 "vector_operand" "xBm,vm"))
8589 (parallel [(const_int 1)
8591 "TARGET_SSE2 && <mask_avx512vl_condition>"
8593 punpckhqdq\t{%2, %0|%0, %2}
8594 vpunpckhqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8595 [(set_attr "isa" "noavx,avx")
8596 (set_attr "type" "sselog")
8597 (set_attr "prefix_data16" "1,*")
8598 (set_attr "prefix" "orig,<mask_prefix>")
8599 (set_attr "mode" "TI")])
8601 (define_insn "avx2_interleave_lowv4di<mask_name>"
8602 [(set (match_operand:V4DI 0 "register_operand" "=v")
8605 (match_operand:V4DI 1 "register_operand" "v")
8606 (match_operand:V4DI 2 "nonimmediate_operand" "vm"))
8607 (parallel [(const_int 0)
8611 "TARGET_AVX2 && <mask_avx512vl_condition>"
8612 "vpunpcklqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8613 [(set_attr "type" "sselog")
8614 (set_attr "prefix" "vex")
8615 (set_attr "mode" "OI")])
8617 (define_insn "<mask_codefor>avx512f_interleave_lowv8di<mask_name>"
8618 [(set (match_operand:V8DI 0 "register_operand" "=v")
8621 (match_operand:V8DI 1 "register_operand" "v")
8622 (match_operand:V8DI 2 "nonimmediate_operand" "vm"))
8623 (parallel [(const_int 0) (const_int 8)
8624 (const_int 2) (const_int 10)
8625 (const_int 4) (const_int 12)
8626 (const_int 6) (const_int 14)])))]
8628 "vpunpcklqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8629 [(set_attr "type" "sselog")
8630 (set_attr "prefix" "evex")
8631 (set_attr "mode" "XI")])
8633 (define_insn "vec_interleave_lowv2di<mask_name>"
8634 [(set (match_operand:V2DI 0 "register_operand" "=x,v")
8637 (match_operand:V2DI 1 "register_operand" "0,v")
8638 (match_operand:V2DI 2 "vector_operand" "xBm,vm"))
8639 (parallel [(const_int 0)
8641 "TARGET_SSE2 && <mask_avx512vl_condition>"
8643 punpcklqdq\t{%2, %0|%0, %2}
8644 vpunpcklqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8645 [(set_attr "isa" "noavx,avx")
8646 (set_attr "type" "sselog")
8647 (set_attr "prefix_data16" "1,*")
8648 (set_attr "prefix" "orig,vex")
8649 (set_attr "mode" "TI")])
8651 (define_insn "sse2_shufpd_<mode>"
8652 [(set (match_operand:VI8F_128 0 "register_operand" "=x,x")
8653 (vec_select:VI8F_128
8654 (vec_concat:<ssedoublevecmode>
8655 (match_operand:VI8F_128 1 "register_operand" "0,x")
8656 (match_operand:VI8F_128 2 "vector_operand" "xBm,xm"))
8657 (parallel [(match_operand 3 "const_0_to_1_operand")
8658 (match_operand 4 "const_2_to_3_operand")])))]
8662 mask = INTVAL (operands[3]);
8663 mask |= (INTVAL (operands[4]) - 2) << 1;
8664 operands[3] = GEN_INT (mask);
8666 switch (which_alternative)
8669 return "shufpd\t{%3, %2, %0|%0, %2, %3}";
8671 return "vshufpd\t{%3, %2, %1, %0|%0, %1, %2, %3}";
8676 [(set_attr "isa" "noavx,avx")
8677 (set_attr "type" "sseshuf")
8678 (set_attr "length_immediate" "1")
8679 (set_attr "prefix" "orig,vex")
8680 (set_attr "mode" "V2DF")])
8682 ;; Avoid combining registers from different units in a single alternative,
8683 ;; see comment above inline_secondary_memory_needed function in i386.c
8684 (define_insn "sse2_storehpd"
8685 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,x,x,*f,r")
8687 (match_operand:V2DF 1 "nonimmediate_operand" " x,0,x,o,o,o")
8688 (parallel [(const_int 1)])))]
8689 "TARGET_SSE2 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
8691 %vmovhpd\t{%1, %0|%0, %1}
8693 vunpckhpd\t{%d1, %0|%0, %d1}
8697 [(set_attr "isa" "*,noavx,avx,*,*,*")
8698 (set_attr "type" "ssemov,sselog1,sselog1,ssemov,fmov,imov")
8699 (set (attr "prefix_data16")
8701 (and (eq_attr "alternative" "0")
8702 (not (match_test "TARGET_AVX")))
8704 (const_string "*")))
8705 (set_attr "prefix" "maybe_vex,orig,vex,*,*,*")
8706 (set_attr "mode" "V1DF,V1DF,V2DF,DF,DF,DF")])
8709 [(set (match_operand:DF 0 "register_operand")
8711 (match_operand:V2DF 1 "memory_operand")
8712 (parallel [(const_int 1)])))]
8713 "TARGET_SSE2 && reload_completed"
8714 [(set (match_dup 0) (match_dup 1))]
8715 "operands[1] = adjust_address (operands[1], DFmode, 8);")
8717 (define_insn "*vec_extractv2df_1_sse"
8718 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,x")
8720 (match_operand:V2DF 1 "nonimmediate_operand" "x,x,o")
8721 (parallel [(const_int 1)])))]
8722 "!TARGET_SSE2 && TARGET_SSE
8723 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
8725 movhps\t{%1, %0|%q0, %1}
8726 movhlps\t{%1, %0|%0, %1}
8727 movlps\t{%H1, %0|%0, %H1}"
8728 [(set_attr "type" "ssemov")
8729 (set_attr "ssememalign" "64")
8730 (set_attr "mode" "V2SF,V4SF,V2SF")])
8732 ;; Avoid combining registers from different units in a single alternative,
8733 ;; see comment above inline_secondary_memory_needed function in i386.c
8734 (define_insn "sse2_storelpd"
8735 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,x,*f,r")
8737 (match_operand:V2DF 1 "nonimmediate_operand" " x,x,m,m,m")
8738 (parallel [(const_int 0)])))]
8739 "TARGET_SSE2 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
8741 %vmovlpd\t{%1, %0|%0, %1}
8746 [(set_attr "type" "ssemov,ssemov,ssemov,fmov,imov")
8747 (set_attr "prefix_data16" "1,*,*,*,*")
8748 (set_attr "prefix" "maybe_vex")
8749 (set_attr "mode" "V1DF,DF,DF,DF,DF")])
8752 [(set (match_operand:DF 0 "register_operand")
8754 (match_operand:V2DF 1 "nonimmediate_operand")
8755 (parallel [(const_int 0)])))]
8756 "TARGET_SSE2 && reload_completed"
8757 [(set (match_dup 0) (match_dup 1))]
8759 if (REG_P (operands[1]))
8760 operands[1] = gen_rtx_REG (DFmode, REGNO (operands[1]));
8762 operands[1] = adjust_address (operands[1], DFmode, 0);
8765 (define_insn "*vec_extractv2df_0_sse"
8766 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,x")
8768 (match_operand:V2DF 1 "nonimmediate_operand" "x,x,m")
8769 (parallel [(const_int 0)])))]
8770 "!TARGET_SSE2 && TARGET_SSE
8771 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
8773 movlps\t{%1, %0|%0, %1}
8774 movaps\t{%1, %0|%0, %1}
8775 movlps\t{%1, %0|%0, %q1}"
8776 [(set_attr "type" "ssemov")
8777 (set_attr "mode" "V2SF,V4SF,V2SF")])
8779 (define_expand "sse2_loadhpd_exp"
8780 [(set (match_operand:V2DF 0 "nonimmediate_operand")
8783 (match_operand:V2DF 1 "nonimmediate_operand")
8784 (parallel [(const_int 0)]))
8785 (match_operand:DF 2 "nonimmediate_operand")))]
8788 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V2DFmode, operands);
8790 emit_insn (gen_sse2_loadhpd (dst, operands[1], operands[2]));
8792 /* Fix up the destination if needed. */
8793 if (dst != operands[0])
8794 emit_move_insn (operands[0], dst);
8799 ;; Avoid combining registers from different units in a single alternative,
8800 ;; see comment above inline_secondary_memory_needed function in i386.c
8801 (define_insn "sse2_loadhpd"
8802 [(set (match_operand:V2DF 0 "nonimmediate_operand"
8806 (match_operand:V2DF 1 "nonimmediate_operand"
8808 (parallel [(const_int 0)]))
8809 (match_operand:DF 2 "nonimmediate_operand"
8810 " m,m,x,x,x,*f,r")))]
8811 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
8813 movhpd\t{%2, %0|%0, %2}
8814 vmovhpd\t{%2, %1, %0|%0, %1, %2}
8815 unpcklpd\t{%2, %0|%0, %2}
8816 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
8820 [(set_attr "isa" "noavx,avx,noavx,avx,*,*,*")
8821 (set_attr "type" "ssemov,ssemov,sselog,sselog,ssemov,fmov,imov")
8822 (set_attr "ssememalign" "64")
8823 (set_attr "prefix_data16" "1,*,*,*,*,*,*")
8824 (set_attr "prefix" "orig,vex,orig,vex,*,*,*")
8825 (set_attr "mode" "V1DF,V1DF,V2DF,V2DF,DF,DF,DF")])
8828 [(set (match_operand:V2DF 0 "memory_operand")
8830 (vec_select:DF (match_dup 0) (parallel [(const_int 0)]))
8831 (match_operand:DF 1 "register_operand")))]
8832 "TARGET_SSE2 && reload_completed"
8833 [(set (match_dup 0) (match_dup 1))]
8834 "operands[0] = adjust_address (operands[0], DFmode, 8);")
8836 (define_expand "sse2_loadlpd_exp"
8837 [(set (match_operand:V2DF 0 "nonimmediate_operand")
8839 (match_operand:DF 2 "nonimmediate_operand")
8841 (match_operand:V2DF 1 "nonimmediate_operand")
8842 (parallel [(const_int 1)]))))]
8845 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V2DFmode, operands);
8847 emit_insn (gen_sse2_loadlpd (dst, operands[1], operands[2]));
8849 /* Fix up the destination if needed. */
8850 if (dst != operands[0])
8851 emit_move_insn (operands[0], dst);
8856 ;; Avoid combining registers from different units in a single alternative,
8857 ;; see comment above inline_secondary_memory_needed function in i386.c
8858 (define_insn "sse2_loadlpd"
8859 [(set (match_operand:V2DF 0 "nonimmediate_operand"
8860 "=x,x,x,x,x,x,x,x,m,m ,m")
8862 (match_operand:DF 2 "nonimmediate_operand"
8863 " m,m,m,x,x,0,0,x,x,*f,r")
8865 (match_operand:V2DF 1 "vector_move_operand"
8866 " C,0,x,0,x,x,o,o,0,0 ,0")
8867 (parallel [(const_int 1)]))))]
8868 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
8870 %vmovsd\t{%2, %0|%0, %2}
8871 movlpd\t{%2, %0|%0, %2}
8872 vmovlpd\t{%2, %1, %0|%0, %1, %2}
8873 movsd\t{%2, %0|%0, %2}
8874 vmovsd\t{%2, %1, %0|%0, %1, %2}
8875 shufpd\t{$2, %1, %0|%0, %1, 2}
8876 movhpd\t{%H1, %0|%0, %H1}
8877 vmovhpd\t{%H1, %2, %0|%0, %2, %H1}
8881 [(set_attr "isa" "*,noavx,avx,noavx,avx,noavx,noavx,avx,*,*,*")
8883 (cond [(eq_attr "alternative" "5")
8884 (const_string "sselog")
8885 (eq_attr "alternative" "9")
8886 (const_string "fmov")
8887 (eq_attr "alternative" "10")
8888 (const_string "imov")
8890 (const_string "ssemov")))
8891 (set_attr "ssememalign" "64")
8892 (set_attr "prefix_data16" "*,1,*,*,*,*,1,*,*,*,*")
8893 (set_attr "length_immediate" "*,*,*,*,*,1,*,*,*,*,*")
8894 (set_attr "prefix" "maybe_vex,orig,vex,orig,vex,orig,orig,vex,*,*,*")
8895 (set_attr "mode" "DF,V1DF,V1DF,V1DF,V1DF,V2DF,V1DF,V1DF,DF,DF,DF")])
8898 [(set (match_operand:V2DF 0 "memory_operand")
8900 (match_operand:DF 1 "register_operand")
8901 (vec_select:DF (match_dup 0) (parallel [(const_int 1)]))))]
8902 "TARGET_SSE2 && reload_completed"
8903 [(set (match_dup 0) (match_dup 1))]
8904 "operands[0] = adjust_address (operands[0], DFmode, 0);")
8906 (define_insn "sse2_movsd"
8907 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,x,x,x,m,x,x,x,o")
8909 (match_operand:V2DF 2 "nonimmediate_operand" " x,x,m,m,x,0,0,x,0")
8910 (match_operand:V2DF 1 "nonimmediate_operand" " 0,x,0,x,0,x,o,o,x")
8914 movsd\t{%2, %0|%0, %2}
8915 vmovsd\t{%2, %1, %0|%0, %1, %2}
8916 movlpd\t{%2, %0|%0, %q2}
8917 vmovlpd\t{%2, %1, %0|%0, %1, %q2}
8918 %vmovlpd\t{%2, %0|%q0, %2}
8919 shufpd\t{$2, %1, %0|%0, %1, 2}
8920 movhps\t{%H1, %0|%0, %H1}
8921 vmovhps\t{%H1, %2, %0|%0, %2, %H1}
8922 %vmovhps\t{%1, %H0|%H0, %1}"
8923 [(set_attr "isa" "noavx,avx,noavx,avx,*,noavx,noavx,avx,*")
8926 (eq_attr "alternative" "5")
8927 (const_string "sselog")
8928 (const_string "ssemov")))
8929 (set (attr "prefix_data16")
8931 (and (eq_attr "alternative" "2,4")
8932 (not (match_test "TARGET_AVX")))
8934 (const_string "*")))
8935 (set_attr "length_immediate" "*,*,*,*,*,1,*,*,*")
8936 (set_attr "ssememalign" "64")
8937 (set_attr "prefix" "orig,vex,orig,vex,maybe_vex,orig,orig,vex,maybe_vex")
8938 (set_attr "mode" "DF,DF,V1DF,V1DF,V1DF,V2DF,V1DF,V1DF,V1DF")])
8940 (define_insn "vec_dupv2df<mask_name>"
8941 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
8943 (match_operand:DF 1 "nonimmediate_operand" " 0,xm,vm")))]
8944 "TARGET_SSE2 && <mask_avx512vl_condition>"
8947 %vmovddup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}
8948 vmovddup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
8949 [(set_attr "isa" "noavx,sse3,avx512vl")
8950 (set_attr "type" "sselog1")
8951 (set_attr "prefix" "orig,maybe_vex,evex")
8952 (set_attr "mode" "V2DF,DF,DF")])
8954 (define_insn "vec_concatv2df"
8955 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v,x,v,x,x,v,x,x")
8957 (match_operand:DF 1 "nonimmediate_operand" " 0,x,v,m,m,0,x,m,0,0")
8958 (match_operand:DF 2 "vector_move_operand" " x,x,v,1,1,m,m,C,x,m")))]
8960 && (!(MEM_P (operands[1]) && MEM_P (operands[2]))
8961 || (TARGET_SSE3 && rtx_equal_p (operands[1], operands[2])))"
8963 unpcklpd\t{%2, %0|%0, %2}
8964 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
8965 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
8966 %vmovddup\t{%1, %0|%0, %1}
8967 vmovddup\t{%1, %0|%0, %1}
8968 movhpd\t{%2, %0|%0, %2}
8969 vmovhpd\t{%2, %1, %0|%0, %1, %2}
8970 %vmovsd\t{%1, %0|%0, %1}
8971 movlhps\t{%2, %0|%0, %2}
8972 movhps\t{%2, %0|%0, %2}"
8973 [(set_attr "isa" "sse2_noavx,avx,avx512vl,sse3,avx512vl,sse2_noavx,avx,sse2,noavx,noavx")
8976 (eq_attr "alternative" "0,1,2,3,4")
8977 (const_string "sselog")
8978 (const_string "ssemov")))
8979 (set (attr "prefix_data16")
8980 (if_then_else (eq_attr "alternative" "5")
8982 (const_string "*")))
8983 (set_attr "prefix" "orig,vex,evex,maybe_vex,evex,orig,vex,maybe_vex,orig,orig")
8984 (set_attr "mode" "V2DF,V2DF,V2DF, DF, DF, V1DF,V1DF,DF,V4SF,V2SF")])
8986 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8988 ;; Parallel integer down-conversion operations
8990 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8992 (define_mode_iterator PMOV_DST_MODE_1 [V16QI V16HI V8SI V8HI])
8993 (define_mode_attr pmov_src_mode
8994 [(V16QI "V16SI") (V16HI "V16SI") (V8SI "V8DI") (V8HI "V8DI")])
8995 (define_mode_attr pmov_src_lower
8996 [(V16QI "v16si") (V16HI "v16si") (V8SI "v8di") (V8HI "v8di")])
8997 (define_mode_attr pmov_suff_1
8998 [(V16QI "db") (V16HI "dw") (V8SI "qd") (V8HI "qw")])
9000 (define_insn "*avx512f_<code><pmov_src_lower><mode>2"
9001 [(set (match_operand:PMOV_DST_MODE_1 0 "nonimmediate_operand" "=v,m")
9002 (any_truncate:PMOV_DST_MODE_1
9003 (match_operand:<pmov_src_mode> 1 "register_operand" "v,v")))]
9005 "vpmov<trunsuffix><pmov_suff_1>\t{%1, %0|%0, %1}"
9006 [(set_attr "type" "ssemov")
9007 (set_attr "memory" "none,store")
9008 (set_attr "prefix" "evex")
9009 (set_attr "mode" "<sseinsnmode>")])
9011 (define_insn "avx512f_<code><pmov_src_lower><mode>2_mask"
9012 [(set (match_operand:PMOV_DST_MODE_1 0 "nonimmediate_operand" "=v,m")
9013 (vec_merge:PMOV_DST_MODE_1
9014 (any_truncate:PMOV_DST_MODE_1
9015 (match_operand:<pmov_src_mode> 1 "register_operand" "v,v"))
9016 (match_operand:PMOV_DST_MODE_1 2 "vector_move_operand" "0C,0")
9017 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
9019 "vpmov<trunsuffix><pmov_suff_1>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9020 [(set_attr "type" "ssemov")
9021 (set_attr "memory" "none,store")
9022 (set_attr "prefix" "evex")
9023 (set_attr "mode" "<sseinsnmode>")])
9025 (define_expand "avx512f_<code><pmov_src_lower><mode>2_mask_store"
9026 [(set (match_operand:PMOV_DST_MODE_1 0 "memory_operand")
9027 (vec_merge:PMOV_DST_MODE_1
9028 (any_truncate:PMOV_DST_MODE_1
9029 (match_operand:<pmov_src_mode> 1 "register_operand"))
9031 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
9034 (define_insn "avx512bw_<code>v32hiv32qi2"
9035 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=v,m")
9037 (match_operand:V32HI 1 "register_operand" "v,v")))]
9039 "vpmov<trunsuffix>wb\t{%1, %0|%0, %1}"
9040 [(set_attr "type" "ssemov")
9041 (set_attr "memory" "none,store")
9042 (set_attr "prefix" "evex")
9043 (set_attr "mode" "XI")])
9045 (define_insn "avx512bw_<code>v32hiv32qi2_mask"
9046 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=v,m")
9049 (match_operand:V32HI 1 "register_operand" "v,v"))
9050 (match_operand:V32QI 2 "vector_move_operand" "0C,0")
9051 (match_operand:SI 3 "register_operand" "Yk,Yk")))]
9053 "vpmov<trunsuffix>wb\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9054 [(set_attr "type" "ssemov")
9055 (set_attr "memory" "none,store")
9056 (set_attr "prefix" "evex")
9057 (set_attr "mode" "XI")])
9059 (define_expand "avx512bw_<code>v32hiv32qi2_mask_store"
9060 [(set (match_operand:V32QI 0 "nonimmediate_operand")
9063 (match_operand:V32HI 1 "register_operand"))
9065 (match_operand:SI 2 "register_operand")))]
9068 (define_mode_iterator PMOV_DST_MODE_2
9069 [V4SI V8HI (V16QI "TARGET_AVX512BW")])
9070 (define_mode_attr pmov_suff_2
9071 [(V16QI "wb") (V8HI "dw") (V4SI "qd")])
9073 (define_insn "*avx512vl_<code><ssedoublemodelower><mode>2"
9074 [(set (match_operand:PMOV_DST_MODE_2 0 "nonimmediate_operand" "=v,m")
9075 (any_truncate:PMOV_DST_MODE_2
9076 (match_operand:<ssedoublemode> 1 "register_operand" "v,v")))]
9078 "vpmov<trunsuffix><pmov_suff_2>\t{%1, %0|%0, %1}"
9079 [(set_attr "type" "ssemov")
9080 (set_attr "memory" "none,store")
9081 (set_attr "prefix" "evex")
9082 (set_attr "mode" "<sseinsnmode>")])
9084 (define_insn "<avx512>_<code><ssedoublemodelower><mode>2_mask"
9085 [(set (match_operand:PMOV_DST_MODE_2 0 "nonimmediate_operand" "=v,m")
9086 (vec_merge:PMOV_DST_MODE_2
9087 (any_truncate:PMOV_DST_MODE_2
9088 (match_operand:<ssedoublemode> 1 "register_operand" "v,v"))
9089 (match_operand:PMOV_DST_MODE_2 2 "vector_move_operand" "0C,0")
9090 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
9092 "vpmov<trunsuffix><pmov_suff_2>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9093 [(set_attr "type" "ssemov")
9094 (set_attr "memory" "none,store")
9095 (set_attr "prefix" "evex")
9096 (set_attr "mode" "<sseinsnmode>")])
9098 (define_expand "<avx512>_<code><ssedoublemodelower><mode>2_mask_store"
9099 [(set (match_operand:PMOV_DST_MODE_2 0 "nonimmediate_operand")
9100 (vec_merge:PMOV_DST_MODE_2
9101 (any_truncate:PMOV_DST_MODE_2
9102 (match_operand:<ssedoublemode> 1 "register_operand"))
9104 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
9107 (define_mode_iterator PMOV_SRC_MODE_3 [V4DI V2DI V8SI V4SI (V8HI "TARGET_AVX512BW")])
9108 (define_mode_attr pmov_dst_3
9109 [(V4DI "V4QI") (V2DI "V2QI") (V8SI "V8QI") (V4SI "V4QI") (V8HI "V8QI")])
9110 (define_mode_attr pmov_dst_zeroed_3
9111 [(V4DI "V12QI") (V2DI "V14QI") (V8SI "V8QI") (V4SI "V12QI") (V8HI "V8QI")])
9112 (define_mode_attr pmov_suff_3
9113 [(V4DI "qb") (V2DI "qb") (V8SI "db") (V4SI "db") (V8HI "wb")])
9115 (define_insn "*avx512vl_<code><mode>v<ssescalarnum>qi2"
9116 [(set (match_operand:V16QI 0 "register_operand" "=v")
9118 (any_truncate:<pmov_dst_3>
9119 (match_operand:PMOV_SRC_MODE_3 1 "register_operand" "v"))
9120 (match_operand:<pmov_dst_zeroed_3> 2 "const0_operand")))]
9122 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0|%0, %1}"
9123 [(set_attr "type" "ssemov")
9124 (set_attr "prefix" "evex")
9125 (set_attr "mode" "TI")])
9127 (define_insn "*avx512vl_<code>v2div2qi2_store"
9128 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9131 (match_operand:V2DI 1 "register_operand" "v"))
9134 (parallel [(const_int 2) (const_int 3)
9135 (const_int 4) (const_int 5)
9136 (const_int 6) (const_int 7)
9137 (const_int 8) (const_int 9)
9138 (const_int 10) (const_int 11)
9139 (const_int 12) (const_int 13)
9140 (const_int 14) (const_int 15)]))))]
9142 "vpmov<trunsuffix>qb\t{%1, %0|%0, %1}"
9143 [(set_attr "type" "ssemov")
9144 (set_attr "memory" "store")
9145 (set_attr "prefix" "evex")
9146 (set_attr "mode" "TI")])
9148 (define_insn "avx512vl_<code>v2div2qi2_mask"
9149 [(set (match_operand:V16QI 0 "register_operand" "=v")
9153 (match_operand:V2DI 1 "register_operand" "v"))
9155 (match_operand:V16QI 2 "vector_move_operand" "0C")
9156 (parallel [(const_int 0) (const_int 1)]))
9157 (match_operand:QI 3 "register_operand" "Yk"))
9158 (const_vector:V14QI [(const_int 0) (const_int 0)
9159 (const_int 0) (const_int 0)
9160 (const_int 0) (const_int 0)
9161 (const_int 0) (const_int 0)
9162 (const_int 0) (const_int 0)
9163 (const_int 0) (const_int 0)
9164 (const_int 0) (const_int 0)])))]
9166 "vpmov<trunsuffix>qb\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9167 [(set_attr "type" "ssemov")
9168 (set_attr "prefix" "evex")
9169 (set_attr "mode" "TI")])
9171 (define_insn "*avx512vl_<code>v2div2qi2_mask_1"
9172 [(set (match_operand:V16QI 0 "register_operand" "=v")
9176 (match_operand:V2DI 1 "register_operand" "v"))
9177 (const_vector:V2QI [(const_int 0) (const_int 0)])
9178 (match_operand:QI 2 "register_operand" "Yk"))
9179 (const_vector:V14QI [(const_int 0) (const_int 0)
9180 (const_int 0) (const_int 0)
9181 (const_int 0) (const_int 0)
9182 (const_int 0) (const_int 0)
9183 (const_int 0) (const_int 0)
9184 (const_int 0) (const_int 0)
9185 (const_int 0) (const_int 0)])))]
9187 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9188 [(set_attr "type" "ssemov")
9189 (set_attr "prefix" "evex")
9190 (set_attr "mode" "TI")])
9192 (define_insn "avx512vl_<code>v2div2qi2_mask_store"
9193 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9197 (match_operand:V2DI 1 "register_operand" "v"))
9200 (parallel [(const_int 0) (const_int 1)]))
9201 (match_operand:QI 2 "register_operand" "Yk"))
9204 (parallel [(const_int 2) (const_int 3)
9205 (const_int 4) (const_int 5)
9206 (const_int 6) (const_int 7)
9207 (const_int 8) (const_int 9)
9208 (const_int 10) (const_int 11)
9209 (const_int 12) (const_int 13)
9210 (const_int 14) (const_int 15)]))))]
9212 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}|%0%{%2%}, %1}"
9213 [(set_attr "type" "ssemov")
9214 (set_attr "memory" "store")
9215 (set_attr "prefix" "evex")
9216 (set_attr "mode" "TI")])
9218 (define_insn "*avx512vl_<code><mode>v4qi2_store"
9219 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9222 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9225 (parallel [(const_int 4) (const_int 5)
9226 (const_int 6) (const_int 7)
9227 (const_int 8) (const_int 9)
9228 (const_int 10) (const_int 11)
9229 (const_int 12) (const_int 13)
9230 (const_int 14) (const_int 15)]))))]
9232 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0|%0, %1}"
9233 [(set_attr "type" "ssemov")
9234 (set_attr "memory" "store")
9235 (set_attr "prefix" "evex")
9236 (set_attr "mode" "TI")])
9238 (define_insn "avx512vl_<code><mode>v4qi2_mask"
9239 [(set (match_operand:V16QI 0 "register_operand" "=v")
9243 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9245 (match_operand:V16QI 2 "vector_move_operand" "0C")
9246 (parallel [(const_int 0) (const_int 1)
9247 (const_int 2) (const_int 3)]))
9248 (match_operand:QI 3 "register_operand" "Yk"))
9249 (const_vector:V12QI [(const_int 0) (const_int 0)
9250 (const_int 0) (const_int 0)
9251 (const_int 0) (const_int 0)
9252 (const_int 0) (const_int 0)
9253 (const_int 0) (const_int 0)
9254 (const_int 0) (const_int 0)])))]
9256 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9257 [(set_attr "type" "ssemov")
9258 (set_attr "prefix" "evex")
9259 (set_attr "mode" "TI")])
9261 (define_insn "*avx512vl_<code><mode>v4qi2_mask_1"
9262 [(set (match_operand:V16QI 0 "register_operand" "=v")
9266 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9267 (const_vector:V4QI [(const_int 0) (const_int 0)
9268 (const_int 0) (const_int 0)])
9269 (match_operand:QI 2 "register_operand" "Yk"))
9270 (const_vector:V12QI [(const_int 0) (const_int 0)
9271 (const_int 0) (const_int 0)
9272 (const_int 0) (const_int 0)
9273 (const_int 0) (const_int 0)
9274 (const_int 0) (const_int 0)
9275 (const_int 0) (const_int 0)])))]
9277 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9278 [(set_attr "type" "ssemov")
9279 (set_attr "prefix" "evex")
9280 (set_attr "mode" "TI")])
9282 (define_insn "avx512vl_<code><mode>v4qi2_mask_store"
9283 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9287 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9290 (parallel [(const_int 0) (const_int 1)
9291 (const_int 2) (const_int 3)]))
9292 (match_operand:QI 2 "register_operand" "Yk"))
9295 (parallel [(const_int 4) (const_int 5)
9296 (const_int 6) (const_int 7)
9297 (const_int 8) (const_int 9)
9298 (const_int 10) (const_int 11)
9299 (const_int 12) (const_int 13)
9300 (const_int 14) (const_int 15)]))))]
9302 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}|%0%{%2%}, %1}"
9303 [(set_attr "type" "ssemov")
9304 (set_attr "memory" "store")
9305 (set_attr "prefix" "evex")
9306 (set_attr "mode" "TI")])
9308 (define_mode_iterator VI2_128_BW_4_256
9309 [(V8HI "TARGET_AVX512BW") V8SI])
9311 (define_insn "*avx512vl_<code><mode>v8qi2_store"
9312 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9315 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9318 (parallel [(const_int 8) (const_int 9)
9319 (const_int 10) (const_int 11)
9320 (const_int 12) (const_int 13)
9321 (const_int 14) (const_int 15)]))))]
9323 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0|%0, %1}"
9324 [(set_attr "type" "ssemov")
9325 (set_attr "memory" "store")
9326 (set_attr "prefix" "evex")
9327 (set_attr "mode" "TI")])
9329 (define_insn "avx512vl_<code><mode>v8qi2_mask"
9330 [(set (match_operand:V16QI 0 "register_operand" "=v")
9334 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9336 (match_operand:V16QI 2 "vector_move_operand" "0C")
9337 (parallel [(const_int 0) (const_int 1)
9338 (const_int 2) (const_int 3)
9339 (const_int 4) (const_int 5)
9340 (const_int 6) (const_int 7)]))
9341 (match_operand:QI 3 "register_operand" "Yk"))
9342 (const_vector:V8QI [(const_int 0) (const_int 0)
9343 (const_int 0) (const_int 0)
9344 (const_int 0) (const_int 0)
9345 (const_int 0) (const_int 0)])))]
9347 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9348 [(set_attr "type" "ssemov")
9349 (set_attr "prefix" "evex")
9350 (set_attr "mode" "TI")])
9352 (define_insn "*avx512vl_<code><mode>v8qi2_mask_1"
9353 [(set (match_operand:V16QI 0 "register_operand" "=v")
9357 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9358 (const_vector:V8QI [(const_int 0) (const_int 0)
9359 (const_int 0) (const_int 0)
9360 (const_int 0) (const_int 0)
9361 (const_int 0) (const_int 0)])
9362 (match_operand:QI 2 "register_operand" "Yk"))
9363 (const_vector:V8QI [(const_int 0) (const_int 0)
9364 (const_int 0) (const_int 0)
9365 (const_int 0) (const_int 0)
9366 (const_int 0) (const_int 0)])))]
9368 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9369 [(set_attr "type" "ssemov")
9370 (set_attr "prefix" "evex")
9371 (set_attr "mode" "TI")])
9373 (define_insn "avx512vl_<code><mode>v8qi2_mask_store"
9374 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9378 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9381 (parallel [(const_int 0) (const_int 1)
9382 (const_int 2) (const_int 3)
9383 (const_int 4) (const_int 5)
9384 (const_int 6) (const_int 7)]))
9385 (match_operand:QI 2 "register_operand" "Yk"))
9388 (parallel [(const_int 8) (const_int 9)
9389 (const_int 10) (const_int 11)
9390 (const_int 12) (const_int 13)
9391 (const_int 14) (const_int 15)]))))]
9393 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}|%0%{%2%}, %1}"
9394 [(set_attr "type" "ssemov")
9395 (set_attr "memory" "store")
9396 (set_attr "prefix" "evex")
9397 (set_attr "mode" "TI")])
9399 (define_mode_iterator PMOV_SRC_MODE_4 [V4DI V2DI V4SI])
9400 (define_mode_attr pmov_dst_4
9401 [(V4DI "V4HI") (V2DI "V2HI") (V4SI "V4HI")])
9402 (define_mode_attr pmov_dst_zeroed_4
9403 [(V4DI "V4HI") (V2DI "V6HI") (V4SI "V4HI")])
9404 (define_mode_attr pmov_suff_4
9405 [(V4DI "qw") (V2DI "qw") (V4SI "dw")])
9407 (define_insn "*avx512vl_<code><mode>v<ssescalarnum>hi2"
9408 [(set (match_operand:V8HI 0 "register_operand" "=v")
9410 (any_truncate:<pmov_dst_4>
9411 (match_operand:PMOV_SRC_MODE_4 1 "register_operand" "v"))
9412 (match_operand:<pmov_dst_zeroed_4> 2 "const0_operand")))]
9414 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0|%0, %1}"
9415 [(set_attr "type" "ssemov")
9416 (set_attr "prefix" "evex")
9417 (set_attr "mode" "TI")])
9419 (define_insn "*avx512vl_<code><mode>v4hi2_store"
9420 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9423 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9426 (parallel [(const_int 4) (const_int 5)
9427 (const_int 6) (const_int 7)]))))]
9429 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0|%0, %1}"
9430 [(set_attr "type" "ssemov")
9431 (set_attr "memory" "store")
9432 (set_attr "prefix" "evex")
9433 (set_attr "mode" "TI")])
9435 (define_insn "avx512vl_<code><mode>v4hi2_mask"
9436 [(set (match_operand:V8HI 0 "register_operand" "=v")
9440 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9442 (match_operand:V8HI 2 "vector_move_operand" "0C")
9443 (parallel [(const_int 0) (const_int 1)
9444 (const_int 2) (const_int 3)]))
9445 (match_operand:QI 3 "register_operand" "Yk"))
9446 (const_vector:V4HI [(const_int 0) (const_int 0)
9447 (const_int 0) (const_int 0)])))]
9449 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9450 [(set_attr "type" "ssemov")
9451 (set_attr "prefix" "evex")
9452 (set_attr "mode" "TI")])
9454 (define_insn "*avx512vl_<code><mode>v4hi2_mask_1"
9455 [(set (match_operand:V8HI 0 "register_operand" "=v")
9459 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9460 (const_vector:V4HI [(const_int 0) (const_int 0)
9461 (const_int 0) (const_int 0)])
9462 (match_operand:QI 2 "register_operand" "Yk"))
9463 (const_vector:V4HI [(const_int 0) (const_int 0)
9464 (const_int 0) (const_int 0)])))]
9466 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9467 [(set_attr "type" "ssemov")
9468 (set_attr "prefix" "evex")
9469 (set_attr "mode" "TI")])
9471 (define_insn "avx512vl_<code><mode>v4hi2_mask_store"
9472 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9476 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9479 (parallel [(const_int 0) (const_int 1)
9480 (const_int 2) (const_int 3)]))
9481 (match_operand:QI 2 "register_operand" "Yk"))
9484 (parallel [(const_int 4) (const_int 5)
9485 (const_int 6) (const_int 7)]))))]
9487 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%2%}|%0%{%2%}, %1}"
9488 [(set_attr "type" "ssemov")
9489 (set_attr "memory" "store")
9490 (set_attr "prefix" "evex")
9491 (set_attr "mode" "TI")])
9493 (define_insn "*avx512vl_<code>v2div2hi2_store"
9494 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9497 (match_operand:V2DI 1 "register_operand" "v"))
9500 (parallel [(const_int 2) (const_int 3)
9501 (const_int 4) (const_int 5)
9502 (const_int 6) (const_int 7)]))))]
9504 "vpmov<trunsuffix>qw\t{%1, %0|%0, %1}"
9505 [(set_attr "type" "ssemov")
9506 (set_attr "memory" "store")
9507 (set_attr "prefix" "evex")
9508 (set_attr "mode" "TI")])
9510 (define_insn "avx512vl_<code>v2div2hi2_mask"
9511 [(set (match_operand:V8HI 0 "register_operand" "=v")
9515 (match_operand:V2DI 1 "register_operand" "v"))
9517 (match_operand:V8HI 2 "vector_move_operand" "0C")
9518 (parallel [(const_int 0) (const_int 1)]))
9519 (match_operand:QI 3 "register_operand" "Yk"))
9520 (const_vector:V6HI [(const_int 0) (const_int 0)
9521 (const_int 0) (const_int 0)
9522 (const_int 0) (const_int 0)])))]
9524 "vpmov<trunsuffix>qw\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9525 [(set_attr "type" "ssemov")
9526 (set_attr "prefix" "evex")
9527 (set_attr "mode" "TI")])
9529 (define_insn "*avx512vl_<code>v2div2hi2_mask_1"
9530 [(set (match_operand:V8HI 0 "register_operand" "=v")
9534 (match_operand:V2DI 1 "register_operand" "v"))
9535 (const_vector:V2HI [(const_int 0) (const_int 0)])
9536 (match_operand:QI 2 "register_operand" "Yk"))
9537 (const_vector:V6HI [(const_int 0) (const_int 0)
9538 (const_int 0) (const_int 0)
9539 (const_int 0) (const_int 0)])))]
9541 "vpmov<trunsuffix>qw\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9542 [(set_attr "type" "ssemov")
9543 (set_attr "prefix" "evex")
9544 (set_attr "mode" "TI")])
9546 (define_insn "avx512vl_<code>v2div2hi2_mask_store"
9547 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9551 (match_operand:V2DI 1 "register_operand" "v"))
9554 (parallel [(const_int 0) (const_int 1)]))
9555 (match_operand:QI 2 "register_operand" "Yk"))
9558 (parallel [(const_int 2) (const_int 3)
9559 (const_int 4) (const_int 5)
9560 (const_int 6) (const_int 7)]))))]
9562 "vpmov<trunsuffix>qw\t{%1, %0%{%2%}|%0%{%2%}, %1}"
9563 [(set_attr "type" "ssemov")
9564 (set_attr "memory" "store")
9565 (set_attr "prefix" "evex")
9566 (set_attr "mode" "TI")])
9568 (define_insn "*avx512vl_<code>v2div2si2"
9569 [(set (match_operand:V4SI 0 "register_operand" "=v")
9572 (match_operand:V2DI 1 "register_operand" "v"))
9573 (match_operand:V2SI 2 "const0_operand")))]
9575 "vpmov<trunsuffix>qd\t{%1, %0|%0, %1}"
9576 [(set_attr "type" "ssemov")
9577 (set_attr "prefix" "evex")
9578 (set_attr "mode" "TI")])
9580 (define_insn "*avx512vl_<code>v2div2si2_store"
9581 [(set (match_operand:V4SI 0 "memory_operand" "=m")
9584 (match_operand:V2DI 1 "register_operand" "v"))
9587 (parallel [(const_int 2) (const_int 3)]))))]
9589 "vpmov<trunsuffix>qd\t{%1, %0|%0, %1}"
9590 [(set_attr "type" "ssemov")
9591 (set_attr "memory" "store")
9592 (set_attr "prefix" "evex")
9593 (set_attr "mode" "TI")])
9595 (define_insn "avx512vl_<code>v2div2si2_mask"
9596 [(set (match_operand:V4SI 0 "register_operand" "=v")
9600 (match_operand:V2DI 1 "register_operand" "v"))
9602 (match_operand:V4SI 2 "vector_move_operand" "0C")
9603 (parallel [(const_int 0) (const_int 1)]))
9604 (match_operand:QI 3 "register_operand" "Yk"))
9605 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
9607 "vpmov<trunsuffix>qd\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9608 [(set_attr "type" "ssemov")
9609 (set_attr "prefix" "evex")
9610 (set_attr "mode" "TI")])
9612 (define_insn "*avx512vl_<code>v2div2si2_mask_1"
9613 [(set (match_operand:V4SI 0 "register_operand" "=v")
9617 (match_operand:V2DI 1 "register_operand" "v"))
9618 (const_vector:V2SI [(const_int 0) (const_int 0)])
9619 (match_operand:QI 2 "register_operand" "Yk"))
9620 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
9622 "vpmov<trunsuffix>qd\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9623 [(set_attr "type" "ssemov")
9624 (set_attr "prefix" "evex")
9625 (set_attr "mode" "TI")])
9627 (define_insn "avx512vl_<code>v2div2si2_mask_store"
9628 [(set (match_operand:V4SI 0 "memory_operand" "=m")
9632 (match_operand:V2DI 1 "register_operand" "v"))
9635 (parallel [(const_int 0) (const_int 1)]))
9636 (match_operand:QI 2 "register_operand" "Yk"))
9639 (parallel [(const_int 2) (const_int 3)]))))]
9641 "vpmov<trunsuffix>qd\t{%1, %0%{%2%}|%0%{%2%}, %1}"
9642 [(set_attr "type" "ssemov")
9643 (set_attr "memory" "store")
9644 (set_attr "prefix" "evex")
9645 (set_attr "mode" "TI")])
9647 (define_insn "*avx512f_<code>v8div16qi2"
9648 [(set (match_operand:V16QI 0 "register_operand" "=v")
9651 (match_operand:V8DI 1 "register_operand" "v"))
9652 (const_vector:V8QI [(const_int 0) (const_int 0)
9653 (const_int 0) (const_int 0)
9654 (const_int 0) (const_int 0)
9655 (const_int 0) (const_int 0)])))]
9657 "vpmov<trunsuffix>qb\t{%1, %0|%0, %1}"
9658 [(set_attr "type" "ssemov")
9659 (set_attr "prefix" "evex")
9660 (set_attr "mode" "TI")])
9662 (define_insn "*avx512f_<code>v8div16qi2_store"
9663 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9666 (match_operand:V8DI 1 "register_operand" "v"))
9669 (parallel [(const_int 8) (const_int 9)
9670 (const_int 10) (const_int 11)
9671 (const_int 12) (const_int 13)
9672 (const_int 14) (const_int 15)]))))]
9674 "vpmov<trunsuffix>qb\t{%1, %0|%0, %1}"
9675 [(set_attr "type" "ssemov")
9676 (set_attr "memory" "store")
9677 (set_attr "prefix" "evex")
9678 (set_attr "mode" "TI")])
9680 (define_insn "avx512f_<code>v8div16qi2_mask"
9681 [(set (match_operand:V16QI 0 "register_operand" "=v")
9685 (match_operand:V8DI 1 "register_operand" "v"))
9687 (match_operand:V16QI 2 "vector_move_operand" "0C")
9688 (parallel [(const_int 0) (const_int 1)
9689 (const_int 2) (const_int 3)
9690 (const_int 4) (const_int 5)
9691 (const_int 6) (const_int 7)]))
9692 (match_operand:QI 3 "register_operand" "Yk"))
9693 (const_vector:V8QI [(const_int 0) (const_int 0)
9694 (const_int 0) (const_int 0)
9695 (const_int 0) (const_int 0)
9696 (const_int 0) (const_int 0)])))]
9698 "vpmov<trunsuffix>qb\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9699 [(set_attr "type" "ssemov")
9700 (set_attr "prefix" "evex")
9701 (set_attr "mode" "TI")])
9703 (define_insn "*avx512f_<code>v8div16qi2_mask_1"
9704 [(set (match_operand:V16QI 0 "register_operand" "=v")
9708 (match_operand:V8DI 1 "register_operand" "v"))
9709 (const_vector:V8QI [(const_int 0) (const_int 0)
9710 (const_int 0) (const_int 0)
9711 (const_int 0) (const_int 0)
9712 (const_int 0) (const_int 0)])
9713 (match_operand:QI 2 "register_operand" "Yk"))
9714 (const_vector:V8QI [(const_int 0) (const_int 0)
9715 (const_int 0) (const_int 0)
9716 (const_int 0) (const_int 0)
9717 (const_int 0) (const_int 0)])))]
9719 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9720 [(set_attr "type" "ssemov")
9721 (set_attr "prefix" "evex")
9722 (set_attr "mode" "TI")])
9724 (define_insn "avx512f_<code>v8div16qi2_mask_store"
9725 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9729 (match_operand:V8DI 1 "register_operand" "v"))
9732 (parallel [(const_int 0) (const_int 1)
9733 (const_int 2) (const_int 3)
9734 (const_int 4) (const_int 5)
9735 (const_int 6) (const_int 7)]))
9736 (match_operand:QI 2 "register_operand" "Yk"))
9739 (parallel [(const_int 8) (const_int 9)
9740 (const_int 10) (const_int 11)
9741 (const_int 12) (const_int 13)
9742 (const_int 14) (const_int 15)]))))]
9744 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}|%0%{%2%}, %1}"
9745 [(set_attr "type" "ssemov")
9746 (set_attr "memory" "store")
9747 (set_attr "prefix" "evex")
9748 (set_attr "mode" "TI")])
9750 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9752 ;; Parallel integral arithmetic
9754 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9756 (define_expand "neg<mode>2"
9757 [(set (match_operand:VI_AVX2 0 "register_operand")
9760 (match_operand:VI_AVX2 1 "vector_operand")))]
9762 "operands[2] = force_reg (<MODE>mode, CONST0_RTX (<MODE>mode));")
9764 (define_expand "<plusminus_insn><mode>3"
9765 [(set (match_operand:VI_AVX2 0 "register_operand")
9767 (match_operand:VI_AVX2 1 "vector_operand")
9768 (match_operand:VI_AVX2 2 "vector_operand")))]
9770 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
9772 (define_expand "<plusminus_insn><mode>3_mask"
9773 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
9774 (vec_merge:VI48_AVX512VL
9775 (plusminus:VI48_AVX512VL
9776 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand")
9777 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand"))
9778 (match_operand:VI48_AVX512VL 3 "vector_move_operand")
9779 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
9781 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
9783 (define_expand "<plusminus_insn><mode>3_mask"
9784 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
9785 (vec_merge:VI12_AVX512VL
9786 (plusminus:VI12_AVX512VL
9787 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand")
9788 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand"))
9789 (match_operand:VI12_AVX512VL 3 "vector_move_operand")
9790 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
9792 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
9794 (define_insn "*<plusminus_insn><mode>3"
9795 [(set (match_operand:VI_AVX2 0 "register_operand" "=x,v")
9797 (match_operand:VI_AVX2 1 "vector_operand" "<comm>0,v")
9798 (match_operand:VI_AVX2 2 "vector_operand" "xBm,vm")))]
9800 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
9802 p<plusminus_mnemonic><ssemodesuffix>\t{%2, %0|%0, %2}
9803 vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
9804 [(set_attr "isa" "noavx,avx")
9805 (set_attr "type" "sseiadd")
9806 (set_attr "prefix_data16" "1,*")
9807 (set_attr "prefix" "<mask_prefix3>")
9808 (set_attr "mode" "<sseinsnmode>")])
9810 (define_insn "*<plusminus_insn><mode>3_mask"
9811 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
9812 (vec_merge:VI48_AVX512VL
9813 (plusminus:VI48_AVX512VL
9814 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "<comm>v")
9815 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm"))
9816 (match_operand:VI48_AVX512VL 3 "vector_move_operand" "0C")
9817 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
9819 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
9820 "vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
9821 [(set_attr "type" "sseiadd")
9822 (set_attr "prefix" "evex")
9823 (set_attr "mode" "<sseinsnmode>")])
9825 (define_insn "*<plusminus_insn><mode>3_mask"
9826 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
9827 (vec_merge:VI12_AVX512VL
9828 (plusminus:VI12_AVX512VL
9829 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "<comm>v")
9830 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm"))
9831 (match_operand:VI12_AVX512VL 3 "vector_move_operand" "0C")
9832 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
9833 "TARGET_AVX512BW && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
9834 "vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
9835 [(set_attr "type" "sseiadd")
9836 (set_attr "prefix" "evex")
9837 (set_attr "mode" "<sseinsnmode>")])
9839 (define_expand "<sse2_avx2>_<plusminus_insn><mode>3<mask_name>"
9840 [(set (match_operand:VI12_AVX2 0 "register_operand")
9841 (sat_plusminus:VI12_AVX2
9842 (match_operand:VI12_AVX2 1 "vector_operand")
9843 (match_operand:VI12_AVX2 2 "vector_operand")))]
9844 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
9845 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
9847 (define_insn "*<sse2_avx2>_<plusminus_insn><mode>3<mask_name>"
9848 [(set (match_operand:VI12_AVX2 0 "register_operand" "=x,v")
9849 (sat_plusminus:VI12_AVX2
9850 (match_operand:VI12_AVX2 1 "vector_operand" "<comm>0,v")
9851 (match_operand:VI12_AVX2 2 "vector_operand" "xBm,vm")))]
9852 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>
9853 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
9855 p<plusminus_mnemonic><ssemodesuffix>\t{%2, %0|%0, %2}
9856 vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
9857 [(set_attr "isa" "noavx,avx")
9858 (set_attr "type" "sseiadd")
9859 (set_attr "prefix_data16" "1,*")
9860 (set_attr "prefix" "orig,maybe_evex")
9861 (set_attr "mode" "TI")])
9863 (define_expand "mul<mode>3<mask_name>"
9864 [(set (match_operand:VI1_AVX512 0 "register_operand")
9865 (mult:VI1_AVX512 (match_operand:VI1_AVX512 1 "register_operand")
9866 (match_operand:VI1_AVX512 2 "register_operand")))]
9867 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
9869 ix86_expand_vecop_qihi (MULT, operands[0], operands[1], operands[2]);
9873 (define_expand "mul<mode>3<mask_name>"
9874 [(set (match_operand:VI2_AVX2 0 "register_operand")
9875 (mult:VI2_AVX2 (match_operand:VI2_AVX2 1 "vector_operand")
9876 (match_operand:VI2_AVX2 2 "vector_operand")))]
9877 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
9878 "ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);")
9880 (define_insn "*mul<mode>3<mask_name>"
9881 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,v")
9882 (mult:VI2_AVX2 (match_operand:VI2_AVX2 1 "vector_operand" "%0,v")
9883 (match_operand:VI2_AVX2 2 "vector_operand" "xBm,vm")))]
9885 && ix86_binary_operator_ok (MULT, <MODE>mode, operands)
9886 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
9888 pmullw\t{%2, %0|%0, %2}
9889 vpmullw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
9890 [(set_attr "isa" "noavx,avx")
9891 (set_attr "type" "sseimul")
9892 (set_attr "prefix_data16" "1,*")
9893 (set_attr "prefix" "orig,vex")
9894 (set_attr "mode" "<sseinsnmode>")])
9896 (define_expand "<s>mul<mode>3_highpart<mask_name>"
9897 [(set (match_operand:VI2_AVX2 0 "register_operand")
9899 (lshiftrt:<ssedoublemode>
9900 (mult:<ssedoublemode>
9901 (any_extend:<ssedoublemode>
9902 (match_operand:VI2_AVX2 1 "vector_operand"))
9903 (any_extend:<ssedoublemode>
9904 (match_operand:VI2_AVX2 2 "vector_operand")))
9907 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
9908 "ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);")
9910 (define_insn "*<s>mul<mode>3_highpart<mask_name>"
9911 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,v")
9913 (lshiftrt:<ssedoublemode>
9914 (mult:<ssedoublemode>
9915 (any_extend:<ssedoublemode>
9916 (match_operand:VI2_AVX2 1 "vector_operand" "%0,v"))
9917 (any_extend:<ssedoublemode>
9918 (match_operand:VI2_AVX2 2 "vector_operand" "xBm,vm")))
9921 && ix86_binary_operator_ok (MULT, <MODE>mode, operands)
9922 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
9924 pmulh<u>w\t{%2, %0|%0, %2}
9925 vpmulh<u>w\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
9926 [(set_attr "isa" "noavx,avx")
9927 (set_attr "type" "sseimul")
9928 (set_attr "prefix_data16" "1,*")
9929 (set_attr "prefix" "orig,vex")
9930 (set_attr "mode" "<sseinsnmode>")])
9932 (define_expand "vec_widen_umult_even_v16si<mask_name>"
9933 [(set (match_operand:V8DI 0 "register_operand")
9937 (match_operand:V16SI 1 "nonimmediate_operand")
9938 (parallel [(const_int 0) (const_int 2)
9939 (const_int 4) (const_int 6)
9940 (const_int 8) (const_int 10)
9941 (const_int 12) (const_int 14)])))
9944 (match_operand:V16SI 2 "nonimmediate_operand")
9945 (parallel [(const_int 0) (const_int 2)
9946 (const_int 4) (const_int 6)
9947 (const_int 8) (const_int 10)
9948 (const_int 12) (const_int 14)])))))]
9950 "ix86_fixup_binary_operands_no_copy (MULT, V16SImode, operands);")
9952 (define_insn "*vec_widen_umult_even_v16si<mask_name>"
9953 [(set (match_operand:V8DI 0 "register_operand" "=v")
9957 (match_operand:V16SI 1 "nonimmediate_operand" "%v")
9958 (parallel [(const_int 0) (const_int 2)
9959 (const_int 4) (const_int 6)
9960 (const_int 8) (const_int 10)
9961 (const_int 12) (const_int 14)])))
9964 (match_operand:V16SI 2 "nonimmediate_operand" "vm")
9965 (parallel [(const_int 0) (const_int 2)
9966 (const_int 4) (const_int 6)
9967 (const_int 8) (const_int 10)
9968 (const_int 12) (const_int 14)])))))]
9969 "TARGET_AVX512F && ix86_binary_operator_ok (MULT, V16SImode, operands)"
9970 "vpmuludq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
9971 [(set_attr "isa" "avx512f")
9972 (set_attr "type" "sseimul")
9973 (set_attr "prefix_extra" "1")
9974 (set_attr "prefix" "evex")
9975 (set_attr "mode" "XI")])
9977 (define_expand "vec_widen_umult_even_v8si<mask_name>"
9978 [(set (match_operand:V4DI 0 "register_operand")
9982 (match_operand:V8SI 1 "nonimmediate_operand")
9983 (parallel [(const_int 0) (const_int 2)
9984 (const_int 4) (const_int 6)])))
9987 (match_operand:V8SI 2 "nonimmediate_operand")
9988 (parallel [(const_int 0) (const_int 2)
9989 (const_int 4) (const_int 6)])))))]
9990 "TARGET_AVX2 && <mask_avx512vl_condition>"
9991 "ix86_fixup_binary_operands_no_copy (MULT, V8SImode, operands);")
9993 (define_insn "*vec_widen_umult_even_v8si<mask_name>"
9994 [(set (match_operand:V4DI 0 "register_operand" "=v")
9998 (match_operand:V8SI 1 "nonimmediate_operand" "%v")
9999 (parallel [(const_int 0) (const_int 2)
10000 (const_int 4) (const_int 6)])))
10003 (match_operand:V8SI 2 "nonimmediate_operand" "vm")
10004 (parallel [(const_int 0) (const_int 2)
10005 (const_int 4) (const_int 6)])))))]
10006 "TARGET_AVX2 && <mask_avx512vl_condition>
10007 && ix86_binary_operator_ok (MULT, V8SImode, operands)"
10008 "vpmuludq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10009 [(set_attr "type" "sseimul")
10010 (set_attr "prefix" "maybe_evex")
10011 (set_attr "mode" "OI")])
10013 (define_expand "vec_widen_umult_even_v4si<mask_name>"
10014 [(set (match_operand:V2DI 0 "register_operand")
10018 (match_operand:V4SI 1 "vector_operand")
10019 (parallel [(const_int 0) (const_int 2)])))
10022 (match_operand:V4SI 2 "vector_operand")
10023 (parallel [(const_int 0) (const_int 2)])))))]
10024 "TARGET_SSE2 && <mask_avx512vl_condition>"
10025 "ix86_fixup_binary_operands_no_copy (MULT, V4SImode, operands);")
10027 (define_insn "*vec_widen_umult_even_v4si<mask_name>"
10028 [(set (match_operand:V2DI 0 "register_operand" "=x,v")
10032 (match_operand:V4SI 1 "vector_operand" "%0,v")
10033 (parallel [(const_int 0) (const_int 2)])))
10036 (match_operand:V4SI 2 "vector_operand" "xBm,vm")
10037 (parallel [(const_int 0) (const_int 2)])))))]
10038 "TARGET_SSE2 && <mask_avx512vl_condition>
10039 && ix86_binary_operator_ok (MULT, V4SImode, operands)"
10041 pmuludq\t{%2, %0|%0, %2}
10042 vpmuludq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10043 [(set_attr "isa" "noavx,avx")
10044 (set_attr "type" "sseimul")
10045 (set_attr "prefix_data16" "1,*")
10046 (set_attr "prefix" "orig,maybe_evex")
10047 (set_attr "mode" "TI")])
10049 (define_expand "vec_widen_smult_even_v16si<mask_name>"
10050 [(set (match_operand:V8DI 0 "register_operand")
10054 (match_operand:V16SI 1 "nonimmediate_operand")
10055 (parallel [(const_int 0) (const_int 2)
10056 (const_int 4) (const_int 6)
10057 (const_int 8) (const_int 10)
10058 (const_int 12) (const_int 14)])))
10061 (match_operand:V16SI 2 "nonimmediate_operand")
10062 (parallel [(const_int 0) (const_int 2)
10063 (const_int 4) (const_int 6)
10064 (const_int 8) (const_int 10)
10065 (const_int 12) (const_int 14)])))))]
10067 "ix86_fixup_binary_operands_no_copy (MULT, V16SImode, operands);")
10069 (define_insn "*vec_widen_smult_even_v16si<mask_name>"
10070 [(set (match_operand:V8DI 0 "register_operand" "=v")
10074 (match_operand:V16SI 1 "nonimmediate_operand" "%v")
10075 (parallel [(const_int 0) (const_int 2)
10076 (const_int 4) (const_int 6)
10077 (const_int 8) (const_int 10)
10078 (const_int 12) (const_int 14)])))
10081 (match_operand:V16SI 2 "nonimmediate_operand" "vm")
10082 (parallel [(const_int 0) (const_int 2)
10083 (const_int 4) (const_int 6)
10084 (const_int 8) (const_int 10)
10085 (const_int 12) (const_int 14)])))))]
10086 "TARGET_AVX512F && ix86_binary_operator_ok (MULT, V16SImode, operands)"
10087 "vpmuldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10088 [(set_attr "isa" "avx512f")
10089 (set_attr "type" "sseimul")
10090 (set_attr "prefix_extra" "1")
10091 (set_attr "prefix" "evex")
10092 (set_attr "mode" "XI")])
10094 (define_expand "vec_widen_smult_even_v8si<mask_name>"
10095 [(set (match_operand:V4DI 0 "register_operand")
10099 (match_operand:V8SI 1 "nonimmediate_operand")
10100 (parallel [(const_int 0) (const_int 2)
10101 (const_int 4) (const_int 6)])))
10104 (match_operand:V8SI 2 "nonimmediate_operand")
10105 (parallel [(const_int 0) (const_int 2)
10106 (const_int 4) (const_int 6)])))))]
10107 "TARGET_AVX2 && <mask_avx512vl_condition>"
10108 "ix86_fixup_binary_operands_no_copy (MULT, V8SImode, operands);")
10110 (define_insn "*vec_widen_smult_even_v8si<mask_name>"
10111 [(set (match_operand:V4DI 0 "register_operand" "=v")
10115 (match_operand:V8SI 1 "nonimmediate_operand" "%v")
10116 (parallel [(const_int 0) (const_int 2)
10117 (const_int 4) (const_int 6)])))
10120 (match_operand:V8SI 2 "nonimmediate_operand" "vm")
10121 (parallel [(const_int 0) (const_int 2)
10122 (const_int 4) (const_int 6)])))))]
10124 && ix86_binary_operator_ok (MULT, V8SImode, operands)"
10125 "vpmuldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10126 [(set_attr "type" "sseimul")
10127 (set_attr "prefix_extra" "1")
10128 (set_attr "prefix" "vex")
10129 (set_attr "mode" "OI")])
10131 (define_expand "sse4_1_mulv2siv2di3<mask_name>"
10132 [(set (match_operand:V2DI 0 "register_operand")
10136 (match_operand:V4SI 1 "vector_operand")
10137 (parallel [(const_int 0) (const_int 2)])))
10140 (match_operand:V4SI 2 "vector_operand")
10141 (parallel [(const_int 0) (const_int 2)])))))]
10142 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
10143 "ix86_fixup_binary_operands_no_copy (MULT, V4SImode, operands);")
10145 (define_insn "*sse4_1_mulv2siv2di3<mask_name>"
10146 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
10150 (match_operand:V4SI 1 "vector_operand" "%0,0,v")
10151 (parallel [(const_int 0) (const_int 2)])))
10154 (match_operand:V4SI 2 "vector_operand" "YrBm,*xBm,vm")
10155 (parallel [(const_int 0) (const_int 2)])))))]
10156 "TARGET_SSE4_1 && <mask_avx512vl_condition>
10157 && ix86_binary_operator_ok (MULT, V4SImode, operands)"
10159 pmuldq\t{%2, %0|%0, %2}
10160 pmuldq\t{%2, %0|%0, %2}
10161 vpmuldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10162 [(set_attr "isa" "noavx,noavx,avx")
10163 (set_attr "type" "sseimul")
10164 (set_attr "prefix_data16" "1,1,*")
10165 (set_attr "prefix_extra" "1")
10166 (set_attr "prefix" "orig,orig,vex")
10167 (set_attr "mode" "TI")])
10169 (define_insn "avx512bw_pmaddwd512<mode><mask_name>"
10170 [(set (match_operand:<sseunpackmode> 0 "register_operand" "=v")
10171 (unspec:<sseunpackmode>
10172 [(match_operand:VI2_AVX2 1 "register_operand" "v")
10173 (match_operand:VI2_AVX2 2 "nonimmediate_operand" "vm")]
10174 UNSPEC_PMADDWD512))]
10175 "TARGET_AVX512BW && <mask_mode512bit_condition>"
10176 "vpmaddwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}";
10177 [(set_attr "type" "sseiadd")
10178 (set_attr "prefix" "evex")
10179 (set_attr "mode" "XI")])
10181 (define_expand "avx2_pmaddwd"
10182 [(set (match_operand:V8SI 0 "register_operand")
10187 (match_operand:V16HI 1 "nonimmediate_operand")
10188 (parallel [(const_int 0) (const_int 2)
10189 (const_int 4) (const_int 6)
10190 (const_int 8) (const_int 10)
10191 (const_int 12) (const_int 14)])))
10194 (match_operand:V16HI 2 "nonimmediate_operand")
10195 (parallel [(const_int 0) (const_int 2)
10196 (const_int 4) (const_int 6)
10197 (const_int 8) (const_int 10)
10198 (const_int 12) (const_int 14)]))))
10201 (vec_select:V8HI (match_dup 1)
10202 (parallel [(const_int 1) (const_int 3)
10203 (const_int 5) (const_int 7)
10204 (const_int 9) (const_int 11)
10205 (const_int 13) (const_int 15)])))
10207 (vec_select:V8HI (match_dup 2)
10208 (parallel [(const_int 1) (const_int 3)
10209 (const_int 5) (const_int 7)
10210 (const_int 9) (const_int 11)
10211 (const_int 13) (const_int 15)]))))))]
10213 "ix86_fixup_binary_operands_no_copy (MULT, V16HImode, operands);")
10215 (define_insn "*avx2_pmaddwd"
10216 [(set (match_operand:V8SI 0 "register_operand" "=x")
10221 (match_operand:V16HI 1 "nonimmediate_operand" "%x")
10222 (parallel [(const_int 0) (const_int 2)
10223 (const_int 4) (const_int 6)
10224 (const_int 8) (const_int 10)
10225 (const_int 12) (const_int 14)])))
10228 (match_operand:V16HI 2 "nonimmediate_operand" "xm")
10229 (parallel [(const_int 0) (const_int 2)
10230 (const_int 4) (const_int 6)
10231 (const_int 8) (const_int 10)
10232 (const_int 12) (const_int 14)]))))
10235 (vec_select:V8HI (match_dup 1)
10236 (parallel [(const_int 1) (const_int 3)
10237 (const_int 5) (const_int 7)
10238 (const_int 9) (const_int 11)
10239 (const_int 13) (const_int 15)])))
10241 (vec_select:V8HI (match_dup 2)
10242 (parallel [(const_int 1) (const_int 3)
10243 (const_int 5) (const_int 7)
10244 (const_int 9) (const_int 11)
10245 (const_int 13) (const_int 15)]))))))]
10246 "TARGET_AVX2 && ix86_binary_operator_ok (MULT, V16HImode, operands)"
10247 "vpmaddwd\t{%2, %1, %0|%0, %1, %2}"
10248 [(set_attr "type" "sseiadd")
10249 (set_attr "prefix" "vex")
10250 (set_attr "mode" "OI")])
10252 (define_expand "sse2_pmaddwd"
10253 [(set (match_operand:V4SI 0 "register_operand")
10258 (match_operand:V8HI 1 "vector_operand")
10259 (parallel [(const_int 0) (const_int 2)
10260 (const_int 4) (const_int 6)])))
10263 (match_operand:V8HI 2 "vector_operand")
10264 (parallel [(const_int 0) (const_int 2)
10265 (const_int 4) (const_int 6)]))))
10268 (vec_select:V4HI (match_dup 1)
10269 (parallel [(const_int 1) (const_int 3)
10270 (const_int 5) (const_int 7)])))
10272 (vec_select:V4HI (match_dup 2)
10273 (parallel [(const_int 1) (const_int 3)
10274 (const_int 5) (const_int 7)]))))))]
10276 "ix86_fixup_binary_operands_no_copy (MULT, V8HImode, operands);")
10278 (define_insn "*sse2_pmaddwd"
10279 [(set (match_operand:V4SI 0 "register_operand" "=x,x")
10284 (match_operand:V8HI 1 "vector_operand" "%0,x")
10285 (parallel [(const_int 0) (const_int 2)
10286 (const_int 4) (const_int 6)])))
10289 (match_operand:V8HI 2 "vector_operand" "xBm,xm")
10290 (parallel [(const_int 0) (const_int 2)
10291 (const_int 4) (const_int 6)]))))
10294 (vec_select:V4HI (match_dup 1)
10295 (parallel [(const_int 1) (const_int 3)
10296 (const_int 5) (const_int 7)])))
10298 (vec_select:V4HI (match_dup 2)
10299 (parallel [(const_int 1) (const_int 3)
10300 (const_int 5) (const_int 7)]))))))]
10301 "TARGET_SSE2 && ix86_binary_operator_ok (MULT, V8HImode, operands)"
10303 pmaddwd\t{%2, %0|%0, %2}
10304 vpmaddwd\t{%2, %1, %0|%0, %1, %2}"
10305 [(set_attr "isa" "noavx,avx")
10306 (set_attr "type" "sseiadd")
10307 (set_attr "atom_unit" "simul")
10308 (set_attr "prefix_data16" "1,*")
10309 (set_attr "prefix" "orig,vex")
10310 (set_attr "mode" "TI")])
10312 (define_insn "avx512dq_mul<mode>3<mask_name>"
10313 [(set (match_operand:VI8 0 "register_operand" "=v")
10315 (match_operand:VI8 1 "register_operand" "v")
10316 (match_operand:VI8 2 "nonimmediate_operand" "vm")))]
10317 "TARGET_AVX512DQ && <mask_mode512bit_condition>"
10318 "vpmullq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10319 [(set_attr "type" "sseimul")
10320 (set_attr "prefix" "evex")
10321 (set_attr "mode" "<sseinsnmode>")])
10323 (define_expand "mul<mode>3<mask_name>"
10324 [(set (match_operand:VI4_AVX512F 0 "register_operand")
10326 (match_operand:VI4_AVX512F 1 "general_vector_operand")
10327 (match_operand:VI4_AVX512F 2 "general_vector_operand")))]
10328 "TARGET_SSE2 && <mask_mode512bit_condition>"
10332 if (!vector_operand (operands[1], <MODE>mode))
10333 operands[1] = force_reg (<MODE>mode, operands[1]);
10334 if (!vector_operand (operands[2], <MODE>mode))
10335 operands[2] = force_reg (<MODE>mode, operands[2]);
10336 ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);
10340 ix86_expand_sse2_mulv4si3 (operands[0], operands[1], operands[2]);
10345 (define_insn "*<sse4_1_avx2>_mul<mode>3<mask_name>"
10346 [(set (match_operand:VI4_AVX512F 0 "register_operand" "=Yr,*x,v")
10348 (match_operand:VI4_AVX512F 1 "vector_operand" "%0,0,v")
10349 (match_operand:VI4_AVX512F 2 "vector_operand" "YrBm,*xBm,vm")))]
10350 "TARGET_SSE4_1 && ix86_binary_operator_ok (MULT, <MODE>mode, operands) && <mask_mode512bit_condition>"
10352 pmulld\t{%2, %0|%0, %2}
10353 pmulld\t{%2, %0|%0, %2}
10354 vpmulld\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10355 [(set_attr "isa" "noavx,noavx,avx")
10356 (set_attr "type" "sseimul")
10357 (set_attr "prefix_extra" "1")
10358 (set_attr "prefix" "<mask_prefix4>")
10359 (set_attr "btver2_decode" "vector,vector,vector")
10360 (set_attr "mode" "<sseinsnmode>")])
10362 (define_expand "mul<mode>3"
10363 [(set (match_operand:VI8_AVX2_AVX512F 0 "register_operand")
10364 (mult:VI8_AVX2_AVX512F
10365 (match_operand:VI8_AVX2_AVX512F 1 "register_operand")
10366 (match_operand:VI8_AVX2_AVX512F 2 "register_operand")))]
10369 ix86_expand_sse2_mulvxdi3 (operands[0], operands[1], operands[2]);
10373 (define_expand "vec_widen_<s>mult_hi_<mode>"
10374 [(match_operand:<sseunpackmode> 0 "register_operand")
10375 (any_extend:<sseunpackmode>
10376 (match_operand:VI124_AVX2 1 "register_operand"))
10377 (match_operand:VI124_AVX2 2 "register_operand")]
10380 ix86_expand_mul_widen_hilo (operands[0], operands[1], operands[2],
10385 (define_expand "vec_widen_<s>mult_lo_<mode>"
10386 [(match_operand:<sseunpackmode> 0 "register_operand")
10387 (any_extend:<sseunpackmode>
10388 (match_operand:VI124_AVX2 1 "register_operand"))
10389 (match_operand:VI124_AVX2 2 "register_operand")]
10392 ix86_expand_mul_widen_hilo (operands[0], operands[1], operands[2],
10397 ;; Most widen_<s>mult_even_<mode> can be handled directly from other
10398 ;; named patterns, but signed V4SI needs special help for plain SSE2.
10399 (define_expand "vec_widen_smult_even_v4si"
10400 [(match_operand:V2DI 0 "register_operand")
10401 (match_operand:V4SI 1 "vector_operand")
10402 (match_operand:V4SI 2 "vector_operand")]
10405 ix86_expand_mul_widen_evenodd (operands[0], operands[1], operands[2],
10410 (define_expand "vec_widen_<s>mult_odd_<mode>"
10411 [(match_operand:<sseunpackmode> 0 "register_operand")
10412 (any_extend:<sseunpackmode>
10413 (match_operand:VI4_AVX512F 1 "general_vector_operand"))
10414 (match_operand:VI4_AVX512F 2 "general_vector_operand")]
10417 ix86_expand_mul_widen_evenodd (operands[0], operands[1], operands[2],
10422 (define_mode_attr SDOT_PMADD_SUF
10423 [(V32HI "512v32hi") (V16HI "") (V8HI "")])
10425 (define_expand "sdot_prod<mode>"
10426 [(match_operand:<sseunpackmode> 0 "register_operand")
10427 (match_operand:VI2_AVX2 1 "register_operand")
10428 (match_operand:VI2_AVX2 2 "register_operand")
10429 (match_operand:<sseunpackmode> 3 "register_operand")]
10432 rtx t = gen_reg_rtx (<sseunpackmode>mode);
10433 emit_insn (gen_<sse2_avx2>_pmaddwd<SDOT_PMADD_SUF> (t, operands[1], operands[2]));
10434 emit_insn (gen_rtx_SET (operands[0],
10435 gen_rtx_PLUS (<sseunpackmode>mode,
10440 ;; Normally we use widen_mul_even/odd, but combine can't quite get it all
10441 ;; back together when madd is available.
10442 (define_expand "sdot_prodv4si"
10443 [(match_operand:V2DI 0 "register_operand")
10444 (match_operand:V4SI 1 "register_operand")
10445 (match_operand:V4SI 2 "register_operand")
10446 (match_operand:V2DI 3 "register_operand")]
10449 rtx t = gen_reg_rtx (V2DImode);
10450 emit_insn (gen_xop_pmacsdqh (t, operands[1], operands[2], operands[3]));
10451 emit_insn (gen_xop_pmacsdql (operands[0], operands[1], operands[2], t));
10455 (define_expand "usadv16qi"
10456 [(match_operand:V4SI 0 "register_operand")
10457 (match_operand:V16QI 1 "register_operand")
10458 (match_operand:V16QI 2 "vector_operand")
10459 (match_operand:V4SI 3 "vector_operand")]
10462 rtx t1 = gen_reg_rtx (V2DImode);
10463 rtx t2 = gen_reg_rtx (V4SImode);
10464 emit_insn (gen_sse2_psadbw (t1, operands[1], operands[2]));
10465 convert_move (t2, t1, 0);
10466 emit_insn (gen_addv4si3 (operands[0], t2, operands[3]));
10470 (define_expand "usadv32qi"
10471 [(match_operand:V8SI 0 "register_operand")
10472 (match_operand:V32QI 1 "register_operand")
10473 (match_operand:V32QI 2 "nonimmediate_operand")
10474 (match_operand:V8SI 3 "nonimmediate_operand")]
10477 rtx t1 = gen_reg_rtx (V4DImode);
10478 rtx t2 = gen_reg_rtx (V8SImode);
10479 emit_insn (gen_avx2_psadbw (t1, operands[1], operands[2]));
10480 convert_move (t2, t1, 0);
10481 emit_insn (gen_addv8si3 (operands[0], t2, operands[3]));
10485 (define_insn "ashr<mode>3"
10486 [(set (match_operand:VI24_AVX2 0 "register_operand" "=x,x")
10487 (ashiftrt:VI24_AVX2
10488 (match_operand:VI24_AVX2 1 "register_operand" "0,x")
10489 (match_operand:SI 2 "nonmemory_operand" "xN,xN")))]
10492 psra<ssemodesuffix>\t{%2, %0|%0, %2}
10493 vpsra<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
10494 [(set_attr "isa" "noavx,avx")
10495 (set_attr "type" "sseishft")
10496 (set (attr "length_immediate")
10497 (if_then_else (match_operand 2 "const_int_operand")
10499 (const_string "0")))
10500 (set_attr "prefix_data16" "1,*")
10501 (set_attr "prefix" "orig,vex")
10502 (set_attr "mode" "<sseinsnmode>")])
10504 (define_insn "<mask_codefor>ashr<mode>3<mask_name>"
10505 [(set (match_operand:VI24_AVX512BW_1 0 "register_operand" "=v,v")
10506 (ashiftrt:VI24_AVX512BW_1
10507 (match_operand:VI24_AVX512BW_1 1 "nonimmediate_operand" "v,vm")
10508 (match_operand:SI 2 "nonmemory_operand" "v,N")))]
10510 "vpsra<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10511 [(set_attr "type" "sseishft")
10512 (set (attr "length_immediate")
10513 (if_then_else (match_operand 2 "const_int_operand")
10515 (const_string "0")))
10516 (set_attr "mode" "<sseinsnmode>")])
10518 (define_insn "<mask_codefor>ashrv2di3<mask_name>"
10519 [(set (match_operand:V2DI 0 "register_operand" "=v,v")
10521 (match_operand:V2DI 1 "nonimmediate_operand" "v,vm")
10522 (match_operand:DI 2 "nonmemory_operand" "v,N")))]
10524 "vpsraq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10525 [(set_attr "type" "sseishft")
10526 (set (attr "length_immediate")
10527 (if_then_else (match_operand 2 "const_int_operand")
10529 (const_string "0")))
10530 (set_attr "mode" "TI")])
10532 (define_insn "ashr<mode>3<mask_name>"
10533 [(set (match_operand:VI248_AVX512BW_AVX512VL 0 "register_operand" "=v,v")
10534 (ashiftrt:VI248_AVX512BW_AVX512VL
10535 (match_operand:VI248_AVX512BW_AVX512VL 1 "nonimmediate_operand" "v,vm")
10536 (match_operand:SI 2 "nonmemory_operand" "v,N")))]
10538 "vpsra<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10539 [(set_attr "type" "sseishft")
10540 (set (attr "length_immediate")
10541 (if_then_else (match_operand 2 "const_int_operand")
10543 (const_string "0")))
10544 (set_attr "mode" "<sseinsnmode>")])
10546 (define_insn "<shift_insn><mode>3<mask_name>"
10547 [(set (match_operand:VI2_AVX2_AVX512BW 0 "register_operand" "=x,v")
10548 (any_lshift:VI2_AVX2_AVX512BW
10549 (match_operand:VI2_AVX2_AVX512BW 1 "register_operand" "0,v")
10550 (match_operand:SI 2 "nonmemory_operand" "xN,vN")))]
10551 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10553 p<vshift><ssemodesuffix>\t{%2, %0|%0, %2}
10554 vp<vshift><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10555 [(set_attr "isa" "noavx,avx")
10556 (set_attr "type" "sseishft")
10557 (set (attr "length_immediate")
10558 (if_then_else (match_operand 2 "const_int_operand")
10560 (const_string "0")))
10561 (set_attr "prefix_data16" "1,*")
10562 (set_attr "prefix" "orig,vex")
10563 (set_attr "mode" "<sseinsnmode>")])
10565 (define_insn "<shift_insn><mode>3<mask_name>"
10566 [(set (match_operand:VI48_AVX2 0 "register_operand" "=x,v")
10567 (any_lshift:VI48_AVX2
10568 (match_operand:VI48_AVX2 1 "register_operand" "0,v")
10569 (match_operand:SI 2 "nonmemory_operand" "xN,vN")))]
10570 "TARGET_SSE2 && <mask_mode512bit_condition>"
10572 p<vshift><ssemodesuffix>\t{%2, %0|%0, %2}
10573 vp<vshift><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10574 [(set_attr "isa" "noavx,avx")
10575 (set_attr "type" "sseishft")
10576 (set (attr "length_immediate")
10577 (if_then_else (match_operand 2 "const_int_operand")
10579 (const_string "0")))
10580 (set_attr "prefix_data16" "1,*")
10581 (set_attr "prefix" "orig,vex")
10582 (set_attr "mode" "<sseinsnmode>")])
10584 (define_insn "<shift_insn><mode>3<mask_name>"
10585 [(set (match_operand:VI48_512 0 "register_operand" "=v,v")
10586 (any_lshift:VI48_512
10587 (match_operand:VI48_512 1 "nonimmediate_operand" "v,m")
10588 (match_operand:SI 2 "nonmemory_operand" "vN,N")))]
10589 "TARGET_AVX512F && <mask_mode512bit_condition>"
10590 "vp<vshift><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10591 [(set_attr "isa" "avx512f")
10592 (set_attr "type" "sseishft")
10593 (set (attr "length_immediate")
10594 (if_then_else (match_operand 2 "const_int_operand")
10596 (const_string "0")))
10597 (set_attr "prefix" "evex")
10598 (set_attr "mode" "<sseinsnmode>")])
10601 (define_expand "vec_shl_<mode>"
10602 [(set (match_dup 3)
10604 (match_operand:VI_128 1 "register_operand")
10605 (match_operand:SI 2 "const_0_to_255_mul_8_operand")))
10606 (set (match_operand:VI_128 0 "register_operand") (match_dup 4))]
10609 operands[1] = gen_lowpart (V1TImode, operands[1]);
10610 operands[3] = gen_reg_rtx (V1TImode);
10611 operands[4] = gen_lowpart (<MODE>mode, operands[3]);
10614 (define_insn "<sse2_avx2>_ashl<mode>3"
10615 [(set (match_operand:VIMAX_AVX2 0 "register_operand" "=x,v")
10617 (match_operand:VIMAX_AVX2 1 "register_operand" "0,v")
10618 (match_operand:SI 2 "const_0_to_255_mul_8_operand" "n,n")))]
10621 operands[2] = GEN_INT (INTVAL (operands[2]) / 8);
10623 switch (which_alternative)
10626 return "pslldq\t{%2, %0|%0, %2}";
10628 return "vpslldq\t{%2, %1, %0|%0, %1, %2}";
10630 gcc_unreachable ();
10633 [(set_attr "isa" "noavx,avx")
10634 (set_attr "type" "sseishft")
10635 (set_attr "length_immediate" "1")
10636 (set_attr "prefix_data16" "1,*")
10637 (set_attr "prefix" "orig,vex")
10638 (set_attr "mode" "<sseinsnmode>")])
10640 (define_expand "vec_shr_<mode>"
10641 [(set (match_dup 3)
10643 (match_operand:VI_128 1 "register_operand")
10644 (match_operand:SI 2 "const_0_to_255_mul_8_operand")))
10645 (set (match_operand:VI_128 0 "register_operand") (match_dup 4))]
10648 operands[1] = gen_lowpart (V1TImode, operands[1]);
10649 operands[3] = gen_reg_rtx (V1TImode);
10650 operands[4] = gen_lowpart (<MODE>mode, operands[3]);
10653 (define_insn "<sse2_avx2>_lshr<mode>3"
10654 [(set (match_operand:VIMAX_AVX2 0 "register_operand" "=x,v")
10655 (lshiftrt:VIMAX_AVX2
10656 (match_operand:VIMAX_AVX2 1 "register_operand" "0,v")
10657 (match_operand:SI 2 "const_0_to_255_mul_8_operand" "n,n")))]
10660 operands[2] = GEN_INT (INTVAL (operands[2]) / 8);
10662 switch (which_alternative)
10665 return "psrldq\t{%2, %0|%0, %2}";
10667 return "vpsrldq\t{%2, %1, %0|%0, %1, %2}";
10669 gcc_unreachable ();
10672 [(set_attr "isa" "noavx,avx")
10673 (set_attr "type" "sseishft")
10674 (set_attr "length_immediate" "1")
10675 (set_attr "atom_unit" "sishuf")
10676 (set_attr "prefix_data16" "1,*")
10677 (set_attr "prefix" "orig,vex")
10678 (set_attr "mode" "<sseinsnmode>")])
10680 (define_insn "<avx512>_<rotate>v<mode><mask_name>"
10681 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
10682 (any_rotate:VI48_AVX512VL
10683 (match_operand:VI48_AVX512VL 1 "register_operand" "v")
10684 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")))]
10686 "vp<rotate>v<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10687 [(set_attr "prefix" "evex")
10688 (set_attr "mode" "<sseinsnmode>")])
10690 (define_insn "<avx512>_<rotate><mode><mask_name>"
10691 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
10692 (any_rotate:VI48_AVX512VL
10693 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm")
10694 (match_operand:SI 2 "const_0_to_255_operand")))]
10696 "vp<rotate><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10697 [(set_attr "prefix" "evex")
10698 (set_attr "mode" "<sseinsnmode>")])
10700 (define_expand "<code><mode>3"
10701 [(set (match_operand:VI124_256_AVX512F_AVX512BW 0 "register_operand")
10702 (maxmin:VI124_256_AVX512F_AVX512BW
10703 (match_operand:VI124_256_AVX512F_AVX512BW 1 "nonimmediate_operand")
10704 (match_operand:VI124_256_AVX512F_AVX512BW 2 "nonimmediate_operand")))]
10706 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
10708 (define_insn "*avx2_<code><mode>3"
10709 [(set (match_operand:VI124_256 0 "register_operand" "=v")
10711 (match_operand:VI124_256 1 "nonimmediate_operand" "%v")
10712 (match_operand:VI124_256 2 "nonimmediate_operand" "vm")))]
10713 "TARGET_AVX2 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
10714 "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
10715 [(set_attr "type" "sseiadd")
10716 (set_attr "prefix_extra" "1")
10717 (set_attr "prefix" "vex")
10718 (set_attr "mode" "OI")])
10720 (define_expand "<code><mode>3_mask"
10721 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
10722 (vec_merge:VI48_AVX512VL
10723 (maxmin:VI48_AVX512VL
10724 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand")
10725 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand"))
10726 (match_operand:VI48_AVX512VL 3 "vector_move_operand")
10727 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
10729 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
10731 (define_insn "*avx512bw_<code><mode>3<mask_name>"
10732 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
10733 (maxmin:VI48_AVX512VL
10734 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "%v")
10735 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")))]
10736 "TARGET_AVX512F && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
10737 "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10738 [(set_attr "type" "sseiadd")
10739 (set_attr "prefix_extra" "1")
10740 (set_attr "prefix" "maybe_evex")
10741 (set_attr "mode" "<sseinsnmode>")])
10743 (define_insn "<mask_codefor><code><mode>3<mask_name>"
10744 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
10745 (maxmin:VI12_AVX512VL
10746 (match_operand:VI12_AVX512VL 1 "register_operand" "v")
10747 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")))]
10749 "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10750 [(set_attr "type" "sseiadd")
10751 (set_attr "prefix" "evex")
10752 (set_attr "mode" "<sseinsnmode>")])
10754 (define_expand "<code><mode>3"
10755 [(set (match_operand:VI8_AVX2_AVX512BW 0 "register_operand")
10756 (maxmin:VI8_AVX2_AVX512BW
10757 (match_operand:VI8_AVX2_AVX512BW 1 "register_operand")
10758 (match_operand:VI8_AVX2_AVX512BW 2 "register_operand")))]
10762 && (<MODE>mode == V8DImode || TARGET_AVX512VL))
10763 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
10766 enum rtx_code code;
10771 xops[0] = operands[0];
10773 if (<CODE> == SMAX || <CODE> == UMAX)
10775 xops[1] = operands[1];
10776 xops[2] = operands[2];
10780 xops[1] = operands[2];
10781 xops[2] = operands[1];
10784 code = (<CODE> == UMAX || <CODE> == UMIN) ? GTU : GT;
10786 xops[3] = gen_rtx_fmt_ee (code, VOIDmode, operands[1], operands[2]);
10787 xops[4] = operands[1];
10788 xops[5] = operands[2];
10790 ok = ix86_expand_int_vcond (xops);
10796 (define_expand "<code><mode>3"
10797 [(set (match_operand:VI124_128 0 "register_operand")
10799 (match_operand:VI124_128 1 "vector_operand")
10800 (match_operand:VI124_128 2 "vector_operand")))]
10803 if (TARGET_SSE4_1 || <MODE>mode == V8HImode)
10804 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
10810 xops[0] = operands[0];
10811 operands[1] = force_reg (<MODE>mode, operands[1]);
10812 operands[2] = force_reg (<MODE>mode, operands[2]);
10814 if (<CODE> == SMAX)
10816 xops[1] = operands[1];
10817 xops[2] = operands[2];
10821 xops[1] = operands[2];
10822 xops[2] = operands[1];
10825 xops[3] = gen_rtx_GT (VOIDmode, operands[1], operands[2]);
10826 xops[4] = operands[1];
10827 xops[5] = operands[2];
10829 ok = ix86_expand_int_vcond (xops);
10835 (define_insn "*sse4_1_<code><mode>3<mask_name>"
10836 [(set (match_operand:VI14_128 0 "register_operand" "=Yr,*x,v")
10838 (match_operand:VI14_128 1 "vector_operand" "%0,0,v")
10839 (match_operand:VI14_128 2 "vector_operand" "YrBm,*xBm,vm")))]
10841 && <mask_mode512bit_condition>
10842 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
10844 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
10845 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
10846 vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10847 [(set_attr "isa" "noavx,noavx,avx")
10848 (set_attr "type" "sseiadd")
10849 (set_attr "prefix_extra" "1,1,*")
10850 (set_attr "prefix" "orig,orig,vex")
10851 (set_attr "mode" "TI")])
10853 (define_insn "*<code>v8hi3"
10854 [(set (match_operand:V8HI 0 "register_operand" "=x,x")
10856 (match_operand:V8HI 1 "vector_operand" "%0,x")
10857 (match_operand:V8HI 2 "vector_operand" "xBm,xm")))]
10858 "TARGET_SSE2 && ix86_binary_operator_ok (<CODE>, V8HImode, operands)"
10860 p<maxmin_int>w\t{%2, %0|%0, %2}
10861 vp<maxmin_int>w\t{%2, %1, %0|%0, %1, %2}"
10862 [(set_attr "isa" "noavx,avx")
10863 (set_attr "type" "sseiadd")
10864 (set_attr "prefix_data16" "1,*")
10865 (set_attr "prefix_extra" "*,1")
10866 (set_attr "prefix" "orig,vex")
10867 (set_attr "mode" "TI")])
10869 (define_expand "<code><mode>3"
10870 [(set (match_operand:VI124_128 0 "register_operand")
10872 (match_operand:VI124_128 1 "vector_operand")
10873 (match_operand:VI124_128 2 "vector_operand")))]
10876 if (TARGET_SSE4_1 || <MODE>mode == V16QImode)
10877 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
10878 else if (<CODE> == UMAX && <MODE>mode == V8HImode)
10880 rtx op0 = operands[0], op2 = operands[2], op3 = op0;
10881 operands[1] = force_reg (<MODE>mode, operands[1]);
10882 if (rtx_equal_p (op3, op2))
10883 op3 = gen_reg_rtx (V8HImode);
10884 emit_insn (gen_sse2_ussubv8hi3 (op3, operands[1], op2));
10885 emit_insn (gen_addv8hi3 (op0, op3, op2));
10893 operands[1] = force_reg (<MODE>mode, operands[1]);
10894 operands[2] = force_reg (<MODE>mode, operands[2]);
10896 xops[0] = operands[0];
10898 if (<CODE> == UMAX)
10900 xops[1] = operands[1];
10901 xops[2] = operands[2];
10905 xops[1] = operands[2];
10906 xops[2] = operands[1];
10909 xops[3] = gen_rtx_GTU (VOIDmode, operands[1], operands[2]);
10910 xops[4] = operands[1];
10911 xops[5] = operands[2];
10913 ok = ix86_expand_int_vcond (xops);
10919 (define_insn "*sse4_1_<code><mode>3<mask_name>"
10920 [(set (match_operand:VI24_128 0 "register_operand" "=Yr,*x,v")
10922 (match_operand:VI24_128 1 "vector_operand" "%0,0,v")
10923 (match_operand:VI24_128 2 "vector_operand" "YrBm,*xBm,vm")))]
10925 && <mask_mode512bit_condition>
10926 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
10928 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
10929 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
10930 vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10931 [(set_attr "isa" "noavx,noavx,avx")
10932 (set_attr "type" "sseiadd")
10933 (set_attr "prefix_extra" "1,1,*")
10934 (set_attr "prefix" "orig,orig,vex")
10935 (set_attr "mode" "TI")])
10937 (define_insn "*<code>v16qi3"
10938 [(set (match_operand:V16QI 0 "register_operand" "=x,x")
10940 (match_operand:V16QI 1 "vector_operand" "%0,x")
10941 (match_operand:V16QI 2 "vector_operand" "xBm,xm")))]
10942 "TARGET_SSE2 && ix86_binary_operator_ok (<CODE>, V16QImode, operands)"
10944 p<maxmin_int>b\t{%2, %0|%0, %2}
10945 vp<maxmin_int>b\t{%2, %1, %0|%0, %1, %2}"
10946 [(set_attr "isa" "noavx,avx")
10947 (set_attr "type" "sseiadd")
10948 (set_attr "prefix_data16" "1,*")
10949 (set_attr "prefix_extra" "*,1")
10950 (set_attr "prefix" "orig,vex")
10951 (set_attr "mode" "TI")])
10953 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
10955 ;; Parallel integral comparisons
10957 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
10959 (define_expand "avx2_eq<mode>3"
10960 [(set (match_operand:VI_256 0 "register_operand")
10962 (match_operand:VI_256 1 "nonimmediate_operand")
10963 (match_operand:VI_256 2 "nonimmediate_operand")))]
10965 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
10967 (define_insn "*avx2_eq<mode>3"
10968 [(set (match_operand:VI_256 0 "register_operand" "=x")
10970 (match_operand:VI_256 1 "nonimmediate_operand" "%x")
10971 (match_operand:VI_256 2 "nonimmediate_operand" "xm")))]
10972 "TARGET_AVX2 && ix86_binary_operator_ok (EQ, <MODE>mode, operands)"
10973 "vpcmpeq<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
10974 [(set_attr "type" "ssecmp")
10975 (set_attr "prefix_extra" "1")
10976 (set_attr "prefix" "vex")
10977 (set_attr "mode" "OI")])
10979 (define_expand "<avx512>_eq<mode>3<mask_scalar_merge_name>"
10980 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
10981 (unspec:<avx512fmaskmode>
10982 [(match_operand:VI12_AVX512VL 1 "register_operand")
10983 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand")]
10984 UNSPEC_MASKED_EQ))]
10986 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
10988 (define_expand "<avx512>_eq<mode>3<mask_scalar_merge_name>"
10989 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
10990 (unspec:<avx512fmaskmode>
10991 [(match_operand:VI48_AVX512VL 1 "register_operand")
10992 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand")]
10993 UNSPEC_MASKED_EQ))]
10995 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
10997 (define_insn "<avx512>_eq<mode>3<mask_scalar_merge_name>_1"
10998 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
10999 (unspec:<avx512fmaskmode>
11000 [(match_operand:VI12_AVX512VL 1 "register_operand" "%v")
11001 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")]
11002 UNSPEC_MASKED_EQ))]
11003 "TARGET_AVX512F && ix86_binary_operator_ok (EQ, <MODE>mode, operands)"
11004 "vpcmpeq<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11005 [(set_attr "type" "ssecmp")
11006 (set_attr "prefix_extra" "1")
11007 (set_attr "prefix" "evex")
11008 (set_attr "mode" "<sseinsnmode>")])
11010 (define_insn "<avx512>_eq<mode>3<mask_scalar_merge_name>_1"
11011 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11012 (unspec:<avx512fmaskmode>
11013 [(match_operand:VI48_AVX512VL 1 "register_operand" "%v")
11014 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")]
11015 UNSPEC_MASKED_EQ))]
11016 "TARGET_AVX512F && ix86_binary_operator_ok (EQ, <MODE>mode, operands)"
11017 "vpcmpeq<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11018 [(set_attr "type" "ssecmp")
11019 (set_attr "prefix_extra" "1")
11020 (set_attr "prefix" "evex")
11021 (set_attr "mode" "<sseinsnmode>")])
11023 (define_insn "*sse4_1_eqv2di3"
11024 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,x")
11026 (match_operand:V2DI 1 "vector_operand" "%0,0,x")
11027 (match_operand:V2DI 2 "vector_operand" "YrBm,*xBm,xm")))]
11028 "TARGET_SSE4_1 && ix86_binary_operator_ok (EQ, V2DImode, operands)"
11030 pcmpeqq\t{%2, %0|%0, %2}
11031 pcmpeqq\t{%2, %0|%0, %2}
11032 vpcmpeqq\t{%2, %1, %0|%0, %1, %2}"
11033 [(set_attr "isa" "noavx,noavx,avx")
11034 (set_attr "type" "ssecmp")
11035 (set_attr "prefix_extra" "1")
11036 (set_attr "prefix" "orig,orig,vex")
11037 (set_attr "mode" "TI")])
11039 (define_insn "*sse2_eq<mode>3"
11040 [(set (match_operand:VI124_128 0 "register_operand" "=x,x")
11042 (match_operand:VI124_128 1 "vector_operand" "%0,x")
11043 (match_operand:VI124_128 2 "vector_operand" "xBm,xm")))]
11044 "TARGET_SSE2 && !TARGET_XOP
11045 && ix86_binary_operator_ok (EQ, <MODE>mode, operands)"
11047 pcmpeq<ssemodesuffix>\t{%2, %0|%0, %2}
11048 vpcmpeq<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11049 [(set_attr "isa" "noavx,avx")
11050 (set_attr "type" "ssecmp")
11051 (set_attr "prefix_data16" "1,*")
11052 (set_attr "prefix" "orig,vex")
11053 (set_attr "mode" "TI")])
11055 (define_expand "sse2_eq<mode>3"
11056 [(set (match_operand:VI124_128 0 "register_operand")
11058 (match_operand:VI124_128 1 "vector_operand")
11059 (match_operand:VI124_128 2 "vector_operand")))]
11060 "TARGET_SSE2 && !TARGET_XOP "
11061 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
11063 (define_expand "sse4_1_eqv2di3"
11064 [(set (match_operand:V2DI 0 "register_operand")
11066 (match_operand:V2DI 1 "vector_operand")
11067 (match_operand:V2DI 2 "vector_operand")))]
11069 "ix86_fixup_binary_operands_no_copy (EQ, V2DImode, operands);")
11071 (define_insn "sse4_2_gtv2di3"
11072 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,x")
11074 (match_operand:V2DI 1 "register_operand" "0,0,x")
11075 (match_operand:V2DI 2 "vector_operand" "YrBm,*xBm,xm")))]
11078 pcmpgtq\t{%2, %0|%0, %2}
11079 pcmpgtq\t{%2, %0|%0, %2}
11080 vpcmpgtq\t{%2, %1, %0|%0, %1, %2}"
11081 [(set_attr "isa" "noavx,noavx,avx")
11082 (set_attr "type" "ssecmp")
11083 (set_attr "prefix_extra" "1")
11084 (set_attr "prefix" "orig,orig,vex")
11085 (set_attr "mode" "TI")])
11087 (define_insn "avx2_gt<mode>3"
11088 [(set (match_operand:VI_256 0 "register_operand" "=x")
11090 (match_operand:VI_256 1 "register_operand" "x")
11091 (match_operand:VI_256 2 "nonimmediate_operand" "xm")))]
11093 "vpcmpgt<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11094 [(set_attr "type" "ssecmp")
11095 (set_attr "prefix_extra" "1")
11096 (set_attr "prefix" "vex")
11097 (set_attr "mode" "OI")])
11099 (define_insn "<avx512>_gt<mode>3<mask_scalar_merge_name>"
11100 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11101 (unspec:<avx512fmaskmode>
11102 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
11103 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")] UNSPEC_MASKED_GT))]
11105 "vpcmpgt<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11106 [(set_attr "type" "ssecmp")
11107 (set_attr "prefix_extra" "1")
11108 (set_attr "prefix" "evex")
11109 (set_attr "mode" "<sseinsnmode>")])
11111 (define_insn "<avx512>_gt<mode>3<mask_scalar_merge_name>"
11112 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11113 (unspec:<avx512fmaskmode>
11114 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
11115 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")] UNSPEC_MASKED_GT))]
11117 "vpcmpgt<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11118 [(set_attr "type" "ssecmp")
11119 (set_attr "prefix_extra" "1")
11120 (set_attr "prefix" "evex")
11121 (set_attr "mode" "<sseinsnmode>")])
11123 (define_insn "sse2_gt<mode>3"
11124 [(set (match_operand:VI124_128 0 "register_operand" "=x,x")
11126 (match_operand:VI124_128 1 "register_operand" "0,x")
11127 (match_operand:VI124_128 2 "vector_operand" "xBm,xm")))]
11128 "TARGET_SSE2 && !TARGET_XOP"
11130 pcmpgt<ssemodesuffix>\t{%2, %0|%0, %2}
11131 vpcmpgt<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11132 [(set_attr "isa" "noavx,avx")
11133 (set_attr "type" "ssecmp")
11134 (set_attr "prefix_data16" "1,*")
11135 (set_attr "prefix" "orig,vex")
11136 (set_attr "mode" "TI")])
11138 (define_expand "vcond<V_512:mode><VI_512:mode>"
11139 [(set (match_operand:V_512 0 "register_operand")
11140 (if_then_else:V_512
11141 (match_operator 3 ""
11142 [(match_operand:VI_512 4 "nonimmediate_operand")
11143 (match_operand:VI_512 5 "general_operand")])
11144 (match_operand:V_512 1)
11145 (match_operand:V_512 2)))]
11147 && (GET_MODE_NUNITS (<V_512:MODE>mode)
11148 == GET_MODE_NUNITS (<VI_512:MODE>mode))"
11150 bool ok = ix86_expand_int_vcond (operands);
11155 (define_expand "vcond<V_256:mode><VI_256:mode>"
11156 [(set (match_operand:V_256 0 "register_operand")
11157 (if_then_else:V_256
11158 (match_operator 3 ""
11159 [(match_operand:VI_256 4 "nonimmediate_operand")
11160 (match_operand:VI_256 5 "general_operand")])
11161 (match_operand:V_256 1)
11162 (match_operand:V_256 2)))]
11164 && (GET_MODE_NUNITS (<V_256:MODE>mode)
11165 == GET_MODE_NUNITS (<VI_256:MODE>mode))"
11167 bool ok = ix86_expand_int_vcond (operands);
11172 (define_expand "vcond<V_128:mode><VI124_128:mode>"
11173 [(set (match_operand:V_128 0 "register_operand")
11174 (if_then_else:V_128
11175 (match_operator 3 ""
11176 [(match_operand:VI124_128 4 "vector_operand")
11177 (match_operand:VI124_128 5 "general_operand")])
11178 (match_operand:V_128 1)
11179 (match_operand:V_128 2)))]
11181 && (GET_MODE_NUNITS (<V_128:MODE>mode)
11182 == GET_MODE_NUNITS (<VI124_128:MODE>mode))"
11184 bool ok = ix86_expand_int_vcond (operands);
11189 (define_expand "vcond<VI8F_128:mode>v2di"
11190 [(set (match_operand:VI8F_128 0 "register_operand")
11191 (if_then_else:VI8F_128
11192 (match_operator 3 ""
11193 [(match_operand:V2DI 4 "vector_operand")
11194 (match_operand:V2DI 5 "general_operand")])
11195 (match_operand:VI8F_128 1)
11196 (match_operand:VI8F_128 2)))]
11199 bool ok = ix86_expand_int_vcond (operands);
11204 (define_expand "vcondu<V_512:mode><VI_512:mode>"
11205 [(set (match_operand:V_512 0 "register_operand")
11206 (if_then_else:V_512
11207 (match_operator 3 ""
11208 [(match_operand:VI_512 4 "nonimmediate_operand")
11209 (match_operand:VI_512 5 "nonimmediate_operand")])
11210 (match_operand:V_512 1 "general_operand")
11211 (match_operand:V_512 2 "general_operand")))]
11213 && (GET_MODE_NUNITS (<V_512:MODE>mode)
11214 == GET_MODE_NUNITS (<VI_512:MODE>mode))"
11216 bool ok = ix86_expand_int_vcond (operands);
11221 (define_expand "vcondu<V_256:mode><VI_256:mode>"
11222 [(set (match_operand:V_256 0 "register_operand")
11223 (if_then_else:V_256
11224 (match_operator 3 ""
11225 [(match_operand:VI_256 4 "nonimmediate_operand")
11226 (match_operand:VI_256 5 "nonimmediate_operand")])
11227 (match_operand:V_256 1 "general_operand")
11228 (match_operand:V_256 2 "general_operand")))]
11230 && (GET_MODE_NUNITS (<V_256:MODE>mode)
11231 == GET_MODE_NUNITS (<VI_256:MODE>mode))"
11233 bool ok = ix86_expand_int_vcond (operands);
11238 (define_expand "vcondu<V_128:mode><VI124_128:mode>"
11239 [(set (match_operand:V_128 0 "register_operand")
11240 (if_then_else:V_128
11241 (match_operator 3 ""
11242 [(match_operand:VI124_128 4 "vector_operand")
11243 (match_operand:VI124_128 5 "vector_operand")])
11244 (match_operand:V_128 1 "general_operand")
11245 (match_operand:V_128 2 "general_operand")))]
11247 && (GET_MODE_NUNITS (<V_128:MODE>mode)
11248 == GET_MODE_NUNITS (<VI124_128:MODE>mode))"
11250 bool ok = ix86_expand_int_vcond (operands);
11255 (define_expand "vcondu<VI8F_128:mode>v2di"
11256 [(set (match_operand:VI8F_128 0 "register_operand")
11257 (if_then_else:VI8F_128
11258 (match_operator 3 ""
11259 [(match_operand:V2DI 4 "vector_operand")
11260 (match_operand:V2DI 5 "vector_operand")])
11261 (match_operand:VI8F_128 1 "general_operand")
11262 (match_operand:VI8F_128 2 "general_operand")))]
11265 bool ok = ix86_expand_int_vcond (operands);
11270 (define_mode_iterator VEC_PERM_AVX2
11271 [V16QI V8HI V4SI V2DI V4SF V2DF
11272 (V32QI "TARGET_AVX2") (V16HI "TARGET_AVX2")
11273 (V8SI "TARGET_AVX2") (V4DI "TARGET_AVX2")
11274 (V8SF "TARGET_AVX2") (V4DF "TARGET_AVX2")
11275 (V16SF "TARGET_AVX512F") (V8DF "TARGET_AVX512F")
11276 (V16SI "TARGET_AVX512F") (V8DI "TARGET_AVX512F")
11277 (V32HI "TARGET_AVX512BW") (V64QI "TARGET_AVX512VBMI")])
11279 (define_expand "vec_perm<mode>"
11280 [(match_operand:VEC_PERM_AVX2 0 "register_operand")
11281 (match_operand:VEC_PERM_AVX2 1 "register_operand")
11282 (match_operand:VEC_PERM_AVX2 2 "register_operand")
11283 (match_operand:<sseintvecmode> 3 "register_operand")]
11284 "TARGET_SSSE3 || TARGET_AVX || TARGET_XOP"
11286 ix86_expand_vec_perm (operands);
11290 (define_mode_iterator VEC_PERM_CONST
11291 [(V4SF "TARGET_SSE") (V4SI "TARGET_SSE")
11292 (V2DF "TARGET_SSE") (V2DI "TARGET_SSE")
11293 (V16QI "TARGET_SSE2") (V8HI "TARGET_SSE2")
11294 (V8SF "TARGET_AVX") (V4DF "TARGET_AVX")
11295 (V8SI "TARGET_AVX") (V4DI "TARGET_AVX")
11296 (V32QI "TARGET_AVX2") (V16HI "TARGET_AVX2")
11297 (V16SI "TARGET_AVX512F") (V8DI "TARGET_AVX512F")
11298 (V16SF "TARGET_AVX512F") (V8DF "TARGET_AVX512F")
11299 (V32HI "TARGET_AVX512BW") (V64QI "TARGET_AVX512BW")])
11301 (define_expand "vec_perm_const<mode>"
11302 [(match_operand:VEC_PERM_CONST 0 "register_operand")
11303 (match_operand:VEC_PERM_CONST 1 "register_operand")
11304 (match_operand:VEC_PERM_CONST 2 "register_operand")
11305 (match_operand:<sseintvecmode> 3)]
11308 if (ix86_expand_vec_perm_const (operands))
11314 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11316 ;; Parallel bitwise logical operations
11318 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11320 (define_expand "one_cmpl<mode>2"
11321 [(set (match_operand:VI 0 "register_operand")
11322 (xor:VI (match_operand:VI 1 "vector_operand")
11326 int i, n = GET_MODE_NUNITS (<MODE>mode);
11327 rtvec v = rtvec_alloc (n);
11329 for (i = 0; i < n; ++i)
11330 RTVEC_ELT (v, i) = constm1_rtx;
11332 operands[2] = force_reg (<MODE>mode, gen_rtx_CONST_VECTOR (<MODE>mode, v));
11335 (define_expand "<sse2_avx2>_andnot<mode>3"
11336 [(set (match_operand:VI_AVX2 0 "register_operand")
11338 (not:VI_AVX2 (match_operand:VI_AVX2 1 "register_operand"))
11339 (match_operand:VI_AVX2 2 "vector_operand")))]
11342 (define_expand "<sse2_avx2>_andnot<mode>3_mask"
11343 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
11344 (vec_merge:VI48_AVX512VL
11347 (match_operand:VI48_AVX512VL 1 "register_operand"))
11348 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand"))
11349 (match_operand:VI48_AVX512VL 3 "vector_move_operand")
11350 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
11353 (define_expand "<sse2_avx2>_andnot<mode>3_mask"
11354 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
11355 (vec_merge:VI12_AVX512VL
11358 (match_operand:VI12_AVX512VL 1 "register_operand"))
11359 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand"))
11360 (match_operand:VI12_AVX512VL 3 "vector_move_operand")
11361 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
11364 (define_insn "*andnot<mode>3"
11365 [(set (match_operand:VI 0 "register_operand" "=x,v")
11367 (not:VI (match_operand:VI 1 "register_operand" "0,v"))
11368 (match_operand:VI 2 "vector_operand" "xBm,vm")))]
11371 static char buf[64];
11375 switch (get_attr_mode (insn))
11378 gcc_assert (TARGET_AVX512F);
11380 gcc_assert (TARGET_AVX2);
11382 gcc_assert (TARGET_SSE2);
11383 switch (<MODE>mode)
11387 /* There is no vpandnb or vpandnw instruction, nor vpandn for
11388 512-bit vectors. Use vpandnq instead. */
11393 tmp = "pandn<ssemodesuffix>";
11399 tmp = TARGET_AVX512VL ? "pandn<ssemodesuffix>" : "pandn";
11402 tmp = TARGET_AVX512VL ? "pandnq" : "pandn";
11408 gcc_assert (TARGET_AVX512F);
11410 gcc_assert (TARGET_AVX);
11412 gcc_assert (TARGET_SSE);
11418 gcc_unreachable ();
11421 switch (which_alternative)
11424 ops = "%s\t{%%2, %%0|%%0, %%2}";
11427 ops = "v%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
11430 gcc_unreachable ();
11433 snprintf (buf, sizeof (buf), ops, tmp);
11436 [(set_attr "isa" "noavx,avx")
11437 (set_attr "type" "sselog")
11438 (set (attr "prefix_data16")
11440 (and (eq_attr "alternative" "0")
11441 (eq_attr "mode" "TI"))
11443 (const_string "*")))
11444 (set_attr "prefix" "orig,vex")
11446 (cond [(and (match_test "<MODE_SIZE> == 16")
11447 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
11448 (const_string "<ssePSmode>")
11449 (match_test "TARGET_AVX2")
11450 (const_string "<sseinsnmode>")
11451 (match_test "TARGET_AVX")
11453 (match_test "<MODE_SIZE> > 16")
11454 (const_string "V8SF")
11455 (const_string "<sseinsnmode>"))
11456 (ior (not (match_test "TARGET_SSE2"))
11457 (match_test "optimize_function_for_size_p (cfun)"))
11458 (const_string "V4SF")
11460 (const_string "<sseinsnmode>")))])
11462 (define_insn "*andnot<mode>3_mask"
11463 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
11464 (vec_merge:VI48_AVX512VL
11467 (match_operand:VI48_AVX512VL 1 "register_operand" "v"))
11468 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm"))
11469 (match_operand:VI48_AVX512VL 3 "vector_move_operand" "0C")
11470 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
11472 "vpandn<ssemodesuffix>\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}";
11473 [(set_attr "type" "sselog")
11474 (set_attr "prefix" "evex")
11475 (set_attr "mode" "<sseinsnmode>")])
11477 (define_expand "<code><mode>3"
11478 [(set (match_operand:VI 0 "register_operand")
11480 (match_operand:VI 1 "nonimmediate_or_const_vector_operand")
11481 (match_operand:VI 2 "nonimmediate_or_const_vector_operand")))]
11484 ix86_expand_vector_logical_operator (<CODE>, <MODE>mode, operands);
11488 (define_insn "<mask_codefor><code><mode>3<mask_name>"
11489 [(set (match_operand:VI48_AVX_AVX512F 0 "register_operand" "=x,v")
11490 (any_logic:VI48_AVX_AVX512F
11491 (match_operand:VI48_AVX_AVX512F 1 "vector_operand" "%0,v")
11492 (match_operand:VI48_AVX_AVX512F 2 "vector_operand" "xBm,vm")))]
11493 "TARGET_SSE && <mask_mode512bit_condition>
11494 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
11496 static char buf[64];
11500 switch (get_attr_mode (insn))
11503 gcc_assert (TARGET_AVX512F);
11505 gcc_assert (TARGET_AVX2 || TARGET_AVX512VL);
11507 gcc_assert (TARGET_SSE2 || TARGET_AVX512VL);
11508 switch (<MODE>mode)
11512 if (TARGET_AVX512F)
11514 tmp = "p<logic><ssemodesuffix>";
11521 tmp = TARGET_AVX512VL ? "p<logic><ssemodesuffix>" : "p<logic>";
11524 gcc_unreachable ();
11529 gcc_assert (TARGET_AVX);
11531 gcc_assert (TARGET_SSE);
11532 gcc_assert (!<mask_applied>);
11537 gcc_unreachable ();
11540 switch (which_alternative)
11543 if (<mask_applied>)
11544 ops = "v%s\t{%%2, %%0, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%0, %%2}";
11546 ops = "%s\t{%%2, %%0|%%0, %%2}";
11549 ops = "v%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
11552 gcc_unreachable ();
11555 snprintf (buf, sizeof (buf), ops, tmp);
11558 [(set_attr "isa" "noavx,avx")
11559 (set_attr "type" "sselog")
11560 (set (attr "prefix_data16")
11562 (and (eq_attr "alternative" "0")
11563 (eq_attr "mode" "TI"))
11565 (const_string "*")))
11566 (set_attr "prefix" "<mask_prefix3>")
11568 (cond [(and (match_test "<MODE_SIZE> == 16")
11569 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
11570 (const_string "<ssePSmode>")
11571 (match_test "TARGET_AVX2")
11572 (const_string "<sseinsnmode>")
11573 (match_test "TARGET_AVX")
11575 (match_test "<MODE_SIZE> > 16")
11576 (const_string "V8SF")
11577 (const_string "<sseinsnmode>"))
11578 (ior (not (match_test "TARGET_SSE2"))
11579 (match_test "optimize_function_for_size_p (cfun)"))
11580 (const_string "V4SF")
11582 (const_string "<sseinsnmode>")))])
11584 (define_insn "*<code><mode>3"
11585 [(set (match_operand:VI12_AVX_AVX512F 0 "register_operand" "=x,v")
11586 (any_logic: VI12_AVX_AVX512F
11587 (match_operand:VI12_AVX_AVX512F 1 "vector_operand" "%0,v")
11588 (match_operand:VI12_AVX_AVX512F 2 "vector_operand" "xBm,vm")))]
11589 "TARGET_SSE && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
11591 static char buf[64];
11594 const char *ssesuffix;
11596 switch (get_attr_mode (insn))
11599 gcc_assert (TARGET_AVX512F);
11601 gcc_assert (TARGET_AVX2 || TARGET_AVX512VL);
11603 gcc_assert (TARGET_SSE2 || TARGET_AVX512VL);
11604 switch (<MODE>mode)
11608 if (TARGET_AVX512F)
11618 if (TARGET_AVX512VL || TARGET_AVX2 || TARGET_SSE2)
11621 ssesuffix = TARGET_AVX512VL ? "q" : "";
11625 gcc_unreachable ();
11630 gcc_assert (TARGET_AVX);
11632 gcc_assert (TARGET_SSE);
11638 gcc_unreachable ();
11641 switch (which_alternative)
11644 ops = "%s\t{%%2, %%0|%%0, %%2}";
11645 snprintf (buf, sizeof (buf), ops, tmp);
11648 ops = "v%s%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
11649 snprintf (buf, sizeof (buf), ops, tmp, ssesuffix);
11652 gcc_unreachable ();
11657 [(set_attr "isa" "noavx,avx")
11658 (set_attr "type" "sselog")
11659 (set (attr "prefix_data16")
11661 (and (eq_attr "alternative" "0")
11662 (eq_attr "mode" "TI"))
11664 (const_string "*")))
11665 (set_attr "prefix" "<mask_prefix3>")
11667 (cond [(and (match_test "<MODE_SIZE> == 16")
11668 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
11669 (const_string "<ssePSmode>")
11670 (match_test "TARGET_AVX2")
11671 (const_string "<sseinsnmode>")
11672 (match_test "TARGET_AVX")
11674 (match_test "<MODE_SIZE> > 16")
11675 (const_string "V8SF")
11676 (const_string "<sseinsnmode>"))
11677 (ior (not (match_test "TARGET_SSE2"))
11678 (match_test "optimize_function_for_size_p (cfun)"))
11679 (const_string "V4SF")
11681 (const_string "<sseinsnmode>")))])
11683 (define_insn "<avx512>_testm<mode>3<mask_scalar_merge_name>"
11684 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11685 (unspec:<avx512fmaskmode>
11686 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
11687 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")]
11690 "vptestm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11691 [(set_attr "prefix" "evex")
11692 (set_attr "mode" "<sseinsnmode>")])
11694 (define_insn "<avx512>_testm<mode>3<mask_scalar_merge_name>"
11695 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11696 (unspec:<avx512fmaskmode>
11697 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
11698 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")]
11701 "vptestm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11702 [(set_attr "prefix" "evex")
11703 (set_attr "mode" "<sseinsnmode>")])
11705 (define_insn "<avx512>_testnm<mode>3<mask_scalar_merge_name>"
11706 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11707 (unspec:<avx512fmaskmode>
11708 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
11709 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")]
11712 "vptestnm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11713 [(set_attr "prefix" "evex")
11714 (set_attr "mode" "<sseinsnmode>")])
11716 (define_insn "<avx512>_testnm<mode>3<mask_scalar_merge_name>"
11717 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11718 (unspec:<avx512fmaskmode>
11719 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
11720 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")]
11723 "vptestnm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11724 [(set_attr "prefix" "evex")
11725 (set_attr "mode" "<sseinsnmode>")])
11727 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11729 ;; Parallel integral element swizzling
11731 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11733 (define_expand "vec_pack_trunc_<mode>"
11734 [(match_operand:<ssepackmode> 0 "register_operand")
11735 (match_operand:VI248_AVX2_8_AVX512F_24_AVX512BW 1 "register_operand")
11736 (match_operand:VI248_AVX2_8_AVX512F_24_AVX512BW 2 "register_operand")]
11739 rtx op1 = gen_lowpart (<ssepackmode>mode, operands[1]);
11740 rtx op2 = gen_lowpart (<ssepackmode>mode, operands[2]);
11741 ix86_expand_vec_extract_even_odd (operands[0], op1, op2, 0);
11745 (define_expand "vec_pack_trunc_qi"
11746 [(set (match_operand:HI 0 ("register_operand"))
11747 (ior:HI (ashift:HI (zero_extend:HI (match_operand:QI 1 ("register_operand")))
11749 (zero_extend:HI (match_operand:QI 2 ("register_operand")))))]
11752 (define_expand "vec_pack_trunc_<mode>"
11753 [(set (match_operand:<DOUBLEMASKMODE> 0 ("register_operand"))
11754 (ior:<DOUBLEMASKMODE> (ashift:<DOUBLEMASKMODE> (zero_extend:<DOUBLEMASKMODE> (match_operand:SWI24 1 ("register_operand")))
11756 (zero_extend:<DOUBLEMASKMODE> (match_operand:SWI24 2 ("register_operand")))))]
11759 operands[3] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
11762 (define_insn "<sse2_avx2>_packsswb<mask_name>"
11763 [(set (match_operand:VI1_AVX512 0 "register_operand" "=x,x")
11764 (vec_concat:VI1_AVX512
11765 (ss_truncate:<ssehalfvecmode>
11766 (match_operand:<sseunpackmode> 1 "register_operand" "0,v"))
11767 (ss_truncate:<ssehalfvecmode>
11768 (match_operand:<sseunpackmode> 2 "vector_operand" "xBm,vm"))))]
11769 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
11771 packsswb\t{%2, %0|%0, %2}
11772 vpacksswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11773 [(set_attr "isa" "noavx,avx")
11774 (set_attr "type" "sselog")
11775 (set_attr "prefix_data16" "1,*")
11776 (set_attr "prefix" "orig,maybe_evex")
11777 (set_attr "mode" "<sseinsnmode>")])
11779 (define_insn "<sse2_avx2>_packssdw<mask_name>"
11780 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,v")
11781 (vec_concat:VI2_AVX2
11782 (ss_truncate:<ssehalfvecmode>
11783 (match_operand:<sseunpackmode> 1 "register_operand" "0,v"))
11784 (ss_truncate:<ssehalfvecmode>
11785 (match_operand:<sseunpackmode> 2 "vector_operand" "xBm,vm"))))]
11786 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
11788 packssdw\t{%2, %0|%0, %2}
11789 vpackssdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11790 [(set_attr "isa" "noavx,avx")
11791 (set_attr "type" "sselog")
11792 (set_attr "prefix_data16" "1,*")
11793 (set_attr "prefix" "orig,vex")
11794 (set_attr "mode" "<sseinsnmode>")])
11796 (define_insn "<sse2_avx2>_packuswb<mask_name>"
11797 [(set (match_operand:VI1_AVX512 0 "register_operand" "=x,x")
11798 (vec_concat:VI1_AVX512
11799 (us_truncate:<ssehalfvecmode>
11800 (match_operand:<sseunpackmode> 1 "register_operand" "0,v"))
11801 (us_truncate:<ssehalfvecmode>
11802 (match_operand:<sseunpackmode> 2 "vector_operand" "xBm,vm"))))]
11803 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
11805 packuswb\t{%2, %0|%0, %2}
11806 vpackuswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11807 [(set_attr "isa" "noavx,avx")
11808 (set_attr "type" "sselog")
11809 (set_attr "prefix_data16" "1,*")
11810 (set_attr "prefix" "orig,vex")
11811 (set_attr "mode" "<sseinsnmode>")])
11813 (define_insn "avx512bw_interleave_highv64qi<mask_name>"
11814 [(set (match_operand:V64QI 0 "register_operand" "=v")
11817 (match_operand:V64QI 1 "register_operand" "v")
11818 (match_operand:V64QI 2 "nonimmediate_operand" "vm"))
11819 (parallel [(const_int 8) (const_int 72)
11820 (const_int 9) (const_int 73)
11821 (const_int 10) (const_int 74)
11822 (const_int 11) (const_int 75)
11823 (const_int 12) (const_int 76)
11824 (const_int 13) (const_int 77)
11825 (const_int 14) (const_int 78)
11826 (const_int 15) (const_int 79)
11827 (const_int 24) (const_int 88)
11828 (const_int 25) (const_int 89)
11829 (const_int 26) (const_int 90)
11830 (const_int 27) (const_int 91)
11831 (const_int 28) (const_int 92)
11832 (const_int 29) (const_int 93)
11833 (const_int 30) (const_int 94)
11834 (const_int 31) (const_int 95)
11835 (const_int 40) (const_int 104)
11836 (const_int 41) (const_int 105)
11837 (const_int 42) (const_int 106)
11838 (const_int 43) (const_int 107)
11839 (const_int 44) (const_int 108)
11840 (const_int 45) (const_int 109)
11841 (const_int 46) (const_int 110)
11842 (const_int 47) (const_int 111)
11843 (const_int 56) (const_int 120)
11844 (const_int 57) (const_int 121)
11845 (const_int 58) (const_int 122)
11846 (const_int 59) (const_int 123)
11847 (const_int 60) (const_int 124)
11848 (const_int 61) (const_int 125)
11849 (const_int 62) (const_int 126)
11850 (const_int 63) (const_int 127)])))]
11852 "vpunpckhbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11853 [(set_attr "type" "sselog")
11854 (set_attr "prefix" "evex")
11855 (set_attr "mode" "XI")])
11857 (define_insn "avx2_interleave_highv32qi<mask_name>"
11858 [(set (match_operand:V32QI 0 "register_operand" "=v")
11861 (match_operand:V32QI 1 "register_operand" "v")
11862 (match_operand:V32QI 2 "nonimmediate_operand" "vm"))
11863 (parallel [(const_int 8) (const_int 40)
11864 (const_int 9) (const_int 41)
11865 (const_int 10) (const_int 42)
11866 (const_int 11) (const_int 43)
11867 (const_int 12) (const_int 44)
11868 (const_int 13) (const_int 45)
11869 (const_int 14) (const_int 46)
11870 (const_int 15) (const_int 47)
11871 (const_int 24) (const_int 56)
11872 (const_int 25) (const_int 57)
11873 (const_int 26) (const_int 58)
11874 (const_int 27) (const_int 59)
11875 (const_int 28) (const_int 60)
11876 (const_int 29) (const_int 61)
11877 (const_int 30) (const_int 62)
11878 (const_int 31) (const_int 63)])))]
11879 "TARGET_AVX2 && <mask_avx512vl_condition>"
11880 "vpunpckhbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11881 [(set_attr "type" "sselog")
11882 (set_attr "prefix" "<mask_prefix>")
11883 (set_attr "mode" "OI")])
11885 (define_insn "vec_interleave_highv16qi<mask_name>"
11886 [(set (match_operand:V16QI 0 "register_operand" "=x,v")
11889 (match_operand:V16QI 1 "register_operand" "0,v")
11890 (match_operand:V16QI 2 "vector_operand" "xBm,vm"))
11891 (parallel [(const_int 8) (const_int 24)
11892 (const_int 9) (const_int 25)
11893 (const_int 10) (const_int 26)
11894 (const_int 11) (const_int 27)
11895 (const_int 12) (const_int 28)
11896 (const_int 13) (const_int 29)
11897 (const_int 14) (const_int 30)
11898 (const_int 15) (const_int 31)])))]
11899 "TARGET_SSE2 && <mask_avx512vl_condition>"
11901 punpckhbw\t{%2, %0|%0, %2}
11902 vpunpckhbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11903 [(set_attr "isa" "noavx,avx")
11904 (set_attr "type" "sselog")
11905 (set_attr "prefix_data16" "1,*")
11906 (set_attr "prefix" "orig,<mask_prefix>")
11907 (set_attr "mode" "TI")])
11909 (define_insn "avx512bw_interleave_lowv64qi<mask_name>"
11910 [(set (match_operand:V64QI 0 "register_operand" "=v")
11913 (match_operand:V64QI 1 "register_operand" "v")
11914 (match_operand:V64QI 2 "nonimmediate_operand" "vm"))
11915 (parallel [(const_int 0) (const_int 64)
11916 (const_int 1) (const_int 65)
11917 (const_int 2) (const_int 66)
11918 (const_int 3) (const_int 67)
11919 (const_int 4) (const_int 68)
11920 (const_int 5) (const_int 69)
11921 (const_int 6) (const_int 70)
11922 (const_int 7) (const_int 71)
11923 (const_int 16) (const_int 80)
11924 (const_int 17) (const_int 81)
11925 (const_int 18) (const_int 82)
11926 (const_int 19) (const_int 83)
11927 (const_int 20) (const_int 84)
11928 (const_int 21) (const_int 85)
11929 (const_int 22) (const_int 86)
11930 (const_int 23) (const_int 87)
11931 (const_int 32) (const_int 96)
11932 (const_int 33) (const_int 97)
11933 (const_int 34) (const_int 98)
11934 (const_int 35) (const_int 99)
11935 (const_int 36) (const_int 100)
11936 (const_int 37) (const_int 101)
11937 (const_int 38) (const_int 102)
11938 (const_int 39) (const_int 103)
11939 (const_int 48) (const_int 112)
11940 (const_int 49) (const_int 113)
11941 (const_int 50) (const_int 114)
11942 (const_int 51) (const_int 115)
11943 (const_int 52) (const_int 116)
11944 (const_int 53) (const_int 117)
11945 (const_int 54) (const_int 118)
11946 (const_int 55) (const_int 119)])))]
11948 "vpunpcklbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11949 [(set_attr "type" "sselog")
11950 (set_attr "prefix" "evex")
11951 (set_attr "mode" "XI")])
11953 (define_insn "avx2_interleave_lowv32qi<mask_name>"
11954 [(set (match_operand:V32QI 0 "register_operand" "=v")
11957 (match_operand:V32QI 1 "register_operand" "v")
11958 (match_operand:V32QI 2 "nonimmediate_operand" "vm"))
11959 (parallel [(const_int 0) (const_int 32)
11960 (const_int 1) (const_int 33)
11961 (const_int 2) (const_int 34)
11962 (const_int 3) (const_int 35)
11963 (const_int 4) (const_int 36)
11964 (const_int 5) (const_int 37)
11965 (const_int 6) (const_int 38)
11966 (const_int 7) (const_int 39)
11967 (const_int 16) (const_int 48)
11968 (const_int 17) (const_int 49)
11969 (const_int 18) (const_int 50)
11970 (const_int 19) (const_int 51)
11971 (const_int 20) (const_int 52)
11972 (const_int 21) (const_int 53)
11973 (const_int 22) (const_int 54)
11974 (const_int 23) (const_int 55)])))]
11975 "TARGET_AVX2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
11976 "vpunpcklbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11977 [(set_attr "type" "sselog")
11978 (set_attr "prefix" "maybe_vex")
11979 (set_attr "mode" "OI")])
11981 (define_insn "vec_interleave_lowv16qi<mask_name>"
11982 [(set (match_operand:V16QI 0 "register_operand" "=x,v")
11985 (match_operand:V16QI 1 "register_operand" "0,v")
11986 (match_operand:V16QI 2 "vector_operand" "xBm,vm"))
11987 (parallel [(const_int 0) (const_int 16)
11988 (const_int 1) (const_int 17)
11989 (const_int 2) (const_int 18)
11990 (const_int 3) (const_int 19)
11991 (const_int 4) (const_int 20)
11992 (const_int 5) (const_int 21)
11993 (const_int 6) (const_int 22)
11994 (const_int 7) (const_int 23)])))]
11995 "TARGET_SSE2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
11997 punpcklbw\t{%2, %0|%0, %2}
11998 vpunpcklbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11999 [(set_attr "isa" "noavx,avx")
12000 (set_attr "type" "sselog")
12001 (set_attr "prefix_data16" "1,*")
12002 (set_attr "prefix" "orig,vex")
12003 (set_attr "mode" "TI")])
12005 (define_insn "avx512bw_interleave_highv32hi<mask_name>"
12006 [(set (match_operand:V32HI 0 "register_operand" "=v")
12009 (match_operand:V32HI 1 "register_operand" "v")
12010 (match_operand:V32HI 2 "nonimmediate_operand" "vm"))
12011 (parallel [(const_int 4) (const_int 36)
12012 (const_int 5) (const_int 37)
12013 (const_int 6) (const_int 38)
12014 (const_int 7) (const_int 39)
12015 (const_int 12) (const_int 44)
12016 (const_int 13) (const_int 45)
12017 (const_int 14) (const_int 46)
12018 (const_int 15) (const_int 47)
12019 (const_int 20) (const_int 52)
12020 (const_int 21) (const_int 53)
12021 (const_int 22) (const_int 54)
12022 (const_int 23) (const_int 55)
12023 (const_int 28) (const_int 60)
12024 (const_int 29) (const_int 61)
12025 (const_int 30) (const_int 62)
12026 (const_int 31) (const_int 63)])))]
12028 "vpunpckhwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12029 [(set_attr "type" "sselog")
12030 (set_attr "prefix" "evex")
12031 (set_attr "mode" "XI")])
12033 (define_insn "avx2_interleave_highv16hi<mask_name>"
12034 [(set (match_operand:V16HI 0 "register_operand" "=v")
12037 (match_operand:V16HI 1 "register_operand" "v")
12038 (match_operand:V16HI 2 "nonimmediate_operand" "vm"))
12039 (parallel [(const_int 4) (const_int 20)
12040 (const_int 5) (const_int 21)
12041 (const_int 6) (const_int 22)
12042 (const_int 7) (const_int 23)
12043 (const_int 12) (const_int 28)
12044 (const_int 13) (const_int 29)
12045 (const_int 14) (const_int 30)
12046 (const_int 15) (const_int 31)])))]
12047 "TARGET_AVX2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12048 "vpunpckhwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12049 [(set_attr "type" "sselog")
12050 (set_attr "prefix" "maybe_evex")
12051 (set_attr "mode" "OI")])
12053 (define_insn "vec_interleave_highv8hi<mask_name>"
12054 [(set (match_operand:V8HI 0 "register_operand" "=x,v")
12057 (match_operand:V8HI 1 "register_operand" "0,v")
12058 (match_operand:V8HI 2 "vector_operand" "xBm,vm"))
12059 (parallel [(const_int 4) (const_int 12)
12060 (const_int 5) (const_int 13)
12061 (const_int 6) (const_int 14)
12062 (const_int 7) (const_int 15)])))]
12063 "TARGET_SSE2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12065 punpckhwd\t{%2, %0|%0, %2}
12066 vpunpckhwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12067 [(set_attr "isa" "noavx,avx")
12068 (set_attr "type" "sselog")
12069 (set_attr "prefix_data16" "1,*")
12070 (set_attr "prefix" "orig,maybe_vex")
12071 (set_attr "mode" "TI")])
12073 (define_insn "<mask_codefor>avx512bw_interleave_lowv32hi<mask_name>"
12074 [(set (match_operand:V32HI 0 "register_operand" "=v")
12077 (match_operand:V32HI 1 "register_operand" "v")
12078 (match_operand:V32HI 2 "nonimmediate_operand" "vm"))
12079 (parallel [(const_int 0) (const_int 32)
12080 (const_int 1) (const_int 33)
12081 (const_int 2) (const_int 34)
12082 (const_int 3) (const_int 35)
12083 (const_int 8) (const_int 40)
12084 (const_int 9) (const_int 41)
12085 (const_int 10) (const_int 42)
12086 (const_int 11) (const_int 43)
12087 (const_int 16) (const_int 48)
12088 (const_int 17) (const_int 49)
12089 (const_int 18) (const_int 50)
12090 (const_int 19) (const_int 51)
12091 (const_int 24) (const_int 56)
12092 (const_int 25) (const_int 57)
12093 (const_int 26) (const_int 58)
12094 (const_int 27) (const_int 59)])))]
12096 "vpunpcklwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12097 [(set_attr "type" "sselog")
12098 (set_attr "prefix" "evex")
12099 (set_attr "mode" "XI")])
12101 (define_insn "avx2_interleave_lowv16hi<mask_name>"
12102 [(set (match_operand:V16HI 0 "register_operand" "=v")
12105 (match_operand:V16HI 1 "register_operand" "v")
12106 (match_operand:V16HI 2 "nonimmediate_operand" "vm"))
12107 (parallel [(const_int 0) (const_int 16)
12108 (const_int 1) (const_int 17)
12109 (const_int 2) (const_int 18)
12110 (const_int 3) (const_int 19)
12111 (const_int 8) (const_int 24)
12112 (const_int 9) (const_int 25)
12113 (const_int 10) (const_int 26)
12114 (const_int 11) (const_int 27)])))]
12115 "TARGET_AVX2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12116 "vpunpcklwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12117 [(set_attr "type" "sselog")
12118 (set_attr "prefix" "maybe_evex")
12119 (set_attr "mode" "OI")])
12121 (define_insn "vec_interleave_lowv8hi<mask_name>"
12122 [(set (match_operand:V8HI 0 "register_operand" "=x,v")
12125 (match_operand:V8HI 1 "register_operand" "0,v")
12126 (match_operand:V8HI 2 "vector_operand" "xBm,vm"))
12127 (parallel [(const_int 0) (const_int 8)
12128 (const_int 1) (const_int 9)
12129 (const_int 2) (const_int 10)
12130 (const_int 3) (const_int 11)])))]
12131 "TARGET_SSE2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12133 punpcklwd\t{%2, %0|%0, %2}
12134 vpunpcklwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12135 [(set_attr "isa" "noavx,avx")
12136 (set_attr "type" "sselog")
12137 (set_attr "prefix_data16" "1,*")
12138 (set_attr "prefix" "orig,maybe_evex")
12139 (set_attr "mode" "TI")])
12141 (define_insn "avx2_interleave_highv8si<mask_name>"
12142 [(set (match_operand:V8SI 0 "register_operand" "=v")
12145 (match_operand:V8SI 1 "register_operand" "v")
12146 (match_operand:V8SI 2 "nonimmediate_operand" "vm"))
12147 (parallel [(const_int 2) (const_int 10)
12148 (const_int 3) (const_int 11)
12149 (const_int 6) (const_int 14)
12150 (const_int 7) (const_int 15)])))]
12151 "TARGET_AVX2 && <mask_avx512vl_condition>"
12152 "vpunpckhdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12153 [(set_attr "type" "sselog")
12154 (set_attr "prefix" "maybe_evex")
12155 (set_attr "mode" "OI")])
12157 (define_insn "<mask_codefor>avx512f_interleave_highv16si<mask_name>"
12158 [(set (match_operand:V16SI 0 "register_operand" "=v")
12161 (match_operand:V16SI 1 "register_operand" "v")
12162 (match_operand:V16SI 2 "nonimmediate_operand" "vm"))
12163 (parallel [(const_int 2) (const_int 18)
12164 (const_int 3) (const_int 19)
12165 (const_int 6) (const_int 22)
12166 (const_int 7) (const_int 23)
12167 (const_int 10) (const_int 26)
12168 (const_int 11) (const_int 27)
12169 (const_int 14) (const_int 30)
12170 (const_int 15) (const_int 31)])))]
12172 "vpunpckhdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12173 [(set_attr "type" "sselog")
12174 (set_attr "prefix" "evex")
12175 (set_attr "mode" "XI")])
12178 (define_insn "vec_interleave_highv4si<mask_name>"
12179 [(set (match_operand:V4SI 0 "register_operand" "=x,v")
12182 (match_operand:V4SI 1 "register_operand" "0,v")
12183 (match_operand:V4SI 2 "vector_operand" "xBm,vm"))
12184 (parallel [(const_int 2) (const_int 6)
12185 (const_int 3) (const_int 7)])))]
12186 "TARGET_SSE2 && <mask_avx512vl_condition>"
12188 punpckhdq\t{%2, %0|%0, %2}
12189 vpunpckhdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12190 [(set_attr "isa" "noavx,avx")
12191 (set_attr "type" "sselog")
12192 (set_attr "prefix_data16" "1,*")
12193 (set_attr "prefix" "orig,maybe_vex")
12194 (set_attr "mode" "TI")])
12196 (define_insn "avx2_interleave_lowv8si<mask_name>"
12197 [(set (match_operand:V8SI 0 "register_operand" "=v")
12200 (match_operand:V8SI 1 "register_operand" "v")
12201 (match_operand:V8SI 2 "nonimmediate_operand" "vm"))
12202 (parallel [(const_int 0) (const_int 8)
12203 (const_int 1) (const_int 9)
12204 (const_int 4) (const_int 12)
12205 (const_int 5) (const_int 13)])))]
12206 "TARGET_AVX2 && <mask_avx512vl_condition>"
12207 "vpunpckldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12208 [(set_attr "type" "sselog")
12209 (set_attr "prefix" "maybe_evex")
12210 (set_attr "mode" "OI")])
12212 (define_insn "<mask_codefor>avx512f_interleave_lowv16si<mask_name>"
12213 [(set (match_operand:V16SI 0 "register_operand" "=v")
12216 (match_operand:V16SI 1 "register_operand" "v")
12217 (match_operand:V16SI 2 "nonimmediate_operand" "vm"))
12218 (parallel [(const_int 0) (const_int 16)
12219 (const_int 1) (const_int 17)
12220 (const_int 4) (const_int 20)
12221 (const_int 5) (const_int 21)
12222 (const_int 8) (const_int 24)
12223 (const_int 9) (const_int 25)
12224 (const_int 12) (const_int 28)
12225 (const_int 13) (const_int 29)])))]
12227 "vpunpckldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12228 [(set_attr "type" "sselog")
12229 (set_attr "prefix" "evex")
12230 (set_attr "mode" "XI")])
12232 (define_insn "vec_interleave_lowv4si<mask_name>"
12233 [(set (match_operand:V4SI 0 "register_operand" "=x,v")
12236 (match_operand:V4SI 1 "register_operand" "0,v")
12237 (match_operand:V4SI 2 "vector_operand" "xBm,vm"))
12238 (parallel [(const_int 0) (const_int 4)
12239 (const_int 1) (const_int 5)])))]
12240 "TARGET_SSE2 && <mask_avx512vl_condition>"
12242 punpckldq\t{%2, %0|%0, %2}
12243 vpunpckldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12244 [(set_attr "isa" "noavx,avx")
12245 (set_attr "type" "sselog")
12246 (set_attr "prefix_data16" "1,*")
12247 (set_attr "prefix" "orig,vex")
12248 (set_attr "mode" "TI")])
12250 (define_expand "vec_interleave_high<mode>"
12251 [(match_operand:VI_256 0 "register_operand" "=x")
12252 (match_operand:VI_256 1 "register_operand" "x")
12253 (match_operand:VI_256 2 "nonimmediate_operand" "xm")]
12256 rtx t1 = gen_reg_rtx (<MODE>mode);
12257 rtx t2 = gen_reg_rtx (<MODE>mode);
12258 rtx t3 = gen_reg_rtx (V4DImode);
12259 emit_insn (gen_avx2_interleave_low<mode> (t1, operands[1], operands[2]));
12260 emit_insn (gen_avx2_interleave_high<mode> (t2, operands[1], operands[2]));
12261 emit_insn (gen_avx2_permv2ti (t3, gen_lowpart (V4DImode, t1),
12262 gen_lowpart (V4DImode, t2),
12263 GEN_INT (1 + (3 << 4))));
12264 emit_move_insn (operands[0], gen_lowpart (<MODE>mode, t3));
12268 (define_expand "vec_interleave_low<mode>"
12269 [(match_operand:VI_256 0 "register_operand" "=x")
12270 (match_operand:VI_256 1 "register_operand" "x")
12271 (match_operand:VI_256 2 "nonimmediate_operand" "xm")]
12274 rtx t1 = gen_reg_rtx (<MODE>mode);
12275 rtx t2 = gen_reg_rtx (<MODE>mode);
12276 rtx t3 = gen_reg_rtx (V4DImode);
12277 emit_insn (gen_avx2_interleave_low<mode> (t1, operands[1], operands[2]));
12278 emit_insn (gen_avx2_interleave_high<mode> (t2, operands[1], operands[2]));
12279 emit_insn (gen_avx2_permv2ti (t3, gen_lowpart (V4DImode, t1),
12280 gen_lowpart (V4DImode, t2),
12281 GEN_INT (0 + (2 << 4))));
12282 emit_move_insn (operands[0], gen_lowpart (<MODE>mode, t3));
12286 ;; Modes handled by pinsr patterns.
12287 (define_mode_iterator PINSR_MODE
12288 [(V16QI "TARGET_SSE4_1") V8HI
12289 (V4SI "TARGET_SSE4_1")
12290 (V2DI "TARGET_SSE4_1 && TARGET_64BIT")])
12292 (define_mode_attr sse2p4_1
12293 [(V16QI "sse4_1") (V8HI "sse2")
12294 (V4SI "sse4_1") (V2DI "sse4_1")])
12296 ;; sse4_1_pinsrd must come before sse2_loadld since it is preferred.
12297 (define_insn "<sse2p4_1>_pinsr<ssemodesuffix>"
12298 [(set (match_operand:PINSR_MODE 0 "register_operand" "=x,x,x,x")
12299 (vec_merge:PINSR_MODE
12300 (vec_duplicate:PINSR_MODE
12301 (match_operand:<ssescalarmode> 2 "nonimmediate_operand" "r,m,r,m"))
12302 (match_operand:PINSR_MODE 1 "register_operand" "0,0,x,x")
12303 (match_operand:SI 3 "const_int_operand")))]
12305 && ((unsigned) exact_log2 (INTVAL (operands[3]))
12306 < GET_MODE_NUNITS (<MODE>mode))"
12308 operands[3] = GEN_INT (exact_log2 (INTVAL (operands[3])));
12310 switch (which_alternative)
12313 if (GET_MODE_SIZE (<ssescalarmode>mode) < GET_MODE_SIZE (SImode))
12314 return "pinsr<ssemodesuffix>\t{%3, %k2, %0|%0, %k2, %3}";
12317 return "pinsr<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}";
12319 if (GET_MODE_SIZE (<ssescalarmode>mode) < GET_MODE_SIZE (SImode))
12320 return "vpinsr<ssemodesuffix>\t{%3, %k2, %1, %0|%0, %1, %k2, %3}";
12323 return "vpinsr<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}";
12325 gcc_unreachable ();
12328 [(set_attr "isa" "noavx,noavx,avx,avx")
12329 (set_attr "type" "sselog")
12330 (set (attr "prefix_rex")
12332 (and (not (match_test "TARGET_AVX"))
12333 (eq (const_string "<MODE>mode") (const_string "V2DImode")))
12335 (const_string "*")))
12336 (set (attr "prefix_data16")
12338 (and (not (match_test "TARGET_AVX"))
12339 (eq (const_string "<MODE>mode") (const_string "V8HImode")))
12341 (const_string "*")))
12342 (set (attr "prefix_extra")
12344 (and (not (match_test "TARGET_AVX"))
12345 (eq (const_string "<MODE>mode") (const_string "V8HImode")))
12347 (const_string "1")))
12348 (set_attr "length_immediate" "1")
12349 (set_attr "prefix" "orig,orig,vex,vex")
12350 (set_attr "mode" "TI")])
12352 (define_expand "<extract_type>_vinsert<shuffletype><extract_suf>_mask"
12353 [(match_operand:AVX512_VEC 0 "register_operand")
12354 (match_operand:AVX512_VEC 1 "register_operand")
12355 (match_operand:<ssequartermode> 2 "nonimmediate_operand")
12356 (match_operand:SI 3 "const_0_to_3_operand")
12357 (match_operand:AVX512_VEC 4 "register_operand")
12358 (match_operand:<avx512fmaskmode> 5 "register_operand")]
12362 mask = INTVAL (operands[3]);
12363 selector = GET_MODE_UNIT_SIZE (<MODE>mode) == 4 ?
12364 0xFFFF ^ (0xF000 >> mask * 4)
12365 : 0xFF ^ (0xC0 >> mask * 2);
12366 emit_insn (gen_<extract_type>_vinsert<shuffletype><extract_suf>_1_mask
12367 (operands[0], operands[1], operands[2], GEN_INT (selector),
12368 operands[4], operands[5]));
12372 (define_insn "<mask_codefor><extract_type>_vinsert<shuffletype><extract_suf>_1<mask_name>"
12373 [(set (match_operand:AVX512_VEC 0 "register_operand" "=v")
12374 (vec_merge:AVX512_VEC
12375 (match_operand:AVX512_VEC 1 "register_operand" "v")
12376 (vec_duplicate:AVX512_VEC
12377 (match_operand:<ssequartermode> 2 "nonimmediate_operand" "vm"))
12378 (match_operand:SI 3 "const_int_operand" "n")))]
12382 int selector = INTVAL (operands[3]);
12384 if (selector == 0xFFF || selector == 0x3F)
12386 else if ( selector == 0xF0FF || selector == 0xCF)
12388 else if ( selector == 0xFF0F || selector == 0xF3)
12390 else if ( selector == 0xFFF0 || selector == 0xFC)
12393 gcc_unreachable ();
12395 operands[3] = GEN_INT (mask);
12397 return "vinsert<shuffletype><extract_suf>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3}";
12399 [(set_attr "type" "sselog")
12400 (set_attr "length_immediate" "1")
12401 (set_attr "prefix" "evex")
12402 (set_attr "mode" "<sseinsnmode>")])
12404 (define_expand "<extract_type_2>_vinsert<shuffletype><extract_suf_2>_mask"
12405 [(match_operand:AVX512_VEC_2 0 "register_operand")
12406 (match_operand:AVX512_VEC_2 1 "register_operand")
12407 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand")
12408 (match_operand:SI 3 "const_0_to_1_operand")
12409 (match_operand:AVX512_VEC_2 4 "register_operand")
12410 (match_operand:<avx512fmaskmode> 5 "register_operand")]
12413 int mask = INTVAL (operands[3]);
12415 emit_insn (gen_vec_set_lo_<mode>_mask (operands[0], operands[1],
12416 operands[2], operands[4],
12419 emit_insn (gen_vec_set_hi_<mode>_mask (operands[0], operands[1],
12420 operands[2], operands[4],
12425 (define_insn "vec_set_lo_<mode><mask_name>"
12426 [(set (match_operand:V16FI 0 "register_operand" "=v")
12428 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
12429 (vec_select:<ssehalfvecmode>
12430 (match_operand:V16FI 1 "register_operand" "v")
12431 (parallel [(const_int 8) (const_int 9)
12432 (const_int 10) (const_int 11)
12433 (const_int 12) (const_int 13)
12434 (const_int 14) (const_int 15)]))))]
12436 "vinsert<shuffletype>32x8\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, $0x0}"
12437 [(set_attr "type" "sselog")
12438 (set_attr "length_immediate" "1")
12439 (set_attr "prefix" "evex")
12440 (set_attr "mode" "<sseinsnmode>")])
12442 (define_insn "vec_set_hi_<mode><mask_name>"
12443 [(set (match_operand:V16FI 0 "register_operand" "=v")
12445 (vec_select:<ssehalfvecmode>
12446 (match_operand:V16FI 1 "register_operand" "v")
12447 (parallel [(const_int 0) (const_int 1)
12448 (const_int 2) (const_int 3)
12449 (const_int 4) (const_int 5)
12450 (const_int 6) (const_int 7)]))
12451 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
12453 "vinsert<shuffletype>32x8\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, $0x1}"
12454 [(set_attr "type" "sselog")
12455 (set_attr "length_immediate" "1")
12456 (set_attr "prefix" "evex")
12457 (set_attr "mode" "<sseinsnmode>")])
12459 (define_insn "vec_set_lo_<mode><mask_name>"
12460 [(set (match_operand:V8FI 0 "register_operand" "=v")
12462 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
12463 (vec_select:<ssehalfvecmode>
12464 (match_operand:V8FI 1 "register_operand" "v")
12465 (parallel [(const_int 4) (const_int 5)
12466 (const_int 6) (const_int 7)]))))]
12468 "vinsert<shuffletype>64x4\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, $0x0}"
12469 [(set_attr "type" "sselog")
12470 (set_attr "length_immediate" "1")
12471 (set_attr "prefix" "evex")
12472 (set_attr "mode" "XI")])
12474 (define_insn "vec_set_hi_<mode><mask_name>"
12475 [(set (match_operand:V8FI 0 "register_operand" "=v")
12477 (vec_select:<ssehalfvecmode>
12478 (match_operand:V8FI 1 "register_operand" "v")
12479 (parallel [(const_int 0) (const_int 1)
12480 (const_int 2) (const_int 3)]))
12481 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
12483 "vinsert<shuffletype>64x4\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, $0x1}"
12484 [(set_attr "type" "sselog")
12485 (set_attr "length_immediate" "1")
12486 (set_attr "prefix" "evex")
12487 (set_attr "mode" "XI")])
12489 (define_expand "avx512dq_shuf_<shuffletype>64x2_mask"
12490 [(match_operand:VI8F_256 0 "register_operand")
12491 (match_operand:VI8F_256 1 "register_operand")
12492 (match_operand:VI8F_256 2 "nonimmediate_operand")
12493 (match_operand:SI 3 "const_0_to_3_operand")
12494 (match_operand:VI8F_256 4 "register_operand")
12495 (match_operand:QI 5 "register_operand")]
12498 int mask = INTVAL (operands[3]);
12499 emit_insn (gen_avx512dq_shuf_<shuffletype>64x2_1_mask
12500 (operands[0], operands[1], operands[2],
12501 GEN_INT (((mask >> 0) & 1) * 2 + 0),
12502 GEN_INT (((mask >> 0) & 1) * 2 + 1),
12503 GEN_INT (((mask >> 1) & 1) * 2 + 4),
12504 GEN_INT (((mask >> 1) & 1) * 2 + 5),
12505 operands[4], operands[5]));
12509 (define_insn "<mask_codefor>avx512dq_shuf_<shuffletype>64x2_1<mask_name>"
12510 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
12511 (vec_select:VI8F_256
12512 (vec_concat:<ssedoublemode>
12513 (match_operand:VI8F_256 1 "register_operand" "v")
12514 (match_operand:VI8F_256 2 "nonimmediate_operand" "vm"))
12515 (parallel [(match_operand 3 "const_0_to_3_operand")
12516 (match_operand 4 "const_0_to_3_operand")
12517 (match_operand 5 "const_4_to_7_operand")
12518 (match_operand 6 "const_4_to_7_operand")])))]
12520 && (INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
12521 && INTVAL (operands[5]) == (INTVAL (operands[6]) - 1))"
12524 mask = INTVAL (operands[3]) / 2;
12525 mask |= (INTVAL (operands[5]) - 4) / 2 << 1;
12526 operands[3] = GEN_INT (mask);
12527 return "vshuf<shuffletype>64x2\t{%3, %2, %1, %0<mask_operand7>|%0<mask_operand7>, %1, %2, %3}";
12529 [(set_attr "type" "sselog")
12530 (set_attr "length_immediate" "1")
12531 (set_attr "prefix" "evex")
12532 (set_attr "mode" "XI")])
12534 (define_expand "avx512f_shuf_<shuffletype>64x2_mask"
12535 [(match_operand:V8FI 0 "register_operand")
12536 (match_operand:V8FI 1 "register_operand")
12537 (match_operand:V8FI 2 "nonimmediate_operand")
12538 (match_operand:SI 3 "const_0_to_255_operand")
12539 (match_operand:V8FI 4 "register_operand")
12540 (match_operand:QI 5 "register_operand")]
12543 int mask = INTVAL (operands[3]);
12544 emit_insn (gen_avx512f_shuf_<shuffletype>64x2_1_mask
12545 (operands[0], operands[1], operands[2],
12546 GEN_INT (((mask >> 0) & 3) * 2),
12547 GEN_INT (((mask >> 0) & 3) * 2 + 1),
12548 GEN_INT (((mask >> 2) & 3) * 2),
12549 GEN_INT (((mask >> 2) & 3) * 2 + 1),
12550 GEN_INT (((mask >> 4) & 3) * 2 + 8),
12551 GEN_INT (((mask >> 4) & 3) * 2 + 9),
12552 GEN_INT (((mask >> 6) & 3) * 2 + 8),
12553 GEN_INT (((mask >> 6) & 3) * 2 + 9),
12554 operands[4], operands[5]));
12558 (define_insn "avx512f_shuf_<shuffletype>64x2_1<mask_name>"
12559 [(set (match_operand:V8FI 0 "register_operand" "=v")
12561 (vec_concat:<ssedoublemode>
12562 (match_operand:V8FI 1 "register_operand" "v")
12563 (match_operand:V8FI 2 "nonimmediate_operand" "vm"))
12564 (parallel [(match_operand 3 "const_0_to_7_operand")
12565 (match_operand 4 "const_0_to_7_operand")
12566 (match_operand 5 "const_0_to_7_operand")
12567 (match_operand 6 "const_0_to_7_operand")
12568 (match_operand 7 "const_8_to_15_operand")
12569 (match_operand 8 "const_8_to_15_operand")
12570 (match_operand 9 "const_8_to_15_operand")
12571 (match_operand 10 "const_8_to_15_operand")])))]
12573 && (INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
12574 && INTVAL (operands[5]) == (INTVAL (operands[6]) - 1)
12575 && INTVAL (operands[7]) == (INTVAL (operands[8]) - 1)
12576 && INTVAL (operands[9]) == (INTVAL (operands[10]) - 1))"
12579 mask = INTVAL (operands[3]) / 2;
12580 mask |= INTVAL (operands[5]) / 2 << 2;
12581 mask |= (INTVAL (operands[7]) - 8) / 2 << 4;
12582 mask |= (INTVAL (operands[9]) - 8) / 2 << 6;
12583 operands[3] = GEN_INT (mask);
12585 return "vshuf<shuffletype>64x2\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
12587 [(set_attr "type" "sselog")
12588 (set_attr "length_immediate" "1")
12589 (set_attr "prefix" "evex")
12590 (set_attr "mode" "<sseinsnmode>")])
12592 (define_expand "avx512vl_shuf_<shuffletype>32x4_mask"
12593 [(match_operand:VI4F_256 0 "register_operand")
12594 (match_operand:VI4F_256 1 "register_operand")
12595 (match_operand:VI4F_256 2 "nonimmediate_operand")
12596 (match_operand:SI 3 "const_0_to_3_operand")
12597 (match_operand:VI4F_256 4 "register_operand")
12598 (match_operand:QI 5 "register_operand")]
12601 int mask = INTVAL (operands[3]);
12602 emit_insn (gen_avx512vl_shuf_<shuffletype>32x4_1_mask
12603 (operands[0], operands[1], operands[2],
12604 GEN_INT (((mask >> 0) & 1) * 4 + 0),
12605 GEN_INT (((mask >> 0) & 1) * 4 + 1),
12606 GEN_INT (((mask >> 0) & 1) * 4 + 2),
12607 GEN_INT (((mask >> 0) & 1) * 4 + 3),
12608 GEN_INT (((mask >> 1) & 1) * 4 + 8),
12609 GEN_INT (((mask >> 1) & 1) * 4 + 9),
12610 GEN_INT (((mask >> 1) & 1) * 4 + 10),
12611 GEN_INT (((mask >> 1) & 1) * 4 + 11),
12612 operands[4], operands[5]));
12616 (define_insn "<mask_codefor>avx512vl_shuf_<shuffletype>32x4_1<mask_name>"
12617 [(set (match_operand:VI4F_256 0 "register_operand" "=v")
12618 (vec_select:VI4F_256
12619 (vec_concat:<ssedoublemode>
12620 (match_operand:VI4F_256 1 "register_operand" "v")
12621 (match_operand:VI4F_256 2 "nonimmediate_operand" "vm"))
12622 (parallel [(match_operand 3 "const_0_to_7_operand")
12623 (match_operand 4 "const_0_to_7_operand")
12624 (match_operand 5 "const_0_to_7_operand")
12625 (match_operand 6 "const_0_to_7_operand")
12626 (match_operand 7 "const_8_to_15_operand")
12627 (match_operand 8 "const_8_to_15_operand")
12628 (match_operand 9 "const_8_to_15_operand")
12629 (match_operand 10 "const_8_to_15_operand")])))]
12631 && (INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
12632 && INTVAL (operands[3]) == (INTVAL (operands[5]) - 2)
12633 && INTVAL (operands[3]) == (INTVAL (operands[6]) - 3)
12634 && INTVAL (operands[7]) == (INTVAL (operands[8]) - 1)
12635 && INTVAL (operands[7]) == (INTVAL (operands[9]) - 2)
12636 && INTVAL (operands[7]) == (INTVAL (operands[10]) - 3))"
12639 mask = INTVAL (operands[3]) / 4;
12640 mask |= (INTVAL (operands[7]) - 8) / 4 << 1;
12641 operands[3] = GEN_INT (mask);
12643 return "vshuf<shuffletype>32x4\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
12645 [(set_attr "type" "sselog")
12646 (set_attr "length_immediate" "1")
12647 (set_attr "prefix" "evex")
12648 (set_attr "mode" "<sseinsnmode>")])
12650 (define_expand "avx512f_shuf_<shuffletype>32x4_mask"
12651 [(match_operand:V16FI 0 "register_operand")
12652 (match_operand:V16FI 1 "register_operand")
12653 (match_operand:V16FI 2 "nonimmediate_operand")
12654 (match_operand:SI 3 "const_0_to_255_operand")
12655 (match_operand:V16FI 4 "register_operand")
12656 (match_operand:HI 5 "register_operand")]
12659 int mask = INTVAL (operands[3]);
12660 emit_insn (gen_avx512f_shuf_<shuffletype>32x4_1_mask
12661 (operands[0], operands[1], operands[2],
12662 GEN_INT (((mask >> 0) & 3) * 4),
12663 GEN_INT (((mask >> 0) & 3) * 4 + 1),
12664 GEN_INT (((mask >> 0) & 3) * 4 + 2),
12665 GEN_INT (((mask >> 0) & 3) * 4 + 3),
12666 GEN_INT (((mask >> 2) & 3) * 4),
12667 GEN_INT (((mask >> 2) & 3) * 4 + 1),
12668 GEN_INT (((mask >> 2) & 3) * 4 + 2),
12669 GEN_INT (((mask >> 2) & 3) * 4 + 3),
12670 GEN_INT (((mask >> 4) & 3) * 4 + 16),
12671 GEN_INT (((mask >> 4) & 3) * 4 + 17),
12672 GEN_INT (((mask >> 4) & 3) * 4 + 18),
12673 GEN_INT (((mask >> 4) & 3) * 4 + 19),
12674 GEN_INT (((mask >> 6) & 3) * 4 + 16),
12675 GEN_INT (((mask >> 6) & 3) * 4 + 17),
12676 GEN_INT (((mask >> 6) & 3) * 4 + 18),
12677 GEN_INT (((mask >> 6) & 3) * 4 + 19),
12678 operands[4], operands[5]));
12682 (define_insn "avx512f_shuf_<shuffletype>32x4_1<mask_name>"
12683 [(set (match_operand:V16FI 0 "register_operand" "=v")
12685 (vec_concat:<ssedoublemode>
12686 (match_operand:V16FI 1 "register_operand" "v")
12687 (match_operand:V16FI 2 "nonimmediate_operand" "vm"))
12688 (parallel [(match_operand 3 "const_0_to_15_operand")
12689 (match_operand 4 "const_0_to_15_operand")
12690 (match_operand 5 "const_0_to_15_operand")
12691 (match_operand 6 "const_0_to_15_operand")
12692 (match_operand 7 "const_0_to_15_operand")
12693 (match_operand 8 "const_0_to_15_operand")
12694 (match_operand 9 "const_0_to_15_operand")
12695 (match_operand 10 "const_0_to_15_operand")
12696 (match_operand 11 "const_16_to_31_operand")
12697 (match_operand 12 "const_16_to_31_operand")
12698 (match_operand 13 "const_16_to_31_operand")
12699 (match_operand 14 "const_16_to_31_operand")
12700 (match_operand 15 "const_16_to_31_operand")
12701 (match_operand 16 "const_16_to_31_operand")
12702 (match_operand 17 "const_16_to_31_operand")
12703 (match_operand 18 "const_16_to_31_operand")])))]
12705 && (INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
12706 && INTVAL (operands[3]) == (INTVAL (operands[5]) - 2)
12707 && INTVAL (operands[3]) == (INTVAL (operands[6]) - 3)
12708 && INTVAL (operands[7]) == (INTVAL (operands[8]) - 1)
12709 && INTVAL (operands[7]) == (INTVAL (operands[9]) - 2)
12710 && INTVAL (operands[7]) == (INTVAL (operands[10]) - 3)
12711 && INTVAL (operands[11]) == (INTVAL (operands[12]) - 1)
12712 && INTVAL (operands[11]) == (INTVAL (operands[13]) - 2)
12713 && INTVAL (operands[11]) == (INTVAL (operands[14]) - 3)
12714 && INTVAL (operands[15]) == (INTVAL (operands[16]) - 1)
12715 && INTVAL (operands[15]) == (INTVAL (operands[17]) - 2)
12716 && INTVAL (operands[15]) == (INTVAL (operands[18]) - 3))"
12719 mask = INTVAL (operands[3]) / 4;
12720 mask |= INTVAL (operands[7]) / 4 << 2;
12721 mask |= (INTVAL (operands[11]) - 16) / 4 << 4;
12722 mask |= (INTVAL (operands[15]) - 16) / 4 << 6;
12723 operands[3] = GEN_INT (mask);
12725 return "vshuf<shuffletype>32x4\t{%3, %2, %1, %0<mask_operand19>|%0<mask_operand19>, %1, %2, %3}";
12727 [(set_attr "type" "sselog")
12728 (set_attr "length_immediate" "1")
12729 (set_attr "prefix" "evex")
12730 (set_attr "mode" "<sseinsnmode>")])
12732 (define_expand "avx512f_pshufdv3_mask"
12733 [(match_operand:V16SI 0 "register_operand")
12734 (match_operand:V16SI 1 "nonimmediate_operand")
12735 (match_operand:SI 2 "const_0_to_255_operand")
12736 (match_operand:V16SI 3 "register_operand")
12737 (match_operand:HI 4 "register_operand")]
12740 int mask = INTVAL (operands[2]);
12741 emit_insn (gen_avx512f_pshufd_1_mask (operands[0], operands[1],
12742 GEN_INT ((mask >> 0) & 3),
12743 GEN_INT ((mask >> 2) & 3),
12744 GEN_INT ((mask >> 4) & 3),
12745 GEN_INT ((mask >> 6) & 3),
12746 GEN_INT (((mask >> 0) & 3) + 4),
12747 GEN_INT (((mask >> 2) & 3) + 4),
12748 GEN_INT (((mask >> 4) & 3) + 4),
12749 GEN_INT (((mask >> 6) & 3) + 4),
12750 GEN_INT (((mask >> 0) & 3) + 8),
12751 GEN_INT (((mask >> 2) & 3) + 8),
12752 GEN_INT (((mask >> 4) & 3) + 8),
12753 GEN_INT (((mask >> 6) & 3) + 8),
12754 GEN_INT (((mask >> 0) & 3) + 12),
12755 GEN_INT (((mask >> 2) & 3) + 12),
12756 GEN_INT (((mask >> 4) & 3) + 12),
12757 GEN_INT (((mask >> 6) & 3) + 12),
12758 operands[3], operands[4]));
12762 (define_insn "avx512f_pshufd_1<mask_name>"
12763 [(set (match_operand:V16SI 0 "register_operand" "=v")
12765 (match_operand:V16SI 1 "nonimmediate_operand" "vm")
12766 (parallel [(match_operand 2 "const_0_to_3_operand")
12767 (match_operand 3 "const_0_to_3_operand")
12768 (match_operand 4 "const_0_to_3_operand")
12769 (match_operand 5 "const_0_to_3_operand")
12770 (match_operand 6 "const_4_to_7_operand")
12771 (match_operand 7 "const_4_to_7_operand")
12772 (match_operand 8 "const_4_to_7_operand")
12773 (match_operand 9 "const_4_to_7_operand")
12774 (match_operand 10 "const_8_to_11_operand")
12775 (match_operand 11 "const_8_to_11_operand")
12776 (match_operand 12 "const_8_to_11_operand")
12777 (match_operand 13 "const_8_to_11_operand")
12778 (match_operand 14 "const_12_to_15_operand")
12779 (match_operand 15 "const_12_to_15_operand")
12780 (match_operand 16 "const_12_to_15_operand")
12781 (match_operand 17 "const_12_to_15_operand")])))]
12783 && INTVAL (operands[2]) + 4 == INTVAL (operands[6])
12784 && INTVAL (operands[3]) + 4 == INTVAL (operands[7])
12785 && INTVAL (operands[4]) + 4 == INTVAL (operands[8])
12786 && INTVAL (operands[5]) + 4 == INTVAL (operands[9])
12787 && INTVAL (operands[2]) + 8 == INTVAL (operands[10])
12788 && INTVAL (operands[3]) + 8 == INTVAL (operands[11])
12789 && INTVAL (operands[4]) + 8 == INTVAL (operands[12])
12790 && INTVAL (operands[5]) + 8 == INTVAL (operands[13])
12791 && INTVAL (operands[2]) + 12 == INTVAL (operands[14])
12792 && INTVAL (operands[3]) + 12 == INTVAL (operands[15])
12793 && INTVAL (operands[4]) + 12 == INTVAL (operands[16])
12794 && INTVAL (operands[5]) + 12 == INTVAL (operands[17])"
12797 mask |= INTVAL (operands[2]) << 0;
12798 mask |= INTVAL (operands[3]) << 2;
12799 mask |= INTVAL (operands[4]) << 4;
12800 mask |= INTVAL (operands[5]) << 6;
12801 operands[2] = GEN_INT (mask);
12803 return "vpshufd\t{%2, %1, %0<mask_operand18>|%0<mask_operand18>, %1, %2}";
12805 [(set_attr "type" "sselog1")
12806 (set_attr "prefix" "evex")
12807 (set_attr "length_immediate" "1")
12808 (set_attr "mode" "XI")])
12810 (define_expand "avx512vl_pshufdv3_mask"
12811 [(match_operand:V8SI 0 "register_operand")
12812 (match_operand:V8SI 1 "nonimmediate_operand")
12813 (match_operand:SI 2 "const_0_to_255_operand")
12814 (match_operand:V8SI 3 "register_operand")
12815 (match_operand:QI 4 "register_operand")]
12818 int mask = INTVAL (operands[2]);
12819 emit_insn (gen_avx2_pshufd_1_mask (operands[0], operands[1],
12820 GEN_INT ((mask >> 0) & 3),
12821 GEN_INT ((mask >> 2) & 3),
12822 GEN_INT ((mask >> 4) & 3),
12823 GEN_INT ((mask >> 6) & 3),
12824 GEN_INT (((mask >> 0) & 3) + 4),
12825 GEN_INT (((mask >> 2) & 3) + 4),
12826 GEN_INT (((mask >> 4) & 3) + 4),
12827 GEN_INT (((mask >> 6) & 3) + 4),
12828 operands[3], operands[4]));
12832 (define_expand "avx2_pshufdv3"
12833 [(match_operand:V8SI 0 "register_operand")
12834 (match_operand:V8SI 1 "nonimmediate_operand")
12835 (match_operand:SI 2 "const_0_to_255_operand")]
12838 int mask = INTVAL (operands[2]);
12839 emit_insn (gen_avx2_pshufd_1 (operands[0], operands[1],
12840 GEN_INT ((mask >> 0) & 3),
12841 GEN_INT ((mask >> 2) & 3),
12842 GEN_INT ((mask >> 4) & 3),
12843 GEN_INT ((mask >> 6) & 3),
12844 GEN_INT (((mask >> 0) & 3) + 4),
12845 GEN_INT (((mask >> 2) & 3) + 4),
12846 GEN_INT (((mask >> 4) & 3) + 4),
12847 GEN_INT (((mask >> 6) & 3) + 4)));
12851 (define_insn "avx2_pshufd_1<mask_name>"
12852 [(set (match_operand:V8SI 0 "register_operand" "=v")
12854 (match_operand:V8SI 1 "nonimmediate_operand" "vm")
12855 (parallel [(match_operand 2 "const_0_to_3_operand")
12856 (match_operand 3 "const_0_to_3_operand")
12857 (match_operand 4 "const_0_to_3_operand")
12858 (match_operand 5 "const_0_to_3_operand")
12859 (match_operand 6 "const_4_to_7_operand")
12860 (match_operand 7 "const_4_to_7_operand")
12861 (match_operand 8 "const_4_to_7_operand")
12862 (match_operand 9 "const_4_to_7_operand")])))]
12864 && <mask_avx512vl_condition>
12865 && INTVAL (operands[2]) + 4 == INTVAL (operands[6])
12866 && INTVAL (operands[3]) + 4 == INTVAL (operands[7])
12867 && INTVAL (operands[4]) + 4 == INTVAL (operands[8])
12868 && INTVAL (operands[5]) + 4 == INTVAL (operands[9])"
12871 mask |= INTVAL (operands[2]) << 0;
12872 mask |= INTVAL (operands[3]) << 2;
12873 mask |= INTVAL (operands[4]) << 4;
12874 mask |= INTVAL (operands[5]) << 6;
12875 operands[2] = GEN_INT (mask);
12877 return "vpshufd\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
12879 [(set_attr "type" "sselog1")
12880 (set_attr "prefix" "maybe_evex")
12881 (set_attr "length_immediate" "1")
12882 (set_attr "mode" "OI")])
12884 (define_expand "avx512vl_pshufd_mask"
12885 [(match_operand:V4SI 0 "register_operand")
12886 (match_operand:V4SI 1 "nonimmediate_operand")
12887 (match_operand:SI 2 "const_0_to_255_operand")
12888 (match_operand:V4SI 3 "register_operand")
12889 (match_operand:QI 4 "register_operand")]
12892 int mask = INTVAL (operands[2]);
12893 emit_insn (gen_sse2_pshufd_1_mask (operands[0], operands[1],
12894 GEN_INT ((mask >> 0) & 3),
12895 GEN_INT ((mask >> 2) & 3),
12896 GEN_INT ((mask >> 4) & 3),
12897 GEN_INT ((mask >> 6) & 3),
12898 operands[3], operands[4]));
12902 (define_expand "sse2_pshufd"
12903 [(match_operand:V4SI 0 "register_operand")
12904 (match_operand:V4SI 1 "vector_operand")
12905 (match_operand:SI 2 "const_int_operand")]
12908 int mask = INTVAL (operands[2]);
12909 emit_insn (gen_sse2_pshufd_1 (operands[0], operands[1],
12910 GEN_INT ((mask >> 0) & 3),
12911 GEN_INT ((mask >> 2) & 3),
12912 GEN_INT ((mask >> 4) & 3),
12913 GEN_INT ((mask >> 6) & 3)));
12917 (define_insn "sse2_pshufd_1<mask_name>"
12918 [(set (match_operand:V4SI 0 "register_operand" "=v")
12920 (match_operand:V4SI 1 "vector_operand" "vBm")
12921 (parallel [(match_operand 2 "const_0_to_3_operand")
12922 (match_operand 3 "const_0_to_3_operand")
12923 (match_operand 4 "const_0_to_3_operand")
12924 (match_operand 5 "const_0_to_3_operand")])))]
12925 "TARGET_SSE2 && <mask_avx512vl_condition>"
12928 mask |= INTVAL (operands[2]) << 0;
12929 mask |= INTVAL (operands[3]) << 2;
12930 mask |= INTVAL (operands[4]) << 4;
12931 mask |= INTVAL (operands[5]) << 6;
12932 operands[2] = GEN_INT (mask);
12934 return "%vpshufd\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
12936 [(set_attr "type" "sselog1")
12937 (set_attr "prefix_data16" "1")
12938 (set_attr "prefix" "<mask_prefix2>")
12939 (set_attr "length_immediate" "1")
12940 (set_attr "mode" "TI")])
12942 (define_insn "<mask_codefor>avx512bw_pshuflwv32hi<mask_name>"
12943 [(set (match_operand:V32HI 0 "register_operand" "=v")
12945 [(match_operand:V32HI 1 "nonimmediate_operand" "vm")
12946 (match_operand:SI 2 "const_0_to_255_operand" "n")]
12949 "vpshuflw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12950 [(set_attr "type" "sselog")
12951 (set_attr "prefix" "evex")
12952 (set_attr "mode" "XI")])
12954 (define_expand "avx512vl_pshuflwv3_mask"
12955 [(match_operand:V16HI 0 "register_operand")
12956 (match_operand:V16HI 1 "nonimmediate_operand")
12957 (match_operand:SI 2 "const_0_to_255_operand")
12958 (match_operand:V16HI 3 "register_operand")
12959 (match_operand:HI 4 "register_operand")]
12960 "TARGET_AVX512VL && TARGET_AVX512BW"
12962 int mask = INTVAL (operands[2]);
12963 emit_insn (gen_avx2_pshuflw_1_mask (operands[0], operands[1],
12964 GEN_INT ((mask >> 0) & 3),
12965 GEN_INT ((mask >> 2) & 3),
12966 GEN_INT ((mask >> 4) & 3),
12967 GEN_INT ((mask >> 6) & 3),
12968 GEN_INT (((mask >> 0) & 3) + 8),
12969 GEN_INT (((mask >> 2) & 3) + 8),
12970 GEN_INT (((mask >> 4) & 3) + 8),
12971 GEN_INT (((mask >> 6) & 3) + 8),
12972 operands[3], operands[4]));
12976 (define_expand "avx2_pshuflwv3"
12977 [(match_operand:V16HI 0 "register_operand")
12978 (match_operand:V16HI 1 "nonimmediate_operand")
12979 (match_operand:SI 2 "const_0_to_255_operand")]
12982 int mask = INTVAL (operands[2]);
12983 emit_insn (gen_avx2_pshuflw_1 (operands[0], operands[1],
12984 GEN_INT ((mask >> 0) & 3),
12985 GEN_INT ((mask >> 2) & 3),
12986 GEN_INT ((mask >> 4) & 3),
12987 GEN_INT ((mask >> 6) & 3),
12988 GEN_INT (((mask >> 0) & 3) + 8),
12989 GEN_INT (((mask >> 2) & 3) + 8),
12990 GEN_INT (((mask >> 4) & 3) + 8),
12991 GEN_INT (((mask >> 6) & 3) + 8)));
12995 (define_insn "avx2_pshuflw_1<mask_name>"
12996 [(set (match_operand:V16HI 0 "register_operand" "=v")
12998 (match_operand:V16HI 1 "nonimmediate_operand" "vm")
12999 (parallel [(match_operand 2 "const_0_to_3_operand")
13000 (match_operand 3 "const_0_to_3_operand")
13001 (match_operand 4 "const_0_to_3_operand")
13002 (match_operand 5 "const_0_to_3_operand")
13007 (match_operand 6 "const_8_to_11_operand")
13008 (match_operand 7 "const_8_to_11_operand")
13009 (match_operand 8 "const_8_to_11_operand")
13010 (match_operand 9 "const_8_to_11_operand")
13014 (const_int 15)])))]
13016 && <mask_avx512bw_condition> && <mask_avx512vl_condition>
13017 && INTVAL (operands[2]) + 8 == INTVAL (operands[6])
13018 && INTVAL (operands[3]) + 8 == INTVAL (operands[7])
13019 && INTVAL (operands[4]) + 8 == INTVAL (operands[8])
13020 && INTVAL (operands[5]) + 8 == INTVAL (operands[9])"
13023 mask |= INTVAL (operands[2]) << 0;
13024 mask |= INTVAL (operands[3]) << 2;
13025 mask |= INTVAL (operands[4]) << 4;
13026 mask |= INTVAL (operands[5]) << 6;
13027 operands[2] = GEN_INT (mask);
13029 return "vpshuflw\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
13031 [(set_attr "type" "sselog")
13032 (set_attr "prefix" "maybe_evex")
13033 (set_attr "length_immediate" "1")
13034 (set_attr "mode" "OI")])
13036 (define_expand "avx512vl_pshuflw_mask"
13037 [(match_operand:V8HI 0 "register_operand")
13038 (match_operand:V8HI 1 "nonimmediate_operand")
13039 (match_operand:SI 2 "const_0_to_255_operand")
13040 (match_operand:V8HI 3 "register_operand")
13041 (match_operand:QI 4 "register_operand")]
13042 "TARGET_AVX512VL && TARGET_AVX512BW"
13044 int mask = INTVAL (operands[2]);
13045 emit_insn (gen_sse2_pshuflw_1_mask (operands[0], operands[1],
13046 GEN_INT ((mask >> 0) & 3),
13047 GEN_INT ((mask >> 2) & 3),
13048 GEN_INT ((mask >> 4) & 3),
13049 GEN_INT ((mask >> 6) & 3),
13050 operands[3], operands[4]));
13054 (define_expand "sse2_pshuflw"
13055 [(match_operand:V8HI 0 "register_operand")
13056 (match_operand:V8HI 1 "vector_operand")
13057 (match_operand:SI 2 "const_int_operand")]
13060 int mask = INTVAL (operands[2]);
13061 emit_insn (gen_sse2_pshuflw_1 (operands[0], operands[1],
13062 GEN_INT ((mask >> 0) & 3),
13063 GEN_INT ((mask >> 2) & 3),
13064 GEN_INT ((mask >> 4) & 3),
13065 GEN_INT ((mask >> 6) & 3)));
13069 (define_insn "sse2_pshuflw_1<mask_name>"
13070 [(set (match_operand:V8HI 0 "register_operand" "=v")
13072 (match_operand:V8HI 1 "vector_operand" "vBm")
13073 (parallel [(match_operand 2 "const_0_to_3_operand")
13074 (match_operand 3 "const_0_to_3_operand")
13075 (match_operand 4 "const_0_to_3_operand")
13076 (match_operand 5 "const_0_to_3_operand")
13081 "TARGET_SSE2 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
13084 mask |= INTVAL (operands[2]) << 0;
13085 mask |= INTVAL (operands[3]) << 2;
13086 mask |= INTVAL (operands[4]) << 4;
13087 mask |= INTVAL (operands[5]) << 6;
13088 operands[2] = GEN_INT (mask);
13090 return "%vpshuflw\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
13092 [(set_attr "type" "sselog")
13093 (set_attr "prefix_data16" "0")
13094 (set_attr "prefix_rep" "1")
13095 (set_attr "prefix" "maybe_vex")
13096 (set_attr "length_immediate" "1")
13097 (set_attr "mode" "TI")])
13099 (define_expand "avx2_pshufhwv3"
13100 [(match_operand:V16HI 0 "register_operand")
13101 (match_operand:V16HI 1 "nonimmediate_operand")
13102 (match_operand:SI 2 "const_0_to_255_operand")]
13105 int mask = INTVAL (operands[2]);
13106 emit_insn (gen_avx2_pshufhw_1 (operands[0], operands[1],
13107 GEN_INT (((mask >> 0) & 3) + 4),
13108 GEN_INT (((mask >> 2) & 3) + 4),
13109 GEN_INT (((mask >> 4) & 3) + 4),
13110 GEN_INT (((mask >> 6) & 3) + 4),
13111 GEN_INT (((mask >> 0) & 3) + 12),
13112 GEN_INT (((mask >> 2) & 3) + 12),
13113 GEN_INT (((mask >> 4) & 3) + 12),
13114 GEN_INT (((mask >> 6) & 3) + 12)));
13118 (define_insn "<mask_codefor>avx512bw_pshufhwv32hi<mask_name>"
13119 [(set (match_operand:V32HI 0 "register_operand" "=v")
13121 [(match_operand:V32HI 1 "nonimmediate_operand" "vm")
13122 (match_operand:SI 2 "const_0_to_255_operand" "n")]
13125 "vpshufhw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13126 [(set_attr "type" "sselog")
13127 (set_attr "prefix" "evex")
13128 (set_attr "mode" "XI")])
13130 (define_expand "avx512vl_pshufhwv3_mask"
13131 [(match_operand:V16HI 0 "register_operand")
13132 (match_operand:V16HI 1 "nonimmediate_operand")
13133 (match_operand:SI 2 "const_0_to_255_operand")
13134 (match_operand:V16HI 3 "register_operand")
13135 (match_operand:HI 4 "register_operand")]
13136 "TARGET_AVX512VL && TARGET_AVX512BW"
13138 int mask = INTVAL (operands[2]);
13139 emit_insn (gen_avx2_pshufhw_1_mask (operands[0], operands[1],
13140 GEN_INT (((mask >> 0) & 3) + 4),
13141 GEN_INT (((mask >> 2) & 3) + 4),
13142 GEN_INT (((mask >> 4) & 3) + 4),
13143 GEN_INT (((mask >> 6) & 3) + 4),
13144 GEN_INT (((mask >> 0) & 3) + 12),
13145 GEN_INT (((mask >> 2) & 3) + 12),
13146 GEN_INT (((mask >> 4) & 3) + 12),
13147 GEN_INT (((mask >> 6) & 3) + 12),
13148 operands[3], operands[4]));
13152 (define_insn "avx2_pshufhw_1<mask_name>"
13153 [(set (match_operand:V16HI 0 "register_operand" "=v")
13155 (match_operand:V16HI 1 "nonimmediate_operand" "vm")
13156 (parallel [(const_int 0)
13160 (match_operand 2 "const_4_to_7_operand")
13161 (match_operand 3 "const_4_to_7_operand")
13162 (match_operand 4 "const_4_to_7_operand")
13163 (match_operand 5 "const_4_to_7_operand")
13168 (match_operand 6 "const_12_to_15_operand")
13169 (match_operand 7 "const_12_to_15_operand")
13170 (match_operand 8 "const_12_to_15_operand")
13171 (match_operand 9 "const_12_to_15_operand")])))]
13173 && <mask_avx512bw_condition> && <mask_avx512vl_condition>
13174 && INTVAL (operands[2]) + 8 == INTVAL (operands[6])
13175 && INTVAL (operands[3]) + 8 == INTVAL (operands[7])
13176 && INTVAL (operands[4]) + 8 == INTVAL (operands[8])
13177 && INTVAL (operands[5]) + 8 == INTVAL (operands[9])"
13180 mask |= (INTVAL (operands[2]) - 4) << 0;
13181 mask |= (INTVAL (operands[3]) - 4) << 2;
13182 mask |= (INTVAL (operands[4]) - 4) << 4;
13183 mask |= (INTVAL (operands[5]) - 4) << 6;
13184 operands[2] = GEN_INT (mask);
13186 return "vpshufhw\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
13188 [(set_attr "type" "sselog")
13189 (set_attr "prefix" "maybe_evex")
13190 (set_attr "length_immediate" "1")
13191 (set_attr "mode" "OI")])
13193 (define_expand "avx512vl_pshufhw_mask"
13194 [(match_operand:V8HI 0 "register_operand")
13195 (match_operand:V8HI 1 "nonimmediate_operand")
13196 (match_operand:SI 2 "const_0_to_255_operand")
13197 (match_operand:V8HI 3 "register_operand")
13198 (match_operand:QI 4 "register_operand")]
13199 "TARGET_AVX512VL && TARGET_AVX512BW"
13201 int mask = INTVAL (operands[2]);
13202 emit_insn (gen_sse2_pshufhw_1_mask (operands[0], operands[1],
13203 GEN_INT (((mask >> 0) & 3) + 4),
13204 GEN_INT (((mask >> 2) & 3) + 4),
13205 GEN_INT (((mask >> 4) & 3) + 4),
13206 GEN_INT (((mask >> 6) & 3) + 4),
13207 operands[3], operands[4]));
13211 (define_expand "sse2_pshufhw"
13212 [(match_operand:V8HI 0 "register_operand")
13213 (match_operand:V8HI 1 "vector_operand")
13214 (match_operand:SI 2 "const_int_operand")]
13217 int mask = INTVAL (operands[2]);
13218 emit_insn (gen_sse2_pshufhw_1 (operands[0], operands[1],
13219 GEN_INT (((mask >> 0) & 3) + 4),
13220 GEN_INT (((mask >> 2) & 3) + 4),
13221 GEN_INT (((mask >> 4) & 3) + 4),
13222 GEN_INT (((mask >> 6) & 3) + 4)));
13226 (define_insn "sse2_pshufhw_1<mask_name>"
13227 [(set (match_operand:V8HI 0 "register_operand" "=v")
13229 (match_operand:V8HI 1 "vector_operand" "vBm")
13230 (parallel [(const_int 0)
13234 (match_operand 2 "const_4_to_7_operand")
13235 (match_operand 3 "const_4_to_7_operand")
13236 (match_operand 4 "const_4_to_7_operand")
13237 (match_operand 5 "const_4_to_7_operand")])))]
13238 "TARGET_SSE2 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
13241 mask |= (INTVAL (operands[2]) - 4) << 0;
13242 mask |= (INTVAL (operands[3]) - 4) << 2;
13243 mask |= (INTVAL (operands[4]) - 4) << 4;
13244 mask |= (INTVAL (operands[5]) - 4) << 6;
13245 operands[2] = GEN_INT (mask);
13247 return "%vpshufhw\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
13249 [(set_attr "type" "sselog")
13250 (set_attr "prefix_rep" "1")
13251 (set_attr "prefix_data16" "0")
13252 (set_attr "prefix" "maybe_vex")
13253 (set_attr "length_immediate" "1")
13254 (set_attr "mode" "TI")])
13256 (define_expand "sse2_loadd"
13257 [(set (match_operand:V4SI 0 "register_operand")
13259 (vec_duplicate:V4SI
13260 (match_operand:SI 1 "nonimmediate_operand"))
13264 "operands[2] = CONST0_RTX (V4SImode);")
13266 (define_insn "sse2_loadld"
13267 [(set (match_operand:V4SI 0 "register_operand" "=x,Yi,x,x,x")
13269 (vec_duplicate:V4SI
13270 (match_operand:SI 2 "nonimmediate_operand" "m ,r ,m,x,x"))
13271 (match_operand:V4SI 1 "reg_or_0_operand" "C ,C ,C,0,x")
13275 %vmovd\t{%2, %0|%0, %2}
13276 %vmovd\t{%2, %0|%0, %2}
13277 movss\t{%2, %0|%0, %2}
13278 movss\t{%2, %0|%0, %2}
13279 vmovss\t{%2, %1, %0|%0, %1, %2}"
13280 [(set_attr "isa" "sse2,sse2,noavx,noavx,avx")
13281 (set_attr "type" "ssemov")
13282 (set_attr "prefix" "maybe_vex,maybe_vex,orig,orig,vex")
13283 (set_attr "mode" "TI,TI,V4SF,SF,SF")])
13285 ;; QI and HI modes handled by pextr patterns.
13286 (define_mode_iterator PEXTR_MODE12
13287 [(V16QI "TARGET_SSE4_1") V8HI])
13289 (define_insn "*vec_extract<mode>"
13290 [(set (match_operand:<ssescalarmode> 0 "register_sse4nonimm_operand" "=r,m")
13291 (vec_select:<ssescalarmode>
13292 (match_operand:PEXTR_MODE12 1 "register_operand" "x,x")
13294 [(match_operand:SI 2 "const_0_to_<ssescalarnummask>_operand")])))]
13297 %vpextr<ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}
13298 %vpextr<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
13299 [(set_attr "isa" "*,sse4")
13300 (set_attr "type" "sselog1")
13301 (set_attr "prefix_data16" "1")
13302 (set (attr "prefix_extra")
13304 (and (eq_attr "alternative" "0")
13305 (eq (const_string "<MODE>mode") (const_string "V8HImode")))
13307 (const_string "1")))
13308 (set_attr "length_immediate" "1")
13309 (set_attr "prefix" "maybe_vex")
13310 (set_attr "mode" "TI")])
13312 (define_insn "*vec_extract<PEXTR_MODE12:mode>_zext"
13313 [(set (match_operand:SWI48 0 "register_operand" "=r")
13315 (vec_select:<PEXTR_MODE12:ssescalarmode>
13316 (match_operand:PEXTR_MODE12 1 "register_operand" "x")
13318 [(match_operand:SI 2
13319 "const_0_to_<PEXTR_MODE12:ssescalarnummask>_operand")]))))]
13321 "%vpextr<PEXTR_MODE12:ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}"
13322 [(set_attr "type" "sselog1")
13323 (set_attr "prefix_data16" "1")
13324 (set (attr "prefix_extra")
13326 (eq (const_string "<PEXTR_MODE12:MODE>mode") (const_string "V8HImode"))
13328 (const_string "1")))
13329 (set_attr "length_immediate" "1")
13330 (set_attr "prefix" "maybe_vex")
13331 (set_attr "mode" "TI")])
13333 (define_insn "*vec_extract<mode>_mem"
13334 [(set (match_operand:<ssescalarmode> 0 "register_operand" "=r")
13335 (vec_select:<ssescalarmode>
13336 (match_operand:VI12_128 1 "memory_operand" "o")
13338 [(match_operand 2 "const_0_to_<ssescalarnummask>_operand")])))]
13342 (define_insn "*vec_extract<ssevecmodelower>_0"
13343 [(set (match_operand:SWI48 0 "nonimmediate_operand" "=r ,r,x ,m")
13345 (match_operand:<ssevecmode> 1 "nonimmediate_operand" "mYj,x,xm,x")
13346 (parallel [(const_int 0)])))]
13347 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
13349 [(set_attr "isa" "*,sse4,*,*")])
13351 (define_insn_and_split "*vec_extractv4si_0_zext"
13352 [(set (match_operand:DI 0 "register_operand" "=r")
13355 (match_operand:V4SI 1 "register_operand" "x")
13356 (parallel [(const_int 0)]))))]
13357 "TARGET_64BIT && TARGET_SSE2 && TARGET_INTER_UNIT_MOVES_FROM_VEC"
13359 "&& reload_completed"
13360 [(set (match_dup 0) (zero_extend:DI (match_dup 1)))]
13361 "operands[1] = gen_rtx_REG (SImode, REGNO (operands[1]));")
13363 (define_insn "*vec_extractv2di_0_sse"
13364 [(set (match_operand:DI 0 "nonimmediate_operand" "=x,m")
13366 (match_operand:V2DI 1 "nonimmediate_operand" "xm,x")
13367 (parallel [(const_int 0)])))]
13368 "TARGET_SSE && !TARGET_64BIT
13369 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
13373 [(set (match_operand:SWI48x 0 "nonimmediate_operand")
13375 (match_operand:<ssevecmode> 1 "register_operand")
13376 (parallel [(const_int 0)])))]
13377 "TARGET_SSE && reload_completed"
13378 [(set (match_dup 0) (match_dup 1))]
13379 "operands[1] = gen_rtx_REG (<MODE>mode, REGNO (operands[1]));")
13381 (define_insn "*vec_extractv4si"
13382 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,Yr,*x,x")
13384 (match_operand:V4SI 1 "register_operand" "x,0,0,x")
13385 (parallel [(match_operand:SI 2 "const_0_to_3_operand")])))]
13388 switch (which_alternative)
13391 return "%vpextrd\t{%2, %1, %0|%0, %1, %2}";
13395 operands [2] = GEN_INT (INTVAL (operands[2]) * 4);
13396 return "psrldq\t{%2, %0|%0, %2}";
13399 operands [2] = GEN_INT (INTVAL (operands[2]) * 4);
13400 return "vpsrldq\t{%2, %1, %0|%0, %1, %2}";
13403 gcc_unreachable ();
13406 [(set_attr "isa" "*,noavx,noavx,avx")
13407 (set_attr "type" "sselog1,sseishft1,sseishft1,sseishft1")
13408 (set_attr "prefix_extra" "1,*,*,*")
13409 (set_attr "length_immediate" "1")
13410 (set_attr "prefix" "maybe_vex,orig,orig,vex")
13411 (set_attr "mode" "TI")])
13413 (define_insn "*vec_extractv4si_zext"
13414 [(set (match_operand:DI 0 "register_operand" "=r")
13417 (match_operand:V4SI 1 "register_operand" "x")
13418 (parallel [(match_operand:SI 2 "const_0_to_3_operand")]))))]
13419 "TARGET_64BIT && TARGET_SSE4_1"
13420 "%vpextrd\t{%2, %1, %k0|%k0, %1, %2}"
13421 [(set_attr "type" "sselog1")
13422 (set_attr "prefix_extra" "1")
13423 (set_attr "length_immediate" "1")
13424 (set_attr "prefix" "maybe_vex")
13425 (set_attr "mode" "TI")])
13427 (define_insn "*vec_extractv4si_mem"
13428 [(set (match_operand:SI 0 "register_operand" "=x,r")
13430 (match_operand:V4SI 1 "memory_operand" "o,o")
13431 (parallel [(match_operand 2 "const_0_to_3_operand")])))]
13435 (define_insn_and_split "*vec_extractv4si_zext_mem"
13436 [(set (match_operand:DI 0 "register_operand" "=x,r")
13439 (match_operand:V4SI 1 "memory_operand" "o,o")
13440 (parallel [(match_operand:SI 2 "const_0_to_3_operand")]))))]
13441 "TARGET_64BIT && TARGET_SSE"
13443 "&& reload_completed"
13444 [(set (match_dup 0) (zero_extend:DI (match_dup 1)))]
13446 operands[1] = adjust_address (operands[1], SImode, INTVAL (operands[2]) * 4);
13449 (define_insn "*vec_extractv2di_1"
13450 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,m,x,x,x,x,r")
13452 (match_operand:V2DI 1 "nonimmediate_operand" "x ,x,0,x,x,o,o")
13453 (parallel [(const_int 1)])))]
13454 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
13456 %vpextrq\t{$1, %1, %0|%0, %1, 1}
13457 %vmovhps\t{%1, %0|%0, %1}
13458 psrldq\t{$8, %0|%0, 8}
13459 vpsrldq\t{$8, %1, %0|%0, %1, 8}
13460 movhlps\t{%1, %0|%0, %1}
13463 [(set_attr "isa" "x64_sse4,*,sse2_noavx,avx,noavx,*,x64")
13464 (set_attr "type" "sselog1,ssemov,sseishft1,sseishft1,ssemov,ssemov,imov")
13465 (set_attr "length_immediate" "1,*,1,1,*,*,*")
13466 (set_attr "prefix_rex" "1,*,*,*,*,*,*")
13467 (set_attr "prefix_extra" "1,*,*,*,*,*,*")
13468 (set_attr "prefix" "maybe_vex,maybe_vex,orig,vex,orig,*,*")
13469 (set_attr "mode" "TI,V2SF,TI,TI,V4SF,DI,DI")])
13472 [(set (match_operand:<ssescalarmode> 0 "register_operand")
13473 (vec_select:<ssescalarmode>
13474 (match_operand:VI_128 1 "memory_operand")
13476 [(match_operand 2 "const_0_to_<ssescalarnummask>_operand")])))]
13477 "TARGET_SSE && reload_completed"
13478 [(set (match_dup 0) (match_dup 1))]
13480 int offs = INTVAL (operands[2]) * GET_MODE_SIZE (<ssescalarmode>mode);
13482 operands[1] = adjust_address (operands[1], <ssescalarmode>mode, offs);
13485 ;; Turn SImode or DImode extraction from arbitrary SSE/AVX/AVX512F
13486 ;; vector modes into vec_extract*.
13488 [(set (match_operand:SWI48x 0 "nonimmediate_operand")
13489 (match_operand:SWI48x 1 "register_operand"))]
13490 "can_create_pseudo_p ()
13491 && SUBREG_P (operands[1])
13492 && REG_P (SUBREG_REG (operands[1]))
13493 && (GET_MODE_CLASS (GET_MODE (SUBREG_REG (operands[1]))) == MODE_VECTOR_INT
13494 || (GET_MODE_CLASS (GET_MODE (SUBREG_REG (operands[1])))
13495 == MODE_VECTOR_FLOAT))
13496 && SUBREG_BYTE (operands[1]) == 0
13498 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[1]))) == 16
13499 || (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[1]))) == 32
13501 || (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[1]))) == 64
13502 && TARGET_AVX512F))
13503 && (<MODE>mode == SImode || TARGET_64BIT || MEM_P (operands[0]))"
13504 [(set (match_dup 0) (vec_select:SWI48x (match_dup 1)
13505 (parallel [(const_int 0)])))]
13508 operands[1] = SUBREG_REG (operands[1]);
13509 switch (GET_MODE_SIZE (GET_MODE (operands[1])))
13512 if (<MODE>mode == SImode)
13514 tmp = gen_reg_rtx (V8SImode);
13515 emit_insn (gen_vec_extract_lo_v16si (tmp,
13516 gen_lowpart (V16SImode,
13521 tmp = gen_reg_rtx (V4DImode);
13522 emit_insn (gen_vec_extract_lo_v8di (tmp,
13523 gen_lowpart (V8DImode,
13529 tmp = gen_reg_rtx (<ssevecmode>mode);
13530 if (<MODE>mode == SImode)
13531 emit_insn (gen_vec_extract_lo_v8si (tmp, gen_lowpart (V8SImode,
13534 emit_insn (gen_vec_extract_lo_v4di (tmp, gen_lowpart (V4DImode,
13539 operands[1] = gen_lowpart (<ssevecmode>mode, operands[1]);
13544 (define_insn "*vec_concatv2si_sse4_1"
13545 [(set (match_operand:V2SI 0 "register_operand"
13546 "=Yr,*x,x, Yr,*x,x, x, *y,*y")
13548 (match_operand:SI 1 "nonimmediate_operand"
13549 " 0, 0,x, 0,0, x,rm, 0,rm")
13550 (match_operand:SI 2 "vector_move_operand"
13551 " rm,rm,rm,Yr,*x,x, C,*ym, C")))]
13552 "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
13554 pinsrd\t{$1, %2, %0|%0, %2, 1}
13555 pinsrd\t{$1, %2, %0|%0, %2, 1}
13556 vpinsrd\t{$1, %2, %1, %0|%0, %1, %2, 1}
13557 punpckldq\t{%2, %0|%0, %2}
13558 punpckldq\t{%2, %0|%0, %2}
13559 vpunpckldq\t{%2, %1, %0|%0, %1, %2}
13560 %vmovd\t{%1, %0|%0, %1}
13561 punpckldq\t{%2, %0|%0, %2}
13562 movd\t{%1, %0|%0, %1}"
13563 [(set_attr "isa" "noavx,noavx,avx,noavx,noavx,avx,*,*,*")
13564 (set_attr "type" "sselog,sselog,sselog,sselog,sselog,sselog,ssemov,mmxcvt,mmxmov")
13565 (set_attr "prefix_extra" "1,1,1,*,*,*,*,*,*")
13566 (set_attr "length_immediate" "1,1,1,*,*,*,*,*,*")
13567 (set_attr "prefix" "orig,orig,vex,orig,orig,vex,maybe_vex,orig,orig")
13568 (set_attr "mode" "TI,TI,TI,TI,TI,TI,TI,DI,DI")])
13570 ;; ??? In theory we can match memory for the MMX alternative, but allowing
13571 ;; nonimmediate_operand for operand 2 and *not* allowing memory for the SSE
13572 ;; alternatives pretty much forces the MMX alternative to be chosen.
13573 (define_insn "*vec_concatv2si"
13574 [(set (match_operand:V2SI 0 "register_operand" "=x,x ,*y,x,x,*y,*y")
13576 (match_operand:SI 1 "nonimmediate_operand" " 0,rm,rm,0,m, 0,*rm")
13577 (match_operand:SI 2 "reg_or_0_operand" " x,C ,C, x,C,*y,C")))]
13578 "TARGET_SSE && !TARGET_SSE4_1"
13580 punpckldq\t{%2, %0|%0, %2}
13581 movd\t{%1, %0|%0, %1}
13582 movd\t{%1, %0|%0, %1}
13583 unpcklps\t{%2, %0|%0, %2}
13584 movss\t{%1, %0|%0, %1}
13585 punpckldq\t{%2, %0|%0, %2}
13586 movd\t{%1, %0|%0, %1}"
13587 [(set_attr "isa" "sse2,sse2,sse2,*,*,*,*")
13588 (set_attr "type" "sselog,ssemov,mmxmov,sselog,ssemov,mmxcvt,mmxmov")
13589 (set_attr "mode" "TI,TI,DI,V4SF,SF,DI,DI")])
13591 (define_insn "*vec_concatv4si"
13592 [(set (match_operand:V4SI 0 "register_operand" "=x,x,x,x,x")
13594 (match_operand:V2SI 1 "register_operand" " 0,x,0,0,x")
13595 (match_operand:V2SI 2 "nonimmediate_operand" " x,x,x,m,m")))]
13598 punpcklqdq\t{%2, %0|%0, %2}
13599 vpunpcklqdq\t{%2, %1, %0|%0, %1, %2}
13600 movlhps\t{%2, %0|%0, %2}
13601 movhps\t{%2, %0|%0, %q2}
13602 vmovhps\t{%2, %1, %0|%0, %1, %q2}"
13603 [(set_attr "isa" "sse2_noavx,avx,noavx,noavx,avx")
13604 (set_attr "type" "sselog,sselog,ssemov,ssemov,ssemov")
13605 (set_attr "prefix" "orig,vex,orig,orig,vex")
13606 (set_attr "mode" "TI,TI,V4SF,V2SF,V2SF")])
13608 ;; movd instead of movq is required to handle broken assemblers.
13609 (define_insn "vec_concatv2di"
13610 [(set (match_operand:V2DI 0 "register_operand"
13611 "=Yr,*x,x ,Yi,x ,!x,x,x,x,x,x")
13613 (match_operand:DI 1 "nonimmediate_operand"
13614 " 0, 0,x ,r ,xm,*y,0,x,0,0,x")
13615 (match_operand:DI 2 "vector_move_operand"
13616 "*rm,rm,rm,C ,C ,C ,x,x,x,m,m")))]
13619 pinsrq\t{$1, %2, %0|%0, %2, 1}
13620 pinsrq\t{$1, %2, %0|%0, %2, 1}
13621 vpinsrq\t{$1, %2, %1, %0|%0, %1, %2, 1}
13622 * return HAVE_AS_IX86_INTERUNIT_MOVQ ? \"%vmovq\t{%1, %0|%0, %1}\" : \"%vmovd\t{%1, %0|%0, %1}\";
13623 %vmovq\t{%1, %0|%0, %1}
13624 movq2dq\t{%1, %0|%0, %1}
13625 punpcklqdq\t{%2, %0|%0, %2}
13626 vpunpcklqdq\t{%2, %1, %0|%0, %1, %2}
13627 movlhps\t{%2, %0|%0, %2}
13628 movhps\t{%2, %0|%0, %2}
13629 vmovhps\t{%2, %1, %0|%0, %1, %2}"
13630 [(set_attr "isa" "x64_sse4_noavx,x64_sse4_noavx,x64_avx,x64,sse2,sse2,sse2_noavx,avx,noavx,noavx,avx")
13633 (eq_attr "alternative" "0,1,2,6,7")
13634 (const_string "sselog")
13635 (const_string "ssemov")))
13636 (set_attr "prefix_rex" "1,1,1,1,*,*,*,*,*,*,*")
13637 (set_attr "prefix_extra" "1,1,1,*,*,*,*,*,*,*,*")
13638 (set_attr "length_immediate" "1,1,1,*,*,*,*,*,*,*,*")
13639 (set_attr "prefix" "orig,orig,vex,maybe_vex,maybe_vex,orig,orig,vex,orig,orig,vex")
13640 (set_attr "mode" "TI,TI,TI,TI,TI,TI,TI,TI,V4SF,V2SF,V2SF")])
13642 (define_expand "vec_unpacks_lo_<mode>"
13643 [(match_operand:<sseunpackmode> 0 "register_operand")
13644 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
13646 "ix86_expand_sse_unpack (operands[0], operands[1], false, false); DONE;")
13648 (define_expand "vec_unpacks_hi_<mode>"
13649 [(match_operand:<sseunpackmode> 0 "register_operand")
13650 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
13652 "ix86_expand_sse_unpack (operands[0], operands[1], false, true); DONE;")
13654 (define_expand "vec_unpacku_lo_<mode>"
13655 [(match_operand:<sseunpackmode> 0 "register_operand")
13656 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
13658 "ix86_expand_sse_unpack (operands[0], operands[1], true, false); DONE;")
13660 (define_expand "vec_unpacks_lo_hi"
13661 [(set (match_operand:QI 0 "register_operand")
13662 (subreg:QI (match_operand:HI 1 "register_operand") 0))]
13665 (define_expand "vec_unpacks_lo_si"
13666 [(set (match_operand:HI 0 "register_operand")
13667 (subreg:HI (match_operand:SI 1 "register_operand") 0))]
13670 (define_expand "vec_unpacks_lo_di"
13671 [(set (match_operand:SI 0 "register_operand")
13672 (subreg:SI (match_operand:DI 1 "register_operand") 0))]
13675 (define_expand "vec_unpacku_hi_<mode>"
13676 [(match_operand:<sseunpackmode> 0 "register_operand")
13677 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
13679 "ix86_expand_sse_unpack (operands[0], operands[1], true, true); DONE;")
13681 (define_expand "vec_unpacks_hi_hi"
13682 [(set (subreg:HI (match_operand:QI 0 "register_operand") 0)
13683 (lshiftrt:HI (match_operand:HI 1 "register_operand")
13687 (define_expand "vec_unpacks_hi_<mode>"
13688 [(set (subreg:SWI48x (match_operand:<HALFMASKMODE> 0 "register_operand") 0)
13689 (lshiftrt:SWI48x (match_operand:SWI48x 1 "register_operand")
13693 operands[2] = GEN_INT (GET_MODE_BITSIZE (<HALFMASKMODE>mode));
13696 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
13700 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
13702 (define_expand "<sse2_avx2>_uavg<mode>3<mask_name>"
13703 [(set (match_operand:VI12_AVX2 0 "register_operand")
13704 (truncate:VI12_AVX2
13705 (lshiftrt:<ssedoublemode>
13706 (plus:<ssedoublemode>
13707 (plus:<ssedoublemode>
13708 (zero_extend:<ssedoublemode>
13709 (match_operand:VI12_AVX2 1 "vector_operand"))
13710 (zero_extend:<ssedoublemode>
13711 (match_operand:VI12_AVX2 2 "vector_operand")))
13712 (match_dup <mask_expand_op3>))
13714 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
13717 if (<mask_applied>)
13719 operands[3] = CONST1_RTX(<MODE>mode);
13720 ix86_fixup_binary_operands_no_copy (PLUS, <MODE>mode, operands);
13722 if (<mask_applied>)
13724 operands[5] = operands[3];
13729 (define_insn "*<sse2_avx2>_uavg<mode>3<mask_name>"
13730 [(set (match_operand:VI12_AVX2 0 "register_operand" "=x,v")
13731 (truncate:VI12_AVX2
13732 (lshiftrt:<ssedoublemode>
13733 (plus:<ssedoublemode>
13734 (plus:<ssedoublemode>
13735 (zero_extend:<ssedoublemode>
13736 (match_operand:VI12_AVX2 1 "vector_operand" "%0,v"))
13737 (zero_extend:<ssedoublemode>
13738 (match_operand:VI12_AVX2 2 "vector_operand" "xBm,vm")))
13739 (match_operand:VI12_AVX2 <mask_expand_op3> "const1_operand"))
13741 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>
13742 && ix86_binary_operator_ok (PLUS, <MODE>mode, operands)"
13744 pavg<ssemodesuffix>\t{%2, %0|%0, %2}
13745 vpavg<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13746 [(set_attr "isa" "noavx,avx")
13747 (set_attr "type" "sseiadd")
13748 (set_attr "prefix_data16" "1,*")
13749 (set_attr "prefix" "orig,<mask_prefix>")
13750 (set_attr "mode" "<sseinsnmode>")])
13752 ;; The correct representation for this is absolutely enormous, and
13753 ;; surely not generally useful.
13754 (define_insn "<sse2_avx2>_psadbw"
13755 [(set (match_operand:VI8_AVX2_AVX512BW 0 "register_operand" "=x,v")
13756 (unspec:VI8_AVX2_AVX512BW
13757 [(match_operand:<ssebytemode> 1 "register_operand" "0,v")
13758 (match_operand:<ssebytemode> 2 "vector_operand" "xBm,vm")]
13762 psadbw\t{%2, %0|%0, %2}
13763 vpsadbw\t{%2, %1, %0|%0, %1, %2}"
13764 [(set_attr "isa" "noavx,avx")
13765 (set_attr "type" "sseiadd")
13766 (set_attr "atom_unit" "simul")
13767 (set_attr "prefix_data16" "1,*")
13768 (set_attr "prefix" "orig,maybe_evex")
13769 (set_attr "mode" "<sseinsnmode>")])
13771 (define_insn "<sse>_movmsk<ssemodesuffix><avxsizesuffix>"
13772 [(set (match_operand:SI 0 "register_operand" "=r")
13774 [(match_operand:VF_128_256 1 "register_operand" "x")]
13777 "%vmovmsk<ssemodesuffix>\t{%1, %0|%0, %1}"
13778 [(set_attr "type" "ssemov")
13779 (set_attr "prefix" "maybe_vex")
13780 (set_attr "mode" "<MODE>")])
13782 (define_insn "*<sse>_movmsk<ssemodesuffix><avxsizesuffix>_zext"
13783 [(set (match_operand:DI 0 "register_operand" "=r")
13786 [(match_operand:VF_128_256 1 "register_operand" "x")]
13788 "TARGET_64BIT && TARGET_SSE"
13789 "%vmovmsk<ssemodesuffix>\t{%1, %k0|%k0, %1}"
13790 [(set_attr "type" "ssemov")
13791 (set_attr "prefix" "maybe_vex")
13792 (set_attr "mode" "<MODE>")])
13794 (define_insn "<sse2_avx2>_pmovmskb"
13795 [(set (match_operand:SI 0 "register_operand" "=r")
13797 [(match_operand:VI1_AVX2 1 "register_operand" "x")]
13800 "%vpmovmskb\t{%1, %0|%0, %1}"
13801 [(set_attr "type" "ssemov")
13802 (set (attr "prefix_data16")
13804 (match_test "TARGET_AVX")
13806 (const_string "1")))
13807 (set_attr "prefix" "maybe_vex")
13808 (set_attr "mode" "SI")])
13810 (define_insn "*<sse2_avx2>_pmovmskb_zext"
13811 [(set (match_operand:DI 0 "register_operand" "=r")
13814 [(match_operand:VI1_AVX2 1 "register_operand" "x")]
13816 "TARGET_64BIT && TARGET_SSE2"
13817 "%vpmovmskb\t{%1, %k0|%k0, %1}"
13818 [(set_attr "type" "ssemov")
13819 (set (attr "prefix_data16")
13821 (match_test "TARGET_AVX")
13823 (const_string "1")))
13824 (set_attr "prefix" "maybe_vex")
13825 (set_attr "mode" "SI")])
13827 (define_expand "sse2_maskmovdqu"
13828 [(set (match_operand:V16QI 0 "memory_operand")
13829 (unspec:V16QI [(match_operand:V16QI 1 "register_operand")
13830 (match_operand:V16QI 2 "register_operand")
13835 (define_insn "*sse2_maskmovdqu"
13836 [(set (mem:V16QI (match_operand:P 0 "register_operand" "D"))
13837 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "x")
13838 (match_operand:V16QI 2 "register_operand" "x")
13839 (mem:V16QI (match_dup 0))]
13843 /* We can't use %^ here due to ASM_OUTPUT_OPCODE processing
13844 that requires %v to be at the beginning of the opcode name. */
13845 if (Pmode != word_mode)
13846 fputs ("\taddr32", asm_out_file);
13847 return "%vmaskmovdqu\t{%2, %1|%1, %2}";
13849 [(set_attr "type" "ssemov")
13850 (set_attr "prefix_data16" "1")
13851 (set (attr "length_address")
13852 (symbol_ref ("Pmode != word_mode")))
13853 ;; The implicit %rdi operand confuses default length_vex computation.
13854 (set (attr "length_vex")
13855 (symbol_ref ("3 + REX_SSE_REGNO_P (REGNO (operands[2]))")))
13856 (set_attr "prefix" "maybe_vex")
13857 (set_attr "znver1_decode" "vector")
13858 (set_attr "mode" "TI")])
13860 (define_insn "sse_ldmxcsr"
13861 [(unspec_volatile [(match_operand:SI 0 "memory_operand" "m")]
13865 [(set_attr "type" "sse")
13866 (set_attr "atom_sse_attr" "mxcsr")
13867 (set_attr "prefix" "maybe_vex")
13868 (set_attr "memory" "load")])
13870 (define_insn "sse_stmxcsr"
13871 [(set (match_operand:SI 0 "memory_operand" "=m")
13872 (unspec_volatile:SI [(const_int 0)] UNSPECV_STMXCSR))]
13875 [(set_attr "type" "sse")
13876 (set_attr "atom_sse_attr" "mxcsr")
13877 (set_attr "prefix" "maybe_vex")
13878 (set_attr "memory" "store")])
13880 (define_insn "sse2_clflush"
13881 [(unspec_volatile [(match_operand 0 "address_operand" "p")]
13885 [(set_attr "type" "sse")
13886 (set_attr "atom_sse_attr" "fence")
13887 (set_attr "memory" "unknown")])
13889 ;; As per AMD and Intel ISA manuals, the first operand is extensions
13890 ;; and it goes to %ecx. The second operand received is hints and it goes
13892 (define_insn "sse3_mwait"
13893 [(unspec_volatile [(match_operand:SI 0 "register_operand" "c")
13894 (match_operand:SI 1 "register_operand" "a")]
13897 ;; 64bit version is "mwait %rax,%rcx". But only lower 32bits are used.
13898 ;; Since 32bit register operands are implicitly zero extended to 64bit,
13899 ;; we only need to set up 32bit registers.
13901 [(set_attr "length" "3")])
13903 (define_insn "sse3_monitor_<mode>"
13904 [(unspec_volatile [(match_operand:P 0 "register_operand" "a")
13905 (match_operand:SI 1 "register_operand" "c")
13906 (match_operand:SI 2 "register_operand" "d")]
13909 ;; 64bit version is "monitor %rax,%rcx,%rdx". But only lower 32bits in
13910 ;; RCX and RDX are used. Since 32bit register operands are implicitly
13911 ;; zero extended to 64bit, we only need to set up 32bit registers.
13913 [(set (attr "length")
13914 (symbol_ref ("(Pmode != word_mode) + 3")))])
13916 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
13918 ;; SSSE3 instructions
13920 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
13922 (define_code_iterator ssse3_plusminus [plus ss_plus minus ss_minus])
13924 (define_insn "avx2_ph<plusminus_mnemonic>wv16hi3"
13925 [(set (match_operand:V16HI 0 "register_operand" "=x")
13930 (ssse3_plusminus:HI
13932 (match_operand:V16HI 1 "register_operand" "x")
13933 (parallel [(const_int 0)]))
13934 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
13935 (ssse3_plusminus:HI
13936 (vec_select:HI (match_dup 1) (parallel [(const_int 2)]))
13937 (vec_select:HI (match_dup 1) (parallel [(const_int 3)]))))
13939 (ssse3_plusminus:HI
13940 (vec_select:HI (match_dup 1) (parallel [(const_int 4)]))
13941 (vec_select:HI (match_dup 1) (parallel [(const_int 5)])))
13942 (ssse3_plusminus:HI
13943 (vec_select:HI (match_dup 1) (parallel [(const_int 6)]))
13944 (vec_select:HI (match_dup 1) (parallel [(const_int 7)])))))
13947 (ssse3_plusminus:HI
13948 (vec_select:HI (match_dup 1) (parallel [(const_int 8)]))
13949 (vec_select:HI (match_dup 1) (parallel [(const_int 9)])))
13950 (ssse3_plusminus:HI
13951 (vec_select:HI (match_dup 1) (parallel [(const_int 10)]))
13952 (vec_select:HI (match_dup 1) (parallel [(const_int 11)]))))
13954 (ssse3_plusminus:HI
13955 (vec_select:HI (match_dup 1) (parallel [(const_int 12)]))
13956 (vec_select:HI (match_dup 1) (parallel [(const_int 13)])))
13957 (ssse3_plusminus:HI
13958 (vec_select:HI (match_dup 1) (parallel [(const_int 14)]))
13959 (vec_select:HI (match_dup 1) (parallel [(const_int 15)]))))))
13963 (ssse3_plusminus:HI
13965 (match_operand:V16HI 2 "nonimmediate_operand" "xm")
13966 (parallel [(const_int 0)]))
13967 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))
13968 (ssse3_plusminus:HI
13969 (vec_select:HI (match_dup 2) (parallel [(const_int 2)]))
13970 (vec_select:HI (match_dup 2) (parallel [(const_int 3)]))))
13972 (ssse3_plusminus:HI
13973 (vec_select:HI (match_dup 2) (parallel [(const_int 4)]))
13974 (vec_select:HI (match_dup 2) (parallel [(const_int 5)])))
13975 (ssse3_plusminus:HI
13976 (vec_select:HI (match_dup 2) (parallel [(const_int 6)]))
13977 (vec_select:HI (match_dup 2) (parallel [(const_int 7)])))))
13980 (ssse3_plusminus:HI
13981 (vec_select:HI (match_dup 2) (parallel [(const_int 8)]))
13982 (vec_select:HI (match_dup 2) (parallel [(const_int 9)])))
13983 (ssse3_plusminus:HI
13984 (vec_select:HI (match_dup 2) (parallel [(const_int 10)]))
13985 (vec_select:HI (match_dup 2) (parallel [(const_int 11)]))))
13987 (ssse3_plusminus:HI
13988 (vec_select:HI (match_dup 2) (parallel [(const_int 12)]))
13989 (vec_select:HI (match_dup 2) (parallel [(const_int 13)])))
13990 (ssse3_plusminus:HI
13991 (vec_select:HI (match_dup 2) (parallel [(const_int 14)]))
13992 (vec_select:HI (match_dup 2) (parallel [(const_int 15)]))))))))]
13994 "vph<plusminus_mnemonic>w\t{%2, %1, %0|%0, %1, %2}"
13995 [(set_attr "type" "sseiadd")
13996 (set_attr "prefix_extra" "1")
13997 (set_attr "prefix" "vex")
13998 (set_attr "mode" "OI")])
14000 (define_insn "ssse3_ph<plusminus_mnemonic>wv8hi3"
14001 [(set (match_operand:V8HI 0 "register_operand" "=x,x")
14005 (ssse3_plusminus:HI
14007 (match_operand:V8HI 1 "register_operand" "0,x")
14008 (parallel [(const_int 0)]))
14009 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
14010 (ssse3_plusminus:HI
14011 (vec_select:HI (match_dup 1) (parallel [(const_int 2)]))
14012 (vec_select:HI (match_dup 1) (parallel [(const_int 3)]))))
14014 (ssse3_plusminus:HI
14015 (vec_select:HI (match_dup 1) (parallel [(const_int 4)]))
14016 (vec_select:HI (match_dup 1) (parallel [(const_int 5)])))
14017 (ssse3_plusminus:HI
14018 (vec_select:HI (match_dup 1) (parallel [(const_int 6)]))
14019 (vec_select:HI (match_dup 1) (parallel [(const_int 7)])))))
14022 (ssse3_plusminus:HI
14024 (match_operand:V8HI 2 "vector_operand" "xBm,xm")
14025 (parallel [(const_int 0)]))
14026 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))
14027 (ssse3_plusminus:HI
14028 (vec_select:HI (match_dup 2) (parallel [(const_int 2)]))
14029 (vec_select:HI (match_dup 2) (parallel [(const_int 3)]))))
14031 (ssse3_plusminus:HI
14032 (vec_select:HI (match_dup 2) (parallel [(const_int 4)]))
14033 (vec_select:HI (match_dup 2) (parallel [(const_int 5)])))
14034 (ssse3_plusminus:HI
14035 (vec_select:HI (match_dup 2) (parallel [(const_int 6)]))
14036 (vec_select:HI (match_dup 2) (parallel [(const_int 7)])))))))]
14039 ph<plusminus_mnemonic>w\t{%2, %0|%0, %2}
14040 vph<plusminus_mnemonic>w\t{%2, %1, %0|%0, %1, %2}"
14041 [(set_attr "isa" "noavx,avx")
14042 (set_attr "type" "sseiadd")
14043 (set_attr "atom_unit" "complex")
14044 (set_attr "prefix_data16" "1,*")
14045 (set_attr "prefix_extra" "1")
14046 (set_attr "prefix" "orig,vex")
14047 (set_attr "mode" "TI")])
14049 (define_insn "ssse3_ph<plusminus_mnemonic>wv4hi3"
14050 [(set (match_operand:V4HI 0 "register_operand" "=y")
14053 (ssse3_plusminus:HI
14055 (match_operand:V4HI 1 "register_operand" "0")
14056 (parallel [(const_int 0)]))
14057 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
14058 (ssse3_plusminus:HI
14059 (vec_select:HI (match_dup 1) (parallel [(const_int 2)]))
14060 (vec_select:HI (match_dup 1) (parallel [(const_int 3)]))))
14062 (ssse3_plusminus:HI
14064 (match_operand:V4HI 2 "nonimmediate_operand" "ym")
14065 (parallel [(const_int 0)]))
14066 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))
14067 (ssse3_plusminus:HI
14068 (vec_select:HI (match_dup 2) (parallel [(const_int 2)]))
14069 (vec_select:HI (match_dup 2) (parallel [(const_int 3)]))))))]
14071 "ph<plusminus_mnemonic>w\t{%2, %0|%0, %2}"
14072 [(set_attr "type" "sseiadd")
14073 (set_attr "atom_unit" "complex")
14074 (set_attr "prefix_extra" "1")
14075 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14076 (set_attr "mode" "DI")])
14078 (define_insn "avx2_ph<plusminus_mnemonic>dv8si3"
14079 [(set (match_operand:V8SI 0 "register_operand" "=x")
14085 (match_operand:V8SI 1 "register_operand" "x")
14086 (parallel [(const_int 0)]))
14087 (vec_select:SI (match_dup 1) (parallel [(const_int 1)])))
14089 (vec_select:SI (match_dup 1) (parallel [(const_int 2)]))
14090 (vec_select:SI (match_dup 1) (parallel [(const_int 3)]))))
14093 (vec_select:SI (match_dup 1) (parallel [(const_int 4)]))
14094 (vec_select:SI (match_dup 1) (parallel [(const_int 5)])))
14096 (vec_select:SI (match_dup 1) (parallel [(const_int 6)]))
14097 (vec_select:SI (match_dup 1) (parallel [(const_int 7)])))))
14102 (match_operand:V8SI 2 "nonimmediate_operand" "xm")
14103 (parallel [(const_int 0)]))
14104 (vec_select:SI (match_dup 2) (parallel [(const_int 1)])))
14106 (vec_select:SI (match_dup 2) (parallel [(const_int 2)]))
14107 (vec_select:SI (match_dup 2) (parallel [(const_int 3)]))))
14110 (vec_select:SI (match_dup 2) (parallel [(const_int 4)]))
14111 (vec_select:SI (match_dup 2) (parallel [(const_int 5)])))
14113 (vec_select:SI (match_dup 2) (parallel [(const_int 6)]))
14114 (vec_select:SI (match_dup 2) (parallel [(const_int 7)])))))))]
14116 "vph<plusminus_mnemonic>d\t{%2, %1, %0|%0, %1, %2}"
14117 [(set_attr "type" "sseiadd")
14118 (set_attr "prefix_extra" "1")
14119 (set_attr "prefix" "vex")
14120 (set_attr "mode" "OI")])
14122 (define_insn "ssse3_ph<plusminus_mnemonic>dv4si3"
14123 [(set (match_operand:V4SI 0 "register_operand" "=x,x")
14128 (match_operand:V4SI 1 "register_operand" "0,x")
14129 (parallel [(const_int 0)]))
14130 (vec_select:SI (match_dup 1) (parallel [(const_int 1)])))
14132 (vec_select:SI (match_dup 1) (parallel [(const_int 2)]))
14133 (vec_select:SI (match_dup 1) (parallel [(const_int 3)]))))
14137 (match_operand:V4SI 2 "vector_operand" "xBm,xm")
14138 (parallel [(const_int 0)]))
14139 (vec_select:SI (match_dup 2) (parallel [(const_int 1)])))
14141 (vec_select:SI (match_dup 2) (parallel [(const_int 2)]))
14142 (vec_select:SI (match_dup 2) (parallel [(const_int 3)]))))))]
14145 ph<plusminus_mnemonic>d\t{%2, %0|%0, %2}
14146 vph<plusminus_mnemonic>d\t{%2, %1, %0|%0, %1, %2}"
14147 [(set_attr "isa" "noavx,avx")
14148 (set_attr "type" "sseiadd")
14149 (set_attr "atom_unit" "complex")
14150 (set_attr "prefix_data16" "1,*")
14151 (set_attr "prefix_extra" "1")
14152 (set_attr "prefix" "orig,vex")
14153 (set_attr "mode" "TI")])
14155 (define_insn "ssse3_ph<plusminus_mnemonic>dv2si3"
14156 [(set (match_operand:V2SI 0 "register_operand" "=y")
14160 (match_operand:V2SI 1 "register_operand" "0")
14161 (parallel [(const_int 0)]))
14162 (vec_select:SI (match_dup 1) (parallel [(const_int 1)])))
14165 (match_operand:V2SI 2 "nonimmediate_operand" "ym")
14166 (parallel [(const_int 0)]))
14167 (vec_select:SI (match_dup 2) (parallel [(const_int 1)])))))]
14169 "ph<plusminus_mnemonic>d\t{%2, %0|%0, %2}"
14170 [(set_attr "type" "sseiadd")
14171 (set_attr "atom_unit" "complex")
14172 (set_attr "prefix_extra" "1")
14173 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14174 (set_attr "mode" "DI")])
14176 (define_insn "avx2_pmaddubsw256"
14177 [(set (match_operand:V16HI 0 "register_operand" "=x")
14182 (match_operand:V32QI 1 "register_operand" "x")
14183 (parallel [(const_int 0) (const_int 2)
14184 (const_int 4) (const_int 6)
14185 (const_int 8) (const_int 10)
14186 (const_int 12) (const_int 14)
14187 (const_int 16) (const_int 18)
14188 (const_int 20) (const_int 22)
14189 (const_int 24) (const_int 26)
14190 (const_int 28) (const_int 30)])))
14193 (match_operand:V32QI 2 "nonimmediate_operand" "xm")
14194 (parallel [(const_int 0) (const_int 2)
14195 (const_int 4) (const_int 6)
14196 (const_int 8) (const_int 10)
14197 (const_int 12) (const_int 14)
14198 (const_int 16) (const_int 18)
14199 (const_int 20) (const_int 22)
14200 (const_int 24) (const_int 26)
14201 (const_int 28) (const_int 30)]))))
14204 (vec_select:V16QI (match_dup 1)
14205 (parallel [(const_int 1) (const_int 3)
14206 (const_int 5) (const_int 7)
14207 (const_int 9) (const_int 11)
14208 (const_int 13) (const_int 15)
14209 (const_int 17) (const_int 19)
14210 (const_int 21) (const_int 23)
14211 (const_int 25) (const_int 27)
14212 (const_int 29) (const_int 31)])))
14214 (vec_select:V16QI (match_dup 2)
14215 (parallel [(const_int 1) (const_int 3)
14216 (const_int 5) (const_int 7)
14217 (const_int 9) (const_int 11)
14218 (const_int 13) (const_int 15)
14219 (const_int 17) (const_int 19)
14220 (const_int 21) (const_int 23)
14221 (const_int 25) (const_int 27)
14222 (const_int 29) (const_int 31)]))))))]
14224 "vpmaddubsw\t{%2, %1, %0|%0, %1, %2}"
14225 [(set_attr "type" "sseiadd")
14226 (set_attr "prefix_extra" "1")
14227 (set_attr "prefix" "vex")
14228 (set_attr "mode" "OI")])
14230 ;; The correct representation for this is absolutely enormous, and
14231 ;; surely not generally useful.
14232 (define_insn "avx512bw_pmaddubsw512<mode><mask_name>"
14233 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
14234 (unspec:VI2_AVX512VL
14235 [(match_operand:<dbpsadbwmode> 1 "register_operand" "v")
14236 (match_operand:<dbpsadbwmode> 2 "nonimmediate_operand" "vm")]
14237 UNSPEC_PMADDUBSW512))]
14239 "vpmaddubsw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}";
14240 [(set_attr "type" "sseiadd")
14241 (set_attr "prefix" "evex")
14242 (set_attr "mode" "XI")])
14244 (define_insn "avx512bw_umulhrswv32hi3<mask_name>"
14245 [(set (match_operand:V32HI 0 "register_operand" "=v")
14252 (match_operand:V32HI 1 "nonimmediate_operand" "%v"))
14254 (match_operand:V32HI 2 "nonimmediate_operand" "vm")))
14256 (const_vector:V32HI [(const_int 1) (const_int 1)
14257 (const_int 1) (const_int 1)
14258 (const_int 1) (const_int 1)
14259 (const_int 1) (const_int 1)
14260 (const_int 1) (const_int 1)
14261 (const_int 1) (const_int 1)
14262 (const_int 1) (const_int 1)
14263 (const_int 1) (const_int 1)
14264 (const_int 1) (const_int 1)
14265 (const_int 1) (const_int 1)
14266 (const_int 1) (const_int 1)
14267 (const_int 1) (const_int 1)
14268 (const_int 1) (const_int 1)
14269 (const_int 1) (const_int 1)
14270 (const_int 1) (const_int 1)
14271 (const_int 1) (const_int 1)]))
14274 "vpmulhrsw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
14275 [(set_attr "type" "sseimul")
14276 (set_attr "prefix" "evex")
14277 (set_attr "mode" "XI")])
14279 (define_insn "ssse3_pmaddubsw128"
14280 [(set (match_operand:V8HI 0 "register_operand" "=x,x")
14285 (match_operand:V16QI 1 "register_operand" "0,x")
14286 (parallel [(const_int 0) (const_int 2)
14287 (const_int 4) (const_int 6)
14288 (const_int 8) (const_int 10)
14289 (const_int 12) (const_int 14)])))
14292 (match_operand:V16QI 2 "vector_operand" "xBm,xm")
14293 (parallel [(const_int 0) (const_int 2)
14294 (const_int 4) (const_int 6)
14295 (const_int 8) (const_int 10)
14296 (const_int 12) (const_int 14)]))))
14299 (vec_select:V8QI (match_dup 1)
14300 (parallel [(const_int 1) (const_int 3)
14301 (const_int 5) (const_int 7)
14302 (const_int 9) (const_int 11)
14303 (const_int 13) (const_int 15)])))
14305 (vec_select:V8QI (match_dup 2)
14306 (parallel [(const_int 1) (const_int 3)
14307 (const_int 5) (const_int 7)
14308 (const_int 9) (const_int 11)
14309 (const_int 13) (const_int 15)]))))))]
14312 pmaddubsw\t{%2, %0|%0, %2}
14313 vpmaddubsw\t{%2, %1, %0|%0, %1, %2}"
14314 [(set_attr "isa" "noavx,avx")
14315 (set_attr "type" "sseiadd")
14316 (set_attr "atom_unit" "simul")
14317 (set_attr "prefix_data16" "1,*")
14318 (set_attr "prefix_extra" "1")
14319 (set_attr "prefix" "orig,vex")
14320 (set_attr "mode" "TI")])
14322 (define_insn "ssse3_pmaddubsw"
14323 [(set (match_operand:V4HI 0 "register_operand" "=y")
14328 (match_operand:V8QI 1 "register_operand" "0")
14329 (parallel [(const_int 0) (const_int 2)
14330 (const_int 4) (const_int 6)])))
14333 (match_operand:V8QI 2 "nonimmediate_operand" "ym")
14334 (parallel [(const_int 0) (const_int 2)
14335 (const_int 4) (const_int 6)]))))
14338 (vec_select:V4QI (match_dup 1)
14339 (parallel [(const_int 1) (const_int 3)
14340 (const_int 5) (const_int 7)])))
14342 (vec_select:V4QI (match_dup 2)
14343 (parallel [(const_int 1) (const_int 3)
14344 (const_int 5) (const_int 7)]))))))]
14346 "pmaddubsw\t{%2, %0|%0, %2}"
14347 [(set_attr "type" "sseiadd")
14348 (set_attr "atom_unit" "simul")
14349 (set_attr "prefix_extra" "1")
14350 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14351 (set_attr "mode" "DI")])
14353 (define_mode_iterator PMULHRSW
14354 [V4HI V8HI (V16HI "TARGET_AVX2")])
14356 (define_expand "<ssse3_avx2>_pmulhrsw<mode>3_mask"
14357 [(set (match_operand:PMULHRSW 0 "register_operand")
14358 (vec_merge:PMULHRSW
14360 (lshiftrt:<ssedoublemode>
14361 (plus:<ssedoublemode>
14362 (lshiftrt:<ssedoublemode>
14363 (mult:<ssedoublemode>
14364 (sign_extend:<ssedoublemode>
14365 (match_operand:PMULHRSW 1 "nonimmediate_operand"))
14366 (sign_extend:<ssedoublemode>
14367 (match_operand:PMULHRSW 2 "nonimmediate_operand")))
14371 (match_operand:PMULHRSW 3 "register_operand")
14372 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
14373 "TARGET_AVX512BW && TARGET_AVX512VL"
14375 operands[5] = CONST1_RTX(<MODE>mode);
14376 ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);
14379 (define_expand "<ssse3_avx2>_pmulhrsw<mode>3"
14380 [(set (match_operand:PMULHRSW 0 "register_operand")
14382 (lshiftrt:<ssedoublemode>
14383 (plus:<ssedoublemode>
14384 (lshiftrt:<ssedoublemode>
14385 (mult:<ssedoublemode>
14386 (sign_extend:<ssedoublemode>
14387 (match_operand:PMULHRSW 1 "nonimmediate_operand"))
14388 (sign_extend:<ssedoublemode>
14389 (match_operand:PMULHRSW 2 "nonimmediate_operand")))
14395 operands[3] = CONST1_RTX(<MODE>mode);
14396 ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);
14399 (define_insn "*<ssse3_avx2>_pmulhrsw<mode>3<mask_name>"
14400 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,v")
14402 (lshiftrt:<ssedoublemode>
14403 (plus:<ssedoublemode>
14404 (lshiftrt:<ssedoublemode>
14405 (mult:<ssedoublemode>
14406 (sign_extend:<ssedoublemode>
14407 (match_operand:VI2_AVX2 1 "vector_operand" "%0,v"))
14408 (sign_extend:<ssedoublemode>
14409 (match_operand:VI2_AVX2 2 "vector_operand" "xBm,vm")))
14411 (match_operand:VI2_AVX2 3 "const1_operand"))
14413 "TARGET_SSSE3 && <mask_mode512bit_condition> && <mask_avx512bw_condition>
14414 && ix86_binary_operator_ok (MULT, <MODE>mode, operands)"
14416 pmulhrsw\t{%2, %0|%0, %2}
14417 vpmulhrsw\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}"
14418 [(set_attr "isa" "noavx,avx")
14419 (set_attr "type" "sseimul")
14420 (set_attr "prefix_data16" "1,*")
14421 (set_attr "prefix_extra" "1")
14422 (set_attr "prefix" "orig,maybe_evex")
14423 (set_attr "mode" "<sseinsnmode>")])
14425 (define_insn "*ssse3_pmulhrswv4hi3"
14426 [(set (match_operand:V4HI 0 "register_operand" "=y")
14433 (match_operand:V4HI 1 "nonimmediate_operand" "%0"))
14435 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))
14437 (match_operand:V4HI 3 "const1_operand"))
14439 "TARGET_SSSE3 && ix86_binary_operator_ok (MULT, V4HImode, operands)"
14440 "pmulhrsw\t{%2, %0|%0, %2}"
14441 [(set_attr "type" "sseimul")
14442 (set_attr "prefix_extra" "1")
14443 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14444 (set_attr "mode" "DI")])
14446 (define_insn "<ssse3_avx2>_pshufb<mode>3<mask_name>"
14447 [(set (match_operand:VI1_AVX512 0 "register_operand" "=x,v")
14449 [(match_operand:VI1_AVX512 1 "register_operand" "0,v")
14450 (match_operand:VI1_AVX512 2 "vector_operand" "xBm,vm")]
14452 "TARGET_SSSE3 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
14454 pshufb\t{%2, %0|%0, %2}
14455 vpshufb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
14456 [(set_attr "isa" "noavx,avx")
14457 (set_attr "type" "sselog1")
14458 (set_attr "prefix_data16" "1,*")
14459 (set_attr "prefix_extra" "1")
14460 (set_attr "prefix" "orig,maybe_evex")
14461 (set_attr "btver2_decode" "vector,vector")
14462 (set_attr "mode" "<sseinsnmode>")])
14464 (define_insn "ssse3_pshufbv8qi3"
14465 [(set (match_operand:V8QI 0 "register_operand" "=y")
14466 (unspec:V8QI [(match_operand:V8QI 1 "register_operand" "0")
14467 (match_operand:V8QI 2 "nonimmediate_operand" "ym")]
14470 "pshufb\t{%2, %0|%0, %2}";
14471 [(set_attr "type" "sselog1")
14472 (set_attr "prefix_extra" "1")
14473 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14474 (set_attr "mode" "DI")])
14476 (define_insn "<ssse3_avx2>_psign<mode>3"
14477 [(set (match_operand:VI124_AVX2 0 "register_operand" "=x,x")
14479 [(match_operand:VI124_AVX2 1 "register_operand" "0,x")
14480 (match_operand:VI124_AVX2 2 "vector_operand" "xBm,xm")]
14484 psign<ssemodesuffix>\t{%2, %0|%0, %2}
14485 vpsign<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
14486 [(set_attr "isa" "noavx,avx")
14487 (set_attr "type" "sselog1")
14488 (set_attr "prefix_data16" "1,*")
14489 (set_attr "prefix_extra" "1")
14490 (set_attr "prefix" "orig,vex")
14491 (set_attr "mode" "<sseinsnmode>")])
14493 (define_insn "ssse3_psign<mode>3"
14494 [(set (match_operand:MMXMODEI 0 "register_operand" "=y")
14496 [(match_operand:MMXMODEI 1 "register_operand" "0")
14497 (match_operand:MMXMODEI 2 "nonimmediate_operand" "ym")]
14500 "psign<mmxvecsize>\t{%2, %0|%0, %2}";
14501 [(set_attr "type" "sselog1")
14502 (set_attr "prefix_extra" "1")
14503 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14504 (set_attr "mode" "DI")])
14506 (define_insn "<ssse3_avx2>_palignr<mode>_mask"
14507 [(set (match_operand:VI1_AVX512 0 "register_operand" "=v")
14508 (vec_merge:VI1_AVX512
14510 [(match_operand:VI1_AVX512 1 "register_operand" "v")
14511 (match_operand:VI1_AVX512 2 "nonimmediate_operand" "vm")
14512 (match_operand:SI 3 "const_0_to_255_mul_8_operand" "n")]
14514 (match_operand:VI1_AVX512 4 "vector_move_operand" "0C")
14515 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
14516 "TARGET_AVX512BW && (<MODE_SIZE> == 64 || TARGET_AVX512VL)"
14518 operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
14519 return "vpalignr\t{%3, %2, %1, %0%{%5%}%N4|%0%{%5%}%N4, %1, %2, %3}";
14521 [(set_attr "type" "sseishft")
14522 (set_attr "atom_unit" "sishuf")
14523 (set_attr "prefix_extra" "1")
14524 (set_attr "length_immediate" "1")
14525 (set_attr "prefix" "evex")
14526 (set_attr "mode" "<sseinsnmode>")])
14528 (define_insn "<ssse3_avx2>_palignr<mode>"
14529 [(set (match_operand:SSESCALARMODE 0 "register_operand" "=x,v")
14530 (unspec:SSESCALARMODE
14531 [(match_operand:SSESCALARMODE 1 "register_operand" "0,v")
14532 (match_operand:SSESCALARMODE 2 "vector_operand" "xBm,vm")
14533 (match_operand:SI 3 "const_0_to_255_mul_8_operand" "n,n")]
14537 operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
14539 switch (which_alternative)
14542 return "palignr\t{%3, %2, %0|%0, %2, %3}";
14544 return "vpalignr\t{%3, %2, %1, %0|%0, %1, %2, %3}";
14546 gcc_unreachable ();
14549 [(set_attr "isa" "noavx,avx")
14550 (set_attr "type" "sseishft")
14551 (set_attr "atom_unit" "sishuf")
14552 (set_attr "prefix_data16" "1,*")
14553 (set_attr "prefix_extra" "1")
14554 (set_attr "length_immediate" "1")
14555 (set_attr "prefix" "orig,vex")
14556 (set_attr "mode" "<sseinsnmode>")])
14558 (define_insn "ssse3_palignrdi"
14559 [(set (match_operand:DI 0 "register_operand" "=y")
14560 (unspec:DI [(match_operand:DI 1 "register_operand" "0")
14561 (match_operand:DI 2 "nonimmediate_operand" "ym")
14562 (match_operand:SI 3 "const_0_to_255_mul_8_operand" "n")]
14566 operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
14567 return "palignr\t{%3, %2, %0|%0, %2, %3}";
14569 [(set_attr "type" "sseishft")
14570 (set_attr "atom_unit" "sishuf")
14571 (set_attr "prefix_extra" "1")
14572 (set_attr "length_immediate" "1")
14573 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14574 (set_attr "mode" "DI")])
14576 ;; Mode iterator to handle singularity w/ absence of V2DI and V4DI
14577 ;; modes for abs instruction on pre AVX-512 targets.
14578 (define_mode_iterator VI1248_AVX512VL_AVX512BW
14579 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI
14580 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI
14581 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX2") V4SI
14582 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")])
14584 (define_insn "*abs<mode>2"
14585 [(set (match_operand:VI1248_AVX512VL_AVX512BW 0 "register_operand" "=v")
14586 (abs:VI1248_AVX512VL_AVX512BW
14587 (match_operand:VI1248_AVX512VL_AVX512BW 1 "vector_operand" "vBm")))]
14589 "%vpabs<ssemodesuffix>\t{%1, %0|%0, %1}"
14590 [(set_attr "type" "sselog1")
14591 (set_attr "prefix_data16" "1")
14592 (set_attr "prefix_extra" "1")
14593 (set_attr "prefix" "maybe_vex")
14594 (set_attr "mode" "<sseinsnmode>")])
14596 (define_insn "abs<mode>2_mask"
14597 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
14598 (vec_merge:VI48_AVX512VL
14600 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm"))
14601 (match_operand:VI48_AVX512VL 2 "vector_move_operand" "0C")
14602 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
14604 "vpabs<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
14605 [(set_attr "type" "sselog1")
14606 (set_attr "prefix" "evex")
14607 (set_attr "mode" "<sseinsnmode>")])
14609 (define_insn "abs<mode>2_mask"
14610 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
14611 (vec_merge:VI12_AVX512VL
14613 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "vm"))
14614 (match_operand:VI12_AVX512VL 2 "vector_move_operand" "0C")
14615 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
14617 "vpabs<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
14618 [(set_attr "type" "sselog1")
14619 (set_attr "prefix" "evex")
14620 (set_attr "mode" "<sseinsnmode>")])
14622 (define_expand "abs<mode>2"
14623 [(set (match_operand:VI1248_AVX512VL_AVX512BW 0 "register_operand")
14624 (abs:VI1248_AVX512VL_AVX512BW
14625 (match_operand:VI1248_AVX512VL_AVX512BW 1 "vector_operand")))]
14630 ix86_expand_sse2_abs (operands[0], operands[1]);
14635 (define_insn "abs<mode>2"
14636 [(set (match_operand:MMXMODEI 0 "register_operand" "=y")
14638 (match_operand:MMXMODEI 1 "nonimmediate_operand" "ym")))]
14640 "pabs<mmxvecsize>\t{%1, %0|%0, %1}";
14641 [(set_attr "type" "sselog1")
14642 (set_attr "prefix_rep" "0")
14643 (set_attr "prefix_extra" "1")
14644 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14645 (set_attr "mode" "DI")])
14647 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14649 ;; AMD SSE4A instructions
14651 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14653 (define_insn "sse4a_movnt<mode>"
14654 [(set (match_operand:MODEF 0 "memory_operand" "=m")
14656 [(match_operand:MODEF 1 "register_operand" "x")]
14659 "movnt<ssemodesuffix>\t{%1, %0|%0, %1}"
14660 [(set_attr "type" "ssemov")
14661 (set_attr "mode" "<MODE>")])
14663 (define_insn "sse4a_vmmovnt<mode>"
14664 [(set (match_operand:<ssescalarmode> 0 "memory_operand" "=m")
14665 (unspec:<ssescalarmode>
14666 [(vec_select:<ssescalarmode>
14667 (match_operand:VF_128 1 "register_operand" "x")
14668 (parallel [(const_int 0)]))]
14671 "movnt<ssescalarmodesuffix>\t{%1, %0|%0, %1}"
14672 [(set_attr "type" "ssemov")
14673 (set_attr "mode" "<ssescalarmode>")])
14675 (define_insn "sse4a_extrqi"
14676 [(set (match_operand:V2DI 0 "register_operand" "=x")
14677 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
14678 (match_operand 2 "const_0_to_255_operand")
14679 (match_operand 3 "const_0_to_255_operand")]
14682 "extrq\t{%3, %2, %0|%0, %2, %3}"
14683 [(set_attr "type" "sse")
14684 (set_attr "prefix_data16" "1")
14685 (set_attr "length_immediate" "2")
14686 (set_attr "mode" "TI")])
14688 (define_insn "sse4a_extrq"
14689 [(set (match_operand:V2DI 0 "register_operand" "=x")
14690 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
14691 (match_operand:V16QI 2 "register_operand" "x")]
14694 "extrq\t{%2, %0|%0, %2}"
14695 [(set_attr "type" "sse")
14696 (set_attr "prefix_data16" "1")
14697 (set_attr "mode" "TI")])
14699 (define_insn "sse4a_insertqi"
14700 [(set (match_operand:V2DI 0 "register_operand" "=x")
14701 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
14702 (match_operand:V2DI 2 "register_operand" "x")
14703 (match_operand 3 "const_0_to_255_operand")
14704 (match_operand 4 "const_0_to_255_operand")]
14707 "insertq\t{%4, %3, %2, %0|%0, %2, %3, %4}"
14708 [(set_attr "type" "sseins")
14709 (set_attr "prefix_data16" "0")
14710 (set_attr "prefix_rep" "1")
14711 (set_attr "length_immediate" "2")
14712 (set_attr "mode" "TI")])
14714 (define_insn "sse4a_insertq"
14715 [(set (match_operand:V2DI 0 "register_operand" "=x")
14716 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
14717 (match_operand:V2DI 2 "register_operand" "x")]
14720 "insertq\t{%2, %0|%0, %2}"
14721 [(set_attr "type" "sseins")
14722 (set_attr "prefix_data16" "0")
14723 (set_attr "prefix_rep" "1")
14724 (set_attr "mode" "TI")])
14726 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14728 ;; Intel SSE4.1 instructions
14730 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14732 ;; Mapping of immediate bits for blend instructions
14733 (define_mode_attr blendbits
14734 [(V8SF "255") (V4SF "15") (V4DF "15") (V2DF "3")])
14736 (define_insn "<sse4_1>_blend<ssemodesuffix><avxsizesuffix>"
14737 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
14738 (vec_merge:VF_128_256
14739 (match_operand:VF_128_256 2 "vector_operand" "YrBm,*xBm,xm")
14740 (match_operand:VF_128_256 1 "register_operand" "0,0,x")
14741 (match_operand:SI 3 "const_0_to_<blendbits>_operand")))]
14744 blend<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
14745 blend<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
14746 vblend<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
14747 [(set_attr "isa" "noavx,noavx,avx")
14748 (set_attr "type" "ssemov")
14749 (set_attr "length_immediate" "1")
14750 (set_attr "prefix_data16" "1,1,*")
14751 (set_attr "prefix_extra" "1")
14752 (set_attr "prefix" "orig,orig,vex")
14753 (set_attr "mode" "<MODE>")])
14755 (define_insn "<sse4_1>_blendv<ssemodesuffix><avxsizesuffix>"
14756 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
14758 [(match_operand:VF_128_256 1 "register_operand" "0,0,x")
14759 (match_operand:VF_128_256 2 "vector_operand" "YrBm,*xBm,xm")
14760 (match_operand:VF_128_256 3 "register_operand" "Yz,Yz,x")]
14764 blendv<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
14765 blendv<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
14766 vblendv<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
14767 [(set_attr "isa" "noavx,noavx,avx")
14768 (set_attr "type" "ssemov")
14769 (set_attr "length_immediate" "1")
14770 (set_attr "prefix_data16" "1,1,*")
14771 (set_attr "prefix_extra" "1")
14772 (set_attr "prefix" "orig,orig,vex")
14773 (set_attr "btver2_decode" "vector,vector,vector")
14774 (set_attr "mode" "<MODE>")])
14776 (define_insn "<sse4_1>_dp<ssemodesuffix><avxsizesuffix>"
14777 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
14779 [(match_operand:VF_128_256 1 "vector_operand" "%0,0,x")
14780 (match_operand:VF_128_256 2 "vector_operand" "YrBm,*xBm,xm")
14781 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")]
14785 dp<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
14786 dp<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
14787 vdp<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
14788 [(set_attr "isa" "noavx,noavx,avx")
14789 (set_attr "type" "ssemul")
14790 (set_attr "length_immediate" "1")
14791 (set_attr "prefix_data16" "1,1,*")
14792 (set_attr "prefix_extra" "1")
14793 (set_attr "prefix" "orig,orig,vex")
14794 (set_attr "btver2_decode" "vector,vector,vector")
14795 (set_attr "znver1_decode" "vector,vector,vector")
14796 (set_attr "mode" "<MODE>")])
14798 ;; Mode attribute used by `vmovntdqa' pattern
14799 (define_mode_attr vi8_sse4_1_avx2_avx512
14800 [(V2DI "sse4_1") (V4DI "avx2") (V8DI "avx512f")])
14802 (define_insn "<vi8_sse4_1_avx2_avx512>_movntdqa"
14803 [(set (match_operand:VI8_AVX2_AVX512F 0 "register_operand" "=Yr,*x, v")
14804 (unspec:VI8_AVX2_AVX512F [(match_operand:VI8_AVX2_AVX512F 1 "memory_operand" "m, m, m")]
14807 "%vmovntdqa\t{%1, %0|%0, %1}"
14808 [(set_attr "type" "ssemov")
14809 (set_attr "prefix_extra" "1,1,*")
14810 (set_attr "prefix" "maybe_vex,maybe_vex,evex")
14811 (set_attr "mode" "<sseinsnmode>")])
14813 (define_insn "<sse4_1_avx2>_mpsadbw"
14814 [(set (match_operand:VI1_AVX2 0 "register_operand" "=Yr,*x,x")
14816 [(match_operand:VI1_AVX2 1 "register_operand" "0,0,x")
14817 (match_operand:VI1_AVX2 2 "vector_operand" "YrBm,*xBm,xm")
14818 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")]
14822 mpsadbw\t{%3, %2, %0|%0, %2, %3}
14823 mpsadbw\t{%3, %2, %0|%0, %2, %3}
14824 vmpsadbw\t{%3, %2, %1, %0|%0, %1, %2, %3}"
14825 [(set_attr "isa" "noavx,noavx,avx")
14826 (set_attr "type" "sselog1")
14827 (set_attr "length_immediate" "1")
14828 (set_attr "prefix_extra" "1")
14829 (set_attr "prefix" "orig,orig,vex")
14830 (set_attr "btver2_decode" "vector,vector,vector")
14831 (set_attr "znver1_decode" "vector,vector,vector")
14832 (set_attr "mode" "<sseinsnmode>")])
14834 (define_insn "<sse4_1_avx2>_packusdw<mask_name>"
14835 [(set (match_operand:VI2_AVX2 0 "register_operand" "=Yr,*x,v")
14836 (vec_concat:VI2_AVX2
14837 (us_truncate:<ssehalfvecmode>
14838 (match_operand:<sseunpackmode> 1 "register_operand" "0,0,v"))
14839 (us_truncate:<ssehalfvecmode>
14840 (match_operand:<sseunpackmode> 2 "vector_operand" "YrBm,*xBm,vm"))))]
14841 "TARGET_SSE4_1 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
14843 packusdw\t{%2, %0|%0, %2}
14844 packusdw\t{%2, %0|%0, %2}
14845 vpackusdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
14846 [(set_attr "isa" "noavx,noavx,avx")
14847 (set_attr "type" "sselog")
14848 (set_attr "prefix_extra" "1")
14849 (set_attr "prefix" "orig,orig,maybe_evex")
14850 (set_attr "mode" "<sseinsnmode>")])
14852 (define_insn "<sse4_1_avx2>_pblendvb"
14853 [(set (match_operand:VI1_AVX2 0 "register_operand" "=Yr,*x,x")
14855 [(match_operand:VI1_AVX2 1 "register_operand" "0,0,x")
14856 (match_operand:VI1_AVX2 2 "vector_operand" "YrBm,*xBm,xm")
14857 (match_operand:VI1_AVX2 3 "register_operand" "Yz,Yz,x")]
14861 pblendvb\t{%3, %2, %0|%0, %2, %3}
14862 pblendvb\t{%3, %2, %0|%0, %2, %3}
14863 vpblendvb\t{%3, %2, %1, %0|%0, %1, %2, %3}"
14864 [(set_attr "isa" "noavx,noavx,avx")
14865 (set_attr "type" "ssemov")
14866 (set_attr "prefix_extra" "1")
14867 (set_attr "length_immediate" "*,*,1")
14868 (set_attr "prefix" "orig,orig,vex")
14869 (set_attr "btver2_decode" "vector,vector,vector")
14870 (set_attr "mode" "<sseinsnmode>")])
14872 (define_insn "sse4_1_pblendw"
14873 [(set (match_operand:V8HI 0 "register_operand" "=Yr,*x,x")
14875 (match_operand:V8HI 2 "vector_operand" "YrBm,*xBm,xm")
14876 (match_operand:V8HI 1 "register_operand" "0,0,x")
14877 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")))]
14880 pblendw\t{%3, %2, %0|%0, %2, %3}
14881 pblendw\t{%3, %2, %0|%0, %2, %3}
14882 vpblendw\t{%3, %2, %1, %0|%0, %1, %2, %3}"
14883 [(set_attr "isa" "noavx,noavx,avx")
14884 (set_attr "type" "ssemov")
14885 (set_attr "prefix_extra" "1")
14886 (set_attr "length_immediate" "1")
14887 (set_attr "prefix" "orig,orig,vex")
14888 (set_attr "mode" "TI")])
14890 ;; The builtin uses an 8-bit immediate. Expand that.
14891 (define_expand "avx2_pblendw"
14892 [(set (match_operand:V16HI 0 "register_operand")
14894 (match_operand:V16HI 2 "nonimmediate_operand")
14895 (match_operand:V16HI 1 "register_operand")
14896 (match_operand:SI 3 "const_0_to_255_operand")))]
14899 HOST_WIDE_INT val = INTVAL (operands[3]) & 0xff;
14900 operands[3] = GEN_INT (val << 8 | val);
14903 (define_insn "*avx2_pblendw"
14904 [(set (match_operand:V16HI 0 "register_operand" "=x")
14906 (match_operand:V16HI 2 "nonimmediate_operand" "xm")
14907 (match_operand:V16HI 1 "register_operand" "x")
14908 (match_operand:SI 3 "avx2_pblendw_operand" "n")))]
14911 operands[3] = GEN_INT (INTVAL (operands[3]) & 0xff);
14912 return "vpblendw\t{%3, %2, %1, %0|%0, %1, %2, %3}";
14914 [(set_attr "type" "ssemov")
14915 (set_attr "prefix_extra" "1")
14916 (set_attr "length_immediate" "1")
14917 (set_attr "prefix" "vex")
14918 (set_attr "mode" "OI")])
14920 (define_insn "avx2_pblendd<mode>"
14921 [(set (match_operand:VI4_AVX2 0 "register_operand" "=x")
14922 (vec_merge:VI4_AVX2
14923 (match_operand:VI4_AVX2 2 "nonimmediate_operand" "xm")
14924 (match_operand:VI4_AVX2 1 "register_operand" "x")
14925 (match_operand:SI 3 "const_0_to_255_operand" "n")))]
14927 "vpblendd\t{%3, %2, %1, %0|%0, %1, %2, %3}"
14928 [(set_attr "type" "ssemov")
14929 (set_attr "prefix_extra" "1")
14930 (set_attr "length_immediate" "1")
14931 (set_attr "prefix" "vex")
14932 (set_attr "mode" "<sseinsnmode>")])
14934 (define_insn "sse4_1_phminposuw"
14935 [(set (match_operand:V8HI 0 "register_operand" "=Yr,*x")
14936 (unspec:V8HI [(match_operand:V8HI 1 "vector_operand" "YrBm,*xBm")]
14937 UNSPEC_PHMINPOSUW))]
14939 "%vphminposuw\t{%1, %0|%0, %1}"
14940 [(set_attr "type" "sselog1")
14941 (set_attr "prefix_extra" "1")
14942 (set_attr "prefix" "maybe_vex")
14943 (set_attr "mode" "TI")])
14945 (define_insn "avx2_<code>v16qiv16hi2<mask_name>"
14946 [(set (match_operand:V16HI 0 "register_operand" "=v")
14948 (match_operand:V16QI 1 "nonimmediate_operand" "vm")))]
14949 "TARGET_AVX2 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
14950 "vpmov<extsuffix>bw\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
14951 [(set_attr "type" "ssemov")
14952 (set_attr "prefix_extra" "1")
14953 (set_attr "prefix" "maybe_evex")
14954 (set_attr "mode" "OI")])
14956 (define_insn "avx512bw_<code>v32qiv32hi2<mask_name>"
14957 [(set (match_operand:V32HI 0 "register_operand" "=v")
14959 (match_operand:V32QI 1 "nonimmediate_operand" "vm")))]
14961 "vpmov<extsuffix>bw\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
14962 [(set_attr "type" "ssemov")
14963 (set_attr "prefix_extra" "1")
14964 (set_attr "prefix" "evex")
14965 (set_attr "mode" "XI")])
14967 (define_insn "sse4_1_<code>v8qiv8hi2<mask_name>"
14968 [(set (match_operand:V8HI 0 "register_operand" "=Yr,*v")
14971 (match_operand:V16QI 1 "nonimmediate_operand" "Yrm,*vm")
14972 (parallel [(const_int 0) (const_int 1)
14973 (const_int 2) (const_int 3)
14974 (const_int 4) (const_int 5)
14975 (const_int 6) (const_int 7)]))))]
14976 "TARGET_SSE4_1 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
14977 "%vpmov<extsuffix>bw\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
14978 [(set_attr "type" "ssemov")
14979 (set_attr "ssememalign" "64")
14980 (set_attr "prefix_extra" "1")
14981 (set_attr "prefix" "maybe_vex")
14982 (set_attr "mode" "TI")])
14984 (define_insn "<mask_codefor>avx512f_<code>v16qiv16si2<mask_name>"
14985 [(set (match_operand:V16SI 0 "register_operand" "=v")
14987 (match_operand:V16QI 1 "nonimmediate_operand" "vm")))]
14989 "vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
14990 [(set_attr "type" "ssemov")
14991 (set_attr "prefix" "evex")
14992 (set_attr "mode" "XI")])
14994 (define_insn "avx2_<code>v8qiv8si2<mask_name>"
14995 [(set (match_operand:V8SI 0 "register_operand" "=v")
14998 (match_operand:V16QI 1 "nonimmediate_operand" "vm")
14999 (parallel [(const_int 0) (const_int 1)
15000 (const_int 2) (const_int 3)
15001 (const_int 4) (const_int 5)
15002 (const_int 6) (const_int 7)]))))]
15003 "TARGET_AVX2 && <mask_avx512vl_condition>"
15004 "vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15005 [(set_attr "type" "ssemov")
15006 (set_attr "prefix_extra" "1")
15007 (set_attr "prefix" "maybe_evex")
15008 (set_attr "mode" "OI")])
15010 (define_insn "sse4_1_<code>v4qiv4si2<mask_name>"
15011 [(set (match_operand:V4SI 0 "register_operand" "=Yr,*v")
15014 (match_operand:V16QI 1 "nonimmediate_operand" "Yrm,*vm")
15015 (parallel [(const_int 0) (const_int 1)
15016 (const_int 2) (const_int 3)]))))]
15017 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15018 "%vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
15019 [(set_attr "type" "ssemov")
15020 (set_attr "ssememalign" "32")
15021 (set_attr "prefix_extra" "1")
15022 (set_attr "prefix" "maybe_vex")
15023 (set_attr "mode" "TI")])
15025 (define_insn "avx512f_<code>v16hiv16si2<mask_name>"
15026 [(set (match_operand:V16SI 0 "register_operand" "=v")
15028 (match_operand:V16HI 1 "nonimmediate_operand" "vm")))]
15030 "vpmov<extsuffix>wd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15031 [(set_attr "type" "ssemov")
15032 (set_attr "prefix" "evex")
15033 (set_attr "mode" "XI")])
15035 (define_insn "avx2_<code>v8hiv8si2<mask_name>"
15036 [(set (match_operand:V8SI 0 "register_operand" "=v")
15038 (match_operand:V8HI 1 "nonimmediate_operand" "vm")))]
15039 "TARGET_AVX2 && <mask_avx512vl_condition>"
15040 "vpmov<extsuffix>wd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15041 [(set_attr "type" "ssemov")
15042 (set_attr "prefix_extra" "1")
15043 (set_attr "prefix" "maybe_evex")
15044 (set_attr "mode" "OI")])
15046 (define_insn "sse4_1_<code>v4hiv4si2<mask_name>"
15047 [(set (match_operand:V4SI 0 "register_operand" "=Yr,*v")
15050 (match_operand:V8HI 1 "nonimmediate_operand" "Yrm,*vm")
15051 (parallel [(const_int 0) (const_int 1)
15052 (const_int 2) (const_int 3)]))))]
15053 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15054 "%vpmov<extsuffix>wd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15055 [(set_attr "type" "ssemov")
15056 (set_attr "ssememalign" "64")
15057 (set_attr "prefix_extra" "1")
15058 (set_attr "prefix" "maybe_vex")
15059 (set_attr "mode" "TI")])
15061 (define_insn "avx512f_<code>v8qiv8di2<mask_name>"
15062 [(set (match_operand:V8DI 0 "register_operand" "=v")
15065 (match_operand:V16QI 1 "nonimmediate_operand" "vm")
15066 (parallel [(const_int 0) (const_int 1)
15067 (const_int 2) (const_int 3)
15068 (const_int 4) (const_int 5)
15069 (const_int 6) (const_int 7)]))))]
15071 "vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
15072 [(set_attr "type" "ssemov")
15073 (set_attr "prefix" "evex")
15074 (set_attr "mode" "XI")])
15076 (define_insn "avx2_<code>v4qiv4di2<mask_name>"
15077 [(set (match_operand:V4DI 0 "register_operand" "=v")
15080 (match_operand:V16QI 1 "nonimmediate_operand" "vm")
15081 (parallel [(const_int 0) (const_int 1)
15082 (const_int 2) (const_int 3)]))))]
15083 "TARGET_AVX2 && <mask_avx512vl_condition>"
15084 "vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
15085 [(set_attr "type" "ssemov")
15086 (set_attr "prefix_extra" "1")
15087 (set_attr "prefix" "maybe_evex")
15088 (set_attr "mode" "OI")])
15090 (define_insn "sse4_1_<code>v2qiv2di2<mask_name>"
15091 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*v")
15094 (match_operand:V16QI 1 "nonimmediate_operand" "Yrm,*vm")
15095 (parallel [(const_int 0) (const_int 1)]))))]
15096 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15097 "%vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %w1}"
15098 [(set_attr "type" "ssemov")
15099 (set_attr "ssememalign" "16")
15100 (set_attr "prefix_extra" "1")
15101 (set_attr "prefix" "maybe_vex")
15102 (set_attr "mode" "TI")])
15104 (define_insn "avx512f_<code>v8hiv8di2<mask_name>"
15105 [(set (match_operand:V8DI 0 "register_operand" "=v")
15107 (match_operand:V8HI 1 "nonimmediate_operand" "vm")))]
15109 "vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15110 [(set_attr "type" "ssemov")
15111 (set_attr "prefix" "evex")
15112 (set_attr "mode" "XI")])
15114 (define_insn "avx2_<code>v4hiv4di2<mask_name>"
15115 [(set (match_operand:V4DI 0 "register_operand" "=v")
15118 (match_operand:V8HI 1 "nonimmediate_operand" "vm")
15119 (parallel [(const_int 0) (const_int 1)
15120 (const_int 2) (const_int 3)]))))]
15121 "TARGET_AVX2 && <mask_avx512vl_condition>"
15122 "vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15123 [(set_attr "type" "ssemov")
15124 (set_attr "prefix_extra" "1")
15125 (set_attr "prefix" "maybe_evex")
15126 (set_attr "mode" "OI")])
15128 (define_insn "sse4_1_<code>v2hiv2di2<mask_name>"
15129 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*v")
15132 (match_operand:V8HI 1 "nonimmediate_operand" "Yrm,*vm")
15133 (parallel [(const_int 0) (const_int 1)]))))]
15134 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15135 "%vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
15136 [(set_attr "type" "ssemov")
15137 (set_attr "ssememalign" "32")
15138 (set_attr "prefix_extra" "1")
15139 (set_attr "prefix" "maybe_vex")
15140 (set_attr "mode" "TI")])
15142 (define_insn "avx512f_<code>v8siv8di2<mask_name>"
15143 [(set (match_operand:V8DI 0 "register_operand" "=v")
15145 (match_operand:V8SI 1 "nonimmediate_operand" "vm")))]
15147 "vpmov<extsuffix>dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15148 [(set_attr "type" "ssemov")
15149 (set_attr "prefix" "evex")
15150 (set_attr "mode" "XI")])
15152 (define_insn "avx2_<code>v4siv4di2<mask_name>"
15153 [(set (match_operand:V4DI 0 "register_operand" "=v")
15155 (match_operand:V4SI 1 "nonimmediate_operand" "vm")))]
15156 "TARGET_AVX2 && <mask_avx512vl_condition>"
15157 "vpmov<extsuffix>dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15158 [(set_attr "type" "ssemov")
15159 (set_attr "prefix" "maybe_evex")
15160 (set_attr "prefix_extra" "1")
15161 (set_attr "mode" "OI")])
15163 (define_insn "sse4_1_<code>v2siv2di2<mask_name>"
15164 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*v")
15167 (match_operand:V4SI 1 "nonimmediate_operand" "Yrm,*vm")
15168 (parallel [(const_int 0) (const_int 1)]))))]
15169 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15170 "%vpmov<extsuffix>dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15171 [(set_attr "type" "ssemov")
15172 (set_attr "ssememalign" "64")
15173 (set_attr "prefix_extra" "1")
15174 (set_attr "prefix" "maybe_vex")
15175 (set_attr "mode" "TI")])
15177 ;; ptestps/ptestpd are very similar to comiss and ucomiss when
15178 ;; setting FLAGS_REG. But it is not a really compare instruction.
15179 (define_insn "avx_vtest<ssemodesuffix><avxsizesuffix>"
15180 [(set (reg:CC FLAGS_REG)
15181 (unspec:CC [(match_operand:VF_128_256 0 "register_operand" "x")
15182 (match_operand:VF_128_256 1 "nonimmediate_operand" "xm")]
15185 "vtest<ssemodesuffix>\t{%1, %0|%0, %1}"
15186 [(set_attr "type" "ssecomi")
15187 (set_attr "prefix_extra" "1")
15188 (set_attr "prefix" "vex")
15189 (set_attr "mode" "<MODE>")])
15191 ;; ptest is very similar to comiss and ucomiss when setting FLAGS_REG.
15192 ;; But it is not a really compare instruction.
15193 (define_insn "<sse4_1>_ptest<mode>"
15194 [(set (reg:CC FLAGS_REG)
15195 (unspec:CC [(match_operand:V_AVX 0 "register_operand" "Yr, *x, x")
15196 (match_operand:V_AVX 1 "vector_operand" "YrBm, *xBm, xm")]
15199 "%vptest\t{%1, %0|%0, %1}"
15200 [(set_attr "isa" "*,*,avx")
15201 (set_attr "type" "ssecomi")
15202 (set_attr "prefix_extra" "1")
15203 (set_attr "prefix" "maybe_vex")
15204 (set (attr "btver2_decode")
15206 (match_test "<sseinsnmode>mode==OImode")
15207 (const_string "vector")
15208 (const_string "*")))
15209 (set_attr "mode" "<sseinsnmode>")])
15211 (define_insn "<sse4_1>_round<ssemodesuffix><avxsizesuffix>"
15212 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x")
15214 [(match_operand:VF_128_256 1 "vector_operand" "YrBm,*xBm")
15215 (match_operand:SI 2 "const_0_to_15_operand" "n,n")]
15218 "%vround<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
15219 [(set_attr "type" "ssecvt")
15220 (set (attr "prefix_data16")
15222 (match_test "TARGET_AVX")
15224 (const_string "1")))
15225 (set_attr "prefix_extra" "1")
15226 (set_attr "length_immediate" "1")
15227 (set_attr "prefix" "maybe_vex")
15228 (set_attr "mode" "<MODE>")])
15230 (define_expand "<sse4_1>_round<ssemodesuffix>_sfix<avxsizesuffix>"
15231 [(match_operand:<sseintvecmode> 0 "register_operand")
15232 (match_operand:VF1_128_256 1 "vector_operand")
15233 (match_operand:SI 2 "const_0_to_15_operand")]
15236 rtx tmp = gen_reg_rtx (<MODE>mode);
15239 (gen_<sse4_1>_round<ssemodesuffix><avxsizesuffix> (tmp, operands[1],
15242 (gen_fix_trunc<mode><sseintvecmodelower>2 (operands[0], tmp));
15246 (define_expand "avx512f_roundpd512"
15247 [(match_operand:V8DF 0 "register_operand")
15248 (match_operand:V8DF 1 "nonimmediate_operand")
15249 (match_operand:SI 2 "const_0_to_15_operand")]
15252 emit_insn (gen_avx512f_rndscalev8df (operands[0], operands[1], operands[2]));
15256 (define_expand "<sse4_1>_round<ssemodesuffix>_vec_pack_sfix<avxsizesuffix>"
15257 [(match_operand:<ssepackfltmode> 0 "register_operand")
15258 (match_operand:VF2 1 "vector_operand")
15259 (match_operand:VF2 2 "vector_operand")
15260 (match_operand:SI 3 "const_0_to_15_operand")]
15265 if (<MODE>mode == V2DFmode
15266 && TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
15268 rtx tmp2 = gen_reg_rtx (V4DFmode);
15270 tmp0 = gen_reg_rtx (V4DFmode);
15271 tmp1 = force_reg (V2DFmode, operands[1]);
15273 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
15274 emit_insn (gen_avx_roundpd256 (tmp2, tmp0, operands[3]));
15275 emit_insn (gen_fix_truncv4dfv4si2 (operands[0], tmp2));
15279 tmp0 = gen_reg_rtx (<MODE>mode);
15280 tmp1 = gen_reg_rtx (<MODE>mode);
15283 (gen_<sse4_1>_round<ssemodesuffix><avxsizesuffix> (tmp0, operands[1],
15286 (gen_<sse4_1>_round<ssemodesuffix><avxsizesuffix> (tmp1, operands[2],
15289 (gen_vec_pack_sfix_trunc_<mode> (operands[0], tmp0, tmp1));
15294 (define_insn "sse4_1_round<ssescalarmodesuffix>"
15295 [(set (match_operand:VF_128 0 "register_operand" "=Yr,*x,x")
15298 [(match_operand:VF_128 2 "register_operand" "Yr,*x,x")
15299 (match_operand:SI 3 "const_0_to_15_operand" "n,n,n")]
15301 (match_operand:VF_128 1 "register_operand" "0,0,x")
15305 round<ssescalarmodesuffix>\t{%3, %2, %0|%0, %2, %3}
15306 round<ssescalarmodesuffix>\t{%3, %2, %0|%0, %2, %3}
15307 vround<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15308 [(set_attr "isa" "noavx,noavx,avx")
15309 (set_attr "type" "ssecvt")
15310 (set_attr "length_immediate" "1")
15311 (set_attr "prefix_data16" "1,1,*")
15312 (set_attr "prefix_extra" "1")
15313 (set_attr "prefix" "orig,orig,vex")
15314 (set_attr "mode" "<MODE>")])
15316 (define_expand "round<mode>2"
15317 [(set (match_dup 4)
15319 (match_operand:VF 1 "register_operand")
15321 (set (match_operand:VF 0 "register_operand")
15323 [(match_dup 4) (match_dup 5)]
15325 "TARGET_ROUND && !flag_trapping_math"
15327 machine_mode scalar_mode;
15328 const struct real_format *fmt;
15329 REAL_VALUE_TYPE pred_half, half_minus_pred_half;
15330 rtx half, vec_half;
15332 scalar_mode = GET_MODE_INNER (<MODE>mode);
15334 /* load nextafter (0.5, 0.0) */
15335 fmt = REAL_MODE_FORMAT (scalar_mode);
15336 real_2expN (&half_minus_pred_half, -(fmt->p) - 1, scalar_mode);
15337 real_arithmetic (&pred_half, MINUS_EXPR, &dconsthalf, &half_minus_pred_half);
15338 half = const_double_from_real_value (pred_half, scalar_mode);
15340 vec_half = ix86_build_const_vector (<MODE>mode, true, half);
15341 vec_half = force_reg (<MODE>mode, vec_half);
15343 operands[3] = gen_reg_rtx (<MODE>mode);
15344 emit_insn (gen_copysign<mode>3 (operands[3], vec_half, operands[1]));
15346 operands[4] = gen_reg_rtx (<MODE>mode);
15347 operands[5] = GEN_INT (ROUND_TRUNC);
15350 (define_expand "round<mode>2_sfix"
15351 [(match_operand:<sseintvecmode> 0 "register_operand")
15352 (match_operand:VF1_128_256 1 "register_operand")]
15353 "TARGET_ROUND && !flag_trapping_math"
15355 rtx tmp = gen_reg_rtx (<MODE>mode);
15357 emit_insn (gen_round<mode>2 (tmp, operands[1]));
15360 (gen_fix_trunc<mode><sseintvecmodelower>2 (operands[0], tmp));
15364 (define_expand "round<mode>2_vec_pack_sfix"
15365 [(match_operand:<ssepackfltmode> 0 "register_operand")
15366 (match_operand:VF2 1 "register_operand")
15367 (match_operand:VF2 2 "register_operand")]
15368 "TARGET_ROUND && !flag_trapping_math"
15372 if (<MODE>mode == V2DFmode
15373 && TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
15375 rtx tmp2 = gen_reg_rtx (V4DFmode);
15377 tmp0 = gen_reg_rtx (V4DFmode);
15378 tmp1 = force_reg (V2DFmode, operands[1]);
15380 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
15381 emit_insn (gen_roundv4df2 (tmp2, tmp0));
15382 emit_insn (gen_fix_truncv4dfv4si2 (operands[0], tmp2));
15386 tmp0 = gen_reg_rtx (<MODE>mode);
15387 tmp1 = gen_reg_rtx (<MODE>mode);
15389 emit_insn (gen_round<mode>2 (tmp0, operands[1]));
15390 emit_insn (gen_round<mode>2 (tmp1, operands[2]));
15393 (gen_vec_pack_sfix_trunc_<mode> (operands[0], tmp0, tmp1));
15398 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15400 ;; Intel SSE4.2 string/text processing instructions
15402 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15404 (define_insn_and_split "sse4_2_pcmpestr"
15405 [(set (match_operand:SI 0 "register_operand" "=c,c")
15407 [(match_operand:V16QI 2 "register_operand" "x,x")
15408 (match_operand:SI 3 "register_operand" "a,a")
15409 (match_operand:V16QI 4 "nonimmediate_operand" "x,m")
15410 (match_operand:SI 5 "register_operand" "d,d")
15411 (match_operand:SI 6 "const_0_to_255_operand" "n,n")]
15413 (set (match_operand:V16QI 1 "register_operand" "=Yz,Yz")
15421 (set (reg:CC FLAGS_REG)
15430 && can_create_pseudo_p ()"
15435 int ecx = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[0]));
15436 int xmm0 = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[1]));
15437 int flags = !find_regno_note (curr_insn, REG_UNUSED, FLAGS_REG);
15440 emit_insn (gen_sse4_2_pcmpestri (operands[0], operands[2],
15441 operands[3], operands[4],
15442 operands[5], operands[6]));
15444 emit_insn (gen_sse4_2_pcmpestrm (operands[1], operands[2],
15445 operands[3], operands[4],
15446 operands[5], operands[6]));
15447 if (flags && !(ecx || xmm0))
15448 emit_insn (gen_sse4_2_pcmpestr_cconly (NULL, NULL,
15449 operands[2], operands[3],
15450 operands[4], operands[5],
15452 if (!(flags || ecx || xmm0))
15453 emit_note (NOTE_INSN_DELETED);
15457 [(set_attr "type" "sselog")
15458 (set_attr "prefix_data16" "1")
15459 (set_attr "prefix_extra" "1")
15460 (set_attr "ssememalign" "8")
15461 (set_attr "length_immediate" "1")
15462 (set_attr "memory" "none,load")
15463 (set_attr "mode" "TI")])
15465 (define_insn_and_split "*sse4_2_pcmpestr_unaligned"
15466 [(set (match_operand:SI 0 "register_operand" "=c")
15468 [(match_operand:V16QI 2 "register_operand" "x")
15469 (match_operand:SI 3 "register_operand" "a")
15471 [(match_operand:V16QI 4 "memory_operand" "m")]
15473 (match_operand:SI 5 "register_operand" "d")
15474 (match_operand:SI 6 "const_0_to_255_operand" "n")]
15476 (set (match_operand:V16QI 1 "register_operand" "=Yz")
15480 (unspec:V16QI [(match_dup 4)] UNSPEC_LOADU)
15484 (set (reg:CC FLAGS_REG)
15488 (unspec:V16QI [(match_dup 4)] UNSPEC_LOADU)
15493 && can_create_pseudo_p ()"
15498 int ecx = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[0]));
15499 int xmm0 = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[1]));
15500 int flags = !find_regno_note (curr_insn, REG_UNUSED, FLAGS_REG);
15503 emit_insn (gen_sse4_2_pcmpestri (operands[0], operands[2],
15504 operands[3], operands[4],
15505 operands[5], operands[6]));
15507 emit_insn (gen_sse4_2_pcmpestrm (operands[1], operands[2],
15508 operands[3], operands[4],
15509 operands[5], operands[6]));
15510 if (flags && !(ecx || xmm0))
15511 emit_insn (gen_sse4_2_pcmpestr_cconly (NULL, NULL,
15512 operands[2], operands[3],
15513 operands[4], operands[5],
15515 if (!(flags || ecx || xmm0))
15516 emit_note (NOTE_INSN_DELETED);
15520 [(set_attr "type" "sselog")
15521 (set_attr "prefix_data16" "1")
15522 (set_attr "prefix_extra" "1")
15523 (set_attr "ssememalign" "8")
15524 (set_attr "length_immediate" "1")
15525 (set_attr "memory" "load")
15526 (set_attr "mode" "TI")])
15528 (define_insn "sse4_2_pcmpestri"
15529 [(set (match_operand:SI 0 "register_operand" "=c,c")
15531 [(match_operand:V16QI 1 "register_operand" "x,x")
15532 (match_operand:SI 2 "register_operand" "a,a")
15533 (match_operand:V16QI 3 "nonimmediate_operand" "x,m")
15534 (match_operand:SI 4 "register_operand" "d,d")
15535 (match_operand:SI 5 "const_0_to_255_operand" "n,n")]
15537 (set (reg:CC FLAGS_REG)
15546 "%vpcmpestri\t{%5, %3, %1|%1, %3, %5}"
15547 [(set_attr "type" "sselog")
15548 (set_attr "prefix_data16" "1")
15549 (set_attr "prefix_extra" "1")
15550 (set_attr "prefix" "maybe_vex")
15551 (set_attr "ssememalign" "8")
15552 (set_attr "length_immediate" "1")
15553 (set_attr "btver2_decode" "vector")
15554 (set_attr "memory" "none,load")
15555 (set_attr "mode" "TI")])
15557 (define_insn "sse4_2_pcmpestrm"
15558 [(set (match_operand:V16QI 0 "register_operand" "=Yz,Yz")
15560 [(match_operand:V16QI 1 "register_operand" "x,x")
15561 (match_operand:SI 2 "register_operand" "a,a")
15562 (match_operand:V16QI 3 "nonimmediate_operand" "x,m")
15563 (match_operand:SI 4 "register_operand" "d,d")
15564 (match_operand:SI 5 "const_0_to_255_operand" "n,n")]
15566 (set (reg:CC FLAGS_REG)
15575 "%vpcmpestrm\t{%5, %3, %1|%1, %3, %5}"
15576 [(set_attr "type" "sselog")
15577 (set_attr "prefix_data16" "1")
15578 (set_attr "prefix_extra" "1")
15579 (set_attr "ssememalign" "8")
15580 (set_attr "length_immediate" "1")
15581 (set_attr "prefix" "maybe_vex")
15582 (set_attr "btver2_decode" "vector")
15583 (set_attr "memory" "none,load")
15584 (set_attr "mode" "TI")])
15586 (define_insn "sse4_2_pcmpestr_cconly"
15587 [(set (reg:CC FLAGS_REG)
15589 [(match_operand:V16QI 2 "register_operand" "x,x,x,x")
15590 (match_operand:SI 3 "register_operand" "a,a,a,a")
15591 (match_operand:V16QI 4 "nonimmediate_operand" "x,m,x,m")
15592 (match_operand:SI 5 "register_operand" "d,d,d,d")
15593 (match_operand:SI 6 "const_0_to_255_operand" "n,n,n,n")]
15595 (clobber (match_scratch:V16QI 0 "=Yz,Yz,X,X"))
15596 (clobber (match_scratch:SI 1 "= X, X,c,c"))]
15599 %vpcmpestrm\t{%6, %4, %2|%2, %4, %6}
15600 %vpcmpestrm\t{%6, %4, %2|%2, %4, %6}
15601 %vpcmpestri\t{%6, %4, %2|%2, %4, %6}
15602 %vpcmpestri\t{%6, %4, %2|%2, %4, %6}"
15603 [(set_attr "type" "sselog")
15604 (set_attr "prefix_data16" "1")
15605 (set_attr "prefix_extra" "1")
15606 (set_attr "ssememalign" "8")
15607 (set_attr "length_immediate" "1")
15608 (set_attr "memory" "none,load,none,load")
15609 (set_attr "btver2_decode" "vector,vector,vector,vector")
15610 (set_attr "prefix" "maybe_vex")
15611 (set_attr "mode" "TI")])
15613 (define_insn_and_split "sse4_2_pcmpistr"
15614 [(set (match_operand:SI 0 "register_operand" "=c,c")
15616 [(match_operand:V16QI 2 "register_operand" "x,x")
15617 (match_operand:V16QI 3 "nonimmediate_operand" "x,m")
15618 (match_operand:SI 4 "const_0_to_255_operand" "n,n")]
15620 (set (match_operand:V16QI 1 "register_operand" "=Yz,Yz")
15626 (set (reg:CC FLAGS_REG)
15633 && can_create_pseudo_p ()"
15638 int ecx = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[0]));
15639 int xmm0 = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[1]));
15640 int flags = !find_regno_note (curr_insn, REG_UNUSED, FLAGS_REG);
15643 emit_insn (gen_sse4_2_pcmpistri (operands[0], operands[2],
15644 operands[3], operands[4]));
15646 emit_insn (gen_sse4_2_pcmpistrm (operands[1], operands[2],
15647 operands[3], operands[4]));
15648 if (flags && !(ecx || xmm0))
15649 emit_insn (gen_sse4_2_pcmpistr_cconly (NULL, NULL,
15650 operands[2], operands[3],
15652 if (!(flags || ecx || xmm0))
15653 emit_note (NOTE_INSN_DELETED);
15657 [(set_attr "type" "sselog")
15658 (set_attr "prefix_data16" "1")
15659 (set_attr "prefix_extra" "1")
15660 (set_attr "ssememalign" "8")
15661 (set_attr "length_immediate" "1")
15662 (set_attr "memory" "none,load")
15663 (set_attr "mode" "TI")])
15665 (define_insn_and_split "*sse4_2_pcmpistr_unaligned"
15666 [(set (match_operand:SI 0 "register_operand" "=c")
15668 [(match_operand:V16QI 2 "register_operand" "x")
15670 [(match_operand:V16QI 3 "memory_operand" "m")]
15672 (match_operand:SI 4 "const_0_to_255_operand" "n")]
15674 (set (match_operand:V16QI 1 "register_operand" "=Yz")
15677 (unspec:V16QI [(match_dup 3)] UNSPEC_LOADU)
15680 (set (reg:CC FLAGS_REG)
15683 (unspec:V16QI [(match_dup 3)] UNSPEC_LOADU)
15687 && can_create_pseudo_p ()"
15692 int ecx = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[0]));
15693 int xmm0 = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[1]));
15694 int flags = !find_regno_note (curr_insn, REG_UNUSED, FLAGS_REG);
15697 emit_insn (gen_sse4_2_pcmpistri (operands[0], operands[2],
15698 operands[3], operands[4]));
15700 emit_insn (gen_sse4_2_pcmpistrm (operands[1], operands[2],
15701 operands[3], operands[4]));
15702 if (flags && !(ecx || xmm0))
15703 emit_insn (gen_sse4_2_pcmpistr_cconly (NULL, NULL,
15704 operands[2], operands[3],
15706 if (!(flags || ecx || xmm0))
15707 emit_note (NOTE_INSN_DELETED);
15711 [(set_attr "type" "sselog")
15712 (set_attr "prefix_data16" "1")
15713 (set_attr "prefix_extra" "1")
15714 (set_attr "ssememalign" "8")
15715 (set_attr "length_immediate" "1")
15716 (set_attr "memory" "load")
15717 (set_attr "mode" "TI")])
15719 (define_insn "sse4_2_pcmpistri"
15720 [(set (match_operand:SI 0 "register_operand" "=c,c")
15722 [(match_operand:V16QI 1 "register_operand" "x,x")
15723 (match_operand:V16QI 2 "nonimmediate_operand" "x,m")
15724 (match_operand:SI 3 "const_0_to_255_operand" "n,n")]
15726 (set (reg:CC FLAGS_REG)
15733 "%vpcmpistri\t{%3, %2, %1|%1, %2, %3}"
15734 [(set_attr "type" "sselog")
15735 (set_attr "prefix_data16" "1")
15736 (set_attr "prefix_extra" "1")
15737 (set_attr "ssememalign" "8")
15738 (set_attr "length_immediate" "1")
15739 (set_attr "prefix" "maybe_vex")
15740 (set_attr "memory" "none,load")
15741 (set_attr "btver2_decode" "vector")
15742 (set_attr "mode" "TI")])
15744 (define_insn "sse4_2_pcmpistrm"
15745 [(set (match_operand:V16QI 0 "register_operand" "=Yz,Yz")
15747 [(match_operand:V16QI 1 "register_operand" "x,x")
15748 (match_operand:V16QI 2 "nonimmediate_operand" "x,m")
15749 (match_operand:SI 3 "const_0_to_255_operand" "n,n")]
15751 (set (reg:CC FLAGS_REG)
15758 "%vpcmpistrm\t{%3, %2, %1|%1, %2, %3}"
15759 [(set_attr "type" "sselog")
15760 (set_attr "prefix_data16" "1")
15761 (set_attr "prefix_extra" "1")
15762 (set_attr "ssememalign" "8")
15763 (set_attr "length_immediate" "1")
15764 (set_attr "prefix" "maybe_vex")
15765 (set_attr "memory" "none,load")
15766 (set_attr "btver2_decode" "vector")
15767 (set_attr "mode" "TI")])
15769 (define_insn "sse4_2_pcmpistr_cconly"
15770 [(set (reg:CC FLAGS_REG)
15772 [(match_operand:V16QI 2 "register_operand" "x,x,x,x")
15773 (match_operand:V16QI 3 "nonimmediate_operand" "x,m,x,m")
15774 (match_operand:SI 4 "const_0_to_255_operand" "n,n,n,n")]
15776 (clobber (match_scratch:V16QI 0 "=Yz,Yz,X,X"))
15777 (clobber (match_scratch:SI 1 "= X, X,c,c"))]
15780 %vpcmpistrm\t{%4, %3, %2|%2, %3, %4}
15781 %vpcmpistrm\t{%4, %3, %2|%2, %3, %4}
15782 %vpcmpistri\t{%4, %3, %2|%2, %3, %4}
15783 %vpcmpistri\t{%4, %3, %2|%2, %3, %4}"
15784 [(set_attr "type" "sselog")
15785 (set_attr "prefix_data16" "1")
15786 (set_attr "prefix_extra" "1")
15787 (set_attr "ssememalign" "8")
15788 (set_attr "length_immediate" "1")
15789 (set_attr "memory" "none,load,none,load")
15790 (set_attr "prefix" "maybe_vex")
15791 (set_attr "btver2_decode" "vector,vector,vector,vector")
15792 (set_attr "mode" "TI")])
15794 ;; Packed float variants
15795 (define_mode_attr GATHER_SCATTER_SF_MEM_MODE
15796 [(V8DI "V8SF") (V16SI "V16SF")])
15798 (define_expand "avx512pf_gatherpf<mode>sf"
15800 [(match_operand:<avx512fmaskmode> 0 "register_operand")
15801 (mem:<GATHER_SCATTER_SF_MEM_MODE>
15803 [(match_operand 2 "vsib_address_operand")
15804 (match_operand:VI48_512 1 "register_operand")
15805 (match_operand:SI 3 "const1248_operand")]))
15806 (match_operand:SI 4 "const_2_to_3_operand")]
15807 UNSPEC_GATHER_PREFETCH)]
15811 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
15812 operands[3]), UNSPEC_VSIBADDR);
15815 (define_insn "*avx512pf_gatherpf<mode>sf_mask"
15817 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
15818 (match_operator:<GATHER_SCATTER_SF_MEM_MODE> 5 "vsib_mem_operator"
15820 [(match_operand:P 2 "vsib_address_operand" "Tv")
15821 (match_operand:VI48_512 1 "register_operand" "v")
15822 (match_operand:SI 3 "const1248_operand" "n")]
15824 (match_operand:SI 4 "const_2_to_3_operand" "n")]
15825 UNSPEC_GATHER_PREFETCH)]
15828 switch (INTVAL (operands[4]))
15831 return "vgatherpf0<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
15833 return "vgatherpf1<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
15835 gcc_unreachable ();
15838 [(set_attr "type" "sse")
15839 (set_attr "prefix" "evex")
15840 (set_attr "mode" "XI")])
15842 ;; Packed double variants
15843 (define_expand "avx512pf_gatherpf<mode>df"
15845 [(match_operand:<avx512fmaskmode> 0 "register_operand")
15848 [(match_operand 2 "vsib_address_operand")
15849 (match_operand:VI4_256_8_512 1 "register_operand")
15850 (match_operand:SI 3 "const1248_operand")]))
15851 (match_operand:SI 4 "const_2_to_3_operand")]
15852 UNSPEC_GATHER_PREFETCH)]
15856 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
15857 operands[3]), UNSPEC_VSIBADDR);
15860 (define_insn "*avx512pf_gatherpf<mode>df_mask"
15862 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
15863 (match_operator:V8DF 5 "vsib_mem_operator"
15865 [(match_operand:P 2 "vsib_address_operand" "Tv")
15866 (match_operand:VI4_256_8_512 1 "register_operand" "v")
15867 (match_operand:SI 3 "const1248_operand" "n")]
15869 (match_operand:SI 4 "const_2_to_3_operand" "n")]
15870 UNSPEC_GATHER_PREFETCH)]
15873 switch (INTVAL (operands[4]))
15876 return "vgatherpf0<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
15878 return "vgatherpf1<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
15880 gcc_unreachable ();
15883 [(set_attr "type" "sse")
15884 (set_attr "prefix" "evex")
15885 (set_attr "mode" "XI")])
15887 ;; Packed float variants
15888 (define_expand "avx512pf_scatterpf<mode>sf"
15890 [(match_operand:<avx512fmaskmode> 0 "register_operand")
15891 (mem:<GATHER_SCATTER_SF_MEM_MODE>
15893 [(match_operand 2 "vsib_address_operand")
15894 (match_operand:VI48_512 1 "register_operand")
15895 (match_operand:SI 3 "const1248_operand")]))
15896 (match_operand:SI 4 "const2367_operand")]
15897 UNSPEC_SCATTER_PREFETCH)]
15901 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
15902 operands[3]), UNSPEC_VSIBADDR);
15905 (define_insn "*avx512pf_scatterpf<mode>sf_mask"
15907 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
15908 (match_operator:<GATHER_SCATTER_SF_MEM_MODE> 5 "vsib_mem_operator"
15910 [(match_operand:P 2 "vsib_address_operand" "Tv")
15911 (match_operand:VI48_512 1 "register_operand" "v")
15912 (match_operand:SI 3 "const1248_operand" "n")]
15914 (match_operand:SI 4 "const2367_operand" "n")]
15915 UNSPEC_SCATTER_PREFETCH)]
15918 switch (INTVAL (operands[4]))
15922 return "vscatterpf0<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
15925 return "vscatterpf1<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
15927 gcc_unreachable ();
15930 [(set_attr "type" "sse")
15931 (set_attr "prefix" "evex")
15932 (set_attr "mode" "XI")])
15934 ;; Packed double variants
15935 (define_expand "avx512pf_scatterpf<mode>df"
15937 [(match_operand:<avx512fmaskmode> 0 "register_operand")
15940 [(match_operand 2 "vsib_address_operand")
15941 (match_operand:VI4_256_8_512 1 "register_operand")
15942 (match_operand:SI 3 "const1248_operand")]))
15943 (match_operand:SI 4 "const2367_operand")]
15944 UNSPEC_SCATTER_PREFETCH)]
15948 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
15949 operands[3]), UNSPEC_VSIBADDR);
15952 (define_insn "*avx512pf_scatterpf<mode>df_mask"
15954 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
15955 (match_operator:V8DF 5 "vsib_mem_operator"
15957 [(match_operand:P 2 "vsib_address_operand" "Tv")
15958 (match_operand:VI4_256_8_512 1 "register_operand" "v")
15959 (match_operand:SI 3 "const1248_operand" "n")]
15961 (match_operand:SI 4 "const2367_operand" "n")]
15962 UNSPEC_SCATTER_PREFETCH)]
15965 switch (INTVAL (operands[4]))
15969 return "vscatterpf0<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
15972 return "vscatterpf1<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
15974 gcc_unreachable ();
15977 [(set_attr "type" "sse")
15978 (set_attr "prefix" "evex")
15979 (set_attr "mode" "XI")])
15981 (define_insn "avx512er_exp2<mode><mask_name><round_saeonly_name>"
15982 [(set (match_operand:VF_512 0 "register_operand" "=v")
15984 [(match_operand:VF_512 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
15987 "vexp2<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
15988 [(set_attr "prefix" "evex")
15989 (set_attr "type" "sse")
15990 (set_attr "mode" "<MODE>")])
15992 (define_insn "<mask_codefor>avx512er_rcp28<mode><mask_name><round_saeonly_name>"
15993 [(set (match_operand:VF_512 0 "register_operand" "=v")
15995 [(match_operand:VF_512 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
15998 "vrcp28<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
15999 [(set_attr "prefix" "evex")
16000 (set_attr "type" "sse")
16001 (set_attr "mode" "<MODE>")])
16003 (define_insn "avx512er_vmrcp28<mode><round_saeonly_name>"
16004 [(set (match_operand:VF_128 0 "register_operand" "=v")
16007 [(match_operand:VF_128 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16009 (match_operand:VF_128 2 "register_operand" "v")
16012 "vrcp28<ssescalarmodesuffix>\t{<round_saeonly_op3>%1, %2, %0|%0, %2, %1<round_saeonly_op3>}"
16013 [(set_attr "length_immediate" "1")
16014 (set_attr "prefix" "evex")
16015 (set_attr "type" "sse")
16016 (set_attr "mode" "<MODE>")])
16018 (define_insn "<mask_codefor>avx512er_rsqrt28<mode><mask_name><round_saeonly_name>"
16019 [(set (match_operand:VF_512 0 "register_operand" "=v")
16021 [(match_operand:VF_512 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16024 "vrsqrt28<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
16025 [(set_attr "prefix" "evex")
16026 (set_attr "type" "sse")
16027 (set_attr "mode" "<MODE>")])
16029 (define_insn "avx512er_vmrsqrt28<mode><round_saeonly_name>"
16030 [(set (match_operand:VF_128 0 "register_operand" "=v")
16033 [(match_operand:VF_128 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16035 (match_operand:VF_128 2 "register_operand" "v")
16038 "vrsqrt28<ssescalarmodesuffix>\t{<round_saeonly_op3>%1, %2, %0|%0, %2, %1<round_saeonly_op3>}"
16039 [(set_attr "length_immediate" "1")
16040 (set_attr "type" "sse")
16041 (set_attr "prefix" "evex")
16042 (set_attr "mode" "<MODE>")])
16044 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16046 ;; XOP instructions
16048 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16050 (define_code_iterator xop_plus [plus ss_plus])
16052 (define_code_attr macs [(plus "macs") (ss_plus "macss")])
16053 (define_code_attr madcs [(plus "madcs") (ss_plus "madcss")])
16055 ;; XOP parallel integer multiply/add instructions.
16057 (define_insn "xop_p<macs><ssemodesuffix><ssemodesuffix>"
16058 [(set (match_operand:VI24_128 0 "register_operand" "=x")
16061 (match_operand:VI24_128 1 "nonimmediate_operand" "%x")
16062 (match_operand:VI24_128 2 "nonimmediate_operand" "xm"))
16063 (match_operand:VI24_128 3 "register_operand" "x")))]
16065 "vp<macs><ssemodesuffix><ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16066 [(set_attr "type" "ssemuladd")
16067 (set_attr "mode" "TI")])
16069 (define_insn "xop_p<macs>dql"
16070 [(set (match_operand:V2DI 0 "register_operand" "=x")
16075 (match_operand:V4SI 1 "nonimmediate_operand" "%x")
16076 (parallel [(const_int 0) (const_int 2)])))
16079 (match_operand:V4SI 2 "nonimmediate_operand" "xm")
16080 (parallel [(const_int 0) (const_int 2)]))))
16081 (match_operand:V2DI 3 "register_operand" "x")))]
16083 "vp<macs>dql\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16084 [(set_attr "type" "ssemuladd")
16085 (set_attr "mode" "TI")])
16087 (define_insn "xop_p<macs>dqh"
16088 [(set (match_operand:V2DI 0 "register_operand" "=x")
16093 (match_operand:V4SI 1 "nonimmediate_operand" "%x")
16094 (parallel [(const_int 1) (const_int 3)])))
16097 (match_operand:V4SI 2 "nonimmediate_operand" "xm")
16098 (parallel [(const_int 1) (const_int 3)]))))
16099 (match_operand:V2DI 3 "register_operand" "x")))]
16101 "vp<macs>dqh\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16102 [(set_attr "type" "ssemuladd")
16103 (set_attr "mode" "TI")])
16105 ;; XOP parallel integer multiply/add instructions for the intrinisics
16106 (define_insn "xop_p<macs>wd"
16107 [(set (match_operand:V4SI 0 "register_operand" "=x")
16112 (match_operand:V8HI 1 "nonimmediate_operand" "%x")
16113 (parallel [(const_int 1) (const_int 3)
16114 (const_int 5) (const_int 7)])))
16117 (match_operand:V8HI 2 "nonimmediate_operand" "xm")
16118 (parallel [(const_int 1) (const_int 3)
16119 (const_int 5) (const_int 7)]))))
16120 (match_operand:V4SI 3 "register_operand" "x")))]
16122 "vp<macs>wd\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16123 [(set_attr "type" "ssemuladd")
16124 (set_attr "mode" "TI")])
16126 (define_insn "xop_p<madcs>wd"
16127 [(set (match_operand:V4SI 0 "register_operand" "=x")
16133 (match_operand:V8HI 1 "nonimmediate_operand" "%x")
16134 (parallel [(const_int 0) (const_int 2)
16135 (const_int 4) (const_int 6)])))
16138 (match_operand:V8HI 2 "nonimmediate_operand" "xm")
16139 (parallel [(const_int 0) (const_int 2)
16140 (const_int 4) (const_int 6)]))))
16145 (parallel [(const_int 1) (const_int 3)
16146 (const_int 5) (const_int 7)])))
16150 (parallel [(const_int 1) (const_int 3)
16151 (const_int 5) (const_int 7)])))))
16152 (match_operand:V4SI 3 "register_operand" "x")))]
16154 "vp<madcs>wd\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16155 [(set_attr "type" "ssemuladd")
16156 (set_attr "mode" "TI")])
16158 ;; XOP parallel XMM conditional moves
16159 (define_insn "xop_pcmov_<mode><avxsizesuffix>"
16160 [(set (match_operand:V 0 "register_operand" "=x,x")
16162 (match_operand:V 3 "nonimmediate_operand" "x,m")
16163 (match_operand:V 1 "register_operand" "x,x")
16164 (match_operand:V 2 "nonimmediate_operand" "xm,x")))]
16166 "vpcmov\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16167 [(set_attr "type" "sse4arg")])
16169 ;; XOP horizontal add/subtract instructions
16170 (define_insn "xop_phadd<u>bw"
16171 [(set (match_operand:V8HI 0 "register_operand" "=x")
16175 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
16176 (parallel [(const_int 0) (const_int 2)
16177 (const_int 4) (const_int 6)
16178 (const_int 8) (const_int 10)
16179 (const_int 12) (const_int 14)])))
16183 (parallel [(const_int 1) (const_int 3)
16184 (const_int 5) (const_int 7)
16185 (const_int 9) (const_int 11)
16186 (const_int 13) (const_int 15)])))))]
16188 "vphadd<u>bw\t{%1, %0|%0, %1}"
16189 [(set_attr "type" "sseiadd1")])
16191 (define_insn "xop_phadd<u>bd"
16192 [(set (match_operand:V4SI 0 "register_operand" "=x")
16197 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
16198 (parallel [(const_int 0) (const_int 4)
16199 (const_int 8) (const_int 12)])))
16203 (parallel [(const_int 1) (const_int 5)
16204 (const_int 9) (const_int 13)]))))
16209 (parallel [(const_int 2) (const_int 6)
16210 (const_int 10) (const_int 14)])))
16214 (parallel [(const_int 3) (const_int 7)
16215 (const_int 11) (const_int 15)]))))))]
16217 "vphadd<u>bd\t{%1, %0|%0, %1}"
16218 [(set_attr "type" "sseiadd1")])
16220 (define_insn "xop_phadd<u>bq"
16221 [(set (match_operand:V2DI 0 "register_operand" "=x")
16227 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
16228 (parallel [(const_int 0) (const_int 8)])))
16232 (parallel [(const_int 1) (const_int 9)]))))
16237 (parallel [(const_int 2) (const_int 10)])))
16241 (parallel [(const_int 3) (const_int 11)])))))
16247 (parallel [(const_int 4) (const_int 12)])))
16251 (parallel [(const_int 5) (const_int 13)]))))
16256 (parallel [(const_int 6) (const_int 14)])))
16260 (parallel [(const_int 7) (const_int 15)])))))))]
16262 "vphadd<u>bq\t{%1, %0|%0, %1}"
16263 [(set_attr "type" "sseiadd1")])
16265 (define_insn "xop_phadd<u>wd"
16266 [(set (match_operand:V4SI 0 "register_operand" "=x")
16270 (match_operand:V8HI 1 "nonimmediate_operand" "xm")
16271 (parallel [(const_int 0) (const_int 2)
16272 (const_int 4) (const_int 6)])))
16276 (parallel [(const_int 1) (const_int 3)
16277 (const_int 5) (const_int 7)])))))]
16279 "vphadd<u>wd\t{%1, %0|%0, %1}"
16280 [(set_attr "type" "sseiadd1")])
16282 (define_insn "xop_phadd<u>wq"
16283 [(set (match_operand:V2DI 0 "register_operand" "=x")
16288 (match_operand:V8HI 1 "nonimmediate_operand" "xm")
16289 (parallel [(const_int 0) (const_int 4)])))
16293 (parallel [(const_int 1) (const_int 5)]))))
16298 (parallel [(const_int 2) (const_int 6)])))
16302 (parallel [(const_int 3) (const_int 7)]))))))]
16304 "vphadd<u>wq\t{%1, %0|%0, %1}"
16305 [(set_attr "type" "sseiadd1")])
16307 (define_insn "xop_phadd<u>dq"
16308 [(set (match_operand:V2DI 0 "register_operand" "=x")
16312 (match_operand:V4SI 1 "nonimmediate_operand" "xm")
16313 (parallel [(const_int 0) (const_int 2)])))
16317 (parallel [(const_int 1) (const_int 3)])))))]
16319 "vphadd<u>dq\t{%1, %0|%0, %1}"
16320 [(set_attr "type" "sseiadd1")])
16322 (define_insn "xop_phsubbw"
16323 [(set (match_operand:V8HI 0 "register_operand" "=x")
16327 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
16328 (parallel [(const_int 0) (const_int 2)
16329 (const_int 4) (const_int 6)
16330 (const_int 8) (const_int 10)
16331 (const_int 12) (const_int 14)])))
16335 (parallel [(const_int 1) (const_int 3)
16336 (const_int 5) (const_int 7)
16337 (const_int 9) (const_int 11)
16338 (const_int 13) (const_int 15)])))))]
16340 "vphsubbw\t{%1, %0|%0, %1}"
16341 [(set_attr "type" "sseiadd1")])
16343 (define_insn "xop_phsubwd"
16344 [(set (match_operand:V4SI 0 "register_operand" "=x")
16348 (match_operand:V8HI 1 "nonimmediate_operand" "xm")
16349 (parallel [(const_int 0) (const_int 2)
16350 (const_int 4) (const_int 6)])))
16354 (parallel [(const_int 1) (const_int 3)
16355 (const_int 5) (const_int 7)])))))]
16357 "vphsubwd\t{%1, %0|%0, %1}"
16358 [(set_attr "type" "sseiadd1")])
16360 (define_insn "xop_phsubdq"
16361 [(set (match_operand:V2DI 0 "register_operand" "=x")
16365 (match_operand:V4SI 1 "nonimmediate_operand" "xm")
16366 (parallel [(const_int 0) (const_int 2)])))
16370 (parallel [(const_int 1) (const_int 3)])))))]
16372 "vphsubdq\t{%1, %0|%0, %1}"
16373 [(set_attr "type" "sseiadd1")])
16375 ;; XOP permute instructions
16376 (define_insn "xop_pperm"
16377 [(set (match_operand:V16QI 0 "register_operand" "=x,x")
16379 [(match_operand:V16QI 1 "register_operand" "x,x")
16380 (match_operand:V16QI 2 "nonimmediate_operand" "x,m")
16381 (match_operand:V16QI 3 "nonimmediate_operand" "xm,x")]
16382 UNSPEC_XOP_PERMUTE))]
16383 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
16384 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16385 [(set_attr "type" "sse4arg")
16386 (set_attr "mode" "TI")])
16388 ;; XOP pack instructions that combine two vectors into a smaller vector
16389 (define_insn "xop_pperm_pack_v2di_v4si"
16390 [(set (match_operand:V4SI 0 "register_operand" "=x,x")
16393 (match_operand:V2DI 1 "register_operand" "x,x"))
16395 (match_operand:V2DI 2 "nonimmediate_operand" "x,m"))))
16396 (use (match_operand:V16QI 3 "nonimmediate_operand" "xm,x"))]
16397 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
16398 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16399 [(set_attr "type" "sse4arg")
16400 (set_attr "mode" "TI")])
16402 (define_insn "xop_pperm_pack_v4si_v8hi"
16403 [(set (match_operand:V8HI 0 "register_operand" "=x,x")
16406 (match_operand:V4SI 1 "register_operand" "x,x"))
16408 (match_operand:V4SI 2 "nonimmediate_operand" "x,m"))))
16409 (use (match_operand:V16QI 3 "nonimmediate_operand" "xm,x"))]
16410 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
16411 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16412 [(set_attr "type" "sse4arg")
16413 (set_attr "mode" "TI")])
16415 (define_insn "xop_pperm_pack_v8hi_v16qi"
16416 [(set (match_operand:V16QI 0 "register_operand" "=x,x")
16419 (match_operand:V8HI 1 "register_operand" "x,x"))
16421 (match_operand:V8HI 2 "nonimmediate_operand" "x,m"))))
16422 (use (match_operand:V16QI 3 "nonimmediate_operand" "xm,x"))]
16423 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
16424 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16425 [(set_attr "type" "sse4arg")
16426 (set_attr "mode" "TI")])
16428 ;; XOP packed rotate instructions
16429 (define_expand "rotl<mode>3"
16430 [(set (match_operand:VI_128 0 "register_operand")
16432 (match_operand:VI_128 1 "nonimmediate_operand")
16433 (match_operand:SI 2 "general_operand")))]
16436 /* If we were given a scalar, convert it to parallel */
16437 if (! const_0_to_<sserotatemax>_operand (operands[2], SImode))
16439 rtvec vs = rtvec_alloc (<ssescalarnum>);
16440 rtx par = gen_rtx_PARALLEL (<MODE>mode, vs);
16441 rtx reg = gen_reg_rtx (<MODE>mode);
16442 rtx op2 = operands[2];
16445 if (GET_MODE (op2) != <ssescalarmode>mode)
16447 op2 = gen_reg_rtx (<ssescalarmode>mode);
16448 convert_move (op2, operands[2], false);
16451 for (i = 0; i < <ssescalarnum>; i++)
16452 RTVEC_ELT (vs, i) = op2;
16454 emit_insn (gen_vec_init<mode> (reg, par));
16455 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], reg));
16460 (define_expand "rotr<mode>3"
16461 [(set (match_operand:VI_128 0 "register_operand")
16463 (match_operand:VI_128 1 "nonimmediate_operand")
16464 (match_operand:SI 2 "general_operand")))]
16467 /* If we were given a scalar, convert it to parallel */
16468 if (! const_0_to_<sserotatemax>_operand (operands[2], SImode))
16470 rtvec vs = rtvec_alloc (<ssescalarnum>);
16471 rtx par = gen_rtx_PARALLEL (<MODE>mode, vs);
16472 rtx neg = gen_reg_rtx (<MODE>mode);
16473 rtx reg = gen_reg_rtx (<MODE>mode);
16474 rtx op2 = operands[2];
16477 if (GET_MODE (op2) != <ssescalarmode>mode)
16479 op2 = gen_reg_rtx (<ssescalarmode>mode);
16480 convert_move (op2, operands[2], false);
16483 for (i = 0; i < <ssescalarnum>; i++)
16484 RTVEC_ELT (vs, i) = op2;
16486 emit_insn (gen_vec_init<mode> (reg, par));
16487 emit_insn (gen_neg<mode>2 (neg, reg));
16488 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], neg));
16493 (define_insn "xop_rotl<mode>3"
16494 [(set (match_operand:VI_128 0 "register_operand" "=x")
16496 (match_operand:VI_128 1 "nonimmediate_operand" "xm")
16497 (match_operand:SI 2 "const_0_to_<sserotatemax>_operand" "n")))]
16499 "vprot<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
16500 [(set_attr "type" "sseishft")
16501 (set_attr "length_immediate" "1")
16502 (set_attr "mode" "TI")])
16504 (define_insn "xop_rotr<mode>3"
16505 [(set (match_operand:VI_128 0 "register_operand" "=x")
16507 (match_operand:VI_128 1 "nonimmediate_operand" "xm")
16508 (match_operand:SI 2 "const_0_to_<sserotatemax>_operand" "n")))]
16512 = GEN_INT (GET_MODE_BITSIZE (<ssescalarmode>mode) - INTVAL (operands[2]));
16513 return \"vprot<ssemodesuffix>\t{%3, %1, %0|%0, %1, %3}\";
16515 [(set_attr "type" "sseishft")
16516 (set_attr "length_immediate" "1")
16517 (set_attr "mode" "TI")])
16519 (define_expand "vrotr<mode>3"
16520 [(match_operand:VI_128 0 "register_operand")
16521 (match_operand:VI_128 1 "register_operand")
16522 (match_operand:VI_128 2 "register_operand")]
16525 rtx reg = gen_reg_rtx (<MODE>mode);
16526 emit_insn (gen_neg<mode>2 (reg, operands[2]));
16527 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], reg));
16531 (define_expand "vrotl<mode>3"
16532 [(match_operand:VI_128 0 "register_operand")
16533 (match_operand:VI_128 1 "register_operand")
16534 (match_operand:VI_128 2 "register_operand")]
16537 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], operands[2]));
16541 (define_insn "xop_vrotl<mode>3"
16542 [(set (match_operand:VI_128 0 "register_operand" "=x,x")
16543 (if_then_else:VI_128
16545 (match_operand:VI_128 2 "nonimmediate_operand" "x,m")
16548 (match_operand:VI_128 1 "nonimmediate_operand" "xm,x")
16552 (neg:VI_128 (match_dup 2)))))]
16553 "TARGET_XOP && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
16554 "vprot<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
16555 [(set_attr "type" "sseishft")
16556 (set_attr "prefix_data16" "0")
16557 (set_attr "prefix_extra" "2")
16558 (set_attr "mode" "TI")])
16560 ;; XOP packed shift instructions.
16561 (define_expand "vlshr<mode>3"
16562 [(set (match_operand:VI12_128 0 "register_operand")
16564 (match_operand:VI12_128 1 "register_operand")
16565 (match_operand:VI12_128 2 "nonimmediate_operand")))]
16568 rtx neg = gen_reg_rtx (<MODE>mode);
16569 emit_insn (gen_neg<mode>2 (neg, operands[2]));
16570 emit_insn (gen_xop_shl<mode>3 (operands[0], operands[1], neg));
16574 (define_expand "vlshr<mode>3"
16575 [(set (match_operand:VI48_128 0 "register_operand")
16577 (match_operand:VI48_128 1 "register_operand")
16578 (match_operand:VI48_128 2 "nonimmediate_operand")))]
16579 "TARGET_AVX2 || TARGET_XOP"
16583 rtx neg = gen_reg_rtx (<MODE>mode);
16584 emit_insn (gen_neg<mode>2 (neg, operands[2]));
16585 emit_insn (gen_xop_shl<mode>3 (operands[0], operands[1], neg));
16590 (define_expand "vlshr<mode>3"
16591 [(set (match_operand:VI48_512 0 "register_operand")
16593 (match_operand:VI48_512 1 "register_operand")
16594 (match_operand:VI48_512 2 "nonimmediate_operand")))]
16597 (define_expand "vlshr<mode>3"
16598 [(set (match_operand:VI48_256 0 "register_operand")
16600 (match_operand:VI48_256 1 "register_operand")
16601 (match_operand:VI48_256 2 "nonimmediate_operand")))]
16604 (define_expand "vashrv8hi3<mask_name>"
16605 [(set (match_operand:V8HI 0 "register_operand")
16607 (match_operand:V8HI 1 "register_operand")
16608 (match_operand:V8HI 2 "nonimmediate_operand")))]
16609 "TARGET_XOP || (TARGET_AVX512BW && TARGET_AVX512VL)"
16613 rtx neg = gen_reg_rtx (V8HImode);
16614 emit_insn (gen_negv8hi2 (neg, operands[2]));
16615 emit_insn (gen_xop_shav8hi3 (operands[0], operands[1], neg));
16620 (define_expand "vashrv16qi3"
16621 [(set (match_operand:V16QI 0 "register_operand")
16623 (match_operand:V16QI 1 "register_operand")
16624 (match_operand:V16QI 2 "nonimmediate_operand")))]
16627 rtx neg = gen_reg_rtx (V16QImode);
16628 emit_insn (gen_negv16qi2 (neg, operands[2]));
16629 emit_insn (gen_xop_shav16qi3 (operands[0], operands[1], neg));
16633 (define_expand "vashrv2di3<mask_name>"
16634 [(set (match_operand:V2DI 0 "register_operand")
16636 (match_operand:V2DI 1 "register_operand")
16637 (match_operand:V2DI 2 "nonimmediate_operand")))]
16638 "TARGET_XOP || TARGET_AVX512VL"
16642 rtx neg = gen_reg_rtx (V2DImode);
16643 emit_insn (gen_negv2di2 (neg, operands[2]));
16644 emit_insn (gen_xop_shav2di3 (operands[0], operands[1], neg));
16649 (define_expand "vashrv4si3"
16650 [(set (match_operand:V4SI 0 "register_operand")
16651 (ashiftrt:V4SI (match_operand:V4SI 1 "register_operand")
16652 (match_operand:V4SI 2 "nonimmediate_operand")))]
16653 "TARGET_AVX2 || TARGET_XOP"
16657 rtx neg = gen_reg_rtx (V4SImode);
16658 emit_insn (gen_negv4si2 (neg, operands[2]));
16659 emit_insn (gen_xop_shav4si3 (operands[0], operands[1], neg));
16664 (define_expand "vashrv16si3"
16665 [(set (match_operand:V16SI 0 "register_operand")
16666 (ashiftrt:V16SI (match_operand:V16SI 1 "register_operand")
16667 (match_operand:V16SI 2 "nonimmediate_operand")))]
16670 (define_expand "vashrv8si3"
16671 [(set (match_operand:V8SI 0 "register_operand")
16672 (ashiftrt:V8SI (match_operand:V8SI 1 "register_operand")
16673 (match_operand:V8SI 2 "nonimmediate_operand")))]
16676 (define_expand "vashl<mode>3"
16677 [(set (match_operand:VI12_128 0 "register_operand")
16679 (match_operand:VI12_128 1 "register_operand")
16680 (match_operand:VI12_128 2 "nonimmediate_operand")))]
16683 emit_insn (gen_xop_sha<mode>3 (operands[0], operands[1], operands[2]));
16687 (define_expand "vashl<mode>3"
16688 [(set (match_operand:VI48_128 0 "register_operand")
16690 (match_operand:VI48_128 1 "register_operand")
16691 (match_operand:VI48_128 2 "nonimmediate_operand")))]
16692 "TARGET_AVX2 || TARGET_XOP"
16696 operands[2] = force_reg (<MODE>mode, operands[2]);
16697 emit_insn (gen_xop_sha<mode>3 (operands[0], operands[1], operands[2]));
16702 (define_expand "vashl<mode>3"
16703 [(set (match_operand:VI48_512 0 "register_operand")
16705 (match_operand:VI48_512 1 "register_operand")
16706 (match_operand:VI48_512 2 "nonimmediate_operand")))]
16709 (define_expand "vashl<mode>3"
16710 [(set (match_operand:VI48_256 0 "register_operand")
16712 (match_operand:VI48_256 1 "register_operand")
16713 (match_operand:VI48_256 2 "nonimmediate_operand")))]
16716 (define_insn "xop_sha<mode>3"
16717 [(set (match_operand:VI_128 0 "register_operand" "=x,x")
16718 (if_then_else:VI_128
16720 (match_operand:VI_128 2 "nonimmediate_operand" "x,m")
16723 (match_operand:VI_128 1 "nonimmediate_operand" "xm,x")
16727 (neg:VI_128 (match_dup 2)))))]
16728 "TARGET_XOP && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
16729 "vpsha<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
16730 [(set_attr "type" "sseishft")
16731 (set_attr "prefix_data16" "0")
16732 (set_attr "prefix_extra" "2")
16733 (set_attr "mode" "TI")])
16735 (define_insn "xop_shl<mode>3"
16736 [(set (match_operand:VI_128 0 "register_operand" "=x,x")
16737 (if_then_else:VI_128
16739 (match_operand:VI_128 2 "nonimmediate_operand" "x,m")
16742 (match_operand:VI_128 1 "nonimmediate_operand" "xm,x")
16746 (neg:VI_128 (match_dup 2)))))]
16747 "TARGET_XOP && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
16748 "vpshl<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
16749 [(set_attr "type" "sseishft")
16750 (set_attr "prefix_data16" "0")
16751 (set_attr "prefix_extra" "2")
16752 (set_attr "mode" "TI")])
16754 (define_expand "<shift_insn><mode>3"
16755 [(set (match_operand:VI1_AVX512 0 "register_operand")
16756 (any_shift:VI1_AVX512
16757 (match_operand:VI1_AVX512 1 "register_operand")
16758 (match_operand:SI 2 "nonmemory_operand")))]
16761 if (TARGET_XOP && <MODE>mode == V16QImode)
16763 bool negate = false;
16764 rtx (*gen) (rtx, rtx, rtx);
16768 if (<CODE> != ASHIFT)
16770 if (CONST_INT_P (operands[2]))
16771 operands[2] = GEN_INT (-INTVAL (operands[2]));
16775 par = gen_rtx_PARALLEL (V16QImode, rtvec_alloc (16));
16776 for (i = 0; i < 16; i++)
16777 XVECEXP (par, 0, i) = operands[2];
16779 tmp = gen_reg_rtx (V16QImode);
16780 emit_insn (gen_vec_initv16qi (tmp, par));
16783 emit_insn (gen_negv16qi2 (tmp, tmp));
16785 gen = (<CODE> == LSHIFTRT ? gen_xop_shlv16qi3 : gen_xop_shav16qi3);
16786 emit_insn (gen (operands[0], operands[1], tmp));
16789 ix86_expand_vecop_qihi (<CODE>, operands[0], operands[1], operands[2]);
16793 (define_expand "ashrv2di3"
16794 [(set (match_operand:V2DI 0 "register_operand")
16796 (match_operand:V2DI 1 "register_operand")
16797 (match_operand:DI 2 "nonmemory_operand")))]
16798 "TARGET_XOP || TARGET_AVX512VL"
16800 if (!TARGET_AVX512VL)
16802 rtx reg = gen_reg_rtx (V2DImode);
16804 bool negate = false;
16807 if (CONST_INT_P (operands[2]))
16808 operands[2] = GEN_INT (-INTVAL (operands[2]));
16812 par = gen_rtx_PARALLEL (V2DImode, rtvec_alloc (2));
16813 for (i = 0; i < 2; i++)
16814 XVECEXP (par, 0, i) = operands[2];
16816 emit_insn (gen_vec_initv2di (reg, par));
16819 emit_insn (gen_negv2di2 (reg, reg));
16821 emit_insn (gen_xop_shav2di3 (operands[0], operands[1], reg));
16826 ;; XOP FRCZ support
16827 (define_insn "xop_frcz<mode>2"
16828 [(set (match_operand:FMAMODE 0 "register_operand" "=x")
16830 [(match_operand:FMAMODE 1 "nonimmediate_operand" "xm")]
16833 "vfrcz<ssemodesuffix>\t{%1, %0|%0, %1}"
16834 [(set_attr "type" "ssecvt1")
16835 (set_attr "mode" "<MODE>")])
16837 (define_expand "xop_vmfrcz<mode>2"
16838 [(set (match_operand:VF_128 0 "register_operand")
16841 [(match_operand:VF_128 1 "nonimmediate_operand")]
16846 "operands[2] = CONST0_RTX (<MODE>mode);")
16848 (define_insn "*xop_vmfrcz<mode>2"
16849 [(set (match_operand:VF_128 0 "register_operand" "=x")
16852 [(match_operand:VF_128 1 "nonimmediate_operand" "xm")]
16854 (match_operand:VF_128 2 "const0_operand")
16857 "vfrcz<ssescalarmodesuffix>\t{%1, %0|%0, %<iptr>1}"
16858 [(set_attr "type" "ssecvt1")
16859 (set_attr "mode" "<MODE>")])
16861 (define_insn "xop_maskcmp<mode>3"
16862 [(set (match_operand:VI_128 0 "register_operand" "=x")
16863 (match_operator:VI_128 1 "ix86_comparison_int_operator"
16864 [(match_operand:VI_128 2 "register_operand" "x")
16865 (match_operand:VI_128 3 "nonimmediate_operand" "xm")]))]
16867 "vpcom%Y1<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}"
16868 [(set_attr "type" "sse4arg")
16869 (set_attr "prefix_data16" "0")
16870 (set_attr "prefix_rep" "0")
16871 (set_attr "prefix_extra" "2")
16872 (set_attr "length_immediate" "1")
16873 (set_attr "mode" "TI")])
16875 (define_insn "xop_maskcmp_uns<mode>3"
16876 [(set (match_operand:VI_128 0 "register_operand" "=x")
16877 (match_operator:VI_128 1 "ix86_comparison_uns_operator"
16878 [(match_operand:VI_128 2 "register_operand" "x")
16879 (match_operand:VI_128 3 "nonimmediate_operand" "xm")]))]
16881 "vpcom%Y1u<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}"
16882 [(set_attr "type" "ssecmp")
16883 (set_attr "prefix_data16" "0")
16884 (set_attr "prefix_rep" "0")
16885 (set_attr "prefix_extra" "2")
16886 (set_attr "length_immediate" "1")
16887 (set_attr "mode" "TI")])
16889 ;; Version of pcom*u* that is called from the intrinsics that allows pcomequ*
16890 ;; and pcomneu* not to be converted to the signed ones in case somebody needs
16891 ;; the exact instruction generated for the intrinsic.
16892 (define_insn "xop_maskcmp_uns2<mode>3"
16893 [(set (match_operand:VI_128 0 "register_operand" "=x")
16895 [(match_operator:VI_128 1 "ix86_comparison_uns_operator"
16896 [(match_operand:VI_128 2 "register_operand" "x")
16897 (match_operand:VI_128 3 "nonimmediate_operand" "xm")])]
16898 UNSPEC_XOP_UNSIGNED_CMP))]
16900 "vpcom%Y1u<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}"
16901 [(set_attr "type" "ssecmp")
16902 (set_attr "prefix_data16" "0")
16903 (set_attr "prefix_extra" "2")
16904 (set_attr "length_immediate" "1")
16905 (set_attr "mode" "TI")])
16907 ;; Pcomtrue and pcomfalse support. These are useless instructions, but are
16908 ;; being added here to be complete.
16909 (define_insn "xop_pcom_tf<mode>3"
16910 [(set (match_operand:VI_128 0 "register_operand" "=x")
16912 [(match_operand:VI_128 1 "register_operand" "x")
16913 (match_operand:VI_128 2 "nonimmediate_operand" "xm")
16914 (match_operand:SI 3 "const_int_operand" "n")]
16915 UNSPEC_XOP_TRUEFALSE))]
16918 return ((INTVAL (operands[3]) != 0)
16919 ? "vpcomtrue<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
16920 : "vpcomfalse<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}");
16922 [(set_attr "type" "ssecmp")
16923 (set_attr "prefix_data16" "0")
16924 (set_attr "prefix_extra" "2")
16925 (set_attr "length_immediate" "1")
16926 (set_attr "mode" "TI")])
16928 (define_insn "xop_vpermil2<mode>3"
16929 [(set (match_operand:VF_128_256 0 "register_operand" "=x")
16931 [(match_operand:VF_128_256 1 "register_operand" "x")
16932 (match_operand:VF_128_256 2 "nonimmediate_operand" "%x")
16933 (match_operand:<sseintvecmode> 3 "nonimmediate_operand" "xm")
16934 (match_operand:SI 4 "const_0_to_3_operand" "n")]
16937 "vpermil2<ssemodesuffix>\t{%4, %3, %2, %1, %0|%0, %1, %2, %3, %4}"
16938 [(set_attr "type" "sse4arg")
16939 (set_attr "length_immediate" "1")
16940 (set_attr "mode" "<MODE>")])
16942 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16944 (define_insn "aesenc"
16945 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
16946 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
16947 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
16951 aesenc\t{%2, %0|%0, %2}
16952 vaesenc\t{%2, %1, %0|%0, %1, %2}"
16953 [(set_attr "isa" "noavx,avx")
16954 (set_attr "type" "sselog1")
16955 (set_attr "prefix_extra" "1")
16956 (set_attr "prefix" "orig,vex")
16957 (set_attr "btver2_decode" "double,double")
16958 (set_attr "mode" "TI")])
16960 (define_insn "aesenclast"
16961 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
16962 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
16963 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
16964 UNSPEC_AESENCLAST))]
16967 aesenclast\t{%2, %0|%0, %2}
16968 vaesenclast\t{%2, %1, %0|%0, %1, %2}"
16969 [(set_attr "isa" "noavx,avx")
16970 (set_attr "type" "sselog1")
16971 (set_attr "prefix_extra" "1")
16972 (set_attr "prefix" "orig,vex")
16973 (set_attr "btver2_decode" "double,double")
16974 (set_attr "mode" "TI")])
16976 (define_insn "aesdec"
16977 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
16978 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
16979 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
16983 aesdec\t{%2, %0|%0, %2}
16984 vaesdec\t{%2, %1, %0|%0, %1, %2}"
16985 [(set_attr "isa" "noavx,avx")
16986 (set_attr "type" "sselog1")
16987 (set_attr "prefix_extra" "1")
16988 (set_attr "prefix" "orig,vex")
16989 (set_attr "btver2_decode" "double,double")
16990 (set_attr "mode" "TI")])
16992 (define_insn "aesdeclast"
16993 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
16994 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
16995 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
16996 UNSPEC_AESDECLAST))]
16999 aesdeclast\t{%2, %0|%0, %2}
17000 vaesdeclast\t{%2, %1, %0|%0, %1, %2}"
17001 [(set_attr "isa" "noavx,avx")
17002 (set_attr "type" "sselog1")
17003 (set_attr "prefix_extra" "1")
17004 (set_attr "prefix" "orig,vex")
17005 (set_attr "btver2_decode" "double,double")
17006 (set_attr "mode" "TI")])
17008 (define_insn "aesimc"
17009 [(set (match_operand:V2DI 0 "register_operand" "=x")
17010 (unspec:V2DI [(match_operand:V2DI 1 "vector_operand" "xBm")]
17013 "%vaesimc\t{%1, %0|%0, %1}"
17014 [(set_attr "type" "sselog1")
17015 (set_attr "prefix_extra" "1")
17016 (set_attr "prefix" "maybe_vex")
17017 (set_attr "mode" "TI")])
17019 (define_insn "aeskeygenassist"
17020 [(set (match_operand:V2DI 0 "register_operand" "=x")
17021 (unspec:V2DI [(match_operand:V2DI 1 "vector_operand" "xBm")
17022 (match_operand:SI 2 "const_0_to_255_operand" "n")]
17023 UNSPEC_AESKEYGENASSIST))]
17025 "%vaeskeygenassist\t{%2, %1, %0|%0, %1, %2}"
17026 [(set_attr "type" "sselog1")
17027 (set_attr "prefix_extra" "1")
17028 (set_attr "length_immediate" "1")
17029 (set_attr "prefix" "maybe_vex")
17030 (set_attr "mode" "TI")])
17032 (define_insn "pclmulqdq"
17033 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17034 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17035 (match_operand:V2DI 2 "vector_operand" "xBm,xm")
17036 (match_operand:SI 3 "const_0_to_255_operand" "n,n")]
17040 pclmulqdq\t{%3, %2, %0|%0, %2, %3}
17041 vpclmulqdq\t{%3, %2, %1, %0|%0, %1, %2, %3}"
17042 [(set_attr "isa" "noavx,avx")
17043 (set_attr "type" "sselog1")
17044 (set_attr "prefix_extra" "1")
17045 (set_attr "length_immediate" "1")
17046 (set_attr "prefix" "orig,vex")
17047 (set_attr "mode" "TI")])
17049 (define_expand "avx_vzeroall"
17050 [(match_par_dup 0 [(const_int 0)])]
17053 int nregs = TARGET_64BIT ? 16 : 8;
17056 operands[0] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (nregs + 1));
17058 XVECEXP (operands[0], 0, 0)
17059 = gen_rtx_UNSPEC_VOLATILE (VOIDmode, gen_rtvec (1, const0_rtx),
17062 for (regno = 0; regno < nregs; regno++)
17063 XVECEXP (operands[0], 0, regno + 1)
17064 = gen_rtx_SET (gen_rtx_REG (V8SImode, SSE_REGNO (regno)),
17065 CONST0_RTX (V8SImode));
17068 (define_insn "*avx_vzeroall"
17069 [(match_parallel 0 "vzeroall_operation"
17070 [(unspec_volatile [(const_int 0)] UNSPECV_VZEROALL)])]
17073 [(set_attr "type" "sse")
17074 (set_attr "modrm" "0")
17075 (set_attr "memory" "none")
17076 (set_attr "prefix" "vex")
17077 (set_attr "btver2_decode" "vector")
17078 (set_attr "mode" "OI")])
17080 ;; Clear the upper 128bits of AVX registers, equivalent to a NOP
17081 ;; if the upper 128bits are unused.
17082 (define_insn "avx_vzeroupper"
17083 [(unspec_volatile [(const_int 0)] UNSPECV_VZEROUPPER)]
17086 [(set_attr "type" "sse")
17087 (set_attr "modrm" "0")
17088 (set_attr "memory" "none")
17089 (set_attr "prefix" "vex")
17090 (set_attr "btver2_decode" "vector")
17091 (set_attr "mode" "OI")])
17093 (define_insn "avx2_pbroadcast<mode>"
17094 [(set (match_operand:VI 0 "register_operand" "=x")
17096 (vec_select:<ssescalarmode>
17097 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "xm")
17098 (parallel [(const_int 0)]))))]
17100 "vpbroadcast<ssemodesuffix>\t{%1, %0|%0, %<iptr>1}"
17101 [(set_attr "type" "ssemov")
17102 (set_attr "prefix_extra" "1")
17103 (set_attr "prefix" "vex")
17104 (set_attr "mode" "<sseinsnmode>")])
17106 (define_insn "avx2_pbroadcast<mode>_1"
17107 [(set (match_operand:VI_256 0 "register_operand" "=x,x")
17108 (vec_duplicate:VI_256
17109 (vec_select:<ssescalarmode>
17110 (match_operand:VI_256 1 "nonimmediate_operand" "m,x")
17111 (parallel [(const_int 0)]))))]
17114 vpbroadcast<ssemodesuffix>\t{%1, %0|%0, %<iptr>1}
17115 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %x1}"
17116 [(set_attr "type" "ssemov")
17117 (set_attr "prefix_extra" "1")
17118 (set_attr "prefix" "vex")
17119 (set_attr "mode" "<sseinsnmode>")])
17121 (define_insn "<avx2_avx512>_permvar<mode><mask_name>"
17122 [(set (match_operand:VI48F_256_512 0 "register_operand" "=v")
17123 (unspec:VI48F_256_512
17124 [(match_operand:VI48F_256_512 1 "nonimmediate_operand" "vm")
17125 (match_operand:<sseintvecmode> 2 "register_operand" "v")]
17127 "TARGET_AVX2 && <mask_mode512bit_condition>"
17128 "vperm<ssemodesuffix>\t{%1, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1}"
17129 [(set_attr "type" "sselog")
17130 (set_attr "prefix" "<mask_prefix2>")
17131 (set_attr "mode" "<sseinsnmode>")])
17133 (define_insn "<avx512>_permvar<mode><mask_name>"
17134 [(set (match_operand:VI1_AVX512VL 0 "register_operand" "=v")
17135 (unspec:VI1_AVX512VL
17136 [(match_operand:VI1_AVX512VL 1 "nonimmediate_operand" "vm")
17137 (match_operand:<sseintvecmode> 2 "register_operand" "v")]
17139 "TARGET_AVX512VBMI && <mask_mode512bit_condition>"
17140 "vperm<ssemodesuffix>\t{%1, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1}"
17141 [(set_attr "type" "sselog")
17142 (set_attr "prefix" "<mask_prefix2>")
17143 (set_attr "mode" "<sseinsnmode>")])
17145 (define_insn "<avx512>_permvar<mode><mask_name>"
17146 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
17147 (unspec:VI2_AVX512VL
17148 [(match_operand:VI2_AVX512VL 1 "nonimmediate_operand" "vm")
17149 (match_operand:<sseintvecmode> 2 "register_operand" "v")]
17151 "TARGET_AVX512BW && <mask_mode512bit_condition>"
17152 "vperm<ssemodesuffix>\t{%1, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1}"
17153 [(set_attr "type" "sselog")
17154 (set_attr "prefix" "<mask_prefix2>")
17155 (set_attr "mode" "<sseinsnmode>")])
17157 (define_expand "<avx2_avx512>_perm<mode>"
17158 [(match_operand:VI8F_256_512 0 "register_operand")
17159 (match_operand:VI8F_256_512 1 "nonimmediate_operand")
17160 (match_operand:SI 2 "const_0_to_255_operand")]
17163 int mask = INTVAL (operands[2]);
17164 emit_insn (gen_<avx2_avx512>_perm<mode>_1 (operands[0], operands[1],
17165 GEN_INT ((mask >> 0) & 3),
17166 GEN_INT ((mask >> 2) & 3),
17167 GEN_INT ((mask >> 4) & 3),
17168 GEN_INT ((mask >> 6) & 3)));
17172 (define_expand "<avx512>_perm<mode>_mask"
17173 [(match_operand:VI8F_256_512 0 "register_operand")
17174 (match_operand:VI8F_256_512 1 "nonimmediate_operand")
17175 (match_operand:SI 2 "const_0_to_255_operand")
17176 (match_operand:VI8F_256_512 3 "vector_move_operand")
17177 (match_operand:<avx512fmaskmode> 4 "register_operand")]
17180 int mask = INTVAL (operands[2]);
17181 emit_insn (gen_<avx2_avx512>_perm<mode>_1_mask (operands[0], operands[1],
17182 GEN_INT ((mask >> 0) & 3),
17183 GEN_INT ((mask >> 2) & 3),
17184 GEN_INT ((mask >> 4) & 3),
17185 GEN_INT ((mask >> 6) & 3),
17186 operands[3], operands[4]));
17190 (define_insn "<avx2_avx512>_perm<mode>_1<mask_name>"
17191 [(set (match_operand:VI8F_256_512 0 "register_operand" "=v")
17192 (vec_select:VI8F_256_512
17193 (match_operand:VI8F_256_512 1 "nonimmediate_operand" "vm")
17194 (parallel [(match_operand 2 "const_0_to_3_operand")
17195 (match_operand 3 "const_0_to_3_operand")
17196 (match_operand 4 "const_0_to_3_operand")
17197 (match_operand 5 "const_0_to_3_operand")])))]
17198 "TARGET_AVX2 && <mask_mode512bit_condition>"
17201 mask |= INTVAL (operands[2]) << 0;
17202 mask |= INTVAL (operands[3]) << 2;
17203 mask |= INTVAL (operands[4]) << 4;
17204 mask |= INTVAL (operands[5]) << 6;
17205 operands[2] = GEN_INT (mask);
17206 return "vperm<ssemodesuffix>\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
17208 [(set_attr "type" "sselog")
17209 (set_attr "prefix" "<mask_prefix2>")
17210 (set_attr "mode" "<sseinsnmode>")])
17212 (define_insn "avx2_permv2ti"
17213 [(set (match_operand:V4DI 0 "register_operand" "=x")
17215 [(match_operand:V4DI 1 "register_operand" "x")
17216 (match_operand:V4DI 2 "nonimmediate_operand" "xm")
17217 (match_operand:SI 3 "const_0_to_255_operand" "n")]
17220 "vperm2i128\t{%3, %2, %1, %0|%0, %1, %2, %3}"
17221 [(set_attr "type" "sselog")
17222 (set_attr "prefix" "vex")
17223 (set_attr "mode" "OI")])
17225 (define_insn "avx2_vec_dupv4df"
17226 [(set (match_operand:V4DF 0 "register_operand" "=x")
17227 (vec_duplicate:V4DF
17229 (match_operand:V2DF 1 "register_operand" "x")
17230 (parallel [(const_int 0)]))))]
17232 "vbroadcastsd\t{%1, %0|%0, %1}"
17233 [(set_attr "type" "sselog1")
17234 (set_attr "prefix" "vex")
17235 (set_attr "mode" "V4DF")])
17237 (define_insn "<avx512>_vec_dup<mode>_1"
17238 [(set (match_operand:VI_AVX512BW 0 "register_operand" "=v,v")
17239 (vec_duplicate:VI_AVX512BW
17240 (vec_select:VI_AVX512BW
17241 (match_operand:VI_AVX512BW 1 "nonimmediate_operand" "v,m")
17242 (parallel [(const_int 0)]))))]
17245 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %x1}
17246 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %<iptr>1}"
17247 [(set_attr "type" "ssemov")
17248 (set_attr "prefix" "evex")
17249 (set_attr "mode" "<sseinsnmode>")])
17251 (define_insn "<avx512>_vec_dup<mode><mask_name>"
17252 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v")
17253 (vec_duplicate:V48_AVX512VL
17254 (vec_select:<ssescalarmode>
17255 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "vm")
17256 (parallel [(const_int 0)]))))]
17259 /* There is no DF broadcast (in AVX-512*) to 128b register.
17260 Mimic it with integer variant. */
17261 if (<MODE>mode == V2DFmode)
17262 return "vpbroadcastq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}";
17264 return "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}";
17266 [(set_attr "type" "ssemov")
17267 (set_attr "prefix" "evex")
17268 (set_attr "mode" "<sseinsnmode>")])
17270 (define_insn "<avx512>_vec_dup<mode><mask_name>"
17271 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
17272 (vec_duplicate:VI12_AVX512VL
17273 (vec_select:<ssescalarmode>
17274 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "vm")
17275 (parallel [(const_int 0)]))))]
17277 "vpbroadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17278 [(set_attr "type" "ssemov")
17279 (set_attr "prefix" "evex")
17280 (set_attr "mode" "<sseinsnmode>")])
17282 (define_insn "<mask_codefor>avx512f_broadcast<mode><mask_name>"
17283 [(set (match_operand:V16FI 0 "register_operand" "=v,v")
17284 (vec_duplicate:V16FI
17285 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "v,m")))]
17288 vshuf<shuffletype>32x4\t{$0x0, %g1, %g1, %0<mask_operand2>|%0<mask_operand2>, %g1, %g1, 0x0}
17289 vbroadcast<shuffletype>32x4\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17290 [(set_attr "type" "ssemov")
17291 (set_attr "prefix" "evex")
17292 (set_attr "mode" "<sseinsnmode>")])
17294 (define_insn "<mask_codefor>avx512f_broadcast<mode><mask_name>"
17295 [(set (match_operand:V8FI 0 "register_operand" "=v,v")
17296 (vec_duplicate:V8FI
17297 (match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "v,m")))]
17300 vshuf<shuffletype>64x2\t{$0x44, %g1, %g1, %0<mask_operand2>|%0<mask_operand2>, %g1, %g1, 0x44}
17301 vbroadcast<shuffletype>64x4\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17302 [(set_attr "type" "ssemov")
17303 (set_attr "prefix" "evex")
17304 (set_attr "mode" "<sseinsnmode>")])
17306 (define_insn "<mask_codefor><avx512>_vec_dup_gpr<mode><mask_name>"
17307 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v,v")
17308 (vec_duplicate:VI12_AVX512VL
17309 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "vm,r")))]
17312 vpbroadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}
17313 vpbroadcast<bcstscalarsuff>\t{%k1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
17314 [(set_attr "type" "ssemov")
17315 (set_attr "prefix" "evex")
17316 (set_attr "mode" "<sseinsnmode>")])
17318 (define_insn "<mask_codefor><avx512>_vec_dup_gpr<mode><mask_name>"
17319 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v,v")
17320 (vec_duplicate:V48_AVX512VL
17321 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "vm,r")))]
17323 "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17324 [(set_attr "type" "ssemov")
17325 (set_attr "prefix" "evex")
17326 (set_attr "mode" "<sseinsnmode>")
17327 (set (attr "enabled")
17328 (if_then_else (eq_attr "alternative" "1")
17329 (symbol_ref "GET_MODE_CLASS (<ssescalarmode>mode) == MODE_INT
17330 && (<ssescalarmode>mode != DImode || TARGET_64BIT)")
17333 (define_insn "vec_dupv4sf"
17334 [(set (match_operand:V4SF 0 "register_operand" "=x,x,x")
17335 (vec_duplicate:V4SF
17336 (match_operand:SF 1 "nonimmediate_operand" "x,m,0")))]
17339 vshufps\t{$0, %1, %1, %0|%0, %1, %1, 0}
17340 vbroadcastss\t{%1, %0|%0, %1}
17341 shufps\t{$0, %0, %0|%0, %0, 0}"
17342 [(set_attr "isa" "avx,avx,noavx")
17343 (set_attr "type" "sseshuf1,ssemov,sseshuf1")
17344 (set_attr "length_immediate" "1,0,1")
17345 (set_attr "prefix_extra" "0,1,*")
17346 (set_attr "prefix" "vex,vex,orig")
17347 (set_attr "mode" "V4SF")])
17349 (define_insn "*vec_dupv4si"
17350 [(set (match_operand:V4SI 0 "register_operand" "=x,x,x")
17351 (vec_duplicate:V4SI
17352 (match_operand:SI 1 "nonimmediate_operand" " x,m,0")))]
17355 %vpshufd\t{$0, %1, %0|%0, %1, 0}
17356 vbroadcastss\t{%1, %0|%0, %1}
17357 shufps\t{$0, %0, %0|%0, %0, 0}"
17358 [(set_attr "isa" "sse2,avx,noavx")
17359 (set_attr "type" "sselog1,ssemov,sselog1")
17360 (set_attr "length_immediate" "1,0,1")
17361 (set_attr "prefix_extra" "0,1,*")
17362 (set_attr "prefix" "maybe_vex,vex,orig")
17363 (set_attr "mode" "TI,V4SF,V4SF")])
17365 (define_insn "*vec_dupv2di"
17366 [(set (match_operand:V2DI 0 "register_operand" "=x,x,x,x")
17367 (vec_duplicate:V2DI
17368 (match_operand:DI 1 "nonimmediate_operand" " 0,x,m,0")))]
17372 vpunpcklqdq\t{%d1, %0|%0, %d1}
17373 %vmovddup\t{%1, %0|%0, %1}
17375 [(set_attr "isa" "sse2_noavx,avx,sse3,noavx")
17376 (set_attr "type" "sselog1,sselog1,sselog1,ssemov")
17377 (set_attr "prefix" "orig,vex,maybe_vex,orig")
17378 (set_attr "mode" "TI,TI,DF,V4SF")])
17380 (define_insn "avx2_vbroadcasti128_<mode>"
17381 [(set (match_operand:VI_256 0 "register_operand" "=x")
17383 (match_operand:<ssehalfvecmode> 1 "memory_operand" "m")
17386 "vbroadcasti128\t{%1, %0|%0, %1}"
17387 [(set_attr "type" "ssemov")
17388 (set_attr "prefix_extra" "1")
17389 (set_attr "prefix" "vex")
17390 (set_attr "mode" "OI")])
17392 ;; Modes handled by AVX vec_dup patterns.
17393 (define_mode_iterator AVX_VEC_DUP_MODE
17394 [V8SI V8SF V4DI V4DF])
17395 ;; Modes handled by AVX2 vec_dup patterns.
17396 (define_mode_iterator AVX2_VEC_DUP_MODE
17397 [V32QI V16QI V16HI V8HI V8SI V4SI])
17399 (define_insn "*vec_dup<mode>"
17400 [(set (match_operand:AVX2_VEC_DUP_MODE 0 "register_operand" "=x,x,Yi")
17401 (vec_duplicate:AVX2_VEC_DUP_MODE
17402 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "m,x,$r")))]
17405 v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0|%0, %1}
17406 v<sseintprefix>broadcast<bcstscalarsuff>\t{%x1, %0|%0, %x1}
17408 [(set_attr "isa" "*,*,noavx512vl")
17409 (set_attr "type" "ssemov")
17410 (set_attr "prefix_extra" "1")
17411 (set_attr "prefix" "maybe_evex")
17412 (set_attr "mode" "<sseinsnmode>")])
17414 (define_insn "vec_dup<mode>"
17415 [(set (match_operand:AVX_VEC_DUP_MODE 0 "register_operand" "=x,x,x,v,x")
17416 (vec_duplicate:AVX_VEC_DUP_MODE
17417 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "m,m,x,v,?x")))]
17420 v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0|%0, %1}
17421 vbroadcast<ssescalarmodesuffix>\t{%1, %0|%0, %1}
17422 v<sseintprefix>broadcast<bcstscalarsuff>\t{%x1, %0|%0, %x1}
17423 v<sseintprefix>broadcast<bcstscalarsuff>\t{%x1, %g0|%g0, %x1}
17425 [(set_attr "type" "ssemov")
17426 (set_attr "prefix_extra" "1")
17427 (set_attr "prefix" "maybe_evex")
17428 (set_attr "isa" "avx2,noavx2,avx2,avx512f,noavx2")
17429 (set_attr "mode" "<sseinsnmode>,V8SF,<sseinsnmode>,<sseinsnmode>,V8SF")])
17432 [(set (match_operand:AVX2_VEC_DUP_MODE 0 "register_operand")
17433 (vec_duplicate:AVX2_VEC_DUP_MODE
17434 (match_operand:<ssescalarmode> 1 "register_operand")))]
17436 /* Disable this splitter if avx512vl_vec_dup_gprv*[qhs]i insn is
17437 available, because then we can broadcast from GPRs directly.
17438 For V*[QH]I modes it requires both -mavx512vl and -mavx512bw,
17439 for V*SI mode it requires just -mavx512vl. */
17440 && !(TARGET_AVX512VL
17441 && (TARGET_AVX512BW || <ssescalarmode>mode == SImode))
17442 && reload_completed && GENERAL_REG_P (operands[1])"
17445 emit_insn (gen_vec_setv4si_0 (gen_lowpart (V4SImode, operands[0]),
17446 CONST0_RTX (V4SImode),
17447 gen_lowpart (SImode, operands[1])));
17448 emit_insn (gen_avx2_pbroadcast<mode> (operands[0],
17449 gen_lowpart (<ssexmmmode>mode,
17455 [(set (match_operand:AVX_VEC_DUP_MODE 0 "register_operand")
17456 (vec_duplicate:AVX_VEC_DUP_MODE
17457 (match_operand:<ssescalarmode> 1 "register_operand")))]
17458 "TARGET_AVX && !TARGET_AVX2 && reload_completed"
17459 [(set (match_dup 2)
17460 (vec_duplicate:<ssehalfvecmode> (match_dup 1)))
17462 (vec_concat:AVX_VEC_DUP_MODE (match_dup 2) (match_dup 2)))]
17463 "operands[2] = gen_rtx_REG (<ssehalfvecmode>mode, REGNO (operands[0]));")
17465 (define_insn "avx_vbroadcastf128_<mode>"
17466 [(set (match_operand:V_256 0 "register_operand" "=x,x,x")
17468 (match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "m,0,?x")
17472 vbroadcast<i128>\t{%1, %0|%0, %1}
17473 vinsert<i128>\t{$1, %1, %0, %0|%0, %0, %1, 1}
17474 vperm2<i128>\t{$0, %t1, %t1, %0|%0, %t1, %t1, 0}"
17475 [(set_attr "type" "ssemov,sselog1,sselog1")
17476 (set_attr "prefix_extra" "1")
17477 (set_attr "length_immediate" "0,1,1")
17478 (set_attr "prefix" "vex")
17479 (set_attr "mode" "<sseinsnmode>")])
17481 ;; For broadcast[i|f]32x2. Yes there is no v4sf version, only v4si.
17482 (define_mode_iterator VI4F_BRCST32x2
17483 [V16SI (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")
17484 V16SF (V8SF "TARGET_AVX512VL")])
17486 (define_mode_attr 64x2mode
17487 [(V8DF "V2DF") (V8DI "V2DI") (V4DI "V2DI") (V4DF "V2DF")])
17489 (define_mode_attr 32x2mode
17490 [(V16SF "V2SF") (V16SI "V2SI") (V8SI "V2SI")
17491 (V8SF "V2SF") (V4SI "V2SI")])
17493 (define_insn "<mask_codefor>avx512dq_broadcast<mode><mask_name>"
17494 [(set (match_operand:VI4F_BRCST32x2 0 "register_operand" "=v")
17495 (vec_duplicate:VI4F_BRCST32x2
17496 (vec_select:<32x2mode>
17497 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "vm")
17498 (parallel [(const_int 0) (const_int 1)]))))]
17500 "vbroadcast<shuffletype>32x2\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17501 [(set_attr "type" "ssemov")
17502 (set_attr "prefix_extra" "1")
17503 (set_attr "prefix" "evex")
17504 (set_attr "mode" "<sseinsnmode>")])
17506 (define_insn "<mask_codefor>avx512vl_broadcast<mode><mask_name>_1"
17507 [(set (match_operand:VI4F_256 0 "register_operand" "=v,v")
17508 (vec_duplicate:VI4F_256
17509 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "v,m")))]
17512 vshuf<shuffletype>32x4\t{$0x0, %t1, %t1, %0<mask_operand2>|%0<mask_operand2>, %t1, %t1, 0x0}
17513 vbroadcast<shuffletype>32x4\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17514 [(set_attr "type" "ssemov")
17515 (set_attr "prefix_extra" "1")
17516 (set_attr "prefix" "evex")
17517 (set_attr "mode" "<sseinsnmode>")])
17519 (define_insn "<mask_codefor>avx512dq_broadcast<mode><mask_name>_1"
17520 [(set (match_operand:V16FI 0 "register_operand" "=v,v")
17521 (vec_duplicate:V16FI
17522 (match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "v,m")))]
17525 vshuf<shuffletype>32x4\t{$0x44, %g1, %g1, %0<mask_operand2>|%0<mask_operand2>, %g1, %g1, 0x44}
17526 vbroadcast<shuffletype>32x8\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17527 [(set_attr "type" "ssemov")
17528 (set_attr "prefix_extra" "1")
17529 (set_attr "prefix" "evex")
17530 (set_attr "mode" "<sseinsnmode>")])
17532 ;; For broadcast[i|f]64x2
17533 (define_mode_iterator VI8F_BRCST64x2
17534 [V8DI V8DF (V4DI "TARGET_AVX512VL") (V4DF "TARGET_AVX512VL")])
17536 (define_insn "<mask_codefor>avx512dq_broadcast<mode><mask_name>_1"
17537 [(set (match_operand:VI8F_BRCST64x2 0 "register_operand" "=v,v")
17538 (vec_duplicate:VI8F_BRCST64x2
17539 (match_operand:<64x2mode> 1 "nonimmediate_operand" "v,m")))]
17542 vshuf<shuffletype>64x2\t{$0x0, %<concat_tg_mode>1, %<concat_tg_mode>1, %0<mask_operand2>|%0<mask_operand2>, %<concat_tg_mode>1, %<concat_tg_mode>1, 0x0}
17543 vbroadcast<shuffletype>64x2\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17544 [(set_attr "type" "ssemov")
17545 (set_attr "prefix_extra" "1")
17546 (set_attr "prefix" "evex")
17547 (set_attr "mode" "<sseinsnmode>")])
17549 (define_insn "avx512cd_maskb_vec_dup<mode>"
17550 [(set (match_operand:VI8_AVX512VL 0 "register_operand" "=v")
17551 (vec_duplicate:VI8_AVX512VL
17553 (match_operand:QI 1 "register_operand" "Yk"))))]
17555 "vpbroadcastmb2q\t{%1, %0|%0, %1}"
17556 [(set_attr "type" "mskmov")
17557 (set_attr "prefix" "evex")
17558 (set_attr "mode" "XI")])
17560 (define_insn "avx512cd_maskw_vec_dup<mode>"
17561 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
17562 (vec_duplicate:VI4_AVX512VL
17564 (match_operand:HI 1 "register_operand" "Yk"))))]
17566 "vpbroadcastmw2d\t{%1, %0|%0, %1}"
17567 [(set_attr "type" "mskmov")
17568 (set_attr "prefix" "evex")
17569 (set_attr "mode" "XI")])
17571 ;; Recognize broadcast as a vec_select as produced by builtin_vec_perm.
17572 ;; If it so happens that the input is in memory, use vbroadcast.
17573 ;; Otherwise use vpermilp (and in the case of 256-bit modes, vperm2f128).
17574 (define_insn "*avx_vperm_broadcast_v4sf"
17575 [(set (match_operand:V4SF 0 "register_operand" "=x,x,x")
17577 (match_operand:V4SF 1 "nonimmediate_operand" "m,o,x")
17578 (match_parallel 2 "avx_vbroadcast_operand"
17579 [(match_operand 3 "const_int_operand" "C,n,n")])))]
17582 int elt = INTVAL (operands[3]);
17583 switch (which_alternative)
17587 operands[1] = adjust_address_nv (operands[1], SFmode, elt * 4);
17588 return "vbroadcastss\t{%1, %0|%0, %k1}";
17590 operands[2] = GEN_INT (elt * 0x55);
17591 return "vpermilps\t{%2, %1, %0|%0, %1, %2}";
17593 gcc_unreachable ();
17596 [(set_attr "type" "ssemov,ssemov,sselog1")
17597 (set_attr "prefix_extra" "1")
17598 (set_attr "length_immediate" "0,0,1")
17599 (set_attr "prefix" "vex")
17600 (set_attr "mode" "SF,SF,V4SF")])
17602 (define_insn_and_split "*avx_vperm_broadcast_<mode>"
17603 [(set (match_operand:VF_256 0 "register_operand" "=x,x,x")
17605 (match_operand:VF_256 1 "nonimmediate_operand" "m,o,?x")
17606 (match_parallel 2 "avx_vbroadcast_operand"
17607 [(match_operand 3 "const_int_operand" "C,n,n")])))]
17610 "&& reload_completed && (<MODE>mode != V4DFmode || !TARGET_AVX2)"
17611 [(set (match_dup 0) (vec_duplicate:VF_256 (match_dup 1)))]
17613 rtx op0 = operands[0], op1 = operands[1];
17614 int elt = INTVAL (operands[3]);
17620 if (TARGET_AVX2 && elt == 0)
17622 emit_insn (gen_vec_dup<mode> (op0, gen_lowpart (<ssescalarmode>mode,
17627 /* Shuffle element we care about into all elements of the 128-bit lane.
17628 The other lane gets shuffled too, but we don't care. */
17629 if (<MODE>mode == V4DFmode)
17630 mask = (elt & 1 ? 15 : 0);
17632 mask = (elt & 3) * 0x55;
17633 emit_insn (gen_avx_vpermil<mode> (op0, op1, GEN_INT (mask)));
17635 /* Shuffle the lane we care about into both lanes of the dest. */
17636 mask = (elt / (<ssescalarnum> / 2)) * 0x11;
17637 emit_insn (gen_avx_vperm2f128<mode>3 (op0, op0, op0, GEN_INT (mask)));
17641 operands[1] = adjust_address (op1, <ssescalarmode>mode,
17642 elt * GET_MODE_SIZE (<ssescalarmode>mode));
17645 (define_expand "<sse2_avx_avx512f>_vpermil<mode><mask_name>"
17646 [(set (match_operand:VF2 0 "register_operand")
17648 (match_operand:VF2 1 "nonimmediate_operand")
17649 (match_operand:SI 2 "const_0_to_255_operand")))]
17650 "TARGET_AVX && <mask_mode512bit_condition>"
17652 int mask = INTVAL (operands[2]);
17653 rtx perm[<ssescalarnum>];
17656 for (i = 0; i < <ssescalarnum>; i = i + 2)
17658 perm[i] = GEN_INT (((mask >> i) & 1) + i);
17659 perm[i + 1] = GEN_INT (((mask >> (i + 1)) & 1) + i);
17663 = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (<ssescalarnum>, perm));
17666 (define_expand "<sse2_avx_avx512f>_vpermil<mode><mask_name>"
17667 [(set (match_operand:VF1 0 "register_operand")
17669 (match_operand:VF1 1 "nonimmediate_operand")
17670 (match_operand:SI 2 "const_0_to_255_operand")))]
17671 "TARGET_AVX && <mask_mode512bit_condition>"
17673 int mask = INTVAL (operands[2]);
17674 rtx perm[<ssescalarnum>];
17677 for (i = 0; i < <ssescalarnum>; i = i + 4)
17679 perm[i] = GEN_INT (((mask >> 0) & 3) + i);
17680 perm[i + 1] = GEN_INT (((mask >> 2) & 3) + i);
17681 perm[i + 2] = GEN_INT (((mask >> 4) & 3) + i);
17682 perm[i + 3] = GEN_INT (((mask >> 6) & 3) + i);
17686 = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (<ssescalarnum>, perm));
17689 (define_insn "*<sse2_avx_avx512f>_vpermilp<mode><mask_name>"
17690 [(set (match_operand:VF 0 "register_operand" "=v")
17692 (match_operand:VF 1 "nonimmediate_operand" "vm")
17693 (match_parallel 2 ""
17694 [(match_operand 3 "const_int_operand")])))]
17695 "TARGET_AVX && <mask_mode512bit_condition>
17696 && avx_vpermilp_parallel (operands[2], <MODE>mode)"
17698 int mask = avx_vpermilp_parallel (operands[2], <MODE>mode) - 1;
17699 operands[2] = GEN_INT (mask);
17700 return "vpermil<ssemodesuffix>\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}";
17702 [(set_attr "type" "sselog")
17703 (set_attr "prefix_extra" "1")
17704 (set_attr "length_immediate" "1")
17705 (set_attr "prefix" "<mask_prefix>")
17706 (set_attr "mode" "<sseinsnmode>")])
17708 (define_insn "<sse2_avx_avx512f>_vpermilvar<mode>3<mask_name>"
17709 [(set (match_operand:VF 0 "register_operand" "=v")
17711 [(match_operand:VF 1 "register_operand" "v")
17712 (match_operand:<sseintvecmode> 2 "nonimmediate_operand" "vm")]
17714 "TARGET_AVX && <mask_mode512bit_condition>"
17715 "vpermil<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
17716 [(set_attr "type" "sselog")
17717 (set_attr "prefix_extra" "1")
17718 (set_attr "btver2_decode" "vector")
17719 (set_attr "prefix" "<mask_prefix>")
17720 (set_attr "mode" "<sseinsnmode>")])
17722 (define_expand "<avx512>_vpermi2var<mode>3_maskz"
17723 [(match_operand:VI48F 0 "register_operand" "=v")
17724 (match_operand:VI48F 1 "register_operand" "v")
17725 (match_operand:<sseintvecmode> 2 "register_operand" "0")
17726 (match_operand:VI48F 3 "nonimmediate_operand" "vm")
17727 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")]
17730 emit_insn (gen_<avx512>_vpermi2var<mode>3_maskz_1 (
17731 operands[0], operands[1], operands[2], operands[3],
17732 CONST0_RTX (<MODE>mode), operands[4]));
17736 (define_expand "<avx512>_vpermi2var<mode>3_maskz"
17737 [(match_operand:VI1_AVX512VL 0 "register_operand")
17738 (match_operand:VI1_AVX512VL 1 "register_operand")
17739 (match_operand:<sseintvecmode> 2 "register_operand")
17740 (match_operand:VI1_AVX512VL 3 "nonimmediate_operand")
17741 (match_operand:<avx512fmaskmode> 4 "register_operand")]
17742 "TARGET_AVX512VBMI"
17744 emit_insn (gen_<avx512>_vpermi2var<mode>3_maskz_1 (
17745 operands[0], operands[1], operands[2], operands[3],
17746 CONST0_RTX (<MODE>mode), operands[4]));
17750 (define_expand "<avx512>_vpermi2var<mode>3_maskz"
17751 [(match_operand:VI2_AVX512VL 0 "register_operand" "=v")
17752 (match_operand:VI2_AVX512VL 1 "register_operand" "v")
17753 (match_operand:<sseintvecmode> 2 "register_operand" "0")
17754 (match_operand:VI2_AVX512VL 3 "nonimmediate_operand" "vm")
17755 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")]
17758 emit_insn (gen_<avx512>_vpermi2var<mode>3_maskz_1 (
17759 operands[0], operands[1], operands[2], operands[3],
17760 CONST0_RTX (<MODE>mode), operands[4]));
17764 (define_insn "<avx512>_vpermi2var<mode>3<sd_maskz_name>"
17765 [(set (match_operand:VI48F 0 "register_operand" "=v")
17767 [(match_operand:VI48F 1 "register_operand" "v")
17768 (match_operand:<sseintvecmode> 2 "register_operand" "0")
17769 (match_operand:VI48F 3 "nonimmediate_operand" "vm")]
17772 "vpermi2<ssemodesuffix>\t{%3, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %3}"
17773 [(set_attr "type" "sselog")
17774 (set_attr "prefix" "evex")
17775 (set_attr "mode" "<sseinsnmode>")])
17777 (define_insn "<avx512>_vpermi2var<mode>3<sd_maskz_name>"
17778 [(set (match_operand:VI1_AVX512VL 0 "register_operand" "=v")
17779 (unspec:VI1_AVX512VL
17780 [(match_operand:VI1_AVX512VL 1 "register_operand" "v")
17781 (match_operand:<sseintvecmode> 2 "register_operand" "0")
17782 (match_operand:VI1_AVX512VL 3 "nonimmediate_operand" "vm")]
17784 "TARGET_AVX512VBMI"
17785 "vpermi2<ssemodesuffix>\t{%3, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %3}"
17786 [(set_attr "type" "sselog")
17787 (set_attr "prefix" "evex")
17788 (set_attr "mode" "<sseinsnmode>")])
17790 (define_insn "<avx512>_vpermi2var<mode>3<sd_maskz_name>"
17791 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
17792 (unspec:VI2_AVX512VL
17793 [(match_operand:VI2_AVX512VL 1 "register_operand" "v")
17794 (match_operand:<sseintvecmode> 2 "register_operand" "0")
17795 (match_operand:VI2_AVX512VL 3 "nonimmediate_operand" "vm")]
17798 "vpermi2<ssemodesuffix>\t{%3, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %3}"
17799 [(set_attr "type" "sselog")
17800 (set_attr "prefix" "evex")
17801 (set_attr "mode" "<sseinsnmode>")])
17803 (define_insn "<avx512>_vpermi2var<mode>3_mask"
17804 [(set (match_operand:VI48F 0 "register_operand" "=v")
17807 [(match_operand:VI48F 1 "register_operand" "v")
17808 (match_operand:<sseintvecmode> 2 "register_operand" "0")
17809 (match_operand:VI48F 3 "nonimmediate_operand" "vm")]
17810 UNSPEC_VPERMI2_MASK)
17812 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
17814 "vpermi2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
17815 [(set_attr "type" "sselog")
17816 (set_attr "prefix" "evex")
17817 (set_attr "mode" "<sseinsnmode>")])
17819 (define_insn "<avx512>_vpermi2var<mode>3_mask"
17820 [(set (match_operand:VI1_AVX512VL 0 "register_operand" "=v")
17821 (vec_merge:VI1_AVX512VL
17822 (unspec:VI1_AVX512VL
17823 [(match_operand:VI1_AVX512VL 1 "register_operand" "v")
17824 (match_operand:<sseintvecmode> 2 "register_operand" "0")
17825 (match_operand:VI1_AVX512VL 3 "nonimmediate_operand" "vm")]
17826 UNSPEC_VPERMI2_MASK)
17828 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
17829 "TARGET_AVX512VBMI"
17830 "vpermi2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
17831 [(set_attr "type" "sselog")
17832 (set_attr "prefix" "evex")
17833 (set_attr "mode" "<sseinsnmode>")])
17835 (define_insn "<avx512>_vpermi2var<mode>3_mask"
17836 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
17837 (vec_merge:VI2_AVX512VL
17838 (unspec:VI2_AVX512VL
17839 [(match_operand:VI2_AVX512VL 1 "register_operand" "v")
17840 (match_operand:<sseintvecmode> 2 "register_operand" "0")
17841 (match_operand:VI2_AVX512VL 3 "nonimmediate_operand" "vm")]
17842 UNSPEC_VPERMI2_MASK)
17844 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
17846 "vpermi2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
17847 [(set_attr "type" "sselog")
17848 (set_attr "prefix" "evex")
17849 (set_attr "mode" "<sseinsnmode>")])
17851 (define_expand "<avx512>_vpermt2var<mode>3_maskz"
17852 [(match_operand:VI48F 0 "register_operand" "=v")
17853 (match_operand:<sseintvecmode> 1 "register_operand" "v")
17854 (match_operand:VI48F 2 "register_operand" "0")
17855 (match_operand:VI48F 3 "nonimmediate_operand" "vm")
17856 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")]
17859 emit_insn (gen_<avx512>_vpermt2var<mode>3_maskz_1 (
17860 operands[0], operands[1], operands[2], operands[3],
17861 CONST0_RTX (<MODE>mode), operands[4]));
17865 (define_expand "<avx512>_vpermt2var<mode>3_maskz"
17866 [(match_operand:VI1_AVX512VL 0 "register_operand" "=v")
17867 (match_operand:<sseintvecmode> 1 "register_operand" "v")
17868 (match_operand:VI1_AVX512VL 2 "register_operand" "0")
17869 (match_operand:VI1_AVX512VL 3 "nonimmediate_operand" "vm")
17870 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")]
17871 "TARGET_AVX512VBMI"
17873 emit_insn (gen_<avx512>_vpermt2var<mode>3_maskz_1 (
17874 operands[0], operands[1], operands[2], operands[3],
17875 CONST0_RTX (<MODE>mode), operands[4]));
17879 (define_expand "<avx512>_vpermt2var<mode>3_maskz"
17880 [(match_operand:VI2_AVX512VL 0 "register_operand" "=v")
17881 (match_operand:<sseintvecmode> 1 "register_operand" "v")
17882 (match_operand:VI2_AVX512VL 2 "register_operand" "0")
17883 (match_operand:VI2_AVX512VL 3 "nonimmediate_operand" "vm")
17884 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")]
17887 emit_insn (gen_<avx512>_vpermt2var<mode>3_maskz_1 (
17888 operands[0], operands[1], operands[2], operands[3],
17889 CONST0_RTX (<MODE>mode), operands[4]));
17893 (define_insn "<avx512>_vpermt2var<mode>3<sd_maskz_name>"
17894 [(set (match_operand:VI48F 0 "register_operand" "=v")
17896 [(match_operand:<sseintvecmode> 1 "register_operand" "v")
17897 (match_operand:VI48F 2 "register_operand" "0")
17898 (match_operand:VI48F 3 "nonimmediate_operand" "vm")]
17901 "vpermt2<ssemodesuffix>\t{%3, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %3}"
17902 [(set_attr "type" "sselog")
17903 (set_attr "prefix" "evex")
17904 (set_attr "mode" "<sseinsnmode>")])
17906 (define_insn "<avx512>_vpermt2var<mode>3<sd_maskz_name>"
17907 [(set (match_operand:VI1_AVX512VL 0 "register_operand" "=v")
17908 (unspec:VI1_AVX512VL
17909 [(match_operand:<sseintvecmode> 1 "register_operand" "v")
17910 (match_operand:VI1_AVX512VL 2 "register_operand" "0")
17911 (match_operand:VI1_AVX512VL 3 "nonimmediate_operand" "vm")]
17913 "TARGET_AVX512VBMI"
17914 "vpermt2<ssemodesuffix>\t{%3, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %3}"
17915 [(set_attr "type" "sselog")
17916 (set_attr "prefix" "evex")
17917 (set_attr "mode" "<sseinsnmode>")])
17919 (define_insn "<avx512>_vpermt2var<mode>3<sd_maskz_name>"
17920 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
17921 (unspec:VI2_AVX512VL
17922 [(match_operand:<sseintvecmode> 1 "register_operand" "v")
17923 (match_operand:VI2_AVX512VL 2 "register_operand" "0")
17924 (match_operand:VI2_AVX512VL 3 "nonimmediate_operand" "vm")]
17927 "vpermt2<ssemodesuffix>\t{%3, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %3}"
17928 [(set_attr "type" "sselog")
17929 (set_attr "prefix" "evex")
17930 (set_attr "mode" "<sseinsnmode>")])
17932 (define_insn "<avx512>_vpermt2var<mode>3_mask"
17933 [(set (match_operand:VI48F 0 "register_operand" "=v")
17936 [(match_operand:<sseintvecmode> 1 "register_operand" "v")
17937 (match_operand:VI48F 2 "register_operand" "0")
17938 (match_operand:VI48F 3 "nonimmediate_operand" "vm")]
17941 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
17943 "vpermt2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
17944 [(set_attr "type" "sselog")
17945 (set_attr "prefix" "evex")
17946 (set_attr "mode" "<sseinsnmode>")])
17948 (define_insn "<avx512>_vpermt2var<mode>3_mask"
17949 [(set (match_operand:VI1_AVX512VL 0 "register_operand" "=v")
17950 (vec_merge:VI1_AVX512VL
17951 (unspec:VI1_AVX512VL
17952 [(match_operand:<sseintvecmode> 1 "register_operand" "v")
17953 (match_operand:VI1_AVX512VL 2 "register_operand" "0")
17954 (match_operand:VI1_AVX512VL 3 "nonimmediate_operand" "vm")]
17957 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
17958 "TARGET_AVX512VBMI"
17959 "vpermt2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
17960 [(set_attr "type" "sselog")
17961 (set_attr "prefix" "evex")
17962 (set_attr "mode" "<sseinsnmode>")])
17964 (define_insn "<avx512>_vpermt2var<mode>3_mask"
17965 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
17966 (vec_merge:VI2_AVX512VL
17967 (unspec:VI2_AVX512VL
17968 [(match_operand:<sseintvecmode> 1 "register_operand" "v")
17969 (match_operand:VI2_AVX512VL 2 "register_operand" "0")
17970 (match_operand:VI2_AVX512VL 3 "nonimmediate_operand" "vm")]
17973 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
17975 "vpermt2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
17976 [(set_attr "type" "sselog")
17977 (set_attr "prefix" "evex")
17978 (set_attr "mode" "<sseinsnmode>")])
17980 (define_expand "avx_vperm2f128<mode>3"
17981 [(set (match_operand:AVX256MODE2P 0 "register_operand")
17982 (unspec:AVX256MODE2P
17983 [(match_operand:AVX256MODE2P 1 "register_operand")
17984 (match_operand:AVX256MODE2P 2 "nonimmediate_operand")
17985 (match_operand:SI 3 "const_0_to_255_operand")]
17986 UNSPEC_VPERMIL2F128))]
17989 int mask = INTVAL (operands[3]);
17990 if ((mask & 0x88) == 0)
17992 rtx perm[<ssescalarnum>], t1, t2;
17993 int i, base, nelt = <ssescalarnum>, nelt2 = nelt / 2;
17995 base = (mask & 3) * nelt2;
17996 for (i = 0; i < nelt2; ++i)
17997 perm[i] = GEN_INT (base + i);
17999 base = ((mask >> 4) & 3) * nelt2;
18000 for (i = 0; i < nelt2; ++i)
18001 perm[i + nelt2] = GEN_INT (base + i);
18003 t2 = gen_rtx_VEC_CONCAT (<ssedoublevecmode>mode,
18004 operands[1], operands[2]);
18005 t1 = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (nelt, perm));
18006 t2 = gen_rtx_VEC_SELECT (<MODE>mode, t2, t1);
18007 t2 = gen_rtx_SET (operands[0], t2);
18013 ;; Note that bits 7 and 3 of the imm8 allow lanes to be zeroed, which
18014 ;; means that in order to represent this properly in rtl we'd have to
18015 ;; nest *another* vec_concat with a zero operand and do the select from
18016 ;; a 4x wide vector. That doesn't seem very nice.
18017 (define_insn "*avx_vperm2f128<mode>_full"
18018 [(set (match_operand:AVX256MODE2P 0 "register_operand" "=x")
18019 (unspec:AVX256MODE2P
18020 [(match_operand:AVX256MODE2P 1 "register_operand" "x")
18021 (match_operand:AVX256MODE2P 2 "nonimmediate_operand" "xm")
18022 (match_operand:SI 3 "const_0_to_255_operand" "n")]
18023 UNSPEC_VPERMIL2F128))]
18025 "vperm2<i128>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
18026 [(set_attr "type" "sselog")
18027 (set_attr "prefix_extra" "1")
18028 (set_attr "length_immediate" "1")
18029 (set_attr "prefix" "vex")
18030 (set_attr "mode" "<sseinsnmode>")])
18032 (define_insn "*avx_vperm2f128<mode>_nozero"
18033 [(set (match_operand:AVX256MODE2P 0 "register_operand" "=x")
18034 (vec_select:AVX256MODE2P
18035 (vec_concat:<ssedoublevecmode>
18036 (match_operand:AVX256MODE2P 1 "register_operand" "x")
18037 (match_operand:AVX256MODE2P 2 "nonimmediate_operand" "xm"))
18038 (match_parallel 3 ""
18039 [(match_operand 4 "const_int_operand")])))]
18041 && avx_vperm2f128_parallel (operands[3], <MODE>mode)"
18043 int mask = avx_vperm2f128_parallel (operands[3], <MODE>mode) - 1;
18045 return "vinsert<i128>\t{$0, %x2, %1, %0|%0, %1, %x2, 0}";
18047 return "vinsert<i128>\t{$1, %x2, %1, %0|%0, %1, %x2, 1}";
18048 operands[3] = GEN_INT (mask);
18049 return "vperm2<i128>\t{%3, %2, %1, %0|%0, %1, %2, %3}";
18051 [(set_attr "type" "sselog")
18052 (set_attr "prefix_extra" "1")
18053 (set_attr "length_immediate" "1")
18054 (set_attr "prefix" "vex")
18055 (set_attr "mode" "<sseinsnmode>")])
18057 (define_insn "*ssse3_palignr<mode>_perm"
18058 [(set (match_operand:V_128 0 "register_operand" "=x,x")
18060 (match_operand:V_128 1 "register_operand" "0,x")
18061 (match_parallel 2 "palignr_operand"
18062 [(match_operand 3 "const_int_operand" "n, n")])))]
18066 GEN_INT (INTVAL (operands[3]) * GET_MODE_UNIT_SIZE (GET_MODE (operands[0])));
18068 switch (which_alternative)
18071 return "palignr\t{%2, %1, %0|%0, %1, %2}";
18073 return "vpalignr\t{%2, %1, %1, %0|%0, %1, %1, %2}";
18075 gcc_unreachable ();
18078 [(set_attr "isa" "noavx,avx")
18079 (set_attr "type" "sseishft")
18080 (set_attr "atom_unit" "sishuf")
18081 (set_attr "prefix_data16" "1,*")
18082 (set_attr "prefix_extra" "1")
18083 (set_attr "length_immediate" "1")
18084 (set_attr "prefix" "orig,vex")])
18086 (define_expand "avx512vl_vinsert<mode>"
18087 [(match_operand:VI48F_256 0 "register_operand")
18088 (match_operand:VI48F_256 1 "register_operand")
18089 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand")
18090 (match_operand:SI 3 "const_0_to_1_operand")
18091 (match_operand:VI48F_256 4 "register_operand")
18092 (match_operand:<avx512fmaskmode> 5 "register_operand")]
18095 rtx (*insn)(rtx, rtx, rtx, rtx, rtx);
18097 switch (INTVAL (operands[3]))
18100 insn = gen_vec_set_lo_<mode>_mask;
18103 insn = gen_vec_set_hi_<mode>_mask;
18106 gcc_unreachable ();
18109 emit_insn (insn (operands[0], operands[1], operands[2], operands[4],
18114 (define_expand "avx_vinsertf128<mode>"
18115 [(match_operand:V_256 0 "register_operand")
18116 (match_operand:V_256 1 "register_operand")
18117 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand")
18118 (match_operand:SI 3 "const_0_to_1_operand")]
18121 rtx (*insn)(rtx, rtx, rtx);
18123 switch (INTVAL (operands[3]))
18126 insn = gen_vec_set_lo_<mode>;
18129 insn = gen_vec_set_hi_<mode>;
18132 gcc_unreachable ();
18135 emit_insn (insn (operands[0], operands[1], operands[2]));
18139 (define_insn "vec_set_lo_<mode><mask_name>"
18140 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
18141 (vec_concat:VI8F_256
18142 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
18143 (vec_select:<ssehalfvecmode>
18144 (match_operand:VI8F_256 1 "register_operand" "v")
18145 (parallel [(const_int 2) (const_int 3)]))))]
18148 if (TARGET_AVX512VL)
18149 return "vinsert<shuffletype>64x2\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}";
18151 return "vinsert<i128>\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}";
18153 [(set_attr "type" "sselog")
18154 (set_attr "prefix_extra" "1")
18155 (set_attr "length_immediate" "1")
18156 (set_attr "prefix" "vex")
18157 (set_attr "mode" "<sseinsnmode>")])
18159 (define_insn "vec_set_hi_<mode><mask_name>"
18160 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
18161 (vec_concat:VI8F_256
18162 (vec_select:<ssehalfvecmode>
18163 (match_operand:VI8F_256 1 "register_operand" "v")
18164 (parallel [(const_int 0) (const_int 1)]))
18165 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
18168 if (TARGET_AVX512VL)
18169 return "vinsert<shuffletype>64x2\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}";
18171 return "vinsert<i128>\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}";
18173 [(set_attr "type" "sselog")
18174 (set_attr "prefix_extra" "1")
18175 (set_attr "length_immediate" "1")
18176 (set_attr "prefix" "vex")
18177 (set_attr "mode" "<sseinsnmode>")])
18179 (define_insn "vec_set_lo_<mode><mask_name>"
18180 [(set (match_operand:VI4F_256 0 "register_operand" "=v")
18181 (vec_concat:VI4F_256
18182 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
18183 (vec_select:<ssehalfvecmode>
18184 (match_operand:VI4F_256 1 "register_operand" "v")
18185 (parallel [(const_int 4) (const_int 5)
18186 (const_int 6) (const_int 7)]))))]
18189 if (TARGET_AVX512VL)
18190 return "vinsert<shuffletype>32x4\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}";
18192 return "vinsert<i128>\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}";
18194 [(set_attr "type" "sselog")
18195 (set_attr "prefix_extra" "1")
18196 (set_attr "length_immediate" "1")
18197 (set_attr "prefix" "vex")
18198 (set_attr "mode" "<sseinsnmode>")])
18200 (define_insn "vec_set_hi_<mode><mask_name>"
18201 [(set (match_operand:VI4F_256 0 "register_operand" "=v")
18202 (vec_concat:VI4F_256
18203 (vec_select:<ssehalfvecmode>
18204 (match_operand:VI4F_256 1 "register_operand" "v")
18205 (parallel [(const_int 0) (const_int 1)
18206 (const_int 2) (const_int 3)]))
18207 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
18210 if (TARGET_AVX512VL)
18211 return "vinsert<shuffletype>32x4\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}";
18213 return "vinsert<i128>\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}";
18215 [(set_attr "type" "sselog")
18216 (set_attr "prefix_extra" "1")
18217 (set_attr "length_immediate" "1")
18218 (set_attr "prefix" "vex")
18219 (set_attr "mode" "<sseinsnmode>")])
18221 (define_insn "vec_set_lo_v16hi"
18222 [(set (match_operand:V16HI 0 "register_operand" "=x")
18224 (match_operand:V8HI 2 "nonimmediate_operand" "xm")
18226 (match_operand:V16HI 1 "register_operand" "x")
18227 (parallel [(const_int 8) (const_int 9)
18228 (const_int 10) (const_int 11)
18229 (const_int 12) (const_int 13)
18230 (const_int 14) (const_int 15)]))))]
18232 "vinsert%~128\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}"
18233 [(set_attr "type" "sselog")
18234 (set_attr "prefix_extra" "1")
18235 (set_attr "length_immediate" "1")
18236 (set_attr "prefix" "vex")
18237 (set_attr "mode" "OI")])
18239 (define_insn "vec_set_hi_v16hi"
18240 [(set (match_operand:V16HI 0 "register_operand" "=x")
18243 (match_operand:V16HI 1 "register_operand" "x")
18244 (parallel [(const_int 0) (const_int 1)
18245 (const_int 2) (const_int 3)
18246 (const_int 4) (const_int 5)
18247 (const_int 6) (const_int 7)]))
18248 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
18250 "vinsert%~128\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}"
18251 [(set_attr "type" "sselog")
18252 (set_attr "prefix_extra" "1")
18253 (set_attr "length_immediate" "1")
18254 (set_attr "prefix" "vex")
18255 (set_attr "mode" "OI")])
18257 (define_insn "vec_set_lo_v32qi"
18258 [(set (match_operand:V32QI 0 "register_operand" "=x")
18260 (match_operand:V16QI 2 "nonimmediate_operand" "xm")
18262 (match_operand:V32QI 1 "register_operand" "x")
18263 (parallel [(const_int 16) (const_int 17)
18264 (const_int 18) (const_int 19)
18265 (const_int 20) (const_int 21)
18266 (const_int 22) (const_int 23)
18267 (const_int 24) (const_int 25)
18268 (const_int 26) (const_int 27)
18269 (const_int 28) (const_int 29)
18270 (const_int 30) (const_int 31)]))))]
18272 "vinsert%~128\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}"
18273 [(set_attr "type" "sselog")
18274 (set_attr "prefix_extra" "1")
18275 (set_attr "length_immediate" "1")
18276 (set_attr "prefix" "vex")
18277 (set_attr "mode" "OI")])
18279 (define_insn "vec_set_hi_v32qi"
18280 [(set (match_operand:V32QI 0 "register_operand" "=x")
18283 (match_operand:V32QI 1 "register_operand" "x")
18284 (parallel [(const_int 0) (const_int 1)
18285 (const_int 2) (const_int 3)
18286 (const_int 4) (const_int 5)
18287 (const_int 6) (const_int 7)
18288 (const_int 8) (const_int 9)
18289 (const_int 10) (const_int 11)
18290 (const_int 12) (const_int 13)
18291 (const_int 14) (const_int 15)]))
18292 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
18294 "vinsert%~128\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}"
18295 [(set_attr "type" "sselog")
18296 (set_attr "prefix_extra" "1")
18297 (set_attr "length_immediate" "1")
18298 (set_attr "prefix" "vex")
18299 (set_attr "mode" "OI")])
18301 (define_insn "<avx_avx2>_maskload<ssemodesuffix><avxsizesuffix>"
18302 [(set (match_operand:V48_AVX2 0 "register_operand" "=x")
18304 [(match_operand:<sseintvecmode> 2 "register_operand" "x")
18305 (match_operand:V48_AVX2 1 "memory_operand" "m")]
18308 "v<sseintprefix>maskmov<ssemodesuffix>\t{%1, %2, %0|%0, %2, %1}"
18309 [(set_attr "type" "sselog1")
18310 (set_attr "prefix_extra" "1")
18311 (set_attr "prefix" "vex")
18312 (set_attr "btver2_decode" "vector")
18313 (set_attr "mode" "<sseinsnmode>")])
18315 (define_insn "<avx_avx2>_maskstore<ssemodesuffix><avxsizesuffix>"
18316 [(set (match_operand:V48_AVX2 0 "memory_operand" "+m")
18318 [(match_operand:<sseintvecmode> 1 "register_operand" "x")
18319 (match_operand:V48_AVX2 2 "register_operand" "x")
18323 "v<sseintprefix>maskmov<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
18324 [(set_attr "type" "sselog1")
18325 (set_attr "prefix_extra" "1")
18326 (set_attr "prefix" "vex")
18327 (set_attr "btver2_decode" "vector")
18328 (set_attr "mode" "<sseinsnmode>")])
18330 (define_expand "maskload<mode><sseintvecmodelower>"
18331 [(set (match_operand:V48_AVX2 0 "register_operand")
18333 [(match_operand:<sseintvecmode> 2 "register_operand")
18334 (match_operand:V48_AVX2 1 "memory_operand")]
18338 (define_expand "maskload<mode><avx512fmaskmodelower>"
18339 [(set (match_operand:V48_AVX512VL 0 "register_operand")
18340 (vec_merge:V48_AVX512VL
18341 (match_operand:V48_AVX512VL 1 "memory_operand")
18343 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18346 (define_expand "maskload<mode><avx512fmaskmodelower>"
18347 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
18348 (vec_merge:VI12_AVX512VL
18349 (match_operand:VI12_AVX512VL 1 "memory_operand")
18351 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18354 (define_expand "maskstore<mode><sseintvecmodelower>"
18355 [(set (match_operand:V48_AVX2 0 "memory_operand")
18357 [(match_operand:<sseintvecmode> 2 "register_operand")
18358 (match_operand:V48_AVX2 1 "register_operand")
18363 (define_expand "maskstore<mode><avx512fmaskmodelower>"
18364 [(set (match_operand:V48_AVX512VL 0 "memory_operand")
18365 (vec_merge:V48_AVX512VL
18366 (match_operand:V48_AVX512VL 1 "register_operand")
18368 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18371 (define_expand "maskstore<mode><avx512fmaskmodelower>"
18372 [(set (match_operand:VI12_AVX512VL 0 "memory_operand")
18373 (vec_merge:VI12_AVX512VL
18374 (match_operand:VI12_AVX512VL 1 "register_operand")
18376 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18379 (define_expand "cbranch<mode>4"
18380 [(set (reg:CC FLAGS_REG)
18381 (compare:CC (match_operand:VI48_AVX 1 "register_operand")
18382 (match_operand:VI48_AVX 2 "nonimmediate_operand")))
18383 (set (pc) (if_then_else
18384 (match_operator 0 "bt_comparison_operator"
18385 [(reg:CC FLAGS_REG) (const_int 0)])
18386 (label_ref (match_operand 3))
18390 ix86_expand_branch (GET_CODE (operands[0]),
18391 operands[1], operands[2], operands[3]);
18396 (define_insn_and_split "avx_<castmode><avxsizesuffix>_<castmode>"
18397 [(set (match_operand:AVX256MODE2P 0 "nonimmediate_operand" "=x,m")
18398 (unspec:AVX256MODE2P
18399 [(match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "xm,x")]
18403 "&& reload_completed"
18406 rtx op0 = operands[0];
18407 rtx op1 = operands[1];
18409 op0 = gen_rtx_REG (<ssehalfvecmode>mode, REGNO (op0));
18411 op1 = gen_rtx_REG (<MODE>mode, REGNO (op1));
18412 emit_move_insn (op0, op1);
18416 (define_expand "vec_init<mode>"
18417 [(match_operand:V_256 0 "register_operand")
18421 ix86_expand_vector_init (false, operands[0], operands[1]);
18425 (define_expand "vec_init<mode>"
18426 [(match_operand:VF48_I1248 0 "register_operand")
18430 ix86_expand_vector_init (false, operands[0], operands[1]);
18434 (define_insn "<avx2_avx512>_ashrv<mode><mask_name>"
18435 [(set (match_operand:VI48_AVX512F_AVX512VL 0 "register_operand" "=v")
18436 (ashiftrt:VI48_AVX512F_AVX512VL
18437 (match_operand:VI48_AVX512F_AVX512VL 1 "register_operand" "v")
18438 (match_operand:VI48_AVX512F_AVX512VL 2 "nonimmediate_operand" "vm")))]
18439 "TARGET_AVX2 && <mask_mode512bit_condition>"
18440 "vpsrav<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18441 [(set_attr "type" "sseishft")
18442 (set_attr "prefix" "maybe_evex")
18443 (set_attr "mode" "<sseinsnmode>")])
18445 (define_insn "<avx2_avx512>_ashrv<mode><mask_name>"
18446 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
18447 (ashiftrt:VI2_AVX512VL
18448 (match_operand:VI2_AVX512VL 1 "register_operand" "v")
18449 (match_operand:VI2_AVX512VL 2 "nonimmediate_operand" "vm")))]
18451 "vpsravw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18452 [(set_attr "type" "sseishft")
18453 (set_attr "prefix" "maybe_evex")
18454 (set_attr "mode" "<sseinsnmode>")])
18456 (define_insn "<avx2_avx512>_<shift_insn>v<mode><mask_name>"
18457 [(set (match_operand:VI48_AVX512F 0 "register_operand" "=v")
18458 (any_lshift:VI48_AVX512F
18459 (match_operand:VI48_AVX512F 1 "register_operand" "v")
18460 (match_operand:VI48_AVX512F 2 "nonimmediate_operand" "vm")))]
18461 "TARGET_AVX2 && <mask_mode512bit_condition>"
18462 "vp<vshift>v<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18463 [(set_attr "type" "sseishft")
18464 (set_attr "prefix" "maybe_evex")
18465 (set_attr "mode" "<sseinsnmode>")])
18467 (define_insn "<avx2_avx512>_<shift_insn>v<mode><mask_name>"
18468 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
18469 (any_lshift:VI2_AVX512VL
18470 (match_operand:VI2_AVX512VL 1 "register_operand" "v")
18471 (match_operand:VI2_AVX512VL 2 "nonimmediate_operand" "vm")))]
18473 "vp<vshift>v<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18474 [(set_attr "type" "sseishft")
18475 (set_attr "prefix" "maybe_evex")
18476 (set_attr "mode" "<sseinsnmode>")])
18478 (define_insn "avx_vec_concat<mode>"
18479 [(set (match_operand:V_256_512 0 "register_operand" "=x,x")
18480 (vec_concat:V_256_512
18481 (match_operand:<ssehalfvecmode> 1 "register_operand" "x,x")
18482 (match_operand:<ssehalfvecmode> 2 "vector_move_operand" "xm,C")))]
18485 switch (which_alternative)
18488 return "vinsert<i128>\t{$0x1, %2, %<concat_tg_mode>1, %0|%0, %<concat_tg_mode>1, %2, 0x1}";
18490 switch (get_attr_mode (insn))
18493 return "vmovaps\t{%1, %t0|%t0, %1}";
18495 return "vmovapd\t{%1, %t0|%t0, %1}";
18497 return "vmovaps\t{%1, %x0|%x0, %1}";
18499 return "vmovapd\t{%1, %x0|%x0, %1}";
18501 return "vmovdqa\t{%1, %t0|%t0, %1}";
18503 return "vmovdqa\t{%1, %x0|%x0, %1}";
18505 gcc_unreachable ();
18508 gcc_unreachable ();
18511 [(set_attr "type" "sselog,ssemov")
18512 (set_attr "prefix_extra" "1,*")
18513 (set_attr "length_immediate" "1,*")
18514 (set_attr "prefix" "maybe_evex")
18515 (set_attr "mode" "<sseinsnmode>")])
18517 (define_insn "vcvtph2ps<mask_name>"
18518 [(set (match_operand:V4SF 0 "register_operand" "=v")
18520 (unspec:V8SF [(match_operand:V8HI 1 "register_operand" "v")]
18522 (parallel [(const_int 0) (const_int 1)
18523 (const_int 2) (const_int 3)])))]
18524 "TARGET_F16C || TARGET_AVX512VL"
18525 "vcvtph2ps\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
18526 [(set_attr "type" "ssecvt")
18527 (set_attr "prefix" "maybe_evex")
18528 (set_attr "mode" "V4SF")])
18530 (define_insn "*vcvtph2ps_load<mask_name>"
18531 [(set (match_operand:V4SF 0 "register_operand" "=v")
18532 (unspec:V4SF [(match_operand:V4HI 1 "memory_operand" "m")]
18533 UNSPEC_VCVTPH2PS))]
18534 "TARGET_F16C || TARGET_AVX512VL"
18535 "vcvtph2ps\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
18536 [(set_attr "type" "ssecvt")
18537 (set_attr "prefix" "vex")
18538 (set_attr "mode" "V8SF")])
18540 (define_insn "vcvtph2ps256<mask_name>"
18541 [(set (match_operand:V8SF 0 "register_operand" "=v")
18542 (unspec:V8SF [(match_operand:V8HI 1 "nonimmediate_operand" "vm")]
18543 UNSPEC_VCVTPH2PS))]
18544 "TARGET_F16C || TARGET_AVX512VL"
18545 "vcvtph2ps\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
18546 [(set_attr "type" "ssecvt")
18547 (set_attr "prefix" "vex")
18548 (set_attr "btver2_decode" "double")
18549 (set_attr "mode" "V8SF")])
18551 (define_insn "<mask_codefor>avx512f_vcvtph2ps512<mask_name><round_saeonly_name>"
18552 [(set (match_operand:V16SF 0 "register_operand" "=v")
18554 [(match_operand:V16HI 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
18555 UNSPEC_VCVTPH2PS))]
18557 "vcvtph2ps\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
18558 [(set_attr "type" "ssecvt")
18559 (set_attr "prefix" "evex")
18560 (set_attr "mode" "V16SF")])
18562 (define_expand "vcvtps2ph_mask"
18563 [(set (match_operand:V8HI 0 "register_operand")
18566 (unspec:V4HI [(match_operand:V4SF 1 "register_operand")
18567 (match_operand:SI 2 "const_0_to_255_operand")]
18570 (match_operand:V8HI 3 "vector_move_operand")
18571 (match_operand:QI 4 "register_operand")))]
18573 "operands[5] = CONST0_RTX (V4HImode);")
18575 (define_expand "vcvtps2ph"
18576 [(set (match_operand:V8HI 0 "register_operand")
18578 (unspec:V4HI [(match_operand:V4SF 1 "register_operand")
18579 (match_operand:SI 2 "const_0_to_255_operand")]
18583 "operands[3] = CONST0_RTX (V4HImode);")
18585 (define_insn "*vcvtps2ph<mask_name>"
18586 [(set (match_operand:V8HI 0 "register_operand" "=v")
18588 (unspec:V4HI [(match_operand:V4SF 1 "register_operand" "v")
18589 (match_operand:SI 2 "const_0_to_255_operand" "N")]
18591 (match_operand:V4HI 3 "const0_operand")))]
18592 "(TARGET_F16C || TARGET_AVX512VL) && <mask_avx512vl_condition>"
18593 "vcvtps2ph\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}"
18594 [(set_attr "type" "ssecvt")
18595 (set_attr "prefix" "maybe_evex")
18596 (set_attr "mode" "V4SF")])
18598 (define_insn "*vcvtps2ph_store<mask_name>"
18599 [(set (match_operand:V4HI 0 "memory_operand" "=m")
18600 (unspec:V4HI [(match_operand:V4SF 1 "register_operand" "x")
18601 (match_operand:SI 2 "const_0_to_255_operand" "N")]
18602 UNSPEC_VCVTPS2PH))]
18603 "TARGET_F16C || TARGET_AVX512VL"
18604 "vcvtps2ph\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18605 [(set_attr "type" "ssecvt")
18606 (set_attr "prefix" "maybe_evex")
18607 (set_attr "mode" "V4SF")])
18609 (define_insn "vcvtps2ph256<mask_name>"
18610 [(set (match_operand:V8HI 0 "nonimmediate_operand" "=xm")
18611 (unspec:V8HI [(match_operand:V8SF 1 "register_operand" "x")
18612 (match_operand:SI 2 "const_0_to_255_operand" "N")]
18613 UNSPEC_VCVTPS2PH))]
18614 "TARGET_F16C || TARGET_AVX512VL"
18615 "vcvtps2ph\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18616 [(set_attr "type" "ssecvt")
18617 (set_attr "prefix" "maybe_evex")
18618 (set_attr "btver2_decode" "vector")
18619 (set_attr "mode" "V8SF")])
18621 (define_insn "<mask_codefor>avx512f_vcvtps2ph512<mask_name>"
18622 [(set (match_operand:V16HI 0 "nonimmediate_operand" "=vm")
18624 [(match_operand:V16SF 1 "register_operand" "v")
18625 (match_operand:SI 2 "const_0_to_255_operand" "N")]
18626 UNSPEC_VCVTPS2PH))]
18628 "vcvtps2ph\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18629 [(set_attr "type" "ssecvt")
18630 (set_attr "prefix" "evex")
18631 (set_attr "mode" "V16SF")])
18633 ;; For gather* insn patterns
18634 (define_mode_iterator VEC_GATHER_MODE
18635 [V2DI V2DF V4DI V4DF V4SI V4SF V8SI V8SF])
18636 (define_mode_attr VEC_GATHER_IDXSI
18637 [(V2DI "V4SI") (V4DI "V4SI") (V8DI "V8SI")
18638 (V2DF "V4SI") (V4DF "V4SI") (V8DF "V8SI")
18639 (V4SI "V4SI") (V8SI "V8SI") (V16SI "V16SI")
18640 (V4SF "V4SI") (V8SF "V8SI") (V16SF "V16SI")])
18642 (define_mode_attr VEC_GATHER_IDXDI
18643 [(V2DI "V2DI") (V4DI "V4DI") (V8DI "V8DI")
18644 (V2DF "V2DI") (V4DF "V4DI") (V8DF "V8DI")
18645 (V4SI "V2DI") (V8SI "V4DI") (V16SI "V8DI")
18646 (V4SF "V2DI") (V8SF "V4DI") (V16SF "V8DI")])
18648 (define_mode_attr VEC_GATHER_SRCDI
18649 [(V2DI "V2DI") (V4DI "V4DI") (V8DI "V8DI")
18650 (V2DF "V2DF") (V4DF "V4DF") (V8DF "V8DF")
18651 (V4SI "V4SI") (V8SI "V4SI") (V16SI "V8SI")
18652 (V4SF "V4SF") (V8SF "V4SF") (V16SF "V8SF")])
18654 (define_expand "avx2_gathersi<mode>"
18655 [(parallel [(set (match_operand:VEC_GATHER_MODE 0 "register_operand")
18656 (unspec:VEC_GATHER_MODE
18657 [(match_operand:VEC_GATHER_MODE 1 "register_operand")
18658 (mem:<ssescalarmode>
18660 [(match_operand 2 "vsib_address_operand")
18661 (match_operand:<VEC_GATHER_IDXSI>
18662 3 "register_operand")
18663 (match_operand:SI 5 "const1248_operand ")]))
18664 (mem:BLK (scratch))
18665 (match_operand:VEC_GATHER_MODE 4 "register_operand")]
18667 (clobber (match_scratch:VEC_GATHER_MODE 6))])]
18671 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
18672 operands[5]), UNSPEC_VSIBADDR);
18675 (define_insn "*avx2_gathersi<mode>"
18676 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
18677 (unspec:VEC_GATHER_MODE
18678 [(match_operand:VEC_GATHER_MODE 2 "register_operand" "0")
18679 (match_operator:<ssescalarmode> 7 "vsib_mem_operator"
18681 [(match_operand:P 3 "vsib_address_operand" "Tv")
18682 (match_operand:<VEC_GATHER_IDXSI> 4 "register_operand" "x")
18683 (match_operand:SI 6 "const1248_operand" "n")]
18685 (mem:BLK (scratch))
18686 (match_operand:VEC_GATHER_MODE 5 "register_operand" "1")]
18688 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
18690 "v<sseintprefix>gatherd<ssemodesuffix>\t{%1, %7, %0|%0, %7, %1}"
18691 [(set_attr "type" "ssemov")
18692 (set_attr "prefix" "vex")
18693 (set_attr "mode" "<sseinsnmode>")])
18695 (define_insn "*avx2_gathersi<mode>_2"
18696 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
18697 (unspec:VEC_GATHER_MODE
18699 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
18701 [(match_operand:P 2 "vsib_address_operand" "Tv")
18702 (match_operand:<VEC_GATHER_IDXSI> 3 "register_operand" "x")
18703 (match_operand:SI 5 "const1248_operand" "n")]
18705 (mem:BLK (scratch))
18706 (match_operand:VEC_GATHER_MODE 4 "register_operand" "1")]
18708 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
18710 "v<sseintprefix>gatherd<ssemodesuffix>\t{%1, %6, %0|%0, %6, %1}"
18711 [(set_attr "type" "ssemov")
18712 (set_attr "prefix" "vex")
18713 (set_attr "mode" "<sseinsnmode>")])
18715 (define_expand "avx2_gatherdi<mode>"
18716 [(parallel [(set (match_operand:VEC_GATHER_MODE 0 "register_operand")
18717 (unspec:VEC_GATHER_MODE
18718 [(match_operand:<VEC_GATHER_SRCDI> 1 "register_operand")
18719 (mem:<ssescalarmode>
18721 [(match_operand 2 "vsib_address_operand")
18722 (match_operand:<VEC_GATHER_IDXDI>
18723 3 "register_operand")
18724 (match_operand:SI 5 "const1248_operand ")]))
18725 (mem:BLK (scratch))
18726 (match_operand:<VEC_GATHER_SRCDI> 4 "register_operand")]
18728 (clobber (match_scratch:VEC_GATHER_MODE 6))])]
18732 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
18733 operands[5]), UNSPEC_VSIBADDR);
18736 (define_insn "*avx2_gatherdi<mode>"
18737 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
18738 (unspec:VEC_GATHER_MODE
18739 [(match_operand:<VEC_GATHER_SRCDI> 2 "register_operand" "0")
18740 (match_operator:<ssescalarmode> 7 "vsib_mem_operator"
18742 [(match_operand:P 3 "vsib_address_operand" "Tv")
18743 (match_operand:<VEC_GATHER_IDXDI> 4 "register_operand" "x")
18744 (match_operand:SI 6 "const1248_operand" "n")]
18746 (mem:BLK (scratch))
18747 (match_operand:<VEC_GATHER_SRCDI> 5 "register_operand" "1")]
18749 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
18751 "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %7, %2|%2, %7, %5}"
18752 [(set_attr "type" "ssemov")
18753 (set_attr "prefix" "vex")
18754 (set_attr "mode" "<sseinsnmode>")])
18756 (define_insn "*avx2_gatherdi<mode>_2"
18757 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
18758 (unspec:VEC_GATHER_MODE
18760 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
18762 [(match_operand:P 2 "vsib_address_operand" "Tv")
18763 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand" "x")
18764 (match_operand:SI 5 "const1248_operand" "n")]
18766 (mem:BLK (scratch))
18767 (match_operand:<VEC_GATHER_SRCDI> 4 "register_operand" "1")]
18769 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
18772 if (<MODE>mode != <VEC_GATHER_SRCDI>mode)
18773 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%4, %6, %x0|%x0, %6, %4}";
18774 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%4, %6, %0|%0, %6, %4}";
18776 [(set_attr "type" "ssemov")
18777 (set_attr "prefix" "vex")
18778 (set_attr "mode" "<sseinsnmode>")])
18780 (define_insn "*avx2_gatherdi<mode>_3"
18781 [(set (match_operand:<VEC_GATHER_SRCDI> 0 "register_operand" "=&x")
18782 (vec_select:<VEC_GATHER_SRCDI>
18784 [(match_operand:<VEC_GATHER_SRCDI> 2 "register_operand" "0")
18785 (match_operator:<ssescalarmode> 7 "vsib_mem_operator"
18787 [(match_operand:P 3 "vsib_address_operand" "Tv")
18788 (match_operand:<VEC_GATHER_IDXDI> 4 "register_operand" "x")
18789 (match_operand:SI 6 "const1248_operand" "n")]
18791 (mem:BLK (scratch))
18792 (match_operand:<VEC_GATHER_SRCDI> 5 "register_operand" "1")]
18794 (parallel [(const_int 0) (const_int 1)
18795 (const_int 2) (const_int 3)])))
18796 (clobber (match_scratch:VI4F_256 1 "=&x"))]
18798 "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %7, %0|%0, %7, %5}"
18799 [(set_attr "type" "ssemov")
18800 (set_attr "prefix" "vex")
18801 (set_attr "mode" "<sseinsnmode>")])
18803 (define_insn "*avx2_gatherdi<mode>_4"
18804 [(set (match_operand:<VEC_GATHER_SRCDI> 0 "register_operand" "=&x")
18805 (vec_select:<VEC_GATHER_SRCDI>
18808 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
18810 [(match_operand:P 2 "vsib_address_operand" "Tv")
18811 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand" "x")
18812 (match_operand:SI 5 "const1248_operand" "n")]
18814 (mem:BLK (scratch))
18815 (match_operand:<VEC_GATHER_SRCDI> 4 "register_operand" "1")]
18817 (parallel [(const_int 0) (const_int 1)
18818 (const_int 2) (const_int 3)])))
18819 (clobber (match_scratch:VI4F_256 1 "=&x"))]
18821 "v<sseintprefix>gatherq<ssemodesuffix>\t{%4, %6, %0|%0, %6, %4}"
18822 [(set_attr "type" "ssemov")
18823 (set_attr "prefix" "vex")
18824 (set_attr "mode" "<sseinsnmode>")])
18826 (define_expand "<avx512>_gathersi<mode>"
18827 [(parallel [(set (match_operand:VI48F 0 "register_operand")
18829 [(match_operand:VI48F 1 "register_operand")
18830 (match_operand:<avx512fmaskmode> 4 "register_operand")
18831 (mem:<ssescalarmode>
18833 [(match_operand 2 "vsib_address_operand")
18834 (match_operand:<VEC_GATHER_IDXSI> 3 "register_operand")
18835 (match_operand:SI 5 "const1248_operand")]))]
18837 (clobber (match_scratch:<avx512fmaskmode> 7))])]
18841 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
18842 operands[5]), UNSPEC_VSIBADDR);
18845 (define_insn "*avx512f_gathersi<mode>"
18846 [(set (match_operand:VI48F 0 "register_operand" "=&v")
18848 [(match_operand:VI48F 1 "register_operand" "0")
18849 (match_operand:<avx512fmaskmode> 7 "register_operand" "2")
18850 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
18852 [(match_operand:P 4 "vsib_address_operand" "Tv")
18853 (match_operand:<VEC_GATHER_IDXSI> 3 "register_operand" "v")
18854 (match_operand:SI 5 "const1248_operand" "n")]
18855 UNSPEC_VSIBADDR)])]
18857 (clobber (match_scratch:<avx512fmaskmode> 2 "=&Yk"))]
18859 "v<sseintprefix>gatherd<ssemodesuffix>\t{%6, %0%{%2%}|%0%{%2%}, %g6}"
18860 [(set_attr "type" "ssemov")
18861 (set_attr "prefix" "evex")
18862 (set_attr "mode" "<sseinsnmode>")])
18864 (define_insn "*avx512f_gathersi<mode>_2"
18865 [(set (match_operand:VI48F 0 "register_operand" "=&v")
18868 (match_operand:<avx512fmaskmode> 6 "register_operand" "1")
18869 (match_operator:<ssescalarmode> 5 "vsib_mem_operator"
18871 [(match_operand:P 3 "vsib_address_operand" "Tv")
18872 (match_operand:<VEC_GATHER_IDXSI> 2 "register_operand" "v")
18873 (match_operand:SI 4 "const1248_operand" "n")]
18874 UNSPEC_VSIBADDR)])]
18876 (clobber (match_scratch:<avx512fmaskmode> 1 "=&Yk"))]
18878 "v<sseintprefix>gatherd<ssemodesuffix>\t{%5, %0%{%1%}|%0%{%1%}, %g5}"
18879 [(set_attr "type" "ssemov")
18880 (set_attr "prefix" "evex")
18881 (set_attr "mode" "<sseinsnmode>")])
18884 (define_expand "<avx512>_gatherdi<mode>"
18885 [(parallel [(set (match_operand:VI48F 0 "register_operand")
18887 [(match_operand:<VEC_GATHER_SRCDI> 1 "register_operand")
18888 (match_operand:QI 4 "register_operand")
18889 (mem:<ssescalarmode>
18891 [(match_operand 2 "vsib_address_operand")
18892 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand")
18893 (match_operand:SI 5 "const1248_operand")]))]
18895 (clobber (match_scratch:QI 7))])]
18899 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
18900 operands[5]), UNSPEC_VSIBADDR);
18903 (define_insn "*avx512f_gatherdi<mode>"
18904 [(set (match_operand:VI48F 0 "register_operand" "=&v")
18906 [(match_operand:<VEC_GATHER_SRCDI> 1 "register_operand" "0")
18907 (match_operand:QI 7 "register_operand" "2")
18908 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
18910 [(match_operand:P 4 "vsib_address_operand" "Tv")
18911 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand" "v")
18912 (match_operand:SI 5 "const1248_operand" "n")]
18913 UNSPEC_VSIBADDR)])]
18915 (clobber (match_scratch:QI 2 "=&Yk"))]
18917 "v<sseintprefix>gatherq<ssemodesuffix>\t{%6, %1%{%2%}|%1%{%2%}, %g6}"
18918 [(set_attr "type" "ssemov")
18919 (set_attr "prefix" "evex")
18920 (set_attr "mode" "<sseinsnmode>")])
18922 (define_insn "*avx512f_gatherdi<mode>_2"
18923 [(set (match_operand:VI48F 0 "register_operand" "=&v")
18926 (match_operand:QI 6 "register_operand" "1")
18927 (match_operator:<ssescalarmode> 5 "vsib_mem_operator"
18929 [(match_operand:P 3 "vsib_address_operand" "Tv")
18930 (match_operand:<VEC_GATHER_IDXDI> 2 "register_operand" "v")
18931 (match_operand:SI 4 "const1248_operand" "n")]
18932 UNSPEC_VSIBADDR)])]
18934 (clobber (match_scratch:QI 1 "=&Yk"))]
18937 if (<MODE>mode != <VEC_GATHER_SRCDI>mode)
18939 if (<MODE_SIZE> != 64)
18940 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %x0%{%1%}|%t0%{%1%}, %g5}";
18942 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %t0%{%1%}|%t0%{%1%}, %g5}";
18944 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %0%{%1%}|%0%{%1%}, %g5}";
18946 [(set_attr "type" "ssemov")
18947 (set_attr "prefix" "evex")
18948 (set_attr "mode" "<sseinsnmode>")])
18950 (define_expand "<avx512>_scattersi<mode>"
18951 [(parallel [(set (mem:VI48F
18953 [(match_operand 0 "vsib_address_operand")
18954 (match_operand:<VEC_GATHER_IDXSI> 2 "register_operand")
18955 (match_operand:SI 4 "const1248_operand")]))
18957 [(match_operand:<avx512fmaskmode> 1 "register_operand")
18958 (match_operand:VI48F 3 "register_operand")]
18960 (clobber (match_scratch:<avx512fmaskmode> 6))])]
18964 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[0], operands[2],
18965 operands[4]), UNSPEC_VSIBADDR);
18968 (define_insn "*avx512f_scattersi<mode>"
18969 [(set (match_operator:VI48F 5 "vsib_mem_operator"
18971 [(match_operand:P 0 "vsib_address_operand" "Tv")
18972 (match_operand:<VEC_GATHER_IDXSI> 2 "register_operand" "v")
18973 (match_operand:SI 4 "const1248_operand" "n")]
18976 [(match_operand:<avx512fmaskmode> 6 "register_operand" "1")
18977 (match_operand:VI48F 3 "register_operand" "v")]
18979 (clobber (match_scratch:<avx512fmaskmode> 1 "=&Yk"))]
18981 "v<sseintprefix>scatterd<ssemodesuffix>\t{%3, %5%{%1%}|%5%{%1%}, %3}"
18982 [(set_attr "type" "ssemov")
18983 (set_attr "prefix" "evex")
18984 (set_attr "mode" "<sseinsnmode>")])
18986 (define_expand "<avx512>_scatterdi<mode>"
18987 [(parallel [(set (mem:VI48F
18989 [(match_operand 0 "vsib_address_operand")
18990 (match_operand:<VEC_GATHER_IDXDI> 2 "register_operand")
18991 (match_operand:SI 4 "const1248_operand")]))
18993 [(match_operand:QI 1 "register_operand")
18994 (match_operand:<VEC_GATHER_SRCDI> 3 "register_operand")]
18996 (clobber (match_scratch:QI 6))])]
19000 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[0], operands[2],
19001 operands[4]), UNSPEC_VSIBADDR);
19004 (define_insn "*avx512f_scatterdi<mode>"
19005 [(set (match_operator:VI48F 5 "vsib_mem_operator"
19007 [(match_operand:P 0 "vsib_address_operand" "Tv")
19008 (match_operand:<VEC_GATHER_IDXDI> 2 "register_operand" "v")
19009 (match_operand:SI 4 "const1248_operand" "n")]
19012 [(match_operand:QI 6 "register_operand" "1")
19013 (match_operand:<VEC_GATHER_SRCDI> 3 "register_operand" "v")]
19015 (clobber (match_scratch:QI 1 "=&Yk"))]
19017 "v<sseintprefix>scatterq<ssemodesuffix>\t{%3, %5%{%1%}|%5%{%1%}, %3}"
19018 [(set_attr "type" "ssemov")
19019 (set_attr "prefix" "evex")
19020 (set_attr "mode" "<sseinsnmode>")])
19022 (define_insn "<avx512>_compress<mode>_mask"
19023 [(set (match_operand:VI48F 0 "register_operand" "=v")
19025 [(match_operand:VI48F 1 "register_operand" "v")
19026 (match_operand:VI48F 2 "vector_move_operand" "0C")
19027 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")]
19030 "v<sseintprefix>compress<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
19031 [(set_attr "type" "ssemov")
19032 (set_attr "prefix" "evex")
19033 (set_attr "mode" "<sseinsnmode>")])
19035 (define_insn "<avx512>_compressstore<mode>_mask"
19036 [(set (match_operand:VI48F 0 "memory_operand" "=m")
19038 [(match_operand:VI48F 1 "register_operand" "x")
19040 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")]
19041 UNSPEC_COMPRESS_STORE))]
19043 "v<sseintprefix>compress<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}"
19044 [(set_attr "type" "ssemov")
19045 (set_attr "prefix" "evex")
19046 (set_attr "memory" "store")
19047 (set_attr "mode" "<sseinsnmode>")])
19049 (define_expand "<avx512>_expand<mode>_maskz"
19050 [(set (match_operand:VI48F 0 "register_operand")
19052 [(match_operand:VI48F 1 "nonimmediate_operand")
19053 (match_operand:VI48F 2 "vector_move_operand")
19054 (match_operand:<avx512fmaskmode> 3 "register_operand")]
19057 "operands[2] = CONST0_RTX (<MODE>mode);")
19059 (define_insn "<avx512>_expand<mode>_mask"
19060 [(set (match_operand:VI48F 0 "register_operand" "=v,v")
19062 [(match_operand:VI48F 1 "nonimmediate_operand" "v,m")
19063 (match_operand:VI48F 2 "vector_move_operand" "0C,0C")
19064 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")]
19067 "v<sseintprefix>expand<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
19068 [(set_attr "type" "ssemov")
19069 (set_attr "prefix" "evex")
19070 (set_attr "memory" "none,load")
19071 (set_attr "mode" "<sseinsnmode>")])
19073 (define_insn "avx512dq_rangep<mode><mask_name><round_saeonly_name>"
19074 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
19075 (unspec:VF_AVX512VL
19076 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
19077 (match_operand:VF_AVX512VL 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
19078 (match_operand:SI 3 "const_0_to_15_operand")]
19080 "TARGET_AVX512DQ && <round_saeonly_mode512bit_condition>"
19081 "vrange<ssemodesuffix>\t{%3, <round_saeonly_mask_op4>%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2<round_saeonly_mask_op4>, %3}"
19082 [(set_attr "type" "sse")
19083 (set_attr "prefix" "evex")
19084 (set_attr "mode" "<MODE>")])
19086 (define_insn "avx512dq_ranges<mode><round_saeonly_name>"
19087 [(set (match_operand:VF_128 0 "register_operand" "=v")
19090 [(match_operand:VF_128 1 "register_operand" "v")
19091 (match_operand:VF_128 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
19092 (match_operand:SI 3 "const_0_to_15_operand")]
19097 "vrange<ssescalarmodesuffix>\t{%3, <round_saeonly_op4>%2, %1, %0|%0, %1, %2<round_saeonly_op4>, %3}"
19098 [(set_attr "type" "sse")
19099 (set_attr "prefix" "evex")
19100 (set_attr "mode" "<MODE>")])
19102 (define_insn "avx512dq_fpclass<mode><mask_scalar_merge_name>"
19103 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
19104 (unspec:<avx512fmaskmode>
19105 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
19106 (match_operand:QI 2 "const_0_to_255_operand" "n")]
19109 "vfpclass<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}";
19110 [(set_attr "type" "sse")
19111 (set_attr "length_immediate" "1")
19112 (set_attr "prefix" "evex")
19113 (set_attr "mode" "<MODE>")])
19115 (define_insn "avx512dq_vmfpclass<mode>"
19116 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
19117 (and:<avx512fmaskmode>
19118 (unspec:<avx512fmaskmode>
19119 [(match_operand:VF_128 1 "register_operand" "v")
19120 (match_operand:QI 2 "const_0_to_255_operand" "n")]
19124 "vfpclass<ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %2}";
19125 [(set_attr "type" "sse")
19126 (set_attr "length_immediate" "1")
19127 (set_attr "prefix" "evex")
19128 (set_attr "mode" "<MODE>")])
19130 (define_insn "<avx512>_getmant<mode><mask_name><round_saeonly_name>"
19131 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
19132 (unspec:VF_AVX512VL
19133 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "<round_saeonly_constraint>")
19134 (match_operand:SI 2 "const_0_to_15_operand")]
19137 "vgetmant<ssemodesuffix>\t{%2, <round_saeonly_mask_op3>%1, %0<mask_operand3>|%0<mask_operand3>, %1<round_saeonly_mask_op3>, %2}";
19138 [(set_attr "prefix" "evex")
19139 (set_attr "mode" "<MODE>")])
19141 (define_insn "avx512f_vgetmant<mode><round_saeonly_name>"
19142 [(set (match_operand:VF_128 0 "register_operand" "=v")
19145 [(match_operand:VF_128 1 "register_operand" "v")
19146 (match_operand:VF_128 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
19147 (match_operand:SI 3 "const_0_to_15_operand")]
19152 "vgetmant<ssescalarmodesuffix>\t{%3, <round_saeonly_op4>%2, %1, %0|%0, %1, %2<round_saeonly_op4>, %3}";
19153 [(set_attr "prefix" "evex")
19154 (set_attr "mode" "<ssescalarmode>")])
19156 ;; The correct representation for this is absolutely enormous, and
19157 ;; surely not generally useful.
19158 (define_insn "<mask_codefor>avx512bw_dbpsadbw<mode><mask_name>"
19159 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
19160 (unspec:VI2_AVX512VL
19161 [(match_operand:<dbpsadbwmode> 1 "register_operand" "v")
19162 (match_operand:<dbpsadbwmode> 2 "nonimmediate_operand" "vm")
19163 (match_operand:SI 3 "const_0_to_255_operand")]
19166 "vdbpsadbw\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3}"
19167 [(set_attr "isa" "avx")
19168 (set_attr "type" "sselog1")
19169 (set_attr "length_immediate" "1")
19170 (set_attr "prefix" "evex")
19171 (set_attr "mode" "<sseinsnmode>")])
19173 (define_insn "clz<mode>2<mask_name>"
19174 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
19176 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm")))]
19178 "vplzcnt<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
19179 [(set_attr "type" "sse")
19180 (set_attr "prefix" "evex")
19181 (set_attr "mode" "<sseinsnmode>")])
19183 (define_insn "<mask_codefor>conflict<mode><mask_name>"
19184 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
19185 (unspec:VI48_AVX512VL
19186 [(match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm")]
19189 "vpconflict<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
19190 [(set_attr "type" "sse")
19191 (set_attr "prefix" "evex")
19192 (set_attr "mode" "<sseinsnmode>")])
19194 (define_insn "sha1msg1"
19195 [(set (match_operand:V4SI 0 "register_operand" "=x")
19197 [(match_operand:V4SI 1 "register_operand" "0")
19198 (match_operand:V4SI 2 "vector_operand" "xBm")]
19201 "sha1msg1\t{%2, %0|%0, %2}"
19202 [(set_attr "type" "sselog1")
19203 (set_attr "mode" "TI")])
19205 (define_insn "sha1msg2"
19206 [(set (match_operand:V4SI 0 "register_operand" "=x")
19208 [(match_operand:V4SI 1 "register_operand" "0")
19209 (match_operand:V4SI 2 "vector_operand" "xBm")]
19212 "sha1msg2\t{%2, %0|%0, %2}"
19213 [(set_attr "type" "sselog1")
19214 (set_attr "mode" "TI")])
19216 (define_insn "sha1nexte"
19217 [(set (match_operand:V4SI 0 "register_operand" "=x")
19219 [(match_operand:V4SI 1 "register_operand" "0")
19220 (match_operand:V4SI 2 "vector_operand" "xBm")]
19221 UNSPEC_SHA1NEXTE))]
19223 "sha1nexte\t{%2, %0|%0, %2}"
19224 [(set_attr "type" "sselog1")
19225 (set_attr "mode" "TI")])
19227 (define_insn "sha1rnds4"
19228 [(set (match_operand:V4SI 0 "register_operand" "=x")
19230 [(match_operand:V4SI 1 "register_operand" "0")
19231 (match_operand:V4SI 2 "vector_operand" "xBm")
19232 (match_operand:SI 3 "const_0_to_3_operand" "n")]
19233 UNSPEC_SHA1RNDS4))]
19235 "sha1rnds4\t{%3, %2, %0|%0, %2, %3}"
19236 [(set_attr "type" "sselog1")
19237 (set_attr "length_immediate" "1")
19238 (set_attr "mode" "TI")])
19240 (define_insn "sha256msg1"
19241 [(set (match_operand:V4SI 0 "register_operand" "=x")
19243 [(match_operand:V4SI 1 "register_operand" "0")
19244 (match_operand:V4SI 2 "vector_operand" "xBm")]
19245 UNSPEC_SHA256MSG1))]
19247 "sha256msg1\t{%2, %0|%0, %2}"
19248 [(set_attr "type" "sselog1")
19249 (set_attr "mode" "TI")])
19251 (define_insn "sha256msg2"
19252 [(set (match_operand:V4SI 0 "register_operand" "=x")
19254 [(match_operand:V4SI 1 "register_operand" "0")
19255 (match_operand:V4SI 2 "vector_operand" "xBm")]
19256 UNSPEC_SHA256MSG2))]
19258 "sha256msg2\t{%2, %0|%0, %2}"
19259 [(set_attr "type" "sselog1")
19260 (set_attr "mode" "TI")])
19262 (define_insn "sha256rnds2"
19263 [(set (match_operand:V4SI 0 "register_operand" "=x")
19265 [(match_operand:V4SI 1 "register_operand" "0")
19266 (match_operand:V4SI 2 "vector_operand" "xBm")
19267 (match_operand:V4SI 3 "register_operand" "Yz")]
19268 UNSPEC_SHA256RNDS2))]
19270 "sha256rnds2\t{%3, %2, %0|%0, %2, %3}"
19271 [(set_attr "type" "sselog1")
19272 (set_attr "length_immediate" "1")
19273 (set_attr "mode" "TI")])
19275 (define_insn_and_split "avx512f_<castmode><avxsizesuffix>_<castmode>"
19276 [(set (match_operand:AVX512MODE2P 0 "nonimmediate_operand" "=x,m")
19277 (unspec:AVX512MODE2P
19278 [(match_operand:<ssequartermode> 1 "nonimmediate_operand" "xm,x")]
19282 "&& reload_completed"
19285 rtx op0 = operands[0];
19286 rtx op1 = operands[1];
19288 op0 = gen_rtx_REG (<ssequartermode>mode, REGNO (op0));
19290 op1 = gen_rtx_REG (<MODE>mode, REGNO (op1));
19291 emit_move_insn (op0, op1);
19295 (define_insn_and_split "avx512f_<castmode><avxsizesuffix>_256<castmode>"
19296 [(set (match_operand:AVX512MODE2P 0 "nonimmediate_operand" "=x,m")
19297 (unspec:AVX512MODE2P
19298 [(match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "xm,x")]
19302 "&& reload_completed"
19305 rtx op0 = operands[0];
19306 rtx op1 = operands[1];
19308 op0 = gen_rtx_REG (<ssehalfvecmode>mode, REGNO (op0));
19310 op1 = gen_rtx_REG (<MODE>mode, REGNO (op1));
19311 emit_move_insn (op0, op1);
19315 (define_int_iterator VPMADD52
19316 [UNSPEC_VPMADD52LUQ
19317 UNSPEC_VPMADD52HUQ])
19319 (define_int_attr vpmadd52type
19320 [(UNSPEC_VPMADD52LUQ "luq") (UNSPEC_VPMADD52HUQ "huq")])
19322 (define_expand "vpamdd52huq<mode>_maskz"
19323 [(match_operand:VI8_AVX512VL 0 "register_operand")
19324 (match_operand:VI8_AVX512VL 1 "register_operand")
19325 (match_operand:VI8_AVX512VL 2 "register_operand")
19326 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand")
19327 (match_operand:<avx512fmaskmode> 4 "register_operand")]
19328 "TARGET_AVX512IFMA"
19330 emit_insn (gen_vpamdd52huq<mode>_maskz_1 (
19331 operands[0], operands[1], operands[2], operands[3],
19332 CONST0_RTX (<MODE>mode), operands[4]));
19336 (define_expand "vpamdd52luq<mode>_maskz"
19337 [(match_operand:VI8_AVX512VL 0 "register_operand")
19338 (match_operand:VI8_AVX512VL 1 "register_operand")
19339 (match_operand:VI8_AVX512VL 2 "register_operand")
19340 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand")
19341 (match_operand:<avx512fmaskmode> 4 "register_operand")]
19342 "TARGET_AVX512IFMA"
19344 emit_insn (gen_vpamdd52luq<mode>_maskz_1 (
19345 operands[0], operands[1], operands[2], operands[3],
19346 CONST0_RTX (<MODE>mode), operands[4]));
19350 (define_insn "vpamdd52<vpmadd52type><mode><sd_maskz_name>"
19351 [(set (match_operand:VI8_AVX512VL 0 "register_operand" "=v")
19352 (unspec:VI8_AVX512VL
19353 [(match_operand:VI8_AVX512VL 1 "register_operand" "0")
19354 (match_operand:VI8_AVX512VL 2 "register_operand" "v")
19355 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand" "vm")]
19357 "TARGET_AVX512IFMA"
19358 "vpmadd52<vpmadd52type>\t{%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3}"
19359 [(set_attr "type" "ssemuladd")
19360 (set_attr "prefix" "evex")
19361 (set_attr "mode" "<sseinsnmode>")])
19363 (define_insn "vpamdd52<vpmadd52type><mode>_mask"
19364 [(set (match_operand:VI8_AVX512VL 0 "register_operand" "=v")
19365 (vec_merge:VI8_AVX512VL
19366 (unspec:VI8_AVX512VL
19367 [(match_operand:VI8_AVX512VL 1 "register_operand" "0")
19368 (match_operand:VI8_AVX512VL 2 "register_operand" "v")
19369 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand" "vm")]
19372 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
19373 "TARGET_AVX512IFMA"
19374 "vpmadd52<vpmadd52type>\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3}"
19375 [(set_attr "type" "ssemuladd")
19376 (set_attr "prefix" "evex")
19377 (set_attr "mode" "<sseinsnmode>")])
19379 (define_insn "vpmultishiftqb<mode><mask_name>"
19380 [(set (match_operand:VI1_AVX512VL 0 "register_operand" "=v")
19381 (unspec:VI1_AVX512VL
19382 [(match_operand:VI1_AVX512VL 1 "register_operand" "v")
19383 (match_operand:VI1_AVX512VL 2 "nonimmediate_operand" "vm")]
19384 UNSPEC_VPMULTISHIFT))]
19385 "TARGET_AVX512VBMI"
19386 "vpmultishiftqb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
19387 [(set_attr "type" "sselog")
19388 (set_attr "prefix" "evex")
19389 (set_attr "mode" "<sseinsnmode>")])