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,v,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,*,*,*")
7075 (set (attr "preferred_for_speed")
7076 (cond [(eq_attr "alternative" "4")
7077 (symbol_ref "TARGET_INTER_UNIT_MOVES_TO_VEC")
7079 (symbol_ref "true")))])
7081 ;; A subset is vec_setv4sf.
7082 (define_insn "*vec_setv4sf_sse4_1"
7083 [(set (match_operand:V4SF 0 "register_operand" "=Yr,*x,v")
7086 (match_operand:SF 2 "nonimmediate_operand" "Yrm,*xm,vm"))
7087 (match_operand:V4SF 1 "register_operand" "0,0,v")
7088 (match_operand:SI 3 "const_int_operand")))]
7090 && ((unsigned) exact_log2 (INTVAL (operands[3]))
7091 < GET_MODE_NUNITS (V4SFmode))"
7093 operands[3] = GEN_INT (exact_log2 (INTVAL (operands[3])) << 4);
7094 switch (which_alternative)
7098 return "insertps\t{%3, %2, %0|%0, %2, %3}";
7100 return "vinsertps\t{%3, %2, %1, %0|%0, %1, %2, %3}";
7105 [(set_attr "isa" "noavx,noavx,avx")
7106 (set_attr "type" "sselog")
7107 (set_attr "prefix_data16" "1,1,*")
7108 (set_attr "prefix_extra" "1")
7109 (set_attr "length_immediate" "1")
7110 (set_attr "prefix" "orig,orig,maybe_evex")
7111 (set_attr "mode" "V4SF")])
7113 ;; All of vinsertps, vmovss, vmovd clear also the higher bits.
7114 (define_insn "vec_set<mode>_0"
7115 [(set (match_operand:VI4F_256_512 0 "register_operand" "=v,v,v")
7116 (vec_merge:VI4F_256_512
7117 (vec_duplicate:VI4F_256_512
7118 (match_operand:<ssescalarmode> 2 "general_operand" "v,m,r"))
7119 (match_operand:VI4F_256_512 1 "const0_operand" "C,C,C")
7123 vinsertps\t{$0xe, %2, %2, %x0|%x0, %2, %2, 0xe}
7124 vmov<ssescalarmodesuffix>\t{%x2, %x0|%x0, %2}
7125 vmovd\t{%2, %x0|%x0, %2}"
7127 (if_then_else (eq_attr "alternative" "0")
7128 (const_string "sselog")
7129 (const_string "ssemov")))
7130 (set_attr "prefix" "maybe_evex")
7131 (set_attr "mode" "SF,<ssescalarmode>,SI")
7132 (set (attr "preferred_for_speed")
7133 (cond [(eq_attr "alternative" "2")
7134 (symbol_ref "TARGET_INTER_UNIT_MOVES_TO_VEC")
7136 (symbol_ref "true")))])
7138 (define_insn "sse4_1_insertps"
7139 [(set (match_operand:V4SF 0 "register_operand" "=Yr,*x,v")
7140 (unspec:V4SF [(match_operand:V4SF 2 "nonimmediate_operand" "Yrm,*xm,vm")
7141 (match_operand:V4SF 1 "register_operand" "0,0,v")
7142 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")]
7146 if (MEM_P (operands[2]))
7148 unsigned count_s = INTVAL (operands[3]) >> 6;
7150 operands[3] = GEN_INT (INTVAL (operands[3]) & 0x3f);
7151 operands[2] = adjust_address_nv (operands[2], SFmode, count_s * 4);
7153 switch (which_alternative)
7157 return "insertps\t{%3, %2, %0|%0, %2, %3}";
7159 return "vinsertps\t{%3, %2, %1, %0|%0, %1, %2, %3}";
7164 [(set_attr "isa" "noavx,noavx,avx")
7165 (set_attr "type" "sselog")
7166 (set_attr "prefix_data16" "1,1,*")
7167 (set_attr "prefix_extra" "1")
7168 (set_attr "length_immediate" "1")
7169 (set_attr "prefix" "orig,orig,maybe_evex")
7170 (set_attr "mode" "V4SF")])
7173 [(set (match_operand:VI4F_128 0 "memory_operand")
7175 (vec_duplicate:VI4F_128
7176 (match_operand:<ssescalarmode> 1 "nonmemory_operand"))
7179 "TARGET_SSE && reload_completed"
7180 [(set (match_dup 0) (match_dup 1))]
7181 "operands[0] = adjust_address (operands[0], <ssescalarmode>mode, 0);")
7183 (define_expand "vec_set<mode>"
7184 [(match_operand:V 0 "register_operand")
7185 (match_operand:<ssescalarmode> 1 "register_operand")
7186 (match_operand 2 "const_int_operand")]
7189 ix86_expand_vector_set (false, operands[0], operands[1],
7190 INTVAL (operands[2]));
7194 (define_insn_and_split "*vec_extractv4sf_0"
7195 [(set (match_operand:SF 0 "nonimmediate_operand" "=v,m,f,r")
7197 (match_operand:V4SF 1 "nonimmediate_operand" "vm,v,m,m")
7198 (parallel [(const_int 0)])))]
7199 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7201 "&& reload_completed"
7202 [(set (match_dup 0) (match_dup 1))]
7203 "operands[1] = gen_lowpart (SFmode, operands[1]);")
7205 (define_insn_and_split "*sse4_1_extractps"
7206 [(set (match_operand:SF 0 "nonimmediate_operand" "=rm,rm,rm,Yv,Yv")
7208 (match_operand:V4SF 1 "register_operand" "Yr,*x,v,0,v")
7209 (parallel [(match_operand:SI 2 "const_0_to_3_operand" "n,n,n,n,n")])))]
7212 extractps\t{%2, %1, %0|%0, %1, %2}
7213 extractps\t{%2, %1, %0|%0, %1, %2}
7214 vextractps\t{%2, %1, %0|%0, %1, %2}
7217 "&& reload_completed && SSE_REG_P (operands[0])"
7220 rtx dest = lowpart_subreg (V4SFmode, operands[0], SFmode);
7221 switch (INTVAL (operands[2]))
7225 emit_insn (gen_sse_shufps_v4sf (dest, operands[1], operands[1],
7226 operands[2], operands[2],
7227 GEN_INT (INTVAL (operands[2]) + 4),
7228 GEN_INT (INTVAL (operands[2]) + 4)));
7231 emit_insn (gen_vec_interleave_highv4sf (dest, operands[1], operands[1]));
7234 /* 0 should be handled by the *vec_extractv4sf_0 pattern above. */
7239 [(set_attr "isa" "noavx,noavx,avx,noavx,avx")
7240 (set_attr "type" "sselog,sselog,sselog,*,*")
7241 (set_attr "prefix_data16" "1,1,1,*,*")
7242 (set_attr "prefix_extra" "1,1,1,*,*")
7243 (set_attr "length_immediate" "1,1,1,*,*")
7244 (set_attr "prefix" "orig,orig,maybe_evex,*,*")
7245 (set_attr "mode" "V4SF,V4SF,V4SF,*,*")])
7247 (define_insn_and_split "*vec_extractv4sf_mem"
7248 [(set (match_operand:SF 0 "register_operand" "=v,*r,f")
7250 (match_operand:V4SF 1 "memory_operand" "o,o,o")
7251 (parallel [(match_operand 2 "const_0_to_3_operand" "n,n,n")])))]
7254 "&& reload_completed"
7255 [(set (match_dup 0) (match_dup 1))]
7257 operands[1] = adjust_address (operands[1], SFmode, INTVAL (operands[2]) * 4);
7260 (define_mode_attr extract_type
7261 [(V16SF "avx512f") (V16SI "avx512f") (V8DF "avx512dq") (V8DI "avx512dq")])
7263 (define_mode_attr extract_suf
7264 [(V16SF "32x4") (V16SI "32x4") (V8DF "64x2") (V8DI "64x2")])
7266 (define_mode_iterator AVX512_VEC
7267 [(V8DF "TARGET_AVX512DQ") (V8DI "TARGET_AVX512DQ") V16SF V16SI])
7269 (define_expand "<extract_type>_vextract<shuffletype><extract_suf>_mask"
7270 [(match_operand:<ssequartermode> 0 "nonimmediate_operand")
7271 (match_operand:AVX512_VEC 1 "register_operand")
7272 (match_operand:SI 2 "const_0_to_3_operand")
7273 (match_operand:<ssequartermode> 3 "nonimmediate_operand")
7274 (match_operand:QI 4 "register_operand")]
7278 mask = INTVAL (operands[2]);
7279 rtx dest = operands[0];
7281 if (MEM_P (operands[0]) && !rtx_equal_p (operands[0], operands[3]))
7282 dest = gen_reg_rtx (<ssequartermode>mode);
7284 if (<MODE>mode == V16SImode || <MODE>mode == V16SFmode)
7285 emit_insn (gen_avx512f_vextract<shuffletype>32x4_1_mask (dest,
7286 operands[1], GEN_INT (mask * 4), GEN_INT (mask * 4 + 1),
7287 GEN_INT (mask * 4 + 2), GEN_INT (mask * 4 + 3), operands[3],
7290 emit_insn (gen_avx512dq_vextract<shuffletype>64x2_1_mask (dest,
7291 operands[1], GEN_INT (mask * 2), GEN_INT (mask * 2 + 1), operands[3],
7293 if (dest != operands[0])
7294 emit_move_insn (operands[0], dest);
7298 (define_insn "avx512dq_vextract<shuffletype>64x2_1_maskm"
7299 [(set (match_operand:<ssequartermode> 0 "memory_operand" "=m")
7300 (vec_merge:<ssequartermode>
7301 (vec_select:<ssequartermode>
7302 (match_operand:V8FI 1 "register_operand" "v")
7303 (parallel [(match_operand 2 "const_0_to_7_operand")
7304 (match_operand 3 "const_0_to_7_operand")]))
7305 (match_operand:<ssequartermode> 4 "memory_operand" "0")
7306 (match_operand:QI 5 "register_operand" "Yk")))]
7308 && INTVAL (operands[2]) % 2 == 0
7309 && INTVAL (operands[2]) == INTVAL (operands[3]) - 1
7310 && rtx_equal_p (operands[4], operands[0])"
7312 operands[2] = GEN_INT ((INTVAL (operands[2])) >> 1);
7313 return "vextract<shuffletype>64x2\t{%2, %1, %0%{%5%}|%0%{%5%}, %1, %2}";
7315 [(set_attr "type" "sselog")
7316 (set_attr "prefix_extra" "1")
7317 (set_attr "length_immediate" "1")
7318 (set_attr "memory" "store")
7319 (set_attr "prefix" "evex")
7320 (set_attr "mode" "<sseinsnmode>")])
7322 (define_insn "avx512f_vextract<shuffletype>32x4_1_maskm"
7323 [(set (match_operand:<ssequartermode> 0 "memory_operand" "=m")
7324 (vec_merge:<ssequartermode>
7325 (vec_select:<ssequartermode>
7326 (match_operand:V16FI 1 "register_operand" "v")
7327 (parallel [(match_operand 2 "const_0_to_15_operand")
7328 (match_operand 3 "const_0_to_15_operand")
7329 (match_operand 4 "const_0_to_15_operand")
7330 (match_operand 5 "const_0_to_15_operand")]))
7331 (match_operand:<ssequartermode> 6 "memory_operand" "0")
7332 (match_operand:QI 7 "register_operand" "Yk")))]
7334 && INTVAL (operands[2]) % 4 == 0
7335 && INTVAL (operands[2]) == INTVAL (operands[3]) - 1
7336 && INTVAL (operands[3]) == INTVAL (operands[4]) - 1
7337 && INTVAL (operands[4]) == INTVAL (operands[5]) - 1
7338 && rtx_equal_p (operands[6], operands[0])"
7340 operands[2] = GEN_INT (INTVAL (operands[2]) >> 2);
7341 return "vextract<shuffletype>32x4\t{%2, %1, %0%{%7%}|%0%{%7%}, %1, %2}";
7343 [(set_attr "type" "sselog")
7344 (set_attr "prefix_extra" "1")
7345 (set_attr "length_immediate" "1")
7346 (set_attr "memory" "store")
7347 (set_attr "prefix" "evex")
7348 (set_attr "mode" "<sseinsnmode>")])
7350 (define_insn "<mask_codefor>avx512dq_vextract<shuffletype>64x2_1<mask_name>"
7351 [(set (match_operand:<ssequartermode> 0 "<store_mask_predicate>" "=<store_mask_constraint>")
7352 (vec_select:<ssequartermode>
7353 (match_operand:V8FI 1 "register_operand" "v")
7354 (parallel [(match_operand 2 "const_0_to_7_operand")
7355 (match_operand 3 "const_0_to_7_operand")])))]
7357 && INTVAL (operands[2]) % 2 == 0
7358 && INTVAL (operands[2]) == INTVAL (operands[3]) - 1"
7360 operands[2] = GEN_INT (INTVAL (operands[2]) >> 1);
7361 return "vextract<shuffletype>64x2\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}";
7363 [(set_attr "type" "sselog1")
7364 (set_attr "prefix_extra" "1")
7365 (set_attr "length_immediate" "1")
7366 (set_attr "prefix" "evex")
7367 (set_attr "mode" "<sseinsnmode>")])
7370 [(set (match_operand:<ssequartermode> 0 "nonimmediate_operand")
7371 (vec_select:<ssequartermode>
7372 (match_operand:V8FI 1 "register_operand")
7373 (parallel [(const_int 0) (const_int 1)])))]
7377 || REG_P (operands[0])
7378 || !EXT_REX_SSE_REG_P (operands[1]))"
7379 [(set (match_dup 0) (match_dup 1))]
7381 if (!TARGET_AVX512VL
7382 && REG_P (operands[0])
7383 && EXT_REX_SSE_REG_P (operands[1]))
7385 = lowpart_subreg (<MODE>mode, operands[0], <ssequartermode>mode);
7387 operands[1] = gen_lowpart (<ssequartermode>mode, operands[1]);
7390 (define_insn "<mask_codefor>avx512f_vextract<shuffletype>32x4_1<mask_name>"
7391 [(set (match_operand:<ssequartermode> 0 "<store_mask_predicate>" "=<store_mask_constraint>")
7392 (vec_select:<ssequartermode>
7393 (match_operand:V16FI 1 "register_operand" "v")
7394 (parallel [(match_operand 2 "const_0_to_15_operand")
7395 (match_operand 3 "const_0_to_15_operand")
7396 (match_operand 4 "const_0_to_15_operand")
7397 (match_operand 5 "const_0_to_15_operand")])))]
7399 && INTVAL (operands[2]) % 4 == 0
7400 && INTVAL (operands[2]) == INTVAL (operands[3]) - 1
7401 && INTVAL (operands[3]) == INTVAL (operands[4]) - 1
7402 && INTVAL (operands[4]) == INTVAL (operands[5]) - 1"
7404 operands[2] = GEN_INT (INTVAL (operands[2]) >> 2);
7405 return "vextract<shuffletype>32x4\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
7407 [(set_attr "type" "sselog1")
7408 (set_attr "prefix_extra" "1")
7409 (set_attr "length_immediate" "1")
7410 (set_attr "prefix" "evex")
7411 (set_attr "mode" "<sseinsnmode>")])
7414 [(set (match_operand:<ssequartermode> 0 "nonimmediate_operand")
7415 (vec_select:<ssequartermode>
7416 (match_operand:V16FI 1 "register_operand")
7417 (parallel [(const_int 0) (const_int 1)
7418 (const_int 2) (const_int 3)])))]
7422 || REG_P (operands[0])
7423 || !EXT_REX_SSE_REG_P (operands[1]))"
7424 [(set (match_dup 0) (match_dup 1))]
7426 if (!TARGET_AVX512VL
7427 && REG_P (operands[0])
7428 && EXT_REX_SSE_REG_P (operands[1]))
7430 = lowpart_subreg (<MODE>mode, operands[0], <ssequartermode>mode);
7432 operands[1] = gen_lowpart (<ssequartermode>mode, operands[1]);
7435 (define_mode_attr extract_type_2
7436 [(V16SF "avx512dq") (V16SI "avx512dq") (V8DF "avx512f") (V8DI "avx512f")])
7438 (define_mode_attr extract_suf_2
7439 [(V16SF "32x8") (V16SI "32x8") (V8DF "64x4") (V8DI "64x4")])
7441 (define_mode_iterator AVX512_VEC_2
7442 [(V16SF "TARGET_AVX512DQ") (V16SI "TARGET_AVX512DQ") V8DF V8DI])
7444 (define_expand "<extract_type_2>_vextract<shuffletype><extract_suf_2>_mask"
7445 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7446 (match_operand:AVX512_VEC_2 1 "register_operand")
7447 (match_operand:SI 2 "const_0_to_1_operand")
7448 (match_operand:<ssehalfvecmode> 3 "nonimmediate_operand")
7449 (match_operand:QI 4 "register_operand")]
7452 rtx (*insn)(rtx, rtx, rtx, rtx);
7453 rtx dest = operands[0];
7455 if (MEM_P (dest) && !rtx_equal_p (dest, operands[3]))
7456 dest = gen_reg_rtx (<ssehalfvecmode>mode);
7458 switch (INTVAL (operands[2]))
7461 insn = gen_vec_extract_lo_<mode>_mask;
7464 insn = gen_vec_extract_hi_<mode>_mask;
7470 emit_insn (insn (dest, operands[1], operands[3], operands[4]));
7471 if (dest != operands[0])
7472 emit_move_insn (operands[0], dest);
7477 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7478 (vec_select:<ssehalfvecmode>
7479 (match_operand:V8FI 1 "nonimmediate_operand")
7480 (parallel [(const_int 0) (const_int 1)
7481 (const_int 2) (const_int 3)])))]
7482 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))
7485 || (REG_P (operands[0]) && !EXT_REX_SSE_REG_P (operands[1])))"
7486 [(set (match_dup 0) (match_dup 1))]
7487 "operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);")
7489 (define_insn "vec_extract_lo_<mode>_maskm"
7490 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7491 (vec_merge:<ssehalfvecmode>
7492 (vec_select:<ssehalfvecmode>
7493 (match_operand:V8FI 1 "register_operand" "v")
7494 (parallel [(const_int 0) (const_int 1)
7495 (const_int 2) (const_int 3)]))
7496 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7497 (match_operand:QI 3 "register_operand" "Yk")))]
7499 && rtx_equal_p (operands[2], operands[0])"
7500 "vextract<shuffletype>64x4\t{$0x0, %1, %0%{%3%}|%0%{%3%}, %1, 0x0}"
7501 [(set_attr "type" "sselog1")
7502 (set_attr "prefix_extra" "1")
7503 (set_attr "length_immediate" "1")
7504 (set_attr "prefix" "evex")
7505 (set_attr "mode" "<sseinsnmode>")])
7507 (define_insn "vec_extract_lo_<mode><mask_name>"
7508 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=v,<store_mask_constraint>,v")
7509 (vec_select:<ssehalfvecmode>
7510 (match_operand:V8FI 1 "<store_mask_predicate>" "v,v,<store_mask_constraint>")
7511 (parallel [(const_int 0) (const_int 1)
7512 (const_int 2) (const_int 3)])))]
7514 && (<mask_applied> || !(MEM_P (operands[0]) && MEM_P (operands[1])))"
7516 if (<mask_applied> || (!TARGET_AVX512VL && !MEM_P (operands[1])))
7517 return "vextract<shuffletype>64x4\t{$0x0, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x0}";
7521 [(set_attr "type" "sselog1")
7522 (set_attr "prefix_extra" "1")
7523 (set_attr "length_immediate" "1")
7524 (set_attr "memory" "none,store,load")
7525 (set_attr "prefix" "evex")
7526 (set_attr "mode" "<sseinsnmode>")])
7528 (define_insn "vec_extract_hi_<mode>_maskm"
7529 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7530 (vec_merge:<ssehalfvecmode>
7531 (vec_select:<ssehalfvecmode>
7532 (match_operand:V8FI 1 "register_operand" "v")
7533 (parallel [(const_int 4) (const_int 5)
7534 (const_int 6) (const_int 7)]))
7535 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7536 (match_operand:QI 3 "register_operand" "Yk")))]
7538 && rtx_equal_p (operands[2], operands[0])"
7539 "vextract<shuffletype>64x4\t{$0x1, %1, %0%{%3%}|%0%{%3%}, %1, 0x1}"
7540 [(set_attr "type" "sselog")
7541 (set_attr "prefix_extra" "1")
7542 (set_attr "length_immediate" "1")
7543 (set_attr "memory" "store")
7544 (set_attr "prefix" "evex")
7545 (set_attr "mode" "<sseinsnmode>")])
7547 (define_insn "vec_extract_hi_<mode><mask_name>"
7548 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=<store_mask_constraint>")
7549 (vec_select:<ssehalfvecmode>
7550 (match_operand:V8FI 1 "register_operand" "v")
7551 (parallel [(const_int 4) (const_int 5)
7552 (const_int 6) (const_int 7)])))]
7554 "vextract<shuffletype>64x4\t{$0x1, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x1}"
7555 [(set_attr "type" "sselog1")
7556 (set_attr "prefix_extra" "1")
7557 (set_attr "length_immediate" "1")
7558 (set_attr "prefix" "evex")
7559 (set_attr "mode" "<sseinsnmode>")])
7561 (define_insn "vec_extract_hi_<mode>_maskm"
7562 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7563 (vec_merge:<ssehalfvecmode>
7564 (vec_select:<ssehalfvecmode>
7565 (match_operand:V16FI 1 "register_operand" "v")
7566 (parallel [(const_int 8) (const_int 9)
7567 (const_int 10) (const_int 11)
7568 (const_int 12) (const_int 13)
7569 (const_int 14) (const_int 15)]))
7570 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7571 (match_operand:QI 3 "register_operand" "Yk")))]
7573 && rtx_equal_p (operands[2], operands[0])"
7574 "vextract<shuffletype>32x8\t{$0x1, %1, %0%{%3%}|%0%{%3%}, %1, 0x1}"
7575 [(set_attr "type" "sselog1")
7576 (set_attr "prefix_extra" "1")
7577 (set_attr "length_immediate" "1")
7578 (set_attr "prefix" "evex")
7579 (set_attr "mode" "<sseinsnmode>")])
7581 (define_insn "vec_extract_hi_<mode><mask_name>"
7582 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=<store_mask_constraint>,vm")
7583 (vec_select:<ssehalfvecmode>
7584 (match_operand:V16FI 1 "register_operand" "v,v")
7585 (parallel [(const_int 8) (const_int 9)
7586 (const_int 10) (const_int 11)
7587 (const_int 12) (const_int 13)
7588 (const_int 14) (const_int 15)])))]
7589 "TARGET_AVX512F && <mask_avx512dq_condition>"
7591 vextract<shuffletype>32x8\t{$0x1, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x1}
7592 vextracti64x4\t{$0x1, %1, %0|%0, %1, 0x1}"
7593 [(set_attr "type" "sselog1")
7594 (set_attr "prefix_extra" "1")
7595 (set_attr "isa" "avx512dq,noavx512dq")
7596 (set_attr "length_immediate" "1")
7597 (set_attr "prefix" "evex")
7598 (set_attr "mode" "<sseinsnmode>")])
7600 (define_expand "avx512vl_vextractf128<mode>"
7601 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7602 (match_operand:VI48F_256 1 "register_operand")
7603 (match_operand:SI 2 "const_0_to_1_operand")
7604 (match_operand:<ssehalfvecmode> 3 "vector_move_operand")
7605 (match_operand:QI 4 "register_operand")]
7606 "TARGET_AVX512DQ && TARGET_AVX512VL"
7608 rtx (*insn)(rtx, rtx, rtx, rtx);
7609 rtx dest = operands[0];
7612 && (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 4
7613 /* For V8S[IF]mode there are maskm insns with =m and 0
7615 ? !rtx_equal_p (dest, operands[3])
7616 /* For V4D[IF]mode, hi insns don't allow memory, and
7617 lo insns have =m and 0C constraints. */
7618 : (operands[2] != const0_rtx
7619 || (!rtx_equal_p (dest, operands[3])
7620 && GET_CODE (operands[3]) != CONST_VECTOR))))
7621 dest = gen_reg_rtx (<ssehalfvecmode>mode);
7622 switch (INTVAL (operands[2]))
7625 insn = gen_vec_extract_lo_<mode>_mask;
7628 insn = gen_vec_extract_hi_<mode>_mask;
7634 emit_insn (insn (dest, operands[1], operands[3], operands[4]));
7635 if (dest != operands[0])
7636 emit_move_insn (operands[0], dest);
7640 (define_expand "avx_vextractf128<mode>"
7641 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7642 (match_operand:V_256 1 "register_operand")
7643 (match_operand:SI 2 "const_0_to_1_operand")]
7646 rtx (*insn)(rtx, rtx);
7648 switch (INTVAL (operands[2]))
7651 insn = gen_vec_extract_lo_<mode>;
7654 insn = gen_vec_extract_hi_<mode>;
7660 emit_insn (insn (operands[0], operands[1]));
7664 (define_insn "vec_extract_lo_<mode><mask_name>"
7665 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand" "=v,v,m")
7666 (vec_select:<ssehalfvecmode>
7667 (match_operand:V16FI 1 "<store_mask_predicate>"
7668 "v,<store_mask_constraint>,v")
7669 (parallel [(const_int 0) (const_int 1)
7670 (const_int 2) (const_int 3)
7671 (const_int 4) (const_int 5)
7672 (const_int 6) (const_int 7)])))]
7674 && <mask_mode512bit_condition>
7675 && (<mask_applied> || !(MEM_P (operands[0]) && MEM_P (operands[1])))"
7678 || (!TARGET_AVX512VL
7679 && !REG_P (operands[0])
7680 && EXT_REX_SSE_REG_P (operands[1])))
7681 return "vextract<shuffletype>32x8\t{$0x0, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x0}";
7685 [(set_attr "type" "sselog1")
7686 (set_attr "prefix_extra" "1")
7687 (set_attr "length_immediate" "1")
7688 (set_attr "memory" "none,load,store")
7689 (set_attr "prefix" "evex")
7690 (set_attr "mode" "<sseinsnmode>")])
7693 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7694 (vec_select:<ssehalfvecmode>
7695 (match_operand:V16FI 1 "nonimmediate_operand")
7696 (parallel [(const_int 0) (const_int 1)
7697 (const_int 2) (const_int 3)
7698 (const_int 4) (const_int 5)
7699 (const_int 6) (const_int 7)])))]
7700 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))
7703 || REG_P (operands[0])
7704 || !EXT_REX_SSE_REG_P (operands[1]))"
7705 [(set (match_dup 0) (match_dup 1))]
7707 if (!TARGET_AVX512VL
7708 && REG_P (operands[0])
7709 && EXT_REX_SSE_REG_P (operands[1]))
7711 = lowpart_subreg (<MODE>mode, operands[0], <ssehalfvecmode>mode);
7713 operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);
7716 (define_insn "vec_extract_lo_<mode><mask_name>"
7717 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=v,v,m")
7718 (vec_select:<ssehalfvecmode>
7719 (match_operand:VI8F_256 1 "<store_mask_predicate>"
7720 "v,<store_mask_constraint>,v")
7721 (parallel [(const_int 0) (const_int 1)])))]
7723 && <mask_avx512vl_condition> && <mask_avx512dq_condition>
7724 && (<mask_applied> || !(MEM_P (operands[0]) && MEM_P (operands[1])))"
7727 return "vextract<shuffletype>64x2\t{$0x0, %1, %0%{%3%}|%0%{%3%}, %1, 0x0}";
7731 [(set_attr "type" "sselog1")
7732 (set_attr "prefix_extra" "1")
7733 (set_attr "length_immediate" "1")
7734 (set_attr "memory" "none,load,store")
7735 (set_attr "prefix" "evex")
7736 (set_attr "mode" "XI")])
7739 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7740 (vec_select:<ssehalfvecmode>
7741 (match_operand:VI8F_256 1 "nonimmediate_operand")
7742 (parallel [(const_int 0) (const_int 1)])))]
7743 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))
7744 && reload_completed"
7745 [(set (match_dup 0) (match_dup 1))]
7746 "operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);")
7748 (define_insn "vec_extract_hi_<mode><mask_name>"
7749 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=v,<store_mask_constraint>")
7750 (vec_select:<ssehalfvecmode>
7751 (match_operand:VI8F_256 1 "register_operand" "v,v")
7752 (parallel [(const_int 2) (const_int 3)])))]
7753 "TARGET_AVX && <mask_avx512vl_condition> && <mask_avx512dq_condition>"
7755 if (TARGET_AVX512VL)
7757 if (TARGET_AVX512DQ)
7758 return "vextract<shuffletype>64x2\t{$0x1, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x1}";
7760 return "vextract<shuffletype>32x4\t{$0x1, %1, %0|%0, %1, 0x1}";
7763 return "vextract<i128>\t{$0x1, %1, %0|%0, %1, 0x1}";
7765 [(set_attr "type" "sselog1")
7766 (set_attr "prefix_extra" "1")
7767 (set_attr "length_immediate" "1")
7768 (set_attr "prefix" "vex")
7769 (set_attr "mode" "<sseinsnmode>")])
7772 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7773 (vec_select:<ssehalfvecmode>
7774 (match_operand:VI4F_256 1 "nonimmediate_operand")
7775 (parallel [(const_int 0) (const_int 1)
7776 (const_int 2) (const_int 3)])))]
7777 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))
7778 && reload_completed"
7779 [(set (match_dup 0) (match_dup 1))]
7780 "operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);")
7782 (define_insn "vec_extract_lo_<mode><mask_name>"
7783 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>"
7784 "=<store_mask_constraint>,v")
7785 (vec_select:<ssehalfvecmode>
7786 (match_operand:VI4F_256 1 "<store_mask_predicate>"
7787 "v,<store_mask_constraint>")
7788 (parallel [(const_int 0) (const_int 1)
7789 (const_int 2) (const_int 3)])))]
7791 && <mask_avx512vl_condition> && <mask_avx512dq_condition>
7792 && (<mask_applied> || !(MEM_P (operands[0]) && MEM_P (operands[1])))"
7795 return "vextract<shuffletype>32x4\t{$0x0, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x0}";
7799 [(set_attr "type" "sselog1")
7800 (set_attr "prefix_extra" "1")
7801 (set_attr "length_immediate" "1")
7802 (set_attr "prefix" "evex")
7803 (set_attr "mode" "<sseinsnmode>")])
7805 (define_insn "vec_extract_lo_<mode>_maskm"
7806 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7807 (vec_merge:<ssehalfvecmode>
7808 (vec_select:<ssehalfvecmode>
7809 (match_operand:VI4F_256 1 "register_operand" "v")
7810 (parallel [(const_int 0) (const_int 1)
7811 (const_int 2) (const_int 3)]))
7812 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7813 (match_operand:QI 3 "register_operand" "Yk")))]
7814 "TARGET_AVX512VL && TARGET_AVX512F
7815 && rtx_equal_p (operands[2], operands[0])"
7816 "vextract<shuffletype>32x4\t{$0x0, %1, %0%{%3%}|%0%{%3%}, %1, 0x0}"
7817 [(set_attr "type" "sselog1")
7818 (set_attr "prefix_extra" "1")
7819 (set_attr "length_immediate" "1")
7820 (set_attr "prefix" "evex")
7821 (set_attr "mode" "<sseinsnmode>")])
7823 (define_insn "vec_extract_hi_<mode>_maskm"
7824 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7825 (vec_merge:<ssehalfvecmode>
7826 (vec_select:<ssehalfvecmode>
7827 (match_operand:VI4F_256 1 "register_operand" "v")
7828 (parallel [(const_int 4) (const_int 5)
7829 (const_int 6) (const_int 7)]))
7830 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7831 (match_operand:<ssehalfvecmode> 3 "register_operand" "Yk")))]
7832 "TARGET_AVX512F && TARGET_AVX512VL
7833 && rtx_equal_p (operands[2], operands[0])"
7834 "vextract<shuffletype>32x4\t{$0x1, %1, %0%{%3%}|%0%{%3%}, %1, 0x1}"
7835 [(set_attr "type" "sselog1")
7836 (set_attr "length_immediate" "1")
7837 (set_attr "prefix" "evex")
7838 (set_attr "mode" "<sseinsnmode>")])
7840 (define_insn "vec_extract_hi_<mode>_mask"
7841 [(set (match_operand:<ssehalfvecmode> 0 "register_operand" "=v")
7842 (vec_merge:<ssehalfvecmode>
7843 (vec_select:<ssehalfvecmode>
7844 (match_operand:VI4F_256 1 "register_operand" "v")
7845 (parallel [(const_int 4) (const_int 5)
7846 (const_int 6) (const_int 7)]))
7847 (match_operand:<ssehalfvecmode> 2 "vector_move_operand" "0C")
7848 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
7850 "vextract<shuffletype>32x4\t{$0x1, %1, %0%{%3%}%N2|%0%{%3%}%N2, %1, 0x1}"
7851 [(set_attr "type" "sselog1")
7852 (set_attr "length_immediate" "1")
7853 (set_attr "prefix" "evex")
7854 (set_attr "mode" "<sseinsnmode>")])
7856 (define_insn "vec_extract_hi_<mode>"
7857 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand" "=xm, vm")
7858 (vec_select:<ssehalfvecmode>
7859 (match_operand:VI4F_256 1 "register_operand" "x, v")
7860 (parallel [(const_int 4) (const_int 5)
7861 (const_int 6) (const_int 7)])))]
7864 vextract<i128>\t{$0x1, %1, %0|%0, %1, 0x1}
7865 vextract<shuffletype>32x4\t{$0x1, %1, %0|%0, %1, 0x1}"
7866 [(set_attr "isa" "*, avx512vl")
7867 (set_attr "prefix" "vex, evex")
7868 (set_attr "type" "sselog1")
7869 (set_attr "length_immediate" "1")
7870 (set_attr "mode" "<sseinsnmode>")])
7872 (define_insn_and_split "vec_extract_lo_v32hi"
7873 [(set (match_operand:V16HI 0 "nonimmediate_operand" "=v,v,m")
7875 (match_operand:V32HI 1 "nonimmediate_operand" "v,m,v")
7876 (parallel [(const_int 0) (const_int 1)
7877 (const_int 2) (const_int 3)
7878 (const_int 4) (const_int 5)
7879 (const_int 6) (const_int 7)
7880 (const_int 8) (const_int 9)
7881 (const_int 10) (const_int 11)
7882 (const_int 12) (const_int 13)
7883 (const_int 14) (const_int 15)])))]
7884 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7887 || REG_P (operands[0])
7888 || !EXT_REX_SSE_REG_P (operands[1]))
7891 return "vextracti64x4\t{$0x0, %1, %0|%0, %1, 0x0}";
7893 "&& reload_completed
7895 || REG_P (operands[0])
7896 || !EXT_REX_SSE_REG_P (operands[1]))"
7897 [(set (match_dup 0) (match_dup 1))]
7899 if (!TARGET_AVX512VL
7900 && REG_P (operands[0])
7901 && EXT_REX_SSE_REG_P (operands[1]))
7902 operands[0] = lowpart_subreg (V32HImode, operands[0], V16HImode);
7904 operands[1] = gen_lowpart (V16HImode, operands[1]);
7906 [(set_attr "type" "sselog1")
7907 (set_attr "prefix_extra" "1")
7908 (set_attr "length_immediate" "1")
7909 (set_attr "memory" "none,load,store")
7910 (set_attr "prefix" "evex")
7911 (set_attr "mode" "XI")])
7913 (define_insn "vec_extract_hi_v32hi"
7914 [(set (match_operand:V16HI 0 "nonimmediate_operand" "=vm")
7916 (match_operand:V32HI 1 "register_operand" "v")
7917 (parallel [(const_int 16) (const_int 17)
7918 (const_int 18) (const_int 19)
7919 (const_int 20) (const_int 21)
7920 (const_int 22) (const_int 23)
7921 (const_int 24) (const_int 25)
7922 (const_int 26) (const_int 27)
7923 (const_int 28) (const_int 29)
7924 (const_int 30) (const_int 31)])))]
7926 "vextracti64x4\t{$0x1, %1, %0|%0, %1, 0x1}"
7927 [(set_attr "type" "sselog1")
7928 (set_attr "prefix_extra" "1")
7929 (set_attr "length_immediate" "1")
7930 (set_attr "prefix" "evex")
7931 (set_attr "mode" "XI")])
7933 (define_insn_and_split "vec_extract_lo_v16hi"
7934 [(set (match_operand:V8HI 0 "nonimmediate_operand" "=v,m")
7936 (match_operand:V16HI 1 "nonimmediate_operand" "vm,v")
7937 (parallel [(const_int 0) (const_int 1)
7938 (const_int 2) (const_int 3)
7939 (const_int 4) (const_int 5)
7940 (const_int 6) (const_int 7)])))]
7941 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7943 "&& reload_completed"
7944 [(set (match_dup 0) (match_dup 1))]
7945 "operands[1] = gen_lowpart (V8HImode, operands[1]);")
7947 (define_insn "vec_extract_hi_v16hi"
7948 [(set (match_operand:V8HI 0 "nonimmediate_operand" "=xm,vm,vm")
7950 (match_operand:V16HI 1 "register_operand" "x,v,v")
7951 (parallel [(const_int 8) (const_int 9)
7952 (const_int 10) (const_int 11)
7953 (const_int 12) (const_int 13)
7954 (const_int 14) (const_int 15)])))]
7957 vextract%~128\t{$0x1, %1, %0|%0, %1, 0x1}
7958 vextracti32x4\t{$0x1, %1, %0|%0, %1, 0x1}
7959 vextracti32x4\t{$0x1, %g1, %0|%0, %g1, 0x1}"
7960 [(set_attr "type" "sselog1")
7961 (set_attr "prefix_extra" "1")
7962 (set_attr "length_immediate" "1")
7963 (set_attr "isa" "*,avx512dq,avx512f")
7964 (set_attr "prefix" "vex,evex,evex")
7965 (set_attr "mode" "OI")])
7967 (define_insn_and_split "vec_extract_lo_v64qi"
7968 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=v,v,m")
7970 (match_operand:V64QI 1 "nonimmediate_operand" "v,m,v")
7971 (parallel [(const_int 0) (const_int 1)
7972 (const_int 2) (const_int 3)
7973 (const_int 4) (const_int 5)
7974 (const_int 6) (const_int 7)
7975 (const_int 8) (const_int 9)
7976 (const_int 10) (const_int 11)
7977 (const_int 12) (const_int 13)
7978 (const_int 14) (const_int 15)
7979 (const_int 16) (const_int 17)
7980 (const_int 18) (const_int 19)
7981 (const_int 20) (const_int 21)
7982 (const_int 22) (const_int 23)
7983 (const_int 24) (const_int 25)
7984 (const_int 26) (const_int 27)
7985 (const_int 28) (const_int 29)
7986 (const_int 30) (const_int 31)])))]
7987 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7990 || REG_P (operands[0])
7991 || !EXT_REX_SSE_REG_P (operands[1]))
7994 return "vextracti64x4\t{$0x0, %1, %0|%0, %1, 0x0}";
7996 "&& reload_completed
7998 || REG_P (operands[0])
7999 || !EXT_REX_SSE_REG_P (operands[1]))"
8000 [(set (match_dup 0) (match_dup 1))]
8002 if (!TARGET_AVX512VL
8003 && REG_P (operands[0])
8004 && EXT_REX_SSE_REG_P (operands[1]))
8005 operands[0] = lowpart_subreg (V64QImode, operands[0], V32QImode);
8007 operands[1] = gen_lowpart (V32QImode, operands[1]);
8009 [(set_attr "type" "sselog1")
8010 (set_attr "prefix_extra" "1")
8011 (set_attr "length_immediate" "1")
8012 (set_attr "memory" "none,load,store")
8013 (set_attr "prefix" "evex")
8014 (set_attr "mode" "XI")])
8016 (define_insn "vec_extract_hi_v64qi"
8017 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=vm")
8019 (match_operand:V64QI 1 "register_operand" "v")
8020 (parallel [(const_int 32) (const_int 33)
8021 (const_int 34) (const_int 35)
8022 (const_int 36) (const_int 37)
8023 (const_int 38) (const_int 39)
8024 (const_int 40) (const_int 41)
8025 (const_int 42) (const_int 43)
8026 (const_int 44) (const_int 45)
8027 (const_int 46) (const_int 47)
8028 (const_int 48) (const_int 49)
8029 (const_int 50) (const_int 51)
8030 (const_int 52) (const_int 53)
8031 (const_int 54) (const_int 55)
8032 (const_int 56) (const_int 57)
8033 (const_int 58) (const_int 59)
8034 (const_int 60) (const_int 61)
8035 (const_int 62) (const_int 63)])))]
8037 "vextracti64x4\t{$0x1, %1, %0|%0, %1, 0x1}"
8038 [(set_attr "type" "sselog1")
8039 (set_attr "prefix_extra" "1")
8040 (set_attr "length_immediate" "1")
8041 (set_attr "prefix" "evex")
8042 (set_attr "mode" "XI")])
8044 (define_insn_and_split "vec_extract_lo_v32qi"
8045 [(set (match_operand:V16QI 0 "nonimmediate_operand" "=v,m")
8047 (match_operand:V32QI 1 "nonimmediate_operand" "vm,v")
8048 (parallel [(const_int 0) (const_int 1)
8049 (const_int 2) (const_int 3)
8050 (const_int 4) (const_int 5)
8051 (const_int 6) (const_int 7)
8052 (const_int 8) (const_int 9)
8053 (const_int 10) (const_int 11)
8054 (const_int 12) (const_int 13)
8055 (const_int 14) (const_int 15)])))]
8056 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
8058 "&& reload_completed"
8059 [(set (match_dup 0) (match_dup 1))]
8060 "operands[1] = gen_lowpart (V16QImode, operands[1]);")
8062 (define_insn "vec_extract_hi_v32qi"
8063 [(set (match_operand:V16QI 0 "nonimmediate_operand" "=xm,vm,vm")
8065 (match_operand:V32QI 1 "register_operand" "x,v,v")
8066 (parallel [(const_int 16) (const_int 17)
8067 (const_int 18) (const_int 19)
8068 (const_int 20) (const_int 21)
8069 (const_int 22) (const_int 23)
8070 (const_int 24) (const_int 25)
8071 (const_int 26) (const_int 27)
8072 (const_int 28) (const_int 29)
8073 (const_int 30) (const_int 31)])))]
8076 vextract%~128\t{$0x1, %1, %0|%0, %1, 0x1}
8077 vextracti32x4\t{$0x1, %1, %0|%0, %1, 0x1}
8078 vextracti32x4\t{$0x1, %g1, %0|%0, %g1, 0x1}"
8079 [(set_attr "type" "sselog1")
8080 (set_attr "prefix_extra" "1")
8081 (set_attr "length_immediate" "1")
8082 (set_attr "isa" "*,avx512dq,avx512f")
8083 (set_attr "prefix" "vex,evex,evex")
8084 (set_attr "mode" "OI")])
8086 ;; Modes handled by vec_extract patterns.
8087 (define_mode_iterator VEC_EXTRACT_MODE
8088 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX") V16QI
8089 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX") V8HI
8090 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
8091 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI
8092 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
8093 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") V2DF
8094 (V4TI "TARGET_AVX512F") (V2TI "TARGET_AVX")])
8096 (define_expand "vec_extract<mode><ssescalarmodelower>"
8097 [(match_operand:<ssescalarmode> 0 "register_operand")
8098 (match_operand:VEC_EXTRACT_MODE 1 "register_operand")
8099 (match_operand 2 "const_int_operand")]
8102 ix86_expand_vector_extract (false, operands[0], operands[1],
8103 INTVAL (operands[2]));
8107 (define_expand "vec_extract<mode><ssehalfvecmodelower>"
8108 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
8109 (match_operand:V_512 1 "register_operand")
8110 (match_operand 2 "const_0_to_1_operand")]
8113 if (INTVAL (operands[2]))
8114 emit_insn (gen_vec_extract_hi_<mode> (operands[0], operands[1]));
8116 emit_insn (gen_vec_extract_lo_<mode> (operands[0], operands[1]));
8120 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8122 ;; Parallel double-precision floating point element swizzling
8124 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8126 (define_insn "<mask_codefor>avx512f_unpckhpd512<mask_name>"
8127 [(set (match_operand:V8DF 0 "register_operand" "=v")
8130 (match_operand:V8DF 1 "register_operand" "v")
8131 (match_operand:V8DF 2 "nonimmediate_operand" "vm"))
8132 (parallel [(const_int 1) (const_int 9)
8133 (const_int 3) (const_int 11)
8134 (const_int 5) (const_int 13)
8135 (const_int 7) (const_int 15)])))]
8137 "vunpckhpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8138 [(set_attr "type" "sselog")
8139 (set_attr "prefix" "evex")
8140 (set_attr "mode" "V8DF")])
8142 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
8143 (define_insn "avx_unpckhpd256<mask_name>"
8144 [(set (match_operand:V4DF 0 "register_operand" "=v")
8147 (match_operand:V4DF 1 "register_operand" "v")
8148 (match_operand:V4DF 2 "nonimmediate_operand" "vm"))
8149 (parallel [(const_int 1) (const_int 5)
8150 (const_int 3) (const_int 7)])))]
8151 "TARGET_AVX && <mask_avx512vl_condition>"
8152 "vunpckhpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8153 [(set_attr "type" "sselog")
8154 (set_attr "prefix" "vex")
8155 (set_attr "mode" "V4DF")])
8157 (define_expand "vec_interleave_highv4df"
8161 (match_operand:V4DF 1 "register_operand")
8162 (match_operand:V4DF 2 "nonimmediate_operand"))
8163 (parallel [(const_int 0) (const_int 4)
8164 (const_int 2) (const_int 6)])))
8170 (parallel [(const_int 1) (const_int 5)
8171 (const_int 3) (const_int 7)])))
8172 (set (match_operand:V4DF 0 "register_operand")
8177 (parallel [(const_int 2) (const_int 3)
8178 (const_int 6) (const_int 7)])))]
8181 operands[3] = gen_reg_rtx (V4DFmode);
8182 operands[4] = gen_reg_rtx (V4DFmode);
8186 (define_insn "avx512vl_unpckhpd128_mask"
8187 [(set (match_operand:V2DF 0 "register_operand" "=v")
8191 (match_operand:V2DF 1 "register_operand" "v")
8192 (match_operand:V2DF 2 "nonimmediate_operand" "vm"))
8193 (parallel [(const_int 1) (const_int 3)]))
8194 (match_operand:V2DF 3 "vector_move_operand" "0C")
8195 (match_operand:QI 4 "register_operand" "Yk")))]
8197 "vunpckhpd\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
8198 [(set_attr "type" "sselog")
8199 (set_attr "prefix" "evex")
8200 (set_attr "mode" "V2DF")])
8202 (define_expand "vec_interleave_highv2df"
8203 [(set (match_operand:V2DF 0 "register_operand")
8206 (match_operand:V2DF 1 "nonimmediate_operand")
8207 (match_operand:V2DF 2 "nonimmediate_operand"))
8208 (parallel [(const_int 1)
8212 if (!ix86_vec_interleave_v2df_operator_ok (operands, 1))
8213 operands[2] = force_reg (V2DFmode, operands[2]);
8216 (define_insn "*vec_interleave_highv2df"
8217 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,v,v,x,v,m")
8220 (match_operand:V2DF 1 "nonimmediate_operand" " 0,v,o,o,o,v")
8221 (match_operand:V2DF 2 "nonimmediate_operand" " x,v,1,0,v,0"))
8222 (parallel [(const_int 1)
8224 "TARGET_SSE2 && ix86_vec_interleave_v2df_operator_ok (operands, 1)"
8226 unpckhpd\t{%2, %0|%0, %2}
8227 vunpckhpd\t{%2, %1, %0|%0, %1, %2}
8228 %vmovddup\t{%H1, %0|%0, %H1}
8229 movlpd\t{%H1, %0|%0, %H1}
8230 vmovlpd\t{%H1, %2, %0|%0, %2, %H1}
8231 %vmovhpd\t{%1, %0|%q0, %1}"
8232 [(set_attr "isa" "noavx,avx,sse3,noavx,avx,*")
8233 (set_attr "type" "sselog,sselog,sselog,ssemov,ssemov,ssemov")
8234 (set (attr "prefix_data16")
8235 (if_then_else (eq_attr "alternative" "3,5")
8237 (const_string "*")))
8238 (set_attr "prefix" "orig,maybe_evex,maybe_vex,orig,maybe_evex,maybe_vex")
8239 (set_attr "mode" "V2DF,V2DF,DF,V1DF,V1DF,V1DF")])
8241 (define_expand "avx512f_movddup512<mask_name>"
8242 [(set (match_operand:V8DF 0 "register_operand")
8245 (match_operand:V8DF 1 "nonimmediate_operand")
8247 (parallel [(const_int 0) (const_int 8)
8248 (const_int 2) (const_int 10)
8249 (const_int 4) (const_int 12)
8250 (const_int 6) (const_int 14)])))]
8253 (define_expand "avx512f_unpcklpd512<mask_name>"
8254 [(set (match_operand:V8DF 0 "register_operand")
8257 (match_operand:V8DF 1 "register_operand")
8258 (match_operand:V8DF 2 "nonimmediate_operand"))
8259 (parallel [(const_int 0) (const_int 8)
8260 (const_int 2) (const_int 10)
8261 (const_int 4) (const_int 12)
8262 (const_int 6) (const_int 14)])))]
8265 (define_insn "*avx512f_unpcklpd512<mask_name>"
8266 [(set (match_operand:V8DF 0 "register_operand" "=v,v")
8269 (match_operand:V8DF 1 "nonimmediate_operand" "vm, v")
8270 (match_operand:V8DF 2 "nonimmediate_operand" "1 ,vm"))
8271 (parallel [(const_int 0) (const_int 8)
8272 (const_int 2) (const_int 10)
8273 (const_int 4) (const_int 12)
8274 (const_int 6) (const_int 14)])))]
8277 vmovddup\t{%1, %0<mask_operand3>|%0<mask_operand3>, %1}
8278 vunpcklpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8279 [(set_attr "type" "sselog")
8280 (set_attr "prefix" "evex")
8281 (set_attr "mode" "V8DF")])
8283 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
8284 (define_expand "avx_movddup256<mask_name>"
8285 [(set (match_operand:V4DF 0 "register_operand")
8288 (match_operand:V4DF 1 "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_expand "avx_unpcklpd256<mask_name>"
8295 [(set (match_operand:V4DF 0 "register_operand")
8298 (match_operand:V4DF 1 "register_operand")
8299 (match_operand:V4DF 2 "nonimmediate_operand"))
8300 (parallel [(const_int 0) (const_int 4)
8301 (const_int 2) (const_int 6)])))]
8302 "TARGET_AVX && <mask_avx512vl_condition>")
8304 (define_insn "*avx_unpcklpd256<mask_name>"
8305 [(set (match_operand:V4DF 0 "register_operand" "=v,v")
8308 (match_operand:V4DF 1 "nonimmediate_operand" " v,m")
8309 (match_operand:V4DF 2 "nonimmediate_operand" "vm,1"))
8310 (parallel [(const_int 0) (const_int 4)
8311 (const_int 2) (const_int 6)])))]
8312 "TARGET_AVX && <mask_avx512vl_condition>"
8314 vunpcklpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
8315 vmovddup\t{%1, %0<mask_operand3>|%0<mask_operand3>, %1}"
8316 [(set_attr "type" "sselog")
8317 (set_attr "prefix" "vex")
8318 (set_attr "mode" "V4DF")])
8320 (define_expand "vec_interleave_lowv4df"
8324 (match_operand:V4DF 1 "register_operand")
8325 (match_operand:V4DF 2 "nonimmediate_operand"))
8326 (parallel [(const_int 0) (const_int 4)
8327 (const_int 2) (const_int 6)])))
8333 (parallel [(const_int 1) (const_int 5)
8334 (const_int 3) (const_int 7)])))
8335 (set (match_operand:V4DF 0 "register_operand")
8340 (parallel [(const_int 0) (const_int 1)
8341 (const_int 4) (const_int 5)])))]
8344 operands[3] = gen_reg_rtx (V4DFmode);
8345 operands[4] = gen_reg_rtx (V4DFmode);
8348 (define_insn "avx512vl_unpcklpd128_mask"
8349 [(set (match_operand:V2DF 0 "register_operand" "=v")
8353 (match_operand:V2DF 1 "register_operand" "v")
8354 (match_operand:V2DF 2 "nonimmediate_operand" "vm"))
8355 (parallel [(const_int 0) (const_int 2)]))
8356 (match_operand:V2DF 3 "vector_move_operand" "0C")
8357 (match_operand:QI 4 "register_operand" "Yk")))]
8359 "vunpcklpd\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
8360 [(set_attr "type" "sselog")
8361 (set_attr "prefix" "evex")
8362 (set_attr "mode" "V2DF")])
8364 (define_expand "vec_interleave_lowv2df"
8365 [(set (match_operand:V2DF 0 "register_operand")
8368 (match_operand:V2DF 1 "nonimmediate_operand")
8369 (match_operand:V2DF 2 "nonimmediate_operand"))
8370 (parallel [(const_int 0)
8374 if (!ix86_vec_interleave_v2df_operator_ok (operands, 0))
8375 operands[1] = force_reg (V2DFmode, operands[1]);
8378 (define_insn "*vec_interleave_lowv2df"
8379 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,v,v,x,v,o")
8382 (match_operand:V2DF 1 "nonimmediate_operand" " 0,v,m,0,v,0")
8383 (match_operand:V2DF 2 "nonimmediate_operand" " x,v,1,m,m,v"))
8384 (parallel [(const_int 0)
8386 "TARGET_SSE2 && ix86_vec_interleave_v2df_operator_ok (operands, 0)"
8388 unpcklpd\t{%2, %0|%0, %2}
8389 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
8390 %vmovddup\t{%1, %0|%0, %q1}
8391 movhpd\t{%2, %0|%0, %q2}
8392 vmovhpd\t{%2, %1, %0|%0, %1, %q2}
8393 %vmovlpd\t{%2, %H0|%H0, %2}"
8394 [(set_attr "isa" "noavx,avx,sse3,noavx,avx,*")
8395 (set_attr "type" "sselog,sselog,sselog,ssemov,ssemov,ssemov")
8396 (set (attr "prefix_data16")
8397 (if_then_else (eq_attr "alternative" "3,5")
8399 (const_string "*")))
8400 (set_attr "prefix" "orig,maybe_evex,maybe_vex,orig,maybe_evex,maybe_vex")
8401 (set_attr "mode" "V2DF,V2DF,DF,V1DF,V1DF,V1DF")])
8404 [(set (match_operand:V2DF 0 "memory_operand")
8407 (match_operand:V2DF 1 "register_operand")
8409 (parallel [(const_int 0)
8411 "TARGET_SSE3 && reload_completed"
8414 rtx low = gen_lowpart (DFmode, operands[1]);
8416 emit_move_insn (adjust_address (operands[0], DFmode, 0), low);
8417 emit_move_insn (adjust_address (operands[0], DFmode, 8), low);
8422 [(set (match_operand:V2DF 0 "register_operand")
8425 (match_operand:V2DF 1 "memory_operand")
8427 (parallel [(match_operand:SI 2 "const_0_to_1_operand")
8428 (match_operand:SI 3 "const_int_operand")])))]
8429 "TARGET_SSE3 && INTVAL (operands[2]) + 2 == INTVAL (operands[3])"
8430 [(set (match_dup 0) (vec_duplicate:V2DF (match_dup 1)))]
8432 operands[1] = adjust_address (operands[1], DFmode, INTVAL (operands[2]) * 8);
8435 (define_insn "avx512f_vmscalef<mode><mask_scalar_name><round_scalar_name>"
8436 [(set (match_operand:VF_128 0 "register_operand" "=v")
8439 [(match_operand:VF_128 1 "register_operand" "v")
8440 (match_operand:VF_128 2 "<round_scalar_nimm_predicate>" "<round_scalar_constraint>")]
8445 "vscalef<ssescalarmodesuffix>\t{<round_scalar_mask_op3>%2, %1, %0<mask_scalar_operand3>|%0<mask_scalar_operand3>, %1, %2<round_scalar_mask_op3>}"
8446 [(set_attr "prefix" "evex")
8447 (set_attr "mode" "<ssescalarmode>")])
8449 (define_insn "<avx512>_scalef<mode><mask_name><round_name>"
8450 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8452 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
8453 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")]
8456 "vscalef<ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
8457 [(set_attr "prefix" "evex")
8458 (set_attr "mode" "<MODE>")])
8460 (define_expand "<avx512>_vternlog<mode>_maskz"
8461 [(match_operand:VI48_AVX512VL 0 "register_operand")
8462 (match_operand:VI48_AVX512VL 1 "register_operand")
8463 (match_operand:VI48_AVX512VL 2 "register_operand")
8464 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand")
8465 (match_operand:SI 4 "const_0_to_255_operand")
8466 (match_operand:<avx512fmaskmode> 5 "register_operand")]
8469 emit_insn (gen_<avx512>_vternlog<mode>_maskz_1 (
8470 operands[0], operands[1], operands[2], operands[3],
8471 operands[4], CONST0_RTX (<MODE>mode), operands[5]));
8475 (define_insn "<avx512>_vternlog<mode><sd_maskz_name>"
8476 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
8477 (unspec:VI48_AVX512VL
8478 [(match_operand:VI48_AVX512VL 1 "register_operand" "0")
8479 (match_operand:VI48_AVX512VL 2 "register_operand" "v")
8480 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand" "vm")
8481 (match_operand:SI 4 "const_0_to_255_operand")]
8484 "vpternlog<ssemodesuffix>\t{%4, %3, %2, %0<sd_mask_op5>|%0<sd_mask_op5>, %2, %3, %4}"
8485 [(set_attr "type" "sselog")
8486 (set_attr "prefix" "evex")
8487 (set_attr "mode" "<sseinsnmode>")])
8489 (define_insn "<avx512>_vternlog<mode>_mask"
8490 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
8491 (vec_merge:VI48_AVX512VL
8492 (unspec:VI48_AVX512VL
8493 [(match_operand:VI48_AVX512VL 1 "register_operand" "0")
8494 (match_operand:VI48_AVX512VL 2 "register_operand" "v")
8495 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand" "vm")
8496 (match_operand:SI 4 "const_0_to_255_operand")]
8499 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
8501 "vpternlog<ssemodesuffix>\t{%4, %3, %2, %0%{%5%}|%0%{%5%}, %2, %3, %4}"
8502 [(set_attr "type" "sselog")
8503 (set_attr "prefix" "evex")
8504 (set_attr "mode" "<sseinsnmode>")])
8506 (define_insn "<avx512>_getexp<mode><mask_name><round_saeonly_name>"
8507 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8508 (unspec:VF_AVX512VL [(match_operand:VF_AVX512VL 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
8511 "vgetexp<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}";
8512 [(set_attr "prefix" "evex")
8513 (set_attr "mode" "<MODE>")])
8515 (define_insn "avx512f_sgetexp<mode><mask_scalar_name><round_saeonly_scalar_name>"
8516 [(set (match_operand:VF_128 0 "register_operand" "=v")
8519 [(match_operand:VF_128 1 "register_operand" "v")
8520 (match_operand:VF_128 2 "<round_saeonly_scalar_nimm_predicate>" "<round_saeonly_scalar_constraint>")]
8525 "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>}";
8526 [(set_attr "prefix" "evex")
8527 (set_attr "mode" "<ssescalarmode>")])
8529 (define_insn "<mask_codefor><avx512>_align<mode><mask_name>"
8530 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
8531 (unspec:VI48_AVX512VL [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
8532 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")
8533 (match_operand:SI 3 "const_0_to_255_operand")]
8536 "valign<ssemodesuffix>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3}";
8537 [(set_attr "prefix" "evex")
8538 (set_attr "mode" "<sseinsnmode>")])
8540 (define_expand "avx512f_shufps512_mask"
8541 [(match_operand:V16SF 0 "register_operand")
8542 (match_operand:V16SF 1 "register_operand")
8543 (match_operand:V16SF 2 "nonimmediate_operand")
8544 (match_operand:SI 3 "const_0_to_255_operand")
8545 (match_operand:V16SF 4 "register_operand")
8546 (match_operand:HI 5 "register_operand")]
8549 int mask = INTVAL (operands[3]);
8550 emit_insn (gen_avx512f_shufps512_1_mask (operands[0], operands[1], operands[2],
8551 GEN_INT ((mask >> 0) & 3),
8552 GEN_INT ((mask >> 2) & 3),
8553 GEN_INT (((mask >> 4) & 3) + 16),
8554 GEN_INT (((mask >> 6) & 3) + 16),
8555 GEN_INT (((mask >> 0) & 3) + 4),
8556 GEN_INT (((mask >> 2) & 3) + 4),
8557 GEN_INT (((mask >> 4) & 3) + 20),
8558 GEN_INT (((mask >> 6) & 3) + 20),
8559 GEN_INT (((mask >> 0) & 3) + 8),
8560 GEN_INT (((mask >> 2) & 3) + 8),
8561 GEN_INT (((mask >> 4) & 3) + 24),
8562 GEN_INT (((mask >> 6) & 3) + 24),
8563 GEN_INT (((mask >> 0) & 3) + 12),
8564 GEN_INT (((mask >> 2) & 3) + 12),
8565 GEN_INT (((mask >> 4) & 3) + 28),
8566 GEN_INT (((mask >> 6) & 3) + 28),
8567 operands[4], operands[5]));
8572 (define_expand "<avx512>_fixupimm<mode>_maskz<round_saeonly_expand_name>"
8573 [(match_operand:VF_AVX512VL 0 "register_operand")
8574 (match_operand:VF_AVX512VL 1 "register_operand")
8575 (match_operand:VF_AVX512VL 2 "register_operand")
8576 (match_operand:<sseintvecmode> 3 "<round_saeonly_expand_nimm_predicate>")
8577 (match_operand:SI 4 "const_0_to_255_operand")
8578 (match_operand:<avx512fmaskmode> 5 "register_operand")]
8581 emit_insn (gen_<avx512>_fixupimm<mode>_maskz_1<round_saeonly_expand_name> (
8582 operands[0], operands[1], operands[2], operands[3],
8583 operands[4], CONST0_RTX (<MODE>mode), operands[5]
8584 <round_saeonly_expand_operand6>));
8588 (define_insn "<avx512>_fixupimm<mode><sd_maskz_name><round_saeonly_name>"
8589 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8591 [(match_operand:VF_AVX512VL 1 "register_operand" "0")
8592 (match_operand:VF_AVX512VL 2 "register_operand" "v")
8593 (match_operand:<sseintvecmode> 3 "nonimmediate_operand" "<round_saeonly_constraint>")
8594 (match_operand:SI 4 "const_0_to_255_operand")]
8597 "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}";
8598 [(set_attr "prefix" "evex")
8599 (set_attr "mode" "<MODE>")])
8601 (define_insn "<avx512>_fixupimm<mode>_mask<round_saeonly_name>"
8602 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8603 (vec_merge:VF_AVX512VL
8605 [(match_operand:VF_AVX512VL 1 "register_operand" "0")
8606 (match_operand:VF_AVX512VL 2 "register_operand" "v")
8607 (match_operand:<sseintvecmode> 3 "nonimmediate_operand" "<round_saeonly_constraint>")
8608 (match_operand:SI 4 "const_0_to_255_operand")]
8611 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
8613 "vfixupimm<ssemodesuffix>\t{%4, <round_saeonly_op6>%3, %2, %0%{%5%}|%0%{%5%}, %2, %3<round_saeonly_op6>, %4}";
8614 [(set_attr "prefix" "evex")
8615 (set_attr "mode" "<MODE>")])
8617 (define_expand "avx512f_sfixupimm<mode>_maskz<round_saeonly_expand_name>"
8618 [(match_operand:VF_128 0 "register_operand")
8619 (match_operand:VF_128 1 "register_operand")
8620 (match_operand:VF_128 2 "register_operand")
8621 (match_operand:<sseintvecmode> 3 "<round_saeonly_expand_nimm_predicate>")
8622 (match_operand:SI 4 "const_0_to_255_operand")
8623 (match_operand:<avx512fmaskmode> 5 "register_operand")]
8626 emit_insn (gen_avx512f_sfixupimm<mode>_maskz_1<round_saeonly_expand_name> (
8627 operands[0], operands[1], operands[2], operands[3],
8628 operands[4], CONST0_RTX (<MODE>mode), operands[5]
8629 <round_saeonly_expand_operand6>));
8633 (define_insn "avx512f_sfixupimm<mode><sd_maskz_name><round_saeonly_name>"
8634 [(set (match_operand:VF_128 0 "register_operand" "=v")
8637 [(match_operand:VF_128 1 "register_operand" "0")
8638 (match_operand:VF_128 2 "register_operand" "v")
8639 (match_operand:<sseintvecmode> 3 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
8640 (match_operand:SI 4 "const_0_to_255_operand")]
8645 "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}";
8646 [(set_attr "prefix" "evex")
8647 (set_attr "mode" "<ssescalarmode>")])
8649 (define_insn "avx512f_sfixupimm<mode>_mask<round_saeonly_name>"
8650 [(set (match_operand:VF_128 0 "register_operand" "=v")
8654 [(match_operand:VF_128 1 "register_operand" "0")
8655 (match_operand:VF_128 2 "register_operand" "v")
8656 (match_operand:<sseintvecmode> 3 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
8657 (match_operand:SI 4 "const_0_to_255_operand")]
8662 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
8664 "vfixupimm<ssescalarmodesuffix>\t{%4, <round_saeonly_op6>%3, %2, %0%{%5%}|%0%{%5%}, %2, %<iptr>3<round_saeonly_op6>, %4}";
8665 [(set_attr "prefix" "evex")
8666 (set_attr "mode" "<ssescalarmode>")])
8668 (define_insn "<avx512>_rndscale<mode><mask_name><round_saeonly_name>"
8669 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8671 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "<round_saeonly_constraint>")
8672 (match_operand:SI 2 "const_0_to_255_operand")]
8675 "vrndscale<ssemodesuffix>\t{%2, <round_saeonly_mask_op3>%1, %0<mask_operand3>|%0<mask_operand3>, %1<round_saeonly_mask_op3>, %2}"
8676 [(set_attr "length_immediate" "1")
8677 (set_attr "prefix" "evex")
8678 (set_attr "mode" "<MODE>")])
8680 (define_insn "avx512f_rndscale<mode><round_saeonly_name>"
8681 [(set (match_operand:VF_128 0 "register_operand" "=v")
8684 [(match_operand:VF_128 1 "register_operand" "v")
8685 (match_operand:VF_128 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
8686 (match_operand:SI 3 "const_0_to_255_operand")]
8691 "vrndscale<ssescalarmodesuffix>\t{%3, <round_saeonly_op4>%2, %1, %0|%0, %1, %<iptr>2<round_saeonly_op4>, %3}"
8692 [(set_attr "length_immediate" "1")
8693 (set_attr "prefix" "evex")
8694 (set_attr "mode" "<MODE>")])
8696 ;; One bit in mask selects 2 elements.
8697 (define_insn "avx512f_shufps512_1<mask_name>"
8698 [(set (match_operand:V16SF 0 "register_operand" "=v")
8701 (match_operand:V16SF 1 "register_operand" "v")
8702 (match_operand:V16SF 2 "nonimmediate_operand" "vm"))
8703 (parallel [(match_operand 3 "const_0_to_3_operand")
8704 (match_operand 4 "const_0_to_3_operand")
8705 (match_operand 5 "const_16_to_19_operand")
8706 (match_operand 6 "const_16_to_19_operand")
8707 (match_operand 7 "const_4_to_7_operand")
8708 (match_operand 8 "const_4_to_7_operand")
8709 (match_operand 9 "const_20_to_23_operand")
8710 (match_operand 10 "const_20_to_23_operand")
8711 (match_operand 11 "const_8_to_11_operand")
8712 (match_operand 12 "const_8_to_11_operand")
8713 (match_operand 13 "const_24_to_27_operand")
8714 (match_operand 14 "const_24_to_27_operand")
8715 (match_operand 15 "const_12_to_15_operand")
8716 (match_operand 16 "const_12_to_15_operand")
8717 (match_operand 17 "const_28_to_31_operand")
8718 (match_operand 18 "const_28_to_31_operand")])))]
8720 && (INTVAL (operands[3]) == (INTVAL (operands[7]) - 4)
8721 && INTVAL (operands[4]) == (INTVAL (operands[8]) - 4)
8722 && INTVAL (operands[5]) == (INTVAL (operands[9]) - 4)
8723 && INTVAL (operands[6]) == (INTVAL (operands[10]) - 4)
8724 && INTVAL (operands[3]) == (INTVAL (operands[11]) - 8)
8725 && INTVAL (operands[4]) == (INTVAL (operands[12]) - 8)
8726 && INTVAL (operands[5]) == (INTVAL (operands[13]) - 8)
8727 && INTVAL (operands[6]) == (INTVAL (operands[14]) - 8)
8728 && INTVAL (operands[3]) == (INTVAL (operands[15]) - 12)
8729 && INTVAL (operands[4]) == (INTVAL (operands[16]) - 12)
8730 && INTVAL (operands[5]) == (INTVAL (operands[17]) - 12)
8731 && INTVAL (operands[6]) == (INTVAL (operands[18]) - 12))"
8734 mask = INTVAL (operands[3]);
8735 mask |= INTVAL (operands[4]) << 2;
8736 mask |= (INTVAL (operands[5]) - 16) << 4;
8737 mask |= (INTVAL (operands[6]) - 16) << 6;
8738 operands[3] = GEN_INT (mask);
8740 return "vshufps\t{%3, %2, %1, %0<mask_operand19>|%0<mask_operand19>, %1, %2, %3}";
8742 [(set_attr "type" "sselog")
8743 (set_attr "length_immediate" "1")
8744 (set_attr "prefix" "evex")
8745 (set_attr "mode" "V16SF")])
8747 (define_expand "avx512f_shufpd512_mask"
8748 [(match_operand:V8DF 0 "register_operand")
8749 (match_operand:V8DF 1 "register_operand")
8750 (match_operand:V8DF 2 "nonimmediate_operand")
8751 (match_operand:SI 3 "const_0_to_255_operand")
8752 (match_operand:V8DF 4 "register_operand")
8753 (match_operand:QI 5 "register_operand")]
8756 int mask = INTVAL (operands[3]);
8757 emit_insn (gen_avx512f_shufpd512_1_mask (operands[0], operands[1], operands[2],
8759 GEN_INT (mask & 2 ? 9 : 8),
8760 GEN_INT (mask & 4 ? 3 : 2),
8761 GEN_INT (mask & 8 ? 11 : 10),
8762 GEN_INT (mask & 16 ? 5 : 4),
8763 GEN_INT (mask & 32 ? 13 : 12),
8764 GEN_INT (mask & 64 ? 7 : 6),
8765 GEN_INT (mask & 128 ? 15 : 14),
8766 operands[4], operands[5]));
8770 (define_insn "avx512f_shufpd512_1<mask_name>"
8771 [(set (match_operand:V8DF 0 "register_operand" "=v")
8774 (match_operand:V8DF 1 "register_operand" "v")
8775 (match_operand:V8DF 2 "nonimmediate_operand" "vm"))
8776 (parallel [(match_operand 3 "const_0_to_1_operand")
8777 (match_operand 4 "const_8_to_9_operand")
8778 (match_operand 5 "const_2_to_3_operand")
8779 (match_operand 6 "const_10_to_11_operand")
8780 (match_operand 7 "const_4_to_5_operand")
8781 (match_operand 8 "const_12_to_13_operand")
8782 (match_operand 9 "const_6_to_7_operand")
8783 (match_operand 10 "const_14_to_15_operand")])))]
8787 mask = INTVAL (operands[3]);
8788 mask |= (INTVAL (operands[4]) - 8) << 1;
8789 mask |= (INTVAL (operands[5]) - 2) << 2;
8790 mask |= (INTVAL (operands[6]) - 10) << 3;
8791 mask |= (INTVAL (operands[7]) - 4) << 4;
8792 mask |= (INTVAL (operands[8]) - 12) << 5;
8793 mask |= (INTVAL (operands[9]) - 6) << 6;
8794 mask |= (INTVAL (operands[10]) - 14) << 7;
8795 operands[3] = GEN_INT (mask);
8797 return "vshufpd\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
8799 [(set_attr "type" "sselog")
8800 (set_attr "length_immediate" "1")
8801 (set_attr "prefix" "evex")
8802 (set_attr "mode" "V8DF")])
8804 (define_expand "avx_shufpd256<mask_expand4_name>"
8805 [(match_operand:V4DF 0 "register_operand")
8806 (match_operand:V4DF 1 "register_operand")
8807 (match_operand:V4DF 2 "nonimmediate_operand")
8808 (match_operand:SI 3 "const_int_operand")]
8811 int mask = INTVAL (operands[3]);
8812 emit_insn (gen_avx_shufpd256_1<mask_expand4_name> (operands[0],
8816 GEN_INT (mask & 2 ? 5 : 4),
8817 GEN_INT (mask & 4 ? 3 : 2),
8818 GEN_INT (mask & 8 ? 7 : 6)
8819 <mask_expand4_args>));
8823 (define_insn "avx_shufpd256_1<mask_name>"
8824 [(set (match_operand:V4DF 0 "register_operand" "=v")
8827 (match_operand:V4DF 1 "register_operand" "v")
8828 (match_operand:V4DF 2 "nonimmediate_operand" "vm"))
8829 (parallel [(match_operand 3 "const_0_to_1_operand")
8830 (match_operand 4 "const_4_to_5_operand")
8831 (match_operand 5 "const_2_to_3_operand")
8832 (match_operand 6 "const_6_to_7_operand")])))]
8833 "TARGET_AVX && <mask_avx512vl_condition>"
8836 mask = INTVAL (operands[3]);
8837 mask |= (INTVAL (operands[4]) - 4) << 1;
8838 mask |= (INTVAL (operands[5]) - 2) << 2;
8839 mask |= (INTVAL (operands[6]) - 6) << 3;
8840 operands[3] = GEN_INT (mask);
8842 return "vshufpd\t{%3, %2, %1, %0<mask_operand7>|%0<mask_operand7>, %1, %2, %3}";
8844 [(set_attr "type" "sseshuf")
8845 (set_attr "length_immediate" "1")
8846 (set_attr "prefix" "vex")
8847 (set_attr "mode" "V4DF")])
8849 (define_expand "sse2_shufpd<mask_expand4_name>"
8850 [(match_operand:V2DF 0 "register_operand")
8851 (match_operand:V2DF 1 "register_operand")
8852 (match_operand:V2DF 2 "vector_operand")
8853 (match_operand:SI 3 "const_int_operand")]
8856 int mask = INTVAL (operands[3]);
8857 emit_insn (gen_sse2_shufpd_v2df<mask_expand4_name> (operands[0], operands[1],
8858 operands[2], GEN_INT (mask & 1),
8859 GEN_INT (mask & 2 ? 3 : 2)
8860 <mask_expand4_args>));
8864 (define_insn "sse2_shufpd_v2df_mask"
8865 [(set (match_operand:V2DF 0 "register_operand" "=v")
8869 (match_operand:V2DF 1 "register_operand" "v")
8870 (match_operand:V2DF 2 "nonimmediate_operand" "vm"))
8871 (parallel [(match_operand 3 "const_0_to_1_operand")
8872 (match_operand 4 "const_2_to_3_operand")]))
8873 (match_operand:V2DF 5 "vector_move_operand" "0C")
8874 (match_operand:QI 6 "register_operand" "Yk")))]
8878 mask = INTVAL (operands[3]);
8879 mask |= (INTVAL (operands[4]) - 2) << 1;
8880 operands[3] = GEN_INT (mask);
8882 return "vshufpd\t{%3, %2, %1, %0%{%6%}%N5|%0%{%6%}%N5, %1, %2, %3}";
8884 [(set_attr "type" "sseshuf")
8885 (set_attr "length_immediate" "1")
8886 (set_attr "prefix" "evex")
8887 (set_attr "mode" "V2DF")])
8889 ;; punpcklqdq and punpckhqdq are shorter than shufpd.
8890 (define_insn "avx2_interleave_highv4di<mask_name>"
8891 [(set (match_operand:V4DI 0 "register_operand" "=v")
8894 (match_operand:V4DI 1 "register_operand" "v")
8895 (match_operand:V4DI 2 "nonimmediate_operand" "vm"))
8896 (parallel [(const_int 1)
8900 "TARGET_AVX2 && <mask_avx512vl_condition>"
8901 "vpunpckhqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8902 [(set_attr "type" "sselog")
8903 (set_attr "prefix" "vex")
8904 (set_attr "mode" "OI")])
8906 (define_insn "<mask_codefor>avx512f_interleave_highv8di<mask_name>"
8907 [(set (match_operand:V8DI 0 "register_operand" "=v")
8910 (match_operand:V8DI 1 "register_operand" "v")
8911 (match_operand:V8DI 2 "nonimmediate_operand" "vm"))
8912 (parallel [(const_int 1) (const_int 9)
8913 (const_int 3) (const_int 11)
8914 (const_int 5) (const_int 13)
8915 (const_int 7) (const_int 15)])))]
8917 "vpunpckhqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8918 [(set_attr "type" "sselog")
8919 (set_attr "prefix" "evex")
8920 (set_attr "mode" "XI")])
8922 (define_insn "vec_interleave_highv2di<mask_name>"
8923 [(set (match_operand:V2DI 0 "register_operand" "=x,v")
8926 (match_operand:V2DI 1 "register_operand" "0,v")
8927 (match_operand:V2DI 2 "vector_operand" "xBm,vm"))
8928 (parallel [(const_int 1)
8930 "TARGET_SSE2 && <mask_avx512vl_condition>"
8932 punpckhqdq\t{%2, %0|%0, %2}
8933 vpunpckhqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8934 [(set_attr "isa" "noavx,avx")
8935 (set_attr "type" "sselog")
8936 (set_attr "prefix_data16" "1,*")
8937 (set_attr "prefix" "orig,<mask_prefix>")
8938 (set_attr "mode" "TI")])
8940 (define_insn "avx2_interleave_lowv4di<mask_name>"
8941 [(set (match_operand:V4DI 0 "register_operand" "=v")
8944 (match_operand:V4DI 1 "register_operand" "v")
8945 (match_operand:V4DI 2 "nonimmediate_operand" "vm"))
8946 (parallel [(const_int 0)
8950 "TARGET_AVX2 && <mask_avx512vl_condition>"
8951 "vpunpcklqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8952 [(set_attr "type" "sselog")
8953 (set_attr "prefix" "vex")
8954 (set_attr "mode" "OI")])
8956 (define_insn "<mask_codefor>avx512f_interleave_lowv8di<mask_name>"
8957 [(set (match_operand:V8DI 0 "register_operand" "=v")
8960 (match_operand:V8DI 1 "register_operand" "v")
8961 (match_operand:V8DI 2 "nonimmediate_operand" "vm"))
8962 (parallel [(const_int 0) (const_int 8)
8963 (const_int 2) (const_int 10)
8964 (const_int 4) (const_int 12)
8965 (const_int 6) (const_int 14)])))]
8967 "vpunpcklqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8968 [(set_attr "type" "sselog")
8969 (set_attr "prefix" "evex")
8970 (set_attr "mode" "XI")])
8972 (define_insn "vec_interleave_lowv2di<mask_name>"
8973 [(set (match_operand:V2DI 0 "register_operand" "=x,v")
8976 (match_operand:V2DI 1 "register_operand" "0,v")
8977 (match_operand:V2DI 2 "vector_operand" "xBm,vm"))
8978 (parallel [(const_int 0)
8980 "TARGET_SSE2 && <mask_avx512vl_condition>"
8982 punpcklqdq\t{%2, %0|%0, %2}
8983 vpunpcklqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8984 [(set_attr "isa" "noavx,avx")
8985 (set_attr "type" "sselog")
8986 (set_attr "prefix_data16" "1,*")
8987 (set_attr "prefix" "orig,vex")
8988 (set_attr "mode" "TI")])
8990 (define_insn "sse2_shufpd_<mode>"
8991 [(set (match_operand:VI8F_128 0 "register_operand" "=x,v")
8992 (vec_select:VI8F_128
8993 (vec_concat:<ssedoublevecmode>
8994 (match_operand:VI8F_128 1 "register_operand" "0,v")
8995 (match_operand:VI8F_128 2 "vector_operand" "xBm,vm"))
8996 (parallel [(match_operand 3 "const_0_to_1_operand")
8997 (match_operand 4 "const_2_to_3_operand")])))]
9001 mask = INTVAL (operands[3]);
9002 mask |= (INTVAL (operands[4]) - 2) << 1;
9003 operands[3] = GEN_INT (mask);
9005 switch (which_alternative)
9008 return "shufpd\t{%3, %2, %0|%0, %2, %3}";
9010 return "vshufpd\t{%3, %2, %1, %0|%0, %1, %2, %3}";
9015 [(set_attr "isa" "noavx,avx")
9016 (set_attr "type" "sseshuf")
9017 (set_attr "length_immediate" "1")
9018 (set_attr "prefix" "orig,maybe_evex")
9019 (set_attr "mode" "V2DF")])
9021 ;; Avoid combining registers from different units in a single alternative,
9022 ;; see comment above inline_secondary_memory_needed function in i386.c
9023 (define_insn "sse2_storehpd"
9024 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,Yv,x,*f,r")
9026 (match_operand:V2DF 1 "nonimmediate_operand" " v,0, v,o,o,o")
9027 (parallel [(const_int 1)])))]
9028 "TARGET_SSE2 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
9030 %vmovhpd\t{%1, %0|%0, %1}
9032 vunpckhpd\t{%d1, %0|%0, %d1}
9036 [(set_attr "isa" "*,noavx,avx,*,*,*")
9037 (set_attr "type" "ssemov,sselog1,sselog1,ssemov,fmov,imov")
9038 (set (attr "prefix_data16")
9040 (and (eq_attr "alternative" "0")
9041 (not (match_test "TARGET_AVX")))
9043 (const_string "*")))
9044 (set_attr "prefix" "maybe_vex,orig,maybe_evex,*,*,*")
9045 (set_attr "mode" "V1DF,V1DF,V2DF,DF,DF,DF")])
9048 [(set (match_operand:DF 0 "register_operand")
9050 (match_operand:V2DF 1 "memory_operand")
9051 (parallel [(const_int 1)])))]
9052 "TARGET_SSE2 && reload_completed"
9053 [(set (match_dup 0) (match_dup 1))]
9054 "operands[1] = adjust_address (operands[1], DFmode, 8);")
9056 (define_insn "*vec_extractv2df_1_sse"
9057 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,x")
9059 (match_operand:V2DF 1 "nonimmediate_operand" "x,x,o")
9060 (parallel [(const_int 1)])))]
9061 "!TARGET_SSE2 && TARGET_SSE
9062 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
9064 movhps\t{%1, %0|%q0, %1}
9065 movhlps\t{%1, %0|%0, %1}
9066 movlps\t{%H1, %0|%0, %H1}"
9067 [(set_attr "type" "ssemov")
9068 (set_attr "mode" "V2SF,V4SF,V2SF")])
9070 ;; Avoid combining registers from different units in a single alternative,
9071 ;; see comment above inline_secondary_memory_needed function in i386.c
9072 (define_insn "sse2_storelpd"
9073 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,x,*f,r")
9075 (match_operand:V2DF 1 "nonimmediate_operand" " v,x,m,m,m")
9076 (parallel [(const_int 0)])))]
9077 "TARGET_SSE2 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
9079 %vmovlpd\t{%1, %0|%0, %1}
9084 [(set_attr "type" "ssemov,ssemov,ssemov,fmov,imov")
9085 (set (attr "prefix_data16")
9086 (if_then_else (eq_attr "alternative" "0")
9088 (const_string "*")))
9089 (set_attr "prefix" "maybe_vex")
9090 (set_attr "mode" "V1DF,DF,DF,DF,DF")])
9093 [(set (match_operand:DF 0 "register_operand")
9095 (match_operand:V2DF 1 "nonimmediate_operand")
9096 (parallel [(const_int 0)])))]
9097 "TARGET_SSE2 && reload_completed"
9098 [(set (match_dup 0) (match_dup 1))]
9099 "operands[1] = gen_lowpart (DFmode, operands[1]);")
9101 (define_insn "*vec_extractv2df_0_sse"
9102 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,x")
9104 (match_operand:V2DF 1 "nonimmediate_operand" "x,x,m")
9105 (parallel [(const_int 0)])))]
9106 "!TARGET_SSE2 && TARGET_SSE
9107 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
9109 movlps\t{%1, %0|%0, %1}
9110 movaps\t{%1, %0|%0, %1}
9111 movlps\t{%1, %0|%0, %q1}"
9112 [(set_attr "type" "ssemov")
9113 (set_attr "mode" "V2SF,V4SF,V2SF")])
9115 (define_expand "sse2_loadhpd_exp"
9116 [(set (match_operand:V2DF 0 "nonimmediate_operand")
9119 (match_operand:V2DF 1 "nonimmediate_operand")
9120 (parallel [(const_int 0)]))
9121 (match_operand:DF 2 "nonimmediate_operand")))]
9124 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V2DFmode, operands);
9126 emit_insn (gen_sse2_loadhpd (dst, operands[1], operands[2]));
9128 /* Fix up the destination if needed. */
9129 if (dst != operands[0])
9130 emit_move_insn (operands[0], dst);
9135 ;; Avoid combining registers from different units in a single alternative,
9136 ;; see comment above inline_secondary_memory_needed function in i386.c
9137 (define_insn "sse2_loadhpd"
9138 [(set (match_operand:V2DF 0 "nonimmediate_operand"
9142 (match_operand:V2DF 1 "nonimmediate_operand"
9144 (parallel [(const_int 0)]))
9145 (match_operand:DF 2 "nonimmediate_operand"
9146 " m,m,x,Yv,x,*f,r")))]
9147 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
9149 movhpd\t{%2, %0|%0, %2}
9150 vmovhpd\t{%2, %1, %0|%0, %1, %2}
9151 unpcklpd\t{%2, %0|%0, %2}
9152 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
9156 [(set_attr "isa" "noavx,avx,noavx,avx,*,*,*")
9157 (set_attr "type" "ssemov,ssemov,sselog,sselog,ssemov,fmov,imov")
9158 (set (attr "prefix_data16")
9159 (if_then_else (eq_attr "alternative" "0")
9161 (const_string "*")))
9162 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,*,*,*")
9163 (set_attr "mode" "V1DF,V1DF,V2DF,V2DF,DF,DF,DF")])
9166 [(set (match_operand:V2DF 0 "memory_operand")
9168 (vec_select:DF (match_dup 0) (parallel [(const_int 0)]))
9169 (match_operand:DF 1 "register_operand")))]
9170 "TARGET_SSE2 && reload_completed"
9171 [(set (match_dup 0) (match_dup 1))]
9172 "operands[0] = adjust_address (operands[0], DFmode, 8);")
9174 (define_expand "sse2_loadlpd_exp"
9175 [(set (match_operand:V2DF 0 "nonimmediate_operand")
9177 (match_operand:DF 2 "nonimmediate_operand")
9179 (match_operand:V2DF 1 "nonimmediate_operand")
9180 (parallel [(const_int 1)]))))]
9183 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V2DFmode, operands);
9185 emit_insn (gen_sse2_loadlpd (dst, operands[1], operands[2]));
9187 /* Fix up the destination if needed. */
9188 if (dst != operands[0])
9189 emit_move_insn (operands[0], dst);
9194 ;; Avoid combining registers from different units in a single alternative,
9195 ;; see comment above inline_secondary_memory_needed function in i386.c
9196 (define_insn "sse2_loadlpd"
9197 [(set (match_operand:V2DF 0 "nonimmediate_operand"
9198 "=v,x,v,x,v,x,x,v,m,m ,m")
9200 (match_operand:DF 2 "nonimmediate_operand"
9201 "vm,m,m,x,v,0,0,v,x,*f,r")
9203 (match_operand:V2DF 1 "vector_move_operand"
9204 " C,0,v,0,v,x,o,o,0,0 ,0")
9205 (parallel [(const_int 1)]))))]
9206 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
9208 %vmovq\t{%2, %0|%0, %2}
9209 movlpd\t{%2, %0|%0, %2}
9210 vmovlpd\t{%2, %1, %0|%0, %1, %2}
9211 movsd\t{%2, %0|%0, %2}
9212 vmovsd\t{%2, %1, %0|%0, %1, %2}
9213 shufpd\t{$2, %1, %0|%0, %1, 2}
9214 movhpd\t{%H1, %0|%0, %H1}
9215 vmovhpd\t{%H1, %2, %0|%0, %2, %H1}
9219 [(set_attr "isa" "*,noavx,avx,noavx,avx,noavx,noavx,avx,*,*,*")
9221 (cond [(eq_attr "alternative" "5")
9222 (const_string "sselog")
9223 (eq_attr "alternative" "9")
9224 (const_string "fmov")
9225 (eq_attr "alternative" "10")
9226 (const_string "imov")
9228 (const_string "ssemov")))
9229 (set (attr "prefix_data16")
9230 (if_then_else (eq_attr "alternative" "1,6")
9232 (const_string "*")))
9233 (set (attr "length_immediate")
9234 (if_then_else (eq_attr "alternative" "5")
9236 (const_string "*")))
9237 (set (attr "prefix")
9238 (cond [(eq_attr "alternative" "0")
9239 (const_string "maybe_vex")
9240 (eq_attr "alternative" "1,3,5,6")
9241 (const_string "orig")
9242 (eq_attr "alternative" "2,4,7")
9243 (const_string "maybe_evex")
9245 (const_string "*")))
9246 (set_attr "mode" "DF,V1DF,V1DF,V1DF,V1DF,V2DF,V1DF,V1DF,DF,DF,DF")])
9249 [(set (match_operand:V2DF 0 "memory_operand")
9251 (match_operand:DF 1 "register_operand")
9252 (vec_select:DF (match_dup 0) (parallel [(const_int 1)]))))]
9253 "TARGET_SSE2 && reload_completed"
9254 [(set (match_dup 0) (match_dup 1))]
9255 "operands[0] = adjust_address (operands[0], DFmode, 0);")
9257 (define_insn "sse2_movsd"
9258 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,v,x,v,m,x,x,v,o")
9260 (match_operand:V2DF 2 "nonimmediate_operand" " x,v,m,m,v,0,0,v,0")
9261 (match_operand:V2DF 1 "nonimmediate_operand" " 0,v,0,v,0,x,o,o,v")
9265 movsd\t{%2, %0|%0, %2}
9266 vmovsd\t{%2, %1, %0|%0, %1, %2}
9267 movlpd\t{%2, %0|%0, %q2}
9268 vmovlpd\t{%2, %1, %0|%0, %1, %q2}
9269 %vmovlpd\t{%2, %0|%q0, %2}
9270 shufpd\t{$2, %1, %0|%0, %1, 2}
9271 movhps\t{%H1, %0|%0, %H1}
9272 vmovhps\t{%H1, %2, %0|%0, %2, %H1}
9273 %vmovhps\t{%1, %H0|%H0, %1}"
9274 [(set_attr "isa" "noavx,avx,noavx,avx,*,noavx,noavx,avx,*")
9277 (eq_attr "alternative" "5")
9278 (const_string "sselog")
9279 (const_string "ssemov")))
9280 (set (attr "prefix_data16")
9282 (and (eq_attr "alternative" "2,4")
9283 (not (match_test "TARGET_AVX")))
9285 (const_string "*")))
9286 (set (attr "length_immediate")
9287 (if_then_else (eq_attr "alternative" "5")
9289 (const_string "*")))
9290 (set (attr "prefix")
9291 (cond [(eq_attr "alternative" "1,3,7")
9292 (const_string "maybe_evex")
9293 (eq_attr "alternative" "4,8")
9294 (const_string "maybe_vex")
9296 (const_string "orig")))
9297 (set_attr "mode" "DF,DF,V1DF,V1DF,V1DF,V2DF,V1DF,V1DF,V1DF")])
9299 (define_insn "vec_dupv2df<mask_name>"
9300 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
9302 (match_operand:DF 1 "nonimmediate_operand" " 0,xm,vm")))]
9303 "TARGET_SSE2 && <mask_avx512vl_condition>"
9306 %vmovddup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}
9307 vmovddup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
9308 [(set_attr "isa" "noavx,sse3,avx512vl")
9309 (set_attr "type" "sselog1")
9310 (set_attr "prefix" "orig,maybe_vex,evex")
9311 (set_attr "mode" "V2DF,DF,DF")])
9313 (define_insn "vec_concatv2df"
9314 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v,x,v,x,x, v,x,x")
9316 (match_operand:DF 1 "nonimmediate_operand" " 0,x,v,m,m,0,x,xm,0,0")
9317 (match_operand:DF 2 "vector_move_operand" " x,x,v,1,1,m,m, C,x,m")))]
9319 && (!(MEM_P (operands[1]) && MEM_P (operands[2]))
9320 || (TARGET_SSE3 && rtx_equal_p (operands[1], operands[2])))"
9322 unpcklpd\t{%2, %0|%0, %2}
9323 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
9324 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
9325 %vmovddup\t{%1, %0|%0, %1}
9326 vmovddup\t{%1, %0|%0, %1}
9327 movhpd\t{%2, %0|%0, %2}
9328 vmovhpd\t{%2, %1, %0|%0, %1, %2}
9329 %vmovq\t{%1, %0|%0, %1}
9330 movlhps\t{%2, %0|%0, %2}
9331 movhps\t{%2, %0|%0, %2}"
9333 (cond [(eq_attr "alternative" "0,5")
9334 (const_string "sse2_noavx")
9335 (eq_attr "alternative" "1,6")
9336 (const_string "avx")
9337 (eq_attr "alternative" "2,4")
9338 (const_string "avx512vl")
9339 (eq_attr "alternative" "3")
9340 (const_string "sse3")
9341 (eq_attr "alternative" "7")
9342 (const_string "sse2")
9344 (const_string "noavx")))
9347 (eq_attr "alternative" "0,1,2,3,4")
9348 (const_string "sselog")
9349 (const_string "ssemov")))
9350 (set (attr "prefix_data16")
9351 (if_then_else (eq_attr "alternative" "5")
9353 (const_string "*")))
9354 (set (attr "prefix")
9355 (cond [(eq_attr "alternative" "1,6")
9356 (const_string "vex")
9357 (eq_attr "alternative" "2,4")
9358 (const_string "evex")
9359 (eq_attr "alternative" "3,7")
9360 (const_string "maybe_vex")
9362 (const_string "orig")))
9363 (set_attr "mode" "V2DF,V2DF,V2DF, DF, DF, V1DF,V1DF,DF,V4SF,V2SF")])
9365 ;; vmovq clears also the higher bits.
9366 (define_insn "vec_set<mode>_0"
9367 [(set (match_operand:VF2_512_256 0 "register_operand" "=v")
9368 (vec_merge:VF2_512_256
9369 (vec_duplicate:VF2_512_256
9370 (match_operand:<ssescalarmode> 2 "general_operand" "xm"))
9371 (match_operand:VF2_512_256 1 "const0_operand" "C")
9374 "vmovq\t{%2, %x0|%x0, %2}"
9375 [(set_attr "type" "ssemov")
9376 (set_attr "prefix" "maybe_evex")
9377 (set_attr "mode" "DF")])
9379 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9381 ;; Parallel integer down-conversion operations
9383 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9385 (define_mode_iterator PMOV_DST_MODE_1 [V16QI V16HI V8SI V8HI])
9386 (define_mode_attr pmov_src_mode
9387 [(V16QI "V16SI") (V16HI "V16SI") (V8SI "V8DI") (V8HI "V8DI")])
9388 (define_mode_attr pmov_src_lower
9389 [(V16QI "v16si") (V16HI "v16si") (V8SI "v8di") (V8HI "v8di")])
9390 (define_mode_attr pmov_suff_1
9391 [(V16QI "db") (V16HI "dw") (V8SI "qd") (V8HI "qw")])
9393 (define_insn "*avx512f_<code><pmov_src_lower><mode>2"
9394 [(set (match_operand:PMOV_DST_MODE_1 0 "nonimmediate_operand" "=v,m")
9395 (any_truncate:PMOV_DST_MODE_1
9396 (match_operand:<pmov_src_mode> 1 "register_operand" "v,v")))]
9398 "vpmov<trunsuffix><pmov_suff_1>\t{%1, %0|%0, %1}"
9399 [(set_attr "type" "ssemov")
9400 (set_attr "memory" "none,store")
9401 (set_attr "prefix" "evex")
9402 (set_attr "mode" "<sseinsnmode>")])
9404 (define_insn "avx512f_<code><pmov_src_lower><mode>2_mask"
9405 [(set (match_operand:PMOV_DST_MODE_1 0 "nonimmediate_operand" "=v,m")
9406 (vec_merge:PMOV_DST_MODE_1
9407 (any_truncate:PMOV_DST_MODE_1
9408 (match_operand:<pmov_src_mode> 1 "register_operand" "v,v"))
9409 (match_operand:PMOV_DST_MODE_1 2 "vector_move_operand" "0C,0")
9410 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
9412 "vpmov<trunsuffix><pmov_suff_1>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9413 [(set_attr "type" "ssemov")
9414 (set_attr "memory" "none,store")
9415 (set_attr "prefix" "evex")
9416 (set_attr "mode" "<sseinsnmode>")])
9418 (define_expand "avx512f_<code><pmov_src_lower><mode>2_mask_store"
9419 [(set (match_operand:PMOV_DST_MODE_1 0 "memory_operand")
9420 (vec_merge:PMOV_DST_MODE_1
9421 (any_truncate:PMOV_DST_MODE_1
9422 (match_operand:<pmov_src_mode> 1 "register_operand"))
9424 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
9427 (define_insn "avx512bw_<code>v32hiv32qi2"
9428 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=v,m")
9430 (match_operand:V32HI 1 "register_operand" "v,v")))]
9432 "vpmov<trunsuffix>wb\t{%1, %0|%0, %1}"
9433 [(set_attr "type" "ssemov")
9434 (set_attr "memory" "none,store")
9435 (set_attr "prefix" "evex")
9436 (set_attr "mode" "XI")])
9438 (define_insn "avx512bw_<code>v32hiv32qi2_mask"
9439 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=v,m")
9442 (match_operand:V32HI 1 "register_operand" "v,v"))
9443 (match_operand:V32QI 2 "vector_move_operand" "0C,0")
9444 (match_operand:SI 3 "register_operand" "Yk,Yk")))]
9446 "vpmov<trunsuffix>wb\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9447 [(set_attr "type" "ssemov")
9448 (set_attr "memory" "none,store")
9449 (set_attr "prefix" "evex")
9450 (set_attr "mode" "XI")])
9452 (define_expand "avx512bw_<code>v32hiv32qi2_mask_store"
9453 [(set (match_operand:V32QI 0 "nonimmediate_operand")
9456 (match_operand:V32HI 1 "register_operand"))
9458 (match_operand:SI 2 "register_operand")))]
9461 (define_mode_iterator PMOV_DST_MODE_2
9462 [V4SI V8HI (V16QI "TARGET_AVX512BW")])
9463 (define_mode_attr pmov_suff_2
9464 [(V16QI "wb") (V8HI "dw") (V4SI "qd")])
9466 (define_insn "*avx512vl_<code><ssedoublemodelower><mode>2"
9467 [(set (match_operand:PMOV_DST_MODE_2 0 "nonimmediate_operand" "=v,m")
9468 (any_truncate:PMOV_DST_MODE_2
9469 (match_operand:<ssedoublemode> 1 "register_operand" "v,v")))]
9471 "vpmov<trunsuffix><pmov_suff_2>\t{%1, %0|%0, %1}"
9472 [(set_attr "type" "ssemov")
9473 (set_attr "memory" "none,store")
9474 (set_attr "prefix" "evex")
9475 (set_attr "mode" "<sseinsnmode>")])
9477 (define_insn "<avx512>_<code><ssedoublemodelower><mode>2_mask"
9478 [(set (match_operand:PMOV_DST_MODE_2 0 "nonimmediate_operand" "=v,m")
9479 (vec_merge:PMOV_DST_MODE_2
9480 (any_truncate:PMOV_DST_MODE_2
9481 (match_operand:<ssedoublemode> 1 "register_operand" "v,v"))
9482 (match_operand:PMOV_DST_MODE_2 2 "vector_move_operand" "0C,0")
9483 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
9485 "vpmov<trunsuffix><pmov_suff_2>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9486 [(set_attr "type" "ssemov")
9487 (set_attr "memory" "none,store")
9488 (set_attr "prefix" "evex")
9489 (set_attr "mode" "<sseinsnmode>")])
9491 (define_expand "<avx512>_<code><ssedoublemodelower><mode>2_mask_store"
9492 [(set (match_operand:PMOV_DST_MODE_2 0 "nonimmediate_operand")
9493 (vec_merge:PMOV_DST_MODE_2
9494 (any_truncate:PMOV_DST_MODE_2
9495 (match_operand:<ssedoublemode> 1 "register_operand"))
9497 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
9500 (define_mode_iterator PMOV_SRC_MODE_3 [V4DI V2DI V8SI V4SI (V8HI "TARGET_AVX512BW")])
9501 (define_mode_attr pmov_dst_3
9502 [(V4DI "V4QI") (V2DI "V2QI") (V8SI "V8QI") (V4SI "V4QI") (V8HI "V8QI")])
9503 (define_mode_attr pmov_dst_zeroed_3
9504 [(V4DI "V12QI") (V2DI "V14QI") (V8SI "V8QI") (V4SI "V12QI") (V8HI "V8QI")])
9505 (define_mode_attr pmov_suff_3
9506 [(V4DI "qb") (V2DI "qb") (V8SI "db") (V4SI "db") (V8HI "wb")])
9508 (define_insn "*avx512vl_<code><mode>v<ssescalarnum>qi2"
9509 [(set (match_operand:V16QI 0 "register_operand" "=v")
9511 (any_truncate:<pmov_dst_3>
9512 (match_operand:PMOV_SRC_MODE_3 1 "register_operand" "v"))
9513 (match_operand:<pmov_dst_zeroed_3> 2 "const0_operand")))]
9515 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0|%0, %1}"
9516 [(set_attr "type" "ssemov")
9517 (set_attr "prefix" "evex")
9518 (set_attr "mode" "TI")])
9520 (define_insn "*avx512vl_<code>v2div2qi2_store"
9521 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9524 (match_operand:V2DI 1 "register_operand" "v"))
9527 (parallel [(const_int 2) (const_int 3)
9528 (const_int 4) (const_int 5)
9529 (const_int 6) (const_int 7)
9530 (const_int 8) (const_int 9)
9531 (const_int 10) (const_int 11)
9532 (const_int 12) (const_int 13)
9533 (const_int 14) (const_int 15)]))))]
9535 "vpmov<trunsuffix>qb\t{%1, %0|%w0, %1}"
9536 [(set_attr "type" "ssemov")
9537 (set_attr "memory" "store")
9538 (set_attr "prefix" "evex")
9539 (set_attr "mode" "TI")])
9541 (define_insn "avx512vl_<code>v2div2qi2_mask"
9542 [(set (match_operand:V16QI 0 "register_operand" "=v")
9546 (match_operand:V2DI 1 "register_operand" "v"))
9548 (match_operand:V16QI 2 "vector_move_operand" "0C")
9549 (parallel [(const_int 0) (const_int 1)]))
9550 (match_operand:QI 3 "register_operand" "Yk"))
9551 (const_vector:V14QI [(const_int 0) (const_int 0)
9552 (const_int 0) (const_int 0)
9553 (const_int 0) (const_int 0)
9554 (const_int 0) (const_int 0)
9555 (const_int 0) (const_int 0)
9556 (const_int 0) (const_int 0)
9557 (const_int 0) (const_int 0)])))]
9559 "vpmov<trunsuffix>qb\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9560 [(set_attr "type" "ssemov")
9561 (set_attr "prefix" "evex")
9562 (set_attr "mode" "TI")])
9564 (define_insn "*avx512vl_<code>v2div2qi2_mask_1"
9565 [(set (match_operand:V16QI 0 "register_operand" "=v")
9569 (match_operand:V2DI 1 "register_operand" "v"))
9570 (const_vector:V2QI [(const_int 0) (const_int 0)])
9571 (match_operand:QI 2 "register_operand" "Yk"))
9572 (const_vector:V14QI [(const_int 0) (const_int 0)
9573 (const_int 0) (const_int 0)
9574 (const_int 0) (const_int 0)
9575 (const_int 0) (const_int 0)
9576 (const_int 0) (const_int 0)
9577 (const_int 0) (const_int 0)
9578 (const_int 0) (const_int 0)])))]
9580 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9581 [(set_attr "type" "ssemov")
9582 (set_attr "prefix" "evex")
9583 (set_attr "mode" "TI")])
9585 (define_insn "avx512vl_<code>v2div2qi2_mask_store"
9586 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9590 (match_operand:V2DI 1 "register_operand" "v"))
9593 (parallel [(const_int 0) (const_int 1)]))
9594 (match_operand:QI 2 "register_operand" "Yk"))
9597 (parallel [(const_int 2) (const_int 3)
9598 (const_int 4) (const_int 5)
9599 (const_int 6) (const_int 7)
9600 (const_int 8) (const_int 9)
9601 (const_int 10) (const_int 11)
9602 (const_int 12) (const_int 13)
9603 (const_int 14) (const_int 15)]))))]
9605 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}|%w0%{%2%}, %1}"
9606 [(set_attr "type" "ssemov")
9607 (set_attr "memory" "store")
9608 (set_attr "prefix" "evex")
9609 (set_attr "mode" "TI")])
9611 (define_insn "*avx512vl_<code><mode>v4qi2_store"
9612 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9615 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9618 (parallel [(const_int 4) (const_int 5)
9619 (const_int 6) (const_int 7)
9620 (const_int 8) (const_int 9)
9621 (const_int 10) (const_int 11)
9622 (const_int 12) (const_int 13)
9623 (const_int 14) (const_int 15)]))))]
9625 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0|%k0, %1}"
9626 [(set_attr "type" "ssemov")
9627 (set_attr "memory" "store")
9628 (set_attr "prefix" "evex")
9629 (set_attr "mode" "TI")])
9631 (define_insn "avx512vl_<code><mode>v4qi2_mask"
9632 [(set (match_operand:V16QI 0 "register_operand" "=v")
9636 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9638 (match_operand:V16QI 2 "vector_move_operand" "0C")
9639 (parallel [(const_int 0) (const_int 1)
9640 (const_int 2) (const_int 3)]))
9641 (match_operand:QI 3 "register_operand" "Yk"))
9642 (const_vector:V12QI [(const_int 0) (const_int 0)
9643 (const_int 0) (const_int 0)
9644 (const_int 0) (const_int 0)
9645 (const_int 0) (const_int 0)
9646 (const_int 0) (const_int 0)
9647 (const_int 0) (const_int 0)])))]
9649 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9650 [(set_attr "type" "ssemov")
9651 (set_attr "prefix" "evex")
9652 (set_attr "mode" "TI")])
9654 (define_insn "*avx512vl_<code><mode>v4qi2_mask_1"
9655 [(set (match_operand:V16QI 0 "register_operand" "=v")
9659 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9660 (const_vector:V4QI [(const_int 0) (const_int 0)
9661 (const_int 0) (const_int 0)])
9662 (match_operand:QI 2 "register_operand" "Yk"))
9663 (const_vector:V12QI [(const_int 0) (const_int 0)
9664 (const_int 0) (const_int 0)
9665 (const_int 0) (const_int 0)
9666 (const_int 0) (const_int 0)
9667 (const_int 0) (const_int 0)
9668 (const_int 0) (const_int 0)])))]
9670 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9671 [(set_attr "type" "ssemov")
9672 (set_attr "prefix" "evex")
9673 (set_attr "mode" "TI")])
9675 (define_insn "avx512vl_<code><mode>v4qi2_mask_store"
9676 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9680 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9683 (parallel [(const_int 0) (const_int 1)
9684 (const_int 2) (const_int 3)]))
9685 (match_operand:QI 2 "register_operand" "Yk"))
9688 (parallel [(const_int 4) (const_int 5)
9689 (const_int 6) (const_int 7)
9690 (const_int 8) (const_int 9)
9691 (const_int 10) (const_int 11)
9692 (const_int 12) (const_int 13)
9693 (const_int 14) (const_int 15)]))))]
9695 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}|%k0%{%2%}, %1}"
9696 [(set_attr "type" "ssemov")
9697 (set_attr "memory" "store")
9698 (set_attr "prefix" "evex")
9699 (set_attr "mode" "TI")])
9701 (define_mode_iterator VI2_128_BW_4_256
9702 [(V8HI "TARGET_AVX512BW") V8SI])
9704 (define_insn "*avx512vl_<code><mode>v8qi2_store"
9705 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9708 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9711 (parallel [(const_int 8) (const_int 9)
9712 (const_int 10) (const_int 11)
9713 (const_int 12) (const_int 13)
9714 (const_int 14) (const_int 15)]))))]
9716 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0|%q0, %1}"
9717 [(set_attr "type" "ssemov")
9718 (set_attr "memory" "store")
9719 (set_attr "prefix" "evex")
9720 (set_attr "mode" "TI")])
9722 (define_insn "avx512vl_<code><mode>v8qi2_mask"
9723 [(set (match_operand:V16QI 0 "register_operand" "=v")
9727 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9729 (match_operand:V16QI 2 "vector_move_operand" "0C")
9730 (parallel [(const_int 0) (const_int 1)
9731 (const_int 2) (const_int 3)
9732 (const_int 4) (const_int 5)
9733 (const_int 6) (const_int 7)]))
9734 (match_operand:QI 3 "register_operand" "Yk"))
9735 (const_vector:V8QI [(const_int 0) (const_int 0)
9736 (const_int 0) (const_int 0)
9737 (const_int 0) (const_int 0)
9738 (const_int 0) (const_int 0)])))]
9740 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9741 [(set_attr "type" "ssemov")
9742 (set_attr "prefix" "evex")
9743 (set_attr "mode" "TI")])
9745 (define_insn "*avx512vl_<code><mode>v8qi2_mask_1"
9746 [(set (match_operand:V16QI 0 "register_operand" "=v")
9750 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9751 (const_vector:V8QI [(const_int 0) (const_int 0)
9752 (const_int 0) (const_int 0)
9753 (const_int 0) (const_int 0)
9754 (const_int 0) (const_int 0)])
9755 (match_operand:QI 2 "register_operand" "Yk"))
9756 (const_vector:V8QI [(const_int 0) (const_int 0)
9757 (const_int 0) (const_int 0)
9758 (const_int 0) (const_int 0)
9759 (const_int 0) (const_int 0)])))]
9761 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9762 [(set_attr "type" "ssemov")
9763 (set_attr "prefix" "evex")
9764 (set_attr "mode" "TI")])
9766 (define_insn "avx512vl_<code><mode>v8qi2_mask_store"
9767 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9771 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9774 (parallel [(const_int 0) (const_int 1)
9775 (const_int 2) (const_int 3)
9776 (const_int 4) (const_int 5)
9777 (const_int 6) (const_int 7)]))
9778 (match_operand:QI 2 "register_operand" "Yk"))
9781 (parallel [(const_int 8) (const_int 9)
9782 (const_int 10) (const_int 11)
9783 (const_int 12) (const_int 13)
9784 (const_int 14) (const_int 15)]))))]
9786 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}|%q0%{%2%}, %1}"
9787 [(set_attr "type" "ssemov")
9788 (set_attr "memory" "store")
9789 (set_attr "prefix" "evex")
9790 (set_attr "mode" "TI")])
9792 (define_mode_iterator PMOV_SRC_MODE_4 [V4DI V2DI V4SI])
9793 (define_mode_attr pmov_dst_4
9794 [(V4DI "V4HI") (V2DI "V2HI") (V4SI "V4HI")])
9795 (define_mode_attr pmov_dst_zeroed_4
9796 [(V4DI "V4HI") (V2DI "V6HI") (V4SI "V4HI")])
9797 (define_mode_attr pmov_suff_4
9798 [(V4DI "qw") (V2DI "qw") (V4SI "dw")])
9800 (define_insn "*avx512vl_<code><mode>v<ssescalarnum>hi2"
9801 [(set (match_operand:V8HI 0 "register_operand" "=v")
9803 (any_truncate:<pmov_dst_4>
9804 (match_operand:PMOV_SRC_MODE_4 1 "register_operand" "v"))
9805 (match_operand:<pmov_dst_zeroed_4> 2 "const0_operand")))]
9807 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0|%0, %1}"
9808 [(set_attr "type" "ssemov")
9809 (set_attr "prefix" "evex")
9810 (set_attr "mode" "TI")])
9812 (define_insn "*avx512vl_<code><mode>v4hi2_store"
9813 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9816 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9819 (parallel [(const_int 4) (const_int 5)
9820 (const_int 6) (const_int 7)]))))]
9822 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0|%0, %1}"
9823 [(set_attr "type" "ssemov")
9824 (set_attr "memory" "store")
9825 (set_attr "prefix" "evex")
9826 (set_attr "mode" "TI")])
9828 (define_insn "avx512vl_<code><mode>v4hi2_mask"
9829 [(set (match_operand:V8HI 0 "register_operand" "=v")
9833 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9835 (match_operand:V8HI 2 "vector_move_operand" "0C")
9836 (parallel [(const_int 0) (const_int 1)
9837 (const_int 2) (const_int 3)]))
9838 (match_operand:QI 3 "register_operand" "Yk"))
9839 (const_vector:V4HI [(const_int 0) (const_int 0)
9840 (const_int 0) (const_int 0)])))]
9842 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9843 [(set_attr "type" "ssemov")
9844 (set_attr "prefix" "evex")
9845 (set_attr "mode" "TI")])
9847 (define_insn "*avx512vl_<code><mode>v4hi2_mask_1"
9848 [(set (match_operand:V8HI 0 "register_operand" "=v")
9852 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9853 (const_vector:V4HI [(const_int 0) (const_int 0)
9854 (const_int 0) (const_int 0)])
9855 (match_operand:QI 2 "register_operand" "Yk"))
9856 (const_vector:V4HI [(const_int 0) (const_int 0)
9857 (const_int 0) (const_int 0)])))]
9859 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9860 [(set_attr "type" "ssemov")
9861 (set_attr "prefix" "evex")
9862 (set_attr "mode" "TI")])
9864 (define_insn "avx512vl_<code><mode>v4hi2_mask_store"
9865 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9869 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9872 (parallel [(const_int 0) (const_int 1)
9873 (const_int 2) (const_int 3)]))
9874 (match_operand:QI 2 "register_operand" "Yk"))
9877 (parallel [(const_int 4) (const_int 5)
9878 (const_int 6) (const_int 7)]))))]
9881 if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 4)
9882 return "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%2%}|%0%{%2%}, %t1}";
9883 return "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%2%}|%0%{%2%}, %g1}";
9885 [(set_attr "type" "ssemov")
9886 (set_attr "memory" "store")
9887 (set_attr "prefix" "evex")
9888 (set_attr "mode" "TI")])
9890 (define_insn "*avx512vl_<code>v2div2hi2_store"
9891 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9894 (match_operand:V2DI 1 "register_operand" "v"))
9897 (parallel [(const_int 2) (const_int 3)
9898 (const_int 4) (const_int 5)
9899 (const_int 6) (const_int 7)]))))]
9901 "vpmov<trunsuffix>qw\t{%1, %0|%0, %1}"
9902 [(set_attr "type" "ssemov")
9903 (set_attr "memory" "store")
9904 (set_attr "prefix" "evex")
9905 (set_attr "mode" "TI")])
9907 (define_insn "avx512vl_<code>v2div2hi2_mask"
9908 [(set (match_operand:V8HI 0 "register_operand" "=v")
9912 (match_operand:V2DI 1 "register_operand" "v"))
9914 (match_operand:V8HI 2 "vector_move_operand" "0C")
9915 (parallel [(const_int 0) (const_int 1)]))
9916 (match_operand:QI 3 "register_operand" "Yk"))
9917 (const_vector:V6HI [(const_int 0) (const_int 0)
9918 (const_int 0) (const_int 0)
9919 (const_int 0) (const_int 0)])))]
9921 "vpmov<trunsuffix>qw\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9922 [(set_attr "type" "ssemov")
9923 (set_attr "prefix" "evex")
9924 (set_attr "mode" "TI")])
9926 (define_insn "*avx512vl_<code>v2div2hi2_mask_1"
9927 [(set (match_operand:V8HI 0 "register_operand" "=v")
9931 (match_operand:V2DI 1 "register_operand" "v"))
9932 (const_vector:V2HI [(const_int 0) (const_int 0)])
9933 (match_operand:QI 2 "register_operand" "Yk"))
9934 (const_vector:V6HI [(const_int 0) (const_int 0)
9935 (const_int 0) (const_int 0)
9936 (const_int 0) (const_int 0)])))]
9938 "vpmov<trunsuffix>qw\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9939 [(set_attr "type" "ssemov")
9940 (set_attr "prefix" "evex")
9941 (set_attr "mode" "TI")])
9943 (define_insn "avx512vl_<code>v2div2hi2_mask_store"
9944 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9948 (match_operand:V2DI 1 "register_operand" "v"))
9951 (parallel [(const_int 0) (const_int 1)]))
9952 (match_operand:QI 2 "register_operand" "Yk"))
9955 (parallel [(const_int 2) (const_int 3)
9956 (const_int 4) (const_int 5)
9957 (const_int 6) (const_int 7)]))))]
9959 "vpmov<trunsuffix>qw\t{%1, %0%{%2%}|%0%{%2%}, %g1}"
9960 [(set_attr "type" "ssemov")
9961 (set_attr "memory" "store")
9962 (set_attr "prefix" "evex")
9963 (set_attr "mode" "TI")])
9965 (define_insn "*avx512vl_<code>v2div2si2"
9966 [(set (match_operand:V4SI 0 "register_operand" "=v")
9969 (match_operand:V2DI 1 "register_operand" "v"))
9970 (match_operand:V2SI 2 "const0_operand")))]
9972 "vpmov<trunsuffix>qd\t{%1, %0|%0, %1}"
9973 [(set_attr "type" "ssemov")
9974 (set_attr "prefix" "evex")
9975 (set_attr "mode" "TI")])
9977 (define_insn "*avx512vl_<code>v2div2si2_store"
9978 [(set (match_operand:V4SI 0 "memory_operand" "=m")
9981 (match_operand:V2DI 1 "register_operand" "v"))
9984 (parallel [(const_int 2) (const_int 3)]))))]
9986 "vpmov<trunsuffix>qd\t{%1, %0|%0, %1}"
9987 [(set_attr "type" "ssemov")
9988 (set_attr "memory" "store")
9989 (set_attr "prefix" "evex")
9990 (set_attr "mode" "TI")])
9992 (define_insn "avx512vl_<code>v2div2si2_mask"
9993 [(set (match_operand:V4SI 0 "register_operand" "=v")
9997 (match_operand:V2DI 1 "register_operand" "v"))
9999 (match_operand:V4SI 2 "vector_move_operand" "0C")
10000 (parallel [(const_int 0) (const_int 1)]))
10001 (match_operand:QI 3 "register_operand" "Yk"))
10002 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
10004 "vpmov<trunsuffix>qd\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
10005 [(set_attr "type" "ssemov")
10006 (set_attr "prefix" "evex")
10007 (set_attr "mode" "TI")])
10009 (define_insn "*avx512vl_<code>v2div2si2_mask_1"
10010 [(set (match_operand:V4SI 0 "register_operand" "=v")
10014 (match_operand:V2DI 1 "register_operand" "v"))
10015 (const_vector:V2SI [(const_int 0) (const_int 0)])
10016 (match_operand:QI 2 "register_operand" "Yk"))
10017 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
10019 "vpmov<trunsuffix>qd\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
10020 [(set_attr "type" "ssemov")
10021 (set_attr "prefix" "evex")
10022 (set_attr "mode" "TI")])
10024 (define_insn "avx512vl_<code>v2div2si2_mask_store"
10025 [(set (match_operand:V4SI 0 "memory_operand" "=m")
10029 (match_operand:V2DI 1 "register_operand" "v"))
10032 (parallel [(const_int 0) (const_int 1)]))
10033 (match_operand:QI 2 "register_operand" "Yk"))
10036 (parallel [(const_int 2) (const_int 3)]))))]
10038 "vpmov<trunsuffix>qd\t{%1, %0%{%2%}|%0%{%2%}, %t1}"
10039 [(set_attr "type" "ssemov")
10040 (set_attr "memory" "store")
10041 (set_attr "prefix" "evex")
10042 (set_attr "mode" "TI")])
10044 (define_insn "*avx512f_<code>v8div16qi2"
10045 [(set (match_operand:V16QI 0 "register_operand" "=v")
10048 (match_operand:V8DI 1 "register_operand" "v"))
10049 (const_vector:V8QI [(const_int 0) (const_int 0)
10050 (const_int 0) (const_int 0)
10051 (const_int 0) (const_int 0)
10052 (const_int 0) (const_int 0)])))]
10054 "vpmov<trunsuffix>qb\t{%1, %0|%0, %1}"
10055 [(set_attr "type" "ssemov")
10056 (set_attr "prefix" "evex")
10057 (set_attr "mode" "TI")])
10059 (define_insn "*avx512f_<code>v8div16qi2_store"
10060 [(set (match_operand:V16QI 0 "memory_operand" "=m")
10063 (match_operand:V8DI 1 "register_operand" "v"))
10066 (parallel [(const_int 8) (const_int 9)
10067 (const_int 10) (const_int 11)
10068 (const_int 12) (const_int 13)
10069 (const_int 14) (const_int 15)]))))]
10071 "vpmov<trunsuffix>qb\t{%1, %0|%0, %1}"
10072 [(set_attr "type" "ssemov")
10073 (set_attr "memory" "store")
10074 (set_attr "prefix" "evex")
10075 (set_attr "mode" "TI")])
10077 (define_insn "avx512f_<code>v8div16qi2_mask"
10078 [(set (match_operand:V16QI 0 "register_operand" "=v")
10082 (match_operand:V8DI 1 "register_operand" "v"))
10084 (match_operand:V16QI 2 "vector_move_operand" "0C")
10085 (parallel [(const_int 0) (const_int 1)
10086 (const_int 2) (const_int 3)
10087 (const_int 4) (const_int 5)
10088 (const_int 6) (const_int 7)]))
10089 (match_operand:QI 3 "register_operand" "Yk"))
10090 (const_vector:V8QI [(const_int 0) (const_int 0)
10091 (const_int 0) (const_int 0)
10092 (const_int 0) (const_int 0)
10093 (const_int 0) (const_int 0)])))]
10095 "vpmov<trunsuffix>qb\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
10096 [(set_attr "type" "ssemov")
10097 (set_attr "prefix" "evex")
10098 (set_attr "mode" "TI")])
10100 (define_insn "*avx512f_<code>v8div16qi2_mask_1"
10101 [(set (match_operand:V16QI 0 "register_operand" "=v")
10105 (match_operand:V8DI 1 "register_operand" "v"))
10106 (const_vector:V8QI [(const_int 0) (const_int 0)
10107 (const_int 0) (const_int 0)
10108 (const_int 0) (const_int 0)
10109 (const_int 0) (const_int 0)])
10110 (match_operand:QI 2 "register_operand" "Yk"))
10111 (const_vector:V8QI [(const_int 0) (const_int 0)
10112 (const_int 0) (const_int 0)
10113 (const_int 0) (const_int 0)
10114 (const_int 0) (const_int 0)])))]
10116 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
10117 [(set_attr "type" "ssemov")
10118 (set_attr "prefix" "evex")
10119 (set_attr "mode" "TI")])
10121 (define_insn "avx512f_<code>v8div16qi2_mask_store"
10122 [(set (match_operand:V16QI 0 "memory_operand" "=m")
10126 (match_operand:V8DI 1 "register_operand" "v"))
10129 (parallel [(const_int 0) (const_int 1)
10130 (const_int 2) (const_int 3)
10131 (const_int 4) (const_int 5)
10132 (const_int 6) (const_int 7)]))
10133 (match_operand:QI 2 "register_operand" "Yk"))
10136 (parallel [(const_int 8) (const_int 9)
10137 (const_int 10) (const_int 11)
10138 (const_int 12) (const_int 13)
10139 (const_int 14) (const_int 15)]))))]
10141 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}|%q0%{%2%}, %1}"
10142 [(set_attr "type" "ssemov")
10143 (set_attr "memory" "store")
10144 (set_attr "prefix" "evex")
10145 (set_attr "mode" "TI")])
10147 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
10149 ;; Parallel integral arithmetic
10151 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
10153 (define_expand "neg<mode>2"
10154 [(set (match_operand:VI_AVX2 0 "register_operand")
10157 (match_operand:VI_AVX2 1 "vector_operand")))]
10159 "operands[2] = force_reg (<MODE>mode, CONST0_RTX (<MODE>mode));")
10161 (define_expand "<plusminus_insn><mode>3"
10162 [(set (match_operand:VI_AVX2 0 "register_operand")
10164 (match_operand:VI_AVX2 1 "vector_operand")
10165 (match_operand:VI_AVX2 2 "vector_operand")))]
10167 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
10169 (define_expand "<plusminus_insn><mode>3_mask"
10170 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
10171 (vec_merge:VI48_AVX512VL
10172 (plusminus:VI48_AVX512VL
10173 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand")
10174 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand"))
10175 (match_operand:VI48_AVX512VL 3 "vector_move_operand")
10176 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
10178 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
10180 (define_expand "<plusminus_insn><mode>3_mask"
10181 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
10182 (vec_merge:VI12_AVX512VL
10183 (plusminus:VI12_AVX512VL
10184 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand")
10185 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand"))
10186 (match_operand:VI12_AVX512VL 3 "vector_move_operand")
10187 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
10189 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
10191 (define_insn "*<plusminus_insn><mode>3"
10192 [(set (match_operand:VI_AVX2 0 "register_operand" "=x,v")
10194 (match_operand:VI_AVX2 1 "vector_operand" "<comm>0,v")
10195 (match_operand:VI_AVX2 2 "vector_operand" "xBm,vm")))]
10196 "TARGET_SSE2 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
10198 p<plusminus_mnemonic><ssemodesuffix>\t{%2, %0|%0, %2}
10199 vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
10200 [(set_attr "isa" "noavx,avx")
10201 (set_attr "type" "sseiadd")
10202 (set_attr "prefix_data16" "1,*")
10203 (set_attr "prefix" "orig,vex")
10204 (set_attr "mode" "<sseinsnmode>")])
10206 (define_insn "*<plusminus_insn><mode>3_mask"
10207 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
10208 (vec_merge:VI48_AVX512VL
10209 (plusminus:VI48_AVX512VL
10210 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "<comm>v")
10211 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm"))
10212 (match_operand:VI48_AVX512VL 3 "vector_move_operand" "0C")
10213 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
10214 "TARGET_AVX512F && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
10215 "vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
10216 [(set_attr "type" "sseiadd")
10217 (set_attr "prefix" "evex")
10218 (set_attr "mode" "<sseinsnmode>")])
10220 (define_insn "*<plusminus_insn><mode>3_mask"
10221 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
10222 (vec_merge:VI12_AVX512VL
10223 (plusminus:VI12_AVX512VL
10224 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "<comm>v")
10225 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm"))
10226 (match_operand:VI12_AVX512VL 3 "vector_move_operand" "0C")
10227 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
10228 "TARGET_AVX512BW && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
10229 "vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
10230 [(set_attr "type" "sseiadd")
10231 (set_attr "prefix" "evex")
10232 (set_attr "mode" "<sseinsnmode>")])
10234 (define_expand "<sse2_avx2>_<plusminus_insn><mode>3<mask_name>"
10235 [(set (match_operand:VI12_AVX2 0 "register_operand")
10236 (sat_plusminus:VI12_AVX2
10237 (match_operand:VI12_AVX2 1 "vector_operand")
10238 (match_operand:VI12_AVX2 2 "vector_operand")))]
10239 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10240 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
10242 (define_insn "*<sse2_avx2>_<plusminus_insn><mode>3<mask_name>"
10243 [(set (match_operand:VI12_AVX2 0 "register_operand" "=x,v")
10244 (sat_plusminus:VI12_AVX2
10245 (match_operand:VI12_AVX2 1 "vector_operand" "<comm>0,v")
10246 (match_operand:VI12_AVX2 2 "vector_operand" "xBm,vm")))]
10247 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>
10248 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
10250 p<plusminus_mnemonic><ssemodesuffix>\t{%2, %0|%0, %2}
10251 vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10252 [(set_attr "isa" "noavx,avx")
10253 (set_attr "type" "sseiadd")
10254 (set_attr "prefix_data16" "1,*")
10255 (set_attr "prefix" "orig,maybe_evex")
10256 (set_attr "mode" "TI")])
10258 (define_expand "mul<mode>3<mask_name>"
10259 [(set (match_operand:VI1_AVX512 0 "register_operand")
10260 (mult:VI1_AVX512 (match_operand:VI1_AVX512 1 "register_operand")
10261 (match_operand:VI1_AVX512 2 "register_operand")))]
10262 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10264 ix86_expand_vecop_qihi (MULT, operands[0], operands[1], operands[2]);
10268 (define_expand "mul<mode>3<mask_name>"
10269 [(set (match_operand:VI2_AVX2 0 "register_operand")
10270 (mult:VI2_AVX2 (match_operand:VI2_AVX2 1 "vector_operand")
10271 (match_operand:VI2_AVX2 2 "vector_operand")))]
10272 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10273 "ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);")
10275 (define_insn "*mul<mode>3<mask_name>"
10276 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,v")
10277 (mult:VI2_AVX2 (match_operand:VI2_AVX2 1 "vector_operand" "%0,v")
10278 (match_operand:VI2_AVX2 2 "vector_operand" "xBm,vm")))]
10279 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
10280 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10282 pmullw\t{%2, %0|%0, %2}
10283 vpmullw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10284 [(set_attr "isa" "noavx,avx")
10285 (set_attr "type" "sseimul")
10286 (set_attr "prefix_data16" "1,*")
10287 (set_attr "prefix" "orig,vex")
10288 (set_attr "mode" "<sseinsnmode>")])
10290 (define_expand "<s>mul<mode>3_highpart<mask_name>"
10291 [(set (match_operand:VI2_AVX2 0 "register_operand")
10293 (lshiftrt:<ssedoublemode>
10294 (mult:<ssedoublemode>
10295 (any_extend:<ssedoublemode>
10296 (match_operand:VI2_AVX2 1 "vector_operand"))
10297 (any_extend:<ssedoublemode>
10298 (match_operand:VI2_AVX2 2 "vector_operand")))
10301 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10302 "ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);")
10304 (define_insn "*<s>mul<mode>3_highpart<mask_name>"
10305 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,v")
10307 (lshiftrt:<ssedoublemode>
10308 (mult:<ssedoublemode>
10309 (any_extend:<ssedoublemode>
10310 (match_operand:VI2_AVX2 1 "vector_operand" "%0,v"))
10311 (any_extend:<ssedoublemode>
10312 (match_operand:VI2_AVX2 2 "vector_operand" "xBm,vm")))
10314 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
10315 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10317 pmulh<u>w\t{%2, %0|%0, %2}
10318 vpmulh<u>w\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10319 [(set_attr "isa" "noavx,avx")
10320 (set_attr "type" "sseimul")
10321 (set_attr "prefix_data16" "1,*")
10322 (set_attr "prefix" "orig,vex")
10323 (set_attr "mode" "<sseinsnmode>")])
10325 (define_expand "vec_widen_umult_even_v16si<mask_name>"
10326 [(set (match_operand:V8DI 0 "register_operand")
10330 (match_operand:V16SI 1 "nonimmediate_operand")
10331 (parallel [(const_int 0) (const_int 2)
10332 (const_int 4) (const_int 6)
10333 (const_int 8) (const_int 10)
10334 (const_int 12) (const_int 14)])))
10337 (match_operand:V16SI 2 "nonimmediate_operand")
10338 (parallel [(const_int 0) (const_int 2)
10339 (const_int 4) (const_int 6)
10340 (const_int 8) (const_int 10)
10341 (const_int 12) (const_int 14)])))))]
10343 "ix86_fixup_binary_operands_no_copy (MULT, V16SImode, operands);")
10345 (define_insn "*vec_widen_umult_even_v16si<mask_name>"
10346 [(set (match_operand:V8DI 0 "register_operand" "=v")
10350 (match_operand:V16SI 1 "nonimmediate_operand" "%v")
10351 (parallel [(const_int 0) (const_int 2)
10352 (const_int 4) (const_int 6)
10353 (const_int 8) (const_int 10)
10354 (const_int 12) (const_int 14)])))
10357 (match_operand:V16SI 2 "nonimmediate_operand" "vm")
10358 (parallel [(const_int 0) (const_int 2)
10359 (const_int 4) (const_int 6)
10360 (const_int 8) (const_int 10)
10361 (const_int 12) (const_int 14)])))))]
10362 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10363 "vpmuludq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10364 [(set_attr "type" "sseimul")
10365 (set_attr "prefix_extra" "1")
10366 (set_attr "prefix" "evex")
10367 (set_attr "mode" "XI")])
10369 (define_expand "vec_widen_umult_even_v8si<mask_name>"
10370 [(set (match_operand:V4DI 0 "register_operand")
10374 (match_operand:V8SI 1 "nonimmediate_operand")
10375 (parallel [(const_int 0) (const_int 2)
10376 (const_int 4) (const_int 6)])))
10379 (match_operand:V8SI 2 "nonimmediate_operand")
10380 (parallel [(const_int 0) (const_int 2)
10381 (const_int 4) (const_int 6)])))))]
10382 "TARGET_AVX2 && <mask_avx512vl_condition>"
10383 "ix86_fixup_binary_operands_no_copy (MULT, V8SImode, operands);")
10385 (define_insn "*vec_widen_umult_even_v8si<mask_name>"
10386 [(set (match_operand:V4DI 0 "register_operand" "=v")
10390 (match_operand:V8SI 1 "nonimmediate_operand" "%v")
10391 (parallel [(const_int 0) (const_int 2)
10392 (const_int 4) (const_int 6)])))
10395 (match_operand:V8SI 2 "nonimmediate_operand" "vm")
10396 (parallel [(const_int 0) (const_int 2)
10397 (const_int 4) (const_int 6)])))))]
10398 "TARGET_AVX2 && <mask_avx512vl_condition>
10399 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10400 "vpmuludq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10401 [(set_attr "type" "sseimul")
10402 (set_attr "prefix" "maybe_evex")
10403 (set_attr "mode" "OI")])
10405 (define_expand "vec_widen_umult_even_v4si<mask_name>"
10406 [(set (match_operand:V2DI 0 "register_operand")
10410 (match_operand:V4SI 1 "vector_operand")
10411 (parallel [(const_int 0) (const_int 2)])))
10414 (match_operand:V4SI 2 "vector_operand")
10415 (parallel [(const_int 0) (const_int 2)])))))]
10416 "TARGET_SSE2 && <mask_avx512vl_condition>"
10417 "ix86_fixup_binary_operands_no_copy (MULT, V4SImode, operands);")
10419 (define_insn "*vec_widen_umult_even_v4si<mask_name>"
10420 [(set (match_operand:V2DI 0 "register_operand" "=x,v")
10424 (match_operand:V4SI 1 "vector_operand" "%0,v")
10425 (parallel [(const_int 0) (const_int 2)])))
10428 (match_operand:V4SI 2 "vector_operand" "xBm,vm")
10429 (parallel [(const_int 0) (const_int 2)])))))]
10430 "TARGET_SSE2 && <mask_avx512vl_condition>
10431 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10433 pmuludq\t{%2, %0|%0, %2}
10434 vpmuludq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10435 [(set_attr "isa" "noavx,avx")
10436 (set_attr "type" "sseimul")
10437 (set_attr "prefix_data16" "1,*")
10438 (set_attr "prefix" "orig,maybe_evex")
10439 (set_attr "mode" "TI")])
10441 (define_expand "vec_widen_smult_even_v16si<mask_name>"
10442 [(set (match_operand:V8DI 0 "register_operand")
10446 (match_operand:V16SI 1 "nonimmediate_operand")
10447 (parallel [(const_int 0) (const_int 2)
10448 (const_int 4) (const_int 6)
10449 (const_int 8) (const_int 10)
10450 (const_int 12) (const_int 14)])))
10453 (match_operand:V16SI 2 "nonimmediate_operand")
10454 (parallel [(const_int 0) (const_int 2)
10455 (const_int 4) (const_int 6)
10456 (const_int 8) (const_int 10)
10457 (const_int 12) (const_int 14)])))))]
10459 "ix86_fixup_binary_operands_no_copy (MULT, V16SImode, operands);")
10461 (define_insn "*vec_widen_smult_even_v16si<mask_name>"
10462 [(set (match_operand:V8DI 0 "register_operand" "=v")
10466 (match_operand:V16SI 1 "nonimmediate_operand" "%v")
10467 (parallel [(const_int 0) (const_int 2)
10468 (const_int 4) (const_int 6)
10469 (const_int 8) (const_int 10)
10470 (const_int 12) (const_int 14)])))
10473 (match_operand:V16SI 2 "nonimmediate_operand" "vm")
10474 (parallel [(const_int 0) (const_int 2)
10475 (const_int 4) (const_int 6)
10476 (const_int 8) (const_int 10)
10477 (const_int 12) (const_int 14)])))))]
10478 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10479 "vpmuldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10480 [(set_attr "type" "sseimul")
10481 (set_attr "prefix_extra" "1")
10482 (set_attr "prefix" "evex")
10483 (set_attr "mode" "XI")])
10485 (define_expand "vec_widen_smult_even_v8si<mask_name>"
10486 [(set (match_operand:V4DI 0 "register_operand")
10490 (match_operand:V8SI 1 "nonimmediate_operand")
10491 (parallel [(const_int 0) (const_int 2)
10492 (const_int 4) (const_int 6)])))
10495 (match_operand:V8SI 2 "nonimmediate_operand")
10496 (parallel [(const_int 0) (const_int 2)
10497 (const_int 4) (const_int 6)])))))]
10498 "TARGET_AVX2 && <mask_avx512vl_condition>"
10499 "ix86_fixup_binary_operands_no_copy (MULT, V8SImode, operands);")
10501 (define_insn "*vec_widen_smult_even_v8si<mask_name>"
10502 [(set (match_operand:V4DI 0 "register_operand" "=v")
10506 (match_operand:V8SI 1 "nonimmediate_operand" "%v")
10507 (parallel [(const_int 0) (const_int 2)
10508 (const_int 4) (const_int 6)])))
10511 (match_operand:V8SI 2 "nonimmediate_operand" "vm")
10512 (parallel [(const_int 0) (const_int 2)
10513 (const_int 4) (const_int 6)])))))]
10514 "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10515 "vpmuldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10516 [(set_attr "type" "sseimul")
10517 (set_attr "prefix_extra" "1")
10518 (set_attr "prefix" "vex")
10519 (set_attr "mode" "OI")])
10521 (define_expand "sse4_1_mulv2siv2di3<mask_name>"
10522 [(set (match_operand:V2DI 0 "register_operand")
10526 (match_operand:V4SI 1 "vector_operand")
10527 (parallel [(const_int 0) (const_int 2)])))
10530 (match_operand:V4SI 2 "vector_operand")
10531 (parallel [(const_int 0) (const_int 2)])))))]
10532 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
10533 "ix86_fixup_binary_operands_no_copy (MULT, V4SImode, operands);")
10535 (define_insn "*sse4_1_mulv2siv2di3<mask_name>"
10536 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
10540 (match_operand:V4SI 1 "vector_operand" "%0,0,v")
10541 (parallel [(const_int 0) (const_int 2)])))
10544 (match_operand:V4SI 2 "vector_operand" "YrBm,*xBm,vm")
10545 (parallel [(const_int 0) (const_int 2)])))))]
10546 "TARGET_SSE4_1 && <mask_avx512vl_condition>
10547 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10549 pmuldq\t{%2, %0|%0, %2}
10550 pmuldq\t{%2, %0|%0, %2}
10551 vpmuldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10552 [(set_attr "isa" "noavx,noavx,avx")
10553 (set_attr "type" "sseimul")
10554 (set_attr "prefix_data16" "1,1,*")
10555 (set_attr "prefix_extra" "1")
10556 (set_attr "prefix" "orig,orig,vex")
10557 (set_attr "mode" "TI")])
10559 (define_insn "avx512bw_pmaddwd512<mode><mask_name>"
10560 [(set (match_operand:<sseunpackmode> 0 "register_operand" "=v")
10561 (unspec:<sseunpackmode>
10562 [(match_operand:VI2_AVX2 1 "register_operand" "v")
10563 (match_operand:VI2_AVX2 2 "nonimmediate_operand" "vm")]
10564 UNSPEC_PMADDWD512))]
10565 "TARGET_AVX512BW && <mask_mode512bit_condition>"
10566 "vpmaddwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}";
10567 [(set_attr "type" "sseiadd")
10568 (set_attr "prefix" "evex")
10569 (set_attr "mode" "XI")])
10571 (define_expand "avx2_pmaddwd"
10572 [(set (match_operand:V8SI 0 "register_operand")
10577 (match_operand:V16HI 1 "nonimmediate_operand")
10578 (parallel [(const_int 0) (const_int 2)
10579 (const_int 4) (const_int 6)
10580 (const_int 8) (const_int 10)
10581 (const_int 12) (const_int 14)])))
10584 (match_operand:V16HI 2 "nonimmediate_operand")
10585 (parallel [(const_int 0) (const_int 2)
10586 (const_int 4) (const_int 6)
10587 (const_int 8) (const_int 10)
10588 (const_int 12) (const_int 14)]))))
10591 (vec_select:V8HI (match_dup 1)
10592 (parallel [(const_int 1) (const_int 3)
10593 (const_int 5) (const_int 7)
10594 (const_int 9) (const_int 11)
10595 (const_int 13) (const_int 15)])))
10597 (vec_select:V8HI (match_dup 2)
10598 (parallel [(const_int 1) (const_int 3)
10599 (const_int 5) (const_int 7)
10600 (const_int 9) (const_int 11)
10601 (const_int 13) (const_int 15)]))))))]
10603 "ix86_fixup_binary_operands_no_copy (MULT, V16HImode, operands);")
10605 (define_insn "*avx2_pmaddwd"
10606 [(set (match_operand:V8SI 0 "register_operand" "=x,v")
10611 (match_operand:V16HI 1 "nonimmediate_operand" "%x,v")
10612 (parallel [(const_int 0) (const_int 2)
10613 (const_int 4) (const_int 6)
10614 (const_int 8) (const_int 10)
10615 (const_int 12) (const_int 14)])))
10618 (match_operand:V16HI 2 "nonimmediate_operand" "xm,vm")
10619 (parallel [(const_int 0) (const_int 2)
10620 (const_int 4) (const_int 6)
10621 (const_int 8) (const_int 10)
10622 (const_int 12) (const_int 14)]))))
10625 (vec_select:V8HI (match_dup 1)
10626 (parallel [(const_int 1) (const_int 3)
10627 (const_int 5) (const_int 7)
10628 (const_int 9) (const_int 11)
10629 (const_int 13) (const_int 15)])))
10631 (vec_select:V8HI (match_dup 2)
10632 (parallel [(const_int 1) (const_int 3)
10633 (const_int 5) (const_int 7)
10634 (const_int 9) (const_int 11)
10635 (const_int 13) (const_int 15)]))))))]
10636 "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10637 "vpmaddwd\t{%2, %1, %0|%0, %1, %2}"
10638 [(set_attr "type" "sseiadd")
10639 (set_attr "isa" "*,avx512bw")
10640 (set_attr "prefix" "vex,evex")
10641 (set_attr "mode" "OI")])
10643 (define_expand "sse2_pmaddwd"
10644 [(set (match_operand:V4SI 0 "register_operand")
10649 (match_operand:V8HI 1 "vector_operand")
10650 (parallel [(const_int 0) (const_int 2)
10651 (const_int 4) (const_int 6)])))
10654 (match_operand:V8HI 2 "vector_operand")
10655 (parallel [(const_int 0) (const_int 2)
10656 (const_int 4) (const_int 6)]))))
10659 (vec_select:V4HI (match_dup 1)
10660 (parallel [(const_int 1) (const_int 3)
10661 (const_int 5) (const_int 7)])))
10663 (vec_select:V4HI (match_dup 2)
10664 (parallel [(const_int 1) (const_int 3)
10665 (const_int 5) (const_int 7)]))))))]
10667 "ix86_fixup_binary_operands_no_copy (MULT, V8HImode, operands);")
10669 (define_insn "*sse2_pmaddwd"
10670 [(set (match_operand:V4SI 0 "register_operand" "=x,x,v")
10675 (match_operand:V8HI 1 "vector_operand" "%0,x,v")
10676 (parallel [(const_int 0) (const_int 2)
10677 (const_int 4) (const_int 6)])))
10680 (match_operand:V8HI 2 "vector_operand" "xBm,xm,vm")
10681 (parallel [(const_int 0) (const_int 2)
10682 (const_int 4) (const_int 6)]))))
10685 (vec_select:V4HI (match_dup 1)
10686 (parallel [(const_int 1) (const_int 3)
10687 (const_int 5) (const_int 7)])))
10689 (vec_select:V4HI (match_dup 2)
10690 (parallel [(const_int 1) (const_int 3)
10691 (const_int 5) (const_int 7)]))))))]
10692 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10694 pmaddwd\t{%2, %0|%0, %2}
10695 vpmaddwd\t{%2, %1, %0|%0, %1, %2}
10696 vpmaddwd\t{%2, %1, %0|%0, %1, %2}"
10697 [(set_attr "isa" "noavx,avx,avx512bw")
10698 (set_attr "type" "sseiadd")
10699 (set_attr "atom_unit" "simul")
10700 (set_attr "prefix_data16" "1,*,*")
10701 (set_attr "prefix" "orig,vex,evex")
10702 (set_attr "mode" "TI")])
10704 (define_insn "avx512dq_mul<mode>3<mask_name>"
10705 [(set (match_operand:VI8 0 "register_operand" "=v")
10707 (match_operand:VI8 1 "register_operand" "v")
10708 (match_operand:VI8 2 "nonimmediate_operand" "vm")))]
10709 "TARGET_AVX512DQ && <mask_mode512bit_condition>"
10710 "vpmullq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10711 [(set_attr "type" "sseimul")
10712 (set_attr "prefix" "evex")
10713 (set_attr "mode" "<sseinsnmode>")])
10715 (define_expand "mul<mode>3<mask_name>"
10716 [(set (match_operand:VI4_AVX512F 0 "register_operand")
10718 (match_operand:VI4_AVX512F 1 "general_vector_operand")
10719 (match_operand:VI4_AVX512F 2 "general_vector_operand")))]
10720 "TARGET_SSE2 && <mask_mode512bit_condition>"
10724 if (!vector_operand (operands[1], <MODE>mode))
10725 operands[1] = force_reg (<MODE>mode, operands[1]);
10726 if (!vector_operand (operands[2], <MODE>mode))
10727 operands[2] = force_reg (<MODE>mode, operands[2]);
10728 ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);
10732 ix86_expand_sse2_mulv4si3 (operands[0], operands[1], operands[2]);
10737 (define_insn "*<sse4_1_avx2>_mul<mode>3<mask_name>"
10738 [(set (match_operand:VI4_AVX512F 0 "register_operand" "=Yr,*x,v")
10740 (match_operand:VI4_AVX512F 1 "vector_operand" "%0,0,v")
10741 (match_operand:VI4_AVX512F 2 "vector_operand" "YrBm,*xBm,vm")))]
10742 "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
10743 && <mask_mode512bit_condition>"
10745 pmulld\t{%2, %0|%0, %2}
10746 pmulld\t{%2, %0|%0, %2}
10747 vpmulld\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10748 [(set_attr "isa" "noavx,noavx,avx")
10749 (set_attr "type" "sseimul")
10750 (set_attr "prefix_extra" "1")
10751 (set_attr "prefix" "<mask_prefix4>")
10752 (set_attr "btver2_decode" "vector,vector,vector")
10753 (set_attr "mode" "<sseinsnmode>")])
10755 (define_expand "mul<mode>3"
10756 [(set (match_operand:VI8_AVX2_AVX512F 0 "register_operand")
10757 (mult:VI8_AVX2_AVX512F
10758 (match_operand:VI8_AVX2_AVX512F 1 "register_operand")
10759 (match_operand:VI8_AVX2_AVX512F 2 "register_operand")))]
10762 ix86_expand_sse2_mulvxdi3 (operands[0], operands[1], operands[2]);
10766 (define_expand "vec_widen_<s>mult_hi_<mode>"
10767 [(match_operand:<sseunpackmode> 0 "register_operand")
10768 (any_extend:<sseunpackmode>
10769 (match_operand:VI124_AVX2 1 "register_operand"))
10770 (match_operand:VI124_AVX2 2 "register_operand")]
10773 ix86_expand_mul_widen_hilo (operands[0], operands[1], operands[2],
10778 (define_expand "vec_widen_<s>mult_lo_<mode>"
10779 [(match_operand:<sseunpackmode> 0 "register_operand")
10780 (any_extend:<sseunpackmode>
10781 (match_operand:VI124_AVX2 1 "register_operand"))
10782 (match_operand:VI124_AVX2 2 "register_operand")]
10785 ix86_expand_mul_widen_hilo (operands[0], operands[1], operands[2],
10790 ;; Most widen_<s>mult_even_<mode> can be handled directly from other
10791 ;; named patterns, but signed V4SI needs special help for plain SSE2.
10792 (define_expand "vec_widen_smult_even_v4si"
10793 [(match_operand:V2DI 0 "register_operand")
10794 (match_operand:V4SI 1 "vector_operand")
10795 (match_operand:V4SI 2 "vector_operand")]
10798 ix86_expand_mul_widen_evenodd (operands[0], operands[1], operands[2],
10803 (define_expand "vec_widen_<s>mult_odd_<mode>"
10804 [(match_operand:<sseunpackmode> 0 "register_operand")
10805 (any_extend:<sseunpackmode>
10806 (match_operand:VI4_AVX512F 1 "general_vector_operand"))
10807 (match_operand:VI4_AVX512F 2 "general_vector_operand")]
10810 ix86_expand_mul_widen_evenodd (operands[0], operands[1], operands[2],
10815 (define_mode_attr SDOT_PMADD_SUF
10816 [(V32HI "512v32hi") (V16HI "") (V8HI "")])
10818 (define_expand "sdot_prod<mode>"
10819 [(match_operand:<sseunpackmode> 0 "register_operand")
10820 (match_operand:VI2_AVX2 1 "register_operand")
10821 (match_operand:VI2_AVX2 2 "register_operand")
10822 (match_operand:<sseunpackmode> 3 "register_operand")]
10825 rtx t = gen_reg_rtx (<sseunpackmode>mode);
10826 emit_insn (gen_<sse2_avx2>_pmaddwd<SDOT_PMADD_SUF> (t, operands[1], operands[2]));
10827 emit_insn (gen_rtx_SET (operands[0],
10828 gen_rtx_PLUS (<sseunpackmode>mode,
10833 ;; Normally we use widen_mul_even/odd, but combine can't quite get it all
10834 ;; back together when madd is available.
10835 (define_expand "sdot_prodv4si"
10836 [(match_operand:V2DI 0 "register_operand")
10837 (match_operand:V4SI 1 "register_operand")
10838 (match_operand:V4SI 2 "register_operand")
10839 (match_operand:V2DI 3 "register_operand")]
10842 rtx t = gen_reg_rtx (V2DImode);
10843 emit_insn (gen_xop_pmacsdqh (t, operands[1], operands[2], operands[3]));
10844 emit_insn (gen_xop_pmacsdql (operands[0], operands[1], operands[2], t));
10848 (define_expand "usadv16qi"
10849 [(match_operand:V4SI 0 "register_operand")
10850 (match_operand:V16QI 1 "register_operand")
10851 (match_operand:V16QI 2 "vector_operand")
10852 (match_operand:V4SI 3 "vector_operand")]
10855 rtx t1 = gen_reg_rtx (V2DImode);
10856 rtx t2 = gen_reg_rtx (V4SImode);
10857 emit_insn (gen_sse2_psadbw (t1, operands[1], operands[2]));
10858 convert_move (t2, t1, 0);
10859 emit_insn (gen_addv4si3 (operands[0], t2, operands[3]));
10863 (define_expand "usadv32qi"
10864 [(match_operand:V8SI 0 "register_operand")
10865 (match_operand:V32QI 1 "register_operand")
10866 (match_operand:V32QI 2 "nonimmediate_operand")
10867 (match_operand:V8SI 3 "nonimmediate_operand")]
10870 rtx t1 = gen_reg_rtx (V4DImode);
10871 rtx t2 = gen_reg_rtx (V8SImode);
10872 emit_insn (gen_avx2_psadbw (t1, operands[1], operands[2]));
10873 convert_move (t2, t1, 0);
10874 emit_insn (gen_addv8si3 (operands[0], t2, operands[3]));
10878 (define_insn "<mask_codefor>ashr<mode>3<mask_name>"
10879 [(set (match_operand:VI248_AVX512BW_1 0 "register_operand" "=v,v")
10880 (ashiftrt:VI248_AVX512BW_1
10881 (match_operand:VI248_AVX512BW_1 1 "nonimmediate_operand" "v,vm")
10882 (match_operand:DI 2 "nonmemory_operand" "v,N")))]
10884 "vpsra<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10885 [(set_attr "type" "sseishft")
10886 (set (attr "length_immediate")
10887 (if_then_else (match_operand 2 "const_int_operand")
10889 (const_string "0")))
10890 (set_attr "mode" "<sseinsnmode>")])
10892 (define_insn "ashr<mode>3"
10893 [(set (match_operand:VI24_AVX2 0 "register_operand" "=x,x")
10894 (ashiftrt:VI24_AVX2
10895 (match_operand:VI24_AVX2 1 "register_operand" "0,x")
10896 (match_operand:DI 2 "nonmemory_operand" "xN,xN")))]
10899 psra<ssemodesuffix>\t{%2, %0|%0, %2}
10900 vpsra<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
10901 [(set_attr "isa" "noavx,avx")
10902 (set_attr "type" "sseishft")
10903 (set (attr "length_immediate")
10904 (if_then_else (match_operand 2 "const_int_operand")
10906 (const_string "0")))
10907 (set_attr "prefix_data16" "1,*")
10908 (set_attr "prefix" "orig,vex")
10909 (set_attr "mode" "<sseinsnmode>")])
10911 (define_insn "ashr<mode>3<mask_name>"
10912 [(set (match_operand:VI248_AVX512BW_AVX512VL 0 "register_operand" "=v,v")
10913 (ashiftrt:VI248_AVX512BW_AVX512VL
10914 (match_operand:VI248_AVX512BW_AVX512VL 1 "nonimmediate_operand" "v,vm")
10915 (match_operand:DI 2 "nonmemory_operand" "v,N")))]
10917 "vpsra<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10918 [(set_attr "type" "sseishft")
10919 (set (attr "length_immediate")
10920 (if_then_else (match_operand 2 "const_int_operand")
10922 (const_string "0")))
10923 (set_attr "mode" "<sseinsnmode>")])
10925 (define_insn "<mask_codefor><shift_insn><mode>3<mask_name>"
10926 [(set (match_operand:VI248_AVX512BW_2 0 "register_operand" "=v,v")
10927 (any_lshift:VI248_AVX512BW_2
10928 (match_operand:VI248_AVX512BW_2 1 "nonimmediate_operand" "v,vm")
10929 (match_operand:DI 2 "nonmemory_operand" "v,N")))]
10931 "vp<vshift><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10932 [(set_attr "type" "sseishft")
10933 (set (attr "length_immediate")
10934 (if_then_else (match_operand 2 "const_int_operand")
10936 (const_string "0")))
10937 (set_attr "mode" "<sseinsnmode>")])
10939 (define_insn "<shift_insn><mode>3"
10940 [(set (match_operand:VI248_AVX2 0 "register_operand" "=x,x")
10941 (any_lshift:VI248_AVX2
10942 (match_operand:VI248_AVX2 1 "register_operand" "0,x")
10943 (match_operand:DI 2 "nonmemory_operand" "xN,xN")))]
10946 p<vshift><ssemodesuffix>\t{%2, %0|%0, %2}
10947 vp<vshift><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
10948 [(set_attr "isa" "noavx,avx")
10949 (set_attr "type" "sseishft")
10950 (set (attr "length_immediate")
10951 (if_then_else (match_operand 2 "const_int_operand")
10953 (const_string "0")))
10954 (set_attr "prefix_data16" "1,*")
10955 (set_attr "prefix" "orig,vex")
10956 (set_attr "mode" "<sseinsnmode>")])
10958 (define_insn "<shift_insn><mode>3<mask_name>"
10959 [(set (match_operand:VI248_AVX512BW 0 "register_operand" "=v,v")
10960 (any_lshift:VI248_AVX512BW
10961 (match_operand:VI248_AVX512BW 1 "nonimmediate_operand" "v,m")
10962 (match_operand:DI 2 "nonmemory_operand" "vN,N")))]
10964 "vp<vshift><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10965 [(set_attr "type" "sseishft")
10966 (set (attr "length_immediate")
10967 (if_then_else (match_operand 2 "const_int_operand")
10969 (const_string "0")))
10970 (set_attr "mode" "<sseinsnmode>")])
10973 (define_expand "vec_shr_<mode>"
10974 [(set (match_dup 3)
10976 (match_operand:VI_128 1 "register_operand")
10977 (match_operand:SI 2 "const_0_to_255_mul_8_operand")))
10978 (set (match_operand:VI_128 0 "register_operand") (match_dup 4))]
10981 operands[1] = gen_lowpart (V1TImode, operands[1]);
10982 operands[3] = gen_reg_rtx (V1TImode);
10983 operands[4] = gen_lowpart (<MODE>mode, operands[3]);
10986 (define_insn "avx512bw_<shift_insn><mode>3"
10987 [(set (match_operand:VIMAX_AVX512VL 0 "register_operand" "=v")
10988 (any_lshift:VIMAX_AVX512VL
10989 (match_operand:VIMAX_AVX512VL 1 "nonimmediate_operand" "vm")
10990 (match_operand:SI 2 "const_0_to_255_mul_8_operand" "n")))]
10993 operands[2] = GEN_INT (INTVAL (operands[2]) / 8);
10994 return "vp<vshift>dq\t{%2, %1, %0|%0, %1, %2}";
10996 [(set_attr "type" "sseishft")
10997 (set_attr "length_immediate" "1")
10998 (set_attr "prefix" "maybe_evex")
10999 (set_attr "mode" "<sseinsnmode>")])
11001 (define_insn "<sse2_avx2>_<shift_insn><mode>3"
11002 [(set (match_operand:VIMAX_AVX2 0 "register_operand" "=x,v")
11003 (any_lshift:VIMAX_AVX2
11004 (match_operand:VIMAX_AVX2 1 "register_operand" "0,v")
11005 (match_operand:SI 2 "const_0_to_255_mul_8_operand" "n,n")))]
11008 operands[2] = GEN_INT (INTVAL (operands[2]) / 8);
11010 switch (which_alternative)
11013 return "p<vshift>dq\t{%2, %0|%0, %2}";
11015 return "vp<vshift>dq\t{%2, %1, %0|%0, %1, %2}";
11017 gcc_unreachable ();
11020 [(set_attr "isa" "noavx,avx")
11021 (set_attr "type" "sseishft")
11022 (set_attr "length_immediate" "1")
11023 (set_attr "atom_unit" "sishuf")
11024 (set_attr "prefix_data16" "1,*")
11025 (set_attr "prefix" "orig,vex")
11026 (set_attr "mode" "<sseinsnmode>")])
11028 (define_insn "<avx512>_<rotate>v<mode><mask_name>"
11029 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
11030 (any_rotate:VI48_AVX512VL
11031 (match_operand:VI48_AVX512VL 1 "register_operand" "v")
11032 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")))]
11034 "vp<rotate>v<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11035 [(set_attr "prefix" "evex")
11036 (set_attr "mode" "<sseinsnmode>")])
11038 (define_insn "<avx512>_<rotate><mode><mask_name>"
11039 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
11040 (any_rotate:VI48_AVX512VL
11041 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm")
11042 (match_operand:SI 2 "const_0_to_255_operand")))]
11044 "vp<rotate><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11045 [(set_attr "prefix" "evex")
11046 (set_attr "mode" "<sseinsnmode>")])
11048 (define_expand "<code><mode>3"
11049 [(set (match_operand:VI124_256_AVX512F_AVX512BW 0 "register_operand")
11050 (maxmin:VI124_256_AVX512F_AVX512BW
11051 (match_operand:VI124_256_AVX512F_AVX512BW 1 "nonimmediate_operand")
11052 (match_operand:VI124_256_AVX512F_AVX512BW 2 "nonimmediate_operand")))]
11054 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
11056 (define_insn "*avx2_<code><mode>3"
11057 [(set (match_operand:VI124_256 0 "register_operand" "=v")
11059 (match_operand:VI124_256 1 "nonimmediate_operand" "%v")
11060 (match_operand:VI124_256 2 "nonimmediate_operand" "vm")))]
11061 "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11062 "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11063 [(set_attr "type" "sseiadd")
11064 (set_attr "prefix_extra" "1")
11065 (set_attr "prefix" "vex")
11066 (set_attr "mode" "OI")])
11068 (define_expand "<code><mode>3_mask"
11069 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
11070 (vec_merge:VI48_AVX512VL
11071 (maxmin:VI48_AVX512VL
11072 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand")
11073 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand"))
11074 (match_operand:VI48_AVX512VL 3 "vector_move_operand")
11075 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
11077 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
11079 (define_insn "*avx512f_<code><mode>3<mask_name>"
11080 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
11081 (maxmin:VI48_AVX512VL
11082 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "%v")
11083 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")))]
11084 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11085 "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11086 [(set_attr "type" "sseiadd")
11087 (set_attr "prefix_extra" "1")
11088 (set_attr "prefix" "maybe_evex")
11089 (set_attr "mode" "<sseinsnmode>")])
11091 (define_insn "<mask_codefor><code><mode>3<mask_name>"
11092 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
11093 (maxmin:VI12_AVX512VL
11094 (match_operand:VI12_AVX512VL 1 "register_operand" "v")
11095 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")))]
11097 "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11098 [(set_attr "type" "sseiadd")
11099 (set_attr "prefix" "evex")
11100 (set_attr "mode" "<sseinsnmode>")])
11102 (define_expand "<code><mode>3"
11103 [(set (match_operand:VI8_AVX2_AVX512F 0 "register_operand")
11104 (maxmin:VI8_AVX2_AVX512F
11105 (match_operand:VI8_AVX2_AVX512F 1 "register_operand")
11106 (match_operand:VI8_AVX2_AVX512F 2 "register_operand")))]
11110 && (<MODE>mode == V8DImode || TARGET_AVX512VL))
11111 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
11114 enum rtx_code code;
11119 xops[0] = operands[0];
11121 if (<CODE> == SMAX || <CODE> == UMAX)
11123 xops[1] = operands[1];
11124 xops[2] = operands[2];
11128 xops[1] = operands[2];
11129 xops[2] = operands[1];
11132 code = (<CODE> == UMAX || <CODE> == UMIN) ? GTU : GT;
11134 xops[3] = gen_rtx_fmt_ee (code, VOIDmode, operands[1], operands[2]);
11135 xops[4] = operands[1];
11136 xops[5] = operands[2];
11138 ok = ix86_expand_int_vcond (xops);
11144 (define_expand "<code><mode>3"
11145 [(set (match_operand:VI124_128 0 "register_operand")
11147 (match_operand:VI124_128 1 "vector_operand")
11148 (match_operand:VI124_128 2 "vector_operand")))]
11151 if (TARGET_SSE4_1 || <MODE>mode == V8HImode)
11152 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
11158 xops[0] = operands[0];
11159 operands[1] = force_reg (<MODE>mode, operands[1]);
11160 operands[2] = force_reg (<MODE>mode, operands[2]);
11162 if (<CODE> == SMAX)
11164 xops[1] = operands[1];
11165 xops[2] = operands[2];
11169 xops[1] = operands[2];
11170 xops[2] = operands[1];
11173 xops[3] = gen_rtx_GT (VOIDmode, operands[1], operands[2]);
11174 xops[4] = operands[1];
11175 xops[5] = operands[2];
11177 ok = ix86_expand_int_vcond (xops);
11183 (define_insn "*sse4_1_<code><mode>3<mask_name>"
11184 [(set (match_operand:VI14_128 0 "register_operand" "=Yr,*x,v")
11186 (match_operand:VI14_128 1 "vector_operand" "%0,0,v")
11187 (match_operand:VI14_128 2 "vector_operand" "YrBm,*xBm,vm")))]
11189 && <mask_mode512bit_condition>
11190 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11192 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
11193 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
11194 vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11195 [(set_attr "isa" "noavx,noavx,avx")
11196 (set_attr "type" "sseiadd")
11197 (set_attr "prefix_extra" "1,1,*")
11198 (set_attr "prefix" "orig,orig,vex")
11199 (set_attr "mode" "TI")])
11201 (define_insn "*<code>v8hi3"
11202 [(set (match_operand:V8HI 0 "register_operand" "=x,x,v")
11204 (match_operand:V8HI 1 "vector_operand" "%0,x,v")
11205 (match_operand:V8HI 2 "vector_operand" "xBm,xm,vm")))]
11206 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11208 p<maxmin_int>w\t{%2, %0|%0, %2}
11209 vp<maxmin_int>w\t{%2, %1, %0|%0, %1, %2}
11210 vp<maxmin_int>w\t{%2, %1, %0|%0, %1, %2}"
11211 [(set_attr "isa" "noavx,avx,avx512bw")
11212 (set_attr "type" "sseiadd")
11213 (set_attr "prefix_data16" "1,*,*")
11214 (set_attr "prefix_extra" "*,1,1")
11215 (set_attr "prefix" "orig,vex,evex")
11216 (set_attr "mode" "TI")])
11218 (define_expand "<code><mode>3"
11219 [(set (match_operand:VI124_128 0 "register_operand")
11221 (match_operand:VI124_128 1 "vector_operand")
11222 (match_operand:VI124_128 2 "vector_operand")))]
11225 if (TARGET_SSE4_1 || <MODE>mode == V16QImode)
11226 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
11227 else if (<CODE> == UMAX && <MODE>mode == V8HImode)
11229 rtx op0 = operands[0], op2 = operands[2], op3 = op0;
11230 operands[1] = force_reg (<MODE>mode, operands[1]);
11231 if (rtx_equal_p (op3, op2))
11232 op3 = gen_reg_rtx (V8HImode);
11233 emit_insn (gen_sse2_ussubv8hi3 (op3, operands[1], op2));
11234 emit_insn (gen_addv8hi3 (op0, op3, op2));
11242 operands[1] = force_reg (<MODE>mode, operands[1]);
11243 operands[2] = force_reg (<MODE>mode, operands[2]);
11245 xops[0] = operands[0];
11247 if (<CODE> == UMAX)
11249 xops[1] = operands[1];
11250 xops[2] = operands[2];
11254 xops[1] = operands[2];
11255 xops[2] = operands[1];
11258 xops[3] = gen_rtx_GTU (VOIDmode, operands[1], operands[2]);
11259 xops[4] = operands[1];
11260 xops[5] = operands[2];
11262 ok = ix86_expand_int_vcond (xops);
11268 (define_insn "*sse4_1_<code><mode>3<mask_name>"
11269 [(set (match_operand:VI24_128 0 "register_operand" "=Yr,*x,v")
11271 (match_operand:VI24_128 1 "vector_operand" "%0,0,v")
11272 (match_operand:VI24_128 2 "vector_operand" "YrBm,*xBm,vm")))]
11274 && <mask_mode512bit_condition>
11275 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11277 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
11278 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
11279 vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11280 [(set_attr "isa" "noavx,noavx,avx")
11281 (set_attr "type" "sseiadd")
11282 (set_attr "prefix_extra" "1,1,*")
11283 (set_attr "prefix" "orig,orig,vex")
11284 (set_attr "mode" "TI")])
11286 (define_insn "*<code>v16qi3"
11287 [(set (match_operand:V16QI 0 "register_operand" "=x,x,v")
11289 (match_operand:V16QI 1 "vector_operand" "%0,x,v")
11290 (match_operand:V16QI 2 "vector_operand" "xBm,xm,vm")))]
11291 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11293 p<maxmin_int>b\t{%2, %0|%0, %2}
11294 vp<maxmin_int>b\t{%2, %1, %0|%0, %1, %2}
11295 vp<maxmin_int>b\t{%2, %1, %0|%0, %1, %2}"
11296 [(set_attr "isa" "noavx,avx,avx512bw")
11297 (set_attr "type" "sseiadd")
11298 (set_attr "prefix_data16" "1,*,*")
11299 (set_attr "prefix_extra" "*,1,1")
11300 (set_attr "prefix" "orig,vex,evex")
11301 (set_attr "mode" "TI")])
11303 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11305 ;; Parallel integral comparisons
11307 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11309 (define_expand "avx2_eq<mode>3"
11310 [(set (match_operand:VI_256 0 "register_operand")
11312 (match_operand:VI_256 1 "nonimmediate_operand")
11313 (match_operand:VI_256 2 "nonimmediate_operand")))]
11315 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
11317 (define_insn "*avx2_eq<mode>3"
11318 [(set (match_operand:VI_256 0 "register_operand" "=x")
11320 (match_operand:VI_256 1 "nonimmediate_operand" "%x")
11321 (match_operand:VI_256 2 "nonimmediate_operand" "xm")))]
11322 "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11323 "vpcmpeq<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11324 [(set_attr "type" "ssecmp")
11325 (set_attr "prefix_extra" "1")
11326 (set_attr "prefix" "vex")
11327 (set_attr "mode" "OI")])
11329 (define_expand "<avx512>_eq<mode>3<mask_scalar_merge_name>"
11330 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
11331 (unspec:<avx512fmaskmode>
11332 [(match_operand:VI12_AVX512VL 1 "nonimmediate_operand")
11333 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand")]
11334 UNSPEC_MASKED_EQ))]
11336 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
11338 (define_expand "<avx512>_eq<mode>3<mask_scalar_merge_name>"
11339 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
11340 (unspec:<avx512fmaskmode>
11341 [(match_operand:VI48_AVX512VL 1 "nonimmediate_operand")
11342 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand")]
11343 UNSPEC_MASKED_EQ))]
11345 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
11347 (define_insn "<avx512>_eq<mode>3<mask_scalar_merge_name>_1"
11348 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11349 (unspec:<avx512fmaskmode>
11350 [(match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "%v")
11351 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")]
11352 UNSPEC_MASKED_EQ))]
11353 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11354 "vpcmpeq<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11355 [(set_attr "type" "ssecmp")
11356 (set_attr "prefix_extra" "1")
11357 (set_attr "prefix" "evex")
11358 (set_attr "mode" "<sseinsnmode>")])
11360 (define_insn "<avx512>_eq<mode>3<mask_scalar_merge_name>_1"
11361 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11362 (unspec:<avx512fmaskmode>
11363 [(match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "%v")
11364 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")]
11365 UNSPEC_MASKED_EQ))]
11366 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11367 "vpcmpeq<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11368 [(set_attr "type" "ssecmp")
11369 (set_attr "prefix_extra" "1")
11370 (set_attr "prefix" "evex")
11371 (set_attr "mode" "<sseinsnmode>")])
11373 (define_insn "*sse4_1_eqv2di3"
11374 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,x")
11376 (match_operand:V2DI 1 "vector_operand" "%0,0,x")
11377 (match_operand:V2DI 2 "vector_operand" "YrBm,*xBm,xm")))]
11378 "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11380 pcmpeqq\t{%2, %0|%0, %2}
11381 pcmpeqq\t{%2, %0|%0, %2}
11382 vpcmpeqq\t{%2, %1, %0|%0, %1, %2}"
11383 [(set_attr "isa" "noavx,noavx,avx")
11384 (set_attr "type" "ssecmp")
11385 (set_attr "prefix_extra" "1")
11386 (set_attr "prefix" "orig,orig,vex")
11387 (set_attr "mode" "TI")])
11389 (define_insn "*sse2_eq<mode>3"
11390 [(set (match_operand:VI124_128 0 "register_operand" "=x,x")
11392 (match_operand:VI124_128 1 "vector_operand" "%0,x")
11393 (match_operand:VI124_128 2 "vector_operand" "xBm,xm")))]
11394 "TARGET_SSE2 && !TARGET_XOP
11395 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11397 pcmpeq<ssemodesuffix>\t{%2, %0|%0, %2}
11398 vpcmpeq<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11399 [(set_attr "isa" "noavx,avx")
11400 (set_attr "type" "ssecmp")
11401 (set_attr "prefix_data16" "1,*")
11402 (set_attr "prefix" "orig,vex")
11403 (set_attr "mode" "TI")])
11405 (define_expand "sse2_eq<mode>3"
11406 [(set (match_operand:VI124_128 0 "register_operand")
11408 (match_operand:VI124_128 1 "vector_operand")
11409 (match_operand:VI124_128 2 "vector_operand")))]
11410 "TARGET_SSE2 && !TARGET_XOP "
11411 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
11413 (define_expand "sse4_1_eqv2di3"
11414 [(set (match_operand:V2DI 0 "register_operand")
11416 (match_operand:V2DI 1 "vector_operand")
11417 (match_operand:V2DI 2 "vector_operand")))]
11419 "ix86_fixup_binary_operands_no_copy (EQ, V2DImode, operands);")
11421 (define_insn "sse4_2_gtv2di3"
11422 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,x")
11424 (match_operand:V2DI 1 "register_operand" "0,0,x")
11425 (match_operand:V2DI 2 "vector_operand" "YrBm,*xBm,xm")))]
11428 pcmpgtq\t{%2, %0|%0, %2}
11429 pcmpgtq\t{%2, %0|%0, %2}
11430 vpcmpgtq\t{%2, %1, %0|%0, %1, %2}"
11431 [(set_attr "isa" "noavx,noavx,avx")
11432 (set_attr "type" "ssecmp")
11433 (set_attr "prefix_extra" "1")
11434 (set_attr "prefix" "orig,orig,vex")
11435 (set_attr "mode" "TI")])
11437 (define_insn "avx2_gt<mode>3"
11438 [(set (match_operand:VI_256 0 "register_operand" "=x")
11440 (match_operand:VI_256 1 "register_operand" "x")
11441 (match_operand:VI_256 2 "nonimmediate_operand" "xm")))]
11443 "vpcmpgt<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11444 [(set_attr "type" "ssecmp")
11445 (set_attr "prefix_extra" "1")
11446 (set_attr "prefix" "vex")
11447 (set_attr "mode" "OI")])
11449 (define_insn "<avx512>_gt<mode>3<mask_scalar_merge_name>"
11450 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11451 (unspec:<avx512fmaskmode>
11452 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
11453 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")] UNSPEC_MASKED_GT))]
11455 "vpcmpgt<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11456 [(set_attr "type" "ssecmp")
11457 (set_attr "prefix_extra" "1")
11458 (set_attr "prefix" "evex")
11459 (set_attr "mode" "<sseinsnmode>")])
11461 (define_insn "<avx512>_gt<mode>3<mask_scalar_merge_name>"
11462 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11463 (unspec:<avx512fmaskmode>
11464 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
11465 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")] UNSPEC_MASKED_GT))]
11467 "vpcmpgt<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11468 [(set_attr "type" "ssecmp")
11469 (set_attr "prefix_extra" "1")
11470 (set_attr "prefix" "evex")
11471 (set_attr "mode" "<sseinsnmode>")])
11473 (define_insn "sse2_gt<mode>3"
11474 [(set (match_operand:VI124_128 0 "register_operand" "=x,x")
11476 (match_operand:VI124_128 1 "register_operand" "0,x")
11477 (match_operand:VI124_128 2 "vector_operand" "xBm,xm")))]
11478 "TARGET_SSE2 && !TARGET_XOP"
11480 pcmpgt<ssemodesuffix>\t{%2, %0|%0, %2}
11481 vpcmpgt<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11482 [(set_attr "isa" "noavx,avx")
11483 (set_attr "type" "ssecmp")
11484 (set_attr "prefix_data16" "1,*")
11485 (set_attr "prefix" "orig,vex")
11486 (set_attr "mode" "TI")])
11488 (define_expand "vcond<V_512:mode><VI_AVX512BW:mode>"
11489 [(set (match_operand:V_512 0 "register_operand")
11490 (if_then_else:V_512
11491 (match_operator 3 ""
11492 [(match_operand:VI_AVX512BW 4 "nonimmediate_operand")
11493 (match_operand:VI_AVX512BW 5 "general_operand")])
11494 (match_operand:V_512 1)
11495 (match_operand:V_512 2)))]
11497 && (GET_MODE_NUNITS (<V_512:MODE>mode)
11498 == GET_MODE_NUNITS (<VI_AVX512BW:MODE>mode))"
11500 bool ok = ix86_expand_int_vcond (operands);
11505 (define_expand "vcond<V_256:mode><VI_256:mode>"
11506 [(set (match_operand:V_256 0 "register_operand")
11507 (if_then_else:V_256
11508 (match_operator 3 ""
11509 [(match_operand:VI_256 4 "nonimmediate_operand")
11510 (match_operand:VI_256 5 "general_operand")])
11511 (match_operand:V_256 1)
11512 (match_operand:V_256 2)))]
11514 && (GET_MODE_NUNITS (<V_256:MODE>mode)
11515 == GET_MODE_NUNITS (<VI_256:MODE>mode))"
11517 bool ok = ix86_expand_int_vcond (operands);
11522 (define_expand "vcond<V_128:mode><VI124_128:mode>"
11523 [(set (match_operand:V_128 0 "register_operand")
11524 (if_then_else:V_128
11525 (match_operator 3 ""
11526 [(match_operand:VI124_128 4 "vector_operand")
11527 (match_operand:VI124_128 5 "general_operand")])
11528 (match_operand:V_128 1)
11529 (match_operand:V_128 2)))]
11531 && (GET_MODE_NUNITS (<V_128:MODE>mode)
11532 == GET_MODE_NUNITS (<VI124_128:MODE>mode))"
11534 bool ok = ix86_expand_int_vcond (operands);
11539 (define_expand "vcond<VI8F_128:mode>v2di"
11540 [(set (match_operand:VI8F_128 0 "register_operand")
11541 (if_then_else:VI8F_128
11542 (match_operator 3 ""
11543 [(match_operand:V2DI 4 "vector_operand")
11544 (match_operand:V2DI 5 "general_operand")])
11545 (match_operand:VI8F_128 1)
11546 (match_operand:VI8F_128 2)))]
11549 bool ok = ix86_expand_int_vcond (operands);
11554 (define_expand "vcondu<V_512:mode><VI_AVX512BW:mode>"
11555 [(set (match_operand:V_512 0 "register_operand")
11556 (if_then_else:V_512
11557 (match_operator 3 ""
11558 [(match_operand:VI_AVX512BW 4 "nonimmediate_operand")
11559 (match_operand:VI_AVX512BW 5 "nonimmediate_operand")])
11560 (match_operand:V_512 1 "general_operand")
11561 (match_operand:V_512 2 "general_operand")))]
11563 && (GET_MODE_NUNITS (<V_512:MODE>mode)
11564 == GET_MODE_NUNITS (<VI_AVX512BW:MODE>mode))"
11566 bool ok = ix86_expand_int_vcond (operands);
11571 (define_expand "vcondu<V_256:mode><VI_256:mode>"
11572 [(set (match_operand:V_256 0 "register_operand")
11573 (if_then_else:V_256
11574 (match_operator 3 ""
11575 [(match_operand:VI_256 4 "nonimmediate_operand")
11576 (match_operand:VI_256 5 "nonimmediate_operand")])
11577 (match_operand:V_256 1 "general_operand")
11578 (match_operand:V_256 2 "general_operand")))]
11580 && (GET_MODE_NUNITS (<V_256:MODE>mode)
11581 == GET_MODE_NUNITS (<VI_256:MODE>mode))"
11583 bool ok = ix86_expand_int_vcond (operands);
11588 (define_expand "vcondu<V_128:mode><VI124_128:mode>"
11589 [(set (match_operand:V_128 0 "register_operand")
11590 (if_then_else:V_128
11591 (match_operator 3 ""
11592 [(match_operand:VI124_128 4 "vector_operand")
11593 (match_operand:VI124_128 5 "vector_operand")])
11594 (match_operand:V_128 1 "general_operand")
11595 (match_operand:V_128 2 "general_operand")))]
11597 && (GET_MODE_NUNITS (<V_128:MODE>mode)
11598 == GET_MODE_NUNITS (<VI124_128:MODE>mode))"
11600 bool ok = ix86_expand_int_vcond (operands);
11605 (define_expand "vcondu<VI8F_128:mode>v2di"
11606 [(set (match_operand:VI8F_128 0 "register_operand")
11607 (if_then_else:VI8F_128
11608 (match_operator 3 ""
11609 [(match_operand:V2DI 4 "vector_operand")
11610 (match_operand:V2DI 5 "vector_operand")])
11611 (match_operand:VI8F_128 1 "general_operand")
11612 (match_operand:VI8F_128 2 "general_operand")))]
11615 bool ok = ix86_expand_int_vcond (operands);
11620 (define_expand "vcondeq<VI8F_128:mode>v2di"
11621 [(set (match_operand:VI8F_128 0 "register_operand")
11622 (if_then_else:VI8F_128
11623 (match_operator 3 ""
11624 [(match_operand:V2DI 4 "vector_operand")
11625 (match_operand:V2DI 5 "general_operand")])
11626 (match_operand:VI8F_128 1)
11627 (match_operand:VI8F_128 2)))]
11630 bool ok = ix86_expand_int_vcond (operands);
11635 (define_mode_iterator VEC_PERM_AVX2
11636 [V16QI V8HI V4SI V2DI V4SF V2DF
11637 (V32QI "TARGET_AVX2") (V16HI "TARGET_AVX2")
11638 (V8SI "TARGET_AVX2") (V4DI "TARGET_AVX2")
11639 (V8SF "TARGET_AVX2") (V4DF "TARGET_AVX2")
11640 (V16SF "TARGET_AVX512F") (V8DF "TARGET_AVX512F")
11641 (V16SI "TARGET_AVX512F") (V8DI "TARGET_AVX512F")
11642 (V32HI "TARGET_AVX512BW") (V64QI "TARGET_AVX512VBMI")])
11644 (define_expand "vec_perm<mode>"
11645 [(match_operand:VEC_PERM_AVX2 0 "register_operand")
11646 (match_operand:VEC_PERM_AVX2 1 "register_operand")
11647 (match_operand:VEC_PERM_AVX2 2 "register_operand")
11648 (match_operand:<sseintvecmode> 3 "register_operand")]
11649 "TARGET_SSSE3 || TARGET_AVX || TARGET_XOP"
11651 ix86_expand_vec_perm (operands);
11655 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11657 ;; Parallel bitwise logical operations
11659 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11661 (define_expand "one_cmpl<mode>2"
11662 [(set (match_operand:VI 0 "register_operand")
11663 (xor:VI (match_operand:VI 1 "vector_operand")
11667 operands[2] = force_reg (<MODE>mode, CONSTM1_RTX (<MODE>mode));
11670 (define_expand "<sse2_avx2>_andnot<mode>3"
11671 [(set (match_operand:VI_AVX2 0 "register_operand")
11673 (not:VI_AVX2 (match_operand:VI_AVX2 1 "register_operand"))
11674 (match_operand:VI_AVX2 2 "vector_operand")))]
11677 (define_expand "<sse2_avx2>_andnot<mode>3_mask"
11678 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
11679 (vec_merge:VI48_AVX512VL
11682 (match_operand:VI48_AVX512VL 1 "register_operand"))
11683 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand"))
11684 (match_operand:VI48_AVX512VL 3 "vector_move_operand")
11685 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
11688 (define_expand "<sse2_avx2>_andnot<mode>3_mask"
11689 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
11690 (vec_merge:VI12_AVX512VL
11693 (match_operand:VI12_AVX512VL 1 "register_operand"))
11694 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand"))
11695 (match_operand:VI12_AVX512VL 3 "vector_move_operand")
11696 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
11699 (define_insn "*andnot<mode>3"
11700 [(set (match_operand:VI 0 "register_operand" "=x,x,v")
11702 (not:VI (match_operand:VI 1 "register_operand" "0,x,v"))
11703 (match_operand:VI 2 "vector_operand" "xBm,xm,vm")))]
11706 static char buf[64];
11709 const char *ssesuffix;
11711 switch (get_attr_mode (insn))
11714 gcc_assert (TARGET_AVX512F);
11717 gcc_assert (TARGET_AVX2);
11720 gcc_assert (TARGET_SSE2);
11722 switch (<MODE>mode)
11726 /* There is no vpandnb or vpandnw instruction, nor vpandn for
11727 512-bit vectors. Use vpandnq instead. */
11732 ssesuffix = "<ssemodesuffix>";
11738 ssesuffix = (TARGET_AVX512VL && which_alternative == 2
11739 ? "<ssemodesuffix>" : "");
11742 ssesuffix = TARGET_AVX512VL && which_alternative == 2 ? "q" : "";
11747 gcc_assert (TARGET_AVX512F);
11750 gcc_assert (TARGET_AVX);
11753 gcc_assert (TARGET_SSE);
11759 gcc_unreachable ();
11762 switch (which_alternative)
11765 ops = "%s%s\t{%%2, %%0|%%0, %%2}";
11769 ops = "v%s%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
11772 gcc_unreachable ();
11775 snprintf (buf, sizeof (buf), ops, tmp, ssesuffix);
11778 [(set_attr "isa" "noavx,avx,avx")
11779 (set_attr "type" "sselog")
11780 (set (attr "prefix_data16")
11782 (and (eq_attr "alternative" "0")
11783 (eq_attr "mode" "TI"))
11785 (const_string "*")))
11786 (set_attr "prefix" "orig,vex,evex")
11788 (cond [(and (match_test "<MODE_SIZE> == 16")
11789 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
11790 (const_string "<ssePSmode>")
11791 (match_test "TARGET_AVX2")
11792 (const_string "<sseinsnmode>")
11793 (match_test "TARGET_AVX")
11795 (match_test "<MODE_SIZE> > 16")
11796 (const_string "V8SF")
11797 (const_string "<sseinsnmode>"))
11798 (ior (not (match_test "TARGET_SSE2"))
11799 (match_test "optimize_function_for_size_p (cfun)"))
11800 (const_string "V4SF")
11802 (const_string "<sseinsnmode>")))])
11804 (define_insn "*andnot<mode>3_mask"
11805 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
11806 (vec_merge:VI48_AVX512VL
11809 (match_operand:VI48_AVX512VL 1 "register_operand" "v"))
11810 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm"))
11811 (match_operand:VI48_AVX512VL 3 "vector_move_operand" "0C")
11812 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
11814 "vpandn<ssemodesuffix>\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}";
11815 [(set_attr "type" "sselog")
11816 (set_attr "prefix" "evex")
11817 (set_attr "mode" "<sseinsnmode>")])
11819 (define_expand "<code><mode>3"
11820 [(set (match_operand:VI 0 "register_operand")
11822 (match_operand:VI 1 "nonimmediate_or_const_vector_operand")
11823 (match_operand:VI 2 "nonimmediate_or_const_vector_operand")))]
11826 ix86_expand_vector_logical_operator (<CODE>, <MODE>mode, operands);
11830 (define_insn "<mask_codefor><code><mode>3<mask_name>"
11831 [(set (match_operand:VI48_AVX_AVX512F 0 "register_operand" "=x,x,v")
11832 (any_logic:VI48_AVX_AVX512F
11833 (match_operand:VI48_AVX_AVX512F 1 "vector_operand" "%0,x,v")
11834 (match_operand:VI48_AVX_AVX512F 2 "vector_operand" "xBm,xm,vm")))]
11835 "TARGET_SSE && <mask_mode512bit_condition>
11836 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11838 static char buf[64];
11841 const char *ssesuffix;
11843 switch (get_attr_mode (insn))
11846 gcc_assert (TARGET_AVX512F);
11849 gcc_assert (TARGET_AVX2);
11852 gcc_assert (TARGET_SSE2);
11854 switch (<MODE>mode)
11858 ssesuffix = "<ssemodesuffix>";
11864 ssesuffix = (TARGET_AVX512VL
11865 && (<mask_applied> || which_alternative == 2)
11866 ? "<ssemodesuffix>" : "");
11869 gcc_unreachable ();
11874 gcc_assert (TARGET_AVX);
11877 gcc_assert (TARGET_SSE);
11883 gcc_unreachable ();
11886 switch (which_alternative)
11889 if (<mask_applied>)
11890 ops = "v%s%s\t{%%2, %%0, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%0, %%2}";
11892 ops = "%s%s\t{%%2, %%0|%%0, %%2}";
11896 ops = "v%s%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
11899 gcc_unreachable ();
11902 snprintf (buf, sizeof (buf), ops, tmp, ssesuffix);
11905 [(set_attr "isa" "noavx,avx,avx")
11906 (set_attr "type" "sselog")
11907 (set (attr "prefix_data16")
11909 (and (eq_attr "alternative" "0")
11910 (eq_attr "mode" "TI"))
11912 (const_string "*")))
11913 (set_attr "prefix" "<mask_prefix3>,evex")
11915 (cond [(and (match_test "<MODE_SIZE> == 16")
11916 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
11917 (const_string "<ssePSmode>")
11918 (match_test "TARGET_AVX2")
11919 (const_string "<sseinsnmode>")
11920 (match_test "TARGET_AVX")
11922 (match_test "<MODE_SIZE> > 16")
11923 (const_string "V8SF")
11924 (const_string "<sseinsnmode>"))
11925 (ior (not (match_test "TARGET_SSE2"))
11926 (match_test "optimize_function_for_size_p (cfun)"))
11927 (const_string "V4SF")
11929 (const_string "<sseinsnmode>")))])
11931 (define_insn "*<code><mode>3"
11932 [(set (match_operand:VI12_AVX_AVX512F 0 "register_operand" "=x,x,v")
11933 (any_logic:VI12_AVX_AVX512F
11934 (match_operand:VI12_AVX_AVX512F 1 "vector_operand" "%0,x,v")
11935 (match_operand:VI12_AVX_AVX512F 2 "vector_operand" "xBm,xm,vm")))]
11936 "TARGET_SSE && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11938 static char buf[64];
11941 const char *ssesuffix;
11943 switch (get_attr_mode (insn))
11946 gcc_assert (TARGET_AVX512F);
11949 gcc_assert (TARGET_AVX2);
11952 gcc_assert (TARGET_SSE2);
11954 switch (<MODE>mode)
11964 ssesuffix = TARGET_AVX512VL && which_alternative == 2 ? "q" : "";
11967 gcc_unreachable ();
11972 gcc_assert (TARGET_AVX);
11975 gcc_assert (TARGET_SSE);
11981 gcc_unreachable ();
11984 switch (which_alternative)
11987 ops = "%s%s\t{%%2, %%0|%%0, %%2}";
11991 ops = "v%s%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
11994 gcc_unreachable ();
11997 snprintf (buf, sizeof (buf), ops, tmp, ssesuffix);
12000 [(set_attr "isa" "noavx,avx,avx")
12001 (set_attr "type" "sselog")
12002 (set (attr "prefix_data16")
12004 (and (eq_attr "alternative" "0")
12005 (eq_attr "mode" "TI"))
12007 (const_string "*")))
12008 (set_attr "prefix" "orig,vex,evex")
12010 (cond [(and (match_test "<MODE_SIZE> == 16")
12011 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
12012 (const_string "<ssePSmode>")
12013 (match_test "TARGET_AVX2")
12014 (const_string "<sseinsnmode>")
12015 (match_test "TARGET_AVX")
12017 (match_test "<MODE_SIZE> > 16")
12018 (const_string "V8SF")
12019 (const_string "<sseinsnmode>"))
12020 (ior (not (match_test "TARGET_SSE2"))
12021 (match_test "optimize_function_for_size_p (cfun)"))
12022 (const_string "V4SF")
12024 (const_string "<sseinsnmode>")))])
12026 (define_insn "<avx512>_testm<mode>3<mask_scalar_merge_name>"
12027 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
12028 (unspec:<avx512fmaskmode>
12029 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
12030 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")]
12033 "vptestm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
12034 [(set_attr "prefix" "evex")
12035 (set_attr "mode" "<sseinsnmode>")])
12037 (define_insn "<avx512>_testm<mode>3<mask_scalar_merge_name>"
12038 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
12039 (unspec:<avx512fmaskmode>
12040 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
12041 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")]
12044 "vptestm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
12045 [(set_attr "prefix" "evex")
12046 (set_attr "mode" "<sseinsnmode>")])
12048 (define_insn "<avx512>_testnm<mode>3<mask_scalar_merge_name>"
12049 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
12050 (unspec:<avx512fmaskmode>
12051 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
12052 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")]
12055 "vptestnm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
12056 [(set_attr "prefix" "evex")
12057 (set_attr "mode" "<sseinsnmode>")])
12059 (define_insn "<avx512>_testnm<mode>3<mask_scalar_merge_name>"
12060 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
12061 (unspec:<avx512fmaskmode>
12062 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
12063 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")]
12066 "vptestnm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
12067 [(set_attr "prefix" "evex")
12068 (set_attr "mode" "<sseinsnmode>")])
12070 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12072 ;; Parallel integral element swizzling
12074 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12076 (define_expand "vec_pack_trunc_<mode>"
12077 [(match_operand:<ssepackmode> 0 "register_operand")
12078 (match_operand:VI248_AVX2_8_AVX512F_24_AVX512BW 1 "register_operand")
12079 (match_operand:VI248_AVX2_8_AVX512F_24_AVX512BW 2 "register_operand")]
12082 rtx op1 = gen_lowpart (<ssepackmode>mode, operands[1]);
12083 rtx op2 = gen_lowpart (<ssepackmode>mode, operands[2]);
12084 ix86_expand_vec_extract_even_odd (operands[0], op1, op2, 0);
12088 (define_expand "vec_pack_trunc_qi"
12089 [(set (match_operand:HI 0 ("register_operand"))
12090 (ior:HI (ashift:HI (zero_extend:HI (match_operand:QI 2 ("register_operand")))
12092 (zero_extend:HI (match_operand:QI 1 ("register_operand")))))]
12095 (define_expand "vec_pack_trunc_<mode>"
12096 [(set (match_operand:<DOUBLEMASKMODE> 0 ("register_operand"))
12097 (ior:<DOUBLEMASKMODE> (ashift:<DOUBLEMASKMODE> (zero_extend:<DOUBLEMASKMODE> (match_operand:SWI24 2 ("register_operand")))
12099 (zero_extend:<DOUBLEMASKMODE> (match_operand:SWI24 1 ("register_operand")))))]
12102 operands[3] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
12105 (define_insn "<sse2_avx2>_packsswb<mask_name>"
12106 [(set (match_operand:VI1_AVX512 0 "register_operand" "=x,x,v")
12107 (vec_concat:VI1_AVX512
12108 (ss_truncate:<ssehalfvecmode>
12109 (match_operand:<sseunpackmode> 1 "register_operand" "0,x,v"))
12110 (ss_truncate:<ssehalfvecmode>
12111 (match_operand:<sseunpackmode> 2 "vector_operand" "xBm,xm,vm"))))]
12112 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
12114 packsswb\t{%2, %0|%0, %2}
12115 vpacksswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
12116 vpacksswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12117 [(set_attr "isa" "noavx,avx,avx512bw")
12118 (set_attr "type" "sselog")
12119 (set_attr "prefix_data16" "1,*,*")
12120 (set_attr "prefix" "orig,<mask_prefix>,evex")
12121 (set_attr "mode" "<sseinsnmode>")])
12123 (define_insn "<sse2_avx2>_packssdw<mask_name>"
12124 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,x,v")
12125 (vec_concat:VI2_AVX2
12126 (ss_truncate:<ssehalfvecmode>
12127 (match_operand:<sseunpackmode> 1 "register_operand" "0,x,v"))
12128 (ss_truncate:<ssehalfvecmode>
12129 (match_operand:<sseunpackmode> 2 "vector_operand" "xBm,xm,vm"))))]
12130 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
12132 packssdw\t{%2, %0|%0, %2}
12133 vpackssdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
12134 vpackssdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12135 [(set_attr "isa" "noavx,avx,avx512bw")
12136 (set_attr "type" "sselog")
12137 (set_attr "prefix_data16" "1,*,*")
12138 (set_attr "prefix" "orig,<mask_prefix>,evex")
12139 (set_attr "mode" "<sseinsnmode>")])
12141 (define_insn "<sse2_avx2>_packuswb<mask_name>"
12142 [(set (match_operand:VI1_AVX512 0 "register_operand" "=x,x,v")
12143 (vec_concat:VI1_AVX512
12144 (us_truncate:<ssehalfvecmode>
12145 (match_operand:<sseunpackmode> 1 "register_operand" "0,x,v"))
12146 (us_truncate:<ssehalfvecmode>
12147 (match_operand:<sseunpackmode> 2 "vector_operand" "xBm,xm,vm"))))]
12148 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
12150 packuswb\t{%2, %0|%0, %2}
12151 vpackuswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
12152 vpackuswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12153 [(set_attr "isa" "noavx,avx,avx512bw")
12154 (set_attr "type" "sselog")
12155 (set_attr "prefix_data16" "1,*,*")
12156 (set_attr "prefix" "orig,<mask_prefix>,evex")
12157 (set_attr "mode" "<sseinsnmode>")])
12159 (define_insn "avx512bw_interleave_highv64qi<mask_name>"
12160 [(set (match_operand:V64QI 0 "register_operand" "=v")
12163 (match_operand:V64QI 1 "register_operand" "v")
12164 (match_operand:V64QI 2 "nonimmediate_operand" "vm"))
12165 (parallel [(const_int 8) (const_int 72)
12166 (const_int 9) (const_int 73)
12167 (const_int 10) (const_int 74)
12168 (const_int 11) (const_int 75)
12169 (const_int 12) (const_int 76)
12170 (const_int 13) (const_int 77)
12171 (const_int 14) (const_int 78)
12172 (const_int 15) (const_int 79)
12173 (const_int 24) (const_int 88)
12174 (const_int 25) (const_int 89)
12175 (const_int 26) (const_int 90)
12176 (const_int 27) (const_int 91)
12177 (const_int 28) (const_int 92)
12178 (const_int 29) (const_int 93)
12179 (const_int 30) (const_int 94)
12180 (const_int 31) (const_int 95)
12181 (const_int 40) (const_int 104)
12182 (const_int 41) (const_int 105)
12183 (const_int 42) (const_int 106)
12184 (const_int 43) (const_int 107)
12185 (const_int 44) (const_int 108)
12186 (const_int 45) (const_int 109)
12187 (const_int 46) (const_int 110)
12188 (const_int 47) (const_int 111)
12189 (const_int 56) (const_int 120)
12190 (const_int 57) (const_int 121)
12191 (const_int 58) (const_int 122)
12192 (const_int 59) (const_int 123)
12193 (const_int 60) (const_int 124)
12194 (const_int 61) (const_int 125)
12195 (const_int 62) (const_int 126)
12196 (const_int 63) (const_int 127)])))]
12198 "vpunpckhbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12199 [(set_attr "type" "sselog")
12200 (set_attr "prefix" "evex")
12201 (set_attr "mode" "XI")])
12203 (define_insn "avx2_interleave_highv32qi<mask_name>"
12204 [(set (match_operand:V32QI 0 "register_operand" "=v")
12207 (match_operand:V32QI 1 "register_operand" "v")
12208 (match_operand:V32QI 2 "nonimmediate_operand" "vm"))
12209 (parallel [(const_int 8) (const_int 40)
12210 (const_int 9) (const_int 41)
12211 (const_int 10) (const_int 42)
12212 (const_int 11) (const_int 43)
12213 (const_int 12) (const_int 44)
12214 (const_int 13) (const_int 45)
12215 (const_int 14) (const_int 46)
12216 (const_int 15) (const_int 47)
12217 (const_int 24) (const_int 56)
12218 (const_int 25) (const_int 57)
12219 (const_int 26) (const_int 58)
12220 (const_int 27) (const_int 59)
12221 (const_int 28) (const_int 60)
12222 (const_int 29) (const_int 61)
12223 (const_int 30) (const_int 62)
12224 (const_int 31) (const_int 63)])))]
12225 "TARGET_AVX2 && <mask_avx512vl_condition>"
12226 "vpunpckhbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12227 [(set_attr "type" "sselog")
12228 (set_attr "prefix" "<mask_prefix>")
12229 (set_attr "mode" "OI")])
12231 (define_insn "vec_interleave_highv16qi<mask_name>"
12232 [(set (match_operand:V16QI 0 "register_operand" "=x,v")
12235 (match_operand:V16QI 1 "register_operand" "0,v")
12236 (match_operand:V16QI 2 "vector_operand" "xBm,vm"))
12237 (parallel [(const_int 8) (const_int 24)
12238 (const_int 9) (const_int 25)
12239 (const_int 10) (const_int 26)
12240 (const_int 11) (const_int 27)
12241 (const_int 12) (const_int 28)
12242 (const_int 13) (const_int 29)
12243 (const_int 14) (const_int 30)
12244 (const_int 15) (const_int 31)])))]
12245 "TARGET_SSE2 && <mask_avx512vl_condition>"
12247 punpckhbw\t{%2, %0|%0, %2}
12248 vpunpckhbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12249 [(set_attr "isa" "noavx,avx")
12250 (set_attr "type" "sselog")
12251 (set_attr "prefix_data16" "1,*")
12252 (set_attr "prefix" "orig,<mask_prefix>")
12253 (set_attr "mode" "TI")])
12255 (define_insn "avx512bw_interleave_lowv64qi<mask_name>"
12256 [(set (match_operand:V64QI 0 "register_operand" "=v")
12259 (match_operand:V64QI 1 "register_operand" "v")
12260 (match_operand:V64QI 2 "nonimmediate_operand" "vm"))
12261 (parallel [(const_int 0) (const_int 64)
12262 (const_int 1) (const_int 65)
12263 (const_int 2) (const_int 66)
12264 (const_int 3) (const_int 67)
12265 (const_int 4) (const_int 68)
12266 (const_int 5) (const_int 69)
12267 (const_int 6) (const_int 70)
12268 (const_int 7) (const_int 71)
12269 (const_int 16) (const_int 80)
12270 (const_int 17) (const_int 81)
12271 (const_int 18) (const_int 82)
12272 (const_int 19) (const_int 83)
12273 (const_int 20) (const_int 84)
12274 (const_int 21) (const_int 85)
12275 (const_int 22) (const_int 86)
12276 (const_int 23) (const_int 87)
12277 (const_int 32) (const_int 96)
12278 (const_int 33) (const_int 97)
12279 (const_int 34) (const_int 98)
12280 (const_int 35) (const_int 99)
12281 (const_int 36) (const_int 100)
12282 (const_int 37) (const_int 101)
12283 (const_int 38) (const_int 102)
12284 (const_int 39) (const_int 103)
12285 (const_int 48) (const_int 112)
12286 (const_int 49) (const_int 113)
12287 (const_int 50) (const_int 114)
12288 (const_int 51) (const_int 115)
12289 (const_int 52) (const_int 116)
12290 (const_int 53) (const_int 117)
12291 (const_int 54) (const_int 118)
12292 (const_int 55) (const_int 119)])))]
12294 "vpunpcklbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12295 [(set_attr "type" "sselog")
12296 (set_attr "prefix" "evex")
12297 (set_attr "mode" "XI")])
12299 (define_insn "avx2_interleave_lowv32qi<mask_name>"
12300 [(set (match_operand:V32QI 0 "register_operand" "=v")
12303 (match_operand:V32QI 1 "register_operand" "v")
12304 (match_operand:V32QI 2 "nonimmediate_operand" "vm"))
12305 (parallel [(const_int 0) (const_int 32)
12306 (const_int 1) (const_int 33)
12307 (const_int 2) (const_int 34)
12308 (const_int 3) (const_int 35)
12309 (const_int 4) (const_int 36)
12310 (const_int 5) (const_int 37)
12311 (const_int 6) (const_int 38)
12312 (const_int 7) (const_int 39)
12313 (const_int 16) (const_int 48)
12314 (const_int 17) (const_int 49)
12315 (const_int 18) (const_int 50)
12316 (const_int 19) (const_int 51)
12317 (const_int 20) (const_int 52)
12318 (const_int 21) (const_int 53)
12319 (const_int 22) (const_int 54)
12320 (const_int 23) (const_int 55)])))]
12321 "TARGET_AVX2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12322 "vpunpcklbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12323 [(set_attr "type" "sselog")
12324 (set_attr "prefix" "maybe_vex")
12325 (set_attr "mode" "OI")])
12327 (define_insn "vec_interleave_lowv16qi<mask_name>"
12328 [(set (match_operand:V16QI 0 "register_operand" "=x,v")
12331 (match_operand:V16QI 1 "register_operand" "0,v")
12332 (match_operand:V16QI 2 "vector_operand" "xBm,vm"))
12333 (parallel [(const_int 0) (const_int 16)
12334 (const_int 1) (const_int 17)
12335 (const_int 2) (const_int 18)
12336 (const_int 3) (const_int 19)
12337 (const_int 4) (const_int 20)
12338 (const_int 5) (const_int 21)
12339 (const_int 6) (const_int 22)
12340 (const_int 7) (const_int 23)])))]
12341 "TARGET_SSE2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12343 punpcklbw\t{%2, %0|%0, %2}
12344 vpunpcklbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12345 [(set_attr "isa" "noavx,avx")
12346 (set_attr "type" "sselog")
12347 (set_attr "prefix_data16" "1,*")
12348 (set_attr "prefix" "orig,vex")
12349 (set_attr "mode" "TI")])
12351 (define_insn "avx512bw_interleave_highv32hi<mask_name>"
12352 [(set (match_operand:V32HI 0 "register_operand" "=v")
12355 (match_operand:V32HI 1 "register_operand" "v")
12356 (match_operand:V32HI 2 "nonimmediate_operand" "vm"))
12357 (parallel [(const_int 4) (const_int 36)
12358 (const_int 5) (const_int 37)
12359 (const_int 6) (const_int 38)
12360 (const_int 7) (const_int 39)
12361 (const_int 12) (const_int 44)
12362 (const_int 13) (const_int 45)
12363 (const_int 14) (const_int 46)
12364 (const_int 15) (const_int 47)
12365 (const_int 20) (const_int 52)
12366 (const_int 21) (const_int 53)
12367 (const_int 22) (const_int 54)
12368 (const_int 23) (const_int 55)
12369 (const_int 28) (const_int 60)
12370 (const_int 29) (const_int 61)
12371 (const_int 30) (const_int 62)
12372 (const_int 31) (const_int 63)])))]
12374 "vpunpckhwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12375 [(set_attr "type" "sselog")
12376 (set_attr "prefix" "evex")
12377 (set_attr "mode" "XI")])
12379 (define_insn "avx2_interleave_highv16hi<mask_name>"
12380 [(set (match_operand:V16HI 0 "register_operand" "=v")
12383 (match_operand:V16HI 1 "register_operand" "v")
12384 (match_operand:V16HI 2 "nonimmediate_operand" "vm"))
12385 (parallel [(const_int 4) (const_int 20)
12386 (const_int 5) (const_int 21)
12387 (const_int 6) (const_int 22)
12388 (const_int 7) (const_int 23)
12389 (const_int 12) (const_int 28)
12390 (const_int 13) (const_int 29)
12391 (const_int 14) (const_int 30)
12392 (const_int 15) (const_int 31)])))]
12393 "TARGET_AVX2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12394 "vpunpckhwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12395 [(set_attr "type" "sselog")
12396 (set_attr "prefix" "maybe_evex")
12397 (set_attr "mode" "OI")])
12399 (define_insn "vec_interleave_highv8hi<mask_name>"
12400 [(set (match_operand:V8HI 0 "register_operand" "=x,v")
12403 (match_operand:V8HI 1 "register_operand" "0,v")
12404 (match_operand:V8HI 2 "vector_operand" "xBm,vm"))
12405 (parallel [(const_int 4) (const_int 12)
12406 (const_int 5) (const_int 13)
12407 (const_int 6) (const_int 14)
12408 (const_int 7) (const_int 15)])))]
12409 "TARGET_SSE2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12411 punpckhwd\t{%2, %0|%0, %2}
12412 vpunpckhwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12413 [(set_attr "isa" "noavx,avx")
12414 (set_attr "type" "sselog")
12415 (set_attr "prefix_data16" "1,*")
12416 (set_attr "prefix" "orig,maybe_vex")
12417 (set_attr "mode" "TI")])
12419 (define_insn "<mask_codefor>avx512bw_interleave_lowv32hi<mask_name>"
12420 [(set (match_operand:V32HI 0 "register_operand" "=v")
12423 (match_operand:V32HI 1 "register_operand" "v")
12424 (match_operand:V32HI 2 "nonimmediate_operand" "vm"))
12425 (parallel [(const_int 0) (const_int 32)
12426 (const_int 1) (const_int 33)
12427 (const_int 2) (const_int 34)
12428 (const_int 3) (const_int 35)
12429 (const_int 8) (const_int 40)
12430 (const_int 9) (const_int 41)
12431 (const_int 10) (const_int 42)
12432 (const_int 11) (const_int 43)
12433 (const_int 16) (const_int 48)
12434 (const_int 17) (const_int 49)
12435 (const_int 18) (const_int 50)
12436 (const_int 19) (const_int 51)
12437 (const_int 24) (const_int 56)
12438 (const_int 25) (const_int 57)
12439 (const_int 26) (const_int 58)
12440 (const_int 27) (const_int 59)])))]
12442 "vpunpcklwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12443 [(set_attr "type" "sselog")
12444 (set_attr "prefix" "evex")
12445 (set_attr "mode" "XI")])
12447 (define_insn "avx2_interleave_lowv16hi<mask_name>"
12448 [(set (match_operand:V16HI 0 "register_operand" "=v")
12451 (match_operand:V16HI 1 "register_operand" "v")
12452 (match_operand:V16HI 2 "nonimmediate_operand" "vm"))
12453 (parallel [(const_int 0) (const_int 16)
12454 (const_int 1) (const_int 17)
12455 (const_int 2) (const_int 18)
12456 (const_int 3) (const_int 19)
12457 (const_int 8) (const_int 24)
12458 (const_int 9) (const_int 25)
12459 (const_int 10) (const_int 26)
12460 (const_int 11) (const_int 27)])))]
12461 "TARGET_AVX2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12462 "vpunpcklwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12463 [(set_attr "type" "sselog")
12464 (set_attr "prefix" "maybe_evex")
12465 (set_attr "mode" "OI")])
12467 (define_insn "vec_interleave_lowv8hi<mask_name>"
12468 [(set (match_operand:V8HI 0 "register_operand" "=x,v")
12471 (match_operand:V8HI 1 "register_operand" "0,v")
12472 (match_operand:V8HI 2 "vector_operand" "xBm,vm"))
12473 (parallel [(const_int 0) (const_int 8)
12474 (const_int 1) (const_int 9)
12475 (const_int 2) (const_int 10)
12476 (const_int 3) (const_int 11)])))]
12477 "TARGET_SSE2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12479 punpcklwd\t{%2, %0|%0, %2}
12480 vpunpcklwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12481 [(set_attr "isa" "noavx,avx")
12482 (set_attr "type" "sselog")
12483 (set_attr "prefix_data16" "1,*")
12484 (set_attr "prefix" "orig,maybe_evex")
12485 (set_attr "mode" "TI")])
12487 (define_insn "avx2_interleave_highv8si<mask_name>"
12488 [(set (match_operand:V8SI 0 "register_operand" "=v")
12491 (match_operand:V8SI 1 "register_operand" "v")
12492 (match_operand:V8SI 2 "nonimmediate_operand" "vm"))
12493 (parallel [(const_int 2) (const_int 10)
12494 (const_int 3) (const_int 11)
12495 (const_int 6) (const_int 14)
12496 (const_int 7) (const_int 15)])))]
12497 "TARGET_AVX2 && <mask_avx512vl_condition>"
12498 "vpunpckhdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12499 [(set_attr "type" "sselog")
12500 (set_attr "prefix" "maybe_evex")
12501 (set_attr "mode" "OI")])
12503 (define_insn "<mask_codefor>avx512f_interleave_highv16si<mask_name>"
12504 [(set (match_operand:V16SI 0 "register_operand" "=v")
12507 (match_operand:V16SI 1 "register_operand" "v")
12508 (match_operand:V16SI 2 "nonimmediate_operand" "vm"))
12509 (parallel [(const_int 2) (const_int 18)
12510 (const_int 3) (const_int 19)
12511 (const_int 6) (const_int 22)
12512 (const_int 7) (const_int 23)
12513 (const_int 10) (const_int 26)
12514 (const_int 11) (const_int 27)
12515 (const_int 14) (const_int 30)
12516 (const_int 15) (const_int 31)])))]
12518 "vpunpckhdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12519 [(set_attr "type" "sselog")
12520 (set_attr "prefix" "evex")
12521 (set_attr "mode" "XI")])
12524 (define_insn "vec_interleave_highv4si<mask_name>"
12525 [(set (match_operand:V4SI 0 "register_operand" "=x,v")
12528 (match_operand:V4SI 1 "register_operand" "0,v")
12529 (match_operand:V4SI 2 "vector_operand" "xBm,vm"))
12530 (parallel [(const_int 2) (const_int 6)
12531 (const_int 3) (const_int 7)])))]
12532 "TARGET_SSE2 && <mask_avx512vl_condition>"
12534 punpckhdq\t{%2, %0|%0, %2}
12535 vpunpckhdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12536 [(set_attr "isa" "noavx,avx")
12537 (set_attr "type" "sselog")
12538 (set_attr "prefix_data16" "1,*")
12539 (set_attr "prefix" "orig,maybe_vex")
12540 (set_attr "mode" "TI")])
12542 (define_insn "avx2_interleave_lowv8si<mask_name>"
12543 [(set (match_operand:V8SI 0 "register_operand" "=v")
12546 (match_operand:V8SI 1 "register_operand" "v")
12547 (match_operand:V8SI 2 "nonimmediate_operand" "vm"))
12548 (parallel [(const_int 0) (const_int 8)
12549 (const_int 1) (const_int 9)
12550 (const_int 4) (const_int 12)
12551 (const_int 5) (const_int 13)])))]
12552 "TARGET_AVX2 && <mask_avx512vl_condition>"
12553 "vpunpckldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12554 [(set_attr "type" "sselog")
12555 (set_attr "prefix" "maybe_evex")
12556 (set_attr "mode" "OI")])
12558 (define_insn "<mask_codefor>avx512f_interleave_lowv16si<mask_name>"
12559 [(set (match_operand:V16SI 0 "register_operand" "=v")
12562 (match_operand:V16SI 1 "register_operand" "v")
12563 (match_operand:V16SI 2 "nonimmediate_operand" "vm"))
12564 (parallel [(const_int 0) (const_int 16)
12565 (const_int 1) (const_int 17)
12566 (const_int 4) (const_int 20)
12567 (const_int 5) (const_int 21)
12568 (const_int 8) (const_int 24)
12569 (const_int 9) (const_int 25)
12570 (const_int 12) (const_int 28)
12571 (const_int 13) (const_int 29)])))]
12573 "vpunpckldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12574 [(set_attr "type" "sselog")
12575 (set_attr "prefix" "evex")
12576 (set_attr "mode" "XI")])
12578 (define_insn "vec_interleave_lowv4si<mask_name>"
12579 [(set (match_operand:V4SI 0 "register_operand" "=x,v")
12582 (match_operand:V4SI 1 "register_operand" "0,v")
12583 (match_operand:V4SI 2 "vector_operand" "xBm,vm"))
12584 (parallel [(const_int 0) (const_int 4)
12585 (const_int 1) (const_int 5)])))]
12586 "TARGET_SSE2 && <mask_avx512vl_condition>"
12588 punpckldq\t{%2, %0|%0, %2}
12589 vpunpckldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12590 [(set_attr "isa" "noavx,avx")
12591 (set_attr "type" "sselog")
12592 (set_attr "prefix_data16" "1,*")
12593 (set_attr "prefix" "orig,vex")
12594 (set_attr "mode" "TI")])
12596 (define_expand "vec_interleave_high<mode>"
12597 [(match_operand:VI_256 0 "register_operand")
12598 (match_operand:VI_256 1 "register_operand")
12599 (match_operand:VI_256 2 "nonimmediate_operand")]
12602 rtx t1 = gen_reg_rtx (<MODE>mode);
12603 rtx t2 = gen_reg_rtx (<MODE>mode);
12604 rtx t3 = gen_reg_rtx (V4DImode);
12605 emit_insn (gen_avx2_interleave_low<mode> (t1, operands[1], operands[2]));
12606 emit_insn (gen_avx2_interleave_high<mode> (t2, operands[1], operands[2]));
12607 emit_insn (gen_avx2_permv2ti (t3, gen_lowpart (V4DImode, t1),
12608 gen_lowpart (V4DImode, t2),
12609 GEN_INT (1 + (3 << 4))));
12610 emit_move_insn (operands[0], gen_lowpart (<MODE>mode, t3));
12614 (define_expand "vec_interleave_low<mode>"
12615 [(match_operand:VI_256 0 "register_operand")
12616 (match_operand:VI_256 1 "register_operand")
12617 (match_operand:VI_256 2 "nonimmediate_operand")]
12620 rtx t1 = gen_reg_rtx (<MODE>mode);
12621 rtx t2 = gen_reg_rtx (<MODE>mode);
12622 rtx t3 = gen_reg_rtx (V4DImode);
12623 emit_insn (gen_avx2_interleave_low<mode> (t1, operands[1], operands[2]));
12624 emit_insn (gen_avx2_interleave_high<mode> (t2, operands[1], operands[2]));
12625 emit_insn (gen_avx2_permv2ti (t3, gen_lowpart (V4DImode, t1),
12626 gen_lowpart (V4DImode, t2),
12627 GEN_INT (0 + (2 << 4))));
12628 emit_move_insn (operands[0], gen_lowpart (<MODE>mode, t3));
12632 ;; Modes handled by pinsr patterns.
12633 (define_mode_iterator PINSR_MODE
12634 [(V16QI "TARGET_SSE4_1") V8HI
12635 (V4SI "TARGET_SSE4_1")
12636 (V2DI "TARGET_SSE4_1 && TARGET_64BIT")])
12638 (define_mode_attr sse2p4_1
12639 [(V16QI "sse4_1") (V8HI "sse2")
12640 (V4SI "sse4_1") (V2DI "sse4_1")])
12642 (define_mode_attr pinsr_evex_isa
12643 [(V16QI "avx512bw") (V8HI "avx512bw")
12644 (V4SI "avx512dq") (V2DI "avx512dq")])
12646 ;; sse4_1_pinsrd must come before sse2_loadld since it is preferred.
12647 (define_insn "<sse2p4_1>_pinsr<ssemodesuffix>"
12648 [(set (match_operand:PINSR_MODE 0 "register_operand" "=x,x,x,x,v,v")
12649 (vec_merge:PINSR_MODE
12650 (vec_duplicate:PINSR_MODE
12651 (match_operand:<ssescalarmode> 2 "nonimmediate_operand" "r,m,r,m,r,m"))
12652 (match_operand:PINSR_MODE 1 "register_operand" "0,0,x,x,v,v")
12653 (match_operand:SI 3 "const_int_operand")))]
12655 && ((unsigned) exact_log2 (INTVAL (operands[3]))
12656 < GET_MODE_NUNITS (<MODE>mode))"
12658 operands[3] = GEN_INT (exact_log2 (INTVAL (operands[3])));
12660 switch (which_alternative)
12663 if (GET_MODE_SIZE (<ssescalarmode>mode) < GET_MODE_SIZE (SImode))
12664 return "pinsr<ssemodesuffix>\t{%3, %k2, %0|%0, %k2, %3}";
12667 return "pinsr<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}";
12670 if (GET_MODE_SIZE (<ssescalarmode>mode) < GET_MODE_SIZE (SImode))
12671 return "vpinsr<ssemodesuffix>\t{%3, %k2, %1, %0|%0, %1, %k2, %3}";
12675 return "vpinsr<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}";
12677 gcc_unreachable ();
12680 [(set_attr "isa" "noavx,noavx,avx,avx,<pinsr_evex_isa>,<pinsr_evex_isa>")
12681 (set_attr "type" "sselog")
12682 (set (attr "prefix_rex")
12684 (and (not (match_test "TARGET_AVX"))
12685 (eq (const_string "<MODE>mode") (const_string "V2DImode")))
12687 (const_string "*")))
12688 (set (attr "prefix_data16")
12690 (and (not (match_test "TARGET_AVX"))
12691 (eq (const_string "<MODE>mode") (const_string "V8HImode")))
12693 (const_string "*")))
12694 (set (attr "prefix_extra")
12696 (and (not (match_test "TARGET_AVX"))
12697 (eq (const_string "<MODE>mode") (const_string "V8HImode")))
12699 (const_string "1")))
12700 (set_attr "length_immediate" "1")
12701 (set_attr "prefix" "orig,orig,vex,vex,evex,evex")
12702 (set_attr "mode" "TI")])
12704 (define_expand "<extract_type>_vinsert<shuffletype><extract_suf>_mask"
12705 [(match_operand:AVX512_VEC 0 "register_operand")
12706 (match_operand:AVX512_VEC 1 "register_operand")
12707 (match_operand:<ssequartermode> 2 "nonimmediate_operand")
12708 (match_operand:SI 3 "const_0_to_3_operand")
12709 (match_operand:AVX512_VEC 4 "register_operand")
12710 (match_operand:<avx512fmaskmode> 5 "register_operand")]
12713 int mask, selector;
12714 mask = INTVAL (operands[3]);
12715 selector = (GET_MODE_UNIT_SIZE (<MODE>mode) == 4
12716 ? 0xFFFF ^ (0x000F << mask * 4)
12717 : 0xFF ^ (0x03 << mask * 2));
12718 emit_insn (gen_<extract_type>_vinsert<shuffletype><extract_suf>_1_mask
12719 (operands[0], operands[1], operands[2], GEN_INT (selector),
12720 operands[4], operands[5]));
12724 (define_insn "<mask_codefor><extract_type>_vinsert<shuffletype><extract_suf>_1<mask_name>"
12725 [(set (match_operand:AVX512_VEC 0 "register_operand" "=v")
12726 (vec_merge:AVX512_VEC
12727 (match_operand:AVX512_VEC 1 "register_operand" "v")
12728 (vec_duplicate:AVX512_VEC
12729 (match_operand:<ssequartermode> 2 "nonimmediate_operand" "vm"))
12730 (match_operand:SI 3 "const_int_operand" "n")))]
12734 int selector = INTVAL (operands[3]);
12736 if (selector == (GET_MODE_UNIT_SIZE (<MODE>mode) == 4 ? 0xFFF0 : 0xFC))
12738 else if (selector == (GET_MODE_UNIT_SIZE (<MODE>mode) == 4 ? 0xFF0F : 0xF3))
12740 else if (selector == (GET_MODE_UNIT_SIZE (<MODE>mode) == 4 ? 0xF0FF : 0xCF))
12742 else if (selector == (GET_MODE_UNIT_SIZE (<MODE>mode) == 4 ? 0x0FFF : 0x3F))
12745 gcc_unreachable ();
12747 operands[3] = GEN_INT (mask);
12749 return "vinsert<shuffletype><extract_suf>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3}";
12751 [(set_attr "type" "sselog")
12752 (set_attr "length_immediate" "1")
12753 (set_attr "prefix" "evex")
12754 (set_attr "mode" "<sseinsnmode>")])
12756 (define_expand "<extract_type_2>_vinsert<shuffletype><extract_suf_2>_mask"
12757 [(match_operand:AVX512_VEC_2 0 "register_operand")
12758 (match_operand:AVX512_VEC_2 1 "register_operand")
12759 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand")
12760 (match_operand:SI 3 "const_0_to_1_operand")
12761 (match_operand:AVX512_VEC_2 4 "register_operand")
12762 (match_operand:<avx512fmaskmode> 5 "register_operand")]
12765 int mask = INTVAL (operands[3]);
12767 emit_insn (gen_vec_set_lo_<mode>_mask (operands[0], operands[1],
12768 operands[2], operands[4],
12771 emit_insn (gen_vec_set_hi_<mode>_mask (operands[0], operands[1],
12772 operands[2], operands[4],
12777 (define_insn "vec_set_lo_<mode><mask_name>"
12778 [(set (match_operand:V16FI 0 "register_operand" "=v")
12780 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
12781 (vec_select:<ssehalfvecmode>
12782 (match_operand:V16FI 1 "register_operand" "v")
12783 (parallel [(const_int 8) (const_int 9)
12784 (const_int 10) (const_int 11)
12785 (const_int 12) (const_int 13)
12786 (const_int 14) (const_int 15)]))))]
12788 "vinsert<shuffletype>32x8\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}"
12789 [(set_attr "type" "sselog")
12790 (set_attr "length_immediate" "1")
12791 (set_attr "prefix" "evex")
12792 (set_attr "mode" "<sseinsnmode>")])
12794 (define_insn "vec_set_hi_<mode><mask_name>"
12795 [(set (match_operand:V16FI 0 "register_operand" "=v")
12797 (vec_select:<ssehalfvecmode>
12798 (match_operand:V16FI 1 "register_operand" "v")
12799 (parallel [(const_int 0) (const_int 1)
12800 (const_int 2) (const_int 3)
12801 (const_int 4) (const_int 5)
12802 (const_int 6) (const_int 7)]))
12803 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
12805 "vinsert<shuffletype>32x8\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}"
12806 [(set_attr "type" "sselog")
12807 (set_attr "length_immediate" "1")
12808 (set_attr "prefix" "evex")
12809 (set_attr "mode" "<sseinsnmode>")])
12811 (define_insn "vec_set_lo_<mode><mask_name>"
12812 [(set (match_operand:V8FI 0 "register_operand" "=v")
12814 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
12815 (vec_select:<ssehalfvecmode>
12816 (match_operand:V8FI 1 "register_operand" "v")
12817 (parallel [(const_int 4) (const_int 5)
12818 (const_int 6) (const_int 7)]))))]
12820 "vinsert<shuffletype>64x4\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}"
12821 [(set_attr "type" "sselog")
12822 (set_attr "length_immediate" "1")
12823 (set_attr "prefix" "evex")
12824 (set_attr "mode" "XI")])
12826 (define_insn "vec_set_hi_<mode><mask_name>"
12827 [(set (match_operand:V8FI 0 "register_operand" "=v")
12829 (vec_select:<ssehalfvecmode>
12830 (match_operand:V8FI 1 "register_operand" "v")
12831 (parallel [(const_int 0) (const_int 1)
12832 (const_int 2) (const_int 3)]))
12833 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
12835 "vinsert<shuffletype>64x4\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}"
12836 [(set_attr "type" "sselog")
12837 (set_attr "length_immediate" "1")
12838 (set_attr "prefix" "evex")
12839 (set_attr "mode" "XI")])
12841 (define_expand "avx512dq_shuf_<shuffletype>64x2_mask"
12842 [(match_operand:VI8F_256 0 "register_operand")
12843 (match_operand:VI8F_256 1 "register_operand")
12844 (match_operand:VI8F_256 2 "nonimmediate_operand")
12845 (match_operand:SI 3 "const_0_to_3_operand")
12846 (match_operand:VI8F_256 4 "register_operand")
12847 (match_operand:QI 5 "register_operand")]
12850 int mask = INTVAL (operands[3]);
12851 emit_insn (gen_avx512dq_shuf_<shuffletype>64x2_1_mask
12852 (operands[0], operands[1], operands[2],
12853 GEN_INT (((mask >> 0) & 1) * 2 + 0),
12854 GEN_INT (((mask >> 0) & 1) * 2 + 1),
12855 GEN_INT (((mask >> 1) & 1) * 2 + 4),
12856 GEN_INT (((mask >> 1) & 1) * 2 + 5),
12857 operands[4], operands[5]));
12861 (define_insn "<mask_codefor>avx512dq_shuf_<shuffletype>64x2_1<mask_name>"
12862 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
12863 (vec_select:VI8F_256
12864 (vec_concat:<ssedoublemode>
12865 (match_operand:VI8F_256 1 "register_operand" "v")
12866 (match_operand:VI8F_256 2 "nonimmediate_operand" "vm"))
12867 (parallel [(match_operand 3 "const_0_to_3_operand")
12868 (match_operand 4 "const_0_to_3_operand")
12869 (match_operand 5 "const_4_to_7_operand")
12870 (match_operand 6 "const_4_to_7_operand")])))]
12872 && (INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
12873 && INTVAL (operands[5]) == (INTVAL (operands[6]) - 1))"
12876 mask = INTVAL (operands[3]) / 2;
12877 mask |= (INTVAL (operands[5]) - 4) / 2 << 1;
12878 operands[3] = GEN_INT (mask);
12879 return "vshuf<shuffletype>64x2\t{%3, %2, %1, %0<mask_operand7>|%0<mask_operand7>, %1, %2, %3}";
12881 [(set_attr "type" "sselog")
12882 (set_attr "length_immediate" "1")
12883 (set_attr "prefix" "evex")
12884 (set_attr "mode" "XI")])
12886 (define_expand "avx512f_shuf_<shuffletype>64x2_mask"
12887 [(match_operand:V8FI 0 "register_operand")
12888 (match_operand:V8FI 1 "register_operand")
12889 (match_operand:V8FI 2 "nonimmediate_operand")
12890 (match_operand:SI 3 "const_0_to_255_operand")
12891 (match_operand:V8FI 4 "register_operand")
12892 (match_operand:QI 5 "register_operand")]
12895 int mask = INTVAL (operands[3]);
12896 emit_insn (gen_avx512f_shuf_<shuffletype>64x2_1_mask
12897 (operands[0], operands[1], operands[2],
12898 GEN_INT (((mask >> 0) & 3) * 2),
12899 GEN_INT (((mask >> 0) & 3) * 2 + 1),
12900 GEN_INT (((mask >> 2) & 3) * 2),
12901 GEN_INT (((mask >> 2) & 3) * 2 + 1),
12902 GEN_INT (((mask >> 4) & 3) * 2 + 8),
12903 GEN_INT (((mask >> 4) & 3) * 2 + 9),
12904 GEN_INT (((mask >> 6) & 3) * 2 + 8),
12905 GEN_INT (((mask >> 6) & 3) * 2 + 9),
12906 operands[4], operands[5]));
12910 (define_insn "avx512f_shuf_<shuffletype>64x2_1<mask_name>"
12911 [(set (match_operand:V8FI 0 "register_operand" "=v")
12913 (vec_concat:<ssedoublemode>
12914 (match_operand:V8FI 1 "register_operand" "v")
12915 (match_operand:V8FI 2 "nonimmediate_operand" "vm"))
12916 (parallel [(match_operand 3 "const_0_to_7_operand")
12917 (match_operand 4 "const_0_to_7_operand")
12918 (match_operand 5 "const_0_to_7_operand")
12919 (match_operand 6 "const_0_to_7_operand")
12920 (match_operand 7 "const_8_to_15_operand")
12921 (match_operand 8 "const_8_to_15_operand")
12922 (match_operand 9 "const_8_to_15_operand")
12923 (match_operand 10 "const_8_to_15_operand")])))]
12925 && (INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
12926 && INTVAL (operands[5]) == (INTVAL (operands[6]) - 1)
12927 && INTVAL (operands[7]) == (INTVAL (operands[8]) - 1)
12928 && INTVAL (operands[9]) == (INTVAL (operands[10]) - 1))"
12931 mask = INTVAL (operands[3]) / 2;
12932 mask |= INTVAL (operands[5]) / 2 << 2;
12933 mask |= (INTVAL (operands[7]) - 8) / 2 << 4;
12934 mask |= (INTVAL (operands[9]) - 8) / 2 << 6;
12935 operands[3] = GEN_INT (mask);
12937 return "vshuf<shuffletype>64x2\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
12939 [(set_attr "type" "sselog")
12940 (set_attr "length_immediate" "1")
12941 (set_attr "prefix" "evex")
12942 (set_attr "mode" "<sseinsnmode>")])
12944 (define_expand "avx512vl_shuf_<shuffletype>32x4_mask"
12945 [(match_operand:VI4F_256 0 "register_operand")
12946 (match_operand:VI4F_256 1 "register_operand")
12947 (match_operand:VI4F_256 2 "nonimmediate_operand")
12948 (match_operand:SI 3 "const_0_to_3_operand")
12949 (match_operand:VI4F_256 4 "register_operand")
12950 (match_operand:QI 5 "register_operand")]
12953 int mask = INTVAL (operands[3]);
12954 emit_insn (gen_avx512vl_shuf_<shuffletype>32x4_1_mask
12955 (operands[0], operands[1], operands[2],
12956 GEN_INT (((mask >> 0) & 1) * 4 + 0),
12957 GEN_INT (((mask >> 0) & 1) * 4 + 1),
12958 GEN_INT (((mask >> 0) & 1) * 4 + 2),
12959 GEN_INT (((mask >> 0) & 1) * 4 + 3),
12960 GEN_INT (((mask >> 1) & 1) * 4 + 8),
12961 GEN_INT (((mask >> 1) & 1) * 4 + 9),
12962 GEN_INT (((mask >> 1) & 1) * 4 + 10),
12963 GEN_INT (((mask >> 1) & 1) * 4 + 11),
12964 operands[4], operands[5]));
12968 (define_insn "avx512vl_shuf_<shuffletype>32x4_1<mask_name>"
12969 [(set (match_operand:VI4F_256 0 "register_operand" "=v")
12970 (vec_select:VI4F_256
12971 (vec_concat:<ssedoublemode>
12972 (match_operand:VI4F_256 1 "register_operand" "v")
12973 (match_operand:VI4F_256 2 "nonimmediate_operand" "vm"))
12974 (parallel [(match_operand 3 "const_0_to_7_operand")
12975 (match_operand 4 "const_0_to_7_operand")
12976 (match_operand 5 "const_0_to_7_operand")
12977 (match_operand 6 "const_0_to_7_operand")
12978 (match_operand 7 "const_8_to_15_operand")
12979 (match_operand 8 "const_8_to_15_operand")
12980 (match_operand 9 "const_8_to_15_operand")
12981 (match_operand 10 "const_8_to_15_operand")])))]
12983 && (INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
12984 && INTVAL (operands[3]) == (INTVAL (operands[5]) - 2)
12985 && INTVAL (operands[3]) == (INTVAL (operands[6]) - 3)
12986 && INTVAL (operands[7]) == (INTVAL (operands[8]) - 1)
12987 && INTVAL (operands[7]) == (INTVAL (operands[9]) - 2)
12988 && INTVAL (operands[7]) == (INTVAL (operands[10]) - 3))"
12991 mask = INTVAL (operands[3]) / 4;
12992 mask |= (INTVAL (operands[7]) - 8) / 4 << 1;
12993 operands[3] = GEN_INT (mask);
12995 return "vshuf<shuffletype>32x4\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
12997 [(set_attr "type" "sselog")
12998 (set_attr "length_immediate" "1")
12999 (set_attr "prefix" "evex")
13000 (set_attr "mode" "<sseinsnmode>")])
13002 (define_expand "avx512f_shuf_<shuffletype>32x4_mask"
13003 [(match_operand:V16FI 0 "register_operand")
13004 (match_operand:V16FI 1 "register_operand")
13005 (match_operand:V16FI 2 "nonimmediate_operand")
13006 (match_operand:SI 3 "const_0_to_255_operand")
13007 (match_operand:V16FI 4 "register_operand")
13008 (match_operand:HI 5 "register_operand")]
13011 int mask = INTVAL (operands[3]);
13012 emit_insn (gen_avx512f_shuf_<shuffletype>32x4_1_mask
13013 (operands[0], operands[1], operands[2],
13014 GEN_INT (((mask >> 0) & 3) * 4),
13015 GEN_INT (((mask >> 0) & 3) * 4 + 1),
13016 GEN_INT (((mask >> 0) & 3) * 4 + 2),
13017 GEN_INT (((mask >> 0) & 3) * 4 + 3),
13018 GEN_INT (((mask >> 2) & 3) * 4),
13019 GEN_INT (((mask >> 2) & 3) * 4 + 1),
13020 GEN_INT (((mask >> 2) & 3) * 4 + 2),
13021 GEN_INT (((mask >> 2) & 3) * 4 + 3),
13022 GEN_INT (((mask >> 4) & 3) * 4 + 16),
13023 GEN_INT (((mask >> 4) & 3) * 4 + 17),
13024 GEN_INT (((mask >> 4) & 3) * 4 + 18),
13025 GEN_INT (((mask >> 4) & 3) * 4 + 19),
13026 GEN_INT (((mask >> 6) & 3) * 4 + 16),
13027 GEN_INT (((mask >> 6) & 3) * 4 + 17),
13028 GEN_INT (((mask >> 6) & 3) * 4 + 18),
13029 GEN_INT (((mask >> 6) & 3) * 4 + 19),
13030 operands[4], operands[5]));
13034 (define_insn "avx512f_shuf_<shuffletype>32x4_1<mask_name>"
13035 [(set (match_operand:V16FI 0 "register_operand" "=v")
13037 (vec_concat:<ssedoublemode>
13038 (match_operand:V16FI 1 "register_operand" "v")
13039 (match_operand:V16FI 2 "nonimmediate_operand" "vm"))
13040 (parallel [(match_operand 3 "const_0_to_15_operand")
13041 (match_operand 4 "const_0_to_15_operand")
13042 (match_operand 5 "const_0_to_15_operand")
13043 (match_operand 6 "const_0_to_15_operand")
13044 (match_operand 7 "const_0_to_15_operand")
13045 (match_operand 8 "const_0_to_15_operand")
13046 (match_operand 9 "const_0_to_15_operand")
13047 (match_operand 10 "const_0_to_15_operand")
13048 (match_operand 11 "const_16_to_31_operand")
13049 (match_operand 12 "const_16_to_31_operand")
13050 (match_operand 13 "const_16_to_31_operand")
13051 (match_operand 14 "const_16_to_31_operand")
13052 (match_operand 15 "const_16_to_31_operand")
13053 (match_operand 16 "const_16_to_31_operand")
13054 (match_operand 17 "const_16_to_31_operand")
13055 (match_operand 18 "const_16_to_31_operand")])))]
13057 && (INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
13058 && INTVAL (operands[3]) == (INTVAL (operands[5]) - 2)
13059 && INTVAL (operands[3]) == (INTVAL (operands[6]) - 3)
13060 && INTVAL (operands[7]) == (INTVAL (operands[8]) - 1)
13061 && INTVAL (operands[7]) == (INTVAL (operands[9]) - 2)
13062 && INTVAL (operands[7]) == (INTVAL (operands[10]) - 3)
13063 && INTVAL (operands[11]) == (INTVAL (operands[12]) - 1)
13064 && INTVAL (operands[11]) == (INTVAL (operands[13]) - 2)
13065 && INTVAL (operands[11]) == (INTVAL (operands[14]) - 3)
13066 && INTVAL (operands[15]) == (INTVAL (operands[16]) - 1)
13067 && INTVAL (operands[15]) == (INTVAL (operands[17]) - 2)
13068 && INTVAL (operands[15]) == (INTVAL (operands[18]) - 3))"
13071 mask = INTVAL (operands[3]) / 4;
13072 mask |= INTVAL (operands[7]) / 4 << 2;
13073 mask |= (INTVAL (operands[11]) - 16) / 4 << 4;
13074 mask |= (INTVAL (operands[15]) - 16) / 4 << 6;
13075 operands[3] = GEN_INT (mask);
13077 return "vshuf<shuffletype>32x4\t{%3, %2, %1, %0<mask_operand19>|%0<mask_operand19>, %1, %2, %3}";
13079 [(set_attr "type" "sselog")
13080 (set_attr "length_immediate" "1")
13081 (set_attr "prefix" "evex")
13082 (set_attr "mode" "<sseinsnmode>")])
13084 (define_expand "avx512f_pshufdv3_mask"
13085 [(match_operand:V16SI 0 "register_operand")
13086 (match_operand:V16SI 1 "nonimmediate_operand")
13087 (match_operand:SI 2 "const_0_to_255_operand")
13088 (match_operand:V16SI 3 "register_operand")
13089 (match_operand:HI 4 "register_operand")]
13092 int mask = INTVAL (operands[2]);
13093 emit_insn (gen_avx512f_pshufd_1_mask (operands[0], operands[1],
13094 GEN_INT ((mask >> 0) & 3),
13095 GEN_INT ((mask >> 2) & 3),
13096 GEN_INT ((mask >> 4) & 3),
13097 GEN_INT ((mask >> 6) & 3),
13098 GEN_INT (((mask >> 0) & 3) + 4),
13099 GEN_INT (((mask >> 2) & 3) + 4),
13100 GEN_INT (((mask >> 4) & 3) + 4),
13101 GEN_INT (((mask >> 6) & 3) + 4),
13102 GEN_INT (((mask >> 0) & 3) + 8),
13103 GEN_INT (((mask >> 2) & 3) + 8),
13104 GEN_INT (((mask >> 4) & 3) + 8),
13105 GEN_INT (((mask >> 6) & 3) + 8),
13106 GEN_INT (((mask >> 0) & 3) + 12),
13107 GEN_INT (((mask >> 2) & 3) + 12),
13108 GEN_INT (((mask >> 4) & 3) + 12),
13109 GEN_INT (((mask >> 6) & 3) + 12),
13110 operands[3], operands[4]));
13114 (define_insn "avx512f_pshufd_1<mask_name>"
13115 [(set (match_operand:V16SI 0 "register_operand" "=v")
13117 (match_operand:V16SI 1 "nonimmediate_operand" "vm")
13118 (parallel [(match_operand 2 "const_0_to_3_operand")
13119 (match_operand 3 "const_0_to_3_operand")
13120 (match_operand 4 "const_0_to_3_operand")
13121 (match_operand 5 "const_0_to_3_operand")
13122 (match_operand 6 "const_4_to_7_operand")
13123 (match_operand 7 "const_4_to_7_operand")
13124 (match_operand 8 "const_4_to_7_operand")
13125 (match_operand 9 "const_4_to_7_operand")
13126 (match_operand 10 "const_8_to_11_operand")
13127 (match_operand 11 "const_8_to_11_operand")
13128 (match_operand 12 "const_8_to_11_operand")
13129 (match_operand 13 "const_8_to_11_operand")
13130 (match_operand 14 "const_12_to_15_operand")
13131 (match_operand 15 "const_12_to_15_operand")
13132 (match_operand 16 "const_12_to_15_operand")
13133 (match_operand 17 "const_12_to_15_operand")])))]
13135 && INTVAL (operands[2]) + 4 == INTVAL (operands[6])
13136 && INTVAL (operands[3]) + 4 == INTVAL (operands[7])
13137 && INTVAL (operands[4]) + 4 == INTVAL (operands[8])
13138 && INTVAL (operands[5]) + 4 == INTVAL (operands[9])
13139 && INTVAL (operands[2]) + 8 == INTVAL (operands[10])
13140 && INTVAL (operands[3]) + 8 == INTVAL (operands[11])
13141 && INTVAL (operands[4]) + 8 == INTVAL (operands[12])
13142 && INTVAL (operands[5]) + 8 == INTVAL (operands[13])
13143 && INTVAL (operands[2]) + 12 == INTVAL (operands[14])
13144 && INTVAL (operands[3]) + 12 == INTVAL (operands[15])
13145 && INTVAL (operands[4]) + 12 == INTVAL (operands[16])
13146 && INTVAL (operands[5]) + 12 == INTVAL (operands[17])"
13149 mask |= INTVAL (operands[2]) << 0;
13150 mask |= INTVAL (operands[3]) << 2;
13151 mask |= INTVAL (operands[4]) << 4;
13152 mask |= INTVAL (operands[5]) << 6;
13153 operands[2] = GEN_INT (mask);
13155 return "vpshufd\t{%2, %1, %0<mask_operand18>|%0<mask_operand18>, %1, %2}";
13157 [(set_attr "type" "sselog1")
13158 (set_attr "prefix" "evex")
13159 (set_attr "length_immediate" "1")
13160 (set_attr "mode" "XI")])
13162 (define_expand "avx512vl_pshufdv3_mask"
13163 [(match_operand:V8SI 0 "register_operand")
13164 (match_operand:V8SI 1 "nonimmediate_operand")
13165 (match_operand:SI 2 "const_0_to_255_operand")
13166 (match_operand:V8SI 3 "register_operand")
13167 (match_operand:QI 4 "register_operand")]
13170 int mask = INTVAL (operands[2]);
13171 emit_insn (gen_avx2_pshufd_1_mask (operands[0], operands[1],
13172 GEN_INT ((mask >> 0) & 3),
13173 GEN_INT ((mask >> 2) & 3),
13174 GEN_INT ((mask >> 4) & 3),
13175 GEN_INT ((mask >> 6) & 3),
13176 GEN_INT (((mask >> 0) & 3) + 4),
13177 GEN_INT (((mask >> 2) & 3) + 4),
13178 GEN_INT (((mask >> 4) & 3) + 4),
13179 GEN_INT (((mask >> 6) & 3) + 4),
13180 operands[3], operands[4]));
13184 (define_expand "avx2_pshufdv3"
13185 [(match_operand:V8SI 0 "register_operand")
13186 (match_operand:V8SI 1 "nonimmediate_operand")
13187 (match_operand:SI 2 "const_0_to_255_operand")]
13190 int mask = INTVAL (operands[2]);
13191 emit_insn (gen_avx2_pshufd_1 (operands[0], operands[1],
13192 GEN_INT ((mask >> 0) & 3),
13193 GEN_INT ((mask >> 2) & 3),
13194 GEN_INT ((mask >> 4) & 3),
13195 GEN_INT ((mask >> 6) & 3),
13196 GEN_INT (((mask >> 0) & 3) + 4),
13197 GEN_INT (((mask >> 2) & 3) + 4),
13198 GEN_INT (((mask >> 4) & 3) + 4),
13199 GEN_INT (((mask >> 6) & 3) + 4)));
13203 (define_insn "avx2_pshufd_1<mask_name>"
13204 [(set (match_operand:V8SI 0 "register_operand" "=v")
13206 (match_operand:V8SI 1 "nonimmediate_operand" "vm")
13207 (parallel [(match_operand 2 "const_0_to_3_operand")
13208 (match_operand 3 "const_0_to_3_operand")
13209 (match_operand 4 "const_0_to_3_operand")
13210 (match_operand 5 "const_0_to_3_operand")
13211 (match_operand 6 "const_4_to_7_operand")
13212 (match_operand 7 "const_4_to_7_operand")
13213 (match_operand 8 "const_4_to_7_operand")
13214 (match_operand 9 "const_4_to_7_operand")])))]
13216 && <mask_avx512vl_condition>
13217 && INTVAL (operands[2]) + 4 == INTVAL (operands[6])
13218 && INTVAL (operands[3]) + 4 == INTVAL (operands[7])
13219 && INTVAL (operands[4]) + 4 == INTVAL (operands[8])
13220 && INTVAL (operands[5]) + 4 == INTVAL (operands[9])"
13223 mask |= INTVAL (operands[2]) << 0;
13224 mask |= INTVAL (operands[3]) << 2;
13225 mask |= INTVAL (operands[4]) << 4;
13226 mask |= INTVAL (operands[5]) << 6;
13227 operands[2] = GEN_INT (mask);
13229 return "vpshufd\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
13231 [(set_attr "type" "sselog1")
13232 (set_attr "prefix" "maybe_evex")
13233 (set_attr "length_immediate" "1")
13234 (set_attr "mode" "OI")])
13236 (define_expand "avx512vl_pshufd_mask"
13237 [(match_operand:V4SI 0 "register_operand")
13238 (match_operand:V4SI 1 "nonimmediate_operand")
13239 (match_operand:SI 2 "const_0_to_255_operand")
13240 (match_operand:V4SI 3 "register_operand")
13241 (match_operand:QI 4 "register_operand")]
13244 int mask = INTVAL (operands[2]);
13245 emit_insn (gen_sse2_pshufd_1_mask (operands[0], operands[1],
13246 GEN_INT ((mask >> 0) & 3),
13247 GEN_INT ((mask >> 2) & 3),
13248 GEN_INT ((mask >> 4) & 3),
13249 GEN_INT ((mask >> 6) & 3),
13250 operands[3], operands[4]));
13254 (define_expand "sse2_pshufd"
13255 [(match_operand:V4SI 0 "register_operand")
13256 (match_operand:V4SI 1 "vector_operand")
13257 (match_operand:SI 2 "const_int_operand")]
13260 int mask = INTVAL (operands[2]);
13261 emit_insn (gen_sse2_pshufd_1 (operands[0], operands[1],
13262 GEN_INT ((mask >> 0) & 3),
13263 GEN_INT ((mask >> 2) & 3),
13264 GEN_INT ((mask >> 4) & 3),
13265 GEN_INT ((mask >> 6) & 3)));
13269 (define_insn "sse2_pshufd_1<mask_name>"
13270 [(set (match_operand:V4SI 0 "register_operand" "=v")
13272 (match_operand:V4SI 1 "vector_operand" "vBm")
13273 (parallel [(match_operand 2 "const_0_to_3_operand")
13274 (match_operand 3 "const_0_to_3_operand")
13275 (match_operand 4 "const_0_to_3_operand")
13276 (match_operand 5 "const_0_to_3_operand")])))]
13277 "TARGET_SSE2 && <mask_avx512vl_condition>"
13280 mask |= INTVAL (operands[2]) << 0;
13281 mask |= INTVAL (operands[3]) << 2;
13282 mask |= INTVAL (operands[4]) << 4;
13283 mask |= INTVAL (operands[5]) << 6;
13284 operands[2] = GEN_INT (mask);
13286 return "%vpshufd\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
13288 [(set_attr "type" "sselog1")
13289 (set_attr "prefix_data16" "1")
13290 (set_attr "prefix" "<mask_prefix2>")
13291 (set_attr "length_immediate" "1")
13292 (set_attr "mode" "TI")])
13294 (define_insn "<mask_codefor>avx512bw_pshuflwv32hi<mask_name>"
13295 [(set (match_operand:V32HI 0 "register_operand" "=v")
13297 [(match_operand:V32HI 1 "nonimmediate_operand" "vm")
13298 (match_operand:SI 2 "const_0_to_255_operand" "n")]
13301 "vpshuflw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13302 [(set_attr "type" "sselog")
13303 (set_attr "prefix" "evex")
13304 (set_attr "mode" "XI")])
13306 (define_expand "avx512vl_pshuflwv3_mask"
13307 [(match_operand:V16HI 0 "register_operand")
13308 (match_operand:V16HI 1 "nonimmediate_operand")
13309 (match_operand:SI 2 "const_0_to_255_operand")
13310 (match_operand:V16HI 3 "register_operand")
13311 (match_operand:HI 4 "register_operand")]
13312 "TARGET_AVX512VL && TARGET_AVX512BW"
13314 int mask = INTVAL (operands[2]);
13315 emit_insn (gen_avx2_pshuflw_1_mask (operands[0], operands[1],
13316 GEN_INT ((mask >> 0) & 3),
13317 GEN_INT ((mask >> 2) & 3),
13318 GEN_INT ((mask >> 4) & 3),
13319 GEN_INT ((mask >> 6) & 3),
13320 GEN_INT (((mask >> 0) & 3) + 8),
13321 GEN_INT (((mask >> 2) & 3) + 8),
13322 GEN_INT (((mask >> 4) & 3) + 8),
13323 GEN_INT (((mask >> 6) & 3) + 8),
13324 operands[3], operands[4]));
13328 (define_expand "avx2_pshuflwv3"
13329 [(match_operand:V16HI 0 "register_operand")
13330 (match_operand:V16HI 1 "nonimmediate_operand")
13331 (match_operand:SI 2 "const_0_to_255_operand")]
13334 int mask = INTVAL (operands[2]);
13335 emit_insn (gen_avx2_pshuflw_1 (operands[0], operands[1],
13336 GEN_INT ((mask >> 0) & 3),
13337 GEN_INT ((mask >> 2) & 3),
13338 GEN_INT ((mask >> 4) & 3),
13339 GEN_INT ((mask >> 6) & 3),
13340 GEN_INT (((mask >> 0) & 3) + 8),
13341 GEN_INT (((mask >> 2) & 3) + 8),
13342 GEN_INT (((mask >> 4) & 3) + 8),
13343 GEN_INT (((mask >> 6) & 3) + 8)));
13347 (define_insn "avx2_pshuflw_1<mask_name>"
13348 [(set (match_operand:V16HI 0 "register_operand" "=v")
13350 (match_operand:V16HI 1 "nonimmediate_operand" "vm")
13351 (parallel [(match_operand 2 "const_0_to_3_operand")
13352 (match_operand 3 "const_0_to_3_operand")
13353 (match_operand 4 "const_0_to_3_operand")
13354 (match_operand 5 "const_0_to_3_operand")
13359 (match_operand 6 "const_8_to_11_operand")
13360 (match_operand 7 "const_8_to_11_operand")
13361 (match_operand 8 "const_8_to_11_operand")
13362 (match_operand 9 "const_8_to_11_operand")
13366 (const_int 15)])))]
13368 && <mask_avx512bw_condition> && <mask_avx512vl_condition>
13369 && INTVAL (operands[2]) + 8 == INTVAL (operands[6])
13370 && INTVAL (operands[3]) + 8 == INTVAL (operands[7])
13371 && INTVAL (operands[4]) + 8 == INTVAL (operands[8])
13372 && INTVAL (operands[5]) + 8 == INTVAL (operands[9])"
13375 mask |= INTVAL (operands[2]) << 0;
13376 mask |= INTVAL (operands[3]) << 2;
13377 mask |= INTVAL (operands[4]) << 4;
13378 mask |= INTVAL (operands[5]) << 6;
13379 operands[2] = GEN_INT (mask);
13381 return "vpshuflw\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
13383 [(set_attr "type" "sselog")
13384 (set_attr "prefix" "maybe_evex")
13385 (set_attr "length_immediate" "1")
13386 (set_attr "mode" "OI")])
13388 (define_expand "avx512vl_pshuflw_mask"
13389 [(match_operand:V8HI 0 "register_operand")
13390 (match_operand:V8HI 1 "nonimmediate_operand")
13391 (match_operand:SI 2 "const_0_to_255_operand")
13392 (match_operand:V8HI 3 "register_operand")
13393 (match_operand:QI 4 "register_operand")]
13394 "TARGET_AVX512VL && TARGET_AVX512BW"
13396 int mask = INTVAL (operands[2]);
13397 emit_insn (gen_sse2_pshuflw_1_mask (operands[0], operands[1],
13398 GEN_INT ((mask >> 0) & 3),
13399 GEN_INT ((mask >> 2) & 3),
13400 GEN_INT ((mask >> 4) & 3),
13401 GEN_INT ((mask >> 6) & 3),
13402 operands[3], operands[4]));
13406 (define_expand "sse2_pshuflw"
13407 [(match_operand:V8HI 0 "register_operand")
13408 (match_operand:V8HI 1 "vector_operand")
13409 (match_operand:SI 2 "const_int_operand")]
13412 int mask = INTVAL (operands[2]);
13413 emit_insn (gen_sse2_pshuflw_1 (operands[0], operands[1],
13414 GEN_INT ((mask >> 0) & 3),
13415 GEN_INT ((mask >> 2) & 3),
13416 GEN_INT ((mask >> 4) & 3),
13417 GEN_INT ((mask >> 6) & 3)));
13421 (define_insn "sse2_pshuflw_1<mask_name>"
13422 [(set (match_operand:V8HI 0 "register_operand" "=v")
13424 (match_operand:V8HI 1 "vector_operand" "vBm")
13425 (parallel [(match_operand 2 "const_0_to_3_operand")
13426 (match_operand 3 "const_0_to_3_operand")
13427 (match_operand 4 "const_0_to_3_operand")
13428 (match_operand 5 "const_0_to_3_operand")
13433 "TARGET_SSE2 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
13436 mask |= INTVAL (operands[2]) << 0;
13437 mask |= INTVAL (operands[3]) << 2;
13438 mask |= INTVAL (operands[4]) << 4;
13439 mask |= INTVAL (operands[5]) << 6;
13440 operands[2] = GEN_INT (mask);
13442 return "%vpshuflw\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
13444 [(set_attr "type" "sselog")
13445 (set_attr "prefix_data16" "0")
13446 (set_attr "prefix_rep" "1")
13447 (set_attr "prefix" "maybe_vex")
13448 (set_attr "length_immediate" "1")
13449 (set_attr "mode" "TI")])
13451 (define_expand "avx2_pshufhwv3"
13452 [(match_operand:V16HI 0 "register_operand")
13453 (match_operand:V16HI 1 "nonimmediate_operand")
13454 (match_operand:SI 2 "const_0_to_255_operand")]
13457 int mask = INTVAL (operands[2]);
13458 emit_insn (gen_avx2_pshufhw_1 (operands[0], operands[1],
13459 GEN_INT (((mask >> 0) & 3) + 4),
13460 GEN_INT (((mask >> 2) & 3) + 4),
13461 GEN_INT (((mask >> 4) & 3) + 4),
13462 GEN_INT (((mask >> 6) & 3) + 4),
13463 GEN_INT (((mask >> 0) & 3) + 12),
13464 GEN_INT (((mask >> 2) & 3) + 12),
13465 GEN_INT (((mask >> 4) & 3) + 12),
13466 GEN_INT (((mask >> 6) & 3) + 12)));
13470 (define_insn "<mask_codefor>avx512bw_pshufhwv32hi<mask_name>"
13471 [(set (match_operand:V32HI 0 "register_operand" "=v")
13473 [(match_operand:V32HI 1 "nonimmediate_operand" "vm")
13474 (match_operand:SI 2 "const_0_to_255_operand" "n")]
13477 "vpshufhw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13478 [(set_attr "type" "sselog")
13479 (set_attr "prefix" "evex")
13480 (set_attr "mode" "XI")])
13482 (define_expand "avx512vl_pshufhwv3_mask"
13483 [(match_operand:V16HI 0 "register_operand")
13484 (match_operand:V16HI 1 "nonimmediate_operand")
13485 (match_operand:SI 2 "const_0_to_255_operand")
13486 (match_operand:V16HI 3 "register_operand")
13487 (match_operand:HI 4 "register_operand")]
13488 "TARGET_AVX512VL && TARGET_AVX512BW"
13490 int mask = INTVAL (operands[2]);
13491 emit_insn (gen_avx2_pshufhw_1_mask (operands[0], operands[1],
13492 GEN_INT (((mask >> 0) & 3) + 4),
13493 GEN_INT (((mask >> 2) & 3) + 4),
13494 GEN_INT (((mask >> 4) & 3) + 4),
13495 GEN_INT (((mask >> 6) & 3) + 4),
13496 GEN_INT (((mask >> 0) & 3) + 12),
13497 GEN_INT (((mask >> 2) & 3) + 12),
13498 GEN_INT (((mask >> 4) & 3) + 12),
13499 GEN_INT (((mask >> 6) & 3) + 12),
13500 operands[3], operands[4]));
13504 (define_insn "avx2_pshufhw_1<mask_name>"
13505 [(set (match_operand:V16HI 0 "register_operand" "=v")
13507 (match_operand:V16HI 1 "nonimmediate_operand" "vm")
13508 (parallel [(const_int 0)
13512 (match_operand 2 "const_4_to_7_operand")
13513 (match_operand 3 "const_4_to_7_operand")
13514 (match_operand 4 "const_4_to_7_operand")
13515 (match_operand 5 "const_4_to_7_operand")
13520 (match_operand 6 "const_12_to_15_operand")
13521 (match_operand 7 "const_12_to_15_operand")
13522 (match_operand 8 "const_12_to_15_operand")
13523 (match_operand 9 "const_12_to_15_operand")])))]
13525 && <mask_avx512bw_condition> && <mask_avx512vl_condition>
13526 && INTVAL (operands[2]) + 8 == INTVAL (operands[6])
13527 && INTVAL (operands[3]) + 8 == INTVAL (operands[7])
13528 && INTVAL (operands[4]) + 8 == INTVAL (operands[8])
13529 && INTVAL (operands[5]) + 8 == INTVAL (operands[9])"
13532 mask |= (INTVAL (operands[2]) - 4) << 0;
13533 mask |= (INTVAL (operands[3]) - 4) << 2;
13534 mask |= (INTVAL (operands[4]) - 4) << 4;
13535 mask |= (INTVAL (operands[5]) - 4) << 6;
13536 operands[2] = GEN_INT (mask);
13538 return "vpshufhw\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
13540 [(set_attr "type" "sselog")
13541 (set_attr "prefix" "maybe_evex")
13542 (set_attr "length_immediate" "1")
13543 (set_attr "mode" "OI")])
13545 (define_expand "avx512vl_pshufhw_mask"
13546 [(match_operand:V8HI 0 "register_operand")
13547 (match_operand:V8HI 1 "nonimmediate_operand")
13548 (match_operand:SI 2 "const_0_to_255_operand")
13549 (match_operand:V8HI 3 "register_operand")
13550 (match_operand:QI 4 "register_operand")]
13551 "TARGET_AVX512VL && TARGET_AVX512BW"
13553 int mask = INTVAL (operands[2]);
13554 emit_insn (gen_sse2_pshufhw_1_mask (operands[0], operands[1],
13555 GEN_INT (((mask >> 0) & 3) + 4),
13556 GEN_INT (((mask >> 2) & 3) + 4),
13557 GEN_INT (((mask >> 4) & 3) + 4),
13558 GEN_INT (((mask >> 6) & 3) + 4),
13559 operands[3], operands[4]));
13563 (define_expand "sse2_pshufhw"
13564 [(match_operand:V8HI 0 "register_operand")
13565 (match_operand:V8HI 1 "vector_operand")
13566 (match_operand:SI 2 "const_int_operand")]
13569 int mask = INTVAL (operands[2]);
13570 emit_insn (gen_sse2_pshufhw_1 (operands[0], operands[1],
13571 GEN_INT (((mask >> 0) & 3) + 4),
13572 GEN_INT (((mask >> 2) & 3) + 4),
13573 GEN_INT (((mask >> 4) & 3) + 4),
13574 GEN_INT (((mask >> 6) & 3) + 4)));
13578 (define_insn "sse2_pshufhw_1<mask_name>"
13579 [(set (match_operand:V8HI 0 "register_operand" "=v")
13581 (match_operand:V8HI 1 "vector_operand" "vBm")
13582 (parallel [(const_int 0)
13586 (match_operand 2 "const_4_to_7_operand")
13587 (match_operand 3 "const_4_to_7_operand")
13588 (match_operand 4 "const_4_to_7_operand")
13589 (match_operand 5 "const_4_to_7_operand")])))]
13590 "TARGET_SSE2 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
13593 mask |= (INTVAL (operands[2]) - 4) << 0;
13594 mask |= (INTVAL (operands[3]) - 4) << 2;
13595 mask |= (INTVAL (operands[4]) - 4) << 4;
13596 mask |= (INTVAL (operands[5]) - 4) << 6;
13597 operands[2] = GEN_INT (mask);
13599 return "%vpshufhw\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
13601 [(set_attr "type" "sselog")
13602 (set_attr "prefix_rep" "1")
13603 (set_attr "prefix_data16" "0")
13604 (set_attr "prefix" "maybe_vex")
13605 (set_attr "length_immediate" "1")
13606 (set_attr "mode" "TI")])
13608 (define_expand "sse2_loadd"
13609 [(set (match_operand:V4SI 0 "register_operand")
13611 (vec_duplicate:V4SI
13612 (match_operand:SI 1 "nonimmediate_operand"))
13616 "operands[2] = CONST0_RTX (V4SImode);")
13618 (define_insn "sse2_loadld"
13619 [(set (match_operand:V4SI 0 "register_operand" "=v,v,x,x,v")
13621 (vec_duplicate:V4SI
13622 (match_operand:SI 2 "nonimmediate_operand" "m ,r ,m,x,v"))
13623 (match_operand:V4SI 1 "reg_or_0_operand" "C ,C ,C,0,v")
13627 %vmovd\t{%2, %0|%0, %2}
13628 %vmovd\t{%2, %0|%0, %2}
13629 movss\t{%2, %0|%0, %2}
13630 movss\t{%2, %0|%0, %2}
13631 vmovss\t{%2, %1, %0|%0, %1, %2}"
13632 [(set_attr "isa" "sse2,sse2,noavx,noavx,avx")
13633 (set_attr "type" "ssemov")
13634 (set_attr "prefix" "maybe_vex,maybe_vex,orig,orig,maybe_evex")
13635 (set_attr "mode" "TI,TI,V4SF,SF,SF")
13636 (set (attr "preferred_for_speed")
13637 (cond [(eq_attr "alternative" "1")
13638 (symbol_ref "TARGET_INTER_UNIT_MOVES_TO_VEC")
13640 (symbol_ref "true")))])
13642 ;; QI and HI modes handled by pextr patterns.
13643 (define_mode_iterator PEXTR_MODE12
13644 [(V16QI "TARGET_SSE4_1") V8HI])
13646 (define_insn "*vec_extract<mode>"
13647 [(set (match_operand:<ssescalarmode> 0 "register_sse4nonimm_operand" "=r,m,r,m")
13648 (vec_select:<ssescalarmode>
13649 (match_operand:PEXTR_MODE12 1 "register_operand" "x,x,v,v")
13651 [(match_operand:SI 2 "const_0_to_<ssescalarnummask>_operand")])))]
13654 %vpextr<ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}
13655 %vpextr<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
13656 vpextr<ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}
13657 vpextr<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
13658 [(set_attr "isa" "*,sse4,avx512bw,avx512bw")
13659 (set_attr "type" "sselog1")
13660 (set_attr "prefix_data16" "1")
13661 (set (attr "prefix_extra")
13663 (and (eq_attr "alternative" "0,2")
13664 (eq (const_string "<MODE>mode") (const_string "V8HImode")))
13666 (const_string "1")))
13667 (set_attr "length_immediate" "1")
13668 (set_attr "prefix" "maybe_vex,maybe_vex,evex,evex")
13669 (set_attr "mode" "TI")])
13671 (define_insn "*vec_extract<PEXTR_MODE12:mode>_zext"
13672 [(set (match_operand:SWI48 0 "register_operand" "=r,r")
13674 (vec_select:<PEXTR_MODE12:ssescalarmode>
13675 (match_operand:PEXTR_MODE12 1 "register_operand" "x,v")
13677 [(match_operand:SI 2
13678 "const_0_to_<PEXTR_MODE12:ssescalarnummask>_operand")]))))]
13681 %vpextr<PEXTR_MODE12:ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}
13682 vpextr<PEXTR_MODE12:ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}"
13683 [(set_attr "isa" "*,avx512bw")
13684 (set_attr "type" "sselog1")
13685 (set_attr "prefix_data16" "1")
13686 (set (attr "prefix_extra")
13688 (eq (const_string "<PEXTR_MODE12:MODE>mode") (const_string "V8HImode"))
13690 (const_string "1")))
13691 (set_attr "length_immediate" "1")
13692 (set_attr "prefix" "maybe_vex")
13693 (set_attr "mode" "TI")])
13695 (define_insn "*vec_extract<mode>_mem"
13696 [(set (match_operand:<ssescalarmode> 0 "register_operand" "=r")
13697 (vec_select:<ssescalarmode>
13698 (match_operand:VI12_128 1 "memory_operand" "o")
13700 [(match_operand 2 "const_0_to_<ssescalarnummask>_operand")])))]
13704 (define_insn "*vec_extract<ssevecmodelower>_0"
13705 [(set (match_operand:SWI48 0 "nonimmediate_operand" "=r,r,v ,m")
13707 (match_operand:<ssevecmode> 1 "nonimmediate_operand" "m ,v,vm,v")
13708 (parallel [(const_int 0)])))]
13709 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
13711 [(set_attr "isa" "*,sse2,*,*")
13712 (set (attr "preferred_for_speed")
13713 (cond [(eq_attr "alternative" "1")
13714 (symbol_ref "TARGET_INTER_UNIT_MOVES_FROM_VEC")
13716 (symbol_ref "true")))])
13718 (define_insn "*vec_extractv2di_0_sse"
13719 [(set (match_operand:DI 0 "nonimmediate_operand" "=v,m")
13721 (match_operand:V2DI 1 "nonimmediate_operand" "vm,v")
13722 (parallel [(const_int 0)])))]
13723 "TARGET_SSE && !TARGET_64BIT
13724 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
13728 [(set (match_operand:SWI48x 0 "nonimmediate_operand")
13730 (match_operand:<ssevecmode> 1 "register_operand")
13731 (parallel [(const_int 0)])))]
13732 "TARGET_SSE && reload_completed"
13733 [(set (match_dup 0) (match_dup 1))]
13734 "operands[1] = gen_lowpart (<MODE>mode, operands[1]);")
13736 (define_insn "*vec_extractv4si_0_zext_sse4"
13737 [(set (match_operand:DI 0 "register_operand" "=r,x,v")
13740 (match_operand:V4SI 1 "register_operand" "v,x,v")
13741 (parallel [(const_int 0)]))))]
13744 [(set_attr "isa" "x64,*,avx512f")
13745 (set (attr "preferred_for_speed")
13746 (cond [(eq_attr "alternative" "1")
13747 (symbol_ref "TARGET_INTER_UNIT_MOVES_FROM_VEC")
13749 (symbol_ref "true")))])
13751 (define_insn "*vec_extractv4si_0_zext"
13752 [(set (match_operand:DI 0 "register_operand" "=r")
13755 (match_operand:V4SI 1 "register_operand" "x")
13756 (parallel [(const_int 0)]))))]
13757 "TARGET_64BIT && TARGET_SSE2 && TARGET_INTER_UNIT_MOVES_FROM_VEC"
13761 [(set (match_operand:DI 0 "register_operand")
13764 (match_operand:V4SI 1 "register_operand")
13765 (parallel [(const_int 0)]))))]
13766 "TARGET_SSE2 && reload_completed"
13767 [(set (match_dup 0) (zero_extend:DI (match_dup 1)))]
13768 "operands[1] = gen_lowpart (SImode, operands[1]);")
13770 (define_insn "*vec_extractv4si"
13771 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,rm,Yr,*x,x,Yv")
13773 (match_operand:V4SI 1 "register_operand" "x,v,0,0,x,v")
13774 (parallel [(match_operand:SI 2 "const_0_to_3_operand")])))]
13777 switch (which_alternative)
13781 return "%vpextrd\t{%2, %1, %0|%0, %1, %2}";
13785 operands[2] = GEN_INT (INTVAL (operands[2]) * 4);
13786 return "psrldq\t{%2, %0|%0, %2}";
13790 operands[2] = GEN_INT (INTVAL (operands[2]) * 4);
13791 return "vpsrldq\t{%2, %1, %0|%0, %1, %2}";
13794 gcc_unreachable ();
13797 [(set_attr "isa" "*,avx512dq,noavx,noavx,avx,avx512bw")
13798 (set_attr "type" "sselog1,sselog1,sseishft1,sseishft1,sseishft1,sseishft1")
13799 (set (attr "prefix_extra")
13800 (if_then_else (eq_attr "alternative" "0,1")
13802 (const_string "*")))
13803 (set_attr "length_immediate" "1")
13804 (set_attr "prefix" "maybe_vex,evex,orig,orig,vex,evex")
13805 (set_attr "mode" "TI")])
13807 (define_insn "*vec_extractv4si_zext"
13808 [(set (match_operand:DI 0 "register_operand" "=r,r")
13811 (match_operand:V4SI 1 "register_operand" "x,v")
13812 (parallel [(match_operand:SI 2 "const_0_to_3_operand")]))))]
13813 "TARGET_64BIT && TARGET_SSE4_1"
13814 "%vpextrd\t{%2, %1, %k0|%k0, %1, %2}"
13815 [(set_attr "isa" "*,avx512dq")
13816 (set_attr "type" "sselog1")
13817 (set_attr "prefix_extra" "1")
13818 (set_attr "length_immediate" "1")
13819 (set_attr "prefix" "maybe_vex")
13820 (set_attr "mode" "TI")])
13822 (define_insn "*vec_extractv4si_mem"
13823 [(set (match_operand:SI 0 "register_operand" "=x,r")
13825 (match_operand:V4SI 1 "memory_operand" "o,o")
13826 (parallel [(match_operand 2 "const_0_to_3_operand")])))]
13830 (define_insn_and_split "*vec_extractv4si_zext_mem"
13831 [(set (match_operand:DI 0 "register_operand" "=x,r")
13834 (match_operand:V4SI 1 "memory_operand" "o,o")
13835 (parallel [(match_operand:SI 2 "const_0_to_3_operand")]))))]
13836 "TARGET_64BIT && TARGET_SSE"
13838 "&& reload_completed"
13839 [(set (match_dup 0) (zero_extend:DI (match_dup 1)))]
13841 operands[1] = adjust_address (operands[1], SImode, INTVAL (operands[2]) * 4);
13844 (define_insn "*vec_extractv2di_1"
13845 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,rm,m,x,x,Yv,x,v,r")
13847 (match_operand:V2DI 1 "nonimmediate_operand" "x ,v ,v,0,x, v,x,o,o")
13848 (parallel [(const_int 1)])))]
13849 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
13851 %vpextrq\t{$1, %1, %0|%0, %1, 1}
13852 vpextrq\t{$1, %1, %0|%0, %1, 1}
13853 %vmovhps\t{%1, %0|%0, %1}
13854 psrldq\t{$8, %0|%0, 8}
13855 vpsrldq\t{$8, %1, %0|%0, %1, 8}
13856 vpsrldq\t{$8, %1, %0|%0, %1, 8}
13857 movhlps\t{%1, %0|%0, %1}
13861 (cond [(eq_attr "alternative" "0")
13862 (const_string "x64_sse4")
13863 (eq_attr "alternative" "1")
13864 (const_string "x64_avx512dq")
13865 (eq_attr "alternative" "3")
13866 (const_string "sse2_noavx")
13867 (eq_attr "alternative" "4")
13868 (const_string "avx")
13869 (eq_attr "alternative" "5")
13870 (const_string "avx512bw")
13871 (eq_attr "alternative" "6")
13872 (const_string "noavx")
13873 (eq_attr "alternative" "8")
13874 (const_string "x64")
13876 (const_string "*")))
13878 (cond [(eq_attr "alternative" "2,6,7")
13879 (const_string "ssemov")
13880 (eq_attr "alternative" "3,4,5")
13881 (const_string "sseishft1")
13882 (eq_attr "alternative" "8")
13883 (const_string "imov")
13885 (const_string "sselog1")))
13886 (set (attr "length_immediate")
13887 (if_then_else (eq_attr "alternative" "0,1,3,4,5")
13889 (const_string "*")))
13890 (set (attr "prefix_rex")
13891 (if_then_else (eq_attr "alternative" "0,1")
13893 (const_string "*")))
13894 (set (attr "prefix_extra")
13895 (if_then_else (eq_attr "alternative" "0,1")
13897 (const_string "*")))
13898 (set_attr "prefix" "maybe_vex,evex,maybe_vex,orig,vex,evex,orig,*,*")
13899 (set_attr "mode" "TI,TI,V2SF,TI,TI,TI,V4SF,DI,DI")])
13902 [(set (match_operand:<ssescalarmode> 0 "register_operand")
13903 (vec_select:<ssescalarmode>
13904 (match_operand:VI_128 1 "memory_operand")
13906 [(match_operand 2 "const_0_to_<ssescalarnummask>_operand")])))]
13907 "TARGET_SSE && reload_completed"
13908 [(set (match_dup 0) (match_dup 1))]
13910 int offs = INTVAL (operands[2]) * GET_MODE_SIZE (<ssescalarmode>mode);
13912 operands[1] = adjust_address (operands[1], <ssescalarmode>mode, offs);
13915 (define_insn "*vec_extractv2ti"
13916 [(set (match_operand:TI 0 "nonimmediate_operand" "=xm,vm")
13918 (match_operand:V2TI 1 "register_operand" "x,v")
13920 [(match_operand:SI 2 "const_0_to_1_operand")])))]
13923 vextract%~128\t{%2, %1, %0|%0, %1, %2}
13924 vextracti32x4\t{%2, %g1, %0|%0, %g1, %2}"
13925 [(set_attr "type" "sselog")
13926 (set_attr "prefix_extra" "1")
13927 (set_attr "length_immediate" "1")
13928 (set_attr "prefix" "vex,evex")
13929 (set_attr "mode" "OI")])
13931 (define_insn "*vec_extractv4ti"
13932 [(set (match_operand:TI 0 "nonimmediate_operand" "=vm")
13934 (match_operand:V4TI 1 "register_operand" "v")
13936 [(match_operand:SI 2 "const_0_to_3_operand")])))]
13938 "vextracti32x4\t{%2, %1, %0|%0, %1, %2}"
13939 [(set_attr "type" "sselog")
13940 (set_attr "prefix_extra" "1")
13941 (set_attr "length_immediate" "1")
13942 (set_attr "prefix" "evex")
13943 (set_attr "mode" "XI")])
13945 (define_mode_iterator VEXTRACTI128_MODE
13946 [(V4TI "TARGET_AVX512F") V2TI])
13949 [(set (match_operand:TI 0 "nonimmediate_operand")
13951 (match_operand:VEXTRACTI128_MODE 1 "register_operand")
13952 (parallel [(const_int 0)])))]
13954 && reload_completed
13955 && (TARGET_AVX512VL || !EXT_REX_SSE_REG_P (operands[1]))"
13956 [(set (match_dup 0) (match_dup 1))]
13957 "operands[1] = gen_lowpart (TImode, operands[1]);")
13959 ;; Turn SImode or DImode extraction from arbitrary SSE/AVX/AVX512F
13960 ;; vector modes into vec_extract*.
13962 [(set (match_operand:SWI48x 0 "nonimmediate_operand")
13963 (subreg:SWI48x (match_operand 1 "register_operand") 0))]
13964 "can_create_pseudo_p ()
13965 && REG_P (operands[1])
13966 && VECTOR_MODE_P (GET_MODE (operands[1]))
13967 && ((TARGET_SSE && GET_MODE_SIZE (GET_MODE (operands[1])) == 16)
13968 || (TARGET_AVX && GET_MODE_SIZE (GET_MODE (operands[1])) == 32)
13969 || (TARGET_AVX512F && GET_MODE_SIZE (GET_MODE (operands[1])) == 64))
13970 && (<MODE>mode == SImode || TARGET_64BIT || MEM_P (operands[0]))"
13971 [(set (match_dup 0) (vec_select:SWI48x (match_dup 1)
13972 (parallel [(const_int 0)])))]
13976 switch (GET_MODE_SIZE (GET_MODE (operands[1])))
13979 if (<MODE>mode == SImode)
13981 tmp = gen_reg_rtx (V8SImode);
13982 emit_insn (gen_vec_extract_lo_v16si (tmp,
13983 gen_lowpart (V16SImode,
13988 tmp = gen_reg_rtx (V4DImode);
13989 emit_insn (gen_vec_extract_lo_v8di (tmp,
13990 gen_lowpart (V8DImode,
13996 tmp = gen_reg_rtx (<ssevecmode>mode);
13997 if (<MODE>mode == SImode)
13998 emit_insn (gen_vec_extract_lo_v8si (tmp, gen_lowpart (V8SImode,
14001 emit_insn (gen_vec_extract_lo_v4di (tmp, gen_lowpart (V4DImode,
14006 operands[1] = gen_lowpart (<ssevecmode>mode, operands[1]);
14011 (define_insn "*vec_concatv2si_sse4_1"
14012 [(set (match_operand:V2SI 0 "register_operand"
14013 "=Yr,*x, x, v,Yr,*x, v, v, *y,*y")
14015 (match_operand:SI 1 "nonimmediate_operand"
14016 " 0, 0, x,Yv, 0, 0,Yv,rm, 0,rm")
14017 (match_operand:SI 2 "vector_move_operand"
14018 " rm,rm,rm,rm,Yr,*x,Yv, C,*ym, C")))]
14019 "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
14021 pinsrd\t{$1, %2, %0|%0, %2, 1}
14022 pinsrd\t{$1, %2, %0|%0, %2, 1}
14023 vpinsrd\t{$1, %2, %1, %0|%0, %1, %2, 1}
14024 vpinsrd\t{$1, %2, %1, %0|%0, %1, %2, 1}
14025 punpckldq\t{%2, %0|%0, %2}
14026 punpckldq\t{%2, %0|%0, %2}
14027 vpunpckldq\t{%2, %1, %0|%0, %1, %2}
14028 %vmovd\t{%1, %0|%0, %1}
14029 punpckldq\t{%2, %0|%0, %2}
14030 movd\t{%1, %0|%0, %1}"
14031 [(set_attr "isa" "noavx,noavx,avx,avx512dq,noavx,noavx,avx,*,*,*")
14033 (cond [(eq_attr "alternative" "7")
14034 (const_string "ssemov")
14035 (eq_attr "alternative" "8")
14036 (const_string "mmxcvt")
14037 (eq_attr "alternative" "9")
14038 (const_string "mmxmov")
14040 (const_string "sselog")))
14041 (set (attr "prefix_extra")
14042 (if_then_else (eq_attr "alternative" "0,1,2,3")
14044 (const_string "*")))
14045 (set (attr "length_immediate")
14046 (if_then_else (eq_attr "alternative" "0,1,2,3")
14048 (const_string "*")))
14049 (set_attr "prefix" "orig,orig,vex,evex,orig,orig,maybe_evex,maybe_vex,orig,orig")
14050 (set_attr "mode" "TI,TI,TI,TI,TI,TI,TI,TI,DI,DI")])
14052 ;; ??? In theory we can match memory for the MMX alternative, but allowing
14053 ;; nonimmediate_operand for operand 2 and *not* allowing memory for the SSE
14054 ;; alternatives pretty much forces the MMX alternative to be chosen.
14055 (define_insn "*vec_concatv2si"
14056 [(set (match_operand:V2SI 0 "register_operand" "=x,x ,*y,x,x,*y,*y")
14058 (match_operand:SI 1 "nonimmediate_operand" " 0,rm,rm,0,m, 0,*rm")
14059 (match_operand:SI 2 "reg_or_0_operand" " x,C ,C, x,C,*y,C")))]
14060 "TARGET_SSE && !TARGET_SSE4_1"
14062 punpckldq\t{%2, %0|%0, %2}
14063 movd\t{%1, %0|%0, %1}
14064 movd\t{%1, %0|%0, %1}
14065 unpcklps\t{%2, %0|%0, %2}
14066 movss\t{%1, %0|%0, %1}
14067 punpckldq\t{%2, %0|%0, %2}
14068 movd\t{%1, %0|%0, %1}"
14069 [(set_attr "isa" "sse2,sse2,sse2,*,*,*,*")
14070 (set_attr "type" "sselog,ssemov,mmxmov,sselog,ssemov,mmxcvt,mmxmov")
14071 (set_attr "mode" "TI,TI,DI,V4SF,SF,DI,DI")])
14073 (define_insn "*vec_concatv4si"
14074 [(set (match_operand:V4SI 0 "register_operand" "=x,v,x,x,v")
14076 (match_operand:V2SI 1 "register_operand" " 0,v,0,0,v")
14077 (match_operand:V2SI 2 "nonimmediate_operand" " x,v,x,m,m")))]
14080 punpcklqdq\t{%2, %0|%0, %2}
14081 vpunpcklqdq\t{%2, %1, %0|%0, %1, %2}
14082 movlhps\t{%2, %0|%0, %2}
14083 movhps\t{%2, %0|%0, %q2}
14084 vmovhps\t{%2, %1, %0|%0, %1, %q2}"
14085 [(set_attr "isa" "sse2_noavx,avx,noavx,noavx,avx")
14086 (set_attr "type" "sselog,sselog,ssemov,ssemov,ssemov")
14087 (set_attr "prefix" "orig,maybe_evex,orig,orig,maybe_evex")
14088 (set_attr "mode" "TI,TI,V4SF,V2SF,V2SF")])
14090 ;; movd instead of movq is required to handle broken assemblers.
14091 (define_insn "vec_concatv2di"
14092 [(set (match_operand:V2DI 0 "register_operand"
14093 "=Yr,*x,x ,v ,v,v ,x ,x,v ,x,x,v")
14095 (match_operand:DI 1 "nonimmediate_operand"
14096 " 0, 0,x ,Yv,r,vm,?!*y,0,Yv,0,0,v")
14097 (match_operand:DI 2 "vector_move_operand"
14098 " rm,rm,rm,rm,C ,C ,C ,x,Yv,x,m,m")))]
14101 pinsrq\t{$1, %2, %0|%0, %2, 1}
14102 pinsrq\t{$1, %2, %0|%0, %2, 1}
14103 vpinsrq\t{$1, %2, %1, %0|%0, %1, %2, 1}
14104 vpinsrq\t{$1, %2, %1, %0|%0, %1, %2, 1}
14105 * return HAVE_AS_IX86_INTERUNIT_MOVQ ? \"%vmovq\t{%1, %0|%0, %1}\" : \"%vmovd\t{%1, %0|%0, %1}\";
14106 %vmovq\t{%1, %0|%0, %1}
14107 movq2dq\t{%1, %0|%0, %1}
14108 punpcklqdq\t{%2, %0|%0, %2}
14109 vpunpcklqdq\t{%2, %1, %0|%0, %1, %2}
14110 movlhps\t{%2, %0|%0, %2}
14111 movhps\t{%2, %0|%0, %2}
14112 vmovhps\t{%2, %1, %0|%0, %1, %2}"
14114 (cond [(eq_attr "alternative" "0,1")
14115 (const_string "x64_sse4_noavx")
14116 (eq_attr "alternative" "2")
14117 (const_string "x64_avx")
14118 (eq_attr "alternative" "3")
14119 (const_string "x64_avx512dq")
14120 (eq_attr "alternative" "4")
14121 (const_string "x64_sse2")
14122 (eq_attr "alternative" "5,6")
14123 (const_string "sse2")
14124 (eq_attr "alternative" "7")
14125 (const_string "sse2_noavx")
14126 (eq_attr "alternative" "8,11")
14127 (const_string "avx")
14129 (const_string "noavx")))
14132 (eq_attr "alternative" "0,1,2,3,7,8")
14133 (const_string "sselog")
14134 (const_string "ssemov")))
14135 (set (attr "prefix_rex")
14136 (if_then_else (eq_attr "alternative" "0,1,2,3,4")
14138 (const_string "*")))
14139 (set (attr "prefix_extra")
14140 (if_then_else (eq_attr "alternative" "0,1,2,3")
14142 (const_string "*")))
14143 (set (attr "length_immediate")
14144 (if_then_else (eq_attr "alternative" "0,1,2,3")
14146 (const_string "*")))
14147 (set (attr "prefix")
14148 (cond [(eq_attr "alternative" "2")
14149 (const_string "vex")
14150 (eq_attr "alternative" "3")
14151 (const_string "evex")
14152 (eq_attr "alternative" "4,5")
14153 (const_string "maybe_vex")
14154 (eq_attr "alternative" "8,11")
14155 (const_string "maybe_evex")
14157 (const_string "orig")))
14158 (set_attr "mode" "TI,TI,TI,TI,TI,TI,TI,TI,TI,V4SF,V2SF,V2SF")
14159 (set (attr "preferred_for_speed")
14160 (cond [(eq_attr "alternative" "4")
14161 (symbol_ref "TARGET_INTER_UNIT_MOVES_TO_VEC")
14162 (eq_attr "alternative" "6")
14163 (symbol_ref "TARGET_INTER_UNIT_MOVES_FROM_VEC")
14165 (symbol_ref "true")))])
14167 ;; vmovq clears also the higher bits.
14168 (define_insn "vec_set<mode>_0"
14169 [(set (match_operand:VI8_AVX_AVX512F 0 "register_operand" "=v,v")
14170 (vec_merge:VI8_AVX_AVX512F
14171 (vec_duplicate:VI8_AVX_AVX512F
14172 (match_operand:<ssescalarmode> 2 "general_operand" "r,vm"))
14173 (match_operand:VI8_AVX_AVX512F 1 "const0_operand" "C,C")
14176 "vmovq\t{%2, %x0|%x0, %2}"
14177 [(set_attr "isa" "x64,*")
14178 (set_attr "type" "ssemov")
14179 (set_attr "prefix_rex" "1,*")
14180 (set_attr "prefix" "maybe_evex")
14181 (set_attr "mode" "TI")
14182 (set (attr "preferred_for_speed")
14183 (cond [(eq_attr "alternative" "0")
14184 (symbol_ref "TARGET_INTER_UNIT_MOVES_TO_VEC")
14186 (symbol_ref "true")))])
14188 (define_expand "vec_unpacks_lo_<mode>"
14189 [(match_operand:<sseunpackmode> 0 "register_operand")
14190 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
14192 "ix86_expand_sse_unpack (operands[0], operands[1], false, false); DONE;")
14194 (define_expand "vec_unpacks_hi_<mode>"
14195 [(match_operand:<sseunpackmode> 0 "register_operand")
14196 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
14198 "ix86_expand_sse_unpack (operands[0], operands[1], false, true); DONE;")
14200 (define_expand "vec_unpacku_lo_<mode>"
14201 [(match_operand:<sseunpackmode> 0 "register_operand")
14202 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
14204 "ix86_expand_sse_unpack (operands[0], operands[1], true, false); DONE;")
14206 (define_expand "vec_unpacks_lo_hi"
14207 [(set (subreg:HI (match_operand:QI 0 "register_operand") 0)
14208 (match_operand:HI 1 "register_operand"))]
14211 (define_expand "vec_unpacks_lo_si"
14212 [(set (match_operand:HI 0 "register_operand")
14213 (subreg:HI (match_operand:SI 1 "register_operand") 0))]
14216 (define_expand "vec_unpacks_lo_di"
14217 [(set (match_operand:SI 0 "register_operand")
14218 (subreg:SI (match_operand:DI 1 "register_operand") 0))]
14221 (define_expand "vec_unpacku_hi_<mode>"
14222 [(match_operand:<sseunpackmode> 0 "register_operand")
14223 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
14225 "ix86_expand_sse_unpack (operands[0], operands[1], true, true); DONE;")
14227 (define_expand "vec_unpacks_hi_hi"
14229 [(set (subreg:HI (match_operand:QI 0 "register_operand") 0)
14230 (lshiftrt:HI (match_operand:HI 1 "register_operand")
14232 (unspec [(const_int 0)] UNSPEC_MASKOP)])]
14235 (define_expand "vec_unpacks_hi_<mode>"
14237 [(set (subreg:SWI48x
14238 (match_operand:<HALFMASKMODE> 0 "register_operand") 0)
14239 (lshiftrt:SWI48x (match_operand:SWI48x 1 "register_operand")
14241 (unspec [(const_int 0)] UNSPEC_MASKOP)])]
14243 "operands[2] = GEN_INT (GET_MODE_BITSIZE (<HALFMASKMODE>mode));")
14245 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14249 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14251 (define_expand "<sse2_avx2>_uavg<mode>3<mask_name>"
14252 [(set (match_operand:VI12_AVX2 0 "register_operand")
14253 (truncate:VI12_AVX2
14254 (lshiftrt:<ssedoublemode>
14255 (plus:<ssedoublemode>
14256 (plus:<ssedoublemode>
14257 (zero_extend:<ssedoublemode>
14258 (match_operand:VI12_AVX2 1 "vector_operand"))
14259 (zero_extend:<ssedoublemode>
14260 (match_operand:VI12_AVX2 2 "vector_operand")))
14261 (match_dup <mask_expand_op3>))
14263 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
14266 if (<mask_applied>)
14268 operands[3] = CONST1_RTX(<MODE>mode);
14269 ix86_fixup_binary_operands_no_copy (PLUS, <MODE>mode, operands);
14271 if (<mask_applied>)
14273 operands[5] = operands[3];
14278 (define_insn "*<sse2_avx2>_uavg<mode>3<mask_name>"
14279 [(set (match_operand:VI12_AVX2 0 "register_operand" "=x,v")
14280 (truncate:VI12_AVX2
14281 (lshiftrt:<ssedoublemode>
14282 (plus:<ssedoublemode>
14283 (plus:<ssedoublemode>
14284 (zero_extend:<ssedoublemode>
14285 (match_operand:VI12_AVX2 1 "vector_operand" "%0,v"))
14286 (zero_extend:<ssedoublemode>
14287 (match_operand:VI12_AVX2 2 "vector_operand" "xBm,vm")))
14288 (match_operand:VI12_AVX2 <mask_expand_op3> "const1_operand"))
14290 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>
14291 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
14293 pavg<ssemodesuffix>\t{%2, %0|%0, %2}
14294 vpavg<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
14295 [(set_attr "isa" "noavx,avx")
14296 (set_attr "type" "sseiadd")
14297 (set_attr "prefix_data16" "1,*")
14298 (set_attr "prefix" "orig,<mask_prefix>")
14299 (set_attr "mode" "<sseinsnmode>")])
14301 ;; The correct representation for this is absolutely enormous, and
14302 ;; surely not generally useful.
14303 (define_insn "<sse2_avx2>_psadbw"
14304 [(set (match_operand:VI8_AVX2_AVX512BW 0 "register_operand" "=x,v")
14305 (unspec:VI8_AVX2_AVX512BW
14306 [(match_operand:<ssebytemode> 1 "register_operand" "0,v")
14307 (match_operand:<ssebytemode> 2 "vector_operand" "xBm,vm")]
14311 psadbw\t{%2, %0|%0, %2}
14312 vpsadbw\t{%2, %1, %0|%0, %1, %2}"
14313 [(set_attr "isa" "noavx,avx")
14314 (set_attr "type" "sseiadd")
14315 (set_attr "atom_unit" "simul")
14316 (set_attr "prefix_data16" "1,*")
14317 (set_attr "prefix" "orig,maybe_evex")
14318 (set_attr "mode" "<sseinsnmode>")])
14320 (define_insn "<sse>_movmsk<ssemodesuffix><avxsizesuffix>"
14321 [(set (match_operand:SI 0 "register_operand" "=r")
14323 [(match_operand:VF_128_256 1 "register_operand" "x")]
14326 "%vmovmsk<ssemodesuffix>\t{%1, %0|%0, %1}"
14327 [(set_attr "type" "ssemov")
14328 (set_attr "prefix" "maybe_vex")
14329 (set_attr "mode" "<MODE>")])
14331 (define_insn "*<sse>_movmsk<ssemodesuffix><avxsizesuffix>_zext"
14332 [(set (match_operand:DI 0 "register_operand" "=r")
14335 [(match_operand:VF_128_256 1 "register_operand" "x")]
14337 "TARGET_64BIT && TARGET_SSE"
14338 "%vmovmsk<ssemodesuffix>\t{%1, %k0|%k0, %1}"
14339 [(set_attr "type" "ssemov")
14340 (set_attr "prefix" "maybe_vex")
14341 (set_attr "mode" "<MODE>")])
14343 (define_insn "<sse2_avx2>_pmovmskb"
14344 [(set (match_operand:SI 0 "register_operand" "=r")
14346 [(match_operand:VI1_AVX2 1 "register_operand" "x")]
14349 "%vpmovmskb\t{%1, %0|%0, %1}"
14350 [(set_attr "type" "ssemov")
14351 (set (attr "prefix_data16")
14353 (match_test "TARGET_AVX")
14355 (const_string "1")))
14356 (set_attr "prefix" "maybe_vex")
14357 (set_attr "mode" "SI")])
14359 (define_insn "*<sse2_avx2>_pmovmskb_zext"
14360 [(set (match_operand:DI 0 "register_operand" "=r")
14363 [(match_operand:VI1_AVX2 1 "register_operand" "x")]
14365 "TARGET_64BIT && TARGET_SSE2"
14366 "%vpmovmskb\t{%1, %k0|%k0, %1}"
14367 [(set_attr "type" "ssemov")
14368 (set (attr "prefix_data16")
14370 (match_test "TARGET_AVX")
14372 (const_string "1")))
14373 (set_attr "prefix" "maybe_vex")
14374 (set_attr "mode" "SI")])
14376 (define_expand "sse2_maskmovdqu"
14377 [(set (match_operand:V16QI 0 "memory_operand")
14378 (unspec:V16QI [(match_operand:V16QI 1 "register_operand")
14379 (match_operand:V16QI 2 "register_operand")
14384 (define_insn "*sse2_maskmovdqu"
14385 [(set (mem:V16QI (match_operand:P 0 "register_operand" "D"))
14386 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "x")
14387 (match_operand:V16QI 2 "register_operand" "x")
14388 (mem:V16QI (match_dup 0))]
14392 /* We can't use %^ here due to ASM_OUTPUT_OPCODE processing
14393 that requires %v to be at the beginning of the opcode name. */
14394 if (Pmode != word_mode)
14395 fputs ("\taddr32", asm_out_file);
14396 return "%vmaskmovdqu\t{%2, %1|%1, %2}";
14398 [(set_attr "type" "ssemov")
14399 (set_attr "prefix_data16" "1")
14400 (set (attr "length_address")
14401 (symbol_ref ("Pmode != word_mode")))
14402 ;; The implicit %rdi operand confuses default length_vex computation.
14403 (set (attr "length_vex")
14404 (symbol_ref ("3 + REX_SSE_REGNO_P (REGNO (operands[2]))")))
14405 (set_attr "prefix" "maybe_vex")
14406 (set_attr "znver1_decode" "vector")
14407 (set_attr "mode" "TI")])
14409 (define_insn "sse_ldmxcsr"
14410 [(unspec_volatile [(match_operand:SI 0 "memory_operand" "m")]
14414 [(set_attr "type" "sse")
14415 (set_attr "atom_sse_attr" "mxcsr")
14416 (set_attr "prefix" "maybe_vex")
14417 (set_attr "memory" "load")])
14419 (define_insn "sse_stmxcsr"
14420 [(set (match_operand:SI 0 "memory_operand" "=m")
14421 (unspec_volatile:SI [(const_int 0)] UNSPECV_STMXCSR))]
14424 [(set_attr "type" "sse")
14425 (set_attr "atom_sse_attr" "mxcsr")
14426 (set_attr "prefix" "maybe_vex")
14427 (set_attr "memory" "store")])
14429 (define_insn "sse2_clflush"
14430 [(unspec_volatile [(match_operand 0 "address_operand" "p")]
14434 [(set_attr "type" "sse")
14435 (set_attr "atom_sse_attr" "fence")
14436 (set_attr "memory" "unknown")])
14438 ;; As per AMD and Intel ISA manuals, the first operand is extensions
14439 ;; and it goes to %ecx. The second operand received is hints and it goes
14441 (define_insn "sse3_mwait"
14442 [(unspec_volatile [(match_operand:SI 0 "register_operand" "c")
14443 (match_operand:SI 1 "register_operand" "a")]
14446 ;; 64bit version is "mwait %rax,%rcx". But only lower 32bits are used.
14447 ;; Since 32bit register operands are implicitly zero extended to 64bit,
14448 ;; we only need to set up 32bit registers.
14450 [(set_attr "length" "3")])
14452 (define_insn "sse3_monitor_<mode>"
14453 [(unspec_volatile [(match_operand:P 0 "register_operand" "a")
14454 (match_operand:SI 1 "register_operand" "c")
14455 (match_operand:SI 2 "register_operand" "d")]
14458 ;; 64bit version is "monitor %rax,%rcx,%rdx". But only lower 32bits in
14459 ;; RCX and RDX are used. Since 32bit register operands are implicitly
14460 ;; zero extended to 64bit, we only need to set up 32bit registers.
14462 [(set (attr "length")
14463 (symbol_ref ("(Pmode != word_mode) + 3")))])
14465 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14467 ;; SSSE3 instructions
14469 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14471 (define_code_iterator ssse3_plusminus [plus ss_plus minus ss_minus])
14473 (define_insn "avx2_ph<plusminus_mnemonic>wv16hi3"
14474 [(set (match_operand:V16HI 0 "register_operand" "=x")
14479 (ssse3_plusminus:HI
14481 (match_operand:V16HI 1 "register_operand" "x")
14482 (parallel [(const_int 0)]))
14483 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
14484 (ssse3_plusminus:HI
14485 (vec_select:HI (match_dup 1) (parallel [(const_int 2)]))
14486 (vec_select:HI (match_dup 1) (parallel [(const_int 3)]))))
14488 (ssse3_plusminus:HI
14489 (vec_select:HI (match_dup 1) (parallel [(const_int 4)]))
14490 (vec_select:HI (match_dup 1) (parallel [(const_int 5)])))
14491 (ssse3_plusminus:HI
14492 (vec_select:HI (match_dup 1) (parallel [(const_int 6)]))
14493 (vec_select:HI (match_dup 1) (parallel [(const_int 7)])))))
14496 (ssse3_plusminus:HI
14497 (vec_select:HI (match_dup 1) (parallel [(const_int 8)]))
14498 (vec_select:HI (match_dup 1) (parallel [(const_int 9)])))
14499 (ssse3_plusminus:HI
14500 (vec_select:HI (match_dup 1) (parallel [(const_int 10)]))
14501 (vec_select:HI (match_dup 1) (parallel [(const_int 11)]))))
14503 (ssse3_plusminus:HI
14504 (vec_select:HI (match_dup 1) (parallel [(const_int 12)]))
14505 (vec_select:HI (match_dup 1) (parallel [(const_int 13)])))
14506 (ssse3_plusminus:HI
14507 (vec_select:HI (match_dup 1) (parallel [(const_int 14)]))
14508 (vec_select:HI (match_dup 1) (parallel [(const_int 15)]))))))
14512 (ssse3_plusminus:HI
14514 (match_operand:V16HI 2 "nonimmediate_operand" "xm")
14515 (parallel [(const_int 0)]))
14516 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))
14517 (ssse3_plusminus:HI
14518 (vec_select:HI (match_dup 2) (parallel [(const_int 2)]))
14519 (vec_select:HI (match_dup 2) (parallel [(const_int 3)]))))
14521 (ssse3_plusminus:HI
14522 (vec_select:HI (match_dup 2) (parallel [(const_int 4)]))
14523 (vec_select:HI (match_dup 2) (parallel [(const_int 5)])))
14524 (ssse3_plusminus:HI
14525 (vec_select:HI (match_dup 2) (parallel [(const_int 6)]))
14526 (vec_select:HI (match_dup 2) (parallel [(const_int 7)])))))
14529 (ssse3_plusminus:HI
14530 (vec_select:HI (match_dup 2) (parallel [(const_int 8)]))
14531 (vec_select:HI (match_dup 2) (parallel [(const_int 9)])))
14532 (ssse3_plusminus:HI
14533 (vec_select:HI (match_dup 2) (parallel [(const_int 10)]))
14534 (vec_select:HI (match_dup 2) (parallel [(const_int 11)]))))
14536 (ssse3_plusminus:HI
14537 (vec_select:HI (match_dup 2) (parallel [(const_int 12)]))
14538 (vec_select:HI (match_dup 2) (parallel [(const_int 13)])))
14539 (ssse3_plusminus:HI
14540 (vec_select:HI (match_dup 2) (parallel [(const_int 14)]))
14541 (vec_select:HI (match_dup 2) (parallel [(const_int 15)]))))))))]
14543 "vph<plusminus_mnemonic>w\t{%2, %1, %0|%0, %1, %2}"
14544 [(set_attr "type" "sseiadd")
14545 (set_attr "prefix_extra" "1")
14546 (set_attr "prefix" "vex")
14547 (set_attr "mode" "OI")])
14549 (define_insn "ssse3_ph<plusminus_mnemonic>wv8hi3"
14550 [(set (match_operand:V8HI 0 "register_operand" "=x,x")
14554 (ssse3_plusminus:HI
14556 (match_operand:V8HI 1 "register_operand" "0,x")
14557 (parallel [(const_int 0)]))
14558 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
14559 (ssse3_plusminus:HI
14560 (vec_select:HI (match_dup 1) (parallel [(const_int 2)]))
14561 (vec_select:HI (match_dup 1) (parallel [(const_int 3)]))))
14563 (ssse3_plusminus:HI
14564 (vec_select:HI (match_dup 1) (parallel [(const_int 4)]))
14565 (vec_select:HI (match_dup 1) (parallel [(const_int 5)])))
14566 (ssse3_plusminus:HI
14567 (vec_select:HI (match_dup 1) (parallel [(const_int 6)]))
14568 (vec_select:HI (match_dup 1) (parallel [(const_int 7)])))))
14571 (ssse3_plusminus:HI
14573 (match_operand:V8HI 2 "vector_operand" "xBm,xm")
14574 (parallel [(const_int 0)]))
14575 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))
14576 (ssse3_plusminus:HI
14577 (vec_select:HI (match_dup 2) (parallel [(const_int 2)]))
14578 (vec_select:HI (match_dup 2) (parallel [(const_int 3)]))))
14580 (ssse3_plusminus:HI
14581 (vec_select:HI (match_dup 2) (parallel [(const_int 4)]))
14582 (vec_select:HI (match_dup 2) (parallel [(const_int 5)])))
14583 (ssse3_plusminus:HI
14584 (vec_select:HI (match_dup 2) (parallel [(const_int 6)]))
14585 (vec_select:HI (match_dup 2) (parallel [(const_int 7)])))))))]
14588 ph<plusminus_mnemonic>w\t{%2, %0|%0, %2}
14589 vph<plusminus_mnemonic>w\t{%2, %1, %0|%0, %1, %2}"
14590 [(set_attr "isa" "noavx,avx")
14591 (set_attr "type" "sseiadd")
14592 (set_attr "atom_unit" "complex")
14593 (set_attr "prefix_data16" "1,*")
14594 (set_attr "prefix_extra" "1")
14595 (set_attr "prefix" "orig,vex")
14596 (set_attr "mode" "TI")])
14598 (define_insn "ssse3_ph<plusminus_mnemonic>wv4hi3"
14599 [(set (match_operand:V4HI 0 "register_operand" "=y")
14602 (ssse3_plusminus:HI
14604 (match_operand:V4HI 1 "register_operand" "0")
14605 (parallel [(const_int 0)]))
14606 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
14607 (ssse3_plusminus:HI
14608 (vec_select:HI (match_dup 1) (parallel [(const_int 2)]))
14609 (vec_select:HI (match_dup 1) (parallel [(const_int 3)]))))
14611 (ssse3_plusminus:HI
14613 (match_operand:V4HI 2 "nonimmediate_operand" "ym")
14614 (parallel [(const_int 0)]))
14615 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))
14616 (ssse3_plusminus:HI
14617 (vec_select:HI (match_dup 2) (parallel [(const_int 2)]))
14618 (vec_select:HI (match_dup 2) (parallel [(const_int 3)]))))))]
14620 "ph<plusminus_mnemonic>w\t{%2, %0|%0, %2}"
14621 [(set_attr "type" "sseiadd")
14622 (set_attr "atom_unit" "complex")
14623 (set_attr "prefix_extra" "1")
14624 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14625 (set_attr "mode" "DI")])
14627 (define_insn "avx2_ph<plusminus_mnemonic>dv8si3"
14628 [(set (match_operand:V8SI 0 "register_operand" "=x")
14634 (match_operand:V8SI 1 "register_operand" "x")
14635 (parallel [(const_int 0)]))
14636 (vec_select:SI (match_dup 1) (parallel [(const_int 1)])))
14638 (vec_select:SI (match_dup 1) (parallel [(const_int 2)]))
14639 (vec_select:SI (match_dup 1) (parallel [(const_int 3)]))))
14642 (vec_select:SI (match_dup 1) (parallel [(const_int 4)]))
14643 (vec_select:SI (match_dup 1) (parallel [(const_int 5)])))
14645 (vec_select:SI (match_dup 1) (parallel [(const_int 6)]))
14646 (vec_select:SI (match_dup 1) (parallel [(const_int 7)])))))
14651 (match_operand:V8SI 2 "nonimmediate_operand" "xm")
14652 (parallel [(const_int 0)]))
14653 (vec_select:SI (match_dup 2) (parallel [(const_int 1)])))
14655 (vec_select:SI (match_dup 2) (parallel [(const_int 2)]))
14656 (vec_select:SI (match_dup 2) (parallel [(const_int 3)]))))
14659 (vec_select:SI (match_dup 2) (parallel [(const_int 4)]))
14660 (vec_select:SI (match_dup 2) (parallel [(const_int 5)])))
14662 (vec_select:SI (match_dup 2) (parallel [(const_int 6)]))
14663 (vec_select:SI (match_dup 2) (parallel [(const_int 7)])))))))]
14665 "vph<plusminus_mnemonic>d\t{%2, %1, %0|%0, %1, %2}"
14666 [(set_attr "type" "sseiadd")
14667 (set_attr "prefix_extra" "1")
14668 (set_attr "prefix" "vex")
14669 (set_attr "mode" "OI")])
14671 (define_insn "ssse3_ph<plusminus_mnemonic>dv4si3"
14672 [(set (match_operand:V4SI 0 "register_operand" "=x,x")
14677 (match_operand:V4SI 1 "register_operand" "0,x")
14678 (parallel [(const_int 0)]))
14679 (vec_select:SI (match_dup 1) (parallel [(const_int 1)])))
14681 (vec_select:SI (match_dup 1) (parallel [(const_int 2)]))
14682 (vec_select:SI (match_dup 1) (parallel [(const_int 3)]))))
14686 (match_operand:V4SI 2 "vector_operand" "xBm,xm")
14687 (parallel [(const_int 0)]))
14688 (vec_select:SI (match_dup 2) (parallel [(const_int 1)])))
14690 (vec_select:SI (match_dup 2) (parallel [(const_int 2)]))
14691 (vec_select:SI (match_dup 2) (parallel [(const_int 3)]))))))]
14694 ph<plusminus_mnemonic>d\t{%2, %0|%0, %2}
14695 vph<plusminus_mnemonic>d\t{%2, %1, %0|%0, %1, %2}"
14696 [(set_attr "isa" "noavx,avx")
14697 (set_attr "type" "sseiadd")
14698 (set_attr "atom_unit" "complex")
14699 (set_attr "prefix_data16" "1,*")
14700 (set_attr "prefix_extra" "1")
14701 (set_attr "prefix" "orig,vex")
14702 (set_attr "mode" "TI")])
14704 (define_insn "ssse3_ph<plusminus_mnemonic>dv2si3"
14705 [(set (match_operand:V2SI 0 "register_operand" "=y")
14709 (match_operand:V2SI 1 "register_operand" "0")
14710 (parallel [(const_int 0)]))
14711 (vec_select:SI (match_dup 1) (parallel [(const_int 1)])))
14714 (match_operand:V2SI 2 "nonimmediate_operand" "ym")
14715 (parallel [(const_int 0)]))
14716 (vec_select:SI (match_dup 2) (parallel [(const_int 1)])))))]
14718 "ph<plusminus_mnemonic>d\t{%2, %0|%0, %2}"
14719 [(set_attr "type" "sseiadd")
14720 (set_attr "atom_unit" "complex")
14721 (set_attr "prefix_extra" "1")
14722 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14723 (set_attr "mode" "DI")])
14725 (define_insn "avx2_pmaddubsw256"
14726 [(set (match_operand:V16HI 0 "register_operand" "=x,v")
14731 (match_operand:V32QI 1 "register_operand" "x,v")
14732 (parallel [(const_int 0) (const_int 2)
14733 (const_int 4) (const_int 6)
14734 (const_int 8) (const_int 10)
14735 (const_int 12) (const_int 14)
14736 (const_int 16) (const_int 18)
14737 (const_int 20) (const_int 22)
14738 (const_int 24) (const_int 26)
14739 (const_int 28) (const_int 30)])))
14742 (match_operand:V32QI 2 "nonimmediate_operand" "xm,vm")
14743 (parallel [(const_int 0) (const_int 2)
14744 (const_int 4) (const_int 6)
14745 (const_int 8) (const_int 10)
14746 (const_int 12) (const_int 14)
14747 (const_int 16) (const_int 18)
14748 (const_int 20) (const_int 22)
14749 (const_int 24) (const_int 26)
14750 (const_int 28) (const_int 30)]))))
14753 (vec_select:V16QI (match_dup 1)
14754 (parallel [(const_int 1) (const_int 3)
14755 (const_int 5) (const_int 7)
14756 (const_int 9) (const_int 11)
14757 (const_int 13) (const_int 15)
14758 (const_int 17) (const_int 19)
14759 (const_int 21) (const_int 23)
14760 (const_int 25) (const_int 27)
14761 (const_int 29) (const_int 31)])))
14763 (vec_select:V16QI (match_dup 2)
14764 (parallel [(const_int 1) (const_int 3)
14765 (const_int 5) (const_int 7)
14766 (const_int 9) (const_int 11)
14767 (const_int 13) (const_int 15)
14768 (const_int 17) (const_int 19)
14769 (const_int 21) (const_int 23)
14770 (const_int 25) (const_int 27)
14771 (const_int 29) (const_int 31)]))))))]
14773 "vpmaddubsw\t{%2, %1, %0|%0, %1, %2}"
14774 [(set_attr "isa" "*,avx512bw")
14775 (set_attr "type" "sseiadd")
14776 (set_attr "prefix_extra" "1")
14777 (set_attr "prefix" "vex,evex")
14778 (set_attr "mode" "OI")])
14780 ;; The correct representation for this is absolutely enormous, and
14781 ;; surely not generally useful.
14782 (define_insn "avx512bw_pmaddubsw512<mode><mask_name>"
14783 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
14784 (unspec:VI2_AVX512VL
14785 [(match_operand:<dbpsadbwmode> 1 "register_operand" "v")
14786 (match_operand:<dbpsadbwmode> 2 "nonimmediate_operand" "vm")]
14787 UNSPEC_PMADDUBSW512))]
14789 "vpmaddubsw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}";
14790 [(set_attr "type" "sseiadd")
14791 (set_attr "prefix" "evex")
14792 (set_attr "mode" "XI")])
14794 (define_insn "avx512bw_umulhrswv32hi3<mask_name>"
14795 [(set (match_operand:V32HI 0 "register_operand" "=v")
14802 (match_operand:V32HI 1 "nonimmediate_operand" "%v"))
14804 (match_operand:V32HI 2 "nonimmediate_operand" "vm")))
14806 (const_vector:V32HI [(const_int 1) (const_int 1)
14807 (const_int 1) (const_int 1)
14808 (const_int 1) (const_int 1)
14809 (const_int 1) (const_int 1)
14810 (const_int 1) (const_int 1)
14811 (const_int 1) (const_int 1)
14812 (const_int 1) (const_int 1)
14813 (const_int 1) (const_int 1)
14814 (const_int 1) (const_int 1)
14815 (const_int 1) (const_int 1)
14816 (const_int 1) (const_int 1)
14817 (const_int 1) (const_int 1)
14818 (const_int 1) (const_int 1)
14819 (const_int 1) (const_int 1)
14820 (const_int 1) (const_int 1)
14821 (const_int 1) (const_int 1)]))
14824 "vpmulhrsw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
14825 [(set_attr "type" "sseimul")
14826 (set_attr "prefix" "evex")
14827 (set_attr "mode" "XI")])
14829 (define_insn "ssse3_pmaddubsw128"
14830 [(set (match_operand:V8HI 0 "register_operand" "=x,x,v")
14835 (match_operand:V16QI 1 "register_operand" "0,x,v")
14836 (parallel [(const_int 0) (const_int 2)
14837 (const_int 4) (const_int 6)
14838 (const_int 8) (const_int 10)
14839 (const_int 12) (const_int 14)])))
14842 (match_operand:V16QI 2 "vector_operand" "xBm,xm,vm")
14843 (parallel [(const_int 0) (const_int 2)
14844 (const_int 4) (const_int 6)
14845 (const_int 8) (const_int 10)
14846 (const_int 12) (const_int 14)]))))
14849 (vec_select:V8QI (match_dup 1)
14850 (parallel [(const_int 1) (const_int 3)
14851 (const_int 5) (const_int 7)
14852 (const_int 9) (const_int 11)
14853 (const_int 13) (const_int 15)])))
14855 (vec_select:V8QI (match_dup 2)
14856 (parallel [(const_int 1) (const_int 3)
14857 (const_int 5) (const_int 7)
14858 (const_int 9) (const_int 11)
14859 (const_int 13) (const_int 15)]))))))]
14862 pmaddubsw\t{%2, %0|%0, %2}
14863 vpmaddubsw\t{%2, %1, %0|%0, %1, %2}
14864 vpmaddubsw\t{%2, %1, %0|%0, %1, %2}"
14865 [(set_attr "isa" "noavx,avx,avx512bw")
14866 (set_attr "type" "sseiadd")
14867 (set_attr "atom_unit" "simul")
14868 (set_attr "prefix_data16" "1,*,*")
14869 (set_attr "prefix_extra" "1")
14870 (set_attr "prefix" "orig,vex,evex")
14871 (set_attr "mode" "TI")])
14873 (define_insn "ssse3_pmaddubsw"
14874 [(set (match_operand:V4HI 0 "register_operand" "=y")
14879 (match_operand:V8QI 1 "register_operand" "0")
14880 (parallel [(const_int 0) (const_int 2)
14881 (const_int 4) (const_int 6)])))
14884 (match_operand:V8QI 2 "nonimmediate_operand" "ym")
14885 (parallel [(const_int 0) (const_int 2)
14886 (const_int 4) (const_int 6)]))))
14889 (vec_select:V4QI (match_dup 1)
14890 (parallel [(const_int 1) (const_int 3)
14891 (const_int 5) (const_int 7)])))
14893 (vec_select:V4QI (match_dup 2)
14894 (parallel [(const_int 1) (const_int 3)
14895 (const_int 5) (const_int 7)]))))))]
14897 "pmaddubsw\t{%2, %0|%0, %2}"
14898 [(set_attr "type" "sseiadd")
14899 (set_attr "atom_unit" "simul")
14900 (set_attr "prefix_extra" "1")
14901 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14902 (set_attr "mode" "DI")])
14904 (define_mode_iterator PMULHRSW
14905 [V4HI V8HI (V16HI "TARGET_AVX2")])
14907 (define_expand "<ssse3_avx2>_pmulhrsw<mode>3_mask"
14908 [(set (match_operand:PMULHRSW 0 "register_operand")
14909 (vec_merge:PMULHRSW
14911 (lshiftrt:<ssedoublemode>
14912 (plus:<ssedoublemode>
14913 (lshiftrt:<ssedoublemode>
14914 (mult:<ssedoublemode>
14915 (sign_extend:<ssedoublemode>
14916 (match_operand:PMULHRSW 1 "nonimmediate_operand"))
14917 (sign_extend:<ssedoublemode>
14918 (match_operand:PMULHRSW 2 "nonimmediate_operand")))
14922 (match_operand:PMULHRSW 3 "register_operand")
14923 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
14924 "TARGET_AVX512BW && TARGET_AVX512VL"
14926 operands[5] = CONST1_RTX(<MODE>mode);
14927 ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);
14930 (define_expand "<ssse3_avx2>_pmulhrsw<mode>3"
14931 [(set (match_operand:PMULHRSW 0 "register_operand")
14933 (lshiftrt:<ssedoublemode>
14934 (plus:<ssedoublemode>
14935 (lshiftrt:<ssedoublemode>
14936 (mult:<ssedoublemode>
14937 (sign_extend:<ssedoublemode>
14938 (match_operand:PMULHRSW 1 "nonimmediate_operand"))
14939 (sign_extend:<ssedoublemode>
14940 (match_operand:PMULHRSW 2 "nonimmediate_operand")))
14946 operands[3] = CONST1_RTX(<MODE>mode);
14947 ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);
14950 (define_insn "*<ssse3_avx2>_pmulhrsw<mode>3<mask_name>"
14951 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,x,v")
14953 (lshiftrt:<ssedoublemode>
14954 (plus:<ssedoublemode>
14955 (lshiftrt:<ssedoublemode>
14956 (mult:<ssedoublemode>
14957 (sign_extend:<ssedoublemode>
14958 (match_operand:VI2_AVX2 1 "vector_operand" "%0,x,v"))
14959 (sign_extend:<ssedoublemode>
14960 (match_operand:VI2_AVX2 2 "vector_operand" "xBm,xm,vm")))
14962 (match_operand:VI2_AVX2 3 "const1_operand"))
14964 "TARGET_SSSE3 && <mask_mode512bit_condition> && <mask_avx512bw_condition>
14965 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
14967 pmulhrsw\t{%2, %0|%0, %2}
14968 vpmulhrsw\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}
14969 vpmulhrsw\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}"
14970 [(set_attr "isa" "noavx,avx,avx512bw")
14971 (set_attr "type" "sseimul")
14972 (set_attr "prefix_data16" "1,*,*")
14973 (set_attr "prefix_extra" "1")
14974 (set_attr "prefix" "orig,maybe_evex,evex")
14975 (set_attr "mode" "<sseinsnmode>")])
14977 (define_insn "*ssse3_pmulhrswv4hi3"
14978 [(set (match_operand:V4HI 0 "register_operand" "=y")
14985 (match_operand:V4HI 1 "nonimmediate_operand" "%0"))
14987 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))
14989 (match_operand:V4HI 3 "const1_operand"))
14991 "TARGET_SSSE3 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
14992 "pmulhrsw\t{%2, %0|%0, %2}"
14993 [(set_attr "type" "sseimul")
14994 (set_attr "prefix_extra" "1")
14995 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14996 (set_attr "mode" "DI")])
14998 (define_insn "<ssse3_avx2>_pshufb<mode>3<mask_name>"
14999 [(set (match_operand:VI1_AVX512 0 "register_operand" "=x,x,v")
15001 [(match_operand:VI1_AVX512 1 "register_operand" "0,x,v")
15002 (match_operand:VI1_AVX512 2 "vector_operand" "xBm,xm,vm")]
15004 "TARGET_SSSE3 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
15006 pshufb\t{%2, %0|%0, %2}
15007 vpshufb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
15008 vpshufb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
15009 [(set_attr "isa" "noavx,avx,avx512bw")
15010 (set_attr "type" "sselog1")
15011 (set_attr "prefix_data16" "1,*,*")
15012 (set_attr "prefix_extra" "1")
15013 (set_attr "prefix" "orig,maybe_evex,evex")
15014 (set_attr "btver2_decode" "vector")
15015 (set_attr "mode" "<sseinsnmode>")])
15017 (define_insn "ssse3_pshufbv8qi3"
15018 [(set (match_operand:V8QI 0 "register_operand" "=y")
15019 (unspec:V8QI [(match_operand:V8QI 1 "register_operand" "0")
15020 (match_operand:V8QI 2 "nonimmediate_operand" "ym")]
15023 "pshufb\t{%2, %0|%0, %2}";
15024 [(set_attr "type" "sselog1")
15025 (set_attr "prefix_extra" "1")
15026 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
15027 (set_attr "mode" "DI")])
15029 (define_insn "<ssse3_avx2>_psign<mode>3"
15030 [(set (match_operand:VI124_AVX2 0 "register_operand" "=x,x")
15032 [(match_operand:VI124_AVX2 1 "register_operand" "0,x")
15033 (match_operand:VI124_AVX2 2 "vector_operand" "xBm,xm")]
15037 psign<ssemodesuffix>\t{%2, %0|%0, %2}
15038 vpsign<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
15039 [(set_attr "isa" "noavx,avx")
15040 (set_attr "type" "sselog1")
15041 (set_attr "prefix_data16" "1,*")
15042 (set_attr "prefix_extra" "1")
15043 (set_attr "prefix" "orig,vex")
15044 (set_attr "mode" "<sseinsnmode>")])
15046 (define_insn "ssse3_psign<mode>3"
15047 [(set (match_operand:MMXMODEI 0 "register_operand" "=y")
15049 [(match_operand:MMXMODEI 1 "register_operand" "0")
15050 (match_operand:MMXMODEI 2 "nonimmediate_operand" "ym")]
15053 "psign<mmxvecsize>\t{%2, %0|%0, %2}";
15054 [(set_attr "type" "sselog1")
15055 (set_attr "prefix_extra" "1")
15056 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
15057 (set_attr "mode" "DI")])
15059 (define_insn "<ssse3_avx2>_palignr<mode>_mask"
15060 [(set (match_operand:VI1_AVX512 0 "register_operand" "=v")
15061 (vec_merge:VI1_AVX512
15063 [(match_operand:VI1_AVX512 1 "register_operand" "v")
15064 (match_operand:VI1_AVX512 2 "nonimmediate_operand" "vm")
15065 (match_operand:SI 3 "const_0_to_255_mul_8_operand" "n")]
15067 (match_operand:VI1_AVX512 4 "vector_move_operand" "0C")
15068 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
15069 "TARGET_AVX512BW && (<MODE_SIZE> == 64 || TARGET_AVX512VL)"
15071 operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
15072 return "vpalignr\t{%3, %2, %1, %0%{%5%}%N4|%0%{%5%}%N4, %1, %2, %3}";
15074 [(set_attr "type" "sseishft")
15075 (set_attr "atom_unit" "sishuf")
15076 (set_attr "prefix_extra" "1")
15077 (set_attr "length_immediate" "1")
15078 (set_attr "prefix" "evex")
15079 (set_attr "mode" "<sseinsnmode>")])
15081 (define_insn "<ssse3_avx2>_palignr<mode>"
15082 [(set (match_operand:SSESCALARMODE 0 "register_operand" "=x,x,v")
15083 (unspec:SSESCALARMODE
15084 [(match_operand:SSESCALARMODE 1 "register_operand" "0,x,v")
15085 (match_operand:SSESCALARMODE 2 "vector_operand" "xBm,xm,vm")
15086 (match_operand:SI 3 "const_0_to_255_mul_8_operand" "n,n,n")]
15090 operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
15092 switch (which_alternative)
15095 return "palignr\t{%3, %2, %0|%0, %2, %3}";
15098 return "vpalignr\t{%3, %2, %1, %0|%0, %1, %2, %3}";
15100 gcc_unreachable ();
15103 [(set_attr "isa" "noavx,avx,avx512bw")
15104 (set_attr "type" "sseishft")
15105 (set_attr "atom_unit" "sishuf")
15106 (set_attr "prefix_data16" "1,*,*")
15107 (set_attr "prefix_extra" "1")
15108 (set_attr "length_immediate" "1")
15109 (set_attr "prefix" "orig,vex,evex")
15110 (set_attr "mode" "<sseinsnmode>")])
15112 (define_insn "ssse3_palignrdi"
15113 [(set (match_operand:DI 0 "register_operand" "=y")
15114 (unspec:DI [(match_operand:DI 1 "register_operand" "0")
15115 (match_operand:DI 2 "nonimmediate_operand" "ym")
15116 (match_operand:SI 3 "const_0_to_255_mul_8_operand" "n")]
15120 operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
15121 return "palignr\t{%3, %2, %0|%0, %2, %3}";
15123 [(set_attr "type" "sseishft")
15124 (set_attr "atom_unit" "sishuf")
15125 (set_attr "prefix_extra" "1")
15126 (set_attr "length_immediate" "1")
15127 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
15128 (set_attr "mode" "DI")])
15130 ;; Mode iterator to handle singularity w/ absence of V2DI and V4DI
15131 ;; modes for abs instruction on pre AVX-512 targets.
15132 (define_mode_iterator VI1248_AVX512VL_AVX512BW
15133 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI
15134 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI
15135 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX2") V4SI
15136 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")])
15138 (define_insn "*abs<mode>2"
15139 [(set (match_operand:VI1248_AVX512VL_AVX512BW 0 "register_operand" "=v")
15140 (abs:VI1248_AVX512VL_AVX512BW
15141 (match_operand:VI1248_AVX512VL_AVX512BW 1 "vector_operand" "vBm")))]
15143 "%vpabs<ssemodesuffix>\t{%1, %0|%0, %1}"
15144 [(set_attr "type" "sselog1")
15145 (set_attr "prefix_data16" "1")
15146 (set_attr "prefix_extra" "1")
15147 (set_attr "prefix" "maybe_vex")
15148 (set_attr "mode" "<sseinsnmode>")])
15150 (define_insn "abs<mode>2_mask"
15151 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
15152 (vec_merge:VI48_AVX512VL
15154 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm"))
15155 (match_operand:VI48_AVX512VL 2 "vector_move_operand" "0C")
15156 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
15158 "vpabs<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
15159 [(set_attr "type" "sselog1")
15160 (set_attr "prefix" "evex")
15161 (set_attr "mode" "<sseinsnmode>")])
15163 (define_insn "abs<mode>2_mask"
15164 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
15165 (vec_merge:VI12_AVX512VL
15167 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "vm"))
15168 (match_operand:VI12_AVX512VL 2 "vector_move_operand" "0C")
15169 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
15171 "vpabs<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
15172 [(set_attr "type" "sselog1")
15173 (set_attr "prefix" "evex")
15174 (set_attr "mode" "<sseinsnmode>")])
15176 (define_expand "abs<mode>2"
15177 [(set (match_operand:VI1248_AVX512VL_AVX512BW 0 "register_operand")
15178 (abs:VI1248_AVX512VL_AVX512BW
15179 (match_operand:VI1248_AVX512VL_AVX512BW 1 "vector_operand")))]
15184 ix86_expand_sse2_abs (operands[0], operands[1]);
15189 (define_insn "abs<mode>2"
15190 [(set (match_operand:MMXMODEI 0 "register_operand" "=y")
15192 (match_operand:MMXMODEI 1 "nonimmediate_operand" "ym")))]
15194 "pabs<mmxvecsize>\t{%1, %0|%0, %1}";
15195 [(set_attr "type" "sselog1")
15196 (set_attr "prefix_rep" "0")
15197 (set_attr "prefix_extra" "1")
15198 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
15199 (set_attr "mode" "DI")])
15201 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15203 ;; AMD SSE4A instructions
15205 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15207 (define_insn "sse4a_movnt<mode>"
15208 [(set (match_operand:MODEF 0 "memory_operand" "=m")
15210 [(match_operand:MODEF 1 "register_operand" "x")]
15213 "movnt<ssemodesuffix>\t{%1, %0|%0, %1}"
15214 [(set_attr "type" "ssemov")
15215 (set_attr "mode" "<MODE>")])
15217 (define_insn "sse4a_vmmovnt<mode>"
15218 [(set (match_operand:<ssescalarmode> 0 "memory_operand" "=m")
15219 (unspec:<ssescalarmode>
15220 [(vec_select:<ssescalarmode>
15221 (match_operand:VF_128 1 "register_operand" "x")
15222 (parallel [(const_int 0)]))]
15225 "movnt<ssescalarmodesuffix>\t{%1, %0|%0, %1}"
15226 [(set_attr "type" "ssemov")
15227 (set_attr "mode" "<ssescalarmode>")])
15229 (define_insn "sse4a_extrqi"
15230 [(set (match_operand:V2DI 0 "register_operand" "=x")
15231 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
15232 (match_operand 2 "const_0_to_255_operand")
15233 (match_operand 3 "const_0_to_255_operand")]
15236 "extrq\t{%3, %2, %0|%0, %2, %3}"
15237 [(set_attr "type" "sse")
15238 (set_attr "prefix_data16" "1")
15239 (set_attr "length_immediate" "2")
15240 (set_attr "mode" "TI")])
15242 (define_insn "sse4a_extrq"
15243 [(set (match_operand:V2DI 0 "register_operand" "=x")
15244 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
15245 (match_operand:V16QI 2 "register_operand" "x")]
15248 "extrq\t{%2, %0|%0, %2}"
15249 [(set_attr "type" "sse")
15250 (set_attr "prefix_data16" "1")
15251 (set_attr "mode" "TI")])
15253 (define_insn "sse4a_insertqi"
15254 [(set (match_operand:V2DI 0 "register_operand" "=x")
15255 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
15256 (match_operand:V2DI 2 "register_operand" "x")
15257 (match_operand 3 "const_0_to_255_operand")
15258 (match_operand 4 "const_0_to_255_operand")]
15261 "insertq\t{%4, %3, %2, %0|%0, %2, %3, %4}"
15262 [(set_attr "type" "sseins")
15263 (set_attr "prefix_data16" "0")
15264 (set_attr "prefix_rep" "1")
15265 (set_attr "length_immediate" "2")
15266 (set_attr "mode" "TI")])
15268 (define_insn "sse4a_insertq"
15269 [(set (match_operand:V2DI 0 "register_operand" "=x")
15270 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
15271 (match_operand:V2DI 2 "register_operand" "x")]
15274 "insertq\t{%2, %0|%0, %2}"
15275 [(set_attr "type" "sseins")
15276 (set_attr "prefix_data16" "0")
15277 (set_attr "prefix_rep" "1")
15278 (set_attr "mode" "TI")])
15280 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15282 ;; Intel SSE4.1 instructions
15284 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15286 ;; Mapping of immediate bits for blend instructions
15287 (define_mode_attr blendbits
15288 [(V8SF "255") (V4SF "15") (V4DF "15") (V2DF "3")])
15290 (define_insn "<sse4_1>_blend<ssemodesuffix><avxsizesuffix>"
15291 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
15292 (vec_merge:VF_128_256
15293 (match_operand:VF_128_256 2 "vector_operand" "YrBm,*xBm,xm")
15294 (match_operand:VF_128_256 1 "register_operand" "0,0,x")
15295 (match_operand:SI 3 "const_0_to_<blendbits>_operand")))]
15298 blend<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15299 blend<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15300 vblend<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15301 [(set_attr "isa" "noavx,noavx,avx")
15302 (set_attr "type" "ssemov")
15303 (set_attr "length_immediate" "1")
15304 (set_attr "prefix_data16" "1,1,*")
15305 (set_attr "prefix_extra" "1")
15306 (set_attr "prefix" "orig,orig,vex")
15307 (set_attr "mode" "<MODE>")])
15309 (define_insn "<sse4_1>_blendv<ssemodesuffix><avxsizesuffix>"
15310 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
15312 [(match_operand:VF_128_256 1 "register_operand" "0,0,x")
15313 (match_operand:VF_128_256 2 "vector_operand" "YrBm,*xBm,xm")
15314 (match_operand:VF_128_256 3 "register_operand" "Yz,Yz,x")]
15318 blendv<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15319 blendv<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15320 vblendv<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15321 [(set_attr "isa" "noavx,noavx,avx")
15322 (set_attr "type" "ssemov")
15323 (set_attr "length_immediate" "1")
15324 (set_attr "prefix_data16" "1,1,*")
15325 (set_attr "prefix_extra" "1")
15326 (set_attr "prefix" "orig,orig,vex")
15327 (set_attr "btver2_decode" "vector,vector,vector")
15328 (set_attr "mode" "<MODE>")])
15330 (define_insn "<sse4_1>_dp<ssemodesuffix><avxsizesuffix>"
15331 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
15333 [(match_operand:VF_128_256 1 "vector_operand" "%0,0,x")
15334 (match_operand:VF_128_256 2 "vector_operand" "YrBm,*xBm,xm")
15335 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")]
15339 dp<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15340 dp<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15341 vdp<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15342 [(set_attr "isa" "noavx,noavx,avx")
15343 (set_attr "type" "ssemul")
15344 (set_attr "length_immediate" "1")
15345 (set_attr "prefix_data16" "1,1,*")
15346 (set_attr "prefix_extra" "1")
15347 (set_attr "prefix" "orig,orig,vex")
15348 (set_attr "btver2_decode" "vector,vector,vector")
15349 (set_attr "znver1_decode" "vector,vector,vector")
15350 (set_attr "mode" "<MODE>")])
15352 ;; Mode attribute used by `vmovntdqa' pattern
15353 (define_mode_attr vi8_sse4_1_avx2_avx512
15354 [(V2DI "sse4_1") (V4DI "avx2") (V8DI "avx512f")])
15356 (define_insn "<vi8_sse4_1_avx2_avx512>_movntdqa"
15357 [(set (match_operand:VI8_AVX2_AVX512F 0 "register_operand" "=Yr,*x,v")
15358 (unspec:VI8_AVX2_AVX512F [(match_operand:VI8_AVX2_AVX512F 1 "memory_operand" "m,m,m")]
15361 "%vmovntdqa\t{%1, %0|%0, %1}"
15362 [(set_attr "isa" "noavx,noavx,avx")
15363 (set_attr "type" "ssemov")
15364 (set_attr "prefix_extra" "1,1,*")
15365 (set_attr "prefix" "orig,orig,maybe_evex")
15366 (set_attr "mode" "<sseinsnmode>")])
15368 (define_insn "<sse4_1_avx2>_mpsadbw"
15369 [(set (match_operand:VI1_AVX2 0 "register_operand" "=Yr,*x,x")
15371 [(match_operand:VI1_AVX2 1 "register_operand" "0,0,x")
15372 (match_operand:VI1_AVX2 2 "vector_operand" "YrBm,*xBm,xm")
15373 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")]
15377 mpsadbw\t{%3, %2, %0|%0, %2, %3}
15378 mpsadbw\t{%3, %2, %0|%0, %2, %3}
15379 vmpsadbw\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15380 [(set_attr "isa" "noavx,noavx,avx")
15381 (set_attr "type" "sselog1")
15382 (set_attr "length_immediate" "1")
15383 (set_attr "prefix_extra" "1")
15384 (set_attr "prefix" "orig,orig,vex")
15385 (set_attr "btver2_decode" "vector,vector,vector")
15386 (set_attr "znver1_decode" "vector,vector,vector")
15387 (set_attr "mode" "<sseinsnmode>")])
15389 (define_insn "<sse4_1_avx2>_packusdw<mask_name>"
15390 [(set (match_operand:VI2_AVX2 0 "register_operand" "=Yr,*x,x,v")
15391 (vec_concat:VI2_AVX2
15392 (us_truncate:<ssehalfvecmode>
15393 (match_operand:<sseunpackmode> 1 "register_operand" "0,0,x,v"))
15394 (us_truncate:<ssehalfvecmode>
15395 (match_operand:<sseunpackmode> 2 "vector_operand" "YrBm,*xBm,xm,vm"))))]
15396 "TARGET_SSE4_1 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
15398 packusdw\t{%2, %0|%0, %2}
15399 packusdw\t{%2, %0|%0, %2}
15400 vpackusdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
15401 vpackusdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
15402 [(set_attr "isa" "noavx,noavx,avx,avx512bw")
15403 (set_attr "type" "sselog")
15404 (set_attr "prefix_extra" "1")
15405 (set_attr "prefix" "orig,orig,<mask_prefix>,evex")
15406 (set_attr "mode" "<sseinsnmode>")])
15408 (define_insn "<sse4_1_avx2>_pblendvb"
15409 [(set (match_operand:VI1_AVX2 0 "register_operand" "=Yr,*x,x")
15411 [(match_operand:VI1_AVX2 1 "register_operand" "0,0,x")
15412 (match_operand:VI1_AVX2 2 "vector_operand" "YrBm,*xBm,xm")
15413 (match_operand:VI1_AVX2 3 "register_operand" "Yz,Yz,x")]
15417 pblendvb\t{%3, %2, %0|%0, %2, %3}
15418 pblendvb\t{%3, %2, %0|%0, %2, %3}
15419 vpblendvb\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15420 [(set_attr "isa" "noavx,noavx,avx")
15421 (set_attr "type" "ssemov")
15422 (set_attr "prefix_extra" "1")
15423 (set_attr "length_immediate" "*,*,1")
15424 (set_attr "prefix" "orig,orig,vex")
15425 (set_attr "btver2_decode" "vector,vector,vector")
15426 (set_attr "mode" "<sseinsnmode>")])
15428 (define_insn "sse4_1_pblendw"
15429 [(set (match_operand:V8HI 0 "register_operand" "=Yr,*x,x")
15431 (match_operand:V8HI 2 "vector_operand" "YrBm,*xBm,xm")
15432 (match_operand:V8HI 1 "register_operand" "0,0,x")
15433 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")))]
15436 pblendw\t{%3, %2, %0|%0, %2, %3}
15437 pblendw\t{%3, %2, %0|%0, %2, %3}
15438 vpblendw\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15439 [(set_attr "isa" "noavx,noavx,avx")
15440 (set_attr "type" "ssemov")
15441 (set_attr "prefix_extra" "1")
15442 (set_attr "length_immediate" "1")
15443 (set_attr "prefix" "orig,orig,vex")
15444 (set_attr "mode" "TI")])
15446 ;; The builtin uses an 8-bit immediate. Expand that.
15447 (define_expand "avx2_pblendw"
15448 [(set (match_operand:V16HI 0 "register_operand")
15450 (match_operand:V16HI 2 "nonimmediate_operand")
15451 (match_operand:V16HI 1 "register_operand")
15452 (match_operand:SI 3 "const_0_to_255_operand")))]
15455 HOST_WIDE_INT val = INTVAL (operands[3]) & 0xff;
15456 operands[3] = GEN_INT (val << 8 | val);
15459 (define_insn "*avx2_pblendw"
15460 [(set (match_operand:V16HI 0 "register_operand" "=x")
15462 (match_operand:V16HI 2 "nonimmediate_operand" "xm")
15463 (match_operand:V16HI 1 "register_operand" "x")
15464 (match_operand:SI 3 "avx2_pblendw_operand" "n")))]
15467 operands[3] = GEN_INT (INTVAL (operands[3]) & 0xff);
15468 return "vpblendw\t{%3, %2, %1, %0|%0, %1, %2, %3}";
15470 [(set_attr "type" "ssemov")
15471 (set_attr "prefix_extra" "1")
15472 (set_attr "length_immediate" "1")
15473 (set_attr "prefix" "vex")
15474 (set_attr "mode" "OI")])
15476 (define_insn "avx2_pblendd<mode>"
15477 [(set (match_operand:VI4_AVX2 0 "register_operand" "=x")
15478 (vec_merge:VI4_AVX2
15479 (match_operand:VI4_AVX2 2 "nonimmediate_operand" "xm")
15480 (match_operand:VI4_AVX2 1 "register_operand" "x")
15481 (match_operand:SI 3 "const_0_to_255_operand" "n")))]
15483 "vpblendd\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15484 [(set_attr "type" "ssemov")
15485 (set_attr "prefix_extra" "1")
15486 (set_attr "length_immediate" "1")
15487 (set_attr "prefix" "vex")
15488 (set_attr "mode" "<sseinsnmode>")])
15490 (define_insn "sse4_1_phminposuw"
15491 [(set (match_operand:V8HI 0 "register_operand" "=Yr,*x,x")
15492 (unspec:V8HI [(match_operand:V8HI 1 "vector_operand" "YrBm,*xBm,xm")]
15493 UNSPEC_PHMINPOSUW))]
15495 "%vphminposuw\t{%1, %0|%0, %1}"
15496 [(set_attr "isa" "noavx,noavx,avx")
15497 (set_attr "type" "sselog1")
15498 (set_attr "prefix_extra" "1")
15499 (set_attr "prefix" "orig,orig,vex")
15500 (set_attr "mode" "TI")])
15502 (define_insn "avx2_<code>v16qiv16hi2<mask_name>"
15503 [(set (match_operand:V16HI 0 "register_operand" "=v")
15505 (match_operand:V16QI 1 "nonimmediate_operand" "vm")))]
15506 "TARGET_AVX2 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
15507 "vpmov<extsuffix>bw\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15508 [(set_attr "type" "ssemov")
15509 (set_attr "prefix_extra" "1")
15510 (set_attr "prefix" "maybe_evex")
15511 (set_attr "mode" "OI")])
15513 (define_insn "avx512bw_<code>v32qiv32hi2<mask_name>"
15514 [(set (match_operand:V32HI 0 "register_operand" "=v")
15516 (match_operand:V32QI 1 "nonimmediate_operand" "vm")))]
15518 "vpmov<extsuffix>bw\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15519 [(set_attr "type" "ssemov")
15520 (set_attr "prefix_extra" "1")
15521 (set_attr "prefix" "evex")
15522 (set_attr "mode" "XI")])
15524 (define_insn "sse4_1_<code>v8qiv8hi2<mask_name>"
15525 [(set (match_operand:V8HI 0 "register_operand" "=Yr,*x,v")
15528 (match_operand:V16QI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15529 (parallel [(const_int 0) (const_int 1)
15530 (const_int 2) (const_int 3)
15531 (const_int 4) (const_int 5)
15532 (const_int 6) (const_int 7)]))))]
15533 "TARGET_SSE4_1 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
15534 "%vpmov<extsuffix>bw\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15535 [(set_attr "isa" "noavx,noavx,avx")
15536 (set_attr "type" "ssemov")
15537 (set_attr "prefix_extra" "1")
15538 (set_attr "prefix" "orig,orig,maybe_evex")
15539 (set_attr "mode" "TI")])
15541 (define_insn "<mask_codefor>avx512f_<code>v16qiv16si2<mask_name>"
15542 [(set (match_operand:V16SI 0 "register_operand" "=v")
15544 (match_operand:V16QI 1 "nonimmediate_operand" "vm")))]
15546 "vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15547 [(set_attr "type" "ssemov")
15548 (set_attr "prefix" "evex")
15549 (set_attr "mode" "XI")])
15551 (define_insn "avx2_<code>v8qiv8si2<mask_name>"
15552 [(set (match_operand:V8SI 0 "register_operand" "=v")
15555 (match_operand:V16QI 1 "nonimmediate_operand" "vm")
15556 (parallel [(const_int 0) (const_int 1)
15557 (const_int 2) (const_int 3)
15558 (const_int 4) (const_int 5)
15559 (const_int 6) (const_int 7)]))))]
15560 "TARGET_AVX2 && <mask_avx512vl_condition>"
15561 "vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15562 [(set_attr "type" "ssemov")
15563 (set_attr "prefix_extra" "1")
15564 (set_attr "prefix" "maybe_evex")
15565 (set_attr "mode" "OI")])
15567 (define_insn "sse4_1_<code>v4qiv4si2<mask_name>"
15568 [(set (match_operand:V4SI 0 "register_operand" "=Yr,*x,v")
15571 (match_operand:V16QI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15572 (parallel [(const_int 0) (const_int 1)
15573 (const_int 2) (const_int 3)]))))]
15574 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15575 "%vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
15576 [(set_attr "isa" "noavx,noavx,avx")
15577 (set_attr "type" "ssemov")
15578 (set_attr "prefix_extra" "1")
15579 (set_attr "prefix" "orig,orig,maybe_evex")
15580 (set_attr "mode" "TI")])
15582 (define_insn "avx512f_<code>v16hiv16si2<mask_name>"
15583 [(set (match_operand:V16SI 0 "register_operand" "=v")
15585 (match_operand:V16HI 1 "nonimmediate_operand" "vm")))]
15587 "vpmov<extsuffix>wd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15588 [(set_attr "type" "ssemov")
15589 (set_attr "prefix" "evex")
15590 (set_attr "mode" "XI")])
15592 (define_insn "avx2_<code>v8hiv8si2<mask_name>"
15593 [(set (match_operand:V8SI 0 "register_operand" "=v")
15595 (match_operand:V8HI 1 "nonimmediate_operand" "vm")))]
15596 "TARGET_AVX2 && <mask_avx512vl_condition>"
15597 "vpmov<extsuffix>wd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15598 [(set_attr "type" "ssemov")
15599 (set_attr "prefix_extra" "1")
15600 (set_attr "prefix" "maybe_evex")
15601 (set_attr "mode" "OI")])
15603 (define_insn "sse4_1_<code>v4hiv4si2<mask_name>"
15604 [(set (match_operand:V4SI 0 "register_operand" "=Yr,*x,v")
15607 (match_operand:V8HI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15608 (parallel [(const_int 0) (const_int 1)
15609 (const_int 2) (const_int 3)]))))]
15610 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15611 "%vpmov<extsuffix>wd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15612 [(set_attr "isa" "noavx,noavx,avx")
15613 (set_attr "type" "ssemov")
15614 (set_attr "prefix_extra" "1")
15615 (set_attr "prefix" "orig,orig,maybe_evex")
15616 (set_attr "mode" "TI")])
15618 (define_insn "avx512f_<code>v8qiv8di2<mask_name>"
15619 [(set (match_operand:V8DI 0 "register_operand" "=v")
15622 (match_operand:V16QI 1 "nonimmediate_operand" "vm")
15623 (parallel [(const_int 0) (const_int 1)
15624 (const_int 2) (const_int 3)
15625 (const_int 4) (const_int 5)
15626 (const_int 6) (const_int 7)]))))]
15628 "vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
15629 [(set_attr "type" "ssemov")
15630 (set_attr "prefix" "evex")
15631 (set_attr "mode" "XI")])
15633 (define_insn "avx2_<code>v4qiv4di2<mask_name>"
15634 [(set (match_operand:V4DI 0 "register_operand" "=v")
15637 (match_operand:V16QI 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>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
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>v2qiv2di2<mask_name>"
15648 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
15651 (match_operand:V16QI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15652 (parallel [(const_int 0) (const_int 1)]))))]
15653 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15654 "%vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %w1}"
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>v8hiv8di2<mask_name>"
15662 [(set (match_operand:V8DI 0 "register_operand" "=v")
15664 (match_operand:V8HI 1 "nonimmediate_operand" "vm")))]
15666 "vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15667 [(set_attr "type" "ssemov")
15668 (set_attr "prefix" "evex")
15669 (set_attr "mode" "XI")])
15671 (define_insn "avx2_<code>v4hiv4di2<mask_name>"
15672 [(set (match_operand:V4DI 0 "register_operand" "=v")
15675 (match_operand:V8HI 1 "nonimmediate_operand" "vm")
15676 (parallel [(const_int 0) (const_int 1)
15677 (const_int 2) (const_int 3)]))))]
15678 "TARGET_AVX2 && <mask_avx512vl_condition>"
15679 "vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15680 [(set_attr "type" "ssemov")
15681 (set_attr "prefix_extra" "1")
15682 (set_attr "prefix" "maybe_evex")
15683 (set_attr "mode" "OI")])
15685 (define_insn "sse4_1_<code>v2hiv2di2<mask_name>"
15686 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
15689 (match_operand:V8HI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15690 (parallel [(const_int 0) (const_int 1)]))))]
15691 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15692 "%vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
15693 [(set_attr "isa" "noavx,noavx,avx")
15694 (set_attr "type" "ssemov")
15695 (set_attr "prefix_extra" "1")
15696 (set_attr "prefix" "orig,orig,maybe_evex")
15697 (set_attr "mode" "TI")])
15699 (define_insn "avx512f_<code>v8siv8di2<mask_name>"
15700 [(set (match_operand:V8DI 0 "register_operand" "=v")
15702 (match_operand:V8SI 1 "nonimmediate_operand" "vm")))]
15704 "vpmov<extsuffix>dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15705 [(set_attr "type" "ssemov")
15706 (set_attr "prefix" "evex")
15707 (set_attr "mode" "XI")])
15709 (define_insn "avx2_<code>v4siv4di2<mask_name>"
15710 [(set (match_operand:V4DI 0 "register_operand" "=v")
15712 (match_operand:V4SI 1 "nonimmediate_operand" "vm")))]
15713 "TARGET_AVX2 && <mask_avx512vl_condition>"
15714 "vpmov<extsuffix>dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15715 [(set_attr "type" "ssemov")
15716 (set_attr "prefix" "maybe_evex")
15717 (set_attr "prefix_extra" "1")
15718 (set_attr "mode" "OI")])
15720 (define_insn "sse4_1_<code>v2siv2di2<mask_name>"
15721 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
15724 (match_operand:V4SI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15725 (parallel [(const_int 0) (const_int 1)]))))]
15726 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15727 "%vpmov<extsuffix>dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15728 [(set_attr "isa" "noavx,noavx,avx")
15729 (set_attr "type" "ssemov")
15730 (set_attr "prefix_extra" "1")
15731 (set_attr "prefix" "orig,orig,maybe_evex")
15732 (set_attr "mode" "TI")])
15734 ;; ptestps/ptestpd are very similar to comiss and ucomiss when
15735 ;; setting FLAGS_REG. But it is not a really compare instruction.
15736 (define_insn "avx_vtest<ssemodesuffix><avxsizesuffix>"
15737 [(set (reg:CC FLAGS_REG)
15738 (unspec:CC [(match_operand:VF_128_256 0 "register_operand" "x")
15739 (match_operand:VF_128_256 1 "nonimmediate_operand" "xm")]
15742 "vtest<ssemodesuffix>\t{%1, %0|%0, %1}"
15743 [(set_attr "type" "ssecomi")
15744 (set_attr "prefix_extra" "1")
15745 (set_attr "prefix" "vex")
15746 (set_attr "mode" "<MODE>")])
15748 ;; ptest is very similar to comiss and ucomiss when setting FLAGS_REG.
15749 ;; But it is not a really compare instruction.
15750 (define_insn "<sse4_1>_ptest<mode>"
15751 [(set (reg:CC FLAGS_REG)
15752 (unspec:CC [(match_operand:V_AVX 0 "register_operand" "Yr, *x, x")
15753 (match_operand:V_AVX 1 "vector_operand" "YrBm, *xBm, xm")]
15756 "%vptest\t{%1, %0|%0, %1}"
15757 [(set_attr "isa" "noavx,noavx,avx")
15758 (set_attr "type" "ssecomi")
15759 (set_attr "prefix_extra" "1")
15760 (set_attr "prefix" "orig,orig,vex")
15761 (set (attr "btver2_decode")
15763 (match_test "<sseinsnmode>mode==OImode")
15764 (const_string "vector")
15765 (const_string "*")))
15766 (set_attr "mode" "<sseinsnmode>")])
15768 (define_insn "ptesttf2"
15769 [(set (reg:CC FLAGS_REG)
15770 (unspec:CC [(match_operand:TF 0 "register_operand" "Yr, *x, x")
15771 (match_operand:TF 1 "vector_operand" "YrBm, *xBm, xm")]
15774 "%vptest\t{%1, %0|%0, %1}"
15775 [(set_attr "isa" "noavx,noavx,avx")
15776 (set_attr "type" "ssecomi")
15777 (set_attr "prefix_extra" "1")
15778 (set_attr "prefix" "orig,orig,vex")
15779 (set_attr "mode" "TI")])
15781 (define_insn "<sse4_1>_round<ssemodesuffix><avxsizesuffix>"
15782 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
15784 [(match_operand:VF_128_256 1 "vector_operand" "YrBm,*xBm,xm")
15785 (match_operand:SI 2 "const_0_to_15_operand" "n,n,n")]
15788 "%vround<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
15789 [(set_attr "isa" "noavx,noavx,avx")
15790 (set_attr "type" "ssecvt")
15791 (set_attr "prefix_data16" "1,1,*")
15792 (set_attr "prefix_extra" "1")
15793 (set_attr "length_immediate" "1")
15794 (set_attr "prefix" "orig,orig,vex")
15795 (set_attr "mode" "<MODE>")])
15797 (define_expand "<sse4_1>_round<ssemodesuffix>_sfix<avxsizesuffix>"
15798 [(match_operand:<sseintvecmode> 0 "register_operand")
15799 (match_operand:VF1_128_256 1 "vector_operand")
15800 (match_operand:SI 2 "const_0_to_15_operand")]
15803 rtx tmp = gen_reg_rtx (<MODE>mode);
15806 (gen_<sse4_1>_round<ssemodesuffix><avxsizesuffix> (tmp, operands[1],
15809 (gen_fix_trunc<mode><sseintvecmodelower>2 (operands[0], tmp));
15813 (define_expand "avx512f_round<castmode>512"
15814 [(match_operand:VF_512 0 "register_operand")
15815 (match_operand:VF_512 1 "nonimmediate_operand")
15816 (match_operand:SI 2 "const_0_to_15_operand")]
15819 emit_insn (gen_avx512f_rndscale<mode> (operands[0], operands[1], operands[2]));
15823 (define_expand "avx512f_roundps512_sfix"
15824 [(match_operand:V16SI 0 "register_operand")
15825 (match_operand:V16SF 1 "nonimmediate_operand")
15826 (match_operand:SI 2 "const_0_to_15_operand")]
15829 rtx tmp = gen_reg_rtx (V16SFmode);
15830 emit_insn (gen_avx512f_rndscalev16sf (tmp, operands[1], operands[2]));
15831 emit_insn (gen_fix_truncv16sfv16si2 (operands[0], tmp));
15835 (define_expand "<sse4_1>_round<ssemodesuffix>_vec_pack_sfix<avxsizesuffix>"
15836 [(match_operand:<ssepackfltmode> 0 "register_operand")
15837 (match_operand:VF2 1 "vector_operand")
15838 (match_operand:VF2 2 "vector_operand")
15839 (match_operand:SI 3 "const_0_to_15_operand")]
15844 if (<MODE>mode == V2DFmode
15845 && TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
15847 rtx tmp2 = gen_reg_rtx (V4DFmode);
15849 tmp0 = gen_reg_rtx (V4DFmode);
15850 tmp1 = force_reg (V2DFmode, operands[1]);
15852 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
15853 emit_insn (gen_avx_roundpd256 (tmp2, tmp0, operands[3]));
15854 emit_insn (gen_fix_truncv4dfv4si2 (operands[0], tmp2));
15858 tmp0 = gen_reg_rtx (<MODE>mode);
15859 tmp1 = gen_reg_rtx (<MODE>mode);
15862 (gen_<sse4_1>_round<ssemodesuffix><avxsizesuffix> (tmp0, operands[1],
15865 (gen_<sse4_1>_round<ssemodesuffix><avxsizesuffix> (tmp1, operands[2],
15868 (gen_vec_pack_sfix_trunc_<mode> (operands[0], tmp0, tmp1));
15873 (define_insn "sse4_1_round<ssescalarmodesuffix>"
15874 [(set (match_operand:VF_128 0 "register_operand" "=Yr,*x,x,v")
15877 [(match_operand:VF_128 2 "register_operand" "Yr,*x,x,v")
15878 (match_operand:SI 3 "const_0_to_15_operand" "n,n,n,n")]
15880 (match_operand:VF_128 1 "register_operand" "0,0,x,v")
15884 round<ssescalarmodesuffix>\t{%3, %2, %0|%0, %2, %3}
15885 round<ssescalarmodesuffix>\t{%3, %2, %0|%0, %2, %3}
15886 vround<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
15887 vrndscale<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15888 [(set_attr "isa" "noavx,noavx,avx,avx512f")
15889 (set_attr "type" "ssecvt")
15890 (set_attr "length_immediate" "1")
15891 (set_attr "prefix_data16" "1,1,*,*")
15892 (set_attr "prefix_extra" "1")
15893 (set_attr "prefix" "orig,orig,vex,evex")
15894 (set_attr "mode" "<MODE>")])
15896 (define_expand "round<mode>2"
15897 [(set (match_dup 3)
15899 (match_operand:VF 1 "register_operand")
15901 (set (match_operand:VF 0 "register_operand")
15903 [(match_dup 3) (match_dup 4)]
15905 "TARGET_SSE4_1 && !flag_trapping_math"
15907 machine_mode scalar_mode;
15908 const struct real_format *fmt;
15909 REAL_VALUE_TYPE pred_half, half_minus_pred_half;
15910 rtx half, vec_half;
15912 scalar_mode = GET_MODE_INNER (<MODE>mode);
15914 /* load nextafter (0.5, 0.0) */
15915 fmt = REAL_MODE_FORMAT (scalar_mode);
15916 real_2expN (&half_minus_pred_half, -(fmt->p) - 1, scalar_mode);
15917 real_arithmetic (&pred_half, MINUS_EXPR, &dconsthalf, &half_minus_pred_half);
15918 half = const_double_from_real_value (pred_half, scalar_mode);
15920 vec_half = ix86_build_const_vector (<MODE>mode, true, half);
15921 vec_half = force_reg (<MODE>mode, vec_half);
15923 operands[2] = gen_reg_rtx (<MODE>mode);
15924 emit_insn (gen_copysign<mode>3 (operands[2], vec_half, operands[1]));
15926 operands[3] = gen_reg_rtx (<MODE>mode);
15927 operands[4] = GEN_INT (ROUND_TRUNC);
15930 (define_expand "round<mode>2_sfix"
15931 [(match_operand:<sseintvecmode> 0 "register_operand")
15932 (match_operand:VF1 1 "register_operand")]
15933 "TARGET_SSE4_1 && !flag_trapping_math"
15935 rtx tmp = gen_reg_rtx (<MODE>mode);
15937 emit_insn (gen_round<mode>2 (tmp, operands[1]));
15940 (gen_fix_trunc<mode><sseintvecmodelower>2 (operands[0], tmp));
15944 (define_expand "round<mode>2_vec_pack_sfix"
15945 [(match_operand:<ssepackfltmode> 0 "register_operand")
15946 (match_operand:VF2 1 "register_operand")
15947 (match_operand:VF2 2 "register_operand")]
15948 "TARGET_SSE4_1 && !flag_trapping_math"
15952 if (<MODE>mode == V2DFmode
15953 && TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
15955 rtx tmp2 = gen_reg_rtx (V4DFmode);
15957 tmp0 = gen_reg_rtx (V4DFmode);
15958 tmp1 = force_reg (V2DFmode, operands[1]);
15960 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
15961 emit_insn (gen_roundv4df2 (tmp2, tmp0));
15962 emit_insn (gen_fix_truncv4dfv4si2 (operands[0], tmp2));
15966 tmp0 = gen_reg_rtx (<MODE>mode);
15967 tmp1 = gen_reg_rtx (<MODE>mode);
15969 emit_insn (gen_round<mode>2 (tmp0, operands[1]));
15970 emit_insn (gen_round<mode>2 (tmp1, operands[2]));
15973 (gen_vec_pack_sfix_trunc_<mode> (operands[0], tmp0, tmp1));
15978 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15980 ;; Intel SSE4.2 string/text processing instructions
15982 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15984 (define_insn_and_split "sse4_2_pcmpestr"
15985 [(set (match_operand:SI 0 "register_operand" "=c,c")
15987 [(match_operand:V16QI 2 "register_operand" "x,x")
15988 (match_operand:SI 3 "register_operand" "a,a")
15989 (match_operand:V16QI 4 "nonimmediate_operand" "x,m")
15990 (match_operand:SI 5 "register_operand" "d,d")
15991 (match_operand:SI 6 "const_0_to_255_operand" "n,n")]
15993 (set (match_operand:V16QI 1 "register_operand" "=Yz,Yz")
16001 (set (reg:CC FLAGS_REG)
16010 && can_create_pseudo_p ()"
16015 int ecx = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[0]));
16016 int xmm0 = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[1]));
16017 int flags = !find_regno_note (curr_insn, REG_UNUSED, FLAGS_REG);
16020 emit_insn (gen_sse4_2_pcmpestri (operands[0], operands[2],
16021 operands[3], operands[4],
16022 operands[5], operands[6]));
16024 emit_insn (gen_sse4_2_pcmpestrm (operands[1], operands[2],
16025 operands[3], operands[4],
16026 operands[5], operands[6]));
16027 if (flags && !(ecx || xmm0))
16028 emit_insn (gen_sse4_2_pcmpestr_cconly (NULL, NULL,
16029 operands[2], operands[3],
16030 operands[4], operands[5],
16032 if (!(flags || ecx || xmm0))
16033 emit_note (NOTE_INSN_DELETED);
16037 [(set_attr "type" "sselog")
16038 (set_attr "prefix_data16" "1")
16039 (set_attr "prefix_extra" "1")
16040 (set_attr "length_immediate" "1")
16041 (set_attr "memory" "none,load")
16042 (set_attr "mode" "TI")])
16044 (define_insn "sse4_2_pcmpestri"
16045 [(set (match_operand:SI 0 "register_operand" "=c,c")
16047 [(match_operand:V16QI 1 "register_operand" "x,x")
16048 (match_operand:SI 2 "register_operand" "a,a")
16049 (match_operand:V16QI 3 "nonimmediate_operand" "x,m")
16050 (match_operand:SI 4 "register_operand" "d,d")
16051 (match_operand:SI 5 "const_0_to_255_operand" "n,n")]
16053 (set (reg:CC FLAGS_REG)
16062 "%vpcmpestri\t{%5, %3, %1|%1, %3, %5}"
16063 [(set_attr "type" "sselog")
16064 (set_attr "prefix_data16" "1")
16065 (set_attr "prefix_extra" "1")
16066 (set_attr "prefix" "maybe_vex")
16067 (set_attr "length_immediate" "1")
16068 (set_attr "btver2_decode" "vector")
16069 (set_attr "memory" "none,load")
16070 (set_attr "mode" "TI")])
16072 (define_insn "sse4_2_pcmpestrm"
16073 [(set (match_operand:V16QI 0 "register_operand" "=Yz,Yz")
16075 [(match_operand:V16QI 1 "register_operand" "x,x")
16076 (match_operand:SI 2 "register_operand" "a,a")
16077 (match_operand:V16QI 3 "nonimmediate_operand" "x,m")
16078 (match_operand:SI 4 "register_operand" "d,d")
16079 (match_operand:SI 5 "const_0_to_255_operand" "n,n")]
16081 (set (reg:CC FLAGS_REG)
16090 "%vpcmpestrm\t{%5, %3, %1|%1, %3, %5}"
16091 [(set_attr "type" "sselog")
16092 (set_attr "prefix_data16" "1")
16093 (set_attr "prefix_extra" "1")
16094 (set_attr "length_immediate" "1")
16095 (set_attr "prefix" "maybe_vex")
16096 (set_attr "btver2_decode" "vector")
16097 (set_attr "memory" "none,load")
16098 (set_attr "mode" "TI")])
16100 (define_insn "sse4_2_pcmpestr_cconly"
16101 [(set (reg:CC FLAGS_REG)
16103 [(match_operand:V16QI 2 "register_operand" "x,x,x,x")
16104 (match_operand:SI 3 "register_operand" "a,a,a,a")
16105 (match_operand:V16QI 4 "nonimmediate_operand" "x,m,x,m")
16106 (match_operand:SI 5 "register_operand" "d,d,d,d")
16107 (match_operand:SI 6 "const_0_to_255_operand" "n,n,n,n")]
16109 (clobber (match_scratch:V16QI 0 "=Yz,Yz,X,X"))
16110 (clobber (match_scratch:SI 1 "= X, X,c,c"))]
16113 %vpcmpestrm\t{%6, %4, %2|%2, %4, %6}
16114 %vpcmpestrm\t{%6, %4, %2|%2, %4, %6}
16115 %vpcmpestri\t{%6, %4, %2|%2, %4, %6}
16116 %vpcmpestri\t{%6, %4, %2|%2, %4, %6}"
16117 [(set_attr "type" "sselog")
16118 (set_attr "prefix_data16" "1")
16119 (set_attr "prefix_extra" "1")
16120 (set_attr "length_immediate" "1")
16121 (set_attr "memory" "none,load,none,load")
16122 (set_attr "btver2_decode" "vector,vector,vector,vector")
16123 (set_attr "prefix" "maybe_vex")
16124 (set_attr "mode" "TI")])
16126 (define_insn_and_split "sse4_2_pcmpistr"
16127 [(set (match_operand:SI 0 "register_operand" "=c,c")
16129 [(match_operand:V16QI 2 "register_operand" "x,x")
16130 (match_operand:V16QI 3 "nonimmediate_operand" "x,m")
16131 (match_operand:SI 4 "const_0_to_255_operand" "n,n")]
16133 (set (match_operand:V16QI 1 "register_operand" "=Yz,Yz")
16139 (set (reg:CC FLAGS_REG)
16146 && can_create_pseudo_p ()"
16151 int ecx = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[0]));
16152 int xmm0 = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[1]));
16153 int flags = !find_regno_note (curr_insn, REG_UNUSED, FLAGS_REG);
16156 emit_insn (gen_sse4_2_pcmpistri (operands[0], operands[2],
16157 operands[3], operands[4]));
16159 emit_insn (gen_sse4_2_pcmpistrm (operands[1], operands[2],
16160 operands[3], operands[4]));
16161 if (flags && !(ecx || xmm0))
16162 emit_insn (gen_sse4_2_pcmpistr_cconly (NULL, NULL,
16163 operands[2], operands[3],
16165 if (!(flags || ecx || xmm0))
16166 emit_note (NOTE_INSN_DELETED);
16170 [(set_attr "type" "sselog")
16171 (set_attr "prefix_data16" "1")
16172 (set_attr "prefix_extra" "1")
16173 (set_attr "length_immediate" "1")
16174 (set_attr "memory" "none,load")
16175 (set_attr "mode" "TI")])
16177 (define_insn "sse4_2_pcmpistri"
16178 [(set (match_operand:SI 0 "register_operand" "=c,c")
16180 [(match_operand:V16QI 1 "register_operand" "x,x")
16181 (match_operand:V16QI 2 "nonimmediate_operand" "x,m")
16182 (match_operand:SI 3 "const_0_to_255_operand" "n,n")]
16184 (set (reg:CC FLAGS_REG)
16191 "%vpcmpistri\t{%3, %2, %1|%1, %2, %3}"
16192 [(set_attr "type" "sselog")
16193 (set_attr "prefix_data16" "1")
16194 (set_attr "prefix_extra" "1")
16195 (set_attr "length_immediate" "1")
16196 (set_attr "prefix" "maybe_vex")
16197 (set_attr "memory" "none,load")
16198 (set_attr "btver2_decode" "vector")
16199 (set_attr "mode" "TI")])
16201 (define_insn "sse4_2_pcmpistrm"
16202 [(set (match_operand:V16QI 0 "register_operand" "=Yz,Yz")
16204 [(match_operand:V16QI 1 "register_operand" "x,x")
16205 (match_operand:V16QI 2 "nonimmediate_operand" "x,m")
16206 (match_operand:SI 3 "const_0_to_255_operand" "n,n")]
16208 (set (reg:CC FLAGS_REG)
16215 "%vpcmpistrm\t{%3, %2, %1|%1, %2, %3}"
16216 [(set_attr "type" "sselog")
16217 (set_attr "prefix_data16" "1")
16218 (set_attr "prefix_extra" "1")
16219 (set_attr "length_immediate" "1")
16220 (set_attr "prefix" "maybe_vex")
16221 (set_attr "memory" "none,load")
16222 (set_attr "btver2_decode" "vector")
16223 (set_attr "mode" "TI")])
16225 (define_insn "sse4_2_pcmpistr_cconly"
16226 [(set (reg:CC FLAGS_REG)
16228 [(match_operand:V16QI 2 "register_operand" "x,x,x,x")
16229 (match_operand:V16QI 3 "nonimmediate_operand" "x,m,x,m")
16230 (match_operand:SI 4 "const_0_to_255_operand" "n,n,n,n")]
16232 (clobber (match_scratch:V16QI 0 "=Yz,Yz,X,X"))
16233 (clobber (match_scratch:SI 1 "= X, X,c,c"))]
16236 %vpcmpistrm\t{%4, %3, %2|%2, %3, %4}
16237 %vpcmpistrm\t{%4, %3, %2|%2, %3, %4}
16238 %vpcmpistri\t{%4, %3, %2|%2, %3, %4}
16239 %vpcmpistri\t{%4, %3, %2|%2, %3, %4}"
16240 [(set_attr "type" "sselog")
16241 (set_attr "prefix_data16" "1")
16242 (set_attr "prefix_extra" "1")
16243 (set_attr "length_immediate" "1")
16244 (set_attr "memory" "none,load,none,load")
16245 (set_attr "prefix" "maybe_vex")
16246 (set_attr "btver2_decode" "vector,vector,vector,vector")
16247 (set_attr "mode" "TI")])
16249 ;; Packed float variants
16250 (define_mode_attr GATHER_SCATTER_SF_MEM_MODE
16251 [(V8DI "V8SF") (V16SI "V16SF")])
16253 (define_expand "avx512pf_gatherpf<mode>sf"
16255 [(match_operand:<avx512fmaskmode> 0 "register_operand")
16256 (mem:<GATHER_SCATTER_SF_MEM_MODE>
16258 [(match_operand 2 "vsib_address_operand")
16259 (match_operand:VI48_512 1 "register_operand")
16260 (match_operand:SI 3 "const1248_operand")]))
16261 (match_operand:SI 4 "const_2_to_3_operand")]
16262 UNSPEC_GATHER_PREFETCH)]
16266 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
16267 operands[3]), UNSPEC_VSIBADDR);
16270 (define_insn "*avx512pf_gatherpf<mode>sf_mask"
16272 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
16273 (match_operator:<GATHER_SCATTER_SF_MEM_MODE> 5 "vsib_mem_operator"
16275 [(match_operand:P 2 "vsib_address_operand" "Tv")
16276 (match_operand:VI48_512 1 "register_operand" "v")
16277 (match_operand:SI 3 "const1248_operand" "n")]
16279 (match_operand:SI 4 "const_2_to_3_operand" "n")]
16280 UNSPEC_GATHER_PREFETCH)]
16283 switch (INTVAL (operands[4]))
16286 return "vgatherpf0<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
16288 return "vgatherpf1<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
16290 gcc_unreachable ();
16293 [(set_attr "type" "sse")
16294 (set_attr "prefix" "evex")
16295 (set_attr "mode" "XI")])
16297 ;; Packed double variants
16298 (define_expand "avx512pf_gatherpf<mode>df"
16300 [(match_operand:<avx512fmaskmode> 0 "register_operand")
16303 [(match_operand 2 "vsib_address_operand")
16304 (match_operand:VI4_256_8_512 1 "register_operand")
16305 (match_operand:SI 3 "const1248_operand")]))
16306 (match_operand:SI 4 "const_2_to_3_operand")]
16307 UNSPEC_GATHER_PREFETCH)]
16311 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
16312 operands[3]), UNSPEC_VSIBADDR);
16315 (define_insn "*avx512pf_gatherpf<mode>df_mask"
16317 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
16318 (match_operator:V8DF 5 "vsib_mem_operator"
16320 [(match_operand:P 2 "vsib_address_operand" "Tv")
16321 (match_operand:VI4_256_8_512 1 "register_operand" "v")
16322 (match_operand:SI 3 "const1248_operand" "n")]
16324 (match_operand:SI 4 "const_2_to_3_operand" "n")]
16325 UNSPEC_GATHER_PREFETCH)]
16328 switch (INTVAL (operands[4]))
16331 return "vgatherpf0<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
16333 return "vgatherpf1<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
16335 gcc_unreachable ();
16338 [(set_attr "type" "sse")
16339 (set_attr "prefix" "evex")
16340 (set_attr "mode" "XI")])
16342 ;; Packed float variants
16343 (define_expand "avx512pf_scatterpf<mode>sf"
16345 [(match_operand:<avx512fmaskmode> 0 "register_operand")
16346 (mem:<GATHER_SCATTER_SF_MEM_MODE>
16348 [(match_operand 2 "vsib_address_operand")
16349 (match_operand:VI48_512 1 "register_operand")
16350 (match_operand:SI 3 "const1248_operand")]))
16351 (match_operand:SI 4 "const2367_operand")]
16352 UNSPEC_SCATTER_PREFETCH)]
16356 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
16357 operands[3]), UNSPEC_VSIBADDR);
16360 (define_insn "*avx512pf_scatterpf<mode>sf_mask"
16362 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
16363 (match_operator:<GATHER_SCATTER_SF_MEM_MODE> 5 "vsib_mem_operator"
16365 [(match_operand:P 2 "vsib_address_operand" "Tv")
16366 (match_operand:VI48_512 1 "register_operand" "v")
16367 (match_operand:SI 3 "const1248_operand" "n")]
16369 (match_operand:SI 4 "const2367_operand" "n")]
16370 UNSPEC_SCATTER_PREFETCH)]
16373 switch (INTVAL (operands[4]))
16377 return "vscatterpf0<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
16380 return "vscatterpf1<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
16382 gcc_unreachable ();
16385 [(set_attr "type" "sse")
16386 (set_attr "prefix" "evex")
16387 (set_attr "mode" "XI")])
16389 ;; Packed double variants
16390 (define_expand "avx512pf_scatterpf<mode>df"
16392 [(match_operand:<avx512fmaskmode> 0 "register_operand")
16395 [(match_operand 2 "vsib_address_operand")
16396 (match_operand:VI4_256_8_512 1 "register_operand")
16397 (match_operand:SI 3 "const1248_operand")]))
16398 (match_operand:SI 4 "const2367_operand")]
16399 UNSPEC_SCATTER_PREFETCH)]
16403 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
16404 operands[3]), UNSPEC_VSIBADDR);
16407 (define_insn "*avx512pf_scatterpf<mode>df_mask"
16409 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
16410 (match_operator:V8DF 5 "vsib_mem_operator"
16412 [(match_operand:P 2 "vsib_address_operand" "Tv")
16413 (match_operand:VI4_256_8_512 1 "register_operand" "v")
16414 (match_operand:SI 3 "const1248_operand" "n")]
16416 (match_operand:SI 4 "const2367_operand" "n")]
16417 UNSPEC_SCATTER_PREFETCH)]
16420 switch (INTVAL (operands[4]))
16424 return "vscatterpf0<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
16427 return "vscatterpf1<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
16429 gcc_unreachable ();
16432 [(set_attr "type" "sse")
16433 (set_attr "prefix" "evex")
16434 (set_attr "mode" "XI")])
16436 (define_insn "avx512er_exp2<mode><mask_name><round_saeonly_name>"
16437 [(set (match_operand:VF_512 0 "register_operand" "=v")
16439 [(match_operand:VF_512 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16442 "vexp2<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
16443 [(set_attr "prefix" "evex")
16444 (set_attr "type" "sse")
16445 (set_attr "mode" "<MODE>")])
16447 (define_insn "<mask_codefor>avx512er_rcp28<mode><mask_name><round_saeonly_name>"
16448 [(set (match_operand:VF_512 0 "register_operand" "=v")
16450 [(match_operand:VF_512 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16453 "vrcp28<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
16454 [(set_attr "prefix" "evex")
16455 (set_attr "type" "sse")
16456 (set_attr "mode" "<MODE>")])
16458 (define_insn "avx512er_vmrcp28<mode><round_saeonly_name>"
16459 [(set (match_operand:VF_128 0 "register_operand" "=v")
16462 [(match_operand:VF_128 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16464 (match_operand:VF_128 2 "register_operand" "v")
16467 "vrcp28<ssescalarmodesuffix>\t{<round_saeonly_op3>%1, %2, %0|%0, %2, %<iptr>1<round_saeonly_op3>}"
16468 [(set_attr "length_immediate" "1")
16469 (set_attr "prefix" "evex")
16470 (set_attr "type" "sse")
16471 (set_attr "mode" "<MODE>")])
16473 (define_insn "<mask_codefor>avx512er_rsqrt28<mode><mask_name><round_saeonly_name>"
16474 [(set (match_operand:VF_512 0 "register_operand" "=v")
16476 [(match_operand:VF_512 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16479 "vrsqrt28<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
16480 [(set_attr "prefix" "evex")
16481 (set_attr "type" "sse")
16482 (set_attr "mode" "<MODE>")])
16484 (define_insn "avx512er_vmrsqrt28<mode><round_saeonly_name>"
16485 [(set (match_operand:VF_128 0 "register_operand" "=v")
16488 [(match_operand:VF_128 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16490 (match_operand:VF_128 2 "register_operand" "v")
16493 "vrsqrt28<ssescalarmodesuffix>\t{<round_saeonly_op3>%1, %2, %0|%0, %2, %<iptr>1<round_saeonly_op3>}"
16494 [(set_attr "length_immediate" "1")
16495 (set_attr "type" "sse")
16496 (set_attr "prefix" "evex")
16497 (set_attr "mode" "<MODE>")])
16499 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16501 ;; XOP instructions
16503 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16505 (define_code_iterator xop_plus [plus ss_plus])
16507 (define_code_attr macs [(plus "macs") (ss_plus "macss")])
16508 (define_code_attr madcs [(plus "madcs") (ss_plus "madcss")])
16510 ;; XOP parallel integer multiply/add instructions.
16512 (define_insn "xop_p<macs><ssemodesuffix><ssemodesuffix>"
16513 [(set (match_operand:VI24_128 0 "register_operand" "=x")
16516 (match_operand:VI24_128 1 "nonimmediate_operand" "%x")
16517 (match_operand:VI24_128 2 "nonimmediate_operand" "xm"))
16518 (match_operand:VI24_128 3 "register_operand" "x")))]
16520 "vp<macs><ssemodesuffix><ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16521 [(set_attr "type" "ssemuladd")
16522 (set_attr "mode" "TI")])
16524 (define_insn "xop_p<macs>dql"
16525 [(set (match_operand:V2DI 0 "register_operand" "=x")
16530 (match_operand:V4SI 1 "nonimmediate_operand" "%x")
16531 (parallel [(const_int 0) (const_int 2)])))
16534 (match_operand:V4SI 2 "nonimmediate_operand" "xm")
16535 (parallel [(const_int 0) (const_int 2)]))))
16536 (match_operand:V2DI 3 "register_operand" "x")))]
16538 "vp<macs>dql\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16539 [(set_attr "type" "ssemuladd")
16540 (set_attr "mode" "TI")])
16542 (define_insn "xop_p<macs>dqh"
16543 [(set (match_operand:V2DI 0 "register_operand" "=x")
16548 (match_operand:V4SI 1 "nonimmediate_operand" "%x")
16549 (parallel [(const_int 1) (const_int 3)])))
16552 (match_operand:V4SI 2 "nonimmediate_operand" "xm")
16553 (parallel [(const_int 1) (const_int 3)]))))
16554 (match_operand:V2DI 3 "register_operand" "x")))]
16556 "vp<macs>dqh\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16557 [(set_attr "type" "ssemuladd")
16558 (set_attr "mode" "TI")])
16560 ;; XOP parallel integer multiply/add instructions for the intrinisics
16561 (define_insn "xop_p<macs>wd"
16562 [(set (match_operand:V4SI 0 "register_operand" "=x")
16567 (match_operand:V8HI 1 "nonimmediate_operand" "%x")
16568 (parallel [(const_int 1) (const_int 3)
16569 (const_int 5) (const_int 7)])))
16572 (match_operand:V8HI 2 "nonimmediate_operand" "xm")
16573 (parallel [(const_int 1) (const_int 3)
16574 (const_int 5) (const_int 7)]))))
16575 (match_operand:V4SI 3 "register_operand" "x")))]
16577 "vp<macs>wd\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16578 [(set_attr "type" "ssemuladd")
16579 (set_attr "mode" "TI")])
16581 (define_insn "xop_p<madcs>wd"
16582 [(set (match_operand:V4SI 0 "register_operand" "=x")
16588 (match_operand:V8HI 1 "nonimmediate_operand" "%x")
16589 (parallel [(const_int 0) (const_int 2)
16590 (const_int 4) (const_int 6)])))
16593 (match_operand:V8HI 2 "nonimmediate_operand" "xm")
16594 (parallel [(const_int 0) (const_int 2)
16595 (const_int 4) (const_int 6)]))))
16600 (parallel [(const_int 1) (const_int 3)
16601 (const_int 5) (const_int 7)])))
16605 (parallel [(const_int 1) (const_int 3)
16606 (const_int 5) (const_int 7)])))))
16607 (match_operand:V4SI 3 "register_operand" "x")))]
16609 "vp<madcs>wd\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16610 [(set_attr "type" "ssemuladd")
16611 (set_attr "mode" "TI")])
16613 ;; XOP parallel XMM conditional moves
16614 (define_insn "xop_pcmov_<mode><avxsizesuffix>"
16615 [(set (match_operand:V_128_256 0 "register_operand" "=x,x")
16616 (if_then_else:V_128_256
16617 (match_operand:V_128_256 3 "nonimmediate_operand" "x,m")
16618 (match_operand:V_128_256 1 "register_operand" "x,x")
16619 (match_operand:V_128_256 2 "nonimmediate_operand" "xm,x")))]
16621 "vpcmov\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16622 [(set_attr "type" "sse4arg")])
16624 ;; XOP horizontal add/subtract instructions
16625 (define_insn "xop_phadd<u>bw"
16626 [(set (match_operand:V8HI 0 "register_operand" "=x")
16630 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
16631 (parallel [(const_int 0) (const_int 2)
16632 (const_int 4) (const_int 6)
16633 (const_int 8) (const_int 10)
16634 (const_int 12) (const_int 14)])))
16638 (parallel [(const_int 1) (const_int 3)
16639 (const_int 5) (const_int 7)
16640 (const_int 9) (const_int 11)
16641 (const_int 13) (const_int 15)])))))]
16643 "vphadd<u>bw\t{%1, %0|%0, %1}"
16644 [(set_attr "type" "sseiadd1")])
16646 (define_insn "xop_phadd<u>bd"
16647 [(set (match_operand:V4SI 0 "register_operand" "=x")
16652 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
16653 (parallel [(const_int 0) (const_int 4)
16654 (const_int 8) (const_int 12)])))
16658 (parallel [(const_int 1) (const_int 5)
16659 (const_int 9) (const_int 13)]))))
16664 (parallel [(const_int 2) (const_int 6)
16665 (const_int 10) (const_int 14)])))
16669 (parallel [(const_int 3) (const_int 7)
16670 (const_int 11) (const_int 15)]))))))]
16672 "vphadd<u>bd\t{%1, %0|%0, %1}"
16673 [(set_attr "type" "sseiadd1")])
16675 (define_insn "xop_phadd<u>bq"
16676 [(set (match_operand:V2DI 0 "register_operand" "=x")
16682 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
16683 (parallel [(const_int 0) (const_int 8)])))
16687 (parallel [(const_int 1) (const_int 9)]))))
16692 (parallel [(const_int 2) (const_int 10)])))
16696 (parallel [(const_int 3) (const_int 11)])))))
16702 (parallel [(const_int 4) (const_int 12)])))
16706 (parallel [(const_int 5) (const_int 13)]))))
16711 (parallel [(const_int 6) (const_int 14)])))
16715 (parallel [(const_int 7) (const_int 15)])))))))]
16717 "vphadd<u>bq\t{%1, %0|%0, %1}"
16718 [(set_attr "type" "sseiadd1")])
16720 (define_insn "xop_phadd<u>wd"
16721 [(set (match_operand:V4SI 0 "register_operand" "=x")
16725 (match_operand:V8HI 1 "nonimmediate_operand" "xm")
16726 (parallel [(const_int 0) (const_int 2)
16727 (const_int 4) (const_int 6)])))
16731 (parallel [(const_int 1) (const_int 3)
16732 (const_int 5) (const_int 7)])))))]
16734 "vphadd<u>wd\t{%1, %0|%0, %1}"
16735 [(set_attr "type" "sseiadd1")])
16737 (define_insn "xop_phadd<u>wq"
16738 [(set (match_operand:V2DI 0 "register_operand" "=x")
16743 (match_operand:V8HI 1 "nonimmediate_operand" "xm")
16744 (parallel [(const_int 0) (const_int 4)])))
16748 (parallel [(const_int 1) (const_int 5)]))))
16753 (parallel [(const_int 2) (const_int 6)])))
16757 (parallel [(const_int 3) (const_int 7)]))))))]
16759 "vphadd<u>wq\t{%1, %0|%0, %1}"
16760 [(set_attr "type" "sseiadd1")])
16762 (define_insn "xop_phadd<u>dq"
16763 [(set (match_operand:V2DI 0 "register_operand" "=x")
16767 (match_operand:V4SI 1 "nonimmediate_operand" "xm")
16768 (parallel [(const_int 0) (const_int 2)])))
16772 (parallel [(const_int 1) (const_int 3)])))))]
16774 "vphadd<u>dq\t{%1, %0|%0, %1}"
16775 [(set_attr "type" "sseiadd1")])
16777 (define_insn "xop_phsubbw"
16778 [(set (match_operand:V8HI 0 "register_operand" "=x")
16782 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
16783 (parallel [(const_int 0) (const_int 2)
16784 (const_int 4) (const_int 6)
16785 (const_int 8) (const_int 10)
16786 (const_int 12) (const_int 14)])))
16790 (parallel [(const_int 1) (const_int 3)
16791 (const_int 5) (const_int 7)
16792 (const_int 9) (const_int 11)
16793 (const_int 13) (const_int 15)])))))]
16795 "vphsubbw\t{%1, %0|%0, %1}"
16796 [(set_attr "type" "sseiadd1")])
16798 (define_insn "xop_phsubwd"
16799 [(set (match_operand:V4SI 0 "register_operand" "=x")
16803 (match_operand:V8HI 1 "nonimmediate_operand" "xm")
16804 (parallel [(const_int 0) (const_int 2)
16805 (const_int 4) (const_int 6)])))
16809 (parallel [(const_int 1) (const_int 3)
16810 (const_int 5) (const_int 7)])))))]
16812 "vphsubwd\t{%1, %0|%0, %1}"
16813 [(set_attr "type" "sseiadd1")])
16815 (define_insn "xop_phsubdq"
16816 [(set (match_operand:V2DI 0 "register_operand" "=x")
16820 (match_operand:V4SI 1 "nonimmediate_operand" "xm")
16821 (parallel [(const_int 0) (const_int 2)])))
16825 (parallel [(const_int 1) (const_int 3)])))))]
16827 "vphsubdq\t{%1, %0|%0, %1}"
16828 [(set_attr "type" "sseiadd1")])
16830 ;; XOP permute instructions
16831 (define_insn "xop_pperm"
16832 [(set (match_operand:V16QI 0 "register_operand" "=x,x")
16834 [(match_operand:V16QI 1 "register_operand" "x,x")
16835 (match_operand:V16QI 2 "nonimmediate_operand" "x,m")
16836 (match_operand:V16QI 3 "nonimmediate_operand" "xm,x")]
16837 UNSPEC_XOP_PERMUTE))]
16838 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
16839 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16840 [(set_attr "type" "sse4arg")
16841 (set_attr "mode" "TI")])
16843 ;; XOP pack instructions that combine two vectors into a smaller vector
16844 (define_insn "xop_pperm_pack_v2di_v4si"
16845 [(set (match_operand:V4SI 0 "register_operand" "=x,x")
16848 (match_operand:V2DI 1 "register_operand" "x,x"))
16850 (match_operand:V2DI 2 "nonimmediate_operand" "x,m"))))
16851 (use (match_operand:V16QI 3 "nonimmediate_operand" "xm,x"))]
16852 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
16853 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16854 [(set_attr "type" "sse4arg")
16855 (set_attr "mode" "TI")])
16857 (define_insn "xop_pperm_pack_v4si_v8hi"
16858 [(set (match_operand:V8HI 0 "register_operand" "=x,x")
16861 (match_operand:V4SI 1 "register_operand" "x,x"))
16863 (match_operand:V4SI 2 "nonimmediate_operand" "x,m"))))
16864 (use (match_operand:V16QI 3 "nonimmediate_operand" "xm,x"))]
16865 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
16866 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16867 [(set_attr "type" "sse4arg")
16868 (set_attr "mode" "TI")])
16870 (define_insn "xop_pperm_pack_v8hi_v16qi"
16871 [(set (match_operand:V16QI 0 "register_operand" "=x,x")
16874 (match_operand:V8HI 1 "register_operand" "x,x"))
16876 (match_operand:V8HI 2 "nonimmediate_operand" "x,m"))))
16877 (use (match_operand:V16QI 3 "nonimmediate_operand" "xm,x"))]
16878 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
16879 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16880 [(set_attr "type" "sse4arg")
16881 (set_attr "mode" "TI")])
16883 ;; XOP packed rotate instructions
16884 (define_expand "rotl<mode>3"
16885 [(set (match_operand:VI_128 0 "register_operand")
16887 (match_operand:VI_128 1 "nonimmediate_operand")
16888 (match_operand:SI 2 "general_operand")))]
16891 /* If we were given a scalar, convert it to parallel */
16892 if (! const_0_to_<sserotatemax>_operand (operands[2], SImode))
16894 rtvec vs = rtvec_alloc (<ssescalarnum>);
16895 rtx par = gen_rtx_PARALLEL (<MODE>mode, vs);
16896 rtx reg = gen_reg_rtx (<MODE>mode);
16897 rtx op2 = operands[2];
16900 if (GET_MODE (op2) != <ssescalarmode>mode)
16902 op2 = gen_reg_rtx (<ssescalarmode>mode);
16903 convert_move (op2, operands[2], false);
16906 for (i = 0; i < <ssescalarnum>; i++)
16907 RTVEC_ELT (vs, i) = op2;
16909 emit_insn (gen_vec_init<mode><ssescalarmodelower> (reg, par));
16910 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], reg));
16915 (define_expand "rotr<mode>3"
16916 [(set (match_operand:VI_128 0 "register_operand")
16918 (match_operand:VI_128 1 "nonimmediate_operand")
16919 (match_operand:SI 2 "general_operand")))]
16922 /* If we were given a scalar, convert it to parallel */
16923 if (! const_0_to_<sserotatemax>_operand (operands[2], SImode))
16925 rtvec vs = rtvec_alloc (<ssescalarnum>);
16926 rtx par = gen_rtx_PARALLEL (<MODE>mode, vs);
16927 rtx neg = gen_reg_rtx (<MODE>mode);
16928 rtx reg = gen_reg_rtx (<MODE>mode);
16929 rtx op2 = operands[2];
16932 if (GET_MODE (op2) != <ssescalarmode>mode)
16934 op2 = gen_reg_rtx (<ssescalarmode>mode);
16935 convert_move (op2, operands[2], false);
16938 for (i = 0; i < <ssescalarnum>; i++)
16939 RTVEC_ELT (vs, i) = op2;
16941 emit_insn (gen_vec_init<mode><ssescalarmodelower> (reg, par));
16942 emit_insn (gen_neg<mode>2 (neg, reg));
16943 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], neg));
16948 (define_insn "xop_rotl<mode>3"
16949 [(set (match_operand:VI_128 0 "register_operand" "=x")
16951 (match_operand:VI_128 1 "nonimmediate_operand" "xm")
16952 (match_operand:SI 2 "const_0_to_<sserotatemax>_operand" "n")))]
16954 "vprot<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
16955 [(set_attr "type" "sseishft")
16956 (set_attr "length_immediate" "1")
16957 (set_attr "mode" "TI")])
16959 (define_insn "xop_rotr<mode>3"
16960 [(set (match_operand:VI_128 0 "register_operand" "=x")
16962 (match_operand:VI_128 1 "nonimmediate_operand" "xm")
16963 (match_operand:SI 2 "const_0_to_<sserotatemax>_operand" "n")))]
16967 = GEN_INT (GET_MODE_BITSIZE (<ssescalarmode>mode) - INTVAL (operands[2]));
16968 return \"vprot<ssemodesuffix>\t{%3, %1, %0|%0, %1, %3}\";
16970 [(set_attr "type" "sseishft")
16971 (set_attr "length_immediate" "1")
16972 (set_attr "mode" "TI")])
16974 (define_expand "vrotr<mode>3"
16975 [(match_operand:VI_128 0 "register_operand")
16976 (match_operand:VI_128 1 "register_operand")
16977 (match_operand:VI_128 2 "register_operand")]
16980 rtx reg = gen_reg_rtx (<MODE>mode);
16981 emit_insn (gen_neg<mode>2 (reg, operands[2]));
16982 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], reg));
16986 (define_expand "vrotl<mode>3"
16987 [(match_operand:VI_128 0 "register_operand")
16988 (match_operand:VI_128 1 "register_operand")
16989 (match_operand:VI_128 2 "register_operand")]
16992 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], operands[2]));
16996 (define_insn "xop_vrotl<mode>3"
16997 [(set (match_operand:VI_128 0 "register_operand" "=x,x")
16998 (if_then_else:VI_128
17000 (match_operand:VI_128 2 "nonimmediate_operand" "x,m")
17003 (match_operand:VI_128 1 "nonimmediate_operand" "xm,x")
17007 (neg:VI_128 (match_dup 2)))))]
17008 "TARGET_XOP && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
17009 "vprot<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
17010 [(set_attr "type" "sseishft")
17011 (set_attr "prefix_data16" "0")
17012 (set_attr "prefix_extra" "2")
17013 (set_attr "mode" "TI")])
17015 ;; XOP packed shift instructions.
17016 (define_expand "vlshr<mode>3"
17017 [(set (match_operand:VI12_128 0 "register_operand")
17019 (match_operand:VI12_128 1 "register_operand")
17020 (match_operand:VI12_128 2 "nonimmediate_operand")))]
17023 rtx neg = gen_reg_rtx (<MODE>mode);
17024 emit_insn (gen_neg<mode>2 (neg, operands[2]));
17025 emit_insn (gen_xop_shl<mode>3 (operands[0], operands[1], neg));
17029 (define_expand "vlshr<mode>3"
17030 [(set (match_operand:VI48_128 0 "register_operand")
17032 (match_operand:VI48_128 1 "register_operand")
17033 (match_operand:VI48_128 2 "nonimmediate_operand")))]
17034 "TARGET_AVX2 || TARGET_XOP"
17038 rtx neg = gen_reg_rtx (<MODE>mode);
17039 emit_insn (gen_neg<mode>2 (neg, operands[2]));
17040 emit_insn (gen_xop_shl<mode>3 (operands[0], operands[1], neg));
17045 (define_expand "vlshr<mode>3"
17046 [(set (match_operand:VI48_512 0 "register_operand")
17048 (match_operand:VI48_512 1 "register_operand")
17049 (match_operand:VI48_512 2 "nonimmediate_operand")))]
17052 (define_expand "vlshr<mode>3"
17053 [(set (match_operand:VI48_256 0 "register_operand")
17055 (match_operand:VI48_256 1 "register_operand")
17056 (match_operand:VI48_256 2 "nonimmediate_operand")))]
17059 (define_expand "vashrv8hi3<mask_name>"
17060 [(set (match_operand:V8HI 0 "register_operand")
17062 (match_operand:V8HI 1 "register_operand")
17063 (match_operand:V8HI 2 "nonimmediate_operand")))]
17064 "TARGET_XOP || (TARGET_AVX512BW && TARGET_AVX512VL)"
17068 rtx neg = gen_reg_rtx (V8HImode);
17069 emit_insn (gen_negv8hi2 (neg, operands[2]));
17070 emit_insn (gen_xop_shav8hi3 (operands[0], operands[1], neg));
17075 (define_expand "vashrv16qi3"
17076 [(set (match_operand:V16QI 0 "register_operand")
17078 (match_operand:V16QI 1 "register_operand")
17079 (match_operand:V16QI 2 "nonimmediate_operand")))]
17082 rtx neg = gen_reg_rtx (V16QImode);
17083 emit_insn (gen_negv16qi2 (neg, operands[2]));
17084 emit_insn (gen_xop_shav16qi3 (operands[0], operands[1], neg));
17088 (define_expand "vashrv2di3<mask_name>"
17089 [(set (match_operand:V2DI 0 "register_operand")
17091 (match_operand:V2DI 1 "register_operand")
17092 (match_operand:V2DI 2 "nonimmediate_operand")))]
17093 "TARGET_XOP || TARGET_AVX512VL"
17097 rtx neg = gen_reg_rtx (V2DImode);
17098 emit_insn (gen_negv2di2 (neg, operands[2]));
17099 emit_insn (gen_xop_shav2di3 (operands[0], operands[1], neg));
17104 (define_expand "vashrv4si3"
17105 [(set (match_operand:V4SI 0 "register_operand")
17106 (ashiftrt:V4SI (match_operand:V4SI 1 "register_operand")
17107 (match_operand:V4SI 2 "nonimmediate_operand")))]
17108 "TARGET_AVX2 || TARGET_XOP"
17112 rtx neg = gen_reg_rtx (V4SImode);
17113 emit_insn (gen_negv4si2 (neg, operands[2]));
17114 emit_insn (gen_xop_shav4si3 (operands[0], operands[1], neg));
17119 (define_expand "vashrv16si3"
17120 [(set (match_operand:V16SI 0 "register_operand")
17121 (ashiftrt:V16SI (match_operand:V16SI 1 "register_operand")
17122 (match_operand:V16SI 2 "nonimmediate_operand")))]
17125 (define_expand "vashrv8si3"
17126 [(set (match_operand:V8SI 0 "register_operand")
17127 (ashiftrt:V8SI (match_operand:V8SI 1 "register_operand")
17128 (match_operand:V8SI 2 "nonimmediate_operand")))]
17131 (define_expand "vashl<mode>3"
17132 [(set (match_operand:VI12_128 0 "register_operand")
17134 (match_operand:VI12_128 1 "register_operand")
17135 (match_operand:VI12_128 2 "nonimmediate_operand")))]
17138 emit_insn (gen_xop_sha<mode>3 (operands[0], operands[1], operands[2]));
17142 (define_expand "vashl<mode>3"
17143 [(set (match_operand:VI48_128 0 "register_operand")
17145 (match_operand:VI48_128 1 "register_operand")
17146 (match_operand:VI48_128 2 "nonimmediate_operand")))]
17147 "TARGET_AVX2 || TARGET_XOP"
17151 operands[2] = force_reg (<MODE>mode, operands[2]);
17152 emit_insn (gen_xop_sha<mode>3 (operands[0], operands[1], operands[2]));
17157 (define_expand "vashl<mode>3"
17158 [(set (match_operand:VI48_512 0 "register_operand")
17160 (match_operand:VI48_512 1 "register_operand")
17161 (match_operand:VI48_512 2 "nonimmediate_operand")))]
17164 (define_expand "vashl<mode>3"
17165 [(set (match_operand:VI48_256 0 "register_operand")
17167 (match_operand:VI48_256 1 "register_operand")
17168 (match_operand:VI48_256 2 "nonimmediate_operand")))]
17171 (define_insn "xop_sha<mode>3"
17172 [(set (match_operand:VI_128 0 "register_operand" "=x,x")
17173 (if_then_else:VI_128
17175 (match_operand:VI_128 2 "nonimmediate_operand" "x,m")
17178 (match_operand:VI_128 1 "nonimmediate_operand" "xm,x")
17182 (neg:VI_128 (match_dup 2)))))]
17183 "TARGET_XOP && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
17184 "vpsha<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
17185 [(set_attr "type" "sseishft")
17186 (set_attr "prefix_data16" "0")
17187 (set_attr "prefix_extra" "2")
17188 (set_attr "mode" "TI")])
17190 (define_insn "xop_shl<mode>3"
17191 [(set (match_operand:VI_128 0 "register_operand" "=x,x")
17192 (if_then_else:VI_128
17194 (match_operand:VI_128 2 "nonimmediate_operand" "x,m")
17197 (match_operand:VI_128 1 "nonimmediate_operand" "xm,x")
17201 (neg:VI_128 (match_dup 2)))))]
17202 "TARGET_XOP && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
17203 "vpshl<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
17204 [(set_attr "type" "sseishft")
17205 (set_attr "prefix_data16" "0")
17206 (set_attr "prefix_extra" "2")
17207 (set_attr "mode" "TI")])
17209 (define_expand "<shift_insn><mode>3"
17210 [(set (match_operand:VI1_AVX512 0 "register_operand")
17211 (any_shift:VI1_AVX512
17212 (match_operand:VI1_AVX512 1 "register_operand")
17213 (match_operand:SI 2 "nonmemory_operand")))]
17216 if (TARGET_XOP && <MODE>mode == V16QImode)
17218 bool negate = false;
17219 rtx (*gen) (rtx, rtx, rtx);
17223 if (<CODE> != ASHIFT)
17225 if (CONST_INT_P (operands[2]))
17226 operands[2] = GEN_INT (-INTVAL (operands[2]));
17230 par = gen_rtx_PARALLEL (V16QImode, rtvec_alloc (16));
17231 for (i = 0; i < 16; i++)
17232 XVECEXP (par, 0, i) = operands[2];
17234 tmp = gen_reg_rtx (V16QImode);
17235 emit_insn (gen_vec_initv16qiqi (tmp, par));
17238 emit_insn (gen_negv16qi2 (tmp, tmp));
17240 gen = (<CODE> == LSHIFTRT ? gen_xop_shlv16qi3 : gen_xop_shav16qi3);
17241 emit_insn (gen (operands[0], operands[1], tmp));
17244 ix86_expand_vecop_qihi (<CODE>, operands[0], operands[1], operands[2]);
17248 (define_expand "ashrv2di3"
17249 [(set (match_operand:V2DI 0 "register_operand")
17251 (match_operand:V2DI 1 "register_operand")
17252 (match_operand:DI 2 "nonmemory_operand")))]
17253 "TARGET_XOP || TARGET_AVX512VL"
17255 if (!TARGET_AVX512VL)
17257 rtx reg = gen_reg_rtx (V2DImode);
17259 bool negate = false;
17262 if (CONST_INT_P (operands[2]))
17263 operands[2] = GEN_INT (-INTVAL (operands[2]));
17267 par = gen_rtx_PARALLEL (V2DImode, rtvec_alloc (2));
17268 for (i = 0; i < 2; i++)
17269 XVECEXP (par, 0, i) = operands[2];
17271 emit_insn (gen_vec_initv2didi (reg, par));
17274 emit_insn (gen_negv2di2 (reg, reg));
17276 emit_insn (gen_xop_shav2di3 (operands[0], operands[1], reg));
17281 ;; XOP FRCZ support
17282 (define_insn "xop_frcz<mode>2"
17283 [(set (match_operand:FMAMODE 0 "register_operand" "=x")
17285 [(match_operand:FMAMODE 1 "nonimmediate_operand" "xm")]
17288 "vfrcz<ssemodesuffix>\t{%1, %0|%0, %1}"
17289 [(set_attr "type" "ssecvt1")
17290 (set_attr "mode" "<MODE>")])
17292 (define_expand "xop_vmfrcz<mode>2"
17293 [(set (match_operand:VF_128 0 "register_operand")
17296 [(match_operand:VF_128 1 "nonimmediate_operand")]
17301 "operands[2] = CONST0_RTX (<MODE>mode);")
17303 (define_insn "*xop_vmfrcz<mode>2"
17304 [(set (match_operand:VF_128 0 "register_operand" "=x")
17307 [(match_operand:VF_128 1 "nonimmediate_operand" "xm")]
17309 (match_operand:VF_128 2 "const0_operand")
17312 "vfrcz<ssescalarmodesuffix>\t{%1, %0|%0, %<iptr>1}"
17313 [(set_attr "type" "ssecvt1")
17314 (set_attr "mode" "<MODE>")])
17316 (define_insn "xop_maskcmp<mode>3"
17317 [(set (match_operand:VI_128 0 "register_operand" "=x")
17318 (match_operator:VI_128 1 "ix86_comparison_int_operator"
17319 [(match_operand:VI_128 2 "register_operand" "x")
17320 (match_operand:VI_128 3 "nonimmediate_operand" "xm")]))]
17322 "vpcom%Y1<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}"
17323 [(set_attr "type" "sse4arg")
17324 (set_attr "prefix_data16" "0")
17325 (set_attr "prefix_rep" "0")
17326 (set_attr "prefix_extra" "2")
17327 (set_attr "length_immediate" "1")
17328 (set_attr "mode" "TI")])
17330 (define_insn "xop_maskcmp_uns<mode>3"
17331 [(set (match_operand:VI_128 0 "register_operand" "=x")
17332 (match_operator:VI_128 1 "ix86_comparison_uns_operator"
17333 [(match_operand:VI_128 2 "register_operand" "x")
17334 (match_operand:VI_128 3 "nonimmediate_operand" "xm")]))]
17336 "vpcom%Y1u<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}"
17337 [(set_attr "type" "ssecmp")
17338 (set_attr "prefix_data16" "0")
17339 (set_attr "prefix_rep" "0")
17340 (set_attr "prefix_extra" "2")
17341 (set_attr "length_immediate" "1")
17342 (set_attr "mode" "TI")])
17344 ;; Version of pcom*u* that is called from the intrinsics that allows pcomequ*
17345 ;; and pcomneu* not to be converted to the signed ones in case somebody needs
17346 ;; the exact instruction generated for the intrinsic.
17347 (define_insn "xop_maskcmp_uns2<mode>3"
17348 [(set (match_operand:VI_128 0 "register_operand" "=x")
17350 [(match_operator:VI_128 1 "ix86_comparison_uns_operator"
17351 [(match_operand:VI_128 2 "register_operand" "x")
17352 (match_operand:VI_128 3 "nonimmediate_operand" "xm")])]
17353 UNSPEC_XOP_UNSIGNED_CMP))]
17355 "vpcom%Y1u<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}"
17356 [(set_attr "type" "ssecmp")
17357 (set_attr "prefix_data16" "0")
17358 (set_attr "prefix_extra" "2")
17359 (set_attr "length_immediate" "1")
17360 (set_attr "mode" "TI")])
17362 ;; Pcomtrue and pcomfalse support. These are useless instructions, but are
17363 ;; being added here to be complete.
17364 (define_insn "xop_pcom_tf<mode>3"
17365 [(set (match_operand:VI_128 0 "register_operand" "=x")
17367 [(match_operand:VI_128 1 "register_operand" "x")
17368 (match_operand:VI_128 2 "nonimmediate_operand" "xm")
17369 (match_operand:SI 3 "const_int_operand" "n")]
17370 UNSPEC_XOP_TRUEFALSE))]
17373 return ((INTVAL (operands[3]) != 0)
17374 ? "vpcomtrue<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
17375 : "vpcomfalse<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}");
17377 [(set_attr "type" "ssecmp")
17378 (set_attr "prefix_data16" "0")
17379 (set_attr "prefix_extra" "2")
17380 (set_attr "length_immediate" "1")
17381 (set_attr "mode" "TI")])
17383 (define_insn "xop_vpermil2<mode>3"
17384 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x")
17386 [(match_operand:VF_128_256 1 "register_operand" "x,x")
17387 (match_operand:VF_128_256 2 "nonimmediate_operand" "x,m")
17388 (match_operand:<sseintvecmode> 3 "nonimmediate_operand" "xm,x")
17389 (match_operand:SI 4 "const_0_to_3_operand" "n,n")]
17392 "vpermil2<ssemodesuffix>\t{%4, %3, %2, %1, %0|%0, %1, %2, %3, %4}"
17393 [(set_attr "type" "sse4arg")
17394 (set_attr "length_immediate" "1")
17395 (set_attr "mode" "<MODE>")])
17397 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
17399 (define_insn "aesenc"
17400 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17401 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17402 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
17406 aesenc\t{%2, %0|%0, %2}
17407 vaesenc\t{%2, %1, %0|%0, %1, %2}"
17408 [(set_attr "isa" "noavx,avx")
17409 (set_attr "type" "sselog1")
17410 (set_attr "prefix_extra" "1")
17411 (set_attr "prefix" "orig,vex")
17412 (set_attr "btver2_decode" "double,double")
17413 (set_attr "mode" "TI")])
17415 (define_insn "aesenclast"
17416 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17417 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17418 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
17419 UNSPEC_AESENCLAST))]
17422 aesenclast\t{%2, %0|%0, %2}
17423 vaesenclast\t{%2, %1, %0|%0, %1, %2}"
17424 [(set_attr "isa" "noavx,avx")
17425 (set_attr "type" "sselog1")
17426 (set_attr "prefix_extra" "1")
17427 (set_attr "prefix" "orig,vex")
17428 (set_attr "btver2_decode" "double,double")
17429 (set_attr "mode" "TI")])
17431 (define_insn "aesdec"
17432 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17433 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17434 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
17438 aesdec\t{%2, %0|%0, %2}
17439 vaesdec\t{%2, %1, %0|%0, %1, %2}"
17440 [(set_attr "isa" "noavx,avx")
17441 (set_attr "type" "sselog1")
17442 (set_attr "prefix_extra" "1")
17443 (set_attr "prefix" "orig,vex")
17444 (set_attr "btver2_decode" "double,double")
17445 (set_attr "mode" "TI")])
17447 (define_insn "aesdeclast"
17448 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17449 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17450 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
17451 UNSPEC_AESDECLAST))]
17454 aesdeclast\t{%2, %0|%0, %2}
17455 vaesdeclast\t{%2, %1, %0|%0, %1, %2}"
17456 [(set_attr "isa" "noavx,avx")
17457 (set_attr "type" "sselog1")
17458 (set_attr "prefix_extra" "1")
17459 (set_attr "prefix" "orig,vex")
17460 (set_attr "btver2_decode" "double,double")
17461 (set_attr "mode" "TI")])
17463 (define_insn "aesimc"
17464 [(set (match_operand:V2DI 0 "register_operand" "=x")
17465 (unspec:V2DI [(match_operand:V2DI 1 "vector_operand" "xBm")]
17468 "%vaesimc\t{%1, %0|%0, %1}"
17469 [(set_attr "type" "sselog1")
17470 (set_attr "prefix_extra" "1")
17471 (set_attr "prefix" "maybe_vex")
17472 (set_attr "mode" "TI")])
17474 (define_insn "aeskeygenassist"
17475 [(set (match_operand:V2DI 0 "register_operand" "=x")
17476 (unspec:V2DI [(match_operand:V2DI 1 "vector_operand" "xBm")
17477 (match_operand:SI 2 "const_0_to_255_operand" "n")]
17478 UNSPEC_AESKEYGENASSIST))]
17480 "%vaeskeygenassist\t{%2, %1, %0|%0, %1, %2}"
17481 [(set_attr "type" "sselog1")
17482 (set_attr "prefix_extra" "1")
17483 (set_attr "length_immediate" "1")
17484 (set_attr "prefix" "maybe_vex")
17485 (set_attr "mode" "TI")])
17487 (define_insn "pclmulqdq"
17488 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17489 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17490 (match_operand:V2DI 2 "vector_operand" "xBm,xm")
17491 (match_operand:SI 3 "const_0_to_255_operand" "n,n")]
17495 pclmulqdq\t{%3, %2, %0|%0, %2, %3}
17496 vpclmulqdq\t{%3, %2, %1, %0|%0, %1, %2, %3}"
17497 [(set_attr "isa" "noavx,avx")
17498 (set_attr "type" "sselog1")
17499 (set_attr "prefix_extra" "1")
17500 (set_attr "length_immediate" "1")
17501 (set_attr "prefix" "orig,vex")
17502 (set_attr "mode" "TI")])
17504 (define_expand "avx_vzeroall"
17505 [(match_par_dup 0 [(const_int 0)])]
17508 int nregs = TARGET_64BIT ? 16 : 8;
17511 operands[0] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (nregs + 1));
17513 XVECEXP (operands[0], 0, 0)
17514 = gen_rtx_UNSPEC_VOLATILE (VOIDmode, gen_rtvec (1, const0_rtx),
17517 for (regno = 0; regno < nregs; regno++)
17518 XVECEXP (operands[0], 0, regno + 1)
17519 = gen_rtx_SET (gen_rtx_REG (V8SImode, SSE_REGNO (regno)),
17520 CONST0_RTX (V8SImode));
17523 (define_insn "*avx_vzeroall"
17524 [(match_parallel 0 "vzeroall_operation"
17525 [(unspec_volatile [(const_int 0)] UNSPECV_VZEROALL)])]
17528 [(set_attr "type" "sse")
17529 (set_attr "modrm" "0")
17530 (set_attr "memory" "none")
17531 (set_attr "prefix" "vex")
17532 (set_attr "btver2_decode" "vector")
17533 (set_attr "mode" "OI")])
17535 ;; Clear the upper 128bits of AVX registers, equivalent to a NOP
17536 ;; if the upper 128bits are unused.
17537 (define_insn "avx_vzeroupper"
17538 [(unspec_volatile [(const_int 0)] UNSPECV_VZEROUPPER)]
17541 [(set_attr "type" "sse")
17542 (set_attr "modrm" "0")
17543 (set_attr "memory" "none")
17544 (set_attr "prefix" "vex")
17545 (set_attr "btver2_decode" "vector")
17546 (set_attr "mode" "OI")])
17548 (define_mode_attr pbroadcast_evex_isa
17549 [(V64QI "avx512bw") (V32QI "avx512bw") (V16QI "avx512bw")
17550 (V32HI "avx512bw") (V16HI "avx512bw") (V8HI "avx512bw")
17551 (V16SI "avx512f") (V8SI "avx512f") (V4SI "avx512f")
17552 (V8DI "avx512f") (V4DI "avx512f") (V2DI "avx512f")])
17554 (define_insn "avx2_pbroadcast<mode>"
17555 [(set (match_operand:VI 0 "register_operand" "=x,v")
17557 (vec_select:<ssescalarmode>
17558 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "xm,vm")
17559 (parallel [(const_int 0)]))))]
17561 "vpbroadcast<ssemodesuffix>\t{%1, %0|%0, %<iptr>1}"
17562 [(set_attr "isa" "*,<pbroadcast_evex_isa>")
17563 (set_attr "type" "ssemov")
17564 (set_attr "prefix_extra" "1")
17565 (set_attr "prefix" "vex,evex")
17566 (set_attr "mode" "<sseinsnmode>")])
17568 (define_insn "avx2_pbroadcast<mode>_1"
17569 [(set (match_operand:VI_256 0 "register_operand" "=x,x,v,v")
17570 (vec_duplicate:VI_256
17571 (vec_select:<ssescalarmode>
17572 (match_operand:VI_256 1 "nonimmediate_operand" "m,x,m,v")
17573 (parallel [(const_int 0)]))))]
17576 vpbroadcast<ssemodesuffix>\t{%1, %0|%0, %<iptr>1}
17577 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %x1}
17578 vpbroadcast<ssemodesuffix>\t{%1, %0|%0, %<iptr>1}
17579 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %x1}"
17580 [(set_attr "isa" "*,*,<pbroadcast_evex_isa>,<pbroadcast_evex_isa>")
17581 (set_attr "type" "ssemov")
17582 (set_attr "prefix_extra" "1")
17583 (set_attr "prefix" "vex")
17584 (set_attr "mode" "<sseinsnmode>")])
17586 (define_insn "<avx2_avx512>_permvar<mode><mask_name>"
17587 [(set (match_operand:VI48F_256_512 0 "register_operand" "=v")
17588 (unspec:VI48F_256_512
17589 [(match_operand:VI48F_256_512 1 "nonimmediate_operand" "vm")
17590 (match_operand:<sseintvecmode> 2 "register_operand" "v")]
17592 "TARGET_AVX2 && <mask_mode512bit_condition>"
17593 "vperm<ssemodesuffix>\t{%1, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1}"
17594 [(set_attr "type" "sselog")
17595 (set_attr "prefix" "<mask_prefix2>")
17596 (set_attr "mode" "<sseinsnmode>")])
17598 (define_insn "<avx512>_permvar<mode><mask_name>"
17599 [(set (match_operand:VI1_AVX512VL 0 "register_operand" "=v")
17600 (unspec:VI1_AVX512VL
17601 [(match_operand:VI1_AVX512VL 1 "nonimmediate_operand" "vm")
17602 (match_operand:<sseintvecmode> 2 "register_operand" "v")]
17604 "TARGET_AVX512VBMI && <mask_mode512bit_condition>"
17605 "vperm<ssemodesuffix>\t{%1, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1}"
17606 [(set_attr "type" "sselog")
17607 (set_attr "prefix" "<mask_prefix2>")
17608 (set_attr "mode" "<sseinsnmode>")])
17610 (define_insn "<avx512>_permvar<mode><mask_name>"
17611 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
17612 (unspec:VI2_AVX512VL
17613 [(match_operand:VI2_AVX512VL 1 "nonimmediate_operand" "vm")
17614 (match_operand:<sseintvecmode> 2 "register_operand" "v")]
17616 "TARGET_AVX512BW && <mask_mode512bit_condition>"
17617 "vperm<ssemodesuffix>\t{%1, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1}"
17618 [(set_attr "type" "sselog")
17619 (set_attr "prefix" "<mask_prefix2>")
17620 (set_attr "mode" "<sseinsnmode>")])
17622 (define_expand "avx2_perm<mode>"
17623 [(match_operand:VI8F_256 0 "register_operand")
17624 (match_operand:VI8F_256 1 "nonimmediate_operand")
17625 (match_operand:SI 2 "const_0_to_255_operand")]
17628 int mask = INTVAL (operands[2]);
17629 emit_insn (gen_avx2_perm<mode>_1 (operands[0], operands[1],
17630 GEN_INT ((mask >> 0) & 3),
17631 GEN_INT ((mask >> 2) & 3),
17632 GEN_INT ((mask >> 4) & 3),
17633 GEN_INT ((mask >> 6) & 3)));
17637 (define_expand "avx512vl_perm<mode>_mask"
17638 [(match_operand:VI8F_256 0 "register_operand")
17639 (match_operand:VI8F_256 1 "nonimmediate_operand")
17640 (match_operand:SI 2 "const_0_to_255_operand")
17641 (match_operand:VI8F_256 3 "vector_move_operand")
17642 (match_operand:<avx512fmaskmode> 4 "register_operand")]
17645 int mask = INTVAL (operands[2]);
17646 emit_insn (gen_<avx2_avx512>_perm<mode>_1_mask (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 operands[3], operands[4]));
17655 (define_insn "avx2_perm<mode>_1<mask_name>"
17656 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
17657 (vec_select:VI8F_256
17658 (match_operand:VI8F_256 1 "nonimmediate_operand" "vm")
17659 (parallel [(match_operand 2 "const_0_to_3_operand")
17660 (match_operand 3 "const_0_to_3_operand")
17661 (match_operand 4 "const_0_to_3_operand")
17662 (match_operand 5 "const_0_to_3_operand")])))]
17663 "TARGET_AVX2 && <mask_mode512bit_condition>"
17666 mask |= INTVAL (operands[2]) << 0;
17667 mask |= INTVAL (operands[3]) << 2;
17668 mask |= INTVAL (operands[4]) << 4;
17669 mask |= INTVAL (operands[5]) << 6;
17670 operands[2] = GEN_INT (mask);
17671 return "vperm<ssemodesuffix>\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
17673 [(set_attr "type" "sselog")
17674 (set_attr "prefix" "<mask_prefix2>")
17675 (set_attr "mode" "<sseinsnmode>")])
17677 (define_expand "avx512f_perm<mode>"
17678 [(match_operand:V8FI 0 "register_operand")
17679 (match_operand:V8FI 1 "nonimmediate_operand")
17680 (match_operand:SI 2 "const_0_to_255_operand")]
17683 int mask = INTVAL (operands[2]);
17684 emit_insn (gen_avx512f_perm<mode>_1 (operands[0], operands[1],
17685 GEN_INT ((mask >> 0) & 3),
17686 GEN_INT ((mask >> 2) & 3),
17687 GEN_INT ((mask >> 4) & 3),
17688 GEN_INT ((mask >> 6) & 3),
17689 GEN_INT (((mask >> 0) & 3) + 4),
17690 GEN_INT (((mask >> 2) & 3) + 4),
17691 GEN_INT (((mask >> 4) & 3) + 4),
17692 GEN_INT (((mask >> 6) & 3) + 4)));
17696 (define_expand "avx512f_perm<mode>_mask"
17697 [(match_operand:V8FI 0 "register_operand")
17698 (match_operand:V8FI 1 "nonimmediate_operand")
17699 (match_operand:SI 2 "const_0_to_255_operand")
17700 (match_operand:V8FI 3 "vector_move_operand")
17701 (match_operand:<avx512fmaskmode> 4 "register_operand")]
17704 int mask = INTVAL (operands[2]);
17705 emit_insn (gen_avx512f_perm<mode>_1_mask (operands[0], operands[1],
17706 GEN_INT ((mask >> 0) & 3),
17707 GEN_INT ((mask >> 2) & 3),
17708 GEN_INT ((mask >> 4) & 3),
17709 GEN_INT ((mask >> 6) & 3),
17710 GEN_INT (((mask >> 0) & 3) + 4),
17711 GEN_INT (((mask >> 2) & 3) + 4),
17712 GEN_INT (((mask >> 4) & 3) + 4),
17713 GEN_INT (((mask >> 6) & 3) + 4),
17714 operands[3], operands[4]));
17718 (define_insn "avx512f_perm<mode>_1<mask_name>"
17719 [(set (match_operand:V8FI 0 "register_operand" "=v")
17721 (match_operand:V8FI 1 "nonimmediate_operand" "vm")
17722 (parallel [(match_operand 2 "const_0_to_3_operand")
17723 (match_operand 3 "const_0_to_3_operand")
17724 (match_operand 4 "const_0_to_3_operand")
17725 (match_operand 5 "const_0_to_3_operand")
17726 (match_operand 6 "const_4_to_7_operand")
17727 (match_operand 7 "const_4_to_7_operand")
17728 (match_operand 8 "const_4_to_7_operand")
17729 (match_operand 9 "const_4_to_7_operand")])))]
17730 "TARGET_AVX512F && <mask_mode512bit_condition>
17731 && (INTVAL (operands[2]) == (INTVAL (operands[6]) - 4)
17732 && INTVAL (operands[3]) == (INTVAL (operands[7]) - 4)
17733 && INTVAL (operands[4]) == (INTVAL (operands[8]) - 4)
17734 && INTVAL (operands[5]) == (INTVAL (operands[9]) - 4))"
17737 mask |= INTVAL (operands[2]) << 0;
17738 mask |= INTVAL (operands[3]) << 2;
17739 mask |= INTVAL (operands[4]) << 4;
17740 mask |= INTVAL (operands[5]) << 6;
17741 operands[2] = GEN_INT (mask);
17742 return "vperm<ssemodesuffix>\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
17744 [(set_attr "type" "sselog")
17745 (set_attr "prefix" "<mask_prefix2>")
17746 (set_attr "mode" "<sseinsnmode>")])
17748 (define_insn "avx2_permv2ti"
17749 [(set (match_operand:V4DI 0 "register_operand" "=x")
17751 [(match_operand:V4DI 1 "register_operand" "x")
17752 (match_operand:V4DI 2 "nonimmediate_operand" "xm")
17753 (match_operand:SI 3 "const_0_to_255_operand" "n")]
17756 "vperm2i128\t{%3, %2, %1, %0|%0, %1, %2, %3}"
17757 [(set_attr "type" "sselog")
17758 (set_attr "prefix" "vex")
17759 (set_attr "mode" "OI")])
17761 (define_insn "avx2_vec_dupv4df"
17762 [(set (match_operand:V4DF 0 "register_operand" "=v")
17763 (vec_duplicate:V4DF
17765 (match_operand:V2DF 1 "register_operand" "v")
17766 (parallel [(const_int 0)]))))]
17768 "vbroadcastsd\t{%1, %0|%0, %1}"
17769 [(set_attr "type" "sselog1")
17770 (set_attr "prefix" "maybe_evex")
17771 (set_attr "mode" "V4DF")])
17773 (define_insn "<avx512>_vec_dup<mode>_1"
17774 [(set (match_operand:VI_AVX512BW 0 "register_operand" "=v,v")
17775 (vec_duplicate:VI_AVX512BW
17776 (vec_select:<ssescalarmode>
17777 (match_operand:VI_AVX512BW 1 "nonimmediate_operand" "v,m")
17778 (parallel [(const_int 0)]))))]
17781 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %x1}
17782 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %<iptr>1}"
17783 [(set_attr "type" "ssemov")
17784 (set_attr "prefix" "evex")
17785 (set_attr "mode" "<sseinsnmode>")])
17787 (define_insn "<avx512>_vec_dup<mode><mask_name>"
17788 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v")
17789 (vec_duplicate:V48_AVX512VL
17790 (vec_select:<ssescalarmode>
17791 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "vm")
17792 (parallel [(const_int 0)]))))]
17795 /* There is no DF broadcast (in AVX-512*) to 128b register.
17796 Mimic it with integer variant. */
17797 if (<MODE>mode == V2DFmode)
17798 return "vpbroadcastq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}";
17800 return "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %<iptr>1}";
17802 [(set_attr "type" "ssemov")
17803 (set_attr "prefix" "evex")
17804 (set_attr "mode" "<sseinsnmode>")])
17806 (define_insn "<avx512>_vec_dup<mode><mask_name>"
17807 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
17808 (vec_duplicate:VI12_AVX512VL
17809 (vec_select:<ssescalarmode>
17810 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "vm")
17811 (parallel [(const_int 0)]))))]
17813 "vpbroadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %<iptr>1}"
17814 [(set_attr "type" "ssemov")
17815 (set_attr "prefix" "evex")
17816 (set_attr "mode" "<sseinsnmode>")])
17818 (define_insn "<mask_codefor>avx512f_broadcast<mode><mask_name>"
17819 [(set (match_operand:V16FI 0 "register_operand" "=v,v")
17820 (vec_duplicate:V16FI
17821 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "v,m")))]
17824 vshuf<shuffletype>32x4\t{$0x0, %g1, %g1, %0<mask_operand2>|%0<mask_operand2>, %g1, %g1, 0x0}
17825 vbroadcast<shuffletype>32x4\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17826 [(set_attr "type" "ssemov")
17827 (set_attr "prefix" "evex")
17828 (set_attr "mode" "<sseinsnmode>")])
17830 (define_insn "<mask_codefor>avx512f_broadcast<mode><mask_name>"
17831 [(set (match_operand:V8FI 0 "register_operand" "=v,v")
17832 (vec_duplicate:V8FI
17833 (match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "v,m")))]
17836 vshuf<shuffletype>64x2\t{$0x44, %g1, %g1, %0<mask_operand2>|%0<mask_operand2>, %g1, %g1, 0x44}
17837 vbroadcast<shuffletype>64x4\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17838 [(set_attr "type" "ssemov")
17839 (set_attr "prefix" "evex")
17840 (set_attr "mode" "<sseinsnmode>")])
17842 (define_insn "<mask_codefor><avx512>_vec_dup_gpr<mode><mask_name>"
17843 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v,v")
17844 (vec_duplicate:VI12_AVX512VL
17845 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "vm,r")))]
17848 vpbroadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}
17849 vpbroadcast<bcstscalarsuff>\t{%k1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
17850 [(set_attr "type" "ssemov")
17851 (set_attr "prefix" "evex")
17852 (set_attr "mode" "<sseinsnmode>")])
17854 (define_insn "<mask_codefor><avx512>_vec_dup_gpr<mode><mask_name>"
17855 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v,v")
17856 (vec_duplicate:V48_AVX512VL
17857 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "vm,r")))]
17859 "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17860 [(set_attr "type" "ssemov")
17861 (set_attr "prefix" "evex")
17862 (set_attr "mode" "<sseinsnmode>")
17863 (set (attr "enabled")
17864 (if_then_else (eq_attr "alternative" "1")
17865 (symbol_ref "GET_MODE_CLASS (<ssescalarmode>mode) == MODE_INT
17866 && (<ssescalarmode>mode != DImode || TARGET_64BIT)")
17869 (define_insn "vec_dupv4sf"
17870 [(set (match_operand:V4SF 0 "register_operand" "=v,v,x")
17871 (vec_duplicate:V4SF
17872 (match_operand:SF 1 "nonimmediate_operand" "Yv,m,0")))]
17875 vshufps\t{$0, %1, %1, %0|%0, %1, %1, 0}
17876 vbroadcastss\t{%1, %0|%0, %1}
17877 shufps\t{$0, %0, %0|%0, %0, 0}"
17878 [(set_attr "isa" "avx,avx,noavx")
17879 (set_attr "type" "sseshuf1,ssemov,sseshuf1")
17880 (set_attr "length_immediate" "1,0,1")
17881 (set_attr "prefix_extra" "0,1,*")
17882 (set_attr "prefix" "maybe_evex,maybe_evex,orig")
17883 (set_attr "mode" "V4SF")])
17885 (define_insn "*vec_dupv4si"
17886 [(set (match_operand:V4SI 0 "register_operand" "=v,v,x")
17887 (vec_duplicate:V4SI
17888 (match_operand:SI 1 "nonimmediate_operand" "Yv,m,0")))]
17891 %vpshufd\t{$0, %1, %0|%0, %1, 0}
17892 vbroadcastss\t{%1, %0|%0, %1}
17893 shufps\t{$0, %0, %0|%0, %0, 0}"
17894 [(set_attr "isa" "sse2,avx,noavx")
17895 (set_attr "type" "sselog1,ssemov,sselog1")
17896 (set_attr "length_immediate" "1,0,1")
17897 (set_attr "prefix_extra" "0,1,*")
17898 (set_attr "prefix" "maybe_vex,maybe_evex,orig")
17899 (set_attr "mode" "TI,V4SF,V4SF")])
17901 (define_insn "*vec_dupv2di"
17902 [(set (match_operand:V2DI 0 "register_operand" "=x,v,v,x")
17903 (vec_duplicate:V2DI
17904 (match_operand:DI 1 "nonimmediate_operand" " 0,Yv,m,0")))]
17908 vpunpcklqdq\t{%d1, %0|%0, %d1}
17909 %vmovddup\t{%1, %0|%0, %1}
17911 [(set_attr "isa" "sse2_noavx,avx,sse3,noavx")
17912 (set_attr "type" "sselog1,sselog1,sselog1,ssemov")
17913 (set_attr "prefix" "orig,maybe_evex,maybe_vex,orig")
17914 (set_attr "mode" "TI,TI,DF,V4SF")])
17916 (define_insn "avx2_vbroadcasti128_<mode>"
17917 [(set (match_operand:VI_256 0 "register_operand" "=x,v,v")
17919 (match_operand:<ssehalfvecmode> 1 "memory_operand" "m,m,m")
17923 vbroadcasti128\t{%1, %0|%0, %1}
17924 vbroadcast<i128vldq>\t{%1, %0|%0, %1}
17925 vbroadcast<shuffletype>32x4\t{%1, %0|%0, %1}"
17926 [(set_attr "isa" "*,avx512dq,avx512vl")
17927 (set_attr "type" "ssemov")
17928 (set_attr "prefix_extra" "1")
17929 (set_attr "prefix" "vex,evex,evex")
17930 (set_attr "mode" "OI")])
17932 ;; Modes handled by AVX vec_dup patterns.
17933 (define_mode_iterator AVX_VEC_DUP_MODE
17934 [V8SI V8SF V4DI V4DF])
17935 (define_mode_attr vecdupssescalarmodesuffix
17936 [(V8SF "ss") (V4DF "sd") (V8SI "ss") (V4DI "sd")])
17937 ;; Modes handled by AVX2 vec_dup patterns.
17938 (define_mode_iterator AVX2_VEC_DUP_MODE
17939 [V32QI V16QI V16HI V8HI V8SI V4SI])
17941 (define_insn "*vec_dup<mode>"
17942 [(set (match_operand:AVX2_VEC_DUP_MODE 0 "register_operand" "=x,x,v")
17943 (vec_duplicate:AVX2_VEC_DUP_MODE
17944 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "m,x,$r")))]
17947 v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0|%0, %1}
17948 v<sseintprefix>broadcast<bcstscalarsuff>\t{%x1, %0|%0, %x1}
17950 [(set_attr "isa" "*,*,noavx512vl")
17951 (set_attr "type" "ssemov")
17952 (set_attr "prefix_extra" "1")
17953 (set_attr "prefix" "maybe_evex")
17954 (set_attr "mode" "<sseinsnmode>")
17955 (set (attr "preferred_for_speed")
17956 (cond [(eq_attr "alternative" "2")
17957 (symbol_ref "TARGET_INTER_UNIT_MOVES_TO_VEC")
17959 (symbol_ref "true")))])
17961 (define_insn "vec_dup<mode>"
17962 [(set (match_operand:AVX_VEC_DUP_MODE 0 "register_operand" "=x,x,x,v,x")
17963 (vec_duplicate:AVX_VEC_DUP_MODE
17964 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "m,m,x,v,?x")))]
17967 v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0|%0, %1}
17968 vbroadcast<vecdupssescalarmodesuffix>\t{%1, %0|%0, %1}
17969 v<sseintprefix>broadcast<bcstscalarsuff>\t{%x1, %0|%0, %x1}
17970 v<sseintprefix>broadcast<bcstscalarsuff>\t{%x1, %g0|%g0, %x1}
17972 [(set_attr "type" "ssemov")
17973 (set_attr "prefix_extra" "1")
17974 (set_attr "prefix" "maybe_evex")
17975 (set_attr "isa" "avx2,noavx2,avx2,avx512f,noavx2")
17976 (set_attr "mode" "<sseinsnmode>,V8SF,<sseinsnmode>,<sseinsnmode>,V8SF")])
17979 [(set (match_operand:AVX2_VEC_DUP_MODE 0 "register_operand")
17980 (vec_duplicate:AVX2_VEC_DUP_MODE
17981 (match_operand:<ssescalarmode> 1 "register_operand")))]
17983 /* Disable this splitter if avx512vl_vec_dup_gprv*[qhs]i insn is
17984 available, because then we can broadcast from GPRs directly.
17985 For V*[QH]I modes it requires both -mavx512vl and -mavx512bw,
17986 for V*SI mode it requires just -mavx512vl. */
17987 && !(TARGET_AVX512VL
17988 && (TARGET_AVX512BW || <ssescalarmode>mode == SImode))
17989 && reload_completed && GENERAL_REG_P (operands[1])"
17992 emit_insn (gen_vec_setv4si_0 (gen_lowpart (V4SImode, operands[0]),
17993 CONST0_RTX (V4SImode),
17994 gen_lowpart (SImode, operands[1])));
17995 emit_insn (gen_avx2_pbroadcast<mode> (operands[0],
17996 gen_lowpart (<ssexmmmode>mode,
18002 [(set (match_operand:AVX_VEC_DUP_MODE 0 "register_operand")
18003 (vec_duplicate:AVX_VEC_DUP_MODE
18004 (match_operand:<ssescalarmode> 1 "register_operand")))]
18005 "TARGET_AVX && !TARGET_AVX2 && reload_completed"
18006 [(set (match_dup 2)
18007 (vec_duplicate:<ssehalfvecmode> (match_dup 1)))
18009 (vec_concat:AVX_VEC_DUP_MODE (match_dup 2) (match_dup 2)))]
18010 "operands[2] = gen_lowpart (<ssehalfvecmode>mode, operands[0]);")
18012 (define_insn "avx_vbroadcastf128_<mode>"
18013 [(set (match_operand:V_256 0 "register_operand" "=x,x,x,v,v,v,v")
18015 (match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "m,0,?x,m,0,m,0")
18019 vbroadcast<i128>\t{%1, %0|%0, %1}
18020 vinsert<i128>\t{$1, %1, %0, %0|%0, %0, %1, 1}
18021 vperm2<i128>\t{$0, %t1, %t1, %0|%0, %t1, %t1, 0}
18022 vbroadcast<i128vldq>\t{%1, %0|%0, %1}
18023 vinsert<i128vldq>\t{$1, %1, %0, %0|%0, %0, %1, 1}
18024 vbroadcast<shuffletype>32x4\t{%1, %0|%0, %1}
18025 vinsert<shuffletype>32x4\t{$1, %1, %0, %0|%0, %0, %1, 1}"
18026 [(set_attr "isa" "*,*,*,avx512dq,avx512dq,avx512vl,avx512vl")
18027 (set_attr "type" "ssemov,sselog1,sselog1,ssemov,sselog1,ssemov,sselog1")
18028 (set_attr "prefix_extra" "1")
18029 (set_attr "length_immediate" "0,1,1,0,1,0,1")
18030 (set_attr "prefix" "vex,vex,vex,evex,evex,evex,evex")
18031 (set_attr "mode" "<sseinsnmode>")])
18033 ;; For broadcast[i|f]32x2. Yes there is no v4sf version, only v4si.
18034 (define_mode_iterator VI4F_BRCST32x2
18035 [V16SI (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")
18036 V16SF (V8SF "TARGET_AVX512VL")])
18038 (define_mode_attr 64x2mode
18039 [(V8DF "V2DF") (V8DI "V2DI") (V4DI "V2DI") (V4DF "V2DF")])
18041 (define_mode_attr 32x2mode
18042 [(V16SF "V2SF") (V16SI "V2SI") (V8SI "V2SI")
18043 (V8SF "V2SF") (V4SI "V2SI")])
18045 (define_insn "<mask_codefor>avx512dq_broadcast<mode><mask_name>"
18046 [(set (match_operand:VI4F_BRCST32x2 0 "register_operand" "=v")
18047 (vec_duplicate:VI4F_BRCST32x2
18048 (vec_select:<32x2mode>
18049 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "vm")
18050 (parallel [(const_int 0) (const_int 1)]))))]
18052 "vbroadcast<shuffletype>32x2\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
18053 [(set_attr "type" "ssemov")
18054 (set_attr "prefix_extra" "1")
18055 (set_attr "prefix" "evex")
18056 (set_attr "mode" "<sseinsnmode>")])
18058 (define_insn "<mask_codefor>avx512vl_broadcast<mode><mask_name>_1"
18059 [(set (match_operand:VI4F_256 0 "register_operand" "=v,v")
18060 (vec_duplicate:VI4F_256
18061 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "v,m")))]
18064 vshuf<shuffletype>32x4\t{$0x0, %t1, %t1, %0<mask_operand2>|%0<mask_operand2>, %t1, %t1, 0x0}
18065 vbroadcast<shuffletype>32x4\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
18066 [(set_attr "type" "ssemov")
18067 (set_attr "prefix_extra" "1")
18068 (set_attr "prefix" "evex")
18069 (set_attr "mode" "<sseinsnmode>")])
18071 (define_insn "<mask_codefor>avx512dq_broadcast<mode><mask_name>_1"
18072 [(set (match_operand:V16FI 0 "register_operand" "=v,v")
18073 (vec_duplicate:V16FI
18074 (match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "v,m")))]
18077 vshuf<shuffletype>32x4\t{$0x44, %g1, %g1, %0<mask_operand2>|%0<mask_operand2>, %g1, %g1, 0x44}
18078 vbroadcast<shuffletype>32x8\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
18079 [(set_attr "type" "ssemov")
18080 (set_attr "prefix_extra" "1")
18081 (set_attr "prefix" "evex")
18082 (set_attr "mode" "<sseinsnmode>")])
18084 ;; For broadcast[i|f]64x2
18085 (define_mode_iterator VI8F_BRCST64x2
18086 [V8DI V8DF (V4DI "TARGET_AVX512VL") (V4DF "TARGET_AVX512VL")])
18088 (define_insn "<mask_codefor>avx512dq_broadcast<mode><mask_name>_1"
18089 [(set (match_operand:VI8F_BRCST64x2 0 "register_operand" "=v,v")
18090 (vec_duplicate:VI8F_BRCST64x2
18091 (match_operand:<64x2mode> 1 "nonimmediate_operand" "v,m")))]
18094 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}
18095 vbroadcast<shuffletype>64x2\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
18096 [(set_attr "type" "ssemov")
18097 (set_attr "prefix_extra" "1")
18098 (set_attr "prefix" "evex")
18099 (set_attr "mode" "<sseinsnmode>")])
18101 (define_insn "avx512cd_maskb_vec_dup<mode>"
18102 [(set (match_operand:VI8_AVX512VL 0 "register_operand" "=v")
18103 (vec_duplicate:VI8_AVX512VL
18105 (match_operand:QI 1 "register_operand" "Yk"))))]
18107 "vpbroadcastmb2q\t{%1, %0|%0, %1}"
18108 [(set_attr "type" "mskmov")
18109 (set_attr "prefix" "evex")
18110 (set_attr "mode" "XI")])
18112 (define_insn "avx512cd_maskw_vec_dup<mode>"
18113 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
18114 (vec_duplicate:VI4_AVX512VL
18116 (match_operand:HI 1 "register_operand" "Yk"))))]
18118 "vpbroadcastmw2d\t{%1, %0|%0, %1}"
18119 [(set_attr "type" "mskmov")
18120 (set_attr "prefix" "evex")
18121 (set_attr "mode" "XI")])
18123 ;; Recognize broadcast as a vec_select as produced by builtin_vec_perm.
18124 ;; If it so happens that the input is in memory, use vbroadcast.
18125 ;; Otherwise use vpermilp (and in the case of 256-bit modes, vperm2f128).
18126 (define_insn "*avx_vperm_broadcast_v4sf"
18127 [(set (match_operand:V4SF 0 "register_operand" "=v,v,v")
18129 (match_operand:V4SF 1 "nonimmediate_operand" "m,o,v")
18130 (match_parallel 2 "avx_vbroadcast_operand"
18131 [(match_operand 3 "const_int_operand" "C,n,n")])))]
18134 int elt = INTVAL (operands[3]);
18135 switch (which_alternative)
18139 operands[1] = adjust_address_nv (operands[1], SFmode, elt * 4);
18140 return "vbroadcastss\t{%1, %0|%0, %k1}";
18142 operands[2] = GEN_INT (elt * 0x55);
18143 return "vpermilps\t{%2, %1, %0|%0, %1, %2}";
18145 gcc_unreachable ();
18148 [(set_attr "type" "ssemov,ssemov,sselog1")
18149 (set_attr "prefix_extra" "1")
18150 (set_attr "length_immediate" "0,0,1")
18151 (set_attr "prefix" "maybe_evex")
18152 (set_attr "mode" "SF,SF,V4SF")])
18154 (define_insn_and_split "*avx_vperm_broadcast_<mode>"
18155 [(set (match_operand:VF_256 0 "register_operand" "=v,v,v")
18157 (match_operand:VF_256 1 "nonimmediate_operand" "m,o,?v")
18158 (match_parallel 2 "avx_vbroadcast_operand"
18159 [(match_operand 3 "const_int_operand" "C,n,n")])))]
18162 "&& reload_completed && (<MODE>mode != V4DFmode || !TARGET_AVX2)"
18163 [(set (match_dup 0) (vec_duplicate:VF_256 (match_dup 1)))]
18165 rtx op0 = operands[0], op1 = operands[1];
18166 int elt = INTVAL (operands[3]);
18172 if (TARGET_AVX2 && elt == 0)
18174 emit_insn (gen_vec_dup<mode> (op0, gen_lowpart (<ssescalarmode>mode,
18179 /* Shuffle element we care about into all elements of the 128-bit lane.
18180 The other lane gets shuffled too, but we don't care. */
18181 if (<MODE>mode == V4DFmode)
18182 mask = (elt & 1 ? 15 : 0);
18184 mask = (elt & 3) * 0x55;
18185 emit_insn (gen_avx_vpermil<mode> (op0, op1, GEN_INT (mask)));
18187 /* Shuffle the lane we care about into both lanes of the dest. */
18188 mask = (elt / (<ssescalarnum> / 2)) * 0x11;
18189 if (EXT_REX_SSE_REG_P (op0))
18191 /* There is no EVEX VPERM2F128, but we can use either VBROADCASTSS
18193 gcc_assert (<MODE>mode == V8SFmode);
18194 if ((mask & 1) == 0)
18195 emit_insn (gen_avx2_vec_dupv8sf (op0,
18196 gen_lowpart (V4SFmode, op0)));
18198 emit_insn (gen_avx512vl_shuf_f32x4_1 (op0, op0, op0,
18199 GEN_INT (4), GEN_INT (5),
18200 GEN_INT (6), GEN_INT (7),
18201 GEN_INT (12), GEN_INT (13),
18202 GEN_INT (14), GEN_INT (15)));
18206 emit_insn (gen_avx_vperm2f128<mode>3 (op0, op0, op0, GEN_INT (mask)));
18210 operands[1] = adjust_address (op1, <ssescalarmode>mode,
18211 elt * GET_MODE_SIZE (<ssescalarmode>mode));
18214 (define_expand "<sse2_avx_avx512f>_vpermil<mode><mask_name>"
18215 [(set (match_operand:VF2 0 "register_operand")
18217 (match_operand:VF2 1 "nonimmediate_operand")
18218 (match_operand:SI 2 "const_0_to_255_operand")))]
18219 "TARGET_AVX && <mask_mode512bit_condition>"
18221 int mask = INTVAL (operands[2]);
18222 rtx perm[<ssescalarnum>];
18225 for (i = 0; i < <ssescalarnum>; i = i + 2)
18227 perm[i] = GEN_INT (((mask >> i) & 1) + i);
18228 perm[i + 1] = GEN_INT (((mask >> (i + 1)) & 1) + i);
18232 = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (<ssescalarnum>, perm));
18235 (define_expand "<sse2_avx_avx512f>_vpermil<mode><mask_name>"
18236 [(set (match_operand:VF1 0 "register_operand")
18238 (match_operand:VF1 1 "nonimmediate_operand")
18239 (match_operand:SI 2 "const_0_to_255_operand")))]
18240 "TARGET_AVX && <mask_mode512bit_condition>"
18242 int mask = INTVAL (operands[2]);
18243 rtx perm[<ssescalarnum>];
18246 for (i = 0; i < <ssescalarnum>; i = i + 4)
18248 perm[i] = GEN_INT (((mask >> 0) & 3) + i);
18249 perm[i + 1] = GEN_INT (((mask >> 2) & 3) + i);
18250 perm[i + 2] = GEN_INT (((mask >> 4) & 3) + i);
18251 perm[i + 3] = GEN_INT (((mask >> 6) & 3) + i);
18255 = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (<ssescalarnum>, perm));
18258 (define_insn "*<sse2_avx_avx512f>_vpermilp<mode><mask_name>"
18259 [(set (match_operand:VF 0 "register_operand" "=v")
18261 (match_operand:VF 1 "nonimmediate_operand" "vm")
18262 (match_parallel 2 ""
18263 [(match_operand 3 "const_int_operand")])))]
18264 "TARGET_AVX && <mask_mode512bit_condition>
18265 && avx_vpermilp_parallel (operands[2], <MODE>mode)"
18267 int mask = avx_vpermilp_parallel (operands[2], <MODE>mode) - 1;
18268 operands[2] = GEN_INT (mask);
18269 return "vpermil<ssemodesuffix>\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}";
18271 [(set_attr "type" "sselog")
18272 (set_attr "prefix_extra" "1")
18273 (set_attr "length_immediate" "1")
18274 (set_attr "prefix" "<mask_prefix>")
18275 (set_attr "mode" "<sseinsnmode>")])
18277 (define_insn "<sse2_avx_avx512f>_vpermilvar<mode>3<mask_name>"
18278 [(set (match_operand:VF 0 "register_operand" "=v")
18280 [(match_operand:VF 1 "register_operand" "v")
18281 (match_operand:<sseintvecmode> 2 "nonimmediate_operand" "vm")]
18283 "TARGET_AVX && <mask_mode512bit_condition>"
18284 "vpermil<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18285 [(set_attr "type" "sselog")
18286 (set_attr "prefix_extra" "1")
18287 (set_attr "btver2_decode" "vector")
18288 (set_attr "prefix" "<mask_prefix>")
18289 (set_attr "mode" "<sseinsnmode>")])
18291 (define_mode_iterator VPERMI2
18292 [V16SI V16SF V8DI V8DF
18293 (V8SI "TARGET_AVX512VL") (V8SF "TARGET_AVX512VL")
18294 (V4DI "TARGET_AVX512VL") (V4DF "TARGET_AVX512VL")
18295 (V4SI "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
18296 (V2DI "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")
18297 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX512BW && TARGET_AVX512VL")
18298 (V8HI "TARGET_AVX512BW && TARGET_AVX512VL")
18299 (V64QI "TARGET_AVX512VBMI") (V32QI "TARGET_AVX512VBMI && TARGET_AVX512VL")
18300 (V16QI "TARGET_AVX512VBMI && TARGET_AVX512VL")])
18302 (define_mode_iterator VPERMI2I
18304 (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")
18305 (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")
18306 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX512BW && TARGET_AVX512VL")
18307 (V8HI "TARGET_AVX512BW && TARGET_AVX512VL")
18308 (V64QI "TARGET_AVX512VBMI") (V32QI "TARGET_AVX512VBMI && TARGET_AVX512VL")
18309 (V16QI "TARGET_AVX512VBMI && TARGET_AVX512VL")])
18311 (define_expand "<avx512>_vpermi2var<mode>3_mask"
18312 [(set (match_operand:VPERMI2 0 "register_operand")
18315 [(match_operand:<sseintvecmode> 2 "register_operand")
18316 (match_operand:VPERMI2 1 "register_operand")
18317 (match_operand:VPERMI2 3 "nonimmediate_operand")]
18320 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
18323 operands[2] = force_reg (<sseintvecmode>mode, operands[2]);
18324 operands[5] = gen_lowpart (<MODE>mode, operands[2]);
18327 (define_insn "*<avx512>_vpermi2var<mode>3_mask"
18328 [(set (match_operand:VPERMI2I 0 "register_operand" "=v")
18329 (vec_merge:VPERMI2I
18331 [(match_operand:<sseintvecmode> 2 "register_operand" "0")
18332 (match_operand:VPERMI2I 1 "register_operand" "v")
18333 (match_operand:VPERMI2I 3 "nonimmediate_operand" "vm")]
18336 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
18338 "vpermi2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
18339 [(set_attr "type" "sselog")
18340 (set_attr "prefix" "evex")
18341 (set_attr "mode" "<sseinsnmode>")])
18343 (define_insn "*<avx512>_vpermi2var<mode>3_mask"
18344 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
18345 (vec_merge:VF_AVX512VL
18346 (unspec:VF_AVX512VL
18347 [(match_operand:<sseintvecmode> 2 "register_operand" "0")
18348 (match_operand:VF_AVX512VL 1 "register_operand" "v")
18349 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "vm")]
18351 (subreg:VF_AVX512VL (match_dup 2) 0)
18352 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
18354 "vpermi2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
18355 [(set_attr "type" "sselog")
18356 (set_attr "prefix" "evex")
18357 (set_attr "mode" "<sseinsnmode>")])
18359 (define_expand "<avx512>_vpermt2var<mode>3_maskz"
18360 [(match_operand:VPERMI2 0 "register_operand")
18361 (match_operand:<sseintvecmode> 1 "register_operand")
18362 (match_operand:VPERMI2 2 "register_operand")
18363 (match_operand:VPERMI2 3 "nonimmediate_operand")
18364 (match_operand:<avx512fmaskmode> 4 "register_operand")]
18367 emit_insn (gen_<avx512>_vpermt2var<mode>3_maskz_1 (
18368 operands[0], operands[1], operands[2], operands[3],
18369 CONST0_RTX (<MODE>mode), operands[4]));
18373 (define_insn "<avx512>_vpermt2var<mode>3<sd_maskz_name>"
18374 [(set (match_operand:VPERMI2 0 "register_operand" "=v,v")
18376 [(match_operand:<sseintvecmode> 1 "register_operand" "v,0")
18377 (match_operand:VPERMI2 2 "register_operand" "0,v")
18378 (match_operand:VPERMI2 3 "nonimmediate_operand" "vm,vm")]
18382 vpermt2<ssemodesuffix>\t{%3, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %3}
18383 vpermi2<ssemodesuffix>\t{%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3}"
18384 [(set_attr "type" "sselog")
18385 (set_attr "prefix" "evex")
18386 (set_attr "mode" "<sseinsnmode>")])
18388 (define_insn "<avx512>_vpermt2var<mode>3_mask"
18389 [(set (match_operand:VPERMI2 0 "register_operand" "=v")
18392 [(match_operand:<sseintvecmode> 1 "register_operand" "v")
18393 (match_operand:VPERMI2 2 "register_operand" "0")
18394 (match_operand:VPERMI2 3 "nonimmediate_operand" "vm")]
18397 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
18399 "vpermt2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
18400 [(set_attr "type" "sselog")
18401 (set_attr "prefix" "evex")
18402 (set_attr "mode" "<sseinsnmode>")])
18404 (define_expand "avx_vperm2f128<mode>3"
18405 [(set (match_operand:AVX256MODE2P 0 "register_operand")
18406 (unspec:AVX256MODE2P
18407 [(match_operand:AVX256MODE2P 1 "register_operand")
18408 (match_operand:AVX256MODE2P 2 "nonimmediate_operand")
18409 (match_operand:SI 3 "const_0_to_255_operand")]
18410 UNSPEC_VPERMIL2F128))]
18413 int mask = INTVAL (operands[3]);
18414 if ((mask & 0x88) == 0)
18416 rtx perm[<ssescalarnum>], t1, t2;
18417 int i, base, nelt = <ssescalarnum>, nelt2 = nelt / 2;
18419 base = (mask & 3) * nelt2;
18420 for (i = 0; i < nelt2; ++i)
18421 perm[i] = GEN_INT (base + i);
18423 base = ((mask >> 4) & 3) * nelt2;
18424 for (i = 0; i < nelt2; ++i)
18425 perm[i + nelt2] = GEN_INT (base + i);
18427 t2 = gen_rtx_VEC_CONCAT (<ssedoublevecmode>mode,
18428 operands[1], operands[2]);
18429 t1 = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (nelt, perm));
18430 t2 = gen_rtx_VEC_SELECT (<MODE>mode, t2, t1);
18431 t2 = gen_rtx_SET (operands[0], t2);
18437 ;; Note that bits 7 and 3 of the imm8 allow lanes to be zeroed, which
18438 ;; means that in order to represent this properly in rtl we'd have to
18439 ;; nest *another* vec_concat with a zero operand and do the select from
18440 ;; a 4x wide vector. That doesn't seem very nice.
18441 (define_insn "*avx_vperm2f128<mode>_full"
18442 [(set (match_operand:AVX256MODE2P 0 "register_operand" "=x")
18443 (unspec:AVX256MODE2P
18444 [(match_operand:AVX256MODE2P 1 "register_operand" "x")
18445 (match_operand:AVX256MODE2P 2 "nonimmediate_operand" "xm")
18446 (match_operand:SI 3 "const_0_to_255_operand" "n")]
18447 UNSPEC_VPERMIL2F128))]
18449 "vperm2<i128>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
18450 [(set_attr "type" "sselog")
18451 (set_attr "prefix_extra" "1")
18452 (set_attr "length_immediate" "1")
18453 (set_attr "prefix" "vex")
18454 (set_attr "mode" "<sseinsnmode>")])
18456 (define_insn "*avx_vperm2f128<mode>_nozero"
18457 [(set (match_operand:AVX256MODE2P 0 "register_operand" "=x")
18458 (vec_select:AVX256MODE2P
18459 (vec_concat:<ssedoublevecmode>
18460 (match_operand:AVX256MODE2P 1 "register_operand" "x")
18461 (match_operand:AVX256MODE2P 2 "nonimmediate_operand" "xm"))
18462 (match_parallel 3 ""
18463 [(match_operand 4 "const_int_operand")])))]
18465 && avx_vperm2f128_parallel (operands[3], <MODE>mode)"
18467 int mask = avx_vperm2f128_parallel (operands[3], <MODE>mode) - 1;
18469 return "vinsert<i128>\t{$0, %x2, %1, %0|%0, %1, %x2, 0}";
18471 return "vinsert<i128>\t{$1, %x2, %1, %0|%0, %1, %x2, 1}";
18472 operands[3] = GEN_INT (mask);
18473 return "vperm2<i128>\t{%3, %2, %1, %0|%0, %1, %2, %3}";
18475 [(set_attr "type" "sselog")
18476 (set_attr "prefix_extra" "1")
18477 (set_attr "length_immediate" "1")
18478 (set_attr "prefix" "vex")
18479 (set_attr "mode" "<sseinsnmode>")])
18481 (define_insn "*ssse3_palignr<mode>_perm"
18482 [(set (match_operand:V_128 0 "register_operand" "=x,x,v")
18484 (match_operand:V_128 1 "register_operand" "0,x,v")
18485 (match_parallel 2 "palignr_operand"
18486 [(match_operand 3 "const_int_operand" "n,n,n")])))]
18489 operands[2] = (GEN_INT (INTVAL (operands[3])
18490 * GET_MODE_UNIT_SIZE (GET_MODE (operands[0]))));
18492 switch (which_alternative)
18495 return "palignr\t{%2, %1, %0|%0, %1, %2}";
18498 return "vpalignr\t{%2, %1, %1, %0|%0, %1, %1, %2}";
18500 gcc_unreachable ();
18503 [(set_attr "isa" "noavx,avx,avx512bw")
18504 (set_attr "type" "sseishft")
18505 (set_attr "atom_unit" "sishuf")
18506 (set_attr "prefix_data16" "1,*,*")
18507 (set_attr "prefix_extra" "1")
18508 (set_attr "length_immediate" "1")
18509 (set_attr "prefix" "orig,vex,evex")])
18511 (define_expand "avx512vl_vinsert<mode>"
18512 [(match_operand:VI48F_256 0 "register_operand")
18513 (match_operand:VI48F_256 1 "register_operand")
18514 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand")
18515 (match_operand:SI 3 "const_0_to_1_operand")
18516 (match_operand:VI48F_256 4 "register_operand")
18517 (match_operand:<avx512fmaskmode> 5 "register_operand")]
18520 rtx (*insn)(rtx, rtx, rtx, rtx, rtx);
18522 switch (INTVAL (operands[3]))
18525 insn = gen_vec_set_lo_<mode>_mask;
18528 insn = gen_vec_set_hi_<mode>_mask;
18531 gcc_unreachable ();
18534 emit_insn (insn (operands[0], operands[1], operands[2], operands[4],
18539 (define_expand "avx_vinsertf128<mode>"
18540 [(match_operand:V_256 0 "register_operand")
18541 (match_operand:V_256 1 "register_operand")
18542 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand")
18543 (match_operand:SI 3 "const_0_to_1_operand")]
18546 rtx (*insn)(rtx, rtx, rtx);
18548 switch (INTVAL (operands[3]))
18551 insn = gen_vec_set_lo_<mode>;
18554 insn = gen_vec_set_hi_<mode>;
18557 gcc_unreachable ();
18560 emit_insn (insn (operands[0], operands[1], operands[2]));
18564 (define_insn "vec_set_lo_<mode><mask_name>"
18565 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
18566 (vec_concat:VI8F_256
18567 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
18568 (vec_select:<ssehalfvecmode>
18569 (match_operand:VI8F_256 1 "register_operand" "v")
18570 (parallel [(const_int 2) (const_int 3)]))))]
18571 "TARGET_AVX && <mask_avx512dq_condition>"
18573 if (TARGET_AVX512DQ)
18574 return "vinsert<shuffletype>64x2\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}";
18575 else 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:VI8F_256 0 "register_operand" "=v")
18588 (vec_concat:VI8F_256
18589 (vec_select:<ssehalfvecmode>
18590 (match_operand:VI8F_256 1 "register_operand" "v")
18591 (parallel [(const_int 0) (const_int 1)]))
18592 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
18593 "TARGET_AVX && <mask_avx512dq_condition>"
18595 if (TARGET_AVX512DQ)
18596 return "vinsert<shuffletype>64x2\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}";
18597 else if (TARGET_AVX512VL)
18598 return "vinsert<shuffletype>32x4\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}";
18600 return "vinsert<i128>\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}";
18602 [(set_attr "type" "sselog")
18603 (set_attr "prefix_extra" "1")
18604 (set_attr "length_immediate" "1")
18605 (set_attr "prefix" "vex")
18606 (set_attr "mode" "<sseinsnmode>")])
18608 (define_insn "vec_set_lo_<mode><mask_name>"
18609 [(set (match_operand:VI4F_256 0 "register_operand" "=v")
18610 (vec_concat:VI4F_256
18611 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
18612 (vec_select:<ssehalfvecmode>
18613 (match_operand:VI4F_256 1 "register_operand" "v")
18614 (parallel [(const_int 4) (const_int 5)
18615 (const_int 6) (const_int 7)]))))]
18618 if (TARGET_AVX512VL)
18619 return "vinsert<shuffletype>32x4\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}";
18621 return "vinsert<i128>\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}";
18623 [(set_attr "type" "sselog")
18624 (set_attr "prefix_extra" "1")
18625 (set_attr "length_immediate" "1")
18626 (set_attr "prefix" "vex")
18627 (set_attr "mode" "<sseinsnmode>")])
18629 (define_insn "vec_set_hi_<mode><mask_name>"
18630 [(set (match_operand:VI4F_256 0 "register_operand" "=v")
18631 (vec_concat:VI4F_256
18632 (vec_select:<ssehalfvecmode>
18633 (match_operand:VI4F_256 1 "register_operand" "v")
18634 (parallel [(const_int 0) (const_int 1)
18635 (const_int 2) (const_int 3)]))
18636 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
18639 if (TARGET_AVX512VL)
18640 return "vinsert<shuffletype>32x4\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}";
18642 return "vinsert<i128>\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}";
18644 [(set_attr "type" "sselog")
18645 (set_attr "prefix_extra" "1")
18646 (set_attr "length_immediate" "1")
18647 (set_attr "prefix" "vex")
18648 (set_attr "mode" "<sseinsnmode>")])
18650 (define_insn "vec_set_lo_v16hi"
18651 [(set (match_operand:V16HI 0 "register_operand" "=x,v")
18653 (match_operand:V8HI 2 "nonimmediate_operand" "xm,vm")
18655 (match_operand:V16HI 1 "register_operand" "x,v")
18656 (parallel [(const_int 8) (const_int 9)
18657 (const_int 10) (const_int 11)
18658 (const_int 12) (const_int 13)
18659 (const_int 14) (const_int 15)]))))]
18662 vinsert%~128\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}
18663 vinserti32x4\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}"
18664 [(set_attr "type" "sselog")
18665 (set_attr "prefix_extra" "1")
18666 (set_attr "length_immediate" "1")
18667 (set_attr "prefix" "vex,evex")
18668 (set_attr "mode" "OI")])
18670 (define_insn "vec_set_hi_v16hi"
18671 [(set (match_operand:V16HI 0 "register_operand" "=x,v")
18674 (match_operand:V16HI 1 "register_operand" "x,v")
18675 (parallel [(const_int 0) (const_int 1)
18676 (const_int 2) (const_int 3)
18677 (const_int 4) (const_int 5)
18678 (const_int 6) (const_int 7)]))
18679 (match_operand:V8HI 2 "nonimmediate_operand" "xm,vm")))]
18682 vinsert%~128\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}
18683 vinserti32x4\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}"
18684 [(set_attr "type" "sselog")
18685 (set_attr "prefix_extra" "1")
18686 (set_attr "length_immediate" "1")
18687 (set_attr "prefix" "vex,evex")
18688 (set_attr "mode" "OI")])
18690 (define_insn "vec_set_lo_v32qi"
18691 [(set (match_operand:V32QI 0 "register_operand" "=x,v")
18693 (match_operand:V16QI 2 "nonimmediate_operand" "xm,v")
18695 (match_operand:V32QI 1 "register_operand" "x,v")
18696 (parallel [(const_int 16) (const_int 17)
18697 (const_int 18) (const_int 19)
18698 (const_int 20) (const_int 21)
18699 (const_int 22) (const_int 23)
18700 (const_int 24) (const_int 25)
18701 (const_int 26) (const_int 27)
18702 (const_int 28) (const_int 29)
18703 (const_int 30) (const_int 31)]))))]
18706 vinsert%~128\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}
18707 vinserti32x4\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}"
18708 [(set_attr "type" "sselog")
18709 (set_attr "prefix_extra" "1")
18710 (set_attr "length_immediate" "1")
18711 (set_attr "prefix" "vex,evex")
18712 (set_attr "mode" "OI")])
18714 (define_insn "vec_set_hi_v32qi"
18715 [(set (match_operand:V32QI 0 "register_operand" "=x,v")
18718 (match_operand:V32QI 1 "register_operand" "x,v")
18719 (parallel [(const_int 0) (const_int 1)
18720 (const_int 2) (const_int 3)
18721 (const_int 4) (const_int 5)
18722 (const_int 6) (const_int 7)
18723 (const_int 8) (const_int 9)
18724 (const_int 10) (const_int 11)
18725 (const_int 12) (const_int 13)
18726 (const_int 14) (const_int 15)]))
18727 (match_operand:V16QI 2 "nonimmediate_operand" "xm,vm")))]
18730 vinsert%~128\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}
18731 vinserti32x4\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}"
18732 [(set_attr "type" "sselog")
18733 (set_attr "prefix_extra" "1")
18734 (set_attr "length_immediate" "1")
18735 (set_attr "prefix" "vex,evex")
18736 (set_attr "mode" "OI")])
18738 (define_insn "<avx_avx2>_maskload<ssemodesuffix><avxsizesuffix>"
18739 [(set (match_operand:V48_AVX2 0 "register_operand" "=x")
18741 [(match_operand:<sseintvecmode> 2 "register_operand" "x")
18742 (match_operand:V48_AVX2 1 "memory_operand" "m")]
18745 "v<sseintprefix>maskmov<ssemodesuffix>\t{%1, %2, %0|%0, %2, %1}"
18746 [(set_attr "type" "sselog1")
18747 (set_attr "prefix_extra" "1")
18748 (set_attr "prefix" "vex")
18749 (set_attr "btver2_decode" "vector")
18750 (set_attr "mode" "<sseinsnmode>")])
18752 (define_insn "<avx_avx2>_maskstore<ssemodesuffix><avxsizesuffix>"
18753 [(set (match_operand:V48_AVX2 0 "memory_operand" "+m")
18755 [(match_operand:<sseintvecmode> 1 "register_operand" "x")
18756 (match_operand:V48_AVX2 2 "register_operand" "x")
18760 "v<sseintprefix>maskmov<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
18761 [(set_attr "type" "sselog1")
18762 (set_attr "prefix_extra" "1")
18763 (set_attr "prefix" "vex")
18764 (set_attr "btver2_decode" "vector")
18765 (set_attr "mode" "<sseinsnmode>")])
18767 (define_expand "maskload<mode><sseintvecmodelower>"
18768 [(set (match_operand:V48_AVX2 0 "register_operand")
18770 [(match_operand:<sseintvecmode> 2 "register_operand")
18771 (match_operand:V48_AVX2 1 "memory_operand")]
18775 (define_expand "maskload<mode><avx512fmaskmodelower>"
18776 [(set (match_operand:V48_AVX512VL 0 "register_operand")
18777 (vec_merge:V48_AVX512VL
18778 (match_operand:V48_AVX512VL 1 "memory_operand")
18780 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18783 (define_expand "maskload<mode><avx512fmaskmodelower>"
18784 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
18785 (vec_merge:VI12_AVX512VL
18786 (match_operand:VI12_AVX512VL 1 "memory_operand")
18788 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18791 (define_expand "maskstore<mode><sseintvecmodelower>"
18792 [(set (match_operand:V48_AVX2 0 "memory_operand")
18794 [(match_operand:<sseintvecmode> 2 "register_operand")
18795 (match_operand:V48_AVX2 1 "register_operand")
18800 (define_expand "maskstore<mode><avx512fmaskmodelower>"
18801 [(set (match_operand:V48_AVX512VL 0 "memory_operand")
18802 (vec_merge:V48_AVX512VL
18803 (match_operand:V48_AVX512VL 1 "register_operand")
18805 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18808 (define_expand "maskstore<mode><avx512fmaskmodelower>"
18809 [(set (match_operand:VI12_AVX512VL 0 "memory_operand")
18810 (vec_merge:VI12_AVX512VL
18811 (match_operand:VI12_AVX512VL 1 "register_operand")
18813 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18816 (define_expand "cbranch<mode>4"
18817 [(set (reg:CC FLAGS_REG)
18818 (compare:CC (match_operand:VI48_AVX 1 "register_operand")
18819 (match_operand:VI48_AVX 2 "nonimmediate_operand")))
18820 (set (pc) (if_then_else
18821 (match_operator 0 "bt_comparison_operator"
18822 [(reg:CC FLAGS_REG) (const_int 0)])
18823 (label_ref (match_operand 3))
18827 ix86_expand_branch (GET_CODE (operands[0]),
18828 operands[1], operands[2], operands[3]);
18833 (define_insn_and_split "avx_<castmode><avxsizesuffix>_<castmode>"
18834 [(set (match_operand:AVX256MODE2P 0 "nonimmediate_operand" "=x,m")
18835 (unspec:AVX256MODE2P
18836 [(match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "xm,x")]
18838 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
18840 "&& reload_completed"
18841 [(set (match_dup 0) (match_dup 1))]
18843 if (REG_P (operands[0]))
18844 operands[0] = gen_lowpart (<ssehalfvecmode>mode, operands[0]);
18846 operands[1] = lowpart_subreg (<MODE>mode, operands[1],
18847 <ssehalfvecmode>mode);
18850 ;; Modes handled by vec_init expanders.
18851 (define_mode_iterator VEC_INIT_MODE
18852 [(V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI
18853 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX") V8HI
18854 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
18855 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI
18856 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
18857 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")
18858 (V4TI "TARGET_AVX512F") (V2TI "TARGET_AVX")])
18860 ;; Likewise, but for initialization from half sized vectors.
18861 ;; Thus, these are all VEC_INIT_MODE modes except V2??.
18862 (define_mode_iterator VEC_INIT_HALF_MODE
18863 [(V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI
18864 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX") V8HI
18865 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
18866 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX")
18867 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
18868 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX")
18869 (V4TI "TARGET_AVX512F")])
18871 (define_expand "vec_init<mode><ssescalarmodelower>"
18872 [(match_operand:VEC_INIT_MODE 0 "register_operand")
18876 ix86_expand_vector_init (false, operands[0], operands[1]);
18880 (define_expand "vec_init<mode><ssehalfvecmodelower>"
18881 [(match_operand:VEC_INIT_HALF_MODE 0 "register_operand")
18885 ix86_expand_vector_init (false, operands[0], operands[1]);
18889 (define_insn "<avx2_avx512>_ashrv<mode><mask_name>"
18890 [(set (match_operand:VI48_AVX512F_AVX512VL 0 "register_operand" "=v")
18891 (ashiftrt:VI48_AVX512F_AVX512VL
18892 (match_operand:VI48_AVX512F_AVX512VL 1 "register_operand" "v")
18893 (match_operand:VI48_AVX512F_AVX512VL 2 "nonimmediate_operand" "vm")))]
18894 "TARGET_AVX2 && <mask_mode512bit_condition>"
18895 "vpsrav<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18896 [(set_attr "type" "sseishft")
18897 (set_attr "prefix" "maybe_evex")
18898 (set_attr "mode" "<sseinsnmode>")])
18900 (define_insn "<avx2_avx512>_ashrv<mode><mask_name>"
18901 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
18902 (ashiftrt:VI2_AVX512VL
18903 (match_operand:VI2_AVX512VL 1 "register_operand" "v")
18904 (match_operand:VI2_AVX512VL 2 "nonimmediate_operand" "vm")))]
18906 "vpsravw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18907 [(set_attr "type" "sseishft")
18908 (set_attr "prefix" "maybe_evex")
18909 (set_attr "mode" "<sseinsnmode>")])
18911 (define_insn "<avx2_avx512>_<shift_insn>v<mode><mask_name>"
18912 [(set (match_operand:VI48_AVX512F 0 "register_operand" "=v")
18913 (any_lshift:VI48_AVX512F
18914 (match_operand:VI48_AVX512F 1 "register_operand" "v")
18915 (match_operand:VI48_AVX512F 2 "nonimmediate_operand" "vm")))]
18916 "TARGET_AVX2 && <mask_mode512bit_condition>"
18917 "vp<vshift>v<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18918 [(set_attr "type" "sseishft")
18919 (set_attr "prefix" "maybe_evex")
18920 (set_attr "mode" "<sseinsnmode>")])
18922 (define_insn "<avx2_avx512>_<shift_insn>v<mode><mask_name>"
18923 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
18924 (any_lshift:VI2_AVX512VL
18925 (match_operand:VI2_AVX512VL 1 "register_operand" "v")
18926 (match_operand:VI2_AVX512VL 2 "nonimmediate_operand" "vm")))]
18928 "vp<vshift>v<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18929 [(set_attr "type" "sseishft")
18930 (set_attr "prefix" "maybe_evex")
18931 (set_attr "mode" "<sseinsnmode>")])
18933 (define_insn "avx_vec_concat<mode>"
18934 [(set (match_operand:V_256_512 0 "register_operand" "=x,v,x,Yv")
18935 (vec_concat:V_256_512
18936 (match_operand:<ssehalfvecmode> 1 "register_operand" "x,v,x,v")
18937 (match_operand:<ssehalfvecmode> 2 "vector_move_operand" "xm,vm,C,C")))]
18940 switch (which_alternative)
18943 return "vinsert<i128>\t{$0x1, %2, %<concat_tg_mode>1, %0|%0, %<concat_tg_mode>1, %2, 0x1}";
18945 if (<MODE_SIZE> == 64)
18947 if (TARGET_AVX512DQ && GET_MODE_SIZE (<ssescalarmode>mode) == 4)
18948 return "vinsert<shuffletype>32x8\t{$0x1, %2, %<concat_tg_mode>1, %0|%0, %<concat_tg_mode>1, %2, 0x1}";
18950 return "vinsert<shuffletype>64x4\t{$0x1, %2, %<concat_tg_mode>1, %0|%0, %<concat_tg_mode>1, %2, 0x1}";
18954 if (TARGET_AVX512DQ && GET_MODE_SIZE (<ssescalarmode>mode) == 8)
18955 return "vinsert<shuffletype>64x2\t{$0x1, %2, %<concat_tg_mode>1, %0|%0, %<concat_tg_mode>1, %2, 0x1}";
18957 return "vinsert<shuffletype>32x4\t{$0x1, %2, %<concat_tg_mode>1, %0|%0, %<concat_tg_mode>1, %2, 0x1}";
18961 switch (get_attr_mode (insn))
18964 return "vmovaps\t{%1, %t0|%t0, %1}";
18966 return "vmovapd\t{%1, %t0|%t0, %1}";
18968 return "vmovaps\t{%1, %x0|%x0, %1}";
18970 return "vmovapd\t{%1, %x0|%x0, %1}";
18972 if (which_alternative == 2)
18973 return "vmovdqa\t{%1, %t0|%t0, %1}";
18974 else if (GET_MODE_SIZE (<ssescalarmode>mode) == 8)
18975 return "vmovdqa64\t{%1, %t0|%t0, %1}";
18977 return "vmovdqa32\t{%1, %t0|%t0, %1}";
18979 if (which_alternative == 2)
18980 return "vmovdqa\t{%1, %x0|%x0, %1}";
18981 else if (GET_MODE_SIZE (<ssescalarmode>mode) == 8)
18982 return "vmovdqa64\t{%1, %x0|%x0, %1}";
18984 return "vmovdqa32\t{%1, %x0|%x0, %1}";
18986 gcc_unreachable ();
18989 gcc_unreachable ();
18992 [(set_attr "type" "sselog,sselog,ssemov,ssemov")
18993 (set_attr "prefix_extra" "1,1,*,*")
18994 (set_attr "length_immediate" "1,1,*,*")
18995 (set_attr "prefix" "maybe_evex")
18996 (set_attr "mode" "<sseinsnmode>")])
18998 (define_insn "vcvtph2ps<mask_name>"
18999 [(set (match_operand:V4SF 0 "register_operand" "=v")
19001 (unspec:V8SF [(match_operand:V8HI 1 "register_operand" "v")]
19003 (parallel [(const_int 0) (const_int 1)
19004 (const_int 2) (const_int 3)])))]
19005 "TARGET_F16C || TARGET_AVX512VL"
19006 "vcvtph2ps\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
19007 [(set_attr "type" "ssecvt")
19008 (set_attr "prefix" "maybe_evex")
19009 (set_attr "mode" "V4SF")])
19011 (define_insn "*vcvtph2ps_load<mask_name>"
19012 [(set (match_operand:V4SF 0 "register_operand" "=v")
19013 (unspec:V4SF [(match_operand:V4HI 1 "memory_operand" "m")]
19014 UNSPEC_VCVTPH2PS))]
19015 "TARGET_F16C || TARGET_AVX512VL"
19016 "vcvtph2ps\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
19017 [(set_attr "type" "ssecvt")
19018 (set_attr "prefix" "vex")
19019 (set_attr "mode" "V8SF")])
19021 (define_insn "vcvtph2ps256<mask_name>"
19022 [(set (match_operand:V8SF 0 "register_operand" "=v")
19023 (unspec:V8SF [(match_operand:V8HI 1 "nonimmediate_operand" "vm")]
19024 UNSPEC_VCVTPH2PS))]
19025 "TARGET_F16C || TARGET_AVX512VL"
19026 "vcvtph2ps\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
19027 [(set_attr "type" "ssecvt")
19028 (set_attr "prefix" "vex")
19029 (set_attr "btver2_decode" "double")
19030 (set_attr "mode" "V8SF")])
19032 (define_insn "<mask_codefor>avx512f_vcvtph2ps512<mask_name><round_saeonly_name>"
19033 [(set (match_operand:V16SF 0 "register_operand" "=v")
19035 [(match_operand:V16HI 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
19036 UNSPEC_VCVTPH2PS))]
19038 "vcvtph2ps\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
19039 [(set_attr "type" "ssecvt")
19040 (set_attr "prefix" "evex")
19041 (set_attr "mode" "V16SF")])
19043 (define_expand "vcvtps2ph_mask"
19044 [(set (match_operand:V8HI 0 "register_operand")
19047 (unspec:V4HI [(match_operand:V4SF 1 "register_operand")
19048 (match_operand:SI 2 "const_0_to_255_operand")]
19051 (match_operand:V8HI 3 "vector_move_operand")
19052 (match_operand:QI 4 "register_operand")))]
19054 "operands[5] = CONST0_RTX (V4HImode);")
19056 (define_expand "vcvtps2ph"
19057 [(set (match_operand:V8HI 0 "register_operand")
19059 (unspec:V4HI [(match_operand:V4SF 1 "register_operand")
19060 (match_operand:SI 2 "const_0_to_255_operand")]
19064 "operands[3] = CONST0_RTX (V4HImode);")
19066 (define_insn "*vcvtps2ph<mask_name>"
19067 [(set (match_operand:V8HI 0 "register_operand" "=v")
19069 (unspec:V4HI [(match_operand:V4SF 1 "register_operand" "v")
19070 (match_operand:SI 2 "const_0_to_255_operand" "N")]
19072 (match_operand:V4HI 3 "const0_operand")))]
19073 "(TARGET_F16C || TARGET_AVX512VL) && <mask_avx512vl_condition>"
19074 "vcvtps2ph\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}"
19075 [(set_attr "type" "ssecvt")
19076 (set_attr "prefix" "maybe_evex")
19077 (set_attr "mode" "V4SF")])
19079 (define_insn "*vcvtps2ph_store<mask_name>"
19080 [(set (match_operand:V4HI 0 "memory_operand" "=m")
19081 (unspec:V4HI [(match_operand:V4SF 1 "register_operand" "v")
19082 (match_operand:SI 2 "const_0_to_255_operand" "N")]
19083 UNSPEC_VCVTPS2PH))]
19084 "TARGET_F16C || TARGET_AVX512VL"
19085 "vcvtps2ph\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
19086 [(set_attr "type" "ssecvt")
19087 (set_attr "prefix" "maybe_evex")
19088 (set_attr "mode" "V4SF")])
19090 (define_insn "vcvtps2ph256<mask_name>"
19091 [(set (match_operand:V8HI 0 "nonimmediate_operand" "=vm")
19092 (unspec:V8HI [(match_operand:V8SF 1 "register_operand" "v")
19093 (match_operand:SI 2 "const_0_to_255_operand" "N")]
19094 UNSPEC_VCVTPS2PH))]
19095 "TARGET_F16C || TARGET_AVX512VL"
19096 "vcvtps2ph\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
19097 [(set_attr "type" "ssecvt")
19098 (set_attr "prefix" "maybe_evex")
19099 (set_attr "btver2_decode" "vector")
19100 (set_attr "mode" "V8SF")])
19102 (define_insn "<mask_codefor>avx512f_vcvtps2ph512<mask_name>"
19103 [(set (match_operand:V16HI 0 "nonimmediate_operand" "=vm")
19105 [(match_operand:V16SF 1 "register_operand" "v")
19106 (match_operand:SI 2 "const_0_to_255_operand" "N")]
19107 UNSPEC_VCVTPS2PH))]
19109 "vcvtps2ph\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
19110 [(set_attr "type" "ssecvt")
19111 (set_attr "prefix" "evex")
19112 (set_attr "mode" "V16SF")])
19114 ;; For gather* insn patterns
19115 (define_mode_iterator VEC_GATHER_MODE
19116 [V2DI V2DF V4DI V4DF V4SI V4SF V8SI V8SF])
19117 (define_mode_attr VEC_GATHER_IDXSI
19118 [(V2DI "V4SI") (V4DI "V4SI") (V8DI "V8SI")
19119 (V2DF "V4SI") (V4DF "V4SI") (V8DF "V8SI")
19120 (V4SI "V4SI") (V8SI "V8SI") (V16SI "V16SI")
19121 (V4SF "V4SI") (V8SF "V8SI") (V16SF "V16SI")])
19123 (define_mode_attr VEC_GATHER_IDXDI
19124 [(V2DI "V2DI") (V4DI "V4DI") (V8DI "V8DI")
19125 (V2DF "V2DI") (V4DF "V4DI") (V8DF "V8DI")
19126 (V4SI "V2DI") (V8SI "V4DI") (V16SI "V8DI")
19127 (V4SF "V2DI") (V8SF "V4DI") (V16SF "V8DI")])
19129 (define_mode_attr VEC_GATHER_SRCDI
19130 [(V2DI "V2DI") (V4DI "V4DI") (V8DI "V8DI")
19131 (V2DF "V2DF") (V4DF "V4DF") (V8DF "V8DF")
19132 (V4SI "V4SI") (V8SI "V4SI") (V16SI "V8SI")
19133 (V4SF "V4SF") (V8SF "V4SF") (V16SF "V8SF")])
19135 (define_expand "avx2_gathersi<mode>"
19136 [(parallel [(set (match_operand:VEC_GATHER_MODE 0 "register_operand")
19137 (unspec:VEC_GATHER_MODE
19138 [(match_operand:VEC_GATHER_MODE 1 "register_operand")
19139 (mem:<ssescalarmode>
19141 [(match_operand 2 "vsib_address_operand")
19142 (match_operand:<VEC_GATHER_IDXSI>
19143 3 "register_operand")
19144 (match_operand:SI 5 "const1248_operand ")]))
19145 (mem:BLK (scratch))
19146 (match_operand:VEC_GATHER_MODE 4 "register_operand")]
19148 (clobber (match_scratch:VEC_GATHER_MODE 7))])]
19152 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
19153 operands[5]), UNSPEC_VSIBADDR);
19156 (define_insn "*avx2_gathersi<mode>"
19157 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
19158 (unspec:VEC_GATHER_MODE
19159 [(match_operand:VEC_GATHER_MODE 2 "register_operand" "0")
19160 (match_operator:<ssescalarmode> 7 "vsib_mem_operator"
19162 [(match_operand:P 3 "vsib_address_operand" "Tv")
19163 (match_operand:<VEC_GATHER_IDXSI> 4 "register_operand" "x")
19164 (match_operand:SI 6 "const1248_operand" "n")]
19166 (mem:BLK (scratch))
19167 (match_operand:VEC_GATHER_MODE 5 "register_operand" "1")]
19169 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
19171 "v<sseintprefix>gatherd<ssemodesuffix>\t{%1, %7, %0|%0, %7, %1}"
19172 [(set_attr "type" "ssemov")
19173 (set_attr "prefix" "vex")
19174 (set_attr "mode" "<sseinsnmode>")])
19176 (define_insn "*avx2_gathersi<mode>_2"
19177 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
19178 (unspec:VEC_GATHER_MODE
19180 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
19182 [(match_operand:P 2 "vsib_address_operand" "Tv")
19183 (match_operand:<VEC_GATHER_IDXSI> 3 "register_operand" "x")
19184 (match_operand:SI 5 "const1248_operand" "n")]
19186 (mem:BLK (scratch))
19187 (match_operand:VEC_GATHER_MODE 4 "register_operand" "1")]
19189 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
19191 "v<sseintprefix>gatherd<ssemodesuffix>\t{%1, %6, %0|%0, %6, %1}"
19192 [(set_attr "type" "ssemov")
19193 (set_attr "prefix" "vex")
19194 (set_attr "mode" "<sseinsnmode>")])
19196 (define_expand "avx2_gatherdi<mode>"
19197 [(parallel [(set (match_operand:VEC_GATHER_MODE 0 "register_operand")
19198 (unspec:VEC_GATHER_MODE
19199 [(match_operand:<VEC_GATHER_SRCDI> 1 "register_operand")
19200 (mem:<ssescalarmode>
19202 [(match_operand 2 "vsib_address_operand")
19203 (match_operand:<VEC_GATHER_IDXDI>
19204 3 "register_operand")
19205 (match_operand:SI 5 "const1248_operand ")]))
19206 (mem:BLK (scratch))
19207 (match_operand:<VEC_GATHER_SRCDI> 4 "register_operand")]
19209 (clobber (match_scratch:VEC_GATHER_MODE 7))])]
19213 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
19214 operands[5]), UNSPEC_VSIBADDR);
19217 (define_insn "*avx2_gatherdi<mode>"
19218 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
19219 (unspec:VEC_GATHER_MODE
19220 [(match_operand:<VEC_GATHER_SRCDI> 2 "register_operand" "0")
19221 (match_operator:<ssescalarmode> 7 "vsib_mem_operator"
19223 [(match_operand:P 3 "vsib_address_operand" "Tv")
19224 (match_operand:<VEC_GATHER_IDXDI> 4 "register_operand" "x")
19225 (match_operand:SI 6 "const1248_operand" "n")]
19227 (mem:BLK (scratch))
19228 (match_operand:<VEC_GATHER_SRCDI> 5 "register_operand" "1")]
19230 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
19232 "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %7, %2|%2, %7, %5}"
19233 [(set_attr "type" "ssemov")
19234 (set_attr "prefix" "vex")
19235 (set_attr "mode" "<sseinsnmode>")])
19237 (define_insn "*avx2_gatherdi<mode>_2"
19238 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
19239 (unspec:VEC_GATHER_MODE
19241 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
19243 [(match_operand:P 2 "vsib_address_operand" "Tv")
19244 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand" "x")
19245 (match_operand:SI 5 "const1248_operand" "n")]
19247 (mem:BLK (scratch))
19248 (match_operand:<VEC_GATHER_SRCDI> 4 "register_operand" "1")]
19250 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
19253 if (<MODE>mode != <VEC_GATHER_SRCDI>mode)
19254 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%4, %6, %x0|%x0, %6, %4}";
19255 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%4, %6, %0|%0, %6, %4}";
19257 [(set_attr "type" "ssemov")
19258 (set_attr "prefix" "vex")
19259 (set_attr "mode" "<sseinsnmode>")])
19261 (define_insn "*avx2_gatherdi<mode>_3"
19262 [(set (match_operand:<VEC_GATHER_SRCDI> 0 "register_operand" "=&x")
19263 (vec_select:<VEC_GATHER_SRCDI>
19265 [(match_operand:<VEC_GATHER_SRCDI> 2 "register_operand" "0")
19266 (match_operator:<ssescalarmode> 7 "vsib_mem_operator"
19268 [(match_operand:P 3 "vsib_address_operand" "Tv")
19269 (match_operand:<VEC_GATHER_IDXDI> 4 "register_operand" "x")
19270 (match_operand:SI 6 "const1248_operand" "n")]
19272 (mem:BLK (scratch))
19273 (match_operand:<VEC_GATHER_SRCDI> 5 "register_operand" "1")]
19275 (parallel [(const_int 0) (const_int 1)
19276 (const_int 2) (const_int 3)])))
19277 (clobber (match_scratch:VI4F_256 1 "=&x"))]
19279 "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %7, %0|%0, %7, %5}"
19280 [(set_attr "type" "ssemov")
19281 (set_attr "prefix" "vex")
19282 (set_attr "mode" "<sseinsnmode>")])
19284 (define_insn "*avx2_gatherdi<mode>_4"
19285 [(set (match_operand:<VEC_GATHER_SRCDI> 0 "register_operand" "=&x")
19286 (vec_select:<VEC_GATHER_SRCDI>
19289 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
19291 [(match_operand:P 2 "vsib_address_operand" "Tv")
19292 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand" "x")
19293 (match_operand:SI 5 "const1248_operand" "n")]
19295 (mem:BLK (scratch))
19296 (match_operand:<VEC_GATHER_SRCDI> 4 "register_operand" "1")]
19298 (parallel [(const_int 0) (const_int 1)
19299 (const_int 2) (const_int 3)])))
19300 (clobber (match_scratch:VI4F_256 1 "=&x"))]
19302 "v<sseintprefix>gatherq<ssemodesuffix>\t{%4, %6, %0|%0, %6, %4}"
19303 [(set_attr "type" "ssemov")
19304 (set_attr "prefix" "vex")
19305 (set_attr "mode" "<sseinsnmode>")])
19307 ;; Memory operand override for -masm=intel of the v*gatherq* patterns.
19308 (define_mode_attr gatherq_mode
19309 [(V4SI "q") (V2DI "x") (V4SF "q") (V2DF "x")
19310 (V8SI "x") (V4DI "t") (V8SF "x") (V4DF "t")
19311 (V16SI "t") (V8DI "g") (V16SF "t") (V8DF "g")])
19313 (define_expand "<avx512>_gathersi<mode>"
19314 [(parallel [(set (match_operand:VI48F 0 "register_operand")
19316 [(match_operand:VI48F 1 "register_operand")
19317 (match_operand:<avx512fmaskmode> 4 "register_operand")
19318 (mem:<ssescalarmode>
19320 [(match_operand 2 "vsib_address_operand")
19321 (match_operand:<VEC_GATHER_IDXSI> 3 "register_operand")
19322 (match_operand:SI 5 "const1248_operand")]))]
19324 (clobber (match_scratch:<avx512fmaskmode> 7))])]
19328 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
19329 operands[5]), UNSPEC_VSIBADDR);
19332 (define_insn "*avx512f_gathersi<mode>"
19333 [(set (match_operand:VI48F 0 "register_operand" "=&v")
19335 [(match_operand:VI48F 1 "register_operand" "0")
19336 (match_operand:<avx512fmaskmode> 7 "register_operand" "2")
19337 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
19339 [(match_operand:P 4 "vsib_address_operand" "Tv")
19340 (match_operand:<VEC_GATHER_IDXSI> 3 "register_operand" "v")
19341 (match_operand:SI 5 "const1248_operand" "n")]
19342 UNSPEC_VSIBADDR)])]
19344 (clobber (match_scratch:<avx512fmaskmode> 2 "=&Yk"))]
19346 "v<sseintprefix>gatherd<ssemodesuffix>\t{%6, %0%{%2%}|%0%{%2%}, %<xtg_mode>6}"
19347 [(set_attr "type" "ssemov")
19348 (set_attr "prefix" "evex")
19349 (set_attr "mode" "<sseinsnmode>")])
19351 (define_insn "*avx512f_gathersi<mode>_2"
19352 [(set (match_operand:VI48F 0 "register_operand" "=&v")
19355 (match_operand:<avx512fmaskmode> 6 "register_operand" "1")
19356 (match_operator:<ssescalarmode> 5 "vsib_mem_operator"
19358 [(match_operand:P 3 "vsib_address_operand" "Tv")
19359 (match_operand:<VEC_GATHER_IDXSI> 2 "register_operand" "v")
19360 (match_operand:SI 4 "const1248_operand" "n")]
19361 UNSPEC_VSIBADDR)])]
19363 (clobber (match_scratch:<avx512fmaskmode> 1 "=&Yk"))]
19365 "v<sseintprefix>gatherd<ssemodesuffix>\t{%5, %0%{%1%}|%0%{%1%}, %<xtg_mode>5}"
19366 [(set_attr "type" "ssemov")
19367 (set_attr "prefix" "evex")
19368 (set_attr "mode" "<sseinsnmode>")])
19371 (define_expand "<avx512>_gatherdi<mode>"
19372 [(parallel [(set (match_operand:VI48F 0 "register_operand")
19374 [(match_operand:<VEC_GATHER_SRCDI> 1 "register_operand")
19375 (match_operand:QI 4 "register_operand")
19376 (mem:<ssescalarmode>
19378 [(match_operand 2 "vsib_address_operand")
19379 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand")
19380 (match_operand:SI 5 "const1248_operand")]))]
19382 (clobber (match_scratch:QI 7))])]
19386 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
19387 operands[5]), UNSPEC_VSIBADDR);
19390 (define_insn "*avx512f_gatherdi<mode>"
19391 [(set (match_operand:VI48F 0 "register_operand" "=&v")
19393 [(match_operand:<VEC_GATHER_SRCDI> 1 "register_operand" "0")
19394 (match_operand:QI 7 "register_operand" "2")
19395 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
19397 [(match_operand:P 4 "vsib_address_operand" "Tv")
19398 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand" "v")
19399 (match_operand:SI 5 "const1248_operand" "n")]
19400 UNSPEC_VSIBADDR)])]
19402 (clobber (match_scratch:QI 2 "=&Yk"))]
19405 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%6, %1%{%2%}|%1%{%2%}, %<gatherq_mode>6}";
19407 [(set_attr "type" "ssemov")
19408 (set_attr "prefix" "evex")
19409 (set_attr "mode" "<sseinsnmode>")])
19411 (define_insn "*avx512f_gatherdi<mode>_2"
19412 [(set (match_operand:VI48F 0 "register_operand" "=&v")
19415 (match_operand:QI 6 "register_operand" "1")
19416 (match_operator:<ssescalarmode> 5 "vsib_mem_operator"
19418 [(match_operand:P 3 "vsib_address_operand" "Tv")
19419 (match_operand:<VEC_GATHER_IDXDI> 2 "register_operand" "v")
19420 (match_operand:SI 4 "const1248_operand" "n")]
19421 UNSPEC_VSIBADDR)])]
19423 (clobber (match_scratch:QI 1 "=&Yk"))]
19426 if (<MODE>mode != <VEC_GATHER_SRCDI>mode)
19428 if (<MODE_SIZE> != 64)
19429 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %x0%{%1%}|%x0%{%1%}, %<gatherq_mode>5}";
19431 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %t0%{%1%}|%t0%{%1%}, %t5}";
19433 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %0%{%1%}|%0%{%1%}, %<gatherq_mode>5}";
19435 [(set_attr "type" "ssemov")
19436 (set_attr "prefix" "evex")
19437 (set_attr "mode" "<sseinsnmode>")])
19439 (define_expand "<avx512>_scattersi<mode>"
19440 [(parallel [(set (mem:VI48F
19442 [(match_operand 0 "vsib_address_operand")
19443 (match_operand:<VEC_GATHER_IDXSI> 2 "register_operand")
19444 (match_operand:SI 4 "const1248_operand")]))
19446 [(match_operand:<avx512fmaskmode> 1 "register_operand")
19447 (match_operand:VI48F 3 "register_operand")]
19449 (clobber (match_scratch:<avx512fmaskmode> 6))])]
19453 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[0], operands[2],
19454 operands[4]), UNSPEC_VSIBADDR);
19457 (define_insn "*avx512f_scattersi<mode>"
19458 [(set (match_operator:VI48F 5 "vsib_mem_operator"
19460 [(match_operand:P 0 "vsib_address_operand" "Tv")
19461 (match_operand:<VEC_GATHER_IDXSI> 2 "register_operand" "v")
19462 (match_operand:SI 4 "const1248_operand" "n")]
19465 [(match_operand:<avx512fmaskmode> 6 "register_operand" "1")
19466 (match_operand:VI48F 3 "register_operand" "v")]
19468 (clobber (match_scratch:<avx512fmaskmode> 1 "=&Yk"))]
19470 "v<sseintprefix>scatterd<ssemodesuffix>\t{%3, %5%{%1%}|%5%{%1%}, %3}"
19471 [(set_attr "type" "ssemov")
19472 (set_attr "prefix" "evex")
19473 (set_attr "mode" "<sseinsnmode>")])
19475 (define_expand "<avx512>_scatterdi<mode>"
19476 [(parallel [(set (mem:VI48F
19478 [(match_operand 0 "vsib_address_operand")
19479 (match_operand:<VEC_GATHER_IDXDI> 2 "register_operand")
19480 (match_operand:SI 4 "const1248_operand")]))
19482 [(match_operand:QI 1 "register_operand")
19483 (match_operand:<VEC_GATHER_SRCDI> 3 "register_operand")]
19485 (clobber (match_scratch:QI 6))])]
19489 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[0], operands[2],
19490 operands[4]), UNSPEC_VSIBADDR);
19493 (define_insn "*avx512f_scatterdi<mode>"
19494 [(set (match_operator:VI48F 5 "vsib_mem_operator"
19496 [(match_operand:P 0 "vsib_address_operand" "Tv")
19497 (match_operand:<VEC_GATHER_IDXDI> 2 "register_operand" "v")
19498 (match_operand:SI 4 "const1248_operand" "n")]
19501 [(match_operand:QI 6 "register_operand" "1")
19502 (match_operand:<VEC_GATHER_SRCDI> 3 "register_operand" "v")]
19504 (clobber (match_scratch:QI 1 "=&Yk"))]
19507 if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 8)
19508 return "v<sseintprefix>scatterq<ssemodesuffix>\t{%3, %5%{%1%}|%5%{%1%}, %3}";
19509 return "v<sseintprefix>scatterq<ssemodesuffix>\t{%3, %5%{%1%}|%t5%{%1%}, %3}";
19511 [(set_attr "type" "ssemov")
19512 (set_attr "prefix" "evex")
19513 (set_attr "mode" "<sseinsnmode>")])
19515 (define_insn "<avx512>_compress<mode>_mask"
19516 [(set (match_operand:VI48F 0 "register_operand" "=v")
19518 [(match_operand:VI48F 1 "register_operand" "v")
19519 (match_operand:VI48F 2 "vector_move_operand" "0C")
19520 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")]
19523 "v<sseintprefix>compress<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
19524 [(set_attr "type" "ssemov")
19525 (set_attr "prefix" "evex")
19526 (set_attr "mode" "<sseinsnmode>")])
19528 (define_insn "compress<mode>_mask"
19529 [(set (match_operand:VI12_AVX512VLBW 0 "register_operand" "=v")
19530 (unspec:VI12_AVX512VLBW
19531 [(match_operand:VI12_AVX512VLBW 1 "register_operand" "v")
19532 (match_operand:VI12_AVX512VLBW 2 "vector_move_operand" "0C")
19533 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")]
19535 "TARGET_AVX512VBMI2"
19536 "vpcompress<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
19537 [(set_attr "type" "ssemov")
19538 (set_attr "prefix" "evex")
19539 (set_attr "mode" "<sseinsnmode>")])
19541 (define_insn "<avx512>_compressstore<mode>_mask"
19542 [(set (match_operand:VI48F 0 "memory_operand" "=m")
19544 [(match_operand:VI48F 1 "register_operand" "x")
19546 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")]
19547 UNSPEC_COMPRESS_STORE))]
19549 "v<sseintprefix>compress<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}"
19550 [(set_attr "type" "ssemov")
19551 (set_attr "prefix" "evex")
19552 (set_attr "memory" "store")
19553 (set_attr "mode" "<sseinsnmode>")])
19555 (define_insn "compressstore<mode>_mask"
19556 [(set (match_operand:VI12_AVX512VLBW 0 "memory_operand" "=m")
19557 (unspec:VI12_AVX512VLBW
19558 [(match_operand:VI12_AVX512VLBW 1 "register_operand" "x")
19560 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")]
19561 UNSPEC_COMPRESS_STORE))]
19562 "TARGET_AVX512VBMI2"
19563 "vpcompress<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}"
19564 [(set_attr "type" "ssemov")
19565 (set_attr "prefix" "evex")
19566 (set_attr "memory" "store")
19567 (set_attr "mode" "<sseinsnmode>")])
19569 (define_expand "<avx512>_expand<mode>_maskz"
19570 [(set (match_operand:VI48F 0 "register_operand")
19572 [(match_operand:VI48F 1 "nonimmediate_operand")
19573 (match_operand:VI48F 2 "vector_move_operand")
19574 (match_operand:<avx512fmaskmode> 3 "register_operand")]
19577 "operands[2] = CONST0_RTX (<MODE>mode);")
19579 (define_insn "<avx512>_expand<mode>_mask"
19580 [(set (match_operand:VI48F 0 "register_operand" "=v,v")
19582 [(match_operand:VI48F 1 "nonimmediate_operand" "v,m")
19583 (match_operand:VI48F 2 "vector_move_operand" "0C,0C")
19584 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")]
19587 "v<sseintprefix>expand<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
19588 [(set_attr "type" "ssemov")
19589 (set_attr "prefix" "evex")
19590 (set_attr "memory" "none,load")
19591 (set_attr "mode" "<sseinsnmode>")])
19593 (define_insn "expand<mode>_mask"
19594 [(set (match_operand:VI12_AVX512VLBW 0 "register_operand" "=v,v")
19595 (unspec:VI12_AVX512VLBW
19596 [(match_operand:VI12_AVX512VLBW 1 "nonimmediate_operand" "v,m")
19597 (match_operand:VI12_AVX512VLBW 2 "vector_move_operand" "0C,0C")
19598 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")]
19600 "TARGET_AVX512VBMI2"
19601 "v<sseintprefix>expand<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
19602 [(set_attr "type" "ssemov")
19603 (set_attr "prefix" "evex")
19604 (set_attr "memory" "none,load")
19605 (set_attr "mode" "<sseinsnmode>")])
19607 (define_expand "expand<mode>_maskz"
19608 [(set (match_operand:VI12_AVX512VLBW 0 "register_operand")
19609 (unspec:VI12_AVX512VLBW
19610 [(match_operand:VI12_AVX512VLBW 1 "nonimmediate_operand")
19611 (match_operand:VI12_AVX512VLBW 2 "vector_move_operand")
19612 (match_operand:<avx512fmaskmode> 3 "register_operand")]
19614 "TARGET_AVX512VBMI2"
19615 "operands[2] = CONST0_RTX (<MODE>mode);")
19617 (define_insn "avx512dq_rangep<mode><mask_name><round_saeonly_name>"
19618 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
19619 (unspec:VF_AVX512VL
19620 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
19621 (match_operand:VF_AVX512VL 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
19622 (match_operand:SI 3 "const_0_to_15_operand")]
19624 "TARGET_AVX512DQ && <round_saeonly_mode512bit_condition>"
19625 "vrange<ssemodesuffix>\t{%3, <round_saeonly_mask_op4>%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2<round_saeonly_mask_op4>, %3}"
19626 [(set_attr "type" "sse")
19627 (set_attr "prefix" "evex")
19628 (set_attr "mode" "<MODE>")])
19630 (define_insn "avx512dq_ranges<mode><mask_scalar_name><round_saeonly_scalar_name>"
19631 [(set (match_operand:VF_128 0 "register_operand" "=v")
19634 [(match_operand:VF_128 1 "register_operand" "v")
19635 (match_operand:VF_128 2 "<round_saeonly_scalar_nimm_predicate>" "<round_saeonly_scalar_constraint>")
19636 (match_operand:SI 3 "const_0_to_15_operand")]
19641 "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}"
19642 [(set_attr "type" "sse")
19643 (set_attr "prefix" "evex")
19644 (set_attr "mode" "<MODE>")])
19646 (define_insn "avx512dq_fpclass<mode><mask_scalar_merge_name>"
19647 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
19648 (unspec:<avx512fmaskmode>
19649 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
19650 (match_operand:QI 2 "const_0_to_255_operand" "n")]
19653 "vfpclass<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}";
19654 [(set_attr "type" "sse")
19655 (set_attr "length_immediate" "1")
19656 (set_attr "prefix" "evex")
19657 (set_attr "mode" "<MODE>")])
19659 (define_insn "avx512dq_vmfpclass<mode>"
19660 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
19661 (and:<avx512fmaskmode>
19662 (unspec:<avx512fmaskmode>
19663 [(match_operand:VF_128 1 "register_operand" "v")
19664 (match_operand:QI 2 "const_0_to_255_operand" "n")]
19668 "vfpclass<ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %2}";
19669 [(set_attr "type" "sse")
19670 (set_attr "length_immediate" "1")
19671 (set_attr "prefix" "evex")
19672 (set_attr "mode" "<MODE>")])
19674 (define_insn "<avx512>_getmant<mode><mask_name><round_saeonly_name>"
19675 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
19676 (unspec:VF_AVX512VL
19677 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "<round_saeonly_constraint>")
19678 (match_operand:SI 2 "const_0_to_15_operand")]
19681 "vgetmant<ssemodesuffix>\t{%2, <round_saeonly_mask_op3>%1, %0<mask_operand3>|%0<mask_operand3>, %1<round_saeonly_mask_op3>, %2}";
19682 [(set_attr "prefix" "evex")
19683 (set_attr "mode" "<MODE>")])
19685 (define_insn "avx512f_vgetmant<mode><mask_scalar_name><round_saeonly_scalar_name>"
19686 [(set (match_operand:VF_128 0 "register_operand" "=v")
19689 [(match_operand:VF_128 1 "register_operand" "v")
19690 (match_operand:VF_128 2 "<round_saeonly_scalar_nimm_predicate>" "<round_saeonly_scalar_constraint>")
19691 (match_operand:SI 3 "const_0_to_15_operand")]
19696 "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}";
19697 [(set_attr "prefix" "evex")
19698 (set_attr "mode" "<ssescalarmode>")])
19700 ;; The correct representation for this is absolutely enormous, and
19701 ;; surely not generally useful.
19702 (define_insn "<mask_codefor>avx512bw_dbpsadbw<mode><mask_name>"
19703 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
19704 (unspec:VI2_AVX512VL
19705 [(match_operand:<dbpsadbwmode> 1 "register_operand" "v")
19706 (match_operand:<dbpsadbwmode> 2 "nonimmediate_operand" "vm")
19707 (match_operand:SI 3 "const_0_to_255_operand")]
19710 "vdbpsadbw\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3}"
19711 [(set_attr "type" "sselog1")
19712 (set_attr "length_immediate" "1")
19713 (set_attr "prefix" "evex")
19714 (set_attr "mode" "<sseinsnmode>")])
19716 (define_insn "clz<mode>2<mask_name>"
19717 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
19719 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm")))]
19721 "vplzcnt<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
19722 [(set_attr "type" "sse")
19723 (set_attr "prefix" "evex")
19724 (set_attr "mode" "<sseinsnmode>")])
19726 (define_insn "<mask_codefor>conflict<mode><mask_name>"
19727 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
19728 (unspec:VI48_AVX512VL
19729 [(match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm")]
19732 "vpconflict<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
19733 [(set_attr "type" "sse")
19734 (set_attr "prefix" "evex")
19735 (set_attr "mode" "<sseinsnmode>")])
19737 (define_insn "sha1msg1"
19738 [(set (match_operand:V4SI 0 "register_operand" "=x")
19740 [(match_operand:V4SI 1 "register_operand" "0")
19741 (match_operand:V4SI 2 "vector_operand" "xBm")]
19744 "sha1msg1\t{%2, %0|%0, %2}"
19745 [(set_attr "type" "sselog1")
19746 (set_attr "mode" "TI")])
19748 (define_insn "sha1msg2"
19749 [(set (match_operand:V4SI 0 "register_operand" "=x")
19751 [(match_operand:V4SI 1 "register_operand" "0")
19752 (match_operand:V4SI 2 "vector_operand" "xBm")]
19755 "sha1msg2\t{%2, %0|%0, %2}"
19756 [(set_attr "type" "sselog1")
19757 (set_attr "mode" "TI")])
19759 (define_insn "sha1nexte"
19760 [(set (match_operand:V4SI 0 "register_operand" "=x")
19762 [(match_operand:V4SI 1 "register_operand" "0")
19763 (match_operand:V4SI 2 "vector_operand" "xBm")]
19764 UNSPEC_SHA1NEXTE))]
19766 "sha1nexte\t{%2, %0|%0, %2}"
19767 [(set_attr "type" "sselog1")
19768 (set_attr "mode" "TI")])
19770 (define_insn "sha1rnds4"
19771 [(set (match_operand:V4SI 0 "register_operand" "=x")
19773 [(match_operand:V4SI 1 "register_operand" "0")
19774 (match_operand:V4SI 2 "vector_operand" "xBm")
19775 (match_operand:SI 3 "const_0_to_3_operand" "n")]
19776 UNSPEC_SHA1RNDS4))]
19778 "sha1rnds4\t{%3, %2, %0|%0, %2, %3}"
19779 [(set_attr "type" "sselog1")
19780 (set_attr "length_immediate" "1")
19781 (set_attr "mode" "TI")])
19783 (define_insn "sha256msg1"
19784 [(set (match_operand:V4SI 0 "register_operand" "=x")
19786 [(match_operand:V4SI 1 "register_operand" "0")
19787 (match_operand:V4SI 2 "vector_operand" "xBm")]
19788 UNSPEC_SHA256MSG1))]
19790 "sha256msg1\t{%2, %0|%0, %2}"
19791 [(set_attr "type" "sselog1")
19792 (set_attr "mode" "TI")])
19794 (define_insn "sha256msg2"
19795 [(set (match_operand:V4SI 0 "register_operand" "=x")
19797 [(match_operand:V4SI 1 "register_operand" "0")
19798 (match_operand:V4SI 2 "vector_operand" "xBm")]
19799 UNSPEC_SHA256MSG2))]
19801 "sha256msg2\t{%2, %0|%0, %2}"
19802 [(set_attr "type" "sselog1")
19803 (set_attr "mode" "TI")])
19805 (define_insn "sha256rnds2"
19806 [(set (match_operand:V4SI 0 "register_operand" "=x")
19808 [(match_operand:V4SI 1 "register_operand" "0")
19809 (match_operand:V4SI 2 "vector_operand" "xBm")
19810 (match_operand:V4SI 3 "register_operand" "Yz")]
19811 UNSPEC_SHA256RNDS2))]
19813 "sha256rnds2\t{%3, %2, %0|%0, %2, %3}"
19814 [(set_attr "type" "sselog1")
19815 (set_attr "length_immediate" "1")
19816 (set_attr "mode" "TI")])
19818 (define_insn_and_split "avx512f_<castmode><avxsizesuffix>_<castmode>"
19819 [(set (match_operand:AVX512MODE2P 0 "nonimmediate_operand" "=x,m")
19820 (unspec:AVX512MODE2P
19821 [(match_operand:<ssequartermode> 1 "nonimmediate_operand" "xm,x")]
19823 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
19825 "&& reload_completed"
19826 [(set (match_dup 0) (match_dup 1))]
19828 if (REG_P (operands[0]))
19829 operands[0] = gen_lowpart (<ssequartermode>mode, operands[0]);
19831 operands[1] = lowpart_subreg (<MODE>mode, operands[1],
19832 <ssequartermode>mode);
19835 (define_insn_and_split "avx512f_<castmode><avxsizesuffix>_256<castmode>"
19836 [(set (match_operand:AVX512MODE2P 0 "nonimmediate_operand" "=x,m")
19837 (unspec:AVX512MODE2P
19838 [(match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "xm,x")]
19840 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
19842 "&& reload_completed"
19843 [(set (match_dup 0) (match_dup 1))]
19845 if (REG_P (operands[0]))
19846 operands[0] = gen_lowpart (<ssehalfvecmode>mode, operands[0]);
19848 operands[1] = lowpart_subreg (<MODE>mode, operands[1],
19849 <ssehalfvecmode>mode);
19852 (define_int_iterator VPMADD52
19853 [UNSPEC_VPMADD52LUQ
19854 UNSPEC_VPMADD52HUQ])
19856 (define_int_attr vpmadd52type
19857 [(UNSPEC_VPMADD52LUQ "luq") (UNSPEC_VPMADD52HUQ "huq")])
19859 (define_expand "vpamdd52huq<mode>_maskz"
19860 [(match_operand:VI8_AVX512VL 0 "register_operand")
19861 (match_operand:VI8_AVX512VL 1 "register_operand")
19862 (match_operand:VI8_AVX512VL 2 "register_operand")
19863 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand")
19864 (match_operand:<avx512fmaskmode> 4 "register_operand")]
19865 "TARGET_AVX512IFMA"
19867 emit_insn (gen_vpamdd52huq<mode>_maskz_1 (
19868 operands[0], operands[1], operands[2], operands[3],
19869 CONST0_RTX (<MODE>mode), operands[4]));
19873 (define_expand "vpamdd52luq<mode>_maskz"
19874 [(match_operand:VI8_AVX512VL 0 "register_operand")
19875 (match_operand:VI8_AVX512VL 1 "register_operand")
19876 (match_operand:VI8_AVX512VL 2 "register_operand")
19877 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand")
19878 (match_operand:<avx512fmaskmode> 4 "register_operand")]
19879 "TARGET_AVX512IFMA"
19881 emit_insn (gen_vpamdd52luq<mode>_maskz_1 (
19882 operands[0], operands[1], operands[2], operands[3],
19883 CONST0_RTX (<MODE>mode), operands[4]));
19887 (define_insn "vpamdd52<vpmadd52type><mode><sd_maskz_name>"
19888 [(set (match_operand:VI8_AVX512VL 0 "register_operand" "=v")
19889 (unspec:VI8_AVX512VL
19890 [(match_operand:VI8_AVX512VL 1 "register_operand" "0")
19891 (match_operand:VI8_AVX512VL 2 "register_operand" "v")
19892 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand" "vm")]
19894 "TARGET_AVX512IFMA"
19895 "vpmadd52<vpmadd52type>\t{%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3}"
19896 [(set_attr "type" "ssemuladd")
19897 (set_attr "prefix" "evex")
19898 (set_attr "mode" "<sseinsnmode>")])
19900 (define_insn "vpamdd52<vpmadd52type><mode>_mask"
19901 [(set (match_operand:VI8_AVX512VL 0 "register_operand" "=v")
19902 (vec_merge:VI8_AVX512VL
19903 (unspec:VI8_AVX512VL
19904 [(match_operand:VI8_AVX512VL 1 "register_operand" "0")
19905 (match_operand:VI8_AVX512VL 2 "register_operand" "v")
19906 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand" "vm")]
19909 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
19910 "TARGET_AVX512IFMA"
19911 "vpmadd52<vpmadd52type>\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3}"
19912 [(set_attr "type" "ssemuladd")
19913 (set_attr "prefix" "evex")
19914 (set_attr "mode" "<sseinsnmode>")])
19916 (define_insn "vpmultishiftqb<mode><mask_name>"
19917 [(set (match_operand:VI1_AVX512VL 0 "register_operand" "=v")
19918 (unspec:VI1_AVX512VL
19919 [(match_operand:VI1_AVX512VL 1 "register_operand" "v")
19920 (match_operand:VI1_AVX512VL 2 "nonimmediate_operand" "vm")]
19921 UNSPEC_VPMULTISHIFT))]
19922 "TARGET_AVX512VBMI"
19923 "vpmultishiftqb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
19924 [(set_attr "type" "sselog")
19925 (set_attr "prefix" "evex")
19926 (set_attr "mode" "<sseinsnmode>")])
19928 (define_mode_iterator IMOD4
19929 [(V64SF "TARGET_AVX5124FMAPS") (V64SI "TARGET_AVX5124VNNIW")])
19931 (define_mode_attr imod4_narrow
19932 [(V64SF "V16SF") (V64SI "V16SI")])
19934 (define_expand "mov<mode>"
19935 [(set (match_operand:IMOD4 0 "nonimmediate_operand")
19936 (match_operand:IMOD4 1 "vector_move_operand"))]
19939 ix86_expand_vector_move (<MODE>mode, operands);
19943 (define_insn_and_split "*mov<mode>_internal"
19944 [(set (match_operand:IMOD4 0 "nonimmediate_operand" "=v,v ,m")
19945 (match_operand:IMOD4 1 "vector_move_operand" " C,vm,v"))]
19947 && (register_operand (operands[0], <MODE>mode)
19948 || register_operand (operands[1], <MODE>mode))"
19950 "&& reload_completed"
19956 for (i = 0; i < 4; i++)
19958 op0 = simplify_subreg
19959 (<imod4_narrow>mode, operands[0], <MODE>mode, i * 64);
19960 op1 = simplify_subreg
19961 (<imod4_narrow>mode, operands[1], <MODE>mode, i * 64);
19962 emit_move_insn (op0, op1);
19967 (define_insn "avx5124fmaddps_4fmaddps"
19968 [(set (match_operand:V16SF 0 "register_operand" "=v")
19970 [(match_operand:V16SF 1 "register_operand" "0")
19971 (match_operand:V64SF 2 "register_operand" "Yh")
19972 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FMADD))]
19973 "TARGET_AVX5124FMAPS"
19974 "v4fmaddps\t{%3, %g2, %0|%0, %g2, %3}"
19975 [(set_attr ("type") ("ssemuladd"))
19976 (set_attr ("prefix") ("evex"))
19977 (set_attr ("mode") ("V16SF"))])
19979 (define_insn "avx5124fmaddps_4fmaddps_mask"
19980 [(set (match_operand:V16SF 0 "register_operand" "=v")
19983 [(match_operand:V64SF 1 "register_operand" "Yh")
19984 (match_operand:V4SF 2 "memory_operand" "m")] UNSPEC_VP4FMADD)
19985 (match_operand:V16SF 3 "register_operand" "0")
19986 (match_operand:HI 4 "register_operand" "Yk")))]
19987 "TARGET_AVX5124FMAPS"
19988 "v4fmaddps\t{%2, %g1, %0%{%4%}|%0%{%4%}, %g1, %2}"
19989 [(set_attr ("type") ("ssemuladd"))
19990 (set_attr ("prefix") ("evex"))
19991 (set_attr ("mode") ("V16SF"))])
19993 (define_insn "avx5124fmaddps_4fmaddps_maskz"
19994 [(set (match_operand:V16SF 0 "register_operand" "=v")
19997 [(match_operand:V16SF 1 "register_operand" "0")
19998 (match_operand:V64SF 2 "register_operand" "Yh")
19999 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FMADD)
20000 (match_operand:V16SF 4 "const0_operand" "C")
20001 (match_operand:HI 5 "register_operand" "Yk")))]
20002 "TARGET_AVX5124FMAPS"
20003 "v4fmaddps\t{%3, %g2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %g2, %3}"
20004 [(set_attr ("type") ("ssemuladd"))
20005 (set_attr ("prefix") ("evex"))
20006 (set_attr ("mode") ("V16SF"))])
20008 (define_insn "avx5124fmaddps_4fmaddss"
20009 [(set (match_operand:V4SF 0 "register_operand" "=v")
20011 [(match_operand:V4SF 1 "register_operand" "0")
20012 (match_operand:V64SF 2 "register_operand" "Yh")
20013 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FMADD))]
20014 "TARGET_AVX5124FMAPS"
20015 "v4fmaddss\t{%3, %x2, %0|%0, %x2, %3}"
20016 [(set_attr ("type") ("ssemuladd"))
20017 (set_attr ("prefix") ("evex"))
20018 (set_attr ("mode") ("SF"))])
20020 (define_insn "avx5124fmaddps_4fmaddss_mask"
20021 [(set (match_operand:V4SF 0 "register_operand" "=v")
20024 [(match_operand:V64SF 1 "register_operand" "Yh")
20025 (match_operand:V4SF 2 "memory_operand" "m")] UNSPEC_VP4FMADD)
20026 (match_operand:V4SF 3 "register_operand" "0")
20027 (match_operand:QI 4 "register_operand" "Yk")))]
20028 "TARGET_AVX5124FMAPS"
20029 "v4fmaddss\t{%2, %x1, %0%{%4%}|%0%{%4%}, %x1, %2}"
20030 [(set_attr ("type") ("ssemuladd"))
20031 (set_attr ("prefix") ("evex"))
20032 (set_attr ("mode") ("SF"))])
20034 (define_insn "avx5124fmaddps_4fmaddss_maskz"
20035 [(set (match_operand:V4SF 0 "register_operand" "=v")
20038 [(match_operand:V4SF 1 "register_operand" "0")
20039 (match_operand:V64SF 2 "register_operand" "Yh")
20040 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FMADD)
20041 (match_operand:V4SF 4 "const0_operand" "C")
20042 (match_operand:QI 5 "register_operand" "Yk")))]
20043 "TARGET_AVX5124FMAPS"
20044 "v4fmaddss\t{%3, %x2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %x2, %3}"
20045 [(set_attr ("type") ("ssemuladd"))
20046 (set_attr ("prefix") ("evex"))
20047 (set_attr ("mode") ("SF"))])
20049 (define_insn "avx5124fmaddps_4fnmaddps"
20050 [(set (match_operand:V16SF 0 "register_operand" "=v")
20052 [(match_operand:V16SF 1 "register_operand" "0")
20053 (match_operand:V64SF 2 "register_operand" "Yh")
20054 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FNMADD))]
20055 "TARGET_AVX5124FMAPS"
20056 "v4fnmaddps\t{%3, %g2, %0|%0, %g2, %3}"
20057 [(set_attr ("type") ("ssemuladd"))
20058 (set_attr ("prefix") ("evex"))
20059 (set_attr ("mode") ("V16SF"))])
20061 (define_insn "avx5124fmaddps_4fnmaddps_mask"
20062 [(set (match_operand:V16SF 0 "register_operand" "=v")
20065 [(match_operand:V64SF 1 "register_operand" "Yh")
20066 (match_operand:V4SF 2 "memory_operand" "m")] UNSPEC_VP4FNMADD)
20067 (match_operand:V16SF 3 "register_operand" "0")
20068 (match_operand:HI 4 "register_operand" "Yk")))]
20069 "TARGET_AVX5124FMAPS"
20070 "v4fnmaddps\t{%2, %g1, %0%{%4%}|%0%{%4%}, %g1, %2}"
20071 [(set_attr ("type") ("ssemuladd"))
20072 (set_attr ("prefix") ("evex"))
20073 (set_attr ("mode") ("V16SF"))])
20075 (define_insn "avx5124fmaddps_4fnmaddps_maskz"
20076 [(set (match_operand:V16SF 0 "register_operand" "=v")
20079 [(match_operand:V16SF 1 "register_operand" "0")
20080 (match_operand:V64SF 2 "register_operand" "Yh")
20081 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FNMADD)
20082 (match_operand:V16SF 4 "const0_operand" "C")
20083 (match_operand:HI 5 "register_operand" "Yk")))]
20084 "TARGET_AVX5124FMAPS"
20085 "v4fnmaddps\t{%3, %g2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %g2, %3}"
20086 [(set_attr ("type") ("ssemuladd"))
20087 (set_attr ("prefix") ("evex"))
20088 (set_attr ("mode") ("V16SF"))])
20090 (define_insn "avx5124fmaddps_4fnmaddss"
20091 [(set (match_operand:V4SF 0 "register_operand" "=v")
20093 [(match_operand:V4SF 1 "register_operand" "0")
20094 (match_operand:V64SF 2 "register_operand" "Yh")
20095 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FNMADD))]
20096 "TARGET_AVX5124FMAPS"
20097 "v4fnmaddss\t{%3, %x2, %0|%0, %x2, %3}"
20098 [(set_attr ("type") ("ssemuladd"))
20099 (set_attr ("prefix") ("evex"))
20100 (set_attr ("mode") ("SF"))])
20102 (define_insn "avx5124fmaddps_4fnmaddss_mask"
20103 [(set (match_operand:V4SF 0 "register_operand" "=v")
20106 [(match_operand:V64SF 1 "register_operand" "Yh")
20107 (match_operand:V4SF 2 "memory_operand" "m")] UNSPEC_VP4FNMADD)
20108 (match_operand:V4SF 3 "register_operand" "0")
20109 (match_operand:QI 4 "register_operand" "Yk")))]
20110 "TARGET_AVX5124FMAPS"
20111 "v4fnmaddss\t{%2, %x1, %0%{%4%}|%0%{%4%}, %x1, %2}"
20112 [(set_attr ("type") ("ssemuladd"))
20113 (set_attr ("prefix") ("evex"))
20114 (set_attr ("mode") ("SF"))])
20116 (define_insn "avx5124fmaddps_4fnmaddss_maskz"
20117 [(set (match_operand:V4SF 0 "register_operand" "=v")
20120 [(match_operand:V4SF 1 "register_operand" "0")
20121 (match_operand:V64SF 2 "register_operand" "Yh")
20122 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FNMADD)
20123 (match_operand:V4SF 4 "const0_operand" "C")
20124 (match_operand:QI 5 "register_operand" "Yk")))]
20125 "TARGET_AVX5124FMAPS"
20126 "v4fnmaddss\t{%3, %x2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %x2, %3}"
20127 [(set_attr ("type") ("ssemuladd"))
20128 (set_attr ("prefix") ("evex"))
20129 (set_attr ("mode") ("SF"))])
20131 (define_insn "avx5124vnniw_vp4dpwssd"
20132 [(set (match_operand:V16SI 0 "register_operand" "=v")
20134 [(match_operand:V16SI 1 "register_operand" "0")
20135 (match_operand:V64SI 2 "register_operand" "Yh")
20136 (match_operand:V4SI 3 "memory_operand" "m")] UNSPEC_VP4DPWSSD))]
20137 "TARGET_AVX5124VNNIW"
20138 "vp4dpwssd\t{%3, %g2, %0|%0, %g2, %3}"
20139 [(set_attr ("type") ("ssemuladd"))
20140 (set_attr ("prefix") ("evex"))
20141 (set_attr ("mode") ("TI"))])
20143 (define_insn "avx5124vnniw_vp4dpwssd_mask"
20144 [(set (match_operand:V16SI 0 "register_operand" "=v")
20147 [(match_operand:V64SI 1 "register_operand" "Yh")
20148 (match_operand:V4SI 2 "memory_operand" "m")] UNSPEC_VP4DPWSSD)
20149 (match_operand:V16SI 3 "register_operand" "0")
20150 (match_operand:HI 4 "register_operand" "Yk")))]
20151 "TARGET_AVX5124VNNIW"
20152 "vp4dpwssd\t{%2, %g1, %0%{%4%}|%0%{%4%}, %g1, %2}"
20153 [(set_attr ("type") ("ssemuladd"))
20154 (set_attr ("prefix") ("evex"))
20155 (set_attr ("mode") ("TI"))])
20157 (define_insn "avx5124vnniw_vp4dpwssd_maskz"
20158 [(set (match_operand:V16SI 0 "register_operand" "=v")
20161 [(match_operand:V16SI 1 "register_operand" "0")
20162 (match_operand:V64SI 2 "register_operand" "Yh")
20163 (match_operand:V4SI 3 "memory_operand" "m")] UNSPEC_VP4DPWSSD)
20164 (match_operand:V16SI 4 "const0_operand" "C")
20165 (match_operand:HI 5 "register_operand" "Yk")))]
20166 "TARGET_AVX5124VNNIW"
20167 "vp4dpwssd\t{%3, %g2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %g2, %3}"
20168 [(set_attr ("type") ("ssemuladd"))
20169 (set_attr ("prefix") ("evex"))
20170 (set_attr ("mode") ("TI"))])
20172 (define_insn "avx5124vnniw_vp4dpwssds"
20173 [(set (match_operand:V16SI 0 "register_operand" "=v")
20175 [(match_operand:V16SI 1 "register_operand" "0")
20176 (match_operand:V64SI 2 "register_operand" "Yh")
20177 (match_operand:V4SI 3 "memory_operand" "m")] UNSPEC_VP4DPWSSDS))]
20178 "TARGET_AVX5124VNNIW"
20179 "vp4dpwssds\t{%3, %g2, %0|%0, %g2, %3}"
20180 [(set_attr ("type") ("ssemuladd"))
20181 (set_attr ("prefix") ("evex"))
20182 (set_attr ("mode") ("TI"))])
20184 (define_insn "avx5124vnniw_vp4dpwssds_mask"
20185 [(set (match_operand:V16SI 0 "register_operand" "=v")
20188 [(match_operand:V64SI 1 "register_operand" "Yh")
20189 (match_operand:V4SI 2 "memory_operand" "m")] UNSPEC_VP4DPWSSDS)
20190 (match_operand:V16SI 3 "register_operand" "0")
20191 (match_operand:HI 4 "register_operand" "Yk")))]
20192 "TARGET_AVX5124VNNIW"
20193 "vp4dpwssds\t{%2, %g1, %0%{%4%}|%0%{%4%}, %g1, %2}"
20194 [(set_attr ("type") ("ssemuladd"))
20195 (set_attr ("prefix") ("evex"))
20196 (set_attr ("mode") ("TI"))])
20198 (define_insn "avx5124vnniw_vp4dpwssds_maskz"
20199 [(set (match_operand:V16SI 0 "register_operand" "=v")
20202 [(match_operand:V16SI 1 "register_operand" "0")
20203 (match_operand:V64SI 2 "register_operand" "Yh")
20204 (match_operand:V4SI 3 "memory_operand" "m")] UNSPEC_VP4DPWSSDS)
20205 (match_operand:V16SI 4 "const0_operand" "C")
20206 (match_operand:HI 5 "register_operand" "Yk")))]
20207 "TARGET_AVX5124VNNIW"
20208 "vp4dpwssds\t{%3, %g2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %g2, %3}"
20209 [(set_attr ("type") ("ssemuladd"))
20210 (set_attr ("prefix") ("evex"))
20211 (set_attr ("mode") ("TI"))])
20213 (define_insn "vpopcount<mode><mask_name>"
20214 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
20215 (popcount:VI48_AVX512VL
20216 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm")))]
20217 "TARGET_AVX512VPOPCNTDQ"
20218 "vpopcnt<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}")
20220 ;; Save multiple registers out-of-line.
20221 (define_insn "save_multiple<mode>"
20222 [(match_parallel 0 "save_multiple"
20223 [(use (match_operand:P 1 "symbol_operand"))])]
20224 "TARGET_SSE && TARGET_64BIT"
20227 ;; Restore multiple registers out-of-line.
20228 (define_insn "restore_multiple<mode>"
20229 [(match_parallel 0 "restore_multiple"
20230 [(use (match_operand:P 1 "symbol_operand"))])]
20231 "TARGET_SSE && TARGET_64BIT"
20234 ;; Restore multiple registers out-of-line and return.
20235 (define_insn "restore_multiple_and_return<mode>"
20236 [(match_parallel 0 "restore_multiple"
20238 (use (match_operand:P 1 "symbol_operand"))
20239 (set (reg:DI SP_REG) (reg:DI R10_REG))
20241 "TARGET_SSE && TARGET_64BIT"
20244 ;; Restore multiple registers out-of-line when hard frame pointer is used,
20245 ;; perform the leave operation prior to returning (from the function).
20246 (define_insn "restore_multiple_leave_return<mode>"
20247 [(match_parallel 0 "restore_multiple"
20249 (use (match_operand:P 1 "symbol_operand"))
20250 (set (reg:DI SP_REG) (plus:DI (reg:DI BP_REG) (const_int 8)))
20251 (set (reg:DI BP_REG) (mem:DI (reg:DI BP_REG)))
20252 (clobber (mem:BLK (scratch)))
20254 "TARGET_SSE && TARGET_64BIT"
20257 (define_insn "vpopcount<mode><mask_name>"
20258 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
20259 (popcount:VI12_AVX512VL
20260 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "vm")))]
20261 "TARGET_AVX512BITALG"
20262 "vpopcnt<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}")
20264 (define_insn "vgf2p8affineinvqb_<mode><mask_name>"
20265 [(set (match_operand:VI1_AVX512F 0 "register_operand" "=x,x,v")
20266 (unspec:VI1_AVX512F
20267 [(match_operand:VI1_AVX512F 1 "register_operand" "%0,x,v")
20268 (match_operand:VI1_AVX512F 2 "nonimmediate_operand" "xBm,xm,vm")
20269 (match_operand:QI 3 "const_0_to_255_operand" "n,n,n")]
20270 UNSPEC_GF2P8AFFINEINV))]
20273 gf2p8affineinvqb\t{%3, %2, %0| %0, %2, %3}
20274 vgf2p8affineinvqb\t{%3, %2, %1, %0<mask_operand4>| %0<mask_operand4>, %1, %2, %3}
20275 vgf2p8affineinvqb\t{%3, %2, %1, %0<mask_operand4>| %0<mask_operand4>, %1, %2, %3}"
20276 [(set_attr "isa" "noavx,avx,avx512f")
20277 (set_attr "prefix_data16" "1,*,*")
20278 (set_attr "prefix_extra" "1")
20279 (set_attr "prefix" "orig,maybe_evex,evex")
20280 (set_attr "mode" "<sseinsnmode>")])
20282 (define_insn "vgf2p8affineqb_<mode><mask_name>"
20283 [(set (match_operand:VI1_AVX512F 0 "register_operand" "=x,x,v")
20284 (unspec:VI1_AVX512F
20285 [(match_operand:VI1_AVX512F 1 "register_operand" "%0,x,v")
20286 (match_operand:VI1_AVX512F 2 "nonimmediate_operand" "xBm,xm,vm")
20287 (match_operand:QI 3 "const_0_to_255_operand" "n,n,n")]
20288 UNSPEC_GF2P8AFFINE))]
20291 gf2p8affineqb\t{%3, %2, %0| %0, %2, %3}
20292 vgf2p8affineqb\t{%3, %2, %1, %0<mask_operand4>| %0<mask_operand4>, %1, %2, %3}
20293 vgf2p8affineqb\t{%3, %2, %1, %0<mask_operand4>| %0<mask_operand4>, %1, %2, %3}"
20294 [(set_attr "isa" "noavx,avx,avx512f")
20295 (set_attr "prefix_data16" "1,*,*")
20296 (set_attr "prefix_extra" "1")
20297 (set_attr "prefix" "orig,maybe_evex,evex")
20298 (set_attr "mode" "<sseinsnmode>")])
20300 (define_insn "vgf2p8mulb_<mode><mask_name>"
20301 [(set (match_operand:VI1_AVX512F 0 "register_operand" "=x,x,v")
20302 (unspec:VI1_AVX512F
20303 [(match_operand:VI1_AVX512F 1 "register_operand" "%0,x,v")
20304 (match_operand:VI1_AVX512F 2 "nonimmediate_operand" "xBm,xm,vm")]
20308 gf2p8mulb\t{%2, %0| %0, %2}
20309 vgf2p8mulb\t{%2, %1, %0<mask_operand3>| %0<mask_operand3>, %1, %2}
20310 vgf2p8mulb\t{%2, %1, %0<mask_operand3>| %0<mask_operand3>, %1, %2}"
20311 [(set_attr "isa" "noavx,avx,avx512f")
20312 (set_attr "prefix_data16" "1,*,*")
20313 (set_attr "prefix_extra" "1")
20314 (set_attr "prefix" "orig,maybe_evex,evex")
20315 (set_attr "mode" "<sseinsnmode>")])
20317 (define_insn "vpshrd_<mode><mask_name>"
20318 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
20319 (unspec:VI248_AVX512VL
20320 [(match_operand:VI248_AVX512VL 1 "register_operand" "v")
20321 (match_operand:VI248_AVX512VL 2 "nonimmediate_operand" "vm")
20322 (match_operand:SI 3 "const_0_to_255_operand" "n")]
20324 "TARGET_AVX512VBMI2"
20325 "vpshrd<ssemodesuffix>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3 }"
20326 [(set_attr ("prefix") ("evex"))])
20328 (define_insn "vpshld_<mode><mask_name>"
20329 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
20330 (unspec:VI248_AVX512VL
20331 [(match_operand:VI248_AVX512VL 1 "register_operand" "v")
20332 (match_operand:VI248_AVX512VL 2 "nonimmediate_operand" "vm")
20333 (match_operand:SI 3 "const_0_to_255_operand" "n")]
20335 "TARGET_AVX512VBMI2"
20336 "vpshld<ssemodesuffix>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3 }"
20337 [(set_attr ("prefix") ("evex"))])
20339 (define_insn "vpshrdv_<mode>"
20340 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
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 "TARGET_AVX512VBMI2"
20347 "vpshrdv<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3 }"
20348 [(set_attr ("prefix") ("evex"))
20349 (set_attr "mode" "<sseinsnmode>")])
20351 (define_insn "vpshrdv_<mode>_mask"
20352 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
20353 (vec_merge:VI248_AVX512VL
20354 (unspec:VI248_AVX512VL
20355 [(match_operand:VI248_AVX512VL 1 "register_operand" "0")
20356 (match_operand:VI248_AVX512VL 2 "register_operand" "v")
20357 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand" "vm")]
20360 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
20361 "TARGET_AVX512VBMI2"
20362 "vpshrdv<ssemodesuffix>\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
20363 [(set_attr ("prefix") ("evex"))
20364 (set_attr "mode" "<sseinsnmode>")])
20366 (define_expand "vpshrdv_<mode>_maskz"
20367 [(match_operand:VI248_AVX512VL 0 "register_operand")
20368 (match_operand:VI248_AVX512VL 1 "register_operand")
20369 (match_operand:VI248_AVX512VL 2 "register_operand")
20370 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand")
20371 (match_operand:<avx512fmaskmode> 4 "register_operand")]
20372 "TARGET_AVX512VBMI2"
20374 emit_insn (gen_vpshrdv_<mode>_maskz_1 (operands[0], operands[1],
20375 operands[2], operands[3],
20376 CONST0_RTX (<MODE>mode),
20381 (define_insn "vpshrdv_<mode>_maskz_1"
20382 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
20383 (vec_merge:VI248_AVX512VL
20384 (unspec:VI248_AVX512VL
20385 [(match_operand:VI248_AVX512VL 1 "register_operand" "0")
20386 (match_operand:VI248_AVX512VL 2 "register_operand" "v")
20387 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand" "vm")]
20389 (match_operand:VI248_AVX512VL 4 "const0_operand" "C")
20390 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
20391 "TARGET_AVX512VBMI2"
20392 "vpshrdv<ssemodesuffix>\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
20393 [(set_attr ("prefix") ("evex"))
20394 (set_attr "mode" "<sseinsnmode>")])
20396 (define_insn "vpshldv_<mode>"
20397 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
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 "TARGET_AVX512VBMI2"
20404 "vpshldv<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3 }"
20405 [(set_attr ("prefix") ("evex"))
20406 (set_attr "mode" "<sseinsnmode>")])
20408 (define_insn "vpshldv_<mode>_mask"
20409 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
20410 (vec_merge:VI248_AVX512VL
20411 (unspec:VI248_AVX512VL
20412 [(match_operand:VI248_AVX512VL 1 "register_operand" "0")
20413 (match_operand:VI248_AVX512VL 2 "register_operand" "v")
20414 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand" "vm")]
20417 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
20418 "TARGET_AVX512VBMI2"
20419 "vpshldv<ssemodesuffix>\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
20420 [(set_attr ("prefix") ("evex"))
20421 (set_attr "mode" "<sseinsnmode>")])
20423 (define_expand "vpshldv_<mode>_maskz"
20424 [(match_operand:VI248_AVX512VL 0 "register_operand")
20425 (match_operand:VI248_AVX512VL 1 "register_operand")
20426 (match_operand:VI248_AVX512VL 2 "register_operand")
20427 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand")
20428 (match_operand:<avx512fmaskmode> 4 "register_operand")]
20429 "TARGET_AVX512VBMI2"
20431 emit_insn (gen_vpshldv_<mode>_maskz_1 (operands[0], operands[1],
20432 operands[2], operands[3],
20433 CONST0_RTX (<MODE>mode),
20438 (define_insn "vpshldv_<mode>_maskz_1"
20439 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
20440 (vec_merge:VI248_AVX512VL
20441 (unspec:VI248_AVX512VL
20442 [(match_operand:VI248_AVX512VL 1 "register_operand" "0")
20443 (match_operand:VI248_AVX512VL 2 "register_operand" "v")
20444 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand" "vm")]
20446 (match_operand:VI248_AVX512VL 4 "const0_operand" "C")
20447 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
20448 "TARGET_AVX512VBMI2"
20449 "vpshldv<ssemodesuffix>\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
20450 [(set_attr ("prefix") ("evex"))
20451 (set_attr "mode" "<sseinsnmode>")])
20453 (define_insn "vpdpbusd_<mode>"
20454 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20455 (unspec:VI4_AVX512VL
20456 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20457 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20458 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20459 UNSPEC_VPMADDUBSWACCD))]
20460 "TARGET_AVX512VNNI"
20461 "vpdpbusd\t{%3, %2, %0|%0, %2, %3 }"
20462 [(set_attr ("prefix") ("evex"))])
20464 (define_insn "vpdpbusd_<mode>_mask"
20465 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20466 (vec_merge:VI4_AVX512VL
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_VPMADDUBSWACCD)
20473 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
20474 "TARGET_AVX512VNNI"
20475 "vpdpbusd\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
20476 [(set_attr ("prefix") ("evex"))])
20478 (define_expand "vpdpbusd_<mode>_maskz"
20479 [(match_operand:VI4_AVX512VL 0 "register_operand")
20480 (match_operand:VI4_AVX512VL 1 "register_operand")
20481 (match_operand:VI4_AVX512VL 2 "register_operand")
20482 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand")
20483 (match_operand:<avx512fmaskmode> 4 "register_operand")]
20484 "TARGET_AVX512VNNI"
20486 emit_insn (gen_vpdpbusd_<mode>_maskz_1 (operands[0], operands[1],
20487 operands[2], operands[3],
20488 CONST0_RTX (<MODE>mode),
20493 (define_insn "vpdpbusd_<mode>_maskz_1"
20494 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20495 (vec_merge:VI4_AVX512VL
20496 (unspec:VI4_AVX512VL
20497 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20498 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20499 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")
20500 ] UNSPEC_VPMADDUBSWACCD)
20501 (match_operand:VI4_AVX512VL 4 "const0_operand" "C")
20502 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
20503 "TARGET_AVX512VNNI"
20504 "vpdpbusd\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
20505 [(set_attr ("prefix") ("evex"))])
20508 (define_insn "vpdpbusds_<mode>"
20509 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20510 (unspec:VI4_AVX512VL
20511 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20512 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20513 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20514 UNSPEC_VPMADDUBSWACCSSD))]
20515 "TARGET_AVX512VNNI"
20516 "vpdpbusds\t{%3, %2, %0|%0, %2, %3 }"
20517 [(set_attr ("prefix") ("evex"))])
20519 (define_insn "vpdpbusds_<mode>_mask"
20520 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20521 (vec_merge:VI4_AVX512VL
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_VPMADDUBSWACCSSD)
20528 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
20529 "TARGET_AVX512VNNI"
20530 "vpdpbusds\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
20531 [(set_attr ("prefix") ("evex"))])
20533 (define_expand "vpdpbusds_<mode>_maskz"
20534 [(match_operand:VI4_AVX512VL 0 "register_operand")
20535 (match_operand:VI4_AVX512VL 1 "register_operand")
20536 (match_operand:VI4_AVX512VL 2 "register_operand")
20537 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand")
20538 (match_operand:<avx512fmaskmode> 4 "register_operand")]
20539 "TARGET_AVX512VNNI"
20541 emit_insn (gen_vpdpbusds_<mode>_maskz_1 (operands[0], operands[1],
20542 operands[2], operands[3],
20543 CONST0_RTX (<MODE>mode),
20548 (define_insn "vpdpbusds_<mode>_maskz_1"
20549 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20550 (vec_merge:VI4_AVX512VL
20551 (unspec:VI4_AVX512VL
20552 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20553 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20554 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20555 UNSPEC_VPMADDUBSWACCSSD)
20556 (match_operand:VI4_AVX512VL 4 "const0_operand" "C")
20557 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
20558 "TARGET_AVX512VNNI"
20559 "vpdpbusds\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
20560 [(set_attr ("prefix") ("evex"))])
20563 (define_insn "vpdpwssd_<mode>"
20564 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20565 (unspec:VI4_AVX512VL
20566 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20567 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20568 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20569 UNSPEC_VPMADDWDACCD))]
20570 "TARGET_AVX512VNNI"
20571 "vpdpwssd\t{%3, %2, %0|%0, %2, %3 }"
20572 [(set_attr ("prefix") ("evex"))])
20574 (define_insn "vpdpwssd_<mode>_mask"
20575 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20576 (vec_merge:VI4_AVX512VL
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_VPMADDWDACCD)
20583 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
20584 "TARGET_AVX512VNNI"
20585 "vpdpwssd\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
20586 [(set_attr ("prefix") ("evex"))])
20588 (define_expand "vpdpwssd_<mode>_maskz"
20589 [(match_operand:VI4_AVX512VL 0 "register_operand")
20590 (match_operand:VI4_AVX512VL 1 "register_operand")
20591 (match_operand:VI4_AVX512VL 2 "register_operand")
20592 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand")
20593 (match_operand:<avx512fmaskmode> 4 "register_operand")]
20594 "TARGET_AVX512VNNI"
20596 emit_insn (gen_vpdpwssd_<mode>_maskz_1 (operands[0], operands[1],
20597 operands[2], operands[3],
20598 CONST0_RTX (<MODE>mode),
20603 (define_insn "vpdpwssd_<mode>_maskz_1"
20604 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20605 (vec_merge:VI4_AVX512VL
20606 (unspec:VI4_AVX512VL
20607 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20608 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20609 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20610 UNSPEC_VPMADDWDACCD)
20611 (match_operand:VI4_AVX512VL 4 "const0_operand" "C")
20612 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
20613 "TARGET_AVX512VNNI"
20614 "vpdpwssd\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
20615 [(set_attr ("prefix") ("evex"))])
20618 (define_insn "vpdpwssds_<mode>"
20619 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20620 (unspec:VI4_AVX512VL
20621 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20622 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20623 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20624 UNSPEC_VPMADDWDACCSSD))]
20625 "TARGET_AVX512VNNI"
20626 "vpdpwssds\t{%3, %2, %0|%0, %2, %3 }"
20627 [(set_attr ("prefix") ("evex"))])
20629 (define_insn "vpdpwssds_<mode>_mask"
20630 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20631 (vec_merge:VI4_AVX512VL
20632 (unspec:VI4_AVX512VL
20633 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20634 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20635 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20636 UNSPEC_VPMADDWDACCSSD)
20638 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
20639 "TARGET_AVX512VNNI"
20640 "vpdpwssds\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
20641 [(set_attr ("prefix") ("evex"))])
20643 (define_expand "vpdpwssds_<mode>_maskz"
20644 [(match_operand:VI4_AVX512VL 0 "register_operand")
20645 (match_operand:VI4_AVX512VL 1 "register_operand")
20646 (match_operand:VI4_AVX512VL 2 "register_operand")
20647 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand")
20648 (match_operand:<avx512fmaskmode> 4 "register_operand")]
20649 "TARGET_AVX512VNNI"
20651 emit_insn (gen_vpdpwssds_<mode>_maskz_1 (operands[0], operands[1],
20652 operands[2], operands[3],
20653 CONST0_RTX (<MODE>mode),
20658 (define_insn "vpdpwssds_<mode>_maskz_1"
20659 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20660 (vec_merge:VI4_AVX512VL
20661 (unspec:VI4_AVX512VL
20662 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20663 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20664 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20665 UNSPEC_VPMADDWDACCSSD)
20666 (match_operand:VI4_AVX512VL 4 "const0_operand" "C")
20667 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
20668 "TARGET_AVX512VNNI"
20669 "vpdpwssds\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
20670 [(set_attr ("prefix") ("evex"))])
20672 (define_insn "vaesdec_<mode>"
20673 [(set (match_operand:VI1_AVX512VL_F 0 "register_operand" "=v")
20674 (unspec:VI1_AVX512VL_F
20675 [(match_operand:VI1_AVX512VL_F 1 "register_operand" "v")
20676 (match_operand:VI1_AVX512VL_F 2 "vector_operand" "v")]
20679 "vaesdec\t{%2, %1, %0|%0, %1, %2}"
20682 (define_insn "vaesdeclast_<mode>"
20683 [(set (match_operand:VI1_AVX512VL_F 0 "register_operand" "=v")
20684 (unspec:VI1_AVX512VL_F
20685 [(match_operand:VI1_AVX512VL_F 1 "register_operand" "v")
20686 (match_operand:VI1_AVX512VL_F 2 "vector_operand" "v")]
20687 UNSPEC_VAESDECLAST))]
20689 "vaesdeclast\t{%2, %1, %0|%0, %1, %2}"
20692 (define_insn "vaesenc_<mode>"
20693 [(set (match_operand:VI1_AVX512VL_F 0 "register_operand" "=v")
20694 (unspec:VI1_AVX512VL_F
20695 [(match_operand:VI1_AVX512VL_F 1 "register_operand" "v")
20696 (match_operand:VI1_AVX512VL_F 2 "vector_operand" "vm")]
20699 "vaesenc\t{%2, %1, %0|%0, %1, %2}"
20702 (define_insn "vaesenclast_<mode>"
20703 [(set (match_operand:VI1_AVX512VL_F 0 "register_operand" "=v")
20704 (unspec:VI1_AVX512VL_F
20705 [(match_operand:VI1_AVX512VL_F 1 "register_operand" "v")
20706 (match_operand:VI1_AVX512VL_F 2 "vector_operand" "vm")]
20707 UNSPEC_VAESENCLAST))]
20709 "vaesenclast\t{%2, %1, %0|%0, %1, %2}"
20712 (define_insn "vpclmulqdq_<mode>"
20713 [(set (match_operand:VI8_FVL 0 "register_operand" "=v")
20714 (unspec:VI8_FVL [(match_operand:VI8_FVL 1 "register_operand" "v")
20715 (match_operand:VI8_FVL 2 "vector_operand" "vm")
20716 (match_operand:SI 3 "const_0_to_255_operand" "n")]
20717 UNSPEC_VPCLMULQDQ))]
20718 "TARGET_VPCLMULQDQ"
20719 "vpclmulqdq\t{%3, %2, %1, %0|%0, %1, %2, %3}"
20720 [(set_attr "mode" "DI")])
20722 (define_insn "avx512vl_vpshufbitqmb<mode><mask_scalar_merge_name>"
20723 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
20724 (unspec:<avx512fmaskmode>
20725 [(match_operand:VI1_AVX512VLBW 1 "register_operand" "v")
20726 (match_operand:VI1_AVX512VLBW 2 "nonimmediate_operand" "vm")]
20727 UNSPEC_VPSHUFBIT))]
20728 "TARGET_AVX512BITALG"
20729 "vpshufbitqmb\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
20730 [(set_attr "prefix" "evex")
20731 (set_attr "mode" "<sseinsnmode>")])