1 ;; GCC machine description for SSE instructions
2 ;; Copyright (C) 2005-2018 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" [
53 UNSPEC_XOP_UNSIGNED_CMP
64 UNSPEC_AESKEYGENASSIST
85 ;; For AVX512F support
87 UNSPEC_UNSIGNED_FIX_NOTRUNC
102 UNSPEC_COMPRESS_STORE
112 ;; For embed. rounding feature
113 UNSPEC_EMBEDDED_ROUNDING
115 ;; For AVX512PF support
116 UNSPEC_GATHER_PREFETCH
117 UNSPEC_SCATTER_PREFETCH
119 ;; For AVX512ER support
133 ;; For AVX512BW support
141 ;; For AVX512DQ support
146 ;; For AVX512IFMA support
150 ;; For AVX512VBMI support
153 ;; For AVX5124FMAPS/AVX5124VNNIW support
160 UNSPEC_GF2P8AFFINEINV
164 ;; For AVX512VBMI2 support
170 ;; For AVX512VNNI support
171 UNSPEC_VPMADDUBSWACCD
172 UNSPEC_VPMADDUBSWACCSSD
174 UNSPEC_VPMADDWDACCSSD
182 ;; For VPCLMULQDQ support
185 ;; For AVX512BITALG support
189 (define_c_enum "unspecv" [
199 ;; All vector modes including V?TImode, used in move patterns.
200 (define_mode_iterator VMOVE
201 [(V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI
202 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX") V8HI
203 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
204 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI
205 (V4TI "TARGET_AVX512F") (V2TI "TARGET_AVX") V1TI
206 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
207 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") V2DF])
209 ;; All AVX-512{F,VL} vector modes. Supposed TARGET_AVX512F baseline.
210 (define_mode_iterator V48_AVX512VL
211 [V16SI (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")
212 V8DI (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")
213 V16SF (V8SF "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
214 V8DF (V4DF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
216 ;; 1,2 byte AVX-512{BW,VL} vector modes. Supposed TARGET_AVX512BW baseline.
217 (define_mode_iterator VI12_AVX512VL
218 [V64QI (V16QI "TARGET_AVX512VL") (V32QI "TARGET_AVX512VL")
219 V32HI (V16HI "TARGET_AVX512VL") (V8HI "TARGET_AVX512VL")])
221 ;; Same iterator, but without supposed TARGET_AVX512BW
222 (define_mode_iterator VI12_AVX512VLBW
223 [(V64QI "TARGET_AVX512BW") (V16QI "TARGET_AVX512VL")
224 (V32QI "TARGET_AVX512VL && TARGET_AVX512BW") (V32HI "TARGET_AVX512BW")
225 (V16HI "TARGET_AVX512VL") (V8HI "TARGET_AVX512VL")])
227 (define_mode_iterator VI1_AVX512VL
228 [V64QI (V16QI "TARGET_AVX512VL") (V32QI "TARGET_AVX512VL")])
231 (define_mode_iterator V
232 [(V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI
233 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX") V8HI
234 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
235 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI
236 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
237 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
239 ;; All 128bit vector modes
240 (define_mode_iterator V_128
241 [V16QI V8HI V4SI V2DI V4SF (V2DF "TARGET_SSE2")])
243 ;; All 256bit vector modes
244 (define_mode_iterator V_256
245 [V32QI V16HI V8SI V4DI V8SF V4DF])
247 ;; All 128bit and 256bit vector modes
248 (define_mode_iterator V_128_256
249 [V32QI V16QI V16HI V8HI V8SI V4SI V4DI V2DI V8SF V4SF V4DF V2DF])
251 ;; All 512bit vector modes
252 (define_mode_iterator V_512 [V64QI V32HI V16SI V8DI V16SF V8DF])
254 ;; All 256bit and 512bit vector modes
255 (define_mode_iterator V_256_512
256 [V32QI V16HI V8SI V4DI V8SF V4DF
257 (V64QI "TARGET_AVX512F") (V32HI "TARGET_AVX512F") (V16SI "TARGET_AVX512F")
258 (V8DI "TARGET_AVX512F") (V16SF "TARGET_AVX512F") (V8DF "TARGET_AVX512F")])
260 ;; All vector float modes
261 (define_mode_iterator VF
262 [(V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
263 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
265 ;; 128- and 256-bit float vector modes
266 (define_mode_iterator VF_128_256
267 [(V8SF "TARGET_AVX") V4SF
268 (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
270 ;; All SFmode vector float modes
271 (define_mode_iterator VF1
272 [(V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF])
274 ;; 128- and 256-bit SF vector modes
275 (define_mode_iterator VF1_128_256
276 [(V8SF "TARGET_AVX") V4SF])
278 (define_mode_iterator VF1_128_256VL
279 [V8SF (V4SF "TARGET_AVX512VL")])
281 ;; All DFmode vector float modes
282 (define_mode_iterator VF2
283 [(V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") V2DF])
285 ;; 128- and 256-bit DF vector modes
286 (define_mode_iterator VF2_128_256
287 [(V4DF "TARGET_AVX") V2DF])
289 (define_mode_iterator VF2_512_256
290 [(V8DF "TARGET_AVX512F") V4DF])
292 (define_mode_iterator VF2_512_256VL
293 [V8DF (V4DF "TARGET_AVX512VL")])
295 ;; All 128bit vector float modes
296 (define_mode_iterator VF_128
297 [V4SF (V2DF "TARGET_SSE2")])
299 ;; All 256bit vector float modes
300 (define_mode_iterator VF_256
303 ;; All 512bit vector float modes
304 (define_mode_iterator VF_512
307 (define_mode_iterator VI48_AVX512VL
308 [V16SI (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")
309 V8DI (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")])
311 (define_mode_iterator VF_AVX512VL
312 [V16SF (V8SF "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
313 V8DF (V4DF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
315 (define_mode_iterator VF2_AVX512VL
316 [V8DF (V4DF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
318 (define_mode_iterator VF1_AVX512VL
319 [V16SF (V8SF "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")])
321 ;; All vector integer modes
322 (define_mode_iterator VI
323 [(V16SI "TARGET_AVX512F") (V8DI "TARGET_AVX512F")
324 (V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX") V16QI
325 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX") V8HI
326 (V8SI "TARGET_AVX") V4SI
327 (V4DI "TARGET_AVX") V2DI])
329 (define_mode_iterator VI_AVX2
330 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI
331 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI
332 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX2") V4SI
333 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX2") V2DI])
335 ;; All QImode vector integer modes
336 (define_mode_iterator VI1
337 [(V32QI "TARGET_AVX") V16QI])
339 ;; All DImode vector integer modes
340 (define_mode_iterator V_AVX
341 [V16QI V8HI V4SI V2DI V4SF V2DF
342 (V32QI "TARGET_AVX") (V16HI "TARGET_AVX")
343 (V8SI "TARGET_AVX") (V4DI "TARGET_AVX")
344 (V8SF "TARGET_AVX") (V4DF"TARGET_AVX")])
346 (define_mode_iterator VI48_AVX
348 (V8SI "TARGET_AVX") (V4DI "TARGET_AVX")])
350 (define_mode_iterator VI8
351 [(V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI])
353 (define_mode_iterator VI8_FVL
354 [(V8DI "TARGET_AVX512F") V4DI (V2DI "TARGET_AVX512VL")])
356 (define_mode_iterator VI8_AVX512VL
357 [V8DI (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")])
359 (define_mode_iterator VI8_256_512
360 [V8DI (V4DI "TARGET_AVX512VL")])
362 (define_mode_iterator VI1_AVX2
363 [(V32QI "TARGET_AVX2") V16QI])
365 (define_mode_iterator VI1_AVX512
366 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI])
368 (define_mode_iterator VI1_AVX512F
369 [(V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI])
371 (define_mode_iterator VI2_AVX2
372 [(V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI])
374 (define_mode_iterator VI2_AVX512F
375 [(V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX2") V8HI])
377 (define_mode_iterator VI4_AVX
378 [(V8SI "TARGET_AVX") V4SI])
380 (define_mode_iterator VI4_AVX2
381 [(V8SI "TARGET_AVX2") V4SI])
383 (define_mode_iterator VI4_AVX512F
384 [(V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX2") V4SI])
386 (define_mode_iterator VI4_AVX512VL
387 [V16SI (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")])
389 (define_mode_iterator VI48_AVX512F_AVX512VL
390 [V4SI V8SI (V16SI "TARGET_AVX512F")
391 (V2DI "TARGET_AVX512VL") (V4DI "TARGET_AVX512VL") (V8DI "TARGET_AVX512F")])
393 (define_mode_iterator VI2_AVX512VL
394 [(V8HI "TARGET_AVX512VL") (V16HI "TARGET_AVX512VL") V32HI])
396 (define_mode_iterator VI1_AVX512VL_F
397 [V32QI (V16QI "TARGET_AVX512VL") (V64QI "TARGET_AVX512F")])
399 (define_mode_iterator VI8_AVX2_AVX512BW
400 [(V8DI "TARGET_AVX512BW") (V4DI "TARGET_AVX2") V2DI])
402 (define_mode_iterator VI8_AVX2
403 [(V4DI "TARGET_AVX2") V2DI])
405 (define_mode_iterator VI8_AVX2_AVX512F
406 [(V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX2") V2DI])
408 (define_mode_iterator VI8_AVX_AVX512F
409 [(V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX")])
411 (define_mode_iterator VI4_128_8_256
415 (define_mode_iterator V8FI
419 (define_mode_iterator V16FI
422 ;; ??? We should probably use TImode instead.
423 (define_mode_iterator VIMAX_AVX2_AVX512BW
424 [(V4TI "TARGET_AVX512BW") (V2TI "TARGET_AVX2") V1TI])
426 ;; Suppose TARGET_AVX512BW as baseline
427 (define_mode_iterator VIMAX_AVX512VL
428 [V4TI (V2TI "TARGET_AVX512VL") (V1TI "TARGET_AVX512VL")])
430 (define_mode_iterator VIMAX_AVX2
431 [(V2TI "TARGET_AVX2") V1TI])
433 ;; ??? This should probably be dropped in favor of VIMAX_AVX2_AVX512BW.
434 (define_mode_iterator SSESCALARMODE
435 [(V4TI "TARGET_AVX512BW") (V2TI "TARGET_AVX2") TI])
437 (define_mode_iterator VI12_AVX2
438 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI
439 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI])
441 (define_mode_iterator VI24_AVX2
442 [(V16HI "TARGET_AVX2") V8HI
443 (V8SI "TARGET_AVX2") V4SI])
445 (define_mode_iterator VI124_AVX2_24_AVX512F_1_AVX512BW
446 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI
447 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX2") V8HI
448 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX2") V4SI])
450 (define_mode_iterator VI124_AVX2
451 [(V32QI "TARGET_AVX2") V16QI
452 (V16HI "TARGET_AVX2") V8HI
453 (V8SI "TARGET_AVX2") V4SI])
455 (define_mode_iterator VI2_AVX2_AVX512BW
456 [(V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI])
458 (define_mode_iterator VI248_AVX512VL
460 (V16HI "TARGET_AVX512VL") (V8SI "TARGET_AVX512VL")
461 (V4DI "TARGET_AVX512VL") (V8HI "TARGET_AVX512VL")
462 (V4SI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")])
464 (define_mode_iterator VI48_AVX2
465 [(V8SI "TARGET_AVX2") V4SI
466 (V4DI "TARGET_AVX2") V2DI])
468 (define_mode_iterator VI248_AVX2
469 [(V16HI "TARGET_AVX2") V8HI
470 (V8SI "TARGET_AVX2") V4SI
471 (V4DI "TARGET_AVX2") V2DI])
473 (define_mode_iterator VI248_AVX2_8_AVX512F_24_AVX512BW
474 [(V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI
475 (V16SI "TARGET_AVX512BW") (V8SI "TARGET_AVX2") V4SI
476 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX2") V2DI])
478 (define_mode_iterator VI248_AVX512BW
479 [(V32HI "TARGET_AVX512BW") V16SI V8DI])
481 (define_mode_iterator VI248_AVX512BW_AVX512VL
482 [(V32HI "TARGET_AVX512BW")
483 (V4DI "TARGET_AVX512VL") V16SI V8DI])
485 ;; Suppose TARGET_AVX512VL as baseline
486 (define_mode_iterator VI248_AVX512BW_1
487 [(V16HI "TARGET_AVX512BW") (V8HI "TARGET_AVX512BW")
491 (define_mode_iterator VI248_AVX512BW_2
492 [(V16HI "TARGET_AVX512BW") (V8HI "TARGET_AVX512BW")
496 (define_mode_iterator VI48_AVX512F
497 [(V16SI "TARGET_AVX512F") V8SI V4SI
498 (V8DI "TARGET_AVX512F") V4DI V2DI])
500 (define_mode_iterator VI48_AVX_AVX512F
501 [(V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
502 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI])
504 (define_mode_iterator VI12_AVX_AVX512F
505 [ (V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI
506 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX") V8HI])
508 (define_mode_iterator V48_AVX2
511 (V4SI "TARGET_AVX2") (V2DI "TARGET_AVX2")
512 (V8SI "TARGET_AVX2") (V4DI "TARGET_AVX2")])
514 (define_mode_iterator VI1_AVX512VLBW
515 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX512VL")
516 (V16QI "TARGET_AVX512VL")])
518 (define_mode_attr avx512
519 [(V16QI "avx512vl") (V32QI "avx512vl") (V64QI "avx512bw")
520 (V8HI "avx512vl") (V16HI "avx512vl") (V32HI "avx512bw")
521 (V4SI "avx512vl") (V8SI "avx512vl") (V16SI "avx512f")
522 (V2DI "avx512vl") (V4DI "avx512vl") (V8DI "avx512f")
523 (V4SF "avx512vl") (V8SF "avx512vl") (V16SF "avx512f")
524 (V2DF "avx512vl") (V4DF "avx512vl") (V8DF "avx512f")])
526 (define_mode_attr sse2_avx_avx512f
527 [(V16QI "sse2") (V32QI "avx") (V64QI "avx512f")
528 (V8HI "avx512vl") (V16HI "avx512vl") (V32HI "avx512bw")
529 (V4SI "sse2") (V8SI "avx") (V16SI "avx512f")
530 (V2DI "avx512vl") (V4DI "avx512vl") (V8DI "avx512f")
531 (V16SF "avx512f") (V8SF "avx") (V4SF "avx")
532 (V8DF "avx512f") (V4DF "avx") (V2DF "avx")])
534 (define_mode_attr sse2_avx2
535 [(V16QI "sse2") (V32QI "avx2") (V64QI "avx512bw")
536 (V8HI "sse2") (V16HI "avx2") (V32HI "avx512bw")
537 (V4SI "sse2") (V8SI "avx2") (V16SI "avx512f")
538 (V2DI "sse2") (V4DI "avx2") (V8DI "avx512f")
539 (V1TI "sse2") (V2TI "avx2") (V4TI "avx512bw")])
541 (define_mode_attr ssse3_avx2
542 [(V16QI "ssse3") (V32QI "avx2") (V64QI "avx512bw")
543 (V4HI "ssse3") (V8HI "ssse3") (V16HI "avx2") (V32HI "avx512bw")
544 (V4SI "ssse3") (V8SI "avx2")
545 (V2DI "ssse3") (V4DI "avx2")
546 (TI "ssse3") (V2TI "avx2") (V4TI "avx512bw")])
548 (define_mode_attr sse4_1_avx2
549 [(V16QI "sse4_1") (V32QI "avx2") (V64QI "avx512bw")
550 (V8HI "sse4_1") (V16HI "avx2") (V32HI "avx512bw")
551 (V4SI "sse4_1") (V8SI "avx2") (V16SI "avx512f")
552 (V2DI "sse4_1") (V4DI "avx2") (V8DI "avx512dq")])
554 (define_mode_attr avx_avx2
555 [(V4SF "avx") (V2DF "avx")
556 (V8SF "avx") (V4DF "avx")
557 (V4SI "avx2") (V2DI "avx2")
558 (V8SI "avx2") (V4DI "avx2")])
560 (define_mode_attr vec_avx2
561 [(V16QI "vec") (V32QI "avx2")
562 (V8HI "vec") (V16HI "avx2")
563 (V4SI "vec") (V8SI "avx2")
564 (V2DI "vec") (V4DI "avx2")])
566 (define_mode_attr avx2_avx512
567 [(V4SI "avx2") (V8SI "avx2") (V16SI "avx512f")
568 (V2DI "avx2") (V4DI "avx2") (V8DI "avx512f")
569 (V4SF "avx2") (V8SF "avx2") (V16SF "avx512f")
570 (V2DF "avx2") (V4DF "avx2") (V8DF "avx512f")
571 (V8HI "avx512vl") (V16HI "avx512vl") (V32HI "avx512bw")])
573 (define_mode_attr shuffletype
574 [(V16SF "f") (V16SI "i") (V8DF "f") (V8DI "i")
575 (V8SF "f") (V8SI "i") (V4DF "f") (V4DI "i")
576 (V4SF "f") (V4SI "i") (V2DF "f") (V2DI "i")
577 (V32HI "i") (V16HI "i") (V8HI "i")
578 (V64QI "i") (V32QI "i") (V16QI "i")
579 (V4TI "i") (V2TI "i") (V1TI "i")])
581 (define_mode_attr ssequartermode
582 [(V16SF "V4SF") (V8DF "V2DF") (V16SI "V4SI") (V8DI "V2DI")])
584 (define_mode_attr ssedoublemodelower
585 [(V16QI "v16hi") (V32QI "v32hi") (V64QI "v64hi")
586 (V8HI "v8si") (V16HI "v16si") (V32HI "v32si")
587 (V4SI "v4di") (V8SI "v8di") (V16SI "v16di")])
589 (define_mode_attr ssedoublemode
590 [(V4SF "V8SF") (V8SF "V16SF") (V16SF "V32SF")
591 (V2DF "V4DF") (V4DF "V8DF") (V8DF "V16DF")
592 (V16QI "V16HI") (V32QI "V32HI") (V64QI "V64HI")
593 (V4HI "V4SI") (V8HI "V8SI") (V16HI "V16SI") (V32HI "V32SI")
594 (V4SI "V4DI") (V8SI "V16SI") (V16SI "V32SI")
595 (V4DI "V8DI") (V8DI "V16DI")])
597 (define_mode_attr ssebytemode
598 [(V8DI "V64QI") (V4DI "V32QI") (V2DI "V16QI")])
600 ;; All 128bit vector integer modes
601 (define_mode_iterator VI_128 [V16QI V8HI V4SI V2DI])
603 ;; All 256bit vector integer modes
604 (define_mode_iterator VI_256 [V32QI V16HI V8SI V4DI])
606 ;; Various 128bit vector integer mode combinations
607 (define_mode_iterator VI12_128 [V16QI V8HI])
608 (define_mode_iterator VI14_128 [V16QI V4SI])
609 (define_mode_iterator VI124_128 [V16QI V8HI V4SI])
610 (define_mode_iterator VI24_128 [V8HI V4SI])
611 (define_mode_iterator VI248_128 [V8HI V4SI V2DI])
612 (define_mode_iterator VI48_128 [V4SI V2DI])
614 ;; Various 256bit and 512 vector integer mode combinations
615 (define_mode_iterator VI124_256 [V32QI V16HI V8SI])
616 (define_mode_iterator VI124_256_AVX512F_AVX512BW
618 (V64QI "TARGET_AVX512BW")
619 (V32HI "TARGET_AVX512BW")
620 (V16SI "TARGET_AVX512F")])
621 (define_mode_iterator VI48_256 [V8SI V4DI])
622 (define_mode_iterator VI48_512 [V16SI V8DI])
623 (define_mode_iterator VI4_256_8_512 [V8SI V8DI])
624 (define_mode_iterator VI_AVX512BW
625 [V16SI V8DI (V32HI "TARGET_AVX512BW") (V64QI "TARGET_AVX512BW")])
627 ;; Int-float size matches
628 (define_mode_iterator VI4F_128 [V4SI V4SF])
629 (define_mode_iterator VI8F_128 [V2DI V2DF])
630 (define_mode_iterator VI4F_256 [V8SI V8SF])
631 (define_mode_iterator VI8F_256 [V4DI V4DF])
632 (define_mode_iterator VI4F_256_512
634 (V16SI "TARGET_AVX512F") (V16SF "TARGET_AVX512F")])
635 (define_mode_iterator VI48F_256_512
637 (V16SI "TARGET_AVX512F") (V16SF "TARGET_AVX512F")
638 (V8DI "TARGET_AVX512F") (V8DF "TARGET_AVX512F")
639 (V4DI "TARGET_AVX512VL") (V4DF "TARGET_AVX512VL")])
640 (define_mode_iterator VF48_I1248
641 [V16SI V16SF V8DI V8DF V32HI V64QI])
642 (define_mode_iterator VI48F
643 [V16SI V16SF V8DI V8DF
644 (V8SI "TARGET_AVX512VL") (V8SF "TARGET_AVX512VL")
645 (V4DI "TARGET_AVX512VL") (V4DF "TARGET_AVX512VL")
646 (V4SI "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
647 (V2DI "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
648 (define_mode_iterator VI48F_256 [V8SI V8SF V4DI V4DF])
650 ;; Mapping from float mode to required SSE level
651 (define_mode_attr sse
652 [(SF "sse") (DF "sse2")
653 (V4SF "sse") (V2DF "sse2")
654 (V16SF "avx512f") (V8SF "avx")
655 (V8DF "avx512f") (V4DF "avx")])
657 (define_mode_attr sse2
658 [(V16QI "sse2") (V32QI "avx") (V64QI "avx512f")
659 (V2DI "sse2") (V4DI "avx") (V8DI "avx512f")])
661 (define_mode_attr sse3
662 [(V16QI "sse3") (V32QI "avx")])
664 (define_mode_attr sse4_1
665 [(V4SF "sse4_1") (V2DF "sse4_1")
666 (V8SF "avx") (V4DF "avx")
668 (V4DI "avx") (V2DI "sse4_1")
669 (V8SI "avx") (V4SI "sse4_1")
670 (V16QI "sse4_1") (V32QI "avx")
671 (V8HI "sse4_1") (V16HI "avx")])
673 (define_mode_attr avxsizesuffix
674 [(V64QI "512") (V32HI "512") (V16SI "512") (V8DI "512")
675 (V32QI "256") (V16HI "256") (V8SI "256") (V4DI "256")
676 (V16QI "") (V8HI "") (V4SI "") (V2DI "")
677 (V16SF "512") (V8DF "512")
678 (V8SF "256") (V4DF "256")
679 (V4SF "") (V2DF "")])
681 ;; SSE instruction mode
682 (define_mode_attr sseinsnmode
683 [(V64QI "XI") (V32HI "XI") (V16SI "XI") (V8DI "XI") (V4TI "XI")
684 (V32QI "OI") (V16HI "OI") (V8SI "OI") (V4DI "OI") (V2TI "OI")
685 (V16QI "TI") (V8HI "TI") (V4SI "TI") (V2DI "TI") (V1TI "TI")
686 (V16SF "V16SF") (V8DF "V8DF")
687 (V8SF "V8SF") (V4DF "V4DF")
688 (V4SF "V4SF") (V2DF "V2DF")
691 ;; Mapping of vector modes to corresponding mask size
692 (define_mode_attr avx512fmaskmode
693 [(V64QI "DI") (V32QI "SI") (V16QI "HI")
694 (V32HI "SI") (V16HI "HI") (V8HI "QI") (V4HI "QI")
695 (V16SI "HI") (V8SI "QI") (V4SI "QI")
696 (V8DI "QI") (V4DI "QI") (V2DI "QI")
697 (V16SF "HI") (V8SF "QI") (V4SF "QI")
698 (V8DF "QI") (V4DF "QI") (V2DF "QI")])
700 ;; Mapping of vector modes to corresponding mask size
701 (define_mode_attr avx512fmaskmodelower
702 [(V64QI "di") (V32QI "si") (V16QI "hi")
703 (V32HI "si") (V16HI "hi") (V8HI "qi") (V4HI "qi")
704 (V16SI "hi") (V8SI "qi") (V4SI "qi")
705 (V8DI "qi") (V4DI "qi") (V2DI "qi")
706 (V16SF "hi") (V8SF "qi") (V4SF "qi")
707 (V8DF "qi") (V4DF "qi") (V2DF "qi")])
709 ;; Mapping of vector float modes to an integer mode of the same size
710 (define_mode_attr sseintvecmode
711 [(V16SF "V16SI") (V8DF "V8DI")
712 (V8SF "V8SI") (V4DF "V4DI")
713 (V4SF "V4SI") (V2DF "V2DI")
714 (V16SI "V16SI") (V8DI "V8DI")
715 (V8SI "V8SI") (V4DI "V4DI")
716 (V4SI "V4SI") (V2DI "V2DI")
717 (V16HI "V16HI") (V8HI "V8HI")
718 (V32HI "V32HI") (V64QI "V64QI")
719 (V32QI "V32QI") (V16QI "V16QI")])
721 (define_mode_attr sseintvecmode2
722 [(V8DF "XI") (V4DF "OI") (V2DF "TI")
723 (V8SF "OI") (V4SF "TI")])
725 (define_mode_attr sseintvecmodelower
726 [(V16SF "v16si") (V8DF "v8di")
727 (V8SF "v8si") (V4DF "v4di")
728 (V4SF "v4si") (V2DF "v2di")
729 (V8SI "v8si") (V4DI "v4di")
730 (V4SI "v4si") (V2DI "v2di")
731 (V16HI "v16hi") (V8HI "v8hi")
732 (V32QI "v32qi") (V16QI "v16qi")])
734 ;; Mapping of vector modes to a vector mode of double size
735 (define_mode_attr ssedoublevecmode
736 [(V32QI "V64QI") (V16HI "V32HI") (V8SI "V16SI") (V4DI "V8DI")
737 (V16QI "V32QI") (V8HI "V16HI") (V4SI "V8SI") (V2DI "V4DI")
738 (V8SF "V16SF") (V4DF "V8DF")
739 (V4SF "V8SF") (V2DF "V4DF")])
741 ;; Mapping of vector modes to a vector mode of half size
742 (define_mode_attr ssehalfvecmode
743 [(V64QI "V32QI") (V32HI "V16HI") (V16SI "V8SI") (V8DI "V4DI") (V4TI "V2TI")
744 (V32QI "V16QI") (V16HI "V8HI") (V8SI "V4SI") (V4DI "V2DI")
745 (V16QI "V8QI") (V8HI "V4HI") (V4SI "V2SI")
746 (V16SF "V8SF") (V8DF "V4DF")
747 (V8SF "V4SF") (V4DF "V2DF")
750 (define_mode_attr ssehalfvecmodelower
751 [(V64QI "v32qi") (V32HI "v16hi") (V16SI "v8si") (V8DI "v4di") (V4TI "v2ti")
752 (V32QI "v16qi") (V16HI "v8hi") (V8SI "v4si") (V4DI "v2di")
753 (V16QI "v8qi") (V8HI "v4hi") (V4SI "v2si")
754 (V16SF "v8sf") (V8DF "v4df")
755 (V8SF "v4sf") (V4DF "v2df")
758 ;; Mapping of vector modes ti packed single mode of the same size
759 (define_mode_attr ssePSmode
760 [(V16SI "V16SF") (V8DF "V16SF")
761 (V16SF "V16SF") (V8DI "V16SF")
762 (V64QI "V16SF") (V32QI "V8SF") (V16QI "V4SF")
763 (V32HI "V16SF") (V16HI "V8SF") (V8HI "V4SF")
764 (V8SI "V8SF") (V4SI "V4SF")
765 (V4DI "V8SF") (V2DI "V4SF")
766 (V4TI "V16SF") (V2TI "V8SF") (V1TI "V4SF")
767 (V8SF "V8SF") (V4SF "V4SF")
768 (V4DF "V8SF") (V2DF "V4SF")])
770 (define_mode_attr ssePSmode2
771 [(V8DI "V8SF") (V4DI "V4SF")])
773 ;; Mapping of vector modes back to the scalar modes
774 (define_mode_attr ssescalarmode
775 [(V64QI "QI") (V32QI "QI") (V16QI "QI")
776 (V32HI "HI") (V16HI "HI") (V8HI "HI")
777 (V16SI "SI") (V8SI "SI") (V4SI "SI")
778 (V8DI "DI") (V4DI "DI") (V2DI "DI")
779 (V16SF "SF") (V8SF "SF") (V4SF "SF")
780 (V8DF "DF") (V4DF "DF") (V2DF "DF")
781 (V4TI "TI") (V2TI "TI")])
783 ;; Mapping of vector modes back to the scalar modes
784 (define_mode_attr ssescalarmodelower
785 [(V64QI "qi") (V32QI "qi") (V16QI "qi")
786 (V32HI "hi") (V16HI "hi") (V8HI "hi")
787 (V16SI "si") (V8SI "si") (V4SI "si")
788 (V8DI "di") (V4DI "di") (V2DI "di")
789 (V16SF "sf") (V8SF "sf") (V4SF "sf")
790 (V8DF "df") (V4DF "df") (V2DF "df")
791 (V4TI "ti") (V2TI "ti")])
793 ;; Mapping of vector modes to the 128bit modes
794 (define_mode_attr ssexmmmode
795 [(V64QI "V16QI") (V32QI "V16QI") (V16QI "V16QI")
796 (V32HI "V8HI") (V16HI "V8HI") (V8HI "V8HI")
797 (V16SI "V4SI") (V8SI "V4SI") (V4SI "V4SI")
798 (V8DI "V2DI") (V4DI "V2DI") (V2DI "V2DI")
799 (V16SF "V4SF") (V8SF "V4SF") (V4SF "V4SF")
800 (V8DF "V2DF") (V4DF "V2DF") (V2DF "V2DF")])
802 ;; Pointer size override for scalar modes (Intel asm dialect)
803 (define_mode_attr iptr
804 [(V64QI "b") (V32HI "w") (V16SI "k") (V8DI "q")
805 (V32QI "b") (V16HI "w") (V8SI "k") (V4DI "q")
806 (V16QI "b") (V8HI "w") (V4SI "k") (V2DI "q")
807 (V16SF "k") (V8DF "q")
808 (V8SF "k") (V4DF "q")
809 (V4SF "k") (V2DF "q")
812 ;; Number of scalar elements in each vector type
813 (define_mode_attr ssescalarnum
814 [(V64QI "64") (V16SI "16") (V8DI "8")
815 (V32QI "32") (V16HI "16") (V8SI "8") (V4DI "4")
816 (V16QI "16") (V8HI "8") (V4SI "4") (V2DI "2")
817 (V16SF "16") (V8DF "8")
818 (V8SF "8") (V4DF "4")
819 (V4SF "4") (V2DF "2")])
821 ;; Mask of scalar elements in each vector type
822 (define_mode_attr ssescalarnummask
823 [(V32QI "31") (V16HI "15") (V8SI "7") (V4DI "3")
824 (V16QI "15") (V8HI "7") (V4SI "3") (V2DI "1")
825 (V8SF "7") (V4DF "3")
826 (V4SF "3") (V2DF "1")])
828 (define_mode_attr ssescalarsize
829 [(V4TI "64") (V2TI "64") (V1TI "64")
830 (V8DI "64") (V4DI "64") (V2DI "64")
831 (V64QI "8") (V32QI "8") (V16QI "8")
832 (V32HI "16") (V16HI "16") (V8HI "16")
833 (V16SI "32") (V8SI "32") (V4SI "32")
834 (V16SF "32") (V8SF "32") (V4SF "32")
835 (V8DF "64") (V4DF "64") (V2DF "64")])
837 ;; SSE prefix for integer vector modes
838 (define_mode_attr sseintprefix
839 [(V2DI "p") (V2DF "")
844 (V16SI "p") (V16SF "")
845 (V16QI "p") (V8HI "p")
846 (V32QI "p") (V16HI "p")
847 (V64QI "p") (V32HI "p")])
849 ;; SSE scalar suffix for vector modes
850 (define_mode_attr ssescalarmodesuffix
852 (V16SF "ss") (V8DF "sd")
853 (V8SF "ss") (V4DF "sd")
854 (V4SF "ss") (V2DF "sd")
855 (V16SI "d") (V8DI "q")
856 (V8SI "d") (V4DI "q")
857 (V4SI "d") (V2DI "q")])
859 ;; Pack/unpack vector modes
860 (define_mode_attr sseunpackmode
861 [(V16QI "V8HI") (V8HI "V4SI") (V4SI "V2DI")
862 (V32QI "V16HI") (V16HI "V8SI") (V8SI "V4DI")
863 (V32HI "V16SI") (V64QI "V32HI") (V16SI "V8DI")])
865 (define_mode_attr ssepackmode
866 [(V8HI "V16QI") (V4SI "V8HI") (V2DI "V4SI")
867 (V16HI "V32QI") (V8SI "V16HI") (V4DI "V8SI")
868 (V32HI "V64QI") (V16SI "V32HI") (V8DI "V16SI")])
870 ;; Mapping of the max integer size for xop rotate immediate constraint
871 (define_mode_attr sserotatemax
872 [(V16QI "7") (V8HI "15") (V4SI "31") (V2DI "63")])
874 ;; Mapping of mode to cast intrinsic name
875 (define_mode_attr castmode
876 [(V8SI "si") (V8SF "ps") (V4DF "pd")
877 (V16SI "si") (V16SF "ps") (V8DF "pd")])
879 ;; Instruction suffix for sign and zero extensions.
880 (define_code_attr extsuffix [(sign_extend "sx") (zero_extend "zx")])
882 ;; i128 for integer vectors and TARGET_AVX2, f128 otherwise.
883 ;; i64x4 or f64x4 for 512bit modes.
884 (define_mode_attr i128
885 [(V16SF "f64x4") (V8SF "f128") (V8DF "f64x4") (V4DF "f128")
886 (V64QI "i64x4") (V32QI "%~128") (V32HI "i64x4") (V16HI "%~128")
887 (V16SI "i64x4") (V8SI "%~128") (V8DI "i64x4") (V4DI "%~128")])
889 ;; For 256-bit modes for TARGET_AVX512VL && TARGET_AVX512DQ
890 ;; i32x4, f32x4, i64x2 or f64x2 suffixes.
891 (define_mode_attr i128vldq
892 [(V8SF "f32x4") (V4DF "f64x2")
893 (V32QI "i32x4") (V16HI "i32x4") (V8SI "i32x4") (V4DI "i64x2")])
896 (define_mode_iterator AVX256MODE2P [V8SI V8SF V4DF])
897 (define_mode_iterator AVX512MODE2P [V16SI V16SF V8DF])
899 ;; Mapping for dbpsabbw modes
900 (define_mode_attr dbpsadbwmode
901 [(V32HI "V64QI") (V16HI "V32QI") (V8HI "V16QI")])
903 ;; Mapping suffixes for broadcast
904 (define_mode_attr bcstscalarsuff
905 [(V64QI "b") (V32QI "b") (V16QI "b")
906 (V32HI "w") (V16HI "w") (V8HI "w")
907 (V16SI "d") (V8SI "d") (V4SI "d")
908 (V8DI "q") (V4DI "q") (V2DI "q")
909 (V16SF "ss") (V8SF "ss") (V4SF "ss")
910 (V8DF "sd") (V4DF "sd") (V2DF "sd")])
912 ;; Tie mode of assembler operand to mode iterator
913 (define_mode_attr concat_tg_mode
914 [(V32QI "t") (V16HI "t") (V8SI "t") (V4DI "t") (V8SF "t") (V4DF "t")
915 (V64QI "g") (V32HI "g") (V16SI "g") (V8DI "g") (V16SF "g") (V8DF "g")])
917 ;; Tie mode of assembler operand to mode iterator
918 (define_mode_attr xtg_mode
919 [(V16QI "x") (V8HI "x") (V4SI "x") (V2DI "x") (V4SF "x") (V2DF "x")
920 (V32QI "t") (V16HI "t") (V8SI "t") (V4DI "t") (V8SF "t") (V4DF "t")
921 (V64QI "g") (V32HI "g") (V16SI "g") (V8DI "g") (V16SF "g") (V8DF "g")])
923 ;; Half mask mode for unpacks
924 (define_mode_attr HALFMASKMODE
925 [(DI "SI") (SI "HI")])
927 ;; Double mask mode for packs
928 (define_mode_attr DOUBLEMASKMODE
929 [(HI "SI") (SI "DI")])
932 ;; Include define_subst patterns for instructions with mask
935 ;; Patterns whose name begins with "sse{,2,3}_" are invoked by intrinsics.
937 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
941 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
943 ;; All of these patterns are enabled for SSE1 as well as SSE2.
944 ;; This is essential for maintaining stable calling conventions.
946 (define_expand "mov<mode>"
947 [(set (match_operand:VMOVE 0 "nonimmediate_operand")
948 (match_operand:VMOVE 1 "nonimmediate_operand"))]
951 ix86_expand_vector_move (<MODE>mode, operands);
955 (define_insn "mov<mode>_internal"
956 [(set (match_operand:VMOVE 0 "nonimmediate_operand"
958 (match_operand:VMOVE 1 "nonimmediate_or_sse_const_operand"
961 && (register_operand (operands[0], <MODE>mode)
962 || register_operand (operands[1], <MODE>mode))"
964 switch (get_attr_type (insn))
967 return standard_sse_constant_opcode (insn, operands);
970 /* There is no evex-encoded vmov* for sizes smaller than 64-bytes
971 in avx512f, so we need to use workarounds, to access sse registers
972 16-31, which are evex-only. In avx512vl we don't need workarounds. */
973 if (TARGET_AVX512F && <MODE_SIZE> < 64 && !TARGET_AVX512VL
974 && (EXT_REX_SSE_REG_P (operands[0])
975 || EXT_REX_SSE_REG_P (operands[1])))
977 if (memory_operand (operands[0], <MODE>mode))
979 if (<MODE_SIZE> == 32)
980 return "vextract<shuffletype>64x4\t{$0x0, %g1, %0|%0, %g1, 0x0}";
981 else if (<MODE_SIZE> == 16)
982 return "vextract<shuffletype>32x4\t{$0x0, %g1, %0|%0, %g1, 0x0}";
986 else if (memory_operand (operands[1], <MODE>mode))
988 if (<MODE_SIZE> == 32)
989 return "vbroadcast<shuffletype>64x4\t{%1, %g0|%g0, %1}";
990 else if (<MODE_SIZE> == 16)
991 return "vbroadcast<shuffletype>32x4\t{%1, %g0|%g0, %1}";
996 /* Reg -> reg move is always aligned. Just use wider move. */
997 switch (get_attr_mode (insn))
1001 return "vmovaps\t{%g1, %g0|%g0, %g1}";
1004 return "vmovapd\t{%g1, %g0|%g0, %g1}";
1007 return "vmovdqa64\t{%g1, %g0|%g0, %g1}";
1013 switch (get_attr_mode (insn))
1018 if (misaligned_operand (operands[0], <MODE>mode)
1019 || misaligned_operand (operands[1], <MODE>mode))
1020 return "%vmovups\t{%1, %0|%0, %1}";
1022 return "%vmovaps\t{%1, %0|%0, %1}";
1027 if (misaligned_operand (operands[0], <MODE>mode)
1028 || misaligned_operand (operands[1], <MODE>mode))
1029 return "%vmovupd\t{%1, %0|%0, %1}";
1031 return "%vmovapd\t{%1, %0|%0, %1}";
1035 if (misaligned_operand (operands[0], <MODE>mode)
1036 || misaligned_operand (operands[1], <MODE>mode))
1037 return TARGET_AVX512VL
1038 && (<MODE>mode == V4SImode
1039 || <MODE>mode == V2DImode
1040 || <MODE>mode == V8SImode
1041 || <MODE>mode == V4DImode
1043 ? "vmovdqu<ssescalarsize>\t{%1, %0|%0, %1}"
1044 : "%vmovdqu\t{%1, %0|%0, %1}";
1046 return TARGET_AVX512VL ? "vmovdqa64\t{%1, %0|%0, %1}"
1047 : "%vmovdqa\t{%1, %0|%0, %1}";
1049 if (misaligned_operand (operands[0], <MODE>mode)
1050 || misaligned_operand (operands[1], <MODE>mode))
1051 return (<MODE>mode == V16SImode
1052 || <MODE>mode == V8DImode
1054 ? "vmovdqu<ssescalarsize>\t{%1, %0|%0, %1}"
1055 : "vmovdqu64\t{%1, %0|%0, %1}";
1057 return "vmovdqa64\t{%1, %0|%0, %1}";
1067 [(set_attr "type" "sselog1,sselog1,ssemov,ssemov")
1068 (set_attr "prefix" "maybe_vex")
1070 (cond [(and (eq_attr "alternative" "1")
1071 (match_test "TARGET_AVX512VL"))
1072 (const_string "<sseinsnmode>")
1073 (and (match_test "<MODE_SIZE> == 16")
1074 (ior (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
1075 (and (eq_attr "alternative" "3")
1076 (match_test "TARGET_SSE_TYPELESS_STORES"))))
1077 (const_string "<ssePSmode>")
1078 (match_test "TARGET_AVX")
1079 (const_string "<sseinsnmode>")
1080 (ior (not (match_test "TARGET_SSE2"))
1081 (match_test "optimize_function_for_size_p (cfun)"))
1082 (const_string "V4SF")
1083 (and (eq_attr "alternative" "0")
1084 (match_test "TARGET_SSE_LOAD0_BY_PXOR"))
1087 (const_string "<sseinsnmode>")))
1088 (set (attr "enabled")
1089 (cond [(and (match_test "<MODE_SIZE> == 16")
1090 (eq_attr "alternative" "1"))
1091 (symbol_ref "TARGET_SSE2")
1092 (and (match_test "<MODE_SIZE> == 32")
1093 (eq_attr "alternative" "1"))
1094 (symbol_ref "TARGET_AVX2")
1096 (symbol_ref "true")))])
1098 (define_insn "<avx512>_load<mode>_mask"
1099 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v,v")
1100 (vec_merge:V48_AVX512VL
1101 (match_operand:V48_AVX512VL 1 "nonimmediate_operand" "v,m")
1102 (match_operand:V48_AVX512VL 2 "vector_move_operand" "0C,0C")
1103 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
1106 if (FLOAT_MODE_P (GET_MODE_INNER (<MODE>mode)))
1108 if (misaligned_operand (operands[1], <MODE>mode))
1109 return "vmovu<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
1111 return "vmova<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
1115 if (misaligned_operand (operands[1], <MODE>mode))
1116 return "vmovdqu<ssescalarsize>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
1118 return "vmovdqa<ssescalarsize>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
1121 [(set_attr "type" "ssemov")
1122 (set_attr "prefix" "evex")
1123 (set_attr "memory" "none,load")
1124 (set_attr "mode" "<sseinsnmode>")])
1126 (define_insn "<avx512>_load<mode>_mask"
1127 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v,v")
1128 (vec_merge:VI12_AVX512VL
1129 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "v,m")
1130 (match_operand:VI12_AVX512VL 2 "vector_move_operand" "0C,0C")
1131 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
1133 "vmovdqu<ssescalarsize>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
1134 [(set_attr "type" "ssemov")
1135 (set_attr "prefix" "evex")
1136 (set_attr "memory" "none,load")
1137 (set_attr "mode" "<sseinsnmode>")])
1139 (define_insn "<avx512>_blendm<mode>"
1140 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v")
1141 (vec_merge:V48_AVX512VL
1142 (match_operand:V48_AVX512VL 2 "nonimmediate_operand" "vm")
1143 (match_operand:V48_AVX512VL 1 "register_operand" "v")
1144 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
1146 "v<sseintprefix>blendm<ssemodesuffix>\t{%2, %1, %0%{%3%}|%0%{%3%}, %1, %2}"
1147 [(set_attr "type" "ssemov")
1148 (set_attr "prefix" "evex")
1149 (set_attr "mode" "<sseinsnmode>")])
1151 (define_insn "<avx512>_blendm<mode>"
1152 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
1153 (vec_merge:VI12_AVX512VL
1154 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")
1155 (match_operand:VI12_AVX512VL 1 "register_operand" "v")
1156 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
1158 "vpblendm<ssemodesuffix>\t{%2, %1, %0%{%3%}|%0%{%3%}, %1, %2}"
1159 [(set_attr "type" "ssemov")
1160 (set_attr "prefix" "evex")
1161 (set_attr "mode" "<sseinsnmode>")])
1163 (define_insn "<avx512>_store<mode>_mask"
1164 [(set (match_operand:V48_AVX512VL 0 "memory_operand" "=m")
1165 (vec_merge:V48_AVX512VL
1166 (match_operand:V48_AVX512VL 1 "register_operand" "v")
1168 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")))]
1171 if (FLOAT_MODE_P (GET_MODE_INNER (<MODE>mode)))
1173 if (misaligned_operand (operands[0], <MODE>mode))
1174 return "vmovu<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1176 return "vmova<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1180 if (misaligned_operand (operands[0], <MODE>mode))
1181 return "vmovdqu<ssescalarsize>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1183 return "vmovdqa<ssescalarsize>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1186 [(set_attr "type" "ssemov")
1187 (set_attr "prefix" "evex")
1188 (set_attr "memory" "store")
1189 (set_attr "mode" "<sseinsnmode>")])
1191 (define_insn "<avx512>_store<mode>_mask"
1192 [(set (match_operand:VI12_AVX512VL 0 "memory_operand" "=m")
1193 (vec_merge:VI12_AVX512VL
1194 (match_operand:VI12_AVX512VL 1 "register_operand" "v")
1196 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")))]
1198 "vmovdqu<ssescalarsize>\t{%1, %0%{%2%}|%0%{%2%}, %1}"
1199 [(set_attr "type" "ssemov")
1200 (set_attr "prefix" "evex")
1201 (set_attr "memory" "store")
1202 (set_attr "mode" "<sseinsnmode>")])
1204 (define_insn "sse2_movq128"
1205 [(set (match_operand:V2DI 0 "register_operand" "=v")
1208 (match_operand:V2DI 1 "nonimmediate_operand" "vm")
1209 (parallel [(const_int 0)]))
1212 "%vmovq\t{%1, %0|%0, %q1}"
1213 [(set_attr "type" "ssemov")
1214 (set_attr "prefix" "maybe_vex")
1215 (set_attr "mode" "TI")])
1217 ;; Move a DI from a 32-bit register pair (e.g. %edx:%eax) to an xmm.
1218 ;; We'd rather avoid this entirely; if the 32-bit reg pair was loaded
1219 ;; from memory, we'd prefer to load the memory directly into the %xmm
1220 ;; register. To facilitate this happy circumstance, this pattern won't
1221 ;; split until after register allocation. If the 64-bit value didn't
1222 ;; come from memory, this is the best we can do. This is much better
1223 ;; than storing %edx:%eax into a stack temporary and loading an %xmm
1226 (define_insn_and_split "movdi_to_sse"
1228 [(set (match_operand:V4SI 0 "register_operand" "=?x,x")
1229 (subreg:V4SI (match_operand:DI 1 "nonimmediate_operand" "r,m") 0))
1230 (clobber (match_scratch:V4SI 2 "=&x,X"))])]
1231 "!TARGET_64BIT && TARGET_SSE2 && TARGET_INTER_UNIT_MOVES_TO_VEC"
1233 "&& reload_completed"
1236 if (register_operand (operands[1], DImode))
1238 /* The DImode arrived in a pair of integral registers (e.g. %edx:%eax).
1239 Assemble the 64-bit DImode value in an xmm register. */
1240 emit_insn (gen_sse2_loadld (operands[0], CONST0_RTX (V4SImode),
1241 gen_lowpart (SImode, operands[1])));
1242 emit_insn (gen_sse2_loadld (operands[2], CONST0_RTX (V4SImode),
1243 gen_highpart (SImode, operands[1])));
1244 emit_insn (gen_vec_interleave_lowv4si (operands[0], operands[0],
1247 else if (memory_operand (operands[1], DImode))
1249 rtx tmp = gen_reg_rtx (V2DImode);
1250 emit_insn (gen_vec_concatv2di (tmp, operands[1], const0_rtx));
1251 emit_move_insn (operands[0], gen_lowpart (V4SImode, tmp));
1259 [(set (match_operand:V4SF 0 "register_operand")
1260 (match_operand:V4SF 1 "zero_extended_scalar_load_operand"))]
1261 "TARGET_SSE && reload_completed"
1264 (vec_duplicate:V4SF (match_dup 1))
1268 operands[1] = gen_lowpart (SFmode, operands[1]);
1269 operands[2] = CONST0_RTX (V4SFmode);
1273 [(set (match_operand:V2DF 0 "register_operand")
1274 (match_operand:V2DF 1 "zero_extended_scalar_load_operand"))]
1275 "TARGET_SSE2 && reload_completed"
1276 [(set (match_dup 0) (vec_concat:V2DF (match_dup 1) (match_dup 2)))]
1278 operands[1] = gen_lowpart (DFmode, operands[1]);
1279 operands[2] = CONST0_RTX (DFmode);
1282 (define_expand "movmisalign<mode>"
1283 [(set (match_operand:VMOVE 0 "nonimmediate_operand")
1284 (match_operand:VMOVE 1 "nonimmediate_operand"))]
1287 ix86_expand_vector_move_misalign (<MODE>mode, operands);
1291 ;; Merge movsd/movhpd to movupd for TARGET_SSE_UNALIGNED_LOAD_OPTIMAL targets.
1293 [(set (match_operand:V2DF 0 "sse_reg_operand")
1294 (vec_concat:V2DF (match_operand:DF 1 "memory_operand")
1295 (match_operand:DF 4 "const0_operand")))
1296 (set (match_operand:V2DF 2 "sse_reg_operand")
1297 (vec_concat:V2DF (vec_select:DF (match_dup 2)
1298 (parallel [(const_int 0)]))
1299 (match_operand:DF 3 "memory_operand")))]
1300 "TARGET_SSE2 && TARGET_SSE_UNALIGNED_LOAD_OPTIMAL
1301 && ix86_operands_ok_for_move_multiple (operands, true, DFmode)"
1302 [(set (match_dup 2) (match_dup 5))]
1303 "operands[5] = adjust_address (operands[1], V2DFmode, 0);")
1306 [(set (match_operand:DF 0 "sse_reg_operand")
1307 (match_operand:DF 1 "memory_operand"))
1308 (set (match_operand:V2DF 2 "sse_reg_operand")
1309 (vec_concat:V2DF (match_operand:DF 4 "sse_reg_operand")
1310 (match_operand:DF 3 "memory_operand")))]
1311 "TARGET_SSE2 && TARGET_SSE_UNALIGNED_LOAD_OPTIMAL
1312 && REGNO (operands[4]) == REGNO (operands[2])
1313 && ix86_operands_ok_for_move_multiple (operands, true, DFmode)"
1314 [(set (match_dup 2) (match_dup 5))]
1315 "operands[5] = adjust_address (operands[1], V2DFmode, 0);")
1317 ;; Merge movlpd/movhpd to movupd for TARGET_SSE_UNALIGNED_STORE_OPTIMAL targets.
1319 [(set (match_operand:DF 0 "memory_operand")
1320 (vec_select:DF (match_operand:V2DF 1 "sse_reg_operand")
1321 (parallel [(const_int 0)])))
1322 (set (match_operand:DF 2 "memory_operand")
1323 (vec_select:DF (match_operand:V2DF 3 "sse_reg_operand")
1324 (parallel [(const_int 1)])))]
1325 "TARGET_SSE2 && TARGET_SSE_UNALIGNED_STORE_OPTIMAL
1326 && ix86_operands_ok_for_move_multiple (operands, false, DFmode)"
1327 [(set (match_dup 4) (match_dup 1))]
1328 "operands[4] = adjust_address (operands[0], V2DFmode, 0);")
1330 (define_insn "<sse3>_lddqu<avxsizesuffix>"
1331 [(set (match_operand:VI1 0 "register_operand" "=x")
1332 (unspec:VI1 [(match_operand:VI1 1 "memory_operand" "m")]
1335 "%vlddqu\t{%1, %0|%0, %1}"
1336 [(set_attr "type" "ssemov")
1337 (set_attr "movu" "1")
1338 (set (attr "prefix_data16")
1340 (match_test "TARGET_AVX")
1342 (const_string "0")))
1343 (set (attr "prefix_rep")
1345 (match_test "TARGET_AVX")
1347 (const_string "1")))
1348 (set_attr "prefix" "maybe_vex")
1349 (set_attr "mode" "<sseinsnmode>")])
1351 (define_insn "sse2_movnti<mode>"
1352 [(set (match_operand:SWI48 0 "memory_operand" "=m")
1353 (unspec:SWI48 [(match_operand:SWI48 1 "register_operand" "r")]
1356 "movnti\t{%1, %0|%0, %1}"
1357 [(set_attr "type" "ssemov")
1358 (set_attr "prefix_data16" "0")
1359 (set_attr "mode" "<MODE>")])
1361 (define_insn "<sse>_movnt<mode>"
1362 [(set (match_operand:VF 0 "memory_operand" "=m")
1364 [(match_operand:VF 1 "register_operand" "v")]
1367 "%vmovnt<ssemodesuffix>\t{%1, %0|%0, %1}"
1368 [(set_attr "type" "ssemov")
1369 (set_attr "prefix" "maybe_vex")
1370 (set_attr "mode" "<MODE>")])
1372 (define_insn "<sse2>_movnt<mode>"
1373 [(set (match_operand:VI8 0 "memory_operand" "=m")
1374 (unspec:VI8 [(match_operand:VI8 1 "register_operand" "v")]
1377 "%vmovntdq\t{%1, %0|%0, %1}"
1378 [(set_attr "type" "ssecvt")
1379 (set (attr "prefix_data16")
1381 (match_test "TARGET_AVX")
1383 (const_string "1")))
1384 (set_attr "prefix" "maybe_vex")
1385 (set_attr "mode" "<sseinsnmode>")])
1387 ; Expand patterns for non-temporal stores. At the moment, only those
1388 ; that directly map to insns are defined; it would be possible to
1389 ; define patterns for other modes that would expand to several insns.
1391 ;; Modes handled by storent patterns.
1392 (define_mode_iterator STORENT_MODE
1393 [(DI "TARGET_SSE2 && TARGET_64BIT") (SI "TARGET_SSE2")
1394 (SF "TARGET_SSE4A") (DF "TARGET_SSE4A")
1395 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") (V2DI "TARGET_SSE2")
1396 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
1397 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
1399 (define_expand "storent<mode>"
1400 [(set (match_operand:STORENT_MODE 0 "memory_operand")
1401 (unspec:STORENT_MODE
1402 [(match_operand:STORENT_MODE 1 "register_operand")]
1406 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1410 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1412 ;; All integer modes with AVX512BW/DQ.
1413 (define_mode_iterator SWI1248_AVX512BWDQ
1414 [(QI "TARGET_AVX512DQ") HI (SI "TARGET_AVX512BW") (DI "TARGET_AVX512BW")])
1416 ;; All integer modes with AVX512BW, where HImode operation
1417 ;; can be used instead of QImode.
1418 (define_mode_iterator SWI1248_AVX512BW
1419 [QI HI (SI "TARGET_AVX512BW") (DI "TARGET_AVX512BW")])
1421 ;; All integer modes with AVX512BW/DQ, even HImode requires DQ.
1422 (define_mode_iterator SWI1248_AVX512BWDQ2
1423 [(QI "TARGET_AVX512DQ") (HI "TARGET_AVX512DQ")
1424 (SI "TARGET_AVX512BW") (DI "TARGET_AVX512BW")])
1426 (define_expand "kmov<mskmodesuffix>"
1427 [(set (match_operand:SWI1248_AVX512BWDQ 0 "nonimmediate_operand")
1428 (match_operand:SWI1248_AVX512BWDQ 1 "nonimmediate_operand"))]
1430 && !(MEM_P (operands[0]) && MEM_P (operands[1]))")
1432 (define_insn "k<code><mode>"
1433 [(set (match_operand:SWI1248_AVX512BW 0 "register_operand" "=k")
1434 (any_logic:SWI1248_AVX512BW
1435 (match_operand:SWI1248_AVX512BW 1 "register_operand" "k")
1436 (match_operand:SWI1248_AVX512BW 2 "register_operand" "k")))
1437 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1440 if (get_attr_mode (insn) == MODE_HI)
1441 return "k<logic>w\t{%2, %1, %0|%0, %1, %2}";
1443 return "k<logic><mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}";
1445 [(set_attr "type" "msklog")
1446 (set_attr "prefix" "vex")
1448 (cond [(and (match_test "<MODE>mode == QImode")
1449 (not (match_test "TARGET_AVX512DQ")))
1452 (const_string "<MODE>")))])
1454 (define_insn "kandn<mode>"
1455 [(set (match_operand:SWI1248_AVX512BW 0 "register_operand" "=k")
1456 (and:SWI1248_AVX512BW
1457 (not:SWI1248_AVX512BW
1458 (match_operand:SWI1248_AVX512BW 1 "register_operand" "k"))
1459 (match_operand:SWI1248_AVX512BW 2 "register_operand" "k")))
1460 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1463 if (get_attr_mode (insn) == MODE_HI)
1464 return "kandnw\t{%2, %1, %0|%0, %1, %2}";
1466 return "kandn<mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}";
1468 [(set_attr "type" "msklog")
1469 (set_attr "prefix" "vex")
1471 (cond [(and (match_test "<MODE>mode == QImode")
1472 (not (match_test "TARGET_AVX512DQ")))
1475 (const_string "<MODE>")))])
1477 (define_insn "kxnor<mode>"
1478 [(set (match_operand:SWI1248_AVX512BW 0 "register_operand" "=k")
1479 (not:SWI1248_AVX512BW
1480 (xor:SWI1248_AVX512BW
1481 (match_operand:SWI1248_AVX512BW 1 "register_operand" "k")
1482 (match_operand:SWI1248_AVX512BW 2 "register_operand" "k"))))
1483 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1486 if (get_attr_mode (insn) == MODE_HI)
1487 return "kxnorw\t{%2, %1, %0|%0, %1, %2}";
1489 return "kxnor<mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}";
1491 [(set_attr "type" "msklog")
1492 (set_attr "prefix" "vex")
1494 (cond [(and (match_test "<MODE>mode == QImode")
1495 (not (match_test "TARGET_AVX512DQ")))
1498 (const_string "<MODE>")))])
1500 (define_insn "knot<mode>"
1501 [(set (match_operand:SWI1248_AVX512BW 0 "register_operand" "=k")
1502 (not:SWI1248_AVX512BW
1503 (match_operand:SWI1248_AVX512BW 1 "register_operand" "k")))
1504 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1507 if (get_attr_mode (insn) == MODE_HI)
1508 return "knotw\t{%1, %0|%0, %1}";
1510 return "knot<mskmodesuffix>\t{%1, %0|%0, %1}";
1512 [(set_attr "type" "msklog")
1513 (set_attr "prefix" "vex")
1515 (cond [(and (match_test "<MODE>mode == QImode")
1516 (not (match_test "TARGET_AVX512DQ")))
1519 (const_string "<MODE>")))])
1521 (define_insn "kadd<mode>"
1522 [(set (match_operand:SWI1248_AVX512BWDQ2 0 "register_operand" "=k")
1523 (plus:SWI1248_AVX512BWDQ2
1524 (match_operand:SWI1248_AVX512BWDQ2 1 "register_operand" "k")
1525 (match_operand:SWI1248_AVX512BWDQ2 2 "register_operand" "k")))
1526 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1528 "kadd<mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}"
1529 [(set_attr "type" "msklog")
1530 (set_attr "prefix" "vex")
1531 (set_attr "mode" "<MODE>")])
1533 ;; Mask variant shift mnemonics
1534 (define_code_attr mshift [(ashift "shiftl") (lshiftrt "shiftr")])
1536 (define_insn "k<code><mode>"
1537 [(set (match_operand:SWI1248_AVX512BWDQ 0 "register_operand" "=k")
1538 (any_lshift:SWI1248_AVX512BWDQ
1539 (match_operand:SWI1248_AVX512BWDQ 1 "register_operand" "k")
1540 (match_operand:QI 2 "immediate_operand" "n")))
1541 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1543 "k<mshift><mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}"
1544 [(set_attr "type" "msklog")
1545 (set_attr "prefix" "vex")
1546 (set_attr "mode" "<MODE>")])
1548 (define_insn "ktest<mode>"
1549 [(set (reg:CC FLAGS_REG)
1551 [(match_operand:SWI1248_AVX512BWDQ2 0 "register_operand" "k")
1552 (match_operand:SWI1248_AVX512BWDQ2 1 "register_operand" "k")]
1555 "ktest<mskmodesuffix>\t{%1, %0|%0, %1}"
1556 [(set_attr "mode" "<MODE>")
1557 (set_attr "type" "msklog")
1558 (set_attr "prefix" "vex")])
1560 (define_insn "kortest<mode>"
1561 [(set (reg:CC FLAGS_REG)
1563 [(match_operand:SWI1248_AVX512BWDQ 0 "register_operand" "k")
1564 (match_operand:SWI1248_AVX512BWDQ 1 "register_operand" "k")]
1567 "kortest<mskmodesuffix>\t{%1, %0|%0, %1}"
1568 [(set_attr "mode" "<MODE>")
1569 (set_attr "type" "msklog")
1570 (set_attr "prefix" "vex")])
1572 (define_insn "kunpckhi"
1573 [(set (match_operand:HI 0 "register_operand" "=k")
1576 (zero_extend:HI (match_operand:QI 1 "register_operand" "k"))
1578 (zero_extend:HI (match_operand:QI 2 "register_operand" "k"))))]
1580 "kunpckbw\t{%2, %1, %0|%0, %1, %2}"
1581 [(set_attr "mode" "HI")
1582 (set_attr "type" "msklog")
1583 (set_attr "prefix" "vex")])
1585 (define_insn "kunpcksi"
1586 [(set (match_operand:SI 0 "register_operand" "=k")
1589 (zero_extend:SI (match_operand:HI 1 "register_operand" "k"))
1591 (zero_extend:SI (match_operand:HI 2 "register_operand" "k"))))]
1593 "kunpckwd\t{%2, %1, %0|%0, %1, %2}"
1594 [(set_attr "mode" "SI")])
1596 (define_insn "kunpckdi"
1597 [(set (match_operand:DI 0 "register_operand" "=k")
1600 (zero_extend:DI (match_operand:SI 1 "register_operand" "k"))
1602 (zero_extend:DI (match_operand:SI 2 "register_operand" "k"))))]
1604 "kunpckdq\t{%2, %1, %0|%0, %1, %2}"
1605 [(set_attr "mode" "DI")])
1608 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1610 ;; Parallel floating point arithmetic
1612 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1614 (define_expand "<code><mode>2"
1615 [(set (match_operand:VF 0 "register_operand")
1617 (match_operand:VF 1 "register_operand")))]
1619 "ix86_expand_fp_absneg_operator (<CODE>, <MODE>mode, operands); DONE;")
1621 (define_insn_and_split "*absneg<mode>2"
1622 [(set (match_operand:VF 0 "register_operand" "=x,x,v,v")
1623 (match_operator:VF 3 "absneg_operator"
1624 [(match_operand:VF 1 "vector_operand" "0, xBm,v, m")]))
1625 (use (match_operand:VF 2 "vector_operand" "xBm,0, vm,v"))]
1628 "&& reload_completed"
1631 enum rtx_code absneg_op;
1637 if (MEM_P (operands[1]))
1638 op1 = operands[2], op2 = operands[1];
1640 op1 = operands[1], op2 = operands[2];
1645 if (rtx_equal_p (operands[0], operands[1]))
1651 absneg_op = GET_CODE (operands[3]) == NEG ? XOR : AND;
1652 t = gen_rtx_fmt_ee (absneg_op, <MODE>mode, op1, op2);
1653 t = gen_rtx_SET (operands[0], t);
1657 [(set_attr "isa" "noavx,noavx,avx,avx")])
1659 (define_expand "<plusminus_insn><mode>3<mask_name><round_name>"
1660 [(set (match_operand:VF 0 "register_operand")
1662 (match_operand:VF 1 "<round_nimm_predicate>")
1663 (match_operand:VF 2 "<round_nimm_predicate>")))]
1664 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1665 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
1667 (define_insn "*<plusminus_insn><mode>3<mask_name><round_name>"
1668 [(set (match_operand:VF 0 "register_operand" "=x,v")
1670 (match_operand:VF 1 "<round_nimm_predicate>" "<comm>0,v")
1671 (match_operand:VF 2 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
1672 "TARGET_SSE && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)
1673 && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1675 <plusminus_mnemonic><ssemodesuffix>\t{%2, %0|%0, %2}
1676 v<plusminus_mnemonic><ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
1677 [(set_attr "isa" "noavx,avx")
1678 (set_attr "type" "sseadd")
1679 (set_attr "prefix" "<mask_prefix3>")
1680 (set_attr "mode" "<MODE>")])
1682 (define_insn "<sse>_vm<plusminus_insn><mode>3<mask_scalar_name><round_scalar_name>"
1683 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
1686 (match_operand:VF_128 1 "register_operand" "0,v")
1687 (match_operand:VF_128 2 "vector_operand" "xBm,<round_scalar_constraint>"))
1692 <plusminus_mnemonic><ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
1693 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>}"
1694 [(set_attr "isa" "noavx,avx")
1695 (set_attr "type" "sseadd")
1696 (set_attr "prefix" "<round_scalar_prefix>")
1697 (set_attr "mode" "<ssescalarmode>")])
1699 (define_expand "mul<mode>3<mask_name><round_name>"
1700 [(set (match_operand:VF 0 "register_operand")
1702 (match_operand:VF 1 "<round_nimm_predicate>")
1703 (match_operand:VF 2 "<round_nimm_predicate>")))]
1704 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1705 "ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);")
1707 (define_insn "*mul<mode>3<mask_name><round_name>"
1708 [(set (match_operand:VF 0 "register_operand" "=x,v")
1710 (match_operand:VF 1 "<round_nimm_predicate>" "%0,v")
1711 (match_operand:VF 2 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
1713 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
1714 && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1716 mul<ssemodesuffix>\t{%2, %0|%0, %2}
1717 vmul<ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
1718 [(set_attr "isa" "noavx,avx")
1719 (set_attr "type" "ssemul")
1720 (set_attr "prefix" "<mask_prefix3>")
1721 (set_attr "btver2_decode" "direct,double")
1722 (set_attr "mode" "<MODE>")])
1724 (define_insn "<sse>_vm<multdiv_mnemonic><mode>3<mask_scalar_name><round_scalar_name>"
1725 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
1728 (match_operand:VF_128 1 "register_operand" "0,v")
1729 (match_operand:VF_128 2 "vector_operand" "xBm,<round_scalar_constraint>"))
1734 <multdiv_mnemonic><ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
1735 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>}"
1736 [(set_attr "isa" "noavx,avx")
1737 (set_attr "type" "sse<multdiv_mnemonic>")
1738 (set_attr "prefix" "<round_scalar_prefix>")
1739 (set_attr "btver2_decode" "direct,double")
1740 (set_attr "mode" "<ssescalarmode>")])
1742 (define_expand "div<mode>3"
1743 [(set (match_operand:VF2 0 "register_operand")
1744 (div:VF2 (match_operand:VF2 1 "register_operand")
1745 (match_operand:VF2 2 "vector_operand")))]
1747 "ix86_fixup_binary_operands_no_copy (DIV, <MODE>mode, operands);")
1749 (define_expand "div<mode>3"
1750 [(set (match_operand:VF1 0 "register_operand")
1751 (div:VF1 (match_operand:VF1 1 "register_operand")
1752 (match_operand:VF1 2 "vector_operand")))]
1755 ix86_fixup_binary_operands_no_copy (DIV, <MODE>mode, operands);
1758 && TARGET_RECIP_VEC_DIV
1759 && !optimize_insn_for_size_p ()
1760 && flag_finite_math_only && !flag_trapping_math
1761 && flag_unsafe_math_optimizations)
1763 ix86_emit_swdivsf (operands[0], operands[1], operands[2], <MODE>mode);
1768 (define_insn "<sse>_div<mode>3<mask_name><round_name>"
1769 [(set (match_operand:VF 0 "register_operand" "=x,v")
1771 (match_operand:VF 1 "register_operand" "0,v")
1772 (match_operand:VF 2 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
1773 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1775 div<ssemodesuffix>\t{%2, %0|%0, %2}
1776 vdiv<ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
1777 [(set_attr "isa" "noavx,avx")
1778 (set_attr "type" "ssediv")
1779 (set_attr "prefix" "<mask_prefix3>")
1780 (set_attr "mode" "<MODE>")])
1782 (define_insn "<sse>_rcp<mode>2"
1783 [(set (match_operand:VF1_128_256 0 "register_operand" "=x")
1785 [(match_operand:VF1_128_256 1 "vector_operand" "xBm")] UNSPEC_RCP))]
1787 "%vrcpps\t{%1, %0|%0, %1}"
1788 [(set_attr "type" "sse")
1789 (set_attr "atom_sse_attr" "rcp")
1790 (set_attr "btver2_sse_attr" "rcp")
1791 (set_attr "prefix" "maybe_vex")
1792 (set_attr "mode" "<MODE>")])
1794 (define_insn "sse_vmrcpv4sf2"
1795 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
1797 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm,xm")]
1799 (match_operand:V4SF 2 "register_operand" "0,x")
1803 rcpss\t{%1, %0|%0, %k1}
1804 vrcpss\t{%1, %2, %0|%0, %2, %k1}"
1805 [(set_attr "isa" "noavx,avx")
1806 (set_attr "type" "sse")
1807 (set_attr "atom_sse_attr" "rcp")
1808 (set_attr "btver2_sse_attr" "rcp")
1809 (set_attr "prefix" "orig,vex")
1810 (set_attr "mode" "SF")])
1812 (define_insn "<mask_codefor>rcp14<mode><mask_name>"
1813 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
1815 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "vm")]
1818 "vrcp14<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
1819 [(set_attr "type" "sse")
1820 (set_attr "prefix" "evex")
1821 (set_attr "mode" "<MODE>")])
1823 (define_insn "srcp14<mode>"
1824 [(set (match_operand:VF_128 0 "register_operand" "=v")
1827 [(match_operand:VF_128 1 "nonimmediate_operand" "vm")]
1829 (match_operand:VF_128 2 "register_operand" "v")
1832 "vrcp14<ssescalarmodesuffix>\t{%1, %2, %0|%0, %2, %<iptr>1}"
1833 [(set_attr "type" "sse")
1834 (set_attr "prefix" "evex")
1835 (set_attr "mode" "<MODE>")])
1837 (define_insn "srcp14<mode>_mask"
1838 [(set (match_operand:VF_128 0 "register_operand" "=v")
1842 [(match_operand:VF_128 1 "nonimmediate_operand" "vm")]
1844 (match_operand:VF_128 3 "vector_move_operand" "0C")
1845 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk"))
1846 (match_operand:VF_128 2 "register_operand" "v")
1849 "vrcp14<ssescalarmodesuffix>\t{%1, %2, %0%{%4%}%N3|%0%{%4%}%N3, %2, %<iptr>1}"
1850 [(set_attr "type" "sse")
1851 (set_attr "prefix" "evex")
1852 (set_attr "mode" "<MODE>")])
1854 (define_expand "sqrt<mode>2"
1855 [(set (match_operand:VF2 0 "register_operand")
1856 (sqrt:VF2 (match_operand:VF2 1 "vector_operand")))]
1859 (define_expand "sqrt<mode>2"
1860 [(set (match_operand:VF1 0 "register_operand")
1861 (sqrt:VF1 (match_operand:VF1 1 "vector_operand")))]
1865 && TARGET_RECIP_VEC_SQRT
1866 && !optimize_insn_for_size_p ()
1867 && flag_finite_math_only && !flag_trapping_math
1868 && flag_unsafe_math_optimizations)
1870 ix86_emit_swsqrtsf (operands[0], operands[1], <MODE>mode, false);
1875 (define_insn "<sse>_sqrt<mode>2<mask_name><round_name>"
1876 [(set (match_operand:VF 0 "register_operand" "=x,v")
1877 (sqrt:VF (match_operand:VF 1 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
1878 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1880 sqrt<ssemodesuffix>\t{%1, %0|%0, %1}
1881 vsqrt<ssemodesuffix>\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
1882 [(set_attr "isa" "noavx,avx")
1883 (set_attr "type" "sse")
1884 (set_attr "atom_sse_attr" "sqrt")
1885 (set_attr "btver2_sse_attr" "sqrt")
1886 (set_attr "prefix" "maybe_vex")
1887 (set_attr "mode" "<MODE>")])
1889 (define_insn "<sse>_vmsqrt<mode>2<mask_scalar_name><round_scalar_name>"
1890 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
1893 (match_operand:VF_128 1 "vector_operand" "xBm,<round_scalar_constraint>"))
1894 (match_operand:VF_128 2 "register_operand" "0,v")
1898 sqrt<ssescalarmodesuffix>\t{%1, %0|%0, %<iptr>1}
1899 vsqrt<ssescalarmodesuffix>\t{<round_scalar_mask_op3>%1, %2, %0<mask_scalar_operand3>|%0<mask_scalar_operand3>, %2, %<iptr>1<round_scalar_mask_op3>}"
1900 [(set_attr "isa" "noavx,avx")
1901 (set_attr "type" "sse")
1902 (set_attr "atom_sse_attr" "sqrt")
1903 (set_attr "prefix" "<round_scalar_prefix>")
1904 (set_attr "btver2_sse_attr" "sqrt")
1905 (set_attr "mode" "<ssescalarmode>")])
1907 (define_expand "rsqrt<mode>2"
1908 [(set (match_operand:VF1_128_256 0 "register_operand")
1910 [(match_operand:VF1_128_256 1 "vector_operand")] UNSPEC_RSQRT))]
1913 ix86_emit_swsqrtsf (operands[0], operands[1], <MODE>mode, true);
1917 (define_expand "rsqrtv16sf2"
1918 [(set (match_operand:V16SF 0 "register_operand")
1920 [(match_operand:V16SF 1 "vector_operand")]
1922 "TARGET_SSE_MATH && TARGET_AVX512ER"
1924 ix86_emit_swsqrtsf (operands[0], operands[1], V16SFmode, true);
1928 (define_insn "<sse>_rsqrt<mode>2"
1929 [(set (match_operand:VF1_128_256 0 "register_operand" "=x")
1931 [(match_operand:VF1_128_256 1 "vector_operand" "xBm")] UNSPEC_RSQRT))]
1933 "%vrsqrtps\t{%1, %0|%0, %1}"
1934 [(set_attr "type" "sse")
1935 (set_attr "prefix" "maybe_vex")
1936 (set_attr "mode" "<MODE>")])
1938 (define_insn "<mask_codefor>rsqrt14<mode><mask_name>"
1939 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
1941 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "vm")]
1944 "vrsqrt14<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
1945 [(set_attr "type" "sse")
1946 (set_attr "prefix" "evex")
1947 (set_attr "mode" "<MODE>")])
1949 (define_insn "rsqrt14<mode>"
1950 [(set (match_operand:VF_128 0 "register_operand" "=v")
1953 [(match_operand:VF_128 1 "nonimmediate_operand" "vm")]
1955 (match_operand:VF_128 2 "register_operand" "v")
1958 "vrsqrt14<ssescalarmodesuffix>\t{%1, %2, %0|%0, %2, %<iptr>1}"
1959 [(set_attr "type" "sse")
1960 (set_attr "prefix" "evex")
1961 (set_attr "mode" "<MODE>")])
1963 (define_insn "rsqrt14_<mode>_mask"
1964 [(set (match_operand:VF_128 0 "register_operand" "=v")
1968 [(match_operand:VF_128 1 "nonimmediate_operand" "vm")]
1970 (match_operand:VF_128 3 "vector_move_operand" "0C")
1971 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk"))
1972 (match_operand:VF_128 2 "register_operand" "v")
1975 "vrsqrt14<ssescalarmodesuffix>\t{%1, %2, %0%{%4%}%N3|%0%{%4%}%N3, %2, %<iptr>1}"
1976 [(set_attr "type" "sse")
1977 (set_attr "prefix" "evex")
1978 (set_attr "mode" "<MODE>")])
1980 (define_insn "sse_vmrsqrtv4sf2"
1981 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
1983 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm,xm")]
1985 (match_operand:V4SF 2 "register_operand" "0,x")
1989 rsqrtss\t{%1, %0|%0, %k1}
1990 vrsqrtss\t{%1, %2, %0|%0, %2, %k1}"
1991 [(set_attr "isa" "noavx,avx")
1992 (set_attr "type" "sse")
1993 (set_attr "prefix" "orig,vex")
1994 (set_attr "mode" "SF")])
1996 (define_expand "<code><mode>3<mask_name><round_saeonly_name>"
1997 [(set (match_operand:VF 0 "register_operand")
1999 (match_operand:VF 1 "<round_saeonly_nimm_predicate>")
2000 (match_operand:VF 2 "<round_saeonly_nimm_predicate>")))]
2001 "TARGET_SSE && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
2003 if (!flag_finite_math_only || flag_signed_zeros)
2005 operands[1] = force_reg (<MODE>mode, operands[1]);
2006 emit_insn (gen_ieee_<maxmin_float><mode>3<mask_name><round_saeonly_name>
2007 (operands[0], operands[1], operands[2]
2008 <mask_operand_arg34>
2009 <round_saeonly_mask_arg3>));
2013 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
2016 ;; These versions of the min/max patterns are intentionally ignorant of
2017 ;; their behavior wrt -0.0 and NaN (via the commutative operand mark).
2018 ;; Since both the tree-level MAX_EXPR and the rtl-level SMAX operator
2019 ;; are undefined in this condition, we're certain this is correct.
2021 (define_insn "*<code><mode>3<mask_name><round_saeonly_name>"
2022 [(set (match_operand:VF 0 "register_operand" "=x,v")
2024 (match_operand:VF 1 "<round_saeonly_nimm_predicate>" "%0,v")
2025 (match_operand:VF 2 "<round_saeonly_nimm_predicate>" "xBm,<round_saeonly_constraint>")))]
2027 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
2028 && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
2030 <maxmin_float><ssemodesuffix>\t{%2, %0|%0, %2}
2031 v<maxmin_float><ssemodesuffix>\t{<round_saeonly_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_saeonly_mask_op3>}"
2032 [(set_attr "isa" "noavx,avx")
2033 (set_attr "type" "sseadd")
2034 (set_attr "btver2_sse_attr" "maxmin")
2035 (set_attr "prefix" "<mask_prefix3>")
2036 (set_attr "mode" "<MODE>")])
2038 ;; These versions of the min/max patterns implement exactly the operations
2039 ;; min = (op1 < op2 ? op1 : op2)
2040 ;; max = (!(op1 < op2) ? op1 : op2)
2041 ;; Their operands are not commutative, and thus they may be used in the
2042 ;; presence of -0.0 and NaN.
2044 (define_insn "ieee_<ieee_maxmin><mode>3<mask_name><round_saeonly_name>"
2045 [(set (match_operand:VF 0 "register_operand" "=x,v")
2047 [(match_operand:VF 1 "register_operand" "0,v")
2048 (match_operand:VF 2 "<round_saeonly_nimm_predicate>" "xBm,<round_saeonly_constraint>")]
2051 && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
2053 <ieee_maxmin><ssemodesuffix>\t{%2, %0|%0, %2}
2054 v<ieee_maxmin><ssemodesuffix>\t{<round_saeonly_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_saeonly_mask_op3>}"
2055 [(set_attr "isa" "noavx,avx")
2056 (set_attr "type" "sseadd")
2057 (set_attr "btver2_sse_attr" "maxmin")
2058 (set_attr "prefix" "<mask_prefix3>")
2059 (set_attr "mode" "<MODE>")])
2061 (define_insn "<sse>_vm<code><mode>3<mask_scalar_name><round_saeonly_scalar_name>"
2062 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
2065 (match_operand:VF_128 1 "register_operand" "0,v")
2066 (match_operand:VF_128 2 "vector_operand" "xBm,<round_saeonly_scalar_constraint>"))
2071 <maxmin_float><ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
2072 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>}"
2073 [(set_attr "isa" "noavx,avx")
2074 (set_attr "type" "sse")
2075 (set_attr "btver2_sse_attr" "maxmin")
2076 (set_attr "prefix" "<round_saeonly_scalar_prefix>")
2077 (set_attr "mode" "<ssescalarmode>")])
2079 (define_insn "avx_addsubv4df3"
2080 [(set (match_operand:V4DF 0 "register_operand" "=x")
2083 (match_operand:V4DF 1 "register_operand" "x")
2084 (match_operand:V4DF 2 "nonimmediate_operand" "xm"))
2085 (plus:V4DF (match_dup 1) (match_dup 2))
2088 "vaddsubpd\t{%2, %1, %0|%0, %1, %2}"
2089 [(set_attr "type" "sseadd")
2090 (set_attr "prefix" "vex")
2091 (set_attr "mode" "V4DF")])
2093 (define_insn "sse3_addsubv2df3"
2094 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
2097 (match_operand:V2DF 1 "register_operand" "0,x")
2098 (match_operand:V2DF 2 "vector_operand" "xBm,xm"))
2099 (plus:V2DF (match_dup 1) (match_dup 2))
2103 addsubpd\t{%2, %0|%0, %2}
2104 vaddsubpd\t{%2, %1, %0|%0, %1, %2}"
2105 [(set_attr "isa" "noavx,avx")
2106 (set_attr "type" "sseadd")
2107 (set_attr "atom_unit" "complex")
2108 (set_attr "prefix" "orig,vex")
2109 (set_attr "mode" "V2DF")])
2111 (define_insn "avx_addsubv8sf3"
2112 [(set (match_operand:V8SF 0 "register_operand" "=x")
2115 (match_operand:V8SF 1 "register_operand" "x")
2116 (match_operand:V8SF 2 "nonimmediate_operand" "xm"))
2117 (plus:V8SF (match_dup 1) (match_dup 2))
2120 "vaddsubps\t{%2, %1, %0|%0, %1, %2}"
2121 [(set_attr "type" "sseadd")
2122 (set_attr "prefix" "vex")
2123 (set_attr "mode" "V8SF")])
2125 (define_insn "sse3_addsubv4sf3"
2126 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
2129 (match_operand:V4SF 1 "register_operand" "0,x")
2130 (match_operand:V4SF 2 "vector_operand" "xBm,xm"))
2131 (plus:V4SF (match_dup 1) (match_dup 2))
2135 addsubps\t{%2, %0|%0, %2}
2136 vaddsubps\t{%2, %1, %0|%0, %1, %2}"
2137 [(set_attr "isa" "noavx,avx")
2138 (set_attr "type" "sseadd")
2139 (set_attr "prefix" "orig,vex")
2140 (set_attr "prefix_rep" "1,*")
2141 (set_attr "mode" "V4SF")])
2144 [(set (match_operand:VF_128_256 0 "register_operand")
2145 (match_operator:VF_128_256 6 "addsub_vm_operator"
2147 (match_operand:VF_128_256 1 "register_operand")
2148 (match_operand:VF_128_256 2 "vector_operand"))
2150 (match_operand:VF_128_256 3 "vector_operand")
2151 (match_operand:VF_128_256 4 "vector_operand"))
2152 (match_operand 5 "const_int_operand")]))]
2154 && can_create_pseudo_p ()
2155 && ((rtx_equal_p (operands[1], operands[3])
2156 && rtx_equal_p (operands[2], operands[4]))
2157 || (rtx_equal_p (operands[1], operands[4])
2158 && rtx_equal_p (operands[2], operands[3])))"
2160 (vec_merge:VF_128_256
2161 (minus:VF_128_256 (match_dup 1) (match_dup 2))
2162 (plus:VF_128_256 (match_dup 1) (match_dup 2))
2166 [(set (match_operand:VF_128_256 0 "register_operand")
2167 (match_operator:VF_128_256 6 "addsub_vm_operator"
2169 (match_operand:VF_128_256 1 "vector_operand")
2170 (match_operand:VF_128_256 2 "vector_operand"))
2172 (match_operand:VF_128_256 3 "register_operand")
2173 (match_operand:VF_128_256 4 "vector_operand"))
2174 (match_operand 5 "const_int_operand")]))]
2176 && can_create_pseudo_p ()
2177 && ((rtx_equal_p (operands[1], operands[3])
2178 && rtx_equal_p (operands[2], operands[4]))
2179 || (rtx_equal_p (operands[1], operands[4])
2180 && rtx_equal_p (operands[2], operands[3])))"
2182 (vec_merge:VF_128_256
2183 (minus:VF_128_256 (match_dup 3) (match_dup 4))
2184 (plus:VF_128_256 (match_dup 3) (match_dup 4))
2187 /* Negate mask bits to compensate for swapped PLUS and MINUS RTXes. */
2189 = GEN_INT (~INTVAL (operands[5])
2190 & ((HOST_WIDE_INT_1U << GET_MODE_NUNITS (<MODE>mode)) - 1));
2194 [(set (match_operand:VF_128_256 0 "register_operand")
2195 (match_operator:VF_128_256 7 "addsub_vs_operator"
2196 [(vec_concat:<ssedoublemode>
2198 (match_operand:VF_128_256 1 "register_operand")
2199 (match_operand:VF_128_256 2 "vector_operand"))
2201 (match_operand:VF_128_256 3 "vector_operand")
2202 (match_operand:VF_128_256 4 "vector_operand")))
2203 (match_parallel 5 "addsub_vs_parallel"
2204 [(match_operand 6 "const_int_operand")])]))]
2206 && can_create_pseudo_p ()
2207 && ((rtx_equal_p (operands[1], operands[3])
2208 && rtx_equal_p (operands[2], operands[4]))
2209 || (rtx_equal_p (operands[1], operands[4])
2210 && rtx_equal_p (operands[2], operands[3])))"
2212 (vec_merge:VF_128_256
2213 (minus:VF_128_256 (match_dup 1) (match_dup 2))
2214 (plus:VF_128_256 (match_dup 1) (match_dup 2))
2217 int i, nelt = XVECLEN (operands[5], 0);
2218 HOST_WIDE_INT ival = 0;
2220 for (i = 0; i < nelt; i++)
2221 if (INTVAL (XVECEXP (operands[5], 0, i)) < GET_MODE_NUNITS (<MODE>mode))
2222 ival |= HOST_WIDE_INT_1 << i;
2224 operands[5] = GEN_INT (ival);
2228 [(set (match_operand:VF_128_256 0 "register_operand")
2229 (match_operator:VF_128_256 7 "addsub_vs_operator"
2230 [(vec_concat:<ssedoublemode>
2232 (match_operand:VF_128_256 1 "vector_operand")
2233 (match_operand:VF_128_256 2 "vector_operand"))
2235 (match_operand:VF_128_256 3 "register_operand")
2236 (match_operand:VF_128_256 4 "vector_operand")))
2237 (match_parallel 5 "addsub_vs_parallel"
2238 [(match_operand 6 "const_int_operand")])]))]
2240 && can_create_pseudo_p ()
2241 && ((rtx_equal_p (operands[1], operands[3])
2242 && rtx_equal_p (operands[2], operands[4]))
2243 || (rtx_equal_p (operands[1], operands[4])
2244 && rtx_equal_p (operands[2], operands[3])))"
2246 (vec_merge:VF_128_256
2247 (minus:VF_128_256 (match_dup 3) (match_dup 4))
2248 (plus:VF_128_256 (match_dup 3) (match_dup 4))
2251 int i, nelt = XVECLEN (operands[5], 0);
2252 HOST_WIDE_INT ival = 0;
2254 for (i = 0; i < nelt; i++)
2255 if (INTVAL (XVECEXP (operands[5], 0, i)) >= GET_MODE_NUNITS (<MODE>mode))
2256 ival |= HOST_WIDE_INT_1 << i;
2258 operands[5] = GEN_INT (ival);
2261 (define_insn "avx_h<plusminus_insn>v4df3"
2262 [(set (match_operand:V4DF 0 "register_operand" "=x")
2267 (match_operand:V4DF 1 "register_operand" "x")
2268 (parallel [(const_int 0)]))
2269 (vec_select:DF (match_dup 1) (parallel [(const_int 1)])))
2272 (match_operand:V4DF 2 "nonimmediate_operand" "xm")
2273 (parallel [(const_int 0)]))
2274 (vec_select:DF (match_dup 2) (parallel [(const_int 1)]))))
2277 (vec_select:DF (match_dup 1) (parallel [(const_int 2)]))
2278 (vec_select:DF (match_dup 1) (parallel [(const_int 3)])))
2280 (vec_select:DF (match_dup 2) (parallel [(const_int 2)]))
2281 (vec_select:DF (match_dup 2) (parallel [(const_int 3)]))))))]
2283 "vh<plusminus_mnemonic>pd\t{%2, %1, %0|%0, %1, %2}"
2284 [(set_attr "type" "sseadd")
2285 (set_attr "prefix" "vex")
2286 (set_attr "mode" "V4DF")])
2288 (define_expand "sse3_haddv2df3"
2289 [(set (match_operand:V2DF 0 "register_operand")
2293 (match_operand:V2DF 1 "register_operand")
2294 (parallel [(const_int 0)]))
2295 (vec_select:DF (match_dup 1) (parallel [(const_int 1)])))
2298 (match_operand:V2DF 2 "vector_operand")
2299 (parallel [(const_int 0)]))
2300 (vec_select:DF (match_dup 2) (parallel [(const_int 1)])))))]
2303 (define_insn "*sse3_haddv2df3"
2304 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
2308 (match_operand:V2DF 1 "register_operand" "0,x")
2309 (parallel [(match_operand:SI 3 "const_0_to_1_operand")]))
2312 (parallel [(match_operand:SI 4 "const_0_to_1_operand")])))
2315 (match_operand:V2DF 2 "vector_operand" "xBm,xm")
2316 (parallel [(match_operand:SI 5 "const_0_to_1_operand")]))
2319 (parallel [(match_operand:SI 6 "const_0_to_1_operand")])))))]
2321 && INTVAL (operands[3]) != INTVAL (operands[4])
2322 && INTVAL (operands[5]) != INTVAL (operands[6])"
2324 haddpd\t{%2, %0|%0, %2}
2325 vhaddpd\t{%2, %1, %0|%0, %1, %2}"
2326 [(set_attr "isa" "noavx,avx")
2327 (set_attr "type" "sseadd")
2328 (set_attr "prefix" "orig,vex")
2329 (set_attr "mode" "V2DF")])
2331 (define_insn "sse3_hsubv2df3"
2332 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
2336 (match_operand:V2DF 1 "register_operand" "0,x")
2337 (parallel [(const_int 0)]))
2338 (vec_select:DF (match_dup 1) (parallel [(const_int 1)])))
2341 (match_operand:V2DF 2 "vector_operand" "xBm,xm")
2342 (parallel [(const_int 0)]))
2343 (vec_select:DF (match_dup 2) (parallel [(const_int 1)])))))]
2346 hsubpd\t{%2, %0|%0, %2}
2347 vhsubpd\t{%2, %1, %0|%0, %1, %2}"
2348 [(set_attr "isa" "noavx,avx")
2349 (set_attr "type" "sseadd")
2350 (set_attr "prefix" "orig,vex")
2351 (set_attr "mode" "V2DF")])
2353 (define_insn "*sse3_haddv2df3_low"
2354 [(set (match_operand:DF 0 "register_operand" "=x,x")
2357 (match_operand:V2DF 1 "register_operand" "0,x")
2358 (parallel [(match_operand:SI 2 "const_0_to_1_operand")]))
2361 (parallel [(match_operand:SI 3 "const_0_to_1_operand")]))))]
2363 && INTVAL (operands[2]) != INTVAL (operands[3])"
2365 haddpd\t{%0, %0|%0, %0}
2366 vhaddpd\t{%1, %1, %0|%0, %1, %1}"
2367 [(set_attr "isa" "noavx,avx")
2368 (set_attr "type" "sseadd1")
2369 (set_attr "prefix" "orig,vex")
2370 (set_attr "mode" "V2DF")])
2372 (define_insn "*sse3_hsubv2df3_low"
2373 [(set (match_operand:DF 0 "register_operand" "=x,x")
2376 (match_operand:V2DF 1 "register_operand" "0,x")
2377 (parallel [(const_int 0)]))
2380 (parallel [(const_int 1)]))))]
2383 hsubpd\t{%0, %0|%0, %0}
2384 vhsubpd\t{%1, %1, %0|%0, %1, %1}"
2385 [(set_attr "isa" "noavx,avx")
2386 (set_attr "type" "sseadd1")
2387 (set_attr "prefix" "orig,vex")
2388 (set_attr "mode" "V2DF")])
2390 (define_insn "avx_h<plusminus_insn>v8sf3"
2391 [(set (match_operand:V8SF 0 "register_operand" "=x")
2397 (match_operand:V8SF 1 "register_operand" "x")
2398 (parallel [(const_int 0)]))
2399 (vec_select:SF (match_dup 1) (parallel [(const_int 1)])))
2401 (vec_select:SF (match_dup 1) (parallel [(const_int 2)]))
2402 (vec_select:SF (match_dup 1) (parallel [(const_int 3)]))))
2406 (match_operand:V8SF 2 "nonimmediate_operand" "xm")
2407 (parallel [(const_int 0)]))
2408 (vec_select:SF (match_dup 2) (parallel [(const_int 1)])))
2410 (vec_select:SF (match_dup 2) (parallel [(const_int 2)]))
2411 (vec_select:SF (match_dup 2) (parallel [(const_int 3)])))))
2415 (vec_select:SF (match_dup 1) (parallel [(const_int 4)]))
2416 (vec_select:SF (match_dup 1) (parallel [(const_int 5)])))
2418 (vec_select:SF (match_dup 1) (parallel [(const_int 6)]))
2419 (vec_select:SF (match_dup 1) (parallel [(const_int 7)]))))
2422 (vec_select:SF (match_dup 2) (parallel [(const_int 4)]))
2423 (vec_select:SF (match_dup 2) (parallel [(const_int 5)])))
2425 (vec_select:SF (match_dup 2) (parallel [(const_int 6)]))
2426 (vec_select:SF (match_dup 2) (parallel [(const_int 7)])))))))]
2428 "vh<plusminus_mnemonic>ps\t{%2, %1, %0|%0, %1, %2}"
2429 [(set_attr "type" "sseadd")
2430 (set_attr "prefix" "vex")
2431 (set_attr "mode" "V8SF")])
2433 (define_insn "sse3_h<plusminus_insn>v4sf3"
2434 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
2439 (match_operand:V4SF 1 "register_operand" "0,x")
2440 (parallel [(const_int 0)]))
2441 (vec_select:SF (match_dup 1) (parallel [(const_int 1)])))
2443 (vec_select:SF (match_dup 1) (parallel [(const_int 2)]))
2444 (vec_select:SF (match_dup 1) (parallel [(const_int 3)]))))
2448 (match_operand:V4SF 2 "vector_operand" "xBm,xm")
2449 (parallel [(const_int 0)]))
2450 (vec_select:SF (match_dup 2) (parallel [(const_int 1)])))
2452 (vec_select:SF (match_dup 2) (parallel [(const_int 2)]))
2453 (vec_select:SF (match_dup 2) (parallel [(const_int 3)]))))))]
2456 h<plusminus_mnemonic>ps\t{%2, %0|%0, %2}
2457 vh<plusminus_mnemonic>ps\t{%2, %1, %0|%0, %1, %2}"
2458 [(set_attr "isa" "noavx,avx")
2459 (set_attr "type" "sseadd")
2460 (set_attr "atom_unit" "complex")
2461 (set_attr "prefix" "orig,vex")
2462 (set_attr "prefix_rep" "1,*")
2463 (set_attr "mode" "V4SF")])
2465 (define_expand "reduc_plus_scal_v8df"
2466 [(match_operand:DF 0 "register_operand")
2467 (match_operand:V8DF 1 "register_operand")]
2470 rtx tmp = gen_reg_rtx (V8DFmode);
2471 ix86_expand_reduc (gen_addv8df3, tmp, operands[1]);
2472 emit_insn (gen_vec_extractv8dfdf (operands[0], tmp, const0_rtx));
2476 (define_expand "reduc_plus_scal_v4df"
2477 [(match_operand:DF 0 "register_operand")
2478 (match_operand:V4DF 1 "register_operand")]
2481 rtx tmp = gen_reg_rtx (V4DFmode);
2482 rtx tmp2 = gen_reg_rtx (V4DFmode);
2483 rtx vec_res = gen_reg_rtx (V4DFmode);
2484 emit_insn (gen_avx_haddv4df3 (tmp, operands[1], operands[1]));
2485 emit_insn (gen_avx_vperm2f128v4df3 (tmp2, tmp, tmp, GEN_INT (1)));
2486 emit_insn (gen_addv4df3 (vec_res, tmp, tmp2));
2487 emit_insn (gen_vec_extractv4dfdf (operands[0], vec_res, const0_rtx));
2491 (define_expand "reduc_plus_scal_v2df"
2492 [(match_operand:DF 0 "register_operand")
2493 (match_operand:V2DF 1 "register_operand")]
2496 rtx tmp = gen_reg_rtx (V2DFmode);
2497 emit_insn (gen_sse3_haddv2df3 (tmp, operands[1], operands[1]));
2498 emit_insn (gen_vec_extractv2dfdf (operands[0], tmp, const0_rtx));
2502 (define_expand "reduc_plus_scal_v16sf"
2503 [(match_operand:SF 0 "register_operand")
2504 (match_operand:V16SF 1 "register_operand")]
2507 rtx tmp = gen_reg_rtx (V16SFmode);
2508 ix86_expand_reduc (gen_addv16sf3, tmp, operands[1]);
2509 emit_insn (gen_vec_extractv16sfsf (operands[0], tmp, const0_rtx));
2513 (define_expand "reduc_plus_scal_v8sf"
2514 [(match_operand:SF 0 "register_operand")
2515 (match_operand:V8SF 1 "register_operand")]
2518 rtx tmp = gen_reg_rtx (V8SFmode);
2519 rtx tmp2 = gen_reg_rtx (V8SFmode);
2520 rtx vec_res = gen_reg_rtx (V8SFmode);
2521 emit_insn (gen_avx_haddv8sf3 (tmp, operands[1], operands[1]));
2522 emit_insn (gen_avx_haddv8sf3 (tmp2, tmp, tmp));
2523 emit_insn (gen_avx_vperm2f128v8sf3 (tmp, tmp2, tmp2, GEN_INT (1)));
2524 emit_insn (gen_addv8sf3 (vec_res, tmp, tmp2));
2525 emit_insn (gen_vec_extractv8sfsf (operands[0], vec_res, const0_rtx));
2529 (define_expand "reduc_plus_scal_v4sf"
2530 [(match_operand:SF 0 "register_operand")
2531 (match_operand:V4SF 1 "register_operand")]
2534 rtx vec_res = gen_reg_rtx (V4SFmode);
2537 rtx tmp = gen_reg_rtx (V4SFmode);
2538 emit_insn (gen_sse3_haddv4sf3 (tmp, operands[1], operands[1]));
2539 emit_insn (gen_sse3_haddv4sf3 (vec_res, tmp, tmp));
2542 ix86_expand_reduc (gen_addv4sf3, vec_res, operands[1]);
2543 emit_insn (gen_vec_extractv4sfsf (operands[0], vec_res, const0_rtx));
2547 ;; Modes handled by reduc_sm{in,ax}* patterns.
2548 (define_mode_iterator REDUC_SMINMAX_MODE
2549 [(V32QI "TARGET_AVX2") (V16HI "TARGET_AVX2")
2550 (V8SI "TARGET_AVX2") (V4DI "TARGET_AVX2")
2551 (V8SF "TARGET_AVX") (V4DF "TARGET_AVX")
2552 (V4SF "TARGET_SSE") (V64QI "TARGET_AVX512BW")
2553 (V32HI "TARGET_AVX512BW") (V16SI "TARGET_AVX512F")
2554 (V8DI "TARGET_AVX512F") (V16SF "TARGET_AVX512F")
2555 (V8DF "TARGET_AVX512F")])
2557 (define_expand "reduc_<code>_scal_<mode>"
2558 [(smaxmin:REDUC_SMINMAX_MODE
2559 (match_operand:<ssescalarmode> 0 "register_operand")
2560 (match_operand:REDUC_SMINMAX_MODE 1 "register_operand"))]
2563 rtx tmp = gen_reg_rtx (<MODE>mode);
2564 ix86_expand_reduc (gen_<code><mode>3, tmp, operands[1]);
2565 emit_insn (gen_vec_extract<mode><ssescalarmodelower> (operands[0], tmp,
2570 (define_expand "reduc_<code>_scal_<mode>"
2571 [(umaxmin:VI_AVX512BW
2572 (match_operand:<ssescalarmode> 0 "register_operand")
2573 (match_operand:VI_AVX512BW 1 "register_operand"))]
2576 rtx tmp = gen_reg_rtx (<MODE>mode);
2577 ix86_expand_reduc (gen_<code><mode>3, tmp, operands[1]);
2578 emit_insn (gen_vec_extract<mode><ssescalarmodelower> (operands[0], tmp,
2583 (define_expand "reduc_<code>_scal_<mode>"
2585 (match_operand:<ssescalarmode> 0 "register_operand")
2586 (match_operand:VI_256 1 "register_operand"))]
2589 rtx tmp = gen_reg_rtx (<MODE>mode);
2590 ix86_expand_reduc (gen_<code><mode>3, tmp, operands[1]);
2591 emit_insn (gen_vec_extract<mode><ssescalarmodelower> (operands[0], tmp,
2596 (define_expand "reduc_umin_scal_v8hi"
2598 (match_operand:HI 0 "register_operand")
2599 (match_operand:V8HI 1 "register_operand"))]
2602 rtx tmp = gen_reg_rtx (V8HImode);
2603 ix86_expand_reduc (gen_uminv8hi3, tmp, operands[1]);
2604 emit_insn (gen_vec_extractv8hihi (operands[0], tmp, const0_rtx));
2608 (define_insn "<mask_codefor>reducep<mode><mask_name>"
2609 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
2611 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "vm")
2612 (match_operand:SI 2 "const_0_to_255_operand")]
2615 "vreduce<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
2616 [(set_attr "type" "sse")
2617 (set_attr "prefix" "evex")
2618 (set_attr "mode" "<MODE>")])
2620 (define_insn "reduces<mode><mask_scalar_name>"
2621 [(set (match_operand:VF_128 0 "register_operand" "=v")
2624 [(match_operand:VF_128 1 "register_operand" "v")
2625 (match_operand:VF_128 2 "nonimmediate_operand" "vm")
2626 (match_operand:SI 3 "const_0_to_255_operand")]
2631 "vreduce<ssescalarmodesuffix>\t{%3, %2, %1, %0<mask_scalar_operand4>|%0<mask_scalar_operand4>, %1, %<iptr>2, %3}"
2632 [(set_attr "type" "sse")
2633 (set_attr "prefix" "evex")
2634 (set_attr "mode" "<MODE>")])
2636 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2638 ;; Parallel floating point comparisons
2640 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2642 (define_insn "avx_cmp<mode>3"
2643 [(set (match_operand:VF_128_256 0 "register_operand" "=x")
2645 [(match_operand:VF_128_256 1 "register_operand" "x")
2646 (match_operand:VF_128_256 2 "nonimmediate_operand" "xm")
2647 (match_operand:SI 3 "const_0_to_31_operand" "n")]
2650 "vcmp<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
2651 [(set_attr "type" "ssecmp")
2652 (set_attr "length_immediate" "1")
2653 (set_attr "prefix" "vex")
2654 (set_attr "mode" "<MODE>")])
2656 (define_insn "avx_vmcmp<mode>3"
2657 [(set (match_operand:VF_128 0 "register_operand" "=x")
2660 [(match_operand:VF_128 1 "register_operand" "x")
2661 (match_operand:VF_128 2 "nonimmediate_operand" "xm")
2662 (match_operand:SI 3 "const_0_to_31_operand" "n")]
2667 "vcmp<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %3}"
2668 [(set_attr "type" "ssecmp")
2669 (set_attr "length_immediate" "1")
2670 (set_attr "prefix" "vex")
2671 (set_attr "mode" "<ssescalarmode>")])
2673 (define_insn "*<sse>_maskcmp<mode>3_comm"
2674 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x")
2675 (match_operator:VF_128_256 3 "sse_comparison_operator"
2676 [(match_operand:VF_128_256 1 "register_operand" "%0,x")
2677 (match_operand:VF_128_256 2 "vector_operand" "xBm,xm")]))]
2679 && GET_RTX_CLASS (GET_CODE (operands[3])) == RTX_COMM_COMPARE"
2681 cmp%D3<ssemodesuffix>\t{%2, %0|%0, %2}
2682 vcmp%D3<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
2683 [(set_attr "isa" "noavx,avx")
2684 (set_attr "type" "ssecmp")
2685 (set_attr "length_immediate" "1")
2686 (set_attr "prefix" "orig,vex")
2687 (set_attr "mode" "<MODE>")])
2689 (define_insn "<sse>_maskcmp<mode>3"
2690 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x")
2691 (match_operator:VF_128_256 3 "sse_comparison_operator"
2692 [(match_operand:VF_128_256 1 "register_operand" "0,x")
2693 (match_operand:VF_128_256 2 "vector_operand" "xBm,xm")]))]
2696 cmp%D3<ssemodesuffix>\t{%2, %0|%0, %2}
2697 vcmp%D3<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
2698 [(set_attr "isa" "noavx,avx")
2699 (set_attr "type" "ssecmp")
2700 (set_attr "length_immediate" "1")
2701 (set_attr "prefix" "orig,vex")
2702 (set_attr "mode" "<MODE>")])
2704 (define_insn "<sse>_vmmaskcmp<mode>3"
2705 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
2707 (match_operator:VF_128 3 "sse_comparison_operator"
2708 [(match_operand:VF_128 1 "register_operand" "0,x")
2709 (match_operand:VF_128 2 "vector_operand" "xBm,xm")])
2714 cmp%D3<ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
2715 vcmp%D3<ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %<iptr>2}"
2716 [(set_attr "isa" "noavx,avx")
2717 (set_attr "type" "ssecmp")
2718 (set_attr "length_immediate" "1,*")
2719 (set_attr "prefix" "orig,vex")
2720 (set_attr "mode" "<ssescalarmode>")])
2722 (define_mode_attr cmp_imm_predicate
2723 [(V16SF "const_0_to_31_operand") (V8DF "const_0_to_31_operand")
2724 (V16SI "const_0_to_7_operand") (V8DI "const_0_to_7_operand")
2725 (V8SF "const_0_to_31_operand") (V4DF "const_0_to_31_operand")
2726 (V8SI "const_0_to_7_operand") (V4DI "const_0_to_7_operand")
2727 (V4SF "const_0_to_31_operand") (V2DF "const_0_to_31_operand")
2728 (V4SI "const_0_to_7_operand") (V2DI "const_0_to_7_operand")
2729 (V32HI "const_0_to_7_operand") (V64QI "const_0_to_7_operand")
2730 (V16HI "const_0_to_7_operand") (V32QI "const_0_to_7_operand")
2731 (V8HI "const_0_to_7_operand") (V16QI "const_0_to_7_operand")])
2733 (define_insn "<avx512>_cmp<mode>3<mask_scalar_merge_name><round_saeonly_name>"
2734 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2735 (unspec:<avx512fmaskmode>
2736 [(match_operand:V48_AVX512VL 1 "register_operand" "v")
2737 (match_operand:V48_AVX512VL 2 "nonimmediate_operand" "<round_saeonly_constraint>")
2738 (match_operand:SI 3 "<cmp_imm_predicate>" "n")]
2740 "TARGET_AVX512F && <round_saeonly_mode512bit_condition>"
2741 "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}"
2742 [(set_attr "type" "ssecmp")
2743 (set_attr "length_immediate" "1")
2744 (set_attr "prefix" "evex")
2745 (set_attr "mode" "<sseinsnmode>")])
2747 (define_insn "<avx512>_cmp<mode>3<mask_scalar_merge_name>"
2748 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2749 (unspec:<avx512fmaskmode>
2750 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
2751 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")
2752 (match_operand:SI 3 "<cmp_imm_predicate>" "n")]
2755 "vpcmp<ssemodesuffix>\t{%3, %2, %1, %0<mask_scalar_merge_operand4>|%0<mask_scalar_merge_operand4>, %1, %2, %3}"
2756 [(set_attr "type" "ssecmp")
2757 (set_attr "length_immediate" "1")
2758 (set_attr "prefix" "evex")
2759 (set_attr "mode" "<sseinsnmode>")])
2761 (define_insn "<avx512>_ucmp<mode>3<mask_scalar_merge_name>"
2762 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2763 (unspec:<avx512fmaskmode>
2764 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
2765 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")
2766 (match_operand:SI 3 "const_0_to_7_operand" "n")]
2767 UNSPEC_UNSIGNED_PCMP))]
2769 "vpcmpu<ssemodesuffix>\t{%3, %2, %1, %0<mask_scalar_merge_operand4>|%0<mask_scalar_merge_operand4>, %1, %2, %3}"
2770 [(set_attr "type" "ssecmp")
2771 (set_attr "length_immediate" "1")
2772 (set_attr "prefix" "evex")
2773 (set_attr "mode" "<sseinsnmode>")])
2775 (define_insn "<avx512>_ucmp<mode>3<mask_scalar_merge_name>"
2776 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2777 (unspec:<avx512fmaskmode>
2778 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
2779 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")
2780 (match_operand:SI 3 "const_0_to_7_operand" "n")]
2781 UNSPEC_UNSIGNED_PCMP))]
2783 "vpcmpu<ssemodesuffix>\t{%3, %2, %1, %0<mask_scalar_merge_operand4>|%0<mask_scalar_merge_operand4>, %1, %2, %3}"
2784 [(set_attr "type" "ssecmp")
2785 (set_attr "length_immediate" "1")
2786 (set_attr "prefix" "evex")
2787 (set_attr "mode" "<sseinsnmode>")])
2789 (define_insn "avx512f_vmcmp<mode>3<round_saeonly_name>"
2790 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2791 (and:<avx512fmaskmode>
2792 (unspec:<avx512fmaskmode>
2793 [(match_operand:VF_128 1 "register_operand" "v")
2794 (match_operand:VF_128 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
2795 (match_operand:SI 3 "const_0_to_31_operand" "n")]
2799 "vcmp<ssescalarmodesuffix>\t{%3, <round_saeonly_op4>%2, %1, %0|%0, %1, %<iptr>2<round_saeonly_op4>, %3}"
2800 [(set_attr "type" "ssecmp")
2801 (set_attr "length_immediate" "1")
2802 (set_attr "prefix" "evex")
2803 (set_attr "mode" "<ssescalarmode>")])
2805 (define_insn "avx512f_vmcmp<mode>3_mask<round_saeonly_name>"
2806 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2807 (and:<avx512fmaskmode>
2808 (unspec:<avx512fmaskmode>
2809 [(match_operand:VF_128 1 "register_operand" "v")
2810 (match_operand:VF_128 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
2811 (match_operand:SI 3 "const_0_to_31_operand" "n")]
2813 (and:<avx512fmaskmode>
2814 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")
2817 "vcmp<ssescalarmodesuffix>\t{%3, <round_saeonly_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %<iptr>2<round_saeonly_op5>, %3}"
2818 [(set_attr "type" "ssecmp")
2819 (set_attr "length_immediate" "1")
2820 (set_attr "prefix" "evex")
2821 (set_attr "mode" "<ssescalarmode>")])
2823 (define_insn "avx512f_maskcmp<mode>3"
2824 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2825 (match_operator:<avx512fmaskmode> 3 "sse_comparison_operator"
2826 [(match_operand:VF 1 "register_operand" "v")
2827 (match_operand:VF 2 "nonimmediate_operand" "vm")]))]
2829 "vcmp%D3<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
2830 [(set_attr "type" "ssecmp")
2831 (set_attr "length_immediate" "1")
2832 (set_attr "prefix" "evex")
2833 (set_attr "mode" "<sseinsnmode>")])
2835 (define_insn "<sse>_<unord>comi<round_saeonly_name>"
2836 [(set (reg:CCFP FLAGS_REG)
2839 (match_operand:<ssevecmode> 0 "register_operand" "v")
2840 (parallel [(const_int 0)]))
2842 (match_operand:<ssevecmode> 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
2843 (parallel [(const_int 0)]))))]
2844 "SSE_FLOAT_MODE_P (<MODE>mode)"
2845 "%v<unord>comi<ssemodesuffix>\t{<round_saeonly_op2>%1, %0|%0, %<iptr>1<round_saeonly_op2>}"
2846 [(set_attr "type" "ssecomi")
2847 (set_attr "prefix" "maybe_vex")
2848 (set_attr "prefix_rep" "0")
2849 (set (attr "prefix_data16")
2850 (if_then_else (eq_attr "mode" "DF")
2852 (const_string "0")))
2853 (set_attr "mode" "<MODE>")])
2855 (define_expand "vec_cmp<mode><avx512fmaskmodelower>"
2856 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
2857 (match_operator:<avx512fmaskmode> 1 ""
2858 [(match_operand:V48_AVX512VL 2 "register_operand")
2859 (match_operand:V48_AVX512VL 3 "nonimmediate_operand")]))]
2862 bool ok = ix86_expand_mask_vec_cmp (operands);
2867 (define_expand "vec_cmp<mode><avx512fmaskmodelower>"
2868 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
2869 (match_operator:<avx512fmaskmode> 1 ""
2870 [(match_operand:VI12_AVX512VL 2 "register_operand")
2871 (match_operand:VI12_AVX512VL 3 "nonimmediate_operand")]))]
2874 bool ok = ix86_expand_mask_vec_cmp (operands);
2879 (define_expand "vec_cmp<mode><sseintvecmodelower>"
2880 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2881 (match_operator:<sseintvecmode> 1 ""
2882 [(match_operand:VI_256 2 "register_operand")
2883 (match_operand:VI_256 3 "nonimmediate_operand")]))]
2886 bool ok = ix86_expand_int_vec_cmp (operands);
2891 (define_expand "vec_cmp<mode><sseintvecmodelower>"
2892 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2893 (match_operator:<sseintvecmode> 1 ""
2894 [(match_operand:VI124_128 2 "register_operand")
2895 (match_operand:VI124_128 3 "vector_operand")]))]
2898 bool ok = ix86_expand_int_vec_cmp (operands);
2903 (define_expand "vec_cmpv2div2di"
2904 [(set (match_operand:V2DI 0 "register_operand")
2905 (match_operator:V2DI 1 ""
2906 [(match_operand:V2DI 2 "register_operand")
2907 (match_operand:V2DI 3 "vector_operand")]))]
2910 bool ok = ix86_expand_int_vec_cmp (operands);
2915 (define_expand "vec_cmp<mode><sseintvecmodelower>"
2916 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2917 (match_operator:<sseintvecmode> 1 ""
2918 [(match_operand:VF_256 2 "register_operand")
2919 (match_operand:VF_256 3 "nonimmediate_operand")]))]
2922 bool ok = ix86_expand_fp_vec_cmp (operands);
2927 (define_expand "vec_cmp<mode><sseintvecmodelower>"
2928 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2929 (match_operator:<sseintvecmode> 1 ""
2930 [(match_operand:VF_128 2 "register_operand")
2931 (match_operand:VF_128 3 "vector_operand")]))]
2934 bool ok = ix86_expand_fp_vec_cmp (operands);
2939 (define_expand "vec_cmpu<mode><avx512fmaskmodelower>"
2940 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
2941 (match_operator:<avx512fmaskmode> 1 ""
2942 [(match_operand:VI48_AVX512VL 2 "register_operand")
2943 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand")]))]
2946 bool ok = ix86_expand_mask_vec_cmp (operands);
2951 (define_expand "vec_cmpu<mode><avx512fmaskmodelower>"
2952 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
2953 (match_operator:<avx512fmaskmode> 1 ""
2954 [(match_operand:VI12_AVX512VL 2 "register_operand")
2955 (match_operand:VI12_AVX512VL 3 "nonimmediate_operand")]))]
2958 bool ok = ix86_expand_mask_vec_cmp (operands);
2963 (define_expand "vec_cmpu<mode><sseintvecmodelower>"
2964 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2965 (match_operator:<sseintvecmode> 1 ""
2966 [(match_operand:VI_256 2 "register_operand")
2967 (match_operand:VI_256 3 "nonimmediate_operand")]))]
2970 bool ok = ix86_expand_int_vec_cmp (operands);
2975 (define_expand "vec_cmpu<mode><sseintvecmodelower>"
2976 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2977 (match_operator:<sseintvecmode> 1 ""
2978 [(match_operand:VI124_128 2 "register_operand")
2979 (match_operand:VI124_128 3 "vector_operand")]))]
2982 bool ok = ix86_expand_int_vec_cmp (operands);
2987 (define_expand "vec_cmpuv2div2di"
2988 [(set (match_operand:V2DI 0 "register_operand")
2989 (match_operator:V2DI 1 ""
2990 [(match_operand:V2DI 2 "register_operand")
2991 (match_operand:V2DI 3 "vector_operand")]))]
2994 bool ok = ix86_expand_int_vec_cmp (operands);
2999 (define_expand "vec_cmpeqv2div2di"
3000 [(set (match_operand:V2DI 0 "register_operand")
3001 (match_operator:V2DI 1 ""
3002 [(match_operand:V2DI 2 "register_operand")
3003 (match_operand:V2DI 3 "vector_operand")]))]
3006 bool ok = ix86_expand_int_vec_cmp (operands);
3011 (define_expand "vcond<V_512:mode><VF_512:mode>"
3012 [(set (match_operand:V_512 0 "register_operand")
3014 (match_operator 3 ""
3015 [(match_operand:VF_512 4 "nonimmediate_operand")
3016 (match_operand:VF_512 5 "nonimmediate_operand")])
3017 (match_operand:V_512 1 "general_operand")
3018 (match_operand:V_512 2 "general_operand")))]
3020 && (GET_MODE_NUNITS (<V_512:MODE>mode)
3021 == GET_MODE_NUNITS (<VF_512:MODE>mode))"
3023 bool ok = ix86_expand_fp_vcond (operands);
3028 (define_expand "vcond<V_256:mode><VF_256:mode>"
3029 [(set (match_operand:V_256 0 "register_operand")
3031 (match_operator 3 ""
3032 [(match_operand:VF_256 4 "nonimmediate_operand")
3033 (match_operand:VF_256 5 "nonimmediate_operand")])
3034 (match_operand:V_256 1 "general_operand")
3035 (match_operand:V_256 2 "general_operand")))]
3037 && (GET_MODE_NUNITS (<V_256:MODE>mode)
3038 == GET_MODE_NUNITS (<VF_256:MODE>mode))"
3040 bool ok = ix86_expand_fp_vcond (operands);
3045 (define_expand "vcond<V_128:mode><VF_128:mode>"
3046 [(set (match_operand:V_128 0 "register_operand")
3048 (match_operator 3 ""
3049 [(match_operand:VF_128 4 "vector_operand")
3050 (match_operand:VF_128 5 "vector_operand")])
3051 (match_operand:V_128 1 "general_operand")
3052 (match_operand:V_128 2 "general_operand")))]
3054 && (GET_MODE_NUNITS (<V_128:MODE>mode)
3055 == GET_MODE_NUNITS (<VF_128:MODE>mode))"
3057 bool ok = ix86_expand_fp_vcond (operands);
3062 (define_expand "vcond_mask_<mode><avx512fmaskmodelower>"
3063 [(set (match_operand:V48_AVX512VL 0 "register_operand")
3064 (vec_merge:V48_AVX512VL
3065 (match_operand:V48_AVX512VL 1 "nonimmediate_operand")
3066 (match_operand:V48_AVX512VL 2 "vector_move_operand")
3067 (match_operand:<avx512fmaskmode> 3 "register_operand")))]
3070 (define_expand "vcond_mask_<mode><avx512fmaskmodelower>"
3071 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
3072 (vec_merge:VI12_AVX512VL
3073 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand")
3074 (match_operand:VI12_AVX512VL 2 "vector_move_operand")
3075 (match_operand:<avx512fmaskmode> 3 "register_operand")))]
3078 (define_expand "vcond_mask_<mode><sseintvecmodelower>"
3079 [(set (match_operand:VI_256 0 "register_operand")
3081 (match_operand:VI_256 1 "nonimmediate_operand")
3082 (match_operand:VI_256 2 "vector_move_operand")
3083 (match_operand:<sseintvecmode> 3 "register_operand")))]
3086 ix86_expand_sse_movcc (operands[0], operands[3],
3087 operands[1], operands[2]);
3091 (define_expand "vcond_mask_<mode><sseintvecmodelower>"
3092 [(set (match_operand:VI124_128 0 "register_operand")
3093 (vec_merge:VI124_128
3094 (match_operand:VI124_128 1 "vector_operand")
3095 (match_operand:VI124_128 2 "vector_move_operand")
3096 (match_operand:<sseintvecmode> 3 "register_operand")))]
3099 ix86_expand_sse_movcc (operands[0], operands[3],
3100 operands[1], operands[2]);
3104 (define_expand "vcond_mask_v2div2di"
3105 [(set (match_operand:V2DI 0 "register_operand")
3107 (match_operand:V2DI 1 "vector_operand")
3108 (match_operand:V2DI 2 "vector_move_operand")
3109 (match_operand:V2DI 3 "register_operand")))]
3112 ix86_expand_sse_movcc (operands[0], operands[3],
3113 operands[1], operands[2]);
3117 (define_expand "vcond_mask_<mode><sseintvecmodelower>"
3118 [(set (match_operand:VF_256 0 "register_operand")
3120 (match_operand:VF_256 1 "nonimmediate_operand")
3121 (match_operand:VF_256 2 "vector_move_operand")
3122 (match_operand:<sseintvecmode> 3 "register_operand")))]
3125 ix86_expand_sse_movcc (operands[0], operands[3],
3126 operands[1], operands[2]);
3130 (define_expand "vcond_mask_<mode><sseintvecmodelower>"
3131 [(set (match_operand:VF_128 0 "register_operand")
3133 (match_operand:VF_128 1 "vector_operand")
3134 (match_operand:VF_128 2 "vector_move_operand")
3135 (match_operand:<sseintvecmode> 3 "register_operand")))]
3138 ix86_expand_sse_movcc (operands[0], operands[3],
3139 operands[1], operands[2]);
3143 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3145 ;; Parallel floating point logical operations
3147 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3149 (define_insn "<sse>_andnot<mode>3<mask_name>"
3150 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x,v,v")
3153 (match_operand:VF_128_256 1 "register_operand" "0,x,v,v"))
3154 (match_operand:VF_128_256 2 "vector_operand" "xBm,xm,vm,vm")))]
3155 "TARGET_SSE && <mask_avx512vl_condition>"
3157 static char buf[128];
3161 switch (which_alternative)
3164 ops = "andn%s\t{%%2, %%0|%%0, %%2}";
3169 ops = "vandn%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
3175 switch (get_attr_mode (insn))
3183 /* There is no vandnp[sd] in avx512f. Use vpandn[qd]. */
3184 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
3185 ops = "vpandn%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
3188 suffix = "<ssemodesuffix>";
3191 snprintf (buf, sizeof (buf), ops, suffix);
3194 [(set_attr "isa" "noavx,avx,avx512dq,avx512f")
3195 (set_attr "type" "sselog")
3196 (set_attr "prefix" "orig,maybe_vex,evex,evex")
3198 (cond [(and (match_test "<mask_applied>")
3199 (and (eq_attr "alternative" "1")
3200 (match_test "!TARGET_AVX512DQ")))
3201 (const_string "<sseintvecmode2>")
3202 (eq_attr "alternative" "3")
3203 (const_string "<sseintvecmode2>")
3204 (and (match_test "<MODE_SIZE> == 16")
3205 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
3206 (const_string "<ssePSmode>")
3207 (match_test "TARGET_AVX")
3208 (const_string "<MODE>")
3209 (match_test "optimize_function_for_size_p (cfun)")
3210 (const_string "V4SF")
3212 (const_string "<MODE>")))])
3215 (define_insn "<sse>_andnot<mode>3<mask_name>"
3216 [(set (match_operand:VF_512 0 "register_operand" "=v")
3219 (match_operand:VF_512 1 "register_operand" "v"))
3220 (match_operand:VF_512 2 "nonimmediate_operand" "vm")))]
3223 static char buf[128];
3227 suffix = "<ssemodesuffix>";
3230 /* There is no vandnp[sd] in avx512f. Use vpandn[qd]. */
3231 if (!TARGET_AVX512DQ)
3233 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
3237 snprintf (buf, sizeof (buf),
3238 "v%sandn%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}",
3242 [(set_attr "type" "sselog")
3243 (set_attr "prefix" "evex")
3245 (if_then_else (match_test "TARGET_AVX512DQ")
3246 (const_string "<sseinsnmode>")
3247 (const_string "XI")))])
3249 (define_expand "<code><mode>3<mask_name>"
3250 [(set (match_operand:VF_128_256 0 "register_operand")
3251 (any_logic:VF_128_256
3252 (match_operand:VF_128_256 1 "vector_operand")
3253 (match_operand:VF_128_256 2 "vector_operand")))]
3254 "TARGET_SSE && <mask_avx512vl_condition>"
3255 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
3257 (define_expand "<code><mode>3<mask_name>"
3258 [(set (match_operand:VF_512 0 "register_operand")
3260 (match_operand:VF_512 1 "nonimmediate_operand")
3261 (match_operand:VF_512 2 "nonimmediate_operand")))]
3263 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
3265 (define_insn "*<code><mode>3<mask_name>"
3266 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x,v,v")
3267 (any_logic:VF_128_256
3268 (match_operand:VF_128_256 1 "vector_operand" "%0,x,v,v")
3269 (match_operand:VF_128_256 2 "vector_operand" "xBm,xm,vm,vm")))]
3270 "TARGET_SSE && <mask_avx512vl_condition>
3271 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
3273 static char buf[128];
3277 switch (which_alternative)
3280 ops = "<logic>%s\t{%%2, %%0|%%0, %%2}";
3285 ops = "v<logic>%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
3291 switch (get_attr_mode (insn))
3299 /* There is no v<logic>p[sd] in avx512f. Use vp<logic>[qd]. */
3300 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
3301 ops = "vp<logic>%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
3304 suffix = "<ssemodesuffix>";
3307 snprintf (buf, sizeof (buf), ops, suffix);
3310 [(set_attr "isa" "noavx,avx,avx512dq,avx512f")
3311 (set_attr "type" "sselog")
3312 (set_attr "prefix" "orig,maybe_evex,evex,evex")
3314 (cond [(and (match_test "<mask_applied>")
3315 (and (eq_attr "alternative" "1")
3316 (match_test "!TARGET_AVX512DQ")))
3317 (const_string "<sseintvecmode2>")
3318 (eq_attr "alternative" "3")
3319 (const_string "<sseintvecmode2>")
3320 (and (match_test "<MODE_SIZE> == 16")
3321 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
3322 (const_string "<ssePSmode>")
3323 (match_test "TARGET_AVX")
3324 (const_string "<MODE>")
3325 (match_test "optimize_function_for_size_p (cfun)")
3326 (const_string "V4SF")
3328 (const_string "<MODE>")))])
3330 (define_insn "*<code><mode>3<mask_name>"
3331 [(set (match_operand:VF_512 0 "register_operand" "=v")
3333 (match_operand:VF_512 1 "nonimmediate_operand" "%v")
3334 (match_operand:VF_512 2 "nonimmediate_operand" "vm")))]
3335 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
3337 static char buf[128];
3341 suffix = "<ssemodesuffix>";
3344 /* There is no v<logic>p[sd] in avx512f. Use vp<logic>[dq]. */
3345 if (!TARGET_AVX512DQ)
3347 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
3351 snprintf (buf, sizeof (buf),
3352 "v%s<logic>%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}",
3356 [(set_attr "type" "sselog")
3357 (set_attr "prefix" "evex")
3359 (if_then_else (match_test "TARGET_AVX512DQ")
3360 (const_string "<sseinsnmode>")
3361 (const_string "XI")))])
3363 (define_expand "copysign<mode>3"
3366 (not:VF (match_dup 3))
3367 (match_operand:VF 1 "vector_operand")))
3369 (and:VF (match_dup 3)
3370 (match_operand:VF 2 "vector_operand")))
3371 (set (match_operand:VF 0 "register_operand")
3372 (ior:VF (match_dup 4) (match_dup 5)))]
3375 operands[3] = ix86_build_signbit_mask (<MODE>mode, 1, 0);
3377 operands[4] = gen_reg_rtx (<MODE>mode);
3378 operands[5] = gen_reg_rtx (<MODE>mode);
3381 ;; Also define scalar versions. These are used for abs, neg, and
3382 ;; conditional move. Using subregs into vector modes causes register
3383 ;; allocation lossage. These patterns do not allow memory operands
3384 ;; because the native instructions read the full 128-bits.
3386 (define_insn "*andnot<mode>3"
3387 [(set (match_operand:MODEF 0 "register_operand" "=x,x,v,v")
3390 (match_operand:MODEF 1 "register_operand" "0,x,v,v"))
3391 (match_operand:MODEF 2 "register_operand" "x,x,v,v")))]
3392 "SSE_FLOAT_MODE_P (<MODE>mode)"
3394 static char buf[128];
3397 = (get_attr_mode (insn) == MODE_V4SF) ? "ps" : "<ssevecmodesuffix>";
3399 switch (which_alternative)
3402 ops = "andn%s\t{%%2, %%0|%%0, %%2}";
3405 ops = "vandn%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3408 if (TARGET_AVX512DQ)
3409 ops = "vandn%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3412 suffix = <MODE>mode == DFmode ? "q" : "d";
3413 ops = "vpandn%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3417 if (TARGET_AVX512DQ)
3418 ops = "vandn%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3421 suffix = <MODE>mode == DFmode ? "q" : "d";
3422 ops = "vpandn%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3429 snprintf (buf, sizeof (buf), ops, suffix);
3432 [(set_attr "isa" "noavx,avx,avx512vl,avx512f")
3433 (set_attr "type" "sselog")
3434 (set_attr "prefix" "orig,vex,evex,evex")
3436 (cond [(eq_attr "alternative" "2")
3437 (if_then_else (match_test "TARGET_AVX512DQ")
3438 (const_string "<ssevecmode>")
3439 (const_string "TI"))
3440 (eq_attr "alternative" "3")
3441 (if_then_else (match_test "TARGET_AVX512DQ")
3442 (const_string "<avx512fvecmode>")
3443 (const_string "XI"))
3444 (and (match_test "<MODE_SIZE> == 16")
3445 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
3446 (const_string "V4SF")
3447 (match_test "TARGET_AVX")
3448 (const_string "<ssevecmode>")
3449 (match_test "optimize_function_for_size_p (cfun)")
3450 (const_string "V4SF")
3452 (const_string "<ssevecmode>")))])
3454 (define_insn "*andnottf3"
3455 [(set (match_operand:TF 0 "register_operand" "=x,x,v,v")
3457 (not:TF (match_operand:TF 1 "register_operand" "0,x,v,v"))
3458 (match_operand:TF 2 "vector_operand" "xBm,xm,vm,v")))]
3461 static char buf[128];
3464 = (which_alternative >= 2 ? "pandnq"
3465 : get_attr_mode (insn) == MODE_V4SF ? "andnps" : "pandn");
3467 switch (which_alternative)
3470 ops = "%s\t{%%2, %%0|%%0, %%2}";
3474 ops = "v%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3477 ops = "v%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3483 snprintf (buf, sizeof (buf), ops, tmp);
3486 [(set_attr "isa" "noavx,avx,avx512vl,avx512f")
3487 (set_attr "type" "sselog")
3488 (set (attr "prefix_data16")
3490 (and (eq_attr "alternative" "0")
3491 (eq_attr "mode" "TI"))
3493 (const_string "*")))
3494 (set_attr "prefix" "orig,vex,evex,evex")
3496 (cond [(eq_attr "alternative" "2")
3498 (eq_attr "alternative" "3")
3500 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
3501 (const_string "V4SF")
3502 (match_test "TARGET_AVX")
3504 (ior (not (match_test "TARGET_SSE2"))
3505 (match_test "optimize_function_for_size_p (cfun)"))
3506 (const_string "V4SF")
3508 (const_string "TI")))])
3510 (define_insn "*<code><mode>3"
3511 [(set (match_operand:MODEF 0 "register_operand" "=x,x,v,v")
3513 (match_operand:MODEF 1 "register_operand" "%0,x,v,v")
3514 (match_operand:MODEF 2 "register_operand" "x,x,v,v")))]
3515 "SSE_FLOAT_MODE_P (<MODE>mode)"
3517 static char buf[128];
3520 = (get_attr_mode (insn) == MODE_V4SF) ? "ps" : "<ssevecmodesuffix>";
3522 switch (which_alternative)
3525 ops = "<logic>%s\t{%%2, %%0|%%0, %%2}";
3528 if (!TARGET_AVX512DQ)
3530 suffix = <MODE>mode == DFmode ? "q" : "d";
3531 ops = "vp<logic>%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3536 ops = "v<logic>%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3539 if (TARGET_AVX512DQ)
3540 ops = "v<logic>%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3543 suffix = <MODE>mode == DFmode ? "q" : "d";
3544 ops = "vp<logic>%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3551 snprintf (buf, sizeof (buf), ops, suffix);
3554 [(set_attr "isa" "noavx,avx,avx512vl,avx512f")
3555 (set_attr "type" "sselog")
3556 (set_attr "prefix" "orig,vex,evex,evex")
3558 (cond [(eq_attr "alternative" "2")
3559 (if_then_else (match_test "TARGET_AVX512DQ")
3560 (const_string "<ssevecmode>")
3561 (const_string "TI"))
3562 (eq_attr "alternative" "3")
3563 (if_then_else (match_test "TARGET_AVX512DQ")
3564 (const_string "<avx512fvecmode>")
3565 (const_string "XI"))
3566 (and (match_test "<MODE_SIZE> == 16")
3567 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
3568 (const_string "V4SF")
3569 (match_test "TARGET_AVX")
3570 (const_string "<ssevecmode>")
3571 (match_test "optimize_function_for_size_p (cfun)")
3572 (const_string "V4SF")
3574 (const_string "<ssevecmode>")))])
3576 (define_expand "<code>tf3"
3577 [(set (match_operand:TF 0 "register_operand")
3579 (match_operand:TF 1 "vector_operand")
3580 (match_operand:TF 2 "vector_operand")))]
3582 "ix86_fixup_binary_operands_no_copy (<CODE>, TFmode, operands);")
3584 (define_insn "*<code>tf3"
3585 [(set (match_operand:TF 0 "register_operand" "=x,x,v,v")
3587 (match_operand:TF 1 "vector_operand" "%0,x,v,v")
3588 (match_operand:TF 2 "vector_operand" "xBm,xm,vm,v")))]
3589 "TARGET_SSE && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
3591 static char buf[128];
3594 = (which_alternative >= 2 ? "p<logic>q"
3595 : get_attr_mode (insn) == MODE_V4SF ? "<logic>ps" : "p<logic>");
3597 switch (which_alternative)
3600 ops = "%s\t{%%2, %%0|%%0, %%2}";
3604 ops = "v%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3607 ops = "v%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3613 snprintf (buf, sizeof (buf), ops, tmp);
3616 [(set_attr "isa" "noavx,avx,avx512vl,avx512f")
3617 (set_attr "type" "sselog")
3618 (set (attr "prefix_data16")
3620 (and (eq_attr "alternative" "0")
3621 (eq_attr "mode" "TI"))
3623 (const_string "*")))
3624 (set_attr "prefix" "orig,vex,evex,evex")
3626 (cond [(eq_attr "alternative" "2")
3628 (eq_attr "alternative" "3")
3630 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
3631 (const_string "V4SF")
3632 (match_test "TARGET_AVX")
3634 (ior (not (match_test "TARGET_SSE2"))
3635 (match_test "optimize_function_for_size_p (cfun)"))
3636 (const_string "V4SF")
3638 (const_string "TI")))])
3640 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3642 ;; FMA floating point multiply/accumulate instructions. These include
3643 ;; scalar versions of the instructions as well as vector versions.
3645 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3647 ;; The standard names for scalar FMA are only available with SSE math enabled.
3648 ;; CPUID bit AVX512F enables evex encoded scalar and 512-bit fma. It doesn't
3649 ;; care about FMA bit, so we enable fma for TARGET_AVX512F even when TARGET_FMA
3650 ;; and TARGET_FMA4 are both false.
3651 ;; TODO: In theory AVX512F does not automatically imply FMA, and without FMA
3652 ;; one must force the EVEX encoding of the fma insns. Ideally we'd improve
3653 ;; GAS to allow proper prefix selection. However, for the moment all hardware
3654 ;; that supports AVX512F also supports FMA so we can ignore this for now.
3655 (define_mode_iterator FMAMODEM
3656 [(SF "TARGET_SSE_MATH && (TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F)")
3657 (DF "TARGET_SSE_MATH && (TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F)")
3658 (V4SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3659 (V2DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3660 (V8SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3661 (V4DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3662 (V16SF "TARGET_AVX512F")
3663 (V8DF "TARGET_AVX512F")])
3665 (define_expand "fma<mode>4"
3666 [(set (match_operand:FMAMODEM 0 "register_operand")
3668 (match_operand:FMAMODEM 1 "nonimmediate_operand")
3669 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3670 (match_operand:FMAMODEM 3 "nonimmediate_operand")))])
3672 (define_expand "fms<mode>4"
3673 [(set (match_operand:FMAMODEM 0 "register_operand")
3675 (match_operand:FMAMODEM 1 "nonimmediate_operand")
3676 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3677 (neg:FMAMODEM (match_operand:FMAMODEM 3 "nonimmediate_operand"))))])
3679 (define_expand "fnma<mode>4"
3680 [(set (match_operand:FMAMODEM 0 "register_operand")
3682 (neg:FMAMODEM (match_operand:FMAMODEM 1 "nonimmediate_operand"))
3683 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3684 (match_operand:FMAMODEM 3 "nonimmediate_operand")))])
3686 (define_expand "fnms<mode>4"
3687 [(set (match_operand:FMAMODEM 0 "register_operand")
3689 (neg:FMAMODEM (match_operand:FMAMODEM 1 "nonimmediate_operand"))
3690 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3691 (neg:FMAMODEM (match_operand:FMAMODEM 3 "nonimmediate_operand"))))])
3693 ;; The builtins for intrinsics are not constrained by SSE math enabled.
3694 (define_mode_iterator FMAMODE_AVX512
3695 [(SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F")
3696 (DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F")
3697 (V4SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3698 (V2DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3699 (V8SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3700 (V4DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3701 (V16SF "TARGET_AVX512F")
3702 (V8DF "TARGET_AVX512F")])
3704 (define_mode_iterator FMAMODE
3705 [SF DF V4SF V2DF V8SF V4DF])
3707 (define_expand "fma4i_fmadd_<mode>"
3708 [(set (match_operand:FMAMODE_AVX512 0 "register_operand")
3710 (match_operand:FMAMODE_AVX512 1 "nonimmediate_operand")
3711 (match_operand:FMAMODE_AVX512 2 "nonimmediate_operand")
3712 (match_operand:FMAMODE_AVX512 3 "nonimmediate_operand")))])
3714 (define_expand "<avx512>_fmadd_<mode>_maskz<round_expand_name>"
3715 [(match_operand:VF_AVX512VL 0 "register_operand")
3716 (match_operand:VF_AVX512VL 1 "<round_expand_nimm_predicate>")
3717 (match_operand:VF_AVX512VL 2 "<round_expand_nimm_predicate>")
3718 (match_operand:VF_AVX512VL 3 "<round_expand_nimm_predicate>")
3719 (match_operand:<avx512fmaskmode> 4 "register_operand")]
3720 "TARGET_AVX512F && <round_mode512bit_condition>"
3722 emit_insn (gen_fma_fmadd_<mode>_maskz_1<round_expand_name> (
3723 operands[0], operands[1], operands[2], operands[3],
3724 CONST0_RTX (<MODE>mode), operands[4]<round_expand_operand>));
3728 (define_insn "*fma_fmadd_<mode>"
3729 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
3731 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x")
3732 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
3733 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x")))]
3734 "TARGET_FMA || TARGET_FMA4"
3736 vfmadd132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
3737 vfmadd213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
3738 vfmadd231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
3739 vfmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3740 vfmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3741 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3742 (set_attr "type" "ssemuladd")
3743 (set_attr "mode" "<MODE>")])
3745 ;; Suppose AVX-512F as baseline
3746 (define_mode_iterator VF_SF_AVX512VL
3747 [SF V16SF (V8SF "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
3748 DF V8DF (V4DF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
3750 (define_insn "<sd_mask_codefor>fma_fmadd_<mode><sd_maskz_name><round_name>"
3751 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3753 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
3754 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3755 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0")))]
3756 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3758 vfmadd132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3759 vfmadd213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3760 vfmadd231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
3761 [(set_attr "type" "ssemuladd")
3762 (set_attr "mode" "<MODE>")])
3764 (define_insn "<avx512>_fmadd_<mode>_mask<round_name>"
3765 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
3766 (vec_merge:VF_AVX512VL
3768 (match_operand:VF_AVX512VL 1 "register_operand" "0,0")
3769 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
3770 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>"))
3772 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
3773 "TARGET_AVX512F && <round_mode512bit_condition>"
3775 vfmadd132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
3776 vfmadd213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
3777 [(set_attr "type" "ssemuladd")
3778 (set_attr "mode" "<MODE>")])
3780 (define_insn "<avx512>_fmadd_<mode>_mask3<round_name>"
3781 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
3782 (vec_merge:VF_AVX512VL
3784 (match_operand:VF_AVX512VL 1 "register_operand" "v")
3785 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
3786 (match_operand:VF_AVX512VL 3 "register_operand" "0"))
3788 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
3790 "vfmadd231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
3791 [(set_attr "type" "ssemuladd")
3792 (set_attr "mode" "<MODE>")])
3794 (define_insn "*fma_fmsub_<mode>"
3795 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
3797 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x")
3798 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
3800 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x"))))]
3801 "TARGET_FMA || TARGET_FMA4"
3803 vfmsub132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
3804 vfmsub213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
3805 vfmsub231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
3806 vfmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3807 vfmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3808 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3809 (set_attr "type" "ssemuladd")
3810 (set_attr "mode" "<MODE>")])
3812 (define_insn "<sd_mask_codefor>fma_fmsub_<mode><sd_maskz_name><round_name>"
3813 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3815 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
3816 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3818 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0"))))]
3819 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3821 vfmsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3822 vfmsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3823 vfmsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
3824 [(set_attr "type" "ssemuladd")
3825 (set_attr "mode" "<MODE>")])
3827 (define_insn "<avx512>_fmsub_<mode>_mask<round_name>"
3828 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
3829 (vec_merge:VF_AVX512VL
3831 (match_operand:VF_AVX512VL 1 "register_operand" "0,0")
3832 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
3834 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>")))
3836 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
3839 vfmsub132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
3840 vfmsub213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
3841 [(set_attr "type" "ssemuladd")
3842 (set_attr "mode" "<MODE>")])
3844 (define_insn "<avx512>_fmsub_<mode>_mask3<round_name>"
3845 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
3846 (vec_merge:VF_AVX512VL
3848 (match_operand:VF_AVX512VL 1 "register_operand" "v")
3849 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
3851 (match_operand:VF_AVX512VL 3 "register_operand" "0")))
3853 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
3854 "TARGET_AVX512F && <round_mode512bit_condition>"
3855 "vfmsub231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
3856 [(set_attr "type" "ssemuladd")
3857 (set_attr "mode" "<MODE>")])
3859 (define_insn "*fma_fnmadd_<mode>"
3860 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
3863 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x"))
3864 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
3865 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x")))]
3866 "TARGET_FMA || TARGET_FMA4"
3868 vfnmadd132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
3869 vfnmadd213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
3870 vfnmadd231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
3871 vfnmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3872 vfnmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3873 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3874 (set_attr "type" "ssemuladd")
3875 (set_attr "mode" "<MODE>")])
3877 (define_insn "<sd_mask_codefor>fma_fnmadd_<mode><sd_maskz_name><round_name>"
3878 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3881 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v"))
3882 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3883 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0")))]
3884 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3886 vfnmadd132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3887 vfnmadd213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3888 vfnmadd231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
3889 [(set_attr "type" "ssemuladd")
3890 (set_attr "mode" "<MODE>")])
3892 (define_insn "<avx512>_fnmadd_<mode>_mask<round_name>"
3893 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
3894 (vec_merge:VF_AVX512VL
3897 (match_operand:VF_AVX512VL 1 "register_operand" "0,0"))
3898 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
3899 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>"))
3901 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
3902 "TARGET_AVX512F && <round_mode512bit_condition>"
3904 vfnmadd132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
3905 vfnmadd213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
3906 [(set_attr "type" "ssemuladd")
3907 (set_attr "mode" "<MODE>")])
3909 (define_insn "<avx512>_fnmadd_<mode>_mask3<round_name>"
3910 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
3911 (vec_merge:VF_AVX512VL
3914 (match_operand:VF_AVX512VL 1 "register_operand" "v"))
3915 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
3916 (match_operand:VF_AVX512VL 3 "register_operand" "0"))
3918 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
3919 "TARGET_AVX512F && <round_mode512bit_condition>"
3920 "vfnmadd231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
3921 [(set_attr "type" "ssemuladd")
3922 (set_attr "mode" "<MODE>")])
3924 (define_insn "*fma_fnmsub_<mode>"
3925 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
3928 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x"))
3929 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
3931 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x"))))]
3932 "TARGET_FMA || TARGET_FMA4"
3934 vfnmsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3935 vfnmsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3936 vfnmsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}
3937 vfnmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3938 vfnmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3939 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3940 (set_attr "type" "ssemuladd")
3941 (set_attr "mode" "<MODE>")])
3943 (define_insn "<sd_mask_codefor>fma_fnmsub_<mode><sd_maskz_name><round_name>"
3944 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3947 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v"))
3948 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3950 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0"))))]
3951 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3953 vfnmsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3954 vfnmsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3955 vfnmsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
3956 [(set_attr "type" "ssemuladd")
3957 (set_attr "mode" "<MODE>")])
3959 (define_insn "<avx512>_fnmsub_<mode>_mask<round_name>"
3960 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
3961 (vec_merge:VF_AVX512VL
3964 (match_operand:VF_AVX512VL 1 "register_operand" "0,0"))
3965 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
3967 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>")))
3969 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
3970 "TARGET_AVX512F && <round_mode512bit_condition>"
3972 vfnmsub132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
3973 vfnmsub213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
3974 [(set_attr "type" "ssemuladd")
3975 (set_attr "mode" "<MODE>")])
3977 (define_insn "<avx512>_fnmsub_<mode>_mask3<round_name>"
3978 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
3979 (vec_merge:VF_AVX512VL
3982 (match_operand:VF_AVX512VL 1 "register_operand" "v"))
3983 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
3985 (match_operand:VF_AVX512VL 3 "register_operand" "0")))
3987 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
3989 "vfnmsub231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
3990 [(set_attr "type" "ssemuladd")
3991 (set_attr "mode" "<MODE>")])
3993 ;; FMA parallel floating point multiply addsub and subadd operations.
3995 ;; It would be possible to represent these without the UNSPEC as
3998 ;; (fma op1 op2 op3)
3999 ;; (fma op1 op2 (neg op3))
4002 ;; But this doesn't seem useful in practice.
4004 (define_expand "fmaddsub_<mode>"
4005 [(set (match_operand:VF 0 "register_operand")
4007 [(match_operand:VF 1 "nonimmediate_operand")
4008 (match_operand:VF 2 "nonimmediate_operand")
4009 (match_operand:VF 3 "nonimmediate_operand")]
4011 "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F")
4013 (define_expand "<avx512>_fmaddsub_<mode>_maskz<round_expand_name>"
4014 [(match_operand:VF_AVX512VL 0 "register_operand")
4015 (match_operand:VF_AVX512VL 1 "<round_expand_nimm_predicate>")
4016 (match_operand:VF_AVX512VL 2 "<round_expand_nimm_predicate>")
4017 (match_operand:VF_AVX512VL 3 "<round_expand_nimm_predicate>")
4018 (match_operand:<avx512fmaskmode> 4 "register_operand")]
4021 emit_insn (gen_fma_fmaddsub_<mode>_maskz_1<round_expand_name> (
4022 operands[0], operands[1], operands[2], operands[3],
4023 CONST0_RTX (<MODE>mode), operands[4]<round_expand_operand>));
4027 (define_insn "*fma_fmaddsub_<mode>"
4028 [(set (match_operand:VF_128_256 0 "register_operand" "=v,v,v,x,x")
4030 [(match_operand:VF_128_256 1 "nonimmediate_operand" "%0,0,v,x,x")
4031 (match_operand:VF_128_256 2 "nonimmediate_operand" "vm,v,vm,x,m")
4032 (match_operand:VF_128_256 3 "nonimmediate_operand" "v,vm,0,xm,x")]
4034 "TARGET_FMA || TARGET_FMA4"
4036 vfmaddsub132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
4037 vfmaddsub213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
4038 vfmaddsub231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
4039 vfmaddsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
4040 vfmaddsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
4041 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
4042 (set_attr "type" "ssemuladd")
4043 (set_attr "mode" "<MODE>")])
4045 (define_insn "<sd_mask_codefor>fma_fmaddsub_<mode><sd_maskz_name><round_name>"
4046 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
4047 (unspec:VF_SF_AVX512VL
4048 [(match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
4049 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
4050 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0")]
4052 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
4054 vfmaddsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
4055 vfmaddsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
4056 vfmaddsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
4057 [(set_attr "type" "ssemuladd")
4058 (set_attr "mode" "<MODE>")])
4060 (define_insn "<avx512>_fmaddsub_<mode>_mask<round_name>"
4061 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
4062 (vec_merge:VF_AVX512VL
4064 [(match_operand:VF_AVX512VL 1 "register_operand" "0,0")
4065 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
4066 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>")]
4069 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
4072 vfmaddsub132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
4073 vfmaddsub213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
4074 [(set_attr "type" "ssemuladd")
4075 (set_attr "mode" "<MODE>")])
4077 (define_insn "<avx512>_fmaddsub_<mode>_mask3<round_name>"
4078 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
4079 (vec_merge:VF_AVX512VL
4081 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
4082 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
4083 (match_operand:VF_AVX512VL 3 "register_operand" "0")]
4086 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
4088 "vfmaddsub231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
4089 [(set_attr "type" "ssemuladd")
4090 (set_attr "mode" "<MODE>")])
4092 (define_insn "*fma_fmsubadd_<mode>"
4093 [(set (match_operand:VF_128_256 0 "register_operand" "=v,v,v,x,x")
4095 [(match_operand:VF_128_256 1 "nonimmediate_operand" "%0,0,v,x,x")
4096 (match_operand:VF_128_256 2 "nonimmediate_operand" "vm,v,vm,x,m")
4098 (match_operand:VF_128_256 3 "nonimmediate_operand" "v,vm,0,xm,x"))]
4100 "TARGET_FMA || TARGET_FMA4"
4102 vfmsubadd132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
4103 vfmsubadd213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
4104 vfmsubadd231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
4105 vfmsubadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
4106 vfmsubadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
4107 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
4108 (set_attr "type" "ssemuladd")
4109 (set_attr "mode" "<MODE>")])
4111 (define_insn "<sd_mask_codefor>fma_fmsubadd_<mode><sd_maskz_name><round_name>"
4112 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
4113 (unspec:VF_SF_AVX512VL
4114 [(match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
4115 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
4117 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0"))]
4119 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
4121 vfmsubadd132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
4122 vfmsubadd213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
4123 vfmsubadd231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
4124 [(set_attr "type" "ssemuladd")
4125 (set_attr "mode" "<MODE>")])
4127 (define_insn "<avx512>_fmsubadd_<mode>_mask<round_name>"
4128 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
4129 (vec_merge:VF_AVX512VL
4131 [(match_operand:VF_AVX512VL 1 "register_operand" "0,0")
4132 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
4134 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>"))]
4137 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
4140 vfmsubadd132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
4141 vfmsubadd213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
4142 [(set_attr "type" "ssemuladd")
4143 (set_attr "mode" "<MODE>")])
4145 (define_insn "<avx512>_fmsubadd_<mode>_mask3<round_name>"
4146 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
4147 (vec_merge:VF_AVX512VL
4149 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
4150 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
4152 (match_operand:VF_AVX512VL 3 "register_operand" "0"))]
4155 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
4157 "vfmsubadd231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
4158 [(set_attr "type" "ssemuladd")
4159 (set_attr "mode" "<MODE>")])
4161 ;; FMA3 floating point scalar intrinsics. These merge result with
4162 ;; high-order elements from the destination register.
4164 (define_expand "fmai_vmfmadd_<mode><round_name>"
4165 [(set (match_operand:VF_128 0 "register_operand")
4168 (match_operand:VF_128 1 "<round_nimm_predicate>")
4169 (match_operand:VF_128 2 "<round_nimm_predicate>")
4170 (match_operand:VF_128 3 "<round_nimm_predicate>"))
4175 (define_insn "*fmai_fmadd_<mode>"
4176 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4179 (match_operand:VF_128 1 "<round_nimm_predicate>" " 0, 0")
4180 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>, v")
4181 (match_operand:VF_128 3 "<round_nimm_predicate>" " v,<round_constraint>"))
4184 "TARGET_FMA || TARGET_AVX512F"
4186 vfmadd132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
4187 vfmadd213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
4188 [(set_attr "type" "ssemuladd")
4189 (set_attr "mode" "<MODE>")])
4191 (define_insn "*fmai_fmsub_<mode>"
4192 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4195 (match_operand:VF_128 1 "<round_nimm_predicate>" "0,0")
4196 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>,v")
4198 (match_operand:VF_128 3 "<round_nimm_predicate>" " v,<round_constraint>")))
4201 "TARGET_FMA || TARGET_AVX512F"
4203 vfmsub132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
4204 vfmsub213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
4205 [(set_attr "type" "ssemuladd")
4206 (set_attr "mode" "<MODE>")])
4208 (define_insn "*fmai_fnmadd_<mode><round_name>"
4209 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4213 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>,v"))
4214 (match_operand:VF_128 1 "<round_nimm_predicate>" "0,0")
4215 (match_operand:VF_128 3 "<round_nimm_predicate>" "v,<round_constraint>"))
4218 "TARGET_FMA || TARGET_AVX512F"
4220 vfnmadd132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
4221 vfnmadd213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
4222 [(set_attr "type" "ssemuladd")
4223 (set_attr "mode" "<MODE>")])
4225 (define_insn "*fmai_fnmsub_<mode><round_name>"
4226 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4230 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>, v"))
4231 (match_operand:VF_128 1 "<round_nimm_predicate>" " 0, 0")
4233 (match_operand:VF_128 3 "<round_nimm_predicate>" " v,<round_constraint>")))
4236 "TARGET_FMA || TARGET_AVX512F"
4238 vfnmsub132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
4239 vfnmsub213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
4240 [(set_attr "type" "ssemuladd")
4241 (set_attr "mode" "<MODE>")])
4243 ;; FMA4 floating point scalar intrinsics. These write the
4244 ;; entire destination register, with the high-order elements zeroed.
4246 (define_expand "fma4i_vmfmadd_<mode>"
4247 [(set (match_operand:VF_128 0 "register_operand")
4250 (match_operand:VF_128 1 "nonimmediate_operand")
4251 (match_operand:VF_128 2 "nonimmediate_operand")
4252 (match_operand:VF_128 3 "nonimmediate_operand"))
4256 "operands[4] = CONST0_RTX (<MODE>mode);")
4258 (define_insn "*fma4i_vmfmadd_<mode>"
4259 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
4262 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x")
4263 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
4264 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x"))
4265 (match_operand:VF_128 4 "const0_operand")
4268 "vfmadd<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
4269 [(set_attr "type" "ssemuladd")
4270 (set_attr "mode" "<MODE>")])
4272 (define_insn "*fma4i_vmfmsub_<mode>"
4273 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
4276 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x")
4277 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
4279 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x")))
4280 (match_operand:VF_128 4 "const0_operand")
4283 "vfmsub<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
4284 [(set_attr "type" "ssemuladd")
4285 (set_attr "mode" "<MODE>")])
4287 (define_insn "*fma4i_vmfnmadd_<mode>"
4288 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
4292 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x"))
4293 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
4294 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x"))
4295 (match_operand:VF_128 4 "const0_operand")
4298 "vfnmadd<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
4299 [(set_attr "type" "ssemuladd")
4300 (set_attr "mode" "<MODE>")])
4302 (define_insn "*fma4i_vmfnmsub_<mode>"
4303 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
4307 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x"))
4308 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
4310 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x")))
4311 (match_operand:VF_128 4 "const0_operand")
4314 "vfnmsub<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
4315 [(set_attr "type" "ssemuladd")
4316 (set_attr "mode" "<MODE>")])
4318 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4320 ;; Parallel single-precision floating point conversion operations
4322 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4324 (define_insn "sse_cvtpi2ps"
4325 [(set (match_operand:V4SF 0 "register_operand" "=x")
4328 (float:V2SF (match_operand:V2SI 2 "nonimmediate_operand" "ym")))
4329 (match_operand:V4SF 1 "register_operand" "0")
4332 "cvtpi2ps\t{%2, %0|%0, %2}"
4333 [(set_attr "type" "ssecvt")
4334 (set_attr "mode" "V4SF")])
4336 (define_insn "sse_cvtps2pi"
4337 [(set (match_operand:V2SI 0 "register_operand" "=y")
4339 (unspec:V4SI [(match_operand:V4SF 1 "nonimmediate_operand" "xm")]
4341 (parallel [(const_int 0) (const_int 1)])))]
4343 "cvtps2pi\t{%1, %0|%0, %q1}"
4344 [(set_attr "type" "ssecvt")
4345 (set_attr "unit" "mmx")
4346 (set_attr "mode" "DI")])
4348 (define_insn "sse_cvttps2pi"
4349 [(set (match_operand:V2SI 0 "register_operand" "=y")
4351 (fix:V4SI (match_operand:V4SF 1 "nonimmediate_operand" "xm"))
4352 (parallel [(const_int 0) (const_int 1)])))]
4354 "cvttps2pi\t{%1, %0|%0, %q1}"
4355 [(set_attr "type" "ssecvt")
4356 (set_attr "unit" "mmx")
4357 (set_attr "prefix_rep" "0")
4358 (set_attr "mode" "SF")])
4360 (define_insn "sse_cvtsi2ss<round_name>"
4361 [(set (match_operand:V4SF 0 "register_operand" "=x,x,v")
4364 (float:SF (match_operand:SI 2 "<round_nimm_scalar_predicate>" "r,m,<round_constraint3>")))
4365 (match_operand:V4SF 1 "register_operand" "0,0,v")
4369 cvtsi2ss\t{%2, %0|%0, %2}
4370 cvtsi2ss\t{%2, %0|%0, %2}
4371 vcvtsi2ss\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4372 [(set_attr "isa" "noavx,noavx,avx")
4373 (set_attr "type" "sseicvt")
4374 (set_attr "athlon_decode" "vector,double,*")
4375 (set_attr "amdfam10_decode" "vector,double,*")
4376 (set_attr "bdver1_decode" "double,direct,*")
4377 (set_attr "btver2_decode" "double,double,double")
4378 (set_attr "znver1_decode" "double,double,double")
4379 (set_attr "prefix" "orig,orig,maybe_evex")
4380 (set_attr "mode" "SF")])
4382 (define_insn "sse_cvtsi2ssq<round_name>"
4383 [(set (match_operand:V4SF 0 "register_operand" "=x,x,v")
4386 (float:SF (match_operand:DI 2 "<round_nimm_scalar_predicate>" "r,m,<round_constraint3>")))
4387 (match_operand:V4SF 1 "register_operand" "0,0,v")
4389 "TARGET_SSE && TARGET_64BIT"
4391 cvtsi2ssq\t{%2, %0|%0, %2}
4392 cvtsi2ssq\t{%2, %0|%0, %2}
4393 vcvtsi2ssq\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4394 [(set_attr "isa" "noavx,noavx,avx")
4395 (set_attr "type" "sseicvt")
4396 (set_attr "athlon_decode" "vector,double,*")
4397 (set_attr "amdfam10_decode" "vector,double,*")
4398 (set_attr "bdver1_decode" "double,direct,*")
4399 (set_attr "btver2_decode" "double,double,double")
4400 (set_attr "length_vex" "*,*,4")
4401 (set_attr "prefix_rex" "1,1,*")
4402 (set_attr "prefix" "orig,orig,maybe_evex")
4403 (set_attr "mode" "SF")])
4405 (define_insn "sse_cvtss2si<round_name>"
4406 [(set (match_operand:SI 0 "register_operand" "=r,r")
4409 (match_operand:V4SF 1 "<round_nimm_scalar_predicate>" "v,<round_constraint2>")
4410 (parallel [(const_int 0)]))]
4411 UNSPEC_FIX_NOTRUNC))]
4413 "%vcvtss2si\t{<round_op2>%1, %0|%0, %k1<round_op2>}"
4414 [(set_attr "type" "sseicvt")
4415 (set_attr "athlon_decode" "double,vector")
4416 (set_attr "bdver1_decode" "double,double")
4417 (set_attr "prefix_rep" "1")
4418 (set_attr "prefix" "maybe_vex")
4419 (set_attr "mode" "SI")])
4421 (define_insn "sse_cvtss2si_2"
4422 [(set (match_operand:SI 0 "register_operand" "=r,r")
4423 (unspec:SI [(match_operand:SF 1 "nonimmediate_operand" "v,m")]
4424 UNSPEC_FIX_NOTRUNC))]
4426 "%vcvtss2si\t{%1, %0|%0, %k1}"
4427 [(set_attr "type" "sseicvt")
4428 (set_attr "athlon_decode" "double,vector")
4429 (set_attr "amdfam10_decode" "double,double")
4430 (set_attr "bdver1_decode" "double,double")
4431 (set_attr "prefix_rep" "1")
4432 (set_attr "prefix" "maybe_vex")
4433 (set_attr "mode" "SI")])
4435 (define_insn "sse_cvtss2siq<round_name>"
4436 [(set (match_operand:DI 0 "register_operand" "=r,r")
4439 (match_operand:V4SF 1 "<round_nimm_scalar_predicate>" "v,<round_constraint2>")
4440 (parallel [(const_int 0)]))]
4441 UNSPEC_FIX_NOTRUNC))]
4442 "TARGET_SSE && TARGET_64BIT"
4443 "%vcvtss2si{q}\t{<round_op2>%1, %0|%0, %k1<round_op2>}"
4444 [(set_attr "type" "sseicvt")
4445 (set_attr "athlon_decode" "double,vector")
4446 (set_attr "bdver1_decode" "double,double")
4447 (set_attr "prefix_rep" "1")
4448 (set_attr "prefix" "maybe_vex")
4449 (set_attr "mode" "DI")])
4451 (define_insn "sse_cvtss2siq_2"
4452 [(set (match_operand:DI 0 "register_operand" "=r,r")
4453 (unspec:DI [(match_operand:SF 1 "nonimmediate_operand" "v,m")]
4454 UNSPEC_FIX_NOTRUNC))]
4455 "TARGET_SSE && TARGET_64BIT"
4456 "%vcvtss2si{q}\t{%1, %0|%0, %k1}"
4457 [(set_attr "type" "sseicvt")
4458 (set_attr "athlon_decode" "double,vector")
4459 (set_attr "amdfam10_decode" "double,double")
4460 (set_attr "bdver1_decode" "double,double")
4461 (set_attr "prefix_rep" "1")
4462 (set_attr "prefix" "maybe_vex")
4463 (set_attr "mode" "DI")])
4465 (define_insn "sse_cvttss2si<round_saeonly_name>"
4466 [(set (match_operand:SI 0 "register_operand" "=r,r")
4469 (match_operand:V4SF 1 "<round_saeonly_nimm_scalar_predicate>" "v,<round_saeonly_constraint2>")
4470 (parallel [(const_int 0)]))))]
4472 "%vcvttss2si\t{<round_saeonly_op2>%1, %0|%0, %k1<round_saeonly_op2>}"
4473 [(set_attr "type" "sseicvt")
4474 (set_attr "athlon_decode" "double,vector")
4475 (set_attr "amdfam10_decode" "double,double")
4476 (set_attr "bdver1_decode" "double,double")
4477 (set_attr "prefix_rep" "1")
4478 (set_attr "prefix" "maybe_vex")
4479 (set_attr "mode" "SI")])
4481 (define_insn "sse_cvttss2siq<round_saeonly_name>"
4482 [(set (match_operand:DI 0 "register_operand" "=r,r")
4485 (match_operand:V4SF 1 "<round_saeonly_nimm_scalar_predicate>" "v,<round_saeonly_constraint>")
4486 (parallel [(const_int 0)]))))]
4487 "TARGET_SSE && TARGET_64BIT"
4488 "%vcvttss2si{q}\t{<round_saeonly_op2>%1, %0|%0, %k1<round_saeonly_op2>}"
4489 [(set_attr "type" "sseicvt")
4490 (set_attr "athlon_decode" "double,vector")
4491 (set_attr "amdfam10_decode" "double,double")
4492 (set_attr "bdver1_decode" "double,double")
4493 (set_attr "prefix_rep" "1")
4494 (set_attr "prefix" "maybe_vex")
4495 (set_attr "mode" "DI")])
4497 (define_insn "cvtusi2<ssescalarmodesuffix>32<round_name>"
4498 [(set (match_operand:VF_128 0 "register_operand" "=v")
4500 (vec_duplicate:VF_128
4501 (unsigned_float:<ssescalarmode>
4502 (match_operand:SI 2 "<round_nimm_predicate>" "<round_constraint3>")))
4503 (match_operand:VF_128 1 "register_operand" "v")
4505 "TARGET_AVX512F && <round_modev4sf_condition>"
4506 "vcvtusi2<ssescalarmodesuffix>\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4507 [(set_attr "type" "sseicvt")
4508 (set_attr "prefix" "evex")
4509 (set_attr "mode" "<ssescalarmode>")])
4511 (define_insn "cvtusi2<ssescalarmodesuffix>64<round_name>"
4512 [(set (match_operand:VF_128 0 "register_operand" "=v")
4514 (vec_duplicate:VF_128
4515 (unsigned_float:<ssescalarmode>
4516 (match_operand:DI 2 "<round_nimm_predicate>" "<round_constraint3>")))
4517 (match_operand:VF_128 1 "register_operand" "v")
4519 "TARGET_AVX512F && TARGET_64BIT"
4520 "vcvtusi2<ssescalarmodesuffix>\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4521 [(set_attr "type" "sseicvt")
4522 (set_attr "prefix" "evex")
4523 (set_attr "mode" "<ssescalarmode>")])
4525 (define_insn "float<sseintvecmodelower><mode>2<mask_name><round_name>"
4526 [(set (match_operand:VF1 0 "register_operand" "=x,v")
4528 (match_operand:<sseintvecmode> 1 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
4529 "TARGET_SSE2 && <mask_mode512bit_condition> && <round_mode512bit_condition>"
4531 cvtdq2ps\t{%1, %0|%0, %1}
4532 vcvtdq2ps\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4533 [(set_attr "isa" "noavx,avx")
4534 (set_attr "type" "ssecvt")
4535 (set_attr "prefix" "maybe_vex")
4536 (set_attr "mode" "<sseinsnmode>")])
4538 (define_insn "ufloat<sseintvecmodelower><mode>2<mask_name><round_name>"
4539 [(set (match_operand:VF1_AVX512VL 0 "register_operand" "=v")
4540 (unsigned_float:VF1_AVX512VL
4541 (match_operand:<sseintvecmode> 1 "nonimmediate_operand" "<round_constraint>")))]
4543 "vcvtudq2ps\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4544 [(set_attr "type" "ssecvt")
4545 (set_attr "prefix" "evex")
4546 (set_attr "mode" "<MODE>")])
4548 (define_expand "floatuns<sseintvecmodelower><mode>2"
4549 [(match_operand:VF1 0 "register_operand")
4550 (match_operand:<sseintvecmode> 1 "register_operand")]
4551 "TARGET_SSE2 && (<MODE>mode == V4SFmode || TARGET_AVX2)"
4553 if (<MODE>mode == V16SFmode)
4554 emit_insn (gen_ufloatv16siv16sf2 (operands[0], operands[1]));
4556 if (TARGET_AVX512VL)
4558 if (<MODE>mode == V4SFmode)
4559 emit_insn (gen_ufloatv4siv4sf2 (operands[0], operands[1]));
4561 emit_insn (gen_ufloatv8siv8sf2 (operands[0], operands[1]));
4564 ix86_expand_vector_convert_uns_vsivsf (operands[0], operands[1]);
4570 ;; For <sse2_avx_avx512f>_fix_notrunc<sf2simodelower><mode> insn pattern
4571 (define_mode_attr sf2simodelower
4572 [(V16SI "v16sf") (V8SI "v8sf") (V4SI "v4sf")])
4574 (define_insn "<sse2_avx_avx512f>_fix_notrunc<sf2simodelower><mode><mask_name>"
4575 [(set (match_operand:VI4_AVX 0 "register_operand" "=v")
4577 [(match_operand:<ssePSmode> 1 "vector_operand" "vBm")]
4578 UNSPEC_FIX_NOTRUNC))]
4579 "TARGET_SSE2 && <mask_mode512bit_condition>"
4580 "%vcvtps2dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4581 [(set_attr "type" "ssecvt")
4582 (set (attr "prefix_data16")
4584 (match_test "TARGET_AVX")
4586 (const_string "1")))
4587 (set_attr "prefix" "maybe_vex")
4588 (set_attr "mode" "<sseinsnmode>")])
4590 (define_insn "avx512f_fix_notruncv16sfv16si<mask_name><round_name>"
4591 [(set (match_operand:V16SI 0 "register_operand" "=v")
4593 [(match_operand:V16SF 1 "<round_nimm_predicate>" "<round_constraint>")]
4594 UNSPEC_FIX_NOTRUNC))]
4596 "vcvtps2dq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4597 [(set_attr "type" "ssecvt")
4598 (set_attr "prefix" "evex")
4599 (set_attr "mode" "XI")])
4601 (define_insn "<mask_codefor><avx512>_ufix_notrunc<sf2simodelower><mode><mask_name><round_name>"
4602 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
4603 (unspec:VI4_AVX512VL
4604 [(match_operand:<ssePSmode> 1 "nonimmediate_operand" "<round_constraint>")]
4605 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4607 "vcvtps2udq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4608 [(set_attr "type" "ssecvt")
4609 (set_attr "prefix" "evex")
4610 (set_attr "mode" "<sseinsnmode>")])
4612 (define_insn "<mask_codefor>avx512dq_cvtps2qq<mode><mask_name><round_name>"
4613 [(set (match_operand:VI8_256_512 0 "register_operand" "=v")
4614 (unspec:VI8_256_512 [(match_operand:<ssePSmode2> 1 "nonimmediate_operand" "<round_constraint>")]
4615 UNSPEC_FIX_NOTRUNC))]
4616 "TARGET_AVX512DQ && <round_mode512bit_condition>"
4617 "vcvtps2qq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4618 [(set_attr "type" "ssecvt")
4619 (set_attr "prefix" "evex")
4620 (set_attr "mode" "<sseinsnmode>")])
4622 (define_insn "<mask_codefor>avx512dq_cvtps2qqv2di<mask_name>"
4623 [(set (match_operand:V2DI 0 "register_operand" "=v")
4626 (match_operand:V4SF 1 "nonimmediate_operand" "vm")
4627 (parallel [(const_int 0) (const_int 1)]))]
4628 UNSPEC_FIX_NOTRUNC))]
4629 "TARGET_AVX512DQ && TARGET_AVX512VL"
4630 "vcvtps2qq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
4631 [(set_attr "type" "ssecvt")
4632 (set_attr "prefix" "evex")
4633 (set_attr "mode" "TI")])
4635 (define_insn "<mask_codefor>avx512dq_cvtps2uqq<mode><mask_name><round_name>"
4636 [(set (match_operand:VI8_256_512 0 "register_operand" "=v")
4637 (unspec:VI8_256_512 [(match_operand:<ssePSmode2> 1 "nonimmediate_operand" "<round_constraint>")]
4638 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4639 "TARGET_AVX512DQ && <round_mode512bit_condition>"
4640 "vcvtps2uqq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4641 [(set_attr "type" "ssecvt")
4642 (set_attr "prefix" "evex")
4643 (set_attr "mode" "<sseinsnmode>")])
4645 (define_insn "<mask_codefor>avx512dq_cvtps2uqqv2di<mask_name>"
4646 [(set (match_operand:V2DI 0 "register_operand" "=v")
4649 (match_operand:V4SF 1 "nonimmediate_operand" "vm")
4650 (parallel [(const_int 0) (const_int 1)]))]
4651 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4652 "TARGET_AVX512DQ && TARGET_AVX512VL"
4653 "vcvtps2uqq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
4654 [(set_attr "type" "ssecvt")
4655 (set_attr "prefix" "evex")
4656 (set_attr "mode" "TI")])
4658 (define_insn "<fixsuffix>fix_truncv16sfv16si2<mask_name><round_saeonly_name>"
4659 [(set (match_operand:V16SI 0 "register_operand" "=v")
4661 (match_operand:V16SF 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
4663 "vcvttps2<fixsuffix>dq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
4664 [(set_attr "type" "ssecvt")
4665 (set_attr "prefix" "evex")
4666 (set_attr "mode" "XI")])
4668 (define_insn "fix_truncv8sfv8si2<mask_name>"
4669 [(set (match_operand:V8SI 0 "register_operand" "=v")
4670 (fix:V8SI (match_operand:V8SF 1 "nonimmediate_operand" "vm")))]
4671 "TARGET_AVX && <mask_avx512vl_condition>"
4672 "vcvttps2dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4673 [(set_attr "type" "ssecvt")
4674 (set_attr "prefix" "<mask_prefix>")
4675 (set_attr "mode" "OI")])
4677 (define_insn "fix_truncv4sfv4si2<mask_name>"
4678 [(set (match_operand:V4SI 0 "register_operand" "=v")
4679 (fix:V4SI (match_operand:V4SF 1 "vector_operand" "vBm")))]
4680 "TARGET_SSE2 && <mask_avx512vl_condition>"
4681 "%vcvttps2dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4682 [(set_attr "type" "ssecvt")
4683 (set (attr "prefix_rep")
4685 (match_test "TARGET_AVX")
4687 (const_string "1")))
4688 (set (attr "prefix_data16")
4690 (match_test "TARGET_AVX")
4692 (const_string "0")))
4693 (set_attr "prefix_data16" "0")
4694 (set_attr "prefix" "<mask_prefix2>")
4695 (set_attr "mode" "TI")])
4697 (define_expand "fixuns_trunc<mode><sseintvecmodelower>2"
4698 [(match_operand:<sseintvecmode> 0 "register_operand")
4699 (match_operand:VF1 1 "register_operand")]
4702 if (<MODE>mode == V16SFmode)
4703 emit_insn (gen_ufix_truncv16sfv16si2 (operands[0],
4708 tmp[0] = ix86_expand_adjust_ufix_to_sfix_si (operands[1], &tmp[2]);
4709 tmp[1] = gen_reg_rtx (<sseintvecmode>mode);
4710 emit_insn (gen_fix_trunc<mode><sseintvecmodelower>2 (tmp[1], tmp[0]));
4711 emit_insn (gen_xor<sseintvecmodelower>3 (operands[0], tmp[1], tmp[2]));
4716 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4718 ;; Parallel double-precision floating point conversion operations
4720 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4722 (define_insn "sse2_cvtpi2pd"
4723 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
4724 (float:V2DF (match_operand:V2SI 1 "nonimmediate_operand" "y,m")))]
4726 "cvtpi2pd\t{%1, %0|%0, %1}"
4727 [(set_attr "type" "ssecvt")
4728 (set_attr "unit" "mmx,*")
4729 (set_attr "prefix_data16" "1,*")
4730 (set_attr "mode" "V2DF")])
4732 (define_insn "sse2_cvtpd2pi"
4733 [(set (match_operand:V2SI 0 "register_operand" "=y")
4734 (unspec:V2SI [(match_operand:V2DF 1 "nonimmediate_operand" "xm")]
4735 UNSPEC_FIX_NOTRUNC))]
4737 "cvtpd2pi\t{%1, %0|%0, %1}"
4738 [(set_attr "type" "ssecvt")
4739 (set_attr "unit" "mmx")
4740 (set_attr "bdver1_decode" "double")
4741 (set_attr "btver2_decode" "direct")
4742 (set_attr "prefix_data16" "1")
4743 (set_attr "mode" "DI")])
4745 (define_insn "sse2_cvttpd2pi"
4746 [(set (match_operand:V2SI 0 "register_operand" "=y")
4747 (fix:V2SI (match_operand:V2DF 1 "nonimmediate_operand" "xm")))]
4749 "cvttpd2pi\t{%1, %0|%0, %1}"
4750 [(set_attr "type" "ssecvt")
4751 (set_attr "unit" "mmx")
4752 (set_attr "bdver1_decode" "double")
4753 (set_attr "prefix_data16" "1")
4754 (set_attr "mode" "TI")])
4756 (define_insn "sse2_cvtsi2sd"
4757 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
4760 (float:DF (match_operand:SI 2 "nonimmediate_operand" "r,m,rm")))
4761 (match_operand:V2DF 1 "register_operand" "0,0,v")
4765 cvtsi2sd\t{%2, %0|%0, %2}
4766 cvtsi2sd\t{%2, %0|%0, %2}
4767 vcvtsi2sd\t{%2, %1, %0|%0, %1, %2}"
4768 [(set_attr "isa" "noavx,noavx,avx")
4769 (set_attr "type" "sseicvt")
4770 (set_attr "athlon_decode" "double,direct,*")
4771 (set_attr "amdfam10_decode" "vector,double,*")
4772 (set_attr "bdver1_decode" "double,direct,*")
4773 (set_attr "btver2_decode" "double,double,double")
4774 (set_attr "znver1_decode" "double,double,double")
4775 (set_attr "prefix" "orig,orig,maybe_evex")
4776 (set_attr "mode" "DF")])
4778 (define_insn "sse2_cvtsi2sdq<round_name>"
4779 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
4782 (float:DF (match_operand:DI 2 "<round_nimm_scalar_predicate>" "r,m,<round_constraint3>")))
4783 (match_operand:V2DF 1 "register_operand" "0,0,v")
4785 "TARGET_SSE2 && TARGET_64BIT"
4787 cvtsi2sdq\t{%2, %0|%0, %2}
4788 cvtsi2sdq\t{%2, %0|%0, %2}
4789 vcvtsi2sdq\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4790 [(set_attr "isa" "noavx,noavx,avx")
4791 (set_attr "type" "sseicvt")
4792 (set_attr "athlon_decode" "double,direct,*")
4793 (set_attr "amdfam10_decode" "vector,double,*")
4794 (set_attr "bdver1_decode" "double,direct,*")
4795 (set_attr "length_vex" "*,*,4")
4796 (set_attr "prefix_rex" "1,1,*")
4797 (set_attr "prefix" "orig,orig,maybe_evex")
4798 (set_attr "mode" "DF")])
4800 (define_insn "avx512f_vcvtss2usi<round_name>"
4801 [(set (match_operand:SI 0 "register_operand" "=r")
4804 (match_operand:V4SF 1 "<round_nimm_predicate>" "<round_constraint>")
4805 (parallel [(const_int 0)]))]
4806 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4808 "vcvtss2usi\t{<round_op2>%1, %0|%0, %k1<round_op2>}"
4809 [(set_attr "type" "sseicvt")
4810 (set_attr "prefix" "evex")
4811 (set_attr "mode" "SI")])
4813 (define_insn "avx512f_vcvtss2usiq<round_name>"
4814 [(set (match_operand:DI 0 "register_operand" "=r")
4817 (match_operand:V4SF 1 "<round_nimm_predicate>" "<round_constraint>")
4818 (parallel [(const_int 0)]))]
4819 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4820 "TARGET_AVX512F && TARGET_64BIT"
4821 "vcvtss2usi\t{<round_op2>%1, %0|%0, %k1<round_op2>}"
4822 [(set_attr "type" "sseicvt")
4823 (set_attr "prefix" "evex")
4824 (set_attr "mode" "DI")])
4826 (define_insn "avx512f_vcvttss2usi<round_saeonly_name>"
4827 [(set (match_operand:SI 0 "register_operand" "=r")
4830 (match_operand:V4SF 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
4831 (parallel [(const_int 0)]))))]
4833 "vcvttss2usi\t{<round_saeonly_op2>%1, %0|%0, %k1<round_saeonly_op2>}"
4834 [(set_attr "type" "sseicvt")
4835 (set_attr "prefix" "evex")
4836 (set_attr "mode" "SI")])
4838 (define_insn "avx512f_vcvttss2usiq<round_saeonly_name>"
4839 [(set (match_operand:DI 0 "register_operand" "=r")
4842 (match_operand:V4SF 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
4843 (parallel [(const_int 0)]))))]
4844 "TARGET_AVX512F && TARGET_64BIT"
4845 "vcvttss2usi\t{<round_saeonly_op2>%1, %0|%0, %k1<round_saeonly_op2>}"
4846 [(set_attr "type" "sseicvt")
4847 (set_attr "prefix" "evex")
4848 (set_attr "mode" "DI")])
4850 (define_insn "avx512f_vcvtsd2usi<round_name>"
4851 [(set (match_operand:SI 0 "register_operand" "=r")
4854 (match_operand:V2DF 1 "<round_nimm_predicate>" "<round_constraint>")
4855 (parallel [(const_int 0)]))]
4856 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4858 "vcvtsd2usi\t{<round_op2>%1, %0|%0, %q1<round_op2>}"
4859 [(set_attr "type" "sseicvt")
4860 (set_attr "prefix" "evex")
4861 (set_attr "mode" "SI")])
4863 (define_insn "avx512f_vcvtsd2usiq<round_name>"
4864 [(set (match_operand:DI 0 "register_operand" "=r")
4867 (match_operand:V2DF 1 "<round_nimm_predicate>" "<round_constraint>")
4868 (parallel [(const_int 0)]))]
4869 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4870 "TARGET_AVX512F && TARGET_64BIT"
4871 "vcvtsd2usi\t{<round_op2>%1, %0|%0, %q1<round_op2>}"
4872 [(set_attr "type" "sseicvt")
4873 (set_attr "prefix" "evex")
4874 (set_attr "mode" "DI")])
4876 (define_insn "avx512f_vcvttsd2usi<round_saeonly_name>"
4877 [(set (match_operand:SI 0 "register_operand" "=r")
4880 (match_operand:V2DF 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
4881 (parallel [(const_int 0)]))))]
4883 "vcvttsd2usi\t{<round_saeonly_op2>%1, %0|%0, %q1<round_saeonly_op2>}"
4884 [(set_attr "type" "sseicvt")
4885 (set_attr "prefix" "evex")
4886 (set_attr "mode" "SI")])
4888 (define_insn "avx512f_vcvttsd2usiq<round_saeonly_name>"
4889 [(set (match_operand:DI 0 "register_operand" "=r")
4892 (match_operand:V2DF 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
4893 (parallel [(const_int 0)]))))]
4894 "TARGET_AVX512F && TARGET_64BIT"
4895 "vcvttsd2usi\t{<round_saeonly_op2>%1, %0|%0, %q1<round_saeonly_op2>}"
4896 [(set_attr "type" "sseicvt")
4897 (set_attr "prefix" "evex")
4898 (set_attr "mode" "DI")])
4900 (define_insn "sse2_cvtsd2si<round_name>"
4901 [(set (match_operand:SI 0 "register_operand" "=r,r")
4904 (match_operand:V2DF 1 "<round_nimm_scalar_predicate>" "v,<round_constraint2>")
4905 (parallel [(const_int 0)]))]
4906 UNSPEC_FIX_NOTRUNC))]
4908 "%vcvtsd2si\t{<round_op2>%1, %0|%0, %q1<round_op2>}"
4909 [(set_attr "type" "sseicvt")
4910 (set_attr "athlon_decode" "double,vector")
4911 (set_attr "bdver1_decode" "double,double")
4912 (set_attr "btver2_decode" "double,double")
4913 (set_attr "prefix_rep" "1")
4914 (set_attr "prefix" "maybe_vex")
4915 (set_attr "mode" "SI")])
4917 (define_insn "sse2_cvtsd2si_2"
4918 [(set (match_operand:SI 0 "register_operand" "=r,r")
4919 (unspec:SI [(match_operand:DF 1 "nonimmediate_operand" "v,m")]
4920 UNSPEC_FIX_NOTRUNC))]
4922 "%vcvtsd2si\t{%1, %0|%0, %q1}"
4923 [(set_attr "type" "sseicvt")
4924 (set_attr "athlon_decode" "double,vector")
4925 (set_attr "amdfam10_decode" "double,double")
4926 (set_attr "bdver1_decode" "double,double")
4927 (set_attr "prefix_rep" "1")
4928 (set_attr "prefix" "maybe_vex")
4929 (set_attr "mode" "SI")])
4931 (define_insn "sse2_cvtsd2siq<round_name>"
4932 [(set (match_operand:DI 0 "register_operand" "=r,r")
4935 (match_operand:V2DF 1 "<round_nimm_scalar_predicate>" "v,<round_constraint2>")
4936 (parallel [(const_int 0)]))]
4937 UNSPEC_FIX_NOTRUNC))]
4938 "TARGET_SSE2 && TARGET_64BIT"
4939 "%vcvtsd2si{q}\t{<round_op2>%1, %0|%0, %q1<round_op2>}"
4940 [(set_attr "type" "sseicvt")
4941 (set_attr "athlon_decode" "double,vector")
4942 (set_attr "bdver1_decode" "double,double")
4943 (set_attr "prefix_rep" "1")
4944 (set_attr "prefix" "maybe_vex")
4945 (set_attr "mode" "DI")])
4947 (define_insn "sse2_cvtsd2siq_2"
4948 [(set (match_operand:DI 0 "register_operand" "=r,r")
4949 (unspec:DI [(match_operand:DF 1 "nonimmediate_operand" "v,m")]
4950 UNSPEC_FIX_NOTRUNC))]
4951 "TARGET_SSE2 && TARGET_64BIT"
4952 "%vcvtsd2si{q}\t{%1, %0|%0, %q1}"
4953 [(set_attr "type" "sseicvt")
4954 (set_attr "athlon_decode" "double,vector")
4955 (set_attr "amdfam10_decode" "double,double")
4956 (set_attr "bdver1_decode" "double,double")
4957 (set_attr "prefix_rep" "1")
4958 (set_attr "prefix" "maybe_vex")
4959 (set_attr "mode" "DI")])
4961 (define_insn "sse2_cvttsd2si<round_saeonly_name>"
4962 [(set (match_operand:SI 0 "register_operand" "=r,r")
4965 (match_operand:V2DF 1 "<round_saeonly_nimm_scalar_predicate>" "v,<round_saeonly_constraint2>")
4966 (parallel [(const_int 0)]))))]
4968 "%vcvttsd2si\t{<round_saeonly_op2>%1, %0|%0, %q1<round_saeonly_op2>}"
4969 [(set_attr "type" "sseicvt")
4970 (set_attr "athlon_decode" "double,vector")
4971 (set_attr "amdfam10_decode" "double,double")
4972 (set_attr "bdver1_decode" "double,double")
4973 (set_attr "btver2_decode" "double,double")
4974 (set_attr "prefix_rep" "1")
4975 (set_attr "prefix" "maybe_vex")
4976 (set_attr "mode" "SI")])
4978 (define_insn "sse2_cvttsd2siq<round_saeonly_name>"
4979 [(set (match_operand:DI 0 "register_operand" "=r,r")
4982 (match_operand:V2DF 1 "<round_saeonly_nimm_scalar_predicate>" "v,<round_saeonly_constraint2>")
4983 (parallel [(const_int 0)]))))]
4984 "TARGET_SSE2 && TARGET_64BIT"
4985 "%vcvttsd2si{q}\t{<round_saeonly_op2>%1, %0|%0, %q1<round_saeonly_op2>}"
4986 [(set_attr "type" "sseicvt")
4987 (set_attr "athlon_decode" "double,vector")
4988 (set_attr "amdfam10_decode" "double,double")
4989 (set_attr "bdver1_decode" "double,double")
4990 (set_attr "prefix_rep" "1")
4991 (set_attr "prefix" "maybe_vex")
4992 (set_attr "mode" "DI")])
4994 ;; For float<si2dfmode><mode>2 insn pattern
4995 (define_mode_attr si2dfmode
4996 [(V8DF "V8SI") (V4DF "V4SI")])
4997 (define_mode_attr si2dfmodelower
4998 [(V8DF "v8si") (V4DF "v4si")])
5000 (define_insn "float<si2dfmodelower><mode>2<mask_name>"
5001 [(set (match_operand:VF2_512_256 0 "register_operand" "=v")
5002 (float:VF2_512_256 (match_operand:<si2dfmode> 1 "nonimmediate_operand" "vm")))]
5003 "TARGET_AVX && <mask_mode512bit_condition>"
5004 "vcvtdq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5005 [(set_attr "type" "ssecvt")
5006 (set_attr "prefix" "maybe_vex")
5007 (set_attr "mode" "<MODE>")])
5009 (define_insn "<floatsuffix>float<sseintvecmodelower><mode>2<mask_name><round_name>"
5010 [(set (match_operand:VF2_AVX512VL 0 "register_operand" "=v")
5011 (any_float:VF2_AVX512VL
5012 (match_operand:<sseintvecmode> 1 "nonimmediate_operand" "<round_constraint>")))]
5014 "vcvt<floatsuffix>qq2pd\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5015 [(set_attr "type" "ssecvt")
5016 (set_attr "prefix" "evex")
5017 (set_attr "mode" "<MODE>")])
5019 ;; For <floatsuffix>float<sselondveclower><mode> insn patterns
5020 (define_mode_attr qq2pssuff
5021 [(V8SF "") (V4SF "{y}")])
5023 (define_mode_attr sselongvecmode
5024 [(V8SF "V8DI") (V4SF "V4DI")])
5026 (define_mode_attr sselongvecmodelower
5027 [(V8SF "v8di") (V4SF "v4di")])
5029 (define_mode_attr sseintvecmode3
5030 [(V8SF "XI") (V4SF "OI")
5031 (V8DF "OI") (V4DF "TI")])
5033 (define_insn "<floatsuffix>float<sselongvecmodelower><mode>2<mask_name><round_name>"
5034 [(set (match_operand:VF1_128_256VL 0 "register_operand" "=v")
5035 (any_float:VF1_128_256VL
5036 (match_operand:<sselongvecmode> 1 "nonimmediate_operand" "<round_constraint>")))]
5037 "TARGET_AVX512DQ && <round_modev8sf_condition>"
5038 "vcvt<floatsuffix>qq2ps<qq2pssuff>\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5039 [(set_attr "type" "ssecvt")
5040 (set_attr "prefix" "evex")
5041 (set_attr "mode" "<MODE>")])
5043 (define_insn "*<floatsuffix>floatv2div2sf2"
5044 [(set (match_operand:V4SF 0 "register_operand" "=v")
5046 (any_float:V2SF (match_operand:V2DI 1 "nonimmediate_operand" "vm"))
5047 (const_vector:V2SF [(const_int 0) (const_int 0)])))]
5048 "TARGET_AVX512DQ && TARGET_AVX512VL"
5049 "vcvt<floatsuffix>qq2ps{x}\t{%1, %0|%0, %1}"
5050 [(set_attr "type" "ssecvt")
5051 (set_attr "prefix" "evex")
5052 (set_attr "mode" "V4SF")])
5054 (define_insn "<floatsuffix>floatv2div2sf2_mask"
5055 [(set (match_operand:V4SF 0 "register_operand" "=v")
5058 (any_float:V2SF (match_operand:V2DI 1 "nonimmediate_operand" "vm"))
5060 (match_operand:V4SF 2 "vector_move_operand" "0C")
5061 (parallel [(const_int 0) (const_int 1)]))
5062 (match_operand:QI 3 "register_operand" "Yk"))
5063 (const_vector:V2SF [(const_int 0) (const_int 0)])))]
5064 "TARGET_AVX512DQ && TARGET_AVX512VL"
5065 "vcvt<floatsuffix>qq2ps{x}\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
5066 [(set_attr "type" "ssecvt")
5067 (set_attr "prefix" "evex")
5068 (set_attr "mode" "V4SF")])
5070 (define_insn "*<floatsuffix>floatv2div2sf2_mask_1"
5071 [(set (match_operand:V4SF 0 "register_operand" "=v")
5074 (any_float:V2SF (match_operand:V2DI 1
5075 "nonimmediate_operand" "vm"))
5076 (const_vector:V2SF [(const_int 0) (const_int 0)])
5077 (match_operand:QI 2 "register_operand" "Yk"))
5078 (const_vector:V2SF [(const_int 0) (const_int 0)])))]
5079 "TARGET_AVX512DQ && TARGET_AVX512VL"
5080 "vcvt<floatsuffix>qq2ps{x}\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
5081 [(set_attr "type" "ssecvt")
5082 (set_attr "prefix" "evex")
5083 (set_attr "mode" "V4SF")])
5085 (define_insn "ufloat<si2dfmodelower><mode>2<mask_name>"
5086 [(set (match_operand:VF2_512_256VL 0 "register_operand" "=v")
5087 (unsigned_float:VF2_512_256VL
5088 (match_operand:<si2dfmode> 1 "nonimmediate_operand" "vm")))]
5090 "vcvtudq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5091 [(set_attr "type" "ssecvt")
5092 (set_attr "prefix" "evex")
5093 (set_attr "mode" "<MODE>")])
5095 (define_insn "ufloatv2siv2df2<mask_name>"
5096 [(set (match_operand:V2DF 0 "register_operand" "=v")
5097 (unsigned_float:V2DF
5099 (match_operand:V4SI 1 "nonimmediate_operand" "vm")
5100 (parallel [(const_int 0) (const_int 1)]))))]
5102 "vcvtudq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
5103 [(set_attr "type" "ssecvt")
5104 (set_attr "prefix" "evex")
5105 (set_attr "mode" "V2DF")])
5107 (define_insn "avx512f_cvtdq2pd512_2"
5108 [(set (match_operand:V8DF 0 "register_operand" "=v")
5111 (match_operand:V16SI 1 "nonimmediate_operand" "vm")
5112 (parallel [(const_int 0) (const_int 1)
5113 (const_int 2) (const_int 3)
5114 (const_int 4) (const_int 5)
5115 (const_int 6) (const_int 7)]))))]
5117 "vcvtdq2pd\t{%t1, %0|%0, %t1}"
5118 [(set_attr "type" "ssecvt")
5119 (set_attr "prefix" "evex")
5120 (set_attr "mode" "V8DF")])
5122 (define_insn "avx_cvtdq2pd256_2"
5123 [(set (match_operand:V4DF 0 "register_operand" "=v")
5126 (match_operand:V8SI 1 "nonimmediate_operand" "vm")
5127 (parallel [(const_int 0) (const_int 1)
5128 (const_int 2) (const_int 3)]))))]
5130 "vcvtdq2pd\t{%x1, %0|%0, %x1}"
5131 [(set_attr "type" "ssecvt")
5132 (set_attr "prefix" "maybe_evex")
5133 (set_attr "mode" "V4DF")])
5135 (define_insn "sse2_cvtdq2pd<mask_name>"
5136 [(set (match_operand:V2DF 0 "register_operand" "=v")
5139 (match_operand:V4SI 1 "nonimmediate_operand" "vm")
5140 (parallel [(const_int 0) (const_int 1)]))))]
5141 "TARGET_SSE2 && <mask_avx512vl_condition>"
5142 "%vcvtdq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
5143 [(set_attr "type" "ssecvt")
5144 (set_attr "prefix" "maybe_vex")
5145 (set_attr "mode" "V2DF")])
5147 (define_insn "avx512f_cvtpd2dq512<mask_name><round_name>"
5148 [(set (match_operand:V8SI 0 "register_operand" "=v")
5150 [(match_operand:V8DF 1 "<round_nimm_predicate>" "<round_constraint>")]
5151 UNSPEC_FIX_NOTRUNC))]
5153 "vcvtpd2dq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5154 [(set_attr "type" "ssecvt")
5155 (set_attr "prefix" "evex")
5156 (set_attr "mode" "OI")])
5158 (define_insn "avx_cvtpd2dq256<mask_name>"
5159 [(set (match_operand:V4SI 0 "register_operand" "=v")
5160 (unspec:V4SI [(match_operand:V4DF 1 "nonimmediate_operand" "vm")]
5161 UNSPEC_FIX_NOTRUNC))]
5162 "TARGET_AVX && <mask_avx512vl_condition>"
5163 "vcvtpd2dq{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5164 [(set_attr "type" "ssecvt")
5165 (set_attr "prefix" "<mask_prefix>")
5166 (set_attr "mode" "OI")])
5168 (define_expand "avx_cvtpd2dq256_2"
5169 [(set (match_operand:V8SI 0 "register_operand")
5171 (unspec:V4SI [(match_operand:V4DF 1 "nonimmediate_operand")]
5175 "operands[2] = CONST0_RTX (V4SImode);")
5177 (define_insn "*avx_cvtpd2dq256_2"
5178 [(set (match_operand:V8SI 0 "register_operand" "=v")
5180 (unspec:V4SI [(match_operand:V4DF 1 "nonimmediate_operand" "vm")]
5182 (match_operand:V4SI 2 "const0_operand")))]
5184 "vcvtpd2dq{y}\t{%1, %x0|%x0, %1}"
5185 [(set_attr "type" "ssecvt")
5186 (set_attr "prefix" "vex")
5187 (set_attr "btver2_decode" "vector")
5188 (set_attr "mode" "OI")])
5190 (define_insn "sse2_cvtpd2dq<mask_name>"
5191 [(set (match_operand:V4SI 0 "register_operand" "=v")
5193 (unspec:V2SI [(match_operand:V2DF 1 "vector_operand" "vBm")]
5195 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
5196 "TARGET_SSE2 && <mask_avx512vl_condition>"
5199 return "vcvtpd2dq{x}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}";
5201 return "cvtpd2dq\t{%1, %0|%0, %1}";
5203 [(set_attr "type" "ssecvt")
5204 (set_attr "prefix_rep" "1")
5205 (set_attr "prefix_data16" "0")
5206 (set_attr "prefix" "maybe_vex")
5207 (set_attr "mode" "TI")
5208 (set_attr "amdfam10_decode" "double")
5209 (set_attr "athlon_decode" "vector")
5210 (set_attr "bdver1_decode" "double")])
5212 ;; For ufix_notrunc* insn patterns
5213 (define_mode_attr pd2udqsuff
5214 [(V8DF "") (V4DF "{y}")])
5216 (define_insn "ufix_notrunc<mode><si2dfmodelower>2<mask_name><round_name>"
5217 [(set (match_operand:<si2dfmode> 0 "register_operand" "=v")
5219 [(match_operand:VF2_512_256VL 1 "nonimmediate_operand" "<round_constraint>")]
5220 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
5222 "vcvtpd2udq<pd2udqsuff>\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5223 [(set_attr "type" "ssecvt")
5224 (set_attr "prefix" "evex")
5225 (set_attr "mode" "<sseinsnmode>")])
5227 (define_insn "ufix_notruncv2dfv2si2<mask_name>"
5228 [(set (match_operand:V4SI 0 "register_operand" "=v")
5231 [(match_operand:V2DF 1 "nonimmediate_operand" "vm")]
5232 UNSPEC_UNSIGNED_FIX_NOTRUNC)
5233 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
5235 "vcvtpd2udq{x}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5236 [(set_attr "type" "ssecvt")
5237 (set_attr "prefix" "evex")
5238 (set_attr "mode" "TI")])
5240 (define_insn "<fixsuffix>fix_truncv8dfv8si2<mask_name><round_saeonly_name>"
5241 [(set (match_operand:V8SI 0 "register_operand" "=v")
5243 (match_operand:V8DF 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
5245 "vcvttpd2<fixsuffix>dq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
5246 [(set_attr "type" "ssecvt")
5247 (set_attr "prefix" "evex")
5248 (set_attr "mode" "OI")])
5250 (define_insn "ufix_truncv2dfv2si2<mask_name>"
5251 [(set (match_operand:V4SI 0 "register_operand" "=v")
5253 (unsigned_fix:V2SI (match_operand:V2DF 1 "nonimmediate_operand" "vm"))
5254 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
5256 "vcvttpd2udq{x}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5257 [(set_attr "type" "ssecvt")
5258 (set_attr "prefix" "evex")
5259 (set_attr "mode" "TI")])
5261 (define_insn "fix_truncv4dfv4si2<mask_name>"
5262 [(set (match_operand:V4SI 0 "register_operand" "=v")
5263 (fix:V4SI (match_operand:V4DF 1 "nonimmediate_operand" "vm")))]
5264 "TARGET_AVX || (TARGET_AVX512VL && TARGET_AVX512F)"
5265 "vcvttpd2dq{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5266 [(set_attr "type" "ssecvt")
5267 (set_attr "prefix" "maybe_evex")
5268 (set_attr "mode" "OI")])
5270 (define_insn "ufix_truncv4dfv4si2<mask_name>"
5271 [(set (match_operand:V4SI 0 "register_operand" "=v")
5272 (unsigned_fix:V4SI (match_operand:V4DF 1 "nonimmediate_operand" "vm")))]
5273 "TARGET_AVX512VL && TARGET_AVX512F"
5274 "vcvttpd2udq{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5275 [(set_attr "type" "ssecvt")
5276 (set_attr "prefix" "maybe_evex")
5277 (set_attr "mode" "OI")])
5279 (define_insn "<fixsuffix>fix_trunc<mode><sseintvecmodelower>2<mask_name><round_saeonly_name>"
5280 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
5281 (any_fix:<sseintvecmode>
5282 (match_operand:VF2_AVX512VL 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
5283 "TARGET_AVX512DQ && <round_saeonly_mode512bit_condition>"
5284 "vcvttpd2<fixsuffix>qq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
5285 [(set_attr "type" "ssecvt")
5286 (set_attr "prefix" "evex")
5287 (set_attr "mode" "<sseintvecmode2>")])
5289 (define_insn "fix_notrunc<mode><sseintvecmodelower>2<mask_name><round_name>"
5290 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
5291 (unspec:<sseintvecmode>
5292 [(match_operand:VF2_AVX512VL 1 "<round_nimm_predicate>" "<round_constraint>")]
5293 UNSPEC_FIX_NOTRUNC))]
5294 "TARGET_AVX512DQ && <round_mode512bit_condition>"
5295 "vcvtpd2qq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5296 [(set_attr "type" "ssecvt")
5297 (set_attr "prefix" "evex")
5298 (set_attr "mode" "<sseintvecmode2>")])
5300 (define_insn "ufix_notrunc<mode><sseintvecmodelower>2<mask_name><round_name>"
5301 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
5302 (unspec:<sseintvecmode>
5303 [(match_operand:VF2_AVX512VL 1 "nonimmediate_operand" "<round_constraint>")]
5304 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
5305 "TARGET_AVX512DQ && <round_mode512bit_condition>"
5306 "vcvtpd2uqq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5307 [(set_attr "type" "ssecvt")
5308 (set_attr "prefix" "evex")
5309 (set_attr "mode" "<sseintvecmode2>")])
5311 (define_insn "<fixsuffix>fix_trunc<mode><sselongvecmodelower>2<mask_name><round_saeonly_name>"
5312 [(set (match_operand:<sselongvecmode> 0 "register_operand" "=v")
5313 (any_fix:<sselongvecmode>
5314 (match_operand:VF1_128_256VL 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
5315 "TARGET_AVX512DQ && <round_saeonly_modev8sf_condition>"
5316 "vcvttps2<fixsuffix>qq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
5317 [(set_attr "type" "ssecvt")
5318 (set_attr "prefix" "evex")
5319 (set_attr "mode" "<sseintvecmode3>")])
5321 (define_insn "<fixsuffix>fix_truncv2sfv2di2<mask_name>"
5322 [(set (match_operand:V2DI 0 "register_operand" "=v")
5325 (match_operand:V4SF 1 "nonimmediate_operand" "vm")
5326 (parallel [(const_int 0) (const_int 1)]))))]
5327 "TARGET_AVX512DQ && TARGET_AVX512VL"
5328 "vcvttps2<fixsuffix>qq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
5329 [(set_attr "type" "ssecvt")
5330 (set_attr "prefix" "evex")
5331 (set_attr "mode" "TI")])
5333 (define_insn "ufix_trunc<mode><sseintvecmodelower>2<mask_name>"
5334 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
5335 (unsigned_fix:<sseintvecmode>
5336 (match_operand:VF1_128_256VL 1 "nonimmediate_operand" "vm")))]
5338 "vcvttps2udq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5339 [(set_attr "type" "ssecvt")
5340 (set_attr "prefix" "evex")
5341 (set_attr "mode" "<sseintvecmode2>")])
5343 (define_expand "avx_cvttpd2dq256_2"
5344 [(set (match_operand:V8SI 0 "register_operand")
5346 (fix:V4SI (match_operand:V4DF 1 "nonimmediate_operand"))
5349 "operands[2] = CONST0_RTX (V4SImode);")
5351 (define_insn "sse2_cvttpd2dq<mask_name>"
5352 [(set (match_operand:V4SI 0 "register_operand" "=v")
5354 (fix:V2SI (match_operand:V2DF 1 "vector_operand" "vBm"))
5355 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
5356 "TARGET_SSE2 && <mask_avx512vl_condition>"
5359 return "vcvttpd2dq{x}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}";
5361 return "cvttpd2dq\t{%1, %0|%0, %1}";
5363 [(set_attr "type" "ssecvt")
5364 (set_attr "amdfam10_decode" "double")
5365 (set_attr "athlon_decode" "vector")
5366 (set_attr "bdver1_decode" "double")
5367 (set_attr "prefix" "maybe_vex")
5368 (set_attr "mode" "TI")])
5370 (define_insn "sse2_cvtsd2ss<round_name>"
5371 [(set (match_operand:V4SF 0 "register_operand" "=x,x,v")
5374 (float_truncate:V2SF
5375 (match_operand:V2DF 2 "nonimmediate_operand" "x,m,<round_constraint>")))
5376 (match_operand:V4SF 1 "register_operand" "0,0,v")
5380 cvtsd2ss\t{%2, %0|%0, %2}
5381 cvtsd2ss\t{%2, %0|%0, %q2}
5382 vcvtsd2ss\t{<round_op3>%2, %1, %0|%0, %1, %q2<round_op3>}"
5383 [(set_attr "isa" "noavx,noavx,avx")
5384 (set_attr "type" "ssecvt")
5385 (set_attr "athlon_decode" "vector,double,*")
5386 (set_attr "amdfam10_decode" "vector,double,*")
5387 (set_attr "bdver1_decode" "direct,direct,*")
5388 (set_attr "btver2_decode" "double,double,double")
5389 (set_attr "prefix" "orig,orig,<round_prefix>")
5390 (set_attr "mode" "SF")])
5392 (define_insn "*sse2_vd_cvtsd2ss"
5393 [(set (match_operand:V4SF 0 "register_operand" "=x,x,v")
5396 (float_truncate:SF (match_operand:DF 2 "nonimmediate_operand" "x,m,vm")))
5397 (match_operand:V4SF 1 "register_operand" "0,0,v")
5401 cvtsd2ss\t{%2, %0|%0, %2}
5402 cvtsd2ss\t{%2, %0|%0, %2}
5403 vcvtsd2ss\t{%2, %1, %0|%0, %1, %2}"
5404 [(set_attr "isa" "noavx,noavx,avx")
5405 (set_attr "type" "ssecvt")
5406 (set_attr "athlon_decode" "vector,double,*")
5407 (set_attr "amdfam10_decode" "vector,double,*")
5408 (set_attr "bdver1_decode" "direct,direct,*")
5409 (set_attr "btver2_decode" "double,double,double")
5410 (set_attr "prefix" "orig,orig,vex")
5411 (set_attr "mode" "SF")])
5413 (define_insn "sse2_cvtss2sd<round_saeonly_name>"
5414 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
5418 (match_operand:V4SF 2 "<round_saeonly_nimm_scalar_predicate>" "x,m,<round_saeonly_constraint>")
5419 (parallel [(const_int 0) (const_int 1)])))
5420 (match_operand:V2DF 1 "register_operand" "0,0,v")
5424 cvtss2sd\t{%2, %0|%0, %2}
5425 cvtss2sd\t{%2, %0|%0, %k2}
5426 vcvtss2sd\t{<round_saeonly_op3>%2, %1, %0|%0, %1, %k2<round_saeonly_op3>}"
5427 [(set_attr "isa" "noavx,noavx,avx")
5428 (set_attr "type" "ssecvt")
5429 (set_attr "amdfam10_decode" "vector,double,*")
5430 (set_attr "athlon_decode" "direct,direct,*")
5431 (set_attr "bdver1_decode" "direct,direct,*")
5432 (set_attr "btver2_decode" "double,double,double")
5433 (set_attr "prefix" "orig,orig,<round_saeonly_prefix>")
5434 (set_attr "mode" "DF")])
5436 (define_insn "*sse2_vd_cvtss2sd"
5437 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
5440 (float_extend:DF (match_operand:SF 2 "nonimmediate_operand" "x,m,vm")))
5441 (match_operand:V2DF 1 "register_operand" "0,0,v")
5445 cvtss2sd\t{%2, %0|%0, %2}
5446 cvtss2sd\t{%2, %0|%0, %2}
5447 vcvtss2sd\t{%2, %1, %0|%0, %1, %2}"
5448 [(set_attr "isa" "noavx,noavx,avx")
5449 (set_attr "type" "ssecvt")
5450 (set_attr "amdfam10_decode" "vector,double,*")
5451 (set_attr "athlon_decode" "direct,direct,*")
5452 (set_attr "bdver1_decode" "direct,direct,*")
5453 (set_attr "btver2_decode" "double,double,double")
5454 (set_attr "prefix" "orig,orig,vex")
5455 (set_attr "mode" "DF")])
5457 (define_insn "<mask_codefor>avx512f_cvtpd2ps512<mask_name><round_name>"
5458 [(set (match_operand:V8SF 0 "register_operand" "=v")
5459 (float_truncate:V8SF
5460 (match_operand:V8DF 1 "<round_nimm_predicate>" "<round_constraint>")))]
5462 "vcvtpd2ps\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5463 [(set_attr "type" "ssecvt")
5464 (set_attr "prefix" "evex")
5465 (set_attr "mode" "V8SF")])
5467 (define_insn "avx_cvtpd2ps256<mask_name>"
5468 [(set (match_operand:V4SF 0 "register_operand" "=v")
5469 (float_truncate:V4SF
5470 (match_operand:V4DF 1 "nonimmediate_operand" "vm")))]
5471 "TARGET_AVX && <mask_avx512vl_condition>"
5472 "vcvtpd2ps{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5473 [(set_attr "type" "ssecvt")
5474 (set_attr "prefix" "maybe_evex")
5475 (set_attr "btver2_decode" "vector")
5476 (set_attr "mode" "V4SF")])
5478 (define_expand "sse2_cvtpd2ps"
5479 [(set (match_operand:V4SF 0 "register_operand")
5481 (float_truncate:V2SF
5482 (match_operand:V2DF 1 "vector_operand"))
5485 "operands[2] = CONST0_RTX (V2SFmode);")
5487 (define_expand "sse2_cvtpd2ps_mask"
5488 [(set (match_operand:V4SF 0 "register_operand")
5491 (float_truncate:V2SF
5492 (match_operand:V2DF 1 "vector_operand"))
5494 (match_operand:V4SF 2 "register_operand")
5495 (match_operand:QI 3 "register_operand")))]
5497 "operands[4] = CONST0_RTX (V2SFmode);")
5499 (define_insn "*sse2_cvtpd2ps<mask_name>"
5500 [(set (match_operand:V4SF 0 "register_operand" "=v")
5502 (float_truncate:V2SF
5503 (match_operand:V2DF 1 "vector_operand" "vBm"))
5504 (match_operand:V2SF 2 "const0_operand")))]
5505 "TARGET_SSE2 && <mask_avx512vl_condition>"
5508 return "vcvtpd2ps{x}\t{%1, %0<mask_operand3>|%0<mask_operand3>, %1}";
5510 return "cvtpd2ps\t{%1, %0|%0, %1}";
5512 [(set_attr "type" "ssecvt")
5513 (set_attr "amdfam10_decode" "double")
5514 (set_attr "athlon_decode" "vector")
5515 (set_attr "bdver1_decode" "double")
5516 (set_attr "prefix_data16" "1")
5517 (set_attr "prefix" "maybe_vex")
5518 (set_attr "mode" "V4SF")])
5520 ;; For <sse2_avx_avx512f>_cvtps2pd<avxsizesuffix> insn pattern
5521 (define_mode_attr sf2dfmode
5522 [(V8DF "V8SF") (V4DF "V4SF")])
5524 (define_insn "<sse2_avx_avx512f>_cvtps2pd<avxsizesuffix><mask_name><round_saeonly_name>"
5525 [(set (match_operand:VF2_512_256 0 "register_operand" "=v")
5526 (float_extend:VF2_512_256
5527 (match_operand:<sf2dfmode> 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
5528 "TARGET_AVX && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
5529 "vcvtps2pd\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
5530 [(set_attr "type" "ssecvt")
5531 (set_attr "prefix" "maybe_vex")
5532 (set_attr "mode" "<MODE>")])
5534 (define_insn "*avx_cvtps2pd256_2"
5535 [(set (match_operand:V4DF 0 "register_operand" "=v")
5538 (match_operand:V8SF 1 "nonimmediate_operand" "vm")
5539 (parallel [(const_int 0) (const_int 1)
5540 (const_int 2) (const_int 3)]))))]
5542 "vcvtps2pd\t{%x1, %0|%0, %x1}"
5543 [(set_attr "type" "ssecvt")
5544 (set_attr "prefix" "vex")
5545 (set_attr "mode" "V4DF")])
5547 (define_insn "vec_unpacks_lo_v16sf"
5548 [(set (match_operand:V8DF 0 "register_operand" "=v")
5551 (match_operand:V16SF 1 "nonimmediate_operand" "vm")
5552 (parallel [(const_int 0) (const_int 1)
5553 (const_int 2) (const_int 3)
5554 (const_int 4) (const_int 5)
5555 (const_int 6) (const_int 7)]))))]
5557 "vcvtps2pd\t{%t1, %0|%0, %t1}"
5558 [(set_attr "type" "ssecvt")
5559 (set_attr "prefix" "evex")
5560 (set_attr "mode" "V8DF")])
5562 (define_insn "<avx512>_cvt<ssemodesuffix>2mask<mode>"
5563 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
5564 (unspec:<avx512fmaskmode>
5565 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")]
5566 UNSPEC_CVTINT2MASK))]
5568 "vpmov<ssemodesuffix>2m\t{%1, %0|%0, %1}"
5569 [(set_attr "prefix" "evex")
5570 (set_attr "mode" "<sseinsnmode>")])
5572 (define_insn "<avx512>_cvt<ssemodesuffix>2mask<mode>"
5573 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
5574 (unspec:<avx512fmaskmode>
5575 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")]
5576 UNSPEC_CVTINT2MASK))]
5578 "vpmov<ssemodesuffix>2m\t{%1, %0|%0, %1}"
5579 [(set_attr "prefix" "evex")
5580 (set_attr "mode" "<sseinsnmode>")])
5582 (define_expand "<avx512>_cvtmask2<ssemodesuffix><mode>"
5583 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
5584 (vec_merge:VI12_AVX512VL
5587 (match_operand:<avx512fmaskmode> 1 "register_operand")))]
5590 operands[2] = CONSTM1_RTX (<MODE>mode);
5591 operands[3] = CONST0_RTX (<MODE>mode);
5594 (define_insn "*<avx512>_cvtmask2<ssemodesuffix><mode>"
5595 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
5596 (vec_merge:VI12_AVX512VL
5597 (match_operand:VI12_AVX512VL 2 "vector_all_ones_operand")
5598 (match_operand:VI12_AVX512VL 3 "const0_operand")
5599 (match_operand:<avx512fmaskmode> 1 "register_operand" "Yk")))]
5601 "vpmovm2<ssemodesuffix>\t{%1, %0|%0, %1}"
5602 [(set_attr "prefix" "evex")
5603 (set_attr "mode" "<sseinsnmode>")])
5605 (define_expand "<avx512>_cvtmask2<ssemodesuffix><mode>"
5606 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
5607 (vec_merge:VI48_AVX512VL
5610 (match_operand:<avx512fmaskmode> 1 "register_operand")))]
5613 operands[2] = CONSTM1_RTX (<MODE>mode);
5614 operands[3] = CONST0_RTX (<MODE>mode);
5617 (define_insn "*<avx512>_cvtmask2<ssemodesuffix><mode>"
5618 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
5619 (vec_merge:VI48_AVX512VL
5620 (match_operand:VI48_AVX512VL 2 "vector_all_ones_operand")
5621 (match_operand:VI48_AVX512VL 3 "const0_operand")
5622 (match_operand:<avx512fmaskmode> 1 "register_operand" "Yk")))]
5624 "vpmovm2<ssemodesuffix>\t{%1, %0|%0, %1}"
5625 [(set_attr "prefix" "evex")
5626 (set_attr "mode" "<sseinsnmode>")])
5628 (define_insn "sse2_cvtps2pd<mask_name>"
5629 [(set (match_operand:V2DF 0 "register_operand" "=v")
5632 (match_operand:V4SF 1 "vector_operand" "vm")
5633 (parallel [(const_int 0) (const_int 1)]))))]
5634 "TARGET_SSE2 && <mask_avx512vl_condition>"
5635 "%vcvtps2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
5636 [(set_attr "type" "ssecvt")
5637 (set_attr "amdfam10_decode" "direct")
5638 (set_attr "athlon_decode" "double")
5639 (set_attr "bdver1_decode" "double")
5640 (set_attr "prefix_data16" "0")
5641 (set_attr "prefix" "maybe_vex")
5642 (set_attr "mode" "V2DF")])
5644 (define_expand "vec_unpacks_hi_v4sf"
5649 (match_operand:V4SF 1 "vector_operand"))
5650 (parallel [(const_int 6) (const_int 7)
5651 (const_int 2) (const_int 3)])))
5652 (set (match_operand:V2DF 0 "register_operand")
5656 (parallel [(const_int 0) (const_int 1)]))))]
5658 "operands[2] = gen_reg_rtx (V4SFmode);")
5660 (define_expand "vec_unpacks_hi_v8sf"
5663 (match_operand:V8SF 1 "register_operand")
5664 (parallel [(const_int 4) (const_int 5)
5665 (const_int 6) (const_int 7)])))
5666 (set (match_operand:V4DF 0 "register_operand")
5670 "operands[2] = gen_reg_rtx (V4SFmode);")
5672 (define_expand "vec_unpacks_hi_v16sf"
5675 (match_operand:V16SF 1 "register_operand")
5676 (parallel [(const_int 8) (const_int 9)
5677 (const_int 10) (const_int 11)
5678 (const_int 12) (const_int 13)
5679 (const_int 14) (const_int 15)])))
5680 (set (match_operand:V8DF 0 "register_operand")
5684 "operands[2] = gen_reg_rtx (V8SFmode);")
5686 (define_expand "vec_unpacks_lo_v4sf"
5687 [(set (match_operand:V2DF 0 "register_operand")
5690 (match_operand:V4SF 1 "vector_operand")
5691 (parallel [(const_int 0) (const_int 1)]))))]
5694 (define_expand "vec_unpacks_lo_v8sf"
5695 [(set (match_operand:V4DF 0 "register_operand")
5698 (match_operand:V8SF 1 "nonimmediate_operand")
5699 (parallel [(const_int 0) (const_int 1)
5700 (const_int 2) (const_int 3)]))))]
5703 (define_mode_attr sseunpackfltmode
5704 [(V8HI "V4SF") (V4SI "V2DF") (V16HI "V8SF")
5705 (V8SI "V4DF") (V32HI "V16SF") (V16SI "V8DF")])
5707 (define_expand "vec_unpacks_float_hi_<mode>"
5708 [(match_operand:<sseunpackfltmode> 0 "register_operand")
5709 (match_operand:VI2_AVX512F 1 "register_operand")]
5712 rtx tmp = gen_reg_rtx (<sseunpackmode>mode);
5714 emit_insn (gen_vec_unpacks_hi_<mode> (tmp, operands[1]));
5715 emit_insn (gen_rtx_SET (operands[0],
5716 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
5720 (define_expand "vec_unpacks_float_lo_<mode>"
5721 [(match_operand:<sseunpackfltmode> 0 "register_operand")
5722 (match_operand:VI2_AVX512F 1 "register_operand")]
5725 rtx tmp = gen_reg_rtx (<sseunpackmode>mode);
5727 emit_insn (gen_vec_unpacks_lo_<mode> (tmp, operands[1]));
5728 emit_insn (gen_rtx_SET (operands[0],
5729 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
5733 (define_expand "vec_unpacku_float_hi_<mode>"
5734 [(match_operand:<sseunpackfltmode> 0 "register_operand")
5735 (match_operand:VI2_AVX512F 1 "register_operand")]
5738 rtx tmp = gen_reg_rtx (<sseunpackmode>mode);
5740 emit_insn (gen_vec_unpacku_hi_<mode> (tmp, operands[1]));
5741 emit_insn (gen_rtx_SET (operands[0],
5742 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
5746 (define_expand "vec_unpacku_float_lo_<mode>"
5747 [(match_operand:<sseunpackfltmode> 0 "register_operand")
5748 (match_operand:VI2_AVX512F 1 "register_operand")]
5751 rtx tmp = gen_reg_rtx (<sseunpackmode>mode);
5753 emit_insn (gen_vec_unpacku_lo_<mode> (tmp, operands[1]));
5754 emit_insn (gen_rtx_SET (operands[0],
5755 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
5759 (define_expand "vec_unpacks_float_hi_v4si"
5762 (match_operand:V4SI 1 "vector_operand")
5763 (parallel [(const_int 2) (const_int 3)
5764 (const_int 2) (const_int 3)])))
5765 (set (match_operand:V2DF 0 "register_operand")
5769 (parallel [(const_int 0) (const_int 1)]))))]
5771 "operands[2] = gen_reg_rtx (V4SImode);")
5773 (define_expand "vec_unpacks_float_lo_v4si"
5774 [(set (match_operand:V2DF 0 "register_operand")
5777 (match_operand:V4SI 1 "vector_operand")
5778 (parallel [(const_int 0) (const_int 1)]))))]
5781 (define_expand "vec_unpacks_float_hi_v8si"
5784 (match_operand:V8SI 1 "vector_operand")
5785 (parallel [(const_int 4) (const_int 5)
5786 (const_int 6) (const_int 7)])))
5787 (set (match_operand:V4DF 0 "register_operand")
5791 "operands[2] = gen_reg_rtx (V4SImode);")
5793 (define_expand "vec_unpacks_float_lo_v8si"
5794 [(set (match_operand:V4DF 0 "register_operand")
5797 (match_operand:V8SI 1 "nonimmediate_operand")
5798 (parallel [(const_int 0) (const_int 1)
5799 (const_int 2) (const_int 3)]))))]
5802 (define_expand "vec_unpacks_float_hi_v16si"
5805 (match_operand:V16SI 1 "nonimmediate_operand")
5806 (parallel [(const_int 8) (const_int 9)
5807 (const_int 10) (const_int 11)
5808 (const_int 12) (const_int 13)
5809 (const_int 14) (const_int 15)])))
5810 (set (match_operand:V8DF 0 "register_operand")
5814 "operands[2] = gen_reg_rtx (V8SImode);")
5816 (define_expand "vec_unpacks_float_lo_v16si"
5817 [(set (match_operand:V8DF 0 "register_operand")
5820 (match_operand:V16SI 1 "nonimmediate_operand")
5821 (parallel [(const_int 0) (const_int 1)
5822 (const_int 2) (const_int 3)
5823 (const_int 4) (const_int 5)
5824 (const_int 6) (const_int 7)]))))]
5827 (define_expand "vec_unpacku_float_hi_v4si"
5830 (match_operand:V4SI 1 "vector_operand")
5831 (parallel [(const_int 2) (const_int 3)
5832 (const_int 2) (const_int 3)])))
5837 (parallel [(const_int 0) (const_int 1)]))))
5839 (lt:V2DF (match_dup 6) (match_dup 3)))
5841 (and:V2DF (match_dup 7) (match_dup 4)))
5842 (set (match_operand:V2DF 0 "register_operand")
5843 (plus:V2DF (match_dup 6) (match_dup 8)))]
5846 REAL_VALUE_TYPE TWO32r;
5850 real_ldexp (&TWO32r, &dconst1, 32);
5851 x = const_double_from_real_value (TWO32r, DFmode);
5853 operands[3] = force_reg (V2DFmode, CONST0_RTX (V2DFmode));
5854 operands[4] = force_reg (V2DFmode,
5855 ix86_build_const_vector (V2DFmode, 1, x));
5857 operands[5] = gen_reg_rtx (V4SImode);
5859 for (i = 6; i < 9; i++)
5860 operands[i] = gen_reg_rtx (V2DFmode);
5863 (define_expand "vec_unpacku_float_lo_v4si"
5867 (match_operand:V4SI 1 "vector_operand")
5868 (parallel [(const_int 0) (const_int 1)]))))
5870 (lt:V2DF (match_dup 5) (match_dup 3)))
5872 (and:V2DF (match_dup 6) (match_dup 4)))
5873 (set (match_operand:V2DF 0 "register_operand")
5874 (plus:V2DF (match_dup 5) (match_dup 7)))]
5877 REAL_VALUE_TYPE TWO32r;
5881 real_ldexp (&TWO32r, &dconst1, 32);
5882 x = const_double_from_real_value (TWO32r, DFmode);
5884 operands[3] = force_reg (V2DFmode, CONST0_RTX (V2DFmode));
5885 operands[4] = force_reg (V2DFmode,
5886 ix86_build_const_vector (V2DFmode, 1, x));
5888 for (i = 5; i < 8; i++)
5889 operands[i] = gen_reg_rtx (V2DFmode);
5892 (define_expand "vec_unpacku_float_hi_v8si"
5893 [(match_operand:V4DF 0 "register_operand")
5894 (match_operand:V8SI 1 "register_operand")]
5897 REAL_VALUE_TYPE TWO32r;
5901 real_ldexp (&TWO32r, &dconst1, 32);
5902 x = const_double_from_real_value (TWO32r, DFmode);
5904 tmp[0] = force_reg (V4DFmode, CONST0_RTX (V4DFmode));
5905 tmp[1] = force_reg (V4DFmode, ix86_build_const_vector (V4DFmode, 1, x));
5906 tmp[5] = gen_reg_rtx (V4SImode);
5908 for (i = 2; i < 5; i++)
5909 tmp[i] = gen_reg_rtx (V4DFmode);
5910 emit_insn (gen_vec_extract_hi_v8si (tmp[5], operands[1]));
5911 emit_insn (gen_floatv4siv4df2 (tmp[2], tmp[5]));
5912 emit_insn (gen_rtx_SET (tmp[3], gen_rtx_LT (V4DFmode, tmp[2], tmp[0])));
5913 emit_insn (gen_andv4df3 (tmp[4], tmp[3], tmp[1]));
5914 emit_insn (gen_addv4df3 (operands[0], tmp[2], tmp[4]));
5918 (define_expand "vec_unpacku_float_hi_v16si"
5919 [(match_operand:V8DF 0 "register_operand")
5920 (match_operand:V16SI 1 "register_operand")]
5923 REAL_VALUE_TYPE TWO32r;
5926 real_ldexp (&TWO32r, &dconst1, 32);
5927 x = const_double_from_real_value (TWO32r, DFmode);
5929 tmp[0] = force_reg (V8DFmode, CONST0_RTX (V8DFmode));
5930 tmp[1] = force_reg (V8DFmode, ix86_build_const_vector (V8DFmode, 1, x));
5931 tmp[2] = gen_reg_rtx (V8DFmode);
5932 tmp[3] = gen_reg_rtx (V8SImode);
5933 k = gen_reg_rtx (QImode);
5935 emit_insn (gen_vec_extract_hi_v16si (tmp[3], operands[1]));
5936 emit_insn (gen_floatv8siv8df2 (tmp[2], tmp[3]));
5937 emit_insn (gen_rtx_SET (k, gen_rtx_LT (QImode, tmp[2], tmp[0])));
5938 emit_insn (gen_addv8df3_mask (tmp[2], tmp[2], tmp[1], tmp[2], k));
5939 emit_move_insn (operands[0], tmp[2]);
5943 (define_expand "vec_unpacku_float_lo_v8si"
5944 [(match_operand:V4DF 0 "register_operand")
5945 (match_operand:V8SI 1 "nonimmediate_operand")]
5948 REAL_VALUE_TYPE TWO32r;
5952 real_ldexp (&TWO32r, &dconst1, 32);
5953 x = const_double_from_real_value (TWO32r, DFmode);
5955 tmp[0] = force_reg (V4DFmode, CONST0_RTX (V4DFmode));
5956 tmp[1] = force_reg (V4DFmode, ix86_build_const_vector (V4DFmode, 1, x));
5958 for (i = 2; i < 5; i++)
5959 tmp[i] = gen_reg_rtx (V4DFmode);
5960 emit_insn (gen_avx_cvtdq2pd256_2 (tmp[2], operands[1]));
5961 emit_insn (gen_rtx_SET (tmp[3], gen_rtx_LT (V4DFmode, tmp[2], tmp[0])));
5962 emit_insn (gen_andv4df3 (tmp[4], tmp[3], tmp[1]));
5963 emit_insn (gen_addv4df3 (operands[0], tmp[2], tmp[4]));
5967 (define_expand "vec_unpacku_float_lo_v16si"
5968 [(match_operand:V8DF 0 "register_operand")
5969 (match_operand:V16SI 1 "nonimmediate_operand")]
5972 REAL_VALUE_TYPE TWO32r;
5975 real_ldexp (&TWO32r, &dconst1, 32);
5976 x = const_double_from_real_value (TWO32r, DFmode);
5978 tmp[0] = force_reg (V8DFmode, CONST0_RTX (V8DFmode));
5979 tmp[1] = force_reg (V8DFmode, ix86_build_const_vector (V8DFmode, 1, x));
5980 tmp[2] = gen_reg_rtx (V8DFmode);
5981 k = gen_reg_rtx (QImode);
5983 emit_insn (gen_avx512f_cvtdq2pd512_2 (tmp[2], operands[1]));
5984 emit_insn (gen_rtx_SET (k, gen_rtx_LT (QImode, tmp[2], tmp[0])));
5985 emit_insn (gen_addv8df3_mask (tmp[2], tmp[2], tmp[1], tmp[2], k));
5986 emit_move_insn (operands[0], tmp[2]);
5990 (define_expand "vec_pack_trunc_<mode>"
5992 (float_truncate:<sf2dfmode>
5993 (match_operand:VF2_512_256 1 "nonimmediate_operand")))
5995 (float_truncate:<sf2dfmode>
5996 (match_operand:VF2_512_256 2 "nonimmediate_operand")))
5997 (set (match_operand:<ssePSmode> 0 "register_operand")
5998 (vec_concat:<ssePSmode>
6003 operands[3] = gen_reg_rtx (<sf2dfmode>mode);
6004 operands[4] = gen_reg_rtx (<sf2dfmode>mode);
6007 (define_expand "vec_pack_trunc_v2df"
6008 [(match_operand:V4SF 0 "register_operand")
6009 (match_operand:V2DF 1 "vector_operand")
6010 (match_operand:V2DF 2 "vector_operand")]
6015 if (TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
6017 tmp0 = gen_reg_rtx (V4DFmode);
6018 tmp1 = force_reg (V2DFmode, operands[1]);
6020 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
6021 emit_insn (gen_avx_cvtpd2ps256 (operands[0], tmp0));
6025 tmp0 = gen_reg_rtx (V4SFmode);
6026 tmp1 = gen_reg_rtx (V4SFmode);
6028 emit_insn (gen_sse2_cvtpd2ps (tmp0, operands[1]));
6029 emit_insn (gen_sse2_cvtpd2ps (tmp1, operands[2]));
6030 emit_insn (gen_sse_movlhps (operands[0], tmp0, tmp1));
6035 (define_expand "vec_pack_sfix_trunc_v8df"
6036 [(match_operand:V16SI 0 "register_operand")
6037 (match_operand:V8DF 1 "nonimmediate_operand")
6038 (match_operand:V8DF 2 "nonimmediate_operand")]
6043 r1 = gen_reg_rtx (V8SImode);
6044 r2 = gen_reg_rtx (V8SImode);
6046 emit_insn (gen_fix_truncv8dfv8si2 (r1, operands[1]));
6047 emit_insn (gen_fix_truncv8dfv8si2 (r2, operands[2]));
6048 emit_insn (gen_avx_vec_concatv16si (operands[0], r1, r2));
6052 (define_expand "vec_pack_sfix_trunc_v4df"
6053 [(match_operand:V8SI 0 "register_operand")
6054 (match_operand:V4DF 1 "nonimmediate_operand")
6055 (match_operand:V4DF 2 "nonimmediate_operand")]
6060 r1 = gen_reg_rtx (V4SImode);
6061 r2 = gen_reg_rtx (V4SImode);
6063 emit_insn (gen_fix_truncv4dfv4si2 (r1, operands[1]));
6064 emit_insn (gen_fix_truncv4dfv4si2 (r2, operands[2]));
6065 emit_insn (gen_avx_vec_concatv8si (operands[0], r1, r2));
6069 (define_expand "vec_pack_sfix_trunc_v2df"
6070 [(match_operand:V4SI 0 "register_operand")
6071 (match_operand:V2DF 1 "vector_operand")
6072 (match_operand:V2DF 2 "vector_operand")]
6075 rtx tmp0, tmp1, tmp2;
6077 if (TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
6079 tmp0 = gen_reg_rtx (V4DFmode);
6080 tmp1 = force_reg (V2DFmode, operands[1]);
6082 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
6083 emit_insn (gen_fix_truncv4dfv4si2 (operands[0], tmp0));
6087 tmp0 = gen_reg_rtx (V4SImode);
6088 tmp1 = gen_reg_rtx (V4SImode);
6089 tmp2 = gen_reg_rtx (V2DImode);
6091 emit_insn (gen_sse2_cvttpd2dq (tmp0, operands[1]));
6092 emit_insn (gen_sse2_cvttpd2dq (tmp1, operands[2]));
6093 emit_insn (gen_vec_interleave_lowv2di (tmp2,
6094 gen_lowpart (V2DImode, tmp0),
6095 gen_lowpart (V2DImode, tmp1)));
6096 emit_move_insn (operands[0], gen_lowpart (V4SImode, tmp2));
6101 (define_mode_attr ssepackfltmode
6102 [(V8DF "V16SI") (V4DF "V8SI") (V2DF "V4SI")])
6104 (define_expand "vec_pack_ufix_trunc_<mode>"
6105 [(match_operand:<ssepackfltmode> 0 "register_operand")
6106 (match_operand:VF2 1 "register_operand")
6107 (match_operand:VF2 2 "register_operand")]
6110 if (<MODE>mode == V8DFmode)
6114 r1 = gen_reg_rtx (V8SImode);
6115 r2 = gen_reg_rtx (V8SImode);
6117 emit_insn (gen_ufix_truncv8dfv8si2 (r1, operands[1]));
6118 emit_insn (gen_ufix_truncv8dfv8si2 (r2, operands[2]));
6119 emit_insn (gen_avx_vec_concatv16si (operands[0], r1, r2));
6124 tmp[0] = ix86_expand_adjust_ufix_to_sfix_si (operands[1], &tmp[2]);
6125 tmp[1] = ix86_expand_adjust_ufix_to_sfix_si (operands[2], &tmp[3]);
6126 tmp[4] = gen_reg_rtx (<ssepackfltmode>mode);
6127 emit_insn (gen_vec_pack_sfix_trunc_<mode> (tmp[4], tmp[0], tmp[1]));
6128 if (<ssepackfltmode>mode == V4SImode || TARGET_AVX2)
6130 tmp[5] = gen_reg_rtx (<ssepackfltmode>mode);
6131 ix86_expand_vec_extract_even_odd (tmp[5], tmp[2], tmp[3], 0);
6135 tmp[5] = gen_reg_rtx (V8SFmode);
6136 ix86_expand_vec_extract_even_odd (tmp[5],
6137 gen_lowpart (V8SFmode, tmp[2]),
6138 gen_lowpart (V8SFmode, tmp[3]), 0);
6139 tmp[5] = gen_lowpart (V8SImode, tmp[5]);
6141 tmp[6] = expand_simple_binop (<ssepackfltmode>mode, XOR, tmp[4], tmp[5],
6142 operands[0], 0, OPTAB_DIRECT);
6143 if (tmp[6] != operands[0])
6144 emit_move_insn (operands[0], tmp[6]);
6150 (define_expand "avx512f_vec_pack_sfix_v8df"
6151 [(match_operand:V16SI 0 "register_operand")
6152 (match_operand:V8DF 1 "nonimmediate_operand")
6153 (match_operand:V8DF 2 "nonimmediate_operand")]
6158 r1 = gen_reg_rtx (V8SImode);
6159 r2 = gen_reg_rtx (V8SImode);
6161 emit_insn (gen_avx512f_cvtpd2dq512 (r1, operands[1]));
6162 emit_insn (gen_avx512f_cvtpd2dq512 (r2, operands[2]));
6163 emit_insn (gen_avx_vec_concatv16si (operands[0], r1, r2));
6167 (define_expand "vec_pack_sfix_v4df"
6168 [(match_operand:V8SI 0 "register_operand")
6169 (match_operand:V4DF 1 "nonimmediate_operand")
6170 (match_operand:V4DF 2 "nonimmediate_operand")]
6175 r1 = gen_reg_rtx (V4SImode);
6176 r2 = gen_reg_rtx (V4SImode);
6178 emit_insn (gen_avx_cvtpd2dq256 (r1, operands[1]));
6179 emit_insn (gen_avx_cvtpd2dq256 (r2, operands[2]));
6180 emit_insn (gen_avx_vec_concatv8si (operands[0], r1, r2));
6184 (define_expand "vec_pack_sfix_v2df"
6185 [(match_operand:V4SI 0 "register_operand")
6186 (match_operand:V2DF 1 "vector_operand")
6187 (match_operand:V2DF 2 "vector_operand")]
6190 rtx tmp0, tmp1, tmp2;
6192 if (TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
6194 tmp0 = gen_reg_rtx (V4DFmode);
6195 tmp1 = force_reg (V2DFmode, operands[1]);
6197 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
6198 emit_insn (gen_avx_cvtpd2dq256 (operands[0], tmp0));
6202 tmp0 = gen_reg_rtx (V4SImode);
6203 tmp1 = gen_reg_rtx (V4SImode);
6204 tmp2 = gen_reg_rtx (V2DImode);
6206 emit_insn (gen_sse2_cvtpd2dq (tmp0, operands[1]));
6207 emit_insn (gen_sse2_cvtpd2dq (tmp1, operands[2]));
6208 emit_insn (gen_vec_interleave_lowv2di (tmp2,
6209 gen_lowpart (V2DImode, tmp0),
6210 gen_lowpart (V2DImode, tmp1)));
6211 emit_move_insn (operands[0], gen_lowpart (V4SImode, tmp2));
6216 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6218 ;; Parallel single-precision floating point element swizzling
6220 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6222 (define_expand "sse_movhlps_exp"
6223 [(set (match_operand:V4SF 0 "nonimmediate_operand")
6226 (match_operand:V4SF 1 "nonimmediate_operand")
6227 (match_operand:V4SF 2 "nonimmediate_operand"))
6228 (parallel [(const_int 6)
6234 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
6236 emit_insn (gen_sse_movhlps (dst, operands[1], operands[2]));
6238 /* Fix up the destination if needed. */
6239 if (dst != operands[0])
6240 emit_move_insn (operands[0], dst);
6245 (define_insn "sse_movhlps"
6246 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,v,x,v,m")
6249 (match_operand:V4SF 1 "nonimmediate_operand" " 0,v,0,v,0")
6250 (match_operand:V4SF 2 "nonimmediate_operand" " x,v,o,o,v"))
6251 (parallel [(const_int 6)
6255 "TARGET_SSE && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
6257 movhlps\t{%2, %0|%0, %2}
6258 vmovhlps\t{%2, %1, %0|%0, %1, %2}
6259 movlps\t{%H2, %0|%0, %H2}
6260 vmovlps\t{%H2, %1, %0|%0, %1, %H2}
6261 %vmovhps\t{%2, %0|%q0, %2}"
6262 [(set_attr "isa" "noavx,avx,noavx,avx,*")
6263 (set_attr "type" "ssemov")
6264 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,maybe_vex")
6265 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF,V2SF")])
6267 (define_expand "sse_movlhps_exp"
6268 [(set (match_operand:V4SF 0 "nonimmediate_operand")
6271 (match_operand:V4SF 1 "nonimmediate_operand")
6272 (match_operand:V4SF 2 "nonimmediate_operand"))
6273 (parallel [(const_int 0)
6279 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
6281 emit_insn (gen_sse_movlhps (dst, operands[1], operands[2]));
6283 /* Fix up the destination if needed. */
6284 if (dst != operands[0])
6285 emit_move_insn (operands[0], dst);
6290 (define_insn "sse_movlhps"
6291 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,v,x,v,o")
6294 (match_operand:V4SF 1 "nonimmediate_operand" " 0,v,0,v,0")
6295 (match_operand:V4SF 2 "nonimmediate_operand" " x,v,m,v,v"))
6296 (parallel [(const_int 0)
6300 "TARGET_SSE && ix86_binary_operator_ok (UNKNOWN, V4SFmode, operands)"
6302 movlhps\t{%2, %0|%0, %2}
6303 vmovlhps\t{%2, %1, %0|%0, %1, %2}
6304 movhps\t{%2, %0|%0, %q2}
6305 vmovhps\t{%2, %1, %0|%0, %1, %q2}
6306 %vmovlps\t{%2, %H0|%H0, %2}"
6307 [(set_attr "isa" "noavx,avx,noavx,avx,*")
6308 (set_attr "type" "ssemov")
6309 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,maybe_vex")
6310 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF,V2SF")])
6312 (define_insn "<mask_codefor>avx512f_unpckhps512<mask_name>"
6313 [(set (match_operand:V16SF 0 "register_operand" "=v")
6316 (match_operand:V16SF 1 "register_operand" "v")
6317 (match_operand:V16SF 2 "nonimmediate_operand" "vm"))
6318 (parallel [(const_int 2) (const_int 18)
6319 (const_int 3) (const_int 19)
6320 (const_int 6) (const_int 22)
6321 (const_int 7) (const_int 23)
6322 (const_int 10) (const_int 26)
6323 (const_int 11) (const_int 27)
6324 (const_int 14) (const_int 30)
6325 (const_int 15) (const_int 31)])))]
6327 "vunpckhps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6328 [(set_attr "type" "sselog")
6329 (set_attr "prefix" "evex")
6330 (set_attr "mode" "V16SF")])
6332 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
6333 (define_insn "avx_unpckhps256<mask_name>"
6334 [(set (match_operand:V8SF 0 "register_operand" "=v")
6337 (match_operand:V8SF 1 "register_operand" "v")
6338 (match_operand:V8SF 2 "nonimmediate_operand" "vm"))
6339 (parallel [(const_int 2) (const_int 10)
6340 (const_int 3) (const_int 11)
6341 (const_int 6) (const_int 14)
6342 (const_int 7) (const_int 15)])))]
6343 "TARGET_AVX && <mask_avx512vl_condition>"
6344 "vunpckhps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6345 [(set_attr "type" "sselog")
6346 (set_attr "prefix" "vex")
6347 (set_attr "mode" "V8SF")])
6349 (define_expand "vec_interleave_highv8sf"
6353 (match_operand:V8SF 1 "register_operand")
6354 (match_operand:V8SF 2 "nonimmediate_operand"))
6355 (parallel [(const_int 0) (const_int 8)
6356 (const_int 1) (const_int 9)
6357 (const_int 4) (const_int 12)
6358 (const_int 5) (const_int 13)])))
6364 (parallel [(const_int 2) (const_int 10)
6365 (const_int 3) (const_int 11)
6366 (const_int 6) (const_int 14)
6367 (const_int 7) (const_int 15)])))
6368 (set (match_operand:V8SF 0 "register_operand")
6373 (parallel [(const_int 4) (const_int 5)
6374 (const_int 6) (const_int 7)
6375 (const_int 12) (const_int 13)
6376 (const_int 14) (const_int 15)])))]
6379 operands[3] = gen_reg_rtx (V8SFmode);
6380 operands[4] = gen_reg_rtx (V8SFmode);
6383 (define_insn "vec_interleave_highv4sf<mask_name>"
6384 [(set (match_operand:V4SF 0 "register_operand" "=x,v")
6387 (match_operand:V4SF 1 "register_operand" "0,v")
6388 (match_operand:V4SF 2 "vector_operand" "xBm,vm"))
6389 (parallel [(const_int 2) (const_int 6)
6390 (const_int 3) (const_int 7)])))]
6391 "TARGET_SSE && <mask_avx512vl_condition>"
6393 unpckhps\t{%2, %0|%0, %2}
6394 vunpckhps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6395 [(set_attr "isa" "noavx,avx")
6396 (set_attr "type" "sselog")
6397 (set_attr "prefix" "orig,vex")
6398 (set_attr "mode" "V4SF")])
6400 (define_insn "<mask_codefor>avx512f_unpcklps512<mask_name>"
6401 [(set (match_operand:V16SF 0 "register_operand" "=v")
6404 (match_operand:V16SF 1 "register_operand" "v")
6405 (match_operand:V16SF 2 "nonimmediate_operand" "vm"))
6406 (parallel [(const_int 0) (const_int 16)
6407 (const_int 1) (const_int 17)
6408 (const_int 4) (const_int 20)
6409 (const_int 5) (const_int 21)
6410 (const_int 8) (const_int 24)
6411 (const_int 9) (const_int 25)
6412 (const_int 12) (const_int 28)
6413 (const_int 13) (const_int 29)])))]
6415 "vunpcklps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6416 [(set_attr "type" "sselog")
6417 (set_attr "prefix" "evex")
6418 (set_attr "mode" "V16SF")])
6420 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
6421 (define_insn "avx_unpcklps256<mask_name>"
6422 [(set (match_operand:V8SF 0 "register_operand" "=v")
6425 (match_operand:V8SF 1 "register_operand" "v")
6426 (match_operand:V8SF 2 "nonimmediate_operand" "vm"))
6427 (parallel [(const_int 0) (const_int 8)
6428 (const_int 1) (const_int 9)
6429 (const_int 4) (const_int 12)
6430 (const_int 5) (const_int 13)])))]
6431 "TARGET_AVX && <mask_avx512vl_condition>"
6432 "vunpcklps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6433 [(set_attr "type" "sselog")
6434 (set_attr "prefix" "vex")
6435 (set_attr "mode" "V8SF")])
6437 (define_insn "unpcklps128_mask"
6438 [(set (match_operand:V4SF 0 "register_operand" "=v")
6442 (match_operand:V4SF 1 "register_operand" "v")
6443 (match_operand:V4SF 2 "nonimmediate_operand" "vm"))
6444 (parallel [(const_int 0) (const_int 4)
6445 (const_int 1) (const_int 5)]))
6446 (match_operand:V4SF 3 "vector_move_operand" "0C")
6447 (match_operand:QI 4 "register_operand" "Yk")))]
6449 "vunpcklps\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
6450 [(set_attr "type" "sselog")
6451 (set_attr "prefix" "evex")
6452 (set_attr "mode" "V4SF")])
6454 (define_expand "vec_interleave_lowv8sf"
6458 (match_operand:V8SF 1 "register_operand")
6459 (match_operand:V8SF 2 "nonimmediate_operand"))
6460 (parallel [(const_int 0) (const_int 8)
6461 (const_int 1) (const_int 9)
6462 (const_int 4) (const_int 12)
6463 (const_int 5) (const_int 13)])))
6469 (parallel [(const_int 2) (const_int 10)
6470 (const_int 3) (const_int 11)
6471 (const_int 6) (const_int 14)
6472 (const_int 7) (const_int 15)])))
6473 (set (match_operand:V8SF 0 "register_operand")
6478 (parallel [(const_int 0) (const_int 1)
6479 (const_int 2) (const_int 3)
6480 (const_int 8) (const_int 9)
6481 (const_int 10) (const_int 11)])))]
6484 operands[3] = gen_reg_rtx (V8SFmode);
6485 operands[4] = gen_reg_rtx (V8SFmode);
6488 (define_insn "vec_interleave_lowv4sf"
6489 [(set (match_operand:V4SF 0 "register_operand" "=x,v")
6492 (match_operand:V4SF 1 "register_operand" "0,v")
6493 (match_operand:V4SF 2 "vector_operand" "xBm,vm"))
6494 (parallel [(const_int 0) (const_int 4)
6495 (const_int 1) (const_int 5)])))]
6498 unpcklps\t{%2, %0|%0, %2}
6499 vunpcklps\t{%2, %1, %0|%0, %1, %2}"
6500 [(set_attr "isa" "noavx,avx")
6501 (set_attr "type" "sselog")
6502 (set_attr "prefix" "orig,maybe_evex")
6503 (set_attr "mode" "V4SF")])
6505 ;; These are modeled with the same vec_concat as the others so that we
6506 ;; capture users of shufps that can use the new instructions
6507 (define_insn "avx_movshdup256<mask_name>"
6508 [(set (match_operand:V8SF 0 "register_operand" "=v")
6511 (match_operand:V8SF 1 "nonimmediate_operand" "vm")
6513 (parallel [(const_int 1) (const_int 1)
6514 (const_int 3) (const_int 3)
6515 (const_int 5) (const_int 5)
6516 (const_int 7) (const_int 7)])))]
6517 "TARGET_AVX && <mask_avx512vl_condition>"
6518 "vmovshdup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6519 [(set_attr "type" "sse")
6520 (set_attr "prefix" "vex")
6521 (set_attr "mode" "V8SF")])
6523 (define_insn "sse3_movshdup<mask_name>"
6524 [(set (match_operand:V4SF 0 "register_operand" "=v")
6527 (match_operand:V4SF 1 "vector_operand" "vBm")
6529 (parallel [(const_int 1)
6533 "TARGET_SSE3 && <mask_avx512vl_condition>"
6534 "%vmovshdup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6535 [(set_attr "type" "sse")
6536 (set_attr "prefix_rep" "1")
6537 (set_attr "prefix" "maybe_vex")
6538 (set_attr "mode" "V4SF")])
6540 (define_insn "<mask_codefor>avx512f_movshdup512<mask_name>"
6541 [(set (match_operand:V16SF 0 "register_operand" "=v")
6544 (match_operand:V16SF 1 "nonimmediate_operand" "vm")
6546 (parallel [(const_int 1) (const_int 1)
6547 (const_int 3) (const_int 3)
6548 (const_int 5) (const_int 5)
6549 (const_int 7) (const_int 7)
6550 (const_int 9) (const_int 9)
6551 (const_int 11) (const_int 11)
6552 (const_int 13) (const_int 13)
6553 (const_int 15) (const_int 15)])))]
6555 "vmovshdup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6556 [(set_attr "type" "sse")
6557 (set_attr "prefix" "evex")
6558 (set_attr "mode" "V16SF")])
6560 (define_insn "avx_movsldup256<mask_name>"
6561 [(set (match_operand:V8SF 0 "register_operand" "=v")
6564 (match_operand:V8SF 1 "nonimmediate_operand" "vm")
6566 (parallel [(const_int 0) (const_int 0)
6567 (const_int 2) (const_int 2)
6568 (const_int 4) (const_int 4)
6569 (const_int 6) (const_int 6)])))]
6570 "TARGET_AVX && <mask_avx512vl_condition>"
6571 "vmovsldup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6572 [(set_attr "type" "sse")
6573 (set_attr "prefix" "vex")
6574 (set_attr "mode" "V8SF")])
6576 (define_insn "sse3_movsldup<mask_name>"
6577 [(set (match_operand:V4SF 0 "register_operand" "=v")
6580 (match_operand:V4SF 1 "vector_operand" "vBm")
6582 (parallel [(const_int 0)
6586 "TARGET_SSE3 && <mask_avx512vl_condition>"
6587 "%vmovsldup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6588 [(set_attr "type" "sse")
6589 (set_attr "prefix_rep" "1")
6590 (set_attr "prefix" "maybe_vex")
6591 (set_attr "mode" "V4SF")])
6593 (define_insn "<mask_codefor>avx512f_movsldup512<mask_name>"
6594 [(set (match_operand:V16SF 0 "register_operand" "=v")
6597 (match_operand:V16SF 1 "nonimmediate_operand" "vm")
6599 (parallel [(const_int 0) (const_int 0)
6600 (const_int 2) (const_int 2)
6601 (const_int 4) (const_int 4)
6602 (const_int 6) (const_int 6)
6603 (const_int 8) (const_int 8)
6604 (const_int 10) (const_int 10)
6605 (const_int 12) (const_int 12)
6606 (const_int 14) (const_int 14)])))]
6608 "vmovsldup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6609 [(set_attr "type" "sse")
6610 (set_attr "prefix" "evex")
6611 (set_attr "mode" "V16SF")])
6613 (define_expand "avx_shufps256<mask_expand4_name>"
6614 [(match_operand:V8SF 0 "register_operand")
6615 (match_operand:V8SF 1 "register_operand")
6616 (match_operand:V8SF 2 "nonimmediate_operand")
6617 (match_operand:SI 3 "const_int_operand")]
6620 int mask = INTVAL (operands[3]);
6621 emit_insn (gen_avx_shufps256_1<mask_expand4_name> (operands[0],
6624 GEN_INT ((mask >> 0) & 3),
6625 GEN_INT ((mask >> 2) & 3),
6626 GEN_INT (((mask >> 4) & 3) + 8),
6627 GEN_INT (((mask >> 6) & 3) + 8),
6628 GEN_INT (((mask >> 0) & 3) + 4),
6629 GEN_INT (((mask >> 2) & 3) + 4),
6630 GEN_INT (((mask >> 4) & 3) + 12),
6631 GEN_INT (((mask >> 6) & 3) + 12)
6632 <mask_expand4_args>));
6636 ;; One bit in mask selects 2 elements.
6637 (define_insn "avx_shufps256_1<mask_name>"
6638 [(set (match_operand:V8SF 0 "register_operand" "=v")
6641 (match_operand:V8SF 1 "register_operand" "v")
6642 (match_operand:V8SF 2 "nonimmediate_operand" "vm"))
6643 (parallel [(match_operand 3 "const_0_to_3_operand" )
6644 (match_operand 4 "const_0_to_3_operand" )
6645 (match_operand 5 "const_8_to_11_operand" )
6646 (match_operand 6 "const_8_to_11_operand" )
6647 (match_operand 7 "const_4_to_7_operand" )
6648 (match_operand 8 "const_4_to_7_operand" )
6649 (match_operand 9 "const_12_to_15_operand")
6650 (match_operand 10 "const_12_to_15_operand")])))]
6652 && <mask_avx512vl_condition>
6653 && (INTVAL (operands[3]) == (INTVAL (operands[7]) - 4)
6654 && INTVAL (operands[4]) == (INTVAL (operands[8]) - 4)
6655 && INTVAL (operands[5]) == (INTVAL (operands[9]) - 4)
6656 && INTVAL (operands[6]) == (INTVAL (operands[10]) - 4))"
6659 mask = INTVAL (operands[3]);
6660 mask |= INTVAL (operands[4]) << 2;
6661 mask |= (INTVAL (operands[5]) - 8) << 4;
6662 mask |= (INTVAL (operands[6]) - 8) << 6;
6663 operands[3] = GEN_INT (mask);
6665 return "vshufps\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
6667 [(set_attr "type" "sseshuf")
6668 (set_attr "length_immediate" "1")
6669 (set_attr "prefix" "<mask_prefix>")
6670 (set_attr "mode" "V8SF")])
6672 (define_expand "sse_shufps<mask_expand4_name>"
6673 [(match_operand:V4SF 0 "register_operand")
6674 (match_operand:V4SF 1 "register_operand")
6675 (match_operand:V4SF 2 "vector_operand")
6676 (match_operand:SI 3 "const_int_operand")]
6679 int mask = INTVAL (operands[3]);
6680 emit_insn (gen_sse_shufps_v4sf<mask_expand4_name> (operands[0],
6683 GEN_INT ((mask >> 0) & 3),
6684 GEN_INT ((mask >> 2) & 3),
6685 GEN_INT (((mask >> 4) & 3) + 4),
6686 GEN_INT (((mask >> 6) & 3) + 4)
6687 <mask_expand4_args>));
6691 (define_insn "sse_shufps_v4sf_mask"
6692 [(set (match_operand:V4SF 0 "register_operand" "=v")
6696 (match_operand:V4SF 1 "register_operand" "v")
6697 (match_operand:V4SF 2 "nonimmediate_operand" "vm"))
6698 (parallel [(match_operand 3 "const_0_to_3_operand")
6699 (match_operand 4 "const_0_to_3_operand")
6700 (match_operand 5 "const_4_to_7_operand")
6701 (match_operand 6 "const_4_to_7_operand")]))
6702 (match_operand:V4SF 7 "vector_move_operand" "0C")
6703 (match_operand:QI 8 "register_operand" "Yk")))]
6707 mask |= INTVAL (operands[3]) << 0;
6708 mask |= INTVAL (operands[4]) << 2;
6709 mask |= (INTVAL (operands[5]) - 4) << 4;
6710 mask |= (INTVAL (operands[6]) - 4) << 6;
6711 operands[3] = GEN_INT (mask);
6713 return "vshufps\t{%3, %2, %1, %0%{%8%}%N7|%0%{%8%}%N7, %1, %2, %3}";
6715 [(set_attr "type" "sseshuf")
6716 (set_attr "length_immediate" "1")
6717 (set_attr "prefix" "evex")
6718 (set_attr "mode" "V4SF")])
6720 (define_insn "sse_shufps_<mode>"
6721 [(set (match_operand:VI4F_128 0 "register_operand" "=x,v")
6722 (vec_select:VI4F_128
6723 (vec_concat:<ssedoublevecmode>
6724 (match_operand:VI4F_128 1 "register_operand" "0,v")
6725 (match_operand:VI4F_128 2 "vector_operand" "xBm,vm"))
6726 (parallel [(match_operand 3 "const_0_to_3_operand")
6727 (match_operand 4 "const_0_to_3_operand")
6728 (match_operand 5 "const_4_to_7_operand")
6729 (match_operand 6 "const_4_to_7_operand")])))]
6733 mask |= INTVAL (operands[3]) << 0;
6734 mask |= INTVAL (operands[4]) << 2;
6735 mask |= (INTVAL (operands[5]) - 4) << 4;
6736 mask |= (INTVAL (operands[6]) - 4) << 6;
6737 operands[3] = GEN_INT (mask);
6739 switch (which_alternative)
6742 return "shufps\t{%3, %2, %0|%0, %2, %3}";
6744 return "vshufps\t{%3, %2, %1, %0|%0, %1, %2, %3}";
6749 [(set_attr "isa" "noavx,avx")
6750 (set_attr "type" "sseshuf")
6751 (set_attr "length_immediate" "1")
6752 (set_attr "prefix" "orig,maybe_evex")
6753 (set_attr "mode" "V4SF")])
6755 (define_insn "sse_storehps"
6756 [(set (match_operand:V2SF 0 "nonimmediate_operand" "=m,v,v")
6758 (match_operand:V4SF 1 "nonimmediate_operand" "v,v,o")
6759 (parallel [(const_int 2) (const_int 3)])))]
6760 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
6762 %vmovhps\t{%1, %0|%q0, %1}
6763 %vmovhlps\t{%1, %d0|%d0, %1}
6764 %vmovlps\t{%H1, %d0|%d0, %H1}"
6765 [(set_attr "type" "ssemov")
6766 (set_attr "prefix" "maybe_vex")
6767 (set_attr "mode" "V2SF,V4SF,V2SF")])
6769 (define_expand "sse_loadhps_exp"
6770 [(set (match_operand:V4SF 0 "nonimmediate_operand")
6773 (match_operand:V4SF 1 "nonimmediate_operand")
6774 (parallel [(const_int 0) (const_int 1)]))
6775 (match_operand:V2SF 2 "nonimmediate_operand")))]
6778 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
6780 emit_insn (gen_sse_loadhps (dst, operands[1], operands[2]));
6782 /* Fix up the destination if needed. */
6783 if (dst != operands[0])
6784 emit_move_insn (operands[0], dst);
6789 (define_insn "sse_loadhps"
6790 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,v,x,v,o")
6793 (match_operand:V4SF 1 "nonimmediate_operand" " 0,v,0,v,0")
6794 (parallel [(const_int 0) (const_int 1)]))
6795 (match_operand:V2SF 2 "nonimmediate_operand" " m,m,x,v,v")))]
6798 movhps\t{%2, %0|%0, %q2}
6799 vmovhps\t{%2, %1, %0|%0, %1, %q2}
6800 movlhps\t{%2, %0|%0, %2}
6801 vmovlhps\t{%2, %1, %0|%0, %1, %2}
6802 %vmovlps\t{%2, %H0|%H0, %2}"
6803 [(set_attr "isa" "noavx,avx,noavx,avx,*")
6804 (set_attr "type" "ssemov")
6805 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,maybe_vex")
6806 (set_attr "mode" "V2SF,V2SF,V4SF,V4SF,V2SF")])
6808 (define_insn "sse_storelps"
6809 [(set (match_operand:V2SF 0 "nonimmediate_operand" "=m,v,v")
6811 (match_operand:V4SF 1 "nonimmediate_operand" " v,v,m")
6812 (parallel [(const_int 0) (const_int 1)])))]
6813 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
6815 %vmovlps\t{%1, %0|%q0, %1}
6816 %vmovaps\t{%1, %0|%0, %1}
6817 %vmovlps\t{%1, %d0|%d0, %q1}"
6818 [(set_attr "type" "ssemov")
6819 (set_attr "prefix" "maybe_vex")
6820 (set_attr "mode" "V2SF,V4SF,V2SF")])
6822 (define_expand "sse_loadlps_exp"
6823 [(set (match_operand:V4SF 0 "nonimmediate_operand")
6825 (match_operand:V2SF 2 "nonimmediate_operand")
6827 (match_operand:V4SF 1 "nonimmediate_operand")
6828 (parallel [(const_int 2) (const_int 3)]))))]
6831 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
6833 emit_insn (gen_sse_loadlps (dst, operands[1], operands[2]));
6835 /* Fix up the destination if needed. */
6836 if (dst != operands[0])
6837 emit_move_insn (operands[0], dst);
6842 (define_insn "sse_loadlps"
6843 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,v,x,v,m")
6845 (match_operand:V2SF 2 "nonimmediate_operand" " 0,v,m,m,v")
6847 (match_operand:V4SF 1 "nonimmediate_operand" " x,v,0,v,0")
6848 (parallel [(const_int 2) (const_int 3)]))))]
6851 shufps\t{$0xe4, %1, %0|%0, %1, 0xe4}
6852 vshufps\t{$0xe4, %1, %2, %0|%0, %2, %1, 0xe4}
6853 movlps\t{%2, %0|%0, %q2}
6854 vmovlps\t{%2, %1, %0|%0, %1, %q2}
6855 %vmovlps\t{%2, %0|%q0, %2}"
6856 [(set_attr "isa" "noavx,avx,noavx,avx,*")
6857 (set_attr "type" "sseshuf,sseshuf,ssemov,ssemov,ssemov")
6858 (set (attr "length_immediate")
6859 (if_then_else (eq_attr "alternative" "0,1")
6861 (const_string "*")))
6862 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,maybe_vex")
6863 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF,V2SF")])
6865 (define_insn "sse_movss"
6866 [(set (match_operand:V4SF 0 "register_operand" "=x,v")
6868 (match_operand:V4SF 2 "register_operand" " x,v")
6869 (match_operand:V4SF 1 "register_operand" " 0,v")
6873 movss\t{%2, %0|%0, %2}
6874 vmovss\t{%2, %1, %0|%0, %1, %2}"
6875 [(set_attr "isa" "noavx,avx")
6876 (set_attr "type" "ssemov")
6877 (set_attr "prefix" "orig,maybe_evex")
6878 (set_attr "mode" "SF")])
6880 (define_insn "avx2_vec_dup<mode>"
6881 [(set (match_operand:VF1_128_256 0 "register_operand" "=v")
6882 (vec_duplicate:VF1_128_256
6884 (match_operand:V4SF 1 "register_operand" "v")
6885 (parallel [(const_int 0)]))))]
6887 "vbroadcastss\t{%1, %0|%0, %1}"
6888 [(set_attr "type" "sselog1")
6889 (set_attr "prefix" "maybe_evex")
6890 (set_attr "mode" "<MODE>")])
6892 (define_insn "avx2_vec_dupv8sf_1"
6893 [(set (match_operand:V8SF 0 "register_operand" "=v")
6896 (match_operand:V8SF 1 "register_operand" "v")
6897 (parallel [(const_int 0)]))))]
6899 "vbroadcastss\t{%x1, %0|%0, %x1}"
6900 [(set_attr "type" "sselog1")
6901 (set_attr "prefix" "maybe_evex")
6902 (set_attr "mode" "V8SF")])
6904 (define_insn "avx512f_vec_dup<mode>_1"
6905 [(set (match_operand:VF_512 0 "register_operand" "=v")
6906 (vec_duplicate:VF_512
6907 (vec_select:<ssescalarmode>
6908 (match_operand:VF_512 1 "register_operand" "v")
6909 (parallel [(const_int 0)]))))]
6911 "vbroadcast<bcstscalarsuff>\t{%x1, %0|%0, %x1}"
6912 [(set_attr "type" "sselog1")
6913 (set_attr "prefix" "evex")
6914 (set_attr "mode" "<MODE>")])
6916 ;; Although insertps takes register source, we prefer
6917 ;; unpcklps with register source since it is shorter.
6918 (define_insn "*vec_concatv2sf_sse4_1"
6919 [(set (match_operand:V2SF 0 "register_operand"
6920 "=Yr,*x, v,Yr,*x,v,v,*y ,*y")
6922 (match_operand:SF 1 "nonimmediate_operand"
6923 " 0, 0,Yv, 0,0, v,m, 0 , m")
6924 (match_operand:SF 2 "vector_move_operand"
6925 " Yr,*x,Yv, m,m, m,C,*ym, C")))]
6926 "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
6928 unpcklps\t{%2, %0|%0, %2}
6929 unpcklps\t{%2, %0|%0, %2}
6930 vunpcklps\t{%2, %1, %0|%0, %1, %2}
6931 insertps\t{$0x10, %2, %0|%0, %2, 0x10}
6932 insertps\t{$0x10, %2, %0|%0, %2, 0x10}
6933 vinsertps\t{$0x10, %2, %1, %0|%0, %1, %2, 0x10}
6934 %vmovss\t{%1, %0|%0, %1}
6935 punpckldq\t{%2, %0|%0, %2}
6936 movd\t{%1, %0|%0, %1}"
6938 (cond [(eq_attr "alternative" "0,1,3,4")
6939 (const_string "noavx")
6940 (eq_attr "alternative" "2,5")
6941 (const_string "avx")
6943 (const_string "*")))
6945 (cond [(eq_attr "alternative" "6")
6946 (const_string "ssemov")
6947 (eq_attr "alternative" "7")
6948 (const_string "mmxcvt")
6949 (eq_attr "alternative" "8")
6950 (const_string "mmxmov")
6952 (const_string "sselog")))
6953 (set (attr "prefix_data16")
6954 (if_then_else (eq_attr "alternative" "3,4")
6956 (const_string "*")))
6957 (set (attr "prefix_extra")
6958 (if_then_else (eq_attr "alternative" "3,4,5")
6960 (const_string "*")))
6961 (set (attr "length_immediate")
6962 (if_then_else (eq_attr "alternative" "3,4,5")
6964 (const_string "*")))
6965 (set (attr "prefix")
6966 (cond [(eq_attr "alternative" "2,5")
6967 (const_string "maybe_evex")
6968 (eq_attr "alternative" "6")
6969 (const_string "maybe_vex")
6971 (const_string "orig")))
6972 (set_attr "mode" "V4SF,V4SF,V4SF,V4SF,V4SF,V4SF,SF,DI,DI")])
6974 ;; ??? In theory we can match memory for the MMX alternative, but allowing
6975 ;; vector_operand for operand 2 and *not* allowing memory for the SSE
6976 ;; alternatives pretty much forces the MMX alternative to be chosen.
6977 (define_insn "*vec_concatv2sf_sse"
6978 [(set (match_operand:V2SF 0 "register_operand" "=x,x,*y,*y")
6980 (match_operand:SF 1 "nonimmediate_operand" " 0,m, 0, m")
6981 (match_operand:SF 2 "reg_or_0_operand" " x,C,*y, C")))]
6984 unpcklps\t{%2, %0|%0, %2}
6985 movss\t{%1, %0|%0, %1}
6986 punpckldq\t{%2, %0|%0, %2}
6987 movd\t{%1, %0|%0, %1}"
6988 [(set_attr "type" "sselog,ssemov,mmxcvt,mmxmov")
6989 (set_attr "mode" "V4SF,SF,DI,DI")])
6991 (define_insn "*vec_concatv4sf"
6992 [(set (match_operand:V4SF 0 "register_operand" "=x,v,x,v")
6994 (match_operand:V2SF 1 "register_operand" " 0,v,0,v")
6995 (match_operand:V2SF 2 "nonimmediate_operand" " x,v,m,m")))]
6998 movlhps\t{%2, %0|%0, %2}
6999 vmovlhps\t{%2, %1, %0|%0, %1, %2}
7000 movhps\t{%2, %0|%0, %q2}
7001 vmovhps\t{%2, %1, %0|%0, %1, %q2}"
7002 [(set_attr "isa" "noavx,avx,noavx,avx")
7003 (set_attr "type" "ssemov")
7004 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex")
7005 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF")])
7007 ;; Avoid combining registers from different units in a single alternative,
7008 ;; see comment above inline_secondary_memory_needed function in i386.c
7009 (define_insn "vec_set<mode>_0"
7010 [(set (match_operand:VI4F_128 0 "nonimmediate_operand"
7011 "=Yr,*x,v,v,Yi,x,x,v,Yr ,*x ,x ,m ,m ,m")
7013 (vec_duplicate:VI4F_128
7014 (match_operand:<ssescalarmode> 2 "general_operand"
7015 " Yr,*x,v,m,r ,m,x,v,*rm,*rm,*rm,!x,!*re,!*fF"))
7016 (match_operand:VI4F_128 1 "vector_move_operand"
7017 " C , C,C,C,C ,C,0,v,0 ,0 ,x ,0 ,0 ,0")
7021 insertps\t{$0xe, %2, %0|%0, %2, 0xe}
7022 insertps\t{$0xe, %2, %0|%0, %2, 0xe}
7023 vinsertps\t{$0xe, %2, %2, %0|%0, %2, %2, 0xe}
7024 %vmov<ssescalarmodesuffix>\t{%2, %0|%0, %2}
7025 %vmovd\t{%2, %0|%0, %2}
7026 movss\t{%2, %0|%0, %2}
7027 movss\t{%2, %0|%0, %2}
7028 vmovss\t{%2, %1, %0|%0, %1, %2}
7029 pinsrd\t{$0, %2, %0|%0, %2, 0}
7030 pinsrd\t{$0, %2, %0|%0, %2, 0}
7031 vpinsrd\t{$0, %2, %1, %0|%0, %1, %2, 0}
7036 (cond [(eq_attr "alternative" "0,1,8,9")
7037 (const_string "sse4_noavx")
7038 (eq_attr "alternative" "2,7,10")
7039 (const_string "avx")
7040 (eq_attr "alternative" "3,4")
7041 (const_string "sse2")
7042 (eq_attr "alternative" "5,6")
7043 (const_string "noavx")
7045 (const_string "*")))
7047 (cond [(eq_attr "alternative" "0,1,2,8,9,10")
7048 (const_string "sselog")
7049 (eq_attr "alternative" "12")
7050 (const_string "imov")
7051 (eq_attr "alternative" "13")
7052 (const_string "fmov")
7054 (const_string "ssemov")))
7055 (set (attr "prefix_extra")
7056 (if_then_else (eq_attr "alternative" "8,9,10")
7058 (const_string "*")))
7059 (set (attr "length_immediate")
7060 (if_then_else (eq_attr "alternative" "8,9,10")
7062 (const_string "*")))
7063 (set (attr "prefix")
7064 (cond [(eq_attr "alternative" "0,1,5,6,8,9")
7065 (const_string "orig")
7066 (eq_attr "alternative" "2")
7067 (const_string "maybe_evex")
7068 (eq_attr "alternative" "3,4")
7069 (const_string "maybe_vex")
7070 (eq_attr "alternative" "7,10")
7071 (const_string "vex")
7073 (const_string "*")))
7074 (set_attr "mode" "SF,SF,SF,<ssescalarmode>,SI,SF,SF,SF,TI,TI,TI,*,*,*")])
7076 ;; A subset is vec_setv4sf.
7077 (define_insn "*vec_setv4sf_sse4_1"
7078 [(set (match_operand:V4SF 0 "register_operand" "=Yr,*x,v")
7081 (match_operand:SF 2 "nonimmediate_operand" "Yrm,*xm,vm"))
7082 (match_operand:V4SF 1 "register_operand" "0,0,v")
7083 (match_operand:SI 3 "const_int_operand")))]
7085 && ((unsigned) exact_log2 (INTVAL (operands[3]))
7086 < GET_MODE_NUNITS (V4SFmode))"
7088 operands[3] = GEN_INT (exact_log2 (INTVAL (operands[3])) << 4);
7089 switch (which_alternative)
7093 return "insertps\t{%3, %2, %0|%0, %2, %3}";
7095 return "vinsertps\t{%3, %2, %1, %0|%0, %1, %2, %3}";
7100 [(set_attr "isa" "noavx,noavx,avx")
7101 (set_attr "type" "sselog")
7102 (set_attr "prefix_data16" "1,1,*")
7103 (set_attr "prefix_extra" "1")
7104 (set_attr "length_immediate" "1")
7105 (set_attr "prefix" "orig,orig,maybe_evex")
7106 (set_attr "mode" "V4SF")])
7108 ;; All of vinsertps, vmovss, vmovd clear also the higher bits.
7109 (define_insn "vec_set<mode>_0"
7110 [(set (match_operand:VI4F_256_512 0 "register_operand" "=v,v,Yi")
7111 (vec_merge:VI4F_256_512
7112 (vec_duplicate:VI4F_256_512
7113 (match_operand:<ssescalarmode> 2 "general_operand" "v,m,r"))
7114 (match_operand:VI4F_256_512 1 "const0_operand" "C,C,C")
7118 vinsertps\t{$0xe, %2, %2, %x0|%x0, %2, %2, 0xe}
7119 vmov<ssescalarmodesuffix>\t{%x2, %x0|%x0, %2}
7120 vmovd\t{%2, %x0|%x0, %2}"
7122 (if_then_else (eq_attr "alternative" "0")
7123 (const_string "sselog")
7124 (const_string "ssemov")))
7125 (set_attr "prefix" "maybe_evex")
7126 (set_attr "mode" "SF,<ssescalarmode>,SI")])
7128 (define_insn "sse4_1_insertps"
7129 [(set (match_operand:V4SF 0 "register_operand" "=Yr,*x,v")
7130 (unspec:V4SF [(match_operand:V4SF 2 "nonimmediate_operand" "Yrm,*xm,vm")
7131 (match_operand:V4SF 1 "register_operand" "0,0,v")
7132 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")]
7136 if (MEM_P (operands[2]))
7138 unsigned count_s = INTVAL (operands[3]) >> 6;
7140 operands[3] = GEN_INT (INTVAL (operands[3]) & 0x3f);
7141 operands[2] = adjust_address_nv (operands[2], SFmode, count_s * 4);
7143 switch (which_alternative)
7147 return "insertps\t{%3, %2, %0|%0, %2, %3}";
7149 return "vinsertps\t{%3, %2, %1, %0|%0, %1, %2, %3}";
7154 [(set_attr "isa" "noavx,noavx,avx")
7155 (set_attr "type" "sselog")
7156 (set_attr "prefix_data16" "1,1,*")
7157 (set_attr "prefix_extra" "1")
7158 (set_attr "length_immediate" "1")
7159 (set_attr "prefix" "orig,orig,maybe_evex")
7160 (set_attr "mode" "V4SF")])
7163 [(set (match_operand:VI4F_128 0 "memory_operand")
7165 (vec_duplicate:VI4F_128
7166 (match_operand:<ssescalarmode> 1 "nonmemory_operand"))
7169 "TARGET_SSE && reload_completed"
7170 [(set (match_dup 0) (match_dup 1))]
7171 "operands[0] = adjust_address (operands[0], <ssescalarmode>mode, 0);")
7173 (define_expand "vec_set<mode>"
7174 [(match_operand:V 0 "register_operand")
7175 (match_operand:<ssescalarmode> 1 "register_operand")
7176 (match_operand 2 "const_int_operand")]
7179 ix86_expand_vector_set (false, operands[0], operands[1],
7180 INTVAL (operands[2]));
7184 (define_insn_and_split "*vec_extractv4sf_0"
7185 [(set (match_operand:SF 0 "nonimmediate_operand" "=v,m,f,r")
7187 (match_operand:V4SF 1 "nonimmediate_operand" "vm,v,m,m")
7188 (parallel [(const_int 0)])))]
7189 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7191 "&& reload_completed"
7192 [(set (match_dup 0) (match_dup 1))]
7193 "operands[1] = gen_lowpart (SFmode, operands[1]);")
7195 (define_insn_and_split "*sse4_1_extractps"
7196 [(set (match_operand:SF 0 "nonimmediate_operand" "=rm,rm,rm,Yv,Yv")
7198 (match_operand:V4SF 1 "register_operand" "Yr,*x,v,0,v")
7199 (parallel [(match_operand:SI 2 "const_0_to_3_operand" "n,n,n,n,n")])))]
7202 extractps\t{%2, %1, %0|%0, %1, %2}
7203 extractps\t{%2, %1, %0|%0, %1, %2}
7204 vextractps\t{%2, %1, %0|%0, %1, %2}
7207 "&& reload_completed && SSE_REG_P (operands[0])"
7210 rtx dest = lowpart_subreg (V4SFmode, operands[0], SFmode);
7211 switch (INTVAL (operands[2]))
7215 emit_insn (gen_sse_shufps_v4sf (dest, operands[1], operands[1],
7216 operands[2], operands[2],
7217 GEN_INT (INTVAL (operands[2]) + 4),
7218 GEN_INT (INTVAL (operands[2]) + 4)));
7221 emit_insn (gen_vec_interleave_highv4sf (dest, operands[1], operands[1]));
7224 /* 0 should be handled by the *vec_extractv4sf_0 pattern above. */
7229 [(set_attr "isa" "noavx,noavx,avx,noavx,avx")
7230 (set_attr "type" "sselog,sselog,sselog,*,*")
7231 (set_attr "prefix_data16" "1,1,1,*,*")
7232 (set_attr "prefix_extra" "1,1,1,*,*")
7233 (set_attr "length_immediate" "1,1,1,*,*")
7234 (set_attr "prefix" "orig,orig,maybe_evex,*,*")
7235 (set_attr "mode" "V4SF,V4SF,V4SF,*,*")])
7237 (define_insn_and_split "*vec_extractv4sf_mem"
7238 [(set (match_operand:SF 0 "register_operand" "=v,*r,f")
7240 (match_operand:V4SF 1 "memory_operand" "o,o,o")
7241 (parallel [(match_operand 2 "const_0_to_3_operand" "n,n,n")])))]
7244 "&& reload_completed"
7245 [(set (match_dup 0) (match_dup 1))]
7247 operands[1] = adjust_address (operands[1], SFmode, INTVAL (operands[2]) * 4);
7250 (define_mode_attr extract_type
7251 [(V16SF "avx512f") (V16SI "avx512f") (V8DF "avx512dq") (V8DI "avx512dq")])
7253 (define_mode_attr extract_suf
7254 [(V16SF "32x4") (V16SI "32x4") (V8DF "64x2") (V8DI "64x2")])
7256 (define_mode_iterator AVX512_VEC
7257 [(V8DF "TARGET_AVX512DQ") (V8DI "TARGET_AVX512DQ") V16SF V16SI])
7259 (define_expand "<extract_type>_vextract<shuffletype><extract_suf>_mask"
7260 [(match_operand:<ssequartermode> 0 "nonimmediate_operand")
7261 (match_operand:AVX512_VEC 1 "register_operand")
7262 (match_operand:SI 2 "const_0_to_3_operand")
7263 (match_operand:<ssequartermode> 3 "nonimmediate_operand")
7264 (match_operand:QI 4 "register_operand")]
7268 mask = INTVAL (operands[2]);
7269 rtx dest = operands[0];
7271 if (MEM_P (operands[0]) && !rtx_equal_p (operands[0], operands[3]))
7272 dest = gen_reg_rtx (<ssequartermode>mode);
7274 if (<MODE>mode == V16SImode || <MODE>mode == V16SFmode)
7275 emit_insn (gen_avx512f_vextract<shuffletype>32x4_1_mask (dest,
7276 operands[1], GEN_INT (mask * 4), GEN_INT (mask * 4 + 1),
7277 GEN_INT (mask * 4 + 2), GEN_INT (mask * 4 + 3), operands[3],
7280 emit_insn (gen_avx512dq_vextract<shuffletype>64x2_1_mask (dest,
7281 operands[1], GEN_INT (mask * 2), GEN_INT (mask * 2 + 1), operands[3],
7283 if (dest != operands[0])
7284 emit_move_insn (operands[0], dest);
7288 (define_insn "avx512dq_vextract<shuffletype>64x2_1_maskm"
7289 [(set (match_operand:<ssequartermode> 0 "memory_operand" "=m")
7290 (vec_merge:<ssequartermode>
7291 (vec_select:<ssequartermode>
7292 (match_operand:V8FI 1 "register_operand" "v")
7293 (parallel [(match_operand 2 "const_0_to_7_operand")
7294 (match_operand 3 "const_0_to_7_operand")]))
7295 (match_operand:<ssequartermode> 4 "memory_operand" "0")
7296 (match_operand:QI 5 "register_operand" "Yk")))]
7298 && INTVAL (operands[2]) % 2 == 0
7299 && INTVAL (operands[2]) == INTVAL (operands[3]) - 1
7300 && rtx_equal_p (operands[4], operands[0])"
7302 operands[2] = GEN_INT ((INTVAL (operands[2])) >> 1);
7303 return "vextract<shuffletype>64x2\t{%2, %1, %0%{%5%}|%0%{%5%}, %1, %2}";
7305 [(set_attr "type" "sselog")
7306 (set_attr "prefix_extra" "1")
7307 (set_attr "length_immediate" "1")
7308 (set_attr "memory" "store")
7309 (set_attr "prefix" "evex")
7310 (set_attr "mode" "<sseinsnmode>")])
7312 (define_insn "avx512f_vextract<shuffletype>32x4_1_maskm"
7313 [(set (match_operand:<ssequartermode> 0 "memory_operand" "=m")
7314 (vec_merge:<ssequartermode>
7315 (vec_select:<ssequartermode>
7316 (match_operand:V16FI 1 "register_operand" "v")
7317 (parallel [(match_operand 2 "const_0_to_15_operand")
7318 (match_operand 3 "const_0_to_15_operand")
7319 (match_operand 4 "const_0_to_15_operand")
7320 (match_operand 5 "const_0_to_15_operand")]))
7321 (match_operand:<ssequartermode> 6 "memory_operand" "0")
7322 (match_operand:QI 7 "register_operand" "Yk")))]
7324 && INTVAL (operands[2]) % 4 == 0
7325 && INTVAL (operands[2]) == INTVAL (operands[3]) - 1
7326 && INTVAL (operands[3]) == INTVAL (operands[4]) - 1
7327 && INTVAL (operands[4]) == INTVAL (operands[5]) - 1
7328 && rtx_equal_p (operands[6], operands[0])"
7330 operands[2] = GEN_INT (INTVAL (operands[2]) >> 2);
7331 return "vextract<shuffletype>32x4\t{%2, %1, %0%{%7%}|%0%{%7%}, %1, %2}";
7333 [(set_attr "type" "sselog")
7334 (set_attr "prefix_extra" "1")
7335 (set_attr "length_immediate" "1")
7336 (set_attr "memory" "store")
7337 (set_attr "prefix" "evex")
7338 (set_attr "mode" "<sseinsnmode>")])
7340 (define_insn "<mask_codefor>avx512dq_vextract<shuffletype>64x2_1<mask_name>"
7341 [(set (match_operand:<ssequartermode> 0 "<store_mask_predicate>" "=<store_mask_constraint>")
7342 (vec_select:<ssequartermode>
7343 (match_operand:V8FI 1 "register_operand" "v")
7344 (parallel [(match_operand 2 "const_0_to_7_operand")
7345 (match_operand 3 "const_0_to_7_operand")])))]
7347 && INTVAL (operands[2]) % 2 == 0
7348 && INTVAL (operands[2]) == INTVAL (operands[3]) - 1"
7350 operands[2] = GEN_INT (INTVAL (operands[2]) >> 1);
7351 return "vextract<shuffletype>64x2\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}";
7353 [(set_attr "type" "sselog1")
7354 (set_attr "prefix_extra" "1")
7355 (set_attr "length_immediate" "1")
7356 (set_attr "prefix" "evex")
7357 (set_attr "mode" "<sseinsnmode>")])
7360 [(set (match_operand:<ssequartermode> 0 "nonimmediate_operand")
7361 (vec_select:<ssequartermode>
7362 (match_operand:V8FI 1 "register_operand")
7363 (parallel [(const_int 0) (const_int 1)])))]
7367 || REG_P (operands[0])
7368 || !EXT_REX_SSE_REG_P (operands[1]))"
7369 [(set (match_dup 0) (match_dup 1))]
7371 if (!TARGET_AVX512VL
7372 && REG_P (operands[0])
7373 && EXT_REX_SSE_REG_P (operands[1]))
7375 = lowpart_subreg (<MODE>mode, operands[0], <ssequartermode>mode);
7377 operands[1] = gen_lowpart (<ssequartermode>mode, operands[1]);
7380 (define_insn "<mask_codefor>avx512f_vextract<shuffletype>32x4_1<mask_name>"
7381 [(set (match_operand:<ssequartermode> 0 "<store_mask_predicate>" "=<store_mask_constraint>")
7382 (vec_select:<ssequartermode>
7383 (match_operand:V16FI 1 "register_operand" "v")
7384 (parallel [(match_operand 2 "const_0_to_15_operand")
7385 (match_operand 3 "const_0_to_15_operand")
7386 (match_operand 4 "const_0_to_15_operand")
7387 (match_operand 5 "const_0_to_15_operand")])))]
7389 && INTVAL (operands[2]) % 4 == 0
7390 && INTVAL (operands[2]) == INTVAL (operands[3]) - 1
7391 && INTVAL (operands[3]) == INTVAL (operands[4]) - 1
7392 && INTVAL (operands[4]) == INTVAL (operands[5]) - 1"
7394 operands[2] = GEN_INT (INTVAL (operands[2]) >> 2);
7395 return "vextract<shuffletype>32x4\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
7397 [(set_attr "type" "sselog1")
7398 (set_attr "prefix_extra" "1")
7399 (set_attr "length_immediate" "1")
7400 (set_attr "prefix" "evex")
7401 (set_attr "mode" "<sseinsnmode>")])
7404 [(set (match_operand:<ssequartermode> 0 "nonimmediate_operand")
7405 (vec_select:<ssequartermode>
7406 (match_operand:V16FI 1 "register_operand")
7407 (parallel [(const_int 0) (const_int 1)
7408 (const_int 2) (const_int 3)])))]
7412 || REG_P (operands[0])
7413 || !EXT_REX_SSE_REG_P (operands[1]))"
7414 [(set (match_dup 0) (match_dup 1))]
7416 if (!TARGET_AVX512VL
7417 && REG_P (operands[0])
7418 && EXT_REX_SSE_REG_P (operands[1]))
7420 = lowpart_subreg (<MODE>mode, operands[0], <ssequartermode>mode);
7422 operands[1] = gen_lowpart (<ssequartermode>mode, operands[1]);
7425 (define_mode_attr extract_type_2
7426 [(V16SF "avx512dq") (V16SI "avx512dq") (V8DF "avx512f") (V8DI "avx512f")])
7428 (define_mode_attr extract_suf_2
7429 [(V16SF "32x8") (V16SI "32x8") (V8DF "64x4") (V8DI "64x4")])
7431 (define_mode_iterator AVX512_VEC_2
7432 [(V16SF "TARGET_AVX512DQ") (V16SI "TARGET_AVX512DQ") V8DF V8DI])
7434 (define_expand "<extract_type_2>_vextract<shuffletype><extract_suf_2>_mask"
7435 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7436 (match_operand:AVX512_VEC_2 1 "register_operand")
7437 (match_operand:SI 2 "const_0_to_1_operand")
7438 (match_operand:<ssehalfvecmode> 3 "nonimmediate_operand")
7439 (match_operand:QI 4 "register_operand")]
7442 rtx (*insn)(rtx, rtx, rtx, rtx);
7443 rtx dest = operands[0];
7445 if (MEM_P (dest) && !rtx_equal_p (dest, operands[3]))
7446 dest = gen_reg_rtx (<ssehalfvecmode>mode);
7448 switch (INTVAL (operands[2]))
7451 insn = gen_vec_extract_lo_<mode>_mask;
7454 insn = gen_vec_extract_hi_<mode>_mask;
7460 emit_insn (insn (dest, operands[1], operands[3], operands[4]));
7461 if (dest != operands[0])
7462 emit_move_insn (operands[0], dest);
7467 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7468 (vec_select:<ssehalfvecmode>
7469 (match_operand:V8FI 1 "nonimmediate_operand")
7470 (parallel [(const_int 0) (const_int 1)
7471 (const_int 2) (const_int 3)])))]
7472 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))
7475 || (REG_P (operands[0]) && !EXT_REX_SSE_REG_P (operands[1])))"
7476 [(set (match_dup 0) (match_dup 1))]
7477 "operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);")
7479 (define_insn "vec_extract_lo_<mode>_maskm"
7480 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7481 (vec_merge:<ssehalfvecmode>
7482 (vec_select:<ssehalfvecmode>
7483 (match_operand:V8FI 1 "register_operand" "v")
7484 (parallel [(const_int 0) (const_int 1)
7485 (const_int 2) (const_int 3)]))
7486 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7487 (match_operand:QI 3 "register_operand" "Yk")))]
7489 && rtx_equal_p (operands[2], operands[0])"
7490 "vextract<shuffletype>64x4\t{$0x0, %1, %0%{%3%}|%0%{%3%}, %1, 0x0}"
7491 [(set_attr "type" "sselog1")
7492 (set_attr "prefix_extra" "1")
7493 (set_attr "length_immediate" "1")
7494 (set_attr "prefix" "evex")
7495 (set_attr "mode" "<sseinsnmode>")])
7497 (define_insn "vec_extract_lo_<mode><mask_name>"
7498 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=v,<store_mask_constraint>,v")
7499 (vec_select:<ssehalfvecmode>
7500 (match_operand:V8FI 1 "<store_mask_predicate>" "v,v,<store_mask_constraint>")
7501 (parallel [(const_int 0) (const_int 1)
7502 (const_int 2) (const_int 3)])))]
7504 && (<mask_applied> || !(MEM_P (operands[0]) && MEM_P (operands[1])))"
7506 if (<mask_applied> || (!TARGET_AVX512VL && !MEM_P (operands[1])))
7507 return "vextract<shuffletype>64x4\t{$0x0, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x0}";
7511 [(set_attr "type" "sselog1")
7512 (set_attr "prefix_extra" "1")
7513 (set_attr "length_immediate" "1")
7514 (set_attr "memory" "none,store,load")
7515 (set_attr "prefix" "evex")
7516 (set_attr "mode" "<sseinsnmode>")])
7518 (define_insn "vec_extract_hi_<mode>_maskm"
7519 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7520 (vec_merge:<ssehalfvecmode>
7521 (vec_select:<ssehalfvecmode>
7522 (match_operand:V8FI 1 "register_operand" "v")
7523 (parallel [(const_int 4) (const_int 5)
7524 (const_int 6) (const_int 7)]))
7525 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7526 (match_operand:QI 3 "register_operand" "Yk")))]
7528 && rtx_equal_p (operands[2], operands[0])"
7529 "vextract<shuffletype>64x4\t{$0x1, %1, %0%{%3%}|%0%{%3%}, %1, 0x1}"
7530 [(set_attr "type" "sselog")
7531 (set_attr "prefix_extra" "1")
7532 (set_attr "length_immediate" "1")
7533 (set_attr "memory" "store")
7534 (set_attr "prefix" "evex")
7535 (set_attr "mode" "<sseinsnmode>")])
7537 (define_insn "vec_extract_hi_<mode><mask_name>"
7538 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=<store_mask_constraint>")
7539 (vec_select:<ssehalfvecmode>
7540 (match_operand:V8FI 1 "register_operand" "v")
7541 (parallel [(const_int 4) (const_int 5)
7542 (const_int 6) (const_int 7)])))]
7544 "vextract<shuffletype>64x4\t{$0x1, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x1}"
7545 [(set_attr "type" "sselog1")
7546 (set_attr "prefix_extra" "1")
7547 (set_attr "length_immediate" "1")
7548 (set_attr "prefix" "evex")
7549 (set_attr "mode" "<sseinsnmode>")])
7551 (define_insn "vec_extract_hi_<mode>_maskm"
7552 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7553 (vec_merge:<ssehalfvecmode>
7554 (vec_select:<ssehalfvecmode>
7555 (match_operand:V16FI 1 "register_operand" "v")
7556 (parallel [(const_int 8) (const_int 9)
7557 (const_int 10) (const_int 11)
7558 (const_int 12) (const_int 13)
7559 (const_int 14) (const_int 15)]))
7560 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7561 (match_operand:QI 3 "register_operand" "Yk")))]
7563 && rtx_equal_p (operands[2], operands[0])"
7564 "vextract<shuffletype>32x8\t{$0x1, %1, %0%{%3%}|%0%{%3%}, %1, 0x1}"
7565 [(set_attr "type" "sselog1")
7566 (set_attr "prefix_extra" "1")
7567 (set_attr "length_immediate" "1")
7568 (set_attr "prefix" "evex")
7569 (set_attr "mode" "<sseinsnmode>")])
7571 (define_insn "vec_extract_hi_<mode><mask_name>"
7572 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=<store_mask_constraint>,vm")
7573 (vec_select:<ssehalfvecmode>
7574 (match_operand:V16FI 1 "register_operand" "v,v")
7575 (parallel [(const_int 8) (const_int 9)
7576 (const_int 10) (const_int 11)
7577 (const_int 12) (const_int 13)
7578 (const_int 14) (const_int 15)])))]
7579 "TARGET_AVX512F && <mask_avx512dq_condition>"
7581 vextract<shuffletype>32x8\t{$0x1, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x1}
7582 vextracti64x4\t{$0x1, %1, %0|%0, %1, 0x1}"
7583 [(set_attr "type" "sselog1")
7584 (set_attr "prefix_extra" "1")
7585 (set_attr "isa" "avx512dq,noavx512dq")
7586 (set_attr "length_immediate" "1")
7587 (set_attr "prefix" "evex")
7588 (set_attr "mode" "<sseinsnmode>")])
7590 (define_expand "avx512vl_vextractf128<mode>"
7591 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7592 (match_operand:VI48F_256 1 "register_operand")
7593 (match_operand:SI 2 "const_0_to_1_operand")
7594 (match_operand:<ssehalfvecmode> 3 "vector_move_operand")
7595 (match_operand:QI 4 "register_operand")]
7596 "TARGET_AVX512DQ && TARGET_AVX512VL"
7598 rtx (*insn)(rtx, rtx, rtx, rtx);
7599 rtx dest = operands[0];
7602 && (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 4
7603 /* For V8S[IF]mode there are maskm insns with =m and 0
7605 ? !rtx_equal_p (dest, operands[3])
7606 /* For V4D[IF]mode, hi insns don't allow memory, and
7607 lo insns have =m and 0C constraints. */
7608 : (operands[2] != const0_rtx
7609 || (!rtx_equal_p (dest, operands[3])
7610 && GET_CODE (operands[3]) != CONST_VECTOR))))
7611 dest = gen_reg_rtx (<ssehalfvecmode>mode);
7612 switch (INTVAL (operands[2]))
7615 insn = gen_vec_extract_lo_<mode>_mask;
7618 insn = gen_vec_extract_hi_<mode>_mask;
7624 emit_insn (insn (dest, operands[1], operands[3], operands[4]));
7625 if (dest != operands[0])
7626 emit_move_insn (operands[0], dest);
7630 (define_expand "avx_vextractf128<mode>"
7631 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7632 (match_operand:V_256 1 "register_operand")
7633 (match_operand:SI 2 "const_0_to_1_operand")]
7636 rtx (*insn)(rtx, rtx);
7638 switch (INTVAL (operands[2]))
7641 insn = gen_vec_extract_lo_<mode>;
7644 insn = gen_vec_extract_hi_<mode>;
7650 emit_insn (insn (operands[0], operands[1]));
7654 (define_insn "vec_extract_lo_<mode><mask_name>"
7655 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand" "=v,v,m")
7656 (vec_select:<ssehalfvecmode>
7657 (match_operand:V16FI 1 "<store_mask_predicate>"
7658 "v,<store_mask_constraint>,v")
7659 (parallel [(const_int 0) (const_int 1)
7660 (const_int 2) (const_int 3)
7661 (const_int 4) (const_int 5)
7662 (const_int 6) (const_int 7)])))]
7664 && <mask_mode512bit_condition>
7665 && (<mask_applied> || !(MEM_P (operands[0]) && MEM_P (operands[1])))"
7668 || (!TARGET_AVX512VL
7669 && !REG_P (operands[0])
7670 && EXT_REX_SSE_REG_P (operands[1])))
7671 return "vextract<shuffletype>32x8\t{$0x0, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x0}";
7675 [(set_attr "type" "sselog1")
7676 (set_attr "prefix_extra" "1")
7677 (set_attr "length_immediate" "1")
7678 (set_attr "memory" "none,load,store")
7679 (set_attr "prefix" "evex")
7680 (set_attr "mode" "<sseinsnmode>")])
7683 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7684 (vec_select:<ssehalfvecmode>
7685 (match_operand:V16FI 1 "nonimmediate_operand")
7686 (parallel [(const_int 0) (const_int 1)
7687 (const_int 2) (const_int 3)
7688 (const_int 4) (const_int 5)
7689 (const_int 6) (const_int 7)])))]
7690 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))
7693 || REG_P (operands[0])
7694 || !EXT_REX_SSE_REG_P (operands[1]))"
7695 [(set (match_dup 0) (match_dup 1))]
7697 if (!TARGET_AVX512VL
7698 && REG_P (operands[0])
7699 && EXT_REX_SSE_REG_P (operands[1]))
7701 = lowpart_subreg (<MODE>mode, operands[0], <ssehalfvecmode>mode);
7703 operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);
7706 (define_insn "vec_extract_lo_<mode><mask_name>"
7707 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=v,v,m")
7708 (vec_select:<ssehalfvecmode>
7709 (match_operand:VI8F_256 1 "<store_mask_predicate>"
7710 "v,<store_mask_constraint>,v")
7711 (parallel [(const_int 0) (const_int 1)])))]
7713 && <mask_avx512vl_condition> && <mask_avx512dq_condition>
7714 && (<mask_applied> || !(MEM_P (operands[0]) && MEM_P (operands[1])))"
7717 return "vextract<shuffletype>64x2\t{$0x0, %1, %0%{%3%}|%0%{%3%}, %1, 0x0}";
7721 [(set_attr "type" "sselog1")
7722 (set_attr "prefix_extra" "1")
7723 (set_attr "length_immediate" "1")
7724 (set_attr "memory" "none,load,store")
7725 (set_attr "prefix" "evex")
7726 (set_attr "mode" "XI")])
7729 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7730 (vec_select:<ssehalfvecmode>
7731 (match_operand:VI8F_256 1 "nonimmediate_operand")
7732 (parallel [(const_int 0) (const_int 1)])))]
7733 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))
7734 && reload_completed"
7735 [(set (match_dup 0) (match_dup 1))]
7736 "operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);")
7738 (define_insn "vec_extract_hi_<mode><mask_name>"
7739 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=v,<store_mask_constraint>")
7740 (vec_select:<ssehalfvecmode>
7741 (match_operand:VI8F_256 1 "register_operand" "v,v")
7742 (parallel [(const_int 2) (const_int 3)])))]
7743 "TARGET_AVX && <mask_avx512vl_condition> && <mask_avx512dq_condition>"
7745 if (TARGET_AVX512VL)
7747 if (TARGET_AVX512DQ)
7748 return "vextract<shuffletype>64x2\t{$0x1, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x1}";
7750 return "vextract<shuffletype>32x4\t{$0x1, %1, %0|%0, %1, 0x1}";
7753 return "vextract<i128>\t{$0x1, %1, %0|%0, %1, 0x1}";
7755 [(set_attr "type" "sselog1")
7756 (set_attr "prefix_extra" "1")
7757 (set_attr "length_immediate" "1")
7758 (set_attr "prefix" "vex")
7759 (set_attr "mode" "<sseinsnmode>")])
7762 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7763 (vec_select:<ssehalfvecmode>
7764 (match_operand:VI4F_256 1 "nonimmediate_operand")
7765 (parallel [(const_int 0) (const_int 1)
7766 (const_int 2) (const_int 3)])))]
7767 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))
7768 && reload_completed"
7769 [(set (match_dup 0) (match_dup 1))]
7770 "operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);")
7772 (define_insn "vec_extract_lo_<mode><mask_name>"
7773 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>"
7774 "=<store_mask_constraint>,v")
7775 (vec_select:<ssehalfvecmode>
7776 (match_operand:VI4F_256 1 "<store_mask_predicate>"
7777 "v,<store_mask_constraint>")
7778 (parallel [(const_int 0) (const_int 1)
7779 (const_int 2) (const_int 3)])))]
7781 && <mask_avx512vl_condition> && <mask_avx512dq_condition>
7782 && (<mask_applied> || !(MEM_P (operands[0]) && MEM_P (operands[1])))"
7785 return "vextract<shuffletype>32x4\t{$0x0, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x0}";
7789 [(set_attr "type" "sselog1")
7790 (set_attr "prefix_extra" "1")
7791 (set_attr "length_immediate" "1")
7792 (set_attr "prefix" "evex")
7793 (set_attr "mode" "<sseinsnmode>")])
7795 (define_insn "vec_extract_lo_<mode>_maskm"
7796 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7797 (vec_merge:<ssehalfvecmode>
7798 (vec_select:<ssehalfvecmode>
7799 (match_operand:VI4F_256 1 "register_operand" "v")
7800 (parallel [(const_int 0) (const_int 1)
7801 (const_int 2) (const_int 3)]))
7802 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7803 (match_operand:QI 3 "register_operand" "Yk")))]
7804 "TARGET_AVX512VL && TARGET_AVX512F
7805 && rtx_equal_p (operands[2], operands[0])"
7806 "vextract<shuffletype>32x4\t{$0x0, %1, %0%{%3%}|%0%{%3%}, %1, 0x0}"
7807 [(set_attr "type" "sselog1")
7808 (set_attr "prefix_extra" "1")
7809 (set_attr "length_immediate" "1")
7810 (set_attr "prefix" "evex")
7811 (set_attr "mode" "<sseinsnmode>")])
7813 (define_insn "vec_extract_hi_<mode>_maskm"
7814 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7815 (vec_merge:<ssehalfvecmode>
7816 (vec_select:<ssehalfvecmode>
7817 (match_operand:VI4F_256 1 "register_operand" "v")
7818 (parallel [(const_int 4) (const_int 5)
7819 (const_int 6) (const_int 7)]))
7820 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7821 (match_operand:<ssehalfvecmode> 3 "register_operand" "Yk")))]
7822 "TARGET_AVX512F && TARGET_AVX512VL
7823 && rtx_equal_p (operands[2], operands[0])"
7824 "vextract<shuffletype>32x4\t{$0x1, %1, %0%{%3%}|%0%{%3%}, %1, 0x1}"
7825 [(set_attr "type" "sselog1")
7826 (set_attr "length_immediate" "1")
7827 (set_attr "prefix" "evex")
7828 (set_attr "mode" "<sseinsnmode>")])
7830 (define_insn "vec_extract_hi_<mode>_mask"
7831 [(set (match_operand:<ssehalfvecmode> 0 "register_operand" "=v")
7832 (vec_merge:<ssehalfvecmode>
7833 (vec_select:<ssehalfvecmode>
7834 (match_operand:VI4F_256 1 "register_operand" "v")
7835 (parallel [(const_int 4) (const_int 5)
7836 (const_int 6) (const_int 7)]))
7837 (match_operand:<ssehalfvecmode> 2 "vector_move_operand" "0C")
7838 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
7840 "vextract<shuffletype>32x4\t{$0x1, %1, %0%{%3%}%N2|%0%{%3%}%N2, %1, 0x1}"
7841 [(set_attr "type" "sselog1")
7842 (set_attr "length_immediate" "1")
7843 (set_attr "prefix" "evex")
7844 (set_attr "mode" "<sseinsnmode>")])
7846 (define_insn "vec_extract_hi_<mode>"
7847 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand" "=xm, vm")
7848 (vec_select:<ssehalfvecmode>
7849 (match_operand:VI4F_256 1 "register_operand" "x, v")
7850 (parallel [(const_int 4) (const_int 5)
7851 (const_int 6) (const_int 7)])))]
7854 vextract<i128>\t{$0x1, %1, %0|%0, %1, 0x1}
7855 vextract<shuffletype>32x4\t{$0x1, %1, %0|%0, %1, 0x1}"
7856 [(set_attr "isa" "*, avx512vl")
7857 (set_attr "prefix" "vex, evex")
7858 (set_attr "type" "sselog1")
7859 (set_attr "length_immediate" "1")
7860 (set_attr "mode" "<sseinsnmode>")])
7862 (define_insn_and_split "vec_extract_lo_v32hi"
7863 [(set (match_operand:V16HI 0 "nonimmediate_operand" "=v,v,m")
7865 (match_operand:V32HI 1 "nonimmediate_operand" "v,m,v")
7866 (parallel [(const_int 0) (const_int 1)
7867 (const_int 2) (const_int 3)
7868 (const_int 4) (const_int 5)
7869 (const_int 6) (const_int 7)
7870 (const_int 8) (const_int 9)
7871 (const_int 10) (const_int 11)
7872 (const_int 12) (const_int 13)
7873 (const_int 14) (const_int 15)])))]
7874 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7877 || REG_P (operands[0])
7878 || !EXT_REX_SSE_REG_P (operands[1]))
7881 return "vextracti64x4\t{$0x0, %1, %0|%0, %1, 0x0}";
7883 "&& reload_completed
7885 || REG_P (operands[0])
7886 || !EXT_REX_SSE_REG_P (operands[1]))"
7887 [(set (match_dup 0) (match_dup 1))]
7889 if (!TARGET_AVX512VL
7890 && REG_P (operands[0])
7891 && EXT_REX_SSE_REG_P (operands[1]))
7892 operands[0] = lowpart_subreg (V32HImode, operands[0], V16HImode);
7894 operands[1] = gen_lowpart (V16HImode, operands[1]);
7896 [(set_attr "type" "sselog1")
7897 (set_attr "prefix_extra" "1")
7898 (set_attr "length_immediate" "1")
7899 (set_attr "memory" "none,load,store")
7900 (set_attr "prefix" "evex")
7901 (set_attr "mode" "XI")])
7903 (define_insn "vec_extract_hi_v32hi"
7904 [(set (match_operand:V16HI 0 "nonimmediate_operand" "=vm")
7906 (match_operand:V32HI 1 "register_operand" "v")
7907 (parallel [(const_int 16) (const_int 17)
7908 (const_int 18) (const_int 19)
7909 (const_int 20) (const_int 21)
7910 (const_int 22) (const_int 23)
7911 (const_int 24) (const_int 25)
7912 (const_int 26) (const_int 27)
7913 (const_int 28) (const_int 29)
7914 (const_int 30) (const_int 31)])))]
7916 "vextracti64x4\t{$0x1, %1, %0|%0, %1, 0x1}"
7917 [(set_attr "type" "sselog1")
7918 (set_attr "prefix_extra" "1")
7919 (set_attr "length_immediate" "1")
7920 (set_attr "prefix" "evex")
7921 (set_attr "mode" "XI")])
7923 (define_insn_and_split "vec_extract_lo_v16hi"
7924 [(set (match_operand:V8HI 0 "nonimmediate_operand" "=v,m")
7926 (match_operand:V16HI 1 "nonimmediate_operand" "vm,v")
7927 (parallel [(const_int 0) (const_int 1)
7928 (const_int 2) (const_int 3)
7929 (const_int 4) (const_int 5)
7930 (const_int 6) (const_int 7)])))]
7931 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7933 "&& reload_completed"
7934 [(set (match_dup 0) (match_dup 1))]
7935 "operands[1] = gen_lowpart (V8HImode, operands[1]);")
7937 (define_insn "vec_extract_hi_v16hi"
7938 [(set (match_operand:V8HI 0 "nonimmediate_operand" "=xm,vm,vm")
7940 (match_operand:V16HI 1 "register_operand" "x,v,v")
7941 (parallel [(const_int 8) (const_int 9)
7942 (const_int 10) (const_int 11)
7943 (const_int 12) (const_int 13)
7944 (const_int 14) (const_int 15)])))]
7947 vextract%~128\t{$0x1, %1, %0|%0, %1, 0x1}
7948 vextracti32x4\t{$0x1, %1, %0|%0, %1, 0x1}
7949 vextracti32x4\t{$0x1, %g1, %0|%0, %g1, 0x1}"
7950 [(set_attr "type" "sselog1")
7951 (set_attr "prefix_extra" "1")
7952 (set_attr "length_immediate" "1")
7953 (set_attr "isa" "*,avx512dq,avx512f")
7954 (set_attr "prefix" "vex,evex,evex")
7955 (set_attr "mode" "OI")])
7957 (define_insn_and_split "vec_extract_lo_v64qi"
7958 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=v,v,m")
7960 (match_operand:V64QI 1 "nonimmediate_operand" "v,m,v")
7961 (parallel [(const_int 0) (const_int 1)
7962 (const_int 2) (const_int 3)
7963 (const_int 4) (const_int 5)
7964 (const_int 6) (const_int 7)
7965 (const_int 8) (const_int 9)
7966 (const_int 10) (const_int 11)
7967 (const_int 12) (const_int 13)
7968 (const_int 14) (const_int 15)
7969 (const_int 16) (const_int 17)
7970 (const_int 18) (const_int 19)
7971 (const_int 20) (const_int 21)
7972 (const_int 22) (const_int 23)
7973 (const_int 24) (const_int 25)
7974 (const_int 26) (const_int 27)
7975 (const_int 28) (const_int 29)
7976 (const_int 30) (const_int 31)])))]
7977 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7980 || REG_P (operands[0])
7981 || !EXT_REX_SSE_REG_P (operands[1]))
7984 return "vextracti64x4\t{$0x0, %1, %0|%0, %1, 0x0}";
7986 "&& reload_completed
7988 || REG_P (operands[0])
7989 || !EXT_REX_SSE_REG_P (operands[1]))"
7990 [(set (match_dup 0) (match_dup 1))]
7992 if (!TARGET_AVX512VL
7993 && REG_P (operands[0])
7994 && EXT_REX_SSE_REG_P (operands[1]))
7995 operands[0] = lowpart_subreg (V64QImode, operands[0], V32QImode);
7997 operands[1] = gen_lowpart (V32QImode, operands[1]);
7999 [(set_attr "type" "sselog1")
8000 (set_attr "prefix_extra" "1")
8001 (set_attr "length_immediate" "1")
8002 (set_attr "memory" "none,load,store")
8003 (set_attr "prefix" "evex")
8004 (set_attr "mode" "XI")])
8006 (define_insn "vec_extract_hi_v64qi"
8007 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=vm")
8009 (match_operand:V64QI 1 "register_operand" "v")
8010 (parallel [(const_int 32) (const_int 33)
8011 (const_int 34) (const_int 35)
8012 (const_int 36) (const_int 37)
8013 (const_int 38) (const_int 39)
8014 (const_int 40) (const_int 41)
8015 (const_int 42) (const_int 43)
8016 (const_int 44) (const_int 45)
8017 (const_int 46) (const_int 47)
8018 (const_int 48) (const_int 49)
8019 (const_int 50) (const_int 51)
8020 (const_int 52) (const_int 53)
8021 (const_int 54) (const_int 55)
8022 (const_int 56) (const_int 57)
8023 (const_int 58) (const_int 59)
8024 (const_int 60) (const_int 61)
8025 (const_int 62) (const_int 63)])))]
8027 "vextracti64x4\t{$0x1, %1, %0|%0, %1, 0x1}"
8028 [(set_attr "type" "sselog1")
8029 (set_attr "prefix_extra" "1")
8030 (set_attr "length_immediate" "1")
8031 (set_attr "prefix" "evex")
8032 (set_attr "mode" "XI")])
8034 (define_insn_and_split "vec_extract_lo_v32qi"
8035 [(set (match_operand:V16QI 0 "nonimmediate_operand" "=v,m")
8037 (match_operand:V32QI 1 "nonimmediate_operand" "vm,v")
8038 (parallel [(const_int 0) (const_int 1)
8039 (const_int 2) (const_int 3)
8040 (const_int 4) (const_int 5)
8041 (const_int 6) (const_int 7)
8042 (const_int 8) (const_int 9)
8043 (const_int 10) (const_int 11)
8044 (const_int 12) (const_int 13)
8045 (const_int 14) (const_int 15)])))]
8046 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
8048 "&& reload_completed"
8049 [(set (match_dup 0) (match_dup 1))]
8050 "operands[1] = gen_lowpart (V16QImode, operands[1]);")
8052 (define_insn "vec_extract_hi_v32qi"
8053 [(set (match_operand:V16QI 0 "nonimmediate_operand" "=xm,vm,vm")
8055 (match_operand:V32QI 1 "register_operand" "x,v,v")
8056 (parallel [(const_int 16) (const_int 17)
8057 (const_int 18) (const_int 19)
8058 (const_int 20) (const_int 21)
8059 (const_int 22) (const_int 23)
8060 (const_int 24) (const_int 25)
8061 (const_int 26) (const_int 27)
8062 (const_int 28) (const_int 29)
8063 (const_int 30) (const_int 31)])))]
8066 vextract%~128\t{$0x1, %1, %0|%0, %1, 0x1}
8067 vextracti32x4\t{$0x1, %1, %0|%0, %1, 0x1}
8068 vextracti32x4\t{$0x1, %g1, %0|%0, %g1, 0x1}"
8069 [(set_attr "type" "sselog1")
8070 (set_attr "prefix_extra" "1")
8071 (set_attr "length_immediate" "1")
8072 (set_attr "isa" "*,avx512dq,avx512f")
8073 (set_attr "prefix" "vex,evex,evex")
8074 (set_attr "mode" "OI")])
8076 ;; Modes handled by vec_extract patterns.
8077 (define_mode_iterator VEC_EXTRACT_MODE
8078 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX") V16QI
8079 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX") V8HI
8080 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
8081 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI
8082 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
8083 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") V2DF
8084 (V4TI "TARGET_AVX512F") (V2TI "TARGET_AVX")])
8086 (define_expand "vec_extract<mode><ssescalarmodelower>"
8087 [(match_operand:<ssescalarmode> 0 "register_operand")
8088 (match_operand:VEC_EXTRACT_MODE 1 "register_operand")
8089 (match_operand 2 "const_int_operand")]
8092 ix86_expand_vector_extract (false, operands[0], operands[1],
8093 INTVAL (operands[2]));
8097 (define_expand "vec_extract<mode><ssehalfvecmodelower>"
8098 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
8099 (match_operand:V_512 1 "register_operand")
8100 (match_operand 2 "const_0_to_1_operand")]
8103 if (INTVAL (operands[2]))
8104 emit_insn (gen_vec_extract_hi_<mode> (operands[0], operands[1]));
8106 emit_insn (gen_vec_extract_lo_<mode> (operands[0], operands[1]));
8110 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8112 ;; Parallel double-precision floating point element swizzling
8114 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8116 (define_insn "<mask_codefor>avx512f_unpckhpd512<mask_name>"
8117 [(set (match_operand:V8DF 0 "register_operand" "=v")
8120 (match_operand:V8DF 1 "register_operand" "v")
8121 (match_operand:V8DF 2 "nonimmediate_operand" "vm"))
8122 (parallel [(const_int 1) (const_int 9)
8123 (const_int 3) (const_int 11)
8124 (const_int 5) (const_int 13)
8125 (const_int 7) (const_int 15)])))]
8127 "vunpckhpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8128 [(set_attr "type" "sselog")
8129 (set_attr "prefix" "evex")
8130 (set_attr "mode" "V8DF")])
8132 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
8133 (define_insn "avx_unpckhpd256<mask_name>"
8134 [(set (match_operand:V4DF 0 "register_operand" "=v")
8137 (match_operand:V4DF 1 "register_operand" "v")
8138 (match_operand:V4DF 2 "nonimmediate_operand" "vm"))
8139 (parallel [(const_int 1) (const_int 5)
8140 (const_int 3) (const_int 7)])))]
8141 "TARGET_AVX && <mask_avx512vl_condition>"
8142 "vunpckhpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8143 [(set_attr "type" "sselog")
8144 (set_attr "prefix" "vex")
8145 (set_attr "mode" "V4DF")])
8147 (define_expand "vec_interleave_highv4df"
8151 (match_operand:V4DF 1 "register_operand")
8152 (match_operand:V4DF 2 "nonimmediate_operand"))
8153 (parallel [(const_int 0) (const_int 4)
8154 (const_int 2) (const_int 6)])))
8160 (parallel [(const_int 1) (const_int 5)
8161 (const_int 3) (const_int 7)])))
8162 (set (match_operand:V4DF 0 "register_operand")
8167 (parallel [(const_int 2) (const_int 3)
8168 (const_int 6) (const_int 7)])))]
8171 operands[3] = gen_reg_rtx (V4DFmode);
8172 operands[4] = gen_reg_rtx (V4DFmode);
8176 (define_insn "avx512vl_unpckhpd128_mask"
8177 [(set (match_operand:V2DF 0 "register_operand" "=v")
8181 (match_operand:V2DF 1 "register_operand" "v")
8182 (match_operand:V2DF 2 "nonimmediate_operand" "vm"))
8183 (parallel [(const_int 1) (const_int 3)]))
8184 (match_operand:V2DF 3 "vector_move_operand" "0C")
8185 (match_operand:QI 4 "register_operand" "Yk")))]
8187 "vunpckhpd\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
8188 [(set_attr "type" "sselog")
8189 (set_attr "prefix" "evex")
8190 (set_attr "mode" "V2DF")])
8192 (define_expand "vec_interleave_highv2df"
8193 [(set (match_operand:V2DF 0 "register_operand")
8196 (match_operand:V2DF 1 "nonimmediate_operand")
8197 (match_operand:V2DF 2 "nonimmediate_operand"))
8198 (parallel [(const_int 1)
8202 if (!ix86_vec_interleave_v2df_operator_ok (operands, 1))
8203 operands[2] = force_reg (V2DFmode, operands[2]);
8206 (define_insn "*vec_interleave_highv2df"
8207 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,v,v,x,v,m")
8210 (match_operand:V2DF 1 "nonimmediate_operand" " 0,v,o,o,o,v")
8211 (match_operand:V2DF 2 "nonimmediate_operand" " x,v,1,0,v,0"))
8212 (parallel [(const_int 1)
8214 "TARGET_SSE2 && ix86_vec_interleave_v2df_operator_ok (operands, 1)"
8216 unpckhpd\t{%2, %0|%0, %2}
8217 vunpckhpd\t{%2, %1, %0|%0, %1, %2}
8218 %vmovddup\t{%H1, %0|%0, %H1}
8219 movlpd\t{%H1, %0|%0, %H1}
8220 vmovlpd\t{%H1, %2, %0|%0, %2, %H1}
8221 %vmovhpd\t{%1, %0|%q0, %1}"
8222 [(set_attr "isa" "noavx,avx,sse3,noavx,avx,*")
8223 (set_attr "type" "sselog,sselog,sselog,ssemov,ssemov,ssemov")
8224 (set (attr "prefix_data16")
8225 (if_then_else (eq_attr "alternative" "3,5")
8227 (const_string "*")))
8228 (set_attr "prefix" "orig,maybe_evex,maybe_vex,orig,maybe_evex,maybe_vex")
8229 (set_attr "mode" "V2DF,V2DF,DF,V1DF,V1DF,V1DF")])
8231 (define_expand "avx512f_movddup512<mask_name>"
8232 [(set (match_operand:V8DF 0 "register_operand")
8235 (match_operand:V8DF 1 "nonimmediate_operand")
8237 (parallel [(const_int 0) (const_int 8)
8238 (const_int 2) (const_int 10)
8239 (const_int 4) (const_int 12)
8240 (const_int 6) (const_int 14)])))]
8243 (define_expand "avx512f_unpcklpd512<mask_name>"
8244 [(set (match_operand:V8DF 0 "register_operand")
8247 (match_operand:V8DF 1 "register_operand")
8248 (match_operand:V8DF 2 "nonimmediate_operand"))
8249 (parallel [(const_int 0) (const_int 8)
8250 (const_int 2) (const_int 10)
8251 (const_int 4) (const_int 12)
8252 (const_int 6) (const_int 14)])))]
8255 (define_insn "*avx512f_unpcklpd512<mask_name>"
8256 [(set (match_operand:V8DF 0 "register_operand" "=v,v")
8259 (match_operand:V8DF 1 "nonimmediate_operand" "vm, v")
8260 (match_operand:V8DF 2 "nonimmediate_operand" "1 ,vm"))
8261 (parallel [(const_int 0) (const_int 8)
8262 (const_int 2) (const_int 10)
8263 (const_int 4) (const_int 12)
8264 (const_int 6) (const_int 14)])))]
8267 vmovddup\t{%1, %0<mask_operand3>|%0<mask_operand3>, %1}
8268 vunpcklpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8269 [(set_attr "type" "sselog")
8270 (set_attr "prefix" "evex")
8271 (set_attr "mode" "V8DF")])
8273 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
8274 (define_expand "avx_movddup256<mask_name>"
8275 [(set (match_operand:V4DF 0 "register_operand")
8278 (match_operand:V4DF 1 "nonimmediate_operand")
8280 (parallel [(const_int 0) (const_int 4)
8281 (const_int 2) (const_int 6)])))]
8282 "TARGET_AVX && <mask_avx512vl_condition>")
8284 (define_expand "avx_unpcklpd256<mask_name>"
8285 [(set (match_operand:V4DF 0 "register_operand")
8288 (match_operand:V4DF 1 "register_operand")
8289 (match_operand:V4DF 2 "nonimmediate_operand"))
8290 (parallel [(const_int 0) (const_int 4)
8291 (const_int 2) (const_int 6)])))]
8292 "TARGET_AVX && <mask_avx512vl_condition>")
8294 (define_insn "*avx_unpcklpd256<mask_name>"
8295 [(set (match_operand:V4DF 0 "register_operand" "=v,v")
8298 (match_operand:V4DF 1 "nonimmediate_operand" " v,m")
8299 (match_operand:V4DF 2 "nonimmediate_operand" "vm,1"))
8300 (parallel [(const_int 0) (const_int 4)
8301 (const_int 2) (const_int 6)])))]
8302 "TARGET_AVX && <mask_avx512vl_condition>"
8304 vunpcklpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
8305 vmovddup\t{%1, %0<mask_operand3>|%0<mask_operand3>, %1}"
8306 [(set_attr "type" "sselog")
8307 (set_attr "prefix" "vex")
8308 (set_attr "mode" "V4DF")])
8310 (define_expand "vec_interleave_lowv4df"
8314 (match_operand:V4DF 1 "register_operand")
8315 (match_operand:V4DF 2 "nonimmediate_operand"))
8316 (parallel [(const_int 0) (const_int 4)
8317 (const_int 2) (const_int 6)])))
8323 (parallel [(const_int 1) (const_int 5)
8324 (const_int 3) (const_int 7)])))
8325 (set (match_operand:V4DF 0 "register_operand")
8330 (parallel [(const_int 0) (const_int 1)
8331 (const_int 4) (const_int 5)])))]
8334 operands[3] = gen_reg_rtx (V4DFmode);
8335 operands[4] = gen_reg_rtx (V4DFmode);
8338 (define_insn "avx512vl_unpcklpd128_mask"
8339 [(set (match_operand:V2DF 0 "register_operand" "=v")
8343 (match_operand:V2DF 1 "register_operand" "v")
8344 (match_operand:V2DF 2 "nonimmediate_operand" "vm"))
8345 (parallel [(const_int 0) (const_int 2)]))
8346 (match_operand:V2DF 3 "vector_move_operand" "0C")
8347 (match_operand:QI 4 "register_operand" "Yk")))]
8349 "vunpcklpd\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
8350 [(set_attr "type" "sselog")
8351 (set_attr "prefix" "evex")
8352 (set_attr "mode" "V2DF")])
8354 (define_expand "vec_interleave_lowv2df"
8355 [(set (match_operand:V2DF 0 "register_operand")
8358 (match_operand:V2DF 1 "nonimmediate_operand")
8359 (match_operand:V2DF 2 "nonimmediate_operand"))
8360 (parallel [(const_int 0)
8364 if (!ix86_vec_interleave_v2df_operator_ok (operands, 0))
8365 operands[1] = force_reg (V2DFmode, operands[1]);
8368 (define_insn "*vec_interleave_lowv2df"
8369 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,v,v,x,v,o")
8372 (match_operand:V2DF 1 "nonimmediate_operand" " 0,v,m,0,v,0")
8373 (match_operand:V2DF 2 "nonimmediate_operand" " x,v,1,m,m,v"))
8374 (parallel [(const_int 0)
8376 "TARGET_SSE2 && ix86_vec_interleave_v2df_operator_ok (operands, 0)"
8378 unpcklpd\t{%2, %0|%0, %2}
8379 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
8380 %vmovddup\t{%1, %0|%0, %q1}
8381 movhpd\t{%2, %0|%0, %q2}
8382 vmovhpd\t{%2, %1, %0|%0, %1, %q2}
8383 %vmovlpd\t{%2, %H0|%H0, %2}"
8384 [(set_attr "isa" "noavx,avx,sse3,noavx,avx,*")
8385 (set_attr "type" "sselog,sselog,sselog,ssemov,ssemov,ssemov")
8386 (set (attr "prefix_data16")
8387 (if_then_else (eq_attr "alternative" "3,5")
8389 (const_string "*")))
8390 (set_attr "prefix" "orig,maybe_evex,maybe_vex,orig,maybe_evex,maybe_vex")
8391 (set_attr "mode" "V2DF,V2DF,DF,V1DF,V1DF,V1DF")])
8394 [(set (match_operand:V2DF 0 "memory_operand")
8397 (match_operand:V2DF 1 "register_operand")
8399 (parallel [(const_int 0)
8401 "TARGET_SSE3 && reload_completed"
8404 rtx low = gen_lowpart (DFmode, operands[1]);
8406 emit_move_insn (adjust_address (operands[0], DFmode, 0), low);
8407 emit_move_insn (adjust_address (operands[0], DFmode, 8), low);
8412 [(set (match_operand:V2DF 0 "register_operand")
8415 (match_operand:V2DF 1 "memory_operand")
8417 (parallel [(match_operand:SI 2 "const_0_to_1_operand")
8418 (match_operand:SI 3 "const_int_operand")])))]
8419 "TARGET_SSE3 && INTVAL (operands[2]) + 2 == INTVAL (operands[3])"
8420 [(set (match_dup 0) (vec_duplicate:V2DF (match_dup 1)))]
8422 operands[1] = adjust_address (operands[1], DFmode, INTVAL (operands[2]) * 8);
8425 (define_insn "avx512f_vmscalef<mode><mask_scalar_name><round_scalar_name>"
8426 [(set (match_operand:VF_128 0 "register_operand" "=v")
8429 [(match_operand:VF_128 1 "register_operand" "v")
8430 (match_operand:VF_128 2 "<round_scalar_nimm_predicate>" "<round_scalar_constraint>")]
8435 "vscalef<ssescalarmodesuffix>\t{<round_scalar_mask_op3>%2, %1, %0<mask_scalar_operand3>|%0<mask_scalar_operand3>, %1, %2<round_scalar_mask_op3>}"
8436 [(set_attr "prefix" "evex")
8437 (set_attr "mode" "<ssescalarmode>")])
8439 (define_insn "<avx512>_scalef<mode><mask_name><round_name>"
8440 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8442 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
8443 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")]
8446 "vscalef<ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
8447 [(set_attr "prefix" "evex")
8448 (set_attr "mode" "<MODE>")])
8450 (define_expand "<avx512>_vternlog<mode>_maskz"
8451 [(match_operand:VI48_AVX512VL 0 "register_operand")
8452 (match_operand:VI48_AVX512VL 1 "register_operand")
8453 (match_operand:VI48_AVX512VL 2 "register_operand")
8454 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand")
8455 (match_operand:SI 4 "const_0_to_255_operand")
8456 (match_operand:<avx512fmaskmode> 5 "register_operand")]
8459 emit_insn (gen_<avx512>_vternlog<mode>_maskz_1 (
8460 operands[0], operands[1], operands[2], operands[3],
8461 operands[4], CONST0_RTX (<MODE>mode), operands[5]));
8465 (define_insn "<avx512>_vternlog<mode><sd_maskz_name>"
8466 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
8467 (unspec:VI48_AVX512VL
8468 [(match_operand:VI48_AVX512VL 1 "register_operand" "0")
8469 (match_operand:VI48_AVX512VL 2 "register_operand" "v")
8470 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand" "vm")
8471 (match_operand:SI 4 "const_0_to_255_operand")]
8474 "vpternlog<ssemodesuffix>\t{%4, %3, %2, %0<sd_mask_op5>|%0<sd_mask_op5>, %2, %3, %4}"
8475 [(set_attr "type" "sselog")
8476 (set_attr "prefix" "evex")
8477 (set_attr "mode" "<sseinsnmode>")])
8479 (define_insn "<avx512>_vternlog<mode>_mask"
8480 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
8481 (vec_merge:VI48_AVX512VL
8482 (unspec:VI48_AVX512VL
8483 [(match_operand:VI48_AVX512VL 1 "register_operand" "0")
8484 (match_operand:VI48_AVX512VL 2 "register_operand" "v")
8485 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand" "vm")
8486 (match_operand:SI 4 "const_0_to_255_operand")]
8489 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
8491 "vpternlog<ssemodesuffix>\t{%4, %3, %2, %0%{%5%}|%0%{%5%}, %2, %3, %4}"
8492 [(set_attr "type" "sselog")
8493 (set_attr "prefix" "evex")
8494 (set_attr "mode" "<sseinsnmode>")])
8496 (define_insn "<avx512>_getexp<mode><mask_name><round_saeonly_name>"
8497 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8498 (unspec:VF_AVX512VL [(match_operand:VF_AVX512VL 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
8501 "vgetexp<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}";
8502 [(set_attr "prefix" "evex")
8503 (set_attr "mode" "<MODE>")])
8505 (define_insn "avx512f_sgetexp<mode><mask_scalar_name><round_saeonly_scalar_name>"
8506 [(set (match_operand:VF_128 0 "register_operand" "=v")
8509 [(match_operand:VF_128 1 "register_operand" "v")
8510 (match_operand:VF_128 2 "<round_saeonly_scalar_nimm_predicate>" "<round_saeonly_scalar_constraint>")]
8515 "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>}";
8516 [(set_attr "prefix" "evex")
8517 (set_attr "mode" "<ssescalarmode>")])
8519 (define_insn "<mask_codefor><avx512>_align<mode><mask_name>"
8520 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
8521 (unspec:VI48_AVX512VL [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
8522 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")
8523 (match_operand:SI 3 "const_0_to_255_operand")]
8526 "valign<ssemodesuffix>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3}";
8527 [(set_attr "prefix" "evex")
8528 (set_attr "mode" "<sseinsnmode>")])
8530 (define_expand "avx512f_shufps512_mask"
8531 [(match_operand:V16SF 0 "register_operand")
8532 (match_operand:V16SF 1 "register_operand")
8533 (match_operand:V16SF 2 "nonimmediate_operand")
8534 (match_operand:SI 3 "const_0_to_255_operand")
8535 (match_operand:V16SF 4 "register_operand")
8536 (match_operand:HI 5 "register_operand")]
8539 int mask = INTVAL (operands[3]);
8540 emit_insn (gen_avx512f_shufps512_1_mask (operands[0], operands[1], operands[2],
8541 GEN_INT ((mask >> 0) & 3),
8542 GEN_INT ((mask >> 2) & 3),
8543 GEN_INT (((mask >> 4) & 3) + 16),
8544 GEN_INT (((mask >> 6) & 3) + 16),
8545 GEN_INT (((mask >> 0) & 3) + 4),
8546 GEN_INT (((mask >> 2) & 3) + 4),
8547 GEN_INT (((mask >> 4) & 3) + 20),
8548 GEN_INT (((mask >> 6) & 3) + 20),
8549 GEN_INT (((mask >> 0) & 3) + 8),
8550 GEN_INT (((mask >> 2) & 3) + 8),
8551 GEN_INT (((mask >> 4) & 3) + 24),
8552 GEN_INT (((mask >> 6) & 3) + 24),
8553 GEN_INT (((mask >> 0) & 3) + 12),
8554 GEN_INT (((mask >> 2) & 3) + 12),
8555 GEN_INT (((mask >> 4) & 3) + 28),
8556 GEN_INT (((mask >> 6) & 3) + 28),
8557 operands[4], operands[5]));
8562 (define_expand "<avx512>_fixupimm<mode>_maskz<round_saeonly_expand_name>"
8563 [(match_operand:VF_AVX512VL 0 "register_operand")
8564 (match_operand:VF_AVX512VL 1 "register_operand")
8565 (match_operand:VF_AVX512VL 2 "register_operand")
8566 (match_operand:<sseintvecmode> 3 "<round_saeonly_expand_nimm_predicate>")
8567 (match_operand:SI 4 "const_0_to_255_operand")
8568 (match_operand:<avx512fmaskmode> 5 "register_operand")]
8571 emit_insn (gen_<avx512>_fixupimm<mode>_maskz_1<round_saeonly_expand_name> (
8572 operands[0], operands[1], operands[2], operands[3],
8573 operands[4], CONST0_RTX (<MODE>mode), operands[5]
8574 <round_saeonly_expand_operand6>));
8578 (define_insn "<avx512>_fixupimm<mode><sd_maskz_name><round_saeonly_name>"
8579 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8581 [(match_operand:VF_AVX512VL 1 "register_operand" "0")
8582 (match_operand:VF_AVX512VL 2 "register_operand" "v")
8583 (match_operand:<sseintvecmode> 3 "nonimmediate_operand" "<round_saeonly_constraint>")
8584 (match_operand:SI 4 "const_0_to_255_operand")]
8587 "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}";
8588 [(set_attr "prefix" "evex")
8589 (set_attr "mode" "<MODE>")])
8591 (define_insn "<avx512>_fixupimm<mode>_mask<round_saeonly_name>"
8592 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8593 (vec_merge:VF_AVX512VL
8595 [(match_operand:VF_AVX512VL 1 "register_operand" "0")
8596 (match_operand:VF_AVX512VL 2 "register_operand" "v")
8597 (match_operand:<sseintvecmode> 3 "nonimmediate_operand" "<round_saeonly_constraint>")
8598 (match_operand:SI 4 "const_0_to_255_operand")]
8601 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
8603 "vfixupimm<ssemodesuffix>\t{%4, <round_saeonly_op6>%3, %2, %0%{%5%}|%0%{%5%}, %2, %3<round_saeonly_op6>, %4}";
8604 [(set_attr "prefix" "evex")
8605 (set_attr "mode" "<MODE>")])
8607 (define_expand "avx512f_sfixupimm<mode>_maskz<round_saeonly_expand_name>"
8608 [(match_operand:VF_128 0 "register_operand")
8609 (match_operand:VF_128 1 "register_operand")
8610 (match_operand:VF_128 2 "register_operand")
8611 (match_operand:<sseintvecmode> 3 "<round_saeonly_expand_nimm_predicate>")
8612 (match_operand:SI 4 "const_0_to_255_operand")
8613 (match_operand:<avx512fmaskmode> 5 "register_operand")]
8616 emit_insn (gen_avx512f_sfixupimm<mode>_maskz_1<round_saeonly_expand_name> (
8617 operands[0], operands[1], operands[2], operands[3],
8618 operands[4], CONST0_RTX (<MODE>mode), operands[5]
8619 <round_saeonly_expand_operand6>));
8623 (define_insn "avx512f_sfixupimm<mode><sd_maskz_name><round_saeonly_name>"
8624 [(set (match_operand:VF_128 0 "register_operand" "=v")
8627 [(match_operand:VF_128 1 "register_operand" "0")
8628 (match_operand:VF_128 2 "register_operand" "v")
8629 (match_operand:<sseintvecmode> 3 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
8630 (match_operand:SI 4 "const_0_to_255_operand")]
8635 "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}";
8636 [(set_attr "prefix" "evex")
8637 (set_attr "mode" "<ssescalarmode>")])
8639 (define_insn "avx512f_sfixupimm<mode>_mask<round_saeonly_name>"
8640 [(set (match_operand:VF_128 0 "register_operand" "=v")
8644 [(match_operand:VF_128 1 "register_operand" "0")
8645 (match_operand:VF_128 2 "register_operand" "v")
8646 (match_operand:<sseintvecmode> 3 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
8647 (match_operand:SI 4 "const_0_to_255_operand")]
8652 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
8654 "vfixupimm<ssescalarmodesuffix>\t{%4, <round_saeonly_op6>%3, %2, %0%{%5%}|%0%{%5%}, %2, %<iptr>3<round_saeonly_op6>, %4}";
8655 [(set_attr "prefix" "evex")
8656 (set_attr "mode" "<ssescalarmode>")])
8658 (define_insn "<avx512>_rndscale<mode><mask_name><round_saeonly_name>"
8659 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8661 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "<round_saeonly_constraint>")
8662 (match_operand:SI 2 "const_0_to_255_operand")]
8665 "vrndscale<ssemodesuffix>\t{%2, <round_saeonly_mask_op3>%1, %0<mask_operand3>|%0<mask_operand3>, %1<round_saeonly_mask_op3>, %2}"
8666 [(set_attr "length_immediate" "1")
8667 (set_attr "prefix" "evex")
8668 (set_attr "mode" "<MODE>")])
8670 (define_insn "avx512f_rndscale<mode><round_saeonly_name>"
8671 [(set (match_operand:VF_128 0 "register_operand" "=v")
8674 [(match_operand:VF_128 1 "register_operand" "v")
8675 (match_operand:VF_128 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
8676 (match_operand:SI 3 "const_0_to_255_operand")]
8681 "vrndscale<ssescalarmodesuffix>\t{%3, <round_saeonly_op4>%2, %1, %0|%0, %1, %<iptr>2<round_saeonly_op4>, %3}"
8682 [(set_attr "length_immediate" "1")
8683 (set_attr "prefix" "evex")
8684 (set_attr "mode" "<MODE>")])
8686 ;; One bit in mask selects 2 elements.
8687 (define_insn "avx512f_shufps512_1<mask_name>"
8688 [(set (match_operand:V16SF 0 "register_operand" "=v")
8691 (match_operand:V16SF 1 "register_operand" "v")
8692 (match_operand:V16SF 2 "nonimmediate_operand" "vm"))
8693 (parallel [(match_operand 3 "const_0_to_3_operand")
8694 (match_operand 4 "const_0_to_3_operand")
8695 (match_operand 5 "const_16_to_19_operand")
8696 (match_operand 6 "const_16_to_19_operand")
8697 (match_operand 7 "const_4_to_7_operand")
8698 (match_operand 8 "const_4_to_7_operand")
8699 (match_operand 9 "const_20_to_23_operand")
8700 (match_operand 10 "const_20_to_23_operand")
8701 (match_operand 11 "const_8_to_11_operand")
8702 (match_operand 12 "const_8_to_11_operand")
8703 (match_operand 13 "const_24_to_27_operand")
8704 (match_operand 14 "const_24_to_27_operand")
8705 (match_operand 15 "const_12_to_15_operand")
8706 (match_operand 16 "const_12_to_15_operand")
8707 (match_operand 17 "const_28_to_31_operand")
8708 (match_operand 18 "const_28_to_31_operand")])))]
8710 && (INTVAL (operands[3]) == (INTVAL (operands[7]) - 4)
8711 && INTVAL (operands[4]) == (INTVAL (operands[8]) - 4)
8712 && INTVAL (operands[5]) == (INTVAL (operands[9]) - 4)
8713 && INTVAL (operands[6]) == (INTVAL (operands[10]) - 4)
8714 && INTVAL (operands[3]) == (INTVAL (operands[11]) - 8)
8715 && INTVAL (operands[4]) == (INTVAL (operands[12]) - 8)
8716 && INTVAL (operands[5]) == (INTVAL (operands[13]) - 8)
8717 && INTVAL (operands[6]) == (INTVAL (operands[14]) - 8)
8718 && INTVAL (operands[3]) == (INTVAL (operands[15]) - 12)
8719 && INTVAL (operands[4]) == (INTVAL (operands[16]) - 12)
8720 && INTVAL (operands[5]) == (INTVAL (operands[17]) - 12)
8721 && INTVAL (operands[6]) == (INTVAL (operands[18]) - 12))"
8724 mask = INTVAL (operands[3]);
8725 mask |= INTVAL (operands[4]) << 2;
8726 mask |= (INTVAL (operands[5]) - 16) << 4;
8727 mask |= (INTVAL (operands[6]) - 16) << 6;
8728 operands[3] = GEN_INT (mask);
8730 return "vshufps\t{%3, %2, %1, %0<mask_operand19>|%0<mask_operand19>, %1, %2, %3}";
8732 [(set_attr "type" "sselog")
8733 (set_attr "length_immediate" "1")
8734 (set_attr "prefix" "evex")
8735 (set_attr "mode" "V16SF")])
8737 (define_expand "avx512f_shufpd512_mask"
8738 [(match_operand:V8DF 0 "register_operand")
8739 (match_operand:V8DF 1 "register_operand")
8740 (match_operand:V8DF 2 "nonimmediate_operand")
8741 (match_operand:SI 3 "const_0_to_255_operand")
8742 (match_operand:V8DF 4 "register_operand")
8743 (match_operand:QI 5 "register_operand")]
8746 int mask = INTVAL (operands[3]);
8747 emit_insn (gen_avx512f_shufpd512_1_mask (operands[0], operands[1], operands[2],
8749 GEN_INT (mask & 2 ? 9 : 8),
8750 GEN_INT (mask & 4 ? 3 : 2),
8751 GEN_INT (mask & 8 ? 11 : 10),
8752 GEN_INT (mask & 16 ? 5 : 4),
8753 GEN_INT (mask & 32 ? 13 : 12),
8754 GEN_INT (mask & 64 ? 7 : 6),
8755 GEN_INT (mask & 128 ? 15 : 14),
8756 operands[4], operands[5]));
8760 (define_insn "avx512f_shufpd512_1<mask_name>"
8761 [(set (match_operand:V8DF 0 "register_operand" "=v")
8764 (match_operand:V8DF 1 "register_operand" "v")
8765 (match_operand:V8DF 2 "nonimmediate_operand" "vm"))
8766 (parallel [(match_operand 3 "const_0_to_1_operand")
8767 (match_operand 4 "const_8_to_9_operand")
8768 (match_operand 5 "const_2_to_3_operand")
8769 (match_operand 6 "const_10_to_11_operand")
8770 (match_operand 7 "const_4_to_5_operand")
8771 (match_operand 8 "const_12_to_13_operand")
8772 (match_operand 9 "const_6_to_7_operand")
8773 (match_operand 10 "const_14_to_15_operand")])))]
8777 mask = INTVAL (operands[3]);
8778 mask |= (INTVAL (operands[4]) - 8) << 1;
8779 mask |= (INTVAL (operands[5]) - 2) << 2;
8780 mask |= (INTVAL (operands[6]) - 10) << 3;
8781 mask |= (INTVAL (operands[7]) - 4) << 4;
8782 mask |= (INTVAL (operands[8]) - 12) << 5;
8783 mask |= (INTVAL (operands[9]) - 6) << 6;
8784 mask |= (INTVAL (operands[10]) - 14) << 7;
8785 operands[3] = GEN_INT (mask);
8787 return "vshufpd\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
8789 [(set_attr "type" "sselog")
8790 (set_attr "length_immediate" "1")
8791 (set_attr "prefix" "evex")
8792 (set_attr "mode" "V8DF")])
8794 (define_expand "avx_shufpd256<mask_expand4_name>"
8795 [(match_operand:V4DF 0 "register_operand")
8796 (match_operand:V4DF 1 "register_operand")
8797 (match_operand:V4DF 2 "nonimmediate_operand")
8798 (match_operand:SI 3 "const_int_operand")]
8801 int mask = INTVAL (operands[3]);
8802 emit_insn (gen_avx_shufpd256_1<mask_expand4_name> (operands[0],
8806 GEN_INT (mask & 2 ? 5 : 4),
8807 GEN_INT (mask & 4 ? 3 : 2),
8808 GEN_INT (mask & 8 ? 7 : 6)
8809 <mask_expand4_args>));
8813 (define_insn "avx_shufpd256_1<mask_name>"
8814 [(set (match_operand:V4DF 0 "register_operand" "=v")
8817 (match_operand:V4DF 1 "register_operand" "v")
8818 (match_operand:V4DF 2 "nonimmediate_operand" "vm"))
8819 (parallel [(match_operand 3 "const_0_to_1_operand")
8820 (match_operand 4 "const_4_to_5_operand")
8821 (match_operand 5 "const_2_to_3_operand")
8822 (match_operand 6 "const_6_to_7_operand")])))]
8823 "TARGET_AVX && <mask_avx512vl_condition>"
8826 mask = INTVAL (operands[3]);
8827 mask |= (INTVAL (operands[4]) - 4) << 1;
8828 mask |= (INTVAL (operands[5]) - 2) << 2;
8829 mask |= (INTVAL (operands[6]) - 6) << 3;
8830 operands[3] = GEN_INT (mask);
8832 return "vshufpd\t{%3, %2, %1, %0<mask_operand7>|%0<mask_operand7>, %1, %2, %3}";
8834 [(set_attr "type" "sseshuf")
8835 (set_attr "length_immediate" "1")
8836 (set_attr "prefix" "vex")
8837 (set_attr "mode" "V4DF")])
8839 (define_expand "sse2_shufpd<mask_expand4_name>"
8840 [(match_operand:V2DF 0 "register_operand")
8841 (match_operand:V2DF 1 "register_operand")
8842 (match_operand:V2DF 2 "vector_operand")
8843 (match_operand:SI 3 "const_int_operand")]
8846 int mask = INTVAL (operands[3]);
8847 emit_insn (gen_sse2_shufpd_v2df<mask_expand4_name> (operands[0], operands[1],
8848 operands[2], GEN_INT (mask & 1),
8849 GEN_INT (mask & 2 ? 3 : 2)
8850 <mask_expand4_args>));
8854 (define_insn "sse2_shufpd_v2df_mask"
8855 [(set (match_operand:V2DF 0 "register_operand" "=v")
8859 (match_operand:V2DF 1 "register_operand" "v")
8860 (match_operand:V2DF 2 "nonimmediate_operand" "vm"))
8861 (parallel [(match_operand 3 "const_0_to_1_operand")
8862 (match_operand 4 "const_2_to_3_operand")]))
8863 (match_operand:V2DF 5 "vector_move_operand" "0C")
8864 (match_operand:QI 6 "register_operand" "Yk")))]
8868 mask = INTVAL (operands[3]);
8869 mask |= (INTVAL (operands[4]) - 2) << 1;
8870 operands[3] = GEN_INT (mask);
8872 return "vshufpd\t{%3, %2, %1, %0%{%6%}%N5|%0%{%6%}%N5, %1, %2, %3}";
8874 [(set_attr "type" "sseshuf")
8875 (set_attr "length_immediate" "1")
8876 (set_attr "prefix" "evex")
8877 (set_attr "mode" "V2DF")])
8879 ;; punpcklqdq and punpckhqdq are shorter than shufpd.
8880 (define_insn "avx2_interleave_highv4di<mask_name>"
8881 [(set (match_operand:V4DI 0 "register_operand" "=v")
8884 (match_operand:V4DI 1 "register_operand" "v")
8885 (match_operand:V4DI 2 "nonimmediate_operand" "vm"))
8886 (parallel [(const_int 1)
8890 "TARGET_AVX2 && <mask_avx512vl_condition>"
8891 "vpunpckhqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8892 [(set_attr "type" "sselog")
8893 (set_attr "prefix" "vex")
8894 (set_attr "mode" "OI")])
8896 (define_insn "<mask_codefor>avx512f_interleave_highv8di<mask_name>"
8897 [(set (match_operand:V8DI 0 "register_operand" "=v")
8900 (match_operand:V8DI 1 "register_operand" "v")
8901 (match_operand:V8DI 2 "nonimmediate_operand" "vm"))
8902 (parallel [(const_int 1) (const_int 9)
8903 (const_int 3) (const_int 11)
8904 (const_int 5) (const_int 13)
8905 (const_int 7) (const_int 15)])))]
8907 "vpunpckhqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8908 [(set_attr "type" "sselog")
8909 (set_attr "prefix" "evex")
8910 (set_attr "mode" "XI")])
8912 (define_insn "vec_interleave_highv2di<mask_name>"
8913 [(set (match_operand:V2DI 0 "register_operand" "=x,v")
8916 (match_operand:V2DI 1 "register_operand" "0,v")
8917 (match_operand:V2DI 2 "vector_operand" "xBm,vm"))
8918 (parallel [(const_int 1)
8920 "TARGET_SSE2 && <mask_avx512vl_condition>"
8922 punpckhqdq\t{%2, %0|%0, %2}
8923 vpunpckhqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8924 [(set_attr "isa" "noavx,avx")
8925 (set_attr "type" "sselog")
8926 (set_attr "prefix_data16" "1,*")
8927 (set_attr "prefix" "orig,<mask_prefix>")
8928 (set_attr "mode" "TI")])
8930 (define_insn "avx2_interleave_lowv4di<mask_name>"
8931 [(set (match_operand:V4DI 0 "register_operand" "=v")
8934 (match_operand:V4DI 1 "register_operand" "v")
8935 (match_operand:V4DI 2 "nonimmediate_operand" "vm"))
8936 (parallel [(const_int 0)
8940 "TARGET_AVX2 && <mask_avx512vl_condition>"
8941 "vpunpcklqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8942 [(set_attr "type" "sselog")
8943 (set_attr "prefix" "vex")
8944 (set_attr "mode" "OI")])
8946 (define_insn "<mask_codefor>avx512f_interleave_lowv8di<mask_name>"
8947 [(set (match_operand:V8DI 0 "register_operand" "=v")
8950 (match_operand:V8DI 1 "register_operand" "v")
8951 (match_operand:V8DI 2 "nonimmediate_operand" "vm"))
8952 (parallel [(const_int 0) (const_int 8)
8953 (const_int 2) (const_int 10)
8954 (const_int 4) (const_int 12)
8955 (const_int 6) (const_int 14)])))]
8957 "vpunpcklqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8958 [(set_attr "type" "sselog")
8959 (set_attr "prefix" "evex")
8960 (set_attr "mode" "XI")])
8962 (define_insn "vec_interleave_lowv2di<mask_name>"
8963 [(set (match_operand:V2DI 0 "register_operand" "=x,v")
8966 (match_operand:V2DI 1 "register_operand" "0,v")
8967 (match_operand:V2DI 2 "vector_operand" "xBm,vm"))
8968 (parallel [(const_int 0)
8970 "TARGET_SSE2 && <mask_avx512vl_condition>"
8972 punpcklqdq\t{%2, %0|%0, %2}
8973 vpunpcklqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8974 [(set_attr "isa" "noavx,avx")
8975 (set_attr "type" "sselog")
8976 (set_attr "prefix_data16" "1,*")
8977 (set_attr "prefix" "orig,vex")
8978 (set_attr "mode" "TI")])
8980 (define_insn "sse2_shufpd_<mode>"
8981 [(set (match_operand:VI8F_128 0 "register_operand" "=x,v")
8982 (vec_select:VI8F_128
8983 (vec_concat:<ssedoublevecmode>
8984 (match_operand:VI8F_128 1 "register_operand" "0,v")
8985 (match_operand:VI8F_128 2 "vector_operand" "xBm,vm"))
8986 (parallel [(match_operand 3 "const_0_to_1_operand")
8987 (match_operand 4 "const_2_to_3_operand")])))]
8991 mask = INTVAL (operands[3]);
8992 mask |= (INTVAL (operands[4]) - 2) << 1;
8993 operands[3] = GEN_INT (mask);
8995 switch (which_alternative)
8998 return "shufpd\t{%3, %2, %0|%0, %2, %3}";
9000 return "vshufpd\t{%3, %2, %1, %0|%0, %1, %2, %3}";
9005 [(set_attr "isa" "noavx,avx")
9006 (set_attr "type" "sseshuf")
9007 (set_attr "length_immediate" "1")
9008 (set_attr "prefix" "orig,maybe_evex")
9009 (set_attr "mode" "V2DF")])
9011 ;; Avoid combining registers from different units in a single alternative,
9012 ;; see comment above inline_secondary_memory_needed function in i386.c
9013 (define_insn "sse2_storehpd"
9014 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,Yv,x,*f,r")
9016 (match_operand:V2DF 1 "nonimmediate_operand" " v,0, v,o,o,o")
9017 (parallel [(const_int 1)])))]
9018 "TARGET_SSE2 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
9020 %vmovhpd\t{%1, %0|%0, %1}
9022 vunpckhpd\t{%d1, %0|%0, %d1}
9026 [(set_attr "isa" "*,noavx,avx,*,*,*")
9027 (set_attr "type" "ssemov,sselog1,sselog1,ssemov,fmov,imov")
9028 (set (attr "prefix_data16")
9030 (and (eq_attr "alternative" "0")
9031 (not (match_test "TARGET_AVX")))
9033 (const_string "*")))
9034 (set_attr "prefix" "maybe_vex,orig,maybe_evex,*,*,*")
9035 (set_attr "mode" "V1DF,V1DF,V2DF,DF,DF,DF")])
9038 [(set (match_operand:DF 0 "register_operand")
9040 (match_operand:V2DF 1 "memory_operand")
9041 (parallel [(const_int 1)])))]
9042 "TARGET_SSE2 && reload_completed"
9043 [(set (match_dup 0) (match_dup 1))]
9044 "operands[1] = adjust_address (operands[1], DFmode, 8);")
9046 (define_insn "*vec_extractv2df_1_sse"
9047 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,x")
9049 (match_operand:V2DF 1 "nonimmediate_operand" "x,x,o")
9050 (parallel [(const_int 1)])))]
9051 "!TARGET_SSE2 && TARGET_SSE
9052 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
9054 movhps\t{%1, %0|%q0, %1}
9055 movhlps\t{%1, %0|%0, %1}
9056 movlps\t{%H1, %0|%0, %H1}"
9057 [(set_attr "type" "ssemov")
9058 (set_attr "mode" "V2SF,V4SF,V2SF")])
9060 ;; Avoid combining registers from different units in a single alternative,
9061 ;; see comment above inline_secondary_memory_needed function in i386.c
9062 (define_insn "sse2_storelpd"
9063 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,x,*f,r")
9065 (match_operand:V2DF 1 "nonimmediate_operand" " v,x,m,m,m")
9066 (parallel [(const_int 0)])))]
9067 "TARGET_SSE2 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
9069 %vmovlpd\t{%1, %0|%0, %1}
9074 [(set_attr "type" "ssemov,ssemov,ssemov,fmov,imov")
9075 (set (attr "prefix_data16")
9076 (if_then_else (eq_attr "alternative" "0")
9078 (const_string "*")))
9079 (set_attr "prefix" "maybe_vex")
9080 (set_attr "mode" "V1DF,DF,DF,DF,DF")])
9083 [(set (match_operand:DF 0 "register_operand")
9085 (match_operand:V2DF 1 "nonimmediate_operand")
9086 (parallel [(const_int 0)])))]
9087 "TARGET_SSE2 && reload_completed"
9088 [(set (match_dup 0) (match_dup 1))]
9089 "operands[1] = gen_lowpart (DFmode, operands[1]);")
9091 (define_insn "*vec_extractv2df_0_sse"
9092 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,x")
9094 (match_operand:V2DF 1 "nonimmediate_operand" "x,x,m")
9095 (parallel [(const_int 0)])))]
9096 "!TARGET_SSE2 && TARGET_SSE
9097 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
9099 movlps\t{%1, %0|%0, %1}
9100 movaps\t{%1, %0|%0, %1}
9101 movlps\t{%1, %0|%0, %q1}"
9102 [(set_attr "type" "ssemov")
9103 (set_attr "mode" "V2SF,V4SF,V2SF")])
9105 (define_expand "sse2_loadhpd_exp"
9106 [(set (match_operand:V2DF 0 "nonimmediate_operand")
9109 (match_operand:V2DF 1 "nonimmediate_operand")
9110 (parallel [(const_int 0)]))
9111 (match_operand:DF 2 "nonimmediate_operand")))]
9114 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V2DFmode, operands);
9116 emit_insn (gen_sse2_loadhpd (dst, operands[1], operands[2]));
9118 /* Fix up the destination if needed. */
9119 if (dst != operands[0])
9120 emit_move_insn (operands[0], dst);
9125 ;; Avoid combining registers from different units in a single alternative,
9126 ;; see comment above inline_secondary_memory_needed function in i386.c
9127 (define_insn "sse2_loadhpd"
9128 [(set (match_operand:V2DF 0 "nonimmediate_operand"
9132 (match_operand:V2DF 1 "nonimmediate_operand"
9134 (parallel [(const_int 0)]))
9135 (match_operand:DF 2 "nonimmediate_operand"
9136 " m,m,x,Yv,x,*f,r")))]
9137 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
9139 movhpd\t{%2, %0|%0, %2}
9140 vmovhpd\t{%2, %1, %0|%0, %1, %2}
9141 unpcklpd\t{%2, %0|%0, %2}
9142 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
9146 [(set_attr "isa" "noavx,avx,noavx,avx,*,*,*")
9147 (set_attr "type" "ssemov,ssemov,sselog,sselog,ssemov,fmov,imov")
9148 (set (attr "prefix_data16")
9149 (if_then_else (eq_attr "alternative" "0")
9151 (const_string "*")))
9152 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,*,*,*")
9153 (set_attr "mode" "V1DF,V1DF,V2DF,V2DF,DF,DF,DF")])
9156 [(set (match_operand:V2DF 0 "memory_operand")
9158 (vec_select:DF (match_dup 0) (parallel [(const_int 0)]))
9159 (match_operand:DF 1 "register_operand")))]
9160 "TARGET_SSE2 && reload_completed"
9161 [(set (match_dup 0) (match_dup 1))]
9162 "operands[0] = adjust_address (operands[0], DFmode, 8);")
9164 (define_expand "sse2_loadlpd_exp"
9165 [(set (match_operand:V2DF 0 "nonimmediate_operand")
9167 (match_operand:DF 2 "nonimmediate_operand")
9169 (match_operand:V2DF 1 "nonimmediate_operand")
9170 (parallel [(const_int 1)]))))]
9173 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V2DFmode, operands);
9175 emit_insn (gen_sse2_loadlpd (dst, operands[1], operands[2]));
9177 /* Fix up the destination if needed. */
9178 if (dst != operands[0])
9179 emit_move_insn (operands[0], dst);
9184 ;; Avoid combining registers from different units in a single alternative,
9185 ;; see comment above inline_secondary_memory_needed function in i386.c
9186 (define_insn "sse2_loadlpd"
9187 [(set (match_operand:V2DF 0 "nonimmediate_operand"
9188 "=v,x,v,x,v,x,x,v,m,m ,m")
9190 (match_operand:DF 2 "nonimmediate_operand"
9191 "vm,m,m,x,v,0,0,v,x,*f,r")
9193 (match_operand:V2DF 1 "vector_move_operand"
9194 " C,0,v,0,v,x,o,o,0,0 ,0")
9195 (parallel [(const_int 1)]))))]
9196 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
9198 %vmovq\t{%2, %0|%0, %2}
9199 movlpd\t{%2, %0|%0, %2}
9200 vmovlpd\t{%2, %1, %0|%0, %1, %2}
9201 movsd\t{%2, %0|%0, %2}
9202 vmovsd\t{%2, %1, %0|%0, %1, %2}
9203 shufpd\t{$2, %1, %0|%0, %1, 2}
9204 movhpd\t{%H1, %0|%0, %H1}
9205 vmovhpd\t{%H1, %2, %0|%0, %2, %H1}
9209 [(set_attr "isa" "*,noavx,avx,noavx,avx,noavx,noavx,avx,*,*,*")
9211 (cond [(eq_attr "alternative" "5")
9212 (const_string "sselog")
9213 (eq_attr "alternative" "9")
9214 (const_string "fmov")
9215 (eq_attr "alternative" "10")
9216 (const_string "imov")
9218 (const_string "ssemov")))
9219 (set (attr "prefix_data16")
9220 (if_then_else (eq_attr "alternative" "1,6")
9222 (const_string "*")))
9223 (set (attr "length_immediate")
9224 (if_then_else (eq_attr "alternative" "5")
9226 (const_string "*")))
9227 (set (attr "prefix")
9228 (cond [(eq_attr "alternative" "0")
9229 (const_string "maybe_vex")
9230 (eq_attr "alternative" "1,3,5,6")
9231 (const_string "orig")
9232 (eq_attr "alternative" "2,4,7")
9233 (const_string "maybe_evex")
9235 (const_string "*")))
9236 (set_attr "mode" "DF,V1DF,V1DF,V1DF,V1DF,V2DF,V1DF,V1DF,DF,DF,DF")])
9239 [(set (match_operand:V2DF 0 "memory_operand")
9241 (match_operand:DF 1 "register_operand")
9242 (vec_select:DF (match_dup 0) (parallel [(const_int 1)]))))]
9243 "TARGET_SSE2 && reload_completed"
9244 [(set (match_dup 0) (match_dup 1))]
9245 "operands[0] = adjust_address (operands[0], DFmode, 0);")
9247 (define_insn "sse2_movsd"
9248 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,v,x,v,m,x,x,v,o")
9250 (match_operand:V2DF 2 "nonimmediate_operand" " x,v,m,m,v,0,0,v,0")
9251 (match_operand:V2DF 1 "nonimmediate_operand" " 0,v,0,v,0,x,o,o,v")
9255 movsd\t{%2, %0|%0, %2}
9256 vmovsd\t{%2, %1, %0|%0, %1, %2}
9257 movlpd\t{%2, %0|%0, %q2}
9258 vmovlpd\t{%2, %1, %0|%0, %1, %q2}
9259 %vmovlpd\t{%2, %0|%q0, %2}
9260 shufpd\t{$2, %1, %0|%0, %1, 2}
9261 movhps\t{%H1, %0|%0, %H1}
9262 vmovhps\t{%H1, %2, %0|%0, %2, %H1}
9263 %vmovhps\t{%1, %H0|%H0, %1}"
9264 [(set_attr "isa" "noavx,avx,noavx,avx,*,noavx,noavx,avx,*")
9267 (eq_attr "alternative" "5")
9268 (const_string "sselog")
9269 (const_string "ssemov")))
9270 (set (attr "prefix_data16")
9272 (and (eq_attr "alternative" "2,4")
9273 (not (match_test "TARGET_AVX")))
9275 (const_string "*")))
9276 (set (attr "length_immediate")
9277 (if_then_else (eq_attr "alternative" "5")
9279 (const_string "*")))
9280 (set (attr "prefix")
9281 (cond [(eq_attr "alternative" "1,3,7")
9282 (const_string "maybe_evex")
9283 (eq_attr "alternative" "4,8")
9284 (const_string "maybe_vex")
9286 (const_string "orig")))
9287 (set_attr "mode" "DF,DF,V1DF,V1DF,V1DF,V2DF,V1DF,V1DF,V1DF")])
9289 (define_insn "vec_dupv2df<mask_name>"
9290 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
9292 (match_operand:DF 1 "nonimmediate_operand" " 0,xm,vm")))]
9293 "TARGET_SSE2 && <mask_avx512vl_condition>"
9296 %vmovddup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}
9297 vmovddup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
9298 [(set_attr "isa" "noavx,sse3,avx512vl")
9299 (set_attr "type" "sselog1")
9300 (set_attr "prefix" "orig,maybe_vex,evex")
9301 (set_attr "mode" "V2DF,DF,DF")])
9303 (define_insn "vec_concatv2df"
9304 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v,x,v,x,x, v,x,x")
9306 (match_operand:DF 1 "nonimmediate_operand" " 0,x,v,m,m,0,x,xm,0,0")
9307 (match_operand:DF 2 "vector_move_operand" " x,x,v,1,1,m,m, C,x,m")))]
9309 && (!(MEM_P (operands[1]) && MEM_P (operands[2]))
9310 || (TARGET_SSE3 && rtx_equal_p (operands[1], operands[2])))"
9312 unpcklpd\t{%2, %0|%0, %2}
9313 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
9314 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
9315 %vmovddup\t{%1, %0|%0, %1}
9316 vmovddup\t{%1, %0|%0, %1}
9317 movhpd\t{%2, %0|%0, %2}
9318 vmovhpd\t{%2, %1, %0|%0, %1, %2}
9319 %vmovq\t{%1, %0|%0, %1}
9320 movlhps\t{%2, %0|%0, %2}
9321 movhps\t{%2, %0|%0, %2}"
9323 (cond [(eq_attr "alternative" "0,5")
9324 (const_string "sse2_noavx")
9325 (eq_attr "alternative" "1,6")
9326 (const_string "avx")
9327 (eq_attr "alternative" "2,4")
9328 (const_string "avx512vl")
9329 (eq_attr "alternative" "3")
9330 (const_string "sse3")
9331 (eq_attr "alternative" "7")
9332 (const_string "sse2")
9334 (const_string "noavx")))
9337 (eq_attr "alternative" "0,1,2,3,4")
9338 (const_string "sselog")
9339 (const_string "ssemov")))
9340 (set (attr "prefix_data16")
9341 (if_then_else (eq_attr "alternative" "5")
9343 (const_string "*")))
9344 (set (attr "prefix")
9345 (cond [(eq_attr "alternative" "1,6")
9346 (const_string "vex")
9347 (eq_attr "alternative" "2,4")
9348 (const_string "evex")
9349 (eq_attr "alternative" "3,7")
9350 (const_string "maybe_vex")
9352 (const_string "orig")))
9353 (set_attr "mode" "V2DF,V2DF,V2DF, DF, DF, V1DF,V1DF,DF,V4SF,V2SF")])
9355 ;; vmovq clears also the higher bits.
9356 (define_insn "vec_set<mode>_0"
9357 [(set (match_operand:VF2_512_256 0 "register_operand" "=v")
9358 (vec_merge:VF2_512_256
9359 (vec_duplicate:VF2_512_256
9360 (match_operand:<ssescalarmode> 2 "general_operand" "xm"))
9361 (match_operand:VF2_512_256 1 "const0_operand" "C")
9364 "vmovq\t{%2, %x0|%x0, %2}"
9365 [(set_attr "type" "ssemov")
9366 (set_attr "prefix" "maybe_evex")
9367 (set_attr "mode" "DF")])
9369 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9371 ;; Parallel integer down-conversion operations
9373 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9375 (define_mode_iterator PMOV_DST_MODE_1 [V16QI V16HI V8SI V8HI])
9376 (define_mode_attr pmov_src_mode
9377 [(V16QI "V16SI") (V16HI "V16SI") (V8SI "V8DI") (V8HI "V8DI")])
9378 (define_mode_attr pmov_src_lower
9379 [(V16QI "v16si") (V16HI "v16si") (V8SI "v8di") (V8HI "v8di")])
9380 (define_mode_attr pmov_suff_1
9381 [(V16QI "db") (V16HI "dw") (V8SI "qd") (V8HI "qw")])
9383 (define_insn "*avx512f_<code><pmov_src_lower><mode>2"
9384 [(set (match_operand:PMOV_DST_MODE_1 0 "nonimmediate_operand" "=v,m")
9385 (any_truncate:PMOV_DST_MODE_1
9386 (match_operand:<pmov_src_mode> 1 "register_operand" "v,v")))]
9388 "vpmov<trunsuffix><pmov_suff_1>\t{%1, %0|%0, %1}"
9389 [(set_attr "type" "ssemov")
9390 (set_attr "memory" "none,store")
9391 (set_attr "prefix" "evex")
9392 (set_attr "mode" "<sseinsnmode>")])
9394 (define_insn "avx512f_<code><pmov_src_lower><mode>2_mask"
9395 [(set (match_operand:PMOV_DST_MODE_1 0 "nonimmediate_operand" "=v,m")
9396 (vec_merge:PMOV_DST_MODE_1
9397 (any_truncate:PMOV_DST_MODE_1
9398 (match_operand:<pmov_src_mode> 1 "register_operand" "v,v"))
9399 (match_operand:PMOV_DST_MODE_1 2 "vector_move_operand" "0C,0")
9400 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
9402 "vpmov<trunsuffix><pmov_suff_1>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9403 [(set_attr "type" "ssemov")
9404 (set_attr "memory" "none,store")
9405 (set_attr "prefix" "evex")
9406 (set_attr "mode" "<sseinsnmode>")])
9408 (define_expand "avx512f_<code><pmov_src_lower><mode>2_mask_store"
9409 [(set (match_operand:PMOV_DST_MODE_1 0 "memory_operand")
9410 (vec_merge:PMOV_DST_MODE_1
9411 (any_truncate:PMOV_DST_MODE_1
9412 (match_operand:<pmov_src_mode> 1 "register_operand"))
9414 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
9417 (define_insn "avx512bw_<code>v32hiv32qi2"
9418 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=v,m")
9420 (match_operand:V32HI 1 "register_operand" "v,v")))]
9422 "vpmov<trunsuffix>wb\t{%1, %0|%0, %1}"
9423 [(set_attr "type" "ssemov")
9424 (set_attr "memory" "none,store")
9425 (set_attr "prefix" "evex")
9426 (set_attr "mode" "XI")])
9428 (define_insn "avx512bw_<code>v32hiv32qi2_mask"
9429 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=v,m")
9432 (match_operand:V32HI 1 "register_operand" "v,v"))
9433 (match_operand:V32QI 2 "vector_move_operand" "0C,0")
9434 (match_operand:SI 3 "register_operand" "Yk,Yk")))]
9436 "vpmov<trunsuffix>wb\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9437 [(set_attr "type" "ssemov")
9438 (set_attr "memory" "none,store")
9439 (set_attr "prefix" "evex")
9440 (set_attr "mode" "XI")])
9442 (define_expand "avx512bw_<code>v32hiv32qi2_mask_store"
9443 [(set (match_operand:V32QI 0 "nonimmediate_operand")
9446 (match_operand:V32HI 1 "register_operand"))
9448 (match_operand:SI 2 "register_operand")))]
9451 (define_mode_iterator PMOV_DST_MODE_2
9452 [V4SI V8HI (V16QI "TARGET_AVX512BW")])
9453 (define_mode_attr pmov_suff_2
9454 [(V16QI "wb") (V8HI "dw") (V4SI "qd")])
9456 (define_insn "*avx512vl_<code><ssedoublemodelower><mode>2"
9457 [(set (match_operand:PMOV_DST_MODE_2 0 "nonimmediate_operand" "=v,m")
9458 (any_truncate:PMOV_DST_MODE_2
9459 (match_operand:<ssedoublemode> 1 "register_operand" "v,v")))]
9461 "vpmov<trunsuffix><pmov_suff_2>\t{%1, %0|%0, %1}"
9462 [(set_attr "type" "ssemov")
9463 (set_attr "memory" "none,store")
9464 (set_attr "prefix" "evex")
9465 (set_attr "mode" "<sseinsnmode>")])
9467 (define_insn "<avx512>_<code><ssedoublemodelower><mode>2_mask"
9468 [(set (match_operand:PMOV_DST_MODE_2 0 "nonimmediate_operand" "=v,m")
9469 (vec_merge:PMOV_DST_MODE_2
9470 (any_truncate:PMOV_DST_MODE_2
9471 (match_operand:<ssedoublemode> 1 "register_operand" "v,v"))
9472 (match_operand:PMOV_DST_MODE_2 2 "vector_move_operand" "0C,0")
9473 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
9475 "vpmov<trunsuffix><pmov_suff_2>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9476 [(set_attr "type" "ssemov")
9477 (set_attr "memory" "none,store")
9478 (set_attr "prefix" "evex")
9479 (set_attr "mode" "<sseinsnmode>")])
9481 (define_expand "<avx512>_<code><ssedoublemodelower><mode>2_mask_store"
9482 [(set (match_operand:PMOV_DST_MODE_2 0 "nonimmediate_operand")
9483 (vec_merge:PMOV_DST_MODE_2
9484 (any_truncate:PMOV_DST_MODE_2
9485 (match_operand:<ssedoublemode> 1 "register_operand"))
9487 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
9490 (define_mode_iterator PMOV_SRC_MODE_3 [V4DI V2DI V8SI V4SI (V8HI "TARGET_AVX512BW")])
9491 (define_mode_attr pmov_dst_3
9492 [(V4DI "V4QI") (V2DI "V2QI") (V8SI "V8QI") (V4SI "V4QI") (V8HI "V8QI")])
9493 (define_mode_attr pmov_dst_zeroed_3
9494 [(V4DI "V12QI") (V2DI "V14QI") (V8SI "V8QI") (V4SI "V12QI") (V8HI "V8QI")])
9495 (define_mode_attr pmov_suff_3
9496 [(V4DI "qb") (V2DI "qb") (V8SI "db") (V4SI "db") (V8HI "wb")])
9498 (define_insn "*avx512vl_<code><mode>v<ssescalarnum>qi2"
9499 [(set (match_operand:V16QI 0 "register_operand" "=v")
9501 (any_truncate:<pmov_dst_3>
9502 (match_operand:PMOV_SRC_MODE_3 1 "register_operand" "v"))
9503 (match_operand:<pmov_dst_zeroed_3> 2 "const0_operand")))]
9505 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0|%0, %1}"
9506 [(set_attr "type" "ssemov")
9507 (set_attr "prefix" "evex")
9508 (set_attr "mode" "TI")])
9510 (define_insn "*avx512vl_<code>v2div2qi2_store"
9511 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9514 (match_operand:V2DI 1 "register_operand" "v"))
9517 (parallel [(const_int 2) (const_int 3)
9518 (const_int 4) (const_int 5)
9519 (const_int 6) (const_int 7)
9520 (const_int 8) (const_int 9)
9521 (const_int 10) (const_int 11)
9522 (const_int 12) (const_int 13)
9523 (const_int 14) (const_int 15)]))))]
9525 "vpmov<trunsuffix>qb\t{%1, %0|%w0, %1}"
9526 [(set_attr "type" "ssemov")
9527 (set_attr "memory" "store")
9528 (set_attr "prefix" "evex")
9529 (set_attr "mode" "TI")])
9531 (define_insn "avx512vl_<code>v2div2qi2_mask"
9532 [(set (match_operand:V16QI 0 "register_operand" "=v")
9536 (match_operand:V2DI 1 "register_operand" "v"))
9538 (match_operand:V16QI 2 "vector_move_operand" "0C")
9539 (parallel [(const_int 0) (const_int 1)]))
9540 (match_operand:QI 3 "register_operand" "Yk"))
9541 (const_vector:V14QI [(const_int 0) (const_int 0)
9542 (const_int 0) (const_int 0)
9543 (const_int 0) (const_int 0)
9544 (const_int 0) (const_int 0)
9545 (const_int 0) (const_int 0)
9546 (const_int 0) (const_int 0)
9547 (const_int 0) (const_int 0)])))]
9549 "vpmov<trunsuffix>qb\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9550 [(set_attr "type" "ssemov")
9551 (set_attr "prefix" "evex")
9552 (set_attr "mode" "TI")])
9554 (define_insn "*avx512vl_<code>v2div2qi2_mask_1"
9555 [(set (match_operand:V16QI 0 "register_operand" "=v")
9559 (match_operand:V2DI 1 "register_operand" "v"))
9560 (const_vector:V2QI [(const_int 0) (const_int 0)])
9561 (match_operand:QI 2 "register_operand" "Yk"))
9562 (const_vector:V14QI [(const_int 0) (const_int 0)
9563 (const_int 0) (const_int 0)
9564 (const_int 0) (const_int 0)
9565 (const_int 0) (const_int 0)
9566 (const_int 0) (const_int 0)
9567 (const_int 0) (const_int 0)
9568 (const_int 0) (const_int 0)])))]
9570 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9571 [(set_attr "type" "ssemov")
9572 (set_attr "prefix" "evex")
9573 (set_attr "mode" "TI")])
9575 (define_insn "avx512vl_<code>v2div2qi2_mask_store"
9576 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9580 (match_operand:V2DI 1 "register_operand" "v"))
9583 (parallel [(const_int 0) (const_int 1)]))
9584 (match_operand:QI 2 "register_operand" "Yk"))
9587 (parallel [(const_int 2) (const_int 3)
9588 (const_int 4) (const_int 5)
9589 (const_int 6) (const_int 7)
9590 (const_int 8) (const_int 9)
9591 (const_int 10) (const_int 11)
9592 (const_int 12) (const_int 13)
9593 (const_int 14) (const_int 15)]))))]
9595 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}|%w0%{%2%}, %1}"
9596 [(set_attr "type" "ssemov")
9597 (set_attr "memory" "store")
9598 (set_attr "prefix" "evex")
9599 (set_attr "mode" "TI")])
9601 (define_insn "*avx512vl_<code><mode>v4qi2_store"
9602 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9605 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9608 (parallel [(const_int 4) (const_int 5)
9609 (const_int 6) (const_int 7)
9610 (const_int 8) (const_int 9)
9611 (const_int 10) (const_int 11)
9612 (const_int 12) (const_int 13)
9613 (const_int 14) (const_int 15)]))))]
9615 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0|%k0, %1}"
9616 [(set_attr "type" "ssemov")
9617 (set_attr "memory" "store")
9618 (set_attr "prefix" "evex")
9619 (set_attr "mode" "TI")])
9621 (define_insn "avx512vl_<code><mode>v4qi2_mask"
9622 [(set (match_operand:V16QI 0 "register_operand" "=v")
9626 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9628 (match_operand:V16QI 2 "vector_move_operand" "0C")
9629 (parallel [(const_int 0) (const_int 1)
9630 (const_int 2) (const_int 3)]))
9631 (match_operand:QI 3 "register_operand" "Yk"))
9632 (const_vector:V12QI [(const_int 0) (const_int 0)
9633 (const_int 0) (const_int 0)
9634 (const_int 0) (const_int 0)
9635 (const_int 0) (const_int 0)
9636 (const_int 0) (const_int 0)
9637 (const_int 0) (const_int 0)])))]
9639 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9640 [(set_attr "type" "ssemov")
9641 (set_attr "prefix" "evex")
9642 (set_attr "mode" "TI")])
9644 (define_insn "*avx512vl_<code><mode>v4qi2_mask_1"
9645 [(set (match_operand:V16QI 0 "register_operand" "=v")
9649 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9650 (const_vector:V4QI [(const_int 0) (const_int 0)
9651 (const_int 0) (const_int 0)])
9652 (match_operand:QI 2 "register_operand" "Yk"))
9653 (const_vector:V12QI [(const_int 0) (const_int 0)
9654 (const_int 0) (const_int 0)
9655 (const_int 0) (const_int 0)
9656 (const_int 0) (const_int 0)
9657 (const_int 0) (const_int 0)
9658 (const_int 0) (const_int 0)])))]
9660 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9661 [(set_attr "type" "ssemov")
9662 (set_attr "prefix" "evex")
9663 (set_attr "mode" "TI")])
9665 (define_insn "avx512vl_<code><mode>v4qi2_mask_store"
9666 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9670 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9673 (parallel [(const_int 0) (const_int 1)
9674 (const_int 2) (const_int 3)]))
9675 (match_operand:QI 2 "register_operand" "Yk"))
9678 (parallel [(const_int 4) (const_int 5)
9679 (const_int 6) (const_int 7)
9680 (const_int 8) (const_int 9)
9681 (const_int 10) (const_int 11)
9682 (const_int 12) (const_int 13)
9683 (const_int 14) (const_int 15)]))))]
9685 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}|%k0%{%2%}, %1}"
9686 [(set_attr "type" "ssemov")
9687 (set_attr "memory" "store")
9688 (set_attr "prefix" "evex")
9689 (set_attr "mode" "TI")])
9691 (define_mode_iterator VI2_128_BW_4_256
9692 [(V8HI "TARGET_AVX512BW") V8SI])
9694 (define_insn "*avx512vl_<code><mode>v8qi2_store"
9695 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9698 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9701 (parallel [(const_int 8) (const_int 9)
9702 (const_int 10) (const_int 11)
9703 (const_int 12) (const_int 13)
9704 (const_int 14) (const_int 15)]))))]
9706 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0|%q0, %1}"
9707 [(set_attr "type" "ssemov")
9708 (set_attr "memory" "store")
9709 (set_attr "prefix" "evex")
9710 (set_attr "mode" "TI")])
9712 (define_insn "avx512vl_<code><mode>v8qi2_mask"
9713 [(set (match_operand:V16QI 0 "register_operand" "=v")
9717 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9719 (match_operand:V16QI 2 "vector_move_operand" "0C")
9720 (parallel [(const_int 0) (const_int 1)
9721 (const_int 2) (const_int 3)
9722 (const_int 4) (const_int 5)
9723 (const_int 6) (const_int 7)]))
9724 (match_operand:QI 3 "register_operand" "Yk"))
9725 (const_vector:V8QI [(const_int 0) (const_int 0)
9726 (const_int 0) (const_int 0)
9727 (const_int 0) (const_int 0)
9728 (const_int 0) (const_int 0)])))]
9730 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9731 [(set_attr "type" "ssemov")
9732 (set_attr "prefix" "evex")
9733 (set_attr "mode" "TI")])
9735 (define_insn "*avx512vl_<code><mode>v8qi2_mask_1"
9736 [(set (match_operand:V16QI 0 "register_operand" "=v")
9740 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9741 (const_vector:V8QI [(const_int 0) (const_int 0)
9742 (const_int 0) (const_int 0)
9743 (const_int 0) (const_int 0)
9744 (const_int 0) (const_int 0)])
9745 (match_operand:QI 2 "register_operand" "Yk"))
9746 (const_vector:V8QI [(const_int 0) (const_int 0)
9747 (const_int 0) (const_int 0)
9748 (const_int 0) (const_int 0)
9749 (const_int 0) (const_int 0)])))]
9751 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9752 [(set_attr "type" "ssemov")
9753 (set_attr "prefix" "evex")
9754 (set_attr "mode" "TI")])
9756 (define_insn "avx512vl_<code><mode>v8qi2_mask_store"
9757 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9761 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9764 (parallel [(const_int 0) (const_int 1)
9765 (const_int 2) (const_int 3)
9766 (const_int 4) (const_int 5)
9767 (const_int 6) (const_int 7)]))
9768 (match_operand:QI 2 "register_operand" "Yk"))
9771 (parallel [(const_int 8) (const_int 9)
9772 (const_int 10) (const_int 11)
9773 (const_int 12) (const_int 13)
9774 (const_int 14) (const_int 15)]))))]
9776 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}|%q0%{%2%}, %1}"
9777 [(set_attr "type" "ssemov")
9778 (set_attr "memory" "store")
9779 (set_attr "prefix" "evex")
9780 (set_attr "mode" "TI")])
9782 (define_mode_iterator PMOV_SRC_MODE_4 [V4DI V2DI V4SI])
9783 (define_mode_attr pmov_dst_4
9784 [(V4DI "V4HI") (V2DI "V2HI") (V4SI "V4HI")])
9785 (define_mode_attr pmov_dst_zeroed_4
9786 [(V4DI "V4HI") (V2DI "V6HI") (V4SI "V4HI")])
9787 (define_mode_attr pmov_suff_4
9788 [(V4DI "qw") (V2DI "qw") (V4SI "dw")])
9790 (define_insn "*avx512vl_<code><mode>v<ssescalarnum>hi2"
9791 [(set (match_operand:V8HI 0 "register_operand" "=v")
9793 (any_truncate:<pmov_dst_4>
9794 (match_operand:PMOV_SRC_MODE_4 1 "register_operand" "v"))
9795 (match_operand:<pmov_dst_zeroed_4> 2 "const0_operand")))]
9797 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0|%0, %1}"
9798 [(set_attr "type" "ssemov")
9799 (set_attr "prefix" "evex")
9800 (set_attr "mode" "TI")])
9802 (define_insn "*avx512vl_<code><mode>v4hi2_store"
9803 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9806 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9809 (parallel [(const_int 4) (const_int 5)
9810 (const_int 6) (const_int 7)]))))]
9812 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0|%0, %1}"
9813 [(set_attr "type" "ssemov")
9814 (set_attr "memory" "store")
9815 (set_attr "prefix" "evex")
9816 (set_attr "mode" "TI")])
9818 (define_insn "avx512vl_<code><mode>v4hi2_mask"
9819 [(set (match_operand:V8HI 0 "register_operand" "=v")
9823 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9825 (match_operand:V8HI 2 "vector_move_operand" "0C")
9826 (parallel [(const_int 0) (const_int 1)
9827 (const_int 2) (const_int 3)]))
9828 (match_operand:QI 3 "register_operand" "Yk"))
9829 (const_vector:V4HI [(const_int 0) (const_int 0)
9830 (const_int 0) (const_int 0)])))]
9832 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9833 [(set_attr "type" "ssemov")
9834 (set_attr "prefix" "evex")
9835 (set_attr "mode" "TI")])
9837 (define_insn "*avx512vl_<code><mode>v4hi2_mask_1"
9838 [(set (match_operand:V8HI 0 "register_operand" "=v")
9842 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9843 (const_vector:V4HI [(const_int 0) (const_int 0)
9844 (const_int 0) (const_int 0)])
9845 (match_operand:QI 2 "register_operand" "Yk"))
9846 (const_vector:V4HI [(const_int 0) (const_int 0)
9847 (const_int 0) (const_int 0)])))]
9849 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9850 [(set_attr "type" "ssemov")
9851 (set_attr "prefix" "evex")
9852 (set_attr "mode" "TI")])
9854 (define_insn "avx512vl_<code><mode>v4hi2_mask_store"
9855 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9859 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9862 (parallel [(const_int 0) (const_int 1)
9863 (const_int 2) (const_int 3)]))
9864 (match_operand:QI 2 "register_operand" "Yk"))
9867 (parallel [(const_int 4) (const_int 5)
9868 (const_int 6) (const_int 7)]))))]
9871 if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 4)
9872 return "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%2%}|%0%{%2%}, %t1}";
9873 return "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%2%}|%0%{%2%}, %g1}";
9875 [(set_attr "type" "ssemov")
9876 (set_attr "memory" "store")
9877 (set_attr "prefix" "evex")
9878 (set_attr "mode" "TI")])
9880 (define_insn "*avx512vl_<code>v2div2hi2_store"
9881 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9884 (match_operand:V2DI 1 "register_operand" "v"))
9887 (parallel [(const_int 2) (const_int 3)
9888 (const_int 4) (const_int 5)
9889 (const_int 6) (const_int 7)]))))]
9891 "vpmov<trunsuffix>qw\t{%1, %0|%0, %1}"
9892 [(set_attr "type" "ssemov")
9893 (set_attr "memory" "store")
9894 (set_attr "prefix" "evex")
9895 (set_attr "mode" "TI")])
9897 (define_insn "avx512vl_<code>v2div2hi2_mask"
9898 [(set (match_operand:V8HI 0 "register_operand" "=v")
9902 (match_operand:V2DI 1 "register_operand" "v"))
9904 (match_operand:V8HI 2 "vector_move_operand" "0C")
9905 (parallel [(const_int 0) (const_int 1)]))
9906 (match_operand:QI 3 "register_operand" "Yk"))
9907 (const_vector:V6HI [(const_int 0) (const_int 0)
9908 (const_int 0) (const_int 0)
9909 (const_int 0) (const_int 0)])))]
9911 "vpmov<trunsuffix>qw\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9912 [(set_attr "type" "ssemov")
9913 (set_attr "prefix" "evex")
9914 (set_attr "mode" "TI")])
9916 (define_insn "*avx512vl_<code>v2div2hi2_mask_1"
9917 [(set (match_operand:V8HI 0 "register_operand" "=v")
9921 (match_operand:V2DI 1 "register_operand" "v"))
9922 (const_vector:V2HI [(const_int 0) (const_int 0)])
9923 (match_operand:QI 2 "register_operand" "Yk"))
9924 (const_vector:V6HI [(const_int 0) (const_int 0)
9925 (const_int 0) (const_int 0)
9926 (const_int 0) (const_int 0)])))]
9928 "vpmov<trunsuffix>qw\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9929 [(set_attr "type" "ssemov")
9930 (set_attr "prefix" "evex")
9931 (set_attr "mode" "TI")])
9933 (define_insn "avx512vl_<code>v2div2hi2_mask_store"
9934 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9938 (match_operand:V2DI 1 "register_operand" "v"))
9941 (parallel [(const_int 0) (const_int 1)]))
9942 (match_operand:QI 2 "register_operand" "Yk"))
9945 (parallel [(const_int 2) (const_int 3)
9946 (const_int 4) (const_int 5)
9947 (const_int 6) (const_int 7)]))))]
9949 "vpmov<trunsuffix>qw\t{%1, %0%{%2%}|%0%{%2%}, %g1}"
9950 [(set_attr "type" "ssemov")
9951 (set_attr "memory" "store")
9952 (set_attr "prefix" "evex")
9953 (set_attr "mode" "TI")])
9955 (define_insn "*avx512vl_<code>v2div2si2"
9956 [(set (match_operand:V4SI 0 "register_operand" "=v")
9959 (match_operand:V2DI 1 "register_operand" "v"))
9960 (match_operand:V2SI 2 "const0_operand")))]
9962 "vpmov<trunsuffix>qd\t{%1, %0|%0, %1}"
9963 [(set_attr "type" "ssemov")
9964 (set_attr "prefix" "evex")
9965 (set_attr "mode" "TI")])
9967 (define_insn "*avx512vl_<code>v2div2si2_store"
9968 [(set (match_operand:V4SI 0 "memory_operand" "=m")
9971 (match_operand:V2DI 1 "register_operand" "v"))
9974 (parallel [(const_int 2) (const_int 3)]))))]
9976 "vpmov<trunsuffix>qd\t{%1, %0|%0, %1}"
9977 [(set_attr "type" "ssemov")
9978 (set_attr "memory" "store")
9979 (set_attr "prefix" "evex")
9980 (set_attr "mode" "TI")])
9982 (define_insn "avx512vl_<code>v2div2si2_mask"
9983 [(set (match_operand:V4SI 0 "register_operand" "=v")
9987 (match_operand:V2DI 1 "register_operand" "v"))
9989 (match_operand:V4SI 2 "vector_move_operand" "0C")
9990 (parallel [(const_int 0) (const_int 1)]))
9991 (match_operand:QI 3 "register_operand" "Yk"))
9992 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
9994 "vpmov<trunsuffix>qd\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9995 [(set_attr "type" "ssemov")
9996 (set_attr "prefix" "evex")
9997 (set_attr "mode" "TI")])
9999 (define_insn "*avx512vl_<code>v2div2si2_mask_1"
10000 [(set (match_operand:V4SI 0 "register_operand" "=v")
10004 (match_operand:V2DI 1 "register_operand" "v"))
10005 (const_vector:V2SI [(const_int 0) (const_int 0)])
10006 (match_operand:QI 2 "register_operand" "Yk"))
10007 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
10009 "vpmov<trunsuffix>qd\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
10010 [(set_attr "type" "ssemov")
10011 (set_attr "prefix" "evex")
10012 (set_attr "mode" "TI")])
10014 (define_insn "avx512vl_<code>v2div2si2_mask_store"
10015 [(set (match_operand:V4SI 0 "memory_operand" "=m")
10019 (match_operand:V2DI 1 "register_operand" "v"))
10022 (parallel [(const_int 0) (const_int 1)]))
10023 (match_operand:QI 2 "register_operand" "Yk"))
10026 (parallel [(const_int 2) (const_int 3)]))))]
10028 "vpmov<trunsuffix>qd\t{%1, %0%{%2%}|%0%{%2%}, %t1}"
10029 [(set_attr "type" "ssemov")
10030 (set_attr "memory" "store")
10031 (set_attr "prefix" "evex")
10032 (set_attr "mode" "TI")])
10034 (define_insn "*avx512f_<code>v8div16qi2"
10035 [(set (match_operand:V16QI 0 "register_operand" "=v")
10038 (match_operand:V8DI 1 "register_operand" "v"))
10039 (const_vector:V8QI [(const_int 0) (const_int 0)
10040 (const_int 0) (const_int 0)
10041 (const_int 0) (const_int 0)
10042 (const_int 0) (const_int 0)])))]
10044 "vpmov<trunsuffix>qb\t{%1, %0|%0, %1}"
10045 [(set_attr "type" "ssemov")
10046 (set_attr "prefix" "evex")
10047 (set_attr "mode" "TI")])
10049 (define_insn "*avx512f_<code>v8div16qi2_store"
10050 [(set (match_operand:V16QI 0 "memory_operand" "=m")
10053 (match_operand:V8DI 1 "register_operand" "v"))
10056 (parallel [(const_int 8) (const_int 9)
10057 (const_int 10) (const_int 11)
10058 (const_int 12) (const_int 13)
10059 (const_int 14) (const_int 15)]))))]
10061 "vpmov<trunsuffix>qb\t{%1, %0|%0, %1}"
10062 [(set_attr "type" "ssemov")
10063 (set_attr "memory" "store")
10064 (set_attr "prefix" "evex")
10065 (set_attr "mode" "TI")])
10067 (define_insn "avx512f_<code>v8div16qi2_mask"
10068 [(set (match_operand:V16QI 0 "register_operand" "=v")
10072 (match_operand:V8DI 1 "register_operand" "v"))
10074 (match_operand:V16QI 2 "vector_move_operand" "0C")
10075 (parallel [(const_int 0) (const_int 1)
10076 (const_int 2) (const_int 3)
10077 (const_int 4) (const_int 5)
10078 (const_int 6) (const_int 7)]))
10079 (match_operand:QI 3 "register_operand" "Yk"))
10080 (const_vector:V8QI [(const_int 0) (const_int 0)
10081 (const_int 0) (const_int 0)
10082 (const_int 0) (const_int 0)
10083 (const_int 0) (const_int 0)])))]
10085 "vpmov<trunsuffix>qb\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
10086 [(set_attr "type" "ssemov")
10087 (set_attr "prefix" "evex")
10088 (set_attr "mode" "TI")])
10090 (define_insn "*avx512f_<code>v8div16qi2_mask_1"
10091 [(set (match_operand:V16QI 0 "register_operand" "=v")
10095 (match_operand:V8DI 1 "register_operand" "v"))
10096 (const_vector:V8QI [(const_int 0) (const_int 0)
10097 (const_int 0) (const_int 0)
10098 (const_int 0) (const_int 0)
10099 (const_int 0) (const_int 0)])
10100 (match_operand:QI 2 "register_operand" "Yk"))
10101 (const_vector:V8QI [(const_int 0) (const_int 0)
10102 (const_int 0) (const_int 0)
10103 (const_int 0) (const_int 0)
10104 (const_int 0) (const_int 0)])))]
10106 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
10107 [(set_attr "type" "ssemov")
10108 (set_attr "prefix" "evex")
10109 (set_attr "mode" "TI")])
10111 (define_insn "avx512f_<code>v8div16qi2_mask_store"
10112 [(set (match_operand:V16QI 0 "memory_operand" "=m")
10116 (match_operand:V8DI 1 "register_operand" "v"))
10119 (parallel [(const_int 0) (const_int 1)
10120 (const_int 2) (const_int 3)
10121 (const_int 4) (const_int 5)
10122 (const_int 6) (const_int 7)]))
10123 (match_operand:QI 2 "register_operand" "Yk"))
10126 (parallel [(const_int 8) (const_int 9)
10127 (const_int 10) (const_int 11)
10128 (const_int 12) (const_int 13)
10129 (const_int 14) (const_int 15)]))))]
10131 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}|%q0%{%2%}, %1}"
10132 [(set_attr "type" "ssemov")
10133 (set_attr "memory" "store")
10134 (set_attr "prefix" "evex")
10135 (set_attr "mode" "TI")])
10137 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
10139 ;; Parallel integral arithmetic
10141 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
10143 (define_expand "neg<mode>2"
10144 [(set (match_operand:VI_AVX2 0 "register_operand")
10147 (match_operand:VI_AVX2 1 "vector_operand")))]
10149 "operands[2] = force_reg (<MODE>mode, CONST0_RTX (<MODE>mode));")
10151 (define_expand "<plusminus_insn><mode>3"
10152 [(set (match_operand:VI_AVX2 0 "register_operand")
10154 (match_operand:VI_AVX2 1 "vector_operand")
10155 (match_operand:VI_AVX2 2 "vector_operand")))]
10157 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
10159 (define_expand "<plusminus_insn><mode>3_mask"
10160 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
10161 (vec_merge:VI48_AVX512VL
10162 (plusminus:VI48_AVX512VL
10163 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand")
10164 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand"))
10165 (match_operand:VI48_AVX512VL 3 "vector_move_operand")
10166 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
10168 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
10170 (define_expand "<plusminus_insn><mode>3_mask"
10171 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
10172 (vec_merge:VI12_AVX512VL
10173 (plusminus:VI12_AVX512VL
10174 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand")
10175 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand"))
10176 (match_operand:VI12_AVX512VL 3 "vector_move_operand")
10177 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
10179 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
10181 (define_insn "*<plusminus_insn><mode>3"
10182 [(set (match_operand:VI_AVX2 0 "register_operand" "=x,v")
10184 (match_operand:VI_AVX2 1 "vector_operand" "<comm>0,v")
10185 (match_operand:VI_AVX2 2 "vector_operand" "xBm,vm")))]
10186 "TARGET_SSE2 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
10188 p<plusminus_mnemonic><ssemodesuffix>\t{%2, %0|%0, %2}
10189 vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
10190 [(set_attr "isa" "noavx,avx")
10191 (set_attr "type" "sseiadd")
10192 (set_attr "prefix_data16" "1,*")
10193 (set_attr "prefix" "orig,vex")
10194 (set_attr "mode" "<sseinsnmode>")])
10196 (define_insn "*<plusminus_insn><mode>3_mask"
10197 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
10198 (vec_merge:VI48_AVX512VL
10199 (plusminus:VI48_AVX512VL
10200 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "<comm>v")
10201 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm"))
10202 (match_operand:VI48_AVX512VL 3 "vector_move_operand" "0C")
10203 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
10204 "TARGET_AVX512F && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
10205 "vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
10206 [(set_attr "type" "sseiadd")
10207 (set_attr "prefix" "evex")
10208 (set_attr "mode" "<sseinsnmode>")])
10210 (define_insn "*<plusminus_insn><mode>3_mask"
10211 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
10212 (vec_merge:VI12_AVX512VL
10213 (plusminus:VI12_AVX512VL
10214 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "<comm>v")
10215 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm"))
10216 (match_operand:VI12_AVX512VL 3 "vector_move_operand" "0C")
10217 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
10218 "TARGET_AVX512BW && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
10219 "vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
10220 [(set_attr "type" "sseiadd")
10221 (set_attr "prefix" "evex")
10222 (set_attr "mode" "<sseinsnmode>")])
10224 (define_expand "<sse2_avx2>_<plusminus_insn><mode>3<mask_name>"
10225 [(set (match_operand:VI12_AVX2 0 "register_operand")
10226 (sat_plusminus:VI12_AVX2
10227 (match_operand:VI12_AVX2 1 "vector_operand")
10228 (match_operand:VI12_AVX2 2 "vector_operand")))]
10229 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10230 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
10232 (define_insn "*<sse2_avx2>_<plusminus_insn><mode>3<mask_name>"
10233 [(set (match_operand:VI12_AVX2 0 "register_operand" "=x,v")
10234 (sat_plusminus:VI12_AVX2
10235 (match_operand:VI12_AVX2 1 "vector_operand" "<comm>0,v")
10236 (match_operand:VI12_AVX2 2 "vector_operand" "xBm,vm")))]
10237 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>
10238 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
10240 p<plusminus_mnemonic><ssemodesuffix>\t{%2, %0|%0, %2}
10241 vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10242 [(set_attr "isa" "noavx,avx")
10243 (set_attr "type" "sseiadd")
10244 (set_attr "prefix_data16" "1,*")
10245 (set_attr "prefix" "orig,maybe_evex")
10246 (set_attr "mode" "TI")])
10248 (define_expand "mul<mode>3<mask_name>"
10249 [(set (match_operand:VI1_AVX512 0 "register_operand")
10250 (mult:VI1_AVX512 (match_operand:VI1_AVX512 1 "register_operand")
10251 (match_operand:VI1_AVX512 2 "register_operand")))]
10252 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10254 ix86_expand_vecop_qihi (MULT, operands[0], operands[1], operands[2]);
10258 (define_expand "mul<mode>3<mask_name>"
10259 [(set (match_operand:VI2_AVX2 0 "register_operand")
10260 (mult:VI2_AVX2 (match_operand:VI2_AVX2 1 "vector_operand")
10261 (match_operand:VI2_AVX2 2 "vector_operand")))]
10262 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10263 "ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);")
10265 (define_insn "*mul<mode>3<mask_name>"
10266 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,v")
10267 (mult:VI2_AVX2 (match_operand:VI2_AVX2 1 "vector_operand" "%0,v")
10268 (match_operand:VI2_AVX2 2 "vector_operand" "xBm,vm")))]
10269 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
10270 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10272 pmullw\t{%2, %0|%0, %2}
10273 vpmullw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10274 [(set_attr "isa" "noavx,avx")
10275 (set_attr "type" "sseimul")
10276 (set_attr "prefix_data16" "1,*")
10277 (set_attr "prefix" "orig,vex")
10278 (set_attr "mode" "<sseinsnmode>")])
10280 (define_expand "<s>mul<mode>3_highpart<mask_name>"
10281 [(set (match_operand:VI2_AVX2 0 "register_operand")
10283 (lshiftrt:<ssedoublemode>
10284 (mult:<ssedoublemode>
10285 (any_extend:<ssedoublemode>
10286 (match_operand:VI2_AVX2 1 "vector_operand"))
10287 (any_extend:<ssedoublemode>
10288 (match_operand:VI2_AVX2 2 "vector_operand")))
10291 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10292 "ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);")
10294 (define_insn "*<s>mul<mode>3_highpart<mask_name>"
10295 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,v")
10297 (lshiftrt:<ssedoublemode>
10298 (mult:<ssedoublemode>
10299 (any_extend:<ssedoublemode>
10300 (match_operand:VI2_AVX2 1 "vector_operand" "%0,v"))
10301 (any_extend:<ssedoublemode>
10302 (match_operand:VI2_AVX2 2 "vector_operand" "xBm,vm")))
10304 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
10305 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10307 pmulh<u>w\t{%2, %0|%0, %2}
10308 vpmulh<u>w\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10309 [(set_attr "isa" "noavx,avx")
10310 (set_attr "type" "sseimul")
10311 (set_attr "prefix_data16" "1,*")
10312 (set_attr "prefix" "orig,vex")
10313 (set_attr "mode" "<sseinsnmode>")])
10315 (define_expand "vec_widen_umult_even_v16si<mask_name>"
10316 [(set (match_operand:V8DI 0 "register_operand")
10320 (match_operand:V16SI 1 "nonimmediate_operand")
10321 (parallel [(const_int 0) (const_int 2)
10322 (const_int 4) (const_int 6)
10323 (const_int 8) (const_int 10)
10324 (const_int 12) (const_int 14)])))
10327 (match_operand:V16SI 2 "nonimmediate_operand")
10328 (parallel [(const_int 0) (const_int 2)
10329 (const_int 4) (const_int 6)
10330 (const_int 8) (const_int 10)
10331 (const_int 12) (const_int 14)])))))]
10333 "ix86_fixup_binary_operands_no_copy (MULT, V16SImode, operands);")
10335 (define_insn "*vec_widen_umult_even_v16si<mask_name>"
10336 [(set (match_operand:V8DI 0 "register_operand" "=v")
10340 (match_operand:V16SI 1 "nonimmediate_operand" "%v")
10341 (parallel [(const_int 0) (const_int 2)
10342 (const_int 4) (const_int 6)
10343 (const_int 8) (const_int 10)
10344 (const_int 12) (const_int 14)])))
10347 (match_operand:V16SI 2 "nonimmediate_operand" "vm")
10348 (parallel [(const_int 0) (const_int 2)
10349 (const_int 4) (const_int 6)
10350 (const_int 8) (const_int 10)
10351 (const_int 12) (const_int 14)])))))]
10352 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10353 "vpmuludq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10354 [(set_attr "type" "sseimul")
10355 (set_attr "prefix_extra" "1")
10356 (set_attr "prefix" "evex")
10357 (set_attr "mode" "XI")])
10359 (define_expand "vec_widen_umult_even_v8si<mask_name>"
10360 [(set (match_operand:V4DI 0 "register_operand")
10364 (match_operand:V8SI 1 "nonimmediate_operand")
10365 (parallel [(const_int 0) (const_int 2)
10366 (const_int 4) (const_int 6)])))
10369 (match_operand:V8SI 2 "nonimmediate_operand")
10370 (parallel [(const_int 0) (const_int 2)
10371 (const_int 4) (const_int 6)])))))]
10372 "TARGET_AVX2 && <mask_avx512vl_condition>"
10373 "ix86_fixup_binary_operands_no_copy (MULT, V8SImode, operands);")
10375 (define_insn "*vec_widen_umult_even_v8si<mask_name>"
10376 [(set (match_operand:V4DI 0 "register_operand" "=v")
10380 (match_operand:V8SI 1 "nonimmediate_operand" "%v")
10381 (parallel [(const_int 0) (const_int 2)
10382 (const_int 4) (const_int 6)])))
10385 (match_operand:V8SI 2 "nonimmediate_operand" "vm")
10386 (parallel [(const_int 0) (const_int 2)
10387 (const_int 4) (const_int 6)])))))]
10388 "TARGET_AVX2 && <mask_avx512vl_condition>
10389 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10390 "vpmuludq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10391 [(set_attr "type" "sseimul")
10392 (set_attr "prefix" "maybe_evex")
10393 (set_attr "mode" "OI")])
10395 (define_expand "vec_widen_umult_even_v4si<mask_name>"
10396 [(set (match_operand:V2DI 0 "register_operand")
10400 (match_operand:V4SI 1 "vector_operand")
10401 (parallel [(const_int 0) (const_int 2)])))
10404 (match_operand:V4SI 2 "vector_operand")
10405 (parallel [(const_int 0) (const_int 2)])))))]
10406 "TARGET_SSE2 && <mask_avx512vl_condition>"
10407 "ix86_fixup_binary_operands_no_copy (MULT, V4SImode, operands);")
10409 (define_insn "*vec_widen_umult_even_v4si<mask_name>"
10410 [(set (match_operand:V2DI 0 "register_operand" "=x,v")
10414 (match_operand:V4SI 1 "vector_operand" "%0,v")
10415 (parallel [(const_int 0) (const_int 2)])))
10418 (match_operand:V4SI 2 "vector_operand" "xBm,vm")
10419 (parallel [(const_int 0) (const_int 2)])))))]
10420 "TARGET_SSE2 && <mask_avx512vl_condition>
10421 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10423 pmuludq\t{%2, %0|%0, %2}
10424 vpmuludq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10425 [(set_attr "isa" "noavx,avx")
10426 (set_attr "type" "sseimul")
10427 (set_attr "prefix_data16" "1,*")
10428 (set_attr "prefix" "orig,maybe_evex")
10429 (set_attr "mode" "TI")])
10431 (define_expand "vec_widen_smult_even_v16si<mask_name>"
10432 [(set (match_operand:V8DI 0 "register_operand")
10436 (match_operand:V16SI 1 "nonimmediate_operand")
10437 (parallel [(const_int 0) (const_int 2)
10438 (const_int 4) (const_int 6)
10439 (const_int 8) (const_int 10)
10440 (const_int 12) (const_int 14)])))
10443 (match_operand:V16SI 2 "nonimmediate_operand")
10444 (parallel [(const_int 0) (const_int 2)
10445 (const_int 4) (const_int 6)
10446 (const_int 8) (const_int 10)
10447 (const_int 12) (const_int 14)])))))]
10449 "ix86_fixup_binary_operands_no_copy (MULT, V16SImode, operands);")
10451 (define_insn "*vec_widen_smult_even_v16si<mask_name>"
10452 [(set (match_operand:V8DI 0 "register_operand" "=v")
10456 (match_operand:V16SI 1 "nonimmediate_operand" "%v")
10457 (parallel [(const_int 0) (const_int 2)
10458 (const_int 4) (const_int 6)
10459 (const_int 8) (const_int 10)
10460 (const_int 12) (const_int 14)])))
10463 (match_operand:V16SI 2 "nonimmediate_operand" "vm")
10464 (parallel [(const_int 0) (const_int 2)
10465 (const_int 4) (const_int 6)
10466 (const_int 8) (const_int 10)
10467 (const_int 12) (const_int 14)])))))]
10468 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10469 "vpmuldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10470 [(set_attr "type" "sseimul")
10471 (set_attr "prefix_extra" "1")
10472 (set_attr "prefix" "evex")
10473 (set_attr "mode" "XI")])
10475 (define_expand "vec_widen_smult_even_v8si<mask_name>"
10476 [(set (match_operand:V4DI 0 "register_operand")
10480 (match_operand:V8SI 1 "nonimmediate_operand")
10481 (parallel [(const_int 0) (const_int 2)
10482 (const_int 4) (const_int 6)])))
10485 (match_operand:V8SI 2 "nonimmediate_operand")
10486 (parallel [(const_int 0) (const_int 2)
10487 (const_int 4) (const_int 6)])))))]
10488 "TARGET_AVX2 && <mask_avx512vl_condition>"
10489 "ix86_fixup_binary_operands_no_copy (MULT, V8SImode, operands);")
10491 (define_insn "*vec_widen_smult_even_v8si<mask_name>"
10492 [(set (match_operand:V4DI 0 "register_operand" "=v")
10496 (match_operand:V8SI 1 "nonimmediate_operand" "%v")
10497 (parallel [(const_int 0) (const_int 2)
10498 (const_int 4) (const_int 6)])))
10501 (match_operand:V8SI 2 "nonimmediate_operand" "vm")
10502 (parallel [(const_int 0) (const_int 2)
10503 (const_int 4) (const_int 6)])))))]
10504 "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10505 "vpmuldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10506 [(set_attr "type" "sseimul")
10507 (set_attr "prefix_extra" "1")
10508 (set_attr "prefix" "vex")
10509 (set_attr "mode" "OI")])
10511 (define_expand "sse4_1_mulv2siv2di3<mask_name>"
10512 [(set (match_operand:V2DI 0 "register_operand")
10516 (match_operand:V4SI 1 "vector_operand")
10517 (parallel [(const_int 0) (const_int 2)])))
10520 (match_operand:V4SI 2 "vector_operand")
10521 (parallel [(const_int 0) (const_int 2)])))))]
10522 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
10523 "ix86_fixup_binary_operands_no_copy (MULT, V4SImode, operands);")
10525 (define_insn "*sse4_1_mulv2siv2di3<mask_name>"
10526 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
10530 (match_operand:V4SI 1 "vector_operand" "%0,0,v")
10531 (parallel [(const_int 0) (const_int 2)])))
10534 (match_operand:V4SI 2 "vector_operand" "YrBm,*xBm,vm")
10535 (parallel [(const_int 0) (const_int 2)])))))]
10536 "TARGET_SSE4_1 && <mask_avx512vl_condition>
10537 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10539 pmuldq\t{%2, %0|%0, %2}
10540 pmuldq\t{%2, %0|%0, %2}
10541 vpmuldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10542 [(set_attr "isa" "noavx,noavx,avx")
10543 (set_attr "type" "sseimul")
10544 (set_attr "prefix_data16" "1,1,*")
10545 (set_attr "prefix_extra" "1")
10546 (set_attr "prefix" "orig,orig,vex")
10547 (set_attr "mode" "TI")])
10549 (define_insn "avx512bw_pmaddwd512<mode><mask_name>"
10550 [(set (match_operand:<sseunpackmode> 0 "register_operand" "=v")
10551 (unspec:<sseunpackmode>
10552 [(match_operand:VI2_AVX2 1 "register_operand" "v")
10553 (match_operand:VI2_AVX2 2 "nonimmediate_operand" "vm")]
10554 UNSPEC_PMADDWD512))]
10555 "TARGET_AVX512BW && <mask_mode512bit_condition>"
10556 "vpmaddwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}";
10557 [(set_attr "type" "sseiadd")
10558 (set_attr "prefix" "evex")
10559 (set_attr "mode" "XI")])
10561 (define_expand "avx2_pmaddwd"
10562 [(set (match_operand:V8SI 0 "register_operand")
10567 (match_operand:V16HI 1 "nonimmediate_operand")
10568 (parallel [(const_int 0) (const_int 2)
10569 (const_int 4) (const_int 6)
10570 (const_int 8) (const_int 10)
10571 (const_int 12) (const_int 14)])))
10574 (match_operand:V16HI 2 "nonimmediate_operand")
10575 (parallel [(const_int 0) (const_int 2)
10576 (const_int 4) (const_int 6)
10577 (const_int 8) (const_int 10)
10578 (const_int 12) (const_int 14)]))))
10581 (vec_select:V8HI (match_dup 1)
10582 (parallel [(const_int 1) (const_int 3)
10583 (const_int 5) (const_int 7)
10584 (const_int 9) (const_int 11)
10585 (const_int 13) (const_int 15)])))
10587 (vec_select:V8HI (match_dup 2)
10588 (parallel [(const_int 1) (const_int 3)
10589 (const_int 5) (const_int 7)
10590 (const_int 9) (const_int 11)
10591 (const_int 13) (const_int 15)]))))))]
10593 "ix86_fixup_binary_operands_no_copy (MULT, V16HImode, operands);")
10595 (define_insn "*avx2_pmaddwd"
10596 [(set (match_operand:V8SI 0 "register_operand" "=x,v")
10601 (match_operand:V16HI 1 "nonimmediate_operand" "%x,v")
10602 (parallel [(const_int 0) (const_int 2)
10603 (const_int 4) (const_int 6)
10604 (const_int 8) (const_int 10)
10605 (const_int 12) (const_int 14)])))
10608 (match_operand:V16HI 2 "nonimmediate_operand" "xm,vm")
10609 (parallel [(const_int 0) (const_int 2)
10610 (const_int 4) (const_int 6)
10611 (const_int 8) (const_int 10)
10612 (const_int 12) (const_int 14)]))))
10615 (vec_select:V8HI (match_dup 1)
10616 (parallel [(const_int 1) (const_int 3)
10617 (const_int 5) (const_int 7)
10618 (const_int 9) (const_int 11)
10619 (const_int 13) (const_int 15)])))
10621 (vec_select:V8HI (match_dup 2)
10622 (parallel [(const_int 1) (const_int 3)
10623 (const_int 5) (const_int 7)
10624 (const_int 9) (const_int 11)
10625 (const_int 13) (const_int 15)]))))))]
10626 "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10627 "vpmaddwd\t{%2, %1, %0|%0, %1, %2}"
10628 [(set_attr "type" "sseiadd")
10629 (set_attr "isa" "*,avx512bw")
10630 (set_attr "prefix" "vex,evex")
10631 (set_attr "mode" "OI")])
10633 (define_expand "sse2_pmaddwd"
10634 [(set (match_operand:V4SI 0 "register_operand")
10639 (match_operand:V8HI 1 "vector_operand")
10640 (parallel [(const_int 0) (const_int 2)
10641 (const_int 4) (const_int 6)])))
10644 (match_operand:V8HI 2 "vector_operand")
10645 (parallel [(const_int 0) (const_int 2)
10646 (const_int 4) (const_int 6)]))))
10649 (vec_select:V4HI (match_dup 1)
10650 (parallel [(const_int 1) (const_int 3)
10651 (const_int 5) (const_int 7)])))
10653 (vec_select:V4HI (match_dup 2)
10654 (parallel [(const_int 1) (const_int 3)
10655 (const_int 5) (const_int 7)]))))))]
10657 "ix86_fixup_binary_operands_no_copy (MULT, V8HImode, operands);")
10659 (define_insn "*sse2_pmaddwd"
10660 [(set (match_operand:V4SI 0 "register_operand" "=x,x,v")
10665 (match_operand:V8HI 1 "vector_operand" "%0,x,v")
10666 (parallel [(const_int 0) (const_int 2)
10667 (const_int 4) (const_int 6)])))
10670 (match_operand:V8HI 2 "vector_operand" "xBm,xm,vm")
10671 (parallel [(const_int 0) (const_int 2)
10672 (const_int 4) (const_int 6)]))))
10675 (vec_select:V4HI (match_dup 1)
10676 (parallel [(const_int 1) (const_int 3)
10677 (const_int 5) (const_int 7)])))
10679 (vec_select:V4HI (match_dup 2)
10680 (parallel [(const_int 1) (const_int 3)
10681 (const_int 5) (const_int 7)]))))))]
10682 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10684 pmaddwd\t{%2, %0|%0, %2}
10685 vpmaddwd\t{%2, %1, %0|%0, %1, %2}
10686 vpmaddwd\t{%2, %1, %0|%0, %1, %2}"
10687 [(set_attr "isa" "noavx,avx,avx512bw")
10688 (set_attr "type" "sseiadd")
10689 (set_attr "atom_unit" "simul")
10690 (set_attr "prefix_data16" "1,*,*")
10691 (set_attr "prefix" "orig,vex,evex")
10692 (set_attr "mode" "TI")])
10694 (define_insn "avx512dq_mul<mode>3<mask_name>"
10695 [(set (match_operand:VI8 0 "register_operand" "=v")
10697 (match_operand:VI8 1 "register_operand" "v")
10698 (match_operand:VI8 2 "nonimmediate_operand" "vm")))]
10699 "TARGET_AVX512DQ && <mask_mode512bit_condition>"
10700 "vpmullq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10701 [(set_attr "type" "sseimul")
10702 (set_attr "prefix" "evex")
10703 (set_attr "mode" "<sseinsnmode>")])
10705 (define_expand "mul<mode>3<mask_name>"
10706 [(set (match_operand:VI4_AVX512F 0 "register_operand")
10708 (match_operand:VI4_AVX512F 1 "general_vector_operand")
10709 (match_operand:VI4_AVX512F 2 "general_vector_operand")))]
10710 "TARGET_SSE2 && <mask_mode512bit_condition>"
10714 if (!vector_operand (operands[1], <MODE>mode))
10715 operands[1] = force_reg (<MODE>mode, operands[1]);
10716 if (!vector_operand (operands[2], <MODE>mode))
10717 operands[2] = force_reg (<MODE>mode, operands[2]);
10718 ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);
10722 ix86_expand_sse2_mulv4si3 (operands[0], operands[1], operands[2]);
10727 (define_insn "*<sse4_1_avx2>_mul<mode>3<mask_name>"
10728 [(set (match_operand:VI4_AVX512F 0 "register_operand" "=Yr,*x,v")
10730 (match_operand:VI4_AVX512F 1 "vector_operand" "%0,0,v")
10731 (match_operand:VI4_AVX512F 2 "vector_operand" "YrBm,*xBm,vm")))]
10732 "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
10733 && <mask_mode512bit_condition>"
10735 pmulld\t{%2, %0|%0, %2}
10736 pmulld\t{%2, %0|%0, %2}
10737 vpmulld\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10738 [(set_attr "isa" "noavx,noavx,avx")
10739 (set_attr "type" "sseimul")
10740 (set_attr "prefix_extra" "1")
10741 (set_attr "prefix" "<mask_prefix4>")
10742 (set_attr "btver2_decode" "vector,vector,vector")
10743 (set_attr "mode" "<sseinsnmode>")])
10745 (define_expand "mul<mode>3"
10746 [(set (match_operand:VI8_AVX2_AVX512F 0 "register_operand")
10747 (mult:VI8_AVX2_AVX512F
10748 (match_operand:VI8_AVX2_AVX512F 1 "register_operand")
10749 (match_operand:VI8_AVX2_AVX512F 2 "register_operand")))]
10752 ix86_expand_sse2_mulvxdi3 (operands[0], operands[1], operands[2]);
10756 (define_expand "vec_widen_<s>mult_hi_<mode>"
10757 [(match_operand:<sseunpackmode> 0 "register_operand")
10758 (any_extend:<sseunpackmode>
10759 (match_operand:VI124_AVX2 1 "register_operand"))
10760 (match_operand:VI124_AVX2 2 "register_operand")]
10763 ix86_expand_mul_widen_hilo (operands[0], operands[1], operands[2],
10768 (define_expand "vec_widen_<s>mult_lo_<mode>"
10769 [(match_operand:<sseunpackmode> 0 "register_operand")
10770 (any_extend:<sseunpackmode>
10771 (match_operand:VI124_AVX2 1 "register_operand"))
10772 (match_operand:VI124_AVX2 2 "register_operand")]
10775 ix86_expand_mul_widen_hilo (operands[0], operands[1], operands[2],
10780 ;; Most widen_<s>mult_even_<mode> can be handled directly from other
10781 ;; named patterns, but signed V4SI needs special help for plain SSE2.
10782 (define_expand "vec_widen_smult_even_v4si"
10783 [(match_operand:V2DI 0 "register_operand")
10784 (match_operand:V4SI 1 "vector_operand")
10785 (match_operand:V4SI 2 "vector_operand")]
10788 ix86_expand_mul_widen_evenodd (operands[0], operands[1], operands[2],
10793 (define_expand "vec_widen_<s>mult_odd_<mode>"
10794 [(match_operand:<sseunpackmode> 0 "register_operand")
10795 (any_extend:<sseunpackmode>
10796 (match_operand:VI4_AVX512F 1 "general_vector_operand"))
10797 (match_operand:VI4_AVX512F 2 "general_vector_operand")]
10800 ix86_expand_mul_widen_evenodd (operands[0], operands[1], operands[2],
10805 (define_mode_attr SDOT_PMADD_SUF
10806 [(V32HI "512v32hi") (V16HI "") (V8HI "")])
10808 (define_expand "sdot_prod<mode>"
10809 [(match_operand:<sseunpackmode> 0 "register_operand")
10810 (match_operand:VI2_AVX2 1 "register_operand")
10811 (match_operand:VI2_AVX2 2 "register_operand")
10812 (match_operand:<sseunpackmode> 3 "register_operand")]
10815 rtx t = gen_reg_rtx (<sseunpackmode>mode);
10816 emit_insn (gen_<sse2_avx2>_pmaddwd<SDOT_PMADD_SUF> (t, operands[1], operands[2]));
10817 emit_insn (gen_rtx_SET (operands[0],
10818 gen_rtx_PLUS (<sseunpackmode>mode,
10823 ;; Normally we use widen_mul_even/odd, but combine can't quite get it all
10824 ;; back together when madd is available.
10825 (define_expand "sdot_prodv4si"
10826 [(match_operand:V2DI 0 "register_operand")
10827 (match_operand:V4SI 1 "register_operand")
10828 (match_operand:V4SI 2 "register_operand")
10829 (match_operand:V2DI 3 "register_operand")]
10832 rtx t = gen_reg_rtx (V2DImode);
10833 emit_insn (gen_xop_pmacsdqh (t, operands[1], operands[2], operands[3]));
10834 emit_insn (gen_xop_pmacsdql (operands[0], operands[1], operands[2], t));
10838 (define_expand "usadv16qi"
10839 [(match_operand:V4SI 0 "register_operand")
10840 (match_operand:V16QI 1 "register_operand")
10841 (match_operand:V16QI 2 "vector_operand")
10842 (match_operand:V4SI 3 "vector_operand")]
10845 rtx t1 = gen_reg_rtx (V2DImode);
10846 rtx t2 = gen_reg_rtx (V4SImode);
10847 emit_insn (gen_sse2_psadbw (t1, operands[1], operands[2]));
10848 convert_move (t2, t1, 0);
10849 emit_insn (gen_addv4si3 (operands[0], t2, operands[3]));
10853 (define_expand "usadv32qi"
10854 [(match_operand:V8SI 0 "register_operand")
10855 (match_operand:V32QI 1 "register_operand")
10856 (match_operand:V32QI 2 "nonimmediate_operand")
10857 (match_operand:V8SI 3 "nonimmediate_operand")]
10860 rtx t1 = gen_reg_rtx (V4DImode);
10861 rtx t2 = gen_reg_rtx (V8SImode);
10862 emit_insn (gen_avx2_psadbw (t1, operands[1], operands[2]));
10863 convert_move (t2, t1, 0);
10864 emit_insn (gen_addv8si3 (operands[0], t2, operands[3]));
10868 (define_insn "<mask_codefor>ashr<mode>3<mask_name>"
10869 [(set (match_operand:VI248_AVX512BW_1 0 "register_operand" "=v,v")
10870 (ashiftrt:VI248_AVX512BW_1
10871 (match_operand:VI248_AVX512BW_1 1 "nonimmediate_operand" "v,vm")
10872 (match_operand:DI 2 "nonmemory_operand" "v,N")))]
10874 "vpsra<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10875 [(set_attr "type" "sseishft")
10876 (set (attr "length_immediate")
10877 (if_then_else (match_operand 2 "const_int_operand")
10879 (const_string "0")))
10880 (set_attr "mode" "<sseinsnmode>")])
10882 (define_insn "ashr<mode>3"
10883 [(set (match_operand:VI24_AVX2 0 "register_operand" "=x,x")
10884 (ashiftrt:VI24_AVX2
10885 (match_operand:VI24_AVX2 1 "register_operand" "0,x")
10886 (match_operand:DI 2 "nonmemory_operand" "xN,xN")))]
10889 psra<ssemodesuffix>\t{%2, %0|%0, %2}
10890 vpsra<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
10891 [(set_attr "isa" "noavx,avx")
10892 (set_attr "type" "sseishft")
10893 (set (attr "length_immediate")
10894 (if_then_else (match_operand 2 "const_int_operand")
10896 (const_string "0")))
10897 (set_attr "prefix_data16" "1,*")
10898 (set_attr "prefix" "orig,vex")
10899 (set_attr "mode" "<sseinsnmode>")])
10901 (define_insn "ashr<mode>3<mask_name>"
10902 [(set (match_operand:VI248_AVX512BW_AVX512VL 0 "register_operand" "=v,v")
10903 (ashiftrt:VI248_AVX512BW_AVX512VL
10904 (match_operand:VI248_AVX512BW_AVX512VL 1 "nonimmediate_operand" "v,vm")
10905 (match_operand:DI 2 "nonmemory_operand" "v,N")))]
10907 "vpsra<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10908 [(set_attr "type" "sseishft")
10909 (set (attr "length_immediate")
10910 (if_then_else (match_operand 2 "const_int_operand")
10912 (const_string "0")))
10913 (set_attr "mode" "<sseinsnmode>")])
10915 (define_insn "<mask_codefor><shift_insn><mode>3<mask_name>"
10916 [(set (match_operand:VI248_AVX512BW_2 0 "register_operand" "=v,v")
10917 (any_lshift:VI248_AVX512BW_2
10918 (match_operand:VI248_AVX512BW_2 1 "nonimmediate_operand" "v,vm")
10919 (match_operand:DI 2 "nonmemory_operand" "v,N")))]
10921 "vp<vshift><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10922 [(set_attr "type" "sseishft")
10923 (set (attr "length_immediate")
10924 (if_then_else (match_operand 2 "const_int_operand")
10926 (const_string "0")))
10927 (set_attr "mode" "<sseinsnmode>")])
10929 (define_insn "<shift_insn><mode>3"
10930 [(set (match_operand:VI248_AVX2 0 "register_operand" "=x,x")
10931 (any_lshift:VI248_AVX2
10932 (match_operand:VI248_AVX2 1 "register_operand" "0,x")
10933 (match_operand:DI 2 "nonmemory_operand" "xN,xN")))]
10936 p<vshift><ssemodesuffix>\t{%2, %0|%0, %2}
10937 vp<vshift><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
10938 [(set_attr "isa" "noavx,avx")
10939 (set_attr "type" "sseishft")
10940 (set (attr "length_immediate")
10941 (if_then_else (match_operand 2 "const_int_operand")
10943 (const_string "0")))
10944 (set_attr "prefix_data16" "1,*")
10945 (set_attr "prefix" "orig,vex")
10946 (set_attr "mode" "<sseinsnmode>")])
10948 (define_insn "<shift_insn><mode>3<mask_name>"
10949 [(set (match_operand:VI248_AVX512BW 0 "register_operand" "=v,v")
10950 (any_lshift:VI248_AVX512BW
10951 (match_operand:VI248_AVX512BW 1 "nonimmediate_operand" "v,m")
10952 (match_operand:DI 2 "nonmemory_operand" "vN,N")))]
10954 "vp<vshift><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10955 [(set_attr "type" "sseishft")
10956 (set (attr "length_immediate")
10957 (if_then_else (match_operand 2 "const_int_operand")
10959 (const_string "0")))
10960 (set_attr "mode" "<sseinsnmode>")])
10963 (define_expand "vec_shr_<mode>"
10964 [(set (match_dup 3)
10966 (match_operand:VI_128 1 "register_operand")
10967 (match_operand:SI 2 "const_0_to_255_mul_8_operand")))
10968 (set (match_operand:VI_128 0 "register_operand") (match_dup 4))]
10971 operands[1] = gen_lowpart (V1TImode, operands[1]);
10972 operands[3] = gen_reg_rtx (V1TImode);
10973 operands[4] = gen_lowpart (<MODE>mode, operands[3]);
10976 (define_insn "avx512bw_<shift_insn><mode>3"
10977 [(set (match_operand:VIMAX_AVX512VL 0 "register_operand" "=v")
10978 (any_lshift:VIMAX_AVX512VL
10979 (match_operand:VIMAX_AVX512VL 1 "nonimmediate_operand" "vm")
10980 (match_operand:SI 2 "const_0_to_255_mul_8_operand" "n")))]
10983 operands[2] = GEN_INT (INTVAL (operands[2]) / 8);
10984 return "vp<vshift>dq\t{%2, %1, %0|%0, %1, %2}";
10986 [(set_attr "type" "sseishft")
10987 (set_attr "length_immediate" "1")
10988 (set_attr "prefix" "maybe_evex")
10989 (set_attr "mode" "<sseinsnmode>")])
10991 (define_insn "<sse2_avx2>_<shift_insn><mode>3"
10992 [(set (match_operand:VIMAX_AVX2 0 "register_operand" "=x,v")
10993 (any_lshift:VIMAX_AVX2
10994 (match_operand:VIMAX_AVX2 1 "register_operand" "0,v")
10995 (match_operand:SI 2 "const_0_to_255_mul_8_operand" "n,n")))]
10998 operands[2] = GEN_INT (INTVAL (operands[2]) / 8);
11000 switch (which_alternative)
11003 return "p<vshift>dq\t{%2, %0|%0, %2}";
11005 return "vp<vshift>dq\t{%2, %1, %0|%0, %1, %2}";
11007 gcc_unreachable ();
11010 [(set_attr "isa" "noavx,avx")
11011 (set_attr "type" "sseishft")
11012 (set_attr "length_immediate" "1")
11013 (set_attr "atom_unit" "sishuf")
11014 (set_attr "prefix_data16" "1,*")
11015 (set_attr "prefix" "orig,vex")
11016 (set_attr "mode" "<sseinsnmode>")])
11018 (define_insn "<avx512>_<rotate>v<mode><mask_name>"
11019 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
11020 (any_rotate:VI48_AVX512VL
11021 (match_operand:VI48_AVX512VL 1 "register_operand" "v")
11022 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")))]
11024 "vp<rotate>v<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11025 [(set_attr "prefix" "evex")
11026 (set_attr "mode" "<sseinsnmode>")])
11028 (define_insn "<avx512>_<rotate><mode><mask_name>"
11029 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
11030 (any_rotate:VI48_AVX512VL
11031 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm")
11032 (match_operand:SI 2 "const_0_to_255_operand")))]
11034 "vp<rotate><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11035 [(set_attr "prefix" "evex")
11036 (set_attr "mode" "<sseinsnmode>")])
11038 (define_expand "<code><mode>3"
11039 [(set (match_operand:VI124_256_AVX512F_AVX512BW 0 "register_operand")
11040 (maxmin:VI124_256_AVX512F_AVX512BW
11041 (match_operand:VI124_256_AVX512F_AVX512BW 1 "nonimmediate_operand")
11042 (match_operand:VI124_256_AVX512F_AVX512BW 2 "nonimmediate_operand")))]
11044 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
11046 (define_insn "*avx2_<code><mode>3"
11047 [(set (match_operand:VI124_256 0 "register_operand" "=v")
11049 (match_operand:VI124_256 1 "nonimmediate_operand" "%v")
11050 (match_operand:VI124_256 2 "nonimmediate_operand" "vm")))]
11051 "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11052 "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11053 [(set_attr "type" "sseiadd")
11054 (set_attr "prefix_extra" "1")
11055 (set_attr "prefix" "vex")
11056 (set_attr "mode" "OI")])
11058 (define_expand "<code><mode>3_mask"
11059 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
11060 (vec_merge:VI48_AVX512VL
11061 (maxmin:VI48_AVX512VL
11062 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand")
11063 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand"))
11064 (match_operand:VI48_AVX512VL 3 "vector_move_operand")
11065 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
11067 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
11069 (define_insn "*avx512f_<code><mode>3<mask_name>"
11070 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
11071 (maxmin:VI48_AVX512VL
11072 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "%v")
11073 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")))]
11074 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11075 "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11076 [(set_attr "type" "sseiadd")
11077 (set_attr "prefix_extra" "1")
11078 (set_attr "prefix" "maybe_evex")
11079 (set_attr "mode" "<sseinsnmode>")])
11081 (define_insn "<mask_codefor><code><mode>3<mask_name>"
11082 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
11083 (maxmin:VI12_AVX512VL
11084 (match_operand:VI12_AVX512VL 1 "register_operand" "v")
11085 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")))]
11087 "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11088 [(set_attr "type" "sseiadd")
11089 (set_attr "prefix" "evex")
11090 (set_attr "mode" "<sseinsnmode>")])
11092 (define_expand "<code><mode>3"
11093 [(set (match_operand:VI8_AVX2_AVX512F 0 "register_operand")
11094 (maxmin:VI8_AVX2_AVX512F
11095 (match_operand:VI8_AVX2_AVX512F 1 "register_operand")
11096 (match_operand:VI8_AVX2_AVX512F 2 "register_operand")))]
11100 && (<MODE>mode == V8DImode || TARGET_AVX512VL))
11101 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
11104 enum rtx_code code;
11109 xops[0] = operands[0];
11111 if (<CODE> == SMAX || <CODE> == UMAX)
11113 xops[1] = operands[1];
11114 xops[2] = operands[2];
11118 xops[1] = operands[2];
11119 xops[2] = operands[1];
11122 code = (<CODE> == UMAX || <CODE> == UMIN) ? GTU : GT;
11124 xops[3] = gen_rtx_fmt_ee (code, VOIDmode, operands[1], operands[2]);
11125 xops[4] = operands[1];
11126 xops[5] = operands[2];
11128 ok = ix86_expand_int_vcond (xops);
11134 (define_expand "<code><mode>3"
11135 [(set (match_operand:VI124_128 0 "register_operand")
11137 (match_operand:VI124_128 1 "vector_operand")
11138 (match_operand:VI124_128 2 "vector_operand")))]
11141 if (TARGET_SSE4_1 || <MODE>mode == V8HImode)
11142 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
11148 xops[0] = operands[0];
11149 operands[1] = force_reg (<MODE>mode, operands[1]);
11150 operands[2] = force_reg (<MODE>mode, operands[2]);
11152 if (<CODE> == SMAX)
11154 xops[1] = operands[1];
11155 xops[2] = operands[2];
11159 xops[1] = operands[2];
11160 xops[2] = operands[1];
11163 xops[3] = gen_rtx_GT (VOIDmode, operands[1], operands[2]);
11164 xops[4] = operands[1];
11165 xops[5] = operands[2];
11167 ok = ix86_expand_int_vcond (xops);
11173 (define_insn "*sse4_1_<code><mode>3<mask_name>"
11174 [(set (match_operand:VI14_128 0 "register_operand" "=Yr,*x,v")
11176 (match_operand:VI14_128 1 "vector_operand" "%0,0,v")
11177 (match_operand:VI14_128 2 "vector_operand" "YrBm,*xBm,vm")))]
11179 && <mask_mode512bit_condition>
11180 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11182 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
11183 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
11184 vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11185 [(set_attr "isa" "noavx,noavx,avx")
11186 (set_attr "type" "sseiadd")
11187 (set_attr "prefix_extra" "1,1,*")
11188 (set_attr "prefix" "orig,orig,vex")
11189 (set_attr "mode" "TI")])
11191 (define_insn "*<code>v8hi3"
11192 [(set (match_operand:V8HI 0 "register_operand" "=x,x,v")
11194 (match_operand:V8HI 1 "vector_operand" "%0,x,v")
11195 (match_operand:V8HI 2 "vector_operand" "xBm,xm,vm")))]
11196 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11198 p<maxmin_int>w\t{%2, %0|%0, %2}
11199 vp<maxmin_int>w\t{%2, %1, %0|%0, %1, %2}
11200 vp<maxmin_int>w\t{%2, %1, %0|%0, %1, %2}"
11201 [(set_attr "isa" "noavx,avx,avx512bw")
11202 (set_attr "type" "sseiadd")
11203 (set_attr "prefix_data16" "1,*,*")
11204 (set_attr "prefix_extra" "*,1,1")
11205 (set_attr "prefix" "orig,vex,evex")
11206 (set_attr "mode" "TI")])
11208 (define_expand "<code><mode>3"
11209 [(set (match_operand:VI124_128 0 "register_operand")
11211 (match_operand:VI124_128 1 "vector_operand")
11212 (match_operand:VI124_128 2 "vector_operand")))]
11215 if (TARGET_SSE4_1 || <MODE>mode == V16QImode)
11216 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
11217 else if (<CODE> == UMAX && <MODE>mode == V8HImode)
11219 rtx op0 = operands[0], op2 = operands[2], op3 = op0;
11220 operands[1] = force_reg (<MODE>mode, operands[1]);
11221 if (rtx_equal_p (op3, op2))
11222 op3 = gen_reg_rtx (V8HImode);
11223 emit_insn (gen_sse2_ussubv8hi3 (op3, operands[1], op2));
11224 emit_insn (gen_addv8hi3 (op0, op3, op2));
11232 operands[1] = force_reg (<MODE>mode, operands[1]);
11233 operands[2] = force_reg (<MODE>mode, operands[2]);
11235 xops[0] = operands[0];
11237 if (<CODE> == UMAX)
11239 xops[1] = operands[1];
11240 xops[2] = operands[2];
11244 xops[1] = operands[2];
11245 xops[2] = operands[1];
11248 xops[3] = gen_rtx_GTU (VOIDmode, operands[1], operands[2]);
11249 xops[4] = operands[1];
11250 xops[5] = operands[2];
11252 ok = ix86_expand_int_vcond (xops);
11258 (define_insn "*sse4_1_<code><mode>3<mask_name>"
11259 [(set (match_operand:VI24_128 0 "register_operand" "=Yr,*x,v")
11261 (match_operand:VI24_128 1 "vector_operand" "%0,0,v")
11262 (match_operand:VI24_128 2 "vector_operand" "YrBm,*xBm,vm")))]
11264 && <mask_mode512bit_condition>
11265 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11267 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
11268 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
11269 vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11270 [(set_attr "isa" "noavx,noavx,avx")
11271 (set_attr "type" "sseiadd")
11272 (set_attr "prefix_extra" "1,1,*")
11273 (set_attr "prefix" "orig,orig,vex")
11274 (set_attr "mode" "TI")])
11276 (define_insn "*<code>v16qi3"
11277 [(set (match_operand:V16QI 0 "register_operand" "=x,x,v")
11279 (match_operand:V16QI 1 "vector_operand" "%0,x,v")
11280 (match_operand:V16QI 2 "vector_operand" "xBm,xm,vm")))]
11281 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11283 p<maxmin_int>b\t{%2, %0|%0, %2}
11284 vp<maxmin_int>b\t{%2, %1, %0|%0, %1, %2}
11285 vp<maxmin_int>b\t{%2, %1, %0|%0, %1, %2}"
11286 [(set_attr "isa" "noavx,avx,avx512bw")
11287 (set_attr "type" "sseiadd")
11288 (set_attr "prefix_data16" "1,*,*")
11289 (set_attr "prefix_extra" "*,1,1")
11290 (set_attr "prefix" "orig,vex,evex")
11291 (set_attr "mode" "TI")])
11293 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11295 ;; Parallel integral comparisons
11297 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11299 (define_expand "avx2_eq<mode>3"
11300 [(set (match_operand:VI_256 0 "register_operand")
11302 (match_operand:VI_256 1 "nonimmediate_operand")
11303 (match_operand:VI_256 2 "nonimmediate_operand")))]
11305 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
11307 (define_insn "*avx2_eq<mode>3"
11308 [(set (match_operand:VI_256 0 "register_operand" "=x")
11310 (match_operand:VI_256 1 "nonimmediate_operand" "%x")
11311 (match_operand:VI_256 2 "nonimmediate_operand" "xm")))]
11312 "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11313 "vpcmpeq<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11314 [(set_attr "type" "ssecmp")
11315 (set_attr "prefix_extra" "1")
11316 (set_attr "prefix" "vex")
11317 (set_attr "mode" "OI")])
11319 (define_expand "<avx512>_eq<mode>3<mask_scalar_merge_name>"
11320 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
11321 (unspec:<avx512fmaskmode>
11322 [(match_operand:VI12_AVX512VL 1 "nonimmediate_operand")
11323 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand")]
11324 UNSPEC_MASKED_EQ))]
11326 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
11328 (define_expand "<avx512>_eq<mode>3<mask_scalar_merge_name>"
11329 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
11330 (unspec:<avx512fmaskmode>
11331 [(match_operand:VI48_AVX512VL 1 "nonimmediate_operand")
11332 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand")]
11333 UNSPEC_MASKED_EQ))]
11335 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
11337 (define_insn "<avx512>_eq<mode>3<mask_scalar_merge_name>_1"
11338 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11339 (unspec:<avx512fmaskmode>
11340 [(match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "%v")
11341 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")]
11342 UNSPEC_MASKED_EQ))]
11343 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11344 "vpcmpeq<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11345 [(set_attr "type" "ssecmp")
11346 (set_attr "prefix_extra" "1")
11347 (set_attr "prefix" "evex")
11348 (set_attr "mode" "<sseinsnmode>")])
11350 (define_insn "<avx512>_eq<mode>3<mask_scalar_merge_name>_1"
11351 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11352 (unspec:<avx512fmaskmode>
11353 [(match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "%v")
11354 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")]
11355 UNSPEC_MASKED_EQ))]
11356 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11357 "vpcmpeq<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11358 [(set_attr "type" "ssecmp")
11359 (set_attr "prefix_extra" "1")
11360 (set_attr "prefix" "evex")
11361 (set_attr "mode" "<sseinsnmode>")])
11363 (define_insn "*sse4_1_eqv2di3"
11364 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,x")
11366 (match_operand:V2DI 1 "vector_operand" "%0,0,x")
11367 (match_operand:V2DI 2 "vector_operand" "YrBm,*xBm,xm")))]
11368 "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11370 pcmpeqq\t{%2, %0|%0, %2}
11371 pcmpeqq\t{%2, %0|%0, %2}
11372 vpcmpeqq\t{%2, %1, %0|%0, %1, %2}"
11373 [(set_attr "isa" "noavx,noavx,avx")
11374 (set_attr "type" "ssecmp")
11375 (set_attr "prefix_extra" "1")
11376 (set_attr "prefix" "orig,orig,vex")
11377 (set_attr "mode" "TI")])
11379 (define_insn "*sse2_eq<mode>3"
11380 [(set (match_operand:VI124_128 0 "register_operand" "=x,x")
11382 (match_operand:VI124_128 1 "vector_operand" "%0,x")
11383 (match_operand:VI124_128 2 "vector_operand" "xBm,xm")))]
11384 "TARGET_SSE2 && !TARGET_XOP
11385 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11387 pcmpeq<ssemodesuffix>\t{%2, %0|%0, %2}
11388 vpcmpeq<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11389 [(set_attr "isa" "noavx,avx")
11390 (set_attr "type" "ssecmp")
11391 (set_attr "prefix_data16" "1,*")
11392 (set_attr "prefix" "orig,vex")
11393 (set_attr "mode" "TI")])
11395 (define_expand "sse2_eq<mode>3"
11396 [(set (match_operand:VI124_128 0 "register_operand")
11398 (match_operand:VI124_128 1 "vector_operand")
11399 (match_operand:VI124_128 2 "vector_operand")))]
11400 "TARGET_SSE2 && !TARGET_XOP "
11401 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
11403 (define_expand "sse4_1_eqv2di3"
11404 [(set (match_operand:V2DI 0 "register_operand")
11406 (match_operand:V2DI 1 "vector_operand")
11407 (match_operand:V2DI 2 "vector_operand")))]
11409 "ix86_fixup_binary_operands_no_copy (EQ, V2DImode, operands);")
11411 (define_insn "sse4_2_gtv2di3"
11412 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,x")
11414 (match_operand:V2DI 1 "register_operand" "0,0,x")
11415 (match_operand:V2DI 2 "vector_operand" "YrBm,*xBm,xm")))]
11418 pcmpgtq\t{%2, %0|%0, %2}
11419 pcmpgtq\t{%2, %0|%0, %2}
11420 vpcmpgtq\t{%2, %1, %0|%0, %1, %2}"
11421 [(set_attr "isa" "noavx,noavx,avx")
11422 (set_attr "type" "ssecmp")
11423 (set_attr "prefix_extra" "1")
11424 (set_attr "prefix" "orig,orig,vex")
11425 (set_attr "mode" "TI")])
11427 (define_insn "avx2_gt<mode>3"
11428 [(set (match_operand:VI_256 0 "register_operand" "=x")
11430 (match_operand:VI_256 1 "register_operand" "x")
11431 (match_operand:VI_256 2 "nonimmediate_operand" "xm")))]
11433 "vpcmpgt<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11434 [(set_attr "type" "ssecmp")
11435 (set_attr "prefix_extra" "1")
11436 (set_attr "prefix" "vex")
11437 (set_attr "mode" "OI")])
11439 (define_insn "<avx512>_gt<mode>3<mask_scalar_merge_name>"
11440 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11441 (unspec:<avx512fmaskmode>
11442 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
11443 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")] UNSPEC_MASKED_GT))]
11445 "vpcmpgt<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11446 [(set_attr "type" "ssecmp")
11447 (set_attr "prefix_extra" "1")
11448 (set_attr "prefix" "evex")
11449 (set_attr "mode" "<sseinsnmode>")])
11451 (define_insn "<avx512>_gt<mode>3<mask_scalar_merge_name>"
11452 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11453 (unspec:<avx512fmaskmode>
11454 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
11455 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")] UNSPEC_MASKED_GT))]
11457 "vpcmpgt<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11458 [(set_attr "type" "ssecmp")
11459 (set_attr "prefix_extra" "1")
11460 (set_attr "prefix" "evex")
11461 (set_attr "mode" "<sseinsnmode>")])
11463 (define_insn "sse2_gt<mode>3"
11464 [(set (match_operand:VI124_128 0 "register_operand" "=x,x")
11466 (match_operand:VI124_128 1 "register_operand" "0,x")
11467 (match_operand:VI124_128 2 "vector_operand" "xBm,xm")))]
11468 "TARGET_SSE2 && !TARGET_XOP"
11470 pcmpgt<ssemodesuffix>\t{%2, %0|%0, %2}
11471 vpcmpgt<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11472 [(set_attr "isa" "noavx,avx")
11473 (set_attr "type" "ssecmp")
11474 (set_attr "prefix_data16" "1,*")
11475 (set_attr "prefix" "orig,vex")
11476 (set_attr "mode" "TI")])
11478 (define_expand "vcond<V_512:mode><VI_AVX512BW:mode>"
11479 [(set (match_operand:V_512 0 "register_operand")
11480 (if_then_else:V_512
11481 (match_operator 3 ""
11482 [(match_operand:VI_AVX512BW 4 "nonimmediate_operand")
11483 (match_operand:VI_AVX512BW 5 "general_operand")])
11484 (match_operand:V_512 1)
11485 (match_operand:V_512 2)))]
11487 && (GET_MODE_NUNITS (<V_512:MODE>mode)
11488 == GET_MODE_NUNITS (<VI_AVX512BW:MODE>mode))"
11490 bool ok = ix86_expand_int_vcond (operands);
11495 (define_expand "vcond<V_256:mode><VI_256:mode>"
11496 [(set (match_operand:V_256 0 "register_operand")
11497 (if_then_else:V_256
11498 (match_operator 3 ""
11499 [(match_operand:VI_256 4 "nonimmediate_operand")
11500 (match_operand:VI_256 5 "general_operand")])
11501 (match_operand:V_256 1)
11502 (match_operand:V_256 2)))]
11504 && (GET_MODE_NUNITS (<V_256:MODE>mode)
11505 == GET_MODE_NUNITS (<VI_256:MODE>mode))"
11507 bool ok = ix86_expand_int_vcond (operands);
11512 (define_expand "vcond<V_128:mode><VI124_128:mode>"
11513 [(set (match_operand:V_128 0 "register_operand")
11514 (if_then_else:V_128
11515 (match_operator 3 ""
11516 [(match_operand:VI124_128 4 "vector_operand")
11517 (match_operand:VI124_128 5 "general_operand")])
11518 (match_operand:V_128 1)
11519 (match_operand:V_128 2)))]
11521 && (GET_MODE_NUNITS (<V_128:MODE>mode)
11522 == GET_MODE_NUNITS (<VI124_128:MODE>mode))"
11524 bool ok = ix86_expand_int_vcond (operands);
11529 (define_expand "vcond<VI8F_128:mode>v2di"
11530 [(set (match_operand:VI8F_128 0 "register_operand")
11531 (if_then_else:VI8F_128
11532 (match_operator 3 ""
11533 [(match_operand:V2DI 4 "vector_operand")
11534 (match_operand:V2DI 5 "general_operand")])
11535 (match_operand:VI8F_128 1)
11536 (match_operand:VI8F_128 2)))]
11539 bool ok = ix86_expand_int_vcond (operands);
11544 (define_expand "vcondu<V_512:mode><VI_AVX512BW:mode>"
11545 [(set (match_operand:V_512 0 "register_operand")
11546 (if_then_else:V_512
11547 (match_operator 3 ""
11548 [(match_operand:VI_AVX512BW 4 "nonimmediate_operand")
11549 (match_operand:VI_AVX512BW 5 "nonimmediate_operand")])
11550 (match_operand:V_512 1 "general_operand")
11551 (match_operand:V_512 2 "general_operand")))]
11553 && (GET_MODE_NUNITS (<V_512:MODE>mode)
11554 == GET_MODE_NUNITS (<VI_AVX512BW:MODE>mode))"
11556 bool ok = ix86_expand_int_vcond (operands);
11561 (define_expand "vcondu<V_256:mode><VI_256:mode>"
11562 [(set (match_operand:V_256 0 "register_operand")
11563 (if_then_else:V_256
11564 (match_operator 3 ""
11565 [(match_operand:VI_256 4 "nonimmediate_operand")
11566 (match_operand:VI_256 5 "nonimmediate_operand")])
11567 (match_operand:V_256 1 "general_operand")
11568 (match_operand:V_256 2 "general_operand")))]
11570 && (GET_MODE_NUNITS (<V_256:MODE>mode)
11571 == GET_MODE_NUNITS (<VI_256:MODE>mode))"
11573 bool ok = ix86_expand_int_vcond (operands);
11578 (define_expand "vcondu<V_128:mode><VI124_128:mode>"
11579 [(set (match_operand:V_128 0 "register_operand")
11580 (if_then_else:V_128
11581 (match_operator 3 ""
11582 [(match_operand:VI124_128 4 "vector_operand")
11583 (match_operand:VI124_128 5 "vector_operand")])
11584 (match_operand:V_128 1 "general_operand")
11585 (match_operand:V_128 2 "general_operand")))]
11587 && (GET_MODE_NUNITS (<V_128:MODE>mode)
11588 == GET_MODE_NUNITS (<VI124_128:MODE>mode))"
11590 bool ok = ix86_expand_int_vcond (operands);
11595 (define_expand "vcondu<VI8F_128:mode>v2di"
11596 [(set (match_operand:VI8F_128 0 "register_operand")
11597 (if_then_else:VI8F_128
11598 (match_operator 3 ""
11599 [(match_operand:V2DI 4 "vector_operand")
11600 (match_operand:V2DI 5 "vector_operand")])
11601 (match_operand:VI8F_128 1 "general_operand")
11602 (match_operand:VI8F_128 2 "general_operand")))]
11605 bool ok = ix86_expand_int_vcond (operands);
11610 (define_expand "vcondeq<VI8F_128:mode>v2di"
11611 [(set (match_operand:VI8F_128 0 "register_operand")
11612 (if_then_else:VI8F_128
11613 (match_operator 3 ""
11614 [(match_operand:V2DI 4 "vector_operand")
11615 (match_operand:V2DI 5 "general_operand")])
11616 (match_operand:VI8F_128 1)
11617 (match_operand:VI8F_128 2)))]
11620 bool ok = ix86_expand_int_vcond (operands);
11625 (define_mode_iterator VEC_PERM_AVX2
11626 [V16QI V8HI V4SI V2DI V4SF V2DF
11627 (V32QI "TARGET_AVX2") (V16HI "TARGET_AVX2")
11628 (V8SI "TARGET_AVX2") (V4DI "TARGET_AVX2")
11629 (V8SF "TARGET_AVX2") (V4DF "TARGET_AVX2")
11630 (V16SF "TARGET_AVX512F") (V8DF "TARGET_AVX512F")
11631 (V16SI "TARGET_AVX512F") (V8DI "TARGET_AVX512F")
11632 (V32HI "TARGET_AVX512BW") (V64QI "TARGET_AVX512VBMI")])
11634 (define_expand "vec_perm<mode>"
11635 [(match_operand:VEC_PERM_AVX2 0 "register_operand")
11636 (match_operand:VEC_PERM_AVX2 1 "register_operand")
11637 (match_operand:VEC_PERM_AVX2 2 "register_operand")
11638 (match_operand:<sseintvecmode> 3 "register_operand")]
11639 "TARGET_SSSE3 || TARGET_AVX || TARGET_XOP"
11641 ix86_expand_vec_perm (operands);
11645 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11647 ;; Parallel bitwise logical operations
11649 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11651 (define_expand "one_cmpl<mode>2"
11652 [(set (match_operand:VI 0 "register_operand")
11653 (xor:VI (match_operand:VI 1 "vector_operand")
11657 operands[2] = force_reg (<MODE>mode, CONSTM1_RTX (<MODE>mode));
11660 (define_expand "<sse2_avx2>_andnot<mode>3"
11661 [(set (match_operand:VI_AVX2 0 "register_operand")
11663 (not:VI_AVX2 (match_operand:VI_AVX2 1 "register_operand"))
11664 (match_operand:VI_AVX2 2 "vector_operand")))]
11667 (define_expand "<sse2_avx2>_andnot<mode>3_mask"
11668 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
11669 (vec_merge:VI48_AVX512VL
11672 (match_operand:VI48_AVX512VL 1 "register_operand"))
11673 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand"))
11674 (match_operand:VI48_AVX512VL 3 "vector_move_operand")
11675 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
11678 (define_expand "<sse2_avx2>_andnot<mode>3_mask"
11679 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
11680 (vec_merge:VI12_AVX512VL
11683 (match_operand:VI12_AVX512VL 1 "register_operand"))
11684 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand"))
11685 (match_operand:VI12_AVX512VL 3 "vector_move_operand")
11686 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
11689 (define_insn "*andnot<mode>3"
11690 [(set (match_operand:VI 0 "register_operand" "=x,x,v")
11692 (not:VI (match_operand:VI 1 "register_operand" "0,x,v"))
11693 (match_operand:VI 2 "vector_operand" "xBm,xm,vm")))]
11696 static char buf[64];
11699 const char *ssesuffix;
11701 switch (get_attr_mode (insn))
11704 gcc_assert (TARGET_AVX512F);
11707 gcc_assert (TARGET_AVX2);
11710 gcc_assert (TARGET_SSE2);
11712 switch (<MODE>mode)
11716 /* There is no vpandnb or vpandnw instruction, nor vpandn for
11717 512-bit vectors. Use vpandnq instead. */
11722 ssesuffix = "<ssemodesuffix>";
11728 ssesuffix = (TARGET_AVX512VL && which_alternative == 2
11729 ? "<ssemodesuffix>" : "");
11732 ssesuffix = TARGET_AVX512VL && which_alternative == 2 ? "q" : "";
11737 gcc_assert (TARGET_AVX512F);
11740 gcc_assert (TARGET_AVX);
11743 gcc_assert (TARGET_SSE);
11749 gcc_unreachable ();
11752 switch (which_alternative)
11755 ops = "%s%s\t{%%2, %%0|%%0, %%2}";
11759 ops = "v%s%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
11762 gcc_unreachable ();
11765 snprintf (buf, sizeof (buf), ops, tmp, ssesuffix);
11768 [(set_attr "isa" "noavx,avx,avx")
11769 (set_attr "type" "sselog")
11770 (set (attr "prefix_data16")
11772 (and (eq_attr "alternative" "0")
11773 (eq_attr "mode" "TI"))
11775 (const_string "*")))
11776 (set_attr "prefix" "orig,vex,evex")
11778 (cond [(and (match_test "<MODE_SIZE> == 16")
11779 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
11780 (const_string "<ssePSmode>")
11781 (match_test "TARGET_AVX2")
11782 (const_string "<sseinsnmode>")
11783 (match_test "TARGET_AVX")
11785 (match_test "<MODE_SIZE> > 16")
11786 (const_string "V8SF")
11787 (const_string "<sseinsnmode>"))
11788 (ior (not (match_test "TARGET_SSE2"))
11789 (match_test "optimize_function_for_size_p (cfun)"))
11790 (const_string "V4SF")
11792 (const_string "<sseinsnmode>")))])
11794 (define_insn "*andnot<mode>3_mask"
11795 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
11796 (vec_merge:VI48_AVX512VL
11799 (match_operand:VI48_AVX512VL 1 "register_operand" "v"))
11800 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm"))
11801 (match_operand:VI48_AVX512VL 3 "vector_move_operand" "0C")
11802 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
11804 "vpandn<ssemodesuffix>\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}";
11805 [(set_attr "type" "sselog")
11806 (set_attr "prefix" "evex")
11807 (set_attr "mode" "<sseinsnmode>")])
11809 (define_expand "<code><mode>3"
11810 [(set (match_operand:VI 0 "register_operand")
11812 (match_operand:VI 1 "nonimmediate_or_const_vector_operand")
11813 (match_operand:VI 2 "nonimmediate_or_const_vector_operand")))]
11816 ix86_expand_vector_logical_operator (<CODE>, <MODE>mode, operands);
11820 (define_insn "<mask_codefor><code><mode>3<mask_name>"
11821 [(set (match_operand:VI48_AVX_AVX512F 0 "register_operand" "=x,x,v")
11822 (any_logic:VI48_AVX_AVX512F
11823 (match_operand:VI48_AVX_AVX512F 1 "vector_operand" "%0,x,v")
11824 (match_operand:VI48_AVX_AVX512F 2 "vector_operand" "xBm,xm,vm")))]
11825 "TARGET_SSE && <mask_mode512bit_condition>
11826 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11828 static char buf[64];
11831 const char *ssesuffix;
11833 switch (get_attr_mode (insn))
11836 gcc_assert (TARGET_AVX512F);
11839 gcc_assert (TARGET_AVX2);
11842 gcc_assert (TARGET_SSE2);
11844 switch (<MODE>mode)
11848 ssesuffix = "<ssemodesuffix>";
11854 ssesuffix = (TARGET_AVX512VL
11855 && (<mask_applied> || which_alternative == 2)
11856 ? "<ssemodesuffix>" : "");
11859 gcc_unreachable ();
11864 gcc_assert (TARGET_AVX);
11867 gcc_assert (TARGET_SSE);
11873 gcc_unreachable ();
11876 switch (which_alternative)
11879 if (<mask_applied>)
11880 ops = "v%s%s\t{%%2, %%0, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%0, %%2}";
11882 ops = "%s%s\t{%%2, %%0|%%0, %%2}";
11886 ops = "v%s%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
11889 gcc_unreachable ();
11892 snprintf (buf, sizeof (buf), ops, tmp, ssesuffix);
11895 [(set_attr "isa" "noavx,avx,avx")
11896 (set_attr "type" "sselog")
11897 (set (attr "prefix_data16")
11899 (and (eq_attr "alternative" "0")
11900 (eq_attr "mode" "TI"))
11902 (const_string "*")))
11903 (set_attr "prefix" "<mask_prefix3>,evex")
11905 (cond [(and (match_test "<MODE_SIZE> == 16")
11906 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
11907 (const_string "<ssePSmode>")
11908 (match_test "TARGET_AVX2")
11909 (const_string "<sseinsnmode>")
11910 (match_test "TARGET_AVX")
11912 (match_test "<MODE_SIZE> > 16")
11913 (const_string "V8SF")
11914 (const_string "<sseinsnmode>"))
11915 (ior (not (match_test "TARGET_SSE2"))
11916 (match_test "optimize_function_for_size_p (cfun)"))
11917 (const_string "V4SF")
11919 (const_string "<sseinsnmode>")))])
11921 (define_insn "*<code><mode>3"
11922 [(set (match_operand:VI12_AVX_AVX512F 0 "register_operand" "=x,x,v")
11923 (any_logic:VI12_AVX_AVX512F
11924 (match_operand:VI12_AVX_AVX512F 1 "vector_operand" "%0,x,v")
11925 (match_operand:VI12_AVX_AVX512F 2 "vector_operand" "xBm,xm,vm")))]
11926 "TARGET_SSE && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11928 static char buf[64];
11931 const char *ssesuffix;
11933 switch (get_attr_mode (insn))
11936 gcc_assert (TARGET_AVX512F);
11939 gcc_assert (TARGET_AVX2);
11942 gcc_assert (TARGET_SSE2);
11944 switch (<MODE>mode)
11954 ssesuffix = TARGET_AVX512VL && which_alternative == 2 ? "q" : "";
11957 gcc_unreachable ();
11962 gcc_assert (TARGET_AVX);
11965 gcc_assert (TARGET_SSE);
11971 gcc_unreachable ();
11974 switch (which_alternative)
11977 ops = "%s%s\t{%%2, %%0|%%0, %%2}";
11981 ops = "v%s%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
11984 gcc_unreachable ();
11987 snprintf (buf, sizeof (buf), ops, tmp, ssesuffix);
11990 [(set_attr "isa" "noavx,avx,avx")
11991 (set_attr "type" "sselog")
11992 (set (attr "prefix_data16")
11994 (and (eq_attr "alternative" "0")
11995 (eq_attr "mode" "TI"))
11997 (const_string "*")))
11998 (set_attr "prefix" "orig,vex,evex")
12000 (cond [(and (match_test "<MODE_SIZE> == 16")
12001 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
12002 (const_string "<ssePSmode>")
12003 (match_test "TARGET_AVX2")
12004 (const_string "<sseinsnmode>")
12005 (match_test "TARGET_AVX")
12007 (match_test "<MODE_SIZE> > 16")
12008 (const_string "V8SF")
12009 (const_string "<sseinsnmode>"))
12010 (ior (not (match_test "TARGET_SSE2"))
12011 (match_test "optimize_function_for_size_p (cfun)"))
12012 (const_string "V4SF")
12014 (const_string "<sseinsnmode>")))])
12016 (define_insn "<avx512>_testm<mode>3<mask_scalar_merge_name>"
12017 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
12018 (unspec:<avx512fmaskmode>
12019 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
12020 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")]
12023 "vptestm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
12024 [(set_attr "prefix" "evex")
12025 (set_attr "mode" "<sseinsnmode>")])
12027 (define_insn "<avx512>_testm<mode>3<mask_scalar_merge_name>"
12028 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
12029 (unspec:<avx512fmaskmode>
12030 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
12031 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")]
12034 "vptestm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
12035 [(set_attr "prefix" "evex")
12036 (set_attr "mode" "<sseinsnmode>")])
12038 (define_insn "<avx512>_testnm<mode>3<mask_scalar_merge_name>"
12039 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
12040 (unspec:<avx512fmaskmode>
12041 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
12042 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")]
12045 "vptestnm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
12046 [(set_attr "prefix" "evex")
12047 (set_attr "mode" "<sseinsnmode>")])
12049 (define_insn "<avx512>_testnm<mode>3<mask_scalar_merge_name>"
12050 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
12051 (unspec:<avx512fmaskmode>
12052 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
12053 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")]
12056 "vptestnm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
12057 [(set_attr "prefix" "evex")
12058 (set_attr "mode" "<sseinsnmode>")])
12060 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12062 ;; Parallel integral element swizzling
12064 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12066 (define_expand "vec_pack_trunc_<mode>"
12067 [(match_operand:<ssepackmode> 0 "register_operand")
12068 (match_operand:VI248_AVX2_8_AVX512F_24_AVX512BW 1 "register_operand")
12069 (match_operand:VI248_AVX2_8_AVX512F_24_AVX512BW 2 "register_operand")]
12072 rtx op1 = gen_lowpart (<ssepackmode>mode, operands[1]);
12073 rtx op2 = gen_lowpart (<ssepackmode>mode, operands[2]);
12074 ix86_expand_vec_extract_even_odd (operands[0], op1, op2, 0);
12078 (define_expand "vec_pack_trunc_qi"
12079 [(set (match_operand:HI 0 ("register_operand"))
12080 (ior:HI (ashift:HI (zero_extend:HI (match_operand:QI 2 ("register_operand")))
12082 (zero_extend:HI (match_operand:QI 1 ("register_operand")))))]
12085 (define_expand "vec_pack_trunc_<mode>"
12086 [(set (match_operand:<DOUBLEMASKMODE> 0 ("register_operand"))
12087 (ior:<DOUBLEMASKMODE> (ashift:<DOUBLEMASKMODE> (zero_extend:<DOUBLEMASKMODE> (match_operand:SWI24 2 ("register_operand")))
12089 (zero_extend:<DOUBLEMASKMODE> (match_operand:SWI24 1 ("register_operand")))))]
12092 operands[3] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
12095 (define_insn "<sse2_avx2>_packsswb<mask_name>"
12096 [(set (match_operand:VI1_AVX512 0 "register_operand" "=x,x,v")
12097 (vec_concat:VI1_AVX512
12098 (ss_truncate:<ssehalfvecmode>
12099 (match_operand:<sseunpackmode> 1 "register_operand" "0,x,v"))
12100 (ss_truncate:<ssehalfvecmode>
12101 (match_operand:<sseunpackmode> 2 "vector_operand" "xBm,xm,vm"))))]
12102 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
12104 packsswb\t{%2, %0|%0, %2}
12105 vpacksswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
12106 vpacksswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12107 [(set_attr "isa" "noavx,avx,avx512bw")
12108 (set_attr "type" "sselog")
12109 (set_attr "prefix_data16" "1,*,*")
12110 (set_attr "prefix" "orig,<mask_prefix>,evex")
12111 (set_attr "mode" "<sseinsnmode>")])
12113 (define_insn "<sse2_avx2>_packssdw<mask_name>"
12114 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,x,v")
12115 (vec_concat:VI2_AVX2
12116 (ss_truncate:<ssehalfvecmode>
12117 (match_operand:<sseunpackmode> 1 "register_operand" "0,x,v"))
12118 (ss_truncate:<ssehalfvecmode>
12119 (match_operand:<sseunpackmode> 2 "vector_operand" "xBm,xm,vm"))))]
12120 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
12122 packssdw\t{%2, %0|%0, %2}
12123 vpackssdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
12124 vpackssdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12125 [(set_attr "isa" "noavx,avx,avx512bw")
12126 (set_attr "type" "sselog")
12127 (set_attr "prefix_data16" "1,*,*")
12128 (set_attr "prefix" "orig,<mask_prefix>,evex")
12129 (set_attr "mode" "<sseinsnmode>")])
12131 (define_insn "<sse2_avx2>_packuswb<mask_name>"
12132 [(set (match_operand:VI1_AVX512 0 "register_operand" "=x,x,v")
12133 (vec_concat:VI1_AVX512
12134 (us_truncate:<ssehalfvecmode>
12135 (match_operand:<sseunpackmode> 1 "register_operand" "0,x,v"))
12136 (us_truncate:<ssehalfvecmode>
12137 (match_operand:<sseunpackmode> 2 "vector_operand" "xBm,xm,vm"))))]
12138 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
12140 packuswb\t{%2, %0|%0, %2}
12141 vpackuswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
12142 vpackuswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12143 [(set_attr "isa" "noavx,avx,avx512bw")
12144 (set_attr "type" "sselog")
12145 (set_attr "prefix_data16" "1,*,*")
12146 (set_attr "prefix" "orig,<mask_prefix>,evex")
12147 (set_attr "mode" "<sseinsnmode>")])
12149 (define_insn "avx512bw_interleave_highv64qi<mask_name>"
12150 [(set (match_operand:V64QI 0 "register_operand" "=v")
12153 (match_operand:V64QI 1 "register_operand" "v")
12154 (match_operand:V64QI 2 "nonimmediate_operand" "vm"))
12155 (parallel [(const_int 8) (const_int 72)
12156 (const_int 9) (const_int 73)
12157 (const_int 10) (const_int 74)
12158 (const_int 11) (const_int 75)
12159 (const_int 12) (const_int 76)
12160 (const_int 13) (const_int 77)
12161 (const_int 14) (const_int 78)
12162 (const_int 15) (const_int 79)
12163 (const_int 24) (const_int 88)
12164 (const_int 25) (const_int 89)
12165 (const_int 26) (const_int 90)
12166 (const_int 27) (const_int 91)
12167 (const_int 28) (const_int 92)
12168 (const_int 29) (const_int 93)
12169 (const_int 30) (const_int 94)
12170 (const_int 31) (const_int 95)
12171 (const_int 40) (const_int 104)
12172 (const_int 41) (const_int 105)
12173 (const_int 42) (const_int 106)
12174 (const_int 43) (const_int 107)
12175 (const_int 44) (const_int 108)
12176 (const_int 45) (const_int 109)
12177 (const_int 46) (const_int 110)
12178 (const_int 47) (const_int 111)
12179 (const_int 56) (const_int 120)
12180 (const_int 57) (const_int 121)
12181 (const_int 58) (const_int 122)
12182 (const_int 59) (const_int 123)
12183 (const_int 60) (const_int 124)
12184 (const_int 61) (const_int 125)
12185 (const_int 62) (const_int 126)
12186 (const_int 63) (const_int 127)])))]
12188 "vpunpckhbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12189 [(set_attr "type" "sselog")
12190 (set_attr "prefix" "evex")
12191 (set_attr "mode" "XI")])
12193 (define_insn "avx2_interleave_highv32qi<mask_name>"
12194 [(set (match_operand:V32QI 0 "register_operand" "=v")
12197 (match_operand:V32QI 1 "register_operand" "v")
12198 (match_operand:V32QI 2 "nonimmediate_operand" "vm"))
12199 (parallel [(const_int 8) (const_int 40)
12200 (const_int 9) (const_int 41)
12201 (const_int 10) (const_int 42)
12202 (const_int 11) (const_int 43)
12203 (const_int 12) (const_int 44)
12204 (const_int 13) (const_int 45)
12205 (const_int 14) (const_int 46)
12206 (const_int 15) (const_int 47)
12207 (const_int 24) (const_int 56)
12208 (const_int 25) (const_int 57)
12209 (const_int 26) (const_int 58)
12210 (const_int 27) (const_int 59)
12211 (const_int 28) (const_int 60)
12212 (const_int 29) (const_int 61)
12213 (const_int 30) (const_int 62)
12214 (const_int 31) (const_int 63)])))]
12215 "TARGET_AVX2 && <mask_avx512vl_condition>"
12216 "vpunpckhbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12217 [(set_attr "type" "sselog")
12218 (set_attr "prefix" "<mask_prefix>")
12219 (set_attr "mode" "OI")])
12221 (define_insn "vec_interleave_highv16qi<mask_name>"
12222 [(set (match_operand:V16QI 0 "register_operand" "=x,v")
12225 (match_operand:V16QI 1 "register_operand" "0,v")
12226 (match_operand:V16QI 2 "vector_operand" "xBm,vm"))
12227 (parallel [(const_int 8) (const_int 24)
12228 (const_int 9) (const_int 25)
12229 (const_int 10) (const_int 26)
12230 (const_int 11) (const_int 27)
12231 (const_int 12) (const_int 28)
12232 (const_int 13) (const_int 29)
12233 (const_int 14) (const_int 30)
12234 (const_int 15) (const_int 31)])))]
12235 "TARGET_SSE2 && <mask_avx512vl_condition>"
12237 punpckhbw\t{%2, %0|%0, %2}
12238 vpunpckhbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12239 [(set_attr "isa" "noavx,avx")
12240 (set_attr "type" "sselog")
12241 (set_attr "prefix_data16" "1,*")
12242 (set_attr "prefix" "orig,<mask_prefix>")
12243 (set_attr "mode" "TI")])
12245 (define_insn "avx512bw_interleave_lowv64qi<mask_name>"
12246 [(set (match_operand:V64QI 0 "register_operand" "=v")
12249 (match_operand:V64QI 1 "register_operand" "v")
12250 (match_operand:V64QI 2 "nonimmediate_operand" "vm"))
12251 (parallel [(const_int 0) (const_int 64)
12252 (const_int 1) (const_int 65)
12253 (const_int 2) (const_int 66)
12254 (const_int 3) (const_int 67)
12255 (const_int 4) (const_int 68)
12256 (const_int 5) (const_int 69)
12257 (const_int 6) (const_int 70)
12258 (const_int 7) (const_int 71)
12259 (const_int 16) (const_int 80)
12260 (const_int 17) (const_int 81)
12261 (const_int 18) (const_int 82)
12262 (const_int 19) (const_int 83)
12263 (const_int 20) (const_int 84)
12264 (const_int 21) (const_int 85)
12265 (const_int 22) (const_int 86)
12266 (const_int 23) (const_int 87)
12267 (const_int 32) (const_int 96)
12268 (const_int 33) (const_int 97)
12269 (const_int 34) (const_int 98)
12270 (const_int 35) (const_int 99)
12271 (const_int 36) (const_int 100)
12272 (const_int 37) (const_int 101)
12273 (const_int 38) (const_int 102)
12274 (const_int 39) (const_int 103)
12275 (const_int 48) (const_int 112)
12276 (const_int 49) (const_int 113)
12277 (const_int 50) (const_int 114)
12278 (const_int 51) (const_int 115)
12279 (const_int 52) (const_int 116)
12280 (const_int 53) (const_int 117)
12281 (const_int 54) (const_int 118)
12282 (const_int 55) (const_int 119)])))]
12284 "vpunpcklbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12285 [(set_attr "type" "sselog")
12286 (set_attr "prefix" "evex")
12287 (set_attr "mode" "XI")])
12289 (define_insn "avx2_interleave_lowv32qi<mask_name>"
12290 [(set (match_operand:V32QI 0 "register_operand" "=v")
12293 (match_operand:V32QI 1 "register_operand" "v")
12294 (match_operand:V32QI 2 "nonimmediate_operand" "vm"))
12295 (parallel [(const_int 0) (const_int 32)
12296 (const_int 1) (const_int 33)
12297 (const_int 2) (const_int 34)
12298 (const_int 3) (const_int 35)
12299 (const_int 4) (const_int 36)
12300 (const_int 5) (const_int 37)
12301 (const_int 6) (const_int 38)
12302 (const_int 7) (const_int 39)
12303 (const_int 16) (const_int 48)
12304 (const_int 17) (const_int 49)
12305 (const_int 18) (const_int 50)
12306 (const_int 19) (const_int 51)
12307 (const_int 20) (const_int 52)
12308 (const_int 21) (const_int 53)
12309 (const_int 22) (const_int 54)
12310 (const_int 23) (const_int 55)])))]
12311 "TARGET_AVX2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12312 "vpunpcklbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12313 [(set_attr "type" "sselog")
12314 (set_attr "prefix" "maybe_vex")
12315 (set_attr "mode" "OI")])
12317 (define_insn "vec_interleave_lowv16qi<mask_name>"
12318 [(set (match_operand:V16QI 0 "register_operand" "=x,v")
12321 (match_operand:V16QI 1 "register_operand" "0,v")
12322 (match_operand:V16QI 2 "vector_operand" "xBm,vm"))
12323 (parallel [(const_int 0) (const_int 16)
12324 (const_int 1) (const_int 17)
12325 (const_int 2) (const_int 18)
12326 (const_int 3) (const_int 19)
12327 (const_int 4) (const_int 20)
12328 (const_int 5) (const_int 21)
12329 (const_int 6) (const_int 22)
12330 (const_int 7) (const_int 23)])))]
12331 "TARGET_SSE2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12333 punpcklbw\t{%2, %0|%0, %2}
12334 vpunpcklbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12335 [(set_attr "isa" "noavx,avx")
12336 (set_attr "type" "sselog")
12337 (set_attr "prefix_data16" "1,*")
12338 (set_attr "prefix" "orig,vex")
12339 (set_attr "mode" "TI")])
12341 (define_insn "avx512bw_interleave_highv32hi<mask_name>"
12342 [(set (match_operand:V32HI 0 "register_operand" "=v")
12345 (match_operand:V32HI 1 "register_operand" "v")
12346 (match_operand:V32HI 2 "nonimmediate_operand" "vm"))
12347 (parallel [(const_int 4) (const_int 36)
12348 (const_int 5) (const_int 37)
12349 (const_int 6) (const_int 38)
12350 (const_int 7) (const_int 39)
12351 (const_int 12) (const_int 44)
12352 (const_int 13) (const_int 45)
12353 (const_int 14) (const_int 46)
12354 (const_int 15) (const_int 47)
12355 (const_int 20) (const_int 52)
12356 (const_int 21) (const_int 53)
12357 (const_int 22) (const_int 54)
12358 (const_int 23) (const_int 55)
12359 (const_int 28) (const_int 60)
12360 (const_int 29) (const_int 61)
12361 (const_int 30) (const_int 62)
12362 (const_int 31) (const_int 63)])))]
12364 "vpunpckhwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12365 [(set_attr "type" "sselog")
12366 (set_attr "prefix" "evex")
12367 (set_attr "mode" "XI")])
12369 (define_insn "avx2_interleave_highv16hi<mask_name>"
12370 [(set (match_operand:V16HI 0 "register_operand" "=v")
12373 (match_operand:V16HI 1 "register_operand" "v")
12374 (match_operand:V16HI 2 "nonimmediate_operand" "vm"))
12375 (parallel [(const_int 4) (const_int 20)
12376 (const_int 5) (const_int 21)
12377 (const_int 6) (const_int 22)
12378 (const_int 7) (const_int 23)
12379 (const_int 12) (const_int 28)
12380 (const_int 13) (const_int 29)
12381 (const_int 14) (const_int 30)
12382 (const_int 15) (const_int 31)])))]
12383 "TARGET_AVX2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12384 "vpunpckhwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12385 [(set_attr "type" "sselog")
12386 (set_attr "prefix" "maybe_evex")
12387 (set_attr "mode" "OI")])
12389 (define_insn "vec_interleave_highv8hi<mask_name>"
12390 [(set (match_operand:V8HI 0 "register_operand" "=x,v")
12393 (match_operand:V8HI 1 "register_operand" "0,v")
12394 (match_operand:V8HI 2 "vector_operand" "xBm,vm"))
12395 (parallel [(const_int 4) (const_int 12)
12396 (const_int 5) (const_int 13)
12397 (const_int 6) (const_int 14)
12398 (const_int 7) (const_int 15)])))]
12399 "TARGET_SSE2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12401 punpckhwd\t{%2, %0|%0, %2}
12402 vpunpckhwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12403 [(set_attr "isa" "noavx,avx")
12404 (set_attr "type" "sselog")
12405 (set_attr "prefix_data16" "1,*")
12406 (set_attr "prefix" "orig,maybe_vex")
12407 (set_attr "mode" "TI")])
12409 (define_insn "<mask_codefor>avx512bw_interleave_lowv32hi<mask_name>"
12410 [(set (match_operand:V32HI 0 "register_operand" "=v")
12413 (match_operand:V32HI 1 "register_operand" "v")
12414 (match_operand:V32HI 2 "nonimmediate_operand" "vm"))
12415 (parallel [(const_int 0) (const_int 32)
12416 (const_int 1) (const_int 33)
12417 (const_int 2) (const_int 34)
12418 (const_int 3) (const_int 35)
12419 (const_int 8) (const_int 40)
12420 (const_int 9) (const_int 41)
12421 (const_int 10) (const_int 42)
12422 (const_int 11) (const_int 43)
12423 (const_int 16) (const_int 48)
12424 (const_int 17) (const_int 49)
12425 (const_int 18) (const_int 50)
12426 (const_int 19) (const_int 51)
12427 (const_int 24) (const_int 56)
12428 (const_int 25) (const_int 57)
12429 (const_int 26) (const_int 58)
12430 (const_int 27) (const_int 59)])))]
12432 "vpunpcklwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12433 [(set_attr "type" "sselog")
12434 (set_attr "prefix" "evex")
12435 (set_attr "mode" "XI")])
12437 (define_insn "avx2_interleave_lowv16hi<mask_name>"
12438 [(set (match_operand:V16HI 0 "register_operand" "=v")
12441 (match_operand:V16HI 1 "register_operand" "v")
12442 (match_operand:V16HI 2 "nonimmediate_operand" "vm"))
12443 (parallel [(const_int 0) (const_int 16)
12444 (const_int 1) (const_int 17)
12445 (const_int 2) (const_int 18)
12446 (const_int 3) (const_int 19)
12447 (const_int 8) (const_int 24)
12448 (const_int 9) (const_int 25)
12449 (const_int 10) (const_int 26)
12450 (const_int 11) (const_int 27)])))]
12451 "TARGET_AVX2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12452 "vpunpcklwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12453 [(set_attr "type" "sselog")
12454 (set_attr "prefix" "maybe_evex")
12455 (set_attr "mode" "OI")])
12457 (define_insn "vec_interleave_lowv8hi<mask_name>"
12458 [(set (match_operand:V8HI 0 "register_operand" "=x,v")
12461 (match_operand:V8HI 1 "register_operand" "0,v")
12462 (match_operand:V8HI 2 "vector_operand" "xBm,vm"))
12463 (parallel [(const_int 0) (const_int 8)
12464 (const_int 1) (const_int 9)
12465 (const_int 2) (const_int 10)
12466 (const_int 3) (const_int 11)])))]
12467 "TARGET_SSE2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12469 punpcklwd\t{%2, %0|%0, %2}
12470 vpunpcklwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12471 [(set_attr "isa" "noavx,avx")
12472 (set_attr "type" "sselog")
12473 (set_attr "prefix_data16" "1,*")
12474 (set_attr "prefix" "orig,maybe_evex")
12475 (set_attr "mode" "TI")])
12477 (define_insn "avx2_interleave_highv8si<mask_name>"
12478 [(set (match_operand:V8SI 0 "register_operand" "=v")
12481 (match_operand:V8SI 1 "register_operand" "v")
12482 (match_operand:V8SI 2 "nonimmediate_operand" "vm"))
12483 (parallel [(const_int 2) (const_int 10)
12484 (const_int 3) (const_int 11)
12485 (const_int 6) (const_int 14)
12486 (const_int 7) (const_int 15)])))]
12487 "TARGET_AVX2 && <mask_avx512vl_condition>"
12488 "vpunpckhdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12489 [(set_attr "type" "sselog")
12490 (set_attr "prefix" "maybe_evex")
12491 (set_attr "mode" "OI")])
12493 (define_insn "<mask_codefor>avx512f_interleave_highv16si<mask_name>"
12494 [(set (match_operand:V16SI 0 "register_operand" "=v")
12497 (match_operand:V16SI 1 "register_operand" "v")
12498 (match_operand:V16SI 2 "nonimmediate_operand" "vm"))
12499 (parallel [(const_int 2) (const_int 18)
12500 (const_int 3) (const_int 19)
12501 (const_int 6) (const_int 22)
12502 (const_int 7) (const_int 23)
12503 (const_int 10) (const_int 26)
12504 (const_int 11) (const_int 27)
12505 (const_int 14) (const_int 30)
12506 (const_int 15) (const_int 31)])))]
12508 "vpunpckhdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12509 [(set_attr "type" "sselog")
12510 (set_attr "prefix" "evex")
12511 (set_attr "mode" "XI")])
12514 (define_insn "vec_interleave_highv4si<mask_name>"
12515 [(set (match_operand:V4SI 0 "register_operand" "=x,v")
12518 (match_operand:V4SI 1 "register_operand" "0,v")
12519 (match_operand:V4SI 2 "vector_operand" "xBm,vm"))
12520 (parallel [(const_int 2) (const_int 6)
12521 (const_int 3) (const_int 7)])))]
12522 "TARGET_SSE2 && <mask_avx512vl_condition>"
12524 punpckhdq\t{%2, %0|%0, %2}
12525 vpunpckhdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12526 [(set_attr "isa" "noavx,avx")
12527 (set_attr "type" "sselog")
12528 (set_attr "prefix_data16" "1,*")
12529 (set_attr "prefix" "orig,maybe_vex")
12530 (set_attr "mode" "TI")])
12532 (define_insn "avx2_interleave_lowv8si<mask_name>"
12533 [(set (match_operand:V8SI 0 "register_operand" "=v")
12536 (match_operand:V8SI 1 "register_operand" "v")
12537 (match_operand:V8SI 2 "nonimmediate_operand" "vm"))
12538 (parallel [(const_int 0) (const_int 8)
12539 (const_int 1) (const_int 9)
12540 (const_int 4) (const_int 12)
12541 (const_int 5) (const_int 13)])))]
12542 "TARGET_AVX2 && <mask_avx512vl_condition>"
12543 "vpunpckldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12544 [(set_attr "type" "sselog")
12545 (set_attr "prefix" "maybe_evex")
12546 (set_attr "mode" "OI")])
12548 (define_insn "<mask_codefor>avx512f_interleave_lowv16si<mask_name>"
12549 [(set (match_operand:V16SI 0 "register_operand" "=v")
12552 (match_operand:V16SI 1 "register_operand" "v")
12553 (match_operand:V16SI 2 "nonimmediate_operand" "vm"))
12554 (parallel [(const_int 0) (const_int 16)
12555 (const_int 1) (const_int 17)
12556 (const_int 4) (const_int 20)
12557 (const_int 5) (const_int 21)
12558 (const_int 8) (const_int 24)
12559 (const_int 9) (const_int 25)
12560 (const_int 12) (const_int 28)
12561 (const_int 13) (const_int 29)])))]
12563 "vpunpckldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12564 [(set_attr "type" "sselog")
12565 (set_attr "prefix" "evex")
12566 (set_attr "mode" "XI")])
12568 (define_insn "vec_interleave_lowv4si<mask_name>"
12569 [(set (match_operand:V4SI 0 "register_operand" "=x,v")
12572 (match_operand:V4SI 1 "register_operand" "0,v")
12573 (match_operand:V4SI 2 "vector_operand" "xBm,vm"))
12574 (parallel [(const_int 0) (const_int 4)
12575 (const_int 1) (const_int 5)])))]
12576 "TARGET_SSE2 && <mask_avx512vl_condition>"
12578 punpckldq\t{%2, %0|%0, %2}
12579 vpunpckldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12580 [(set_attr "isa" "noavx,avx")
12581 (set_attr "type" "sselog")
12582 (set_attr "prefix_data16" "1,*")
12583 (set_attr "prefix" "orig,vex")
12584 (set_attr "mode" "TI")])
12586 (define_expand "vec_interleave_high<mode>"
12587 [(match_operand:VI_256 0 "register_operand")
12588 (match_operand:VI_256 1 "register_operand")
12589 (match_operand:VI_256 2 "nonimmediate_operand")]
12592 rtx t1 = gen_reg_rtx (<MODE>mode);
12593 rtx t2 = gen_reg_rtx (<MODE>mode);
12594 rtx t3 = gen_reg_rtx (V4DImode);
12595 emit_insn (gen_avx2_interleave_low<mode> (t1, operands[1], operands[2]));
12596 emit_insn (gen_avx2_interleave_high<mode> (t2, operands[1], operands[2]));
12597 emit_insn (gen_avx2_permv2ti (t3, gen_lowpart (V4DImode, t1),
12598 gen_lowpart (V4DImode, t2),
12599 GEN_INT (1 + (3 << 4))));
12600 emit_move_insn (operands[0], gen_lowpart (<MODE>mode, t3));
12604 (define_expand "vec_interleave_low<mode>"
12605 [(match_operand:VI_256 0 "register_operand")
12606 (match_operand:VI_256 1 "register_operand")
12607 (match_operand:VI_256 2 "nonimmediate_operand")]
12610 rtx t1 = gen_reg_rtx (<MODE>mode);
12611 rtx t2 = gen_reg_rtx (<MODE>mode);
12612 rtx t3 = gen_reg_rtx (V4DImode);
12613 emit_insn (gen_avx2_interleave_low<mode> (t1, operands[1], operands[2]));
12614 emit_insn (gen_avx2_interleave_high<mode> (t2, operands[1], operands[2]));
12615 emit_insn (gen_avx2_permv2ti (t3, gen_lowpart (V4DImode, t1),
12616 gen_lowpart (V4DImode, t2),
12617 GEN_INT (0 + (2 << 4))));
12618 emit_move_insn (operands[0], gen_lowpart (<MODE>mode, t3));
12622 ;; Modes handled by pinsr patterns.
12623 (define_mode_iterator PINSR_MODE
12624 [(V16QI "TARGET_SSE4_1") V8HI
12625 (V4SI "TARGET_SSE4_1")
12626 (V2DI "TARGET_SSE4_1 && TARGET_64BIT")])
12628 (define_mode_attr sse2p4_1
12629 [(V16QI "sse4_1") (V8HI "sse2")
12630 (V4SI "sse4_1") (V2DI "sse4_1")])
12632 (define_mode_attr pinsr_evex_isa
12633 [(V16QI "avx512bw") (V8HI "avx512bw")
12634 (V4SI "avx512dq") (V2DI "avx512dq")])
12636 ;; sse4_1_pinsrd must come before sse2_loadld since it is preferred.
12637 (define_insn "<sse2p4_1>_pinsr<ssemodesuffix>"
12638 [(set (match_operand:PINSR_MODE 0 "register_operand" "=x,x,x,x,v,v")
12639 (vec_merge:PINSR_MODE
12640 (vec_duplicate:PINSR_MODE
12641 (match_operand:<ssescalarmode> 2 "nonimmediate_operand" "r,m,r,m,r,m"))
12642 (match_operand:PINSR_MODE 1 "register_operand" "0,0,x,x,v,v")
12643 (match_operand:SI 3 "const_int_operand")))]
12645 && ((unsigned) exact_log2 (INTVAL (operands[3]))
12646 < GET_MODE_NUNITS (<MODE>mode))"
12648 operands[3] = GEN_INT (exact_log2 (INTVAL (operands[3])));
12650 switch (which_alternative)
12653 if (GET_MODE_SIZE (<ssescalarmode>mode) < GET_MODE_SIZE (SImode))
12654 return "pinsr<ssemodesuffix>\t{%3, %k2, %0|%0, %k2, %3}";
12657 return "pinsr<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}";
12660 if (GET_MODE_SIZE (<ssescalarmode>mode) < GET_MODE_SIZE (SImode))
12661 return "vpinsr<ssemodesuffix>\t{%3, %k2, %1, %0|%0, %1, %k2, %3}";
12665 return "vpinsr<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}";
12667 gcc_unreachable ();
12670 [(set_attr "isa" "noavx,noavx,avx,avx,<pinsr_evex_isa>,<pinsr_evex_isa>")
12671 (set_attr "type" "sselog")
12672 (set (attr "prefix_rex")
12674 (and (not (match_test "TARGET_AVX"))
12675 (eq (const_string "<MODE>mode") (const_string "V2DImode")))
12677 (const_string "*")))
12678 (set (attr "prefix_data16")
12680 (and (not (match_test "TARGET_AVX"))
12681 (eq (const_string "<MODE>mode") (const_string "V8HImode")))
12683 (const_string "*")))
12684 (set (attr "prefix_extra")
12686 (and (not (match_test "TARGET_AVX"))
12687 (eq (const_string "<MODE>mode") (const_string "V8HImode")))
12689 (const_string "1")))
12690 (set_attr "length_immediate" "1")
12691 (set_attr "prefix" "orig,orig,vex,vex,evex,evex")
12692 (set_attr "mode" "TI")])
12694 (define_expand "<extract_type>_vinsert<shuffletype><extract_suf>_mask"
12695 [(match_operand:AVX512_VEC 0 "register_operand")
12696 (match_operand:AVX512_VEC 1 "register_operand")
12697 (match_operand:<ssequartermode> 2 "nonimmediate_operand")
12698 (match_operand:SI 3 "const_0_to_3_operand")
12699 (match_operand:AVX512_VEC 4 "register_operand")
12700 (match_operand:<avx512fmaskmode> 5 "register_operand")]
12703 int mask, selector;
12704 mask = INTVAL (operands[3]);
12705 selector = (GET_MODE_UNIT_SIZE (<MODE>mode) == 4
12706 ? 0xFFFF ^ (0x000F << mask * 4)
12707 : 0xFF ^ (0x03 << mask * 2));
12708 emit_insn (gen_<extract_type>_vinsert<shuffletype><extract_suf>_1_mask
12709 (operands[0], operands[1], operands[2], GEN_INT (selector),
12710 operands[4], operands[5]));
12714 (define_insn "<mask_codefor><extract_type>_vinsert<shuffletype><extract_suf>_1<mask_name>"
12715 [(set (match_operand:AVX512_VEC 0 "register_operand" "=v")
12716 (vec_merge:AVX512_VEC
12717 (match_operand:AVX512_VEC 1 "register_operand" "v")
12718 (vec_duplicate:AVX512_VEC
12719 (match_operand:<ssequartermode> 2 "nonimmediate_operand" "vm"))
12720 (match_operand:SI 3 "const_int_operand" "n")))]
12724 int selector = INTVAL (operands[3]);
12726 if (selector == (GET_MODE_UNIT_SIZE (<MODE>mode) == 4 ? 0xFFF0 : 0xFC))
12728 else if (selector == (GET_MODE_UNIT_SIZE (<MODE>mode) == 4 ? 0xFF0F : 0xF3))
12730 else if (selector == (GET_MODE_UNIT_SIZE (<MODE>mode) == 4 ? 0xF0FF : 0xCF))
12732 else if (selector == (GET_MODE_UNIT_SIZE (<MODE>mode) == 4 ? 0x0FFF : 0x3F))
12735 gcc_unreachable ();
12737 operands[3] = GEN_INT (mask);
12739 return "vinsert<shuffletype><extract_suf>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3}";
12741 [(set_attr "type" "sselog")
12742 (set_attr "length_immediate" "1")
12743 (set_attr "prefix" "evex")
12744 (set_attr "mode" "<sseinsnmode>")])
12746 (define_expand "<extract_type_2>_vinsert<shuffletype><extract_suf_2>_mask"
12747 [(match_operand:AVX512_VEC_2 0 "register_operand")
12748 (match_operand:AVX512_VEC_2 1 "register_operand")
12749 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand")
12750 (match_operand:SI 3 "const_0_to_1_operand")
12751 (match_operand:AVX512_VEC_2 4 "register_operand")
12752 (match_operand:<avx512fmaskmode> 5 "register_operand")]
12755 int mask = INTVAL (operands[3]);
12757 emit_insn (gen_vec_set_lo_<mode>_mask (operands[0], operands[1],
12758 operands[2], operands[4],
12761 emit_insn (gen_vec_set_hi_<mode>_mask (operands[0], operands[1],
12762 operands[2], operands[4],
12767 (define_insn "vec_set_lo_<mode><mask_name>"
12768 [(set (match_operand:V16FI 0 "register_operand" "=v")
12770 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
12771 (vec_select:<ssehalfvecmode>
12772 (match_operand:V16FI 1 "register_operand" "v")
12773 (parallel [(const_int 8) (const_int 9)
12774 (const_int 10) (const_int 11)
12775 (const_int 12) (const_int 13)
12776 (const_int 14) (const_int 15)]))))]
12778 "vinsert<shuffletype>32x8\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}"
12779 [(set_attr "type" "sselog")
12780 (set_attr "length_immediate" "1")
12781 (set_attr "prefix" "evex")
12782 (set_attr "mode" "<sseinsnmode>")])
12784 (define_insn "vec_set_hi_<mode><mask_name>"
12785 [(set (match_operand:V16FI 0 "register_operand" "=v")
12787 (vec_select:<ssehalfvecmode>
12788 (match_operand:V16FI 1 "register_operand" "v")
12789 (parallel [(const_int 0) (const_int 1)
12790 (const_int 2) (const_int 3)
12791 (const_int 4) (const_int 5)
12792 (const_int 6) (const_int 7)]))
12793 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
12795 "vinsert<shuffletype>32x8\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}"
12796 [(set_attr "type" "sselog")
12797 (set_attr "length_immediate" "1")
12798 (set_attr "prefix" "evex")
12799 (set_attr "mode" "<sseinsnmode>")])
12801 (define_insn "vec_set_lo_<mode><mask_name>"
12802 [(set (match_operand:V8FI 0 "register_operand" "=v")
12804 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
12805 (vec_select:<ssehalfvecmode>
12806 (match_operand:V8FI 1 "register_operand" "v")
12807 (parallel [(const_int 4) (const_int 5)
12808 (const_int 6) (const_int 7)]))))]
12810 "vinsert<shuffletype>64x4\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}"
12811 [(set_attr "type" "sselog")
12812 (set_attr "length_immediate" "1")
12813 (set_attr "prefix" "evex")
12814 (set_attr "mode" "XI")])
12816 (define_insn "vec_set_hi_<mode><mask_name>"
12817 [(set (match_operand:V8FI 0 "register_operand" "=v")
12819 (vec_select:<ssehalfvecmode>
12820 (match_operand:V8FI 1 "register_operand" "v")
12821 (parallel [(const_int 0) (const_int 1)
12822 (const_int 2) (const_int 3)]))
12823 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
12825 "vinsert<shuffletype>64x4\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}"
12826 [(set_attr "type" "sselog")
12827 (set_attr "length_immediate" "1")
12828 (set_attr "prefix" "evex")
12829 (set_attr "mode" "XI")])
12831 (define_expand "avx512dq_shuf_<shuffletype>64x2_mask"
12832 [(match_operand:VI8F_256 0 "register_operand")
12833 (match_operand:VI8F_256 1 "register_operand")
12834 (match_operand:VI8F_256 2 "nonimmediate_operand")
12835 (match_operand:SI 3 "const_0_to_3_operand")
12836 (match_operand:VI8F_256 4 "register_operand")
12837 (match_operand:QI 5 "register_operand")]
12840 int mask = INTVAL (operands[3]);
12841 emit_insn (gen_avx512dq_shuf_<shuffletype>64x2_1_mask
12842 (operands[0], operands[1], operands[2],
12843 GEN_INT (((mask >> 0) & 1) * 2 + 0),
12844 GEN_INT (((mask >> 0) & 1) * 2 + 1),
12845 GEN_INT (((mask >> 1) & 1) * 2 + 4),
12846 GEN_INT (((mask >> 1) & 1) * 2 + 5),
12847 operands[4], operands[5]));
12851 (define_insn "<mask_codefor>avx512dq_shuf_<shuffletype>64x2_1<mask_name>"
12852 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
12853 (vec_select:VI8F_256
12854 (vec_concat:<ssedoublemode>
12855 (match_operand:VI8F_256 1 "register_operand" "v")
12856 (match_operand:VI8F_256 2 "nonimmediate_operand" "vm"))
12857 (parallel [(match_operand 3 "const_0_to_3_operand")
12858 (match_operand 4 "const_0_to_3_operand")
12859 (match_operand 5 "const_4_to_7_operand")
12860 (match_operand 6 "const_4_to_7_operand")])))]
12862 && (INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
12863 && INTVAL (operands[5]) == (INTVAL (operands[6]) - 1))"
12866 mask = INTVAL (operands[3]) / 2;
12867 mask |= (INTVAL (operands[5]) - 4) / 2 << 1;
12868 operands[3] = GEN_INT (mask);
12869 return "vshuf<shuffletype>64x2\t{%3, %2, %1, %0<mask_operand7>|%0<mask_operand7>, %1, %2, %3}";
12871 [(set_attr "type" "sselog")
12872 (set_attr "length_immediate" "1")
12873 (set_attr "prefix" "evex")
12874 (set_attr "mode" "XI")])
12876 (define_expand "avx512f_shuf_<shuffletype>64x2_mask"
12877 [(match_operand:V8FI 0 "register_operand")
12878 (match_operand:V8FI 1 "register_operand")
12879 (match_operand:V8FI 2 "nonimmediate_operand")
12880 (match_operand:SI 3 "const_0_to_255_operand")
12881 (match_operand:V8FI 4 "register_operand")
12882 (match_operand:QI 5 "register_operand")]
12885 int mask = INTVAL (operands[3]);
12886 emit_insn (gen_avx512f_shuf_<shuffletype>64x2_1_mask
12887 (operands[0], operands[1], operands[2],
12888 GEN_INT (((mask >> 0) & 3) * 2),
12889 GEN_INT (((mask >> 0) & 3) * 2 + 1),
12890 GEN_INT (((mask >> 2) & 3) * 2),
12891 GEN_INT (((mask >> 2) & 3) * 2 + 1),
12892 GEN_INT (((mask >> 4) & 3) * 2 + 8),
12893 GEN_INT (((mask >> 4) & 3) * 2 + 9),
12894 GEN_INT (((mask >> 6) & 3) * 2 + 8),
12895 GEN_INT (((mask >> 6) & 3) * 2 + 9),
12896 operands[4], operands[5]));
12900 (define_insn "avx512f_shuf_<shuffletype>64x2_1<mask_name>"
12901 [(set (match_operand:V8FI 0 "register_operand" "=v")
12903 (vec_concat:<ssedoublemode>
12904 (match_operand:V8FI 1 "register_operand" "v")
12905 (match_operand:V8FI 2 "nonimmediate_operand" "vm"))
12906 (parallel [(match_operand 3 "const_0_to_7_operand")
12907 (match_operand 4 "const_0_to_7_operand")
12908 (match_operand 5 "const_0_to_7_operand")
12909 (match_operand 6 "const_0_to_7_operand")
12910 (match_operand 7 "const_8_to_15_operand")
12911 (match_operand 8 "const_8_to_15_operand")
12912 (match_operand 9 "const_8_to_15_operand")
12913 (match_operand 10 "const_8_to_15_operand")])))]
12915 && (INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
12916 && INTVAL (operands[5]) == (INTVAL (operands[6]) - 1)
12917 && INTVAL (operands[7]) == (INTVAL (operands[8]) - 1)
12918 && INTVAL (operands[9]) == (INTVAL (operands[10]) - 1))"
12921 mask = INTVAL (operands[3]) / 2;
12922 mask |= INTVAL (operands[5]) / 2 << 2;
12923 mask |= (INTVAL (operands[7]) - 8) / 2 << 4;
12924 mask |= (INTVAL (operands[9]) - 8) / 2 << 6;
12925 operands[3] = GEN_INT (mask);
12927 return "vshuf<shuffletype>64x2\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
12929 [(set_attr "type" "sselog")
12930 (set_attr "length_immediate" "1")
12931 (set_attr "prefix" "evex")
12932 (set_attr "mode" "<sseinsnmode>")])
12934 (define_expand "avx512vl_shuf_<shuffletype>32x4_mask"
12935 [(match_operand:VI4F_256 0 "register_operand")
12936 (match_operand:VI4F_256 1 "register_operand")
12937 (match_operand:VI4F_256 2 "nonimmediate_operand")
12938 (match_operand:SI 3 "const_0_to_3_operand")
12939 (match_operand:VI4F_256 4 "register_operand")
12940 (match_operand:QI 5 "register_operand")]
12943 int mask = INTVAL (operands[3]);
12944 emit_insn (gen_avx512vl_shuf_<shuffletype>32x4_1_mask
12945 (operands[0], operands[1], operands[2],
12946 GEN_INT (((mask >> 0) & 1) * 4 + 0),
12947 GEN_INT (((mask >> 0) & 1) * 4 + 1),
12948 GEN_INT (((mask >> 0) & 1) * 4 + 2),
12949 GEN_INT (((mask >> 0) & 1) * 4 + 3),
12950 GEN_INT (((mask >> 1) & 1) * 4 + 8),
12951 GEN_INT (((mask >> 1) & 1) * 4 + 9),
12952 GEN_INT (((mask >> 1) & 1) * 4 + 10),
12953 GEN_INT (((mask >> 1) & 1) * 4 + 11),
12954 operands[4], operands[5]));
12958 (define_insn "avx512vl_shuf_<shuffletype>32x4_1<mask_name>"
12959 [(set (match_operand:VI4F_256 0 "register_operand" "=v")
12960 (vec_select:VI4F_256
12961 (vec_concat:<ssedoublemode>
12962 (match_operand:VI4F_256 1 "register_operand" "v")
12963 (match_operand:VI4F_256 2 "nonimmediate_operand" "vm"))
12964 (parallel [(match_operand 3 "const_0_to_7_operand")
12965 (match_operand 4 "const_0_to_7_operand")
12966 (match_operand 5 "const_0_to_7_operand")
12967 (match_operand 6 "const_0_to_7_operand")
12968 (match_operand 7 "const_8_to_15_operand")
12969 (match_operand 8 "const_8_to_15_operand")
12970 (match_operand 9 "const_8_to_15_operand")
12971 (match_operand 10 "const_8_to_15_operand")])))]
12973 && (INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
12974 && INTVAL (operands[3]) == (INTVAL (operands[5]) - 2)
12975 && INTVAL (operands[3]) == (INTVAL (operands[6]) - 3)
12976 && INTVAL (operands[7]) == (INTVAL (operands[8]) - 1)
12977 && INTVAL (operands[7]) == (INTVAL (operands[9]) - 2)
12978 && INTVAL (operands[7]) == (INTVAL (operands[10]) - 3))"
12981 mask = INTVAL (operands[3]) / 4;
12982 mask |= (INTVAL (operands[7]) - 8) / 4 << 1;
12983 operands[3] = GEN_INT (mask);
12985 return "vshuf<shuffletype>32x4\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
12987 [(set_attr "type" "sselog")
12988 (set_attr "length_immediate" "1")
12989 (set_attr "prefix" "evex")
12990 (set_attr "mode" "<sseinsnmode>")])
12992 (define_expand "avx512f_shuf_<shuffletype>32x4_mask"
12993 [(match_operand:V16FI 0 "register_operand")
12994 (match_operand:V16FI 1 "register_operand")
12995 (match_operand:V16FI 2 "nonimmediate_operand")
12996 (match_operand:SI 3 "const_0_to_255_operand")
12997 (match_operand:V16FI 4 "register_operand")
12998 (match_operand:HI 5 "register_operand")]
13001 int mask = INTVAL (operands[3]);
13002 emit_insn (gen_avx512f_shuf_<shuffletype>32x4_1_mask
13003 (operands[0], operands[1], operands[2],
13004 GEN_INT (((mask >> 0) & 3) * 4),
13005 GEN_INT (((mask >> 0) & 3) * 4 + 1),
13006 GEN_INT (((mask >> 0) & 3) * 4 + 2),
13007 GEN_INT (((mask >> 0) & 3) * 4 + 3),
13008 GEN_INT (((mask >> 2) & 3) * 4),
13009 GEN_INT (((mask >> 2) & 3) * 4 + 1),
13010 GEN_INT (((mask >> 2) & 3) * 4 + 2),
13011 GEN_INT (((mask >> 2) & 3) * 4 + 3),
13012 GEN_INT (((mask >> 4) & 3) * 4 + 16),
13013 GEN_INT (((mask >> 4) & 3) * 4 + 17),
13014 GEN_INT (((mask >> 4) & 3) * 4 + 18),
13015 GEN_INT (((mask >> 4) & 3) * 4 + 19),
13016 GEN_INT (((mask >> 6) & 3) * 4 + 16),
13017 GEN_INT (((mask >> 6) & 3) * 4 + 17),
13018 GEN_INT (((mask >> 6) & 3) * 4 + 18),
13019 GEN_INT (((mask >> 6) & 3) * 4 + 19),
13020 operands[4], operands[5]));
13024 (define_insn "avx512f_shuf_<shuffletype>32x4_1<mask_name>"
13025 [(set (match_operand:V16FI 0 "register_operand" "=v")
13027 (vec_concat:<ssedoublemode>
13028 (match_operand:V16FI 1 "register_operand" "v")
13029 (match_operand:V16FI 2 "nonimmediate_operand" "vm"))
13030 (parallel [(match_operand 3 "const_0_to_15_operand")
13031 (match_operand 4 "const_0_to_15_operand")
13032 (match_operand 5 "const_0_to_15_operand")
13033 (match_operand 6 "const_0_to_15_operand")
13034 (match_operand 7 "const_0_to_15_operand")
13035 (match_operand 8 "const_0_to_15_operand")
13036 (match_operand 9 "const_0_to_15_operand")
13037 (match_operand 10 "const_0_to_15_operand")
13038 (match_operand 11 "const_16_to_31_operand")
13039 (match_operand 12 "const_16_to_31_operand")
13040 (match_operand 13 "const_16_to_31_operand")
13041 (match_operand 14 "const_16_to_31_operand")
13042 (match_operand 15 "const_16_to_31_operand")
13043 (match_operand 16 "const_16_to_31_operand")
13044 (match_operand 17 "const_16_to_31_operand")
13045 (match_operand 18 "const_16_to_31_operand")])))]
13047 && (INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
13048 && INTVAL (operands[3]) == (INTVAL (operands[5]) - 2)
13049 && INTVAL (operands[3]) == (INTVAL (operands[6]) - 3)
13050 && INTVAL (operands[7]) == (INTVAL (operands[8]) - 1)
13051 && INTVAL (operands[7]) == (INTVAL (operands[9]) - 2)
13052 && INTVAL (operands[7]) == (INTVAL (operands[10]) - 3)
13053 && INTVAL (operands[11]) == (INTVAL (operands[12]) - 1)
13054 && INTVAL (operands[11]) == (INTVAL (operands[13]) - 2)
13055 && INTVAL (operands[11]) == (INTVAL (operands[14]) - 3)
13056 && INTVAL (operands[15]) == (INTVAL (operands[16]) - 1)
13057 && INTVAL (operands[15]) == (INTVAL (operands[17]) - 2)
13058 && INTVAL (operands[15]) == (INTVAL (operands[18]) - 3))"
13061 mask = INTVAL (operands[3]) / 4;
13062 mask |= INTVAL (operands[7]) / 4 << 2;
13063 mask |= (INTVAL (operands[11]) - 16) / 4 << 4;
13064 mask |= (INTVAL (operands[15]) - 16) / 4 << 6;
13065 operands[3] = GEN_INT (mask);
13067 return "vshuf<shuffletype>32x4\t{%3, %2, %1, %0<mask_operand19>|%0<mask_operand19>, %1, %2, %3}";
13069 [(set_attr "type" "sselog")
13070 (set_attr "length_immediate" "1")
13071 (set_attr "prefix" "evex")
13072 (set_attr "mode" "<sseinsnmode>")])
13074 (define_expand "avx512f_pshufdv3_mask"
13075 [(match_operand:V16SI 0 "register_operand")
13076 (match_operand:V16SI 1 "nonimmediate_operand")
13077 (match_operand:SI 2 "const_0_to_255_operand")
13078 (match_operand:V16SI 3 "register_operand")
13079 (match_operand:HI 4 "register_operand")]
13082 int mask = INTVAL (operands[2]);
13083 emit_insn (gen_avx512f_pshufd_1_mask (operands[0], operands[1],
13084 GEN_INT ((mask >> 0) & 3),
13085 GEN_INT ((mask >> 2) & 3),
13086 GEN_INT ((mask >> 4) & 3),
13087 GEN_INT ((mask >> 6) & 3),
13088 GEN_INT (((mask >> 0) & 3) + 4),
13089 GEN_INT (((mask >> 2) & 3) + 4),
13090 GEN_INT (((mask >> 4) & 3) + 4),
13091 GEN_INT (((mask >> 6) & 3) + 4),
13092 GEN_INT (((mask >> 0) & 3) + 8),
13093 GEN_INT (((mask >> 2) & 3) + 8),
13094 GEN_INT (((mask >> 4) & 3) + 8),
13095 GEN_INT (((mask >> 6) & 3) + 8),
13096 GEN_INT (((mask >> 0) & 3) + 12),
13097 GEN_INT (((mask >> 2) & 3) + 12),
13098 GEN_INT (((mask >> 4) & 3) + 12),
13099 GEN_INT (((mask >> 6) & 3) + 12),
13100 operands[3], operands[4]));
13104 (define_insn "avx512f_pshufd_1<mask_name>"
13105 [(set (match_operand:V16SI 0 "register_operand" "=v")
13107 (match_operand:V16SI 1 "nonimmediate_operand" "vm")
13108 (parallel [(match_operand 2 "const_0_to_3_operand")
13109 (match_operand 3 "const_0_to_3_operand")
13110 (match_operand 4 "const_0_to_3_operand")
13111 (match_operand 5 "const_0_to_3_operand")
13112 (match_operand 6 "const_4_to_7_operand")
13113 (match_operand 7 "const_4_to_7_operand")
13114 (match_operand 8 "const_4_to_7_operand")
13115 (match_operand 9 "const_4_to_7_operand")
13116 (match_operand 10 "const_8_to_11_operand")
13117 (match_operand 11 "const_8_to_11_operand")
13118 (match_operand 12 "const_8_to_11_operand")
13119 (match_operand 13 "const_8_to_11_operand")
13120 (match_operand 14 "const_12_to_15_operand")
13121 (match_operand 15 "const_12_to_15_operand")
13122 (match_operand 16 "const_12_to_15_operand")
13123 (match_operand 17 "const_12_to_15_operand")])))]
13125 && INTVAL (operands[2]) + 4 == INTVAL (operands[6])
13126 && INTVAL (operands[3]) + 4 == INTVAL (operands[7])
13127 && INTVAL (operands[4]) + 4 == INTVAL (operands[8])
13128 && INTVAL (operands[5]) + 4 == INTVAL (operands[9])
13129 && INTVAL (operands[2]) + 8 == INTVAL (operands[10])
13130 && INTVAL (operands[3]) + 8 == INTVAL (operands[11])
13131 && INTVAL (operands[4]) + 8 == INTVAL (operands[12])
13132 && INTVAL (operands[5]) + 8 == INTVAL (operands[13])
13133 && INTVAL (operands[2]) + 12 == INTVAL (operands[14])
13134 && INTVAL (operands[3]) + 12 == INTVAL (operands[15])
13135 && INTVAL (operands[4]) + 12 == INTVAL (operands[16])
13136 && INTVAL (operands[5]) + 12 == INTVAL (operands[17])"
13139 mask |= INTVAL (operands[2]) << 0;
13140 mask |= INTVAL (operands[3]) << 2;
13141 mask |= INTVAL (operands[4]) << 4;
13142 mask |= INTVAL (operands[5]) << 6;
13143 operands[2] = GEN_INT (mask);
13145 return "vpshufd\t{%2, %1, %0<mask_operand18>|%0<mask_operand18>, %1, %2}";
13147 [(set_attr "type" "sselog1")
13148 (set_attr "prefix" "evex")
13149 (set_attr "length_immediate" "1")
13150 (set_attr "mode" "XI")])
13152 (define_expand "avx512vl_pshufdv3_mask"
13153 [(match_operand:V8SI 0 "register_operand")
13154 (match_operand:V8SI 1 "nonimmediate_operand")
13155 (match_operand:SI 2 "const_0_to_255_operand")
13156 (match_operand:V8SI 3 "register_operand")
13157 (match_operand:QI 4 "register_operand")]
13160 int mask = INTVAL (operands[2]);
13161 emit_insn (gen_avx2_pshufd_1_mask (operands[0], operands[1],
13162 GEN_INT ((mask >> 0) & 3),
13163 GEN_INT ((mask >> 2) & 3),
13164 GEN_INT ((mask >> 4) & 3),
13165 GEN_INT ((mask >> 6) & 3),
13166 GEN_INT (((mask >> 0) & 3) + 4),
13167 GEN_INT (((mask >> 2) & 3) + 4),
13168 GEN_INT (((mask >> 4) & 3) + 4),
13169 GEN_INT (((mask >> 6) & 3) + 4),
13170 operands[3], operands[4]));
13174 (define_expand "avx2_pshufdv3"
13175 [(match_operand:V8SI 0 "register_operand")
13176 (match_operand:V8SI 1 "nonimmediate_operand")
13177 (match_operand:SI 2 "const_0_to_255_operand")]
13180 int mask = INTVAL (operands[2]);
13181 emit_insn (gen_avx2_pshufd_1 (operands[0], operands[1],
13182 GEN_INT ((mask >> 0) & 3),
13183 GEN_INT ((mask >> 2) & 3),
13184 GEN_INT ((mask >> 4) & 3),
13185 GEN_INT ((mask >> 6) & 3),
13186 GEN_INT (((mask >> 0) & 3) + 4),
13187 GEN_INT (((mask >> 2) & 3) + 4),
13188 GEN_INT (((mask >> 4) & 3) + 4),
13189 GEN_INT (((mask >> 6) & 3) + 4)));
13193 (define_insn "avx2_pshufd_1<mask_name>"
13194 [(set (match_operand:V8SI 0 "register_operand" "=v")
13196 (match_operand:V8SI 1 "nonimmediate_operand" "vm")
13197 (parallel [(match_operand 2 "const_0_to_3_operand")
13198 (match_operand 3 "const_0_to_3_operand")
13199 (match_operand 4 "const_0_to_3_operand")
13200 (match_operand 5 "const_0_to_3_operand")
13201 (match_operand 6 "const_4_to_7_operand")
13202 (match_operand 7 "const_4_to_7_operand")
13203 (match_operand 8 "const_4_to_7_operand")
13204 (match_operand 9 "const_4_to_7_operand")])))]
13206 && <mask_avx512vl_condition>
13207 && INTVAL (operands[2]) + 4 == INTVAL (operands[6])
13208 && INTVAL (operands[3]) + 4 == INTVAL (operands[7])
13209 && INTVAL (operands[4]) + 4 == INTVAL (operands[8])
13210 && INTVAL (operands[5]) + 4 == INTVAL (operands[9])"
13213 mask |= INTVAL (operands[2]) << 0;
13214 mask |= INTVAL (operands[3]) << 2;
13215 mask |= INTVAL (operands[4]) << 4;
13216 mask |= INTVAL (operands[5]) << 6;
13217 operands[2] = GEN_INT (mask);
13219 return "vpshufd\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
13221 [(set_attr "type" "sselog1")
13222 (set_attr "prefix" "maybe_evex")
13223 (set_attr "length_immediate" "1")
13224 (set_attr "mode" "OI")])
13226 (define_expand "avx512vl_pshufd_mask"
13227 [(match_operand:V4SI 0 "register_operand")
13228 (match_operand:V4SI 1 "nonimmediate_operand")
13229 (match_operand:SI 2 "const_0_to_255_operand")
13230 (match_operand:V4SI 3 "register_operand")
13231 (match_operand:QI 4 "register_operand")]
13234 int mask = INTVAL (operands[2]);
13235 emit_insn (gen_sse2_pshufd_1_mask (operands[0], operands[1],
13236 GEN_INT ((mask >> 0) & 3),
13237 GEN_INT ((mask >> 2) & 3),
13238 GEN_INT ((mask >> 4) & 3),
13239 GEN_INT ((mask >> 6) & 3),
13240 operands[3], operands[4]));
13244 (define_expand "sse2_pshufd"
13245 [(match_operand:V4SI 0 "register_operand")
13246 (match_operand:V4SI 1 "vector_operand")
13247 (match_operand:SI 2 "const_int_operand")]
13250 int mask = INTVAL (operands[2]);
13251 emit_insn (gen_sse2_pshufd_1 (operands[0], operands[1],
13252 GEN_INT ((mask >> 0) & 3),
13253 GEN_INT ((mask >> 2) & 3),
13254 GEN_INT ((mask >> 4) & 3),
13255 GEN_INT ((mask >> 6) & 3)));
13259 (define_insn "sse2_pshufd_1<mask_name>"
13260 [(set (match_operand:V4SI 0 "register_operand" "=v")
13262 (match_operand:V4SI 1 "vector_operand" "vBm")
13263 (parallel [(match_operand 2 "const_0_to_3_operand")
13264 (match_operand 3 "const_0_to_3_operand")
13265 (match_operand 4 "const_0_to_3_operand")
13266 (match_operand 5 "const_0_to_3_operand")])))]
13267 "TARGET_SSE2 && <mask_avx512vl_condition>"
13270 mask |= INTVAL (operands[2]) << 0;
13271 mask |= INTVAL (operands[3]) << 2;
13272 mask |= INTVAL (operands[4]) << 4;
13273 mask |= INTVAL (operands[5]) << 6;
13274 operands[2] = GEN_INT (mask);
13276 return "%vpshufd\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
13278 [(set_attr "type" "sselog1")
13279 (set_attr "prefix_data16" "1")
13280 (set_attr "prefix" "<mask_prefix2>")
13281 (set_attr "length_immediate" "1")
13282 (set_attr "mode" "TI")])
13284 (define_insn "<mask_codefor>avx512bw_pshuflwv32hi<mask_name>"
13285 [(set (match_operand:V32HI 0 "register_operand" "=v")
13287 [(match_operand:V32HI 1 "nonimmediate_operand" "vm")
13288 (match_operand:SI 2 "const_0_to_255_operand" "n")]
13291 "vpshuflw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13292 [(set_attr "type" "sselog")
13293 (set_attr "prefix" "evex")
13294 (set_attr "mode" "XI")])
13296 (define_expand "avx512vl_pshuflwv3_mask"
13297 [(match_operand:V16HI 0 "register_operand")
13298 (match_operand:V16HI 1 "nonimmediate_operand")
13299 (match_operand:SI 2 "const_0_to_255_operand")
13300 (match_operand:V16HI 3 "register_operand")
13301 (match_operand:HI 4 "register_operand")]
13302 "TARGET_AVX512VL && TARGET_AVX512BW"
13304 int mask = INTVAL (operands[2]);
13305 emit_insn (gen_avx2_pshuflw_1_mask (operands[0], operands[1],
13306 GEN_INT ((mask >> 0) & 3),
13307 GEN_INT ((mask >> 2) & 3),
13308 GEN_INT ((mask >> 4) & 3),
13309 GEN_INT ((mask >> 6) & 3),
13310 GEN_INT (((mask >> 0) & 3) + 8),
13311 GEN_INT (((mask >> 2) & 3) + 8),
13312 GEN_INT (((mask >> 4) & 3) + 8),
13313 GEN_INT (((mask >> 6) & 3) + 8),
13314 operands[3], operands[4]));
13318 (define_expand "avx2_pshuflwv3"
13319 [(match_operand:V16HI 0 "register_operand")
13320 (match_operand:V16HI 1 "nonimmediate_operand")
13321 (match_operand:SI 2 "const_0_to_255_operand")]
13324 int mask = INTVAL (operands[2]);
13325 emit_insn (gen_avx2_pshuflw_1 (operands[0], operands[1],
13326 GEN_INT ((mask >> 0) & 3),
13327 GEN_INT ((mask >> 2) & 3),
13328 GEN_INT ((mask >> 4) & 3),
13329 GEN_INT ((mask >> 6) & 3),
13330 GEN_INT (((mask >> 0) & 3) + 8),
13331 GEN_INT (((mask >> 2) & 3) + 8),
13332 GEN_INT (((mask >> 4) & 3) + 8),
13333 GEN_INT (((mask >> 6) & 3) + 8)));
13337 (define_insn "avx2_pshuflw_1<mask_name>"
13338 [(set (match_operand:V16HI 0 "register_operand" "=v")
13340 (match_operand:V16HI 1 "nonimmediate_operand" "vm")
13341 (parallel [(match_operand 2 "const_0_to_3_operand")
13342 (match_operand 3 "const_0_to_3_operand")
13343 (match_operand 4 "const_0_to_3_operand")
13344 (match_operand 5 "const_0_to_3_operand")
13349 (match_operand 6 "const_8_to_11_operand")
13350 (match_operand 7 "const_8_to_11_operand")
13351 (match_operand 8 "const_8_to_11_operand")
13352 (match_operand 9 "const_8_to_11_operand")
13356 (const_int 15)])))]
13358 && <mask_avx512bw_condition> && <mask_avx512vl_condition>
13359 && INTVAL (operands[2]) + 8 == INTVAL (operands[6])
13360 && INTVAL (operands[3]) + 8 == INTVAL (operands[7])
13361 && INTVAL (operands[4]) + 8 == INTVAL (operands[8])
13362 && INTVAL (operands[5]) + 8 == INTVAL (operands[9])"
13365 mask |= INTVAL (operands[2]) << 0;
13366 mask |= INTVAL (operands[3]) << 2;
13367 mask |= INTVAL (operands[4]) << 4;
13368 mask |= INTVAL (operands[5]) << 6;
13369 operands[2] = GEN_INT (mask);
13371 return "vpshuflw\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
13373 [(set_attr "type" "sselog")
13374 (set_attr "prefix" "maybe_evex")
13375 (set_attr "length_immediate" "1")
13376 (set_attr "mode" "OI")])
13378 (define_expand "avx512vl_pshuflw_mask"
13379 [(match_operand:V8HI 0 "register_operand")
13380 (match_operand:V8HI 1 "nonimmediate_operand")
13381 (match_operand:SI 2 "const_0_to_255_operand")
13382 (match_operand:V8HI 3 "register_operand")
13383 (match_operand:QI 4 "register_operand")]
13384 "TARGET_AVX512VL && TARGET_AVX512BW"
13386 int mask = INTVAL (operands[2]);
13387 emit_insn (gen_sse2_pshuflw_1_mask (operands[0], operands[1],
13388 GEN_INT ((mask >> 0) & 3),
13389 GEN_INT ((mask >> 2) & 3),
13390 GEN_INT ((mask >> 4) & 3),
13391 GEN_INT ((mask >> 6) & 3),
13392 operands[3], operands[4]));
13396 (define_expand "sse2_pshuflw"
13397 [(match_operand:V8HI 0 "register_operand")
13398 (match_operand:V8HI 1 "vector_operand")
13399 (match_operand:SI 2 "const_int_operand")]
13402 int mask = INTVAL (operands[2]);
13403 emit_insn (gen_sse2_pshuflw_1 (operands[0], operands[1],
13404 GEN_INT ((mask >> 0) & 3),
13405 GEN_INT ((mask >> 2) & 3),
13406 GEN_INT ((mask >> 4) & 3),
13407 GEN_INT ((mask >> 6) & 3)));
13411 (define_insn "sse2_pshuflw_1<mask_name>"
13412 [(set (match_operand:V8HI 0 "register_operand" "=v")
13414 (match_operand:V8HI 1 "vector_operand" "vBm")
13415 (parallel [(match_operand 2 "const_0_to_3_operand")
13416 (match_operand 3 "const_0_to_3_operand")
13417 (match_operand 4 "const_0_to_3_operand")
13418 (match_operand 5 "const_0_to_3_operand")
13423 "TARGET_SSE2 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
13426 mask |= INTVAL (operands[2]) << 0;
13427 mask |= INTVAL (operands[3]) << 2;
13428 mask |= INTVAL (operands[4]) << 4;
13429 mask |= INTVAL (operands[5]) << 6;
13430 operands[2] = GEN_INT (mask);
13432 return "%vpshuflw\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
13434 [(set_attr "type" "sselog")
13435 (set_attr "prefix_data16" "0")
13436 (set_attr "prefix_rep" "1")
13437 (set_attr "prefix" "maybe_vex")
13438 (set_attr "length_immediate" "1")
13439 (set_attr "mode" "TI")])
13441 (define_expand "avx2_pshufhwv3"
13442 [(match_operand:V16HI 0 "register_operand")
13443 (match_operand:V16HI 1 "nonimmediate_operand")
13444 (match_operand:SI 2 "const_0_to_255_operand")]
13447 int mask = INTVAL (operands[2]);
13448 emit_insn (gen_avx2_pshufhw_1 (operands[0], operands[1],
13449 GEN_INT (((mask >> 0) & 3) + 4),
13450 GEN_INT (((mask >> 2) & 3) + 4),
13451 GEN_INT (((mask >> 4) & 3) + 4),
13452 GEN_INT (((mask >> 6) & 3) + 4),
13453 GEN_INT (((mask >> 0) & 3) + 12),
13454 GEN_INT (((mask >> 2) & 3) + 12),
13455 GEN_INT (((mask >> 4) & 3) + 12),
13456 GEN_INT (((mask >> 6) & 3) + 12)));
13460 (define_insn "<mask_codefor>avx512bw_pshufhwv32hi<mask_name>"
13461 [(set (match_operand:V32HI 0 "register_operand" "=v")
13463 [(match_operand:V32HI 1 "nonimmediate_operand" "vm")
13464 (match_operand:SI 2 "const_0_to_255_operand" "n")]
13467 "vpshufhw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13468 [(set_attr "type" "sselog")
13469 (set_attr "prefix" "evex")
13470 (set_attr "mode" "XI")])
13472 (define_expand "avx512vl_pshufhwv3_mask"
13473 [(match_operand:V16HI 0 "register_operand")
13474 (match_operand:V16HI 1 "nonimmediate_operand")
13475 (match_operand:SI 2 "const_0_to_255_operand")
13476 (match_operand:V16HI 3 "register_operand")
13477 (match_operand:HI 4 "register_operand")]
13478 "TARGET_AVX512VL && TARGET_AVX512BW"
13480 int mask = INTVAL (operands[2]);
13481 emit_insn (gen_avx2_pshufhw_1_mask (operands[0], operands[1],
13482 GEN_INT (((mask >> 0) & 3) + 4),
13483 GEN_INT (((mask >> 2) & 3) + 4),
13484 GEN_INT (((mask >> 4) & 3) + 4),
13485 GEN_INT (((mask >> 6) & 3) + 4),
13486 GEN_INT (((mask >> 0) & 3) + 12),
13487 GEN_INT (((mask >> 2) & 3) + 12),
13488 GEN_INT (((mask >> 4) & 3) + 12),
13489 GEN_INT (((mask >> 6) & 3) + 12),
13490 operands[3], operands[4]));
13494 (define_insn "avx2_pshufhw_1<mask_name>"
13495 [(set (match_operand:V16HI 0 "register_operand" "=v")
13497 (match_operand:V16HI 1 "nonimmediate_operand" "vm")
13498 (parallel [(const_int 0)
13502 (match_operand 2 "const_4_to_7_operand")
13503 (match_operand 3 "const_4_to_7_operand")
13504 (match_operand 4 "const_4_to_7_operand")
13505 (match_operand 5 "const_4_to_7_operand")
13510 (match_operand 6 "const_12_to_15_operand")
13511 (match_operand 7 "const_12_to_15_operand")
13512 (match_operand 8 "const_12_to_15_operand")
13513 (match_operand 9 "const_12_to_15_operand")])))]
13515 && <mask_avx512bw_condition> && <mask_avx512vl_condition>
13516 && INTVAL (operands[2]) + 8 == INTVAL (operands[6])
13517 && INTVAL (operands[3]) + 8 == INTVAL (operands[7])
13518 && INTVAL (operands[4]) + 8 == INTVAL (operands[8])
13519 && INTVAL (operands[5]) + 8 == INTVAL (operands[9])"
13522 mask |= (INTVAL (operands[2]) - 4) << 0;
13523 mask |= (INTVAL (operands[3]) - 4) << 2;
13524 mask |= (INTVAL (operands[4]) - 4) << 4;
13525 mask |= (INTVAL (operands[5]) - 4) << 6;
13526 operands[2] = GEN_INT (mask);
13528 return "vpshufhw\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
13530 [(set_attr "type" "sselog")
13531 (set_attr "prefix" "maybe_evex")
13532 (set_attr "length_immediate" "1")
13533 (set_attr "mode" "OI")])
13535 (define_expand "avx512vl_pshufhw_mask"
13536 [(match_operand:V8HI 0 "register_operand")
13537 (match_operand:V8HI 1 "nonimmediate_operand")
13538 (match_operand:SI 2 "const_0_to_255_operand")
13539 (match_operand:V8HI 3 "register_operand")
13540 (match_operand:QI 4 "register_operand")]
13541 "TARGET_AVX512VL && TARGET_AVX512BW"
13543 int mask = INTVAL (operands[2]);
13544 emit_insn (gen_sse2_pshufhw_1_mask (operands[0], operands[1],
13545 GEN_INT (((mask >> 0) & 3) + 4),
13546 GEN_INT (((mask >> 2) & 3) + 4),
13547 GEN_INT (((mask >> 4) & 3) + 4),
13548 GEN_INT (((mask >> 6) & 3) + 4),
13549 operands[3], operands[4]));
13553 (define_expand "sse2_pshufhw"
13554 [(match_operand:V8HI 0 "register_operand")
13555 (match_operand:V8HI 1 "vector_operand")
13556 (match_operand:SI 2 "const_int_operand")]
13559 int mask = INTVAL (operands[2]);
13560 emit_insn (gen_sse2_pshufhw_1 (operands[0], operands[1],
13561 GEN_INT (((mask >> 0) & 3) + 4),
13562 GEN_INT (((mask >> 2) & 3) + 4),
13563 GEN_INT (((mask >> 4) & 3) + 4),
13564 GEN_INT (((mask >> 6) & 3) + 4)));
13568 (define_insn "sse2_pshufhw_1<mask_name>"
13569 [(set (match_operand:V8HI 0 "register_operand" "=v")
13571 (match_operand:V8HI 1 "vector_operand" "vBm")
13572 (parallel [(const_int 0)
13576 (match_operand 2 "const_4_to_7_operand")
13577 (match_operand 3 "const_4_to_7_operand")
13578 (match_operand 4 "const_4_to_7_operand")
13579 (match_operand 5 "const_4_to_7_operand")])))]
13580 "TARGET_SSE2 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
13583 mask |= (INTVAL (operands[2]) - 4) << 0;
13584 mask |= (INTVAL (operands[3]) - 4) << 2;
13585 mask |= (INTVAL (operands[4]) - 4) << 4;
13586 mask |= (INTVAL (operands[5]) - 4) << 6;
13587 operands[2] = GEN_INT (mask);
13589 return "%vpshufhw\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
13591 [(set_attr "type" "sselog")
13592 (set_attr "prefix_rep" "1")
13593 (set_attr "prefix_data16" "0")
13594 (set_attr "prefix" "maybe_vex")
13595 (set_attr "length_immediate" "1")
13596 (set_attr "mode" "TI")])
13598 (define_expand "sse2_loadd"
13599 [(set (match_operand:V4SI 0 "register_operand")
13601 (vec_duplicate:V4SI
13602 (match_operand:SI 1 "nonimmediate_operand"))
13606 "operands[2] = CONST0_RTX (V4SImode);")
13608 (define_insn "sse2_loadld"
13609 [(set (match_operand:V4SI 0 "register_operand" "=v,Yi,x,x,v")
13611 (vec_duplicate:V4SI
13612 (match_operand:SI 2 "nonimmediate_operand" "m ,r ,m,x,v"))
13613 (match_operand:V4SI 1 "reg_or_0_operand" "C ,C ,C,0,v")
13617 %vmovd\t{%2, %0|%0, %2}
13618 %vmovd\t{%2, %0|%0, %2}
13619 movss\t{%2, %0|%0, %2}
13620 movss\t{%2, %0|%0, %2}
13621 vmovss\t{%2, %1, %0|%0, %1, %2}"
13622 [(set_attr "isa" "sse2,sse2,noavx,noavx,avx")
13623 (set_attr "type" "ssemov")
13624 (set_attr "prefix" "maybe_vex,maybe_vex,orig,orig,maybe_evex")
13625 (set_attr "mode" "TI,TI,V4SF,SF,SF")])
13627 ;; QI and HI modes handled by pextr patterns.
13628 (define_mode_iterator PEXTR_MODE12
13629 [(V16QI "TARGET_SSE4_1") V8HI])
13631 (define_insn "*vec_extract<mode>"
13632 [(set (match_operand:<ssescalarmode> 0 "register_sse4nonimm_operand" "=r,m,r,m")
13633 (vec_select:<ssescalarmode>
13634 (match_operand:PEXTR_MODE12 1 "register_operand" "x,x,v,v")
13636 [(match_operand:SI 2 "const_0_to_<ssescalarnummask>_operand")])))]
13639 %vpextr<ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}
13640 %vpextr<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
13641 vpextr<ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}
13642 vpextr<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
13643 [(set_attr "isa" "*,sse4,avx512bw,avx512bw")
13644 (set_attr "type" "sselog1")
13645 (set_attr "prefix_data16" "1")
13646 (set (attr "prefix_extra")
13648 (and (eq_attr "alternative" "0,2")
13649 (eq (const_string "<MODE>mode") (const_string "V8HImode")))
13651 (const_string "1")))
13652 (set_attr "length_immediate" "1")
13653 (set_attr "prefix" "maybe_vex,maybe_vex,evex,evex")
13654 (set_attr "mode" "TI")])
13656 (define_insn "*vec_extract<PEXTR_MODE12:mode>_zext"
13657 [(set (match_operand:SWI48 0 "register_operand" "=r,r")
13659 (vec_select:<PEXTR_MODE12:ssescalarmode>
13660 (match_operand:PEXTR_MODE12 1 "register_operand" "x,v")
13662 [(match_operand:SI 2
13663 "const_0_to_<PEXTR_MODE12:ssescalarnummask>_operand")]))))]
13666 %vpextr<PEXTR_MODE12:ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}
13667 vpextr<PEXTR_MODE12:ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}"
13668 [(set_attr "isa" "*,avx512bw")
13669 (set_attr "type" "sselog1")
13670 (set_attr "prefix_data16" "1")
13671 (set (attr "prefix_extra")
13673 (eq (const_string "<PEXTR_MODE12:MODE>mode") (const_string "V8HImode"))
13675 (const_string "1")))
13676 (set_attr "length_immediate" "1")
13677 (set_attr "prefix" "maybe_vex")
13678 (set_attr "mode" "TI")])
13680 (define_insn "*vec_extract<mode>_mem"
13681 [(set (match_operand:<ssescalarmode> 0 "register_operand" "=r")
13682 (vec_select:<ssescalarmode>
13683 (match_operand:VI12_128 1 "memory_operand" "o")
13685 [(match_operand 2 "const_0_to_<ssescalarnummask>_operand")])))]
13689 (define_insn "*vec_extract<ssevecmodelower>_0"
13690 [(set (match_operand:SWI48 0 "nonimmediate_operand" "=r ,v ,m")
13692 (match_operand:<ssevecmode> 1 "nonimmediate_operand" "mYj,vm,v")
13693 (parallel [(const_int 0)])))]
13694 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
13697 (define_insn "*vec_extractv2di_0_sse"
13698 [(set (match_operand:DI 0 "nonimmediate_operand" "=v,m")
13700 (match_operand:V2DI 1 "nonimmediate_operand" "vm,v")
13701 (parallel [(const_int 0)])))]
13702 "TARGET_SSE && !TARGET_64BIT
13703 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
13707 [(set (match_operand:SWI48x 0 "nonimmediate_operand")
13709 (match_operand:<ssevecmode> 1 "register_operand")
13710 (parallel [(const_int 0)])))]
13711 "TARGET_SSE && reload_completed"
13712 [(set (match_dup 0) (match_dup 1))]
13713 "operands[1] = gen_lowpart (<MODE>mode, operands[1]);")
13715 (define_insn "*vec_extractv4si_0_zext_sse4"
13716 [(set (match_operand:DI 0 "register_operand" "=r,x,v")
13719 (match_operand:V4SI 1 "register_operand" "Yj,x,v")
13720 (parallel [(const_int 0)]))))]
13723 [(set_attr "isa" "x64,*,avx512f")])
13725 (define_insn "*vec_extractv4si_0_zext"
13726 [(set (match_operand:DI 0 "register_operand" "=r")
13729 (match_operand:V4SI 1 "register_operand" "x")
13730 (parallel [(const_int 0)]))))]
13731 "TARGET_64BIT && TARGET_SSE2 && TARGET_INTER_UNIT_MOVES_FROM_VEC"
13735 [(set (match_operand:DI 0 "register_operand")
13738 (match_operand:V4SI 1 "register_operand")
13739 (parallel [(const_int 0)]))))]
13740 "TARGET_SSE2 && reload_completed"
13741 [(set (match_dup 0) (zero_extend:DI (match_dup 1)))]
13742 "operands[1] = gen_lowpart (SImode, operands[1]);")
13744 (define_insn "*vec_extractv4si"
13745 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,rm,Yr,*x,x,Yv")
13747 (match_operand:V4SI 1 "register_operand" "x,v,0,0,x,v")
13748 (parallel [(match_operand:SI 2 "const_0_to_3_operand")])))]
13751 switch (which_alternative)
13755 return "%vpextrd\t{%2, %1, %0|%0, %1, %2}";
13759 operands[2] = GEN_INT (INTVAL (operands[2]) * 4);
13760 return "psrldq\t{%2, %0|%0, %2}";
13764 operands[2] = GEN_INT (INTVAL (operands[2]) * 4);
13765 return "vpsrldq\t{%2, %1, %0|%0, %1, %2}";
13768 gcc_unreachable ();
13771 [(set_attr "isa" "*,avx512dq,noavx,noavx,avx,avx512bw")
13772 (set_attr "type" "sselog1,sselog1,sseishft1,sseishft1,sseishft1,sseishft1")
13773 (set (attr "prefix_extra")
13774 (if_then_else (eq_attr "alternative" "0,1")
13776 (const_string "*")))
13777 (set_attr "length_immediate" "1")
13778 (set_attr "prefix" "maybe_vex,evex,orig,orig,vex,evex")
13779 (set_attr "mode" "TI")])
13781 (define_insn "*vec_extractv4si_zext"
13782 [(set (match_operand:DI 0 "register_operand" "=r,r")
13785 (match_operand:V4SI 1 "register_operand" "x,v")
13786 (parallel [(match_operand:SI 2 "const_0_to_3_operand")]))))]
13787 "TARGET_64BIT && TARGET_SSE4_1"
13788 "%vpextrd\t{%2, %1, %k0|%k0, %1, %2}"
13789 [(set_attr "isa" "*,avx512dq")
13790 (set_attr "type" "sselog1")
13791 (set_attr "prefix_extra" "1")
13792 (set_attr "length_immediate" "1")
13793 (set_attr "prefix" "maybe_vex")
13794 (set_attr "mode" "TI")])
13796 (define_insn "*vec_extractv4si_mem"
13797 [(set (match_operand:SI 0 "register_operand" "=x,r")
13799 (match_operand:V4SI 1 "memory_operand" "o,o")
13800 (parallel [(match_operand 2 "const_0_to_3_operand")])))]
13804 (define_insn_and_split "*vec_extractv4si_zext_mem"
13805 [(set (match_operand:DI 0 "register_operand" "=x,r")
13808 (match_operand:V4SI 1 "memory_operand" "o,o")
13809 (parallel [(match_operand:SI 2 "const_0_to_3_operand")]))))]
13810 "TARGET_64BIT && TARGET_SSE"
13812 "&& reload_completed"
13813 [(set (match_dup 0) (zero_extend:DI (match_dup 1)))]
13815 operands[1] = adjust_address (operands[1], SImode, INTVAL (operands[2]) * 4);
13818 (define_insn "*vec_extractv2di_1"
13819 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,rm,m,x,x,Yv,x,v,r")
13821 (match_operand:V2DI 1 "nonimmediate_operand" "x ,v ,v,0,x, v,x,o,o")
13822 (parallel [(const_int 1)])))]
13823 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
13825 %vpextrq\t{$1, %1, %0|%0, %1, 1}
13826 vpextrq\t{$1, %1, %0|%0, %1, 1}
13827 %vmovhps\t{%1, %0|%0, %1}
13828 psrldq\t{$8, %0|%0, 8}
13829 vpsrldq\t{$8, %1, %0|%0, %1, 8}
13830 vpsrldq\t{$8, %1, %0|%0, %1, 8}
13831 movhlps\t{%1, %0|%0, %1}
13835 (cond [(eq_attr "alternative" "0")
13836 (const_string "x64_sse4")
13837 (eq_attr "alternative" "1")
13838 (const_string "x64_avx512dq")
13839 (eq_attr "alternative" "3")
13840 (const_string "sse2_noavx")
13841 (eq_attr "alternative" "4")
13842 (const_string "avx")
13843 (eq_attr "alternative" "5")
13844 (const_string "avx512bw")
13845 (eq_attr "alternative" "6")
13846 (const_string "noavx")
13847 (eq_attr "alternative" "8")
13848 (const_string "x64")
13850 (const_string "*")))
13852 (cond [(eq_attr "alternative" "2,6,7")
13853 (const_string "ssemov")
13854 (eq_attr "alternative" "3,4,5")
13855 (const_string "sseishft1")
13856 (eq_attr "alternative" "8")
13857 (const_string "imov")
13859 (const_string "sselog1")))
13860 (set (attr "length_immediate")
13861 (if_then_else (eq_attr "alternative" "0,1,3,4,5")
13863 (const_string "*")))
13864 (set (attr "prefix_rex")
13865 (if_then_else (eq_attr "alternative" "0,1")
13867 (const_string "*")))
13868 (set (attr "prefix_extra")
13869 (if_then_else (eq_attr "alternative" "0,1")
13871 (const_string "*")))
13872 (set_attr "prefix" "maybe_vex,evex,maybe_vex,orig,vex,evex,orig,*,*")
13873 (set_attr "mode" "TI,TI,V2SF,TI,TI,TI,V4SF,DI,DI")])
13876 [(set (match_operand:<ssescalarmode> 0 "register_operand")
13877 (vec_select:<ssescalarmode>
13878 (match_operand:VI_128 1 "memory_operand")
13880 [(match_operand 2 "const_0_to_<ssescalarnummask>_operand")])))]
13881 "TARGET_SSE && reload_completed"
13882 [(set (match_dup 0) (match_dup 1))]
13884 int offs = INTVAL (operands[2]) * GET_MODE_SIZE (<ssescalarmode>mode);
13886 operands[1] = adjust_address (operands[1], <ssescalarmode>mode, offs);
13889 (define_insn "*vec_extractv2ti"
13890 [(set (match_operand:TI 0 "nonimmediate_operand" "=xm,vm")
13892 (match_operand:V2TI 1 "register_operand" "x,v")
13894 [(match_operand:SI 2 "const_0_to_1_operand")])))]
13897 vextract%~128\t{%2, %1, %0|%0, %1, %2}
13898 vextracti32x4\t{%2, %g1, %0|%0, %g1, %2}"
13899 [(set_attr "type" "sselog")
13900 (set_attr "prefix_extra" "1")
13901 (set_attr "length_immediate" "1")
13902 (set_attr "prefix" "vex,evex")
13903 (set_attr "mode" "OI")])
13905 (define_insn "*vec_extractv4ti"
13906 [(set (match_operand:TI 0 "nonimmediate_operand" "=vm")
13908 (match_operand:V4TI 1 "register_operand" "v")
13910 [(match_operand:SI 2 "const_0_to_3_operand")])))]
13912 "vextracti32x4\t{%2, %1, %0|%0, %1, %2}"
13913 [(set_attr "type" "sselog")
13914 (set_attr "prefix_extra" "1")
13915 (set_attr "length_immediate" "1")
13916 (set_attr "prefix" "evex")
13917 (set_attr "mode" "XI")])
13919 (define_mode_iterator VEXTRACTI128_MODE
13920 [(V4TI "TARGET_AVX512F") V2TI])
13923 [(set (match_operand:TI 0 "nonimmediate_operand")
13925 (match_operand:VEXTRACTI128_MODE 1 "register_operand")
13926 (parallel [(const_int 0)])))]
13928 && reload_completed
13929 && (TARGET_AVX512VL || !EXT_REX_SSE_REG_P (operands[1]))"
13930 [(set (match_dup 0) (match_dup 1))]
13931 "operands[1] = gen_lowpart (TImode, operands[1]);")
13933 ;; Turn SImode or DImode extraction from arbitrary SSE/AVX/AVX512F
13934 ;; vector modes into vec_extract*.
13936 [(set (match_operand:SWI48x 0 "nonimmediate_operand")
13937 (subreg:SWI48x (match_operand 1 "register_operand") 0))]
13938 "can_create_pseudo_p ()
13939 && REG_P (operands[1])
13940 && VECTOR_MODE_P (GET_MODE (operands[1]))
13941 && ((TARGET_SSE && GET_MODE_SIZE (GET_MODE (operands[1])) == 16)
13942 || (TARGET_AVX && GET_MODE_SIZE (GET_MODE (operands[1])) == 32)
13943 || (TARGET_AVX512F && GET_MODE_SIZE (GET_MODE (operands[1])) == 64))
13944 && (<MODE>mode == SImode || TARGET_64BIT || MEM_P (operands[0]))"
13945 [(set (match_dup 0) (vec_select:SWI48x (match_dup 1)
13946 (parallel [(const_int 0)])))]
13950 switch (GET_MODE_SIZE (GET_MODE (operands[1])))
13953 if (<MODE>mode == SImode)
13955 tmp = gen_reg_rtx (V8SImode);
13956 emit_insn (gen_vec_extract_lo_v16si (tmp,
13957 gen_lowpart (V16SImode,
13962 tmp = gen_reg_rtx (V4DImode);
13963 emit_insn (gen_vec_extract_lo_v8di (tmp,
13964 gen_lowpart (V8DImode,
13970 tmp = gen_reg_rtx (<ssevecmode>mode);
13971 if (<MODE>mode == SImode)
13972 emit_insn (gen_vec_extract_lo_v8si (tmp, gen_lowpart (V8SImode,
13975 emit_insn (gen_vec_extract_lo_v4di (tmp, gen_lowpart (V4DImode,
13980 operands[1] = gen_lowpart (<ssevecmode>mode, operands[1]);
13985 (define_insn "*vec_concatv2si_sse4_1"
13986 [(set (match_operand:V2SI 0 "register_operand"
13987 "=Yr,*x, x, v,Yr,*x, v, v, *y,*y")
13989 (match_operand:SI 1 "nonimmediate_operand"
13990 " 0, 0, x,Yv, 0, 0,Yv,rm, 0,rm")
13991 (match_operand:SI 2 "vector_move_operand"
13992 " rm,rm,rm,rm,Yr,*x,Yv, C,*ym, C")))]
13993 "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
13995 pinsrd\t{$1, %2, %0|%0, %2, 1}
13996 pinsrd\t{$1, %2, %0|%0, %2, 1}
13997 vpinsrd\t{$1, %2, %1, %0|%0, %1, %2, 1}
13998 vpinsrd\t{$1, %2, %1, %0|%0, %1, %2, 1}
13999 punpckldq\t{%2, %0|%0, %2}
14000 punpckldq\t{%2, %0|%0, %2}
14001 vpunpckldq\t{%2, %1, %0|%0, %1, %2}
14002 %vmovd\t{%1, %0|%0, %1}
14003 punpckldq\t{%2, %0|%0, %2}
14004 movd\t{%1, %0|%0, %1}"
14005 [(set_attr "isa" "noavx,noavx,avx,avx512dq,noavx,noavx,avx,*,*,*")
14007 (cond [(eq_attr "alternative" "7")
14008 (const_string "ssemov")
14009 (eq_attr "alternative" "8")
14010 (const_string "mmxcvt")
14011 (eq_attr "alternative" "9")
14012 (const_string "mmxmov")
14014 (const_string "sselog")))
14015 (set (attr "prefix_extra")
14016 (if_then_else (eq_attr "alternative" "0,1,2,3")
14018 (const_string "*")))
14019 (set (attr "length_immediate")
14020 (if_then_else (eq_attr "alternative" "0,1,2,3")
14022 (const_string "*")))
14023 (set_attr "prefix" "orig,orig,vex,evex,orig,orig,maybe_evex,maybe_vex,orig,orig")
14024 (set_attr "mode" "TI,TI,TI,TI,TI,TI,TI,TI,DI,DI")])
14026 ;; ??? In theory we can match memory for the MMX alternative, but allowing
14027 ;; nonimmediate_operand for operand 2 and *not* allowing memory for the SSE
14028 ;; alternatives pretty much forces the MMX alternative to be chosen.
14029 (define_insn "*vec_concatv2si"
14030 [(set (match_operand:V2SI 0 "register_operand" "=x,x ,*y,x,x,*y,*y")
14032 (match_operand:SI 1 "nonimmediate_operand" " 0,rm,rm,0,m, 0,*rm")
14033 (match_operand:SI 2 "reg_or_0_operand" " x,C ,C, x,C,*y,C")))]
14034 "TARGET_SSE && !TARGET_SSE4_1"
14036 punpckldq\t{%2, %0|%0, %2}
14037 movd\t{%1, %0|%0, %1}
14038 movd\t{%1, %0|%0, %1}
14039 unpcklps\t{%2, %0|%0, %2}
14040 movss\t{%1, %0|%0, %1}
14041 punpckldq\t{%2, %0|%0, %2}
14042 movd\t{%1, %0|%0, %1}"
14043 [(set_attr "isa" "sse2,sse2,sse2,*,*,*,*")
14044 (set_attr "type" "sselog,ssemov,mmxmov,sselog,ssemov,mmxcvt,mmxmov")
14045 (set_attr "mode" "TI,TI,DI,V4SF,SF,DI,DI")])
14047 (define_insn "*vec_concatv4si"
14048 [(set (match_operand:V4SI 0 "register_operand" "=x,v,x,x,v")
14050 (match_operand:V2SI 1 "register_operand" " 0,v,0,0,v")
14051 (match_operand:V2SI 2 "nonimmediate_operand" " x,v,x,m,m")))]
14054 punpcklqdq\t{%2, %0|%0, %2}
14055 vpunpcklqdq\t{%2, %1, %0|%0, %1, %2}
14056 movlhps\t{%2, %0|%0, %2}
14057 movhps\t{%2, %0|%0, %q2}
14058 vmovhps\t{%2, %1, %0|%0, %1, %q2}"
14059 [(set_attr "isa" "sse2_noavx,avx,noavx,noavx,avx")
14060 (set_attr "type" "sselog,sselog,ssemov,ssemov,ssemov")
14061 (set_attr "prefix" "orig,maybe_evex,orig,orig,maybe_evex")
14062 (set_attr "mode" "TI,TI,V4SF,V2SF,V2SF")])
14064 ;; movd instead of movq is required to handle broken assemblers.
14065 (define_insn "vec_concatv2di"
14066 [(set (match_operand:V2DI 0 "register_operand"
14067 "=Yr,*x,x ,v ,Yi,v ,x ,x,v ,x,x,v")
14069 (match_operand:DI 1 "nonimmediate_operand"
14070 " 0, 0,x ,Yv,r ,vm,?!*Yn,0,Yv,0,0,v")
14071 (match_operand:DI 2 "vector_move_operand"
14072 " rm,rm,rm,rm,C ,C ,C ,x,Yv,x,m,m")))]
14075 pinsrq\t{$1, %2, %0|%0, %2, 1}
14076 pinsrq\t{$1, %2, %0|%0, %2, 1}
14077 vpinsrq\t{$1, %2, %1, %0|%0, %1, %2, 1}
14078 vpinsrq\t{$1, %2, %1, %0|%0, %1, %2, 1}
14079 * return HAVE_AS_IX86_INTERUNIT_MOVQ ? \"%vmovq\t{%1, %0|%0, %1}\" : \"%vmovd\t{%1, %0|%0, %1}\";
14080 %vmovq\t{%1, %0|%0, %1}
14081 movq2dq\t{%1, %0|%0, %1}
14082 punpcklqdq\t{%2, %0|%0, %2}
14083 vpunpcklqdq\t{%2, %1, %0|%0, %1, %2}
14084 movlhps\t{%2, %0|%0, %2}
14085 movhps\t{%2, %0|%0, %2}
14086 vmovhps\t{%2, %1, %0|%0, %1, %2}"
14088 (cond [(eq_attr "alternative" "0,1")
14089 (const_string "x64_sse4_noavx")
14090 (eq_attr "alternative" "2")
14091 (const_string "x64_avx")
14092 (eq_attr "alternative" "3")
14093 (const_string "x64_avx512dq")
14094 (eq_attr "alternative" "4")
14095 (const_string "x64")
14096 (eq_attr "alternative" "5,6")
14097 (const_string "sse2")
14098 (eq_attr "alternative" "7")
14099 (const_string "sse2_noavx")
14100 (eq_attr "alternative" "8,11")
14101 (const_string "avx")
14103 (const_string "noavx")))
14106 (eq_attr "alternative" "0,1,2,3,7,8")
14107 (const_string "sselog")
14108 (const_string "ssemov")))
14109 (set (attr "prefix_rex")
14110 (if_then_else (eq_attr "alternative" "0,1,2,3,4")
14112 (const_string "*")))
14113 (set (attr "prefix_extra")
14114 (if_then_else (eq_attr "alternative" "0,1,2,3")
14116 (const_string "*")))
14117 (set (attr "length_immediate")
14118 (if_then_else (eq_attr "alternative" "0,1,2,3")
14120 (const_string "*")))
14121 (set (attr "prefix")
14122 (cond [(eq_attr "alternative" "2")
14123 (const_string "vex")
14124 (eq_attr "alternative" "3")
14125 (const_string "evex")
14126 (eq_attr "alternative" "4,5")
14127 (const_string "maybe_vex")
14128 (eq_attr "alternative" "8,11")
14129 (const_string "maybe_evex")
14131 (const_string "orig")))
14132 (set_attr "mode" "TI,TI,TI,TI,TI,TI,TI,TI,TI,V4SF,V2SF,V2SF")])
14134 ;; vmovq clears also the higher bits.
14135 (define_insn "vec_set<mode>_0"
14136 [(set (match_operand:VI8_AVX_AVX512F 0 "register_operand" "=Yi,v")
14137 (vec_merge:VI8_AVX_AVX512F
14138 (vec_duplicate:VI8_AVX_AVX512F
14139 (match_operand:<ssescalarmode> 2 "general_operand" "r,vm"))
14140 (match_operand:VI8_AVX_AVX512F 1 "const0_operand" "C,C")
14143 "vmovq\t{%2, %x0|%x0, %2}"
14144 [(set_attr "isa" "x64,*")
14145 (set_attr "type" "ssemov")
14146 (set_attr "prefix_rex" "1,*")
14147 (set_attr "prefix" "maybe_evex")
14148 (set_attr "mode" "TI")])
14150 (define_expand "vec_unpacks_lo_<mode>"
14151 [(match_operand:<sseunpackmode> 0 "register_operand")
14152 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
14154 "ix86_expand_sse_unpack (operands[0], operands[1], false, false); DONE;")
14156 (define_expand "vec_unpacks_hi_<mode>"
14157 [(match_operand:<sseunpackmode> 0 "register_operand")
14158 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
14160 "ix86_expand_sse_unpack (operands[0], operands[1], false, true); DONE;")
14162 (define_expand "vec_unpacku_lo_<mode>"
14163 [(match_operand:<sseunpackmode> 0 "register_operand")
14164 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
14166 "ix86_expand_sse_unpack (operands[0], operands[1], true, false); DONE;")
14168 (define_expand "vec_unpacks_lo_hi"
14169 [(set (subreg:HI (match_operand:QI 0 "register_operand") 0)
14170 (match_operand:HI 1 "register_operand"))]
14173 (define_expand "vec_unpacks_lo_si"
14174 [(set (match_operand:HI 0 "register_operand")
14175 (subreg:HI (match_operand:SI 1 "register_operand") 0))]
14178 (define_expand "vec_unpacks_lo_di"
14179 [(set (match_operand:SI 0 "register_operand")
14180 (subreg:SI (match_operand:DI 1 "register_operand") 0))]
14183 (define_expand "vec_unpacku_hi_<mode>"
14184 [(match_operand:<sseunpackmode> 0 "register_operand")
14185 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
14187 "ix86_expand_sse_unpack (operands[0], operands[1], true, true); DONE;")
14189 (define_expand "vec_unpacks_hi_hi"
14191 [(set (subreg:HI (match_operand:QI 0 "register_operand") 0)
14192 (lshiftrt:HI (match_operand:HI 1 "register_operand")
14194 (unspec [(const_int 0)] UNSPEC_MASKOP)])]
14197 (define_expand "vec_unpacks_hi_<mode>"
14199 [(set (subreg:SWI48x
14200 (match_operand:<HALFMASKMODE> 0 "register_operand") 0)
14201 (lshiftrt:SWI48x (match_operand:SWI48x 1 "register_operand")
14203 (unspec [(const_int 0)] UNSPEC_MASKOP)])]
14205 "operands[2] = GEN_INT (GET_MODE_BITSIZE (<HALFMASKMODE>mode));")
14207 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14211 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14213 (define_expand "<sse2_avx2>_uavg<mode>3<mask_name>"
14214 [(set (match_operand:VI12_AVX2 0 "register_operand")
14215 (truncate:VI12_AVX2
14216 (lshiftrt:<ssedoublemode>
14217 (plus:<ssedoublemode>
14218 (plus:<ssedoublemode>
14219 (zero_extend:<ssedoublemode>
14220 (match_operand:VI12_AVX2 1 "vector_operand"))
14221 (zero_extend:<ssedoublemode>
14222 (match_operand:VI12_AVX2 2 "vector_operand")))
14223 (match_dup <mask_expand_op3>))
14225 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
14228 if (<mask_applied>)
14230 operands[3] = CONST1_RTX(<MODE>mode);
14231 ix86_fixup_binary_operands_no_copy (PLUS, <MODE>mode, operands);
14233 if (<mask_applied>)
14235 operands[5] = operands[3];
14240 (define_insn "*<sse2_avx2>_uavg<mode>3<mask_name>"
14241 [(set (match_operand:VI12_AVX2 0 "register_operand" "=x,v")
14242 (truncate:VI12_AVX2
14243 (lshiftrt:<ssedoublemode>
14244 (plus:<ssedoublemode>
14245 (plus:<ssedoublemode>
14246 (zero_extend:<ssedoublemode>
14247 (match_operand:VI12_AVX2 1 "vector_operand" "%0,v"))
14248 (zero_extend:<ssedoublemode>
14249 (match_operand:VI12_AVX2 2 "vector_operand" "xBm,vm")))
14250 (match_operand:VI12_AVX2 <mask_expand_op3> "const1_operand"))
14252 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>
14253 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
14255 pavg<ssemodesuffix>\t{%2, %0|%0, %2}
14256 vpavg<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
14257 [(set_attr "isa" "noavx,avx")
14258 (set_attr "type" "sseiadd")
14259 (set_attr "prefix_data16" "1,*")
14260 (set_attr "prefix" "orig,<mask_prefix>")
14261 (set_attr "mode" "<sseinsnmode>")])
14263 ;; The correct representation for this is absolutely enormous, and
14264 ;; surely not generally useful.
14265 (define_insn "<sse2_avx2>_psadbw"
14266 [(set (match_operand:VI8_AVX2_AVX512BW 0 "register_operand" "=x,v")
14267 (unspec:VI8_AVX2_AVX512BW
14268 [(match_operand:<ssebytemode> 1 "register_operand" "0,v")
14269 (match_operand:<ssebytemode> 2 "vector_operand" "xBm,vm")]
14273 psadbw\t{%2, %0|%0, %2}
14274 vpsadbw\t{%2, %1, %0|%0, %1, %2}"
14275 [(set_attr "isa" "noavx,avx")
14276 (set_attr "type" "sseiadd")
14277 (set_attr "atom_unit" "simul")
14278 (set_attr "prefix_data16" "1,*")
14279 (set_attr "prefix" "orig,maybe_evex")
14280 (set_attr "mode" "<sseinsnmode>")])
14282 (define_insn "<sse>_movmsk<ssemodesuffix><avxsizesuffix>"
14283 [(set (match_operand:SI 0 "register_operand" "=r")
14285 [(match_operand:VF_128_256 1 "register_operand" "x")]
14288 "%vmovmsk<ssemodesuffix>\t{%1, %0|%0, %1}"
14289 [(set_attr "type" "ssemov")
14290 (set_attr "prefix" "maybe_vex")
14291 (set_attr "mode" "<MODE>")])
14293 (define_insn "*<sse>_movmsk<ssemodesuffix><avxsizesuffix>_zext"
14294 [(set (match_operand:DI 0 "register_operand" "=r")
14297 [(match_operand:VF_128_256 1 "register_operand" "x")]
14299 "TARGET_64BIT && TARGET_SSE"
14300 "%vmovmsk<ssemodesuffix>\t{%1, %k0|%k0, %1}"
14301 [(set_attr "type" "ssemov")
14302 (set_attr "prefix" "maybe_vex")
14303 (set_attr "mode" "<MODE>")])
14305 (define_insn "<sse2_avx2>_pmovmskb"
14306 [(set (match_operand:SI 0 "register_operand" "=r")
14308 [(match_operand:VI1_AVX2 1 "register_operand" "x")]
14311 "%vpmovmskb\t{%1, %0|%0, %1}"
14312 [(set_attr "type" "ssemov")
14313 (set (attr "prefix_data16")
14315 (match_test "TARGET_AVX")
14317 (const_string "1")))
14318 (set_attr "prefix" "maybe_vex")
14319 (set_attr "mode" "SI")])
14321 (define_insn "*<sse2_avx2>_pmovmskb_zext"
14322 [(set (match_operand:DI 0 "register_operand" "=r")
14325 [(match_operand:VI1_AVX2 1 "register_operand" "x")]
14327 "TARGET_64BIT && TARGET_SSE2"
14328 "%vpmovmskb\t{%1, %k0|%k0, %1}"
14329 [(set_attr "type" "ssemov")
14330 (set (attr "prefix_data16")
14332 (match_test "TARGET_AVX")
14334 (const_string "1")))
14335 (set_attr "prefix" "maybe_vex")
14336 (set_attr "mode" "SI")])
14338 (define_expand "sse2_maskmovdqu"
14339 [(set (match_operand:V16QI 0 "memory_operand")
14340 (unspec:V16QI [(match_operand:V16QI 1 "register_operand")
14341 (match_operand:V16QI 2 "register_operand")
14346 (define_insn "*sse2_maskmovdqu"
14347 [(set (mem:V16QI (match_operand:P 0 "register_operand" "D"))
14348 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "x")
14349 (match_operand:V16QI 2 "register_operand" "x")
14350 (mem:V16QI (match_dup 0))]
14354 /* We can't use %^ here due to ASM_OUTPUT_OPCODE processing
14355 that requires %v to be at the beginning of the opcode name. */
14356 if (Pmode != word_mode)
14357 fputs ("\taddr32", asm_out_file);
14358 return "%vmaskmovdqu\t{%2, %1|%1, %2}";
14360 [(set_attr "type" "ssemov")
14361 (set_attr "prefix_data16" "1")
14362 (set (attr "length_address")
14363 (symbol_ref ("Pmode != word_mode")))
14364 ;; The implicit %rdi operand confuses default length_vex computation.
14365 (set (attr "length_vex")
14366 (symbol_ref ("3 + REX_SSE_REGNO_P (REGNO (operands[2]))")))
14367 (set_attr "prefix" "maybe_vex")
14368 (set_attr "znver1_decode" "vector")
14369 (set_attr "mode" "TI")])
14371 (define_insn "sse_ldmxcsr"
14372 [(unspec_volatile [(match_operand:SI 0 "memory_operand" "m")]
14376 [(set_attr "type" "sse")
14377 (set_attr "atom_sse_attr" "mxcsr")
14378 (set_attr "prefix" "maybe_vex")
14379 (set_attr "memory" "load")])
14381 (define_insn "sse_stmxcsr"
14382 [(set (match_operand:SI 0 "memory_operand" "=m")
14383 (unspec_volatile:SI [(const_int 0)] UNSPECV_STMXCSR))]
14386 [(set_attr "type" "sse")
14387 (set_attr "atom_sse_attr" "mxcsr")
14388 (set_attr "prefix" "maybe_vex")
14389 (set_attr "memory" "store")])
14391 (define_insn "sse2_clflush"
14392 [(unspec_volatile [(match_operand 0 "address_operand" "p")]
14396 [(set_attr "type" "sse")
14397 (set_attr "atom_sse_attr" "fence")
14398 (set_attr "memory" "unknown")])
14400 ;; As per AMD and Intel ISA manuals, the first operand is extensions
14401 ;; and it goes to %ecx. The second operand received is hints and it goes
14403 (define_insn "sse3_mwait"
14404 [(unspec_volatile [(match_operand:SI 0 "register_operand" "c")
14405 (match_operand:SI 1 "register_operand" "a")]
14408 ;; 64bit version is "mwait %rax,%rcx". But only lower 32bits are used.
14409 ;; Since 32bit register operands are implicitly zero extended to 64bit,
14410 ;; we only need to set up 32bit registers.
14412 [(set_attr "length" "3")])
14414 (define_insn "sse3_monitor_<mode>"
14415 [(unspec_volatile [(match_operand:P 0 "register_operand" "a")
14416 (match_operand:SI 1 "register_operand" "c")
14417 (match_operand:SI 2 "register_operand" "d")]
14420 ;; 64bit version is "monitor %rax,%rcx,%rdx". But only lower 32bits in
14421 ;; RCX and RDX are used. Since 32bit register operands are implicitly
14422 ;; zero extended to 64bit, we only need to set up 32bit registers.
14424 [(set (attr "length")
14425 (symbol_ref ("(Pmode != word_mode) + 3")))])
14427 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14429 ;; SSSE3 instructions
14431 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14433 (define_code_iterator ssse3_plusminus [plus ss_plus minus ss_minus])
14435 (define_insn "avx2_ph<plusminus_mnemonic>wv16hi3"
14436 [(set (match_operand:V16HI 0 "register_operand" "=x")
14441 (ssse3_plusminus:HI
14443 (match_operand:V16HI 1 "register_operand" "x")
14444 (parallel [(const_int 0)]))
14445 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
14446 (ssse3_plusminus:HI
14447 (vec_select:HI (match_dup 1) (parallel [(const_int 2)]))
14448 (vec_select:HI (match_dup 1) (parallel [(const_int 3)]))))
14450 (ssse3_plusminus:HI
14451 (vec_select:HI (match_dup 1) (parallel [(const_int 4)]))
14452 (vec_select:HI (match_dup 1) (parallel [(const_int 5)])))
14453 (ssse3_plusminus:HI
14454 (vec_select:HI (match_dup 1) (parallel [(const_int 6)]))
14455 (vec_select:HI (match_dup 1) (parallel [(const_int 7)])))))
14458 (ssse3_plusminus:HI
14459 (vec_select:HI (match_dup 1) (parallel [(const_int 8)]))
14460 (vec_select:HI (match_dup 1) (parallel [(const_int 9)])))
14461 (ssse3_plusminus:HI
14462 (vec_select:HI (match_dup 1) (parallel [(const_int 10)]))
14463 (vec_select:HI (match_dup 1) (parallel [(const_int 11)]))))
14465 (ssse3_plusminus:HI
14466 (vec_select:HI (match_dup 1) (parallel [(const_int 12)]))
14467 (vec_select:HI (match_dup 1) (parallel [(const_int 13)])))
14468 (ssse3_plusminus:HI
14469 (vec_select:HI (match_dup 1) (parallel [(const_int 14)]))
14470 (vec_select:HI (match_dup 1) (parallel [(const_int 15)]))))))
14474 (ssse3_plusminus:HI
14476 (match_operand:V16HI 2 "nonimmediate_operand" "xm")
14477 (parallel [(const_int 0)]))
14478 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))
14479 (ssse3_plusminus:HI
14480 (vec_select:HI (match_dup 2) (parallel [(const_int 2)]))
14481 (vec_select:HI (match_dup 2) (parallel [(const_int 3)]))))
14483 (ssse3_plusminus:HI
14484 (vec_select:HI (match_dup 2) (parallel [(const_int 4)]))
14485 (vec_select:HI (match_dup 2) (parallel [(const_int 5)])))
14486 (ssse3_plusminus:HI
14487 (vec_select:HI (match_dup 2) (parallel [(const_int 6)]))
14488 (vec_select:HI (match_dup 2) (parallel [(const_int 7)])))))
14491 (ssse3_plusminus:HI
14492 (vec_select:HI (match_dup 2) (parallel [(const_int 8)]))
14493 (vec_select:HI (match_dup 2) (parallel [(const_int 9)])))
14494 (ssse3_plusminus:HI
14495 (vec_select:HI (match_dup 2) (parallel [(const_int 10)]))
14496 (vec_select:HI (match_dup 2) (parallel [(const_int 11)]))))
14498 (ssse3_plusminus:HI
14499 (vec_select:HI (match_dup 2) (parallel [(const_int 12)]))
14500 (vec_select:HI (match_dup 2) (parallel [(const_int 13)])))
14501 (ssse3_plusminus:HI
14502 (vec_select:HI (match_dup 2) (parallel [(const_int 14)]))
14503 (vec_select:HI (match_dup 2) (parallel [(const_int 15)]))))))))]
14505 "vph<plusminus_mnemonic>w\t{%2, %1, %0|%0, %1, %2}"
14506 [(set_attr "type" "sseiadd")
14507 (set_attr "prefix_extra" "1")
14508 (set_attr "prefix" "vex")
14509 (set_attr "mode" "OI")])
14511 (define_insn "ssse3_ph<plusminus_mnemonic>wv8hi3"
14512 [(set (match_operand:V8HI 0 "register_operand" "=x,x")
14516 (ssse3_plusminus:HI
14518 (match_operand:V8HI 1 "register_operand" "0,x")
14519 (parallel [(const_int 0)]))
14520 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
14521 (ssse3_plusminus:HI
14522 (vec_select:HI (match_dup 1) (parallel [(const_int 2)]))
14523 (vec_select:HI (match_dup 1) (parallel [(const_int 3)]))))
14525 (ssse3_plusminus:HI
14526 (vec_select:HI (match_dup 1) (parallel [(const_int 4)]))
14527 (vec_select:HI (match_dup 1) (parallel [(const_int 5)])))
14528 (ssse3_plusminus:HI
14529 (vec_select:HI (match_dup 1) (parallel [(const_int 6)]))
14530 (vec_select:HI (match_dup 1) (parallel [(const_int 7)])))))
14533 (ssse3_plusminus:HI
14535 (match_operand:V8HI 2 "vector_operand" "xBm,xm")
14536 (parallel [(const_int 0)]))
14537 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))
14538 (ssse3_plusminus:HI
14539 (vec_select:HI (match_dup 2) (parallel [(const_int 2)]))
14540 (vec_select:HI (match_dup 2) (parallel [(const_int 3)]))))
14542 (ssse3_plusminus:HI
14543 (vec_select:HI (match_dup 2) (parallel [(const_int 4)]))
14544 (vec_select:HI (match_dup 2) (parallel [(const_int 5)])))
14545 (ssse3_plusminus:HI
14546 (vec_select:HI (match_dup 2) (parallel [(const_int 6)]))
14547 (vec_select:HI (match_dup 2) (parallel [(const_int 7)])))))))]
14550 ph<plusminus_mnemonic>w\t{%2, %0|%0, %2}
14551 vph<plusminus_mnemonic>w\t{%2, %1, %0|%0, %1, %2}"
14552 [(set_attr "isa" "noavx,avx")
14553 (set_attr "type" "sseiadd")
14554 (set_attr "atom_unit" "complex")
14555 (set_attr "prefix_data16" "1,*")
14556 (set_attr "prefix_extra" "1")
14557 (set_attr "prefix" "orig,vex")
14558 (set_attr "mode" "TI")])
14560 (define_insn "ssse3_ph<plusminus_mnemonic>wv4hi3"
14561 [(set (match_operand:V4HI 0 "register_operand" "=y")
14564 (ssse3_plusminus:HI
14566 (match_operand:V4HI 1 "register_operand" "0")
14567 (parallel [(const_int 0)]))
14568 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
14569 (ssse3_plusminus:HI
14570 (vec_select:HI (match_dup 1) (parallel [(const_int 2)]))
14571 (vec_select:HI (match_dup 1) (parallel [(const_int 3)]))))
14573 (ssse3_plusminus:HI
14575 (match_operand:V4HI 2 "nonimmediate_operand" "ym")
14576 (parallel [(const_int 0)]))
14577 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))
14578 (ssse3_plusminus:HI
14579 (vec_select:HI (match_dup 2) (parallel [(const_int 2)]))
14580 (vec_select:HI (match_dup 2) (parallel [(const_int 3)]))))))]
14582 "ph<plusminus_mnemonic>w\t{%2, %0|%0, %2}"
14583 [(set_attr "type" "sseiadd")
14584 (set_attr "atom_unit" "complex")
14585 (set_attr "prefix_extra" "1")
14586 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14587 (set_attr "mode" "DI")])
14589 (define_insn "avx2_ph<plusminus_mnemonic>dv8si3"
14590 [(set (match_operand:V8SI 0 "register_operand" "=x")
14596 (match_operand:V8SI 1 "register_operand" "x")
14597 (parallel [(const_int 0)]))
14598 (vec_select:SI (match_dup 1) (parallel [(const_int 1)])))
14600 (vec_select:SI (match_dup 1) (parallel [(const_int 2)]))
14601 (vec_select:SI (match_dup 1) (parallel [(const_int 3)]))))
14604 (vec_select:SI (match_dup 1) (parallel [(const_int 4)]))
14605 (vec_select:SI (match_dup 1) (parallel [(const_int 5)])))
14607 (vec_select:SI (match_dup 1) (parallel [(const_int 6)]))
14608 (vec_select:SI (match_dup 1) (parallel [(const_int 7)])))))
14613 (match_operand:V8SI 2 "nonimmediate_operand" "xm")
14614 (parallel [(const_int 0)]))
14615 (vec_select:SI (match_dup 2) (parallel [(const_int 1)])))
14617 (vec_select:SI (match_dup 2) (parallel [(const_int 2)]))
14618 (vec_select:SI (match_dup 2) (parallel [(const_int 3)]))))
14621 (vec_select:SI (match_dup 2) (parallel [(const_int 4)]))
14622 (vec_select:SI (match_dup 2) (parallel [(const_int 5)])))
14624 (vec_select:SI (match_dup 2) (parallel [(const_int 6)]))
14625 (vec_select:SI (match_dup 2) (parallel [(const_int 7)])))))))]
14627 "vph<plusminus_mnemonic>d\t{%2, %1, %0|%0, %1, %2}"
14628 [(set_attr "type" "sseiadd")
14629 (set_attr "prefix_extra" "1")
14630 (set_attr "prefix" "vex")
14631 (set_attr "mode" "OI")])
14633 (define_insn "ssse3_ph<plusminus_mnemonic>dv4si3"
14634 [(set (match_operand:V4SI 0 "register_operand" "=x,x")
14639 (match_operand:V4SI 1 "register_operand" "0,x")
14640 (parallel [(const_int 0)]))
14641 (vec_select:SI (match_dup 1) (parallel [(const_int 1)])))
14643 (vec_select:SI (match_dup 1) (parallel [(const_int 2)]))
14644 (vec_select:SI (match_dup 1) (parallel [(const_int 3)]))))
14648 (match_operand:V4SI 2 "vector_operand" "xBm,xm")
14649 (parallel [(const_int 0)]))
14650 (vec_select:SI (match_dup 2) (parallel [(const_int 1)])))
14652 (vec_select:SI (match_dup 2) (parallel [(const_int 2)]))
14653 (vec_select:SI (match_dup 2) (parallel [(const_int 3)]))))))]
14656 ph<plusminus_mnemonic>d\t{%2, %0|%0, %2}
14657 vph<plusminus_mnemonic>d\t{%2, %1, %0|%0, %1, %2}"
14658 [(set_attr "isa" "noavx,avx")
14659 (set_attr "type" "sseiadd")
14660 (set_attr "atom_unit" "complex")
14661 (set_attr "prefix_data16" "1,*")
14662 (set_attr "prefix_extra" "1")
14663 (set_attr "prefix" "orig,vex")
14664 (set_attr "mode" "TI")])
14666 (define_insn "ssse3_ph<plusminus_mnemonic>dv2si3"
14667 [(set (match_operand:V2SI 0 "register_operand" "=y")
14671 (match_operand:V2SI 1 "register_operand" "0")
14672 (parallel [(const_int 0)]))
14673 (vec_select:SI (match_dup 1) (parallel [(const_int 1)])))
14676 (match_operand:V2SI 2 "nonimmediate_operand" "ym")
14677 (parallel [(const_int 0)]))
14678 (vec_select:SI (match_dup 2) (parallel [(const_int 1)])))))]
14680 "ph<plusminus_mnemonic>d\t{%2, %0|%0, %2}"
14681 [(set_attr "type" "sseiadd")
14682 (set_attr "atom_unit" "complex")
14683 (set_attr "prefix_extra" "1")
14684 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14685 (set_attr "mode" "DI")])
14687 (define_insn "avx2_pmaddubsw256"
14688 [(set (match_operand:V16HI 0 "register_operand" "=x,v")
14693 (match_operand:V32QI 1 "register_operand" "x,v")
14694 (parallel [(const_int 0) (const_int 2)
14695 (const_int 4) (const_int 6)
14696 (const_int 8) (const_int 10)
14697 (const_int 12) (const_int 14)
14698 (const_int 16) (const_int 18)
14699 (const_int 20) (const_int 22)
14700 (const_int 24) (const_int 26)
14701 (const_int 28) (const_int 30)])))
14704 (match_operand:V32QI 2 "nonimmediate_operand" "xm,vm")
14705 (parallel [(const_int 0) (const_int 2)
14706 (const_int 4) (const_int 6)
14707 (const_int 8) (const_int 10)
14708 (const_int 12) (const_int 14)
14709 (const_int 16) (const_int 18)
14710 (const_int 20) (const_int 22)
14711 (const_int 24) (const_int 26)
14712 (const_int 28) (const_int 30)]))))
14715 (vec_select:V16QI (match_dup 1)
14716 (parallel [(const_int 1) (const_int 3)
14717 (const_int 5) (const_int 7)
14718 (const_int 9) (const_int 11)
14719 (const_int 13) (const_int 15)
14720 (const_int 17) (const_int 19)
14721 (const_int 21) (const_int 23)
14722 (const_int 25) (const_int 27)
14723 (const_int 29) (const_int 31)])))
14725 (vec_select:V16QI (match_dup 2)
14726 (parallel [(const_int 1) (const_int 3)
14727 (const_int 5) (const_int 7)
14728 (const_int 9) (const_int 11)
14729 (const_int 13) (const_int 15)
14730 (const_int 17) (const_int 19)
14731 (const_int 21) (const_int 23)
14732 (const_int 25) (const_int 27)
14733 (const_int 29) (const_int 31)]))))))]
14735 "vpmaddubsw\t{%2, %1, %0|%0, %1, %2}"
14736 [(set_attr "isa" "*,avx512bw")
14737 (set_attr "type" "sseiadd")
14738 (set_attr "prefix_extra" "1")
14739 (set_attr "prefix" "vex,evex")
14740 (set_attr "mode" "OI")])
14742 ;; The correct representation for this is absolutely enormous, and
14743 ;; surely not generally useful.
14744 (define_insn "avx512bw_pmaddubsw512<mode><mask_name>"
14745 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
14746 (unspec:VI2_AVX512VL
14747 [(match_operand:<dbpsadbwmode> 1 "register_operand" "v")
14748 (match_operand:<dbpsadbwmode> 2 "nonimmediate_operand" "vm")]
14749 UNSPEC_PMADDUBSW512))]
14751 "vpmaddubsw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}";
14752 [(set_attr "type" "sseiadd")
14753 (set_attr "prefix" "evex")
14754 (set_attr "mode" "XI")])
14756 (define_insn "avx512bw_umulhrswv32hi3<mask_name>"
14757 [(set (match_operand:V32HI 0 "register_operand" "=v")
14764 (match_operand:V32HI 1 "nonimmediate_operand" "%v"))
14766 (match_operand:V32HI 2 "nonimmediate_operand" "vm")))
14768 (const_vector:V32HI [(const_int 1) (const_int 1)
14769 (const_int 1) (const_int 1)
14770 (const_int 1) (const_int 1)
14771 (const_int 1) (const_int 1)
14772 (const_int 1) (const_int 1)
14773 (const_int 1) (const_int 1)
14774 (const_int 1) (const_int 1)
14775 (const_int 1) (const_int 1)
14776 (const_int 1) (const_int 1)
14777 (const_int 1) (const_int 1)
14778 (const_int 1) (const_int 1)
14779 (const_int 1) (const_int 1)
14780 (const_int 1) (const_int 1)
14781 (const_int 1) (const_int 1)
14782 (const_int 1) (const_int 1)
14783 (const_int 1) (const_int 1)]))
14786 "vpmulhrsw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
14787 [(set_attr "type" "sseimul")
14788 (set_attr "prefix" "evex")
14789 (set_attr "mode" "XI")])
14791 (define_insn "ssse3_pmaddubsw128"
14792 [(set (match_operand:V8HI 0 "register_operand" "=x,x,v")
14797 (match_operand:V16QI 1 "register_operand" "0,x,v")
14798 (parallel [(const_int 0) (const_int 2)
14799 (const_int 4) (const_int 6)
14800 (const_int 8) (const_int 10)
14801 (const_int 12) (const_int 14)])))
14804 (match_operand:V16QI 2 "vector_operand" "xBm,xm,vm")
14805 (parallel [(const_int 0) (const_int 2)
14806 (const_int 4) (const_int 6)
14807 (const_int 8) (const_int 10)
14808 (const_int 12) (const_int 14)]))))
14811 (vec_select:V8QI (match_dup 1)
14812 (parallel [(const_int 1) (const_int 3)
14813 (const_int 5) (const_int 7)
14814 (const_int 9) (const_int 11)
14815 (const_int 13) (const_int 15)])))
14817 (vec_select:V8QI (match_dup 2)
14818 (parallel [(const_int 1) (const_int 3)
14819 (const_int 5) (const_int 7)
14820 (const_int 9) (const_int 11)
14821 (const_int 13) (const_int 15)]))))))]
14824 pmaddubsw\t{%2, %0|%0, %2}
14825 vpmaddubsw\t{%2, %1, %0|%0, %1, %2}
14826 vpmaddubsw\t{%2, %1, %0|%0, %1, %2}"
14827 [(set_attr "isa" "noavx,avx,avx512bw")
14828 (set_attr "type" "sseiadd")
14829 (set_attr "atom_unit" "simul")
14830 (set_attr "prefix_data16" "1,*,*")
14831 (set_attr "prefix_extra" "1")
14832 (set_attr "prefix" "orig,vex,evex")
14833 (set_attr "mode" "TI")])
14835 (define_insn "ssse3_pmaddubsw"
14836 [(set (match_operand:V4HI 0 "register_operand" "=y")
14841 (match_operand:V8QI 1 "register_operand" "0")
14842 (parallel [(const_int 0) (const_int 2)
14843 (const_int 4) (const_int 6)])))
14846 (match_operand:V8QI 2 "nonimmediate_operand" "ym")
14847 (parallel [(const_int 0) (const_int 2)
14848 (const_int 4) (const_int 6)]))))
14851 (vec_select:V4QI (match_dup 1)
14852 (parallel [(const_int 1) (const_int 3)
14853 (const_int 5) (const_int 7)])))
14855 (vec_select:V4QI (match_dup 2)
14856 (parallel [(const_int 1) (const_int 3)
14857 (const_int 5) (const_int 7)]))))))]
14859 "pmaddubsw\t{%2, %0|%0, %2}"
14860 [(set_attr "type" "sseiadd")
14861 (set_attr "atom_unit" "simul")
14862 (set_attr "prefix_extra" "1")
14863 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14864 (set_attr "mode" "DI")])
14866 (define_mode_iterator PMULHRSW
14867 [V4HI V8HI (V16HI "TARGET_AVX2")])
14869 (define_expand "<ssse3_avx2>_pmulhrsw<mode>3_mask"
14870 [(set (match_operand:PMULHRSW 0 "register_operand")
14871 (vec_merge:PMULHRSW
14873 (lshiftrt:<ssedoublemode>
14874 (plus:<ssedoublemode>
14875 (lshiftrt:<ssedoublemode>
14876 (mult:<ssedoublemode>
14877 (sign_extend:<ssedoublemode>
14878 (match_operand:PMULHRSW 1 "nonimmediate_operand"))
14879 (sign_extend:<ssedoublemode>
14880 (match_operand:PMULHRSW 2 "nonimmediate_operand")))
14884 (match_operand:PMULHRSW 3 "register_operand")
14885 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
14886 "TARGET_AVX512BW && TARGET_AVX512VL"
14888 operands[5] = CONST1_RTX(<MODE>mode);
14889 ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);
14892 (define_expand "<ssse3_avx2>_pmulhrsw<mode>3"
14893 [(set (match_operand:PMULHRSW 0 "register_operand")
14895 (lshiftrt:<ssedoublemode>
14896 (plus:<ssedoublemode>
14897 (lshiftrt:<ssedoublemode>
14898 (mult:<ssedoublemode>
14899 (sign_extend:<ssedoublemode>
14900 (match_operand:PMULHRSW 1 "nonimmediate_operand"))
14901 (sign_extend:<ssedoublemode>
14902 (match_operand:PMULHRSW 2 "nonimmediate_operand")))
14908 operands[3] = CONST1_RTX(<MODE>mode);
14909 ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);
14912 (define_insn "*<ssse3_avx2>_pmulhrsw<mode>3<mask_name>"
14913 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,x,v")
14915 (lshiftrt:<ssedoublemode>
14916 (plus:<ssedoublemode>
14917 (lshiftrt:<ssedoublemode>
14918 (mult:<ssedoublemode>
14919 (sign_extend:<ssedoublemode>
14920 (match_operand:VI2_AVX2 1 "vector_operand" "%0,x,v"))
14921 (sign_extend:<ssedoublemode>
14922 (match_operand:VI2_AVX2 2 "vector_operand" "xBm,xm,vm")))
14924 (match_operand:VI2_AVX2 3 "const1_operand"))
14926 "TARGET_SSSE3 && <mask_mode512bit_condition> && <mask_avx512bw_condition>
14927 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
14929 pmulhrsw\t{%2, %0|%0, %2}
14930 vpmulhrsw\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}
14931 vpmulhrsw\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}"
14932 [(set_attr "isa" "noavx,avx,avx512bw")
14933 (set_attr "type" "sseimul")
14934 (set_attr "prefix_data16" "1,*,*")
14935 (set_attr "prefix_extra" "1")
14936 (set_attr "prefix" "orig,maybe_evex,evex")
14937 (set_attr "mode" "<sseinsnmode>")])
14939 (define_insn "*ssse3_pmulhrswv4hi3"
14940 [(set (match_operand:V4HI 0 "register_operand" "=y")
14947 (match_operand:V4HI 1 "nonimmediate_operand" "%0"))
14949 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))
14951 (match_operand:V4HI 3 "const1_operand"))
14953 "TARGET_SSSE3 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
14954 "pmulhrsw\t{%2, %0|%0, %2}"
14955 [(set_attr "type" "sseimul")
14956 (set_attr "prefix_extra" "1")
14957 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14958 (set_attr "mode" "DI")])
14960 (define_insn "<ssse3_avx2>_pshufb<mode>3<mask_name>"
14961 [(set (match_operand:VI1_AVX512 0 "register_operand" "=x,x,v")
14963 [(match_operand:VI1_AVX512 1 "register_operand" "0,x,v")
14964 (match_operand:VI1_AVX512 2 "vector_operand" "xBm,xm,vm")]
14966 "TARGET_SSSE3 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
14968 pshufb\t{%2, %0|%0, %2}
14969 vpshufb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
14970 vpshufb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
14971 [(set_attr "isa" "noavx,avx,avx512bw")
14972 (set_attr "type" "sselog1")
14973 (set_attr "prefix_data16" "1,*,*")
14974 (set_attr "prefix_extra" "1")
14975 (set_attr "prefix" "orig,maybe_evex,evex")
14976 (set_attr "btver2_decode" "vector")
14977 (set_attr "mode" "<sseinsnmode>")])
14979 (define_insn "ssse3_pshufbv8qi3"
14980 [(set (match_operand:V8QI 0 "register_operand" "=y")
14981 (unspec:V8QI [(match_operand:V8QI 1 "register_operand" "0")
14982 (match_operand:V8QI 2 "nonimmediate_operand" "ym")]
14985 "pshufb\t{%2, %0|%0, %2}";
14986 [(set_attr "type" "sselog1")
14987 (set_attr "prefix_extra" "1")
14988 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14989 (set_attr "mode" "DI")])
14991 (define_insn "<ssse3_avx2>_psign<mode>3"
14992 [(set (match_operand:VI124_AVX2 0 "register_operand" "=x,x")
14994 [(match_operand:VI124_AVX2 1 "register_operand" "0,x")
14995 (match_operand:VI124_AVX2 2 "vector_operand" "xBm,xm")]
14999 psign<ssemodesuffix>\t{%2, %0|%0, %2}
15000 vpsign<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
15001 [(set_attr "isa" "noavx,avx")
15002 (set_attr "type" "sselog1")
15003 (set_attr "prefix_data16" "1,*")
15004 (set_attr "prefix_extra" "1")
15005 (set_attr "prefix" "orig,vex")
15006 (set_attr "mode" "<sseinsnmode>")])
15008 (define_insn "ssse3_psign<mode>3"
15009 [(set (match_operand:MMXMODEI 0 "register_operand" "=y")
15011 [(match_operand:MMXMODEI 1 "register_operand" "0")
15012 (match_operand:MMXMODEI 2 "nonimmediate_operand" "ym")]
15015 "psign<mmxvecsize>\t{%2, %0|%0, %2}";
15016 [(set_attr "type" "sselog1")
15017 (set_attr "prefix_extra" "1")
15018 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
15019 (set_attr "mode" "DI")])
15021 (define_insn "<ssse3_avx2>_palignr<mode>_mask"
15022 [(set (match_operand:VI1_AVX512 0 "register_operand" "=v")
15023 (vec_merge:VI1_AVX512
15025 [(match_operand:VI1_AVX512 1 "register_operand" "v")
15026 (match_operand:VI1_AVX512 2 "nonimmediate_operand" "vm")
15027 (match_operand:SI 3 "const_0_to_255_mul_8_operand" "n")]
15029 (match_operand:VI1_AVX512 4 "vector_move_operand" "0C")
15030 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
15031 "TARGET_AVX512BW && (<MODE_SIZE> == 64 || TARGET_AVX512VL)"
15033 operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
15034 return "vpalignr\t{%3, %2, %1, %0%{%5%}%N4|%0%{%5%}%N4, %1, %2, %3}";
15036 [(set_attr "type" "sseishft")
15037 (set_attr "atom_unit" "sishuf")
15038 (set_attr "prefix_extra" "1")
15039 (set_attr "length_immediate" "1")
15040 (set_attr "prefix" "evex")
15041 (set_attr "mode" "<sseinsnmode>")])
15043 (define_insn "<ssse3_avx2>_palignr<mode>"
15044 [(set (match_operand:SSESCALARMODE 0 "register_operand" "=x,x,v")
15045 (unspec:SSESCALARMODE
15046 [(match_operand:SSESCALARMODE 1 "register_operand" "0,x,v")
15047 (match_operand:SSESCALARMODE 2 "vector_operand" "xBm,xm,vm")
15048 (match_operand:SI 3 "const_0_to_255_mul_8_operand" "n,n,n")]
15052 operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
15054 switch (which_alternative)
15057 return "palignr\t{%3, %2, %0|%0, %2, %3}";
15060 return "vpalignr\t{%3, %2, %1, %0|%0, %1, %2, %3}";
15062 gcc_unreachable ();
15065 [(set_attr "isa" "noavx,avx,avx512bw")
15066 (set_attr "type" "sseishft")
15067 (set_attr "atom_unit" "sishuf")
15068 (set_attr "prefix_data16" "1,*,*")
15069 (set_attr "prefix_extra" "1")
15070 (set_attr "length_immediate" "1")
15071 (set_attr "prefix" "orig,vex,evex")
15072 (set_attr "mode" "<sseinsnmode>")])
15074 (define_insn "ssse3_palignrdi"
15075 [(set (match_operand:DI 0 "register_operand" "=y")
15076 (unspec:DI [(match_operand:DI 1 "register_operand" "0")
15077 (match_operand:DI 2 "nonimmediate_operand" "ym")
15078 (match_operand:SI 3 "const_0_to_255_mul_8_operand" "n")]
15082 operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
15083 return "palignr\t{%3, %2, %0|%0, %2, %3}";
15085 [(set_attr "type" "sseishft")
15086 (set_attr "atom_unit" "sishuf")
15087 (set_attr "prefix_extra" "1")
15088 (set_attr "length_immediate" "1")
15089 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
15090 (set_attr "mode" "DI")])
15092 ;; Mode iterator to handle singularity w/ absence of V2DI and V4DI
15093 ;; modes for abs instruction on pre AVX-512 targets.
15094 (define_mode_iterator VI1248_AVX512VL_AVX512BW
15095 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI
15096 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI
15097 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX2") V4SI
15098 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")])
15100 (define_insn "*abs<mode>2"
15101 [(set (match_operand:VI1248_AVX512VL_AVX512BW 0 "register_operand" "=v")
15102 (abs:VI1248_AVX512VL_AVX512BW
15103 (match_operand:VI1248_AVX512VL_AVX512BW 1 "vector_operand" "vBm")))]
15105 "%vpabs<ssemodesuffix>\t{%1, %0|%0, %1}"
15106 [(set_attr "type" "sselog1")
15107 (set_attr "prefix_data16" "1")
15108 (set_attr "prefix_extra" "1")
15109 (set_attr "prefix" "maybe_vex")
15110 (set_attr "mode" "<sseinsnmode>")])
15112 (define_insn "abs<mode>2_mask"
15113 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
15114 (vec_merge:VI48_AVX512VL
15116 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm"))
15117 (match_operand:VI48_AVX512VL 2 "vector_move_operand" "0C")
15118 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
15120 "vpabs<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
15121 [(set_attr "type" "sselog1")
15122 (set_attr "prefix" "evex")
15123 (set_attr "mode" "<sseinsnmode>")])
15125 (define_insn "abs<mode>2_mask"
15126 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
15127 (vec_merge:VI12_AVX512VL
15129 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "vm"))
15130 (match_operand:VI12_AVX512VL 2 "vector_move_operand" "0C")
15131 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
15133 "vpabs<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
15134 [(set_attr "type" "sselog1")
15135 (set_attr "prefix" "evex")
15136 (set_attr "mode" "<sseinsnmode>")])
15138 (define_expand "abs<mode>2"
15139 [(set (match_operand:VI1248_AVX512VL_AVX512BW 0 "register_operand")
15140 (abs:VI1248_AVX512VL_AVX512BW
15141 (match_operand:VI1248_AVX512VL_AVX512BW 1 "vector_operand")))]
15146 ix86_expand_sse2_abs (operands[0], operands[1]);
15151 (define_insn "abs<mode>2"
15152 [(set (match_operand:MMXMODEI 0 "register_operand" "=y")
15154 (match_operand:MMXMODEI 1 "nonimmediate_operand" "ym")))]
15156 "pabs<mmxvecsize>\t{%1, %0|%0, %1}";
15157 [(set_attr "type" "sselog1")
15158 (set_attr "prefix_rep" "0")
15159 (set_attr "prefix_extra" "1")
15160 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
15161 (set_attr "mode" "DI")])
15163 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15165 ;; AMD SSE4A instructions
15167 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15169 (define_insn "sse4a_movnt<mode>"
15170 [(set (match_operand:MODEF 0 "memory_operand" "=m")
15172 [(match_operand:MODEF 1 "register_operand" "x")]
15175 "movnt<ssemodesuffix>\t{%1, %0|%0, %1}"
15176 [(set_attr "type" "ssemov")
15177 (set_attr "mode" "<MODE>")])
15179 (define_insn "sse4a_vmmovnt<mode>"
15180 [(set (match_operand:<ssescalarmode> 0 "memory_operand" "=m")
15181 (unspec:<ssescalarmode>
15182 [(vec_select:<ssescalarmode>
15183 (match_operand:VF_128 1 "register_operand" "x")
15184 (parallel [(const_int 0)]))]
15187 "movnt<ssescalarmodesuffix>\t{%1, %0|%0, %1}"
15188 [(set_attr "type" "ssemov")
15189 (set_attr "mode" "<ssescalarmode>")])
15191 (define_insn "sse4a_extrqi"
15192 [(set (match_operand:V2DI 0 "register_operand" "=x")
15193 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
15194 (match_operand 2 "const_0_to_255_operand")
15195 (match_operand 3 "const_0_to_255_operand")]
15198 "extrq\t{%3, %2, %0|%0, %2, %3}"
15199 [(set_attr "type" "sse")
15200 (set_attr "prefix_data16" "1")
15201 (set_attr "length_immediate" "2")
15202 (set_attr "mode" "TI")])
15204 (define_insn "sse4a_extrq"
15205 [(set (match_operand:V2DI 0 "register_operand" "=x")
15206 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
15207 (match_operand:V16QI 2 "register_operand" "x")]
15210 "extrq\t{%2, %0|%0, %2}"
15211 [(set_attr "type" "sse")
15212 (set_attr "prefix_data16" "1")
15213 (set_attr "mode" "TI")])
15215 (define_insn "sse4a_insertqi"
15216 [(set (match_operand:V2DI 0 "register_operand" "=x")
15217 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
15218 (match_operand:V2DI 2 "register_operand" "x")
15219 (match_operand 3 "const_0_to_255_operand")
15220 (match_operand 4 "const_0_to_255_operand")]
15223 "insertq\t{%4, %3, %2, %0|%0, %2, %3, %4}"
15224 [(set_attr "type" "sseins")
15225 (set_attr "prefix_data16" "0")
15226 (set_attr "prefix_rep" "1")
15227 (set_attr "length_immediate" "2")
15228 (set_attr "mode" "TI")])
15230 (define_insn "sse4a_insertq"
15231 [(set (match_operand:V2DI 0 "register_operand" "=x")
15232 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
15233 (match_operand:V2DI 2 "register_operand" "x")]
15236 "insertq\t{%2, %0|%0, %2}"
15237 [(set_attr "type" "sseins")
15238 (set_attr "prefix_data16" "0")
15239 (set_attr "prefix_rep" "1")
15240 (set_attr "mode" "TI")])
15242 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15244 ;; Intel SSE4.1 instructions
15246 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15248 ;; Mapping of immediate bits for blend instructions
15249 (define_mode_attr blendbits
15250 [(V8SF "255") (V4SF "15") (V4DF "15") (V2DF "3")])
15252 (define_insn "<sse4_1>_blend<ssemodesuffix><avxsizesuffix>"
15253 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
15254 (vec_merge:VF_128_256
15255 (match_operand:VF_128_256 2 "vector_operand" "YrBm,*xBm,xm")
15256 (match_operand:VF_128_256 1 "register_operand" "0,0,x")
15257 (match_operand:SI 3 "const_0_to_<blendbits>_operand")))]
15260 blend<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15261 blend<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15262 vblend<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15263 [(set_attr "isa" "noavx,noavx,avx")
15264 (set_attr "type" "ssemov")
15265 (set_attr "length_immediate" "1")
15266 (set_attr "prefix_data16" "1,1,*")
15267 (set_attr "prefix_extra" "1")
15268 (set_attr "prefix" "orig,orig,vex")
15269 (set_attr "mode" "<MODE>")])
15271 (define_insn "<sse4_1>_blendv<ssemodesuffix><avxsizesuffix>"
15272 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
15274 [(match_operand:VF_128_256 1 "register_operand" "0,0,x")
15275 (match_operand:VF_128_256 2 "vector_operand" "YrBm,*xBm,xm")
15276 (match_operand:VF_128_256 3 "register_operand" "Yz,Yz,x")]
15280 blendv<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15281 blendv<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15282 vblendv<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15283 [(set_attr "isa" "noavx,noavx,avx")
15284 (set_attr "type" "ssemov")
15285 (set_attr "length_immediate" "1")
15286 (set_attr "prefix_data16" "1,1,*")
15287 (set_attr "prefix_extra" "1")
15288 (set_attr "prefix" "orig,orig,vex")
15289 (set_attr "btver2_decode" "vector,vector,vector")
15290 (set_attr "mode" "<MODE>")])
15292 (define_insn "<sse4_1>_dp<ssemodesuffix><avxsizesuffix>"
15293 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
15295 [(match_operand:VF_128_256 1 "vector_operand" "%0,0,x")
15296 (match_operand:VF_128_256 2 "vector_operand" "YrBm,*xBm,xm")
15297 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")]
15301 dp<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15302 dp<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15303 vdp<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15304 [(set_attr "isa" "noavx,noavx,avx")
15305 (set_attr "type" "ssemul")
15306 (set_attr "length_immediate" "1")
15307 (set_attr "prefix_data16" "1,1,*")
15308 (set_attr "prefix_extra" "1")
15309 (set_attr "prefix" "orig,orig,vex")
15310 (set_attr "btver2_decode" "vector,vector,vector")
15311 (set_attr "znver1_decode" "vector,vector,vector")
15312 (set_attr "mode" "<MODE>")])
15314 ;; Mode attribute used by `vmovntdqa' pattern
15315 (define_mode_attr vi8_sse4_1_avx2_avx512
15316 [(V2DI "sse4_1") (V4DI "avx2") (V8DI "avx512f")])
15318 (define_insn "<vi8_sse4_1_avx2_avx512>_movntdqa"
15319 [(set (match_operand:VI8_AVX2_AVX512F 0 "register_operand" "=Yr,*x,v")
15320 (unspec:VI8_AVX2_AVX512F [(match_operand:VI8_AVX2_AVX512F 1 "memory_operand" "m,m,m")]
15323 "%vmovntdqa\t{%1, %0|%0, %1}"
15324 [(set_attr "isa" "noavx,noavx,avx")
15325 (set_attr "type" "ssemov")
15326 (set_attr "prefix_extra" "1,1,*")
15327 (set_attr "prefix" "orig,orig,maybe_evex")
15328 (set_attr "mode" "<sseinsnmode>")])
15330 (define_insn "<sse4_1_avx2>_mpsadbw"
15331 [(set (match_operand:VI1_AVX2 0 "register_operand" "=Yr,*x,x")
15333 [(match_operand:VI1_AVX2 1 "register_operand" "0,0,x")
15334 (match_operand:VI1_AVX2 2 "vector_operand" "YrBm,*xBm,xm")
15335 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")]
15339 mpsadbw\t{%3, %2, %0|%0, %2, %3}
15340 mpsadbw\t{%3, %2, %0|%0, %2, %3}
15341 vmpsadbw\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15342 [(set_attr "isa" "noavx,noavx,avx")
15343 (set_attr "type" "sselog1")
15344 (set_attr "length_immediate" "1")
15345 (set_attr "prefix_extra" "1")
15346 (set_attr "prefix" "orig,orig,vex")
15347 (set_attr "btver2_decode" "vector,vector,vector")
15348 (set_attr "znver1_decode" "vector,vector,vector")
15349 (set_attr "mode" "<sseinsnmode>")])
15351 (define_insn "<sse4_1_avx2>_packusdw<mask_name>"
15352 [(set (match_operand:VI2_AVX2 0 "register_operand" "=Yr,*x,x,v")
15353 (vec_concat:VI2_AVX2
15354 (us_truncate:<ssehalfvecmode>
15355 (match_operand:<sseunpackmode> 1 "register_operand" "0,0,x,v"))
15356 (us_truncate:<ssehalfvecmode>
15357 (match_operand:<sseunpackmode> 2 "vector_operand" "YrBm,*xBm,xm,vm"))))]
15358 "TARGET_SSE4_1 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
15360 packusdw\t{%2, %0|%0, %2}
15361 packusdw\t{%2, %0|%0, %2}
15362 vpackusdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
15363 vpackusdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
15364 [(set_attr "isa" "noavx,noavx,avx,avx512bw")
15365 (set_attr "type" "sselog")
15366 (set_attr "prefix_extra" "1")
15367 (set_attr "prefix" "orig,orig,<mask_prefix>,evex")
15368 (set_attr "mode" "<sseinsnmode>")])
15370 (define_insn "<sse4_1_avx2>_pblendvb"
15371 [(set (match_operand:VI1_AVX2 0 "register_operand" "=Yr,*x,x")
15373 [(match_operand:VI1_AVX2 1 "register_operand" "0,0,x")
15374 (match_operand:VI1_AVX2 2 "vector_operand" "YrBm,*xBm,xm")
15375 (match_operand:VI1_AVX2 3 "register_operand" "Yz,Yz,x")]
15379 pblendvb\t{%3, %2, %0|%0, %2, %3}
15380 pblendvb\t{%3, %2, %0|%0, %2, %3}
15381 vpblendvb\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15382 [(set_attr "isa" "noavx,noavx,avx")
15383 (set_attr "type" "ssemov")
15384 (set_attr "prefix_extra" "1")
15385 (set_attr "length_immediate" "*,*,1")
15386 (set_attr "prefix" "orig,orig,vex")
15387 (set_attr "btver2_decode" "vector,vector,vector")
15388 (set_attr "mode" "<sseinsnmode>")])
15390 (define_insn "sse4_1_pblendw"
15391 [(set (match_operand:V8HI 0 "register_operand" "=Yr,*x,x")
15393 (match_operand:V8HI 2 "vector_operand" "YrBm,*xBm,xm")
15394 (match_operand:V8HI 1 "register_operand" "0,0,x")
15395 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")))]
15398 pblendw\t{%3, %2, %0|%0, %2, %3}
15399 pblendw\t{%3, %2, %0|%0, %2, %3}
15400 vpblendw\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15401 [(set_attr "isa" "noavx,noavx,avx")
15402 (set_attr "type" "ssemov")
15403 (set_attr "prefix_extra" "1")
15404 (set_attr "length_immediate" "1")
15405 (set_attr "prefix" "orig,orig,vex")
15406 (set_attr "mode" "TI")])
15408 ;; The builtin uses an 8-bit immediate. Expand that.
15409 (define_expand "avx2_pblendw"
15410 [(set (match_operand:V16HI 0 "register_operand")
15412 (match_operand:V16HI 2 "nonimmediate_operand")
15413 (match_operand:V16HI 1 "register_operand")
15414 (match_operand:SI 3 "const_0_to_255_operand")))]
15417 HOST_WIDE_INT val = INTVAL (operands[3]) & 0xff;
15418 operands[3] = GEN_INT (val << 8 | val);
15421 (define_insn "*avx2_pblendw"
15422 [(set (match_operand:V16HI 0 "register_operand" "=x")
15424 (match_operand:V16HI 2 "nonimmediate_operand" "xm")
15425 (match_operand:V16HI 1 "register_operand" "x")
15426 (match_operand:SI 3 "avx2_pblendw_operand" "n")))]
15429 operands[3] = GEN_INT (INTVAL (operands[3]) & 0xff);
15430 return "vpblendw\t{%3, %2, %1, %0|%0, %1, %2, %3}";
15432 [(set_attr "type" "ssemov")
15433 (set_attr "prefix_extra" "1")
15434 (set_attr "length_immediate" "1")
15435 (set_attr "prefix" "vex")
15436 (set_attr "mode" "OI")])
15438 (define_insn "avx2_pblendd<mode>"
15439 [(set (match_operand:VI4_AVX2 0 "register_operand" "=x")
15440 (vec_merge:VI4_AVX2
15441 (match_operand:VI4_AVX2 2 "nonimmediate_operand" "xm")
15442 (match_operand:VI4_AVX2 1 "register_operand" "x")
15443 (match_operand:SI 3 "const_0_to_255_operand" "n")))]
15445 "vpblendd\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15446 [(set_attr "type" "ssemov")
15447 (set_attr "prefix_extra" "1")
15448 (set_attr "length_immediate" "1")
15449 (set_attr "prefix" "vex")
15450 (set_attr "mode" "<sseinsnmode>")])
15452 (define_insn "sse4_1_phminposuw"
15453 [(set (match_operand:V8HI 0 "register_operand" "=Yr,*x,x")
15454 (unspec:V8HI [(match_operand:V8HI 1 "vector_operand" "YrBm,*xBm,xm")]
15455 UNSPEC_PHMINPOSUW))]
15457 "%vphminposuw\t{%1, %0|%0, %1}"
15458 [(set_attr "isa" "noavx,noavx,avx")
15459 (set_attr "type" "sselog1")
15460 (set_attr "prefix_extra" "1")
15461 (set_attr "prefix" "orig,orig,vex")
15462 (set_attr "mode" "TI")])
15464 (define_insn "avx2_<code>v16qiv16hi2<mask_name>"
15465 [(set (match_operand:V16HI 0 "register_operand" "=v")
15467 (match_operand:V16QI 1 "nonimmediate_operand" "vm")))]
15468 "TARGET_AVX2 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
15469 "vpmov<extsuffix>bw\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15470 [(set_attr "type" "ssemov")
15471 (set_attr "prefix_extra" "1")
15472 (set_attr "prefix" "maybe_evex")
15473 (set_attr "mode" "OI")])
15475 (define_insn "avx512bw_<code>v32qiv32hi2<mask_name>"
15476 [(set (match_operand:V32HI 0 "register_operand" "=v")
15478 (match_operand:V32QI 1 "nonimmediate_operand" "vm")))]
15480 "vpmov<extsuffix>bw\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15481 [(set_attr "type" "ssemov")
15482 (set_attr "prefix_extra" "1")
15483 (set_attr "prefix" "evex")
15484 (set_attr "mode" "XI")])
15486 (define_insn "sse4_1_<code>v8qiv8hi2<mask_name>"
15487 [(set (match_operand:V8HI 0 "register_operand" "=Yr,*x,v")
15490 (match_operand:V16QI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15491 (parallel [(const_int 0) (const_int 1)
15492 (const_int 2) (const_int 3)
15493 (const_int 4) (const_int 5)
15494 (const_int 6) (const_int 7)]))))]
15495 "TARGET_SSE4_1 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
15496 "%vpmov<extsuffix>bw\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15497 [(set_attr "isa" "noavx,noavx,avx")
15498 (set_attr "type" "ssemov")
15499 (set_attr "prefix_extra" "1")
15500 (set_attr "prefix" "orig,orig,maybe_evex")
15501 (set_attr "mode" "TI")])
15503 (define_insn "<mask_codefor>avx512f_<code>v16qiv16si2<mask_name>"
15504 [(set (match_operand:V16SI 0 "register_operand" "=v")
15506 (match_operand:V16QI 1 "nonimmediate_operand" "vm")))]
15508 "vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15509 [(set_attr "type" "ssemov")
15510 (set_attr "prefix" "evex")
15511 (set_attr "mode" "XI")])
15513 (define_insn "avx2_<code>v8qiv8si2<mask_name>"
15514 [(set (match_operand:V8SI 0 "register_operand" "=v")
15517 (match_operand:V16QI 1 "nonimmediate_operand" "vm")
15518 (parallel [(const_int 0) (const_int 1)
15519 (const_int 2) (const_int 3)
15520 (const_int 4) (const_int 5)
15521 (const_int 6) (const_int 7)]))))]
15522 "TARGET_AVX2 && <mask_avx512vl_condition>"
15523 "vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15524 [(set_attr "type" "ssemov")
15525 (set_attr "prefix_extra" "1")
15526 (set_attr "prefix" "maybe_evex")
15527 (set_attr "mode" "OI")])
15529 (define_insn "sse4_1_<code>v4qiv4si2<mask_name>"
15530 [(set (match_operand:V4SI 0 "register_operand" "=Yr,*x,v")
15533 (match_operand:V16QI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15534 (parallel [(const_int 0) (const_int 1)
15535 (const_int 2) (const_int 3)]))))]
15536 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15537 "%vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
15538 [(set_attr "isa" "noavx,noavx,avx")
15539 (set_attr "type" "ssemov")
15540 (set_attr "prefix_extra" "1")
15541 (set_attr "prefix" "orig,orig,maybe_evex")
15542 (set_attr "mode" "TI")])
15544 (define_insn "avx512f_<code>v16hiv16si2<mask_name>"
15545 [(set (match_operand:V16SI 0 "register_operand" "=v")
15547 (match_operand:V16HI 1 "nonimmediate_operand" "vm")))]
15549 "vpmov<extsuffix>wd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15550 [(set_attr "type" "ssemov")
15551 (set_attr "prefix" "evex")
15552 (set_attr "mode" "XI")])
15554 (define_insn "avx2_<code>v8hiv8si2<mask_name>"
15555 [(set (match_operand:V8SI 0 "register_operand" "=v")
15557 (match_operand:V8HI 1 "nonimmediate_operand" "vm")))]
15558 "TARGET_AVX2 && <mask_avx512vl_condition>"
15559 "vpmov<extsuffix>wd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15560 [(set_attr "type" "ssemov")
15561 (set_attr "prefix_extra" "1")
15562 (set_attr "prefix" "maybe_evex")
15563 (set_attr "mode" "OI")])
15565 (define_insn "sse4_1_<code>v4hiv4si2<mask_name>"
15566 [(set (match_operand:V4SI 0 "register_operand" "=Yr,*x,v")
15569 (match_operand:V8HI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15570 (parallel [(const_int 0) (const_int 1)
15571 (const_int 2) (const_int 3)]))))]
15572 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15573 "%vpmov<extsuffix>wd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15574 [(set_attr "isa" "noavx,noavx,avx")
15575 (set_attr "type" "ssemov")
15576 (set_attr "prefix_extra" "1")
15577 (set_attr "prefix" "orig,orig,maybe_evex")
15578 (set_attr "mode" "TI")])
15580 (define_insn "avx512f_<code>v8qiv8di2<mask_name>"
15581 [(set (match_operand:V8DI 0 "register_operand" "=v")
15584 (match_operand:V16QI 1 "nonimmediate_operand" "vm")
15585 (parallel [(const_int 0) (const_int 1)
15586 (const_int 2) (const_int 3)
15587 (const_int 4) (const_int 5)
15588 (const_int 6) (const_int 7)]))))]
15590 "vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
15591 [(set_attr "type" "ssemov")
15592 (set_attr "prefix" "evex")
15593 (set_attr "mode" "XI")])
15595 (define_insn "avx2_<code>v4qiv4di2<mask_name>"
15596 [(set (match_operand:V4DI 0 "register_operand" "=v")
15599 (match_operand:V16QI 1 "nonimmediate_operand" "vm")
15600 (parallel [(const_int 0) (const_int 1)
15601 (const_int 2) (const_int 3)]))))]
15602 "TARGET_AVX2 && <mask_avx512vl_condition>"
15603 "vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
15604 [(set_attr "type" "ssemov")
15605 (set_attr "prefix_extra" "1")
15606 (set_attr "prefix" "maybe_evex")
15607 (set_attr "mode" "OI")])
15609 (define_insn "sse4_1_<code>v2qiv2di2<mask_name>"
15610 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
15613 (match_operand:V16QI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15614 (parallel [(const_int 0) (const_int 1)]))))]
15615 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15616 "%vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %w1}"
15617 [(set_attr "isa" "noavx,noavx,avx")
15618 (set_attr "type" "ssemov")
15619 (set_attr "prefix_extra" "1")
15620 (set_attr "prefix" "orig,orig,maybe_evex")
15621 (set_attr "mode" "TI")])
15623 (define_insn "avx512f_<code>v8hiv8di2<mask_name>"
15624 [(set (match_operand:V8DI 0 "register_operand" "=v")
15626 (match_operand:V8HI 1 "nonimmediate_operand" "vm")))]
15628 "vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15629 [(set_attr "type" "ssemov")
15630 (set_attr "prefix" "evex")
15631 (set_attr "mode" "XI")])
15633 (define_insn "avx2_<code>v4hiv4di2<mask_name>"
15634 [(set (match_operand:V4DI 0 "register_operand" "=v")
15637 (match_operand:V8HI 1 "nonimmediate_operand" "vm")
15638 (parallel [(const_int 0) (const_int 1)
15639 (const_int 2) (const_int 3)]))))]
15640 "TARGET_AVX2 && <mask_avx512vl_condition>"
15641 "vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15642 [(set_attr "type" "ssemov")
15643 (set_attr "prefix_extra" "1")
15644 (set_attr "prefix" "maybe_evex")
15645 (set_attr "mode" "OI")])
15647 (define_insn "sse4_1_<code>v2hiv2di2<mask_name>"
15648 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
15651 (match_operand:V8HI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15652 (parallel [(const_int 0) (const_int 1)]))))]
15653 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15654 "%vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
15655 [(set_attr "isa" "noavx,noavx,avx")
15656 (set_attr "type" "ssemov")
15657 (set_attr "prefix_extra" "1")
15658 (set_attr "prefix" "orig,orig,maybe_evex")
15659 (set_attr "mode" "TI")])
15661 (define_insn "avx512f_<code>v8siv8di2<mask_name>"
15662 [(set (match_operand:V8DI 0 "register_operand" "=v")
15664 (match_operand:V8SI 1 "nonimmediate_operand" "vm")))]
15666 "vpmov<extsuffix>dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15667 [(set_attr "type" "ssemov")
15668 (set_attr "prefix" "evex")
15669 (set_attr "mode" "XI")])
15671 (define_insn "avx2_<code>v4siv4di2<mask_name>"
15672 [(set (match_operand:V4DI 0 "register_operand" "=v")
15674 (match_operand:V4SI 1 "nonimmediate_operand" "vm")))]
15675 "TARGET_AVX2 && <mask_avx512vl_condition>"
15676 "vpmov<extsuffix>dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15677 [(set_attr "type" "ssemov")
15678 (set_attr "prefix" "maybe_evex")
15679 (set_attr "prefix_extra" "1")
15680 (set_attr "mode" "OI")])
15682 (define_insn "sse4_1_<code>v2siv2di2<mask_name>"
15683 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
15686 (match_operand:V4SI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15687 (parallel [(const_int 0) (const_int 1)]))))]
15688 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15689 "%vpmov<extsuffix>dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15690 [(set_attr "isa" "noavx,noavx,avx")
15691 (set_attr "type" "ssemov")
15692 (set_attr "prefix_extra" "1")
15693 (set_attr "prefix" "orig,orig,maybe_evex")
15694 (set_attr "mode" "TI")])
15696 ;; ptestps/ptestpd are very similar to comiss and ucomiss when
15697 ;; setting FLAGS_REG. But it is not a really compare instruction.
15698 (define_insn "avx_vtest<ssemodesuffix><avxsizesuffix>"
15699 [(set (reg:CC FLAGS_REG)
15700 (unspec:CC [(match_operand:VF_128_256 0 "register_operand" "x")
15701 (match_operand:VF_128_256 1 "nonimmediate_operand" "xm")]
15704 "vtest<ssemodesuffix>\t{%1, %0|%0, %1}"
15705 [(set_attr "type" "ssecomi")
15706 (set_attr "prefix_extra" "1")
15707 (set_attr "prefix" "vex")
15708 (set_attr "mode" "<MODE>")])
15710 ;; ptest is very similar to comiss and ucomiss when setting FLAGS_REG.
15711 ;; But it is not a really compare instruction.
15712 (define_insn "<sse4_1>_ptest<mode>"
15713 [(set (reg:CC FLAGS_REG)
15714 (unspec:CC [(match_operand:V_AVX 0 "register_operand" "Yr, *x, x")
15715 (match_operand:V_AVX 1 "vector_operand" "YrBm, *xBm, xm")]
15718 "%vptest\t{%1, %0|%0, %1}"
15719 [(set_attr "isa" "noavx,noavx,avx")
15720 (set_attr "type" "ssecomi")
15721 (set_attr "prefix_extra" "1")
15722 (set_attr "prefix" "orig,orig,vex")
15723 (set (attr "btver2_decode")
15725 (match_test "<sseinsnmode>mode==OImode")
15726 (const_string "vector")
15727 (const_string "*")))
15728 (set_attr "mode" "<sseinsnmode>")])
15730 (define_insn "ptesttf2"
15731 [(set (reg:CC FLAGS_REG)
15732 (unspec:CC [(match_operand:TF 0 "register_operand" "Yr, *x, x")
15733 (match_operand:TF 1 "vector_operand" "YrBm, *xBm, xm")]
15736 "%vptest\t{%1, %0|%0, %1}"
15737 [(set_attr "isa" "noavx,noavx,avx")
15738 (set_attr "type" "ssecomi")
15739 (set_attr "prefix_extra" "1")
15740 (set_attr "prefix" "orig,orig,vex")
15741 (set_attr "mode" "TI")])
15743 (define_insn "<sse4_1>_round<ssemodesuffix><avxsizesuffix>"
15744 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
15746 [(match_operand:VF_128_256 1 "vector_operand" "YrBm,*xBm,xm")
15747 (match_operand:SI 2 "const_0_to_15_operand" "n,n,n")]
15750 "%vround<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
15751 [(set_attr "isa" "noavx,noavx,avx")
15752 (set_attr "type" "ssecvt")
15753 (set_attr "prefix_data16" "1,1,*")
15754 (set_attr "prefix_extra" "1")
15755 (set_attr "length_immediate" "1")
15756 (set_attr "prefix" "orig,orig,vex")
15757 (set_attr "mode" "<MODE>")])
15759 (define_expand "<sse4_1>_round<ssemodesuffix>_sfix<avxsizesuffix>"
15760 [(match_operand:<sseintvecmode> 0 "register_operand")
15761 (match_operand:VF1_128_256 1 "vector_operand")
15762 (match_operand:SI 2 "const_0_to_15_operand")]
15765 rtx tmp = gen_reg_rtx (<MODE>mode);
15768 (gen_<sse4_1>_round<ssemodesuffix><avxsizesuffix> (tmp, operands[1],
15771 (gen_fix_trunc<mode><sseintvecmodelower>2 (operands[0], tmp));
15775 (define_expand "avx512f_round<castmode>512"
15776 [(match_operand:VF_512 0 "register_operand")
15777 (match_operand:VF_512 1 "nonimmediate_operand")
15778 (match_operand:SI 2 "const_0_to_15_operand")]
15781 emit_insn (gen_avx512f_rndscale<mode> (operands[0], operands[1], operands[2]));
15785 (define_expand "avx512f_roundps512_sfix"
15786 [(match_operand:V16SI 0 "register_operand")
15787 (match_operand:V16SF 1 "nonimmediate_operand")
15788 (match_operand:SI 2 "const_0_to_15_operand")]
15791 rtx tmp = gen_reg_rtx (V16SFmode);
15792 emit_insn (gen_avx512f_rndscalev16sf (tmp, operands[1], operands[2]));
15793 emit_insn (gen_fix_truncv16sfv16si2 (operands[0], tmp));
15797 (define_expand "<sse4_1>_round<ssemodesuffix>_vec_pack_sfix<avxsizesuffix>"
15798 [(match_operand:<ssepackfltmode> 0 "register_operand")
15799 (match_operand:VF2 1 "vector_operand")
15800 (match_operand:VF2 2 "vector_operand")
15801 (match_operand:SI 3 "const_0_to_15_operand")]
15806 if (<MODE>mode == V2DFmode
15807 && TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
15809 rtx tmp2 = gen_reg_rtx (V4DFmode);
15811 tmp0 = gen_reg_rtx (V4DFmode);
15812 tmp1 = force_reg (V2DFmode, operands[1]);
15814 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
15815 emit_insn (gen_avx_roundpd256 (tmp2, tmp0, operands[3]));
15816 emit_insn (gen_fix_truncv4dfv4si2 (operands[0], tmp2));
15820 tmp0 = gen_reg_rtx (<MODE>mode);
15821 tmp1 = gen_reg_rtx (<MODE>mode);
15824 (gen_<sse4_1>_round<ssemodesuffix><avxsizesuffix> (tmp0, operands[1],
15827 (gen_<sse4_1>_round<ssemodesuffix><avxsizesuffix> (tmp1, operands[2],
15830 (gen_vec_pack_sfix_trunc_<mode> (operands[0], tmp0, tmp1));
15835 (define_insn "sse4_1_round<ssescalarmodesuffix>"
15836 [(set (match_operand:VF_128 0 "register_operand" "=Yr,*x,x,v")
15839 [(match_operand:VF_128 2 "register_operand" "Yr,*x,x,v")
15840 (match_operand:SI 3 "const_0_to_15_operand" "n,n,n,n")]
15842 (match_operand:VF_128 1 "register_operand" "0,0,x,v")
15846 round<ssescalarmodesuffix>\t{%3, %2, %0|%0, %2, %3}
15847 round<ssescalarmodesuffix>\t{%3, %2, %0|%0, %2, %3}
15848 vround<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
15849 vrndscale<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15850 [(set_attr "isa" "noavx,noavx,avx,avx512f")
15851 (set_attr "type" "ssecvt")
15852 (set_attr "length_immediate" "1")
15853 (set_attr "prefix_data16" "1,1,*,*")
15854 (set_attr "prefix_extra" "1")
15855 (set_attr "prefix" "orig,orig,vex,evex")
15856 (set_attr "mode" "<MODE>")])
15858 (define_expand "round<mode>2"
15859 [(set (match_dup 3)
15861 (match_operand:VF 1 "register_operand")
15863 (set (match_operand:VF 0 "register_operand")
15865 [(match_dup 3) (match_dup 4)]
15867 "TARGET_SSE4_1 && !flag_trapping_math"
15869 machine_mode scalar_mode;
15870 const struct real_format *fmt;
15871 REAL_VALUE_TYPE pred_half, half_minus_pred_half;
15872 rtx half, vec_half;
15874 scalar_mode = GET_MODE_INNER (<MODE>mode);
15876 /* load nextafter (0.5, 0.0) */
15877 fmt = REAL_MODE_FORMAT (scalar_mode);
15878 real_2expN (&half_minus_pred_half, -(fmt->p) - 1, scalar_mode);
15879 real_arithmetic (&pred_half, MINUS_EXPR, &dconsthalf, &half_minus_pred_half);
15880 half = const_double_from_real_value (pred_half, scalar_mode);
15882 vec_half = ix86_build_const_vector (<MODE>mode, true, half);
15883 vec_half = force_reg (<MODE>mode, vec_half);
15885 operands[2] = gen_reg_rtx (<MODE>mode);
15886 emit_insn (gen_copysign<mode>3 (operands[2], vec_half, operands[1]));
15888 operands[3] = gen_reg_rtx (<MODE>mode);
15889 operands[4] = GEN_INT (ROUND_TRUNC);
15892 (define_expand "round<mode>2_sfix"
15893 [(match_operand:<sseintvecmode> 0 "register_operand")
15894 (match_operand:VF1 1 "register_operand")]
15895 "TARGET_SSE4_1 && !flag_trapping_math"
15897 rtx tmp = gen_reg_rtx (<MODE>mode);
15899 emit_insn (gen_round<mode>2 (tmp, operands[1]));
15902 (gen_fix_trunc<mode><sseintvecmodelower>2 (operands[0], tmp));
15906 (define_expand "round<mode>2_vec_pack_sfix"
15907 [(match_operand:<ssepackfltmode> 0 "register_operand")
15908 (match_operand:VF2 1 "register_operand")
15909 (match_operand:VF2 2 "register_operand")]
15910 "TARGET_SSE4_1 && !flag_trapping_math"
15914 if (<MODE>mode == V2DFmode
15915 && TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
15917 rtx tmp2 = gen_reg_rtx (V4DFmode);
15919 tmp0 = gen_reg_rtx (V4DFmode);
15920 tmp1 = force_reg (V2DFmode, operands[1]);
15922 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
15923 emit_insn (gen_roundv4df2 (tmp2, tmp0));
15924 emit_insn (gen_fix_truncv4dfv4si2 (operands[0], tmp2));
15928 tmp0 = gen_reg_rtx (<MODE>mode);
15929 tmp1 = gen_reg_rtx (<MODE>mode);
15931 emit_insn (gen_round<mode>2 (tmp0, operands[1]));
15932 emit_insn (gen_round<mode>2 (tmp1, operands[2]));
15935 (gen_vec_pack_sfix_trunc_<mode> (operands[0], tmp0, tmp1));
15940 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15942 ;; Intel SSE4.2 string/text processing instructions
15944 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15946 (define_insn_and_split "sse4_2_pcmpestr"
15947 [(set (match_operand:SI 0 "register_operand" "=c,c")
15949 [(match_operand:V16QI 2 "register_operand" "x,x")
15950 (match_operand:SI 3 "register_operand" "a,a")
15951 (match_operand:V16QI 4 "nonimmediate_operand" "x,m")
15952 (match_operand:SI 5 "register_operand" "d,d")
15953 (match_operand:SI 6 "const_0_to_255_operand" "n,n")]
15955 (set (match_operand:V16QI 1 "register_operand" "=Yz,Yz")
15963 (set (reg:CC FLAGS_REG)
15972 && can_create_pseudo_p ()"
15977 int ecx = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[0]));
15978 int xmm0 = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[1]));
15979 int flags = !find_regno_note (curr_insn, REG_UNUSED, FLAGS_REG);
15982 emit_insn (gen_sse4_2_pcmpestri (operands[0], operands[2],
15983 operands[3], operands[4],
15984 operands[5], operands[6]));
15986 emit_insn (gen_sse4_2_pcmpestrm (operands[1], operands[2],
15987 operands[3], operands[4],
15988 operands[5], operands[6]));
15989 if (flags && !(ecx || xmm0))
15990 emit_insn (gen_sse4_2_pcmpestr_cconly (NULL, NULL,
15991 operands[2], operands[3],
15992 operands[4], operands[5],
15994 if (!(flags || ecx || xmm0))
15995 emit_note (NOTE_INSN_DELETED);
15999 [(set_attr "type" "sselog")
16000 (set_attr "prefix_data16" "1")
16001 (set_attr "prefix_extra" "1")
16002 (set_attr "length_immediate" "1")
16003 (set_attr "memory" "none,load")
16004 (set_attr "mode" "TI")])
16006 (define_insn "sse4_2_pcmpestri"
16007 [(set (match_operand:SI 0 "register_operand" "=c,c")
16009 [(match_operand:V16QI 1 "register_operand" "x,x")
16010 (match_operand:SI 2 "register_operand" "a,a")
16011 (match_operand:V16QI 3 "nonimmediate_operand" "x,m")
16012 (match_operand:SI 4 "register_operand" "d,d")
16013 (match_operand:SI 5 "const_0_to_255_operand" "n,n")]
16015 (set (reg:CC FLAGS_REG)
16024 "%vpcmpestri\t{%5, %3, %1|%1, %3, %5}"
16025 [(set_attr "type" "sselog")
16026 (set_attr "prefix_data16" "1")
16027 (set_attr "prefix_extra" "1")
16028 (set_attr "prefix" "maybe_vex")
16029 (set_attr "length_immediate" "1")
16030 (set_attr "btver2_decode" "vector")
16031 (set_attr "memory" "none,load")
16032 (set_attr "mode" "TI")])
16034 (define_insn "sse4_2_pcmpestrm"
16035 [(set (match_operand:V16QI 0 "register_operand" "=Yz,Yz")
16037 [(match_operand:V16QI 1 "register_operand" "x,x")
16038 (match_operand:SI 2 "register_operand" "a,a")
16039 (match_operand:V16QI 3 "nonimmediate_operand" "x,m")
16040 (match_operand:SI 4 "register_operand" "d,d")
16041 (match_operand:SI 5 "const_0_to_255_operand" "n,n")]
16043 (set (reg:CC FLAGS_REG)
16052 "%vpcmpestrm\t{%5, %3, %1|%1, %3, %5}"
16053 [(set_attr "type" "sselog")
16054 (set_attr "prefix_data16" "1")
16055 (set_attr "prefix_extra" "1")
16056 (set_attr "length_immediate" "1")
16057 (set_attr "prefix" "maybe_vex")
16058 (set_attr "btver2_decode" "vector")
16059 (set_attr "memory" "none,load")
16060 (set_attr "mode" "TI")])
16062 (define_insn "sse4_2_pcmpestr_cconly"
16063 [(set (reg:CC FLAGS_REG)
16065 [(match_operand:V16QI 2 "register_operand" "x,x,x,x")
16066 (match_operand:SI 3 "register_operand" "a,a,a,a")
16067 (match_operand:V16QI 4 "nonimmediate_operand" "x,m,x,m")
16068 (match_operand:SI 5 "register_operand" "d,d,d,d")
16069 (match_operand:SI 6 "const_0_to_255_operand" "n,n,n,n")]
16071 (clobber (match_scratch:V16QI 0 "=Yz,Yz,X,X"))
16072 (clobber (match_scratch:SI 1 "= X, X,c,c"))]
16075 %vpcmpestrm\t{%6, %4, %2|%2, %4, %6}
16076 %vpcmpestrm\t{%6, %4, %2|%2, %4, %6}
16077 %vpcmpestri\t{%6, %4, %2|%2, %4, %6}
16078 %vpcmpestri\t{%6, %4, %2|%2, %4, %6}"
16079 [(set_attr "type" "sselog")
16080 (set_attr "prefix_data16" "1")
16081 (set_attr "prefix_extra" "1")
16082 (set_attr "length_immediate" "1")
16083 (set_attr "memory" "none,load,none,load")
16084 (set_attr "btver2_decode" "vector,vector,vector,vector")
16085 (set_attr "prefix" "maybe_vex")
16086 (set_attr "mode" "TI")])
16088 (define_insn_and_split "sse4_2_pcmpistr"
16089 [(set (match_operand:SI 0 "register_operand" "=c,c")
16091 [(match_operand:V16QI 2 "register_operand" "x,x")
16092 (match_operand:V16QI 3 "nonimmediate_operand" "x,m")
16093 (match_operand:SI 4 "const_0_to_255_operand" "n,n")]
16095 (set (match_operand:V16QI 1 "register_operand" "=Yz,Yz")
16101 (set (reg:CC FLAGS_REG)
16108 && can_create_pseudo_p ()"
16113 int ecx = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[0]));
16114 int xmm0 = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[1]));
16115 int flags = !find_regno_note (curr_insn, REG_UNUSED, FLAGS_REG);
16118 emit_insn (gen_sse4_2_pcmpistri (operands[0], operands[2],
16119 operands[3], operands[4]));
16121 emit_insn (gen_sse4_2_pcmpistrm (operands[1], operands[2],
16122 operands[3], operands[4]));
16123 if (flags && !(ecx || xmm0))
16124 emit_insn (gen_sse4_2_pcmpistr_cconly (NULL, NULL,
16125 operands[2], operands[3],
16127 if (!(flags || ecx || xmm0))
16128 emit_note (NOTE_INSN_DELETED);
16132 [(set_attr "type" "sselog")
16133 (set_attr "prefix_data16" "1")
16134 (set_attr "prefix_extra" "1")
16135 (set_attr "length_immediate" "1")
16136 (set_attr "memory" "none,load")
16137 (set_attr "mode" "TI")])
16139 (define_insn "sse4_2_pcmpistri"
16140 [(set (match_operand:SI 0 "register_operand" "=c,c")
16142 [(match_operand:V16QI 1 "register_operand" "x,x")
16143 (match_operand:V16QI 2 "nonimmediate_operand" "x,m")
16144 (match_operand:SI 3 "const_0_to_255_operand" "n,n")]
16146 (set (reg:CC FLAGS_REG)
16153 "%vpcmpistri\t{%3, %2, %1|%1, %2, %3}"
16154 [(set_attr "type" "sselog")
16155 (set_attr "prefix_data16" "1")
16156 (set_attr "prefix_extra" "1")
16157 (set_attr "length_immediate" "1")
16158 (set_attr "prefix" "maybe_vex")
16159 (set_attr "memory" "none,load")
16160 (set_attr "btver2_decode" "vector")
16161 (set_attr "mode" "TI")])
16163 (define_insn "sse4_2_pcmpistrm"
16164 [(set (match_operand:V16QI 0 "register_operand" "=Yz,Yz")
16166 [(match_operand:V16QI 1 "register_operand" "x,x")
16167 (match_operand:V16QI 2 "nonimmediate_operand" "x,m")
16168 (match_operand:SI 3 "const_0_to_255_operand" "n,n")]
16170 (set (reg:CC FLAGS_REG)
16177 "%vpcmpistrm\t{%3, %2, %1|%1, %2, %3}"
16178 [(set_attr "type" "sselog")
16179 (set_attr "prefix_data16" "1")
16180 (set_attr "prefix_extra" "1")
16181 (set_attr "length_immediate" "1")
16182 (set_attr "prefix" "maybe_vex")
16183 (set_attr "memory" "none,load")
16184 (set_attr "btver2_decode" "vector")
16185 (set_attr "mode" "TI")])
16187 (define_insn "sse4_2_pcmpistr_cconly"
16188 [(set (reg:CC FLAGS_REG)
16190 [(match_operand:V16QI 2 "register_operand" "x,x,x,x")
16191 (match_operand:V16QI 3 "nonimmediate_operand" "x,m,x,m")
16192 (match_operand:SI 4 "const_0_to_255_operand" "n,n,n,n")]
16194 (clobber (match_scratch:V16QI 0 "=Yz,Yz,X,X"))
16195 (clobber (match_scratch:SI 1 "= X, X,c,c"))]
16198 %vpcmpistrm\t{%4, %3, %2|%2, %3, %4}
16199 %vpcmpistrm\t{%4, %3, %2|%2, %3, %4}
16200 %vpcmpistri\t{%4, %3, %2|%2, %3, %4}
16201 %vpcmpistri\t{%4, %3, %2|%2, %3, %4}"
16202 [(set_attr "type" "sselog")
16203 (set_attr "prefix_data16" "1")
16204 (set_attr "prefix_extra" "1")
16205 (set_attr "length_immediate" "1")
16206 (set_attr "memory" "none,load,none,load")
16207 (set_attr "prefix" "maybe_vex")
16208 (set_attr "btver2_decode" "vector,vector,vector,vector")
16209 (set_attr "mode" "TI")])
16211 ;; Packed float variants
16212 (define_mode_attr GATHER_SCATTER_SF_MEM_MODE
16213 [(V8DI "V8SF") (V16SI "V16SF")])
16215 (define_expand "avx512pf_gatherpf<mode>sf"
16217 [(match_operand:<avx512fmaskmode> 0 "register_operand")
16218 (mem:<GATHER_SCATTER_SF_MEM_MODE>
16220 [(match_operand 2 "vsib_address_operand")
16221 (match_operand:VI48_512 1 "register_operand")
16222 (match_operand:SI 3 "const1248_operand")]))
16223 (match_operand:SI 4 "const_2_to_3_operand")]
16224 UNSPEC_GATHER_PREFETCH)]
16228 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
16229 operands[3]), UNSPEC_VSIBADDR);
16232 (define_insn "*avx512pf_gatherpf<mode>sf_mask"
16234 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
16235 (match_operator:<GATHER_SCATTER_SF_MEM_MODE> 5 "vsib_mem_operator"
16237 [(match_operand:P 2 "vsib_address_operand" "Tv")
16238 (match_operand:VI48_512 1 "register_operand" "v")
16239 (match_operand:SI 3 "const1248_operand" "n")]
16241 (match_operand:SI 4 "const_2_to_3_operand" "n")]
16242 UNSPEC_GATHER_PREFETCH)]
16245 switch (INTVAL (operands[4]))
16248 return "vgatherpf0<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
16250 return "vgatherpf1<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
16252 gcc_unreachable ();
16255 [(set_attr "type" "sse")
16256 (set_attr "prefix" "evex")
16257 (set_attr "mode" "XI")])
16259 ;; Packed double variants
16260 (define_expand "avx512pf_gatherpf<mode>df"
16262 [(match_operand:<avx512fmaskmode> 0 "register_operand")
16265 [(match_operand 2 "vsib_address_operand")
16266 (match_operand:VI4_256_8_512 1 "register_operand")
16267 (match_operand:SI 3 "const1248_operand")]))
16268 (match_operand:SI 4 "const_2_to_3_operand")]
16269 UNSPEC_GATHER_PREFETCH)]
16273 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
16274 operands[3]), UNSPEC_VSIBADDR);
16277 (define_insn "*avx512pf_gatherpf<mode>df_mask"
16279 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
16280 (match_operator:V8DF 5 "vsib_mem_operator"
16282 [(match_operand:P 2 "vsib_address_operand" "Tv")
16283 (match_operand:VI4_256_8_512 1 "register_operand" "v")
16284 (match_operand:SI 3 "const1248_operand" "n")]
16286 (match_operand:SI 4 "const_2_to_3_operand" "n")]
16287 UNSPEC_GATHER_PREFETCH)]
16290 switch (INTVAL (operands[4]))
16293 return "vgatherpf0<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
16295 return "vgatherpf1<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
16297 gcc_unreachable ();
16300 [(set_attr "type" "sse")
16301 (set_attr "prefix" "evex")
16302 (set_attr "mode" "XI")])
16304 ;; Packed float variants
16305 (define_expand "avx512pf_scatterpf<mode>sf"
16307 [(match_operand:<avx512fmaskmode> 0 "register_operand")
16308 (mem:<GATHER_SCATTER_SF_MEM_MODE>
16310 [(match_operand 2 "vsib_address_operand")
16311 (match_operand:VI48_512 1 "register_operand")
16312 (match_operand:SI 3 "const1248_operand")]))
16313 (match_operand:SI 4 "const2367_operand")]
16314 UNSPEC_SCATTER_PREFETCH)]
16318 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
16319 operands[3]), UNSPEC_VSIBADDR);
16322 (define_insn "*avx512pf_scatterpf<mode>sf_mask"
16324 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
16325 (match_operator:<GATHER_SCATTER_SF_MEM_MODE> 5 "vsib_mem_operator"
16327 [(match_operand:P 2 "vsib_address_operand" "Tv")
16328 (match_operand:VI48_512 1 "register_operand" "v")
16329 (match_operand:SI 3 "const1248_operand" "n")]
16331 (match_operand:SI 4 "const2367_operand" "n")]
16332 UNSPEC_SCATTER_PREFETCH)]
16335 switch (INTVAL (operands[4]))
16339 return "vscatterpf0<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
16342 return "vscatterpf1<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
16344 gcc_unreachable ();
16347 [(set_attr "type" "sse")
16348 (set_attr "prefix" "evex")
16349 (set_attr "mode" "XI")])
16351 ;; Packed double variants
16352 (define_expand "avx512pf_scatterpf<mode>df"
16354 [(match_operand:<avx512fmaskmode> 0 "register_operand")
16357 [(match_operand 2 "vsib_address_operand")
16358 (match_operand:VI4_256_8_512 1 "register_operand")
16359 (match_operand:SI 3 "const1248_operand")]))
16360 (match_operand:SI 4 "const2367_operand")]
16361 UNSPEC_SCATTER_PREFETCH)]
16365 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
16366 operands[3]), UNSPEC_VSIBADDR);
16369 (define_insn "*avx512pf_scatterpf<mode>df_mask"
16371 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
16372 (match_operator:V8DF 5 "vsib_mem_operator"
16374 [(match_operand:P 2 "vsib_address_operand" "Tv")
16375 (match_operand:VI4_256_8_512 1 "register_operand" "v")
16376 (match_operand:SI 3 "const1248_operand" "n")]
16378 (match_operand:SI 4 "const2367_operand" "n")]
16379 UNSPEC_SCATTER_PREFETCH)]
16382 switch (INTVAL (operands[4]))
16386 return "vscatterpf0<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
16389 return "vscatterpf1<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
16391 gcc_unreachable ();
16394 [(set_attr "type" "sse")
16395 (set_attr "prefix" "evex")
16396 (set_attr "mode" "XI")])
16398 (define_insn "avx512er_exp2<mode><mask_name><round_saeonly_name>"
16399 [(set (match_operand:VF_512 0 "register_operand" "=v")
16401 [(match_operand:VF_512 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16404 "vexp2<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
16405 [(set_attr "prefix" "evex")
16406 (set_attr "type" "sse")
16407 (set_attr "mode" "<MODE>")])
16409 (define_insn "<mask_codefor>avx512er_rcp28<mode><mask_name><round_saeonly_name>"
16410 [(set (match_operand:VF_512 0 "register_operand" "=v")
16412 [(match_operand:VF_512 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16415 "vrcp28<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
16416 [(set_attr "prefix" "evex")
16417 (set_attr "type" "sse")
16418 (set_attr "mode" "<MODE>")])
16420 (define_insn "avx512er_vmrcp28<mode><round_saeonly_name>"
16421 [(set (match_operand:VF_128 0 "register_operand" "=v")
16424 [(match_operand:VF_128 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16426 (match_operand:VF_128 2 "register_operand" "v")
16429 "vrcp28<ssescalarmodesuffix>\t{<round_saeonly_op3>%1, %2, %0|%0, %2, %<iptr>1<round_saeonly_op3>}"
16430 [(set_attr "length_immediate" "1")
16431 (set_attr "prefix" "evex")
16432 (set_attr "type" "sse")
16433 (set_attr "mode" "<MODE>")])
16435 (define_insn "<mask_codefor>avx512er_rsqrt28<mode><mask_name><round_saeonly_name>"
16436 [(set (match_operand:VF_512 0 "register_operand" "=v")
16438 [(match_operand:VF_512 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16441 "vrsqrt28<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
16442 [(set_attr "prefix" "evex")
16443 (set_attr "type" "sse")
16444 (set_attr "mode" "<MODE>")])
16446 (define_insn "avx512er_vmrsqrt28<mode><round_saeonly_name>"
16447 [(set (match_operand:VF_128 0 "register_operand" "=v")
16450 [(match_operand:VF_128 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16452 (match_operand:VF_128 2 "register_operand" "v")
16455 "vrsqrt28<ssescalarmodesuffix>\t{<round_saeonly_op3>%1, %2, %0|%0, %2, %<iptr>1<round_saeonly_op3>}"
16456 [(set_attr "length_immediate" "1")
16457 (set_attr "type" "sse")
16458 (set_attr "prefix" "evex")
16459 (set_attr "mode" "<MODE>")])
16461 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16463 ;; XOP instructions
16465 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16467 (define_code_iterator xop_plus [plus ss_plus])
16469 (define_code_attr macs [(plus "macs") (ss_plus "macss")])
16470 (define_code_attr madcs [(plus "madcs") (ss_plus "madcss")])
16472 ;; XOP parallel integer multiply/add instructions.
16474 (define_insn "xop_p<macs><ssemodesuffix><ssemodesuffix>"
16475 [(set (match_operand:VI24_128 0 "register_operand" "=x")
16478 (match_operand:VI24_128 1 "nonimmediate_operand" "%x")
16479 (match_operand:VI24_128 2 "nonimmediate_operand" "xm"))
16480 (match_operand:VI24_128 3 "register_operand" "x")))]
16482 "vp<macs><ssemodesuffix><ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16483 [(set_attr "type" "ssemuladd")
16484 (set_attr "mode" "TI")])
16486 (define_insn "xop_p<macs>dql"
16487 [(set (match_operand:V2DI 0 "register_operand" "=x")
16492 (match_operand:V4SI 1 "nonimmediate_operand" "%x")
16493 (parallel [(const_int 0) (const_int 2)])))
16496 (match_operand:V4SI 2 "nonimmediate_operand" "xm")
16497 (parallel [(const_int 0) (const_int 2)]))))
16498 (match_operand:V2DI 3 "register_operand" "x")))]
16500 "vp<macs>dql\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16501 [(set_attr "type" "ssemuladd")
16502 (set_attr "mode" "TI")])
16504 (define_insn "xop_p<macs>dqh"
16505 [(set (match_operand:V2DI 0 "register_operand" "=x")
16510 (match_operand:V4SI 1 "nonimmediate_operand" "%x")
16511 (parallel [(const_int 1) (const_int 3)])))
16514 (match_operand:V4SI 2 "nonimmediate_operand" "xm")
16515 (parallel [(const_int 1) (const_int 3)]))))
16516 (match_operand:V2DI 3 "register_operand" "x")))]
16518 "vp<macs>dqh\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16519 [(set_attr "type" "ssemuladd")
16520 (set_attr "mode" "TI")])
16522 ;; XOP parallel integer multiply/add instructions for the intrinisics
16523 (define_insn "xop_p<macs>wd"
16524 [(set (match_operand:V4SI 0 "register_operand" "=x")
16529 (match_operand:V8HI 1 "nonimmediate_operand" "%x")
16530 (parallel [(const_int 1) (const_int 3)
16531 (const_int 5) (const_int 7)])))
16534 (match_operand:V8HI 2 "nonimmediate_operand" "xm")
16535 (parallel [(const_int 1) (const_int 3)
16536 (const_int 5) (const_int 7)]))))
16537 (match_operand:V4SI 3 "register_operand" "x")))]
16539 "vp<macs>wd\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16540 [(set_attr "type" "ssemuladd")
16541 (set_attr "mode" "TI")])
16543 (define_insn "xop_p<madcs>wd"
16544 [(set (match_operand:V4SI 0 "register_operand" "=x")
16550 (match_operand:V8HI 1 "nonimmediate_operand" "%x")
16551 (parallel [(const_int 0) (const_int 2)
16552 (const_int 4) (const_int 6)])))
16555 (match_operand:V8HI 2 "nonimmediate_operand" "xm")
16556 (parallel [(const_int 0) (const_int 2)
16557 (const_int 4) (const_int 6)]))))
16562 (parallel [(const_int 1) (const_int 3)
16563 (const_int 5) (const_int 7)])))
16567 (parallel [(const_int 1) (const_int 3)
16568 (const_int 5) (const_int 7)])))))
16569 (match_operand:V4SI 3 "register_operand" "x")))]
16571 "vp<madcs>wd\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16572 [(set_attr "type" "ssemuladd")
16573 (set_attr "mode" "TI")])
16575 ;; XOP parallel XMM conditional moves
16576 (define_insn "xop_pcmov_<mode><avxsizesuffix>"
16577 [(set (match_operand:V_128_256 0 "register_operand" "=x,x")
16578 (if_then_else:V_128_256
16579 (match_operand:V_128_256 3 "nonimmediate_operand" "x,m")
16580 (match_operand:V_128_256 1 "register_operand" "x,x")
16581 (match_operand:V_128_256 2 "nonimmediate_operand" "xm,x")))]
16583 "vpcmov\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16584 [(set_attr "type" "sse4arg")])
16586 ;; XOP horizontal add/subtract instructions
16587 (define_insn "xop_phadd<u>bw"
16588 [(set (match_operand:V8HI 0 "register_operand" "=x")
16592 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
16593 (parallel [(const_int 0) (const_int 2)
16594 (const_int 4) (const_int 6)
16595 (const_int 8) (const_int 10)
16596 (const_int 12) (const_int 14)])))
16600 (parallel [(const_int 1) (const_int 3)
16601 (const_int 5) (const_int 7)
16602 (const_int 9) (const_int 11)
16603 (const_int 13) (const_int 15)])))))]
16605 "vphadd<u>bw\t{%1, %0|%0, %1}"
16606 [(set_attr "type" "sseiadd1")])
16608 (define_insn "xop_phadd<u>bd"
16609 [(set (match_operand:V4SI 0 "register_operand" "=x")
16614 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
16615 (parallel [(const_int 0) (const_int 4)
16616 (const_int 8) (const_int 12)])))
16620 (parallel [(const_int 1) (const_int 5)
16621 (const_int 9) (const_int 13)]))))
16626 (parallel [(const_int 2) (const_int 6)
16627 (const_int 10) (const_int 14)])))
16631 (parallel [(const_int 3) (const_int 7)
16632 (const_int 11) (const_int 15)]))))))]
16634 "vphadd<u>bd\t{%1, %0|%0, %1}"
16635 [(set_attr "type" "sseiadd1")])
16637 (define_insn "xop_phadd<u>bq"
16638 [(set (match_operand:V2DI 0 "register_operand" "=x")
16644 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
16645 (parallel [(const_int 0) (const_int 8)])))
16649 (parallel [(const_int 1) (const_int 9)]))))
16654 (parallel [(const_int 2) (const_int 10)])))
16658 (parallel [(const_int 3) (const_int 11)])))))
16664 (parallel [(const_int 4) (const_int 12)])))
16668 (parallel [(const_int 5) (const_int 13)]))))
16673 (parallel [(const_int 6) (const_int 14)])))
16677 (parallel [(const_int 7) (const_int 15)])))))))]
16679 "vphadd<u>bq\t{%1, %0|%0, %1}"
16680 [(set_attr "type" "sseiadd1")])
16682 (define_insn "xop_phadd<u>wd"
16683 [(set (match_operand:V4SI 0 "register_operand" "=x")
16687 (match_operand:V8HI 1 "nonimmediate_operand" "xm")
16688 (parallel [(const_int 0) (const_int 2)
16689 (const_int 4) (const_int 6)])))
16693 (parallel [(const_int 1) (const_int 3)
16694 (const_int 5) (const_int 7)])))))]
16696 "vphadd<u>wd\t{%1, %0|%0, %1}"
16697 [(set_attr "type" "sseiadd1")])
16699 (define_insn "xop_phadd<u>wq"
16700 [(set (match_operand:V2DI 0 "register_operand" "=x")
16705 (match_operand:V8HI 1 "nonimmediate_operand" "xm")
16706 (parallel [(const_int 0) (const_int 4)])))
16710 (parallel [(const_int 1) (const_int 5)]))))
16715 (parallel [(const_int 2) (const_int 6)])))
16719 (parallel [(const_int 3) (const_int 7)]))))))]
16721 "vphadd<u>wq\t{%1, %0|%0, %1}"
16722 [(set_attr "type" "sseiadd1")])
16724 (define_insn "xop_phadd<u>dq"
16725 [(set (match_operand:V2DI 0 "register_operand" "=x")
16729 (match_operand:V4SI 1 "nonimmediate_operand" "xm")
16730 (parallel [(const_int 0) (const_int 2)])))
16734 (parallel [(const_int 1) (const_int 3)])))))]
16736 "vphadd<u>dq\t{%1, %0|%0, %1}"
16737 [(set_attr "type" "sseiadd1")])
16739 (define_insn "xop_phsubbw"
16740 [(set (match_operand:V8HI 0 "register_operand" "=x")
16744 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
16745 (parallel [(const_int 0) (const_int 2)
16746 (const_int 4) (const_int 6)
16747 (const_int 8) (const_int 10)
16748 (const_int 12) (const_int 14)])))
16752 (parallel [(const_int 1) (const_int 3)
16753 (const_int 5) (const_int 7)
16754 (const_int 9) (const_int 11)
16755 (const_int 13) (const_int 15)])))))]
16757 "vphsubbw\t{%1, %0|%0, %1}"
16758 [(set_attr "type" "sseiadd1")])
16760 (define_insn "xop_phsubwd"
16761 [(set (match_operand:V4SI 0 "register_operand" "=x")
16765 (match_operand:V8HI 1 "nonimmediate_operand" "xm")
16766 (parallel [(const_int 0) (const_int 2)
16767 (const_int 4) (const_int 6)])))
16771 (parallel [(const_int 1) (const_int 3)
16772 (const_int 5) (const_int 7)])))))]
16774 "vphsubwd\t{%1, %0|%0, %1}"
16775 [(set_attr "type" "sseiadd1")])
16777 (define_insn "xop_phsubdq"
16778 [(set (match_operand:V2DI 0 "register_operand" "=x")
16782 (match_operand:V4SI 1 "nonimmediate_operand" "xm")
16783 (parallel [(const_int 0) (const_int 2)])))
16787 (parallel [(const_int 1) (const_int 3)])))))]
16789 "vphsubdq\t{%1, %0|%0, %1}"
16790 [(set_attr "type" "sseiadd1")])
16792 ;; XOP permute instructions
16793 (define_insn "xop_pperm"
16794 [(set (match_operand:V16QI 0 "register_operand" "=x,x")
16796 [(match_operand:V16QI 1 "register_operand" "x,x")
16797 (match_operand:V16QI 2 "nonimmediate_operand" "x,m")
16798 (match_operand:V16QI 3 "nonimmediate_operand" "xm,x")]
16799 UNSPEC_XOP_PERMUTE))]
16800 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
16801 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16802 [(set_attr "type" "sse4arg")
16803 (set_attr "mode" "TI")])
16805 ;; XOP pack instructions that combine two vectors into a smaller vector
16806 (define_insn "xop_pperm_pack_v2di_v4si"
16807 [(set (match_operand:V4SI 0 "register_operand" "=x,x")
16810 (match_operand:V2DI 1 "register_operand" "x,x"))
16812 (match_operand:V2DI 2 "nonimmediate_operand" "x,m"))))
16813 (use (match_operand:V16QI 3 "nonimmediate_operand" "xm,x"))]
16814 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
16815 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16816 [(set_attr "type" "sse4arg")
16817 (set_attr "mode" "TI")])
16819 (define_insn "xop_pperm_pack_v4si_v8hi"
16820 [(set (match_operand:V8HI 0 "register_operand" "=x,x")
16823 (match_operand:V4SI 1 "register_operand" "x,x"))
16825 (match_operand:V4SI 2 "nonimmediate_operand" "x,m"))))
16826 (use (match_operand:V16QI 3 "nonimmediate_operand" "xm,x"))]
16827 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
16828 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16829 [(set_attr "type" "sse4arg")
16830 (set_attr "mode" "TI")])
16832 (define_insn "xop_pperm_pack_v8hi_v16qi"
16833 [(set (match_operand:V16QI 0 "register_operand" "=x,x")
16836 (match_operand:V8HI 1 "register_operand" "x,x"))
16838 (match_operand:V8HI 2 "nonimmediate_operand" "x,m"))))
16839 (use (match_operand:V16QI 3 "nonimmediate_operand" "xm,x"))]
16840 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
16841 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16842 [(set_attr "type" "sse4arg")
16843 (set_attr "mode" "TI")])
16845 ;; XOP packed rotate instructions
16846 (define_expand "rotl<mode>3"
16847 [(set (match_operand:VI_128 0 "register_operand")
16849 (match_operand:VI_128 1 "nonimmediate_operand")
16850 (match_operand:SI 2 "general_operand")))]
16853 /* If we were given a scalar, convert it to parallel */
16854 if (! const_0_to_<sserotatemax>_operand (operands[2], SImode))
16856 rtvec vs = rtvec_alloc (<ssescalarnum>);
16857 rtx par = gen_rtx_PARALLEL (<MODE>mode, vs);
16858 rtx reg = gen_reg_rtx (<MODE>mode);
16859 rtx op2 = operands[2];
16862 if (GET_MODE (op2) != <ssescalarmode>mode)
16864 op2 = gen_reg_rtx (<ssescalarmode>mode);
16865 convert_move (op2, operands[2], false);
16868 for (i = 0; i < <ssescalarnum>; i++)
16869 RTVEC_ELT (vs, i) = op2;
16871 emit_insn (gen_vec_init<mode><ssescalarmodelower> (reg, par));
16872 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], reg));
16877 (define_expand "rotr<mode>3"
16878 [(set (match_operand:VI_128 0 "register_operand")
16880 (match_operand:VI_128 1 "nonimmediate_operand")
16881 (match_operand:SI 2 "general_operand")))]
16884 /* If we were given a scalar, convert it to parallel */
16885 if (! const_0_to_<sserotatemax>_operand (operands[2], SImode))
16887 rtvec vs = rtvec_alloc (<ssescalarnum>);
16888 rtx par = gen_rtx_PARALLEL (<MODE>mode, vs);
16889 rtx neg = gen_reg_rtx (<MODE>mode);
16890 rtx reg = gen_reg_rtx (<MODE>mode);
16891 rtx op2 = operands[2];
16894 if (GET_MODE (op2) != <ssescalarmode>mode)
16896 op2 = gen_reg_rtx (<ssescalarmode>mode);
16897 convert_move (op2, operands[2], false);
16900 for (i = 0; i < <ssescalarnum>; i++)
16901 RTVEC_ELT (vs, i) = op2;
16903 emit_insn (gen_vec_init<mode><ssescalarmodelower> (reg, par));
16904 emit_insn (gen_neg<mode>2 (neg, reg));
16905 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], neg));
16910 (define_insn "xop_rotl<mode>3"
16911 [(set (match_operand:VI_128 0 "register_operand" "=x")
16913 (match_operand:VI_128 1 "nonimmediate_operand" "xm")
16914 (match_operand:SI 2 "const_0_to_<sserotatemax>_operand" "n")))]
16916 "vprot<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
16917 [(set_attr "type" "sseishft")
16918 (set_attr "length_immediate" "1")
16919 (set_attr "mode" "TI")])
16921 (define_insn "xop_rotr<mode>3"
16922 [(set (match_operand:VI_128 0 "register_operand" "=x")
16924 (match_operand:VI_128 1 "nonimmediate_operand" "xm")
16925 (match_operand:SI 2 "const_0_to_<sserotatemax>_operand" "n")))]
16929 = GEN_INT (GET_MODE_BITSIZE (<ssescalarmode>mode) - INTVAL (operands[2]));
16930 return \"vprot<ssemodesuffix>\t{%3, %1, %0|%0, %1, %3}\";
16932 [(set_attr "type" "sseishft")
16933 (set_attr "length_immediate" "1")
16934 (set_attr "mode" "TI")])
16936 (define_expand "vrotr<mode>3"
16937 [(match_operand:VI_128 0 "register_operand")
16938 (match_operand:VI_128 1 "register_operand")
16939 (match_operand:VI_128 2 "register_operand")]
16942 rtx reg = gen_reg_rtx (<MODE>mode);
16943 emit_insn (gen_neg<mode>2 (reg, operands[2]));
16944 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], reg));
16948 (define_expand "vrotl<mode>3"
16949 [(match_operand:VI_128 0 "register_operand")
16950 (match_operand:VI_128 1 "register_operand")
16951 (match_operand:VI_128 2 "register_operand")]
16954 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], operands[2]));
16958 (define_insn "xop_vrotl<mode>3"
16959 [(set (match_operand:VI_128 0 "register_operand" "=x,x")
16960 (if_then_else:VI_128
16962 (match_operand:VI_128 2 "nonimmediate_operand" "x,m")
16965 (match_operand:VI_128 1 "nonimmediate_operand" "xm,x")
16969 (neg:VI_128 (match_dup 2)))))]
16970 "TARGET_XOP && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
16971 "vprot<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
16972 [(set_attr "type" "sseishft")
16973 (set_attr "prefix_data16" "0")
16974 (set_attr "prefix_extra" "2")
16975 (set_attr "mode" "TI")])
16977 ;; XOP packed shift instructions.
16978 (define_expand "vlshr<mode>3"
16979 [(set (match_operand:VI12_128 0 "register_operand")
16981 (match_operand:VI12_128 1 "register_operand")
16982 (match_operand:VI12_128 2 "nonimmediate_operand")))]
16985 rtx neg = gen_reg_rtx (<MODE>mode);
16986 emit_insn (gen_neg<mode>2 (neg, operands[2]));
16987 emit_insn (gen_xop_shl<mode>3 (operands[0], operands[1], neg));
16991 (define_expand "vlshr<mode>3"
16992 [(set (match_operand:VI48_128 0 "register_operand")
16994 (match_operand:VI48_128 1 "register_operand")
16995 (match_operand:VI48_128 2 "nonimmediate_operand")))]
16996 "TARGET_AVX2 || TARGET_XOP"
17000 rtx neg = gen_reg_rtx (<MODE>mode);
17001 emit_insn (gen_neg<mode>2 (neg, operands[2]));
17002 emit_insn (gen_xop_shl<mode>3 (operands[0], operands[1], neg));
17007 (define_expand "vlshr<mode>3"
17008 [(set (match_operand:VI48_512 0 "register_operand")
17010 (match_operand:VI48_512 1 "register_operand")
17011 (match_operand:VI48_512 2 "nonimmediate_operand")))]
17014 (define_expand "vlshr<mode>3"
17015 [(set (match_operand:VI48_256 0 "register_operand")
17017 (match_operand:VI48_256 1 "register_operand")
17018 (match_operand:VI48_256 2 "nonimmediate_operand")))]
17021 (define_expand "vashrv8hi3<mask_name>"
17022 [(set (match_operand:V8HI 0 "register_operand")
17024 (match_operand:V8HI 1 "register_operand")
17025 (match_operand:V8HI 2 "nonimmediate_operand")))]
17026 "TARGET_XOP || (TARGET_AVX512BW && TARGET_AVX512VL)"
17030 rtx neg = gen_reg_rtx (V8HImode);
17031 emit_insn (gen_negv8hi2 (neg, operands[2]));
17032 emit_insn (gen_xop_shav8hi3 (operands[0], operands[1], neg));
17037 (define_expand "vashrv16qi3"
17038 [(set (match_operand:V16QI 0 "register_operand")
17040 (match_operand:V16QI 1 "register_operand")
17041 (match_operand:V16QI 2 "nonimmediate_operand")))]
17044 rtx neg = gen_reg_rtx (V16QImode);
17045 emit_insn (gen_negv16qi2 (neg, operands[2]));
17046 emit_insn (gen_xop_shav16qi3 (operands[0], operands[1], neg));
17050 (define_expand "vashrv2di3<mask_name>"
17051 [(set (match_operand:V2DI 0 "register_operand")
17053 (match_operand:V2DI 1 "register_operand")
17054 (match_operand:V2DI 2 "nonimmediate_operand")))]
17055 "TARGET_XOP || TARGET_AVX512VL"
17059 rtx neg = gen_reg_rtx (V2DImode);
17060 emit_insn (gen_negv2di2 (neg, operands[2]));
17061 emit_insn (gen_xop_shav2di3 (operands[0], operands[1], neg));
17066 (define_expand "vashrv4si3"
17067 [(set (match_operand:V4SI 0 "register_operand")
17068 (ashiftrt:V4SI (match_operand:V4SI 1 "register_operand")
17069 (match_operand:V4SI 2 "nonimmediate_operand")))]
17070 "TARGET_AVX2 || TARGET_XOP"
17074 rtx neg = gen_reg_rtx (V4SImode);
17075 emit_insn (gen_negv4si2 (neg, operands[2]));
17076 emit_insn (gen_xop_shav4si3 (operands[0], operands[1], neg));
17081 (define_expand "vashrv16si3"
17082 [(set (match_operand:V16SI 0 "register_operand")
17083 (ashiftrt:V16SI (match_operand:V16SI 1 "register_operand")
17084 (match_operand:V16SI 2 "nonimmediate_operand")))]
17087 (define_expand "vashrv8si3"
17088 [(set (match_operand:V8SI 0 "register_operand")
17089 (ashiftrt:V8SI (match_operand:V8SI 1 "register_operand")
17090 (match_operand:V8SI 2 "nonimmediate_operand")))]
17093 (define_expand "vashl<mode>3"
17094 [(set (match_operand:VI12_128 0 "register_operand")
17096 (match_operand:VI12_128 1 "register_operand")
17097 (match_operand:VI12_128 2 "nonimmediate_operand")))]
17100 emit_insn (gen_xop_sha<mode>3 (operands[0], operands[1], operands[2]));
17104 (define_expand "vashl<mode>3"
17105 [(set (match_operand:VI48_128 0 "register_operand")
17107 (match_operand:VI48_128 1 "register_operand")
17108 (match_operand:VI48_128 2 "nonimmediate_operand")))]
17109 "TARGET_AVX2 || TARGET_XOP"
17113 operands[2] = force_reg (<MODE>mode, operands[2]);
17114 emit_insn (gen_xop_sha<mode>3 (operands[0], operands[1], operands[2]));
17119 (define_expand "vashl<mode>3"
17120 [(set (match_operand:VI48_512 0 "register_operand")
17122 (match_operand:VI48_512 1 "register_operand")
17123 (match_operand:VI48_512 2 "nonimmediate_operand")))]
17126 (define_expand "vashl<mode>3"
17127 [(set (match_operand:VI48_256 0 "register_operand")
17129 (match_operand:VI48_256 1 "register_operand")
17130 (match_operand:VI48_256 2 "nonimmediate_operand")))]
17133 (define_insn "xop_sha<mode>3"
17134 [(set (match_operand:VI_128 0 "register_operand" "=x,x")
17135 (if_then_else:VI_128
17137 (match_operand:VI_128 2 "nonimmediate_operand" "x,m")
17140 (match_operand:VI_128 1 "nonimmediate_operand" "xm,x")
17144 (neg:VI_128 (match_dup 2)))))]
17145 "TARGET_XOP && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
17146 "vpsha<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
17147 [(set_attr "type" "sseishft")
17148 (set_attr "prefix_data16" "0")
17149 (set_attr "prefix_extra" "2")
17150 (set_attr "mode" "TI")])
17152 (define_insn "xop_shl<mode>3"
17153 [(set (match_operand:VI_128 0 "register_operand" "=x,x")
17154 (if_then_else:VI_128
17156 (match_operand:VI_128 2 "nonimmediate_operand" "x,m")
17159 (match_operand:VI_128 1 "nonimmediate_operand" "xm,x")
17163 (neg:VI_128 (match_dup 2)))))]
17164 "TARGET_XOP && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
17165 "vpshl<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
17166 [(set_attr "type" "sseishft")
17167 (set_attr "prefix_data16" "0")
17168 (set_attr "prefix_extra" "2")
17169 (set_attr "mode" "TI")])
17171 (define_expand "<shift_insn><mode>3"
17172 [(set (match_operand:VI1_AVX512 0 "register_operand")
17173 (any_shift:VI1_AVX512
17174 (match_operand:VI1_AVX512 1 "register_operand")
17175 (match_operand:SI 2 "nonmemory_operand")))]
17178 if (TARGET_XOP && <MODE>mode == V16QImode)
17180 bool negate = false;
17181 rtx (*gen) (rtx, rtx, rtx);
17185 if (<CODE> != ASHIFT)
17187 if (CONST_INT_P (operands[2]))
17188 operands[2] = GEN_INT (-INTVAL (operands[2]));
17192 par = gen_rtx_PARALLEL (V16QImode, rtvec_alloc (16));
17193 for (i = 0; i < 16; i++)
17194 XVECEXP (par, 0, i) = operands[2];
17196 tmp = gen_reg_rtx (V16QImode);
17197 emit_insn (gen_vec_initv16qiqi (tmp, par));
17200 emit_insn (gen_negv16qi2 (tmp, tmp));
17202 gen = (<CODE> == LSHIFTRT ? gen_xop_shlv16qi3 : gen_xop_shav16qi3);
17203 emit_insn (gen (operands[0], operands[1], tmp));
17206 ix86_expand_vecop_qihi (<CODE>, operands[0], operands[1], operands[2]);
17210 (define_expand "ashrv2di3"
17211 [(set (match_operand:V2DI 0 "register_operand")
17213 (match_operand:V2DI 1 "register_operand")
17214 (match_operand:DI 2 "nonmemory_operand")))]
17215 "TARGET_XOP || TARGET_AVX512VL"
17217 if (!TARGET_AVX512VL)
17219 rtx reg = gen_reg_rtx (V2DImode);
17221 bool negate = false;
17224 if (CONST_INT_P (operands[2]))
17225 operands[2] = GEN_INT (-INTVAL (operands[2]));
17229 par = gen_rtx_PARALLEL (V2DImode, rtvec_alloc (2));
17230 for (i = 0; i < 2; i++)
17231 XVECEXP (par, 0, i) = operands[2];
17233 emit_insn (gen_vec_initv2didi (reg, par));
17236 emit_insn (gen_negv2di2 (reg, reg));
17238 emit_insn (gen_xop_shav2di3 (operands[0], operands[1], reg));
17243 ;; XOP FRCZ support
17244 (define_insn "xop_frcz<mode>2"
17245 [(set (match_operand:FMAMODE 0 "register_operand" "=x")
17247 [(match_operand:FMAMODE 1 "nonimmediate_operand" "xm")]
17250 "vfrcz<ssemodesuffix>\t{%1, %0|%0, %1}"
17251 [(set_attr "type" "ssecvt1")
17252 (set_attr "mode" "<MODE>")])
17254 (define_expand "xop_vmfrcz<mode>2"
17255 [(set (match_operand:VF_128 0 "register_operand")
17258 [(match_operand:VF_128 1 "nonimmediate_operand")]
17263 "operands[2] = CONST0_RTX (<MODE>mode);")
17265 (define_insn "*xop_vmfrcz<mode>2"
17266 [(set (match_operand:VF_128 0 "register_operand" "=x")
17269 [(match_operand:VF_128 1 "nonimmediate_operand" "xm")]
17271 (match_operand:VF_128 2 "const0_operand")
17274 "vfrcz<ssescalarmodesuffix>\t{%1, %0|%0, %<iptr>1}"
17275 [(set_attr "type" "ssecvt1")
17276 (set_attr "mode" "<MODE>")])
17278 (define_insn "xop_maskcmp<mode>3"
17279 [(set (match_operand:VI_128 0 "register_operand" "=x")
17280 (match_operator:VI_128 1 "ix86_comparison_int_operator"
17281 [(match_operand:VI_128 2 "register_operand" "x")
17282 (match_operand:VI_128 3 "nonimmediate_operand" "xm")]))]
17284 "vpcom%Y1<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}"
17285 [(set_attr "type" "sse4arg")
17286 (set_attr "prefix_data16" "0")
17287 (set_attr "prefix_rep" "0")
17288 (set_attr "prefix_extra" "2")
17289 (set_attr "length_immediate" "1")
17290 (set_attr "mode" "TI")])
17292 (define_insn "xop_maskcmp_uns<mode>3"
17293 [(set (match_operand:VI_128 0 "register_operand" "=x")
17294 (match_operator:VI_128 1 "ix86_comparison_uns_operator"
17295 [(match_operand:VI_128 2 "register_operand" "x")
17296 (match_operand:VI_128 3 "nonimmediate_operand" "xm")]))]
17298 "vpcom%Y1u<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}"
17299 [(set_attr "type" "ssecmp")
17300 (set_attr "prefix_data16" "0")
17301 (set_attr "prefix_rep" "0")
17302 (set_attr "prefix_extra" "2")
17303 (set_attr "length_immediate" "1")
17304 (set_attr "mode" "TI")])
17306 ;; Version of pcom*u* that is called from the intrinsics that allows pcomequ*
17307 ;; and pcomneu* not to be converted to the signed ones in case somebody needs
17308 ;; the exact instruction generated for the intrinsic.
17309 (define_insn "xop_maskcmp_uns2<mode>3"
17310 [(set (match_operand:VI_128 0 "register_operand" "=x")
17312 [(match_operator:VI_128 1 "ix86_comparison_uns_operator"
17313 [(match_operand:VI_128 2 "register_operand" "x")
17314 (match_operand:VI_128 3 "nonimmediate_operand" "xm")])]
17315 UNSPEC_XOP_UNSIGNED_CMP))]
17317 "vpcom%Y1u<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}"
17318 [(set_attr "type" "ssecmp")
17319 (set_attr "prefix_data16" "0")
17320 (set_attr "prefix_extra" "2")
17321 (set_attr "length_immediate" "1")
17322 (set_attr "mode" "TI")])
17324 ;; Pcomtrue and pcomfalse support. These are useless instructions, but are
17325 ;; being added here to be complete.
17326 (define_insn "xop_pcom_tf<mode>3"
17327 [(set (match_operand:VI_128 0 "register_operand" "=x")
17329 [(match_operand:VI_128 1 "register_operand" "x")
17330 (match_operand:VI_128 2 "nonimmediate_operand" "xm")
17331 (match_operand:SI 3 "const_int_operand" "n")]
17332 UNSPEC_XOP_TRUEFALSE))]
17335 return ((INTVAL (operands[3]) != 0)
17336 ? "vpcomtrue<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
17337 : "vpcomfalse<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}");
17339 [(set_attr "type" "ssecmp")
17340 (set_attr "prefix_data16" "0")
17341 (set_attr "prefix_extra" "2")
17342 (set_attr "length_immediate" "1")
17343 (set_attr "mode" "TI")])
17345 (define_insn "xop_vpermil2<mode>3"
17346 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x")
17348 [(match_operand:VF_128_256 1 "register_operand" "x,x")
17349 (match_operand:VF_128_256 2 "nonimmediate_operand" "x,m")
17350 (match_operand:<sseintvecmode> 3 "nonimmediate_operand" "xm,x")
17351 (match_operand:SI 4 "const_0_to_3_operand" "n,n")]
17354 "vpermil2<ssemodesuffix>\t{%4, %3, %2, %1, %0|%0, %1, %2, %3, %4}"
17355 [(set_attr "type" "sse4arg")
17356 (set_attr "length_immediate" "1")
17357 (set_attr "mode" "<MODE>")])
17359 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
17361 (define_insn "aesenc"
17362 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17363 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17364 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
17368 aesenc\t{%2, %0|%0, %2}
17369 vaesenc\t{%2, %1, %0|%0, %1, %2}"
17370 [(set_attr "isa" "noavx,avx")
17371 (set_attr "type" "sselog1")
17372 (set_attr "prefix_extra" "1")
17373 (set_attr "prefix" "orig,vex")
17374 (set_attr "btver2_decode" "double,double")
17375 (set_attr "mode" "TI")])
17377 (define_insn "aesenclast"
17378 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17379 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17380 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
17381 UNSPEC_AESENCLAST))]
17384 aesenclast\t{%2, %0|%0, %2}
17385 vaesenclast\t{%2, %1, %0|%0, %1, %2}"
17386 [(set_attr "isa" "noavx,avx")
17387 (set_attr "type" "sselog1")
17388 (set_attr "prefix_extra" "1")
17389 (set_attr "prefix" "orig,vex")
17390 (set_attr "btver2_decode" "double,double")
17391 (set_attr "mode" "TI")])
17393 (define_insn "aesdec"
17394 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17395 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17396 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
17400 aesdec\t{%2, %0|%0, %2}
17401 vaesdec\t{%2, %1, %0|%0, %1, %2}"
17402 [(set_attr "isa" "noavx,avx")
17403 (set_attr "type" "sselog1")
17404 (set_attr "prefix_extra" "1")
17405 (set_attr "prefix" "orig,vex")
17406 (set_attr "btver2_decode" "double,double")
17407 (set_attr "mode" "TI")])
17409 (define_insn "aesdeclast"
17410 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17411 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17412 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
17413 UNSPEC_AESDECLAST))]
17416 aesdeclast\t{%2, %0|%0, %2}
17417 vaesdeclast\t{%2, %1, %0|%0, %1, %2}"
17418 [(set_attr "isa" "noavx,avx")
17419 (set_attr "type" "sselog1")
17420 (set_attr "prefix_extra" "1")
17421 (set_attr "prefix" "orig,vex")
17422 (set_attr "btver2_decode" "double,double")
17423 (set_attr "mode" "TI")])
17425 (define_insn "aesimc"
17426 [(set (match_operand:V2DI 0 "register_operand" "=x")
17427 (unspec:V2DI [(match_operand:V2DI 1 "vector_operand" "xBm")]
17430 "%vaesimc\t{%1, %0|%0, %1}"
17431 [(set_attr "type" "sselog1")
17432 (set_attr "prefix_extra" "1")
17433 (set_attr "prefix" "maybe_vex")
17434 (set_attr "mode" "TI")])
17436 (define_insn "aeskeygenassist"
17437 [(set (match_operand:V2DI 0 "register_operand" "=x")
17438 (unspec:V2DI [(match_operand:V2DI 1 "vector_operand" "xBm")
17439 (match_operand:SI 2 "const_0_to_255_operand" "n")]
17440 UNSPEC_AESKEYGENASSIST))]
17442 "%vaeskeygenassist\t{%2, %1, %0|%0, %1, %2}"
17443 [(set_attr "type" "sselog1")
17444 (set_attr "prefix_extra" "1")
17445 (set_attr "length_immediate" "1")
17446 (set_attr "prefix" "maybe_vex")
17447 (set_attr "mode" "TI")])
17449 (define_insn "pclmulqdq"
17450 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17451 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17452 (match_operand:V2DI 2 "vector_operand" "xBm,xm")
17453 (match_operand:SI 3 "const_0_to_255_operand" "n,n")]
17457 pclmulqdq\t{%3, %2, %0|%0, %2, %3}
17458 vpclmulqdq\t{%3, %2, %1, %0|%0, %1, %2, %3}"
17459 [(set_attr "isa" "noavx,avx")
17460 (set_attr "type" "sselog1")
17461 (set_attr "prefix_extra" "1")
17462 (set_attr "length_immediate" "1")
17463 (set_attr "prefix" "orig,vex")
17464 (set_attr "mode" "TI")])
17466 (define_expand "avx_vzeroall"
17467 [(match_par_dup 0 [(const_int 0)])]
17470 int nregs = TARGET_64BIT ? 16 : 8;
17473 operands[0] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (nregs + 1));
17475 XVECEXP (operands[0], 0, 0)
17476 = gen_rtx_UNSPEC_VOLATILE (VOIDmode, gen_rtvec (1, const0_rtx),
17479 for (regno = 0; regno < nregs; regno++)
17480 XVECEXP (operands[0], 0, regno + 1)
17481 = gen_rtx_SET (gen_rtx_REG (V8SImode, SSE_REGNO (regno)),
17482 CONST0_RTX (V8SImode));
17485 (define_insn "*avx_vzeroall"
17486 [(match_parallel 0 "vzeroall_operation"
17487 [(unspec_volatile [(const_int 0)] UNSPECV_VZEROALL)])]
17490 [(set_attr "type" "sse")
17491 (set_attr "modrm" "0")
17492 (set_attr "memory" "none")
17493 (set_attr "prefix" "vex")
17494 (set_attr "btver2_decode" "vector")
17495 (set_attr "mode" "OI")])
17497 ;; Clear the upper 128bits of AVX registers, equivalent to a NOP
17498 ;; if the upper 128bits are unused.
17499 (define_insn "avx_vzeroupper"
17500 [(unspec_volatile [(const_int 0)] UNSPECV_VZEROUPPER)]
17503 [(set_attr "type" "sse")
17504 (set_attr "modrm" "0")
17505 (set_attr "memory" "none")
17506 (set_attr "prefix" "vex")
17507 (set_attr "btver2_decode" "vector")
17508 (set_attr "mode" "OI")])
17510 (define_mode_attr pbroadcast_evex_isa
17511 [(V64QI "avx512bw") (V32QI "avx512bw") (V16QI "avx512bw")
17512 (V32HI "avx512bw") (V16HI "avx512bw") (V8HI "avx512bw")
17513 (V16SI "avx512f") (V8SI "avx512f") (V4SI "avx512f")
17514 (V8DI "avx512f") (V4DI "avx512f") (V2DI "avx512f")])
17516 (define_insn "avx2_pbroadcast<mode>"
17517 [(set (match_operand:VI 0 "register_operand" "=x,v")
17519 (vec_select:<ssescalarmode>
17520 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "xm,vm")
17521 (parallel [(const_int 0)]))))]
17523 "vpbroadcast<ssemodesuffix>\t{%1, %0|%0, %<iptr>1}"
17524 [(set_attr "isa" "*,<pbroadcast_evex_isa>")
17525 (set_attr "type" "ssemov")
17526 (set_attr "prefix_extra" "1")
17527 (set_attr "prefix" "vex,evex")
17528 (set_attr "mode" "<sseinsnmode>")])
17530 (define_insn "avx2_pbroadcast<mode>_1"
17531 [(set (match_operand:VI_256 0 "register_operand" "=x,x,v,v")
17532 (vec_duplicate:VI_256
17533 (vec_select:<ssescalarmode>
17534 (match_operand:VI_256 1 "nonimmediate_operand" "m,x,m,v")
17535 (parallel [(const_int 0)]))))]
17538 vpbroadcast<ssemodesuffix>\t{%1, %0|%0, %<iptr>1}
17539 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %x1}
17540 vpbroadcast<ssemodesuffix>\t{%1, %0|%0, %<iptr>1}
17541 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %x1}"
17542 [(set_attr "isa" "*,*,<pbroadcast_evex_isa>,<pbroadcast_evex_isa>")
17543 (set_attr "type" "ssemov")
17544 (set_attr "prefix_extra" "1")
17545 (set_attr "prefix" "vex")
17546 (set_attr "mode" "<sseinsnmode>")])
17548 (define_insn "<avx2_avx512>_permvar<mode><mask_name>"
17549 [(set (match_operand:VI48F_256_512 0 "register_operand" "=v")
17550 (unspec:VI48F_256_512
17551 [(match_operand:VI48F_256_512 1 "nonimmediate_operand" "vm")
17552 (match_operand:<sseintvecmode> 2 "register_operand" "v")]
17554 "TARGET_AVX2 && <mask_mode512bit_condition>"
17555 "vperm<ssemodesuffix>\t{%1, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1}"
17556 [(set_attr "type" "sselog")
17557 (set_attr "prefix" "<mask_prefix2>")
17558 (set_attr "mode" "<sseinsnmode>")])
17560 (define_insn "<avx512>_permvar<mode><mask_name>"
17561 [(set (match_operand:VI1_AVX512VL 0 "register_operand" "=v")
17562 (unspec:VI1_AVX512VL
17563 [(match_operand:VI1_AVX512VL 1 "nonimmediate_operand" "vm")
17564 (match_operand:<sseintvecmode> 2 "register_operand" "v")]
17566 "TARGET_AVX512VBMI && <mask_mode512bit_condition>"
17567 "vperm<ssemodesuffix>\t{%1, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1}"
17568 [(set_attr "type" "sselog")
17569 (set_attr "prefix" "<mask_prefix2>")
17570 (set_attr "mode" "<sseinsnmode>")])
17572 (define_insn "<avx512>_permvar<mode><mask_name>"
17573 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
17574 (unspec:VI2_AVX512VL
17575 [(match_operand:VI2_AVX512VL 1 "nonimmediate_operand" "vm")
17576 (match_operand:<sseintvecmode> 2 "register_operand" "v")]
17578 "TARGET_AVX512BW && <mask_mode512bit_condition>"
17579 "vperm<ssemodesuffix>\t{%1, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1}"
17580 [(set_attr "type" "sselog")
17581 (set_attr "prefix" "<mask_prefix2>")
17582 (set_attr "mode" "<sseinsnmode>")])
17584 (define_expand "avx2_perm<mode>"
17585 [(match_operand:VI8F_256 0 "register_operand")
17586 (match_operand:VI8F_256 1 "nonimmediate_operand")
17587 (match_operand:SI 2 "const_0_to_255_operand")]
17590 int mask = INTVAL (operands[2]);
17591 emit_insn (gen_avx2_perm<mode>_1 (operands[0], operands[1],
17592 GEN_INT ((mask >> 0) & 3),
17593 GEN_INT ((mask >> 2) & 3),
17594 GEN_INT ((mask >> 4) & 3),
17595 GEN_INT ((mask >> 6) & 3)));
17599 (define_expand "avx512vl_perm<mode>_mask"
17600 [(match_operand:VI8F_256 0 "register_operand")
17601 (match_operand:VI8F_256 1 "nonimmediate_operand")
17602 (match_operand:SI 2 "const_0_to_255_operand")
17603 (match_operand:VI8F_256 3 "vector_move_operand")
17604 (match_operand:<avx512fmaskmode> 4 "register_operand")]
17607 int mask = INTVAL (operands[2]);
17608 emit_insn (gen_<avx2_avx512>_perm<mode>_1_mask (operands[0], operands[1],
17609 GEN_INT ((mask >> 0) & 3),
17610 GEN_INT ((mask >> 2) & 3),
17611 GEN_INT ((mask >> 4) & 3),
17612 GEN_INT ((mask >> 6) & 3),
17613 operands[3], operands[4]));
17617 (define_insn "avx2_perm<mode>_1<mask_name>"
17618 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
17619 (vec_select:VI8F_256
17620 (match_operand:VI8F_256 1 "nonimmediate_operand" "vm")
17621 (parallel [(match_operand 2 "const_0_to_3_operand")
17622 (match_operand 3 "const_0_to_3_operand")
17623 (match_operand 4 "const_0_to_3_operand")
17624 (match_operand 5 "const_0_to_3_operand")])))]
17625 "TARGET_AVX2 && <mask_mode512bit_condition>"
17628 mask |= INTVAL (operands[2]) << 0;
17629 mask |= INTVAL (operands[3]) << 2;
17630 mask |= INTVAL (operands[4]) << 4;
17631 mask |= INTVAL (operands[5]) << 6;
17632 operands[2] = GEN_INT (mask);
17633 return "vperm<ssemodesuffix>\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
17635 [(set_attr "type" "sselog")
17636 (set_attr "prefix" "<mask_prefix2>")
17637 (set_attr "mode" "<sseinsnmode>")])
17639 (define_expand "avx512f_perm<mode>"
17640 [(match_operand:V8FI 0 "register_operand")
17641 (match_operand:V8FI 1 "nonimmediate_operand")
17642 (match_operand:SI 2 "const_0_to_255_operand")]
17645 int mask = INTVAL (operands[2]);
17646 emit_insn (gen_avx512f_perm<mode>_1 (operands[0], operands[1],
17647 GEN_INT ((mask >> 0) & 3),
17648 GEN_INT ((mask >> 2) & 3),
17649 GEN_INT ((mask >> 4) & 3),
17650 GEN_INT ((mask >> 6) & 3),
17651 GEN_INT (((mask >> 0) & 3) + 4),
17652 GEN_INT (((mask >> 2) & 3) + 4),
17653 GEN_INT (((mask >> 4) & 3) + 4),
17654 GEN_INT (((mask >> 6) & 3) + 4)));
17658 (define_expand "avx512f_perm<mode>_mask"
17659 [(match_operand:V8FI 0 "register_operand")
17660 (match_operand:V8FI 1 "nonimmediate_operand")
17661 (match_operand:SI 2 "const_0_to_255_operand")
17662 (match_operand:V8FI 3 "vector_move_operand")
17663 (match_operand:<avx512fmaskmode> 4 "register_operand")]
17666 int mask = INTVAL (operands[2]);
17667 emit_insn (gen_avx512f_perm<mode>_1_mask (operands[0], operands[1],
17668 GEN_INT ((mask >> 0) & 3),
17669 GEN_INT ((mask >> 2) & 3),
17670 GEN_INT ((mask >> 4) & 3),
17671 GEN_INT ((mask >> 6) & 3),
17672 GEN_INT (((mask >> 0) & 3) + 4),
17673 GEN_INT (((mask >> 2) & 3) + 4),
17674 GEN_INT (((mask >> 4) & 3) + 4),
17675 GEN_INT (((mask >> 6) & 3) + 4),
17676 operands[3], operands[4]));
17680 (define_insn "avx512f_perm<mode>_1<mask_name>"
17681 [(set (match_operand:V8FI 0 "register_operand" "=v")
17683 (match_operand:V8FI 1 "nonimmediate_operand" "vm")
17684 (parallel [(match_operand 2 "const_0_to_3_operand")
17685 (match_operand 3 "const_0_to_3_operand")
17686 (match_operand 4 "const_0_to_3_operand")
17687 (match_operand 5 "const_0_to_3_operand")
17688 (match_operand 6 "const_4_to_7_operand")
17689 (match_operand 7 "const_4_to_7_operand")
17690 (match_operand 8 "const_4_to_7_operand")
17691 (match_operand 9 "const_4_to_7_operand")])))]
17692 "TARGET_AVX512F && <mask_mode512bit_condition>
17693 && (INTVAL (operands[2]) == (INTVAL (operands[6]) - 4)
17694 && INTVAL (operands[3]) == (INTVAL (operands[7]) - 4)
17695 && INTVAL (operands[4]) == (INTVAL (operands[8]) - 4)
17696 && INTVAL (operands[5]) == (INTVAL (operands[9]) - 4))"
17699 mask |= INTVAL (operands[2]) << 0;
17700 mask |= INTVAL (operands[3]) << 2;
17701 mask |= INTVAL (operands[4]) << 4;
17702 mask |= INTVAL (operands[5]) << 6;
17703 operands[2] = GEN_INT (mask);
17704 return "vperm<ssemodesuffix>\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
17706 [(set_attr "type" "sselog")
17707 (set_attr "prefix" "<mask_prefix2>")
17708 (set_attr "mode" "<sseinsnmode>")])
17710 (define_insn "avx2_permv2ti"
17711 [(set (match_operand:V4DI 0 "register_operand" "=x")
17713 [(match_operand:V4DI 1 "register_operand" "x")
17714 (match_operand:V4DI 2 "nonimmediate_operand" "xm")
17715 (match_operand:SI 3 "const_0_to_255_operand" "n")]
17718 "vperm2i128\t{%3, %2, %1, %0|%0, %1, %2, %3}"
17719 [(set_attr "type" "sselog")
17720 (set_attr "prefix" "vex")
17721 (set_attr "mode" "OI")])
17723 (define_insn "avx2_vec_dupv4df"
17724 [(set (match_operand:V4DF 0 "register_operand" "=v")
17725 (vec_duplicate:V4DF
17727 (match_operand:V2DF 1 "register_operand" "v")
17728 (parallel [(const_int 0)]))))]
17730 "vbroadcastsd\t{%1, %0|%0, %1}"
17731 [(set_attr "type" "sselog1")
17732 (set_attr "prefix" "maybe_evex")
17733 (set_attr "mode" "V4DF")])
17735 (define_insn "<avx512>_vec_dup<mode>_1"
17736 [(set (match_operand:VI_AVX512BW 0 "register_operand" "=v,v")
17737 (vec_duplicate:VI_AVX512BW
17738 (vec_select:<ssescalarmode>
17739 (match_operand:VI_AVX512BW 1 "nonimmediate_operand" "v,m")
17740 (parallel [(const_int 0)]))))]
17743 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %x1}
17744 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %<iptr>1}"
17745 [(set_attr "type" "ssemov")
17746 (set_attr "prefix" "evex")
17747 (set_attr "mode" "<sseinsnmode>")])
17749 (define_insn "<avx512>_vec_dup<mode><mask_name>"
17750 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v")
17751 (vec_duplicate:V48_AVX512VL
17752 (vec_select:<ssescalarmode>
17753 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "vm")
17754 (parallel [(const_int 0)]))))]
17757 /* There is no DF broadcast (in AVX-512*) to 128b register.
17758 Mimic it with integer variant. */
17759 if (<MODE>mode == V2DFmode)
17760 return "vpbroadcastq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}";
17762 return "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %<iptr>1}";
17764 [(set_attr "type" "ssemov")
17765 (set_attr "prefix" "evex")
17766 (set_attr "mode" "<sseinsnmode>")])
17768 (define_insn "<avx512>_vec_dup<mode><mask_name>"
17769 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
17770 (vec_duplicate:VI12_AVX512VL
17771 (vec_select:<ssescalarmode>
17772 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "vm")
17773 (parallel [(const_int 0)]))))]
17775 "vpbroadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %<iptr>1}"
17776 [(set_attr "type" "ssemov")
17777 (set_attr "prefix" "evex")
17778 (set_attr "mode" "<sseinsnmode>")])
17780 (define_insn "<mask_codefor>avx512f_broadcast<mode><mask_name>"
17781 [(set (match_operand:V16FI 0 "register_operand" "=v,v")
17782 (vec_duplicate:V16FI
17783 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "v,m")))]
17786 vshuf<shuffletype>32x4\t{$0x0, %g1, %g1, %0<mask_operand2>|%0<mask_operand2>, %g1, %g1, 0x0}
17787 vbroadcast<shuffletype>32x4\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17788 [(set_attr "type" "ssemov")
17789 (set_attr "prefix" "evex")
17790 (set_attr "mode" "<sseinsnmode>")])
17792 (define_insn "<mask_codefor>avx512f_broadcast<mode><mask_name>"
17793 [(set (match_operand:V8FI 0 "register_operand" "=v,v")
17794 (vec_duplicate:V8FI
17795 (match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "v,m")))]
17798 vshuf<shuffletype>64x2\t{$0x44, %g1, %g1, %0<mask_operand2>|%0<mask_operand2>, %g1, %g1, 0x44}
17799 vbroadcast<shuffletype>64x4\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17800 [(set_attr "type" "ssemov")
17801 (set_attr "prefix" "evex")
17802 (set_attr "mode" "<sseinsnmode>")])
17804 (define_insn "<mask_codefor><avx512>_vec_dup_gpr<mode><mask_name>"
17805 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v,v")
17806 (vec_duplicate:VI12_AVX512VL
17807 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "vm,r")))]
17810 vpbroadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}
17811 vpbroadcast<bcstscalarsuff>\t{%k1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
17812 [(set_attr "type" "ssemov")
17813 (set_attr "prefix" "evex")
17814 (set_attr "mode" "<sseinsnmode>")])
17816 (define_insn "<mask_codefor><avx512>_vec_dup_gpr<mode><mask_name>"
17817 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v,v")
17818 (vec_duplicate:V48_AVX512VL
17819 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "vm,r")))]
17821 "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17822 [(set_attr "type" "ssemov")
17823 (set_attr "prefix" "evex")
17824 (set_attr "mode" "<sseinsnmode>")
17825 (set (attr "enabled")
17826 (if_then_else (eq_attr "alternative" "1")
17827 (symbol_ref "GET_MODE_CLASS (<ssescalarmode>mode) == MODE_INT
17828 && (<ssescalarmode>mode != DImode || TARGET_64BIT)")
17831 (define_insn "vec_dupv4sf"
17832 [(set (match_operand:V4SF 0 "register_operand" "=v,v,x")
17833 (vec_duplicate:V4SF
17834 (match_operand:SF 1 "nonimmediate_operand" "Yv,m,0")))]
17837 vshufps\t{$0, %1, %1, %0|%0, %1, %1, 0}
17838 vbroadcastss\t{%1, %0|%0, %1}
17839 shufps\t{$0, %0, %0|%0, %0, 0}"
17840 [(set_attr "isa" "avx,avx,noavx")
17841 (set_attr "type" "sseshuf1,ssemov,sseshuf1")
17842 (set_attr "length_immediate" "1,0,1")
17843 (set_attr "prefix_extra" "0,1,*")
17844 (set_attr "prefix" "maybe_evex,maybe_evex,orig")
17845 (set_attr "mode" "V4SF")])
17847 (define_insn "*vec_dupv4si"
17848 [(set (match_operand:V4SI 0 "register_operand" "=v,v,x")
17849 (vec_duplicate:V4SI
17850 (match_operand:SI 1 "nonimmediate_operand" "Yv,m,0")))]
17853 %vpshufd\t{$0, %1, %0|%0, %1, 0}
17854 vbroadcastss\t{%1, %0|%0, %1}
17855 shufps\t{$0, %0, %0|%0, %0, 0}"
17856 [(set_attr "isa" "sse2,avx,noavx")
17857 (set_attr "type" "sselog1,ssemov,sselog1")
17858 (set_attr "length_immediate" "1,0,1")
17859 (set_attr "prefix_extra" "0,1,*")
17860 (set_attr "prefix" "maybe_vex,maybe_evex,orig")
17861 (set_attr "mode" "TI,V4SF,V4SF")])
17863 (define_insn "*vec_dupv2di"
17864 [(set (match_operand:V2DI 0 "register_operand" "=x,v,v,x")
17865 (vec_duplicate:V2DI
17866 (match_operand:DI 1 "nonimmediate_operand" " 0,Yv,m,0")))]
17870 vpunpcklqdq\t{%d1, %0|%0, %d1}
17871 %vmovddup\t{%1, %0|%0, %1}
17873 [(set_attr "isa" "sse2_noavx,avx,sse3,noavx")
17874 (set_attr "type" "sselog1,sselog1,sselog1,ssemov")
17875 (set_attr "prefix" "orig,maybe_evex,maybe_vex,orig")
17876 (set_attr "mode" "TI,TI,DF,V4SF")])
17878 (define_insn "avx2_vbroadcasti128_<mode>"
17879 [(set (match_operand:VI_256 0 "register_operand" "=x,v,v")
17881 (match_operand:<ssehalfvecmode> 1 "memory_operand" "m,m,m")
17885 vbroadcasti128\t{%1, %0|%0, %1}
17886 vbroadcast<i128vldq>\t{%1, %0|%0, %1}
17887 vbroadcast<shuffletype>32x4\t{%1, %0|%0, %1}"
17888 [(set_attr "isa" "*,avx512dq,avx512vl")
17889 (set_attr "type" "ssemov")
17890 (set_attr "prefix_extra" "1")
17891 (set_attr "prefix" "vex,evex,evex")
17892 (set_attr "mode" "OI")])
17894 ;; Modes handled by AVX vec_dup patterns.
17895 (define_mode_iterator AVX_VEC_DUP_MODE
17896 [V8SI V8SF V4DI V4DF])
17897 (define_mode_attr vecdupssescalarmodesuffix
17898 [(V8SF "ss") (V4DF "sd") (V8SI "ss") (V4DI "sd")])
17899 ;; Modes handled by AVX2 vec_dup patterns.
17900 (define_mode_iterator AVX2_VEC_DUP_MODE
17901 [V32QI V16QI V16HI V8HI V8SI V4SI])
17903 (define_insn "*vec_dup<mode>"
17904 [(set (match_operand:AVX2_VEC_DUP_MODE 0 "register_operand" "=x,x,Yi")
17905 (vec_duplicate:AVX2_VEC_DUP_MODE
17906 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "m,x,$r")))]
17909 v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0|%0, %1}
17910 v<sseintprefix>broadcast<bcstscalarsuff>\t{%x1, %0|%0, %x1}
17912 [(set_attr "isa" "*,*,noavx512vl")
17913 (set_attr "type" "ssemov")
17914 (set_attr "prefix_extra" "1")
17915 (set_attr "prefix" "maybe_evex")
17916 (set_attr "mode" "<sseinsnmode>")])
17918 (define_insn "vec_dup<mode>"
17919 [(set (match_operand:AVX_VEC_DUP_MODE 0 "register_operand" "=x,x,x,v,x")
17920 (vec_duplicate:AVX_VEC_DUP_MODE
17921 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "m,m,x,v,?x")))]
17924 v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0|%0, %1}
17925 vbroadcast<vecdupssescalarmodesuffix>\t{%1, %0|%0, %1}
17926 v<sseintprefix>broadcast<bcstscalarsuff>\t{%x1, %0|%0, %x1}
17927 v<sseintprefix>broadcast<bcstscalarsuff>\t{%x1, %g0|%g0, %x1}
17929 [(set_attr "type" "ssemov")
17930 (set_attr "prefix_extra" "1")
17931 (set_attr "prefix" "maybe_evex")
17932 (set_attr "isa" "avx2,noavx2,avx2,avx512f,noavx2")
17933 (set_attr "mode" "<sseinsnmode>,V8SF,<sseinsnmode>,<sseinsnmode>,V8SF")])
17936 [(set (match_operand:AVX2_VEC_DUP_MODE 0 "register_operand")
17937 (vec_duplicate:AVX2_VEC_DUP_MODE
17938 (match_operand:<ssescalarmode> 1 "register_operand")))]
17940 /* Disable this splitter if avx512vl_vec_dup_gprv*[qhs]i insn is
17941 available, because then we can broadcast from GPRs directly.
17942 For V*[QH]I modes it requires both -mavx512vl and -mavx512bw,
17943 for V*SI mode it requires just -mavx512vl. */
17944 && !(TARGET_AVX512VL
17945 && (TARGET_AVX512BW || <ssescalarmode>mode == SImode))
17946 && reload_completed && GENERAL_REG_P (operands[1])"
17949 emit_insn (gen_vec_setv4si_0 (gen_lowpart (V4SImode, operands[0]),
17950 CONST0_RTX (V4SImode),
17951 gen_lowpart (SImode, operands[1])));
17952 emit_insn (gen_avx2_pbroadcast<mode> (operands[0],
17953 gen_lowpart (<ssexmmmode>mode,
17959 [(set (match_operand:AVX_VEC_DUP_MODE 0 "register_operand")
17960 (vec_duplicate:AVX_VEC_DUP_MODE
17961 (match_operand:<ssescalarmode> 1 "register_operand")))]
17962 "TARGET_AVX && !TARGET_AVX2 && reload_completed"
17963 [(set (match_dup 2)
17964 (vec_duplicate:<ssehalfvecmode> (match_dup 1)))
17966 (vec_concat:AVX_VEC_DUP_MODE (match_dup 2) (match_dup 2)))]
17967 "operands[2] = gen_lowpart (<ssehalfvecmode>mode, operands[0]);")
17969 (define_insn "avx_vbroadcastf128_<mode>"
17970 [(set (match_operand:V_256 0 "register_operand" "=x,x,x,v,v,v,v")
17972 (match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "m,0,?x,m,0,m,0")
17976 vbroadcast<i128>\t{%1, %0|%0, %1}
17977 vinsert<i128>\t{$1, %1, %0, %0|%0, %0, %1, 1}
17978 vperm2<i128>\t{$0, %t1, %t1, %0|%0, %t1, %t1, 0}
17979 vbroadcast<i128vldq>\t{%1, %0|%0, %1}
17980 vinsert<i128vldq>\t{$1, %1, %0, %0|%0, %0, %1, 1}
17981 vbroadcast<shuffletype>32x4\t{%1, %0|%0, %1}
17982 vinsert<shuffletype>32x4\t{$1, %1, %0, %0|%0, %0, %1, 1}"
17983 [(set_attr "isa" "*,*,*,avx512dq,avx512dq,avx512vl,avx512vl")
17984 (set_attr "type" "ssemov,sselog1,sselog1,ssemov,sselog1,ssemov,sselog1")
17985 (set_attr "prefix_extra" "1")
17986 (set_attr "length_immediate" "0,1,1,0,1,0,1")
17987 (set_attr "prefix" "vex,vex,vex,evex,evex,evex,evex")
17988 (set_attr "mode" "<sseinsnmode>")])
17990 ;; For broadcast[i|f]32x2. Yes there is no v4sf version, only v4si.
17991 (define_mode_iterator VI4F_BRCST32x2
17992 [V16SI (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")
17993 V16SF (V8SF "TARGET_AVX512VL")])
17995 (define_mode_attr 64x2mode
17996 [(V8DF "V2DF") (V8DI "V2DI") (V4DI "V2DI") (V4DF "V2DF")])
17998 (define_mode_attr 32x2mode
17999 [(V16SF "V2SF") (V16SI "V2SI") (V8SI "V2SI")
18000 (V8SF "V2SF") (V4SI "V2SI")])
18002 (define_insn "<mask_codefor>avx512dq_broadcast<mode><mask_name>"
18003 [(set (match_operand:VI4F_BRCST32x2 0 "register_operand" "=v")
18004 (vec_duplicate:VI4F_BRCST32x2
18005 (vec_select:<32x2mode>
18006 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "vm")
18007 (parallel [(const_int 0) (const_int 1)]))))]
18009 "vbroadcast<shuffletype>32x2\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
18010 [(set_attr "type" "ssemov")
18011 (set_attr "prefix_extra" "1")
18012 (set_attr "prefix" "evex")
18013 (set_attr "mode" "<sseinsnmode>")])
18015 (define_insn "<mask_codefor>avx512vl_broadcast<mode><mask_name>_1"
18016 [(set (match_operand:VI4F_256 0 "register_operand" "=v,v")
18017 (vec_duplicate:VI4F_256
18018 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "v,m")))]
18021 vshuf<shuffletype>32x4\t{$0x0, %t1, %t1, %0<mask_operand2>|%0<mask_operand2>, %t1, %t1, 0x0}
18022 vbroadcast<shuffletype>32x4\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
18023 [(set_attr "type" "ssemov")
18024 (set_attr "prefix_extra" "1")
18025 (set_attr "prefix" "evex")
18026 (set_attr "mode" "<sseinsnmode>")])
18028 (define_insn "<mask_codefor>avx512dq_broadcast<mode><mask_name>_1"
18029 [(set (match_operand:V16FI 0 "register_operand" "=v,v")
18030 (vec_duplicate:V16FI
18031 (match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "v,m")))]
18034 vshuf<shuffletype>32x4\t{$0x44, %g1, %g1, %0<mask_operand2>|%0<mask_operand2>, %g1, %g1, 0x44}
18035 vbroadcast<shuffletype>32x8\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
18036 [(set_attr "type" "ssemov")
18037 (set_attr "prefix_extra" "1")
18038 (set_attr "prefix" "evex")
18039 (set_attr "mode" "<sseinsnmode>")])
18041 ;; For broadcast[i|f]64x2
18042 (define_mode_iterator VI8F_BRCST64x2
18043 [V8DI V8DF (V4DI "TARGET_AVX512VL") (V4DF "TARGET_AVX512VL")])
18045 (define_insn "<mask_codefor>avx512dq_broadcast<mode><mask_name>_1"
18046 [(set (match_operand:VI8F_BRCST64x2 0 "register_operand" "=v,v")
18047 (vec_duplicate:VI8F_BRCST64x2
18048 (match_operand:<64x2mode> 1 "nonimmediate_operand" "v,m")))]
18051 vshuf<shuffletype>64x2\t{$0x0, %<concat_tg_mode>1, %<concat_tg_mode>1, %0<mask_operand2>|%0<mask_operand2>, %<concat_tg_mode>1, %<concat_tg_mode>1, 0x0}
18052 vbroadcast<shuffletype>64x2\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
18053 [(set_attr "type" "ssemov")
18054 (set_attr "prefix_extra" "1")
18055 (set_attr "prefix" "evex")
18056 (set_attr "mode" "<sseinsnmode>")])
18058 (define_insn "avx512cd_maskb_vec_dup<mode>"
18059 [(set (match_operand:VI8_AVX512VL 0 "register_operand" "=v")
18060 (vec_duplicate:VI8_AVX512VL
18062 (match_operand:QI 1 "register_operand" "Yk"))))]
18064 "vpbroadcastmb2q\t{%1, %0|%0, %1}"
18065 [(set_attr "type" "mskmov")
18066 (set_attr "prefix" "evex")
18067 (set_attr "mode" "XI")])
18069 (define_insn "avx512cd_maskw_vec_dup<mode>"
18070 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
18071 (vec_duplicate:VI4_AVX512VL
18073 (match_operand:HI 1 "register_operand" "Yk"))))]
18075 "vpbroadcastmw2d\t{%1, %0|%0, %1}"
18076 [(set_attr "type" "mskmov")
18077 (set_attr "prefix" "evex")
18078 (set_attr "mode" "XI")])
18080 ;; Recognize broadcast as a vec_select as produced by builtin_vec_perm.
18081 ;; If it so happens that the input is in memory, use vbroadcast.
18082 ;; Otherwise use vpermilp (and in the case of 256-bit modes, vperm2f128).
18083 (define_insn "*avx_vperm_broadcast_v4sf"
18084 [(set (match_operand:V4SF 0 "register_operand" "=v,v,v")
18086 (match_operand:V4SF 1 "nonimmediate_operand" "m,o,v")
18087 (match_parallel 2 "avx_vbroadcast_operand"
18088 [(match_operand 3 "const_int_operand" "C,n,n")])))]
18091 int elt = INTVAL (operands[3]);
18092 switch (which_alternative)
18096 operands[1] = adjust_address_nv (operands[1], SFmode, elt * 4);
18097 return "vbroadcastss\t{%1, %0|%0, %k1}";
18099 operands[2] = GEN_INT (elt * 0x55);
18100 return "vpermilps\t{%2, %1, %0|%0, %1, %2}";
18102 gcc_unreachable ();
18105 [(set_attr "type" "ssemov,ssemov,sselog1")
18106 (set_attr "prefix_extra" "1")
18107 (set_attr "length_immediate" "0,0,1")
18108 (set_attr "prefix" "maybe_evex")
18109 (set_attr "mode" "SF,SF,V4SF")])
18111 (define_insn_and_split "*avx_vperm_broadcast_<mode>"
18112 [(set (match_operand:VF_256 0 "register_operand" "=v,v,v")
18114 (match_operand:VF_256 1 "nonimmediate_operand" "m,o,?v")
18115 (match_parallel 2 "avx_vbroadcast_operand"
18116 [(match_operand 3 "const_int_operand" "C,n,n")])))]
18119 "&& reload_completed && (<MODE>mode != V4DFmode || !TARGET_AVX2)"
18120 [(set (match_dup 0) (vec_duplicate:VF_256 (match_dup 1)))]
18122 rtx op0 = operands[0], op1 = operands[1];
18123 int elt = INTVAL (operands[3]);
18129 if (TARGET_AVX2 && elt == 0)
18131 emit_insn (gen_vec_dup<mode> (op0, gen_lowpart (<ssescalarmode>mode,
18136 /* Shuffle element we care about into all elements of the 128-bit lane.
18137 The other lane gets shuffled too, but we don't care. */
18138 if (<MODE>mode == V4DFmode)
18139 mask = (elt & 1 ? 15 : 0);
18141 mask = (elt & 3) * 0x55;
18142 emit_insn (gen_avx_vpermil<mode> (op0, op1, GEN_INT (mask)));
18144 /* Shuffle the lane we care about into both lanes of the dest. */
18145 mask = (elt / (<ssescalarnum> / 2)) * 0x11;
18146 if (EXT_REX_SSE_REG_P (op0))
18148 /* There is no EVEX VPERM2F128, but we can use either VBROADCASTSS
18150 gcc_assert (<MODE>mode == V8SFmode);
18151 if ((mask & 1) == 0)
18152 emit_insn (gen_avx2_vec_dupv8sf (op0,
18153 gen_lowpart (V4SFmode, op0)));
18155 emit_insn (gen_avx512vl_shuf_f32x4_1 (op0, op0, op0,
18156 GEN_INT (4), GEN_INT (5),
18157 GEN_INT (6), GEN_INT (7),
18158 GEN_INT (12), GEN_INT (13),
18159 GEN_INT (14), GEN_INT (15)));
18163 emit_insn (gen_avx_vperm2f128<mode>3 (op0, op0, op0, GEN_INT (mask)));
18167 operands[1] = adjust_address (op1, <ssescalarmode>mode,
18168 elt * GET_MODE_SIZE (<ssescalarmode>mode));
18171 (define_expand "<sse2_avx_avx512f>_vpermil<mode><mask_name>"
18172 [(set (match_operand:VF2 0 "register_operand")
18174 (match_operand:VF2 1 "nonimmediate_operand")
18175 (match_operand:SI 2 "const_0_to_255_operand")))]
18176 "TARGET_AVX && <mask_mode512bit_condition>"
18178 int mask = INTVAL (operands[2]);
18179 rtx perm[<ssescalarnum>];
18182 for (i = 0; i < <ssescalarnum>; i = i + 2)
18184 perm[i] = GEN_INT (((mask >> i) & 1) + i);
18185 perm[i + 1] = GEN_INT (((mask >> (i + 1)) & 1) + i);
18189 = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (<ssescalarnum>, perm));
18192 (define_expand "<sse2_avx_avx512f>_vpermil<mode><mask_name>"
18193 [(set (match_operand:VF1 0 "register_operand")
18195 (match_operand:VF1 1 "nonimmediate_operand")
18196 (match_operand:SI 2 "const_0_to_255_operand")))]
18197 "TARGET_AVX && <mask_mode512bit_condition>"
18199 int mask = INTVAL (operands[2]);
18200 rtx perm[<ssescalarnum>];
18203 for (i = 0; i < <ssescalarnum>; i = i + 4)
18205 perm[i] = GEN_INT (((mask >> 0) & 3) + i);
18206 perm[i + 1] = GEN_INT (((mask >> 2) & 3) + i);
18207 perm[i + 2] = GEN_INT (((mask >> 4) & 3) + i);
18208 perm[i + 3] = GEN_INT (((mask >> 6) & 3) + i);
18212 = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (<ssescalarnum>, perm));
18215 (define_insn "*<sse2_avx_avx512f>_vpermilp<mode><mask_name>"
18216 [(set (match_operand:VF 0 "register_operand" "=v")
18218 (match_operand:VF 1 "nonimmediate_operand" "vm")
18219 (match_parallel 2 ""
18220 [(match_operand 3 "const_int_operand")])))]
18221 "TARGET_AVX && <mask_mode512bit_condition>
18222 && avx_vpermilp_parallel (operands[2], <MODE>mode)"
18224 int mask = avx_vpermilp_parallel (operands[2], <MODE>mode) - 1;
18225 operands[2] = GEN_INT (mask);
18226 return "vpermil<ssemodesuffix>\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}";
18228 [(set_attr "type" "sselog")
18229 (set_attr "prefix_extra" "1")
18230 (set_attr "length_immediate" "1")
18231 (set_attr "prefix" "<mask_prefix>")
18232 (set_attr "mode" "<sseinsnmode>")])
18234 (define_insn "<sse2_avx_avx512f>_vpermilvar<mode>3<mask_name>"
18235 [(set (match_operand:VF 0 "register_operand" "=v")
18237 [(match_operand:VF 1 "register_operand" "v")
18238 (match_operand:<sseintvecmode> 2 "nonimmediate_operand" "vm")]
18240 "TARGET_AVX && <mask_mode512bit_condition>"
18241 "vpermil<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18242 [(set_attr "type" "sselog")
18243 (set_attr "prefix_extra" "1")
18244 (set_attr "btver2_decode" "vector")
18245 (set_attr "prefix" "<mask_prefix>")
18246 (set_attr "mode" "<sseinsnmode>")])
18248 (define_mode_iterator VPERMI2
18249 [V16SI V16SF V8DI V8DF
18250 (V8SI "TARGET_AVX512VL") (V8SF "TARGET_AVX512VL")
18251 (V4DI "TARGET_AVX512VL") (V4DF "TARGET_AVX512VL")
18252 (V4SI "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
18253 (V2DI "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")
18254 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX512BW && TARGET_AVX512VL")
18255 (V8HI "TARGET_AVX512BW && TARGET_AVX512VL")
18256 (V64QI "TARGET_AVX512VBMI") (V32QI "TARGET_AVX512VBMI && TARGET_AVX512VL")
18257 (V16QI "TARGET_AVX512VBMI && TARGET_AVX512VL")])
18259 (define_mode_iterator VPERMI2I
18261 (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")
18262 (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")
18263 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX512BW && TARGET_AVX512VL")
18264 (V8HI "TARGET_AVX512BW && TARGET_AVX512VL")
18265 (V64QI "TARGET_AVX512VBMI") (V32QI "TARGET_AVX512VBMI && TARGET_AVX512VL")
18266 (V16QI "TARGET_AVX512VBMI && TARGET_AVX512VL")])
18268 (define_expand "<avx512>_vpermi2var<mode>3_mask"
18269 [(set (match_operand:VPERMI2 0 "register_operand")
18272 [(match_operand:<sseintvecmode> 2 "register_operand")
18273 (match_operand:VPERMI2 1 "register_operand")
18274 (match_operand:VPERMI2 3 "nonimmediate_operand")]
18277 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
18280 operands[2] = force_reg (<sseintvecmode>mode, operands[2]);
18281 operands[5] = gen_lowpart (<MODE>mode, operands[2]);
18284 (define_insn "*<avx512>_vpermi2var<mode>3_mask"
18285 [(set (match_operand:VPERMI2I 0 "register_operand" "=v")
18286 (vec_merge:VPERMI2I
18288 [(match_operand:<sseintvecmode> 2 "register_operand" "0")
18289 (match_operand:VPERMI2I 1 "register_operand" "v")
18290 (match_operand:VPERMI2I 3 "nonimmediate_operand" "vm")]
18293 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
18295 "vpermi2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
18296 [(set_attr "type" "sselog")
18297 (set_attr "prefix" "evex")
18298 (set_attr "mode" "<sseinsnmode>")])
18300 (define_insn "*<avx512>_vpermi2var<mode>3_mask"
18301 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
18302 (vec_merge:VF_AVX512VL
18303 (unspec:VF_AVX512VL
18304 [(match_operand:<sseintvecmode> 2 "register_operand" "0")
18305 (match_operand:VF_AVX512VL 1 "register_operand" "v")
18306 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "vm")]
18308 (subreg:VF_AVX512VL (match_dup 2) 0)
18309 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
18311 "vpermi2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
18312 [(set_attr "type" "sselog")
18313 (set_attr "prefix" "evex")
18314 (set_attr "mode" "<sseinsnmode>")])
18316 (define_expand "<avx512>_vpermt2var<mode>3_maskz"
18317 [(match_operand:VPERMI2 0 "register_operand")
18318 (match_operand:<sseintvecmode> 1 "register_operand")
18319 (match_operand:VPERMI2 2 "register_operand")
18320 (match_operand:VPERMI2 3 "nonimmediate_operand")
18321 (match_operand:<avx512fmaskmode> 4 "register_operand")]
18324 emit_insn (gen_<avx512>_vpermt2var<mode>3_maskz_1 (
18325 operands[0], operands[1], operands[2], operands[3],
18326 CONST0_RTX (<MODE>mode), operands[4]));
18330 (define_insn "<avx512>_vpermt2var<mode>3<sd_maskz_name>"
18331 [(set (match_operand:VPERMI2 0 "register_operand" "=v,v")
18333 [(match_operand:<sseintvecmode> 1 "register_operand" "v,0")
18334 (match_operand:VPERMI2 2 "register_operand" "0,v")
18335 (match_operand:VPERMI2 3 "nonimmediate_operand" "vm,vm")]
18339 vpermt2<ssemodesuffix>\t{%3, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %3}
18340 vpermi2<ssemodesuffix>\t{%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3}"
18341 [(set_attr "type" "sselog")
18342 (set_attr "prefix" "evex")
18343 (set_attr "mode" "<sseinsnmode>")])
18345 (define_insn "<avx512>_vpermt2var<mode>3_mask"
18346 [(set (match_operand:VPERMI2 0 "register_operand" "=v")
18349 [(match_operand:<sseintvecmode> 1 "register_operand" "v")
18350 (match_operand:VPERMI2 2 "register_operand" "0")
18351 (match_operand:VPERMI2 3 "nonimmediate_operand" "vm")]
18354 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
18356 "vpermt2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
18357 [(set_attr "type" "sselog")
18358 (set_attr "prefix" "evex")
18359 (set_attr "mode" "<sseinsnmode>")])
18361 (define_expand "avx_vperm2f128<mode>3"
18362 [(set (match_operand:AVX256MODE2P 0 "register_operand")
18363 (unspec:AVX256MODE2P
18364 [(match_operand:AVX256MODE2P 1 "register_operand")
18365 (match_operand:AVX256MODE2P 2 "nonimmediate_operand")
18366 (match_operand:SI 3 "const_0_to_255_operand")]
18367 UNSPEC_VPERMIL2F128))]
18370 int mask = INTVAL (operands[3]);
18371 if ((mask & 0x88) == 0)
18373 rtx perm[<ssescalarnum>], t1, t2;
18374 int i, base, nelt = <ssescalarnum>, nelt2 = nelt / 2;
18376 base = (mask & 3) * nelt2;
18377 for (i = 0; i < nelt2; ++i)
18378 perm[i] = GEN_INT (base + i);
18380 base = ((mask >> 4) & 3) * nelt2;
18381 for (i = 0; i < nelt2; ++i)
18382 perm[i + nelt2] = GEN_INT (base + i);
18384 t2 = gen_rtx_VEC_CONCAT (<ssedoublevecmode>mode,
18385 operands[1], operands[2]);
18386 t1 = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (nelt, perm));
18387 t2 = gen_rtx_VEC_SELECT (<MODE>mode, t2, t1);
18388 t2 = gen_rtx_SET (operands[0], t2);
18394 ;; Note that bits 7 and 3 of the imm8 allow lanes to be zeroed, which
18395 ;; means that in order to represent this properly in rtl we'd have to
18396 ;; nest *another* vec_concat with a zero operand and do the select from
18397 ;; a 4x wide vector. That doesn't seem very nice.
18398 (define_insn "*avx_vperm2f128<mode>_full"
18399 [(set (match_operand:AVX256MODE2P 0 "register_operand" "=x")
18400 (unspec:AVX256MODE2P
18401 [(match_operand:AVX256MODE2P 1 "register_operand" "x")
18402 (match_operand:AVX256MODE2P 2 "nonimmediate_operand" "xm")
18403 (match_operand:SI 3 "const_0_to_255_operand" "n")]
18404 UNSPEC_VPERMIL2F128))]
18406 "vperm2<i128>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
18407 [(set_attr "type" "sselog")
18408 (set_attr "prefix_extra" "1")
18409 (set_attr "length_immediate" "1")
18410 (set_attr "prefix" "vex")
18411 (set_attr "mode" "<sseinsnmode>")])
18413 (define_insn "*avx_vperm2f128<mode>_nozero"
18414 [(set (match_operand:AVX256MODE2P 0 "register_operand" "=x")
18415 (vec_select:AVX256MODE2P
18416 (vec_concat:<ssedoublevecmode>
18417 (match_operand:AVX256MODE2P 1 "register_operand" "x")
18418 (match_operand:AVX256MODE2P 2 "nonimmediate_operand" "xm"))
18419 (match_parallel 3 ""
18420 [(match_operand 4 "const_int_operand")])))]
18422 && avx_vperm2f128_parallel (operands[3], <MODE>mode)"
18424 int mask = avx_vperm2f128_parallel (operands[3], <MODE>mode) - 1;
18426 return "vinsert<i128>\t{$0, %x2, %1, %0|%0, %1, %x2, 0}";
18428 return "vinsert<i128>\t{$1, %x2, %1, %0|%0, %1, %x2, 1}";
18429 operands[3] = GEN_INT (mask);
18430 return "vperm2<i128>\t{%3, %2, %1, %0|%0, %1, %2, %3}";
18432 [(set_attr "type" "sselog")
18433 (set_attr "prefix_extra" "1")
18434 (set_attr "length_immediate" "1")
18435 (set_attr "prefix" "vex")
18436 (set_attr "mode" "<sseinsnmode>")])
18438 (define_insn "*ssse3_palignr<mode>_perm"
18439 [(set (match_operand:V_128 0 "register_operand" "=x,x,v")
18441 (match_operand:V_128 1 "register_operand" "0,x,v")
18442 (match_parallel 2 "palignr_operand"
18443 [(match_operand 3 "const_int_operand" "n,n,n")])))]
18446 operands[2] = (GEN_INT (INTVAL (operands[3])
18447 * GET_MODE_UNIT_SIZE (GET_MODE (operands[0]))));
18449 switch (which_alternative)
18452 return "palignr\t{%2, %1, %0|%0, %1, %2}";
18455 return "vpalignr\t{%2, %1, %1, %0|%0, %1, %1, %2}";
18457 gcc_unreachable ();
18460 [(set_attr "isa" "noavx,avx,avx512bw")
18461 (set_attr "type" "sseishft")
18462 (set_attr "atom_unit" "sishuf")
18463 (set_attr "prefix_data16" "1,*,*")
18464 (set_attr "prefix_extra" "1")
18465 (set_attr "length_immediate" "1")
18466 (set_attr "prefix" "orig,vex,evex")])
18468 (define_expand "avx512vl_vinsert<mode>"
18469 [(match_operand:VI48F_256 0 "register_operand")
18470 (match_operand:VI48F_256 1 "register_operand")
18471 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand")
18472 (match_operand:SI 3 "const_0_to_1_operand")
18473 (match_operand:VI48F_256 4 "register_operand")
18474 (match_operand:<avx512fmaskmode> 5 "register_operand")]
18477 rtx (*insn)(rtx, rtx, rtx, rtx, rtx);
18479 switch (INTVAL (operands[3]))
18482 insn = gen_vec_set_lo_<mode>_mask;
18485 insn = gen_vec_set_hi_<mode>_mask;
18488 gcc_unreachable ();
18491 emit_insn (insn (operands[0], operands[1], operands[2], operands[4],
18496 (define_expand "avx_vinsertf128<mode>"
18497 [(match_operand:V_256 0 "register_operand")
18498 (match_operand:V_256 1 "register_operand")
18499 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand")
18500 (match_operand:SI 3 "const_0_to_1_operand")]
18503 rtx (*insn)(rtx, rtx, rtx);
18505 switch (INTVAL (operands[3]))
18508 insn = gen_vec_set_lo_<mode>;
18511 insn = gen_vec_set_hi_<mode>;
18514 gcc_unreachable ();
18517 emit_insn (insn (operands[0], operands[1], operands[2]));
18521 (define_insn "vec_set_lo_<mode><mask_name>"
18522 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
18523 (vec_concat:VI8F_256
18524 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
18525 (vec_select:<ssehalfvecmode>
18526 (match_operand:VI8F_256 1 "register_operand" "v")
18527 (parallel [(const_int 2) (const_int 3)]))))]
18528 "TARGET_AVX && <mask_avx512dq_condition>"
18530 if (TARGET_AVX512DQ)
18531 return "vinsert<shuffletype>64x2\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}";
18532 else if (TARGET_AVX512VL)
18533 return "vinsert<shuffletype>32x4\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}";
18535 return "vinsert<i128>\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}";
18537 [(set_attr "type" "sselog")
18538 (set_attr "prefix_extra" "1")
18539 (set_attr "length_immediate" "1")
18540 (set_attr "prefix" "vex")
18541 (set_attr "mode" "<sseinsnmode>")])
18543 (define_insn "vec_set_hi_<mode><mask_name>"
18544 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
18545 (vec_concat:VI8F_256
18546 (vec_select:<ssehalfvecmode>
18547 (match_operand:VI8F_256 1 "register_operand" "v")
18548 (parallel [(const_int 0) (const_int 1)]))
18549 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
18550 "TARGET_AVX && <mask_avx512dq_condition>"
18552 if (TARGET_AVX512DQ)
18553 return "vinsert<shuffletype>64x2\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}";
18554 else if (TARGET_AVX512VL)
18555 return "vinsert<shuffletype>32x4\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}";
18557 return "vinsert<i128>\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}";
18559 [(set_attr "type" "sselog")
18560 (set_attr "prefix_extra" "1")
18561 (set_attr "length_immediate" "1")
18562 (set_attr "prefix" "vex")
18563 (set_attr "mode" "<sseinsnmode>")])
18565 (define_insn "vec_set_lo_<mode><mask_name>"
18566 [(set (match_operand:VI4F_256 0 "register_operand" "=v")
18567 (vec_concat:VI4F_256
18568 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
18569 (vec_select:<ssehalfvecmode>
18570 (match_operand:VI4F_256 1 "register_operand" "v")
18571 (parallel [(const_int 4) (const_int 5)
18572 (const_int 6) (const_int 7)]))))]
18575 if (TARGET_AVX512VL)
18576 return "vinsert<shuffletype>32x4\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}";
18578 return "vinsert<i128>\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}";
18580 [(set_attr "type" "sselog")
18581 (set_attr "prefix_extra" "1")
18582 (set_attr "length_immediate" "1")
18583 (set_attr "prefix" "vex")
18584 (set_attr "mode" "<sseinsnmode>")])
18586 (define_insn "vec_set_hi_<mode><mask_name>"
18587 [(set (match_operand:VI4F_256 0 "register_operand" "=v")
18588 (vec_concat:VI4F_256
18589 (vec_select:<ssehalfvecmode>
18590 (match_operand:VI4F_256 1 "register_operand" "v")
18591 (parallel [(const_int 0) (const_int 1)
18592 (const_int 2) (const_int 3)]))
18593 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
18596 if (TARGET_AVX512VL)
18597 return "vinsert<shuffletype>32x4\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}";
18599 return "vinsert<i128>\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}";
18601 [(set_attr "type" "sselog")
18602 (set_attr "prefix_extra" "1")
18603 (set_attr "length_immediate" "1")
18604 (set_attr "prefix" "vex")
18605 (set_attr "mode" "<sseinsnmode>")])
18607 (define_insn "vec_set_lo_v16hi"
18608 [(set (match_operand:V16HI 0 "register_operand" "=x,v")
18610 (match_operand:V8HI 2 "nonimmediate_operand" "xm,vm")
18612 (match_operand:V16HI 1 "register_operand" "x,v")
18613 (parallel [(const_int 8) (const_int 9)
18614 (const_int 10) (const_int 11)
18615 (const_int 12) (const_int 13)
18616 (const_int 14) (const_int 15)]))))]
18619 vinsert%~128\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}
18620 vinserti32x4\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}"
18621 [(set_attr "type" "sselog")
18622 (set_attr "prefix_extra" "1")
18623 (set_attr "length_immediate" "1")
18624 (set_attr "prefix" "vex,evex")
18625 (set_attr "mode" "OI")])
18627 (define_insn "vec_set_hi_v16hi"
18628 [(set (match_operand:V16HI 0 "register_operand" "=x,v")
18631 (match_operand:V16HI 1 "register_operand" "x,v")
18632 (parallel [(const_int 0) (const_int 1)
18633 (const_int 2) (const_int 3)
18634 (const_int 4) (const_int 5)
18635 (const_int 6) (const_int 7)]))
18636 (match_operand:V8HI 2 "nonimmediate_operand" "xm,vm")))]
18639 vinsert%~128\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}
18640 vinserti32x4\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}"
18641 [(set_attr "type" "sselog")
18642 (set_attr "prefix_extra" "1")
18643 (set_attr "length_immediate" "1")
18644 (set_attr "prefix" "vex,evex")
18645 (set_attr "mode" "OI")])
18647 (define_insn "vec_set_lo_v32qi"
18648 [(set (match_operand:V32QI 0 "register_operand" "=x,v")
18650 (match_operand:V16QI 2 "nonimmediate_operand" "xm,v")
18652 (match_operand:V32QI 1 "register_operand" "x,v")
18653 (parallel [(const_int 16) (const_int 17)
18654 (const_int 18) (const_int 19)
18655 (const_int 20) (const_int 21)
18656 (const_int 22) (const_int 23)
18657 (const_int 24) (const_int 25)
18658 (const_int 26) (const_int 27)
18659 (const_int 28) (const_int 29)
18660 (const_int 30) (const_int 31)]))))]
18663 vinsert%~128\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}
18664 vinserti32x4\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}"
18665 [(set_attr "type" "sselog")
18666 (set_attr "prefix_extra" "1")
18667 (set_attr "length_immediate" "1")
18668 (set_attr "prefix" "vex,evex")
18669 (set_attr "mode" "OI")])
18671 (define_insn "vec_set_hi_v32qi"
18672 [(set (match_operand:V32QI 0 "register_operand" "=x,v")
18675 (match_operand:V32QI 1 "register_operand" "x,v")
18676 (parallel [(const_int 0) (const_int 1)
18677 (const_int 2) (const_int 3)
18678 (const_int 4) (const_int 5)
18679 (const_int 6) (const_int 7)
18680 (const_int 8) (const_int 9)
18681 (const_int 10) (const_int 11)
18682 (const_int 12) (const_int 13)
18683 (const_int 14) (const_int 15)]))
18684 (match_operand:V16QI 2 "nonimmediate_operand" "xm,vm")))]
18687 vinsert%~128\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}
18688 vinserti32x4\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}"
18689 [(set_attr "type" "sselog")
18690 (set_attr "prefix_extra" "1")
18691 (set_attr "length_immediate" "1")
18692 (set_attr "prefix" "vex,evex")
18693 (set_attr "mode" "OI")])
18695 (define_insn "<avx_avx2>_maskload<ssemodesuffix><avxsizesuffix>"
18696 [(set (match_operand:V48_AVX2 0 "register_operand" "=x")
18698 [(match_operand:<sseintvecmode> 2 "register_operand" "x")
18699 (match_operand:V48_AVX2 1 "memory_operand" "m")]
18702 "v<sseintprefix>maskmov<ssemodesuffix>\t{%1, %2, %0|%0, %2, %1}"
18703 [(set_attr "type" "sselog1")
18704 (set_attr "prefix_extra" "1")
18705 (set_attr "prefix" "vex")
18706 (set_attr "btver2_decode" "vector")
18707 (set_attr "mode" "<sseinsnmode>")])
18709 (define_insn "<avx_avx2>_maskstore<ssemodesuffix><avxsizesuffix>"
18710 [(set (match_operand:V48_AVX2 0 "memory_operand" "+m")
18712 [(match_operand:<sseintvecmode> 1 "register_operand" "x")
18713 (match_operand:V48_AVX2 2 "register_operand" "x")
18717 "v<sseintprefix>maskmov<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
18718 [(set_attr "type" "sselog1")
18719 (set_attr "prefix_extra" "1")
18720 (set_attr "prefix" "vex")
18721 (set_attr "btver2_decode" "vector")
18722 (set_attr "mode" "<sseinsnmode>")])
18724 (define_expand "maskload<mode><sseintvecmodelower>"
18725 [(set (match_operand:V48_AVX2 0 "register_operand")
18727 [(match_operand:<sseintvecmode> 2 "register_operand")
18728 (match_operand:V48_AVX2 1 "memory_operand")]
18732 (define_expand "maskload<mode><avx512fmaskmodelower>"
18733 [(set (match_operand:V48_AVX512VL 0 "register_operand")
18734 (vec_merge:V48_AVX512VL
18735 (match_operand:V48_AVX512VL 1 "memory_operand")
18737 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18740 (define_expand "maskload<mode><avx512fmaskmodelower>"
18741 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
18742 (vec_merge:VI12_AVX512VL
18743 (match_operand:VI12_AVX512VL 1 "memory_operand")
18745 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18748 (define_expand "maskstore<mode><sseintvecmodelower>"
18749 [(set (match_operand:V48_AVX2 0 "memory_operand")
18751 [(match_operand:<sseintvecmode> 2 "register_operand")
18752 (match_operand:V48_AVX2 1 "register_operand")
18757 (define_expand "maskstore<mode><avx512fmaskmodelower>"
18758 [(set (match_operand:V48_AVX512VL 0 "memory_operand")
18759 (vec_merge:V48_AVX512VL
18760 (match_operand:V48_AVX512VL 1 "register_operand")
18762 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18765 (define_expand "maskstore<mode><avx512fmaskmodelower>"
18766 [(set (match_operand:VI12_AVX512VL 0 "memory_operand")
18767 (vec_merge:VI12_AVX512VL
18768 (match_operand:VI12_AVX512VL 1 "register_operand")
18770 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18773 (define_expand "cbranch<mode>4"
18774 [(set (reg:CC FLAGS_REG)
18775 (compare:CC (match_operand:VI48_AVX 1 "register_operand")
18776 (match_operand:VI48_AVX 2 "nonimmediate_operand")))
18777 (set (pc) (if_then_else
18778 (match_operator 0 "bt_comparison_operator"
18779 [(reg:CC FLAGS_REG) (const_int 0)])
18780 (label_ref (match_operand 3))
18784 ix86_expand_branch (GET_CODE (operands[0]),
18785 operands[1], operands[2], operands[3]);
18790 (define_insn_and_split "avx_<castmode><avxsizesuffix>_<castmode>"
18791 [(set (match_operand:AVX256MODE2P 0 "nonimmediate_operand" "=x,m")
18792 (unspec:AVX256MODE2P
18793 [(match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "xm,x")]
18795 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
18797 "&& reload_completed"
18798 [(set (match_dup 0) (match_dup 1))]
18800 if (REG_P (operands[0]))
18801 operands[0] = gen_lowpart (<ssehalfvecmode>mode, operands[0]);
18803 operands[1] = lowpart_subreg (<MODE>mode, operands[1],
18804 <ssehalfvecmode>mode);
18807 ;; Modes handled by vec_init expanders.
18808 (define_mode_iterator VEC_INIT_MODE
18809 [(V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI
18810 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX") V8HI
18811 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
18812 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI
18813 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
18814 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")
18815 (V4TI "TARGET_AVX512F") (V2TI "TARGET_AVX")])
18817 ;; Likewise, but for initialization from half sized vectors.
18818 ;; Thus, these are all VEC_INIT_MODE modes except V2??.
18819 (define_mode_iterator VEC_INIT_HALF_MODE
18820 [(V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI
18821 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX") V8HI
18822 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
18823 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX")
18824 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
18825 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX")
18826 (V4TI "TARGET_AVX512F")])
18828 (define_expand "vec_init<mode><ssescalarmodelower>"
18829 [(match_operand:VEC_INIT_MODE 0 "register_operand")
18833 ix86_expand_vector_init (false, operands[0], operands[1]);
18837 (define_expand "vec_init<mode><ssehalfvecmodelower>"
18838 [(match_operand:VEC_INIT_HALF_MODE 0 "register_operand")
18842 ix86_expand_vector_init (false, operands[0], operands[1]);
18846 (define_insn "<avx2_avx512>_ashrv<mode><mask_name>"
18847 [(set (match_operand:VI48_AVX512F_AVX512VL 0 "register_operand" "=v")
18848 (ashiftrt:VI48_AVX512F_AVX512VL
18849 (match_operand:VI48_AVX512F_AVX512VL 1 "register_operand" "v")
18850 (match_operand:VI48_AVX512F_AVX512VL 2 "nonimmediate_operand" "vm")))]
18851 "TARGET_AVX2 && <mask_mode512bit_condition>"
18852 "vpsrav<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18853 [(set_attr "type" "sseishft")
18854 (set_attr "prefix" "maybe_evex")
18855 (set_attr "mode" "<sseinsnmode>")])
18857 (define_insn "<avx2_avx512>_ashrv<mode><mask_name>"
18858 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
18859 (ashiftrt:VI2_AVX512VL
18860 (match_operand:VI2_AVX512VL 1 "register_operand" "v")
18861 (match_operand:VI2_AVX512VL 2 "nonimmediate_operand" "vm")))]
18863 "vpsravw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18864 [(set_attr "type" "sseishft")
18865 (set_attr "prefix" "maybe_evex")
18866 (set_attr "mode" "<sseinsnmode>")])
18868 (define_insn "<avx2_avx512>_<shift_insn>v<mode><mask_name>"
18869 [(set (match_operand:VI48_AVX512F 0 "register_operand" "=v")
18870 (any_lshift:VI48_AVX512F
18871 (match_operand:VI48_AVX512F 1 "register_operand" "v")
18872 (match_operand:VI48_AVX512F 2 "nonimmediate_operand" "vm")))]
18873 "TARGET_AVX2 && <mask_mode512bit_condition>"
18874 "vp<vshift>v<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18875 [(set_attr "type" "sseishft")
18876 (set_attr "prefix" "maybe_evex")
18877 (set_attr "mode" "<sseinsnmode>")])
18879 (define_insn "<avx2_avx512>_<shift_insn>v<mode><mask_name>"
18880 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
18881 (any_lshift:VI2_AVX512VL
18882 (match_operand:VI2_AVX512VL 1 "register_operand" "v")
18883 (match_operand:VI2_AVX512VL 2 "nonimmediate_operand" "vm")))]
18885 "vp<vshift>v<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18886 [(set_attr "type" "sseishft")
18887 (set_attr "prefix" "maybe_evex")
18888 (set_attr "mode" "<sseinsnmode>")])
18890 (define_insn "avx_vec_concat<mode>"
18891 [(set (match_operand:V_256_512 0 "register_operand" "=x,v,x,Yv")
18892 (vec_concat:V_256_512
18893 (match_operand:<ssehalfvecmode> 1 "register_operand" "x,v,x,v")
18894 (match_operand:<ssehalfvecmode> 2 "vector_move_operand" "xm,vm,C,C")))]
18897 switch (which_alternative)
18900 return "vinsert<i128>\t{$0x1, %2, %<concat_tg_mode>1, %0|%0, %<concat_tg_mode>1, %2, 0x1}";
18902 if (<MODE_SIZE> == 64)
18904 if (TARGET_AVX512DQ && GET_MODE_SIZE (<ssescalarmode>mode) == 4)
18905 return "vinsert<shuffletype>32x8\t{$0x1, %2, %<concat_tg_mode>1, %0|%0, %<concat_tg_mode>1, %2, 0x1}";
18907 return "vinsert<shuffletype>64x4\t{$0x1, %2, %<concat_tg_mode>1, %0|%0, %<concat_tg_mode>1, %2, 0x1}";
18911 if (TARGET_AVX512DQ && GET_MODE_SIZE (<ssescalarmode>mode) == 8)
18912 return "vinsert<shuffletype>64x2\t{$0x1, %2, %<concat_tg_mode>1, %0|%0, %<concat_tg_mode>1, %2, 0x1}";
18914 return "vinsert<shuffletype>32x4\t{$0x1, %2, %<concat_tg_mode>1, %0|%0, %<concat_tg_mode>1, %2, 0x1}";
18918 switch (get_attr_mode (insn))
18921 return "vmovaps\t{%1, %t0|%t0, %1}";
18923 return "vmovapd\t{%1, %t0|%t0, %1}";
18925 return "vmovaps\t{%1, %x0|%x0, %1}";
18927 return "vmovapd\t{%1, %x0|%x0, %1}";
18929 if (which_alternative == 2)
18930 return "vmovdqa\t{%1, %t0|%t0, %1}";
18931 else if (GET_MODE_SIZE (<ssescalarmode>mode) == 8)
18932 return "vmovdqa64\t{%1, %t0|%t0, %1}";
18934 return "vmovdqa32\t{%1, %t0|%t0, %1}";
18936 if (which_alternative == 2)
18937 return "vmovdqa\t{%1, %x0|%x0, %1}";
18938 else if (GET_MODE_SIZE (<ssescalarmode>mode) == 8)
18939 return "vmovdqa64\t{%1, %x0|%x0, %1}";
18941 return "vmovdqa32\t{%1, %x0|%x0, %1}";
18943 gcc_unreachable ();
18946 gcc_unreachable ();
18949 [(set_attr "type" "sselog,sselog,ssemov,ssemov")
18950 (set_attr "prefix_extra" "1,1,*,*")
18951 (set_attr "length_immediate" "1,1,*,*")
18952 (set_attr "prefix" "maybe_evex")
18953 (set_attr "mode" "<sseinsnmode>")])
18955 (define_insn "vcvtph2ps<mask_name>"
18956 [(set (match_operand:V4SF 0 "register_operand" "=v")
18958 (unspec:V8SF [(match_operand:V8HI 1 "register_operand" "v")]
18960 (parallel [(const_int 0) (const_int 1)
18961 (const_int 2) (const_int 3)])))]
18962 "TARGET_F16C || TARGET_AVX512VL"
18963 "vcvtph2ps\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
18964 [(set_attr "type" "ssecvt")
18965 (set_attr "prefix" "maybe_evex")
18966 (set_attr "mode" "V4SF")])
18968 (define_insn "*vcvtph2ps_load<mask_name>"
18969 [(set (match_operand:V4SF 0 "register_operand" "=v")
18970 (unspec:V4SF [(match_operand:V4HI 1 "memory_operand" "m")]
18971 UNSPEC_VCVTPH2PS))]
18972 "TARGET_F16C || TARGET_AVX512VL"
18973 "vcvtph2ps\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
18974 [(set_attr "type" "ssecvt")
18975 (set_attr "prefix" "vex")
18976 (set_attr "mode" "V8SF")])
18978 (define_insn "vcvtph2ps256<mask_name>"
18979 [(set (match_operand:V8SF 0 "register_operand" "=v")
18980 (unspec:V8SF [(match_operand:V8HI 1 "nonimmediate_operand" "vm")]
18981 UNSPEC_VCVTPH2PS))]
18982 "TARGET_F16C || TARGET_AVX512VL"
18983 "vcvtph2ps\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
18984 [(set_attr "type" "ssecvt")
18985 (set_attr "prefix" "vex")
18986 (set_attr "btver2_decode" "double")
18987 (set_attr "mode" "V8SF")])
18989 (define_insn "<mask_codefor>avx512f_vcvtph2ps512<mask_name><round_saeonly_name>"
18990 [(set (match_operand:V16SF 0 "register_operand" "=v")
18992 [(match_operand:V16HI 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
18993 UNSPEC_VCVTPH2PS))]
18995 "vcvtph2ps\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
18996 [(set_attr "type" "ssecvt")
18997 (set_attr "prefix" "evex")
18998 (set_attr "mode" "V16SF")])
19000 (define_expand "vcvtps2ph_mask"
19001 [(set (match_operand:V8HI 0 "register_operand")
19004 (unspec:V4HI [(match_operand:V4SF 1 "register_operand")
19005 (match_operand:SI 2 "const_0_to_255_operand")]
19008 (match_operand:V8HI 3 "vector_move_operand")
19009 (match_operand:QI 4 "register_operand")))]
19011 "operands[5] = CONST0_RTX (V4HImode);")
19013 (define_expand "vcvtps2ph"
19014 [(set (match_operand:V8HI 0 "register_operand")
19016 (unspec:V4HI [(match_operand:V4SF 1 "register_operand")
19017 (match_operand:SI 2 "const_0_to_255_operand")]
19021 "operands[3] = CONST0_RTX (V4HImode);")
19023 (define_insn "*vcvtps2ph<mask_name>"
19024 [(set (match_operand:V8HI 0 "register_operand" "=v")
19026 (unspec:V4HI [(match_operand:V4SF 1 "register_operand" "v")
19027 (match_operand:SI 2 "const_0_to_255_operand" "N")]
19029 (match_operand:V4HI 3 "const0_operand")))]
19030 "(TARGET_F16C || TARGET_AVX512VL) && <mask_avx512vl_condition>"
19031 "vcvtps2ph\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}"
19032 [(set_attr "type" "ssecvt")
19033 (set_attr "prefix" "maybe_evex")
19034 (set_attr "mode" "V4SF")])
19036 (define_insn "*vcvtps2ph_store<mask_name>"
19037 [(set (match_operand:V4HI 0 "memory_operand" "=m")
19038 (unspec:V4HI [(match_operand:V4SF 1 "register_operand" "v")
19039 (match_operand:SI 2 "const_0_to_255_operand" "N")]
19040 UNSPEC_VCVTPS2PH))]
19041 "TARGET_F16C || TARGET_AVX512VL"
19042 "vcvtps2ph\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
19043 [(set_attr "type" "ssecvt")
19044 (set_attr "prefix" "maybe_evex")
19045 (set_attr "mode" "V4SF")])
19047 (define_insn "vcvtps2ph256<mask_name>"
19048 [(set (match_operand:V8HI 0 "nonimmediate_operand" "=vm")
19049 (unspec:V8HI [(match_operand:V8SF 1 "register_operand" "v")
19050 (match_operand:SI 2 "const_0_to_255_operand" "N")]
19051 UNSPEC_VCVTPS2PH))]
19052 "TARGET_F16C || TARGET_AVX512VL"
19053 "vcvtps2ph\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
19054 [(set_attr "type" "ssecvt")
19055 (set_attr "prefix" "maybe_evex")
19056 (set_attr "btver2_decode" "vector")
19057 (set_attr "mode" "V8SF")])
19059 (define_insn "<mask_codefor>avx512f_vcvtps2ph512<mask_name>"
19060 [(set (match_operand:V16HI 0 "nonimmediate_operand" "=vm")
19062 [(match_operand:V16SF 1 "register_operand" "v")
19063 (match_operand:SI 2 "const_0_to_255_operand" "N")]
19064 UNSPEC_VCVTPS2PH))]
19066 "vcvtps2ph\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
19067 [(set_attr "type" "ssecvt")
19068 (set_attr "prefix" "evex")
19069 (set_attr "mode" "V16SF")])
19071 ;; For gather* insn patterns
19072 (define_mode_iterator VEC_GATHER_MODE
19073 [V2DI V2DF V4DI V4DF V4SI V4SF V8SI V8SF])
19074 (define_mode_attr VEC_GATHER_IDXSI
19075 [(V2DI "V4SI") (V4DI "V4SI") (V8DI "V8SI")
19076 (V2DF "V4SI") (V4DF "V4SI") (V8DF "V8SI")
19077 (V4SI "V4SI") (V8SI "V8SI") (V16SI "V16SI")
19078 (V4SF "V4SI") (V8SF "V8SI") (V16SF "V16SI")])
19080 (define_mode_attr VEC_GATHER_IDXDI
19081 [(V2DI "V2DI") (V4DI "V4DI") (V8DI "V8DI")
19082 (V2DF "V2DI") (V4DF "V4DI") (V8DF "V8DI")
19083 (V4SI "V2DI") (V8SI "V4DI") (V16SI "V8DI")
19084 (V4SF "V2DI") (V8SF "V4DI") (V16SF "V8DI")])
19086 (define_mode_attr VEC_GATHER_SRCDI
19087 [(V2DI "V2DI") (V4DI "V4DI") (V8DI "V8DI")
19088 (V2DF "V2DF") (V4DF "V4DF") (V8DF "V8DF")
19089 (V4SI "V4SI") (V8SI "V4SI") (V16SI "V8SI")
19090 (V4SF "V4SF") (V8SF "V4SF") (V16SF "V8SF")])
19092 (define_expand "avx2_gathersi<mode>"
19093 [(parallel [(set (match_operand:VEC_GATHER_MODE 0 "register_operand")
19094 (unspec:VEC_GATHER_MODE
19095 [(match_operand:VEC_GATHER_MODE 1 "register_operand")
19096 (mem:<ssescalarmode>
19098 [(match_operand 2 "vsib_address_operand")
19099 (match_operand:<VEC_GATHER_IDXSI>
19100 3 "register_operand")
19101 (match_operand:SI 5 "const1248_operand ")]))
19102 (mem:BLK (scratch))
19103 (match_operand:VEC_GATHER_MODE 4 "register_operand")]
19105 (clobber (match_scratch:VEC_GATHER_MODE 7))])]
19109 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
19110 operands[5]), UNSPEC_VSIBADDR);
19113 (define_insn "*avx2_gathersi<mode>"
19114 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
19115 (unspec:VEC_GATHER_MODE
19116 [(match_operand:VEC_GATHER_MODE 2 "register_operand" "0")
19117 (match_operator:<ssescalarmode> 7 "vsib_mem_operator"
19119 [(match_operand:P 3 "vsib_address_operand" "Tv")
19120 (match_operand:<VEC_GATHER_IDXSI> 4 "register_operand" "x")
19121 (match_operand:SI 6 "const1248_operand" "n")]
19123 (mem:BLK (scratch))
19124 (match_operand:VEC_GATHER_MODE 5 "register_operand" "1")]
19126 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
19128 "v<sseintprefix>gatherd<ssemodesuffix>\t{%1, %7, %0|%0, %7, %1}"
19129 [(set_attr "type" "ssemov")
19130 (set_attr "prefix" "vex")
19131 (set_attr "mode" "<sseinsnmode>")])
19133 (define_insn "*avx2_gathersi<mode>_2"
19134 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
19135 (unspec:VEC_GATHER_MODE
19137 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
19139 [(match_operand:P 2 "vsib_address_operand" "Tv")
19140 (match_operand:<VEC_GATHER_IDXSI> 3 "register_operand" "x")
19141 (match_operand:SI 5 "const1248_operand" "n")]
19143 (mem:BLK (scratch))
19144 (match_operand:VEC_GATHER_MODE 4 "register_operand" "1")]
19146 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
19148 "v<sseintprefix>gatherd<ssemodesuffix>\t{%1, %6, %0|%0, %6, %1}"
19149 [(set_attr "type" "ssemov")
19150 (set_attr "prefix" "vex")
19151 (set_attr "mode" "<sseinsnmode>")])
19153 (define_expand "avx2_gatherdi<mode>"
19154 [(parallel [(set (match_operand:VEC_GATHER_MODE 0 "register_operand")
19155 (unspec:VEC_GATHER_MODE
19156 [(match_operand:<VEC_GATHER_SRCDI> 1 "register_operand")
19157 (mem:<ssescalarmode>
19159 [(match_operand 2 "vsib_address_operand")
19160 (match_operand:<VEC_GATHER_IDXDI>
19161 3 "register_operand")
19162 (match_operand:SI 5 "const1248_operand ")]))
19163 (mem:BLK (scratch))
19164 (match_operand:<VEC_GATHER_SRCDI> 4 "register_operand")]
19166 (clobber (match_scratch:VEC_GATHER_MODE 7))])]
19170 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
19171 operands[5]), UNSPEC_VSIBADDR);
19174 (define_insn "*avx2_gatherdi<mode>"
19175 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
19176 (unspec:VEC_GATHER_MODE
19177 [(match_operand:<VEC_GATHER_SRCDI> 2 "register_operand" "0")
19178 (match_operator:<ssescalarmode> 7 "vsib_mem_operator"
19180 [(match_operand:P 3 "vsib_address_operand" "Tv")
19181 (match_operand:<VEC_GATHER_IDXDI> 4 "register_operand" "x")
19182 (match_operand:SI 6 "const1248_operand" "n")]
19184 (mem:BLK (scratch))
19185 (match_operand:<VEC_GATHER_SRCDI> 5 "register_operand" "1")]
19187 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
19189 "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %7, %2|%2, %7, %5}"
19190 [(set_attr "type" "ssemov")
19191 (set_attr "prefix" "vex")
19192 (set_attr "mode" "<sseinsnmode>")])
19194 (define_insn "*avx2_gatherdi<mode>_2"
19195 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
19196 (unspec:VEC_GATHER_MODE
19198 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
19200 [(match_operand:P 2 "vsib_address_operand" "Tv")
19201 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand" "x")
19202 (match_operand:SI 5 "const1248_operand" "n")]
19204 (mem:BLK (scratch))
19205 (match_operand:<VEC_GATHER_SRCDI> 4 "register_operand" "1")]
19207 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
19210 if (<MODE>mode != <VEC_GATHER_SRCDI>mode)
19211 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%4, %6, %x0|%x0, %6, %4}";
19212 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%4, %6, %0|%0, %6, %4}";
19214 [(set_attr "type" "ssemov")
19215 (set_attr "prefix" "vex")
19216 (set_attr "mode" "<sseinsnmode>")])
19218 (define_insn "*avx2_gatherdi<mode>_3"
19219 [(set (match_operand:<VEC_GATHER_SRCDI> 0 "register_operand" "=&x")
19220 (vec_select:<VEC_GATHER_SRCDI>
19222 [(match_operand:<VEC_GATHER_SRCDI> 2 "register_operand" "0")
19223 (match_operator:<ssescalarmode> 7 "vsib_mem_operator"
19225 [(match_operand:P 3 "vsib_address_operand" "Tv")
19226 (match_operand:<VEC_GATHER_IDXDI> 4 "register_operand" "x")
19227 (match_operand:SI 6 "const1248_operand" "n")]
19229 (mem:BLK (scratch))
19230 (match_operand:<VEC_GATHER_SRCDI> 5 "register_operand" "1")]
19232 (parallel [(const_int 0) (const_int 1)
19233 (const_int 2) (const_int 3)])))
19234 (clobber (match_scratch:VI4F_256 1 "=&x"))]
19236 "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %7, %0|%0, %7, %5}"
19237 [(set_attr "type" "ssemov")
19238 (set_attr "prefix" "vex")
19239 (set_attr "mode" "<sseinsnmode>")])
19241 (define_insn "*avx2_gatherdi<mode>_4"
19242 [(set (match_operand:<VEC_GATHER_SRCDI> 0 "register_operand" "=&x")
19243 (vec_select:<VEC_GATHER_SRCDI>
19246 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
19248 [(match_operand:P 2 "vsib_address_operand" "Tv")
19249 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand" "x")
19250 (match_operand:SI 5 "const1248_operand" "n")]
19252 (mem:BLK (scratch))
19253 (match_operand:<VEC_GATHER_SRCDI> 4 "register_operand" "1")]
19255 (parallel [(const_int 0) (const_int 1)
19256 (const_int 2) (const_int 3)])))
19257 (clobber (match_scratch:VI4F_256 1 "=&x"))]
19259 "v<sseintprefix>gatherq<ssemodesuffix>\t{%4, %6, %0|%0, %6, %4}"
19260 [(set_attr "type" "ssemov")
19261 (set_attr "prefix" "vex")
19262 (set_attr "mode" "<sseinsnmode>")])
19264 ;; Memory operand override for -masm=intel of the v*gatherq* patterns.
19265 (define_mode_attr gatherq_mode
19266 [(V4SI "q") (V2DI "x") (V4SF "q") (V2DF "x")
19267 (V8SI "x") (V4DI "t") (V8SF "x") (V4DF "t")
19268 (V16SI "t") (V8DI "g") (V16SF "t") (V8DF "g")])
19270 (define_expand "<avx512>_gathersi<mode>"
19271 [(parallel [(set (match_operand:VI48F 0 "register_operand")
19273 [(match_operand:VI48F 1 "register_operand")
19274 (match_operand:<avx512fmaskmode> 4 "register_operand")
19275 (mem:<ssescalarmode>
19277 [(match_operand 2 "vsib_address_operand")
19278 (match_operand:<VEC_GATHER_IDXSI> 3 "register_operand")
19279 (match_operand:SI 5 "const1248_operand")]))]
19281 (clobber (match_scratch:<avx512fmaskmode> 7))])]
19285 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
19286 operands[5]), UNSPEC_VSIBADDR);
19289 (define_insn "*avx512f_gathersi<mode>"
19290 [(set (match_operand:VI48F 0 "register_operand" "=&v")
19292 [(match_operand:VI48F 1 "register_operand" "0")
19293 (match_operand:<avx512fmaskmode> 7 "register_operand" "2")
19294 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
19296 [(match_operand:P 4 "vsib_address_operand" "Tv")
19297 (match_operand:<VEC_GATHER_IDXSI> 3 "register_operand" "v")
19298 (match_operand:SI 5 "const1248_operand" "n")]
19299 UNSPEC_VSIBADDR)])]
19301 (clobber (match_scratch:<avx512fmaskmode> 2 "=&Yk"))]
19303 "v<sseintprefix>gatherd<ssemodesuffix>\t{%6, %0%{%2%}|%0%{%2%}, %<xtg_mode>6}"
19304 [(set_attr "type" "ssemov")
19305 (set_attr "prefix" "evex")
19306 (set_attr "mode" "<sseinsnmode>")])
19308 (define_insn "*avx512f_gathersi<mode>_2"
19309 [(set (match_operand:VI48F 0 "register_operand" "=&v")
19312 (match_operand:<avx512fmaskmode> 6 "register_operand" "1")
19313 (match_operator:<ssescalarmode> 5 "vsib_mem_operator"
19315 [(match_operand:P 3 "vsib_address_operand" "Tv")
19316 (match_operand:<VEC_GATHER_IDXSI> 2 "register_operand" "v")
19317 (match_operand:SI 4 "const1248_operand" "n")]
19318 UNSPEC_VSIBADDR)])]
19320 (clobber (match_scratch:<avx512fmaskmode> 1 "=&Yk"))]
19322 "v<sseintprefix>gatherd<ssemodesuffix>\t{%5, %0%{%1%}|%0%{%1%}, %<xtg_mode>5}"
19323 [(set_attr "type" "ssemov")
19324 (set_attr "prefix" "evex")
19325 (set_attr "mode" "<sseinsnmode>")])
19328 (define_expand "<avx512>_gatherdi<mode>"
19329 [(parallel [(set (match_operand:VI48F 0 "register_operand")
19331 [(match_operand:<VEC_GATHER_SRCDI> 1 "register_operand")
19332 (match_operand:QI 4 "register_operand")
19333 (mem:<ssescalarmode>
19335 [(match_operand 2 "vsib_address_operand")
19336 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand")
19337 (match_operand:SI 5 "const1248_operand")]))]
19339 (clobber (match_scratch:QI 7))])]
19343 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
19344 operands[5]), UNSPEC_VSIBADDR);
19347 (define_insn "*avx512f_gatherdi<mode>"
19348 [(set (match_operand:VI48F 0 "register_operand" "=&v")
19350 [(match_operand:<VEC_GATHER_SRCDI> 1 "register_operand" "0")
19351 (match_operand:QI 7 "register_operand" "2")
19352 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
19354 [(match_operand:P 4 "vsib_address_operand" "Tv")
19355 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand" "v")
19356 (match_operand:SI 5 "const1248_operand" "n")]
19357 UNSPEC_VSIBADDR)])]
19359 (clobber (match_scratch:QI 2 "=&Yk"))]
19362 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%6, %1%{%2%}|%1%{%2%}, %<gatherq_mode>6}";
19364 [(set_attr "type" "ssemov")
19365 (set_attr "prefix" "evex")
19366 (set_attr "mode" "<sseinsnmode>")])
19368 (define_insn "*avx512f_gatherdi<mode>_2"
19369 [(set (match_operand:VI48F 0 "register_operand" "=&v")
19372 (match_operand:QI 6 "register_operand" "1")
19373 (match_operator:<ssescalarmode> 5 "vsib_mem_operator"
19375 [(match_operand:P 3 "vsib_address_operand" "Tv")
19376 (match_operand:<VEC_GATHER_IDXDI> 2 "register_operand" "v")
19377 (match_operand:SI 4 "const1248_operand" "n")]
19378 UNSPEC_VSIBADDR)])]
19380 (clobber (match_scratch:QI 1 "=&Yk"))]
19383 if (<MODE>mode != <VEC_GATHER_SRCDI>mode)
19385 if (<MODE_SIZE> != 64)
19386 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %x0%{%1%}|%x0%{%1%}, %<gatherq_mode>5}";
19388 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %t0%{%1%}|%t0%{%1%}, %t5}";
19390 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %0%{%1%}|%0%{%1%}, %<gatherq_mode>5}";
19392 [(set_attr "type" "ssemov")
19393 (set_attr "prefix" "evex")
19394 (set_attr "mode" "<sseinsnmode>")])
19396 (define_expand "<avx512>_scattersi<mode>"
19397 [(parallel [(set (mem:VI48F
19399 [(match_operand 0 "vsib_address_operand")
19400 (match_operand:<VEC_GATHER_IDXSI> 2 "register_operand")
19401 (match_operand:SI 4 "const1248_operand")]))
19403 [(match_operand:<avx512fmaskmode> 1 "register_operand")
19404 (match_operand:VI48F 3 "register_operand")]
19406 (clobber (match_scratch:<avx512fmaskmode> 6))])]
19410 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[0], operands[2],
19411 operands[4]), UNSPEC_VSIBADDR);
19414 (define_insn "*avx512f_scattersi<mode>"
19415 [(set (match_operator:VI48F 5 "vsib_mem_operator"
19417 [(match_operand:P 0 "vsib_address_operand" "Tv")
19418 (match_operand:<VEC_GATHER_IDXSI> 2 "register_operand" "v")
19419 (match_operand:SI 4 "const1248_operand" "n")]
19422 [(match_operand:<avx512fmaskmode> 6 "register_operand" "1")
19423 (match_operand:VI48F 3 "register_operand" "v")]
19425 (clobber (match_scratch:<avx512fmaskmode> 1 "=&Yk"))]
19427 "v<sseintprefix>scatterd<ssemodesuffix>\t{%3, %5%{%1%}|%5%{%1%}, %3}"
19428 [(set_attr "type" "ssemov")
19429 (set_attr "prefix" "evex")
19430 (set_attr "mode" "<sseinsnmode>")])
19432 (define_expand "<avx512>_scatterdi<mode>"
19433 [(parallel [(set (mem:VI48F
19435 [(match_operand 0 "vsib_address_operand")
19436 (match_operand:<VEC_GATHER_IDXDI> 2 "register_operand")
19437 (match_operand:SI 4 "const1248_operand")]))
19439 [(match_operand:QI 1 "register_operand")
19440 (match_operand:<VEC_GATHER_SRCDI> 3 "register_operand")]
19442 (clobber (match_scratch:QI 6))])]
19446 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[0], operands[2],
19447 operands[4]), UNSPEC_VSIBADDR);
19450 (define_insn "*avx512f_scatterdi<mode>"
19451 [(set (match_operator:VI48F 5 "vsib_mem_operator"
19453 [(match_operand:P 0 "vsib_address_operand" "Tv")
19454 (match_operand:<VEC_GATHER_IDXDI> 2 "register_operand" "v")
19455 (match_operand:SI 4 "const1248_operand" "n")]
19458 [(match_operand:QI 6 "register_operand" "1")
19459 (match_operand:<VEC_GATHER_SRCDI> 3 "register_operand" "v")]
19461 (clobber (match_scratch:QI 1 "=&Yk"))]
19464 if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 8)
19465 return "v<sseintprefix>scatterq<ssemodesuffix>\t{%3, %5%{%1%}|%5%{%1%}, %3}";
19466 return "v<sseintprefix>scatterq<ssemodesuffix>\t{%3, %5%{%1%}|%t5%{%1%}, %3}";
19468 [(set_attr "type" "ssemov")
19469 (set_attr "prefix" "evex")
19470 (set_attr "mode" "<sseinsnmode>")])
19472 (define_insn "<avx512>_compress<mode>_mask"
19473 [(set (match_operand:VI48F 0 "register_operand" "=v")
19475 [(match_operand:VI48F 1 "register_operand" "v")
19476 (match_operand:VI48F 2 "vector_move_operand" "0C")
19477 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")]
19480 "v<sseintprefix>compress<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
19481 [(set_attr "type" "ssemov")
19482 (set_attr "prefix" "evex")
19483 (set_attr "mode" "<sseinsnmode>")])
19485 (define_insn "compress<mode>_mask"
19486 [(set (match_operand:VI12_AVX512VLBW 0 "register_operand" "=v")
19487 (unspec:VI12_AVX512VLBW
19488 [(match_operand:VI12_AVX512VLBW 1 "register_operand" "v")
19489 (match_operand:VI12_AVX512VLBW 2 "vector_move_operand" "0C")
19490 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")]
19492 "TARGET_AVX512VBMI2"
19493 "vpcompress<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
19494 [(set_attr "type" "ssemov")
19495 (set_attr "prefix" "evex")
19496 (set_attr "mode" "<sseinsnmode>")])
19498 (define_insn "<avx512>_compressstore<mode>_mask"
19499 [(set (match_operand:VI48F 0 "memory_operand" "=m")
19501 [(match_operand:VI48F 1 "register_operand" "x")
19503 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")]
19504 UNSPEC_COMPRESS_STORE))]
19506 "v<sseintprefix>compress<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}"
19507 [(set_attr "type" "ssemov")
19508 (set_attr "prefix" "evex")
19509 (set_attr "memory" "store")
19510 (set_attr "mode" "<sseinsnmode>")])
19512 (define_insn "compressstore<mode>_mask"
19513 [(set (match_operand:VI12_AVX512VLBW 0 "memory_operand" "=m")
19514 (unspec:VI12_AVX512VLBW
19515 [(match_operand:VI12_AVX512VLBW 1 "register_operand" "x")
19517 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")]
19518 UNSPEC_COMPRESS_STORE))]
19519 "TARGET_AVX512VBMI2"
19520 "vpcompress<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}"
19521 [(set_attr "type" "ssemov")
19522 (set_attr "prefix" "evex")
19523 (set_attr "memory" "store")
19524 (set_attr "mode" "<sseinsnmode>")])
19526 (define_expand "<avx512>_expand<mode>_maskz"
19527 [(set (match_operand:VI48F 0 "register_operand")
19529 [(match_operand:VI48F 1 "nonimmediate_operand")
19530 (match_operand:VI48F 2 "vector_move_operand")
19531 (match_operand:<avx512fmaskmode> 3 "register_operand")]
19534 "operands[2] = CONST0_RTX (<MODE>mode);")
19536 (define_insn "<avx512>_expand<mode>_mask"
19537 [(set (match_operand:VI48F 0 "register_operand" "=v,v")
19539 [(match_operand:VI48F 1 "nonimmediate_operand" "v,m")
19540 (match_operand:VI48F 2 "vector_move_operand" "0C,0C")
19541 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")]
19544 "v<sseintprefix>expand<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
19545 [(set_attr "type" "ssemov")
19546 (set_attr "prefix" "evex")
19547 (set_attr "memory" "none,load")
19548 (set_attr "mode" "<sseinsnmode>")])
19550 (define_insn "expand<mode>_mask"
19551 [(set (match_operand:VI12_AVX512VLBW 0 "register_operand" "=v,v")
19552 (unspec:VI12_AVX512VLBW
19553 [(match_operand:VI12_AVX512VLBW 1 "nonimmediate_operand" "v,m")
19554 (match_operand:VI12_AVX512VLBW 2 "vector_move_operand" "0C,0C")
19555 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")]
19557 "TARGET_AVX512VBMI2"
19558 "v<sseintprefix>expand<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
19559 [(set_attr "type" "ssemov")
19560 (set_attr "prefix" "evex")
19561 (set_attr "memory" "none,load")
19562 (set_attr "mode" "<sseinsnmode>")])
19564 (define_expand "expand<mode>_maskz"
19565 [(set (match_operand:VI12_AVX512VLBW 0 "register_operand")
19566 (unspec:VI12_AVX512VLBW
19567 [(match_operand:VI12_AVX512VLBW 1 "nonimmediate_operand")
19568 (match_operand:VI12_AVX512VLBW 2 "vector_move_operand")
19569 (match_operand:<avx512fmaskmode> 3 "register_operand")]
19571 "TARGET_AVX512VBMI2"
19572 "operands[2] = CONST0_RTX (<MODE>mode);")
19574 (define_insn "avx512dq_rangep<mode><mask_name><round_saeonly_name>"
19575 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
19576 (unspec:VF_AVX512VL
19577 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
19578 (match_operand:VF_AVX512VL 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
19579 (match_operand:SI 3 "const_0_to_15_operand")]
19581 "TARGET_AVX512DQ && <round_saeonly_mode512bit_condition>"
19582 "vrange<ssemodesuffix>\t{%3, <round_saeonly_mask_op4>%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2<round_saeonly_mask_op4>, %3}"
19583 [(set_attr "type" "sse")
19584 (set_attr "prefix" "evex")
19585 (set_attr "mode" "<MODE>")])
19587 (define_insn "avx512dq_ranges<mode><mask_scalar_name><round_saeonly_scalar_name>"
19588 [(set (match_operand:VF_128 0 "register_operand" "=v")
19591 [(match_operand:VF_128 1 "register_operand" "v")
19592 (match_operand:VF_128 2 "<round_saeonly_scalar_nimm_predicate>" "<round_saeonly_scalar_constraint>")
19593 (match_operand:SI 3 "const_0_to_15_operand")]
19598 "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}"
19599 [(set_attr "type" "sse")
19600 (set_attr "prefix" "evex")
19601 (set_attr "mode" "<MODE>")])
19603 (define_insn "avx512dq_fpclass<mode><mask_scalar_merge_name>"
19604 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
19605 (unspec:<avx512fmaskmode>
19606 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
19607 (match_operand:QI 2 "const_0_to_255_operand" "n")]
19610 "vfpclass<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}";
19611 [(set_attr "type" "sse")
19612 (set_attr "length_immediate" "1")
19613 (set_attr "prefix" "evex")
19614 (set_attr "mode" "<MODE>")])
19616 (define_insn "avx512dq_vmfpclass<mode>"
19617 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
19618 (and:<avx512fmaskmode>
19619 (unspec:<avx512fmaskmode>
19620 [(match_operand:VF_128 1 "register_operand" "v")
19621 (match_operand:QI 2 "const_0_to_255_operand" "n")]
19625 "vfpclass<ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %2}";
19626 [(set_attr "type" "sse")
19627 (set_attr "length_immediate" "1")
19628 (set_attr "prefix" "evex")
19629 (set_attr "mode" "<MODE>")])
19631 (define_insn "<avx512>_getmant<mode><mask_name><round_saeonly_name>"
19632 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
19633 (unspec:VF_AVX512VL
19634 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "<round_saeonly_constraint>")
19635 (match_operand:SI 2 "const_0_to_15_operand")]
19638 "vgetmant<ssemodesuffix>\t{%2, <round_saeonly_mask_op3>%1, %0<mask_operand3>|%0<mask_operand3>, %1<round_saeonly_mask_op3>, %2}";
19639 [(set_attr "prefix" "evex")
19640 (set_attr "mode" "<MODE>")])
19642 (define_insn "avx512f_vgetmant<mode><mask_scalar_name><round_saeonly_scalar_name>"
19643 [(set (match_operand:VF_128 0 "register_operand" "=v")
19646 [(match_operand:VF_128 1 "register_operand" "v")
19647 (match_operand:VF_128 2 "<round_saeonly_scalar_nimm_predicate>" "<round_saeonly_scalar_constraint>")
19648 (match_operand:SI 3 "const_0_to_15_operand")]
19653 "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}";
19654 [(set_attr "prefix" "evex")
19655 (set_attr "mode" "<ssescalarmode>")])
19657 ;; The correct representation for this is absolutely enormous, and
19658 ;; surely not generally useful.
19659 (define_insn "<mask_codefor>avx512bw_dbpsadbw<mode><mask_name>"
19660 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
19661 (unspec:VI2_AVX512VL
19662 [(match_operand:<dbpsadbwmode> 1 "register_operand" "v")
19663 (match_operand:<dbpsadbwmode> 2 "nonimmediate_operand" "vm")
19664 (match_operand:SI 3 "const_0_to_255_operand")]
19667 "vdbpsadbw\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3}"
19668 [(set_attr "type" "sselog1")
19669 (set_attr "length_immediate" "1")
19670 (set_attr "prefix" "evex")
19671 (set_attr "mode" "<sseinsnmode>")])
19673 (define_insn "clz<mode>2<mask_name>"
19674 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
19676 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm")))]
19678 "vplzcnt<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
19679 [(set_attr "type" "sse")
19680 (set_attr "prefix" "evex")
19681 (set_attr "mode" "<sseinsnmode>")])
19683 (define_insn "<mask_codefor>conflict<mode><mask_name>"
19684 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
19685 (unspec:VI48_AVX512VL
19686 [(match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm")]
19689 "vpconflict<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
19690 [(set_attr "type" "sse")
19691 (set_attr "prefix" "evex")
19692 (set_attr "mode" "<sseinsnmode>")])
19694 (define_insn "sha1msg1"
19695 [(set (match_operand:V4SI 0 "register_operand" "=x")
19697 [(match_operand:V4SI 1 "register_operand" "0")
19698 (match_operand:V4SI 2 "vector_operand" "xBm")]
19701 "sha1msg1\t{%2, %0|%0, %2}"
19702 [(set_attr "type" "sselog1")
19703 (set_attr "mode" "TI")])
19705 (define_insn "sha1msg2"
19706 [(set (match_operand:V4SI 0 "register_operand" "=x")
19708 [(match_operand:V4SI 1 "register_operand" "0")
19709 (match_operand:V4SI 2 "vector_operand" "xBm")]
19712 "sha1msg2\t{%2, %0|%0, %2}"
19713 [(set_attr "type" "sselog1")
19714 (set_attr "mode" "TI")])
19716 (define_insn "sha1nexte"
19717 [(set (match_operand:V4SI 0 "register_operand" "=x")
19719 [(match_operand:V4SI 1 "register_operand" "0")
19720 (match_operand:V4SI 2 "vector_operand" "xBm")]
19721 UNSPEC_SHA1NEXTE))]
19723 "sha1nexte\t{%2, %0|%0, %2}"
19724 [(set_attr "type" "sselog1")
19725 (set_attr "mode" "TI")])
19727 (define_insn "sha1rnds4"
19728 [(set (match_operand:V4SI 0 "register_operand" "=x")
19730 [(match_operand:V4SI 1 "register_operand" "0")
19731 (match_operand:V4SI 2 "vector_operand" "xBm")
19732 (match_operand:SI 3 "const_0_to_3_operand" "n")]
19733 UNSPEC_SHA1RNDS4))]
19735 "sha1rnds4\t{%3, %2, %0|%0, %2, %3}"
19736 [(set_attr "type" "sselog1")
19737 (set_attr "length_immediate" "1")
19738 (set_attr "mode" "TI")])
19740 (define_insn "sha256msg1"
19741 [(set (match_operand:V4SI 0 "register_operand" "=x")
19743 [(match_operand:V4SI 1 "register_operand" "0")
19744 (match_operand:V4SI 2 "vector_operand" "xBm")]
19745 UNSPEC_SHA256MSG1))]
19747 "sha256msg1\t{%2, %0|%0, %2}"
19748 [(set_attr "type" "sselog1")
19749 (set_attr "mode" "TI")])
19751 (define_insn "sha256msg2"
19752 [(set (match_operand:V4SI 0 "register_operand" "=x")
19754 [(match_operand:V4SI 1 "register_operand" "0")
19755 (match_operand:V4SI 2 "vector_operand" "xBm")]
19756 UNSPEC_SHA256MSG2))]
19758 "sha256msg2\t{%2, %0|%0, %2}"
19759 [(set_attr "type" "sselog1")
19760 (set_attr "mode" "TI")])
19762 (define_insn "sha256rnds2"
19763 [(set (match_operand:V4SI 0 "register_operand" "=x")
19765 [(match_operand:V4SI 1 "register_operand" "0")
19766 (match_operand:V4SI 2 "vector_operand" "xBm")
19767 (match_operand:V4SI 3 "register_operand" "Yz")]
19768 UNSPEC_SHA256RNDS2))]
19770 "sha256rnds2\t{%3, %2, %0|%0, %2, %3}"
19771 [(set_attr "type" "sselog1")
19772 (set_attr "length_immediate" "1")
19773 (set_attr "mode" "TI")])
19775 (define_insn_and_split "avx512f_<castmode><avxsizesuffix>_<castmode>"
19776 [(set (match_operand:AVX512MODE2P 0 "nonimmediate_operand" "=x,m")
19777 (unspec:AVX512MODE2P
19778 [(match_operand:<ssequartermode> 1 "nonimmediate_operand" "xm,x")]
19780 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
19782 "&& reload_completed"
19783 [(set (match_dup 0) (match_dup 1))]
19785 if (REG_P (operands[0]))
19786 operands[0] = gen_lowpart (<ssequartermode>mode, operands[0]);
19788 operands[1] = lowpart_subreg (<MODE>mode, operands[1],
19789 <ssequartermode>mode);
19792 (define_insn_and_split "avx512f_<castmode><avxsizesuffix>_256<castmode>"
19793 [(set (match_operand:AVX512MODE2P 0 "nonimmediate_operand" "=x,m")
19794 (unspec:AVX512MODE2P
19795 [(match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "xm,x")]
19797 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
19799 "&& reload_completed"
19800 [(set (match_dup 0) (match_dup 1))]
19802 if (REG_P (operands[0]))
19803 operands[0] = gen_lowpart (<ssehalfvecmode>mode, operands[0]);
19805 operands[1] = lowpart_subreg (<MODE>mode, operands[1],
19806 <ssehalfvecmode>mode);
19809 (define_int_iterator VPMADD52
19810 [UNSPEC_VPMADD52LUQ
19811 UNSPEC_VPMADD52HUQ])
19813 (define_int_attr vpmadd52type
19814 [(UNSPEC_VPMADD52LUQ "luq") (UNSPEC_VPMADD52HUQ "huq")])
19816 (define_expand "vpamdd52huq<mode>_maskz"
19817 [(match_operand:VI8_AVX512VL 0 "register_operand")
19818 (match_operand:VI8_AVX512VL 1 "register_operand")
19819 (match_operand:VI8_AVX512VL 2 "register_operand")
19820 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand")
19821 (match_operand:<avx512fmaskmode> 4 "register_operand")]
19822 "TARGET_AVX512IFMA"
19824 emit_insn (gen_vpamdd52huq<mode>_maskz_1 (
19825 operands[0], operands[1], operands[2], operands[3],
19826 CONST0_RTX (<MODE>mode), operands[4]));
19830 (define_expand "vpamdd52luq<mode>_maskz"
19831 [(match_operand:VI8_AVX512VL 0 "register_operand")
19832 (match_operand:VI8_AVX512VL 1 "register_operand")
19833 (match_operand:VI8_AVX512VL 2 "register_operand")
19834 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand")
19835 (match_operand:<avx512fmaskmode> 4 "register_operand")]
19836 "TARGET_AVX512IFMA"
19838 emit_insn (gen_vpamdd52luq<mode>_maskz_1 (
19839 operands[0], operands[1], operands[2], operands[3],
19840 CONST0_RTX (<MODE>mode), operands[4]));
19844 (define_insn "vpamdd52<vpmadd52type><mode><sd_maskz_name>"
19845 [(set (match_operand:VI8_AVX512VL 0 "register_operand" "=v")
19846 (unspec:VI8_AVX512VL
19847 [(match_operand:VI8_AVX512VL 1 "register_operand" "0")
19848 (match_operand:VI8_AVX512VL 2 "register_operand" "v")
19849 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand" "vm")]
19851 "TARGET_AVX512IFMA"
19852 "vpmadd52<vpmadd52type>\t{%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3}"
19853 [(set_attr "type" "ssemuladd")
19854 (set_attr "prefix" "evex")
19855 (set_attr "mode" "<sseinsnmode>")])
19857 (define_insn "vpamdd52<vpmadd52type><mode>_mask"
19858 [(set (match_operand:VI8_AVX512VL 0 "register_operand" "=v")
19859 (vec_merge:VI8_AVX512VL
19860 (unspec:VI8_AVX512VL
19861 [(match_operand:VI8_AVX512VL 1 "register_operand" "0")
19862 (match_operand:VI8_AVX512VL 2 "register_operand" "v")
19863 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand" "vm")]
19866 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
19867 "TARGET_AVX512IFMA"
19868 "vpmadd52<vpmadd52type>\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3}"
19869 [(set_attr "type" "ssemuladd")
19870 (set_attr "prefix" "evex")
19871 (set_attr "mode" "<sseinsnmode>")])
19873 (define_insn "vpmultishiftqb<mode><mask_name>"
19874 [(set (match_operand:VI1_AVX512VL 0 "register_operand" "=v")
19875 (unspec:VI1_AVX512VL
19876 [(match_operand:VI1_AVX512VL 1 "register_operand" "v")
19877 (match_operand:VI1_AVX512VL 2 "nonimmediate_operand" "vm")]
19878 UNSPEC_VPMULTISHIFT))]
19879 "TARGET_AVX512VBMI"
19880 "vpmultishiftqb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
19881 [(set_attr "type" "sselog")
19882 (set_attr "prefix" "evex")
19883 (set_attr "mode" "<sseinsnmode>")])
19885 (define_mode_iterator IMOD4
19886 [(V64SF "TARGET_AVX5124FMAPS") (V64SI "TARGET_AVX5124VNNIW")])
19888 (define_mode_attr imod4_narrow
19889 [(V64SF "V16SF") (V64SI "V16SI")])
19891 (define_expand "mov<mode>"
19892 [(set (match_operand:IMOD4 0 "nonimmediate_operand")
19893 (match_operand:IMOD4 1 "vector_move_operand"))]
19896 ix86_expand_vector_move (<MODE>mode, operands);
19900 (define_insn_and_split "*mov<mode>_internal"
19901 [(set (match_operand:IMOD4 0 "nonimmediate_operand" "=v,v ,m")
19902 (match_operand:IMOD4 1 "vector_move_operand" " C,vm,v"))]
19904 && (register_operand (operands[0], <MODE>mode)
19905 || register_operand (operands[1], <MODE>mode))"
19907 "&& reload_completed"
19913 for (i = 0; i < 4; i++)
19915 op0 = simplify_subreg
19916 (<imod4_narrow>mode, operands[0], <MODE>mode, i * 64);
19917 op1 = simplify_subreg
19918 (<imod4_narrow>mode, operands[1], <MODE>mode, i * 64);
19919 emit_move_insn (op0, op1);
19924 (define_insn "avx5124fmaddps_4fmaddps"
19925 [(set (match_operand:V16SF 0 "register_operand" "=v")
19927 [(match_operand:V16SF 1 "register_operand" "0")
19928 (match_operand:V64SF 2 "register_operand" "Yh")
19929 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FMADD))]
19930 "TARGET_AVX5124FMAPS"
19931 "v4fmaddps\t{%3, %g2, %0|%0, %g2, %3}"
19932 [(set_attr ("type") ("ssemuladd"))
19933 (set_attr ("prefix") ("evex"))
19934 (set_attr ("mode") ("V16SF"))])
19936 (define_insn "avx5124fmaddps_4fmaddps_mask"
19937 [(set (match_operand:V16SF 0 "register_operand" "=v")
19940 [(match_operand:V64SF 1 "register_operand" "Yh")
19941 (match_operand:V4SF 2 "memory_operand" "m")] UNSPEC_VP4FMADD)
19942 (match_operand:V16SF 3 "register_operand" "0")
19943 (match_operand:HI 4 "register_operand" "Yk")))]
19944 "TARGET_AVX5124FMAPS"
19945 "v4fmaddps\t{%2, %g1, %0%{%4%}|%0%{%4%}, %g1, %2}"
19946 [(set_attr ("type") ("ssemuladd"))
19947 (set_attr ("prefix") ("evex"))
19948 (set_attr ("mode") ("V16SF"))])
19950 (define_insn "avx5124fmaddps_4fmaddps_maskz"
19951 [(set (match_operand:V16SF 0 "register_operand" "=v")
19954 [(match_operand:V16SF 1 "register_operand" "0")
19955 (match_operand:V64SF 2 "register_operand" "Yh")
19956 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FMADD)
19957 (match_operand:V16SF 4 "const0_operand" "C")
19958 (match_operand:HI 5 "register_operand" "Yk")))]
19959 "TARGET_AVX5124FMAPS"
19960 "v4fmaddps\t{%3, %g2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %g2, %3}"
19961 [(set_attr ("type") ("ssemuladd"))
19962 (set_attr ("prefix") ("evex"))
19963 (set_attr ("mode") ("V16SF"))])
19965 (define_insn "avx5124fmaddps_4fmaddss"
19966 [(set (match_operand:V4SF 0 "register_operand" "=v")
19968 [(match_operand:V4SF 1 "register_operand" "0")
19969 (match_operand:V64SF 2 "register_operand" "Yh")
19970 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FMADD))]
19971 "TARGET_AVX5124FMAPS"
19972 "v4fmaddss\t{%3, %x2, %0|%0, %x2, %3}"
19973 [(set_attr ("type") ("ssemuladd"))
19974 (set_attr ("prefix") ("evex"))
19975 (set_attr ("mode") ("SF"))])
19977 (define_insn "avx5124fmaddps_4fmaddss_mask"
19978 [(set (match_operand:V4SF 0 "register_operand" "=v")
19981 [(match_operand:V64SF 1 "register_operand" "Yh")
19982 (match_operand:V4SF 2 "memory_operand" "m")] UNSPEC_VP4FMADD)
19983 (match_operand:V4SF 3 "register_operand" "0")
19984 (match_operand:QI 4 "register_operand" "Yk")))]
19985 "TARGET_AVX5124FMAPS"
19986 "v4fmaddss\t{%2, %x1, %0%{%4%}|%0%{%4%}, %x1, %2}"
19987 [(set_attr ("type") ("ssemuladd"))
19988 (set_attr ("prefix") ("evex"))
19989 (set_attr ("mode") ("SF"))])
19991 (define_insn "avx5124fmaddps_4fmaddss_maskz"
19992 [(set (match_operand:V4SF 0 "register_operand" "=v")
19995 [(match_operand:V4SF 1 "register_operand" "0")
19996 (match_operand:V64SF 2 "register_operand" "Yh")
19997 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FMADD)
19998 (match_operand:V4SF 4 "const0_operand" "C")
19999 (match_operand:QI 5 "register_operand" "Yk")))]
20000 "TARGET_AVX5124FMAPS"
20001 "v4fmaddss\t{%3, %x2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %x2, %3}"
20002 [(set_attr ("type") ("ssemuladd"))
20003 (set_attr ("prefix") ("evex"))
20004 (set_attr ("mode") ("SF"))])
20006 (define_insn "avx5124fmaddps_4fnmaddps"
20007 [(set (match_operand:V16SF 0 "register_operand" "=v")
20009 [(match_operand:V16SF 1 "register_operand" "0")
20010 (match_operand:V64SF 2 "register_operand" "Yh")
20011 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FNMADD))]
20012 "TARGET_AVX5124FMAPS"
20013 "v4fnmaddps\t{%3, %g2, %0|%0, %g2, %3}"
20014 [(set_attr ("type") ("ssemuladd"))
20015 (set_attr ("prefix") ("evex"))
20016 (set_attr ("mode") ("V16SF"))])
20018 (define_insn "avx5124fmaddps_4fnmaddps_mask"
20019 [(set (match_operand:V16SF 0 "register_operand" "=v")
20022 [(match_operand:V64SF 1 "register_operand" "Yh")
20023 (match_operand:V4SF 2 "memory_operand" "m")] UNSPEC_VP4FNMADD)
20024 (match_operand:V16SF 3 "register_operand" "0")
20025 (match_operand:HI 4 "register_operand" "Yk")))]
20026 "TARGET_AVX5124FMAPS"
20027 "v4fnmaddps\t{%2, %g1, %0%{%4%}|%0%{%4%}, %g1, %2}"
20028 [(set_attr ("type") ("ssemuladd"))
20029 (set_attr ("prefix") ("evex"))
20030 (set_attr ("mode") ("V16SF"))])
20032 (define_insn "avx5124fmaddps_4fnmaddps_maskz"
20033 [(set (match_operand:V16SF 0 "register_operand" "=v")
20036 [(match_operand:V16SF 1 "register_operand" "0")
20037 (match_operand:V64SF 2 "register_operand" "Yh")
20038 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FNMADD)
20039 (match_operand:V16SF 4 "const0_operand" "C")
20040 (match_operand:HI 5 "register_operand" "Yk")))]
20041 "TARGET_AVX5124FMAPS"
20042 "v4fnmaddps\t{%3, %g2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %g2, %3}"
20043 [(set_attr ("type") ("ssemuladd"))
20044 (set_attr ("prefix") ("evex"))
20045 (set_attr ("mode") ("V16SF"))])
20047 (define_insn "avx5124fmaddps_4fnmaddss"
20048 [(set (match_operand:V4SF 0 "register_operand" "=v")
20050 [(match_operand:V4SF 1 "register_operand" "0")
20051 (match_operand:V64SF 2 "register_operand" "Yh")
20052 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FNMADD))]
20053 "TARGET_AVX5124FMAPS"
20054 "v4fnmaddss\t{%3, %x2, %0|%0, %x2, %3}"
20055 [(set_attr ("type") ("ssemuladd"))
20056 (set_attr ("prefix") ("evex"))
20057 (set_attr ("mode") ("SF"))])
20059 (define_insn "avx5124fmaddps_4fnmaddss_mask"
20060 [(set (match_operand:V4SF 0 "register_operand" "=v")
20063 [(match_operand:V64SF 1 "register_operand" "Yh")
20064 (match_operand:V4SF 2 "memory_operand" "m")] UNSPEC_VP4FNMADD)
20065 (match_operand:V4SF 3 "register_operand" "0")
20066 (match_operand:QI 4 "register_operand" "Yk")))]
20067 "TARGET_AVX5124FMAPS"
20068 "v4fnmaddss\t{%2, %x1, %0%{%4%}|%0%{%4%}, %x1, %2}"
20069 [(set_attr ("type") ("ssemuladd"))
20070 (set_attr ("prefix") ("evex"))
20071 (set_attr ("mode") ("SF"))])
20073 (define_insn "avx5124fmaddps_4fnmaddss_maskz"
20074 [(set (match_operand:V4SF 0 "register_operand" "=v")
20077 [(match_operand:V4SF 1 "register_operand" "0")
20078 (match_operand:V64SF 2 "register_operand" "Yh")
20079 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FNMADD)
20080 (match_operand:V4SF 4 "const0_operand" "C")
20081 (match_operand:QI 5 "register_operand" "Yk")))]
20082 "TARGET_AVX5124FMAPS"
20083 "v4fnmaddss\t{%3, %x2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %x2, %3}"
20084 [(set_attr ("type") ("ssemuladd"))
20085 (set_attr ("prefix") ("evex"))
20086 (set_attr ("mode") ("SF"))])
20088 (define_insn "avx5124vnniw_vp4dpwssd"
20089 [(set (match_operand:V16SI 0 "register_operand" "=v")
20091 [(match_operand:V16SI 1 "register_operand" "0")
20092 (match_operand:V64SI 2 "register_operand" "Yh")
20093 (match_operand:V4SI 3 "memory_operand" "m")] UNSPEC_VP4DPWSSD))]
20094 "TARGET_AVX5124VNNIW"
20095 "vp4dpwssd\t{%3, %g2, %0|%0, %g2, %3}"
20096 [(set_attr ("type") ("ssemuladd"))
20097 (set_attr ("prefix") ("evex"))
20098 (set_attr ("mode") ("TI"))])
20100 (define_insn "avx5124vnniw_vp4dpwssd_mask"
20101 [(set (match_operand:V16SI 0 "register_operand" "=v")
20104 [(match_operand:V64SI 1 "register_operand" "Yh")
20105 (match_operand:V4SI 2 "memory_operand" "m")] UNSPEC_VP4DPWSSD)
20106 (match_operand:V16SI 3 "register_operand" "0")
20107 (match_operand:HI 4 "register_operand" "Yk")))]
20108 "TARGET_AVX5124VNNIW"
20109 "vp4dpwssd\t{%2, %g1, %0%{%4%}|%0%{%4%}, %g1, %2}"
20110 [(set_attr ("type") ("ssemuladd"))
20111 (set_attr ("prefix") ("evex"))
20112 (set_attr ("mode") ("TI"))])
20114 (define_insn "avx5124vnniw_vp4dpwssd_maskz"
20115 [(set (match_operand:V16SI 0 "register_operand" "=v")
20118 [(match_operand:V16SI 1 "register_operand" "0")
20119 (match_operand:V64SI 2 "register_operand" "Yh")
20120 (match_operand:V4SI 3 "memory_operand" "m")] UNSPEC_VP4DPWSSD)
20121 (match_operand:V16SI 4 "const0_operand" "C")
20122 (match_operand:HI 5 "register_operand" "Yk")))]
20123 "TARGET_AVX5124VNNIW"
20124 "vp4dpwssd\t{%3, %g2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %g2, %3}"
20125 [(set_attr ("type") ("ssemuladd"))
20126 (set_attr ("prefix") ("evex"))
20127 (set_attr ("mode") ("TI"))])
20129 (define_insn "avx5124vnniw_vp4dpwssds"
20130 [(set (match_operand:V16SI 0 "register_operand" "=v")
20132 [(match_operand:V16SI 1 "register_operand" "0")
20133 (match_operand:V64SI 2 "register_operand" "Yh")
20134 (match_operand:V4SI 3 "memory_operand" "m")] UNSPEC_VP4DPWSSDS))]
20135 "TARGET_AVX5124VNNIW"
20136 "vp4dpwssds\t{%3, %g2, %0|%0, %g2, %3}"
20137 [(set_attr ("type") ("ssemuladd"))
20138 (set_attr ("prefix") ("evex"))
20139 (set_attr ("mode") ("TI"))])
20141 (define_insn "avx5124vnniw_vp4dpwssds_mask"
20142 [(set (match_operand:V16SI 0 "register_operand" "=v")
20145 [(match_operand:V64SI 1 "register_operand" "Yh")
20146 (match_operand:V4SI 2 "memory_operand" "m")] UNSPEC_VP4DPWSSDS)
20147 (match_operand:V16SI 3 "register_operand" "0")
20148 (match_operand:HI 4 "register_operand" "Yk")))]
20149 "TARGET_AVX5124VNNIW"
20150 "vp4dpwssds\t{%2, %g1, %0%{%4%}|%0%{%4%}, %g1, %2}"
20151 [(set_attr ("type") ("ssemuladd"))
20152 (set_attr ("prefix") ("evex"))
20153 (set_attr ("mode") ("TI"))])
20155 (define_insn "avx5124vnniw_vp4dpwssds_maskz"
20156 [(set (match_operand:V16SI 0 "register_operand" "=v")
20159 [(match_operand:V16SI 1 "register_operand" "0")
20160 (match_operand:V64SI 2 "register_operand" "Yh")
20161 (match_operand:V4SI 3 "memory_operand" "m")] UNSPEC_VP4DPWSSDS)
20162 (match_operand:V16SI 4 "const0_operand" "C")
20163 (match_operand:HI 5 "register_operand" "Yk")))]
20164 "TARGET_AVX5124VNNIW"
20165 "vp4dpwssds\t{%3, %g2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %g2, %3}"
20166 [(set_attr ("type") ("ssemuladd"))
20167 (set_attr ("prefix") ("evex"))
20168 (set_attr ("mode") ("TI"))])
20170 (define_insn "vpopcount<mode><mask_name>"
20171 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
20172 (popcount:VI48_AVX512VL
20173 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm")))]
20174 "TARGET_AVX512VPOPCNTDQ"
20175 "vpopcnt<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}")
20177 ;; Save multiple registers out-of-line.
20178 (define_insn "save_multiple<mode>"
20179 [(match_parallel 0 "save_multiple"
20180 [(use (match_operand:P 1 "symbol_operand"))])]
20181 "TARGET_SSE && TARGET_64BIT"
20184 ;; Restore multiple registers out-of-line.
20185 (define_insn "restore_multiple<mode>"
20186 [(match_parallel 0 "restore_multiple"
20187 [(use (match_operand:P 1 "symbol_operand"))])]
20188 "TARGET_SSE && TARGET_64BIT"
20191 ;; Restore multiple registers out-of-line and return.
20192 (define_insn "restore_multiple_and_return<mode>"
20193 [(match_parallel 0 "restore_multiple"
20195 (use (match_operand:P 1 "symbol_operand"))
20196 (set (reg:DI SP_REG) (reg:DI R10_REG))
20198 "TARGET_SSE && TARGET_64BIT"
20201 ;; Restore multiple registers out-of-line when hard frame pointer is used,
20202 ;; perform the leave operation prior to returning (from the function).
20203 (define_insn "restore_multiple_leave_return<mode>"
20204 [(match_parallel 0 "restore_multiple"
20206 (use (match_operand:P 1 "symbol_operand"))
20207 (set (reg:DI SP_REG) (plus:DI (reg:DI BP_REG) (const_int 8)))
20208 (set (reg:DI BP_REG) (mem:DI (reg:DI BP_REG)))
20209 (clobber (mem:BLK (scratch)))
20211 "TARGET_SSE && TARGET_64BIT"
20214 (define_insn "vpopcount<mode><mask_name>"
20215 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
20216 (popcount:VI12_AVX512VL
20217 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "vm")))]
20218 "TARGET_AVX512BITALG"
20219 "vpopcnt<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}")
20221 (define_insn "vgf2p8affineinvqb_<mode><mask_name>"
20222 [(set (match_operand:VI1_AVX512F 0 "register_operand" "=x,x,v")
20223 (unspec:VI1_AVX512F
20224 [(match_operand:VI1_AVX512F 1 "register_operand" "%0,x,v")
20225 (match_operand:VI1_AVX512F 2 "nonimmediate_operand" "xBm,xm,vm")
20226 (match_operand:QI 3 "const_0_to_255_operand" "n,n,n")]
20227 UNSPEC_GF2P8AFFINEINV))]
20230 gf2p8affineinvqb\t{%3, %2, %0| %0, %2, %3}
20231 vgf2p8affineinvqb\t{%3, %2, %1, %0<mask_operand4>| %0<mask_operand4>, %1, %2, %3}
20232 vgf2p8affineinvqb\t{%3, %2, %1, %0<mask_operand4>| %0<mask_operand4>, %1, %2, %3}"
20233 [(set_attr "isa" "noavx,avx,avx512f")
20234 (set_attr "prefix_data16" "1,*,*")
20235 (set_attr "prefix_extra" "1")
20236 (set_attr "prefix" "orig,maybe_evex,evex")
20237 (set_attr "mode" "<sseinsnmode>")])
20239 (define_insn "vgf2p8affineqb_<mode><mask_name>"
20240 [(set (match_operand:VI1_AVX512F 0 "register_operand" "=x,x,v")
20241 (unspec:VI1_AVX512F
20242 [(match_operand:VI1_AVX512F 1 "register_operand" "%0,x,v")
20243 (match_operand:VI1_AVX512F 2 "nonimmediate_operand" "xBm,xm,vm")
20244 (match_operand:QI 3 "const_0_to_255_operand" "n,n,n")]
20245 UNSPEC_GF2P8AFFINE))]
20248 gf2p8affineqb\t{%3, %2, %0| %0, %2, %3}
20249 vgf2p8affineqb\t{%3, %2, %1, %0<mask_operand4>| %0<mask_operand4>, %1, %2, %3}
20250 vgf2p8affineqb\t{%3, %2, %1, %0<mask_operand4>| %0<mask_operand4>, %1, %2, %3}"
20251 [(set_attr "isa" "noavx,avx,avx512f")
20252 (set_attr "prefix_data16" "1,*,*")
20253 (set_attr "prefix_extra" "1")
20254 (set_attr "prefix" "orig,maybe_evex,evex")
20255 (set_attr "mode" "<sseinsnmode>")])
20257 (define_insn "vgf2p8mulb_<mode><mask_name>"
20258 [(set (match_operand:VI1_AVX512F 0 "register_operand" "=x,x,v")
20259 (unspec:VI1_AVX512F
20260 [(match_operand:VI1_AVX512F 1 "register_operand" "%0,x,v")
20261 (match_operand:VI1_AVX512F 2 "nonimmediate_operand" "xBm,xm,vm")]
20265 gf2p8mulb\t{%2, %0| %0, %2}
20266 vgf2p8mulb\t{%2, %1, %0<mask_operand3>| %0<mask_operand3>, %1, %2}
20267 vgf2p8mulb\t{%2, %1, %0<mask_operand3>| %0<mask_operand3>, %1, %2}"
20268 [(set_attr "isa" "noavx,avx,avx512f")
20269 (set_attr "prefix_data16" "1,*,*")
20270 (set_attr "prefix_extra" "1")
20271 (set_attr "prefix" "orig,maybe_evex,evex")
20272 (set_attr "mode" "<sseinsnmode>")])
20274 (define_insn "vpshrd_<mode><mask_name>"
20275 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
20276 (unspec:VI248_AVX512VL
20277 [(match_operand:VI248_AVX512VL 1 "register_operand" "v")
20278 (match_operand:VI248_AVX512VL 2 "nonimmediate_operand" "vm")
20279 (match_operand:SI 3 "const_0_to_255_operand" "n")]
20281 "TARGET_AVX512VBMI2"
20282 "vpshrd<ssemodesuffix>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3 }"
20283 [(set_attr ("prefix") ("evex"))])
20285 (define_insn "vpshld_<mode><mask_name>"
20286 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
20287 (unspec:VI248_AVX512VL
20288 [(match_operand:VI248_AVX512VL 1 "register_operand" "v")
20289 (match_operand:VI248_AVX512VL 2 "nonimmediate_operand" "vm")
20290 (match_operand:SI 3 "const_0_to_255_operand" "n")]
20292 "TARGET_AVX512VBMI2"
20293 "vpshld<ssemodesuffix>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3 }"
20294 [(set_attr ("prefix") ("evex"))])
20296 (define_insn "vpshrdv_<mode>"
20297 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
20298 (unspec:VI248_AVX512VL
20299 [(match_operand:VI248_AVX512VL 1 "register_operand" "0")
20300 (match_operand:VI248_AVX512VL 2 "register_operand" "v")
20301 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand" "vm")]
20303 "TARGET_AVX512VBMI2"
20304 "vpshrdv<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3 }"
20305 [(set_attr ("prefix") ("evex"))
20306 (set_attr "mode" "<sseinsnmode>")])
20308 (define_insn "vpshrdv_<mode>_mask"
20309 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
20310 (vec_merge:VI248_AVX512VL
20311 (unspec:VI248_AVX512VL
20312 [(match_operand:VI248_AVX512VL 1 "register_operand" "0")
20313 (match_operand:VI248_AVX512VL 2 "register_operand" "v")
20314 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand" "vm")]
20317 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
20318 "TARGET_AVX512VBMI2"
20319 "vpshrdv<ssemodesuffix>\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
20320 [(set_attr ("prefix") ("evex"))
20321 (set_attr "mode" "<sseinsnmode>")])
20323 (define_expand "vpshrdv_<mode>_maskz"
20324 [(match_operand:VI248_AVX512VL 0 "register_operand")
20325 (match_operand:VI248_AVX512VL 1 "register_operand")
20326 (match_operand:VI248_AVX512VL 2 "register_operand")
20327 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand")
20328 (match_operand:<avx512fmaskmode> 4 "register_operand")]
20329 "TARGET_AVX512VBMI2"
20331 emit_insn (gen_vpshrdv_<mode>_maskz_1 (operands[0], operands[1],
20332 operands[2], operands[3],
20333 CONST0_RTX (<MODE>mode),
20338 (define_insn "vpshrdv_<mode>_maskz_1"
20339 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
20340 (vec_merge:VI248_AVX512VL
20341 (unspec:VI248_AVX512VL
20342 [(match_operand:VI248_AVX512VL 1 "register_operand" "0")
20343 (match_operand:VI248_AVX512VL 2 "register_operand" "v")
20344 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand" "vm")]
20346 (match_operand:VI248_AVX512VL 4 "const0_operand" "C")
20347 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
20348 "TARGET_AVX512VBMI2"
20349 "vpshrdv<ssemodesuffix>\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
20350 [(set_attr ("prefix") ("evex"))
20351 (set_attr "mode" "<sseinsnmode>")])
20353 (define_insn "vpshldv_<mode>"
20354 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
20355 (unspec:VI248_AVX512VL
20356 [(match_operand:VI248_AVX512VL 1 "register_operand" "0")
20357 (match_operand:VI248_AVX512VL 2 "register_operand" "v")
20358 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand" "vm")]
20360 "TARGET_AVX512VBMI2"
20361 "vpshldv<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3 }"
20362 [(set_attr ("prefix") ("evex"))
20363 (set_attr "mode" "<sseinsnmode>")])
20365 (define_insn "vpshldv_<mode>_mask"
20366 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
20367 (vec_merge:VI248_AVX512VL
20368 (unspec:VI248_AVX512VL
20369 [(match_operand:VI248_AVX512VL 1 "register_operand" "0")
20370 (match_operand:VI248_AVX512VL 2 "register_operand" "v")
20371 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand" "vm")]
20374 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
20375 "TARGET_AVX512VBMI2"
20376 "vpshldv<ssemodesuffix>\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
20377 [(set_attr ("prefix") ("evex"))
20378 (set_attr "mode" "<sseinsnmode>")])
20380 (define_expand "vpshldv_<mode>_maskz"
20381 [(match_operand:VI248_AVX512VL 0 "register_operand")
20382 (match_operand:VI248_AVX512VL 1 "register_operand")
20383 (match_operand:VI248_AVX512VL 2 "register_operand")
20384 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand")
20385 (match_operand:<avx512fmaskmode> 4 "register_operand")]
20386 "TARGET_AVX512VBMI2"
20388 emit_insn (gen_vpshldv_<mode>_maskz_1 (operands[0], operands[1],
20389 operands[2], operands[3],
20390 CONST0_RTX (<MODE>mode),
20395 (define_insn "vpshldv_<mode>_maskz_1"
20396 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
20397 (vec_merge:VI248_AVX512VL
20398 (unspec:VI248_AVX512VL
20399 [(match_operand:VI248_AVX512VL 1 "register_operand" "0")
20400 (match_operand:VI248_AVX512VL 2 "register_operand" "v")
20401 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand" "vm")]
20403 (match_operand:VI248_AVX512VL 4 "const0_operand" "C")
20404 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
20405 "TARGET_AVX512VBMI2"
20406 "vpshldv<ssemodesuffix>\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
20407 [(set_attr ("prefix") ("evex"))
20408 (set_attr "mode" "<sseinsnmode>")])
20410 (define_insn "vpdpbusd_<mode>"
20411 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20412 (unspec:VI4_AVX512VL
20413 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20414 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20415 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20416 UNSPEC_VPMADDUBSWACCD))]
20417 "TARGET_AVX512VNNI"
20418 "vpdpbusd\t{%3, %2, %0|%0, %2, %3 }"
20419 [(set_attr ("prefix") ("evex"))])
20421 (define_insn "vpdpbusd_<mode>_mask"
20422 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20423 (vec_merge:VI4_AVX512VL
20424 (unspec:VI4_AVX512VL
20425 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20426 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20427 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20428 UNSPEC_VPMADDUBSWACCD)
20430 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
20431 "TARGET_AVX512VNNI"
20432 "vpdpbusd\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
20433 [(set_attr ("prefix") ("evex"))])
20435 (define_expand "vpdpbusd_<mode>_maskz"
20436 [(match_operand:VI4_AVX512VL 0 "register_operand")
20437 (match_operand:VI4_AVX512VL 1 "register_operand")
20438 (match_operand:VI4_AVX512VL 2 "register_operand")
20439 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand")
20440 (match_operand:<avx512fmaskmode> 4 "register_operand")]
20441 "TARGET_AVX512VNNI"
20443 emit_insn (gen_vpdpbusd_<mode>_maskz_1 (operands[0], operands[1],
20444 operands[2], operands[3],
20445 CONST0_RTX (<MODE>mode),
20450 (define_insn "vpdpbusd_<mode>_maskz_1"
20451 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20452 (vec_merge:VI4_AVX512VL
20453 (unspec:VI4_AVX512VL
20454 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20455 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20456 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")
20457 ] UNSPEC_VPMADDUBSWACCD)
20458 (match_operand:VI4_AVX512VL 4 "const0_operand" "C")
20459 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
20460 "TARGET_AVX512VNNI"
20461 "vpdpbusd\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
20462 [(set_attr ("prefix") ("evex"))])
20465 (define_insn "vpdpbusds_<mode>"
20466 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20467 (unspec:VI4_AVX512VL
20468 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20469 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20470 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20471 UNSPEC_VPMADDUBSWACCSSD))]
20472 "TARGET_AVX512VNNI"
20473 "vpdpbusds\t{%3, %2, %0|%0, %2, %3 }"
20474 [(set_attr ("prefix") ("evex"))])
20476 (define_insn "vpdpbusds_<mode>_mask"
20477 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20478 (vec_merge:VI4_AVX512VL
20479 (unspec:VI4_AVX512VL
20480 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20481 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20482 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20483 UNSPEC_VPMADDUBSWACCSSD)
20485 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
20486 "TARGET_AVX512VNNI"
20487 "vpdpbusds\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
20488 [(set_attr ("prefix") ("evex"))])
20490 (define_expand "vpdpbusds_<mode>_maskz"
20491 [(match_operand:VI4_AVX512VL 0 "register_operand")
20492 (match_operand:VI4_AVX512VL 1 "register_operand")
20493 (match_operand:VI4_AVX512VL 2 "register_operand")
20494 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand")
20495 (match_operand:<avx512fmaskmode> 4 "register_operand")]
20496 "TARGET_AVX512VNNI"
20498 emit_insn (gen_vpdpbusds_<mode>_maskz_1 (operands[0], operands[1],
20499 operands[2], operands[3],
20500 CONST0_RTX (<MODE>mode),
20505 (define_insn "vpdpbusds_<mode>_maskz_1"
20506 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20507 (vec_merge:VI4_AVX512VL
20508 (unspec:VI4_AVX512VL
20509 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20510 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20511 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20512 UNSPEC_VPMADDUBSWACCSSD)
20513 (match_operand:VI4_AVX512VL 4 "const0_operand" "C")
20514 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
20515 "TARGET_AVX512VNNI"
20516 "vpdpbusds\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
20517 [(set_attr ("prefix") ("evex"))])
20520 (define_insn "vpdpwssd_<mode>"
20521 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20522 (unspec:VI4_AVX512VL
20523 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20524 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20525 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20526 UNSPEC_VPMADDWDACCD))]
20527 "TARGET_AVX512VNNI"
20528 "vpdpwssd\t{%3, %2, %0|%0, %2, %3 }"
20529 [(set_attr ("prefix") ("evex"))])
20531 (define_insn "vpdpwssd_<mode>_mask"
20532 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20533 (vec_merge:VI4_AVX512VL
20534 (unspec:VI4_AVX512VL
20535 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20536 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20537 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20538 UNSPEC_VPMADDWDACCD)
20540 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
20541 "TARGET_AVX512VNNI"
20542 "vpdpwssd\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
20543 [(set_attr ("prefix") ("evex"))])
20545 (define_expand "vpdpwssd_<mode>_maskz"
20546 [(match_operand:VI4_AVX512VL 0 "register_operand")
20547 (match_operand:VI4_AVX512VL 1 "register_operand")
20548 (match_operand:VI4_AVX512VL 2 "register_operand")
20549 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand")
20550 (match_operand:<avx512fmaskmode> 4 "register_operand")]
20551 "TARGET_AVX512VNNI"
20553 emit_insn (gen_vpdpwssd_<mode>_maskz_1 (operands[0], operands[1],
20554 operands[2], operands[3],
20555 CONST0_RTX (<MODE>mode),
20560 (define_insn "vpdpwssd_<mode>_maskz_1"
20561 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20562 (vec_merge:VI4_AVX512VL
20563 (unspec:VI4_AVX512VL
20564 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20565 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20566 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20567 UNSPEC_VPMADDWDACCD)
20568 (match_operand:VI4_AVX512VL 4 "const0_operand" "C")
20569 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
20570 "TARGET_AVX512VNNI"
20571 "vpdpwssd\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
20572 [(set_attr ("prefix") ("evex"))])
20575 (define_insn "vpdpwssds_<mode>"
20576 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20577 (unspec:VI4_AVX512VL
20578 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20579 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20580 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20581 UNSPEC_VPMADDWDACCSSD))]
20582 "TARGET_AVX512VNNI"
20583 "vpdpwssds\t{%3, %2, %0|%0, %2, %3 }"
20584 [(set_attr ("prefix") ("evex"))])
20586 (define_insn "vpdpwssds_<mode>_mask"
20587 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20588 (vec_merge:VI4_AVX512VL
20589 (unspec:VI4_AVX512VL
20590 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20591 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20592 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20593 UNSPEC_VPMADDWDACCSSD)
20595 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
20596 "TARGET_AVX512VNNI"
20597 "vpdpwssds\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
20598 [(set_attr ("prefix") ("evex"))])
20600 (define_expand "vpdpwssds_<mode>_maskz"
20601 [(match_operand:VI4_AVX512VL 0 "register_operand")
20602 (match_operand:VI4_AVX512VL 1 "register_operand")
20603 (match_operand:VI4_AVX512VL 2 "register_operand")
20604 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand")
20605 (match_operand:<avx512fmaskmode> 4 "register_operand")]
20606 "TARGET_AVX512VNNI"
20608 emit_insn (gen_vpdpwssds_<mode>_maskz_1 (operands[0], operands[1],
20609 operands[2], operands[3],
20610 CONST0_RTX (<MODE>mode),
20615 (define_insn "vpdpwssds_<mode>_maskz_1"
20616 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20617 (vec_merge:VI4_AVX512VL
20618 (unspec:VI4_AVX512VL
20619 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20620 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20621 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20622 UNSPEC_VPMADDWDACCSSD)
20623 (match_operand:VI4_AVX512VL 4 "const0_operand" "C")
20624 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
20625 "TARGET_AVX512VNNI"
20626 "vpdpwssds\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
20627 [(set_attr ("prefix") ("evex"))])
20629 (define_insn "vaesdec_<mode>"
20630 [(set (match_operand:VI1_AVX512VL_F 0 "register_operand" "=v")
20631 (unspec:VI1_AVX512VL_F
20632 [(match_operand:VI1_AVX512VL_F 1 "register_operand" "v")
20633 (match_operand:VI1_AVX512VL_F 2 "vector_operand" "v")]
20636 "vaesdec\t{%2, %1, %0|%0, %1, %2}"
20639 (define_insn "vaesdeclast_<mode>"
20640 [(set (match_operand:VI1_AVX512VL_F 0 "register_operand" "=v")
20641 (unspec:VI1_AVX512VL_F
20642 [(match_operand:VI1_AVX512VL_F 1 "register_operand" "v")
20643 (match_operand:VI1_AVX512VL_F 2 "vector_operand" "v")]
20644 UNSPEC_VAESDECLAST))]
20646 "vaesdeclast\t{%2, %1, %0|%0, %1, %2}"
20649 (define_insn "vaesenc_<mode>"
20650 [(set (match_operand:VI1_AVX512VL_F 0 "register_operand" "=v")
20651 (unspec:VI1_AVX512VL_F
20652 [(match_operand:VI1_AVX512VL_F 1 "register_operand" "v")
20653 (match_operand:VI1_AVX512VL_F 2 "vector_operand" "vm")]
20656 "vaesenc\t{%2, %1, %0|%0, %1, %2}"
20659 (define_insn "vaesenclast_<mode>"
20660 [(set (match_operand:VI1_AVX512VL_F 0 "register_operand" "=v")
20661 (unspec:VI1_AVX512VL_F
20662 [(match_operand:VI1_AVX512VL_F 1 "register_operand" "v")
20663 (match_operand:VI1_AVX512VL_F 2 "vector_operand" "vm")]
20664 UNSPEC_VAESENCLAST))]
20666 "vaesenclast\t{%2, %1, %0|%0, %1, %2}"
20669 (define_insn "vpclmulqdq_<mode>"
20670 [(set (match_operand:VI8_FVL 0 "register_operand" "=v")
20671 (unspec:VI8_FVL [(match_operand:VI8_FVL 1 "register_operand" "v")
20672 (match_operand:VI8_FVL 2 "vector_operand" "vm")
20673 (match_operand:SI 3 "const_0_to_255_operand" "n")]
20674 UNSPEC_VPCLMULQDQ))]
20675 "TARGET_VPCLMULQDQ"
20676 "vpclmulqdq\t{%3, %2, %1, %0|%0, %1, %2, %3}"
20677 [(set_attr "mode" "DI")])
20679 (define_insn "avx512vl_vpshufbitqmb<mode><mask_scalar_merge_name>"
20680 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
20681 (unspec:<avx512fmaskmode>
20682 [(match_operand:VI1_AVX512VLBW 1 "register_operand" "v")
20683 (match_operand:VI1_AVX512VLBW 2 "nonimmediate_operand" "vm")]
20684 UNSPEC_VPSHUFBIT))]
20685 "TARGET_AVX512BITALG"
20686 "vpshufbitqmb\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
20687 [(set_attr "prefix" "evex")
20688 (set_attr "mode" "<sseinsnmode>")])