1 ;; GCC machine description for SSE instructions
2 ;; Copyright (C) 2005-2020 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" [
56 UNSPEC_XOP_UNSIGNED_CMP
67 UNSPEC_AESKEYGENASSIST
88 ;; For AVX512F support
90 UNSPEC_UNSIGNED_FIX_NOTRUNC
105 UNSPEC_COMPRESS_STORE
115 ;; For embed. rounding feature
116 UNSPEC_EMBEDDED_ROUNDING
118 ;; For AVX512PF support
119 UNSPEC_GATHER_PREFETCH
120 UNSPEC_SCATTER_PREFETCH
122 ;; For AVX512ER support
136 ;; For AVX512BW support
144 ;; For AVX512DQ support
149 ;; For AVX512IFMA support
153 ;; For AVX512VBMI support
156 ;; For AVX5124FMAPS/AVX5124VNNIW support
163 UNSPEC_GF2P8AFFINEINV
167 ;; For AVX512VBMI2 support
173 ;; For AVX512VNNI support
174 UNSPEC_VPMADDUBSWACCD
175 UNSPEC_VPMADDUBSWACCSSD
177 UNSPEC_VPMADDWDACCSSD
185 ;; For VPCLMULQDQ support
188 ;; For AVX512BITALG support
191 ;; For VP2INTERSECT support
194 ;; For AVX512BF16 support
195 UNSPEC_VCVTNE2PS2BF16
200 (define_c_enum "unspecv" [
210 ;; All vector modes including V?TImode, used in move patterns.
211 (define_mode_iterator VMOVE
212 [(V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI
213 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX") V8HI
214 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
215 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI
216 (V4TI "TARGET_AVX512F") (V2TI "TARGET_AVX") V1TI
217 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
218 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") V2DF])
220 ;; All AVX-512{F,VL} vector modes. Supposed TARGET_AVX512F baseline.
221 (define_mode_iterator V48_AVX512VL
222 [V16SI (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")
223 V8DI (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")
224 V16SF (V8SF "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
225 V8DF (V4DF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
227 ;; 1,2 byte AVX-512{BW,VL} vector modes. Supposed TARGET_AVX512BW baseline.
228 (define_mode_iterator VI12_AVX512VL
229 [V64QI (V16QI "TARGET_AVX512VL") (V32QI "TARGET_AVX512VL")
230 V32HI (V16HI "TARGET_AVX512VL") (V8HI "TARGET_AVX512VL")])
232 ;; Same iterator, but without supposed TARGET_AVX512BW
233 (define_mode_iterator VI12_AVX512VLBW
234 [(V64QI "TARGET_AVX512BW") (V16QI "TARGET_AVX512VL")
235 (V32QI "TARGET_AVX512VL && TARGET_AVX512BW") (V32HI "TARGET_AVX512BW")
236 (V16HI "TARGET_AVX512VL") (V8HI "TARGET_AVX512VL")])
238 (define_mode_iterator VI1_AVX512VL
239 [V64QI (V16QI "TARGET_AVX512VL") (V32QI "TARGET_AVX512VL")])
242 (define_mode_iterator V
243 [(V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI
244 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX") V8HI
245 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
246 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI
247 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
248 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
250 ;; All 128bit vector modes
251 (define_mode_iterator V_128
252 [V16QI V8HI V4SI V2DI V4SF (V2DF "TARGET_SSE2")])
254 ;; All 256bit vector modes
255 (define_mode_iterator V_256
256 [V32QI V16HI V8SI V4DI V8SF V4DF])
258 ;; All 128bit and 256bit vector modes
259 (define_mode_iterator V_128_256
260 [V32QI V16QI V16HI V8HI V8SI V4SI V4DI V2DI V8SF V4SF V4DF V2DF])
262 ;; All 512bit vector modes
263 (define_mode_iterator V_512 [V64QI V32HI V16SI V8DI V16SF V8DF])
265 ;; All 256bit and 512bit vector modes
266 (define_mode_iterator V_256_512
267 [V32QI V16HI V8SI V4DI V8SF V4DF
268 (V64QI "TARGET_AVX512F") (V32HI "TARGET_AVX512F") (V16SI "TARGET_AVX512F")
269 (V8DI "TARGET_AVX512F") (V16SF "TARGET_AVX512F") (V8DF "TARGET_AVX512F")])
271 ;; All vector float modes
272 (define_mode_iterator VF
273 [(V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
274 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
276 ;; 128- and 256-bit float vector modes
277 (define_mode_iterator VF_128_256
278 [(V8SF "TARGET_AVX") V4SF
279 (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
281 ;; All SFmode vector float modes
282 (define_mode_iterator VF1
283 [(V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF])
285 (define_mode_iterator VF1_AVX2
286 [(V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX2") V4SF])
288 ;; 128- and 256-bit SF vector modes
289 (define_mode_iterator VF1_128_256
290 [(V8SF "TARGET_AVX") V4SF])
292 (define_mode_iterator VF1_128_256VL
293 [V8SF (V4SF "TARGET_AVX512VL")])
295 ;; All DFmode vector float modes
296 (define_mode_iterator VF2
297 [(V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") V2DF])
299 ;; 128- and 256-bit DF vector modes
300 (define_mode_iterator VF2_128_256
301 [(V4DF "TARGET_AVX") V2DF])
303 (define_mode_iterator VF2_512_256
304 [(V8DF "TARGET_AVX512F") V4DF])
306 (define_mode_iterator VF2_512_256VL
307 [V8DF (V4DF "TARGET_AVX512VL")])
309 ;; All 128bit vector float modes
310 (define_mode_iterator VF_128
311 [V4SF (V2DF "TARGET_SSE2")])
313 ;; All 256bit vector float modes
314 (define_mode_iterator VF_256
317 ;; All 512bit vector float modes
318 (define_mode_iterator VF_512
321 (define_mode_iterator VI48_AVX512VL
322 [V16SI (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")
323 V8DI (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")])
325 (define_mode_iterator VF_AVX512VL
326 [V16SF (V8SF "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
327 V8DF (V4DF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
329 (define_mode_iterator VF2_AVX512VL
330 [V8DF (V4DF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
332 (define_mode_iterator VF1_AVX512VL
333 [V16SF (V8SF "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")])
335 ;; All vector integer modes
336 (define_mode_iterator VI
337 [(V16SI "TARGET_AVX512F") (V8DI "TARGET_AVX512F")
338 (V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX") V16QI
339 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX") V8HI
340 (V8SI "TARGET_AVX") V4SI
341 (V4DI "TARGET_AVX") V2DI])
343 (define_mode_iterator VI_AVX2
344 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI
345 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI
346 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX2") V4SI
347 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX2") V2DI])
349 ;; All QImode vector integer modes
350 (define_mode_iterator VI1
351 [(V32QI "TARGET_AVX") V16QI])
353 ;; All DImode vector integer modes
354 (define_mode_iterator V_AVX
355 [V16QI V8HI V4SI V2DI V4SF V2DF
356 (V32QI "TARGET_AVX") (V16HI "TARGET_AVX")
357 (V8SI "TARGET_AVX") (V4DI "TARGET_AVX")
358 (V8SF "TARGET_AVX") (V4DF"TARGET_AVX")])
360 (define_mode_iterator VI48_AVX
362 (V8SI "TARGET_AVX") (V4DI "TARGET_AVX")])
364 (define_mode_iterator VI8
365 [(V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI])
367 (define_mode_iterator VI8_FVL
368 [(V8DI "TARGET_AVX512F") V4DI (V2DI "TARGET_AVX512VL")])
370 (define_mode_iterator VI8_AVX512VL
371 [V8DI (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")])
373 (define_mode_iterator VI8_256_512
374 [V8DI (V4DI "TARGET_AVX512VL")])
376 (define_mode_iterator VI1_AVX2
377 [(V32QI "TARGET_AVX2") V16QI])
379 (define_mode_iterator VI1_AVX512
380 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI])
382 (define_mode_iterator VI1_AVX512F
383 [(V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI])
385 (define_mode_iterator VI2_AVX2
386 [(V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI])
388 (define_mode_iterator VI2_AVX512F
389 [(V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX2") V8HI])
391 (define_mode_iterator VI4_AVX
392 [(V8SI "TARGET_AVX") V4SI])
394 (define_mode_iterator VI4_AVX2
395 [(V8SI "TARGET_AVX2") V4SI])
397 (define_mode_iterator VI4_AVX512F
398 [(V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX2") V4SI])
400 (define_mode_iterator VI4_AVX512VL
401 [V16SI (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")])
403 (define_mode_iterator VI48_AVX512F_AVX512VL
404 [V4SI V8SI (V16SI "TARGET_AVX512F")
405 (V2DI "TARGET_AVX512VL") (V4DI "TARGET_AVX512VL") (V8DI "TARGET_AVX512F")])
407 (define_mode_iterator VI2_AVX512VL
408 [(V8HI "TARGET_AVX512VL") (V16HI "TARGET_AVX512VL") V32HI])
410 (define_mode_iterator VI1_AVX512VL_F
411 [V32QI (V16QI "TARGET_AVX512VL") (V64QI "TARGET_AVX512F")])
413 (define_mode_iterator VI8_AVX2_AVX512BW
414 [(V8DI "TARGET_AVX512BW") (V4DI "TARGET_AVX2") V2DI])
416 (define_mode_iterator VI8_AVX2
417 [(V4DI "TARGET_AVX2") V2DI])
419 (define_mode_iterator VI8_AVX2_AVX512F
420 [(V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX2") V2DI])
422 (define_mode_iterator VI8_AVX_AVX512F
423 [(V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX")])
425 (define_mode_iterator VI4_128_8_256
429 (define_mode_iterator V8FI
433 (define_mode_iterator V16FI
436 ;; ??? We should probably use TImode instead.
437 (define_mode_iterator VIMAX_AVX2_AVX512BW
438 [(V4TI "TARGET_AVX512BW") (V2TI "TARGET_AVX2") V1TI])
440 ;; Suppose TARGET_AVX512BW as baseline
441 (define_mode_iterator VIMAX_AVX512VL
442 [V4TI (V2TI "TARGET_AVX512VL") (V1TI "TARGET_AVX512VL")])
444 (define_mode_iterator VIMAX_AVX2
445 [(V2TI "TARGET_AVX2") V1TI])
447 ;; ??? This should probably be dropped in favor of VIMAX_AVX2_AVX512BW.
448 (define_mode_iterator SSESCALARMODE
449 [(V4TI "TARGET_AVX512BW") (V2TI "TARGET_AVX2") TI])
451 (define_mode_iterator VI12_AVX2
452 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI
453 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI])
455 (define_mode_iterator VI24_AVX2
456 [(V16HI "TARGET_AVX2") V8HI
457 (V8SI "TARGET_AVX2") V4SI])
459 (define_mode_iterator VI124_AVX2_24_AVX512F_1_AVX512BW
460 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI
461 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX2") V8HI
462 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX2") V4SI])
464 (define_mode_iterator VI124_AVX2
465 [(V32QI "TARGET_AVX2") V16QI
466 (V16HI "TARGET_AVX2") V8HI
467 (V8SI "TARGET_AVX2") V4SI])
469 (define_mode_iterator VI2_AVX2_AVX512BW
470 [(V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI])
472 (define_mode_iterator VI248_AVX512VL
474 (V16HI "TARGET_AVX512VL") (V8SI "TARGET_AVX512VL")
475 (V4DI "TARGET_AVX512VL") (V8HI "TARGET_AVX512VL")
476 (V4SI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")])
478 (define_mode_iterator VI48_AVX2
479 [(V8SI "TARGET_AVX2") V4SI
480 (V4DI "TARGET_AVX2") V2DI])
482 (define_mode_iterator VI248_AVX2
483 [(V16HI "TARGET_AVX2") V8HI
484 (V8SI "TARGET_AVX2") V4SI
485 (V4DI "TARGET_AVX2") V2DI])
487 (define_mode_iterator VI248_AVX2_8_AVX512F_24_AVX512BW
488 [(V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI
489 (V16SI "TARGET_AVX512BW") (V8SI "TARGET_AVX2") V4SI
490 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX2") V2DI])
492 (define_mode_iterator VI248_AVX512BW
493 [(V32HI "TARGET_AVX512BW") V16SI V8DI])
495 (define_mode_iterator VI248_AVX512BW_AVX512VL
496 [(V32HI "TARGET_AVX512BW")
497 (V4DI "TARGET_AVX512VL") V16SI V8DI])
499 ;; Suppose TARGET_AVX512VL as baseline
500 (define_mode_iterator VI248_AVX512BW_1
501 [(V16HI "TARGET_AVX512BW") (V8HI "TARGET_AVX512BW")
505 (define_mode_iterator VI248_AVX512BW_2
506 [(V16HI "TARGET_AVX512BW") (V8HI "TARGET_AVX512BW")
510 (define_mode_iterator VI48_AVX512F
511 [(V16SI "TARGET_AVX512F") V8SI V4SI
512 (V8DI "TARGET_AVX512F") V4DI V2DI])
514 (define_mode_iterator VI48_AVX_AVX512F
515 [(V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
516 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI])
518 (define_mode_iterator VI12_AVX_AVX512F
519 [ (V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI
520 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX") V8HI])
522 (define_mode_iterator V48_AVX2
525 (V4SI "TARGET_AVX2") (V2DI "TARGET_AVX2")
526 (V8SI "TARGET_AVX2") (V4DI "TARGET_AVX2")])
528 (define_mode_iterator VI1_AVX512VLBW
529 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX512VL")
530 (V16QI "TARGET_AVX512VL")])
532 (define_mode_attr avx512
533 [(V16QI "avx512vl") (V32QI "avx512vl") (V64QI "avx512bw")
534 (V8HI "avx512vl") (V16HI "avx512vl") (V32HI "avx512bw")
535 (V4SI "avx512vl") (V8SI "avx512vl") (V16SI "avx512f")
536 (V2DI "avx512vl") (V4DI "avx512vl") (V8DI "avx512f")
537 (V4SF "avx512vl") (V8SF "avx512vl") (V16SF "avx512f")
538 (V2DF "avx512vl") (V4DF "avx512vl") (V8DF "avx512f")])
540 (define_mode_attr sse2_avx_avx512f
541 [(V16QI "sse2") (V32QI "avx") (V64QI "avx512f")
542 (V8HI "avx512vl") (V16HI "avx512vl") (V32HI "avx512bw")
543 (V4SI "sse2") (V8SI "avx") (V16SI "avx512f")
544 (V2DI "avx512vl") (V4DI "avx512vl") (V8DI "avx512f")
545 (V16SF "avx512f") (V8SF "avx") (V4SF "avx")
546 (V8DF "avx512f") (V4DF "avx") (V2DF "avx")])
548 (define_mode_attr sse2_avx2
549 [(V16QI "sse2") (V32QI "avx2") (V64QI "avx512bw")
550 (V8HI "sse2") (V16HI "avx2") (V32HI "avx512bw")
551 (V4SI "sse2") (V8SI "avx2") (V16SI "avx512f")
552 (V2DI "sse2") (V4DI "avx2") (V8DI "avx512f")
553 (V1TI "sse2") (V2TI "avx2") (V4TI "avx512bw")])
555 (define_mode_attr ssse3_avx2
556 [(V16QI "ssse3") (V32QI "avx2") (V64QI "avx512bw")
557 (V4HI "ssse3") (V8HI "ssse3") (V16HI "avx2") (V32HI "avx512bw")
558 (V4SI "ssse3") (V8SI "avx2")
559 (V2DI "ssse3") (V4DI "avx2")
560 (TI "ssse3") (V2TI "avx2") (V4TI "avx512bw")])
562 (define_mode_attr sse4_1_avx2
563 [(V16QI "sse4_1") (V32QI "avx2") (V64QI "avx512bw")
564 (V8HI "sse4_1") (V16HI "avx2") (V32HI "avx512bw")
565 (V4SI "sse4_1") (V8SI "avx2") (V16SI "avx512f")
566 (V2DI "sse4_1") (V4DI "avx2") (V8DI "avx512dq")])
568 (define_mode_attr avx_avx2
569 [(V4SF "avx") (V2DF "avx")
570 (V8SF "avx") (V4DF "avx")
571 (V4SI "avx2") (V2DI "avx2")
572 (V8SI "avx2") (V4DI "avx2")])
574 (define_mode_attr vec_avx2
575 [(V16QI "vec") (V32QI "avx2")
576 (V8HI "vec") (V16HI "avx2")
577 (V4SI "vec") (V8SI "avx2")
578 (V2DI "vec") (V4DI "avx2")])
580 (define_mode_attr avx2_avx512
581 [(V4SI "avx2") (V8SI "avx2") (V16SI "avx512f")
582 (V2DI "avx2") (V4DI "avx2") (V8DI "avx512f")
583 (V4SF "avx2") (V8SF "avx2") (V16SF "avx512f")
584 (V2DF "avx2") (V4DF "avx2") (V8DF "avx512f")
585 (V8HI "avx512vl") (V16HI "avx512vl") (V32HI "avx512bw")])
587 (define_mode_attr shuffletype
588 [(V16SF "f") (V16SI "i") (V8DF "f") (V8DI "i")
589 (V8SF "f") (V8SI "i") (V4DF "f") (V4DI "i")
590 (V4SF "f") (V4SI "i") (V2DF "f") (V2DI "i")
591 (V32HI "i") (V16HI "i") (V8HI "i")
592 (V64QI "i") (V32QI "i") (V16QI "i")
593 (V4TI "i") (V2TI "i") (V1TI "i")])
595 (define_mode_attr ssequartermode
596 [(V16SF "V4SF") (V8DF "V2DF") (V16SI "V4SI") (V8DI "V2DI")])
598 (define_mode_attr ssequarterinsnmode
599 [(V16SF "V4SF") (V8DF "V2DF") (V16SI "TI") (V8DI "TI")])
601 (define_mode_attr vecmemsuffix
602 [(V16SF "{z}") (V8SF "{y}") (V4SF "{x}")
603 (V8DF "{z}") (V4DF "{y}") (V2DF "{x}")])
605 (define_mode_attr ssedoublemodelower
606 [(V16QI "v16hi") (V32QI "v32hi") (V64QI "v64hi")
607 (V8HI "v8si") (V16HI "v16si") (V32HI "v32si")
608 (V4SI "v4di") (V8SI "v8di") (V16SI "v16di")])
610 (define_mode_attr ssedoublemode
611 [(V4SF "V8SF") (V8SF "V16SF") (V16SF "V32SF")
612 (V2DF "V4DF") (V4DF "V8DF") (V8DF "V16DF")
613 (V16QI "V16HI") (V32QI "V32HI") (V64QI "V64HI")
614 (V8HI "V8SI") (V16HI "V16SI") (V32HI "V32SI")
615 (V4SI "V4DI") (V8SI "V16SI") (V16SI "V32SI")
616 (V4DI "V8DI") (V8DI "V16DI")])
618 (define_mode_attr ssebytemode
619 [(V8DI "V64QI") (V4DI "V32QI") (V2DI "V16QI")
620 (V16SI "V64QI") (V8SI "V32QI") (V4SI "V16QI")])
622 ;; All 128bit vector integer modes
623 (define_mode_iterator VI_128 [V16QI V8HI V4SI V2DI])
625 ;; All 256bit vector integer modes
626 (define_mode_iterator VI_256 [V32QI V16HI V8SI V4DI])
628 ;; Various 128bit vector integer mode combinations
629 (define_mode_iterator VI12_128 [V16QI V8HI])
630 (define_mode_iterator VI14_128 [V16QI V4SI])
631 (define_mode_iterator VI124_128 [V16QI V8HI V4SI])
632 (define_mode_iterator VI24_128 [V8HI V4SI])
633 (define_mode_iterator VI248_128 [V8HI V4SI V2DI])
634 (define_mode_iterator VI48_128 [V4SI V2DI])
636 ;; Various 256bit and 512 vector integer mode combinations
637 (define_mode_iterator VI124_256 [V32QI V16HI V8SI])
638 (define_mode_iterator VI124_256_AVX512F_AVX512BW
640 (V64QI "TARGET_AVX512BW")
641 (V32HI "TARGET_AVX512BW")
642 (V16SI "TARGET_AVX512F")])
643 (define_mode_iterator VI48_256 [V8SI V4DI])
644 (define_mode_iterator VI48_512 [V16SI V8DI])
645 (define_mode_iterator VI4_256_8_512 [V8SI V8DI])
646 (define_mode_iterator VI_AVX512BW
647 [V16SI V8DI (V32HI "TARGET_AVX512BW") (V64QI "TARGET_AVX512BW")])
649 ;; Int-float size matches
650 (define_mode_iterator VI4F_128 [V4SI V4SF])
651 (define_mode_iterator VI8F_128 [V2DI V2DF])
652 (define_mode_iterator VI4F_256 [V8SI V8SF])
653 (define_mode_iterator VI8F_256 [V4DI V4DF])
654 (define_mode_iterator VI4F_256_512
656 (V16SI "TARGET_AVX512F") (V16SF "TARGET_AVX512F")])
657 (define_mode_iterator VI48F_256_512
659 (V16SI "TARGET_AVX512F") (V16SF "TARGET_AVX512F")
660 (V8DI "TARGET_AVX512F") (V8DF "TARGET_AVX512F")
661 (V4DI "TARGET_AVX512VL") (V4DF "TARGET_AVX512VL")])
662 (define_mode_iterator VF48_I1248
663 [V16SI V16SF V8DI V8DF V32HI V64QI])
664 (define_mode_iterator VI48F
665 [V16SI V16SF V8DI V8DF
666 (V8SI "TARGET_AVX512VL") (V8SF "TARGET_AVX512VL")
667 (V4DI "TARGET_AVX512VL") (V4DF "TARGET_AVX512VL")
668 (V4SI "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
669 (V2DI "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
670 (define_mode_iterator VI48F_256 [V8SI V8SF V4DI V4DF])
672 (define_mode_iterator VF_AVX512
673 [(V4SF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")
674 (V8SF "TARGET_AVX512VL") (V4DF "TARGET_AVX512VL")
677 (define_mode_attr avx512bcst
678 [(V4SI "%{1to4%}") (V2DI "%{1to2%}")
679 (V8SI "%{1to8%}") (V4DI "%{1to4%}")
680 (V16SI "%{1to16%}") (V8DI "%{1to8%}")
681 (V4SF "%{1to4%}") (V2DF "%{1to2%}")
682 (V8SF "%{1to8%}") (V4DF "%{1to4%}")
683 (V16SF "%{1to16%}") (V8DF "%{1to8%}")])
685 ;; Mapping from float mode to required SSE level
686 (define_mode_attr sse
687 [(SF "sse") (DF "sse2")
688 (V4SF "sse") (V2DF "sse2")
689 (V16SF "avx512f") (V8SF "avx")
690 (V8DF "avx512f") (V4DF "avx")])
692 (define_mode_attr sse2
693 [(V16QI "sse2") (V32QI "avx") (V64QI "avx512f")
694 (V2DI "sse2") (V4DI "avx") (V8DI "avx512f")])
696 (define_mode_attr sse3
697 [(V16QI "sse3") (V32QI "avx")])
699 (define_mode_attr sse4_1
700 [(V4SF "sse4_1") (V2DF "sse4_1")
701 (V8SF "avx") (V4DF "avx")
703 (V4DI "avx") (V2DI "sse4_1")
704 (V8SI "avx") (V4SI "sse4_1")
705 (V16QI "sse4_1") (V32QI "avx")
706 (V8HI "sse4_1") (V16HI "avx")])
708 (define_mode_attr avxsizesuffix
709 [(V64QI "512") (V32HI "512") (V16SI "512") (V8DI "512")
710 (V32QI "256") (V16HI "256") (V8SI "256") (V4DI "256")
711 (V16QI "") (V8HI "") (V4SI "") (V2DI "")
712 (V16SF "512") (V8DF "512")
713 (V8SF "256") (V4DF "256")
714 (V4SF "") (V2DF "")])
716 ;; SSE instruction mode
717 (define_mode_attr sseinsnmode
718 [(V64QI "XI") (V32HI "XI") (V16SI "XI") (V8DI "XI") (V4TI "XI")
719 (V32QI "OI") (V16HI "OI") (V8SI "OI") (V4DI "OI") (V2TI "OI")
720 (V16QI "TI") (V8HI "TI") (V4SI "TI") (V2DI "TI") (V1TI "TI")
721 (V16SF "V16SF") (V8DF "V8DF")
722 (V8SF "V8SF") (V4DF "V4DF")
723 (V4SF "V4SF") (V2DF "V2DF")
726 ;; Mapping of vector modes to corresponding mask size
727 (define_mode_attr avx512fmaskmode
728 [(V64QI "DI") (V32QI "SI") (V16QI "HI")
729 (V32HI "SI") (V16HI "HI") (V8HI "QI") (V4HI "QI")
730 (V16SI "HI") (V8SI "QI") (V4SI "QI")
731 (V8DI "QI") (V4DI "QI") (V2DI "QI")
732 (V16SF "HI") (V8SF "QI") (V4SF "QI")
733 (V8DF "QI") (V4DF "QI") (V2DF "QI")])
735 ;; Mapping of vector modes to corresponding mask size
736 (define_mode_attr avx512fmaskmodelower
737 [(V64QI "di") (V32QI "si") (V16QI "hi")
738 (V32HI "si") (V16HI "hi") (V8HI "qi") (V4HI "qi")
739 (V16SI "hi") (V8SI "qi") (V4SI "qi")
740 (V8DI "qi") (V4DI "qi") (V2DI "qi")
741 (V16SF "hi") (V8SF "qi") (V4SF "qi")
742 (V8DF "qi") (V4DF "qi") (V2DF "qi")])
744 ;; Mapping of vector modes to corresponding mask half size
745 (define_mode_attr avx512fmaskhalfmode
746 [(V64QI "SI") (V32QI "HI") (V16QI "QI")
747 (V32HI "HI") (V16HI "QI") (V8HI "QI") (V4HI "QI")
748 (V16SI "QI") (V8SI "QI") (V4SI "QI")
749 (V8DI "QI") (V4DI "QI") (V2DI "QI")
750 (V16SF "QI") (V8SF "QI") (V4SF "QI")
751 (V8DF "QI") (V4DF "QI") (V2DF "QI")])
753 ;; Mapping of vector float modes to an integer mode of the same size
754 (define_mode_attr sseintvecmode
755 [(V16SF "V16SI") (V8DF "V8DI")
756 (V8SF "V8SI") (V4DF "V4DI")
757 (V4SF "V4SI") (V2DF "V2DI")
758 (V16SI "V16SI") (V8DI "V8DI")
759 (V8SI "V8SI") (V4DI "V4DI")
760 (V4SI "V4SI") (V2DI "V2DI")
761 (V16HI "V16HI") (V8HI "V8HI")
762 (V32HI "V32HI") (V64QI "V64QI")
763 (V32QI "V32QI") (V16QI "V16QI")])
765 (define_mode_attr sseintvecmode2
766 [(V8DF "XI") (V4DF "OI") (V2DF "TI")
767 (V8SF "OI") (V4SF "TI")])
769 (define_mode_attr sseintvecmodelower
770 [(V16SF "v16si") (V8DF "v8di")
771 (V8SF "v8si") (V4DF "v4di")
772 (V4SF "v4si") (V2DF "v2di")
773 (V8SI "v8si") (V4DI "v4di")
774 (V4SI "v4si") (V2DI "v2di")
775 (V16HI "v16hi") (V8HI "v8hi")
776 (V32QI "v32qi") (V16QI "v16qi")])
778 ;; Mapping of vector modes to a vector mode of double size
779 (define_mode_attr ssedoublevecmode
780 [(V32QI "V64QI") (V16HI "V32HI") (V8SI "V16SI") (V4DI "V8DI")
781 (V16QI "V32QI") (V8HI "V16HI") (V4SI "V8SI") (V2DI "V4DI")
782 (V8SF "V16SF") (V4DF "V8DF")
783 (V4SF "V8SF") (V2DF "V4DF")])
785 ;; Mapping of vector modes to a vector mode of half size
786 (define_mode_attr ssehalfvecmode
787 [(V64QI "V32QI") (V32HI "V16HI") (V16SI "V8SI") (V8DI "V4DI") (V4TI "V2TI")
788 (V32QI "V16QI") (V16HI "V8HI") (V8SI "V4SI") (V4DI "V2DI")
789 (V16QI "V8QI") (V8HI "V4HI") (V4SI "V2SI")
790 (V16SF "V8SF") (V8DF "V4DF")
791 (V8SF "V4SF") (V4DF "V2DF")
794 (define_mode_attr ssehalfvecmodelower
795 [(V64QI "v32qi") (V32HI "v16hi") (V16SI "v8si") (V8DI "v4di") (V4TI "v2ti")
796 (V32QI "v16qi") (V16HI "v8hi") (V8SI "v4si") (V4DI "v2di")
797 (V16QI "v8qi") (V8HI "v4hi") (V4SI "v2si")
798 (V16SF "v8sf") (V8DF "v4df")
799 (V8SF "v4sf") (V4DF "v2df")
802 ;; Mapping of vector modes ti packed single mode of the same size
803 (define_mode_attr ssePSmode
804 [(V16SI "V16SF") (V8DF "V16SF")
805 (V16SF "V16SF") (V8DI "V16SF")
806 (V64QI "V16SF") (V32QI "V8SF") (V16QI "V4SF")
807 (V32HI "V16SF") (V16HI "V8SF") (V8HI "V4SF")
808 (V8SI "V8SF") (V4SI "V4SF")
809 (V4DI "V8SF") (V2DI "V4SF")
810 (V4TI "V16SF") (V2TI "V8SF") (V1TI "V4SF")
811 (V8SF "V8SF") (V4SF "V4SF")
812 (V4DF "V8SF") (V2DF "V4SF")])
814 (define_mode_attr ssePSmode2
815 [(V8DI "V8SF") (V4DI "V4SF")])
817 ;; Mapping of vector modes back to the scalar modes
818 (define_mode_attr ssescalarmode
819 [(V64QI "QI") (V32QI "QI") (V16QI "QI")
820 (V32HI "HI") (V16HI "HI") (V8HI "HI")
821 (V16SI "SI") (V8SI "SI") (V4SI "SI")
822 (V8DI "DI") (V4DI "DI") (V2DI "DI")
823 (V16SF "SF") (V8SF "SF") (V4SF "SF")
824 (V8DF "DF") (V4DF "DF") (V2DF "DF")
825 (V4TI "TI") (V2TI "TI")])
827 ;; Mapping of vector modes back to the scalar modes
828 (define_mode_attr ssescalarmodelower
829 [(V64QI "qi") (V32QI "qi") (V16QI "qi")
830 (V32HI "hi") (V16HI "hi") (V8HI "hi")
831 (V16SI "si") (V8SI "si") (V4SI "si")
832 (V8DI "di") (V4DI "di") (V2DI "di")
833 (V16SF "sf") (V8SF "sf") (V4SF "sf")
834 (V8DF "df") (V4DF "df") (V2DF "df")
835 (V4TI "ti") (V2TI "ti")])
837 ;; Mapping of vector modes to the 128bit modes
838 (define_mode_attr ssexmmmode
839 [(V64QI "V16QI") (V32QI "V16QI") (V16QI "V16QI")
840 (V32HI "V8HI") (V16HI "V8HI") (V8HI "V8HI")
841 (V16SI "V4SI") (V8SI "V4SI") (V4SI "V4SI")
842 (V8DI "V2DI") (V4DI "V2DI") (V2DI "V2DI")
843 (V16SF "V4SF") (V8SF "V4SF") (V4SF "V4SF")
844 (V8DF "V2DF") (V4DF "V2DF") (V2DF "V2DF")])
846 ;; Pointer size override for scalar modes (Intel asm dialect)
847 (define_mode_attr iptr
848 [(V64QI "b") (V32HI "w") (V16SI "k") (V8DI "q")
849 (V32QI "b") (V16HI "w") (V8SI "k") (V4DI "q")
850 (V16QI "b") (V8HI "w") (V4SI "k") (V2DI "q")
851 (V16SF "k") (V8DF "q")
852 (V8SF "k") (V4DF "q")
853 (V4SF "k") (V2DF "q")
856 ;; Mapping of vector modes to VPTERNLOG suffix
857 (define_mode_attr ternlogsuffix
858 [(V8DI "q") (V4DI "q") (V2DI "q")
859 (V16SI "d") (V8SI "d") (V4SI "d")
860 (V32HI "d") (V16HI "d") (V8HI "d")
861 (V64QI "d") (V32QI "d") (V16QI "d")])
863 ;; Number of scalar elements in each vector type
864 (define_mode_attr ssescalarnum
865 [(V64QI "64") (V16SI "16") (V8DI "8")
866 (V32QI "32") (V16HI "16") (V8SI "8") (V4DI "4")
867 (V16QI "16") (V8HI "8") (V4SI "4") (V2DI "2")
868 (V16SF "16") (V8DF "8")
869 (V8SF "8") (V4DF "4")
870 (V4SF "4") (V2DF "2")])
872 ;; Mask of scalar elements in each vector type
873 (define_mode_attr ssescalarnummask
874 [(V32QI "31") (V16HI "15") (V8SI "7") (V4DI "3")
875 (V16QI "15") (V8HI "7") (V4SI "3") (V2DI "1")
876 (V8SF "7") (V4DF "3")
877 (V4SF "3") (V2DF "1")])
879 (define_mode_attr ssescalarsize
880 [(V4TI "64") (V2TI "64") (V1TI "64")
881 (V8DI "64") (V4DI "64") (V2DI "64")
882 (V64QI "8") (V32QI "8") (V16QI "8")
883 (V32HI "16") (V16HI "16") (V8HI "16")
884 (V16SI "32") (V8SI "32") (V4SI "32")
885 (V16SF "32") (V8SF "32") (V4SF "32")
886 (V8DF "64") (V4DF "64") (V2DF "64")])
888 ;; SSE prefix for integer vector modes
889 (define_mode_attr sseintprefix
890 [(V2DI "p") (V2DF "")
895 (V16SI "p") (V16SF "")
896 (V16QI "p") (V8HI "p")
897 (V32QI "p") (V16HI "p")
898 (V64QI "p") (V32HI "p")])
900 ;; SSE scalar suffix for vector modes
901 (define_mode_attr ssescalarmodesuffix
903 (V16SF "ss") (V8DF "sd")
904 (V8SF "ss") (V4DF "sd")
905 (V4SF "ss") (V2DF "sd")
906 (V16SI "d") (V8DI "q")
907 (V8SI "d") (V4DI "q")
908 (V4SI "d") (V2DI "q")])
910 ;; Pack/unpack vector modes
911 (define_mode_attr sseunpackmode
912 [(V16QI "V8HI") (V8HI "V4SI") (V4SI "V2DI")
913 (V32QI "V16HI") (V16HI "V8SI") (V8SI "V4DI")
914 (V32HI "V16SI") (V64QI "V32HI") (V16SI "V8DI")])
916 (define_mode_attr ssepackmode
917 [(V8HI "V16QI") (V4SI "V8HI") (V2DI "V4SI")
918 (V16HI "V32QI") (V8SI "V16HI") (V4DI "V8SI")
919 (V32HI "V64QI") (V16SI "V32HI") (V8DI "V16SI")])
921 ;; Mapping of the max integer size for xop rotate immediate constraint
922 (define_mode_attr sserotatemax
923 [(V16QI "7") (V8HI "15") (V4SI "31") (V2DI "63")])
925 ;; Mapping of mode to cast intrinsic name
926 (define_mode_attr castmode
927 [(V8SI "si") (V8SF "ps") (V4DF "pd")
928 (V16SI "si") (V16SF "ps") (V8DF "pd")])
930 ;; Instruction suffix for sign and zero extensions.
931 (define_code_attr extsuffix [(sign_extend "sx") (zero_extend "zx")])
933 ;; i128 for integer vectors and TARGET_AVX2, f128 otherwise.
934 ;; i64x4 or f64x4 for 512bit modes.
935 (define_mode_attr i128
936 [(V16SF "f64x4") (V8SF "f128") (V8DF "f64x4") (V4DF "f128")
937 (V64QI "i64x4") (V32QI "%~128") (V32HI "i64x4") (V16HI "%~128")
938 (V16SI "i64x4") (V8SI "%~128") (V8DI "i64x4") (V4DI "%~128")])
940 ;; For 256-bit modes for TARGET_AVX512VL && TARGET_AVX512DQ
941 ;; i32x4, f32x4, i64x2 or f64x2 suffixes.
942 (define_mode_attr i128vldq
943 [(V8SF "f32x4") (V4DF "f64x2")
944 (V32QI "i32x4") (V16HI "i32x4") (V8SI "i32x4") (V4DI "i64x2")])
947 (define_mode_iterator AVX256MODE2P [V8SI V8SF V4DF])
948 (define_mode_iterator AVX512MODE2P [V16SI V16SF V8DF])
950 ;; Mapping for dbpsabbw modes
951 (define_mode_attr dbpsadbwmode
952 [(V32HI "V64QI") (V16HI "V32QI") (V8HI "V16QI")])
954 ;; Mapping suffixes for broadcast
955 (define_mode_attr bcstscalarsuff
956 [(V64QI "b") (V32QI "b") (V16QI "b")
957 (V32HI "w") (V16HI "w") (V8HI "w")
958 (V16SI "d") (V8SI "d") (V4SI "d")
959 (V8DI "q") (V4DI "q") (V2DI "q")
960 (V16SF "ss") (V8SF "ss") (V4SF "ss")
961 (V8DF "sd") (V4DF "sd") (V2DF "sd")])
963 ;; Tie mode of assembler operand to mode iterator
964 (define_mode_attr xtg_mode
965 [(V16QI "x") (V8HI "x") (V4SI "x") (V2DI "x") (V4SF "x") (V2DF "x")
966 (V32QI "t") (V16HI "t") (V8SI "t") (V4DI "t") (V8SF "t") (V4DF "t")
967 (V64QI "g") (V32HI "g") (V16SI "g") (V8DI "g") (V16SF "g") (V8DF "g")])
969 ;; Half mask mode for unpacks
970 (define_mode_attr HALFMASKMODE
971 [(DI "SI") (SI "HI")])
973 ;; Double mask mode for packs
974 (define_mode_attr DOUBLEMASKMODE
975 [(HI "SI") (SI "DI")])
978 ;; Include define_subst patterns for instructions with mask
981 ;; Patterns whose name begins with "sse{,2,3}_" are invoked by intrinsics.
983 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
987 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
989 ;; All of these patterns are enabled for SSE1 as well as SSE2.
990 ;; This is essential for maintaining stable calling conventions.
992 (define_expand "mov<mode>"
993 [(set (match_operand:VMOVE 0 "nonimmediate_operand")
994 (match_operand:VMOVE 1 "nonimmediate_operand"))]
997 ix86_expand_vector_move (<MODE>mode, operands);
1001 (define_insn "mov<mode>_internal"
1002 [(set (match_operand:VMOVE 0 "nonimmediate_operand"
1004 (match_operand:VMOVE 1 "nonimmediate_or_sse_const_operand"
1007 && (register_operand (operands[0], <MODE>mode)
1008 || register_operand (operands[1], <MODE>mode))"
1010 switch (get_attr_type (insn))
1013 return standard_sse_constant_opcode (insn, operands);
1016 return ix86_output_ssemov (insn, operands);
1022 [(set_attr "type" "sselog1,sselog1,ssemov,ssemov")
1023 (set_attr "prefix" "maybe_vex")
1025 (cond [(match_test "TARGET_AVX")
1026 (const_string "<sseinsnmode>")
1027 (ior (not (match_test "TARGET_SSE2"))
1028 (match_test "optimize_function_for_size_p (cfun)"))
1029 (const_string "V4SF")
1030 (and (match_test "<MODE>mode == V2DFmode")
1031 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
1032 (const_string "V4SF")
1033 (and (eq_attr "alternative" "3")
1034 (match_test "TARGET_SSE_TYPELESS_STORES"))
1035 (const_string "V4SF")
1036 (and (eq_attr "alternative" "0")
1037 (match_test "TARGET_SSE_LOAD0_BY_PXOR"))
1040 (const_string "<sseinsnmode>")))
1041 (set (attr "enabled")
1042 (cond [(and (match_test "<MODE_SIZE> == 16")
1043 (eq_attr "alternative" "1"))
1044 (symbol_ref "TARGET_SSE2")
1045 (and (match_test "<MODE_SIZE> == 32")
1046 (eq_attr "alternative" "1"))
1047 (symbol_ref "TARGET_AVX2")
1049 (symbol_ref "true")))])
1051 (define_insn "<avx512>_load<mode>_mask"
1052 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v,v")
1053 (vec_merge:V48_AVX512VL
1054 (match_operand:V48_AVX512VL 1 "nonimmediate_operand" "v,m")
1055 (match_operand:V48_AVX512VL 2 "nonimm_or_0_operand" "0C,0C")
1056 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
1059 if (FLOAT_MODE_P (GET_MODE_INNER (<MODE>mode)))
1061 if (misaligned_operand (operands[1], <MODE>mode))
1062 return "vmovu<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
1064 return "vmova<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
1068 if (misaligned_operand (operands[1], <MODE>mode))
1069 return "vmovdqu<ssescalarsize>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
1071 return "vmovdqa<ssescalarsize>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
1074 [(set_attr "type" "ssemov")
1075 (set_attr "prefix" "evex")
1076 (set_attr "memory" "none,load")
1077 (set_attr "mode" "<sseinsnmode>")])
1079 (define_insn "<avx512>_load<mode>_mask"
1080 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v,v")
1081 (vec_merge:VI12_AVX512VL
1082 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "v,m")
1083 (match_operand:VI12_AVX512VL 2 "nonimm_or_0_operand" "0C,0C")
1084 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
1086 "vmovdqu<ssescalarsize>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
1087 [(set_attr "type" "ssemov")
1088 (set_attr "prefix" "evex")
1089 (set_attr "memory" "none,load")
1090 (set_attr "mode" "<sseinsnmode>")])
1092 (define_insn "avx512f_mov<ssescalarmodelower>_mask"
1093 [(set (match_operand:VF_128 0 "register_operand" "=v")
1096 (match_operand:VF_128 2 "register_operand" "v")
1097 (match_operand:VF_128 3 "nonimm_or_0_operand" "0C")
1098 (match_operand:QI 4 "register_operand" "Yk"))
1099 (match_operand:VF_128 1 "register_operand" "v")
1102 "vmov<ssescalarmodesuffix>\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
1103 [(set_attr "type" "ssemov")
1104 (set_attr "prefix" "evex")
1105 (set_attr "mode" "<ssescalarmode>")])
1107 (define_expand "avx512f_load<mode>_mask"
1108 [(set (match_operand:<ssevecmode> 0 "register_operand")
1109 (vec_merge:<ssevecmode>
1110 (vec_merge:<ssevecmode>
1111 (vec_duplicate:<ssevecmode>
1112 (match_operand:MODEF 1 "memory_operand"))
1113 (match_operand:<ssevecmode> 2 "nonimm_or_0_operand")
1114 (match_operand:QI 3 "register_operand"))
1118 "operands[4] = CONST0_RTX (<ssevecmode>mode);")
1120 (define_insn "*avx512f_load<mode>_mask"
1121 [(set (match_operand:<ssevecmode> 0 "register_operand" "=v")
1122 (vec_merge:<ssevecmode>
1123 (vec_merge:<ssevecmode>
1124 (vec_duplicate:<ssevecmode>
1125 (match_operand:MODEF 1 "memory_operand" "m"))
1126 (match_operand:<ssevecmode> 2 "nonimm_or_0_operand" "0C")
1127 (match_operand:QI 3 "register_operand" "Yk"))
1128 (match_operand:<ssevecmode> 4 "const0_operand" "C")
1131 "vmov<ssescalarmodesuffix>\t{%1, %0%{%3%}%N2|%0%{3%}%N2, %1}"
1132 [(set_attr "type" "ssemov")
1133 (set_attr "prefix" "evex")
1134 (set_attr "memory" "load")
1135 (set_attr "mode" "<MODE>")])
1137 (define_insn "avx512f_store<mode>_mask"
1138 [(set (match_operand:MODEF 0 "memory_operand" "=m")
1140 (and:QI (match_operand:QI 2 "register_operand" "Yk")
1143 (match_operand:<ssevecmode> 1 "register_operand" "v")
1144 (parallel [(const_int 0)]))
1147 "vmov<ssescalarmodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}"
1148 [(set_attr "type" "ssemov")
1149 (set_attr "prefix" "evex")
1150 (set_attr "memory" "store")
1151 (set_attr "mode" "<MODE>")])
1153 (define_insn "<avx512>_blendm<mode>"
1154 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v")
1155 (vec_merge:V48_AVX512VL
1156 (match_operand:V48_AVX512VL 2 "nonimmediate_operand" "vm")
1157 (match_operand:V48_AVX512VL 1 "register_operand" "v")
1158 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
1160 "v<sseintprefix>blendm<ssemodesuffix>\t{%2, %1, %0%{%3%}|%0%{%3%}, %1, %2}"
1161 [(set_attr "type" "ssemov")
1162 (set_attr "prefix" "evex")
1163 (set_attr "mode" "<sseinsnmode>")])
1165 (define_insn "<avx512>_blendm<mode>"
1166 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
1167 (vec_merge:VI12_AVX512VL
1168 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")
1169 (match_operand:VI12_AVX512VL 1 "register_operand" "v")
1170 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
1172 "vpblendm<ssemodesuffix>\t{%2, %1, %0%{%3%}|%0%{%3%}, %1, %2}"
1173 [(set_attr "type" "ssemov")
1174 (set_attr "prefix" "evex")
1175 (set_attr "mode" "<sseinsnmode>")])
1177 (define_insn "<avx512>_store<mode>_mask"
1178 [(set (match_operand:V48_AVX512VL 0 "memory_operand" "=m")
1179 (vec_merge:V48_AVX512VL
1180 (match_operand:V48_AVX512VL 1 "register_operand" "v")
1182 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")))]
1185 if (FLOAT_MODE_P (GET_MODE_INNER (<MODE>mode)))
1187 if (misaligned_operand (operands[0], <MODE>mode))
1188 return "vmovu<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1190 return "vmova<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1194 if (misaligned_operand (operands[0], <MODE>mode))
1195 return "vmovdqu<ssescalarsize>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1197 return "vmovdqa<ssescalarsize>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1200 [(set_attr "type" "ssemov")
1201 (set_attr "prefix" "evex")
1202 (set_attr "memory" "store")
1203 (set_attr "mode" "<sseinsnmode>")])
1205 (define_insn "<avx512>_store<mode>_mask"
1206 [(set (match_operand:VI12_AVX512VL 0 "memory_operand" "=m")
1207 (vec_merge:VI12_AVX512VL
1208 (match_operand:VI12_AVX512VL 1 "register_operand" "v")
1210 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")))]
1212 "vmovdqu<ssescalarsize>\t{%1, %0%{%2%}|%0%{%2%}, %1}"
1213 [(set_attr "type" "ssemov")
1214 (set_attr "prefix" "evex")
1215 (set_attr "memory" "store")
1216 (set_attr "mode" "<sseinsnmode>")])
1218 (define_insn "sse2_movq128"
1219 [(set (match_operand:V2DI 0 "register_operand" "=v")
1222 (match_operand:V2DI 1 "nonimmediate_operand" "vm")
1223 (parallel [(const_int 0)]))
1226 "%vmovq\t{%1, %0|%0, %q1}"
1227 [(set_attr "type" "ssemov")
1228 (set_attr "prefix" "maybe_vex")
1229 (set_attr "mode" "TI")])
1231 ;; Move a DI from a 32-bit register pair (e.g. %edx:%eax) to an xmm.
1232 ;; We'd rather avoid this entirely; if the 32-bit reg pair was loaded
1233 ;; from memory, we'd prefer to load the memory directly into the %xmm
1234 ;; register. To facilitate this happy circumstance, this pattern won't
1235 ;; split until after register allocation. If the 64-bit value didn't
1236 ;; come from memory, this is the best we can do. This is much better
1237 ;; than storing %edx:%eax into a stack temporary and loading an %xmm
1240 (define_insn_and_split "movdi_to_sse"
1241 [(set (match_operand:V4SI 0 "register_operand" "=x,x,?x")
1242 (unspec:V4SI [(match_operand:DI 1 "nonimmediate_operand" "r,m,r")]
1243 UNSPEC_MOVDI_TO_SSE))
1244 (clobber (match_scratch:V4SI 2 "=X,X,&x"))]
1245 "!TARGET_64BIT && TARGET_SSE2 && TARGET_INTER_UNIT_MOVES_TO_VEC"
1247 "&& reload_completed"
1250 if (register_operand (operands[1], DImode))
1252 /* The DImode arrived in a pair of integral registers (e.g. %edx:%eax).
1253 Assemble the 64-bit DImode value in an xmm register. */
1254 emit_insn (gen_sse2_loadld (operands[0], CONST0_RTX (V4SImode),
1255 gen_lowpart (SImode, operands[1])));
1257 emit_insn (gen_sse4_1_pinsrd (operands[0], operands[0],
1258 gen_highpart (SImode, operands[1]),
1262 emit_insn (gen_sse2_loadld (operands[2], CONST0_RTX (V4SImode),
1263 gen_highpart (SImode, operands[1])));
1264 emit_insn (gen_vec_interleave_lowv4si (operands[0], operands[0],
1268 else if (memory_operand (operands[1], DImode))
1269 emit_insn (gen_vec_concatv2di (gen_lowpart (V2DImode, operands[0]),
1270 operands[1], const0_rtx));
1275 [(set_attr "isa" "sse4,*,*")])
1278 [(set (match_operand:V4SF 0 "register_operand")
1279 (match_operand:V4SF 1 "zero_extended_scalar_load_operand"))]
1280 "TARGET_SSE && reload_completed"
1283 (vec_duplicate:V4SF (match_dup 1))
1287 operands[1] = gen_lowpart (SFmode, operands[1]);
1288 operands[2] = CONST0_RTX (V4SFmode);
1292 [(set (match_operand:V2DF 0 "register_operand")
1293 (match_operand:V2DF 1 "zero_extended_scalar_load_operand"))]
1294 "TARGET_SSE2 && reload_completed"
1295 [(set (match_dup 0) (vec_concat:V2DF (match_dup 1) (match_dup 2)))]
1297 operands[1] = gen_lowpart (DFmode, operands[1]);
1298 operands[2] = CONST0_RTX (DFmode);
1301 (define_expand "movmisalign<mode>"
1302 [(set (match_operand:VMOVE 0 "nonimmediate_operand")
1303 (match_operand:VMOVE 1 "nonimmediate_operand"))]
1306 ix86_expand_vector_move_misalign (<MODE>mode, operands);
1310 ;; Merge movsd/movhpd to movupd for TARGET_SSE_UNALIGNED_LOAD_OPTIMAL targets.
1312 [(set (match_operand:V2DF 0 "sse_reg_operand")
1313 (vec_concat:V2DF (match_operand:DF 1 "memory_operand")
1314 (match_operand:DF 4 "const0_operand")))
1315 (set (match_operand:V2DF 2 "sse_reg_operand")
1316 (vec_concat:V2DF (vec_select:DF (match_dup 2)
1317 (parallel [(const_int 0)]))
1318 (match_operand:DF 3 "memory_operand")))]
1319 "TARGET_SSE2 && TARGET_SSE_UNALIGNED_LOAD_OPTIMAL
1320 && ix86_operands_ok_for_move_multiple (operands, true, DFmode)"
1321 [(set (match_dup 2) (match_dup 5))]
1322 "operands[5] = adjust_address (operands[1], V2DFmode, 0);")
1325 [(set (match_operand:DF 0 "sse_reg_operand")
1326 (match_operand:DF 1 "memory_operand"))
1327 (set (match_operand:V2DF 2 "sse_reg_operand")
1328 (vec_concat:V2DF (match_operand:DF 4 "sse_reg_operand")
1329 (match_operand:DF 3 "memory_operand")))]
1330 "TARGET_SSE2 && TARGET_SSE_UNALIGNED_LOAD_OPTIMAL
1331 && REGNO (operands[4]) == REGNO (operands[2])
1332 && ix86_operands_ok_for_move_multiple (operands, true, DFmode)"
1333 [(set (match_dup 2) (match_dup 5))]
1334 "operands[5] = adjust_address (operands[1], V2DFmode, 0);")
1336 ;; Merge movlpd/movhpd to movupd for TARGET_SSE_UNALIGNED_STORE_OPTIMAL targets.
1338 [(set (match_operand:DF 0 "memory_operand")
1339 (vec_select:DF (match_operand:V2DF 1 "sse_reg_operand")
1340 (parallel [(const_int 0)])))
1341 (set (match_operand:DF 2 "memory_operand")
1342 (vec_select:DF (match_operand:V2DF 3 "sse_reg_operand")
1343 (parallel [(const_int 1)])))]
1344 "TARGET_SSE2 && TARGET_SSE_UNALIGNED_STORE_OPTIMAL
1345 && ix86_operands_ok_for_move_multiple (operands, false, DFmode)"
1346 [(set (match_dup 4) (match_dup 1))]
1347 "operands[4] = adjust_address (operands[0], V2DFmode, 0);")
1349 (define_insn "<sse3>_lddqu<avxsizesuffix>"
1350 [(set (match_operand:VI1 0 "register_operand" "=x")
1351 (unspec:VI1 [(match_operand:VI1 1 "memory_operand" "m")]
1354 "%vlddqu\t{%1, %0|%0, %1}"
1355 [(set_attr "type" "ssemov")
1356 (set_attr "movu" "1")
1357 (set (attr "prefix_data16")
1359 (match_test "TARGET_AVX")
1361 (const_string "0")))
1362 (set (attr "prefix_rep")
1364 (match_test "TARGET_AVX")
1366 (const_string "1")))
1367 (set_attr "prefix" "maybe_vex")
1368 (set_attr "mode" "<sseinsnmode>")])
1370 (define_insn "sse2_movnti<mode>"
1371 [(set (match_operand:SWI48 0 "memory_operand" "=m")
1372 (unspec:SWI48 [(match_operand:SWI48 1 "register_operand" "r")]
1375 "movnti\t{%1, %0|%0, %1}"
1376 [(set_attr "type" "ssemov")
1377 (set_attr "prefix_data16" "0")
1378 (set_attr "mode" "<MODE>")])
1380 (define_insn "<sse>_movnt<mode>"
1381 [(set (match_operand:VF 0 "memory_operand" "=m")
1383 [(match_operand:VF 1 "register_operand" "v")]
1386 "%vmovnt<ssemodesuffix>\t{%1, %0|%0, %1}"
1387 [(set_attr "type" "ssemov")
1388 (set_attr "prefix" "maybe_vex")
1389 (set_attr "mode" "<MODE>")])
1391 (define_insn "<sse2>_movnt<mode>"
1392 [(set (match_operand:VI8 0 "memory_operand" "=m")
1393 (unspec:VI8 [(match_operand:VI8 1 "register_operand" "v")]
1396 "%vmovntdq\t{%1, %0|%0, %1}"
1397 [(set_attr "type" "ssecvt")
1398 (set (attr "prefix_data16")
1400 (match_test "TARGET_AVX")
1402 (const_string "1")))
1403 (set_attr "prefix" "maybe_vex")
1404 (set_attr "mode" "<sseinsnmode>")])
1406 ; Expand patterns for non-temporal stores. At the moment, only those
1407 ; that directly map to insns are defined; it would be possible to
1408 ; define patterns for other modes that would expand to several insns.
1410 ;; Modes handled by storent patterns.
1411 (define_mode_iterator STORENT_MODE
1412 [(DI "TARGET_SSE2 && TARGET_64BIT") (SI "TARGET_SSE2")
1413 (SF "TARGET_SSE4A") (DF "TARGET_SSE4A")
1414 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") (V2DI "TARGET_SSE2")
1415 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
1416 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
1418 (define_expand "storent<mode>"
1419 [(set (match_operand:STORENT_MODE 0 "memory_operand")
1420 (unspec:STORENT_MODE
1421 [(match_operand:STORENT_MODE 1 "register_operand")]
1425 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1429 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1431 ;; All integer modes with AVX512BW/DQ.
1432 (define_mode_iterator SWI1248_AVX512BWDQ
1433 [(QI "TARGET_AVX512DQ") HI (SI "TARGET_AVX512BW") (DI "TARGET_AVX512BW")])
1435 ;; All integer modes with AVX512BW, where HImode operation
1436 ;; can be used instead of QImode.
1437 (define_mode_iterator SWI1248_AVX512BW
1438 [QI HI (SI "TARGET_AVX512BW") (DI "TARGET_AVX512BW")])
1440 ;; All integer modes with AVX512BW/DQ, even HImode requires DQ.
1441 (define_mode_iterator SWI1248_AVX512BWDQ2
1442 [(QI "TARGET_AVX512DQ") (HI "TARGET_AVX512DQ")
1443 (SI "TARGET_AVX512BW") (DI "TARGET_AVX512BW")])
1445 (define_expand "kmov<mskmodesuffix>"
1446 [(set (match_operand:SWI1248_AVX512BWDQ 0 "nonimmediate_operand")
1447 (match_operand:SWI1248_AVX512BWDQ 1 "nonimmediate_operand"))]
1449 && !(MEM_P (operands[0]) && MEM_P (operands[1]))")
1451 (define_insn "k<code><mode>"
1452 [(set (match_operand:SWI1248_AVX512BW 0 "register_operand" "=k")
1453 (any_logic:SWI1248_AVX512BW
1454 (match_operand:SWI1248_AVX512BW 1 "register_operand" "k")
1455 (match_operand:SWI1248_AVX512BW 2 "register_operand" "k")))
1456 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1459 if (get_attr_mode (insn) == MODE_HI)
1460 return "k<logic>w\t{%2, %1, %0|%0, %1, %2}";
1462 return "k<logic><mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}";
1464 [(set_attr "type" "msklog")
1465 (set_attr "prefix" "vex")
1467 (cond [(and (match_test "<MODE>mode == QImode")
1468 (not (match_test "TARGET_AVX512DQ")))
1471 (const_string "<MODE>")))])
1473 (define_insn "kandn<mode>"
1474 [(set (match_operand:SWI1248_AVX512BW 0 "register_operand" "=k")
1475 (and:SWI1248_AVX512BW
1476 (not:SWI1248_AVX512BW
1477 (match_operand:SWI1248_AVX512BW 1 "register_operand" "k"))
1478 (match_operand:SWI1248_AVX512BW 2 "register_operand" "k")))
1479 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1482 if (get_attr_mode (insn) == MODE_HI)
1483 return "kandnw\t{%2, %1, %0|%0, %1, %2}";
1485 return "kandn<mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}";
1487 [(set_attr "type" "msklog")
1488 (set_attr "prefix" "vex")
1490 (cond [(and (match_test "<MODE>mode == QImode")
1491 (not (match_test "TARGET_AVX512DQ")))
1494 (const_string "<MODE>")))])
1496 (define_insn "kxnor<mode>"
1497 [(set (match_operand:SWI1248_AVX512BW 0 "register_operand" "=k")
1498 (not:SWI1248_AVX512BW
1499 (xor:SWI1248_AVX512BW
1500 (match_operand:SWI1248_AVX512BW 1 "register_operand" "k")
1501 (match_operand:SWI1248_AVX512BW 2 "register_operand" "k"))))
1502 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1505 if (get_attr_mode (insn) == MODE_HI)
1506 return "kxnorw\t{%2, %1, %0|%0, %1, %2}";
1508 return "kxnor<mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}";
1510 [(set_attr "type" "msklog")
1511 (set_attr "prefix" "vex")
1513 (cond [(and (match_test "<MODE>mode == QImode")
1514 (not (match_test "TARGET_AVX512DQ")))
1517 (const_string "<MODE>")))])
1519 (define_insn "knot<mode>"
1520 [(set (match_operand:SWI1248_AVX512BW 0 "register_operand" "=k")
1521 (not:SWI1248_AVX512BW
1522 (match_operand:SWI1248_AVX512BW 1 "register_operand" "k")))
1523 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1526 if (get_attr_mode (insn) == MODE_HI)
1527 return "knotw\t{%1, %0|%0, %1}";
1529 return "knot<mskmodesuffix>\t{%1, %0|%0, %1}";
1531 [(set_attr "type" "msklog")
1532 (set_attr "prefix" "vex")
1534 (cond [(and (match_test "<MODE>mode == QImode")
1535 (not (match_test "TARGET_AVX512DQ")))
1538 (const_string "<MODE>")))])
1540 (define_insn "kadd<mode>"
1541 [(set (match_operand:SWI1248_AVX512BWDQ2 0 "register_operand" "=k")
1542 (plus:SWI1248_AVX512BWDQ2
1543 (match_operand:SWI1248_AVX512BWDQ2 1 "register_operand" "k")
1544 (match_operand:SWI1248_AVX512BWDQ2 2 "register_operand" "k")))
1545 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1547 "kadd<mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}"
1548 [(set_attr "type" "msklog")
1549 (set_attr "prefix" "vex")
1550 (set_attr "mode" "<MODE>")])
1552 ;; Mask variant shift mnemonics
1553 (define_code_attr mshift [(ashift "shiftl") (lshiftrt "shiftr")])
1555 (define_insn "k<code><mode>"
1556 [(set (match_operand:SWI1248_AVX512BWDQ 0 "register_operand" "=k")
1557 (any_lshift:SWI1248_AVX512BWDQ
1558 (match_operand:SWI1248_AVX512BWDQ 1 "register_operand" "k")
1559 (match_operand 2 "const_0_to_255_operand" "n")))
1560 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1562 "k<mshift><mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}"
1563 [(set_attr "type" "msklog")
1564 (set_attr "prefix" "vex")
1565 (set_attr "mode" "<MODE>")])
1567 (define_insn "ktest<mode>"
1568 [(set (reg:CC FLAGS_REG)
1570 [(match_operand:SWI1248_AVX512BWDQ2 0 "register_operand" "k")
1571 (match_operand:SWI1248_AVX512BWDQ2 1 "register_operand" "k")]
1574 "ktest<mskmodesuffix>\t{%1, %0|%0, %1}"
1575 [(set_attr "mode" "<MODE>")
1576 (set_attr "type" "msklog")
1577 (set_attr "prefix" "vex")])
1579 (define_insn "kortest<mode>"
1580 [(set (reg:CC FLAGS_REG)
1582 [(match_operand:SWI1248_AVX512BWDQ 0 "register_operand" "k")
1583 (match_operand:SWI1248_AVX512BWDQ 1 "register_operand" "k")]
1586 "kortest<mskmodesuffix>\t{%1, %0|%0, %1}"
1587 [(set_attr "mode" "<MODE>")
1588 (set_attr "type" "msklog")
1589 (set_attr "prefix" "vex")])
1591 (define_insn "kunpckhi"
1592 [(set (match_operand:HI 0 "register_operand" "=k")
1595 (zero_extend:HI (match_operand:QI 1 "register_operand" "k"))
1597 (zero_extend:HI (match_operand:QI 2 "register_operand" "k"))))]
1599 "kunpckbw\t{%2, %1, %0|%0, %1, %2}"
1600 [(set_attr "mode" "HI")
1601 (set_attr "type" "msklog")
1602 (set_attr "prefix" "vex")])
1604 (define_insn "kunpcksi"
1605 [(set (match_operand:SI 0 "register_operand" "=k")
1608 (zero_extend:SI (match_operand:HI 1 "register_operand" "k"))
1610 (zero_extend:SI (match_operand:HI 2 "register_operand" "k"))))]
1612 "kunpckwd\t{%2, %1, %0|%0, %1, %2}"
1613 [(set_attr "mode" "SI")])
1615 (define_insn "kunpckdi"
1616 [(set (match_operand:DI 0 "register_operand" "=k")
1619 (zero_extend:DI (match_operand:SI 1 "register_operand" "k"))
1621 (zero_extend:DI (match_operand:SI 2 "register_operand" "k"))))]
1623 "kunpckdq\t{%2, %1, %0|%0, %1, %2}"
1624 [(set_attr "mode" "DI")])
1627 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1629 ;; Parallel floating point arithmetic
1631 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1633 (define_expand "<code><mode>2"
1634 [(set (match_operand:VF 0 "register_operand")
1636 (match_operand:VF 1 "register_operand")))]
1638 "ix86_expand_fp_absneg_operator (<CODE>, <MODE>mode, operands); DONE;")
1640 (define_insn_and_split "*<code><mode>2"
1641 [(set (match_operand:VF 0 "register_operand" "=x,v")
1643 (match_operand:VF 1 "vector_operand" "%0,v")))
1644 (use (match_operand:VF 2 "vector_operand" "xBm,vm"))]
1647 "&& reload_completed"
1649 (<absneg_op>:VF (match_dup 1) (match_dup 2)))]
1651 [(set_attr "isa" "noavx,avx")])
1653 (define_insn_and_split "*nabs<mode>2"
1654 [(set (match_operand:VF 0 "register_operand" "=x,v")
1657 (match_operand:VF 1 "vector_operand" "%0,v"))))
1658 (use (match_operand:VF 2 "vector_operand" "xBm,vm"))]
1661 "&& reload_completed"
1663 (ior:VF (match_dup 1) (match_dup 2)))]
1665 [(set_attr "isa" "noavx,avx")])
1667 (define_expand "<plusminus_insn><mode>3<mask_name><round_name>"
1668 [(set (match_operand:VF 0 "register_operand")
1670 (match_operand:VF 1 "<round_nimm_predicate>")
1671 (match_operand:VF 2 "<round_nimm_predicate>")))]
1672 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1673 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
1675 (define_insn "*<plusminus_insn><mode>3<mask_name><round_name>"
1676 [(set (match_operand:VF 0 "register_operand" "=x,v")
1678 (match_operand:VF 1 "<round_nimm_predicate>" "<comm>0,v")
1679 (match_operand:VF 2 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
1680 "TARGET_SSE && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)
1681 && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1683 <plusminus_mnemonic><ssemodesuffix>\t{%2, %0|%0, %2}
1684 v<plusminus_mnemonic><ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
1685 [(set_attr "isa" "noavx,avx")
1686 (set_attr "type" "sseadd")
1687 (set_attr "prefix" "<mask_prefix3>")
1688 (set_attr "mode" "<MODE>")])
1690 (define_insn "*sub<mode>3<mask_name>_bcst"
1691 [(set (match_operand:VF_AVX512 0 "register_operand" "=v")
1693 (match_operand:VF_AVX512 1 "register_operand" "v")
1694 (vec_duplicate:VF_AVX512
1695 (match_operand:<ssescalarmode> 2 "memory_operand" "m"))))]
1697 && ix86_binary_operator_ok (MINUS, <MODE>mode, operands)
1698 && <mask_mode512bit_condition>"
1699 "vsub<ssemodesuffix>\t{%2<avx512bcst>, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<avx512bcst>}"
1700 [(set_attr "prefix" "evex")
1701 (set_attr "type" "sseadd")
1702 (set_attr "mode" "<MODE>")])
1704 (define_insn "*add<mode>3<mask_name>_bcst"
1705 [(set (match_operand:VF_AVX512 0 "register_operand" "=v")
1707 (vec_duplicate:VF_AVX512
1708 (match_operand:<ssescalarmode> 1 "memory_operand" "m"))
1709 (match_operand:VF_AVX512 2 "register_operand" "v")))]
1711 && ix86_binary_operator_ok (PLUS, <MODE>mode, operands)
1712 && <mask_mode512bit_condition>"
1713 "vadd<ssemodesuffix>\t{%1<avx512bcst>, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1<avx512bcst>}"
1714 [(set_attr "prefix" "evex")
1715 (set_attr "type" "sseadd")
1716 (set_attr "mode" "<MODE>")])
1718 ;; Standard scalar operation patterns which preserve the rest of the
1719 ;; vector for combiner.
1720 (define_insn "*<sse>_vm<plusminus_insn><mode>3"
1721 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
1723 (vec_duplicate:VF_128
1724 (plusminus:<ssescalarmode>
1725 (vec_select:<ssescalarmode>
1726 (match_operand:VF_128 1 "register_operand" "0,v")
1727 (parallel [(const_int 0)]))
1728 (match_operand:<ssescalarmode> 2 "nonimmediate_operand" "xm,vm")))
1733 <plusminus_mnemonic><ssescalarmodesuffix>\t{%2, %0|%0, %2}
1734 v<plusminus_mnemonic><ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %2}"
1735 [(set_attr "isa" "noavx,avx")
1736 (set_attr "type" "sseadd")
1737 (set_attr "prefix" "orig,vex")
1738 (set_attr "mode" "<ssescalarmode>")])
1740 (define_insn "<sse>_vm<plusminus_insn><mode>3<mask_scalar_name><round_scalar_name>"
1741 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
1744 (match_operand:VF_128 1 "register_operand" "0,v")
1745 (match_operand:VF_128 2 "nonimmediate_operand" "xm,<round_scalar_constraint>"))
1750 <plusminus_mnemonic><ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
1751 v<plusminus_mnemonic><ssescalarmodesuffix>\t{<round_scalar_mask_op3>%2, %1, %0<mask_scalar_operand3>|%0<mask_scalar_operand3>, %1, %<iptr>2<round_scalar_mask_op3>}"
1752 [(set_attr "isa" "noavx,avx")
1753 (set_attr "type" "sseadd")
1754 (set_attr "prefix" "<round_scalar_prefix>")
1755 (set_attr "mode" "<ssescalarmode>")])
1757 (define_expand "mul<mode>3<mask_name><round_name>"
1758 [(set (match_operand:VF 0 "register_operand")
1760 (match_operand:VF 1 "<round_nimm_predicate>")
1761 (match_operand:VF 2 "<round_nimm_predicate>")))]
1762 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1763 "ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);")
1765 (define_insn "*mul<mode>3<mask_name><round_name>"
1766 [(set (match_operand:VF 0 "register_operand" "=x,v")
1768 (match_operand:VF 1 "<round_nimm_predicate>" "%0,v")
1769 (match_operand:VF 2 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
1771 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
1772 && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1774 mul<ssemodesuffix>\t{%2, %0|%0, %2}
1775 vmul<ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
1776 [(set_attr "isa" "noavx,avx")
1777 (set_attr "type" "ssemul")
1778 (set_attr "prefix" "<mask_prefix3>")
1779 (set_attr "btver2_decode" "direct,double")
1780 (set_attr "mode" "<MODE>")])
1782 (define_insn "*mul<mode>3<mask_name>_bcst"
1783 [(set (match_operand:VF_AVX512 0 "register_operand" "=v")
1785 (vec_duplicate:VF_AVX512
1786 (match_operand:<ssescalarmode> 1 "memory_operand" "m"))
1787 (match_operand:VF_AVX512 2 "register_operand" "v")))]
1788 "TARGET_AVX512F && <mask_mode512bit_condition>"
1789 "vmul<ssemodesuffix>\t{%1<avx512bcst>, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1<<avx512bcst>>}"
1790 [(set_attr "prefix" "evex")
1791 (set_attr "type" "ssemul")
1792 (set_attr "mode" "<MODE>")])
1794 ;; Standard scalar operation patterns which preserve the rest of the
1795 ;; vector for combiner.
1796 (define_insn "*<sse>_vm<multdiv_mnemonic><mode>3"
1797 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
1799 (vec_duplicate:VF_128
1800 (multdiv:<ssescalarmode>
1801 (vec_select:<ssescalarmode>
1802 (match_operand:VF_128 1 "register_operand" "0,v")
1803 (parallel [(const_int 0)]))
1804 (match_operand:<ssescalarmode> 2 "nonimmediate_operand" "xm,vm")))
1809 <multdiv_mnemonic><ssescalarmodesuffix>\t{%2, %0|%0, %2}
1810 v<multdiv_mnemonic><ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %2}"
1811 [(set_attr "isa" "noavx,avx")
1812 (set_attr "type" "sse<multdiv_mnemonic>")
1813 (set_attr "prefix" "orig,vex")
1814 (set_attr "btver2_decode" "direct,double")
1815 (set_attr "mode" "<ssescalarmode>")])
1817 (define_insn "<sse>_vm<multdiv_mnemonic><mode>3<mask_scalar_name><round_scalar_name>"
1818 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
1821 (match_operand:VF_128 1 "register_operand" "0,v")
1822 (match_operand:VF_128 2 "nonimmediate_operand" "xm,<round_scalar_constraint>"))
1827 <multdiv_mnemonic><ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
1828 v<multdiv_mnemonic><ssescalarmodesuffix>\t{<round_scalar_mask_op3>%2, %1, %0<mask_scalar_operand3>|%0<mask_scalar_operand3>, %1, %<iptr>2<round_scalar_mask_op3>}"
1829 [(set_attr "isa" "noavx,avx")
1830 (set_attr "type" "sse<multdiv_mnemonic>")
1831 (set_attr "prefix" "<round_scalar_prefix>")
1832 (set_attr "btver2_decode" "direct,double")
1833 (set_attr "mode" "<ssescalarmode>")])
1835 (define_expand "div<mode>3"
1836 [(set (match_operand:VF2 0 "register_operand")
1837 (div:VF2 (match_operand:VF2 1 "register_operand")
1838 (match_operand:VF2 2 "vector_operand")))]
1840 "ix86_fixup_binary_operands_no_copy (DIV, <MODE>mode, operands);")
1842 (define_expand "div<mode>3"
1843 [(set (match_operand:VF1 0 "register_operand")
1844 (div:VF1 (match_operand:VF1 1 "register_operand")
1845 (match_operand:VF1 2 "vector_operand")))]
1848 ix86_fixup_binary_operands_no_copy (DIV, <MODE>mode, operands);
1851 && TARGET_RECIP_VEC_DIV
1852 && !optimize_insn_for_size_p ()
1853 && flag_finite_math_only && !flag_trapping_math
1854 && flag_unsafe_math_optimizations)
1856 ix86_emit_swdivsf (operands[0], operands[1], operands[2], <MODE>mode);
1861 (define_insn "<sse>_div<mode>3<mask_name><round_name>"
1862 [(set (match_operand:VF 0 "register_operand" "=x,v")
1864 (match_operand:VF 1 "register_operand" "0,v")
1865 (match_operand:VF 2 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
1866 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1868 div<ssemodesuffix>\t{%2, %0|%0, %2}
1869 vdiv<ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
1870 [(set_attr "isa" "noavx,avx")
1871 (set_attr "type" "ssediv")
1872 (set_attr "prefix" "<mask_prefix3>")
1873 (set_attr "mode" "<MODE>")])
1875 (define_insn "*<avx512>_div<mode>3<mask_name>_bcst"
1876 [(set (match_operand:VF_AVX512 0 "register_operand" "=v")
1878 (match_operand:VF_AVX512 1 "register_operand" "v")
1879 (vec_duplicate:VF_AVX512
1880 (match_operand:<ssescalarmode> 2 "memory_operand" "m"))))]
1881 "TARGET_AVX512F && <mask_mode512bit_condition>"
1882 "vdiv<ssemodesuffix>\t{%2<avx512bcst>, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<<avx512bcst>>}"
1883 [(set_attr "prefix" "evex")
1884 (set_attr "type" "ssediv")
1885 (set_attr "mode" "<MODE>")])
1887 (define_insn "<sse>_rcp<mode>2"
1888 [(set (match_operand:VF1_128_256 0 "register_operand" "=x")
1890 [(match_operand:VF1_128_256 1 "vector_operand" "xBm")] UNSPEC_RCP))]
1892 "%vrcpps\t{%1, %0|%0, %1}"
1893 [(set_attr "type" "sse")
1894 (set_attr "atom_sse_attr" "rcp")
1895 (set_attr "btver2_sse_attr" "rcp")
1896 (set_attr "prefix" "maybe_vex")
1897 (set_attr "mode" "<MODE>")])
1899 (define_insn "sse_vmrcpv4sf2"
1900 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
1902 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm,xm")]
1904 (match_operand:V4SF 2 "register_operand" "0,x")
1908 rcpss\t{%1, %0|%0, %k1}
1909 vrcpss\t{%1, %2, %0|%0, %2, %k1}"
1910 [(set_attr "isa" "noavx,avx")
1911 (set_attr "type" "sse")
1912 (set_attr "atom_sse_attr" "rcp")
1913 (set_attr "btver2_sse_attr" "rcp")
1914 (set_attr "prefix" "orig,vex")
1915 (set_attr "mode" "SF")])
1917 (define_insn "*sse_vmrcpv4sf2"
1918 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
1921 (unspec:SF [(match_operand:SF 1 "nonimmediate_operand" "xm,xm")]
1923 (match_operand:V4SF 2 "register_operand" "0,x")
1927 rcpss\t{%1, %0|%0, %1}
1928 vrcpss\t{%1, %2, %0|%0, %2, %1}"
1929 [(set_attr "isa" "noavx,avx")
1930 (set_attr "type" "sse")
1931 (set_attr "atom_sse_attr" "rcp")
1932 (set_attr "btver2_sse_attr" "rcp")
1933 (set_attr "prefix" "orig,vex")
1934 (set_attr "mode" "SF")])
1936 (define_insn "<mask_codefor>rcp14<mode><mask_name>"
1937 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
1939 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "vm")]
1942 "vrcp14<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
1943 [(set_attr "type" "sse")
1944 (set_attr "prefix" "evex")
1945 (set_attr "mode" "<MODE>")])
1947 (define_insn "srcp14<mode>"
1948 [(set (match_operand:VF_128 0 "register_operand" "=v")
1951 [(match_operand:VF_128 1 "nonimmediate_operand" "vm")]
1953 (match_operand:VF_128 2 "register_operand" "v")
1956 "vrcp14<ssescalarmodesuffix>\t{%1, %2, %0|%0, %2, %<iptr>1}"
1957 [(set_attr "type" "sse")
1958 (set_attr "prefix" "evex")
1959 (set_attr "mode" "<MODE>")])
1961 (define_insn "srcp14<mode>_mask"
1962 [(set (match_operand:VF_128 0 "register_operand" "=v")
1966 [(match_operand:VF_128 1 "nonimmediate_operand" "vm")]
1968 (match_operand:VF_128 3 "nonimm_or_0_operand" "0C")
1969 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk"))
1970 (match_operand:VF_128 2 "register_operand" "v")
1973 "vrcp14<ssescalarmodesuffix>\t{%1, %2, %0%{%4%}%N3|%0%{%4%}%N3, %2, %<iptr>1}"
1974 [(set_attr "type" "sse")
1975 (set_attr "prefix" "evex")
1976 (set_attr "mode" "<MODE>")])
1978 (define_expand "sqrt<mode>2"
1979 [(set (match_operand:VF2 0 "register_operand")
1980 (sqrt:VF2 (match_operand:VF2 1 "vector_operand")))]
1983 (define_expand "sqrt<mode>2"
1984 [(set (match_operand:VF1 0 "register_operand")
1985 (sqrt:VF1 (match_operand:VF1 1 "vector_operand")))]
1989 && TARGET_RECIP_VEC_SQRT
1990 && !optimize_insn_for_size_p ()
1991 && flag_finite_math_only && !flag_trapping_math
1992 && flag_unsafe_math_optimizations)
1994 ix86_emit_swsqrtsf (operands[0], operands[1], <MODE>mode, false);
1999 (define_insn "<sse>_sqrt<mode>2<mask_name><round_name>"
2000 [(set (match_operand:VF 0 "register_operand" "=x,v")
2001 (sqrt:VF (match_operand:VF 1 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
2002 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
2004 sqrt<ssemodesuffix>\t{%1, %0|%0, %1}
2005 vsqrt<ssemodesuffix>\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
2006 [(set_attr "isa" "noavx,avx")
2007 (set_attr "type" "sse")
2008 (set_attr "atom_sse_attr" "sqrt")
2009 (set_attr "btver2_sse_attr" "sqrt")
2010 (set_attr "prefix" "maybe_vex")
2011 (set_attr "mode" "<MODE>")])
2013 (define_insn "<sse>_vmsqrt<mode>2<mask_scalar_name><round_scalar_name>"
2014 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
2017 (match_operand:VF_128 1 "nonimmediate_operand" "xm,<round_scalar_constraint>"))
2018 (match_operand:VF_128 2 "register_operand" "0,v")
2022 sqrt<ssescalarmodesuffix>\t{%1, %0|%0, %<iptr>1}
2023 vsqrt<ssescalarmodesuffix>\t{<round_scalar_mask_op3>%1, %2, %0<mask_scalar_operand3>|%0<mask_scalar_operand3>, %2, %<iptr>1<round_scalar_mask_op3>}"
2024 [(set_attr "isa" "noavx,avx")
2025 (set_attr "type" "sse")
2026 (set_attr "atom_sse_attr" "sqrt")
2027 (set_attr "prefix" "<round_scalar_prefix>")
2028 (set_attr "btver2_sse_attr" "sqrt")
2029 (set_attr "mode" "<ssescalarmode>")])
2031 (define_insn "*<sse>_vmsqrt<mode>2<mask_scalar_name><round_scalar_name>"
2032 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
2034 (vec_duplicate:VF_128
2035 (sqrt:<ssescalarmode>
2036 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "xm,<round_scalar_constraint>")))
2037 (match_operand:VF_128 2 "register_operand" "0,v")
2041 sqrt<ssescalarmodesuffix>\t{%1, %0|%0, %1}
2042 vsqrt<ssescalarmodesuffix>\t{<round_scalar_mask_op3>%1, %2, %0<mask_scalar_operand3>|%0<mask_scalar_operand3>, %2, %1<round_scalar_mask_op3>}"
2043 [(set_attr "isa" "noavx,avx")
2044 (set_attr "type" "sse")
2045 (set_attr "atom_sse_attr" "sqrt")
2046 (set_attr "prefix" "<round_scalar_prefix>")
2047 (set_attr "btver2_sse_attr" "sqrt")
2048 (set_attr "mode" "<ssescalarmode>")])
2050 (define_expand "rsqrt<mode>2"
2051 [(set (match_operand:VF1_128_256 0 "register_operand")
2053 [(match_operand:VF1_128_256 1 "vector_operand")] UNSPEC_RSQRT))]
2054 "TARGET_SSE && TARGET_SSE_MATH"
2056 ix86_emit_swsqrtsf (operands[0], operands[1], <MODE>mode, true);
2060 (define_expand "rsqrtv16sf2"
2061 [(set (match_operand:V16SF 0 "register_operand")
2063 [(match_operand:V16SF 1 "vector_operand")]
2065 "TARGET_AVX512ER && TARGET_SSE_MATH"
2067 ix86_emit_swsqrtsf (operands[0], operands[1], V16SFmode, true);
2071 (define_insn "<sse>_rsqrt<mode>2"
2072 [(set (match_operand:VF1_128_256 0 "register_operand" "=x")
2074 [(match_operand:VF1_128_256 1 "vector_operand" "xBm")] UNSPEC_RSQRT))]
2076 "%vrsqrtps\t{%1, %0|%0, %1}"
2077 [(set_attr "type" "sse")
2078 (set_attr "prefix" "maybe_vex")
2079 (set_attr "mode" "<MODE>")])
2081 (define_insn "<mask_codefor>rsqrt14<mode><mask_name>"
2082 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
2084 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "vm")]
2087 "vrsqrt14<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
2088 [(set_attr "type" "sse")
2089 (set_attr "prefix" "evex")
2090 (set_attr "mode" "<MODE>")])
2092 (define_insn "rsqrt14<mode>"
2093 [(set (match_operand:VF_128 0 "register_operand" "=v")
2096 [(match_operand:VF_128 1 "nonimmediate_operand" "vm")]
2098 (match_operand:VF_128 2 "register_operand" "v")
2101 "vrsqrt14<ssescalarmodesuffix>\t{%1, %2, %0|%0, %2, %<iptr>1}"
2102 [(set_attr "type" "sse")
2103 (set_attr "prefix" "evex")
2104 (set_attr "mode" "<MODE>")])
2106 (define_insn "rsqrt14_<mode>_mask"
2107 [(set (match_operand:VF_128 0 "register_operand" "=v")
2111 [(match_operand:VF_128 1 "nonimmediate_operand" "vm")]
2113 (match_operand:VF_128 3 "nonimm_or_0_operand" "0C")
2114 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk"))
2115 (match_operand:VF_128 2 "register_operand" "v")
2118 "vrsqrt14<ssescalarmodesuffix>\t{%1, %2, %0%{%4%}%N3|%0%{%4%}%N3, %2, %<iptr>1}"
2119 [(set_attr "type" "sse")
2120 (set_attr "prefix" "evex")
2121 (set_attr "mode" "<MODE>")])
2123 (define_insn "sse_vmrsqrtv4sf2"
2124 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
2126 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm,xm")]
2128 (match_operand:V4SF 2 "register_operand" "0,x")
2132 rsqrtss\t{%1, %0|%0, %k1}
2133 vrsqrtss\t{%1, %2, %0|%0, %2, %k1}"
2134 [(set_attr "isa" "noavx,avx")
2135 (set_attr "type" "sse")
2136 (set_attr "prefix" "orig,vex")
2137 (set_attr "mode" "SF")])
2139 (define_insn "*sse_vmrsqrtv4sf2"
2140 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
2143 (unspec:SF [(match_operand:SF 1 "nonimmediate_operand" "xm,xm")]
2145 (match_operand:V4SF 2 "register_operand" "0,x")
2149 rsqrtss\t{%1, %0|%0, %1}
2150 vrsqrtss\t{%1, %2, %0|%0, %2, %1}"
2151 [(set_attr "isa" "noavx,avx")
2152 (set_attr "type" "sse")
2153 (set_attr "prefix" "orig,vex")
2154 (set_attr "mode" "SF")])
2156 (define_expand "<code><mode>3<mask_name><round_saeonly_name>"
2157 [(set (match_operand:VF 0 "register_operand")
2159 (match_operand:VF 1 "<round_saeonly_nimm_predicate>")
2160 (match_operand:VF 2 "<round_saeonly_nimm_predicate>")))]
2161 "TARGET_SSE && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
2163 if (!flag_finite_math_only || flag_signed_zeros)
2165 operands[1] = force_reg (<MODE>mode, operands[1]);
2166 emit_insn (gen_ieee_<maxmin_float><mode>3<mask_name><round_saeonly_name>
2167 (operands[0], operands[1], operands[2]
2168 <mask_operand_arg34>
2169 <round_saeonly_mask_arg3>));
2173 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
2176 ;; These versions of the min/max patterns are intentionally ignorant of
2177 ;; their behavior wrt -0.0 and NaN (via the commutative operand mark).
2178 ;; Since both the tree-level MAX_EXPR and the rtl-level SMAX operator
2179 ;; are undefined in this condition, we're certain this is correct.
2181 (define_insn "*<code><mode>3<mask_name><round_saeonly_name>"
2182 [(set (match_operand:VF 0 "register_operand" "=x,v")
2184 (match_operand:VF 1 "<round_saeonly_nimm_predicate>" "%0,v")
2185 (match_operand:VF 2 "<round_saeonly_nimm_predicate>" "xBm,<round_saeonly_constraint>")))]
2187 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
2188 && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
2190 <maxmin_float><ssemodesuffix>\t{%2, %0|%0, %2}
2191 v<maxmin_float><ssemodesuffix>\t{<round_saeonly_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_saeonly_mask_op3>}"
2192 [(set_attr "isa" "noavx,avx")
2193 (set_attr "type" "sseadd")
2194 (set_attr "btver2_sse_attr" "maxmin")
2195 (set_attr "prefix" "<mask_prefix3>")
2196 (set_attr "mode" "<MODE>")])
2198 ;; These versions of the min/max patterns implement exactly the operations
2199 ;; min = (op1 < op2 ? op1 : op2)
2200 ;; max = (!(op1 < op2) ? op1 : op2)
2201 ;; Their operands are not commutative, and thus they may be used in the
2202 ;; presence of -0.0 and NaN.
2204 (define_insn "ieee_<ieee_maxmin><mode>3<mask_name><round_saeonly_name>"
2205 [(set (match_operand:VF 0 "register_operand" "=x,v")
2207 [(match_operand:VF 1 "register_operand" "0,v")
2208 (match_operand:VF 2 "<round_saeonly_nimm_predicate>" "xBm,<round_saeonly_constraint>")]
2211 && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
2213 <ieee_maxmin><ssemodesuffix>\t{%2, %0|%0, %2}
2214 v<ieee_maxmin><ssemodesuffix>\t{<round_saeonly_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_saeonly_mask_op3>}"
2215 [(set_attr "isa" "noavx,avx")
2216 (set_attr "type" "sseadd")
2217 (set_attr "btver2_sse_attr" "maxmin")
2218 (set_attr "prefix" "<mask_prefix3>")
2219 (set_attr "mode" "<MODE>")])
2221 ;; Standard scalar operation patterns which preserve the rest of the
2222 ;; vector for combiner.
2223 (define_insn "*ieee_<ieee_maxmin><mode>3"
2224 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
2226 (vec_duplicate:VF_128
2227 (unspec:<ssescalarmode>
2228 [(vec_select:<ssescalarmode>
2229 (match_operand:VF_128 1 "register_operand" "0,v")
2230 (parallel [(const_int 0)]))
2231 (match_operand:<ssescalarmode> 2 "nonimmediate_operand" "xm,vm")]
2237 <ieee_maxmin><ssescalarmodesuffix>\t{%2, %0|%0, %2}
2238 v<ieee_maxmin><ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %2}"
2239 [(set_attr "isa" "noavx,avx")
2240 (set_attr "type" "sseadd")
2241 (set_attr "btver2_sse_attr" "maxmin")
2242 (set_attr "prefix" "orig,vex")
2243 (set_attr "mode" "<ssescalarmode>")])
2245 (define_insn "<sse>_vm<code><mode>3<mask_scalar_name><round_saeonly_scalar_name>"
2246 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
2249 (match_operand:VF_128 1 "register_operand" "0,v")
2250 (match_operand:VF_128 2 "nonimmediate_operand" "xm,<round_saeonly_scalar_constraint>"))
2255 <maxmin_float><ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
2256 v<maxmin_float><ssescalarmodesuffix>\t{<round_saeonly_scalar_mask_op3>%2, %1, %0<mask_scalar_operand3>|%0<mask_scalar_operand3>, %1, %<iptr>2<round_saeonly_scalar_mask_op3>}"
2257 [(set_attr "isa" "noavx,avx")
2258 (set_attr "type" "sse")
2259 (set_attr "btver2_sse_attr" "maxmin")
2260 (set_attr "prefix" "<round_saeonly_scalar_prefix>")
2261 (set_attr "mode" "<ssescalarmode>")])
2263 (define_insn "avx_addsubv4df3"
2264 [(set (match_operand:V4DF 0 "register_operand" "=x")
2267 (match_operand:V4DF 1 "register_operand" "x")
2268 (match_operand:V4DF 2 "nonimmediate_operand" "xm"))
2269 (plus:V4DF (match_dup 1) (match_dup 2))
2272 "vaddsubpd\t{%2, %1, %0|%0, %1, %2}"
2273 [(set_attr "type" "sseadd")
2274 (set_attr "prefix" "vex")
2275 (set_attr "mode" "V4DF")])
2277 (define_insn "sse3_addsubv2df3"
2278 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
2281 (match_operand:V2DF 1 "register_operand" "0,x")
2282 (match_operand:V2DF 2 "vector_operand" "xBm,xm"))
2283 (plus:V2DF (match_dup 1) (match_dup 2))
2287 addsubpd\t{%2, %0|%0, %2}
2288 vaddsubpd\t{%2, %1, %0|%0, %1, %2}"
2289 [(set_attr "isa" "noavx,avx")
2290 (set_attr "type" "sseadd")
2291 (set_attr "atom_unit" "complex")
2292 (set_attr "prefix" "orig,vex")
2293 (set_attr "mode" "V2DF")])
2295 (define_insn "avx_addsubv8sf3"
2296 [(set (match_operand:V8SF 0 "register_operand" "=x")
2299 (match_operand:V8SF 1 "register_operand" "x")
2300 (match_operand:V8SF 2 "nonimmediate_operand" "xm"))
2301 (plus:V8SF (match_dup 1) (match_dup 2))
2304 "vaddsubps\t{%2, %1, %0|%0, %1, %2}"
2305 [(set_attr "type" "sseadd")
2306 (set_attr "prefix" "vex")
2307 (set_attr "mode" "V8SF")])
2309 (define_insn "sse3_addsubv4sf3"
2310 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
2313 (match_operand:V4SF 1 "register_operand" "0,x")
2314 (match_operand:V4SF 2 "vector_operand" "xBm,xm"))
2315 (plus:V4SF (match_dup 1) (match_dup 2))
2319 addsubps\t{%2, %0|%0, %2}
2320 vaddsubps\t{%2, %1, %0|%0, %1, %2}"
2321 [(set_attr "isa" "noavx,avx")
2322 (set_attr "type" "sseadd")
2323 (set_attr "prefix" "orig,vex")
2324 (set_attr "prefix_rep" "1,*")
2325 (set_attr "mode" "V4SF")])
2328 [(set (match_operand:VF_128_256 0 "register_operand")
2329 (match_operator:VF_128_256 6 "addsub_vm_operator"
2331 (match_operand:VF_128_256 1 "register_operand")
2332 (match_operand:VF_128_256 2 "vector_operand"))
2334 (match_operand:VF_128_256 3 "vector_operand")
2335 (match_operand:VF_128_256 4 "vector_operand"))
2336 (match_operand 5 "const_int_operand")]))]
2338 && can_create_pseudo_p ()
2339 && ((rtx_equal_p (operands[1], operands[3])
2340 && rtx_equal_p (operands[2], operands[4]))
2341 || (rtx_equal_p (operands[1], operands[4])
2342 && rtx_equal_p (operands[2], operands[3])))"
2344 (vec_merge:VF_128_256
2345 (minus:VF_128_256 (match_dup 1) (match_dup 2))
2346 (plus:VF_128_256 (match_dup 1) (match_dup 2))
2350 [(set (match_operand:VF_128_256 0 "register_operand")
2351 (match_operator:VF_128_256 6 "addsub_vm_operator"
2353 (match_operand:VF_128_256 1 "vector_operand")
2354 (match_operand:VF_128_256 2 "vector_operand"))
2356 (match_operand:VF_128_256 3 "register_operand")
2357 (match_operand:VF_128_256 4 "vector_operand"))
2358 (match_operand 5 "const_int_operand")]))]
2360 && can_create_pseudo_p ()
2361 && ((rtx_equal_p (operands[1], operands[3])
2362 && rtx_equal_p (operands[2], operands[4]))
2363 || (rtx_equal_p (operands[1], operands[4])
2364 && rtx_equal_p (operands[2], operands[3])))"
2366 (vec_merge:VF_128_256
2367 (minus:VF_128_256 (match_dup 3) (match_dup 4))
2368 (plus:VF_128_256 (match_dup 3) (match_dup 4))
2371 /* Negate mask bits to compensate for swapped PLUS and MINUS RTXes. */
2373 = GEN_INT (~INTVAL (operands[5])
2374 & ((HOST_WIDE_INT_1U << GET_MODE_NUNITS (<MODE>mode)) - 1));
2378 [(set (match_operand:VF_128_256 0 "register_operand")
2379 (match_operator:VF_128_256 7 "addsub_vs_operator"
2380 [(vec_concat:<ssedoublemode>
2382 (match_operand:VF_128_256 1 "register_operand")
2383 (match_operand:VF_128_256 2 "vector_operand"))
2385 (match_operand:VF_128_256 3 "vector_operand")
2386 (match_operand:VF_128_256 4 "vector_operand")))
2387 (match_parallel 5 "addsub_vs_parallel"
2388 [(match_operand 6 "const_int_operand")])]))]
2390 && can_create_pseudo_p ()
2391 && ((rtx_equal_p (operands[1], operands[3])
2392 && rtx_equal_p (operands[2], operands[4]))
2393 || (rtx_equal_p (operands[1], operands[4])
2394 && rtx_equal_p (operands[2], operands[3])))"
2396 (vec_merge:VF_128_256
2397 (minus:VF_128_256 (match_dup 1) (match_dup 2))
2398 (plus:VF_128_256 (match_dup 1) (match_dup 2))
2401 int i, nelt = XVECLEN (operands[5], 0);
2402 HOST_WIDE_INT ival = 0;
2404 for (i = 0; i < nelt; i++)
2405 if (INTVAL (XVECEXP (operands[5], 0, i)) < GET_MODE_NUNITS (<MODE>mode))
2406 ival |= HOST_WIDE_INT_1 << i;
2408 operands[5] = GEN_INT (ival);
2412 [(set (match_operand:VF_128_256 0 "register_operand")
2413 (match_operator:VF_128_256 7 "addsub_vs_operator"
2414 [(vec_concat:<ssedoublemode>
2416 (match_operand:VF_128_256 1 "vector_operand")
2417 (match_operand:VF_128_256 2 "vector_operand"))
2419 (match_operand:VF_128_256 3 "register_operand")
2420 (match_operand:VF_128_256 4 "vector_operand")))
2421 (match_parallel 5 "addsub_vs_parallel"
2422 [(match_operand 6 "const_int_operand")])]))]
2424 && can_create_pseudo_p ()
2425 && ((rtx_equal_p (operands[1], operands[3])
2426 && rtx_equal_p (operands[2], operands[4]))
2427 || (rtx_equal_p (operands[1], operands[4])
2428 && rtx_equal_p (operands[2], operands[3])))"
2430 (vec_merge:VF_128_256
2431 (minus:VF_128_256 (match_dup 3) (match_dup 4))
2432 (plus:VF_128_256 (match_dup 3) (match_dup 4))
2435 int i, nelt = XVECLEN (operands[5], 0);
2436 HOST_WIDE_INT ival = 0;
2438 for (i = 0; i < nelt; i++)
2439 if (INTVAL (XVECEXP (operands[5], 0, i)) >= GET_MODE_NUNITS (<MODE>mode))
2440 ival |= HOST_WIDE_INT_1 << i;
2442 operands[5] = GEN_INT (ival);
2445 (define_insn "avx_h<plusminus_insn>v4df3"
2446 [(set (match_operand:V4DF 0 "register_operand" "=x")
2451 (match_operand:V4DF 1 "register_operand" "x")
2452 (parallel [(const_int 0)]))
2453 (vec_select:DF (match_dup 1) (parallel [(const_int 1)])))
2456 (match_operand:V4DF 2 "nonimmediate_operand" "xm")
2457 (parallel [(const_int 0)]))
2458 (vec_select:DF (match_dup 2) (parallel [(const_int 1)]))))
2461 (vec_select:DF (match_dup 1) (parallel [(const_int 2)]))
2462 (vec_select:DF (match_dup 1) (parallel [(const_int 3)])))
2464 (vec_select:DF (match_dup 2) (parallel [(const_int 2)]))
2465 (vec_select:DF (match_dup 2) (parallel [(const_int 3)]))))))]
2467 "vh<plusminus_mnemonic>pd\t{%2, %1, %0|%0, %1, %2}"
2468 [(set_attr "type" "sseadd")
2469 (set_attr "prefix" "vex")
2470 (set_attr "mode" "V4DF")])
2472 (define_expand "sse3_haddv2df3"
2473 [(set (match_operand:V2DF 0 "register_operand")
2477 (match_operand:V2DF 1 "register_operand")
2478 (parallel [(const_int 0)]))
2479 (vec_select:DF (match_dup 1) (parallel [(const_int 1)])))
2482 (match_operand:V2DF 2 "vector_operand")
2483 (parallel [(const_int 0)]))
2484 (vec_select:DF (match_dup 2) (parallel [(const_int 1)])))))]
2487 (define_insn "*sse3_haddv2df3"
2488 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
2492 (match_operand:V2DF 1 "register_operand" "0,x")
2493 (parallel [(match_operand:SI 3 "const_0_to_1_operand")]))
2496 (parallel [(match_operand:SI 4 "const_0_to_1_operand")])))
2499 (match_operand:V2DF 2 "vector_operand" "xBm,xm")
2500 (parallel [(match_operand:SI 5 "const_0_to_1_operand")]))
2503 (parallel [(match_operand:SI 6 "const_0_to_1_operand")])))))]
2505 && INTVAL (operands[3]) != INTVAL (operands[4])
2506 && INTVAL (operands[5]) != INTVAL (operands[6])"
2508 haddpd\t{%2, %0|%0, %2}
2509 vhaddpd\t{%2, %1, %0|%0, %1, %2}"
2510 [(set_attr "isa" "noavx,avx")
2511 (set_attr "type" "sseadd")
2512 (set_attr "prefix" "orig,vex")
2513 (set_attr "mode" "V2DF")])
2515 (define_insn "sse3_hsubv2df3"
2516 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
2520 (match_operand:V2DF 1 "register_operand" "0,x")
2521 (parallel [(const_int 0)]))
2522 (vec_select:DF (match_dup 1) (parallel [(const_int 1)])))
2525 (match_operand:V2DF 2 "vector_operand" "xBm,xm")
2526 (parallel [(const_int 0)]))
2527 (vec_select:DF (match_dup 2) (parallel [(const_int 1)])))))]
2530 hsubpd\t{%2, %0|%0, %2}
2531 vhsubpd\t{%2, %1, %0|%0, %1, %2}"
2532 [(set_attr "isa" "noavx,avx")
2533 (set_attr "type" "sseadd")
2534 (set_attr "prefix" "orig,vex")
2535 (set_attr "mode" "V2DF")])
2537 (define_insn "*sse3_haddv2df3_low"
2538 [(set (match_operand:DF 0 "register_operand" "=x,x")
2541 (match_operand:V2DF 1 "register_operand" "0,x")
2542 (parallel [(match_operand:SI 2 "const_0_to_1_operand")]))
2545 (parallel [(match_operand:SI 3 "const_0_to_1_operand")]))))]
2547 && INTVAL (operands[2]) != INTVAL (operands[3])"
2549 haddpd\t{%0, %0|%0, %0}
2550 vhaddpd\t{%1, %1, %0|%0, %1, %1}"
2551 [(set_attr "isa" "noavx,avx")
2552 (set_attr "type" "sseadd1")
2553 (set_attr "prefix" "orig,vex")
2554 (set_attr "mode" "V2DF")])
2556 (define_insn "*sse3_hsubv2df3_low"
2557 [(set (match_operand:DF 0 "register_operand" "=x,x")
2560 (match_operand:V2DF 1 "register_operand" "0,x")
2561 (parallel [(const_int 0)]))
2564 (parallel [(const_int 1)]))))]
2567 hsubpd\t{%0, %0|%0, %0}
2568 vhsubpd\t{%1, %1, %0|%0, %1, %1}"
2569 [(set_attr "isa" "noavx,avx")
2570 (set_attr "type" "sseadd1")
2571 (set_attr "prefix" "orig,vex")
2572 (set_attr "mode" "V2DF")])
2574 (define_insn "avx_h<plusminus_insn>v8sf3"
2575 [(set (match_operand:V8SF 0 "register_operand" "=x")
2581 (match_operand:V8SF 1 "register_operand" "x")
2582 (parallel [(const_int 0)]))
2583 (vec_select:SF (match_dup 1) (parallel [(const_int 1)])))
2585 (vec_select:SF (match_dup 1) (parallel [(const_int 2)]))
2586 (vec_select:SF (match_dup 1) (parallel [(const_int 3)]))))
2590 (match_operand:V8SF 2 "nonimmediate_operand" "xm")
2591 (parallel [(const_int 0)]))
2592 (vec_select:SF (match_dup 2) (parallel [(const_int 1)])))
2594 (vec_select:SF (match_dup 2) (parallel [(const_int 2)]))
2595 (vec_select:SF (match_dup 2) (parallel [(const_int 3)])))))
2599 (vec_select:SF (match_dup 1) (parallel [(const_int 4)]))
2600 (vec_select:SF (match_dup 1) (parallel [(const_int 5)])))
2602 (vec_select:SF (match_dup 1) (parallel [(const_int 6)]))
2603 (vec_select:SF (match_dup 1) (parallel [(const_int 7)]))))
2606 (vec_select:SF (match_dup 2) (parallel [(const_int 4)]))
2607 (vec_select:SF (match_dup 2) (parallel [(const_int 5)])))
2609 (vec_select:SF (match_dup 2) (parallel [(const_int 6)]))
2610 (vec_select:SF (match_dup 2) (parallel [(const_int 7)])))))))]
2612 "vh<plusminus_mnemonic>ps\t{%2, %1, %0|%0, %1, %2}"
2613 [(set_attr "type" "sseadd")
2614 (set_attr "prefix" "vex")
2615 (set_attr "mode" "V8SF")])
2617 (define_insn "sse3_h<plusminus_insn>v4sf3"
2618 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
2623 (match_operand:V4SF 1 "register_operand" "0,x")
2624 (parallel [(const_int 0)]))
2625 (vec_select:SF (match_dup 1) (parallel [(const_int 1)])))
2627 (vec_select:SF (match_dup 1) (parallel [(const_int 2)]))
2628 (vec_select:SF (match_dup 1) (parallel [(const_int 3)]))))
2632 (match_operand:V4SF 2 "vector_operand" "xBm,xm")
2633 (parallel [(const_int 0)]))
2634 (vec_select:SF (match_dup 2) (parallel [(const_int 1)])))
2636 (vec_select:SF (match_dup 2) (parallel [(const_int 2)]))
2637 (vec_select:SF (match_dup 2) (parallel [(const_int 3)]))))))]
2640 h<plusminus_mnemonic>ps\t{%2, %0|%0, %2}
2641 vh<plusminus_mnemonic>ps\t{%2, %1, %0|%0, %1, %2}"
2642 [(set_attr "isa" "noavx,avx")
2643 (set_attr "type" "sseadd")
2644 (set_attr "atom_unit" "complex")
2645 (set_attr "prefix" "orig,vex")
2646 (set_attr "prefix_rep" "1,*")
2647 (set_attr "mode" "V4SF")])
2649 (define_mode_iterator REDUC_SSE_PLUS_MODE
2650 [(V2DF "TARGET_SSE") (V4SF "TARGET_SSE")])
2652 (define_expand "reduc_plus_scal_<mode>"
2653 [(plus:REDUC_SSE_PLUS_MODE
2654 (match_operand:<ssescalarmode> 0 "register_operand")
2655 (match_operand:REDUC_SSE_PLUS_MODE 1 "register_operand"))]
2658 rtx tmp = gen_reg_rtx (<MODE>mode);
2659 ix86_expand_reduc (gen_add<mode>3, tmp, operands[1]);
2660 emit_insn (gen_vec_extract<mode><ssescalarmodelower> (operands[0], tmp,
2665 (define_expand "reduc_plus_scal_v16qi"
2667 (match_operand:QI 0 "register_operand")
2668 (match_operand:V16QI 1 "register_operand"))]
2671 rtx tmp = gen_reg_rtx (V1TImode);
2672 emit_insn (gen_sse2_lshrv1ti3 (tmp, gen_lowpart (V1TImode, operands[1]),
2674 rtx tmp2 = gen_reg_rtx (V16QImode);
2675 emit_insn (gen_addv16qi3 (tmp2, operands[1], gen_lowpart (V16QImode, tmp)));
2676 rtx tmp3 = gen_reg_rtx (V16QImode);
2677 emit_move_insn (tmp3, CONST0_RTX (V16QImode));
2678 rtx tmp4 = gen_reg_rtx (V2DImode);
2679 emit_insn (gen_sse2_psadbw (tmp4, tmp2, tmp3));
2680 tmp4 = gen_lowpart (V16QImode, tmp4);
2681 emit_insn (gen_vec_extractv16qiqi (operands[0], tmp4, const0_rtx));
2685 (define_mode_iterator REDUC_PLUS_MODE
2686 [(V4DF "TARGET_AVX") (V8SF "TARGET_AVX")
2687 (V8DF "TARGET_AVX512F") (V16SF "TARGET_AVX512F")
2688 (V32QI "TARGET_AVX") (V64QI "TARGET_AVX512F")])
2690 (define_expand "reduc_plus_scal_<mode>"
2691 [(plus:REDUC_PLUS_MODE
2692 (match_operand:<ssescalarmode> 0 "register_operand")
2693 (match_operand:REDUC_PLUS_MODE 1 "register_operand"))]
2696 rtx tmp = gen_reg_rtx (<ssehalfvecmode>mode);
2697 emit_insn (gen_vec_extract_hi_<mode> (tmp, operands[1]));
2698 rtx tmp2 = gen_reg_rtx (<ssehalfvecmode>mode);
2699 rtx tmp3 = gen_lowpart (<ssehalfvecmode>mode, operands[1]);
2700 emit_insn (gen_add<ssehalfvecmodelower>3 (tmp2, tmp, tmp3));
2701 emit_insn (gen_reduc_plus_scal_<ssehalfvecmodelower> (operands[0], tmp2));
2705 ;; Modes handled by reduc_sm{in,ax}* patterns.
2706 (define_mode_iterator REDUC_SSE_SMINMAX_MODE
2707 [(V4SF "TARGET_SSE") (V2DF "TARGET_SSE")
2708 (V4SI "TARGET_SSE2") (V8HI "TARGET_SSE2") (V16QI "TARGET_SSE2")
2709 (V2DI "TARGET_SSE4_2")])
2711 (define_expand "reduc_<code>_scal_<mode>"
2712 [(smaxmin:REDUC_SSE_SMINMAX_MODE
2713 (match_operand:<ssescalarmode> 0 "register_operand")
2714 (match_operand:REDUC_SSE_SMINMAX_MODE 1 "register_operand"))]
2717 rtx tmp = gen_reg_rtx (<MODE>mode);
2718 ix86_expand_reduc (gen_<code><mode>3, tmp, operands[1]);
2719 emit_insn (gen_vec_extract<mode><ssescalarmodelower> (operands[0], tmp,
2724 (define_mode_iterator REDUC_SMINMAX_MODE
2725 [(V32QI "TARGET_AVX2") (V16HI "TARGET_AVX2")
2726 (V8SI "TARGET_AVX2") (V4DI "TARGET_AVX2")
2727 (V8SF "TARGET_AVX") (V4DF "TARGET_AVX")
2728 (V64QI "TARGET_AVX512BW")
2729 (V32HI "TARGET_AVX512BW") (V16SI "TARGET_AVX512F")
2730 (V8DI "TARGET_AVX512F") (V16SF "TARGET_AVX512F")
2731 (V8DF "TARGET_AVX512F")])
2733 (define_expand "reduc_<code>_scal_<mode>"
2734 [(smaxmin:REDUC_SMINMAX_MODE
2735 (match_operand:<ssescalarmode> 0 "register_operand")
2736 (match_operand:REDUC_SMINMAX_MODE 1 "register_operand"))]
2739 rtx tmp = gen_reg_rtx (<ssehalfvecmode>mode);
2740 emit_insn (gen_vec_extract_hi_<mode> (tmp, operands[1]));
2741 rtx tmp2 = gen_reg_rtx (<ssehalfvecmode>mode);
2742 emit_insn (gen_<code><ssehalfvecmodelower>3
2743 (tmp2, tmp, gen_lowpart (<ssehalfvecmode>mode, operands[1])));
2744 emit_insn (gen_reduc_<code>_scal_<ssehalfvecmodelower> (operands[0], tmp2));
2748 (define_expand "reduc_<code>_scal_<mode>"
2749 [(umaxmin:VI_AVX512BW
2750 (match_operand:<ssescalarmode> 0 "register_operand")
2751 (match_operand:VI_AVX512BW 1 "register_operand"))]
2754 rtx tmp = gen_reg_rtx (<ssehalfvecmode>mode);
2755 emit_insn (gen_vec_extract_hi_<mode> (tmp, operands[1]));
2756 rtx tmp2 = gen_reg_rtx (<ssehalfvecmode>mode);
2757 emit_insn (gen_<code><ssehalfvecmodelower>3
2758 (tmp2, tmp, gen_lowpart (<ssehalfvecmode>mode, operands[1])));
2759 emit_insn (gen_reduc_<code>_scal_<ssehalfvecmodelower> (operands[0], tmp2));
2763 (define_expand "reduc_<code>_scal_<mode>"
2765 (match_operand:<ssescalarmode> 0 "register_operand")
2766 (match_operand:VI_256 1 "register_operand"))]
2769 rtx tmp = gen_reg_rtx (<ssehalfvecmode>mode);
2770 emit_insn (gen_vec_extract_hi_<mode> (tmp, operands[1]));
2771 rtx tmp2 = gen_reg_rtx (<ssehalfvecmode>mode);
2772 emit_insn (gen_<code><ssehalfvecmodelower>3
2773 (tmp2, tmp, gen_lowpart (<ssehalfvecmode>mode, operands[1])));
2774 rtx tmp3 = gen_reg_rtx (<ssehalfvecmode>mode);
2775 ix86_expand_reduc (gen_<code><ssehalfvecmodelower>3, tmp3, tmp2);
2776 emit_insn (gen_vec_extract<ssehalfvecmodelower><ssescalarmodelower>
2777 (operands[0], tmp3, const0_rtx));
2781 (define_expand "reduc_umin_scal_v8hi"
2783 (match_operand:HI 0 "register_operand")
2784 (match_operand:V8HI 1 "register_operand"))]
2787 rtx tmp = gen_reg_rtx (V8HImode);
2788 ix86_expand_reduc (gen_uminv8hi3, tmp, operands[1]);
2789 emit_insn (gen_vec_extractv8hihi (operands[0], tmp, const0_rtx));
2793 (define_insn "<mask_codefor>reducep<mode><mask_name>"
2794 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
2796 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "vm")
2797 (match_operand:SI 2 "const_0_to_255_operand")]
2800 "vreduce<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
2801 [(set_attr "type" "sse")
2802 (set_attr "prefix" "evex")
2803 (set_attr "mode" "<MODE>")])
2805 (define_insn "reduces<mode><mask_scalar_name>"
2806 [(set (match_operand:VF_128 0 "register_operand" "=v")
2809 [(match_operand:VF_128 1 "register_operand" "v")
2810 (match_operand:VF_128 2 "nonimmediate_operand" "vm")
2811 (match_operand:SI 3 "const_0_to_255_operand")]
2816 "vreduce<ssescalarmodesuffix>\t{%3, %2, %1, %0<mask_scalar_operand4>|%0<mask_scalar_operand4>, %1, %<iptr>2, %3}"
2817 [(set_attr "type" "sse")
2818 (set_attr "prefix" "evex")
2819 (set_attr "mode" "<MODE>")])
2821 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2823 ;; Parallel floating point comparisons
2825 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2827 (define_insn "avx_cmp<mode>3"
2828 [(set (match_operand:VF_128_256 0 "register_operand" "=x")
2830 [(match_operand:VF_128_256 1 "register_operand" "x")
2831 (match_operand:VF_128_256 2 "nonimmediate_operand" "xm")
2832 (match_operand:SI 3 "const_0_to_31_operand" "n")]
2835 "vcmp<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
2836 [(set_attr "type" "ssecmp")
2837 (set_attr "length_immediate" "1")
2838 (set_attr "prefix" "vex")
2839 (set_attr "mode" "<MODE>")])
2841 (define_insn "avx_vmcmp<mode>3"
2842 [(set (match_operand:VF_128 0 "register_operand" "=x")
2845 [(match_operand:VF_128 1 "register_operand" "x")
2846 (match_operand:VF_128 2 "nonimmediate_operand" "xm")
2847 (match_operand:SI 3 "const_0_to_31_operand" "n")]
2852 "vcmp<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %3}"
2853 [(set_attr "type" "ssecmp")
2854 (set_attr "length_immediate" "1")
2855 (set_attr "prefix" "vex")
2856 (set_attr "mode" "<ssescalarmode>")])
2858 (define_insn "*<sse>_maskcmp<mode>3_comm"
2859 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x")
2860 (match_operator:VF_128_256 3 "sse_comparison_operator"
2861 [(match_operand:VF_128_256 1 "register_operand" "%0,x")
2862 (match_operand:VF_128_256 2 "vector_operand" "xBm,xm")]))]
2864 && GET_RTX_CLASS (GET_CODE (operands[3])) == RTX_COMM_COMPARE"
2866 cmp%D3<ssemodesuffix>\t{%2, %0|%0, %2}
2867 vcmp%D3<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
2868 [(set_attr "isa" "noavx,avx")
2869 (set_attr "type" "ssecmp")
2870 (set_attr "length_immediate" "1")
2871 (set_attr "prefix" "orig,vex")
2872 (set_attr "mode" "<MODE>")])
2874 (define_insn "<sse>_maskcmp<mode>3"
2875 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x")
2876 (match_operator:VF_128_256 3 "sse_comparison_operator"
2877 [(match_operand:VF_128_256 1 "register_operand" "0,x")
2878 (match_operand:VF_128_256 2 "vector_operand" "xBm,xm")]))]
2881 cmp%D3<ssemodesuffix>\t{%2, %0|%0, %2}
2882 vcmp%D3<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
2883 [(set_attr "isa" "noavx,avx")
2884 (set_attr "type" "ssecmp")
2885 (set_attr "length_immediate" "1")
2886 (set_attr "prefix" "orig,vex")
2887 (set_attr "mode" "<MODE>")])
2889 (define_insn "<sse>_vmmaskcmp<mode>3"
2890 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
2892 (match_operator:VF_128 3 "sse_comparison_operator"
2893 [(match_operand:VF_128 1 "register_operand" "0,x")
2894 (match_operand:VF_128 2 "nonimmediate_operand" "xm,xm")])
2899 cmp%D3<ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
2900 vcmp%D3<ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %<iptr>2}"
2901 [(set_attr "isa" "noavx,avx")
2902 (set_attr "type" "ssecmp")
2903 (set_attr "length_immediate" "1,*")
2904 (set_attr "prefix" "orig,vex")
2905 (set_attr "mode" "<ssescalarmode>")])
2907 (define_mode_attr cmp_imm_predicate
2908 [(V16SF "const_0_to_31_operand") (V8DF "const_0_to_31_operand")
2909 (V16SI "const_0_to_7_operand") (V8DI "const_0_to_7_operand")
2910 (V8SF "const_0_to_31_operand") (V4DF "const_0_to_31_operand")
2911 (V8SI "const_0_to_7_operand") (V4DI "const_0_to_7_operand")
2912 (V4SF "const_0_to_31_operand") (V2DF "const_0_to_31_operand")
2913 (V4SI "const_0_to_7_operand") (V2DI "const_0_to_7_operand")
2914 (V32HI "const_0_to_7_operand") (V64QI "const_0_to_7_operand")
2915 (V16HI "const_0_to_7_operand") (V32QI "const_0_to_7_operand")
2916 (V8HI "const_0_to_7_operand") (V16QI "const_0_to_7_operand")])
2918 (define_insn "<avx512>_cmp<mode>3<mask_scalar_merge_name><round_saeonly_name>"
2919 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=k")
2920 (unspec:<avx512fmaskmode>
2921 [(match_operand:V48_AVX512VL 1 "register_operand" "v")
2922 (match_operand:V48_AVX512VL 2 "nonimmediate_operand" "<round_saeonly_constraint>")
2923 (match_operand:SI 3 "<cmp_imm_predicate>" "n")]
2925 "TARGET_AVX512F && <round_saeonly_mode512bit_condition>"
2926 "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}"
2927 [(set_attr "type" "ssecmp")
2928 (set_attr "length_immediate" "1")
2929 (set_attr "prefix" "evex")
2930 (set_attr "mode" "<sseinsnmode>")])
2932 (define_insn "*<avx512>_cmp<mode>3<mask_scalar_merge_name><round_saeonly_name>"
2933 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=k")
2934 (match_operator:<avx512fmaskmode> 3 "ix86_comparison_int_operator"
2935 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
2936 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "<round_saeonly_constraint>")]))]
2937 "TARGET_AVX512F && <round_saeonly_mode512bit_condition>"
2938 "vpcmp<ssemodesuffix>\t{%I3, <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>, %I3}"
2939 [(set_attr "type" "ssecmp")
2940 (set_attr "length_immediate" "1")
2941 (set_attr "prefix" "evex")
2942 (set_attr "mode" "<sseinsnmode>")])
2944 (define_insn "<avx512>_cmp<mode>3<mask_scalar_merge_name>"
2945 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=k")
2946 (unspec:<avx512fmaskmode>
2947 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
2948 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")
2949 (match_operand:SI 3 "<cmp_imm_predicate>" "n")]
2952 "vpcmp<ssemodesuffix>\t{%3, %2, %1, %0<mask_scalar_merge_operand4>|%0<mask_scalar_merge_operand4>, %1, %2, %3}"
2953 [(set_attr "type" "ssecmp")
2954 (set_attr "length_immediate" "1")
2955 (set_attr "prefix" "evex")
2956 (set_attr "mode" "<sseinsnmode>")])
2958 (define_insn "*<avx512>_cmp<mode>3<mask_scalar_merge_name>"
2959 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=k")
2960 (match_operator:<avx512fmaskmode> 3 "ix86_comparison_int_operator"
2961 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
2962 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")]))]
2964 "vpcmp<ssemodesuffix>\t{%I3, %2, %1, %0<mask_scalar_merge_operand4>|%0<mask_scalar_merge_operand4>, %1, %2, %I3}"
2965 [(set_attr "type" "ssecmp")
2966 (set_attr "length_immediate" "1")
2967 (set_attr "prefix" "evex")
2968 (set_attr "mode" "<sseinsnmode>")])
2970 (define_insn "<avx512>_ucmp<mode>3<mask_scalar_merge_name>"
2971 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=k")
2972 (unspec:<avx512fmaskmode>
2973 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
2974 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")
2975 (match_operand:SI 3 "const_0_to_7_operand" "n")]
2976 UNSPEC_UNSIGNED_PCMP))]
2978 "vpcmpu<ssemodesuffix>\t{%3, %2, %1, %0<mask_scalar_merge_operand4>|%0<mask_scalar_merge_operand4>, %1, %2, %3}"
2979 [(set_attr "type" "ssecmp")
2980 (set_attr "length_immediate" "1")
2981 (set_attr "prefix" "evex")
2982 (set_attr "mode" "<sseinsnmode>")])
2984 (define_insn "*<avx512>_ucmp<mode>3<mask_scalar_merge_name>"
2985 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=k")
2986 (match_operator:<avx512fmaskmode> 3 "ix86_comparison_uns_operator"
2987 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
2988 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")]))]
2990 "vpcmpu<ssemodesuffix>\t{%I3, %2, %1, %0<mask_scalar_merge_operand4>|%0<mask_scalar_merge_operand4>, %1, %2, %I3}"
2991 [(set_attr "type" "ssecmp")
2992 (set_attr "length_immediate" "1")
2993 (set_attr "prefix" "evex")
2994 (set_attr "mode" "<sseinsnmode>")])
2996 (define_insn "<avx512>_ucmp<mode>3<mask_scalar_merge_name>"
2997 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=k")
2998 (unspec:<avx512fmaskmode>
2999 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
3000 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")
3001 (match_operand:SI 3 "const_0_to_7_operand" "n")]
3002 UNSPEC_UNSIGNED_PCMP))]
3004 "vpcmpu<ssemodesuffix>\t{%3, %2, %1, %0<mask_scalar_merge_operand4>|%0<mask_scalar_merge_operand4>, %1, %2, %3}"
3005 [(set_attr "type" "ssecmp")
3006 (set_attr "length_immediate" "1")
3007 (set_attr "prefix" "evex")
3008 (set_attr "mode" "<sseinsnmode>")])
3010 (define_insn "*<avx512>_ucmp<mode>3<mask_scalar_merge_name>"
3011 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=k")
3012 (match_operator:<avx512fmaskmode> 3 "ix86_comparison_uns_operator"
3013 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
3014 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")]))]
3016 "vpcmpu<ssemodesuffix>\t{%I3, %2, %1, %0<mask_scalar_merge_operand4>|%0<mask_scalar_merge_operand4>, %1, %2, %I3}"
3017 [(set_attr "type" "ssecmp")
3018 (set_attr "length_immediate" "1")
3019 (set_attr "prefix" "evex")
3020 (set_attr "mode" "<sseinsnmode>")])
3022 (define_insn "avx512f_vmcmp<mode>3<round_saeonly_name>"
3023 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=k")
3024 (and:<avx512fmaskmode>
3025 (unspec:<avx512fmaskmode>
3026 [(match_operand:VF_128 1 "register_operand" "v")
3027 (match_operand:VF_128 2 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
3028 (match_operand:SI 3 "const_0_to_31_operand" "n")]
3032 "vcmp<ssescalarmodesuffix>\t{%3, <round_saeonly_op4>%2, %1, %0|%0, %1, %<iptr>2<round_saeonly_op4>, %3}"
3033 [(set_attr "type" "ssecmp")
3034 (set_attr "length_immediate" "1")
3035 (set_attr "prefix" "evex")
3036 (set_attr "mode" "<ssescalarmode>")])
3038 (define_insn "avx512f_vmcmp<mode>3_mask<round_saeonly_name>"
3039 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=k")
3040 (and:<avx512fmaskmode>
3041 (unspec:<avx512fmaskmode>
3042 [(match_operand:VF_128 1 "register_operand" "v")
3043 (match_operand:VF_128 2 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
3044 (match_operand:SI 3 "const_0_to_31_operand" "n")]
3046 (and:<avx512fmaskmode>
3047 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")
3050 "vcmp<ssescalarmodesuffix>\t{%3, <round_saeonly_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %<iptr>2<round_saeonly_op5>, %3}"
3051 [(set_attr "type" "ssecmp")
3052 (set_attr "length_immediate" "1")
3053 (set_attr "prefix" "evex")
3054 (set_attr "mode" "<ssescalarmode>")])
3056 (define_insn "avx512f_maskcmp<mode>3"
3057 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=k")
3058 (match_operator:<avx512fmaskmode> 3 "sse_comparison_operator"
3059 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
3060 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "vm")]))]
3062 "vcmp%D3<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
3063 [(set_attr "type" "ssecmp")
3064 (set_attr "length_immediate" "1")
3065 (set_attr "prefix" "evex")
3066 (set_attr "mode" "<sseinsnmode>")])
3068 (define_insn "<sse>_<unord>comi<round_saeonly_name>"
3069 [(set (reg:CCFP FLAGS_REG)
3072 (match_operand:<ssevecmode> 0 "register_operand" "v")
3073 (parallel [(const_int 0)]))
3075 (match_operand:<ssevecmode> 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
3076 (parallel [(const_int 0)]))))]
3077 "SSE_FLOAT_MODE_P (<MODE>mode)"
3078 "%v<unord>comi<ssemodesuffix>\t{<round_saeonly_op2>%1, %0|%0, %<iptr>1<round_saeonly_op2>}"
3079 [(set_attr "type" "ssecomi")
3080 (set_attr "prefix" "maybe_vex")
3081 (set_attr "prefix_rep" "0")
3082 (set (attr "prefix_data16")
3083 (if_then_else (eq_attr "mode" "DF")
3085 (const_string "0")))
3086 (set_attr "mode" "<MODE>")])
3088 (define_expand "vec_cmp<mode><avx512fmaskmodelower>"
3089 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
3090 (match_operator:<avx512fmaskmode> 1 ""
3091 [(match_operand:V48_AVX512VL 2 "register_operand")
3092 (match_operand:V48_AVX512VL 3 "nonimmediate_operand")]))]
3095 bool ok = ix86_expand_mask_vec_cmp (operands);
3100 (define_expand "vec_cmp<mode><avx512fmaskmodelower>"
3101 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
3102 (match_operator:<avx512fmaskmode> 1 ""
3103 [(match_operand:VI12_AVX512VL 2 "register_operand")
3104 (match_operand:VI12_AVX512VL 3 "nonimmediate_operand")]))]
3107 bool ok = ix86_expand_mask_vec_cmp (operands);
3112 (define_expand "vec_cmp<mode><sseintvecmodelower>"
3113 [(set (match_operand:<sseintvecmode> 0 "register_operand")
3114 (match_operator:<sseintvecmode> 1 ""
3115 [(match_operand:VI_256 2 "register_operand")
3116 (match_operand:VI_256 3 "nonimmediate_operand")]))]
3119 bool ok = ix86_expand_int_vec_cmp (operands);
3124 (define_expand "vec_cmp<mode><sseintvecmodelower>"
3125 [(set (match_operand:<sseintvecmode> 0 "register_operand")
3126 (match_operator:<sseintvecmode> 1 ""
3127 [(match_operand:VI124_128 2 "register_operand")
3128 (match_operand:VI124_128 3 "vector_operand")]))]
3131 bool ok = ix86_expand_int_vec_cmp (operands);
3136 (define_expand "vec_cmpv2div2di"
3137 [(set (match_operand:V2DI 0 "register_operand")
3138 (match_operator:V2DI 1 ""
3139 [(match_operand:V2DI 2 "register_operand")
3140 (match_operand:V2DI 3 "vector_operand")]))]
3143 bool ok = ix86_expand_int_vec_cmp (operands);
3148 (define_expand "vec_cmp<mode><sseintvecmodelower>"
3149 [(set (match_operand:<sseintvecmode> 0 "register_operand")
3150 (match_operator:<sseintvecmode> 1 ""
3151 [(match_operand:VF_256 2 "register_operand")
3152 (match_operand:VF_256 3 "nonimmediate_operand")]))]
3155 bool ok = ix86_expand_fp_vec_cmp (operands);
3160 (define_expand "vec_cmp<mode><sseintvecmodelower>"
3161 [(set (match_operand:<sseintvecmode> 0 "register_operand")
3162 (match_operator:<sseintvecmode> 1 ""
3163 [(match_operand:VF_128 2 "register_operand")
3164 (match_operand:VF_128 3 "vector_operand")]))]
3167 bool ok = ix86_expand_fp_vec_cmp (operands);
3172 (define_expand "vec_cmpu<mode><avx512fmaskmodelower>"
3173 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
3174 (match_operator:<avx512fmaskmode> 1 ""
3175 [(match_operand:VI48_AVX512VL 2 "register_operand")
3176 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand")]))]
3179 bool ok = ix86_expand_mask_vec_cmp (operands);
3184 (define_expand "vec_cmpu<mode><avx512fmaskmodelower>"
3185 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
3186 (match_operator:<avx512fmaskmode> 1 ""
3187 [(match_operand:VI12_AVX512VL 2 "register_operand")
3188 (match_operand:VI12_AVX512VL 3 "nonimmediate_operand")]))]
3191 bool ok = ix86_expand_mask_vec_cmp (operands);
3196 (define_expand "vec_cmpu<mode><sseintvecmodelower>"
3197 [(set (match_operand:<sseintvecmode> 0 "register_operand")
3198 (match_operator:<sseintvecmode> 1 ""
3199 [(match_operand:VI_256 2 "register_operand")
3200 (match_operand:VI_256 3 "nonimmediate_operand")]))]
3203 bool ok = ix86_expand_int_vec_cmp (operands);
3208 (define_expand "vec_cmpu<mode><sseintvecmodelower>"
3209 [(set (match_operand:<sseintvecmode> 0 "register_operand")
3210 (match_operator:<sseintvecmode> 1 ""
3211 [(match_operand:VI124_128 2 "register_operand")
3212 (match_operand:VI124_128 3 "vector_operand")]))]
3215 bool ok = ix86_expand_int_vec_cmp (operands);
3220 (define_expand "vec_cmpuv2div2di"
3221 [(set (match_operand:V2DI 0 "register_operand")
3222 (match_operator:V2DI 1 ""
3223 [(match_operand:V2DI 2 "register_operand")
3224 (match_operand:V2DI 3 "vector_operand")]))]
3227 bool ok = ix86_expand_int_vec_cmp (operands);
3232 (define_expand "vec_cmpeqv2div2di"
3233 [(set (match_operand:V2DI 0 "register_operand")
3234 (match_operator:V2DI 1 ""
3235 [(match_operand:V2DI 2 "register_operand")
3236 (match_operand:V2DI 3 "vector_operand")]))]
3239 bool ok = ix86_expand_int_vec_cmp (operands);
3244 (define_expand "vcond<V_512:mode><VF_512:mode>"
3245 [(set (match_operand:V_512 0 "register_operand")
3247 (match_operator 3 ""
3248 [(match_operand:VF_512 4 "nonimmediate_operand")
3249 (match_operand:VF_512 5 "nonimmediate_operand")])
3250 (match_operand:V_512 1 "general_operand")
3251 (match_operand:V_512 2 "general_operand")))]
3253 && (GET_MODE_NUNITS (<V_512:MODE>mode)
3254 == GET_MODE_NUNITS (<VF_512:MODE>mode))"
3256 bool ok = ix86_expand_fp_vcond (operands);
3261 (define_expand "vcond<V_256:mode><VF_256:mode>"
3262 [(set (match_operand:V_256 0 "register_operand")
3264 (match_operator 3 ""
3265 [(match_operand:VF_256 4 "nonimmediate_operand")
3266 (match_operand:VF_256 5 "nonimmediate_operand")])
3267 (match_operand:V_256 1 "general_operand")
3268 (match_operand:V_256 2 "general_operand")))]
3270 && (GET_MODE_NUNITS (<V_256:MODE>mode)
3271 == GET_MODE_NUNITS (<VF_256:MODE>mode))"
3273 bool ok = ix86_expand_fp_vcond (operands);
3278 (define_expand "vcond<V_128:mode><VF_128:mode>"
3279 [(set (match_operand:V_128 0 "register_operand")
3281 (match_operator 3 ""
3282 [(match_operand:VF_128 4 "vector_operand")
3283 (match_operand:VF_128 5 "vector_operand")])
3284 (match_operand:V_128 1 "general_operand")
3285 (match_operand:V_128 2 "general_operand")))]
3287 && (GET_MODE_NUNITS (<V_128:MODE>mode)
3288 == GET_MODE_NUNITS (<VF_128:MODE>mode))"
3290 bool ok = ix86_expand_fp_vcond (operands);
3295 (define_expand "vcond_mask_<mode><avx512fmaskmodelower>"
3296 [(set (match_operand:V48_AVX512VL 0 "register_operand")
3297 (vec_merge:V48_AVX512VL
3298 (match_operand:V48_AVX512VL 1 "nonimmediate_operand")
3299 (match_operand:V48_AVX512VL 2 "nonimm_or_0_operand")
3300 (match_operand:<avx512fmaskmode> 3 "register_operand")))]
3303 (define_expand "vcond_mask_<mode><avx512fmaskmodelower>"
3304 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
3305 (vec_merge:VI12_AVX512VL
3306 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand")
3307 (match_operand:VI12_AVX512VL 2 "nonimm_or_0_operand")
3308 (match_operand:<avx512fmaskmode> 3 "register_operand")))]
3311 ;; As vcondv4div4df and vcondv8siv8sf are enabled already with TARGET_AVX,
3312 ;; and their condition can be folded late into a constant, we need to
3313 ;; support vcond_mask_v4div4di and vcond_mask_v8siv8si for TARGET_AVX.
3314 (define_mode_iterator VI_256_AVX2 [(V32QI "TARGET_AVX2") (V16HI "TARGET_AVX2")
3317 (define_expand "vcond_mask_<mode><sseintvecmodelower>"
3318 [(set (match_operand:VI_256_AVX2 0 "register_operand")
3319 (vec_merge:VI_256_AVX2
3320 (match_operand:VI_256_AVX2 1 "nonimmediate_operand")
3321 (match_operand:VI_256_AVX2 2 "nonimm_or_0_operand")
3322 (match_operand:<sseintvecmode> 3 "register_operand")))]
3325 ix86_expand_sse_movcc (operands[0], operands[3],
3326 operands[1], operands[2]);
3330 (define_expand "vcond_mask_<mode><sseintvecmodelower>"
3331 [(set (match_operand:VI124_128 0 "register_operand")
3332 (vec_merge:VI124_128
3333 (match_operand:VI124_128 1 "vector_operand")
3334 (match_operand:VI124_128 2 "nonimm_or_0_operand")
3335 (match_operand:<sseintvecmode> 3 "register_operand")))]
3338 ix86_expand_sse_movcc (operands[0], operands[3],
3339 operands[1], operands[2]);
3343 (define_expand "vcond_mask_v2div2di"
3344 [(set (match_operand:V2DI 0 "register_operand")
3346 (match_operand:V2DI 1 "vector_operand")
3347 (match_operand:V2DI 2 "nonimm_or_0_operand")
3348 (match_operand:V2DI 3 "register_operand")))]
3351 ix86_expand_sse_movcc (operands[0], operands[3],
3352 operands[1], operands[2]);
3356 (define_expand "vcond_mask_<mode><sseintvecmodelower>"
3357 [(set (match_operand:VF_256 0 "register_operand")
3359 (match_operand:VF_256 1 "nonimmediate_operand")
3360 (match_operand:VF_256 2 "nonimm_or_0_operand")
3361 (match_operand:<sseintvecmode> 3 "register_operand")))]
3364 ix86_expand_sse_movcc (operands[0], operands[3],
3365 operands[1], operands[2]);
3369 (define_expand "vcond_mask_<mode><sseintvecmodelower>"
3370 [(set (match_operand:VF_128 0 "register_operand")
3372 (match_operand:VF_128 1 "vector_operand")
3373 (match_operand:VF_128 2 "nonimm_or_0_operand")
3374 (match_operand:<sseintvecmode> 3 "register_operand")))]
3377 ix86_expand_sse_movcc (operands[0], operands[3],
3378 operands[1], operands[2]);
3382 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3384 ;; Parallel floating point logical operations
3386 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3388 (define_insn "<sse>_andnot<mode>3<mask_name>"
3389 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x,v,v")
3392 (match_operand:VF_128_256 1 "register_operand" "0,x,v,v"))
3393 (match_operand:VF_128_256 2 "vector_operand" "xBm,xm,vm,vm")))]
3394 "TARGET_SSE && <mask_avx512vl_condition>"
3400 switch (which_alternative)
3403 ops = "andn%s\t{%%2, %%0|%%0, %%2}";
3408 ops = "vandn%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
3414 switch (get_attr_mode (insn))
3422 /* There is no vandnp[sd] in avx512f. Use vpandn[qd]. */
3423 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
3424 ops = "vpandn%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
3427 suffix = "<ssemodesuffix>";
3430 snprintf (buf, sizeof (buf), ops, suffix);
3431 output_asm_insn (buf, operands);
3434 [(set_attr "isa" "noavx,avx,avx512dq,avx512f")
3435 (set_attr "type" "sselog")
3436 (set_attr "prefix" "orig,maybe_vex,evex,evex")
3438 (cond [(and (match_test "<mask_applied>")
3439 (and (eq_attr "alternative" "1")
3440 (match_test "!TARGET_AVX512DQ")))
3441 (const_string "<sseintvecmode2>")
3442 (eq_attr "alternative" "3")
3443 (const_string "<sseintvecmode2>")
3444 (match_test "TARGET_AVX")
3445 (const_string "<MODE>")
3446 (match_test "optimize_function_for_size_p (cfun)")
3447 (const_string "V4SF")
3448 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
3449 (const_string "V4SF")
3451 (const_string "<MODE>")))])
3453 (define_insn "<sse>_andnot<mode>3<mask_name>"
3454 [(set (match_operand:VF_512 0 "register_operand" "=v")
3457 (match_operand:VF_512 1 "register_operand" "v"))
3458 (match_operand:VF_512 2 "nonimmediate_operand" "vm")))]
3465 suffix = "<ssemodesuffix>";
3468 /* There is no vandnp[sd] in avx512f. Use vpandn[qd]. */
3469 if (!TARGET_AVX512DQ)
3471 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
3475 snprintf (buf, sizeof (buf),
3476 "v%sandn%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}",
3478 output_asm_insn (buf, operands);
3481 [(set_attr "type" "sselog")
3482 (set_attr "prefix" "evex")
3484 (if_then_else (match_test "TARGET_AVX512DQ")
3485 (const_string "<sseinsnmode>")
3486 (const_string "XI")))])
3488 (define_expand "<code><mode>3<mask_name>"
3489 [(set (match_operand:VF_128_256 0 "register_operand")
3490 (any_logic:VF_128_256
3491 (match_operand:VF_128_256 1 "vector_operand")
3492 (match_operand:VF_128_256 2 "vector_operand")))]
3493 "TARGET_SSE && <mask_avx512vl_condition>"
3494 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
3496 (define_expand "<code><mode>3<mask_name>"
3497 [(set (match_operand:VF_512 0 "register_operand")
3499 (match_operand:VF_512 1 "nonimmediate_operand")
3500 (match_operand:VF_512 2 "nonimmediate_operand")))]
3502 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
3504 (define_insn "*<code><mode>3<mask_name>"
3505 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x,v,v")
3506 (any_logic:VF_128_256
3507 (match_operand:VF_128_256 1 "vector_operand" "%0,x,v,v")
3508 (match_operand:VF_128_256 2 "vector_operand" "xBm,xm,vm,vm")))]
3509 "TARGET_SSE && <mask_avx512vl_condition>
3510 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
3516 switch (which_alternative)
3519 ops = "<logic>%s\t{%%2, %%0|%%0, %%2}";
3524 ops = "v<logic>%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
3530 switch (get_attr_mode (insn))
3538 /* There is no v<logic>p[sd] in avx512f. Use vp<logic>[qd]. */
3539 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
3540 ops = "vp<logic>%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
3543 suffix = "<ssemodesuffix>";
3546 snprintf (buf, sizeof (buf), ops, suffix);
3547 output_asm_insn (buf, operands);
3550 [(set_attr "isa" "noavx,avx,avx512dq,avx512f")
3551 (set_attr "type" "sselog")
3552 (set_attr "prefix" "orig,maybe_evex,evex,evex")
3554 (cond [(and (match_test "<mask_applied>")
3555 (and (eq_attr "alternative" "1")
3556 (match_test "!TARGET_AVX512DQ")))
3557 (const_string "<sseintvecmode2>")
3558 (eq_attr "alternative" "3")
3559 (const_string "<sseintvecmode2>")
3560 (match_test "TARGET_AVX")
3561 (const_string "<MODE>")
3562 (match_test "optimize_function_for_size_p (cfun)")
3563 (const_string "V4SF")
3564 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
3565 (const_string "V4SF")
3567 (const_string "<MODE>")))])
3569 (define_insn "*<code><mode>3<mask_name>"
3570 [(set (match_operand:VF_512 0 "register_operand" "=v")
3572 (match_operand:VF_512 1 "nonimmediate_operand" "%v")
3573 (match_operand:VF_512 2 "nonimmediate_operand" "vm")))]
3574 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
3580 suffix = "<ssemodesuffix>";
3583 /* There is no v<logic>p[sd] in avx512f. Use vp<logic>[dq]. */
3584 if (!TARGET_AVX512DQ)
3586 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
3590 snprintf (buf, sizeof (buf),
3591 "v%s<logic>%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}",
3593 output_asm_insn (buf, operands);
3596 [(set_attr "type" "sselog")
3597 (set_attr "prefix" "evex")
3599 (if_then_else (match_test "TARGET_AVX512DQ")
3600 (const_string "<sseinsnmode>")
3601 (const_string "XI")))])
3603 (define_expand "copysign<mode>3"
3606 (not:VF (match_dup 3))
3607 (match_operand:VF 1 "vector_operand")))
3609 (and:VF (match_dup 3)
3610 (match_operand:VF 2 "vector_operand")))
3611 (set (match_operand:VF 0 "register_operand")
3612 (ior:VF (match_dup 4) (match_dup 5)))]
3615 operands[3] = ix86_build_signbit_mask (<MODE>mode, 1, 0);
3617 operands[4] = gen_reg_rtx (<MODE>mode);
3618 operands[5] = gen_reg_rtx (<MODE>mode);
3621 (define_expand "xorsign<mode>3"
3623 (and:VF (match_dup 3)
3624 (match_operand:VF 2 "vector_operand")))
3625 (set (match_operand:VF 0 "register_operand")
3626 (xor:VF (match_dup 4)
3627 (match_operand:VF 1 "vector_operand")))]
3630 operands[3] = ix86_build_signbit_mask (<MODE>mode, 1, 0);
3632 operands[4] = gen_reg_rtx (<MODE>mode);
3635 (define_expand "signbit<mode>2"
3636 [(set (match_operand:<sseintvecmode> 0 "register_operand")
3637 (lshiftrt:<sseintvecmode>
3638 (subreg:<sseintvecmode>
3639 (match_operand:VF1_AVX2 1 "register_operand") 0)
3642 "operands[2] = GEN_INT (GET_MODE_UNIT_BITSIZE (<MODE>mode)-1);")
3644 ;; Also define scalar versions. These are used for abs, neg, and
3645 ;; conditional move. Using subregs into vector modes causes register
3646 ;; allocation lossage. These patterns do not allow memory operands
3647 ;; because the native instructions read the full 128-bits.
3649 (define_insn "*andnot<mode>3"
3650 [(set (match_operand:MODEF 0 "register_operand" "=x,x,v,v")
3653 (match_operand:MODEF 1 "register_operand" "0,x,v,v"))
3654 (match_operand:MODEF 2 "register_operand" "x,x,v,v")))]
3655 "SSE_FLOAT_MODE_P (<MODE>mode)"
3660 = (get_attr_mode (insn) == MODE_V4SF) ? "ps" : "<ssevecmodesuffix>";
3662 switch (which_alternative)
3665 ops = "andn%s\t{%%2, %%0|%%0, %%2}";
3668 ops = "vandn%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3671 if (TARGET_AVX512DQ)
3672 ops = "vandn%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3675 suffix = <MODE>mode == DFmode ? "q" : "d";
3676 ops = "vpandn%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3680 if (TARGET_AVX512DQ)
3681 ops = "vandn%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3684 suffix = <MODE>mode == DFmode ? "q" : "d";
3685 ops = "vpandn%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3692 snprintf (buf, sizeof (buf), ops, suffix);
3693 output_asm_insn (buf, operands);
3696 [(set_attr "isa" "noavx,avx,avx512vl,avx512f")
3697 (set_attr "type" "sselog")
3698 (set_attr "prefix" "orig,vex,evex,evex")
3700 (cond [(eq_attr "alternative" "2")
3701 (if_then_else (match_test "TARGET_AVX512DQ")
3702 (const_string "<ssevecmode>")
3703 (const_string "TI"))
3704 (eq_attr "alternative" "3")
3705 (if_then_else (match_test "TARGET_AVX512DQ")
3706 (const_string "<avx512fvecmode>")
3707 (const_string "XI"))
3708 (match_test "TARGET_AVX")
3709 (const_string "<ssevecmode>")
3710 (match_test "optimize_function_for_size_p (cfun)")
3711 (const_string "V4SF")
3712 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
3713 (const_string "V4SF")
3715 (const_string "<ssevecmode>")))])
3717 (define_insn "*andnottf3"
3718 [(set (match_operand:TF 0 "register_operand" "=x,x,v,v")
3720 (not:TF (match_operand:TF 1 "register_operand" "0,x,v,v"))
3721 (match_operand:TF 2 "vector_operand" "xBm,xm,vm,v")))]
3727 = (which_alternative >= 2 ? "pandnq"
3728 : get_attr_mode (insn) == MODE_V4SF ? "andnps" : "pandn");
3730 switch (which_alternative)
3733 ops = "%s\t{%%2, %%0|%%0, %%2}";
3737 ops = "v%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3740 ops = "v%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3746 snprintf (buf, sizeof (buf), ops, tmp);
3747 output_asm_insn (buf, operands);
3750 [(set_attr "isa" "noavx,avx,avx512vl,avx512f")
3751 (set_attr "type" "sselog")
3752 (set (attr "prefix_data16")
3754 (and (eq_attr "alternative" "0")
3755 (eq_attr "mode" "TI"))
3757 (const_string "*")))
3758 (set_attr "prefix" "orig,vex,evex,evex")
3760 (cond [(eq_attr "alternative" "2")
3762 (eq_attr "alternative" "3")
3764 (match_test "TARGET_AVX")
3766 (ior (not (match_test "TARGET_SSE2"))
3767 (match_test "optimize_function_for_size_p (cfun)"))
3768 (const_string "V4SF")
3769 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
3770 (const_string "V4SF")
3772 (const_string "TI")))])
3774 (define_insn "*<code><mode>3"
3775 [(set (match_operand:MODEF 0 "register_operand" "=x,x,v,v")
3777 (match_operand:MODEF 1 "register_operand" "%0,x,v,v")
3778 (match_operand:MODEF 2 "register_operand" "x,x,v,v")))]
3779 "SSE_FLOAT_MODE_P (<MODE>mode)"
3784 = (get_attr_mode (insn) == MODE_V4SF) ? "ps" : "<ssevecmodesuffix>";
3786 switch (which_alternative)
3789 ops = "<logic>%s\t{%%2, %%0|%%0, %%2}";
3792 if (!TARGET_AVX512DQ)
3794 suffix = <MODE>mode == DFmode ? "q" : "d";
3795 ops = "vp<logic>%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3800 ops = "v<logic>%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3803 if (TARGET_AVX512DQ)
3804 ops = "v<logic>%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3807 suffix = <MODE>mode == DFmode ? "q" : "d";
3808 ops = "vp<logic>%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3815 snprintf (buf, sizeof (buf), ops, suffix);
3816 output_asm_insn (buf, operands);
3819 [(set_attr "isa" "noavx,avx,avx512vl,avx512f")
3820 (set_attr "type" "sselog")
3821 (set_attr "prefix" "orig,vex,evex,evex")
3823 (cond [(eq_attr "alternative" "2")
3824 (if_then_else (match_test "TARGET_AVX512DQ")
3825 (const_string "<ssevecmode>")
3826 (const_string "TI"))
3827 (eq_attr "alternative" "3")
3828 (if_then_else (match_test "TARGET_AVX512DQ")
3829 (const_string "<avx512fvecmode>")
3830 (const_string "XI"))
3831 (match_test "TARGET_AVX")
3832 (const_string "<ssevecmode>")
3833 (match_test "optimize_function_for_size_p (cfun)")
3834 (const_string "V4SF")
3835 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
3836 (const_string "V4SF")
3838 (const_string "<ssevecmode>")))])
3840 (define_expand "<code>tf3"
3841 [(set (match_operand:TF 0 "register_operand")
3843 (match_operand:TF 1 "vector_operand")
3844 (match_operand:TF 2 "vector_operand")))]
3846 "ix86_fixup_binary_operands_no_copy (<CODE>, TFmode, operands);")
3848 (define_insn "*<code>tf3"
3849 [(set (match_operand:TF 0 "register_operand" "=x,x,v,v")
3851 (match_operand:TF 1 "vector_operand" "%0,x,v,v")
3852 (match_operand:TF 2 "vector_operand" "xBm,xm,vm,v")))]
3853 "TARGET_SSE && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
3858 = (which_alternative >= 2 ? "p<logic>q"
3859 : get_attr_mode (insn) == MODE_V4SF ? "<logic>ps" : "p<logic>");
3861 switch (which_alternative)
3864 ops = "%s\t{%%2, %%0|%%0, %%2}";
3868 ops = "v%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3871 ops = "v%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3877 snprintf (buf, sizeof (buf), ops, tmp);
3878 output_asm_insn (buf, operands);
3881 [(set_attr "isa" "noavx,avx,avx512vl,avx512f")
3882 (set_attr "type" "sselog")
3883 (set (attr "prefix_data16")
3885 (and (eq_attr "alternative" "0")
3886 (eq_attr "mode" "TI"))
3888 (const_string "*")))
3889 (set_attr "prefix" "orig,vex,evex,evex")
3891 (cond [(eq_attr "alternative" "2")
3893 (eq_attr "alternative" "3")
3895 (match_test "TARGET_AVX")
3897 (ior (not (match_test "TARGET_SSE2"))
3898 (match_test "optimize_function_for_size_p (cfun)"))
3899 (const_string "V4SF")
3900 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
3901 (const_string "V4SF")
3903 (const_string "TI")))])
3905 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3907 ;; FMA floating point multiply/accumulate instructions. These include
3908 ;; scalar versions of the instructions as well as vector versions.
3910 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3912 ;; The standard names for scalar FMA are only available with SSE math enabled.
3913 ;; CPUID bit AVX512F enables evex encoded scalar and 512-bit fma. It doesn't
3914 ;; care about FMA bit, so we enable fma for TARGET_AVX512F even when TARGET_FMA
3915 ;; and TARGET_FMA4 are both false.
3916 ;; TODO: In theory AVX512F does not automatically imply FMA, and without FMA
3917 ;; one must force the EVEX encoding of the fma insns. Ideally we'd improve
3918 ;; GAS to allow proper prefix selection. However, for the moment all hardware
3919 ;; that supports AVX512F also supports FMA so we can ignore this for now.
3920 (define_mode_iterator FMAMODEM
3921 [(SF "TARGET_SSE_MATH && (TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F)")
3922 (DF "TARGET_SSE_MATH && (TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F)")
3923 (V4SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3924 (V2DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3925 (V8SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3926 (V4DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3927 (V16SF "TARGET_AVX512F")
3928 (V8DF "TARGET_AVX512F")])
3930 (define_expand "fma<mode>4"
3931 [(set (match_operand:FMAMODEM 0 "register_operand")
3933 (match_operand:FMAMODEM 1 "nonimmediate_operand")
3934 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3935 (match_operand:FMAMODEM 3 "nonimmediate_operand")))])
3937 (define_expand "fms<mode>4"
3938 [(set (match_operand:FMAMODEM 0 "register_operand")
3940 (match_operand:FMAMODEM 1 "nonimmediate_operand")
3941 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3942 (neg:FMAMODEM (match_operand:FMAMODEM 3 "nonimmediate_operand"))))])
3944 (define_expand "fnma<mode>4"
3945 [(set (match_operand:FMAMODEM 0 "register_operand")
3947 (neg:FMAMODEM (match_operand:FMAMODEM 1 "nonimmediate_operand"))
3948 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3949 (match_operand:FMAMODEM 3 "nonimmediate_operand")))])
3951 (define_expand "fnms<mode>4"
3952 [(set (match_operand:FMAMODEM 0 "register_operand")
3954 (neg:FMAMODEM (match_operand:FMAMODEM 1 "nonimmediate_operand"))
3955 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3956 (neg:FMAMODEM (match_operand:FMAMODEM 3 "nonimmediate_operand"))))])
3958 ;; The builtins for intrinsics are not constrained by SSE math enabled.
3959 (define_mode_iterator FMAMODE_AVX512
3960 [(SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F")
3961 (DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F")
3962 (V4SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3963 (V2DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3964 (V8SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3965 (V4DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3966 (V16SF "TARGET_AVX512F")
3967 (V8DF "TARGET_AVX512F")])
3969 (define_mode_iterator FMAMODE
3970 [SF DF V4SF V2DF V8SF V4DF])
3972 (define_expand "fma4i_fmadd_<mode>"
3973 [(set (match_operand:FMAMODE_AVX512 0 "register_operand")
3975 (match_operand:FMAMODE_AVX512 1 "nonimmediate_operand")
3976 (match_operand:FMAMODE_AVX512 2 "nonimmediate_operand")
3977 (match_operand:FMAMODE_AVX512 3 "nonimmediate_operand")))])
3979 (define_expand "fma4i_fmsub_<mode>"
3980 [(set (match_operand:FMAMODE_AVX512 0 "register_operand")
3982 (match_operand:FMAMODE_AVX512 1 "nonimmediate_operand")
3983 (match_operand:FMAMODE_AVX512 2 "nonimmediate_operand")
3985 (match_operand:FMAMODE_AVX512 3 "nonimmediate_operand"))))])
3987 (define_expand "fma4i_fnmadd_<mode>"
3988 [(set (match_operand:FMAMODE_AVX512 0 "register_operand")
3991 (match_operand:FMAMODE_AVX512 1 "nonimmediate_operand"))
3992 (match_operand:FMAMODE_AVX512 2 "nonimmediate_operand")
3993 (match_operand:FMAMODE_AVX512 3 "nonimmediate_operand")))])
3995 (define_expand "fma4i_fnmsub_<mode>"
3996 [(set (match_operand:FMAMODE_AVX512 0 "register_operand")
3999 (match_operand:FMAMODE_AVX512 1 "nonimmediate_operand"))
4000 (match_operand:FMAMODE_AVX512 2 "nonimmediate_operand")
4002 (match_operand:FMAMODE_AVX512 3 "nonimmediate_operand"))))])
4004 (define_expand "<avx512>_fmadd_<mode>_maskz<round_expand_name>"
4005 [(match_operand:VF_AVX512VL 0 "register_operand")
4006 (match_operand:VF_AVX512VL 1 "<round_expand_nimm_predicate>")
4007 (match_operand:VF_AVX512VL 2 "<round_expand_nimm_predicate>")
4008 (match_operand:VF_AVX512VL 3 "<round_expand_nimm_predicate>")
4009 (match_operand:<avx512fmaskmode> 4 "register_operand")]
4010 "TARGET_AVX512F && <round_mode512bit_condition>"
4012 emit_insn (gen_fma_fmadd_<mode>_maskz_1<round_expand_name> (
4013 operands[0], operands[1], operands[2], operands[3],
4014 CONST0_RTX (<MODE>mode), operands[4]<round_expand_operand>));
4018 (define_insn "*fma_fmadd_<mode>"
4019 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
4021 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x")
4022 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
4023 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x")))]
4024 "TARGET_FMA || TARGET_FMA4"
4026 vfmadd132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
4027 vfmadd213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
4028 vfmadd231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
4029 vfmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
4030 vfmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
4031 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
4032 (set_attr "type" "ssemuladd")
4033 (set_attr "mode" "<MODE>")])
4035 ;; Suppose AVX-512F as baseline
4036 (define_mode_iterator VF_SF_AVX512VL
4037 [SF V16SF (V8SF "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
4038 DF V8DF (V4DF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
4040 (define_insn "<sd_mask_codefor>fma_fmadd_<mode><sd_maskz_name><round_name>"
4041 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
4043 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
4044 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
4045 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0")))]
4046 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
4048 vfmadd132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
4049 vfmadd213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
4050 vfmadd231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
4051 [(set_attr "type" "ssemuladd")
4052 (set_attr "mode" "<MODE>")])
4054 (define_insn "*<sd_mask_codefor>fma_fmadd_<mode><sd_maskz_name>_bcst_1"
4055 [(set (match_operand:VF_AVX512 0 "register_operand" "=v")
4057 (match_operand:VF_AVX512 1 "register_operand" "%0")
4058 (match_operand:VF_AVX512 2 "register_operand" "v")
4059 (vec_duplicate:VF_AVX512
4060 (match_operand:<ssescalarmode> 3 "memory_operand" "m"))))]
4061 "TARGET_AVX512F && <sd_mask_mode512bit_condition>"
4062 "vfmadd213<ssemodesuffix>\t{%3<avx512bcst>, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<avx512bcst>}"
4063 [(set_attr "type" "ssemuladd")
4064 (set_attr "mode" "<MODE>")])
4066 (define_insn "*<sd_mask_codefor>fma_fmadd_<mode><sd_maskz_name>_bcst_2"
4067 [(set (match_operand:VF_AVX512 0 "register_operand" "=v,v")
4069 (vec_duplicate:VF_AVX512
4070 (match_operand:<ssescalarmode> 1 "memory_operand" "m,m"))
4071 (match_operand:VF_AVX512 2 "register_operand" "0,v")
4072 (match_operand:VF_AVX512 3 "register_operand" "v,0")))]
4073 "TARGET_AVX512F && <sd_mask_mode512bit_condition>"
4075 vfmadd132<ssemodesuffix>\t{%1<avx512bcst>, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %1<avx512bcst>}
4076 vfmadd231<ssemodesuffix>\t{%1<avx512bcst>, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %1<avx512bcst>}"
4077 [(set_attr "type" "ssemuladd")
4078 (set_attr "mode" "<MODE>")])
4080 (define_insn "*<sd_mask_codefor>fma_fmadd_<mode><sd_maskz_name>_bcst_3"
4081 [(set (match_operand:VF_AVX512 0 "register_operand" "=v,v")
4083 (match_operand:VF_AVX512 1 "register_operand" "0,v")
4084 (vec_duplicate:VF_AVX512
4085 (match_operand:<ssescalarmode> 2 "memory_operand" "m,m"))
4086 (match_operand:VF_AVX512 3 "register_operand" "v,0")))]
4087 "TARGET_AVX512F && <sd_mask_mode512bit_condition>"
4089 vfmadd132<ssemodesuffix>\t{%2<avx512bcst>, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<avx512bcst>}
4090 vfmadd231<ssemodesuffix>\t{%2<avx512bcst>, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<avx512bcst>}"
4091 [(set_attr "type" "ssemuladd")
4092 (set_attr "mode" "<MODE>")])
4094 (define_insn "<avx512>_fmadd_<mode>_mask<round_name>"
4095 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
4096 (vec_merge:VF_AVX512VL
4098 (match_operand:VF_AVX512VL 1 "register_operand" "0,0")
4099 (match_operand:VF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v")
4100 (match_operand:VF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>"))
4102 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
4103 "TARGET_AVX512F && <round_mode512bit_condition>"
4105 vfmadd132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
4106 vfmadd213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
4107 [(set_attr "type" "ssemuladd")
4108 (set_attr "mode" "<MODE>")])
4110 (define_insn "<avx512>_fmadd_<mode>_mask3<round_name>"
4111 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
4112 (vec_merge:VF_AVX512VL
4114 (match_operand:VF_AVX512VL 1 "<round_nimm_predicate>" "%v")
4115 (match_operand:VF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>")
4116 (match_operand:VF_AVX512VL 3 "register_operand" "0"))
4118 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
4120 "vfmadd231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
4121 [(set_attr "type" "ssemuladd")
4122 (set_attr "mode" "<MODE>")])
4124 (define_insn "*fma_fmsub_<mode>"
4125 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
4127 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x")
4128 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
4130 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x"))))]
4131 "TARGET_FMA || TARGET_FMA4"
4133 vfmsub132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
4134 vfmsub213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
4135 vfmsub231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
4136 vfmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
4137 vfmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
4138 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
4139 (set_attr "type" "ssemuladd")
4140 (set_attr "mode" "<MODE>")])
4142 (define_expand "<avx512>_fmsub_<mode>_maskz<round_expand_name>"
4143 [(match_operand:VF_AVX512VL 0 "register_operand")
4144 (match_operand:VF_AVX512VL 1 "<round_expand_nimm_predicate>")
4145 (match_operand:VF_AVX512VL 2 "<round_expand_nimm_predicate>")
4146 (match_operand:VF_AVX512VL 3 "<round_expand_nimm_predicate>")
4147 (match_operand:<avx512fmaskmode> 4 "register_operand")]
4148 "TARGET_AVX512F && <round_mode512bit_condition>"
4150 emit_insn (gen_fma_fmsub_<mode>_maskz_1<round_expand_name> (
4151 operands[0], operands[1], operands[2], operands[3],
4152 CONST0_RTX (<MODE>mode), operands[4]<round_expand_operand>));
4156 (define_insn "<sd_mask_codefor>fma_fmsub_<mode><sd_maskz_name><round_name>"
4157 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
4159 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
4160 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
4162 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0"))))]
4163 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
4165 vfmsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
4166 vfmsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
4167 vfmsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
4168 [(set_attr "type" "ssemuladd")
4169 (set_attr "mode" "<MODE>")])
4171 (define_insn "*<sd_mask_codefor>fma_fmsub_<mode><sd_maskz_name>_bcst_1"
4172 [(set (match_operand:VF_AVX512 0 "register_operand" "=v")
4174 (match_operand:VF_AVX512 1 "register_operand" "%0")
4175 (match_operand:VF_AVX512 2 "register_operand" "v")
4177 (vec_duplicate:VF_AVX512
4178 (match_operand:<ssescalarmode> 3 "memory_operand" "m")))))]
4179 "TARGET_AVX512F && <sd_mask_mode512bit_condition>"
4180 "vfmsub213<ssemodesuffix>\t{%3<avx512bcst>, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<avx512bcst>}"
4181 [(set_attr "type" "ssemuladd")
4182 (set_attr "mode" "<MODE>")])
4184 (define_insn "*<sd_mask_codefor>fma_fmsub_<mode><sd_maskz_name>_bcst_2"
4185 [(set (match_operand:VF_AVX512 0 "register_operand" "=v,v")
4187 (vec_duplicate:VF_AVX512
4188 (match_operand:<ssescalarmode> 1 "memory_operand" "m,m"))
4189 (match_operand:VF_AVX512 2 "register_operand" "0,v")
4191 (match_operand:VF_AVX512 3 "register_operand" "v,0"))))]
4192 "TARGET_AVX512F && <sd_mask_mode512bit_condition>"
4194 vfmsub132<ssemodesuffix>\t{%1<avx512bcst>, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %1<avx512bcst>}
4195 vfmsub231<ssemodesuffix>\t{%1<avx512bcst>, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %1<avx512bcst>}"
4196 [(set_attr "type" "ssemuladd")
4197 (set_attr "mode" "<MODE>")])
4199 (define_insn "*<sd_mask_codefor>fma_fmsub_<mode><sd_maskz_name>_bcst_3"
4200 [(set (match_operand:VF_AVX512 0 "register_operand" "=v,v")
4202 (match_operand:VF_AVX512 1 "register_operand" "0,v")
4203 (vec_duplicate:VF_AVX512
4204 (match_operand:<ssescalarmode> 2 "memory_operand" "m,m"))
4206 (match_operand:VF_AVX512 3 "nonimmediate_operand" "v,0"))))]
4207 "TARGET_AVX512F && <sd_mask_mode512bit_condition>"
4209 vfmsub132<ssemodesuffix>\t{%2<avx512bcst>, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<avx512bcst>}
4210 vfmsub231<ssemodesuffix>\t{%2<avx512bcst>, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<avx512bcst>}"
4211 [(set_attr "type" "ssemuladd")
4212 (set_attr "mode" "<MODE>")])
4214 (define_insn "<avx512>_fmsub_<mode>_mask<round_name>"
4215 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
4216 (vec_merge:VF_AVX512VL
4218 (match_operand:VF_AVX512VL 1 "register_operand" "0,0")
4219 (match_operand:VF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v")
4221 (match_operand:VF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>")))
4223 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
4226 vfmsub132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
4227 vfmsub213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
4228 [(set_attr "type" "ssemuladd")
4229 (set_attr "mode" "<MODE>")])
4231 (define_insn "<avx512>_fmsub_<mode>_mask3<round_name>"
4232 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
4233 (vec_merge:VF_AVX512VL
4235 (match_operand:VF_AVX512VL 1 "<round_nimm_predicate>" "%v")
4236 (match_operand:VF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>")
4238 (match_operand:VF_AVX512VL 3 "register_operand" "0")))
4240 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
4241 "TARGET_AVX512F && <round_mode512bit_condition>"
4242 "vfmsub231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
4243 [(set_attr "type" "ssemuladd")
4244 (set_attr "mode" "<MODE>")])
4246 (define_insn "*fma_fnmadd_<mode>"
4247 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
4250 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x"))
4251 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
4252 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x")))]
4253 "TARGET_FMA || TARGET_FMA4"
4255 vfnmadd132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
4256 vfnmadd213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
4257 vfnmadd231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
4258 vfnmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
4259 vfnmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
4260 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
4261 (set_attr "type" "ssemuladd")
4262 (set_attr "mode" "<MODE>")])
4264 (define_expand "<avx512>_fnmadd_<mode>_maskz<round_expand_name>"
4265 [(match_operand:VF_AVX512VL 0 "register_operand")
4266 (match_operand:VF_AVX512VL 1 "<round_expand_nimm_predicate>")
4267 (match_operand:VF_AVX512VL 2 "<round_expand_nimm_predicate>")
4268 (match_operand:VF_AVX512VL 3 "<round_expand_nimm_predicate>")
4269 (match_operand:<avx512fmaskmode> 4 "register_operand")]
4270 "TARGET_AVX512F && <round_mode512bit_condition>"
4272 emit_insn (gen_fma_fnmadd_<mode>_maskz_1<round_expand_name> (
4273 operands[0], operands[1], operands[2], operands[3],
4274 CONST0_RTX (<MODE>mode), operands[4]<round_expand_operand>));
4278 (define_insn "<sd_mask_codefor>fma_fnmadd_<mode><sd_maskz_name><round_name>"
4279 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
4282 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v"))
4283 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
4284 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0")))]
4285 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
4287 vfnmadd132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
4288 vfnmadd213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
4289 vfnmadd231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
4290 [(set_attr "type" "ssemuladd")
4291 (set_attr "mode" "<MODE>")])
4293 (define_insn "*<sd_mask_codefor>fma_fnmadd_<mode><sd_maskz_name>_bcst_1"
4294 [(set (match_operand:VF_AVX512 0 "register_operand" "=v")
4297 (match_operand:VF_AVX512 1 "register_operand" "%0"))
4298 (match_operand:VF_AVX512 2 "register_operand" "v")
4299 (vec_duplicate:VF_AVX512
4300 (match_operand:<ssescalarmode> 3 "memory_operand" "m"))))]
4301 "TARGET_AVX512F && <sd_mask_mode512bit_condition>"
4302 "vfnmadd213<ssemodesuffix>\t{%3<avx512bcst>, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<avx512bcst>}"
4303 [(set_attr "type" "ssemuladd")
4304 (set_attr "mode" "<MODE>")])
4306 (define_insn "*<sd_mask_codefor>fma_fnmadd_<mode><sd_maskz_name>_bcst_2"
4307 [(set (match_operand:VF_AVX512 0 "register_operand" "=v,v")
4310 (vec_duplicate:VF_AVX512
4311 (match_operand:<ssescalarmode> 1 "memory_operand" "m,m")))
4312 (match_operand:VF_AVX512 2 "register_operand" "0,v")
4313 (match_operand:VF_AVX512 3 "register_operand" "v,0")))]
4314 "TARGET_AVX512F && <sd_mask_mode512bit_condition>"
4316 vfnmadd132<ssemodesuffix>\t{%1<avx512bcst>, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %1<avx512bcst>}
4317 vfnmadd231<ssemodesuffix>\t{%1<avx512bcst>, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %1<avx512bcst>}"
4318 [(set_attr "type" "ssemuladd")
4319 (set_attr "mode" "<MODE>")])
4321 (define_insn "*<sd_mask_codefor>fma_fnmadd_<mode><sd_maskz_name>_bcst_3"
4322 [(set (match_operand:VF_AVX512 0 "register_operand" "=v,v")
4325 (match_operand:VF_AVX512 1 "register_operand" "0,v"))
4326 (vec_duplicate:VF_AVX512
4327 (match_operand:<ssescalarmode> 2 "memory_operand" "m,m"))
4328 (match_operand:VF_AVX512 3 "register_operand" "v,0")))]
4329 "TARGET_AVX512F && <sd_mask_mode512bit_condition>"
4331 vfnmadd132<ssemodesuffix>\t{%2<avx512bcst>, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<avx512bcst>}
4332 vfnmadd231<ssemodesuffix>\t{%2<avx512bcst>, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<avx512bcst>}"
4333 [(set_attr "type" "ssemuladd")
4334 (set_attr "mode" "<MODE>")])
4336 (define_insn "<avx512>_fnmadd_<mode>_mask<round_name>"
4337 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
4338 (vec_merge:VF_AVX512VL
4341 (match_operand:VF_AVX512VL 1 "register_operand" "0,0"))
4342 (match_operand:VF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v")
4343 (match_operand:VF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>"))
4345 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
4346 "TARGET_AVX512F && <round_mode512bit_condition>"
4348 vfnmadd132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
4349 vfnmadd213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
4350 [(set_attr "type" "ssemuladd")
4351 (set_attr "mode" "<MODE>")])
4353 (define_insn "<avx512>_fnmadd_<mode>_mask3<round_name>"
4354 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
4355 (vec_merge:VF_AVX512VL
4358 (match_operand:VF_AVX512VL 1 "<round_nimm_predicate>" "%v"))
4359 (match_operand:VF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>")
4360 (match_operand:VF_AVX512VL 3 "register_operand" "0"))
4362 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
4363 "TARGET_AVX512F && <round_mode512bit_condition>"
4364 "vfnmadd231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
4365 [(set_attr "type" "ssemuladd")
4366 (set_attr "mode" "<MODE>")])
4368 (define_insn "*fma_fnmsub_<mode>"
4369 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
4372 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x"))
4373 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
4375 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x"))))]
4376 "TARGET_FMA || TARGET_FMA4"
4378 vfnmsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
4379 vfnmsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
4380 vfnmsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}
4381 vfnmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
4382 vfnmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
4383 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
4384 (set_attr "type" "ssemuladd")
4385 (set_attr "mode" "<MODE>")])
4387 (define_expand "<avx512>_fnmsub_<mode>_maskz<round_expand_name>"
4388 [(match_operand:VF_AVX512VL 0 "register_operand")
4389 (match_operand:VF_AVX512VL 1 "<round_expand_nimm_predicate>")
4390 (match_operand:VF_AVX512VL 2 "<round_expand_nimm_predicate>")
4391 (match_operand:VF_AVX512VL 3 "<round_expand_nimm_predicate>")
4392 (match_operand:<avx512fmaskmode> 4 "register_operand")]
4393 "TARGET_AVX512F && <round_mode512bit_condition>"
4395 emit_insn (gen_fma_fnmsub_<mode>_maskz_1<round_expand_name> (
4396 operands[0], operands[1], operands[2], operands[3],
4397 CONST0_RTX (<MODE>mode), operands[4]<round_expand_operand>));
4401 (define_insn "<sd_mask_codefor>fma_fnmsub_<mode><sd_maskz_name><round_name>"
4402 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
4405 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v"))
4406 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
4408 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0"))))]
4409 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
4411 vfnmsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
4412 vfnmsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
4413 vfnmsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
4414 [(set_attr "type" "ssemuladd")
4415 (set_attr "mode" "<MODE>")])
4417 (define_insn "*<sd_mask_codefor>fma_fnmsub_<mode><sd_maskz_name>_bcst_1"
4418 [(set (match_operand:VF_AVX512 0 "register_operand" "=v")
4421 (match_operand:VF_AVX512 1 "register_operand" "%0"))
4422 (match_operand:VF_AVX512 2 "register_operand" "v")
4424 (vec_duplicate:VF_AVX512
4425 (match_operand:<ssescalarmode> 3 "memory_operand" "m")))))]
4426 "TARGET_AVX512F && <sd_mask_mode512bit_condition>"
4427 "vfnmsub213<ssemodesuffix>\t{%3<avx512bcst>, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<avx512bcst>}"
4428 [(set_attr "type" "ssemuladd")
4429 (set_attr "mode" "<MODE>")])
4431 (define_insn "*<sd_mask_codefor>fma_fnmsub_<mode><sd_maskz_name>_bcst_2"
4432 [(set (match_operand:VF_AVX512 0 "register_operand" "=v,v")
4435 (vec_duplicate:VF_AVX512
4436 (match_operand:<ssescalarmode> 1 "memory_operand" "m,m")))
4437 (match_operand:VF_AVX512 2 "register_operand" "0,v")
4439 (match_operand:VF_AVX512 3 "register_operand" "v,0"))))]
4440 "TARGET_AVX512F && <sd_mask_mode512bit_condition>"
4442 vfnmsub132<ssemodesuffix>\t{%1<avx512bcst>, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %1<avx512bcst>}
4443 vfnmsub231<ssemodesuffix>\t{%1<avx512bcst>, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %1<avx512bcst>}"
4444 [(set_attr "type" "ssemuladd")
4445 (set_attr "mode" "<MODE>")])
4447 (define_insn "*<sd_mask_codefor>fma_fnmsub_<mode><sd_maskz_name>_bcst_3"
4448 [(set (match_operand:VF_AVX512 0 "register_operand" "=v,v")
4451 (match_operand:VF_AVX512 1 "register_operand" "0,v"))
4452 (vec_duplicate:VF_AVX512
4453 (match_operand:<ssescalarmode> 2 "memory_operand" "m,m"))
4455 (match_operand:VF_AVX512 3 "register_operand" "v,0"))))]
4456 "TARGET_AVX512F && <sd_mask_mode512bit_condition>"
4458 vfnmsub132<ssemodesuffix>\t{%2<avx512bcst>, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<avx512bcst>}
4459 vfnmsub231<ssemodesuffix>\t{%2<avx512bcst>, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<avx512bcst>}"
4460 [(set_attr "type" "ssemuladd")
4461 (set_attr "mode" "<MODE>")])
4463 (define_insn "<avx512>_fnmsub_<mode>_mask<round_name>"
4464 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
4465 (vec_merge:VF_AVX512VL
4468 (match_operand:VF_AVX512VL 1 "register_operand" "0,0"))
4469 (match_operand:VF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v")
4471 (match_operand:VF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>")))
4473 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
4474 "TARGET_AVX512F && <round_mode512bit_condition>"
4476 vfnmsub132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
4477 vfnmsub213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
4478 [(set_attr "type" "ssemuladd")
4479 (set_attr "mode" "<MODE>")])
4481 (define_insn "<avx512>_fnmsub_<mode>_mask3<round_name>"
4482 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
4483 (vec_merge:VF_AVX512VL
4486 (match_operand:VF_AVX512VL 1 "<round_nimm_predicate>" "%v"))
4487 (match_operand:VF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>")
4489 (match_operand:VF_AVX512VL 3 "register_operand" "0")))
4491 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
4493 "vfnmsub231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
4494 [(set_attr "type" "ssemuladd")
4495 (set_attr "mode" "<MODE>")])
4497 ;; FMA parallel floating point multiply addsub and subadd operations.
4499 ;; It would be possible to represent these without the UNSPEC as
4502 ;; (fma op1 op2 op3)
4503 ;; (fma op1 op2 (neg op3))
4506 ;; But this doesn't seem useful in practice.
4508 (define_expand "fmaddsub_<mode>"
4509 [(set (match_operand:VF 0 "register_operand")
4511 [(match_operand:VF 1 "nonimmediate_operand")
4512 (match_operand:VF 2 "nonimmediate_operand")
4513 (match_operand:VF 3 "nonimmediate_operand")]
4515 "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F")
4517 (define_expand "<avx512>_fmaddsub_<mode>_maskz<round_expand_name>"
4518 [(match_operand:VF_AVX512VL 0 "register_operand")
4519 (match_operand:VF_AVX512VL 1 "<round_expand_nimm_predicate>")
4520 (match_operand:VF_AVX512VL 2 "<round_expand_nimm_predicate>")
4521 (match_operand:VF_AVX512VL 3 "<round_expand_nimm_predicate>")
4522 (match_operand:<avx512fmaskmode> 4 "register_operand")]
4525 emit_insn (gen_fma_fmaddsub_<mode>_maskz_1<round_expand_name> (
4526 operands[0], operands[1], operands[2], operands[3],
4527 CONST0_RTX (<MODE>mode), operands[4]<round_expand_operand>));
4531 (define_insn "*fma_fmaddsub_<mode>"
4532 [(set (match_operand:VF_128_256 0 "register_operand" "=v,v,v,x,x")
4534 [(match_operand:VF_128_256 1 "nonimmediate_operand" "%0,0,v,x,x")
4535 (match_operand:VF_128_256 2 "nonimmediate_operand" "vm,v,vm,x,m")
4536 (match_operand:VF_128_256 3 "nonimmediate_operand" "v,vm,0,xm,x")]
4538 "TARGET_FMA || TARGET_FMA4"
4540 vfmaddsub132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
4541 vfmaddsub213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
4542 vfmaddsub231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
4543 vfmaddsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
4544 vfmaddsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
4545 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
4546 (set_attr "type" "ssemuladd")
4547 (set_attr "mode" "<MODE>")])
4549 (define_insn "<sd_mask_codefor>fma_fmaddsub_<mode><sd_maskz_name><round_name>"
4550 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
4551 (unspec:VF_SF_AVX512VL
4552 [(match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
4553 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
4554 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0")]
4556 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
4558 vfmaddsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
4559 vfmaddsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
4560 vfmaddsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
4561 [(set_attr "type" "ssemuladd")
4562 (set_attr "mode" "<MODE>")])
4564 (define_insn "<avx512>_fmaddsub_<mode>_mask<round_name>"
4565 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
4566 (vec_merge:VF_AVX512VL
4568 [(match_operand:VF_AVX512VL 1 "register_operand" "0,0")
4569 (match_operand:VF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v")
4570 (match_operand:VF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>")]
4573 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
4576 vfmaddsub132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
4577 vfmaddsub213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
4578 [(set_attr "type" "ssemuladd")
4579 (set_attr "mode" "<MODE>")])
4581 (define_insn "<avx512>_fmaddsub_<mode>_mask3<round_name>"
4582 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
4583 (vec_merge:VF_AVX512VL
4585 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
4586 (match_operand:VF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>")
4587 (match_operand:VF_AVX512VL 3 "register_operand" "0")]
4590 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
4592 "vfmaddsub231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
4593 [(set_attr "type" "ssemuladd")
4594 (set_attr "mode" "<MODE>")])
4596 (define_insn "*fma_fmsubadd_<mode>"
4597 [(set (match_operand:VF_128_256 0 "register_operand" "=v,v,v,x,x")
4599 [(match_operand:VF_128_256 1 "nonimmediate_operand" "%0,0,v,x,x")
4600 (match_operand:VF_128_256 2 "nonimmediate_operand" "vm,v,vm,x,m")
4602 (match_operand:VF_128_256 3 "nonimmediate_operand" "v,vm,0,xm,x"))]
4604 "TARGET_FMA || TARGET_FMA4"
4606 vfmsubadd132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
4607 vfmsubadd213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
4608 vfmsubadd231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
4609 vfmsubadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
4610 vfmsubadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
4611 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
4612 (set_attr "type" "ssemuladd")
4613 (set_attr "mode" "<MODE>")])
4615 (define_insn "<sd_mask_codefor>fma_fmsubadd_<mode><sd_maskz_name><round_name>"
4616 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
4617 (unspec:VF_SF_AVX512VL
4618 [(match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
4619 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
4621 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0"))]
4623 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
4625 vfmsubadd132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
4626 vfmsubadd213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
4627 vfmsubadd231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
4628 [(set_attr "type" "ssemuladd")
4629 (set_attr "mode" "<MODE>")])
4631 (define_insn "<avx512>_fmsubadd_<mode>_mask<round_name>"
4632 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
4633 (vec_merge:VF_AVX512VL
4635 [(match_operand:VF_AVX512VL 1 "register_operand" "0,0")
4636 (match_operand:VF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v")
4638 (match_operand:VF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>"))]
4641 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
4644 vfmsubadd132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
4645 vfmsubadd213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
4646 [(set_attr "type" "ssemuladd")
4647 (set_attr "mode" "<MODE>")])
4649 (define_insn "<avx512>_fmsubadd_<mode>_mask3<round_name>"
4650 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
4651 (vec_merge:VF_AVX512VL
4653 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
4654 (match_operand:VF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>")
4656 (match_operand:VF_AVX512VL 3 "register_operand" "0"))]
4659 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
4661 "vfmsubadd231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
4662 [(set_attr "type" "ssemuladd")
4663 (set_attr "mode" "<MODE>")])
4665 ;; FMA3 floating point scalar intrinsics. These merge result with
4666 ;; high-order elements from the destination register.
4668 (define_expand "fmai_vmfmadd_<mode><round_name>"
4669 [(set (match_operand:VF_128 0 "register_operand")
4672 (match_operand:VF_128 1 "register_operand")
4673 (match_operand:VF_128 2 "<round_nimm_scalar_predicate>")
4674 (match_operand:VF_128 3 "<round_nimm_scalar_predicate>"))
4679 (define_expand "fmai_vmfmsub_<mode><round_name>"
4680 [(set (match_operand:VF_128 0 "register_operand")
4683 (match_operand:VF_128 1 "register_operand")
4684 (match_operand:VF_128 2 "<round_nimm_scalar_predicate>")
4686 (match_operand:VF_128 3 "<round_nimm_scalar_predicate>")))
4691 (define_expand "fmai_vmfnmadd_<mode><round_name>"
4692 [(set (match_operand:VF_128 0 "register_operand")
4696 (match_operand:VF_128 2 "<round_nimm_scalar_predicate>"))
4697 (match_operand:VF_128 1 "register_operand")
4698 (match_operand:VF_128 3 "<round_nimm_scalar_predicate>"))
4703 (define_expand "fmai_vmfnmsub_<mode><round_name>"
4704 [(set (match_operand:VF_128 0 "register_operand")
4708 (match_operand:VF_128 2 "<round_nimm_scalar_predicate>"))
4709 (match_operand:VF_128 1 "register_operand")
4711 (match_operand:VF_128 3 "<round_nimm_scalar_predicate>")))
4716 (define_insn "*fmai_fmadd_<mode>"
4717 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4720 (match_operand:VF_128 1 "register_operand" "0,0")
4721 (match_operand:VF_128 2 "<round_nimm_scalar_predicate>" "<round_constraint>, v")
4722 (match_operand:VF_128 3 "<round_nimm_scalar_predicate>" "v,<round_constraint>"))
4725 "TARGET_FMA || TARGET_AVX512F"
4727 vfmadd132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
4728 vfmadd213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
4729 [(set_attr "type" "ssemuladd")
4730 (set_attr "mode" "<MODE>")])
4732 (define_insn "*fmai_fmsub_<mode>"
4733 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4736 (match_operand:VF_128 1 "register_operand" "0,0")
4737 (match_operand:VF_128 2 "<round_nimm_scalar_predicate>" "<round_constraint>,v")
4739 (match_operand:VF_128 3 "<round_nimm_scalar_predicate>" "v,<round_constraint>")))
4742 "TARGET_FMA || TARGET_AVX512F"
4744 vfmsub132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
4745 vfmsub213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
4746 [(set_attr "type" "ssemuladd")
4747 (set_attr "mode" "<MODE>")])
4749 (define_insn "*fmai_fnmadd_<mode><round_name>"
4750 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4754 (match_operand:VF_128 2 "<round_nimm_scalar_predicate>" "<round_constraint>,v"))
4755 (match_operand:VF_128 1 "register_operand" "0,0")
4756 (match_operand:VF_128 3 "<round_nimm_scalar_predicate>" "v,<round_constraint>"))
4759 "TARGET_FMA || TARGET_AVX512F"
4761 vfnmadd132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
4762 vfnmadd213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
4763 [(set_attr "type" "ssemuladd")
4764 (set_attr "mode" "<MODE>")])
4766 (define_insn "*fmai_fnmsub_<mode><round_name>"
4767 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4771 (match_operand:VF_128 2 "<round_nimm_scalar_predicate>" "<round_constraint>,v"))
4772 (match_operand:VF_128 1 "register_operand" "0,0")
4774 (match_operand:VF_128 3 "<round_nimm_scalar_predicate>" "v,<round_constraint>")))
4777 "TARGET_FMA || TARGET_AVX512F"
4779 vfnmsub132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
4780 vfnmsub213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
4781 [(set_attr "type" "ssemuladd")
4782 (set_attr "mode" "<MODE>")])
4784 (define_insn "avx512f_vmfmadd_<mode>_mask<round_name>"
4785 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4789 (match_operand:VF_128 1 "register_operand" "0,0")
4790 (match_operand:VF_128 2 "<round_nimm_scalar_predicate>" "<round_constraint>,v")
4791 (match_operand:VF_128 3 "<round_nimm_scalar_predicate>" "v,<round_constraint>"))
4793 (match_operand:QI 4 "register_operand" "Yk,Yk"))
4798 vfmadd132<ssescalarmodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %<iptr>3, %<iptr>2<round_op5>}
4799 vfmadd213<ssescalarmodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %<iptr>2, %<iptr>3<round_op5>}"
4800 [(set_attr "type" "ssemuladd")
4801 (set_attr "mode" "<MODE>")])
4803 (define_insn "avx512f_vmfmadd_<mode>_mask3<round_name>"
4804 [(set (match_operand:VF_128 0 "register_operand" "=v")
4808 (match_operand:VF_128 1 "<round_nimm_scalar_predicate>" "%v")
4809 (match_operand:VF_128 2 "<round_nimm_scalar_predicate>" "<round_constraint>")
4810 (match_operand:VF_128 3 "register_operand" "0"))
4812 (match_operand:QI 4 "register_operand" "Yk"))
4816 "vfmadd231<ssescalarmodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %<iptr>3, %<iptr>2<round_op5>}"
4817 [(set_attr "type" "ssemuladd")
4818 (set_attr "mode" "<MODE>")])
4820 (define_expand "avx512f_vmfmadd_<mode>_maskz<round_expand_name>"
4821 [(match_operand:VF_128 0 "register_operand")
4822 (match_operand:VF_128 1 "<round_expand_nimm_predicate>")
4823 (match_operand:VF_128 2 "<round_expand_nimm_predicate>")
4824 (match_operand:VF_128 3 "<round_expand_nimm_predicate>")
4825 (match_operand:QI 4 "register_operand")]
4828 emit_insn (gen_avx512f_vmfmadd_<mode>_maskz_1<round_expand_name> (
4829 operands[0], operands[1], operands[2], operands[3],
4830 CONST0_RTX (<MODE>mode), operands[4]<round_expand_operand>));
4834 (define_insn "avx512f_vmfmadd_<mode>_maskz_1<round_name>"
4835 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4839 (match_operand:VF_128 1 "register_operand" "0,0")
4840 (match_operand:VF_128 2 "<round_nimm_scalar_predicate>" "<round_constraint>,v")
4841 (match_operand:VF_128 3 "<round_nimm_scalar_predicate>" "v,<round_constraint>"))
4842 (match_operand:VF_128 4 "const0_operand" "C,C")
4843 (match_operand:QI 5 "register_operand" "Yk,Yk"))
4848 vfmadd132<ssescalarmodesuffix>\t{<round_op6>%2, %3, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %<iptr>3, %<iptr>2<round_op6>}
4849 vfmadd213<ssescalarmodesuffix>\t{<round_op6>%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %<iptr>2, %<iptr>3<round_op6>}"
4850 [(set_attr "type" "ssemuladd")
4851 (set_attr "mode" "<MODE>")])
4853 (define_insn "*avx512f_vmfmsub_<mode>_mask<round_name>"
4854 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4858 (match_operand:VF_128 1 "register_operand" "0,0")
4859 (match_operand:VF_128 2 "<round_nimm_scalar_predicate>" "<round_constraint>,v")
4861 (match_operand:VF_128 3 "<round_nimm_scalar_predicate>" "v,<round_constraint>")))
4863 (match_operand:QI 4 "register_operand" "Yk,Yk"))
4868 vfmsub132<ssescalarmodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %<iptr>3, %<iptr>2<round_op5>}
4869 vfmsub213<ssescalarmodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %<iptr>2, %<iptr>3<round_op5>}"
4870 [(set_attr "type" "ssemuladd")
4871 (set_attr "mode" "<MODE>")])
4873 (define_insn "avx512f_vmfmsub_<mode>_mask3<round_name>"
4874 [(set (match_operand:VF_128 0 "register_operand" "=v")
4878 (match_operand:VF_128 1 "<round_nimm_scalar_predicate>" "%v")
4879 (match_operand:VF_128 2 "<round_nimm_scalar_predicate>" "<round_constraint>")
4881 (match_operand:VF_128 3 "register_operand" "0")))
4883 (match_operand:QI 4 "register_operand" "Yk"))
4887 "vfmsub231<ssescalarmodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %<iptr>3, %<iptr>2<round_op5>}"
4888 [(set_attr "type" "ssemuladd")
4889 (set_attr "mode" "<MODE>")])
4891 (define_insn "*avx512f_vmfmsub_<mode>_maskz_1<round_name>"
4892 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4896 (match_operand:VF_128 1 "register_operand" "0,0")
4897 (match_operand:VF_128 2 "<round_nimm_scalar_predicate>" "<round_constraint>,v")
4899 (match_operand:VF_128 3 "<round_nimm_scalar_predicate>" "v,<round_constraint>")))
4900 (match_operand:VF_128 4 "const0_operand" "C,C")
4901 (match_operand:QI 5 "register_operand" "Yk,Yk"))
4906 vfmsub132<ssescalarmodesuffix>\t{<round_op6>%2, %3, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %<iptr>3, %<iptr>2<round_op6>}
4907 vfmsub213<ssescalarmodesuffix>\t{<round_op6>%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %<iptr>2, %<iptr>3<round_op6>}"
4908 [(set_attr "type" "ssemuladd")
4909 (set_attr "mode" "<MODE>")])
4911 (define_insn "*avx512f_vmfnmadd_<mode>_mask<round_name>"
4912 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4917 (match_operand:VF_128 2 "<round_nimm_scalar_predicate>" "<round_constraint>,v"))
4918 (match_operand:VF_128 1 "register_operand" "0,0")
4919 (match_operand:VF_128 3 "<round_nimm_scalar_predicate>" "v,<round_constraint>"))
4921 (match_operand:QI 4 "register_operand" "Yk,Yk"))
4926 vfnmadd132<ssescalarmodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %<iptr>3, %<iptr>2<round_op5>}
4927 vfnmadd213<ssescalarmodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %<iptr>2, %<iptr>3<round_op5>}"
4928 [(set_attr "type" "ssemuladd")
4929 (set_attr "mode" "<MODE>")])
4931 (define_insn "*avx512f_vmfnmadd_<mode>_mask3<round_name>"
4932 [(set (match_operand:VF_128 0 "register_operand" "=v")
4937 (match_operand:VF_128 2 "<round_nimm_scalar_predicate>" "<round_constraint>"))
4938 (match_operand:VF_128 1 "<round_nimm_scalar_predicate>" "%v")
4939 (match_operand:VF_128 3 "register_operand" "0"))
4941 (match_operand:QI 4 "register_operand" "Yk"))
4945 "vfnmadd231<ssescalarmodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %<iptr>3, %<iptr>2<round_op5>}"
4946 [(set_attr "type" "ssemuladd")
4947 (set_attr "mode" "<MODE>")])
4949 (define_insn "*avx512f_vmfnmadd_<mode>_maskz_1<round_name>"
4950 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4955 (match_operand:VF_128 2 "<round_nimm_scalar_predicate>" "<round_constraint>,v"))
4956 (match_operand:VF_128 1 "register_operand" "0,0")
4957 (match_operand:VF_128 3 "<round_nimm_scalar_predicate>" "v,<round_constraint>"))
4958 (match_operand:VF_128 4 "const0_operand" "C,C")
4959 (match_operand:QI 5 "register_operand" "Yk,Yk"))
4964 vfnmadd132<ssescalarmodesuffix>\t{<round_op6>%2, %3, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %<iptr>3, %<iptr>2<round_op6>}
4965 vfnmadd213<ssescalarmodesuffix>\t{<round_op6>%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %<iptr>2, %<iptr>3<round_op6>}"
4966 [(set_attr "type" "ssemuladd")
4967 (set_attr "mode" "<MODE>")])
4969 (define_insn "*avx512f_vmfnmsub_<mode>_mask<round_name>"
4970 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4975 (match_operand:VF_128 2 "<round_nimm_scalar_predicate>" "<round_constraint>,v"))
4976 (match_operand:VF_128 1 "register_operand" "0,0")
4978 (match_operand:VF_128 3 "<round_nimm_scalar_predicate>" "v,<round_constraint>")))
4980 (match_operand:QI 4 "register_operand" "Yk,Yk"))
4985 vfnmsub132<ssescalarmodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %<iptr>3, %<iptr>2<round_op5>}
4986 vfnmsub213<ssescalarmodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %<iptr>2, %<iptr>3<round_op5>}"
4987 [(set_attr "type" "ssemuladd")
4988 (set_attr "mode" "<MODE>")])
4990 (define_insn "*avx512f_vmfnmsub_<mode>_mask3<round_name>"
4991 [(set (match_operand:VF_128 0 "register_operand" "=v")
4996 (match_operand:VF_128 2 "<round_nimm_scalar_predicate>" "<round_constraint>"))
4997 (match_operand:VF_128 1 "<round_nimm_scalar_predicate>" "%v")
4999 (match_operand:VF_128 3 "register_operand" "0")))
5001 (match_operand:QI 4 "register_operand" "Yk"))
5005 "vfnmsub231<ssescalarmodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %<iptr>3, %<iptr>2<round_op5>}"
5006 [(set_attr "type" "ssemuladd")
5007 (set_attr "mode" "<MODE>")])
5009 (define_insn "*avx512f_vmfnmsub_<mode>_maskz_1<round_name>"
5010 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
5015 (match_operand:VF_128 2 "<round_nimm_scalar_predicate>" "<round_constraint>,v"))
5016 (match_operand:VF_128 1 "register_operand" "0,0")
5018 (match_operand:VF_128 3 "<round_nimm_scalar_predicate>" "v,<round_constraint>")))
5019 (match_operand:VF_128 4 "const0_operand" "C,C")
5020 (match_operand:QI 5 "register_operand" "Yk,Yk"))
5025 vfnmsub132<ssescalarmodesuffix>\t{<round_op6>%2, %3, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %<iptr>3, %<iptr>2<round_op6>}
5026 vfnmsub213<ssescalarmodesuffix>\t{<round_op6>%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %<iptr>2, %<iptr>3<round_op6>}"
5027 [(set_attr "type" "ssemuladd")
5028 (set_attr "mode" "<MODE>")])
5030 ;; FMA4 floating point scalar intrinsics. These write the
5031 ;; entire destination register, with the high-order elements zeroed.
5033 (define_expand "fma4i_vmfmadd_<mode>"
5034 [(set (match_operand:VF_128 0 "register_operand")
5037 (match_operand:VF_128 1 "nonimmediate_operand")
5038 (match_operand:VF_128 2 "nonimmediate_operand")
5039 (match_operand:VF_128 3 "nonimmediate_operand"))
5043 "operands[4] = CONST0_RTX (<MODE>mode);")
5045 (define_insn "*fma4i_vmfmadd_<mode>"
5046 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
5049 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x")
5050 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
5051 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x"))
5052 (match_operand:VF_128 4 "const0_operand")
5055 "vfmadd<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
5056 [(set_attr "type" "ssemuladd")
5057 (set_attr "mode" "<MODE>")])
5059 (define_insn "*fma4i_vmfmsub_<mode>"
5060 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
5063 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x")
5064 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
5066 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x")))
5067 (match_operand:VF_128 4 "const0_operand")
5070 "vfmsub<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
5071 [(set_attr "type" "ssemuladd")
5072 (set_attr "mode" "<MODE>")])
5074 (define_insn "*fma4i_vmfnmadd_<mode>"
5075 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
5079 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x"))
5080 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
5081 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x"))
5082 (match_operand:VF_128 4 "const0_operand")
5085 "vfnmadd<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
5086 [(set_attr "type" "ssemuladd")
5087 (set_attr "mode" "<MODE>")])
5089 (define_insn "*fma4i_vmfnmsub_<mode>"
5090 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
5094 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x"))
5095 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
5097 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x")))
5098 (match_operand:VF_128 4 "const0_operand")
5101 "vfnmsub<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
5102 [(set_attr "type" "ssemuladd")
5103 (set_attr "mode" "<MODE>")])
5105 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5107 ;; Parallel single-precision floating point conversion operations
5109 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5111 (define_insn_and_split "sse_cvtpi2ps"
5112 [(set (match_operand:V4SF 0 "register_operand" "=x,x,Yv")
5115 (float:V2SF (match_operand:V2SI 2 "register_mmxmem_operand" "ym,x,Yv")))
5116 (match_operand:V4SF 1 "register_operand" "0,0,Yv")
5118 (clobber (match_scratch:V4SF 3 "=X,x,Yv"))]
5119 "(TARGET_MMX || TARGET_MMX_WITH_SSE) && TARGET_SSE"
5121 cvtpi2ps\t{%2, %0|%0, %2}
5124 "TARGET_SSE2 && reload_completed
5125 && SSE_REG_P (operands[2])"
5128 rtx op2 = lowpart_subreg (V4SImode, operands[2],
5129 GET_MODE (operands[2]));
5130 /* Generate SSE2 cvtdq2ps. */
5131 emit_insn (gen_floatv4siv4sf2 (operands[3], op2));
5133 /* Merge operands[3] with operands[0]. */
5137 mask = gen_rtx_PARALLEL (VOIDmode,
5138 gen_rtvec (4, GEN_INT (0), GEN_INT (1),
5139 GEN_INT (6), GEN_INT (7)));
5140 op1 = gen_rtx_VEC_CONCAT (V8SFmode, operands[3], operands[1]);
5141 op2 = gen_rtx_VEC_SELECT (V4SFmode, op1, mask);
5142 emit_insn (gen_rtx_SET (operands[0], op2));
5146 /* NB: SSE can only concatenate OP0 and OP3 to OP0. */
5147 mask = gen_rtx_PARALLEL (VOIDmode,
5148 gen_rtvec (4, GEN_INT (2), GEN_INT (3),
5149 GEN_INT (4), GEN_INT (5)));
5150 op1 = gen_rtx_VEC_CONCAT (V8SFmode, operands[0], operands[3]);
5151 op2 = gen_rtx_VEC_SELECT (V4SFmode, op1, mask);
5152 emit_insn (gen_rtx_SET (operands[0], op2));
5154 /* Swap bits 0:63 with bits 64:127. */
5155 mask = gen_rtx_PARALLEL (VOIDmode,
5156 gen_rtvec (4, GEN_INT (2), GEN_INT (3),
5157 GEN_INT (0), GEN_INT (1)));
5158 rtx dest = lowpart_subreg (V4SImode, operands[0],
5159 GET_MODE (operands[0]));
5160 op1 = gen_rtx_VEC_SELECT (V4SImode, dest, mask);
5161 emit_insn (gen_rtx_SET (dest, op1));
5165 [(set_attr "mmx_isa" "native,sse_noavx,avx")
5166 (set_attr "type" "ssecvt")
5167 (set_attr "mode" "V4SF")])
5169 (define_insn "sse_cvtps2pi"
5170 [(set (match_operand:V2SI 0 "register_operand" "=y,Yv")
5172 (unspec:V4SI [(match_operand:V4SF 1 "register_mmxmem_operand" "xm,YvBm")]
5174 (parallel [(const_int 0) (const_int 1)])))]
5175 "(TARGET_MMX || TARGET_MMX_WITH_SSE) && TARGET_SSE"
5177 cvtps2pi\t{%1, %0|%0, %q1}
5178 %vcvtps2dq\t{%1, %0|%0, %1}"
5179 [(set_attr "isa" "*,sse2")
5180 (set_attr "mmx_isa" "native,*")
5181 (set_attr "type" "ssecvt")
5182 (set_attr "unit" "mmx,*")
5183 (set_attr "mode" "DI")])
5185 (define_insn "sse_cvttps2pi"
5186 [(set (match_operand:V2SI 0 "register_operand" "=y,Yv")
5188 (fix:V4SI (match_operand:V4SF 1 "register_mmxmem_operand" "xm,YvBm"))
5189 (parallel [(const_int 0) (const_int 1)])))]
5190 "(TARGET_MMX || TARGET_MMX_WITH_SSE) && TARGET_SSE"
5192 cvttps2pi\t{%1, %0|%0, %q1}
5193 %vcvttps2dq\t{%1, %0|%0, %1}"
5194 [(set_attr "isa" "*,sse2")
5195 (set_attr "mmx_isa" "native,*")
5196 (set_attr "type" "ssecvt")
5197 (set_attr "unit" "mmx,*")
5198 (set_attr "prefix_rep" "0")
5199 (set_attr "mode" "SF")])
5201 (define_insn "sse_cvtsi2ss<rex64namesuffix><round_name>"
5202 [(set (match_operand:V4SF 0 "register_operand" "=x,x,v")
5205 (float:SF (match_operand:SWI48 2 "<round_nimm_scalar_predicate>" "r,m,<round_constraint3>")))
5206 (match_operand:V4SF 1 "register_operand" "0,0,v")
5210 cvtsi2ss<rex64suffix>\t{%2, %0|%0, %2}
5211 cvtsi2ss<rex64suffix>\t{%2, %0|%0, %2}
5212 vcvtsi2ss<rex64suffix>\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
5213 [(set_attr "isa" "noavx,noavx,avx")
5214 (set_attr "type" "sseicvt")
5215 (set_attr "athlon_decode" "vector,double,*")
5216 (set_attr "amdfam10_decode" "vector,double,*")
5217 (set_attr "bdver1_decode" "double,direct,*")
5218 (set_attr "btver2_decode" "double,double,double")
5219 (set_attr "znver1_decode" "double,double,double")
5220 (set (attr "length_vex")
5222 (and (match_test "<MODE>mode == DImode")
5223 (eq_attr "alternative" "2"))
5225 (const_string "*")))
5226 (set (attr "prefix_rex")
5228 (and (match_test "<MODE>mode == DImode")
5229 (eq_attr "alternative" "0,1"))
5231 (const_string "*")))
5232 (set_attr "prefix" "orig,orig,maybe_evex")
5233 (set_attr "mode" "SF")])
5235 (define_insn "sse_cvtss2si<rex64namesuffix><round_name>"
5236 [(set (match_operand:SWI48 0 "register_operand" "=r,r")
5239 (match_operand:V4SF 1 "<round_nimm_scalar_predicate>" "v,<round_constraint2>")
5240 (parallel [(const_int 0)]))]
5241 UNSPEC_FIX_NOTRUNC))]
5243 "%vcvtss2si<rex64suffix>\t{<round_op2>%1, %0|%0, %k1<round_op2>}"
5244 [(set_attr "type" "sseicvt")
5245 (set_attr "athlon_decode" "double,vector")
5246 (set_attr "bdver1_decode" "double,double")
5247 (set_attr "prefix_rep" "1")
5248 (set_attr "prefix" "maybe_vex")
5249 (set_attr "mode" "<MODE>")])
5251 (define_insn "sse_cvtss2si<rex64namesuffix>_2"
5252 [(set (match_operand:SWI48 0 "register_operand" "=r,r")
5253 (unspec:SWI48 [(match_operand:SF 1 "nonimmediate_operand" "v,m")]
5254 UNSPEC_FIX_NOTRUNC))]
5256 "%vcvtss2si<rex64suffix>\t{%1, %0|%0, %1}"
5257 [(set_attr "type" "sseicvt")
5258 (set_attr "athlon_decode" "double,vector")
5259 (set_attr "amdfam10_decode" "double,double")
5260 (set_attr "bdver1_decode" "double,double")
5261 (set_attr "prefix_rep" "1")
5262 (set_attr "prefix" "maybe_vex")
5263 (set_attr "mode" "<MODE>")])
5265 (define_insn "sse_cvttss2si<rex64namesuffix><round_saeonly_name>"
5266 [(set (match_operand:SWI48 0 "register_operand" "=r,r")
5269 (match_operand:V4SF 1 "<round_saeonly_nimm_scalar_predicate>" "v,<round_saeonly_constraint>")
5270 (parallel [(const_int 0)]))))]
5272 "%vcvttss2si<rex64suffix>\t{<round_saeonly_op2>%1, %0|%0, %k1<round_saeonly_op2>}"
5273 [(set_attr "type" "sseicvt")
5274 (set_attr "athlon_decode" "double,vector")
5275 (set_attr "amdfam10_decode" "double,double")
5276 (set_attr "bdver1_decode" "double,double")
5277 (set_attr "prefix_rep" "1")
5278 (set_attr "prefix" "maybe_vex")
5279 (set_attr "mode" "<MODE>")])
5281 (define_insn "cvtusi2<ssescalarmodesuffix>32<round_name>"
5282 [(set (match_operand:VF_128 0 "register_operand" "=v")
5284 (vec_duplicate:VF_128
5285 (unsigned_float:<ssescalarmode>
5286 (match_operand:SI 2 "<round_nimm_scalar_predicate>" "<round_constraint3>")))
5287 (match_operand:VF_128 1 "register_operand" "v")
5289 "TARGET_AVX512F && <round_modev4sf_condition>"
5290 "vcvtusi2<ssescalarmodesuffix>{l}\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
5291 [(set_attr "type" "sseicvt")
5292 (set_attr "prefix" "evex")
5293 (set_attr "mode" "<ssescalarmode>")])
5295 (define_insn "cvtusi2<ssescalarmodesuffix>64<round_name>"
5296 [(set (match_operand:VF_128 0 "register_operand" "=v")
5298 (vec_duplicate:VF_128
5299 (unsigned_float:<ssescalarmode>
5300 (match_operand:DI 2 "<round_nimm_scalar_predicate>" "<round_constraint3>")))
5301 (match_operand:VF_128 1 "register_operand" "v")
5303 "TARGET_AVX512F && TARGET_64BIT"
5304 "vcvtusi2<ssescalarmodesuffix>{q}\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
5305 [(set_attr "type" "sseicvt")
5306 (set_attr "prefix" "evex")
5307 (set_attr "mode" "<ssescalarmode>")])
5309 (define_insn "float<sseintvecmodelower><mode>2<mask_name><round_name>"
5310 [(set (match_operand:VF1 0 "register_operand" "=x,v")
5312 (match_operand:<sseintvecmode> 1 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
5313 "TARGET_SSE2 && <mask_mode512bit_condition> && <round_mode512bit_condition>"
5315 cvtdq2ps\t{%1, %0|%0, %1}
5316 vcvtdq2ps\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5317 [(set_attr "isa" "noavx,avx")
5318 (set_attr "type" "ssecvt")
5319 (set_attr "prefix" "maybe_vex")
5320 (set_attr "mode" "<sseinsnmode>")])
5322 (define_insn "ufloat<sseintvecmodelower><mode>2<mask_name><round_name>"
5323 [(set (match_operand:VF1_AVX512VL 0 "register_operand" "=v")
5324 (unsigned_float:VF1_AVX512VL
5325 (match_operand:<sseintvecmode> 1 "nonimmediate_operand" "<round_constraint>")))]
5327 "vcvtudq2ps\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5328 [(set_attr "type" "ssecvt")
5329 (set_attr "prefix" "evex")
5330 (set_attr "mode" "<MODE>")])
5332 (define_expand "floatuns<sseintvecmodelower><mode>2"
5333 [(match_operand:VF1 0 "register_operand")
5334 (match_operand:<sseintvecmode> 1 "register_operand")]
5335 "TARGET_SSE2 && (<MODE>mode == V4SFmode || TARGET_AVX2)"
5337 if (<MODE>mode == V16SFmode)
5338 emit_insn (gen_ufloatv16siv16sf2 (operands[0], operands[1]));
5340 if (TARGET_AVX512VL)
5342 if (<MODE>mode == V4SFmode)
5343 emit_insn (gen_ufloatv4siv4sf2 (operands[0], operands[1]));
5345 emit_insn (gen_ufloatv8siv8sf2 (operands[0], operands[1]));
5348 ix86_expand_vector_convert_uns_vsivsf (operands[0], operands[1]);
5354 ;; For <sse2_avx_avx512f>_fix_notrunc<sf2simodelower><mode> insn pattern
5355 (define_mode_attr sf2simodelower
5356 [(V16SI "v16sf") (V8SI "v8sf") (V4SI "v4sf")])
5358 (define_insn "<sse2_avx_avx512f>_fix_notrunc<sf2simodelower><mode><mask_name>"
5359 [(set (match_operand:VI4_AVX 0 "register_operand" "=v")
5361 [(match_operand:<ssePSmode> 1 "vector_operand" "vBm")]
5362 UNSPEC_FIX_NOTRUNC))]
5363 "TARGET_SSE2 && <mask_mode512bit_condition>"
5364 "%vcvtps2dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5365 [(set_attr "type" "ssecvt")
5366 (set (attr "prefix_data16")
5368 (match_test "TARGET_AVX")
5370 (const_string "1")))
5371 (set_attr "prefix" "maybe_vex")
5372 (set_attr "mode" "<sseinsnmode>")])
5374 (define_insn "avx512f_fix_notruncv16sfv16si<mask_name><round_name>"
5375 [(set (match_operand:V16SI 0 "register_operand" "=v")
5377 [(match_operand:V16SF 1 "<round_nimm_predicate>" "<round_constraint>")]
5378 UNSPEC_FIX_NOTRUNC))]
5380 "vcvtps2dq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5381 [(set_attr "type" "ssecvt")
5382 (set_attr "prefix" "evex")
5383 (set_attr "mode" "XI")])
5385 (define_insn "<mask_codefor><avx512>_ufix_notrunc<sf2simodelower><mode><mask_name><round_name>"
5386 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
5387 (unspec:VI4_AVX512VL
5388 [(match_operand:<ssePSmode> 1 "nonimmediate_operand" "<round_constraint>")]
5389 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
5391 "vcvtps2udq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5392 [(set_attr "type" "ssecvt")
5393 (set_attr "prefix" "evex")
5394 (set_attr "mode" "<sseinsnmode>")])
5396 (define_insn "<mask_codefor>avx512dq_cvtps2qq<mode><mask_name><round_name>"
5397 [(set (match_operand:VI8_256_512 0 "register_operand" "=v")
5398 (unspec:VI8_256_512 [(match_operand:<ssePSmode2> 1 "nonimmediate_operand" "<round_constraint>")]
5399 UNSPEC_FIX_NOTRUNC))]
5400 "TARGET_AVX512DQ && <round_mode512bit_condition>"
5401 "vcvtps2qq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5402 [(set_attr "type" "ssecvt")
5403 (set_attr "prefix" "evex")
5404 (set_attr "mode" "<sseinsnmode>")])
5406 (define_insn "<mask_codefor>avx512dq_cvtps2qqv2di<mask_name>"
5407 [(set (match_operand:V2DI 0 "register_operand" "=v")
5410 (match_operand:V4SF 1 "nonimmediate_operand" "vm")
5411 (parallel [(const_int 0) (const_int 1)]))]
5412 UNSPEC_FIX_NOTRUNC))]
5413 "TARGET_AVX512DQ && TARGET_AVX512VL"
5414 "vcvtps2qq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
5415 [(set_attr "type" "ssecvt")
5416 (set_attr "prefix" "evex")
5417 (set_attr "mode" "TI")])
5419 (define_insn "<mask_codefor>avx512dq_cvtps2uqq<mode><mask_name><round_name>"
5420 [(set (match_operand:VI8_256_512 0 "register_operand" "=v")
5421 (unspec:VI8_256_512 [(match_operand:<ssePSmode2> 1 "nonimmediate_operand" "<round_constraint>")]
5422 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
5423 "TARGET_AVX512DQ && <round_mode512bit_condition>"
5424 "vcvtps2uqq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5425 [(set_attr "type" "ssecvt")
5426 (set_attr "prefix" "evex")
5427 (set_attr "mode" "<sseinsnmode>")])
5429 (define_insn "<mask_codefor>avx512dq_cvtps2uqqv2di<mask_name>"
5430 [(set (match_operand:V2DI 0 "register_operand" "=v")
5433 (match_operand:V4SF 1 "nonimmediate_operand" "vm")
5434 (parallel [(const_int 0) (const_int 1)]))]
5435 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
5436 "TARGET_AVX512DQ && TARGET_AVX512VL"
5437 "vcvtps2uqq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
5438 [(set_attr "type" "ssecvt")
5439 (set_attr "prefix" "evex")
5440 (set_attr "mode" "TI")])
5442 (define_insn "<fixsuffix>fix_truncv16sfv16si2<mask_name><round_saeonly_name>"
5443 [(set (match_operand:V16SI 0 "register_operand" "=v")
5445 (match_operand:V16SF 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
5447 "vcvttps2<fixsuffix>dq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
5448 [(set_attr "type" "ssecvt")
5449 (set_attr "prefix" "evex")
5450 (set_attr "mode" "XI")])
5452 (define_insn "fix_truncv8sfv8si2<mask_name>"
5453 [(set (match_operand:V8SI 0 "register_operand" "=v")
5454 (fix:V8SI (match_operand:V8SF 1 "nonimmediate_operand" "vm")))]
5455 "TARGET_AVX && <mask_avx512vl_condition>"
5456 "vcvttps2dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5457 [(set_attr "type" "ssecvt")
5458 (set_attr "prefix" "<mask_prefix>")
5459 (set_attr "mode" "OI")])
5461 (define_insn "fix_truncv4sfv4si2<mask_name>"
5462 [(set (match_operand:V4SI 0 "register_operand" "=v")
5463 (fix:V4SI (match_operand:V4SF 1 "vector_operand" "vBm")))]
5464 "TARGET_SSE2 && <mask_avx512vl_condition>"
5465 "%vcvttps2dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5466 [(set_attr "type" "ssecvt")
5467 (set (attr "prefix_rep")
5469 (match_test "TARGET_AVX")
5471 (const_string "1")))
5472 (set (attr "prefix_data16")
5474 (match_test "TARGET_AVX")
5476 (const_string "0")))
5477 (set_attr "prefix_data16" "0")
5478 (set_attr "prefix" "<mask_prefix2>")
5479 (set_attr "mode" "TI")])
5481 (define_expand "fixuns_trunc<mode><sseintvecmodelower>2"
5482 [(match_operand:<sseintvecmode> 0 "register_operand")
5483 (match_operand:VF1 1 "register_operand")]
5486 if (<MODE>mode == V16SFmode)
5487 emit_insn (gen_ufix_truncv16sfv16si2 (operands[0],
5492 tmp[0] = ix86_expand_adjust_ufix_to_sfix_si (operands[1], &tmp[2]);
5493 tmp[1] = gen_reg_rtx (<sseintvecmode>mode);
5494 emit_insn (gen_fix_trunc<mode><sseintvecmodelower>2 (tmp[1], tmp[0]));
5495 emit_insn (gen_xor<sseintvecmodelower>3 (operands[0], tmp[1], tmp[2]));
5500 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5502 ;; Parallel double-precision floating point conversion operations
5504 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5506 (define_insn "sse2_cvtpi2pd"
5507 [(set (match_operand:V2DF 0 "register_operand" "=v,?!x")
5508 (float:V2DF (match_operand:V2SI 1 "nonimmediate_operand" "vBm,yBm")))]
5511 %vcvtdq2pd\t{%1, %0|%0, %1}
5512 cvtpi2pd\t{%1, %0|%0, %1}"
5513 [(set_attr "mmx_isa" "*,native")
5514 (set_attr "type" "ssecvt")
5515 (set_attr "unit" "*,mmx")
5516 (set_attr "prefix_data16" "*,1")
5517 (set_attr "prefix" "maybe_vex,*")
5518 (set_attr "mode" "V2DF")])
5520 (define_expand "floatv2siv2df2"
5521 [(set (match_operand:V2DF 0 "register_operand")
5522 (float:V2DF (match_operand:V2SI 1 "nonimmediate_operand")))]
5523 "TARGET_MMX_WITH_SSE")
5525 (define_insn "floatunsv2siv2df2"
5526 [(set (match_operand:V2DF 0 "register_operand" "=v")
5527 (unsigned_float:V2DF
5528 (match_operand:V2SI 1 "nonimmediate_operand" "vm")))]
5529 "TARGET_MMX_WITH_SSE && TARGET_AVX512VL"
5530 "vcvtudq2pd\t{%1, %0|%0, %1}"
5531 [(set_attr "type" "ssecvt")
5532 (set_attr "prefix" "evex")
5533 (set_attr "mode" "V2DF")])
5535 (define_insn "sse2_cvtpd2pi"
5536 [(set (match_operand:V2SI 0 "register_operand" "=v,?!y")
5537 (unspec:V2SI [(match_operand:V2DF 1 "vector_operand" "vBm,xBm")]
5538 UNSPEC_FIX_NOTRUNC))]
5541 * return TARGET_AVX ? \"vcvtpd2dq{x}\t{%1, %0|%0, %1}\" : \"cvtpd2dq\t{%1, %0|%0, %1}\";
5542 cvtpd2pi\t{%1, %0|%0, %1}"
5543 [(set_attr "mmx_isa" "*,native")
5544 (set_attr "type" "ssecvt")
5545 (set_attr "unit" "*,mmx")
5546 (set_attr "amdfam10_decode" "double")
5547 (set_attr "athlon_decode" "vector")
5548 (set_attr "bdver1_decode" "double")
5549 (set_attr "prefix_data16" "*,1")
5550 (set_attr "prefix" "maybe_vex,*")
5551 (set_attr "mode" "TI")])
5553 (define_insn "sse2_cvttpd2pi"
5554 [(set (match_operand:V2SI 0 "register_operand" "=v,?!y")
5555 (fix:V2SI (match_operand:V2DF 1 "vector_operand" "vBm,xBm")))]
5558 * return TARGET_AVX ? \"vcvttpd2dq{x}\t{%1, %0|%0, %1}\" : \"cvttpd2dq\t{%1, %0|%0, %1}\";
5559 cvttpd2pi\t{%1, %0|%0, %1}"
5560 [(set_attr "mmx_isa" "*,native")
5561 (set_attr "type" "ssecvt")
5562 (set_attr "unit" "*,mmx")
5563 (set_attr "amdfam10_decode" "double")
5564 (set_attr "athlon_decode" "vector")
5565 (set_attr "bdver1_decode" "double")
5566 (set_attr "prefix_data16" "*,1")
5567 (set_attr "prefix" "maybe_vex,*")
5568 (set_attr "mode" "TI")])
5570 (define_expand "fix_truncv2dfv2si2"
5571 [(set (match_operand:V2SI 0 "register_operand")
5572 (fix:V2SI (match_operand:V2DF 1 "vector_operand")))]
5573 "TARGET_MMX_WITH_SSE")
5575 (define_insn "fixuns_truncv2dfv2si2"
5576 [(set (match_operand:V2SI 0 "register_operand" "=v")
5578 (match_operand:V2DF 1 "nonimmediate_operand" "vm")))]
5579 "TARGET_MMX_WITH_SSE && TARGET_AVX512VL"
5580 "vcvttpd2udq{x}\t{%1, %0|%0, %1}"
5581 [(set_attr "type" "ssecvt")
5582 (set_attr "prefix" "evex")
5583 (set_attr "mode" "TI")])
5585 (define_insn "sse2_cvtsi2sd"
5586 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
5589 (float:DF (match_operand:SI 2 "nonimmediate_operand" "r,m,rm")))
5590 (match_operand:V2DF 1 "register_operand" "0,0,v")
5594 cvtsi2sd{l}\t{%2, %0|%0, %2}
5595 cvtsi2sd{l}\t{%2, %0|%0, %2}
5596 vcvtsi2sd{l}\t{%2, %1, %0|%0, %1, %2}"
5597 [(set_attr "isa" "noavx,noavx,avx")
5598 (set_attr "type" "sseicvt")
5599 (set_attr "athlon_decode" "double,direct,*")
5600 (set_attr "amdfam10_decode" "vector,double,*")
5601 (set_attr "bdver1_decode" "double,direct,*")
5602 (set_attr "btver2_decode" "double,double,double")
5603 (set_attr "znver1_decode" "double,double,double")
5604 (set_attr "prefix" "orig,orig,maybe_evex")
5605 (set_attr "mode" "DF")])
5607 (define_insn "sse2_cvtsi2sdq<round_name>"
5608 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
5611 (float:DF (match_operand:DI 2 "<round_nimm_scalar_predicate>" "r,m,<round_constraint3>")))
5612 (match_operand:V2DF 1 "register_operand" "0,0,v")
5614 "TARGET_SSE2 && TARGET_64BIT"
5616 cvtsi2sd{q}\t{%2, %0|%0, %2}
5617 cvtsi2sd{q}\t{%2, %0|%0, %2}
5618 vcvtsi2sd{q}\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
5619 [(set_attr "isa" "noavx,noavx,avx")
5620 (set_attr "type" "sseicvt")
5621 (set_attr "athlon_decode" "double,direct,*")
5622 (set_attr "amdfam10_decode" "vector,double,*")
5623 (set_attr "bdver1_decode" "double,direct,*")
5624 (set_attr "length_vex" "*,*,4")
5625 (set_attr "prefix_rex" "1,1,*")
5626 (set_attr "prefix" "orig,orig,maybe_evex")
5627 (set_attr "mode" "DF")])
5629 (define_insn "avx512f_vcvtss2usi<rex64namesuffix><round_name>"
5630 [(set (match_operand:SWI48 0 "register_operand" "=r")
5633 (match_operand:V4SF 1 "<round_nimm_predicate>" "<round_constraint>")
5634 (parallel [(const_int 0)]))]
5635 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
5637 "vcvtss2usi\t{<round_op2>%1, %0|%0, %k1<round_op2>}"
5638 [(set_attr "type" "sseicvt")
5639 (set_attr "prefix" "evex")
5640 (set_attr "mode" "<MODE>")])
5642 (define_insn "avx512f_vcvttss2usi<rex64namesuffix><round_saeonly_name>"
5643 [(set (match_operand:SWI48 0 "register_operand" "=r")
5646 (match_operand:V4SF 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
5647 (parallel [(const_int 0)]))))]
5649 "vcvttss2usi\t{<round_saeonly_op2>%1, %0|%0, %k1<round_saeonly_op2>}"
5650 [(set_attr "type" "sseicvt")
5651 (set_attr "prefix" "evex")
5652 (set_attr "mode" "<MODE>")])
5654 (define_insn "avx512f_vcvtsd2usi<rex64namesuffix><round_name>"
5655 [(set (match_operand:SWI48 0 "register_operand" "=r")
5658 (match_operand:V2DF 1 "<round_nimm_predicate>" "<round_constraint>")
5659 (parallel [(const_int 0)]))]
5660 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
5662 "vcvtsd2usi\t{<round_op2>%1, %0|%0, %q1<round_op2>}"
5663 [(set_attr "type" "sseicvt")
5664 (set_attr "prefix" "evex")
5665 (set_attr "mode" "<MODE>")])
5667 (define_insn "avx512f_vcvttsd2usi<rex64namesuffix><round_saeonly_name>"
5668 [(set (match_operand:SWI48 0 "register_operand" "=r")
5671 (match_operand:V2DF 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
5672 (parallel [(const_int 0)]))))]
5674 "vcvttsd2usi\t{<round_saeonly_op2>%1, %0|%0, %q1<round_saeonly_op2>}"
5675 [(set_attr "type" "sseicvt")
5676 (set_attr "prefix" "evex")
5677 (set_attr "mode" "<MODE>")])
5679 (define_insn "sse2_cvtsd2si<rex64namesuffix><round_name>"
5680 [(set (match_operand:SWI48 0 "register_operand" "=r,r")
5683 (match_operand:V2DF 1 "<round_nimm_scalar_predicate>" "v,<round_constraint2>")
5684 (parallel [(const_int 0)]))]
5685 UNSPEC_FIX_NOTRUNC))]
5687 "%vcvtsd2si<rex64suffix>\t{<round_op2>%1, %0|%0, %q1<round_op2>}"
5688 [(set_attr "type" "sseicvt")
5689 (set_attr "athlon_decode" "double,vector")
5690 (set_attr "bdver1_decode" "double,double")
5691 (set_attr "btver2_decode" "double,double")
5692 (set_attr "prefix_rep" "1")
5693 (set_attr "prefix" "maybe_vex")
5694 (set_attr "mode" "<MODE>")])
5696 (define_insn "sse2_cvtsd2si<rex64namesuffix>_2"
5697 [(set (match_operand:SWI48 0 "register_operand" "=r,r")
5698 (unspec:SWI48 [(match_operand:DF 1 "nonimmediate_operand" "v,m")]
5699 UNSPEC_FIX_NOTRUNC))]
5701 "%vcvtsd2si<rex64suffix>\t{%1, %0|%0, %q1}"
5702 [(set_attr "type" "sseicvt")
5703 (set_attr "athlon_decode" "double,vector")
5704 (set_attr "amdfam10_decode" "double,double")
5705 (set_attr "bdver1_decode" "double,double")
5706 (set_attr "prefix_rep" "1")
5707 (set_attr "prefix" "maybe_vex")
5708 (set_attr "mode" "<MODE>")])
5710 (define_insn "sse2_cvttsd2si<rex64namesuffix><round_saeonly_name>"
5711 [(set (match_operand:SWI48 0 "register_operand" "=r,r")
5714 (match_operand:V2DF 1 "<round_saeonly_nimm_scalar_predicate>" "v,<round_saeonly_constraint2>")
5715 (parallel [(const_int 0)]))))]
5717 "%vcvttsd2si<rex64suffix>\t{<round_saeonly_op2>%1, %0|%0, %q1<round_saeonly_op2>}"
5718 [(set_attr "type" "sseicvt")
5719 (set_attr "athlon_decode" "double,vector")
5720 (set_attr "amdfam10_decode" "double,double")
5721 (set_attr "bdver1_decode" "double,double")
5722 (set_attr "btver2_decode" "double,double")
5723 (set_attr "prefix_rep" "1")
5724 (set_attr "prefix" "maybe_vex")
5725 (set_attr "mode" "<MODE>")])
5727 ;; For float<si2dfmode><mode>2 insn pattern
5728 (define_mode_attr si2dfmode
5729 [(V8DF "V8SI") (V4DF "V4SI")])
5730 (define_mode_attr si2dfmodelower
5731 [(V8DF "v8si") (V4DF "v4si")])
5733 (define_insn "float<si2dfmodelower><mode>2<mask_name>"
5734 [(set (match_operand:VF2_512_256 0 "register_operand" "=v")
5735 (float:VF2_512_256 (match_operand:<si2dfmode> 1 "nonimmediate_operand" "vm")))]
5736 "TARGET_AVX && <mask_mode512bit_condition>"
5737 "vcvtdq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5738 [(set_attr "type" "ssecvt")
5739 (set_attr "prefix" "maybe_vex")
5740 (set_attr "mode" "<MODE>")])
5742 (define_insn "float<floatunssuffix><sseintvecmodelower><mode>2<mask_name><round_name>"
5743 [(set (match_operand:VF2_AVX512VL 0 "register_operand" "=v")
5744 (any_float:VF2_AVX512VL
5745 (match_operand:<sseintvecmode> 1 "nonimmediate_operand" "<round_constraint>")))]
5747 "vcvt<floatsuffix>qq2pd\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5748 [(set_attr "type" "ssecvt")
5749 (set_attr "prefix" "evex")
5750 (set_attr "mode" "<MODE>")])
5752 ;; For float<floatunssuffix><sselondveclower><mode> insn patterns
5753 (define_mode_attr qq2pssuff
5754 [(V8SF "") (V4SF "{y}")])
5756 (define_mode_attr sselongvecmode
5757 [(V8SF "V8DI") (V4SF "V4DI")])
5759 (define_mode_attr sselongvecmodelower
5760 [(V8SF "v8di") (V4SF "v4di")])
5762 (define_mode_attr sseintvecmode3
5763 [(V8SF "XI") (V4SF "OI")
5764 (V8DF "OI") (V4DF "TI")])
5766 (define_insn "float<floatunssuffix><sselongvecmodelower><mode>2<mask_name><round_name>"
5767 [(set (match_operand:VF1_128_256VL 0 "register_operand" "=v")
5768 (any_float:VF1_128_256VL
5769 (match_operand:<sselongvecmode> 1 "nonimmediate_operand" "<round_constraint>")))]
5770 "TARGET_AVX512DQ && <round_modev8sf_condition>"
5771 "vcvt<floatsuffix>qq2ps<qq2pssuff>\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5772 [(set_attr "type" "ssecvt")
5773 (set_attr "prefix" "evex")
5774 (set_attr "mode" "<MODE>")])
5776 (define_expand "float<floatunssuffix>v2div2sf2"
5777 [(set (match_operand:V4SF 0 "register_operand" "=v")
5779 (any_float:V2SF (match_operand:V2DI 1 "nonimmediate_operand" "vm"))
5781 "TARGET_AVX512DQ && TARGET_AVX512VL"
5782 "operands[2] = CONST0_RTX (V2SFmode);")
5784 (define_insn "*float<floatunssuffix>v2div2sf2"
5785 [(set (match_operand:V4SF 0 "register_operand" "=v")
5787 (any_float:V2SF (match_operand:V2DI 1 "nonimmediate_operand" "vm"))
5788 (match_operand:V2SF 2 "const0_operand" "C")))]
5789 "TARGET_AVX512DQ && TARGET_AVX512VL"
5790 "vcvt<floatsuffix>qq2ps{x}\t{%1, %0|%0, %1}"
5791 [(set_attr "type" "ssecvt")
5792 (set_attr "prefix" "evex")
5793 (set_attr "mode" "V4SF")])
5795 (define_mode_attr vpckfloat_concat_mode
5796 [(V8DI "v16sf") (V4DI "v8sf") (V2DI "v8sf")])
5797 (define_mode_attr vpckfloat_temp_mode
5798 [(V8DI "V8SF") (V4DI "V4SF") (V2DI "V4SF")])
5799 (define_mode_attr vpckfloat_op_mode
5800 [(V8DI "v8sf") (V4DI "v4sf") (V2DI "v2sf")])
5802 (define_expand "vec_pack<floatprefix>_float_<mode>"
5803 [(match_operand:<ssePSmode> 0 "register_operand")
5804 (any_float:<ssePSmode>
5805 (match_operand:VI8_AVX512VL 1 "register_operand"))
5806 (match_operand:VI8_AVX512VL 2 "register_operand")]
5809 rtx r1 = gen_reg_rtx (<vpckfloat_temp_mode>mode);
5810 rtx r2 = gen_reg_rtx (<vpckfloat_temp_mode>mode);
5811 rtx (*gen) (rtx, rtx) = gen_float<floatunssuffix><mode><vpckfloat_op_mode>2;
5812 emit_insn (gen (r1, operands[1]));
5813 emit_insn (gen (r2, operands[2]));
5814 if (<MODE>mode == V2DImode)
5815 emit_insn (gen_sse_movlhps (operands[0], r1, r2));
5817 emit_insn (gen_avx_vec_concat<vpckfloat_concat_mode> (operands[0],
5822 (define_expand "float<floatunssuffix>v2div2sf2_mask"
5823 [(set (match_operand:V4SF 0 "register_operand" "=v")
5826 (any_float:V2SF (match_operand:V2DI 1 "nonimmediate_operand" "vm"))
5828 (match_operand:V4SF 2 "nonimm_or_0_operand" "0C")
5829 (parallel [(const_int 0) (const_int 1)]))
5830 (match_operand:QI 3 "register_operand" "Yk"))
5832 "TARGET_AVX512DQ && TARGET_AVX512VL"
5833 "operands[4] = CONST0_RTX (V2SFmode);")
5835 (define_insn "*float<floatunssuffix>v2div2sf2_mask"
5836 [(set (match_operand:V4SF 0 "register_operand" "=v")
5839 (any_float:V2SF (match_operand:V2DI 1 "nonimmediate_operand" "vm"))
5841 (match_operand:V4SF 2 "nonimm_or_0_operand" "0C")
5842 (parallel [(const_int 0) (const_int 1)]))
5843 (match_operand:QI 3 "register_operand" "Yk"))
5844 (match_operand:V2SF 4 "const0_operand" "C")))]
5845 "TARGET_AVX512DQ && TARGET_AVX512VL"
5846 "vcvt<floatsuffix>qq2ps{x}\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
5847 [(set_attr "type" "ssecvt")
5848 (set_attr "prefix" "evex")
5849 (set_attr "mode" "V4SF")])
5851 (define_insn "*float<floatunssuffix>v2div2sf2_mask_1"
5852 [(set (match_operand:V4SF 0 "register_operand" "=v")
5855 (any_float:V2SF (match_operand:V2DI 1
5856 "nonimmediate_operand" "vm"))
5857 (match_operand:V2SF 3 "const0_operand" "C")
5858 (match_operand:QI 2 "register_operand" "Yk"))
5859 (match_operand:V2SF 4 "const0_operand" "C")))]
5860 "TARGET_AVX512DQ && TARGET_AVX512VL"
5861 "vcvt<floatsuffix>qq2ps{x}\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
5862 [(set_attr "type" "ssecvt")
5863 (set_attr "prefix" "evex")
5864 (set_attr "mode" "V4SF")])
5866 (define_insn "ufloat<si2dfmodelower><mode>2<mask_name>"
5867 [(set (match_operand:VF2_512_256VL 0 "register_operand" "=v")
5868 (unsigned_float:VF2_512_256VL
5869 (match_operand:<si2dfmode> 1 "nonimmediate_operand" "vm")))]
5871 "vcvtudq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5872 [(set_attr "type" "ssecvt")
5873 (set_attr "prefix" "evex")
5874 (set_attr "mode" "<MODE>")])
5876 (define_insn "ufloatv2siv2df2<mask_name>"
5877 [(set (match_operand:V2DF 0 "register_operand" "=v")
5878 (unsigned_float:V2DF
5880 (match_operand:V4SI 1 "nonimmediate_operand" "vm")
5881 (parallel [(const_int 0) (const_int 1)]))))]
5883 "vcvtudq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
5884 [(set_attr "type" "ssecvt")
5885 (set_attr "prefix" "evex")
5886 (set_attr "mode" "V2DF")])
5888 (define_insn "avx512f_cvtdq2pd512_2"
5889 [(set (match_operand:V8DF 0 "register_operand" "=v")
5892 (match_operand:V16SI 1 "nonimmediate_operand" "vm")
5893 (parallel [(const_int 0) (const_int 1)
5894 (const_int 2) (const_int 3)
5895 (const_int 4) (const_int 5)
5896 (const_int 6) (const_int 7)]))))]
5898 "vcvtdq2pd\t{%t1, %0|%0, %t1}"
5899 [(set_attr "type" "ssecvt")
5900 (set_attr "prefix" "evex")
5901 (set_attr "mode" "V8DF")])
5903 (define_insn "avx_cvtdq2pd256_2"
5904 [(set (match_operand:V4DF 0 "register_operand" "=v")
5907 (match_operand:V8SI 1 "nonimmediate_operand" "vm")
5908 (parallel [(const_int 0) (const_int 1)
5909 (const_int 2) (const_int 3)]))))]
5911 "vcvtdq2pd\t{%x1, %0|%0, %x1}"
5912 [(set_attr "type" "ssecvt")
5913 (set_attr "prefix" "maybe_evex")
5914 (set_attr "mode" "V4DF")])
5916 (define_insn "sse2_cvtdq2pd<mask_name>"
5917 [(set (match_operand:V2DF 0 "register_operand" "=v")
5920 (match_operand:V4SI 1 "nonimmediate_operand" "vm")
5921 (parallel [(const_int 0) (const_int 1)]))))]
5922 "TARGET_SSE2 && <mask_avx512vl_condition>"
5923 "%vcvtdq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
5924 [(set_attr "type" "ssecvt")
5925 (set_attr "prefix" "maybe_vex")
5926 (set_attr "mode" "V2DF")])
5928 (define_insn "avx512f_cvtpd2dq512<mask_name><round_name>"
5929 [(set (match_operand:V8SI 0 "register_operand" "=v")
5931 [(match_operand:V8DF 1 "<round_nimm_predicate>" "<round_constraint>")]
5932 UNSPEC_FIX_NOTRUNC))]
5934 "vcvtpd2dq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5935 [(set_attr "type" "ssecvt")
5936 (set_attr "prefix" "evex")
5937 (set_attr "mode" "OI")])
5939 (define_insn "avx_cvtpd2dq256<mask_name>"
5940 [(set (match_operand:V4SI 0 "register_operand" "=v")
5941 (unspec:V4SI [(match_operand:V4DF 1 "nonimmediate_operand" "vm")]
5942 UNSPEC_FIX_NOTRUNC))]
5943 "TARGET_AVX && <mask_avx512vl_condition>"
5944 "vcvtpd2dq{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5945 [(set_attr "type" "ssecvt")
5946 (set_attr "prefix" "<mask_prefix>")
5947 (set_attr "mode" "OI")])
5949 (define_expand "avx_cvtpd2dq256_2"
5950 [(set (match_operand:V8SI 0 "register_operand")
5952 (unspec:V4SI [(match_operand:V4DF 1 "nonimmediate_operand")]
5956 "operands[2] = CONST0_RTX (V4SImode);")
5958 (define_insn "*avx_cvtpd2dq256_2"
5959 [(set (match_operand:V8SI 0 "register_operand" "=v")
5961 (unspec:V4SI [(match_operand:V4DF 1 "nonimmediate_operand" "vm")]
5963 (match_operand:V4SI 2 "const0_operand")))]
5965 "vcvtpd2dq{y}\t{%1, %x0|%x0, %1}"
5966 [(set_attr "type" "ssecvt")
5967 (set_attr "prefix" "vex")
5968 (set_attr "btver2_decode" "vector")
5969 (set_attr "mode" "OI")])
5971 (define_insn "sse2_cvtpd2dq"
5972 [(set (match_operand:V4SI 0 "register_operand" "=v")
5974 (unspec:V2SI [(match_operand:V2DF 1 "vector_operand" "vBm")]
5976 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
5980 return "vcvtpd2dq{x}\t{%1, %0|%0, %1}";
5982 return "cvtpd2dq\t{%1, %0|%0, %1}";
5984 [(set_attr "type" "ssecvt")
5985 (set_attr "prefix_rep" "1")
5986 (set_attr "prefix_data16" "0")
5987 (set_attr "prefix" "maybe_vex")
5988 (set_attr "mode" "TI")
5989 (set_attr "amdfam10_decode" "double")
5990 (set_attr "athlon_decode" "vector")
5991 (set_attr "bdver1_decode" "double")])
5993 (define_insn "sse2_cvtpd2dq_mask"
5994 [(set (match_operand:V4SI 0 "register_operand" "=v")
5997 (unspec:V2SI [(match_operand:V2DF 1 "nonimmediate_operand" "vm")]
6000 (match_operand:V4SI 2 "nonimm_or_0_operand" "0C")
6001 (parallel [(const_int 0) (const_int 1)]))
6002 (match_operand:QI 3 "register_operand" "Yk"))
6003 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
6005 "vcvtpd2dq{x}\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
6006 [(set_attr "type" "ssecvt")
6007 (set_attr "prefix" "evex")
6008 (set_attr "mode" "TI")])
6010 (define_insn "*sse2_cvtpd2dq_mask_1"
6011 [(set (match_operand:V4SI 0 "register_operand" "=v")
6014 (unspec:V2SI [(match_operand:V2DF 1 "nonimmediate_operand" "vm")]
6016 (const_vector:V2SI [(const_int 0) (const_int 0)])
6017 (match_operand:QI 2 "register_operand" "Yk"))
6018 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
6020 "vcvtpd2dq{x}\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
6021 [(set_attr "type" "ssecvt")
6022 (set_attr "prefix" "evex")
6023 (set_attr "mode" "TI")])
6025 ;; For ufix_notrunc* insn patterns
6026 (define_mode_attr pd2udqsuff
6027 [(V8DF "") (V4DF "{y}")])
6029 (define_insn "ufix_notrunc<mode><si2dfmodelower>2<mask_name><round_name>"
6030 [(set (match_operand:<si2dfmode> 0 "register_operand" "=v")
6032 [(match_operand:VF2_512_256VL 1 "nonimmediate_operand" "<round_constraint>")]
6033 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
6035 "vcvtpd2udq<pd2udqsuff>\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
6036 [(set_attr "type" "ssecvt")
6037 (set_attr "prefix" "evex")
6038 (set_attr "mode" "<sseinsnmode>")])
6040 (define_insn "ufix_notruncv2dfv2si2"
6041 [(set (match_operand:V4SI 0 "register_operand" "=v")
6044 [(match_operand:V2DF 1 "nonimmediate_operand" "vm")]
6045 UNSPEC_UNSIGNED_FIX_NOTRUNC)
6046 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
6048 "vcvtpd2udq{x}\t{%1, %0|%0, %1}"
6049 [(set_attr "type" "ssecvt")
6050 (set_attr "prefix" "evex")
6051 (set_attr "mode" "TI")])
6053 (define_insn "ufix_notruncv2dfv2si2_mask"
6054 [(set (match_operand:V4SI 0 "register_operand" "=v")
6058 [(match_operand:V2DF 1 "nonimmediate_operand" "vm")]
6059 UNSPEC_UNSIGNED_FIX_NOTRUNC)
6061 (match_operand:V4SI 2 "nonimm_or_0_operand" "0C")
6062 (parallel [(const_int 0) (const_int 1)]))
6063 (match_operand:QI 3 "register_operand" "Yk"))
6064 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
6066 "vcvtpd2udq{x}\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
6067 [(set_attr "type" "ssecvt")
6068 (set_attr "prefix" "evex")
6069 (set_attr "mode" "TI")])
6071 (define_insn "*ufix_notruncv2dfv2si2_mask_1"
6072 [(set (match_operand:V4SI 0 "register_operand" "=v")
6076 [(match_operand:V2DF 1 "nonimmediate_operand" "vm")]
6077 UNSPEC_UNSIGNED_FIX_NOTRUNC)
6078 (const_vector:V2SI [(const_int 0) (const_int 0)])
6079 (match_operand:QI 2 "register_operand" "Yk"))
6080 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
6082 "vcvtpd2udq{x}\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
6083 [(set_attr "type" "ssecvt")
6084 (set_attr "prefix" "evex")
6085 (set_attr "mode" "TI")])
6087 (define_insn "fix<fixunssuffix>_truncv8dfv8si2<mask_name><round_saeonly_name>"
6088 [(set (match_operand:V8SI 0 "register_operand" "=v")
6090 (match_operand:V8DF 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
6092 "vcvttpd2<fixsuffix>dq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
6093 [(set_attr "type" "ssecvt")
6094 (set_attr "prefix" "evex")
6095 (set_attr "mode" "OI")])
6097 (define_insn "ufix_truncv2dfv2si2"
6098 [(set (match_operand:V4SI 0 "register_operand" "=v")
6100 (unsigned_fix:V2SI (match_operand:V2DF 1 "nonimmediate_operand" "vm"))
6101 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
6103 "vcvttpd2udq{x}\t{%1, %0|%0, %1}"
6104 [(set_attr "type" "ssecvt")
6105 (set_attr "prefix" "evex")
6106 (set_attr "mode" "TI")])
6108 (define_insn "ufix_truncv2dfv2si2_mask"
6109 [(set (match_operand:V4SI 0 "register_operand" "=v")
6112 (unsigned_fix:V2SI (match_operand:V2DF 1 "nonimmediate_operand" "vm"))
6114 (match_operand:V4SI 2 "nonimm_or_0_operand" "0C")
6115 (parallel [(const_int 0) (const_int 1)]))
6116 (match_operand:QI 3 "register_operand" "Yk"))
6117 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
6119 "vcvttpd2udq{x}\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
6120 [(set_attr "type" "ssecvt")
6121 (set_attr "prefix" "evex")
6122 (set_attr "mode" "TI")])
6124 (define_insn "*ufix_truncv2dfv2si2_mask_1"
6125 [(set (match_operand:V4SI 0 "register_operand" "=v")
6128 (unsigned_fix:V2SI (match_operand:V2DF 1 "nonimmediate_operand" "vm"))
6129 (const_vector:V2SI [(const_int 0) (const_int 0)])
6130 (match_operand:QI 2 "register_operand" "Yk"))
6131 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
6133 "vcvttpd2udq{x}\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
6134 [(set_attr "type" "ssecvt")
6135 (set_attr "prefix" "evex")
6136 (set_attr "mode" "TI")])
6138 (define_insn "fix_truncv4dfv4si2<mask_name>"
6139 [(set (match_operand:V4SI 0 "register_operand" "=v")
6140 (fix:V4SI (match_operand:V4DF 1 "nonimmediate_operand" "vm")))]
6141 "TARGET_AVX || (TARGET_AVX512VL && TARGET_AVX512F)"
6142 "vcvttpd2dq{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6143 [(set_attr "type" "ssecvt")
6144 (set_attr "prefix" "maybe_evex")
6145 (set_attr "mode" "OI")])
6147 (define_insn "ufix_truncv4dfv4si2<mask_name>"
6148 [(set (match_operand:V4SI 0 "register_operand" "=v")
6149 (unsigned_fix:V4SI (match_operand:V4DF 1 "nonimmediate_operand" "vm")))]
6150 "TARGET_AVX512VL && TARGET_AVX512F"
6151 "vcvttpd2udq{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6152 [(set_attr "type" "ssecvt")
6153 (set_attr "prefix" "maybe_evex")
6154 (set_attr "mode" "OI")])
6156 (define_insn "fix<fixunssuffix>_trunc<mode><sseintvecmodelower>2<mask_name><round_saeonly_name>"
6157 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
6158 (any_fix:<sseintvecmode>
6159 (match_operand:VF2_AVX512VL 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
6160 "TARGET_AVX512DQ && <round_saeonly_mode512bit_condition>"
6161 "vcvttpd2<fixsuffix>qq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
6162 [(set_attr "type" "ssecvt")
6163 (set_attr "prefix" "evex")
6164 (set_attr "mode" "<sseintvecmode2>")])
6166 (define_insn "fix_notrunc<mode><sseintvecmodelower>2<mask_name><round_name>"
6167 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
6168 (unspec:<sseintvecmode>
6169 [(match_operand:VF2_AVX512VL 1 "<round_nimm_predicate>" "<round_constraint>")]
6170 UNSPEC_FIX_NOTRUNC))]
6171 "TARGET_AVX512DQ && <round_mode512bit_condition>"
6172 "vcvtpd2qq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
6173 [(set_attr "type" "ssecvt")
6174 (set_attr "prefix" "evex")
6175 (set_attr "mode" "<sseintvecmode2>")])
6177 (define_insn "ufix_notrunc<mode><sseintvecmodelower>2<mask_name><round_name>"
6178 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
6179 (unspec:<sseintvecmode>
6180 [(match_operand:VF2_AVX512VL 1 "nonimmediate_operand" "<round_constraint>")]
6181 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
6182 "TARGET_AVX512DQ && <round_mode512bit_condition>"
6183 "vcvtpd2uqq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
6184 [(set_attr "type" "ssecvt")
6185 (set_attr "prefix" "evex")
6186 (set_attr "mode" "<sseintvecmode2>")])
6188 (define_insn "fix<fixunssuffix>_trunc<mode><sselongvecmodelower>2<mask_name><round_saeonly_name>"
6189 [(set (match_operand:<sselongvecmode> 0 "register_operand" "=v")
6190 (any_fix:<sselongvecmode>
6191 (match_operand:VF1_128_256VL 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
6192 "TARGET_AVX512DQ && <round_saeonly_modev8sf_condition>"
6193 "vcvttps2<fixsuffix>qq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
6194 [(set_attr "type" "ssecvt")
6195 (set_attr "prefix" "evex")
6196 (set_attr "mode" "<sseintvecmode3>")])
6198 (define_insn "fix<fixunssuffix>_truncv2sfv2di2<mask_name>"
6199 [(set (match_operand:V2DI 0 "register_operand" "=v")
6202 (match_operand:V4SF 1 "nonimmediate_operand" "vm")
6203 (parallel [(const_int 0) (const_int 1)]))))]
6204 "TARGET_AVX512DQ && TARGET_AVX512VL"
6205 "vcvttps2<fixsuffix>qq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
6206 [(set_attr "type" "ssecvt")
6207 (set_attr "prefix" "evex")
6208 (set_attr "mode" "TI")])
6210 (define_mode_attr vunpckfixt_mode
6211 [(V16SF "V8DI") (V8SF "V4DI") (V4SF "V2DI")])
6212 (define_mode_attr vunpckfixt_model
6213 [(V16SF "v8di") (V8SF "v4di") (V4SF "v2di")])
6214 (define_mode_attr vunpckfixt_extract_mode
6215 [(V16SF "v16sf") (V8SF "v8sf") (V4SF "v8sf")])
6217 (define_expand "vec_unpack_<fixprefix>fix_trunc_lo_<mode>"
6218 [(match_operand:<vunpckfixt_mode> 0 "register_operand")
6219 (any_fix:<vunpckfixt_mode>
6220 (match_operand:VF1_AVX512VL 1 "register_operand"))]
6223 rtx tem = operands[1];
6224 if (<MODE>mode != V4SFmode)
6226 tem = gen_reg_rtx (<ssehalfvecmode>mode);
6227 emit_insn (gen_vec_extract_lo_<vunpckfixt_extract_mode> (tem,
6230 rtx (*gen) (rtx, rtx)
6231 = gen_fix<fixunssuffix>_trunc<ssehalfvecmodelower><vunpckfixt_model>2;
6232 emit_insn (gen (operands[0], tem));
6236 (define_expand "vec_unpack_<fixprefix>fix_trunc_hi_<mode>"
6237 [(match_operand:<vunpckfixt_mode> 0 "register_operand")
6238 (any_fix:<vunpckfixt_mode>
6239 (match_operand:VF1_AVX512VL 1 "register_operand"))]
6243 if (<MODE>mode != V4SFmode)
6245 tem = gen_reg_rtx (<ssehalfvecmode>mode);
6246 emit_insn (gen_vec_extract_hi_<vunpckfixt_extract_mode> (tem,
6251 tem = gen_reg_rtx (V4SFmode);
6252 emit_insn (gen_avx_vpermilv4sf (tem, operands[1], GEN_INT (0x4e)));
6254 rtx (*gen) (rtx, rtx)
6255 = gen_fix<fixunssuffix>_trunc<ssehalfvecmodelower><vunpckfixt_model>2;
6256 emit_insn (gen (operands[0], tem));
6260 (define_insn "ufix_trunc<mode><sseintvecmodelower>2<mask_name>"
6261 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
6262 (unsigned_fix:<sseintvecmode>
6263 (match_operand:VF1_128_256VL 1 "nonimmediate_operand" "vm")))]
6265 "vcvttps2udq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6266 [(set_attr "type" "ssecvt")
6267 (set_attr "prefix" "evex")
6268 (set_attr "mode" "<sseintvecmode2>")])
6270 (define_expand "avx_cvttpd2dq256_2"
6271 [(set (match_operand:V8SI 0 "register_operand")
6273 (fix:V4SI (match_operand:V4DF 1 "nonimmediate_operand"))
6276 "operands[2] = CONST0_RTX (V4SImode);")
6278 (define_insn "sse2_cvttpd2dq"
6279 [(set (match_operand:V4SI 0 "register_operand" "=v")
6281 (fix:V2SI (match_operand:V2DF 1 "vector_operand" "vBm"))
6282 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
6286 return "vcvttpd2dq{x}\t{%1, %0|%0, %1}";
6288 return "cvttpd2dq\t{%1, %0|%0, %1}";
6290 [(set_attr "type" "ssecvt")
6291 (set_attr "amdfam10_decode" "double")
6292 (set_attr "athlon_decode" "vector")
6293 (set_attr "bdver1_decode" "double")
6294 (set_attr "prefix" "maybe_vex")
6295 (set_attr "mode" "TI")])
6297 (define_insn "sse2_cvttpd2dq_mask"
6298 [(set (match_operand:V4SI 0 "register_operand" "=v")
6301 (fix:V2SI (match_operand:V2DF 1 "nonimmediate_operand" "vm"))
6303 (match_operand:V4SI 2 "nonimm_or_0_operand" "0C")
6304 (parallel [(const_int 0) (const_int 1)]))
6305 (match_operand:QI 3 "register_operand" "Yk"))
6306 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
6308 "vcvttpd2dq{x}\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
6309 [(set_attr "type" "ssecvt")
6310 (set_attr "prefix" "evex")
6311 (set_attr "mode" "TI")])
6313 (define_insn "*sse2_cvttpd2dq_mask_1"
6314 [(set (match_operand:V4SI 0 "register_operand" "=v")
6317 (fix:V2SI (match_operand:V2DF 1 "nonimmediate_operand" "vm"))
6318 (const_vector:V2SI [(const_int 0) (const_int 0)])
6319 (match_operand:QI 2 "register_operand" "Yk"))
6320 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
6322 "vcvttpd2dq{x}\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
6323 [(set_attr "type" "ssecvt")
6324 (set_attr "prefix" "evex")
6325 (set_attr "mode" "TI")])
6327 (define_insn "sse2_cvtsd2ss<round_name>"
6328 [(set (match_operand:V4SF 0 "register_operand" "=x,x,v")
6331 (float_truncate:V2SF
6332 (match_operand:V2DF 2 "nonimmediate_operand" "x,m,<round_constraint>")))
6333 (match_operand:V4SF 1 "register_operand" "0,0,v")
6337 cvtsd2ss\t{%2, %0|%0, %2}
6338 cvtsd2ss\t{%2, %0|%0, %q2}
6339 vcvtsd2ss\t{<round_op3>%2, %1, %0|%0, %1, %q2<round_op3>}"
6340 [(set_attr "isa" "noavx,noavx,avx")
6341 (set_attr "type" "ssecvt")
6342 (set_attr "athlon_decode" "vector,double,*")
6343 (set_attr "amdfam10_decode" "vector,double,*")
6344 (set_attr "bdver1_decode" "direct,direct,*")
6345 (set_attr "btver2_decode" "double,double,double")
6346 (set_attr "prefix" "orig,orig,<round_prefix>")
6347 (set_attr "mode" "SF")])
6349 (define_insn "*sse2_vd_cvtsd2ss"
6350 [(set (match_operand:V4SF 0 "register_operand" "=x,x,v")
6353 (float_truncate:SF (match_operand:DF 2 "nonimmediate_operand" "x,m,vm")))
6354 (match_operand:V4SF 1 "register_operand" "0,0,v")
6358 cvtsd2ss\t{%2, %0|%0, %2}
6359 cvtsd2ss\t{%2, %0|%0, %2}
6360 vcvtsd2ss\t{%2, %1, %0|%0, %1, %2}"
6361 [(set_attr "isa" "noavx,noavx,avx")
6362 (set_attr "type" "ssecvt")
6363 (set_attr "athlon_decode" "vector,double,*")
6364 (set_attr "amdfam10_decode" "vector,double,*")
6365 (set_attr "bdver1_decode" "direct,direct,*")
6366 (set_attr "btver2_decode" "double,double,double")
6367 (set_attr "prefix" "orig,orig,vex")
6368 (set_attr "mode" "SF")])
6370 (define_insn "sse2_cvtss2sd<round_saeonly_name>"
6371 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
6375 (match_operand:V4SF 2 "<round_saeonly_nimm_scalar_predicate>" "x,m,<round_saeonly_constraint>")
6376 (parallel [(const_int 0) (const_int 1)])))
6377 (match_operand:V2DF 1 "register_operand" "0,0,v")
6381 cvtss2sd\t{%2, %0|%0, %2}
6382 cvtss2sd\t{%2, %0|%0, %k2}
6383 vcvtss2sd\t{<round_saeonly_op3>%2, %1, %0|%0, %1, %k2<round_saeonly_op3>}"
6384 [(set_attr "isa" "noavx,noavx,avx")
6385 (set_attr "type" "ssecvt")
6386 (set_attr "amdfam10_decode" "vector,double,*")
6387 (set_attr "athlon_decode" "direct,direct,*")
6388 (set_attr "bdver1_decode" "direct,direct,*")
6389 (set_attr "btver2_decode" "double,double,double")
6390 (set_attr "prefix" "orig,orig,<round_saeonly_prefix>")
6391 (set_attr "mode" "DF")])
6393 (define_insn "*sse2_vd_cvtss2sd"
6394 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
6397 (float_extend:DF (match_operand:SF 2 "nonimmediate_operand" "x,m,vm")))
6398 (match_operand:V2DF 1 "register_operand" "0,0,v")
6402 cvtss2sd\t{%2, %0|%0, %2}
6403 cvtss2sd\t{%2, %0|%0, %2}
6404 vcvtss2sd\t{%2, %1, %0|%0, %1, %2}"
6405 [(set_attr "isa" "noavx,noavx,avx")
6406 (set_attr "type" "ssecvt")
6407 (set_attr "amdfam10_decode" "vector,double,*")
6408 (set_attr "athlon_decode" "direct,direct,*")
6409 (set_attr "bdver1_decode" "direct,direct,*")
6410 (set_attr "btver2_decode" "double,double,double")
6411 (set_attr "prefix" "orig,orig,vex")
6412 (set_attr "mode" "DF")])
6414 (define_insn "<mask_codefor>avx512f_cvtpd2ps512<mask_name><round_name>"
6415 [(set (match_operand:V8SF 0 "register_operand" "=v")
6416 (float_truncate:V8SF
6417 (match_operand:V8DF 1 "<round_nimm_predicate>" "<round_constraint>")))]
6419 "vcvtpd2ps\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
6420 [(set_attr "type" "ssecvt")
6421 (set_attr "prefix" "evex")
6422 (set_attr "mode" "V8SF")])
6424 (define_insn "avx_cvtpd2ps256<mask_name>"
6425 [(set (match_operand:V4SF 0 "register_operand" "=v")
6426 (float_truncate:V4SF
6427 (match_operand:V4DF 1 "nonimmediate_operand" "vm")))]
6428 "TARGET_AVX && <mask_avx512vl_condition>"
6429 "vcvtpd2ps{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6430 [(set_attr "type" "ssecvt")
6431 (set_attr "prefix" "maybe_evex")
6432 (set_attr "btver2_decode" "vector")
6433 (set_attr "mode" "V4SF")])
6435 (define_expand "sse2_cvtpd2ps"
6436 [(set (match_operand:V4SF 0 "register_operand")
6438 (float_truncate:V2SF
6439 (match_operand:V2DF 1 "vector_operand"))
6442 "operands[2] = CONST0_RTX (V2SFmode);")
6444 (define_expand "sse2_cvtpd2ps_mask"
6445 [(set (match_operand:V4SF 0 "register_operand")
6448 (float_truncate:V2SF
6449 (match_operand:V2DF 1 "vector_operand"))
6451 (match_operand:V4SF 2 "nonimm_or_0_operand")
6452 (parallel [(const_int 0) (const_int 1)]))
6453 (match_operand:QI 3 "register_operand"))
6456 "operands[4] = CONST0_RTX (V2SFmode);")
6458 (define_insn "*sse2_cvtpd2ps"
6459 [(set (match_operand:V4SF 0 "register_operand" "=v")
6461 (float_truncate:V2SF
6462 (match_operand:V2DF 1 "vector_operand" "vBm"))
6463 (match_operand:V2SF 2 "const0_operand" "C")))]
6467 return "vcvtpd2ps{x}\t{%1, %0|%0, %1}";
6469 return "cvtpd2ps\t{%1, %0|%0, %1}";
6471 [(set_attr "type" "ssecvt")
6472 (set_attr "amdfam10_decode" "double")
6473 (set_attr "athlon_decode" "vector")
6474 (set_attr "bdver1_decode" "double")
6475 (set_attr "prefix_data16" "1")
6476 (set_attr "prefix" "maybe_vex")
6477 (set_attr "mode" "V4SF")])
6479 (define_insn "truncv2dfv2sf2"
6480 [(set (match_operand:V2SF 0 "register_operand" "=v")
6481 (float_truncate:V2SF
6482 (match_operand:V2DF 1 "vector_operand" "vBm")))]
6483 "TARGET_MMX_WITH_SSE"
6486 return "vcvtpd2ps{x}\t{%1, %0|%0, %1}";
6488 return "cvtpd2ps\t{%1, %0|%0, %1}";
6490 [(set_attr "type" "ssecvt")
6491 (set_attr "amdfam10_decode" "double")
6492 (set_attr "athlon_decode" "vector")
6493 (set_attr "bdver1_decode" "double")
6494 (set_attr "prefix_data16" "1")
6495 (set_attr "prefix" "maybe_vex")
6496 (set_attr "mode" "V4SF")])
6498 (define_insn "*sse2_cvtpd2ps_mask"
6499 [(set (match_operand:V4SF 0 "register_operand" "=v")
6502 (float_truncate:V2SF
6503 (match_operand:V2DF 1 "nonimmediate_operand" "vm"))
6505 (match_operand:V4SF 2 "nonimm_or_0_operand" "0C")
6506 (parallel [(const_int 0) (const_int 1)]))
6507 (match_operand:QI 3 "register_operand" "Yk"))
6508 (match_operand:V2SF 4 "const0_operand" "C")))]
6510 "vcvtpd2ps{x}\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
6511 [(set_attr "type" "ssecvt")
6512 (set_attr "prefix" "evex")
6513 (set_attr "mode" "V4SF")])
6515 (define_insn "*sse2_cvtpd2ps_mask_1"
6516 [(set (match_operand:V4SF 0 "register_operand" "=v")
6519 (float_truncate:V2SF
6520 (match_operand:V2DF 1 "nonimmediate_operand" "vm"))
6521 (match_operand:V2SF 3 "const0_operand" "C")
6522 (match_operand:QI 2 "register_operand" "Yk"))
6523 (match_operand:V2SF 4 "const0_operand" "C")))]
6525 "vcvtpd2ps{x}\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
6526 [(set_attr "type" "ssecvt")
6527 (set_attr "prefix" "evex")
6528 (set_attr "mode" "V4SF")])
6530 ;; For <sse2_avx_avx512f>_cvtps2pd<avxsizesuffix> insn pattern
6531 (define_mode_attr sf2dfmode
6532 [(V8DF "V8SF") (V4DF "V4SF")])
6534 (define_insn "<sse2_avx_avx512f>_cvtps2pd<avxsizesuffix><mask_name><round_saeonly_name>"
6535 [(set (match_operand:VF2_512_256 0 "register_operand" "=v")
6536 (float_extend:VF2_512_256
6537 (match_operand:<sf2dfmode> 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
6538 "TARGET_AVX && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
6539 "vcvtps2pd\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
6540 [(set_attr "type" "ssecvt")
6541 (set_attr "prefix" "maybe_vex")
6542 (set_attr "mode" "<MODE>")])
6544 (define_insn "*avx_cvtps2pd256_2"
6545 [(set (match_operand:V4DF 0 "register_operand" "=v")
6548 (match_operand:V8SF 1 "nonimmediate_operand" "vm")
6549 (parallel [(const_int 0) (const_int 1)
6550 (const_int 2) (const_int 3)]))))]
6552 "vcvtps2pd\t{%x1, %0|%0, %x1}"
6553 [(set_attr "type" "ssecvt")
6554 (set_attr "prefix" "vex")
6555 (set_attr "mode" "V4DF")])
6557 (define_insn "vec_unpacks_lo_v16sf"
6558 [(set (match_operand:V8DF 0 "register_operand" "=v")
6561 (match_operand:V16SF 1 "nonimmediate_operand" "vm")
6562 (parallel [(const_int 0) (const_int 1)
6563 (const_int 2) (const_int 3)
6564 (const_int 4) (const_int 5)
6565 (const_int 6) (const_int 7)]))))]
6567 "vcvtps2pd\t{%t1, %0|%0, %t1}"
6568 [(set_attr "type" "ssecvt")
6569 (set_attr "prefix" "evex")
6570 (set_attr "mode" "V8DF")])
6572 (define_insn "<avx512>_cvt<ssemodesuffix>2mask<mode>"
6573 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=k")
6574 (unspec:<avx512fmaskmode>
6575 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")]
6576 UNSPEC_CVTINT2MASK))]
6578 "vpmov<ssemodesuffix>2m\t{%1, %0|%0, %1}"
6579 [(set_attr "prefix" "evex")
6580 (set_attr "mode" "<sseinsnmode>")])
6582 (define_insn "<avx512>_cvt<ssemodesuffix>2mask<mode>"
6583 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=k")
6584 (unspec:<avx512fmaskmode>
6585 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")]
6586 UNSPEC_CVTINT2MASK))]
6588 "vpmov<ssemodesuffix>2m\t{%1, %0|%0, %1}"
6589 [(set_attr "prefix" "evex")
6590 (set_attr "mode" "<sseinsnmode>")])
6592 (define_expand "<avx512>_cvtmask2<ssemodesuffix><mode>"
6593 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
6594 (vec_merge:VI12_AVX512VL
6597 (match_operand:<avx512fmaskmode> 1 "register_operand")))]
6600 operands[2] = CONSTM1_RTX (<MODE>mode);
6601 operands[3] = CONST0_RTX (<MODE>mode);
6604 (define_insn "*<avx512>_cvtmask2<ssemodesuffix><mode>"
6605 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
6606 (vec_merge:VI12_AVX512VL
6607 (match_operand:VI12_AVX512VL 2 "vector_all_ones_operand")
6608 (match_operand:VI12_AVX512VL 3 "const0_operand")
6609 (match_operand:<avx512fmaskmode> 1 "register_operand" "k")))]
6611 "vpmovm2<ssemodesuffix>\t{%1, %0|%0, %1}"
6612 [(set_attr "prefix" "evex")
6613 (set_attr "mode" "<sseinsnmode>")])
6615 (define_expand "<avx512>_cvtmask2<ssemodesuffix><mode>"
6616 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
6617 (vec_merge:VI48_AVX512VL
6620 (match_operand:<avx512fmaskmode> 1 "register_operand")))]
6623 operands[2] = CONSTM1_RTX (<MODE>mode);
6624 operands[3] = CONST0_RTX (<MODE>mode);
6627 (define_insn "*<avx512>_cvtmask2<ssemodesuffix><mode>"
6628 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v,v")
6629 (vec_merge:VI48_AVX512VL
6630 (match_operand:VI48_AVX512VL 2 "vector_all_ones_operand")
6631 (match_operand:VI48_AVX512VL 3 "const0_operand")
6632 (match_operand:<avx512fmaskmode> 1 "register_operand" "k,Yk")))]
6635 vpmovm2<ssemodesuffix>\t{%1, %0|%0, %1}
6636 vpternlog<ssemodesuffix>\t{$0x81, %0, %0, %0%{%1%}%{z%}|%0%{%1%}%{z%}, %0, %0, 0x81}"
6637 [(set_attr "isa" "avx512dq,*")
6638 (set_attr "length_immediate" "0,1")
6639 (set_attr "prefix" "evex")
6640 (set_attr "mode" "<sseinsnmode>")])
6642 (define_insn "sse2_cvtps2pd<mask_name>"
6643 [(set (match_operand:V2DF 0 "register_operand" "=v")
6646 (match_operand:V4SF 1 "vector_operand" "vm")
6647 (parallel [(const_int 0) (const_int 1)]))))]
6648 "TARGET_SSE2 && <mask_avx512vl_condition>"
6649 "%vcvtps2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
6650 [(set_attr "type" "ssecvt")
6651 (set_attr "amdfam10_decode" "direct")
6652 (set_attr "athlon_decode" "double")
6653 (set_attr "bdver1_decode" "double")
6654 (set_attr "prefix_data16" "0")
6655 (set_attr "prefix" "maybe_vex")
6656 (set_attr "mode" "V2DF")])
6658 (define_insn "extendv2sfv2df2"
6659 [(set (match_operand:V2DF 0 "register_operand" "=v")
6661 (match_operand:V2SF 1 "register_operand" "v")))]
6662 "TARGET_MMX_WITH_SSE"
6663 "%vcvtps2pd\t{%1, %0|%0, %1}"
6664 [(set_attr "type" "ssecvt")
6665 (set_attr "amdfam10_decode" "direct")
6666 (set_attr "athlon_decode" "double")
6667 (set_attr "bdver1_decode" "double")
6668 (set_attr "prefix_data16" "0")
6669 (set_attr "prefix" "maybe_vex")
6670 (set_attr "mode" "V2DF")])
6672 (define_expand "vec_unpacks_hi_v4sf"
6677 (match_operand:V4SF 1 "vector_operand"))
6678 (parallel [(const_int 6) (const_int 7)
6679 (const_int 2) (const_int 3)])))
6680 (set (match_operand:V2DF 0 "register_operand")
6684 (parallel [(const_int 0) (const_int 1)]))))]
6686 "operands[2] = gen_reg_rtx (V4SFmode);")
6688 (define_expand "vec_unpacks_hi_v8sf"
6691 (match_operand:V8SF 1 "register_operand")
6692 (parallel [(const_int 4) (const_int 5)
6693 (const_int 6) (const_int 7)])))
6694 (set (match_operand:V4DF 0 "register_operand")
6698 "operands[2] = gen_reg_rtx (V4SFmode);")
6700 (define_expand "vec_unpacks_hi_v16sf"
6703 (match_operand:V16SF 1 "register_operand")
6704 (parallel [(const_int 8) (const_int 9)
6705 (const_int 10) (const_int 11)
6706 (const_int 12) (const_int 13)
6707 (const_int 14) (const_int 15)])))
6708 (set (match_operand:V8DF 0 "register_operand")
6712 "operands[2] = gen_reg_rtx (V8SFmode);")
6714 (define_expand "vec_unpacks_lo_v4sf"
6715 [(set (match_operand:V2DF 0 "register_operand")
6718 (match_operand:V4SF 1 "vector_operand")
6719 (parallel [(const_int 0) (const_int 1)]))))]
6722 (define_expand "vec_unpacks_lo_v8sf"
6723 [(set (match_operand:V4DF 0 "register_operand")
6726 (match_operand:V8SF 1 "nonimmediate_operand")
6727 (parallel [(const_int 0) (const_int 1)
6728 (const_int 2) (const_int 3)]))))]
6731 (define_mode_attr sseunpackfltmode
6732 [(V8HI "V4SF") (V4SI "V2DF") (V16HI "V8SF")
6733 (V8SI "V4DF") (V32HI "V16SF") (V16SI "V8DF")])
6735 (define_expand "vec_unpacks_float_hi_<mode>"
6736 [(match_operand:<sseunpackfltmode> 0 "register_operand")
6737 (match_operand:VI2_AVX512F 1 "register_operand")]
6740 rtx tmp = gen_reg_rtx (<sseunpackmode>mode);
6742 emit_insn (gen_vec_unpacks_hi_<mode> (tmp, operands[1]));
6743 emit_insn (gen_rtx_SET (operands[0],
6744 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
6748 (define_expand "vec_unpacks_float_lo_<mode>"
6749 [(match_operand:<sseunpackfltmode> 0 "register_operand")
6750 (match_operand:VI2_AVX512F 1 "register_operand")]
6753 rtx tmp = gen_reg_rtx (<sseunpackmode>mode);
6755 emit_insn (gen_vec_unpacks_lo_<mode> (tmp, operands[1]));
6756 emit_insn (gen_rtx_SET (operands[0],
6757 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
6761 (define_expand "vec_unpacku_float_hi_<mode>"
6762 [(match_operand:<sseunpackfltmode> 0 "register_operand")
6763 (match_operand:VI2_AVX512F 1 "register_operand")]
6766 rtx tmp = gen_reg_rtx (<sseunpackmode>mode);
6768 emit_insn (gen_vec_unpacku_hi_<mode> (tmp, operands[1]));
6769 emit_insn (gen_rtx_SET (operands[0],
6770 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
6774 (define_expand "vec_unpacku_float_lo_<mode>"
6775 [(match_operand:<sseunpackfltmode> 0 "register_operand")
6776 (match_operand:VI2_AVX512F 1 "register_operand")]
6779 rtx tmp = gen_reg_rtx (<sseunpackmode>mode);
6781 emit_insn (gen_vec_unpacku_lo_<mode> (tmp, operands[1]));
6782 emit_insn (gen_rtx_SET (operands[0],
6783 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
6787 (define_expand "vec_unpacks_float_hi_v4si"
6790 (match_operand:V4SI 1 "vector_operand")
6791 (parallel [(const_int 2) (const_int 3)
6792 (const_int 2) (const_int 3)])))
6793 (set (match_operand:V2DF 0 "register_operand")
6797 (parallel [(const_int 0) (const_int 1)]))))]
6799 "operands[2] = gen_reg_rtx (V4SImode);")
6801 (define_expand "vec_unpacks_float_lo_v4si"
6802 [(set (match_operand:V2DF 0 "register_operand")
6805 (match_operand:V4SI 1 "vector_operand")
6806 (parallel [(const_int 0) (const_int 1)]))))]
6809 (define_expand "vec_unpacks_float_hi_v8si"
6812 (match_operand:V8SI 1 "vector_operand")
6813 (parallel [(const_int 4) (const_int 5)
6814 (const_int 6) (const_int 7)])))
6815 (set (match_operand:V4DF 0 "register_operand")
6819 "operands[2] = gen_reg_rtx (V4SImode);")
6821 (define_expand "vec_unpacks_float_lo_v8si"
6822 [(set (match_operand:V4DF 0 "register_operand")
6825 (match_operand:V8SI 1 "nonimmediate_operand")
6826 (parallel [(const_int 0) (const_int 1)
6827 (const_int 2) (const_int 3)]))))]
6830 (define_expand "vec_unpacks_float_hi_v16si"
6833 (match_operand:V16SI 1 "nonimmediate_operand")
6834 (parallel [(const_int 8) (const_int 9)
6835 (const_int 10) (const_int 11)
6836 (const_int 12) (const_int 13)
6837 (const_int 14) (const_int 15)])))
6838 (set (match_operand:V8DF 0 "register_operand")
6842 "operands[2] = gen_reg_rtx (V8SImode);")
6844 (define_expand "vec_unpacks_float_lo_v16si"
6845 [(set (match_operand:V8DF 0 "register_operand")
6848 (match_operand:V16SI 1 "nonimmediate_operand")
6849 (parallel [(const_int 0) (const_int 1)
6850 (const_int 2) (const_int 3)
6851 (const_int 4) (const_int 5)
6852 (const_int 6) (const_int 7)]))))]
6855 (define_expand "vec_unpacku_float_hi_v4si"
6858 (match_operand:V4SI 1 "vector_operand")
6859 (parallel [(const_int 2) (const_int 3)
6860 (const_int 2) (const_int 3)])))
6865 (parallel [(const_int 0) (const_int 1)]))))
6867 (lt:V2DF (match_dup 6) (match_dup 3)))
6869 (and:V2DF (match_dup 7) (match_dup 4)))
6870 (set (match_operand:V2DF 0 "register_operand")
6871 (plus:V2DF (match_dup 6) (match_dup 8)))]
6874 REAL_VALUE_TYPE TWO32r;
6878 real_ldexp (&TWO32r, &dconst1, 32);
6879 x = const_double_from_real_value (TWO32r, DFmode);
6881 operands[3] = force_reg (V2DFmode, CONST0_RTX (V2DFmode));
6882 operands[4] = force_reg (V2DFmode,
6883 ix86_build_const_vector (V2DFmode, 1, x));
6885 operands[5] = gen_reg_rtx (V4SImode);
6887 for (i = 6; i < 9; i++)
6888 operands[i] = gen_reg_rtx (V2DFmode);
6891 (define_expand "vec_unpacku_float_lo_v4si"
6895 (match_operand:V4SI 1 "vector_operand")
6896 (parallel [(const_int 0) (const_int 1)]))))
6898 (lt:V2DF (match_dup 5) (match_dup 3)))
6900 (and:V2DF (match_dup 6) (match_dup 4)))
6901 (set (match_operand:V2DF 0 "register_operand")
6902 (plus:V2DF (match_dup 5) (match_dup 7)))]
6905 REAL_VALUE_TYPE TWO32r;
6909 real_ldexp (&TWO32r, &dconst1, 32);
6910 x = const_double_from_real_value (TWO32r, DFmode);
6912 operands[3] = force_reg (V2DFmode, CONST0_RTX (V2DFmode));
6913 operands[4] = force_reg (V2DFmode,
6914 ix86_build_const_vector (V2DFmode, 1, x));
6916 for (i = 5; i < 8; i++)
6917 operands[i] = gen_reg_rtx (V2DFmode);
6920 (define_expand "vec_unpacku_float_hi_v8si"
6921 [(match_operand:V4DF 0 "register_operand")
6922 (match_operand:V8SI 1 "register_operand")]
6925 REAL_VALUE_TYPE TWO32r;
6929 real_ldexp (&TWO32r, &dconst1, 32);
6930 x = const_double_from_real_value (TWO32r, DFmode);
6932 tmp[0] = force_reg (V4DFmode, CONST0_RTX (V4DFmode));
6933 tmp[1] = force_reg (V4DFmode, ix86_build_const_vector (V4DFmode, 1, x));
6934 tmp[5] = gen_reg_rtx (V4SImode);
6936 for (i = 2; i < 5; i++)
6937 tmp[i] = gen_reg_rtx (V4DFmode);
6938 emit_insn (gen_vec_extract_hi_v8si (tmp[5], operands[1]));
6939 emit_insn (gen_floatv4siv4df2 (tmp[2], tmp[5]));
6940 emit_insn (gen_rtx_SET (tmp[3], gen_rtx_LT (V4DFmode, tmp[2], tmp[0])));
6941 emit_insn (gen_andv4df3 (tmp[4], tmp[3], tmp[1]));
6942 emit_insn (gen_addv4df3 (operands[0], tmp[2], tmp[4]));
6946 (define_expand "vec_unpacku_float_hi_v16si"
6947 [(match_operand:V8DF 0 "register_operand")
6948 (match_operand:V16SI 1 "register_operand")]
6951 REAL_VALUE_TYPE TWO32r;
6954 real_ldexp (&TWO32r, &dconst1, 32);
6955 x = const_double_from_real_value (TWO32r, DFmode);
6957 tmp[0] = force_reg (V8DFmode, CONST0_RTX (V8DFmode));
6958 tmp[1] = force_reg (V8DFmode, ix86_build_const_vector (V8DFmode, 1, x));
6959 tmp[2] = gen_reg_rtx (V8DFmode);
6960 tmp[3] = gen_reg_rtx (V8SImode);
6961 k = gen_reg_rtx (QImode);
6963 emit_insn (gen_vec_extract_hi_v16si (tmp[3], operands[1]));
6964 emit_insn (gen_floatv8siv8df2 (tmp[2], tmp[3]));
6965 emit_insn (gen_rtx_SET (k, gen_rtx_LT (QImode, tmp[2], tmp[0])));
6966 emit_insn (gen_addv8df3_mask (tmp[2], tmp[2], tmp[1], tmp[2], k));
6967 emit_move_insn (operands[0], tmp[2]);
6971 (define_expand "vec_unpacku_float_lo_v8si"
6972 [(match_operand:V4DF 0 "register_operand")
6973 (match_operand:V8SI 1 "nonimmediate_operand")]
6976 REAL_VALUE_TYPE TWO32r;
6980 real_ldexp (&TWO32r, &dconst1, 32);
6981 x = const_double_from_real_value (TWO32r, DFmode);
6983 tmp[0] = force_reg (V4DFmode, CONST0_RTX (V4DFmode));
6984 tmp[1] = force_reg (V4DFmode, ix86_build_const_vector (V4DFmode, 1, x));
6986 for (i = 2; i < 5; i++)
6987 tmp[i] = gen_reg_rtx (V4DFmode);
6988 emit_insn (gen_avx_cvtdq2pd256_2 (tmp[2], operands[1]));
6989 emit_insn (gen_rtx_SET (tmp[3], gen_rtx_LT (V4DFmode, tmp[2], tmp[0])));
6990 emit_insn (gen_andv4df3 (tmp[4], tmp[3], tmp[1]));
6991 emit_insn (gen_addv4df3 (operands[0], tmp[2], tmp[4]));
6995 (define_expand "vec_unpacku_float_lo_v16si"
6996 [(match_operand:V8DF 0 "register_operand")
6997 (match_operand:V16SI 1 "nonimmediate_operand")]
7000 REAL_VALUE_TYPE TWO32r;
7003 real_ldexp (&TWO32r, &dconst1, 32);
7004 x = const_double_from_real_value (TWO32r, DFmode);
7006 tmp[0] = force_reg (V8DFmode, CONST0_RTX (V8DFmode));
7007 tmp[1] = force_reg (V8DFmode, ix86_build_const_vector (V8DFmode, 1, x));
7008 tmp[2] = gen_reg_rtx (V8DFmode);
7009 k = gen_reg_rtx (QImode);
7011 emit_insn (gen_avx512f_cvtdq2pd512_2 (tmp[2], operands[1]));
7012 emit_insn (gen_rtx_SET (k, gen_rtx_LT (QImode, tmp[2], tmp[0])));
7013 emit_insn (gen_addv8df3_mask (tmp[2], tmp[2], tmp[1], tmp[2], k));
7014 emit_move_insn (operands[0], tmp[2]);
7018 (define_expand "vec_pack_trunc_<mode>"
7020 (float_truncate:<sf2dfmode>
7021 (match_operand:VF2_512_256 1 "nonimmediate_operand")))
7023 (float_truncate:<sf2dfmode>
7024 (match_operand:VF2_512_256 2 "nonimmediate_operand")))
7025 (set (match_operand:<ssePSmode> 0 "register_operand")
7026 (vec_concat:<ssePSmode>
7031 operands[3] = gen_reg_rtx (<sf2dfmode>mode);
7032 operands[4] = gen_reg_rtx (<sf2dfmode>mode);
7035 (define_expand "vec_pack_trunc_v2df"
7036 [(match_operand:V4SF 0 "register_operand")
7037 (match_operand:V2DF 1 "vector_operand")
7038 (match_operand:V2DF 2 "vector_operand")]
7043 if (TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
7045 tmp0 = gen_reg_rtx (V4DFmode);
7046 tmp1 = force_reg (V2DFmode, operands[1]);
7048 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
7049 emit_insn (gen_avx_cvtpd2ps256 (operands[0], tmp0));
7053 tmp0 = gen_reg_rtx (V4SFmode);
7054 tmp1 = gen_reg_rtx (V4SFmode);
7056 emit_insn (gen_sse2_cvtpd2ps (tmp0, operands[1]));
7057 emit_insn (gen_sse2_cvtpd2ps (tmp1, operands[2]));
7058 emit_insn (gen_sse_movlhps (operands[0], tmp0, tmp1));
7063 (define_expand "vec_pack_sfix_trunc_v8df"
7064 [(match_operand:V16SI 0 "register_operand")
7065 (match_operand:V8DF 1 "nonimmediate_operand")
7066 (match_operand:V8DF 2 "nonimmediate_operand")]
7071 r1 = gen_reg_rtx (V8SImode);
7072 r2 = gen_reg_rtx (V8SImode);
7074 emit_insn (gen_fix_truncv8dfv8si2 (r1, operands[1]));
7075 emit_insn (gen_fix_truncv8dfv8si2 (r2, operands[2]));
7076 emit_insn (gen_avx_vec_concatv16si (operands[0], r1, r2));
7080 (define_expand "vec_pack_sfix_trunc_v4df"
7081 [(match_operand:V8SI 0 "register_operand")
7082 (match_operand:V4DF 1 "nonimmediate_operand")
7083 (match_operand:V4DF 2 "nonimmediate_operand")]
7088 r1 = gen_reg_rtx (V4SImode);
7089 r2 = gen_reg_rtx (V4SImode);
7091 emit_insn (gen_fix_truncv4dfv4si2 (r1, operands[1]));
7092 emit_insn (gen_fix_truncv4dfv4si2 (r2, operands[2]));
7093 emit_insn (gen_avx_vec_concatv8si (operands[0], r1, r2));
7097 (define_expand "vec_pack_sfix_trunc_v2df"
7098 [(match_operand:V4SI 0 "register_operand")
7099 (match_operand:V2DF 1 "vector_operand")
7100 (match_operand:V2DF 2 "vector_operand")]
7103 rtx tmp0, tmp1, tmp2;
7105 if (TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
7107 tmp0 = gen_reg_rtx (V4DFmode);
7108 tmp1 = force_reg (V2DFmode, operands[1]);
7110 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
7111 emit_insn (gen_fix_truncv4dfv4si2 (operands[0], tmp0));
7115 tmp0 = gen_reg_rtx (V4SImode);
7116 tmp1 = gen_reg_rtx (V4SImode);
7117 tmp2 = gen_reg_rtx (V2DImode);
7119 emit_insn (gen_sse2_cvttpd2dq (tmp0, operands[1]));
7120 emit_insn (gen_sse2_cvttpd2dq (tmp1, operands[2]));
7121 emit_insn (gen_vec_interleave_lowv2di (tmp2,
7122 gen_lowpart (V2DImode, tmp0),
7123 gen_lowpart (V2DImode, tmp1)));
7124 emit_move_insn (operands[0], gen_lowpart (V4SImode, tmp2));
7129 (define_mode_attr ssepackfltmode
7130 [(V8DF "V16SI") (V4DF "V8SI") (V2DF "V4SI")])
7132 (define_expand "vec_pack_ufix_trunc_<mode>"
7133 [(match_operand:<ssepackfltmode> 0 "register_operand")
7134 (match_operand:VF2 1 "register_operand")
7135 (match_operand:VF2 2 "register_operand")]
7138 if (<MODE>mode == V8DFmode)
7142 r1 = gen_reg_rtx (V8SImode);
7143 r2 = gen_reg_rtx (V8SImode);
7145 emit_insn (gen_fixuns_truncv8dfv8si2 (r1, operands[1]));
7146 emit_insn (gen_fixuns_truncv8dfv8si2 (r2, operands[2]));
7147 emit_insn (gen_avx_vec_concatv16si (operands[0], r1, r2));
7152 tmp[0] = ix86_expand_adjust_ufix_to_sfix_si (operands[1], &tmp[2]);
7153 tmp[1] = ix86_expand_adjust_ufix_to_sfix_si (operands[2], &tmp[3]);
7154 tmp[4] = gen_reg_rtx (<ssepackfltmode>mode);
7155 emit_insn (gen_vec_pack_sfix_trunc_<mode> (tmp[4], tmp[0], tmp[1]));
7156 if (<ssepackfltmode>mode == V4SImode || TARGET_AVX2)
7158 tmp[5] = gen_reg_rtx (<ssepackfltmode>mode);
7159 ix86_expand_vec_extract_even_odd (tmp[5], tmp[2], tmp[3], 0);
7163 tmp[5] = gen_reg_rtx (V8SFmode);
7164 ix86_expand_vec_extract_even_odd (tmp[5],
7165 gen_lowpart (V8SFmode, tmp[2]),
7166 gen_lowpart (V8SFmode, tmp[3]), 0);
7167 tmp[5] = gen_lowpart (V8SImode, tmp[5]);
7169 tmp[6] = expand_simple_binop (<ssepackfltmode>mode, XOR, tmp[4], tmp[5],
7170 operands[0], 0, OPTAB_DIRECT);
7171 if (tmp[6] != operands[0])
7172 emit_move_insn (operands[0], tmp[6]);
7178 (define_expand "avx512f_vec_pack_sfix_v8df"
7179 [(match_operand:V16SI 0 "register_operand")
7180 (match_operand:V8DF 1 "nonimmediate_operand")
7181 (match_operand:V8DF 2 "nonimmediate_operand")]
7186 r1 = gen_reg_rtx (V8SImode);
7187 r2 = gen_reg_rtx (V8SImode);
7189 emit_insn (gen_avx512f_cvtpd2dq512 (r1, operands[1]));
7190 emit_insn (gen_avx512f_cvtpd2dq512 (r2, operands[2]));
7191 emit_insn (gen_avx_vec_concatv16si (operands[0], r1, r2));
7195 (define_expand "vec_pack_sfix_v4df"
7196 [(match_operand:V8SI 0 "register_operand")
7197 (match_operand:V4DF 1 "nonimmediate_operand")
7198 (match_operand:V4DF 2 "nonimmediate_operand")]
7203 r1 = gen_reg_rtx (V4SImode);
7204 r2 = gen_reg_rtx (V4SImode);
7206 emit_insn (gen_avx_cvtpd2dq256 (r1, operands[1]));
7207 emit_insn (gen_avx_cvtpd2dq256 (r2, operands[2]));
7208 emit_insn (gen_avx_vec_concatv8si (operands[0], r1, r2));
7212 (define_expand "vec_pack_sfix_v2df"
7213 [(match_operand:V4SI 0 "register_operand")
7214 (match_operand:V2DF 1 "vector_operand")
7215 (match_operand:V2DF 2 "vector_operand")]
7218 rtx tmp0, tmp1, tmp2;
7220 if (TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
7222 tmp0 = gen_reg_rtx (V4DFmode);
7223 tmp1 = force_reg (V2DFmode, operands[1]);
7225 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
7226 emit_insn (gen_avx_cvtpd2dq256 (operands[0], tmp0));
7230 tmp0 = gen_reg_rtx (V4SImode);
7231 tmp1 = gen_reg_rtx (V4SImode);
7232 tmp2 = gen_reg_rtx (V2DImode);
7234 emit_insn (gen_sse2_cvtpd2dq (tmp0, operands[1]));
7235 emit_insn (gen_sse2_cvtpd2dq (tmp1, operands[2]));
7236 emit_insn (gen_vec_interleave_lowv2di (tmp2,
7237 gen_lowpart (V2DImode, tmp0),
7238 gen_lowpart (V2DImode, tmp1)));
7239 emit_move_insn (operands[0], gen_lowpart (V4SImode, tmp2));
7244 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7246 ;; Parallel single-precision floating point element swizzling
7248 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7250 (define_expand "sse_movhlps_exp"
7251 [(set (match_operand:V4SF 0 "nonimmediate_operand")
7254 (match_operand:V4SF 1 "nonimmediate_operand")
7255 (match_operand:V4SF 2 "nonimmediate_operand"))
7256 (parallel [(const_int 6)
7262 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
7264 emit_insn (gen_sse_movhlps (dst, operands[1], operands[2]));
7266 /* Fix up the destination if needed. */
7267 if (dst != operands[0])
7268 emit_move_insn (operands[0], dst);
7273 (define_insn "sse_movhlps"
7274 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,v,x,v,m")
7277 (match_operand:V4SF 1 "nonimmediate_operand" " 0,v,0,v,0")
7278 (match_operand:V4SF 2 "nonimmediate_operand" " x,v,o,o,v"))
7279 (parallel [(const_int 6)
7283 "TARGET_SSE && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
7285 movhlps\t{%2, %0|%0, %2}
7286 vmovhlps\t{%2, %1, %0|%0, %1, %2}
7287 movlps\t{%H2, %0|%0, %H2}
7288 vmovlps\t{%H2, %1, %0|%0, %1, %H2}
7289 %vmovhps\t{%2, %0|%q0, %2}"
7290 [(set_attr "isa" "noavx,avx,noavx,avx,*")
7291 (set_attr "type" "ssemov")
7292 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,maybe_vex")
7293 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF,V2SF")])
7295 (define_expand "sse_movlhps_exp"
7296 [(set (match_operand:V4SF 0 "nonimmediate_operand")
7299 (match_operand:V4SF 1 "nonimmediate_operand")
7300 (match_operand:V4SF 2 "nonimmediate_operand"))
7301 (parallel [(const_int 0)
7307 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
7309 emit_insn (gen_sse_movlhps (dst, operands[1], operands[2]));
7311 /* Fix up the destination if needed. */
7312 if (dst != operands[0])
7313 emit_move_insn (operands[0], dst);
7318 (define_insn "sse_movlhps"
7319 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,v,x,v,o")
7322 (match_operand:V4SF 1 "nonimmediate_operand" " 0,v,0,v,0")
7323 (match_operand:V4SF 2 "nonimmediate_operand" " x,v,m,v,v"))
7324 (parallel [(const_int 0)
7328 "TARGET_SSE && ix86_binary_operator_ok (UNKNOWN, V4SFmode, operands)"
7330 movlhps\t{%2, %0|%0, %2}
7331 vmovlhps\t{%2, %1, %0|%0, %1, %2}
7332 movhps\t{%2, %0|%0, %q2}
7333 vmovhps\t{%2, %1, %0|%0, %1, %q2}
7334 %vmovlps\t{%2, %H0|%H0, %2}"
7335 [(set_attr "isa" "noavx,avx,noavx,avx,*")
7336 (set_attr "type" "ssemov")
7337 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,maybe_vex")
7338 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF,V2SF")])
7340 (define_insn "<mask_codefor>avx512f_unpckhps512<mask_name>"
7341 [(set (match_operand:V16SF 0 "register_operand" "=v")
7344 (match_operand:V16SF 1 "register_operand" "v")
7345 (match_operand:V16SF 2 "nonimmediate_operand" "vm"))
7346 (parallel [(const_int 2) (const_int 18)
7347 (const_int 3) (const_int 19)
7348 (const_int 6) (const_int 22)
7349 (const_int 7) (const_int 23)
7350 (const_int 10) (const_int 26)
7351 (const_int 11) (const_int 27)
7352 (const_int 14) (const_int 30)
7353 (const_int 15) (const_int 31)])))]
7355 "vunpckhps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
7356 [(set_attr "type" "sselog")
7357 (set_attr "prefix" "evex")
7358 (set_attr "mode" "V16SF")])
7360 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
7361 (define_insn "avx_unpckhps256<mask_name>"
7362 [(set (match_operand:V8SF 0 "register_operand" "=v")
7365 (match_operand:V8SF 1 "register_operand" "v")
7366 (match_operand:V8SF 2 "nonimmediate_operand" "vm"))
7367 (parallel [(const_int 2) (const_int 10)
7368 (const_int 3) (const_int 11)
7369 (const_int 6) (const_int 14)
7370 (const_int 7) (const_int 15)])))]
7371 "TARGET_AVX && <mask_avx512vl_condition>"
7372 "vunpckhps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
7373 [(set_attr "type" "sselog")
7374 (set_attr "prefix" "vex")
7375 (set_attr "mode" "V8SF")])
7377 (define_expand "vec_interleave_highv8sf"
7381 (match_operand:V8SF 1 "register_operand")
7382 (match_operand:V8SF 2 "nonimmediate_operand"))
7383 (parallel [(const_int 0) (const_int 8)
7384 (const_int 1) (const_int 9)
7385 (const_int 4) (const_int 12)
7386 (const_int 5) (const_int 13)])))
7392 (parallel [(const_int 2) (const_int 10)
7393 (const_int 3) (const_int 11)
7394 (const_int 6) (const_int 14)
7395 (const_int 7) (const_int 15)])))
7396 (set (match_operand:V8SF 0 "register_operand")
7401 (parallel [(const_int 4) (const_int 5)
7402 (const_int 6) (const_int 7)
7403 (const_int 12) (const_int 13)
7404 (const_int 14) (const_int 15)])))]
7407 operands[3] = gen_reg_rtx (V8SFmode);
7408 operands[4] = gen_reg_rtx (V8SFmode);
7411 (define_insn "vec_interleave_highv4sf<mask_name>"
7412 [(set (match_operand:V4SF 0 "register_operand" "=x,v")
7415 (match_operand:V4SF 1 "register_operand" "0,v")
7416 (match_operand:V4SF 2 "vector_operand" "xBm,vm"))
7417 (parallel [(const_int 2) (const_int 6)
7418 (const_int 3) (const_int 7)])))]
7419 "TARGET_SSE && <mask_avx512vl_condition>"
7421 unpckhps\t{%2, %0|%0, %2}
7422 vunpckhps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
7423 [(set_attr "isa" "noavx,avx")
7424 (set_attr "type" "sselog")
7425 (set_attr "prefix" "orig,vex")
7426 (set_attr "mode" "V4SF")])
7428 (define_insn "<mask_codefor>avx512f_unpcklps512<mask_name>"
7429 [(set (match_operand:V16SF 0 "register_operand" "=v")
7432 (match_operand:V16SF 1 "register_operand" "v")
7433 (match_operand:V16SF 2 "nonimmediate_operand" "vm"))
7434 (parallel [(const_int 0) (const_int 16)
7435 (const_int 1) (const_int 17)
7436 (const_int 4) (const_int 20)
7437 (const_int 5) (const_int 21)
7438 (const_int 8) (const_int 24)
7439 (const_int 9) (const_int 25)
7440 (const_int 12) (const_int 28)
7441 (const_int 13) (const_int 29)])))]
7443 "vunpcklps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
7444 [(set_attr "type" "sselog")
7445 (set_attr "prefix" "evex")
7446 (set_attr "mode" "V16SF")])
7448 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
7449 (define_insn "avx_unpcklps256<mask_name>"
7450 [(set (match_operand:V8SF 0 "register_operand" "=v")
7453 (match_operand:V8SF 1 "register_operand" "v")
7454 (match_operand:V8SF 2 "nonimmediate_operand" "vm"))
7455 (parallel [(const_int 0) (const_int 8)
7456 (const_int 1) (const_int 9)
7457 (const_int 4) (const_int 12)
7458 (const_int 5) (const_int 13)])))]
7459 "TARGET_AVX && <mask_avx512vl_condition>"
7460 "vunpcklps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
7461 [(set_attr "type" "sselog")
7462 (set_attr "prefix" "vex")
7463 (set_attr "mode" "V8SF")])
7465 (define_insn "unpcklps128_mask"
7466 [(set (match_operand:V4SF 0 "register_operand" "=v")
7470 (match_operand:V4SF 1 "register_operand" "v")
7471 (match_operand:V4SF 2 "nonimmediate_operand" "vm"))
7472 (parallel [(const_int 0) (const_int 4)
7473 (const_int 1) (const_int 5)]))
7474 (match_operand:V4SF 3 "nonimm_or_0_operand" "0C")
7475 (match_operand:QI 4 "register_operand" "Yk")))]
7477 "vunpcklps\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
7478 [(set_attr "type" "sselog")
7479 (set_attr "prefix" "evex")
7480 (set_attr "mode" "V4SF")])
7482 (define_expand "vec_interleave_lowv8sf"
7486 (match_operand:V8SF 1 "register_operand")
7487 (match_operand:V8SF 2 "nonimmediate_operand"))
7488 (parallel [(const_int 0) (const_int 8)
7489 (const_int 1) (const_int 9)
7490 (const_int 4) (const_int 12)
7491 (const_int 5) (const_int 13)])))
7497 (parallel [(const_int 2) (const_int 10)
7498 (const_int 3) (const_int 11)
7499 (const_int 6) (const_int 14)
7500 (const_int 7) (const_int 15)])))
7501 (set (match_operand:V8SF 0 "register_operand")
7506 (parallel [(const_int 0) (const_int 1)
7507 (const_int 2) (const_int 3)
7508 (const_int 8) (const_int 9)
7509 (const_int 10) (const_int 11)])))]
7512 operands[3] = gen_reg_rtx (V8SFmode);
7513 operands[4] = gen_reg_rtx (V8SFmode);
7516 (define_insn "vec_interleave_lowv4sf"
7517 [(set (match_operand:V4SF 0 "register_operand" "=x,v")
7520 (match_operand:V4SF 1 "register_operand" "0,v")
7521 (match_operand:V4SF 2 "vector_operand" "xBm,vm"))
7522 (parallel [(const_int 0) (const_int 4)
7523 (const_int 1) (const_int 5)])))]
7526 unpcklps\t{%2, %0|%0, %2}
7527 vunpcklps\t{%2, %1, %0|%0, %1, %2}"
7528 [(set_attr "isa" "noavx,avx")
7529 (set_attr "type" "sselog")
7530 (set_attr "prefix" "orig,maybe_evex")
7531 (set_attr "mode" "V4SF")])
7533 ;; These are modeled with the same vec_concat as the others so that we
7534 ;; capture users of shufps that can use the new instructions
7535 (define_insn "avx_movshdup256<mask_name>"
7536 [(set (match_operand:V8SF 0 "register_operand" "=v")
7539 (match_operand:V8SF 1 "nonimmediate_operand" "vm")
7541 (parallel [(const_int 1) (const_int 1)
7542 (const_int 3) (const_int 3)
7543 (const_int 5) (const_int 5)
7544 (const_int 7) (const_int 7)])))]
7545 "TARGET_AVX && <mask_avx512vl_condition>"
7546 "vmovshdup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
7547 [(set_attr "type" "sse")
7548 (set_attr "prefix" "vex")
7549 (set_attr "mode" "V8SF")])
7551 (define_insn "sse3_movshdup<mask_name>"
7552 [(set (match_operand:V4SF 0 "register_operand" "=v")
7555 (match_operand:V4SF 1 "vector_operand" "vBm")
7557 (parallel [(const_int 1)
7561 "TARGET_SSE3 && <mask_avx512vl_condition>"
7562 "%vmovshdup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
7563 [(set_attr "type" "sse")
7564 (set_attr "prefix_rep" "1")
7565 (set_attr "prefix" "maybe_vex")
7566 (set_attr "mode" "V4SF")])
7568 (define_insn "<mask_codefor>avx512f_movshdup512<mask_name>"
7569 [(set (match_operand:V16SF 0 "register_operand" "=v")
7572 (match_operand:V16SF 1 "nonimmediate_operand" "vm")
7574 (parallel [(const_int 1) (const_int 1)
7575 (const_int 3) (const_int 3)
7576 (const_int 5) (const_int 5)
7577 (const_int 7) (const_int 7)
7578 (const_int 9) (const_int 9)
7579 (const_int 11) (const_int 11)
7580 (const_int 13) (const_int 13)
7581 (const_int 15) (const_int 15)])))]
7583 "vmovshdup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
7584 [(set_attr "type" "sse")
7585 (set_attr "prefix" "evex")
7586 (set_attr "mode" "V16SF")])
7588 (define_insn "avx_movsldup256<mask_name>"
7589 [(set (match_operand:V8SF 0 "register_operand" "=v")
7592 (match_operand:V8SF 1 "nonimmediate_operand" "vm")
7594 (parallel [(const_int 0) (const_int 0)
7595 (const_int 2) (const_int 2)
7596 (const_int 4) (const_int 4)
7597 (const_int 6) (const_int 6)])))]
7598 "TARGET_AVX && <mask_avx512vl_condition>"
7599 "vmovsldup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
7600 [(set_attr "type" "sse")
7601 (set_attr "prefix" "vex")
7602 (set_attr "mode" "V8SF")])
7604 (define_insn "sse3_movsldup<mask_name>"
7605 [(set (match_operand:V4SF 0 "register_operand" "=v")
7608 (match_operand:V4SF 1 "vector_operand" "vBm")
7610 (parallel [(const_int 0)
7614 "TARGET_SSE3 && <mask_avx512vl_condition>"
7615 "%vmovsldup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
7616 [(set_attr "type" "sse")
7617 (set_attr "prefix_rep" "1")
7618 (set_attr "prefix" "maybe_vex")
7619 (set_attr "mode" "V4SF")])
7621 (define_insn "<mask_codefor>avx512f_movsldup512<mask_name>"
7622 [(set (match_operand:V16SF 0 "register_operand" "=v")
7625 (match_operand:V16SF 1 "nonimmediate_operand" "vm")
7627 (parallel [(const_int 0) (const_int 0)
7628 (const_int 2) (const_int 2)
7629 (const_int 4) (const_int 4)
7630 (const_int 6) (const_int 6)
7631 (const_int 8) (const_int 8)
7632 (const_int 10) (const_int 10)
7633 (const_int 12) (const_int 12)
7634 (const_int 14) (const_int 14)])))]
7636 "vmovsldup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
7637 [(set_attr "type" "sse")
7638 (set_attr "prefix" "evex")
7639 (set_attr "mode" "V16SF")])
7641 (define_expand "avx_shufps256<mask_expand4_name>"
7642 [(match_operand:V8SF 0 "register_operand")
7643 (match_operand:V8SF 1 "register_operand")
7644 (match_operand:V8SF 2 "nonimmediate_operand")
7645 (match_operand:SI 3 "const_int_operand")]
7648 int mask = INTVAL (operands[3]);
7649 emit_insn (gen_avx_shufps256_1<mask_expand4_name> (operands[0],
7652 GEN_INT ((mask >> 0) & 3),
7653 GEN_INT ((mask >> 2) & 3),
7654 GEN_INT (((mask >> 4) & 3) + 8),
7655 GEN_INT (((mask >> 6) & 3) + 8),
7656 GEN_INT (((mask >> 0) & 3) + 4),
7657 GEN_INT (((mask >> 2) & 3) + 4),
7658 GEN_INT (((mask >> 4) & 3) + 12),
7659 GEN_INT (((mask >> 6) & 3) + 12)
7660 <mask_expand4_args>));
7664 ;; One bit in mask selects 2 elements.
7665 (define_insn "avx_shufps256_1<mask_name>"
7666 [(set (match_operand:V8SF 0 "register_operand" "=v")
7669 (match_operand:V8SF 1 "register_operand" "v")
7670 (match_operand:V8SF 2 "nonimmediate_operand" "vm"))
7671 (parallel [(match_operand 3 "const_0_to_3_operand" )
7672 (match_operand 4 "const_0_to_3_operand" )
7673 (match_operand 5 "const_8_to_11_operand" )
7674 (match_operand 6 "const_8_to_11_operand" )
7675 (match_operand 7 "const_4_to_7_operand" )
7676 (match_operand 8 "const_4_to_7_operand" )
7677 (match_operand 9 "const_12_to_15_operand")
7678 (match_operand 10 "const_12_to_15_operand")])))]
7680 && <mask_avx512vl_condition>
7681 && (INTVAL (operands[3]) == (INTVAL (operands[7]) - 4)
7682 && INTVAL (operands[4]) == (INTVAL (operands[8]) - 4)
7683 && INTVAL (operands[5]) == (INTVAL (operands[9]) - 4)
7684 && INTVAL (operands[6]) == (INTVAL (operands[10]) - 4))"
7687 mask = INTVAL (operands[3]);
7688 mask |= INTVAL (operands[4]) << 2;
7689 mask |= (INTVAL (operands[5]) - 8) << 4;
7690 mask |= (INTVAL (operands[6]) - 8) << 6;
7691 operands[3] = GEN_INT (mask);
7693 return "vshufps\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
7695 [(set_attr "type" "sseshuf")
7696 (set_attr "length_immediate" "1")
7697 (set_attr "prefix" "<mask_prefix>")
7698 (set_attr "mode" "V8SF")])
7700 (define_expand "sse_shufps<mask_expand4_name>"
7701 [(match_operand:V4SF 0 "register_operand")
7702 (match_operand:V4SF 1 "register_operand")
7703 (match_operand:V4SF 2 "vector_operand")
7704 (match_operand:SI 3 "const_int_operand")]
7707 int mask = INTVAL (operands[3]);
7708 emit_insn (gen_sse_shufps_v4sf<mask_expand4_name> (operands[0],
7711 GEN_INT ((mask >> 0) & 3),
7712 GEN_INT ((mask >> 2) & 3),
7713 GEN_INT (((mask >> 4) & 3) + 4),
7714 GEN_INT (((mask >> 6) & 3) + 4)
7715 <mask_expand4_args>));
7719 (define_insn "sse_shufps_v4sf_mask"
7720 [(set (match_operand:V4SF 0 "register_operand" "=v")
7724 (match_operand:V4SF 1 "register_operand" "v")
7725 (match_operand:V4SF 2 "nonimmediate_operand" "vm"))
7726 (parallel [(match_operand 3 "const_0_to_3_operand")
7727 (match_operand 4 "const_0_to_3_operand")
7728 (match_operand 5 "const_4_to_7_operand")
7729 (match_operand 6 "const_4_to_7_operand")]))
7730 (match_operand:V4SF 7 "nonimm_or_0_operand" "0C")
7731 (match_operand:QI 8 "register_operand" "Yk")))]
7735 mask |= INTVAL (operands[3]) << 0;
7736 mask |= INTVAL (operands[4]) << 2;
7737 mask |= (INTVAL (operands[5]) - 4) << 4;
7738 mask |= (INTVAL (operands[6]) - 4) << 6;
7739 operands[3] = GEN_INT (mask);
7741 return "vshufps\t{%3, %2, %1, %0%{%8%}%N7|%0%{%8%}%N7, %1, %2, %3}";
7743 [(set_attr "type" "sseshuf")
7744 (set_attr "length_immediate" "1")
7745 (set_attr "prefix" "evex")
7746 (set_attr "mode" "V4SF")])
7748 (define_insn "sse_shufps_<mode>"
7749 [(set (match_operand:VI4F_128 0 "register_operand" "=x,v")
7750 (vec_select:VI4F_128
7751 (vec_concat:<ssedoublevecmode>
7752 (match_operand:VI4F_128 1 "register_operand" "0,v")
7753 (match_operand:VI4F_128 2 "vector_operand" "xBm,vm"))
7754 (parallel [(match_operand 3 "const_0_to_3_operand")
7755 (match_operand 4 "const_0_to_3_operand")
7756 (match_operand 5 "const_4_to_7_operand")
7757 (match_operand 6 "const_4_to_7_operand")])))]
7761 mask |= INTVAL (operands[3]) << 0;
7762 mask |= INTVAL (operands[4]) << 2;
7763 mask |= (INTVAL (operands[5]) - 4) << 4;
7764 mask |= (INTVAL (operands[6]) - 4) << 6;
7765 operands[3] = GEN_INT (mask);
7767 switch (which_alternative)
7770 return "shufps\t{%3, %2, %0|%0, %2, %3}";
7772 return "vshufps\t{%3, %2, %1, %0|%0, %1, %2, %3}";
7777 [(set_attr "isa" "noavx,avx")
7778 (set_attr "type" "sseshuf")
7779 (set_attr "length_immediate" "1")
7780 (set_attr "prefix" "orig,maybe_evex")
7781 (set_attr "mode" "V4SF")])
7783 (define_insn "sse_storehps"
7784 [(set (match_operand:V2SF 0 "nonimmediate_operand" "=m,v,v")
7786 (match_operand:V4SF 1 "nonimmediate_operand" "v,v,o")
7787 (parallel [(const_int 2) (const_int 3)])))]
7788 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7790 %vmovhps\t{%1, %0|%q0, %1}
7791 %vmovhlps\t{%1, %d0|%d0, %1}
7792 %vmovlps\t{%H1, %d0|%d0, %H1}"
7793 [(set_attr "type" "ssemov")
7794 (set_attr "prefix" "maybe_vex")
7795 (set_attr "mode" "V2SF,V4SF,V2SF")])
7797 (define_expand "sse_loadhps_exp"
7798 [(set (match_operand:V4SF 0 "nonimmediate_operand")
7801 (match_operand:V4SF 1 "nonimmediate_operand")
7802 (parallel [(const_int 0) (const_int 1)]))
7803 (match_operand:V2SF 2 "nonimmediate_operand")))]
7806 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
7808 emit_insn (gen_sse_loadhps (dst, operands[1], operands[2]));
7810 /* Fix up the destination if needed. */
7811 if (dst != operands[0])
7812 emit_move_insn (operands[0], dst);
7817 (define_insn "sse_loadhps"
7818 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,v,x,v,o")
7821 (match_operand:V4SF 1 "nonimmediate_operand" " 0,v,0,v,0")
7822 (parallel [(const_int 0) (const_int 1)]))
7823 (match_operand:V2SF 2 "nonimmediate_operand" " m,m,x,v,v")))]
7826 movhps\t{%2, %0|%0, %q2}
7827 vmovhps\t{%2, %1, %0|%0, %1, %q2}
7828 movlhps\t{%2, %0|%0, %2}
7829 vmovlhps\t{%2, %1, %0|%0, %1, %2}
7830 %vmovlps\t{%2, %H0|%H0, %2}"
7831 [(set_attr "isa" "noavx,avx,noavx,avx,*")
7832 (set_attr "type" "ssemov")
7833 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,maybe_vex")
7834 (set_attr "mode" "V2SF,V2SF,V4SF,V4SF,V2SF")])
7836 (define_insn "sse_storelps"
7837 [(set (match_operand:V2SF 0 "nonimmediate_operand" "=m,v,v")
7839 (match_operand:V4SF 1 "nonimmediate_operand" " v,v,m")
7840 (parallel [(const_int 0) (const_int 1)])))]
7841 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7843 %vmovlps\t{%1, %0|%q0, %1}
7844 %vmovaps\t{%1, %0|%0, %1}
7845 %vmovlps\t{%1, %d0|%d0, %q1}"
7846 [(set_attr "type" "ssemov")
7847 (set_attr "prefix" "maybe_vex")
7848 (set_attr "mode" "V2SF,V4SF,V2SF")])
7850 (define_expand "sse_loadlps_exp"
7851 [(set (match_operand:V4SF 0 "nonimmediate_operand")
7853 (match_operand:V2SF 2 "nonimmediate_operand")
7855 (match_operand:V4SF 1 "nonimmediate_operand")
7856 (parallel [(const_int 2) (const_int 3)]))))]
7859 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
7861 emit_insn (gen_sse_loadlps (dst, operands[1], operands[2]));
7863 /* Fix up the destination if needed. */
7864 if (dst != operands[0])
7865 emit_move_insn (operands[0], dst);
7870 (define_insn "sse_loadlps"
7871 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,v,x,v,m")
7873 (match_operand:V2SF 2 "nonimmediate_operand" " 0,v,m,m,v")
7875 (match_operand:V4SF 1 "nonimmediate_operand" " x,v,0,v,0")
7876 (parallel [(const_int 2) (const_int 3)]))))]
7879 shufps\t{$0xe4, %1, %0|%0, %1, 0xe4}
7880 vshufps\t{$0xe4, %1, %2, %0|%0, %2, %1, 0xe4}
7881 movlps\t{%2, %0|%0, %q2}
7882 vmovlps\t{%2, %1, %0|%0, %1, %q2}
7883 %vmovlps\t{%2, %0|%q0, %2}"
7884 [(set_attr "isa" "noavx,avx,noavx,avx,*")
7885 (set_attr "type" "sseshuf,sseshuf,ssemov,ssemov,ssemov")
7886 (set (attr "length_immediate")
7887 (if_then_else (eq_attr "alternative" "0,1")
7889 (const_string "*")))
7890 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,maybe_vex")
7891 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF,V2SF")])
7893 (define_insn "sse_movss"
7894 [(set (match_operand:V4SF 0 "register_operand" "=x,v")
7896 (match_operand:V4SF 2 "register_operand" " x,v")
7897 (match_operand:V4SF 1 "register_operand" " 0,v")
7901 movss\t{%2, %0|%0, %2}
7902 vmovss\t{%2, %1, %0|%0, %1, %2}"
7903 [(set_attr "isa" "noavx,avx")
7904 (set_attr "type" "ssemov")
7905 (set_attr "prefix" "orig,maybe_evex")
7906 (set_attr "mode" "SF")])
7908 (define_insn "avx2_vec_dup<mode>"
7909 [(set (match_operand:VF1_128_256 0 "register_operand" "=v")
7910 (vec_duplicate:VF1_128_256
7912 (match_operand:V4SF 1 "register_operand" "v")
7913 (parallel [(const_int 0)]))))]
7915 "vbroadcastss\t{%1, %0|%0, %1}"
7916 [(set_attr "type" "sselog1")
7917 (set_attr "prefix" "maybe_evex")
7918 (set_attr "mode" "<MODE>")])
7920 (define_insn "avx2_vec_dupv8sf_1"
7921 [(set (match_operand:V8SF 0 "register_operand" "=v")
7924 (match_operand:V8SF 1 "register_operand" "v")
7925 (parallel [(const_int 0)]))))]
7927 "vbroadcastss\t{%x1, %0|%0, %x1}"
7928 [(set_attr "type" "sselog1")
7929 (set_attr "prefix" "maybe_evex")
7930 (set_attr "mode" "V8SF")])
7932 (define_insn "avx512f_vec_dup<mode>_1"
7933 [(set (match_operand:VF_512 0 "register_operand" "=v")
7934 (vec_duplicate:VF_512
7935 (vec_select:<ssescalarmode>
7936 (match_operand:VF_512 1 "register_operand" "v")
7937 (parallel [(const_int 0)]))))]
7939 "vbroadcast<bcstscalarsuff>\t{%x1, %0|%0, %x1}"
7940 [(set_attr "type" "sselog1")
7941 (set_attr "prefix" "evex")
7942 (set_attr "mode" "<MODE>")])
7944 ;; Although insertps takes register source, we prefer
7945 ;; unpcklps with register source since it is shorter.
7946 (define_insn "*vec_concatv2sf_sse4_1"
7947 [(set (match_operand:V2SF 0 "register_operand"
7948 "=Yr,*x, v,Yr,*x,v,v,*y ,*y")
7950 (match_operand:SF 1 "nonimmediate_operand"
7951 " 0, 0,Yv, 0,0, v,m, 0 , m")
7952 (match_operand:SF 2 "nonimm_or_0_operand"
7953 " Yr,*x,Yv, m,m, m,C,*ym, C")))]
7954 "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
7956 unpcklps\t{%2, %0|%0, %2}
7957 unpcklps\t{%2, %0|%0, %2}
7958 vunpcklps\t{%2, %1, %0|%0, %1, %2}
7959 insertps\t{$0x10, %2, %0|%0, %2, 0x10}
7960 insertps\t{$0x10, %2, %0|%0, %2, 0x10}
7961 vinsertps\t{$0x10, %2, %1, %0|%0, %1, %2, 0x10}
7962 %vmovss\t{%1, %0|%0, %1}
7963 punpckldq\t{%2, %0|%0, %2}
7964 movd\t{%1, %0|%0, %1}"
7966 (cond [(eq_attr "alternative" "0,1,3,4")
7967 (const_string "noavx")
7968 (eq_attr "alternative" "2,5")
7969 (const_string "avx")
7971 (const_string "*")))
7973 (cond [(eq_attr "alternative" "6")
7974 (const_string "ssemov")
7975 (eq_attr "alternative" "7")
7976 (const_string "mmxcvt")
7977 (eq_attr "alternative" "8")
7978 (const_string "mmxmov")
7980 (const_string "sselog")))
7981 (set (attr "mmx_isa")
7982 (if_then_else (eq_attr "alternative" "7,8")
7983 (const_string "native")
7984 (const_string "*")))
7985 (set (attr "prefix_data16")
7986 (if_then_else (eq_attr "alternative" "3,4")
7988 (const_string "*")))
7989 (set (attr "prefix_extra")
7990 (if_then_else (eq_attr "alternative" "3,4,5")
7992 (const_string "*")))
7993 (set (attr "length_immediate")
7994 (if_then_else (eq_attr "alternative" "3,4,5")
7996 (const_string "*")))
7997 (set (attr "prefix")
7998 (cond [(eq_attr "alternative" "2,5")
7999 (const_string "maybe_evex")
8000 (eq_attr "alternative" "6")
8001 (const_string "maybe_vex")
8003 (const_string "orig")))
8004 (set_attr "mode" "V4SF,V4SF,V4SF,V4SF,V4SF,V4SF,SF,DI,DI")])
8006 ;; ??? In theory we can match memory for the MMX alternative, but allowing
8007 ;; vector_operand for operand 2 and *not* allowing memory for the SSE
8008 ;; alternatives pretty much forces the MMX alternative to be chosen.
8009 (define_insn "*vec_concatv2sf_sse"
8010 [(set (match_operand:V2SF 0 "register_operand" "=x,x,*y,*y")
8012 (match_operand:SF 1 "nonimmediate_operand" " 0,m, 0, m")
8013 (match_operand:SF 2 "reg_or_0_operand" " x,C,*y, C")))]
8016 unpcklps\t{%2, %0|%0, %2}
8017 movss\t{%1, %0|%0, %1}
8018 punpckldq\t{%2, %0|%0, %2}
8019 movd\t{%1, %0|%0, %1}"
8020 [(set_attr "mmx_isa" "*,*,native,native")
8021 (set_attr "type" "sselog,ssemov,mmxcvt,mmxmov")
8022 (set_attr "mode" "V4SF,SF,DI,DI")])
8024 (define_insn "*vec_concatv4sf"
8025 [(set (match_operand:V4SF 0 "register_operand" "=x,v,x,v")
8027 (match_operand:V2SF 1 "register_operand" " 0,v,0,v")
8028 (match_operand:V2SF 2 "nonimmediate_operand" " x,v,m,m")))]
8031 movlhps\t{%2, %0|%0, %2}
8032 vmovlhps\t{%2, %1, %0|%0, %1, %2}
8033 movhps\t{%2, %0|%0, %q2}
8034 vmovhps\t{%2, %1, %0|%0, %1, %q2}"
8035 [(set_attr "isa" "noavx,avx,noavx,avx")
8036 (set_attr "type" "ssemov")
8037 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex")
8038 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF")])
8040 (define_insn "*vec_concatv4sf_0"
8041 [(set (match_operand:V4SF 0 "register_operand" "=v")
8043 (match_operand:V2SF 1 "nonimmediate_operand" "xm")
8044 (match_operand:V2SF 2 "const0_operand" " C")))]
8046 "%vmovq\t{%1, %0|%0, %1}"
8047 [(set_attr "type" "ssemov")
8048 (set_attr "prefix" "maybe_vex")
8049 (set_attr "mode" "DF")])
8051 ;; Avoid combining registers from different units in a single alternative,
8052 ;; see comment above inline_secondary_memory_needed function in i386.c
8053 (define_insn "vec_set<mode>_0"
8054 [(set (match_operand:VI4F_128 0 "nonimmediate_operand"
8055 "=Yr,*x,v,v,v,x,x,v,Yr ,*x ,x ,m ,m ,m")
8057 (vec_duplicate:VI4F_128
8058 (match_operand:<ssescalarmode> 2 "general_operand"
8059 " Yr,*x,v,m,r ,m,x,v,*rm,*rm,*rm,!x,!*re,!*fF"))
8060 (match_operand:VI4F_128 1 "nonimm_or_0_operand"
8061 " C , C,C,C,C ,C,0,v,0 ,0 ,x ,0 ,0 ,0")
8065 insertps\t{$0xe, %2, %0|%0, %2, 0xe}
8066 insertps\t{$0xe, %2, %0|%0, %2, 0xe}
8067 vinsertps\t{$0xe, %2, %2, %0|%0, %2, %2, 0xe}
8068 %vmov<ssescalarmodesuffix>\t{%2, %0|%0, %2}
8069 %vmovd\t{%2, %0|%0, %2}
8070 movss\t{%2, %0|%0, %2}
8071 movss\t{%2, %0|%0, %2}
8072 vmovss\t{%2, %1, %0|%0, %1, %2}
8073 pinsrd\t{$0, %2, %0|%0, %2, 0}
8074 pinsrd\t{$0, %2, %0|%0, %2, 0}
8075 vpinsrd\t{$0, %2, %1, %0|%0, %1, %2, 0}
8080 (cond [(eq_attr "alternative" "0,1,8,9")
8081 (const_string "sse4_noavx")
8082 (eq_attr "alternative" "2,7,10")
8083 (const_string "avx")
8084 (eq_attr "alternative" "3,4")
8085 (const_string "sse2")
8086 (eq_attr "alternative" "5,6")
8087 (const_string "noavx")
8089 (const_string "*")))
8091 (cond [(eq_attr "alternative" "0,1,2,8,9,10")
8092 (const_string "sselog")
8093 (eq_attr "alternative" "12")
8094 (const_string "imov")
8095 (eq_attr "alternative" "13")
8096 (const_string "fmov")
8098 (const_string "ssemov")))
8099 (set (attr "prefix_extra")
8100 (if_then_else (eq_attr "alternative" "8,9,10")
8102 (const_string "*")))
8103 (set (attr "length_immediate")
8104 (if_then_else (eq_attr "alternative" "8,9,10")
8106 (const_string "*")))
8107 (set (attr "prefix")
8108 (cond [(eq_attr "alternative" "0,1,5,6,8,9")
8109 (const_string "orig")
8110 (eq_attr "alternative" "2")
8111 (const_string "maybe_evex")
8112 (eq_attr "alternative" "3,4")
8113 (const_string "maybe_vex")
8114 (eq_attr "alternative" "7,10")
8115 (const_string "vex")
8117 (const_string "*")))
8118 (set_attr "mode" "SF,SF,SF,<ssescalarmode>,SI,SF,SF,SF,TI,TI,TI,*,*,*")
8119 (set (attr "preferred_for_speed")
8120 (cond [(eq_attr "alternative" "4")
8121 (symbol_ref "TARGET_INTER_UNIT_MOVES_TO_VEC")
8123 (symbol_ref "true")))])
8125 ;; A subset is vec_setv4sf.
8126 (define_insn "*vec_setv4sf_sse4_1"
8127 [(set (match_operand:V4SF 0 "register_operand" "=Yr,*x,v")
8130 (match_operand:SF 2 "nonimmediate_operand" "Yrm,*xm,vm"))
8131 (match_operand:V4SF 1 "register_operand" "0,0,v")
8132 (match_operand:SI 3 "const_int_operand")))]
8134 && ((unsigned) exact_log2 (INTVAL (operands[3]))
8135 < GET_MODE_NUNITS (V4SFmode))"
8137 operands[3] = GEN_INT (exact_log2 (INTVAL (operands[3])) << 4);
8138 switch (which_alternative)
8142 return "insertps\t{%3, %2, %0|%0, %2, %3}";
8144 return "vinsertps\t{%3, %2, %1, %0|%0, %1, %2, %3}";
8149 [(set_attr "isa" "noavx,noavx,avx")
8150 (set_attr "type" "sselog")
8151 (set_attr "prefix_data16" "1,1,*")
8152 (set_attr "prefix_extra" "1")
8153 (set_attr "length_immediate" "1")
8154 (set_attr "prefix" "orig,orig,maybe_evex")
8155 (set_attr "mode" "V4SF")])
8157 ;; All of vinsertps, vmovss, vmovd clear also the higher bits.
8158 (define_insn "vec_set<mode>_0"
8159 [(set (match_operand:VI4F_256_512 0 "register_operand" "=v,v,v")
8160 (vec_merge:VI4F_256_512
8161 (vec_duplicate:VI4F_256_512
8162 (match_operand:<ssescalarmode> 2 "nonimmediate_operand" "v,m,r"))
8163 (match_operand:VI4F_256_512 1 "const0_operand" "C,C,C")
8167 vinsertps\t{$0xe, %2, %2, %x0|%x0, %2, %2, 0xe}
8168 vmov<ssescalarmodesuffix>\t{%x2, %x0|%x0, %2}
8169 vmovd\t{%2, %x0|%x0, %2}"
8171 (if_then_else (eq_attr "alternative" "0")
8172 (const_string "sselog")
8173 (const_string "ssemov")))
8174 (set_attr "prefix" "maybe_evex")
8175 (set_attr "mode" "SF,<ssescalarmode>,SI")
8176 (set (attr "preferred_for_speed")
8177 (cond [(eq_attr "alternative" "2")
8178 (symbol_ref "TARGET_INTER_UNIT_MOVES_TO_VEC")
8180 (symbol_ref "true")))])
8182 (define_insn "sse4_1_insertps"
8183 [(set (match_operand:V4SF 0 "register_operand" "=Yr,*x,v")
8184 (unspec:V4SF [(match_operand:V4SF 2 "nonimmediate_operand" "Yrm,*xm,vm")
8185 (match_operand:V4SF 1 "register_operand" "0,0,v")
8186 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")]
8190 if (MEM_P (operands[2]))
8192 unsigned count_s = INTVAL (operands[3]) >> 6;
8194 operands[3] = GEN_INT (INTVAL (operands[3]) & 0x3f);
8195 operands[2] = adjust_address_nv (operands[2], SFmode, count_s * 4);
8197 switch (which_alternative)
8201 return "insertps\t{%3, %2, %0|%0, %2, %3}";
8203 return "vinsertps\t{%3, %2, %1, %0|%0, %1, %2, %3}";
8208 [(set_attr "isa" "noavx,noavx,avx")
8209 (set_attr "type" "sselog")
8210 (set_attr "prefix_data16" "1,1,*")
8211 (set_attr "prefix_extra" "1")
8212 (set_attr "length_immediate" "1")
8213 (set_attr "prefix" "orig,orig,maybe_evex")
8214 (set_attr "mode" "V4SF")])
8217 [(set (match_operand:VI4F_128 0 "memory_operand")
8219 (vec_duplicate:VI4F_128
8220 (match_operand:<ssescalarmode> 1 "nonmemory_operand"))
8223 "TARGET_SSE && reload_completed"
8224 [(set (match_dup 0) (match_dup 1))]
8225 "operands[0] = adjust_address (operands[0], <ssescalarmode>mode, 0);")
8227 ;; Standard scalar operation patterns which preserve the rest of the
8228 ;; vector for combiner.
8229 (define_insn "vec_setv2df_0"
8230 [(set (match_operand:V2DF 0 "register_operand" "=x,v,x,v")
8233 (match_operand:DF 2 "nonimmediate_operand" " x,v,m,m"))
8234 (match_operand:V2DF 1 "register_operand" " 0,v,0,v")
8238 movsd\t{%2, %0|%0, %2}
8239 vmovsd\t{%2, %1, %0|%0, %1, %2}
8240 movlpd\t{%2, %0|%0, %2}
8241 vmovlpd\t{%2, %1, %0|%0, %1, %2}"
8242 [(set_attr "isa" "noavx,avx,noavx,avx")
8243 (set_attr "type" "ssemov")
8244 (set_attr "mode" "DF")])
8246 (define_expand "vec_set<mode>"
8247 [(match_operand:V 0 "register_operand")
8248 (match_operand:<ssescalarmode> 1 "register_operand")
8249 (match_operand 2 "const_int_operand")]
8252 ix86_expand_vector_set (false, operands[0], operands[1],
8253 INTVAL (operands[2]));
8257 (define_insn_and_split "*vec_extractv4sf_0"
8258 [(set (match_operand:SF 0 "nonimmediate_operand" "=v,m,f,r")
8260 (match_operand:V4SF 1 "nonimmediate_operand" "vm,v,m,m")
8261 (parallel [(const_int 0)])))]
8262 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
8264 "&& reload_completed"
8265 [(set (match_dup 0) (match_dup 1))]
8266 "operands[1] = gen_lowpart (SFmode, operands[1]);")
8268 (define_insn_and_split "*sse4_1_extractps"
8269 [(set (match_operand:SF 0 "nonimmediate_operand" "=rm,rm,rm,Yv,Yv")
8271 (match_operand:V4SF 1 "register_operand" "Yr,*x,v,0,v")
8272 (parallel [(match_operand:SI 2 "const_0_to_3_operand" "n,n,n,n,n")])))]
8275 extractps\t{%2, %1, %0|%0, %1, %2}
8276 extractps\t{%2, %1, %0|%0, %1, %2}
8277 vextractps\t{%2, %1, %0|%0, %1, %2}
8280 "&& reload_completed && SSE_REG_P (operands[0])"
8283 rtx dest = lowpart_subreg (V4SFmode, operands[0], SFmode);
8284 switch (INTVAL (operands[2]))
8288 emit_insn (gen_sse_shufps_v4sf (dest, operands[1], operands[1],
8289 operands[2], operands[2],
8290 GEN_INT (INTVAL (operands[2]) + 4),
8291 GEN_INT (INTVAL (operands[2]) + 4)));
8294 emit_insn (gen_vec_interleave_highv4sf (dest, operands[1], operands[1]));
8297 /* 0 should be handled by the *vec_extractv4sf_0 pattern above. */
8302 [(set_attr "isa" "noavx,noavx,avx,noavx,avx")
8303 (set_attr "type" "sselog,sselog,sselog,*,*")
8304 (set_attr "prefix_data16" "1,1,1,*,*")
8305 (set_attr "prefix_extra" "1,1,1,*,*")
8306 (set_attr "length_immediate" "1,1,1,*,*")
8307 (set_attr "prefix" "orig,orig,maybe_evex,*,*")
8308 (set_attr "mode" "V4SF,V4SF,V4SF,*,*")])
8310 (define_insn_and_split "*vec_extractv4sf_mem"
8311 [(set (match_operand:SF 0 "register_operand" "=v,*r,f")
8313 (match_operand:V4SF 1 "memory_operand" "o,o,o")
8314 (parallel [(match_operand 2 "const_0_to_3_operand" "n,n,n")])))]
8317 "&& reload_completed"
8318 [(set (match_dup 0) (match_dup 1))]
8320 operands[1] = adjust_address (operands[1], SFmode, INTVAL (operands[2]) * 4);
8323 (define_mode_attr extract_type
8324 [(V16SF "avx512f") (V16SI "avx512f") (V8DF "avx512dq") (V8DI "avx512dq")])
8326 (define_mode_attr extract_suf
8327 [(V16SF "32x4") (V16SI "32x4") (V8DF "64x2") (V8DI "64x2")])
8329 (define_mode_iterator AVX512_VEC
8330 [(V8DF "TARGET_AVX512DQ") (V8DI "TARGET_AVX512DQ") V16SF V16SI])
8332 (define_expand "<extract_type>_vextract<shuffletype><extract_suf>_mask"
8333 [(match_operand:<ssequartermode> 0 "nonimmediate_operand")
8334 (match_operand:AVX512_VEC 1 "register_operand")
8335 (match_operand:SI 2 "const_0_to_3_operand")
8336 (match_operand:<ssequartermode> 3 "nonimmediate_operand")
8337 (match_operand:QI 4 "register_operand")]
8341 mask = INTVAL (operands[2]);
8342 rtx dest = operands[0];
8344 if (MEM_P (operands[0]) && !rtx_equal_p (operands[0], operands[3]))
8345 dest = gen_reg_rtx (<ssequartermode>mode);
8347 if (<MODE>mode == V16SImode || <MODE>mode == V16SFmode)
8348 emit_insn (gen_avx512f_vextract<shuffletype>32x4_1_mask (dest,
8349 operands[1], GEN_INT (mask * 4), GEN_INT (mask * 4 + 1),
8350 GEN_INT (mask * 4 + 2), GEN_INT (mask * 4 + 3), operands[3],
8353 emit_insn (gen_avx512dq_vextract<shuffletype>64x2_1_mask (dest,
8354 operands[1], GEN_INT (mask * 2), GEN_INT (mask * 2 + 1), operands[3],
8356 if (dest != operands[0])
8357 emit_move_insn (operands[0], dest);
8361 (define_insn "avx512dq_vextract<shuffletype>64x2_1_mask"
8362 [(set (match_operand:<ssequartermode> 0 "nonimmediate_operand" "=v,m")
8363 (vec_merge:<ssequartermode>
8364 (vec_select:<ssequartermode>
8365 (match_operand:V8FI 1 "register_operand" "v,v")
8366 (parallel [(match_operand 2 "const_0_to_7_operand")
8367 (match_operand 3 "const_0_to_7_operand")]))
8368 (match_operand:<ssequartermode> 4 "nonimm_or_0_operand" "0C,0")
8369 (match_operand:QI 5 "register_operand" "Yk,Yk")))]
8371 && INTVAL (operands[2]) % 2 == 0
8372 && INTVAL (operands[2]) == INTVAL (operands[3]) - 1
8373 && (!MEM_P (operands[0]) || rtx_equal_p (operands[0], operands[4]))"
8375 operands[2] = GEN_INT (INTVAL (operands[2]) >> 1);
8376 return "vextract<shuffletype>64x2\t{%2, %1, %0%{%5%}%N4|%0%{%5%}%N4, %1, %2}";
8378 [(set_attr "type" "sselog1")
8379 (set_attr "prefix_extra" "1")
8380 (set_attr "length_immediate" "1")
8381 (set_attr "prefix" "evex")
8382 (set_attr "mode" "<sseinsnmode>")])
8384 (define_insn "*avx512dq_vextract<shuffletype>64x2_1"
8385 [(set (match_operand:<ssequartermode> 0 "nonimmediate_operand" "=vm")
8386 (vec_select:<ssequartermode>
8387 (match_operand:V8FI 1 "register_operand" "v")
8388 (parallel [(match_operand 2 "const_0_to_7_operand")
8389 (match_operand 3 "const_0_to_7_operand")])))]
8391 && INTVAL (operands[2]) % 2 == 0
8392 && INTVAL (operands[2]) == INTVAL (operands[3]) - 1"
8394 operands[2] = GEN_INT (INTVAL (operands[2]) >> 1);
8395 return "vextract<shuffletype>64x2\t{%2, %1, %0|%0, %1, %2}";
8397 [(set_attr "type" "sselog1")
8398 (set_attr "prefix_extra" "1")
8399 (set_attr "length_immediate" "1")
8400 (set_attr "prefix" "evex")
8401 (set_attr "mode" "<sseinsnmode>")])
8404 [(set (match_operand:<ssequartermode> 0 "nonimmediate_operand")
8405 (vec_select:<ssequartermode>
8406 (match_operand:V8FI 1 "register_operand")
8407 (parallel [(const_int 0) (const_int 1)])))]
8411 || REG_P (operands[0])
8412 || !EXT_REX_SSE_REG_P (operands[1]))"
8413 [(set (match_dup 0) (match_dup 1))]
8415 if (!TARGET_AVX512VL
8416 && REG_P (operands[0])
8417 && EXT_REX_SSE_REG_P (operands[1]))
8419 = lowpart_subreg (<MODE>mode, operands[0], <ssequartermode>mode);
8421 operands[1] = gen_lowpart (<ssequartermode>mode, operands[1]);
8424 (define_insn "avx512f_vextract<shuffletype>32x4_1_mask"
8425 [(set (match_operand:<ssequartermode> 0 "nonimmediate_operand" "=v,m")
8426 (vec_merge:<ssequartermode>
8427 (vec_select:<ssequartermode>
8428 (match_operand:V16FI 1 "register_operand" "v,v")
8429 (parallel [(match_operand 2 "const_0_to_15_operand")
8430 (match_operand 3 "const_0_to_15_operand")
8431 (match_operand 4 "const_0_to_15_operand")
8432 (match_operand 5 "const_0_to_15_operand")]))
8433 (match_operand:<ssequartermode> 6 "nonimm_or_0_operand" "0C,0")
8434 (match_operand:QI 7 "register_operand" "Yk,Yk")))]
8436 && INTVAL (operands[2]) % 4 == 0
8437 && INTVAL (operands[2]) == INTVAL (operands[3]) - 1
8438 && INTVAL (operands[3]) == INTVAL (operands[4]) - 1
8439 && INTVAL (operands[4]) == INTVAL (operands[5]) - 1
8440 && (!MEM_P (operands[0]) || rtx_equal_p (operands[0], operands[6]))"
8442 operands[2] = GEN_INT (INTVAL (operands[2]) >> 2);
8443 return "vextract<shuffletype>32x4\t{%2, %1, %0%{%7%}%N6|%0%{%7%}%N6, %1, %2}";
8445 [(set_attr "type" "sselog1")
8446 (set_attr "prefix_extra" "1")
8447 (set_attr "length_immediate" "1")
8448 (set_attr "prefix" "evex")
8449 (set_attr "mode" "<sseinsnmode>")])
8451 (define_insn "*avx512f_vextract<shuffletype>32x4_1"
8452 [(set (match_operand:<ssequartermode> 0 "nonimmediate_operand" "=vm")
8453 (vec_select:<ssequartermode>
8454 (match_operand:V16FI 1 "register_operand" "v")
8455 (parallel [(match_operand 2 "const_0_to_15_operand")
8456 (match_operand 3 "const_0_to_15_operand")
8457 (match_operand 4 "const_0_to_15_operand")
8458 (match_operand 5 "const_0_to_15_operand")])))]
8460 && INTVAL (operands[2]) % 4 == 0
8461 && INTVAL (operands[2]) == INTVAL (operands[3]) - 1
8462 && INTVAL (operands[3]) == INTVAL (operands[4]) - 1
8463 && INTVAL (operands[4]) == INTVAL (operands[5]) - 1"
8465 operands[2] = GEN_INT (INTVAL (operands[2]) >> 2);
8466 return "vextract<shuffletype>32x4\t{%2, %1, %0|%0, %1, %2}";
8468 [(set_attr "type" "sselog1")
8469 (set_attr "prefix_extra" "1")
8470 (set_attr "length_immediate" "1")
8471 (set_attr "prefix" "evex")
8472 (set_attr "mode" "<sseinsnmode>")])
8475 [(set (match_operand:<ssequartermode> 0 "nonimmediate_operand")
8476 (vec_select:<ssequartermode>
8477 (match_operand:V16FI 1 "register_operand")
8478 (parallel [(const_int 0) (const_int 1)
8479 (const_int 2) (const_int 3)])))]
8483 || REG_P (operands[0])
8484 || !EXT_REX_SSE_REG_P (operands[1]))"
8485 [(set (match_dup 0) (match_dup 1))]
8487 if (!TARGET_AVX512VL
8488 && REG_P (operands[0])
8489 && EXT_REX_SSE_REG_P (operands[1]))
8491 = lowpart_subreg (<MODE>mode, operands[0], <ssequartermode>mode);
8493 operands[1] = gen_lowpart (<ssequartermode>mode, operands[1]);
8496 (define_mode_attr extract_type_2
8497 [(V16SF "avx512dq") (V16SI "avx512dq") (V8DF "avx512f") (V8DI "avx512f")])
8499 (define_mode_attr extract_suf_2
8500 [(V16SF "32x8") (V16SI "32x8") (V8DF "64x4") (V8DI "64x4")])
8502 (define_mode_iterator AVX512_VEC_2
8503 [(V16SF "TARGET_AVX512DQ") (V16SI "TARGET_AVX512DQ") V8DF V8DI])
8505 (define_expand "<extract_type_2>_vextract<shuffletype><extract_suf_2>_mask"
8506 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
8507 (match_operand:AVX512_VEC_2 1 "register_operand")
8508 (match_operand:SI 2 "const_0_to_1_operand")
8509 (match_operand:<ssehalfvecmode> 3 "nonimmediate_operand")
8510 (match_operand:QI 4 "register_operand")]
8513 rtx (*insn)(rtx, rtx, rtx, rtx);
8514 rtx dest = operands[0];
8516 if (MEM_P (dest) && !rtx_equal_p (dest, operands[3]))
8517 dest = gen_reg_rtx (<ssehalfvecmode>mode);
8519 switch (INTVAL (operands[2]))
8522 insn = gen_vec_extract_lo_<mode>_mask;
8525 insn = gen_vec_extract_hi_<mode>_mask;
8531 emit_insn (insn (dest, operands[1], operands[3], operands[4]));
8532 if (dest != operands[0])
8533 emit_move_insn (operands[0], dest);
8538 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
8539 (vec_select:<ssehalfvecmode>
8540 (match_operand:V8FI 1 "nonimmediate_operand")
8541 (parallel [(const_int 0) (const_int 1)
8542 (const_int 2) (const_int 3)])))]
8543 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))
8546 || (REG_P (operands[0]) && !EXT_REX_SSE_REG_P (operands[1])))"
8547 [(set (match_dup 0) (match_dup 1))]
8548 "operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);")
8550 (define_insn "vec_extract_lo_<mode>_mask"
8551 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand" "=v,m")
8552 (vec_merge:<ssehalfvecmode>
8553 (vec_select:<ssehalfvecmode>
8554 (match_operand:V8FI 1 "register_operand" "v,v")
8555 (parallel [(const_int 0) (const_int 1)
8556 (const_int 2) (const_int 3)]))
8557 (match_operand:<ssehalfvecmode> 2 "nonimm_or_0_operand" "0C,0")
8558 (match_operand:QI 3 "register_operand" "Yk,Yk")))]
8560 && (!MEM_P (operands[0]) || rtx_equal_p (operands[0], operands[2]))"
8561 "vextract<shuffletype>64x4\t{$0x0, %1, %0%{%3%}%N2|%0%{%3%}%N2, %1, 0x0}"
8562 [(set_attr "type" "sselog1")
8563 (set_attr "prefix_extra" "1")
8564 (set_attr "length_immediate" "1")
8565 (set_attr "memory" "none,store")
8566 (set_attr "prefix" "evex")
8567 (set_attr "mode" "<sseinsnmode>")])
8569 (define_insn "vec_extract_lo_<mode>"
8570 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand" "=v,vm,v")
8571 (vec_select:<ssehalfvecmode>
8572 (match_operand:V8FI 1 "nonimmediate_operand" "v,v,vm")
8573 (parallel [(const_int 0) (const_int 1)
8574 (const_int 2) (const_int 3)])))]
8575 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
8577 if (!TARGET_AVX512VL && !MEM_P (operands[1]))
8578 return "vextract<shuffletype>64x4\t{$0x0, %1, %0|%0, %1, 0x0}";
8582 [(set_attr "type" "sselog1")
8583 (set_attr "prefix_extra" "1")
8584 (set_attr "length_immediate" "1")
8585 (set_attr "memory" "none,store,load")
8586 (set_attr "prefix" "evex")
8587 (set_attr "mode" "<sseinsnmode>")])
8589 (define_insn "vec_extract_hi_<mode>_mask"
8590 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand" "=v,m")
8591 (vec_merge:<ssehalfvecmode>
8592 (vec_select:<ssehalfvecmode>
8593 (match_operand:V8FI 1 "register_operand" "v,v")
8594 (parallel [(const_int 4) (const_int 5)
8595 (const_int 6) (const_int 7)]))
8596 (match_operand:<ssehalfvecmode> 2 "nonimm_or_0_operand" "0C,0")
8597 (match_operand:QI 3 "register_operand" "Yk,Yk")))]
8599 && (!MEM_P (operands[0]) || rtx_equal_p (operands[0], operands[2]))"
8600 "vextract<shuffletype>64x4\t{$0x1, %1, %0%{%3%}%N2|%0%{%3%}%N2, %1, 0x1}"
8601 [(set_attr "type" "sselog1")
8602 (set_attr "prefix_extra" "1")
8603 (set_attr "length_immediate" "1")
8604 (set_attr "prefix" "evex")
8605 (set_attr "mode" "<sseinsnmode>")])
8607 (define_insn "vec_extract_hi_<mode>"
8608 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand" "=vm")
8609 (vec_select:<ssehalfvecmode>
8610 (match_operand:V8FI 1 "register_operand" "v")
8611 (parallel [(const_int 4) (const_int 5)
8612 (const_int 6) (const_int 7)])))]
8614 "vextract<shuffletype>64x4\t{$0x1, %1, %0|%0, %1, 0x1}"
8615 [(set_attr "type" "sselog1")
8616 (set_attr "prefix_extra" "1")
8617 (set_attr "length_immediate" "1")
8618 (set_attr "prefix" "evex")
8619 (set_attr "mode" "<sseinsnmode>")])
8621 (define_insn "vec_extract_hi_<mode>_mask"
8622 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand" "=v,m")
8623 (vec_merge:<ssehalfvecmode>
8624 (vec_select:<ssehalfvecmode>
8625 (match_operand:V16FI 1 "register_operand" "v,v")
8626 (parallel [(const_int 8) (const_int 9)
8627 (const_int 10) (const_int 11)
8628 (const_int 12) (const_int 13)
8629 (const_int 14) (const_int 15)]))
8630 (match_operand:<ssehalfvecmode> 2 "nonimm_or_0_operand" "0C,0")
8631 (match_operand:QI 3 "register_operand" "Yk,Yk")))]
8633 && (!MEM_P (operands[0]) || rtx_equal_p (operands[0], operands[2]))"
8634 "vextract<shuffletype>32x8\t{$0x1, %1, %0%{%3%}%N2|%0%{%3%}%N2, %1, 0x1}"
8635 [(set_attr "type" "sselog1")
8636 (set_attr "prefix_extra" "1")
8637 (set_attr "length_immediate" "1")
8638 (set_attr "prefix" "evex")
8639 (set_attr "mode" "<sseinsnmode>")])
8641 (define_insn "vec_extract_hi_<mode>"
8642 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand" "=vm,vm")
8643 (vec_select:<ssehalfvecmode>
8644 (match_operand:V16FI 1 "register_operand" "v,v")
8645 (parallel [(const_int 8) (const_int 9)
8646 (const_int 10) (const_int 11)
8647 (const_int 12) (const_int 13)
8648 (const_int 14) (const_int 15)])))]
8651 vextract<shuffletype>32x8\t{$0x1, %1, %0|%0, %1, 0x1}
8652 vextracti64x4\t{$0x1, %1, %0|%0, %1, 0x1}"
8653 [(set_attr "type" "sselog1")
8654 (set_attr "prefix_extra" "1")
8655 (set_attr "isa" "avx512dq,noavx512dq")
8656 (set_attr "length_immediate" "1")
8657 (set_attr "prefix" "evex")
8658 (set_attr "mode" "<sseinsnmode>")])
8660 (define_mode_iterator VI48F_256_DQ
8661 [V8SI V8SF (V4DI "TARGET_AVX512DQ") (V4DF "TARGET_AVX512DQ")])
8663 (define_expand "avx512vl_vextractf128<mode>"
8664 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
8665 (match_operand:VI48F_256_DQ 1 "register_operand")
8666 (match_operand:SI 2 "const_0_to_1_operand")
8667 (match_operand:<ssehalfvecmode> 3 "nonimm_or_0_operand")
8668 (match_operand:QI 4 "register_operand")]
8671 rtx (*insn)(rtx, rtx, rtx, rtx);
8672 rtx dest = operands[0];
8675 && (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 4
8676 /* For V8S[IF]mode there are maskm insns with =m and 0
8678 ? !rtx_equal_p (dest, operands[3])
8679 /* For V4D[IF]mode, hi insns don't allow memory, and
8680 lo insns have =m and 0C constraints. */
8681 : (operands[2] != const0_rtx
8682 || (!rtx_equal_p (dest, operands[3])
8683 && GET_CODE (operands[3]) != CONST_VECTOR))))
8684 dest = gen_reg_rtx (<ssehalfvecmode>mode);
8685 switch (INTVAL (operands[2]))
8688 insn = gen_vec_extract_lo_<mode>_mask;
8691 insn = gen_vec_extract_hi_<mode>_mask;
8697 emit_insn (insn (dest, operands[1], operands[3], operands[4]));
8698 if (dest != operands[0])
8699 emit_move_insn (operands[0], dest);
8703 (define_expand "avx_vextractf128<mode>"
8704 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
8705 (match_operand:V_256 1 "register_operand")
8706 (match_operand:SI 2 "const_0_to_1_operand")]
8709 rtx (*insn)(rtx, rtx);
8711 switch (INTVAL (operands[2]))
8714 insn = gen_vec_extract_lo_<mode>;
8717 insn = gen_vec_extract_hi_<mode>;
8723 emit_insn (insn (operands[0], operands[1]));
8727 (define_insn "vec_extract_lo_<mode>_mask"
8728 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand" "=v,m")
8729 (vec_merge:<ssehalfvecmode>
8730 (vec_select:<ssehalfvecmode>
8731 (match_operand:V16FI 1 "register_operand" "v,v")
8732 (parallel [(const_int 0) (const_int 1)
8733 (const_int 2) (const_int 3)
8734 (const_int 4) (const_int 5)
8735 (const_int 6) (const_int 7)]))
8736 (match_operand:<ssehalfvecmode> 2 "nonimm_or_0_operand" "0C,0")
8737 (match_operand:QI 3 "register_operand" "Yk,Yk")))]
8739 && (!MEM_P (operands[0]) || rtx_equal_p (operands[0], operands[2]))"
8740 "vextract<shuffletype>32x8\t{$0x0, %1, %0%{%3%}%N2|%0%{%3%}%N2, %1, 0x0}"
8741 [(set_attr "type" "sselog1")
8742 (set_attr "prefix_extra" "1")
8743 (set_attr "length_immediate" "1")
8744 (set_attr "memory" "none,store")
8745 (set_attr "prefix" "evex")
8746 (set_attr "mode" "<sseinsnmode>")])
8748 (define_insn "vec_extract_lo_<mode>"
8749 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand" "=v,v,m")
8750 (vec_select:<ssehalfvecmode>
8751 (match_operand:V16FI 1 "nonimmediate_operand" "v,m,v")
8752 (parallel [(const_int 0) (const_int 1)
8753 (const_int 2) (const_int 3)
8754 (const_int 4) (const_int 5)
8755 (const_int 6) (const_int 7)])))]
8757 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
8759 if (!TARGET_AVX512VL
8760 && !REG_P (operands[0])
8761 && EXT_REX_SSE_REG_P (operands[1]))
8763 if (TARGET_AVX512DQ)
8764 return "vextract<shuffletype>32x8\t{$0x0, %1, %0|%0, %1, 0x0}";
8766 return "vextract<shuffletype>64x4\t{$0x0, %1, %0|%0, %1, 0x0}";
8771 [(set_attr "type" "sselog1")
8772 (set_attr "prefix_extra" "1")
8773 (set_attr "length_immediate" "1")
8774 (set_attr "memory" "none,load,store")
8775 (set_attr "prefix" "evex")
8776 (set_attr "mode" "<sseinsnmode>")])
8779 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
8780 (vec_select:<ssehalfvecmode>
8781 (match_operand:V16FI 1 "nonimmediate_operand")
8782 (parallel [(const_int 0) (const_int 1)
8783 (const_int 2) (const_int 3)
8784 (const_int 4) (const_int 5)
8785 (const_int 6) (const_int 7)])))]
8786 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))
8789 || REG_P (operands[0])
8790 || !EXT_REX_SSE_REG_P (operands[1]))"
8791 [(set (match_dup 0) (match_dup 1))]
8793 if (!TARGET_AVX512VL
8794 && REG_P (operands[0])
8795 && EXT_REX_SSE_REG_P (operands[1]))
8797 = lowpart_subreg (<MODE>mode, operands[0], <ssehalfvecmode>mode);
8799 operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);
8802 (define_insn "vec_extract_lo_<mode>_mask"
8803 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand" "=v,m")
8804 (vec_merge:<ssehalfvecmode>
8805 (vec_select:<ssehalfvecmode>
8806 (match_operand:VI8F_256 1 "register_operand" "v,v")
8807 (parallel [(const_int 0) (const_int 1)]))
8808 (match_operand:<ssehalfvecmode> 2 "nonimm_or_0_operand" "0C,0")
8809 (match_operand:QI 3 "register_operand" "Yk,Yk")))]
8812 && (!MEM_P (operands[0]) || rtx_equal_p (operands[0], operands[2]))"
8813 "vextract<shuffletype>64x2\t{$0x0, %1, %0%{%3%}%N2|%0%{%3%}%N2, %1, 0x0}"
8814 [(set_attr "type" "sselog1")
8815 (set_attr "prefix_extra" "1")
8816 (set_attr "length_immediate" "1")
8817 (set_attr "memory" "none,store")
8818 (set_attr "prefix" "evex")
8819 (set_attr "mode" "XI")])
8821 (define_insn "vec_extract_lo_<mode>"
8822 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand" "=vm,v")
8823 (vec_select:<ssehalfvecmode>
8824 (match_operand:VI8F_256 1 "nonimmediate_operand" "v,vm")
8825 (parallel [(const_int 0) (const_int 1)])))]
8827 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
8831 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
8832 (vec_select:<ssehalfvecmode>
8833 (match_operand:VI8F_256 1 "nonimmediate_operand")
8834 (parallel [(const_int 0) (const_int 1)])))]
8835 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))
8836 && reload_completed"
8837 [(set (match_dup 0) (match_dup 1))]
8838 "operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);")
8840 (define_insn "vec_extract_hi_<mode>_mask"
8841 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand" "=v,m")
8842 (vec_merge:<ssehalfvecmode>
8843 (vec_select:<ssehalfvecmode>
8844 (match_operand:VI8F_256 1 "register_operand" "v,v")
8845 (parallel [(const_int 2) (const_int 3)]))
8846 (match_operand:<ssehalfvecmode> 2 "nonimm_or_0_operand" "0C,0")
8847 (match_operand:QI 3 "register_operand" "Yk,Yk")))]
8850 && (!MEM_P (operands[0]) || rtx_equal_p (operands[0], operands[2]))"
8851 "vextract<shuffletype>64x2\t{$0x1, %1, %0%{%3%}%N2|%0%{%3%}%N2, %1, 0x1}"
8852 [(set_attr "type" "sselog1")
8853 (set_attr "prefix_extra" "1")
8854 (set_attr "length_immediate" "1")
8855 (set_attr "prefix" "vex")
8856 (set_attr "mode" "<sseinsnmode>")])
8858 (define_insn "vec_extract_hi_<mode>"
8859 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand" "=vm")
8860 (vec_select:<ssehalfvecmode>
8861 (match_operand:VI8F_256 1 "register_operand" "v")
8862 (parallel [(const_int 2) (const_int 3)])))]
8865 if (TARGET_AVX512VL)
8867 if (TARGET_AVX512DQ)
8868 return "vextract<shuffletype>64x2\t{$0x1, %1, %0|%0, %1, 0x1}";
8870 return "vextract<shuffletype>32x4\t{$0x1, %1, %0|%0, %1, 0x1}";
8873 return "vextract<i128>\t{$0x1, %1, %0|%0, %1, 0x1}";
8875 [(set_attr "type" "sselog1")
8876 (set_attr "prefix_extra" "1")
8877 (set_attr "length_immediate" "1")
8878 (set_attr "prefix" "vex")
8879 (set_attr "mode" "<sseinsnmode>")])
8882 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
8883 (vec_select:<ssehalfvecmode>
8884 (match_operand:VI4F_256 1 "nonimmediate_operand")
8885 (parallel [(const_int 0) (const_int 1)
8886 (const_int 2) (const_int 3)])))]
8887 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))
8888 && reload_completed"
8889 [(set (match_dup 0) (match_dup 1))]
8890 "operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);")
8892 (define_insn "vec_extract_lo_<mode>_mask"
8893 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand" "=v,m")
8894 (vec_merge:<ssehalfvecmode>
8895 (vec_select:<ssehalfvecmode>
8896 (match_operand:VI4F_256 1 "register_operand" "v,v")
8897 (parallel [(const_int 0) (const_int 1)
8898 (const_int 2) (const_int 3)]))
8899 (match_operand:<ssehalfvecmode> 2 "nonimm_or_0_operand" "0C,0")
8900 (match_operand:QI 3 "register_operand" "Yk,Yk")))]
8902 && (!MEM_P (operands[0]) || rtx_equal_p (operands[0], operands[2]))"
8903 "vextract<shuffletype>32x4\t{$0x0, %1, %0%{%3%}%N2|%0%{%3%}%N2, %1, 0x0}"
8904 [(set_attr "type" "sselog1")
8905 (set_attr "prefix_extra" "1")
8906 (set_attr "length_immediate" "1")
8907 (set_attr "prefix" "evex")
8908 (set_attr "mode" "<sseinsnmode>")])
8910 (define_insn "vec_extract_lo_<mode>"
8911 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand" "=vm,v")
8912 (vec_select:<ssehalfvecmode>
8913 (match_operand:VI4F_256 1 "nonimmediate_operand" "v,vm")
8914 (parallel [(const_int 0) (const_int 1)
8915 (const_int 2) (const_int 3)])))]
8917 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
8919 [(set_attr "type" "sselog1")
8920 (set_attr "prefix_extra" "1")
8921 (set_attr "length_immediate" "1")
8922 (set_attr "prefix" "evex")
8923 (set_attr "mode" "<sseinsnmode>")])
8925 (define_insn "vec_extract_hi_<mode>_mask"
8926 [(set (match_operand:<ssehalfvecmode> 0 "register_operand" "=v,m")
8927 (vec_merge:<ssehalfvecmode>
8928 (vec_select:<ssehalfvecmode>
8929 (match_operand:VI4F_256 1 "register_operand" "v,v")
8930 (parallel [(const_int 4) (const_int 5)
8931 (const_int 6) (const_int 7)]))
8932 (match_operand:<ssehalfvecmode> 2 "nonimm_or_0_operand" "0C,0")
8933 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
8935 && (!MEM_P (operands[0]) || rtx_equal_p (operands[0], operands[2]))"
8936 "vextract<shuffletype>32x4\t{$0x1, %1, %0%{%3%}%N2|%0%{%3%}%N2, %1, 0x1}"
8937 [(set_attr "type" "sselog1")
8938 (set_attr "length_immediate" "1")
8939 (set_attr "prefix" "evex")
8940 (set_attr "mode" "<sseinsnmode>")])
8942 (define_insn "vec_extract_hi_<mode>"
8943 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand" "=xm, vm")
8944 (vec_select:<ssehalfvecmode>
8945 (match_operand:VI4F_256 1 "register_operand" "x, v")
8946 (parallel [(const_int 4) (const_int 5)
8947 (const_int 6) (const_int 7)])))]
8950 vextract<i128>\t{$0x1, %1, %0|%0, %1, 0x1}
8951 vextract<shuffletype>32x4\t{$0x1, %1, %0|%0, %1, 0x1}"
8952 [(set_attr "isa" "*, avx512vl")
8953 (set_attr "prefix" "vex, evex")
8954 (set_attr "type" "sselog1")
8955 (set_attr "length_immediate" "1")
8956 (set_attr "mode" "<sseinsnmode>")])
8958 (define_insn_and_split "vec_extract_lo_v32hi"
8959 [(set (match_operand:V16HI 0 "nonimmediate_operand" "=v,v,m")
8961 (match_operand:V32HI 1 "nonimmediate_operand" "v,m,v")
8962 (parallel [(const_int 0) (const_int 1)
8963 (const_int 2) (const_int 3)
8964 (const_int 4) (const_int 5)
8965 (const_int 6) (const_int 7)
8966 (const_int 8) (const_int 9)
8967 (const_int 10) (const_int 11)
8968 (const_int 12) (const_int 13)
8969 (const_int 14) (const_int 15)])))]
8970 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
8973 || REG_P (operands[0])
8974 || !EXT_REX_SSE_REG_P (operands[1]))
8977 return "vextracti64x4\t{$0x0, %1, %0|%0, %1, 0x0}";
8979 "&& reload_completed
8981 || REG_P (operands[0])
8982 || !EXT_REX_SSE_REG_P (operands[1]))"
8983 [(set (match_dup 0) (match_dup 1))]
8985 if (!TARGET_AVX512VL
8986 && REG_P (operands[0])
8987 && EXT_REX_SSE_REG_P (operands[1]))
8988 operands[0] = lowpart_subreg (V32HImode, operands[0], V16HImode);
8990 operands[1] = gen_lowpart (V16HImode, operands[1]);
8992 [(set_attr "type" "sselog1")
8993 (set_attr "prefix_extra" "1")
8994 (set_attr "length_immediate" "1")
8995 (set_attr "memory" "none,load,store")
8996 (set_attr "prefix" "evex")
8997 (set_attr "mode" "XI")])
8999 (define_insn "vec_extract_hi_v32hi"
9000 [(set (match_operand:V16HI 0 "nonimmediate_operand" "=vm")
9002 (match_operand:V32HI 1 "register_operand" "v")
9003 (parallel [(const_int 16) (const_int 17)
9004 (const_int 18) (const_int 19)
9005 (const_int 20) (const_int 21)
9006 (const_int 22) (const_int 23)
9007 (const_int 24) (const_int 25)
9008 (const_int 26) (const_int 27)
9009 (const_int 28) (const_int 29)
9010 (const_int 30) (const_int 31)])))]
9012 "vextracti64x4\t{$0x1, %1, %0|%0, %1, 0x1}"
9013 [(set_attr "type" "sselog1")
9014 (set_attr "prefix_extra" "1")
9015 (set_attr "length_immediate" "1")
9016 (set_attr "prefix" "evex")
9017 (set_attr "mode" "XI")])
9019 (define_insn_and_split "vec_extract_lo_v16hi"
9020 [(set (match_operand:V8HI 0 "nonimmediate_operand" "=v,m")
9022 (match_operand:V16HI 1 "nonimmediate_operand" "vm,v")
9023 (parallel [(const_int 0) (const_int 1)
9024 (const_int 2) (const_int 3)
9025 (const_int 4) (const_int 5)
9026 (const_int 6) (const_int 7)])))]
9027 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
9029 "&& reload_completed"
9030 [(set (match_dup 0) (match_dup 1))]
9031 "operands[1] = gen_lowpart (V8HImode, operands[1]);")
9033 (define_insn "vec_extract_hi_v16hi"
9034 [(set (match_operand:V8HI 0 "nonimmediate_operand" "=xm,vm,vm")
9036 (match_operand:V16HI 1 "register_operand" "x,v,v")
9037 (parallel [(const_int 8) (const_int 9)
9038 (const_int 10) (const_int 11)
9039 (const_int 12) (const_int 13)
9040 (const_int 14) (const_int 15)])))]
9043 vextract%~128\t{$0x1, %1, %0|%0, %1, 0x1}
9044 vextracti32x4\t{$0x1, %1, %0|%0, %1, 0x1}
9045 vextracti32x4\t{$0x1, %g1, %0|%0, %g1, 0x1}"
9046 [(set_attr "type" "sselog1")
9047 (set_attr "prefix_extra" "1")
9048 (set_attr "length_immediate" "1")
9049 (set_attr "isa" "*,avx512dq,avx512f")
9050 (set_attr "prefix" "vex,evex,evex")
9051 (set_attr "mode" "OI")])
9053 (define_insn_and_split "vec_extract_lo_v64qi"
9054 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=v,v,m")
9056 (match_operand:V64QI 1 "nonimmediate_operand" "v,m,v")
9057 (parallel [(const_int 0) (const_int 1)
9058 (const_int 2) (const_int 3)
9059 (const_int 4) (const_int 5)
9060 (const_int 6) (const_int 7)
9061 (const_int 8) (const_int 9)
9062 (const_int 10) (const_int 11)
9063 (const_int 12) (const_int 13)
9064 (const_int 14) (const_int 15)
9065 (const_int 16) (const_int 17)
9066 (const_int 18) (const_int 19)
9067 (const_int 20) (const_int 21)
9068 (const_int 22) (const_int 23)
9069 (const_int 24) (const_int 25)
9070 (const_int 26) (const_int 27)
9071 (const_int 28) (const_int 29)
9072 (const_int 30) (const_int 31)])))]
9073 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
9076 || REG_P (operands[0])
9077 || !EXT_REX_SSE_REG_P (operands[1]))
9080 return "vextracti64x4\t{$0x0, %1, %0|%0, %1, 0x0}";
9082 "&& reload_completed
9084 || REG_P (operands[0])
9085 || !EXT_REX_SSE_REG_P (operands[1]))"
9086 [(set (match_dup 0) (match_dup 1))]
9088 if (!TARGET_AVX512VL
9089 && REG_P (operands[0])
9090 && EXT_REX_SSE_REG_P (operands[1]))
9091 operands[0] = lowpart_subreg (V64QImode, operands[0], V32QImode);
9093 operands[1] = gen_lowpart (V32QImode, operands[1]);
9095 [(set_attr "type" "sselog1")
9096 (set_attr "prefix_extra" "1")
9097 (set_attr "length_immediate" "1")
9098 (set_attr "memory" "none,load,store")
9099 (set_attr "prefix" "evex")
9100 (set_attr "mode" "XI")])
9102 (define_insn "vec_extract_hi_v64qi"
9103 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=vm")
9105 (match_operand:V64QI 1 "register_operand" "v")
9106 (parallel [(const_int 32) (const_int 33)
9107 (const_int 34) (const_int 35)
9108 (const_int 36) (const_int 37)
9109 (const_int 38) (const_int 39)
9110 (const_int 40) (const_int 41)
9111 (const_int 42) (const_int 43)
9112 (const_int 44) (const_int 45)
9113 (const_int 46) (const_int 47)
9114 (const_int 48) (const_int 49)
9115 (const_int 50) (const_int 51)
9116 (const_int 52) (const_int 53)
9117 (const_int 54) (const_int 55)
9118 (const_int 56) (const_int 57)
9119 (const_int 58) (const_int 59)
9120 (const_int 60) (const_int 61)
9121 (const_int 62) (const_int 63)])))]
9123 "vextracti64x4\t{$0x1, %1, %0|%0, %1, 0x1}"
9124 [(set_attr "type" "sselog1")
9125 (set_attr "prefix_extra" "1")
9126 (set_attr "length_immediate" "1")
9127 (set_attr "prefix" "evex")
9128 (set_attr "mode" "XI")])
9130 (define_insn_and_split "vec_extract_lo_v32qi"
9131 [(set (match_operand:V16QI 0 "nonimmediate_operand" "=v,m")
9133 (match_operand:V32QI 1 "nonimmediate_operand" "vm,v")
9134 (parallel [(const_int 0) (const_int 1)
9135 (const_int 2) (const_int 3)
9136 (const_int 4) (const_int 5)
9137 (const_int 6) (const_int 7)
9138 (const_int 8) (const_int 9)
9139 (const_int 10) (const_int 11)
9140 (const_int 12) (const_int 13)
9141 (const_int 14) (const_int 15)])))]
9142 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
9144 "&& reload_completed"
9145 [(set (match_dup 0) (match_dup 1))]
9146 "operands[1] = gen_lowpart (V16QImode, operands[1]);")
9148 (define_insn "vec_extract_hi_v32qi"
9149 [(set (match_operand:V16QI 0 "nonimmediate_operand" "=xm,vm,vm")
9151 (match_operand:V32QI 1 "register_operand" "x,v,v")
9152 (parallel [(const_int 16) (const_int 17)
9153 (const_int 18) (const_int 19)
9154 (const_int 20) (const_int 21)
9155 (const_int 22) (const_int 23)
9156 (const_int 24) (const_int 25)
9157 (const_int 26) (const_int 27)
9158 (const_int 28) (const_int 29)
9159 (const_int 30) (const_int 31)])))]
9162 vextract%~128\t{$0x1, %1, %0|%0, %1, 0x1}
9163 vextracti32x4\t{$0x1, %1, %0|%0, %1, 0x1}
9164 vextracti32x4\t{$0x1, %g1, %0|%0, %g1, 0x1}"
9165 [(set_attr "type" "sselog1")
9166 (set_attr "prefix_extra" "1")
9167 (set_attr "length_immediate" "1")
9168 (set_attr "isa" "*,avx512dq,avx512f")
9169 (set_attr "prefix" "vex,evex,evex")
9170 (set_attr "mode" "OI")])
9172 ;; Modes handled by vec_extract patterns.
9173 (define_mode_iterator VEC_EXTRACT_MODE
9174 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX") V16QI
9175 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX") V8HI
9176 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
9177 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI
9178 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
9179 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") V2DF
9180 (V4TI "TARGET_AVX512F") (V2TI "TARGET_AVX")])
9182 (define_expand "vec_extract<mode><ssescalarmodelower>"
9183 [(match_operand:<ssescalarmode> 0 "register_operand")
9184 (match_operand:VEC_EXTRACT_MODE 1 "register_operand")
9185 (match_operand 2 "const_int_operand")]
9188 ix86_expand_vector_extract (false, operands[0], operands[1],
9189 INTVAL (operands[2]));
9193 (define_expand "vec_extract<mode><ssehalfvecmodelower>"
9194 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
9195 (match_operand:V_256_512 1 "register_operand")
9196 (match_operand 2 "const_0_to_1_operand")]
9199 if (INTVAL (operands[2]))
9200 emit_insn (gen_vec_extract_hi_<mode> (operands[0], operands[1]));
9202 emit_insn (gen_vec_extract_lo_<mode> (operands[0], operands[1]));
9206 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9208 ;; Parallel double-precision floating point element swizzling
9210 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9212 (define_insn "<mask_codefor>avx512f_unpckhpd512<mask_name>"
9213 [(set (match_operand:V8DF 0 "register_operand" "=v")
9216 (match_operand:V8DF 1 "register_operand" "v")
9217 (match_operand:V8DF 2 "nonimmediate_operand" "vm"))
9218 (parallel [(const_int 1) (const_int 9)
9219 (const_int 3) (const_int 11)
9220 (const_int 5) (const_int 13)
9221 (const_int 7) (const_int 15)])))]
9223 "vunpckhpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
9224 [(set_attr "type" "sselog")
9225 (set_attr "prefix" "evex")
9226 (set_attr "mode" "V8DF")])
9228 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
9229 (define_insn "avx_unpckhpd256<mask_name>"
9230 [(set (match_operand:V4DF 0 "register_operand" "=v")
9233 (match_operand:V4DF 1 "register_operand" "v")
9234 (match_operand:V4DF 2 "nonimmediate_operand" "vm"))
9235 (parallel [(const_int 1) (const_int 5)
9236 (const_int 3) (const_int 7)])))]
9237 "TARGET_AVX && <mask_avx512vl_condition>"
9238 "vunpckhpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
9239 [(set_attr "type" "sselog")
9240 (set_attr "prefix" "vex")
9241 (set_attr "mode" "V4DF")])
9243 (define_expand "vec_interleave_highv4df"
9247 (match_operand:V4DF 1 "register_operand")
9248 (match_operand:V4DF 2 "nonimmediate_operand"))
9249 (parallel [(const_int 0) (const_int 4)
9250 (const_int 2) (const_int 6)])))
9256 (parallel [(const_int 1) (const_int 5)
9257 (const_int 3) (const_int 7)])))
9258 (set (match_operand:V4DF 0 "register_operand")
9263 (parallel [(const_int 2) (const_int 3)
9264 (const_int 6) (const_int 7)])))]
9267 operands[3] = gen_reg_rtx (V4DFmode);
9268 operands[4] = gen_reg_rtx (V4DFmode);
9272 (define_insn "avx512vl_unpckhpd128_mask"
9273 [(set (match_operand:V2DF 0 "register_operand" "=v")
9277 (match_operand:V2DF 1 "register_operand" "v")
9278 (match_operand:V2DF 2 "nonimmediate_operand" "vm"))
9279 (parallel [(const_int 1) (const_int 3)]))
9280 (match_operand:V2DF 3 "nonimm_or_0_operand" "0C")
9281 (match_operand:QI 4 "register_operand" "Yk")))]
9283 "vunpckhpd\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
9284 [(set_attr "type" "sselog")
9285 (set_attr "prefix" "evex")
9286 (set_attr "mode" "V2DF")])
9288 (define_expand "vec_interleave_highv2df"
9289 [(set (match_operand:V2DF 0 "register_operand")
9292 (match_operand:V2DF 1 "nonimmediate_operand")
9293 (match_operand:V2DF 2 "nonimmediate_operand"))
9294 (parallel [(const_int 1)
9298 if (!ix86_vec_interleave_v2df_operator_ok (operands, 1))
9299 operands[2] = force_reg (V2DFmode, operands[2]);
9302 (define_insn "*vec_interleave_highv2df"
9303 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,v,v,x,v,m")
9306 (match_operand:V2DF 1 "nonimmediate_operand" " 0,v,o,o,o,v")
9307 (match_operand:V2DF 2 "nonimmediate_operand" " x,v,1,0,v,0"))
9308 (parallel [(const_int 1)
9310 "TARGET_SSE2 && ix86_vec_interleave_v2df_operator_ok (operands, 1)"
9312 unpckhpd\t{%2, %0|%0, %2}
9313 vunpckhpd\t{%2, %1, %0|%0, %1, %2}
9314 %vmovddup\t{%H1, %0|%0, %H1}
9315 movlpd\t{%H1, %0|%0, %H1}
9316 vmovlpd\t{%H1, %2, %0|%0, %2, %H1}
9317 %vmovhpd\t{%1, %0|%q0, %1}"
9318 [(set_attr "isa" "noavx,avx,sse3,noavx,avx,*")
9319 (set_attr "type" "sselog,sselog,sselog,ssemov,ssemov,ssemov")
9320 (set (attr "prefix_data16")
9321 (if_then_else (eq_attr "alternative" "3,5")
9323 (const_string "*")))
9324 (set_attr "prefix" "orig,maybe_evex,maybe_vex,orig,maybe_evex,maybe_vex")
9325 (set_attr "mode" "V2DF,V2DF,DF,V1DF,V1DF,V1DF")])
9327 (define_expand "avx512f_movddup512<mask_name>"
9328 [(set (match_operand:V8DF 0 "register_operand")
9331 (match_operand:V8DF 1 "nonimmediate_operand")
9333 (parallel [(const_int 0) (const_int 8)
9334 (const_int 2) (const_int 10)
9335 (const_int 4) (const_int 12)
9336 (const_int 6) (const_int 14)])))]
9339 (define_expand "avx512f_unpcklpd512<mask_name>"
9340 [(set (match_operand:V8DF 0 "register_operand")
9343 (match_operand:V8DF 1 "register_operand")
9344 (match_operand:V8DF 2 "nonimmediate_operand"))
9345 (parallel [(const_int 0) (const_int 8)
9346 (const_int 2) (const_int 10)
9347 (const_int 4) (const_int 12)
9348 (const_int 6) (const_int 14)])))]
9351 (define_insn "*avx512f_unpcklpd512<mask_name>"
9352 [(set (match_operand:V8DF 0 "register_operand" "=v,v")
9355 (match_operand:V8DF 1 "nonimmediate_operand" "vm, v")
9356 (match_operand:V8DF 2 "nonimmediate_operand" "1 ,vm"))
9357 (parallel [(const_int 0) (const_int 8)
9358 (const_int 2) (const_int 10)
9359 (const_int 4) (const_int 12)
9360 (const_int 6) (const_int 14)])))]
9363 vmovddup\t{%1, %0<mask_operand3>|%0<mask_operand3>, %1}
9364 vunpcklpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
9365 [(set_attr "type" "sselog")
9366 (set_attr "prefix" "evex")
9367 (set_attr "mode" "V8DF")])
9369 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
9370 (define_expand "avx_movddup256<mask_name>"
9371 [(set (match_operand:V4DF 0 "register_operand")
9374 (match_operand:V4DF 1 "nonimmediate_operand")
9376 (parallel [(const_int 0) (const_int 4)
9377 (const_int 2) (const_int 6)])))]
9378 "TARGET_AVX && <mask_avx512vl_condition>")
9380 (define_expand "avx_unpcklpd256<mask_name>"
9381 [(set (match_operand:V4DF 0 "register_operand")
9384 (match_operand:V4DF 1 "register_operand")
9385 (match_operand:V4DF 2 "nonimmediate_operand"))
9386 (parallel [(const_int 0) (const_int 4)
9387 (const_int 2) (const_int 6)])))]
9388 "TARGET_AVX && <mask_avx512vl_condition>")
9390 (define_insn "*avx_unpcklpd256<mask_name>"
9391 [(set (match_operand:V4DF 0 "register_operand" "=v,v")
9394 (match_operand:V4DF 1 "nonimmediate_operand" " v,m")
9395 (match_operand:V4DF 2 "nonimmediate_operand" "vm,1"))
9396 (parallel [(const_int 0) (const_int 4)
9397 (const_int 2) (const_int 6)])))]
9398 "TARGET_AVX && <mask_avx512vl_condition>"
9400 vunpcklpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
9401 vmovddup\t{%1, %0<mask_operand3>|%0<mask_operand3>, %1}"
9402 [(set_attr "type" "sselog")
9403 (set_attr "prefix" "vex")
9404 (set_attr "mode" "V4DF")])
9406 (define_expand "vec_interleave_lowv4df"
9410 (match_operand:V4DF 1 "register_operand")
9411 (match_operand:V4DF 2 "nonimmediate_operand"))
9412 (parallel [(const_int 0) (const_int 4)
9413 (const_int 2) (const_int 6)])))
9419 (parallel [(const_int 1) (const_int 5)
9420 (const_int 3) (const_int 7)])))
9421 (set (match_operand:V4DF 0 "register_operand")
9426 (parallel [(const_int 0) (const_int 1)
9427 (const_int 4) (const_int 5)])))]
9430 operands[3] = gen_reg_rtx (V4DFmode);
9431 operands[4] = gen_reg_rtx (V4DFmode);
9434 (define_insn "avx512vl_unpcklpd128_mask"
9435 [(set (match_operand:V2DF 0 "register_operand" "=v")
9439 (match_operand:V2DF 1 "register_operand" "v")
9440 (match_operand:V2DF 2 "nonimmediate_operand" "vm"))
9441 (parallel [(const_int 0) (const_int 2)]))
9442 (match_operand:V2DF 3 "nonimm_or_0_operand" "0C")
9443 (match_operand:QI 4 "register_operand" "Yk")))]
9445 "vunpcklpd\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
9446 [(set_attr "type" "sselog")
9447 (set_attr "prefix" "evex")
9448 (set_attr "mode" "V2DF")])
9450 (define_expand "vec_interleave_lowv2df"
9451 [(set (match_operand:V2DF 0 "register_operand")
9454 (match_operand:V2DF 1 "nonimmediate_operand")
9455 (match_operand:V2DF 2 "nonimmediate_operand"))
9456 (parallel [(const_int 0)
9460 if (!ix86_vec_interleave_v2df_operator_ok (operands, 0))
9461 operands[1] = force_reg (V2DFmode, operands[1]);
9464 (define_insn "*vec_interleave_lowv2df"
9465 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,v,v,x,v,o")
9468 (match_operand:V2DF 1 "nonimmediate_operand" " 0,v,m,0,v,0")
9469 (match_operand:V2DF 2 "nonimmediate_operand" " x,v,1,m,m,v"))
9470 (parallel [(const_int 0)
9472 "TARGET_SSE2 && ix86_vec_interleave_v2df_operator_ok (operands, 0)"
9474 unpcklpd\t{%2, %0|%0, %2}
9475 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
9476 %vmovddup\t{%1, %0|%0, %q1}
9477 movhpd\t{%2, %0|%0, %q2}
9478 vmovhpd\t{%2, %1, %0|%0, %1, %q2}
9479 %vmovlpd\t{%2, %H0|%H0, %2}"
9480 [(set_attr "isa" "noavx,avx,sse3,noavx,avx,*")
9481 (set_attr "type" "sselog,sselog,sselog,ssemov,ssemov,ssemov")
9482 (set (attr "prefix_data16")
9483 (if_then_else (eq_attr "alternative" "3,5")
9485 (const_string "*")))
9486 (set_attr "prefix" "orig,maybe_evex,maybe_vex,orig,maybe_evex,maybe_vex")
9487 (set_attr "mode" "V2DF,V2DF,DF,V1DF,V1DF,V1DF")])
9490 [(set (match_operand:V2DF 0 "memory_operand")
9493 (match_operand:V2DF 1 "register_operand")
9495 (parallel [(const_int 0)
9497 "TARGET_SSE3 && reload_completed"
9500 rtx low = gen_lowpart (DFmode, operands[1]);
9502 emit_move_insn (adjust_address (operands[0], DFmode, 0), low);
9503 emit_move_insn (adjust_address (operands[0], DFmode, 8), low);
9508 [(set (match_operand:V2DF 0 "register_operand")
9511 (match_operand:V2DF 1 "memory_operand")
9513 (parallel [(match_operand:SI 2 "const_0_to_1_operand")
9514 (match_operand:SI 3 "const_int_operand")])))]
9515 "TARGET_SSE3 && INTVAL (operands[2]) + 2 == INTVAL (operands[3])"
9516 [(set (match_dup 0) (vec_duplicate:V2DF (match_dup 1)))]
9518 operands[1] = adjust_address (operands[1], DFmode, INTVAL (operands[2]) * 8);
9521 (define_insn "avx512f_vmscalef<mode><mask_scalar_name><round_scalar_name>"
9522 [(set (match_operand:VF_128 0 "register_operand" "=v")
9525 [(match_operand:VF_128 1 "register_operand" "v")
9526 (match_operand:VF_128 2 "<round_scalar_nimm_predicate>" "<round_scalar_constraint>")]
9531 "vscalef<ssescalarmodesuffix>\t{<round_scalar_mask_op3>%2, %1, %0<mask_scalar_operand3>|%0<mask_scalar_operand3>, %1, %2<round_scalar_mask_op3>}"
9532 [(set_attr "prefix" "evex")
9533 (set_attr "mode" "<ssescalarmode>")])
9535 (define_insn "<avx512>_scalef<mode><mask_name><round_name>"
9536 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
9538 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
9539 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")]
9542 "vscalef<ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
9543 [(set_attr "prefix" "evex")
9544 (set_attr "mode" "<MODE>")])
9546 (define_expand "<avx512>_vternlog<mode>_maskz"
9547 [(match_operand:VI48_AVX512VL 0 "register_operand")
9548 (match_operand:VI48_AVX512VL 1 "register_operand")
9549 (match_operand:VI48_AVX512VL 2 "register_operand")
9550 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand")
9551 (match_operand:SI 4 "const_0_to_255_operand")
9552 (match_operand:<avx512fmaskmode> 5 "register_operand")]
9555 emit_insn (gen_<avx512>_vternlog<mode>_maskz_1 (
9556 operands[0], operands[1], operands[2], operands[3],
9557 operands[4], CONST0_RTX (<MODE>mode), operands[5]));
9561 (define_insn "<avx512>_vternlog<mode><sd_maskz_name>"
9562 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
9563 (unspec:VI48_AVX512VL
9564 [(match_operand:VI48_AVX512VL 1 "register_operand" "0")
9565 (match_operand:VI48_AVX512VL 2 "register_operand" "v")
9566 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand" "vm")
9567 (match_operand:SI 4 "const_0_to_255_operand")]
9570 "vpternlog<ssemodesuffix>\t{%4, %3, %2, %0<sd_mask_op5>|%0<sd_mask_op5>, %2, %3, %4}"
9571 [(set_attr "type" "sselog")
9572 (set_attr "prefix" "evex")
9573 (set_attr "mode" "<sseinsnmode>")])
9575 (define_insn "<avx512>_vternlog<mode>_mask"
9576 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
9577 (vec_merge:VI48_AVX512VL
9578 (unspec:VI48_AVX512VL
9579 [(match_operand:VI48_AVX512VL 1 "register_operand" "0")
9580 (match_operand:VI48_AVX512VL 2 "register_operand" "v")
9581 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand" "vm")
9582 (match_operand:SI 4 "const_0_to_255_operand")]
9585 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
9587 "vpternlog<ssemodesuffix>\t{%4, %3, %2, %0%{%5%}|%0%{%5%}, %2, %3, %4}"
9588 [(set_attr "type" "sselog")
9589 (set_attr "prefix" "evex")
9590 (set_attr "mode" "<sseinsnmode>")])
9592 (define_insn "<avx512>_getexp<mode><mask_name><round_saeonly_name>"
9593 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
9594 (unspec:VF_AVX512VL [(match_operand:VF_AVX512VL 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
9597 "vgetexp<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}";
9598 [(set_attr "prefix" "evex")
9599 (set_attr "mode" "<MODE>")])
9601 (define_insn "avx512f_sgetexp<mode><mask_scalar_name><round_saeonly_scalar_name>"
9602 [(set (match_operand:VF_128 0 "register_operand" "=v")
9605 [(match_operand:VF_128 1 "register_operand" "v")
9606 (match_operand:VF_128 2 "<round_saeonly_scalar_nimm_predicate>" "<round_saeonly_scalar_constraint>")]
9611 "vgetexp<ssescalarmodesuffix>\t{<round_saeonly_scalar_mask_op3>%2, %1, %0<mask_scalar_operand3>|%0<mask_scalar_operand3>, %1, %<iptr>2<round_saeonly_scalar_mask_op3>}";
9612 [(set_attr "prefix" "evex")
9613 (set_attr "mode" "<ssescalarmode>")])
9615 (define_insn "<mask_codefor><avx512>_align<mode><mask_name>"
9616 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
9617 (unspec:VI48_AVX512VL [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
9618 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")
9619 (match_operand:SI 3 "const_0_to_255_operand")]
9622 "valign<ssemodesuffix>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3}";
9623 [(set_attr "prefix" "evex")
9624 (set_attr "mode" "<sseinsnmode>")])
9626 (define_expand "avx512f_shufps512_mask"
9627 [(match_operand:V16SF 0 "register_operand")
9628 (match_operand:V16SF 1 "register_operand")
9629 (match_operand:V16SF 2 "nonimmediate_operand")
9630 (match_operand:SI 3 "const_0_to_255_operand")
9631 (match_operand:V16SF 4 "register_operand")
9632 (match_operand:HI 5 "register_operand")]
9635 int mask = INTVAL (operands[3]);
9636 emit_insn (gen_avx512f_shufps512_1_mask (operands[0], operands[1], operands[2],
9637 GEN_INT ((mask >> 0) & 3),
9638 GEN_INT ((mask >> 2) & 3),
9639 GEN_INT (((mask >> 4) & 3) + 16),
9640 GEN_INT (((mask >> 6) & 3) + 16),
9641 GEN_INT (((mask >> 0) & 3) + 4),
9642 GEN_INT (((mask >> 2) & 3) + 4),
9643 GEN_INT (((mask >> 4) & 3) + 20),
9644 GEN_INT (((mask >> 6) & 3) + 20),
9645 GEN_INT (((mask >> 0) & 3) + 8),
9646 GEN_INT (((mask >> 2) & 3) + 8),
9647 GEN_INT (((mask >> 4) & 3) + 24),
9648 GEN_INT (((mask >> 6) & 3) + 24),
9649 GEN_INT (((mask >> 0) & 3) + 12),
9650 GEN_INT (((mask >> 2) & 3) + 12),
9651 GEN_INT (((mask >> 4) & 3) + 28),
9652 GEN_INT (((mask >> 6) & 3) + 28),
9653 operands[4], operands[5]));
9658 (define_expand "<avx512>_fixupimm<mode>_maskz<round_saeonly_expand_name>"
9659 [(match_operand:VF_AVX512VL 0 "register_operand")
9660 (match_operand:VF_AVX512VL 1 "register_operand")
9661 (match_operand:VF_AVX512VL 2 "register_operand")
9662 (match_operand:<sseintvecmode> 3 "<round_saeonly_expand_nimm_predicate>")
9663 (match_operand:SI 4 "const_0_to_255_operand")
9664 (match_operand:<avx512fmaskmode> 5 "register_operand")]
9667 emit_insn (gen_<avx512>_fixupimm<mode>_maskz_1<round_saeonly_expand_name> (
9668 operands[0], operands[1], operands[2], operands[3],
9669 operands[4], CONST0_RTX (<MODE>mode), operands[5]
9670 <round_saeonly_expand_operand6>));
9674 (define_insn "<avx512>_fixupimm<mode><sd_maskz_name><round_saeonly_name>"
9675 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
9677 [(match_operand:VF_AVX512VL 1 "register_operand" "0")
9678 (match_operand:VF_AVX512VL 2 "register_operand" "v")
9679 (match_operand:<sseintvecmode> 3 "nonimmediate_operand" "<round_saeonly_constraint>")
9680 (match_operand:SI 4 "const_0_to_255_operand")]
9683 "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}";
9684 [(set_attr "prefix" "evex")
9685 (set_attr "mode" "<MODE>")])
9687 (define_insn "<avx512>_fixupimm<mode>_mask<round_saeonly_name>"
9688 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
9689 (vec_merge:VF_AVX512VL
9691 [(match_operand:VF_AVX512VL 1 "register_operand" "0")
9692 (match_operand:VF_AVX512VL 2 "register_operand" "v")
9693 (match_operand:<sseintvecmode> 3 "nonimmediate_operand" "<round_saeonly_constraint>")
9694 (match_operand:SI 4 "const_0_to_255_operand")]
9697 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
9699 "vfixupimm<ssemodesuffix>\t{%4, <round_saeonly_op6>%3, %2, %0%{%5%}|%0%{%5%}, %2, %3<round_saeonly_op6>, %4}";
9700 [(set_attr "prefix" "evex")
9701 (set_attr "mode" "<MODE>")])
9703 (define_expand "avx512f_sfixupimm<mode>_maskz<round_saeonly_expand_name>"
9704 [(match_operand:VF_128 0 "register_operand")
9705 (match_operand:VF_128 1 "register_operand")
9706 (match_operand:VF_128 2 "register_operand")
9707 (match_operand:<sseintvecmode> 3 "<round_saeonly_expand_nimm_predicate>")
9708 (match_operand:SI 4 "const_0_to_255_operand")
9709 (match_operand:<avx512fmaskmode> 5 "register_operand")]
9712 emit_insn (gen_avx512f_sfixupimm<mode>_maskz_1<round_saeonly_expand_name> (
9713 operands[0], operands[1], operands[2], operands[3],
9714 operands[4], CONST0_RTX (<MODE>mode), operands[5]
9715 <round_saeonly_expand_operand6>));
9719 (define_insn "avx512f_sfixupimm<mode><sd_maskz_name><round_saeonly_name>"
9720 [(set (match_operand:VF_128 0 "register_operand" "=v")
9723 [(match_operand:VF_128 1 "register_operand" "0")
9724 (match_operand:VF_128 2 "register_operand" "v")
9725 (match_operand:<sseintvecmode> 3 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
9726 (match_operand:SI 4 "const_0_to_255_operand")]
9731 "vfixupimm<ssescalarmodesuffix>\t{%4, <round_saeonly_sd_mask_op5>%3, %2, %0<sd_mask_op5>|%0<sd_mask_op5>, %2, %<iptr>3<round_saeonly_sd_mask_op5>, %4}";
9732 [(set_attr "prefix" "evex")
9733 (set_attr "mode" "<ssescalarmode>")])
9735 (define_insn "avx512f_sfixupimm<mode>_mask<round_saeonly_name>"
9736 [(set (match_operand:VF_128 0 "register_operand" "=v")
9740 [(match_operand:VF_128 1 "register_operand" "0")
9741 (match_operand:VF_128 2 "register_operand" "v")
9742 (match_operand:<sseintvecmode> 3 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
9743 (match_operand:SI 4 "const_0_to_255_operand")]
9748 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
9750 "vfixupimm<ssescalarmodesuffix>\t{%4, <round_saeonly_op6>%3, %2, %0%{%5%}|%0%{%5%}, %2, %<iptr>3<round_saeonly_op6>, %4}";
9751 [(set_attr "prefix" "evex")
9752 (set_attr "mode" "<ssescalarmode>")])
9754 (define_insn "<avx512>_rndscale<mode><mask_name><round_saeonly_name>"
9755 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
9757 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "<round_saeonly_constraint>")
9758 (match_operand:SI 2 "const_0_to_255_operand")]
9761 "vrndscale<ssemodesuffix>\t{%2, <round_saeonly_mask_op3>%1, %0<mask_operand3>|%0<mask_operand3>, %1<round_saeonly_mask_op3>, %2}"
9762 [(set_attr "length_immediate" "1")
9763 (set_attr "prefix" "evex")
9764 (set_attr "mode" "<MODE>")])
9766 (define_insn "avx512f_rndscale<mode><mask_scalar_name><round_saeonly_scalar_name>"
9767 [(set (match_operand:VF_128 0 "register_operand" "=v")
9770 [(match_operand:VF_128 2 "<round_saeonly_scalar_nimm_predicate>" "<round_saeonly_scalar_constraint>")
9771 (match_operand:SI 3 "const_0_to_255_operand")]
9773 (match_operand:VF_128 1 "register_operand" "v")
9776 "vrndscale<ssescalarmodesuffix>\t{%3, <round_saeonly_scalar_mask_op4>%2, %1, %0<mask_scalar_operand4>|%0<mask_scalar_operand4>, %1, %<iptr>2<round_saeonly_scalar_mask_op4>, %3}"
9777 [(set_attr "length_immediate" "1")
9778 (set_attr "prefix" "evex")
9779 (set_attr "mode" "<MODE>")])
9781 (define_insn "*avx512f_rndscale<mode><round_saeonly_name>"
9782 [(set (match_operand:VF_128 0 "register_operand" "=v")
9784 (vec_duplicate:VF_128
9785 (unspec:<ssescalarmode>
9786 [(match_operand:<ssescalarmode> 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
9787 (match_operand:SI 3 "const_0_to_255_operand")]
9789 (match_operand:VF_128 1 "register_operand" "v")
9792 "vrndscale<ssescalarmodesuffix>\t{%3, <round_saeonly_op4>%2, %1, %0|%0, %1, %2<round_saeonly_op4>, %3}"
9793 [(set_attr "length_immediate" "1")
9794 (set_attr "prefix" "evex")
9795 (set_attr "mode" "<MODE>")])
9797 ;; One bit in mask selects 2 elements.
9798 (define_insn "avx512f_shufps512_1<mask_name>"
9799 [(set (match_operand:V16SF 0 "register_operand" "=v")
9802 (match_operand:V16SF 1 "register_operand" "v")
9803 (match_operand:V16SF 2 "nonimmediate_operand" "vm"))
9804 (parallel [(match_operand 3 "const_0_to_3_operand")
9805 (match_operand 4 "const_0_to_3_operand")
9806 (match_operand 5 "const_16_to_19_operand")
9807 (match_operand 6 "const_16_to_19_operand")
9808 (match_operand 7 "const_4_to_7_operand")
9809 (match_operand 8 "const_4_to_7_operand")
9810 (match_operand 9 "const_20_to_23_operand")
9811 (match_operand 10 "const_20_to_23_operand")
9812 (match_operand 11 "const_8_to_11_operand")
9813 (match_operand 12 "const_8_to_11_operand")
9814 (match_operand 13 "const_24_to_27_operand")
9815 (match_operand 14 "const_24_to_27_operand")
9816 (match_operand 15 "const_12_to_15_operand")
9817 (match_operand 16 "const_12_to_15_operand")
9818 (match_operand 17 "const_28_to_31_operand")
9819 (match_operand 18 "const_28_to_31_operand")])))]
9821 && (INTVAL (operands[3]) == (INTVAL (operands[7]) - 4)
9822 && INTVAL (operands[4]) == (INTVAL (operands[8]) - 4)
9823 && INTVAL (operands[5]) == (INTVAL (operands[9]) - 4)
9824 && INTVAL (operands[6]) == (INTVAL (operands[10]) - 4)
9825 && INTVAL (operands[3]) == (INTVAL (operands[11]) - 8)
9826 && INTVAL (operands[4]) == (INTVAL (operands[12]) - 8)
9827 && INTVAL (operands[5]) == (INTVAL (operands[13]) - 8)
9828 && INTVAL (operands[6]) == (INTVAL (operands[14]) - 8)
9829 && INTVAL (operands[3]) == (INTVAL (operands[15]) - 12)
9830 && INTVAL (operands[4]) == (INTVAL (operands[16]) - 12)
9831 && INTVAL (operands[5]) == (INTVAL (operands[17]) - 12)
9832 && INTVAL (operands[6]) == (INTVAL (operands[18]) - 12))"
9835 mask = INTVAL (operands[3]);
9836 mask |= INTVAL (operands[4]) << 2;
9837 mask |= (INTVAL (operands[5]) - 16) << 4;
9838 mask |= (INTVAL (operands[6]) - 16) << 6;
9839 operands[3] = GEN_INT (mask);
9841 return "vshufps\t{%3, %2, %1, %0<mask_operand19>|%0<mask_operand19>, %1, %2, %3}";
9843 [(set_attr "type" "sselog")
9844 (set_attr "length_immediate" "1")
9845 (set_attr "prefix" "evex")
9846 (set_attr "mode" "V16SF")])
9848 (define_expand "avx512f_shufpd512_mask"
9849 [(match_operand:V8DF 0 "register_operand")
9850 (match_operand:V8DF 1 "register_operand")
9851 (match_operand:V8DF 2 "nonimmediate_operand")
9852 (match_operand:SI 3 "const_0_to_255_operand")
9853 (match_operand:V8DF 4 "register_operand")
9854 (match_operand:QI 5 "register_operand")]
9857 int mask = INTVAL (operands[3]);
9858 emit_insn (gen_avx512f_shufpd512_1_mask (operands[0], operands[1], operands[2],
9860 GEN_INT (mask & 2 ? 9 : 8),
9861 GEN_INT (mask & 4 ? 3 : 2),
9862 GEN_INT (mask & 8 ? 11 : 10),
9863 GEN_INT (mask & 16 ? 5 : 4),
9864 GEN_INT (mask & 32 ? 13 : 12),
9865 GEN_INT (mask & 64 ? 7 : 6),
9866 GEN_INT (mask & 128 ? 15 : 14),
9867 operands[4], operands[5]));
9871 (define_insn "avx512f_shufpd512_1<mask_name>"
9872 [(set (match_operand:V8DF 0 "register_operand" "=v")
9875 (match_operand:V8DF 1 "register_operand" "v")
9876 (match_operand:V8DF 2 "nonimmediate_operand" "vm"))
9877 (parallel [(match_operand 3 "const_0_to_1_operand")
9878 (match_operand 4 "const_8_to_9_operand")
9879 (match_operand 5 "const_2_to_3_operand")
9880 (match_operand 6 "const_10_to_11_operand")
9881 (match_operand 7 "const_4_to_5_operand")
9882 (match_operand 8 "const_12_to_13_operand")
9883 (match_operand 9 "const_6_to_7_operand")
9884 (match_operand 10 "const_14_to_15_operand")])))]
9888 mask = INTVAL (operands[3]);
9889 mask |= (INTVAL (operands[4]) - 8) << 1;
9890 mask |= (INTVAL (operands[5]) - 2) << 2;
9891 mask |= (INTVAL (operands[6]) - 10) << 3;
9892 mask |= (INTVAL (operands[7]) - 4) << 4;
9893 mask |= (INTVAL (operands[8]) - 12) << 5;
9894 mask |= (INTVAL (operands[9]) - 6) << 6;
9895 mask |= (INTVAL (operands[10]) - 14) << 7;
9896 operands[3] = GEN_INT (mask);
9898 return "vshufpd\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
9900 [(set_attr "type" "sselog")
9901 (set_attr "length_immediate" "1")
9902 (set_attr "prefix" "evex")
9903 (set_attr "mode" "V8DF")])
9905 (define_expand "avx_shufpd256<mask_expand4_name>"
9906 [(match_operand:V4DF 0 "register_operand")
9907 (match_operand:V4DF 1 "register_operand")
9908 (match_operand:V4DF 2 "nonimmediate_operand")
9909 (match_operand:SI 3 "const_int_operand")]
9912 int mask = INTVAL (operands[3]);
9913 emit_insn (gen_avx_shufpd256_1<mask_expand4_name> (operands[0],
9917 GEN_INT (mask & 2 ? 5 : 4),
9918 GEN_INT (mask & 4 ? 3 : 2),
9919 GEN_INT (mask & 8 ? 7 : 6)
9920 <mask_expand4_args>));
9924 (define_insn "avx_shufpd256_1<mask_name>"
9925 [(set (match_operand:V4DF 0 "register_operand" "=v")
9928 (match_operand:V4DF 1 "register_operand" "v")
9929 (match_operand:V4DF 2 "nonimmediate_operand" "vm"))
9930 (parallel [(match_operand 3 "const_0_to_1_operand")
9931 (match_operand 4 "const_4_to_5_operand")
9932 (match_operand 5 "const_2_to_3_operand")
9933 (match_operand 6 "const_6_to_7_operand")])))]
9934 "TARGET_AVX && <mask_avx512vl_condition>"
9937 mask = INTVAL (operands[3]);
9938 mask |= (INTVAL (operands[4]) - 4) << 1;
9939 mask |= (INTVAL (operands[5]) - 2) << 2;
9940 mask |= (INTVAL (operands[6]) - 6) << 3;
9941 operands[3] = GEN_INT (mask);
9943 return "vshufpd\t{%3, %2, %1, %0<mask_operand7>|%0<mask_operand7>, %1, %2, %3}";
9945 [(set_attr "type" "sseshuf")
9946 (set_attr "length_immediate" "1")
9947 (set_attr "prefix" "vex")
9948 (set_attr "mode" "V4DF")])
9950 (define_expand "sse2_shufpd<mask_expand4_name>"
9951 [(match_operand:V2DF 0 "register_operand")
9952 (match_operand:V2DF 1 "register_operand")
9953 (match_operand:V2DF 2 "vector_operand")
9954 (match_operand:SI 3 "const_int_operand")]
9957 int mask = INTVAL (operands[3]);
9958 emit_insn (gen_sse2_shufpd_v2df<mask_expand4_name> (operands[0], operands[1],
9959 operands[2], GEN_INT (mask & 1),
9960 GEN_INT (mask & 2 ? 3 : 2)
9961 <mask_expand4_args>));
9965 (define_insn "sse2_shufpd_v2df_mask"
9966 [(set (match_operand:V2DF 0 "register_operand" "=v")
9970 (match_operand:V2DF 1 "register_operand" "v")
9971 (match_operand:V2DF 2 "nonimmediate_operand" "vm"))
9972 (parallel [(match_operand 3 "const_0_to_1_operand")
9973 (match_operand 4 "const_2_to_3_operand")]))
9974 (match_operand:V2DF 5 "nonimm_or_0_operand" "0C")
9975 (match_operand:QI 6 "register_operand" "Yk")))]
9979 mask = INTVAL (operands[3]);
9980 mask |= (INTVAL (operands[4]) - 2) << 1;
9981 operands[3] = GEN_INT (mask);
9983 return "vshufpd\t{%3, %2, %1, %0%{%6%}%N5|%0%{%6%}%N5, %1, %2, %3}";
9985 [(set_attr "type" "sseshuf")
9986 (set_attr "length_immediate" "1")
9987 (set_attr "prefix" "evex")
9988 (set_attr "mode" "V2DF")])
9990 ;; punpcklqdq and punpckhqdq are shorter than shufpd.
9991 (define_insn "avx2_interleave_highv4di<mask_name>"
9992 [(set (match_operand:V4DI 0 "register_operand" "=v")
9995 (match_operand:V4DI 1 "register_operand" "v")
9996 (match_operand:V4DI 2 "nonimmediate_operand" "vm"))
9997 (parallel [(const_int 1)
10001 "TARGET_AVX2 && <mask_avx512vl_condition>"
10002 "vpunpckhqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10003 [(set_attr "type" "sselog")
10004 (set_attr "prefix" "vex")
10005 (set_attr "mode" "OI")])
10007 (define_insn "<mask_codefor>avx512f_interleave_highv8di<mask_name>"
10008 [(set (match_operand:V8DI 0 "register_operand" "=v")
10011 (match_operand:V8DI 1 "register_operand" "v")
10012 (match_operand:V8DI 2 "nonimmediate_operand" "vm"))
10013 (parallel [(const_int 1) (const_int 9)
10014 (const_int 3) (const_int 11)
10015 (const_int 5) (const_int 13)
10016 (const_int 7) (const_int 15)])))]
10018 "vpunpckhqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10019 [(set_attr "type" "sselog")
10020 (set_attr "prefix" "evex")
10021 (set_attr "mode" "XI")])
10023 (define_insn "vec_interleave_highv2di<mask_name>"
10024 [(set (match_operand:V2DI 0 "register_operand" "=x,v")
10027 (match_operand:V2DI 1 "register_operand" "0,v")
10028 (match_operand:V2DI 2 "vector_operand" "xBm,vm"))
10029 (parallel [(const_int 1)
10031 "TARGET_SSE2 && <mask_avx512vl_condition>"
10033 punpckhqdq\t{%2, %0|%0, %2}
10034 vpunpckhqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10035 [(set_attr "isa" "noavx,avx")
10036 (set_attr "type" "sselog")
10037 (set_attr "prefix_data16" "1,*")
10038 (set_attr "prefix" "orig,<mask_prefix>")
10039 (set_attr "mode" "TI")])
10041 (define_insn "avx2_interleave_lowv4di<mask_name>"
10042 [(set (match_operand:V4DI 0 "register_operand" "=v")
10045 (match_operand:V4DI 1 "register_operand" "v")
10046 (match_operand:V4DI 2 "nonimmediate_operand" "vm"))
10047 (parallel [(const_int 0)
10051 "TARGET_AVX2 && <mask_avx512vl_condition>"
10052 "vpunpcklqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10053 [(set_attr "type" "sselog")
10054 (set_attr "prefix" "vex")
10055 (set_attr "mode" "OI")])
10057 (define_insn "<mask_codefor>avx512f_interleave_lowv8di<mask_name>"
10058 [(set (match_operand:V8DI 0 "register_operand" "=v")
10061 (match_operand:V8DI 1 "register_operand" "v")
10062 (match_operand:V8DI 2 "nonimmediate_operand" "vm"))
10063 (parallel [(const_int 0) (const_int 8)
10064 (const_int 2) (const_int 10)
10065 (const_int 4) (const_int 12)
10066 (const_int 6) (const_int 14)])))]
10068 "vpunpcklqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10069 [(set_attr "type" "sselog")
10070 (set_attr "prefix" "evex")
10071 (set_attr "mode" "XI")])
10073 (define_insn "vec_interleave_lowv2di<mask_name>"
10074 [(set (match_operand:V2DI 0 "register_operand" "=x,v")
10077 (match_operand:V2DI 1 "register_operand" "0,v")
10078 (match_operand:V2DI 2 "vector_operand" "xBm,vm"))
10079 (parallel [(const_int 0)
10081 "TARGET_SSE2 && <mask_avx512vl_condition>"
10083 punpcklqdq\t{%2, %0|%0, %2}
10084 vpunpcklqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10085 [(set_attr "isa" "noavx,avx")
10086 (set_attr "type" "sselog")
10087 (set_attr "prefix_data16" "1,*")
10088 (set_attr "prefix" "orig,vex")
10089 (set_attr "mode" "TI")])
10091 (define_insn "sse2_shufpd_<mode>"
10092 [(set (match_operand:VI8F_128 0 "register_operand" "=x,v")
10093 (vec_select:VI8F_128
10094 (vec_concat:<ssedoublevecmode>
10095 (match_operand:VI8F_128 1 "register_operand" "0,v")
10096 (match_operand:VI8F_128 2 "vector_operand" "xBm,vm"))
10097 (parallel [(match_operand 3 "const_0_to_1_operand")
10098 (match_operand 4 "const_2_to_3_operand")])))]
10102 mask = INTVAL (operands[3]);
10103 mask |= (INTVAL (operands[4]) - 2) << 1;
10104 operands[3] = GEN_INT (mask);
10106 switch (which_alternative)
10109 return "shufpd\t{%3, %2, %0|%0, %2, %3}";
10111 return "vshufpd\t{%3, %2, %1, %0|%0, %1, %2, %3}";
10113 gcc_unreachable ();
10116 [(set_attr "isa" "noavx,avx")
10117 (set_attr "type" "sseshuf")
10118 (set_attr "length_immediate" "1")
10119 (set_attr "prefix" "orig,maybe_evex")
10120 (set_attr "mode" "V2DF")])
10122 ;; Avoid combining registers from different units in a single alternative,
10123 ;; see comment above inline_secondary_memory_needed function in i386.c
10124 (define_insn "sse2_storehpd"
10125 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,Yv,x,*f,r")
10127 (match_operand:V2DF 1 "nonimmediate_operand" " v,0, v,o,o,o")
10128 (parallel [(const_int 1)])))]
10129 "TARGET_SSE2 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
10131 %vmovhpd\t{%1, %0|%0, %1}
10133 vunpckhpd\t{%d1, %0|%0, %d1}
10137 [(set_attr "isa" "*,noavx,avx,*,*,*")
10138 (set_attr "type" "ssemov,sselog1,sselog1,ssemov,fmov,imov")
10139 (set (attr "prefix_data16")
10141 (and (eq_attr "alternative" "0")
10142 (not (match_test "TARGET_AVX")))
10144 (const_string "*")))
10145 (set_attr "prefix" "maybe_vex,orig,maybe_evex,*,*,*")
10146 (set_attr "mode" "V1DF,V1DF,V2DF,DF,DF,DF")])
10149 [(set (match_operand:DF 0 "register_operand")
10151 (match_operand:V2DF 1 "memory_operand")
10152 (parallel [(const_int 1)])))]
10153 "TARGET_SSE2 && reload_completed"
10154 [(set (match_dup 0) (match_dup 1))]
10155 "operands[1] = adjust_address (operands[1], DFmode, 8);")
10157 (define_insn "*vec_extractv2df_1_sse"
10158 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,x")
10160 (match_operand:V2DF 1 "nonimmediate_operand" "x,x,o")
10161 (parallel [(const_int 1)])))]
10162 "!TARGET_SSE2 && TARGET_SSE
10163 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
10165 movhps\t{%1, %0|%0, %1}
10166 movhlps\t{%1, %0|%0, %1}
10167 movlps\t{%H1, %0|%0, %H1}"
10168 [(set_attr "type" "ssemov")
10169 (set_attr "mode" "V2SF,V4SF,V2SF")])
10171 ;; Avoid combining registers from different units in a single alternative,
10172 ;; see comment above inline_secondary_memory_needed function in i386.c
10173 (define_insn "sse2_storelpd"
10174 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,x,*f,r")
10176 (match_operand:V2DF 1 "nonimmediate_operand" " v,x,m,m,m")
10177 (parallel [(const_int 0)])))]
10178 "TARGET_SSE2 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
10180 %vmovlpd\t{%1, %0|%0, %1}
10185 [(set_attr "type" "ssemov,ssemov,ssemov,fmov,imov")
10186 (set (attr "prefix_data16")
10187 (if_then_else (eq_attr "alternative" "0")
10189 (const_string "*")))
10190 (set_attr "prefix" "maybe_vex")
10191 (set_attr "mode" "V1DF,DF,DF,DF,DF")])
10194 [(set (match_operand:DF 0 "register_operand")
10196 (match_operand:V2DF 1 "nonimmediate_operand")
10197 (parallel [(const_int 0)])))]
10198 "TARGET_SSE2 && reload_completed"
10199 [(set (match_dup 0) (match_dup 1))]
10200 "operands[1] = gen_lowpart (DFmode, operands[1]);")
10202 (define_insn "*vec_extractv2df_0_sse"
10203 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,x")
10205 (match_operand:V2DF 1 "nonimmediate_operand" "x,x,m")
10206 (parallel [(const_int 0)])))]
10207 "!TARGET_SSE2 && TARGET_SSE
10208 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
10210 movlps\t{%1, %0|%0, %1}
10211 movaps\t{%1, %0|%0, %1}
10212 movlps\t{%1, %0|%0, %q1}"
10213 [(set_attr "type" "ssemov")
10214 (set_attr "mode" "V2SF,V4SF,V2SF")])
10216 (define_expand "sse2_loadhpd_exp"
10217 [(set (match_operand:V2DF 0 "nonimmediate_operand")
10220 (match_operand:V2DF 1 "nonimmediate_operand")
10221 (parallel [(const_int 0)]))
10222 (match_operand:DF 2 "nonimmediate_operand")))]
10225 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V2DFmode, operands);
10227 emit_insn (gen_sse2_loadhpd (dst, operands[1], operands[2]));
10229 /* Fix up the destination if needed. */
10230 if (dst != operands[0])
10231 emit_move_insn (operands[0], dst);
10236 ;; Avoid combining registers from different units in a single alternative,
10237 ;; see comment above inline_secondary_memory_needed function in i386.c
10238 (define_insn "sse2_loadhpd"
10239 [(set (match_operand:V2DF 0 "nonimmediate_operand"
10240 "=x,v,x,v ,o,o ,o")
10243 (match_operand:V2DF 1 "nonimmediate_operand"
10244 " 0,v,0,v ,0,0 ,0")
10245 (parallel [(const_int 0)]))
10246 (match_operand:DF 2 "nonimmediate_operand"
10247 " m,m,x,Yv,x,*f,r")))]
10248 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10250 movhpd\t{%2, %0|%0, %2}
10251 vmovhpd\t{%2, %1, %0|%0, %1, %2}
10252 unpcklpd\t{%2, %0|%0, %2}
10253 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
10257 [(set_attr "isa" "noavx,avx,noavx,avx,*,*,*")
10258 (set_attr "type" "ssemov,ssemov,sselog,sselog,ssemov,fmov,imov")
10259 (set (attr "prefix_data16")
10260 (if_then_else (eq_attr "alternative" "0")
10262 (const_string "*")))
10263 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,*,*,*")
10264 (set_attr "mode" "V1DF,V1DF,V2DF,V2DF,DF,DF,DF")])
10267 [(set (match_operand:V2DF 0 "memory_operand")
10269 (vec_select:DF (match_dup 0) (parallel [(const_int 0)]))
10270 (match_operand:DF 1 "register_operand")))]
10271 "TARGET_SSE2 && reload_completed"
10272 [(set (match_dup 0) (match_dup 1))]
10273 "operands[0] = adjust_address (operands[0], DFmode, 8);")
10275 (define_expand "sse2_loadlpd_exp"
10276 [(set (match_operand:V2DF 0 "nonimmediate_operand")
10278 (match_operand:DF 2 "nonimmediate_operand")
10280 (match_operand:V2DF 1 "nonimmediate_operand")
10281 (parallel [(const_int 1)]))))]
10284 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V2DFmode, operands);
10286 emit_insn (gen_sse2_loadlpd (dst, operands[1], operands[2]));
10288 /* Fix up the destination if needed. */
10289 if (dst != operands[0])
10290 emit_move_insn (operands[0], dst);
10295 ;; Avoid combining registers from different units in a single alternative,
10296 ;; see comment above inline_secondary_memory_needed function in i386.c
10297 (define_insn "sse2_loadlpd"
10298 [(set (match_operand:V2DF 0 "nonimmediate_operand"
10299 "=v,x,v,x,v,x,x,v,m,m ,m")
10301 (match_operand:DF 2 "nonimmediate_operand"
10302 "vm,m,m,x,v,0,0,v,x,*f,r")
10304 (match_operand:V2DF 1 "nonimm_or_0_operand"
10305 " C,0,v,0,v,x,o,o,0,0 ,0")
10306 (parallel [(const_int 1)]))))]
10307 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10309 %vmovq\t{%2, %0|%0, %2}
10310 movlpd\t{%2, %0|%0, %2}
10311 vmovlpd\t{%2, %1, %0|%0, %1, %2}
10312 movsd\t{%2, %0|%0, %2}
10313 vmovsd\t{%2, %1, %0|%0, %1, %2}
10314 shufpd\t{$2, %1, %0|%0, %1, 2}
10315 movhpd\t{%H1, %0|%0, %H1}
10316 vmovhpd\t{%H1, %2, %0|%0, %2, %H1}
10320 [(set_attr "isa" "*,noavx,avx,noavx,avx,noavx,noavx,avx,*,*,*")
10322 (cond [(eq_attr "alternative" "5")
10323 (const_string "sselog")
10324 (eq_attr "alternative" "9")
10325 (const_string "fmov")
10326 (eq_attr "alternative" "10")
10327 (const_string "imov")
10329 (const_string "ssemov")))
10330 (set (attr "prefix_data16")
10331 (if_then_else (eq_attr "alternative" "1,6")
10333 (const_string "*")))
10334 (set (attr "length_immediate")
10335 (if_then_else (eq_attr "alternative" "5")
10337 (const_string "*")))
10338 (set (attr "prefix")
10339 (cond [(eq_attr "alternative" "0")
10340 (const_string "maybe_vex")
10341 (eq_attr "alternative" "1,3,5,6")
10342 (const_string "orig")
10343 (eq_attr "alternative" "2,4,7")
10344 (const_string "maybe_evex")
10346 (const_string "*")))
10347 (set_attr "mode" "DF,V1DF,V1DF,V1DF,V1DF,V2DF,V1DF,V1DF,DF,DF,DF")])
10350 [(set (match_operand:V2DF 0 "memory_operand")
10352 (match_operand:DF 1 "register_operand")
10353 (vec_select:DF (match_dup 0) (parallel [(const_int 1)]))))]
10354 "TARGET_SSE2 && reload_completed"
10355 [(set (match_dup 0) (match_dup 1))]
10356 "operands[0] = adjust_address (operands[0], DFmode, 0);")
10358 (define_insn "sse2_movsd"
10359 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,v,x,v,m,x,x,v,o")
10361 (match_operand:V2DF 2 "nonimmediate_operand" " x,v,m,m,v,0,0,v,0")
10362 (match_operand:V2DF 1 "nonimmediate_operand" " 0,v,0,v,0,x,o,o,v")
10366 movsd\t{%2, %0|%0, %2}
10367 vmovsd\t{%2, %1, %0|%0, %1, %2}
10368 movlpd\t{%2, %0|%0, %q2}
10369 vmovlpd\t{%2, %1, %0|%0, %1, %q2}
10370 %vmovlpd\t{%2, %0|%q0, %2}
10371 shufpd\t{$2, %1, %0|%0, %1, 2}
10372 movhps\t{%H1, %0|%0, %H1}
10373 vmovhps\t{%H1, %2, %0|%0, %2, %H1}
10374 %vmovhps\t{%1, %H0|%H0, %1}"
10375 [(set_attr "isa" "noavx,avx,noavx,avx,*,noavx,noavx,avx,*")
10378 (eq_attr "alternative" "5")
10379 (const_string "sselog")
10380 (const_string "ssemov")))
10381 (set (attr "prefix_data16")
10383 (and (eq_attr "alternative" "2,4")
10384 (not (match_test "TARGET_AVX")))
10386 (const_string "*")))
10387 (set (attr "length_immediate")
10388 (if_then_else (eq_attr "alternative" "5")
10390 (const_string "*")))
10391 (set (attr "prefix")
10392 (cond [(eq_attr "alternative" "1,3,7")
10393 (const_string "maybe_evex")
10394 (eq_attr "alternative" "4,8")
10395 (const_string "maybe_vex")
10397 (const_string "orig")))
10398 (set_attr "mode" "DF,DF,V1DF,V1DF,V1DF,V2DF,V1DF,V1DF,V1DF")])
10400 (define_insn "vec_dupv2df<mask_name>"
10401 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
10402 (vec_duplicate:V2DF
10403 (match_operand:DF 1 "nonimmediate_operand" " 0,xm,vm")))]
10404 "TARGET_SSE2 && <mask_avx512vl_condition>"
10407 %vmovddup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}
10408 vmovddup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
10409 [(set_attr "isa" "noavx,sse3,avx512vl")
10410 (set_attr "type" "sselog1")
10411 (set_attr "prefix" "orig,maybe_vex,evex")
10412 (set_attr "mode" "V2DF,DF,DF")])
10414 (define_insn "vec_concatv2df"
10415 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v,x,v,x,x, v,x,x")
10417 (match_operand:DF 1 "nonimmediate_operand" " 0,x,v,m,m,0,x,vm,0,0")
10418 (match_operand:DF 2 "nonimm_or_0_operand" " x,x,v,1,1,m,m, C,x,m")))]
10420 && (!(MEM_P (operands[1]) && MEM_P (operands[2]))
10421 || (TARGET_SSE3 && rtx_equal_p (operands[1], operands[2])))"
10423 unpcklpd\t{%2, %0|%0, %2}
10424 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
10425 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
10426 %vmovddup\t{%1, %0|%0, %1}
10427 vmovddup\t{%1, %0|%0, %1}
10428 movhpd\t{%2, %0|%0, %2}
10429 vmovhpd\t{%2, %1, %0|%0, %1, %2}
10430 %vmovq\t{%1, %0|%0, %1}
10431 movlhps\t{%2, %0|%0, %2}
10432 movhps\t{%2, %0|%0, %2}"
10434 (cond [(eq_attr "alternative" "0,5")
10435 (const_string "sse2_noavx")
10436 (eq_attr "alternative" "1,6")
10437 (const_string "avx")
10438 (eq_attr "alternative" "2,4")
10439 (const_string "avx512vl")
10440 (eq_attr "alternative" "3")
10441 (const_string "sse3")
10442 (eq_attr "alternative" "7")
10443 (const_string "sse2")
10445 (const_string "noavx")))
10448 (eq_attr "alternative" "0,1,2,3,4")
10449 (const_string "sselog")
10450 (const_string "ssemov")))
10451 (set (attr "prefix_data16")
10452 (if_then_else (eq_attr "alternative" "5")
10454 (const_string "*")))
10455 (set (attr "prefix")
10456 (cond [(eq_attr "alternative" "1,6")
10457 (const_string "vex")
10458 (eq_attr "alternative" "2,4")
10459 (const_string "evex")
10460 (eq_attr "alternative" "3,7")
10461 (const_string "maybe_vex")
10463 (const_string "orig")))
10464 (set_attr "mode" "V2DF,V2DF,V2DF, DF, DF, V1DF,V1DF,DF,V4SF,V2SF")])
10466 ;; vmovq clears also the higher bits.
10467 (define_insn "vec_set<mode>_0"
10468 [(set (match_operand:VF2_512_256 0 "register_operand" "=v")
10469 (vec_merge:VF2_512_256
10470 (vec_duplicate:VF2_512_256
10471 (match_operand:<ssescalarmode> 2 "nonimmediate_operand" "xm"))
10472 (match_operand:VF2_512_256 1 "const0_operand" "C")
10475 "vmovq\t{%2, %x0|%x0, %2}"
10476 [(set_attr "type" "ssemov")
10477 (set_attr "prefix" "maybe_evex")
10478 (set_attr "mode" "DF")])
10480 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
10482 ;; Parallel integer down-conversion operations
10484 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
10486 (define_mode_iterator PMOV_DST_MODE_1 [V16QI V16HI V8SI V8HI])
10487 (define_mode_attr pmov_src_mode
10488 [(V16QI "V16SI") (V16HI "V16SI") (V8SI "V8DI") (V8HI "V8DI")])
10489 (define_mode_attr pmov_src_lower
10490 [(V16QI "v16si") (V16HI "v16si") (V8SI "v8di") (V8HI "v8di")])
10491 (define_mode_attr pmov_suff_1
10492 [(V16QI "db") (V16HI "dw") (V8SI "qd") (V8HI "qw")])
10494 (define_insn "*avx512f_<code><pmov_src_lower><mode>2"
10495 [(set (match_operand:PMOV_DST_MODE_1 0 "nonimmediate_operand" "=v,m")
10496 (any_truncate:PMOV_DST_MODE_1
10497 (match_operand:<pmov_src_mode> 1 "register_operand" "v,v")))]
10499 "vpmov<trunsuffix><pmov_suff_1>\t{%1, %0|%0, %1}"
10500 [(set_attr "type" "ssemov")
10501 (set_attr "memory" "none,store")
10502 (set_attr "prefix" "evex")
10503 (set_attr "mode" "<sseinsnmode>")])
10505 (define_insn "avx512f_<code><pmov_src_lower><mode>2_mask"
10506 [(set (match_operand:PMOV_DST_MODE_1 0 "nonimmediate_operand" "=v,m")
10507 (vec_merge:PMOV_DST_MODE_1
10508 (any_truncate:PMOV_DST_MODE_1
10509 (match_operand:<pmov_src_mode> 1 "register_operand" "v,v"))
10510 (match_operand:PMOV_DST_MODE_1 2 "nonimm_or_0_operand" "0C,0")
10511 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
10513 "vpmov<trunsuffix><pmov_suff_1>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
10514 [(set_attr "type" "ssemov")
10515 (set_attr "memory" "none,store")
10516 (set_attr "prefix" "evex")
10517 (set_attr "mode" "<sseinsnmode>")])
10519 (define_expand "avx512f_<code><pmov_src_lower><mode>2_mask_store"
10520 [(set (match_operand:PMOV_DST_MODE_1 0 "memory_operand")
10521 (vec_merge:PMOV_DST_MODE_1
10522 (any_truncate:PMOV_DST_MODE_1
10523 (match_operand:<pmov_src_mode> 1 "register_operand"))
10525 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
10528 (define_insn "avx512bw_<code>v32hiv32qi2"
10529 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=v,m")
10530 (any_truncate:V32QI
10531 (match_operand:V32HI 1 "register_operand" "v,v")))]
10533 "vpmov<trunsuffix>wb\t{%1, %0|%0, %1}"
10534 [(set_attr "type" "ssemov")
10535 (set_attr "memory" "none,store")
10536 (set_attr "prefix" "evex")
10537 (set_attr "mode" "XI")])
10539 (define_insn "avx512bw_<code>v32hiv32qi2_mask"
10540 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=v,m")
10542 (any_truncate:V32QI
10543 (match_operand:V32HI 1 "register_operand" "v,v"))
10544 (match_operand:V32QI 2 "nonimm_or_0_operand" "0C,0")
10545 (match_operand:SI 3 "register_operand" "Yk,Yk")))]
10547 "vpmov<trunsuffix>wb\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
10548 [(set_attr "type" "ssemov")
10549 (set_attr "memory" "none,store")
10550 (set_attr "prefix" "evex")
10551 (set_attr "mode" "XI")])
10553 (define_expand "avx512bw_<code>v32hiv32qi2_mask_store"
10554 [(set (match_operand:V32QI 0 "nonimmediate_operand")
10556 (any_truncate:V32QI
10557 (match_operand:V32HI 1 "register_operand"))
10559 (match_operand:SI 2 "register_operand")))]
10562 (define_mode_iterator PMOV_DST_MODE_2
10563 [V4SI V8HI (V16QI "TARGET_AVX512BW")])
10564 (define_mode_attr pmov_suff_2
10565 [(V16QI "wb") (V8HI "dw") (V4SI "qd")])
10567 (define_insn "*avx512vl_<code><ssedoublemodelower><mode>2"
10568 [(set (match_operand:PMOV_DST_MODE_2 0 "nonimmediate_operand" "=v,m")
10569 (any_truncate:PMOV_DST_MODE_2
10570 (match_operand:<ssedoublemode> 1 "register_operand" "v,v")))]
10572 "vpmov<trunsuffix><pmov_suff_2>\t{%1, %0|%0, %1}"
10573 [(set_attr "type" "ssemov")
10574 (set_attr "memory" "none,store")
10575 (set_attr "prefix" "evex")
10576 (set_attr "mode" "<sseinsnmode>")])
10578 (define_insn "<avx512>_<code><ssedoublemodelower><mode>2_mask"
10579 [(set (match_operand:PMOV_DST_MODE_2 0 "nonimmediate_operand" "=v,m")
10580 (vec_merge:PMOV_DST_MODE_2
10581 (any_truncate:PMOV_DST_MODE_2
10582 (match_operand:<ssedoublemode> 1 "register_operand" "v,v"))
10583 (match_operand:PMOV_DST_MODE_2 2 "nonimm_or_0_operand" "0C,0")
10584 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
10586 "vpmov<trunsuffix><pmov_suff_2>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
10587 [(set_attr "type" "ssemov")
10588 (set_attr "memory" "none,store")
10589 (set_attr "prefix" "evex")
10590 (set_attr "mode" "<sseinsnmode>")])
10592 (define_expand "<avx512>_<code><ssedoublemodelower><mode>2_mask_store"
10593 [(set (match_operand:PMOV_DST_MODE_2 0 "nonimmediate_operand")
10594 (vec_merge:PMOV_DST_MODE_2
10595 (any_truncate:PMOV_DST_MODE_2
10596 (match_operand:<ssedoublemode> 1 "register_operand"))
10598 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
10601 (define_mode_iterator PMOV_SRC_MODE_3 [V4DI V2DI V8SI V4SI (V8HI "TARGET_AVX512BW")])
10602 (define_mode_attr pmov_dst_3
10603 [(V4DI "V4QI") (V2DI "V2QI") (V8SI "V8QI") (V4SI "V4QI") (V8HI "V8QI")])
10604 (define_mode_attr pmov_dst_zeroed_3
10605 [(V4DI "V12QI") (V2DI "V14QI") (V8SI "V8QI") (V4SI "V12QI") (V8HI "V8QI")])
10606 (define_mode_attr pmov_suff_3
10607 [(V4DI "qb") (V2DI "qb") (V8SI "db") (V4SI "db") (V8HI "wb")])
10609 (define_insn "*avx512vl_<code><mode>v<ssescalarnum>qi2"
10610 [(set (match_operand:V16QI 0 "register_operand" "=v")
10612 (any_truncate:<pmov_dst_3>
10613 (match_operand:PMOV_SRC_MODE_3 1 "register_operand" "v"))
10614 (match_operand:<pmov_dst_zeroed_3> 2 "const0_operand")))]
10616 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0|%0, %1}"
10617 [(set_attr "type" "ssemov")
10618 (set_attr "prefix" "evex")
10619 (set_attr "mode" "TI")])
10621 (define_insn "*avx512vl_<code>v2div2qi2_store"
10622 [(set (match_operand:V16QI 0 "memory_operand" "=m")
10625 (match_operand:V2DI 1 "register_operand" "v"))
10628 (parallel [(const_int 2) (const_int 3)
10629 (const_int 4) (const_int 5)
10630 (const_int 6) (const_int 7)
10631 (const_int 8) (const_int 9)
10632 (const_int 10) (const_int 11)
10633 (const_int 12) (const_int 13)
10634 (const_int 14) (const_int 15)]))))]
10636 "vpmov<trunsuffix>qb\t{%1, %0|%w0, %1}"
10637 [(set_attr "type" "ssemov")
10638 (set_attr "memory" "store")
10639 (set_attr "prefix" "evex")
10640 (set_attr "mode" "TI")])
10642 (define_insn "avx512vl_<code>v2div2qi2_mask"
10643 [(set (match_operand:V16QI 0 "register_operand" "=v")
10647 (match_operand:V2DI 1 "register_operand" "v"))
10649 (match_operand:V16QI 2 "nonimm_or_0_operand" "0C")
10650 (parallel [(const_int 0) (const_int 1)]))
10651 (match_operand:QI 3 "register_operand" "Yk"))
10652 (const_vector:V14QI [(const_int 0) (const_int 0)
10653 (const_int 0) (const_int 0)
10654 (const_int 0) (const_int 0)
10655 (const_int 0) (const_int 0)
10656 (const_int 0) (const_int 0)
10657 (const_int 0) (const_int 0)
10658 (const_int 0) (const_int 0)])))]
10660 "vpmov<trunsuffix>qb\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
10661 [(set_attr "type" "ssemov")
10662 (set_attr "prefix" "evex")
10663 (set_attr "mode" "TI")])
10665 (define_insn "*avx512vl_<code>v2div2qi2_mask_1"
10666 [(set (match_operand:V16QI 0 "register_operand" "=v")
10670 (match_operand:V2DI 1 "register_operand" "v"))
10671 (const_vector:V2QI [(const_int 0) (const_int 0)])
10672 (match_operand:QI 2 "register_operand" "Yk"))
10673 (const_vector:V14QI [(const_int 0) (const_int 0)
10674 (const_int 0) (const_int 0)
10675 (const_int 0) (const_int 0)
10676 (const_int 0) (const_int 0)
10677 (const_int 0) (const_int 0)
10678 (const_int 0) (const_int 0)
10679 (const_int 0) (const_int 0)])))]
10681 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
10682 [(set_attr "type" "ssemov")
10683 (set_attr "prefix" "evex")
10684 (set_attr "mode" "TI")])
10686 (define_insn "avx512vl_<code>v2div2qi2_mask_store"
10687 [(set (match_operand:V16QI 0 "memory_operand" "=m")
10691 (match_operand:V2DI 1 "register_operand" "v"))
10694 (parallel [(const_int 0) (const_int 1)]))
10695 (match_operand:QI 2 "register_operand" "Yk"))
10698 (parallel [(const_int 2) (const_int 3)
10699 (const_int 4) (const_int 5)
10700 (const_int 6) (const_int 7)
10701 (const_int 8) (const_int 9)
10702 (const_int 10) (const_int 11)
10703 (const_int 12) (const_int 13)
10704 (const_int 14) (const_int 15)]))))]
10706 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}|%w0%{%2%}, %1}"
10707 [(set_attr "type" "ssemov")
10708 (set_attr "memory" "store")
10709 (set_attr "prefix" "evex")
10710 (set_attr "mode" "TI")])
10712 (define_insn "*avx512vl_<code><mode>v4qi2_store"
10713 [(set (match_operand:V16QI 0 "memory_operand" "=m")
10716 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
10719 (parallel [(const_int 4) (const_int 5)
10720 (const_int 6) (const_int 7)
10721 (const_int 8) (const_int 9)
10722 (const_int 10) (const_int 11)
10723 (const_int 12) (const_int 13)
10724 (const_int 14) (const_int 15)]))))]
10726 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0|%k0, %1}"
10727 [(set_attr "type" "ssemov")
10728 (set_attr "memory" "store")
10729 (set_attr "prefix" "evex")
10730 (set_attr "mode" "TI")])
10732 (define_insn "avx512vl_<code><mode>v4qi2_mask"
10733 [(set (match_operand:V16QI 0 "register_operand" "=v")
10737 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
10739 (match_operand:V16QI 2 "nonimm_or_0_operand" "0C")
10740 (parallel [(const_int 0) (const_int 1)
10741 (const_int 2) (const_int 3)]))
10742 (match_operand:QI 3 "register_operand" "Yk"))
10743 (const_vector:V12QI [(const_int 0) (const_int 0)
10744 (const_int 0) (const_int 0)
10745 (const_int 0) (const_int 0)
10746 (const_int 0) (const_int 0)
10747 (const_int 0) (const_int 0)
10748 (const_int 0) (const_int 0)])))]
10750 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
10751 [(set_attr "type" "ssemov")
10752 (set_attr "prefix" "evex")
10753 (set_attr "mode" "TI")])
10755 (define_insn "*avx512vl_<code><mode>v4qi2_mask_1"
10756 [(set (match_operand:V16QI 0 "register_operand" "=v")
10760 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
10761 (const_vector:V4QI [(const_int 0) (const_int 0)
10762 (const_int 0) (const_int 0)])
10763 (match_operand:QI 2 "register_operand" "Yk"))
10764 (const_vector:V12QI [(const_int 0) (const_int 0)
10765 (const_int 0) (const_int 0)
10766 (const_int 0) (const_int 0)
10767 (const_int 0) (const_int 0)
10768 (const_int 0) (const_int 0)
10769 (const_int 0) (const_int 0)])))]
10771 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
10772 [(set_attr "type" "ssemov")
10773 (set_attr "prefix" "evex")
10774 (set_attr "mode" "TI")])
10776 (define_insn "avx512vl_<code><mode>v4qi2_mask_store"
10777 [(set (match_operand:V16QI 0 "memory_operand" "=m")
10781 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
10784 (parallel [(const_int 0) (const_int 1)
10785 (const_int 2) (const_int 3)]))
10786 (match_operand:QI 2 "register_operand" "Yk"))
10789 (parallel [(const_int 4) (const_int 5)
10790 (const_int 6) (const_int 7)
10791 (const_int 8) (const_int 9)
10792 (const_int 10) (const_int 11)
10793 (const_int 12) (const_int 13)
10794 (const_int 14) (const_int 15)]))))]
10796 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}|%k0%{%2%}, %1}"
10797 [(set_attr "type" "ssemov")
10798 (set_attr "memory" "store")
10799 (set_attr "prefix" "evex")
10800 (set_attr "mode" "TI")])
10802 (define_mode_iterator VI2_128_BW_4_256
10803 [(V8HI "TARGET_AVX512BW") V8SI])
10805 (define_insn "*avx512vl_<code><mode>v8qi2_store"
10806 [(set (match_operand:V16QI 0 "memory_operand" "=m")
10809 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
10812 (parallel [(const_int 8) (const_int 9)
10813 (const_int 10) (const_int 11)
10814 (const_int 12) (const_int 13)
10815 (const_int 14) (const_int 15)]))))]
10817 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0|%q0, %1}"
10818 [(set_attr "type" "ssemov")
10819 (set_attr "memory" "store")
10820 (set_attr "prefix" "evex")
10821 (set_attr "mode" "TI")])
10823 (define_insn "avx512vl_<code><mode>v8qi2_mask"
10824 [(set (match_operand:V16QI 0 "register_operand" "=v")
10828 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
10830 (match_operand:V16QI 2 "nonimm_or_0_operand" "0C")
10831 (parallel [(const_int 0) (const_int 1)
10832 (const_int 2) (const_int 3)
10833 (const_int 4) (const_int 5)
10834 (const_int 6) (const_int 7)]))
10835 (match_operand:QI 3 "register_operand" "Yk"))
10836 (const_vector:V8QI [(const_int 0) (const_int 0)
10837 (const_int 0) (const_int 0)
10838 (const_int 0) (const_int 0)
10839 (const_int 0) (const_int 0)])))]
10841 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
10842 [(set_attr "type" "ssemov")
10843 (set_attr "prefix" "evex")
10844 (set_attr "mode" "TI")])
10846 (define_insn "*avx512vl_<code><mode>v8qi2_mask_1"
10847 [(set (match_operand:V16QI 0 "register_operand" "=v")
10851 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
10852 (const_vector:V8QI [(const_int 0) (const_int 0)
10853 (const_int 0) (const_int 0)
10854 (const_int 0) (const_int 0)
10855 (const_int 0) (const_int 0)])
10856 (match_operand:QI 2 "register_operand" "Yk"))
10857 (const_vector:V8QI [(const_int 0) (const_int 0)
10858 (const_int 0) (const_int 0)
10859 (const_int 0) (const_int 0)
10860 (const_int 0) (const_int 0)])))]
10862 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
10863 [(set_attr "type" "ssemov")
10864 (set_attr "prefix" "evex")
10865 (set_attr "mode" "TI")])
10867 (define_insn "avx512vl_<code><mode>v8qi2_mask_store"
10868 [(set (match_operand:V16QI 0 "memory_operand" "=m")
10872 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
10875 (parallel [(const_int 0) (const_int 1)
10876 (const_int 2) (const_int 3)
10877 (const_int 4) (const_int 5)
10878 (const_int 6) (const_int 7)]))
10879 (match_operand:QI 2 "register_operand" "Yk"))
10882 (parallel [(const_int 8) (const_int 9)
10883 (const_int 10) (const_int 11)
10884 (const_int 12) (const_int 13)
10885 (const_int 14) (const_int 15)]))))]
10887 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}|%q0%{%2%}, %1}"
10888 [(set_attr "type" "ssemov")
10889 (set_attr "memory" "store")
10890 (set_attr "prefix" "evex")
10891 (set_attr "mode" "TI")])
10893 (define_mode_iterator PMOV_SRC_MODE_4 [V4DI V2DI V4SI])
10894 (define_mode_attr pmov_dst_4
10895 [(V4DI "V4HI") (V2DI "V2HI") (V4SI "V4HI")])
10896 (define_mode_attr pmov_dst_zeroed_4
10897 [(V4DI "V4HI") (V2DI "V6HI") (V4SI "V4HI")])
10898 (define_mode_attr pmov_suff_4
10899 [(V4DI "qw") (V2DI "qw") (V4SI "dw")])
10901 (define_insn "*avx512vl_<code><mode>v<ssescalarnum>hi2"
10902 [(set (match_operand:V8HI 0 "register_operand" "=v")
10904 (any_truncate:<pmov_dst_4>
10905 (match_operand:PMOV_SRC_MODE_4 1 "register_operand" "v"))
10906 (match_operand:<pmov_dst_zeroed_4> 2 "const0_operand")))]
10908 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0|%0, %1}"
10909 [(set_attr "type" "ssemov")
10910 (set_attr "prefix" "evex")
10911 (set_attr "mode" "TI")])
10913 (define_insn "*avx512vl_<code><mode>v4hi2_store"
10914 [(set (match_operand:V8HI 0 "memory_operand" "=m")
10917 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
10920 (parallel [(const_int 4) (const_int 5)
10921 (const_int 6) (const_int 7)]))))]
10923 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0|%0, %1}"
10924 [(set_attr "type" "ssemov")
10925 (set_attr "memory" "store")
10926 (set_attr "prefix" "evex")
10927 (set_attr "mode" "TI")])
10929 (define_insn "avx512vl_<code><mode>v4hi2_mask"
10930 [(set (match_operand:V8HI 0 "register_operand" "=v")
10934 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
10936 (match_operand:V8HI 2 "nonimm_or_0_operand" "0C")
10937 (parallel [(const_int 0) (const_int 1)
10938 (const_int 2) (const_int 3)]))
10939 (match_operand:QI 3 "register_operand" "Yk"))
10940 (const_vector:V4HI [(const_int 0) (const_int 0)
10941 (const_int 0) (const_int 0)])))]
10943 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
10944 [(set_attr "type" "ssemov")
10945 (set_attr "prefix" "evex")
10946 (set_attr "mode" "TI")])
10948 (define_insn "*avx512vl_<code><mode>v4hi2_mask_1"
10949 [(set (match_operand:V8HI 0 "register_operand" "=v")
10953 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
10954 (const_vector:V4HI [(const_int 0) (const_int 0)
10955 (const_int 0) (const_int 0)])
10956 (match_operand:QI 2 "register_operand" "Yk"))
10957 (const_vector:V4HI [(const_int 0) (const_int 0)
10958 (const_int 0) (const_int 0)])))]
10960 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
10961 [(set_attr "type" "ssemov")
10962 (set_attr "prefix" "evex")
10963 (set_attr "mode" "TI")])
10965 (define_insn "avx512vl_<code><mode>v4hi2_mask_store"
10966 [(set (match_operand:V8HI 0 "memory_operand" "=m")
10970 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
10973 (parallel [(const_int 0) (const_int 1)
10974 (const_int 2) (const_int 3)]))
10975 (match_operand:QI 2 "register_operand" "Yk"))
10978 (parallel [(const_int 4) (const_int 5)
10979 (const_int 6) (const_int 7)]))))]
10982 if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 4)
10983 return "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%2%}|%0%{%2%}, %t1}";
10984 return "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%2%}|%0%{%2%}, %g1}";
10986 [(set_attr "type" "ssemov")
10987 (set_attr "memory" "store")
10988 (set_attr "prefix" "evex")
10989 (set_attr "mode" "TI")])
10991 (define_insn "*avx512vl_<code>v2div2hi2_store"
10992 [(set (match_operand:V8HI 0 "memory_operand" "=m")
10995 (match_operand:V2DI 1 "register_operand" "v"))
10998 (parallel [(const_int 2) (const_int 3)
10999 (const_int 4) (const_int 5)
11000 (const_int 6) (const_int 7)]))))]
11002 "vpmov<trunsuffix>qw\t{%1, %0|%0, %1}"
11003 [(set_attr "type" "ssemov")
11004 (set_attr "memory" "store")
11005 (set_attr "prefix" "evex")
11006 (set_attr "mode" "TI")])
11008 (define_insn "avx512vl_<code>v2div2hi2_mask"
11009 [(set (match_operand:V8HI 0 "register_operand" "=v")
11013 (match_operand:V2DI 1 "register_operand" "v"))
11015 (match_operand:V8HI 2 "nonimm_or_0_operand" "0C")
11016 (parallel [(const_int 0) (const_int 1)]))
11017 (match_operand:QI 3 "register_operand" "Yk"))
11018 (const_vector:V6HI [(const_int 0) (const_int 0)
11019 (const_int 0) (const_int 0)
11020 (const_int 0) (const_int 0)])))]
11022 "vpmov<trunsuffix>qw\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
11023 [(set_attr "type" "ssemov")
11024 (set_attr "prefix" "evex")
11025 (set_attr "mode" "TI")])
11027 (define_insn "*avx512vl_<code>v2div2hi2_mask_1"
11028 [(set (match_operand:V8HI 0 "register_operand" "=v")
11032 (match_operand:V2DI 1 "register_operand" "v"))
11033 (const_vector:V2HI [(const_int 0) (const_int 0)])
11034 (match_operand:QI 2 "register_operand" "Yk"))
11035 (const_vector:V6HI [(const_int 0) (const_int 0)
11036 (const_int 0) (const_int 0)
11037 (const_int 0) (const_int 0)])))]
11039 "vpmov<trunsuffix>qw\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
11040 [(set_attr "type" "ssemov")
11041 (set_attr "prefix" "evex")
11042 (set_attr "mode" "TI")])
11044 (define_insn "avx512vl_<code>v2div2hi2_mask_store"
11045 [(set (match_operand:V8HI 0 "memory_operand" "=m")
11049 (match_operand:V2DI 1 "register_operand" "v"))
11052 (parallel [(const_int 0) (const_int 1)]))
11053 (match_operand:QI 2 "register_operand" "Yk"))
11056 (parallel [(const_int 2) (const_int 3)
11057 (const_int 4) (const_int 5)
11058 (const_int 6) (const_int 7)]))))]
11060 "vpmov<trunsuffix>qw\t{%1, %0%{%2%}|%0%{%2%}, %g1}"
11061 [(set_attr "type" "ssemov")
11062 (set_attr "memory" "store")
11063 (set_attr "prefix" "evex")
11064 (set_attr "mode" "TI")])
11066 (define_insn "*avx512vl_<code>v2div2si2"
11067 [(set (match_operand:V4SI 0 "register_operand" "=v")
11070 (match_operand:V2DI 1 "register_operand" "v"))
11071 (match_operand:V2SI 2 "const0_operand")))]
11073 "vpmov<trunsuffix>qd\t{%1, %0|%0, %1}"
11074 [(set_attr "type" "ssemov")
11075 (set_attr "prefix" "evex")
11076 (set_attr "mode" "TI")])
11078 (define_insn "*avx512vl_<code>v2div2si2_store"
11079 [(set (match_operand:V4SI 0 "memory_operand" "=m")
11082 (match_operand:V2DI 1 "register_operand" "v"))
11085 (parallel [(const_int 2) (const_int 3)]))))]
11087 "vpmov<trunsuffix>qd\t{%1, %0|%0, %1}"
11088 [(set_attr "type" "ssemov")
11089 (set_attr "memory" "store")
11090 (set_attr "prefix" "evex")
11091 (set_attr "mode" "TI")])
11093 (define_insn "avx512vl_<code>v2div2si2_mask"
11094 [(set (match_operand:V4SI 0 "register_operand" "=v")
11098 (match_operand:V2DI 1 "register_operand" "v"))
11100 (match_operand:V4SI 2 "nonimm_or_0_operand" "0C")
11101 (parallel [(const_int 0) (const_int 1)]))
11102 (match_operand:QI 3 "register_operand" "Yk"))
11103 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
11105 "vpmov<trunsuffix>qd\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
11106 [(set_attr "type" "ssemov")
11107 (set_attr "prefix" "evex")
11108 (set_attr "mode" "TI")])
11110 (define_insn "*avx512vl_<code>v2div2si2_mask_1"
11111 [(set (match_operand:V4SI 0 "register_operand" "=v")
11115 (match_operand:V2DI 1 "register_operand" "v"))
11116 (const_vector:V2SI [(const_int 0) (const_int 0)])
11117 (match_operand:QI 2 "register_operand" "Yk"))
11118 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
11120 "vpmov<trunsuffix>qd\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
11121 [(set_attr "type" "ssemov")
11122 (set_attr "prefix" "evex")
11123 (set_attr "mode" "TI")])
11125 (define_insn "avx512vl_<code>v2div2si2_mask_store"
11126 [(set (match_operand:V4SI 0 "memory_operand" "=m")
11130 (match_operand:V2DI 1 "register_operand" "v"))
11133 (parallel [(const_int 0) (const_int 1)]))
11134 (match_operand:QI 2 "register_operand" "Yk"))
11137 (parallel [(const_int 2) (const_int 3)]))))]
11139 "vpmov<trunsuffix>qd\t{%1, %0%{%2%}|%0%{%2%}, %t1}"
11140 [(set_attr "type" "ssemov")
11141 (set_attr "memory" "store")
11142 (set_attr "prefix" "evex")
11143 (set_attr "mode" "TI")])
11145 (define_insn "*avx512f_<code>v8div16qi2"
11146 [(set (match_operand:V16QI 0 "register_operand" "=v")
11149 (match_operand:V8DI 1 "register_operand" "v"))
11150 (const_vector:V8QI [(const_int 0) (const_int 0)
11151 (const_int 0) (const_int 0)
11152 (const_int 0) (const_int 0)
11153 (const_int 0) (const_int 0)])))]
11155 "vpmov<trunsuffix>qb\t{%1, %0|%0, %1}"
11156 [(set_attr "type" "ssemov")
11157 (set_attr "prefix" "evex")
11158 (set_attr "mode" "TI")])
11160 (define_insn "*avx512f_<code>v8div16qi2_store"
11161 [(set (match_operand:V16QI 0 "memory_operand" "=m")
11164 (match_operand:V8DI 1 "register_operand" "v"))
11167 (parallel [(const_int 8) (const_int 9)
11168 (const_int 10) (const_int 11)
11169 (const_int 12) (const_int 13)
11170 (const_int 14) (const_int 15)]))))]
11172 "vpmov<trunsuffix>qb\t{%1, %0|%0, %1}"
11173 [(set_attr "type" "ssemov")
11174 (set_attr "memory" "store")
11175 (set_attr "prefix" "evex")
11176 (set_attr "mode" "TI")])
11178 (define_insn "avx512f_<code>v8div16qi2_mask"
11179 [(set (match_operand:V16QI 0 "register_operand" "=v")
11183 (match_operand:V8DI 1 "register_operand" "v"))
11185 (match_operand:V16QI 2 "nonimm_or_0_operand" "0C")
11186 (parallel [(const_int 0) (const_int 1)
11187 (const_int 2) (const_int 3)
11188 (const_int 4) (const_int 5)
11189 (const_int 6) (const_int 7)]))
11190 (match_operand:QI 3 "register_operand" "Yk"))
11191 (const_vector:V8QI [(const_int 0) (const_int 0)
11192 (const_int 0) (const_int 0)
11193 (const_int 0) (const_int 0)
11194 (const_int 0) (const_int 0)])))]
11196 "vpmov<trunsuffix>qb\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
11197 [(set_attr "type" "ssemov")
11198 (set_attr "prefix" "evex")
11199 (set_attr "mode" "TI")])
11201 (define_insn "*avx512f_<code>v8div16qi2_mask_1"
11202 [(set (match_operand:V16QI 0 "register_operand" "=v")
11206 (match_operand:V8DI 1 "register_operand" "v"))
11207 (const_vector:V8QI [(const_int 0) (const_int 0)
11208 (const_int 0) (const_int 0)
11209 (const_int 0) (const_int 0)
11210 (const_int 0) (const_int 0)])
11211 (match_operand:QI 2 "register_operand" "Yk"))
11212 (const_vector:V8QI [(const_int 0) (const_int 0)
11213 (const_int 0) (const_int 0)
11214 (const_int 0) (const_int 0)
11215 (const_int 0) (const_int 0)])))]
11217 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
11218 [(set_attr "type" "ssemov")
11219 (set_attr "prefix" "evex")
11220 (set_attr "mode" "TI")])
11222 (define_insn "avx512f_<code>v8div16qi2_mask_store"
11223 [(set (match_operand:V16QI 0 "memory_operand" "=m")
11227 (match_operand:V8DI 1 "register_operand" "v"))
11230 (parallel [(const_int 0) (const_int 1)
11231 (const_int 2) (const_int 3)
11232 (const_int 4) (const_int 5)
11233 (const_int 6) (const_int 7)]))
11234 (match_operand:QI 2 "register_operand" "Yk"))
11237 (parallel [(const_int 8) (const_int 9)
11238 (const_int 10) (const_int 11)
11239 (const_int 12) (const_int 13)
11240 (const_int 14) (const_int 15)]))))]
11242 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}|%q0%{%2%}, %1}"
11243 [(set_attr "type" "ssemov")
11244 (set_attr "memory" "store")
11245 (set_attr "prefix" "evex")
11246 (set_attr "mode" "TI")])
11248 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11250 ;; Parallel integral arithmetic
11252 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11254 (define_expand "neg<mode>2"
11255 [(set (match_operand:VI_AVX2 0 "register_operand")
11258 (match_operand:VI_AVX2 1 "vector_operand")))]
11260 "operands[2] = force_reg (<MODE>mode, CONST0_RTX (<MODE>mode));")
11262 (define_expand "<plusminus_insn><mode>3"
11263 [(set (match_operand:VI_AVX2 0 "register_operand")
11265 (match_operand:VI_AVX2 1 "vector_operand")
11266 (match_operand:VI_AVX2 2 "vector_operand")))]
11268 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
11270 (define_expand "<plusminus_insn><mode>3_mask"
11271 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
11272 (vec_merge:VI48_AVX512VL
11273 (plusminus:VI48_AVX512VL
11274 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand")
11275 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand"))
11276 (match_operand:VI48_AVX512VL 3 "nonimm_or_0_operand")
11277 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
11279 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
11281 (define_expand "<plusminus_insn><mode>3_mask"
11282 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
11283 (vec_merge:VI12_AVX512VL
11284 (plusminus:VI12_AVX512VL
11285 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand")
11286 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand"))
11287 (match_operand:VI12_AVX512VL 3 "nonimm_or_0_operand")
11288 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
11290 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
11292 (define_insn "*<plusminus_insn><mode>3"
11293 [(set (match_operand:VI_AVX2 0 "register_operand" "=x,v")
11295 (match_operand:VI_AVX2 1 "vector_operand" "<comm>0,v")
11296 (match_operand:VI_AVX2 2 "vector_operand" "xBm,vm")))]
11297 "TARGET_SSE2 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
11299 p<plusminus_mnemonic><ssemodesuffix>\t{%2, %0|%0, %2}
11300 vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11301 [(set_attr "isa" "noavx,avx")
11302 (set_attr "type" "sseiadd")
11303 (set_attr "prefix_data16" "1,*")
11304 (set_attr "prefix" "orig,vex")
11305 (set_attr "mode" "<sseinsnmode>")])
11307 (define_insn "*sub<mode>3_bcst"
11308 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
11309 (minus:VI48_AVX512VL
11310 (match_operand:VI48_AVX512VL 1 "register_operand" "v")
11311 (vec_duplicate:VI48_AVX512VL
11312 (match_operand:<ssescalarmode> 2 "memory_operand" "m"))))]
11313 "TARGET_AVX512F && ix86_binary_operator_ok (MINUS, <MODE>mode, operands)"
11314 "vpsub<ssemodesuffix>\t{%2<avx512bcst>, %1, %0|%0, %1, %2<avx512bcst>}"
11315 [(set_attr "type" "sseiadd")
11316 (set_attr "prefix" "evex")
11317 (set_attr "mode" "<sseinsnmode>")])
11319 (define_insn "*add<mode>3_bcst"
11320 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
11321 (plus:VI48_AVX512VL
11322 (vec_duplicate:VI48_AVX512VL
11323 (match_operand:<ssescalarmode> 1 "memory_operand" "m"))
11324 (match_operand:VI48_AVX512VL 2 "register_operand" "v")))]
11325 "TARGET_AVX512F && ix86_binary_operator_ok (PLUS, <MODE>mode, operands)"
11326 "vpadd<ssemodesuffix>\t{%1<avx512bcst>, %2, %0|%0, %2, %1<avx512bcst>}"
11327 [(set_attr "type" "sseiadd")
11328 (set_attr "prefix" "evex")
11329 (set_attr "mode" "<sseinsnmode>")])
11331 (define_insn "*<plusminus_insn><mode>3_mask"
11332 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
11333 (vec_merge:VI48_AVX512VL
11334 (plusminus:VI48_AVX512VL
11335 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "<comm>v")
11336 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm"))
11337 (match_operand:VI48_AVX512VL 3 "nonimm_or_0_operand" "0C")
11338 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
11339 "TARGET_AVX512F && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
11340 "vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
11341 [(set_attr "type" "sseiadd")
11342 (set_attr "prefix" "evex")
11343 (set_attr "mode" "<sseinsnmode>")])
11345 (define_insn "*<plusminus_insn><mode>3_mask"
11346 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
11347 (vec_merge:VI12_AVX512VL
11348 (plusminus:VI12_AVX512VL
11349 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "<comm>v")
11350 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm"))
11351 (match_operand:VI12_AVX512VL 3 "nonimm_or_0_operand" "0C")
11352 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
11353 "TARGET_AVX512BW && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
11354 "vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
11355 [(set_attr "type" "sseiadd")
11356 (set_attr "prefix" "evex")
11357 (set_attr "mode" "<sseinsnmode>")])
11359 (define_expand "<sse2_avx2>_<plusminus_insn><mode>3<mask_name>"
11360 [(set (match_operand:VI12_AVX2 0 "register_operand")
11361 (sat_plusminus:VI12_AVX2
11362 (match_operand:VI12_AVX2 1 "vector_operand")
11363 (match_operand:VI12_AVX2 2 "vector_operand")))]
11364 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
11365 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
11367 (define_insn "*<sse2_avx2>_<plusminus_insn><mode>3<mask_name>"
11368 [(set (match_operand:VI12_AVX2 0 "register_operand" "=x,v")
11369 (sat_plusminus:VI12_AVX2
11370 (match_operand:VI12_AVX2 1 "vector_operand" "<comm>0,v")
11371 (match_operand:VI12_AVX2 2 "vector_operand" "xBm,vm")))]
11372 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>
11373 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
11375 p<plusminus_mnemonic><ssemodesuffix>\t{%2, %0|%0, %2}
11376 vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11377 [(set_attr "isa" "noavx,avx")
11378 (set_attr "type" "sseiadd")
11379 (set_attr "prefix_data16" "1,*")
11380 (set_attr "prefix" "orig,maybe_evex")
11381 (set_attr "mode" "TI")])
11383 (define_expand "mul<mode>3<mask_name>"
11384 [(set (match_operand:VI1_AVX512 0 "register_operand")
11385 (mult:VI1_AVX512 (match_operand:VI1_AVX512 1 "register_operand")
11386 (match_operand:VI1_AVX512 2 "register_operand")))]
11387 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
11389 ix86_expand_vecop_qihi (MULT, operands[0], operands[1], operands[2]);
11393 (define_expand "mul<mode>3<mask_name>"
11394 [(set (match_operand:VI2_AVX2 0 "register_operand")
11395 (mult:VI2_AVX2 (match_operand:VI2_AVX2 1 "vector_operand")
11396 (match_operand:VI2_AVX2 2 "vector_operand")))]
11397 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
11398 "ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);")
11400 (define_insn "*mul<mode>3<mask_name>"
11401 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,v")
11402 (mult:VI2_AVX2 (match_operand:VI2_AVX2 1 "vector_operand" "%0,v")
11403 (match_operand:VI2_AVX2 2 "vector_operand" "xBm,vm")))]
11404 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
11405 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
11407 pmullw\t{%2, %0|%0, %2}
11408 vpmullw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11409 [(set_attr "isa" "noavx,avx")
11410 (set_attr "type" "sseimul")
11411 (set_attr "prefix_data16" "1,*")
11412 (set_attr "prefix" "orig,vex")
11413 (set_attr "mode" "<sseinsnmode>")])
11415 (define_expand "<s>mul<mode>3_highpart<mask_name>"
11416 [(set (match_operand:VI2_AVX2 0 "register_operand")
11418 (lshiftrt:<ssedoublemode>
11419 (mult:<ssedoublemode>
11420 (any_extend:<ssedoublemode>
11421 (match_operand:VI2_AVX2 1 "vector_operand"))
11422 (any_extend:<ssedoublemode>
11423 (match_operand:VI2_AVX2 2 "vector_operand")))
11426 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
11427 "ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);")
11429 (define_insn "*<s>mul<mode>3_highpart<mask_name>"
11430 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,v")
11432 (lshiftrt:<ssedoublemode>
11433 (mult:<ssedoublemode>
11434 (any_extend:<ssedoublemode>
11435 (match_operand:VI2_AVX2 1 "vector_operand" "%0,v"))
11436 (any_extend:<ssedoublemode>
11437 (match_operand:VI2_AVX2 2 "vector_operand" "xBm,vm")))
11439 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
11440 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
11442 pmulh<u>w\t{%2, %0|%0, %2}
11443 vpmulh<u>w\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11444 [(set_attr "isa" "noavx,avx")
11445 (set_attr "type" "sseimul")
11446 (set_attr "prefix_data16" "1,*")
11447 (set_attr "prefix" "orig,vex")
11448 (set_attr "mode" "<sseinsnmode>")])
11450 (define_expand "vec_widen_umult_even_v16si<mask_name>"
11451 [(set (match_operand:V8DI 0 "register_operand")
11455 (match_operand:V16SI 1 "nonimmediate_operand")
11456 (parallel [(const_int 0) (const_int 2)
11457 (const_int 4) (const_int 6)
11458 (const_int 8) (const_int 10)
11459 (const_int 12) (const_int 14)])))
11462 (match_operand:V16SI 2 "nonimmediate_operand")
11463 (parallel [(const_int 0) (const_int 2)
11464 (const_int 4) (const_int 6)
11465 (const_int 8) (const_int 10)
11466 (const_int 12) (const_int 14)])))))]
11468 "ix86_fixup_binary_operands_no_copy (MULT, V16SImode, operands);")
11470 (define_insn "*vec_widen_umult_even_v16si<mask_name>"
11471 [(set (match_operand:V8DI 0 "register_operand" "=v")
11475 (match_operand:V16SI 1 "nonimmediate_operand" "%v")
11476 (parallel [(const_int 0) (const_int 2)
11477 (const_int 4) (const_int 6)
11478 (const_int 8) (const_int 10)
11479 (const_int 12) (const_int 14)])))
11482 (match_operand:V16SI 2 "nonimmediate_operand" "vm")
11483 (parallel [(const_int 0) (const_int 2)
11484 (const_int 4) (const_int 6)
11485 (const_int 8) (const_int 10)
11486 (const_int 12) (const_int 14)])))))]
11487 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11488 "vpmuludq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11489 [(set_attr "type" "sseimul")
11490 (set_attr "prefix_extra" "1")
11491 (set_attr "prefix" "evex")
11492 (set_attr "mode" "XI")])
11494 (define_expand "vec_widen_umult_even_v8si<mask_name>"
11495 [(set (match_operand:V4DI 0 "register_operand")
11499 (match_operand:V8SI 1 "nonimmediate_operand")
11500 (parallel [(const_int 0) (const_int 2)
11501 (const_int 4) (const_int 6)])))
11504 (match_operand:V8SI 2 "nonimmediate_operand")
11505 (parallel [(const_int 0) (const_int 2)
11506 (const_int 4) (const_int 6)])))))]
11507 "TARGET_AVX2 && <mask_avx512vl_condition>"
11508 "ix86_fixup_binary_operands_no_copy (MULT, V8SImode, operands);")
11510 (define_insn "*vec_widen_umult_even_v8si<mask_name>"
11511 [(set (match_operand:V4DI 0 "register_operand" "=v")
11515 (match_operand:V8SI 1 "nonimmediate_operand" "%v")
11516 (parallel [(const_int 0) (const_int 2)
11517 (const_int 4) (const_int 6)])))
11520 (match_operand:V8SI 2 "nonimmediate_operand" "vm")
11521 (parallel [(const_int 0) (const_int 2)
11522 (const_int 4) (const_int 6)])))))]
11523 "TARGET_AVX2 && <mask_avx512vl_condition>
11524 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11525 "vpmuludq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11526 [(set_attr "type" "sseimul")
11527 (set_attr "prefix" "maybe_evex")
11528 (set_attr "mode" "OI")])
11530 (define_expand "vec_widen_umult_even_v4si<mask_name>"
11531 [(set (match_operand:V2DI 0 "register_operand")
11535 (match_operand:V4SI 1 "vector_operand")
11536 (parallel [(const_int 0) (const_int 2)])))
11539 (match_operand:V4SI 2 "vector_operand")
11540 (parallel [(const_int 0) (const_int 2)])))))]
11541 "TARGET_SSE2 && <mask_avx512vl_condition>"
11542 "ix86_fixup_binary_operands_no_copy (MULT, V4SImode, operands);")
11544 (define_insn "*vec_widen_umult_even_v4si<mask_name>"
11545 [(set (match_operand:V2DI 0 "register_operand" "=x,v")
11549 (match_operand:V4SI 1 "vector_operand" "%0,v")
11550 (parallel [(const_int 0) (const_int 2)])))
11553 (match_operand:V4SI 2 "vector_operand" "xBm,vm")
11554 (parallel [(const_int 0) (const_int 2)])))))]
11555 "TARGET_SSE2 && <mask_avx512vl_condition>
11556 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11558 pmuludq\t{%2, %0|%0, %2}
11559 vpmuludq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11560 [(set_attr "isa" "noavx,avx")
11561 (set_attr "type" "sseimul")
11562 (set_attr "prefix_data16" "1,*")
11563 (set_attr "prefix" "orig,maybe_evex")
11564 (set_attr "mode" "TI")])
11566 (define_expand "vec_widen_smult_even_v16si<mask_name>"
11567 [(set (match_operand:V8DI 0 "register_operand")
11571 (match_operand:V16SI 1 "nonimmediate_operand")
11572 (parallel [(const_int 0) (const_int 2)
11573 (const_int 4) (const_int 6)
11574 (const_int 8) (const_int 10)
11575 (const_int 12) (const_int 14)])))
11578 (match_operand:V16SI 2 "nonimmediate_operand")
11579 (parallel [(const_int 0) (const_int 2)
11580 (const_int 4) (const_int 6)
11581 (const_int 8) (const_int 10)
11582 (const_int 12) (const_int 14)])))))]
11584 "ix86_fixup_binary_operands_no_copy (MULT, V16SImode, operands);")
11586 (define_insn "*vec_widen_smult_even_v16si<mask_name>"
11587 [(set (match_operand:V8DI 0 "register_operand" "=v")
11591 (match_operand:V16SI 1 "nonimmediate_operand" "%v")
11592 (parallel [(const_int 0) (const_int 2)
11593 (const_int 4) (const_int 6)
11594 (const_int 8) (const_int 10)
11595 (const_int 12) (const_int 14)])))
11598 (match_operand:V16SI 2 "nonimmediate_operand" "vm")
11599 (parallel [(const_int 0) (const_int 2)
11600 (const_int 4) (const_int 6)
11601 (const_int 8) (const_int 10)
11602 (const_int 12) (const_int 14)])))))]
11603 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11604 "vpmuldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11605 [(set_attr "type" "sseimul")
11606 (set_attr "prefix_extra" "1")
11607 (set_attr "prefix" "evex")
11608 (set_attr "mode" "XI")])
11610 (define_expand "vec_widen_smult_even_v8si<mask_name>"
11611 [(set (match_operand:V4DI 0 "register_operand")
11615 (match_operand:V8SI 1 "nonimmediate_operand")
11616 (parallel [(const_int 0) (const_int 2)
11617 (const_int 4) (const_int 6)])))
11620 (match_operand:V8SI 2 "nonimmediate_operand")
11621 (parallel [(const_int 0) (const_int 2)
11622 (const_int 4) (const_int 6)])))))]
11623 "TARGET_AVX2 && <mask_avx512vl_condition>"
11624 "ix86_fixup_binary_operands_no_copy (MULT, V8SImode, operands);")
11626 (define_insn "*vec_widen_smult_even_v8si<mask_name>"
11627 [(set (match_operand:V4DI 0 "register_operand" "=v")
11631 (match_operand:V8SI 1 "nonimmediate_operand" "%v")
11632 (parallel [(const_int 0) (const_int 2)
11633 (const_int 4) (const_int 6)])))
11636 (match_operand:V8SI 2 "nonimmediate_operand" "vm")
11637 (parallel [(const_int 0) (const_int 2)
11638 (const_int 4) (const_int 6)])))))]
11639 "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11640 "vpmuldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11641 [(set_attr "type" "sseimul")
11642 (set_attr "prefix_extra" "1")
11643 (set_attr "prefix" "vex")
11644 (set_attr "mode" "OI")])
11646 (define_expand "sse4_1_mulv2siv2di3<mask_name>"
11647 [(set (match_operand:V2DI 0 "register_operand")
11651 (match_operand:V4SI 1 "vector_operand")
11652 (parallel [(const_int 0) (const_int 2)])))
11655 (match_operand:V4SI 2 "vector_operand")
11656 (parallel [(const_int 0) (const_int 2)])))))]
11657 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
11658 "ix86_fixup_binary_operands_no_copy (MULT, V4SImode, operands);")
11660 (define_insn "*sse4_1_mulv2siv2di3<mask_name>"
11661 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
11665 (match_operand:V4SI 1 "vector_operand" "%0,0,v")
11666 (parallel [(const_int 0) (const_int 2)])))
11669 (match_operand:V4SI 2 "vector_operand" "YrBm,*xBm,vm")
11670 (parallel [(const_int 0) (const_int 2)])))))]
11671 "TARGET_SSE4_1 && <mask_avx512vl_condition>
11672 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11674 pmuldq\t{%2, %0|%0, %2}
11675 pmuldq\t{%2, %0|%0, %2}
11676 vpmuldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11677 [(set_attr "isa" "noavx,noavx,avx")
11678 (set_attr "type" "sseimul")
11679 (set_attr "prefix_data16" "1,1,*")
11680 (set_attr "prefix_extra" "1")
11681 (set_attr "prefix" "orig,orig,vex")
11682 (set_attr "mode" "TI")])
11684 (define_insn "avx512bw_pmaddwd512<mode><mask_name>"
11685 [(set (match_operand:<sseunpackmode> 0 "register_operand" "=v")
11686 (unspec:<sseunpackmode>
11687 [(match_operand:VI2_AVX2 1 "register_operand" "v")
11688 (match_operand:VI2_AVX2 2 "nonimmediate_operand" "vm")]
11689 UNSPEC_PMADDWD512))]
11690 "TARGET_AVX512BW && <mask_mode512bit_condition>"
11691 "vpmaddwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}";
11692 [(set_attr "type" "sseiadd")
11693 (set_attr "prefix" "evex")
11694 (set_attr "mode" "XI")])
11696 (define_expand "avx2_pmaddwd"
11697 [(set (match_operand:V8SI 0 "register_operand")
11702 (match_operand:V16HI 1 "nonimmediate_operand")
11703 (parallel [(const_int 0) (const_int 2)
11704 (const_int 4) (const_int 6)
11705 (const_int 8) (const_int 10)
11706 (const_int 12) (const_int 14)])))
11709 (match_operand:V16HI 2 "nonimmediate_operand")
11710 (parallel [(const_int 0) (const_int 2)
11711 (const_int 4) (const_int 6)
11712 (const_int 8) (const_int 10)
11713 (const_int 12) (const_int 14)]))))
11716 (vec_select:V8HI (match_dup 1)
11717 (parallel [(const_int 1) (const_int 3)
11718 (const_int 5) (const_int 7)
11719 (const_int 9) (const_int 11)
11720 (const_int 13) (const_int 15)])))
11722 (vec_select:V8HI (match_dup 2)
11723 (parallel [(const_int 1) (const_int 3)
11724 (const_int 5) (const_int 7)
11725 (const_int 9) (const_int 11)
11726 (const_int 13) (const_int 15)]))))))]
11728 "ix86_fixup_binary_operands_no_copy (MULT, V16HImode, operands);")
11730 (define_insn "*avx2_pmaddwd"
11731 [(set (match_operand:V8SI 0 "register_operand" "=x,v")
11736 (match_operand:V16HI 1 "nonimmediate_operand" "%x,v")
11737 (parallel [(const_int 0) (const_int 2)
11738 (const_int 4) (const_int 6)
11739 (const_int 8) (const_int 10)
11740 (const_int 12) (const_int 14)])))
11743 (match_operand:V16HI 2 "nonimmediate_operand" "xm,vm")
11744 (parallel [(const_int 0) (const_int 2)
11745 (const_int 4) (const_int 6)
11746 (const_int 8) (const_int 10)
11747 (const_int 12) (const_int 14)]))))
11750 (vec_select:V8HI (match_dup 1)
11751 (parallel [(const_int 1) (const_int 3)
11752 (const_int 5) (const_int 7)
11753 (const_int 9) (const_int 11)
11754 (const_int 13) (const_int 15)])))
11756 (vec_select:V8HI (match_dup 2)
11757 (parallel [(const_int 1) (const_int 3)
11758 (const_int 5) (const_int 7)
11759 (const_int 9) (const_int 11)
11760 (const_int 13) (const_int 15)]))))))]
11761 "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11762 "vpmaddwd\t{%2, %1, %0|%0, %1, %2}"
11763 [(set_attr "type" "sseiadd")
11764 (set_attr "isa" "*,avx512bw")
11765 (set_attr "prefix" "vex,evex")
11766 (set_attr "mode" "OI")])
11768 (define_expand "sse2_pmaddwd"
11769 [(set (match_operand:V4SI 0 "register_operand")
11774 (match_operand:V8HI 1 "vector_operand")
11775 (parallel [(const_int 0) (const_int 2)
11776 (const_int 4) (const_int 6)])))
11779 (match_operand:V8HI 2 "vector_operand")
11780 (parallel [(const_int 0) (const_int 2)
11781 (const_int 4) (const_int 6)]))))
11784 (vec_select:V4HI (match_dup 1)
11785 (parallel [(const_int 1) (const_int 3)
11786 (const_int 5) (const_int 7)])))
11788 (vec_select:V4HI (match_dup 2)
11789 (parallel [(const_int 1) (const_int 3)
11790 (const_int 5) (const_int 7)]))))))]
11792 "ix86_fixup_binary_operands_no_copy (MULT, V8HImode, operands);")
11794 (define_insn "*sse2_pmaddwd"
11795 [(set (match_operand:V4SI 0 "register_operand" "=x,x,v")
11800 (match_operand:V8HI 1 "vector_operand" "%0,x,v")
11801 (parallel [(const_int 0) (const_int 2)
11802 (const_int 4) (const_int 6)])))
11805 (match_operand:V8HI 2 "vector_operand" "xBm,xm,vm")
11806 (parallel [(const_int 0) (const_int 2)
11807 (const_int 4) (const_int 6)]))))
11810 (vec_select:V4HI (match_dup 1)
11811 (parallel [(const_int 1) (const_int 3)
11812 (const_int 5) (const_int 7)])))
11814 (vec_select:V4HI (match_dup 2)
11815 (parallel [(const_int 1) (const_int 3)
11816 (const_int 5) (const_int 7)]))))))]
11817 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11819 pmaddwd\t{%2, %0|%0, %2}
11820 vpmaddwd\t{%2, %1, %0|%0, %1, %2}
11821 vpmaddwd\t{%2, %1, %0|%0, %1, %2}"
11822 [(set_attr "isa" "noavx,avx,avx512bw")
11823 (set_attr "type" "sseiadd")
11824 (set_attr "atom_unit" "simul")
11825 (set_attr "prefix_data16" "1,*,*")
11826 (set_attr "prefix" "orig,vex,evex")
11827 (set_attr "mode" "TI")])
11829 (define_insn "avx512dq_mul<mode>3<mask_name>"
11830 [(set (match_operand:VI8 0 "register_operand" "=v")
11832 (match_operand:VI8 1 "register_operand" "v")
11833 (match_operand:VI8 2 "nonimmediate_operand" "vm")))]
11834 "TARGET_AVX512DQ && <mask_mode512bit_condition>"
11835 "vpmullq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11836 [(set_attr "type" "sseimul")
11837 (set_attr "prefix" "evex")
11838 (set_attr "mode" "<sseinsnmode>")])
11840 (define_expand "mul<mode>3<mask_name>"
11841 [(set (match_operand:VI4_AVX512F 0 "register_operand")
11843 (match_operand:VI4_AVX512F 1 "general_vector_operand")
11844 (match_operand:VI4_AVX512F 2 "general_vector_operand")))]
11845 "TARGET_SSE2 && <mask_mode512bit_condition>"
11849 if (!vector_operand (operands[1], <MODE>mode))
11850 operands[1] = force_reg (<MODE>mode, operands[1]);
11851 if (!vector_operand (operands[2], <MODE>mode))
11852 operands[2] = force_reg (<MODE>mode, operands[2]);
11853 ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);
11857 ix86_expand_sse2_mulv4si3 (operands[0], operands[1], operands[2]);
11862 (define_insn "*<sse4_1_avx2>_mul<mode>3<mask_name>"
11863 [(set (match_operand:VI4_AVX512F 0 "register_operand" "=Yr,*x,v")
11865 (match_operand:VI4_AVX512F 1 "vector_operand" "%0,0,v")
11866 (match_operand:VI4_AVX512F 2 "vector_operand" "YrBm,*xBm,vm")))]
11867 "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
11868 && <mask_mode512bit_condition>"
11870 pmulld\t{%2, %0|%0, %2}
11871 pmulld\t{%2, %0|%0, %2}
11872 vpmulld\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11873 [(set_attr "isa" "noavx,noavx,avx")
11874 (set_attr "type" "sseimul")
11875 (set_attr "prefix_extra" "1")
11876 (set_attr "prefix" "<mask_prefix4>")
11877 (set_attr "btver2_decode" "vector,vector,vector")
11878 (set_attr "mode" "<sseinsnmode>")])
11880 (define_expand "mul<mode>3"
11881 [(set (match_operand:VI8_AVX2_AVX512F 0 "register_operand")
11882 (mult:VI8_AVX2_AVX512F
11883 (match_operand:VI8_AVX2_AVX512F 1 "register_operand")
11884 (match_operand:VI8_AVX2_AVX512F 2 "register_operand")))]
11887 ix86_expand_sse2_mulvxdi3 (operands[0], operands[1], operands[2]);
11891 (define_expand "vec_widen_<s>mult_hi_<mode>"
11892 [(match_operand:<sseunpackmode> 0 "register_operand")
11893 (any_extend:<sseunpackmode>
11894 (match_operand:VI124_AVX2 1 "register_operand"))
11895 (match_operand:VI124_AVX2 2 "register_operand")]
11898 ix86_expand_mul_widen_hilo (operands[0], operands[1], operands[2],
11903 (define_expand "vec_widen_<s>mult_lo_<mode>"
11904 [(match_operand:<sseunpackmode> 0 "register_operand")
11905 (any_extend:<sseunpackmode>
11906 (match_operand:VI124_AVX2 1 "register_operand"))
11907 (match_operand:VI124_AVX2 2 "register_operand")]
11910 ix86_expand_mul_widen_hilo (operands[0], operands[1], operands[2],
11915 ;; Most widen_<s>mult_even_<mode> can be handled directly from other
11916 ;; named patterns, but signed V4SI needs special help for plain SSE2.
11917 (define_expand "vec_widen_smult_even_v4si"
11918 [(match_operand:V2DI 0 "register_operand")
11919 (match_operand:V4SI 1 "vector_operand")
11920 (match_operand:V4SI 2 "vector_operand")]
11923 ix86_expand_mul_widen_evenodd (operands[0], operands[1], operands[2],
11928 (define_expand "vec_widen_<s>mult_odd_<mode>"
11929 [(match_operand:<sseunpackmode> 0 "register_operand")
11930 (any_extend:<sseunpackmode>
11931 (match_operand:VI4_AVX512F 1 "general_vector_operand"))
11932 (match_operand:VI4_AVX512F 2 "general_vector_operand")]
11935 ix86_expand_mul_widen_evenodd (operands[0], operands[1], operands[2],
11940 (define_mode_attr SDOT_PMADD_SUF
11941 [(V32HI "512v32hi") (V16HI "") (V8HI "")])
11943 (define_expand "sdot_prod<mode>"
11944 [(match_operand:<sseunpackmode> 0 "register_operand")
11945 (match_operand:VI2_AVX2 1 "register_operand")
11946 (match_operand:VI2_AVX2 2 "register_operand")
11947 (match_operand:<sseunpackmode> 3 "register_operand")]
11950 rtx t = gen_reg_rtx (<sseunpackmode>mode);
11951 emit_insn (gen_<sse2_avx2>_pmaddwd<SDOT_PMADD_SUF> (t, operands[1], operands[2]));
11952 emit_insn (gen_rtx_SET (operands[0],
11953 gen_rtx_PLUS (<sseunpackmode>mode,
11958 ;; Normally we use widen_mul_even/odd, but combine can't quite get it all
11959 ;; back together when madd is available.
11960 (define_expand "sdot_prodv4si"
11961 [(match_operand:V2DI 0 "register_operand")
11962 (match_operand:V4SI 1 "register_operand")
11963 (match_operand:V4SI 2 "register_operand")
11964 (match_operand:V2DI 3 "register_operand")]
11967 rtx t = gen_reg_rtx (V2DImode);
11968 emit_insn (gen_xop_pmacsdqh (t, operands[1], operands[2], operands[3]));
11969 emit_insn (gen_xop_pmacsdql (operands[0], operands[1], operands[2], t));
11973 (define_expand "uavg<mode>3_ceil"
11974 [(set (match_operand:VI12_AVX2 0 "register_operand")
11975 (truncate:VI12_AVX2
11976 (lshiftrt:<ssedoublemode>
11977 (plus:<ssedoublemode>
11978 (plus:<ssedoublemode>
11979 (zero_extend:<ssedoublemode>
11980 (match_operand:VI12_AVX2 1 "vector_operand"))
11981 (zero_extend:<ssedoublemode>
11982 (match_operand:VI12_AVX2 2 "vector_operand")))
11987 operands[3] = CONST1_RTX(<ssedoublemode>mode);
11988 ix86_fixup_binary_operands_no_copy (PLUS, <MODE>mode, operands);
11991 (define_expand "usadv16qi"
11992 [(match_operand:V4SI 0 "register_operand")
11993 (match_operand:V16QI 1 "register_operand")
11994 (match_operand:V16QI 2 "vector_operand")
11995 (match_operand:V4SI 3 "vector_operand")]
11998 rtx t1 = gen_reg_rtx (V2DImode);
11999 rtx t2 = gen_reg_rtx (V4SImode);
12000 emit_insn (gen_sse2_psadbw (t1, operands[1], operands[2]));
12001 convert_move (t2, t1, 0);
12002 emit_insn (gen_addv4si3 (operands[0], t2, operands[3]));
12006 (define_expand "usadv32qi"
12007 [(match_operand:V8SI 0 "register_operand")
12008 (match_operand:V32QI 1 "register_operand")
12009 (match_operand:V32QI 2 "nonimmediate_operand")
12010 (match_operand:V8SI 3 "nonimmediate_operand")]
12013 rtx t1 = gen_reg_rtx (V4DImode);
12014 rtx t2 = gen_reg_rtx (V8SImode);
12015 emit_insn (gen_avx2_psadbw (t1, operands[1], operands[2]));
12016 convert_move (t2, t1, 0);
12017 emit_insn (gen_addv8si3 (operands[0], t2, operands[3]));
12021 (define_expand "usadv64qi"
12022 [(match_operand:V16SI 0 "register_operand")
12023 (match_operand:V64QI 1 "register_operand")
12024 (match_operand:V64QI 2 "nonimmediate_operand")
12025 (match_operand:V16SI 3 "nonimmediate_operand")]
12028 rtx t1 = gen_reg_rtx (V8DImode);
12029 rtx t2 = gen_reg_rtx (V16SImode);
12030 emit_insn (gen_avx512f_psadbw (t1, operands[1], operands[2]));
12031 convert_move (t2, t1, 0);
12032 emit_insn (gen_addv16si3 (operands[0], t2, operands[3]));
12036 (define_insn "<mask_codefor>ashr<mode>3<mask_name>"
12037 [(set (match_operand:VI248_AVX512BW_1 0 "register_operand" "=v,v")
12038 (ashiftrt:VI248_AVX512BW_1
12039 (match_operand:VI248_AVX512BW_1 1 "nonimmediate_operand" "v,vm")
12040 (match_operand:DI 2 "nonmemory_operand" "v,N")))]
12042 "vpsra<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12043 [(set_attr "type" "sseishft")
12044 (set (attr "length_immediate")
12045 (if_then_else (match_operand 2 "const_int_operand")
12047 (const_string "0")))
12048 (set_attr "mode" "<sseinsnmode>")])
12050 (define_insn "ashr<mode>3"
12051 [(set (match_operand:VI24_AVX2 0 "register_operand" "=x,x")
12052 (ashiftrt:VI24_AVX2
12053 (match_operand:VI24_AVX2 1 "register_operand" "0,x")
12054 (match_operand:DI 2 "nonmemory_operand" "xN,xN")))]
12057 psra<ssemodesuffix>\t{%2, %0|%0, %2}
12058 vpsra<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
12059 [(set_attr "isa" "noavx,avx")
12060 (set_attr "type" "sseishft")
12061 (set (attr "length_immediate")
12062 (if_then_else (match_operand 2 "const_int_operand")
12064 (const_string "0")))
12065 (set_attr "prefix_data16" "1,*")
12066 (set_attr "prefix" "orig,vex")
12067 (set_attr "mode" "<sseinsnmode>")])
12069 (define_insn "ashr<mode>3<mask_name>"
12070 [(set (match_operand:VI248_AVX512BW_AVX512VL 0 "register_operand" "=v,v")
12071 (ashiftrt:VI248_AVX512BW_AVX512VL
12072 (match_operand:VI248_AVX512BW_AVX512VL 1 "nonimmediate_operand" "v,vm")
12073 (match_operand:DI 2 "nonmemory_operand" "v,N")))]
12075 "vpsra<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12076 [(set_attr "type" "sseishft")
12077 (set (attr "length_immediate")
12078 (if_then_else (match_operand 2 "const_int_operand")
12080 (const_string "0")))
12081 (set_attr "mode" "<sseinsnmode>")])
12083 (define_insn "<mask_codefor><shift_insn><mode>3<mask_name>"
12084 [(set (match_operand:VI248_AVX512BW_2 0 "register_operand" "=v,v")
12085 (any_lshift:VI248_AVX512BW_2
12086 (match_operand:VI248_AVX512BW_2 1 "nonimmediate_operand" "v,vm")
12087 (match_operand:DI 2 "nonmemory_operand" "v,N")))]
12089 "vp<vshift><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12090 [(set_attr "type" "sseishft")
12091 (set (attr "length_immediate")
12092 (if_then_else (match_operand 2 "const_int_operand")
12094 (const_string "0")))
12095 (set_attr "mode" "<sseinsnmode>")])
12097 (define_insn "<shift_insn><mode>3"
12098 [(set (match_operand:VI248_AVX2 0 "register_operand" "=x,x")
12099 (any_lshift:VI248_AVX2
12100 (match_operand:VI248_AVX2 1 "register_operand" "0,x")
12101 (match_operand:DI 2 "nonmemory_operand" "xN,xN")))]
12104 p<vshift><ssemodesuffix>\t{%2, %0|%0, %2}
12105 vp<vshift><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
12106 [(set_attr "isa" "noavx,avx")
12107 (set_attr "type" "sseishft")
12108 (set (attr "length_immediate")
12109 (if_then_else (match_operand 2 "const_int_operand")
12111 (const_string "0")))
12112 (set_attr "prefix_data16" "1,*")
12113 (set_attr "prefix" "orig,vex")
12114 (set_attr "mode" "<sseinsnmode>")])
12116 (define_insn "<shift_insn><mode>3<mask_name>"
12117 [(set (match_operand:VI248_AVX512BW 0 "register_operand" "=v,v")
12118 (any_lshift:VI248_AVX512BW
12119 (match_operand:VI248_AVX512BW 1 "nonimmediate_operand" "v,m")
12120 (match_operand:DI 2 "nonmemory_operand" "vN,N")))]
12122 "vp<vshift><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12123 [(set_attr "type" "sseishft")
12124 (set (attr "length_immediate")
12125 (if_then_else (match_operand 2 "const_int_operand")
12127 (const_string "0")))
12128 (set_attr "mode" "<sseinsnmode>")])
12131 (define_expand "vec_shl_<mode>"
12132 [(set (match_dup 3)
12134 (match_operand:V_128 1 "register_operand")
12135 (match_operand:SI 2 "const_0_to_255_mul_8_operand")))
12136 (set (match_operand:V_128 0 "register_operand") (match_dup 4))]
12139 operands[1] = gen_lowpart (V1TImode, operands[1]);
12140 operands[3] = gen_reg_rtx (V1TImode);
12141 operands[4] = gen_lowpart (<MODE>mode, operands[3]);
12144 (define_expand "vec_shr_<mode>"
12145 [(set (match_dup 3)
12147 (match_operand:V_128 1 "register_operand")
12148 (match_operand:SI 2 "const_0_to_255_mul_8_operand")))
12149 (set (match_operand:V_128 0 "register_operand") (match_dup 4))]
12152 operands[1] = gen_lowpart (V1TImode, operands[1]);
12153 operands[3] = gen_reg_rtx (V1TImode);
12154 operands[4] = gen_lowpart (<MODE>mode, operands[3]);
12157 (define_insn "avx512bw_<shift_insn><mode>3"
12158 [(set (match_operand:VIMAX_AVX512VL 0 "register_operand" "=v")
12159 (any_lshift:VIMAX_AVX512VL
12160 (match_operand:VIMAX_AVX512VL 1 "nonimmediate_operand" "vm")
12161 (match_operand:SI 2 "const_0_to_255_mul_8_operand" "n")))]
12164 operands[2] = GEN_INT (INTVAL (operands[2]) / 8);
12165 return "vp<vshift>dq\t{%2, %1, %0|%0, %1, %2}";
12167 [(set_attr "type" "sseishft")
12168 (set_attr "length_immediate" "1")
12169 (set_attr "prefix" "maybe_evex")
12170 (set_attr "mode" "<sseinsnmode>")])
12172 (define_insn "<sse2_avx2>_<shift_insn><mode>3"
12173 [(set (match_operand:VIMAX_AVX2 0 "register_operand" "=x,v")
12174 (any_lshift:VIMAX_AVX2
12175 (match_operand:VIMAX_AVX2 1 "register_operand" "0,v")
12176 (match_operand:SI 2 "const_0_to_255_mul_8_operand" "n,n")))]
12179 operands[2] = GEN_INT (INTVAL (operands[2]) / 8);
12181 switch (which_alternative)
12184 return "p<vshift>dq\t{%2, %0|%0, %2}";
12186 return "vp<vshift>dq\t{%2, %1, %0|%0, %1, %2}";
12188 gcc_unreachable ();
12191 [(set_attr "isa" "noavx,avx")
12192 (set_attr "type" "sseishft")
12193 (set_attr "length_immediate" "1")
12194 (set_attr "atom_unit" "sishuf")
12195 (set_attr "prefix_data16" "1,*")
12196 (set_attr "prefix" "orig,vex")
12197 (set_attr "mode" "<sseinsnmode>")])
12199 (define_insn "<avx512>_<rotate>v<mode><mask_name>"
12200 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
12201 (any_rotate:VI48_AVX512VL
12202 (match_operand:VI48_AVX512VL 1 "register_operand" "v")
12203 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")))]
12205 "vp<rotate>v<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12206 [(set_attr "prefix" "evex")
12207 (set_attr "mode" "<sseinsnmode>")])
12209 (define_insn "<avx512>_<rotate><mode><mask_name>"
12210 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
12211 (any_rotate:VI48_AVX512VL
12212 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm")
12213 (match_operand:SI 2 "const_0_to_255_operand")))]
12215 "vp<rotate><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12216 [(set_attr "prefix" "evex")
12217 (set_attr "mode" "<sseinsnmode>")])
12219 (define_expand "<code><mode>3"
12220 [(set (match_operand:VI124_256_AVX512F_AVX512BW 0 "register_operand")
12221 (maxmin:VI124_256_AVX512F_AVX512BW
12222 (match_operand:VI124_256_AVX512F_AVX512BW 1 "nonimmediate_operand")
12223 (match_operand:VI124_256_AVX512F_AVX512BW 2 "nonimmediate_operand")))]
12225 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
12227 (define_insn "*avx2_<code><mode>3"
12228 [(set (match_operand:VI124_256 0 "register_operand" "=v")
12230 (match_operand:VI124_256 1 "nonimmediate_operand" "%v")
12231 (match_operand:VI124_256 2 "nonimmediate_operand" "vm")))]
12232 "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
12233 "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
12234 [(set_attr "type" "sseiadd")
12235 (set_attr "prefix_extra" "1")
12236 (set_attr "prefix" "vex")
12237 (set_attr "mode" "OI")])
12239 (define_expand "<code><mode>3_mask"
12240 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
12241 (vec_merge:VI48_AVX512VL
12242 (maxmin:VI48_AVX512VL
12243 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand")
12244 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand"))
12245 (match_operand:VI48_AVX512VL 3 "nonimm_or_0_operand")
12246 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
12248 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
12250 (define_insn "*avx512f_<code><mode>3<mask_name>"
12251 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
12252 (maxmin:VI48_AVX512VL
12253 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "%v")
12254 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")))]
12255 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
12256 "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12257 [(set_attr "type" "sseiadd")
12258 (set_attr "prefix_extra" "1")
12259 (set_attr "prefix" "maybe_evex")
12260 (set_attr "mode" "<sseinsnmode>")])
12262 (define_insn "<mask_codefor><code><mode>3<mask_name>"
12263 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
12264 (maxmin:VI12_AVX512VL
12265 (match_operand:VI12_AVX512VL 1 "register_operand" "v")
12266 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")))]
12268 "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12269 [(set_attr "type" "sseiadd")
12270 (set_attr "prefix" "evex")
12271 (set_attr "mode" "<sseinsnmode>")])
12273 (define_expand "<code><mode>3"
12274 [(set (match_operand:VI8_AVX2_AVX512F 0 "register_operand")
12275 (maxmin:VI8_AVX2_AVX512F
12276 (match_operand:VI8_AVX2_AVX512F 1 "register_operand")
12277 (match_operand:VI8_AVX2_AVX512F 2 "register_operand")))]
12281 && (<MODE>mode == V8DImode || TARGET_AVX512VL))
12282 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
12285 enum rtx_code code;
12290 xops[0] = operands[0];
12292 if (<CODE> == SMAX || <CODE> == UMAX)
12294 xops[1] = operands[1];
12295 xops[2] = operands[2];
12299 xops[1] = operands[2];
12300 xops[2] = operands[1];
12303 code = (<CODE> == UMAX || <CODE> == UMIN) ? GTU : GT;
12305 xops[3] = gen_rtx_fmt_ee (code, VOIDmode, operands[1], operands[2]);
12306 xops[4] = operands[1];
12307 xops[5] = operands[2];
12309 ok = ix86_expand_int_vcond (xops);
12315 (define_expand "<code><mode>3"
12316 [(set (match_operand:VI124_128 0 "register_operand")
12318 (match_operand:VI124_128 1 "vector_operand")
12319 (match_operand:VI124_128 2 "vector_operand")))]
12322 if (TARGET_SSE4_1 || <MODE>mode == V8HImode)
12323 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
12329 xops[0] = operands[0];
12330 operands[1] = force_reg (<MODE>mode, operands[1]);
12331 operands[2] = force_reg (<MODE>mode, operands[2]);
12333 if (<CODE> == SMAX)
12335 xops[1] = operands[1];
12336 xops[2] = operands[2];
12340 xops[1] = operands[2];
12341 xops[2] = operands[1];
12344 xops[3] = gen_rtx_GT (VOIDmode, operands[1], operands[2]);
12345 xops[4] = operands[1];
12346 xops[5] = operands[2];
12348 ok = ix86_expand_int_vcond (xops);
12354 (define_insn "*sse4_1_<code><mode>3<mask_name>"
12355 [(set (match_operand:VI14_128 0 "register_operand" "=Yr,*x,v")
12357 (match_operand:VI14_128 1 "vector_operand" "%0,0,v")
12358 (match_operand:VI14_128 2 "vector_operand" "YrBm,*xBm,vm")))]
12360 && <mask_mode512bit_condition>
12361 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
12363 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
12364 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
12365 vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12366 [(set_attr "isa" "noavx,noavx,avx")
12367 (set_attr "type" "sseiadd")
12368 (set_attr "prefix_extra" "1,1,*")
12369 (set_attr "prefix" "orig,orig,vex")
12370 (set_attr "mode" "TI")])
12372 (define_insn "*<code>v8hi3"
12373 [(set (match_operand:V8HI 0 "register_operand" "=x,x,v")
12375 (match_operand:V8HI 1 "vector_operand" "%0,x,v")
12376 (match_operand:V8HI 2 "vector_operand" "xBm,xm,vm")))]
12377 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
12379 p<maxmin_int>w\t{%2, %0|%0, %2}
12380 vp<maxmin_int>w\t{%2, %1, %0|%0, %1, %2}
12381 vp<maxmin_int>w\t{%2, %1, %0|%0, %1, %2}"
12382 [(set_attr "isa" "noavx,avx,avx512bw")
12383 (set_attr "type" "sseiadd")
12384 (set_attr "prefix_data16" "1,*,*")
12385 (set_attr "prefix_extra" "*,1,1")
12386 (set_attr "prefix" "orig,vex,evex")
12387 (set_attr "mode" "TI")])
12389 (define_expand "<code><mode>3"
12390 [(set (match_operand:VI124_128 0 "register_operand")
12392 (match_operand:VI124_128 1 "vector_operand")
12393 (match_operand:VI124_128 2 "vector_operand")))]
12396 if (TARGET_SSE4_1 || <MODE>mode == V16QImode)
12397 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
12398 else if (<CODE> == UMAX && <MODE>mode == V8HImode)
12400 rtx op0 = operands[0], op2 = operands[2], op3 = op0;
12401 operands[1] = force_reg (<MODE>mode, operands[1]);
12402 if (rtx_equal_p (op3, op2))
12403 op3 = gen_reg_rtx (V8HImode);
12404 emit_insn (gen_sse2_ussubv8hi3 (op3, operands[1], op2));
12405 emit_insn (gen_addv8hi3 (op0, op3, op2));
12413 operands[1] = force_reg (<MODE>mode, operands[1]);
12414 operands[2] = force_reg (<MODE>mode, operands[2]);
12416 xops[0] = operands[0];
12418 if (<CODE> == UMAX)
12420 xops[1] = operands[1];
12421 xops[2] = operands[2];
12425 xops[1] = operands[2];
12426 xops[2] = operands[1];
12429 xops[3] = gen_rtx_GTU (VOIDmode, operands[1], operands[2]);
12430 xops[4] = operands[1];
12431 xops[5] = operands[2];
12433 ok = ix86_expand_int_vcond (xops);
12439 (define_insn "*sse4_1_<code><mode>3<mask_name>"
12440 [(set (match_operand:VI24_128 0 "register_operand" "=Yr,*x,v")
12442 (match_operand:VI24_128 1 "vector_operand" "%0,0,v")
12443 (match_operand:VI24_128 2 "vector_operand" "YrBm,*xBm,vm")))]
12445 && <mask_mode512bit_condition>
12446 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
12448 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
12449 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
12450 vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12451 [(set_attr "isa" "noavx,noavx,avx")
12452 (set_attr "type" "sseiadd")
12453 (set_attr "prefix_extra" "1,1,*")
12454 (set_attr "prefix" "orig,orig,vex")
12455 (set_attr "mode" "TI")])
12457 (define_insn "*<code>v16qi3"
12458 [(set (match_operand:V16QI 0 "register_operand" "=x,x,v")
12460 (match_operand:V16QI 1 "vector_operand" "%0,x,v")
12461 (match_operand:V16QI 2 "vector_operand" "xBm,xm,vm")))]
12462 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
12464 p<maxmin_int>b\t{%2, %0|%0, %2}
12465 vp<maxmin_int>b\t{%2, %1, %0|%0, %1, %2}
12466 vp<maxmin_int>b\t{%2, %1, %0|%0, %1, %2}"
12467 [(set_attr "isa" "noavx,avx,avx512bw")
12468 (set_attr "type" "sseiadd")
12469 (set_attr "prefix_data16" "1,*,*")
12470 (set_attr "prefix_extra" "*,1,1")
12471 (set_attr "prefix" "orig,vex,evex")
12472 (set_attr "mode" "TI")])
12474 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12476 ;; Parallel integral comparisons
12478 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12480 (define_expand "avx2_eq<mode>3"
12481 [(set (match_operand:VI_256 0 "register_operand")
12483 (match_operand:VI_256 1 "nonimmediate_operand")
12484 (match_operand:VI_256 2 "nonimmediate_operand")))]
12486 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
12488 (define_insn "*avx2_eq<mode>3"
12489 [(set (match_operand:VI_256 0 "register_operand" "=x")
12491 (match_operand:VI_256 1 "nonimmediate_operand" "%x")
12492 (match_operand:VI_256 2 "nonimmediate_operand" "xm")))]
12493 "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
12494 "vpcmpeq<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
12495 [(set_attr "type" "ssecmp")
12496 (set_attr "prefix_extra" "1")
12497 (set_attr "prefix" "vex")
12498 (set_attr "mode" "OI")])
12500 (define_expand "<avx512>_eq<mode>3<mask_scalar_merge_name>"
12501 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
12502 (unspec:<avx512fmaskmode>
12503 [(match_operand:VI12_AVX512VL 1 "nonimmediate_operand")
12504 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand")]
12505 UNSPEC_MASKED_EQ))]
12507 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
12509 (define_expand "<avx512>_eq<mode>3<mask_scalar_merge_name>"
12510 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
12511 (unspec:<avx512fmaskmode>
12512 [(match_operand:VI48_AVX512VL 1 "nonimmediate_operand")
12513 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand")]
12514 UNSPEC_MASKED_EQ))]
12516 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
12518 (define_insn "<avx512>_eq<mode>3<mask_scalar_merge_name>_1"
12519 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=k,k")
12520 (unspec:<avx512fmaskmode>
12521 [(match_operand:VI12_AVX512VL 1 "nonimm_or_0_operand" "%v,v")
12522 (match_operand:VI12_AVX512VL 2 "nonimm_or_0_operand" "vm,C")]
12523 UNSPEC_MASKED_EQ))]
12524 "TARGET_AVX512BW && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
12526 vpcmpeq<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}
12527 vptestnm<ssemodesuffix>\t{%1, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %1}"
12528 [(set_attr "type" "ssecmp")
12529 (set_attr "prefix_extra" "1")
12530 (set_attr "prefix" "evex")
12531 (set_attr "mode" "<sseinsnmode>")])
12533 (define_insn "<avx512>_eq<mode>3<mask_scalar_merge_name>_1"
12534 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=k,k")
12535 (unspec:<avx512fmaskmode>
12536 [(match_operand:VI48_AVX512VL 1 "nonimm_or_0_operand" "%v,v")
12537 (match_operand:VI48_AVX512VL 2 "nonimm_or_0_operand" "vm,C")]
12538 UNSPEC_MASKED_EQ))]
12539 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
12541 vpcmpeq<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}
12542 vptestnm<ssemodesuffix>\t{%1, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %1}"
12543 [(set_attr "type" "ssecmp")
12544 (set_attr "prefix_extra" "1")
12545 (set_attr "prefix" "evex")
12546 (set_attr "mode" "<sseinsnmode>")])
12548 (define_insn "*sse4_1_eqv2di3"
12549 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,x")
12551 (match_operand:V2DI 1 "vector_operand" "%0,0,x")
12552 (match_operand:V2DI 2 "vector_operand" "YrBm,*xBm,xm")))]
12553 "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
12555 pcmpeqq\t{%2, %0|%0, %2}
12556 pcmpeqq\t{%2, %0|%0, %2}
12557 vpcmpeqq\t{%2, %1, %0|%0, %1, %2}"
12558 [(set_attr "isa" "noavx,noavx,avx")
12559 (set_attr "type" "ssecmp")
12560 (set_attr "prefix_extra" "1")
12561 (set_attr "prefix" "orig,orig,vex")
12562 (set_attr "mode" "TI")])
12564 (define_insn "*sse2_eq<mode>3"
12565 [(set (match_operand:VI124_128 0 "register_operand" "=x,x")
12567 (match_operand:VI124_128 1 "vector_operand" "%0,x")
12568 (match_operand:VI124_128 2 "vector_operand" "xBm,xm")))]
12569 "TARGET_SSE2 && !TARGET_XOP
12570 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
12572 pcmpeq<ssemodesuffix>\t{%2, %0|%0, %2}
12573 vpcmpeq<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
12574 [(set_attr "isa" "noavx,avx")
12575 (set_attr "type" "ssecmp")
12576 (set_attr "prefix_data16" "1,*")
12577 (set_attr "prefix" "orig,vex")
12578 (set_attr "mode" "TI")])
12580 (define_expand "sse2_eq<mode>3"
12581 [(set (match_operand:VI124_128 0 "register_operand")
12583 (match_operand:VI124_128 1 "vector_operand")
12584 (match_operand:VI124_128 2 "vector_operand")))]
12585 "TARGET_SSE2 && !TARGET_XOP "
12586 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
12588 (define_expand "sse4_1_eqv2di3"
12589 [(set (match_operand:V2DI 0 "register_operand")
12591 (match_operand:V2DI 1 "vector_operand")
12592 (match_operand:V2DI 2 "vector_operand")))]
12594 "ix86_fixup_binary_operands_no_copy (EQ, V2DImode, operands);")
12596 (define_insn "sse4_2_gtv2di3"
12597 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,x")
12599 (match_operand:V2DI 1 "register_operand" "0,0,x")
12600 (match_operand:V2DI 2 "vector_operand" "YrBm,*xBm,xm")))]
12603 pcmpgtq\t{%2, %0|%0, %2}
12604 pcmpgtq\t{%2, %0|%0, %2}
12605 vpcmpgtq\t{%2, %1, %0|%0, %1, %2}"
12606 [(set_attr "isa" "noavx,noavx,avx")
12607 (set_attr "type" "ssecmp")
12608 (set_attr "prefix_extra" "1")
12609 (set_attr "prefix" "orig,orig,vex")
12610 (set_attr "mode" "TI")])
12612 (define_insn "avx2_gt<mode>3"
12613 [(set (match_operand:VI_256 0 "register_operand" "=x")
12615 (match_operand:VI_256 1 "register_operand" "x")
12616 (match_operand:VI_256 2 "nonimmediate_operand" "xm")))]
12618 "vpcmpgt<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
12619 [(set_attr "type" "ssecmp")
12620 (set_attr "prefix_extra" "1")
12621 (set_attr "prefix" "vex")
12622 (set_attr "mode" "OI")])
12624 (define_insn "<avx512>_gt<mode>3<mask_scalar_merge_name>"
12625 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=k")
12626 (unspec:<avx512fmaskmode>
12627 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
12628 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")] UNSPEC_MASKED_GT))]
12630 "vpcmpgt<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
12631 [(set_attr "type" "ssecmp")
12632 (set_attr "prefix_extra" "1")
12633 (set_attr "prefix" "evex")
12634 (set_attr "mode" "<sseinsnmode>")])
12636 (define_insn "<avx512>_gt<mode>3<mask_scalar_merge_name>"
12637 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=k")
12638 (unspec:<avx512fmaskmode>
12639 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
12640 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")] UNSPEC_MASKED_GT))]
12642 "vpcmpgt<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
12643 [(set_attr "type" "ssecmp")
12644 (set_attr "prefix_extra" "1")
12645 (set_attr "prefix" "evex")
12646 (set_attr "mode" "<sseinsnmode>")])
12648 (define_insn "sse2_gt<mode>3"
12649 [(set (match_operand:VI124_128 0 "register_operand" "=x,x")
12651 (match_operand:VI124_128 1 "register_operand" "0,x")
12652 (match_operand:VI124_128 2 "vector_operand" "xBm,xm")))]
12653 "TARGET_SSE2 && !TARGET_XOP"
12655 pcmpgt<ssemodesuffix>\t{%2, %0|%0, %2}
12656 vpcmpgt<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
12657 [(set_attr "isa" "noavx,avx")
12658 (set_attr "type" "ssecmp")
12659 (set_attr "prefix_data16" "1,*")
12660 (set_attr "prefix" "orig,vex")
12661 (set_attr "mode" "TI")])
12663 (define_expand "vcond<V_512:mode><VI_AVX512BW:mode>"
12664 [(set (match_operand:V_512 0 "register_operand")
12665 (if_then_else:V_512
12666 (match_operator 3 ""
12667 [(match_operand:VI_AVX512BW 4 "nonimmediate_operand")
12668 (match_operand:VI_AVX512BW 5 "general_operand")])
12669 (match_operand:V_512 1)
12670 (match_operand:V_512 2)))]
12672 && (GET_MODE_NUNITS (<V_512:MODE>mode)
12673 == GET_MODE_NUNITS (<VI_AVX512BW:MODE>mode))"
12675 bool ok = ix86_expand_int_vcond (operands);
12680 (define_expand "vcond<V_256:mode><VI_256:mode>"
12681 [(set (match_operand:V_256 0 "register_operand")
12682 (if_then_else:V_256
12683 (match_operator 3 ""
12684 [(match_operand:VI_256 4 "nonimmediate_operand")
12685 (match_operand:VI_256 5 "general_operand")])
12686 (match_operand:V_256 1)
12687 (match_operand:V_256 2)))]
12689 && (GET_MODE_NUNITS (<V_256:MODE>mode)
12690 == GET_MODE_NUNITS (<VI_256:MODE>mode))"
12692 bool ok = ix86_expand_int_vcond (operands);
12697 (define_expand "vcond<V_128:mode><VI124_128:mode>"
12698 [(set (match_operand:V_128 0 "register_operand")
12699 (if_then_else:V_128
12700 (match_operator 3 ""
12701 [(match_operand:VI124_128 4 "vector_operand")
12702 (match_operand:VI124_128 5 "general_operand")])
12703 (match_operand:V_128 1)
12704 (match_operand:V_128 2)))]
12706 && (GET_MODE_NUNITS (<V_128:MODE>mode)
12707 == GET_MODE_NUNITS (<VI124_128:MODE>mode))"
12709 bool ok = ix86_expand_int_vcond (operands);
12714 (define_expand "vcond<VI8F_128:mode>v2di"
12715 [(set (match_operand:VI8F_128 0 "register_operand")
12716 (if_then_else:VI8F_128
12717 (match_operator 3 ""
12718 [(match_operand:V2DI 4 "vector_operand")
12719 (match_operand:V2DI 5 "general_operand")])
12720 (match_operand:VI8F_128 1)
12721 (match_operand:VI8F_128 2)))]
12724 bool ok = ix86_expand_int_vcond (operands);
12729 (define_expand "vcondu<V_512:mode><VI_AVX512BW:mode>"
12730 [(set (match_operand:V_512 0 "register_operand")
12731 (if_then_else:V_512
12732 (match_operator 3 ""
12733 [(match_operand:VI_AVX512BW 4 "nonimmediate_operand")
12734 (match_operand:VI_AVX512BW 5 "nonimmediate_operand")])
12735 (match_operand:V_512 1 "general_operand")
12736 (match_operand:V_512 2 "general_operand")))]
12738 && (GET_MODE_NUNITS (<V_512:MODE>mode)
12739 == GET_MODE_NUNITS (<VI_AVX512BW:MODE>mode))"
12741 bool ok = ix86_expand_int_vcond (operands);
12746 (define_expand "vcondu<V_256:mode><VI_256:mode>"
12747 [(set (match_operand:V_256 0 "register_operand")
12748 (if_then_else:V_256
12749 (match_operator 3 ""
12750 [(match_operand:VI_256 4 "nonimmediate_operand")
12751 (match_operand:VI_256 5 "nonimmediate_operand")])
12752 (match_operand:V_256 1 "general_operand")
12753 (match_operand:V_256 2 "general_operand")))]
12755 && (GET_MODE_NUNITS (<V_256:MODE>mode)
12756 == GET_MODE_NUNITS (<VI_256:MODE>mode))"
12758 bool ok = ix86_expand_int_vcond (operands);
12763 (define_expand "vcondu<V_128:mode><VI124_128:mode>"
12764 [(set (match_operand:V_128 0 "register_operand")
12765 (if_then_else:V_128
12766 (match_operator 3 ""
12767 [(match_operand:VI124_128 4 "vector_operand")
12768 (match_operand:VI124_128 5 "vector_operand")])
12769 (match_operand:V_128 1 "general_operand")
12770 (match_operand:V_128 2 "general_operand")))]
12772 && (GET_MODE_NUNITS (<V_128:MODE>mode)
12773 == GET_MODE_NUNITS (<VI124_128:MODE>mode))"
12775 bool ok = ix86_expand_int_vcond (operands);
12780 (define_expand "vcondu<VI8F_128:mode>v2di"
12781 [(set (match_operand:VI8F_128 0 "register_operand")
12782 (if_then_else:VI8F_128
12783 (match_operator 3 ""
12784 [(match_operand:V2DI 4 "vector_operand")
12785 (match_operand:V2DI 5 "vector_operand")])
12786 (match_operand:VI8F_128 1 "general_operand")
12787 (match_operand:VI8F_128 2 "general_operand")))]
12790 bool ok = ix86_expand_int_vcond (operands);
12795 (define_expand "vcondeq<VI8F_128:mode>v2di"
12796 [(set (match_operand:VI8F_128 0 "register_operand")
12797 (if_then_else:VI8F_128
12798 (match_operator 3 ""
12799 [(match_operand:V2DI 4 "vector_operand")
12800 (match_operand:V2DI 5 "general_operand")])
12801 (match_operand:VI8F_128 1)
12802 (match_operand:VI8F_128 2)))]
12805 bool ok = ix86_expand_int_vcond (operands);
12810 (define_mode_iterator VEC_PERM_AVX2
12811 [V16QI V8HI V4SI V2DI V4SF V2DF
12812 (V32QI "TARGET_AVX2") (V16HI "TARGET_AVX2")
12813 (V8SI "TARGET_AVX2") (V4DI "TARGET_AVX2")
12814 (V8SF "TARGET_AVX2") (V4DF "TARGET_AVX2")
12815 (V16SF "TARGET_AVX512F") (V8DF "TARGET_AVX512F")
12816 (V16SI "TARGET_AVX512F") (V8DI "TARGET_AVX512F")
12817 (V32HI "TARGET_AVX512BW") (V64QI "TARGET_AVX512VBMI")])
12819 (define_expand "vec_perm<mode>"
12820 [(match_operand:VEC_PERM_AVX2 0 "register_operand")
12821 (match_operand:VEC_PERM_AVX2 1 "register_operand")
12822 (match_operand:VEC_PERM_AVX2 2 "register_operand")
12823 (match_operand:<sseintvecmode> 3 "register_operand")]
12824 "TARGET_SSSE3 || TARGET_AVX || TARGET_XOP"
12826 ix86_expand_vec_perm (operands);
12830 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12832 ;; Parallel bitwise logical operations
12834 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12836 (define_expand "one_cmpl<mode>2"
12837 [(set (match_operand:VI 0 "register_operand")
12838 (xor:VI (match_operand:VI 1 "vector_operand")
12842 if (!TARGET_AVX512F)
12843 operands[2] = force_reg (<MODE>mode, CONSTM1_RTX (<MODE>mode));
12845 operands[2] = CONSTM1_RTX (<MODE>mode);
12848 (define_insn "<mask_codefor>one_cmpl<mode>2<mask_name>"
12849 [(set (match_operand:VI 0 "register_operand" "=v,v")
12850 (xor:VI (match_operand:VI 1 "nonimmediate_operand" "v,m")
12851 (match_operand:VI 2 "vector_all_ones_operand" "BC,BC")))]
12853 && (!<mask_applied>
12854 || <ssescalarmode>mode == SImode
12855 || <ssescalarmode>mode == DImode)"
12857 if (TARGET_AVX512VL)
12858 return "vpternlog<ternlogsuffix>\t{$0x55, %1, %0, %0<mask_operand3>|%0<mask_operand3>, %0, %1, 0x55}";
12860 return "vpternlog<ternlogsuffix>\t{$0x55, %g1, %g0, %g0<mask_operand3>|%g0<mask_operand3>, %g0, %g1, 0x55}";
12862 [(set_attr "type" "sselog")
12863 (set_attr "prefix" "evex")
12865 (if_then_else (match_test "TARGET_AVX512VL")
12866 (const_string "<sseinsnmode>")
12867 (const_string "XI")))
12868 (set (attr "enabled")
12869 (if_then_else (eq_attr "alternative" "1")
12870 (symbol_ref "<MODE_SIZE> == 64 || TARGET_AVX512VL")
12873 (define_expand "<sse2_avx2>_andnot<mode>3"
12874 [(set (match_operand:VI_AVX2 0 "register_operand")
12876 (not:VI_AVX2 (match_operand:VI_AVX2 1 "register_operand"))
12877 (match_operand:VI_AVX2 2 "vector_operand")))]
12880 (define_expand "<sse2_avx2>_andnot<mode>3_mask"
12881 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
12882 (vec_merge:VI48_AVX512VL
12885 (match_operand:VI48_AVX512VL 1 "register_operand"))
12886 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand"))
12887 (match_operand:VI48_AVX512VL 3 "nonimm_or_0_operand")
12888 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
12891 (define_expand "<sse2_avx2>_andnot<mode>3_mask"
12892 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
12893 (vec_merge:VI12_AVX512VL
12896 (match_operand:VI12_AVX512VL 1 "register_operand"))
12897 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand"))
12898 (match_operand:VI12_AVX512VL 3 "nonimm_or_0_operand")
12899 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
12902 (define_insn "*andnot<mode>3"
12903 [(set (match_operand:VI 0 "register_operand" "=x,x,v")
12905 (not:VI (match_operand:VI 1 "register_operand" "0,x,v"))
12906 (match_operand:VI 2 "vector_operand" "xBm,xm,vm")))]
12912 const char *ssesuffix;
12914 switch (get_attr_mode (insn))
12917 gcc_assert (TARGET_AVX512F);
12920 gcc_assert (TARGET_AVX2);
12923 gcc_assert (TARGET_SSE2);
12925 switch (<MODE>mode)
12929 /* There is no vpandnb or vpandnw instruction, nor vpandn for
12930 512-bit vectors. Use vpandnq instead. */
12935 ssesuffix = "<ssemodesuffix>";
12941 ssesuffix = (TARGET_AVX512VL && which_alternative == 2
12942 ? "<ssemodesuffix>" : "");
12945 ssesuffix = TARGET_AVX512VL && which_alternative == 2 ? "q" : "";
12950 gcc_assert (TARGET_AVX512F);
12953 gcc_assert (TARGET_AVX);
12956 gcc_assert (TARGET_SSE);
12962 gcc_unreachable ();
12965 switch (which_alternative)
12968 ops = "%s%s\t{%%2, %%0|%%0, %%2}";
12972 ops = "v%s%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
12975 gcc_unreachable ();
12978 snprintf (buf, sizeof (buf), ops, tmp, ssesuffix);
12979 output_asm_insn (buf, operands);
12982 [(set_attr "isa" "noavx,avx,avx")
12983 (set_attr "type" "sselog")
12984 (set (attr "prefix_data16")
12986 (and (eq_attr "alternative" "0")
12987 (eq_attr "mode" "TI"))
12989 (const_string "*")))
12990 (set_attr "prefix" "orig,vex,evex")
12992 (cond [(match_test "TARGET_AVX2")
12993 (const_string "<sseinsnmode>")
12994 (match_test "TARGET_AVX")
12996 (match_test "<MODE_SIZE> > 16")
12997 (const_string "V8SF")
12998 (const_string "<sseinsnmode>"))
12999 (ior (not (match_test "TARGET_SSE2"))
13000 (match_test "optimize_function_for_size_p (cfun)"))
13001 (const_string "V4SF")
13003 (const_string "<sseinsnmode>")))])
13005 (define_insn "*andnot<mode>3_bcst"
13006 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
13009 (match_operand:VI48_AVX512VL 1 "register_operand" "v"))
13010 (vec_duplicate:VI48_AVX512VL
13011 (match_operand:<ssescalarmode> 2 "memory_operand" "m"))))]
13013 "vpandn<ssemodesuffix>\t{%2<avx512bcst>, %1, %0|%0, %1, %2<avx512bcst>}"
13014 [(set_attr "type" "sselog")
13015 (set_attr "prefix" "evex")
13016 (set_attr "mode" "<sseinsnmode>")])
13018 (define_insn "*andnot<mode>3_mask"
13019 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
13020 (vec_merge:VI48_AVX512VL
13023 (match_operand:VI48_AVX512VL 1 "register_operand" "v"))
13024 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm"))
13025 (match_operand:VI48_AVX512VL 3 "nonimm_or_0_operand" "0C")
13026 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
13028 "vpandn<ssemodesuffix>\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}";
13029 [(set_attr "type" "sselog")
13030 (set_attr "prefix" "evex")
13031 (set_attr "mode" "<sseinsnmode>")])
13033 (define_expand "<code><mode>3"
13034 [(set (match_operand:VI 0 "register_operand")
13036 (match_operand:VI 1 "nonimmediate_or_const_vector_operand")
13037 (match_operand:VI 2 "nonimmediate_or_const_vector_operand")))]
13040 ix86_expand_vector_logical_operator (<CODE>, <MODE>mode, operands);
13044 (define_insn "<mask_codefor><code><mode>3<mask_name>"
13045 [(set (match_operand:VI48_AVX_AVX512F 0 "register_operand" "=x,x,v")
13046 (any_logic:VI48_AVX_AVX512F
13047 (match_operand:VI48_AVX_AVX512F 1 "vector_operand" "%0,x,v")
13048 (match_operand:VI48_AVX_AVX512F 2 "vector_operand" "xBm,xm,vm")))]
13049 "TARGET_SSE && <mask_mode512bit_condition>
13050 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
13055 const char *ssesuffix;
13057 switch (get_attr_mode (insn))
13060 gcc_assert (TARGET_AVX512F);
13063 gcc_assert (TARGET_AVX2);
13066 gcc_assert (TARGET_SSE2);
13068 switch (<MODE>mode)
13072 ssesuffix = "<ssemodesuffix>";
13078 ssesuffix = (TARGET_AVX512VL
13079 && (<mask_applied> || which_alternative == 2)
13080 ? "<ssemodesuffix>" : "");
13083 gcc_unreachable ();
13088 gcc_assert (TARGET_AVX);
13091 gcc_assert (TARGET_SSE);
13097 gcc_unreachable ();
13100 switch (which_alternative)
13103 if (<mask_applied>)
13104 ops = "v%s%s\t{%%2, %%0, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%0, %%2}";
13106 ops = "%s%s\t{%%2, %%0|%%0, %%2}";
13110 ops = "v%s%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
13113 gcc_unreachable ();
13116 snprintf (buf, sizeof (buf), ops, tmp, ssesuffix);
13117 output_asm_insn (buf, operands);
13120 [(set_attr "isa" "noavx,avx,avx")
13121 (set_attr "type" "sselog")
13122 (set (attr "prefix_data16")
13124 (and (eq_attr "alternative" "0")
13125 (eq_attr "mode" "TI"))
13127 (const_string "*")))
13128 (set_attr "prefix" "<mask_prefix3>,evex")
13130 (cond [(match_test "TARGET_AVX2")
13131 (const_string "<sseinsnmode>")
13132 (match_test "TARGET_AVX")
13134 (match_test "<MODE_SIZE> > 16")
13135 (const_string "V8SF")
13136 (const_string "<sseinsnmode>"))
13137 (ior (not (match_test "TARGET_SSE2"))
13138 (match_test "optimize_function_for_size_p (cfun)"))
13139 (const_string "V4SF")
13141 (const_string "<sseinsnmode>")))])
13143 (define_insn "*<code><mode>3"
13144 [(set (match_operand:VI12_AVX_AVX512F 0 "register_operand" "=x,x,v")
13145 (any_logic:VI12_AVX_AVX512F
13146 (match_operand:VI12_AVX_AVX512F 1 "vector_operand" "%0,x,v")
13147 (match_operand:VI12_AVX_AVX512F 2 "vector_operand" "xBm,xm,vm")))]
13148 "TARGET_SSE && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
13153 const char *ssesuffix;
13155 switch (get_attr_mode (insn))
13158 gcc_assert (TARGET_AVX512F);
13161 gcc_assert (TARGET_AVX2);
13164 gcc_assert (TARGET_SSE2);
13166 switch (<MODE>mode)
13176 ssesuffix = TARGET_AVX512VL && which_alternative == 2 ? "q" : "";
13179 gcc_unreachable ();
13184 gcc_assert (TARGET_AVX);
13187 gcc_assert (TARGET_SSE);
13193 gcc_unreachable ();
13196 switch (which_alternative)
13199 ops = "%s%s\t{%%2, %%0|%%0, %%2}";
13203 ops = "v%s%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
13206 gcc_unreachable ();
13209 snprintf (buf, sizeof (buf), ops, tmp, ssesuffix);
13210 output_asm_insn (buf, operands);
13213 [(set_attr "isa" "noavx,avx,avx")
13214 (set_attr "type" "sselog")
13215 (set (attr "prefix_data16")
13217 (and (eq_attr "alternative" "0")
13218 (eq_attr "mode" "TI"))
13220 (const_string "*")))
13221 (set_attr "prefix" "orig,vex,evex")
13223 (cond [(match_test "TARGET_AVX2")
13224 (const_string "<sseinsnmode>")
13225 (match_test "TARGET_AVX")
13227 (match_test "<MODE_SIZE> > 16")
13228 (const_string "V8SF")
13229 (const_string "<sseinsnmode>"))
13230 (ior (not (match_test "TARGET_SSE2"))
13231 (match_test "optimize_function_for_size_p (cfun)"))
13232 (const_string "V4SF")
13234 (const_string "<sseinsnmode>")))])
13236 (define_insn "*<code><mode>3_bcst"
13237 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
13238 (any_logic:VI48_AVX512VL
13239 (vec_duplicate:VI48_AVX512VL
13240 (match_operand:<ssescalarmode> 1 "memory_operand" "m"))
13241 (match_operand:VI48_AVX512VL 2 "register_operand" "v")))]
13242 "TARGET_AVX512F && <mask_avx512vl_condition>"
13243 "vp<logic><ssemodesuffix>\t{%1<avx512bcst>, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1<avx512bcst>}"
13244 [(set_attr "type" "sseiadd")
13245 (set_attr "prefix" "evex")
13246 (set_attr "mode" "<sseinsnmode>")])
13248 (define_mode_iterator VI1248_AVX512VLBW
13249 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX512VL && TARGET_AVX512BW")
13250 (V16QI "TARGET_AVX512VL && TARGET_AVX512BW")
13251 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX512VL && TARGET_AVX512BW")
13252 (V8HI "TARGET_AVX512VL && TARGET_AVX512BW")
13253 V16SI (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")
13254 V8DI (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")])
13256 (define_mode_iterator AVX512ZEXTMASK
13257 [(DI "TARGET_AVX512BW") (SI "TARGET_AVX512BW") HI])
13259 (define_insn "<avx512>_testm<mode>3<mask_scalar_merge_name>"
13260 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=k")
13261 (unspec:<avx512fmaskmode>
13262 [(match_operand:VI1248_AVX512VLBW 1 "register_operand" "v")
13263 (match_operand:VI1248_AVX512VLBW 2 "nonimmediate_operand" "vm")]
13266 "vptestm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
13267 [(set_attr "prefix" "evex")
13268 (set_attr "mode" "<sseinsnmode>")])
13270 (define_insn "<avx512>_testnm<mode>3<mask_scalar_merge_name>"
13271 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=k")
13272 (unspec:<avx512fmaskmode>
13273 [(match_operand:VI1248_AVX512VLBW 1 "register_operand" "v")
13274 (match_operand:VI1248_AVX512VLBW 2 "nonimmediate_operand" "vm")]
13277 "vptestnm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
13278 [(set_attr "prefix" "evex")
13279 (set_attr "mode" "<sseinsnmode>")])
13281 (define_insn "*<avx512>_testm<VI1248_AVX512VLBW:mode>3_zext"
13282 [(set (match_operand:AVX512ZEXTMASK 0 "register_operand" "=k")
13283 (zero_extend:AVX512ZEXTMASK
13284 (unspec:<VI1248_AVX512VLBW:avx512fmaskmode>
13285 [(match_operand:VI1248_AVX512VLBW 1 "register_operand" "v")
13286 (match_operand:VI1248_AVX512VLBW 2 "nonimmediate_operand" "vm")]
13289 && (<AVX512ZEXTMASK:MODE_SIZE>
13290 > GET_MODE_SIZE (<VI1248_AVX512VLBW:avx512fmaskmode>mode))"
13291 "vptestm<VI1248_AVX512VLBW:ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
13292 [(set_attr "prefix" "evex")
13293 (set_attr "mode" "<VI1248_AVX512VLBW:sseinsnmode>")])
13295 (define_insn "*<avx512>_testm<VI1248_AVX512VLBW:mode>3_zext_mask"
13296 [(set (match_operand:AVX512ZEXTMASK 0 "register_operand" "=k")
13297 (zero_extend:AVX512ZEXTMASK
13298 (and:<VI1248_AVX512VLBW:avx512fmaskmode>
13299 (unspec:<VI1248_AVX512VLBW:avx512fmaskmode>
13300 [(match_operand:VI1248_AVX512VLBW 1 "register_operand" "v")
13301 (match_operand:VI1248_AVX512VLBW 2 "nonimmediate_operand" "vm")]
13303 (match_operand:<VI1248_AVX512VLBW:avx512fmaskmode> 3 "register_operand" "Yk"))))]
13305 && (<AVX512ZEXTMASK:MODE_SIZE>
13306 > GET_MODE_SIZE (<VI1248_AVX512VLBW:avx512fmaskmode>mode))"
13307 "vptestm<VI1248_AVX512VLBW:ssemodesuffix>\t{%2, %1, %0%{%3%}|%0%{%3%}, %1, %2}"
13308 [(set_attr "prefix" "evex")
13309 (set_attr "mode" "<VI1248_AVX512VLBW:sseinsnmode>")])
13311 (define_insn "*<avx512>_testnm<VI1248_AVX512VLBW:mode>3_zext"
13312 [(set (match_operand:AVX512ZEXTMASK 0 "register_operand" "=k")
13313 (zero_extend:AVX512ZEXTMASK
13314 (unspec:<VI1248_AVX512VLBW:avx512fmaskmode>
13315 [(match_operand:VI1248_AVX512VLBW 1 "register_operand" "v")
13316 (match_operand:VI1248_AVX512VLBW 2 "nonimmediate_operand" "vm")]
13319 && (<AVX512ZEXTMASK:MODE_SIZE>
13320 > GET_MODE_SIZE (<VI1248_AVX512VLBW:avx512fmaskmode>mode))"
13321 "vptestnm<VI1248_AVX512VLBW:ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
13322 [(set_attr "prefix" "evex")
13323 (set_attr "mode" "<VI1248_AVX512VLBW:sseinsnmode>")])
13325 (define_insn "*<avx512>_testnm<VI1248_AVX512VLBW:mode>3_zext_mask"
13326 [(set (match_operand:AVX512ZEXTMASK 0 "register_operand" "=k")
13327 (zero_extend:AVX512ZEXTMASK
13328 (and:<VI1248_AVX512VLBW:avx512fmaskmode>
13329 (unspec:<VI1248_AVX512VLBW:avx512fmaskmode>
13330 [(match_operand:VI1248_AVX512VLBW 1 "register_operand" "v")
13331 (match_operand:VI1248_AVX512VLBW 2 "nonimmediate_operand" "vm")]
13333 (match_operand:<VI1248_AVX512VLBW:avx512fmaskmode> 3 "register_operand" "Yk"))))]
13335 && (<AVX512ZEXTMASK:MODE_SIZE>
13336 > GET_MODE_SIZE (<VI1248_AVX512VLBW:avx512fmaskmode>mode))"
13337 "vptestnm<VI1248_AVX512VLBW:ssemodesuffix>\t{%2, %1, %0%{%3%}|%0%{%3%}, %1, %2}"
13338 [(set_attr "prefix" "evex")
13339 (set_attr "mode" "<VI1248_AVX512VLBW:sseinsnmode>")])
13341 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
13343 ;; Parallel integral element swizzling
13345 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
13347 (define_expand "vec_pack_trunc_<mode>"
13348 [(match_operand:<ssepackmode> 0 "register_operand")
13349 (match_operand:VI248_AVX2_8_AVX512F_24_AVX512BW 1 "register_operand")
13350 (match_operand:VI248_AVX2_8_AVX512F_24_AVX512BW 2 "register_operand")]
13353 rtx op1 = gen_lowpart (<ssepackmode>mode, operands[1]);
13354 rtx op2 = gen_lowpart (<ssepackmode>mode, operands[2]);
13355 ix86_expand_vec_extract_even_odd (operands[0], op1, op2, 0);
13359 (define_expand "vec_pack_trunc_qi"
13360 [(set (match_operand:HI 0 "register_operand")
13361 (ior:HI (ashift:HI (zero_extend:HI (match_operand:QI 2 "register_operand"))
13363 (zero_extend:HI (match_operand:QI 1 "register_operand"))))]
13366 (define_expand "vec_pack_trunc_<mode>"
13367 [(set (match_operand:<DOUBLEMASKMODE> 0 "register_operand")
13368 (ior:<DOUBLEMASKMODE>
13369 (ashift:<DOUBLEMASKMODE>
13370 (zero_extend:<DOUBLEMASKMODE>
13371 (match_operand:SWI24 2 "register_operand"))
13373 (zero_extend:<DOUBLEMASKMODE>
13374 (match_operand:SWI24 1 "register_operand"))))]
13377 operands[3] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
13380 (define_expand "vec_pack_sbool_trunc_qi"
13381 [(match_operand:QI 0 "register_operand")
13382 (match_operand:QI 1 "register_operand")
13383 (match_operand:QI 2 "register_operand")
13384 (match_operand:QI 3 "const_int_operand")]
13387 HOST_WIDE_INT nunits = INTVAL (operands[3]);
13388 rtx mask, tem1, tem2;
13389 if (nunits != 8 && nunits != 4)
13391 mask = gen_reg_rtx (QImode);
13392 emit_move_insn (mask, GEN_INT ((1 << (nunits / 2)) - 1));
13393 tem1 = gen_reg_rtx (QImode);
13394 emit_insn (gen_kandqi (tem1, operands[1], mask));
13395 if (TARGET_AVX512DQ)
13397 tem2 = gen_reg_rtx (QImode);
13398 emit_insn (gen_kashiftqi (tem2, operands[2],
13399 GEN_INT (nunits / 2)));
13403 tem2 = gen_reg_rtx (HImode);
13404 emit_insn (gen_kashifthi (tem2, lowpart_subreg (HImode, operands[2],
13406 GEN_INT (nunits / 2)));
13407 tem2 = lowpart_subreg (QImode, tem2, HImode);
13409 emit_insn (gen_kiorqi (operands[0], tem1, tem2));
13413 (define_insn "<sse2_avx2>_packsswb<mask_name>"
13414 [(set (match_operand:VI1_AVX512 0 "register_operand" "=x,x,v")
13415 (vec_concat:VI1_AVX512
13416 (ss_truncate:<ssehalfvecmode>
13417 (match_operand:<sseunpackmode> 1 "register_operand" "0,x,v"))
13418 (ss_truncate:<ssehalfvecmode>
13419 (match_operand:<sseunpackmode> 2 "vector_operand" "xBm,xm,vm"))))]
13420 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
13422 packsswb\t{%2, %0|%0, %2}
13423 vpacksswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
13424 vpacksswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13425 [(set_attr "isa" "noavx,avx,avx512bw")
13426 (set_attr "type" "sselog")
13427 (set_attr "prefix_data16" "1,*,*")
13428 (set_attr "prefix" "orig,<mask_prefix>,evex")
13429 (set_attr "mode" "<sseinsnmode>")])
13431 (define_insn "<sse2_avx2>_packssdw<mask_name>"
13432 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,x,v")
13433 (vec_concat:VI2_AVX2
13434 (ss_truncate:<ssehalfvecmode>
13435 (match_operand:<sseunpackmode> 1 "register_operand" "0,x,v"))
13436 (ss_truncate:<ssehalfvecmode>
13437 (match_operand:<sseunpackmode> 2 "vector_operand" "xBm,xm,vm"))))]
13438 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
13440 packssdw\t{%2, %0|%0, %2}
13441 vpackssdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
13442 vpackssdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13443 [(set_attr "isa" "noavx,avx,avx512bw")
13444 (set_attr "type" "sselog")
13445 (set_attr "prefix_data16" "1,*,*")
13446 (set_attr "prefix" "orig,<mask_prefix>,evex")
13447 (set_attr "mode" "<sseinsnmode>")])
13449 (define_insn "<sse2_avx2>_packuswb<mask_name>"
13450 [(set (match_operand:VI1_AVX512 0 "register_operand" "=x,x,v")
13451 (vec_concat:VI1_AVX512
13452 (us_truncate:<ssehalfvecmode>
13453 (match_operand:<sseunpackmode> 1 "register_operand" "0,x,v"))
13454 (us_truncate:<ssehalfvecmode>
13455 (match_operand:<sseunpackmode> 2 "vector_operand" "xBm,xm,vm"))))]
13456 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
13458 packuswb\t{%2, %0|%0, %2}
13459 vpackuswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
13460 vpackuswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13461 [(set_attr "isa" "noavx,avx,avx512bw")
13462 (set_attr "type" "sselog")
13463 (set_attr "prefix_data16" "1,*,*")
13464 (set_attr "prefix" "orig,<mask_prefix>,evex")
13465 (set_attr "mode" "<sseinsnmode>")])
13467 (define_insn "avx512bw_interleave_highv64qi<mask_name>"
13468 [(set (match_operand:V64QI 0 "register_operand" "=v")
13471 (match_operand:V64QI 1 "register_operand" "v")
13472 (match_operand:V64QI 2 "nonimmediate_operand" "vm"))
13473 (parallel [(const_int 8) (const_int 72)
13474 (const_int 9) (const_int 73)
13475 (const_int 10) (const_int 74)
13476 (const_int 11) (const_int 75)
13477 (const_int 12) (const_int 76)
13478 (const_int 13) (const_int 77)
13479 (const_int 14) (const_int 78)
13480 (const_int 15) (const_int 79)
13481 (const_int 24) (const_int 88)
13482 (const_int 25) (const_int 89)
13483 (const_int 26) (const_int 90)
13484 (const_int 27) (const_int 91)
13485 (const_int 28) (const_int 92)
13486 (const_int 29) (const_int 93)
13487 (const_int 30) (const_int 94)
13488 (const_int 31) (const_int 95)
13489 (const_int 40) (const_int 104)
13490 (const_int 41) (const_int 105)
13491 (const_int 42) (const_int 106)
13492 (const_int 43) (const_int 107)
13493 (const_int 44) (const_int 108)
13494 (const_int 45) (const_int 109)
13495 (const_int 46) (const_int 110)
13496 (const_int 47) (const_int 111)
13497 (const_int 56) (const_int 120)
13498 (const_int 57) (const_int 121)
13499 (const_int 58) (const_int 122)
13500 (const_int 59) (const_int 123)
13501 (const_int 60) (const_int 124)
13502 (const_int 61) (const_int 125)
13503 (const_int 62) (const_int 126)
13504 (const_int 63) (const_int 127)])))]
13506 "vpunpckhbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13507 [(set_attr "type" "sselog")
13508 (set_attr "prefix" "evex")
13509 (set_attr "mode" "XI")])
13511 (define_insn "avx2_interleave_highv32qi<mask_name>"
13512 [(set (match_operand:V32QI 0 "register_operand" "=v")
13515 (match_operand:V32QI 1 "register_operand" "v")
13516 (match_operand:V32QI 2 "nonimmediate_operand" "vm"))
13517 (parallel [(const_int 8) (const_int 40)
13518 (const_int 9) (const_int 41)
13519 (const_int 10) (const_int 42)
13520 (const_int 11) (const_int 43)
13521 (const_int 12) (const_int 44)
13522 (const_int 13) (const_int 45)
13523 (const_int 14) (const_int 46)
13524 (const_int 15) (const_int 47)
13525 (const_int 24) (const_int 56)
13526 (const_int 25) (const_int 57)
13527 (const_int 26) (const_int 58)
13528 (const_int 27) (const_int 59)
13529 (const_int 28) (const_int 60)
13530 (const_int 29) (const_int 61)
13531 (const_int 30) (const_int 62)
13532 (const_int 31) (const_int 63)])))]
13533 "TARGET_AVX2 && <mask_avx512vl_condition>"
13534 "vpunpckhbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13535 [(set_attr "type" "sselog")
13536 (set_attr "prefix" "<mask_prefix>")
13537 (set_attr "mode" "OI")])
13539 (define_insn "vec_interleave_highv16qi<mask_name>"
13540 [(set (match_operand:V16QI 0 "register_operand" "=x,v")
13543 (match_operand:V16QI 1 "register_operand" "0,v")
13544 (match_operand:V16QI 2 "vector_operand" "xBm,vm"))
13545 (parallel [(const_int 8) (const_int 24)
13546 (const_int 9) (const_int 25)
13547 (const_int 10) (const_int 26)
13548 (const_int 11) (const_int 27)
13549 (const_int 12) (const_int 28)
13550 (const_int 13) (const_int 29)
13551 (const_int 14) (const_int 30)
13552 (const_int 15) (const_int 31)])))]
13553 "TARGET_SSE2 && <mask_avx512vl_condition>"
13555 punpckhbw\t{%2, %0|%0, %2}
13556 vpunpckhbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13557 [(set_attr "isa" "noavx,avx")
13558 (set_attr "type" "sselog")
13559 (set_attr "prefix_data16" "1,*")
13560 (set_attr "prefix" "orig,<mask_prefix>")
13561 (set_attr "mode" "TI")])
13563 (define_insn "avx512bw_interleave_lowv64qi<mask_name>"
13564 [(set (match_operand:V64QI 0 "register_operand" "=v")
13567 (match_operand:V64QI 1 "register_operand" "v")
13568 (match_operand:V64QI 2 "nonimmediate_operand" "vm"))
13569 (parallel [(const_int 0) (const_int 64)
13570 (const_int 1) (const_int 65)
13571 (const_int 2) (const_int 66)
13572 (const_int 3) (const_int 67)
13573 (const_int 4) (const_int 68)
13574 (const_int 5) (const_int 69)
13575 (const_int 6) (const_int 70)
13576 (const_int 7) (const_int 71)
13577 (const_int 16) (const_int 80)
13578 (const_int 17) (const_int 81)
13579 (const_int 18) (const_int 82)
13580 (const_int 19) (const_int 83)
13581 (const_int 20) (const_int 84)
13582 (const_int 21) (const_int 85)
13583 (const_int 22) (const_int 86)
13584 (const_int 23) (const_int 87)
13585 (const_int 32) (const_int 96)
13586 (const_int 33) (const_int 97)
13587 (const_int 34) (const_int 98)
13588 (const_int 35) (const_int 99)
13589 (const_int 36) (const_int 100)
13590 (const_int 37) (const_int 101)
13591 (const_int 38) (const_int 102)
13592 (const_int 39) (const_int 103)
13593 (const_int 48) (const_int 112)
13594 (const_int 49) (const_int 113)
13595 (const_int 50) (const_int 114)
13596 (const_int 51) (const_int 115)
13597 (const_int 52) (const_int 116)
13598 (const_int 53) (const_int 117)
13599 (const_int 54) (const_int 118)
13600 (const_int 55) (const_int 119)])))]
13602 "vpunpcklbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13603 [(set_attr "type" "sselog")
13604 (set_attr "prefix" "evex")
13605 (set_attr "mode" "XI")])
13607 (define_insn "avx2_interleave_lowv32qi<mask_name>"
13608 [(set (match_operand:V32QI 0 "register_operand" "=v")
13611 (match_operand:V32QI 1 "register_operand" "v")
13612 (match_operand:V32QI 2 "nonimmediate_operand" "vm"))
13613 (parallel [(const_int 0) (const_int 32)
13614 (const_int 1) (const_int 33)
13615 (const_int 2) (const_int 34)
13616 (const_int 3) (const_int 35)
13617 (const_int 4) (const_int 36)
13618 (const_int 5) (const_int 37)
13619 (const_int 6) (const_int 38)
13620 (const_int 7) (const_int 39)
13621 (const_int 16) (const_int 48)
13622 (const_int 17) (const_int 49)
13623 (const_int 18) (const_int 50)
13624 (const_int 19) (const_int 51)
13625 (const_int 20) (const_int 52)
13626 (const_int 21) (const_int 53)
13627 (const_int 22) (const_int 54)
13628 (const_int 23) (const_int 55)])))]
13629 "TARGET_AVX2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
13630 "vpunpcklbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13631 [(set_attr "type" "sselog")
13632 (set_attr "prefix" "maybe_vex")
13633 (set_attr "mode" "OI")])
13635 (define_insn "vec_interleave_lowv16qi<mask_name>"
13636 [(set (match_operand:V16QI 0 "register_operand" "=x,v")
13639 (match_operand:V16QI 1 "register_operand" "0,v")
13640 (match_operand:V16QI 2 "vector_operand" "xBm,vm"))
13641 (parallel [(const_int 0) (const_int 16)
13642 (const_int 1) (const_int 17)
13643 (const_int 2) (const_int 18)
13644 (const_int 3) (const_int 19)
13645 (const_int 4) (const_int 20)
13646 (const_int 5) (const_int 21)
13647 (const_int 6) (const_int 22)
13648 (const_int 7) (const_int 23)])))]
13649 "TARGET_SSE2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
13651 punpcklbw\t{%2, %0|%0, %2}
13652 vpunpcklbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13653 [(set_attr "isa" "noavx,avx")
13654 (set_attr "type" "sselog")
13655 (set_attr "prefix_data16" "1,*")
13656 (set_attr "prefix" "orig,vex")
13657 (set_attr "mode" "TI")])
13659 (define_insn "avx512bw_interleave_highv32hi<mask_name>"
13660 [(set (match_operand:V32HI 0 "register_operand" "=v")
13663 (match_operand:V32HI 1 "register_operand" "v")
13664 (match_operand:V32HI 2 "nonimmediate_operand" "vm"))
13665 (parallel [(const_int 4) (const_int 36)
13666 (const_int 5) (const_int 37)
13667 (const_int 6) (const_int 38)
13668 (const_int 7) (const_int 39)
13669 (const_int 12) (const_int 44)
13670 (const_int 13) (const_int 45)
13671 (const_int 14) (const_int 46)
13672 (const_int 15) (const_int 47)
13673 (const_int 20) (const_int 52)
13674 (const_int 21) (const_int 53)
13675 (const_int 22) (const_int 54)
13676 (const_int 23) (const_int 55)
13677 (const_int 28) (const_int 60)
13678 (const_int 29) (const_int 61)
13679 (const_int 30) (const_int 62)
13680 (const_int 31) (const_int 63)])))]
13682 "vpunpckhwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13683 [(set_attr "type" "sselog")
13684 (set_attr "prefix" "evex")
13685 (set_attr "mode" "XI")])
13687 (define_insn "avx2_interleave_highv16hi<mask_name>"
13688 [(set (match_operand:V16HI 0 "register_operand" "=v")
13691 (match_operand:V16HI 1 "register_operand" "v")
13692 (match_operand:V16HI 2 "nonimmediate_operand" "vm"))
13693 (parallel [(const_int 4) (const_int 20)
13694 (const_int 5) (const_int 21)
13695 (const_int 6) (const_int 22)
13696 (const_int 7) (const_int 23)
13697 (const_int 12) (const_int 28)
13698 (const_int 13) (const_int 29)
13699 (const_int 14) (const_int 30)
13700 (const_int 15) (const_int 31)])))]
13701 "TARGET_AVX2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
13702 "vpunpckhwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13703 [(set_attr "type" "sselog")
13704 (set_attr "prefix" "maybe_evex")
13705 (set_attr "mode" "OI")])
13707 (define_insn "vec_interleave_highv8hi<mask_name>"
13708 [(set (match_operand:V8HI 0 "register_operand" "=x,v")
13711 (match_operand:V8HI 1 "register_operand" "0,v")
13712 (match_operand:V8HI 2 "vector_operand" "xBm,vm"))
13713 (parallel [(const_int 4) (const_int 12)
13714 (const_int 5) (const_int 13)
13715 (const_int 6) (const_int 14)
13716 (const_int 7) (const_int 15)])))]
13717 "TARGET_SSE2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
13719 punpckhwd\t{%2, %0|%0, %2}
13720 vpunpckhwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13721 [(set_attr "isa" "noavx,avx")
13722 (set_attr "type" "sselog")
13723 (set_attr "prefix_data16" "1,*")
13724 (set_attr "prefix" "orig,maybe_vex")
13725 (set_attr "mode" "TI")])
13727 (define_insn "<mask_codefor>avx512bw_interleave_lowv32hi<mask_name>"
13728 [(set (match_operand:V32HI 0 "register_operand" "=v")
13731 (match_operand:V32HI 1 "register_operand" "v")
13732 (match_operand:V32HI 2 "nonimmediate_operand" "vm"))
13733 (parallel [(const_int 0) (const_int 32)
13734 (const_int 1) (const_int 33)
13735 (const_int 2) (const_int 34)
13736 (const_int 3) (const_int 35)
13737 (const_int 8) (const_int 40)
13738 (const_int 9) (const_int 41)
13739 (const_int 10) (const_int 42)
13740 (const_int 11) (const_int 43)
13741 (const_int 16) (const_int 48)
13742 (const_int 17) (const_int 49)
13743 (const_int 18) (const_int 50)
13744 (const_int 19) (const_int 51)
13745 (const_int 24) (const_int 56)
13746 (const_int 25) (const_int 57)
13747 (const_int 26) (const_int 58)
13748 (const_int 27) (const_int 59)])))]
13750 "vpunpcklwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13751 [(set_attr "type" "sselog")
13752 (set_attr "prefix" "evex")
13753 (set_attr "mode" "XI")])
13755 (define_insn "avx2_interleave_lowv16hi<mask_name>"
13756 [(set (match_operand:V16HI 0 "register_operand" "=v")
13759 (match_operand:V16HI 1 "register_operand" "v")
13760 (match_operand:V16HI 2 "nonimmediate_operand" "vm"))
13761 (parallel [(const_int 0) (const_int 16)
13762 (const_int 1) (const_int 17)
13763 (const_int 2) (const_int 18)
13764 (const_int 3) (const_int 19)
13765 (const_int 8) (const_int 24)
13766 (const_int 9) (const_int 25)
13767 (const_int 10) (const_int 26)
13768 (const_int 11) (const_int 27)])))]
13769 "TARGET_AVX2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
13770 "vpunpcklwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13771 [(set_attr "type" "sselog")
13772 (set_attr "prefix" "maybe_evex")
13773 (set_attr "mode" "OI")])
13775 (define_insn "vec_interleave_lowv8hi<mask_name>"
13776 [(set (match_operand:V8HI 0 "register_operand" "=x,v")
13779 (match_operand:V8HI 1 "register_operand" "0,v")
13780 (match_operand:V8HI 2 "vector_operand" "xBm,vm"))
13781 (parallel [(const_int 0) (const_int 8)
13782 (const_int 1) (const_int 9)
13783 (const_int 2) (const_int 10)
13784 (const_int 3) (const_int 11)])))]
13785 "TARGET_SSE2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
13787 punpcklwd\t{%2, %0|%0, %2}
13788 vpunpcklwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13789 [(set_attr "isa" "noavx,avx")
13790 (set_attr "type" "sselog")
13791 (set_attr "prefix_data16" "1,*")
13792 (set_attr "prefix" "orig,maybe_evex")
13793 (set_attr "mode" "TI")])
13795 (define_insn "avx2_interleave_highv8si<mask_name>"
13796 [(set (match_operand:V8SI 0 "register_operand" "=v")
13799 (match_operand:V8SI 1 "register_operand" "v")
13800 (match_operand:V8SI 2 "nonimmediate_operand" "vm"))
13801 (parallel [(const_int 2) (const_int 10)
13802 (const_int 3) (const_int 11)
13803 (const_int 6) (const_int 14)
13804 (const_int 7) (const_int 15)])))]
13805 "TARGET_AVX2 && <mask_avx512vl_condition>"
13806 "vpunpckhdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13807 [(set_attr "type" "sselog")
13808 (set_attr "prefix" "maybe_evex")
13809 (set_attr "mode" "OI")])
13811 (define_insn "<mask_codefor>avx512f_interleave_highv16si<mask_name>"
13812 [(set (match_operand:V16SI 0 "register_operand" "=v")
13815 (match_operand:V16SI 1 "register_operand" "v")
13816 (match_operand:V16SI 2 "nonimmediate_operand" "vm"))
13817 (parallel [(const_int 2) (const_int 18)
13818 (const_int 3) (const_int 19)
13819 (const_int 6) (const_int 22)
13820 (const_int 7) (const_int 23)
13821 (const_int 10) (const_int 26)
13822 (const_int 11) (const_int 27)
13823 (const_int 14) (const_int 30)
13824 (const_int 15) (const_int 31)])))]
13826 "vpunpckhdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13827 [(set_attr "type" "sselog")
13828 (set_attr "prefix" "evex")
13829 (set_attr "mode" "XI")])
13832 (define_insn "vec_interleave_highv4si<mask_name>"
13833 [(set (match_operand:V4SI 0 "register_operand" "=x,v")
13836 (match_operand:V4SI 1 "register_operand" "0,v")
13837 (match_operand:V4SI 2 "vector_operand" "xBm,vm"))
13838 (parallel [(const_int 2) (const_int 6)
13839 (const_int 3) (const_int 7)])))]
13840 "TARGET_SSE2 && <mask_avx512vl_condition>"
13842 punpckhdq\t{%2, %0|%0, %2}
13843 vpunpckhdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13844 [(set_attr "isa" "noavx,avx")
13845 (set_attr "type" "sselog")
13846 (set_attr "prefix_data16" "1,*")
13847 (set_attr "prefix" "orig,maybe_vex")
13848 (set_attr "mode" "TI")])
13850 (define_insn "avx2_interleave_lowv8si<mask_name>"
13851 [(set (match_operand:V8SI 0 "register_operand" "=v")
13854 (match_operand:V8SI 1 "register_operand" "v")
13855 (match_operand:V8SI 2 "nonimmediate_operand" "vm"))
13856 (parallel [(const_int 0) (const_int 8)
13857 (const_int 1) (const_int 9)
13858 (const_int 4) (const_int 12)
13859 (const_int 5) (const_int 13)])))]
13860 "TARGET_AVX2 && <mask_avx512vl_condition>"
13861 "vpunpckldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13862 [(set_attr "type" "sselog")
13863 (set_attr "prefix" "maybe_evex")
13864 (set_attr "mode" "OI")])
13866 (define_insn "<mask_codefor>avx512f_interleave_lowv16si<mask_name>"
13867 [(set (match_operand:V16SI 0 "register_operand" "=v")
13870 (match_operand:V16SI 1 "register_operand" "v")
13871 (match_operand:V16SI 2 "nonimmediate_operand" "vm"))
13872 (parallel [(const_int 0) (const_int 16)
13873 (const_int 1) (const_int 17)
13874 (const_int 4) (const_int 20)
13875 (const_int 5) (const_int 21)
13876 (const_int 8) (const_int 24)
13877 (const_int 9) (const_int 25)
13878 (const_int 12) (const_int 28)
13879 (const_int 13) (const_int 29)])))]
13881 "vpunpckldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13882 [(set_attr "type" "sselog")
13883 (set_attr "prefix" "evex")
13884 (set_attr "mode" "XI")])
13886 (define_insn "vec_interleave_lowv4si<mask_name>"
13887 [(set (match_operand:V4SI 0 "register_operand" "=x,v")
13890 (match_operand:V4SI 1 "register_operand" "0,v")
13891 (match_operand:V4SI 2 "vector_operand" "xBm,vm"))
13892 (parallel [(const_int 0) (const_int 4)
13893 (const_int 1) (const_int 5)])))]
13894 "TARGET_SSE2 && <mask_avx512vl_condition>"
13896 punpckldq\t{%2, %0|%0, %2}
13897 vpunpckldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13898 [(set_attr "isa" "noavx,avx")
13899 (set_attr "type" "sselog")
13900 (set_attr "prefix_data16" "1,*")
13901 (set_attr "prefix" "orig,vex")
13902 (set_attr "mode" "TI")])
13904 (define_expand "vec_interleave_high<mode>"
13905 [(match_operand:VI_256 0 "register_operand")
13906 (match_operand:VI_256 1 "register_operand")
13907 (match_operand:VI_256 2 "nonimmediate_operand")]
13910 rtx t1 = gen_reg_rtx (<MODE>mode);
13911 rtx t2 = gen_reg_rtx (<MODE>mode);
13912 rtx t3 = gen_reg_rtx (V4DImode);
13913 emit_insn (gen_avx2_interleave_low<mode> (t1, operands[1], operands[2]));
13914 emit_insn (gen_avx2_interleave_high<mode> (t2, operands[1], operands[2]));
13915 emit_insn (gen_avx2_permv2ti (t3, gen_lowpart (V4DImode, t1),
13916 gen_lowpart (V4DImode, t2),
13917 GEN_INT (1 + (3 << 4))));
13918 emit_move_insn (operands[0], gen_lowpart (<MODE>mode, t3));
13922 (define_expand "vec_interleave_low<mode>"
13923 [(match_operand:VI_256 0 "register_operand")
13924 (match_operand:VI_256 1 "register_operand")
13925 (match_operand:VI_256 2 "nonimmediate_operand")]
13928 rtx t1 = gen_reg_rtx (<MODE>mode);
13929 rtx t2 = gen_reg_rtx (<MODE>mode);
13930 rtx t3 = gen_reg_rtx (V4DImode);
13931 emit_insn (gen_avx2_interleave_low<mode> (t1, operands[1], operands[2]));
13932 emit_insn (gen_avx2_interleave_high<mode> (t2, operands[1], operands[2]));
13933 emit_insn (gen_avx2_permv2ti (t3, gen_lowpart (V4DImode, t1),
13934 gen_lowpart (V4DImode, t2),
13935 GEN_INT (0 + (2 << 4))));
13936 emit_move_insn (operands[0], gen_lowpart (<MODE>mode, t3));
13940 ;; Modes handled by pinsr patterns.
13941 (define_mode_iterator PINSR_MODE
13942 [(V16QI "TARGET_SSE4_1") V8HI
13943 (V4SI "TARGET_SSE4_1")
13944 (V2DI "TARGET_SSE4_1 && TARGET_64BIT")])
13946 (define_mode_attr sse2p4_1
13947 [(V16QI "sse4_1") (V8HI "sse2")
13948 (V4SI "sse4_1") (V2DI "sse4_1")])
13950 (define_mode_attr pinsr_evex_isa
13951 [(V16QI "avx512bw") (V8HI "avx512bw")
13952 (V4SI "avx512dq") (V2DI "avx512dq")])
13954 ;; sse4_1_pinsrd must come before sse2_loadld since it is preferred.
13955 (define_insn "<sse2p4_1>_pinsr<ssemodesuffix>"
13956 [(set (match_operand:PINSR_MODE 0 "register_operand" "=x,x,x,x,v,v")
13957 (vec_merge:PINSR_MODE
13958 (vec_duplicate:PINSR_MODE
13959 (match_operand:<ssescalarmode> 2 "nonimmediate_operand" "r,m,r,m,r,m"))
13960 (match_operand:PINSR_MODE 1 "register_operand" "0,0,x,x,v,v")
13961 (match_operand:SI 3 "const_int_operand")))]
13963 && ((unsigned) exact_log2 (INTVAL (operands[3]))
13964 < GET_MODE_NUNITS (<MODE>mode))"
13966 operands[3] = GEN_INT (exact_log2 (INTVAL (operands[3])));
13968 switch (which_alternative)
13971 if (GET_MODE_SIZE (<ssescalarmode>mode) < GET_MODE_SIZE (SImode))
13972 return "pinsr<ssemodesuffix>\t{%3, %k2, %0|%0, %k2, %3}";
13975 return "pinsr<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}";
13978 if (GET_MODE_SIZE (<ssescalarmode>mode) < GET_MODE_SIZE (SImode))
13979 return "vpinsr<ssemodesuffix>\t{%3, %k2, %1, %0|%0, %1, %k2, %3}";
13983 return "vpinsr<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}";
13985 gcc_unreachable ();
13988 [(set_attr "isa" "noavx,noavx,avx,avx,<pinsr_evex_isa>,<pinsr_evex_isa>")
13989 (set_attr "type" "sselog")
13990 (set (attr "prefix_rex")
13992 (and (not (match_test "TARGET_AVX"))
13993 (eq (const_string "<MODE>mode") (const_string "V2DImode")))
13995 (const_string "*")))
13996 (set (attr "prefix_data16")
13998 (and (not (match_test "TARGET_AVX"))
13999 (eq (const_string "<MODE>mode") (const_string "V8HImode")))
14001 (const_string "*")))
14002 (set (attr "prefix_extra")
14004 (and (not (match_test "TARGET_AVX"))
14005 (eq (const_string "<MODE>mode") (const_string "V8HImode")))
14007 (const_string "1")))
14008 (set_attr "length_immediate" "1")
14009 (set_attr "prefix" "orig,orig,vex,vex,evex,evex")
14010 (set_attr "mode" "TI")])
14012 (define_expand "<extract_type>_vinsert<shuffletype><extract_suf>_mask"
14013 [(match_operand:AVX512_VEC 0 "register_operand")
14014 (match_operand:AVX512_VEC 1 "register_operand")
14015 (match_operand:<ssequartermode> 2 "nonimmediate_operand")
14016 (match_operand:SI 3 "const_0_to_3_operand")
14017 (match_operand:AVX512_VEC 4 "register_operand")
14018 (match_operand:<avx512fmaskmode> 5 "register_operand")]
14021 int mask, selector;
14022 mask = INTVAL (operands[3]);
14023 selector = (GET_MODE_UNIT_SIZE (<MODE>mode) == 4
14024 ? 0xFFFF ^ (0x000F << mask * 4)
14025 : 0xFF ^ (0x03 << mask * 2));
14026 emit_insn (gen_<extract_type>_vinsert<shuffletype><extract_suf>_1_mask
14027 (operands[0], operands[1], operands[2], GEN_INT (selector),
14028 operands[4], operands[5]));
14032 (define_insn "*<extract_type>_vinsert<shuffletype><extract_suf>_0"
14033 [(set (match_operand:AVX512_VEC 0 "register_operand" "=v,x,Yv")
14034 (vec_merge:AVX512_VEC
14035 (match_operand:AVX512_VEC 1 "reg_or_0_operand" "v,C,C")
14036 (vec_duplicate:AVX512_VEC
14037 (match_operand:<ssequartermode> 2 "nonimmediate_operand" "vm,xm,vm"))
14038 (match_operand:SI 3 "const_int_operand" "n,n,n")))]
14040 && (INTVAL (operands[3])
14041 == (GET_MODE_UNIT_SIZE (<MODE>mode) == 4 ? 0xFFF0 : 0xFC))"
14043 if (which_alternative == 0)
14044 return "vinsert<shuffletype><extract_suf>\t{$0, %2, %1, %0|%0, %1, %2, 0}";
14045 switch (<MODE>mode)
14048 if (misaligned_operand (operands[2], <ssequartermode>mode))
14049 return "vmovupd\t{%2, %x0|%x0, %2}";
14051 return "vmovapd\t{%2, %x0|%x0, %2}";
14053 if (misaligned_operand (operands[2], <ssequartermode>mode))
14054 return "vmovups\t{%2, %x0|%x0, %2}";
14056 return "vmovaps\t{%2, %x0|%x0, %2}";
14058 if (misaligned_operand (operands[2], <ssequartermode>mode))
14059 return which_alternative == 2 ? "vmovdqu64\t{%2, %x0|%x0, %2}"
14060 : "vmovdqu\t{%2, %x0|%x0, %2}";
14062 return which_alternative == 2 ? "vmovdqa64\t{%2, %x0|%x0, %2}"
14063 : "vmovdqa\t{%2, %x0|%x0, %2}";
14065 if (misaligned_operand (operands[2], <ssequartermode>mode))
14066 return which_alternative == 2 ? "vmovdqu32\t{%2, %x0|%x0, %2}"
14067 : "vmovdqu\t{%2, %x0|%x0, %2}";
14069 return which_alternative == 2 ? "vmovdqa32\t{%2, %x0|%x0, %2}"
14070 : "vmovdqa\t{%2, %x0|%x0, %2}";
14072 gcc_unreachable ();
14075 [(set_attr "type" "sselog,ssemov,ssemov")
14076 (set_attr "length_immediate" "1,0,0")
14077 (set_attr "prefix" "evex,vex,evex")
14078 (set_attr "mode" "<sseinsnmode>,<ssequarterinsnmode>,<ssequarterinsnmode>")])
14080 (define_insn "<mask_codefor><extract_type>_vinsert<shuffletype><extract_suf>_1<mask_name>"
14081 [(set (match_operand:AVX512_VEC 0 "register_operand" "=v")
14082 (vec_merge:AVX512_VEC
14083 (match_operand:AVX512_VEC 1 "register_operand" "v")
14084 (vec_duplicate:AVX512_VEC
14085 (match_operand:<ssequartermode> 2 "nonimmediate_operand" "vm"))
14086 (match_operand:SI 3 "const_int_operand" "n")))]
14090 int selector = INTVAL (operands[3]);
14092 if (selector == (GET_MODE_UNIT_SIZE (<MODE>mode) == 4 ? 0xFFF0 : 0xFC))
14094 else if (selector == (GET_MODE_UNIT_SIZE (<MODE>mode) == 4 ? 0xFF0F : 0xF3))
14096 else if (selector == (GET_MODE_UNIT_SIZE (<MODE>mode) == 4 ? 0xF0FF : 0xCF))
14098 else if (selector == (GET_MODE_UNIT_SIZE (<MODE>mode) == 4 ? 0x0FFF : 0x3F))
14101 gcc_unreachable ();
14103 operands[3] = GEN_INT (mask);
14105 return "vinsert<shuffletype><extract_suf>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3}";
14107 [(set_attr "type" "sselog")
14108 (set_attr "length_immediate" "1")
14109 (set_attr "prefix" "evex")
14110 (set_attr "mode" "<sseinsnmode>")])
14112 (define_expand "<extract_type_2>_vinsert<shuffletype><extract_suf_2>_mask"
14113 [(match_operand:AVX512_VEC_2 0 "register_operand")
14114 (match_operand:AVX512_VEC_2 1 "register_operand")
14115 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand")
14116 (match_operand:SI 3 "const_0_to_1_operand")
14117 (match_operand:AVX512_VEC_2 4 "register_operand")
14118 (match_operand:<avx512fmaskmode> 5 "register_operand")]
14121 int mask = INTVAL (operands[3]);
14123 emit_insn (gen_vec_set_lo_<mode>_mask (operands[0], operands[1],
14124 operands[2], operands[4],
14127 emit_insn (gen_vec_set_hi_<mode>_mask (operands[0], operands[1],
14128 operands[2], operands[4],
14133 (define_insn "vec_set_lo_<mode><mask_name>"
14134 [(set (match_operand:V16FI 0 "register_operand" "=v")
14136 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
14137 (vec_select:<ssehalfvecmode>
14138 (match_operand:V16FI 1 "register_operand" "v")
14139 (parallel [(const_int 8) (const_int 9)
14140 (const_int 10) (const_int 11)
14141 (const_int 12) (const_int 13)
14142 (const_int 14) (const_int 15)]))))]
14144 "vinsert<shuffletype>32x8\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}"
14145 [(set_attr "type" "sselog")
14146 (set_attr "length_immediate" "1")
14147 (set_attr "prefix" "evex")
14148 (set_attr "mode" "<sseinsnmode>")])
14150 (define_insn "vec_set_hi_<mode><mask_name>"
14151 [(set (match_operand:V16FI 0 "register_operand" "=v")
14153 (vec_select:<ssehalfvecmode>
14154 (match_operand:V16FI 1 "register_operand" "v")
14155 (parallel [(const_int 0) (const_int 1)
14156 (const_int 2) (const_int 3)
14157 (const_int 4) (const_int 5)
14158 (const_int 6) (const_int 7)]))
14159 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
14161 "vinsert<shuffletype>32x8\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}"
14162 [(set_attr "type" "sselog")
14163 (set_attr "length_immediate" "1")
14164 (set_attr "prefix" "evex")
14165 (set_attr "mode" "<sseinsnmode>")])
14167 (define_insn "vec_set_lo_<mode><mask_name>"
14168 [(set (match_operand:V8FI 0 "register_operand" "=v")
14170 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
14171 (vec_select:<ssehalfvecmode>
14172 (match_operand:V8FI 1 "register_operand" "v")
14173 (parallel [(const_int 4) (const_int 5)
14174 (const_int 6) (const_int 7)]))))]
14176 "vinsert<shuffletype>64x4\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}"
14177 [(set_attr "type" "sselog")
14178 (set_attr "length_immediate" "1")
14179 (set_attr "prefix" "evex")
14180 (set_attr "mode" "XI")])
14182 (define_insn "vec_set_hi_<mode><mask_name>"
14183 [(set (match_operand:V8FI 0 "register_operand" "=v")
14185 (vec_select:<ssehalfvecmode>
14186 (match_operand:V8FI 1 "register_operand" "v")
14187 (parallel [(const_int 0) (const_int 1)
14188 (const_int 2) (const_int 3)]))
14189 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
14191 "vinsert<shuffletype>64x4\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}"
14192 [(set_attr "type" "sselog")
14193 (set_attr "length_immediate" "1")
14194 (set_attr "prefix" "evex")
14195 (set_attr "mode" "XI")])
14197 (define_expand "avx512dq_shuf_<shuffletype>64x2_mask"
14198 [(match_operand:VI8F_256 0 "register_operand")
14199 (match_operand:VI8F_256 1 "register_operand")
14200 (match_operand:VI8F_256 2 "nonimmediate_operand")
14201 (match_operand:SI 3 "const_0_to_3_operand")
14202 (match_operand:VI8F_256 4 "register_operand")
14203 (match_operand:QI 5 "register_operand")]
14206 int mask = INTVAL (operands[3]);
14207 emit_insn (gen_avx512dq_shuf_<shuffletype>64x2_1_mask
14208 (operands[0], operands[1], operands[2],
14209 GEN_INT (((mask >> 0) & 1) * 2 + 0),
14210 GEN_INT (((mask >> 0) & 1) * 2 + 1),
14211 GEN_INT (((mask >> 1) & 1) * 2 + 4),
14212 GEN_INT (((mask >> 1) & 1) * 2 + 5),
14213 operands[4], operands[5]));
14217 (define_insn "<mask_codefor>avx512dq_shuf_<shuffletype>64x2_1<mask_name>"
14218 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
14219 (vec_select:VI8F_256
14220 (vec_concat:<ssedoublemode>
14221 (match_operand:VI8F_256 1 "register_operand" "v")
14222 (match_operand:VI8F_256 2 "nonimmediate_operand" "vm"))
14223 (parallel [(match_operand 3 "const_0_to_3_operand")
14224 (match_operand 4 "const_0_to_3_operand")
14225 (match_operand 5 "const_4_to_7_operand")
14226 (match_operand 6 "const_4_to_7_operand")])))]
14228 && (INTVAL (operands[3]) & 1) == 0
14229 && INTVAL (operands[3]) == INTVAL (operands[4]) - 1
14230 && (INTVAL (operands[5]) & 1) == 0
14231 && INTVAL (operands[5]) == INTVAL (operands[6]) - 1"
14234 mask = INTVAL (operands[3]) / 2;
14235 mask |= (INTVAL (operands[5]) - 4) / 2 << 1;
14236 operands[3] = GEN_INT (mask);
14237 return "vshuf<shuffletype>64x2\t{%3, %2, %1, %0<mask_operand7>|%0<mask_operand7>, %1, %2, %3}";
14239 [(set_attr "type" "sselog")
14240 (set_attr "length_immediate" "1")
14241 (set_attr "prefix" "evex")
14242 (set_attr "mode" "XI")])
14244 (define_expand "avx512f_shuf_<shuffletype>64x2_mask"
14245 [(match_operand:V8FI 0 "register_operand")
14246 (match_operand:V8FI 1 "register_operand")
14247 (match_operand:V8FI 2 "nonimmediate_operand")
14248 (match_operand:SI 3 "const_0_to_255_operand")
14249 (match_operand:V8FI 4 "register_operand")
14250 (match_operand:QI 5 "register_operand")]
14253 int mask = INTVAL (operands[3]);
14254 emit_insn (gen_avx512f_shuf_<shuffletype>64x2_1_mask
14255 (operands[0], operands[1], operands[2],
14256 GEN_INT (((mask >> 0) & 3) * 2),
14257 GEN_INT (((mask >> 0) & 3) * 2 + 1),
14258 GEN_INT (((mask >> 2) & 3) * 2),
14259 GEN_INT (((mask >> 2) & 3) * 2 + 1),
14260 GEN_INT (((mask >> 4) & 3) * 2 + 8),
14261 GEN_INT (((mask >> 4) & 3) * 2 + 9),
14262 GEN_INT (((mask >> 6) & 3) * 2 + 8),
14263 GEN_INT (((mask >> 6) & 3) * 2 + 9),
14264 operands[4], operands[5]));
14268 (define_insn "avx512f_shuf_<shuffletype>64x2_1<mask_name>"
14269 [(set (match_operand:V8FI 0 "register_operand" "=v")
14271 (vec_concat:<ssedoublemode>
14272 (match_operand:V8FI 1 "register_operand" "v")
14273 (match_operand:V8FI 2 "nonimmediate_operand" "vm"))
14274 (parallel [(match_operand 3 "const_0_to_7_operand")
14275 (match_operand 4 "const_0_to_7_operand")
14276 (match_operand 5 "const_0_to_7_operand")
14277 (match_operand 6 "const_0_to_7_operand")
14278 (match_operand 7 "const_8_to_15_operand")
14279 (match_operand 8 "const_8_to_15_operand")
14280 (match_operand 9 "const_8_to_15_operand")
14281 (match_operand 10 "const_8_to_15_operand")])))]
14283 && (INTVAL (operands[3]) & 1) == 0
14284 && INTVAL (operands[3]) == INTVAL (operands[4]) - 1
14285 && (INTVAL (operands[5]) & 1) == 0
14286 && INTVAL (operands[5]) == INTVAL (operands[6]) - 1
14287 && (INTVAL (operands[7]) & 1) == 0
14288 && INTVAL (operands[7]) == INTVAL (operands[8]) - 1
14289 && (INTVAL (operands[9]) & 1) == 0
14290 && INTVAL (operands[9]) == INTVAL (operands[10]) - 1"
14293 mask = INTVAL (operands[3]) / 2;
14294 mask |= INTVAL (operands[5]) / 2 << 2;
14295 mask |= (INTVAL (operands[7]) - 8) / 2 << 4;
14296 mask |= (INTVAL (operands[9]) - 8) / 2 << 6;
14297 operands[3] = GEN_INT (mask);
14299 return "vshuf<shuffletype>64x2\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
14301 [(set_attr "type" "sselog")
14302 (set_attr "length_immediate" "1")
14303 (set_attr "prefix" "evex")
14304 (set_attr "mode" "<sseinsnmode>")])
14306 (define_expand "avx512vl_shuf_<shuffletype>32x4_mask"
14307 [(match_operand:VI4F_256 0 "register_operand")
14308 (match_operand:VI4F_256 1 "register_operand")
14309 (match_operand:VI4F_256 2 "nonimmediate_operand")
14310 (match_operand:SI 3 "const_0_to_3_operand")
14311 (match_operand:VI4F_256 4 "register_operand")
14312 (match_operand:QI 5 "register_operand")]
14315 int mask = INTVAL (operands[3]);
14316 emit_insn (gen_avx512vl_shuf_<shuffletype>32x4_1_mask
14317 (operands[0], operands[1], operands[2],
14318 GEN_INT (((mask >> 0) & 1) * 4 + 0),
14319 GEN_INT (((mask >> 0) & 1) * 4 + 1),
14320 GEN_INT (((mask >> 0) & 1) * 4 + 2),
14321 GEN_INT (((mask >> 0) & 1) * 4 + 3),
14322 GEN_INT (((mask >> 1) & 1) * 4 + 8),
14323 GEN_INT (((mask >> 1) & 1) * 4 + 9),
14324 GEN_INT (((mask >> 1) & 1) * 4 + 10),
14325 GEN_INT (((mask >> 1) & 1) * 4 + 11),
14326 operands[4], operands[5]));
14330 (define_insn "avx512vl_shuf_<shuffletype>32x4_1<mask_name>"
14331 [(set (match_operand:VI4F_256 0 "register_operand" "=v")
14332 (vec_select:VI4F_256
14333 (vec_concat:<ssedoublemode>
14334 (match_operand:VI4F_256 1 "register_operand" "v")
14335 (match_operand:VI4F_256 2 "nonimmediate_operand" "vm"))
14336 (parallel [(match_operand 3 "const_0_to_7_operand")
14337 (match_operand 4 "const_0_to_7_operand")
14338 (match_operand 5 "const_0_to_7_operand")
14339 (match_operand 6 "const_0_to_7_operand")
14340 (match_operand 7 "const_8_to_15_operand")
14341 (match_operand 8 "const_8_to_15_operand")
14342 (match_operand 9 "const_8_to_15_operand")
14343 (match_operand 10 "const_8_to_15_operand")])))]
14345 && (INTVAL (operands[3]) & 3) == 0
14346 && INTVAL (operands[3]) == INTVAL (operands[4]) - 1
14347 && INTVAL (operands[3]) == INTVAL (operands[5]) - 2
14348 && INTVAL (operands[3]) == INTVAL (operands[6]) - 3
14349 && (INTVAL (operands[7]) & 3) == 0
14350 && INTVAL (operands[7]) == INTVAL (operands[8]) - 1
14351 && INTVAL (operands[7]) == INTVAL (operands[9]) - 2
14352 && INTVAL (operands[7]) == INTVAL (operands[10]) - 3"
14355 mask = INTVAL (operands[3]) / 4;
14356 mask |= (INTVAL (operands[7]) - 8) / 4 << 1;
14357 operands[3] = GEN_INT (mask);
14359 return "vshuf<shuffletype>32x4\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
14361 [(set_attr "type" "sselog")
14362 (set_attr "length_immediate" "1")
14363 (set_attr "prefix" "evex")
14364 (set_attr "mode" "<sseinsnmode>")])
14366 (define_expand "avx512f_shuf_<shuffletype>32x4_mask"
14367 [(match_operand:V16FI 0 "register_operand")
14368 (match_operand:V16FI 1 "register_operand")
14369 (match_operand:V16FI 2 "nonimmediate_operand")
14370 (match_operand:SI 3 "const_0_to_255_operand")
14371 (match_operand:V16FI 4 "register_operand")
14372 (match_operand:HI 5 "register_operand")]
14375 int mask = INTVAL (operands[3]);
14376 emit_insn (gen_avx512f_shuf_<shuffletype>32x4_1_mask
14377 (operands[0], operands[1], operands[2],
14378 GEN_INT (((mask >> 0) & 3) * 4),
14379 GEN_INT (((mask >> 0) & 3) * 4 + 1),
14380 GEN_INT (((mask >> 0) & 3) * 4 + 2),
14381 GEN_INT (((mask >> 0) & 3) * 4 + 3),
14382 GEN_INT (((mask >> 2) & 3) * 4),
14383 GEN_INT (((mask >> 2) & 3) * 4 + 1),
14384 GEN_INT (((mask >> 2) & 3) * 4 + 2),
14385 GEN_INT (((mask >> 2) & 3) * 4 + 3),
14386 GEN_INT (((mask >> 4) & 3) * 4 + 16),
14387 GEN_INT (((mask >> 4) & 3) * 4 + 17),
14388 GEN_INT (((mask >> 4) & 3) * 4 + 18),
14389 GEN_INT (((mask >> 4) & 3) * 4 + 19),
14390 GEN_INT (((mask >> 6) & 3) * 4 + 16),
14391 GEN_INT (((mask >> 6) & 3) * 4 + 17),
14392 GEN_INT (((mask >> 6) & 3) * 4 + 18),
14393 GEN_INT (((mask >> 6) & 3) * 4 + 19),
14394 operands[4], operands[5]));
14398 (define_insn "avx512f_shuf_<shuffletype>32x4_1<mask_name>"
14399 [(set (match_operand:V16FI 0 "register_operand" "=v")
14401 (vec_concat:<ssedoublemode>
14402 (match_operand:V16FI 1 "register_operand" "v")
14403 (match_operand:V16FI 2 "nonimmediate_operand" "vm"))
14404 (parallel [(match_operand 3 "const_0_to_15_operand")
14405 (match_operand 4 "const_0_to_15_operand")
14406 (match_operand 5 "const_0_to_15_operand")
14407 (match_operand 6 "const_0_to_15_operand")
14408 (match_operand 7 "const_0_to_15_operand")
14409 (match_operand 8 "const_0_to_15_operand")
14410 (match_operand 9 "const_0_to_15_operand")
14411 (match_operand 10 "const_0_to_15_operand")
14412 (match_operand 11 "const_16_to_31_operand")
14413 (match_operand 12 "const_16_to_31_operand")
14414 (match_operand 13 "const_16_to_31_operand")
14415 (match_operand 14 "const_16_to_31_operand")
14416 (match_operand 15 "const_16_to_31_operand")
14417 (match_operand 16 "const_16_to_31_operand")
14418 (match_operand 17 "const_16_to_31_operand")
14419 (match_operand 18 "const_16_to_31_operand")])))]
14421 && (INTVAL (operands[3]) & 3) == 0
14422 && INTVAL (operands[3]) == INTVAL (operands[4]) - 1
14423 && INTVAL (operands[3]) == INTVAL (operands[5]) - 2
14424 && INTVAL (operands[3]) == INTVAL (operands[6]) - 3
14425 && (INTVAL (operands[7]) & 3) == 0
14426 && INTVAL (operands[7]) == INTVAL (operands[8]) - 1
14427 && INTVAL (operands[7]) == INTVAL (operands[9]) - 2
14428 && INTVAL (operands[7]) == INTVAL (operands[10]) - 3
14429 && (INTVAL (operands[11]) & 3) == 0
14430 && INTVAL (operands[11]) == INTVAL (operands[12]) - 1
14431 && INTVAL (operands[11]) == INTVAL (operands[13]) - 2
14432 && INTVAL (operands[11]) == INTVAL (operands[14]) - 3
14433 && (INTVAL (operands[15]) & 3) == 0
14434 && INTVAL (operands[15]) == INTVAL (operands[16]) - 1
14435 && INTVAL (operands[15]) == INTVAL (operands[17]) - 2
14436 && INTVAL (operands[15]) == INTVAL (operands[18]) - 3"
14439 mask = INTVAL (operands[3]) / 4;
14440 mask |= INTVAL (operands[7]) / 4 << 2;
14441 mask |= (INTVAL (operands[11]) - 16) / 4 << 4;
14442 mask |= (INTVAL (operands[15]) - 16) / 4 << 6;
14443 operands[3] = GEN_INT (mask);
14445 return "vshuf<shuffletype>32x4\t{%3, %2, %1, %0<mask_operand19>|%0<mask_operand19>, %1, %2, %3}";
14447 [(set_attr "type" "sselog")
14448 (set_attr "length_immediate" "1")
14449 (set_attr "prefix" "evex")
14450 (set_attr "mode" "<sseinsnmode>")])
14452 (define_expand "avx512f_pshufdv3_mask"
14453 [(match_operand:V16SI 0 "register_operand")
14454 (match_operand:V16SI 1 "nonimmediate_operand")
14455 (match_operand:SI 2 "const_0_to_255_operand")
14456 (match_operand:V16SI 3 "register_operand")
14457 (match_operand:HI 4 "register_operand")]
14460 int mask = INTVAL (operands[2]);
14461 emit_insn (gen_avx512f_pshufd_1_mask (operands[0], operands[1],
14462 GEN_INT ((mask >> 0) & 3),
14463 GEN_INT ((mask >> 2) & 3),
14464 GEN_INT ((mask >> 4) & 3),
14465 GEN_INT ((mask >> 6) & 3),
14466 GEN_INT (((mask >> 0) & 3) + 4),
14467 GEN_INT (((mask >> 2) & 3) + 4),
14468 GEN_INT (((mask >> 4) & 3) + 4),
14469 GEN_INT (((mask >> 6) & 3) + 4),
14470 GEN_INT (((mask >> 0) & 3) + 8),
14471 GEN_INT (((mask >> 2) & 3) + 8),
14472 GEN_INT (((mask >> 4) & 3) + 8),
14473 GEN_INT (((mask >> 6) & 3) + 8),
14474 GEN_INT (((mask >> 0) & 3) + 12),
14475 GEN_INT (((mask >> 2) & 3) + 12),
14476 GEN_INT (((mask >> 4) & 3) + 12),
14477 GEN_INT (((mask >> 6) & 3) + 12),
14478 operands[3], operands[4]));
14482 (define_insn "avx512f_pshufd_1<mask_name>"
14483 [(set (match_operand:V16SI 0 "register_operand" "=v")
14485 (match_operand:V16SI 1 "nonimmediate_operand" "vm")
14486 (parallel [(match_operand 2 "const_0_to_3_operand")
14487 (match_operand 3 "const_0_to_3_operand")
14488 (match_operand 4 "const_0_to_3_operand")
14489 (match_operand 5 "const_0_to_3_operand")
14490 (match_operand 6 "const_4_to_7_operand")
14491 (match_operand 7 "const_4_to_7_operand")
14492 (match_operand 8 "const_4_to_7_operand")
14493 (match_operand 9 "const_4_to_7_operand")
14494 (match_operand 10 "const_8_to_11_operand")
14495 (match_operand 11 "const_8_to_11_operand")
14496 (match_operand 12 "const_8_to_11_operand")
14497 (match_operand 13 "const_8_to_11_operand")
14498 (match_operand 14 "const_12_to_15_operand")
14499 (match_operand 15 "const_12_to_15_operand")
14500 (match_operand 16 "const_12_to_15_operand")
14501 (match_operand 17 "const_12_to_15_operand")])))]
14503 && INTVAL (operands[2]) + 4 == INTVAL (operands[6])
14504 && INTVAL (operands[3]) + 4 == INTVAL (operands[7])
14505 && INTVAL (operands[4]) + 4 == INTVAL (operands[8])
14506 && INTVAL (operands[5]) + 4 == INTVAL (operands[9])
14507 && INTVAL (operands[2]) + 8 == INTVAL (operands[10])
14508 && INTVAL (operands[3]) + 8 == INTVAL (operands[11])
14509 && INTVAL (operands[4]) + 8 == INTVAL (operands[12])
14510 && INTVAL (operands[5]) + 8 == INTVAL (operands[13])
14511 && INTVAL (operands[2]) + 12 == INTVAL (operands[14])
14512 && INTVAL (operands[3]) + 12 == INTVAL (operands[15])
14513 && INTVAL (operands[4]) + 12 == INTVAL (operands[16])
14514 && INTVAL (operands[5]) + 12 == INTVAL (operands[17])"
14517 mask |= INTVAL (operands[2]) << 0;
14518 mask |= INTVAL (operands[3]) << 2;
14519 mask |= INTVAL (operands[4]) << 4;
14520 mask |= INTVAL (operands[5]) << 6;
14521 operands[2] = GEN_INT (mask);
14523 return "vpshufd\t{%2, %1, %0<mask_operand18>|%0<mask_operand18>, %1, %2}";
14525 [(set_attr "type" "sselog1")
14526 (set_attr "prefix" "evex")
14527 (set_attr "length_immediate" "1")
14528 (set_attr "mode" "XI")])
14530 (define_expand "avx512vl_pshufdv3_mask"
14531 [(match_operand:V8SI 0 "register_operand")
14532 (match_operand:V8SI 1 "nonimmediate_operand")
14533 (match_operand:SI 2 "const_0_to_255_operand")
14534 (match_operand:V8SI 3 "register_operand")
14535 (match_operand:QI 4 "register_operand")]
14538 int mask = INTVAL (operands[2]);
14539 emit_insn (gen_avx2_pshufd_1_mask (operands[0], operands[1],
14540 GEN_INT ((mask >> 0) & 3),
14541 GEN_INT ((mask >> 2) & 3),
14542 GEN_INT ((mask >> 4) & 3),
14543 GEN_INT ((mask >> 6) & 3),
14544 GEN_INT (((mask >> 0) & 3) + 4),
14545 GEN_INT (((mask >> 2) & 3) + 4),
14546 GEN_INT (((mask >> 4) & 3) + 4),
14547 GEN_INT (((mask >> 6) & 3) + 4),
14548 operands[3], operands[4]));
14552 (define_expand "avx2_pshufdv3"
14553 [(match_operand:V8SI 0 "register_operand")
14554 (match_operand:V8SI 1 "nonimmediate_operand")
14555 (match_operand:SI 2 "const_0_to_255_operand")]
14558 int mask = INTVAL (operands[2]);
14559 emit_insn (gen_avx2_pshufd_1 (operands[0], operands[1],
14560 GEN_INT ((mask >> 0) & 3),
14561 GEN_INT ((mask >> 2) & 3),
14562 GEN_INT ((mask >> 4) & 3),
14563 GEN_INT ((mask >> 6) & 3),
14564 GEN_INT (((mask >> 0) & 3) + 4),
14565 GEN_INT (((mask >> 2) & 3) + 4),
14566 GEN_INT (((mask >> 4) & 3) + 4),
14567 GEN_INT (((mask >> 6) & 3) + 4)));
14571 (define_insn "avx2_pshufd_1<mask_name>"
14572 [(set (match_operand:V8SI 0 "register_operand" "=v")
14574 (match_operand:V8SI 1 "nonimmediate_operand" "vm")
14575 (parallel [(match_operand 2 "const_0_to_3_operand")
14576 (match_operand 3 "const_0_to_3_operand")
14577 (match_operand 4 "const_0_to_3_operand")
14578 (match_operand 5 "const_0_to_3_operand")
14579 (match_operand 6 "const_4_to_7_operand")
14580 (match_operand 7 "const_4_to_7_operand")
14581 (match_operand 8 "const_4_to_7_operand")
14582 (match_operand 9 "const_4_to_7_operand")])))]
14584 && <mask_avx512vl_condition>
14585 && INTVAL (operands[2]) + 4 == INTVAL (operands[6])
14586 && INTVAL (operands[3]) + 4 == INTVAL (operands[7])
14587 && INTVAL (operands[4]) + 4 == INTVAL (operands[8])
14588 && INTVAL (operands[5]) + 4 == INTVAL (operands[9])"
14591 mask |= INTVAL (operands[2]) << 0;
14592 mask |= INTVAL (operands[3]) << 2;
14593 mask |= INTVAL (operands[4]) << 4;
14594 mask |= INTVAL (operands[5]) << 6;
14595 operands[2] = GEN_INT (mask);
14597 return "vpshufd\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
14599 [(set_attr "type" "sselog1")
14600 (set_attr "prefix" "maybe_evex")
14601 (set_attr "length_immediate" "1")
14602 (set_attr "mode" "OI")])
14604 (define_expand "avx512vl_pshufd_mask"
14605 [(match_operand:V4SI 0 "register_operand")
14606 (match_operand:V4SI 1 "nonimmediate_operand")
14607 (match_operand:SI 2 "const_0_to_255_operand")
14608 (match_operand:V4SI 3 "register_operand")
14609 (match_operand:QI 4 "register_operand")]
14612 int mask = INTVAL (operands[2]);
14613 emit_insn (gen_sse2_pshufd_1_mask (operands[0], operands[1],
14614 GEN_INT ((mask >> 0) & 3),
14615 GEN_INT ((mask >> 2) & 3),
14616 GEN_INT ((mask >> 4) & 3),
14617 GEN_INT ((mask >> 6) & 3),
14618 operands[3], operands[4]));
14622 (define_expand "sse2_pshufd"
14623 [(match_operand:V4SI 0 "register_operand")
14624 (match_operand:V4SI 1 "vector_operand")
14625 (match_operand:SI 2 "const_int_operand")]
14628 int mask = INTVAL (operands[2]);
14629 emit_insn (gen_sse2_pshufd_1 (operands[0], operands[1],
14630 GEN_INT ((mask >> 0) & 3),
14631 GEN_INT ((mask >> 2) & 3),
14632 GEN_INT ((mask >> 4) & 3),
14633 GEN_INT ((mask >> 6) & 3)));
14637 (define_insn "sse2_pshufd_1<mask_name>"
14638 [(set (match_operand:V4SI 0 "register_operand" "=v")
14640 (match_operand:V4SI 1 "vector_operand" "vBm")
14641 (parallel [(match_operand 2 "const_0_to_3_operand")
14642 (match_operand 3 "const_0_to_3_operand")
14643 (match_operand 4 "const_0_to_3_operand")
14644 (match_operand 5 "const_0_to_3_operand")])))]
14645 "TARGET_SSE2 && <mask_avx512vl_condition>"
14648 mask |= INTVAL (operands[2]) << 0;
14649 mask |= INTVAL (operands[3]) << 2;
14650 mask |= INTVAL (operands[4]) << 4;
14651 mask |= INTVAL (operands[5]) << 6;
14652 operands[2] = GEN_INT (mask);
14654 return "%vpshufd\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
14656 [(set_attr "type" "sselog1")
14657 (set_attr "prefix_data16" "1")
14658 (set_attr "prefix" "<mask_prefix2>")
14659 (set_attr "length_immediate" "1")
14660 (set_attr "mode" "TI")])
14662 (define_insn "<mask_codefor>avx512bw_pshuflwv32hi<mask_name>"
14663 [(set (match_operand:V32HI 0 "register_operand" "=v")
14665 [(match_operand:V32HI 1 "nonimmediate_operand" "vm")
14666 (match_operand:SI 2 "const_0_to_255_operand" "n")]
14669 "vpshuflw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
14670 [(set_attr "type" "sselog")
14671 (set_attr "prefix" "evex")
14672 (set_attr "mode" "XI")])
14674 (define_expand "avx512vl_pshuflwv3_mask"
14675 [(match_operand:V16HI 0 "register_operand")
14676 (match_operand:V16HI 1 "nonimmediate_operand")
14677 (match_operand:SI 2 "const_0_to_255_operand")
14678 (match_operand:V16HI 3 "register_operand")
14679 (match_operand:HI 4 "register_operand")]
14680 "TARGET_AVX512VL && TARGET_AVX512BW"
14682 int mask = INTVAL (operands[2]);
14683 emit_insn (gen_avx2_pshuflw_1_mask (operands[0], operands[1],
14684 GEN_INT ((mask >> 0) & 3),
14685 GEN_INT ((mask >> 2) & 3),
14686 GEN_INT ((mask >> 4) & 3),
14687 GEN_INT ((mask >> 6) & 3),
14688 GEN_INT (((mask >> 0) & 3) + 8),
14689 GEN_INT (((mask >> 2) & 3) + 8),
14690 GEN_INT (((mask >> 4) & 3) + 8),
14691 GEN_INT (((mask >> 6) & 3) + 8),
14692 operands[3], operands[4]));
14696 (define_expand "avx2_pshuflwv3"
14697 [(match_operand:V16HI 0 "register_operand")
14698 (match_operand:V16HI 1 "nonimmediate_operand")
14699 (match_operand:SI 2 "const_0_to_255_operand")]
14702 int mask = INTVAL (operands[2]);
14703 emit_insn (gen_avx2_pshuflw_1 (operands[0], operands[1],
14704 GEN_INT ((mask >> 0) & 3),
14705 GEN_INT ((mask >> 2) & 3),
14706 GEN_INT ((mask >> 4) & 3),
14707 GEN_INT ((mask >> 6) & 3),
14708 GEN_INT (((mask >> 0) & 3) + 8),
14709 GEN_INT (((mask >> 2) & 3) + 8),
14710 GEN_INT (((mask >> 4) & 3) + 8),
14711 GEN_INT (((mask >> 6) & 3) + 8)));
14715 (define_insn "avx2_pshuflw_1<mask_name>"
14716 [(set (match_operand:V16HI 0 "register_operand" "=v")
14718 (match_operand:V16HI 1 "nonimmediate_operand" "vm")
14719 (parallel [(match_operand 2 "const_0_to_3_operand")
14720 (match_operand 3 "const_0_to_3_operand")
14721 (match_operand 4 "const_0_to_3_operand")
14722 (match_operand 5 "const_0_to_3_operand")
14727 (match_operand 6 "const_8_to_11_operand")
14728 (match_operand 7 "const_8_to_11_operand")
14729 (match_operand 8 "const_8_to_11_operand")
14730 (match_operand 9 "const_8_to_11_operand")
14734 (const_int 15)])))]
14736 && <mask_avx512bw_condition> && <mask_avx512vl_condition>
14737 && INTVAL (operands[2]) + 8 == INTVAL (operands[6])
14738 && INTVAL (operands[3]) + 8 == INTVAL (operands[7])
14739 && INTVAL (operands[4]) + 8 == INTVAL (operands[8])
14740 && INTVAL (operands[5]) + 8 == INTVAL (operands[9])"
14743 mask |= INTVAL (operands[2]) << 0;
14744 mask |= INTVAL (operands[3]) << 2;
14745 mask |= INTVAL (operands[4]) << 4;
14746 mask |= INTVAL (operands[5]) << 6;
14747 operands[2] = GEN_INT (mask);
14749 return "vpshuflw\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
14751 [(set_attr "type" "sselog")
14752 (set_attr "prefix" "maybe_evex")
14753 (set_attr "length_immediate" "1")
14754 (set_attr "mode" "OI")])
14756 (define_expand "avx512vl_pshuflw_mask"
14757 [(match_operand:V8HI 0 "register_operand")
14758 (match_operand:V8HI 1 "nonimmediate_operand")
14759 (match_operand:SI 2 "const_0_to_255_operand")
14760 (match_operand:V8HI 3 "register_operand")
14761 (match_operand:QI 4 "register_operand")]
14762 "TARGET_AVX512VL && TARGET_AVX512BW"
14764 int mask = INTVAL (operands[2]);
14765 emit_insn (gen_sse2_pshuflw_1_mask (operands[0], operands[1],
14766 GEN_INT ((mask >> 0) & 3),
14767 GEN_INT ((mask >> 2) & 3),
14768 GEN_INT ((mask >> 4) & 3),
14769 GEN_INT ((mask >> 6) & 3),
14770 operands[3], operands[4]));
14774 (define_expand "sse2_pshuflw"
14775 [(match_operand:V8HI 0 "register_operand")
14776 (match_operand:V8HI 1 "vector_operand")
14777 (match_operand:SI 2 "const_int_operand")]
14780 int mask = INTVAL (operands[2]);
14781 emit_insn (gen_sse2_pshuflw_1 (operands[0], operands[1],
14782 GEN_INT ((mask >> 0) & 3),
14783 GEN_INT ((mask >> 2) & 3),
14784 GEN_INT ((mask >> 4) & 3),
14785 GEN_INT ((mask >> 6) & 3)));
14789 (define_insn "sse2_pshuflw_1<mask_name>"
14790 [(set (match_operand:V8HI 0 "register_operand" "=v")
14792 (match_operand:V8HI 1 "vector_operand" "vBm")
14793 (parallel [(match_operand 2 "const_0_to_3_operand")
14794 (match_operand 3 "const_0_to_3_operand")
14795 (match_operand 4 "const_0_to_3_operand")
14796 (match_operand 5 "const_0_to_3_operand")
14801 "TARGET_SSE2 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
14804 mask |= INTVAL (operands[2]) << 0;
14805 mask |= INTVAL (operands[3]) << 2;
14806 mask |= INTVAL (operands[4]) << 4;
14807 mask |= INTVAL (operands[5]) << 6;
14808 operands[2] = GEN_INT (mask);
14810 return "%vpshuflw\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
14812 [(set_attr "type" "sselog")
14813 (set_attr "prefix_data16" "0")
14814 (set_attr "prefix_rep" "1")
14815 (set_attr "prefix" "maybe_vex")
14816 (set_attr "length_immediate" "1")
14817 (set_attr "mode" "TI")])
14819 (define_expand "avx2_pshufhwv3"
14820 [(match_operand:V16HI 0 "register_operand")
14821 (match_operand:V16HI 1 "nonimmediate_operand")
14822 (match_operand:SI 2 "const_0_to_255_operand")]
14825 int mask = INTVAL (operands[2]);
14826 emit_insn (gen_avx2_pshufhw_1 (operands[0], operands[1],
14827 GEN_INT (((mask >> 0) & 3) + 4),
14828 GEN_INT (((mask >> 2) & 3) + 4),
14829 GEN_INT (((mask >> 4) & 3) + 4),
14830 GEN_INT (((mask >> 6) & 3) + 4),
14831 GEN_INT (((mask >> 0) & 3) + 12),
14832 GEN_INT (((mask >> 2) & 3) + 12),
14833 GEN_INT (((mask >> 4) & 3) + 12),
14834 GEN_INT (((mask >> 6) & 3) + 12)));
14838 (define_insn "<mask_codefor>avx512bw_pshufhwv32hi<mask_name>"
14839 [(set (match_operand:V32HI 0 "register_operand" "=v")
14841 [(match_operand:V32HI 1 "nonimmediate_operand" "vm")
14842 (match_operand:SI 2 "const_0_to_255_operand" "n")]
14845 "vpshufhw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
14846 [(set_attr "type" "sselog")
14847 (set_attr "prefix" "evex")
14848 (set_attr "mode" "XI")])
14850 (define_expand "avx512vl_pshufhwv3_mask"
14851 [(match_operand:V16HI 0 "register_operand")
14852 (match_operand:V16HI 1 "nonimmediate_operand")
14853 (match_operand:SI 2 "const_0_to_255_operand")
14854 (match_operand:V16HI 3 "register_operand")
14855 (match_operand:HI 4 "register_operand")]
14856 "TARGET_AVX512VL && TARGET_AVX512BW"
14858 int mask = INTVAL (operands[2]);
14859 emit_insn (gen_avx2_pshufhw_1_mask (operands[0], operands[1],
14860 GEN_INT (((mask >> 0) & 3) + 4),
14861 GEN_INT (((mask >> 2) & 3) + 4),
14862 GEN_INT (((mask >> 4) & 3) + 4),
14863 GEN_INT (((mask >> 6) & 3) + 4),
14864 GEN_INT (((mask >> 0) & 3) + 12),
14865 GEN_INT (((mask >> 2) & 3) + 12),
14866 GEN_INT (((mask >> 4) & 3) + 12),
14867 GEN_INT (((mask >> 6) & 3) + 12),
14868 operands[3], operands[4]));
14872 (define_insn "avx2_pshufhw_1<mask_name>"
14873 [(set (match_operand:V16HI 0 "register_operand" "=v")
14875 (match_operand:V16HI 1 "nonimmediate_operand" "vm")
14876 (parallel [(const_int 0)
14880 (match_operand 2 "const_4_to_7_operand")
14881 (match_operand 3 "const_4_to_7_operand")
14882 (match_operand 4 "const_4_to_7_operand")
14883 (match_operand 5 "const_4_to_7_operand")
14888 (match_operand 6 "const_12_to_15_operand")
14889 (match_operand 7 "const_12_to_15_operand")
14890 (match_operand 8 "const_12_to_15_operand")
14891 (match_operand 9 "const_12_to_15_operand")])))]
14893 && <mask_avx512bw_condition> && <mask_avx512vl_condition>
14894 && INTVAL (operands[2]) + 8 == INTVAL (operands[6])
14895 && INTVAL (operands[3]) + 8 == INTVAL (operands[7])
14896 && INTVAL (operands[4]) + 8 == INTVAL (operands[8])
14897 && INTVAL (operands[5]) + 8 == INTVAL (operands[9])"
14900 mask |= (INTVAL (operands[2]) - 4) << 0;
14901 mask |= (INTVAL (operands[3]) - 4) << 2;
14902 mask |= (INTVAL (operands[4]) - 4) << 4;
14903 mask |= (INTVAL (operands[5]) - 4) << 6;
14904 operands[2] = GEN_INT (mask);
14906 return "vpshufhw\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
14908 [(set_attr "type" "sselog")
14909 (set_attr "prefix" "maybe_evex")
14910 (set_attr "length_immediate" "1")
14911 (set_attr "mode" "OI")])
14913 (define_expand "avx512vl_pshufhw_mask"
14914 [(match_operand:V8HI 0 "register_operand")
14915 (match_operand:V8HI 1 "nonimmediate_operand")
14916 (match_operand:SI 2 "const_0_to_255_operand")
14917 (match_operand:V8HI 3 "register_operand")
14918 (match_operand:QI 4 "register_operand")]
14919 "TARGET_AVX512VL && TARGET_AVX512BW"
14921 int mask = INTVAL (operands[2]);
14922 emit_insn (gen_sse2_pshufhw_1_mask (operands[0], operands[1],
14923 GEN_INT (((mask >> 0) & 3) + 4),
14924 GEN_INT (((mask >> 2) & 3) + 4),
14925 GEN_INT (((mask >> 4) & 3) + 4),
14926 GEN_INT (((mask >> 6) & 3) + 4),
14927 operands[3], operands[4]));
14931 (define_expand "sse2_pshufhw"
14932 [(match_operand:V8HI 0 "register_operand")
14933 (match_operand:V8HI 1 "vector_operand")
14934 (match_operand:SI 2 "const_int_operand")]
14937 int mask = INTVAL (operands[2]);
14938 emit_insn (gen_sse2_pshufhw_1 (operands[0], operands[1],
14939 GEN_INT (((mask >> 0) & 3) + 4),
14940 GEN_INT (((mask >> 2) & 3) + 4),
14941 GEN_INT (((mask >> 4) & 3) + 4),
14942 GEN_INT (((mask >> 6) & 3) + 4)));
14946 (define_insn "sse2_pshufhw_1<mask_name>"
14947 [(set (match_operand:V8HI 0 "register_operand" "=v")
14949 (match_operand:V8HI 1 "vector_operand" "vBm")
14950 (parallel [(const_int 0)
14954 (match_operand 2 "const_4_to_7_operand")
14955 (match_operand 3 "const_4_to_7_operand")
14956 (match_operand 4 "const_4_to_7_operand")
14957 (match_operand 5 "const_4_to_7_operand")])))]
14958 "TARGET_SSE2 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
14961 mask |= (INTVAL (operands[2]) - 4) << 0;
14962 mask |= (INTVAL (operands[3]) - 4) << 2;
14963 mask |= (INTVAL (operands[4]) - 4) << 4;
14964 mask |= (INTVAL (operands[5]) - 4) << 6;
14965 operands[2] = GEN_INT (mask);
14967 return "%vpshufhw\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
14969 [(set_attr "type" "sselog")
14970 (set_attr "prefix_rep" "1")
14971 (set_attr "prefix_data16" "0")
14972 (set_attr "prefix" "maybe_vex")
14973 (set_attr "length_immediate" "1")
14974 (set_attr "mode" "TI")])
14976 (define_expand "sse2_loadd"
14977 [(set (match_operand:V4SI 0 "register_operand")
14979 (vec_duplicate:V4SI
14980 (match_operand:SI 1 "nonimmediate_operand"))
14984 "operands[2] = CONST0_RTX (V4SImode);")
14986 (define_insn "sse2_loadld"
14987 [(set (match_operand:V4SI 0 "register_operand" "=v,v,x,x,v")
14989 (vec_duplicate:V4SI
14990 (match_operand:SI 2 "nonimmediate_operand" "m ,r ,m,x,v"))
14991 (match_operand:V4SI 1 "reg_or_0_operand" "C ,C ,C,0,v")
14995 %vmovd\t{%2, %0|%0, %2}
14996 %vmovd\t{%2, %0|%0, %2}
14997 movss\t{%2, %0|%0, %2}
14998 movss\t{%2, %0|%0, %2}
14999 vmovss\t{%2, %1, %0|%0, %1, %2}"
15000 [(set_attr "isa" "sse2,sse2,noavx,noavx,avx")
15001 (set_attr "type" "ssemov")
15002 (set_attr "prefix" "maybe_vex,maybe_vex,orig,orig,maybe_evex")
15003 (set_attr "mode" "TI,TI,V4SF,SF,SF")
15004 (set (attr "preferred_for_speed")
15005 (cond [(eq_attr "alternative" "1")
15006 (symbol_ref "TARGET_INTER_UNIT_MOVES_TO_VEC")
15008 (symbol_ref "true")))])
15010 ;; QI and HI modes handled by pextr patterns.
15011 (define_mode_iterator PEXTR_MODE12
15012 [(V16QI "TARGET_SSE4_1") V8HI])
15014 (define_insn "*vec_extract<mode>"
15015 [(set (match_operand:<ssescalarmode> 0 "register_sse4nonimm_operand" "=r,m,r,m")
15016 (vec_select:<ssescalarmode>
15017 (match_operand:PEXTR_MODE12 1 "register_operand" "x,x,v,v")
15019 [(match_operand:SI 2 "const_0_to_<ssescalarnummask>_operand")])))]
15022 %vpextr<ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}
15023 %vpextr<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
15024 vpextr<ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}
15025 vpextr<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
15026 [(set_attr "isa" "*,sse4,avx512bw,avx512bw")
15027 (set_attr "type" "sselog1")
15028 (set_attr "prefix_data16" "1")
15029 (set (attr "prefix_extra")
15031 (and (eq_attr "alternative" "0,2")
15032 (eq (const_string "<MODE>mode") (const_string "V8HImode")))
15034 (const_string "1")))
15035 (set_attr "length_immediate" "1")
15036 (set_attr "prefix" "maybe_vex,maybe_vex,evex,evex")
15037 (set_attr "mode" "TI")])
15039 (define_insn "*vec_extract<PEXTR_MODE12:mode>_zext"
15040 [(set (match_operand:SWI48 0 "register_operand" "=r,r")
15042 (vec_select:<PEXTR_MODE12:ssescalarmode>
15043 (match_operand:PEXTR_MODE12 1 "register_operand" "x,v")
15045 [(match_operand:SI 2
15046 "const_0_to_<PEXTR_MODE12:ssescalarnummask>_operand")]))))]
15049 %vpextr<PEXTR_MODE12:ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}
15050 vpextr<PEXTR_MODE12:ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}"
15051 [(set_attr "isa" "*,avx512bw")
15052 (set_attr "type" "sselog1")
15053 (set_attr "prefix_data16" "1")
15054 (set (attr "prefix_extra")
15056 (eq (const_string "<PEXTR_MODE12:MODE>mode") (const_string "V8HImode"))
15058 (const_string "1")))
15059 (set_attr "length_immediate" "1")
15060 (set_attr "prefix" "maybe_vex")
15061 (set_attr "mode" "TI")])
15063 (define_insn "*vec_extractv16qi_zext"
15064 [(set (match_operand:HI 0 "register_operand" "=r,r")
15067 (match_operand:V16QI 1 "register_operand" "x,v")
15069 [(match_operand:SI 2 "const_0_to_15_operand")]))))]
15072 %vpextrb\t{%2, %1, %k0|%k0, %1, %2}
15073 vpextrb\t{%2, %1, %k0|%k0, %1, %2}"
15074 [(set_attr "isa" "*,avx512bw")
15075 (set_attr "type" "sselog1")
15076 (set_attr "prefix_data16" "1")
15077 (set_attr "prefix_extra" "1")
15078 (set_attr "length_immediate" "1")
15079 (set_attr "prefix" "maybe_vex")
15080 (set_attr "mode" "TI")])
15082 (define_insn "*vec_extract<mode>_mem"
15083 [(set (match_operand:<ssescalarmode> 0 "register_operand" "=r")
15084 (vec_select:<ssescalarmode>
15085 (match_operand:VI12_128 1 "memory_operand" "o")
15087 [(match_operand 2 "const_0_to_<ssescalarnummask>_operand")])))]
15091 (define_insn "*vec_extract<ssevecmodelower>_0"
15092 [(set (match_operand:SWI48 0 "nonimmediate_operand" "=r,r,v ,m")
15094 (match_operand:<ssevecmode> 1 "nonimmediate_operand" "m ,v,vm,v")
15095 (parallel [(const_int 0)])))]
15096 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
15098 [(set_attr "isa" "*,sse2,*,*")
15099 (set (attr "preferred_for_speed")
15100 (cond [(eq_attr "alternative" "1")
15101 (symbol_ref "TARGET_INTER_UNIT_MOVES_FROM_VEC")
15103 (symbol_ref "true")))])
15105 (define_insn "*vec_extractv2di_0_sse"
15106 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,x ,m")
15108 (match_operand:V2DI 1 "nonimmediate_operand" " x,xm,x")
15109 (parallel [(const_int 0)])))]
15110 "TARGET_SSE && !TARGET_64BIT
15111 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
15113 [(set_attr "isa" "sse4,*,*")
15114 (set (attr "preferred_for_speed")
15115 (cond [(eq_attr "alternative" "0")
15116 (symbol_ref "TARGET_INTER_UNIT_MOVES_FROM_VEC")
15118 (symbol_ref "true")))])
15121 [(set (match_operand:DI 0 "general_reg_operand")
15123 (match_operand:V2DI 1 "register_operand")
15124 (parallel [(const_int 0)])))]
15125 "TARGET_SSE4_1 && !TARGET_64BIT
15126 && reload_completed"
15127 [(set (match_dup 2) (match_dup 4))
15131 (parallel [(const_int 1)])))]
15133 operands[4] = gen_lowpart (SImode, operands[1]);
15134 operands[5] = gen_lowpart (V4SImode, operands[1]);
15135 split_double_mode (DImode, &operands[0], 1, &operands[2], &operands[3]);
15139 [(set (match_operand:SWI48x 0 "nonimmediate_operand")
15141 (match_operand:<ssevecmode> 1 "register_operand")
15142 (parallel [(const_int 0)])))]
15143 "TARGET_SSE && reload_completed"
15144 [(set (match_dup 0) (match_dup 1))]
15145 "operands[1] = gen_lowpart (<MODE>mode, operands[1]);")
15147 (define_insn "*vec_extractv4si_0_zext_sse4"
15148 [(set (match_operand:DI 0 "register_operand" "=r,x,v")
15151 (match_operand:V4SI 1 "register_operand" "v,x,v")
15152 (parallel [(const_int 0)]))))]
15155 [(set_attr "isa" "x64,*,avx512f")
15156 (set (attr "preferred_for_speed")
15157 (cond [(eq_attr "alternative" "0")
15158 (symbol_ref "TARGET_INTER_UNIT_MOVES_FROM_VEC")
15160 (symbol_ref "true")))])
15162 (define_insn "*vec_extractv4si_0_zext"
15163 [(set (match_operand:DI 0 "register_operand" "=r")
15166 (match_operand:V4SI 1 "register_operand" "x")
15167 (parallel [(const_int 0)]))))]
15168 "TARGET_64BIT && TARGET_SSE2 && TARGET_INTER_UNIT_MOVES_FROM_VEC"
15172 [(set (match_operand:DI 0 "register_operand")
15175 (match_operand:V4SI 1 "register_operand")
15176 (parallel [(const_int 0)]))))]
15177 "TARGET_SSE2 && reload_completed"
15178 [(set (match_dup 0) (zero_extend:DI (match_dup 1)))]
15179 "operands[1] = gen_lowpart (SImode, operands[1]);")
15181 (define_insn "*vec_extractv4si"
15182 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,rm,Yr,*x,x,Yv")
15184 (match_operand:V4SI 1 "register_operand" "x,v,0,0,x,v")
15185 (parallel [(match_operand:SI 2 "const_0_to_3_operand")])))]
15188 switch (which_alternative)
15192 return "%vpextrd\t{%2, %1, %0|%0, %1, %2}";
15196 operands[2] = GEN_INT (INTVAL (operands[2]) * 4);
15197 return "psrldq\t{%2, %0|%0, %2}";
15201 operands[2] = GEN_INT (INTVAL (operands[2]) * 4);
15202 return "vpsrldq\t{%2, %1, %0|%0, %1, %2}";
15205 gcc_unreachable ();
15208 [(set_attr "isa" "*,avx512dq,noavx,noavx,avx,avx512bw")
15209 (set_attr "type" "sselog1,sselog1,sseishft1,sseishft1,sseishft1,sseishft1")
15210 (set (attr "prefix_extra")
15211 (if_then_else (eq_attr "alternative" "0,1")
15213 (const_string "*")))
15214 (set_attr "length_immediate" "1")
15215 (set_attr "prefix" "maybe_vex,evex,orig,orig,vex,evex")
15216 (set_attr "mode" "TI")])
15218 (define_insn "*vec_extractv4si_zext"
15219 [(set (match_operand:DI 0 "register_operand" "=r,r")
15222 (match_operand:V4SI 1 "register_operand" "x,v")
15223 (parallel [(match_operand:SI 2 "const_0_to_3_operand")]))))]
15224 "TARGET_64BIT && TARGET_SSE4_1"
15225 "%vpextrd\t{%2, %1, %k0|%k0, %1, %2}"
15226 [(set_attr "isa" "*,avx512dq")
15227 (set_attr "type" "sselog1")
15228 (set_attr "prefix_extra" "1")
15229 (set_attr "length_immediate" "1")
15230 (set_attr "prefix" "maybe_vex")
15231 (set_attr "mode" "TI")])
15233 (define_insn "*vec_extractv4si_mem"
15234 [(set (match_operand:SI 0 "register_operand" "=x,r")
15236 (match_operand:V4SI 1 "memory_operand" "o,o")
15237 (parallel [(match_operand 2 "const_0_to_3_operand")])))]
15241 (define_insn_and_split "*vec_extractv4si_zext_mem"
15242 [(set (match_operand:DI 0 "register_operand" "=x,r")
15245 (match_operand:V4SI 1 "memory_operand" "o,o")
15246 (parallel [(match_operand:SI 2 "const_0_to_3_operand")]))))]
15247 "TARGET_64BIT && TARGET_SSE"
15249 "&& reload_completed"
15250 [(set (match_dup 0) (zero_extend:DI (match_dup 1)))]
15252 operands[1] = adjust_address (operands[1], SImode, INTVAL (operands[2]) * 4);
15255 (define_insn "*vec_extractv2di_1"
15256 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,rm,m,x,x,Yv,x,v,r")
15258 (match_operand:V2DI 1 "nonimmediate_operand" "x ,v ,v,0,x, v,x,o,o")
15259 (parallel [(const_int 1)])))]
15260 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
15262 %vpextrq\t{$1, %1, %0|%0, %1, 1}
15263 vpextrq\t{$1, %1, %0|%0, %1, 1}
15264 %vmovhps\t{%1, %0|%0, %1}
15265 psrldq\t{$8, %0|%0, 8}
15266 vpsrldq\t{$8, %1, %0|%0, %1, 8}
15267 vpsrldq\t{$8, %1, %0|%0, %1, 8}
15268 movhlps\t{%1, %0|%0, %1}
15272 (cond [(eq_attr "alternative" "0")
15273 (const_string "x64_sse4")
15274 (eq_attr "alternative" "1")
15275 (const_string "x64_avx512dq")
15276 (eq_attr "alternative" "3")
15277 (const_string "sse2_noavx")
15278 (eq_attr "alternative" "4")
15279 (const_string "avx")
15280 (eq_attr "alternative" "5")
15281 (const_string "avx512bw")
15282 (eq_attr "alternative" "6")
15283 (const_string "noavx")
15284 (eq_attr "alternative" "8")
15285 (const_string "x64")
15287 (const_string "*")))
15289 (cond [(eq_attr "alternative" "2,6,7")
15290 (const_string "ssemov")
15291 (eq_attr "alternative" "3,4,5")
15292 (const_string "sseishft1")
15293 (eq_attr "alternative" "8")
15294 (const_string "imov")
15296 (const_string "sselog1")))
15297 (set (attr "length_immediate")
15298 (if_then_else (eq_attr "alternative" "0,1,3,4,5")
15300 (const_string "*")))
15301 (set (attr "prefix_rex")
15302 (if_then_else (eq_attr "alternative" "0,1")
15304 (const_string "*")))
15305 (set (attr "prefix_extra")
15306 (if_then_else (eq_attr "alternative" "0,1")
15308 (const_string "*")))
15309 (set_attr "prefix" "maybe_vex,evex,maybe_vex,orig,vex,evex,orig,*,*")
15310 (set_attr "mode" "TI,TI,V2SF,TI,TI,TI,V4SF,DI,DI")])
15313 [(set (match_operand:<ssescalarmode> 0 "register_operand")
15314 (vec_select:<ssescalarmode>
15315 (match_operand:VI_128 1 "memory_operand")
15317 [(match_operand 2 "const_0_to_<ssescalarnummask>_operand")])))]
15318 "TARGET_SSE && reload_completed"
15319 [(set (match_dup 0) (match_dup 1))]
15321 int offs = INTVAL (operands[2]) * GET_MODE_SIZE (<ssescalarmode>mode);
15323 operands[1] = adjust_address (operands[1], <ssescalarmode>mode, offs);
15326 (define_insn "*vec_extractv2ti"
15327 [(set (match_operand:TI 0 "nonimmediate_operand" "=xm,vm")
15329 (match_operand:V2TI 1 "register_operand" "x,v")
15331 [(match_operand:SI 2 "const_0_to_1_operand")])))]
15334 vextract%~128\t{%2, %1, %0|%0, %1, %2}
15335 vextracti32x4\t{%2, %g1, %0|%0, %g1, %2}"
15336 [(set_attr "type" "sselog")
15337 (set_attr "prefix_extra" "1")
15338 (set_attr "length_immediate" "1")
15339 (set_attr "prefix" "vex,evex")
15340 (set_attr "mode" "OI")])
15342 (define_insn "*vec_extractv4ti"
15343 [(set (match_operand:TI 0 "nonimmediate_operand" "=vm")
15345 (match_operand:V4TI 1 "register_operand" "v")
15347 [(match_operand:SI 2 "const_0_to_3_operand")])))]
15349 "vextracti32x4\t{%2, %1, %0|%0, %1, %2}"
15350 [(set_attr "type" "sselog")
15351 (set_attr "prefix_extra" "1")
15352 (set_attr "length_immediate" "1")
15353 (set_attr "prefix" "evex")
15354 (set_attr "mode" "XI")])
15356 (define_mode_iterator VEXTRACTI128_MODE
15357 [(V4TI "TARGET_AVX512F") V2TI])
15360 [(set (match_operand:TI 0 "nonimmediate_operand")
15362 (match_operand:VEXTRACTI128_MODE 1 "register_operand")
15363 (parallel [(const_int 0)])))]
15365 && reload_completed
15366 && (TARGET_AVX512VL || !EXT_REX_SSE_REG_P (operands[1]))"
15367 [(set (match_dup 0) (match_dup 1))]
15368 "operands[1] = gen_lowpart (TImode, operands[1]);")
15370 ;; Turn SImode or DImode extraction from arbitrary SSE/AVX/AVX512F
15371 ;; vector modes into vec_extract*.
15373 [(set (match_operand:SWI48x 0 "nonimmediate_operand")
15374 (subreg:SWI48x (match_operand 1 "register_operand") 0))]
15375 "can_create_pseudo_p ()
15376 && REG_P (operands[1])
15377 && VECTOR_MODE_P (GET_MODE (operands[1]))
15378 && ((TARGET_SSE && GET_MODE_SIZE (GET_MODE (operands[1])) == 16)
15379 || (TARGET_AVX && GET_MODE_SIZE (GET_MODE (operands[1])) == 32)
15380 || (TARGET_AVX512F && GET_MODE_SIZE (GET_MODE (operands[1])) == 64))
15381 && (<MODE>mode == SImode || TARGET_64BIT || MEM_P (operands[0]))"
15382 [(set (match_dup 0) (vec_select:SWI48x (match_dup 1)
15383 (parallel [(const_int 0)])))]
15387 switch (GET_MODE_SIZE (GET_MODE (operands[1])))
15390 if (<MODE>mode == SImode)
15392 tmp = gen_reg_rtx (V8SImode);
15393 emit_insn (gen_vec_extract_lo_v16si (tmp,
15394 gen_lowpart (V16SImode,
15399 tmp = gen_reg_rtx (V4DImode);
15400 emit_insn (gen_vec_extract_lo_v8di (tmp,
15401 gen_lowpart (V8DImode,
15407 tmp = gen_reg_rtx (<ssevecmode>mode);
15408 if (<MODE>mode == SImode)
15409 emit_insn (gen_vec_extract_lo_v8si (tmp, gen_lowpart (V8SImode,
15412 emit_insn (gen_vec_extract_lo_v4di (tmp, gen_lowpart (V4DImode,
15417 operands[1] = gen_lowpart (<ssevecmode>mode, operands[1]);
15422 (define_insn "*vec_concatv2si_sse4_1"
15423 [(set (match_operand:V2SI 0 "register_operand"
15424 "=Yr,*x, x, v,Yr,*x, v, v, *y,*y")
15426 (match_operand:SI 1 "nonimmediate_operand"
15427 " 0, 0, x,Yv, 0, 0,Yv,rm, 0,rm")
15428 (match_operand:SI 2 "nonimm_or_0_operand"
15429 " rm,rm,rm,rm,Yr,*x,Yv, C,*ym, C")))]
15430 "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
15432 pinsrd\t{$1, %2, %0|%0, %2, 1}
15433 pinsrd\t{$1, %2, %0|%0, %2, 1}
15434 vpinsrd\t{$1, %2, %1, %0|%0, %1, %2, 1}
15435 vpinsrd\t{$1, %2, %1, %0|%0, %1, %2, 1}
15436 punpckldq\t{%2, %0|%0, %2}
15437 punpckldq\t{%2, %0|%0, %2}
15438 vpunpckldq\t{%2, %1, %0|%0, %1, %2}
15439 %vmovd\t{%1, %0|%0, %1}
15440 punpckldq\t{%2, %0|%0, %2}
15441 movd\t{%1, %0|%0, %1}"
15442 [(set_attr "isa" "noavx,noavx,avx,avx512dq,noavx,noavx,avx,*,*,*")
15443 (set (attr "mmx_isa")
15444 (if_then_else (eq_attr "alternative" "8,9")
15445 (const_string "native")
15446 (const_string "*")))
15448 (cond [(eq_attr "alternative" "7")
15449 (const_string "ssemov")
15450 (eq_attr "alternative" "8")
15451 (const_string "mmxcvt")
15452 (eq_attr "alternative" "9")
15453 (const_string "mmxmov")
15455 (const_string "sselog")))
15456 (set (attr "prefix_extra")
15457 (if_then_else (eq_attr "alternative" "0,1,2,3")
15459 (const_string "*")))
15460 (set (attr "length_immediate")
15461 (if_then_else (eq_attr "alternative" "0,1,2,3")
15463 (const_string "*")))
15464 (set_attr "prefix" "orig,orig,vex,evex,orig,orig,maybe_evex,maybe_vex,orig,orig")
15465 (set_attr "mode" "TI,TI,TI,TI,TI,TI,TI,TI,DI,DI")])
15467 ;; ??? In theory we can match memory for the MMX alternative, but allowing
15468 ;; nonimmediate_operand for operand 2 and *not* allowing memory for the SSE
15469 ;; alternatives pretty much forces the MMX alternative to be chosen.
15470 (define_insn "*vec_concatv2si"
15471 [(set (match_operand:V2SI 0 "register_operand" "=x,x ,x,x,*y,*y")
15473 (match_operand:SI 1 "nonimmediate_operand" " 0,rm,0,m, 0,rm")
15474 (match_operand:SI 2 "reg_or_0_operand" " x,C ,x,C,*y,C")))]
15475 "TARGET_SSE && !TARGET_SSE4_1"
15477 punpckldq\t{%2, %0|%0, %2}
15478 movd\t{%1, %0|%0, %1}
15479 unpcklps\t{%2, %0|%0, %2}
15480 movss\t{%1, %0|%0, %1}
15481 punpckldq\t{%2, %0|%0, %2}
15482 movd\t{%1, %0|%0, %1}"
15483 [(set_attr "isa" "sse2,sse2,*,*,*,*")
15484 (set_attr "mmx_isa" "*,*,*,*,native,native")
15485 (set_attr "type" "sselog,ssemov,sselog,ssemov,mmxcvt,mmxmov")
15486 (set_attr "mode" "TI,TI,V4SF,SF,DI,DI")])
15488 (define_insn "*vec_concatv4si"
15489 [(set (match_operand:V4SI 0 "register_operand" "=x,v,x,x,v")
15491 (match_operand:V2SI 1 "register_operand" " 0,v,0,0,v")
15492 (match_operand:V2SI 2 "nonimmediate_operand" " x,v,x,m,m")))]
15495 punpcklqdq\t{%2, %0|%0, %2}
15496 vpunpcklqdq\t{%2, %1, %0|%0, %1, %2}
15497 movlhps\t{%2, %0|%0, %2}
15498 movhps\t{%2, %0|%0, %q2}
15499 vmovhps\t{%2, %1, %0|%0, %1, %q2}"
15500 [(set_attr "isa" "sse2_noavx,avx,noavx,noavx,avx")
15501 (set_attr "type" "sselog,sselog,ssemov,ssemov,ssemov")
15502 (set_attr "prefix" "orig,maybe_evex,orig,orig,maybe_evex")
15503 (set_attr "mode" "TI,TI,V4SF,V2SF,V2SF")])
15505 (define_insn "*vec_concatv4si_0"
15506 [(set (match_operand:V4SI 0 "register_operand" "=v,x")
15508 (match_operand:V2SI 1 "nonimmediate_operand" "vm,?!*y")
15509 (match_operand:V2SI 2 "const0_operand" " C,C")))]
15512 %vmovq\t{%1, %0|%0, %1}
15513 movq2dq\t{%1, %0|%0, %1}"
15514 [(set_attr "mmx_isa" "*,native")
15515 (set_attr "type" "ssemov")
15516 (set_attr "prefix" "maybe_vex,orig")
15517 (set_attr "mode" "TI")])
15519 (define_insn "vec_concatv2di"
15520 [(set (match_operand:V2DI 0 "register_operand"
15521 "=Yr,*x,x ,v ,x,v ,x,x,v")
15523 (match_operand:DI 1 "register_operand"
15524 " 0, 0,x ,Yv,0,Yv,0,0,v")
15525 (match_operand:DI 2 "nonimmediate_operand"
15526 " rm,rm,rm,rm,x,Yv,x,m,m")))]
15529 pinsrq\t{$1, %2, %0|%0, %2, 1}
15530 pinsrq\t{$1, %2, %0|%0, %2, 1}
15531 vpinsrq\t{$1, %2, %1, %0|%0, %1, %2, 1}
15532 vpinsrq\t{$1, %2, %1, %0|%0, %1, %2, 1}
15533 punpcklqdq\t{%2, %0|%0, %2}
15534 vpunpcklqdq\t{%2, %1, %0|%0, %1, %2}
15535 movlhps\t{%2, %0|%0, %2}
15536 movhps\t{%2, %0|%0, %2}
15537 vmovhps\t{%2, %1, %0|%0, %1, %2}"
15539 (cond [(eq_attr "alternative" "0,1")
15540 (const_string "x64_sse4_noavx")
15541 (eq_attr "alternative" "2")
15542 (const_string "x64_avx")
15543 (eq_attr "alternative" "3")
15544 (const_string "x64_avx512dq")
15545 (eq_attr "alternative" "4")
15546 (const_string "sse2_noavx")
15547 (eq_attr "alternative" "5,8")
15548 (const_string "avx")
15550 (const_string "noavx")))
15553 (eq_attr "alternative" "0,1,2,3,4,5")
15554 (const_string "sselog")
15555 (const_string "ssemov")))
15556 (set (attr "prefix_rex")
15557 (if_then_else (eq_attr "alternative" "0,1,2,3")
15559 (const_string "*")))
15560 (set (attr "prefix_extra")
15561 (if_then_else (eq_attr "alternative" "0,1,2,3")
15563 (const_string "*")))
15564 (set (attr "length_immediate")
15565 (if_then_else (eq_attr "alternative" "0,1,2,3")
15567 (const_string "*")))
15568 (set (attr "prefix")
15569 (cond [(eq_attr "alternative" "2")
15570 (const_string "vex")
15571 (eq_attr "alternative" "3")
15572 (const_string "evex")
15573 (eq_attr "alternative" "5,8")
15574 (const_string "maybe_evex")
15576 (const_string "orig")))
15577 (set_attr "mode" "TI,TI,TI,TI,TI,TI,V4SF,V2SF,V2SF")])
15579 (define_insn "*vec_concatv2di_0"
15580 [(set (match_operand:V2DI 0 "register_operand" "=v,v ,x")
15582 (match_operand:DI 1 "nonimmediate_operand" " r,vm,?!*y")
15583 (match_operand:DI 2 "const0_operand" " C,C ,C")))]
15586 * return HAVE_AS_IX86_INTERUNIT_MOVQ ? \"%vmovq\t{%1, %0|%0, %1}\" : \"%vmovd\t{%1, %0|%0, %1}\";
15587 %vmovq\t{%1, %0|%0, %1}
15588 movq2dq\t{%1, %0|%0, %1}"
15589 [(set_attr "isa" "x64,*,*")
15590 (set_attr "mmx_isa" "*,*,native")
15591 (set_attr "type" "ssemov")
15592 (set_attr "prefix_rex" "1,*,*")
15593 (set_attr "prefix" "maybe_vex,maybe_vex,orig")
15594 (set_attr "mode" "TI")
15595 (set (attr "preferred_for_speed")
15596 (cond [(eq_attr "alternative" "0")
15597 (symbol_ref "TARGET_INTER_UNIT_MOVES_TO_VEC")
15599 (symbol_ref "true")))])
15601 ;; vmovq clears also the higher bits.
15602 (define_insn "vec_set<mode>_0"
15603 [(set (match_operand:VI8_AVX_AVX512F 0 "register_operand" "=v,v")
15604 (vec_merge:VI8_AVX_AVX512F
15605 (vec_duplicate:VI8_AVX_AVX512F
15606 (match_operand:<ssescalarmode> 2 "nonimmediate_operand" "r,vm"))
15607 (match_operand:VI8_AVX_AVX512F 1 "const0_operand" "C,C")
15610 "vmovq\t{%2, %x0|%x0, %2}"
15611 [(set_attr "isa" "x64,*")
15612 (set_attr "type" "ssemov")
15613 (set_attr "prefix_rex" "1,*")
15614 (set_attr "prefix" "maybe_evex")
15615 (set_attr "mode" "TI")
15616 (set (attr "preferred_for_speed")
15617 (cond [(eq_attr "alternative" "0")
15618 (symbol_ref "TARGET_INTER_UNIT_MOVES_TO_VEC")
15620 (symbol_ref "true")))])
15622 (define_expand "vec_unpacks_lo_<mode>"
15623 [(match_operand:<sseunpackmode> 0 "register_operand")
15624 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
15626 "ix86_expand_sse_unpack (operands[0], operands[1], false, false); DONE;")
15628 (define_expand "vec_unpacks_hi_<mode>"
15629 [(match_operand:<sseunpackmode> 0 "register_operand")
15630 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
15632 "ix86_expand_sse_unpack (operands[0], operands[1], false, true); DONE;")
15634 (define_expand "vec_unpacku_lo_<mode>"
15635 [(match_operand:<sseunpackmode> 0 "register_operand")
15636 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
15638 "ix86_expand_sse_unpack (operands[0], operands[1], true, false); DONE;")
15640 (define_expand "vec_unpacks_sbool_lo_qi"
15641 [(match_operand:QI 0 "register_operand")
15642 (match_operand:QI 1 "register_operand")
15643 (match_operand:QI 2 "const_int_operand")]
15646 if (INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 4)
15648 emit_move_insn (operands[0], operands[1]);
15652 (define_expand "vec_unpacks_lo_hi"
15653 [(set (subreg:HI (match_operand:QI 0 "register_operand") 0)
15654 (match_operand:HI 1 "register_operand"))]
15657 (define_expand "vec_unpacks_lo_si"
15658 [(set (match_operand:HI 0 "register_operand")
15659 (subreg:HI (match_operand:SI 1 "register_operand") 0))]
15662 (define_expand "vec_unpacks_lo_di"
15663 [(set (match_operand:SI 0 "register_operand")
15664 (subreg:SI (match_operand:DI 1 "register_operand") 0))]
15667 (define_expand "vec_unpacku_hi_<mode>"
15668 [(match_operand:<sseunpackmode> 0 "register_operand")
15669 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
15671 "ix86_expand_sse_unpack (operands[0], operands[1], true, true); DONE;")
15673 (define_expand "vec_unpacks_sbool_hi_qi"
15674 [(match_operand:QI 0 "register_operand")
15675 (match_operand:QI 1 "register_operand")
15676 (match_operand:QI 2 "const_int_operand")]
15679 HOST_WIDE_INT nunits = INTVAL (operands[2]);
15680 if (nunits != 8 && nunits != 4)
15682 if (TARGET_AVX512DQ)
15683 emit_insn (gen_klshiftrtqi (operands[0], operands[1],
15684 GEN_INT (nunits / 2)));
15687 rtx tem = gen_reg_rtx (HImode);
15688 emit_insn (gen_klshiftrthi (tem, lowpart_subreg (HImode, operands[1],
15690 GEN_INT (nunits / 2)));
15691 emit_move_insn (operands[0], lowpart_subreg (QImode, tem, HImode));
15696 (define_expand "vec_unpacks_hi_hi"
15698 [(set (subreg:HI (match_operand:QI 0 "register_operand") 0)
15699 (lshiftrt:HI (match_operand:HI 1 "register_operand")
15701 (unspec [(const_int 0)] UNSPEC_MASKOP)])]
15704 (define_expand "vec_unpacks_hi_<mode>"
15706 [(set (subreg:SWI48x
15707 (match_operand:<HALFMASKMODE> 0 "register_operand") 0)
15708 (lshiftrt:SWI48x (match_operand:SWI48x 1 "register_operand")
15710 (unspec [(const_int 0)] UNSPEC_MASKOP)])]
15712 "operands[2] = GEN_INT (GET_MODE_BITSIZE (<HALFMASKMODE>mode));")
15714 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15718 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15720 (define_expand "<sse2_avx2>_uavg<mode>3<mask_name>"
15721 [(set (match_operand:VI12_AVX2 0 "register_operand")
15722 (truncate:VI12_AVX2
15723 (lshiftrt:<ssedoublemode>
15724 (plus:<ssedoublemode>
15725 (plus:<ssedoublemode>
15726 (zero_extend:<ssedoublemode>
15727 (match_operand:VI12_AVX2 1 "vector_operand"))
15728 (zero_extend:<ssedoublemode>
15729 (match_operand:VI12_AVX2 2 "vector_operand")))
15730 (match_dup <mask_expand_op3>))
15732 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
15734 operands[<mask_expand_op3>] = CONST1_RTX(<ssedoublemode>mode);
15735 ix86_fixup_binary_operands_no_copy (PLUS, <MODE>mode, operands);
15738 (define_insn "*<sse2_avx2>_uavg<mode>3<mask_name>"
15739 [(set (match_operand:VI12_AVX2 0 "register_operand" "=x,v")
15740 (truncate:VI12_AVX2
15741 (lshiftrt:<ssedoublemode>
15742 (plus:<ssedoublemode>
15743 (plus:<ssedoublemode>
15744 (zero_extend:<ssedoublemode>
15745 (match_operand:VI12_AVX2 1 "vector_operand" "%0,v"))
15746 (zero_extend:<ssedoublemode>
15747 (match_operand:VI12_AVX2 2 "vector_operand" "xBm,vm")))
15748 (match_operand:<ssedoublemode> <mask_expand_op3> "const1_operand"))
15750 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>
15751 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
15753 pavg<ssemodesuffix>\t{%2, %0|%0, %2}
15754 vpavg<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
15755 [(set_attr "isa" "noavx,avx")
15756 (set_attr "type" "sseiadd")
15757 (set_attr "prefix_data16" "1,*")
15758 (set_attr "prefix" "orig,<mask_prefix>")
15759 (set_attr "mode" "<sseinsnmode>")])
15761 ;; The correct representation for this is absolutely enormous, and
15762 ;; surely not generally useful.
15763 (define_insn "<sse2_avx2>_psadbw"
15764 [(set (match_operand:VI8_AVX2_AVX512BW 0 "register_operand" "=x,v")
15765 (unspec:VI8_AVX2_AVX512BW
15766 [(match_operand:<ssebytemode> 1 "register_operand" "0,v")
15767 (match_operand:<ssebytemode> 2 "vector_operand" "xBm,vm")]
15771 psadbw\t{%2, %0|%0, %2}
15772 vpsadbw\t{%2, %1, %0|%0, %1, %2}"
15773 [(set_attr "isa" "noavx,avx")
15774 (set_attr "type" "sseiadd")
15775 (set_attr "atom_unit" "simul")
15776 (set_attr "prefix_data16" "1,*")
15777 (set_attr "prefix" "orig,maybe_evex")
15778 (set_attr "mode" "<sseinsnmode>")])
15780 (define_insn "<sse>_movmsk<ssemodesuffix><avxsizesuffix>"
15781 [(set (match_operand:SI 0 "register_operand" "=r")
15783 [(match_operand:VF_128_256 1 "register_operand" "x")]
15786 "%vmovmsk<ssemodesuffix>\t{%1, %0|%0, %1}"
15787 [(set_attr "type" "ssemov")
15788 (set_attr "prefix" "maybe_vex")
15789 (set_attr "mode" "<MODE>")])
15791 (define_insn "*<sse>_movmsk<ssemodesuffix><avxsizesuffix>_<u>ext"
15792 [(set (match_operand:DI 0 "register_operand" "=r")
15795 [(match_operand:VF_128_256 1 "register_operand" "x")]
15797 "TARGET_64BIT && TARGET_SSE"
15798 "%vmovmsk<ssemodesuffix>\t{%1, %k0|%k0, %1}"
15799 [(set_attr "type" "ssemov")
15800 (set_attr "prefix" "maybe_vex")
15801 (set_attr "mode" "<MODE>")])
15803 (define_insn_and_split "*<sse>_movmsk<ssemodesuffix><avxsizesuffix>_lt"
15804 [(set (match_operand:SI 0 "register_operand" "=r")
15807 (match_operand:<sseintvecmode> 1 "register_operand" "x")
15808 (match_operand:<sseintvecmode> 2 "const0_operand" "C"))]
15812 "&& reload_completed"
15813 [(set (match_dup 0)
15814 (unspec:SI [(match_dup 1)] UNSPEC_MOVMSK))]
15815 "operands[1] = gen_lowpart (<MODE>mode, operands[1]);"
15816 [(set_attr "type" "ssemov")
15817 (set_attr "prefix" "maybe_vex")
15818 (set_attr "mode" "<MODE>")])
15820 (define_insn_and_split "*<sse>_movmsk<ssemodesuffix><avxsizesuffix>_<u>ext_lt"
15821 [(set (match_operand:DI 0 "register_operand" "=r")
15825 (match_operand:<sseintvecmode> 1 "register_operand" "x")
15826 (match_operand:<sseintvecmode> 2 "const0_operand" "C"))]
15828 "TARGET_64BIT && TARGET_SSE"
15830 "&& reload_completed"
15831 [(set (match_dup 0)
15832 (any_extend:DI (unspec:SI [(match_dup 1)] UNSPEC_MOVMSK)))]
15833 "operands[1] = gen_lowpart (<MODE>mode, operands[1]);"
15834 [(set_attr "type" "ssemov")
15835 (set_attr "prefix" "maybe_vex")
15836 (set_attr "mode" "<MODE>")])
15838 (define_insn_and_split "*<sse>_movmsk<ssemodesuffix><avxsizesuffix>_shift"
15839 [(set (match_operand:SI 0 "register_operand" "=r")
15841 [(subreg:VF_128_256
15842 (ashiftrt:<sseintvecmode>
15843 (match_operand:<sseintvecmode> 1 "register_operand" "x")
15844 (match_operand:QI 2 "const_int_operand" "n")) 0)]
15848 "&& reload_completed"
15849 [(set (match_dup 0)
15850 (unspec:SI [(match_dup 1)] UNSPEC_MOVMSK))]
15851 "operands[1] = gen_lowpart (<MODE>mode, operands[1]);"
15852 [(set_attr "type" "ssemov")
15853 (set_attr "prefix" "maybe_vex")
15854 (set_attr "mode" "<MODE>")])
15856 (define_insn_and_split "*<sse>_movmsk<ssemodesuffix><avxsizesuffix>_<u>ext_shift"
15857 [(set (match_operand:DI 0 "register_operand" "=r")
15860 [(subreg:VF_128_256
15861 (ashiftrt:<sseintvecmode>
15862 (match_operand:<sseintvecmode> 1 "register_operand" "x")
15863 (match_operand:QI 2 "const_int_operand" "n")) 0)]
15865 "TARGET_64BIT && TARGET_SSE"
15867 "&& reload_completed"
15868 [(set (match_dup 0)
15869 (any_extend:DI (unspec:SI [(match_dup 1)] UNSPEC_MOVMSK)))]
15870 "operands[1] = gen_lowpart (<MODE>mode, operands[1]);"
15871 [(set_attr "type" "ssemov")
15872 (set_attr "prefix" "maybe_vex")
15873 (set_attr "mode" "<MODE>")])
15875 (define_insn "<sse2_avx2>_pmovmskb"
15876 [(set (match_operand:SI 0 "register_operand" "=r")
15878 [(match_operand:VI1_AVX2 1 "register_operand" "x")]
15881 "%vpmovmskb\t{%1, %0|%0, %1}"
15882 [(set_attr "type" "ssemov")
15883 (set (attr "prefix_data16")
15885 (match_test "TARGET_AVX")
15887 (const_string "1")))
15888 (set_attr "prefix" "maybe_vex")
15889 (set_attr "mode" "SI")])
15891 (define_insn "*<sse2_avx2>_pmovmskb_zext"
15892 [(set (match_operand:DI 0 "register_operand" "=r")
15895 [(match_operand:VI1_AVX2 1 "register_operand" "x")]
15897 "TARGET_64BIT && TARGET_SSE2"
15898 "%vpmovmskb\t{%1, %k0|%k0, %1}"
15899 [(set_attr "type" "ssemov")
15900 (set (attr "prefix_data16")
15902 (match_test "TARGET_AVX")
15904 (const_string "1")))
15905 (set_attr "prefix" "maybe_vex")
15906 (set_attr "mode" "SI")])
15908 (define_insn "*sse2_pmovmskb_ext"
15909 [(set (match_operand:DI 0 "register_operand" "=r")
15912 [(match_operand:V16QI 1 "register_operand" "x")]
15914 "TARGET_64BIT && TARGET_SSE2"
15915 "%vpmovmskb\t{%1, %k0|%k0, %1}"
15916 [(set_attr "type" "ssemov")
15917 (set (attr "prefix_data16")
15919 (match_test "TARGET_AVX")
15921 (const_string "1")))
15922 (set_attr "prefix" "maybe_vex")
15923 (set_attr "mode" "SI")])
15925 (define_insn_and_split "*<sse2_avx2>_pmovmskb_lt"
15926 [(set (match_operand:SI 0 "register_operand" "=r")
15928 [(lt:VI1_AVX2 (match_operand:VI1_AVX2 1 "register_operand" "x")
15929 (match_operand:VI1_AVX2 2 "const0_operand" "C"))]
15934 [(set (match_dup 0)
15935 (unspec:SI [(match_dup 1)] UNSPEC_MOVMSK))]
15937 [(set_attr "type" "ssemov")
15938 (set (attr "prefix_data16")
15940 (match_test "TARGET_AVX")
15942 (const_string "1")))
15943 (set_attr "prefix" "maybe_vex")
15944 (set_attr "mode" "SI")])
15946 (define_insn_and_split "*<sse2_avx2>_pmovmskb_zext_lt"
15947 [(set (match_operand:DI 0 "register_operand" "=r")
15950 [(lt:VI1_AVX2 (match_operand:VI1_AVX2 1 "register_operand" "x")
15951 (match_operand:VI1_AVX2 2 "const0_operand" "C"))]
15953 "TARGET_64BIT && TARGET_SSE2"
15956 [(set (match_dup 0)
15957 (zero_extend:DI (unspec:SI [(match_dup 1)] UNSPEC_MOVMSK)))]
15959 [(set_attr "type" "ssemov")
15960 (set (attr "prefix_data16")
15962 (match_test "TARGET_AVX")
15964 (const_string "1")))
15965 (set_attr "prefix" "maybe_vex")
15966 (set_attr "mode" "SI")])
15968 (define_insn_and_split "*sse2_pmovmskb_ext_lt"
15969 [(set (match_operand:DI 0 "register_operand" "=r")
15972 [(lt:V16QI (match_operand:V16QI 1 "register_operand" "x")
15973 (match_operand:V16QI 2 "const0_operand" "C"))]
15975 "TARGET_64BIT && TARGET_SSE2"
15978 [(set (match_dup 0)
15979 (sign_extend:DI (unspec:SI [(match_dup 1)] UNSPEC_MOVMSK)))]
15981 [(set_attr "type" "ssemov")
15982 (set (attr "prefix_data16")
15984 (match_test "TARGET_AVX")
15986 (const_string "1")))
15987 (set_attr "prefix" "maybe_vex")
15988 (set_attr "mode" "SI")])
15990 (define_expand "sse2_maskmovdqu"
15991 [(set (match_operand:V16QI 0 "memory_operand")
15992 (unspec:V16QI [(match_operand:V16QI 1 "register_operand")
15993 (match_operand:V16QI 2 "register_operand")
15998 (define_insn "*sse2_maskmovdqu"
15999 [(set (mem:V16QI (match_operand:P 0 "register_operand" "D"))
16000 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "x")
16001 (match_operand:V16QI 2 "register_operand" "x")
16002 (mem:V16QI (match_dup 0))]
16006 /* We can't use %^ here due to ASM_OUTPUT_OPCODE processing
16007 that requires %v to be at the beginning of the opcode name. */
16008 if (Pmode != word_mode)
16009 fputs ("\taddr32", asm_out_file);
16010 return "%vmaskmovdqu\t{%2, %1|%1, %2}";
16012 [(set_attr "type" "ssemov")
16013 (set_attr "prefix_data16" "1")
16014 (set (attr "length_address")
16015 (symbol_ref ("Pmode != word_mode")))
16016 ;; The implicit %rdi operand confuses default length_vex computation.
16017 (set (attr "length_vex")
16018 (symbol_ref ("3 + REX_SSE_REGNO_P (REGNO (operands[2]))")))
16019 (set_attr "prefix" "maybe_vex")
16020 (set_attr "znver1_decode" "vector")
16021 (set_attr "mode" "TI")])
16023 (define_insn "sse_ldmxcsr"
16024 [(unspec_volatile [(match_operand:SI 0 "memory_operand" "m")]
16028 [(set_attr "type" "sse")
16029 (set_attr "atom_sse_attr" "mxcsr")
16030 (set_attr "prefix" "maybe_vex")
16031 (set_attr "memory" "load")])
16033 (define_insn "sse_stmxcsr"
16034 [(set (match_operand:SI 0 "memory_operand" "=m")
16035 (unspec_volatile:SI [(const_int 0)] UNSPECV_STMXCSR))]
16038 [(set_attr "type" "sse")
16039 (set_attr "atom_sse_attr" "mxcsr")
16040 (set_attr "prefix" "maybe_vex")
16041 (set_attr "memory" "store")])
16043 (define_insn "sse2_clflush"
16044 [(unspec_volatile [(match_operand 0 "address_operand" "p")]
16048 [(set_attr "type" "sse")
16049 (set_attr "atom_sse_attr" "fence")
16050 (set_attr "memory" "unknown")])
16052 ;; As per AMD and Intel ISA manuals, the first operand is extensions
16053 ;; and it goes to %ecx. The second operand received is hints and it goes
16055 (define_insn "sse3_mwait"
16056 [(unspec_volatile [(match_operand:SI 0 "register_operand" "c")
16057 (match_operand:SI 1 "register_operand" "a")]
16060 ;; 64bit version is "mwait %rax,%rcx". But only lower 32bits are used.
16061 ;; Since 32bit register operands are implicitly zero extended to 64bit,
16062 ;; we only need to set up 32bit registers.
16064 [(set_attr "length" "3")])
16066 (define_insn "@sse3_monitor_<mode>"
16067 [(unspec_volatile [(match_operand:P 0 "register_operand" "a")
16068 (match_operand:SI 1 "register_operand" "c")
16069 (match_operand:SI 2 "register_operand" "d")]
16072 ;; 64bit version is "monitor %rax,%rcx,%rdx". But only lower 32bits in
16073 ;; RCX and RDX are used. Since 32bit register operands are implicitly
16074 ;; zero extended to 64bit, we only need to set up 32bit registers.
16076 [(set (attr "length")
16077 (symbol_ref ("(Pmode != word_mode) + 3")))])
16079 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16081 ;; SSSE3 instructions
16083 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16085 (define_code_iterator ssse3_plusminus [plus ss_plus minus ss_minus])
16087 (define_insn "avx2_ph<plusminus_mnemonic>wv16hi3"
16088 [(set (match_operand:V16HI 0 "register_operand" "=x")
16089 (ssse3_plusminus:V16HI
16092 (match_operand:V16HI 1 "register_operand" "x")
16093 (match_operand:V16HI 2 "nonimmediate_operand" "xm"))
16095 [(const_int 0) (const_int 2) (const_int 4) (const_int 6)
16096 (const_int 16) (const_int 18) (const_int 20) (const_int 22)
16097 (const_int 8) (const_int 10) (const_int 12) (const_int 14)
16098 (const_int 24) (const_int 26) (const_int 28) (const_int 30)]))
16100 (vec_concat:V32HI (match_dup 1) (match_dup 2))
16102 [(const_int 1) (const_int 3) (const_int 5) (const_int 7)
16103 (const_int 17) (const_int 19) (const_int 21) (const_int 23)
16104 (const_int 9) (const_int 11) (const_int 13) (const_int 15)
16105 (const_int 25) (const_int 27) (const_int 29) (const_int 31)]))))]
16107 "vph<plusminus_mnemonic>w\t{%2, %1, %0|%0, %1, %2}"
16108 [(set_attr "type" "sseiadd")
16109 (set_attr "prefix_extra" "1")
16110 (set_attr "prefix" "vex")
16111 (set_attr "mode" "OI")])
16113 (define_insn "ssse3_ph<plusminus_mnemonic>wv8hi3"
16114 [(set (match_operand:V8HI 0 "register_operand" "=x,x")
16115 (ssse3_plusminus:V8HI
16118 (match_operand:V8HI 1 "register_operand" "0,x")
16119 (match_operand:V8HI 2 "vector_operand" "xBm,xm"))
16121 [(const_int 0) (const_int 2) (const_int 4) (const_int 6)
16122 (const_int 8) (const_int 10) (const_int 12) (const_int 14)]))
16124 (vec_concat:V16HI (match_dup 1) (match_dup 2))
16126 [(const_int 1) (const_int 3) (const_int 5) (const_int 7)
16127 (const_int 9) (const_int 11) (const_int 13) (const_int 15)]))))]
16130 ph<plusminus_mnemonic>w\t{%2, %0|%0, %2}
16131 vph<plusminus_mnemonic>w\t{%2, %1, %0|%0, %1, %2}"
16132 [(set_attr "isa" "noavx,avx")
16133 (set_attr "type" "sseiadd")
16134 (set_attr "atom_unit" "complex")
16135 (set_attr "prefix_data16" "1,*")
16136 (set_attr "prefix_extra" "1")
16137 (set_attr "prefix" "orig,vex")
16138 (set_attr "mode" "TI")])
16140 (define_insn_and_split "ssse3_ph<plusminus_mnemonic>wv4hi3"
16141 [(set (match_operand:V4HI 0 "register_operand" "=y,x,Yv")
16142 (ssse3_plusminus:V4HI
16145 (match_operand:V4HI 1 "register_operand" "0,0,Yv")
16146 (match_operand:V4HI 2 "register_mmxmem_operand" "ym,x,Yv"))
16148 [(const_int 0) (const_int 2) (const_int 4) (const_int 6)]))
16150 (vec_concat:V8HI (match_dup 1) (match_dup 2))
16152 [(const_int 1) (const_int 3) (const_int 5) (const_int 7)]))))]
16153 "(TARGET_MMX || TARGET_MMX_WITH_SSE) && TARGET_SSSE3"
16155 ph<plusminus_mnemonic>w\t{%2, %0|%0, %2}
16158 "TARGET_SSSE3 && reload_completed
16159 && SSE_REGNO_P (REGNO (operands[0]))"
16162 /* Generate SSE version of the operation. */
16163 rtx op0 = lowpart_subreg (V8HImode, operands[0],
16164 GET_MODE (operands[0]));
16165 rtx op1 = lowpart_subreg (V8HImode, operands[1],
16166 GET_MODE (operands[1]));
16167 rtx op2 = lowpart_subreg (V8HImode, operands[2],
16168 GET_MODE (operands[2]));
16169 emit_insn (gen_ssse3_ph<plusminus_mnemonic>wv8hi3 (op0, op1, op2));
16170 ix86_move_vector_high_sse_to_mmx (op0);
16173 [(set_attr "mmx_isa" "native,sse_noavx,avx")
16174 (set_attr "type" "sseiadd")
16175 (set_attr "atom_unit" "complex")
16176 (set_attr "prefix_extra" "1")
16177 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
16178 (set_attr "mode" "DI,TI,TI")])
16180 (define_insn "avx2_ph<plusminus_mnemonic>dv8si3"
16181 [(set (match_operand:V8SI 0 "register_operand" "=x")
16185 (match_operand:V8SI 1 "register_operand" "x")
16186 (match_operand:V8SI 2 "nonimmediate_operand" "xm"))
16188 [(const_int 0) (const_int 2) (const_int 8) (const_int 10)
16189 (const_int 4) (const_int 6) (const_int 12) (const_int 14)]))
16191 (vec_concat:V16SI (match_dup 1) (match_dup 2))
16193 [(const_int 1) (const_int 3) (const_int 9) (const_int 11)
16194 (const_int 5) (const_int 7) (const_int 13) (const_int 15)]))))]
16196 "vph<plusminus_mnemonic>d\t{%2, %1, %0|%0, %1, %2}"
16197 [(set_attr "type" "sseiadd")
16198 (set_attr "prefix_extra" "1")
16199 (set_attr "prefix" "vex")
16200 (set_attr "mode" "OI")])
16202 (define_insn "ssse3_ph<plusminus_mnemonic>dv4si3"
16203 [(set (match_operand:V4SI 0 "register_operand" "=x,x")
16207 (match_operand:V4SI 1 "register_operand" "0,x")
16208 (match_operand:V4SI 2 "vector_operand" "xBm,xm"))
16210 [(const_int 0) (const_int 2) (const_int 4) (const_int 6)]))
16212 (vec_concat:V8SI (match_dup 1) (match_dup 2))
16214 [(const_int 1) (const_int 3) (const_int 5) (const_int 7)]))))]
16217 ph<plusminus_mnemonic>d\t{%2, %0|%0, %2}
16218 vph<plusminus_mnemonic>d\t{%2, %1, %0|%0, %1, %2}"
16219 [(set_attr "isa" "noavx,avx")
16220 (set_attr "type" "sseiadd")
16221 (set_attr "atom_unit" "complex")
16222 (set_attr "prefix_data16" "1,*")
16223 (set_attr "prefix_extra" "1")
16224 (set_attr "prefix" "orig,vex")
16225 (set_attr "mode" "TI")])
16227 (define_insn_and_split "ssse3_ph<plusminus_mnemonic>dv2si3"
16228 [(set (match_operand:V2SI 0 "register_operand" "=y,x,Yv")
16232 (match_operand:V2SI 1 "register_operand" "0,0,Yv")
16233 (match_operand:V2SI 2 "register_mmxmem_operand" "ym,x,Yv"))
16234 (parallel [(const_int 0) (const_int 2)]))
16236 (vec_concat:V4SI (match_dup 1) (match_dup 2))
16237 (parallel [(const_int 1) (const_int 3)]))))]
16238 "(TARGET_MMX || TARGET_MMX_WITH_SSE) && TARGET_SSSE3"
16240 ph<plusminus_mnemonic>d\t{%2, %0|%0, %2}
16243 "TARGET_SSSE3 && reload_completed
16244 && SSE_REGNO_P (REGNO (operands[0]))"
16247 /* Generate SSE version of the operation. */
16248 rtx op0 = lowpart_subreg (V4SImode, operands[0],
16249 GET_MODE (operands[0]));
16250 rtx op1 = lowpart_subreg (V4SImode, operands[1],
16251 GET_MODE (operands[1]));
16252 rtx op2 = lowpart_subreg (V4SImode, operands[2],
16253 GET_MODE (operands[2]));
16254 emit_insn (gen_ssse3_ph<plusminus_mnemonic>dv4si3 (op0, op1, op2));
16255 ix86_move_vector_high_sse_to_mmx (op0);
16258 [(set_attr "mmx_isa" "native,sse_noavx,avx")
16259 (set_attr "type" "sseiadd")
16260 (set_attr "atom_unit" "complex")
16261 (set_attr "prefix_extra" "1")
16262 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
16263 (set_attr "mode" "DI,TI,TI")])
16265 (define_insn "avx2_pmaddubsw256"
16266 [(set (match_operand:V16HI 0 "register_operand" "=x,v")
16271 (match_operand:V32QI 1 "register_operand" "x,v")
16272 (parallel [(const_int 0) (const_int 2)
16273 (const_int 4) (const_int 6)
16274 (const_int 8) (const_int 10)
16275 (const_int 12) (const_int 14)
16276 (const_int 16) (const_int 18)
16277 (const_int 20) (const_int 22)
16278 (const_int 24) (const_int 26)
16279 (const_int 28) (const_int 30)])))
16282 (match_operand:V32QI 2 "nonimmediate_operand" "xm,vm")
16283 (parallel [(const_int 0) (const_int 2)
16284 (const_int 4) (const_int 6)
16285 (const_int 8) (const_int 10)
16286 (const_int 12) (const_int 14)
16287 (const_int 16) (const_int 18)
16288 (const_int 20) (const_int 22)
16289 (const_int 24) (const_int 26)
16290 (const_int 28) (const_int 30)]))))
16293 (vec_select:V16QI (match_dup 1)
16294 (parallel [(const_int 1) (const_int 3)
16295 (const_int 5) (const_int 7)
16296 (const_int 9) (const_int 11)
16297 (const_int 13) (const_int 15)
16298 (const_int 17) (const_int 19)
16299 (const_int 21) (const_int 23)
16300 (const_int 25) (const_int 27)
16301 (const_int 29) (const_int 31)])))
16303 (vec_select:V16QI (match_dup 2)
16304 (parallel [(const_int 1) (const_int 3)
16305 (const_int 5) (const_int 7)
16306 (const_int 9) (const_int 11)
16307 (const_int 13) (const_int 15)
16308 (const_int 17) (const_int 19)
16309 (const_int 21) (const_int 23)
16310 (const_int 25) (const_int 27)
16311 (const_int 29) (const_int 31)]))))))]
16313 "vpmaddubsw\t{%2, %1, %0|%0, %1, %2}"
16314 [(set_attr "isa" "*,avx512bw")
16315 (set_attr "type" "sseiadd")
16316 (set_attr "prefix_extra" "1")
16317 (set_attr "prefix" "vex,evex")
16318 (set_attr "mode" "OI")])
16320 ;; The correct representation for this is absolutely enormous, and
16321 ;; surely not generally useful.
16322 (define_insn "avx512bw_pmaddubsw512<mode><mask_name>"
16323 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
16324 (unspec:VI2_AVX512VL
16325 [(match_operand:<dbpsadbwmode> 1 "register_operand" "v")
16326 (match_operand:<dbpsadbwmode> 2 "nonimmediate_operand" "vm")]
16327 UNSPEC_PMADDUBSW512))]
16329 "vpmaddubsw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}";
16330 [(set_attr "type" "sseiadd")
16331 (set_attr "prefix" "evex")
16332 (set_attr "mode" "XI")])
16334 (define_insn "avx512bw_umulhrswv32hi3<mask_name>"
16335 [(set (match_operand:V32HI 0 "register_operand" "=v")
16342 (match_operand:V32HI 1 "nonimmediate_operand" "%v"))
16344 (match_operand:V32HI 2 "nonimmediate_operand" "vm")))
16346 (const_vector:V32HI [(const_int 1) (const_int 1)
16347 (const_int 1) (const_int 1)
16348 (const_int 1) (const_int 1)
16349 (const_int 1) (const_int 1)
16350 (const_int 1) (const_int 1)
16351 (const_int 1) (const_int 1)
16352 (const_int 1) (const_int 1)
16353 (const_int 1) (const_int 1)
16354 (const_int 1) (const_int 1)
16355 (const_int 1) (const_int 1)
16356 (const_int 1) (const_int 1)
16357 (const_int 1) (const_int 1)
16358 (const_int 1) (const_int 1)
16359 (const_int 1) (const_int 1)
16360 (const_int 1) (const_int 1)
16361 (const_int 1) (const_int 1)]))
16364 "vpmulhrsw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
16365 [(set_attr "type" "sseimul")
16366 (set_attr "prefix" "evex")
16367 (set_attr "mode" "XI")])
16369 (define_insn "ssse3_pmaddubsw128"
16370 [(set (match_operand:V8HI 0 "register_operand" "=x,x,v")
16375 (match_operand:V16QI 1 "register_operand" "0,x,v")
16376 (parallel [(const_int 0) (const_int 2)
16377 (const_int 4) (const_int 6)
16378 (const_int 8) (const_int 10)
16379 (const_int 12) (const_int 14)])))
16382 (match_operand:V16QI 2 "vector_operand" "xBm,xm,vm")
16383 (parallel [(const_int 0) (const_int 2)
16384 (const_int 4) (const_int 6)
16385 (const_int 8) (const_int 10)
16386 (const_int 12) (const_int 14)]))))
16389 (vec_select:V8QI (match_dup 1)
16390 (parallel [(const_int 1) (const_int 3)
16391 (const_int 5) (const_int 7)
16392 (const_int 9) (const_int 11)
16393 (const_int 13) (const_int 15)])))
16395 (vec_select:V8QI (match_dup 2)
16396 (parallel [(const_int 1) (const_int 3)
16397 (const_int 5) (const_int 7)
16398 (const_int 9) (const_int 11)
16399 (const_int 13) (const_int 15)]))))))]
16402 pmaddubsw\t{%2, %0|%0, %2}
16403 vpmaddubsw\t{%2, %1, %0|%0, %1, %2}
16404 vpmaddubsw\t{%2, %1, %0|%0, %1, %2}"
16405 [(set_attr "isa" "noavx,avx,avx512bw")
16406 (set_attr "type" "sseiadd")
16407 (set_attr "atom_unit" "simul")
16408 (set_attr "prefix_data16" "1,*,*")
16409 (set_attr "prefix_extra" "1")
16410 (set_attr "prefix" "orig,vex,evex")
16411 (set_attr "mode" "TI")])
16413 (define_insn "ssse3_pmaddubsw"
16414 [(set (match_operand:V4HI 0 "register_operand" "=y,x,Yv")
16419 (match_operand:V8QI 1 "register_operand" "0,0,Yv")
16420 (parallel [(const_int 0) (const_int 2)
16421 (const_int 4) (const_int 6)])))
16424 (match_operand:V8QI 2 "register_mmxmem_operand" "ym,x,Yv")
16425 (parallel [(const_int 0) (const_int 2)
16426 (const_int 4) (const_int 6)]))))
16429 (vec_select:V4QI (match_dup 1)
16430 (parallel [(const_int 1) (const_int 3)
16431 (const_int 5) (const_int 7)])))
16433 (vec_select:V4QI (match_dup 2)
16434 (parallel [(const_int 1) (const_int 3)
16435 (const_int 5) (const_int 7)]))))))]
16436 "(TARGET_MMX || TARGET_MMX_WITH_SSE) && TARGET_SSSE3"
16438 pmaddubsw\t{%2, %0|%0, %2}
16439 pmaddubsw\t{%2, %0|%0, %2}
16440 vpmaddubsw\t{%2, %1, %0|%0, %1, %2}"
16441 [(set_attr "isa" "*,noavx,avx")
16442 (set_attr "mmx_isa" "native,*,*")
16443 (set_attr "type" "sseiadd")
16444 (set_attr "atom_unit" "simul")
16445 (set_attr "prefix_extra" "1")
16446 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
16447 (set_attr "mode" "DI,TI,TI")])
16449 (define_mode_iterator PMULHRSW
16450 [V8HI (V16HI "TARGET_AVX2")])
16452 (define_expand "<ssse3_avx2>_pmulhrsw<mode>3_mask"
16453 [(set (match_operand:PMULHRSW 0 "register_operand")
16454 (vec_merge:PMULHRSW
16456 (lshiftrt:<ssedoublemode>
16457 (plus:<ssedoublemode>
16458 (lshiftrt:<ssedoublemode>
16459 (mult:<ssedoublemode>
16460 (sign_extend:<ssedoublemode>
16461 (match_operand:PMULHRSW 1 "nonimmediate_operand"))
16462 (sign_extend:<ssedoublemode>
16463 (match_operand:PMULHRSW 2 "nonimmediate_operand")))
16467 (match_operand:PMULHRSW 3 "register_operand")
16468 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
16469 "TARGET_AVX512BW && TARGET_AVX512VL"
16471 operands[5] = CONST1_RTX(<MODE>mode);
16472 ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);
16475 (define_expand "<ssse3_avx2>_pmulhrsw<mode>3"
16476 [(set (match_operand:PMULHRSW 0 "register_operand")
16478 (lshiftrt:<ssedoublemode>
16479 (plus:<ssedoublemode>
16480 (lshiftrt:<ssedoublemode>
16481 (mult:<ssedoublemode>
16482 (sign_extend:<ssedoublemode>
16483 (match_operand:PMULHRSW 1 "nonimmediate_operand"))
16484 (sign_extend:<ssedoublemode>
16485 (match_operand:PMULHRSW 2 "nonimmediate_operand")))
16491 operands[3] = CONST1_RTX(<MODE>mode);
16492 ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);
16495 (define_expand "smulhrs<mode>3"
16496 [(set (match_operand:VI2_AVX2 0 "register_operand")
16498 (lshiftrt:<ssedoublemode>
16499 (plus:<ssedoublemode>
16500 (lshiftrt:<ssedoublemode>
16501 (mult:<ssedoublemode>
16502 (sign_extend:<ssedoublemode>
16503 (match_operand:VI2_AVX2 1 "nonimmediate_operand"))
16504 (sign_extend:<ssedoublemode>
16505 (match_operand:VI2_AVX2 2 "nonimmediate_operand")))
16511 operands[3] = CONST1_RTX(<MODE>mode);
16512 ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);
16515 (define_insn "*<ssse3_avx2>_pmulhrsw<mode>3<mask_name>"
16516 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,x,v")
16518 (lshiftrt:<ssedoublemode>
16519 (plus:<ssedoublemode>
16520 (lshiftrt:<ssedoublemode>
16521 (mult:<ssedoublemode>
16522 (sign_extend:<ssedoublemode>
16523 (match_operand:VI2_AVX2 1 "vector_operand" "%0,x,v"))
16524 (sign_extend:<ssedoublemode>
16525 (match_operand:VI2_AVX2 2 "vector_operand" "xBm,xm,vm")))
16527 (match_operand:VI2_AVX2 3 "const1_operand"))
16529 "TARGET_SSSE3 && <mask_mode512bit_condition> && <mask_avx512bw_condition>
16530 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
16532 pmulhrsw\t{%2, %0|%0, %2}
16533 vpmulhrsw\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}
16534 vpmulhrsw\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}"
16535 [(set_attr "isa" "noavx,avx,avx512bw")
16536 (set_attr "type" "sseimul")
16537 (set_attr "prefix_data16" "1,*,*")
16538 (set_attr "prefix_extra" "1")
16539 (set_attr "prefix" "orig,maybe_evex,evex")
16540 (set_attr "mode" "<sseinsnmode>")])
16542 (define_expand "smulhrsv4hi3"
16543 [(set (match_operand:V4HI 0 "register_operand")
16550 (match_operand:V4HI 1 "register_operand"))
16552 (match_operand:V4HI 2 "register_operand")))
16556 "TARGET_MMX_WITH_SSE && TARGET_SSSE3"
16558 operands[3] = CONST1_RTX(V4HImode);
16559 ix86_fixup_binary_operands_no_copy (MULT, V4HImode, operands);
16562 (define_expand "ssse3_pmulhrswv4hi3"
16563 [(set (match_operand:V4HI 0 "register_operand")
16570 (match_operand:V4HI 1 "register_mmxmem_operand"))
16572 (match_operand:V4HI 2 "register_mmxmem_operand")))
16576 "(TARGET_MMX || TARGET_MMX_WITH_SSE) && TARGET_SSSE3"
16578 operands[3] = CONST1_RTX(V4HImode);
16579 ix86_fixup_binary_operands_no_copy (MULT, V4HImode, operands);
16582 (define_insn "*ssse3_pmulhrswv4hi3"
16583 [(set (match_operand:V4HI 0 "register_operand" "=y,x,Yv")
16590 (match_operand:V4HI 1 "register_mmxmem_operand" "%0,0,Yv"))
16592 (match_operand:V4HI 2 "register_mmxmem_operand" "ym,x,Yv")))
16594 (match_operand:V4HI 3 "const1_operand"))
16596 "(TARGET_MMX || TARGET_MMX_WITH_SSE)
16598 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
16600 pmulhrsw\t{%2, %0|%0, %2}
16601 pmulhrsw\t{%2, %0|%0, %2}
16602 vpmulhrsw\t{%2, %1, %0|%0, %1, %2}"
16603 [(set_attr "isa" "*,noavx,avx")
16604 (set_attr "mmx_isa" "native,*,*")
16605 (set_attr "type" "sseimul")
16606 (set_attr "prefix_extra" "1")
16607 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
16608 (set_attr "mode" "DI,TI,TI")])
16610 (define_insn "<ssse3_avx2>_pshufb<mode>3<mask_name>"
16611 [(set (match_operand:VI1_AVX512 0 "register_operand" "=x,x,v")
16613 [(match_operand:VI1_AVX512 1 "register_operand" "0,x,v")
16614 (match_operand:VI1_AVX512 2 "vector_operand" "xBm,xm,vm")]
16616 "TARGET_SSSE3 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
16618 pshufb\t{%2, %0|%0, %2}
16619 vpshufb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
16620 vpshufb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
16621 [(set_attr "isa" "noavx,avx,avx512bw")
16622 (set_attr "type" "sselog1")
16623 (set_attr "prefix_data16" "1,*,*")
16624 (set_attr "prefix_extra" "1")
16625 (set_attr "prefix" "orig,maybe_evex,evex")
16626 (set_attr "btver2_decode" "vector")
16627 (set_attr "mode" "<sseinsnmode>")])
16629 (define_insn_and_split "ssse3_pshufbv8qi3"
16630 [(set (match_operand:V8QI 0 "register_operand" "=y,x,Yv")
16631 (unspec:V8QI [(match_operand:V8QI 1 "register_operand" "0,0,Yv")
16632 (match_operand:V8QI 2 "register_mmxmem_operand" "ym,x,Yv")]
16634 (clobber (match_scratch:V4SI 3 "=X,&x,&Yv"))]
16635 "(TARGET_MMX || TARGET_MMX_WITH_SSE) && TARGET_SSSE3"
16637 pshufb\t{%2, %0|%0, %2}
16640 "TARGET_SSSE3 && reload_completed
16641 && SSE_REGNO_P (REGNO (operands[0]))"
16642 [(set (match_dup 3) (match_dup 5))
16644 (and:V4SI (match_dup 3) (match_dup 2)))
16646 (unspec:V16QI [(match_dup 1) (match_dup 4)] UNSPEC_PSHUFB))]
16648 /* Emulate MMX version of pshufb with SSE version by masking out the
16649 bit 3 of the shuffle control byte. */
16650 operands[0] = lowpart_subreg (V16QImode, operands[0],
16651 GET_MODE (operands[0]));
16652 operands[1] = lowpart_subreg (V16QImode, operands[1],
16653 GET_MODE (operands[1]));
16654 operands[2] = lowpart_subreg (V4SImode, operands[2],
16655 GET_MODE (operands[2]));
16656 operands[4] = lowpart_subreg (V16QImode, operands[3],
16657 GET_MODE (operands[3]));
16658 rtvec par = gen_rtvec (4, GEN_INT (0xf7f7f7f7),
16659 GEN_INT (0xf7f7f7f7),
16660 GEN_INT (0xf7f7f7f7),
16661 GEN_INT (0xf7f7f7f7));
16662 rtx vec_const = gen_rtx_CONST_VECTOR (V4SImode, par);
16663 operands[5] = force_const_mem (V4SImode, vec_const);
16665 [(set_attr "mmx_isa" "native,sse_noavx,avx")
16666 (set_attr "prefix_extra" "1")
16667 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
16668 (set_attr "mode" "DI,TI,TI")])
16670 (define_insn "<ssse3_avx2>_psign<mode>3"
16671 [(set (match_operand:VI124_AVX2 0 "register_operand" "=x,x")
16673 [(match_operand:VI124_AVX2 1 "register_operand" "0,x")
16674 (match_operand:VI124_AVX2 2 "vector_operand" "xBm,xm")]
16678 psign<ssemodesuffix>\t{%2, %0|%0, %2}
16679 vpsign<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
16680 [(set_attr "isa" "noavx,avx")
16681 (set_attr "type" "sselog1")
16682 (set_attr "prefix_data16" "1,*")
16683 (set_attr "prefix_extra" "1")
16684 (set_attr "prefix" "orig,vex")
16685 (set_attr "mode" "<sseinsnmode>")])
16687 (define_insn "ssse3_psign<mode>3"
16688 [(set (match_operand:MMXMODEI 0 "register_operand" "=y,x,Yv")
16690 [(match_operand:MMXMODEI 1 "register_operand" "0,0,Yv")
16691 (match_operand:MMXMODEI 2 "register_mmxmem_operand" "ym,x,Yv")]
16693 "(TARGET_MMX || TARGET_MMX_WITH_SSE) && TARGET_SSSE3"
16695 psign<mmxvecsize>\t{%2, %0|%0, %2}
16696 psign<mmxvecsize>\t{%2, %0|%0, %2}
16697 vpsign<mmxvecsize>\t{%2, %1, %0|%0, %1, %2}"
16698 [(set_attr "isa" "*,noavx,avx")
16699 (set_attr "mmx_isa" "native,*,*")
16700 (set_attr "type" "sselog1")
16701 (set_attr "prefix_extra" "1")
16702 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
16703 (set_attr "mode" "DI,TI,TI")])
16705 (define_insn "<ssse3_avx2>_palignr<mode>_mask"
16706 [(set (match_operand:VI1_AVX512 0 "register_operand" "=v")
16707 (vec_merge:VI1_AVX512
16709 [(match_operand:VI1_AVX512 1 "register_operand" "v")
16710 (match_operand:VI1_AVX512 2 "nonimmediate_operand" "vm")
16711 (match_operand:SI 3 "const_0_to_255_mul_8_operand" "n")]
16713 (match_operand:VI1_AVX512 4 "nonimm_or_0_operand" "0C")
16714 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
16715 "TARGET_AVX512BW && (<MODE_SIZE> == 64 || TARGET_AVX512VL)"
16717 operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
16718 return "vpalignr\t{%3, %2, %1, %0%{%5%}%N4|%0%{%5%}%N4, %1, %2, %3}";
16720 [(set_attr "type" "sseishft")
16721 (set_attr "atom_unit" "sishuf")
16722 (set_attr "prefix_extra" "1")
16723 (set_attr "length_immediate" "1")
16724 (set_attr "prefix" "evex")
16725 (set_attr "mode" "<sseinsnmode>")])
16727 (define_insn "<ssse3_avx2>_palignr<mode>"
16728 [(set (match_operand:SSESCALARMODE 0 "register_operand" "=x,x,v")
16729 (unspec:SSESCALARMODE
16730 [(match_operand:SSESCALARMODE 1 "register_operand" "0,x,v")
16731 (match_operand:SSESCALARMODE 2 "vector_operand" "xBm,xm,vm")
16732 (match_operand:SI 3 "const_0_to_255_mul_8_operand" "n,n,n")]
16736 operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
16738 switch (which_alternative)
16741 return "palignr\t{%3, %2, %0|%0, %2, %3}";
16744 return "vpalignr\t{%3, %2, %1, %0|%0, %1, %2, %3}";
16746 gcc_unreachable ();
16749 [(set_attr "isa" "noavx,avx,avx512bw")
16750 (set_attr "type" "sseishft")
16751 (set_attr "atom_unit" "sishuf")
16752 (set_attr "prefix_data16" "1,*,*")
16753 (set_attr "prefix_extra" "1")
16754 (set_attr "length_immediate" "1")
16755 (set_attr "prefix" "orig,vex,evex")
16756 (set_attr "mode" "<sseinsnmode>")])
16758 (define_insn_and_split "ssse3_palignrdi"
16759 [(set (match_operand:DI 0 "register_operand" "=y,x,Yv")
16760 (unspec:DI [(match_operand:DI 1 "register_operand" "0,0,Yv")
16761 (match_operand:DI 2 "register_mmxmem_operand" "ym,x,Yv")
16762 (match_operand:SI 3 "const_0_to_255_mul_8_operand" "n,n,n")]
16764 "(TARGET_MMX || TARGET_MMX_WITH_SSE) && TARGET_SSSE3"
16766 switch (which_alternative)
16769 operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
16770 return "palignr\t{%3, %2, %0|%0, %2, %3}";
16775 gcc_unreachable ();
16778 "TARGET_SSSE3 && reload_completed
16779 && SSE_REGNO_P (REGNO (operands[0]))"
16780 [(set (match_dup 0)
16781 (lshiftrt:V1TI (match_dup 0) (match_dup 3)))]
16783 /* Emulate MMX palignrdi with SSE psrldq. */
16784 rtx op0 = lowpart_subreg (V2DImode, operands[0],
16785 GET_MODE (operands[0]));
16787 emit_insn (gen_vec_concatv2di (op0, operands[2], operands[1]));
16790 /* NB: SSE can only concatenate OP0 and OP1 to OP0. */
16791 emit_insn (gen_vec_concatv2di (op0, operands[1], operands[2]));
16792 /* Swap bits 0:63 with bits 64:127. */
16793 rtx mask = gen_rtx_PARALLEL (VOIDmode,
16794 gen_rtvec (4, GEN_INT (2),
16798 rtx op1 = lowpart_subreg (V4SImode, op0, GET_MODE (op0));
16799 rtx op2 = gen_rtx_VEC_SELECT (V4SImode, op1, mask);
16800 emit_insn (gen_rtx_SET (op1, op2));
16802 operands[0] = lowpart_subreg (V1TImode, op0, GET_MODE (op0));
16804 [(set_attr "mmx_isa" "native,sse_noavx,avx")
16805 (set_attr "type" "sseishft")
16806 (set_attr "atom_unit" "sishuf")
16807 (set_attr "prefix_extra" "1")
16808 (set_attr "length_immediate" "1")
16809 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
16810 (set_attr "mode" "DI,TI,TI")])
16812 ;; Mode iterator to handle singularity w/ absence of V2DI and V4DI
16813 ;; modes for abs instruction on pre AVX-512 targets.
16814 (define_mode_iterator VI1248_AVX512VL_AVX512BW
16815 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI
16816 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI
16817 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX2") V4SI
16818 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")])
16820 (define_insn "*abs<mode>2"
16821 [(set (match_operand:VI1248_AVX512VL_AVX512BW 0 "register_operand" "=v")
16822 (abs:VI1248_AVX512VL_AVX512BW
16823 (match_operand:VI1248_AVX512VL_AVX512BW 1 "vector_operand" "vBm")))]
16825 "%vpabs<ssemodesuffix>\t{%1, %0|%0, %1}"
16826 [(set_attr "type" "sselog1")
16827 (set_attr "prefix_data16" "1")
16828 (set_attr "prefix_extra" "1")
16829 (set_attr "prefix" "maybe_vex")
16830 (set_attr "mode" "<sseinsnmode>")])
16832 (define_insn "abs<mode>2_mask"
16833 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
16834 (vec_merge:VI48_AVX512VL
16836 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm"))
16837 (match_operand:VI48_AVX512VL 2 "nonimm_or_0_operand" "0C")
16838 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
16840 "vpabs<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
16841 [(set_attr "type" "sselog1")
16842 (set_attr "prefix" "evex")
16843 (set_attr "mode" "<sseinsnmode>")])
16845 (define_insn "abs<mode>2_mask"
16846 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
16847 (vec_merge:VI12_AVX512VL
16849 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "vm"))
16850 (match_operand:VI12_AVX512VL 2 "nonimm_or_0_operand" "0C")
16851 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
16853 "vpabs<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
16854 [(set_attr "type" "sselog1")
16855 (set_attr "prefix" "evex")
16856 (set_attr "mode" "<sseinsnmode>")])
16858 (define_expand "abs<mode>2"
16859 [(set (match_operand:VI_AVX2 0 "register_operand")
16861 (match_operand:VI_AVX2 1 "vector_operand")))]
16865 || ((<MODE>mode == V2DImode || <MODE>mode == V4DImode)
16866 && !TARGET_AVX512VL))
16868 ix86_expand_sse2_abs (operands[0], operands[1]);
16873 (define_insn "ssse3_abs<mode>2"
16874 [(set (match_operand:MMXMODEI 0 "register_operand" "=y,Yv")
16876 (match_operand:MMXMODEI 1 "register_mmxmem_operand" "ym,Yv")))]
16877 "(TARGET_MMX || TARGET_MMX_WITH_SSE) && TARGET_SSSE3"
16879 pabs<mmxvecsize>\t{%1, %0|%0, %1}
16880 %vpabs<mmxvecsize>\t{%1, %0|%0, %1}"
16881 [(set_attr "mmx_isa" "native,*")
16882 (set_attr "type" "sselog1")
16883 (set_attr "prefix_rep" "0")
16884 (set_attr "prefix_extra" "1")
16885 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
16886 (set_attr "mode" "DI,TI")])
16888 (define_insn "abs<mode>2"
16889 [(set (match_operand:MMXMODEI 0 "register_operand")
16891 (match_operand:MMXMODEI 1 "register_operand")))]
16892 "TARGET_MMX_WITH_SSE && TARGET_SSSE3")
16894 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16896 ;; AMD SSE4A instructions
16898 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16900 (define_insn "sse4a_movnt<mode>"
16901 [(set (match_operand:MODEF 0 "memory_operand" "=m")
16903 [(match_operand:MODEF 1 "register_operand" "x")]
16906 "movnt<ssemodesuffix>\t{%1, %0|%0, %1}"
16907 [(set_attr "type" "ssemov")
16908 (set_attr "mode" "<MODE>")])
16910 (define_insn "sse4a_vmmovnt<mode>"
16911 [(set (match_operand:<ssescalarmode> 0 "memory_operand" "=m")
16912 (unspec:<ssescalarmode>
16913 [(vec_select:<ssescalarmode>
16914 (match_operand:VF_128 1 "register_operand" "x")
16915 (parallel [(const_int 0)]))]
16918 "movnt<ssescalarmodesuffix>\t{%1, %0|%0, %1}"
16919 [(set_attr "type" "ssemov")
16920 (set_attr "mode" "<ssescalarmode>")])
16922 (define_insn "sse4a_extrqi"
16923 [(set (match_operand:V2DI 0 "register_operand" "=x")
16924 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
16925 (match_operand 2 "const_0_to_255_operand")
16926 (match_operand 3 "const_0_to_255_operand")]
16929 "extrq\t{%3, %2, %0|%0, %2, %3}"
16930 [(set_attr "type" "sse")
16931 (set_attr "prefix_data16" "1")
16932 (set_attr "length_immediate" "2")
16933 (set_attr "mode" "TI")])
16935 (define_insn "sse4a_extrq"
16936 [(set (match_operand:V2DI 0 "register_operand" "=x")
16937 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
16938 (match_operand:V16QI 2 "register_operand" "x")]
16941 "extrq\t{%2, %0|%0, %2}"
16942 [(set_attr "type" "sse")
16943 (set_attr "prefix_data16" "1")
16944 (set_attr "mode" "TI")])
16946 (define_insn "sse4a_insertqi"
16947 [(set (match_operand:V2DI 0 "register_operand" "=x")
16948 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
16949 (match_operand:V2DI 2 "register_operand" "x")
16950 (match_operand 3 "const_0_to_255_operand")
16951 (match_operand 4 "const_0_to_255_operand")]
16954 "insertq\t{%4, %3, %2, %0|%0, %2, %3, %4}"
16955 [(set_attr "type" "sseins")
16956 (set_attr "prefix_data16" "0")
16957 (set_attr "prefix_rep" "1")
16958 (set_attr "length_immediate" "2")
16959 (set_attr "mode" "TI")])
16961 (define_insn "sse4a_insertq"
16962 [(set (match_operand:V2DI 0 "register_operand" "=x")
16963 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
16964 (match_operand:V2DI 2 "register_operand" "x")]
16967 "insertq\t{%2, %0|%0, %2}"
16968 [(set_attr "type" "sseins")
16969 (set_attr "prefix_data16" "0")
16970 (set_attr "prefix_rep" "1")
16971 (set_attr "mode" "TI")])
16973 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16975 ;; Intel SSE4.1 instructions
16977 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16979 ;; Mapping of immediate bits for blend instructions
16980 (define_mode_attr blendbits
16981 [(V8SF "255") (V4SF "15") (V4DF "15") (V2DF "3")])
16983 (define_insn "<sse4_1>_blend<ssemodesuffix><avxsizesuffix>"
16984 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
16985 (vec_merge:VF_128_256
16986 (match_operand:VF_128_256 2 "vector_operand" "YrBm,*xBm,xm")
16987 (match_operand:VF_128_256 1 "register_operand" "0,0,x")
16988 (match_operand:SI 3 "const_0_to_<blendbits>_operand")))]
16991 blend<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
16992 blend<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
16993 vblend<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16994 [(set_attr "isa" "noavx,noavx,avx")
16995 (set_attr "type" "ssemov")
16996 (set_attr "length_immediate" "1")
16997 (set_attr "prefix_data16" "1,1,*")
16998 (set_attr "prefix_extra" "1")
16999 (set_attr "prefix" "orig,orig,vex")
17000 (set_attr "mode" "<MODE>")])
17002 (define_insn "<sse4_1>_blendv<ssemodesuffix><avxsizesuffix>"
17003 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
17005 [(match_operand:VF_128_256 1 "register_operand" "0,0,x")
17006 (match_operand:VF_128_256 2 "vector_operand" "YrBm,*xBm,xm")
17007 (match_operand:VF_128_256 3 "register_operand" "Yz,Yz,x")]
17011 blendv<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
17012 blendv<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
17013 vblendv<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
17014 [(set_attr "isa" "noavx,noavx,avx")
17015 (set_attr "type" "ssemov")
17016 (set_attr "length_immediate" "1")
17017 (set_attr "prefix_data16" "1,1,*")
17018 (set_attr "prefix_extra" "1")
17019 (set_attr "prefix" "orig,orig,vex")
17020 (set_attr "btver2_decode" "vector,vector,vector")
17021 (set_attr "mode" "<MODE>")])
17023 ;; Also define scalar versions. These are used for conditional move.
17024 ;; Using subregs into vector modes causes register allocation lossage.
17025 ;; These patterns do not allow memory operands because the native
17026 ;; instructions read the full 128-bits.
17028 (define_insn "sse4_1_blendv<ssemodesuffix>"
17029 [(set (match_operand:MODEF 0 "register_operand" "=Yr,*x,x")
17031 [(match_operand:MODEF 1 "register_operand" "0,0,x")
17032 (match_operand:MODEF 2 "register_operand" "Yr,*x,x")
17033 (match_operand:MODEF 3 "register_operand" "Yz,Yz,x")]
17037 if (get_attr_mode (insn) == MODE_V4SF)
17038 return (which_alternative == 2
17039 ? "vblendvps\t{%3, %2, %1, %0|%0, %1, %2, %3}"
17040 : "blendvps\t{%3, %2, %0|%0, %2, %3}");
17042 return (which_alternative == 2
17043 ? "vblendv<ssevecmodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
17044 : "blendv<ssevecmodesuffix>\t{%3, %2, %0|%0, %2, %3}");
17046 [(set_attr "isa" "noavx,noavx,avx")
17047 (set_attr "type" "ssemov")
17048 (set_attr "length_immediate" "1")
17049 (set_attr "prefix_data16" "1,1,*")
17050 (set_attr "prefix_extra" "1")
17051 (set_attr "prefix" "orig,orig,vex")
17052 (set_attr "btver2_decode" "vector,vector,vector")
17054 (cond [(match_test "TARGET_AVX")
17055 (const_string "<ssevecmode>")
17056 (match_test "optimize_function_for_size_p (cfun)")
17057 (const_string "V4SF")
17058 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
17059 (const_string "V4SF")
17061 (const_string "<ssevecmode>")))])
17063 (define_insn_and_split "*<sse4_1>_blendv<ssemodesuffix><avxsizesuffix>_lt"
17064 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
17066 [(match_operand:VF_128_256 1 "register_operand" "0,0,x")
17067 (match_operand:VF_128_256 2 "vector_operand" "YrBm,*xBm,xm")
17069 (match_operand:<sseintvecmode> 3 "register_operand" "Yz,Yz,x")
17070 (match_operand:<sseintvecmode> 4 "const0_operand" "C,C,C"))]
17074 "&& reload_completed"
17075 [(set (match_dup 0)
17077 [(match_dup 1) (match_dup 2) (match_dup 3)] UNSPEC_BLENDV))]
17078 "operands[3] = gen_lowpart (<MODE>mode, operands[3]);"
17079 [(set_attr "isa" "noavx,noavx,avx")
17080 (set_attr "type" "ssemov")
17081 (set_attr "length_immediate" "1")
17082 (set_attr "prefix_data16" "1,1,*")
17083 (set_attr "prefix_extra" "1")
17084 (set_attr "prefix" "orig,orig,vex")
17085 (set_attr "btver2_decode" "vector,vector,vector")
17086 (set_attr "mode" "<MODE>")])
17088 (define_mode_attr ssefltmodesuffix
17089 [(V2DI "pd") (V4DI "pd") (V4SI "ps") (V8SI "ps")])
17091 (define_mode_attr ssefltvecmode
17092 [(V2DI "V2DF") (V4DI "V4DF") (V4SI "V4SF") (V8SI "V8SF")])
17094 (define_insn_and_split "*<sse4_1>_blendv<ssefltmodesuffix><avxsizesuffix>_ltint"
17095 [(set (match_operand:<ssebytemode> 0 "register_operand" "=Yr,*x,x")
17096 (unspec:<ssebytemode>
17097 [(match_operand:<ssebytemode> 1 "register_operand" "0,0,x")
17098 (match_operand:<ssebytemode> 2 "vector_operand" "YrBm,*xBm,xm")
17099 (subreg:<ssebytemode>
17101 (match_operand:VI48_AVX 3 "register_operand" "Yz,Yz,x")
17102 (match_operand:VI48_AVX 4 "const0_operand" "C,C,C")) 0)]
17106 "&& reload_completed"
17107 [(set (match_dup 0)
17108 (unspec:<ssefltvecmode>
17109 [(match_dup 1) (match_dup 2) (match_dup 3)] UNSPEC_BLENDV))]
17111 operands[0] = gen_lowpart (<ssefltvecmode>mode, operands[0]);
17112 operands[1] = gen_lowpart (<ssefltvecmode>mode, operands[1]);
17113 operands[2] = gen_lowpart (<ssefltvecmode>mode, operands[2]);
17114 operands[3] = gen_lowpart (<ssefltvecmode>mode, operands[3]);
17116 [(set_attr "isa" "noavx,noavx,avx")
17117 (set_attr "type" "ssemov")
17118 (set_attr "length_immediate" "1")
17119 (set_attr "prefix_data16" "1,1,*")
17120 (set_attr "prefix_extra" "1")
17121 (set_attr "prefix" "orig,orig,vex")
17122 (set_attr "btver2_decode" "vector,vector,vector")
17123 (set_attr "mode" "<ssefltvecmode>")])
17125 (define_insn "<sse4_1>_dp<ssemodesuffix><avxsizesuffix>"
17126 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
17128 [(match_operand:VF_128_256 1 "vector_operand" "%0,0,x")
17129 (match_operand:VF_128_256 2 "vector_operand" "YrBm,*xBm,xm")
17130 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")]
17134 dp<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
17135 dp<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
17136 vdp<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
17137 [(set_attr "isa" "noavx,noavx,avx")
17138 (set_attr "type" "ssemul")
17139 (set_attr "length_immediate" "1")
17140 (set_attr "prefix_data16" "1,1,*")
17141 (set_attr "prefix_extra" "1")
17142 (set_attr "prefix" "orig,orig,vex")
17143 (set_attr "btver2_decode" "vector,vector,vector")
17144 (set_attr "znver1_decode" "vector,vector,vector")
17145 (set_attr "mode" "<MODE>")])
17147 ;; Mode attribute used by `vmovntdqa' pattern
17148 (define_mode_attr vi8_sse4_1_avx2_avx512
17149 [(V2DI "sse4_1") (V4DI "avx2") (V8DI "avx512f")])
17151 (define_insn "<vi8_sse4_1_avx2_avx512>_movntdqa"
17152 [(set (match_operand:VI8_AVX2_AVX512F 0 "register_operand" "=Yr,*x,v")
17153 (unspec:VI8_AVX2_AVX512F [(match_operand:VI8_AVX2_AVX512F 1 "memory_operand" "m,m,m")]
17156 "%vmovntdqa\t{%1, %0|%0, %1}"
17157 [(set_attr "isa" "noavx,noavx,avx")
17158 (set_attr "type" "ssemov")
17159 (set_attr "prefix_extra" "1,1,*")
17160 (set_attr "prefix" "orig,orig,maybe_evex")
17161 (set_attr "mode" "<sseinsnmode>")])
17163 (define_insn "<sse4_1_avx2>_mpsadbw"
17164 [(set (match_operand:VI1_AVX2 0 "register_operand" "=Yr,*x,x")
17166 [(match_operand:VI1_AVX2 1 "register_operand" "0,0,x")
17167 (match_operand:VI1_AVX2 2 "vector_operand" "YrBm,*xBm,xm")
17168 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")]
17172 mpsadbw\t{%3, %2, %0|%0, %2, %3}
17173 mpsadbw\t{%3, %2, %0|%0, %2, %3}
17174 vmpsadbw\t{%3, %2, %1, %0|%0, %1, %2, %3}"
17175 [(set_attr "isa" "noavx,noavx,avx")
17176 (set_attr "type" "sselog1")
17177 (set_attr "length_immediate" "1")
17178 (set_attr "prefix_extra" "1")
17179 (set_attr "prefix" "orig,orig,vex")
17180 (set_attr "btver2_decode" "vector,vector,vector")
17181 (set_attr "znver1_decode" "vector,vector,vector")
17182 (set_attr "mode" "<sseinsnmode>")])
17184 (define_insn "<sse4_1_avx2>_packusdw<mask_name>"
17185 [(set (match_operand:VI2_AVX2 0 "register_operand" "=Yr,*x,x,v")
17186 (vec_concat:VI2_AVX2
17187 (us_truncate:<ssehalfvecmode>
17188 (match_operand:<sseunpackmode> 1 "register_operand" "0,0,x,v"))
17189 (us_truncate:<ssehalfvecmode>
17190 (match_operand:<sseunpackmode> 2 "vector_operand" "YrBm,*xBm,xm,vm"))))]
17191 "TARGET_SSE4_1 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
17193 packusdw\t{%2, %0|%0, %2}
17194 packusdw\t{%2, %0|%0, %2}
17195 vpackusdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
17196 vpackusdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
17197 [(set_attr "isa" "noavx,noavx,avx,avx512bw")
17198 (set_attr "type" "sselog")
17199 (set_attr "prefix_extra" "1")
17200 (set_attr "prefix" "orig,orig,<mask_prefix>,evex")
17201 (set_attr "mode" "<sseinsnmode>")])
17203 (define_insn "<sse4_1_avx2>_pblendvb"
17204 [(set (match_operand:VI1_AVX2 0 "register_operand" "=Yr,*x,x")
17206 [(match_operand:VI1_AVX2 1 "register_operand" "0,0,x")
17207 (match_operand:VI1_AVX2 2 "vector_operand" "YrBm,*xBm,xm")
17208 (match_operand:VI1_AVX2 3 "register_operand" "Yz,Yz,x")]
17212 pblendvb\t{%3, %2, %0|%0, %2, %3}
17213 pblendvb\t{%3, %2, %0|%0, %2, %3}
17214 vpblendvb\t{%3, %2, %1, %0|%0, %1, %2, %3}"
17215 [(set_attr "isa" "noavx,noavx,avx")
17216 (set_attr "type" "ssemov")
17217 (set_attr "prefix_extra" "1")
17218 (set_attr "length_immediate" "*,*,1")
17219 (set_attr "prefix" "orig,orig,vex")
17220 (set_attr "btver2_decode" "vector,vector,vector")
17221 (set_attr "mode" "<sseinsnmode>")])
17223 (define_insn_and_split "*<sse4_1_avx2>_pblendvb_lt"
17224 [(set (match_operand:VI1_AVX2 0 "register_operand" "=Yr,*x,x")
17226 [(match_operand:VI1_AVX2 1 "register_operand" "0,0,x")
17227 (match_operand:VI1_AVX2 2 "vector_operand" "YrBm,*xBm,xm")
17228 (lt:VI1_AVX2 (match_operand:VI1_AVX2 3 "register_operand" "Yz,Yz,x")
17229 (match_operand:VI1_AVX2 4 "const0_operand" "C,C,C"))]
17234 [(set (match_dup 0)
17236 [(match_dup 1) (match_dup 2) (match_dup 3)] UNSPEC_BLENDV))]
17238 [(set_attr "isa" "noavx,noavx,avx")
17239 (set_attr "type" "ssemov")
17240 (set_attr "prefix_extra" "1")
17241 (set_attr "length_immediate" "*,*,1")
17242 (set_attr "prefix" "orig,orig,vex")
17243 (set_attr "btver2_decode" "vector,vector,vector")
17244 (set_attr "mode" "<sseinsnmode>")])
17246 (define_insn "sse4_1_pblendw"
17247 [(set (match_operand:V8HI 0 "register_operand" "=Yr,*x,x")
17249 (match_operand:V8HI 2 "vector_operand" "YrBm,*xBm,xm")
17250 (match_operand:V8HI 1 "register_operand" "0,0,x")
17251 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")))]
17254 pblendw\t{%3, %2, %0|%0, %2, %3}
17255 pblendw\t{%3, %2, %0|%0, %2, %3}
17256 vpblendw\t{%3, %2, %1, %0|%0, %1, %2, %3}"
17257 [(set_attr "isa" "noavx,noavx,avx")
17258 (set_attr "type" "ssemov")
17259 (set_attr "prefix_extra" "1")
17260 (set_attr "length_immediate" "1")
17261 (set_attr "prefix" "orig,orig,vex")
17262 (set_attr "mode" "TI")])
17264 ;; The builtin uses an 8-bit immediate. Expand that.
17265 (define_expand "avx2_pblendw"
17266 [(set (match_operand:V16HI 0 "register_operand")
17268 (match_operand:V16HI 2 "nonimmediate_operand")
17269 (match_operand:V16HI 1 "register_operand")
17270 (match_operand:SI 3 "const_0_to_255_operand")))]
17273 HOST_WIDE_INT val = INTVAL (operands[3]) & 0xff;
17274 operands[3] = GEN_INT (val << 8 | val);
17277 (define_insn "*avx2_pblendw"
17278 [(set (match_operand:V16HI 0 "register_operand" "=x")
17280 (match_operand:V16HI 2 "nonimmediate_operand" "xm")
17281 (match_operand:V16HI 1 "register_operand" "x")
17282 (match_operand:SI 3 "avx2_pblendw_operand" "n")))]
17285 operands[3] = GEN_INT (INTVAL (operands[3]) & 0xff);
17286 return "vpblendw\t{%3, %2, %1, %0|%0, %1, %2, %3}";
17288 [(set_attr "type" "ssemov")
17289 (set_attr "prefix_extra" "1")
17290 (set_attr "length_immediate" "1")
17291 (set_attr "prefix" "vex")
17292 (set_attr "mode" "OI")])
17294 (define_insn "avx2_pblendd<mode>"
17295 [(set (match_operand:VI4_AVX2 0 "register_operand" "=x")
17296 (vec_merge:VI4_AVX2
17297 (match_operand:VI4_AVX2 2 "nonimmediate_operand" "xm")
17298 (match_operand:VI4_AVX2 1 "register_operand" "x")
17299 (match_operand:SI 3 "const_0_to_255_operand" "n")))]
17301 "vpblendd\t{%3, %2, %1, %0|%0, %1, %2, %3}"
17302 [(set_attr "type" "ssemov")
17303 (set_attr "prefix_extra" "1")
17304 (set_attr "length_immediate" "1")
17305 (set_attr "prefix" "vex")
17306 (set_attr "mode" "<sseinsnmode>")])
17308 (define_insn "sse4_1_phminposuw"
17309 [(set (match_operand:V8HI 0 "register_operand" "=Yr,*x,x")
17310 (unspec:V8HI [(match_operand:V8HI 1 "vector_operand" "YrBm,*xBm,xm")]
17311 UNSPEC_PHMINPOSUW))]
17313 "%vphminposuw\t{%1, %0|%0, %1}"
17314 [(set_attr "isa" "noavx,noavx,avx")
17315 (set_attr "type" "sselog1")
17316 (set_attr "prefix_extra" "1")
17317 (set_attr "prefix" "orig,orig,vex")
17318 (set_attr "mode" "TI")])
17320 (define_insn "avx2_<code>v16qiv16hi2<mask_name>"
17321 [(set (match_operand:V16HI 0 "register_operand" "=v")
17323 (match_operand:V16QI 1 "nonimmediate_operand" "vm")))]
17324 "TARGET_AVX2 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
17325 "vpmov<extsuffix>bw\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17326 [(set_attr "type" "ssemov")
17327 (set_attr "prefix_extra" "1")
17328 (set_attr "prefix" "maybe_evex")
17329 (set_attr "mode" "OI")])
17331 (define_expand "<code>v16qiv16hi2"
17332 [(set (match_operand:V16HI 0 "register_operand")
17334 (match_operand:V16QI 1 "nonimmediate_operand")))]
17337 (define_insn "avx512bw_<code>v32qiv32hi2<mask_name>"
17338 [(set (match_operand:V32HI 0 "register_operand" "=v")
17340 (match_operand:V32QI 1 "nonimmediate_operand" "vm")))]
17342 "vpmov<extsuffix>bw\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17343 [(set_attr "type" "ssemov")
17344 (set_attr "prefix_extra" "1")
17345 (set_attr "prefix" "evex")
17346 (set_attr "mode" "XI")])
17348 (define_expand "<code>v32qiv32hi2"
17349 [(set (match_operand:V32HI 0 "register_operand")
17351 (match_operand:V32QI 1 "nonimmediate_operand")))]
17354 (define_insn "sse4_1_<code>v8qiv8hi2<mask_name>"
17355 [(set (match_operand:V8HI 0 "register_operand" "=Yr,*x,v")
17358 (match_operand:V16QI 1 "register_operand" "Yr,*x,v")
17359 (parallel [(const_int 0) (const_int 1)
17360 (const_int 2) (const_int 3)
17361 (const_int 4) (const_int 5)
17362 (const_int 6) (const_int 7)]))))]
17363 "TARGET_SSE4_1 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
17364 "%vpmov<extsuffix>bw\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17365 [(set_attr "isa" "noavx,noavx,avx")
17366 (set_attr "type" "ssemov")
17367 (set_attr "prefix_extra" "1")
17368 (set_attr "prefix" "orig,orig,maybe_evex")
17369 (set_attr "mode" "TI")])
17371 (define_insn "*sse4_1_<code>v8qiv8hi2<mask_name>_1"
17372 [(set (match_operand:V8HI 0 "register_operand" "=Yr,*x,v")
17374 (match_operand:V8QI 1 "memory_operand" "m,m,m")))]
17375 "TARGET_SSE4_1 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
17376 "%vpmov<extsuffix>bw\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17377 [(set_attr "isa" "noavx,noavx,avx")
17378 (set_attr "type" "ssemov")
17379 (set_attr "prefix_extra" "1")
17380 (set_attr "prefix" "orig,orig,maybe_evex")
17381 (set_attr "mode" "TI")])
17383 (define_insn_and_split "*sse4_1_<code>v8qiv8hi2<mask_name>_2"
17384 [(set (match_operand:V8HI 0 "register_operand")
17389 (match_operand:DI 1 "memory_operand")
17391 (parallel [(const_int 0) (const_int 1)
17392 (const_int 2) (const_int 3)
17393 (const_int 4) (const_int 5)
17394 (const_int 6) (const_int 7)]))))]
17395 "TARGET_SSE4_1 && <mask_avx512bw_condition> && <mask_avx512vl_condition>
17396 && ix86_pre_reload_split ()"
17399 [(set (match_dup 0)
17400 (any_extend:V8HI (match_dup 1)))]
17401 "operands[1] = adjust_address_nv (operands[1], V8QImode, 0);")
17403 (define_expand "<code>v8qiv8hi2"
17404 [(set (match_operand:V8HI 0 "register_operand")
17406 (match_operand:V8QI 1 "nonimmediate_operand")))]
17409 if (!MEM_P (operands[1]))
17411 operands[1] = simplify_gen_subreg (V16QImode, operands[1], V8QImode, 0);
17412 emit_insn (gen_sse4_1_<code>v8qiv8hi2 (operands[0], operands[1]));
17417 (define_insn "<mask_codefor>avx512f_<code>v16qiv16si2<mask_name>"
17418 [(set (match_operand:V16SI 0 "register_operand" "=v")
17420 (match_operand:V16QI 1 "nonimmediate_operand" "vm")))]
17422 "vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
17423 [(set_attr "type" "ssemov")
17424 (set_attr "prefix" "evex")
17425 (set_attr "mode" "XI")])
17427 (define_expand "<code>v16qiv16si2"
17428 [(set (match_operand:V16SI 0 "register_operand")
17430 (match_operand:V16QI 1 "nonimmediate_operand")))]
17433 (define_insn "avx2_<code>v8qiv8si2<mask_name>"
17434 [(set (match_operand:V8SI 0 "register_operand" "=v")
17437 (match_operand:V16QI 1 "register_operand" "v")
17438 (parallel [(const_int 0) (const_int 1)
17439 (const_int 2) (const_int 3)
17440 (const_int 4) (const_int 5)
17441 (const_int 6) (const_int 7)]))))]
17442 "TARGET_AVX2 && <mask_avx512vl_condition>"
17443 "vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17444 [(set_attr "type" "ssemov")
17445 (set_attr "prefix_extra" "1")
17446 (set_attr "prefix" "maybe_evex")
17447 (set_attr "mode" "OI")])
17449 (define_insn "*avx2_<code>v8qiv8si2<mask_name>_1"
17450 [(set (match_operand:V8SI 0 "register_operand" "=v")
17452 (match_operand:V8QI 1 "memory_operand" "m")))]
17453 "TARGET_AVX2 && <mask_avx512vl_condition>"
17454 "%vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17455 [(set_attr "type" "ssemov")
17456 (set_attr "prefix_extra" "1")
17457 (set_attr "prefix" "maybe_evex")
17458 (set_attr "mode" "OI")])
17460 (define_insn_and_split "*avx2_<code>v8qiv8si2<mask_name>_2"
17461 [(set (match_operand:V8SI 0 "register_operand")
17466 (match_operand:DI 1 "memory_operand")
17468 (parallel [(const_int 0) (const_int 1)
17469 (const_int 2) (const_int 3)
17470 (const_int 4) (const_int 5)
17471 (const_int 6) (const_int 7)]))))]
17472 "TARGET_AVX2 && <mask_avx512vl_condition>
17473 && ix86_pre_reload_split ()"
17476 [(set (match_dup 0)
17477 (any_extend:V8SI (match_dup 1)))]
17478 "operands[1] = adjust_address_nv (operands[1], V8QImode, 0);")
17480 (define_expand "<code>v8qiv8si2"
17481 [(set (match_operand:V8SI 0 "register_operand")
17483 (match_operand:V8QI 1 "nonimmediate_operand")))]
17486 if (!MEM_P (operands[1]))
17488 operands[1] = simplify_gen_subreg (V16QImode, operands[1], V8QImode, 0);
17489 emit_insn (gen_avx2_<code>v8qiv8si2 (operands[0], operands[1]));
17494 (define_insn "sse4_1_<code>v4qiv4si2<mask_name>"
17495 [(set (match_operand:V4SI 0 "register_operand" "=Yr,*x,v")
17498 (match_operand:V16QI 1 "register_operand" "Yr,*x,v")
17499 (parallel [(const_int 0) (const_int 1)
17500 (const_int 2) (const_int 3)]))))]
17501 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
17502 "%vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17503 [(set_attr "isa" "noavx,noavx,avx")
17504 (set_attr "type" "ssemov")
17505 (set_attr "prefix_extra" "1")
17506 (set_attr "prefix" "orig,orig,maybe_evex")
17507 (set_attr "mode" "TI")])
17509 (define_insn "*sse4_1_<code>v4qiv4si2<mask_name>_1"
17510 [(set (match_operand:V4SI 0 "register_operand" "=Yr,*x,v")
17512 (match_operand:V4QI 1 "memory_operand" "m,m,m")))]
17513 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
17514 "%vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17515 [(set_attr "isa" "noavx,noavx,avx")
17516 (set_attr "type" "ssemov")
17517 (set_attr "prefix_extra" "1")
17518 (set_attr "prefix" "orig,orig,maybe_evex")
17519 (set_attr "mode" "TI")])
17521 (define_insn_and_split "*sse4_1_<code>v4qiv4si2<mask_name>_2"
17522 [(set (match_operand:V4SI 0 "register_operand")
17527 (vec_duplicate:V4SI
17528 (match_operand:SI 1 "memory_operand"))
17530 [(const_int 0) (const_int 0)
17531 (const_int 0) (const_int 0)])
17533 (parallel [(const_int 0) (const_int 1)
17534 (const_int 2) (const_int 3)]))))]
17535 "TARGET_SSE4_1 && <mask_avx512vl_condition>
17536 && ix86_pre_reload_split ()"
17539 [(set (match_dup 0)
17540 (any_extend:V4SI (match_dup 1)))]
17541 "operands[1] = adjust_address_nv (operands[1], V4QImode, 0);")
17543 (define_expand "<code>v4qiv4si2"
17544 [(set (match_operand:V4SI 0 "register_operand")
17546 (match_operand:V4QI 1 "nonimmediate_operand")))]
17549 if (!MEM_P (operands[1]))
17551 operands[1] = simplify_gen_subreg (V16QImode, operands[1], V4QImode, 0);
17552 emit_insn (gen_sse4_1_<code>v4qiv4si2 (operands[0], operands[1]));
17557 (define_insn "avx512f_<code>v16hiv16si2<mask_name>"
17558 [(set (match_operand:V16SI 0 "register_operand" "=v")
17560 (match_operand:V16HI 1 "nonimmediate_operand" "vm")))]
17562 "vpmov<extsuffix>wd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17563 [(set_attr "type" "ssemov")
17564 (set_attr "prefix" "evex")
17565 (set_attr "mode" "XI")])
17567 (define_expand "<code>v16hiv16si2"
17568 [(set (match_operand:V16SI 0 "register_operand")
17570 (match_operand:V16HI 1 "nonimmediate_operand")))]
17573 (define_insn "avx2_<code>v8hiv8si2<mask_name>"
17574 [(set (match_operand:V8SI 0 "register_operand" "=v")
17576 (match_operand:V8HI 1 "nonimmediate_operand" "vm")))]
17577 "TARGET_AVX2 && <mask_avx512vl_condition>"
17578 "vpmov<extsuffix>wd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17579 [(set_attr "type" "ssemov")
17580 (set_attr "prefix_extra" "1")
17581 (set_attr "prefix" "maybe_evex")
17582 (set_attr "mode" "OI")])
17584 (define_expand "<code>v8hiv8si2"
17585 [(set (match_operand:V8SI 0 "register_operand")
17587 (match_operand:V8HI 1 "nonimmediate_operand")))]
17590 (define_insn "sse4_1_<code>v4hiv4si2<mask_name>"
17591 [(set (match_operand:V4SI 0 "register_operand" "=Yr,*x,v")
17594 (match_operand:V8HI 1 "register_operand" "Yr,*x,v")
17595 (parallel [(const_int 0) (const_int 1)
17596 (const_int 2) (const_int 3)]))))]
17597 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
17598 "%vpmov<extsuffix>wd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17599 [(set_attr "isa" "noavx,noavx,avx")
17600 (set_attr "type" "ssemov")
17601 (set_attr "prefix_extra" "1")
17602 (set_attr "prefix" "orig,orig,maybe_evex")
17603 (set_attr "mode" "TI")])
17605 (define_insn "*sse4_1_<code>v4hiv4si2<mask_name>_1"
17606 [(set (match_operand:V4SI 0 "register_operand" "=Yr,*x,v")
17608 (match_operand:V4HI 1 "memory_operand" "m,m,m")))]
17609 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
17610 "%vpmov<extsuffix>wd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17611 [(set_attr "isa" "noavx,noavx,avx")
17612 (set_attr "type" "ssemov")
17613 (set_attr "prefix_extra" "1")
17614 (set_attr "prefix" "orig,orig,maybe_evex")
17615 (set_attr "mode" "TI")])
17617 (define_insn_and_split "*sse4_1_<code>v4hiv4si2<mask_name>_2"
17618 [(set (match_operand:V4SI 0 "register_operand")
17623 (match_operand:DI 1 "memory_operand")
17625 (parallel [(const_int 0) (const_int 1)
17626 (const_int 2) (const_int 3)]))))]
17627 "TARGET_SSE4_1 && <mask_avx512vl_condition>
17628 && ix86_pre_reload_split ()"
17631 [(set (match_dup 0)
17632 (any_extend:V4SI (match_dup 1)))]
17633 "operands[1] = adjust_address_nv (operands[1], V4HImode, 0);")
17635 (define_expand "<code>v4hiv4si2"
17636 [(set (match_operand:V4SI 0 "register_operand")
17638 (match_operand:V4HI 1 "nonimmediate_operand")))]
17641 if (!MEM_P (operands[1]))
17643 operands[1] = simplify_gen_subreg (V8HImode, operands[1], V4HImode, 0);
17644 emit_insn (gen_sse4_1_<code>v4hiv4si2 (operands[0], operands[1]));
17649 (define_insn "avx512f_<code>v8qiv8di2<mask_name>"
17650 [(set (match_operand:V8DI 0 "register_operand" "=v")
17653 (match_operand:V16QI 1 "register_operand" "v")
17654 (parallel [(const_int 0) (const_int 1)
17655 (const_int 2) (const_int 3)
17656 (const_int 4) (const_int 5)
17657 (const_int 6) (const_int 7)]))))]
17659 "vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17660 [(set_attr "type" "ssemov")
17661 (set_attr "prefix" "evex")
17662 (set_attr "mode" "XI")])
17664 (define_insn "*avx512f_<code>v8qiv8di2<mask_name>_1"
17665 [(set (match_operand:V8DI 0 "register_operand" "=v")
17667 (match_operand:V8QI 1 "memory_operand" "m")))]
17669 "vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17670 [(set_attr "type" "ssemov")
17671 (set_attr "prefix" "evex")
17672 (set_attr "mode" "XI")])
17674 (define_insn_and_split "*avx512f_<code>v8qiv8di2<mask_name>_2"
17675 [(set (match_operand:V8DI 0 "register_operand")
17680 (match_operand:DI 1 "memory_operand")
17682 (parallel [(const_int 0) (const_int 1)
17683 (const_int 2) (const_int 3)
17684 (const_int 4) (const_int 5)
17685 (const_int 6) (const_int 7)]))))]
17686 "TARGET_AVX512F && ix86_pre_reload_split ()"
17689 [(set (match_dup 0)
17690 (any_extend:V8DI (match_dup 1)))]
17691 "operands[1] = adjust_address_nv (operands[1], V8QImode, 0);")
17693 (define_expand "<code>v8qiv8di2"
17694 [(set (match_operand:V8DI 0 "register_operand")
17696 (match_operand:V8QI 1 "nonimmediate_operand")))]
17699 if (!MEM_P (operands[1]))
17701 operands[1] = simplify_gen_subreg (V16QImode, operands[1], V8QImode, 0);
17702 emit_insn (gen_avx512f_<code>v8qiv8di2 (operands[0], operands[1]));
17707 (define_insn "avx2_<code>v4qiv4di2<mask_name>"
17708 [(set (match_operand:V4DI 0 "register_operand" "=v")
17711 (match_operand:V16QI 1 "register_operand" "v")
17712 (parallel [(const_int 0) (const_int 1)
17713 (const_int 2) (const_int 3)]))))]
17714 "TARGET_AVX2 && <mask_avx512vl_condition>"
17715 "vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17716 [(set_attr "type" "ssemov")
17717 (set_attr "prefix_extra" "1")
17718 (set_attr "prefix" "maybe_evex")
17719 (set_attr "mode" "OI")])
17721 (define_insn "*avx2_<code>v4qiv4di2<mask_name>_1"
17722 [(set (match_operand:V4DI 0 "register_operand" "=v")
17724 (match_operand:V4QI 1 "memory_operand" "m")))]
17725 "TARGET_AVX2 && <mask_avx512vl_condition>"
17726 "vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17727 [(set_attr "type" "ssemov")
17728 (set_attr "prefix_extra" "1")
17729 (set_attr "prefix" "maybe_evex")
17730 (set_attr "mode" "OI")])
17732 (define_insn_and_split "*avx2_<code>v4qiv4di2<mask_name>_2"
17733 [(set (match_operand:V4DI 0 "register_operand")
17738 (vec_duplicate:V4SI
17739 (match_operand:SI 1 "memory_operand"))
17741 [(const_int 0) (const_int 0)
17742 (const_int 0) (const_int 0)])
17744 (parallel [(const_int 0) (const_int 1)
17745 (const_int 2) (const_int 3)]))))]
17746 "TARGET_AVX2 && <mask_avx512vl_condition>
17747 && ix86_pre_reload_split ()"
17750 [(set (match_dup 0)
17751 (any_extend:V4DI (match_dup 1)))]
17752 "operands[1] = adjust_address_nv (operands[1], V4QImode, 0);")
17754 (define_expand "<code>v4qiv4di2"
17755 [(set (match_operand:V4DI 0 "register_operand")
17757 (match_operand:V4QI 1 "nonimmediate_operand")))]
17760 if (!MEM_P (operands[1]))
17762 operands[1] = simplify_gen_subreg (V16QImode, operands[1], V8QImode, 0);
17763 emit_insn (gen_avx2_<code>v4qiv4di2 (operands[0], operands[1]));
17768 (define_insn "sse4_1_<code>v2qiv2di2<mask_name>"
17769 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
17772 (match_operand:V16QI 1 "register_operand" "Yr,*x,v")
17773 (parallel [(const_int 0) (const_int 1)]))))]
17774 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
17775 "%vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17776 [(set_attr "isa" "noavx,noavx,avx")
17777 (set_attr "type" "ssemov")
17778 (set_attr "prefix_extra" "1")
17779 (set_attr "prefix" "orig,orig,maybe_evex")
17780 (set_attr "mode" "TI")])
17782 (define_expand "<code>v2qiv2di2"
17783 [(set (match_operand:V2DI 0 "register_operand")
17785 (match_operand:V2QI 1 "register_operand")))]
17788 operands[1] = simplify_gen_subreg (V16QImode, operands[1], V2QImode, 0);
17789 emit_insn (gen_sse4_1_<code>v2qiv2di2 (operands[0], operands[1]));
17793 (define_insn "avx512f_<code>v8hiv8di2<mask_name>"
17794 [(set (match_operand:V8DI 0 "register_operand" "=v")
17796 (match_operand:V8HI 1 "nonimmediate_operand" "vm")))]
17798 "vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
17799 [(set_attr "type" "ssemov")
17800 (set_attr "prefix" "evex")
17801 (set_attr "mode" "XI")])
17803 (define_expand "<code>v8hiv8di2"
17804 [(set (match_operand:V8DI 0 "register_operand")
17806 (match_operand:V8HI 1 "nonimmediate_operand")))]
17809 (define_insn "avx2_<code>v4hiv4di2<mask_name>"
17810 [(set (match_operand:V4DI 0 "register_operand" "=v")
17813 (match_operand:V8HI 1 "register_operand" "v")
17814 (parallel [(const_int 0) (const_int 1)
17815 (const_int 2) (const_int 3)]))))]
17816 "TARGET_AVX2 && <mask_avx512vl_condition>"
17817 "vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17818 [(set_attr "type" "ssemov")
17819 (set_attr "prefix_extra" "1")
17820 (set_attr "prefix" "maybe_evex")
17821 (set_attr "mode" "OI")])
17823 (define_insn "*avx2_<code>v4hiv4di2<mask_name>_1"
17824 [(set (match_operand:V4DI 0 "register_operand" "=v")
17826 (match_operand:V4HI 1 "memory_operand" "m")))]
17827 "TARGET_AVX2 && <mask_avx512vl_condition>"
17828 "vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17829 [(set_attr "type" "ssemov")
17830 (set_attr "prefix_extra" "1")
17831 (set_attr "prefix" "maybe_evex")
17832 (set_attr "mode" "OI")])
17834 (define_insn_and_split "*avx2_<code>v4hiv4di2<mask_name>_2"
17835 [(set (match_operand:V4DI 0 "register_operand")
17840 (match_operand:DI 1 "memory_operand")
17842 (parallel [(const_int 0) (const_int 1)
17843 (const_int 2) (const_int 3)]))))]
17844 "TARGET_AVX2 && <mask_avx512vl_condition>
17845 && ix86_pre_reload_split ()"
17848 [(set (match_dup 0)
17849 (any_extend:V4DI (match_dup 1)))]
17850 "operands[1] = adjust_address_nv (operands[1], V4HImode, 0);")
17852 (define_expand "<code>v4hiv4di2"
17853 [(set (match_operand:V4DI 0 "register_operand")
17855 (match_operand:V4HI 1 "nonimmediate_operand")))]
17858 if (!MEM_P (operands[1]))
17860 operands[1] = simplify_gen_subreg (V8HImode, operands[1], V4HImode, 0);
17861 emit_insn (gen_avx2_<code>v4hiv4di2 (operands[0], operands[1]));
17866 (define_insn "sse4_1_<code>v2hiv2di2<mask_name>"
17867 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
17870 (match_operand:V8HI 1 "register_operand" "Yr,*x,v")
17871 (parallel [(const_int 0) (const_int 1)]))))]
17872 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
17873 "%vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17874 [(set_attr "isa" "noavx,noavx,avx")
17875 (set_attr "type" "ssemov")
17876 (set_attr "prefix_extra" "1")
17877 (set_attr "prefix" "orig,orig,maybe_evex")
17878 (set_attr "mode" "TI")])
17880 (define_insn "*sse4_1_<code>v2hiv2di2<mask_name>_1"
17881 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
17883 (match_operand:V2HI 1 "memory_operand" "m,m,m")))]
17884 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
17885 "%vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17886 [(set_attr "isa" "noavx,noavx,avx")
17887 (set_attr "type" "ssemov")
17888 (set_attr "prefix_extra" "1")
17889 (set_attr "prefix" "orig,orig,maybe_evex")
17890 (set_attr "mode" "TI")])
17892 (define_insn_and_split "*sse4_1_<code>v2hiv2di2<mask_name>_2"
17893 [(set (match_operand:V2DI 0 "register_operand")
17898 (vec_duplicate:V4SI
17899 (match_operand:SI 1 "memory_operand"))
17901 [(const_int 0) (const_int 0)
17902 (const_int 0) (const_int 0)])
17904 (parallel [(const_int 0) (const_int 1)]))))]
17905 "TARGET_SSE4_1 && <mask_avx512vl_condition>
17906 && ix86_pre_reload_split ()"
17909 [(set (match_dup 0)
17910 (any_extend:V2DI (match_dup 1)))]
17911 "operands[1] = adjust_address_nv (operands[1], V2HImode, 0);")
17913 (define_expand "<code>v2hiv2di2"
17914 [(set (match_operand:V2DI 0 "register_operand")
17916 (match_operand:V2HI 1 "nonimmediate_operand")))]
17919 if (!MEM_P (operands[1]))
17921 operands[1] = simplify_gen_subreg (V8HImode, operands[1], V2HImode, 0);
17922 emit_insn (gen_sse4_1_<code>v2hiv2di2 (operands[0], operands[1]));
17927 (define_insn "avx512f_<code>v8siv8di2<mask_name>"
17928 [(set (match_operand:V8DI 0 "register_operand" "=v")
17930 (match_operand:V8SI 1 "nonimmediate_operand" "vm")))]
17932 "vpmov<extsuffix>dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17933 [(set_attr "type" "ssemov")
17934 (set_attr "prefix" "evex")
17935 (set_attr "mode" "XI")])
17937 (define_expand "<code>v8siv8di2"
17938 [(set (match_operand:V8DI 0 "register_operand" "=v")
17940 (match_operand:V8SI 1 "nonimmediate_operand" "vm")))]
17943 (define_insn "avx2_<code>v4siv4di2<mask_name>"
17944 [(set (match_operand:V4DI 0 "register_operand" "=v")
17946 (match_operand:V4SI 1 "nonimmediate_operand" "vm")))]
17947 "TARGET_AVX2 && <mask_avx512vl_condition>"
17948 "vpmov<extsuffix>dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17949 [(set_attr "type" "ssemov")
17950 (set_attr "prefix" "maybe_evex")
17951 (set_attr "prefix_extra" "1")
17952 (set_attr "mode" "OI")])
17954 (define_expand "<code>v4siv4di2"
17955 [(set (match_operand:V4DI 0 "register_operand" "=v")
17957 (match_operand:V4SI 1 "nonimmediate_operand" "vm")))]
17960 (define_insn "sse4_1_<code>v2siv2di2<mask_name>"
17961 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
17964 (match_operand:V4SI 1 "register_operand" "Yr,*x,v")
17965 (parallel [(const_int 0) (const_int 1)]))))]
17966 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
17967 "%vpmov<extsuffix>dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17968 [(set_attr "isa" "noavx,noavx,avx")
17969 (set_attr "type" "ssemov")
17970 (set_attr "prefix_extra" "1")
17971 (set_attr "prefix" "orig,orig,maybe_evex")
17972 (set_attr "mode" "TI")])
17974 (define_insn "*sse4_1_<code>v2siv2di2<mask_name>_1"
17975 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
17977 (match_operand:V2SI 1 "memory_operand" "m,m,m")))]
17978 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
17979 "%vpmov<extsuffix>dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17980 [(set_attr "isa" "noavx,noavx,avx")
17981 (set_attr "type" "ssemov")
17982 (set_attr "prefix_extra" "1")
17983 (set_attr "prefix" "orig,orig,maybe_evex")
17984 (set_attr "mode" "TI")])
17986 (define_insn_and_split "*sse4_1_<code>v2siv2di2<mask_name>_2"
17987 [(set (match_operand:V2DI 0 "register_operand")
17992 (match_operand:DI 1 "memory_operand")
17994 (parallel [(const_int 0) (const_int 1)]))))]
17995 "TARGET_SSE4_1 && <mask_avx512vl_condition>
17996 && ix86_pre_reload_split ()"
17999 [(set (match_dup 0)
18000 (any_extend:V2DI (match_dup 1)))]
18001 "operands[1] = adjust_address_nv (operands[1], V2SImode, 0);")
18003 (define_expand "<code>v2siv2di2"
18004 [(set (match_operand:V2DI 0 "register_operand")
18006 (match_operand:V2SI 1 "nonimmediate_operand")))]
18009 if (!MEM_P (operands[1]))
18011 operands[1] = simplify_gen_subreg (V4SImode, operands[1], V2SImode, 0);
18012 emit_insn (gen_sse4_1_<code>v2siv2di2 (operands[0], operands[1]));
18017 ;; ptestps/ptestpd are very similar to comiss and ucomiss when
18018 ;; setting FLAGS_REG. But it is not a really compare instruction.
18019 (define_insn "avx_vtest<ssemodesuffix><avxsizesuffix>"
18020 [(set (reg:CC FLAGS_REG)
18021 (unspec:CC [(match_operand:VF_128_256 0 "register_operand" "x")
18022 (match_operand:VF_128_256 1 "nonimmediate_operand" "xm")]
18025 "vtest<ssemodesuffix>\t{%1, %0|%0, %1}"
18026 [(set_attr "type" "ssecomi")
18027 (set_attr "prefix_extra" "1")
18028 (set_attr "prefix" "vex")
18029 (set_attr "mode" "<MODE>")])
18031 ;; ptest is very similar to comiss and ucomiss when setting FLAGS_REG.
18032 ;; But it is not a really compare instruction.
18033 (define_insn "<sse4_1>_ptest<mode>"
18034 [(set (reg:CC FLAGS_REG)
18035 (unspec:CC [(match_operand:V_AVX 0 "register_operand" "Yr, *x, x")
18036 (match_operand:V_AVX 1 "vector_operand" "YrBm, *xBm, xm")]
18039 "%vptest\t{%1, %0|%0, %1}"
18040 [(set_attr "isa" "noavx,noavx,avx")
18041 (set_attr "type" "ssecomi")
18042 (set_attr "prefix_extra" "1")
18043 (set_attr "prefix" "orig,orig,vex")
18044 (set (attr "btver2_decode")
18046 (match_test "<sseinsnmode>mode==OImode")
18047 (const_string "vector")
18048 (const_string "*")))
18049 (set_attr "mode" "<sseinsnmode>")])
18051 (define_insn "ptesttf2"
18052 [(set (reg:CC FLAGS_REG)
18053 (unspec:CC [(match_operand:TF 0 "register_operand" "Yr, *x, x")
18054 (match_operand:TF 1 "vector_operand" "YrBm, *xBm, xm")]
18057 "%vptest\t{%1, %0|%0, %1}"
18058 [(set_attr "isa" "noavx,noavx,avx")
18059 (set_attr "type" "ssecomi")
18060 (set_attr "prefix_extra" "1")
18061 (set_attr "prefix" "orig,orig,vex")
18062 (set_attr "mode" "TI")])
18064 (define_expand "nearbyint<mode>2"
18065 [(set (match_operand:VF 0 "register_operand")
18067 [(match_operand:VF 1 "vector_operand")
18071 "operands[2] = GEN_INT (ROUND_MXCSR | ROUND_NO_EXC);")
18073 (define_expand "rint<mode>2"
18074 [(set (match_operand:VF 0 "register_operand")
18076 [(match_operand:VF 1 "vector_operand")
18080 "operands[2] = GEN_INT (ROUND_MXCSR);")
18082 (define_insn "<sse4_1>_round<ssemodesuffix><avxsizesuffix>"
18083 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
18085 [(match_operand:VF_128_256 1 "vector_operand" "YrBm,*xBm,xm")
18086 (match_operand:SI 2 "const_0_to_15_operand" "n,n,n")]
18089 "%vround<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
18090 [(set_attr "isa" "noavx,noavx,avx")
18091 (set_attr "type" "ssecvt")
18092 (set_attr "prefix_data16" "1,1,*")
18093 (set_attr "prefix_extra" "1")
18094 (set_attr "length_immediate" "1")
18095 (set_attr "prefix" "orig,orig,vex")
18096 (set_attr "mode" "<MODE>")])
18098 (define_expand "<sse4_1>_round<ssemodesuffix>_sfix<avxsizesuffix>"
18099 [(match_operand:<sseintvecmode> 0 "register_operand")
18100 (match_operand:VF1_128_256 1 "vector_operand")
18101 (match_operand:SI 2 "const_0_to_15_operand")]
18104 rtx tmp = gen_reg_rtx (<MODE>mode);
18107 (gen_<sse4_1>_round<ssemodesuffix><avxsizesuffix> (tmp, operands[1],
18110 (gen_fix_trunc<mode><sseintvecmodelower>2 (operands[0], tmp));
18114 (define_expand "avx512f_round<castmode>512"
18115 [(match_operand:VF_512 0 "register_operand")
18116 (match_operand:VF_512 1 "nonimmediate_operand")
18117 (match_operand:SI 2 "const_0_to_15_operand")]
18120 emit_insn (gen_avx512f_rndscale<mode> (operands[0], operands[1], operands[2]));
18124 (define_expand "avx512f_roundps512_sfix"
18125 [(match_operand:V16SI 0 "register_operand")
18126 (match_operand:V16SF 1 "nonimmediate_operand")
18127 (match_operand:SI 2 "const_0_to_15_operand")]
18130 rtx tmp = gen_reg_rtx (V16SFmode);
18131 emit_insn (gen_avx512f_rndscalev16sf (tmp, operands[1], operands[2]));
18132 emit_insn (gen_fix_truncv16sfv16si2 (operands[0], tmp));
18136 (define_expand "<sse4_1>_round<ssemodesuffix>_vec_pack_sfix<avxsizesuffix>"
18137 [(match_operand:<ssepackfltmode> 0 "register_operand")
18138 (match_operand:VF2 1 "vector_operand")
18139 (match_operand:VF2 2 "vector_operand")
18140 (match_operand:SI 3 "const_0_to_15_operand")]
18145 if (<MODE>mode == V2DFmode
18146 && TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
18148 rtx tmp2 = gen_reg_rtx (V4DFmode);
18150 tmp0 = gen_reg_rtx (V4DFmode);
18151 tmp1 = force_reg (V2DFmode, operands[1]);
18153 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
18154 emit_insn (gen_avx_roundpd256 (tmp2, tmp0, operands[3]));
18155 emit_insn (gen_fix_truncv4dfv4si2 (operands[0], tmp2));
18159 tmp0 = gen_reg_rtx (<MODE>mode);
18160 tmp1 = gen_reg_rtx (<MODE>mode);
18163 (gen_<sse4_1>_round<ssemodesuffix><avxsizesuffix> (tmp0, operands[1],
18166 (gen_<sse4_1>_round<ssemodesuffix><avxsizesuffix> (tmp1, operands[2],
18169 (gen_vec_pack_sfix_trunc_<mode> (operands[0], tmp0, tmp1));
18174 (define_insn "sse4_1_round<ssescalarmodesuffix>"
18175 [(set (match_operand:VF_128 0 "register_operand" "=Yr,*x,x,v")
18178 [(match_operand:VF_128 2 "nonimmediate_operand" "Yrm,*xm,xm,vm")
18179 (match_operand:SI 3 "const_0_to_15_operand" "n,n,n,n")]
18181 (match_operand:VF_128 1 "register_operand" "0,0,x,v")
18185 round<ssescalarmodesuffix>\t{%3, %2, %0|%0, %<iptr>2, %3}
18186 round<ssescalarmodesuffix>\t{%3, %2, %0|%0, %<iptr>2, %3}
18187 vround<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %3}
18188 vrndscale<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %3}"
18189 [(set_attr "isa" "noavx,noavx,avx,avx512f")
18190 (set_attr "type" "ssecvt")
18191 (set_attr "length_immediate" "1")
18192 (set_attr "prefix_data16" "1,1,*,*")
18193 (set_attr "prefix_extra" "1")
18194 (set_attr "prefix" "orig,orig,vex,evex")
18195 (set_attr "mode" "<MODE>")])
18197 (define_insn "*sse4_1_round<ssescalarmodesuffix>"
18198 [(set (match_operand:VF_128 0 "register_operand" "=Yr,*x,x,v")
18200 (vec_duplicate:VF_128
18201 (unspec:<ssescalarmode>
18202 [(match_operand:<ssescalarmode> 2 "nonimmediate_operand" "Yrm,*xm,xm,vm")
18203 (match_operand:SI 3 "const_0_to_15_operand" "n,n,n,n")]
18205 (match_operand:VF_128 1 "register_operand" "0,0,x,v")
18209 round<ssescalarmodesuffix>\t{%3, %2, %0|%0, %2, %3}
18210 round<ssescalarmodesuffix>\t{%3, %2, %0|%0, %2, %3}
18211 vround<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
18212 vrndscale<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
18213 [(set_attr "isa" "noavx,noavx,avx,avx512f")
18214 (set_attr "type" "ssecvt")
18215 (set_attr "length_immediate" "1")
18216 (set_attr "prefix_data16" "1,1,*,*")
18217 (set_attr "prefix_extra" "1")
18218 (set_attr "prefix" "orig,orig,vex,evex")
18219 (set_attr "mode" "<MODE>")])
18221 (define_expand "round<mode>2"
18222 [(set (match_dup 3)
18224 (match_operand:VF 1 "register_operand")
18226 (set (match_operand:VF 0 "register_operand")
18228 [(match_dup 3) (match_dup 4)]
18230 "TARGET_SSE4_1 && !flag_trapping_math"
18232 machine_mode scalar_mode;
18233 const struct real_format *fmt;
18234 REAL_VALUE_TYPE pred_half, half_minus_pred_half;
18235 rtx half, vec_half;
18237 scalar_mode = GET_MODE_INNER (<MODE>mode);
18239 /* load nextafter (0.5, 0.0) */
18240 fmt = REAL_MODE_FORMAT (scalar_mode);
18241 real_2expN (&half_minus_pred_half, -(fmt->p) - 1, scalar_mode);
18242 real_arithmetic (&pred_half, MINUS_EXPR, &dconsthalf, &half_minus_pred_half);
18243 half = const_double_from_real_value (pred_half, scalar_mode);
18245 vec_half = ix86_build_const_vector (<MODE>mode, true, half);
18246 vec_half = force_reg (<MODE>mode, vec_half);
18248 operands[2] = gen_reg_rtx (<MODE>mode);
18249 emit_insn (gen_copysign<mode>3 (operands[2], vec_half, operands[1]));
18251 operands[3] = gen_reg_rtx (<MODE>mode);
18252 operands[4] = GEN_INT (ROUND_TRUNC);
18255 (define_expand "round<mode>2_sfix"
18256 [(match_operand:<sseintvecmode> 0 "register_operand")
18257 (match_operand:VF1 1 "register_operand")]
18258 "TARGET_SSE4_1 && !flag_trapping_math"
18260 rtx tmp = gen_reg_rtx (<MODE>mode);
18262 emit_insn (gen_round<mode>2 (tmp, operands[1]));
18265 (gen_fix_trunc<mode><sseintvecmodelower>2 (operands[0], tmp));
18269 (define_expand "round<mode>2_vec_pack_sfix"
18270 [(match_operand:<ssepackfltmode> 0 "register_operand")
18271 (match_operand:VF2 1 "register_operand")
18272 (match_operand:VF2 2 "register_operand")]
18273 "TARGET_SSE4_1 && !flag_trapping_math"
18277 if (<MODE>mode == V2DFmode
18278 && TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
18280 rtx tmp2 = gen_reg_rtx (V4DFmode);
18282 tmp0 = gen_reg_rtx (V4DFmode);
18283 tmp1 = force_reg (V2DFmode, operands[1]);
18285 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
18286 emit_insn (gen_roundv4df2 (tmp2, tmp0));
18287 emit_insn (gen_fix_truncv4dfv4si2 (operands[0], tmp2));
18291 tmp0 = gen_reg_rtx (<MODE>mode);
18292 tmp1 = gen_reg_rtx (<MODE>mode);
18294 emit_insn (gen_round<mode>2 (tmp0, operands[1]));
18295 emit_insn (gen_round<mode>2 (tmp1, operands[2]));
18298 (gen_vec_pack_sfix_trunc_<mode> (operands[0], tmp0, tmp1));
18303 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
18305 ;; Intel SSE4.2 string/text processing instructions
18307 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
18309 (define_insn_and_split "sse4_2_pcmpestr"
18310 [(set (match_operand:SI 0 "register_operand" "=c,c")
18312 [(match_operand:V16QI 2 "register_operand" "x,x")
18313 (match_operand:SI 3 "register_operand" "a,a")
18314 (match_operand:V16QI 4 "nonimmediate_operand" "x,m")
18315 (match_operand:SI 5 "register_operand" "d,d")
18316 (match_operand:SI 6 "const_0_to_255_operand" "n,n")]
18318 (set (match_operand:V16QI 1 "register_operand" "=Yz,Yz")
18326 (set (reg:CC FLAGS_REG)
18335 && ix86_pre_reload_split ()"
18340 int ecx = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[0]));
18341 int xmm0 = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[1]));
18342 int flags = !find_regno_note (curr_insn, REG_UNUSED, FLAGS_REG);
18345 emit_insn (gen_sse4_2_pcmpestri (operands[0], operands[2],
18346 operands[3], operands[4],
18347 operands[5], operands[6]));
18349 emit_insn (gen_sse4_2_pcmpestrm (operands[1], operands[2],
18350 operands[3], operands[4],
18351 operands[5], operands[6]));
18352 if (flags && !(ecx || xmm0))
18353 emit_insn (gen_sse4_2_pcmpestr_cconly (NULL, NULL,
18354 operands[2], operands[3],
18355 operands[4], operands[5],
18357 if (!(flags || ecx || xmm0))
18358 emit_note (NOTE_INSN_DELETED);
18362 [(set_attr "type" "sselog")
18363 (set_attr "prefix_data16" "1")
18364 (set_attr "prefix_extra" "1")
18365 (set_attr "length_immediate" "1")
18366 (set_attr "memory" "none,load")
18367 (set_attr "mode" "TI")])
18369 (define_insn "sse4_2_pcmpestri"
18370 [(set (match_operand:SI 0 "register_operand" "=c,c")
18372 [(match_operand:V16QI 1 "register_operand" "x,x")
18373 (match_operand:SI 2 "register_operand" "a,a")
18374 (match_operand:V16QI 3 "nonimmediate_operand" "x,m")
18375 (match_operand:SI 4 "register_operand" "d,d")
18376 (match_operand:SI 5 "const_0_to_255_operand" "n,n")]
18378 (set (reg:CC FLAGS_REG)
18387 "%vpcmpestri\t{%5, %3, %1|%1, %3, %5}"
18388 [(set_attr "type" "sselog")
18389 (set_attr "prefix_data16" "1")
18390 (set_attr "prefix_extra" "1")
18391 (set_attr "prefix" "maybe_vex")
18392 (set_attr "length_immediate" "1")
18393 (set_attr "btver2_decode" "vector")
18394 (set_attr "memory" "none,load")
18395 (set_attr "mode" "TI")])
18397 (define_insn "sse4_2_pcmpestrm"
18398 [(set (match_operand:V16QI 0 "register_operand" "=Yz,Yz")
18400 [(match_operand:V16QI 1 "register_operand" "x,x")
18401 (match_operand:SI 2 "register_operand" "a,a")
18402 (match_operand:V16QI 3 "nonimmediate_operand" "x,m")
18403 (match_operand:SI 4 "register_operand" "d,d")
18404 (match_operand:SI 5 "const_0_to_255_operand" "n,n")]
18406 (set (reg:CC FLAGS_REG)
18415 "%vpcmpestrm\t{%5, %3, %1|%1, %3, %5}"
18416 [(set_attr "type" "sselog")
18417 (set_attr "prefix_data16" "1")
18418 (set_attr "prefix_extra" "1")
18419 (set_attr "length_immediate" "1")
18420 (set_attr "prefix" "maybe_vex")
18421 (set_attr "btver2_decode" "vector")
18422 (set_attr "memory" "none,load")
18423 (set_attr "mode" "TI")])
18425 (define_insn "sse4_2_pcmpestr_cconly"
18426 [(set (reg:CC FLAGS_REG)
18428 [(match_operand:V16QI 2 "register_operand" "x,x,x,x")
18429 (match_operand:SI 3 "register_operand" "a,a,a,a")
18430 (match_operand:V16QI 4 "nonimmediate_operand" "x,m,x,m")
18431 (match_operand:SI 5 "register_operand" "d,d,d,d")
18432 (match_operand:SI 6 "const_0_to_255_operand" "n,n,n,n")]
18434 (clobber (match_scratch:V16QI 0 "=Yz,Yz,X,X"))
18435 (clobber (match_scratch:SI 1 "= X, X,c,c"))]
18438 %vpcmpestrm\t{%6, %4, %2|%2, %4, %6}
18439 %vpcmpestrm\t{%6, %4, %2|%2, %4, %6}
18440 %vpcmpestri\t{%6, %4, %2|%2, %4, %6}
18441 %vpcmpestri\t{%6, %4, %2|%2, %4, %6}"
18442 [(set_attr "type" "sselog")
18443 (set_attr "prefix_data16" "1")
18444 (set_attr "prefix_extra" "1")
18445 (set_attr "length_immediate" "1")
18446 (set_attr "memory" "none,load,none,load")
18447 (set_attr "btver2_decode" "vector,vector,vector,vector")
18448 (set_attr "prefix" "maybe_vex")
18449 (set_attr "mode" "TI")])
18451 (define_insn_and_split "sse4_2_pcmpistr"
18452 [(set (match_operand:SI 0 "register_operand" "=c,c")
18454 [(match_operand:V16QI 2 "register_operand" "x,x")
18455 (match_operand:V16QI 3 "nonimmediate_operand" "x,m")
18456 (match_operand:SI 4 "const_0_to_255_operand" "n,n")]
18458 (set (match_operand:V16QI 1 "register_operand" "=Yz,Yz")
18464 (set (reg:CC FLAGS_REG)
18471 && ix86_pre_reload_split ()"
18476 int ecx = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[0]));
18477 int xmm0 = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[1]));
18478 int flags = !find_regno_note (curr_insn, REG_UNUSED, FLAGS_REG);
18481 emit_insn (gen_sse4_2_pcmpistri (operands[0], operands[2],
18482 operands[3], operands[4]));
18484 emit_insn (gen_sse4_2_pcmpistrm (operands[1], operands[2],
18485 operands[3], operands[4]));
18486 if (flags && !(ecx || xmm0))
18487 emit_insn (gen_sse4_2_pcmpistr_cconly (NULL, NULL,
18488 operands[2], operands[3],
18490 if (!(flags || ecx || xmm0))
18491 emit_note (NOTE_INSN_DELETED);
18495 [(set_attr "type" "sselog")
18496 (set_attr "prefix_data16" "1")
18497 (set_attr "prefix_extra" "1")
18498 (set_attr "length_immediate" "1")
18499 (set_attr "memory" "none,load")
18500 (set_attr "mode" "TI")])
18502 (define_insn "sse4_2_pcmpistri"
18503 [(set (match_operand:SI 0 "register_operand" "=c,c")
18505 [(match_operand:V16QI 1 "register_operand" "x,x")
18506 (match_operand:V16QI 2 "nonimmediate_operand" "x,m")
18507 (match_operand:SI 3 "const_0_to_255_operand" "n,n")]
18509 (set (reg:CC FLAGS_REG)
18516 "%vpcmpistri\t{%3, %2, %1|%1, %2, %3}"
18517 [(set_attr "type" "sselog")
18518 (set_attr "prefix_data16" "1")
18519 (set_attr "prefix_extra" "1")
18520 (set_attr "length_immediate" "1")
18521 (set_attr "prefix" "maybe_vex")
18522 (set_attr "memory" "none,load")
18523 (set_attr "btver2_decode" "vector")
18524 (set_attr "mode" "TI")])
18526 (define_insn "sse4_2_pcmpistrm"
18527 [(set (match_operand:V16QI 0 "register_operand" "=Yz,Yz")
18529 [(match_operand:V16QI 1 "register_operand" "x,x")
18530 (match_operand:V16QI 2 "nonimmediate_operand" "x,m")
18531 (match_operand:SI 3 "const_0_to_255_operand" "n,n")]
18533 (set (reg:CC FLAGS_REG)
18540 "%vpcmpistrm\t{%3, %2, %1|%1, %2, %3}"
18541 [(set_attr "type" "sselog")
18542 (set_attr "prefix_data16" "1")
18543 (set_attr "prefix_extra" "1")
18544 (set_attr "length_immediate" "1")
18545 (set_attr "prefix" "maybe_vex")
18546 (set_attr "memory" "none,load")
18547 (set_attr "btver2_decode" "vector")
18548 (set_attr "mode" "TI")])
18550 (define_insn "sse4_2_pcmpistr_cconly"
18551 [(set (reg:CC FLAGS_REG)
18553 [(match_operand:V16QI 2 "register_operand" "x,x,x,x")
18554 (match_operand:V16QI 3 "nonimmediate_operand" "x,m,x,m")
18555 (match_operand:SI 4 "const_0_to_255_operand" "n,n,n,n")]
18557 (clobber (match_scratch:V16QI 0 "=Yz,Yz,X,X"))
18558 (clobber (match_scratch:SI 1 "= X, X,c,c"))]
18561 %vpcmpistrm\t{%4, %3, %2|%2, %3, %4}
18562 %vpcmpistrm\t{%4, %3, %2|%2, %3, %4}
18563 %vpcmpistri\t{%4, %3, %2|%2, %3, %4}
18564 %vpcmpistri\t{%4, %3, %2|%2, %3, %4}"
18565 [(set_attr "type" "sselog")
18566 (set_attr "prefix_data16" "1")
18567 (set_attr "prefix_extra" "1")
18568 (set_attr "length_immediate" "1")
18569 (set_attr "memory" "none,load,none,load")
18570 (set_attr "prefix" "maybe_vex")
18571 (set_attr "btver2_decode" "vector,vector,vector,vector")
18572 (set_attr "mode" "TI")])
18574 ;; Packed float variants
18575 (define_mode_attr GATHER_SCATTER_SF_MEM_MODE
18576 [(V8DI "V8SF") (V16SI "V16SF")])
18578 (define_expand "avx512pf_gatherpf<mode>sf"
18580 [(match_operand:<avx512fmaskmode> 0 "register_operand")
18581 (mem:<GATHER_SCATTER_SF_MEM_MODE>
18583 [(match_operand 2 "vsib_address_operand")
18584 (match_operand:VI48_512 1 "register_operand")
18585 (match_operand:SI 3 "const1248_operand")]))
18586 (match_operand:SI 4 "const_2_to_3_operand")]
18587 UNSPEC_GATHER_PREFETCH)]
18591 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
18592 operands[3]), UNSPEC_VSIBADDR);
18595 (define_insn "*avx512pf_gatherpf<VI48_512:mode>sf_mask"
18597 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
18598 (match_operator:<GATHER_SCATTER_SF_MEM_MODE> 5 "vsib_mem_operator"
18600 [(match_operand:P 2 "vsib_address_operand" "Tv")
18601 (match_operand:VI48_512 1 "register_operand" "v")
18602 (match_operand:SI 3 "const1248_operand" "n")]
18604 (match_operand:SI 4 "const_2_to_3_operand" "n")]
18605 UNSPEC_GATHER_PREFETCH)]
18608 switch (INTVAL (operands[4]))
18611 /* %X5 so that we don't emit any *WORD PTR for -masm=intel, as
18612 gas changed what it requires incompatibly. */
18613 return "%M2vgatherpf0<ssemodesuffix>ps\t{%5%{%0%}|%X5%{%0%}}";
18615 return "%M2vgatherpf1<ssemodesuffix>ps\t{%5%{%0%}|%X5%{%0%}}";
18617 gcc_unreachable ();
18620 [(set_attr "type" "sse")
18621 (set_attr "prefix" "evex")
18622 (set_attr "mode" "XI")])
18624 ;; Packed double variants
18625 (define_expand "avx512pf_gatherpf<mode>df"
18627 [(match_operand:<avx512fmaskmode> 0 "register_operand")
18630 [(match_operand 2 "vsib_address_operand")
18631 (match_operand:VI4_256_8_512 1 "register_operand")
18632 (match_operand:SI 3 "const1248_operand")]))
18633 (match_operand:SI 4 "const_2_to_3_operand")]
18634 UNSPEC_GATHER_PREFETCH)]
18638 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
18639 operands[3]), UNSPEC_VSIBADDR);
18642 (define_insn "*avx512pf_gatherpf<VI4_256_8_512:mode>df_mask"
18644 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
18645 (match_operator:V8DF 5 "vsib_mem_operator"
18647 [(match_operand:P 2 "vsib_address_operand" "Tv")
18648 (match_operand:VI4_256_8_512 1 "register_operand" "v")
18649 (match_operand:SI 3 "const1248_operand" "n")]
18651 (match_operand:SI 4 "const_2_to_3_operand" "n")]
18652 UNSPEC_GATHER_PREFETCH)]
18655 switch (INTVAL (operands[4]))
18658 /* %X5 so that we don't emit any *WORD PTR for -masm=intel, as
18659 gas changed what it requires incompatibly. */
18660 return "%M2vgatherpf0<ssemodesuffix>pd\t{%5%{%0%}|%X5%{%0%}}";
18662 return "%M2vgatherpf1<ssemodesuffix>pd\t{%5%{%0%}|%X5%{%0%}}";
18664 gcc_unreachable ();
18667 [(set_attr "type" "sse")
18668 (set_attr "prefix" "evex")
18669 (set_attr "mode" "XI")])
18671 ;; Packed float variants
18672 (define_expand "avx512pf_scatterpf<mode>sf"
18674 [(match_operand:<avx512fmaskmode> 0 "register_operand")
18675 (mem:<GATHER_SCATTER_SF_MEM_MODE>
18677 [(match_operand 2 "vsib_address_operand")
18678 (match_operand:VI48_512 1 "register_operand")
18679 (match_operand:SI 3 "const1248_operand")]))
18680 (match_operand:SI 4 "const2367_operand")]
18681 UNSPEC_SCATTER_PREFETCH)]
18685 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
18686 operands[3]), UNSPEC_VSIBADDR);
18689 (define_insn "*avx512pf_scatterpf<VI48_512:mode>sf_mask"
18691 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
18692 (match_operator:<GATHER_SCATTER_SF_MEM_MODE> 5 "vsib_mem_operator"
18694 [(match_operand:P 2 "vsib_address_operand" "Tv")
18695 (match_operand:VI48_512 1 "register_operand" "v")
18696 (match_operand:SI 3 "const1248_operand" "n")]
18698 (match_operand:SI 4 "const2367_operand" "n")]
18699 UNSPEC_SCATTER_PREFETCH)]
18702 switch (INTVAL (operands[4]))
18706 /* %X5 so that we don't emit any *WORD PTR for -masm=intel, as
18707 gas changed what it requires incompatibly. */
18708 return "%M2vscatterpf0<ssemodesuffix>ps\t{%5%{%0%}|%X5%{%0%}}";
18711 return "%M2vscatterpf1<ssemodesuffix>ps\t{%5%{%0%}|%X5%{%0%}}";
18713 gcc_unreachable ();
18716 [(set_attr "type" "sse")
18717 (set_attr "prefix" "evex")
18718 (set_attr "mode" "XI")])
18720 ;; Packed double variants
18721 (define_expand "avx512pf_scatterpf<mode>df"
18723 [(match_operand:<avx512fmaskmode> 0 "register_operand")
18726 [(match_operand 2 "vsib_address_operand")
18727 (match_operand:VI4_256_8_512 1 "register_operand")
18728 (match_operand:SI 3 "const1248_operand")]))
18729 (match_operand:SI 4 "const2367_operand")]
18730 UNSPEC_SCATTER_PREFETCH)]
18734 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
18735 operands[3]), UNSPEC_VSIBADDR);
18738 (define_insn "*avx512pf_scatterpf<VI4_256_8_512:mode>df_mask"
18740 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
18741 (match_operator:V8DF 5 "vsib_mem_operator"
18743 [(match_operand:P 2 "vsib_address_operand" "Tv")
18744 (match_operand:VI4_256_8_512 1 "register_operand" "v")
18745 (match_operand:SI 3 "const1248_operand" "n")]
18747 (match_operand:SI 4 "const2367_operand" "n")]
18748 UNSPEC_SCATTER_PREFETCH)]
18751 switch (INTVAL (operands[4]))
18755 /* %X5 so that we don't emit any *WORD PTR for -masm=intel, as
18756 gas changed what it requires incompatibly. */
18757 return "%M2vscatterpf0<ssemodesuffix>pd\t{%5%{%0%}|%X5%{%0%}}";
18760 return "%M2vscatterpf1<ssemodesuffix>pd\t{%5%{%0%}|%X5%{%0%}}";
18762 gcc_unreachable ();
18765 [(set_attr "type" "sse")
18766 (set_attr "prefix" "evex")
18767 (set_attr "mode" "XI")])
18769 (define_insn "avx512er_exp2<mode><mask_name><round_saeonly_name>"
18770 [(set (match_operand:VF_512 0 "register_operand" "=v")
18772 [(match_operand:VF_512 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
18775 "vexp2<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
18776 [(set_attr "prefix" "evex")
18777 (set_attr "type" "sse")
18778 (set_attr "mode" "<MODE>")])
18780 (define_insn "<mask_codefor>avx512er_rcp28<mode><mask_name><round_saeonly_name>"
18781 [(set (match_operand:VF_512 0 "register_operand" "=v")
18783 [(match_operand:VF_512 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
18786 "vrcp28<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
18787 [(set_attr "prefix" "evex")
18788 (set_attr "type" "sse")
18789 (set_attr "mode" "<MODE>")])
18791 (define_insn "avx512er_vmrcp28<mode><round_saeonly_name>"
18792 [(set (match_operand:VF_128 0 "register_operand" "=v")
18795 [(match_operand:VF_128 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")]
18797 (match_operand:VF_128 2 "register_operand" "v")
18800 "vrcp28<ssescalarmodesuffix>\t{<round_saeonly_op3>%1, %2, %0|%0, %2, %<iptr>1<round_saeonly_op3>}"
18801 [(set_attr "length_immediate" "1")
18802 (set_attr "prefix" "evex")
18803 (set_attr "type" "sse")
18804 (set_attr "mode" "<MODE>")])
18806 (define_insn "<mask_codefor>avx512er_rsqrt28<mode><mask_name><round_saeonly_name>"
18807 [(set (match_operand:VF_512 0 "register_operand" "=v")
18809 [(match_operand:VF_512 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
18812 "vrsqrt28<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
18813 [(set_attr "prefix" "evex")
18814 (set_attr "type" "sse")
18815 (set_attr "mode" "<MODE>")])
18817 (define_insn "avx512er_vmrsqrt28<mode><round_saeonly_name>"
18818 [(set (match_operand:VF_128 0 "register_operand" "=v")
18821 [(match_operand:VF_128 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")]
18823 (match_operand:VF_128 2 "register_operand" "v")
18826 "vrsqrt28<ssescalarmodesuffix>\t{<round_saeonly_op3>%1, %2, %0|%0, %2, %<iptr>1<round_saeonly_op3>}"
18827 [(set_attr "length_immediate" "1")
18828 (set_attr "type" "sse")
18829 (set_attr "prefix" "evex")
18830 (set_attr "mode" "<MODE>")])
18832 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
18834 ;; XOP instructions
18836 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
18838 (define_code_iterator xop_plus [plus ss_plus])
18840 (define_code_attr macs [(plus "macs") (ss_plus "macss")])
18841 (define_code_attr madcs [(plus "madcs") (ss_plus "madcss")])
18843 ;; XOP parallel integer multiply/add instructions.
18845 (define_insn "xop_p<macs><ssemodesuffix><ssemodesuffix>"
18846 [(set (match_operand:VI24_128 0 "register_operand" "=x")
18849 (match_operand:VI24_128 1 "nonimmediate_operand" "%x")
18850 (match_operand:VI24_128 2 "nonimmediate_operand" "xm"))
18851 (match_operand:VI24_128 3 "register_operand" "x")))]
18853 "vp<macs><ssemodesuffix><ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
18854 [(set_attr "type" "ssemuladd")
18855 (set_attr "mode" "TI")])
18857 (define_insn "xop_p<macs>dql"
18858 [(set (match_operand:V2DI 0 "register_operand" "=x")
18863 (match_operand:V4SI 1 "nonimmediate_operand" "%x")
18864 (parallel [(const_int 0) (const_int 2)])))
18867 (match_operand:V4SI 2 "nonimmediate_operand" "xm")
18868 (parallel [(const_int 0) (const_int 2)]))))
18869 (match_operand:V2DI 3 "register_operand" "x")))]
18871 "vp<macs>dql\t{%3, %2, %1, %0|%0, %1, %2, %3}"
18872 [(set_attr "type" "ssemuladd")
18873 (set_attr "mode" "TI")])
18875 (define_insn "xop_p<macs>dqh"
18876 [(set (match_operand:V2DI 0 "register_operand" "=x")
18881 (match_operand:V4SI 1 "nonimmediate_operand" "%x")
18882 (parallel [(const_int 1) (const_int 3)])))
18885 (match_operand:V4SI 2 "nonimmediate_operand" "xm")
18886 (parallel [(const_int 1) (const_int 3)]))))
18887 (match_operand:V2DI 3 "register_operand" "x")))]
18889 "vp<macs>dqh\t{%3, %2, %1, %0|%0, %1, %2, %3}"
18890 [(set_attr "type" "ssemuladd")
18891 (set_attr "mode" "TI")])
18893 ;; XOP parallel integer multiply/add instructions for the intrinisics
18894 (define_insn "xop_p<macs>wd"
18895 [(set (match_operand:V4SI 0 "register_operand" "=x")
18900 (match_operand:V8HI 1 "nonimmediate_operand" "%x")
18901 (parallel [(const_int 1) (const_int 3)
18902 (const_int 5) (const_int 7)])))
18905 (match_operand:V8HI 2 "nonimmediate_operand" "xm")
18906 (parallel [(const_int 1) (const_int 3)
18907 (const_int 5) (const_int 7)]))))
18908 (match_operand:V4SI 3 "register_operand" "x")))]
18910 "vp<macs>wd\t{%3, %2, %1, %0|%0, %1, %2, %3}"
18911 [(set_attr "type" "ssemuladd")
18912 (set_attr "mode" "TI")])
18914 (define_insn "xop_p<madcs>wd"
18915 [(set (match_operand:V4SI 0 "register_operand" "=x")
18921 (match_operand:V8HI 1 "nonimmediate_operand" "%x")
18922 (parallel [(const_int 0) (const_int 2)
18923 (const_int 4) (const_int 6)])))
18926 (match_operand:V8HI 2 "nonimmediate_operand" "xm")
18927 (parallel [(const_int 0) (const_int 2)
18928 (const_int 4) (const_int 6)]))))
18933 (parallel [(const_int 1) (const_int 3)
18934 (const_int 5) (const_int 7)])))
18938 (parallel [(const_int 1) (const_int 3)
18939 (const_int 5) (const_int 7)])))))
18940 (match_operand:V4SI 3 "register_operand" "x")))]
18942 "vp<madcs>wd\t{%3, %2, %1, %0|%0, %1, %2, %3}"
18943 [(set_attr "type" "ssemuladd")
18944 (set_attr "mode" "TI")])
18946 ;; XOP parallel XMM conditional moves
18947 (define_insn "xop_pcmov_<mode><avxsizesuffix>"
18948 [(set (match_operand:V_128_256 0 "register_operand" "=x,x")
18949 (if_then_else:V_128_256
18950 (match_operand:V_128_256 3 "nonimmediate_operand" "x,m")
18951 (match_operand:V_128_256 1 "register_operand" "x,x")
18952 (match_operand:V_128_256 2 "nonimmediate_operand" "xm,x")))]
18954 "vpcmov\t{%3, %2, %1, %0|%0, %1, %2, %3}"
18955 [(set_attr "type" "sse4arg")])
18957 ;; XOP horizontal add/subtract instructions
18958 (define_insn "xop_phadd<u>bw"
18959 [(set (match_operand:V8HI 0 "register_operand" "=x")
18963 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
18964 (parallel [(const_int 0) (const_int 2)
18965 (const_int 4) (const_int 6)
18966 (const_int 8) (const_int 10)
18967 (const_int 12) (const_int 14)])))
18971 (parallel [(const_int 1) (const_int 3)
18972 (const_int 5) (const_int 7)
18973 (const_int 9) (const_int 11)
18974 (const_int 13) (const_int 15)])))))]
18976 "vphadd<u>bw\t{%1, %0|%0, %1}"
18977 [(set_attr "type" "sseiadd1")])
18979 (define_insn "xop_phadd<u>bd"
18980 [(set (match_operand:V4SI 0 "register_operand" "=x")
18985 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
18986 (parallel [(const_int 0) (const_int 4)
18987 (const_int 8) (const_int 12)])))
18991 (parallel [(const_int 1) (const_int 5)
18992 (const_int 9) (const_int 13)]))))
18997 (parallel [(const_int 2) (const_int 6)
18998 (const_int 10) (const_int 14)])))
19002 (parallel [(const_int 3) (const_int 7)
19003 (const_int 11) (const_int 15)]))))))]
19005 "vphadd<u>bd\t{%1, %0|%0, %1}"
19006 [(set_attr "type" "sseiadd1")])
19008 (define_insn "xop_phadd<u>bq"
19009 [(set (match_operand:V2DI 0 "register_operand" "=x")
19015 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
19016 (parallel [(const_int 0) (const_int 8)])))
19020 (parallel [(const_int 1) (const_int 9)]))))
19025 (parallel [(const_int 2) (const_int 10)])))
19029 (parallel [(const_int 3) (const_int 11)])))))
19035 (parallel [(const_int 4) (const_int 12)])))
19039 (parallel [(const_int 5) (const_int 13)]))))
19044 (parallel [(const_int 6) (const_int 14)])))
19048 (parallel [(const_int 7) (const_int 15)])))))))]
19050 "vphadd<u>bq\t{%1, %0|%0, %1}"
19051 [(set_attr "type" "sseiadd1")])
19053 (define_insn "xop_phadd<u>wd"
19054 [(set (match_operand:V4SI 0 "register_operand" "=x")
19058 (match_operand:V8HI 1 "nonimmediate_operand" "xm")
19059 (parallel [(const_int 0) (const_int 2)
19060 (const_int 4) (const_int 6)])))
19064 (parallel [(const_int 1) (const_int 3)
19065 (const_int 5) (const_int 7)])))))]
19067 "vphadd<u>wd\t{%1, %0|%0, %1}"
19068 [(set_attr "type" "sseiadd1")])
19070 (define_insn "xop_phadd<u>wq"
19071 [(set (match_operand:V2DI 0 "register_operand" "=x")
19076 (match_operand:V8HI 1 "nonimmediate_operand" "xm")
19077 (parallel [(const_int 0) (const_int 4)])))
19081 (parallel [(const_int 1) (const_int 5)]))))
19086 (parallel [(const_int 2) (const_int 6)])))
19090 (parallel [(const_int 3) (const_int 7)]))))))]
19092 "vphadd<u>wq\t{%1, %0|%0, %1}"
19093 [(set_attr "type" "sseiadd1")])
19095 (define_insn "xop_phadd<u>dq"
19096 [(set (match_operand:V2DI 0 "register_operand" "=x")
19100 (match_operand:V4SI 1 "nonimmediate_operand" "xm")
19101 (parallel [(const_int 0) (const_int 2)])))
19105 (parallel [(const_int 1) (const_int 3)])))))]
19107 "vphadd<u>dq\t{%1, %0|%0, %1}"
19108 [(set_attr "type" "sseiadd1")])
19110 (define_insn "xop_phsubbw"
19111 [(set (match_operand:V8HI 0 "register_operand" "=x")
19115 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
19116 (parallel [(const_int 0) (const_int 2)
19117 (const_int 4) (const_int 6)
19118 (const_int 8) (const_int 10)
19119 (const_int 12) (const_int 14)])))
19123 (parallel [(const_int 1) (const_int 3)
19124 (const_int 5) (const_int 7)
19125 (const_int 9) (const_int 11)
19126 (const_int 13) (const_int 15)])))))]
19128 "vphsubbw\t{%1, %0|%0, %1}"
19129 [(set_attr "type" "sseiadd1")])
19131 (define_insn "xop_phsubwd"
19132 [(set (match_operand:V4SI 0 "register_operand" "=x")
19136 (match_operand:V8HI 1 "nonimmediate_operand" "xm")
19137 (parallel [(const_int 0) (const_int 2)
19138 (const_int 4) (const_int 6)])))
19142 (parallel [(const_int 1) (const_int 3)
19143 (const_int 5) (const_int 7)])))))]
19145 "vphsubwd\t{%1, %0|%0, %1}"
19146 [(set_attr "type" "sseiadd1")])
19148 (define_insn "xop_phsubdq"
19149 [(set (match_operand:V2DI 0 "register_operand" "=x")
19153 (match_operand:V4SI 1 "nonimmediate_operand" "xm")
19154 (parallel [(const_int 0) (const_int 2)])))
19158 (parallel [(const_int 1) (const_int 3)])))))]
19160 "vphsubdq\t{%1, %0|%0, %1}"
19161 [(set_attr "type" "sseiadd1")])
19163 ;; XOP permute instructions
19164 (define_insn "xop_pperm"
19165 [(set (match_operand:V16QI 0 "register_operand" "=x,x")
19167 [(match_operand:V16QI 1 "register_operand" "x,x")
19168 (match_operand:V16QI 2 "nonimmediate_operand" "x,m")
19169 (match_operand:V16QI 3 "nonimmediate_operand" "xm,x")]
19170 UNSPEC_XOP_PERMUTE))]
19171 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
19172 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
19173 [(set_attr "type" "sse4arg")
19174 (set_attr "mode" "TI")])
19176 ;; XOP pack instructions that combine two vectors into a smaller vector
19177 (define_insn "xop_pperm_pack_v2di_v4si"
19178 [(set (match_operand:V4SI 0 "register_operand" "=x,x")
19181 (match_operand:V2DI 1 "register_operand" "x,x"))
19183 (match_operand:V2DI 2 "nonimmediate_operand" "x,m"))))
19184 (use (match_operand:V16QI 3 "nonimmediate_operand" "xm,x"))]
19185 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
19186 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
19187 [(set_attr "type" "sse4arg")
19188 (set_attr "mode" "TI")])
19190 (define_insn "xop_pperm_pack_v4si_v8hi"
19191 [(set (match_operand:V8HI 0 "register_operand" "=x,x")
19194 (match_operand:V4SI 1 "register_operand" "x,x"))
19196 (match_operand:V4SI 2 "nonimmediate_operand" "x,m"))))
19197 (use (match_operand:V16QI 3 "nonimmediate_operand" "xm,x"))]
19198 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
19199 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
19200 [(set_attr "type" "sse4arg")
19201 (set_attr "mode" "TI")])
19203 (define_insn "xop_pperm_pack_v8hi_v16qi"
19204 [(set (match_operand:V16QI 0 "register_operand" "=x,x")
19207 (match_operand:V8HI 1 "register_operand" "x,x"))
19209 (match_operand:V8HI 2 "nonimmediate_operand" "x,m"))))
19210 (use (match_operand:V16QI 3 "nonimmediate_operand" "xm,x"))]
19211 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
19212 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
19213 [(set_attr "type" "sse4arg")
19214 (set_attr "mode" "TI")])
19216 ;; XOP packed rotate instructions
19217 (define_expand "rotl<mode>3"
19218 [(set (match_operand:VI_128 0 "register_operand")
19220 (match_operand:VI_128 1 "nonimmediate_operand")
19221 (match_operand:SI 2 "general_operand")))]
19224 /* If we were given a scalar, convert it to parallel */
19225 if (! const_0_to_<sserotatemax>_operand (operands[2], SImode))
19227 rtvec vs = rtvec_alloc (<ssescalarnum>);
19228 rtx par = gen_rtx_PARALLEL (<MODE>mode, vs);
19229 rtx reg = gen_reg_rtx (<MODE>mode);
19230 rtx op2 = operands[2];
19233 if (GET_MODE (op2) != <ssescalarmode>mode)
19235 op2 = gen_reg_rtx (<ssescalarmode>mode);
19236 convert_move (op2, operands[2], false);
19239 for (i = 0; i < <ssescalarnum>; i++)
19240 RTVEC_ELT (vs, i) = op2;
19242 emit_insn (gen_vec_init<mode><ssescalarmodelower> (reg, par));
19243 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], reg));
19248 (define_expand "rotr<mode>3"
19249 [(set (match_operand:VI_128 0 "register_operand")
19251 (match_operand:VI_128 1 "nonimmediate_operand")
19252 (match_operand:SI 2 "general_operand")))]
19255 /* If we were given a scalar, convert it to parallel */
19256 if (! const_0_to_<sserotatemax>_operand (operands[2], SImode))
19258 rtvec vs = rtvec_alloc (<ssescalarnum>);
19259 rtx par = gen_rtx_PARALLEL (<MODE>mode, vs);
19260 rtx neg = gen_reg_rtx (<MODE>mode);
19261 rtx reg = gen_reg_rtx (<MODE>mode);
19262 rtx op2 = operands[2];
19265 if (GET_MODE (op2) != <ssescalarmode>mode)
19267 op2 = gen_reg_rtx (<ssescalarmode>mode);
19268 convert_move (op2, operands[2], false);
19271 for (i = 0; i < <ssescalarnum>; i++)
19272 RTVEC_ELT (vs, i) = op2;
19274 emit_insn (gen_vec_init<mode><ssescalarmodelower> (reg, par));
19275 emit_insn (gen_neg<mode>2 (neg, reg));
19276 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], neg));
19281 (define_insn "xop_rotl<mode>3"
19282 [(set (match_operand:VI_128 0 "register_operand" "=x")
19284 (match_operand:VI_128 1 "nonimmediate_operand" "xm")
19285 (match_operand:SI 2 "const_0_to_<sserotatemax>_operand" "n")))]
19287 "vprot<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
19288 [(set_attr "type" "sseishft")
19289 (set_attr "length_immediate" "1")
19290 (set_attr "mode" "TI")])
19292 (define_insn "xop_rotr<mode>3"
19293 [(set (match_operand:VI_128 0 "register_operand" "=x")
19295 (match_operand:VI_128 1 "nonimmediate_operand" "xm")
19296 (match_operand:SI 2 "const_0_to_<sserotatemax>_operand" "n")))]
19300 = GEN_INT (GET_MODE_BITSIZE (<ssescalarmode>mode) - INTVAL (operands[2]));
19301 return \"vprot<ssemodesuffix>\t{%3, %1, %0|%0, %1, %3}\";
19303 [(set_attr "type" "sseishft")
19304 (set_attr "length_immediate" "1")
19305 (set_attr "mode" "TI")])
19307 (define_expand "vrotr<mode>3"
19308 [(match_operand:VI_128 0 "register_operand")
19309 (match_operand:VI_128 1 "register_operand")
19310 (match_operand:VI_128 2 "register_operand")]
19313 rtx reg = gen_reg_rtx (<MODE>mode);
19314 emit_insn (gen_neg<mode>2 (reg, operands[2]));
19315 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], reg));
19319 (define_expand "vrotl<mode>3"
19320 [(match_operand:VI_128 0 "register_operand")
19321 (match_operand:VI_128 1 "register_operand")
19322 (match_operand:VI_128 2 "register_operand")]
19325 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], operands[2]));
19329 (define_insn "xop_vrotl<mode>3"
19330 [(set (match_operand:VI_128 0 "register_operand" "=x,x")
19331 (if_then_else:VI_128
19333 (match_operand:VI_128 2 "nonimmediate_operand" "x,m")
19336 (match_operand:VI_128 1 "nonimmediate_operand" "xm,x")
19340 (neg:VI_128 (match_dup 2)))))]
19341 "TARGET_XOP && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
19342 "vprot<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
19343 [(set_attr "type" "sseishft")
19344 (set_attr "prefix_data16" "0")
19345 (set_attr "prefix_extra" "2")
19346 (set_attr "mode" "TI")])
19348 ;; XOP packed shift instructions.
19349 (define_expand "vlshr<mode>3"
19350 [(set (match_operand:VI12_128 0 "register_operand")
19352 (match_operand:VI12_128 1 "register_operand")
19353 (match_operand:VI12_128 2 "nonimmediate_operand")))]
19356 rtx neg = gen_reg_rtx (<MODE>mode);
19357 emit_insn (gen_neg<mode>2 (neg, operands[2]));
19358 emit_insn (gen_xop_shl<mode>3 (operands[0], operands[1], neg));
19362 (define_expand "vlshr<mode>3"
19363 [(set (match_operand:VI48_128 0 "register_operand")
19365 (match_operand:VI48_128 1 "register_operand")
19366 (match_operand:VI48_128 2 "nonimmediate_operand")))]
19367 "TARGET_AVX2 || TARGET_XOP"
19371 rtx neg = gen_reg_rtx (<MODE>mode);
19372 emit_insn (gen_neg<mode>2 (neg, operands[2]));
19373 emit_insn (gen_xop_shl<mode>3 (operands[0], operands[1], neg));
19378 (define_expand "vlshr<mode>3"
19379 [(set (match_operand:VI48_512 0 "register_operand")
19381 (match_operand:VI48_512 1 "register_operand")
19382 (match_operand:VI48_512 2 "nonimmediate_operand")))]
19385 (define_expand "vlshr<mode>3"
19386 [(set (match_operand:VI48_256 0 "register_operand")
19388 (match_operand:VI48_256 1 "register_operand")
19389 (match_operand:VI48_256 2 "nonimmediate_operand")))]
19392 (define_expand "vashrv8hi3<mask_name>"
19393 [(set (match_operand:V8HI 0 "register_operand")
19395 (match_operand:V8HI 1 "register_operand")
19396 (match_operand:V8HI 2 "nonimmediate_operand")))]
19397 "TARGET_XOP || (TARGET_AVX512BW && TARGET_AVX512VL)"
19401 rtx neg = gen_reg_rtx (V8HImode);
19402 emit_insn (gen_negv8hi2 (neg, operands[2]));
19403 emit_insn (gen_xop_shav8hi3 (operands[0], operands[1], neg));
19408 (define_expand "vashrv16qi3"
19409 [(set (match_operand:V16QI 0 "register_operand")
19411 (match_operand:V16QI 1 "register_operand")
19412 (match_operand:V16QI 2 "nonimmediate_operand")))]
19415 rtx neg = gen_reg_rtx (V16QImode);
19416 emit_insn (gen_negv16qi2 (neg, operands[2]));
19417 emit_insn (gen_xop_shav16qi3 (operands[0], operands[1], neg));
19421 (define_expand "vashrv2di3<mask_name>"
19422 [(set (match_operand:V2DI 0 "register_operand")
19424 (match_operand:V2DI 1 "register_operand")
19425 (match_operand:V2DI 2 "nonimmediate_operand")))]
19426 "TARGET_XOP || TARGET_AVX512VL"
19430 rtx neg = gen_reg_rtx (V2DImode);
19431 emit_insn (gen_negv2di2 (neg, operands[2]));
19432 emit_insn (gen_xop_shav2di3 (operands[0], operands[1], neg));
19437 (define_expand "vashrv4si3"
19438 [(set (match_operand:V4SI 0 "register_operand")
19439 (ashiftrt:V4SI (match_operand:V4SI 1 "register_operand")
19440 (match_operand:V4SI 2 "nonimmediate_operand")))]
19441 "TARGET_AVX2 || TARGET_XOP"
19445 rtx neg = gen_reg_rtx (V4SImode);
19446 emit_insn (gen_negv4si2 (neg, operands[2]));
19447 emit_insn (gen_xop_shav4si3 (operands[0], operands[1], neg));
19452 (define_expand "vashrv16si3"
19453 [(set (match_operand:V16SI 0 "register_operand")
19454 (ashiftrt:V16SI (match_operand:V16SI 1 "register_operand")
19455 (match_operand:V16SI 2 "nonimmediate_operand")))]
19458 (define_expand "vashrv8si3"
19459 [(set (match_operand:V8SI 0 "register_operand")
19460 (ashiftrt:V8SI (match_operand:V8SI 1 "register_operand")
19461 (match_operand:V8SI 2 "nonimmediate_operand")))]
19464 (define_expand "vashl<mode>3"
19465 [(set (match_operand:VI12_128 0 "register_operand")
19467 (match_operand:VI12_128 1 "register_operand")
19468 (match_operand:VI12_128 2 "nonimmediate_operand")))]
19471 emit_insn (gen_xop_sha<mode>3 (operands[0], operands[1], operands[2]));
19475 (define_expand "vashl<mode>3"
19476 [(set (match_operand:VI48_128 0 "register_operand")
19478 (match_operand:VI48_128 1 "register_operand")
19479 (match_operand:VI48_128 2 "nonimmediate_operand")))]
19480 "TARGET_AVX2 || TARGET_XOP"
19484 operands[2] = force_reg (<MODE>mode, operands[2]);
19485 emit_insn (gen_xop_sha<mode>3 (operands[0], operands[1], operands[2]));
19490 (define_expand "vashl<mode>3"
19491 [(set (match_operand:VI48_512 0 "register_operand")
19493 (match_operand:VI48_512 1 "register_operand")
19494 (match_operand:VI48_512 2 "nonimmediate_operand")))]
19497 (define_expand "vashl<mode>3"
19498 [(set (match_operand:VI48_256 0 "register_operand")
19500 (match_operand:VI48_256 1 "register_operand")
19501 (match_operand:VI48_256 2 "nonimmediate_operand")))]
19504 (define_insn "xop_sha<mode>3"
19505 [(set (match_operand:VI_128 0 "register_operand" "=x,x")
19506 (if_then_else:VI_128
19508 (match_operand:VI_128 2 "nonimmediate_operand" "x,m")
19511 (match_operand:VI_128 1 "nonimmediate_operand" "xm,x")
19515 (neg:VI_128 (match_dup 2)))))]
19516 "TARGET_XOP && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
19517 "vpsha<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
19518 [(set_attr "type" "sseishft")
19519 (set_attr "prefix_data16" "0")
19520 (set_attr "prefix_extra" "2")
19521 (set_attr "mode" "TI")])
19523 (define_insn "xop_shl<mode>3"
19524 [(set (match_operand:VI_128 0 "register_operand" "=x,x")
19525 (if_then_else:VI_128
19527 (match_operand:VI_128 2 "nonimmediate_operand" "x,m")
19530 (match_operand:VI_128 1 "nonimmediate_operand" "xm,x")
19534 (neg:VI_128 (match_dup 2)))))]
19535 "TARGET_XOP && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
19536 "vpshl<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
19537 [(set_attr "type" "sseishft")
19538 (set_attr "prefix_data16" "0")
19539 (set_attr "prefix_extra" "2")
19540 (set_attr "mode" "TI")])
19542 (define_expand "<shift_insn><mode>3"
19543 [(set (match_operand:VI1_AVX512 0 "register_operand")
19544 (any_shift:VI1_AVX512
19545 (match_operand:VI1_AVX512 1 "register_operand")
19546 (match_operand:SI 2 "nonmemory_operand")))]
19549 if (TARGET_XOP && <MODE>mode == V16QImode)
19551 bool negate = false;
19552 rtx (*gen) (rtx, rtx, rtx);
19556 if (<CODE> != ASHIFT)
19558 if (CONST_INT_P (operands[2]))
19559 operands[2] = GEN_INT (-INTVAL (operands[2]));
19563 par = gen_rtx_PARALLEL (V16QImode, rtvec_alloc (16));
19564 for (i = 0; i < 16; i++)
19565 XVECEXP (par, 0, i) = operands[2];
19567 tmp = gen_reg_rtx (V16QImode);
19568 emit_insn (gen_vec_initv16qiqi (tmp, par));
19571 emit_insn (gen_negv16qi2 (tmp, tmp));
19573 gen = (<CODE> == LSHIFTRT ? gen_xop_shlv16qi3 : gen_xop_shav16qi3);
19574 emit_insn (gen (operands[0], operands[1], tmp));
19577 ix86_expand_vecop_qihi (<CODE>, operands[0], operands[1], operands[2]);
19581 (define_expand "ashrv2di3"
19582 [(set (match_operand:V2DI 0 "register_operand")
19584 (match_operand:V2DI 1 "register_operand")
19585 (match_operand:DI 2 "nonmemory_operand")))]
19586 "TARGET_XOP || TARGET_AVX512VL"
19588 if (!TARGET_AVX512VL)
19590 rtx reg = gen_reg_rtx (V2DImode);
19592 bool negate = false;
19595 if (CONST_INT_P (operands[2]))
19596 operands[2] = GEN_INT (-INTVAL (operands[2]));
19600 par = gen_rtx_PARALLEL (V2DImode, rtvec_alloc (2));
19601 for (i = 0; i < 2; i++)
19602 XVECEXP (par, 0, i) = operands[2];
19604 emit_insn (gen_vec_initv2didi (reg, par));
19607 emit_insn (gen_negv2di2 (reg, reg));
19609 emit_insn (gen_xop_shav2di3 (operands[0], operands[1], reg));
19614 ;; XOP FRCZ support
19615 (define_insn "xop_frcz<mode>2"
19616 [(set (match_operand:FMAMODE 0 "register_operand" "=x")
19618 [(match_operand:FMAMODE 1 "nonimmediate_operand" "xm")]
19621 "vfrcz<ssemodesuffix>\t{%1, %0|%0, %1}"
19622 [(set_attr "type" "ssecvt1")
19623 (set_attr "mode" "<MODE>")])
19625 (define_expand "xop_vmfrcz<mode>2"
19626 [(set (match_operand:VF_128 0 "register_operand")
19629 [(match_operand:VF_128 1 "nonimmediate_operand")]
19634 "operands[2] = CONST0_RTX (<MODE>mode);")
19636 (define_insn "*xop_vmfrcz<mode>2"
19637 [(set (match_operand:VF_128 0 "register_operand" "=x")
19640 [(match_operand:VF_128 1 "nonimmediate_operand" "xm")]
19642 (match_operand:VF_128 2 "const0_operand")
19645 "vfrcz<ssescalarmodesuffix>\t{%1, %0|%0, %<iptr>1}"
19646 [(set_attr "type" "ssecvt1")
19647 (set_attr "mode" "<MODE>")])
19649 (define_insn "xop_maskcmp<mode>3"
19650 [(set (match_operand:VI_128 0 "register_operand" "=x")
19651 (match_operator:VI_128 1 "ix86_comparison_int_operator"
19652 [(match_operand:VI_128 2 "register_operand" "x")
19653 (match_operand:VI_128 3 "nonimmediate_operand" "xm")]))]
19655 "vpcom%Y1<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}"
19656 [(set_attr "type" "sse4arg")
19657 (set_attr "prefix_data16" "0")
19658 (set_attr "prefix_rep" "0")
19659 (set_attr "prefix_extra" "2")
19660 (set_attr "length_immediate" "1")
19661 (set_attr "mode" "TI")])
19663 (define_insn "xop_maskcmp_uns<mode>3"
19664 [(set (match_operand:VI_128 0 "register_operand" "=x")
19665 (match_operator:VI_128 1 "ix86_comparison_uns_operator"
19666 [(match_operand:VI_128 2 "register_operand" "x")
19667 (match_operand:VI_128 3 "nonimmediate_operand" "xm")]))]
19669 "vpcom%Y1u<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}"
19670 [(set_attr "type" "ssecmp")
19671 (set_attr "prefix_data16" "0")
19672 (set_attr "prefix_rep" "0")
19673 (set_attr "prefix_extra" "2")
19674 (set_attr "length_immediate" "1")
19675 (set_attr "mode" "TI")])
19677 ;; Version of pcom*u* that is called from the intrinsics that allows pcomequ*
19678 ;; and pcomneu* not to be converted to the signed ones in case somebody needs
19679 ;; the exact instruction generated for the intrinsic.
19680 (define_insn "xop_maskcmp_uns2<mode>3"
19681 [(set (match_operand:VI_128 0 "register_operand" "=x")
19683 [(match_operator:VI_128 1 "ix86_comparison_uns_operator"
19684 [(match_operand:VI_128 2 "register_operand" "x")
19685 (match_operand:VI_128 3 "nonimmediate_operand" "xm")])]
19686 UNSPEC_XOP_UNSIGNED_CMP))]
19688 "vpcom%Y1u<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}"
19689 [(set_attr "type" "ssecmp")
19690 (set_attr "prefix_data16" "0")
19691 (set_attr "prefix_extra" "2")
19692 (set_attr "length_immediate" "1")
19693 (set_attr "mode" "TI")])
19695 ;; Pcomtrue and pcomfalse support. These are useless instructions, but are
19696 ;; being added here to be complete.
19697 (define_insn "xop_pcom_tf<mode>3"
19698 [(set (match_operand:VI_128 0 "register_operand" "=x")
19700 [(match_operand:VI_128 1 "register_operand" "x")
19701 (match_operand:VI_128 2 "nonimmediate_operand" "xm")
19702 (match_operand:SI 3 "const_int_operand" "n")]
19703 UNSPEC_XOP_TRUEFALSE))]
19706 return ((INTVAL (operands[3]) != 0)
19707 ? "vpcomtrue<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
19708 : "vpcomfalse<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}");
19710 [(set_attr "type" "ssecmp")
19711 (set_attr "prefix_data16" "0")
19712 (set_attr "prefix_extra" "2")
19713 (set_attr "length_immediate" "1")
19714 (set_attr "mode" "TI")])
19716 (define_insn "xop_vpermil2<mode>3"
19717 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x")
19719 [(match_operand:VF_128_256 1 "register_operand" "x,x")
19720 (match_operand:VF_128_256 2 "nonimmediate_operand" "x,m")
19721 (match_operand:<sseintvecmode> 3 "nonimmediate_operand" "xm,x")
19722 (match_operand:SI 4 "const_0_to_3_operand" "n,n")]
19725 "vpermil2<ssemodesuffix>\t{%4, %3, %2, %1, %0|%0, %1, %2, %3, %4}"
19726 [(set_attr "type" "sse4arg")
19727 (set_attr "length_immediate" "1")
19728 (set_attr "mode" "<MODE>")])
19730 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
19732 (define_insn "aesenc"
19733 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
19734 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
19735 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
19739 aesenc\t{%2, %0|%0, %2}
19740 vaesenc\t{%2, %1, %0|%0, %1, %2}"
19741 [(set_attr "isa" "noavx,avx")
19742 (set_attr "type" "sselog1")
19743 (set_attr "prefix_extra" "1")
19744 (set_attr "prefix" "orig,vex")
19745 (set_attr "btver2_decode" "double,double")
19746 (set_attr "mode" "TI")])
19748 (define_insn "aesenclast"
19749 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
19750 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
19751 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
19752 UNSPEC_AESENCLAST))]
19755 aesenclast\t{%2, %0|%0, %2}
19756 vaesenclast\t{%2, %1, %0|%0, %1, %2}"
19757 [(set_attr "isa" "noavx,avx")
19758 (set_attr "type" "sselog1")
19759 (set_attr "prefix_extra" "1")
19760 (set_attr "prefix" "orig,vex")
19761 (set_attr "btver2_decode" "double,double")
19762 (set_attr "mode" "TI")])
19764 (define_insn "aesdec"
19765 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
19766 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
19767 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
19771 aesdec\t{%2, %0|%0, %2}
19772 vaesdec\t{%2, %1, %0|%0, %1, %2}"
19773 [(set_attr "isa" "noavx,avx")
19774 (set_attr "type" "sselog1")
19775 (set_attr "prefix_extra" "1")
19776 (set_attr "prefix" "orig,vex")
19777 (set_attr "btver2_decode" "double,double")
19778 (set_attr "mode" "TI")])
19780 (define_insn "aesdeclast"
19781 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
19782 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
19783 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
19784 UNSPEC_AESDECLAST))]
19787 aesdeclast\t{%2, %0|%0, %2}
19788 vaesdeclast\t{%2, %1, %0|%0, %1, %2}"
19789 [(set_attr "isa" "noavx,avx")
19790 (set_attr "type" "sselog1")
19791 (set_attr "prefix_extra" "1")
19792 (set_attr "prefix" "orig,vex")
19793 (set_attr "btver2_decode" "double,double")
19794 (set_attr "mode" "TI")])
19796 (define_insn "aesimc"
19797 [(set (match_operand:V2DI 0 "register_operand" "=x")
19798 (unspec:V2DI [(match_operand:V2DI 1 "vector_operand" "xBm")]
19801 "%vaesimc\t{%1, %0|%0, %1}"
19802 [(set_attr "type" "sselog1")
19803 (set_attr "prefix_extra" "1")
19804 (set_attr "prefix" "maybe_vex")
19805 (set_attr "mode" "TI")])
19807 (define_insn "aeskeygenassist"
19808 [(set (match_operand:V2DI 0 "register_operand" "=x")
19809 (unspec:V2DI [(match_operand:V2DI 1 "vector_operand" "xBm")
19810 (match_operand:SI 2 "const_0_to_255_operand" "n")]
19811 UNSPEC_AESKEYGENASSIST))]
19813 "%vaeskeygenassist\t{%2, %1, %0|%0, %1, %2}"
19814 [(set_attr "type" "sselog1")
19815 (set_attr "prefix_extra" "1")
19816 (set_attr "length_immediate" "1")
19817 (set_attr "prefix" "maybe_vex")
19818 (set_attr "mode" "TI")])
19820 (define_insn "pclmulqdq"
19821 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
19822 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
19823 (match_operand:V2DI 2 "vector_operand" "xBm,xm")
19824 (match_operand:SI 3 "const_0_to_255_operand" "n,n")]
19828 pclmulqdq\t{%3, %2, %0|%0, %2, %3}
19829 vpclmulqdq\t{%3, %2, %1, %0|%0, %1, %2, %3}"
19830 [(set_attr "isa" "noavx,avx")
19831 (set_attr "type" "sselog1")
19832 (set_attr "prefix_extra" "1")
19833 (set_attr "length_immediate" "1")
19834 (set_attr "prefix" "orig,vex")
19835 (set_attr "mode" "TI")])
19837 (define_expand "avx_vzeroall"
19838 [(match_par_dup 0 [(const_int 0)])]
19841 int nregs = TARGET_64BIT ? 16 : 8;
19844 operands[0] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (nregs + 1));
19846 XVECEXP (operands[0], 0, 0)
19847 = gen_rtx_UNSPEC_VOLATILE (VOIDmode, gen_rtvec (1, const0_rtx),
19850 for (regno = 0; regno < nregs; regno++)
19851 XVECEXP (operands[0], 0, regno + 1)
19852 = gen_rtx_SET (gen_rtx_REG (V8SImode, GET_SSE_REGNO (regno)),
19853 CONST0_RTX (V8SImode));
19856 (define_insn "*avx_vzeroall"
19857 [(match_parallel 0 "vzeroall_operation"
19858 [(unspec_volatile [(const_int 0)] UNSPECV_VZEROALL)])]
19861 [(set_attr "type" "sse")
19862 (set_attr "modrm" "0")
19863 (set_attr "memory" "none")
19864 (set_attr "prefix" "vex")
19865 (set_attr "btver2_decode" "vector")
19866 (set_attr "mode" "OI")])
19868 ;; Clear the upper 128bits of AVX registers, equivalent to a NOP
19869 ;; if the upper 128bits are unused. Initially we expand the instructions
19870 ;; as though they had no effect on the SSE registers, but later add SETs and
19871 ;; CLOBBERs to the PARALLEL to model the real effect.
19872 (define_expand "avx_vzeroupper"
19873 [(parallel [(unspec_volatile [(const_int 0)] UNSPECV_VZEROUPPER)])]
19876 (define_insn "*avx_vzeroupper"
19877 [(match_parallel 0 "vzeroupper_pattern"
19878 [(unspec_volatile [(const_int 0)] UNSPECV_VZEROUPPER)])]
19879 "TARGET_AVX && XVECLEN (operands[0], 0) == (TARGET_64BIT ? 16 : 8) + 1"
19881 [(set_attr "type" "sse")
19882 (set_attr "modrm" "0")
19883 (set_attr "memory" "none")
19884 (set_attr "prefix" "vex")
19885 (set_attr "btver2_decode" "vector")
19886 (set_attr "mode" "OI")])
19888 (define_insn_and_split "*avx_vzeroupper_1"
19889 [(match_parallel 0 "vzeroupper_pattern"
19890 [(unspec_volatile [(const_int 0)] UNSPECV_VZEROUPPER)])]
19891 "TARGET_AVX && XVECLEN (operands[0], 0) != (TARGET_64BIT ? 16 : 8) + 1"
19893 "&& epilogue_completed"
19896 /* For IPA-RA purposes, make it clear the instruction clobbers
19897 even XMM registers not mentioned explicitly in the pattern. */
19898 unsigned int nregs = TARGET_64BIT ? 16 : 8;
19899 unsigned int npats = XVECLEN (operands[0], 0);
19900 rtvec vec = rtvec_alloc (nregs + 1);
19901 RTVEC_ELT (vec, 0) = XVECEXP (operands[0], 0, 0);
19902 for (unsigned int i = 0, j = 1; i < nregs; ++i)
19904 unsigned int regno = GET_SSE_REGNO (i);
19906 && REGNO (SET_DEST (XVECEXP (operands[0], 0, j))) == regno)
19908 RTVEC_ELT (vec, i + 1) = XVECEXP (operands[0], 0, j);
19913 rtx reg = gen_rtx_REG (V2DImode, regno);
19914 RTVEC_ELT (vec, i + 1) = gen_rtx_CLOBBER (VOIDmode, reg);
19917 operands[0] = gen_rtx_PARALLEL (VOIDmode, vec);
19919 [(set_attr "type" "sse")
19920 (set_attr "modrm" "0")
19921 (set_attr "memory" "none")
19922 (set_attr "prefix" "vex")
19923 (set_attr "btver2_decode" "vector")
19924 (set_attr "mode" "OI")])
19926 (define_mode_attr pbroadcast_evex_isa
19927 [(V64QI "avx512bw") (V32QI "avx512bw") (V16QI "avx512bw")
19928 (V32HI "avx512bw") (V16HI "avx512bw") (V8HI "avx512bw")
19929 (V16SI "avx512f") (V8SI "avx512f") (V4SI "avx512f")
19930 (V8DI "avx512f") (V4DI "avx512f") (V2DI "avx512f")])
19932 (define_insn "avx2_pbroadcast<mode>"
19933 [(set (match_operand:VI 0 "register_operand" "=x,v")
19935 (vec_select:<ssescalarmode>
19936 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "xm,vm")
19937 (parallel [(const_int 0)]))))]
19939 "vpbroadcast<ssemodesuffix>\t{%1, %0|%0, %<iptr>1}"
19940 [(set_attr "isa" "*,<pbroadcast_evex_isa>")
19941 (set_attr "type" "ssemov")
19942 (set_attr "prefix_extra" "1")
19943 (set_attr "prefix" "vex,evex")
19944 (set_attr "mode" "<sseinsnmode>")])
19946 (define_insn "avx2_pbroadcast<mode>_1"
19947 [(set (match_operand:VI_256 0 "register_operand" "=x,x,v,v")
19948 (vec_duplicate:VI_256
19949 (vec_select:<ssescalarmode>
19950 (match_operand:VI_256 1 "nonimmediate_operand" "m,x,m,v")
19951 (parallel [(const_int 0)]))))]
19954 vpbroadcast<ssemodesuffix>\t{%1, %0|%0, %<iptr>1}
19955 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %x1}
19956 vpbroadcast<ssemodesuffix>\t{%1, %0|%0, %<iptr>1}
19957 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %x1}"
19958 [(set_attr "isa" "*,*,<pbroadcast_evex_isa>,<pbroadcast_evex_isa>")
19959 (set_attr "type" "ssemov")
19960 (set_attr "prefix_extra" "1")
19961 (set_attr "prefix" "vex")
19962 (set_attr "mode" "<sseinsnmode>")])
19964 (define_insn "<avx2_avx512>_permvar<mode><mask_name>"
19965 [(set (match_operand:VI48F_256_512 0 "register_operand" "=v")
19966 (unspec:VI48F_256_512
19967 [(match_operand:VI48F_256_512 1 "nonimmediate_operand" "vm")
19968 (match_operand:<sseintvecmode> 2 "register_operand" "v")]
19970 "TARGET_AVX2 && <mask_mode512bit_condition>"
19971 "vperm<ssemodesuffix>\t{%1, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1}"
19972 [(set_attr "type" "sselog")
19973 (set_attr "prefix" "<mask_prefix2>")
19974 (set_attr "mode" "<sseinsnmode>")])
19976 (define_insn "<avx512>_permvar<mode><mask_name>"
19977 [(set (match_operand:VI1_AVX512VL 0 "register_operand" "=v")
19978 (unspec:VI1_AVX512VL
19979 [(match_operand:VI1_AVX512VL 1 "nonimmediate_operand" "vm")
19980 (match_operand:<sseintvecmode> 2 "register_operand" "v")]
19982 "TARGET_AVX512VBMI && <mask_mode512bit_condition>"
19983 "vperm<ssemodesuffix>\t{%1, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1}"
19984 [(set_attr "type" "sselog")
19985 (set_attr "prefix" "<mask_prefix2>")
19986 (set_attr "mode" "<sseinsnmode>")])
19988 (define_insn "<avx512>_permvar<mode><mask_name>"
19989 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
19990 (unspec:VI2_AVX512VL
19991 [(match_operand:VI2_AVX512VL 1 "nonimmediate_operand" "vm")
19992 (match_operand:<sseintvecmode> 2 "register_operand" "v")]
19994 "TARGET_AVX512BW && <mask_mode512bit_condition>"
19995 "vperm<ssemodesuffix>\t{%1, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1}"
19996 [(set_attr "type" "sselog")
19997 (set_attr "prefix" "<mask_prefix2>")
19998 (set_attr "mode" "<sseinsnmode>")])
20000 ;; Recognize broadcast as a vec_select as produced by builtin_vec_perm.
20001 ;; If it so happens that the input is in memory, use vbroadcast.
20002 ;; Otherwise use vpermilp (and in the case of 256-bit modes, vperm2f128).
20003 (define_insn "*avx_vperm_broadcast_v4sf"
20004 [(set (match_operand:V4SF 0 "register_operand" "=v,v,v")
20006 (match_operand:V4SF 1 "nonimmediate_operand" "m,o,v")
20007 (match_parallel 2 "avx_vbroadcast_operand"
20008 [(match_operand 3 "const_int_operand" "C,n,n")])))]
20011 int elt = INTVAL (operands[3]);
20012 switch (which_alternative)
20016 operands[1] = adjust_address_nv (operands[1], SFmode, elt * 4);
20017 return "vbroadcastss\t{%1, %0|%0, %k1}";
20019 operands[2] = GEN_INT (elt * 0x55);
20020 return "vpermilps\t{%2, %1, %0|%0, %1, %2}";
20022 gcc_unreachable ();
20025 [(set_attr "type" "ssemov,ssemov,sselog1")
20026 (set_attr "prefix_extra" "1")
20027 (set_attr "length_immediate" "0,0,1")
20028 (set_attr "prefix" "maybe_evex")
20029 (set_attr "mode" "SF,SF,V4SF")])
20031 (define_insn_and_split "*avx_vperm_broadcast_<mode>"
20032 [(set (match_operand:VF_256 0 "register_operand" "=v,v,v")
20034 (match_operand:VF_256 1 "nonimmediate_operand" "m,o,?v")
20035 (match_parallel 2 "avx_vbroadcast_operand"
20036 [(match_operand 3 "const_int_operand" "C,n,n")])))]
20038 && (<MODE>mode != V4DFmode || !TARGET_AVX2 || operands[3] == const0_rtx)"
20040 "&& reload_completed"
20041 [(set (match_dup 0) (vec_duplicate:VF_256 (match_dup 1)))]
20043 rtx op0 = operands[0], op1 = operands[1];
20044 int elt = INTVAL (operands[3]);
20050 if (TARGET_AVX2 && elt == 0)
20052 emit_insn (gen_vec_dup<mode> (op0, gen_lowpart (<ssescalarmode>mode,
20057 /* Shuffle element we care about into all elements of the 128-bit lane.
20058 The other lane gets shuffled too, but we don't care. */
20059 if (<MODE>mode == V4DFmode)
20060 mask = (elt & 1 ? 15 : 0);
20062 mask = (elt & 3) * 0x55;
20063 emit_insn (gen_avx_vpermil<mode> (op0, op1, GEN_INT (mask)));
20065 /* Shuffle the lane we care about into both lanes of the dest. */
20066 mask = (elt / (<ssescalarnum> / 2)) * 0x11;
20067 if (EXT_REX_SSE_REG_P (op0))
20069 /* There is no EVEX VPERM2F128, but we can use either VBROADCASTSS
20071 gcc_assert (<MODE>mode == V8SFmode);
20072 if ((mask & 1) == 0)
20073 emit_insn (gen_avx2_vec_dupv8sf (op0,
20074 gen_lowpart (V4SFmode, op0)));
20076 emit_insn (gen_avx512vl_shuf_f32x4_1 (op0, op0, op0,
20077 GEN_INT (4), GEN_INT (5),
20078 GEN_INT (6), GEN_INT (7),
20079 GEN_INT (12), GEN_INT (13),
20080 GEN_INT (14), GEN_INT (15)));
20084 emit_insn (gen_avx_vperm2f128<mode>3 (op0, op0, op0, GEN_INT (mask)));
20088 operands[1] = adjust_address (op1, <ssescalarmode>mode,
20089 elt * GET_MODE_SIZE (<ssescalarmode>mode));
20092 (define_expand "<sse2_avx_avx512f>_vpermil<mode><mask_name>"
20093 [(set (match_operand:VF2 0 "register_operand")
20095 (match_operand:VF2 1 "nonimmediate_operand")
20096 (match_operand:SI 2 "const_0_to_255_operand")))]
20097 "TARGET_AVX && <mask_mode512bit_condition>"
20099 int mask = INTVAL (operands[2]);
20100 rtx perm[<ssescalarnum>];
20103 for (i = 0; i < <ssescalarnum>; i = i + 2)
20105 perm[i] = GEN_INT (((mask >> i) & 1) + i);
20106 perm[i + 1] = GEN_INT (((mask >> (i + 1)) & 1) + i);
20110 = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (<ssescalarnum>, perm));
20113 (define_expand "<sse2_avx_avx512f>_vpermil<mode><mask_name>"
20114 [(set (match_operand:VF1 0 "register_operand")
20116 (match_operand:VF1 1 "nonimmediate_operand")
20117 (match_operand:SI 2 "const_0_to_255_operand")))]
20118 "TARGET_AVX && <mask_mode512bit_condition>"
20120 int mask = INTVAL (operands[2]);
20121 rtx perm[<ssescalarnum>];
20124 for (i = 0; i < <ssescalarnum>; i = i + 4)
20126 perm[i] = GEN_INT (((mask >> 0) & 3) + i);
20127 perm[i + 1] = GEN_INT (((mask >> 2) & 3) + i);
20128 perm[i + 2] = GEN_INT (((mask >> 4) & 3) + i);
20129 perm[i + 3] = GEN_INT (((mask >> 6) & 3) + i);
20133 = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (<ssescalarnum>, perm));
20136 ;; This pattern needs to come before the avx2_perm*/avx512f_perm*
20137 ;; patterns, as they have the same RTL representation (vpermilp*
20138 ;; being a subset of what vpermp* can do), but vpermilp* has shorter
20139 ;; latency as it never crosses lanes.
20140 (define_insn "*<sse2_avx_avx512f>_vpermilp<mode><mask_name>"
20141 [(set (match_operand:VF 0 "register_operand" "=v")
20143 (match_operand:VF 1 "nonimmediate_operand" "vm")
20144 (match_parallel 2 ""
20145 [(match_operand 3 "const_int_operand")])))]
20146 "TARGET_AVX && <mask_mode512bit_condition>
20147 && avx_vpermilp_parallel (operands[2], <MODE>mode)"
20149 int mask = avx_vpermilp_parallel (operands[2], <MODE>mode) - 1;
20150 operands[2] = GEN_INT (mask);
20151 return "vpermil<ssemodesuffix>\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}";
20153 [(set_attr "type" "sselog")
20154 (set_attr "prefix_extra" "1")
20155 (set_attr "length_immediate" "1")
20156 (set_attr "prefix" "<mask_prefix>")
20157 (set_attr "mode" "<sseinsnmode>")])
20159 (define_expand "avx2_perm<mode>"
20160 [(match_operand:VI8F_256 0 "register_operand")
20161 (match_operand:VI8F_256 1 "nonimmediate_operand")
20162 (match_operand:SI 2 "const_0_to_255_operand")]
20165 int mask = INTVAL (operands[2]);
20166 emit_insn (gen_avx2_perm<mode>_1 (operands[0], operands[1],
20167 GEN_INT ((mask >> 0) & 3),
20168 GEN_INT ((mask >> 2) & 3),
20169 GEN_INT ((mask >> 4) & 3),
20170 GEN_INT ((mask >> 6) & 3)));
20174 (define_expand "avx512vl_perm<mode>_mask"
20175 [(match_operand:VI8F_256 0 "register_operand")
20176 (match_operand:VI8F_256 1 "nonimmediate_operand")
20177 (match_operand:SI 2 "const_0_to_255_operand")
20178 (match_operand:VI8F_256 3 "nonimm_or_0_operand")
20179 (match_operand:<avx512fmaskmode> 4 "register_operand")]
20182 int mask = INTVAL (operands[2]);
20183 emit_insn (gen_<avx2_avx512>_perm<mode>_1_mask (operands[0], operands[1],
20184 GEN_INT ((mask >> 0) & 3),
20185 GEN_INT ((mask >> 2) & 3),
20186 GEN_INT ((mask >> 4) & 3),
20187 GEN_INT ((mask >> 6) & 3),
20188 operands[3], operands[4]));
20192 (define_insn "avx2_perm<mode>_1<mask_name>"
20193 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
20194 (vec_select:VI8F_256
20195 (match_operand:VI8F_256 1 "nonimmediate_operand" "vm")
20196 (parallel [(match_operand 2 "const_0_to_3_operand")
20197 (match_operand 3 "const_0_to_3_operand")
20198 (match_operand 4 "const_0_to_3_operand")
20199 (match_operand 5 "const_0_to_3_operand")])))]
20200 "TARGET_AVX2 && <mask_mode512bit_condition>"
20203 mask |= INTVAL (operands[2]) << 0;
20204 mask |= INTVAL (operands[3]) << 2;
20205 mask |= INTVAL (operands[4]) << 4;
20206 mask |= INTVAL (operands[5]) << 6;
20207 operands[2] = GEN_INT (mask);
20208 return "vperm<ssemodesuffix>\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
20210 [(set_attr "type" "sselog")
20211 (set_attr "prefix" "<mask_prefix2>")
20212 (set_attr "mode" "<sseinsnmode>")])
20214 (define_expand "avx512f_perm<mode>"
20215 [(match_operand:V8FI 0 "register_operand")
20216 (match_operand:V8FI 1 "nonimmediate_operand")
20217 (match_operand:SI 2 "const_0_to_255_operand")]
20220 int mask = INTVAL (operands[2]);
20221 emit_insn (gen_avx512f_perm<mode>_1 (operands[0], operands[1],
20222 GEN_INT ((mask >> 0) & 3),
20223 GEN_INT ((mask >> 2) & 3),
20224 GEN_INT ((mask >> 4) & 3),
20225 GEN_INT ((mask >> 6) & 3),
20226 GEN_INT (((mask >> 0) & 3) + 4),
20227 GEN_INT (((mask >> 2) & 3) + 4),
20228 GEN_INT (((mask >> 4) & 3) + 4),
20229 GEN_INT (((mask >> 6) & 3) + 4)));
20233 (define_expand "avx512f_perm<mode>_mask"
20234 [(match_operand:V8FI 0 "register_operand")
20235 (match_operand:V8FI 1 "nonimmediate_operand")
20236 (match_operand:SI 2 "const_0_to_255_operand")
20237 (match_operand:V8FI 3 "nonimm_or_0_operand")
20238 (match_operand:<avx512fmaskmode> 4 "register_operand")]
20241 int mask = INTVAL (operands[2]);
20242 emit_insn (gen_avx512f_perm<mode>_1_mask (operands[0], operands[1],
20243 GEN_INT ((mask >> 0) & 3),
20244 GEN_INT ((mask >> 2) & 3),
20245 GEN_INT ((mask >> 4) & 3),
20246 GEN_INT ((mask >> 6) & 3),
20247 GEN_INT (((mask >> 0) & 3) + 4),
20248 GEN_INT (((mask >> 2) & 3) + 4),
20249 GEN_INT (((mask >> 4) & 3) + 4),
20250 GEN_INT (((mask >> 6) & 3) + 4),
20251 operands[3], operands[4]));
20255 (define_insn "avx512f_perm<mode>_1<mask_name>"
20256 [(set (match_operand:V8FI 0 "register_operand" "=v")
20258 (match_operand:V8FI 1 "nonimmediate_operand" "vm")
20259 (parallel [(match_operand 2 "const_0_to_3_operand")
20260 (match_operand 3 "const_0_to_3_operand")
20261 (match_operand 4 "const_0_to_3_operand")
20262 (match_operand 5 "const_0_to_3_operand")
20263 (match_operand 6 "const_4_to_7_operand")
20264 (match_operand 7 "const_4_to_7_operand")
20265 (match_operand 8 "const_4_to_7_operand")
20266 (match_operand 9 "const_4_to_7_operand")])))]
20267 "TARGET_AVX512F && <mask_mode512bit_condition>
20268 && (INTVAL (operands[2]) == (INTVAL (operands[6]) - 4)
20269 && INTVAL (operands[3]) == (INTVAL (operands[7]) - 4)
20270 && INTVAL (operands[4]) == (INTVAL (operands[8]) - 4)
20271 && INTVAL (operands[5]) == (INTVAL (operands[9]) - 4))"
20274 mask |= INTVAL (operands[2]) << 0;
20275 mask |= INTVAL (operands[3]) << 2;
20276 mask |= INTVAL (operands[4]) << 4;
20277 mask |= INTVAL (operands[5]) << 6;
20278 operands[2] = GEN_INT (mask);
20279 return "vperm<ssemodesuffix>\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
20281 [(set_attr "type" "sselog")
20282 (set_attr "prefix" "<mask_prefix2>")
20283 (set_attr "mode" "<sseinsnmode>")])
20285 (define_insn "avx2_permv2ti"
20286 [(set (match_operand:V4DI 0 "register_operand" "=x")
20288 [(match_operand:V4DI 1 "register_operand" "x")
20289 (match_operand:V4DI 2 "nonimmediate_operand" "xm")
20290 (match_operand:SI 3 "const_0_to_255_operand" "n")]
20293 "vperm2i128\t{%3, %2, %1, %0|%0, %1, %2, %3}"
20294 [(set_attr "type" "sselog")
20295 (set_attr "prefix" "vex")
20296 (set_attr "mode" "OI")])
20298 (define_insn "avx2_vec_dupv4df"
20299 [(set (match_operand:V4DF 0 "register_operand" "=v")
20300 (vec_duplicate:V4DF
20302 (match_operand:V2DF 1 "register_operand" "v")
20303 (parallel [(const_int 0)]))))]
20305 "vbroadcastsd\t{%1, %0|%0, %1}"
20306 [(set_attr "type" "sselog1")
20307 (set_attr "prefix" "maybe_evex")
20308 (set_attr "mode" "V4DF")])
20310 (define_insn "<avx512>_vec_dup<mode>_1"
20311 [(set (match_operand:VI_AVX512BW 0 "register_operand" "=v,v")
20312 (vec_duplicate:VI_AVX512BW
20313 (vec_select:<ssescalarmode>
20314 (match_operand:VI_AVX512BW 1 "nonimmediate_operand" "v,m")
20315 (parallel [(const_int 0)]))))]
20318 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %x1}
20319 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %<iptr>1}"
20320 [(set_attr "type" "ssemov")
20321 (set_attr "prefix" "evex")
20322 (set_attr "mode" "<sseinsnmode>")])
20324 (define_insn "<avx512>_vec_dup<mode><mask_name>"
20325 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v")
20326 (vec_duplicate:V48_AVX512VL
20327 (vec_select:<ssescalarmode>
20328 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "vm")
20329 (parallel [(const_int 0)]))))]
20332 /* There is no DF broadcast (in AVX-512*) to 128b register.
20333 Mimic it with integer variant. */
20334 if (<MODE>mode == V2DFmode)
20335 return "vpbroadcastq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}";
20337 return "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %<iptr>1}";
20339 [(set_attr "type" "ssemov")
20340 (set_attr "prefix" "evex")
20341 (set_attr "mode" "<sseinsnmode>")])
20343 (define_insn "<avx512>_vec_dup<mode><mask_name>"
20344 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
20345 (vec_duplicate:VI12_AVX512VL
20346 (vec_select:<ssescalarmode>
20347 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "vm")
20348 (parallel [(const_int 0)]))))]
20350 "vpbroadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %<iptr>1}"
20351 [(set_attr "type" "ssemov")
20352 (set_attr "prefix" "evex")
20353 (set_attr "mode" "<sseinsnmode>")])
20355 (define_insn "<mask_codefor>avx512f_broadcast<mode><mask_name>"
20356 [(set (match_operand:V16FI 0 "register_operand" "=v,v")
20357 (vec_duplicate:V16FI
20358 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "v,m")))]
20361 vshuf<shuffletype>32x4\t{$0x0, %g1, %g1, %0<mask_operand2>|%0<mask_operand2>, %g1, %g1, 0x0}
20362 vbroadcast<shuffletype>32x4\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
20363 [(set_attr "type" "ssemov")
20364 (set_attr "prefix" "evex")
20365 (set_attr "mode" "<sseinsnmode>")])
20367 (define_insn "<mask_codefor>avx512f_broadcast<mode><mask_name>"
20368 [(set (match_operand:V8FI 0 "register_operand" "=v,v")
20369 (vec_duplicate:V8FI
20370 (match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "v,m")))]
20373 vshuf<shuffletype>64x2\t{$0x44, %g1, %g1, %0<mask_operand2>|%0<mask_operand2>, %g1, %g1, 0x44}
20374 vbroadcast<shuffletype>64x4\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
20375 [(set_attr "type" "ssemov")
20376 (set_attr "prefix" "evex")
20377 (set_attr "mode" "<sseinsnmode>")])
20379 (define_insn "<mask_codefor><avx512>_vec_dup_gpr<mode><mask_name>"
20380 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v,v")
20381 (vec_duplicate:VI12_AVX512VL
20382 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "vm,r")))]
20385 vpbroadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}
20386 vpbroadcast<bcstscalarsuff>\t{%k1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
20387 [(set_attr "type" "ssemov")
20388 (set_attr "prefix" "evex")
20389 (set_attr "mode" "<sseinsnmode>")])
20391 (define_insn "<mask_codefor><avx512>_vec_dup_gpr<mode><mask_name>"
20392 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v,v")
20393 (vec_duplicate:V48_AVX512VL
20394 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "vm,r")))]
20396 "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
20397 [(set_attr "type" "ssemov")
20398 (set_attr "prefix" "evex")
20399 (set_attr "mode" "<sseinsnmode>")
20400 (set (attr "enabled")
20401 (if_then_else (eq_attr "alternative" "1")
20402 (symbol_ref "GET_MODE_CLASS (<ssescalarmode>mode) == MODE_INT
20403 && (<ssescalarmode>mode != DImode || TARGET_64BIT)")
20406 (define_insn "vec_dupv4sf"
20407 [(set (match_operand:V4SF 0 "register_operand" "=v,v,x")
20408 (vec_duplicate:V4SF
20409 (match_operand:SF 1 "nonimmediate_operand" "Yv,m,0")))]
20412 vshufps\t{$0, %1, %1, %0|%0, %1, %1, 0}
20413 vbroadcastss\t{%1, %0|%0, %1}
20414 shufps\t{$0, %0, %0|%0, %0, 0}"
20415 [(set_attr "isa" "avx,avx,noavx")
20416 (set_attr "type" "sseshuf1,ssemov,sseshuf1")
20417 (set_attr "length_immediate" "1,0,1")
20418 (set_attr "prefix_extra" "0,1,*")
20419 (set_attr "prefix" "maybe_evex,maybe_evex,orig")
20420 (set_attr "mode" "V4SF")])
20422 (define_insn "*vec_dupv4si"
20423 [(set (match_operand:V4SI 0 "register_operand" "=v,v,x")
20424 (vec_duplicate:V4SI
20425 (match_operand:SI 1 "nonimmediate_operand" "Yv,m,0")))]
20428 %vpshufd\t{$0, %1, %0|%0, %1, 0}
20429 vbroadcastss\t{%1, %0|%0, %1}
20430 shufps\t{$0, %0, %0|%0, %0, 0}"
20431 [(set_attr "isa" "sse2,avx,noavx")
20432 (set_attr "type" "sselog1,ssemov,sselog1")
20433 (set_attr "length_immediate" "1,0,1")
20434 (set_attr "prefix_extra" "0,1,*")
20435 (set_attr "prefix" "maybe_vex,maybe_evex,orig")
20436 (set_attr "mode" "TI,V4SF,V4SF")])
20438 (define_insn "*vec_dupv2di"
20439 [(set (match_operand:V2DI 0 "register_operand" "=x,v,v,x")
20440 (vec_duplicate:V2DI
20441 (match_operand:DI 1 "nonimmediate_operand" " 0,Yv,vm,0")))]
20445 vpunpcklqdq\t{%d1, %0|%0, %d1}
20446 %vmovddup\t{%1, %0|%0, %1}
20448 [(set_attr "isa" "sse2_noavx,avx,sse3,noavx")
20449 (set_attr "type" "sselog1,sselog1,sselog1,ssemov")
20450 (set_attr "prefix" "orig,maybe_evex,maybe_vex,orig")
20451 (set_attr "mode" "TI,TI,DF,V4SF")])
20453 (define_insn "avx2_vbroadcasti128_<mode>"
20454 [(set (match_operand:VI_256 0 "register_operand" "=x,v,v")
20456 (match_operand:<ssehalfvecmode> 1 "memory_operand" "m,m,m")
20460 vbroadcasti128\t{%1, %0|%0, %1}
20461 vbroadcast<i128vldq>\t{%1, %0|%0, %1}
20462 vbroadcast<shuffletype>32x4\t{%1, %0|%0, %1}"
20463 [(set_attr "isa" "*,avx512dq,avx512vl")
20464 (set_attr "type" "ssemov")
20465 (set_attr "prefix_extra" "1")
20466 (set_attr "prefix" "vex,evex,evex")
20467 (set_attr "mode" "OI")])
20469 ;; Modes handled by AVX vec_dup patterns.
20470 (define_mode_iterator AVX_VEC_DUP_MODE
20471 [V8SI V8SF V4DI V4DF])
20472 (define_mode_attr vecdupssescalarmodesuffix
20473 [(V8SF "ss") (V4DF "sd") (V8SI "ss") (V4DI "sd")])
20474 ;; Modes handled by AVX2 vec_dup patterns.
20475 (define_mode_iterator AVX2_VEC_DUP_MODE
20476 [V32QI V16QI V16HI V8HI V8SI V4SI])
20478 (define_insn "*vec_dup<mode>"
20479 [(set (match_operand:AVX2_VEC_DUP_MODE 0 "register_operand" "=x,x,v")
20480 (vec_duplicate:AVX2_VEC_DUP_MODE
20481 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "m,x,$r")))]
20484 v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0|%0, %1}
20485 v<sseintprefix>broadcast<bcstscalarsuff>\t{%x1, %0|%0, %x1}
20487 [(set_attr "isa" "*,*,noavx512vl")
20488 (set_attr "type" "ssemov")
20489 (set_attr "prefix_extra" "1")
20490 (set_attr "prefix" "maybe_evex")
20491 (set_attr "mode" "<sseinsnmode>")
20492 (set (attr "preferred_for_speed")
20493 (cond [(eq_attr "alternative" "2")
20494 (symbol_ref "TARGET_INTER_UNIT_MOVES_TO_VEC")
20496 (symbol_ref "true")))])
20498 (define_insn "vec_dup<mode>"
20499 [(set (match_operand:AVX_VEC_DUP_MODE 0 "register_operand" "=x,x,x,v,x")
20500 (vec_duplicate:AVX_VEC_DUP_MODE
20501 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "m,m,x,v,?x")))]
20504 v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0|%0, %1}
20505 vbroadcast<vecdupssescalarmodesuffix>\t{%1, %0|%0, %1}
20506 v<sseintprefix>broadcast<bcstscalarsuff>\t{%x1, %0|%0, %x1}
20507 v<sseintprefix>broadcast<bcstscalarsuff>\t{%x1, %g0|%g0, %x1}
20509 [(set_attr "type" "ssemov")
20510 (set_attr "prefix_extra" "1")
20511 (set_attr "prefix" "maybe_evex")
20512 (set_attr "isa" "avx2,noavx2,avx2,avx512f,noavx2")
20513 (set_attr "mode" "<sseinsnmode>,V8SF,<sseinsnmode>,<sseinsnmode>,V8SF")])
20516 [(set (match_operand:AVX2_VEC_DUP_MODE 0 "register_operand")
20517 (vec_duplicate:AVX2_VEC_DUP_MODE
20518 (match_operand:<ssescalarmode> 1 "register_operand")))]
20520 /* Disable this splitter if avx512vl_vec_dup_gprv*[qhs]i insn is
20521 available, because then we can broadcast from GPRs directly.
20522 For V*[QH]I modes it requires both -mavx512vl and -mavx512bw,
20523 for V*SI mode it requires just -mavx512vl. */
20524 && !(TARGET_AVX512VL
20525 && (TARGET_AVX512BW || <ssescalarmode>mode == SImode))
20526 && reload_completed && GENERAL_REG_P (operands[1])"
20529 emit_insn (gen_vec_setv4si_0 (gen_lowpart (V4SImode, operands[0]),
20530 CONST0_RTX (V4SImode),
20531 gen_lowpart (SImode, operands[1])));
20532 emit_insn (gen_avx2_pbroadcast<mode> (operands[0],
20533 gen_lowpart (<ssexmmmode>mode,
20539 [(set (match_operand:AVX_VEC_DUP_MODE 0 "register_operand")
20540 (vec_duplicate:AVX_VEC_DUP_MODE
20541 (match_operand:<ssescalarmode> 1 "register_operand")))]
20542 "TARGET_AVX && !TARGET_AVX2 && reload_completed"
20543 [(set (match_dup 2)
20544 (vec_duplicate:<ssehalfvecmode> (match_dup 1)))
20546 (vec_concat:AVX_VEC_DUP_MODE (match_dup 2) (match_dup 2)))]
20547 "operands[2] = gen_lowpart (<ssehalfvecmode>mode, operands[0]);")
20549 (define_insn "avx_vbroadcastf128_<mode>"
20550 [(set (match_operand:V_256 0 "register_operand" "=x,x,x,v,v,v,v")
20552 (match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "m,0,?x,m,0,m,0")
20556 vbroadcast<i128>\t{%1, %0|%0, %1}
20557 vinsert<i128>\t{$1, %1, %0, %0|%0, %0, %1, 1}
20558 vperm2<i128>\t{$0, %t1, %t1, %0|%0, %t1, %t1, 0}
20559 vbroadcast<i128vldq>\t{%1, %0|%0, %1}
20560 vinsert<i128vldq>\t{$1, %1, %0, %0|%0, %0, %1, 1}
20561 vbroadcast<shuffletype>32x4\t{%1, %0|%0, %1}
20562 vinsert<shuffletype>32x4\t{$1, %1, %0, %0|%0, %0, %1, 1}"
20563 [(set_attr "isa" "*,*,*,avx512dq,avx512dq,avx512vl,avx512vl")
20564 (set_attr "type" "ssemov,sselog1,sselog1,ssemov,sselog1,ssemov,sselog1")
20565 (set_attr "prefix_extra" "1")
20566 (set_attr "length_immediate" "0,1,1,0,1,0,1")
20567 (set_attr "prefix" "vex,vex,vex,evex,evex,evex,evex")
20568 (set_attr "mode" "<sseinsnmode>")])
20570 ;; For broadcast[i|f]32x2. Yes there is no v4sf version, only v4si.
20571 (define_mode_iterator VI4F_BRCST32x2
20572 [V16SI (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")
20573 V16SF (V8SF "TARGET_AVX512VL")])
20575 (define_mode_attr 64x2mode
20576 [(V8DF "V2DF") (V8DI "V2DI") (V4DI "V2DI") (V4DF "V2DF")])
20578 (define_mode_attr 32x2mode
20579 [(V16SF "V2SF") (V16SI "V2SI") (V8SI "V2SI")
20580 (V8SF "V2SF") (V4SI "V2SI")])
20582 (define_insn "<mask_codefor>avx512dq_broadcast<mode><mask_name>"
20583 [(set (match_operand:VI4F_BRCST32x2 0 "register_operand" "=v")
20584 (vec_duplicate:VI4F_BRCST32x2
20585 (vec_select:<32x2mode>
20586 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "vm")
20587 (parallel [(const_int 0) (const_int 1)]))))]
20589 "vbroadcast<shuffletype>32x2\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
20590 [(set_attr "type" "ssemov")
20591 (set_attr "prefix_extra" "1")
20592 (set_attr "prefix" "evex")
20593 (set_attr "mode" "<sseinsnmode>")])
20595 (define_insn "<mask_codefor>avx512vl_broadcast<mode><mask_name>_1"
20596 [(set (match_operand:VI4F_256 0 "register_operand" "=v,v")
20597 (vec_duplicate:VI4F_256
20598 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "v,m")))]
20601 vshuf<shuffletype>32x4\t{$0x0, %t1, %t1, %0<mask_operand2>|%0<mask_operand2>, %t1, %t1, 0x0}
20602 vbroadcast<shuffletype>32x4\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
20603 [(set_attr "type" "ssemov")
20604 (set_attr "prefix_extra" "1")
20605 (set_attr "prefix" "evex")
20606 (set_attr "mode" "<sseinsnmode>")])
20608 (define_insn "<mask_codefor>avx512dq_broadcast<mode><mask_name>_1"
20609 [(set (match_operand:V16FI 0 "register_operand" "=v,v")
20610 (vec_duplicate:V16FI
20611 (match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "v,m")))]
20614 vshuf<shuffletype>32x4\t{$0x44, %g1, %g1, %0<mask_operand2>|%0<mask_operand2>, %g1, %g1, 0x44}
20615 vbroadcast<shuffletype>32x8\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
20616 [(set_attr "type" "ssemov")
20617 (set_attr "prefix_extra" "1")
20618 (set_attr "prefix" "evex")
20619 (set_attr "mode" "<sseinsnmode>")])
20621 ;; For broadcast[i|f]64x2
20622 (define_mode_iterator VI8F_BRCST64x2
20623 [V8DI V8DF (V4DI "TARGET_AVX512VL") (V4DF "TARGET_AVX512VL")])
20625 (define_insn "<mask_codefor>avx512dq_broadcast<mode><mask_name>_1"
20626 [(set (match_operand:VI8F_BRCST64x2 0 "register_operand" "=v,v")
20627 (vec_duplicate:VI8F_BRCST64x2
20628 (match_operand:<64x2mode> 1 "nonimmediate_operand" "v,m")))]
20631 vshuf<shuffletype>64x2\t{$0x0, %<xtg_mode>1, %<xtg_mode>1, %0<mask_operand2>|%0<mask_operand2>, %<xtg_mode>1, %<xtg_mode>1, 0x0}
20632 vbroadcast<shuffletype>64x2\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
20633 [(set_attr "type" "ssemov")
20634 (set_attr "prefix_extra" "1")
20635 (set_attr "prefix" "evex")
20636 (set_attr "mode" "<sseinsnmode>")])
20638 (define_insn "avx512cd_maskb_vec_dup<mode>"
20639 [(set (match_operand:VI8_AVX512VL 0 "register_operand" "=v")
20640 (vec_duplicate:VI8_AVX512VL
20642 (match_operand:QI 1 "register_operand" "k"))))]
20644 "vpbroadcastmb2q\t{%1, %0|%0, %1}"
20645 [(set_attr "type" "mskmov")
20646 (set_attr "prefix" "evex")
20647 (set_attr "mode" "XI")])
20649 (define_insn "avx512cd_maskw_vec_dup<mode>"
20650 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20651 (vec_duplicate:VI4_AVX512VL
20653 (match_operand:HI 1 "register_operand" "k"))))]
20655 "vpbroadcastmw2d\t{%1, %0|%0, %1}"
20656 [(set_attr "type" "mskmov")
20657 (set_attr "prefix" "evex")
20658 (set_attr "mode" "XI")])
20660 (define_insn "<sse2_avx_avx512f>_vpermilvar<mode>3<mask_name>"
20661 [(set (match_operand:VF 0 "register_operand" "=v")
20663 [(match_operand:VF 1 "register_operand" "v")
20664 (match_operand:<sseintvecmode> 2 "nonimmediate_operand" "vm")]
20666 "TARGET_AVX && <mask_mode512bit_condition>"
20667 "vpermil<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
20668 [(set_attr "type" "sselog")
20669 (set_attr "prefix_extra" "1")
20670 (set_attr "btver2_decode" "vector")
20671 (set_attr "prefix" "<mask_prefix>")
20672 (set_attr "mode" "<sseinsnmode>")])
20674 (define_mode_iterator VPERMI2
20675 [V16SI V16SF V8DI V8DF
20676 (V8SI "TARGET_AVX512VL") (V8SF "TARGET_AVX512VL")
20677 (V4DI "TARGET_AVX512VL") (V4DF "TARGET_AVX512VL")
20678 (V4SI "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
20679 (V2DI "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")
20680 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX512BW && TARGET_AVX512VL")
20681 (V8HI "TARGET_AVX512BW && TARGET_AVX512VL")
20682 (V64QI "TARGET_AVX512VBMI") (V32QI "TARGET_AVX512VBMI && TARGET_AVX512VL")
20683 (V16QI "TARGET_AVX512VBMI && TARGET_AVX512VL")])
20685 (define_mode_iterator VPERMI2I
20687 (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")
20688 (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")
20689 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX512BW && TARGET_AVX512VL")
20690 (V8HI "TARGET_AVX512BW && TARGET_AVX512VL")
20691 (V64QI "TARGET_AVX512VBMI") (V32QI "TARGET_AVX512VBMI && TARGET_AVX512VL")
20692 (V16QI "TARGET_AVX512VBMI && TARGET_AVX512VL")])
20694 (define_expand "<avx512>_vpermi2var<mode>3_mask"
20695 [(set (match_operand:VPERMI2 0 "register_operand")
20698 [(match_operand:<sseintvecmode> 2 "register_operand")
20699 (match_operand:VPERMI2 1 "register_operand")
20700 (match_operand:VPERMI2 3 "nonimmediate_operand")]
20703 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
20706 operands[2] = force_reg (<sseintvecmode>mode, operands[2]);
20707 operands[5] = gen_lowpart (<MODE>mode, operands[2]);
20710 (define_insn "*<avx512>_vpermi2var<mode>3_mask"
20711 [(set (match_operand:VPERMI2I 0 "register_operand" "=v")
20712 (vec_merge:VPERMI2I
20714 [(match_operand:<sseintvecmode> 2 "register_operand" "0")
20715 (match_operand:VPERMI2I 1 "register_operand" "v")
20716 (match_operand:VPERMI2I 3 "nonimmediate_operand" "vm")]
20719 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
20721 "vpermi2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
20722 [(set_attr "type" "sselog")
20723 (set_attr "prefix" "evex")
20724 (set_attr "mode" "<sseinsnmode>")])
20726 (define_insn "*<avx512>_vpermi2var<mode>3_mask"
20727 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
20728 (vec_merge:VF_AVX512VL
20729 (unspec:VF_AVX512VL
20730 [(match_operand:<sseintvecmode> 2 "register_operand" "0")
20731 (match_operand:VF_AVX512VL 1 "register_operand" "v")
20732 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "vm")]
20734 (subreg:VF_AVX512VL (match_dup 2) 0)
20735 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
20737 "vpermi2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
20738 [(set_attr "type" "sselog")
20739 (set_attr "prefix" "evex")
20740 (set_attr "mode" "<sseinsnmode>")])
20742 (define_expand "<avx512>_vpermt2var<mode>3_maskz"
20743 [(match_operand:VPERMI2 0 "register_operand")
20744 (match_operand:<sseintvecmode> 1 "register_operand")
20745 (match_operand:VPERMI2 2 "register_operand")
20746 (match_operand:VPERMI2 3 "nonimmediate_operand")
20747 (match_operand:<avx512fmaskmode> 4 "register_operand")]
20750 emit_insn (gen_<avx512>_vpermt2var<mode>3_maskz_1 (
20751 operands[0], operands[1], operands[2], operands[3],
20752 CONST0_RTX (<MODE>mode), operands[4]));
20756 (define_insn "<avx512>_vpermt2var<mode>3<sd_maskz_name>"
20757 [(set (match_operand:VPERMI2 0 "register_operand" "=v,v")
20759 [(match_operand:<sseintvecmode> 1 "register_operand" "v,0")
20760 (match_operand:VPERMI2 2 "register_operand" "0,v")
20761 (match_operand:VPERMI2 3 "nonimmediate_operand" "vm,vm")]
20765 vpermt2<ssemodesuffix>\t{%3, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %3}
20766 vpermi2<ssemodesuffix>\t{%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3}"
20767 [(set_attr "type" "sselog")
20768 (set_attr "prefix" "evex")
20769 (set_attr "mode" "<sseinsnmode>")])
20771 (define_insn "<avx512>_vpermt2var<mode>3_mask"
20772 [(set (match_operand:VPERMI2 0 "register_operand" "=v")
20775 [(match_operand:<sseintvecmode> 1 "register_operand" "v")
20776 (match_operand:VPERMI2 2 "register_operand" "0")
20777 (match_operand:VPERMI2 3 "nonimmediate_operand" "vm")]
20780 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
20782 "vpermt2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
20783 [(set_attr "type" "sselog")
20784 (set_attr "prefix" "evex")
20785 (set_attr "mode" "<sseinsnmode>")])
20787 (define_expand "avx_vperm2f128<mode>3"
20788 [(set (match_operand:AVX256MODE2P 0 "register_operand")
20789 (unspec:AVX256MODE2P
20790 [(match_operand:AVX256MODE2P 1 "register_operand")
20791 (match_operand:AVX256MODE2P 2 "nonimmediate_operand")
20792 (match_operand:SI 3 "const_0_to_255_operand")]
20793 UNSPEC_VPERMIL2F128))]
20796 int mask = INTVAL (operands[3]);
20797 if ((mask & 0x88) == 0)
20799 rtx perm[<ssescalarnum>], t1, t2;
20800 int i, base, nelt = <ssescalarnum>, nelt2 = nelt / 2;
20802 base = (mask & 3) * nelt2;
20803 for (i = 0; i < nelt2; ++i)
20804 perm[i] = GEN_INT (base + i);
20806 base = ((mask >> 4) & 3) * nelt2;
20807 for (i = 0; i < nelt2; ++i)
20808 perm[i + nelt2] = GEN_INT (base + i);
20810 t2 = gen_rtx_VEC_CONCAT (<ssedoublevecmode>mode,
20811 operands[1], operands[2]);
20812 t1 = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (nelt, perm));
20813 t2 = gen_rtx_VEC_SELECT (<MODE>mode, t2, t1);
20814 t2 = gen_rtx_SET (operands[0], t2);
20820 ;; Note that bits 7 and 3 of the imm8 allow lanes to be zeroed, which
20821 ;; means that in order to represent this properly in rtl we'd have to
20822 ;; nest *another* vec_concat with a zero operand and do the select from
20823 ;; a 4x wide vector. That doesn't seem very nice.
20824 (define_insn "*avx_vperm2f128<mode>_full"
20825 [(set (match_operand:AVX256MODE2P 0 "register_operand" "=x")
20826 (unspec:AVX256MODE2P
20827 [(match_operand:AVX256MODE2P 1 "register_operand" "x")
20828 (match_operand:AVX256MODE2P 2 "nonimmediate_operand" "xm")
20829 (match_operand:SI 3 "const_0_to_255_operand" "n")]
20830 UNSPEC_VPERMIL2F128))]
20832 "vperm2<i128>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
20833 [(set_attr "type" "sselog")
20834 (set_attr "prefix_extra" "1")
20835 (set_attr "length_immediate" "1")
20836 (set_attr "prefix" "vex")
20837 (set_attr "mode" "<sseinsnmode>")])
20839 (define_insn "*avx_vperm2f128<mode>_nozero"
20840 [(set (match_operand:AVX256MODE2P 0 "register_operand" "=x")
20841 (vec_select:AVX256MODE2P
20842 (vec_concat:<ssedoublevecmode>
20843 (match_operand:AVX256MODE2P 1 "register_operand" "x")
20844 (match_operand:AVX256MODE2P 2 "nonimmediate_operand" "xm"))
20845 (match_parallel 3 ""
20846 [(match_operand 4 "const_int_operand")])))]
20848 && avx_vperm2f128_parallel (operands[3], <MODE>mode)"
20850 int mask = avx_vperm2f128_parallel (operands[3], <MODE>mode) - 1;
20852 return "vinsert<i128>\t{$0, %x2, %1, %0|%0, %1, %x2, 0}";
20854 return "vinsert<i128>\t{$1, %x2, %1, %0|%0, %1, %x2, 1}";
20855 operands[3] = GEN_INT (mask);
20856 return "vperm2<i128>\t{%3, %2, %1, %0|%0, %1, %2, %3}";
20858 [(set_attr "type" "sselog")
20859 (set_attr "prefix_extra" "1")
20860 (set_attr "length_immediate" "1")
20861 (set_attr "prefix" "vex")
20862 (set_attr "mode" "<sseinsnmode>")])
20864 (define_insn "*ssse3_palignr<mode>_perm"
20865 [(set (match_operand:V_128 0 "register_operand" "=x,x,v")
20867 (match_operand:V_128 1 "register_operand" "0,x,v")
20868 (match_parallel 2 "palignr_operand"
20869 [(match_operand 3 "const_int_operand" "n,n,n")])))]
20872 operands[2] = (GEN_INT (INTVAL (operands[3])
20873 * GET_MODE_UNIT_SIZE (GET_MODE (operands[0]))));
20875 switch (which_alternative)
20878 return "palignr\t{%2, %1, %0|%0, %1, %2}";
20881 return "vpalignr\t{%2, %1, %1, %0|%0, %1, %1, %2}";
20883 gcc_unreachable ();
20886 [(set_attr "isa" "noavx,avx,avx512bw")
20887 (set_attr "type" "sseishft")
20888 (set_attr "atom_unit" "sishuf")
20889 (set_attr "prefix_data16" "1,*,*")
20890 (set_attr "prefix_extra" "1")
20891 (set_attr "length_immediate" "1")
20892 (set_attr "prefix" "orig,vex,evex")])
20894 (define_expand "avx512vl_vinsert<mode>"
20895 [(match_operand:VI48F_256 0 "register_operand")
20896 (match_operand:VI48F_256 1 "register_operand")
20897 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand")
20898 (match_operand:SI 3 "const_0_to_1_operand")
20899 (match_operand:VI48F_256 4 "register_operand")
20900 (match_operand:<avx512fmaskmode> 5 "register_operand")]
20903 rtx (*insn)(rtx, rtx, rtx, rtx, rtx);
20905 switch (INTVAL (operands[3]))
20908 insn = gen_vec_set_lo_<mode>_mask;
20911 insn = gen_vec_set_hi_<mode>_mask;
20914 gcc_unreachable ();
20917 emit_insn (insn (operands[0], operands[1], operands[2], operands[4],
20922 (define_expand "avx_vinsertf128<mode>"
20923 [(match_operand:V_256 0 "register_operand")
20924 (match_operand:V_256 1 "register_operand")
20925 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand")
20926 (match_operand:SI 3 "const_0_to_1_operand")]
20929 rtx (*insn)(rtx, rtx, rtx);
20931 switch (INTVAL (operands[3]))
20934 insn = gen_vec_set_lo_<mode>;
20937 insn = gen_vec_set_hi_<mode>;
20940 gcc_unreachable ();
20943 emit_insn (insn (operands[0], operands[1], operands[2]));
20947 (define_insn "vec_set_lo_<mode><mask_name>"
20948 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
20949 (vec_concat:VI8F_256
20950 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
20951 (vec_select:<ssehalfvecmode>
20952 (match_operand:VI8F_256 1 "register_operand" "v")
20953 (parallel [(const_int 2) (const_int 3)]))))]
20954 "TARGET_AVX && <mask_avx512dq_condition>"
20956 if (TARGET_AVX512DQ)
20957 return "vinsert<shuffletype>64x2\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}";
20958 else if (TARGET_AVX512VL)
20959 return "vinsert<shuffletype>32x4\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}";
20961 return "vinsert<i128>\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}";
20963 [(set_attr "type" "sselog")
20964 (set_attr "prefix_extra" "1")
20965 (set_attr "length_immediate" "1")
20966 (set_attr "prefix" "vex")
20967 (set_attr "mode" "<sseinsnmode>")])
20969 (define_insn "vec_set_hi_<mode><mask_name>"
20970 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
20971 (vec_concat:VI8F_256
20972 (vec_select:<ssehalfvecmode>
20973 (match_operand:VI8F_256 1 "register_operand" "v")
20974 (parallel [(const_int 0) (const_int 1)]))
20975 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
20976 "TARGET_AVX && <mask_avx512dq_condition>"
20978 if (TARGET_AVX512DQ)
20979 return "vinsert<shuffletype>64x2\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}";
20980 else if (TARGET_AVX512VL)
20981 return "vinsert<shuffletype>32x4\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}";
20983 return "vinsert<i128>\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}";
20985 [(set_attr "type" "sselog")
20986 (set_attr "prefix_extra" "1")
20987 (set_attr "length_immediate" "1")
20988 (set_attr "prefix" "vex")
20989 (set_attr "mode" "<sseinsnmode>")])
20991 (define_insn "vec_set_lo_<mode><mask_name>"
20992 [(set (match_operand:VI4F_256 0 "register_operand" "=v")
20993 (vec_concat:VI4F_256
20994 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
20995 (vec_select:<ssehalfvecmode>
20996 (match_operand:VI4F_256 1 "register_operand" "v")
20997 (parallel [(const_int 4) (const_int 5)
20998 (const_int 6) (const_int 7)]))))]
21001 if (TARGET_AVX512VL)
21002 return "vinsert<shuffletype>32x4\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}";
21004 return "vinsert<i128>\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}";
21006 [(set_attr "type" "sselog")
21007 (set_attr "prefix_extra" "1")
21008 (set_attr "length_immediate" "1")
21009 (set_attr "prefix" "vex")
21010 (set_attr "mode" "<sseinsnmode>")])
21012 (define_insn "vec_set_hi_<mode><mask_name>"
21013 [(set (match_operand:VI4F_256 0 "register_operand" "=v")
21014 (vec_concat:VI4F_256
21015 (vec_select:<ssehalfvecmode>
21016 (match_operand:VI4F_256 1 "register_operand" "v")
21017 (parallel [(const_int 0) (const_int 1)
21018 (const_int 2) (const_int 3)]))
21019 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
21022 if (TARGET_AVX512VL)
21023 return "vinsert<shuffletype>32x4\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}";
21025 return "vinsert<i128>\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}";
21027 [(set_attr "type" "sselog")
21028 (set_attr "prefix_extra" "1")
21029 (set_attr "length_immediate" "1")
21030 (set_attr "prefix" "vex")
21031 (set_attr "mode" "<sseinsnmode>")])
21033 (define_insn "vec_set_lo_v16hi"
21034 [(set (match_operand:V16HI 0 "register_operand" "=x,v")
21036 (match_operand:V8HI 2 "nonimmediate_operand" "xm,vm")
21038 (match_operand:V16HI 1 "register_operand" "x,v")
21039 (parallel [(const_int 8) (const_int 9)
21040 (const_int 10) (const_int 11)
21041 (const_int 12) (const_int 13)
21042 (const_int 14) (const_int 15)]))))]
21045 vinsert%~128\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}
21046 vinserti32x4\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}"
21047 [(set_attr "type" "sselog")
21048 (set_attr "prefix_extra" "1")
21049 (set_attr "length_immediate" "1")
21050 (set_attr "prefix" "vex,evex")
21051 (set_attr "mode" "OI")])
21053 (define_insn "vec_set_hi_v16hi"
21054 [(set (match_operand:V16HI 0 "register_operand" "=x,v")
21057 (match_operand:V16HI 1 "register_operand" "x,v")
21058 (parallel [(const_int 0) (const_int 1)
21059 (const_int 2) (const_int 3)
21060 (const_int 4) (const_int 5)
21061 (const_int 6) (const_int 7)]))
21062 (match_operand:V8HI 2 "nonimmediate_operand" "xm,vm")))]
21065 vinsert%~128\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}
21066 vinserti32x4\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}"
21067 [(set_attr "type" "sselog")
21068 (set_attr "prefix_extra" "1")
21069 (set_attr "length_immediate" "1")
21070 (set_attr "prefix" "vex,evex")
21071 (set_attr "mode" "OI")])
21073 (define_insn "vec_set_lo_v32qi"
21074 [(set (match_operand:V32QI 0 "register_operand" "=x,v")
21076 (match_operand:V16QI 2 "nonimmediate_operand" "xm,v")
21078 (match_operand:V32QI 1 "register_operand" "x,v")
21079 (parallel [(const_int 16) (const_int 17)
21080 (const_int 18) (const_int 19)
21081 (const_int 20) (const_int 21)
21082 (const_int 22) (const_int 23)
21083 (const_int 24) (const_int 25)
21084 (const_int 26) (const_int 27)
21085 (const_int 28) (const_int 29)
21086 (const_int 30) (const_int 31)]))))]
21089 vinsert%~128\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}
21090 vinserti32x4\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}"
21091 [(set_attr "type" "sselog")
21092 (set_attr "prefix_extra" "1")
21093 (set_attr "length_immediate" "1")
21094 (set_attr "prefix" "vex,evex")
21095 (set_attr "mode" "OI")])
21097 (define_insn "vec_set_hi_v32qi"
21098 [(set (match_operand:V32QI 0 "register_operand" "=x,v")
21101 (match_operand:V32QI 1 "register_operand" "x,v")
21102 (parallel [(const_int 0) (const_int 1)
21103 (const_int 2) (const_int 3)
21104 (const_int 4) (const_int 5)
21105 (const_int 6) (const_int 7)
21106 (const_int 8) (const_int 9)
21107 (const_int 10) (const_int 11)
21108 (const_int 12) (const_int 13)
21109 (const_int 14) (const_int 15)]))
21110 (match_operand:V16QI 2 "nonimmediate_operand" "xm,vm")))]
21113 vinsert%~128\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}
21114 vinserti32x4\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}"
21115 [(set_attr "type" "sselog")
21116 (set_attr "prefix_extra" "1")
21117 (set_attr "length_immediate" "1")
21118 (set_attr "prefix" "vex,evex")
21119 (set_attr "mode" "OI")])
21121 (define_insn "<avx_avx2>_maskload<ssemodesuffix><avxsizesuffix>"
21122 [(set (match_operand:V48_AVX2 0 "register_operand" "=x")
21124 [(match_operand:<sseintvecmode> 2 "register_operand" "x")
21125 (match_operand:V48_AVX2 1 "memory_operand" "m")]
21128 "v<sseintprefix>maskmov<ssemodesuffix>\t{%1, %2, %0|%0, %2, %1}"
21129 [(set_attr "type" "sselog1")
21130 (set_attr "prefix_extra" "1")
21131 (set_attr "prefix" "vex")
21132 (set_attr "btver2_decode" "vector")
21133 (set_attr "mode" "<sseinsnmode>")])
21135 (define_insn "<avx_avx2>_maskstore<ssemodesuffix><avxsizesuffix>"
21136 [(set (match_operand:V48_AVX2 0 "memory_operand" "+m")
21138 [(match_operand:<sseintvecmode> 1 "register_operand" "x")
21139 (match_operand:V48_AVX2 2 "register_operand" "x")
21143 "v<sseintprefix>maskmov<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
21144 [(set_attr "type" "sselog1")
21145 (set_attr "prefix_extra" "1")
21146 (set_attr "prefix" "vex")
21147 (set_attr "btver2_decode" "vector")
21148 (set_attr "mode" "<sseinsnmode>")])
21150 (define_expand "maskload<mode><sseintvecmodelower>"
21151 [(set (match_operand:V48_AVX2 0 "register_operand")
21153 [(match_operand:<sseintvecmode> 2 "register_operand")
21154 (match_operand:V48_AVX2 1 "memory_operand")]
21158 (define_expand "maskload<mode><avx512fmaskmodelower>"
21159 [(set (match_operand:V48_AVX512VL 0 "register_operand")
21160 (vec_merge:V48_AVX512VL
21161 (match_operand:V48_AVX512VL 1 "memory_operand")
21163 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
21166 (define_expand "maskload<mode><avx512fmaskmodelower>"
21167 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
21168 (vec_merge:VI12_AVX512VL
21169 (match_operand:VI12_AVX512VL 1 "memory_operand")
21171 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
21174 (define_expand "maskstore<mode><sseintvecmodelower>"
21175 [(set (match_operand:V48_AVX2 0 "memory_operand")
21177 [(match_operand:<sseintvecmode> 2 "register_operand")
21178 (match_operand:V48_AVX2 1 "register_operand")
21183 (define_expand "maskstore<mode><avx512fmaskmodelower>"
21184 [(set (match_operand:V48_AVX512VL 0 "memory_operand")
21185 (vec_merge:V48_AVX512VL
21186 (match_operand:V48_AVX512VL 1 "register_operand")
21188 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
21191 (define_expand "maskstore<mode><avx512fmaskmodelower>"
21192 [(set (match_operand:VI12_AVX512VL 0 "memory_operand")
21193 (vec_merge:VI12_AVX512VL
21194 (match_operand:VI12_AVX512VL 1 "register_operand")
21196 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
21199 (define_expand "cbranch<mode>4"
21200 [(set (reg:CC FLAGS_REG)
21201 (compare:CC (match_operand:VI48_AVX 1 "register_operand")
21202 (match_operand:VI48_AVX 2 "nonimmediate_operand")))
21203 (set (pc) (if_then_else
21204 (match_operator 0 "bt_comparison_operator"
21205 [(reg:CC FLAGS_REG) (const_int 0)])
21206 (label_ref (match_operand 3))
21210 ix86_expand_branch (GET_CODE (operands[0]),
21211 operands[1], operands[2], operands[3]);
21216 (define_insn_and_split "avx_<castmode><avxsizesuffix>_<castmode>"
21217 [(set (match_operand:AVX256MODE2P 0 "nonimmediate_operand" "=x,m")
21218 (vec_concat:AVX256MODE2P
21219 (match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "xm,x")
21220 (unspec:<ssehalfvecmode> [(const_int 0)] UNSPEC_CAST)))]
21221 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
21223 "&& reload_completed"
21224 [(set (match_dup 0) (match_dup 1))]
21226 if (REG_P (operands[0]))
21227 operands[0] = gen_lowpart (<ssehalfvecmode>mode, operands[0]);
21229 operands[1] = lowpart_subreg (<MODE>mode, operands[1],
21230 <ssehalfvecmode>mode);
21233 ;; Modes handled by vec_init expanders.
21234 (define_mode_iterator VEC_INIT_MODE
21235 [(V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI
21236 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX") V8HI
21237 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
21238 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI
21239 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
21240 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")
21241 (V4TI "TARGET_AVX512F") (V2TI "TARGET_AVX")])
21243 ;; Likewise, but for initialization from half sized vectors.
21244 ;; Thus, these are all VEC_INIT_MODE modes except V2??.
21245 (define_mode_iterator VEC_INIT_HALF_MODE
21246 [(V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI
21247 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX") V8HI
21248 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
21249 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX")
21250 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
21251 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX")
21252 (V4TI "TARGET_AVX512F")])
21254 (define_expand "vec_init<mode><ssescalarmodelower>"
21255 [(match_operand:VEC_INIT_MODE 0 "register_operand")
21259 ix86_expand_vector_init (false, operands[0], operands[1]);
21263 (define_expand "vec_init<mode><ssehalfvecmodelower>"
21264 [(match_operand:VEC_INIT_HALF_MODE 0 "register_operand")
21268 ix86_expand_vector_init (false, operands[0], operands[1]);
21272 (define_insn "<avx2_avx512>_ashrv<mode><mask_name>"
21273 [(set (match_operand:VI48_AVX512F_AVX512VL 0 "register_operand" "=v")
21274 (ashiftrt:VI48_AVX512F_AVX512VL
21275 (match_operand:VI48_AVX512F_AVX512VL 1 "register_operand" "v")
21276 (match_operand:VI48_AVX512F_AVX512VL 2 "nonimmediate_operand" "vm")))]
21277 "TARGET_AVX2 && <mask_mode512bit_condition>"
21278 "vpsrav<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
21279 [(set_attr "type" "sseishft")
21280 (set_attr "prefix" "maybe_evex")
21281 (set_attr "mode" "<sseinsnmode>")])
21283 (define_insn "<avx2_avx512>_ashrv<mode><mask_name>"
21284 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
21285 (ashiftrt:VI2_AVX512VL
21286 (match_operand:VI2_AVX512VL 1 "register_operand" "v")
21287 (match_operand:VI2_AVX512VL 2 "nonimmediate_operand" "vm")))]
21289 "vpsravw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
21290 [(set_attr "type" "sseishft")
21291 (set_attr "prefix" "maybe_evex")
21292 (set_attr "mode" "<sseinsnmode>")])
21294 (define_insn "<avx2_avx512>_<shift_insn>v<mode><mask_name>"
21295 [(set (match_operand:VI48_AVX512F 0 "register_operand" "=v")
21296 (any_lshift:VI48_AVX512F
21297 (match_operand:VI48_AVX512F 1 "register_operand" "v")
21298 (match_operand:VI48_AVX512F 2 "nonimmediate_operand" "vm")))]
21299 "TARGET_AVX2 && <mask_mode512bit_condition>"
21300 "vp<vshift>v<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
21301 [(set_attr "type" "sseishft")
21302 (set_attr "prefix" "maybe_evex")
21303 (set_attr "mode" "<sseinsnmode>")])
21305 (define_insn "<avx2_avx512>_<shift_insn>v<mode><mask_name>"
21306 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
21307 (any_lshift:VI2_AVX512VL
21308 (match_operand:VI2_AVX512VL 1 "register_operand" "v")
21309 (match_operand:VI2_AVX512VL 2 "nonimmediate_operand" "vm")))]
21311 "vp<vshift>v<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
21312 [(set_attr "type" "sseishft")
21313 (set_attr "prefix" "maybe_evex")
21314 (set_attr "mode" "<sseinsnmode>")])
21316 (define_insn "avx_vec_concat<mode>"
21317 [(set (match_operand:V_256_512 0 "register_operand" "=x,v,x,Yv")
21318 (vec_concat:V_256_512
21319 (match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "x,v,xm,vm")
21320 (match_operand:<ssehalfvecmode> 2 "nonimm_or_0_operand" "xm,vm,C,C")))]
21322 && (operands[2] == CONST0_RTX (<ssehalfvecmode>mode)
21323 || !MEM_P (operands[1]))"
21325 switch (which_alternative)
21328 return "vinsert<i128>\t{$0x1, %2, %<xtg_mode>1, %0|%0, %<xtg_mode>1, %2, 0x1}";
21330 if (<MODE_SIZE> == 64)
21332 if (TARGET_AVX512DQ && GET_MODE_SIZE (<ssescalarmode>mode) == 4)
21333 return "vinsert<shuffletype>32x8\t{$0x1, %2, %<xtg_mode>1, %0|%0, %<xtg_mode>1, %2, 0x1}";
21335 return "vinsert<shuffletype>64x4\t{$0x1, %2, %<xtg_mode>1, %0|%0, %<xtg_mode>1, %2, 0x1}";
21339 if (TARGET_AVX512DQ && GET_MODE_SIZE (<ssescalarmode>mode) == 8)
21340 return "vinsert<shuffletype>64x2\t{$0x1, %2, %<xtg_mode>1, %0|%0, %<xtg_mode>1, %2, 0x1}";
21342 return "vinsert<shuffletype>32x4\t{$0x1, %2, %<xtg_mode>1, %0|%0, %<xtg_mode>1, %2, 0x1}";
21346 switch (get_attr_mode (insn))
21349 if (misaligned_operand (operands[1], <ssehalfvecmode>mode))
21350 return "vmovups\t{%1, %t0|%t0, %1}";
21352 return "vmovaps\t{%1, %t0|%t0, %1}";
21354 if (misaligned_operand (operands[1], <ssehalfvecmode>mode))
21355 return "vmovupd\t{%1, %t0|%t0, %1}";
21357 return "vmovapd\t{%1, %t0|%t0, %1}";
21359 if (misaligned_operand (operands[1], <ssehalfvecmode>mode))
21360 return "vmovups\t{%1, %x0|%x0, %1}";
21362 return "vmovaps\t{%1, %x0|%x0, %1}";
21364 if (misaligned_operand (operands[1], <ssehalfvecmode>mode))
21365 return "vmovupd\t{%1, %x0|%x0, %1}";
21367 return "vmovapd\t{%1, %x0|%x0, %1}";
21369 if (misaligned_operand (operands[1], <ssehalfvecmode>mode))
21371 if (which_alternative == 2)
21372 return "vmovdqu\t{%1, %t0|%t0, %1}";
21373 else if (GET_MODE_SIZE (<ssescalarmode>mode) == 8)
21374 return "vmovdqu64\t{%1, %t0|%t0, %1}";
21376 return "vmovdqu32\t{%1, %t0|%t0, %1}";
21380 if (which_alternative == 2)
21381 return "vmovdqa\t{%1, %t0|%t0, %1}";
21382 else if (GET_MODE_SIZE (<ssescalarmode>mode) == 8)
21383 return "vmovdqa64\t{%1, %t0|%t0, %1}";
21385 return "vmovdqa32\t{%1, %t0|%t0, %1}";
21388 if (misaligned_operand (operands[1], <ssehalfvecmode>mode))
21390 if (which_alternative == 2)
21391 return "vmovdqu\t{%1, %x0|%x0, %1}";
21392 else if (GET_MODE_SIZE (<ssescalarmode>mode) == 8)
21393 return "vmovdqu64\t{%1, %x0|%x0, %1}";
21395 return "vmovdqu32\t{%1, %x0|%x0, %1}";
21399 if (which_alternative == 2)
21400 return "vmovdqa\t{%1, %x0|%x0, %1}";
21401 else if (GET_MODE_SIZE (<ssescalarmode>mode) == 8)
21402 return "vmovdqa64\t{%1, %x0|%x0, %1}";
21404 return "vmovdqa32\t{%1, %x0|%x0, %1}";
21407 gcc_unreachable ();
21410 gcc_unreachable ();
21413 [(set_attr "type" "sselog,sselog,ssemov,ssemov")
21414 (set_attr "prefix_extra" "1,1,*,*")
21415 (set_attr "length_immediate" "1,1,*,*")
21416 (set_attr "prefix" "maybe_evex")
21417 (set_attr "mode" "<sseinsnmode>")])
21419 (define_insn "vcvtph2ps<mask_name>"
21420 [(set (match_operand:V4SF 0 "register_operand" "=v")
21422 (unspec:V8SF [(match_operand:V8HI 1 "register_operand" "v")]
21424 (parallel [(const_int 0) (const_int 1)
21425 (const_int 2) (const_int 3)])))]
21426 "TARGET_F16C || TARGET_AVX512VL"
21427 "vcvtph2ps\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
21428 [(set_attr "type" "ssecvt")
21429 (set_attr "prefix" "maybe_evex")
21430 (set_attr "mode" "V4SF")])
21432 (define_insn "*vcvtph2ps_load<mask_name>"
21433 [(set (match_operand:V4SF 0 "register_operand" "=v")
21434 (unspec:V4SF [(match_operand:V4HI 1 "memory_operand" "m")]
21435 UNSPEC_VCVTPH2PS))]
21436 "TARGET_F16C || TARGET_AVX512VL"
21437 "vcvtph2ps\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
21438 [(set_attr "type" "ssecvt")
21439 (set_attr "prefix" "vex")
21440 (set_attr "mode" "V8SF")])
21442 (define_insn "vcvtph2ps256<mask_name>"
21443 [(set (match_operand:V8SF 0 "register_operand" "=v")
21444 (unspec:V8SF [(match_operand:V8HI 1 "nonimmediate_operand" "vm")]
21445 UNSPEC_VCVTPH2PS))]
21446 "TARGET_F16C || TARGET_AVX512VL"
21447 "vcvtph2ps\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
21448 [(set_attr "type" "ssecvt")
21449 (set_attr "prefix" "vex")
21450 (set_attr "btver2_decode" "double")
21451 (set_attr "mode" "V8SF")])
21453 (define_insn "<mask_codefor>avx512f_vcvtph2ps512<mask_name><round_saeonly_name>"
21454 [(set (match_operand:V16SF 0 "register_operand" "=v")
21456 [(match_operand:V16HI 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
21457 UNSPEC_VCVTPH2PS))]
21459 "vcvtph2ps\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
21460 [(set_attr "type" "ssecvt")
21461 (set_attr "prefix" "evex")
21462 (set_attr "mode" "V16SF")])
21464 (define_expand "vcvtps2ph_mask"
21465 [(set (match_operand:V8HI 0 "register_operand")
21468 (unspec:V4HI [(match_operand:V4SF 1 "register_operand")
21469 (match_operand:SI 2 "const_0_to_255_operand")]
21472 (match_operand:V8HI 3 "nonimm_or_0_operand")
21473 (match_operand:QI 4 "register_operand")))]
21475 "operands[5] = CONST0_RTX (V4HImode);")
21477 (define_expand "vcvtps2ph"
21478 [(set (match_operand:V8HI 0 "register_operand")
21480 (unspec:V4HI [(match_operand:V4SF 1 "register_operand")
21481 (match_operand:SI 2 "const_0_to_255_operand")]
21485 "operands[3] = CONST0_RTX (V4HImode);")
21487 (define_insn "*vcvtps2ph<mask_name>"
21488 [(set (match_operand:V8HI 0 "register_operand" "=v")
21490 (unspec:V4HI [(match_operand:V4SF 1 "register_operand" "v")
21491 (match_operand:SI 2 "const_0_to_255_operand" "N")]
21493 (match_operand:V4HI 3 "const0_operand")))]
21494 "(TARGET_F16C || TARGET_AVX512VL) && <mask_avx512vl_condition>"
21495 "vcvtps2ph\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}"
21496 [(set_attr "type" "ssecvt")
21497 (set_attr "prefix" "maybe_evex")
21498 (set_attr "mode" "V4SF")])
21500 (define_insn "*vcvtps2ph_store<mask_name>"
21501 [(set (match_operand:V4HI 0 "memory_operand" "=m")
21502 (unspec:V4HI [(match_operand:V4SF 1 "register_operand" "v")
21503 (match_operand:SI 2 "const_0_to_255_operand" "N")]
21504 UNSPEC_VCVTPS2PH))]
21505 "TARGET_F16C || TARGET_AVX512VL"
21506 "vcvtps2ph\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
21507 [(set_attr "type" "ssecvt")
21508 (set_attr "prefix" "maybe_evex")
21509 (set_attr "mode" "V4SF")])
21511 (define_insn "vcvtps2ph256<mask_name>"
21512 [(set (match_operand:V8HI 0 "nonimmediate_operand" "=vm")
21513 (unspec:V8HI [(match_operand:V8SF 1 "register_operand" "v")
21514 (match_operand:SI 2 "const_0_to_255_operand" "N")]
21515 UNSPEC_VCVTPS2PH))]
21516 "TARGET_F16C || TARGET_AVX512VL"
21517 "vcvtps2ph\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
21518 [(set_attr "type" "ssecvt")
21519 (set_attr "prefix" "maybe_evex")
21520 (set_attr "btver2_decode" "vector")
21521 (set_attr "mode" "V8SF")])
21523 (define_insn "<mask_codefor>avx512f_vcvtps2ph512<mask_name>"
21524 [(set (match_operand:V16HI 0 "nonimmediate_operand" "=vm")
21526 [(match_operand:V16SF 1 "register_operand" "v")
21527 (match_operand:SI 2 "const_0_to_255_operand" "N")]
21528 UNSPEC_VCVTPS2PH))]
21530 "vcvtps2ph\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
21531 [(set_attr "type" "ssecvt")
21532 (set_attr "prefix" "evex")
21533 (set_attr "mode" "V16SF")])
21535 ;; For gather* insn patterns
21536 (define_mode_iterator VEC_GATHER_MODE
21537 [V2DI V2DF V4DI V4DF V4SI V4SF V8SI V8SF])
21538 (define_mode_attr VEC_GATHER_IDXSI
21539 [(V2DI "V4SI") (V4DI "V4SI") (V8DI "V8SI")
21540 (V2DF "V4SI") (V4DF "V4SI") (V8DF "V8SI")
21541 (V4SI "V4SI") (V8SI "V8SI") (V16SI "V16SI")
21542 (V4SF "V4SI") (V8SF "V8SI") (V16SF "V16SI")])
21544 (define_mode_attr VEC_GATHER_IDXDI
21545 [(V2DI "V2DI") (V4DI "V4DI") (V8DI "V8DI")
21546 (V2DF "V2DI") (V4DF "V4DI") (V8DF "V8DI")
21547 (V4SI "V2DI") (V8SI "V4DI") (V16SI "V8DI")
21548 (V4SF "V2DI") (V8SF "V4DI") (V16SF "V8DI")])
21550 (define_mode_attr VEC_GATHER_SRCDI
21551 [(V2DI "V2DI") (V4DI "V4DI") (V8DI "V8DI")
21552 (V2DF "V2DF") (V4DF "V4DF") (V8DF "V8DF")
21553 (V4SI "V4SI") (V8SI "V4SI") (V16SI "V8SI")
21554 (V4SF "V4SF") (V8SF "V4SF") (V16SF "V8SF")])
21556 (define_expand "avx2_gathersi<mode>"
21557 [(parallel [(set (match_operand:VEC_GATHER_MODE 0 "register_operand")
21558 (unspec:VEC_GATHER_MODE
21559 [(match_operand:VEC_GATHER_MODE 1 "register_operand")
21560 (mem:<ssescalarmode>
21562 [(match_operand 2 "vsib_address_operand")
21563 (match_operand:<VEC_GATHER_IDXSI>
21564 3 "register_operand")
21565 (match_operand:SI 5 "const1248_operand ")]))
21566 (mem:BLK (scratch))
21567 (match_operand:VEC_GATHER_MODE 4 "register_operand")]
21569 (clobber (match_scratch:VEC_GATHER_MODE 7))])]
21573 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
21574 operands[5]), UNSPEC_VSIBADDR);
21577 (define_insn "*avx2_gathersi<VEC_GATHER_MODE:mode>"
21578 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
21579 (unspec:VEC_GATHER_MODE
21580 [(match_operand:VEC_GATHER_MODE 2 "register_operand" "0")
21581 (match_operator:<ssescalarmode> 7 "vsib_mem_operator"
21583 [(match_operand:P 3 "vsib_address_operand" "Tv")
21584 (match_operand:<VEC_GATHER_IDXSI> 4 "register_operand" "x")
21585 (match_operand:SI 6 "const1248_operand" "n")]
21587 (mem:BLK (scratch))
21588 (match_operand:VEC_GATHER_MODE 5 "register_operand" "1")]
21590 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
21592 "%M3v<sseintprefix>gatherd<ssemodesuffix>\t{%1, %7, %0|%0, %7, %1}"
21593 [(set_attr "type" "ssemov")
21594 (set_attr "prefix" "vex")
21595 (set_attr "mode" "<sseinsnmode>")])
21597 (define_insn "*avx2_gathersi<VEC_GATHER_MODE:mode>_2"
21598 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
21599 (unspec:VEC_GATHER_MODE
21601 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
21603 [(match_operand:P 2 "vsib_address_operand" "Tv")
21604 (match_operand:<VEC_GATHER_IDXSI> 3 "register_operand" "x")
21605 (match_operand:SI 5 "const1248_operand" "n")]
21607 (mem:BLK (scratch))
21608 (match_operand:VEC_GATHER_MODE 4 "register_operand" "1")]
21610 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
21612 "%M2v<sseintprefix>gatherd<ssemodesuffix>\t{%1, %6, %0|%0, %6, %1}"
21613 [(set_attr "type" "ssemov")
21614 (set_attr "prefix" "vex")
21615 (set_attr "mode" "<sseinsnmode>")])
21617 (define_expand "avx2_gatherdi<mode>"
21618 [(parallel [(set (match_operand:VEC_GATHER_MODE 0 "register_operand")
21619 (unspec:VEC_GATHER_MODE
21620 [(match_operand:<VEC_GATHER_SRCDI> 1 "register_operand")
21621 (mem:<ssescalarmode>
21623 [(match_operand 2 "vsib_address_operand")
21624 (match_operand:<VEC_GATHER_IDXDI>
21625 3 "register_operand")
21626 (match_operand:SI 5 "const1248_operand ")]))
21627 (mem:BLK (scratch))
21628 (match_operand:<VEC_GATHER_SRCDI> 4 "register_operand")]
21630 (clobber (match_scratch:VEC_GATHER_MODE 7))])]
21634 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
21635 operands[5]), UNSPEC_VSIBADDR);
21638 (define_insn "*avx2_gatherdi<VEC_GATHER_MODE:mode>"
21639 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
21640 (unspec:VEC_GATHER_MODE
21641 [(match_operand:<VEC_GATHER_SRCDI> 2 "register_operand" "0")
21642 (match_operator:<ssescalarmode> 7 "vsib_mem_operator"
21644 [(match_operand:P 3 "vsib_address_operand" "Tv")
21645 (match_operand:<VEC_GATHER_IDXDI> 4 "register_operand" "x")
21646 (match_operand:SI 6 "const1248_operand" "n")]
21648 (mem:BLK (scratch))
21649 (match_operand:<VEC_GATHER_SRCDI> 5 "register_operand" "1")]
21651 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
21653 "%M3v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %7, %2|%2, %7, %5}"
21654 [(set_attr "type" "ssemov")
21655 (set_attr "prefix" "vex")
21656 (set_attr "mode" "<sseinsnmode>")])
21658 (define_insn "*avx2_gatherdi<VEC_GATHER_MODE:mode>_2"
21659 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
21660 (unspec:VEC_GATHER_MODE
21662 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
21664 [(match_operand:P 2 "vsib_address_operand" "Tv")
21665 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand" "x")
21666 (match_operand:SI 5 "const1248_operand" "n")]
21668 (mem:BLK (scratch))
21669 (match_operand:<VEC_GATHER_SRCDI> 4 "register_operand" "1")]
21671 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
21674 if (<VEC_GATHER_MODE:MODE>mode != <VEC_GATHER_SRCDI>mode)
21675 return "%M2v<sseintprefix>gatherq<ssemodesuffix>\t{%4, %6, %x0|%x0, %6, %4}";
21676 return "%M2v<sseintprefix>gatherq<ssemodesuffix>\t{%4, %6, %0|%0, %6, %4}";
21678 [(set_attr "type" "ssemov")
21679 (set_attr "prefix" "vex")
21680 (set_attr "mode" "<sseinsnmode>")])
21682 (define_insn "*avx2_gatherdi<VI4F_256:mode>_3"
21683 [(set (match_operand:<VEC_GATHER_SRCDI> 0 "register_operand" "=&x")
21684 (vec_select:<VEC_GATHER_SRCDI>
21686 [(match_operand:<VEC_GATHER_SRCDI> 2 "register_operand" "0")
21687 (match_operator:<ssescalarmode> 7 "vsib_mem_operator"
21689 [(match_operand:P 3 "vsib_address_operand" "Tv")
21690 (match_operand:<VEC_GATHER_IDXDI> 4 "register_operand" "x")
21691 (match_operand:SI 6 "const1248_operand" "n")]
21693 (mem:BLK (scratch))
21694 (match_operand:<VEC_GATHER_SRCDI> 5 "register_operand" "1")]
21696 (parallel [(const_int 0) (const_int 1)
21697 (const_int 2) (const_int 3)])))
21698 (clobber (match_scratch:VI4F_256 1 "=&x"))]
21700 "%M3v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %7, %0|%0, %7, %5}"
21701 [(set_attr "type" "ssemov")
21702 (set_attr "prefix" "vex")
21703 (set_attr "mode" "<sseinsnmode>")])
21705 (define_insn "*avx2_gatherdi<VI4F_256:mode>_4"
21706 [(set (match_operand:<VEC_GATHER_SRCDI> 0 "register_operand" "=&x")
21707 (vec_select:<VEC_GATHER_SRCDI>
21710 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
21712 [(match_operand:P 2 "vsib_address_operand" "Tv")
21713 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand" "x")
21714 (match_operand:SI 5 "const1248_operand" "n")]
21716 (mem:BLK (scratch))
21717 (match_operand:<VEC_GATHER_SRCDI> 4 "register_operand" "1")]
21719 (parallel [(const_int 0) (const_int 1)
21720 (const_int 2) (const_int 3)])))
21721 (clobber (match_scratch:VI4F_256 1 "=&x"))]
21723 "%M2v<sseintprefix>gatherq<ssemodesuffix>\t{%4, %6, %0|%0, %6, %4}"
21724 [(set_attr "type" "ssemov")
21725 (set_attr "prefix" "vex")
21726 (set_attr "mode" "<sseinsnmode>")])
21728 (define_expand "<avx512>_gathersi<mode>"
21729 [(parallel [(set (match_operand:VI48F 0 "register_operand")
21731 [(match_operand:VI48F 1 "register_operand")
21732 (match_operand:<avx512fmaskmode> 4 "register_operand")
21733 (mem:<ssescalarmode>
21735 [(match_operand 2 "vsib_address_operand")
21736 (match_operand:<VEC_GATHER_IDXSI> 3 "register_operand")
21737 (match_operand:SI 5 "const1248_operand")]))]
21739 (clobber (match_scratch:<avx512fmaskmode> 7))])]
21743 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
21744 operands[5]), UNSPEC_VSIBADDR);
21747 (define_insn "*avx512f_gathersi<VI48F:mode>"
21748 [(set (match_operand:VI48F 0 "register_operand" "=&v")
21750 [(match_operand:VI48F 1 "register_operand" "0")
21751 (match_operand:<avx512fmaskmode> 7 "register_operand" "2")
21752 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
21754 [(match_operand:P 4 "vsib_address_operand" "Tv")
21755 (match_operand:<VEC_GATHER_IDXSI> 3 "register_operand" "v")
21756 (match_operand:SI 5 "const1248_operand" "n")]
21757 UNSPEC_VSIBADDR)])]
21759 (clobber (match_scratch:<avx512fmaskmode> 2 "=&Yk"))]
21761 ;; %X6 so that we don't emit any *WORD PTR for -masm=intel, as
21762 ;; gas changed what it requires incompatibly.
21763 "%M4v<sseintprefix>gatherd<ssemodesuffix>\t{%6, %0%{%2%}|%0%{%2%}, %X6}"
21764 [(set_attr "type" "ssemov")
21765 (set_attr "prefix" "evex")
21766 (set_attr "mode" "<sseinsnmode>")])
21768 (define_insn "*avx512f_gathersi<VI48F:mode>_2"
21769 [(set (match_operand:VI48F 0 "register_operand" "=&v")
21772 (match_operand:<avx512fmaskmode> 6 "register_operand" "1")
21773 (match_operator:<ssescalarmode> 5 "vsib_mem_operator"
21775 [(match_operand:P 3 "vsib_address_operand" "Tv")
21776 (match_operand:<VEC_GATHER_IDXSI> 2 "register_operand" "v")
21777 (match_operand:SI 4 "const1248_operand" "n")]
21778 UNSPEC_VSIBADDR)])]
21780 (clobber (match_scratch:<avx512fmaskmode> 1 "=&Yk"))]
21782 ;; %X5 so that we don't emit any *WORD PTR for -masm=intel, as
21783 ;; gas changed what it requires incompatibly.
21784 "%M3v<sseintprefix>gatherd<ssemodesuffix>\t{%5, %0%{%1%}|%0%{%1%}, %X5}"
21785 [(set_attr "type" "ssemov")
21786 (set_attr "prefix" "evex")
21787 (set_attr "mode" "<sseinsnmode>")])
21790 (define_expand "<avx512>_gatherdi<mode>"
21791 [(parallel [(set (match_operand:VI48F 0 "register_operand")
21793 [(match_operand:<VEC_GATHER_SRCDI> 1 "register_operand")
21794 (match_operand:QI 4 "register_operand")
21795 (mem:<ssescalarmode>
21797 [(match_operand 2 "vsib_address_operand")
21798 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand")
21799 (match_operand:SI 5 "const1248_operand")]))]
21801 (clobber (match_scratch:QI 7))])]
21805 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
21806 operands[5]), UNSPEC_VSIBADDR);
21809 (define_insn "*avx512f_gatherdi<VI48F:mode>"
21810 [(set (match_operand:VI48F 0 "register_operand" "=&v")
21812 [(match_operand:<VEC_GATHER_SRCDI> 1 "register_operand" "0")
21813 (match_operand:QI 7 "register_operand" "2")
21814 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
21816 [(match_operand:P 4 "vsib_address_operand" "Tv")
21817 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand" "v")
21818 (match_operand:SI 5 "const1248_operand" "n")]
21819 UNSPEC_VSIBADDR)])]
21821 (clobber (match_scratch:QI 2 "=&Yk"))]
21823 ;; %X6 so that we don't emit any *WORD PTR for -masm=intel, as
21824 ;; gas changed what it requires incompatibly.
21825 "%M4v<sseintprefix>gatherq<ssemodesuffix>\t{%6, %1%{%2%}|%1%{%2%}, %X6}"
21826 [(set_attr "type" "ssemov")
21827 (set_attr "prefix" "evex")
21828 (set_attr "mode" "<sseinsnmode>")])
21830 (define_insn "*avx512f_gatherdi<VI48F:mode>_2"
21831 [(set (match_operand:VI48F 0 "register_operand" "=&v")
21834 (match_operand:QI 6 "register_operand" "1")
21835 (match_operator:<ssescalarmode> 5 "vsib_mem_operator"
21837 [(match_operand:P 3 "vsib_address_operand" "Tv")
21838 (match_operand:<VEC_GATHER_IDXDI> 2 "register_operand" "v")
21839 (match_operand:SI 4 "const1248_operand" "n")]
21840 UNSPEC_VSIBADDR)])]
21842 (clobber (match_scratch:QI 1 "=&Yk"))]
21845 /* %X5 so that we don't emit any *WORD PTR for -masm=intel, as
21846 gas changed what it requires incompatibly. */
21847 if (<VI48F:MODE>mode != <VEC_GATHER_SRCDI>mode)
21849 if (<VI48F:MODE_SIZE> != 64)
21850 return "%M3v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %x0%{%1%}|%x0%{%1%}, %X5}";
21852 return "%M3v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %t0%{%1%}|%t0%{%1%}, %X5}";
21854 return "%M3v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %0%{%1%}|%0%{%1%}, %X5}";
21856 [(set_attr "type" "ssemov")
21857 (set_attr "prefix" "evex")
21858 (set_attr "mode" "<sseinsnmode>")])
21860 (define_expand "<avx512>_scattersi<mode>"
21861 [(parallel [(set (mem:VI48F
21863 [(match_operand 0 "vsib_address_operand")
21864 (match_operand:<VEC_GATHER_IDXSI> 2 "register_operand")
21865 (match_operand:SI 4 "const1248_operand")]))
21867 [(match_operand:<avx512fmaskmode> 1 "register_operand")
21868 (match_operand:VI48F 3 "register_operand")]
21870 (clobber (match_scratch:<avx512fmaskmode> 6))])]
21874 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[0], operands[2],
21875 operands[4]), UNSPEC_VSIBADDR);
21878 (define_insn "*avx512f_scattersi<VI48F:mode>"
21879 [(set (match_operator:VI48F 5 "vsib_mem_operator"
21881 [(match_operand:P 0 "vsib_address_operand" "Tv")
21882 (match_operand:<VEC_GATHER_IDXSI> 2 "register_operand" "v")
21883 (match_operand:SI 4 "const1248_operand" "n")]
21886 [(match_operand:<avx512fmaskmode> 6 "register_operand" "1")
21887 (match_operand:VI48F 3 "register_operand" "v")]
21889 (clobber (match_scratch:<avx512fmaskmode> 1 "=&Yk"))]
21891 ;; %X5 so that we don't emit any *WORD PTR for -masm=intel, as
21892 ;; gas changed what it requires incompatibly.
21893 "%M0v<sseintprefix>scatterd<ssemodesuffix>\t{%3, %5%{%1%}|%X5%{%1%}, %3}"
21894 [(set_attr "type" "ssemov")
21895 (set_attr "prefix" "evex")
21896 (set_attr "mode" "<sseinsnmode>")])
21898 (define_expand "<avx512>_scatterdi<mode>"
21899 [(parallel [(set (mem:VI48F
21901 [(match_operand 0 "vsib_address_operand")
21902 (match_operand:<VEC_GATHER_IDXDI> 2 "register_operand")
21903 (match_operand:SI 4 "const1248_operand")]))
21905 [(match_operand:QI 1 "register_operand")
21906 (match_operand:<VEC_GATHER_SRCDI> 3 "register_operand")]
21908 (clobber (match_scratch:QI 6))])]
21912 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[0], operands[2],
21913 operands[4]), UNSPEC_VSIBADDR);
21916 (define_insn "*avx512f_scatterdi<VI48F:mode>"
21917 [(set (match_operator:VI48F 5 "vsib_mem_operator"
21919 [(match_operand:P 0 "vsib_address_operand" "Tv")
21920 (match_operand:<VEC_GATHER_IDXDI> 2 "register_operand" "v")
21921 (match_operand:SI 4 "const1248_operand" "n")]
21924 [(match_operand:QI 6 "register_operand" "1")
21925 (match_operand:<VEC_GATHER_SRCDI> 3 "register_operand" "v")]
21927 (clobber (match_scratch:QI 1 "=&Yk"))]
21929 ;; %X5 so that we don't emit any *WORD PTR for -masm=intel, as
21930 ;; gas changed what it requires incompatibly.
21931 "%M0v<sseintprefix>scatterq<ssemodesuffix>\t{%3, %5%{%1%}|%X5%{%1%}, %3}"
21932 [(set_attr "type" "ssemov")
21933 (set_attr "prefix" "evex")
21934 (set_attr "mode" "<sseinsnmode>")])
21936 (define_insn "<avx512>_compress<mode>_mask"
21937 [(set (match_operand:VI48F 0 "register_operand" "=v")
21939 [(match_operand:VI48F 1 "register_operand" "v")
21940 (match_operand:VI48F 2 "nonimm_or_0_operand" "0C")
21941 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")]
21944 "v<sseintprefix>compress<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
21945 [(set_attr "type" "ssemov")
21946 (set_attr "prefix" "evex")
21947 (set_attr "mode" "<sseinsnmode>")])
21949 (define_insn "compress<mode>_mask"
21950 [(set (match_operand:VI12_AVX512VLBW 0 "register_operand" "=v")
21951 (unspec:VI12_AVX512VLBW
21952 [(match_operand:VI12_AVX512VLBW 1 "register_operand" "v")
21953 (match_operand:VI12_AVX512VLBW 2 "nonimm_or_0_operand" "0C")
21954 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")]
21956 "TARGET_AVX512VBMI2"
21957 "vpcompress<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
21958 [(set_attr "type" "ssemov")
21959 (set_attr "prefix" "evex")
21960 (set_attr "mode" "<sseinsnmode>")])
21962 (define_insn "<avx512>_compressstore<mode>_mask"
21963 [(set (match_operand:VI48F 0 "memory_operand" "=m")
21965 [(match_operand:VI48F 1 "register_operand" "x")
21967 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")]
21968 UNSPEC_COMPRESS_STORE))]
21970 "v<sseintprefix>compress<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}"
21971 [(set_attr "type" "ssemov")
21972 (set_attr "prefix" "evex")
21973 (set_attr "memory" "store")
21974 (set_attr "mode" "<sseinsnmode>")])
21976 (define_insn "compressstore<mode>_mask"
21977 [(set (match_operand:VI12_AVX512VLBW 0 "memory_operand" "=m")
21978 (unspec:VI12_AVX512VLBW
21979 [(match_operand:VI12_AVX512VLBW 1 "register_operand" "x")
21981 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")]
21982 UNSPEC_COMPRESS_STORE))]
21983 "TARGET_AVX512VBMI2"
21984 "vpcompress<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}"
21985 [(set_attr "type" "ssemov")
21986 (set_attr "prefix" "evex")
21987 (set_attr "memory" "store")
21988 (set_attr "mode" "<sseinsnmode>")])
21990 (define_expand "<avx512>_expand<mode>_maskz"
21991 [(set (match_operand:VI48F 0 "register_operand")
21993 [(match_operand:VI48F 1 "nonimmediate_operand")
21994 (match_operand:VI48F 2 "nonimm_or_0_operand")
21995 (match_operand:<avx512fmaskmode> 3 "register_operand")]
21998 "operands[2] = CONST0_RTX (<MODE>mode);")
22000 (define_insn "<avx512>_expand<mode>_mask"
22001 [(set (match_operand:VI48F 0 "register_operand" "=v,v")
22003 [(match_operand:VI48F 1 "nonimmediate_operand" "v,m")
22004 (match_operand:VI48F 2 "nonimm_or_0_operand" "0C,0C")
22005 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")]
22008 "v<sseintprefix>expand<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
22009 [(set_attr "type" "ssemov")
22010 (set_attr "prefix" "evex")
22011 (set_attr "memory" "none,load")
22012 (set_attr "mode" "<sseinsnmode>")])
22014 (define_insn "expand<mode>_mask"
22015 [(set (match_operand:VI12_AVX512VLBW 0 "register_operand" "=v,v")
22016 (unspec:VI12_AVX512VLBW
22017 [(match_operand:VI12_AVX512VLBW 1 "nonimmediate_operand" "v,m")
22018 (match_operand:VI12_AVX512VLBW 2 "nonimm_or_0_operand" "0C,0C")
22019 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")]
22021 "TARGET_AVX512VBMI2"
22022 "v<sseintprefix>expand<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
22023 [(set_attr "type" "ssemov")
22024 (set_attr "prefix" "evex")
22025 (set_attr "memory" "none,load")
22026 (set_attr "mode" "<sseinsnmode>")])
22028 (define_expand "expand<mode>_maskz"
22029 [(set (match_operand:VI12_AVX512VLBW 0 "register_operand")
22030 (unspec:VI12_AVX512VLBW
22031 [(match_operand:VI12_AVX512VLBW 1 "nonimmediate_operand")
22032 (match_operand:VI12_AVX512VLBW 2 "nonimm_or_0_operand")
22033 (match_operand:<avx512fmaskmode> 3 "register_operand")]
22035 "TARGET_AVX512VBMI2"
22036 "operands[2] = CONST0_RTX (<MODE>mode);")
22038 (define_insn "avx512dq_rangep<mode><mask_name><round_saeonly_name>"
22039 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
22040 (unspec:VF_AVX512VL
22041 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
22042 (match_operand:VF_AVX512VL 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
22043 (match_operand:SI 3 "const_0_to_15_operand")]
22045 "TARGET_AVX512DQ && <round_saeonly_mode512bit_condition>"
22046 "vrange<ssemodesuffix>\t{%3, <round_saeonly_mask_op4>%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2<round_saeonly_mask_op4>, %3}"
22047 [(set_attr "type" "sse")
22048 (set_attr "prefix" "evex")
22049 (set_attr "mode" "<MODE>")])
22051 (define_insn "avx512dq_ranges<mode><mask_scalar_name><round_saeonly_scalar_name>"
22052 [(set (match_operand:VF_128 0 "register_operand" "=v")
22055 [(match_operand:VF_128 1 "register_operand" "v")
22056 (match_operand:VF_128 2 "<round_saeonly_scalar_nimm_predicate>" "<round_saeonly_scalar_constraint>")
22057 (match_operand:SI 3 "const_0_to_15_operand")]
22062 "vrange<ssescalarmodesuffix>\t{%3, <round_saeonly_scalar_mask_op4>%2, %1, %0<mask_scalar_operand4>|%0<mask_scalar_operand4>, %1, %<iptr>2<round_saeonly_scalar_mask_op4>, %3}"
22063 [(set_attr "type" "sse")
22064 (set_attr "prefix" "evex")
22065 (set_attr "mode" "<MODE>")])
22067 (define_insn "avx512dq_fpclass<mode><mask_scalar_merge_name>"
22068 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=k")
22069 (unspec:<avx512fmaskmode>
22070 [(match_operand:VF_AVX512VL 1 "vector_operand" "vm")
22071 (match_operand 2 "const_0_to_255_operand" "n")]
22074 "vfpclass<ssemodesuffix><vecmemsuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}";
22075 [(set_attr "type" "sse")
22076 (set_attr "length_immediate" "1")
22077 (set_attr "prefix" "evex")
22078 (set_attr "mode" "<MODE>")])
22080 (define_insn "avx512dq_vmfpclass<mode><mask_scalar_merge_name>"
22081 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=k")
22082 (and:<avx512fmaskmode>
22083 (unspec:<avx512fmaskmode>
22084 [(match_operand:VF_128 1 "nonimmediate_operand" "vm")
22085 (match_operand 2 "const_0_to_255_operand" "n")]
22089 "vfpclass<ssescalarmodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}";
22090 [(set_attr "type" "sse")
22091 (set_attr "length_immediate" "1")
22092 (set_attr "prefix" "evex")
22093 (set_attr "mode" "<MODE>")])
22095 (define_insn "<avx512>_getmant<mode><mask_name><round_saeonly_name>"
22096 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
22097 (unspec:VF_AVX512VL
22098 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "<round_saeonly_constraint>")
22099 (match_operand:SI 2 "const_0_to_15_operand")]
22102 "vgetmant<ssemodesuffix>\t{%2, <round_saeonly_mask_op3>%1, %0<mask_operand3>|%0<mask_operand3>, %1<round_saeonly_mask_op3>, %2}";
22103 [(set_attr "prefix" "evex")
22104 (set_attr "mode" "<MODE>")])
22106 (define_insn "avx512f_vgetmant<mode><mask_scalar_name><round_saeonly_scalar_name>"
22107 [(set (match_operand:VF_128 0 "register_operand" "=v")
22110 [(match_operand:VF_128 1 "register_operand" "v")
22111 (match_operand:VF_128 2 "<round_saeonly_scalar_nimm_predicate>" "<round_saeonly_scalar_constraint>")
22112 (match_operand:SI 3 "const_0_to_15_operand")]
22117 "vgetmant<ssescalarmodesuffix>\t{%3, <round_saeonly_scalar_mask_op4>%2, %1, %0<mask_scalar_operand4>|%0<mask_scalar_operand4>, %1, %<iptr>2<round_saeonly_scalar_mask_op4>, %3}";
22118 [(set_attr "prefix" "evex")
22119 (set_attr "mode" "<ssescalarmode>")])
22121 ;; The correct representation for this is absolutely enormous, and
22122 ;; surely not generally useful.
22123 (define_insn "<mask_codefor>avx512bw_dbpsadbw<mode><mask_name>"
22124 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
22125 (unspec:VI2_AVX512VL
22126 [(match_operand:<dbpsadbwmode> 1 "register_operand" "v")
22127 (match_operand:<dbpsadbwmode> 2 "nonimmediate_operand" "vm")
22128 (match_operand:SI 3 "const_0_to_255_operand")]
22131 "vdbpsadbw\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3}"
22132 [(set_attr "type" "sselog1")
22133 (set_attr "length_immediate" "1")
22134 (set_attr "prefix" "evex")
22135 (set_attr "mode" "<sseinsnmode>")])
22137 (define_insn "clz<mode>2<mask_name>"
22138 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
22140 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm")))]
22142 "vplzcnt<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
22143 [(set_attr "type" "sse")
22144 (set_attr "prefix" "evex")
22145 (set_attr "mode" "<sseinsnmode>")])
22147 (define_insn "<mask_codefor>conflict<mode><mask_name>"
22148 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
22149 (unspec:VI48_AVX512VL
22150 [(match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm")]
22153 "vpconflict<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
22154 [(set_attr "type" "sse")
22155 (set_attr "prefix" "evex")
22156 (set_attr "mode" "<sseinsnmode>")])
22158 (define_insn "sha1msg1"
22159 [(set (match_operand:V4SI 0 "register_operand" "=x")
22161 [(match_operand:V4SI 1 "register_operand" "0")
22162 (match_operand:V4SI 2 "vector_operand" "xBm")]
22165 "sha1msg1\t{%2, %0|%0, %2}"
22166 [(set_attr "type" "sselog1")
22167 (set_attr "mode" "TI")])
22169 (define_insn "sha1msg2"
22170 [(set (match_operand:V4SI 0 "register_operand" "=x")
22172 [(match_operand:V4SI 1 "register_operand" "0")
22173 (match_operand:V4SI 2 "vector_operand" "xBm")]
22176 "sha1msg2\t{%2, %0|%0, %2}"
22177 [(set_attr "type" "sselog1")
22178 (set_attr "mode" "TI")])
22180 (define_insn "sha1nexte"
22181 [(set (match_operand:V4SI 0 "register_operand" "=x")
22183 [(match_operand:V4SI 1 "register_operand" "0")
22184 (match_operand:V4SI 2 "vector_operand" "xBm")]
22185 UNSPEC_SHA1NEXTE))]
22187 "sha1nexte\t{%2, %0|%0, %2}"
22188 [(set_attr "type" "sselog1")
22189 (set_attr "mode" "TI")])
22191 (define_insn "sha1rnds4"
22192 [(set (match_operand:V4SI 0 "register_operand" "=x")
22194 [(match_operand:V4SI 1 "register_operand" "0")
22195 (match_operand:V4SI 2 "vector_operand" "xBm")
22196 (match_operand:SI 3 "const_0_to_3_operand" "n")]
22197 UNSPEC_SHA1RNDS4))]
22199 "sha1rnds4\t{%3, %2, %0|%0, %2, %3}"
22200 [(set_attr "type" "sselog1")
22201 (set_attr "length_immediate" "1")
22202 (set_attr "mode" "TI")])
22204 (define_insn "sha256msg1"
22205 [(set (match_operand:V4SI 0 "register_operand" "=x")
22207 [(match_operand:V4SI 1 "register_operand" "0")
22208 (match_operand:V4SI 2 "vector_operand" "xBm")]
22209 UNSPEC_SHA256MSG1))]
22211 "sha256msg1\t{%2, %0|%0, %2}"
22212 [(set_attr "type" "sselog1")
22213 (set_attr "mode" "TI")])
22215 (define_insn "sha256msg2"
22216 [(set (match_operand:V4SI 0 "register_operand" "=x")
22218 [(match_operand:V4SI 1 "register_operand" "0")
22219 (match_operand:V4SI 2 "vector_operand" "xBm")]
22220 UNSPEC_SHA256MSG2))]
22222 "sha256msg2\t{%2, %0|%0, %2}"
22223 [(set_attr "type" "sselog1")
22224 (set_attr "mode" "TI")])
22226 (define_insn "sha256rnds2"
22227 [(set (match_operand:V4SI 0 "register_operand" "=x")
22229 [(match_operand:V4SI 1 "register_operand" "0")
22230 (match_operand:V4SI 2 "vector_operand" "xBm")
22231 (match_operand:V4SI 3 "register_operand" "Yz")]
22232 UNSPEC_SHA256RNDS2))]
22234 "sha256rnds2\t{%3, %2, %0|%0, %2, %3}"
22235 [(set_attr "type" "sselog1")
22236 (set_attr "length_immediate" "1")
22237 (set_attr "mode" "TI")])
22239 (define_insn_and_split "avx512f_<castmode><avxsizesuffix>_<castmode>"
22240 [(set (match_operand:AVX512MODE2P 0 "nonimmediate_operand" "=x,m")
22241 (vec_concat:AVX512MODE2P
22242 (vec_concat:<ssehalfvecmode>
22243 (match_operand:<ssequartermode> 1 "nonimmediate_operand" "xm,x")
22244 (unspec:<ssequartermode> [(const_int 0)] UNSPEC_CAST))
22245 (unspec:<ssehalfvecmode> [(const_int 0)] UNSPEC_CAST)))]
22246 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
22248 "&& reload_completed"
22249 [(set (match_dup 0) (match_dup 1))]
22251 if (REG_P (operands[0]))
22252 operands[0] = gen_lowpart (<ssequartermode>mode, operands[0]);
22254 operands[1] = lowpart_subreg (<MODE>mode, operands[1],
22255 <ssequartermode>mode);
22258 (define_insn_and_split "avx512f_<castmode><avxsizesuffix>_256<castmode>"
22259 [(set (match_operand:AVX512MODE2P 0 "nonimmediate_operand" "=x,m")
22260 (vec_concat:AVX512MODE2P
22261 (match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "xm,x")
22262 (unspec:<ssehalfvecmode> [(const_int 0)] UNSPEC_CAST)))]
22263 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
22265 "&& reload_completed"
22266 [(set (match_dup 0) (match_dup 1))]
22268 if (REG_P (operands[0]))
22269 operands[0] = gen_lowpart (<ssehalfvecmode>mode, operands[0]);
22271 operands[1] = lowpart_subreg (<MODE>mode, operands[1],
22272 <ssehalfvecmode>mode);
22275 (define_int_iterator VPMADD52
22276 [UNSPEC_VPMADD52LUQ
22277 UNSPEC_VPMADD52HUQ])
22279 (define_int_attr vpmadd52type
22280 [(UNSPEC_VPMADD52LUQ "luq") (UNSPEC_VPMADD52HUQ "huq")])
22282 (define_expand "vpamdd52huq<mode>_maskz"
22283 [(match_operand:VI8_AVX512VL 0 "register_operand")
22284 (match_operand:VI8_AVX512VL 1 "register_operand")
22285 (match_operand:VI8_AVX512VL 2 "register_operand")
22286 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand")
22287 (match_operand:<avx512fmaskmode> 4 "register_operand")]
22288 "TARGET_AVX512IFMA"
22290 emit_insn (gen_vpamdd52huq<mode>_maskz_1 (
22291 operands[0], operands[1], operands[2], operands[3],
22292 CONST0_RTX (<MODE>mode), operands[4]));
22296 (define_expand "vpamdd52luq<mode>_maskz"
22297 [(match_operand:VI8_AVX512VL 0 "register_operand")
22298 (match_operand:VI8_AVX512VL 1 "register_operand")
22299 (match_operand:VI8_AVX512VL 2 "register_operand")
22300 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand")
22301 (match_operand:<avx512fmaskmode> 4 "register_operand")]
22302 "TARGET_AVX512IFMA"
22304 emit_insn (gen_vpamdd52luq<mode>_maskz_1 (
22305 operands[0], operands[1], operands[2], operands[3],
22306 CONST0_RTX (<MODE>mode), operands[4]));
22310 (define_insn "vpamdd52<vpmadd52type><mode><sd_maskz_name>"
22311 [(set (match_operand:VI8_AVX512VL 0 "register_operand" "=v")
22312 (unspec:VI8_AVX512VL
22313 [(match_operand:VI8_AVX512VL 1 "register_operand" "0")
22314 (match_operand:VI8_AVX512VL 2 "register_operand" "v")
22315 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand" "vm")]
22317 "TARGET_AVX512IFMA"
22318 "vpmadd52<vpmadd52type>\t{%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3}"
22319 [(set_attr "type" "ssemuladd")
22320 (set_attr "prefix" "evex")
22321 (set_attr "mode" "<sseinsnmode>")])
22323 (define_insn "vpamdd52<vpmadd52type><mode>_mask"
22324 [(set (match_operand:VI8_AVX512VL 0 "register_operand" "=v")
22325 (vec_merge:VI8_AVX512VL
22326 (unspec:VI8_AVX512VL
22327 [(match_operand:VI8_AVX512VL 1 "register_operand" "0")
22328 (match_operand:VI8_AVX512VL 2 "register_operand" "v")
22329 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand" "vm")]
22332 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
22333 "TARGET_AVX512IFMA"
22334 "vpmadd52<vpmadd52type>\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3}"
22335 [(set_attr "type" "ssemuladd")
22336 (set_attr "prefix" "evex")
22337 (set_attr "mode" "<sseinsnmode>")])
22339 (define_insn "vpmultishiftqb<mode><mask_name>"
22340 [(set (match_operand:VI1_AVX512VL 0 "register_operand" "=v")
22341 (unspec:VI1_AVX512VL
22342 [(match_operand:VI1_AVX512VL 1 "register_operand" "v")
22343 (match_operand:VI1_AVX512VL 2 "nonimmediate_operand" "vm")]
22344 UNSPEC_VPMULTISHIFT))]
22345 "TARGET_AVX512VBMI"
22346 "vpmultishiftqb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
22347 [(set_attr "type" "sselog")
22348 (set_attr "prefix" "evex")
22349 (set_attr "mode" "<sseinsnmode>")])
22351 (define_mode_iterator IMOD4
22352 [(V64SF "TARGET_AVX5124FMAPS") (V64SI "TARGET_AVX5124VNNIW")])
22354 (define_mode_attr imod4_narrow
22355 [(V64SF "V16SF") (V64SI "V16SI")])
22357 (define_expand "mov<mode>"
22358 [(set (match_operand:IMOD4 0 "nonimmediate_operand")
22359 (match_operand:IMOD4 1 "nonimm_or_0_operand"))]
22362 ix86_expand_vector_move (<MODE>mode, operands);
22366 (define_insn_and_split "*mov<mode>_internal"
22367 [(set (match_operand:IMOD4 0 "nonimmediate_operand" "=v,v ,m")
22368 (match_operand:IMOD4 1 "nonimm_or_0_operand" " C,vm,v"))]
22370 && (register_operand (operands[0], <MODE>mode)
22371 || register_operand (operands[1], <MODE>mode))"
22373 "&& reload_completed"
22379 for (i = 0; i < 4; i++)
22381 op0 = simplify_subreg
22382 (<imod4_narrow>mode, operands[0], <MODE>mode, i * 64);
22383 op1 = simplify_subreg
22384 (<imod4_narrow>mode, operands[1], <MODE>mode, i * 64);
22385 emit_move_insn (op0, op1);
22390 (define_insn "avx5124fmaddps_4fmaddps"
22391 [(set (match_operand:V16SF 0 "register_operand" "=v")
22393 [(match_operand:V16SF 1 "register_operand" "0")
22394 (match_operand:V64SF 2 "register_operand" "v")
22395 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FMADD))]
22396 "TARGET_AVX5124FMAPS"
22397 "v4fmaddps\t{%3, %g2, %0|%0, %g2, %3}"
22398 [(set_attr ("type") ("ssemuladd"))
22399 (set_attr ("prefix") ("evex"))
22400 (set_attr ("mode") ("V16SF"))])
22402 (define_insn "avx5124fmaddps_4fmaddps_mask"
22403 [(set (match_operand:V16SF 0 "register_operand" "=v")
22406 [(match_operand:V64SF 1 "register_operand" "v")
22407 (match_operand:V4SF 2 "memory_operand" "m")] UNSPEC_VP4FMADD)
22408 (match_operand:V16SF 3 "register_operand" "0")
22409 (match_operand:HI 4 "register_operand" "Yk")))]
22410 "TARGET_AVX5124FMAPS"
22411 "v4fmaddps\t{%2, %g1, %0%{%4%}|%0%{%4%}, %g1, %2}"
22412 [(set_attr ("type") ("ssemuladd"))
22413 (set_attr ("prefix") ("evex"))
22414 (set_attr ("mode") ("V16SF"))])
22416 (define_insn "avx5124fmaddps_4fmaddps_maskz"
22417 [(set (match_operand:V16SF 0 "register_operand" "=v")
22420 [(match_operand:V16SF 1 "register_operand" "0")
22421 (match_operand:V64SF 2 "register_operand" "v")
22422 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FMADD)
22423 (match_operand:V16SF 4 "const0_operand" "C")
22424 (match_operand:HI 5 "register_operand" "Yk")))]
22425 "TARGET_AVX5124FMAPS"
22426 "v4fmaddps\t{%3, %g2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %g2, %3}"
22427 [(set_attr ("type") ("ssemuladd"))
22428 (set_attr ("prefix") ("evex"))
22429 (set_attr ("mode") ("V16SF"))])
22431 (define_insn "avx5124fmaddps_4fmaddss"
22432 [(set (match_operand:V4SF 0 "register_operand" "=v")
22434 [(match_operand:V4SF 1 "register_operand" "0")
22435 (match_operand:V64SF 2 "register_operand" "v")
22436 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FMADD))]
22437 "TARGET_AVX5124FMAPS"
22438 "v4fmaddss\t{%3, %x2, %0|%0, %x2, %3}"
22439 [(set_attr ("type") ("ssemuladd"))
22440 (set_attr ("prefix") ("evex"))
22441 (set_attr ("mode") ("SF"))])
22443 (define_insn "avx5124fmaddps_4fmaddss_mask"
22444 [(set (match_operand:V4SF 0 "register_operand" "=v")
22447 [(match_operand:V64SF 1 "register_operand" "v")
22448 (match_operand:V4SF 2 "memory_operand" "m")] UNSPEC_VP4FMADD)
22449 (match_operand:V4SF 3 "register_operand" "0")
22450 (match_operand:QI 4 "register_operand" "Yk")))]
22451 "TARGET_AVX5124FMAPS"
22452 "v4fmaddss\t{%2, %x1, %0%{%4%}|%0%{%4%}, %x1, %2}"
22453 [(set_attr ("type") ("ssemuladd"))
22454 (set_attr ("prefix") ("evex"))
22455 (set_attr ("mode") ("SF"))])
22457 (define_insn "avx5124fmaddps_4fmaddss_maskz"
22458 [(set (match_operand:V4SF 0 "register_operand" "=v")
22461 [(match_operand:V4SF 1 "register_operand" "0")
22462 (match_operand:V64SF 2 "register_operand" "v")
22463 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FMADD)
22464 (match_operand:V4SF 4 "const0_operand" "C")
22465 (match_operand:QI 5 "register_operand" "Yk")))]
22466 "TARGET_AVX5124FMAPS"
22467 "v4fmaddss\t{%3, %x2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %x2, %3}"
22468 [(set_attr ("type") ("ssemuladd"))
22469 (set_attr ("prefix") ("evex"))
22470 (set_attr ("mode") ("SF"))])
22472 (define_insn "avx5124fmaddps_4fnmaddps"
22473 [(set (match_operand:V16SF 0 "register_operand" "=v")
22475 [(match_operand:V16SF 1 "register_operand" "0")
22476 (match_operand:V64SF 2 "register_operand" "v")
22477 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FNMADD))]
22478 "TARGET_AVX5124FMAPS"
22479 "v4fnmaddps\t{%3, %g2, %0|%0, %g2, %3}"
22480 [(set_attr ("type") ("ssemuladd"))
22481 (set_attr ("prefix") ("evex"))
22482 (set_attr ("mode") ("V16SF"))])
22484 (define_insn "avx5124fmaddps_4fnmaddps_mask"
22485 [(set (match_operand:V16SF 0 "register_operand" "=v")
22488 [(match_operand:V64SF 1 "register_operand" "v")
22489 (match_operand:V4SF 2 "memory_operand" "m")] UNSPEC_VP4FNMADD)
22490 (match_operand:V16SF 3 "register_operand" "0")
22491 (match_operand:HI 4 "register_operand" "Yk")))]
22492 "TARGET_AVX5124FMAPS"
22493 "v4fnmaddps\t{%2, %g1, %0%{%4%}|%0%{%4%}, %g1, %2}"
22494 [(set_attr ("type") ("ssemuladd"))
22495 (set_attr ("prefix") ("evex"))
22496 (set_attr ("mode") ("V16SF"))])
22498 (define_insn "avx5124fmaddps_4fnmaddps_maskz"
22499 [(set (match_operand:V16SF 0 "register_operand" "=v")
22502 [(match_operand:V16SF 1 "register_operand" "0")
22503 (match_operand:V64SF 2 "register_operand" "v")
22504 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FNMADD)
22505 (match_operand:V16SF 4 "const0_operand" "C")
22506 (match_operand:HI 5 "register_operand" "Yk")))]
22507 "TARGET_AVX5124FMAPS"
22508 "v4fnmaddps\t{%3, %g2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %g2, %3}"
22509 [(set_attr ("type") ("ssemuladd"))
22510 (set_attr ("prefix") ("evex"))
22511 (set_attr ("mode") ("V16SF"))])
22513 (define_insn "avx5124fmaddps_4fnmaddss"
22514 [(set (match_operand:V4SF 0 "register_operand" "=v")
22516 [(match_operand:V4SF 1 "register_operand" "0")
22517 (match_operand:V64SF 2 "register_operand" "v")
22518 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FNMADD))]
22519 "TARGET_AVX5124FMAPS"
22520 "v4fnmaddss\t{%3, %x2, %0|%0, %x2, %3}"
22521 [(set_attr ("type") ("ssemuladd"))
22522 (set_attr ("prefix") ("evex"))
22523 (set_attr ("mode") ("SF"))])
22525 (define_insn "avx5124fmaddps_4fnmaddss_mask"
22526 [(set (match_operand:V4SF 0 "register_operand" "=v")
22529 [(match_operand:V64SF 1 "register_operand" "v")
22530 (match_operand:V4SF 2 "memory_operand" "m")] UNSPEC_VP4FNMADD)
22531 (match_operand:V4SF 3 "register_operand" "0")
22532 (match_operand:QI 4 "register_operand" "Yk")))]
22533 "TARGET_AVX5124FMAPS"
22534 "v4fnmaddss\t{%2, %x1, %0%{%4%}|%0%{%4%}, %x1, %2}"
22535 [(set_attr ("type") ("ssemuladd"))
22536 (set_attr ("prefix") ("evex"))
22537 (set_attr ("mode") ("SF"))])
22539 (define_insn "avx5124fmaddps_4fnmaddss_maskz"
22540 [(set (match_operand:V4SF 0 "register_operand" "=v")
22543 [(match_operand:V4SF 1 "register_operand" "0")
22544 (match_operand:V64SF 2 "register_operand" "v")
22545 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FNMADD)
22546 (match_operand:V4SF 4 "const0_operand" "C")
22547 (match_operand:QI 5 "register_operand" "Yk")))]
22548 "TARGET_AVX5124FMAPS"
22549 "v4fnmaddss\t{%3, %x2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %x2, %3}"
22550 [(set_attr ("type") ("ssemuladd"))
22551 (set_attr ("prefix") ("evex"))
22552 (set_attr ("mode") ("SF"))])
22554 (define_insn "avx5124vnniw_vp4dpwssd"
22555 [(set (match_operand:V16SI 0 "register_operand" "=v")
22557 [(match_operand:V16SI 1 "register_operand" "0")
22558 (match_operand:V64SI 2 "register_operand" "v")
22559 (match_operand:V4SI 3 "memory_operand" "m")] UNSPEC_VP4DPWSSD))]
22560 "TARGET_AVX5124VNNIW"
22561 "vp4dpwssd\t{%3, %g2, %0|%0, %g2, %3}"
22562 [(set_attr ("type") ("ssemuladd"))
22563 (set_attr ("prefix") ("evex"))
22564 (set_attr ("mode") ("TI"))])
22566 (define_insn "avx5124vnniw_vp4dpwssd_mask"
22567 [(set (match_operand:V16SI 0 "register_operand" "=v")
22570 [(match_operand:V64SI 1 "register_operand" "v")
22571 (match_operand:V4SI 2 "memory_operand" "m")] UNSPEC_VP4DPWSSD)
22572 (match_operand:V16SI 3 "register_operand" "0")
22573 (match_operand:HI 4 "register_operand" "Yk")))]
22574 "TARGET_AVX5124VNNIW"
22575 "vp4dpwssd\t{%2, %g1, %0%{%4%}|%0%{%4%}, %g1, %2}"
22576 [(set_attr ("type") ("ssemuladd"))
22577 (set_attr ("prefix") ("evex"))
22578 (set_attr ("mode") ("TI"))])
22580 (define_insn "avx5124vnniw_vp4dpwssd_maskz"
22581 [(set (match_operand:V16SI 0 "register_operand" "=v")
22584 [(match_operand:V16SI 1 "register_operand" "0")
22585 (match_operand:V64SI 2 "register_operand" "v")
22586 (match_operand:V4SI 3 "memory_operand" "m")] UNSPEC_VP4DPWSSD)
22587 (match_operand:V16SI 4 "const0_operand" "C")
22588 (match_operand:HI 5 "register_operand" "Yk")))]
22589 "TARGET_AVX5124VNNIW"
22590 "vp4dpwssd\t{%3, %g2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %g2, %3}"
22591 [(set_attr ("type") ("ssemuladd"))
22592 (set_attr ("prefix") ("evex"))
22593 (set_attr ("mode") ("TI"))])
22595 (define_insn "avx5124vnniw_vp4dpwssds"
22596 [(set (match_operand:V16SI 0 "register_operand" "=v")
22598 [(match_operand:V16SI 1 "register_operand" "0")
22599 (match_operand:V64SI 2 "register_operand" "v")
22600 (match_operand:V4SI 3 "memory_operand" "m")] UNSPEC_VP4DPWSSDS))]
22601 "TARGET_AVX5124VNNIW"
22602 "vp4dpwssds\t{%3, %g2, %0|%0, %g2, %3}"
22603 [(set_attr ("type") ("ssemuladd"))
22604 (set_attr ("prefix") ("evex"))
22605 (set_attr ("mode") ("TI"))])
22607 (define_insn "avx5124vnniw_vp4dpwssds_mask"
22608 [(set (match_operand:V16SI 0 "register_operand" "=v")
22611 [(match_operand:V64SI 1 "register_operand" "v")
22612 (match_operand:V4SI 2 "memory_operand" "m")] UNSPEC_VP4DPWSSDS)
22613 (match_operand:V16SI 3 "register_operand" "0")
22614 (match_operand:HI 4 "register_operand" "Yk")))]
22615 "TARGET_AVX5124VNNIW"
22616 "vp4dpwssds\t{%2, %g1, %0%{%4%}|%0%{%4%}, %g1, %2}"
22617 [(set_attr ("type") ("ssemuladd"))
22618 (set_attr ("prefix") ("evex"))
22619 (set_attr ("mode") ("TI"))])
22621 (define_insn "avx5124vnniw_vp4dpwssds_maskz"
22622 [(set (match_operand:V16SI 0 "register_operand" "=v")
22625 [(match_operand:V16SI 1 "register_operand" "0")
22626 (match_operand:V64SI 2 "register_operand" "v")
22627 (match_operand:V4SI 3 "memory_operand" "m")] UNSPEC_VP4DPWSSDS)
22628 (match_operand:V16SI 4 "const0_operand" "C")
22629 (match_operand:HI 5 "register_operand" "Yk")))]
22630 "TARGET_AVX5124VNNIW"
22631 "vp4dpwssds\t{%3, %g2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %g2, %3}"
22632 [(set_attr ("type") ("ssemuladd"))
22633 (set_attr ("prefix") ("evex"))
22634 (set_attr ("mode") ("TI"))])
22636 (define_insn "vpopcount<mode><mask_name>"
22637 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
22638 (popcount:VI48_AVX512VL
22639 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm")))]
22640 "TARGET_AVX512VPOPCNTDQ"
22641 "vpopcnt<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}")
22643 ;; Save multiple registers out-of-line.
22644 (define_insn "*save_multiple<mode>"
22645 [(match_parallel 0 "save_multiple"
22646 [(use (match_operand:P 1 "symbol_operand"))])]
22647 "TARGET_SSE && TARGET_64BIT"
22650 ;; Restore multiple registers out-of-line.
22651 (define_insn "*restore_multiple<mode>"
22652 [(match_parallel 0 "restore_multiple"
22653 [(use (match_operand:P 1 "symbol_operand"))])]
22654 "TARGET_SSE && TARGET_64BIT"
22657 ;; Restore multiple registers out-of-line and return.
22658 (define_insn "*restore_multiple_and_return<mode>"
22659 [(match_parallel 0 "restore_multiple"
22661 (use (match_operand:P 1 "symbol_operand"))
22662 (set (reg:DI SP_REG) (reg:DI R10_REG))
22664 "TARGET_SSE && TARGET_64BIT"
22667 ;; Restore multiple registers out-of-line when hard frame pointer is used,
22668 ;; perform the leave operation prior to returning (from the function).
22669 (define_insn "*restore_multiple_leave_return<mode>"
22670 [(match_parallel 0 "restore_multiple"
22672 (use (match_operand:P 1 "symbol_operand"))
22673 (set (reg:DI SP_REG) (plus:DI (reg:DI BP_REG) (const_int 8)))
22674 (set (reg:DI BP_REG) (mem:DI (reg:DI BP_REG)))
22675 (clobber (mem:BLK (scratch)))
22677 "TARGET_SSE && TARGET_64BIT"
22680 (define_insn "vpopcount<mode><mask_name>"
22681 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
22682 (popcount:VI12_AVX512VL
22683 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "vm")))]
22684 "TARGET_AVX512BITALG"
22685 "vpopcnt<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}")
22687 (define_insn "vgf2p8affineinvqb_<mode><mask_name>"
22688 [(set (match_operand:VI1_AVX512F 0 "register_operand" "=x,v")
22689 (unspec:VI1_AVX512F
22690 [(match_operand:VI1_AVX512F 1 "register_operand" "0,v")
22691 (match_operand:VI1_AVX512F 2 "vector_operand" "xBm,vm")
22692 (match_operand 3 "const_0_to_255_operand" "n,n")]
22693 UNSPEC_GF2P8AFFINEINV))]
22696 gf2p8affineinvqb\t{%3, %2, %0| %0, %2, %3}
22697 vgf2p8affineinvqb\t{%3, %2, %1, %0<mask_operand4>| %0<mask_operand4>, %1, %2, %3}"
22698 [(set_attr "isa" "noavx,avx")
22699 (set_attr "prefix_data16" "1,*")
22700 (set_attr "prefix_extra" "1")
22701 (set_attr "prefix" "orig,maybe_evex")
22702 (set_attr "mode" "<sseinsnmode>")])
22704 (define_insn "vgf2p8affineqb_<mode><mask_name>"
22705 [(set (match_operand:VI1_AVX512F 0 "register_operand" "=x,v")
22706 (unspec:VI1_AVX512F
22707 [(match_operand:VI1_AVX512F 1 "register_operand" "0,v")
22708 (match_operand:VI1_AVX512F 2 "vector_operand" "xBm,vm")
22709 (match_operand 3 "const_0_to_255_operand" "n,n")]
22710 UNSPEC_GF2P8AFFINE))]
22713 gf2p8affineqb\t{%3, %2, %0| %0, %2, %3}
22714 vgf2p8affineqb\t{%3, %2, %1, %0<mask_operand4>| %0<mask_operand4>, %1, %2, %3}"
22715 [(set_attr "isa" "noavx,avx")
22716 (set_attr "prefix_data16" "1,*")
22717 (set_attr "prefix_extra" "1")
22718 (set_attr "prefix" "orig,maybe_evex")
22719 (set_attr "mode" "<sseinsnmode>")])
22721 (define_insn "vgf2p8mulb_<mode><mask_name>"
22722 [(set (match_operand:VI1_AVX512F 0 "register_operand" "=x,v")
22723 (unspec:VI1_AVX512F
22724 [(match_operand:VI1_AVX512F 1 "register_operand" "%0,v")
22725 (match_operand:VI1_AVX512F 2 "vector_operand" "xBm,vm")]
22729 gf2p8mulb\t{%2, %0| %0, %2}
22730 vgf2p8mulb\t{%2, %1, %0<mask_operand3>| %0<mask_operand3>, %1, %2}"
22731 [(set_attr "isa" "noavx,avx")
22732 (set_attr "prefix_data16" "1,*")
22733 (set_attr "prefix_extra" "1")
22734 (set_attr "prefix" "orig,maybe_evex")
22735 (set_attr "mode" "<sseinsnmode>")])
22737 (define_insn "vpshrd_<mode><mask_name>"
22738 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
22739 (unspec:VI248_AVX512VL
22740 [(match_operand:VI248_AVX512VL 1 "register_operand" "v")
22741 (match_operand:VI248_AVX512VL 2 "nonimmediate_operand" "vm")
22742 (match_operand:SI 3 "const_0_to_255_operand" "n")]
22744 "TARGET_AVX512VBMI2"
22745 "vpshrd<ssemodesuffix>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3 }"
22746 [(set_attr ("prefix") ("evex"))])
22748 (define_insn "vpshld_<mode><mask_name>"
22749 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
22750 (unspec:VI248_AVX512VL
22751 [(match_operand:VI248_AVX512VL 1 "register_operand" "v")
22752 (match_operand:VI248_AVX512VL 2 "nonimmediate_operand" "vm")
22753 (match_operand:SI 3 "const_0_to_255_operand" "n")]
22755 "TARGET_AVX512VBMI2"
22756 "vpshld<ssemodesuffix>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3 }"
22757 [(set_attr ("prefix") ("evex"))])
22759 (define_insn "vpshrdv_<mode>"
22760 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
22761 (unspec:VI248_AVX512VL
22762 [(match_operand:VI248_AVX512VL 1 "register_operand" "0")
22763 (match_operand:VI248_AVX512VL 2 "register_operand" "v")
22764 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand" "vm")]
22766 "TARGET_AVX512VBMI2"
22767 "vpshrdv<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3 }"
22768 [(set_attr ("prefix") ("evex"))
22769 (set_attr "mode" "<sseinsnmode>")])
22771 (define_insn "vpshrdv_<mode>_mask"
22772 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
22773 (vec_merge:VI248_AVX512VL
22774 (unspec:VI248_AVX512VL
22775 [(match_operand:VI248_AVX512VL 1 "register_operand" "0")
22776 (match_operand:VI248_AVX512VL 2 "register_operand" "v")
22777 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand" "vm")]
22780 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
22781 "TARGET_AVX512VBMI2"
22782 "vpshrdv<ssemodesuffix>\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
22783 [(set_attr ("prefix") ("evex"))
22784 (set_attr "mode" "<sseinsnmode>")])
22786 (define_expand "vpshrdv_<mode>_maskz"
22787 [(match_operand:VI248_AVX512VL 0 "register_operand")
22788 (match_operand:VI248_AVX512VL 1 "register_operand")
22789 (match_operand:VI248_AVX512VL 2 "register_operand")
22790 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand")
22791 (match_operand:<avx512fmaskmode> 4 "register_operand")]
22792 "TARGET_AVX512VBMI2"
22794 emit_insn (gen_vpshrdv_<mode>_maskz_1 (operands[0], operands[1],
22795 operands[2], operands[3],
22796 CONST0_RTX (<MODE>mode),
22801 (define_insn "vpshrdv_<mode>_maskz_1"
22802 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
22803 (vec_merge:VI248_AVX512VL
22804 (unspec:VI248_AVX512VL
22805 [(match_operand:VI248_AVX512VL 1 "register_operand" "0")
22806 (match_operand:VI248_AVX512VL 2 "register_operand" "v")
22807 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand" "vm")]
22809 (match_operand:VI248_AVX512VL 4 "const0_operand" "C")
22810 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
22811 "TARGET_AVX512VBMI2"
22812 "vpshrdv<ssemodesuffix>\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
22813 [(set_attr ("prefix") ("evex"))
22814 (set_attr "mode" "<sseinsnmode>")])
22816 (define_insn "vpshldv_<mode>"
22817 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
22818 (unspec:VI248_AVX512VL
22819 [(match_operand:VI248_AVX512VL 1 "register_operand" "0")
22820 (match_operand:VI248_AVX512VL 2 "register_operand" "v")
22821 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand" "vm")]
22823 "TARGET_AVX512VBMI2"
22824 "vpshldv<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3 }"
22825 [(set_attr ("prefix") ("evex"))
22826 (set_attr "mode" "<sseinsnmode>")])
22828 (define_insn "vpshldv_<mode>_mask"
22829 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
22830 (vec_merge:VI248_AVX512VL
22831 (unspec:VI248_AVX512VL
22832 [(match_operand:VI248_AVX512VL 1 "register_operand" "0")
22833 (match_operand:VI248_AVX512VL 2 "register_operand" "v")
22834 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand" "vm")]
22837 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
22838 "TARGET_AVX512VBMI2"
22839 "vpshldv<ssemodesuffix>\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
22840 [(set_attr ("prefix") ("evex"))
22841 (set_attr "mode" "<sseinsnmode>")])
22843 (define_expand "vpshldv_<mode>_maskz"
22844 [(match_operand:VI248_AVX512VL 0 "register_operand")
22845 (match_operand:VI248_AVX512VL 1 "register_operand")
22846 (match_operand:VI248_AVX512VL 2 "register_operand")
22847 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand")
22848 (match_operand:<avx512fmaskmode> 4 "register_operand")]
22849 "TARGET_AVX512VBMI2"
22851 emit_insn (gen_vpshldv_<mode>_maskz_1 (operands[0], operands[1],
22852 operands[2], operands[3],
22853 CONST0_RTX (<MODE>mode),
22858 (define_insn "vpshldv_<mode>_maskz_1"
22859 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
22860 (vec_merge:VI248_AVX512VL
22861 (unspec:VI248_AVX512VL
22862 [(match_operand:VI248_AVX512VL 1 "register_operand" "0")
22863 (match_operand:VI248_AVX512VL 2 "register_operand" "v")
22864 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand" "vm")]
22866 (match_operand:VI248_AVX512VL 4 "const0_operand" "C")
22867 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
22868 "TARGET_AVX512VBMI2"
22869 "vpshldv<ssemodesuffix>\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
22870 [(set_attr ("prefix") ("evex"))
22871 (set_attr "mode" "<sseinsnmode>")])
22873 (define_insn "vpdpbusd_<mode>"
22874 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
22875 (unspec:VI4_AVX512VL
22876 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
22877 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
22878 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
22879 UNSPEC_VPMADDUBSWACCD))]
22880 "TARGET_AVX512VNNI"
22881 "vpdpbusd\t{%3, %2, %0|%0, %2, %3 }"
22882 [(set_attr ("prefix") ("evex"))])
22884 (define_insn "vpdpbusd_<mode>_mask"
22885 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
22886 (vec_merge:VI4_AVX512VL
22887 (unspec:VI4_AVX512VL
22888 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
22889 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
22890 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
22891 UNSPEC_VPMADDUBSWACCD)
22893 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
22894 "TARGET_AVX512VNNI"
22895 "vpdpbusd\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
22896 [(set_attr ("prefix") ("evex"))])
22898 (define_expand "vpdpbusd_<mode>_maskz"
22899 [(match_operand:VI4_AVX512VL 0 "register_operand")
22900 (match_operand:VI4_AVX512VL 1 "register_operand")
22901 (match_operand:VI4_AVX512VL 2 "register_operand")
22902 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand")
22903 (match_operand:<avx512fmaskmode> 4 "register_operand")]
22904 "TARGET_AVX512VNNI"
22906 emit_insn (gen_vpdpbusd_<mode>_maskz_1 (operands[0], operands[1],
22907 operands[2], operands[3],
22908 CONST0_RTX (<MODE>mode),
22913 (define_insn "vpdpbusd_<mode>_maskz_1"
22914 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
22915 (vec_merge:VI4_AVX512VL
22916 (unspec:VI4_AVX512VL
22917 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
22918 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
22919 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")
22920 ] UNSPEC_VPMADDUBSWACCD)
22921 (match_operand:VI4_AVX512VL 4 "const0_operand" "C")
22922 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
22923 "TARGET_AVX512VNNI"
22924 "vpdpbusd\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
22925 [(set_attr ("prefix") ("evex"))])
22928 (define_insn "vpdpbusds_<mode>"
22929 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
22930 (unspec:VI4_AVX512VL
22931 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
22932 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
22933 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
22934 UNSPEC_VPMADDUBSWACCSSD))]
22935 "TARGET_AVX512VNNI"
22936 "vpdpbusds\t{%3, %2, %0|%0, %2, %3 }"
22937 [(set_attr ("prefix") ("evex"))])
22939 (define_insn "vpdpbusds_<mode>_mask"
22940 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
22941 (vec_merge:VI4_AVX512VL
22942 (unspec:VI4_AVX512VL
22943 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
22944 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
22945 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
22946 UNSPEC_VPMADDUBSWACCSSD)
22948 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
22949 "TARGET_AVX512VNNI"
22950 "vpdpbusds\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
22951 [(set_attr ("prefix") ("evex"))])
22953 (define_expand "vpdpbusds_<mode>_maskz"
22954 [(match_operand:VI4_AVX512VL 0 "register_operand")
22955 (match_operand:VI4_AVX512VL 1 "register_operand")
22956 (match_operand:VI4_AVX512VL 2 "register_operand")
22957 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand")
22958 (match_operand:<avx512fmaskmode> 4 "register_operand")]
22959 "TARGET_AVX512VNNI"
22961 emit_insn (gen_vpdpbusds_<mode>_maskz_1 (operands[0], operands[1],
22962 operands[2], operands[3],
22963 CONST0_RTX (<MODE>mode),
22968 (define_insn "vpdpbusds_<mode>_maskz_1"
22969 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
22970 (vec_merge:VI4_AVX512VL
22971 (unspec:VI4_AVX512VL
22972 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
22973 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
22974 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
22975 UNSPEC_VPMADDUBSWACCSSD)
22976 (match_operand:VI4_AVX512VL 4 "const0_operand" "C")
22977 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
22978 "TARGET_AVX512VNNI"
22979 "vpdpbusds\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
22980 [(set_attr ("prefix") ("evex"))])
22983 (define_insn "vpdpwssd_<mode>"
22984 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
22985 (unspec:VI4_AVX512VL
22986 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
22987 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
22988 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
22989 UNSPEC_VPMADDWDACCD))]
22990 "TARGET_AVX512VNNI"
22991 "vpdpwssd\t{%3, %2, %0|%0, %2, %3 }"
22992 [(set_attr ("prefix") ("evex"))])
22994 (define_insn "vpdpwssd_<mode>_mask"
22995 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
22996 (vec_merge:VI4_AVX512VL
22997 (unspec:VI4_AVX512VL
22998 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
22999 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
23000 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
23001 UNSPEC_VPMADDWDACCD)
23003 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
23004 "TARGET_AVX512VNNI"
23005 "vpdpwssd\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
23006 [(set_attr ("prefix") ("evex"))])
23008 (define_expand "vpdpwssd_<mode>_maskz"
23009 [(match_operand:VI4_AVX512VL 0 "register_operand")
23010 (match_operand:VI4_AVX512VL 1 "register_operand")
23011 (match_operand:VI4_AVX512VL 2 "register_operand")
23012 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand")
23013 (match_operand:<avx512fmaskmode> 4 "register_operand")]
23014 "TARGET_AVX512VNNI"
23016 emit_insn (gen_vpdpwssd_<mode>_maskz_1 (operands[0], operands[1],
23017 operands[2], operands[3],
23018 CONST0_RTX (<MODE>mode),
23023 (define_insn "vpdpwssd_<mode>_maskz_1"
23024 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
23025 (vec_merge:VI4_AVX512VL
23026 (unspec:VI4_AVX512VL
23027 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
23028 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
23029 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
23030 UNSPEC_VPMADDWDACCD)
23031 (match_operand:VI4_AVX512VL 4 "const0_operand" "C")
23032 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
23033 "TARGET_AVX512VNNI"
23034 "vpdpwssd\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
23035 [(set_attr ("prefix") ("evex"))])
23038 (define_insn "vpdpwssds_<mode>"
23039 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
23040 (unspec:VI4_AVX512VL
23041 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
23042 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
23043 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
23044 UNSPEC_VPMADDWDACCSSD))]
23045 "TARGET_AVX512VNNI"
23046 "vpdpwssds\t{%3, %2, %0|%0, %2, %3 }"
23047 [(set_attr ("prefix") ("evex"))])
23049 (define_insn "vpdpwssds_<mode>_mask"
23050 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
23051 (vec_merge:VI4_AVX512VL
23052 (unspec:VI4_AVX512VL
23053 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
23054 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
23055 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
23056 UNSPEC_VPMADDWDACCSSD)
23058 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
23059 "TARGET_AVX512VNNI"
23060 "vpdpwssds\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
23061 [(set_attr ("prefix") ("evex"))])
23063 (define_expand "vpdpwssds_<mode>_maskz"
23064 [(match_operand:VI4_AVX512VL 0 "register_operand")
23065 (match_operand:VI4_AVX512VL 1 "register_operand")
23066 (match_operand:VI4_AVX512VL 2 "register_operand")
23067 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand")
23068 (match_operand:<avx512fmaskmode> 4 "register_operand")]
23069 "TARGET_AVX512VNNI"
23071 emit_insn (gen_vpdpwssds_<mode>_maskz_1 (operands[0], operands[1],
23072 operands[2], operands[3],
23073 CONST0_RTX (<MODE>mode),
23078 (define_insn "vpdpwssds_<mode>_maskz_1"
23079 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
23080 (vec_merge:VI4_AVX512VL
23081 (unspec:VI4_AVX512VL
23082 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
23083 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
23084 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
23085 UNSPEC_VPMADDWDACCSSD)
23086 (match_operand:VI4_AVX512VL 4 "const0_operand" "C")
23087 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
23088 "TARGET_AVX512VNNI"
23089 "vpdpwssds\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
23090 [(set_attr ("prefix") ("evex"))])
23092 (define_insn "vaesdec_<mode>"
23093 [(set (match_operand:VI1_AVX512VL_F 0 "register_operand" "=v")
23094 (unspec:VI1_AVX512VL_F
23095 [(match_operand:VI1_AVX512VL_F 1 "register_operand" "v")
23096 (match_operand:VI1_AVX512VL_F 2 "vector_operand" "vm")]
23099 "vaesdec\t{%2, %1, %0|%0, %1, %2}"
23102 (define_insn "vaesdeclast_<mode>"
23103 [(set (match_operand:VI1_AVX512VL_F 0 "register_operand" "=v")
23104 (unspec:VI1_AVX512VL_F
23105 [(match_operand:VI1_AVX512VL_F 1 "register_operand" "v")
23106 (match_operand:VI1_AVX512VL_F 2 "vector_operand" "vm")]
23107 UNSPEC_VAESDECLAST))]
23109 "vaesdeclast\t{%2, %1, %0|%0, %1, %2}"
23112 (define_insn "vaesenc_<mode>"
23113 [(set (match_operand:VI1_AVX512VL_F 0 "register_operand" "=v")
23114 (unspec:VI1_AVX512VL_F
23115 [(match_operand:VI1_AVX512VL_F 1 "register_operand" "v")
23116 (match_operand:VI1_AVX512VL_F 2 "vector_operand" "vm")]
23119 "vaesenc\t{%2, %1, %0|%0, %1, %2}"
23122 (define_insn "vaesenclast_<mode>"
23123 [(set (match_operand:VI1_AVX512VL_F 0 "register_operand" "=v")
23124 (unspec:VI1_AVX512VL_F
23125 [(match_operand:VI1_AVX512VL_F 1 "register_operand" "v")
23126 (match_operand:VI1_AVX512VL_F 2 "vector_operand" "vm")]
23127 UNSPEC_VAESENCLAST))]
23129 "vaesenclast\t{%2, %1, %0|%0, %1, %2}"
23132 (define_insn "vpclmulqdq_<mode>"
23133 [(set (match_operand:VI8_FVL 0 "register_operand" "=v")
23134 (unspec:VI8_FVL [(match_operand:VI8_FVL 1 "register_operand" "v")
23135 (match_operand:VI8_FVL 2 "vector_operand" "vm")
23136 (match_operand:SI 3 "const_0_to_255_operand" "n")]
23137 UNSPEC_VPCLMULQDQ))]
23138 "TARGET_VPCLMULQDQ"
23139 "vpclmulqdq\t{%3, %2, %1, %0|%0, %1, %2, %3}"
23140 [(set_attr "mode" "DI")])
23142 (define_insn "avx512vl_vpshufbitqmb<mode><mask_scalar_merge_name>"
23143 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=k")
23144 (unspec:<avx512fmaskmode>
23145 [(match_operand:VI1_AVX512VLBW 1 "register_operand" "v")
23146 (match_operand:VI1_AVX512VLBW 2 "nonimmediate_operand" "vm")]
23147 UNSPEC_VPSHUFBIT))]
23148 "TARGET_AVX512BITALG"
23149 "vpshufbitqmb\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
23150 [(set_attr "prefix" "evex")
23151 (set_attr "mode" "<sseinsnmode>")])
23153 (define_mode_iterator VI48_AVX512VP2VL
23155 (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")
23156 (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")])
23158 (define_insn "avx512vp2intersect_2intersect<mode>"
23159 [(set (match_operand:P2QI 0 "register_operand" "=k")
23161 [(match_operand:VI48_AVX512VP2VL 1 "register_operand" "v")
23162 (match_operand:VI48_AVX512VP2VL 2 "vector_operand" "vm")]
23163 UNSPEC_VP2INTERSECT))]
23164 "TARGET_AVX512VP2INTERSECT"
23165 "vp2intersect<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
23166 [(set_attr ("prefix") ("evex"))])
23168 (define_insn "avx512vp2intersect_2intersectv16si"
23169 [(set (match_operand:P2HI 0 "register_operand" "=k")
23170 (unspec:P2HI [(match_operand:V16SI 1 "register_operand" "v")
23171 (match_operand:V16SI 2 "vector_operand" "vm")]
23172 UNSPEC_VP2INTERSECT))]
23173 "TARGET_AVX512VP2INTERSECT"
23174 "vp2intersectd\t{%2, %1, %0|%0, %1, %2}"
23175 [(set_attr ("prefix") ("evex"))])
23177 (define_mode_iterator BF16 [V32HI (V16HI "TARGET_AVX512VL") (V8HI "TARGET_AVX512VL")])
23178 ;; Converting from BF to SF
23179 (define_mode_attr bf16_cvt_2sf
23180 [(V32HI "V16SF") (V16HI "V8SF") (V8HI "V4SF")])
23181 ;; Converting from SF to BF
23182 (define_mode_attr sf_cvt_bf16
23183 [(V4SF "V8HI") (V8SF "V8HI") (V16SF "V16HI")])
23184 ;; Mapping from BF to SF
23185 (define_mode_attr sf_bf16
23186 [(V4SF "V8HI") (V8SF "V16HI") (V16SF "V32HI")])
23188 (define_expand "avx512f_cvtne2ps2bf16_<mode>_maskz"
23189 [(match_operand:BF16 0 "register_operand")
23190 (match_operand:<bf16_cvt_2sf> 1 "register_operand")
23191 (match_operand:<bf16_cvt_2sf> 2 "register_operand")
23192 (match_operand:<avx512fmaskmode> 3 "register_operand")]
23193 "TARGET_AVX512BF16"
23195 emit_insn (gen_avx512f_cvtne2ps2bf16_<mode>_mask(operands[0], operands[1],
23196 operands[2], CONST0_RTX(<MODE>mode), operands[3]));
23200 (define_insn "avx512f_cvtne2ps2bf16_<mode><mask_name>"
23201 [(set (match_operand:BF16 0 "register_operand" "=v")
23203 [(match_operand:<bf16_cvt_2sf> 1 "register_operand" "v")
23204 (match_operand:<bf16_cvt_2sf> 2 "register_operand" "v")]
23205 UNSPEC_VCVTNE2PS2BF16))]
23206 "TARGET_AVX512BF16"
23207 "vcvtne2ps2bf16\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}")
23209 (define_expand "avx512f_cvtneps2bf16_<mode>_maskz"
23210 [(match_operand:<sf_cvt_bf16> 0 "register_operand")
23211 (match_operand:VF1_AVX512VL 1 "register_operand")
23212 (match_operand:<avx512fmaskmode> 2 "register_operand")]
23213 "TARGET_AVX512BF16"
23215 emit_insn (gen_avx512f_cvtneps2bf16_<mode>_mask(operands[0], operands[1],
23216 CONST0_RTX(<sf_cvt_bf16>mode), operands[2]));
23220 (define_insn "avx512f_cvtneps2bf16_<mode><mask_name>"
23221 [(set (match_operand:<sf_cvt_bf16> 0 "register_operand" "=v")
23222 (unspec:<sf_cvt_bf16>
23223 [(match_operand:VF1_AVX512VL 1 "register_operand" "v")]
23224 UNSPEC_VCVTNEPS2BF16))]
23225 "TARGET_AVX512BF16"
23226 "vcvtneps2bf16\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}")
23228 (define_expand "avx512f_dpbf16ps_<mode>_maskz"
23229 [(match_operand:VF1_AVX512VL 0 "register_operand")
23230 (match_operand:VF1_AVX512VL 1 "register_operand")
23231 (match_operand:<sf_bf16> 2 "register_operand")
23232 (match_operand:<sf_bf16> 3 "register_operand")
23233 (match_operand:<avx512fmaskhalfmode> 4 "register_operand")]
23234 "TARGET_AVX512BF16"
23236 emit_insn (gen_avx512f_dpbf16ps_<mode>_maskz_1(operands[0], operands[1],
23237 operands[2], operands[3], CONST0_RTX(<MODE>mode), operands[4]));
23241 (define_insn "avx512f_dpbf16ps_<mode><maskz_half_name>"
23242 [(set (match_operand:VF1_AVX512VL 0 "register_operand" "=v")
23243 (unspec:VF1_AVX512VL
23244 [(match_operand:VF1_AVX512VL 1 "register_operand" "0")
23245 (match_operand:<sf_bf16> 2 "register_operand" "v")
23246 (match_operand:<sf_bf16> 3 "register_operand" "v")]
23247 UNSPEC_VDPBF16PS))]
23248 "TARGET_AVX512BF16"
23249 "vdpbf16ps\t{%3, %2, %0<maskz_half_operand4>|%0<maskz_half_operand4>, %2, %3}")
23251 (define_insn "avx512f_dpbf16ps_<mode>_mask"
23252 [(set (match_operand:VF1_AVX512VL 0 "register_operand" "=v")
23253 (vec_merge:VF1_AVX512VL
23254 (unspec:VF1_AVX512VL
23255 [(match_operand:VF1_AVX512VL 1 "register_operand" "0")
23256 (match_operand:<sf_bf16> 2 "register_operand" "v")
23257 (match_operand:<sf_bf16> 3 "register_operand" "v")]
23260 (match_operand:<avx512fmaskhalfmode> 4 "register_operand" "Yk")))]
23261 "TARGET_AVX512BF16"
23262 "vdpbf16ps\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3}")