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 ssequarterinsnmode
585 [(V16SF "V4SF") (V8DF "V2DF") (V16SI "TI") (V8DI "TI")])
587 (define_mode_attr ssedoublemodelower
588 [(V16QI "v16hi") (V32QI "v32hi") (V64QI "v64hi")
589 (V8HI "v8si") (V16HI "v16si") (V32HI "v32si")
590 (V4SI "v4di") (V8SI "v8di") (V16SI "v16di")])
592 (define_mode_attr ssedoublemode
593 [(V4SF "V8SF") (V8SF "V16SF") (V16SF "V32SF")
594 (V2DF "V4DF") (V4DF "V8DF") (V8DF "V16DF")
595 (V16QI "V16HI") (V32QI "V32HI") (V64QI "V64HI")
596 (V4HI "V4SI") (V8HI "V8SI") (V16HI "V16SI") (V32HI "V32SI")
597 (V4SI "V4DI") (V8SI "V16SI") (V16SI "V32SI")
598 (V4DI "V8DI") (V8DI "V16DI")])
600 (define_mode_attr ssebytemode
601 [(V8DI "V64QI") (V4DI "V32QI") (V2DI "V16QI")])
603 ;; All 128bit vector integer modes
604 (define_mode_iterator VI_128 [V16QI V8HI V4SI V2DI])
606 ;; All 256bit vector integer modes
607 (define_mode_iterator VI_256 [V32QI V16HI V8SI V4DI])
609 ;; Various 128bit vector integer mode combinations
610 (define_mode_iterator VI12_128 [V16QI V8HI])
611 (define_mode_iterator VI14_128 [V16QI V4SI])
612 (define_mode_iterator VI124_128 [V16QI V8HI V4SI])
613 (define_mode_iterator VI24_128 [V8HI V4SI])
614 (define_mode_iterator VI248_128 [V8HI V4SI V2DI])
615 (define_mode_iterator VI48_128 [V4SI V2DI])
617 ;; Various 256bit and 512 vector integer mode combinations
618 (define_mode_iterator VI124_256 [V32QI V16HI V8SI])
619 (define_mode_iterator VI124_256_AVX512F_AVX512BW
621 (V64QI "TARGET_AVX512BW")
622 (V32HI "TARGET_AVX512BW")
623 (V16SI "TARGET_AVX512F")])
624 (define_mode_iterator VI48_256 [V8SI V4DI])
625 (define_mode_iterator VI48_512 [V16SI V8DI])
626 (define_mode_iterator VI4_256_8_512 [V8SI V8DI])
627 (define_mode_iterator VI_AVX512BW
628 [V16SI V8DI (V32HI "TARGET_AVX512BW") (V64QI "TARGET_AVX512BW")])
630 ;; Int-float size matches
631 (define_mode_iterator VI4F_128 [V4SI V4SF])
632 (define_mode_iterator VI8F_128 [V2DI V2DF])
633 (define_mode_iterator VI4F_256 [V8SI V8SF])
634 (define_mode_iterator VI8F_256 [V4DI V4DF])
635 (define_mode_iterator VI4F_256_512
637 (V16SI "TARGET_AVX512F") (V16SF "TARGET_AVX512F")])
638 (define_mode_iterator VI48F_256_512
640 (V16SI "TARGET_AVX512F") (V16SF "TARGET_AVX512F")
641 (V8DI "TARGET_AVX512F") (V8DF "TARGET_AVX512F")
642 (V4DI "TARGET_AVX512VL") (V4DF "TARGET_AVX512VL")])
643 (define_mode_iterator VF48_I1248
644 [V16SI V16SF V8DI V8DF V32HI V64QI])
645 (define_mode_iterator VI48F
646 [V16SI V16SF V8DI V8DF
647 (V8SI "TARGET_AVX512VL") (V8SF "TARGET_AVX512VL")
648 (V4DI "TARGET_AVX512VL") (V4DF "TARGET_AVX512VL")
649 (V4SI "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
650 (V2DI "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
651 (define_mode_iterator VI48F_256 [V8SI V8SF V4DI V4DF])
653 ;; Mapping from float mode to required SSE level
654 (define_mode_attr sse
655 [(SF "sse") (DF "sse2")
656 (V4SF "sse") (V2DF "sse2")
657 (V16SF "avx512f") (V8SF "avx")
658 (V8DF "avx512f") (V4DF "avx")])
660 (define_mode_attr sse2
661 [(V16QI "sse2") (V32QI "avx") (V64QI "avx512f")
662 (V2DI "sse2") (V4DI "avx") (V8DI "avx512f")])
664 (define_mode_attr sse3
665 [(V16QI "sse3") (V32QI "avx")])
667 (define_mode_attr sse4_1
668 [(V4SF "sse4_1") (V2DF "sse4_1")
669 (V8SF "avx") (V4DF "avx")
671 (V4DI "avx") (V2DI "sse4_1")
672 (V8SI "avx") (V4SI "sse4_1")
673 (V16QI "sse4_1") (V32QI "avx")
674 (V8HI "sse4_1") (V16HI "avx")])
676 (define_mode_attr avxsizesuffix
677 [(V64QI "512") (V32HI "512") (V16SI "512") (V8DI "512")
678 (V32QI "256") (V16HI "256") (V8SI "256") (V4DI "256")
679 (V16QI "") (V8HI "") (V4SI "") (V2DI "")
680 (V16SF "512") (V8DF "512")
681 (V8SF "256") (V4DF "256")
682 (V4SF "") (V2DF "")])
684 ;; SSE instruction mode
685 (define_mode_attr sseinsnmode
686 [(V64QI "XI") (V32HI "XI") (V16SI "XI") (V8DI "XI") (V4TI "XI")
687 (V32QI "OI") (V16HI "OI") (V8SI "OI") (V4DI "OI") (V2TI "OI")
688 (V16QI "TI") (V8HI "TI") (V4SI "TI") (V2DI "TI") (V1TI "TI")
689 (V16SF "V16SF") (V8DF "V8DF")
690 (V8SF "V8SF") (V4DF "V4DF")
691 (V4SF "V4SF") (V2DF "V2DF")
694 ;; Mapping of vector modes to corresponding mask size
695 (define_mode_attr avx512fmaskmode
696 [(V64QI "DI") (V32QI "SI") (V16QI "HI")
697 (V32HI "SI") (V16HI "HI") (V8HI "QI") (V4HI "QI")
698 (V16SI "HI") (V8SI "QI") (V4SI "QI")
699 (V8DI "QI") (V4DI "QI") (V2DI "QI")
700 (V16SF "HI") (V8SF "QI") (V4SF "QI")
701 (V8DF "QI") (V4DF "QI") (V2DF "QI")])
703 ;; Mapping of vector modes to corresponding mask size
704 (define_mode_attr avx512fmaskmodelower
705 [(V64QI "di") (V32QI "si") (V16QI "hi")
706 (V32HI "si") (V16HI "hi") (V8HI "qi") (V4HI "qi")
707 (V16SI "hi") (V8SI "qi") (V4SI "qi")
708 (V8DI "qi") (V4DI "qi") (V2DI "qi")
709 (V16SF "hi") (V8SF "qi") (V4SF "qi")
710 (V8DF "qi") (V4DF "qi") (V2DF "qi")])
712 ;; Mapping of vector float modes to an integer mode of the same size
713 (define_mode_attr sseintvecmode
714 [(V16SF "V16SI") (V8DF "V8DI")
715 (V8SF "V8SI") (V4DF "V4DI")
716 (V4SF "V4SI") (V2DF "V2DI")
717 (V16SI "V16SI") (V8DI "V8DI")
718 (V8SI "V8SI") (V4DI "V4DI")
719 (V4SI "V4SI") (V2DI "V2DI")
720 (V16HI "V16HI") (V8HI "V8HI")
721 (V32HI "V32HI") (V64QI "V64QI")
722 (V32QI "V32QI") (V16QI "V16QI")])
724 (define_mode_attr sseintvecmode2
725 [(V8DF "XI") (V4DF "OI") (V2DF "TI")
726 (V8SF "OI") (V4SF "TI")])
728 (define_mode_attr sseintvecmodelower
729 [(V16SF "v16si") (V8DF "v8di")
730 (V8SF "v8si") (V4DF "v4di")
731 (V4SF "v4si") (V2DF "v2di")
732 (V8SI "v8si") (V4DI "v4di")
733 (V4SI "v4si") (V2DI "v2di")
734 (V16HI "v16hi") (V8HI "v8hi")
735 (V32QI "v32qi") (V16QI "v16qi")])
737 ;; Mapping of vector modes to a vector mode of double size
738 (define_mode_attr ssedoublevecmode
739 [(V32QI "V64QI") (V16HI "V32HI") (V8SI "V16SI") (V4DI "V8DI")
740 (V16QI "V32QI") (V8HI "V16HI") (V4SI "V8SI") (V2DI "V4DI")
741 (V8SF "V16SF") (V4DF "V8DF")
742 (V4SF "V8SF") (V2DF "V4DF")])
744 ;; Mapping of vector modes to a vector mode of half size
745 (define_mode_attr ssehalfvecmode
746 [(V64QI "V32QI") (V32HI "V16HI") (V16SI "V8SI") (V8DI "V4DI") (V4TI "V2TI")
747 (V32QI "V16QI") (V16HI "V8HI") (V8SI "V4SI") (V4DI "V2DI")
748 (V16QI "V8QI") (V8HI "V4HI") (V4SI "V2SI")
749 (V16SF "V8SF") (V8DF "V4DF")
750 (V8SF "V4SF") (V4DF "V2DF")
753 (define_mode_attr ssehalfvecmodelower
754 [(V64QI "v32qi") (V32HI "v16hi") (V16SI "v8si") (V8DI "v4di") (V4TI "v2ti")
755 (V32QI "v16qi") (V16HI "v8hi") (V8SI "v4si") (V4DI "v2di")
756 (V16QI "v8qi") (V8HI "v4hi") (V4SI "v2si")
757 (V16SF "v8sf") (V8DF "v4df")
758 (V8SF "v4sf") (V4DF "v2df")
761 ;; Mapping of vector modes ti packed single mode of the same size
762 (define_mode_attr ssePSmode
763 [(V16SI "V16SF") (V8DF "V16SF")
764 (V16SF "V16SF") (V8DI "V16SF")
765 (V64QI "V16SF") (V32QI "V8SF") (V16QI "V4SF")
766 (V32HI "V16SF") (V16HI "V8SF") (V8HI "V4SF")
767 (V8SI "V8SF") (V4SI "V4SF")
768 (V4DI "V8SF") (V2DI "V4SF")
769 (V4TI "V16SF") (V2TI "V8SF") (V1TI "V4SF")
770 (V8SF "V8SF") (V4SF "V4SF")
771 (V4DF "V8SF") (V2DF "V4SF")])
773 (define_mode_attr ssePSmode2
774 [(V8DI "V8SF") (V4DI "V4SF")])
776 ;; Mapping of vector modes back to the scalar modes
777 (define_mode_attr ssescalarmode
778 [(V64QI "QI") (V32QI "QI") (V16QI "QI")
779 (V32HI "HI") (V16HI "HI") (V8HI "HI")
780 (V16SI "SI") (V8SI "SI") (V4SI "SI")
781 (V8DI "DI") (V4DI "DI") (V2DI "DI")
782 (V16SF "SF") (V8SF "SF") (V4SF "SF")
783 (V8DF "DF") (V4DF "DF") (V2DF "DF")
784 (V4TI "TI") (V2TI "TI")])
786 ;; Mapping of vector modes back to the scalar modes
787 (define_mode_attr ssescalarmodelower
788 [(V64QI "qi") (V32QI "qi") (V16QI "qi")
789 (V32HI "hi") (V16HI "hi") (V8HI "hi")
790 (V16SI "si") (V8SI "si") (V4SI "si")
791 (V8DI "di") (V4DI "di") (V2DI "di")
792 (V16SF "sf") (V8SF "sf") (V4SF "sf")
793 (V8DF "df") (V4DF "df") (V2DF "df")
794 (V4TI "ti") (V2TI "ti")])
796 ;; Mapping of vector modes to the 128bit modes
797 (define_mode_attr ssexmmmode
798 [(V64QI "V16QI") (V32QI "V16QI") (V16QI "V16QI")
799 (V32HI "V8HI") (V16HI "V8HI") (V8HI "V8HI")
800 (V16SI "V4SI") (V8SI "V4SI") (V4SI "V4SI")
801 (V8DI "V2DI") (V4DI "V2DI") (V2DI "V2DI")
802 (V16SF "V4SF") (V8SF "V4SF") (V4SF "V4SF")
803 (V8DF "V2DF") (V4DF "V2DF") (V2DF "V2DF")])
805 ;; Pointer size override for scalar modes (Intel asm dialect)
806 (define_mode_attr iptr
807 [(V64QI "b") (V32HI "w") (V16SI "k") (V8DI "q")
808 (V32QI "b") (V16HI "w") (V8SI "k") (V4DI "q")
809 (V16QI "b") (V8HI "w") (V4SI "k") (V2DI "q")
810 (V16SF "k") (V8DF "q")
811 (V8SF "k") (V4DF "q")
812 (V4SF "k") (V2DF "q")
815 ;; Number of scalar elements in each vector type
816 (define_mode_attr ssescalarnum
817 [(V64QI "64") (V16SI "16") (V8DI "8")
818 (V32QI "32") (V16HI "16") (V8SI "8") (V4DI "4")
819 (V16QI "16") (V8HI "8") (V4SI "4") (V2DI "2")
820 (V16SF "16") (V8DF "8")
821 (V8SF "8") (V4DF "4")
822 (V4SF "4") (V2DF "2")])
824 ;; Mask of scalar elements in each vector type
825 (define_mode_attr ssescalarnummask
826 [(V32QI "31") (V16HI "15") (V8SI "7") (V4DI "3")
827 (V16QI "15") (V8HI "7") (V4SI "3") (V2DI "1")
828 (V8SF "7") (V4DF "3")
829 (V4SF "3") (V2DF "1")])
831 (define_mode_attr ssescalarsize
832 [(V4TI "64") (V2TI "64") (V1TI "64")
833 (V8DI "64") (V4DI "64") (V2DI "64")
834 (V64QI "8") (V32QI "8") (V16QI "8")
835 (V32HI "16") (V16HI "16") (V8HI "16")
836 (V16SI "32") (V8SI "32") (V4SI "32")
837 (V16SF "32") (V8SF "32") (V4SF "32")
838 (V8DF "64") (V4DF "64") (V2DF "64")])
840 ;; SSE prefix for integer vector modes
841 (define_mode_attr sseintprefix
842 [(V2DI "p") (V2DF "")
847 (V16SI "p") (V16SF "")
848 (V16QI "p") (V8HI "p")
849 (V32QI "p") (V16HI "p")
850 (V64QI "p") (V32HI "p")])
852 ;; SSE scalar suffix for vector modes
853 (define_mode_attr ssescalarmodesuffix
855 (V16SF "ss") (V8DF "sd")
856 (V8SF "ss") (V4DF "sd")
857 (V4SF "ss") (V2DF "sd")
858 (V16SI "d") (V8DI "q")
859 (V8SI "d") (V4DI "q")
860 (V4SI "d") (V2DI "q")])
862 ;; Pack/unpack vector modes
863 (define_mode_attr sseunpackmode
864 [(V16QI "V8HI") (V8HI "V4SI") (V4SI "V2DI")
865 (V32QI "V16HI") (V16HI "V8SI") (V8SI "V4DI")
866 (V32HI "V16SI") (V64QI "V32HI") (V16SI "V8DI")])
868 (define_mode_attr ssepackmode
869 [(V8HI "V16QI") (V4SI "V8HI") (V2DI "V4SI")
870 (V16HI "V32QI") (V8SI "V16HI") (V4DI "V8SI")
871 (V32HI "V64QI") (V16SI "V32HI") (V8DI "V16SI")])
873 ;; Mapping of the max integer size for xop rotate immediate constraint
874 (define_mode_attr sserotatemax
875 [(V16QI "7") (V8HI "15") (V4SI "31") (V2DI "63")])
877 ;; Mapping of mode to cast intrinsic name
878 (define_mode_attr castmode
879 [(V8SI "si") (V8SF "ps") (V4DF "pd")
880 (V16SI "si") (V16SF "ps") (V8DF "pd")])
882 ;; Instruction suffix for sign and zero extensions.
883 (define_code_attr extsuffix [(sign_extend "sx") (zero_extend "zx")])
885 ;; i128 for integer vectors and TARGET_AVX2, f128 otherwise.
886 ;; i64x4 or f64x4 for 512bit modes.
887 (define_mode_attr i128
888 [(V16SF "f64x4") (V8SF "f128") (V8DF "f64x4") (V4DF "f128")
889 (V64QI "i64x4") (V32QI "%~128") (V32HI "i64x4") (V16HI "%~128")
890 (V16SI "i64x4") (V8SI "%~128") (V8DI "i64x4") (V4DI "%~128")])
892 ;; For 256-bit modes for TARGET_AVX512VL && TARGET_AVX512DQ
893 ;; i32x4, f32x4, i64x2 or f64x2 suffixes.
894 (define_mode_attr i128vldq
895 [(V8SF "f32x4") (V4DF "f64x2")
896 (V32QI "i32x4") (V16HI "i32x4") (V8SI "i32x4") (V4DI "i64x2")])
899 (define_mode_iterator AVX256MODE2P [V8SI V8SF V4DF])
900 (define_mode_iterator AVX512MODE2P [V16SI V16SF V8DF])
902 ;; Mapping for dbpsabbw modes
903 (define_mode_attr dbpsadbwmode
904 [(V32HI "V64QI") (V16HI "V32QI") (V8HI "V16QI")])
906 ;; Mapping suffixes for broadcast
907 (define_mode_attr bcstscalarsuff
908 [(V64QI "b") (V32QI "b") (V16QI "b")
909 (V32HI "w") (V16HI "w") (V8HI "w")
910 (V16SI "d") (V8SI "d") (V4SI "d")
911 (V8DI "q") (V4DI "q") (V2DI "q")
912 (V16SF "ss") (V8SF "ss") (V4SF "ss")
913 (V8DF "sd") (V4DF "sd") (V2DF "sd")])
915 ;; Tie mode of assembler operand to mode iterator
916 (define_mode_attr concat_tg_mode
917 [(V32QI "t") (V16HI "t") (V8SI "t") (V4DI "t") (V8SF "t") (V4DF "t")
918 (V64QI "g") (V32HI "g") (V16SI "g") (V8DI "g") (V16SF "g") (V8DF "g")])
920 ;; Tie mode of assembler operand to mode iterator
921 (define_mode_attr xtg_mode
922 [(V16QI "x") (V8HI "x") (V4SI "x") (V2DI "x") (V4SF "x") (V2DF "x")
923 (V32QI "t") (V16HI "t") (V8SI "t") (V4DI "t") (V8SF "t") (V4DF "t")
924 (V64QI "g") (V32HI "g") (V16SI "g") (V8DI "g") (V16SF "g") (V8DF "g")])
926 ;; Half mask mode for unpacks
927 (define_mode_attr HALFMASKMODE
928 [(DI "SI") (SI "HI")])
930 ;; Double mask mode for packs
931 (define_mode_attr DOUBLEMASKMODE
932 [(HI "SI") (SI "DI")])
935 ;; Include define_subst patterns for instructions with mask
938 ;; Patterns whose name begins with "sse{,2,3}_" are invoked by intrinsics.
940 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
944 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
946 ;; All of these patterns are enabled for SSE1 as well as SSE2.
947 ;; This is essential for maintaining stable calling conventions.
949 (define_expand "mov<mode>"
950 [(set (match_operand:VMOVE 0 "nonimmediate_operand")
951 (match_operand:VMOVE 1 "nonimmediate_operand"))]
954 ix86_expand_vector_move (<MODE>mode, operands);
958 (define_insn "mov<mode>_internal"
959 [(set (match_operand:VMOVE 0 "nonimmediate_operand"
961 (match_operand:VMOVE 1 "nonimmediate_or_sse_const_operand"
964 && (register_operand (operands[0], <MODE>mode)
965 || register_operand (operands[1], <MODE>mode))"
967 switch (get_attr_type (insn))
970 return standard_sse_constant_opcode (insn, operands);
973 /* There is no evex-encoded vmov* for sizes smaller than 64-bytes
974 in avx512f, so we need to use workarounds, to access sse registers
975 16-31, which are evex-only. In avx512vl we don't need workarounds. */
976 if (TARGET_AVX512F && <MODE_SIZE> < 64 && !TARGET_AVX512VL
977 && (EXT_REX_SSE_REG_P (operands[0])
978 || EXT_REX_SSE_REG_P (operands[1])))
980 if (memory_operand (operands[0], <MODE>mode))
982 if (<MODE_SIZE> == 32)
983 return "vextract<shuffletype>64x4\t{$0x0, %g1, %0|%0, %g1, 0x0}";
984 else if (<MODE_SIZE> == 16)
985 return "vextract<shuffletype>32x4\t{$0x0, %g1, %0|%0, %g1, 0x0}";
989 else if (memory_operand (operands[1], <MODE>mode))
991 if (<MODE_SIZE> == 32)
992 return "vbroadcast<shuffletype>64x4\t{%1, %g0|%g0, %1}";
993 else if (<MODE_SIZE> == 16)
994 return "vbroadcast<shuffletype>32x4\t{%1, %g0|%g0, %1}";
999 /* Reg -> reg move is always aligned. Just use wider move. */
1000 switch (get_attr_mode (insn))
1004 return "vmovaps\t{%g1, %g0|%g0, %g1}";
1007 return "vmovapd\t{%g1, %g0|%g0, %g1}";
1010 return "vmovdqa64\t{%g1, %g0|%g0, %g1}";
1016 switch (get_attr_mode (insn))
1021 if (misaligned_operand (operands[0], <MODE>mode)
1022 || misaligned_operand (operands[1], <MODE>mode))
1023 return "%vmovups\t{%1, %0|%0, %1}";
1025 return "%vmovaps\t{%1, %0|%0, %1}";
1030 if (misaligned_operand (operands[0], <MODE>mode)
1031 || misaligned_operand (operands[1], <MODE>mode))
1032 return "%vmovupd\t{%1, %0|%0, %1}";
1034 return "%vmovapd\t{%1, %0|%0, %1}";
1038 if (misaligned_operand (operands[0], <MODE>mode)
1039 || misaligned_operand (operands[1], <MODE>mode))
1040 return TARGET_AVX512VL
1041 && (<MODE>mode == V4SImode
1042 || <MODE>mode == V2DImode
1043 || <MODE>mode == V8SImode
1044 || <MODE>mode == V4DImode
1046 ? "vmovdqu<ssescalarsize>\t{%1, %0|%0, %1}"
1047 : "%vmovdqu\t{%1, %0|%0, %1}";
1049 return TARGET_AVX512VL ? "vmovdqa64\t{%1, %0|%0, %1}"
1050 : "%vmovdqa\t{%1, %0|%0, %1}";
1052 if (misaligned_operand (operands[0], <MODE>mode)
1053 || misaligned_operand (operands[1], <MODE>mode))
1054 return (<MODE>mode == V16SImode
1055 || <MODE>mode == V8DImode
1057 ? "vmovdqu<ssescalarsize>\t{%1, %0|%0, %1}"
1058 : "vmovdqu64\t{%1, %0|%0, %1}";
1060 return "vmovdqa64\t{%1, %0|%0, %1}";
1070 [(set_attr "type" "sselog1,sselog1,ssemov,ssemov")
1071 (set_attr "prefix" "maybe_vex")
1073 (cond [(and (eq_attr "alternative" "1")
1074 (match_test "TARGET_AVX512VL"))
1075 (const_string "<sseinsnmode>")
1076 (and (match_test "<MODE_SIZE> == 16")
1077 (ior (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
1078 (and (eq_attr "alternative" "3")
1079 (match_test "TARGET_SSE_TYPELESS_STORES"))))
1080 (const_string "<ssePSmode>")
1081 (match_test "TARGET_AVX")
1082 (const_string "<sseinsnmode>")
1083 (ior (not (match_test "TARGET_SSE2"))
1084 (match_test "optimize_function_for_size_p (cfun)"))
1085 (const_string "V4SF")
1086 (and (eq_attr "alternative" "0")
1087 (match_test "TARGET_SSE_LOAD0_BY_PXOR"))
1090 (const_string "<sseinsnmode>")))
1091 (set (attr "enabled")
1092 (cond [(and (match_test "<MODE_SIZE> == 16")
1093 (eq_attr "alternative" "1"))
1094 (symbol_ref "TARGET_SSE2")
1095 (and (match_test "<MODE_SIZE> == 32")
1096 (eq_attr "alternative" "1"))
1097 (symbol_ref "TARGET_AVX2")
1099 (symbol_ref "true")))])
1101 (define_insn "<avx512>_load<mode>_mask"
1102 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v,v")
1103 (vec_merge:V48_AVX512VL
1104 (match_operand:V48_AVX512VL 1 "nonimmediate_operand" "v,m")
1105 (match_operand:V48_AVX512VL 2 "vector_move_operand" "0C,0C")
1106 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
1109 if (FLOAT_MODE_P (GET_MODE_INNER (<MODE>mode)))
1111 if (misaligned_operand (operands[1], <MODE>mode))
1112 return "vmovu<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
1114 return "vmova<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
1118 if (misaligned_operand (operands[1], <MODE>mode))
1119 return "vmovdqu<ssescalarsize>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
1121 return "vmovdqa<ssescalarsize>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
1124 [(set_attr "type" "ssemov")
1125 (set_attr "prefix" "evex")
1126 (set_attr "memory" "none,load")
1127 (set_attr "mode" "<sseinsnmode>")])
1129 (define_insn "<avx512>_load<mode>_mask"
1130 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v,v")
1131 (vec_merge:VI12_AVX512VL
1132 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "v,m")
1133 (match_operand:VI12_AVX512VL 2 "vector_move_operand" "0C,0C")
1134 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
1136 "vmovdqu<ssescalarsize>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
1137 [(set_attr "type" "ssemov")
1138 (set_attr "prefix" "evex")
1139 (set_attr "memory" "none,load")
1140 (set_attr "mode" "<sseinsnmode>")])
1142 (define_insn "<avx512>_blendm<mode>"
1143 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v")
1144 (vec_merge:V48_AVX512VL
1145 (match_operand:V48_AVX512VL 2 "nonimmediate_operand" "vm")
1146 (match_operand:V48_AVX512VL 1 "register_operand" "v")
1147 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
1149 "v<sseintprefix>blendm<ssemodesuffix>\t{%2, %1, %0%{%3%}|%0%{%3%}, %1, %2}"
1150 [(set_attr "type" "ssemov")
1151 (set_attr "prefix" "evex")
1152 (set_attr "mode" "<sseinsnmode>")])
1154 (define_insn "<avx512>_blendm<mode>"
1155 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
1156 (vec_merge:VI12_AVX512VL
1157 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")
1158 (match_operand:VI12_AVX512VL 1 "register_operand" "v")
1159 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
1161 "vpblendm<ssemodesuffix>\t{%2, %1, %0%{%3%}|%0%{%3%}, %1, %2}"
1162 [(set_attr "type" "ssemov")
1163 (set_attr "prefix" "evex")
1164 (set_attr "mode" "<sseinsnmode>")])
1166 (define_insn "<avx512>_store<mode>_mask"
1167 [(set (match_operand:V48_AVX512VL 0 "memory_operand" "=m")
1168 (vec_merge:V48_AVX512VL
1169 (match_operand:V48_AVX512VL 1 "register_operand" "v")
1171 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")))]
1174 if (FLOAT_MODE_P (GET_MODE_INNER (<MODE>mode)))
1176 if (misaligned_operand (operands[0], <MODE>mode))
1177 return "vmovu<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1179 return "vmova<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1183 if (misaligned_operand (operands[0], <MODE>mode))
1184 return "vmovdqu<ssescalarsize>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1186 return "vmovdqa<ssescalarsize>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1189 [(set_attr "type" "ssemov")
1190 (set_attr "prefix" "evex")
1191 (set_attr "memory" "store")
1192 (set_attr "mode" "<sseinsnmode>")])
1194 (define_insn "<avx512>_store<mode>_mask"
1195 [(set (match_operand:VI12_AVX512VL 0 "memory_operand" "=m")
1196 (vec_merge:VI12_AVX512VL
1197 (match_operand:VI12_AVX512VL 1 "register_operand" "v")
1199 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")))]
1201 "vmovdqu<ssescalarsize>\t{%1, %0%{%2%}|%0%{%2%}, %1}"
1202 [(set_attr "type" "ssemov")
1203 (set_attr "prefix" "evex")
1204 (set_attr "memory" "store")
1205 (set_attr "mode" "<sseinsnmode>")])
1207 (define_insn "sse2_movq128"
1208 [(set (match_operand:V2DI 0 "register_operand" "=v")
1211 (match_operand:V2DI 1 "nonimmediate_operand" "vm")
1212 (parallel [(const_int 0)]))
1215 "%vmovq\t{%1, %0|%0, %q1}"
1216 [(set_attr "type" "ssemov")
1217 (set_attr "prefix" "maybe_vex")
1218 (set_attr "mode" "TI")])
1220 ;; Move a DI from a 32-bit register pair (e.g. %edx:%eax) to an xmm.
1221 ;; We'd rather avoid this entirely; if the 32-bit reg pair was loaded
1222 ;; from memory, we'd prefer to load the memory directly into the %xmm
1223 ;; register. To facilitate this happy circumstance, this pattern won't
1224 ;; split until after register allocation. If the 64-bit value didn't
1225 ;; come from memory, this is the best we can do. This is much better
1226 ;; than storing %edx:%eax into a stack temporary and loading an %xmm
1229 (define_insn_and_split "movdi_to_sse"
1231 [(set (match_operand:V4SI 0 "register_operand" "=?x,x")
1232 (subreg:V4SI (match_operand:DI 1 "nonimmediate_operand" "r,m") 0))
1233 (clobber (match_scratch:V4SI 2 "=&x,X"))])]
1234 "!TARGET_64BIT && TARGET_SSE2 && TARGET_INTER_UNIT_MOVES_TO_VEC"
1236 "&& reload_completed"
1239 if (register_operand (operands[1], DImode))
1241 /* The DImode arrived in a pair of integral registers (e.g. %edx:%eax).
1242 Assemble the 64-bit DImode value in an xmm register. */
1243 emit_insn (gen_sse2_loadld (operands[0], CONST0_RTX (V4SImode),
1244 gen_lowpart (SImode, operands[1])));
1245 emit_insn (gen_sse2_loadld (operands[2], CONST0_RTX (V4SImode),
1246 gen_highpart (SImode, operands[1])));
1247 emit_insn (gen_vec_interleave_lowv4si (operands[0], operands[0],
1250 else if (memory_operand (operands[1], DImode))
1252 rtx tmp = gen_reg_rtx (V2DImode);
1253 emit_insn (gen_vec_concatv2di (tmp, operands[1], const0_rtx));
1254 emit_move_insn (operands[0], gen_lowpart (V4SImode, tmp));
1262 [(set (match_operand:V4SF 0 "register_operand")
1263 (match_operand:V4SF 1 "zero_extended_scalar_load_operand"))]
1264 "TARGET_SSE && reload_completed"
1267 (vec_duplicate:V4SF (match_dup 1))
1271 operands[1] = gen_lowpart (SFmode, operands[1]);
1272 operands[2] = CONST0_RTX (V4SFmode);
1276 [(set (match_operand:V2DF 0 "register_operand")
1277 (match_operand:V2DF 1 "zero_extended_scalar_load_operand"))]
1278 "TARGET_SSE2 && reload_completed"
1279 [(set (match_dup 0) (vec_concat:V2DF (match_dup 1) (match_dup 2)))]
1281 operands[1] = gen_lowpart (DFmode, operands[1]);
1282 operands[2] = CONST0_RTX (DFmode);
1285 (define_expand "movmisalign<mode>"
1286 [(set (match_operand:VMOVE 0 "nonimmediate_operand")
1287 (match_operand:VMOVE 1 "nonimmediate_operand"))]
1290 ix86_expand_vector_move_misalign (<MODE>mode, operands);
1294 ;; Merge movsd/movhpd to movupd for TARGET_SSE_UNALIGNED_LOAD_OPTIMAL targets.
1296 [(set (match_operand:V2DF 0 "sse_reg_operand")
1297 (vec_concat:V2DF (match_operand:DF 1 "memory_operand")
1298 (match_operand:DF 4 "const0_operand")))
1299 (set (match_operand:V2DF 2 "sse_reg_operand")
1300 (vec_concat:V2DF (vec_select:DF (match_dup 2)
1301 (parallel [(const_int 0)]))
1302 (match_operand:DF 3 "memory_operand")))]
1303 "TARGET_SSE2 && TARGET_SSE_UNALIGNED_LOAD_OPTIMAL
1304 && ix86_operands_ok_for_move_multiple (operands, true, DFmode)"
1305 [(set (match_dup 2) (match_dup 5))]
1306 "operands[5] = adjust_address (operands[1], V2DFmode, 0);")
1309 [(set (match_operand:DF 0 "sse_reg_operand")
1310 (match_operand:DF 1 "memory_operand"))
1311 (set (match_operand:V2DF 2 "sse_reg_operand")
1312 (vec_concat:V2DF (match_operand:DF 4 "sse_reg_operand")
1313 (match_operand:DF 3 "memory_operand")))]
1314 "TARGET_SSE2 && TARGET_SSE_UNALIGNED_LOAD_OPTIMAL
1315 && REGNO (operands[4]) == REGNO (operands[2])
1316 && ix86_operands_ok_for_move_multiple (operands, true, DFmode)"
1317 [(set (match_dup 2) (match_dup 5))]
1318 "operands[5] = adjust_address (operands[1], V2DFmode, 0);")
1320 ;; Merge movlpd/movhpd to movupd for TARGET_SSE_UNALIGNED_STORE_OPTIMAL targets.
1322 [(set (match_operand:DF 0 "memory_operand")
1323 (vec_select:DF (match_operand:V2DF 1 "sse_reg_operand")
1324 (parallel [(const_int 0)])))
1325 (set (match_operand:DF 2 "memory_operand")
1326 (vec_select:DF (match_operand:V2DF 3 "sse_reg_operand")
1327 (parallel [(const_int 1)])))]
1328 "TARGET_SSE2 && TARGET_SSE_UNALIGNED_STORE_OPTIMAL
1329 && ix86_operands_ok_for_move_multiple (operands, false, DFmode)"
1330 [(set (match_dup 4) (match_dup 1))]
1331 "operands[4] = adjust_address (operands[0], V2DFmode, 0);")
1333 (define_insn "<sse3>_lddqu<avxsizesuffix>"
1334 [(set (match_operand:VI1 0 "register_operand" "=x")
1335 (unspec:VI1 [(match_operand:VI1 1 "memory_operand" "m")]
1338 "%vlddqu\t{%1, %0|%0, %1}"
1339 [(set_attr "type" "ssemov")
1340 (set_attr "movu" "1")
1341 (set (attr "prefix_data16")
1343 (match_test "TARGET_AVX")
1345 (const_string "0")))
1346 (set (attr "prefix_rep")
1348 (match_test "TARGET_AVX")
1350 (const_string "1")))
1351 (set_attr "prefix" "maybe_vex")
1352 (set_attr "mode" "<sseinsnmode>")])
1354 (define_insn "sse2_movnti<mode>"
1355 [(set (match_operand:SWI48 0 "memory_operand" "=m")
1356 (unspec:SWI48 [(match_operand:SWI48 1 "register_operand" "r")]
1359 "movnti\t{%1, %0|%0, %1}"
1360 [(set_attr "type" "ssemov")
1361 (set_attr "prefix_data16" "0")
1362 (set_attr "mode" "<MODE>")])
1364 (define_insn "<sse>_movnt<mode>"
1365 [(set (match_operand:VF 0 "memory_operand" "=m")
1367 [(match_operand:VF 1 "register_operand" "v")]
1370 "%vmovnt<ssemodesuffix>\t{%1, %0|%0, %1}"
1371 [(set_attr "type" "ssemov")
1372 (set_attr "prefix" "maybe_vex")
1373 (set_attr "mode" "<MODE>")])
1375 (define_insn "<sse2>_movnt<mode>"
1376 [(set (match_operand:VI8 0 "memory_operand" "=m")
1377 (unspec:VI8 [(match_operand:VI8 1 "register_operand" "v")]
1380 "%vmovntdq\t{%1, %0|%0, %1}"
1381 [(set_attr "type" "ssecvt")
1382 (set (attr "prefix_data16")
1384 (match_test "TARGET_AVX")
1386 (const_string "1")))
1387 (set_attr "prefix" "maybe_vex")
1388 (set_attr "mode" "<sseinsnmode>")])
1390 ; Expand patterns for non-temporal stores. At the moment, only those
1391 ; that directly map to insns are defined; it would be possible to
1392 ; define patterns for other modes that would expand to several insns.
1394 ;; Modes handled by storent patterns.
1395 (define_mode_iterator STORENT_MODE
1396 [(DI "TARGET_SSE2 && TARGET_64BIT") (SI "TARGET_SSE2")
1397 (SF "TARGET_SSE4A") (DF "TARGET_SSE4A")
1398 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") (V2DI "TARGET_SSE2")
1399 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
1400 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
1402 (define_expand "storent<mode>"
1403 [(set (match_operand:STORENT_MODE 0 "memory_operand")
1404 (unspec:STORENT_MODE
1405 [(match_operand:STORENT_MODE 1 "register_operand")]
1409 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1413 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1415 ;; All integer modes with AVX512BW/DQ.
1416 (define_mode_iterator SWI1248_AVX512BWDQ
1417 [(QI "TARGET_AVX512DQ") HI (SI "TARGET_AVX512BW") (DI "TARGET_AVX512BW")])
1419 ;; All integer modes with AVX512BW, where HImode operation
1420 ;; can be used instead of QImode.
1421 (define_mode_iterator SWI1248_AVX512BW
1422 [QI HI (SI "TARGET_AVX512BW") (DI "TARGET_AVX512BW")])
1424 ;; All integer modes with AVX512BW/DQ, even HImode requires DQ.
1425 (define_mode_iterator SWI1248_AVX512BWDQ2
1426 [(QI "TARGET_AVX512DQ") (HI "TARGET_AVX512DQ")
1427 (SI "TARGET_AVX512BW") (DI "TARGET_AVX512BW")])
1429 (define_expand "kmov<mskmodesuffix>"
1430 [(set (match_operand:SWI1248_AVX512BWDQ 0 "nonimmediate_operand")
1431 (match_operand:SWI1248_AVX512BWDQ 1 "nonimmediate_operand"))]
1433 && !(MEM_P (operands[0]) && MEM_P (operands[1]))")
1435 (define_insn "k<code><mode>"
1436 [(set (match_operand:SWI1248_AVX512BW 0 "register_operand" "=k")
1437 (any_logic:SWI1248_AVX512BW
1438 (match_operand:SWI1248_AVX512BW 1 "register_operand" "k")
1439 (match_operand:SWI1248_AVX512BW 2 "register_operand" "k")))
1440 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1443 if (get_attr_mode (insn) == MODE_HI)
1444 return "k<logic>w\t{%2, %1, %0|%0, %1, %2}";
1446 return "k<logic><mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}";
1448 [(set_attr "type" "msklog")
1449 (set_attr "prefix" "vex")
1451 (cond [(and (match_test "<MODE>mode == QImode")
1452 (not (match_test "TARGET_AVX512DQ")))
1455 (const_string "<MODE>")))])
1457 (define_insn "kandn<mode>"
1458 [(set (match_operand:SWI1248_AVX512BW 0 "register_operand" "=k")
1459 (and:SWI1248_AVX512BW
1460 (not:SWI1248_AVX512BW
1461 (match_operand:SWI1248_AVX512BW 1 "register_operand" "k"))
1462 (match_operand:SWI1248_AVX512BW 2 "register_operand" "k")))
1463 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1466 if (get_attr_mode (insn) == MODE_HI)
1467 return "kandnw\t{%2, %1, %0|%0, %1, %2}";
1469 return "kandn<mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}";
1471 [(set_attr "type" "msklog")
1472 (set_attr "prefix" "vex")
1474 (cond [(and (match_test "<MODE>mode == QImode")
1475 (not (match_test "TARGET_AVX512DQ")))
1478 (const_string "<MODE>")))])
1480 (define_insn "kxnor<mode>"
1481 [(set (match_operand:SWI1248_AVX512BW 0 "register_operand" "=k")
1482 (not:SWI1248_AVX512BW
1483 (xor:SWI1248_AVX512BW
1484 (match_operand:SWI1248_AVX512BW 1 "register_operand" "k")
1485 (match_operand:SWI1248_AVX512BW 2 "register_operand" "k"))))
1486 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1489 if (get_attr_mode (insn) == MODE_HI)
1490 return "kxnorw\t{%2, %1, %0|%0, %1, %2}";
1492 return "kxnor<mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}";
1494 [(set_attr "type" "msklog")
1495 (set_attr "prefix" "vex")
1497 (cond [(and (match_test "<MODE>mode == QImode")
1498 (not (match_test "TARGET_AVX512DQ")))
1501 (const_string "<MODE>")))])
1503 (define_insn "knot<mode>"
1504 [(set (match_operand:SWI1248_AVX512BW 0 "register_operand" "=k")
1505 (not:SWI1248_AVX512BW
1506 (match_operand:SWI1248_AVX512BW 1 "register_operand" "k")))
1507 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1510 if (get_attr_mode (insn) == MODE_HI)
1511 return "knotw\t{%1, %0|%0, %1}";
1513 return "knot<mskmodesuffix>\t{%1, %0|%0, %1}";
1515 [(set_attr "type" "msklog")
1516 (set_attr "prefix" "vex")
1518 (cond [(and (match_test "<MODE>mode == QImode")
1519 (not (match_test "TARGET_AVX512DQ")))
1522 (const_string "<MODE>")))])
1524 (define_insn "kadd<mode>"
1525 [(set (match_operand:SWI1248_AVX512BWDQ2 0 "register_operand" "=k")
1526 (plus:SWI1248_AVX512BWDQ2
1527 (match_operand:SWI1248_AVX512BWDQ2 1 "register_operand" "k")
1528 (match_operand:SWI1248_AVX512BWDQ2 2 "register_operand" "k")))
1529 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1531 "kadd<mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}"
1532 [(set_attr "type" "msklog")
1533 (set_attr "prefix" "vex")
1534 (set_attr "mode" "<MODE>")])
1536 ;; Mask variant shift mnemonics
1537 (define_code_attr mshift [(ashift "shiftl") (lshiftrt "shiftr")])
1539 (define_insn "k<code><mode>"
1540 [(set (match_operand:SWI1248_AVX512BWDQ 0 "register_operand" "=k")
1541 (any_lshift:SWI1248_AVX512BWDQ
1542 (match_operand:SWI1248_AVX512BWDQ 1 "register_operand" "k")
1543 (match_operand:QI 2 "immediate_operand" "n")))
1544 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1546 "k<mshift><mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}"
1547 [(set_attr "type" "msklog")
1548 (set_attr "prefix" "vex")
1549 (set_attr "mode" "<MODE>")])
1551 (define_insn "ktest<mode>"
1552 [(set (reg:CC FLAGS_REG)
1554 [(match_operand:SWI1248_AVX512BWDQ2 0 "register_operand" "k")
1555 (match_operand:SWI1248_AVX512BWDQ2 1 "register_operand" "k")]
1558 "ktest<mskmodesuffix>\t{%1, %0|%0, %1}"
1559 [(set_attr "mode" "<MODE>")
1560 (set_attr "type" "msklog")
1561 (set_attr "prefix" "vex")])
1563 (define_insn "kortest<mode>"
1564 [(set (reg:CC FLAGS_REG)
1566 [(match_operand:SWI1248_AVX512BWDQ 0 "register_operand" "k")
1567 (match_operand:SWI1248_AVX512BWDQ 1 "register_operand" "k")]
1570 "kortest<mskmodesuffix>\t{%1, %0|%0, %1}"
1571 [(set_attr "mode" "<MODE>")
1572 (set_attr "type" "msklog")
1573 (set_attr "prefix" "vex")])
1575 (define_insn "kunpckhi"
1576 [(set (match_operand:HI 0 "register_operand" "=k")
1579 (zero_extend:HI (match_operand:QI 1 "register_operand" "k"))
1581 (zero_extend:HI (match_operand:QI 2 "register_operand" "k"))))]
1583 "kunpckbw\t{%2, %1, %0|%0, %1, %2}"
1584 [(set_attr "mode" "HI")
1585 (set_attr "type" "msklog")
1586 (set_attr "prefix" "vex")])
1588 (define_insn "kunpcksi"
1589 [(set (match_operand:SI 0 "register_operand" "=k")
1592 (zero_extend:SI (match_operand:HI 1 "register_operand" "k"))
1594 (zero_extend:SI (match_operand:HI 2 "register_operand" "k"))))]
1596 "kunpckwd\t{%2, %1, %0|%0, %1, %2}"
1597 [(set_attr "mode" "SI")])
1599 (define_insn "kunpckdi"
1600 [(set (match_operand:DI 0 "register_operand" "=k")
1603 (zero_extend:DI (match_operand:SI 1 "register_operand" "k"))
1605 (zero_extend:DI (match_operand:SI 2 "register_operand" "k"))))]
1607 "kunpckdq\t{%2, %1, %0|%0, %1, %2}"
1608 [(set_attr "mode" "DI")])
1611 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1613 ;; Parallel floating point arithmetic
1615 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1617 (define_expand "<code><mode>2"
1618 [(set (match_operand:VF 0 "register_operand")
1620 (match_operand:VF 1 "register_operand")))]
1622 "ix86_expand_fp_absneg_operator (<CODE>, <MODE>mode, operands); DONE;")
1624 (define_insn_and_split "*absneg<mode>2"
1625 [(set (match_operand:VF 0 "register_operand" "=x,x,v,v")
1626 (match_operator:VF 3 "absneg_operator"
1627 [(match_operand:VF 1 "vector_operand" "0, xBm,v, m")]))
1628 (use (match_operand:VF 2 "vector_operand" "xBm,0, vm,v"))]
1631 "&& reload_completed"
1634 enum rtx_code absneg_op;
1640 if (MEM_P (operands[1]))
1641 op1 = operands[2], op2 = operands[1];
1643 op1 = operands[1], op2 = operands[2];
1648 if (rtx_equal_p (operands[0], operands[1]))
1654 absneg_op = GET_CODE (operands[3]) == NEG ? XOR : AND;
1655 t = gen_rtx_fmt_ee (absneg_op, <MODE>mode, op1, op2);
1656 t = gen_rtx_SET (operands[0], t);
1660 [(set_attr "isa" "noavx,noavx,avx,avx")])
1662 (define_expand "<plusminus_insn><mode>3<mask_name><round_name>"
1663 [(set (match_operand:VF 0 "register_operand")
1665 (match_operand:VF 1 "<round_nimm_predicate>")
1666 (match_operand:VF 2 "<round_nimm_predicate>")))]
1667 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1668 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
1670 (define_insn "*<plusminus_insn><mode>3<mask_name><round_name>"
1671 [(set (match_operand:VF 0 "register_operand" "=x,v")
1673 (match_operand:VF 1 "<round_nimm_predicate>" "<comm>0,v")
1674 (match_operand:VF 2 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
1675 "TARGET_SSE && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)
1676 && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1678 <plusminus_mnemonic><ssemodesuffix>\t{%2, %0|%0, %2}
1679 v<plusminus_mnemonic><ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
1680 [(set_attr "isa" "noavx,avx")
1681 (set_attr "type" "sseadd")
1682 (set_attr "prefix" "<mask_prefix3>")
1683 (set_attr "mode" "<MODE>")])
1685 (define_insn "<sse>_vm<plusminus_insn><mode>3<mask_scalar_name><round_scalar_name>"
1686 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
1689 (match_operand:VF_128 1 "register_operand" "0,v")
1690 (match_operand:VF_128 2 "vector_operand" "xBm,<round_scalar_constraint>"))
1695 <plusminus_mnemonic><ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
1696 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>}"
1697 [(set_attr "isa" "noavx,avx")
1698 (set_attr "type" "sseadd")
1699 (set_attr "prefix" "<round_scalar_prefix>")
1700 (set_attr "mode" "<ssescalarmode>")])
1702 (define_expand "mul<mode>3<mask_name><round_name>"
1703 [(set (match_operand:VF 0 "register_operand")
1705 (match_operand:VF 1 "<round_nimm_predicate>")
1706 (match_operand:VF 2 "<round_nimm_predicate>")))]
1707 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1708 "ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);")
1710 (define_insn "*mul<mode>3<mask_name><round_name>"
1711 [(set (match_operand:VF 0 "register_operand" "=x,v")
1713 (match_operand:VF 1 "<round_nimm_predicate>" "%0,v")
1714 (match_operand:VF 2 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
1716 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
1717 && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1719 mul<ssemodesuffix>\t{%2, %0|%0, %2}
1720 vmul<ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
1721 [(set_attr "isa" "noavx,avx")
1722 (set_attr "type" "ssemul")
1723 (set_attr "prefix" "<mask_prefix3>")
1724 (set_attr "btver2_decode" "direct,double")
1725 (set_attr "mode" "<MODE>")])
1727 (define_insn "<sse>_vm<multdiv_mnemonic><mode>3<mask_scalar_name><round_scalar_name>"
1728 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
1731 (match_operand:VF_128 1 "register_operand" "0,v")
1732 (match_operand:VF_128 2 "vector_operand" "xBm,<round_scalar_constraint>"))
1737 <multdiv_mnemonic><ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
1738 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>}"
1739 [(set_attr "isa" "noavx,avx")
1740 (set_attr "type" "sse<multdiv_mnemonic>")
1741 (set_attr "prefix" "<round_scalar_prefix>")
1742 (set_attr "btver2_decode" "direct,double")
1743 (set_attr "mode" "<ssescalarmode>")])
1745 (define_expand "div<mode>3"
1746 [(set (match_operand:VF2 0 "register_operand")
1747 (div:VF2 (match_operand:VF2 1 "register_operand")
1748 (match_operand:VF2 2 "vector_operand")))]
1750 "ix86_fixup_binary_operands_no_copy (DIV, <MODE>mode, operands);")
1752 (define_expand "div<mode>3"
1753 [(set (match_operand:VF1 0 "register_operand")
1754 (div:VF1 (match_operand:VF1 1 "register_operand")
1755 (match_operand:VF1 2 "vector_operand")))]
1758 ix86_fixup_binary_operands_no_copy (DIV, <MODE>mode, operands);
1761 && TARGET_RECIP_VEC_DIV
1762 && !optimize_insn_for_size_p ()
1763 && flag_finite_math_only && !flag_trapping_math
1764 && flag_unsafe_math_optimizations)
1766 ix86_emit_swdivsf (operands[0], operands[1], operands[2], <MODE>mode);
1771 (define_insn "<sse>_div<mode>3<mask_name><round_name>"
1772 [(set (match_operand:VF 0 "register_operand" "=x,v")
1774 (match_operand:VF 1 "register_operand" "0,v")
1775 (match_operand:VF 2 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
1776 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1778 div<ssemodesuffix>\t{%2, %0|%0, %2}
1779 vdiv<ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
1780 [(set_attr "isa" "noavx,avx")
1781 (set_attr "type" "ssediv")
1782 (set_attr "prefix" "<mask_prefix3>")
1783 (set_attr "mode" "<MODE>")])
1785 (define_insn "<sse>_rcp<mode>2"
1786 [(set (match_operand:VF1_128_256 0 "register_operand" "=x")
1788 [(match_operand:VF1_128_256 1 "vector_operand" "xBm")] UNSPEC_RCP))]
1790 "%vrcpps\t{%1, %0|%0, %1}"
1791 [(set_attr "type" "sse")
1792 (set_attr "atom_sse_attr" "rcp")
1793 (set_attr "btver2_sse_attr" "rcp")
1794 (set_attr "prefix" "maybe_vex")
1795 (set_attr "mode" "<MODE>")])
1797 (define_insn "sse_vmrcpv4sf2"
1798 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
1800 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm,xm")]
1802 (match_operand:V4SF 2 "register_operand" "0,x")
1806 rcpss\t{%1, %0|%0, %k1}
1807 vrcpss\t{%1, %2, %0|%0, %2, %k1}"
1808 [(set_attr "isa" "noavx,avx")
1809 (set_attr "type" "sse")
1810 (set_attr "atom_sse_attr" "rcp")
1811 (set_attr "btver2_sse_attr" "rcp")
1812 (set_attr "prefix" "orig,vex")
1813 (set_attr "mode" "SF")])
1815 (define_insn "<mask_codefor>rcp14<mode><mask_name>"
1816 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
1818 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "vm")]
1821 "vrcp14<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
1822 [(set_attr "type" "sse")
1823 (set_attr "prefix" "evex")
1824 (set_attr "mode" "<MODE>")])
1826 (define_insn "srcp14<mode>"
1827 [(set (match_operand:VF_128 0 "register_operand" "=v")
1830 [(match_operand:VF_128 1 "nonimmediate_operand" "vm")]
1832 (match_operand:VF_128 2 "register_operand" "v")
1835 "vrcp14<ssescalarmodesuffix>\t{%1, %2, %0|%0, %2, %<iptr>1}"
1836 [(set_attr "type" "sse")
1837 (set_attr "prefix" "evex")
1838 (set_attr "mode" "<MODE>")])
1840 (define_insn "srcp14<mode>_mask"
1841 [(set (match_operand:VF_128 0 "register_operand" "=v")
1845 [(match_operand:VF_128 1 "nonimmediate_operand" "vm")]
1847 (match_operand:VF_128 3 "vector_move_operand" "0C")
1848 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk"))
1849 (match_operand:VF_128 2 "register_operand" "v")
1852 "vrcp14<ssescalarmodesuffix>\t{%1, %2, %0%{%4%}%N3|%0%{%4%}%N3, %2, %<iptr>1}"
1853 [(set_attr "type" "sse")
1854 (set_attr "prefix" "evex")
1855 (set_attr "mode" "<MODE>")])
1857 (define_expand "sqrt<mode>2"
1858 [(set (match_operand:VF2 0 "register_operand")
1859 (sqrt:VF2 (match_operand:VF2 1 "vector_operand")))]
1862 (define_expand "sqrt<mode>2"
1863 [(set (match_operand:VF1 0 "register_operand")
1864 (sqrt:VF1 (match_operand:VF1 1 "vector_operand")))]
1868 && TARGET_RECIP_VEC_SQRT
1869 && !optimize_insn_for_size_p ()
1870 && flag_finite_math_only && !flag_trapping_math
1871 && flag_unsafe_math_optimizations)
1873 ix86_emit_swsqrtsf (operands[0], operands[1], <MODE>mode, false);
1878 (define_insn "<sse>_sqrt<mode>2<mask_name><round_name>"
1879 [(set (match_operand:VF 0 "register_operand" "=x,v")
1880 (sqrt:VF (match_operand:VF 1 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
1881 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1883 sqrt<ssemodesuffix>\t{%1, %0|%0, %1}
1884 vsqrt<ssemodesuffix>\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
1885 [(set_attr "isa" "noavx,avx")
1886 (set_attr "type" "sse")
1887 (set_attr "atom_sse_attr" "sqrt")
1888 (set_attr "btver2_sse_attr" "sqrt")
1889 (set_attr "prefix" "maybe_vex")
1890 (set_attr "mode" "<MODE>")])
1892 (define_insn "<sse>_vmsqrt<mode>2<mask_scalar_name><round_scalar_name>"
1893 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
1896 (match_operand:VF_128 1 "vector_operand" "xBm,<round_scalar_constraint>"))
1897 (match_operand:VF_128 2 "register_operand" "0,v")
1901 sqrt<ssescalarmodesuffix>\t{%1, %0|%0, %<iptr>1}
1902 vsqrt<ssescalarmodesuffix>\t{<round_scalar_mask_op3>%1, %2, %0<mask_scalar_operand3>|%0<mask_scalar_operand3>, %2, %<iptr>1<round_scalar_mask_op3>}"
1903 [(set_attr "isa" "noavx,avx")
1904 (set_attr "type" "sse")
1905 (set_attr "atom_sse_attr" "sqrt")
1906 (set_attr "prefix" "<round_scalar_prefix>")
1907 (set_attr "btver2_sse_attr" "sqrt")
1908 (set_attr "mode" "<ssescalarmode>")])
1910 (define_expand "rsqrt<mode>2"
1911 [(set (match_operand:VF1_128_256 0 "register_operand")
1913 [(match_operand:VF1_128_256 1 "vector_operand")] UNSPEC_RSQRT))]
1916 ix86_emit_swsqrtsf (operands[0], operands[1], <MODE>mode, true);
1920 (define_expand "rsqrtv16sf2"
1921 [(set (match_operand:V16SF 0 "register_operand")
1923 [(match_operand:V16SF 1 "vector_operand")]
1925 "TARGET_SSE_MATH && TARGET_AVX512ER"
1927 ix86_emit_swsqrtsf (operands[0], operands[1], V16SFmode, true);
1931 (define_insn "<sse>_rsqrt<mode>2"
1932 [(set (match_operand:VF1_128_256 0 "register_operand" "=x")
1934 [(match_operand:VF1_128_256 1 "vector_operand" "xBm")] UNSPEC_RSQRT))]
1936 "%vrsqrtps\t{%1, %0|%0, %1}"
1937 [(set_attr "type" "sse")
1938 (set_attr "prefix" "maybe_vex")
1939 (set_attr "mode" "<MODE>")])
1941 (define_insn "<mask_codefor>rsqrt14<mode><mask_name>"
1942 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
1944 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "vm")]
1947 "vrsqrt14<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
1948 [(set_attr "type" "sse")
1949 (set_attr "prefix" "evex")
1950 (set_attr "mode" "<MODE>")])
1952 (define_insn "rsqrt14<mode>"
1953 [(set (match_operand:VF_128 0 "register_operand" "=v")
1956 [(match_operand:VF_128 1 "nonimmediate_operand" "vm")]
1958 (match_operand:VF_128 2 "register_operand" "v")
1961 "vrsqrt14<ssescalarmodesuffix>\t{%1, %2, %0|%0, %2, %<iptr>1}"
1962 [(set_attr "type" "sse")
1963 (set_attr "prefix" "evex")
1964 (set_attr "mode" "<MODE>")])
1966 (define_insn "rsqrt14_<mode>_mask"
1967 [(set (match_operand:VF_128 0 "register_operand" "=v")
1971 [(match_operand:VF_128 1 "nonimmediate_operand" "vm")]
1973 (match_operand:VF_128 3 "vector_move_operand" "0C")
1974 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk"))
1975 (match_operand:VF_128 2 "register_operand" "v")
1978 "vrsqrt14<ssescalarmodesuffix>\t{%1, %2, %0%{%4%}%N3|%0%{%4%}%N3, %2, %<iptr>1}"
1979 [(set_attr "type" "sse")
1980 (set_attr "prefix" "evex")
1981 (set_attr "mode" "<MODE>")])
1983 (define_insn "sse_vmrsqrtv4sf2"
1984 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
1986 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm,xm")]
1988 (match_operand:V4SF 2 "register_operand" "0,x")
1992 rsqrtss\t{%1, %0|%0, %k1}
1993 vrsqrtss\t{%1, %2, %0|%0, %2, %k1}"
1994 [(set_attr "isa" "noavx,avx")
1995 (set_attr "type" "sse")
1996 (set_attr "prefix" "orig,vex")
1997 (set_attr "mode" "SF")])
1999 (define_expand "<code><mode>3<mask_name><round_saeonly_name>"
2000 [(set (match_operand:VF 0 "register_operand")
2002 (match_operand:VF 1 "<round_saeonly_nimm_predicate>")
2003 (match_operand:VF 2 "<round_saeonly_nimm_predicate>")))]
2004 "TARGET_SSE && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
2006 if (!flag_finite_math_only || flag_signed_zeros)
2008 operands[1] = force_reg (<MODE>mode, operands[1]);
2009 emit_insn (gen_ieee_<maxmin_float><mode>3<mask_name><round_saeonly_name>
2010 (operands[0], operands[1], operands[2]
2011 <mask_operand_arg34>
2012 <round_saeonly_mask_arg3>));
2016 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
2019 ;; These versions of the min/max patterns are intentionally ignorant of
2020 ;; their behavior wrt -0.0 and NaN (via the commutative operand mark).
2021 ;; Since both the tree-level MAX_EXPR and the rtl-level SMAX operator
2022 ;; are undefined in this condition, we're certain this is correct.
2024 (define_insn "*<code><mode>3<mask_name><round_saeonly_name>"
2025 [(set (match_operand:VF 0 "register_operand" "=x,v")
2027 (match_operand:VF 1 "<round_saeonly_nimm_predicate>" "%0,v")
2028 (match_operand:VF 2 "<round_saeonly_nimm_predicate>" "xBm,<round_saeonly_constraint>")))]
2030 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
2031 && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
2033 <maxmin_float><ssemodesuffix>\t{%2, %0|%0, %2}
2034 v<maxmin_float><ssemodesuffix>\t{<round_saeonly_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_saeonly_mask_op3>}"
2035 [(set_attr "isa" "noavx,avx")
2036 (set_attr "type" "sseadd")
2037 (set_attr "btver2_sse_attr" "maxmin")
2038 (set_attr "prefix" "<mask_prefix3>")
2039 (set_attr "mode" "<MODE>")])
2041 ;; These versions of the min/max patterns implement exactly the operations
2042 ;; min = (op1 < op2 ? op1 : op2)
2043 ;; max = (!(op1 < op2) ? op1 : op2)
2044 ;; Their operands are not commutative, and thus they may be used in the
2045 ;; presence of -0.0 and NaN.
2047 (define_insn "ieee_<ieee_maxmin><mode>3<mask_name><round_saeonly_name>"
2048 [(set (match_operand:VF 0 "register_operand" "=x,v")
2050 [(match_operand:VF 1 "register_operand" "0,v")
2051 (match_operand:VF 2 "<round_saeonly_nimm_predicate>" "xBm,<round_saeonly_constraint>")]
2054 && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
2056 <ieee_maxmin><ssemodesuffix>\t{%2, %0|%0, %2}
2057 v<ieee_maxmin><ssemodesuffix>\t{<round_saeonly_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_saeonly_mask_op3>}"
2058 [(set_attr "isa" "noavx,avx")
2059 (set_attr "type" "sseadd")
2060 (set_attr "btver2_sse_attr" "maxmin")
2061 (set_attr "prefix" "<mask_prefix3>")
2062 (set_attr "mode" "<MODE>")])
2064 (define_insn "<sse>_vm<code><mode>3<mask_scalar_name><round_saeonly_scalar_name>"
2065 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
2068 (match_operand:VF_128 1 "register_operand" "0,v")
2069 (match_operand:VF_128 2 "vector_operand" "xBm,<round_saeonly_scalar_constraint>"))
2074 <maxmin_float><ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
2075 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>}"
2076 [(set_attr "isa" "noavx,avx")
2077 (set_attr "type" "sse")
2078 (set_attr "btver2_sse_attr" "maxmin")
2079 (set_attr "prefix" "<round_saeonly_scalar_prefix>")
2080 (set_attr "mode" "<ssescalarmode>")])
2082 (define_insn "avx_addsubv4df3"
2083 [(set (match_operand:V4DF 0 "register_operand" "=x")
2086 (match_operand:V4DF 1 "register_operand" "x")
2087 (match_operand:V4DF 2 "nonimmediate_operand" "xm"))
2088 (plus:V4DF (match_dup 1) (match_dup 2))
2091 "vaddsubpd\t{%2, %1, %0|%0, %1, %2}"
2092 [(set_attr "type" "sseadd")
2093 (set_attr "prefix" "vex")
2094 (set_attr "mode" "V4DF")])
2096 (define_insn "sse3_addsubv2df3"
2097 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
2100 (match_operand:V2DF 1 "register_operand" "0,x")
2101 (match_operand:V2DF 2 "vector_operand" "xBm,xm"))
2102 (plus:V2DF (match_dup 1) (match_dup 2))
2106 addsubpd\t{%2, %0|%0, %2}
2107 vaddsubpd\t{%2, %1, %0|%0, %1, %2}"
2108 [(set_attr "isa" "noavx,avx")
2109 (set_attr "type" "sseadd")
2110 (set_attr "atom_unit" "complex")
2111 (set_attr "prefix" "orig,vex")
2112 (set_attr "mode" "V2DF")])
2114 (define_insn "avx_addsubv8sf3"
2115 [(set (match_operand:V8SF 0 "register_operand" "=x")
2118 (match_operand:V8SF 1 "register_operand" "x")
2119 (match_operand:V8SF 2 "nonimmediate_operand" "xm"))
2120 (plus:V8SF (match_dup 1) (match_dup 2))
2123 "vaddsubps\t{%2, %1, %0|%0, %1, %2}"
2124 [(set_attr "type" "sseadd")
2125 (set_attr "prefix" "vex")
2126 (set_attr "mode" "V8SF")])
2128 (define_insn "sse3_addsubv4sf3"
2129 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
2132 (match_operand:V4SF 1 "register_operand" "0,x")
2133 (match_operand:V4SF 2 "vector_operand" "xBm,xm"))
2134 (plus:V4SF (match_dup 1) (match_dup 2))
2138 addsubps\t{%2, %0|%0, %2}
2139 vaddsubps\t{%2, %1, %0|%0, %1, %2}"
2140 [(set_attr "isa" "noavx,avx")
2141 (set_attr "type" "sseadd")
2142 (set_attr "prefix" "orig,vex")
2143 (set_attr "prefix_rep" "1,*")
2144 (set_attr "mode" "V4SF")])
2147 [(set (match_operand:VF_128_256 0 "register_operand")
2148 (match_operator:VF_128_256 6 "addsub_vm_operator"
2150 (match_operand:VF_128_256 1 "register_operand")
2151 (match_operand:VF_128_256 2 "vector_operand"))
2153 (match_operand:VF_128_256 3 "vector_operand")
2154 (match_operand:VF_128_256 4 "vector_operand"))
2155 (match_operand 5 "const_int_operand")]))]
2157 && can_create_pseudo_p ()
2158 && ((rtx_equal_p (operands[1], operands[3])
2159 && rtx_equal_p (operands[2], operands[4]))
2160 || (rtx_equal_p (operands[1], operands[4])
2161 && rtx_equal_p (operands[2], operands[3])))"
2163 (vec_merge:VF_128_256
2164 (minus:VF_128_256 (match_dup 1) (match_dup 2))
2165 (plus:VF_128_256 (match_dup 1) (match_dup 2))
2169 [(set (match_operand:VF_128_256 0 "register_operand")
2170 (match_operator:VF_128_256 6 "addsub_vm_operator"
2172 (match_operand:VF_128_256 1 "vector_operand")
2173 (match_operand:VF_128_256 2 "vector_operand"))
2175 (match_operand:VF_128_256 3 "register_operand")
2176 (match_operand:VF_128_256 4 "vector_operand"))
2177 (match_operand 5 "const_int_operand")]))]
2179 && can_create_pseudo_p ()
2180 && ((rtx_equal_p (operands[1], operands[3])
2181 && rtx_equal_p (operands[2], operands[4]))
2182 || (rtx_equal_p (operands[1], operands[4])
2183 && rtx_equal_p (operands[2], operands[3])))"
2185 (vec_merge:VF_128_256
2186 (minus:VF_128_256 (match_dup 3) (match_dup 4))
2187 (plus:VF_128_256 (match_dup 3) (match_dup 4))
2190 /* Negate mask bits to compensate for swapped PLUS and MINUS RTXes. */
2192 = GEN_INT (~INTVAL (operands[5])
2193 & ((HOST_WIDE_INT_1U << GET_MODE_NUNITS (<MODE>mode)) - 1));
2197 [(set (match_operand:VF_128_256 0 "register_operand")
2198 (match_operator:VF_128_256 7 "addsub_vs_operator"
2199 [(vec_concat:<ssedoublemode>
2201 (match_operand:VF_128_256 1 "register_operand")
2202 (match_operand:VF_128_256 2 "vector_operand"))
2204 (match_operand:VF_128_256 3 "vector_operand")
2205 (match_operand:VF_128_256 4 "vector_operand")))
2206 (match_parallel 5 "addsub_vs_parallel"
2207 [(match_operand 6 "const_int_operand")])]))]
2209 && can_create_pseudo_p ()
2210 && ((rtx_equal_p (operands[1], operands[3])
2211 && rtx_equal_p (operands[2], operands[4]))
2212 || (rtx_equal_p (operands[1], operands[4])
2213 && rtx_equal_p (operands[2], operands[3])))"
2215 (vec_merge:VF_128_256
2216 (minus:VF_128_256 (match_dup 1) (match_dup 2))
2217 (plus:VF_128_256 (match_dup 1) (match_dup 2))
2220 int i, nelt = XVECLEN (operands[5], 0);
2221 HOST_WIDE_INT ival = 0;
2223 for (i = 0; i < nelt; i++)
2224 if (INTVAL (XVECEXP (operands[5], 0, i)) < GET_MODE_NUNITS (<MODE>mode))
2225 ival |= HOST_WIDE_INT_1 << i;
2227 operands[5] = GEN_INT (ival);
2231 [(set (match_operand:VF_128_256 0 "register_operand")
2232 (match_operator:VF_128_256 7 "addsub_vs_operator"
2233 [(vec_concat:<ssedoublemode>
2235 (match_operand:VF_128_256 1 "vector_operand")
2236 (match_operand:VF_128_256 2 "vector_operand"))
2238 (match_operand:VF_128_256 3 "register_operand")
2239 (match_operand:VF_128_256 4 "vector_operand")))
2240 (match_parallel 5 "addsub_vs_parallel"
2241 [(match_operand 6 "const_int_operand")])]))]
2243 && can_create_pseudo_p ()
2244 && ((rtx_equal_p (operands[1], operands[3])
2245 && rtx_equal_p (operands[2], operands[4]))
2246 || (rtx_equal_p (operands[1], operands[4])
2247 && rtx_equal_p (operands[2], operands[3])))"
2249 (vec_merge:VF_128_256
2250 (minus:VF_128_256 (match_dup 3) (match_dup 4))
2251 (plus:VF_128_256 (match_dup 3) (match_dup 4))
2254 int i, nelt = XVECLEN (operands[5], 0);
2255 HOST_WIDE_INT ival = 0;
2257 for (i = 0; i < nelt; i++)
2258 if (INTVAL (XVECEXP (operands[5], 0, i)) >= GET_MODE_NUNITS (<MODE>mode))
2259 ival |= HOST_WIDE_INT_1 << i;
2261 operands[5] = GEN_INT (ival);
2264 (define_insn "avx_h<plusminus_insn>v4df3"
2265 [(set (match_operand:V4DF 0 "register_operand" "=x")
2270 (match_operand:V4DF 1 "register_operand" "x")
2271 (parallel [(const_int 0)]))
2272 (vec_select:DF (match_dup 1) (parallel [(const_int 1)])))
2275 (match_operand:V4DF 2 "nonimmediate_operand" "xm")
2276 (parallel [(const_int 0)]))
2277 (vec_select:DF (match_dup 2) (parallel [(const_int 1)]))))
2280 (vec_select:DF (match_dup 1) (parallel [(const_int 2)]))
2281 (vec_select:DF (match_dup 1) (parallel [(const_int 3)])))
2283 (vec_select:DF (match_dup 2) (parallel [(const_int 2)]))
2284 (vec_select:DF (match_dup 2) (parallel [(const_int 3)]))))))]
2286 "vh<plusminus_mnemonic>pd\t{%2, %1, %0|%0, %1, %2}"
2287 [(set_attr "type" "sseadd")
2288 (set_attr "prefix" "vex")
2289 (set_attr "mode" "V4DF")])
2291 (define_expand "sse3_haddv2df3"
2292 [(set (match_operand:V2DF 0 "register_operand")
2296 (match_operand:V2DF 1 "register_operand")
2297 (parallel [(const_int 0)]))
2298 (vec_select:DF (match_dup 1) (parallel [(const_int 1)])))
2301 (match_operand:V2DF 2 "vector_operand")
2302 (parallel [(const_int 0)]))
2303 (vec_select:DF (match_dup 2) (parallel [(const_int 1)])))))]
2306 (define_insn "*sse3_haddv2df3"
2307 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
2311 (match_operand:V2DF 1 "register_operand" "0,x")
2312 (parallel [(match_operand:SI 3 "const_0_to_1_operand")]))
2315 (parallel [(match_operand:SI 4 "const_0_to_1_operand")])))
2318 (match_operand:V2DF 2 "vector_operand" "xBm,xm")
2319 (parallel [(match_operand:SI 5 "const_0_to_1_operand")]))
2322 (parallel [(match_operand:SI 6 "const_0_to_1_operand")])))))]
2324 && INTVAL (operands[3]) != INTVAL (operands[4])
2325 && INTVAL (operands[5]) != INTVAL (operands[6])"
2327 haddpd\t{%2, %0|%0, %2}
2328 vhaddpd\t{%2, %1, %0|%0, %1, %2}"
2329 [(set_attr "isa" "noavx,avx")
2330 (set_attr "type" "sseadd")
2331 (set_attr "prefix" "orig,vex")
2332 (set_attr "mode" "V2DF")])
2334 (define_insn "sse3_hsubv2df3"
2335 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
2339 (match_operand:V2DF 1 "register_operand" "0,x")
2340 (parallel [(const_int 0)]))
2341 (vec_select:DF (match_dup 1) (parallel [(const_int 1)])))
2344 (match_operand:V2DF 2 "vector_operand" "xBm,xm")
2345 (parallel [(const_int 0)]))
2346 (vec_select:DF (match_dup 2) (parallel [(const_int 1)])))))]
2349 hsubpd\t{%2, %0|%0, %2}
2350 vhsubpd\t{%2, %1, %0|%0, %1, %2}"
2351 [(set_attr "isa" "noavx,avx")
2352 (set_attr "type" "sseadd")
2353 (set_attr "prefix" "orig,vex")
2354 (set_attr "mode" "V2DF")])
2356 (define_insn "*sse3_haddv2df3_low"
2357 [(set (match_operand:DF 0 "register_operand" "=x,x")
2360 (match_operand:V2DF 1 "register_operand" "0,x")
2361 (parallel [(match_operand:SI 2 "const_0_to_1_operand")]))
2364 (parallel [(match_operand:SI 3 "const_0_to_1_operand")]))))]
2366 && INTVAL (operands[2]) != INTVAL (operands[3])"
2368 haddpd\t{%0, %0|%0, %0}
2369 vhaddpd\t{%1, %1, %0|%0, %1, %1}"
2370 [(set_attr "isa" "noavx,avx")
2371 (set_attr "type" "sseadd1")
2372 (set_attr "prefix" "orig,vex")
2373 (set_attr "mode" "V2DF")])
2375 (define_insn "*sse3_hsubv2df3_low"
2376 [(set (match_operand:DF 0 "register_operand" "=x,x")
2379 (match_operand:V2DF 1 "register_operand" "0,x")
2380 (parallel [(const_int 0)]))
2383 (parallel [(const_int 1)]))))]
2386 hsubpd\t{%0, %0|%0, %0}
2387 vhsubpd\t{%1, %1, %0|%0, %1, %1}"
2388 [(set_attr "isa" "noavx,avx")
2389 (set_attr "type" "sseadd1")
2390 (set_attr "prefix" "orig,vex")
2391 (set_attr "mode" "V2DF")])
2393 (define_insn "avx_h<plusminus_insn>v8sf3"
2394 [(set (match_operand:V8SF 0 "register_operand" "=x")
2400 (match_operand:V8SF 1 "register_operand" "x")
2401 (parallel [(const_int 0)]))
2402 (vec_select:SF (match_dup 1) (parallel [(const_int 1)])))
2404 (vec_select:SF (match_dup 1) (parallel [(const_int 2)]))
2405 (vec_select:SF (match_dup 1) (parallel [(const_int 3)]))))
2409 (match_operand:V8SF 2 "nonimmediate_operand" "xm")
2410 (parallel [(const_int 0)]))
2411 (vec_select:SF (match_dup 2) (parallel [(const_int 1)])))
2413 (vec_select:SF (match_dup 2) (parallel [(const_int 2)]))
2414 (vec_select:SF (match_dup 2) (parallel [(const_int 3)])))))
2418 (vec_select:SF (match_dup 1) (parallel [(const_int 4)]))
2419 (vec_select:SF (match_dup 1) (parallel [(const_int 5)])))
2421 (vec_select:SF (match_dup 1) (parallel [(const_int 6)]))
2422 (vec_select:SF (match_dup 1) (parallel [(const_int 7)]))))
2425 (vec_select:SF (match_dup 2) (parallel [(const_int 4)]))
2426 (vec_select:SF (match_dup 2) (parallel [(const_int 5)])))
2428 (vec_select:SF (match_dup 2) (parallel [(const_int 6)]))
2429 (vec_select:SF (match_dup 2) (parallel [(const_int 7)])))))))]
2431 "vh<plusminus_mnemonic>ps\t{%2, %1, %0|%0, %1, %2}"
2432 [(set_attr "type" "sseadd")
2433 (set_attr "prefix" "vex")
2434 (set_attr "mode" "V8SF")])
2436 (define_insn "sse3_h<plusminus_insn>v4sf3"
2437 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
2442 (match_operand:V4SF 1 "register_operand" "0,x")
2443 (parallel [(const_int 0)]))
2444 (vec_select:SF (match_dup 1) (parallel [(const_int 1)])))
2446 (vec_select:SF (match_dup 1) (parallel [(const_int 2)]))
2447 (vec_select:SF (match_dup 1) (parallel [(const_int 3)]))))
2451 (match_operand:V4SF 2 "vector_operand" "xBm,xm")
2452 (parallel [(const_int 0)]))
2453 (vec_select:SF (match_dup 2) (parallel [(const_int 1)])))
2455 (vec_select:SF (match_dup 2) (parallel [(const_int 2)]))
2456 (vec_select:SF (match_dup 2) (parallel [(const_int 3)]))))))]
2459 h<plusminus_mnemonic>ps\t{%2, %0|%0, %2}
2460 vh<plusminus_mnemonic>ps\t{%2, %1, %0|%0, %1, %2}"
2461 [(set_attr "isa" "noavx,avx")
2462 (set_attr "type" "sseadd")
2463 (set_attr "atom_unit" "complex")
2464 (set_attr "prefix" "orig,vex")
2465 (set_attr "prefix_rep" "1,*")
2466 (set_attr "mode" "V4SF")])
2468 (define_expand "reduc_plus_scal_v8df"
2469 [(match_operand:DF 0 "register_operand")
2470 (match_operand:V8DF 1 "register_operand")]
2473 rtx tmp = gen_reg_rtx (V8DFmode);
2474 ix86_expand_reduc (gen_addv8df3, tmp, operands[1]);
2475 emit_insn (gen_vec_extractv8dfdf (operands[0], tmp, const0_rtx));
2479 (define_expand "reduc_plus_scal_v4df"
2480 [(match_operand:DF 0 "register_operand")
2481 (match_operand:V4DF 1 "register_operand")]
2484 rtx tmp = gen_reg_rtx (V4DFmode);
2485 rtx tmp2 = gen_reg_rtx (V4DFmode);
2486 rtx vec_res = gen_reg_rtx (V4DFmode);
2487 emit_insn (gen_avx_haddv4df3 (tmp, operands[1], operands[1]));
2488 emit_insn (gen_avx_vperm2f128v4df3 (tmp2, tmp, tmp, GEN_INT (1)));
2489 emit_insn (gen_addv4df3 (vec_res, tmp, tmp2));
2490 emit_insn (gen_vec_extractv4dfdf (operands[0], vec_res, const0_rtx));
2494 (define_expand "reduc_plus_scal_v2df"
2495 [(match_operand:DF 0 "register_operand")
2496 (match_operand:V2DF 1 "register_operand")]
2499 rtx tmp = gen_reg_rtx (V2DFmode);
2500 emit_insn (gen_sse3_haddv2df3 (tmp, operands[1], operands[1]));
2501 emit_insn (gen_vec_extractv2dfdf (operands[0], tmp, const0_rtx));
2505 (define_expand "reduc_plus_scal_v16sf"
2506 [(match_operand:SF 0 "register_operand")
2507 (match_operand:V16SF 1 "register_operand")]
2510 rtx tmp = gen_reg_rtx (V16SFmode);
2511 ix86_expand_reduc (gen_addv16sf3, tmp, operands[1]);
2512 emit_insn (gen_vec_extractv16sfsf (operands[0], tmp, const0_rtx));
2516 (define_expand "reduc_plus_scal_v8sf"
2517 [(match_operand:SF 0 "register_operand")
2518 (match_operand:V8SF 1 "register_operand")]
2521 rtx tmp = gen_reg_rtx (V8SFmode);
2522 rtx tmp2 = gen_reg_rtx (V8SFmode);
2523 rtx vec_res = gen_reg_rtx (V8SFmode);
2524 emit_insn (gen_avx_haddv8sf3 (tmp, operands[1], operands[1]));
2525 emit_insn (gen_avx_haddv8sf3 (tmp2, tmp, tmp));
2526 emit_insn (gen_avx_vperm2f128v8sf3 (tmp, tmp2, tmp2, GEN_INT (1)));
2527 emit_insn (gen_addv8sf3 (vec_res, tmp, tmp2));
2528 emit_insn (gen_vec_extractv8sfsf (operands[0], vec_res, const0_rtx));
2532 (define_expand "reduc_plus_scal_v4sf"
2533 [(match_operand:SF 0 "register_operand")
2534 (match_operand:V4SF 1 "register_operand")]
2537 rtx vec_res = gen_reg_rtx (V4SFmode);
2540 rtx tmp = gen_reg_rtx (V4SFmode);
2541 emit_insn (gen_sse3_haddv4sf3 (tmp, operands[1], operands[1]));
2542 emit_insn (gen_sse3_haddv4sf3 (vec_res, tmp, tmp));
2545 ix86_expand_reduc (gen_addv4sf3, vec_res, operands[1]);
2546 emit_insn (gen_vec_extractv4sfsf (operands[0], vec_res, const0_rtx));
2550 ;; Modes handled by reduc_sm{in,ax}* patterns.
2551 (define_mode_iterator REDUC_SMINMAX_MODE
2552 [(V32QI "TARGET_AVX2") (V16HI "TARGET_AVX2")
2553 (V8SI "TARGET_AVX2") (V4DI "TARGET_AVX2")
2554 (V8SF "TARGET_AVX") (V4DF "TARGET_AVX")
2555 (V4SF "TARGET_SSE") (V64QI "TARGET_AVX512BW")
2556 (V32HI "TARGET_AVX512BW") (V16SI "TARGET_AVX512F")
2557 (V8DI "TARGET_AVX512F") (V16SF "TARGET_AVX512F")
2558 (V8DF "TARGET_AVX512F")])
2560 (define_expand "reduc_<code>_scal_<mode>"
2561 [(smaxmin:REDUC_SMINMAX_MODE
2562 (match_operand:<ssescalarmode> 0 "register_operand")
2563 (match_operand:REDUC_SMINMAX_MODE 1 "register_operand"))]
2566 rtx tmp = gen_reg_rtx (<MODE>mode);
2567 ix86_expand_reduc (gen_<code><mode>3, tmp, operands[1]);
2568 emit_insn (gen_vec_extract<mode><ssescalarmodelower> (operands[0], tmp,
2573 (define_expand "reduc_<code>_scal_<mode>"
2574 [(umaxmin:VI_AVX512BW
2575 (match_operand:<ssescalarmode> 0 "register_operand")
2576 (match_operand:VI_AVX512BW 1 "register_operand"))]
2579 rtx tmp = gen_reg_rtx (<MODE>mode);
2580 ix86_expand_reduc (gen_<code><mode>3, tmp, operands[1]);
2581 emit_insn (gen_vec_extract<mode><ssescalarmodelower> (operands[0], tmp,
2586 (define_expand "reduc_<code>_scal_<mode>"
2588 (match_operand:<ssescalarmode> 0 "register_operand")
2589 (match_operand:VI_256 1 "register_operand"))]
2592 rtx tmp = gen_reg_rtx (<MODE>mode);
2593 ix86_expand_reduc (gen_<code><mode>3, tmp, operands[1]);
2594 emit_insn (gen_vec_extract<mode><ssescalarmodelower> (operands[0], tmp,
2599 (define_expand "reduc_umin_scal_v8hi"
2601 (match_operand:HI 0 "register_operand")
2602 (match_operand:V8HI 1 "register_operand"))]
2605 rtx tmp = gen_reg_rtx (V8HImode);
2606 ix86_expand_reduc (gen_uminv8hi3, tmp, operands[1]);
2607 emit_insn (gen_vec_extractv8hihi (operands[0], tmp, const0_rtx));
2611 (define_insn "<mask_codefor>reducep<mode><mask_name>"
2612 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
2614 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "vm")
2615 (match_operand:SI 2 "const_0_to_255_operand")]
2618 "vreduce<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
2619 [(set_attr "type" "sse")
2620 (set_attr "prefix" "evex")
2621 (set_attr "mode" "<MODE>")])
2623 (define_insn "reduces<mode><mask_scalar_name>"
2624 [(set (match_operand:VF_128 0 "register_operand" "=v")
2627 [(match_operand:VF_128 1 "register_operand" "v")
2628 (match_operand:VF_128 2 "nonimmediate_operand" "vm")
2629 (match_operand:SI 3 "const_0_to_255_operand")]
2634 "vreduce<ssescalarmodesuffix>\t{%3, %2, %1, %0<mask_scalar_operand4>|%0<mask_scalar_operand4>, %1, %<iptr>2, %3}"
2635 [(set_attr "type" "sse")
2636 (set_attr "prefix" "evex")
2637 (set_attr "mode" "<MODE>")])
2639 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2641 ;; Parallel floating point comparisons
2643 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2645 (define_insn "avx_cmp<mode>3"
2646 [(set (match_operand:VF_128_256 0 "register_operand" "=x")
2648 [(match_operand:VF_128_256 1 "register_operand" "x")
2649 (match_operand:VF_128_256 2 "nonimmediate_operand" "xm")
2650 (match_operand:SI 3 "const_0_to_31_operand" "n")]
2653 "vcmp<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
2654 [(set_attr "type" "ssecmp")
2655 (set_attr "length_immediate" "1")
2656 (set_attr "prefix" "vex")
2657 (set_attr "mode" "<MODE>")])
2659 (define_insn "avx_vmcmp<mode>3"
2660 [(set (match_operand:VF_128 0 "register_operand" "=x")
2663 [(match_operand:VF_128 1 "register_operand" "x")
2664 (match_operand:VF_128 2 "nonimmediate_operand" "xm")
2665 (match_operand:SI 3 "const_0_to_31_operand" "n")]
2670 "vcmp<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %3}"
2671 [(set_attr "type" "ssecmp")
2672 (set_attr "length_immediate" "1")
2673 (set_attr "prefix" "vex")
2674 (set_attr "mode" "<ssescalarmode>")])
2676 (define_insn "*<sse>_maskcmp<mode>3_comm"
2677 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x")
2678 (match_operator:VF_128_256 3 "sse_comparison_operator"
2679 [(match_operand:VF_128_256 1 "register_operand" "%0,x")
2680 (match_operand:VF_128_256 2 "vector_operand" "xBm,xm")]))]
2682 && GET_RTX_CLASS (GET_CODE (operands[3])) == RTX_COMM_COMPARE"
2684 cmp%D3<ssemodesuffix>\t{%2, %0|%0, %2}
2685 vcmp%D3<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
2686 [(set_attr "isa" "noavx,avx")
2687 (set_attr "type" "ssecmp")
2688 (set_attr "length_immediate" "1")
2689 (set_attr "prefix" "orig,vex")
2690 (set_attr "mode" "<MODE>")])
2692 (define_insn "<sse>_maskcmp<mode>3"
2693 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x")
2694 (match_operator:VF_128_256 3 "sse_comparison_operator"
2695 [(match_operand:VF_128_256 1 "register_operand" "0,x")
2696 (match_operand:VF_128_256 2 "vector_operand" "xBm,xm")]))]
2699 cmp%D3<ssemodesuffix>\t{%2, %0|%0, %2}
2700 vcmp%D3<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
2701 [(set_attr "isa" "noavx,avx")
2702 (set_attr "type" "ssecmp")
2703 (set_attr "length_immediate" "1")
2704 (set_attr "prefix" "orig,vex")
2705 (set_attr "mode" "<MODE>")])
2707 (define_insn "<sse>_vmmaskcmp<mode>3"
2708 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
2710 (match_operator:VF_128 3 "sse_comparison_operator"
2711 [(match_operand:VF_128 1 "register_operand" "0,x")
2712 (match_operand:VF_128 2 "vector_operand" "xBm,xm")])
2717 cmp%D3<ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
2718 vcmp%D3<ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %<iptr>2}"
2719 [(set_attr "isa" "noavx,avx")
2720 (set_attr "type" "ssecmp")
2721 (set_attr "length_immediate" "1,*")
2722 (set_attr "prefix" "orig,vex")
2723 (set_attr "mode" "<ssescalarmode>")])
2725 (define_mode_attr cmp_imm_predicate
2726 [(V16SF "const_0_to_31_operand") (V8DF "const_0_to_31_operand")
2727 (V16SI "const_0_to_7_operand") (V8DI "const_0_to_7_operand")
2728 (V8SF "const_0_to_31_operand") (V4DF "const_0_to_31_operand")
2729 (V8SI "const_0_to_7_operand") (V4DI "const_0_to_7_operand")
2730 (V4SF "const_0_to_31_operand") (V2DF "const_0_to_31_operand")
2731 (V4SI "const_0_to_7_operand") (V2DI "const_0_to_7_operand")
2732 (V32HI "const_0_to_7_operand") (V64QI "const_0_to_7_operand")
2733 (V16HI "const_0_to_7_operand") (V32QI "const_0_to_7_operand")
2734 (V8HI "const_0_to_7_operand") (V16QI "const_0_to_7_operand")])
2736 (define_insn "<avx512>_cmp<mode>3<mask_scalar_merge_name><round_saeonly_name>"
2737 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2738 (unspec:<avx512fmaskmode>
2739 [(match_operand:V48_AVX512VL 1 "register_operand" "v")
2740 (match_operand:V48_AVX512VL 2 "nonimmediate_operand" "<round_saeonly_constraint>")
2741 (match_operand:SI 3 "<cmp_imm_predicate>" "n")]
2743 "TARGET_AVX512F && <round_saeonly_mode512bit_condition>"
2744 "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}"
2745 [(set_attr "type" "ssecmp")
2746 (set_attr "length_immediate" "1")
2747 (set_attr "prefix" "evex")
2748 (set_attr "mode" "<sseinsnmode>")])
2750 (define_insn "<avx512>_cmp<mode>3<mask_scalar_merge_name>"
2751 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2752 (unspec:<avx512fmaskmode>
2753 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
2754 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")
2755 (match_operand:SI 3 "<cmp_imm_predicate>" "n")]
2758 "vpcmp<ssemodesuffix>\t{%3, %2, %1, %0<mask_scalar_merge_operand4>|%0<mask_scalar_merge_operand4>, %1, %2, %3}"
2759 [(set_attr "type" "ssecmp")
2760 (set_attr "length_immediate" "1")
2761 (set_attr "prefix" "evex")
2762 (set_attr "mode" "<sseinsnmode>")])
2764 (define_insn "<avx512>_ucmp<mode>3<mask_scalar_merge_name>"
2765 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2766 (unspec:<avx512fmaskmode>
2767 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
2768 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")
2769 (match_operand:SI 3 "const_0_to_7_operand" "n")]
2770 UNSPEC_UNSIGNED_PCMP))]
2772 "vpcmpu<ssemodesuffix>\t{%3, %2, %1, %0<mask_scalar_merge_operand4>|%0<mask_scalar_merge_operand4>, %1, %2, %3}"
2773 [(set_attr "type" "ssecmp")
2774 (set_attr "length_immediate" "1")
2775 (set_attr "prefix" "evex")
2776 (set_attr "mode" "<sseinsnmode>")])
2778 (define_insn "<avx512>_ucmp<mode>3<mask_scalar_merge_name>"
2779 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2780 (unspec:<avx512fmaskmode>
2781 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
2782 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")
2783 (match_operand:SI 3 "const_0_to_7_operand" "n")]
2784 UNSPEC_UNSIGNED_PCMP))]
2786 "vpcmpu<ssemodesuffix>\t{%3, %2, %1, %0<mask_scalar_merge_operand4>|%0<mask_scalar_merge_operand4>, %1, %2, %3}"
2787 [(set_attr "type" "ssecmp")
2788 (set_attr "length_immediate" "1")
2789 (set_attr "prefix" "evex")
2790 (set_attr "mode" "<sseinsnmode>")])
2792 (define_insn "avx512f_vmcmp<mode>3<round_saeonly_name>"
2793 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2794 (and:<avx512fmaskmode>
2795 (unspec:<avx512fmaskmode>
2796 [(match_operand:VF_128 1 "register_operand" "v")
2797 (match_operand:VF_128 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
2798 (match_operand:SI 3 "const_0_to_31_operand" "n")]
2802 "vcmp<ssescalarmodesuffix>\t{%3, <round_saeonly_op4>%2, %1, %0|%0, %1, %<iptr>2<round_saeonly_op4>, %3}"
2803 [(set_attr "type" "ssecmp")
2804 (set_attr "length_immediate" "1")
2805 (set_attr "prefix" "evex")
2806 (set_attr "mode" "<ssescalarmode>")])
2808 (define_insn "avx512f_vmcmp<mode>3_mask<round_saeonly_name>"
2809 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2810 (and:<avx512fmaskmode>
2811 (unspec:<avx512fmaskmode>
2812 [(match_operand:VF_128 1 "register_operand" "v")
2813 (match_operand:VF_128 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
2814 (match_operand:SI 3 "const_0_to_31_operand" "n")]
2816 (and:<avx512fmaskmode>
2817 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")
2820 "vcmp<ssescalarmodesuffix>\t{%3, <round_saeonly_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %<iptr>2<round_saeonly_op5>, %3}"
2821 [(set_attr "type" "ssecmp")
2822 (set_attr "length_immediate" "1")
2823 (set_attr "prefix" "evex")
2824 (set_attr "mode" "<ssescalarmode>")])
2826 (define_insn "avx512f_maskcmp<mode>3"
2827 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2828 (match_operator:<avx512fmaskmode> 3 "sse_comparison_operator"
2829 [(match_operand:VF 1 "register_operand" "v")
2830 (match_operand:VF 2 "nonimmediate_operand" "vm")]))]
2832 "vcmp%D3<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
2833 [(set_attr "type" "ssecmp")
2834 (set_attr "length_immediate" "1")
2835 (set_attr "prefix" "evex")
2836 (set_attr "mode" "<sseinsnmode>")])
2838 (define_insn "<sse>_<unord>comi<round_saeonly_name>"
2839 [(set (reg:CCFP FLAGS_REG)
2842 (match_operand:<ssevecmode> 0 "register_operand" "v")
2843 (parallel [(const_int 0)]))
2845 (match_operand:<ssevecmode> 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
2846 (parallel [(const_int 0)]))))]
2847 "SSE_FLOAT_MODE_P (<MODE>mode)"
2848 "%v<unord>comi<ssemodesuffix>\t{<round_saeonly_op2>%1, %0|%0, %<iptr>1<round_saeonly_op2>}"
2849 [(set_attr "type" "ssecomi")
2850 (set_attr "prefix" "maybe_vex")
2851 (set_attr "prefix_rep" "0")
2852 (set (attr "prefix_data16")
2853 (if_then_else (eq_attr "mode" "DF")
2855 (const_string "0")))
2856 (set_attr "mode" "<MODE>")])
2858 (define_expand "vec_cmp<mode><avx512fmaskmodelower>"
2859 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
2860 (match_operator:<avx512fmaskmode> 1 ""
2861 [(match_operand:V48_AVX512VL 2 "register_operand")
2862 (match_operand:V48_AVX512VL 3 "nonimmediate_operand")]))]
2865 bool ok = ix86_expand_mask_vec_cmp (operands);
2870 (define_expand "vec_cmp<mode><avx512fmaskmodelower>"
2871 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
2872 (match_operator:<avx512fmaskmode> 1 ""
2873 [(match_operand:VI12_AVX512VL 2 "register_operand")
2874 (match_operand:VI12_AVX512VL 3 "nonimmediate_operand")]))]
2877 bool ok = ix86_expand_mask_vec_cmp (operands);
2882 (define_expand "vec_cmp<mode><sseintvecmodelower>"
2883 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2884 (match_operator:<sseintvecmode> 1 ""
2885 [(match_operand:VI_256 2 "register_operand")
2886 (match_operand:VI_256 3 "nonimmediate_operand")]))]
2889 bool ok = ix86_expand_int_vec_cmp (operands);
2894 (define_expand "vec_cmp<mode><sseintvecmodelower>"
2895 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2896 (match_operator:<sseintvecmode> 1 ""
2897 [(match_operand:VI124_128 2 "register_operand")
2898 (match_operand:VI124_128 3 "vector_operand")]))]
2901 bool ok = ix86_expand_int_vec_cmp (operands);
2906 (define_expand "vec_cmpv2div2di"
2907 [(set (match_operand:V2DI 0 "register_operand")
2908 (match_operator:V2DI 1 ""
2909 [(match_operand:V2DI 2 "register_operand")
2910 (match_operand:V2DI 3 "vector_operand")]))]
2913 bool ok = ix86_expand_int_vec_cmp (operands);
2918 (define_expand "vec_cmp<mode><sseintvecmodelower>"
2919 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2920 (match_operator:<sseintvecmode> 1 ""
2921 [(match_operand:VF_256 2 "register_operand")
2922 (match_operand:VF_256 3 "nonimmediate_operand")]))]
2925 bool ok = ix86_expand_fp_vec_cmp (operands);
2930 (define_expand "vec_cmp<mode><sseintvecmodelower>"
2931 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2932 (match_operator:<sseintvecmode> 1 ""
2933 [(match_operand:VF_128 2 "register_operand")
2934 (match_operand:VF_128 3 "vector_operand")]))]
2937 bool ok = ix86_expand_fp_vec_cmp (operands);
2942 (define_expand "vec_cmpu<mode><avx512fmaskmodelower>"
2943 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
2944 (match_operator:<avx512fmaskmode> 1 ""
2945 [(match_operand:VI48_AVX512VL 2 "register_operand")
2946 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand")]))]
2949 bool ok = ix86_expand_mask_vec_cmp (operands);
2954 (define_expand "vec_cmpu<mode><avx512fmaskmodelower>"
2955 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
2956 (match_operator:<avx512fmaskmode> 1 ""
2957 [(match_operand:VI12_AVX512VL 2 "register_operand")
2958 (match_operand:VI12_AVX512VL 3 "nonimmediate_operand")]))]
2961 bool ok = ix86_expand_mask_vec_cmp (operands);
2966 (define_expand "vec_cmpu<mode><sseintvecmodelower>"
2967 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2968 (match_operator:<sseintvecmode> 1 ""
2969 [(match_operand:VI_256 2 "register_operand")
2970 (match_operand:VI_256 3 "nonimmediate_operand")]))]
2973 bool ok = ix86_expand_int_vec_cmp (operands);
2978 (define_expand "vec_cmpu<mode><sseintvecmodelower>"
2979 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2980 (match_operator:<sseintvecmode> 1 ""
2981 [(match_operand:VI124_128 2 "register_operand")
2982 (match_operand:VI124_128 3 "vector_operand")]))]
2985 bool ok = ix86_expand_int_vec_cmp (operands);
2990 (define_expand "vec_cmpuv2div2di"
2991 [(set (match_operand:V2DI 0 "register_operand")
2992 (match_operator:V2DI 1 ""
2993 [(match_operand:V2DI 2 "register_operand")
2994 (match_operand:V2DI 3 "vector_operand")]))]
2997 bool ok = ix86_expand_int_vec_cmp (operands);
3002 (define_expand "vec_cmpeqv2div2di"
3003 [(set (match_operand:V2DI 0 "register_operand")
3004 (match_operator:V2DI 1 ""
3005 [(match_operand:V2DI 2 "register_operand")
3006 (match_operand:V2DI 3 "vector_operand")]))]
3009 bool ok = ix86_expand_int_vec_cmp (operands);
3014 (define_expand "vcond<V_512:mode><VF_512:mode>"
3015 [(set (match_operand:V_512 0 "register_operand")
3017 (match_operator 3 ""
3018 [(match_operand:VF_512 4 "nonimmediate_operand")
3019 (match_operand:VF_512 5 "nonimmediate_operand")])
3020 (match_operand:V_512 1 "general_operand")
3021 (match_operand:V_512 2 "general_operand")))]
3023 && (GET_MODE_NUNITS (<V_512:MODE>mode)
3024 == GET_MODE_NUNITS (<VF_512:MODE>mode))"
3026 bool ok = ix86_expand_fp_vcond (operands);
3031 (define_expand "vcond<V_256:mode><VF_256:mode>"
3032 [(set (match_operand:V_256 0 "register_operand")
3034 (match_operator 3 ""
3035 [(match_operand:VF_256 4 "nonimmediate_operand")
3036 (match_operand:VF_256 5 "nonimmediate_operand")])
3037 (match_operand:V_256 1 "general_operand")
3038 (match_operand:V_256 2 "general_operand")))]
3040 && (GET_MODE_NUNITS (<V_256:MODE>mode)
3041 == GET_MODE_NUNITS (<VF_256:MODE>mode))"
3043 bool ok = ix86_expand_fp_vcond (operands);
3048 (define_expand "vcond<V_128:mode><VF_128:mode>"
3049 [(set (match_operand:V_128 0 "register_operand")
3051 (match_operator 3 ""
3052 [(match_operand:VF_128 4 "vector_operand")
3053 (match_operand:VF_128 5 "vector_operand")])
3054 (match_operand:V_128 1 "general_operand")
3055 (match_operand:V_128 2 "general_operand")))]
3057 && (GET_MODE_NUNITS (<V_128:MODE>mode)
3058 == GET_MODE_NUNITS (<VF_128:MODE>mode))"
3060 bool ok = ix86_expand_fp_vcond (operands);
3065 (define_expand "vcond_mask_<mode><avx512fmaskmodelower>"
3066 [(set (match_operand:V48_AVX512VL 0 "register_operand")
3067 (vec_merge:V48_AVX512VL
3068 (match_operand:V48_AVX512VL 1 "nonimmediate_operand")
3069 (match_operand:V48_AVX512VL 2 "vector_move_operand")
3070 (match_operand:<avx512fmaskmode> 3 "register_operand")))]
3073 (define_expand "vcond_mask_<mode><avx512fmaskmodelower>"
3074 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
3075 (vec_merge:VI12_AVX512VL
3076 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand")
3077 (match_operand:VI12_AVX512VL 2 "vector_move_operand")
3078 (match_operand:<avx512fmaskmode> 3 "register_operand")))]
3081 (define_expand "vcond_mask_<mode><sseintvecmodelower>"
3082 [(set (match_operand:VI_256 0 "register_operand")
3084 (match_operand:VI_256 1 "nonimmediate_operand")
3085 (match_operand:VI_256 2 "vector_move_operand")
3086 (match_operand:<sseintvecmode> 3 "register_operand")))]
3089 ix86_expand_sse_movcc (operands[0], operands[3],
3090 operands[1], operands[2]);
3094 (define_expand "vcond_mask_<mode><sseintvecmodelower>"
3095 [(set (match_operand:VI124_128 0 "register_operand")
3096 (vec_merge:VI124_128
3097 (match_operand:VI124_128 1 "vector_operand")
3098 (match_operand:VI124_128 2 "vector_move_operand")
3099 (match_operand:<sseintvecmode> 3 "register_operand")))]
3102 ix86_expand_sse_movcc (operands[0], operands[3],
3103 operands[1], operands[2]);
3107 (define_expand "vcond_mask_v2div2di"
3108 [(set (match_operand:V2DI 0 "register_operand")
3110 (match_operand:V2DI 1 "vector_operand")
3111 (match_operand:V2DI 2 "vector_move_operand")
3112 (match_operand:V2DI 3 "register_operand")))]
3115 ix86_expand_sse_movcc (operands[0], operands[3],
3116 operands[1], operands[2]);
3120 (define_expand "vcond_mask_<mode><sseintvecmodelower>"
3121 [(set (match_operand:VF_256 0 "register_operand")
3123 (match_operand:VF_256 1 "nonimmediate_operand")
3124 (match_operand:VF_256 2 "vector_move_operand")
3125 (match_operand:<sseintvecmode> 3 "register_operand")))]
3128 ix86_expand_sse_movcc (operands[0], operands[3],
3129 operands[1], operands[2]);
3133 (define_expand "vcond_mask_<mode><sseintvecmodelower>"
3134 [(set (match_operand:VF_128 0 "register_operand")
3136 (match_operand:VF_128 1 "vector_operand")
3137 (match_operand:VF_128 2 "vector_move_operand")
3138 (match_operand:<sseintvecmode> 3 "register_operand")))]
3141 ix86_expand_sse_movcc (operands[0], operands[3],
3142 operands[1], operands[2]);
3146 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3148 ;; Parallel floating point logical operations
3150 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3152 (define_insn "<sse>_andnot<mode>3<mask_name>"
3153 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x,v,v")
3156 (match_operand:VF_128_256 1 "register_operand" "0,x,v,v"))
3157 (match_operand:VF_128_256 2 "vector_operand" "xBm,xm,vm,vm")))]
3158 "TARGET_SSE && <mask_avx512vl_condition>"
3160 static char buf[128];
3164 switch (which_alternative)
3167 ops = "andn%s\t{%%2, %%0|%%0, %%2}";
3172 ops = "vandn%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
3178 switch (get_attr_mode (insn))
3186 /* There is no vandnp[sd] in avx512f. Use vpandn[qd]. */
3187 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
3188 ops = "vpandn%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
3191 suffix = "<ssemodesuffix>";
3194 snprintf (buf, sizeof (buf), ops, suffix);
3197 [(set_attr "isa" "noavx,avx,avx512dq,avx512f")
3198 (set_attr "type" "sselog")
3199 (set_attr "prefix" "orig,maybe_vex,evex,evex")
3201 (cond [(and (match_test "<mask_applied>")
3202 (and (eq_attr "alternative" "1")
3203 (match_test "!TARGET_AVX512DQ")))
3204 (const_string "<sseintvecmode2>")
3205 (eq_attr "alternative" "3")
3206 (const_string "<sseintvecmode2>")
3207 (and (match_test "<MODE_SIZE> == 16")
3208 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
3209 (const_string "<ssePSmode>")
3210 (match_test "TARGET_AVX")
3211 (const_string "<MODE>")
3212 (match_test "optimize_function_for_size_p (cfun)")
3213 (const_string "V4SF")
3215 (const_string "<MODE>")))])
3218 (define_insn "<sse>_andnot<mode>3<mask_name>"
3219 [(set (match_operand:VF_512 0 "register_operand" "=v")
3222 (match_operand:VF_512 1 "register_operand" "v"))
3223 (match_operand:VF_512 2 "nonimmediate_operand" "vm")))]
3226 static char buf[128];
3230 suffix = "<ssemodesuffix>";
3233 /* There is no vandnp[sd] in avx512f. Use vpandn[qd]. */
3234 if (!TARGET_AVX512DQ)
3236 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
3240 snprintf (buf, sizeof (buf),
3241 "v%sandn%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}",
3245 [(set_attr "type" "sselog")
3246 (set_attr "prefix" "evex")
3248 (if_then_else (match_test "TARGET_AVX512DQ")
3249 (const_string "<sseinsnmode>")
3250 (const_string "XI")))])
3252 (define_expand "<code><mode>3<mask_name>"
3253 [(set (match_operand:VF_128_256 0 "register_operand")
3254 (any_logic:VF_128_256
3255 (match_operand:VF_128_256 1 "vector_operand")
3256 (match_operand:VF_128_256 2 "vector_operand")))]
3257 "TARGET_SSE && <mask_avx512vl_condition>"
3258 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
3260 (define_expand "<code><mode>3<mask_name>"
3261 [(set (match_operand:VF_512 0 "register_operand")
3263 (match_operand:VF_512 1 "nonimmediate_operand")
3264 (match_operand:VF_512 2 "nonimmediate_operand")))]
3266 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
3268 (define_insn "*<code><mode>3<mask_name>"
3269 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x,v,v")
3270 (any_logic:VF_128_256
3271 (match_operand:VF_128_256 1 "vector_operand" "%0,x,v,v")
3272 (match_operand:VF_128_256 2 "vector_operand" "xBm,xm,vm,vm")))]
3273 "TARGET_SSE && <mask_avx512vl_condition>
3274 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
3276 static char buf[128];
3280 switch (which_alternative)
3283 ops = "<logic>%s\t{%%2, %%0|%%0, %%2}";
3288 ops = "v<logic>%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
3294 switch (get_attr_mode (insn))
3302 /* There is no v<logic>p[sd] in avx512f. Use vp<logic>[qd]. */
3303 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
3304 ops = "vp<logic>%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
3307 suffix = "<ssemodesuffix>";
3310 snprintf (buf, sizeof (buf), ops, suffix);
3313 [(set_attr "isa" "noavx,avx,avx512dq,avx512f")
3314 (set_attr "type" "sselog")
3315 (set_attr "prefix" "orig,maybe_evex,evex,evex")
3317 (cond [(and (match_test "<mask_applied>")
3318 (and (eq_attr "alternative" "1")
3319 (match_test "!TARGET_AVX512DQ")))
3320 (const_string "<sseintvecmode2>")
3321 (eq_attr "alternative" "3")
3322 (const_string "<sseintvecmode2>")
3323 (and (match_test "<MODE_SIZE> == 16")
3324 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
3325 (const_string "<ssePSmode>")
3326 (match_test "TARGET_AVX")
3327 (const_string "<MODE>")
3328 (match_test "optimize_function_for_size_p (cfun)")
3329 (const_string "V4SF")
3331 (const_string "<MODE>")))])
3333 (define_insn "*<code><mode>3<mask_name>"
3334 [(set (match_operand:VF_512 0 "register_operand" "=v")
3336 (match_operand:VF_512 1 "nonimmediate_operand" "%v")
3337 (match_operand:VF_512 2 "nonimmediate_operand" "vm")))]
3338 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
3340 static char buf[128];
3344 suffix = "<ssemodesuffix>";
3347 /* There is no v<logic>p[sd] in avx512f. Use vp<logic>[dq]. */
3348 if (!TARGET_AVX512DQ)
3350 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
3354 snprintf (buf, sizeof (buf),
3355 "v%s<logic>%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}",
3359 [(set_attr "type" "sselog")
3360 (set_attr "prefix" "evex")
3362 (if_then_else (match_test "TARGET_AVX512DQ")
3363 (const_string "<sseinsnmode>")
3364 (const_string "XI")))])
3366 (define_expand "copysign<mode>3"
3369 (not:VF (match_dup 3))
3370 (match_operand:VF 1 "vector_operand")))
3372 (and:VF (match_dup 3)
3373 (match_operand:VF 2 "vector_operand")))
3374 (set (match_operand:VF 0 "register_operand")
3375 (ior:VF (match_dup 4) (match_dup 5)))]
3378 operands[3] = ix86_build_signbit_mask (<MODE>mode, 1, 0);
3380 operands[4] = gen_reg_rtx (<MODE>mode);
3381 operands[5] = gen_reg_rtx (<MODE>mode);
3384 ;; Also define scalar versions. These are used for abs, neg, and
3385 ;; conditional move. Using subregs into vector modes causes register
3386 ;; allocation lossage. These patterns do not allow memory operands
3387 ;; because the native instructions read the full 128-bits.
3389 (define_insn "*andnot<mode>3"
3390 [(set (match_operand:MODEF 0 "register_operand" "=x,x,v,v")
3393 (match_operand:MODEF 1 "register_operand" "0,x,v,v"))
3394 (match_operand:MODEF 2 "register_operand" "x,x,v,v")))]
3395 "SSE_FLOAT_MODE_P (<MODE>mode)"
3397 static char buf[128];
3400 = (get_attr_mode (insn) == MODE_V4SF) ? "ps" : "<ssevecmodesuffix>";
3402 switch (which_alternative)
3405 ops = "andn%s\t{%%2, %%0|%%0, %%2}";
3408 ops = "vandn%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3411 if (TARGET_AVX512DQ)
3412 ops = "vandn%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3415 suffix = <MODE>mode == DFmode ? "q" : "d";
3416 ops = "vpandn%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3420 if (TARGET_AVX512DQ)
3421 ops = "vandn%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3424 suffix = <MODE>mode == DFmode ? "q" : "d";
3425 ops = "vpandn%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3432 snprintf (buf, sizeof (buf), ops, suffix);
3435 [(set_attr "isa" "noavx,avx,avx512vl,avx512f")
3436 (set_attr "type" "sselog")
3437 (set_attr "prefix" "orig,vex,evex,evex")
3439 (cond [(eq_attr "alternative" "2")
3440 (if_then_else (match_test "TARGET_AVX512DQ")
3441 (const_string "<ssevecmode>")
3442 (const_string "TI"))
3443 (eq_attr "alternative" "3")
3444 (if_then_else (match_test "TARGET_AVX512DQ")
3445 (const_string "<avx512fvecmode>")
3446 (const_string "XI"))
3447 (and (match_test "<MODE_SIZE> == 16")
3448 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
3449 (const_string "V4SF")
3450 (match_test "TARGET_AVX")
3451 (const_string "<ssevecmode>")
3452 (match_test "optimize_function_for_size_p (cfun)")
3453 (const_string "V4SF")
3455 (const_string "<ssevecmode>")))])
3457 (define_insn "*andnottf3"
3458 [(set (match_operand:TF 0 "register_operand" "=x,x,v,v")
3460 (not:TF (match_operand:TF 1 "register_operand" "0,x,v,v"))
3461 (match_operand:TF 2 "vector_operand" "xBm,xm,vm,v")))]
3464 static char buf[128];
3467 = (which_alternative >= 2 ? "pandnq"
3468 : get_attr_mode (insn) == MODE_V4SF ? "andnps" : "pandn");
3470 switch (which_alternative)
3473 ops = "%s\t{%%2, %%0|%%0, %%2}";
3477 ops = "v%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3480 ops = "v%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3486 snprintf (buf, sizeof (buf), ops, tmp);
3489 [(set_attr "isa" "noavx,avx,avx512vl,avx512f")
3490 (set_attr "type" "sselog")
3491 (set (attr "prefix_data16")
3493 (and (eq_attr "alternative" "0")
3494 (eq_attr "mode" "TI"))
3496 (const_string "*")))
3497 (set_attr "prefix" "orig,vex,evex,evex")
3499 (cond [(eq_attr "alternative" "2")
3501 (eq_attr "alternative" "3")
3503 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
3504 (const_string "V4SF")
3505 (match_test "TARGET_AVX")
3507 (ior (not (match_test "TARGET_SSE2"))
3508 (match_test "optimize_function_for_size_p (cfun)"))
3509 (const_string "V4SF")
3511 (const_string "TI")))])
3513 (define_insn "*<code><mode>3"
3514 [(set (match_operand:MODEF 0 "register_operand" "=x,x,v,v")
3516 (match_operand:MODEF 1 "register_operand" "%0,x,v,v")
3517 (match_operand:MODEF 2 "register_operand" "x,x,v,v")))]
3518 "SSE_FLOAT_MODE_P (<MODE>mode)"
3520 static char buf[128];
3523 = (get_attr_mode (insn) == MODE_V4SF) ? "ps" : "<ssevecmodesuffix>";
3525 switch (which_alternative)
3528 ops = "<logic>%s\t{%%2, %%0|%%0, %%2}";
3531 if (!TARGET_AVX512DQ)
3533 suffix = <MODE>mode == DFmode ? "q" : "d";
3534 ops = "vp<logic>%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3539 ops = "v<logic>%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3542 if (TARGET_AVX512DQ)
3543 ops = "v<logic>%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3546 suffix = <MODE>mode == DFmode ? "q" : "d";
3547 ops = "vp<logic>%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3554 snprintf (buf, sizeof (buf), ops, suffix);
3557 [(set_attr "isa" "noavx,avx,avx512vl,avx512f")
3558 (set_attr "type" "sselog")
3559 (set_attr "prefix" "orig,vex,evex,evex")
3561 (cond [(eq_attr "alternative" "2")
3562 (if_then_else (match_test "TARGET_AVX512DQ")
3563 (const_string "<ssevecmode>")
3564 (const_string "TI"))
3565 (eq_attr "alternative" "3")
3566 (if_then_else (match_test "TARGET_AVX512DQ")
3567 (const_string "<avx512fvecmode>")
3568 (const_string "XI"))
3569 (and (match_test "<MODE_SIZE> == 16")
3570 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
3571 (const_string "V4SF")
3572 (match_test "TARGET_AVX")
3573 (const_string "<ssevecmode>")
3574 (match_test "optimize_function_for_size_p (cfun)")
3575 (const_string "V4SF")
3577 (const_string "<ssevecmode>")))])
3579 (define_expand "<code>tf3"
3580 [(set (match_operand:TF 0 "register_operand")
3582 (match_operand:TF 1 "vector_operand")
3583 (match_operand:TF 2 "vector_operand")))]
3585 "ix86_fixup_binary_operands_no_copy (<CODE>, TFmode, operands);")
3587 (define_insn "*<code>tf3"
3588 [(set (match_operand:TF 0 "register_operand" "=x,x,v,v")
3590 (match_operand:TF 1 "vector_operand" "%0,x,v,v")
3591 (match_operand:TF 2 "vector_operand" "xBm,xm,vm,v")))]
3592 "TARGET_SSE && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
3594 static char buf[128];
3597 = (which_alternative >= 2 ? "p<logic>q"
3598 : get_attr_mode (insn) == MODE_V4SF ? "<logic>ps" : "p<logic>");
3600 switch (which_alternative)
3603 ops = "%s\t{%%2, %%0|%%0, %%2}";
3607 ops = "v%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3610 ops = "v%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3616 snprintf (buf, sizeof (buf), ops, tmp);
3619 [(set_attr "isa" "noavx,avx,avx512vl,avx512f")
3620 (set_attr "type" "sselog")
3621 (set (attr "prefix_data16")
3623 (and (eq_attr "alternative" "0")
3624 (eq_attr "mode" "TI"))
3626 (const_string "*")))
3627 (set_attr "prefix" "orig,vex,evex,evex")
3629 (cond [(eq_attr "alternative" "2")
3631 (eq_attr "alternative" "3")
3633 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
3634 (const_string "V4SF")
3635 (match_test "TARGET_AVX")
3637 (ior (not (match_test "TARGET_SSE2"))
3638 (match_test "optimize_function_for_size_p (cfun)"))
3639 (const_string "V4SF")
3641 (const_string "TI")))])
3643 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3645 ;; FMA floating point multiply/accumulate instructions. These include
3646 ;; scalar versions of the instructions as well as vector versions.
3648 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3650 ;; The standard names for scalar FMA are only available with SSE math enabled.
3651 ;; CPUID bit AVX512F enables evex encoded scalar and 512-bit fma. It doesn't
3652 ;; care about FMA bit, so we enable fma for TARGET_AVX512F even when TARGET_FMA
3653 ;; and TARGET_FMA4 are both false.
3654 ;; TODO: In theory AVX512F does not automatically imply FMA, and without FMA
3655 ;; one must force the EVEX encoding of the fma insns. Ideally we'd improve
3656 ;; GAS to allow proper prefix selection. However, for the moment all hardware
3657 ;; that supports AVX512F also supports FMA so we can ignore this for now.
3658 (define_mode_iterator FMAMODEM
3659 [(SF "TARGET_SSE_MATH && (TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F)")
3660 (DF "TARGET_SSE_MATH && (TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F)")
3661 (V4SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3662 (V2DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3663 (V8SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3664 (V4DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3665 (V16SF "TARGET_AVX512F")
3666 (V8DF "TARGET_AVX512F")])
3668 (define_expand "fma<mode>4"
3669 [(set (match_operand:FMAMODEM 0 "register_operand")
3671 (match_operand:FMAMODEM 1 "nonimmediate_operand")
3672 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3673 (match_operand:FMAMODEM 3 "nonimmediate_operand")))])
3675 (define_expand "fms<mode>4"
3676 [(set (match_operand:FMAMODEM 0 "register_operand")
3678 (match_operand:FMAMODEM 1 "nonimmediate_operand")
3679 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3680 (neg:FMAMODEM (match_operand:FMAMODEM 3 "nonimmediate_operand"))))])
3682 (define_expand "fnma<mode>4"
3683 [(set (match_operand:FMAMODEM 0 "register_operand")
3685 (neg:FMAMODEM (match_operand:FMAMODEM 1 "nonimmediate_operand"))
3686 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3687 (match_operand:FMAMODEM 3 "nonimmediate_operand")))])
3689 (define_expand "fnms<mode>4"
3690 [(set (match_operand:FMAMODEM 0 "register_operand")
3692 (neg:FMAMODEM (match_operand:FMAMODEM 1 "nonimmediate_operand"))
3693 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3694 (neg:FMAMODEM (match_operand:FMAMODEM 3 "nonimmediate_operand"))))])
3696 ;; The builtins for intrinsics are not constrained by SSE math enabled.
3697 (define_mode_iterator FMAMODE_AVX512
3698 [(SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F")
3699 (DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F")
3700 (V4SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3701 (V2DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3702 (V8SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3703 (V4DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3704 (V16SF "TARGET_AVX512F")
3705 (V8DF "TARGET_AVX512F")])
3707 (define_mode_iterator FMAMODE
3708 [SF DF V4SF V2DF V8SF V4DF])
3710 (define_expand "fma4i_fmadd_<mode>"
3711 [(set (match_operand:FMAMODE_AVX512 0 "register_operand")
3713 (match_operand:FMAMODE_AVX512 1 "nonimmediate_operand")
3714 (match_operand:FMAMODE_AVX512 2 "nonimmediate_operand")
3715 (match_operand:FMAMODE_AVX512 3 "nonimmediate_operand")))])
3717 (define_expand "<avx512>_fmadd_<mode>_maskz<round_expand_name>"
3718 [(match_operand:VF_AVX512VL 0 "register_operand")
3719 (match_operand:VF_AVX512VL 1 "<round_expand_nimm_predicate>")
3720 (match_operand:VF_AVX512VL 2 "<round_expand_nimm_predicate>")
3721 (match_operand:VF_AVX512VL 3 "<round_expand_nimm_predicate>")
3722 (match_operand:<avx512fmaskmode> 4 "register_operand")]
3723 "TARGET_AVX512F && <round_mode512bit_condition>"
3725 emit_insn (gen_fma_fmadd_<mode>_maskz_1<round_expand_name> (
3726 operands[0], operands[1], operands[2], operands[3],
3727 CONST0_RTX (<MODE>mode), operands[4]<round_expand_operand>));
3731 (define_insn "*fma_fmadd_<mode>"
3732 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
3734 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x")
3735 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
3736 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x")))]
3737 "TARGET_FMA || TARGET_FMA4"
3739 vfmadd132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
3740 vfmadd213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
3741 vfmadd231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
3742 vfmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3743 vfmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3744 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3745 (set_attr "type" "ssemuladd")
3746 (set_attr "mode" "<MODE>")])
3748 ;; Suppose AVX-512F as baseline
3749 (define_mode_iterator VF_SF_AVX512VL
3750 [SF V16SF (V8SF "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
3751 DF V8DF (V4DF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
3753 (define_insn "<sd_mask_codefor>fma_fmadd_<mode><sd_maskz_name><round_name>"
3754 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3756 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
3757 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3758 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0")))]
3759 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3761 vfmadd132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3762 vfmadd213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3763 vfmadd231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
3764 [(set_attr "type" "ssemuladd")
3765 (set_attr "mode" "<MODE>")])
3767 (define_insn "<avx512>_fmadd_<mode>_mask<round_name>"
3768 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
3769 (vec_merge:VF_AVX512VL
3771 (match_operand:VF_AVX512VL 1 "register_operand" "0,0")
3772 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
3773 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>"))
3775 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
3776 "TARGET_AVX512F && <round_mode512bit_condition>"
3778 vfmadd132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
3779 vfmadd213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
3780 [(set_attr "type" "ssemuladd")
3781 (set_attr "mode" "<MODE>")])
3783 (define_insn "<avx512>_fmadd_<mode>_mask3<round_name>"
3784 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
3785 (vec_merge:VF_AVX512VL
3787 (match_operand:VF_AVX512VL 1 "register_operand" "v")
3788 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
3789 (match_operand:VF_AVX512VL 3 "register_operand" "0"))
3791 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
3793 "vfmadd231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
3794 [(set_attr "type" "ssemuladd")
3795 (set_attr "mode" "<MODE>")])
3797 (define_insn "*fma_fmsub_<mode>"
3798 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
3800 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x")
3801 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
3803 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x"))))]
3804 "TARGET_FMA || TARGET_FMA4"
3806 vfmsub132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
3807 vfmsub213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
3808 vfmsub231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
3809 vfmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3810 vfmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3811 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3812 (set_attr "type" "ssemuladd")
3813 (set_attr "mode" "<MODE>")])
3815 (define_insn "<sd_mask_codefor>fma_fmsub_<mode><sd_maskz_name><round_name>"
3816 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3818 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
3819 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3821 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0"))))]
3822 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3824 vfmsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3825 vfmsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3826 vfmsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
3827 [(set_attr "type" "ssemuladd")
3828 (set_attr "mode" "<MODE>")])
3830 (define_insn "<avx512>_fmsub_<mode>_mask<round_name>"
3831 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
3832 (vec_merge:VF_AVX512VL
3834 (match_operand:VF_AVX512VL 1 "register_operand" "0,0")
3835 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
3837 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>")))
3839 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
3842 vfmsub132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
3843 vfmsub213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
3844 [(set_attr "type" "ssemuladd")
3845 (set_attr "mode" "<MODE>")])
3847 (define_insn "<avx512>_fmsub_<mode>_mask3<round_name>"
3848 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
3849 (vec_merge:VF_AVX512VL
3851 (match_operand:VF_AVX512VL 1 "register_operand" "v")
3852 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
3854 (match_operand:VF_AVX512VL 3 "register_operand" "0")))
3856 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
3857 "TARGET_AVX512F && <round_mode512bit_condition>"
3858 "vfmsub231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
3859 [(set_attr "type" "ssemuladd")
3860 (set_attr "mode" "<MODE>")])
3862 (define_insn "*fma_fnmadd_<mode>"
3863 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
3866 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x"))
3867 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
3868 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x")))]
3869 "TARGET_FMA || TARGET_FMA4"
3871 vfnmadd132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
3872 vfnmadd213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
3873 vfnmadd231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
3874 vfnmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3875 vfnmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3876 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3877 (set_attr "type" "ssemuladd")
3878 (set_attr "mode" "<MODE>")])
3880 (define_insn "<sd_mask_codefor>fma_fnmadd_<mode><sd_maskz_name><round_name>"
3881 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3884 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v"))
3885 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3886 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0")))]
3887 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3889 vfnmadd132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3890 vfnmadd213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3891 vfnmadd231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
3892 [(set_attr "type" "ssemuladd")
3893 (set_attr "mode" "<MODE>")])
3895 (define_insn "<avx512>_fnmadd_<mode>_mask<round_name>"
3896 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
3897 (vec_merge:VF_AVX512VL
3900 (match_operand:VF_AVX512VL 1 "register_operand" "0,0"))
3901 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
3902 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>"))
3904 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
3905 "TARGET_AVX512F && <round_mode512bit_condition>"
3907 vfnmadd132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
3908 vfnmadd213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
3909 [(set_attr "type" "ssemuladd")
3910 (set_attr "mode" "<MODE>")])
3912 (define_insn "<avx512>_fnmadd_<mode>_mask3<round_name>"
3913 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
3914 (vec_merge:VF_AVX512VL
3917 (match_operand:VF_AVX512VL 1 "register_operand" "v"))
3918 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
3919 (match_operand:VF_AVX512VL 3 "register_operand" "0"))
3921 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
3922 "TARGET_AVX512F && <round_mode512bit_condition>"
3923 "vfnmadd231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
3924 [(set_attr "type" "ssemuladd")
3925 (set_attr "mode" "<MODE>")])
3927 (define_insn "*fma_fnmsub_<mode>"
3928 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
3931 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x"))
3932 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
3934 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x"))))]
3935 "TARGET_FMA || TARGET_FMA4"
3937 vfnmsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3938 vfnmsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3939 vfnmsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}
3940 vfnmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3941 vfnmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3942 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3943 (set_attr "type" "ssemuladd")
3944 (set_attr "mode" "<MODE>")])
3946 (define_insn "<sd_mask_codefor>fma_fnmsub_<mode><sd_maskz_name><round_name>"
3947 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3950 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v"))
3951 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3953 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0"))))]
3954 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3956 vfnmsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3957 vfnmsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3958 vfnmsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
3959 [(set_attr "type" "ssemuladd")
3960 (set_attr "mode" "<MODE>")])
3962 (define_insn "<avx512>_fnmsub_<mode>_mask<round_name>"
3963 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
3964 (vec_merge:VF_AVX512VL
3967 (match_operand:VF_AVX512VL 1 "register_operand" "0,0"))
3968 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
3970 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>")))
3972 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
3973 "TARGET_AVX512F && <round_mode512bit_condition>"
3975 vfnmsub132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
3976 vfnmsub213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
3977 [(set_attr "type" "ssemuladd")
3978 (set_attr "mode" "<MODE>")])
3980 (define_insn "<avx512>_fnmsub_<mode>_mask3<round_name>"
3981 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
3982 (vec_merge:VF_AVX512VL
3985 (match_operand:VF_AVX512VL 1 "register_operand" "v"))
3986 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
3988 (match_operand:VF_AVX512VL 3 "register_operand" "0")))
3990 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
3992 "vfnmsub231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
3993 [(set_attr "type" "ssemuladd")
3994 (set_attr "mode" "<MODE>")])
3996 ;; FMA parallel floating point multiply addsub and subadd operations.
3998 ;; It would be possible to represent these without the UNSPEC as
4001 ;; (fma op1 op2 op3)
4002 ;; (fma op1 op2 (neg op3))
4005 ;; But this doesn't seem useful in practice.
4007 (define_expand "fmaddsub_<mode>"
4008 [(set (match_operand:VF 0 "register_operand")
4010 [(match_operand:VF 1 "nonimmediate_operand")
4011 (match_operand:VF 2 "nonimmediate_operand")
4012 (match_operand:VF 3 "nonimmediate_operand")]
4014 "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F")
4016 (define_expand "<avx512>_fmaddsub_<mode>_maskz<round_expand_name>"
4017 [(match_operand:VF_AVX512VL 0 "register_operand")
4018 (match_operand:VF_AVX512VL 1 "<round_expand_nimm_predicate>")
4019 (match_operand:VF_AVX512VL 2 "<round_expand_nimm_predicate>")
4020 (match_operand:VF_AVX512VL 3 "<round_expand_nimm_predicate>")
4021 (match_operand:<avx512fmaskmode> 4 "register_operand")]
4024 emit_insn (gen_fma_fmaddsub_<mode>_maskz_1<round_expand_name> (
4025 operands[0], operands[1], operands[2], operands[3],
4026 CONST0_RTX (<MODE>mode), operands[4]<round_expand_operand>));
4030 (define_insn "*fma_fmaddsub_<mode>"
4031 [(set (match_operand:VF_128_256 0 "register_operand" "=v,v,v,x,x")
4033 [(match_operand:VF_128_256 1 "nonimmediate_operand" "%0,0,v,x,x")
4034 (match_operand:VF_128_256 2 "nonimmediate_operand" "vm,v,vm,x,m")
4035 (match_operand:VF_128_256 3 "nonimmediate_operand" "v,vm,0,xm,x")]
4037 "TARGET_FMA || TARGET_FMA4"
4039 vfmaddsub132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
4040 vfmaddsub213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
4041 vfmaddsub231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
4042 vfmaddsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
4043 vfmaddsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
4044 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
4045 (set_attr "type" "ssemuladd")
4046 (set_attr "mode" "<MODE>")])
4048 (define_insn "<sd_mask_codefor>fma_fmaddsub_<mode><sd_maskz_name><round_name>"
4049 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
4050 (unspec:VF_SF_AVX512VL
4051 [(match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
4052 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
4053 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0")]
4055 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
4057 vfmaddsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
4058 vfmaddsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
4059 vfmaddsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
4060 [(set_attr "type" "ssemuladd")
4061 (set_attr "mode" "<MODE>")])
4063 (define_insn "<avx512>_fmaddsub_<mode>_mask<round_name>"
4064 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
4065 (vec_merge:VF_AVX512VL
4067 [(match_operand:VF_AVX512VL 1 "register_operand" "0,0")
4068 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
4069 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>")]
4072 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
4075 vfmaddsub132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
4076 vfmaddsub213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
4077 [(set_attr "type" "ssemuladd")
4078 (set_attr "mode" "<MODE>")])
4080 (define_insn "<avx512>_fmaddsub_<mode>_mask3<round_name>"
4081 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
4082 (vec_merge:VF_AVX512VL
4084 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
4085 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
4086 (match_operand:VF_AVX512VL 3 "register_operand" "0")]
4089 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
4091 "vfmaddsub231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
4092 [(set_attr "type" "ssemuladd")
4093 (set_attr "mode" "<MODE>")])
4095 (define_insn "*fma_fmsubadd_<mode>"
4096 [(set (match_operand:VF_128_256 0 "register_operand" "=v,v,v,x,x")
4098 [(match_operand:VF_128_256 1 "nonimmediate_operand" "%0,0,v,x,x")
4099 (match_operand:VF_128_256 2 "nonimmediate_operand" "vm,v,vm,x,m")
4101 (match_operand:VF_128_256 3 "nonimmediate_operand" "v,vm,0,xm,x"))]
4103 "TARGET_FMA || TARGET_FMA4"
4105 vfmsubadd132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
4106 vfmsubadd213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
4107 vfmsubadd231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
4108 vfmsubadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
4109 vfmsubadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
4110 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
4111 (set_attr "type" "ssemuladd")
4112 (set_attr "mode" "<MODE>")])
4114 (define_insn "<sd_mask_codefor>fma_fmsubadd_<mode><sd_maskz_name><round_name>"
4115 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
4116 (unspec:VF_SF_AVX512VL
4117 [(match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
4118 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
4120 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0"))]
4122 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
4124 vfmsubadd132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
4125 vfmsubadd213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
4126 vfmsubadd231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
4127 [(set_attr "type" "ssemuladd")
4128 (set_attr "mode" "<MODE>")])
4130 (define_insn "<avx512>_fmsubadd_<mode>_mask<round_name>"
4131 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
4132 (vec_merge:VF_AVX512VL
4134 [(match_operand:VF_AVX512VL 1 "register_operand" "0,0")
4135 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
4137 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>"))]
4140 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
4143 vfmsubadd132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
4144 vfmsubadd213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
4145 [(set_attr "type" "ssemuladd")
4146 (set_attr "mode" "<MODE>")])
4148 (define_insn "<avx512>_fmsubadd_<mode>_mask3<round_name>"
4149 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
4150 (vec_merge:VF_AVX512VL
4152 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
4153 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
4155 (match_operand:VF_AVX512VL 3 "register_operand" "0"))]
4158 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
4160 "vfmsubadd231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
4161 [(set_attr "type" "ssemuladd")
4162 (set_attr "mode" "<MODE>")])
4164 ;; FMA3 floating point scalar intrinsics. These merge result with
4165 ;; high-order elements from the destination register.
4167 (define_expand "fmai_vmfmadd_<mode><round_name>"
4168 [(set (match_operand:VF_128 0 "register_operand")
4171 (match_operand:VF_128 1 "<round_nimm_predicate>")
4172 (match_operand:VF_128 2 "<round_nimm_predicate>")
4173 (match_operand:VF_128 3 "<round_nimm_predicate>"))
4178 (define_insn "*fmai_fmadd_<mode>"
4179 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4182 (match_operand:VF_128 1 "<round_nimm_predicate>" " 0, 0")
4183 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>, v")
4184 (match_operand:VF_128 3 "<round_nimm_predicate>" " v,<round_constraint>"))
4187 "TARGET_FMA || TARGET_AVX512F"
4189 vfmadd132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
4190 vfmadd213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
4191 [(set_attr "type" "ssemuladd")
4192 (set_attr "mode" "<MODE>")])
4194 (define_insn "*fmai_fmsub_<mode>"
4195 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4198 (match_operand:VF_128 1 "<round_nimm_predicate>" "0,0")
4199 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>,v")
4201 (match_operand:VF_128 3 "<round_nimm_predicate>" " v,<round_constraint>")))
4204 "TARGET_FMA || TARGET_AVX512F"
4206 vfmsub132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
4207 vfmsub213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
4208 [(set_attr "type" "ssemuladd")
4209 (set_attr "mode" "<MODE>")])
4211 (define_insn "*fmai_fnmadd_<mode><round_name>"
4212 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4216 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>,v"))
4217 (match_operand:VF_128 1 "<round_nimm_predicate>" "0,0")
4218 (match_operand:VF_128 3 "<round_nimm_predicate>" "v,<round_constraint>"))
4221 "TARGET_FMA || TARGET_AVX512F"
4223 vfnmadd132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
4224 vfnmadd213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
4225 [(set_attr "type" "ssemuladd")
4226 (set_attr "mode" "<MODE>")])
4228 (define_insn "*fmai_fnmsub_<mode><round_name>"
4229 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4233 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>, v"))
4234 (match_operand:VF_128 1 "<round_nimm_predicate>" " 0, 0")
4236 (match_operand:VF_128 3 "<round_nimm_predicate>" " v,<round_constraint>")))
4239 "TARGET_FMA || TARGET_AVX512F"
4241 vfnmsub132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
4242 vfnmsub213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
4243 [(set_attr "type" "ssemuladd")
4244 (set_attr "mode" "<MODE>")])
4246 ;; FMA4 floating point scalar intrinsics. These write the
4247 ;; entire destination register, with the high-order elements zeroed.
4249 (define_expand "fma4i_vmfmadd_<mode>"
4250 [(set (match_operand:VF_128 0 "register_operand")
4253 (match_operand:VF_128 1 "nonimmediate_operand")
4254 (match_operand:VF_128 2 "nonimmediate_operand")
4255 (match_operand:VF_128 3 "nonimmediate_operand"))
4259 "operands[4] = CONST0_RTX (<MODE>mode);")
4261 (define_insn "*fma4i_vmfmadd_<mode>"
4262 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
4265 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x")
4266 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
4267 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x"))
4268 (match_operand:VF_128 4 "const0_operand")
4271 "vfmadd<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
4272 [(set_attr "type" "ssemuladd")
4273 (set_attr "mode" "<MODE>")])
4275 (define_insn "*fma4i_vmfmsub_<mode>"
4276 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
4279 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x")
4280 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
4282 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x")))
4283 (match_operand:VF_128 4 "const0_operand")
4286 "vfmsub<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
4287 [(set_attr "type" "ssemuladd")
4288 (set_attr "mode" "<MODE>")])
4290 (define_insn "*fma4i_vmfnmadd_<mode>"
4291 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
4295 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x"))
4296 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
4297 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x"))
4298 (match_operand:VF_128 4 "const0_operand")
4301 "vfnmadd<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
4302 [(set_attr "type" "ssemuladd")
4303 (set_attr "mode" "<MODE>")])
4305 (define_insn "*fma4i_vmfnmsub_<mode>"
4306 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
4310 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x"))
4311 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
4313 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x")))
4314 (match_operand:VF_128 4 "const0_operand")
4317 "vfnmsub<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
4318 [(set_attr "type" "ssemuladd")
4319 (set_attr "mode" "<MODE>")])
4321 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4323 ;; Parallel single-precision floating point conversion operations
4325 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4327 (define_insn "sse_cvtpi2ps"
4328 [(set (match_operand:V4SF 0 "register_operand" "=x")
4331 (float:V2SF (match_operand:V2SI 2 "nonimmediate_operand" "ym")))
4332 (match_operand:V4SF 1 "register_operand" "0")
4335 "cvtpi2ps\t{%2, %0|%0, %2}"
4336 [(set_attr "type" "ssecvt")
4337 (set_attr "mode" "V4SF")])
4339 (define_insn "sse_cvtps2pi"
4340 [(set (match_operand:V2SI 0 "register_operand" "=y")
4342 (unspec:V4SI [(match_operand:V4SF 1 "nonimmediate_operand" "xm")]
4344 (parallel [(const_int 0) (const_int 1)])))]
4346 "cvtps2pi\t{%1, %0|%0, %q1}"
4347 [(set_attr "type" "ssecvt")
4348 (set_attr "unit" "mmx")
4349 (set_attr "mode" "DI")])
4351 (define_insn "sse_cvttps2pi"
4352 [(set (match_operand:V2SI 0 "register_operand" "=y")
4354 (fix:V4SI (match_operand:V4SF 1 "nonimmediate_operand" "xm"))
4355 (parallel [(const_int 0) (const_int 1)])))]
4357 "cvttps2pi\t{%1, %0|%0, %q1}"
4358 [(set_attr "type" "ssecvt")
4359 (set_attr "unit" "mmx")
4360 (set_attr "prefix_rep" "0")
4361 (set_attr "mode" "SF")])
4363 (define_insn "sse_cvtsi2ss<round_name>"
4364 [(set (match_operand:V4SF 0 "register_operand" "=x,x,v")
4367 (float:SF (match_operand:SI 2 "<round_nimm_scalar_predicate>" "r,m,<round_constraint3>")))
4368 (match_operand:V4SF 1 "register_operand" "0,0,v")
4372 cvtsi2ss\t{%2, %0|%0, %2}
4373 cvtsi2ss\t{%2, %0|%0, %2}
4374 vcvtsi2ss\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4375 [(set_attr "isa" "noavx,noavx,avx")
4376 (set_attr "type" "sseicvt")
4377 (set_attr "athlon_decode" "vector,double,*")
4378 (set_attr "amdfam10_decode" "vector,double,*")
4379 (set_attr "bdver1_decode" "double,direct,*")
4380 (set_attr "btver2_decode" "double,double,double")
4381 (set_attr "znver1_decode" "double,double,double")
4382 (set_attr "prefix" "orig,orig,maybe_evex")
4383 (set_attr "mode" "SF")])
4385 (define_insn "sse_cvtsi2ssq<round_name>"
4386 [(set (match_operand:V4SF 0 "register_operand" "=x,x,v")
4389 (float:SF (match_operand:DI 2 "<round_nimm_scalar_predicate>" "r,m,<round_constraint3>")))
4390 (match_operand:V4SF 1 "register_operand" "0,0,v")
4392 "TARGET_SSE && TARGET_64BIT"
4394 cvtsi2ssq\t{%2, %0|%0, %2}
4395 cvtsi2ssq\t{%2, %0|%0, %2}
4396 vcvtsi2ssq\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4397 [(set_attr "isa" "noavx,noavx,avx")
4398 (set_attr "type" "sseicvt")
4399 (set_attr "athlon_decode" "vector,double,*")
4400 (set_attr "amdfam10_decode" "vector,double,*")
4401 (set_attr "bdver1_decode" "double,direct,*")
4402 (set_attr "btver2_decode" "double,double,double")
4403 (set_attr "length_vex" "*,*,4")
4404 (set_attr "prefix_rex" "1,1,*")
4405 (set_attr "prefix" "orig,orig,maybe_evex")
4406 (set_attr "mode" "SF")])
4408 (define_insn "sse_cvtss2si<round_name>"
4409 [(set (match_operand:SI 0 "register_operand" "=r,r")
4412 (match_operand:V4SF 1 "<round_nimm_scalar_predicate>" "v,<round_constraint2>")
4413 (parallel [(const_int 0)]))]
4414 UNSPEC_FIX_NOTRUNC))]
4416 "%vcvtss2si\t{<round_op2>%1, %0|%0, %k1<round_op2>}"
4417 [(set_attr "type" "sseicvt")
4418 (set_attr "athlon_decode" "double,vector")
4419 (set_attr "bdver1_decode" "double,double")
4420 (set_attr "prefix_rep" "1")
4421 (set_attr "prefix" "maybe_vex")
4422 (set_attr "mode" "SI")])
4424 (define_insn "sse_cvtss2si_2"
4425 [(set (match_operand:SI 0 "register_operand" "=r,r")
4426 (unspec:SI [(match_operand:SF 1 "nonimmediate_operand" "v,m")]
4427 UNSPEC_FIX_NOTRUNC))]
4429 "%vcvtss2si\t{%1, %0|%0, %k1}"
4430 [(set_attr "type" "sseicvt")
4431 (set_attr "athlon_decode" "double,vector")
4432 (set_attr "amdfam10_decode" "double,double")
4433 (set_attr "bdver1_decode" "double,double")
4434 (set_attr "prefix_rep" "1")
4435 (set_attr "prefix" "maybe_vex")
4436 (set_attr "mode" "SI")])
4438 (define_insn "sse_cvtss2siq<round_name>"
4439 [(set (match_operand:DI 0 "register_operand" "=r,r")
4442 (match_operand:V4SF 1 "<round_nimm_scalar_predicate>" "v,<round_constraint2>")
4443 (parallel [(const_int 0)]))]
4444 UNSPEC_FIX_NOTRUNC))]
4445 "TARGET_SSE && TARGET_64BIT"
4446 "%vcvtss2si{q}\t{<round_op2>%1, %0|%0, %k1<round_op2>}"
4447 [(set_attr "type" "sseicvt")
4448 (set_attr "athlon_decode" "double,vector")
4449 (set_attr "bdver1_decode" "double,double")
4450 (set_attr "prefix_rep" "1")
4451 (set_attr "prefix" "maybe_vex")
4452 (set_attr "mode" "DI")])
4454 (define_insn "sse_cvtss2siq_2"
4455 [(set (match_operand:DI 0 "register_operand" "=r,r")
4456 (unspec:DI [(match_operand:SF 1 "nonimmediate_operand" "v,m")]
4457 UNSPEC_FIX_NOTRUNC))]
4458 "TARGET_SSE && TARGET_64BIT"
4459 "%vcvtss2si{q}\t{%1, %0|%0, %k1}"
4460 [(set_attr "type" "sseicvt")
4461 (set_attr "athlon_decode" "double,vector")
4462 (set_attr "amdfam10_decode" "double,double")
4463 (set_attr "bdver1_decode" "double,double")
4464 (set_attr "prefix_rep" "1")
4465 (set_attr "prefix" "maybe_vex")
4466 (set_attr "mode" "DI")])
4468 (define_insn "sse_cvttss2si<round_saeonly_name>"
4469 [(set (match_operand:SI 0 "register_operand" "=r,r")
4472 (match_operand:V4SF 1 "<round_saeonly_nimm_scalar_predicate>" "v,<round_saeonly_constraint2>")
4473 (parallel [(const_int 0)]))))]
4475 "%vcvttss2si\t{<round_saeonly_op2>%1, %0|%0, %k1<round_saeonly_op2>}"
4476 [(set_attr "type" "sseicvt")
4477 (set_attr "athlon_decode" "double,vector")
4478 (set_attr "amdfam10_decode" "double,double")
4479 (set_attr "bdver1_decode" "double,double")
4480 (set_attr "prefix_rep" "1")
4481 (set_attr "prefix" "maybe_vex")
4482 (set_attr "mode" "SI")])
4484 (define_insn "sse_cvttss2siq<round_saeonly_name>"
4485 [(set (match_operand:DI 0 "register_operand" "=r,r")
4488 (match_operand:V4SF 1 "<round_saeonly_nimm_scalar_predicate>" "v,<round_saeonly_constraint>")
4489 (parallel [(const_int 0)]))))]
4490 "TARGET_SSE && TARGET_64BIT"
4491 "%vcvttss2si{q}\t{<round_saeonly_op2>%1, %0|%0, %k1<round_saeonly_op2>}"
4492 [(set_attr "type" "sseicvt")
4493 (set_attr "athlon_decode" "double,vector")
4494 (set_attr "amdfam10_decode" "double,double")
4495 (set_attr "bdver1_decode" "double,double")
4496 (set_attr "prefix_rep" "1")
4497 (set_attr "prefix" "maybe_vex")
4498 (set_attr "mode" "DI")])
4500 (define_insn "cvtusi2<ssescalarmodesuffix>32<round_name>"
4501 [(set (match_operand:VF_128 0 "register_operand" "=v")
4503 (vec_duplicate:VF_128
4504 (unsigned_float:<ssescalarmode>
4505 (match_operand:SI 2 "<round_nimm_predicate>" "<round_constraint3>")))
4506 (match_operand:VF_128 1 "register_operand" "v")
4508 "TARGET_AVX512F && <round_modev4sf_condition>"
4509 "vcvtusi2<ssescalarmodesuffix>\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4510 [(set_attr "type" "sseicvt")
4511 (set_attr "prefix" "evex")
4512 (set_attr "mode" "<ssescalarmode>")])
4514 (define_insn "cvtusi2<ssescalarmodesuffix>64<round_name>"
4515 [(set (match_operand:VF_128 0 "register_operand" "=v")
4517 (vec_duplicate:VF_128
4518 (unsigned_float:<ssescalarmode>
4519 (match_operand:DI 2 "<round_nimm_predicate>" "<round_constraint3>")))
4520 (match_operand:VF_128 1 "register_operand" "v")
4522 "TARGET_AVX512F && TARGET_64BIT"
4523 "vcvtusi2<ssescalarmodesuffix>\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4524 [(set_attr "type" "sseicvt")
4525 (set_attr "prefix" "evex")
4526 (set_attr "mode" "<ssescalarmode>")])
4528 (define_insn "float<sseintvecmodelower><mode>2<mask_name><round_name>"
4529 [(set (match_operand:VF1 0 "register_operand" "=x,v")
4531 (match_operand:<sseintvecmode> 1 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
4532 "TARGET_SSE2 && <mask_mode512bit_condition> && <round_mode512bit_condition>"
4534 cvtdq2ps\t{%1, %0|%0, %1}
4535 vcvtdq2ps\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4536 [(set_attr "isa" "noavx,avx")
4537 (set_attr "type" "ssecvt")
4538 (set_attr "prefix" "maybe_vex")
4539 (set_attr "mode" "<sseinsnmode>")])
4541 (define_insn "ufloat<sseintvecmodelower><mode>2<mask_name><round_name>"
4542 [(set (match_operand:VF1_AVX512VL 0 "register_operand" "=v")
4543 (unsigned_float:VF1_AVX512VL
4544 (match_operand:<sseintvecmode> 1 "nonimmediate_operand" "<round_constraint>")))]
4546 "vcvtudq2ps\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4547 [(set_attr "type" "ssecvt")
4548 (set_attr "prefix" "evex")
4549 (set_attr "mode" "<MODE>")])
4551 (define_expand "floatuns<sseintvecmodelower><mode>2"
4552 [(match_operand:VF1 0 "register_operand")
4553 (match_operand:<sseintvecmode> 1 "register_operand")]
4554 "TARGET_SSE2 && (<MODE>mode == V4SFmode || TARGET_AVX2)"
4556 if (<MODE>mode == V16SFmode)
4557 emit_insn (gen_ufloatv16siv16sf2 (operands[0], operands[1]));
4559 if (TARGET_AVX512VL)
4561 if (<MODE>mode == V4SFmode)
4562 emit_insn (gen_ufloatv4siv4sf2 (operands[0], operands[1]));
4564 emit_insn (gen_ufloatv8siv8sf2 (operands[0], operands[1]));
4567 ix86_expand_vector_convert_uns_vsivsf (operands[0], operands[1]);
4573 ;; For <sse2_avx_avx512f>_fix_notrunc<sf2simodelower><mode> insn pattern
4574 (define_mode_attr sf2simodelower
4575 [(V16SI "v16sf") (V8SI "v8sf") (V4SI "v4sf")])
4577 (define_insn "<sse2_avx_avx512f>_fix_notrunc<sf2simodelower><mode><mask_name>"
4578 [(set (match_operand:VI4_AVX 0 "register_operand" "=v")
4580 [(match_operand:<ssePSmode> 1 "vector_operand" "vBm")]
4581 UNSPEC_FIX_NOTRUNC))]
4582 "TARGET_SSE2 && <mask_mode512bit_condition>"
4583 "%vcvtps2dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4584 [(set_attr "type" "ssecvt")
4585 (set (attr "prefix_data16")
4587 (match_test "TARGET_AVX")
4589 (const_string "1")))
4590 (set_attr "prefix" "maybe_vex")
4591 (set_attr "mode" "<sseinsnmode>")])
4593 (define_insn "avx512f_fix_notruncv16sfv16si<mask_name><round_name>"
4594 [(set (match_operand:V16SI 0 "register_operand" "=v")
4596 [(match_operand:V16SF 1 "<round_nimm_predicate>" "<round_constraint>")]
4597 UNSPEC_FIX_NOTRUNC))]
4599 "vcvtps2dq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4600 [(set_attr "type" "ssecvt")
4601 (set_attr "prefix" "evex")
4602 (set_attr "mode" "XI")])
4604 (define_insn "<mask_codefor><avx512>_ufix_notrunc<sf2simodelower><mode><mask_name><round_name>"
4605 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
4606 (unspec:VI4_AVX512VL
4607 [(match_operand:<ssePSmode> 1 "nonimmediate_operand" "<round_constraint>")]
4608 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4610 "vcvtps2udq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4611 [(set_attr "type" "ssecvt")
4612 (set_attr "prefix" "evex")
4613 (set_attr "mode" "<sseinsnmode>")])
4615 (define_insn "<mask_codefor>avx512dq_cvtps2qq<mode><mask_name><round_name>"
4616 [(set (match_operand:VI8_256_512 0 "register_operand" "=v")
4617 (unspec:VI8_256_512 [(match_operand:<ssePSmode2> 1 "nonimmediate_operand" "<round_constraint>")]
4618 UNSPEC_FIX_NOTRUNC))]
4619 "TARGET_AVX512DQ && <round_mode512bit_condition>"
4620 "vcvtps2qq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4621 [(set_attr "type" "ssecvt")
4622 (set_attr "prefix" "evex")
4623 (set_attr "mode" "<sseinsnmode>")])
4625 (define_insn "<mask_codefor>avx512dq_cvtps2qqv2di<mask_name>"
4626 [(set (match_operand:V2DI 0 "register_operand" "=v")
4629 (match_operand:V4SF 1 "nonimmediate_operand" "vm")
4630 (parallel [(const_int 0) (const_int 1)]))]
4631 UNSPEC_FIX_NOTRUNC))]
4632 "TARGET_AVX512DQ && TARGET_AVX512VL"
4633 "vcvtps2qq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
4634 [(set_attr "type" "ssecvt")
4635 (set_attr "prefix" "evex")
4636 (set_attr "mode" "TI")])
4638 (define_insn "<mask_codefor>avx512dq_cvtps2uqq<mode><mask_name><round_name>"
4639 [(set (match_operand:VI8_256_512 0 "register_operand" "=v")
4640 (unspec:VI8_256_512 [(match_operand:<ssePSmode2> 1 "nonimmediate_operand" "<round_constraint>")]
4641 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4642 "TARGET_AVX512DQ && <round_mode512bit_condition>"
4643 "vcvtps2uqq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4644 [(set_attr "type" "ssecvt")
4645 (set_attr "prefix" "evex")
4646 (set_attr "mode" "<sseinsnmode>")])
4648 (define_insn "<mask_codefor>avx512dq_cvtps2uqqv2di<mask_name>"
4649 [(set (match_operand:V2DI 0 "register_operand" "=v")
4652 (match_operand:V4SF 1 "nonimmediate_operand" "vm")
4653 (parallel [(const_int 0) (const_int 1)]))]
4654 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4655 "TARGET_AVX512DQ && TARGET_AVX512VL"
4656 "vcvtps2uqq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
4657 [(set_attr "type" "ssecvt")
4658 (set_attr "prefix" "evex")
4659 (set_attr "mode" "TI")])
4661 (define_insn "<fixsuffix>fix_truncv16sfv16si2<mask_name><round_saeonly_name>"
4662 [(set (match_operand:V16SI 0 "register_operand" "=v")
4664 (match_operand:V16SF 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
4666 "vcvttps2<fixsuffix>dq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
4667 [(set_attr "type" "ssecvt")
4668 (set_attr "prefix" "evex")
4669 (set_attr "mode" "XI")])
4671 (define_insn "fix_truncv8sfv8si2<mask_name>"
4672 [(set (match_operand:V8SI 0 "register_operand" "=v")
4673 (fix:V8SI (match_operand:V8SF 1 "nonimmediate_operand" "vm")))]
4674 "TARGET_AVX && <mask_avx512vl_condition>"
4675 "vcvttps2dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4676 [(set_attr "type" "ssecvt")
4677 (set_attr "prefix" "<mask_prefix>")
4678 (set_attr "mode" "OI")])
4680 (define_insn "fix_truncv4sfv4si2<mask_name>"
4681 [(set (match_operand:V4SI 0 "register_operand" "=v")
4682 (fix:V4SI (match_operand:V4SF 1 "vector_operand" "vBm")))]
4683 "TARGET_SSE2 && <mask_avx512vl_condition>"
4684 "%vcvttps2dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4685 [(set_attr "type" "ssecvt")
4686 (set (attr "prefix_rep")
4688 (match_test "TARGET_AVX")
4690 (const_string "1")))
4691 (set (attr "prefix_data16")
4693 (match_test "TARGET_AVX")
4695 (const_string "0")))
4696 (set_attr "prefix_data16" "0")
4697 (set_attr "prefix" "<mask_prefix2>")
4698 (set_attr "mode" "TI")])
4700 (define_expand "fixuns_trunc<mode><sseintvecmodelower>2"
4701 [(match_operand:<sseintvecmode> 0 "register_operand")
4702 (match_operand:VF1 1 "register_operand")]
4705 if (<MODE>mode == V16SFmode)
4706 emit_insn (gen_ufix_truncv16sfv16si2 (operands[0],
4711 tmp[0] = ix86_expand_adjust_ufix_to_sfix_si (operands[1], &tmp[2]);
4712 tmp[1] = gen_reg_rtx (<sseintvecmode>mode);
4713 emit_insn (gen_fix_trunc<mode><sseintvecmodelower>2 (tmp[1], tmp[0]));
4714 emit_insn (gen_xor<sseintvecmodelower>3 (operands[0], tmp[1], tmp[2]));
4719 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4721 ;; Parallel double-precision floating point conversion operations
4723 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4725 (define_insn "sse2_cvtpi2pd"
4726 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
4727 (float:V2DF (match_operand:V2SI 1 "nonimmediate_operand" "y,m")))]
4729 "cvtpi2pd\t{%1, %0|%0, %1}"
4730 [(set_attr "type" "ssecvt")
4731 (set_attr "unit" "mmx,*")
4732 (set_attr "prefix_data16" "1,*")
4733 (set_attr "mode" "V2DF")])
4735 (define_insn "sse2_cvtpd2pi"
4736 [(set (match_operand:V2SI 0 "register_operand" "=y")
4737 (unspec:V2SI [(match_operand:V2DF 1 "nonimmediate_operand" "xm")]
4738 UNSPEC_FIX_NOTRUNC))]
4740 "cvtpd2pi\t{%1, %0|%0, %1}"
4741 [(set_attr "type" "ssecvt")
4742 (set_attr "unit" "mmx")
4743 (set_attr "bdver1_decode" "double")
4744 (set_attr "btver2_decode" "direct")
4745 (set_attr "prefix_data16" "1")
4746 (set_attr "mode" "DI")])
4748 (define_insn "sse2_cvttpd2pi"
4749 [(set (match_operand:V2SI 0 "register_operand" "=y")
4750 (fix:V2SI (match_operand:V2DF 1 "nonimmediate_operand" "xm")))]
4752 "cvttpd2pi\t{%1, %0|%0, %1}"
4753 [(set_attr "type" "ssecvt")
4754 (set_attr "unit" "mmx")
4755 (set_attr "bdver1_decode" "double")
4756 (set_attr "prefix_data16" "1")
4757 (set_attr "mode" "TI")])
4759 (define_insn "sse2_cvtsi2sd"
4760 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
4763 (float:DF (match_operand:SI 2 "nonimmediate_operand" "r,m,rm")))
4764 (match_operand:V2DF 1 "register_operand" "0,0,v")
4768 cvtsi2sd\t{%2, %0|%0, %2}
4769 cvtsi2sd\t{%2, %0|%0, %2}
4770 vcvtsi2sd\t{%2, %1, %0|%0, %1, %2}"
4771 [(set_attr "isa" "noavx,noavx,avx")
4772 (set_attr "type" "sseicvt")
4773 (set_attr "athlon_decode" "double,direct,*")
4774 (set_attr "amdfam10_decode" "vector,double,*")
4775 (set_attr "bdver1_decode" "double,direct,*")
4776 (set_attr "btver2_decode" "double,double,double")
4777 (set_attr "znver1_decode" "double,double,double")
4778 (set_attr "prefix" "orig,orig,maybe_evex")
4779 (set_attr "mode" "DF")])
4781 (define_insn "sse2_cvtsi2sdq<round_name>"
4782 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
4785 (float:DF (match_operand:DI 2 "<round_nimm_scalar_predicate>" "r,m,<round_constraint3>")))
4786 (match_operand:V2DF 1 "register_operand" "0,0,v")
4788 "TARGET_SSE2 && TARGET_64BIT"
4790 cvtsi2sdq\t{%2, %0|%0, %2}
4791 cvtsi2sdq\t{%2, %0|%0, %2}
4792 vcvtsi2sdq\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4793 [(set_attr "isa" "noavx,noavx,avx")
4794 (set_attr "type" "sseicvt")
4795 (set_attr "athlon_decode" "double,direct,*")
4796 (set_attr "amdfam10_decode" "vector,double,*")
4797 (set_attr "bdver1_decode" "double,direct,*")
4798 (set_attr "length_vex" "*,*,4")
4799 (set_attr "prefix_rex" "1,1,*")
4800 (set_attr "prefix" "orig,orig,maybe_evex")
4801 (set_attr "mode" "DF")])
4803 (define_insn "avx512f_vcvtss2usi<round_name>"
4804 [(set (match_operand:SI 0 "register_operand" "=r")
4807 (match_operand:V4SF 1 "<round_nimm_predicate>" "<round_constraint>")
4808 (parallel [(const_int 0)]))]
4809 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4811 "vcvtss2usi\t{<round_op2>%1, %0|%0, %k1<round_op2>}"
4812 [(set_attr "type" "sseicvt")
4813 (set_attr "prefix" "evex")
4814 (set_attr "mode" "SI")])
4816 (define_insn "avx512f_vcvtss2usiq<round_name>"
4817 [(set (match_operand:DI 0 "register_operand" "=r")
4820 (match_operand:V4SF 1 "<round_nimm_predicate>" "<round_constraint>")
4821 (parallel [(const_int 0)]))]
4822 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4823 "TARGET_AVX512F && TARGET_64BIT"
4824 "vcvtss2usi\t{<round_op2>%1, %0|%0, %k1<round_op2>}"
4825 [(set_attr "type" "sseicvt")
4826 (set_attr "prefix" "evex")
4827 (set_attr "mode" "DI")])
4829 (define_insn "avx512f_vcvttss2usi<round_saeonly_name>"
4830 [(set (match_operand:SI 0 "register_operand" "=r")
4833 (match_operand:V4SF 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
4834 (parallel [(const_int 0)]))))]
4836 "vcvttss2usi\t{<round_saeonly_op2>%1, %0|%0, %k1<round_saeonly_op2>}"
4837 [(set_attr "type" "sseicvt")
4838 (set_attr "prefix" "evex")
4839 (set_attr "mode" "SI")])
4841 (define_insn "avx512f_vcvttss2usiq<round_saeonly_name>"
4842 [(set (match_operand:DI 0 "register_operand" "=r")
4845 (match_operand:V4SF 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
4846 (parallel [(const_int 0)]))))]
4847 "TARGET_AVX512F && TARGET_64BIT"
4848 "vcvttss2usi\t{<round_saeonly_op2>%1, %0|%0, %k1<round_saeonly_op2>}"
4849 [(set_attr "type" "sseicvt")
4850 (set_attr "prefix" "evex")
4851 (set_attr "mode" "DI")])
4853 (define_insn "avx512f_vcvtsd2usi<round_name>"
4854 [(set (match_operand:SI 0 "register_operand" "=r")
4857 (match_operand:V2DF 1 "<round_nimm_predicate>" "<round_constraint>")
4858 (parallel [(const_int 0)]))]
4859 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4861 "vcvtsd2usi\t{<round_op2>%1, %0|%0, %q1<round_op2>}"
4862 [(set_attr "type" "sseicvt")
4863 (set_attr "prefix" "evex")
4864 (set_attr "mode" "SI")])
4866 (define_insn "avx512f_vcvtsd2usiq<round_name>"
4867 [(set (match_operand:DI 0 "register_operand" "=r")
4870 (match_operand:V2DF 1 "<round_nimm_predicate>" "<round_constraint>")
4871 (parallel [(const_int 0)]))]
4872 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4873 "TARGET_AVX512F && TARGET_64BIT"
4874 "vcvtsd2usi\t{<round_op2>%1, %0|%0, %q1<round_op2>}"
4875 [(set_attr "type" "sseicvt")
4876 (set_attr "prefix" "evex")
4877 (set_attr "mode" "DI")])
4879 (define_insn "avx512f_vcvttsd2usi<round_saeonly_name>"
4880 [(set (match_operand:SI 0 "register_operand" "=r")
4883 (match_operand:V2DF 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
4884 (parallel [(const_int 0)]))))]
4886 "vcvttsd2usi\t{<round_saeonly_op2>%1, %0|%0, %q1<round_saeonly_op2>}"
4887 [(set_attr "type" "sseicvt")
4888 (set_attr "prefix" "evex")
4889 (set_attr "mode" "SI")])
4891 (define_insn "avx512f_vcvttsd2usiq<round_saeonly_name>"
4892 [(set (match_operand:DI 0 "register_operand" "=r")
4895 (match_operand:V2DF 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
4896 (parallel [(const_int 0)]))))]
4897 "TARGET_AVX512F && TARGET_64BIT"
4898 "vcvttsd2usi\t{<round_saeonly_op2>%1, %0|%0, %q1<round_saeonly_op2>}"
4899 [(set_attr "type" "sseicvt")
4900 (set_attr "prefix" "evex")
4901 (set_attr "mode" "DI")])
4903 (define_insn "sse2_cvtsd2si<round_name>"
4904 [(set (match_operand:SI 0 "register_operand" "=r,r")
4907 (match_operand:V2DF 1 "<round_nimm_scalar_predicate>" "v,<round_constraint2>")
4908 (parallel [(const_int 0)]))]
4909 UNSPEC_FIX_NOTRUNC))]
4911 "%vcvtsd2si\t{<round_op2>%1, %0|%0, %q1<round_op2>}"
4912 [(set_attr "type" "sseicvt")
4913 (set_attr "athlon_decode" "double,vector")
4914 (set_attr "bdver1_decode" "double,double")
4915 (set_attr "btver2_decode" "double,double")
4916 (set_attr "prefix_rep" "1")
4917 (set_attr "prefix" "maybe_vex")
4918 (set_attr "mode" "SI")])
4920 (define_insn "sse2_cvtsd2si_2"
4921 [(set (match_operand:SI 0 "register_operand" "=r,r")
4922 (unspec:SI [(match_operand:DF 1 "nonimmediate_operand" "v,m")]
4923 UNSPEC_FIX_NOTRUNC))]
4925 "%vcvtsd2si\t{%1, %0|%0, %q1}"
4926 [(set_attr "type" "sseicvt")
4927 (set_attr "athlon_decode" "double,vector")
4928 (set_attr "amdfam10_decode" "double,double")
4929 (set_attr "bdver1_decode" "double,double")
4930 (set_attr "prefix_rep" "1")
4931 (set_attr "prefix" "maybe_vex")
4932 (set_attr "mode" "SI")])
4934 (define_insn "sse2_cvtsd2siq<round_name>"
4935 [(set (match_operand:DI 0 "register_operand" "=r,r")
4938 (match_operand:V2DF 1 "<round_nimm_scalar_predicate>" "v,<round_constraint2>")
4939 (parallel [(const_int 0)]))]
4940 UNSPEC_FIX_NOTRUNC))]
4941 "TARGET_SSE2 && TARGET_64BIT"
4942 "%vcvtsd2si{q}\t{<round_op2>%1, %0|%0, %q1<round_op2>}"
4943 [(set_attr "type" "sseicvt")
4944 (set_attr "athlon_decode" "double,vector")
4945 (set_attr "bdver1_decode" "double,double")
4946 (set_attr "prefix_rep" "1")
4947 (set_attr "prefix" "maybe_vex")
4948 (set_attr "mode" "DI")])
4950 (define_insn "sse2_cvtsd2siq_2"
4951 [(set (match_operand:DI 0 "register_operand" "=r,r")
4952 (unspec:DI [(match_operand:DF 1 "nonimmediate_operand" "v,m")]
4953 UNSPEC_FIX_NOTRUNC))]
4954 "TARGET_SSE2 && TARGET_64BIT"
4955 "%vcvtsd2si{q}\t{%1, %0|%0, %q1}"
4956 [(set_attr "type" "sseicvt")
4957 (set_attr "athlon_decode" "double,vector")
4958 (set_attr "amdfam10_decode" "double,double")
4959 (set_attr "bdver1_decode" "double,double")
4960 (set_attr "prefix_rep" "1")
4961 (set_attr "prefix" "maybe_vex")
4962 (set_attr "mode" "DI")])
4964 (define_insn "sse2_cvttsd2si<round_saeonly_name>"
4965 [(set (match_operand:SI 0 "register_operand" "=r,r")
4968 (match_operand:V2DF 1 "<round_saeonly_nimm_scalar_predicate>" "v,<round_saeonly_constraint2>")
4969 (parallel [(const_int 0)]))))]
4971 "%vcvttsd2si\t{<round_saeonly_op2>%1, %0|%0, %q1<round_saeonly_op2>}"
4972 [(set_attr "type" "sseicvt")
4973 (set_attr "athlon_decode" "double,vector")
4974 (set_attr "amdfam10_decode" "double,double")
4975 (set_attr "bdver1_decode" "double,double")
4976 (set_attr "btver2_decode" "double,double")
4977 (set_attr "prefix_rep" "1")
4978 (set_attr "prefix" "maybe_vex")
4979 (set_attr "mode" "SI")])
4981 (define_insn "sse2_cvttsd2siq<round_saeonly_name>"
4982 [(set (match_operand:DI 0 "register_operand" "=r,r")
4985 (match_operand:V2DF 1 "<round_saeonly_nimm_scalar_predicate>" "v,<round_saeonly_constraint2>")
4986 (parallel [(const_int 0)]))))]
4987 "TARGET_SSE2 && TARGET_64BIT"
4988 "%vcvttsd2si{q}\t{<round_saeonly_op2>%1, %0|%0, %q1<round_saeonly_op2>}"
4989 [(set_attr "type" "sseicvt")
4990 (set_attr "athlon_decode" "double,vector")
4991 (set_attr "amdfam10_decode" "double,double")
4992 (set_attr "bdver1_decode" "double,double")
4993 (set_attr "prefix_rep" "1")
4994 (set_attr "prefix" "maybe_vex")
4995 (set_attr "mode" "DI")])
4997 ;; For float<si2dfmode><mode>2 insn pattern
4998 (define_mode_attr si2dfmode
4999 [(V8DF "V8SI") (V4DF "V4SI")])
5000 (define_mode_attr si2dfmodelower
5001 [(V8DF "v8si") (V4DF "v4si")])
5003 (define_insn "float<si2dfmodelower><mode>2<mask_name>"
5004 [(set (match_operand:VF2_512_256 0 "register_operand" "=v")
5005 (float:VF2_512_256 (match_operand:<si2dfmode> 1 "nonimmediate_operand" "vm")))]
5006 "TARGET_AVX && <mask_mode512bit_condition>"
5007 "vcvtdq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5008 [(set_attr "type" "ssecvt")
5009 (set_attr "prefix" "maybe_vex")
5010 (set_attr "mode" "<MODE>")])
5012 (define_insn "<floatsuffix>float<sseintvecmodelower><mode>2<mask_name><round_name>"
5013 [(set (match_operand:VF2_AVX512VL 0 "register_operand" "=v")
5014 (any_float:VF2_AVX512VL
5015 (match_operand:<sseintvecmode> 1 "nonimmediate_operand" "<round_constraint>")))]
5017 "vcvt<floatsuffix>qq2pd\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5018 [(set_attr "type" "ssecvt")
5019 (set_attr "prefix" "evex")
5020 (set_attr "mode" "<MODE>")])
5022 ;; For <floatsuffix>float<sselondveclower><mode> insn patterns
5023 (define_mode_attr qq2pssuff
5024 [(V8SF "") (V4SF "{y}")])
5026 (define_mode_attr sselongvecmode
5027 [(V8SF "V8DI") (V4SF "V4DI")])
5029 (define_mode_attr sselongvecmodelower
5030 [(V8SF "v8di") (V4SF "v4di")])
5032 (define_mode_attr sseintvecmode3
5033 [(V8SF "XI") (V4SF "OI")
5034 (V8DF "OI") (V4DF "TI")])
5036 (define_insn "<floatsuffix>float<sselongvecmodelower><mode>2<mask_name><round_name>"
5037 [(set (match_operand:VF1_128_256VL 0 "register_operand" "=v")
5038 (any_float:VF1_128_256VL
5039 (match_operand:<sselongvecmode> 1 "nonimmediate_operand" "<round_constraint>")))]
5040 "TARGET_AVX512DQ && <round_modev8sf_condition>"
5041 "vcvt<floatsuffix>qq2ps<qq2pssuff>\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5042 [(set_attr "type" "ssecvt")
5043 (set_attr "prefix" "evex")
5044 (set_attr "mode" "<MODE>")])
5046 (define_insn "*<floatsuffix>floatv2div2sf2"
5047 [(set (match_operand:V4SF 0 "register_operand" "=v")
5049 (any_float:V2SF (match_operand:V2DI 1 "nonimmediate_operand" "vm"))
5050 (const_vector:V2SF [(const_int 0) (const_int 0)])))]
5051 "TARGET_AVX512DQ && TARGET_AVX512VL"
5052 "vcvt<floatsuffix>qq2ps{x}\t{%1, %0|%0, %1}"
5053 [(set_attr "type" "ssecvt")
5054 (set_attr "prefix" "evex")
5055 (set_attr "mode" "V4SF")])
5057 (define_insn "<floatsuffix>floatv2div2sf2_mask"
5058 [(set (match_operand:V4SF 0 "register_operand" "=v")
5061 (any_float:V2SF (match_operand:V2DI 1 "nonimmediate_operand" "vm"))
5063 (match_operand:V4SF 2 "vector_move_operand" "0C")
5064 (parallel [(const_int 0) (const_int 1)]))
5065 (match_operand:QI 3 "register_operand" "Yk"))
5066 (const_vector:V2SF [(const_int 0) (const_int 0)])))]
5067 "TARGET_AVX512DQ && TARGET_AVX512VL"
5068 "vcvt<floatsuffix>qq2ps{x}\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
5069 [(set_attr "type" "ssecvt")
5070 (set_attr "prefix" "evex")
5071 (set_attr "mode" "V4SF")])
5073 (define_insn "*<floatsuffix>floatv2div2sf2_mask_1"
5074 [(set (match_operand:V4SF 0 "register_operand" "=v")
5077 (any_float:V2SF (match_operand:V2DI 1
5078 "nonimmediate_operand" "vm"))
5079 (const_vector:V2SF [(const_int 0) (const_int 0)])
5080 (match_operand:QI 2 "register_operand" "Yk"))
5081 (const_vector:V2SF [(const_int 0) (const_int 0)])))]
5082 "TARGET_AVX512DQ && TARGET_AVX512VL"
5083 "vcvt<floatsuffix>qq2ps{x}\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
5084 [(set_attr "type" "ssecvt")
5085 (set_attr "prefix" "evex")
5086 (set_attr "mode" "V4SF")])
5088 (define_insn "ufloat<si2dfmodelower><mode>2<mask_name>"
5089 [(set (match_operand:VF2_512_256VL 0 "register_operand" "=v")
5090 (unsigned_float:VF2_512_256VL
5091 (match_operand:<si2dfmode> 1 "nonimmediate_operand" "vm")))]
5093 "vcvtudq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5094 [(set_attr "type" "ssecvt")
5095 (set_attr "prefix" "evex")
5096 (set_attr "mode" "<MODE>")])
5098 (define_insn "ufloatv2siv2df2<mask_name>"
5099 [(set (match_operand:V2DF 0 "register_operand" "=v")
5100 (unsigned_float:V2DF
5102 (match_operand:V4SI 1 "nonimmediate_operand" "vm")
5103 (parallel [(const_int 0) (const_int 1)]))))]
5105 "vcvtudq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
5106 [(set_attr "type" "ssecvt")
5107 (set_attr "prefix" "evex")
5108 (set_attr "mode" "V2DF")])
5110 (define_insn "avx512f_cvtdq2pd512_2"
5111 [(set (match_operand:V8DF 0 "register_operand" "=v")
5114 (match_operand:V16SI 1 "nonimmediate_operand" "vm")
5115 (parallel [(const_int 0) (const_int 1)
5116 (const_int 2) (const_int 3)
5117 (const_int 4) (const_int 5)
5118 (const_int 6) (const_int 7)]))))]
5120 "vcvtdq2pd\t{%t1, %0|%0, %t1}"
5121 [(set_attr "type" "ssecvt")
5122 (set_attr "prefix" "evex")
5123 (set_attr "mode" "V8DF")])
5125 (define_insn "avx_cvtdq2pd256_2"
5126 [(set (match_operand:V4DF 0 "register_operand" "=v")
5129 (match_operand:V8SI 1 "nonimmediate_operand" "vm")
5130 (parallel [(const_int 0) (const_int 1)
5131 (const_int 2) (const_int 3)]))))]
5133 "vcvtdq2pd\t{%x1, %0|%0, %x1}"
5134 [(set_attr "type" "ssecvt")
5135 (set_attr "prefix" "maybe_evex")
5136 (set_attr "mode" "V4DF")])
5138 (define_insn "sse2_cvtdq2pd<mask_name>"
5139 [(set (match_operand:V2DF 0 "register_operand" "=v")
5142 (match_operand:V4SI 1 "nonimmediate_operand" "vm")
5143 (parallel [(const_int 0) (const_int 1)]))))]
5144 "TARGET_SSE2 && <mask_avx512vl_condition>"
5145 "%vcvtdq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
5146 [(set_attr "type" "ssecvt")
5147 (set_attr "prefix" "maybe_vex")
5148 (set_attr "mode" "V2DF")])
5150 (define_insn "avx512f_cvtpd2dq512<mask_name><round_name>"
5151 [(set (match_operand:V8SI 0 "register_operand" "=v")
5153 [(match_operand:V8DF 1 "<round_nimm_predicate>" "<round_constraint>")]
5154 UNSPEC_FIX_NOTRUNC))]
5156 "vcvtpd2dq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5157 [(set_attr "type" "ssecvt")
5158 (set_attr "prefix" "evex")
5159 (set_attr "mode" "OI")])
5161 (define_insn "avx_cvtpd2dq256<mask_name>"
5162 [(set (match_operand:V4SI 0 "register_operand" "=v")
5163 (unspec:V4SI [(match_operand:V4DF 1 "nonimmediate_operand" "vm")]
5164 UNSPEC_FIX_NOTRUNC))]
5165 "TARGET_AVX && <mask_avx512vl_condition>"
5166 "vcvtpd2dq{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5167 [(set_attr "type" "ssecvt")
5168 (set_attr "prefix" "<mask_prefix>")
5169 (set_attr "mode" "OI")])
5171 (define_expand "avx_cvtpd2dq256_2"
5172 [(set (match_operand:V8SI 0 "register_operand")
5174 (unspec:V4SI [(match_operand:V4DF 1 "nonimmediate_operand")]
5178 "operands[2] = CONST0_RTX (V4SImode);")
5180 (define_insn "*avx_cvtpd2dq256_2"
5181 [(set (match_operand:V8SI 0 "register_operand" "=v")
5183 (unspec:V4SI [(match_operand:V4DF 1 "nonimmediate_operand" "vm")]
5185 (match_operand:V4SI 2 "const0_operand")))]
5187 "vcvtpd2dq{y}\t{%1, %x0|%x0, %1}"
5188 [(set_attr "type" "ssecvt")
5189 (set_attr "prefix" "vex")
5190 (set_attr "btver2_decode" "vector")
5191 (set_attr "mode" "OI")])
5193 (define_insn "sse2_cvtpd2dq<mask_name>"
5194 [(set (match_operand:V4SI 0 "register_operand" "=v")
5196 (unspec:V2SI [(match_operand:V2DF 1 "vector_operand" "vBm")]
5198 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
5199 "TARGET_SSE2 && <mask_avx512vl_condition>"
5202 return "vcvtpd2dq{x}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}";
5204 return "cvtpd2dq\t{%1, %0|%0, %1}";
5206 [(set_attr "type" "ssecvt")
5207 (set_attr "prefix_rep" "1")
5208 (set_attr "prefix_data16" "0")
5209 (set_attr "prefix" "maybe_vex")
5210 (set_attr "mode" "TI")
5211 (set_attr "amdfam10_decode" "double")
5212 (set_attr "athlon_decode" "vector")
5213 (set_attr "bdver1_decode" "double")])
5215 ;; For ufix_notrunc* insn patterns
5216 (define_mode_attr pd2udqsuff
5217 [(V8DF "") (V4DF "{y}")])
5219 (define_insn "ufix_notrunc<mode><si2dfmodelower>2<mask_name><round_name>"
5220 [(set (match_operand:<si2dfmode> 0 "register_operand" "=v")
5222 [(match_operand:VF2_512_256VL 1 "nonimmediate_operand" "<round_constraint>")]
5223 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
5225 "vcvtpd2udq<pd2udqsuff>\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5226 [(set_attr "type" "ssecvt")
5227 (set_attr "prefix" "evex")
5228 (set_attr "mode" "<sseinsnmode>")])
5230 (define_insn "ufix_notruncv2dfv2si2<mask_name>"
5231 [(set (match_operand:V4SI 0 "register_operand" "=v")
5234 [(match_operand:V2DF 1 "nonimmediate_operand" "vm")]
5235 UNSPEC_UNSIGNED_FIX_NOTRUNC)
5236 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
5238 "vcvtpd2udq{x}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5239 [(set_attr "type" "ssecvt")
5240 (set_attr "prefix" "evex")
5241 (set_attr "mode" "TI")])
5243 (define_insn "<fixsuffix>fix_truncv8dfv8si2<mask_name><round_saeonly_name>"
5244 [(set (match_operand:V8SI 0 "register_operand" "=v")
5246 (match_operand:V8DF 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
5248 "vcvttpd2<fixsuffix>dq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
5249 [(set_attr "type" "ssecvt")
5250 (set_attr "prefix" "evex")
5251 (set_attr "mode" "OI")])
5253 (define_insn "ufix_truncv2dfv2si2<mask_name>"
5254 [(set (match_operand:V4SI 0 "register_operand" "=v")
5256 (unsigned_fix:V2SI (match_operand:V2DF 1 "nonimmediate_operand" "vm"))
5257 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
5259 "vcvttpd2udq{x}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5260 [(set_attr "type" "ssecvt")
5261 (set_attr "prefix" "evex")
5262 (set_attr "mode" "TI")])
5264 (define_insn "fix_truncv4dfv4si2<mask_name>"
5265 [(set (match_operand:V4SI 0 "register_operand" "=v")
5266 (fix:V4SI (match_operand:V4DF 1 "nonimmediate_operand" "vm")))]
5267 "TARGET_AVX || (TARGET_AVX512VL && TARGET_AVX512F)"
5268 "vcvttpd2dq{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5269 [(set_attr "type" "ssecvt")
5270 (set_attr "prefix" "maybe_evex")
5271 (set_attr "mode" "OI")])
5273 (define_insn "ufix_truncv4dfv4si2<mask_name>"
5274 [(set (match_operand:V4SI 0 "register_operand" "=v")
5275 (unsigned_fix:V4SI (match_operand:V4DF 1 "nonimmediate_operand" "vm")))]
5276 "TARGET_AVX512VL && TARGET_AVX512F"
5277 "vcvttpd2udq{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5278 [(set_attr "type" "ssecvt")
5279 (set_attr "prefix" "maybe_evex")
5280 (set_attr "mode" "OI")])
5282 (define_insn "<fixsuffix>fix_trunc<mode><sseintvecmodelower>2<mask_name><round_saeonly_name>"
5283 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
5284 (any_fix:<sseintvecmode>
5285 (match_operand:VF2_AVX512VL 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
5286 "TARGET_AVX512DQ && <round_saeonly_mode512bit_condition>"
5287 "vcvttpd2<fixsuffix>qq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
5288 [(set_attr "type" "ssecvt")
5289 (set_attr "prefix" "evex")
5290 (set_attr "mode" "<sseintvecmode2>")])
5292 (define_insn "fix_notrunc<mode><sseintvecmodelower>2<mask_name><round_name>"
5293 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
5294 (unspec:<sseintvecmode>
5295 [(match_operand:VF2_AVX512VL 1 "<round_nimm_predicate>" "<round_constraint>")]
5296 UNSPEC_FIX_NOTRUNC))]
5297 "TARGET_AVX512DQ && <round_mode512bit_condition>"
5298 "vcvtpd2qq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5299 [(set_attr "type" "ssecvt")
5300 (set_attr "prefix" "evex")
5301 (set_attr "mode" "<sseintvecmode2>")])
5303 (define_insn "ufix_notrunc<mode><sseintvecmodelower>2<mask_name><round_name>"
5304 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
5305 (unspec:<sseintvecmode>
5306 [(match_operand:VF2_AVX512VL 1 "nonimmediate_operand" "<round_constraint>")]
5307 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
5308 "TARGET_AVX512DQ && <round_mode512bit_condition>"
5309 "vcvtpd2uqq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5310 [(set_attr "type" "ssecvt")
5311 (set_attr "prefix" "evex")
5312 (set_attr "mode" "<sseintvecmode2>")])
5314 (define_insn "<fixsuffix>fix_trunc<mode><sselongvecmodelower>2<mask_name><round_saeonly_name>"
5315 [(set (match_operand:<sselongvecmode> 0 "register_operand" "=v")
5316 (any_fix:<sselongvecmode>
5317 (match_operand:VF1_128_256VL 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
5318 "TARGET_AVX512DQ && <round_saeonly_modev8sf_condition>"
5319 "vcvttps2<fixsuffix>qq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
5320 [(set_attr "type" "ssecvt")
5321 (set_attr "prefix" "evex")
5322 (set_attr "mode" "<sseintvecmode3>")])
5324 (define_insn "<fixsuffix>fix_truncv2sfv2di2<mask_name>"
5325 [(set (match_operand:V2DI 0 "register_operand" "=v")
5328 (match_operand:V4SF 1 "nonimmediate_operand" "vm")
5329 (parallel [(const_int 0) (const_int 1)]))))]
5330 "TARGET_AVX512DQ && TARGET_AVX512VL"
5331 "vcvttps2<fixsuffix>qq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
5332 [(set_attr "type" "ssecvt")
5333 (set_attr "prefix" "evex")
5334 (set_attr "mode" "TI")])
5336 (define_insn "ufix_trunc<mode><sseintvecmodelower>2<mask_name>"
5337 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
5338 (unsigned_fix:<sseintvecmode>
5339 (match_operand:VF1_128_256VL 1 "nonimmediate_operand" "vm")))]
5341 "vcvttps2udq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5342 [(set_attr "type" "ssecvt")
5343 (set_attr "prefix" "evex")
5344 (set_attr "mode" "<sseintvecmode2>")])
5346 (define_expand "avx_cvttpd2dq256_2"
5347 [(set (match_operand:V8SI 0 "register_operand")
5349 (fix:V4SI (match_operand:V4DF 1 "nonimmediate_operand"))
5352 "operands[2] = CONST0_RTX (V4SImode);")
5354 (define_insn "sse2_cvttpd2dq<mask_name>"
5355 [(set (match_operand:V4SI 0 "register_operand" "=v")
5357 (fix:V2SI (match_operand:V2DF 1 "vector_operand" "vBm"))
5358 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
5359 "TARGET_SSE2 && <mask_avx512vl_condition>"
5362 return "vcvttpd2dq{x}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}";
5364 return "cvttpd2dq\t{%1, %0|%0, %1}";
5366 [(set_attr "type" "ssecvt")
5367 (set_attr "amdfam10_decode" "double")
5368 (set_attr "athlon_decode" "vector")
5369 (set_attr "bdver1_decode" "double")
5370 (set_attr "prefix" "maybe_vex")
5371 (set_attr "mode" "TI")])
5373 (define_insn "sse2_cvtsd2ss<round_name>"
5374 [(set (match_operand:V4SF 0 "register_operand" "=x,x,v")
5377 (float_truncate:V2SF
5378 (match_operand:V2DF 2 "nonimmediate_operand" "x,m,<round_constraint>")))
5379 (match_operand:V4SF 1 "register_operand" "0,0,v")
5383 cvtsd2ss\t{%2, %0|%0, %2}
5384 cvtsd2ss\t{%2, %0|%0, %q2}
5385 vcvtsd2ss\t{<round_op3>%2, %1, %0|%0, %1, %q2<round_op3>}"
5386 [(set_attr "isa" "noavx,noavx,avx")
5387 (set_attr "type" "ssecvt")
5388 (set_attr "athlon_decode" "vector,double,*")
5389 (set_attr "amdfam10_decode" "vector,double,*")
5390 (set_attr "bdver1_decode" "direct,direct,*")
5391 (set_attr "btver2_decode" "double,double,double")
5392 (set_attr "prefix" "orig,orig,<round_prefix>")
5393 (set_attr "mode" "SF")])
5395 (define_insn "*sse2_vd_cvtsd2ss"
5396 [(set (match_operand:V4SF 0 "register_operand" "=x,x,v")
5399 (float_truncate:SF (match_operand:DF 2 "nonimmediate_operand" "x,m,vm")))
5400 (match_operand:V4SF 1 "register_operand" "0,0,v")
5404 cvtsd2ss\t{%2, %0|%0, %2}
5405 cvtsd2ss\t{%2, %0|%0, %2}
5406 vcvtsd2ss\t{%2, %1, %0|%0, %1, %2}"
5407 [(set_attr "isa" "noavx,noavx,avx")
5408 (set_attr "type" "ssecvt")
5409 (set_attr "athlon_decode" "vector,double,*")
5410 (set_attr "amdfam10_decode" "vector,double,*")
5411 (set_attr "bdver1_decode" "direct,direct,*")
5412 (set_attr "btver2_decode" "double,double,double")
5413 (set_attr "prefix" "orig,orig,vex")
5414 (set_attr "mode" "SF")])
5416 (define_insn "sse2_cvtss2sd<round_saeonly_name>"
5417 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
5421 (match_operand:V4SF 2 "<round_saeonly_nimm_scalar_predicate>" "x,m,<round_saeonly_constraint>")
5422 (parallel [(const_int 0) (const_int 1)])))
5423 (match_operand:V2DF 1 "register_operand" "0,0,v")
5427 cvtss2sd\t{%2, %0|%0, %2}
5428 cvtss2sd\t{%2, %0|%0, %k2}
5429 vcvtss2sd\t{<round_saeonly_op3>%2, %1, %0|%0, %1, %k2<round_saeonly_op3>}"
5430 [(set_attr "isa" "noavx,noavx,avx")
5431 (set_attr "type" "ssecvt")
5432 (set_attr "amdfam10_decode" "vector,double,*")
5433 (set_attr "athlon_decode" "direct,direct,*")
5434 (set_attr "bdver1_decode" "direct,direct,*")
5435 (set_attr "btver2_decode" "double,double,double")
5436 (set_attr "prefix" "orig,orig,<round_saeonly_prefix>")
5437 (set_attr "mode" "DF")])
5439 (define_insn "*sse2_vd_cvtss2sd"
5440 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
5443 (float_extend:DF (match_operand:SF 2 "nonimmediate_operand" "x,m,vm")))
5444 (match_operand:V2DF 1 "register_operand" "0,0,v")
5448 cvtss2sd\t{%2, %0|%0, %2}
5449 cvtss2sd\t{%2, %0|%0, %2}
5450 vcvtss2sd\t{%2, %1, %0|%0, %1, %2}"
5451 [(set_attr "isa" "noavx,noavx,avx")
5452 (set_attr "type" "ssecvt")
5453 (set_attr "amdfam10_decode" "vector,double,*")
5454 (set_attr "athlon_decode" "direct,direct,*")
5455 (set_attr "bdver1_decode" "direct,direct,*")
5456 (set_attr "btver2_decode" "double,double,double")
5457 (set_attr "prefix" "orig,orig,vex")
5458 (set_attr "mode" "DF")])
5460 (define_insn "<mask_codefor>avx512f_cvtpd2ps512<mask_name><round_name>"
5461 [(set (match_operand:V8SF 0 "register_operand" "=v")
5462 (float_truncate:V8SF
5463 (match_operand:V8DF 1 "<round_nimm_predicate>" "<round_constraint>")))]
5465 "vcvtpd2ps\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5466 [(set_attr "type" "ssecvt")
5467 (set_attr "prefix" "evex")
5468 (set_attr "mode" "V8SF")])
5470 (define_insn "avx_cvtpd2ps256<mask_name>"
5471 [(set (match_operand:V4SF 0 "register_operand" "=v")
5472 (float_truncate:V4SF
5473 (match_operand:V4DF 1 "nonimmediate_operand" "vm")))]
5474 "TARGET_AVX && <mask_avx512vl_condition>"
5475 "vcvtpd2ps{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5476 [(set_attr "type" "ssecvt")
5477 (set_attr "prefix" "maybe_evex")
5478 (set_attr "btver2_decode" "vector")
5479 (set_attr "mode" "V4SF")])
5481 (define_expand "sse2_cvtpd2ps"
5482 [(set (match_operand:V4SF 0 "register_operand")
5484 (float_truncate:V2SF
5485 (match_operand:V2DF 1 "vector_operand"))
5488 "operands[2] = CONST0_RTX (V2SFmode);")
5490 (define_expand "sse2_cvtpd2ps_mask"
5491 [(set (match_operand:V4SF 0 "register_operand")
5494 (float_truncate:V2SF
5495 (match_operand:V2DF 1 "vector_operand"))
5497 (match_operand:V4SF 2 "register_operand")
5498 (match_operand:QI 3 "register_operand")))]
5500 "operands[4] = CONST0_RTX (V2SFmode);")
5502 (define_insn "*sse2_cvtpd2ps<mask_name>"
5503 [(set (match_operand:V4SF 0 "register_operand" "=v")
5505 (float_truncate:V2SF
5506 (match_operand:V2DF 1 "vector_operand" "vBm"))
5507 (match_operand:V2SF 2 "const0_operand")))]
5508 "TARGET_SSE2 && <mask_avx512vl_condition>"
5511 return "vcvtpd2ps{x}\t{%1, %0<mask_operand3>|%0<mask_operand3>, %1}";
5513 return "cvtpd2ps\t{%1, %0|%0, %1}";
5515 [(set_attr "type" "ssecvt")
5516 (set_attr "amdfam10_decode" "double")
5517 (set_attr "athlon_decode" "vector")
5518 (set_attr "bdver1_decode" "double")
5519 (set_attr "prefix_data16" "1")
5520 (set_attr "prefix" "maybe_vex")
5521 (set_attr "mode" "V4SF")])
5523 ;; For <sse2_avx_avx512f>_cvtps2pd<avxsizesuffix> insn pattern
5524 (define_mode_attr sf2dfmode
5525 [(V8DF "V8SF") (V4DF "V4SF")])
5527 (define_insn "<sse2_avx_avx512f>_cvtps2pd<avxsizesuffix><mask_name><round_saeonly_name>"
5528 [(set (match_operand:VF2_512_256 0 "register_operand" "=v")
5529 (float_extend:VF2_512_256
5530 (match_operand:<sf2dfmode> 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
5531 "TARGET_AVX && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
5532 "vcvtps2pd\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
5533 [(set_attr "type" "ssecvt")
5534 (set_attr "prefix" "maybe_vex")
5535 (set_attr "mode" "<MODE>")])
5537 (define_insn "*avx_cvtps2pd256_2"
5538 [(set (match_operand:V4DF 0 "register_operand" "=v")
5541 (match_operand:V8SF 1 "nonimmediate_operand" "vm")
5542 (parallel [(const_int 0) (const_int 1)
5543 (const_int 2) (const_int 3)]))))]
5545 "vcvtps2pd\t{%x1, %0|%0, %x1}"
5546 [(set_attr "type" "ssecvt")
5547 (set_attr "prefix" "vex")
5548 (set_attr "mode" "V4DF")])
5550 (define_insn "vec_unpacks_lo_v16sf"
5551 [(set (match_operand:V8DF 0 "register_operand" "=v")
5554 (match_operand:V16SF 1 "nonimmediate_operand" "vm")
5555 (parallel [(const_int 0) (const_int 1)
5556 (const_int 2) (const_int 3)
5557 (const_int 4) (const_int 5)
5558 (const_int 6) (const_int 7)]))))]
5560 "vcvtps2pd\t{%t1, %0|%0, %t1}"
5561 [(set_attr "type" "ssecvt")
5562 (set_attr "prefix" "evex")
5563 (set_attr "mode" "V8DF")])
5565 (define_insn "<avx512>_cvt<ssemodesuffix>2mask<mode>"
5566 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
5567 (unspec:<avx512fmaskmode>
5568 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")]
5569 UNSPEC_CVTINT2MASK))]
5571 "vpmov<ssemodesuffix>2m\t{%1, %0|%0, %1}"
5572 [(set_attr "prefix" "evex")
5573 (set_attr "mode" "<sseinsnmode>")])
5575 (define_insn "<avx512>_cvt<ssemodesuffix>2mask<mode>"
5576 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
5577 (unspec:<avx512fmaskmode>
5578 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")]
5579 UNSPEC_CVTINT2MASK))]
5581 "vpmov<ssemodesuffix>2m\t{%1, %0|%0, %1}"
5582 [(set_attr "prefix" "evex")
5583 (set_attr "mode" "<sseinsnmode>")])
5585 (define_expand "<avx512>_cvtmask2<ssemodesuffix><mode>"
5586 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
5587 (vec_merge:VI12_AVX512VL
5590 (match_operand:<avx512fmaskmode> 1 "register_operand")))]
5593 operands[2] = CONSTM1_RTX (<MODE>mode);
5594 operands[3] = CONST0_RTX (<MODE>mode);
5597 (define_insn "*<avx512>_cvtmask2<ssemodesuffix><mode>"
5598 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
5599 (vec_merge:VI12_AVX512VL
5600 (match_operand:VI12_AVX512VL 2 "vector_all_ones_operand")
5601 (match_operand:VI12_AVX512VL 3 "const0_operand")
5602 (match_operand:<avx512fmaskmode> 1 "register_operand" "Yk")))]
5604 "vpmovm2<ssemodesuffix>\t{%1, %0|%0, %1}"
5605 [(set_attr "prefix" "evex")
5606 (set_attr "mode" "<sseinsnmode>")])
5608 (define_expand "<avx512>_cvtmask2<ssemodesuffix><mode>"
5609 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
5610 (vec_merge:VI48_AVX512VL
5613 (match_operand:<avx512fmaskmode> 1 "register_operand")))]
5616 operands[2] = CONSTM1_RTX (<MODE>mode);
5617 operands[3] = CONST0_RTX (<MODE>mode);
5620 (define_insn "*<avx512>_cvtmask2<ssemodesuffix><mode>"
5621 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
5622 (vec_merge:VI48_AVX512VL
5623 (match_operand:VI48_AVX512VL 2 "vector_all_ones_operand")
5624 (match_operand:VI48_AVX512VL 3 "const0_operand")
5625 (match_operand:<avx512fmaskmode> 1 "register_operand" "Yk")))]
5627 "vpmovm2<ssemodesuffix>\t{%1, %0|%0, %1}"
5628 [(set_attr "prefix" "evex")
5629 (set_attr "mode" "<sseinsnmode>")])
5631 (define_insn "sse2_cvtps2pd<mask_name>"
5632 [(set (match_operand:V2DF 0 "register_operand" "=v")
5635 (match_operand:V4SF 1 "vector_operand" "vm")
5636 (parallel [(const_int 0) (const_int 1)]))))]
5637 "TARGET_SSE2 && <mask_avx512vl_condition>"
5638 "%vcvtps2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
5639 [(set_attr "type" "ssecvt")
5640 (set_attr "amdfam10_decode" "direct")
5641 (set_attr "athlon_decode" "double")
5642 (set_attr "bdver1_decode" "double")
5643 (set_attr "prefix_data16" "0")
5644 (set_attr "prefix" "maybe_vex")
5645 (set_attr "mode" "V2DF")])
5647 (define_expand "vec_unpacks_hi_v4sf"
5652 (match_operand:V4SF 1 "vector_operand"))
5653 (parallel [(const_int 6) (const_int 7)
5654 (const_int 2) (const_int 3)])))
5655 (set (match_operand:V2DF 0 "register_operand")
5659 (parallel [(const_int 0) (const_int 1)]))))]
5661 "operands[2] = gen_reg_rtx (V4SFmode);")
5663 (define_expand "vec_unpacks_hi_v8sf"
5666 (match_operand:V8SF 1 "register_operand")
5667 (parallel [(const_int 4) (const_int 5)
5668 (const_int 6) (const_int 7)])))
5669 (set (match_operand:V4DF 0 "register_operand")
5673 "operands[2] = gen_reg_rtx (V4SFmode);")
5675 (define_expand "vec_unpacks_hi_v16sf"
5678 (match_operand:V16SF 1 "register_operand")
5679 (parallel [(const_int 8) (const_int 9)
5680 (const_int 10) (const_int 11)
5681 (const_int 12) (const_int 13)
5682 (const_int 14) (const_int 15)])))
5683 (set (match_operand:V8DF 0 "register_operand")
5687 "operands[2] = gen_reg_rtx (V8SFmode);")
5689 (define_expand "vec_unpacks_lo_v4sf"
5690 [(set (match_operand:V2DF 0 "register_operand")
5693 (match_operand:V4SF 1 "vector_operand")
5694 (parallel [(const_int 0) (const_int 1)]))))]
5697 (define_expand "vec_unpacks_lo_v8sf"
5698 [(set (match_operand:V4DF 0 "register_operand")
5701 (match_operand:V8SF 1 "nonimmediate_operand")
5702 (parallel [(const_int 0) (const_int 1)
5703 (const_int 2) (const_int 3)]))))]
5706 (define_mode_attr sseunpackfltmode
5707 [(V8HI "V4SF") (V4SI "V2DF") (V16HI "V8SF")
5708 (V8SI "V4DF") (V32HI "V16SF") (V16SI "V8DF")])
5710 (define_expand "vec_unpacks_float_hi_<mode>"
5711 [(match_operand:<sseunpackfltmode> 0 "register_operand")
5712 (match_operand:VI2_AVX512F 1 "register_operand")]
5715 rtx tmp = gen_reg_rtx (<sseunpackmode>mode);
5717 emit_insn (gen_vec_unpacks_hi_<mode> (tmp, operands[1]));
5718 emit_insn (gen_rtx_SET (operands[0],
5719 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
5723 (define_expand "vec_unpacks_float_lo_<mode>"
5724 [(match_operand:<sseunpackfltmode> 0 "register_operand")
5725 (match_operand:VI2_AVX512F 1 "register_operand")]
5728 rtx tmp = gen_reg_rtx (<sseunpackmode>mode);
5730 emit_insn (gen_vec_unpacks_lo_<mode> (tmp, operands[1]));
5731 emit_insn (gen_rtx_SET (operands[0],
5732 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
5736 (define_expand "vec_unpacku_float_hi_<mode>"
5737 [(match_operand:<sseunpackfltmode> 0 "register_operand")
5738 (match_operand:VI2_AVX512F 1 "register_operand")]
5741 rtx tmp = gen_reg_rtx (<sseunpackmode>mode);
5743 emit_insn (gen_vec_unpacku_hi_<mode> (tmp, operands[1]));
5744 emit_insn (gen_rtx_SET (operands[0],
5745 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
5749 (define_expand "vec_unpacku_float_lo_<mode>"
5750 [(match_operand:<sseunpackfltmode> 0 "register_operand")
5751 (match_operand:VI2_AVX512F 1 "register_operand")]
5754 rtx tmp = gen_reg_rtx (<sseunpackmode>mode);
5756 emit_insn (gen_vec_unpacku_lo_<mode> (tmp, operands[1]));
5757 emit_insn (gen_rtx_SET (operands[0],
5758 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
5762 (define_expand "vec_unpacks_float_hi_v4si"
5765 (match_operand:V4SI 1 "vector_operand")
5766 (parallel [(const_int 2) (const_int 3)
5767 (const_int 2) (const_int 3)])))
5768 (set (match_operand:V2DF 0 "register_operand")
5772 (parallel [(const_int 0) (const_int 1)]))))]
5774 "operands[2] = gen_reg_rtx (V4SImode);")
5776 (define_expand "vec_unpacks_float_lo_v4si"
5777 [(set (match_operand:V2DF 0 "register_operand")
5780 (match_operand:V4SI 1 "vector_operand")
5781 (parallel [(const_int 0) (const_int 1)]))))]
5784 (define_expand "vec_unpacks_float_hi_v8si"
5787 (match_operand:V8SI 1 "vector_operand")
5788 (parallel [(const_int 4) (const_int 5)
5789 (const_int 6) (const_int 7)])))
5790 (set (match_operand:V4DF 0 "register_operand")
5794 "operands[2] = gen_reg_rtx (V4SImode);")
5796 (define_expand "vec_unpacks_float_lo_v8si"
5797 [(set (match_operand:V4DF 0 "register_operand")
5800 (match_operand:V8SI 1 "nonimmediate_operand")
5801 (parallel [(const_int 0) (const_int 1)
5802 (const_int 2) (const_int 3)]))))]
5805 (define_expand "vec_unpacks_float_hi_v16si"
5808 (match_operand:V16SI 1 "nonimmediate_operand")
5809 (parallel [(const_int 8) (const_int 9)
5810 (const_int 10) (const_int 11)
5811 (const_int 12) (const_int 13)
5812 (const_int 14) (const_int 15)])))
5813 (set (match_operand:V8DF 0 "register_operand")
5817 "operands[2] = gen_reg_rtx (V8SImode);")
5819 (define_expand "vec_unpacks_float_lo_v16si"
5820 [(set (match_operand:V8DF 0 "register_operand")
5823 (match_operand:V16SI 1 "nonimmediate_operand")
5824 (parallel [(const_int 0) (const_int 1)
5825 (const_int 2) (const_int 3)
5826 (const_int 4) (const_int 5)
5827 (const_int 6) (const_int 7)]))))]
5830 (define_expand "vec_unpacku_float_hi_v4si"
5833 (match_operand:V4SI 1 "vector_operand")
5834 (parallel [(const_int 2) (const_int 3)
5835 (const_int 2) (const_int 3)])))
5840 (parallel [(const_int 0) (const_int 1)]))))
5842 (lt:V2DF (match_dup 6) (match_dup 3)))
5844 (and:V2DF (match_dup 7) (match_dup 4)))
5845 (set (match_operand:V2DF 0 "register_operand")
5846 (plus:V2DF (match_dup 6) (match_dup 8)))]
5849 REAL_VALUE_TYPE TWO32r;
5853 real_ldexp (&TWO32r, &dconst1, 32);
5854 x = const_double_from_real_value (TWO32r, DFmode);
5856 operands[3] = force_reg (V2DFmode, CONST0_RTX (V2DFmode));
5857 operands[4] = force_reg (V2DFmode,
5858 ix86_build_const_vector (V2DFmode, 1, x));
5860 operands[5] = gen_reg_rtx (V4SImode);
5862 for (i = 6; i < 9; i++)
5863 operands[i] = gen_reg_rtx (V2DFmode);
5866 (define_expand "vec_unpacku_float_lo_v4si"
5870 (match_operand:V4SI 1 "vector_operand")
5871 (parallel [(const_int 0) (const_int 1)]))))
5873 (lt:V2DF (match_dup 5) (match_dup 3)))
5875 (and:V2DF (match_dup 6) (match_dup 4)))
5876 (set (match_operand:V2DF 0 "register_operand")
5877 (plus:V2DF (match_dup 5) (match_dup 7)))]
5880 REAL_VALUE_TYPE TWO32r;
5884 real_ldexp (&TWO32r, &dconst1, 32);
5885 x = const_double_from_real_value (TWO32r, DFmode);
5887 operands[3] = force_reg (V2DFmode, CONST0_RTX (V2DFmode));
5888 operands[4] = force_reg (V2DFmode,
5889 ix86_build_const_vector (V2DFmode, 1, x));
5891 for (i = 5; i < 8; i++)
5892 operands[i] = gen_reg_rtx (V2DFmode);
5895 (define_expand "vec_unpacku_float_hi_v8si"
5896 [(match_operand:V4DF 0 "register_operand")
5897 (match_operand:V8SI 1 "register_operand")]
5900 REAL_VALUE_TYPE TWO32r;
5904 real_ldexp (&TWO32r, &dconst1, 32);
5905 x = const_double_from_real_value (TWO32r, DFmode);
5907 tmp[0] = force_reg (V4DFmode, CONST0_RTX (V4DFmode));
5908 tmp[1] = force_reg (V4DFmode, ix86_build_const_vector (V4DFmode, 1, x));
5909 tmp[5] = gen_reg_rtx (V4SImode);
5911 for (i = 2; i < 5; i++)
5912 tmp[i] = gen_reg_rtx (V4DFmode);
5913 emit_insn (gen_vec_extract_hi_v8si (tmp[5], operands[1]));
5914 emit_insn (gen_floatv4siv4df2 (tmp[2], tmp[5]));
5915 emit_insn (gen_rtx_SET (tmp[3], gen_rtx_LT (V4DFmode, tmp[2], tmp[0])));
5916 emit_insn (gen_andv4df3 (tmp[4], tmp[3], tmp[1]));
5917 emit_insn (gen_addv4df3 (operands[0], tmp[2], tmp[4]));
5921 (define_expand "vec_unpacku_float_hi_v16si"
5922 [(match_operand:V8DF 0 "register_operand")
5923 (match_operand:V16SI 1 "register_operand")]
5926 REAL_VALUE_TYPE TWO32r;
5929 real_ldexp (&TWO32r, &dconst1, 32);
5930 x = const_double_from_real_value (TWO32r, DFmode);
5932 tmp[0] = force_reg (V8DFmode, CONST0_RTX (V8DFmode));
5933 tmp[1] = force_reg (V8DFmode, ix86_build_const_vector (V8DFmode, 1, x));
5934 tmp[2] = gen_reg_rtx (V8DFmode);
5935 tmp[3] = gen_reg_rtx (V8SImode);
5936 k = gen_reg_rtx (QImode);
5938 emit_insn (gen_vec_extract_hi_v16si (tmp[3], operands[1]));
5939 emit_insn (gen_floatv8siv8df2 (tmp[2], tmp[3]));
5940 emit_insn (gen_rtx_SET (k, gen_rtx_LT (QImode, tmp[2], tmp[0])));
5941 emit_insn (gen_addv8df3_mask (tmp[2], tmp[2], tmp[1], tmp[2], k));
5942 emit_move_insn (operands[0], tmp[2]);
5946 (define_expand "vec_unpacku_float_lo_v8si"
5947 [(match_operand:V4DF 0 "register_operand")
5948 (match_operand:V8SI 1 "nonimmediate_operand")]
5951 REAL_VALUE_TYPE TWO32r;
5955 real_ldexp (&TWO32r, &dconst1, 32);
5956 x = const_double_from_real_value (TWO32r, DFmode);
5958 tmp[0] = force_reg (V4DFmode, CONST0_RTX (V4DFmode));
5959 tmp[1] = force_reg (V4DFmode, ix86_build_const_vector (V4DFmode, 1, x));
5961 for (i = 2; i < 5; i++)
5962 tmp[i] = gen_reg_rtx (V4DFmode);
5963 emit_insn (gen_avx_cvtdq2pd256_2 (tmp[2], operands[1]));
5964 emit_insn (gen_rtx_SET (tmp[3], gen_rtx_LT (V4DFmode, tmp[2], tmp[0])));
5965 emit_insn (gen_andv4df3 (tmp[4], tmp[3], tmp[1]));
5966 emit_insn (gen_addv4df3 (operands[0], tmp[2], tmp[4]));
5970 (define_expand "vec_unpacku_float_lo_v16si"
5971 [(match_operand:V8DF 0 "register_operand")
5972 (match_operand:V16SI 1 "nonimmediate_operand")]
5975 REAL_VALUE_TYPE TWO32r;
5978 real_ldexp (&TWO32r, &dconst1, 32);
5979 x = const_double_from_real_value (TWO32r, DFmode);
5981 tmp[0] = force_reg (V8DFmode, CONST0_RTX (V8DFmode));
5982 tmp[1] = force_reg (V8DFmode, ix86_build_const_vector (V8DFmode, 1, x));
5983 tmp[2] = gen_reg_rtx (V8DFmode);
5984 k = gen_reg_rtx (QImode);
5986 emit_insn (gen_avx512f_cvtdq2pd512_2 (tmp[2], operands[1]));
5987 emit_insn (gen_rtx_SET (k, gen_rtx_LT (QImode, tmp[2], tmp[0])));
5988 emit_insn (gen_addv8df3_mask (tmp[2], tmp[2], tmp[1], tmp[2], k));
5989 emit_move_insn (operands[0], tmp[2]);
5993 (define_expand "vec_pack_trunc_<mode>"
5995 (float_truncate:<sf2dfmode>
5996 (match_operand:VF2_512_256 1 "nonimmediate_operand")))
5998 (float_truncate:<sf2dfmode>
5999 (match_operand:VF2_512_256 2 "nonimmediate_operand")))
6000 (set (match_operand:<ssePSmode> 0 "register_operand")
6001 (vec_concat:<ssePSmode>
6006 operands[3] = gen_reg_rtx (<sf2dfmode>mode);
6007 operands[4] = gen_reg_rtx (<sf2dfmode>mode);
6010 (define_expand "vec_pack_trunc_v2df"
6011 [(match_operand:V4SF 0 "register_operand")
6012 (match_operand:V2DF 1 "vector_operand")
6013 (match_operand:V2DF 2 "vector_operand")]
6018 if (TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
6020 tmp0 = gen_reg_rtx (V4DFmode);
6021 tmp1 = force_reg (V2DFmode, operands[1]);
6023 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
6024 emit_insn (gen_avx_cvtpd2ps256 (operands[0], tmp0));
6028 tmp0 = gen_reg_rtx (V4SFmode);
6029 tmp1 = gen_reg_rtx (V4SFmode);
6031 emit_insn (gen_sse2_cvtpd2ps (tmp0, operands[1]));
6032 emit_insn (gen_sse2_cvtpd2ps (tmp1, operands[2]));
6033 emit_insn (gen_sse_movlhps (operands[0], tmp0, tmp1));
6038 (define_expand "vec_pack_sfix_trunc_v8df"
6039 [(match_operand:V16SI 0 "register_operand")
6040 (match_operand:V8DF 1 "nonimmediate_operand")
6041 (match_operand:V8DF 2 "nonimmediate_operand")]
6046 r1 = gen_reg_rtx (V8SImode);
6047 r2 = gen_reg_rtx (V8SImode);
6049 emit_insn (gen_fix_truncv8dfv8si2 (r1, operands[1]));
6050 emit_insn (gen_fix_truncv8dfv8si2 (r2, operands[2]));
6051 emit_insn (gen_avx_vec_concatv16si (operands[0], r1, r2));
6055 (define_expand "vec_pack_sfix_trunc_v4df"
6056 [(match_operand:V8SI 0 "register_operand")
6057 (match_operand:V4DF 1 "nonimmediate_operand")
6058 (match_operand:V4DF 2 "nonimmediate_operand")]
6063 r1 = gen_reg_rtx (V4SImode);
6064 r2 = gen_reg_rtx (V4SImode);
6066 emit_insn (gen_fix_truncv4dfv4si2 (r1, operands[1]));
6067 emit_insn (gen_fix_truncv4dfv4si2 (r2, operands[2]));
6068 emit_insn (gen_avx_vec_concatv8si (operands[0], r1, r2));
6072 (define_expand "vec_pack_sfix_trunc_v2df"
6073 [(match_operand:V4SI 0 "register_operand")
6074 (match_operand:V2DF 1 "vector_operand")
6075 (match_operand:V2DF 2 "vector_operand")]
6078 rtx tmp0, tmp1, tmp2;
6080 if (TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
6082 tmp0 = gen_reg_rtx (V4DFmode);
6083 tmp1 = force_reg (V2DFmode, operands[1]);
6085 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
6086 emit_insn (gen_fix_truncv4dfv4si2 (operands[0], tmp0));
6090 tmp0 = gen_reg_rtx (V4SImode);
6091 tmp1 = gen_reg_rtx (V4SImode);
6092 tmp2 = gen_reg_rtx (V2DImode);
6094 emit_insn (gen_sse2_cvttpd2dq (tmp0, operands[1]));
6095 emit_insn (gen_sse2_cvttpd2dq (tmp1, operands[2]));
6096 emit_insn (gen_vec_interleave_lowv2di (tmp2,
6097 gen_lowpart (V2DImode, tmp0),
6098 gen_lowpart (V2DImode, tmp1)));
6099 emit_move_insn (operands[0], gen_lowpart (V4SImode, tmp2));
6104 (define_mode_attr ssepackfltmode
6105 [(V8DF "V16SI") (V4DF "V8SI") (V2DF "V4SI")])
6107 (define_expand "vec_pack_ufix_trunc_<mode>"
6108 [(match_operand:<ssepackfltmode> 0 "register_operand")
6109 (match_operand:VF2 1 "register_operand")
6110 (match_operand:VF2 2 "register_operand")]
6113 if (<MODE>mode == V8DFmode)
6117 r1 = gen_reg_rtx (V8SImode);
6118 r2 = gen_reg_rtx (V8SImode);
6120 emit_insn (gen_ufix_truncv8dfv8si2 (r1, operands[1]));
6121 emit_insn (gen_ufix_truncv8dfv8si2 (r2, operands[2]));
6122 emit_insn (gen_avx_vec_concatv16si (operands[0], r1, r2));
6127 tmp[0] = ix86_expand_adjust_ufix_to_sfix_si (operands[1], &tmp[2]);
6128 tmp[1] = ix86_expand_adjust_ufix_to_sfix_si (operands[2], &tmp[3]);
6129 tmp[4] = gen_reg_rtx (<ssepackfltmode>mode);
6130 emit_insn (gen_vec_pack_sfix_trunc_<mode> (tmp[4], tmp[0], tmp[1]));
6131 if (<ssepackfltmode>mode == V4SImode || TARGET_AVX2)
6133 tmp[5] = gen_reg_rtx (<ssepackfltmode>mode);
6134 ix86_expand_vec_extract_even_odd (tmp[5], tmp[2], tmp[3], 0);
6138 tmp[5] = gen_reg_rtx (V8SFmode);
6139 ix86_expand_vec_extract_even_odd (tmp[5],
6140 gen_lowpart (V8SFmode, tmp[2]),
6141 gen_lowpart (V8SFmode, tmp[3]), 0);
6142 tmp[5] = gen_lowpart (V8SImode, tmp[5]);
6144 tmp[6] = expand_simple_binop (<ssepackfltmode>mode, XOR, tmp[4], tmp[5],
6145 operands[0], 0, OPTAB_DIRECT);
6146 if (tmp[6] != operands[0])
6147 emit_move_insn (operands[0], tmp[6]);
6153 (define_expand "avx512f_vec_pack_sfix_v8df"
6154 [(match_operand:V16SI 0 "register_operand")
6155 (match_operand:V8DF 1 "nonimmediate_operand")
6156 (match_operand:V8DF 2 "nonimmediate_operand")]
6161 r1 = gen_reg_rtx (V8SImode);
6162 r2 = gen_reg_rtx (V8SImode);
6164 emit_insn (gen_avx512f_cvtpd2dq512 (r1, operands[1]));
6165 emit_insn (gen_avx512f_cvtpd2dq512 (r2, operands[2]));
6166 emit_insn (gen_avx_vec_concatv16si (operands[0], r1, r2));
6170 (define_expand "vec_pack_sfix_v4df"
6171 [(match_operand:V8SI 0 "register_operand")
6172 (match_operand:V4DF 1 "nonimmediate_operand")
6173 (match_operand:V4DF 2 "nonimmediate_operand")]
6178 r1 = gen_reg_rtx (V4SImode);
6179 r2 = gen_reg_rtx (V4SImode);
6181 emit_insn (gen_avx_cvtpd2dq256 (r1, operands[1]));
6182 emit_insn (gen_avx_cvtpd2dq256 (r2, operands[2]));
6183 emit_insn (gen_avx_vec_concatv8si (operands[0], r1, r2));
6187 (define_expand "vec_pack_sfix_v2df"
6188 [(match_operand:V4SI 0 "register_operand")
6189 (match_operand:V2DF 1 "vector_operand")
6190 (match_operand:V2DF 2 "vector_operand")]
6193 rtx tmp0, tmp1, tmp2;
6195 if (TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
6197 tmp0 = gen_reg_rtx (V4DFmode);
6198 tmp1 = force_reg (V2DFmode, operands[1]);
6200 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
6201 emit_insn (gen_avx_cvtpd2dq256 (operands[0], tmp0));
6205 tmp0 = gen_reg_rtx (V4SImode);
6206 tmp1 = gen_reg_rtx (V4SImode);
6207 tmp2 = gen_reg_rtx (V2DImode);
6209 emit_insn (gen_sse2_cvtpd2dq (tmp0, operands[1]));
6210 emit_insn (gen_sse2_cvtpd2dq (tmp1, operands[2]));
6211 emit_insn (gen_vec_interleave_lowv2di (tmp2,
6212 gen_lowpart (V2DImode, tmp0),
6213 gen_lowpart (V2DImode, tmp1)));
6214 emit_move_insn (operands[0], gen_lowpart (V4SImode, tmp2));
6219 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6221 ;; Parallel single-precision floating point element swizzling
6223 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6225 (define_expand "sse_movhlps_exp"
6226 [(set (match_operand:V4SF 0 "nonimmediate_operand")
6229 (match_operand:V4SF 1 "nonimmediate_operand")
6230 (match_operand:V4SF 2 "nonimmediate_operand"))
6231 (parallel [(const_int 6)
6237 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
6239 emit_insn (gen_sse_movhlps (dst, operands[1], operands[2]));
6241 /* Fix up the destination if needed. */
6242 if (dst != operands[0])
6243 emit_move_insn (operands[0], dst);
6248 (define_insn "sse_movhlps"
6249 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,v,x,v,m")
6252 (match_operand:V4SF 1 "nonimmediate_operand" " 0,v,0,v,0")
6253 (match_operand:V4SF 2 "nonimmediate_operand" " x,v,o,o,v"))
6254 (parallel [(const_int 6)
6258 "TARGET_SSE && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
6260 movhlps\t{%2, %0|%0, %2}
6261 vmovhlps\t{%2, %1, %0|%0, %1, %2}
6262 movlps\t{%H2, %0|%0, %H2}
6263 vmovlps\t{%H2, %1, %0|%0, %1, %H2}
6264 %vmovhps\t{%2, %0|%q0, %2}"
6265 [(set_attr "isa" "noavx,avx,noavx,avx,*")
6266 (set_attr "type" "ssemov")
6267 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,maybe_vex")
6268 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF,V2SF")])
6270 (define_expand "sse_movlhps_exp"
6271 [(set (match_operand:V4SF 0 "nonimmediate_operand")
6274 (match_operand:V4SF 1 "nonimmediate_operand")
6275 (match_operand:V4SF 2 "nonimmediate_operand"))
6276 (parallel [(const_int 0)
6282 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
6284 emit_insn (gen_sse_movlhps (dst, operands[1], operands[2]));
6286 /* Fix up the destination if needed. */
6287 if (dst != operands[0])
6288 emit_move_insn (operands[0], dst);
6293 (define_insn "sse_movlhps"
6294 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,v,x,v,o")
6297 (match_operand:V4SF 1 "nonimmediate_operand" " 0,v,0,v,0")
6298 (match_operand:V4SF 2 "nonimmediate_operand" " x,v,m,v,v"))
6299 (parallel [(const_int 0)
6303 "TARGET_SSE && ix86_binary_operator_ok (UNKNOWN, V4SFmode, operands)"
6305 movlhps\t{%2, %0|%0, %2}
6306 vmovlhps\t{%2, %1, %0|%0, %1, %2}
6307 movhps\t{%2, %0|%0, %q2}
6308 vmovhps\t{%2, %1, %0|%0, %1, %q2}
6309 %vmovlps\t{%2, %H0|%H0, %2}"
6310 [(set_attr "isa" "noavx,avx,noavx,avx,*")
6311 (set_attr "type" "ssemov")
6312 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,maybe_vex")
6313 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF,V2SF")])
6315 (define_insn "<mask_codefor>avx512f_unpckhps512<mask_name>"
6316 [(set (match_operand:V16SF 0 "register_operand" "=v")
6319 (match_operand:V16SF 1 "register_operand" "v")
6320 (match_operand:V16SF 2 "nonimmediate_operand" "vm"))
6321 (parallel [(const_int 2) (const_int 18)
6322 (const_int 3) (const_int 19)
6323 (const_int 6) (const_int 22)
6324 (const_int 7) (const_int 23)
6325 (const_int 10) (const_int 26)
6326 (const_int 11) (const_int 27)
6327 (const_int 14) (const_int 30)
6328 (const_int 15) (const_int 31)])))]
6330 "vunpckhps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6331 [(set_attr "type" "sselog")
6332 (set_attr "prefix" "evex")
6333 (set_attr "mode" "V16SF")])
6335 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
6336 (define_insn "avx_unpckhps256<mask_name>"
6337 [(set (match_operand:V8SF 0 "register_operand" "=v")
6340 (match_operand:V8SF 1 "register_operand" "v")
6341 (match_operand:V8SF 2 "nonimmediate_operand" "vm"))
6342 (parallel [(const_int 2) (const_int 10)
6343 (const_int 3) (const_int 11)
6344 (const_int 6) (const_int 14)
6345 (const_int 7) (const_int 15)])))]
6346 "TARGET_AVX && <mask_avx512vl_condition>"
6347 "vunpckhps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6348 [(set_attr "type" "sselog")
6349 (set_attr "prefix" "vex")
6350 (set_attr "mode" "V8SF")])
6352 (define_expand "vec_interleave_highv8sf"
6356 (match_operand:V8SF 1 "register_operand")
6357 (match_operand:V8SF 2 "nonimmediate_operand"))
6358 (parallel [(const_int 0) (const_int 8)
6359 (const_int 1) (const_int 9)
6360 (const_int 4) (const_int 12)
6361 (const_int 5) (const_int 13)])))
6367 (parallel [(const_int 2) (const_int 10)
6368 (const_int 3) (const_int 11)
6369 (const_int 6) (const_int 14)
6370 (const_int 7) (const_int 15)])))
6371 (set (match_operand:V8SF 0 "register_operand")
6376 (parallel [(const_int 4) (const_int 5)
6377 (const_int 6) (const_int 7)
6378 (const_int 12) (const_int 13)
6379 (const_int 14) (const_int 15)])))]
6382 operands[3] = gen_reg_rtx (V8SFmode);
6383 operands[4] = gen_reg_rtx (V8SFmode);
6386 (define_insn "vec_interleave_highv4sf<mask_name>"
6387 [(set (match_operand:V4SF 0 "register_operand" "=x,v")
6390 (match_operand:V4SF 1 "register_operand" "0,v")
6391 (match_operand:V4SF 2 "vector_operand" "xBm,vm"))
6392 (parallel [(const_int 2) (const_int 6)
6393 (const_int 3) (const_int 7)])))]
6394 "TARGET_SSE && <mask_avx512vl_condition>"
6396 unpckhps\t{%2, %0|%0, %2}
6397 vunpckhps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6398 [(set_attr "isa" "noavx,avx")
6399 (set_attr "type" "sselog")
6400 (set_attr "prefix" "orig,vex")
6401 (set_attr "mode" "V4SF")])
6403 (define_insn "<mask_codefor>avx512f_unpcklps512<mask_name>"
6404 [(set (match_operand:V16SF 0 "register_operand" "=v")
6407 (match_operand:V16SF 1 "register_operand" "v")
6408 (match_operand:V16SF 2 "nonimmediate_operand" "vm"))
6409 (parallel [(const_int 0) (const_int 16)
6410 (const_int 1) (const_int 17)
6411 (const_int 4) (const_int 20)
6412 (const_int 5) (const_int 21)
6413 (const_int 8) (const_int 24)
6414 (const_int 9) (const_int 25)
6415 (const_int 12) (const_int 28)
6416 (const_int 13) (const_int 29)])))]
6418 "vunpcklps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6419 [(set_attr "type" "sselog")
6420 (set_attr "prefix" "evex")
6421 (set_attr "mode" "V16SF")])
6423 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
6424 (define_insn "avx_unpcklps256<mask_name>"
6425 [(set (match_operand:V8SF 0 "register_operand" "=v")
6428 (match_operand:V8SF 1 "register_operand" "v")
6429 (match_operand:V8SF 2 "nonimmediate_operand" "vm"))
6430 (parallel [(const_int 0) (const_int 8)
6431 (const_int 1) (const_int 9)
6432 (const_int 4) (const_int 12)
6433 (const_int 5) (const_int 13)])))]
6434 "TARGET_AVX && <mask_avx512vl_condition>"
6435 "vunpcklps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6436 [(set_attr "type" "sselog")
6437 (set_attr "prefix" "vex")
6438 (set_attr "mode" "V8SF")])
6440 (define_insn "unpcklps128_mask"
6441 [(set (match_operand:V4SF 0 "register_operand" "=v")
6445 (match_operand:V4SF 1 "register_operand" "v")
6446 (match_operand:V4SF 2 "nonimmediate_operand" "vm"))
6447 (parallel [(const_int 0) (const_int 4)
6448 (const_int 1) (const_int 5)]))
6449 (match_operand:V4SF 3 "vector_move_operand" "0C")
6450 (match_operand:QI 4 "register_operand" "Yk")))]
6452 "vunpcklps\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
6453 [(set_attr "type" "sselog")
6454 (set_attr "prefix" "evex")
6455 (set_attr "mode" "V4SF")])
6457 (define_expand "vec_interleave_lowv8sf"
6461 (match_operand:V8SF 1 "register_operand")
6462 (match_operand:V8SF 2 "nonimmediate_operand"))
6463 (parallel [(const_int 0) (const_int 8)
6464 (const_int 1) (const_int 9)
6465 (const_int 4) (const_int 12)
6466 (const_int 5) (const_int 13)])))
6472 (parallel [(const_int 2) (const_int 10)
6473 (const_int 3) (const_int 11)
6474 (const_int 6) (const_int 14)
6475 (const_int 7) (const_int 15)])))
6476 (set (match_operand:V8SF 0 "register_operand")
6481 (parallel [(const_int 0) (const_int 1)
6482 (const_int 2) (const_int 3)
6483 (const_int 8) (const_int 9)
6484 (const_int 10) (const_int 11)])))]
6487 operands[3] = gen_reg_rtx (V8SFmode);
6488 operands[4] = gen_reg_rtx (V8SFmode);
6491 (define_insn "vec_interleave_lowv4sf"
6492 [(set (match_operand:V4SF 0 "register_operand" "=x,v")
6495 (match_operand:V4SF 1 "register_operand" "0,v")
6496 (match_operand:V4SF 2 "vector_operand" "xBm,vm"))
6497 (parallel [(const_int 0) (const_int 4)
6498 (const_int 1) (const_int 5)])))]
6501 unpcklps\t{%2, %0|%0, %2}
6502 vunpcklps\t{%2, %1, %0|%0, %1, %2}"
6503 [(set_attr "isa" "noavx,avx")
6504 (set_attr "type" "sselog")
6505 (set_attr "prefix" "orig,maybe_evex")
6506 (set_attr "mode" "V4SF")])
6508 ;; These are modeled with the same vec_concat as the others so that we
6509 ;; capture users of shufps that can use the new instructions
6510 (define_insn "avx_movshdup256<mask_name>"
6511 [(set (match_operand:V8SF 0 "register_operand" "=v")
6514 (match_operand:V8SF 1 "nonimmediate_operand" "vm")
6516 (parallel [(const_int 1) (const_int 1)
6517 (const_int 3) (const_int 3)
6518 (const_int 5) (const_int 5)
6519 (const_int 7) (const_int 7)])))]
6520 "TARGET_AVX && <mask_avx512vl_condition>"
6521 "vmovshdup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6522 [(set_attr "type" "sse")
6523 (set_attr "prefix" "vex")
6524 (set_attr "mode" "V8SF")])
6526 (define_insn "sse3_movshdup<mask_name>"
6527 [(set (match_operand:V4SF 0 "register_operand" "=v")
6530 (match_operand:V4SF 1 "vector_operand" "vBm")
6532 (parallel [(const_int 1)
6536 "TARGET_SSE3 && <mask_avx512vl_condition>"
6537 "%vmovshdup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6538 [(set_attr "type" "sse")
6539 (set_attr "prefix_rep" "1")
6540 (set_attr "prefix" "maybe_vex")
6541 (set_attr "mode" "V4SF")])
6543 (define_insn "<mask_codefor>avx512f_movshdup512<mask_name>"
6544 [(set (match_operand:V16SF 0 "register_operand" "=v")
6547 (match_operand:V16SF 1 "nonimmediate_operand" "vm")
6549 (parallel [(const_int 1) (const_int 1)
6550 (const_int 3) (const_int 3)
6551 (const_int 5) (const_int 5)
6552 (const_int 7) (const_int 7)
6553 (const_int 9) (const_int 9)
6554 (const_int 11) (const_int 11)
6555 (const_int 13) (const_int 13)
6556 (const_int 15) (const_int 15)])))]
6558 "vmovshdup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6559 [(set_attr "type" "sse")
6560 (set_attr "prefix" "evex")
6561 (set_attr "mode" "V16SF")])
6563 (define_insn "avx_movsldup256<mask_name>"
6564 [(set (match_operand:V8SF 0 "register_operand" "=v")
6567 (match_operand:V8SF 1 "nonimmediate_operand" "vm")
6569 (parallel [(const_int 0) (const_int 0)
6570 (const_int 2) (const_int 2)
6571 (const_int 4) (const_int 4)
6572 (const_int 6) (const_int 6)])))]
6573 "TARGET_AVX && <mask_avx512vl_condition>"
6574 "vmovsldup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6575 [(set_attr "type" "sse")
6576 (set_attr "prefix" "vex")
6577 (set_attr "mode" "V8SF")])
6579 (define_insn "sse3_movsldup<mask_name>"
6580 [(set (match_operand:V4SF 0 "register_operand" "=v")
6583 (match_operand:V4SF 1 "vector_operand" "vBm")
6585 (parallel [(const_int 0)
6589 "TARGET_SSE3 && <mask_avx512vl_condition>"
6590 "%vmovsldup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6591 [(set_attr "type" "sse")
6592 (set_attr "prefix_rep" "1")
6593 (set_attr "prefix" "maybe_vex")
6594 (set_attr "mode" "V4SF")])
6596 (define_insn "<mask_codefor>avx512f_movsldup512<mask_name>"
6597 [(set (match_operand:V16SF 0 "register_operand" "=v")
6600 (match_operand:V16SF 1 "nonimmediate_operand" "vm")
6602 (parallel [(const_int 0) (const_int 0)
6603 (const_int 2) (const_int 2)
6604 (const_int 4) (const_int 4)
6605 (const_int 6) (const_int 6)
6606 (const_int 8) (const_int 8)
6607 (const_int 10) (const_int 10)
6608 (const_int 12) (const_int 12)
6609 (const_int 14) (const_int 14)])))]
6611 "vmovsldup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6612 [(set_attr "type" "sse")
6613 (set_attr "prefix" "evex")
6614 (set_attr "mode" "V16SF")])
6616 (define_expand "avx_shufps256<mask_expand4_name>"
6617 [(match_operand:V8SF 0 "register_operand")
6618 (match_operand:V8SF 1 "register_operand")
6619 (match_operand:V8SF 2 "nonimmediate_operand")
6620 (match_operand:SI 3 "const_int_operand")]
6623 int mask = INTVAL (operands[3]);
6624 emit_insn (gen_avx_shufps256_1<mask_expand4_name> (operands[0],
6627 GEN_INT ((mask >> 0) & 3),
6628 GEN_INT ((mask >> 2) & 3),
6629 GEN_INT (((mask >> 4) & 3) + 8),
6630 GEN_INT (((mask >> 6) & 3) + 8),
6631 GEN_INT (((mask >> 0) & 3) + 4),
6632 GEN_INT (((mask >> 2) & 3) + 4),
6633 GEN_INT (((mask >> 4) & 3) + 12),
6634 GEN_INT (((mask >> 6) & 3) + 12)
6635 <mask_expand4_args>));
6639 ;; One bit in mask selects 2 elements.
6640 (define_insn "avx_shufps256_1<mask_name>"
6641 [(set (match_operand:V8SF 0 "register_operand" "=v")
6644 (match_operand:V8SF 1 "register_operand" "v")
6645 (match_operand:V8SF 2 "nonimmediate_operand" "vm"))
6646 (parallel [(match_operand 3 "const_0_to_3_operand" )
6647 (match_operand 4 "const_0_to_3_operand" )
6648 (match_operand 5 "const_8_to_11_operand" )
6649 (match_operand 6 "const_8_to_11_operand" )
6650 (match_operand 7 "const_4_to_7_operand" )
6651 (match_operand 8 "const_4_to_7_operand" )
6652 (match_operand 9 "const_12_to_15_operand")
6653 (match_operand 10 "const_12_to_15_operand")])))]
6655 && <mask_avx512vl_condition>
6656 && (INTVAL (operands[3]) == (INTVAL (operands[7]) - 4)
6657 && INTVAL (operands[4]) == (INTVAL (operands[8]) - 4)
6658 && INTVAL (operands[5]) == (INTVAL (operands[9]) - 4)
6659 && INTVAL (operands[6]) == (INTVAL (operands[10]) - 4))"
6662 mask = INTVAL (operands[3]);
6663 mask |= INTVAL (operands[4]) << 2;
6664 mask |= (INTVAL (operands[5]) - 8) << 4;
6665 mask |= (INTVAL (operands[6]) - 8) << 6;
6666 operands[3] = GEN_INT (mask);
6668 return "vshufps\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
6670 [(set_attr "type" "sseshuf")
6671 (set_attr "length_immediate" "1")
6672 (set_attr "prefix" "<mask_prefix>")
6673 (set_attr "mode" "V8SF")])
6675 (define_expand "sse_shufps<mask_expand4_name>"
6676 [(match_operand:V4SF 0 "register_operand")
6677 (match_operand:V4SF 1 "register_operand")
6678 (match_operand:V4SF 2 "vector_operand")
6679 (match_operand:SI 3 "const_int_operand")]
6682 int mask = INTVAL (operands[3]);
6683 emit_insn (gen_sse_shufps_v4sf<mask_expand4_name> (operands[0],
6686 GEN_INT ((mask >> 0) & 3),
6687 GEN_INT ((mask >> 2) & 3),
6688 GEN_INT (((mask >> 4) & 3) + 4),
6689 GEN_INT (((mask >> 6) & 3) + 4)
6690 <mask_expand4_args>));
6694 (define_insn "sse_shufps_v4sf_mask"
6695 [(set (match_operand:V4SF 0 "register_operand" "=v")
6699 (match_operand:V4SF 1 "register_operand" "v")
6700 (match_operand:V4SF 2 "nonimmediate_operand" "vm"))
6701 (parallel [(match_operand 3 "const_0_to_3_operand")
6702 (match_operand 4 "const_0_to_3_operand")
6703 (match_operand 5 "const_4_to_7_operand")
6704 (match_operand 6 "const_4_to_7_operand")]))
6705 (match_operand:V4SF 7 "vector_move_operand" "0C")
6706 (match_operand:QI 8 "register_operand" "Yk")))]
6710 mask |= INTVAL (operands[3]) << 0;
6711 mask |= INTVAL (operands[4]) << 2;
6712 mask |= (INTVAL (operands[5]) - 4) << 4;
6713 mask |= (INTVAL (operands[6]) - 4) << 6;
6714 operands[3] = GEN_INT (mask);
6716 return "vshufps\t{%3, %2, %1, %0%{%8%}%N7|%0%{%8%}%N7, %1, %2, %3}";
6718 [(set_attr "type" "sseshuf")
6719 (set_attr "length_immediate" "1")
6720 (set_attr "prefix" "evex")
6721 (set_attr "mode" "V4SF")])
6723 (define_insn "sse_shufps_<mode>"
6724 [(set (match_operand:VI4F_128 0 "register_operand" "=x,v")
6725 (vec_select:VI4F_128
6726 (vec_concat:<ssedoublevecmode>
6727 (match_operand:VI4F_128 1 "register_operand" "0,v")
6728 (match_operand:VI4F_128 2 "vector_operand" "xBm,vm"))
6729 (parallel [(match_operand 3 "const_0_to_3_operand")
6730 (match_operand 4 "const_0_to_3_operand")
6731 (match_operand 5 "const_4_to_7_operand")
6732 (match_operand 6 "const_4_to_7_operand")])))]
6736 mask |= INTVAL (operands[3]) << 0;
6737 mask |= INTVAL (operands[4]) << 2;
6738 mask |= (INTVAL (operands[5]) - 4) << 4;
6739 mask |= (INTVAL (operands[6]) - 4) << 6;
6740 operands[3] = GEN_INT (mask);
6742 switch (which_alternative)
6745 return "shufps\t{%3, %2, %0|%0, %2, %3}";
6747 return "vshufps\t{%3, %2, %1, %0|%0, %1, %2, %3}";
6752 [(set_attr "isa" "noavx,avx")
6753 (set_attr "type" "sseshuf")
6754 (set_attr "length_immediate" "1")
6755 (set_attr "prefix" "orig,maybe_evex")
6756 (set_attr "mode" "V4SF")])
6758 (define_insn "sse_storehps"
6759 [(set (match_operand:V2SF 0 "nonimmediate_operand" "=m,v,v")
6761 (match_operand:V4SF 1 "nonimmediate_operand" "v,v,o")
6762 (parallel [(const_int 2) (const_int 3)])))]
6763 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
6765 %vmovhps\t{%1, %0|%q0, %1}
6766 %vmovhlps\t{%1, %d0|%d0, %1}
6767 %vmovlps\t{%H1, %d0|%d0, %H1}"
6768 [(set_attr "type" "ssemov")
6769 (set_attr "prefix" "maybe_vex")
6770 (set_attr "mode" "V2SF,V4SF,V2SF")])
6772 (define_expand "sse_loadhps_exp"
6773 [(set (match_operand:V4SF 0 "nonimmediate_operand")
6776 (match_operand:V4SF 1 "nonimmediate_operand")
6777 (parallel [(const_int 0) (const_int 1)]))
6778 (match_operand:V2SF 2 "nonimmediate_operand")))]
6781 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
6783 emit_insn (gen_sse_loadhps (dst, operands[1], operands[2]));
6785 /* Fix up the destination if needed. */
6786 if (dst != operands[0])
6787 emit_move_insn (operands[0], dst);
6792 (define_insn "sse_loadhps"
6793 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,v,x,v,o")
6796 (match_operand:V4SF 1 "nonimmediate_operand" " 0,v,0,v,0")
6797 (parallel [(const_int 0) (const_int 1)]))
6798 (match_operand:V2SF 2 "nonimmediate_operand" " m,m,x,v,v")))]
6801 movhps\t{%2, %0|%0, %q2}
6802 vmovhps\t{%2, %1, %0|%0, %1, %q2}
6803 movlhps\t{%2, %0|%0, %2}
6804 vmovlhps\t{%2, %1, %0|%0, %1, %2}
6805 %vmovlps\t{%2, %H0|%H0, %2}"
6806 [(set_attr "isa" "noavx,avx,noavx,avx,*")
6807 (set_attr "type" "ssemov")
6808 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,maybe_vex")
6809 (set_attr "mode" "V2SF,V2SF,V4SF,V4SF,V2SF")])
6811 (define_insn "sse_storelps"
6812 [(set (match_operand:V2SF 0 "nonimmediate_operand" "=m,v,v")
6814 (match_operand:V4SF 1 "nonimmediate_operand" " v,v,m")
6815 (parallel [(const_int 0) (const_int 1)])))]
6816 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
6818 %vmovlps\t{%1, %0|%q0, %1}
6819 %vmovaps\t{%1, %0|%0, %1}
6820 %vmovlps\t{%1, %d0|%d0, %q1}"
6821 [(set_attr "type" "ssemov")
6822 (set_attr "prefix" "maybe_vex")
6823 (set_attr "mode" "V2SF,V4SF,V2SF")])
6825 (define_expand "sse_loadlps_exp"
6826 [(set (match_operand:V4SF 0 "nonimmediate_operand")
6828 (match_operand:V2SF 2 "nonimmediate_operand")
6830 (match_operand:V4SF 1 "nonimmediate_operand")
6831 (parallel [(const_int 2) (const_int 3)]))))]
6834 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
6836 emit_insn (gen_sse_loadlps (dst, operands[1], operands[2]));
6838 /* Fix up the destination if needed. */
6839 if (dst != operands[0])
6840 emit_move_insn (operands[0], dst);
6845 (define_insn "sse_loadlps"
6846 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,v,x,v,m")
6848 (match_operand:V2SF 2 "nonimmediate_operand" " 0,v,m,m,v")
6850 (match_operand:V4SF 1 "nonimmediate_operand" " x,v,0,v,0")
6851 (parallel [(const_int 2) (const_int 3)]))))]
6854 shufps\t{$0xe4, %1, %0|%0, %1, 0xe4}
6855 vshufps\t{$0xe4, %1, %2, %0|%0, %2, %1, 0xe4}
6856 movlps\t{%2, %0|%0, %q2}
6857 vmovlps\t{%2, %1, %0|%0, %1, %q2}
6858 %vmovlps\t{%2, %0|%q0, %2}"
6859 [(set_attr "isa" "noavx,avx,noavx,avx,*")
6860 (set_attr "type" "sseshuf,sseshuf,ssemov,ssemov,ssemov")
6861 (set (attr "length_immediate")
6862 (if_then_else (eq_attr "alternative" "0,1")
6864 (const_string "*")))
6865 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,maybe_vex")
6866 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF,V2SF")])
6868 (define_insn "sse_movss"
6869 [(set (match_operand:V4SF 0 "register_operand" "=x,v")
6871 (match_operand:V4SF 2 "register_operand" " x,v")
6872 (match_operand:V4SF 1 "register_operand" " 0,v")
6876 movss\t{%2, %0|%0, %2}
6877 vmovss\t{%2, %1, %0|%0, %1, %2}"
6878 [(set_attr "isa" "noavx,avx")
6879 (set_attr "type" "ssemov")
6880 (set_attr "prefix" "orig,maybe_evex")
6881 (set_attr "mode" "SF")])
6883 (define_insn "avx2_vec_dup<mode>"
6884 [(set (match_operand:VF1_128_256 0 "register_operand" "=v")
6885 (vec_duplicate:VF1_128_256
6887 (match_operand:V4SF 1 "register_operand" "v")
6888 (parallel [(const_int 0)]))))]
6890 "vbroadcastss\t{%1, %0|%0, %1}"
6891 [(set_attr "type" "sselog1")
6892 (set_attr "prefix" "maybe_evex")
6893 (set_attr "mode" "<MODE>")])
6895 (define_insn "avx2_vec_dupv8sf_1"
6896 [(set (match_operand:V8SF 0 "register_operand" "=v")
6899 (match_operand:V8SF 1 "register_operand" "v")
6900 (parallel [(const_int 0)]))))]
6902 "vbroadcastss\t{%x1, %0|%0, %x1}"
6903 [(set_attr "type" "sselog1")
6904 (set_attr "prefix" "maybe_evex")
6905 (set_attr "mode" "V8SF")])
6907 (define_insn "avx512f_vec_dup<mode>_1"
6908 [(set (match_operand:VF_512 0 "register_operand" "=v")
6909 (vec_duplicate:VF_512
6910 (vec_select:<ssescalarmode>
6911 (match_operand:VF_512 1 "register_operand" "v")
6912 (parallel [(const_int 0)]))))]
6914 "vbroadcast<bcstscalarsuff>\t{%x1, %0|%0, %x1}"
6915 [(set_attr "type" "sselog1")
6916 (set_attr "prefix" "evex")
6917 (set_attr "mode" "<MODE>")])
6919 ;; Although insertps takes register source, we prefer
6920 ;; unpcklps with register source since it is shorter.
6921 (define_insn "*vec_concatv2sf_sse4_1"
6922 [(set (match_operand:V2SF 0 "register_operand"
6923 "=Yr,*x, v,Yr,*x,v,v,*y ,*y")
6925 (match_operand:SF 1 "nonimmediate_operand"
6926 " 0, 0,Yv, 0,0, v,m, 0 , m")
6927 (match_operand:SF 2 "vector_move_operand"
6928 " Yr,*x,Yv, m,m, m,C,*ym, C")))]
6929 "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
6931 unpcklps\t{%2, %0|%0, %2}
6932 unpcklps\t{%2, %0|%0, %2}
6933 vunpcklps\t{%2, %1, %0|%0, %1, %2}
6934 insertps\t{$0x10, %2, %0|%0, %2, 0x10}
6935 insertps\t{$0x10, %2, %0|%0, %2, 0x10}
6936 vinsertps\t{$0x10, %2, %1, %0|%0, %1, %2, 0x10}
6937 %vmovss\t{%1, %0|%0, %1}
6938 punpckldq\t{%2, %0|%0, %2}
6939 movd\t{%1, %0|%0, %1}"
6941 (cond [(eq_attr "alternative" "0,1,3,4")
6942 (const_string "noavx")
6943 (eq_attr "alternative" "2,5")
6944 (const_string "avx")
6946 (const_string "*")))
6948 (cond [(eq_attr "alternative" "6")
6949 (const_string "ssemov")
6950 (eq_attr "alternative" "7")
6951 (const_string "mmxcvt")
6952 (eq_attr "alternative" "8")
6953 (const_string "mmxmov")
6955 (const_string "sselog")))
6956 (set (attr "prefix_data16")
6957 (if_then_else (eq_attr "alternative" "3,4")
6959 (const_string "*")))
6960 (set (attr "prefix_extra")
6961 (if_then_else (eq_attr "alternative" "3,4,5")
6963 (const_string "*")))
6964 (set (attr "length_immediate")
6965 (if_then_else (eq_attr "alternative" "3,4,5")
6967 (const_string "*")))
6968 (set (attr "prefix")
6969 (cond [(eq_attr "alternative" "2,5")
6970 (const_string "maybe_evex")
6971 (eq_attr "alternative" "6")
6972 (const_string "maybe_vex")
6974 (const_string "orig")))
6975 (set_attr "mode" "V4SF,V4SF,V4SF,V4SF,V4SF,V4SF,SF,DI,DI")])
6977 ;; ??? In theory we can match memory for the MMX alternative, but allowing
6978 ;; vector_operand for operand 2 and *not* allowing memory for the SSE
6979 ;; alternatives pretty much forces the MMX alternative to be chosen.
6980 (define_insn "*vec_concatv2sf_sse"
6981 [(set (match_operand:V2SF 0 "register_operand" "=x,x,*y,*y")
6983 (match_operand:SF 1 "nonimmediate_operand" " 0,m, 0, m")
6984 (match_operand:SF 2 "reg_or_0_operand" " x,C,*y, C")))]
6987 unpcklps\t{%2, %0|%0, %2}
6988 movss\t{%1, %0|%0, %1}
6989 punpckldq\t{%2, %0|%0, %2}
6990 movd\t{%1, %0|%0, %1}"
6991 [(set_attr "type" "sselog,ssemov,mmxcvt,mmxmov")
6992 (set_attr "mode" "V4SF,SF,DI,DI")])
6994 (define_insn "*vec_concatv4sf"
6995 [(set (match_operand:V4SF 0 "register_operand" "=x,v,x,v")
6997 (match_operand:V2SF 1 "register_operand" " 0,v,0,v")
6998 (match_operand:V2SF 2 "nonimmediate_operand" " x,v,m,m")))]
7001 movlhps\t{%2, %0|%0, %2}
7002 vmovlhps\t{%2, %1, %0|%0, %1, %2}
7003 movhps\t{%2, %0|%0, %q2}
7004 vmovhps\t{%2, %1, %0|%0, %1, %q2}"
7005 [(set_attr "isa" "noavx,avx,noavx,avx")
7006 (set_attr "type" "ssemov")
7007 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex")
7008 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF")])
7010 ;; Avoid combining registers from different units in a single alternative,
7011 ;; see comment above inline_secondary_memory_needed function in i386.c
7012 (define_insn "vec_set<mode>_0"
7013 [(set (match_operand:VI4F_128 0 "nonimmediate_operand"
7014 "=Yr,*x,v,v,v,x,x,v,Yr ,*x ,x ,m ,m ,m")
7016 (vec_duplicate:VI4F_128
7017 (match_operand:<ssescalarmode> 2 "general_operand"
7018 " Yr,*x,v,m,r ,m,x,v,*rm,*rm,*rm,!x,!*re,!*fF"))
7019 (match_operand:VI4F_128 1 "vector_move_operand"
7020 " C , C,C,C,C ,C,0,v,0 ,0 ,x ,0 ,0 ,0")
7024 insertps\t{$0xe, %2, %0|%0, %2, 0xe}
7025 insertps\t{$0xe, %2, %0|%0, %2, 0xe}
7026 vinsertps\t{$0xe, %2, %2, %0|%0, %2, %2, 0xe}
7027 %vmov<ssescalarmodesuffix>\t{%2, %0|%0, %2}
7028 %vmovd\t{%2, %0|%0, %2}
7029 movss\t{%2, %0|%0, %2}
7030 movss\t{%2, %0|%0, %2}
7031 vmovss\t{%2, %1, %0|%0, %1, %2}
7032 pinsrd\t{$0, %2, %0|%0, %2, 0}
7033 pinsrd\t{$0, %2, %0|%0, %2, 0}
7034 vpinsrd\t{$0, %2, %1, %0|%0, %1, %2, 0}
7039 (cond [(eq_attr "alternative" "0,1,8,9")
7040 (const_string "sse4_noavx")
7041 (eq_attr "alternative" "2,7,10")
7042 (const_string "avx")
7043 (eq_attr "alternative" "3,4")
7044 (const_string "sse2")
7045 (eq_attr "alternative" "5,6")
7046 (const_string "noavx")
7048 (const_string "*")))
7050 (cond [(eq_attr "alternative" "0,1,2,8,9,10")
7051 (const_string "sselog")
7052 (eq_attr "alternative" "12")
7053 (const_string "imov")
7054 (eq_attr "alternative" "13")
7055 (const_string "fmov")
7057 (const_string "ssemov")))
7058 (set (attr "prefix_extra")
7059 (if_then_else (eq_attr "alternative" "8,9,10")
7061 (const_string "*")))
7062 (set (attr "length_immediate")
7063 (if_then_else (eq_attr "alternative" "8,9,10")
7065 (const_string "*")))
7066 (set (attr "prefix")
7067 (cond [(eq_attr "alternative" "0,1,5,6,8,9")
7068 (const_string "orig")
7069 (eq_attr "alternative" "2")
7070 (const_string "maybe_evex")
7071 (eq_attr "alternative" "3,4")
7072 (const_string "maybe_vex")
7073 (eq_attr "alternative" "7,10")
7074 (const_string "vex")
7076 (const_string "*")))
7077 (set_attr "mode" "SF,SF,SF,<ssescalarmode>,SI,SF,SF,SF,TI,TI,TI,*,*,*")
7078 (set (attr "preferred_for_speed")
7079 (cond [(eq_attr "alternative" "4")
7080 (symbol_ref "TARGET_INTER_UNIT_MOVES_TO_VEC")
7082 (symbol_ref "true")))])
7084 ;; A subset is vec_setv4sf.
7085 (define_insn "*vec_setv4sf_sse4_1"
7086 [(set (match_operand:V4SF 0 "register_operand" "=Yr,*x,v")
7089 (match_operand:SF 2 "nonimmediate_operand" "Yrm,*xm,vm"))
7090 (match_operand:V4SF 1 "register_operand" "0,0,v")
7091 (match_operand:SI 3 "const_int_operand")))]
7093 && ((unsigned) exact_log2 (INTVAL (operands[3]))
7094 < GET_MODE_NUNITS (V4SFmode))"
7096 operands[3] = GEN_INT (exact_log2 (INTVAL (operands[3])) << 4);
7097 switch (which_alternative)
7101 return "insertps\t{%3, %2, %0|%0, %2, %3}";
7103 return "vinsertps\t{%3, %2, %1, %0|%0, %1, %2, %3}";
7108 [(set_attr "isa" "noavx,noavx,avx")
7109 (set_attr "type" "sselog")
7110 (set_attr "prefix_data16" "1,1,*")
7111 (set_attr "prefix_extra" "1")
7112 (set_attr "length_immediate" "1")
7113 (set_attr "prefix" "orig,orig,maybe_evex")
7114 (set_attr "mode" "V4SF")])
7116 ;; All of vinsertps, vmovss, vmovd clear also the higher bits.
7117 (define_insn "vec_set<mode>_0"
7118 [(set (match_operand:VI4F_256_512 0 "register_operand" "=v,v,v")
7119 (vec_merge:VI4F_256_512
7120 (vec_duplicate:VI4F_256_512
7121 (match_operand:<ssescalarmode> 2 "general_operand" "v,m,r"))
7122 (match_operand:VI4F_256_512 1 "const0_operand" "C,C,C")
7126 vinsertps\t{$0xe, %2, %2, %x0|%x0, %2, %2, 0xe}
7127 vmov<ssescalarmodesuffix>\t{%x2, %x0|%x0, %2}
7128 vmovd\t{%2, %x0|%x0, %2}"
7130 (if_then_else (eq_attr "alternative" "0")
7131 (const_string "sselog")
7132 (const_string "ssemov")))
7133 (set_attr "prefix" "maybe_evex")
7134 (set_attr "mode" "SF,<ssescalarmode>,SI")
7135 (set (attr "preferred_for_speed")
7136 (cond [(eq_attr "alternative" "2")
7137 (symbol_ref "TARGET_INTER_UNIT_MOVES_TO_VEC")
7139 (symbol_ref "true")))])
7141 (define_insn "sse4_1_insertps"
7142 [(set (match_operand:V4SF 0 "register_operand" "=Yr,*x,v")
7143 (unspec:V4SF [(match_operand:V4SF 2 "nonimmediate_operand" "Yrm,*xm,vm")
7144 (match_operand:V4SF 1 "register_operand" "0,0,v")
7145 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")]
7149 if (MEM_P (operands[2]))
7151 unsigned count_s = INTVAL (operands[3]) >> 6;
7153 operands[3] = GEN_INT (INTVAL (operands[3]) & 0x3f);
7154 operands[2] = adjust_address_nv (operands[2], SFmode, count_s * 4);
7156 switch (which_alternative)
7160 return "insertps\t{%3, %2, %0|%0, %2, %3}";
7162 return "vinsertps\t{%3, %2, %1, %0|%0, %1, %2, %3}";
7167 [(set_attr "isa" "noavx,noavx,avx")
7168 (set_attr "type" "sselog")
7169 (set_attr "prefix_data16" "1,1,*")
7170 (set_attr "prefix_extra" "1")
7171 (set_attr "length_immediate" "1")
7172 (set_attr "prefix" "orig,orig,maybe_evex")
7173 (set_attr "mode" "V4SF")])
7176 [(set (match_operand:VI4F_128 0 "memory_operand")
7178 (vec_duplicate:VI4F_128
7179 (match_operand:<ssescalarmode> 1 "nonmemory_operand"))
7182 "TARGET_SSE && reload_completed"
7183 [(set (match_dup 0) (match_dup 1))]
7184 "operands[0] = adjust_address (operands[0], <ssescalarmode>mode, 0);")
7186 (define_expand "vec_set<mode>"
7187 [(match_operand:V 0 "register_operand")
7188 (match_operand:<ssescalarmode> 1 "register_operand")
7189 (match_operand 2 "const_int_operand")]
7192 ix86_expand_vector_set (false, operands[0], operands[1],
7193 INTVAL (operands[2]));
7197 (define_insn_and_split "*vec_extractv4sf_0"
7198 [(set (match_operand:SF 0 "nonimmediate_operand" "=v,m,f,r")
7200 (match_operand:V4SF 1 "nonimmediate_operand" "vm,v,m,m")
7201 (parallel [(const_int 0)])))]
7202 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7204 "&& reload_completed"
7205 [(set (match_dup 0) (match_dup 1))]
7206 "operands[1] = gen_lowpart (SFmode, operands[1]);")
7208 (define_insn_and_split "*sse4_1_extractps"
7209 [(set (match_operand:SF 0 "nonimmediate_operand" "=rm,rm,rm,Yv,Yv")
7211 (match_operand:V4SF 1 "register_operand" "Yr,*x,v,0,v")
7212 (parallel [(match_operand:SI 2 "const_0_to_3_operand" "n,n,n,n,n")])))]
7215 extractps\t{%2, %1, %0|%0, %1, %2}
7216 extractps\t{%2, %1, %0|%0, %1, %2}
7217 vextractps\t{%2, %1, %0|%0, %1, %2}
7220 "&& reload_completed && SSE_REG_P (operands[0])"
7223 rtx dest = lowpart_subreg (V4SFmode, operands[0], SFmode);
7224 switch (INTVAL (operands[2]))
7228 emit_insn (gen_sse_shufps_v4sf (dest, operands[1], operands[1],
7229 operands[2], operands[2],
7230 GEN_INT (INTVAL (operands[2]) + 4),
7231 GEN_INT (INTVAL (operands[2]) + 4)));
7234 emit_insn (gen_vec_interleave_highv4sf (dest, operands[1], operands[1]));
7237 /* 0 should be handled by the *vec_extractv4sf_0 pattern above. */
7242 [(set_attr "isa" "noavx,noavx,avx,noavx,avx")
7243 (set_attr "type" "sselog,sselog,sselog,*,*")
7244 (set_attr "prefix_data16" "1,1,1,*,*")
7245 (set_attr "prefix_extra" "1,1,1,*,*")
7246 (set_attr "length_immediate" "1,1,1,*,*")
7247 (set_attr "prefix" "orig,orig,maybe_evex,*,*")
7248 (set_attr "mode" "V4SF,V4SF,V4SF,*,*")])
7250 (define_insn_and_split "*vec_extractv4sf_mem"
7251 [(set (match_operand:SF 0 "register_operand" "=v,*r,f")
7253 (match_operand:V4SF 1 "memory_operand" "o,o,o")
7254 (parallel [(match_operand 2 "const_0_to_3_operand" "n,n,n")])))]
7257 "&& reload_completed"
7258 [(set (match_dup 0) (match_dup 1))]
7260 operands[1] = adjust_address (operands[1], SFmode, INTVAL (operands[2]) * 4);
7263 (define_mode_attr extract_type
7264 [(V16SF "avx512f") (V16SI "avx512f") (V8DF "avx512dq") (V8DI "avx512dq")])
7266 (define_mode_attr extract_suf
7267 [(V16SF "32x4") (V16SI "32x4") (V8DF "64x2") (V8DI "64x2")])
7269 (define_mode_iterator AVX512_VEC
7270 [(V8DF "TARGET_AVX512DQ") (V8DI "TARGET_AVX512DQ") V16SF V16SI])
7272 (define_expand "<extract_type>_vextract<shuffletype><extract_suf>_mask"
7273 [(match_operand:<ssequartermode> 0 "nonimmediate_operand")
7274 (match_operand:AVX512_VEC 1 "register_operand")
7275 (match_operand:SI 2 "const_0_to_3_operand")
7276 (match_operand:<ssequartermode> 3 "nonimmediate_operand")
7277 (match_operand:QI 4 "register_operand")]
7281 mask = INTVAL (operands[2]);
7282 rtx dest = operands[0];
7284 if (MEM_P (operands[0]) && !rtx_equal_p (operands[0], operands[3]))
7285 dest = gen_reg_rtx (<ssequartermode>mode);
7287 if (<MODE>mode == V16SImode || <MODE>mode == V16SFmode)
7288 emit_insn (gen_avx512f_vextract<shuffletype>32x4_1_mask (dest,
7289 operands[1], GEN_INT (mask * 4), GEN_INT (mask * 4 + 1),
7290 GEN_INT (mask * 4 + 2), GEN_INT (mask * 4 + 3), operands[3],
7293 emit_insn (gen_avx512dq_vextract<shuffletype>64x2_1_mask (dest,
7294 operands[1], GEN_INT (mask * 2), GEN_INT (mask * 2 + 1), operands[3],
7296 if (dest != operands[0])
7297 emit_move_insn (operands[0], dest);
7301 (define_insn "avx512dq_vextract<shuffletype>64x2_1_maskm"
7302 [(set (match_operand:<ssequartermode> 0 "memory_operand" "=m")
7303 (vec_merge:<ssequartermode>
7304 (vec_select:<ssequartermode>
7305 (match_operand:V8FI 1 "register_operand" "v")
7306 (parallel [(match_operand 2 "const_0_to_7_operand")
7307 (match_operand 3 "const_0_to_7_operand")]))
7308 (match_operand:<ssequartermode> 4 "memory_operand" "0")
7309 (match_operand:QI 5 "register_operand" "Yk")))]
7311 && INTVAL (operands[2]) % 2 == 0
7312 && INTVAL (operands[2]) == INTVAL (operands[3]) - 1
7313 && rtx_equal_p (operands[4], operands[0])"
7315 operands[2] = GEN_INT ((INTVAL (operands[2])) >> 1);
7316 return "vextract<shuffletype>64x2\t{%2, %1, %0%{%5%}|%0%{%5%}, %1, %2}";
7318 [(set_attr "type" "sselog")
7319 (set_attr "prefix_extra" "1")
7320 (set_attr "length_immediate" "1")
7321 (set_attr "memory" "store")
7322 (set_attr "prefix" "evex")
7323 (set_attr "mode" "<sseinsnmode>")])
7325 (define_insn "avx512f_vextract<shuffletype>32x4_1_maskm"
7326 [(set (match_operand:<ssequartermode> 0 "memory_operand" "=m")
7327 (vec_merge:<ssequartermode>
7328 (vec_select:<ssequartermode>
7329 (match_operand:V16FI 1 "register_operand" "v")
7330 (parallel [(match_operand 2 "const_0_to_15_operand")
7331 (match_operand 3 "const_0_to_15_operand")
7332 (match_operand 4 "const_0_to_15_operand")
7333 (match_operand 5 "const_0_to_15_operand")]))
7334 (match_operand:<ssequartermode> 6 "memory_operand" "0")
7335 (match_operand:QI 7 "register_operand" "Yk")))]
7337 && INTVAL (operands[2]) % 4 == 0
7338 && INTVAL (operands[2]) == INTVAL (operands[3]) - 1
7339 && INTVAL (operands[3]) == INTVAL (operands[4]) - 1
7340 && INTVAL (operands[4]) == INTVAL (operands[5]) - 1
7341 && rtx_equal_p (operands[6], operands[0])"
7343 operands[2] = GEN_INT (INTVAL (operands[2]) >> 2);
7344 return "vextract<shuffletype>32x4\t{%2, %1, %0%{%7%}|%0%{%7%}, %1, %2}";
7346 [(set_attr "type" "sselog")
7347 (set_attr "prefix_extra" "1")
7348 (set_attr "length_immediate" "1")
7349 (set_attr "memory" "store")
7350 (set_attr "prefix" "evex")
7351 (set_attr "mode" "<sseinsnmode>")])
7353 (define_insn "<mask_codefor>avx512dq_vextract<shuffletype>64x2_1<mask_name>"
7354 [(set (match_operand:<ssequartermode> 0 "<store_mask_predicate>" "=<store_mask_constraint>")
7355 (vec_select:<ssequartermode>
7356 (match_operand:V8FI 1 "register_operand" "v")
7357 (parallel [(match_operand 2 "const_0_to_7_operand")
7358 (match_operand 3 "const_0_to_7_operand")])))]
7360 && INTVAL (operands[2]) % 2 == 0
7361 && INTVAL (operands[2]) == INTVAL (operands[3]) - 1"
7363 operands[2] = GEN_INT (INTVAL (operands[2]) >> 1);
7364 return "vextract<shuffletype>64x2\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}";
7366 [(set_attr "type" "sselog1")
7367 (set_attr "prefix_extra" "1")
7368 (set_attr "length_immediate" "1")
7369 (set_attr "prefix" "evex")
7370 (set_attr "mode" "<sseinsnmode>")])
7373 [(set (match_operand:<ssequartermode> 0 "nonimmediate_operand")
7374 (vec_select:<ssequartermode>
7375 (match_operand:V8FI 1 "register_operand")
7376 (parallel [(const_int 0) (const_int 1)])))]
7380 || REG_P (operands[0])
7381 || !EXT_REX_SSE_REG_P (operands[1]))"
7382 [(set (match_dup 0) (match_dup 1))]
7384 if (!TARGET_AVX512VL
7385 && REG_P (operands[0])
7386 && EXT_REX_SSE_REG_P (operands[1]))
7388 = lowpart_subreg (<MODE>mode, operands[0], <ssequartermode>mode);
7390 operands[1] = gen_lowpart (<ssequartermode>mode, operands[1]);
7393 (define_insn "<mask_codefor>avx512f_vextract<shuffletype>32x4_1<mask_name>"
7394 [(set (match_operand:<ssequartermode> 0 "<store_mask_predicate>" "=<store_mask_constraint>")
7395 (vec_select:<ssequartermode>
7396 (match_operand:V16FI 1 "register_operand" "v")
7397 (parallel [(match_operand 2 "const_0_to_15_operand")
7398 (match_operand 3 "const_0_to_15_operand")
7399 (match_operand 4 "const_0_to_15_operand")
7400 (match_operand 5 "const_0_to_15_operand")])))]
7402 && INTVAL (operands[2]) % 4 == 0
7403 && INTVAL (operands[2]) == INTVAL (operands[3]) - 1
7404 && INTVAL (operands[3]) == INTVAL (operands[4]) - 1
7405 && INTVAL (operands[4]) == INTVAL (operands[5]) - 1"
7407 operands[2] = GEN_INT (INTVAL (operands[2]) >> 2);
7408 return "vextract<shuffletype>32x4\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
7410 [(set_attr "type" "sselog1")
7411 (set_attr "prefix_extra" "1")
7412 (set_attr "length_immediate" "1")
7413 (set_attr "prefix" "evex")
7414 (set_attr "mode" "<sseinsnmode>")])
7417 [(set (match_operand:<ssequartermode> 0 "nonimmediate_operand")
7418 (vec_select:<ssequartermode>
7419 (match_operand:V16FI 1 "register_operand")
7420 (parallel [(const_int 0) (const_int 1)
7421 (const_int 2) (const_int 3)])))]
7425 || REG_P (operands[0])
7426 || !EXT_REX_SSE_REG_P (operands[1]))"
7427 [(set (match_dup 0) (match_dup 1))]
7429 if (!TARGET_AVX512VL
7430 && REG_P (operands[0])
7431 && EXT_REX_SSE_REG_P (operands[1]))
7433 = lowpart_subreg (<MODE>mode, operands[0], <ssequartermode>mode);
7435 operands[1] = gen_lowpart (<ssequartermode>mode, operands[1]);
7438 (define_mode_attr extract_type_2
7439 [(V16SF "avx512dq") (V16SI "avx512dq") (V8DF "avx512f") (V8DI "avx512f")])
7441 (define_mode_attr extract_suf_2
7442 [(V16SF "32x8") (V16SI "32x8") (V8DF "64x4") (V8DI "64x4")])
7444 (define_mode_iterator AVX512_VEC_2
7445 [(V16SF "TARGET_AVX512DQ") (V16SI "TARGET_AVX512DQ") V8DF V8DI])
7447 (define_expand "<extract_type_2>_vextract<shuffletype><extract_suf_2>_mask"
7448 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7449 (match_operand:AVX512_VEC_2 1 "register_operand")
7450 (match_operand:SI 2 "const_0_to_1_operand")
7451 (match_operand:<ssehalfvecmode> 3 "nonimmediate_operand")
7452 (match_operand:QI 4 "register_operand")]
7455 rtx (*insn)(rtx, rtx, rtx, rtx);
7456 rtx dest = operands[0];
7458 if (MEM_P (dest) && !rtx_equal_p (dest, operands[3]))
7459 dest = gen_reg_rtx (<ssehalfvecmode>mode);
7461 switch (INTVAL (operands[2]))
7464 insn = gen_vec_extract_lo_<mode>_mask;
7467 insn = gen_vec_extract_hi_<mode>_mask;
7473 emit_insn (insn (dest, operands[1], operands[3], operands[4]));
7474 if (dest != operands[0])
7475 emit_move_insn (operands[0], dest);
7480 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7481 (vec_select:<ssehalfvecmode>
7482 (match_operand:V8FI 1 "nonimmediate_operand")
7483 (parallel [(const_int 0) (const_int 1)
7484 (const_int 2) (const_int 3)])))]
7485 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))
7488 || (REG_P (operands[0]) && !EXT_REX_SSE_REG_P (operands[1])))"
7489 [(set (match_dup 0) (match_dup 1))]
7490 "operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);")
7492 (define_insn "vec_extract_lo_<mode>_maskm"
7493 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7494 (vec_merge:<ssehalfvecmode>
7495 (vec_select:<ssehalfvecmode>
7496 (match_operand:V8FI 1 "register_operand" "v")
7497 (parallel [(const_int 0) (const_int 1)
7498 (const_int 2) (const_int 3)]))
7499 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7500 (match_operand:QI 3 "register_operand" "Yk")))]
7502 && rtx_equal_p (operands[2], operands[0])"
7503 "vextract<shuffletype>64x4\t{$0x0, %1, %0%{%3%}|%0%{%3%}, %1, 0x0}"
7504 [(set_attr "type" "sselog1")
7505 (set_attr "prefix_extra" "1")
7506 (set_attr "length_immediate" "1")
7507 (set_attr "prefix" "evex")
7508 (set_attr "mode" "<sseinsnmode>")])
7510 (define_insn "vec_extract_lo_<mode><mask_name>"
7511 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=v,<store_mask_constraint>,v")
7512 (vec_select:<ssehalfvecmode>
7513 (match_operand:V8FI 1 "<store_mask_predicate>" "v,v,<store_mask_constraint>")
7514 (parallel [(const_int 0) (const_int 1)
7515 (const_int 2) (const_int 3)])))]
7517 && (<mask_applied> || !(MEM_P (operands[0]) && MEM_P (operands[1])))"
7519 if (<mask_applied> || (!TARGET_AVX512VL && !MEM_P (operands[1])))
7520 return "vextract<shuffletype>64x4\t{$0x0, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x0}";
7524 [(set_attr "type" "sselog1")
7525 (set_attr "prefix_extra" "1")
7526 (set_attr "length_immediate" "1")
7527 (set_attr "memory" "none,store,load")
7528 (set_attr "prefix" "evex")
7529 (set_attr "mode" "<sseinsnmode>")])
7531 (define_insn "vec_extract_hi_<mode>_maskm"
7532 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7533 (vec_merge:<ssehalfvecmode>
7534 (vec_select:<ssehalfvecmode>
7535 (match_operand:V8FI 1 "register_operand" "v")
7536 (parallel [(const_int 4) (const_int 5)
7537 (const_int 6) (const_int 7)]))
7538 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7539 (match_operand:QI 3 "register_operand" "Yk")))]
7541 && rtx_equal_p (operands[2], operands[0])"
7542 "vextract<shuffletype>64x4\t{$0x1, %1, %0%{%3%}|%0%{%3%}, %1, 0x1}"
7543 [(set_attr "type" "sselog")
7544 (set_attr "prefix_extra" "1")
7545 (set_attr "length_immediate" "1")
7546 (set_attr "memory" "store")
7547 (set_attr "prefix" "evex")
7548 (set_attr "mode" "<sseinsnmode>")])
7550 (define_insn "vec_extract_hi_<mode><mask_name>"
7551 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=<store_mask_constraint>")
7552 (vec_select:<ssehalfvecmode>
7553 (match_operand:V8FI 1 "register_operand" "v")
7554 (parallel [(const_int 4) (const_int 5)
7555 (const_int 6) (const_int 7)])))]
7557 "vextract<shuffletype>64x4\t{$0x1, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x1}"
7558 [(set_attr "type" "sselog1")
7559 (set_attr "prefix_extra" "1")
7560 (set_attr "length_immediate" "1")
7561 (set_attr "prefix" "evex")
7562 (set_attr "mode" "<sseinsnmode>")])
7564 (define_insn "vec_extract_hi_<mode>_maskm"
7565 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7566 (vec_merge:<ssehalfvecmode>
7567 (vec_select:<ssehalfvecmode>
7568 (match_operand:V16FI 1 "register_operand" "v")
7569 (parallel [(const_int 8) (const_int 9)
7570 (const_int 10) (const_int 11)
7571 (const_int 12) (const_int 13)
7572 (const_int 14) (const_int 15)]))
7573 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7574 (match_operand:QI 3 "register_operand" "Yk")))]
7576 && rtx_equal_p (operands[2], operands[0])"
7577 "vextract<shuffletype>32x8\t{$0x1, %1, %0%{%3%}|%0%{%3%}, %1, 0x1}"
7578 [(set_attr "type" "sselog1")
7579 (set_attr "prefix_extra" "1")
7580 (set_attr "length_immediate" "1")
7581 (set_attr "prefix" "evex")
7582 (set_attr "mode" "<sseinsnmode>")])
7584 (define_insn "vec_extract_hi_<mode><mask_name>"
7585 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=<store_mask_constraint>,vm")
7586 (vec_select:<ssehalfvecmode>
7587 (match_operand:V16FI 1 "register_operand" "v,v")
7588 (parallel [(const_int 8) (const_int 9)
7589 (const_int 10) (const_int 11)
7590 (const_int 12) (const_int 13)
7591 (const_int 14) (const_int 15)])))]
7592 "TARGET_AVX512F && <mask_avx512dq_condition>"
7594 vextract<shuffletype>32x8\t{$0x1, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x1}
7595 vextracti64x4\t{$0x1, %1, %0|%0, %1, 0x1}"
7596 [(set_attr "type" "sselog1")
7597 (set_attr "prefix_extra" "1")
7598 (set_attr "isa" "avx512dq,noavx512dq")
7599 (set_attr "length_immediate" "1")
7600 (set_attr "prefix" "evex")
7601 (set_attr "mode" "<sseinsnmode>")])
7603 (define_expand "avx512vl_vextractf128<mode>"
7604 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7605 (match_operand:VI48F_256 1 "register_operand")
7606 (match_operand:SI 2 "const_0_to_1_operand")
7607 (match_operand:<ssehalfvecmode> 3 "vector_move_operand")
7608 (match_operand:QI 4 "register_operand")]
7609 "TARGET_AVX512DQ && TARGET_AVX512VL"
7611 rtx (*insn)(rtx, rtx, rtx, rtx);
7612 rtx dest = operands[0];
7615 && (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 4
7616 /* For V8S[IF]mode there are maskm insns with =m and 0
7618 ? !rtx_equal_p (dest, operands[3])
7619 /* For V4D[IF]mode, hi insns don't allow memory, and
7620 lo insns have =m and 0C constraints. */
7621 : (operands[2] != const0_rtx
7622 || (!rtx_equal_p (dest, operands[3])
7623 && GET_CODE (operands[3]) != CONST_VECTOR))))
7624 dest = gen_reg_rtx (<ssehalfvecmode>mode);
7625 switch (INTVAL (operands[2]))
7628 insn = gen_vec_extract_lo_<mode>_mask;
7631 insn = gen_vec_extract_hi_<mode>_mask;
7637 emit_insn (insn (dest, operands[1], operands[3], operands[4]));
7638 if (dest != operands[0])
7639 emit_move_insn (operands[0], dest);
7643 (define_expand "avx_vextractf128<mode>"
7644 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7645 (match_operand:V_256 1 "register_operand")
7646 (match_operand:SI 2 "const_0_to_1_operand")]
7649 rtx (*insn)(rtx, rtx);
7651 switch (INTVAL (operands[2]))
7654 insn = gen_vec_extract_lo_<mode>;
7657 insn = gen_vec_extract_hi_<mode>;
7663 emit_insn (insn (operands[0], operands[1]));
7667 (define_insn "vec_extract_lo_<mode><mask_name>"
7668 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand" "=v,v,m")
7669 (vec_select:<ssehalfvecmode>
7670 (match_operand:V16FI 1 "<store_mask_predicate>"
7671 "v,<store_mask_constraint>,v")
7672 (parallel [(const_int 0) (const_int 1)
7673 (const_int 2) (const_int 3)
7674 (const_int 4) (const_int 5)
7675 (const_int 6) (const_int 7)])))]
7677 && <mask_mode512bit_condition>
7678 && (<mask_applied> || !(MEM_P (operands[0]) && MEM_P (operands[1])))"
7681 || (!TARGET_AVX512VL
7682 && !REG_P (operands[0])
7683 && EXT_REX_SSE_REG_P (operands[1])))
7684 return "vextract<shuffletype>32x8\t{$0x0, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x0}";
7688 [(set_attr "type" "sselog1")
7689 (set_attr "prefix_extra" "1")
7690 (set_attr "length_immediate" "1")
7691 (set_attr "memory" "none,load,store")
7692 (set_attr "prefix" "evex")
7693 (set_attr "mode" "<sseinsnmode>")])
7696 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7697 (vec_select:<ssehalfvecmode>
7698 (match_operand:V16FI 1 "nonimmediate_operand")
7699 (parallel [(const_int 0) (const_int 1)
7700 (const_int 2) (const_int 3)
7701 (const_int 4) (const_int 5)
7702 (const_int 6) (const_int 7)])))]
7703 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))
7706 || REG_P (operands[0])
7707 || !EXT_REX_SSE_REG_P (operands[1]))"
7708 [(set (match_dup 0) (match_dup 1))]
7710 if (!TARGET_AVX512VL
7711 && REG_P (operands[0])
7712 && EXT_REX_SSE_REG_P (operands[1]))
7714 = lowpart_subreg (<MODE>mode, operands[0], <ssehalfvecmode>mode);
7716 operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);
7719 (define_insn "vec_extract_lo_<mode><mask_name>"
7720 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=v,v,m")
7721 (vec_select:<ssehalfvecmode>
7722 (match_operand:VI8F_256 1 "<store_mask_predicate>"
7723 "v,<store_mask_constraint>,v")
7724 (parallel [(const_int 0) (const_int 1)])))]
7726 && <mask_avx512vl_condition> && <mask_avx512dq_condition>
7727 && (<mask_applied> || !(MEM_P (operands[0]) && MEM_P (operands[1])))"
7730 return "vextract<shuffletype>64x2\t{$0x0, %1, %0%{%3%}|%0%{%3%}, %1, 0x0}";
7734 [(set_attr "type" "sselog1")
7735 (set_attr "prefix_extra" "1")
7736 (set_attr "length_immediate" "1")
7737 (set_attr "memory" "none,load,store")
7738 (set_attr "prefix" "evex")
7739 (set_attr "mode" "XI")])
7742 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7743 (vec_select:<ssehalfvecmode>
7744 (match_operand:VI8F_256 1 "nonimmediate_operand")
7745 (parallel [(const_int 0) (const_int 1)])))]
7746 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))
7747 && reload_completed"
7748 [(set (match_dup 0) (match_dup 1))]
7749 "operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);")
7751 (define_insn "vec_extract_hi_<mode><mask_name>"
7752 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=v,<store_mask_constraint>")
7753 (vec_select:<ssehalfvecmode>
7754 (match_operand:VI8F_256 1 "register_operand" "v,v")
7755 (parallel [(const_int 2) (const_int 3)])))]
7756 "TARGET_AVX && <mask_avx512vl_condition> && <mask_avx512dq_condition>"
7758 if (TARGET_AVX512VL)
7760 if (TARGET_AVX512DQ)
7761 return "vextract<shuffletype>64x2\t{$0x1, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x1}";
7763 return "vextract<shuffletype>32x4\t{$0x1, %1, %0|%0, %1, 0x1}";
7766 return "vextract<i128>\t{$0x1, %1, %0|%0, %1, 0x1}";
7768 [(set_attr "type" "sselog1")
7769 (set_attr "prefix_extra" "1")
7770 (set_attr "length_immediate" "1")
7771 (set_attr "prefix" "vex")
7772 (set_attr "mode" "<sseinsnmode>")])
7775 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7776 (vec_select:<ssehalfvecmode>
7777 (match_operand:VI4F_256 1 "nonimmediate_operand")
7778 (parallel [(const_int 0) (const_int 1)
7779 (const_int 2) (const_int 3)])))]
7780 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))
7781 && reload_completed"
7782 [(set (match_dup 0) (match_dup 1))]
7783 "operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);")
7785 (define_insn "vec_extract_lo_<mode><mask_name>"
7786 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>"
7787 "=<store_mask_constraint>,v")
7788 (vec_select:<ssehalfvecmode>
7789 (match_operand:VI4F_256 1 "<store_mask_predicate>"
7790 "v,<store_mask_constraint>")
7791 (parallel [(const_int 0) (const_int 1)
7792 (const_int 2) (const_int 3)])))]
7794 && <mask_avx512vl_condition> && <mask_avx512dq_condition>
7795 && (<mask_applied> || !(MEM_P (operands[0]) && MEM_P (operands[1])))"
7798 return "vextract<shuffletype>32x4\t{$0x0, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x0}";
7802 [(set_attr "type" "sselog1")
7803 (set_attr "prefix_extra" "1")
7804 (set_attr "length_immediate" "1")
7805 (set_attr "prefix" "evex")
7806 (set_attr "mode" "<sseinsnmode>")])
7808 (define_insn "vec_extract_lo_<mode>_maskm"
7809 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7810 (vec_merge:<ssehalfvecmode>
7811 (vec_select:<ssehalfvecmode>
7812 (match_operand:VI4F_256 1 "register_operand" "v")
7813 (parallel [(const_int 0) (const_int 1)
7814 (const_int 2) (const_int 3)]))
7815 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7816 (match_operand:QI 3 "register_operand" "Yk")))]
7817 "TARGET_AVX512VL && TARGET_AVX512F
7818 && rtx_equal_p (operands[2], operands[0])"
7819 "vextract<shuffletype>32x4\t{$0x0, %1, %0%{%3%}|%0%{%3%}, %1, 0x0}"
7820 [(set_attr "type" "sselog1")
7821 (set_attr "prefix_extra" "1")
7822 (set_attr "length_immediate" "1")
7823 (set_attr "prefix" "evex")
7824 (set_attr "mode" "<sseinsnmode>")])
7826 (define_insn "vec_extract_hi_<mode>_maskm"
7827 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7828 (vec_merge:<ssehalfvecmode>
7829 (vec_select:<ssehalfvecmode>
7830 (match_operand:VI4F_256 1 "register_operand" "v")
7831 (parallel [(const_int 4) (const_int 5)
7832 (const_int 6) (const_int 7)]))
7833 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7834 (match_operand:<ssehalfvecmode> 3 "register_operand" "Yk")))]
7835 "TARGET_AVX512F && TARGET_AVX512VL
7836 && rtx_equal_p (operands[2], operands[0])"
7837 "vextract<shuffletype>32x4\t{$0x1, %1, %0%{%3%}|%0%{%3%}, %1, 0x1}"
7838 [(set_attr "type" "sselog1")
7839 (set_attr "length_immediate" "1")
7840 (set_attr "prefix" "evex")
7841 (set_attr "mode" "<sseinsnmode>")])
7843 (define_insn "vec_extract_hi_<mode>_mask"
7844 [(set (match_operand:<ssehalfvecmode> 0 "register_operand" "=v")
7845 (vec_merge:<ssehalfvecmode>
7846 (vec_select:<ssehalfvecmode>
7847 (match_operand:VI4F_256 1 "register_operand" "v")
7848 (parallel [(const_int 4) (const_int 5)
7849 (const_int 6) (const_int 7)]))
7850 (match_operand:<ssehalfvecmode> 2 "vector_move_operand" "0C")
7851 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
7853 "vextract<shuffletype>32x4\t{$0x1, %1, %0%{%3%}%N2|%0%{%3%}%N2, %1, 0x1}"
7854 [(set_attr "type" "sselog1")
7855 (set_attr "length_immediate" "1")
7856 (set_attr "prefix" "evex")
7857 (set_attr "mode" "<sseinsnmode>")])
7859 (define_insn "vec_extract_hi_<mode>"
7860 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand" "=xm, vm")
7861 (vec_select:<ssehalfvecmode>
7862 (match_operand:VI4F_256 1 "register_operand" "x, v")
7863 (parallel [(const_int 4) (const_int 5)
7864 (const_int 6) (const_int 7)])))]
7867 vextract<i128>\t{$0x1, %1, %0|%0, %1, 0x1}
7868 vextract<shuffletype>32x4\t{$0x1, %1, %0|%0, %1, 0x1}"
7869 [(set_attr "isa" "*, avx512vl")
7870 (set_attr "prefix" "vex, evex")
7871 (set_attr "type" "sselog1")
7872 (set_attr "length_immediate" "1")
7873 (set_attr "mode" "<sseinsnmode>")])
7875 (define_insn_and_split "vec_extract_lo_v32hi"
7876 [(set (match_operand:V16HI 0 "nonimmediate_operand" "=v,v,m")
7878 (match_operand:V32HI 1 "nonimmediate_operand" "v,m,v")
7879 (parallel [(const_int 0) (const_int 1)
7880 (const_int 2) (const_int 3)
7881 (const_int 4) (const_int 5)
7882 (const_int 6) (const_int 7)
7883 (const_int 8) (const_int 9)
7884 (const_int 10) (const_int 11)
7885 (const_int 12) (const_int 13)
7886 (const_int 14) (const_int 15)])))]
7887 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7890 || REG_P (operands[0])
7891 || !EXT_REX_SSE_REG_P (operands[1]))
7894 return "vextracti64x4\t{$0x0, %1, %0|%0, %1, 0x0}";
7896 "&& reload_completed
7898 || REG_P (operands[0])
7899 || !EXT_REX_SSE_REG_P (operands[1]))"
7900 [(set (match_dup 0) (match_dup 1))]
7902 if (!TARGET_AVX512VL
7903 && REG_P (operands[0])
7904 && EXT_REX_SSE_REG_P (operands[1]))
7905 operands[0] = lowpart_subreg (V32HImode, operands[0], V16HImode);
7907 operands[1] = gen_lowpart (V16HImode, operands[1]);
7909 [(set_attr "type" "sselog1")
7910 (set_attr "prefix_extra" "1")
7911 (set_attr "length_immediate" "1")
7912 (set_attr "memory" "none,load,store")
7913 (set_attr "prefix" "evex")
7914 (set_attr "mode" "XI")])
7916 (define_insn "vec_extract_hi_v32hi"
7917 [(set (match_operand:V16HI 0 "nonimmediate_operand" "=vm")
7919 (match_operand:V32HI 1 "register_operand" "v")
7920 (parallel [(const_int 16) (const_int 17)
7921 (const_int 18) (const_int 19)
7922 (const_int 20) (const_int 21)
7923 (const_int 22) (const_int 23)
7924 (const_int 24) (const_int 25)
7925 (const_int 26) (const_int 27)
7926 (const_int 28) (const_int 29)
7927 (const_int 30) (const_int 31)])))]
7929 "vextracti64x4\t{$0x1, %1, %0|%0, %1, 0x1}"
7930 [(set_attr "type" "sselog1")
7931 (set_attr "prefix_extra" "1")
7932 (set_attr "length_immediate" "1")
7933 (set_attr "prefix" "evex")
7934 (set_attr "mode" "XI")])
7936 (define_insn_and_split "vec_extract_lo_v16hi"
7937 [(set (match_operand:V8HI 0 "nonimmediate_operand" "=v,m")
7939 (match_operand:V16HI 1 "nonimmediate_operand" "vm,v")
7940 (parallel [(const_int 0) (const_int 1)
7941 (const_int 2) (const_int 3)
7942 (const_int 4) (const_int 5)
7943 (const_int 6) (const_int 7)])))]
7944 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7946 "&& reload_completed"
7947 [(set (match_dup 0) (match_dup 1))]
7948 "operands[1] = gen_lowpart (V8HImode, operands[1]);")
7950 (define_insn "vec_extract_hi_v16hi"
7951 [(set (match_operand:V8HI 0 "nonimmediate_operand" "=xm,vm,vm")
7953 (match_operand:V16HI 1 "register_operand" "x,v,v")
7954 (parallel [(const_int 8) (const_int 9)
7955 (const_int 10) (const_int 11)
7956 (const_int 12) (const_int 13)
7957 (const_int 14) (const_int 15)])))]
7960 vextract%~128\t{$0x1, %1, %0|%0, %1, 0x1}
7961 vextracti32x4\t{$0x1, %1, %0|%0, %1, 0x1}
7962 vextracti32x4\t{$0x1, %g1, %0|%0, %g1, 0x1}"
7963 [(set_attr "type" "sselog1")
7964 (set_attr "prefix_extra" "1")
7965 (set_attr "length_immediate" "1")
7966 (set_attr "isa" "*,avx512dq,avx512f")
7967 (set_attr "prefix" "vex,evex,evex")
7968 (set_attr "mode" "OI")])
7970 (define_insn_and_split "vec_extract_lo_v64qi"
7971 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=v,v,m")
7973 (match_operand:V64QI 1 "nonimmediate_operand" "v,m,v")
7974 (parallel [(const_int 0) (const_int 1)
7975 (const_int 2) (const_int 3)
7976 (const_int 4) (const_int 5)
7977 (const_int 6) (const_int 7)
7978 (const_int 8) (const_int 9)
7979 (const_int 10) (const_int 11)
7980 (const_int 12) (const_int 13)
7981 (const_int 14) (const_int 15)
7982 (const_int 16) (const_int 17)
7983 (const_int 18) (const_int 19)
7984 (const_int 20) (const_int 21)
7985 (const_int 22) (const_int 23)
7986 (const_int 24) (const_int 25)
7987 (const_int 26) (const_int 27)
7988 (const_int 28) (const_int 29)
7989 (const_int 30) (const_int 31)])))]
7990 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7993 || REG_P (operands[0])
7994 || !EXT_REX_SSE_REG_P (operands[1]))
7997 return "vextracti64x4\t{$0x0, %1, %0|%0, %1, 0x0}";
7999 "&& reload_completed
8001 || REG_P (operands[0])
8002 || !EXT_REX_SSE_REG_P (operands[1]))"
8003 [(set (match_dup 0) (match_dup 1))]
8005 if (!TARGET_AVX512VL
8006 && REG_P (operands[0])
8007 && EXT_REX_SSE_REG_P (operands[1]))
8008 operands[0] = lowpart_subreg (V64QImode, operands[0], V32QImode);
8010 operands[1] = gen_lowpart (V32QImode, operands[1]);
8012 [(set_attr "type" "sselog1")
8013 (set_attr "prefix_extra" "1")
8014 (set_attr "length_immediate" "1")
8015 (set_attr "memory" "none,load,store")
8016 (set_attr "prefix" "evex")
8017 (set_attr "mode" "XI")])
8019 (define_insn "vec_extract_hi_v64qi"
8020 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=vm")
8022 (match_operand:V64QI 1 "register_operand" "v")
8023 (parallel [(const_int 32) (const_int 33)
8024 (const_int 34) (const_int 35)
8025 (const_int 36) (const_int 37)
8026 (const_int 38) (const_int 39)
8027 (const_int 40) (const_int 41)
8028 (const_int 42) (const_int 43)
8029 (const_int 44) (const_int 45)
8030 (const_int 46) (const_int 47)
8031 (const_int 48) (const_int 49)
8032 (const_int 50) (const_int 51)
8033 (const_int 52) (const_int 53)
8034 (const_int 54) (const_int 55)
8035 (const_int 56) (const_int 57)
8036 (const_int 58) (const_int 59)
8037 (const_int 60) (const_int 61)
8038 (const_int 62) (const_int 63)])))]
8040 "vextracti64x4\t{$0x1, %1, %0|%0, %1, 0x1}"
8041 [(set_attr "type" "sselog1")
8042 (set_attr "prefix_extra" "1")
8043 (set_attr "length_immediate" "1")
8044 (set_attr "prefix" "evex")
8045 (set_attr "mode" "XI")])
8047 (define_insn_and_split "vec_extract_lo_v32qi"
8048 [(set (match_operand:V16QI 0 "nonimmediate_operand" "=v,m")
8050 (match_operand:V32QI 1 "nonimmediate_operand" "vm,v")
8051 (parallel [(const_int 0) (const_int 1)
8052 (const_int 2) (const_int 3)
8053 (const_int 4) (const_int 5)
8054 (const_int 6) (const_int 7)
8055 (const_int 8) (const_int 9)
8056 (const_int 10) (const_int 11)
8057 (const_int 12) (const_int 13)
8058 (const_int 14) (const_int 15)])))]
8059 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
8061 "&& reload_completed"
8062 [(set (match_dup 0) (match_dup 1))]
8063 "operands[1] = gen_lowpart (V16QImode, operands[1]);")
8065 (define_insn "vec_extract_hi_v32qi"
8066 [(set (match_operand:V16QI 0 "nonimmediate_operand" "=xm,vm,vm")
8068 (match_operand:V32QI 1 "register_operand" "x,v,v")
8069 (parallel [(const_int 16) (const_int 17)
8070 (const_int 18) (const_int 19)
8071 (const_int 20) (const_int 21)
8072 (const_int 22) (const_int 23)
8073 (const_int 24) (const_int 25)
8074 (const_int 26) (const_int 27)
8075 (const_int 28) (const_int 29)
8076 (const_int 30) (const_int 31)])))]
8079 vextract%~128\t{$0x1, %1, %0|%0, %1, 0x1}
8080 vextracti32x4\t{$0x1, %1, %0|%0, %1, 0x1}
8081 vextracti32x4\t{$0x1, %g1, %0|%0, %g1, 0x1}"
8082 [(set_attr "type" "sselog1")
8083 (set_attr "prefix_extra" "1")
8084 (set_attr "length_immediate" "1")
8085 (set_attr "isa" "*,avx512dq,avx512f")
8086 (set_attr "prefix" "vex,evex,evex")
8087 (set_attr "mode" "OI")])
8089 ;; Modes handled by vec_extract patterns.
8090 (define_mode_iterator VEC_EXTRACT_MODE
8091 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX") V16QI
8092 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX") V8HI
8093 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
8094 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI
8095 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
8096 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") V2DF
8097 (V4TI "TARGET_AVX512F") (V2TI "TARGET_AVX")])
8099 (define_expand "vec_extract<mode><ssescalarmodelower>"
8100 [(match_operand:<ssescalarmode> 0 "register_operand")
8101 (match_operand:VEC_EXTRACT_MODE 1 "register_operand")
8102 (match_operand 2 "const_int_operand")]
8105 ix86_expand_vector_extract (false, operands[0], operands[1],
8106 INTVAL (operands[2]));
8110 (define_expand "vec_extract<mode><ssehalfvecmodelower>"
8111 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
8112 (match_operand:V_512 1 "register_operand")
8113 (match_operand 2 "const_0_to_1_operand")]
8116 if (INTVAL (operands[2]))
8117 emit_insn (gen_vec_extract_hi_<mode> (operands[0], operands[1]));
8119 emit_insn (gen_vec_extract_lo_<mode> (operands[0], operands[1]));
8123 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8125 ;; Parallel double-precision floating point element swizzling
8127 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8129 (define_insn "<mask_codefor>avx512f_unpckhpd512<mask_name>"
8130 [(set (match_operand:V8DF 0 "register_operand" "=v")
8133 (match_operand:V8DF 1 "register_operand" "v")
8134 (match_operand:V8DF 2 "nonimmediate_operand" "vm"))
8135 (parallel [(const_int 1) (const_int 9)
8136 (const_int 3) (const_int 11)
8137 (const_int 5) (const_int 13)
8138 (const_int 7) (const_int 15)])))]
8140 "vunpckhpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8141 [(set_attr "type" "sselog")
8142 (set_attr "prefix" "evex")
8143 (set_attr "mode" "V8DF")])
8145 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
8146 (define_insn "avx_unpckhpd256<mask_name>"
8147 [(set (match_operand:V4DF 0 "register_operand" "=v")
8150 (match_operand:V4DF 1 "register_operand" "v")
8151 (match_operand:V4DF 2 "nonimmediate_operand" "vm"))
8152 (parallel [(const_int 1) (const_int 5)
8153 (const_int 3) (const_int 7)])))]
8154 "TARGET_AVX && <mask_avx512vl_condition>"
8155 "vunpckhpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8156 [(set_attr "type" "sselog")
8157 (set_attr "prefix" "vex")
8158 (set_attr "mode" "V4DF")])
8160 (define_expand "vec_interleave_highv4df"
8164 (match_operand:V4DF 1 "register_operand")
8165 (match_operand:V4DF 2 "nonimmediate_operand"))
8166 (parallel [(const_int 0) (const_int 4)
8167 (const_int 2) (const_int 6)])))
8173 (parallel [(const_int 1) (const_int 5)
8174 (const_int 3) (const_int 7)])))
8175 (set (match_operand:V4DF 0 "register_operand")
8180 (parallel [(const_int 2) (const_int 3)
8181 (const_int 6) (const_int 7)])))]
8184 operands[3] = gen_reg_rtx (V4DFmode);
8185 operands[4] = gen_reg_rtx (V4DFmode);
8189 (define_insn "avx512vl_unpckhpd128_mask"
8190 [(set (match_operand:V2DF 0 "register_operand" "=v")
8194 (match_operand:V2DF 1 "register_operand" "v")
8195 (match_operand:V2DF 2 "nonimmediate_operand" "vm"))
8196 (parallel [(const_int 1) (const_int 3)]))
8197 (match_operand:V2DF 3 "vector_move_operand" "0C")
8198 (match_operand:QI 4 "register_operand" "Yk")))]
8200 "vunpckhpd\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
8201 [(set_attr "type" "sselog")
8202 (set_attr "prefix" "evex")
8203 (set_attr "mode" "V2DF")])
8205 (define_expand "vec_interleave_highv2df"
8206 [(set (match_operand:V2DF 0 "register_operand")
8209 (match_operand:V2DF 1 "nonimmediate_operand")
8210 (match_operand:V2DF 2 "nonimmediate_operand"))
8211 (parallel [(const_int 1)
8215 if (!ix86_vec_interleave_v2df_operator_ok (operands, 1))
8216 operands[2] = force_reg (V2DFmode, operands[2]);
8219 (define_insn "*vec_interleave_highv2df"
8220 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,v,v,x,v,m")
8223 (match_operand:V2DF 1 "nonimmediate_operand" " 0,v,o,o,o,v")
8224 (match_operand:V2DF 2 "nonimmediate_operand" " x,v,1,0,v,0"))
8225 (parallel [(const_int 1)
8227 "TARGET_SSE2 && ix86_vec_interleave_v2df_operator_ok (operands, 1)"
8229 unpckhpd\t{%2, %0|%0, %2}
8230 vunpckhpd\t{%2, %1, %0|%0, %1, %2}
8231 %vmovddup\t{%H1, %0|%0, %H1}
8232 movlpd\t{%H1, %0|%0, %H1}
8233 vmovlpd\t{%H1, %2, %0|%0, %2, %H1}
8234 %vmovhpd\t{%1, %0|%q0, %1}"
8235 [(set_attr "isa" "noavx,avx,sse3,noavx,avx,*")
8236 (set_attr "type" "sselog,sselog,sselog,ssemov,ssemov,ssemov")
8237 (set (attr "prefix_data16")
8238 (if_then_else (eq_attr "alternative" "3,5")
8240 (const_string "*")))
8241 (set_attr "prefix" "orig,maybe_evex,maybe_vex,orig,maybe_evex,maybe_vex")
8242 (set_attr "mode" "V2DF,V2DF,DF,V1DF,V1DF,V1DF")])
8244 (define_expand "avx512f_movddup512<mask_name>"
8245 [(set (match_operand:V8DF 0 "register_operand")
8248 (match_operand:V8DF 1 "nonimmediate_operand")
8250 (parallel [(const_int 0) (const_int 8)
8251 (const_int 2) (const_int 10)
8252 (const_int 4) (const_int 12)
8253 (const_int 6) (const_int 14)])))]
8256 (define_expand "avx512f_unpcklpd512<mask_name>"
8257 [(set (match_operand:V8DF 0 "register_operand")
8260 (match_operand:V8DF 1 "register_operand")
8261 (match_operand:V8DF 2 "nonimmediate_operand"))
8262 (parallel [(const_int 0) (const_int 8)
8263 (const_int 2) (const_int 10)
8264 (const_int 4) (const_int 12)
8265 (const_int 6) (const_int 14)])))]
8268 (define_insn "*avx512f_unpcklpd512<mask_name>"
8269 [(set (match_operand:V8DF 0 "register_operand" "=v,v")
8272 (match_operand:V8DF 1 "nonimmediate_operand" "vm, v")
8273 (match_operand:V8DF 2 "nonimmediate_operand" "1 ,vm"))
8274 (parallel [(const_int 0) (const_int 8)
8275 (const_int 2) (const_int 10)
8276 (const_int 4) (const_int 12)
8277 (const_int 6) (const_int 14)])))]
8280 vmovddup\t{%1, %0<mask_operand3>|%0<mask_operand3>, %1}
8281 vunpcklpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8282 [(set_attr "type" "sselog")
8283 (set_attr "prefix" "evex")
8284 (set_attr "mode" "V8DF")])
8286 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
8287 (define_expand "avx_movddup256<mask_name>"
8288 [(set (match_operand:V4DF 0 "register_operand")
8291 (match_operand:V4DF 1 "nonimmediate_operand")
8293 (parallel [(const_int 0) (const_int 4)
8294 (const_int 2) (const_int 6)])))]
8295 "TARGET_AVX && <mask_avx512vl_condition>")
8297 (define_expand "avx_unpcklpd256<mask_name>"
8298 [(set (match_operand:V4DF 0 "register_operand")
8301 (match_operand:V4DF 1 "register_operand")
8302 (match_operand:V4DF 2 "nonimmediate_operand"))
8303 (parallel [(const_int 0) (const_int 4)
8304 (const_int 2) (const_int 6)])))]
8305 "TARGET_AVX && <mask_avx512vl_condition>")
8307 (define_insn "*avx_unpcklpd256<mask_name>"
8308 [(set (match_operand:V4DF 0 "register_operand" "=v,v")
8311 (match_operand:V4DF 1 "nonimmediate_operand" " v,m")
8312 (match_operand:V4DF 2 "nonimmediate_operand" "vm,1"))
8313 (parallel [(const_int 0) (const_int 4)
8314 (const_int 2) (const_int 6)])))]
8315 "TARGET_AVX && <mask_avx512vl_condition>"
8317 vunpcklpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
8318 vmovddup\t{%1, %0<mask_operand3>|%0<mask_operand3>, %1}"
8319 [(set_attr "type" "sselog")
8320 (set_attr "prefix" "vex")
8321 (set_attr "mode" "V4DF")])
8323 (define_expand "vec_interleave_lowv4df"
8327 (match_operand:V4DF 1 "register_operand")
8328 (match_operand:V4DF 2 "nonimmediate_operand"))
8329 (parallel [(const_int 0) (const_int 4)
8330 (const_int 2) (const_int 6)])))
8336 (parallel [(const_int 1) (const_int 5)
8337 (const_int 3) (const_int 7)])))
8338 (set (match_operand:V4DF 0 "register_operand")
8343 (parallel [(const_int 0) (const_int 1)
8344 (const_int 4) (const_int 5)])))]
8347 operands[3] = gen_reg_rtx (V4DFmode);
8348 operands[4] = gen_reg_rtx (V4DFmode);
8351 (define_insn "avx512vl_unpcklpd128_mask"
8352 [(set (match_operand:V2DF 0 "register_operand" "=v")
8356 (match_operand:V2DF 1 "register_operand" "v")
8357 (match_operand:V2DF 2 "nonimmediate_operand" "vm"))
8358 (parallel [(const_int 0) (const_int 2)]))
8359 (match_operand:V2DF 3 "vector_move_operand" "0C")
8360 (match_operand:QI 4 "register_operand" "Yk")))]
8362 "vunpcklpd\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
8363 [(set_attr "type" "sselog")
8364 (set_attr "prefix" "evex")
8365 (set_attr "mode" "V2DF")])
8367 (define_expand "vec_interleave_lowv2df"
8368 [(set (match_operand:V2DF 0 "register_operand")
8371 (match_operand:V2DF 1 "nonimmediate_operand")
8372 (match_operand:V2DF 2 "nonimmediate_operand"))
8373 (parallel [(const_int 0)
8377 if (!ix86_vec_interleave_v2df_operator_ok (operands, 0))
8378 operands[1] = force_reg (V2DFmode, operands[1]);
8381 (define_insn "*vec_interleave_lowv2df"
8382 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,v,v,x,v,o")
8385 (match_operand:V2DF 1 "nonimmediate_operand" " 0,v,m,0,v,0")
8386 (match_operand:V2DF 2 "nonimmediate_operand" " x,v,1,m,m,v"))
8387 (parallel [(const_int 0)
8389 "TARGET_SSE2 && ix86_vec_interleave_v2df_operator_ok (operands, 0)"
8391 unpcklpd\t{%2, %0|%0, %2}
8392 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
8393 %vmovddup\t{%1, %0|%0, %q1}
8394 movhpd\t{%2, %0|%0, %q2}
8395 vmovhpd\t{%2, %1, %0|%0, %1, %q2}
8396 %vmovlpd\t{%2, %H0|%H0, %2}"
8397 [(set_attr "isa" "noavx,avx,sse3,noavx,avx,*")
8398 (set_attr "type" "sselog,sselog,sselog,ssemov,ssemov,ssemov")
8399 (set (attr "prefix_data16")
8400 (if_then_else (eq_attr "alternative" "3,5")
8402 (const_string "*")))
8403 (set_attr "prefix" "orig,maybe_evex,maybe_vex,orig,maybe_evex,maybe_vex")
8404 (set_attr "mode" "V2DF,V2DF,DF,V1DF,V1DF,V1DF")])
8407 [(set (match_operand:V2DF 0 "memory_operand")
8410 (match_operand:V2DF 1 "register_operand")
8412 (parallel [(const_int 0)
8414 "TARGET_SSE3 && reload_completed"
8417 rtx low = gen_lowpart (DFmode, operands[1]);
8419 emit_move_insn (adjust_address (operands[0], DFmode, 0), low);
8420 emit_move_insn (adjust_address (operands[0], DFmode, 8), low);
8425 [(set (match_operand:V2DF 0 "register_operand")
8428 (match_operand:V2DF 1 "memory_operand")
8430 (parallel [(match_operand:SI 2 "const_0_to_1_operand")
8431 (match_operand:SI 3 "const_int_operand")])))]
8432 "TARGET_SSE3 && INTVAL (operands[2]) + 2 == INTVAL (operands[3])"
8433 [(set (match_dup 0) (vec_duplicate:V2DF (match_dup 1)))]
8435 operands[1] = adjust_address (operands[1], DFmode, INTVAL (operands[2]) * 8);
8438 (define_insn "avx512f_vmscalef<mode><mask_scalar_name><round_scalar_name>"
8439 [(set (match_operand:VF_128 0 "register_operand" "=v")
8442 [(match_operand:VF_128 1 "register_operand" "v")
8443 (match_operand:VF_128 2 "<round_scalar_nimm_predicate>" "<round_scalar_constraint>")]
8448 "vscalef<ssescalarmodesuffix>\t{<round_scalar_mask_op3>%2, %1, %0<mask_scalar_operand3>|%0<mask_scalar_operand3>, %1, %2<round_scalar_mask_op3>}"
8449 [(set_attr "prefix" "evex")
8450 (set_attr "mode" "<ssescalarmode>")])
8452 (define_insn "<avx512>_scalef<mode><mask_name><round_name>"
8453 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8455 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
8456 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")]
8459 "vscalef<ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
8460 [(set_attr "prefix" "evex")
8461 (set_attr "mode" "<MODE>")])
8463 (define_expand "<avx512>_vternlog<mode>_maskz"
8464 [(match_operand:VI48_AVX512VL 0 "register_operand")
8465 (match_operand:VI48_AVX512VL 1 "register_operand")
8466 (match_operand:VI48_AVX512VL 2 "register_operand")
8467 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand")
8468 (match_operand:SI 4 "const_0_to_255_operand")
8469 (match_operand:<avx512fmaskmode> 5 "register_operand")]
8472 emit_insn (gen_<avx512>_vternlog<mode>_maskz_1 (
8473 operands[0], operands[1], operands[2], operands[3],
8474 operands[4], CONST0_RTX (<MODE>mode), operands[5]));
8478 (define_insn "<avx512>_vternlog<mode><sd_maskz_name>"
8479 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
8480 (unspec:VI48_AVX512VL
8481 [(match_operand:VI48_AVX512VL 1 "register_operand" "0")
8482 (match_operand:VI48_AVX512VL 2 "register_operand" "v")
8483 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand" "vm")
8484 (match_operand:SI 4 "const_0_to_255_operand")]
8487 "vpternlog<ssemodesuffix>\t{%4, %3, %2, %0<sd_mask_op5>|%0<sd_mask_op5>, %2, %3, %4}"
8488 [(set_attr "type" "sselog")
8489 (set_attr "prefix" "evex")
8490 (set_attr "mode" "<sseinsnmode>")])
8492 (define_insn "<avx512>_vternlog<mode>_mask"
8493 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
8494 (vec_merge:VI48_AVX512VL
8495 (unspec:VI48_AVX512VL
8496 [(match_operand:VI48_AVX512VL 1 "register_operand" "0")
8497 (match_operand:VI48_AVX512VL 2 "register_operand" "v")
8498 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand" "vm")
8499 (match_operand:SI 4 "const_0_to_255_operand")]
8502 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
8504 "vpternlog<ssemodesuffix>\t{%4, %3, %2, %0%{%5%}|%0%{%5%}, %2, %3, %4}"
8505 [(set_attr "type" "sselog")
8506 (set_attr "prefix" "evex")
8507 (set_attr "mode" "<sseinsnmode>")])
8509 (define_insn "<avx512>_getexp<mode><mask_name><round_saeonly_name>"
8510 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8511 (unspec:VF_AVX512VL [(match_operand:VF_AVX512VL 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
8514 "vgetexp<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}";
8515 [(set_attr "prefix" "evex")
8516 (set_attr "mode" "<MODE>")])
8518 (define_insn "avx512f_sgetexp<mode><mask_scalar_name><round_saeonly_scalar_name>"
8519 [(set (match_operand:VF_128 0 "register_operand" "=v")
8522 [(match_operand:VF_128 1 "register_operand" "v")
8523 (match_operand:VF_128 2 "<round_saeonly_scalar_nimm_predicate>" "<round_saeonly_scalar_constraint>")]
8528 "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>}";
8529 [(set_attr "prefix" "evex")
8530 (set_attr "mode" "<ssescalarmode>")])
8532 (define_insn "<mask_codefor><avx512>_align<mode><mask_name>"
8533 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
8534 (unspec:VI48_AVX512VL [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
8535 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")
8536 (match_operand:SI 3 "const_0_to_255_operand")]
8539 "valign<ssemodesuffix>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3}";
8540 [(set_attr "prefix" "evex")
8541 (set_attr "mode" "<sseinsnmode>")])
8543 (define_expand "avx512f_shufps512_mask"
8544 [(match_operand:V16SF 0 "register_operand")
8545 (match_operand:V16SF 1 "register_operand")
8546 (match_operand:V16SF 2 "nonimmediate_operand")
8547 (match_operand:SI 3 "const_0_to_255_operand")
8548 (match_operand:V16SF 4 "register_operand")
8549 (match_operand:HI 5 "register_operand")]
8552 int mask = INTVAL (operands[3]);
8553 emit_insn (gen_avx512f_shufps512_1_mask (operands[0], operands[1], operands[2],
8554 GEN_INT ((mask >> 0) & 3),
8555 GEN_INT ((mask >> 2) & 3),
8556 GEN_INT (((mask >> 4) & 3) + 16),
8557 GEN_INT (((mask >> 6) & 3) + 16),
8558 GEN_INT (((mask >> 0) & 3) + 4),
8559 GEN_INT (((mask >> 2) & 3) + 4),
8560 GEN_INT (((mask >> 4) & 3) + 20),
8561 GEN_INT (((mask >> 6) & 3) + 20),
8562 GEN_INT (((mask >> 0) & 3) + 8),
8563 GEN_INT (((mask >> 2) & 3) + 8),
8564 GEN_INT (((mask >> 4) & 3) + 24),
8565 GEN_INT (((mask >> 6) & 3) + 24),
8566 GEN_INT (((mask >> 0) & 3) + 12),
8567 GEN_INT (((mask >> 2) & 3) + 12),
8568 GEN_INT (((mask >> 4) & 3) + 28),
8569 GEN_INT (((mask >> 6) & 3) + 28),
8570 operands[4], operands[5]));
8575 (define_expand "<avx512>_fixupimm<mode>_maskz<round_saeonly_expand_name>"
8576 [(match_operand:VF_AVX512VL 0 "register_operand")
8577 (match_operand:VF_AVX512VL 1 "register_operand")
8578 (match_operand:VF_AVX512VL 2 "register_operand")
8579 (match_operand:<sseintvecmode> 3 "<round_saeonly_expand_nimm_predicate>")
8580 (match_operand:SI 4 "const_0_to_255_operand")
8581 (match_operand:<avx512fmaskmode> 5 "register_operand")]
8584 emit_insn (gen_<avx512>_fixupimm<mode>_maskz_1<round_saeonly_expand_name> (
8585 operands[0], operands[1], operands[2], operands[3],
8586 operands[4], CONST0_RTX (<MODE>mode), operands[5]
8587 <round_saeonly_expand_operand6>));
8591 (define_insn "<avx512>_fixupimm<mode><sd_maskz_name><round_saeonly_name>"
8592 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8594 [(match_operand:VF_AVX512VL 1 "register_operand" "0")
8595 (match_operand:VF_AVX512VL 2 "register_operand" "v")
8596 (match_operand:<sseintvecmode> 3 "nonimmediate_operand" "<round_saeonly_constraint>")
8597 (match_operand:SI 4 "const_0_to_255_operand")]
8600 "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}";
8601 [(set_attr "prefix" "evex")
8602 (set_attr "mode" "<MODE>")])
8604 (define_insn "<avx512>_fixupimm<mode>_mask<round_saeonly_name>"
8605 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8606 (vec_merge:VF_AVX512VL
8608 [(match_operand:VF_AVX512VL 1 "register_operand" "0")
8609 (match_operand:VF_AVX512VL 2 "register_operand" "v")
8610 (match_operand:<sseintvecmode> 3 "nonimmediate_operand" "<round_saeonly_constraint>")
8611 (match_operand:SI 4 "const_0_to_255_operand")]
8614 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
8616 "vfixupimm<ssemodesuffix>\t{%4, <round_saeonly_op6>%3, %2, %0%{%5%}|%0%{%5%}, %2, %3<round_saeonly_op6>, %4}";
8617 [(set_attr "prefix" "evex")
8618 (set_attr "mode" "<MODE>")])
8620 (define_expand "avx512f_sfixupimm<mode>_maskz<round_saeonly_expand_name>"
8621 [(match_operand:VF_128 0 "register_operand")
8622 (match_operand:VF_128 1 "register_operand")
8623 (match_operand:VF_128 2 "register_operand")
8624 (match_operand:<sseintvecmode> 3 "<round_saeonly_expand_nimm_predicate>")
8625 (match_operand:SI 4 "const_0_to_255_operand")
8626 (match_operand:<avx512fmaskmode> 5 "register_operand")]
8629 emit_insn (gen_avx512f_sfixupimm<mode>_maskz_1<round_saeonly_expand_name> (
8630 operands[0], operands[1], operands[2], operands[3],
8631 operands[4], CONST0_RTX (<MODE>mode), operands[5]
8632 <round_saeonly_expand_operand6>));
8636 (define_insn "avx512f_sfixupimm<mode><sd_maskz_name><round_saeonly_name>"
8637 [(set (match_operand:VF_128 0 "register_operand" "=v")
8640 [(match_operand:VF_128 1 "register_operand" "0")
8641 (match_operand:VF_128 2 "register_operand" "v")
8642 (match_operand:<sseintvecmode> 3 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
8643 (match_operand:SI 4 "const_0_to_255_operand")]
8648 "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}";
8649 [(set_attr "prefix" "evex")
8650 (set_attr "mode" "<ssescalarmode>")])
8652 (define_insn "avx512f_sfixupimm<mode>_mask<round_saeonly_name>"
8653 [(set (match_operand:VF_128 0 "register_operand" "=v")
8657 [(match_operand:VF_128 1 "register_operand" "0")
8658 (match_operand:VF_128 2 "register_operand" "v")
8659 (match_operand:<sseintvecmode> 3 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
8660 (match_operand:SI 4 "const_0_to_255_operand")]
8665 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
8667 "vfixupimm<ssescalarmodesuffix>\t{%4, <round_saeonly_op6>%3, %2, %0%{%5%}|%0%{%5%}, %2, %<iptr>3<round_saeonly_op6>, %4}";
8668 [(set_attr "prefix" "evex")
8669 (set_attr "mode" "<ssescalarmode>")])
8671 (define_insn "<avx512>_rndscale<mode><mask_name><round_saeonly_name>"
8672 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8674 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "<round_saeonly_constraint>")
8675 (match_operand:SI 2 "const_0_to_255_operand")]
8678 "vrndscale<ssemodesuffix>\t{%2, <round_saeonly_mask_op3>%1, %0<mask_operand3>|%0<mask_operand3>, %1<round_saeonly_mask_op3>, %2}"
8679 [(set_attr "length_immediate" "1")
8680 (set_attr "prefix" "evex")
8681 (set_attr "mode" "<MODE>")])
8683 (define_insn "avx512f_rndscale<mode><round_saeonly_name>"
8684 [(set (match_operand:VF_128 0 "register_operand" "=v")
8687 [(match_operand:VF_128 1 "register_operand" "v")
8688 (match_operand:VF_128 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
8689 (match_operand:SI 3 "const_0_to_255_operand")]
8694 "vrndscale<ssescalarmodesuffix>\t{%3, <round_saeonly_op4>%2, %1, %0|%0, %1, %<iptr>2<round_saeonly_op4>, %3}"
8695 [(set_attr "length_immediate" "1")
8696 (set_attr "prefix" "evex")
8697 (set_attr "mode" "<MODE>")])
8699 ;; One bit in mask selects 2 elements.
8700 (define_insn "avx512f_shufps512_1<mask_name>"
8701 [(set (match_operand:V16SF 0 "register_operand" "=v")
8704 (match_operand:V16SF 1 "register_operand" "v")
8705 (match_operand:V16SF 2 "nonimmediate_operand" "vm"))
8706 (parallel [(match_operand 3 "const_0_to_3_operand")
8707 (match_operand 4 "const_0_to_3_operand")
8708 (match_operand 5 "const_16_to_19_operand")
8709 (match_operand 6 "const_16_to_19_operand")
8710 (match_operand 7 "const_4_to_7_operand")
8711 (match_operand 8 "const_4_to_7_operand")
8712 (match_operand 9 "const_20_to_23_operand")
8713 (match_operand 10 "const_20_to_23_operand")
8714 (match_operand 11 "const_8_to_11_operand")
8715 (match_operand 12 "const_8_to_11_operand")
8716 (match_operand 13 "const_24_to_27_operand")
8717 (match_operand 14 "const_24_to_27_operand")
8718 (match_operand 15 "const_12_to_15_operand")
8719 (match_operand 16 "const_12_to_15_operand")
8720 (match_operand 17 "const_28_to_31_operand")
8721 (match_operand 18 "const_28_to_31_operand")])))]
8723 && (INTVAL (operands[3]) == (INTVAL (operands[7]) - 4)
8724 && INTVAL (operands[4]) == (INTVAL (operands[8]) - 4)
8725 && INTVAL (operands[5]) == (INTVAL (operands[9]) - 4)
8726 && INTVAL (operands[6]) == (INTVAL (operands[10]) - 4)
8727 && INTVAL (operands[3]) == (INTVAL (operands[11]) - 8)
8728 && INTVAL (operands[4]) == (INTVAL (operands[12]) - 8)
8729 && INTVAL (operands[5]) == (INTVAL (operands[13]) - 8)
8730 && INTVAL (operands[6]) == (INTVAL (operands[14]) - 8)
8731 && INTVAL (operands[3]) == (INTVAL (operands[15]) - 12)
8732 && INTVAL (operands[4]) == (INTVAL (operands[16]) - 12)
8733 && INTVAL (operands[5]) == (INTVAL (operands[17]) - 12)
8734 && INTVAL (operands[6]) == (INTVAL (operands[18]) - 12))"
8737 mask = INTVAL (operands[3]);
8738 mask |= INTVAL (operands[4]) << 2;
8739 mask |= (INTVAL (operands[5]) - 16) << 4;
8740 mask |= (INTVAL (operands[6]) - 16) << 6;
8741 operands[3] = GEN_INT (mask);
8743 return "vshufps\t{%3, %2, %1, %0<mask_operand19>|%0<mask_operand19>, %1, %2, %3}";
8745 [(set_attr "type" "sselog")
8746 (set_attr "length_immediate" "1")
8747 (set_attr "prefix" "evex")
8748 (set_attr "mode" "V16SF")])
8750 (define_expand "avx512f_shufpd512_mask"
8751 [(match_operand:V8DF 0 "register_operand")
8752 (match_operand:V8DF 1 "register_operand")
8753 (match_operand:V8DF 2 "nonimmediate_operand")
8754 (match_operand:SI 3 "const_0_to_255_operand")
8755 (match_operand:V8DF 4 "register_operand")
8756 (match_operand:QI 5 "register_operand")]
8759 int mask = INTVAL (operands[3]);
8760 emit_insn (gen_avx512f_shufpd512_1_mask (operands[0], operands[1], operands[2],
8762 GEN_INT (mask & 2 ? 9 : 8),
8763 GEN_INT (mask & 4 ? 3 : 2),
8764 GEN_INT (mask & 8 ? 11 : 10),
8765 GEN_INT (mask & 16 ? 5 : 4),
8766 GEN_INT (mask & 32 ? 13 : 12),
8767 GEN_INT (mask & 64 ? 7 : 6),
8768 GEN_INT (mask & 128 ? 15 : 14),
8769 operands[4], operands[5]));
8773 (define_insn "avx512f_shufpd512_1<mask_name>"
8774 [(set (match_operand:V8DF 0 "register_operand" "=v")
8777 (match_operand:V8DF 1 "register_operand" "v")
8778 (match_operand:V8DF 2 "nonimmediate_operand" "vm"))
8779 (parallel [(match_operand 3 "const_0_to_1_operand")
8780 (match_operand 4 "const_8_to_9_operand")
8781 (match_operand 5 "const_2_to_3_operand")
8782 (match_operand 6 "const_10_to_11_operand")
8783 (match_operand 7 "const_4_to_5_operand")
8784 (match_operand 8 "const_12_to_13_operand")
8785 (match_operand 9 "const_6_to_7_operand")
8786 (match_operand 10 "const_14_to_15_operand")])))]
8790 mask = INTVAL (operands[3]);
8791 mask |= (INTVAL (operands[4]) - 8) << 1;
8792 mask |= (INTVAL (operands[5]) - 2) << 2;
8793 mask |= (INTVAL (operands[6]) - 10) << 3;
8794 mask |= (INTVAL (operands[7]) - 4) << 4;
8795 mask |= (INTVAL (operands[8]) - 12) << 5;
8796 mask |= (INTVAL (operands[9]) - 6) << 6;
8797 mask |= (INTVAL (operands[10]) - 14) << 7;
8798 operands[3] = GEN_INT (mask);
8800 return "vshufpd\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
8802 [(set_attr "type" "sselog")
8803 (set_attr "length_immediate" "1")
8804 (set_attr "prefix" "evex")
8805 (set_attr "mode" "V8DF")])
8807 (define_expand "avx_shufpd256<mask_expand4_name>"
8808 [(match_operand:V4DF 0 "register_operand")
8809 (match_operand:V4DF 1 "register_operand")
8810 (match_operand:V4DF 2 "nonimmediate_operand")
8811 (match_operand:SI 3 "const_int_operand")]
8814 int mask = INTVAL (operands[3]);
8815 emit_insn (gen_avx_shufpd256_1<mask_expand4_name> (operands[0],
8819 GEN_INT (mask & 2 ? 5 : 4),
8820 GEN_INT (mask & 4 ? 3 : 2),
8821 GEN_INT (mask & 8 ? 7 : 6)
8822 <mask_expand4_args>));
8826 (define_insn "avx_shufpd256_1<mask_name>"
8827 [(set (match_operand:V4DF 0 "register_operand" "=v")
8830 (match_operand:V4DF 1 "register_operand" "v")
8831 (match_operand:V4DF 2 "nonimmediate_operand" "vm"))
8832 (parallel [(match_operand 3 "const_0_to_1_operand")
8833 (match_operand 4 "const_4_to_5_operand")
8834 (match_operand 5 "const_2_to_3_operand")
8835 (match_operand 6 "const_6_to_7_operand")])))]
8836 "TARGET_AVX && <mask_avx512vl_condition>"
8839 mask = INTVAL (operands[3]);
8840 mask |= (INTVAL (operands[4]) - 4) << 1;
8841 mask |= (INTVAL (operands[5]) - 2) << 2;
8842 mask |= (INTVAL (operands[6]) - 6) << 3;
8843 operands[3] = GEN_INT (mask);
8845 return "vshufpd\t{%3, %2, %1, %0<mask_operand7>|%0<mask_operand7>, %1, %2, %3}";
8847 [(set_attr "type" "sseshuf")
8848 (set_attr "length_immediate" "1")
8849 (set_attr "prefix" "vex")
8850 (set_attr "mode" "V4DF")])
8852 (define_expand "sse2_shufpd<mask_expand4_name>"
8853 [(match_operand:V2DF 0 "register_operand")
8854 (match_operand:V2DF 1 "register_operand")
8855 (match_operand:V2DF 2 "vector_operand")
8856 (match_operand:SI 3 "const_int_operand")]
8859 int mask = INTVAL (operands[3]);
8860 emit_insn (gen_sse2_shufpd_v2df<mask_expand4_name> (operands[0], operands[1],
8861 operands[2], GEN_INT (mask & 1),
8862 GEN_INT (mask & 2 ? 3 : 2)
8863 <mask_expand4_args>));
8867 (define_insn "sse2_shufpd_v2df_mask"
8868 [(set (match_operand:V2DF 0 "register_operand" "=v")
8872 (match_operand:V2DF 1 "register_operand" "v")
8873 (match_operand:V2DF 2 "nonimmediate_operand" "vm"))
8874 (parallel [(match_operand 3 "const_0_to_1_operand")
8875 (match_operand 4 "const_2_to_3_operand")]))
8876 (match_operand:V2DF 5 "vector_move_operand" "0C")
8877 (match_operand:QI 6 "register_operand" "Yk")))]
8881 mask = INTVAL (operands[3]);
8882 mask |= (INTVAL (operands[4]) - 2) << 1;
8883 operands[3] = GEN_INT (mask);
8885 return "vshufpd\t{%3, %2, %1, %0%{%6%}%N5|%0%{%6%}%N5, %1, %2, %3}";
8887 [(set_attr "type" "sseshuf")
8888 (set_attr "length_immediate" "1")
8889 (set_attr "prefix" "evex")
8890 (set_attr "mode" "V2DF")])
8892 ;; punpcklqdq and punpckhqdq are shorter than shufpd.
8893 (define_insn "avx2_interleave_highv4di<mask_name>"
8894 [(set (match_operand:V4DI 0 "register_operand" "=v")
8897 (match_operand:V4DI 1 "register_operand" "v")
8898 (match_operand:V4DI 2 "nonimmediate_operand" "vm"))
8899 (parallel [(const_int 1)
8903 "TARGET_AVX2 && <mask_avx512vl_condition>"
8904 "vpunpckhqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8905 [(set_attr "type" "sselog")
8906 (set_attr "prefix" "vex")
8907 (set_attr "mode" "OI")])
8909 (define_insn "<mask_codefor>avx512f_interleave_highv8di<mask_name>"
8910 [(set (match_operand:V8DI 0 "register_operand" "=v")
8913 (match_operand:V8DI 1 "register_operand" "v")
8914 (match_operand:V8DI 2 "nonimmediate_operand" "vm"))
8915 (parallel [(const_int 1) (const_int 9)
8916 (const_int 3) (const_int 11)
8917 (const_int 5) (const_int 13)
8918 (const_int 7) (const_int 15)])))]
8920 "vpunpckhqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8921 [(set_attr "type" "sselog")
8922 (set_attr "prefix" "evex")
8923 (set_attr "mode" "XI")])
8925 (define_insn "vec_interleave_highv2di<mask_name>"
8926 [(set (match_operand:V2DI 0 "register_operand" "=x,v")
8929 (match_operand:V2DI 1 "register_operand" "0,v")
8930 (match_operand:V2DI 2 "vector_operand" "xBm,vm"))
8931 (parallel [(const_int 1)
8933 "TARGET_SSE2 && <mask_avx512vl_condition>"
8935 punpckhqdq\t{%2, %0|%0, %2}
8936 vpunpckhqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8937 [(set_attr "isa" "noavx,avx")
8938 (set_attr "type" "sselog")
8939 (set_attr "prefix_data16" "1,*")
8940 (set_attr "prefix" "orig,<mask_prefix>")
8941 (set_attr "mode" "TI")])
8943 (define_insn "avx2_interleave_lowv4di<mask_name>"
8944 [(set (match_operand:V4DI 0 "register_operand" "=v")
8947 (match_operand:V4DI 1 "register_operand" "v")
8948 (match_operand:V4DI 2 "nonimmediate_operand" "vm"))
8949 (parallel [(const_int 0)
8953 "TARGET_AVX2 && <mask_avx512vl_condition>"
8954 "vpunpcklqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8955 [(set_attr "type" "sselog")
8956 (set_attr "prefix" "vex")
8957 (set_attr "mode" "OI")])
8959 (define_insn "<mask_codefor>avx512f_interleave_lowv8di<mask_name>"
8960 [(set (match_operand:V8DI 0 "register_operand" "=v")
8963 (match_operand:V8DI 1 "register_operand" "v")
8964 (match_operand:V8DI 2 "nonimmediate_operand" "vm"))
8965 (parallel [(const_int 0) (const_int 8)
8966 (const_int 2) (const_int 10)
8967 (const_int 4) (const_int 12)
8968 (const_int 6) (const_int 14)])))]
8970 "vpunpcklqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8971 [(set_attr "type" "sselog")
8972 (set_attr "prefix" "evex")
8973 (set_attr "mode" "XI")])
8975 (define_insn "vec_interleave_lowv2di<mask_name>"
8976 [(set (match_operand:V2DI 0 "register_operand" "=x,v")
8979 (match_operand:V2DI 1 "register_operand" "0,v")
8980 (match_operand:V2DI 2 "vector_operand" "xBm,vm"))
8981 (parallel [(const_int 0)
8983 "TARGET_SSE2 && <mask_avx512vl_condition>"
8985 punpcklqdq\t{%2, %0|%0, %2}
8986 vpunpcklqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8987 [(set_attr "isa" "noavx,avx")
8988 (set_attr "type" "sselog")
8989 (set_attr "prefix_data16" "1,*")
8990 (set_attr "prefix" "orig,vex")
8991 (set_attr "mode" "TI")])
8993 (define_insn "sse2_shufpd_<mode>"
8994 [(set (match_operand:VI8F_128 0 "register_operand" "=x,v")
8995 (vec_select:VI8F_128
8996 (vec_concat:<ssedoublevecmode>
8997 (match_operand:VI8F_128 1 "register_operand" "0,v")
8998 (match_operand:VI8F_128 2 "vector_operand" "xBm,vm"))
8999 (parallel [(match_operand 3 "const_0_to_1_operand")
9000 (match_operand 4 "const_2_to_3_operand")])))]
9004 mask = INTVAL (operands[3]);
9005 mask |= (INTVAL (operands[4]) - 2) << 1;
9006 operands[3] = GEN_INT (mask);
9008 switch (which_alternative)
9011 return "shufpd\t{%3, %2, %0|%0, %2, %3}";
9013 return "vshufpd\t{%3, %2, %1, %0|%0, %1, %2, %3}";
9018 [(set_attr "isa" "noavx,avx")
9019 (set_attr "type" "sseshuf")
9020 (set_attr "length_immediate" "1")
9021 (set_attr "prefix" "orig,maybe_evex")
9022 (set_attr "mode" "V2DF")])
9024 ;; Avoid combining registers from different units in a single alternative,
9025 ;; see comment above inline_secondary_memory_needed function in i386.c
9026 (define_insn "sse2_storehpd"
9027 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,Yv,x,*f,r")
9029 (match_operand:V2DF 1 "nonimmediate_operand" " v,0, v,o,o,o")
9030 (parallel [(const_int 1)])))]
9031 "TARGET_SSE2 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
9033 %vmovhpd\t{%1, %0|%0, %1}
9035 vunpckhpd\t{%d1, %0|%0, %d1}
9039 [(set_attr "isa" "*,noavx,avx,*,*,*")
9040 (set_attr "type" "ssemov,sselog1,sselog1,ssemov,fmov,imov")
9041 (set (attr "prefix_data16")
9043 (and (eq_attr "alternative" "0")
9044 (not (match_test "TARGET_AVX")))
9046 (const_string "*")))
9047 (set_attr "prefix" "maybe_vex,orig,maybe_evex,*,*,*")
9048 (set_attr "mode" "V1DF,V1DF,V2DF,DF,DF,DF")])
9051 [(set (match_operand:DF 0 "register_operand")
9053 (match_operand:V2DF 1 "memory_operand")
9054 (parallel [(const_int 1)])))]
9055 "TARGET_SSE2 && reload_completed"
9056 [(set (match_dup 0) (match_dup 1))]
9057 "operands[1] = adjust_address (operands[1], DFmode, 8);")
9059 (define_insn "*vec_extractv2df_1_sse"
9060 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,x")
9062 (match_operand:V2DF 1 "nonimmediate_operand" "x,x,o")
9063 (parallel [(const_int 1)])))]
9064 "!TARGET_SSE2 && TARGET_SSE
9065 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
9067 movhps\t{%1, %0|%q0, %1}
9068 movhlps\t{%1, %0|%0, %1}
9069 movlps\t{%H1, %0|%0, %H1}"
9070 [(set_attr "type" "ssemov")
9071 (set_attr "mode" "V2SF,V4SF,V2SF")])
9073 ;; Avoid combining registers from different units in a single alternative,
9074 ;; see comment above inline_secondary_memory_needed function in i386.c
9075 (define_insn "sse2_storelpd"
9076 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,x,*f,r")
9078 (match_operand:V2DF 1 "nonimmediate_operand" " v,x,m,m,m")
9079 (parallel [(const_int 0)])))]
9080 "TARGET_SSE2 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
9082 %vmovlpd\t{%1, %0|%0, %1}
9087 [(set_attr "type" "ssemov,ssemov,ssemov,fmov,imov")
9088 (set (attr "prefix_data16")
9089 (if_then_else (eq_attr "alternative" "0")
9091 (const_string "*")))
9092 (set_attr "prefix" "maybe_vex")
9093 (set_attr "mode" "V1DF,DF,DF,DF,DF")])
9096 [(set (match_operand:DF 0 "register_operand")
9098 (match_operand:V2DF 1 "nonimmediate_operand")
9099 (parallel [(const_int 0)])))]
9100 "TARGET_SSE2 && reload_completed"
9101 [(set (match_dup 0) (match_dup 1))]
9102 "operands[1] = gen_lowpart (DFmode, operands[1]);")
9104 (define_insn "*vec_extractv2df_0_sse"
9105 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,x")
9107 (match_operand:V2DF 1 "nonimmediate_operand" "x,x,m")
9108 (parallel [(const_int 0)])))]
9109 "!TARGET_SSE2 && TARGET_SSE
9110 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
9112 movlps\t{%1, %0|%0, %1}
9113 movaps\t{%1, %0|%0, %1}
9114 movlps\t{%1, %0|%0, %q1}"
9115 [(set_attr "type" "ssemov")
9116 (set_attr "mode" "V2SF,V4SF,V2SF")])
9118 (define_expand "sse2_loadhpd_exp"
9119 [(set (match_operand:V2DF 0 "nonimmediate_operand")
9122 (match_operand:V2DF 1 "nonimmediate_operand")
9123 (parallel [(const_int 0)]))
9124 (match_operand:DF 2 "nonimmediate_operand")))]
9127 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V2DFmode, operands);
9129 emit_insn (gen_sse2_loadhpd (dst, operands[1], operands[2]));
9131 /* Fix up the destination if needed. */
9132 if (dst != operands[0])
9133 emit_move_insn (operands[0], dst);
9138 ;; Avoid combining registers from different units in a single alternative,
9139 ;; see comment above inline_secondary_memory_needed function in i386.c
9140 (define_insn "sse2_loadhpd"
9141 [(set (match_operand:V2DF 0 "nonimmediate_operand"
9145 (match_operand:V2DF 1 "nonimmediate_operand"
9147 (parallel [(const_int 0)]))
9148 (match_operand:DF 2 "nonimmediate_operand"
9149 " m,m,x,Yv,x,*f,r")))]
9150 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
9152 movhpd\t{%2, %0|%0, %2}
9153 vmovhpd\t{%2, %1, %0|%0, %1, %2}
9154 unpcklpd\t{%2, %0|%0, %2}
9155 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
9159 [(set_attr "isa" "noavx,avx,noavx,avx,*,*,*")
9160 (set_attr "type" "ssemov,ssemov,sselog,sselog,ssemov,fmov,imov")
9161 (set (attr "prefix_data16")
9162 (if_then_else (eq_attr "alternative" "0")
9164 (const_string "*")))
9165 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,*,*,*")
9166 (set_attr "mode" "V1DF,V1DF,V2DF,V2DF,DF,DF,DF")])
9169 [(set (match_operand:V2DF 0 "memory_operand")
9171 (vec_select:DF (match_dup 0) (parallel [(const_int 0)]))
9172 (match_operand:DF 1 "register_operand")))]
9173 "TARGET_SSE2 && reload_completed"
9174 [(set (match_dup 0) (match_dup 1))]
9175 "operands[0] = adjust_address (operands[0], DFmode, 8);")
9177 (define_expand "sse2_loadlpd_exp"
9178 [(set (match_operand:V2DF 0 "nonimmediate_operand")
9180 (match_operand:DF 2 "nonimmediate_operand")
9182 (match_operand:V2DF 1 "nonimmediate_operand")
9183 (parallel [(const_int 1)]))))]
9186 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V2DFmode, operands);
9188 emit_insn (gen_sse2_loadlpd (dst, operands[1], operands[2]));
9190 /* Fix up the destination if needed. */
9191 if (dst != operands[0])
9192 emit_move_insn (operands[0], dst);
9197 ;; Avoid combining registers from different units in a single alternative,
9198 ;; see comment above inline_secondary_memory_needed function in i386.c
9199 (define_insn "sse2_loadlpd"
9200 [(set (match_operand:V2DF 0 "nonimmediate_operand"
9201 "=v,x,v,x,v,x,x,v,m,m ,m")
9203 (match_operand:DF 2 "nonimmediate_operand"
9204 "vm,m,m,x,v,0,0,v,x,*f,r")
9206 (match_operand:V2DF 1 "vector_move_operand"
9207 " C,0,v,0,v,x,o,o,0,0 ,0")
9208 (parallel [(const_int 1)]))))]
9209 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
9211 %vmovq\t{%2, %0|%0, %2}
9212 movlpd\t{%2, %0|%0, %2}
9213 vmovlpd\t{%2, %1, %0|%0, %1, %2}
9214 movsd\t{%2, %0|%0, %2}
9215 vmovsd\t{%2, %1, %0|%0, %1, %2}
9216 shufpd\t{$2, %1, %0|%0, %1, 2}
9217 movhpd\t{%H1, %0|%0, %H1}
9218 vmovhpd\t{%H1, %2, %0|%0, %2, %H1}
9222 [(set_attr "isa" "*,noavx,avx,noavx,avx,noavx,noavx,avx,*,*,*")
9224 (cond [(eq_attr "alternative" "5")
9225 (const_string "sselog")
9226 (eq_attr "alternative" "9")
9227 (const_string "fmov")
9228 (eq_attr "alternative" "10")
9229 (const_string "imov")
9231 (const_string "ssemov")))
9232 (set (attr "prefix_data16")
9233 (if_then_else (eq_attr "alternative" "1,6")
9235 (const_string "*")))
9236 (set (attr "length_immediate")
9237 (if_then_else (eq_attr "alternative" "5")
9239 (const_string "*")))
9240 (set (attr "prefix")
9241 (cond [(eq_attr "alternative" "0")
9242 (const_string "maybe_vex")
9243 (eq_attr "alternative" "1,3,5,6")
9244 (const_string "orig")
9245 (eq_attr "alternative" "2,4,7")
9246 (const_string "maybe_evex")
9248 (const_string "*")))
9249 (set_attr "mode" "DF,V1DF,V1DF,V1DF,V1DF,V2DF,V1DF,V1DF,DF,DF,DF")])
9252 [(set (match_operand:V2DF 0 "memory_operand")
9254 (match_operand:DF 1 "register_operand")
9255 (vec_select:DF (match_dup 0) (parallel [(const_int 1)]))))]
9256 "TARGET_SSE2 && reload_completed"
9257 [(set (match_dup 0) (match_dup 1))]
9258 "operands[0] = adjust_address (operands[0], DFmode, 0);")
9260 (define_insn "sse2_movsd"
9261 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,v,x,v,m,x,x,v,o")
9263 (match_operand:V2DF 2 "nonimmediate_operand" " x,v,m,m,v,0,0,v,0")
9264 (match_operand:V2DF 1 "nonimmediate_operand" " 0,v,0,v,0,x,o,o,v")
9268 movsd\t{%2, %0|%0, %2}
9269 vmovsd\t{%2, %1, %0|%0, %1, %2}
9270 movlpd\t{%2, %0|%0, %q2}
9271 vmovlpd\t{%2, %1, %0|%0, %1, %q2}
9272 %vmovlpd\t{%2, %0|%q0, %2}
9273 shufpd\t{$2, %1, %0|%0, %1, 2}
9274 movhps\t{%H1, %0|%0, %H1}
9275 vmovhps\t{%H1, %2, %0|%0, %2, %H1}
9276 %vmovhps\t{%1, %H0|%H0, %1}"
9277 [(set_attr "isa" "noavx,avx,noavx,avx,*,noavx,noavx,avx,*")
9280 (eq_attr "alternative" "5")
9281 (const_string "sselog")
9282 (const_string "ssemov")))
9283 (set (attr "prefix_data16")
9285 (and (eq_attr "alternative" "2,4")
9286 (not (match_test "TARGET_AVX")))
9288 (const_string "*")))
9289 (set (attr "length_immediate")
9290 (if_then_else (eq_attr "alternative" "5")
9292 (const_string "*")))
9293 (set (attr "prefix")
9294 (cond [(eq_attr "alternative" "1,3,7")
9295 (const_string "maybe_evex")
9296 (eq_attr "alternative" "4,8")
9297 (const_string "maybe_vex")
9299 (const_string "orig")))
9300 (set_attr "mode" "DF,DF,V1DF,V1DF,V1DF,V2DF,V1DF,V1DF,V1DF")])
9302 (define_insn "vec_dupv2df<mask_name>"
9303 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
9305 (match_operand:DF 1 "nonimmediate_operand" " 0,xm,vm")))]
9306 "TARGET_SSE2 && <mask_avx512vl_condition>"
9309 %vmovddup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}
9310 vmovddup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
9311 [(set_attr "isa" "noavx,sse3,avx512vl")
9312 (set_attr "type" "sselog1")
9313 (set_attr "prefix" "orig,maybe_vex,evex")
9314 (set_attr "mode" "V2DF,DF,DF")])
9316 (define_insn "vec_concatv2df"
9317 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v,x,v,x,x, v,x,x")
9319 (match_operand:DF 1 "nonimmediate_operand" " 0,x,v,m,m,0,x,xm,0,0")
9320 (match_operand:DF 2 "vector_move_operand" " x,x,v,1,1,m,m, C,x,m")))]
9322 && (!(MEM_P (operands[1]) && MEM_P (operands[2]))
9323 || (TARGET_SSE3 && rtx_equal_p (operands[1], operands[2])))"
9325 unpcklpd\t{%2, %0|%0, %2}
9326 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
9327 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
9328 %vmovddup\t{%1, %0|%0, %1}
9329 vmovddup\t{%1, %0|%0, %1}
9330 movhpd\t{%2, %0|%0, %2}
9331 vmovhpd\t{%2, %1, %0|%0, %1, %2}
9332 %vmovq\t{%1, %0|%0, %1}
9333 movlhps\t{%2, %0|%0, %2}
9334 movhps\t{%2, %0|%0, %2}"
9336 (cond [(eq_attr "alternative" "0,5")
9337 (const_string "sse2_noavx")
9338 (eq_attr "alternative" "1,6")
9339 (const_string "avx")
9340 (eq_attr "alternative" "2,4")
9341 (const_string "avx512vl")
9342 (eq_attr "alternative" "3")
9343 (const_string "sse3")
9344 (eq_attr "alternative" "7")
9345 (const_string "sse2")
9347 (const_string "noavx")))
9350 (eq_attr "alternative" "0,1,2,3,4")
9351 (const_string "sselog")
9352 (const_string "ssemov")))
9353 (set (attr "prefix_data16")
9354 (if_then_else (eq_attr "alternative" "5")
9356 (const_string "*")))
9357 (set (attr "prefix")
9358 (cond [(eq_attr "alternative" "1,6")
9359 (const_string "vex")
9360 (eq_attr "alternative" "2,4")
9361 (const_string "evex")
9362 (eq_attr "alternative" "3,7")
9363 (const_string "maybe_vex")
9365 (const_string "orig")))
9366 (set_attr "mode" "V2DF,V2DF,V2DF, DF, DF, V1DF,V1DF,DF,V4SF,V2SF")])
9368 ;; vmovq clears also the higher bits.
9369 (define_insn "vec_set<mode>_0"
9370 [(set (match_operand:VF2_512_256 0 "register_operand" "=v")
9371 (vec_merge:VF2_512_256
9372 (vec_duplicate:VF2_512_256
9373 (match_operand:<ssescalarmode> 2 "general_operand" "xm"))
9374 (match_operand:VF2_512_256 1 "const0_operand" "C")
9377 "vmovq\t{%2, %x0|%x0, %2}"
9378 [(set_attr "type" "ssemov")
9379 (set_attr "prefix" "maybe_evex")
9380 (set_attr "mode" "DF")])
9382 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9384 ;; Parallel integer down-conversion operations
9386 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9388 (define_mode_iterator PMOV_DST_MODE_1 [V16QI V16HI V8SI V8HI])
9389 (define_mode_attr pmov_src_mode
9390 [(V16QI "V16SI") (V16HI "V16SI") (V8SI "V8DI") (V8HI "V8DI")])
9391 (define_mode_attr pmov_src_lower
9392 [(V16QI "v16si") (V16HI "v16si") (V8SI "v8di") (V8HI "v8di")])
9393 (define_mode_attr pmov_suff_1
9394 [(V16QI "db") (V16HI "dw") (V8SI "qd") (V8HI "qw")])
9396 (define_insn "*avx512f_<code><pmov_src_lower><mode>2"
9397 [(set (match_operand:PMOV_DST_MODE_1 0 "nonimmediate_operand" "=v,m")
9398 (any_truncate:PMOV_DST_MODE_1
9399 (match_operand:<pmov_src_mode> 1 "register_operand" "v,v")))]
9401 "vpmov<trunsuffix><pmov_suff_1>\t{%1, %0|%0, %1}"
9402 [(set_attr "type" "ssemov")
9403 (set_attr "memory" "none,store")
9404 (set_attr "prefix" "evex")
9405 (set_attr "mode" "<sseinsnmode>")])
9407 (define_insn "avx512f_<code><pmov_src_lower><mode>2_mask"
9408 [(set (match_operand:PMOV_DST_MODE_1 0 "nonimmediate_operand" "=v,m")
9409 (vec_merge:PMOV_DST_MODE_1
9410 (any_truncate:PMOV_DST_MODE_1
9411 (match_operand:<pmov_src_mode> 1 "register_operand" "v,v"))
9412 (match_operand:PMOV_DST_MODE_1 2 "vector_move_operand" "0C,0")
9413 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
9415 "vpmov<trunsuffix><pmov_suff_1>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9416 [(set_attr "type" "ssemov")
9417 (set_attr "memory" "none,store")
9418 (set_attr "prefix" "evex")
9419 (set_attr "mode" "<sseinsnmode>")])
9421 (define_expand "avx512f_<code><pmov_src_lower><mode>2_mask_store"
9422 [(set (match_operand:PMOV_DST_MODE_1 0 "memory_operand")
9423 (vec_merge:PMOV_DST_MODE_1
9424 (any_truncate:PMOV_DST_MODE_1
9425 (match_operand:<pmov_src_mode> 1 "register_operand"))
9427 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
9430 (define_insn "avx512bw_<code>v32hiv32qi2"
9431 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=v,m")
9433 (match_operand:V32HI 1 "register_operand" "v,v")))]
9435 "vpmov<trunsuffix>wb\t{%1, %0|%0, %1}"
9436 [(set_attr "type" "ssemov")
9437 (set_attr "memory" "none,store")
9438 (set_attr "prefix" "evex")
9439 (set_attr "mode" "XI")])
9441 (define_insn "avx512bw_<code>v32hiv32qi2_mask"
9442 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=v,m")
9445 (match_operand:V32HI 1 "register_operand" "v,v"))
9446 (match_operand:V32QI 2 "vector_move_operand" "0C,0")
9447 (match_operand:SI 3 "register_operand" "Yk,Yk")))]
9449 "vpmov<trunsuffix>wb\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9450 [(set_attr "type" "ssemov")
9451 (set_attr "memory" "none,store")
9452 (set_attr "prefix" "evex")
9453 (set_attr "mode" "XI")])
9455 (define_expand "avx512bw_<code>v32hiv32qi2_mask_store"
9456 [(set (match_operand:V32QI 0 "nonimmediate_operand")
9459 (match_operand:V32HI 1 "register_operand"))
9461 (match_operand:SI 2 "register_operand")))]
9464 (define_mode_iterator PMOV_DST_MODE_2
9465 [V4SI V8HI (V16QI "TARGET_AVX512BW")])
9466 (define_mode_attr pmov_suff_2
9467 [(V16QI "wb") (V8HI "dw") (V4SI "qd")])
9469 (define_insn "*avx512vl_<code><ssedoublemodelower><mode>2"
9470 [(set (match_operand:PMOV_DST_MODE_2 0 "nonimmediate_operand" "=v,m")
9471 (any_truncate:PMOV_DST_MODE_2
9472 (match_operand:<ssedoublemode> 1 "register_operand" "v,v")))]
9474 "vpmov<trunsuffix><pmov_suff_2>\t{%1, %0|%0, %1}"
9475 [(set_attr "type" "ssemov")
9476 (set_attr "memory" "none,store")
9477 (set_attr "prefix" "evex")
9478 (set_attr "mode" "<sseinsnmode>")])
9480 (define_insn "<avx512>_<code><ssedoublemodelower><mode>2_mask"
9481 [(set (match_operand:PMOV_DST_MODE_2 0 "nonimmediate_operand" "=v,m")
9482 (vec_merge:PMOV_DST_MODE_2
9483 (any_truncate:PMOV_DST_MODE_2
9484 (match_operand:<ssedoublemode> 1 "register_operand" "v,v"))
9485 (match_operand:PMOV_DST_MODE_2 2 "vector_move_operand" "0C,0")
9486 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
9488 "vpmov<trunsuffix><pmov_suff_2>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9489 [(set_attr "type" "ssemov")
9490 (set_attr "memory" "none,store")
9491 (set_attr "prefix" "evex")
9492 (set_attr "mode" "<sseinsnmode>")])
9494 (define_expand "<avx512>_<code><ssedoublemodelower><mode>2_mask_store"
9495 [(set (match_operand:PMOV_DST_MODE_2 0 "nonimmediate_operand")
9496 (vec_merge:PMOV_DST_MODE_2
9497 (any_truncate:PMOV_DST_MODE_2
9498 (match_operand:<ssedoublemode> 1 "register_operand"))
9500 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
9503 (define_mode_iterator PMOV_SRC_MODE_3 [V4DI V2DI V8SI V4SI (V8HI "TARGET_AVX512BW")])
9504 (define_mode_attr pmov_dst_3
9505 [(V4DI "V4QI") (V2DI "V2QI") (V8SI "V8QI") (V4SI "V4QI") (V8HI "V8QI")])
9506 (define_mode_attr pmov_dst_zeroed_3
9507 [(V4DI "V12QI") (V2DI "V14QI") (V8SI "V8QI") (V4SI "V12QI") (V8HI "V8QI")])
9508 (define_mode_attr pmov_suff_3
9509 [(V4DI "qb") (V2DI "qb") (V8SI "db") (V4SI "db") (V8HI "wb")])
9511 (define_insn "*avx512vl_<code><mode>v<ssescalarnum>qi2"
9512 [(set (match_operand:V16QI 0 "register_operand" "=v")
9514 (any_truncate:<pmov_dst_3>
9515 (match_operand:PMOV_SRC_MODE_3 1 "register_operand" "v"))
9516 (match_operand:<pmov_dst_zeroed_3> 2 "const0_operand")))]
9518 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0|%0, %1}"
9519 [(set_attr "type" "ssemov")
9520 (set_attr "prefix" "evex")
9521 (set_attr "mode" "TI")])
9523 (define_insn "*avx512vl_<code>v2div2qi2_store"
9524 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9527 (match_operand:V2DI 1 "register_operand" "v"))
9530 (parallel [(const_int 2) (const_int 3)
9531 (const_int 4) (const_int 5)
9532 (const_int 6) (const_int 7)
9533 (const_int 8) (const_int 9)
9534 (const_int 10) (const_int 11)
9535 (const_int 12) (const_int 13)
9536 (const_int 14) (const_int 15)]))))]
9538 "vpmov<trunsuffix>qb\t{%1, %0|%w0, %1}"
9539 [(set_attr "type" "ssemov")
9540 (set_attr "memory" "store")
9541 (set_attr "prefix" "evex")
9542 (set_attr "mode" "TI")])
9544 (define_insn "avx512vl_<code>v2div2qi2_mask"
9545 [(set (match_operand:V16QI 0 "register_operand" "=v")
9549 (match_operand:V2DI 1 "register_operand" "v"))
9551 (match_operand:V16QI 2 "vector_move_operand" "0C")
9552 (parallel [(const_int 0) (const_int 1)]))
9553 (match_operand:QI 3 "register_operand" "Yk"))
9554 (const_vector:V14QI [(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)
9558 (const_int 0) (const_int 0)
9559 (const_int 0) (const_int 0)
9560 (const_int 0) (const_int 0)])))]
9562 "vpmov<trunsuffix>qb\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9563 [(set_attr "type" "ssemov")
9564 (set_attr "prefix" "evex")
9565 (set_attr "mode" "TI")])
9567 (define_insn "*avx512vl_<code>v2div2qi2_mask_1"
9568 [(set (match_operand:V16QI 0 "register_operand" "=v")
9572 (match_operand:V2DI 1 "register_operand" "v"))
9573 (const_vector:V2QI [(const_int 0) (const_int 0)])
9574 (match_operand:QI 2 "register_operand" "Yk"))
9575 (const_vector:V14QI [(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)
9579 (const_int 0) (const_int 0)
9580 (const_int 0) (const_int 0)
9581 (const_int 0) (const_int 0)])))]
9583 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9584 [(set_attr "type" "ssemov")
9585 (set_attr "prefix" "evex")
9586 (set_attr "mode" "TI")])
9588 (define_insn "avx512vl_<code>v2div2qi2_mask_store"
9589 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9593 (match_operand:V2DI 1 "register_operand" "v"))
9596 (parallel [(const_int 0) (const_int 1)]))
9597 (match_operand:QI 2 "register_operand" "Yk"))
9600 (parallel [(const_int 2) (const_int 3)
9601 (const_int 4) (const_int 5)
9602 (const_int 6) (const_int 7)
9603 (const_int 8) (const_int 9)
9604 (const_int 10) (const_int 11)
9605 (const_int 12) (const_int 13)
9606 (const_int 14) (const_int 15)]))))]
9608 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}|%w0%{%2%}, %1}"
9609 [(set_attr "type" "ssemov")
9610 (set_attr "memory" "store")
9611 (set_attr "prefix" "evex")
9612 (set_attr "mode" "TI")])
9614 (define_insn "*avx512vl_<code><mode>v4qi2_store"
9615 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9618 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9621 (parallel [(const_int 4) (const_int 5)
9622 (const_int 6) (const_int 7)
9623 (const_int 8) (const_int 9)
9624 (const_int 10) (const_int 11)
9625 (const_int 12) (const_int 13)
9626 (const_int 14) (const_int 15)]))))]
9628 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0|%k0, %1}"
9629 [(set_attr "type" "ssemov")
9630 (set_attr "memory" "store")
9631 (set_attr "prefix" "evex")
9632 (set_attr "mode" "TI")])
9634 (define_insn "avx512vl_<code><mode>v4qi2_mask"
9635 [(set (match_operand:V16QI 0 "register_operand" "=v")
9639 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9641 (match_operand:V16QI 2 "vector_move_operand" "0C")
9642 (parallel [(const_int 0) (const_int 1)
9643 (const_int 2) (const_int 3)]))
9644 (match_operand:QI 3 "register_operand" "Yk"))
9645 (const_vector:V12QI [(const_int 0) (const_int 0)
9646 (const_int 0) (const_int 0)
9647 (const_int 0) (const_int 0)
9648 (const_int 0) (const_int 0)
9649 (const_int 0) (const_int 0)
9650 (const_int 0) (const_int 0)])))]
9652 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9653 [(set_attr "type" "ssemov")
9654 (set_attr "prefix" "evex")
9655 (set_attr "mode" "TI")])
9657 (define_insn "*avx512vl_<code><mode>v4qi2_mask_1"
9658 [(set (match_operand:V16QI 0 "register_operand" "=v")
9662 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9663 (const_vector:V4QI [(const_int 0) (const_int 0)
9664 (const_int 0) (const_int 0)])
9665 (match_operand:QI 2 "register_operand" "Yk"))
9666 (const_vector:V12QI [(const_int 0) (const_int 0)
9667 (const_int 0) (const_int 0)
9668 (const_int 0) (const_int 0)
9669 (const_int 0) (const_int 0)
9670 (const_int 0) (const_int 0)
9671 (const_int 0) (const_int 0)])))]
9673 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9674 [(set_attr "type" "ssemov")
9675 (set_attr "prefix" "evex")
9676 (set_attr "mode" "TI")])
9678 (define_insn "avx512vl_<code><mode>v4qi2_mask_store"
9679 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9683 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9686 (parallel [(const_int 0) (const_int 1)
9687 (const_int 2) (const_int 3)]))
9688 (match_operand:QI 2 "register_operand" "Yk"))
9691 (parallel [(const_int 4) (const_int 5)
9692 (const_int 6) (const_int 7)
9693 (const_int 8) (const_int 9)
9694 (const_int 10) (const_int 11)
9695 (const_int 12) (const_int 13)
9696 (const_int 14) (const_int 15)]))))]
9698 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}|%k0%{%2%}, %1}"
9699 [(set_attr "type" "ssemov")
9700 (set_attr "memory" "store")
9701 (set_attr "prefix" "evex")
9702 (set_attr "mode" "TI")])
9704 (define_mode_iterator VI2_128_BW_4_256
9705 [(V8HI "TARGET_AVX512BW") V8SI])
9707 (define_insn "*avx512vl_<code><mode>v8qi2_store"
9708 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9711 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9714 (parallel [(const_int 8) (const_int 9)
9715 (const_int 10) (const_int 11)
9716 (const_int 12) (const_int 13)
9717 (const_int 14) (const_int 15)]))))]
9719 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0|%q0, %1}"
9720 [(set_attr "type" "ssemov")
9721 (set_attr "memory" "store")
9722 (set_attr "prefix" "evex")
9723 (set_attr "mode" "TI")])
9725 (define_insn "avx512vl_<code><mode>v8qi2_mask"
9726 [(set (match_operand:V16QI 0 "register_operand" "=v")
9730 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9732 (match_operand:V16QI 2 "vector_move_operand" "0C")
9733 (parallel [(const_int 0) (const_int 1)
9734 (const_int 2) (const_int 3)
9735 (const_int 4) (const_int 5)
9736 (const_int 6) (const_int 7)]))
9737 (match_operand:QI 3 "register_operand" "Yk"))
9738 (const_vector:V8QI [(const_int 0) (const_int 0)
9739 (const_int 0) (const_int 0)
9740 (const_int 0) (const_int 0)
9741 (const_int 0) (const_int 0)])))]
9743 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9744 [(set_attr "type" "ssemov")
9745 (set_attr "prefix" "evex")
9746 (set_attr "mode" "TI")])
9748 (define_insn "*avx512vl_<code><mode>v8qi2_mask_1"
9749 [(set (match_operand:V16QI 0 "register_operand" "=v")
9753 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9754 (const_vector:V8QI [(const_int 0) (const_int 0)
9755 (const_int 0) (const_int 0)
9756 (const_int 0) (const_int 0)
9757 (const_int 0) (const_int 0)])
9758 (match_operand:QI 2 "register_operand" "Yk"))
9759 (const_vector:V8QI [(const_int 0) (const_int 0)
9760 (const_int 0) (const_int 0)
9761 (const_int 0) (const_int 0)
9762 (const_int 0) (const_int 0)])))]
9764 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9765 [(set_attr "type" "ssemov")
9766 (set_attr "prefix" "evex")
9767 (set_attr "mode" "TI")])
9769 (define_insn "avx512vl_<code><mode>v8qi2_mask_store"
9770 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9774 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9777 (parallel [(const_int 0) (const_int 1)
9778 (const_int 2) (const_int 3)
9779 (const_int 4) (const_int 5)
9780 (const_int 6) (const_int 7)]))
9781 (match_operand:QI 2 "register_operand" "Yk"))
9784 (parallel [(const_int 8) (const_int 9)
9785 (const_int 10) (const_int 11)
9786 (const_int 12) (const_int 13)
9787 (const_int 14) (const_int 15)]))))]
9789 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}|%q0%{%2%}, %1}"
9790 [(set_attr "type" "ssemov")
9791 (set_attr "memory" "store")
9792 (set_attr "prefix" "evex")
9793 (set_attr "mode" "TI")])
9795 (define_mode_iterator PMOV_SRC_MODE_4 [V4DI V2DI V4SI])
9796 (define_mode_attr pmov_dst_4
9797 [(V4DI "V4HI") (V2DI "V2HI") (V4SI "V4HI")])
9798 (define_mode_attr pmov_dst_zeroed_4
9799 [(V4DI "V4HI") (V2DI "V6HI") (V4SI "V4HI")])
9800 (define_mode_attr pmov_suff_4
9801 [(V4DI "qw") (V2DI "qw") (V4SI "dw")])
9803 (define_insn "*avx512vl_<code><mode>v<ssescalarnum>hi2"
9804 [(set (match_operand:V8HI 0 "register_operand" "=v")
9806 (any_truncate:<pmov_dst_4>
9807 (match_operand:PMOV_SRC_MODE_4 1 "register_operand" "v"))
9808 (match_operand:<pmov_dst_zeroed_4> 2 "const0_operand")))]
9810 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0|%0, %1}"
9811 [(set_attr "type" "ssemov")
9812 (set_attr "prefix" "evex")
9813 (set_attr "mode" "TI")])
9815 (define_insn "*avx512vl_<code><mode>v4hi2_store"
9816 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9819 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9822 (parallel [(const_int 4) (const_int 5)
9823 (const_int 6) (const_int 7)]))))]
9825 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0|%0, %1}"
9826 [(set_attr "type" "ssemov")
9827 (set_attr "memory" "store")
9828 (set_attr "prefix" "evex")
9829 (set_attr "mode" "TI")])
9831 (define_insn "avx512vl_<code><mode>v4hi2_mask"
9832 [(set (match_operand:V8HI 0 "register_operand" "=v")
9836 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9838 (match_operand:V8HI 2 "vector_move_operand" "0C")
9839 (parallel [(const_int 0) (const_int 1)
9840 (const_int 2) (const_int 3)]))
9841 (match_operand:QI 3 "register_operand" "Yk"))
9842 (const_vector:V4HI [(const_int 0) (const_int 0)
9843 (const_int 0) (const_int 0)])))]
9845 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9846 [(set_attr "type" "ssemov")
9847 (set_attr "prefix" "evex")
9848 (set_attr "mode" "TI")])
9850 (define_insn "*avx512vl_<code><mode>v4hi2_mask_1"
9851 [(set (match_operand:V8HI 0 "register_operand" "=v")
9855 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9856 (const_vector:V4HI [(const_int 0) (const_int 0)
9857 (const_int 0) (const_int 0)])
9858 (match_operand:QI 2 "register_operand" "Yk"))
9859 (const_vector:V4HI [(const_int 0) (const_int 0)
9860 (const_int 0) (const_int 0)])))]
9862 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9863 [(set_attr "type" "ssemov")
9864 (set_attr "prefix" "evex")
9865 (set_attr "mode" "TI")])
9867 (define_insn "avx512vl_<code><mode>v4hi2_mask_store"
9868 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9872 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9875 (parallel [(const_int 0) (const_int 1)
9876 (const_int 2) (const_int 3)]))
9877 (match_operand:QI 2 "register_operand" "Yk"))
9880 (parallel [(const_int 4) (const_int 5)
9881 (const_int 6) (const_int 7)]))))]
9884 if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 4)
9885 return "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%2%}|%0%{%2%}, %t1}";
9886 return "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%2%}|%0%{%2%}, %g1}";
9888 [(set_attr "type" "ssemov")
9889 (set_attr "memory" "store")
9890 (set_attr "prefix" "evex")
9891 (set_attr "mode" "TI")])
9893 (define_insn "*avx512vl_<code>v2div2hi2_store"
9894 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9897 (match_operand:V2DI 1 "register_operand" "v"))
9900 (parallel [(const_int 2) (const_int 3)
9901 (const_int 4) (const_int 5)
9902 (const_int 6) (const_int 7)]))))]
9904 "vpmov<trunsuffix>qw\t{%1, %0|%0, %1}"
9905 [(set_attr "type" "ssemov")
9906 (set_attr "memory" "store")
9907 (set_attr "prefix" "evex")
9908 (set_attr "mode" "TI")])
9910 (define_insn "avx512vl_<code>v2div2hi2_mask"
9911 [(set (match_operand:V8HI 0 "register_operand" "=v")
9915 (match_operand:V2DI 1 "register_operand" "v"))
9917 (match_operand:V8HI 2 "vector_move_operand" "0C")
9918 (parallel [(const_int 0) (const_int 1)]))
9919 (match_operand:QI 3 "register_operand" "Yk"))
9920 (const_vector:V6HI [(const_int 0) (const_int 0)
9921 (const_int 0) (const_int 0)
9922 (const_int 0) (const_int 0)])))]
9924 "vpmov<trunsuffix>qw\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9925 [(set_attr "type" "ssemov")
9926 (set_attr "prefix" "evex")
9927 (set_attr "mode" "TI")])
9929 (define_insn "*avx512vl_<code>v2div2hi2_mask_1"
9930 [(set (match_operand:V8HI 0 "register_operand" "=v")
9934 (match_operand:V2DI 1 "register_operand" "v"))
9935 (const_vector:V2HI [(const_int 0) (const_int 0)])
9936 (match_operand:QI 2 "register_operand" "Yk"))
9937 (const_vector:V6HI [(const_int 0) (const_int 0)
9938 (const_int 0) (const_int 0)
9939 (const_int 0) (const_int 0)])))]
9941 "vpmov<trunsuffix>qw\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9942 [(set_attr "type" "ssemov")
9943 (set_attr "prefix" "evex")
9944 (set_attr "mode" "TI")])
9946 (define_insn "avx512vl_<code>v2div2hi2_mask_store"
9947 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9951 (match_operand:V2DI 1 "register_operand" "v"))
9954 (parallel [(const_int 0) (const_int 1)]))
9955 (match_operand:QI 2 "register_operand" "Yk"))
9958 (parallel [(const_int 2) (const_int 3)
9959 (const_int 4) (const_int 5)
9960 (const_int 6) (const_int 7)]))))]
9962 "vpmov<trunsuffix>qw\t{%1, %0%{%2%}|%0%{%2%}, %g1}"
9963 [(set_attr "type" "ssemov")
9964 (set_attr "memory" "store")
9965 (set_attr "prefix" "evex")
9966 (set_attr "mode" "TI")])
9968 (define_insn "*avx512vl_<code>v2div2si2"
9969 [(set (match_operand:V4SI 0 "register_operand" "=v")
9972 (match_operand:V2DI 1 "register_operand" "v"))
9973 (match_operand:V2SI 2 "const0_operand")))]
9975 "vpmov<trunsuffix>qd\t{%1, %0|%0, %1}"
9976 [(set_attr "type" "ssemov")
9977 (set_attr "prefix" "evex")
9978 (set_attr "mode" "TI")])
9980 (define_insn "*avx512vl_<code>v2div2si2_store"
9981 [(set (match_operand:V4SI 0 "memory_operand" "=m")
9984 (match_operand:V2DI 1 "register_operand" "v"))
9987 (parallel [(const_int 2) (const_int 3)]))))]
9989 "vpmov<trunsuffix>qd\t{%1, %0|%0, %1}"
9990 [(set_attr "type" "ssemov")
9991 (set_attr "memory" "store")
9992 (set_attr "prefix" "evex")
9993 (set_attr "mode" "TI")])
9995 (define_insn "avx512vl_<code>v2div2si2_mask"
9996 [(set (match_operand:V4SI 0 "register_operand" "=v")
10000 (match_operand:V2DI 1 "register_operand" "v"))
10002 (match_operand:V4SI 2 "vector_move_operand" "0C")
10003 (parallel [(const_int 0) (const_int 1)]))
10004 (match_operand:QI 3 "register_operand" "Yk"))
10005 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
10007 "vpmov<trunsuffix>qd\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
10008 [(set_attr "type" "ssemov")
10009 (set_attr "prefix" "evex")
10010 (set_attr "mode" "TI")])
10012 (define_insn "*avx512vl_<code>v2div2si2_mask_1"
10013 [(set (match_operand:V4SI 0 "register_operand" "=v")
10017 (match_operand:V2DI 1 "register_operand" "v"))
10018 (const_vector:V2SI [(const_int 0) (const_int 0)])
10019 (match_operand:QI 2 "register_operand" "Yk"))
10020 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
10022 "vpmov<trunsuffix>qd\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
10023 [(set_attr "type" "ssemov")
10024 (set_attr "prefix" "evex")
10025 (set_attr "mode" "TI")])
10027 (define_insn "avx512vl_<code>v2div2si2_mask_store"
10028 [(set (match_operand:V4SI 0 "memory_operand" "=m")
10032 (match_operand:V2DI 1 "register_operand" "v"))
10035 (parallel [(const_int 0) (const_int 1)]))
10036 (match_operand:QI 2 "register_operand" "Yk"))
10039 (parallel [(const_int 2) (const_int 3)]))))]
10041 "vpmov<trunsuffix>qd\t{%1, %0%{%2%}|%0%{%2%}, %t1}"
10042 [(set_attr "type" "ssemov")
10043 (set_attr "memory" "store")
10044 (set_attr "prefix" "evex")
10045 (set_attr "mode" "TI")])
10047 (define_insn "*avx512f_<code>v8div16qi2"
10048 [(set (match_operand:V16QI 0 "register_operand" "=v")
10051 (match_operand:V8DI 1 "register_operand" "v"))
10052 (const_vector:V8QI [(const_int 0) (const_int 0)
10053 (const_int 0) (const_int 0)
10054 (const_int 0) (const_int 0)
10055 (const_int 0) (const_int 0)])))]
10057 "vpmov<trunsuffix>qb\t{%1, %0|%0, %1}"
10058 [(set_attr "type" "ssemov")
10059 (set_attr "prefix" "evex")
10060 (set_attr "mode" "TI")])
10062 (define_insn "*avx512f_<code>v8div16qi2_store"
10063 [(set (match_operand:V16QI 0 "memory_operand" "=m")
10066 (match_operand:V8DI 1 "register_operand" "v"))
10069 (parallel [(const_int 8) (const_int 9)
10070 (const_int 10) (const_int 11)
10071 (const_int 12) (const_int 13)
10072 (const_int 14) (const_int 15)]))))]
10074 "vpmov<trunsuffix>qb\t{%1, %0|%0, %1}"
10075 [(set_attr "type" "ssemov")
10076 (set_attr "memory" "store")
10077 (set_attr "prefix" "evex")
10078 (set_attr "mode" "TI")])
10080 (define_insn "avx512f_<code>v8div16qi2_mask"
10081 [(set (match_operand:V16QI 0 "register_operand" "=v")
10085 (match_operand:V8DI 1 "register_operand" "v"))
10087 (match_operand:V16QI 2 "vector_move_operand" "0C")
10088 (parallel [(const_int 0) (const_int 1)
10089 (const_int 2) (const_int 3)
10090 (const_int 4) (const_int 5)
10091 (const_int 6) (const_int 7)]))
10092 (match_operand:QI 3 "register_operand" "Yk"))
10093 (const_vector:V8QI [(const_int 0) (const_int 0)
10094 (const_int 0) (const_int 0)
10095 (const_int 0) (const_int 0)
10096 (const_int 0) (const_int 0)])))]
10098 "vpmov<trunsuffix>qb\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
10099 [(set_attr "type" "ssemov")
10100 (set_attr "prefix" "evex")
10101 (set_attr "mode" "TI")])
10103 (define_insn "*avx512f_<code>v8div16qi2_mask_1"
10104 [(set (match_operand:V16QI 0 "register_operand" "=v")
10108 (match_operand:V8DI 1 "register_operand" "v"))
10109 (const_vector:V8QI [(const_int 0) (const_int 0)
10110 (const_int 0) (const_int 0)
10111 (const_int 0) (const_int 0)
10112 (const_int 0) (const_int 0)])
10113 (match_operand:QI 2 "register_operand" "Yk"))
10114 (const_vector:V8QI [(const_int 0) (const_int 0)
10115 (const_int 0) (const_int 0)
10116 (const_int 0) (const_int 0)
10117 (const_int 0) (const_int 0)])))]
10119 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
10120 [(set_attr "type" "ssemov")
10121 (set_attr "prefix" "evex")
10122 (set_attr "mode" "TI")])
10124 (define_insn "avx512f_<code>v8div16qi2_mask_store"
10125 [(set (match_operand:V16QI 0 "memory_operand" "=m")
10129 (match_operand:V8DI 1 "register_operand" "v"))
10132 (parallel [(const_int 0) (const_int 1)
10133 (const_int 2) (const_int 3)
10134 (const_int 4) (const_int 5)
10135 (const_int 6) (const_int 7)]))
10136 (match_operand:QI 2 "register_operand" "Yk"))
10139 (parallel [(const_int 8) (const_int 9)
10140 (const_int 10) (const_int 11)
10141 (const_int 12) (const_int 13)
10142 (const_int 14) (const_int 15)]))))]
10144 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}|%q0%{%2%}, %1}"
10145 [(set_attr "type" "ssemov")
10146 (set_attr "memory" "store")
10147 (set_attr "prefix" "evex")
10148 (set_attr "mode" "TI")])
10150 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
10152 ;; Parallel integral arithmetic
10154 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
10156 (define_expand "neg<mode>2"
10157 [(set (match_operand:VI_AVX2 0 "register_operand")
10160 (match_operand:VI_AVX2 1 "vector_operand")))]
10162 "operands[2] = force_reg (<MODE>mode, CONST0_RTX (<MODE>mode));")
10164 (define_expand "<plusminus_insn><mode>3"
10165 [(set (match_operand:VI_AVX2 0 "register_operand")
10167 (match_operand:VI_AVX2 1 "vector_operand")
10168 (match_operand:VI_AVX2 2 "vector_operand")))]
10170 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
10172 (define_expand "<plusminus_insn><mode>3_mask"
10173 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
10174 (vec_merge:VI48_AVX512VL
10175 (plusminus:VI48_AVX512VL
10176 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand")
10177 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand"))
10178 (match_operand:VI48_AVX512VL 3 "vector_move_operand")
10179 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
10181 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
10183 (define_expand "<plusminus_insn><mode>3_mask"
10184 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
10185 (vec_merge:VI12_AVX512VL
10186 (plusminus:VI12_AVX512VL
10187 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand")
10188 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand"))
10189 (match_operand:VI12_AVX512VL 3 "vector_move_operand")
10190 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
10192 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
10194 (define_insn "*<plusminus_insn><mode>3"
10195 [(set (match_operand:VI_AVX2 0 "register_operand" "=x,v")
10197 (match_operand:VI_AVX2 1 "vector_operand" "<comm>0,v")
10198 (match_operand:VI_AVX2 2 "vector_operand" "xBm,vm")))]
10199 "TARGET_SSE2 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
10201 p<plusminus_mnemonic><ssemodesuffix>\t{%2, %0|%0, %2}
10202 vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
10203 [(set_attr "isa" "noavx,avx")
10204 (set_attr "type" "sseiadd")
10205 (set_attr "prefix_data16" "1,*")
10206 (set_attr "prefix" "orig,vex")
10207 (set_attr "mode" "<sseinsnmode>")])
10209 (define_insn "*<plusminus_insn><mode>3_mask"
10210 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
10211 (vec_merge:VI48_AVX512VL
10212 (plusminus:VI48_AVX512VL
10213 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "<comm>v")
10214 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm"))
10215 (match_operand:VI48_AVX512VL 3 "vector_move_operand" "0C")
10216 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
10217 "TARGET_AVX512F && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
10218 "vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
10219 [(set_attr "type" "sseiadd")
10220 (set_attr "prefix" "evex")
10221 (set_attr "mode" "<sseinsnmode>")])
10223 (define_insn "*<plusminus_insn><mode>3_mask"
10224 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
10225 (vec_merge:VI12_AVX512VL
10226 (plusminus:VI12_AVX512VL
10227 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "<comm>v")
10228 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm"))
10229 (match_operand:VI12_AVX512VL 3 "vector_move_operand" "0C")
10230 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
10231 "TARGET_AVX512BW && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
10232 "vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
10233 [(set_attr "type" "sseiadd")
10234 (set_attr "prefix" "evex")
10235 (set_attr "mode" "<sseinsnmode>")])
10237 (define_expand "<sse2_avx2>_<plusminus_insn><mode>3<mask_name>"
10238 [(set (match_operand:VI12_AVX2 0 "register_operand")
10239 (sat_plusminus:VI12_AVX2
10240 (match_operand:VI12_AVX2 1 "vector_operand")
10241 (match_operand:VI12_AVX2 2 "vector_operand")))]
10242 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10243 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
10245 (define_insn "*<sse2_avx2>_<plusminus_insn><mode>3<mask_name>"
10246 [(set (match_operand:VI12_AVX2 0 "register_operand" "=x,v")
10247 (sat_plusminus:VI12_AVX2
10248 (match_operand:VI12_AVX2 1 "vector_operand" "<comm>0,v")
10249 (match_operand:VI12_AVX2 2 "vector_operand" "xBm,vm")))]
10250 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>
10251 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
10253 p<plusminus_mnemonic><ssemodesuffix>\t{%2, %0|%0, %2}
10254 vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10255 [(set_attr "isa" "noavx,avx")
10256 (set_attr "type" "sseiadd")
10257 (set_attr "prefix_data16" "1,*")
10258 (set_attr "prefix" "orig,maybe_evex")
10259 (set_attr "mode" "TI")])
10261 (define_expand "mul<mode>3<mask_name>"
10262 [(set (match_operand:VI1_AVX512 0 "register_operand")
10263 (mult:VI1_AVX512 (match_operand:VI1_AVX512 1 "register_operand")
10264 (match_operand:VI1_AVX512 2 "register_operand")))]
10265 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10267 ix86_expand_vecop_qihi (MULT, operands[0], operands[1], operands[2]);
10271 (define_expand "mul<mode>3<mask_name>"
10272 [(set (match_operand:VI2_AVX2 0 "register_operand")
10273 (mult:VI2_AVX2 (match_operand:VI2_AVX2 1 "vector_operand")
10274 (match_operand:VI2_AVX2 2 "vector_operand")))]
10275 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10276 "ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);")
10278 (define_insn "*mul<mode>3<mask_name>"
10279 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,v")
10280 (mult:VI2_AVX2 (match_operand:VI2_AVX2 1 "vector_operand" "%0,v")
10281 (match_operand:VI2_AVX2 2 "vector_operand" "xBm,vm")))]
10282 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
10283 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10285 pmullw\t{%2, %0|%0, %2}
10286 vpmullw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10287 [(set_attr "isa" "noavx,avx")
10288 (set_attr "type" "sseimul")
10289 (set_attr "prefix_data16" "1,*")
10290 (set_attr "prefix" "orig,vex")
10291 (set_attr "mode" "<sseinsnmode>")])
10293 (define_expand "<s>mul<mode>3_highpart<mask_name>"
10294 [(set (match_operand:VI2_AVX2 0 "register_operand")
10296 (lshiftrt:<ssedoublemode>
10297 (mult:<ssedoublemode>
10298 (any_extend:<ssedoublemode>
10299 (match_operand:VI2_AVX2 1 "vector_operand"))
10300 (any_extend:<ssedoublemode>
10301 (match_operand:VI2_AVX2 2 "vector_operand")))
10304 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10305 "ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);")
10307 (define_insn "*<s>mul<mode>3_highpart<mask_name>"
10308 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,v")
10310 (lshiftrt:<ssedoublemode>
10311 (mult:<ssedoublemode>
10312 (any_extend:<ssedoublemode>
10313 (match_operand:VI2_AVX2 1 "vector_operand" "%0,v"))
10314 (any_extend:<ssedoublemode>
10315 (match_operand:VI2_AVX2 2 "vector_operand" "xBm,vm")))
10317 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
10318 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10320 pmulh<u>w\t{%2, %0|%0, %2}
10321 vpmulh<u>w\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10322 [(set_attr "isa" "noavx,avx")
10323 (set_attr "type" "sseimul")
10324 (set_attr "prefix_data16" "1,*")
10325 (set_attr "prefix" "orig,vex")
10326 (set_attr "mode" "<sseinsnmode>")])
10328 (define_expand "vec_widen_umult_even_v16si<mask_name>"
10329 [(set (match_operand:V8DI 0 "register_operand")
10333 (match_operand:V16SI 1 "nonimmediate_operand")
10334 (parallel [(const_int 0) (const_int 2)
10335 (const_int 4) (const_int 6)
10336 (const_int 8) (const_int 10)
10337 (const_int 12) (const_int 14)])))
10340 (match_operand:V16SI 2 "nonimmediate_operand")
10341 (parallel [(const_int 0) (const_int 2)
10342 (const_int 4) (const_int 6)
10343 (const_int 8) (const_int 10)
10344 (const_int 12) (const_int 14)])))))]
10346 "ix86_fixup_binary_operands_no_copy (MULT, V16SImode, operands);")
10348 (define_insn "*vec_widen_umult_even_v16si<mask_name>"
10349 [(set (match_operand:V8DI 0 "register_operand" "=v")
10353 (match_operand:V16SI 1 "nonimmediate_operand" "%v")
10354 (parallel [(const_int 0) (const_int 2)
10355 (const_int 4) (const_int 6)
10356 (const_int 8) (const_int 10)
10357 (const_int 12) (const_int 14)])))
10360 (match_operand:V16SI 2 "nonimmediate_operand" "vm")
10361 (parallel [(const_int 0) (const_int 2)
10362 (const_int 4) (const_int 6)
10363 (const_int 8) (const_int 10)
10364 (const_int 12) (const_int 14)])))))]
10365 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10366 "vpmuludq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10367 [(set_attr "type" "sseimul")
10368 (set_attr "prefix_extra" "1")
10369 (set_attr "prefix" "evex")
10370 (set_attr "mode" "XI")])
10372 (define_expand "vec_widen_umult_even_v8si<mask_name>"
10373 [(set (match_operand:V4DI 0 "register_operand")
10377 (match_operand:V8SI 1 "nonimmediate_operand")
10378 (parallel [(const_int 0) (const_int 2)
10379 (const_int 4) (const_int 6)])))
10382 (match_operand:V8SI 2 "nonimmediate_operand")
10383 (parallel [(const_int 0) (const_int 2)
10384 (const_int 4) (const_int 6)])))))]
10385 "TARGET_AVX2 && <mask_avx512vl_condition>"
10386 "ix86_fixup_binary_operands_no_copy (MULT, V8SImode, operands);")
10388 (define_insn "*vec_widen_umult_even_v8si<mask_name>"
10389 [(set (match_operand:V4DI 0 "register_operand" "=v")
10393 (match_operand:V8SI 1 "nonimmediate_operand" "%v")
10394 (parallel [(const_int 0) (const_int 2)
10395 (const_int 4) (const_int 6)])))
10398 (match_operand:V8SI 2 "nonimmediate_operand" "vm")
10399 (parallel [(const_int 0) (const_int 2)
10400 (const_int 4) (const_int 6)])))))]
10401 "TARGET_AVX2 && <mask_avx512vl_condition>
10402 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10403 "vpmuludq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10404 [(set_attr "type" "sseimul")
10405 (set_attr "prefix" "maybe_evex")
10406 (set_attr "mode" "OI")])
10408 (define_expand "vec_widen_umult_even_v4si<mask_name>"
10409 [(set (match_operand:V2DI 0 "register_operand")
10413 (match_operand:V4SI 1 "vector_operand")
10414 (parallel [(const_int 0) (const_int 2)])))
10417 (match_operand:V4SI 2 "vector_operand")
10418 (parallel [(const_int 0) (const_int 2)])))))]
10419 "TARGET_SSE2 && <mask_avx512vl_condition>"
10420 "ix86_fixup_binary_operands_no_copy (MULT, V4SImode, operands);")
10422 (define_insn "*vec_widen_umult_even_v4si<mask_name>"
10423 [(set (match_operand:V2DI 0 "register_operand" "=x,v")
10427 (match_operand:V4SI 1 "vector_operand" "%0,v")
10428 (parallel [(const_int 0) (const_int 2)])))
10431 (match_operand:V4SI 2 "vector_operand" "xBm,vm")
10432 (parallel [(const_int 0) (const_int 2)])))))]
10433 "TARGET_SSE2 && <mask_avx512vl_condition>
10434 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10436 pmuludq\t{%2, %0|%0, %2}
10437 vpmuludq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10438 [(set_attr "isa" "noavx,avx")
10439 (set_attr "type" "sseimul")
10440 (set_attr "prefix_data16" "1,*")
10441 (set_attr "prefix" "orig,maybe_evex")
10442 (set_attr "mode" "TI")])
10444 (define_expand "vec_widen_smult_even_v16si<mask_name>"
10445 [(set (match_operand:V8DI 0 "register_operand")
10449 (match_operand:V16SI 1 "nonimmediate_operand")
10450 (parallel [(const_int 0) (const_int 2)
10451 (const_int 4) (const_int 6)
10452 (const_int 8) (const_int 10)
10453 (const_int 12) (const_int 14)])))
10456 (match_operand:V16SI 2 "nonimmediate_operand")
10457 (parallel [(const_int 0) (const_int 2)
10458 (const_int 4) (const_int 6)
10459 (const_int 8) (const_int 10)
10460 (const_int 12) (const_int 14)])))))]
10462 "ix86_fixup_binary_operands_no_copy (MULT, V16SImode, operands);")
10464 (define_insn "*vec_widen_smult_even_v16si<mask_name>"
10465 [(set (match_operand:V8DI 0 "register_operand" "=v")
10469 (match_operand:V16SI 1 "nonimmediate_operand" "%v")
10470 (parallel [(const_int 0) (const_int 2)
10471 (const_int 4) (const_int 6)
10472 (const_int 8) (const_int 10)
10473 (const_int 12) (const_int 14)])))
10476 (match_operand:V16SI 2 "nonimmediate_operand" "vm")
10477 (parallel [(const_int 0) (const_int 2)
10478 (const_int 4) (const_int 6)
10479 (const_int 8) (const_int 10)
10480 (const_int 12) (const_int 14)])))))]
10481 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10482 "vpmuldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10483 [(set_attr "type" "sseimul")
10484 (set_attr "prefix_extra" "1")
10485 (set_attr "prefix" "evex")
10486 (set_attr "mode" "XI")])
10488 (define_expand "vec_widen_smult_even_v8si<mask_name>"
10489 [(set (match_operand:V4DI 0 "register_operand")
10493 (match_operand:V8SI 1 "nonimmediate_operand")
10494 (parallel [(const_int 0) (const_int 2)
10495 (const_int 4) (const_int 6)])))
10498 (match_operand:V8SI 2 "nonimmediate_operand")
10499 (parallel [(const_int 0) (const_int 2)
10500 (const_int 4) (const_int 6)])))))]
10501 "TARGET_AVX2 && <mask_avx512vl_condition>"
10502 "ix86_fixup_binary_operands_no_copy (MULT, V8SImode, operands);")
10504 (define_insn "*vec_widen_smult_even_v8si<mask_name>"
10505 [(set (match_operand:V4DI 0 "register_operand" "=v")
10509 (match_operand:V8SI 1 "nonimmediate_operand" "%v")
10510 (parallel [(const_int 0) (const_int 2)
10511 (const_int 4) (const_int 6)])))
10514 (match_operand:V8SI 2 "nonimmediate_operand" "vm")
10515 (parallel [(const_int 0) (const_int 2)
10516 (const_int 4) (const_int 6)])))))]
10517 "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10518 "vpmuldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10519 [(set_attr "type" "sseimul")
10520 (set_attr "prefix_extra" "1")
10521 (set_attr "prefix" "vex")
10522 (set_attr "mode" "OI")])
10524 (define_expand "sse4_1_mulv2siv2di3<mask_name>"
10525 [(set (match_operand:V2DI 0 "register_operand")
10529 (match_operand:V4SI 1 "vector_operand")
10530 (parallel [(const_int 0) (const_int 2)])))
10533 (match_operand:V4SI 2 "vector_operand")
10534 (parallel [(const_int 0) (const_int 2)])))))]
10535 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
10536 "ix86_fixup_binary_operands_no_copy (MULT, V4SImode, operands);")
10538 (define_insn "*sse4_1_mulv2siv2di3<mask_name>"
10539 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
10543 (match_operand:V4SI 1 "vector_operand" "%0,0,v")
10544 (parallel [(const_int 0) (const_int 2)])))
10547 (match_operand:V4SI 2 "vector_operand" "YrBm,*xBm,vm")
10548 (parallel [(const_int 0) (const_int 2)])))))]
10549 "TARGET_SSE4_1 && <mask_avx512vl_condition>
10550 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10552 pmuldq\t{%2, %0|%0, %2}
10553 pmuldq\t{%2, %0|%0, %2}
10554 vpmuldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10555 [(set_attr "isa" "noavx,noavx,avx")
10556 (set_attr "type" "sseimul")
10557 (set_attr "prefix_data16" "1,1,*")
10558 (set_attr "prefix_extra" "1")
10559 (set_attr "prefix" "orig,orig,vex")
10560 (set_attr "mode" "TI")])
10562 (define_insn "avx512bw_pmaddwd512<mode><mask_name>"
10563 [(set (match_operand:<sseunpackmode> 0 "register_operand" "=v")
10564 (unspec:<sseunpackmode>
10565 [(match_operand:VI2_AVX2 1 "register_operand" "v")
10566 (match_operand:VI2_AVX2 2 "nonimmediate_operand" "vm")]
10567 UNSPEC_PMADDWD512))]
10568 "TARGET_AVX512BW && <mask_mode512bit_condition>"
10569 "vpmaddwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}";
10570 [(set_attr "type" "sseiadd")
10571 (set_attr "prefix" "evex")
10572 (set_attr "mode" "XI")])
10574 (define_expand "avx2_pmaddwd"
10575 [(set (match_operand:V8SI 0 "register_operand")
10580 (match_operand:V16HI 1 "nonimmediate_operand")
10581 (parallel [(const_int 0) (const_int 2)
10582 (const_int 4) (const_int 6)
10583 (const_int 8) (const_int 10)
10584 (const_int 12) (const_int 14)])))
10587 (match_operand:V16HI 2 "nonimmediate_operand")
10588 (parallel [(const_int 0) (const_int 2)
10589 (const_int 4) (const_int 6)
10590 (const_int 8) (const_int 10)
10591 (const_int 12) (const_int 14)]))))
10594 (vec_select:V8HI (match_dup 1)
10595 (parallel [(const_int 1) (const_int 3)
10596 (const_int 5) (const_int 7)
10597 (const_int 9) (const_int 11)
10598 (const_int 13) (const_int 15)])))
10600 (vec_select:V8HI (match_dup 2)
10601 (parallel [(const_int 1) (const_int 3)
10602 (const_int 5) (const_int 7)
10603 (const_int 9) (const_int 11)
10604 (const_int 13) (const_int 15)]))))))]
10606 "ix86_fixup_binary_operands_no_copy (MULT, V16HImode, operands);")
10608 (define_insn "*avx2_pmaddwd"
10609 [(set (match_operand:V8SI 0 "register_operand" "=x,v")
10614 (match_operand:V16HI 1 "nonimmediate_operand" "%x,v")
10615 (parallel [(const_int 0) (const_int 2)
10616 (const_int 4) (const_int 6)
10617 (const_int 8) (const_int 10)
10618 (const_int 12) (const_int 14)])))
10621 (match_operand:V16HI 2 "nonimmediate_operand" "xm,vm")
10622 (parallel [(const_int 0) (const_int 2)
10623 (const_int 4) (const_int 6)
10624 (const_int 8) (const_int 10)
10625 (const_int 12) (const_int 14)]))))
10628 (vec_select:V8HI (match_dup 1)
10629 (parallel [(const_int 1) (const_int 3)
10630 (const_int 5) (const_int 7)
10631 (const_int 9) (const_int 11)
10632 (const_int 13) (const_int 15)])))
10634 (vec_select:V8HI (match_dup 2)
10635 (parallel [(const_int 1) (const_int 3)
10636 (const_int 5) (const_int 7)
10637 (const_int 9) (const_int 11)
10638 (const_int 13) (const_int 15)]))))))]
10639 "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10640 "vpmaddwd\t{%2, %1, %0|%0, %1, %2}"
10641 [(set_attr "type" "sseiadd")
10642 (set_attr "isa" "*,avx512bw")
10643 (set_attr "prefix" "vex,evex")
10644 (set_attr "mode" "OI")])
10646 (define_expand "sse2_pmaddwd"
10647 [(set (match_operand:V4SI 0 "register_operand")
10652 (match_operand:V8HI 1 "vector_operand")
10653 (parallel [(const_int 0) (const_int 2)
10654 (const_int 4) (const_int 6)])))
10657 (match_operand:V8HI 2 "vector_operand")
10658 (parallel [(const_int 0) (const_int 2)
10659 (const_int 4) (const_int 6)]))))
10662 (vec_select:V4HI (match_dup 1)
10663 (parallel [(const_int 1) (const_int 3)
10664 (const_int 5) (const_int 7)])))
10666 (vec_select:V4HI (match_dup 2)
10667 (parallel [(const_int 1) (const_int 3)
10668 (const_int 5) (const_int 7)]))))))]
10670 "ix86_fixup_binary_operands_no_copy (MULT, V8HImode, operands);")
10672 (define_insn "*sse2_pmaddwd"
10673 [(set (match_operand:V4SI 0 "register_operand" "=x,x,v")
10678 (match_operand:V8HI 1 "vector_operand" "%0,x,v")
10679 (parallel [(const_int 0) (const_int 2)
10680 (const_int 4) (const_int 6)])))
10683 (match_operand:V8HI 2 "vector_operand" "xBm,xm,vm")
10684 (parallel [(const_int 0) (const_int 2)
10685 (const_int 4) (const_int 6)]))))
10688 (vec_select:V4HI (match_dup 1)
10689 (parallel [(const_int 1) (const_int 3)
10690 (const_int 5) (const_int 7)])))
10692 (vec_select:V4HI (match_dup 2)
10693 (parallel [(const_int 1) (const_int 3)
10694 (const_int 5) (const_int 7)]))))))]
10695 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10697 pmaddwd\t{%2, %0|%0, %2}
10698 vpmaddwd\t{%2, %1, %0|%0, %1, %2}
10699 vpmaddwd\t{%2, %1, %0|%0, %1, %2}"
10700 [(set_attr "isa" "noavx,avx,avx512bw")
10701 (set_attr "type" "sseiadd")
10702 (set_attr "atom_unit" "simul")
10703 (set_attr "prefix_data16" "1,*,*")
10704 (set_attr "prefix" "orig,vex,evex")
10705 (set_attr "mode" "TI")])
10707 (define_insn "avx512dq_mul<mode>3<mask_name>"
10708 [(set (match_operand:VI8 0 "register_operand" "=v")
10710 (match_operand:VI8 1 "register_operand" "v")
10711 (match_operand:VI8 2 "nonimmediate_operand" "vm")))]
10712 "TARGET_AVX512DQ && <mask_mode512bit_condition>"
10713 "vpmullq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10714 [(set_attr "type" "sseimul")
10715 (set_attr "prefix" "evex")
10716 (set_attr "mode" "<sseinsnmode>")])
10718 (define_expand "mul<mode>3<mask_name>"
10719 [(set (match_operand:VI4_AVX512F 0 "register_operand")
10721 (match_operand:VI4_AVX512F 1 "general_vector_operand")
10722 (match_operand:VI4_AVX512F 2 "general_vector_operand")))]
10723 "TARGET_SSE2 && <mask_mode512bit_condition>"
10727 if (!vector_operand (operands[1], <MODE>mode))
10728 operands[1] = force_reg (<MODE>mode, operands[1]);
10729 if (!vector_operand (operands[2], <MODE>mode))
10730 operands[2] = force_reg (<MODE>mode, operands[2]);
10731 ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);
10735 ix86_expand_sse2_mulv4si3 (operands[0], operands[1], operands[2]);
10740 (define_insn "*<sse4_1_avx2>_mul<mode>3<mask_name>"
10741 [(set (match_operand:VI4_AVX512F 0 "register_operand" "=Yr,*x,v")
10743 (match_operand:VI4_AVX512F 1 "vector_operand" "%0,0,v")
10744 (match_operand:VI4_AVX512F 2 "vector_operand" "YrBm,*xBm,vm")))]
10745 "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
10746 && <mask_mode512bit_condition>"
10748 pmulld\t{%2, %0|%0, %2}
10749 pmulld\t{%2, %0|%0, %2}
10750 vpmulld\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10751 [(set_attr "isa" "noavx,noavx,avx")
10752 (set_attr "type" "sseimul")
10753 (set_attr "prefix_extra" "1")
10754 (set_attr "prefix" "<mask_prefix4>")
10755 (set_attr "btver2_decode" "vector,vector,vector")
10756 (set_attr "mode" "<sseinsnmode>")])
10758 (define_expand "mul<mode>3"
10759 [(set (match_operand:VI8_AVX2_AVX512F 0 "register_operand")
10760 (mult:VI8_AVX2_AVX512F
10761 (match_operand:VI8_AVX2_AVX512F 1 "register_operand")
10762 (match_operand:VI8_AVX2_AVX512F 2 "register_operand")))]
10765 ix86_expand_sse2_mulvxdi3 (operands[0], operands[1], operands[2]);
10769 (define_expand "vec_widen_<s>mult_hi_<mode>"
10770 [(match_operand:<sseunpackmode> 0 "register_operand")
10771 (any_extend:<sseunpackmode>
10772 (match_operand:VI124_AVX2 1 "register_operand"))
10773 (match_operand:VI124_AVX2 2 "register_operand")]
10776 ix86_expand_mul_widen_hilo (operands[0], operands[1], operands[2],
10781 (define_expand "vec_widen_<s>mult_lo_<mode>"
10782 [(match_operand:<sseunpackmode> 0 "register_operand")
10783 (any_extend:<sseunpackmode>
10784 (match_operand:VI124_AVX2 1 "register_operand"))
10785 (match_operand:VI124_AVX2 2 "register_operand")]
10788 ix86_expand_mul_widen_hilo (operands[0], operands[1], operands[2],
10793 ;; Most widen_<s>mult_even_<mode> can be handled directly from other
10794 ;; named patterns, but signed V4SI needs special help for plain SSE2.
10795 (define_expand "vec_widen_smult_even_v4si"
10796 [(match_operand:V2DI 0 "register_operand")
10797 (match_operand:V4SI 1 "vector_operand")
10798 (match_operand:V4SI 2 "vector_operand")]
10801 ix86_expand_mul_widen_evenodd (operands[0], operands[1], operands[2],
10806 (define_expand "vec_widen_<s>mult_odd_<mode>"
10807 [(match_operand:<sseunpackmode> 0 "register_operand")
10808 (any_extend:<sseunpackmode>
10809 (match_operand:VI4_AVX512F 1 "general_vector_operand"))
10810 (match_operand:VI4_AVX512F 2 "general_vector_operand")]
10813 ix86_expand_mul_widen_evenodd (operands[0], operands[1], operands[2],
10818 (define_mode_attr SDOT_PMADD_SUF
10819 [(V32HI "512v32hi") (V16HI "") (V8HI "")])
10821 (define_expand "sdot_prod<mode>"
10822 [(match_operand:<sseunpackmode> 0 "register_operand")
10823 (match_operand:VI2_AVX2 1 "register_operand")
10824 (match_operand:VI2_AVX2 2 "register_operand")
10825 (match_operand:<sseunpackmode> 3 "register_operand")]
10828 rtx t = gen_reg_rtx (<sseunpackmode>mode);
10829 emit_insn (gen_<sse2_avx2>_pmaddwd<SDOT_PMADD_SUF> (t, operands[1], operands[2]));
10830 emit_insn (gen_rtx_SET (operands[0],
10831 gen_rtx_PLUS (<sseunpackmode>mode,
10836 ;; Normally we use widen_mul_even/odd, but combine can't quite get it all
10837 ;; back together when madd is available.
10838 (define_expand "sdot_prodv4si"
10839 [(match_operand:V2DI 0 "register_operand")
10840 (match_operand:V4SI 1 "register_operand")
10841 (match_operand:V4SI 2 "register_operand")
10842 (match_operand:V2DI 3 "register_operand")]
10845 rtx t = gen_reg_rtx (V2DImode);
10846 emit_insn (gen_xop_pmacsdqh (t, operands[1], operands[2], operands[3]));
10847 emit_insn (gen_xop_pmacsdql (operands[0], operands[1], operands[2], t));
10851 (define_expand "usadv16qi"
10852 [(match_operand:V4SI 0 "register_operand")
10853 (match_operand:V16QI 1 "register_operand")
10854 (match_operand:V16QI 2 "vector_operand")
10855 (match_operand:V4SI 3 "vector_operand")]
10858 rtx t1 = gen_reg_rtx (V2DImode);
10859 rtx t2 = gen_reg_rtx (V4SImode);
10860 emit_insn (gen_sse2_psadbw (t1, operands[1], operands[2]));
10861 convert_move (t2, t1, 0);
10862 emit_insn (gen_addv4si3 (operands[0], t2, operands[3]));
10866 (define_expand "usadv32qi"
10867 [(match_operand:V8SI 0 "register_operand")
10868 (match_operand:V32QI 1 "register_operand")
10869 (match_operand:V32QI 2 "nonimmediate_operand")
10870 (match_operand:V8SI 3 "nonimmediate_operand")]
10873 rtx t1 = gen_reg_rtx (V4DImode);
10874 rtx t2 = gen_reg_rtx (V8SImode);
10875 emit_insn (gen_avx2_psadbw (t1, operands[1], operands[2]));
10876 convert_move (t2, t1, 0);
10877 emit_insn (gen_addv8si3 (operands[0], t2, operands[3]));
10881 (define_expand "usadv64qi"
10882 [(match_operand:V16SI 0 "register_operand")
10883 (match_operand:V64QI 1 "register_operand")
10884 (match_operand:V64QI 2 "nonimmediate_operand")
10885 (match_operand:V16SI 3 "nonimmediate_operand")]
10888 rtx t1 = gen_reg_rtx (V8DImode);
10889 rtx t2 = gen_reg_rtx (V16SImode);
10890 emit_insn (gen_avx512f_psadbw (t1, operands[1], operands[2]));
10891 convert_move (t2, t1, 0);
10892 emit_insn (gen_addv16si3 (operands[0], t2, operands[3]));
10896 (define_insn "<mask_codefor>ashr<mode>3<mask_name>"
10897 [(set (match_operand:VI248_AVX512BW_1 0 "register_operand" "=v,v")
10898 (ashiftrt:VI248_AVX512BW_1
10899 (match_operand:VI248_AVX512BW_1 1 "nonimmediate_operand" "v,vm")
10900 (match_operand:DI 2 "nonmemory_operand" "v,N")))]
10902 "vpsra<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10903 [(set_attr "type" "sseishft")
10904 (set (attr "length_immediate")
10905 (if_then_else (match_operand 2 "const_int_operand")
10907 (const_string "0")))
10908 (set_attr "mode" "<sseinsnmode>")])
10910 (define_insn "ashr<mode>3"
10911 [(set (match_operand:VI24_AVX2 0 "register_operand" "=x,x")
10912 (ashiftrt:VI24_AVX2
10913 (match_operand:VI24_AVX2 1 "register_operand" "0,x")
10914 (match_operand:DI 2 "nonmemory_operand" "xN,xN")))]
10917 psra<ssemodesuffix>\t{%2, %0|%0, %2}
10918 vpsra<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
10919 [(set_attr "isa" "noavx,avx")
10920 (set_attr "type" "sseishft")
10921 (set (attr "length_immediate")
10922 (if_then_else (match_operand 2 "const_int_operand")
10924 (const_string "0")))
10925 (set_attr "prefix_data16" "1,*")
10926 (set_attr "prefix" "orig,vex")
10927 (set_attr "mode" "<sseinsnmode>")])
10929 (define_insn "ashr<mode>3<mask_name>"
10930 [(set (match_operand:VI248_AVX512BW_AVX512VL 0 "register_operand" "=v,v")
10931 (ashiftrt:VI248_AVX512BW_AVX512VL
10932 (match_operand:VI248_AVX512BW_AVX512VL 1 "nonimmediate_operand" "v,vm")
10933 (match_operand:DI 2 "nonmemory_operand" "v,N")))]
10935 "vpsra<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10936 [(set_attr "type" "sseishft")
10937 (set (attr "length_immediate")
10938 (if_then_else (match_operand 2 "const_int_operand")
10940 (const_string "0")))
10941 (set_attr "mode" "<sseinsnmode>")])
10943 (define_insn "<mask_codefor><shift_insn><mode>3<mask_name>"
10944 [(set (match_operand:VI248_AVX512BW_2 0 "register_operand" "=v,v")
10945 (any_lshift:VI248_AVX512BW_2
10946 (match_operand:VI248_AVX512BW_2 1 "nonimmediate_operand" "v,vm")
10947 (match_operand:DI 2 "nonmemory_operand" "v,N")))]
10949 "vp<vshift><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10950 [(set_attr "type" "sseishft")
10951 (set (attr "length_immediate")
10952 (if_then_else (match_operand 2 "const_int_operand")
10954 (const_string "0")))
10955 (set_attr "mode" "<sseinsnmode>")])
10957 (define_insn "<shift_insn><mode>3"
10958 [(set (match_operand:VI248_AVX2 0 "register_operand" "=x,x")
10959 (any_lshift:VI248_AVX2
10960 (match_operand:VI248_AVX2 1 "register_operand" "0,x")
10961 (match_operand:DI 2 "nonmemory_operand" "xN,xN")))]
10964 p<vshift><ssemodesuffix>\t{%2, %0|%0, %2}
10965 vp<vshift><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
10966 [(set_attr "isa" "noavx,avx")
10967 (set_attr "type" "sseishft")
10968 (set (attr "length_immediate")
10969 (if_then_else (match_operand 2 "const_int_operand")
10971 (const_string "0")))
10972 (set_attr "prefix_data16" "1,*")
10973 (set_attr "prefix" "orig,vex")
10974 (set_attr "mode" "<sseinsnmode>")])
10976 (define_insn "<shift_insn><mode>3<mask_name>"
10977 [(set (match_operand:VI248_AVX512BW 0 "register_operand" "=v,v")
10978 (any_lshift:VI248_AVX512BW
10979 (match_operand:VI248_AVX512BW 1 "nonimmediate_operand" "v,m")
10980 (match_operand:DI 2 "nonmemory_operand" "vN,N")))]
10982 "vp<vshift><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10983 [(set_attr "type" "sseishft")
10984 (set (attr "length_immediate")
10985 (if_then_else (match_operand 2 "const_int_operand")
10987 (const_string "0")))
10988 (set_attr "mode" "<sseinsnmode>")])
10991 (define_expand "vec_shr_<mode>"
10992 [(set (match_dup 3)
10994 (match_operand:VI_128 1 "register_operand")
10995 (match_operand:SI 2 "const_0_to_255_mul_8_operand")))
10996 (set (match_operand:VI_128 0 "register_operand") (match_dup 4))]
10999 operands[1] = gen_lowpart (V1TImode, operands[1]);
11000 operands[3] = gen_reg_rtx (V1TImode);
11001 operands[4] = gen_lowpart (<MODE>mode, operands[3]);
11004 (define_insn "avx512bw_<shift_insn><mode>3"
11005 [(set (match_operand:VIMAX_AVX512VL 0 "register_operand" "=v")
11006 (any_lshift:VIMAX_AVX512VL
11007 (match_operand:VIMAX_AVX512VL 1 "nonimmediate_operand" "vm")
11008 (match_operand:SI 2 "const_0_to_255_mul_8_operand" "n")))]
11011 operands[2] = GEN_INT (INTVAL (operands[2]) / 8);
11012 return "vp<vshift>dq\t{%2, %1, %0|%0, %1, %2}";
11014 [(set_attr "type" "sseishft")
11015 (set_attr "length_immediate" "1")
11016 (set_attr "prefix" "maybe_evex")
11017 (set_attr "mode" "<sseinsnmode>")])
11019 (define_insn "<sse2_avx2>_<shift_insn><mode>3"
11020 [(set (match_operand:VIMAX_AVX2 0 "register_operand" "=x,v")
11021 (any_lshift:VIMAX_AVX2
11022 (match_operand:VIMAX_AVX2 1 "register_operand" "0,v")
11023 (match_operand:SI 2 "const_0_to_255_mul_8_operand" "n,n")))]
11026 operands[2] = GEN_INT (INTVAL (operands[2]) / 8);
11028 switch (which_alternative)
11031 return "p<vshift>dq\t{%2, %0|%0, %2}";
11033 return "vp<vshift>dq\t{%2, %1, %0|%0, %1, %2}";
11035 gcc_unreachable ();
11038 [(set_attr "isa" "noavx,avx")
11039 (set_attr "type" "sseishft")
11040 (set_attr "length_immediate" "1")
11041 (set_attr "atom_unit" "sishuf")
11042 (set_attr "prefix_data16" "1,*")
11043 (set_attr "prefix" "orig,vex")
11044 (set_attr "mode" "<sseinsnmode>")])
11046 (define_insn "<avx512>_<rotate>v<mode><mask_name>"
11047 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
11048 (any_rotate:VI48_AVX512VL
11049 (match_operand:VI48_AVX512VL 1 "register_operand" "v")
11050 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")))]
11052 "vp<rotate>v<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11053 [(set_attr "prefix" "evex")
11054 (set_attr "mode" "<sseinsnmode>")])
11056 (define_insn "<avx512>_<rotate><mode><mask_name>"
11057 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
11058 (any_rotate:VI48_AVX512VL
11059 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm")
11060 (match_operand:SI 2 "const_0_to_255_operand")))]
11062 "vp<rotate><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11063 [(set_attr "prefix" "evex")
11064 (set_attr "mode" "<sseinsnmode>")])
11066 (define_expand "<code><mode>3"
11067 [(set (match_operand:VI124_256_AVX512F_AVX512BW 0 "register_operand")
11068 (maxmin:VI124_256_AVX512F_AVX512BW
11069 (match_operand:VI124_256_AVX512F_AVX512BW 1 "nonimmediate_operand")
11070 (match_operand:VI124_256_AVX512F_AVX512BW 2 "nonimmediate_operand")))]
11072 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
11074 (define_insn "*avx2_<code><mode>3"
11075 [(set (match_operand:VI124_256 0 "register_operand" "=v")
11077 (match_operand:VI124_256 1 "nonimmediate_operand" "%v")
11078 (match_operand:VI124_256 2 "nonimmediate_operand" "vm")))]
11079 "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11080 "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11081 [(set_attr "type" "sseiadd")
11082 (set_attr "prefix_extra" "1")
11083 (set_attr "prefix" "vex")
11084 (set_attr "mode" "OI")])
11086 (define_expand "<code><mode>3_mask"
11087 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
11088 (vec_merge:VI48_AVX512VL
11089 (maxmin:VI48_AVX512VL
11090 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand")
11091 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand"))
11092 (match_operand:VI48_AVX512VL 3 "vector_move_operand")
11093 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
11095 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
11097 (define_insn "*avx512f_<code><mode>3<mask_name>"
11098 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
11099 (maxmin:VI48_AVX512VL
11100 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "%v")
11101 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")))]
11102 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11103 "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11104 [(set_attr "type" "sseiadd")
11105 (set_attr "prefix_extra" "1")
11106 (set_attr "prefix" "maybe_evex")
11107 (set_attr "mode" "<sseinsnmode>")])
11109 (define_insn "<mask_codefor><code><mode>3<mask_name>"
11110 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
11111 (maxmin:VI12_AVX512VL
11112 (match_operand:VI12_AVX512VL 1 "register_operand" "v")
11113 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")))]
11115 "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11116 [(set_attr "type" "sseiadd")
11117 (set_attr "prefix" "evex")
11118 (set_attr "mode" "<sseinsnmode>")])
11120 (define_expand "<code><mode>3"
11121 [(set (match_operand:VI8_AVX2_AVX512F 0 "register_operand")
11122 (maxmin:VI8_AVX2_AVX512F
11123 (match_operand:VI8_AVX2_AVX512F 1 "register_operand")
11124 (match_operand:VI8_AVX2_AVX512F 2 "register_operand")))]
11128 && (<MODE>mode == V8DImode || TARGET_AVX512VL))
11129 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
11132 enum rtx_code code;
11137 xops[0] = operands[0];
11139 if (<CODE> == SMAX || <CODE> == UMAX)
11141 xops[1] = operands[1];
11142 xops[2] = operands[2];
11146 xops[1] = operands[2];
11147 xops[2] = operands[1];
11150 code = (<CODE> == UMAX || <CODE> == UMIN) ? GTU : GT;
11152 xops[3] = gen_rtx_fmt_ee (code, VOIDmode, operands[1], operands[2]);
11153 xops[4] = operands[1];
11154 xops[5] = operands[2];
11156 ok = ix86_expand_int_vcond (xops);
11162 (define_expand "<code><mode>3"
11163 [(set (match_operand:VI124_128 0 "register_operand")
11165 (match_operand:VI124_128 1 "vector_operand")
11166 (match_operand:VI124_128 2 "vector_operand")))]
11169 if (TARGET_SSE4_1 || <MODE>mode == V8HImode)
11170 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
11176 xops[0] = operands[0];
11177 operands[1] = force_reg (<MODE>mode, operands[1]);
11178 operands[2] = force_reg (<MODE>mode, operands[2]);
11180 if (<CODE> == SMAX)
11182 xops[1] = operands[1];
11183 xops[2] = operands[2];
11187 xops[1] = operands[2];
11188 xops[2] = operands[1];
11191 xops[3] = gen_rtx_GT (VOIDmode, operands[1], operands[2]);
11192 xops[4] = operands[1];
11193 xops[5] = operands[2];
11195 ok = ix86_expand_int_vcond (xops);
11201 (define_insn "*sse4_1_<code><mode>3<mask_name>"
11202 [(set (match_operand:VI14_128 0 "register_operand" "=Yr,*x,v")
11204 (match_operand:VI14_128 1 "vector_operand" "%0,0,v")
11205 (match_operand:VI14_128 2 "vector_operand" "YrBm,*xBm,vm")))]
11207 && <mask_mode512bit_condition>
11208 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11210 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
11211 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
11212 vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11213 [(set_attr "isa" "noavx,noavx,avx")
11214 (set_attr "type" "sseiadd")
11215 (set_attr "prefix_extra" "1,1,*")
11216 (set_attr "prefix" "orig,orig,vex")
11217 (set_attr "mode" "TI")])
11219 (define_insn "*<code>v8hi3"
11220 [(set (match_operand:V8HI 0 "register_operand" "=x,x,v")
11222 (match_operand:V8HI 1 "vector_operand" "%0,x,v")
11223 (match_operand:V8HI 2 "vector_operand" "xBm,xm,vm")))]
11224 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11226 p<maxmin_int>w\t{%2, %0|%0, %2}
11227 vp<maxmin_int>w\t{%2, %1, %0|%0, %1, %2}
11228 vp<maxmin_int>w\t{%2, %1, %0|%0, %1, %2}"
11229 [(set_attr "isa" "noavx,avx,avx512bw")
11230 (set_attr "type" "sseiadd")
11231 (set_attr "prefix_data16" "1,*,*")
11232 (set_attr "prefix_extra" "*,1,1")
11233 (set_attr "prefix" "orig,vex,evex")
11234 (set_attr "mode" "TI")])
11236 (define_expand "<code><mode>3"
11237 [(set (match_operand:VI124_128 0 "register_operand")
11239 (match_operand:VI124_128 1 "vector_operand")
11240 (match_operand:VI124_128 2 "vector_operand")))]
11243 if (TARGET_SSE4_1 || <MODE>mode == V16QImode)
11244 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
11245 else if (<CODE> == UMAX && <MODE>mode == V8HImode)
11247 rtx op0 = operands[0], op2 = operands[2], op3 = op0;
11248 operands[1] = force_reg (<MODE>mode, operands[1]);
11249 if (rtx_equal_p (op3, op2))
11250 op3 = gen_reg_rtx (V8HImode);
11251 emit_insn (gen_sse2_ussubv8hi3 (op3, operands[1], op2));
11252 emit_insn (gen_addv8hi3 (op0, op3, op2));
11260 operands[1] = force_reg (<MODE>mode, operands[1]);
11261 operands[2] = force_reg (<MODE>mode, operands[2]);
11263 xops[0] = operands[0];
11265 if (<CODE> == UMAX)
11267 xops[1] = operands[1];
11268 xops[2] = operands[2];
11272 xops[1] = operands[2];
11273 xops[2] = operands[1];
11276 xops[3] = gen_rtx_GTU (VOIDmode, operands[1], operands[2]);
11277 xops[4] = operands[1];
11278 xops[5] = operands[2];
11280 ok = ix86_expand_int_vcond (xops);
11286 (define_insn "*sse4_1_<code><mode>3<mask_name>"
11287 [(set (match_operand:VI24_128 0 "register_operand" "=Yr,*x,v")
11289 (match_operand:VI24_128 1 "vector_operand" "%0,0,v")
11290 (match_operand:VI24_128 2 "vector_operand" "YrBm,*xBm,vm")))]
11292 && <mask_mode512bit_condition>
11293 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11295 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
11296 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
11297 vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11298 [(set_attr "isa" "noavx,noavx,avx")
11299 (set_attr "type" "sseiadd")
11300 (set_attr "prefix_extra" "1,1,*")
11301 (set_attr "prefix" "orig,orig,vex")
11302 (set_attr "mode" "TI")])
11304 (define_insn "*<code>v16qi3"
11305 [(set (match_operand:V16QI 0 "register_operand" "=x,x,v")
11307 (match_operand:V16QI 1 "vector_operand" "%0,x,v")
11308 (match_operand:V16QI 2 "vector_operand" "xBm,xm,vm")))]
11309 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11311 p<maxmin_int>b\t{%2, %0|%0, %2}
11312 vp<maxmin_int>b\t{%2, %1, %0|%0, %1, %2}
11313 vp<maxmin_int>b\t{%2, %1, %0|%0, %1, %2}"
11314 [(set_attr "isa" "noavx,avx,avx512bw")
11315 (set_attr "type" "sseiadd")
11316 (set_attr "prefix_data16" "1,*,*")
11317 (set_attr "prefix_extra" "*,1,1")
11318 (set_attr "prefix" "orig,vex,evex")
11319 (set_attr "mode" "TI")])
11321 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11323 ;; Parallel integral comparisons
11325 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11327 (define_expand "avx2_eq<mode>3"
11328 [(set (match_operand:VI_256 0 "register_operand")
11330 (match_operand:VI_256 1 "nonimmediate_operand")
11331 (match_operand:VI_256 2 "nonimmediate_operand")))]
11333 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
11335 (define_insn "*avx2_eq<mode>3"
11336 [(set (match_operand:VI_256 0 "register_operand" "=x")
11338 (match_operand:VI_256 1 "nonimmediate_operand" "%x")
11339 (match_operand:VI_256 2 "nonimmediate_operand" "xm")))]
11340 "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11341 "vpcmpeq<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11342 [(set_attr "type" "ssecmp")
11343 (set_attr "prefix_extra" "1")
11344 (set_attr "prefix" "vex")
11345 (set_attr "mode" "OI")])
11347 (define_expand "<avx512>_eq<mode>3<mask_scalar_merge_name>"
11348 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
11349 (unspec:<avx512fmaskmode>
11350 [(match_operand:VI12_AVX512VL 1 "nonimmediate_operand")
11351 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand")]
11352 UNSPEC_MASKED_EQ))]
11354 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
11356 (define_expand "<avx512>_eq<mode>3<mask_scalar_merge_name>"
11357 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
11358 (unspec:<avx512fmaskmode>
11359 [(match_operand:VI48_AVX512VL 1 "nonimmediate_operand")
11360 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand")]
11361 UNSPEC_MASKED_EQ))]
11363 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
11365 (define_insn "<avx512>_eq<mode>3<mask_scalar_merge_name>_1"
11366 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11367 (unspec:<avx512fmaskmode>
11368 [(match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "%v")
11369 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")]
11370 UNSPEC_MASKED_EQ))]
11371 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11372 "vpcmpeq<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11373 [(set_attr "type" "ssecmp")
11374 (set_attr "prefix_extra" "1")
11375 (set_attr "prefix" "evex")
11376 (set_attr "mode" "<sseinsnmode>")])
11378 (define_insn "<avx512>_eq<mode>3<mask_scalar_merge_name>_1"
11379 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11380 (unspec:<avx512fmaskmode>
11381 [(match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "%v")
11382 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")]
11383 UNSPEC_MASKED_EQ))]
11384 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11385 "vpcmpeq<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11386 [(set_attr "type" "ssecmp")
11387 (set_attr "prefix_extra" "1")
11388 (set_attr "prefix" "evex")
11389 (set_attr "mode" "<sseinsnmode>")])
11391 (define_insn "*sse4_1_eqv2di3"
11392 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,x")
11394 (match_operand:V2DI 1 "vector_operand" "%0,0,x")
11395 (match_operand:V2DI 2 "vector_operand" "YrBm,*xBm,xm")))]
11396 "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11398 pcmpeqq\t{%2, %0|%0, %2}
11399 pcmpeqq\t{%2, %0|%0, %2}
11400 vpcmpeqq\t{%2, %1, %0|%0, %1, %2}"
11401 [(set_attr "isa" "noavx,noavx,avx")
11402 (set_attr "type" "ssecmp")
11403 (set_attr "prefix_extra" "1")
11404 (set_attr "prefix" "orig,orig,vex")
11405 (set_attr "mode" "TI")])
11407 (define_insn "*sse2_eq<mode>3"
11408 [(set (match_operand:VI124_128 0 "register_operand" "=x,x")
11410 (match_operand:VI124_128 1 "vector_operand" "%0,x")
11411 (match_operand:VI124_128 2 "vector_operand" "xBm,xm")))]
11412 "TARGET_SSE2 && !TARGET_XOP
11413 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11415 pcmpeq<ssemodesuffix>\t{%2, %0|%0, %2}
11416 vpcmpeq<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11417 [(set_attr "isa" "noavx,avx")
11418 (set_attr "type" "ssecmp")
11419 (set_attr "prefix_data16" "1,*")
11420 (set_attr "prefix" "orig,vex")
11421 (set_attr "mode" "TI")])
11423 (define_expand "sse2_eq<mode>3"
11424 [(set (match_operand:VI124_128 0 "register_operand")
11426 (match_operand:VI124_128 1 "vector_operand")
11427 (match_operand:VI124_128 2 "vector_operand")))]
11428 "TARGET_SSE2 && !TARGET_XOP "
11429 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
11431 (define_expand "sse4_1_eqv2di3"
11432 [(set (match_operand:V2DI 0 "register_operand")
11434 (match_operand:V2DI 1 "vector_operand")
11435 (match_operand:V2DI 2 "vector_operand")))]
11437 "ix86_fixup_binary_operands_no_copy (EQ, V2DImode, operands);")
11439 (define_insn "sse4_2_gtv2di3"
11440 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,x")
11442 (match_operand:V2DI 1 "register_operand" "0,0,x")
11443 (match_operand:V2DI 2 "vector_operand" "YrBm,*xBm,xm")))]
11446 pcmpgtq\t{%2, %0|%0, %2}
11447 pcmpgtq\t{%2, %0|%0, %2}
11448 vpcmpgtq\t{%2, %1, %0|%0, %1, %2}"
11449 [(set_attr "isa" "noavx,noavx,avx")
11450 (set_attr "type" "ssecmp")
11451 (set_attr "prefix_extra" "1")
11452 (set_attr "prefix" "orig,orig,vex")
11453 (set_attr "mode" "TI")])
11455 (define_insn "avx2_gt<mode>3"
11456 [(set (match_operand:VI_256 0 "register_operand" "=x")
11458 (match_operand:VI_256 1 "register_operand" "x")
11459 (match_operand:VI_256 2 "nonimmediate_operand" "xm")))]
11461 "vpcmpgt<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11462 [(set_attr "type" "ssecmp")
11463 (set_attr "prefix_extra" "1")
11464 (set_attr "prefix" "vex")
11465 (set_attr "mode" "OI")])
11467 (define_insn "<avx512>_gt<mode>3<mask_scalar_merge_name>"
11468 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11469 (unspec:<avx512fmaskmode>
11470 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
11471 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")] UNSPEC_MASKED_GT))]
11473 "vpcmpgt<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11474 [(set_attr "type" "ssecmp")
11475 (set_attr "prefix_extra" "1")
11476 (set_attr "prefix" "evex")
11477 (set_attr "mode" "<sseinsnmode>")])
11479 (define_insn "<avx512>_gt<mode>3<mask_scalar_merge_name>"
11480 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11481 (unspec:<avx512fmaskmode>
11482 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
11483 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")] UNSPEC_MASKED_GT))]
11485 "vpcmpgt<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11486 [(set_attr "type" "ssecmp")
11487 (set_attr "prefix_extra" "1")
11488 (set_attr "prefix" "evex")
11489 (set_attr "mode" "<sseinsnmode>")])
11491 (define_insn "sse2_gt<mode>3"
11492 [(set (match_operand:VI124_128 0 "register_operand" "=x,x")
11494 (match_operand:VI124_128 1 "register_operand" "0,x")
11495 (match_operand:VI124_128 2 "vector_operand" "xBm,xm")))]
11496 "TARGET_SSE2 && !TARGET_XOP"
11498 pcmpgt<ssemodesuffix>\t{%2, %0|%0, %2}
11499 vpcmpgt<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11500 [(set_attr "isa" "noavx,avx")
11501 (set_attr "type" "ssecmp")
11502 (set_attr "prefix_data16" "1,*")
11503 (set_attr "prefix" "orig,vex")
11504 (set_attr "mode" "TI")])
11506 (define_expand "vcond<V_512:mode><VI_AVX512BW:mode>"
11507 [(set (match_operand:V_512 0 "register_operand")
11508 (if_then_else:V_512
11509 (match_operator 3 ""
11510 [(match_operand:VI_AVX512BW 4 "nonimmediate_operand")
11511 (match_operand:VI_AVX512BW 5 "general_operand")])
11512 (match_operand:V_512 1)
11513 (match_operand:V_512 2)))]
11515 && (GET_MODE_NUNITS (<V_512:MODE>mode)
11516 == GET_MODE_NUNITS (<VI_AVX512BW:MODE>mode))"
11518 bool ok = ix86_expand_int_vcond (operands);
11523 (define_expand "vcond<V_256:mode><VI_256:mode>"
11524 [(set (match_operand:V_256 0 "register_operand")
11525 (if_then_else:V_256
11526 (match_operator 3 ""
11527 [(match_operand:VI_256 4 "nonimmediate_operand")
11528 (match_operand:VI_256 5 "general_operand")])
11529 (match_operand:V_256 1)
11530 (match_operand:V_256 2)))]
11532 && (GET_MODE_NUNITS (<V_256:MODE>mode)
11533 == GET_MODE_NUNITS (<VI_256:MODE>mode))"
11535 bool ok = ix86_expand_int_vcond (operands);
11540 (define_expand "vcond<V_128:mode><VI124_128:mode>"
11541 [(set (match_operand:V_128 0 "register_operand")
11542 (if_then_else:V_128
11543 (match_operator 3 ""
11544 [(match_operand:VI124_128 4 "vector_operand")
11545 (match_operand:VI124_128 5 "general_operand")])
11546 (match_operand:V_128 1)
11547 (match_operand:V_128 2)))]
11549 && (GET_MODE_NUNITS (<V_128:MODE>mode)
11550 == GET_MODE_NUNITS (<VI124_128:MODE>mode))"
11552 bool ok = ix86_expand_int_vcond (operands);
11557 (define_expand "vcond<VI8F_128:mode>v2di"
11558 [(set (match_operand:VI8F_128 0 "register_operand")
11559 (if_then_else:VI8F_128
11560 (match_operator 3 ""
11561 [(match_operand:V2DI 4 "vector_operand")
11562 (match_operand:V2DI 5 "general_operand")])
11563 (match_operand:VI8F_128 1)
11564 (match_operand:VI8F_128 2)))]
11567 bool ok = ix86_expand_int_vcond (operands);
11572 (define_expand "vcondu<V_512:mode><VI_AVX512BW:mode>"
11573 [(set (match_operand:V_512 0 "register_operand")
11574 (if_then_else:V_512
11575 (match_operator 3 ""
11576 [(match_operand:VI_AVX512BW 4 "nonimmediate_operand")
11577 (match_operand:VI_AVX512BW 5 "nonimmediate_operand")])
11578 (match_operand:V_512 1 "general_operand")
11579 (match_operand:V_512 2 "general_operand")))]
11581 && (GET_MODE_NUNITS (<V_512:MODE>mode)
11582 == GET_MODE_NUNITS (<VI_AVX512BW:MODE>mode))"
11584 bool ok = ix86_expand_int_vcond (operands);
11589 (define_expand "vcondu<V_256:mode><VI_256:mode>"
11590 [(set (match_operand:V_256 0 "register_operand")
11591 (if_then_else:V_256
11592 (match_operator 3 ""
11593 [(match_operand:VI_256 4 "nonimmediate_operand")
11594 (match_operand:VI_256 5 "nonimmediate_operand")])
11595 (match_operand:V_256 1 "general_operand")
11596 (match_operand:V_256 2 "general_operand")))]
11598 && (GET_MODE_NUNITS (<V_256:MODE>mode)
11599 == GET_MODE_NUNITS (<VI_256:MODE>mode))"
11601 bool ok = ix86_expand_int_vcond (operands);
11606 (define_expand "vcondu<V_128:mode><VI124_128:mode>"
11607 [(set (match_operand:V_128 0 "register_operand")
11608 (if_then_else:V_128
11609 (match_operator 3 ""
11610 [(match_operand:VI124_128 4 "vector_operand")
11611 (match_operand:VI124_128 5 "vector_operand")])
11612 (match_operand:V_128 1 "general_operand")
11613 (match_operand:V_128 2 "general_operand")))]
11615 && (GET_MODE_NUNITS (<V_128:MODE>mode)
11616 == GET_MODE_NUNITS (<VI124_128:MODE>mode))"
11618 bool ok = ix86_expand_int_vcond (operands);
11623 (define_expand "vcondu<VI8F_128:mode>v2di"
11624 [(set (match_operand:VI8F_128 0 "register_operand")
11625 (if_then_else:VI8F_128
11626 (match_operator 3 ""
11627 [(match_operand:V2DI 4 "vector_operand")
11628 (match_operand:V2DI 5 "vector_operand")])
11629 (match_operand:VI8F_128 1 "general_operand")
11630 (match_operand:VI8F_128 2 "general_operand")))]
11633 bool ok = ix86_expand_int_vcond (operands);
11638 (define_expand "vcondeq<VI8F_128:mode>v2di"
11639 [(set (match_operand:VI8F_128 0 "register_operand")
11640 (if_then_else:VI8F_128
11641 (match_operator 3 ""
11642 [(match_operand:V2DI 4 "vector_operand")
11643 (match_operand:V2DI 5 "general_operand")])
11644 (match_operand:VI8F_128 1)
11645 (match_operand:VI8F_128 2)))]
11648 bool ok = ix86_expand_int_vcond (operands);
11653 (define_mode_iterator VEC_PERM_AVX2
11654 [V16QI V8HI V4SI V2DI V4SF V2DF
11655 (V32QI "TARGET_AVX2") (V16HI "TARGET_AVX2")
11656 (V8SI "TARGET_AVX2") (V4DI "TARGET_AVX2")
11657 (V8SF "TARGET_AVX2") (V4DF "TARGET_AVX2")
11658 (V16SF "TARGET_AVX512F") (V8DF "TARGET_AVX512F")
11659 (V16SI "TARGET_AVX512F") (V8DI "TARGET_AVX512F")
11660 (V32HI "TARGET_AVX512BW") (V64QI "TARGET_AVX512VBMI")])
11662 (define_expand "vec_perm<mode>"
11663 [(match_operand:VEC_PERM_AVX2 0 "register_operand")
11664 (match_operand:VEC_PERM_AVX2 1 "register_operand")
11665 (match_operand:VEC_PERM_AVX2 2 "register_operand")
11666 (match_operand:<sseintvecmode> 3 "register_operand")]
11667 "TARGET_SSSE3 || TARGET_AVX || TARGET_XOP"
11669 ix86_expand_vec_perm (operands);
11673 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11675 ;; Parallel bitwise logical operations
11677 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11679 (define_expand "one_cmpl<mode>2"
11680 [(set (match_operand:VI 0 "register_operand")
11681 (xor:VI (match_operand:VI 1 "vector_operand")
11685 operands[2] = force_reg (<MODE>mode, CONSTM1_RTX (<MODE>mode));
11688 (define_expand "<sse2_avx2>_andnot<mode>3"
11689 [(set (match_operand:VI_AVX2 0 "register_operand")
11691 (not:VI_AVX2 (match_operand:VI_AVX2 1 "register_operand"))
11692 (match_operand:VI_AVX2 2 "vector_operand")))]
11695 (define_expand "<sse2_avx2>_andnot<mode>3_mask"
11696 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
11697 (vec_merge:VI48_AVX512VL
11700 (match_operand:VI48_AVX512VL 1 "register_operand"))
11701 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand"))
11702 (match_operand:VI48_AVX512VL 3 "vector_move_operand")
11703 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
11706 (define_expand "<sse2_avx2>_andnot<mode>3_mask"
11707 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
11708 (vec_merge:VI12_AVX512VL
11711 (match_operand:VI12_AVX512VL 1 "register_operand"))
11712 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand"))
11713 (match_operand:VI12_AVX512VL 3 "vector_move_operand")
11714 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
11717 (define_insn "*andnot<mode>3"
11718 [(set (match_operand:VI 0 "register_operand" "=x,x,v")
11720 (not:VI (match_operand:VI 1 "register_operand" "0,x,v"))
11721 (match_operand:VI 2 "vector_operand" "xBm,xm,vm")))]
11724 static char buf[64];
11727 const char *ssesuffix;
11729 switch (get_attr_mode (insn))
11732 gcc_assert (TARGET_AVX512F);
11735 gcc_assert (TARGET_AVX2);
11738 gcc_assert (TARGET_SSE2);
11740 switch (<MODE>mode)
11744 /* There is no vpandnb or vpandnw instruction, nor vpandn for
11745 512-bit vectors. Use vpandnq instead. */
11750 ssesuffix = "<ssemodesuffix>";
11756 ssesuffix = (TARGET_AVX512VL && which_alternative == 2
11757 ? "<ssemodesuffix>" : "");
11760 ssesuffix = TARGET_AVX512VL && which_alternative == 2 ? "q" : "";
11765 gcc_assert (TARGET_AVX512F);
11768 gcc_assert (TARGET_AVX);
11771 gcc_assert (TARGET_SSE);
11777 gcc_unreachable ();
11780 switch (which_alternative)
11783 ops = "%s%s\t{%%2, %%0|%%0, %%2}";
11787 ops = "v%s%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
11790 gcc_unreachable ();
11793 snprintf (buf, sizeof (buf), ops, tmp, ssesuffix);
11796 [(set_attr "isa" "noavx,avx,avx")
11797 (set_attr "type" "sselog")
11798 (set (attr "prefix_data16")
11800 (and (eq_attr "alternative" "0")
11801 (eq_attr "mode" "TI"))
11803 (const_string "*")))
11804 (set_attr "prefix" "orig,vex,evex")
11806 (cond [(and (match_test "<MODE_SIZE> == 16")
11807 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
11808 (const_string "<ssePSmode>")
11809 (match_test "TARGET_AVX2")
11810 (const_string "<sseinsnmode>")
11811 (match_test "TARGET_AVX")
11813 (match_test "<MODE_SIZE> > 16")
11814 (const_string "V8SF")
11815 (const_string "<sseinsnmode>"))
11816 (ior (not (match_test "TARGET_SSE2"))
11817 (match_test "optimize_function_for_size_p (cfun)"))
11818 (const_string "V4SF")
11820 (const_string "<sseinsnmode>")))])
11822 (define_insn "*andnot<mode>3_mask"
11823 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
11824 (vec_merge:VI48_AVX512VL
11827 (match_operand:VI48_AVX512VL 1 "register_operand" "v"))
11828 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm"))
11829 (match_operand:VI48_AVX512VL 3 "vector_move_operand" "0C")
11830 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
11832 "vpandn<ssemodesuffix>\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}";
11833 [(set_attr "type" "sselog")
11834 (set_attr "prefix" "evex")
11835 (set_attr "mode" "<sseinsnmode>")])
11837 (define_expand "<code><mode>3"
11838 [(set (match_operand:VI 0 "register_operand")
11840 (match_operand:VI 1 "nonimmediate_or_const_vector_operand")
11841 (match_operand:VI 2 "nonimmediate_or_const_vector_operand")))]
11844 ix86_expand_vector_logical_operator (<CODE>, <MODE>mode, operands);
11848 (define_insn "<mask_codefor><code><mode>3<mask_name>"
11849 [(set (match_operand:VI48_AVX_AVX512F 0 "register_operand" "=x,x,v")
11850 (any_logic:VI48_AVX_AVX512F
11851 (match_operand:VI48_AVX_AVX512F 1 "vector_operand" "%0,x,v")
11852 (match_operand:VI48_AVX_AVX512F 2 "vector_operand" "xBm,xm,vm")))]
11853 "TARGET_SSE && <mask_mode512bit_condition>
11854 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11856 static char buf[64];
11859 const char *ssesuffix;
11861 switch (get_attr_mode (insn))
11864 gcc_assert (TARGET_AVX512F);
11867 gcc_assert (TARGET_AVX2);
11870 gcc_assert (TARGET_SSE2);
11872 switch (<MODE>mode)
11876 ssesuffix = "<ssemodesuffix>";
11882 ssesuffix = (TARGET_AVX512VL
11883 && (<mask_applied> || which_alternative == 2)
11884 ? "<ssemodesuffix>" : "");
11887 gcc_unreachable ();
11892 gcc_assert (TARGET_AVX);
11895 gcc_assert (TARGET_SSE);
11901 gcc_unreachable ();
11904 switch (which_alternative)
11907 if (<mask_applied>)
11908 ops = "v%s%s\t{%%2, %%0, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%0, %%2}";
11910 ops = "%s%s\t{%%2, %%0|%%0, %%2}";
11914 ops = "v%s%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
11917 gcc_unreachable ();
11920 snprintf (buf, sizeof (buf), ops, tmp, ssesuffix);
11923 [(set_attr "isa" "noavx,avx,avx")
11924 (set_attr "type" "sselog")
11925 (set (attr "prefix_data16")
11927 (and (eq_attr "alternative" "0")
11928 (eq_attr "mode" "TI"))
11930 (const_string "*")))
11931 (set_attr "prefix" "<mask_prefix3>,evex")
11933 (cond [(and (match_test "<MODE_SIZE> == 16")
11934 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
11935 (const_string "<ssePSmode>")
11936 (match_test "TARGET_AVX2")
11937 (const_string "<sseinsnmode>")
11938 (match_test "TARGET_AVX")
11940 (match_test "<MODE_SIZE> > 16")
11941 (const_string "V8SF")
11942 (const_string "<sseinsnmode>"))
11943 (ior (not (match_test "TARGET_SSE2"))
11944 (match_test "optimize_function_for_size_p (cfun)"))
11945 (const_string "V4SF")
11947 (const_string "<sseinsnmode>")))])
11949 (define_insn "*<code><mode>3"
11950 [(set (match_operand:VI12_AVX_AVX512F 0 "register_operand" "=x,x,v")
11951 (any_logic:VI12_AVX_AVX512F
11952 (match_operand:VI12_AVX_AVX512F 1 "vector_operand" "%0,x,v")
11953 (match_operand:VI12_AVX_AVX512F 2 "vector_operand" "xBm,xm,vm")))]
11954 "TARGET_SSE && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11956 static char buf[64];
11959 const char *ssesuffix;
11961 switch (get_attr_mode (insn))
11964 gcc_assert (TARGET_AVX512F);
11967 gcc_assert (TARGET_AVX2);
11970 gcc_assert (TARGET_SSE2);
11972 switch (<MODE>mode)
11982 ssesuffix = TARGET_AVX512VL && which_alternative == 2 ? "q" : "";
11985 gcc_unreachable ();
11990 gcc_assert (TARGET_AVX);
11993 gcc_assert (TARGET_SSE);
11999 gcc_unreachable ();
12002 switch (which_alternative)
12005 ops = "%s%s\t{%%2, %%0|%%0, %%2}";
12009 ops = "v%s%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
12012 gcc_unreachable ();
12015 snprintf (buf, sizeof (buf), ops, tmp, ssesuffix);
12018 [(set_attr "isa" "noavx,avx,avx")
12019 (set_attr "type" "sselog")
12020 (set (attr "prefix_data16")
12022 (and (eq_attr "alternative" "0")
12023 (eq_attr "mode" "TI"))
12025 (const_string "*")))
12026 (set_attr "prefix" "orig,vex,evex")
12028 (cond [(and (match_test "<MODE_SIZE> == 16")
12029 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
12030 (const_string "<ssePSmode>")
12031 (match_test "TARGET_AVX2")
12032 (const_string "<sseinsnmode>")
12033 (match_test "TARGET_AVX")
12035 (match_test "<MODE_SIZE> > 16")
12036 (const_string "V8SF")
12037 (const_string "<sseinsnmode>"))
12038 (ior (not (match_test "TARGET_SSE2"))
12039 (match_test "optimize_function_for_size_p (cfun)"))
12040 (const_string "V4SF")
12042 (const_string "<sseinsnmode>")))])
12044 (define_insn "<avx512>_testm<mode>3<mask_scalar_merge_name>"
12045 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
12046 (unspec:<avx512fmaskmode>
12047 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
12048 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")]
12051 "vptestm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
12052 [(set_attr "prefix" "evex")
12053 (set_attr "mode" "<sseinsnmode>")])
12055 (define_insn "<avx512>_testm<mode>3<mask_scalar_merge_name>"
12056 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
12057 (unspec:<avx512fmaskmode>
12058 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
12059 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")]
12062 "vptestm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
12063 [(set_attr "prefix" "evex")
12064 (set_attr "mode" "<sseinsnmode>")])
12066 (define_insn "<avx512>_testnm<mode>3<mask_scalar_merge_name>"
12067 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
12068 (unspec:<avx512fmaskmode>
12069 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
12070 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")]
12073 "vptestnm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
12074 [(set_attr "prefix" "evex")
12075 (set_attr "mode" "<sseinsnmode>")])
12077 (define_insn "<avx512>_testnm<mode>3<mask_scalar_merge_name>"
12078 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
12079 (unspec:<avx512fmaskmode>
12080 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
12081 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")]
12084 "vptestnm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
12085 [(set_attr "prefix" "evex")
12086 (set_attr "mode" "<sseinsnmode>")])
12088 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12090 ;; Parallel integral element swizzling
12092 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12094 (define_expand "vec_pack_trunc_<mode>"
12095 [(match_operand:<ssepackmode> 0 "register_operand")
12096 (match_operand:VI248_AVX2_8_AVX512F_24_AVX512BW 1 "register_operand")
12097 (match_operand:VI248_AVX2_8_AVX512F_24_AVX512BW 2 "register_operand")]
12100 rtx op1 = gen_lowpart (<ssepackmode>mode, operands[1]);
12101 rtx op2 = gen_lowpart (<ssepackmode>mode, operands[2]);
12102 ix86_expand_vec_extract_even_odd (operands[0], op1, op2, 0);
12106 (define_expand "vec_pack_trunc_qi"
12107 [(set (match_operand:HI 0 ("register_operand"))
12108 (ior:HI (ashift:HI (zero_extend:HI (match_operand:QI 2 ("register_operand")))
12110 (zero_extend:HI (match_operand:QI 1 ("register_operand")))))]
12113 (define_expand "vec_pack_trunc_<mode>"
12114 [(set (match_operand:<DOUBLEMASKMODE> 0 ("register_operand"))
12115 (ior:<DOUBLEMASKMODE> (ashift:<DOUBLEMASKMODE> (zero_extend:<DOUBLEMASKMODE> (match_operand:SWI24 2 ("register_operand")))
12117 (zero_extend:<DOUBLEMASKMODE> (match_operand:SWI24 1 ("register_operand")))))]
12120 operands[3] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
12123 (define_insn "<sse2_avx2>_packsswb<mask_name>"
12124 [(set (match_operand:VI1_AVX512 0 "register_operand" "=x,x,v")
12125 (vec_concat:VI1_AVX512
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 packsswb\t{%2, %0|%0, %2}
12133 vpacksswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
12134 vpacksswb\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>_packssdw<mask_name>"
12142 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,x,v")
12143 (vec_concat:VI2_AVX2
12144 (ss_truncate:<ssehalfvecmode>
12145 (match_operand:<sseunpackmode> 1 "register_operand" "0,x,v"))
12146 (ss_truncate:<ssehalfvecmode>
12147 (match_operand:<sseunpackmode> 2 "vector_operand" "xBm,xm,vm"))))]
12148 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
12150 packssdw\t{%2, %0|%0, %2}
12151 vpackssdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
12152 vpackssdw\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 "<sse2_avx2>_packuswb<mask_name>"
12160 [(set (match_operand:VI1_AVX512 0 "register_operand" "=x,x,v")
12161 (vec_concat:VI1_AVX512
12162 (us_truncate:<ssehalfvecmode>
12163 (match_operand:<sseunpackmode> 1 "register_operand" "0,x,v"))
12164 (us_truncate:<ssehalfvecmode>
12165 (match_operand:<sseunpackmode> 2 "vector_operand" "xBm,xm,vm"))))]
12166 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
12168 packuswb\t{%2, %0|%0, %2}
12169 vpackuswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
12170 vpackuswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12171 [(set_attr "isa" "noavx,avx,avx512bw")
12172 (set_attr "type" "sselog")
12173 (set_attr "prefix_data16" "1,*,*")
12174 (set_attr "prefix" "orig,<mask_prefix>,evex")
12175 (set_attr "mode" "<sseinsnmode>")])
12177 (define_insn "avx512bw_interleave_highv64qi<mask_name>"
12178 [(set (match_operand:V64QI 0 "register_operand" "=v")
12181 (match_operand:V64QI 1 "register_operand" "v")
12182 (match_operand:V64QI 2 "nonimmediate_operand" "vm"))
12183 (parallel [(const_int 8) (const_int 72)
12184 (const_int 9) (const_int 73)
12185 (const_int 10) (const_int 74)
12186 (const_int 11) (const_int 75)
12187 (const_int 12) (const_int 76)
12188 (const_int 13) (const_int 77)
12189 (const_int 14) (const_int 78)
12190 (const_int 15) (const_int 79)
12191 (const_int 24) (const_int 88)
12192 (const_int 25) (const_int 89)
12193 (const_int 26) (const_int 90)
12194 (const_int 27) (const_int 91)
12195 (const_int 28) (const_int 92)
12196 (const_int 29) (const_int 93)
12197 (const_int 30) (const_int 94)
12198 (const_int 31) (const_int 95)
12199 (const_int 40) (const_int 104)
12200 (const_int 41) (const_int 105)
12201 (const_int 42) (const_int 106)
12202 (const_int 43) (const_int 107)
12203 (const_int 44) (const_int 108)
12204 (const_int 45) (const_int 109)
12205 (const_int 46) (const_int 110)
12206 (const_int 47) (const_int 111)
12207 (const_int 56) (const_int 120)
12208 (const_int 57) (const_int 121)
12209 (const_int 58) (const_int 122)
12210 (const_int 59) (const_int 123)
12211 (const_int 60) (const_int 124)
12212 (const_int 61) (const_int 125)
12213 (const_int 62) (const_int 126)
12214 (const_int 63) (const_int 127)])))]
12216 "vpunpckhbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12217 [(set_attr "type" "sselog")
12218 (set_attr "prefix" "evex")
12219 (set_attr "mode" "XI")])
12221 (define_insn "avx2_interleave_highv32qi<mask_name>"
12222 [(set (match_operand:V32QI 0 "register_operand" "=v")
12225 (match_operand:V32QI 1 "register_operand" "v")
12226 (match_operand:V32QI 2 "nonimmediate_operand" "vm"))
12227 (parallel [(const_int 8) (const_int 40)
12228 (const_int 9) (const_int 41)
12229 (const_int 10) (const_int 42)
12230 (const_int 11) (const_int 43)
12231 (const_int 12) (const_int 44)
12232 (const_int 13) (const_int 45)
12233 (const_int 14) (const_int 46)
12234 (const_int 15) (const_int 47)
12235 (const_int 24) (const_int 56)
12236 (const_int 25) (const_int 57)
12237 (const_int 26) (const_int 58)
12238 (const_int 27) (const_int 59)
12239 (const_int 28) (const_int 60)
12240 (const_int 29) (const_int 61)
12241 (const_int 30) (const_int 62)
12242 (const_int 31) (const_int 63)])))]
12243 "TARGET_AVX2 && <mask_avx512vl_condition>"
12244 "vpunpckhbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12245 [(set_attr "type" "sselog")
12246 (set_attr "prefix" "<mask_prefix>")
12247 (set_attr "mode" "OI")])
12249 (define_insn "vec_interleave_highv16qi<mask_name>"
12250 [(set (match_operand:V16QI 0 "register_operand" "=x,v")
12253 (match_operand:V16QI 1 "register_operand" "0,v")
12254 (match_operand:V16QI 2 "vector_operand" "xBm,vm"))
12255 (parallel [(const_int 8) (const_int 24)
12256 (const_int 9) (const_int 25)
12257 (const_int 10) (const_int 26)
12258 (const_int 11) (const_int 27)
12259 (const_int 12) (const_int 28)
12260 (const_int 13) (const_int 29)
12261 (const_int 14) (const_int 30)
12262 (const_int 15) (const_int 31)])))]
12263 "TARGET_SSE2 && <mask_avx512vl_condition>"
12265 punpckhbw\t{%2, %0|%0, %2}
12266 vpunpckhbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12267 [(set_attr "isa" "noavx,avx")
12268 (set_attr "type" "sselog")
12269 (set_attr "prefix_data16" "1,*")
12270 (set_attr "prefix" "orig,<mask_prefix>")
12271 (set_attr "mode" "TI")])
12273 (define_insn "avx512bw_interleave_lowv64qi<mask_name>"
12274 [(set (match_operand:V64QI 0 "register_operand" "=v")
12277 (match_operand:V64QI 1 "register_operand" "v")
12278 (match_operand:V64QI 2 "nonimmediate_operand" "vm"))
12279 (parallel [(const_int 0) (const_int 64)
12280 (const_int 1) (const_int 65)
12281 (const_int 2) (const_int 66)
12282 (const_int 3) (const_int 67)
12283 (const_int 4) (const_int 68)
12284 (const_int 5) (const_int 69)
12285 (const_int 6) (const_int 70)
12286 (const_int 7) (const_int 71)
12287 (const_int 16) (const_int 80)
12288 (const_int 17) (const_int 81)
12289 (const_int 18) (const_int 82)
12290 (const_int 19) (const_int 83)
12291 (const_int 20) (const_int 84)
12292 (const_int 21) (const_int 85)
12293 (const_int 22) (const_int 86)
12294 (const_int 23) (const_int 87)
12295 (const_int 32) (const_int 96)
12296 (const_int 33) (const_int 97)
12297 (const_int 34) (const_int 98)
12298 (const_int 35) (const_int 99)
12299 (const_int 36) (const_int 100)
12300 (const_int 37) (const_int 101)
12301 (const_int 38) (const_int 102)
12302 (const_int 39) (const_int 103)
12303 (const_int 48) (const_int 112)
12304 (const_int 49) (const_int 113)
12305 (const_int 50) (const_int 114)
12306 (const_int 51) (const_int 115)
12307 (const_int 52) (const_int 116)
12308 (const_int 53) (const_int 117)
12309 (const_int 54) (const_int 118)
12310 (const_int 55) (const_int 119)])))]
12312 "vpunpcklbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12313 [(set_attr "type" "sselog")
12314 (set_attr "prefix" "evex")
12315 (set_attr "mode" "XI")])
12317 (define_insn "avx2_interleave_lowv32qi<mask_name>"
12318 [(set (match_operand:V32QI 0 "register_operand" "=v")
12321 (match_operand:V32QI 1 "register_operand" "v")
12322 (match_operand:V32QI 2 "nonimmediate_operand" "vm"))
12323 (parallel [(const_int 0) (const_int 32)
12324 (const_int 1) (const_int 33)
12325 (const_int 2) (const_int 34)
12326 (const_int 3) (const_int 35)
12327 (const_int 4) (const_int 36)
12328 (const_int 5) (const_int 37)
12329 (const_int 6) (const_int 38)
12330 (const_int 7) (const_int 39)
12331 (const_int 16) (const_int 48)
12332 (const_int 17) (const_int 49)
12333 (const_int 18) (const_int 50)
12334 (const_int 19) (const_int 51)
12335 (const_int 20) (const_int 52)
12336 (const_int 21) (const_int 53)
12337 (const_int 22) (const_int 54)
12338 (const_int 23) (const_int 55)])))]
12339 "TARGET_AVX2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12340 "vpunpcklbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12341 [(set_attr "type" "sselog")
12342 (set_attr "prefix" "maybe_vex")
12343 (set_attr "mode" "OI")])
12345 (define_insn "vec_interleave_lowv16qi<mask_name>"
12346 [(set (match_operand:V16QI 0 "register_operand" "=x,v")
12349 (match_operand:V16QI 1 "register_operand" "0,v")
12350 (match_operand:V16QI 2 "vector_operand" "xBm,vm"))
12351 (parallel [(const_int 0) (const_int 16)
12352 (const_int 1) (const_int 17)
12353 (const_int 2) (const_int 18)
12354 (const_int 3) (const_int 19)
12355 (const_int 4) (const_int 20)
12356 (const_int 5) (const_int 21)
12357 (const_int 6) (const_int 22)
12358 (const_int 7) (const_int 23)])))]
12359 "TARGET_SSE2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12361 punpcklbw\t{%2, %0|%0, %2}
12362 vpunpcklbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12363 [(set_attr "isa" "noavx,avx")
12364 (set_attr "type" "sselog")
12365 (set_attr "prefix_data16" "1,*")
12366 (set_attr "prefix" "orig,vex")
12367 (set_attr "mode" "TI")])
12369 (define_insn "avx512bw_interleave_highv32hi<mask_name>"
12370 [(set (match_operand:V32HI 0 "register_operand" "=v")
12373 (match_operand:V32HI 1 "register_operand" "v")
12374 (match_operand:V32HI 2 "nonimmediate_operand" "vm"))
12375 (parallel [(const_int 4) (const_int 36)
12376 (const_int 5) (const_int 37)
12377 (const_int 6) (const_int 38)
12378 (const_int 7) (const_int 39)
12379 (const_int 12) (const_int 44)
12380 (const_int 13) (const_int 45)
12381 (const_int 14) (const_int 46)
12382 (const_int 15) (const_int 47)
12383 (const_int 20) (const_int 52)
12384 (const_int 21) (const_int 53)
12385 (const_int 22) (const_int 54)
12386 (const_int 23) (const_int 55)
12387 (const_int 28) (const_int 60)
12388 (const_int 29) (const_int 61)
12389 (const_int 30) (const_int 62)
12390 (const_int 31) (const_int 63)])))]
12392 "vpunpckhwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12393 [(set_attr "type" "sselog")
12394 (set_attr "prefix" "evex")
12395 (set_attr "mode" "XI")])
12397 (define_insn "avx2_interleave_highv16hi<mask_name>"
12398 [(set (match_operand:V16HI 0 "register_operand" "=v")
12401 (match_operand:V16HI 1 "register_operand" "v")
12402 (match_operand:V16HI 2 "nonimmediate_operand" "vm"))
12403 (parallel [(const_int 4) (const_int 20)
12404 (const_int 5) (const_int 21)
12405 (const_int 6) (const_int 22)
12406 (const_int 7) (const_int 23)
12407 (const_int 12) (const_int 28)
12408 (const_int 13) (const_int 29)
12409 (const_int 14) (const_int 30)
12410 (const_int 15) (const_int 31)])))]
12411 "TARGET_AVX2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12412 "vpunpckhwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12413 [(set_attr "type" "sselog")
12414 (set_attr "prefix" "maybe_evex")
12415 (set_attr "mode" "OI")])
12417 (define_insn "vec_interleave_highv8hi<mask_name>"
12418 [(set (match_operand:V8HI 0 "register_operand" "=x,v")
12421 (match_operand:V8HI 1 "register_operand" "0,v")
12422 (match_operand:V8HI 2 "vector_operand" "xBm,vm"))
12423 (parallel [(const_int 4) (const_int 12)
12424 (const_int 5) (const_int 13)
12425 (const_int 6) (const_int 14)
12426 (const_int 7) (const_int 15)])))]
12427 "TARGET_SSE2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12429 punpckhwd\t{%2, %0|%0, %2}
12430 vpunpckhwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12431 [(set_attr "isa" "noavx,avx")
12432 (set_attr "type" "sselog")
12433 (set_attr "prefix_data16" "1,*")
12434 (set_attr "prefix" "orig,maybe_vex")
12435 (set_attr "mode" "TI")])
12437 (define_insn "<mask_codefor>avx512bw_interleave_lowv32hi<mask_name>"
12438 [(set (match_operand:V32HI 0 "register_operand" "=v")
12441 (match_operand:V32HI 1 "register_operand" "v")
12442 (match_operand:V32HI 2 "nonimmediate_operand" "vm"))
12443 (parallel [(const_int 0) (const_int 32)
12444 (const_int 1) (const_int 33)
12445 (const_int 2) (const_int 34)
12446 (const_int 3) (const_int 35)
12447 (const_int 8) (const_int 40)
12448 (const_int 9) (const_int 41)
12449 (const_int 10) (const_int 42)
12450 (const_int 11) (const_int 43)
12451 (const_int 16) (const_int 48)
12452 (const_int 17) (const_int 49)
12453 (const_int 18) (const_int 50)
12454 (const_int 19) (const_int 51)
12455 (const_int 24) (const_int 56)
12456 (const_int 25) (const_int 57)
12457 (const_int 26) (const_int 58)
12458 (const_int 27) (const_int 59)])))]
12460 "vpunpcklwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12461 [(set_attr "type" "sselog")
12462 (set_attr "prefix" "evex")
12463 (set_attr "mode" "XI")])
12465 (define_insn "avx2_interleave_lowv16hi<mask_name>"
12466 [(set (match_operand:V16HI 0 "register_operand" "=v")
12469 (match_operand:V16HI 1 "register_operand" "v")
12470 (match_operand:V16HI 2 "nonimmediate_operand" "vm"))
12471 (parallel [(const_int 0) (const_int 16)
12472 (const_int 1) (const_int 17)
12473 (const_int 2) (const_int 18)
12474 (const_int 3) (const_int 19)
12475 (const_int 8) (const_int 24)
12476 (const_int 9) (const_int 25)
12477 (const_int 10) (const_int 26)
12478 (const_int 11) (const_int 27)])))]
12479 "TARGET_AVX2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12480 "vpunpcklwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12481 [(set_attr "type" "sselog")
12482 (set_attr "prefix" "maybe_evex")
12483 (set_attr "mode" "OI")])
12485 (define_insn "vec_interleave_lowv8hi<mask_name>"
12486 [(set (match_operand:V8HI 0 "register_operand" "=x,v")
12489 (match_operand:V8HI 1 "register_operand" "0,v")
12490 (match_operand:V8HI 2 "vector_operand" "xBm,vm"))
12491 (parallel [(const_int 0) (const_int 8)
12492 (const_int 1) (const_int 9)
12493 (const_int 2) (const_int 10)
12494 (const_int 3) (const_int 11)])))]
12495 "TARGET_SSE2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12497 punpcklwd\t{%2, %0|%0, %2}
12498 vpunpcklwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12499 [(set_attr "isa" "noavx,avx")
12500 (set_attr "type" "sselog")
12501 (set_attr "prefix_data16" "1,*")
12502 (set_attr "prefix" "orig,maybe_evex")
12503 (set_attr "mode" "TI")])
12505 (define_insn "avx2_interleave_highv8si<mask_name>"
12506 [(set (match_operand:V8SI 0 "register_operand" "=v")
12509 (match_operand:V8SI 1 "register_operand" "v")
12510 (match_operand:V8SI 2 "nonimmediate_operand" "vm"))
12511 (parallel [(const_int 2) (const_int 10)
12512 (const_int 3) (const_int 11)
12513 (const_int 6) (const_int 14)
12514 (const_int 7) (const_int 15)])))]
12515 "TARGET_AVX2 && <mask_avx512vl_condition>"
12516 "vpunpckhdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12517 [(set_attr "type" "sselog")
12518 (set_attr "prefix" "maybe_evex")
12519 (set_attr "mode" "OI")])
12521 (define_insn "<mask_codefor>avx512f_interleave_highv16si<mask_name>"
12522 [(set (match_operand:V16SI 0 "register_operand" "=v")
12525 (match_operand:V16SI 1 "register_operand" "v")
12526 (match_operand:V16SI 2 "nonimmediate_operand" "vm"))
12527 (parallel [(const_int 2) (const_int 18)
12528 (const_int 3) (const_int 19)
12529 (const_int 6) (const_int 22)
12530 (const_int 7) (const_int 23)
12531 (const_int 10) (const_int 26)
12532 (const_int 11) (const_int 27)
12533 (const_int 14) (const_int 30)
12534 (const_int 15) (const_int 31)])))]
12536 "vpunpckhdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12537 [(set_attr "type" "sselog")
12538 (set_attr "prefix" "evex")
12539 (set_attr "mode" "XI")])
12542 (define_insn "vec_interleave_highv4si<mask_name>"
12543 [(set (match_operand:V4SI 0 "register_operand" "=x,v")
12546 (match_operand:V4SI 1 "register_operand" "0,v")
12547 (match_operand:V4SI 2 "vector_operand" "xBm,vm"))
12548 (parallel [(const_int 2) (const_int 6)
12549 (const_int 3) (const_int 7)])))]
12550 "TARGET_SSE2 && <mask_avx512vl_condition>"
12552 punpckhdq\t{%2, %0|%0, %2}
12553 vpunpckhdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12554 [(set_attr "isa" "noavx,avx")
12555 (set_attr "type" "sselog")
12556 (set_attr "prefix_data16" "1,*")
12557 (set_attr "prefix" "orig,maybe_vex")
12558 (set_attr "mode" "TI")])
12560 (define_insn "avx2_interleave_lowv8si<mask_name>"
12561 [(set (match_operand:V8SI 0 "register_operand" "=v")
12564 (match_operand:V8SI 1 "register_operand" "v")
12565 (match_operand:V8SI 2 "nonimmediate_operand" "vm"))
12566 (parallel [(const_int 0) (const_int 8)
12567 (const_int 1) (const_int 9)
12568 (const_int 4) (const_int 12)
12569 (const_int 5) (const_int 13)])))]
12570 "TARGET_AVX2 && <mask_avx512vl_condition>"
12571 "vpunpckldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12572 [(set_attr "type" "sselog")
12573 (set_attr "prefix" "maybe_evex")
12574 (set_attr "mode" "OI")])
12576 (define_insn "<mask_codefor>avx512f_interleave_lowv16si<mask_name>"
12577 [(set (match_operand:V16SI 0 "register_operand" "=v")
12580 (match_operand:V16SI 1 "register_operand" "v")
12581 (match_operand:V16SI 2 "nonimmediate_operand" "vm"))
12582 (parallel [(const_int 0) (const_int 16)
12583 (const_int 1) (const_int 17)
12584 (const_int 4) (const_int 20)
12585 (const_int 5) (const_int 21)
12586 (const_int 8) (const_int 24)
12587 (const_int 9) (const_int 25)
12588 (const_int 12) (const_int 28)
12589 (const_int 13) (const_int 29)])))]
12591 "vpunpckldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12592 [(set_attr "type" "sselog")
12593 (set_attr "prefix" "evex")
12594 (set_attr "mode" "XI")])
12596 (define_insn "vec_interleave_lowv4si<mask_name>"
12597 [(set (match_operand:V4SI 0 "register_operand" "=x,v")
12600 (match_operand:V4SI 1 "register_operand" "0,v")
12601 (match_operand:V4SI 2 "vector_operand" "xBm,vm"))
12602 (parallel [(const_int 0) (const_int 4)
12603 (const_int 1) (const_int 5)])))]
12604 "TARGET_SSE2 && <mask_avx512vl_condition>"
12606 punpckldq\t{%2, %0|%0, %2}
12607 vpunpckldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12608 [(set_attr "isa" "noavx,avx")
12609 (set_attr "type" "sselog")
12610 (set_attr "prefix_data16" "1,*")
12611 (set_attr "prefix" "orig,vex")
12612 (set_attr "mode" "TI")])
12614 (define_expand "vec_interleave_high<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 (1 + (3 << 4))));
12628 emit_move_insn (operands[0], gen_lowpart (<MODE>mode, t3));
12632 (define_expand "vec_interleave_low<mode>"
12633 [(match_operand:VI_256 0 "register_operand")
12634 (match_operand:VI_256 1 "register_operand")
12635 (match_operand:VI_256 2 "nonimmediate_operand")]
12638 rtx t1 = gen_reg_rtx (<MODE>mode);
12639 rtx t2 = gen_reg_rtx (<MODE>mode);
12640 rtx t3 = gen_reg_rtx (V4DImode);
12641 emit_insn (gen_avx2_interleave_low<mode> (t1, operands[1], operands[2]));
12642 emit_insn (gen_avx2_interleave_high<mode> (t2, operands[1], operands[2]));
12643 emit_insn (gen_avx2_permv2ti (t3, gen_lowpart (V4DImode, t1),
12644 gen_lowpart (V4DImode, t2),
12645 GEN_INT (0 + (2 << 4))));
12646 emit_move_insn (operands[0], gen_lowpart (<MODE>mode, t3));
12650 ;; Modes handled by pinsr patterns.
12651 (define_mode_iterator PINSR_MODE
12652 [(V16QI "TARGET_SSE4_1") V8HI
12653 (V4SI "TARGET_SSE4_1")
12654 (V2DI "TARGET_SSE4_1 && TARGET_64BIT")])
12656 (define_mode_attr sse2p4_1
12657 [(V16QI "sse4_1") (V8HI "sse2")
12658 (V4SI "sse4_1") (V2DI "sse4_1")])
12660 (define_mode_attr pinsr_evex_isa
12661 [(V16QI "avx512bw") (V8HI "avx512bw")
12662 (V4SI "avx512dq") (V2DI "avx512dq")])
12664 ;; sse4_1_pinsrd must come before sse2_loadld since it is preferred.
12665 (define_insn "<sse2p4_1>_pinsr<ssemodesuffix>"
12666 [(set (match_operand:PINSR_MODE 0 "register_operand" "=x,x,x,x,v,v")
12667 (vec_merge:PINSR_MODE
12668 (vec_duplicate:PINSR_MODE
12669 (match_operand:<ssescalarmode> 2 "nonimmediate_operand" "r,m,r,m,r,m"))
12670 (match_operand:PINSR_MODE 1 "register_operand" "0,0,x,x,v,v")
12671 (match_operand:SI 3 "const_int_operand")))]
12673 && ((unsigned) exact_log2 (INTVAL (operands[3]))
12674 < GET_MODE_NUNITS (<MODE>mode))"
12676 operands[3] = GEN_INT (exact_log2 (INTVAL (operands[3])));
12678 switch (which_alternative)
12681 if (GET_MODE_SIZE (<ssescalarmode>mode) < GET_MODE_SIZE (SImode))
12682 return "pinsr<ssemodesuffix>\t{%3, %k2, %0|%0, %k2, %3}";
12685 return "pinsr<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}";
12688 if (GET_MODE_SIZE (<ssescalarmode>mode) < GET_MODE_SIZE (SImode))
12689 return "vpinsr<ssemodesuffix>\t{%3, %k2, %1, %0|%0, %1, %k2, %3}";
12693 return "vpinsr<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}";
12695 gcc_unreachable ();
12698 [(set_attr "isa" "noavx,noavx,avx,avx,<pinsr_evex_isa>,<pinsr_evex_isa>")
12699 (set_attr "type" "sselog")
12700 (set (attr "prefix_rex")
12702 (and (not (match_test "TARGET_AVX"))
12703 (eq (const_string "<MODE>mode") (const_string "V2DImode")))
12705 (const_string "*")))
12706 (set (attr "prefix_data16")
12708 (and (not (match_test "TARGET_AVX"))
12709 (eq (const_string "<MODE>mode") (const_string "V8HImode")))
12711 (const_string "*")))
12712 (set (attr "prefix_extra")
12714 (and (not (match_test "TARGET_AVX"))
12715 (eq (const_string "<MODE>mode") (const_string "V8HImode")))
12717 (const_string "1")))
12718 (set_attr "length_immediate" "1")
12719 (set_attr "prefix" "orig,orig,vex,vex,evex,evex")
12720 (set_attr "mode" "TI")])
12722 (define_expand "<extract_type>_vinsert<shuffletype><extract_suf>_mask"
12723 [(match_operand:AVX512_VEC 0 "register_operand")
12724 (match_operand:AVX512_VEC 1 "register_operand")
12725 (match_operand:<ssequartermode> 2 "nonimmediate_operand")
12726 (match_operand:SI 3 "const_0_to_3_operand")
12727 (match_operand:AVX512_VEC 4 "register_operand")
12728 (match_operand:<avx512fmaskmode> 5 "register_operand")]
12731 int mask, selector;
12732 mask = INTVAL (operands[3]);
12733 selector = (GET_MODE_UNIT_SIZE (<MODE>mode) == 4
12734 ? 0xFFFF ^ (0x000F << mask * 4)
12735 : 0xFF ^ (0x03 << mask * 2));
12736 emit_insn (gen_<extract_type>_vinsert<shuffletype><extract_suf>_1_mask
12737 (operands[0], operands[1], operands[2], GEN_INT (selector),
12738 operands[4], operands[5]));
12742 (define_insn "*<extract_type>_vinsert<shuffletype><extract_suf>_0"
12743 [(set (match_operand:AVX512_VEC 0 "register_operand" "=v,x,Yv")
12744 (vec_merge:AVX512_VEC
12745 (match_operand:AVX512_VEC 1 "reg_or_0_operand" "v,C,C")
12746 (vec_duplicate:AVX512_VEC
12747 (match_operand:<ssequartermode> 2 "nonimmediate_operand" "vm,xm,vm"))
12748 (match_operand:SI 3 "const_int_operand" "n,n,n")))]
12750 && (INTVAL (operands[3])
12751 == (GET_MODE_UNIT_SIZE (<MODE>mode) == 4 ? 0xFFF0 : 0xFC))"
12753 if (which_alternative == 0)
12754 return "vinsert<shuffletype><extract_suf>\t{$0, %2, %1, %0|%0, %1, %2, 0}";
12755 switch (<MODE>mode)
12758 return "vmovapd\t{%2, %x0|%x0, %2}";
12760 return "vmovaps\t{%2, %x0|%x0, %2}";
12762 return which_alternative == 2 ? "vmovdqa64\t{%2, %x0|%x0, %2}"
12763 : "vmovdqa\t{%2, %x0|%x0, %2}";
12765 return which_alternative == 2 ? "vmovdqa32\t{%2, %x0|%x0, %2}"
12766 : "vmovdqa\t{%2, %x0|%x0, %2}";
12768 gcc_unreachable ();
12771 [(set_attr "type" "sselog,ssemov,ssemov")
12772 (set_attr "length_immediate" "1,0,0")
12773 (set_attr "prefix" "evex,vex,evex")
12774 (set_attr "mode" "<sseinsnmode>,<ssequarterinsnmode>,<ssequarterinsnmode>")])
12776 (define_insn "<mask_codefor><extract_type>_vinsert<shuffletype><extract_suf>_1<mask_name>"
12777 [(set (match_operand:AVX512_VEC 0 "register_operand" "=v")
12778 (vec_merge:AVX512_VEC
12779 (match_operand:AVX512_VEC 1 "register_operand" "v")
12780 (vec_duplicate:AVX512_VEC
12781 (match_operand:<ssequartermode> 2 "nonimmediate_operand" "vm"))
12782 (match_operand:SI 3 "const_int_operand" "n")))]
12786 int selector = INTVAL (operands[3]);
12788 if (selector == (GET_MODE_UNIT_SIZE (<MODE>mode) == 4 ? 0xFFF0 : 0xFC))
12790 else if (selector == (GET_MODE_UNIT_SIZE (<MODE>mode) == 4 ? 0xFF0F : 0xF3))
12792 else if (selector == (GET_MODE_UNIT_SIZE (<MODE>mode) == 4 ? 0xF0FF : 0xCF))
12794 else if (selector == (GET_MODE_UNIT_SIZE (<MODE>mode) == 4 ? 0x0FFF : 0x3F))
12797 gcc_unreachable ();
12799 operands[3] = GEN_INT (mask);
12801 return "vinsert<shuffletype><extract_suf>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3}";
12803 [(set_attr "type" "sselog")
12804 (set_attr "length_immediate" "1")
12805 (set_attr "prefix" "evex")
12806 (set_attr "mode" "<sseinsnmode>")])
12808 (define_expand "<extract_type_2>_vinsert<shuffletype><extract_suf_2>_mask"
12809 [(match_operand:AVX512_VEC_2 0 "register_operand")
12810 (match_operand:AVX512_VEC_2 1 "register_operand")
12811 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand")
12812 (match_operand:SI 3 "const_0_to_1_operand")
12813 (match_operand:AVX512_VEC_2 4 "register_operand")
12814 (match_operand:<avx512fmaskmode> 5 "register_operand")]
12817 int mask = INTVAL (operands[3]);
12819 emit_insn (gen_vec_set_lo_<mode>_mask (operands[0], operands[1],
12820 operands[2], operands[4],
12823 emit_insn (gen_vec_set_hi_<mode>_mask (operands[0], operands[1],
12824 operands[2], operands[4],
12829 (define_insn "vec_set_lo_<mode><mask_name>"
12830 [(set (match_operand:V16FI 0 "register_operand" "=v")
12832 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
12833 (vec_select:<ssehalfvecmode>
12834 (match_operand:V16FI 1 "register_operand" "v")
12835 (parallel [(const_int 8) (const_int 9)
12836 (const_int 10) (const_int 11)
12837 (const_int 12) (const_int 13)
12838 (const_int 14) (const_int 15)]))))]
12840 "vinsert<shuffletype>32x8\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}"
12841 [(set_attr "type" "sselog")
12842 (set_attr "length_immediate" "1")
12843 (set_attr "prefix" "evex")
12844 (set_attr "mode" "<sseinsnmode>")])
12846 (define_insn "vec_set_hi_<mode><mask_name>"
12847 [(set (match_operand:V16FI 0 "register_operand" "=v")
12849 (vec_select:<ssehalfvecmode>
12850 (match_operand:V16FI 1 "register_operand" "v")
12851 (parallel [(const_int 0) (const_int 1)
12852 (const_int 2) (const_int 3)
12853 (const_int 4) (const_int 5)
12854 (const_int 6) (const_int 7)]))
12855 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
12857 "vinsert<shuffletype>32x8\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}"
12858 [(set_attr "type" "sselog")
12859 (set_attr "length_immediate" "1")
12860 (set_attr "prefix" "evex")
12861 (set_attr "mode" "<sseinsnmode>")])
12863 (define_insn "vec_set_lo_<mode><mask_name>"
12864 [(set (match_operand:V8FI 0 "register_operand" "=v")
12866 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
12867 (vec_select:<ssehalfvecmode>
12868 (match_operand:V8FI 1 "register_operand" "v")
12869 (parallel [(const_int 4) (const_int 5)
12870 (const_int 6) (const_int 7)]))))]
12872 "vinsert<shuffletype>64x4\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}"
12873 [(set_attr "type" "sselog")
12874 (set_attr "length_immediate" "1")
12875 (set_attr "prefix" "evex")
12876 (set_attr "mode" "XI")])
12878 (define_insn "vec_set_hi_<mode><mask_name>"
12879 [(set (match_operand:V8FI 0 "register_operand" "=v")
12881 (vec_select:<ssehalfvecmode>
12882 (match_operand:V8FI 1 "register_operand" "v")
12883 (parallel [(const_int 0) (const_int 1)
12884 (const_int 2) (const_int 3)]))
12885 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
12887 "vinsert<shuffletype>64x4\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}"
12888 [(set_attr "type" "sselog")
12889 (set_attr "length_immediate" "1")
12890 (set_attr "prefix" "evex")
12891 (set_attr "mode" "XI")])
12893 (define_expand "avx512dq_shuf_<shuffletype>64x2_mask"
12894 [(match_operand:VI8F_256 0 "register_operand")
12895 (match_operand:VI8F_256 1 "register_operand")
12896 (match_operand:VI8F_256 2 "nonimmediate_operand")
12897 (match_operand:SI 3 "const_0_to_3_operand")
12898 (match_operand:VI8F_256 4 "register_operand")
12899 (match_operand:QI 5 "register_operand")]
12902 int mask = INTVAL (operands[3]);
12903 emit_insn (gen_avx512dq_shuf_<shuffletype>64x2_1_mask
12904 (operands[0], operands[1], operands[2],
12905 GEN_INT (((mask >> 0) & 1) * 2 + 0),
12906 GEN_INT (((mask >> 0) & 1) * 2 + 1),
12907 GEN_INT (((mask >> 1) & 1) * 2 + 4),
12908 GEN_INT (((mask >> 1) & 1) * 2 + 5),
12909 operands[4], operands[5]));
12913 (define_insn "<mask_codefor>avx512dq_shuf_<shuffletype>64x2_1<mask_name>"
12914 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
12915 (vec_select:VI8F_256
12916 (vec_concat:<ssedoublemode>
12917 (match_operand:VI8F_256 1 "register_operand" "v")
12918 (match_operand:VI8F_256 2 "nonimmediate_operand" "vm"))
12919 (parallel [(match_operand 3 "const_0_to_3_operand")
12920 (match_operand 4 "const_0_to_3_operand")
12921 (match_operand 5 "const_4_to_7_operand")
12922 (match_operand 6 "const_4_to_7_operand")])))]
12924 && (INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
12925 && INTVAL (operands[5]) == (INTVAL (operands[6]) - 1))"
12928 mask = INTVAL (operands[3]) / 2;
12929 mask |= (INTVAL (operands[5]) - 4) / 2 << 1;
12930 operands[3] = GEN_INT (mask);
12931 return "vshuf<shuffletype>64x2\t{%3, %2, %1, %0<mask_operand7>|%0<mask_operand7>, %1, %2, %3}";
12933 [(set_attr "type" "sselog")
12934 (set_attr "length_immediate" "1")
12935 (set_attr "prefix" "evex")
12936 (set_attr "mode" "XI")])
12938 (define_expand "avx512f_shuf_<shuffletype>64x2_mask"
12939 [(match_operand:V8FI 0 "register_operand")
12940 (match_operand:V8FI 1 "register_operand")
12941 (match_operand:V8FI 2 "nonimmediate_operand")
12942 (match_operand:SI 3 "const_0_to_255_operand")
12943 (match_operand:V8FI 4 "register_operand")
12944 (match_operand:QI 5 "register_operand")]
12947 int mask = INTVAL (operands[3]);
12948 emit_insn (gen_avx512f_shuf_<shuffletype>64x2_1_mask
12949 (operands[0], operands[1], operands[2],
12950 GEN_INT (((mask >> 0) & 3) * 2),
12951 GEN_INT (((mask >> 0) & 3) * 2 + 1),
12952 GEN_INT (((mask >> 2) & 3) * 2),
12953 GEN_INT (((mask >> 2) & 3) * 2 + 1),
12954 GEN_INT (((mask >> 4) & 3) * 2 + 8),
12955 GEN_INT (((mask >> 4) & 3) * 2 + 9),
12956 GEN_INT (((mask >> 6) & 3) * 2 + 8),
12957 GEN_INT (((mask >> 6) & 3) * 2 + 9),
12958 operands[4], operands[5]));
12962 (define_insn "avx512f_shuf_<shuffletype>64x2_1<mask_name>"
12963 [(set (match_operand:V8FI 0 "register_operand" "=v")
12965 (vec_concat:<ssedoublemode>
12966 (match_operand:V8FI 1 "register_operand" "v")
12967 (match_operand:V8FI 2 "nonimmediate_operand" "vm"))
12968 (parallel [(match_operand 3 "const_0_to_7_operand")
12969 (match_operand 4 "const_0_to_7_operand")
12970 (match_operand 5 "const_0_to_7_operand")
12971 (match_operand 6 "const_0_to_7_operand")
12972 (match_operand 7 "const_8_to_15_operand")
12973 (match_operand 8 "const_8_to_15_operand")
12974 (match_operand 9 "const_8_to_15_operand")
12975 (match_operand 10 "const_8_to_15_operand")])))]
12977 && (INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
12978 && INTVAL (operands[5]) == (INTVAL (operands[6]) - 1)
12979 && INTVAL (operands[7]) == (INTVAL (operands[8]) - 1)
12980 && INTVAL (operands[9]) == (INTVAL (operands[10]) - 1))"
12983 mask = INTVAL (operands[3]) / 2;
12984 mask |= INTVAL (operands[5]) / 2 << 2;
12985 mask |= (INTVAL (operands[7]) - 8) / 2 << 4;
12986 mask |= (INTVAL (operands[9]) - 8) / 2 << 6;
12987 operands[3] = GEN_INT (mask);
12989 return "vshuf<shuffletype>64x2\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
12991 [(set_attr "type" "sselog")
12992 (set_attr "length_immediate" "1")
12993 (set_attr "prefix" "evex")
12994 (set_attr "mode" "<sseinsnmode>")])
12996 (define_expand "avx512vl_shuf_<shuffletype>32x4_mask"
12997 [(match_operand:VI4F_256 0 "register_operand")
12998 (match_operand:VI4F_256 1 "register_operand")
12999 (match_operand:VI4F_256 2 "nonimmediate_operand")
13000 (match_operand:SI 3 "const_0_to_3_operand")
13001 (match_operand:VI4F_256 4 "register_operand")
13002 (match_operand:QI 5 "register_operand")]
13005 int mask = INTVAL (operands[3]);
13006 emit_insn (gen_avx512vl_shuf_<shuffletype>32x4_1_mask
13007 (operands[0], operands[1], operands[2],
13008 GEN_INT (((mask >> 0) & 1) * 4 + 0),
13009 GEN_INT (((mask >> 0) & 1) * 4 + 1),
13010 GEN_INT (((mask >> 0) & 1) * 4 + 2),
13011 GEN_INT (((mask >> 0) & 1) * 4 + 3),
13012 GEN_INT (((mask >> 1) & 1) * 4 + 8),
13013 GEN_INT (((mask >> 1) & 1) * 4 + 9),
13014 GEN_INT (((mask >> 1) & 1) * 4 + 10),
13015 GEN_INT (((mask >> 1) & 1) * 4 + 11),
13016 operands[4], operands[5]));
13020 (define_insn "avx512vl_shuf_<shuffletype>32x4_1<mask_name>"
13021 [(set (match_operand:VI4F_256 0 "register_operand" "=v")
13022 (vec_select:VI4F_256
13023 (vec_concat:<ssedoublemode>
13024 (match_operand:VI4F_256 1 "register_operand" "v")
13025 (match_operand:VI4F_256 2 "nonimmediate_operand" "vm"))
13026 (parallel [(match_operand 3 "const_0_to_7_operand")
13027 (match_operand 4 "const_0_to_7_operand")
13028 (match_operand 5 "const_0_to_7_operand")
13029 (match_operand 6 "const_0_to_7_operand")
13030 (match_operand 7 "const_8_to_15_operand")
13031 (match_operand 8 "const_8_to_15_operand")
13032 (match_operand 9 "const_8_to_15_operand")
13033 (match_operand 10 "const_8_to_15_operand")])))]
13035 && (INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
13036 && INTVAL (operands[3]) == (INTVAL (operands[5]) - 2)
13037 && INTVAL (operands[3]) == (INTVAL (operands[6]) - 3)
13038 && INTVAL (operands[7]) == (INTVAL (operands[8]) - 1)
13039 && INTVAL (operands[7]) == (INTVAL (operands[9]) - 2)
13040 && INTVAL (operands[7]) == (INTVAL (operands[10]) - 3))"
13043 mask = INTVAL (operands[3]) / 4;
13044 mask |= (INTVAL (operands[7]) - 8) / 4 << 1;
13045 operands[3] = GEN_INT (mask);
13047 return "vshuf<shuffletype>32x4\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
13049 [(set_attr "type" "sselog")
13050 (set_attr "length_immediate" "1")
13051 (set_attr "prefix" "evex")
13052 (set_attr "mode" "<sseinsnmode>")])
13054 (define_expand "avx512f_shuf_<shuffletype>32x4_mask"
13055 [(match_operand:V16FI 0 "register_operand")
13056 (match_operand:V16FI 1 "register_operand")
13057 (match_operand:V16FI 2 "nonimmediate_operand")
13058 (match_operand:SI 3 "const_0_to_255_operand")
13059 (match_operand:V16FI 4 "register_operand")
13060 (match_operand:HI 5 "register_operand")]
13063 int mask = INTVAL (operands[3]);
13064 emit_insn (gen_avx512f_shuf_<shuffletype>32x4_1_mask
13065 (operands[0], operands[1], operands[2],
13066 GEN_INT (((mask >> 0) & 3) * 4),
13067 GEN_INT (((mask >> 0) & 3) * 4 + 1),
13068 GEN_INT (((mask >> 0) & 3) * 4 + 2),
13069 GEN_INT (((mask >> 0) & 3) * 4 + 3),
13070 GEN_INT (((mask >> 2) & 3) * 4),
13071 GEN_INT (((mask >> 2) & 3) * 4 + 1),
13072 GEN_INT (((mask >> 2) & 3) * 4 + 2),
13073 GEN_INT (((mask >> 2) & 3) * 4 + 3),
13074 GEN_INT (((mask >> 4) & 3) * 4 + 16),
13075 GEN_INT (((mask >> 4) & 3) * 4 + 17),
13076 GEN_INT (((mask >> 4) & 3) * 4 + 18),
13077 GEN_INT (((mask >> 4) & 3) * 4 + 19),
13078 GEN_INT (((mask >> 6) & 3) * 4 + 16),
13079 GEN_INT (((mask >> 6) & 3) * 4 + 17),
13080 GEN_INT (((mask >> 6) & 3) * 4 + 18),
13081 GEN_INT (((mask >> 6) & 3) * 4 + 19),
13082 operands[4], operands[5]));
13086 (define_insn "avx512f_shuf_<shuffletype>32x4_1<mask_name>"
13087 [(set (match_operand:V16FI 0 "register_operand" "=v")
13089 (vec_concat:<ssedoublemode>
13090 (match_operand:V16FI 1 "register_operand" "v")
13091 (match_operand:V16FI 2 "nonimmediate_operand" "vm"))
13092 (parallel [(match_operand 3 "const_0_to_15_operand")
13093 (match_operand 4 "const_0_to_15_operand")
13094 (match_operand 5 "const_0_to_15_operand")
13095 (match_operand 6 "const_0_to_15_operand")
13096 (match_operand 7 "const_0_to_15_operand")
13097 (match_operand 8 "const_0_to_15_operand")
13098 (match_operand 9 "const_0_to_15_operand")
13099 (match_operand 10 "const_0_to_15_operand")
13100 (match_operand 11 "const_16_to_31_operand")
13101 (match_operand 12 "const_16_to_31_operand")
13102 (match_operand 13 "const_16_to_31_operand")
13103 (match_operand 14 "const_16_to_31_operand")
13104 (match_operand 15 "const_16_to_31_operand")
13105 (match_operand 16 "const_16_to_31_operand")
13106 (match_operand 17 "const_16_to_31_operand")
13107 (match_operand 18 "const_16_to_31_operand")])))]
13109 && (INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
13110 && INTVAL (operands[3]) == (INTVAL (operands[5]) - 2)
13111 && INTVAL (operands[3]) == (INTVAL (operands[6]) - 3)
13112 && INTVAL (operands[7]) == (INTVAL (operands[8]) - 1)
13113 && INTVAL (operands[7]) == (INTVAL (operands[9]) - 2)
13114 && INTVAL (operands[7]) == (INTVAL (operands[10]) - 3)
13115 && INTVAL (operands[11]) == (INTVAL (operands[12]) - 1)
13116 && INTVAL (operands[11]) == (INTVAL (operands[13]) - 2)
13117 && INTVAL (operands[11]) == (INTVAL (operands[14]) - 3)
13118 && INTVAL (operands[15]) == (INTVAL (operands[16]) - 1)
13119 && INTVAL (operands[15]) == (INTVAL (operands[17]) - 2)
13120 && INTVAL (operands[15]) == (INTVAL (operands[18]) - 3))"
13123 mask = INTVAL (operands[3]) / 4;
13124 mask |= INTVAL (operands[7]) / 4 << 2;
13125 mask |= (INTVAL (operands[11]) - 16) / 4 << 4;
13126 mask |= (INTVAL (operands[15]) - 16) / 4 << 6;
13127 operands[3] = GEN_INT (mask);
13129 return "vshuf<shuffletype>32x4\t{%3, %2, %1, %0<mask_operand19>|%0<mask_operand19>, %1, %2, %3}";
13131 [(set_attr "type" "sselog")
13132 (set_attr "length_immediate" "1")
13133 (set_attr "prefix" "evex")
13134 (set_attr "mode" "<sseinsnmode>")])
13136 (define_expand "avx512f_pshufdv3_mask"
13137 [(match_operand:V16SI 0 "register_operand")
13138 (match_operand:V16SI 1 "nonimmediate_operand")
13139 (match_operand:SI 2 "const_0_to_255_operand")
13140 (match_operand:V16SI 3 "register_operand")
13141 (match_operand:HI 4 "register_operand")]
13144 int mask = INTVAL (operands[2]);
13145 emit_insn (gen_avx512f_pshufd_1_mask (operands[0], operands[1],
13146 GEN_INT ((mask >> 0) & 3),
13147 GEN_INT ((mask >> 2) & 3),
13148 GEN_INT ((mask >> 4) & 3),
13149 GEN_INT ((mask >> 6) & 3),
13150 GEN_INT (((mask >> 0) & 3) + 4),
13151 GEN_INT (((mask >> 2) & 3) + 4),
13152 GEN_INT (((mask >> 4) & 3) + 4),
13153 GEN_INT (((mask >> 6) & 3) + 4),
13154 GEN_INT (((mask >> 0) & 3) + 8),
13155 GEN_INT (((mask >> 2) & 3) + 8),
13156 GEN_INT (((mask >> 4) & 3) + 8),
13157 GEN_INT (((mask >> 6) & 3) + 8),
13158 GEN_INT (((mask >> 0) & 3) + 12),
13159 GEN_INT (((mask >> 2) & 3) + 12),
13160 GEN_INT (((mask >> 4) & 3) + 12),
13161 GEN_INT (((mask >> 6) & 3) + 12),
13162 operands[3], operands[4]));
13166 (define_insn "avx512f_pshufd_1<mask_name>"
13167 [(set (match_operand:V16SI 0 "register_operand" "=v")
13169 (match_operand:V16SI 1 "nonimmediate_operand" "vm")
13170 (parallel [(match_operand 2 "const_0_to_3_operand")
13171 (match_operand 3 "const_0_to_3_operand")
13172 (match_operand 4 "const_0_to_3_operand")
13173 (match_operand 5 "const_0_to_3_operand")
13174 (match_operand 6 "const_4_to_7_operand")
13175 (match_operand 7 "const_4_to_7_operand")
13176 (match_operand 8 "const_4_to_7_operand")
13177 (match_operand 9 "const_4_to_7_operand")
13178 (match_operand 10 "const_8_to_11_operand")
13179 (match_operand 11 "const_8_to_11_operand")
13180 (match_operand 12 "const_8_to_11_operand")
13181 (match_operand 13 "const_8_to_11_operand")
13182 (match_operand 14 "const_12_to_15_operand")
13183 (match_operand 15 "const_12_to_15_operand")
13184 (match_operand 16 "const_12_to_15_operand")
13185 (match_operand 17 "const_12_to_15_operand")])))]
13187 && INTVAL (operands[2]) + 4 == INTVAL (operands[6])
13188 && INTVAL (operands[3]) + 4 == INTVAL (operands[7])
13189 && INTVAL (operands[4]) + 4 == INTVAL (operands[8])
13190 && INTVAL (operands[5]) + 4 == INTVAL (operands[9])
13191 && INTVAL (operands[2]) + 8 == INTVAL (operands[10])
13192 && INTVAL (operands[3]) + 8 == INTVAL (operands[11])
13193 && INTVAL (operands[4]) + 8 == INTVAL (operands[12])
13194 && INTVAL (operands[5]) + 8 == INTVAL (operands[13])
13195 && INTVAL (operands[2]) + 12 == INTVAL (operands[14])
13196 && INTVAL (operands[3]) + 12 == INTVAL (operands[15])
13197 && INTVAL (operands[4]) + 12 == INTVAL (operands[16])
13198 && INTVAL (operands[5]) + 12 == INTVAL (operands[17])"
13201 mask |= INTVAL (operands[2]) << 0;
13202 mask |= INTVAL (operands[3]) << 2;
13203 mask |= INTVAL (operands[4]) << 4;
13204 mask |= INTVAL (operands[5]) << 6;
13205 operands[2] = GEN_INT (mask);
13207 return "vpshufd\t{%2, %1, %0<mask_operand18>|%0<mask_operand18>, %1, %2}";
13209 [(set_attr "type" "sselog1")
13210 (set_attr "prefix" "evex")
13211 (set_attr "length_immediate" "1")
13212 (set_attr "mode" "XI")])
13214 (define_expand "avx512vl_pshufdv3_mask"
13215 [(match_operand:V8SI 0 "register_operand")
13216 (match_operand:V8SI 1 "nonimmediate_operand")
13217 (match_operand:SI 2 "const_0_to_255_operand")
13218 (match_operand:V8SI 3 "register_operand")
13219 (match_operand:QI 4 "register_operand")]
13222 int mask = INTVAL (operands[2]);
13223 emit_insn (gen_avx2_pshufd_1_mask (operands[0], operands[1],
13224 GEN_INT ((mask >> 0) & 3),
13225 GEN_INT ((mask >> 2) & 3),
13226 GEN_INT ((mask >> 4) & 3),
13227 GEN_INT ((mask >> 6) & 3),
13228 GEN_INT (((mask >> 0) & 3) + 4),
13229 GEN_INT (((mask >> 2) & 3) + 4),
13230 GEN_INT (((mask >> 4) & 3) + 4),
13231 GEN_INT (((mask >> 6) & 3) + 4),
13232 operands[3], operands[4]));
13236 (define_expand "avx2_pshufdv3"
13237 [(match_operand:V8SI 0 "register_operand")
13238 (match_operand:V8SI 1 "nonimmediate_operand")
13239 (match_operand:SI 2 "const_0_to_255_operand")]
13242 int mask = INTVAL (operands[2]);
13243 emit_insn (gen_avx2_pshufd_1 (operands[0], operands[1],
13244 GEN_INT ((mask >> 0) & 3),
13245 GEN_INT ((mask >> 2) & 3),
13246 GEN_INT ((mask >> 4) & 3),
13247 GEN_INT ((mask >> 6) & 3),
13248 GEN_INT (((mask >> 0) & 3) + 4),
13249 GEN_INT (((mask >> 2) & 3) + 4),
13250 GEN_INT (((mask >> 4) & 3) + 4),
13251 GEN_INT (((mask >> 6) & 3) + 4)));
13255 (define_insn "avx2_pshufd_1<mask_name>"
13256 [(set (match_operand:V8SI 0 "register_operand" "=v")
13258 (match_operand:V8SI 1 "nonimmediate_operand" "vm")
13259 (parallel [(match_operand 2 "const_0_to_3_operand")
13260 (match_operand 3 "const_0_to_3_operand")
13261 (match_operand 4 "const_0_to_3_operand")
13262 (match_operand 5 "const_0_to_3_operand")
13263 (match_operand 6 "const_4_to_7_operand")
13264 (match_operand 7 "const_4_to_7_operand")
13265 (match_operand 8 "const_4_to_7_operand")
13266 (match_operand 9 "const_4_to_7_operand")])))]
13268 && <mask_avx512vl_condition>
13269 && INTVAL (operands[2]) + 4 == INTVAL (operands[6])
13270 && INTVAL (operands[3]) + 4 == INTVAL (operands[7])
13271 && INTVAL (operands[4]) + 4 == INTVAL (operands[8])
13272 && INTVAL (operands[5]) + 4 == INTVAL (operands[9])"
13275 mask |= INTVAL (operands[2]) << 0;
13276 mask |= INTVAL (operands[3]) << 2;
13277 mask |= INTVAL (operands[4]) << 4;
13278 mask |= INTVAL (operands[5]) << 6;
13279 operands[2] = GEN_INT (mask);
13281 return "vpshufd\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
13283 [(set_attr "type" "sselog1")
13284 (set_attr "prefix" "maybe_evex")
13285 (set_attr "length_immediate" "1")
13286 (set_attr "mode" "OI")])
13288 (define_expand "avx512vl_pshufd_mask"
13289 [(match_operand:V4SI 0 "register_operand")
13290 (match_operand:V4SI 1 "nonimmediate_operand")
13291 (match_operand:SI 2 "const_0_to_255_operand")
13292 (match_operand:V4SI 3 "register_operand")
13293 (match_operand:QI 4 "register_operand")]
13296 int mask = INTVAL (operands[2]);
13297 emit_insn (gen_sse2_pshufd_1_mask (operands[0], operands[1],
13298 GEN_INT ((mask >> 0) & 3),
13299 GEN_INT ((mask >> 2) & 3),
13300 GEN_INT ((mask >> 4) & 3),
13301 GEN_INT ((mask >> 6) & 3),
13302 operands[3], operands[4]));
13306 (define_expand "sse2_pshufd"
13307 [(match_operand:V4SI 0 "register_operand")
13308 (match_operand:V4SI 1 "vector_operand")
13309 (match_operand:SI 2 "const_int_operand")]
13312 int mask = INTVAL (operands[2]);
13313 emit_insn (gen_sse2_pshufd_1 (operands[0], operands[1],
13314 GEN_INT ((mask >> 0) & 3),
13315 GEN_INT ((mask >> 2) & 3),
13316 GEN_INT ((mask >> 4) & 3),
13317 GEN_INT ((mask >> 6) & 3)));
13321 (define_insn "sse2_pshufd_1<mask_name>"
13322 [(set (match_operand:V4SI 0 "register_operand" "=v")
13324 (match_operand:V4SI 1 "vector_operand" "vBm")
13325 (parallel [(match_operand 2 "const_0_to_3_operand")
13326 (match_operand 3 "const_0_to_3_operand")
13327 (match_operand 4 "const_0_to_3_operand")
13328 (match_operand 5 "const_0_to_3_operand")])))]
13329 "TARGET_SSE2 && <mask_avx512vl_condition>"
13332 mask |= INTVAL (operands[2]) << 0;
13333 mask |= INTVAL (operands[3]) << 2;
13334 mask |= INTVAL (operands[4]) << 4;
13335 mask |= INTVAL (operands[5]) << 6;
13336 operands[2] = GEN_INT (mask);
13338 return "%vpshufd\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
13340 [(set_attr "type" "sselog1")
13341 (set_attr "prefix_data16" "1")
13342 (set_attr "prefix" "<mask_prefix2>")
13343 (set_attr "length_immediate" "1")
13344 (set_attr "mode" "TI")])
13346 (define_insn "<mask_codefor>avx512bw_pshuflwv32hi<mask_name>"
13347 [(set (match_operand:V32HI 0 "register_operand" "=v")
13349 [(match_operand:V32HI 1 "nonimmediate_operand" "vm")
13350 (match_operand:SI 2 "const_0_to_255_operand" "n")]
13353 "vpshuflw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13354 [(set_attr "type" "sselog")
13355 (set_attr "prefix" "evex")
13356 (set_attr "mode" "XI")])
13358 (define_expand "avx512vl_pshuflwv3_mask"
13359 [(match_operand:V16HI 0 "register_operand")
13360 (match_operand:V16HI 1 "nonimmediate_operand")
13361 (match_operand:SI 2 "const_0_to_255_operand")
13362 (match_operand:V16HI 3 "register_operand")
13363 (match_operand:HI 4 "register_operand")]
13364 "TARGET_AVX512VL && TARGET_AVX512BW"
13366 int mask = INTVAL (operands[2]);
13367 emit_insn (gen_avx2_pshuflw_1_mask (operands[0], operands[1],
13368 GEN_INT ((mask >> 0) & 3),
13369 GEN_INT ((mask >> 2) & 3),
13370 GEN_INT ((mask >> 4) & 3),
13371 GEN_INT ((mask >> 6) & 3),
13372 GEN_INT (((mask >> 0) & 3) + 8),
13373 GEN_INT (((mask >> 2) & 3) + 8),
13374 GEN_INT (((mask >> 4) & 3) + 8),
13375 GEN_INT (((mask >> 6) & 3) + 8),
13376 operands[3], operands[4]));
13380 (define_expand "avx2_pshuflwv3"
13381 [(match_operand:V16HI 0 "register_operand")
13382 (match_operand:V16HI 1 "nonimmediate_operand")
13383 (match_operand:SI 2 "const_0_to_255_operand")]
13386 int mask = INTVAL (operands[2]);
13387 emit_insn (gen_avx2_pshuflw_1 (operands[0], operands[1],
13388 GEN_INT ((mask >> 0) & 3),
13389 GEN_INT ((mask >> 2) & 3),
13390 GEN_INT ((mask >> 4) & 3),
13391 GEN_INT ((mask >> 6) & 3),
13392 GEN_INT (((mask >> 0) & 3) + 8),
13393 GEN_INT (((mask >> 2) & 3) + 8),
13394 GEN_INT (((mask >> 4) & 3) + 8),
13395 GEN_INT (((mask >> 6) & 3) + 8)));
13399 (define_insn "avx2_pshuflw_1<mask_name>"
13400 [(set (match_operand:V16HI 0 "register_operand" "=v")
13402 (match_operand:V16HI 1 "nonimmediate_operand" "vm")
13403 (parallel [(match_operand 2 "const_0_to_3_operand")
13404 (match_operand 3 "const_0_to_3_operand")
13405 (match_operand 4 "const_0_to_3_operand")
13406 (match_operand 5 "const_0_to_3_operand")
13411 (match_operand 6 "const_8_to_11_operand")
13412 (match_operand 7 "const_8_to_11_operand")
13413 (match_operand 8 "const_8_to_11_operand")
13414 (match_operand 9 "const_8_to_11_operand")
13418 (const_int 15)])))]
13420 && <mask_avx512bw_condition> && <mask_avx512vl_condition>
13421 && INTVAL (operands[2]) + 8 == INTVAL (operands[6])
13422 && INTVAL (operands[3]) + 8 == INTVAL (operands[7])
13423 && INTVAL (operands[4]) + 8 == INTVAL (operands[8])
13424 && INTVAL (operands[5]) + 8 == INTVAL (operands[9])"
13427 mask |= INTVAL (operands[2]) << 0;
13428 mask |= INTVAL (operands[3]) << 2;
13429 mask |= INTVAL (operands[4]) << 4;
13430 mask |= INTVAL (operands[5]) << 6;
13431 operands[2] = GEN_INT (mask);
13433 return "vpshuflw\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
13435 [(set_attr "type" "sselog")
13436 (set_attr "prefix" "maybe_evex")
13437 (set_attr "length_immediate" "1")
13438 (set_attr "mode" "OI")])
13440 (define_expand "avx512vl_pshuflw_mask"
13441 [(match_operand:V8HI 0 "register_operand")
13442 (match_operand:V8HI 1 "nonimmediate_operand")
13443 (match_operand:SI 2 "const_0_to_255_operand")
13444 (match_operand:V8HI 3 "register_operand")
13445 (match_operand:QI 4 "register_operand")]
13446 "TARGET_AVX512VL && TARGET_AVX512BW"
13448 int mask = INTVAL (operands[2]);
13449 emit_insn (gen_sse2_pshuflw_1_mask (operands[0], operands[1],
13450 GEN_INT ((mask >> 0) & 3),
13451 GEN_INT ((mask >> 2) & 3),
13452 GEN_INT ((mask >> 4) & 3),
13453 GEN_INT ((mask >> 6) & 3),
13454 operands[3], operands[4]));
13458 (define_expand "sse2_pshuflw"
13459 [(match_operand:V8HI 0 "register_operand")
13460 (match_operand:V8HI 1 "vector_operand")
13461 (match_operand:SI 2 "const_int_operand")]
13464 int mask = INTVAL (operands[2]);
13465 emit_insn (gen_sse2_pshuflw_1 (operands[0], operands[1],
13466 GEN_INT ((mask >> 0) & 3),
13467 GEN_INT ((mask >> 2) & 3),
13468 GEN_INT ((mask >> 4) & 3),
13469 GEN_INT ((mask >> 6) & 3)));
13473 (define_insn "sse2_pshuflw_1<mask_name>"
13474 [(set (match_operand:V8HI 0 "register_operand" "=v")
13476 (match_operand:V8HI 1 "vector_operand" "vBm")
13477 (parallel [(match_operand 2 "const_0_to_3_operand")
13478 (match_operand 3 "const_0_to_3_operand")
13479 (match_operand 4 "const_0_to_3_operand")
13480 (match_operand 5 "const_0_to_3_operand")
13485 "TARGET_SSE2 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
13488 mask |= INTVAL (operands[2]) << 0;
13489 mask |= INTVAL (operands[3]) << 2;
13490 mask |= INTVAL (operands[4]) << 4;
13491 mask |= INTVAL (operands[5]) << 6;
13492 operands[2] = GEN_INT (mask);
13494 return "%vpshuflw\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
13496 [(set_attr "type" "sselog")
13497 (set_attr "prefix_data16" "0")
13498 (set_attr "prefix_rep" "1")
13499 (set_attr "prefix" "maybe_vex")
13500 (set_attr "length_immediate" "1")
13501 (set_attr "mode" "TI")])
13503 (define_expand "avx2_pshufhwv3"
13504 [(match_operand:V16HI 0 "register_operand")
13505 (match_operand:V16HI 1 "nonimmediate_operand")
13506 (match_operand:SI 2 "const_0_to_255_operand")]
13509 int mask = INTVAL (operands[2]);
13510 emit_insn (gen_avx2_pshufhw_1 (operands[0], operands[1],
13511 GEN_INT (((mask >> 0) & 3) + 4),
13512 GEN_INT (((mask >> 2) & 3) + 4),
13513 GEN_INT (((mask >> 4) & 3) + 4),
13514 GEN_INT (((mask >> 6) & 3) + 4),
13515 GEN_INT (((mask >> 0) & 3) + 12),
13516 GEN_INT (((mask >> 2) & 3) + 12),
13517 GEN_INT (((mask >> 4) & 3) + 12),
13518 GEN_INT (((mask >> 6) & 3) + 12)));
13522 (define_insn "<mask_codefor>avx512bw_pshufhwv32hi<mask_name>"
13523 [(set (match_operand:V32HI 0 "register_operand" "=v")
13525 [(match_operand:V32HI 1 "nonimmediate_operand" "vm")
13526 (match_operand:SI 2 "const_0_to_255_operand" "n")]
13529 "vpshufhw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13530 [(set_attr "type" "sselog")
13531 (set_attr "prefix" "evex")
13532 (set_attr "mode" "XI")])
13534 (define_expand "avx512vl_pshufhwv3_mask"
13535 [(match_operand:V16HI 0 "register_operand")
13536 (match_operand:V16HI 1 "nonimmediate_operand")
13537 (match_operand:SI 2 "const_0_to_255_operand")
13538 (match_operand:V16HI 3 "register_operand")
13539 (match_operand:HI 4 "register_operand")]
13540 "TARGET_AVX512VL && TARGET_AVX512BW"
13542 int mask = INTVAL (operands[2]);
13543 emit_insn (gen_avx2_pshufhw_1_mask (operands[0], operands[1],
13544 GEN_INT (((mask >> 0) & 3) + 4),
13545 GEN_INT (((mask >> 2) & 3) + 4),
13546 GEN_INT (((mask >> 4) & 3) + 4),
13547 GEN_INT (((mask >> 6) & 3) + 4),
13548 GEN_INT (((mask >> 0) & 3) + 12),
13549 GEN_INT (((mask >> 2) & 3) + 12),
13550 GEN_INT (((mask >> 4) & 3) + 12),
13551 GEN_INT (((mask >> 6) & 3) + 12),
13552 operands[3], operands[4]));
13556 (define_insn "avx2_pshufhw_1<mask_name>"
13557 [(set (match_operand:V16HI 0 "register_operand" "=v")
13559 (match_operand:V16HI 1 "nonimmediate_operand" "vm")
13560 (parallel [(const_int 0)
13564 (match_operand 2 "const_4_to_7_operand")
13565 (match_operand 3 "const_4_to_7_operand")
13566 (match_operand 4 "const_4_to_7_operand")
13567 (match_operand 5 "const_4_to_7_operand")
13572 (match_operand 6 "const_12_to_15_operand")
13573 (match_operand 7 "const_12_to_15_operand")
13574 (match_operand 8 "const_12_to_15_operand")
13575 (match_operand 9 "const_12_to_15_operand")])))]
13577 && <mask_avx512bw_condition> && <mask_avx512vl_condition>
13578 && INTVAL (operands[2]) + 8 == INTVAL (operands[6])
13579 && INTVAL (operands[3]) + 8 == INTVAL (operands[7])
13580 && INTVAL (operands[4]) + 8 == INTVAL (operands[8])
13581 && INTVAL (operands[5]) + 8 == INTVAL (operands[9])"
13584 mask |= (INTVAL (operands[2]) - 4) << 0;
13585 mask |= (INTVAL (operands[3]) - 4) << 2;
13586 mask |= (INTVAL (operands[4]) - 4) << 4;
13587 mask |= (INTVAL (operands[5]) - 4) << 6;
13588 operands[2] = GEN_INT (mask);
13590 return "vpshufhw\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
13592 [(set_attr "type" "sselog")
13593 (set_attr "prefix" "maybe_evex")
13594 (set_attr "length_immediate" "1")
13595 (set_attr "mode" "OI")])
13597 (define_expand "avx512vl_pshufhw_mask"
13598 [(match_operand:V8HI 0 "register_operand")
13599 (match_operand:V8HI 1 "nonimmediate_operand")
13600 (match_operand:SI 2 "const_0_to_255_operand")
13601 (match_operand:V8HI 3 "register_operand")
13602 (match_operand:QI 4 "register_operand")]
13603 "TARGET_AVX512VL && TARGET_AVX512BW"
13605 int mask = INTVAL (operands[2]);
13606 emit_insn (gen_sse2_pshufhw_1_mask (operands[0], operands[1],
13607 GEN_INT (((mask >> 0) & 3) + 4),
13608 GEN_INT (((mask >> 2) & 3) + 4),
13609 GEN_INT (((mask >> 4) & 3) + 4),
13610 GEN_INT (((mask >> 6) & 3) + 4),
13611 operands[3], operands[4]));
13615 (define_expand "sse2_pshufhw"
13616 [(match_operand:V8HI 0 "register_operand")
13617 (match_operand:V8HI 1 "vector_operand")
13618 (match_operand:SI 2 "const_int_operand")]
13621 int mask = INTVAL (operands[2]);
13622 emit_insn (gen_sse2_pshufhw_1 (operands[0], operands[1],
13623 GEN_INT (((mask >> 0) & 3) + 4),
13624 GEN_INT (((mask >> 2) & 3) + 4),
13625 GEN_INT (((mask >> 4) & 3) + 4),
13626 GEN_INT (((mask >> 6) & 3) + 4)));
13630 (define_insn "sse2_pshufhw_1<mask_name>"
13631 [(set (match_operand:V8HI 0 "register_operand" "=v")
13633 (match_operand:V8HI 1 "vector_operand" "vBm")
13634 (parallel [(const_int 0)
13638 (match_operand 2 "const_4_to_7_operand")
13639 (match_operand 3 "const_4_to_7_operand")
13640 (match_operand 4 "const_4_to_7_operand")
13641 (match_operand 5 "const_4_to_7_operand")])))]
13642 "TARGET_SSE2 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
13645 mask |= (INTVAL (operands[2]) - 4) << 0;
13646 mask |= (INTVAL (operands[3]) - 4) << 2;
13647 mask |= (INTVAL (operands[4]) - 4) << 4;
13648 mask |= (INTVAL (operands[5]) - 4) << 6;
13649 operands[2] = GEN_INT (mask);
13651 return "%vpshufhw\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
13653 [(set_attr "type" "sselog")
13654 (set_attr "prefix_rep" "1")
13655 (set_attr "prefix_data16" "0")
13656 (set_attr "prefix" "maybe_vex")
13657 (set_attr "length_immediate" "1")
13658 (set_attr "mode" "TI")])
13660 (define_expand "sse2_loadd"
13661 [(set (match_operand:V4SI 0 "register_operand")
13663 (vec_duplicate:V4SI
13664 (match_operand:SI 1 "nonimmediate_operand"))
13668 "operands[2] = CONST0_RTX (V4SImode);")
13670 (define_insn "sse2_loadld"
13671 [(set (match_operand:V4SI 0 "register_operand" "=v,v,x,x,v")
13673 (vec_duplicate:V4SI
13674 (match_operand:SI 2 "nonimmediate_operand" "m ,r ,m,x,v"))
13675 (match_operand:V4SI 1 "reg_or_0_operand" "C ,C ,C,0,v")
13679 %vmovd\t{%2, %0|%0, %2}
13680 %vmovd\t{%2, %0|%0, %2}
13681 movss\t{%2, %0|%0, %2}
13682 movss\t{%2, %0|%0, %2}
13683 vmovss\t{%2, %1, %0|%0, %1, %2}"
13684 [(set_attr "isa" "sse2,sse2,noavx,noavx,avx")
13685 (set_attr "type" "ssemov")
13686 (set_attr "prefix" "maybe_vex,maybe_vex,orig,orig,maybe_evex")
13687 (set_attr "mode" "TI,TI,V4SF,SF,SF")
13688 (set (attr "preferred_for_speed")
13689 (cond [(eq_attr "alternative" "1")
13690 (symbol_ref "TARGET_INTER_UNIT_MOVES_TO_VEC")
13692 (symbol_ref "true")))])
13694 ;; QI and HI modes handled by pextr patterns.
13695 (define_mode_iterator PEXTR_MODE12
13696 [(V16QI "TARGET_SSE4_1") V8HI])
13698 (define_insn "*vec_extract<mode>"
13699 [(set (match_operand:<ssescalarmode> 0 "register_sse4nonimm_operand" "=r,m,r,m")
13700 (vec_select:<ssescalarmode>
13701 (match_operand:PEXTR_MODE12 1 "register_operand" "x,x,v,v")
13703 [(match_operand:SI 2 "const_0_to_<ssescalarnummask>_operand")])))]
13706 %vpextr<ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}
13707 %vpextr<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
13708 vpextr<ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}
13709 vpextr<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
13710 [(set_attr "isa" "*,sse4,avx512bw,avx512bw")
13711 (set_attr "type" "sselog1")
13712 (set_attr "prefix_data16" "1")
13713 (set (attr "prefix_extra")
13715 (and (eq_attr "alternative" "0,2")
13716 (eq (const_string "<MODE>mode") (const_string "V8HImode")))
13718 (const_string "1")))
13719 (set_attr "length_immediate" "1")
13720 (set_attr "prefix" "maybe_vex,maybe_vex,evex,evex")
13721 (set_attr "mode" "TI")])
13723 (define_insn "*vec_extract<PEXTR_MODE12:mode>_zext"
13724 [(set (match_operand:SWI48 0 "register_operand" "=r,r")
13726 (vec_select:<PEXTR_MODE12:ssescalarmode>
13727 (match_operand:PEXTR_MODE12 1 "register_operand" "x,v")
13729 [(match_operand:SI 2
13730 "const_0_to_<PEXTR_MODE12:ssescalarnummask>_operand")]))))]
13733 %vpextr<PEXTR_MODE12:ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}
13734 vpextr<PEXTR_MODE12:ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}"
13735 [(set_attr "isa" "*,avx512bw")
13736 (set_attr "type" "sselog1")
13737 (set_attr "prefix_data16" "1")
13738 (set (attr "prefix_extra")
13740 (eq (const_string "<PEXTR_MODE12:MODE>mode") (const_string "V8HImode"))
13742 (const_string "1")))
13743 (set_attr "length_immediate" "1")
13744 (set_attr "prefix" "maybe_vex")
13745 (set_attr "mode" "TI")])
13747 (define_insn "*vec_extract<mode>_mem"
13748 [(set (match_operand:<ssescalarmode> 0 "register_operand" "=r")
13749 (vec_select:<ssescalarmode>
13750 (match_operand:VI12_128 1 "memory_operand" "o")
13752 [(match_operand 2 "const_0_to_<ssescalarnummask>_operand")])))]
13756 (define_insn "*vec_extract<ssevecmodelower>_0"
13757 [(set (match_operand:SWI48 0 "nonimmediate_operand" "=r,r,v ,m")
13759 (match_operand:<ssevecmode> 1 "nonimmediate_operand" "m ,v,vm,v")
13760 (parallel [(const_int 0)])))]
13761 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
13763 [(set_attr "isa" "*,sse2,*,*")
13764 (set (attr "preferred_for_speed")
13765 (cond [(eq_attr "alternative" "1")
13766 (symbol_ref "TARGET_INTER_UNIT_MOVES_FROM_VEC")
13768 (symbol_ref "true")))])
13770 (define_insn "*vec_extractv2di_0_sse"
13771 [(set (match_operand:DI 0 "nonimmediate_operand" "=v,m")
13773 (match_operand:V2DI 1 "nonimmediate_operand" "vm,v")
13774 (parallel [(const_int 0)])))]
13775 "TARGET_SSE && !TARGET_64BIT
13776 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
13780 [(set (match_operand:SWI48x 0 "nonimmediate_operand")
13782 (match_operand:<ssevecmode> 1 "register_operand")
13783 (parallel [(const_int 0)])))]
13784 "TARGET_SSE && reload_completed"
13785 [(set (match_dup 0) (match_dup 1))]
13786 "operands[1] = gen_lowpart (<MODE>mode, operands[1]);")
13788 (define_insn "*vec_extractv4si_0_zext_sse4"
13789 [(set (match_operand:DI 0 "register_operand" "=r,x,v")
13792 (match_operand:V4SI 1 "register_operand" "v,x,v")
13793 (parallel [(const_int 0)]))))]
13796 [(set_attr "isa" "x64,*,avx512f")
13797 (set (attr "preferred_for_speed")
13798 (cond [(eq_attr "alternative" "1")
13799 (symbol_ref "TARGET_INTER_UNIT_MOVES_FROM_VEC")
13801 (symbol_ref "true")))])
13803 (define_insn "*vec_extractv4si_0_zext"
13804 [(set (match_operand:DI 0 "register_operand" "=r")
13807 (match_operand:V4SI 1 "register_operand" "x")
13808 (parallel [(const_int 0)]))))]
13809 "TARGET_64BIT && TARGET_SSE2 && TARGET_INTER_UNIT_MOVES_FROM_VEC"
13813 [(set (match_operand:DI 0 "register_operand")
13816 (match_operand:V4SI 1 "register_operand")
13817 (parallel [(const_int 0)]))))]
13818 "TARGET_SSE2 && reload_completed"
13819 [(set (match_dup 0) (zero_extend:DI (match_dup 1)))]
13820 "operands[1] = gen_lowpart (SImode, operands[1]);")
13822 (define_insn "*vec_extractv4si"
13823 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,rm,Yr,*x,x,Yv")
13825 (match_operand:V4SI 1 "register_operand" "x,v,0,0,x,v")
13826 (parallel [(match_operand:SI 2 "const_0_to_3_operand")])))]
13829 switch (which_alternative)
13833 return "%vpextrd\t{%2, %1, %0|%0, %1, %2}";
13837 operands[2] = GEN_INT (INTVAL (operands[2]) * 4);
13838 return "psrldq\t{%2, %0|%0, %2}";
13842 operands[2] = GEN_INT (INTVAL (operands[2]) * 4);
13843 return "vpsrldq\t{%2, %1, %0|%0, %1, %2}";
13846 gcc_unreachable ();
13849 [(set_attr "isa" "*,avx512dq,noavx,noavx,avx,avx512bw")
13850 (set_attr "type" "sselog1,sselog1,sseishft1,sseishft1,sseishft1,sseishft1")
13851 (set (attr "prefix_extra")
13852 (if_then_else (eq_attr "alternative" "0,1")
13854 (const_string "*")))
13855 (set_attr "length_immediate" "1")
13856 (set_attr "prefix" "maybe_vex,evex,orig,orig,vex,evex")
13857 (set_attr "mode" "TI")])
13859 (define_insn "*vec_extractv4si_zext"
13860 [(set (match_operand:DI 0 "register_operand" "=r,r")
13863 (match_operand:V4SI 1 "register_operand" "x,v")
13864 (parallel [(match_operand:SI 2 "const_0_to_3_operand")]))))]
13865 "TARGET_64BIT && TARGET_SSE4_1"
13866 "%vpextrd\t{%2, %1, %k0|%k0, %1, %2}"
13867 [(set_attr "isa" "*,avx512dq")
13868 (set_attr "type" "sselog1")
13869 (set_attr "prefix_extra" "1")
13870 (set_attr "length_immediate" "1")
13871 (set_attr "prefix" "maybe_vex")
13872 (set_attr "mode" "TI")])
13874 (define_insn "*vec_extractv4si_mem"
13875 [(set (match_operand:SI 0 "register_operand" "=x,r")
13877 (match_operand:V4SI 1 "memory_operand" "o,o")
13878 (parallel [(match_operand 2 "const_0_to_3_operand")])))]
13882 (define_insn_and_split "*vec_extractv4si_zext_mem"
13883 [(set (match_operand:DI 0 "register_operand" "=x,r")
13886 (match_operand:V4SI 1 "memory_operand" "o,o")
13887 (parallel [(match_operand:SI 2 "const_0_to_3_operand")]))))]
13888 "TARGET_64BIT && TARGET_SSE"
13890 "&& reload_completed"
13891 [(set (match_dup 0) (zero_extend:DI (match_dup 1)))]
13893 operands[1] = adjust_address (operands[1], SImode, INTVAL (operands[2]) * 4);
13896 (define_insn "*vec_extractv2di_1"
13897 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,rm,m,x,x,Yv,x,v,r")
13899 (match_operand:V2DI 1 "nonimmediate_operand" "x ,v ,v,0,x, v,x,o,o")
13900 (parallel [(const_int 1)])))]
13901 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
13903 %vpextrq\t{$1, %1, %0|%0, %1, 1}
13904 vpextrq\t{$1, %1, %0|%0, %1, 1}
13905 %vmovhps\t{%1, %0|%0, %1}
13906 psrldq\t{$8, %0|%0, 8}
13907 vpsrldq\t{$8, %1, %0|%0, %1, 8}
13908 vpsrldq\t{$8, %1, %0|%0, %1, 8}
13909 movhlps\t{%1, %0|%0, %1}
13913 (cond [(eq_attr "alternative" "0")
13914 (const_string "x64_sse4")
13915 (eq_attr "alternative" "1")
13916 (const_string "x64_avx512dq")
13917 (eq_attr "alternative" "3")
13918 (const_string "sse2_noavx")
13919 (eq_attr "alternative" "4")
13920 (const_string "avx")
13921 (eq_attr "alternative" "5")
13922 (const_string "avx512bw")
13923 (eq_attr "alternative" "6")
13924 (const_string "noavx")
13925 (eq_attr "alternative" "8")
13926 (const_string "x64")
13928 (const_string "*")))
13930 (cond [(eq_attr "alternative" "2,6,7")
13931 (const_string "ssemov")
13932 (eq_attr "alternative" "3,4,5")
13933 (const_string "sseishft1")
13934 (eq_attr "alternative" "8")
13935 (const_string "imov")
13937 (const_string "sselog1")))
13938 (set (attr "length_immediate")
13939 (if_then_else (eq_attr "alternative" "0,1,3,4,5")
13941 (const_string "*")))
13942 (set (attr "prefix_rex")
13943 (if_then_else (eq_attr "alternative" "0,1")
13945 (const_string "*")))
13946 (set (attr "prefix_extra")
13947 (if_then_else (eq_attr "alternative" "0,1")
13949 (const_string "*")))
13950 (set_attr "prefix" "maybe_vex,evex,maybe_vex,orig,vex,evex,orig,*,*")
13951 (set_attr "mode" "TI,TI,V2SF,TI,TI,TI,V4SF,DI,DI")])
13954 [(set (match_operand:<ssescalarmode> 0 "register_operand")
13955 (vec_select:<ssescalarmode>
13956 (match_operand:VI_128 1 "memory_operand")
13958 [(match_operand 2 "const_0_to_<ssescalarnummask>_operand")])))]
13959 "TARGET_SSE && reload_completed"
13960 [(set (match_dup 0) (match_dup 1))]
13962 int offs = INTVAL (operands[2]) * GET_MODE_SIZE (<ssescalarmode>mode);
13964 operands[1] = adjust_address (operands[1], <ssescalarmode>mode, offs);
13967 (define_insn "*vec_extractv2ti"
13968 [(set (match_operand:TI 0 "nonimmediate_operand" "=xm,vm")
13970 (match_operand:V2TI 1 "register_operand" "x,v")
13972 [(match_operand:SI 2 "const_0_to_1_operand")])))]
13975 vextract%~128\t{%2, %1, %0|%0, %1, %2}
13976 vextracti32x4\t{%2, %g1, %0|%0, %g1, %2}"
13977 [(set_attr "type" "sselog")
13978 (set_attr "prefix_extra" "1")
13979 (set_attr "length_immediate" "1")
13980 (set_attr "prefix" "vex,evex")
13981 (set_attr "mode" "OI")])
13983 (define_insn "*vec_extractv4ti"
13984 [(set (match_operand:TI 0 "nonimmediate_operand" "=vm")
13986 (match_operand:V4TI 1 "register_operand" "v")
13988 [(match_operand:SI 2 "const_0_to_3_operand")])))]
13990 "vextracti32x4\t{%2, %1, %0|%0, %1, %2}"
13991 [(set_attr "type" "sselog")
13992 (set_attr "prefix_extra" "1")
13993 (set_attr "length_immediate" "1")
13994 (set_attr "prefix" "evex")
13995 (set_attr "mode" "XI")])
13997 (define_mode_iterator VEXTRACTI128_MODE
13998 [(V4TI "TARGET_AVX512F") V2TI])
14001 [(set (match_operand:TI 0 "nonimmediate_operand")
14003 (match_operand:VEXTRACTI128_MODE 1 "register_operand")
14004 (parallel [(const_int 0)])))]
14006 && reload_completed
14007 && (TARGET_AVX512VL || !EXT_REX_SSE_REG_P (operands[1]))"
14008 [(set (match_dup 0) (match_dup 1))]
14009 "operands[1] = gen_lowpart (TImode, operands[1]);")
14011 ;; Turn SImode or DImode extraction from arbitrary SSE/AVX/AVX512F
14012 ;; vector modes into vec_extract*.
14014 [(set (match_operand:SWI48x 0 "nonimmediate_operand")
14015 (subreg:SWI48x (match_operand 1 "register_operand") 0))]
14016 "can_create_pseudo_p ()
14017 && REG_P (operands[1])
14018 && VECTOR_MODE_P (GET_MODE (operands[1]))
14019 && ((TARGET_SSE && GET_MODE_SIZE (GET_MODE (operands[1])) == 16)
14020 || (TARGET_AVX && GET_MODE_SIZE (GET_MODE (operands[1])) == 32)
14021 || (TARGET_AVX512F && GET_MODE_SIZE (GET_MODE (operands[1])) == 64))
14022 && (<MODE>mode == SImode || TARGET_64BIT || MEM_P (operands[0]))"
14023 [(set (match_dup 0) (vec_select:SWI48x (match_dup 1)
14024 (parallel [(const_int 0)])))]
14028 switch (GET_MODE_SIZE (GET_MODE (operands[1])))
14031 if (<MODE>mode == SImode)
14033 tmp = gen_reg_rtx (V8SImode);
14034 emit_insn (gen_vec_extract_lo_v16si (tmp,
14035 gen_lowpart (V16SImode,
14040 tmp = gen_reg_rtx (V4DImode);
14041 emit_insn (gen_vec_extract_lo_v8di (tmp,
14042 gen_lowpart (V8DImode,
14048 tmp = gen_reg_rtx (<ssevecmode>mode);
14049 if (<MODE>mode == SImode)
14050 emit_insn (gen_vec_extract_lo_v8si (tmp, gen_lowpart (V8SImode,
14053 emit_insn (gen_vec_extract_lo_v4di (tmp, gen_lowpart (V4DImode,
14058 operands[1] = gen_lowpart (<ssevecmode>mode, operands[1]);
14063 (define_insn "*vec_concatv2si_sse4_1"
14064 [(set (match_operand:V2SI 0 "register_operand"
14065 "=Yr,*x, x, v,Yr,*x, v, v, *y,*y")
14067 (match_operand:SI 1 "nonimmediate_operand"
14068 " 0, 0, x,Yv, 0, 0,Yv,rm, 0,rm")
14069 (match_operand:SI 2 "vector_move_operand"
14070 " rm,rm,rm,rm,Yr,*x,Yv, C,*ym, C")))]
14071 "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
14073 pinsrd\t{$1, %2, %0|%0, %2, 1}
14074 pinsrd\t{$1, %2, %0|%0, %2, 1}
14075 vpinsrd\t{$1, %2, %1, %0|%0, %1, %2, 1}
14076 vpinsrd\t{$1, %2, %1, %0|%0, %1, %2, 1}
14077 punpckldq\t{%2, %0|%0, %2}
14078 punpckldq\t{%2, %0|%0, %2}
14079 vpunpckldq\t{%2, %1, %0|%0, %1, %2}
14080 %vmovd\t{%1, %0|%0, %1}
14081 punpckldq\t{%2, %0|%0, %2}
14082 movd\t{%1, %0|%0, %1}"
14083 [(set_attr "isa" "noavx,noavx,avx,avx512dq,noavx,noavx,avx,*,*,*")
14085 (cond [(eq_attr "alternative" "7")
14086 (const_string "ssemov")
14087 (eq_attr "alternative" "8")
14088 (const_string "mmxcvt")
14089 (eq_attr "alternative" "9")
14090 (const_string "mmxmov")
14092 (const_string "sselog")))
14093 (set (attr "prefix_extra")
14094 (if_then_else (eq_attr "alternative" "0,1,2,3")
14096 (const_string "*")))
14097 (set (attr "length_immediate")
14098 (if_then_else (eq_attr "alternative" "0,1,2,3")
14100 (const_string "*")))
14101 (set_attr "prefix" "orig,orig,vex,evex,orig,orig,maybe_evex,maybe_vex,orig,orig")
14102 (set_attr "mode" "TI,TI,TI,TI,TI,TI,TI,TI,DI,DI")])
14104 ;; ??? In theory we can match memory for the MMX alternative, but allowing
14105 ;; nonimmediate_operand for operand 2 and *not* allowing memory for the SSE
14106 ;; alternatives pretty much forces the MMX alternative to be chosen.
14107 (define_insn "*vec_concatv2si"
14108 [(set (match_operand:V2SI 0 "register_operand" "=x,x ,*y,x,x,*y,*y")
14110 (match_operand:SI 1 "nonimmediate_operand" " 0,rm,rm,0,m, 0,*rm")
14111 (match_operand:SI 2 "reg_or_0_operand" " x,C ,C, x,C,*y,C")))]
14112 "TARGET_SSE && !TARGET_SSE4_1"
14114 punpckldq\t{%2, %0|%0, %2}
14115 movd\t{%1, %0|%0, %1}
14116 movd\t{%1, %0|%0, %1}
14117 unpcklps\t{%2, %0|%0, %2}
14118 movss\t{%1, %0|%0, %1}
14119 punpckldq\t{%2, %0|%0, %2}
14120 movd\t{%1, %0|%0, %1}"
14121 [(set_attr "isa" "sse2,sse2,sse2,*,*,*,*")
14122 (set_attr "type" "sselog,ssemov,mmxmov,sselog,ssemov,mmxcvt,mmxmov")
14123 (set_attr "mode" "TI,TI,DI,V4SF,SF,DI,DI")])
14125 (define_insn "*vec_concatv4si"
14126 [(set (match_operand:V4SI 0 "register_operand" "=x,v,x,x,v")
14128 (match_operand:V2SI 1 "register_operand" " 0,v,0,0,v")
14129 (match_operand:V2SI 2 "nonimmediate_operand" " x,v,x,m,m")))]
14132 punpcklqdq\t{%2, %0|%0, %2}
14133 vpunpcklqdq\t{%2, %1, %0|%0, %1, %2}
14134 movlhps\t{%2, %0|%0, %2}
14135 movhps\t{%2, %0|%0, %q2}
14136 vmovhps\t{%2, %1, %0|%0, %1, %q2}"
14137 [(set_attr "isa" "sse2_noavx,avx,noavx,noavx,avx")
14138 (set_attr "type" "sselog,sselog,ssemov,ssemov,ssemov")
14139 (set_attr "prefix" "orig,maybe_evex,orig,orig,maybe_evex")
14140 (set_attr "mode" "TI,TI,V4SF,V2SF,V2SF")])
14142 ;; movd instead of movq is required to handle broken assemblers.
14143 (define_insn "vec_concatv2di"
14144 [(set (match_operand:V2DI 0 "register_operand"
14145 "=Yr,*x,x ,v ,v,v ,x ,x,v ,x,x,v")
14147 (match_operand:DI 1 "nonimmediate_operand"
14148 " 0, 0,x ,Yv,r,vm,?!*y,0,Yv,0,0,v")
14149 (match_operand:DI 2 "vector_move_operand"
14150 " rm,rm,rm,rm,C ,C ,C ,x,Yv,x,m,m")))]
14153 pinsrq\t{$1, %2, %0|%0, %2, 1}
14154 pinsrq\t{$1, %2, %0|%0, %2, 1}
14155 vpinsrq\t{$1, %2, %1, %0|%0, %1, %2, 1}
14156 vpinsrq\t{$1, %2, %1, %0|%0, %1, %2, 1}
14157 * return HAVE_AS_IX86_INTERUNIT_MOVQ ? \"%vmovq\t{%1, %0|%0, %1}\" : \"%vmovd\t{%1, %0|%0, %1}\";
14158 %vmovq\t{%1, %0|%0, %1}
14159 movq2dq\t{%1, %0|%0, %1}
14160 punpcklqdq\t{%2, %0|%0, %2}
14161 vpunpcklqdq\t{%2, %1, %0|%0, %1, %2}
14162 movlhps\t{%2, %0|%0, %2}
14163 movhps\t{%2, %0|%0, %2}
14164 vmovhps\t{%2, %1, %0|%0, %1, %2}"
14166 (cond [(eq_attr "alternative" "0,1")
14167 (const_string "x64_sse4_noavx")
14168 (eq_attr "alternative" "2")
14169 (const_string "x64_avx")
14170 (eq_attr "alternative" "3")
14171 (const_string "x64_avx512dq")
14172 (eq_attr "alternative" "4")
14173 (const_string "x64_sse2")
14174 (eq_attr "alternative" "5,6")
14175 (const_string "sse2")
14176 (eq_attr "alternative" "7")
14177 (const_string "sse2_noavx")
14178 (eq_attr "alternative" "8,11")
14179 (const_string "avx")
14181 (const_string "noavx")))
14184 (eq_attr "alternative" "0,1,2,3,7,8")
14185 (const_string "sselog")
14186 (const_string "ssemov")))
14187 (set (attr "prefix_rex")
14188 (if_then_else (eq_attr "alternative" "0,1,2,3,4")
14190 (const_string "*")))
14191 (set (attr "prefix_extra")
14192 (if_then_else (eq_attr "alternative" "0,1,2,3")
14194 (const_string "*")))
14195 (set (attr "length_immediate")
14196 (if_then_else (eq_attr "alternative" "0,1,2,3")
14198 (const_string "*")))
14199 (set (attr "prefix")
14200 (cond [(eq_attr "alternative" "2")
14201 (const_string "vex")
14202 (eq_attr "alternative" "3")
14203 (const_string "evex")
14204 (eq_attr "alternative" "4,5")
14205 (const_string "maybe_vex")
14206 (eq_attr "alternative" "8,11")
14207 (const_string "maybe_evex")
14209 (const_string "orig")))
14210 (set_attr "mode" "TI,TI,TI,TI,TI,TI,TI,TI,TI,V4SF,V2SF,V2SF")
14211 (set (attr "preferred_for_speed")
14212 (cond [(eq_attr "alternative" "4")
14213 (symbol_ref "TARGET_INTER_UNIT_MOVES_TO_VEC")
14214 (eq_attr "alternative" "6")
14215 (symbol_ref "TARGET_INTER_UNIT_MOVES_FROM_VEC")
14217 (symbol_ref "true")))])
14219 ;; vmovq clears also the higher bits.
14220 (define_insn "vec_set<mode>_0"
14221 [(set (match_operand:VI8_AVX_AVX512F 0 "register_operand" "=v,v")
14222 (vec_merge:VI8_AVX_AVX512F
14223 (vec_duplicate:VI8_AVX_AVX512F
14224 (match_operand:<ssescalarmode> 2 "general_operand" "r,vm"))
14225 (match_operand:VI8_AVX_AVX512F 1 "const0_operand" "C,C")
14228 "vmovq\t{%2, %x0|%x0, %2}"
14229 [(set_attr "isa" "x64,*")
14230 (set_attr "type" "ssemov")
14231 (set_attr "prefix_rex" "1,*")
14232 (set_attr "prefix" "maybe_evex")
14233 (set_attr "mode" "TI")
14234 (set (attr "preferred_for_speed")
14235 (cond [(eq_attr "alternative" "0")
14236 (symbol_ref "TARGET_INTER_UNIT_MOVES_TO_VEC")
14238 (symbol_ref "true")))])
14240 (define_expand "vec_unpacks_lo_<mode>"
14241 [(match_operand:<sseunpackmode> 0 "register_operand")
14242 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
14244 "ix86_expand_sse_unpack (operands[0], operands[1], false, false); DONE;")
14246 (define_expand "vec_unpacks_hi_<mode>"
14247 [(match_operand:<sseunpackmode> 0 "register_operand")
14248 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
14250 "ix86_expand_sse_unpack (operands[0], operands[1], false, true); DONE;")
14252 (define_expand "vec_unpacku_lo_<mode>"
14253 [(match_operand:<sseunpackmode> 0 "register_operand")
14254 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
14256 "ix86_expand_sse_unpack (operands[0], operands[1], true, false); DONE;")
14258 (define_expand "vec_unpacks_lo_hi"
14259 [(set (subreg:HI (match_operand:QI 0 "register_operand") 0)
14260 (match_operand:HI 1 "register_operand"))]
14263 (define_expand "vec_unpacks_lo_si"
14264 [(set (match_operand:HI 0 "register_operand")
14265 (subreg:HI (match_operand:SI 1 "register_operand") 0))]
14268 (define_expand "vec_unpacks_lo_di"
14269 [(set (match_operand:SI 0 "register_operand")
14270 (subreg:SI (match_operand:DI 1 "register_operand") 0))]
14273 (define_expand "vec_unpacku_hi_<mode>"
14274 [(match_operand:<sseunpackmode> 0 "register_operand")
14275 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
14277 "ix86_expand_sse_unpack (operands[0], operands[1], true, true); DONE;")
14279 (define_expand "vec_unpacks_hi_hi"
14281 [(set (subreg:HI (match_operand:QI 0 "register_operand") 0)
14282 (lshiftrt:HI (match_operand:HI 1 "register_operand")
14284 (unspec [(const_int 0)] UNSPEC_MASKOP)])]
14287 (define_expand "vec_unpacks_hi_<mode>"
14289 [(set (subreg:SWI48x
14290 (match_operand:<HALFMASKMODE> 0 "register_operand") 0)
14291 (lshiftrt:SWI48x (match_operand:SWI48x 1 "register_operand")
14293 (unspec [(const_int 0)] UNSPEC_MASKOP)])]
14295 "operands[2] = GEN_INT (GET_MODE_BITSIZE (<HALFMASKMODE>mode));")
14297 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14301 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14303 (define_expand "<sse2_avx2>_uavg<mode>3<mask_name>"
14304 [(set (match_operand:VI12_AVX2 0 "register_operand")
14305 (truncate:VI12_AVX2
14306 (lshiftrt:<ssedoublemode>
14307 (plus:<ssedoublemode>
14308 (plus:<ssedoublemode>
14309 (zero_extend:<ssedoublemode>
14310 (match_operand:VI12_AVX2 1 "vector_operand"))
14311 (zero_extend:<ssedoublemode>
14312 (match_operand:VI12_AVX2 2 "vector_operand")))
14313 (match_dup <mask_expand_op3>))
14315 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
14318 if (<mask_applied>)
14320 operands[3] = CONST1_RTX(<MODE>mode);
14321 ix86_fixup_binary_operands_no_copy (PLUS, <MODE>mode, operands);
14323 if (<mask_applied>)
14325 operands[5] = operands[3];
14330 (define_insn "*<sse2_avx2>_uavg<mode>3<mask_name>"
14331 [(set (match_operand:VI12_AVX2 0 "register_operand" "=x,v")
14332 (truncate:VI12_AVX2
14333 (lshiftrt:<ssedoublemode>
14334 (plus:<ssedoublemode>
14335 (plus:<ssedoublemode>
14336 (zero_extend:<ssedoublemode>
14337 (match_operand:VI12_AVX2 1 "vector_operand" "%0,v"))
14338 (zero_extend:<ssedoublemode>
14339 (match_operand:VI12_AVX2 2 "vector_operand" "xBm,vm")))
14340 (match_operand:VI12_AVX2 <mask_expand_op3> "const1_operand"))
14342 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>
14343 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
14345 pavg<ssemodesuffix>\t{%2, %0|%0, %2}
14346 vpavg<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
14347 [(set_attr "isa" "noavx,avx")
14348 (set_attr "type" "sseiadd")
14349 (set_attr "prefix_data16" "1,*")
14350 (set_attr "prefix" "orig,<mask_prefix>")
14351 (set_attr "mode" "<sseinsnmode>")])
14353 ;; The correct representation for this is absolutely enormous, and
14354 ;; surely not generally useful.
14355 (define_insn "<sse2_avx2>_psadbw"
14356 [(set (match_operand:VI8_AVX2_AVX512BW 0 "register_operand" "=x,v")
14357 (unspec:VI8_AVX2_AVX512BW
14358 [(match_operand:<ssebytemode> 1 "register_operand" "0,v")
14359 (match_operand:<ssebytemode> 2 "vector_operand" "xBm,vm")]
14363 psadbw\t{%2, %0|%0, %2}
14364 vpsadbw\t{%2, %1, %0|%0, %1, %2}"
14365 [(set_attr "isa" "noavx,avx")
14366 (set_attr "type" "sseiadd")
14367 (set_attr "atom_unit" "simul")
14368 (set_attr "prefix_data16" "1,*")
14369 (set_attr "prefix" "orig,maybe_evex")
14370 (set_attr "mode" "<sseinsnmode>")])
14372 (define_insn "<sse>_movmsk<ssemodesuffix><avxsizesuffix>"
14373 [(set (match_operand:SI 0 "register_operand" "=r")
14375 [(match_operand:VF_128_256 1 "register_operand" "x")]
14378 "%vmovmsk<ssemodesuffix>\t{%1, %0|%0, %1}"
14379 [(set_attr "type" "ssemov")
14380 (set_attr "prefix" "maybe_vex")
14381 (set_attr "mode" "<MODE>")])
14383 (define_insn "*<sse>_movmsk<ssemodesuffix><avxsizesuffix>_zext"
14384 [(set (match_operand:DI 0 "register_operand" "=r")
14387 [(match_operand:VF_128_256 1 "register_operand" "x")]
14389 "TARGET_64BIT && TARGET_SSE"
14390 "%vmovmsk<ssemodesuffix>\t{%1, %k0|%k0, %1}"
14391 [(set_attr "type" "ssemov")
14392 (set_attr "prefix" "maybe_vex")
14393 (set_attr "mode" "<MODE>")])
14395 (define_insn "<sse2_avx2>_pmovmskb"
14396 [(set (match_operand:SI 0 "register_operand" "=r")
14398 [(match_operand:VI1_AVX2 1 "register_operand" "x")]
14401 "%vpmovmskb\t{%1, %0|%0, %1}"
14402 [(set_attr "type" "ssemov")
14403 (set (attr "prefix_data16")
14405 (match_test "TARGET_AVX")
14407 (const_string "1")))
14408 (set_attr "prefix" "maybe_vex")
14409 (set_attr "mode" "SI")])
14411 (define_insn "*<sse2_avx2>_pmovmskb_zext"
14412 [(set (match_operand:DI 0 "register_operand" "=r")
14415 [(match_operand:VI1_AVX2 1 "register_operand" "x")]
14417 "TARGET_64BIT && TARGET_SSE2"
14418 "%vpmovmskb\t{%1, %k0|%k0, %1}"
14419 [(set_attr "type" "ssemov")
14420 (set (attr "prefix_data16")
14422 (match_test "TARGET_AVX")
14424 (const_string "1")))
14425 (set_attr "prefix" "maybe_vex")
14426 (set_attr "mode" "SI")])
14428 (define_expand "sse2_maskmovdqu"
14429 [(set (match_operand:V16QI 0 "memory_operand")
14430 (unspec:V16QI [(match_operand:V16QI 1 "register_operand")
14431 (match_operand:V16QI 2 "register_operand")
14436 (define_insn "*sse2_maskmovdqu"
14437 [(set (mem:V16QI (match_operand:P 0 "register_operand" "D"))
14438 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "x")
14439 (match_operand:V16QI 2 "register_operand" "x")
14440 (mem:V16QI (match_dup 0))]
14444 /* We can't use %^ here due to ASM_OUTPUT_OPCODE processing
14445 that requires %v to be at the beginning of the opcode name. */
14446 if (Pmode != word_mode)
14447 fputs ("\taddr32", asm_out_file);
14448 return "%vmaskmovdqu\t{%2, %1|%1, %2}";
14450 [(set_attr "type" "ssemov")
14451 (set_attr "prefix_data16" "1")
14452 (set (attr "length_address")
14453 (symbol_ref ("Pmode != word_mode")))
14454 ;; The implicit %rdi operand confuses default length_vex computation.
14455 (set (attr "length_vex")
14456 (symbol_ref ("3 + REX_SSE_REGNO_P (REGNO (operands[2]))")))
14457 (set_attr "prefix" "maybe_vex")
14458 (set_attr "znver1_decode" "vector")
14459 (set_attr "mode" "TI")])
14461 (define_insn "sse_ldmxcsr"
14462 [(unspec_volatile [(match_operand:SI 0 "memory_operand" "m")]
14466 [(set_attr "type" "sse")
14467 (set_attr "atom_sse_attr" "mxcsr")
14468 (set_attr "prefix" "maybe_vex")
14469 (set_attr "memory" "load")])
14471 (define_insn "sse_stmxcsr"
14472 [(set (match_operand:SI 0 "memory_operand" "=m")
14473 (unspec_volatile:SI [(const_int 0)] UNSPECV_STMXCSR))]
14476 [(set_attr "type" "sse")
14477 (set_attr "atom_sse_attr" "mxcsr")
14478 (set_attr "prefix" "maybe_vex")
14479 (set_attr "memory" "store")])
14481 (define_insn "sse2_clflush"
14482 [(unspec_volatile [(match_operand 0 "address_operand" "p")]
14486 [(set_attr "type" "sse")
14487 (set_attr "atom_sse_attr" "fence")
14488 (set_attr "memory" "unknown")])
14490 ;; As per AMD and Intel ISA manuals, the first operand is extensions
14491 ;; and it goes to %ecx. The second operand received is hints and it goes
14493 (define_insn "sse3_mwait"
14494 [(unspec_volatile [(match_operand:SI 0 "register_operand" "c")
14495 (match_operand:SI 1 "register_operand" "a")]
14498 ;; 64bit version is "mwait %rax,%rcx". But only lower 32bits are used.
14499 ;; Since 32bit register operands are implicitly zero extended to 64bit,
14500 ;; we only need to set up 32bit registers.
14502 [(set_attr "length" "3")])
14504 (define_insn "sse3_monitor_<mode>"
14505 [(unspec_volatile [(match_operand:P 0 "register_operand" "a")
14506 (match_operand:SI 1 "register_operand" "c")
14507 (match_operand:SI 2 "register_operand" "d")]
14510 ;; 64bit version is "monitor %rax,%rcx,%rdx". But only lower 32bits in
14511 ;; RCX and RDX are used. Since 32bit register operands are implicitly
14512 ;; zero extended to 64bit, we only need to set up 32bit registers.
14514 [(set (attr "length")
14515 (symbol_ref ("(Pmode != word_mode) + 3")))])
14517 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14519 ;; SSSE3 instructions
14521 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14523 (define_code_iterator ssse3_plusminus [plus ss_plus minus ss_minus])
14525 (define_insn "avx2_ph<plusminus_mnemonic>wv16hi3"
14526 [(set (match_operand:V16HI 0 "register_operand" "=x")
14531 (ssse3_plusminus:HI
14533 (match_operand:V16HI 1 "register_operand" "x")
14534 (parallel [(const_int 0)]))
14535 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
14536 (ssse3_plusminus:HI
14537 (vec_select:HI (match_dup 1) (parallel [(const_int 2)]))
14538 (vec_select:HI (match_dup 1) (parallel [(const_int 3)]))))
14540 (ssse3_plusminus:HI
14541 (vec_select:HI (match_dup 1) (parallel [(const_int 4)]))
14542 (vec_select:HI (match_dup 1) (parallel [(const_int 5)])))
14543 (ssse3_plusminus:HI
14544 (vec_select:HI (match_dup 1) (parallel [(const_int 6)]))
14545 (vec_select:HI (match_dup 1) (parallel [(const_int 7)])))))
14548 (ssse3_plusminus:HI
14549 (vec_select:HI (match_dup 1) (parallel [(const_int 8)]))
14550 (vec_select:HI (match_dup 1) (parallel [(const_int 9)])))
14551 (ssse3_plusminus:HI
14552 (vec_select:HI (match_dup 1) (parallel [(const_int 10)]))
14553 (vec_select:HI (match_dup 1) (parallel [(const_int 11)]))))
14555 (ssse3_plusminus:HI
14556 (vec_select:HI (match_dup 1) (parallel [(const_int 12)]))
14557 (vec_select:HI (match_dup 1) (parallel [(const_int 13)])))
14558 (ssse3_plusminus:HI
14559 (vec_select:HI (match_dup 1) (parallel [(const_int 14)]))
14560 (vec_select:HI (match_dup 1) (parallel [(const_int 15)]))))))
14564 (ssse3_plusminus:HI
14566 (match_operand:V16HI 2 "nonimmediate_operand" "xm")
14567 (parallel [(const_int 0)]))
14568 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))
14569 (ssse3_plusminus:HI
14570 (vec_select:HI (match_dup 2) (parallel [(const_int 2)]))
14571 (vec_select:HI (match_dup 2) (parallel [(const_int 3)]))))
14573 (ssse3_plusminus:HI
14574 (vec_select:HI (match_dup 2) (parallel [(const_int 4)]))
14575 (vec_select:HI (match_dup 2) (parallel [(const_int 5)])))
14576 (ssse3_plusminus:HI
14577 (vec_select:HI (match_dup 2) (parallel [(const_int 6)]))
14578 (vec_select:HI (match_dup 2) (parallel [(const_int 7)])))))
14581 (ssse3_plusminus:HI
14582 (vec_select:HI (match_dup 2) (parallel [(const_int 8)]))
14583 (vec_select:HI (match_dup 2) (parallel [(const_int 9)])))
14584 (ssse3_plusminus:HI
14585 (vec_select:HI (match_dup 2) (parallel [(const_int 10)]))
14586 (vec_select:HI (match_dup 2) (parallel [(const_int 11)]))))
14588 (ssse3_plusminus:HI
14589 (vec_select:HI (match_dup 2) (parallel [(const_int 12)]))
14590 (vec_select:HI (match_dup 2) (parallel [(const_int 13)])))
14591 (ssse3_plusminus:HI
14592 (vec_select:HI (match_dup 2) (parallel [(const_int 14)]))
14593 (vec_select:HI (match_dup 2) (parallel [(const_int 15)]))))))))]
14595 "vph<plusminus_mnemonic>w\t{%2, %1, %0|%0, %1, %2}"
14596 [(set_attr "type" "sseiadd")
14597 (set_attr "prefix_extra" "1")
14598 (set_attr "prefix" "vex")
14599 (set_attr "mode" "OI")])
14601 (define_insn "ssse3_ph<plusminus_mnemonic>wv8hi3"
14602 [(set (match_operand:V8HI 0 "register_operand" "=x,x")
14606 (ssse3_plusminus:HI
14608 (match_operand:V8HI 1 "register_operand" "0,x")
14609 (parallel [(const_int 0)]))
14610 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
14611 (ssse3_plusminus:HI
14612 (vec_select:HI (match_dup 1) (parallel [(const_int 2)]))
14613 (vec_select:HI (match_dup 1) (parallel [(const_int 3)]))))
14615 (ssse3_plusminus:HI
14616 (vec_select:HI (match_dup 1) (parallel [(const_int 4)]))
14617 (vec_select:HI (match_dup 1) (parallel [(const_int 5)])))
14618 (ssse3_plusminus:HI
14619 (vec_select:HI (match_dup 1) (parallel [(const_int 6)]))
14620 (vec_select:HI (match_dup 1) (parallel [(const_int 7)])))))
14623 (ssse3_plusminus:HI
14625 (match_operand:V8HI 2 "vector_operand" "xBm,xm")
14626 (parallel [(const_int 0)]))
14627 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))
14628 (ssse3_plusminus:HI
14629 (vec_select:HI (match_dup 2) (parallel [(const_int 2)]))
14630 (vec_select:HI (match_dup 2) (parallel [(const_int 3)]))))
14632 (ssse3_plusminus:HI
14633 (vec_select:HI (match_dup 2) (parallel [(const_int 4)]))
14634 (vec_select:HI (match_dup 2) (parallel [(const_int 5)])))
14635 (ssse3_plusminus:HI
14636 (vec_select:HI (match_dup 2) (parallel [(const_int 6)]))
14637 (vec_select:HI (match_dup 2) (parallel [(const_int 7)])))))))]
14640 ph<plusminus_mnemonic>w\t{%2, %0|%0, %2}
14641 vph<plusminus_mnemonic>w\t{%2, %1, %0|%0, %1, %2}"
14642 [(set_attr "isa" "noavx,avx")
14643 (set_attr "type" "sseiadd")
14644 (set_attr "atom_unit" "complex")
14645 (set_attr "prefix_data16" "1,*")
14646 (set_attr "prefix_extra" "1")
14647 (set_attr "prefix" "orig,vex")
14648 (set_attr "mode" "TI")])
14650 (define_insn "ssse3_ph<plusminus_mnemonic>wv4hi3"
14651 [(set (match_operand:V4HI 0 "register_operand" "=y")
14654 (ssse3_plusminus:HI
14656 (match_operand:V4HI 1 "register_operand" "0")
14657 (parallel [(const_int 0)]))
14658 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
14659 (ssse3_plusminus:HI
14660 (vec_select:HI (match_dup 1) (parallel [(const_int 2)]))
14661 (vec_select:HI (match_dup 1) (parallel [(const_int 3)]))))
14663 (ssse3_plusminus:HI
14665 (match_operand:V4HI 2 "nonimmediate_operand" "ym")
14666 (parallel [(const_int 0)]))
14667 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))
14668 (ssse3_plusminus:HI
14669 (vec_select:HI (match_dup 2) (parallel [(const_int 2)]))
14670 (vec_select:HI (match_dup 2) (parallel [(const_int 3)]))))))]
14672 "ph<plusminus_mnemonic>w\t{%2, %0|%0, %2}"
14673 [(set_attr "type" "sseiadd")
14674 (set_attr "atom_unit" "complex")
14675 (set_attr "prefix_extra" "1")
14676 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14677 (set_attr "mode" "DI")])
14679 (define_insn "avx2_ph<plusminus_mnemonic>dv8si3"
14680 [(set (match_operand:V8SI 0 "register_operand" "=x")
14686 (match_operand:V8SI 1 "register_operand" "x")
14687 (parallel [(const_int 0)]))
14688 (vec_select:SI (match_dup 1) (parallel [(const_int 1)])))
14690 (vec_select:SI (match_dup 1) (parallel [(const_int 2)]))
14691 (vec_select:SI (match_dup 1) (parallel [(const_int 3)]))))
14694 (vec_select:SI (match_dup 1) (parallel [(const_int 4)]))
14695 (vec_select:SI (match_dup 1) (parallel [(const_int 5)])))
14697 (vec_select:SI (match_dup 1) (parallel [(const_int 6)]))
14698 (vec_select:SI (match_dup 1) (parallel [(const_int 7)])))))
14703 (match_operand:V8SI 2 "nonimmediate_operand" "xm")
14704 (parallel [(const_int 0)]))
14705 (vec_select:SI (match_dup 2) (parallel [(const_int 1)])))
14707 (vec_select:SI (match_dup 2) (parallel [(const_int 2)]))
14708 (vec_select:SI (match_dup 2) (parallel [(const_int 3)]))))
14711 (vec_select:SI (match_dup 2) (parallel [(const_int 4)]))
14712 (vec_select:SI (match_dup 2) (parallel [(const_int 5)])))
14714 (vec_select:SI (match_dup 2) (parallel [(const_int 6)]))
14715 (vec_select:SI (match_dup 2) (parallel [(const_int 7)])))))))]
14717 "vph<plusminus_mnemonic>d\t{%2, %1, %0|%0, %1, %2}"
14718 [(set_attr "type" "sseiadd")
14719 (set_attr "prefix_extra" "1")
14720 (set_attr "prefix" "vex")
14721 (set_attr "mode" "OI")])
14723 (define_insn "ssse3_ph<plusminus_mnemonic>dv4si3"
14724 [(set (match_operand:V4SI 0 "register_operand" "=x,x")
14729 (match_operand:V4SI 1 "register_operand" "0,x")
14730 (parallel [(const_int 0)]))
14731 (vec_select:SI (match_dup 1) (parallel [(const_int 1)])))
14733 (vec_select:SI (match_dup 1) (parallel [(const_int 2)]))
14734 (vec_select:SI (match_dup 1) (parallel [(const_int 3)]))))
14738 (match_operand:V4SI 2 "vector_operand" "xBm,xm")
14739 (parallel [(const_int 0)]))
14740 (vec_select:SI (match_dup 2) (parallel [(const_int 1)])))
14742 (vec_select:SI (match_dup 2) (parallel [(const_int 2)]))
14743 (vec_select:SI (match_dup 2) (parallel [(const_int 3)]))))))]
14746 ph<plusminus_mnemonic>d\t{%2, %0|%0, %2}
14747 vph<plusminus_mnemonic>d\t{%2, %1, %0|%0, %1, %2}"
14748 [(set_attr "isa" "noavx,avx")
14749 (set_attr "type" "sseiadd")
14750 (set_attr "atom_unit" "complex")
14751 (set_attr "prefix_data16" "1,*")
14752 (set_attr "prefix_extra" "1")
14753 (set_attr "prefix" "orig,vex")
14754 (set_attr "mode" "TI")])
14756 (define_insn "ssse3_ph<plusminus_mnemonic>dv2si3"
14757 [(set (match_operand:V2SI 0 "register_operand" "=y")
14761 (match_operand:V2SI 1 "register_operand" "0")
14762 (parallel [(const_int 0)]))
14763 (vec_select:SI (match_dup 1) (parallel [(const_int 1)])))
14766 (match_operand:V2SI 2 "nonimmediate_operand" "ym")
14767 (parallel [(const_int 0)]))
14768 (vec_select:SI (match_dup 2) (parallel [(const_int 1)])))))]
14770 "ph<plusminus_mnemonic>d\t{%2, %0|%0, %2}"
14771 [(set_attr "type" "sseiadd")
14772 (set_attr "atom_unit" "complex")
14773 (set_attr "prefix_extra" "1")
14774 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14775 (set_attr "mode" "DI")])
14777 (define_insn "avx2_pmaddubsw256"
14778 [(set (match_operand:V16HI 0 "register_operand" "=x,v")
14783 (match_operand:V32QI 1 "register_operand" "x,v")
14784 (parallel [(const_int 0) (const_int 2)
14785 (const_int 4) (const_int 6)
14786 (const_int 8) (const_int 10)
14787 (const_int 12) (const_int 14)
14788 (const_int 16) (const_int 18)
14789 (const_int 20) (const_int 22)
14790 (const_int 24) (const_int 26)
14791 (const_int 28) (const_int 30)])))
14794 (match_operand:V32QI 2 "nonimmediate_operand" "xm,vm")
14795 (parallel [(const_int 0) (const_int 2)
14796 (const_int 4) (const_int 6)
14797 (const_int 8) (const_int 10)
14798 (const_int 12) (const_int 14)
14799 (const_int 16) (const_int 18)
14800 (const_int 20) (const_int 22)
14801 (const_int 24) (const_int 26)
14802 (const_int 28) (const_int 30)]))))
14805 (vec_select:V16QI (match_dup 1)
14806 (parallel [(const_int 1) (const_int 3)
14807 (const_int 5) (const_int 7)
14808 (const_int 9) (const_int 11)
14809 (const_int 13) (const_int 15)
14810 (const_int 17) (const_int 19)
14811 (const_int 21) (const_int 23)
14812 (const_int 25) (const_int 27)
14813 (const_int 29) (const_int 31)])))
14815 (vec_select:V16QI (match_dup 2)
14816 (parallel [(const_int 1) (const_int 3)
14817 (const_int 5) (const_int 7)
14818 (const_int 9) (const_int 11)
14819 (const_int 13) (const_int 15)
14820 (const_int 17) (const_int 19)
14821 (const_int 21) (const_int 23)
14822 (const_int 25) (const_int 27)
14823 (const_int 29) (const_int 31)]))))))]
14825 "vpmaddubsw\t{%2, %1, %0|%0, %1, %2}"
14826 [(set_attr "isa" "*,avx512bw")
14827 (set_attr "type" "sseiadd")
14828 (set_attr "prefix_extra" "1")
14829 (set_attr "prefix" "vex,evex")
14830 (set_attr "mode" "OI")])
14832 ;; The correct representation for this is absolutely enormous, and
14833 ;; surely not generally useful.
14834 (define_insn "avx512bw_pmaddubsw512<mode><mask_name>"
14835 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
14836 (unspec:VI2_AVX512VL
14837 [(match_operand:<dbpsadbwmode> 1 "register_operand" "v")
14838 (match_operand:<dbpsadbwmode> 2 "nonimmediate_operand" "vm")]
14839 UNSPEC_PMADDUBSW512))]
14841 "vpmaddubsw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}";
14842 [(set_attr "type" "sseiadd")
14843 (set_attr "prefix" "evex")
14844 (set_attr "mode" "XI")])
14846 (define_insn "avx512bw_umulhrswv32hi3<mask_name>"
14847 [(set (match_operand:V32HI 0 "register_operand" "=v")
14854 (match_operand:V32HI 1 "nonimmediate_operand" "%v"))
14856 (match_operand:V32HI 2 "nonimmediate_operand" "vm")))
14858 (const_vector:V32HI [(const_int 1) (const_int 1)
14859 (const_int 1) (const_int 1)
14860 (const_int 1) (const_int 1)
14861 (const_int 1) (const_int 1)
14862 (const_int 1) (const_int 1)
14863 (const_int 1) (const_int 1)
14864 (const_int 1) (const_int 1)
14865 (const_int 1) (const_int 1)
14866 (const_int 1) (const_int 1)
14867 (const_int 1) (const_int 1)
14868 (const_int 1) (const_int 1)
14869 (const_int 1) (const_int 1)
14870 (const_int 1) (const_int 1)
14871 (const_int 1) (const_int 1)
14872 (const_int 1) (const_int 1)
14873 (const_int 1) (const_int 1)]))
14876 "vpmulhrsw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
14877 [(set_attr "type" "sseimul")
14878 (set_attr "prefix" "evex")
14879 (set_attr "mode" "XI")])
14881 (define_insn "ssse3_pmaddubsw128"
14882 [(set (match_operand:V8HI 0 "register_operand" "=x,x,v")
14887 (match_operand:V16QI 1 "register_operand" "0,x,v")
14888 (parallel [(const_int 0) (const_int 2)
14889 (const_int 4) (const_int 6)
14890 (const_int 8) (const_int 10)
14891 (const_int 12) (const_int 14)])))
14894 (match_operand:V16QI 2 "vector_operand" "xBm,xm,vm")
14895 (parallel [(const_int 0) (const_int 2)
14896 (const_int 4) (const_int 6)
14897 (const_int 8) (const_int 10)
14898 (const_int 12) (const_int 14)]))))
14901 (vec_select:V8QI (match_dup 1)
14902 (parallel [(const_int 1) (const_int 3)
14903 (const_int 5) (const_int 7)
14904 (const_int 9) (const_int 11)
14905 (const_int 13) (const_int 15)])))
14907 (vec_select:V8QI (match_dup 2)
14908 (parallel [(const_int 1) (const_int 3)
14909 (const_int 5) (const_int 7)
14910 (const_int 9) (const_int 11)
14911 (const_int 13) (const_int 15)]))))))]
14914 pmaddubsw\t{%2, %0|%0, %2}
14915 vpmaddubsw\t{%2, %1, %0|%0, %1, %2}
14916 vpmaddubsw\t{%2, %1, %0|%0, %1, %2}"
14917 [(set_attr "isa" "noavx,avx,avx512bw")
14918 (set_attr "type" "sseiadd")
14919 (set_attr "atom_unit" "simul")
14920 (set_attr "prefix_data16" "1,*,*")
14921 (set_attr "prefix_extra" "1")
14922 (set_attr "prefix" "orig,vex,evex")
14923 (set_attr "mode" "TI")])
14925 (define_insn "ssse3_pmaddubsw"
14926 [(set (match_operand:V4HI 0 "register_operand" "=y")
14931 (match_operand:V8QI 1 "register_operand" "0")
14932 (parallel [(const_int 0) (const_int 2)
14933 (const_int 4) (const_int 6)])))
14936 (match_operand:V8QI 2 "nonimmediate_operand" "ym")
14937 (parallel [(const_int 0) (const_int 2)
14938 (const_int 4) (const_int 6)]))))
14941 (vec_select:V4QI (match_dup 1)
14942 (parallel [(const_int 1) (const_int 3)
14943 (const_int 5) (const_int 7)])))
14945 (vec_select:V4QI (match_dup 2)
14946 (parallel [(const_int 1) (const_int 3)
14947 (const_int 5) (const_int 7)]))))))]
14949 "pmaddubsw\t{%2, %0|%0, %2}"
14950 [(set_attr "type" "sseiadd")
14951 (set_attr "atom_unit" "simul")
14952 (set_attr "prefix_extra" "1")
14953 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14954 (set_attr "mode" "DI")])
14956 (define_mode_iterator PMULHRSW
14957 [V4HI V8HI (V16HI "TARGET_AVX2")])
14959 (define_expand "<ssse3_avx2>_pmulhrsw<mode>3_mask"
14960 [(set (match_operand:PMULHRSW 0 "register_operand")
14961 (vec_merge:PMULHRSW
14963 (lshiftrt:<ssedoublemode>
14964 (plus:<ssedoublemode>
14965 (lshiftrt:<ssedoublemode>
14966 (mult:<ssedoublemode>
14967 (sign_extend:<ssedoublemode>
14968 (match_operand:PMULHRSW 1 "nonimmediate_operand"))
14969 (sign_extend:<ssedoublemode>
14970 (match_operand:PMULHRSW 2 "nonimmediate_operand")))
14974 (match_operand:PMULHRSW 3 "register_operand")
14975 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
14976 "TARGET_AVX512BW && TARGET_AVX512VL"
14978 operands[5] = CONST1_RTX(<MODE>mode);
14979 ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);
14982 (define_expand "<ssse3_avx2>_pmulhrsw<mode>3"
14983 [(set (match_operand:PMULHRSW 0 "register_operand")
14985 (lshiftrt:<ssedoublemode>
14986 (plus:<ssedoublemode>
14987 (lshiftrt:<ssedoublemode>
14988 (mult:<ssedoublemode>
14989 (sign_extend:<ssedoublemode>
14990 (match_operand:PMULHRSW 1 "nonimmediate_operand"))
14991 (sign_extend:<ssedoublemode>
14992 (match_operand:PMULHRSW 2 "nonimmediate_operand")))
14998 operands[3] = CONST1_RTX(<MODE>mode);
14999 ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);
15002 (define_insn "*<ssse3_avx2>_pmulhrsw<mode>3<mask_name>"
15003 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,x,v")
15005 (lshiftrt:<ssedoublemode>
15006 (plus:<ssedoublemode>
15007 (lshiftrt:<ssedoublemode>
15008 (mult:<ssedoublemode>
15009 (sign_extend:<ssedoublemode>
15010 (match_operand:VI2_AVX2 1 "vector_operand" "%0,x,v"))
15011 (sign_extend:<ssedoublemode>
15012 (match_operand:VI2_AVX2 2 "vector_operand" "xBm,xm,vm")))
15014 (match_operand:VI2_AVX2 3 "const1_operand"))
15016 "TARGET_SSSE3 && <mask_mode512bit_condition> && <mask_avx512bw_condition>
15017 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
15019 pmulhrsw\t{%2, %0|%0, %2}
15020 vpmulhrsw\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}
15021 vpmulhrsw\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}"
15022 [(set_attr "isa" "noavx,avx,avx512bw")
15023 (set_attr "type" "sseimul")
15024 (set_attr "prefix_data16" "1,*,*")
15025 (set_attr "prefix_extra" "1")
15026 (set_attr "prefix" "orig,maybe_evex,evex")
15027 (set_attr "mode" "<sseinsnmode>")])
15029 (define_insn "*ssse3_pmulhrswv4hi3"
15030 [(set (match_operand:V4HI 0 "register_operand" "=y")
15037 (match_operand:V4HI 1 "nonimmediate_operand" "%0"))
15039 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))
15041 (match_operand:V4HI 3 "const1_operand"))
15043 "TARGET_SSSE3 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
15044 "pmulhrsw\t{%2, %0|%0, %2}"
15045 [(set_attr "type" "sseimul")
15046 (set_attr "prefix_extra" "1")
15047 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
15048 (set_attr "mode" "DI")])
15050 (define_insn "<ssse3_avx2>_pshufb<mode>3<mask_name>"
15051 [(set (match_operand:VI1_AVX512 0 "register_operand" "=x,x,v")
15053 [(match_operand:VI1_AVX512 1 "register_operand" "0,x,v")
15054 (match_operand:VI1_AVX512 2 "vector_operand" "xBm,xm,vm")]
15056 "TARGET_SSSE3 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
15058 pshufb\t{%2, %0|%0, %2}
15059 vpshufb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
15060 vpshufb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
15061 [(set_attr "isa" "noavx,avx,avx512bw")
15062 (set_attr "type" "sselog1")
15063 (set_attr "prefix_data16" "1,*,*")
15064 (set_attr "prefix_extra" "1")
15065 (set_attr "prefix" "orig,maybe_evex,evex")
15066 (set_attr "btver2_decode" "vector")
15067 (set_attr "mode" "<sseinsnmode>")])
15069 (define_insn "ssse3_pshufbv8qi3"
15070 [(set (match_operand:V8QI 0 "register_operand" "=y")
15071 (unspec:V8QI [(match_operand:V8QI 1 "register_operand" "0")
15072 (match_operand:V8QI 2 "nonimmediate_operand" "ym")]
15075 "pshufb\t{%2, %0|%0, %2}";
15076 [(set_attr "type" "sselog1")
15077 (set_attr "prefix_extra" "1")
15078 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
15079 (set_attr "mode" "DI")])
15081 (define_insn "<ssse3_avx2>_psign<mode>3"
15082 [(set (match_operand:VI124_AVX2 0 "register_operand" "=x,x")
15084 [(match_operand:VI124_AVX2 1 "register_operand" "0,x")
15085 (match_operand:VI124_AVX2 2 "vector_operand" "xBm,xm")]
15089 psign<ssemodesuffix>\t{%2, %0|%0, %2}
15090 vpsign<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
15091 [(set_attr "isa" "noavx,avx")
15092 (set_attr "type" "sselog1")
15093 (set_attr "prefix_data16" "1,*")
15094 (set_attr "prefix_extra" "1")
15095 (set_attr "prefix" "orig,vex")
15096 (set_attr "mode" "<sseinsnmode>")])
15098 (define_insn "ssse3_psign<mode>3"
15099 [(set (match_operand:MMXMODEI 0 "register_operand" "=y")
15101 [(match_operand:MMXMODEI 1 "register_operand" "0")
15102 (match_operand:MMXMODEI 2 "nonimmediate_operand" "ym")]
15105 "psign<mmxvecsize>\t{%2, %0|%0, %2}";
15106 [(set_attr "type" "sselog1")
15107 (set_attr "prefix_extra" "1")
15108 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
15109 (set_attr "mode" "DI")])
15111 (define_insn "<ssse3_avx2>_palignr<mode>_mask"
15112 [(set (match_operand:VI1_AVX512 0 "register_operand" "=v")
15113 (vec_merge:VI1_AVX512
15115 [(match_operand:VI1_AVX512 1 "register_operand" "v")
15116 (match_operand:VI1_AVX512 2 "nonimmediate_operand" "vm")
15117 (match_operand:SI 3 "const_0_to_255_mul_8_operand" "n")]
15119 (match_operand:VI1_AVX512 4 "vector_move_operand" "0C")
15120 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
15121 "TARGET_AVX512BW && (<MODE_SIZE> == 64 || TARGET_AVX512VL)"
15123 operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
15124 return "vpalignr\t{%3, %2, %1, %0%{%5%}%N4|%0%{%5%}%N4, %1, %2, %3}";
15126 [(set_attr "type" "sseishft")
15127 (set_attr "atom_unit" "sishuf")
15128 (set_attr "prefix_extra" "1")
15129 (set_attr "length_immediate" "1")
15130 (set_attr "prefix" "evex")
15131 (set_attr "mode" "<sseinsnmode>")])
15133 (define_insn "<ssse3_avx2>_palignr<mode>"
15134 [(set (match_operand:SSESCALARMODE 0 "register_operand" "=x,x,v")
15135 (unspec:SSESCALARMODE
15136 [(match_operand:SSESCALARMODE 1 "register_operand" "0,x,v")
15137 (match_operand:SSESCALARMODE 2 "vector_operand" "xBm,xm,vm")
15138 (match_operand:SI 3 "const_0_to_255_mul_8_operand" "n,n,n")]
15142 operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
15144 switch (which_alternative)
15147 return "palignr\t{%3, %2, %0|%0, %2, %3}";
15150 return "vpalignr\t{%3, %2, %1, %0|%0, %1, %2, %3}";
15152 gcc_unreachable ();
15155 [(set_attr "isa" "noavx,avx,avx512bw")
15156 (set_attr "type" "sseishft")
15157 (set_attr "atom_unit" "sishuf")
15158 (set_attr "prefix_data16" "1,*,*")
15159 (set_attr "prefix_extra" "1")
15160 (set_attr "length_immediate" "1")
15161 (set_attr "prefix" "orig,vex,evex")
15162 (set_attr "mode" "<sseinsnmode>")])
15164 (define_insn "ssse3_palignrdi"
15165 [(set (match_operand:DI 0 "register_operand" "=y")
15166 (unspec:DI [(match_operand:DI 1 "register_operand" "0")
15167 (match_operand:DI 2 "nonimmediate_operand" "ym")
15168 (match_operand:SI 3 "const_0_to_255_mul_8_operand" "n")]
15172 operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
15173 return "palignr\t{%3, %2, %0|%0, %2, %3}";
15175 [(set_attr "type" "sseishft")
15176 (set_attr "atom_unit" "sishuf")
15177 (set_attr "prefix_extra" "1")
15178 (set_attr "length_immediate" "1")
15179 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
15180 (set_attr "mode" "DI")])
15182 ;; Mode iterator to handle singularity w/ absence of V2DI and V4DI
15183 ;; modes for abs instruction on pre AVX-512 targets.
15184 (define_mode_iterator VI1248_AVX512VL_AVX512BW
15185 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI
15186 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI
15187 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX2") V4SI
15188 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")])
15190 (define_insn "*abs<mode>2"
15191 [(set (match_operand:VI1248_AVX512VL_AVX512BW 0 "register_operand" "=v")
15192 (abs:VI1248_AVX512VL_AVX512BW
15193 (match_operand:VI1248_AVX512VL_AVX512BW 1 "vector_operand" "vBm")))]
15195 "%vpabs<ssemodesuffix>\t{%1, %0|%0, %1}"
15196 [(set_attr "type" "sselog1")
15197 (set_attr "prefix_data16" "1")
15198 (set_attr "prefix_extra" "1")
15199 (set_attr "prefix" "maybe_vex")
15200 (set_attr "mode" "<sseinsnmode>")])
15202 (define_insn "abs<mode>2_mask"
15203 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
15204 (vec_merge:VI48_AVX512VL
15206 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm"))
15207 (match_operand:VI48_AVX512VL 2 "vector_move_operand" "0C")
15208 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
15210 "vpabs<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
15211 [(set_attr "type" "sselog1")
15212 (set_attr "prefix" "evex")
15213 (set_attr "mode" "<sseinsnmode>")])
15215 (define_insn "abs<mode>2_mask"
15216 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
15217 (vec_merge:VI12_AVX512VL
15219 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "vm"))
15220 (match_operand:VI12_AVX512VL 2 "vector_move_operand" "0C")
15221 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
15223 "vpabs<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
15224 [(set_attr "type" "sselog1")
15225 (set_attr "prefix" "evex")
15226 (set_attr "mode" "<sseinsnmode>")])
15228 (define_expand "abs<mode>2"
15229 [(set (match_operand:VI_AVX2 0 "register_operand")
15231 (match_operand:VI_AVX2 1 "vector_operand")))]
15235 || ((<MODE>mode == V2DImode || <MODE>mode == V4DImode)
15236 && !TARGET_AVX512VL))
15238 ix86_expand_sse2_abs (operands[0], operands[1]);
15243 (define_insn "abs<mode>2"
15244 [(set (match_operand:MMXMODEI 0 "register_operand" "=y")
15246 (match_operand:MMXMODEI 1 "nonimmediate_operand" "ym")))]
15248 "pabs<mmxvecsize>\t{%1, %0|%0, %1}";
15249 [(set_attr "type" "sselog1")
15250 (set_attr "prefix_rep" "0")
15251 (set_attr "prefix_extra" "1")
15252 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
15253 (set_attr "mode" "DI")])
15255 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15257 ;; AMD SSE4A instructions
15259 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15261 (define_insn "sse4a_movnt<mode>"
15262 [(set (match_operand:MODEF 0 "memory_operand" "=m")
15264 [(match_operand:MODEF 1 "register_operand" "x")]
15267 "movnt<ssemodesuffix>\t{%1, %0|%0, %1}"
15268 [(set_attr "type" "ssemov")
15269 (set_attr "mode" "<MODE>")])
15271 (define_insn "sse4a_vmmovnt<mode>"
15272 [(set (match_operand:<ssescalarmode> 0 "memory_operand" "=m")
15273 (unspec:<ssescalarmode>
15274 [(vec_select:<ssescalarmode>
15275 (match_operand:VF_128 1 "register_operand" "x")
15276 (parallel [(const_int 0)]))]
15279 "movnt<ssescalarmodesuffix>\t{%1, %0|%0, %1}"
15280 [(set_attr "type" "ssemov")
15281 (set_attr "mode" "<ssescalarmode>")])
15283 (define_insn "sse4a_extrqi"
15284 [(set (match_operand:V2DI 0 "register_operand" "=x")
15285 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
15286 (match_operand 2 "const_0_to_255_operand")
15287 (match_operand 3 "const_0_to_255_operand")]
15290 "extrq\t{%3, %2, %0|%0, %2, %3}"
15291 [(set_attr "type" "sse")
15292 (set_attr "prefix_data16" "1")
15293 (set_attr "length_immediate" "2")
15294 (set_attr "mode" "TI")])
15296 (define_insn "sse4a_extrq"
15297 [(set (match_operand:V2DI 0 "register_operand" "=x")
15298 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
15299 (match_operand:V16QI 2 "register_operand" "x")]
15302 "extrq\t{%2, %0|%0, %2}"
15303 [(set_attr "type" "sse")
15304 (set_attr "prefix_data16" "1")
15305 (set_attr "mode" "TI")])
15307 (define_insn "sse4a_insertqi"
15308 [(set (match_operand:V2DI 0 "register_operand" "=x")
15309 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
15310 (match_operand:V2DI 2 "register_operand" "x")
15311 (match_operand 3 "const_0_to_255_operand")
15312 (match_operand 4 "const_0_to_255_operand")]
15315 "insertq\t{%4, %3, %2, %0|%0, %2, %3, %4}"
15316 [(set_attr "type" "sseins")
15317 (set_attr "prefix_data16" "0")
15318 (set_attr "prefix_rep" "1")
15319 (set_attr "length_immediate" "2")
15320 (set_attr "mode" "TI")])
15322 (define_insn "sse4a_insertq"
15323 [(set (match_operand:V2DI 0 "register_operand" "=x")
15324 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
15325 (match_operand:V2DI 2 "register_operand" "x")]
15328 "insertq\t{%2, %0|%0, %2}"
15329 [(set_attr "type" "sseins")
15330 (set_attr "prefix_data16" "0")
15331 (set_attr "prefix_rep" "1")
15332 (set_attr "mode" "TI")])
15334 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15336 ;; Intel SSE4.1 instructions
15338 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15340 ;; Mapping of immediate bits for blend instructions
15341 (define_mode_attr blendbits
15342 [(V8SF "255") (V4SF "15") (V4DF "15") (V2DF "3")])
15344 (define_insn "<sse4_1>_blend<ssemodesuffix><avxsizesuffix>"
15345 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
15346 (vec_merge:VF_128_256
15347 (match_operand:VF_128_256 2 "vector_operand" "YrBm,*xBm,xm")
15348 (match_operand:VF_128_256 1 "register_operand" "0,0,x")
15349 (match_operand:SI 3 "const_0_to_<blendbits>_operand")))]
15352 blend<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15353 blend<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15354 vblend<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15355 [(set_attr "isa" "noavx,noavx,avx")
15356 (set_attr "type" "ssemov")
15357 (set_attr "length_immediate" "1")
15358 (set_attr "prefix_data16" "1,1,*")
15359 (set_attr "prefix_extra" "1")
15360 (set_attr "prefix" "orig,orig,vex")
15361 (set_attr "mode" "<MODE>")])
15363 (define_insn "<sse4_1>_blendv<ssemodesuffix><avxsizesuffix>"
15364 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
15366 [(match_operand:VF_128_256 1 "register_operand" "0,0,x")
15367 (match_operand:VF_128_256 2 "vector_operand" "YrBm,*xBm,xm")
15368 (match_operand:VF_128_256 3 "register_operand" "Yz,Yz,x")]
15372 blendv<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15373 blendv<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15374 vblendv<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15375 [(set_attr "isa" "noavx,noavx,avx")
15376 (set_attr "type" "ssemov")
15377 (set_attr "length_immediate" "1")
15378 (set_attr "prefix_data16" "1,1,*")
15379 (set_attr "prefix_extra" "1")
15380 (set_attr "prefix" "orig,orig,vex")
15381 (set_attr "btver2_decode" "vector,vector,vector")
15382 (set_attr "mode" "<MODE>")])
15384 (define_insn "<sse4_1>_dp<ssemodesuffix><avxsizesuffix>"
15385 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
15387 [(match_operand:VF_128_256 1 "vector_operand" "%0,0,x")
15388 (match_operand:VF_128_256 2 "vector_operand" "YrBm,*xBm,xm")
15389 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")]
15393 dp<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15394 dp<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15395 vdp<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15396 [(set_attr "isa" "noavx,noavx,avx")
15397 (set_attr "type" "ssemul")
15398 (set_attr "length_immediate" "1")
15399 (set_attr "prefix_data16" "1,1,*")
15400 (set_attr "prefix_extra" "1")
15401 (set_attr "prefix" "orig,orig,vex")
15402 (set_attr "btver2_decode" "vector,vector,vector")
15403 (set_attr "znver1_decode" "vector,vector,vector")
15404 (set_attr "mode" "<MODE>")])
15406 ;; Mode attribute used by `vmovntdqa' pattern
15407 (define_mode_attr vi8_sse4_1_avx2_avx512
15408 [(V2DI "sse4_1") (V4DI "avx2") (V8DI "avx512f")])
15410 (define_insn "<vi8_sse4_1_avx2_avx512>_movntdqa"
15411 [(set (match_operand:VI8_AVX2_AVX512F 0 "register_operand" "=Yr,*x,v")
15412 (unspec:VI8_AVX2_AVX512F [(match_operand:VI8_AVX2_AVX512F 1 "memory_operand" "m,m,m")]
15415 "%vmovntdqa\t{%1, %0|%0, %1}"
15416 [(set_attr "isa" "noavx,noavx,avx")
15417 (set_attr "type" "ssemov")
15418 (set_attr "prefix_extra" "1,1,*")
15419 (set_attr "prefix" "orig,orig,maybe_evex")
15420 (set_attr "mode" "<sseinsnmode>")])
15422 (define_insn "<sse4_1_avx2>_mpsadbw"
15423 [(set (match_operand:VI1_AVX2 0 "register_operand" "=Yr,*x,x")
15425 [(match_operand:VI1_AVX2 1 "register_operand" "0,0,x")
15426 (match_operand:VI1_AVX2 2 "vector_operand" "YrBm,*xBm,xm")
15427 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")]
15431 mpsadbw\t{%3, %2, %0|%0, %2, %3}
15432 mpsadbw\t{%3, %2, %0|%0, %2, %3}
15433 vmpsadbw\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15434 [(set_attr "isa" "noavx,noavx,avx")
15435 (set_attr "type" "sselog1")
15436 (set_attr "length_immediate" "1")
15437 (set_attr "prefix_extra" "1")
15438 (set_attr "prefix" "orig,orig,vex")
15439 (set_attr "btver2_decode" "vector,vector,vector")
15440 (set_attr "znver1_decode" "vector,vector,vector")
15441 (set_attr "mode" "<sseinsnmode>")])
15443 (define_insn "<sse4_1_avx2>_packusdw<mask_name>"
15444 [(set (match_operand:VI2_AVX2 0 "register_operand" "=Yr,*x,x,v")
15445 (vec_concat:VI2_AVX2
15446 (us_truncate:<ssehalfvecmode>
15447 (match_operand:<sseunpackmode> 1 "register_operand" "0,0,x,v"))
15448 (us_truncate:<ssehalfvecmode>
15449 (match_operand:<sseunpackmode> 2 "vector_operand" "YrBm,*xBm,xm,vm"))))]
15450 "TARGET_SSE4_1 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
15452 packusdw\t{%2, %0|%0, %2}
15453 packusdw\t{%2, %0|%0, %2}
15454 vpackusdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
15455 vpackusdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
15456 [(set_attr "isa" "noavx,noavx,avx,avx512bw")
15457 (set_attr "type" "sselog")
15458 (set_attr "prefix_extra" "1")
15459 (set_attr "prefix" "orig,orig,<mask_prefix>,evex")
15460 (set_attr "mode" "<sseinsnmode>")])
15462 (define_insn "<sse4_1_avx2>_pblendvb"
15463 [(set (match_operand:VI1_AVX2 0 "register_operand" "=Yr,*x,x")
15465 [(match_operand:VI1_AVX2 1 "register_operand" "0,0,x")
15466 (match_operand:VI1_AVX2 2 "vector_operand" "YrBm,*xBm,xm")
15467 (match_operand:VI1_AVX2 3 "register_operand" "Yz,Yz,x")]
15471 pblendvb\t{%3, %2, %0|%0, %2, %3}
15472 pblendvb\t{%3, %2, %0|%0, %2, %3}
15473 vpblendvb\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15474 [(set_attr "isa" "noavx,noavx,avx")
15475 (set_attr "type" "ssemov")
15476 (set_attr "prefix_extra" "1")
15477 (set_attr "length_immediate" "*,*,1")
15478 (set_attr "prefix" "orig,orig,vex")
15479 (set_attr "btver2_decode" "vector,vector,vector")
15480 (set_attr "mode" "<sseinsnmode>")])
15482 (define_insn "sse4_1_pblendw"
15483 [(set (match_operand:V8HI 0 "register_operand" "=Yr,*x,x")
15485 (match_operand:V8HI 2 "vector_operand" "YrBm,*xBm,xm")
15486 (match_operand:V8HI 1 "register_operand" "0,0,x")
15487 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")))]
15490 pblendw\t{%3, %2, %0|%0, %2, %3}
15491 pblendw\t{%3, %2, %0|%0, %2, %3}
15492 vpblendw\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15493 [(set_attr "isa" "noavx,noavx,avx")
15494 (set_attr "type" "ssemov")
15495 (set_attr "prefix_extra" "1")
15496 (set_attr "length_immediate" "1")
15497 (set_attr "prefix" "orig,orig,vex")
15498 (set_attr "mode" "TI")])
15500 ;; The builtin uses an 8-bit immediate. Expand that.
15501 (define_expand "avx2_pblendw"
15502 [(set (match_operand:V16HI 0 "register_operand")
15504 (match_operand:V16HI 2 "nonimmediate_operand")
15505 (match_operand:V16HI 1 "register_operand")
15506 (match_operand:SI 3 "const_0_to_255_operand")))]
15509 HOST_WIDE_INT val = INTVAL (operands[3]) & 0xff;
15510 operands[3] = GEN_INT (val << 8 | val);
15513 (define_insn "*avx2_pblendw"
15514 [(set (match_operand:V16HI 0 "register_operand" "=x")
15516 (match_operand:V16HI 2 "nonimmediate_operand" "xm")
15517 (match_operand:V16HI 1 "register_operand" "x")
15518 (match_operand:SI 3 "avx2_pblendw_operand" "n")))]
15521 operands[3] = GEN_INT (INTVAL (operands[3]) & 0xff);
15522 return "vpblendw\t{%3, %2, %1, %0|%0, %1, %2, %3}";
15524 [(set_attr "type" "ssemov")
15525 (set_attr "prefix_extra" "1")
15526 (set_attr "length_immediate" "1")
15527 (set_attr "prefix" "vex")
15528 (set_attr "mode" "OI")])
15530 (define_insn "avx2_pblendd<mode>"
15531 [(set (match_operand:VI4_AVX2 0 "register_operand" "=x")
15532 (vec_merge:VI4_AVX2
15533 (match_operand:VI4_AVX2 2 "nonimmediate_operand" "xm")
15534 (match_operand:VI4_AVX2 1 "register_operand" "x")
15535 (match_operand:SI 3 "const_0_to_255_operand" "n")))]
15537 "vpblendd\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15538 [(set_attr "type" "ssemov")
15539 (set_attr "prefix_extra" "1")
15540 (set_attr "length_immediate" "1")
15541 (set_attr "prefix" "vex")
15542 (set_attr "mode" "<sseinsnmode>")])
15544 (define_insn "sse4_1_phminposuw"
15545 [(set (match_operand:V8HI 0 "register_operand" "=Yr,*x,x")
15546 (unspec:V8HI [(match_operand:V8HI 1 "vector_operand" "YrBm,*xBm,xm")]
15547 UNSPEC_PHMINPOSUW))]
15549 "%vphminposuw\t{%1, %0|%0, %1}"
15550 [(set_attr "isa" "noavx,noavx,avx")
15551 (set_attr "type" "sselog1")
15552 (set_attr "prefix_extra" "1")
15553 (set_attr "prefix" "orig,orig,vex")
15554 (set_attr "mode" "TI")])
15556 (define_insn "avx2_<code>v16qiv16hi2<mask_name>"
15557 [(set (match_operand:V16HI 0 "register_operand" "=v")
15559 (match_operand:V16QI 1 "nonimmediate_operand" "vm")))]
15560 "TARGET_AVX2 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
15561 "vpmov<extsuffix>bw\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
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 "avx512bw_<code>v32qiv32hi2<mask_name>"
15568 [(set (match_operand:V32HI 0 "register_operand" "=v")
15570 (match_operand:V32QI 1 "nonimmediate_operand" "vm")))]
15572 "vpmov<extsuffix>bw\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15573 [(set_attr "type" "ssemov")
15574 (set_attr "prefix_extra" "1")
15575 (set_attr "prefix" "evex")
15576 (set_attr "mode" "XI")])
15578 (define_insn "sse4_1_<code>v8qiv8hi2<mask_name>"
15579 [(set (match_operand:V8HI 0 "register_operand" "=Yr,*x,v")
15582 (match_operand:V16QI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15583 (parallel [(const_int 0) (const_int 1)
15584 (const_int 2) (const_int 3)
15585 (const_int 4) (const_int 5)
15586 (const_int 6) (const_int 7)]))))]
15587 "TARGET_SSE4_1 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
15588 "%vpmov<extsuffix>bw\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15589 [(set_attr "isa" "noavx,noavx,avx")
15590 (set_attr "type" "ssemov")
15591 (set_attr "prefix_extra" "1")
15592 (set_attr "prefix" "orig,orig,maybe_evex")
15593 (set_attr "mode" "TI")])
15595 (define_insn "<mask_codefor>avx512f_<code>v16qiv16si2<mask_name>"
15596 [(set (match_operand:V16SI 0 "register_operand" "=v")
15598 (match_operand:V16QI 1 "nonimmediate_operand" "vm")))]
15600 "vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15601 [(set_attr "type" "ssemov")
15602 (set_attr "prefix" "evex")
15603 (set_attr "mode" "XI")])
15605 (define_insn "avx2_<code>v8qiv8si2<mask_name>"
15606 [(set (match_operand:V8SI 0 "register_operand" "=v")
15609 (match_operand:V16QI 1 "nonimmediate_operand" "vm")
15610 (parallel [(const_int 0) (const_int 1)
15611 (const_int 2) (const_int 3)
15612 (const_int 4) (const_int 5)
15613 (const_int 6) (const_int 7)]))))]
15614 "TARGET_AVX2 && <mask_avx512vl_condition>"
15615 "vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15616 [(set_attr "type" "ssemov")
15617 (set_attr "prefix_extra" "1")
15618 (set_attr "prefix" "maybe_evex")
15619 (set_attr "mode" "OI")])
15621 (define_insn "sse4_1_<code>v4qiv4si2<mask_name>"
15622 [(set (match_operand:V4SI 0 "register_operand" "=Yr,*x,v")
15625 (match_operand:V16QI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15626 (parallel [(const_int 0) (const_int 1)
15627 (const_int 2) (const_int 3)]))))]
15628 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15629 "%vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
15630 [(set_attr "isa" "noavx,noavx,avx")
15631 (set_attr "type" "ssemov")
15632 (set_attr "prefix_extra" "1")
15633 (set_attr "prefix" "orig,orig,maybe_evex")
15634 (set_attr "mode" "TI")])
15636 (define_insn "avx512f_<code>v16hiv16si2<mask_name>"
15637 [(set (match_operand:V16SI 0 "register_operand" "=v")
15639 (match_operand:V16HI 1 "nonimmediate_operand" "vm")))]
15641 "vpmov<extsuffix>wd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15642 [(set_attr "type" "ssemov")
15643 (set_attr "prefix" "evex")
15644 (set_attr "mode" "XI")])
15646 (define_insn "avx2_<code>v8hiv8si2<mask_name>"
15647 [(set (match_operand:V8SI 0 "register_operand" "=v")
15649 (match_operand:V8HI 1 "nonimmediate_operand" "vm")))]
15650 "TARGET_AVX2 && <mask_avx512vl_condition>"
15651 "vpmov<extsuffix>wd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15652 [(set_attr "type" "ssemov")
15653 (set_attr "prefix_extra" "1")
15654 (set_attr "prefix" "maybe_evex")
15655 (set_attr "mode" "OI")])
15657 (define_insn "sse4_1_<code>v4hiv4si2<mask_name>"
15658 [(set (match_operand:V4SI 0 "register_operand" "=Yr,*x,v")
15661 (match_operand:V8HI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15662 (parallel [(const_int 0) (const_int 1)
15663 (const_int 2) (const_int 3)]))))]
15664 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15665 "%vpmov<extsuffix>wd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15666 [(set_attr "isa" "noavx,noavx,avx")
15667 (set_attr "type" "ssemov")
15668 (set_attr "prefix_extra" "1")
15669 (set_attr "prefix" "orig,orig,maybe_evex")
15670 (set_attr "mode" "TI")])
15672 (define_insn "avx512f_<code>v8qiv8di2<mask_name>"
15673 [(set (match_operand:V8DI 0 "register_operand" "=v")
15676 (match_operand:V16QI 1 "nonimmediate_operand" "vm")
15677 (parallel [(const_int 0) (const_int 1)
15678 (const_int 2) (const_int 3)
15679 (const_int 4) (const_int 5)
15680 (const_int 6) (const_int 7)]))))]
15682 "vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
15683 [(set_attr "type" "ssemov")
15684 (set_attr "prefix" "evex")
15685 (set_attr "mode" "XI")])
15687 (define_insn "avx2_<code>v4qiv4di2<mask_name>"
15688 [(set (match_operand:V4DI 0 "register_operand" "=v")
15691 (match_operand:V16QI 1 "nonimmediate_operand" "vm")
15692 (parallel [(const_int 0) (const_int 1)
15693 (const_int 2) (const_int 3)]))))]
15694 "TARGET_AVX2 && <mask_avx512vl_condition>"
15695 "vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
15696 [(set_attr "type" "ssemov")
15697 (set_attr "prefix_extra" "1")
15698 (set_attr "prefix" "maybe_evex")
15699 (set_attr "mode" "OI")])
15701 (define_insn "sse4_1_<code>v2qiv2di2<mask_name>"
15702 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
15705 (match_operand:V16QI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15706 (parallel [(const_int 0) (const_int 1)]))))]
15707 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15708 "%vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %w1}"
15709 [(set_attr "isa" "noavx,noavx,avx")
15710 (set_attr "type" "ssemov")
15711 (set_attr "prefix_extra" "1")
15712 (set_attr "prefix" "orig,orig,maybe_evex")
15713 (set_attr "mode" "TI")])
15715 (define_insn "avx512f_<code>v8hiv8di2<mask_name>"
15716 [(set (match_operand:V8DI 0 "register_operand" "=v")
15718 (match_operand:V8HI 1 "nonimmediate_operand" "vm")))]
15720 "vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15721 [(set_attr "type" "ssemov")
15722 (set_attr "prefix" "evex")
15723 (set_attr "mode" "XI")])
15725 (define_insn "avx2_<code>v4hiv4di2<mask_name>"
15726 [(set (match_operand:V4DI 0 "register_operand" "=v")
15729 (match_operand:V8HI 1 "nonimmediate_operand" "vm")
15730 (parallel [(const_int 0) (const_int 1)
15731 (const_int 2) (const_int 3)]))))]
15732 "TARGET_AVX2 && <mask_avx512vl_condition>"
15733 "vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15734 [(set_attr "type" "ssemov")
15735 (set_attr "prefix_extra" "1")
15736 (set_attr "prefix" "maybe_evex")
15737 (set_attr "mode" "OI")])
15739 (define_insn "sse4_1_<code>v2hiv2di2<mask_name>"
15740 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
15743 (match_operand:V8HI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15744 (parallel [(const_int 0) (const_int 1)]))))]
15745 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15746 "%vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
15747 [(set_attr "isa" "noavx,noavx,avx")
15748 (set_attr "type" "ssemov")
15749 (set_attr "prefix_extra" "1")
15750 (set_attr "prefix" "orig,orig,maybe_evex")
15751 (set_attr "mode" "TI")])
15753 (define_insn "avx512f_<code>v8siv8di2<mask_name>"
15754 [(set (match_operand:V8DI 0 "register_operand" "=v")
15756 (match_operand:V8SI 1 "nonimmediate_operand" "vm")))]
15758 "vpmov<extsuffix>dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15759 [(set_attr "type" "ssemov")
15760 (set_attr "prefix" "evex")
15761 (set_attr "mode" "XI")])
15763 (define_insn "avx2_<code>v4siv4di2<mask_name>"
15764 [(set (match_operand:V4DI 0 "register_operand" "=v")
15766 (match_operand:V4SI 1 "nonimmediate_operand" "vm")))]
15767 "TARGET_AVX2 && <mask_avx512vl_condition>"
15768 "vpmov<extsuffix>dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15769 [(set_attr "type" "ssemov")
15770 (set_attr "prefix" "maybe_evex")
15771 (set_attr "prefix_extra" "1")
15772 (set_attr "mode" "OI")])
15774 (define_insn "sse4_1_<code>v2siv2di2<mask_name>"
15775 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
15778 (match_operand:V4SI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15779 (parallel [(const_int 0) (const_int 1)]))))]
15780 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15781 "%vpmov<extsuffix>dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15782 [(set_attr "isa" "noavx,noavx,avx")
15783 (set_attr "type" "ssemov")
15784 (set_attr "prefix_extra" "1")
15785 (set_attr "prefix" "orig,orig,maybe_evex")
15786 (set_attr "mode" "TI")])
15788 ;; ptestps/ptestpd are very similar to comiss and ucomiss when
15789 ;; setting FLAGS_REG. But it is not a really compare instruction.
15790 (define_insn "avx_vtest<ssemodesuffix><avxsizesuffix>"
15791 [(set (reg:CC FLAGS_REG)
15792 (unspec:CC [(match_operand:VF_128_256 0 "register_operand" "x")
15793 (match_operand:VF_128_256 1 "nonimmediate_operand" "xm")]
15796 "vtest<ssemodesuffix>\t{%1, %0|%0, %1}"
15797 [(set_attr "type" "ssecomi")
15798 (set_attr "prefix_extra" "1")
15799 (set_attr "prefix" "vex")
15800 (set_attr "mode" "<MODE>")])
15802 ;; ptest is very similar to comiss and ucomiss when setting FLAGS_REG.
15803 ;; But it is not a really compare instruction.
15804 (define_insn "<sse4_1>_ptest<mode>"
15805 [(set (reg:CC FLAGS_REG)
15806 (unspec:CC [(match_operand:V_AVX 0 "register_operand" "Yr, *x, x")
15807 (match_operand:V_AVX 1 "vector_operand" "YrBm, *xBm, xm")]
15810 "%vptest\t{%1, %0|%0, %1}"
15811 [(set_attr "isa" "noavx,noavx,avx")
15812 (set_attr "type" "ssecomi")
15813 (set_attr "prefix_extra" "1")
15814 (set_attr "prefix" "orig,orig,vex")
15815 (set (attr "btver2_decode")
15817 (match_test "<sseinsnmode>mode==OImode")
15818 (const_string "vector")
15819 (const_string "*")))
15820 (set_attr "mode" "<sseinsnmode>")])
15822 (define_insn "ptesttf2"
15823 [(set (reg:CC FLAGS_REG)
15824 (unspec:CC [(match_operand:TF 0 "register_operand" "Yr, *x, x")
15825 (match_operand:TF 1 "vector_operand" "YrBm, *xBm, xm")]
15828 "%vptest\t{%1, %0|%0, %1}"
15829 [(set_attr "isa" "noavx,noavx,avx")
15830 (set_attr "type" "ssecomi")
15831 (set_attr "prefix_extra" "1")
15832 (set_attr "prefix" "orig,orig,vex")
15833 (set_attr "mode" "TI")])
15835 (define_insn "<sse4_1>_round<ssemodesuffix><avxsizesuffix>"
15836 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
15838 [(match_operand:VF_128_256 1 "vector_operand" "YrBm,*xBm,xm")
15839 (match_operand:SI 2 "const_0_to_15_operand" "n,n,n")]
15842 "%vround<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
15843 [(set_attr "isa" "noavx,noavx,avx")
15844 (set_attr "type" "ssecvt")
15845 (set_attr "prefix_data16" "1,1,*")
15846 (set_attr "prefix_extra" "1")
15847 (set_attr "length_immediate" "1")
15848 (set_attr "prefix" "orig,orig,vex")
15849 (set_attr "mode" "<MODE>")])
15851 (define_expand "<sse4_1>_round<ssemodesuffix>_sfix<avxsizesuffix>"
15852 [(match_operand:<sseintvecmode> 0 "register_operand")
15853 (match_operand:VF1_128_256 1 "vector_operand")
15854 (match_operand:SI 2 "const_0_to_15_operand")]
15857 rtx tmp = gen_reg_rtx (<MODE>mode);
15860 (gen_<sse4_1>_round<ssemodesuffix><avxsizesuffix> (tmp, operands[1],
15863 (gen_fix_trunc<mode><sseintvecmodelower>2 (operands[0], tmp));
15867 (define_expand "avx512f_round<castmode>512"
15868 [(match_operand:VF_512 0 "register_operand")
15869 (match_operand:VF_512 1 "nonimmediate_operand")
15870 (match_operand:SI 2 "const_0_to_15_operand")]
15873 emit_insn (gen_avx512f_rndscale<mode> (operands[0], operands[1], operands[2]));
15877 (define_expand "avx512f_roundps512_sfix"
15878 [(match_operand:V16SI 0 "register_operand")
15879 (match_operand:V16SF 1 "nonimmediate_operand")
15880 (match_operand:SI 2 "const_0_to_15_operand")]
15883 rtx tmp = gen_reg_rtx (V16SFmode);
15884 emit_insn (gen_avx512f_rndscalev16sf (tmp, operands[1], operands[2]));
15885 emit_insn (gen_fix_truncv16sfv16si2 (operands[0], tmp));
15889 (define_expand "<sse4_1>_round<ssemodesuffix>_vec_pack_sfix<avxsizesuffix>"
15890 [(match_operand:<ssepackfltmode> 0 "register_operand")
15891 (match_operand:VF2 1 "vector_operand")
15892 (match_operand:VF2 2 "vector_operand")
15893 (match_operand:SI 3 "const_0_to_15_operand")]
15898 if (<MODE>mode == V2DFmode
15899 && TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
15901 rtx tmp2 = gen_reg_rtx (V4DFmode);
15903 tmp0 = gen_reg_rtx (V4DFmode);
15904 tmp1 = force_reg (V2DFmode, operands[1]);
15906 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
15907 emit_insn (gen_avx_roundpd256 (tmp2, tmp0, operands[3]));
15908 emit_insn (gen_fix_truncv4dfv4si2 (operands[0], tmp2));
15912 tmp0 = gen_reg_rtx (<MODE>mode);
15913 tmp1 = gen_reg_rtx (<MODE>mode);
15916 (gen_<sse4_1>_round<ssemodesuffix><avxsizesuffix> (tmp0, operands[1],
15919 (gen_<sse4_1>_round<ssemodesuffix><avxsizesuffix> (tmp1, operands[2],
15922 (gen_vec_pack_sfix_trunc_<mode> (operands[0], tmp0, tmp1));
15927 (define_insn "sse4_1_round<ssescalarmodesuffix>"
15928 [(set (match_operand:VF_128 0 "register_operand" "=Yr,*x,x,v")
15931 [(match_operand:VF_128 2 "register_operand" "Yr,*x,x,v")
15932 (match_operand:SI 3 "const_0_to_15_operand" "n,n,n,n")]
15934 (match_operand:VF_128 1 "register_operand" "0,0,x,v")
15938 round<ssescalarmodesuffix>\t{%3, %2, %0|%0, %2, %3}
15939 round<ssescalarmodesuffix>\t{%3, %2, %0|%0, %2, %3}
15940 vround<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
15941 vrndscale<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15942 [(set_attr "isa" "noavx,noavx,avx,avx512f")
15943 (set_attr "type" "ssecvt")
15944 (set_attr "length_immediate" "1")
15945 (set_attr "prefix_data16" "1,1,*,*")
15946 (set_attr "prefix_extra" "1")
15947 (set_attr "prefix" "orig,orig,vex,evex")
15948 (set_attr "mode" "<MODE>")])
15950 (define_expand "round<mode>2"
15951 [(set (match_dup 3)
15953 (match_operand:VF 1 "register_operand")
15955 (set (match_operand:VF 0 "register_operand")
15957 [(match_dup 3) (match_dup 4)]
15959 "TARGET_SSE4_1 && !flag_trapping_math"
15961 machine_mode scalar_mode;
15962 const struct real_format *fmt;
15963 REAL_VALUE_TYPE pred_half, half_minus_pred_half;
15964 rtx half, vec_half;
15966 scalar_mode = GET_MODE_INNER (<MODE>mode);
15968 /* load nextafter (0.5, 0.0) */
15969 fmt = REAL_MODE_FORMAT (scalar_mode);
15970 real_2expN (&half_minus_pred_half, -(fmt->p) - 1, scalar_mode);
15971 real_arithmetic (&pred_half, MINUS_EXPR, &dconsthalf, &half_minus_pred_half);
15972 half = const_double_from_real_value (pred_half, scalar_mode);
15974 vec_half = ix86_build_const_vector (<MODE>mode, true, half);
15975 vec_half = force_reg (<MODE>mode, vec_half);
15977 operands[2] = gen_reg_rtx (<MODE>mode);
15978 emit_insn (gen_copysign<mode>3 (operands[2], vec_half, operands[1]));
15980 operands[3] = gen_reg_rtx (<MODE>mode);
15981 operands[4] = GEN_INT (ROUND_TRUNC);
15984 (define_expand "round<mode>2_sfix"
15985 [(match_operand:<sseintvecmode> 0 "register_operand")
15986 (match_operand:VF1 1 "register_operand")]
15987 "TARGET_SSE4_1 && !flag_trapping_math"
15989 rtx tmp = gen_reg_rtx (<MODE>mode);
15991 emit_insn (gen_round<mode>2 (tmp, operands[1]));
15994 (gen_fix_trunc<mode><sseintvecmodelower>2 (operands[0], tmp));
15998 (define_expand "round<mode>2_vec_pack_sfix"
15999 [(match_operand:<ssepackfltmode> 0 "register_operand")
16000 (match_operand:VF2 1 "register_operand")
16001 (match_operand:VF2 2 "register_operand")]
16002 "TARGET_SSE4_1 && !flag_trapping_math"
16006 if (<MODE>mode == V2DFmode
16007 && TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
16009 rtx tmp2 = gen_reg_rtx (V4DFmode);
16011 tmp0 = gen_reg_rtx (V4DFmode);
16012 tmp1 = force_reg (V2DFmode, operands[1]);
16014 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
16015 emit_insn (gen_roundv4df2 (tmp2, tmp0));
16016 emit_insn (gen_fix_truncv4dfv4si2 (operands[0], tmp2));
16020 tmp0 = gen_reg_rtx (<MODE>mode);
16021 tmp1 = gen_reg_rtx (<MODE>mode);
16023 emit_insn (gen_round<mode>2 (tmp0, operands[1]));
16024 emit_insn (gen_round<mode>2 (tmp1, operands[2]));
16027 (gen_vec_pack_sfix_trunc_<mode> (operands[0], tmp0, tmp1));
16032 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16034 ;; Intel SSE4.2 string/text processing instructions
16036 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16038 (define_insn_and_split "sse4_2_pcmpestr"
16039 [(set (match_operand:SI 0 "register_operand" "=c,c")
16041 [(match_operand:V16QI 2 "register_operand" "x,x")
16042 (match_operand:SI 3 "register_operand" "a,a")
16043 (match_operand:V16QI 4 "nonimmediate_operand" "x,m")
16044 (match_operand:SI 5 "register_operand" "d,d")
16045 (match_operand:SI 6 "const_0_to_255_operand" "n,n")]
16047 (set (match_operand:V16QI 1 "register_operand" "=Yz,Yz")
16055 (set (reg:CC FLAGS_REG)
16064 && can_create_pseudo_p ()"
16069 int ecx = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[0]));
16070 int xmm0 = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[1]));
16071 int flags = !find_regno_note (curr_insn, REG_UNUSED, FLAGS_REG);
16074 emit_insn (gen_sse4_2_pcmpestri (operands[0], operands[2],
16075 operands[3], operands[4],
16076 operands[5], operands[6]));
16078 emit_insn (gen_sse4_2_pcmpestrm (operands[1], operands[2],
16079 operands[3], operands[4],
16080 operands[5], operands[6]));
16081 if (flags && !(ecx || xmm0))
16082 emit_insn (gen_sse4_2_pcmpestr_cconly (NULL, NULL,
16083 operands[2], operands[3],
16084 operands[4], operands[5],
16086 if (!(flags || ecx || xmm0))
16087 emit_note (NOTE_INSN_DELETED);
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 "memory" "none,load")
16096 (set_attr "mode" "TI")])
16098 (define_insn "sse4_2_pcmpestri"
16099 [(set (match_operand:SI 0 "register_operand" "=c,c")
16101 [(match_operand:V16QI 1 "register_operand" "x,x")
16102 (match_operand:SI 2 "register_operand" "a,a")
16103 (match_operand:V16QI 3 "nonimmediate_operand" "x,m")
16104 (match_operand:SI 4 "register_operand" "d,d")
16105 (match_operand:SI 5 "const_0_to_255_operand" "n,n")]
16107 (set (reg:CC FLAGS_REG)
16116 "%vpcmpestri\t{%5, %3, %1|%1, %3, %5}"
16117 [(set_attr "type" "sselog")
16118 (set_attr "prefix_data16" "1")
16119 (set_attr "prefix_extra" "1")
16120 (set_attr "prefix" "maybe_vex")
16121 (set_attr "length_immediate" "1")
16122 (set_attr "btver2_decode" "vector")
16123 (set_attr "memory" "none,load")
16124 (set_attr "mode" "TI")])
16126 (define_insn "sse4_2_pcmpestrm"
16127 [(set (match_operand:V16QI 0 "register_operand" "=Yz,Yz")
16129 [(match_operand:V16QI 1 "register_operand" "x,x")
16130 (match_operand:SI 2 "register_operand" "a,a")
16131 (match_operand:V16QI 3 "nonimmediate_operand" "x,m")
16132 (match_operand:SI 4 "register_operand" "d,d")
16133 (match_operand:SI 5 "const_0_to_255_operand" "n,n")]
16135 (set (reg:CC FLAGS_REG)
16144 "%vpcmpestrm\t{%5, %3, %1|%1, %3, %5}"
16145 [(set_attr "type" "sselog")
16146 (set_attr "prefix_data16" "1")
16147 (set_attr "prefix_extra" "1")
16148 (set_attr "length_immediate" "1")
16149 (set_attr "prefix" "maybe_vex")
16150 (set_attr "btver2_decode" "vector")
16151 (set_attr "memory" "none,load")
16152 (set_attr "mode" "TI")])
16154 (define_insn "sse4_2_pcmpestr_cconly"
16155 [(set (reg:CC FLAGS_REG)
16157 [(match_operand:V16QI 2 "register_operand" "x,x,x,x")
16158 (match_operand:SI 3 "register_operand" "a,a,a,a")
16159 (match_operand:V16QI 4 "nonimmediate_operand" "x,m,x,m")
16160 (match_operand:SI 5 "register_operand" "d,d,d,d")
16161 (match_operand:SI 6 "const_0_to_255_operand" "n,n,n,n")]
16163 (clobber (match_scratch:V16QI 0 "=Yz,Yz,X,X"))
16164 (clobber (match_scratch:SI 1 "= X, X,c,c"))]
16167 %vpcmpestrm\t{%6, %4, %2|%2, %4, %6}
16168 %vpcmpestrm\t{%6, %4, %2|%2, %4, %6}
16169 %vpcmpestri\t{%6, %4, %2|%2, %4, %6}
16170 %vpcmpestri\t{%6, %4, %2|%2, %4, %6}"
16171 [(set_attr "type" "sselog")
16172 (set_attr "prefix_data16" "1")
16173 (set_attr "prefix_extra" "1")
16174 (set_attr "length_immediate" "1")
16175 (set_attr "memory" "none,load,none,load")
16176 (set_attr "btver2_decode" "vector,vector,vector,vector")
16177 (set_attr "prefix" "maybe_vex")
16178 (set_attr "mode" "TI")])
16180 (define_insn_and_split "sse4_2_pcmpistr"
16181 [(set (match_operand:SI 0 "register_operand" "=c,c")
16183 [(match_operand:V16QI 2 "register_operand" "x,x")
16184 (match_operand:V16QI 3 "nonimmediate_operand" "x,m")
16185 (match_operand:SI 4 "const_0_to_255_operand" "n,n")]
16187 (set (match_operand:V16QI 1 "register_operand" "=Yz,Yz")
16193 (set (reg:CC FLAGS_REG)
16200 && can_create_pseudo_p ()"
16205 int ecx = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[0]));
16206 int xmm0 = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[1]));
16207 int flags = !find_regno_note (curr_insn, REG_UNUSED, FLAGS_REG);
16210 emit_insn (gen_sse4_2_pcmpistri (operands[0], operands[2],
16211 operands[3], operands[4]));
16213 emit_insn (gen_sse4_2_pcmpistrm (operands[1], operands[2],
16214 operands[3], operands[4]));
16215 if (flags && !(ecx || xmm0))
16216 emit_insn (gen_sse4_2_pcmpistr_cconly (NULL, NULL,
16217 operands[2], operands[3],
16219 if (!(flags || ecx || xmm0))
16220 emit_note (NOTE_INSN_DELETED);
16224 [(set_attr "type" "sselog")
16225 (set_attr "prefix_data16" "1")
16226 (set_attr "prefix_extra" "1")
16227 (set_attr "length_immediate" "1")
16228 (set_attr "memory" "none,load")
16229 (set_attr "mode" "TI")])
16231 (define_insn "sse4_2_pcmpistri"
16232 [(set (match_operand:SI 0 "register_operand" "=c,c")
16234 [(match_operand:V16QI 1 "register_operand" "x,x")
16235 (match_operand:V16QI 2 "nonimmediate_operand" "x,m")
16236 (match_operand:SI 3 "const_0_to_255_operand" "n,n")]
16238 (set (reg:CC FLAGS_REG)
16245 "%vpcmpistri\t{%3, %2, %1|%1, %2, %3}"
16246 [(set_attr "type" "sselog")
16247 (set_attr "prefix_data16" "1")
16248 (set_attr "prefix_extra" "1")
16249 (set_attr "length_immediate" "1")
16250 (set_attr "prefix" "maybe_vex")
16251 (set_attr "memory" "none,load")
16252 (set_attr "btver2_decode" "vector")
16253 (set_attr "mode" "TI")])
16255 (define_insn "sse4_2_pcmpistrm"
16256 [(set (match_operand:V16QI 0 "register_operand" "=Yz,Yz")
16258 [(match_operand:V16QI 1 "register_operand" "x,x")
16259 (match_operand:V16QI 2 "nonimmediate_operand" "x,m")
16260 (match_operand:SI 3 "const_0_to_255_operand" "n,n")]
16262 (set (reg:CC FLAGS_REG)
16269 "%vpcmpistrm\t{%3, %2, %1|%1, %2, %3}"
16270 [(set_attr "type" "sselog")
16271 (set_attr "prefix_data16" "1")
16272 (set_attr "prefix_extra" "1")
16273 (set_attr "length_immediate" "1")
16274 (set_attr "prefix" "maybe_vex")
16275 (set_attr "memory" "none,load")
16276 (set_attr "btver2_decode" "vector")
16277 (set_attr "mode" "TI")])
16279 (define_insn "sse4_2_pcmpistr_cconly"
16280 [(set (reg:CC FLAGS_REG)
16282 [(match_operand:V16QI 2 "register_operand" "x,x,x,x")
16283 (match_operand:V16QI 3 "nonimmediate_operand" "x,m,x,m")
16284 (match_operand:SI 4 "const_0_to_255_operand" "n,n,n,n")]
16286 (clobber (match_scratch:V16QI 0 "=Yz,Yz,X,X"))
16287 (clobber (match_scratch:SI 1 "= X, X,c,c"))]
16290 %vpcmpistrm\t{%4, %3, %2|%2, %3, %4}
16291 %vpcmpistrm\t{%4, %3, %2|%2, %3, %4}
16292 %vpcmpistri\t{%4, %3, %2|%2, %3, %4}
16293 %vpcmpistri\t{%4, %3, %2|%2, %3, %4}"
16294 [(set_attr "type" "sselog")
16295 (set_attr "prefix_data16" "1")
16296 (set_attr "prefix_extra" "1")
16297 (set_attr "length_immediate" "1")
16298 (set_attr "memory" "none,load,none,load")
16299 (set_attr "prefix" "maybe_vex")
16300 (set_attr "btver2_decode" "vector,vector,vector,vector")
16301 (set_attr "mode" "TI")])
16303 ;; Packed float variants
16304 (define_mode_attr GATHER_SCATTER_SF_MEM_MODE
16305 [(V8DI "V8SF") (V16SI "V16SF")])
16307 (define_expand "avx512pf_gatherpf<mode>sf"
16309 [(match_operand:<avx512fmaskmode> 0 "register_operand")
16310 (mem:<GATHER_SCATTER_SF_MEM_MODE>
16312 [(match_operand 2 "vsib_address_operand")
16313 (match_operand:VI48_512 1 "register_operand")
16314 (match_operand:SI 3 "const1248_operand")]))
16315 (match_operand:SI 4 "const_2_to_3_operand")]
16316 UNSPEC_GATHER_PREFETCH)]
16320 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
16321 operands[3]), UNSPEC_VSIBADDR);
16324 (define_insn "*avx512pf_gatherpf<mode>sf_mask"
16326 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
16327 (match_operator:<GATHER_SCATTER_SF_MEM_MODE> 5 "vsib_mem_operator"
16329 [(match_operand:P 2 "vsib_address_operand" "Tv")
16330 (match_operand:VI48_512 1 "register_operand" "v")
16331 (match_operand:SI 3 "const1248_operand" "n")]
16333 (match_operand:SI 4 "const_2_to_3_operand" "n")]
16334 UNSPEC_GATHER_PREFETCH)]
16337 switch (INTVAL (operands[4]))
16340 return "vgatherpf0<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
16342 return "vgatherpf1<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
16344 gcc_unreachable ();
16347 [(set_attr "type" "sse")
16348 (set_attr "prefix" "evex")
16349 (set_attr "mode" "XI")])
16351 ;; Packed double variants
16352 (define_expand "avx512pf_gatherpf<mode>df"
16354 [(match_operand:<avx512fmaskmode> 0 "register_operand")
16357 [(match_operand 2 "vsib_address_operand")
16358 (match_operand:VI4_256_8_512 1 "register_operand")
16359 (match_operand:SI 3 "const1248_operand")]))
16360 (match_operand:SI 4 "const_2_to_3_operand")]
16361 UNSPEC_GATHER_PREFETCH)]
16365 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
16366 operands[3]), UNSPEC_VSIBADDR);
16369 (define_insn "*avx512pf_gatherpf<mode>df_mask"
16371 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
16372 (match_operator:V8DF 5 "vsib_mem_operator"
16374 [(match_operand:P 2 "vsib_address_operand" "Tv")
16375 (match_operand:VI4_256_8_512 1 "register_operand" "v")
16376 (match_operand:SI 3 "const1248_operand" "n")]
16378 (match_operand:SI 4 "const_2_to_3_operand" "n")]
16379 UNSPEC_GATHER_PREFETCH)]
16382 switch (INTVAL (operands[4]))
16385 return "vgatherpf0<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
16387 return "vgatherpf1<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
16389 gcc_unreachable ();
16392 [(set_attr "type" "sse")
16393 (set_attr "prefix" "evex")
16394 (set_attr "mode" "XI")])
16396 ;; Packed float variants
16397 (define_expand "avx512pf_scatterpf<mode>sf"
16399 [(match_operand:<avx512fmaskmode> 0 "register_operand")
16400 (mem:<GATHER_SCATTER_SF_MEM_MODE>
16402 [(match_operand 2 "vsib_address_operand")
16403 (match_operand:VI48_512 1 "register_operand")
16404 (match_operand:SI 3 "const1248_operand")]))
16405 (match_operand:SI 4 "const2367_operand")]
16406 UNSPEC_SCATTER_PREFETCH)]
16410 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
16411 operands[3]), UNSPEC_VSIBADDR);
16414 (define_insn "*avx512pf_scatterpf<mode>sf_mask"
16416 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
16417 (match_operator:<GATHER_SCATTER_SF_MEM_MODE> 5 "vsib_mem_operator"
16419 [(match_operand:P 2 "vsib_address_operand" "Tv")
16420 (match_operand:VI48_512 1 "register_operand" "v")
16421 (match_operand:SI 3 "const1248_operand" "n")]
16423 (match_operand:SI 4 "const2367_operand" "n")]
16424 UNSPEC_SCATTER_PREFETCH)]
16427 switch (INTVAL (operands[4]))
16431 return "vscatterpf0<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
16434 return "vscatterpf1<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
16436 gcc_unreachable ();
16439 [(set_attr "type" "sse")
16440 (set_attr "prefix" "evex")
16441 (set_attr "mode" "XI")])
16443 ;; Packed double variants
16444 (define_expand "avx512pf_scatterpf<mode>df"
16446 [(match_operand:<avx512fmaskmode> 0 "register_operand")
16449 [(match_operand 2 "vsib_address_operand")
16450 (match_operand:VI4_256_8_512 1 "register_operand")
16451 (match_operand:SI 3 "const1248_operand")]))
16452 (match_operand:SI 4 "const2367_operand")]
16453 UNSPEC_SCATTER_PREFETCH)]
16457 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
16458 operands[3]), UNSPEC_VSIBADDR);
16461 (define_insn "*avx512pf_scatterpf<mode>df_mask"
16463 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
16464 (match_operator:V8DF 5 "vsib_mem_operator"
16466 [(match_operand:P 2 "vsib_address_operand" "Tv")
16467 (match_operand:VI4_256_8_512 1 "register_operand" "v")
16468 (match_operand:SI 3 "const1248_operand" "n")]
16470 (match_operand:SI 4 "const2367_operand" "n")]
16471 UNSPEC_SCATTER_PREFETCH)]
16474 switch (INTVAL (operands[4]))
16478 return "vscatterpf0<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
16481 return "vscatterpf1<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
16483 gcc_unreachable ();
16486 [(set_attr "type" "sse")
16487 (set_attr "prefix" "evex")
16488 (set_attr "mode" "XI")])
16490 (define_insn "avx512er_exp2<mode><mask_name><round_saeonly_name>"
16491 [(set (match_operand:VF_512 0 "register_operand" "=v")
16493 [(match_operand:VF_512 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16496 "vexp2<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
16497 [(set_attr "prefix" "evex")
16498 (set_attr "type" "sse")
16499 (set_attr "mode" "<MODE>")])
16501 (define_insn "<mask_codefor>avx512er_rcp28<mode><mask_name><round_saeonly_name>"
16502 [(set (match_operand:VF_512 0 "register_operand" "=v")
16504 [(match_operand:VF_512 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16507 "vrcp28<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
16508 [(set_attr "prefix" "evex")
16509 (set_attr "type" "sse")
16510 (set_attr "mode" "<MODE>")])
16512 (define_insn "avx512er_vmrcp28<mode><round_saeonly_name>"
16513 [(set (match_operand:VF_128 0 "register_operand" "=v")
16516 [(match_operand:VF_128 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16518 (match_operand:VF_128 2 "register_operand" "v")
16521 "vrcp28<ssescalarmodesuffix>\t{<round_saeonly_op3>%1, %2, %0|%0, %2, %<iptr>1<round_saeonly_op3>}"
16522 [(set_attr "length_immediate" "1")
16523 (set_attr "prefix" "evex")
16524 (set_attr "type" "sse")
16525 (set_attr "mode" "<MODE>")])
16527 (define_insn "<mask_codefor>avx512er_rsqrt28<mode><mask_name><round_saeonly_name>"
16528 [(set (match_operand:VF_512 0 "register_operand" "=v")
16530 [(match_operand:VF_512 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16533 "vrsqrt28<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
16534 [(set_attr "prefix" "evex")
16535 (set_attr "type" "sse")
16536 (set_attr "mode" "<MODE>")])
16538 (define_insn "avx512er_vmrsqrt28<mode><round_saeonly_name>"
16539 [(set (match_operand:VF_128 0 "register_operand" "=v")
16542 [(match_operand:VF_128 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16544 (match_operand:VF_128 2 "register_operand" "v")
16547 "vrsqrt28<ssescalarmodesuffix>\t{<round_saeonly_op3>%1, %2, %0|%0, %2, %<iptr>1<round_saeonly_op3>}"
16548 [(set_attr "length_immediate" "1")
16549 (set_attr "type" "sse")
16550 (set_attr "prefix" "evex")
16551 (set_attr "mode" "<MODE>")])
16553 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16555 ;; XOP instructions
16557 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16559 (define_code_iterator xop_plus [plus ss_plus])
16561 (define_code_attr macs [(plus "macs") (ss_plus "macss")])
16562 (define_code_attr madcs [(plus "madcs") (ss_plus "madcss")])
16564 ;; XOP parallel integer multiply/add instructions.
16566 (define_insn "xop_p<macs><ssemodesuffix><ssemodesuffix>"
16567 [(set (match_operand:VI24_128 0 "register_operand" "=x")
16570 (match_operand:VI24_128 1 "nonimmediate_operand" "%x")
16571 (match_operand:VI24_128 2 "nonimmediate_operand" "xm"))
16572 (match_operand:VI24_128 3 "register_operand" "x")))]
16574 "vp<macs><ssemodesuffix><ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16575 [(set_attr "type" "ssemuladd")
16576 (set_attr "mode" "TI")])
16578 (define_insn "xop_p<macs>dql"
16579 [(set (match_operand:V2DI 0 "register_operand" "=x")
16584 (match_operand:V4SI 1 "nonimmediate_operand" "%x")
16585 (parallel [(const_int 0) (const_int 2)])))
16588 (match_operand:V4SI 2 "nonimmediate_operand" "xm")
16589 (parallel [(const_int 0) (const_int 2)]))))
16590 (match_operand:V2DI 3 "register_operand" "x")))]
16592 "vp<macs>dql\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16593 [(set_attr "type" "ssemuladd")
16594 (set_attr "mode" "TI")])
16596 (define_insn "xop_p<macs>dqh"
16597 [(set (match_operand:V2DI 0 "register_operand" "=x")
16602 (match_operand:V4SI 1 "nonimmediate_operand" "%x")
16603 (parallel [(const_int 1) (const_int 3)])))
16606 (match_operand:V4SI 2 "nonimmediate_operand" "xm")
16607 (parallel [(const_int 1) (const_int 3)]))))
16608 (match_operand:V2DI 3 "register_operand" "x")))]
16610 "vp<macs>dqh\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16611 [(set_attr "type" "ssemuladd")
16612 (set_attr "mode" "TI")])
16614 ;; XOP parallel integer multiply/add instructions for the intrinisics
16615 (define_insn "xop_p<macs>wd"
16616 [(set (match_operand:V4SI 0 "register_operand" "=x")
16621 (match_operand:V8HI 1 "nonimmediate_operand" "%x")
16622 (parallel [(const_int 1) (const_int 3)
16623 (const_int 5) (const_int 7)])))
16626 (match_operand:V8HI 2 "nonimmediate_operand" "xm")
16627 (parallel [(const_int 1) (const_int 3)
16628 (const_int 5) (const_int 7)]))))
16629 (match_operand:V4SI 3 "register_operand" "x")))]
16631 "vp<macs>wd\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16632 [(set_attr "type" "ssemuladd")
16633 (set_attr "mode" "TI")])
16635 (define_insn "xop_p<madcs>wd"
16636 [(set (match_operand:V4SI 0 "register_operand" "=x")
16642 (match_operand:V8HI 1 "nonimmediate_operand" "%x")
16643 (parallel [(const_int 0) (const_int 2)
16644 (const_int 4) (const_int 6)])))
16647 (match_operand:V8HI 2 "nonimmediate_operand" "xm")
16648 (parallel [(const_int 0) (const_int 2)
16649 (const_int 4) (const_int 6)]))))
16654 (parallel [(const_int 1) (const_int 3)
16655 (const_int 5) (const_int 7)])))
16659 (parallel [(const_int 1) (const_int 3)
16660 (const_int 5) (const_int 7)])))))
16661 (match_operand:V4SI 3 "register_operand" "x")))]
16663 "vp<madcs>wd\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16664 [(set_attr "type" "ssemuladd")
16665 (set_attr "mode" "TI")])
16667 ;; XOP parallel XMM conditional moves
16668 (define_insn "xop_pcmov_<mode><avxsizesuffix>"
16669 [(set (match_operand:V_128_256 0 "register_operand" "=x,x")
16670 (if_then_else:V_128_256
16671 (match_operand:V_128_256 3 "nonimmediate_operand" "x,m")
16672 (match_operand:V_128_256 1 "register_operand" "x,x")
16673 (match_operand:V_128_256 2 "nonimmediate_operand" "xm,x")))]
16675 "vpcmov\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16676 [(set_attr "type" "sse4arg")])
16678 ;; XOP horizontal add/subtract instructions
16679 (define_insn "xop_phadd<u>bw"
16680 [(set (match_operand:V8HI 0 "register_operand" "=x")
16684 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
16685 (parallel [(const_int 0) (const_int 2)
16686 (const_int 4) (const_int 6)
16687 (const_int 8) (const_int 10)
16688 (const_int 12) (const_int 14)])))
16692 (parallel [(const_int 1) (const_int 3)
16693 (const_int 5) (const_int 7)
16694 (const_int 9) (const_int 11)
16695 (const_int 13) (const_int 15)])))))]
16697 "vphadd<u>bw\t{%1, %0|%0, %1}"
16698 [(set_attr "type" "sseiadd1")])
16700 (define_insn "xop_phadd<u>bd"
16701 [(set (match_operand:V4SI 0 "register_operand" "=x")
16706 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
16707 (parallel [(const_int 0) (const_int 4)
16708 (const_int 8) (const_int 12)])))
16712 (parallel [(const_int 1) (const_int 5)
16713 (const_int 9) (const_int 13)]))))
16718 (parallel [(const_int 2) (const_int 6)
16719 (const_int 10) (const_int 14)])))
16723 (parallel [(const_int 3) (const_int 7)
16724 (const_int 11) (const_int 15)]))))))]
16726 "vphadd<u>bd\t{%1, %0|%0, %1}"
16727 [(set_attr "type" "sseiadd1")])
16729 (define_insn "xop_phadd<u>bq"
16730 [(set (match_operand:V2DI 0 "register_operand" "=x")
16736 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
16737 (parallel [(const_int 0) (const_int 8)])))
16741 (parallel [(const_int 1) (const_int 9)]))))
16746 (parallel [(const_int 2) (const_int 10)])))
16750 (parallel [(const_int 3) (const_int 11)])))))
16756 (parallel [(const_int 4) (const_int 12)])))
16760 (parallel [(const_int 5) (const_int 13)]))))
16765 (parallel [(const_int 6) (const_int 14)])))
16769 (parallel [(const_int 7) (const_int 15)])))))))]
16771 "vphadd<u>bq\t{%1, %0|%0, %1}"
16772 [(set_attr "type" "sseiadd1")])
16774 (define_insn "xop_phadd<u>wd"
16775 [(set (match_operand:V4SI 0 "register_operand" "=x")
16779 (match_operand:V8HI 1 "nonimmediate_operand" "xm")
16780 (parallel [(const_int 0) (const_int 2)
16781 (const_int 4) (const_int 6)])))
16785 (parallel [(const_int 1) (const_int 3)
16786 (const_int 5) (const_int 7)])))))]
16788 "vphadd<u>wd\t{%1, %0|%0, %1}"
16789 [(set_attr "type" "sseiadd1")])
16791 (define_insn "xop_phadd<u>wq"
16792 [(set (match_operand:V2DI 0 "register_operand" "=x")
16797 (match_operand:V8HI 1 "nonimmediate_operand" "xm")
16798 (parallel [(const_int 0) (const_int 4)])))
16802 (parallel [(const_int 1) (const_int 5)]))))
16807 (parallel [(const_int 2) (const_int 6)])))
16811 (parallel [(const_int 3) (const_int 7)]))))))]
16813 "vphadd<u>wq\t{%1, %0|%0, %1}"
16814 [(set_attr "type" "sseiadd1")])
16816 (define_insn "xop_phadd<u>dq"
16817 [(set (match_operand:V2DI 0 "register_operand" "=x")
16821 (match_operand:V4SI 1 "nonimmediate_operand" "xm")
16822 (parallel [(const_int 0) (const_int 2)])))
16826 (parallel [(const_int 1) (const_int 3)])))))]
16828 "vphadd<u>dq\t{%1, %0|%0, %1}"
16829 [(set_attr "type" "sseiadd1")])
16831 (define_insn "xop_phsubbw"
16832 [(set (match_operand:V8HI 0 "register_operand" "=x")
16836 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
16837 (parallel [(const_int 0) (const_int 2)
16838 (const_int 4) (const_int 6)
16839 (const_int 8) (const_int 10)
16840 (const_int 12) (const_int 14)])))
16844 (parallel [(const_int 1) (const_int 3)
16845 (const_int 5) (const_int 7)
16846 (const_int 9) (const_int 11)
16847 (const_int 13) (const_int 15)])))))]
16849 "vphsubbw\t{%1, %0|%0, %1}"
16850 [(set_attr "type" "sseiadd1")])
16852 (define_insn "xop_phsubwd"
16853 [(set (match_operand:V4SI 0 "register_operand" "=x")
16857 (match_operand:V8HI 1 "nonimmediate_operand" "xm")
16858 (parallel [(const_int 0) (const_int 2)
16859 (const_int 4) (const_int 6)])))
16863 (parallel [(const_int 1) (const_int 3)
16864 (const_int 5) (const_int 7)])))))]
16866 "vphsubwd\t{%1, %0|%0, %1}"
16867 [(set_attr "type" "sseiadd1")])
16869 (define_insn "xop_phsubdq"
16870 [(set (match_operand:V2DI 0 "register_operand" "=x")
16874 (match_operand:V4SI 1 "nonimmediate_operand" "xm")
16875 (parallel [(const_int 0) (const_int 2)])))
16879 (parallel [(const_int 1) (const_int 3)])))))]
16881 "vphsubdq\t{%1, %0|%0, %1}"
16882 [(set_attr "type" "sseiadd1")])
16884 ;; XOP permute instructions
16885 (define_insn "xop_pperm"
16886 [(set (match_operand:V16QI 0 "register_operand" "=x,x")
16888 [(match_operand:V16QI 1 "register_operand" "x,x")
16889 (match_operand:V16QI 2 "nonimmediate_operand" "x,m")
16890 (match_operand:V16QI 3 "nonimmediate_operand" "xm,x")]
16891 UNSPEC_XOP_PERMUTE))]
16892 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
16893 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16894 [(set_attr "type" "sse4arg")
16895 (set_attr "mode" "TI")])
16897 ;; XOP pack instructions that combine two vectors into a smaller vector
16898 (define_insn "xop_pperm_pack_v2di_v4si"
16899 [(set (match_operand:V4SI 0 "register_operand" "=x,x")
16902 (match_operand:V2DI 1 "register_operand" "x,x"))
16904 (match_operand:V2DI 2 "nonimmediate_operand" "x,m"))))
16905 (use (match_operand:V16QI 3 "nonimmediate_operand" "xm,x"))]
16906 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
16907 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16908 [(set_attr "type" "sse4arg")
16909 (set_attr "mode" "TI")])
16911 (define_insn "xop_pperm_pack_v4si_v8hi"
16912 [(set (match_operand:V8HI 0 "register_operand" "=x,x")
16915 (match_operand:V4SI 1 "register_operand" "x,x"))
16917 (match_operand:V4SI 2 "nonimmediate_operand" "x,m"))))
16918 (use (match_operand:V16QI 3 "nonimmediate_operand" "xm,x"))]
16919 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
16920 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16921 [(set_attr "type" "sse4arg")
16922 (set_attr "mode" "TI")])
16924 (define_insn "xop_pperm_pack_v8hi_v16qi"
16925 [(set (match_operand:V16QI 0 "register_operand" "=x,x")
16928 (match_operand:V8HI 1 "register_operand" "x,x"))
16930 (match_operand:V8HI 2 "nonimmediate_operand" "x,m"))))
16931 (use (match_operand:V16QI 3 "nonimmediate_operand" "xm,x"))]
16932 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
16933 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16934 [(set_attr "type" "sse4arg")
16935 (set_attr "mode" "TI")])
16937 ;; XOP packed rotate instructions
16938 (define_expand "rotl<mode>3"
16939 [(set (match_operand:VI_128 0 "register_operand")
16941 (match_operand:VI_128 1 "nonimmediate_operand")
16942 (match_operand:SI 2 "general_operand")))]
16945 /* If we were given a scalar, convert it to parallel */
16946 if (! const_0_to_<sserotatemax>_operand (operands[2], SImode))
16948 rtvec vs = rtvec_alloc (<ssescalarnum>);
16949 rtx par = gen_rtx_PARALLEL (<MODE>mode, vs);
16950 rtx reg = gen_reg_rtx (<MODE>mode);
16951 rtx op2 = operands[2];
16954 if (GET_MODE (op2) != <ssescalarmode>mode)
16956 op2 = gen_reg_rtx (<ssescalarmode>mode);
16957 convert_move (op2, operands[2], false);
16960 for (i = 0; i < <ssescalarnum>; i++)
16961 RTVEC_ELT (vs, i) = op2;
16963 emit_insn (gen_vec_init<mode><ssescalarmodelower> (reg, par));
16964 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], reg));
16969 (define_expand "rotr<mode>3"
16970 [(set (match_operand:VI_128 0 "register_operand")
16972 (match_operand:VI_128 1 "nonimmediate_operand")
16973 (match_operand:SI 2 "general_operand")))]
16976 /* If we were given a scalar, convert it to parallel */
16977 if (! const_0_to_<sserotatemax>_operand (operands[2], SImode))
16979 rtvec vs = rtvec_alloc (<ssescalarnum>);
16980 rtx par = gen_rtx_PARALLEL (<MODE>mode, vs);
16981 rtx neg = gen_reg_rtx (<MODE>mode);
16982 rtx reg = gen_reg_rtx (<MODE>mode);
16983 rtx op2 = operands[2];
16986 if (GET_MODE (op2) != <ssescalarmode>mode)
16988 op2 = gen_reg_rtx (<ssescalarmode>mode);
16989 convert_move (op2, operands[2], false);
16992 for (i = 0; i < <ssescalarnum>; i++)
16993 RTVEC_ELT (vs, i) = op2;
16995 emit_insn (gen_vec_init<mode><ssescalarmodelower> (reg, par));
16996 emit_insn (gen_neg<mode>2 (neg, reg));
16997 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], neg));
17002 (define_insn "xop_rotl<mode>3"
17003 [(set (match_operand:VI_128 0 "register_operand" "=x")
17005 (match_operand:VI_128 1 "nonimmediate_operand" "xm")
17006 (match_operand:SI 2 "const_0_to_<sserotatemax>_operand" "n")))]
17008 "vprot<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
17009 [(set_attr "type" "sseishft")
17010 (set_attr "length_immediate" "1")
17011 (set_attr "mode" "TI")])
17013 (define_insn "xop_rotr<mode>3"
17014 [(set (match_operand:VI_128 0 "register_operand" "=x")
17016 (match_operand:VI_128 1 "nonimmediate_operand" "xm")
17017 (match_operand:SI 2 "const_0_to_<sserotatemax>_operand" "n")))]
17021 = GEN_INT (GET_MODE_BITSIZE (<ssescalarmode>mode) - INTVAL (operands[2]));
17022 return \"vprot<ssemodesuffix>\t{%3, %1, %0|%0, %1, %3}\";
17024 [(set_attr "type" "sseishft")
17025 (set_attr "length_immediate" "1")
17026 (set_attr "mode" "TI")])
17028 (define_expand "vrotr<mode>3"
17029 [(match_operand:VI_128 0 "register_operand")
17030 (match_operand:VI_128 1 "register_operand")
17031 (match_operand:VI_128 2 "register_operand")]
17034 rtx reg = gen_reg_rtx (<MODE>mode);
17035 emit_insn (gen_neg<mode>2 (reg, operands[2]));
17036 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], reg));
17040 (define_expand "vrotl<mode>3"
17041 [(match_operand:VI_128 0 "register_operand")
17042 (match_operand:VI_128 1 "register_operand")
17043 (match_operand:VI_128 2 "register_operand")]
17046 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], operands[2]));
17050 (define_insn "xop_vrotl<mode>3"
17051 [(set (match_operand:VI_128 0 "register_operand" "=x,x")
17052 (if_then_else:VI_128
17054 (match_operand:VI_128 2 "nonimmediate_operand" "x,m")
17057 (match_operand:VI_128 1 "nonimmediate_operand" "xm,x")
17061 (neg:VI_128 (match_dup 2)))))]
17062 "TARGET_XOP && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
17063 "vprot<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
17064 [(set_attr "type" "sseishft")
17065 (set_attr "prefix_data16" "0")
17066 (set_attr "prefix_extra" "2")
17067 (set_attr "mode" "TI")])
17069 ;; XOP packed shift instructions.
17070 (define_expand "vlshr<mode>3"
17071 [(set (match_operand:VI12_128 0 "register_operand")
17073 (match_operand:VI12_128 1 "register_operand")
17074 (match_operand:VI12_128 2 "nonimmediate_operand")))]
17077 rtx neg = gen_reg_rtx (<MODE>mode);
17078 emit_insn (gen_neg<mode>2 (neg, operands[2]));
17079 emit_insn (gen_xop_shl<mode>3 (operands[0], operands[1], neg));
17083 (define_expand "vlshr<mode>3"
17084 [(set (match_operand:VI48_128 0 "register_operand")
17086 (match_operand:VI48_128 1 "register_operand")
17087 (match_operand:VI48_128 2 "nonimmediate_operand")))]
17088 "TARGET_AVX2 || TARGET_XOP"
17092 rtx neg = gen_reg_rtx (<MODE>mode);
17093 emit_insn (gen_neg<mode>2 (neg, operands[2]));
17094 emit_insn (gen_xop_shl<mode>3 (operands[0], operands[1], neg));
17099 (define_expand "vlshr<mode>3"
17100 [(set (match_operand:VI48_512 0 "register_operand")
17102 (match_operand:VI48_512 1 "register_operand")
17103 (match_operand:VI48_512 2 "nonimmediate_operand")))]
17106 (define_expand "vlshr<mode>3"
17107 [(set (match_operand:VI48_256 0 "register_operand")
17109 (match_operand:VI48_256 1 "register_operand")
17110 (match_operand:VI48_256 2 "nonimmediate_operand")))]
17113 (define_expand "vashrv8hi3<mask_name>"
17114 [(set (match_operand:V8HI 0 "register_operand")
17116 (match_operand:V8HI 1 "register_operand")
17117 (match_operand:V8HI 2 "nonimmediate_operand")))]
17118 "TARGET_XOP || (TARGET_AVX512BW && TARGET_AVX512VL)"
17122 rtx neg = gen_reg_rtx (V8HImode);
17123 emit_insn (gen_negv8hi2 (neg, operands[2]));
17124 emit_insn (gen_xop_shav8hi3 (operands[0], operands[1], neg));
17129 (define_expand "vashrv16qi3"
17130 [(set (match_operand:V16QI 0 "register_operand")
17132 (match_operand:V16QI 1 "register_operand")
17133 (match_operand:V16QI 2 "nonimmediate_operand")))]
17136 rtx neg = gen_reg_rtx (V16QImode);
17137 emit_insn (gen_negv16qi2 (neg, operands[2]));
17138 emit_insn (gen_xop_shav16qi3 (operands[0], operands[1], neg));
17142 (define_expand "vashrv2di3<mask_name>"
17143 [(set (match_operand:V2DI 0 "register_operand")
17145 (match_operand:V2DI 1 "register_operand")
17146 (match_operand:V2DI 2 "nonimmediate_operand")))]
17147 "TARGET_XOP || TARGET_AVX512VL"
17151 rtx neg = gen_reg_rtx (V2DImode);
17152 emit_insn (gen_negv2di2 (neg, operands[2]));
17153 emit_insn (gen_xop_shav2di3 (operands[0], operands[1], neg));
17158 (define_expand "vashrv4si3"
17159 [(set (match_operand:V4SI 0 "register_operand")
17160 (ashiftrt:V4SI (match_operand:V4SI 1 "register_operand")
17161 (match_operand:V4SI 2 "nonimmediate_operand")))]
17162 "TARGET_AVX2 || TARGET_XOP"
17166 rtx neg = gen_reg_rtx (V4SImode);
17167 emit_insn (gen_negv4si2 (neg, operands[2]));
17168 emit_insn (gen_xop_shav4si3 (operands[0], operands[1], neg));
17173 (define_expand "vashrv16si3"
17174 [(set (match_operand:V16SI 0 "register_operand")
17175 (ashiftrt:V16SI (match_operand:V16SI 1 "register_operand")
17176 (match_operand:V16SI 2 "nonimmediate_operand")))]
17179 (define_expand "vashrv8si3"
17180 [(set (match_operand:V8SI 0 "register_operand")
17181 (ashiftrt:V8SI (match_operand:V8SI 1 "register_operand")
17182 (match_operand:V8SI 2 "nonimmediate_operand")))]
17185 (define_expand "vashl<mode>3"
17186 [(set (match_operand:VI12_128 0 "register_operand")
17188 (match_operand:VI12_128 1 "register_operand")
17189 (match_operand:VI12_128 2 "nonimmediate_operand")))]
17192 emit_insn (gen_xop_sha<mode>3 (operands[0], operands[1], operands[2]));
17196 (define_expand "vashl<mode>3"
17197 [(set (match_operand:VI48_128 0 "register_operand")
17199 (match_operand:VI48_128 1 "register_operand")
17200 (match_operand:VI48_128 2 "nonimmediate_operand")))]
17201 "TARGET_AVX2 || TARGET_XOP"
17205 operands[2] = force_reg (<MODE>mode, operands[2]);
17206 emit_insn (gen_xop_sha<mode>3 (operands[0], operands[1], operands[2]));
17211 (define_expand "vashl<mode>3"
17212 [(set (match_operand:VI48_512 0 "register_operand")
17214 (match_operand:VI48_512 1 "register_operand")
17215 (match_operand:VI48_512 2 "nonimmediate_operand")))]
17218 (define_expand "vashl<mode>3"
17219 [(set (match_operand:VI48_256 0 "register_operand")
17221 (match_operand:VI48_256 1 "register_operand")
17222 (match_operand:VI48_256 2 "nonimmediate_operand")))]
17225 (define_insn "xop_sha<mode>3"
17226 [(set (match_operand:VI_128 0 "register_operand" "=x,x")
17227 (if_then_else:VI_128
17229 (match_operand:VI_128 2 "nonimmediate_operand" "x,m")
17232 (match_operand:VI_128 1 "nonimmediate_operand" "xm,x")
17236 (neg:VI_128 (match_dup 2)))))]
17237 "TARGET_XOP && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
17238 "vpsha<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
17239 [(set_attr "type" "sseishft")
17240 (set_attr "prefix_data16" "0")
17241 (set_attr "prefix_extra" "2")
17242 (set_attr "mode" "TI")])
17244 (define_insn "xop_shl<mode>3"
17245 [(set (match_operand:VI_128 0 "register_operand" "=x,x")
17246 (if_then_else:VI_128
17248 (match_operand:VI_128 2 "nonimmediate_operand" "x,m")
17251 (match_operand:VI_128 1 "nonimmediate_operand" "xm,x")
17255 (neg:VI_128 (match_dup 2)))))]
17256 "TARGET_XOP && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
17257 "vpshl<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
17258 [(set_attr "type" "sseishft")
17259 (set_attr "prefix_data16" "0")
17260 (set_attr "prefix_extra" "2")
17261 (set_attr "mode" "TI")])
17263 (define_expand "<shift_insn><mode>3"
17264 [(set (match_operand:VI1_AVX512 0 "register_operand")
17265 (any_shift:VI1_AVX512
17266 (match_operand:VI1_AVX512 1 "register_operand")
17267 (match_operand:SI 2 "nonmemory_operand")))]
17270 if (TARGET_XOP && <MODE>mode == V16QImode)
17272 bool negate = false;
17273 rtx (*gen) (rtx, rtx, rtx);
17277 if (<CODE> != ASHIFT)
17279 if (CONST_INT_P (operands[2]))
17280 operands[2] = GEN_INT (-INTVAL (operands[2]));
17284 par = gen_rtx_PARALLEL (V16QImode, rtvec_alloc (16));
17285 for (i = 0; i < 16; i++)
17286 XVECEXP (par, 0, i) = operands[2];
17288 tmp = gen_reg_rtx (V16QImode);
17289 emit_insn (gen_vec_initv16qiqi (tmp, par));
17292 emit_insn (gen_negv16qi2 (tmp, tmp));
17294 gen = (<CODE> == LSHIFTRT ? gen_xop_shlv16qi3 : gen_xop_shav16qi3);
17295 emit_insn (gen (operands[0], operands[1], tmp));
17298 ix86_expand_vecop_qihi (<CODE>, operands[0], operands[1], operands[2]);
17302 (define_expand "ashrv2di3"
17303 [(set (match_operand:V2DI 0 "register_operand")
17305 (match_operand:V2DI 1 "register_operand")
17306 (match_operand:DI 2 "nonmemory_operand")))]
17307 "TARGET_XOP || TARGET_AVX512VL"
17309 if (!TARGET_AVX512VL)
17311 rtx reg = gen_reg_rtx (V2DImode);
17313 bool negate = false;
17316 if (CONST_INT_P (operands[2]))
17317 operands[2] = GEN_INT (-INTVAL (operands[2]));
17321 par = gen_rtx_PARALLEL (V2DImode, rtvec_alloc (2));
17322 for (i = 0; i < 2; i++)
17323 XVECEXP (par, 0, i) = operands[2];
17325 emit_insn (gen_vec_initv2didi (reg, par));
17328 emit_insn (gen_negv2di2 (reg, reg));
17330 emit_insn (gen_xop_shav2di3 (operands[0], operands[1], reg));
17335 ;; XOP FRCZ support
17336 (define_insn "xop_frcz<mode>2"
17337 [(set (match_operand:FMAMODE 0 "register_operand" "=x")
17339 [(match_operand:FMAMODE 1 "nonimmediate_operand" "xm")]
17342 "vfrcz<ssemodesuffix>\t{%1, %0|%0, %1}"
17343 [(set_attr "type" "ssecvt1")
17344 (set_attr "mode" "<MODE>")])
17346 (define_expand "xop_vmfrcz<mode>2"
17347 [(set (match_operand:VF_128 0 "register_operand")
17350 [(match_operand:VF_128 1 "nonimmediate_operand")]
17355 "operands[2] = CONST0_RTX (<MODE>mode);")
17357 (define_insn "*xop_vmfrcz<mode>2"
17358 [(set (match_operand:VF_128 0 "register_operand" "=x")
17361 [(match_operand:VF_128 1 "nonimmediate_operand" "xm")]
17363 (match_operand:VF_128 2 "const0_operand")
17366 "vfrcz<ssescalarmodesuffix>\t{%1, %0|%0, %<iptr>1}"
17367 [(set_attr "type" "ssecvt1")
17368 (set_attr "mode" "<MODE>")])
17370 (define_insn "xop_maskcmp<mode>3"
17371 [(set (match_operand:VI_128 0 "register_operand" "=x")
17372 (match_operator:VI_128 1 "ix86_comparison_int_operator"
17373 [(match_operand:VI_128 2 "register_operand" "x")
17374 (match_operand:VI_128 3 "nonimmediate_operand" "xm")]))]
17376 "vpcom%Y1<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}"
17377 [(set_attr "type" "sse4arg")
17378 (set_attr "prefix_data16" "0")
17379 (set_attr "prefix_rep" "0")
17380 (set_attr "prefix_extra" "2")
17381 (set_attr "length_immediate" "1")
17382 (set_attr "mode" "TI")])
17384 (define_insn "xop_maskcmp_uns<mode>3"
17385 [(set (match_operand:VI_128 0 "register_operand" "=x")
17386 (match_operator:VI_128 1 "ix86_comparison_uns_operator"
17387 [(match_operand:VI_128 2 "register_operand" "x")
17388 (match_operand:VI_128 3 "nonimmediate_operand" "xm")]))]
17390 "vpcom%Y1u<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}"
17391 [(set_attr "type" "ssecmp")
17392 (set_attr "prefix_data16" "0")
17393 (set_attr "prefix_rep" "0")
17394 (set_attr "prefix_extra" "2")
17395 (set_attr "length_immediate" "1")
17396 (set_attr "mode" "TI")])
17398 ;; Version of pcom*u* that is called from the intrinsics that allows pcomequ*
17399 ;; and pcomneu* not to be converted to the signed ones in case somebody needs
17400 ;; the exact instruction generated for the intrinsic.
17401 (define_insn "xop_maskcmp_uns2<mode>3"
17402 [(set (match_operand:VI_128 0 "register_operand" "=x")
17404 [(match_operator:VI_128 1 "ix86_comparison_uns_operator"
17405 [(match_operand:VI_128 2 "register_operand" "x")
17406 (match_operand:VI_128 3 "nonimmediate_operand" "xm")])]
17407 UNSPEC_XOP_UNSIGNED_CMP))]
17409 "vpcom%Y1u<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}"
17410 [(set_attr "type" "ssecmp")
17411 (set_attr "prefix_data16" "0")
17412 (set_attr "prefix_extra" "2")
17413 (set_attr "length_immediate" "1")
17414 (set_attr "mode" "TI")])
17416 ;; Pcomtrue and pcomfalse support. These are useless instructions, but are
17417 ;; being added here to be complete.
17418 (define_insn "xop_pcom_tf<mode>3"
17419 [(set (match_operand:VI_128 0 "register_operand" "=x")
17421 [(match_operand:VI_128 1 "register_operand" "x")
17422 (match_operand:VI_128 2 "nonimmediate_operand" "xm")
17423 (match_operand:SI 3 "const_int_operand" "n")]
17424 UNSPEC_XOP_TRUEFALSE))]
17427 return ((INTVAL (operands[3]) != 0)
17428 ? "vpcomtrue<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
17429 : "vpcomfalse<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}");
17431 [(set_attr "type" "ssecmp")
17432 (set_attr "prefix_data16" "0")
17433 (set_attr "prefix_extra" "2")
17434 (set_attr "length_immediate" "1")
17435 (set_attr "mode" "TI")])
17437 (define_insn "xop_vpermil2<mode>3"
17438 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x")
17440 [(match_operand:VF_128_256 1 "register_operand" "x,x")
17441 (match_operand:VF_128_256 2 "nonimmediate_operand" "x,m")
17442 (match_operand:<sseintvecmode> 3 "nonimmediate_operand" "xm,x")
17443 (match_operand:SI 4 "const_0_to_3_operand" "n,n")]
17446 "vpermil2<ssemodesuffix>\t{%4, %3, %2, %1, %0|%0, %1, %2, %3, %4}"
17447 [(set_attr "type" "sse4arg")
17448 (set_attr "length_immediate" "1")
17449 (set_attr "mode" "<MODE>")])
17451 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
17453 (define_insn "aesenc"
17454 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17455 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17456 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
17460 aesenc\t{%2, %0|%0, %2}
17461 vaesenc\t{%2, %1, %0|%0, %1, %2}"
17462 [(set_attr "isa" "noavx,avx")
17463 (set_attr "type" "sselog1")
17464 (set_attr "prefix_extra" "1")
17465 (set_attr "prefix" "orig,vex")
17466 (set_attr "btver2_decode" "double,double")
17467 (set_attr "mode" "TI")])
17469 (define_insn "aesenclast"
17470 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17471 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17472 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
17473 UNSPEC_AESENCLAST))]
17476 aesenclast\t{%2, %0|%0, %2}
17477 vaesenclast\t{%2, %1, %0|%0, %1, %2}"
17478 [(set_attr "isa" "noavx,avx")
17479 (set_attr "type" "sselog1")
17480 (set_attr "prefix_extra" "1")
17481 (set_attr "prefix" "orig,vex")
17482 (set_attr "btver2_decode" "double,double")
17483 (set_attr "mode" "TI")])
17485 (define_insn "aesdec"
17486 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17487 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17488 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
17492 aesdec\t{%2, %0|%0, %2}
17493 vaesdec\t{%2, %1, %0|%0, %1, %2}"
17494 [(set_attr "isa" "noavx,avx")
17495 (set_attr "type" "sselog1")
17496 (set_attr "prefix_extra" "1")
17497 (set_attr "prefix" "orig,vex")
17498 (set_attr "btver2_decode" "double,double")
17499 (set_attr "mode" "TI")])
17501 (define_insn "aesdeclast"
17502 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17503 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17504 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
17505 UNSPEC_AESDECLAST))]
17508 aesdeclast\t{%2, %0|%0, %2}
17509 vaesdeclast\t{%2, %1, %0|%0, %1, %2}"
17510 [(set_attr "isa" "noavx,avx")
17511 (set_attr "type" "sselog1")
17512 (set_attr "prefix_extra" "1")
17513 (set_attr "prefix" "orig,vex")
17514 (set_attr "btver2_decode" "double,double")
17515 (set_attr "mode" "TI")])
17517 (define_insn "aesimc"
17518 [(set (match_operand:V2DI 0 "register_operand" "=x")
17519 (unspec:V2DI [(match_operand:V2DI 1 "vector_operand" "xBm")]
17522 "%vaesimc\t{%1, %0|%0, %1}"
17523 [(set_attr "type" "sselog1")
17524 (set_attr "prefix_extra" "1")
17525 (set_attr "prefix" "maybe_vex")
17526 (set_attr "mode" "TI")])
17528 (define_insn "aeskeygenassist"
17529 [(set (match_operand:V2DI 0 "register_operand" "=x")
17530 (unspec:V2DI [(match_operand:V2DI 1 "vector_operand" "xBm")
17531 (match_operand:SI 2 "const_0_to_255_operand" "n")]
17532 UNSPEC_AESKEYGENASSIST))]
17534 "%vaeskeygenassist\t{%2, %1, %0|%0, %1, %2}"
17535 [(set_attr "type" "sselog1")
17536 (set_attr "prefix_extra" "1")
17537 (set_attr "length_immediate" "1")
17538 (set_attr "prefix" "maybe_vex")
17539 (set_attr "mode" "TI")])
17541 (define_insn "pclmulqdq"
17542 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17543 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17544 (match_operand:V2DI 2 "vector_operand" "xBm,xm")
17545 (match_operand:SI 3 "const_0_to_255_operand" "n,n")]
17549 pclmulqdq\t{%3, %2, %0|%0, %2, %3}
17550 vpclmulqdq\t{%3, %2, %1, %0|%0, %1, %2, %3}"
17551 [(set_attr "isa" "noavx,avx")
17552 (set_attr "type" "sselog1")
17553 (set_attr "prefix_extra" "1")
17554 (set_attr "length_immediate" "1")
17555 (set_attr "prefix" "orig,vex")
17556 (set_attr "mode" "TI")])
17558 (define_expand "avx_vzeroall"
17559 [(match_par_dup 0 [(const_int 0)])]
17562 int nregs = TARGET_64BIT ? 16 : 8;
17565 operands[0] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (nregs + 1));
17567 XVECEXP (operands[0], 0, 0)
17568 = gen_rtx_UNSPEC_VOLATILE (VOIDmode, gen_rtvec (1, const0_rtx),
17571 for (regno = 0; regno < nregs; regno++)
17572 XVECEXP (operands[0], 0, regno + 1)
17573 = gen_rtx_SET (gen_rtx_REG (V8SImode, SSE_REGNO (regno)),
17574 CONST0_RTX (V8SImode));
17577 (define_insn "*avx_vzeroall"
17578 [(match_parallel 0 "vzeroall_operation"
17579 [(unspec_volatile [(const_int 0)] UNSPECV_VZEROALL)])]
17582 [(set_attr "type" "sse")
17583 (set_attr "modrm" "0")
17584 (set_attr "memory" "none")
17585 (set_attr "prefix" "vex")
17586 (set_attr "btver2_decode" "vector")
17587 (set_attr "mode" "OI")])
17589 ;; Clear the upper 128bits of AVX registers, equivalent to a NOP
17590 ;; if the upper 128bits are unused.
17591 (define_insn "avx_vzeroupper"
17592 [(unspec_volatile [(const_int 0)] UNSPECV_VZEROUPPER)]
17595 [(set_attr "type" "sse")
17596 (set_attr "modrm" "0")
17597 (set_attr "memory" "none")
17598 (set_attr "prefix" "vex")
17599 (set_attr "btver2_decode" "vector")
17600 (set_attr "mode" "OI")])
17602 (define_mode_attr pbroadcast_evex_isa
17603 [(V64QI "avx512bw") (V32QI "avx512bw") (V16QI "avx512bw")
17604 (V32HI "avx512bw") (V16HI "avx512bw") (V8HI "avx512bw")
17605 (V16SI "avx512f") (V8SI "avx512f") (V4SI "avx512f")
17606 (V8DI "avx512f") (V4DI "avx512f") (V2DI "avx512f")])
17608 (define_insn "avx2_pbroadcast<mode>"
17609 [(set (match_operand:VI 0 "register_operand" "=x,v")
17611 (vec_select:<ssescalarmode>
17612 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "xm,vm")
17613 (parallel [(const_int 0)]))))]
17615 "vpbroadcast<ssemodesuffix>\t{%1, %0|%0, %<iptr>1}"
17616 [(set_attr "isa" "*,<pbroadcast_evex_isa>")
17617 (set_attr "type" "ssemov")
17618 (set_attr "prefix_extra" "1")
17619 (set_attr "prefix" "vex,evex")
17620 (set_attr "mode" "<sseinsnmode>")])
17622 (define_insn "avx2_pbroadcast<mode>_1"
17623 [(set (match_operand:VI_256 0 "register_operand" "=x,x,v,v")
17624 (vec_duplicate:VI_256
17625 (vec_select:<ssescalarmode>
17626 (match_operand:VI_256 1 "nonimmediate_operand" "m,x,m,v")
17627 (parallel [(const_int 0)]))))]
17630 vpbroadcast<ssemodesuffix>\t{%1, %0|%0, %<iptr>1}
17631 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %x1}
17632 vpbroadcast<ssemodesuffix>\t{%1, %0|%0, %<iptr>1}
17633 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %x1}"
17634 [(set_attr "isa" "*,*,<pbroadcast_evex_isa>,<pbroadcast_evex_isa>")
17635 (set_attr "type" "ssemov")
17636 (set_attr "prefix_extra" "1")
17637 (set_attr "prefix" "vex")
17638 (set_attr "mode" "<sseinsnmode>")])
17640 (define_insn "<avx2_avx512>_permvar<mode><mask_name>"
17641 [(set (match_operand:VI48F_256_512 0 "register_operand" "=v")
17642 (unspec:VI48F_256_512
17643 [(match_operand:VI48F_256_512 1 "nonimmediate_operand" "vm")
17644 (match_operand:<sseintvecmode> 2 "register_operand" "v")]
17646 "TARGET_AVX2 && <mask_mode512bit_condition>"
17647 "vperm<ssemodesuffix>\t{%1, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1}"
17648 [(set_attr "type" "sselog")
17649 (set_attr "prefix" "<mask_prefix2>")
17650 (set_attr "mode" "<sseinsnmode>")])
17652 (define_insn "<avx512>_permvar<mode><mask_name>"
17653 [(set (match_operand:VI1_AVX512VL 0 "register_operand" "=v")
17654 (unspec:VI1_AVX512VL
17655 [(match_operand:VI1_AVX512VL 1 "nonimmediate_operand" "vm")
17656 (match_operand:<sseintvecmode> 2 "register_operand" "v")]
17658 "TARGET_AVX512VBMI && <mask_mode512bit_condition>"
17659 "vperm<ssemodesuffix>\t{%1, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1}"
17660 [(set_attr "type" "sselog")
17661 (set_attr "prefix" "<mask_prefix2>")
17662 (set_attr "mode" "<sseinsnmode>")])
17664 (define_insn "<avx512>_permvar<mode><mask_name>"
17665 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
17666 (unspec:VI2_AVX512VL
17667 [(match_operand:VI2_AVX512VL 1 "nonimmediate_operand" "vm")
17668 (match_operand:<sseintvecmode> 2 "register_operand" "v")]
17670 "TARGET_AVX512BW && <mask_mode512bit_condition>"
17671 "vperm<ssemodesuffix>\t{%1, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1}"
17672 [(set_attr "type" "sselog")
17673 (set_attr "prefix" "<mask_prefix2>")
17674 (set_attr "mode" "<sseinsnmode>")])
17676 (define_expand "avx2_perm<mode>"
17677 [(match_operand:VI8F_256 0 "register_operand")
17678 (match_operand:VI8F_256 1 "nonimmediate_operand")
17679 (match_operand:SI 2 "const_0_to_255_operand")]
17682 int mask = INTVAL (operands[2]);
17683 emit_insn (gen_avx2_perm<mode>_1 (operands[0], operands[1],
17684 GEN_INT ((mask >> 0) & 3),
17685 GEN_INT ((mask >> 2) & 3),
17686 GEN_INT ((mask >> 4) & 3),
17687 GEN_INT ((mask >> 6) & 3)));
17691 (define_expand "avx512vl_perm<mode>_mask"
17692 [(match_operand:VI8F_256 0 "register_operand")
17693 (match_operand:VI8F_256 1 "nonimmediate_operand")
17694 (match_operand:SI 2 "const_0_to_255_operand")
17695 (match_operand:VI8F_256 3 "vector_move_operand")
17696 (match_operand:<avx512fmaskmode> 4 "register_operand")]
17699 int mask = INTVAL (operands[2]);
17700 emit_insn (gen_<avx2_avx512>_perm<mode>_1_mask (operands[0], operands[1],
17701 GEN_INT ((mask >> 0) & 3),
17702 GEN_INT ((mask >> 2) & 3),
17703 GEN_INT ((mask >> 4) & 3),
17704 GEN_INT ((mask >> 6) & 3),
17705 operands[3], operands[4]));
17709 (define_insn "avx2_perm<mode>_1<mask_name>"
17710 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
17711 (vec_select:VI8F_256
17712 (match_operand:VI8F_256 1 "nonimmediate_operand" "vm")
17713 (parallel [(match_operand 2 "const_0_to_3_operand")
17714 (match_operand 3 "const_0_to_3_operand")
17715 (match_operand 4 "const_0_to_3_operand")
17716 (match_operand 5 "const_0_to_3_operand")])))]
17717 "TARGET_AVX2 && <mask_mode512bit_condition>"
17720 mask |= INTVAL (operands[2]) << 0;
17721 mask |= INTVAL (operands[3]) << 2;
17722 mask |= INTVAL (operands[4]) << 4;
17723 mask |= INTVAL (operands[5]) << 6;
17724 operands[2] = GEN_INT (mask);
17725 return "vperm<ssemodesuffix>\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
17727 [(set_attr "type" "sselog")
17728 (set_attr "prefix" "<mask_prefix2>")
17729 (set_attr "mode" "<sseinsnmode>")])
17731 (define_expand "avx512f_perm<mode>"
17732 [(match_operand:V8FI 0 "register_operand")
17733 (match_operand:V8FI 1 "nonimmediate_operand")
17734 (match_operand:SI 2 "const_0_to_255_operand")]
17737 int mask = INTVAL (operands[2]);
17738 emit_insn (gen_avx512f_perm<mode>_1 (operands[0], operands[1],
17739 GEN_INT ((mask >> 0) & 3),
17740 GEN_INT ((mask >> 2) & 3),
17741 GEN_INT ((mask >> 4) & 3),
17742 GEN_INT ((mask >> 6) & 3),
17743 GEN_INT (((mask >> 0) & 3) + 4),
17744 GEN_INT (((mask >> 2) & 3) + 4),
17745 GEN_INT (((mask >> 4) & 3) + 4),
17746 GEN_INT (((mask >> 6) & 3) + 4)));
17750 (define_expand "avx512f_perm<mode>_mask"
17751 [(match_operand:V8FI 0 "register_operand")
17752 (match_operand:V8FI 1 "nonimmediate_operand")
17753 (match_operand:SI 2 "const_0_to_255_operand")
17754 (match_operand:V8FI 3 "vector_move_operand")
17755 (match_operand:<avx512fmaskmode> 4 "register_operand")]
17758 int mask = INTVAL (operands[2]);
17759 emit_insn (gen_avx512f_perm<mode>_1_mask (operands[0], operands[1],
17760 GEN_INT ((mask >> 0) & 3),
17761 GEN_INT ((mask >> 2) & 3),
17762 GEN_INT ((mask >> 4) & 3),
17763 GEN_INT ((mask >> 6) & 3),
17764 GEN_INT (((mask >> 0) & 3) + 4),
17765 GEN_INT (((mask >> 2) & 3) + 4),
17766 GEN_INT (((mask >> 4) & 3) + 4),
17767 GEN_INT (((mask >> 6) & 3) + 4),
17768 operands[3], operands[4]));
17772 (define_insn "avx512f_perm<mode>_1<mask_name>"
17773 [(set (match_operand:V8FI 0 "register_operand" "=v")
17775 (match_operand:V8FI 1 "nonimmediate_operand" "vm")
17776 (parallel [(match_operand 2 "const_0_to_3_operand")
17777 (match_operand 3 "const_0_to_3_operand")
17778 (match_operand 4 "const_0_to_3_operand")
17779 (match_operand 5 "const_0_to_3_operand")
17780 (match_operand 6 "const_4_to_7_operand")
17781 (match_operand 7 "const_4_to_7_operand")
17782 (match_operand 8 "const_4_to_7_operand")
17783 (match_operand 9 "const_4_to_7_operand")])))]
17784 "TARGET_AVX512F && <mask_mode512bit_condition>
17785 && (INTVAL (operands[2]) == (INTVAL (operands[6]) - 4)
17786 && INTVAL (operands[3]) == (INTVAL (operands[7]) - 4)
17787 && INTVAL (operands[4]) == (INTVAL (operands[8]) - 4)
17788 && INTVAL (operands[5]) == (INTVAL (operands[9]) - 4))"
17791 mask |= INTVAL (operands[2]) << 0;
17792 mask |= INTVAL (operands[3]) << 2;
17793 mask |= INTVAL (operands[4]) << 4;
17794 mask |= INTVAL (operands[5]) << 6;
17795 operands[2] = GEN_INT (mask);
17796 return "vperm<ssemodesuffix>\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
17798 [(set_attr "type" "sselog")
17799 (set_attr "prefix" "<mask_prefix2>")
17800 (set_attr "mode" "<sseinsnmode>")])
17802 (define_insn "avx2_permv2ti"
17803 [(set (match_operand:V4DI 0 "register_operand" "=x")
17805 [(match_operand:V4DI 1 "register_operand" "x")
17806 (match_operand:V4DI 2 "nonimmediate_operand" "xm")
17807 (match_operand:SI 3 "const_0_to_255_operand" "n")]
17810 "vperm2i128\t{%3, %2, %1, %0|%0, %1, %2, %3}"
17811 [(set_attr "type" "sselog")
17812 (set_attr "prefix" "vex")
17813 (set_attr "mode" "OI")])
17815 (define_insn "avx2_vec_dupv4df"
17816 [(set (match_operand:V4DF 0 "register_operand" "=v")
17817 (vec_duplicate:V4DF
17819 (match_operand:V2DF 1 "register_operand" "v")
17820 (parallel [(const_int 0)]))))]
17822 "vbroadcastsd\t{%1, %0|%0, %1}"
17823 [(set_attr "type" "sselog1")
17824 (set_attr "prefix" "maybe_evex")
17825 (set_attr "mode" "V4DF")])
17827 (define_insn "<avx512>_vec_dup<mode>_1"
17828 [(set (match_operand:VI_AVX512BW 0 "register_operand" "=v,v")
17829 (vec_duplicate:VI_AVX512BW
17830 (vec_select:<ssescalarmode>
17831 (match_operand:VI_AVX512BW 1 "nonimmediate_operand" "v,m")
17832 (parallel [(const_int 0)]))))]
17835 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %x1}
17836 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %<iptr>1}"
17837 [(set_attr "type" "ssemov")
17838 (set_attr "prefix" "evex")
17839 (set_attr "mode" "<sseinsnmode>")])
17841 (define_insn "<avx512>_vec_dup<mode><mask_name>"
17842 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v")
17843 (vec_duplicate:V48_AVX512VL
17844 (vec_select:<ssescalarmode>
17845 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "vm")
17846 (parallel [(const_int 0)]))))]
17849 /* There is no DF broadcast (in AVX-512*) to 128b register.
17850 Mimic it with integer variant. */
17851 if (<MODE>mode == V2DFmode)
17852 return "vpbroadcastq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}";
17854 return "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %<iptr>1}";
17856 [(set_attr "type" "ssemov")
17857 (set_attr "prefix" "evex")
17858 (set_attr "mode" "<sseinsnmode>")])
17860 (define_insn "<avx512>_vec_dup<mode><mask_name>"
17861 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
17862 (vec_duplicate:VI12_AVX512VL
17863 (vec_select:<ssescalarmode>
17864 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "vm")
17865 (parallel [(const_int 0)]))))]
17867 "vpbroadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %<iptr>1}"
17868 [(set_attr "type" "ssemov")
17869 (set_attr "prefix" "evex")
17870 (set_attr "mode" "<sseinsnmode>")])
17872 (define_insn "<mask_codefor>avx512f_broadcast<mode><mask_name>"
17873 [(set (match_operand:V16FI 0 "register_operand" "=v,v")
17874 (vec_duplicate:V16FI
17875 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "v,m")))]
17878 vshuf<shuffletype>32x4\t{$0x0, %g1, %g1, %0<mask_operand2>|%0<mask_operand2>, %g1, %g1, 0x0}
17879 vbroadcast<shuffletype>32x4\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17880 [(set_attr "type" "ssemov")
17881 (set_attr "prefix" "evex")
17882 (set_attr "mode" "<sseinsnmode>")])
17884 (define_insn "<mask_codefor>avx512f_broadcast<mode><mask_name>"
17885 [(set (match_operand:V8FI 0 "register_operand" "=v,v")
17886 (vec_duplicate:V8FI
17887 (match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "v,m")))]
17890 vshuf<shuffletype>64x2\t{$0x44, %g1, %g1, %0<mask_operand2>|%0<mask_operand2>, %g1, %g1, 0x44}
17891 vbroadcast<shuffletype>64x4\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17892 [(set_attr "type" "ssemov")
17893 (set_attr "prefix" "evex")
17894 (set_attr "mode" "<sseinsnmode>")])
17896 (define_insn "<mask_codefor><avx512>_vec_dup_gpr<mode><mask_name>"
17897 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v,v")
17898 (vec_duplicate:VI12_AVX512VL
17899 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "vm,r")))]
17902 vpbroadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}
17903 vpbroadcast<bcstscalarsuff>\t{%k1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
17904 [(set_attr "type" "ssemov")
17905 (set_attr "prefix" "evex")
17906 (set_attr "mode" "<sseinsnmode>")])
17908 (define_insn "<mask_codefor><avx512>_vec_dup_gpr<mode><mask_name>"
17909 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v,v")
17910 (vec_duplicate:V48_AVX512VL
17911 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "vm,r")))]
17913 "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17914 [(set_attr "type" "ssemov")
17915 (set_attr "prefix" "evex")
17916 (set_attr "mode" "<sseinsnmode>")
17917 (set (attr "enabled")
17918 (if_then_else (eq_attr "alternative" "1")
17919 (symbol_ref "GET_MODE_CLASS (<ssescalarmode>mode) == MODE_INT
17920 && (<ssescalarmode>mode != DImode || TARGET_64BIT)")
17923 (define_insn "vec_dupv4sf"
17924 [(set (match_operand:V4SF 0 "register_operand" "=v,v,x")
17925 (vec_duplicate:V4SF
17926 (match_operand:SF 1 "nonimmediate_operand" "Yv,m,0")))]
17929 vshufps\t{$0, %1, %1, %0|%0, %1, %1, 0}
17930 vbroadcastss\t{%1, %0|%0, %1}
17931 shufps\t{$0, %0, %0|%0, %0, 0}"
17932 [(set_attr "isa" "avx,avx,noavx")
17933 (set_attr "type" "sseshuf1,ssemov,sseshuf1")
17934 (set_attr "length_immediate" "1,0,1")
17935 (set_attr "prefix_extra" "0,1,*")
17936 (set_attr "prefix" "maybe_evex,maybe_evex,orig")
17937 (set_attr "mode" "V4SF")])
17939 (define_insn "*vec_dupv4si"
17940 [(set (match_operand:V4SI 0 "register_operand" "=v,v,x")
17941 (vec_duplicate:V4SI
17942 (match_operand:SI 1 "nonimmediate_operand" "Yv,m,0")))]
17945 %vpshufd\t{$0, %1, %0|%0, %1, 0}
17946 vbroadcastss\t{%1, %0|%0, %1}
17947 shufps\t{$0, %0, %0|%0, %0, 0}"
17948 [(set_attr "isa" "sse2,avx,noavx")
17949 (set_attr "type" "sselog1,ssemov,sselog1")
17950 (set_attr "length_immediate" "1,0,1")
17951 (set_attr "prefix_extra" "0,1,*")
17952 (set_attr "prefix" "maybe_vex,maybe_evex,orig")
17953 (set_attr "mode" "TI,V4SF,V4SF")])
17955 (define_insn "*vec_dupv2di"
17956 [(set (match_operand:V2DI 0 "register_operand" "=x,v,v,x")
17957 (vec_duplicate:V2DI
17958 (match_operand:DI 1 "nonimmediate_operand" " 0,Yv,m,0")))]
17962 vpunpcklqdq\t{%d1, %0|%0, %d1}
17963 %vmovddup\t{%1, %0|%0, %1}
17965 [(set_attr "isa" "sse2_noavx,avx,sse3,noavx")
17966 (set_attr "type" "sselog1,sselog1,sselog1,ssemov")
17967 (set_attr "prefix" "orig,maybe_evex,maybe_vex,orig")
17968 (set_attr "mode" "TI,TI,DF,V4SF")])
17970 (define_insn "avx2_vbroadcasti128_<mode>"
17971 [(set (match_operand:VI_256 0 "register_operand" "=x,v,v")
17973 (match_operand:<ssehalfvecmode> 1 "memory_operand" "m,m,m")
17977 vbroadcasti128\t{%1, %0|%0, %1}
17978 vbroadcast<i128vldq>\t{%1, %0|%0, %1}
17979 vbroadcast<shuffletype>32x4\t{%1, %0|%0, %1}"
17980 [(set_attr "isa" "*,avx512dq,avx512vl")
17981 (set_attr "type" "ssemov")
17982 (set_attr "prefix_extra" "1")
17983 (set_attr "prefix" "vex,evex,evex")
17984 (set_attr "mode" "OI")])
17986 ;; Modes handled by AVX vec_dup patterns.
17987 (define_mode_iterator AVX_VEC_DUP_MODE
17988 [V8SI V8SF V4DI V4DF])
17989 (define_mode_attr vecdupssescalarmodesuffix
17990 [(V8SF "ss") (V4DF "sd") (V8SI "ss") (V4DI "sd")])
17991 ;; Modes handled by AVX2 vec_dup patterns.
17992 (define_mode_iterator AVX2_VEC_DUP_MODE
17993 [V32QI V16QI V16HI V8HI V8SI V4SI])
17995 (define_insn "*vec_dup<mode>"
17996 [(set (match_operand:AVX2_VEC_DUP_MODE 0 "register_operand" "=x,x,v")
17997 (vec_duplicate:AVX2_VEC_DUP_MODE
17998 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "m,x,$r")))]
18001 v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0|%0, %1}
18002 v<sseintprefix>broadcast<bcstscalarsuff>\t{%x1, %0|%0, %x1}
18004 [(set_attr "isa" "*,*,noavx512vl")
18005 (set_attr "type" "ssemov")
18006 (set_attr "prefix_extra" "1")
18007 (set_attr "prefix" "maybe_evex")
18008 (set_attr "mode" "<sseinsnmode>")
18009 (set (attr "preferred_for_speed")
18010 (cond [(eq_attr "alternative" "2")
18011 (symbol_ref "TARGET_INTER_UNIT_MOVES_TO_VEC")
18013 (symbol_ref "true")))])
18015 (define_insn "vec_dup<mode>"
18016 [(set (match_operand:AVX_VEC_DUP_MODE 0 "register_operand" "=x,x,x,v,x")
18017 (vec_duplicate:AVX_VEC_DUP_MODE
18018 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "m,m,x,v,?x")))]
18021 v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0|%0, %1}
18022 vbroadcast<vecdupssescalarmodesuffix>\t{%1, %0|%0, %1}
18023 v<sseintprefix>broadcast<bcstscalarsuff>\t{%x1, %0|%0, %x1}
18024 v<sseintprefix>broadcast<bcstscalarsuff>\t{%x1, %g0|%g0, %x1}
18026 [(set_attr "type" "ssemov")
18027 (set_attr "prefix_extra" "1")
18028 (set_attr "prefix" "maybe_evex")
18029 (set_attr "isa" "avx2,noavx2,avx2,avx512f,noavx2")
18030 (set_attr "mode" "<sseinsnmode>,V8SF,<sseinsnmode>,<sseinsnmode>,V8SF")])
18033 [(set (match_operand:AVX2_VEC_DUP_MODE 0 "register_operand")
18034 (vec_duplicate:AVX2_VEC_DUP_MODE
18035 (match_operand:<ssescalarmode> 1 "register_operand")))]
18037 /* Disable this splitter if avx512vl_vec_dup_gprv*[qhs]i insn is
18038 available, because then we can broadcast from GPRs directly.
18039 For V*[QH]I modes it requires both -mavx512vl and -mavx512bw,
18040 for V*SI mode it requires just -mavx512vl. */
18041 && !(TARGET_AVX512VL
18042 && (TARGET_AVX512BW || <ssescalarmode>mode == SImode))
18043 && reload_completed && GENERAL_REG_P (operands[1])"
18046 emit_insn (gen_vec_setv4si_0 (gen_lowpart (V4SImode, operands[0]),
18047 CONST0_RTX (V4SImode),
18048 gen_lowpart (SImode, operands[1])));
18049 emit_insn (gen_avx2_pbroadcast<mode> (operands[0],
18050 gen_lowpart (<ssexmmmode>mode,
18056 [(set (match_operand:AVX_VEC_DUP_MODE 0 "register_operand")
18057 (vec_duplicate:AVX_VEC_DUP_MODE
18058 (match_operand:<ssescalarmode> 1 "register_operand")))]
18059 "TARGET_AVX && !TARGET_AVX2 && reload_completed"
18060 [(set (match_dup 2)
18061 (vec_duplicate:<ssehalfvecmode> (match_dup 1)))
18063 (vec_concat:AVX_VEC_DUP_MODE (match_dup 2) (match_dup 2)))]
18064 "operands[2] = gen_lowpart (<ssehalfvecmode>mode, operands[0]);")
18066 (define_insn "avx_vbroadcastf128_<mode>"
18067 [(set (match_operand:V_256 0 "register_operand" "=x,x,x,v,v,v,v")
18069 (match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "m,0,?x,m,0,m,0")
18073 vbroadcast<i128>\t{%1, %0|%0, %1}
18074 vinsert<i128>\t{$1, %1, %0, %0|%0, %0, %1, 1}
18075 vperm2<i128>\t{$0, %t1, %t1, %0|%0, %t1, %t1, 0}
18076 vbroadcast<i128vldq>\t{%1, %0|%0, %1}
18077 vinsert<i128vldq>\t{$1, %1, %0, %0|%0, %0, %1, 1}
18078 vbroadcast<shuffletype>32x4\t{%1, %0|%0, %1}
18079 vinsert<shuffletype>32x4\t{$1, %1, %0, %0|%0, %0, %1, 1}"
18080 [(set_attr "isa" "*,*,*,avx512dq,avx512dq,avx512vl,avx512vl")
18081 (set_attr "type" "ssemov,sselog1,sselog1,ssemov,sselog1,ssemov,sselog1")
18082 (set_attr "prefix_extra" "1")
18083 (set_attr "length_immediate" "0,1,1,0,1,0,1")
18084 (set_attr "prefix" "vex,vex,vex,evex,evex,evex,evex")
18085 (set_attr "mode" "<sseinsnmode>")])
18087 ;; For broadcast[i|f]32x2. Yes there is no v4sf version, only v4si.
18088 (define_mode_iterator VI4F_BRCST32x2
18089 [V16SI (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")
18090 V16SF (V8SF "TARGET_AVX512VL")])
18092 (define_mode_attr 64x2mode
18093 [(V8DF "V2DF") (V8DI "V2DI") (V4DI "V2DI") (V4DF "V2DF")])
18095 (define_mode_attr 32x2mode
18096 [(V16SF "V2SF") (V16SI "V2SI") (V8SI "V2SI")
18097 (V8SF "V2SF") (V4SI "V2SI")])
18099 (define_insn "<mask_codefor>avx512dq_broadcast<mode><mask_name>"
18100 [(set (match_operand:VI4F_BRCST32x2 0 "register_operand" "=v")
18101 (vec_duplicate:VI4F_BRCST32x2
18102 (vec_select:<32x2mode>
18103 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "vm")
18104 (parallel [(const_int 0) (const_int 1)]))))]
18106 "vbroadcast<shuffletype>32x2\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
18107 [(set_attr "type" "ssemov")
18108 (set_attr "prefix_extra" "1")
18109 (set_attr "prefix" "evex")
18110 (set_attr "mode" "<sseinsnmode>")])
18112 (define_insn "<mask_codefor>avx512vl_broadcast<mode><mask_name>_1"
18113 [(set (match_operand:VI4F_256 0 "register_operand" "=v,v")
18114 (vec_duplicate:VI4F_256
18115 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "v,m")))]
18118 vshuf<shuffletype>32x4\t{$0x0, %t1, %t1, %0<mask_operand2>|%0<mask_operand2>, %t1, %t1, 0x0}
18119 vbroadcast<shuffletype>32x4\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
18120 [(set_attr "type" "ssemov")
18121 (set_attr "prefix_extra" "1")
18122 (set_attr "prefix" "evex")
18123 (set_attr "mode" "<sseinsnmode>")])
18125 (define_insn "<mask_codefor>avx512dq_broadcast<mode><mask_name>_1"
18126 [(set (match_operand:V16FI 0 "register_operand" "=v,v")
18127 (vec_duplicate:V16FI
18128 (match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "v,m")))]
18131 vshuf<shuffletype>32x4\t{$0x44, %g1, %g1, %0<mask_operand2>|%0<mask_operand2>, %g1, %g1, 0x44}
18132 vbroadcast<shuffletype>32x8\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
18133 [(set_attr "type" "ssemov")
18134 (set_attr "prefix_extra" "1")
18135 (set_attr "prefix" "evex")
18136 (set_attr "mode" "<sseinsnmode>")])
18138 ;; For broadcast[i|f]64x2
18139 (define_mode_iterator VI8F_BRCST64x2
18140 [V8DI V8DF (V4DI "TARGET_AVX512VL") (V4DF "TARGET_AVX512VL")])
18142 (define_insn "<mask_codefor>avx512dq_broadcast<mode><mask_name>_1"
18143 [(set (match_operand:VI8F_BRCST64x2 0 "register_operand" "=v,v")
18144 (vec_duplicate:VI8F_BRCST64x2
18145 (match_operand:<64x2mode> 1 "nonimmediate_operand" "v,m")))]
18148 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}
18149 vbroadcast<shuffletype>64x2\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
18150 [(set_attr "type" "ssemov")
18151 (set_attr "prefix_extra" "1")
18152 (set_attr "prefix" "evex")
18153 (set_attr "mode" "<sseinsnmode>")])
18155 (define_insn "avx512cd_maskb_vec_dup<mode>"
18156 [(set (match_operand:VI8_AVX512VL 0 "register_operand" "=v")
18157 (vec_duplicate:VI8_AVX512VL
18159 (match_operand:QI 1 "register_operand" "Yk"))))]
18161 "vpbroadcastmb2q\t{%1, %0|%0, %1}"
18162 [(set_attr "type" "mskmov")
18163 (set_attr "prefix" "evex")
18164 (set_attr "mode" "XI")])
18166 (define_insn "avx512cd_maskw_vec_dup<mode>"
18167 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
18168 (vec_duplicate:VI4_AVX512VL
18170 (match_operand:HI 1 "register_operand" "Yk"))))]
18172 "vpbroadcastmw2d\t{%1, %0|%0, %1}"
18173 [(set_attr "type" "mskmov")
18174 (set_attr "prefix" "evex")
18175 (set_attr "mode" "XI")])
18177 ;; Recognize broadcast as a vec_select as produced by builtin_vec_perm.
18178 ;; If it so happens that the input is in memory, use vbroadcast.
18179 ;; Otherwise use vpermilp (and in the case of 256-bit modes, vperm2f128).
18180 (define_insn "*avx_vperm_broadcast_v4sf"
18181 [(set (match_operand:V4SF 0 "register_operand" "=v,v,v")
18183 (match_operand:V4SF 1 "nonimmediate_operand" "m,o,v")
18184 (match_parallel 2 "avx_vbroadcast_operand"
18185 [(match_operand 3 "const_int_operand" "C,n,n")])))]
18188 int elt = INTVAL (operands[3]);
18189 switch (which_alternative)
18193 operands[1] = adjust_address_nv (operands[1], SFmode, elt * 4);
18194 return "vbroadcastss\t{%1, %0|%0, %k1}";
18196 operands[2] = GEN_INT (elt * 0x55);
18197 return "vpermilps\t{%2, %1, %0|%0, %1, %2}";
18199 gcc_unreachable ();
18202 [(set_attr "type" "ssemov,ssemov,sselog1")
18203 (set_attr "prefix_extra" "1")
18204 (set_attr "length_immediate" "0,0,1")
18205 (set_attr "prefix" "maybe_evex")
18206 (set_attr "mode" "SF,SF,V4SF")])
18208 (define_insn_and_split "*avx_vperm_broadcast_<mode>"
18209 [(set (match_operand:VF_256 0 "register_operand" "=v,v,v")
18211 (match_operand:VF_256 1 "nonimmediate_operand" "m,o,?v")
18212 (match_parallel 2 "avx_vbroadcast_operand"
18213 [(match_operand 3 "const_int_operand" "C,n,n")])))]
18216 "&& reload_completed && (<MODE>mode != V4DFmode || !TARGET_AVX2)"
18217 [(set (match_dup 0) (vec_duplicate:VF_256 (match_dup 1)))]
18219 rtx op0 = operands[0], op1 = operands[1];
18220 int elt = INTVAL (operands[3]);
18226 if (TARGET_AVX2 && elt == 0)
18228 emit_insn (gen_vec_dup<mode> (op0, gen_lowpart (<ssescalarmode>mode,
18233 /* Shuffle element we care about into all elements of the 128-bit lane.
18234 The other lane gets shuffled too, but we don't care. */
18235 if (<MODE>mode == V4DFmode)
18236 mask = (elt & 1 ? 15 : 0);
18238 mask = (elt & 3) * 0x55;
18239 emit_insn (gen_avx_vpermil<mode> (op0, op1, GEN_INT (mask)));
18241 /* Shuffle the lane we care about into both lanes of the dest. */
18242 mask = (elt / (<ssescalarnum> / 2)) * 0x11;
18243 if (EXT_REX_SSE_REG_P (op0))
18245 /* There is no EVEX VPERM2F128, but we can use either VBROADCASTSS
18247 gcc_assert (<MODE>mode == V8SFmode);
18248 if ((mask & 1) == 0)
18249 emit_insn (gen_avx2_vec_dupv8sf (op0,
18250 gen_lowpart (V4SFmode, op0)));
18252 emit_insn (gen_avx512vl_shuf_f32x4_1 (op0, op0, op0,
18253 GEN_INT (4), GEN_INT (5),
18254 GEN_INT (6), GEN_INT (7),
18255 GEN_INT (12), GEN_INT (13),
18256 GEN_INT (14), GEN_INT (15)));
18260 emit_insn (gen_avx_vperm2f128<mode>3 (op0, op0, op0, GEN_INT (mask)));
18264 operands[1] = adjust_address (op1, <ssescalarmode>mode,
18265 elt * GET_MODE_SIZE (<ssescalarmode>mode));
18268 (define_expand "<sse2_avx_avx512f>_vpermil<mode><mask_name>"
18269 [(set (match_operand:VF2 0 "register_operand")
18271 (match_operand:VF2 1 "nonimmediate_operand")
18272 (match_operand:SI 2 "const_0_to_255_operand")))]
18273 "TARGET_AVX && <mask_mode512bit_condition>"
18275 int mask = INTVAL (operands[2]);
18276 rtx perm[<ssescalarnum>];
18279 for (i = 0; i < <ssescalarnum>; i = i + 2)
18281 perm[i] = GEN_INT (((mask >> i) & 1) + i);
18282 perm[i + 1] = GEN_INT (((mask >> (i + 1)) & 1) + i);
18286 = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (<ssescalarnum>, perm));
18289 (define_expand "<sse2_avx_avx512f>_vpermil<mode><mask_name>"
18290 [(set (match_operand:VF1 0 "register_operand")
18292 (match_operand:VF1 1 "nonimmediate_operand")
18293 (match_operand:SI 2 "const_0_to_255_operand")))]
18294 "TARGET_AVX && <mask_mode512bit_condition>"
18296 int mask = INTVAL (operands[2]);
18297 rtx perm[<ssescalarnum>];
18300 for (i = 0; i < <ssescalarnum>; i = i + 4)
18302 perm[i] = GEN_INT (((mask >> 0) & 3) + i);
18303 perm[i + 1] = GEN_INT (((mask >> 2) & 3) + i);
18304 perm[i + 2] = GEN_INT (((mask >> 4) & 3) + i);
18305 perm[i + 3] = GEN_INT (((mask >> 6) & 3) + i);
18309 = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (<ssescalarnum>, perm));
18312 (define_insn "*<sse2_avx_avx512f>_vpermilp<mode><mask_name>"
18313 [(set (match_operand:VF 0 "register_operand" "=v")
18315 (match_operand:VF 1 "nonimmediate_operand" "vm")
18316 (match_parallel 2 ""
18317 [(match_operand 3 "const_int_operand")])))]
18318 "TARGET_AVX && <mask_mode512bit_condition>
18319 && avx_vpermilp_parallel (operands[2], <MODE>mode)"
18321 int mask = avx_vpermilp_parallel (operands[2], <MODE>mode) - 1;
18322 operands[2] = GEN_INT (mask);
18323 return "vpermil<ssemodesuffix>\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}";
18325 [(set_attr "type" "sselog")
18326 (set_attr "prefix_extra" "1")
18327 (set_attr "length_immediate" "1")
18328 (set_attr "prefix" "<mask_prefix>")
18329 (set_attr "mode" "<sseinsnmode>")])
18331 (define_insn "<sse2_avx_avx512f>_vpermilvar<mode>3<mask_name>"
18332 [(set (match_operand:VF 0 "register_operand" "=v")
18334 [(match_operand:VF 1 "register_operand" "v")
18335 (match_operand:<sseintvecmode> 2 "nonimmediate_operand" "vm")]
18337 "TARGET_AVX && <mask_mode512bit_condition>"
18338 "vpermil<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18339 [(set_attr "type" "sselog")
18340 (set_attr "prefix_extra" "1")
18341 (set_attr "btver2_decode" "vector")
18342 (set_attr "prefix" "<mask_prefix>")
18343 (set_attr "mode" "<sseinsnmode>")])
18345 (define_mode_iterator VPERMI2
18346 [V16SI V16SF V8DI V8DF
18347 (V8SI "TARGET_AVX512VL") (V8SF "TARGET_AVX512VL")
18348 (V4DI "TARGET_AVX512VL") (V4DF "TARGET_AVX512VL")
18349 (V4SI "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
18350 (V2DI "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")
18351 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX512BW && TARGET_AVX512VL")
18352 (V8HI "TARGET_AVX512BW && TARGET_AVX512VL")
18353 (V64QI "TARGET_AVX512VBMI") (V32QI "TARGET_AVX512VBMI && TARGET_AVX512VL")
18354 (V16QI "TARGET_AVX512VBMI && TARGET_AVX512VL")])
18356 (define_mode_iterator VPERMI2I
18358 (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")
18359 (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")
18360 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX512BW && TARGET_AVX512VL")
18361 (V8HI "TARGET_AVX512BW && TARGET_AVX512VL")
18362 (V64QI "TARGET_AVX512VBMI") (V32QI "TARGET_AVX512VBMI && TARGET_AVX512VL")
18363 (V16QI "TARGET_AVX512VBMI && TARGET_AVX512VL")])
18365 (define_expand "<avx512>_vpermi2var<mode>3_mask"
18366 [(set (match_operand:VPERMI2 0 "register_operand")
18369 [(match_operand:<sseintvecmode> 2 "register_operand")
18370 (match_operand:VPERMI2 1 "register_operand")
18371 (match_operand:VPERMI2 3 "nonimmediate_operand")]
18374 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
18377 operands[2] = force_reg (<sseintvecmode>mode, operands[2]);
18378 operands[5] = gen_lowpart (<MODE>mode, operands[2]);
18381 (define_insn "*<avx512>_vpermi2var<mode>3_mask"
18382 [(set (match_operand:VPERMI2I 0 "register_operand" "=v")
18383 (vec_merge:VPERMI2I
18385 [(match_operand:<sseintvecmode> 2 "register_operand" "0")
18386 (match_operand:VPERMI2I 1 "register_operand" "v")
18387 (match_operand:VPERMI2I 3 "nonimmediate_operand" "vm")]
18390 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
18392 "vpermi2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
18393 [(set_attr "type" "sselog")
18394 (set_attr "prefix" "evex")
18395 (set_attr "mode" "<sseinsnmode>")])
18397 (define_insn "*<avx512>_vpermi2var<mode>3_mask"
18398 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
18399 (vec_merge:VF_AVX512VL
18400 (unspec:VF_AVX512VL
18401 [(match_operand:<sseintvecmode> 2 "register_operand" "0")
18402 (match_operand:VF_AVX512VL 1 "register_operand" "v")
18403 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "vm")]
18405 (subreg:VF_AVX512VL (match_dup 2) 0)
18406 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
18408 "vpermi2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
18409 [(set_attr "type" "sselog")
18410 (set_attr "prefix" "evex")
18411 (set_attr "mode" "<sseinsnmode>")])
18413 (define_expand "<avx512>_vpermt2var<mode>3_maskz"
18414 [(match_operand:VPERMI2 0 "register_operand")
18415 (match_operand:<sseintvecmode> 1 "register_operand")
18416 (match_operand:VPERMI2 2 "register_operand")
18417 (match_operand:VPERMI2 3 "nonimmediate_operand")
18418 (match_operand:<avx512fmaskmode> 4 "register_operand")]
18421 emit_insn (gen_<avx512>_vpermt2var<mode>3_maskz_1 (
18422 operands[0], operands[1], operands[2], operands[3],
18423 CONST0_RTX (<MODE>mode), operands[4]));
18427 (define_insn "<avx512>_vpermt2var<mode>3<sd_maskz_name>"
18428 [(set (match_operand:VPERMI2 0 "register_operand" "=v,v")
18430 [(match_operand:<sseintvecmode> 1 "register_operand" "v,0")
18431 (match_operand:VPERMI2 2 "register_operand" "0,v")
18432 (match_operand:VPERMI2 3 "nonimmediate_operand" "vm,vm")]
18436 vpermt2<ssemodesuffix>\t{%3, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %3}
18437 vpermi2<ssemodesuffix>\t{%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3}"
18438 [(set_attr "type" "sselog")
18439 (set_attr "prefix" "evex")
18440 (set_attr "mode" "<sseinsnmode>")])
18442 (define_insn "<avx512>_vpermt2var<mode>3_mask"
18443 [(set (match_operand:VPERMI2 0 "register_operand" "=v")
18446 [(match_operand:<sseintvecmode> 1 "register_operand" "v")
18447 (match_operand:VPERMI2 2 "register_operand" "0")
18448 (match_operand:VPERMI2 3 "nonimmediate_operand" "vm")]
18451 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
18453 "vpermt2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
18454 [(set_attr "type" "sselog")
18455 (set_attr "prefix" "evex")
18456 (set_attr "mode" "<sseinsnmode>")])
18458 (define_expand "avx_vperm2f128<mode>3"
18459 [(set (match_operand:AVX256MODE2P 0 "register_operand")
18460 (unspec:AVX256MODE2P
18461 [(match_operand:AVX256MODE2P 1 "register_operand")
18462 (match_operand:AVX256MODE2P 2 "nonimmediate_operand")
18463 (match_operand:SI 3 "const_0_to_255_operand")]
18464 UNSPEC_VPERMIL2F128))]
18467 int mask = INTVAL (operands[3]);
18468 if ((mask & 0x88) == 0)
18470 rtx perm[<ssescalarnum>], t1, t2;
18471 int i, base, nelt = <ssescalarnum>, nelt2 = nelt / 2;
18473 base = (mask & 3) * nelt2;
18474 for (i = 0; i < nelt2; ++i)
18475 perm[i] = GEN_INT (base + i);
18477 base = ((mask >> 4) & 3) * nelt2;
18478 for (i = 0; i < nelt2; ++i)
18479 perm[i + nelt2] = GEN_INT (base + i);
18481 t2 = gen_rtx_VEC_CONCAT (<ssedoublevecmode>mode,
18482 operands[1], operands[2]);
18483 t1 = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (nelt, perm));
18484 t2 = gen_rtx_VEC_SELECT (<MODE>mode, t2, t1);
18485 t2 = gen_rtx_SET (operands[0], t2);
18491 ;; Note that bits 7 and 3 of the imm8 allow lanes to be zeroed, which
18492 ;; means that in order to represent this properly in rtl we'd have to
18493 ;; nest *another* vec_concat with a zero operand and do the select from
18494 ;; a 4x wide vector. That doesn't seem very nice.
18495 (define_insn "*avx_vperm2f128<mode>_full"
18496 [(set (match_operand:AVX256MODE2P 0 "register_operand" "=x")
18497 (unspec:AVX256MODE2P
18498 [(match_operand:AVX256MODE2P 1 "register_operand" "x")
18499 (match_operand:AVX256MODE2P 2 "nonimmediate_operand" "xm")
18500 (match_operand:SI 3 "const_0_to_255_operand" "n")]
18501 UNSPEC_VPERMIL2F128))]
18503 "vperm2<i128>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
18504 [(set_attr "type" "sselog")
18505 (set_attr "prefix_extra" "1")
18506 (set_attr "length_immediate" "1")
18507 (set_attr "prefix" "vex")
18508 (set_attr "mode" "<sseinsnmode>")])
18510 (define_insn "*avx_vperm2f128<mode>_nozero"
18511 [(set (match_operand:AVX256MODE2P 0 "register_operand" "=x")
18512 (vec_select:AVX256MODE2P
18513 (vec_concat:<ssedoublevecmode>
18514 (match_operand:AVX256MODE2P 1 "register_operand" "x")
18515 (match_operand:AVX256MODE2P 2 "nonimmediate_operand" "xm"))
18516 (match_parallel 3 ""
18517 [(match_operand 4 "const_int_operand")])))]
18519 && avx_vperm2f128_parallel (operands[3], <MODE>mode)"
18521 int mask = avx_vperm2f128_parallel (operands[3], <MODE>mode) - 1;
18523 return "vinsert<i128>\t{$0, %x2, %1, %0|%0, %1, %x2, 0}";
18525 return "vinsert<i128>\t{$1, %x2, %1, %0|%0, %1, %x2, 1}";
18526 operands[3] = GEN_INT (mask);
18527 return "vperm2<i128>\t{%3, %2, %1, %0|%0, %1, %2, %3}";
18529 [(set_attr "type" "sselog")
18530 (set_attr "prefix_extra" "1")
18531 (set_attr "length_immediate" "1")
18532 (set_attr "prefix" "vex")
18533 (set_attr "mode" "<sseinsnmode>")])
18535 (define_insn "*ssse3_palignr<mode>_perm"
18536 [(set (match_operand:V_128 0 "register_operand" "=x,x,v")
18538 (match_operand:V_128 1 "register_operand" "0,x,v")
18539 (match_parallel 2 "palignr_operand"
18540 [(match_operand 3 "const_int_operand" "n,n,n")])))]
18543 operands[2] = (GEN_INT (INTVAL (operands[3])
18544 * GET_MODE_UNIT_SIZE (GET_MODE (operands[0]))));
18546 switch (which_alternative)
18549 return "palignr\t{%2, %1, %0|%0, %1, %2}";
18552 return "vpalignr\t{%2, %1, %1, %0|%0, %1, %1, %2}";
18554 gcc_unreachable ();
18557 [(set_attr "isa" "noavx,avx,avx512bw")
18558 (set_attr "type" "sseishft")
18559 (set_attr "atom_unit" "sishuf")
18560 (set_attr "prefix_data16" "1,*,*")
18561 (set_attr "prefix_extra" "1")
18562 (set_attr "length_immediate" "1")
18563 (set_attr "prefix" "orig,vex,evex")])
18565 (define_expand "avx512vl_vinsert<mode>"
18566 [(match_operand:VI48F_256 0 "register_operand")
18567 (match_operand:VI48F_256 1 "register_operand")
18568 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand")
18569 (match_operand:SI 3 "const_0_to_1_operand")
18570 (match_operand:VI48F_256 4 "register_operand")
18571 (match_operand:<avx512fmaskmode> 5 "register_operand")]
18574 rtx (*insn)(rtx, rtx, rtx, rtx, rtx);
18576 switch (INTVAL (operands[3]))
18579 insn = gen_vec_set_lo_<mode>_mask;
18582 insn = gen_vec_set_hi_<mode>_mask;
18585 gcc_unreachable ();
18588 emit_insn (insn (operands[0], operands[1], operands[2], operands[4],
18593 (define_expand "avx_vinsertf128<mode>"
18594 [(match_operand:V_256 0 "register_operand")
18595 (match_operand:V_256 1 "register_operand")
18596 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand")
18597 (match_operand:SI 3 "const_0_to_1_operand")]
18600 rtx (*insn)(rtx, rtx, rtx);
18602 switch (INTVAL (operands[3]))
18605 insn = gen_vec_set_lo_<mode>;
18608 insn = gen_vec_set_hi_<mode>;
18611 gcc_unreachable ();
18614 emit_insn (insn (operands[0], operands[1], operands[2]));
18618 (define_insn "vec_set_lo_<mode><mask_name>"
18619 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
18620 (vec_concat:VI8F_256
18621 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
18622 (vec_select:<ssehalfvecmode>
18623 (match_operand:VI8F_256 1 "register_operand" "v")
18624 (parallel [(const_int 2) (const_int 3)]))))]
18625 "TARGET_AVX && <mask_avx512dq_condition>"
18627 if (TARGET_AVX512DQ)
18628 return "vinsert<shuffletype>64x2\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}";
18629 else if (TARGET_AVX512VL)
18630 return "vinsert<shuffletype>32x4\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}";
18632 return "vinsert<i128>\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}";
18634 [(set_attr "type" "sselog")
18635 (set_attr "prefix_extra" "1")
18636 (set_attr "length_immediate" "1")
18637 (set_attr "prefix" "vex")
18638 (set_attr "mode" "<sseinsnmode>")])
18640 (define_insn "vec_set_hi_<mode><mask_name>"
18641 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
18642 (vec_concat:VI8F_256
18643 (vec_select:<ssehalfvecmode>
18644 (match_operand:VI8F_256 1 "register_operand" "v")
18645 (parallel [(const_int 0) (const_int 1)]))
18646 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
18647 "TARGET_AVX && <mask_avx512dq_condition>"
18649 if (TARGET_AVX512DQ)
18650 return "vinsert<shuffletype>64x2\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}";
18651 else if (TARGET_AVX512VL)
18652 return "vinsert<shuffletype>32x4\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}";
18654 return "vinsert<i128>\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}";
18656 [(set_attr "type" "sselog")
18657 (set_attr "prefix_extra" "1")
18658 (set_attr "length_immediate" "1")
18659 (set_attr "prefix" "vex")
18660 (set_attr "mode" "<sseinsnmode>")])
18662 (define_insn "vec_set_lo_<mode><mask_name>"
18663 [(set (match_operand:VI4F_256 0 "register_operand" "=v")
18664 (vec_concat:VI4F_256
18665 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
18666 (vec_select:<ssehalfvecmode>
18667 (match_operand:VI4F_256 1 "register_operand" "v")
18668 (parallel [(const_int 4) (const_int 5)
18669 (const_int 6) (const_int 7)]))))]
18672 if (TARGET_AVX512VL)
18673 return "vinsert<shuffletype>32x4\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}";
18675 return "vinsert<i128>\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}";
18677 [(set_attr "type" "sselog")
18678 (set_attr "prefix_extra" "1")
18679 (set_attr "length_immediate" "1")
18680 (set_attr "prefix" "vex")
18681 (set_attr "mode" "<sseinsnmode>")])
18683 (define_insn "vec_set_hi_<mode><mask_name>"
18684 [(set (match_operand:VI4F_256 0 "register_operand" "=v")
18685 (vec_concat:VI4F_256
18686 (vec_select:<ssehalfvecmode>
18687 (match_operand:VI4F_256 1 "register_operand" "v")
18688 (parallel [(const_int 0) (const_int 1)
18689 (const_int 2) (const_int 3)]))
18690 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
18693 if (TARGET_AVX512VL)
18694 return "vinsert<shuffletype>32x4\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}";
18696 return "vinsert<i128>\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}";
18698 [(set_attr "type" "sselog")
18699 (set_attr "prefix_extra" "1")
18700 (set_attr "length_immediate" "1")
18701 (set_attr "prefix" "vex")
18702 (set_attr "mode" "<sseinsnmode>")])
18704 (define_insn "vec_set_lo_v16hi"
18705 [(set (match_operand:V16HI 0 "register_operand" "=x,v")
18707 (match_operand:V8HI 2 "nonimmediate_operand" "xm,vm")
18709 (match_operand:V16HI 1 "register_operand" "x,v")
18710 (parallel [(const_int 8) (const_int 9)
18711 (const_int 10) (const_int 11)
18712 (const_int 12) (const_int 13)
18713 (const_int 14) (const_int 15)]))))]
18716 vinsert%~128\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}
18717 vinserti32x4\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}"
18718 [(set_attr "type" "sselog")
18719 (set_attr "prefix_extra" "1")
18720 (set_attr "length_immediate" "1")
18721 (set_attr "prefix" "vex,evex")
18722 (set_attr "mode" "OI")])
18724 (define_insn "vec_set_hi_v16hi"
18725 [(set (match_operand:V16HI 0 "register_operand" "=x,v")
18728 (match_operand:V16HI 1 "register_operand" "x,v")
18729 (parallel [(const_int 0) (const_int 1)
18730 (const_int 2) (const_int 3)
18731 (const_int 4) (const_int 5)
18732 (const_int 6) (const_int 7)]))
18733 (match_operand:V8HI 2 "nonimmediate_operand" "xm,vm")))]
18736 vinsert%~128\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}
18737 vinserti32x4\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}"
18738 [(set_attr "type" "sselog")
18739 (set_attr "prefix_extra" "1")
18740 (set_attr "length_immediate" "1")
18741 (set_attr "prefix" "vex,evex")
18742 (set_attr "mode" "OI")])
18744 (define_insn "vec_set_lo_v32qi"
18745 [(set (match_operand:V32QI 0 "register_operand" "=x,v")
18747 (match_operand:V16QI 2 "nonimmediate_operand" "xm,v")
18749 (match_operand:V32QI 1 "register_operand" "x,v")
18750 (parallel [(const_int 16) (const_int 17)
18751 (const_int 18) (const_int 19)
18752 (const_int 20) (const_int 21)
18753 (const_int 22) (const_int 23)
18754 (const_int 24) (const_int 25)
18755 (const_int 26) (const_int 27)
18756 (const_int 28) (const_int 29)
18757 (const_int 30) (const_int 31)]))))]
18760 vinsert%~128\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}
18761 vinserti32x4\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}"
18762 [(set_attr "type" "sselog")
18763 (set_attr "prefix_extra" "1")
18764 (set_attr "length_immediate" "1")
18765 (set_attr "prefix" "vex,evex")
18766 (set_attr "mode" "OI")])
18768 (define_insn "vec_set_hi_v32qi"
18769 [(set (match_operand:V32QI 0 "register_operand" "=x,v")
18772 (match_operand:V32QI 1 "register_operand" "x,v")
18773 (parallel [(const_int 0) (const_int 1)
18774 (const_int 2) (const_int 3)
18775 (const_int 4) (const_int 5)
18776 (const_int 6) (const_int 7)
18777 (const_int 8) (const_int 9)
18778 (const_int 10) (const_int 11)
18779 (const_int 12) (const_int 13)
18780 (const_int 14) (const_int 15)]))
18781 (match_operand:V16QI 2 "nonimmediate_operand" "xm,vm")))]
18784 vinsert%~128\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}
18785 vinserti32x4\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}"
18786 [(set_attr "type" "sselog")
18787 (set_attr "prefix_extra" "1")
18788 (set_attr "length_immediate" "1")
18789 (set_attr "prefix" "vex,evex")
18790 (set_attr "mode" "OI")])
18792 (define_insn "<avx_avx2>_maskload<ssemodesuffix><avxsizesuffix>"
18793 [(set (match_operand:V48_AVX2 0 "register_operand" "=x")
18795 [(match_operand:<sseintvecmode> 2 "register_operand" "x")
18796 (match_operand:V48_AVX2 1 "memory_operand" "m")]
18799 "v<sseintprefix>maskmov<ssemodesuffix>\t{%1, %2, %0|%0, %2, %1}"
18800 [(set_attr "type" "sselog1")
18801 (set_attr "prefix_extra" "1")
18802 (set_attr "prefix" "vex")
18803 (set_attr "btver2_decode" "vector")
18804 (set_attr "mode" "<sseinsnmode>")])
18806 (define_insn "<avx_avx2>_maskstore<ssemodesuffix><avxsizesuffix>"
18807 [(set (match_operand:V48_AVX2 0 "memory_operand" "+m")
18809 [(match_operand:<sseintvecmode> 1 "register_operand" "x")
18810 (match_operand:V48_AVX2 2 "register_operand" "x")
18814 "v<sseintprefix>maskmov<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
18815 [(set_attr "type" "sselog1")
18816 (set_attr "prefix_extra" "1")
18817 (set_attr "prefix" "vex")
18818 (set_attr "btver2_decode" "vector")
18819 (set_attr "mode" "<sseinsnmode>")])
18821 (define_expand "maskload<mode><sseintvecmodelower>"
18822 [(set (match_operand:V48_AVX2 0 "register_operand")
18824 [(match_operand:<sseintvecmode> 2 "register_operand")
18825 (match_operand:V48_AVX2 1 "memory_operand")]
18829 (define_expand "maskload<mode><avx512fmaskmodelower>"
18830 [(set (match_operand:V48_AVX512VL 0 "register_operand")
18831 (vec_merge:V48_AVX512VL
18832 (match_operand:V48_AVX512VL 1 "memory_operand")
18834 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18837 (define_expand "maskload<mode><avx512fmaskmodelower>"
18838 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
18839 (vec_merge:VI12_AVX512VL
18840 (match_operand:VI12_AVX512VL 1 "memory_operand")
18842 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18845 (define_expand "maskstore<mode><sseintvecmodelower>"
18846 [(set (match_operand:V48_AVX2 0 "memory_operand")
18848 [(match_operand:<sseintvecmode> 2 "register_operand")
18849 (match_operand:V48_AVX2 1 "register_operand")
18854 (define_expand "maskstore<mode><avx512fmaskmodelower>"
18855 [(set (match_operand:V48_AVX512VL 0 "memory_operand")
18856 (vec_merge:V48_AVX512VL
18857 (match_operand:V48_AVX512VL 1 "register_operand")
18859 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18862 (define_expand "maskstore<mode><avx512fmaskmodelower>"
18863 [(set (match_operand:VI12_AVX512VL 0 "memory_operand")
18864 (vec_merge:VI12_AVX512VL
18865 (match_operand:VI12_AVX512VL 1 "register_operand")
18867 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18870 (define_expand "cbranch<mode>4"
18871 [(set (reg:CC FLAGS_REG)
18872 (compare:CC (match_operand:VI48_AVX 1 "register_operand")
18873 (match_operand:VI48_AVX 2 "nonimmediate_operand")))
18874 (set (pc) (if_then_else
18875 (match_operator 0 "bt_comparison_operator"
18876 [(reg:CC FLAGS_REG) (const_int 0)])
18877 (label_ref (match_operand 3))
18881 ix86_expand_branch (GET_CODE (operands[0]),
18882 operands[1], operands[2], operands[3]);
18887 (define_insn_and_split "avx_<castmode><avxsizesuffix>_<castmode>"
18888 [(set (match_operand:AVX256MODE2P 0 "nonimmediate_operand" "=x,m")
18889 (unspec:AVX256MODE2P
18890 [(match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "xm,x")]
18892 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
18894 "&& reload_completed"
18895 [(set (match_dup 0) (match_dup 1))]
18897 if (REG_P (operands[0]))
18898 operands[0] = gen_lowpart (<ssehalfvecmode>mode, operands[0]);
18900 operands[1] = lowpart_subreg (<MODE>mode, operands[1],
18901 <ssehalfvecmode>mode);
18904 ;; Modes handled by vec_init expanders.
18905 (define_mode_iterator VEC_INIT_MODE
18906 [(V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI
18907 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX") V8HI
18908 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
18909 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI
18910 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
18911 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")
18912 (V4TI "TARGET_AVX512F") (V2TI "TARGET_AVX")])
18914 ;; Likewise, but for initialization from half sized vectors.
18915 ;; Thus, these are all VEC_INIT_MODE modes except V2??.
18916 (define_mode_iterator VEC_INIT_HALF_MODE
18917 [(V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI
18918 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX") V8HI
18919 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
18920 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX")
18921 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
18922 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX")
18923 (V4TI "TARGET_AVX512F")])
18925 (define_expand "vec_init<mode><ssescalarmodelower>"
18926 [(match_operand:VEC_INIT_MODE 0 "register_operand")
18930 ix86_expand_vector_init (false, operands[0], operands[1]);
18934 (define_expand "vec_init<mode><ssehalfvecmodelower>"
18935 [(match_operand:VEC_INIT_HALF_MODE 0 "register_operand")
18939 ix86_expand_vector_init (false, operands[0], operands[1]);
18943 (define_insn "<avx2_avx512>_ashrv<mode><mask_name>"
18944 [(set (match_operand:VI48_AVX512F_AVX512VL 0 "register_operand" "=v")
18945 (ashiftrt:VI48_AVX512F_AVX512VL
18946 (match_operand:VI48_AVX512F_AVX512VL 1 "register_operand" "v")
18947 (match_operand:VI48_AVX512F_AVX512VL 2 "nonimmediate_operand" "vm")))]
18948 "TARGET_AVX2 && <mask_mode512bit_condition>"
18949 "vpsrav<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18950 [(set_attr "type" "sseishft")
18951 (set_attr "prefix" "maybe_evex")
18952 (set_attr "mode" "<sseinsnmode>")])
18954 (define_insn "<avx2_avx512>_ashrv<mode><mask_name>"
18955 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
18956 (ashiftrt:VI2_AVX512VL
18957 (match_operand:VI2_AVX512VL 1 "register_operand" "v")
18958 (match_operand:VI2_AVX512VL 2 "nonimmediate_operand" "vm")))]
18960 "vpsravw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18961 [(set_attr "type" "sseishft")
18962 (set_attr "prefix" "maybe_evex")
18963 (set_attr "mode" "<sseinsnmode>")])
18965 (define_insn "<avx2_avx512>_<shift_insn>v<mode><mask_name>"
18966 [(set (match_operand:VI48_AVX512F 0 "register_operand" "=v")
18967 (any_lshift:VI48_AVX512F
18968 (match_operand:VI48_AVX512F 1 "register_operand" "v")
18969 (match_operand:VI48_AVX512F 2 "nonimmediate_operand" "vm")))]
18970 "TARGET_AVX2 && <mask_mode512bit_condition>"
18971 "vp<vshift>v<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18972 [(set_attr "type" "sseishft")
18973 (set_attr "prefix" "maybe_evex")
18974 (set_attr "mode" "<sseinsnmode>")])
18976 (define_insn "<avx2_avx512>_<shift_insn>v<mode><mask_name>"
18977 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
18978 (any_lshift:VI2_AVX512VL
18979 (match_operand:VI2_AVX512VL 1 "register_operand" "v")
18980 (match_operand:VI2_AVX512VL 2 "nonimmediate_operand" "vm")))]
18982 "vp<vshift>v<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18983 [(set_attr "type" "sseishft")
18984 (set_attr "prefix" "maybe_evex")
18985 (set_attr "mode" "<sseinsnmode>")])
18987 (define_insn "avx_vec_concat<mode>"
18988 [(set (match_operand:V_256_512 0 "register_operand" "=x,v,x,Yv")
18989 (vec_concat:V_256_512
18990 (match_operand:<ssehalfvecmode> 1 "register_operand" "x,v,x,v")
18991 (match_operand:<ssehalfvecmode> 2 "vector_move_operand" "xm,vm,C,C")))]
18994 switch (which_alternative)
18997 return "vinsert<i128>\t{$0x1, %2, %<concat_tg_mode>1, %0|%0, %<concat_tg_mode>1, %2, 0x1}";
18999 if (<MODE_SIZE> == 64)
19001 if (TARGET_AVX512DQ && GET_MODE_SIZE (<ssescalarmode>mode) == 4)
19002 return "vinsert<shuffletype>32x8\t{$0x1, %2, %<concat_tg_mode>1, %0|%0, %<concat_tg_mode>1, %2, 0x1}";
19004 return "vinsert<shuffletype>64x4\t{$0x1, %2, %<concat_tg_mode>1, %0|%0, %<concat_tg_mode>1, %2, 0x1}";
19008 if (TARGET_AVX512DQ && GET_MODE_SIZE (<ssescalarmode>mode) == 8)
19009 return "vinsert<shuffletype>64x2\t{$0x1, %2, %<concat_tg_mode>1, %0|%0, %<concat_tg_mode>1, %2, 0x1}";
19011 return "vinsert<shuffletype>32x4\t{$0x1, %2, %<concat_tg_mode>1, %0|%0, %<concat_tg_mode>1, %2, 0x1}";
19015 switch (get_attr_mode (insn))
19018 return "vmovaps\t{%1, %t0|%t0, %1}";
19020 return "vmovapd\t{%1, %t0|%t0, %1}";
19022 return "vmovaps\t{%1, %x0|%x0, %1}";
19024 return "vmovapd\t{%1, %x0|%x0, %1}";
19026 if (which_alternative == 2)
19027 return "vmovdqa\t{%1, %t0|%t0, %1}";
19028 else if (GET_MODE_SIZE (<ssescalarmode>mode) == 8)
19029 return "vmovdqa64\t{%1, %t0|%t0, %1}";
19031 return "vmovdqa32\t{%1, %t0|%t0, %1}";
19033 if (which_alternative == 2)
19034 return "vmovdqa\t{%1, %x0|%x0, %1}";
19035 else if (GET_MODE_SIZE (<ssescalarmode>mode) == 8)
19036 return "vmovdqa64\t{%1, %x0|%x0, %1}";
19038 return "vmovdqa32\t{%1, %x0|%x0, %1}";
19040 gcc_unreachable ();
19043 gcc_unreachable ();
19046 [(set_attr "type" "sselog,sselog,ssemov,ssemov")
19047 (set_attr "prefix_extra" "1,1,*,*")
19048 (set_attr "length_immediate" "1,1,*,*")
19049 (set_attr "prefix" "maybe_evex")
19050 (set_attr "mode" "<sseinsnmode>")])
19052 (define_insn "vcvtph2ps<mask_name>"
19053 [(set (match_operand:V4SF 0 "register_operand" "=v")
19055 (unspec:V8SF [(match_operand:V8HI 1 "register_operand" "v")]
19057 (parallel [(const_int 0) (const_int 1)
19058 (const_int 2) (const_int 3)])))]
19059 "TARGET_F16C || TARGET_AVX512VL"
19060 "vcvtph2ps\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
19061 [(set_attr "type" "ssecvt")
19062 (set_attr "prefix" "maybe_evex")
19063 (set_attr "mode" "V4SF")])
19065 (define_insn "*vcvtph2ps_load<mask_name>"
19066 [(set (match_operand:V4SF 0 "register_operand" "=v")
19067 (unspec:V4SF [(match_operand:V4HI 1 "memory_operand" "m")]
19068 UNSPEC_VCVTPH2PS))]
19069 "TARGET_F16C || TARGET_AVX512VL"
19070 "vcvtph2ps\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
19071 [(set_attr "type" "ssecvt")
19072 (set_attr "prefix" "vex")
19073 (set_attr "mode" "V8SF")])
19075 (define_insn "vcvtph2ps256<mask_name>"
19076 [(set (match_operand:V8SF 0 "register_operand" "=v")
19077 (unspec:V8SF [(match_operand:V8HI 1 "nonimmediate_operand" "vm")]
19078 UNSPEC_VCVTPH2PS))]
19079 "TARGET_F16C || TARGET_AVX512VL"
19080 "vcvtph2ps\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
19081 [(set_attr "type" "ssecvt")
19082 (set_attr "prefix" "vex")
19083 (set_attr "btver2_decode" "double")
19084 (set_attr "mode" "V8SF")])
19086 (define_insn "<mask_codefor>avx512f_vcvtph2ps512<mask_name><round_saeonly_name>"
19087 [(set (match_operand:V16SF 0 "register_operand" "=v")
19089 [(match_operand:V16HI 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
19090 UNSPEC_VCVTPH2PS))]
19092 "vcvtph2ps\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
19093 [(set_attr "type" "ssecvt")
19094 (set_attr "prefix" "evex")
19095 (set_attr "mode" "V16SF")])
19097 (define_expand "vcvtps2ph_mask"
19098 [(set (match_operand:V8HI 0 "register_operand")
19101 (unspec:V4HI [(match_operand:V4SF 1 "register_operand")
19102 (match_operand:SI 2 "const_0_to_255_operand")]
19105 (match_operand:V8HI 3 "vector_move_operand")
19106 (match_operand:QI 4 "register_operand")))]
19108 "operands[5] = CONST0_RTX (V4HImode);")
19110 (define_expand "vcvtps2ph"
19111 [(set (match_operand:V8HI 0 "register_operand")
19113 (unspec:V4HI [(match_operand:V4SF 1 "register_operand")
19114 (match_operand:SI 2 "const_0_to_255_operand")]
19118 "operands[3] = CONST0_RTX (V4HImode);")
19120 (define_insn "*vcvtps2ph<mask_name>"
19121 [(set (match_operand:V8HI 0 "register_operand" "=v")
19123 (unspec:V4HI [(match_operand:V4SF 1 "register_operand" "v")
19124 (match_operand:SI 2 "const_0_to_255_operand" "N")]
19126 (match_operand:V4HI 3 "const0_operand")))]
19127 "(TARGET_F16C || TARGET_AVX512VL) && <mask_avx512vl_condition>"
19128 "vcvtps2ph\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}"
19129 [(set_attr "type" "ssecvt")
19130 (set_attr "prefix" "maybe_evex")
19131 (set_attr "mode" "V4SF")])
19133 (define_insn "*vcvtps2ph_store<mask_name>"
19134 [(set (match_operand:V4HI 0 "memory_operand" "=m")
19135 (unspec:V4HI [(match_operand:V4SF 1 "register_operand" "v")
19136 (match_operand:SI 2 "const_0_to_255_operand" "N")]
19137 UNSPEC_VCVTPS2PH))]
19138 "TARGET_F16C || TARGET_AVX512VL"
19139 "vcvtps2ph\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
19140 [(set_attr "type" "ssecvt")
19141 (set_attr "prefix" "maybe_evex")
19142 (set_attr "mode" "V4SF")])
19144 (define_insn "vcvtps2ph256<mask_name>"
19145 [(set (match_operand:V8HI 0 "nonimmediate_operand" "=vm")
19146 (unspec:V8HI [(match_operand:V8SF 1 "register_operand" "v")
19147 (match_operand:SI 2 "const_0_to_255_operand" "N")]
19148 UNSPEC_VCVTPS2PH))]
19149 "TARGET_F16C || TARGET_AVX512VL"
19150 "vcvtps2ph\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
19151 [(set_attr "type" "ssecvt")
19152 (set_attr "prefix" "maybe_evex")
19153 (set_attr "btver2_decode" "vector")
19154 (set_attr "mode" "V8SF")])
19156 (define_insn "<mask_codefor>avx512f_vcvtps2ph512<mask_name>"
19157 [(set (match_operand:V16HI 0 "nonimmediate_operand" "=vm")
19159 [(match_operand:V16SF 1 "register_operand" "v")
19160 (match_operand:SI 2 "const_0_to_255_operand" "N")]
19161 UNSPEC_VCVTPS2PH))]
19163 "vcvtps2ph\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
19164 [(set_attr "type" "ssecvt")
19165 (set_attr "prefix" "evex")
19166 (set_attr "mode" "V16SF")])
19168 ;; For gather* insn patterns
19169 (define_mode_iterator VEC_GATHER_MODE
19170 [V2DI V2DF V4DI V4DF V4SI V4SF V8SI V8SF])
19171 (define_mode_attr VEC_GATHER_IDXSI
19172 [(V2DI "V4SI") (V4DI "V4SI") (V8DI "V8SI")
19173 (V2DF "V4SI") (V4DF "V4SI") (V8DF "V8SI")
19174 (V4SI "V4SI") (V8SI "V8SI") (V16SI "V16SI")
19175 (V4SF "V4SI") (V8SF "V8SI") (V16SF "V16SI")])
19177 (define_mode_attr VEC_GATHER_IDXDI
19178 [(V2DI "V2DI") (V4DI "V4DI") (V8DI "V8DI")
19179 (V2DF "V2DI") (V4DF "V4DI") (V8DF "V8DI")
19180 (V4SI "V2DI") (V8SI "V4DI") (V16SI "V8DI")
19181 (V4SF "V2DI") (V8SF "V4DI") (V16SF "V8DI")])
19183 (define_mode_attr VEC_GATHER_SRCDI
19184 [(V2DI "V2DI") (V4DI "V4DI") (V8DI "V8DI")
19185 (V2DF "V2DF") (V4DF "V4DF") (V8DF "V8DF")
19186 (V4SI "V4SI") (V8SI "V4SI") (V16SI "V8SI")
19187 (V4SF "V4SF") (V8SF "V4SF") (V16SF "V8SF")])
19189 (define_expand "avx2_gathersi<mode>"
19190 [(parallel [(set (match_operand:VEC_GATHER_MODE 0 "register_operand")
19191 (unspec:VEC_GATHER_MODE
19192 [(match_operand:VEC_GATHER_MODE 1 "register_operand")
19193 (mem:<ssescalarmode>
19195 [(match_operand 2 "vsib_address_operand")
19196 (match_operand:<VEC_GATHER_IDXSI>
19197 3 "register_operand")
19198 (match_operand:SI 5 "const1248_operand ")]))
19199 (mem:BLK (scratch))
19200 (match_operand:VEC_GATHER_MODE 4 "register_operand")]
19202 (clobber (match_scratch:VEC_GATHER_MODE 7))])]
19206 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
19207 operands[5]), UNSPEC_VSIBADDR);
19210 (define_insn "*avx2_gathersi<mode>"
19211 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
19212 (unspec:VEC_GATHER_MODE
19213 [(match_operand:VEC_GATHER_MODE 2 "register_operand" "0")
19214 (match_operator:<ssescalarmode> 7 "vsib_mem_operator"
19216 [(match_operand:P 3 "vsib_address_operand" "Tv")
19217 (match_operand:<VEC_GATHER_IDXSI> 4 "register_operand" "x")
19218 (match_operand:SI 6 "const1248_operand" "n")]
19220 (mem:BLK (scratch))
19221 (match_operand:VEC_GATHER_MODE 5 "register_operand" "1")]
19223 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
19225 "v<sseintprefix>gatherd<ssemodesuffix>\t{%1, %7, %0|%0, %7, %1}"
19226 [(set_attr "type" "ssemov")
19227 (set_attr "prefix" "vex")
19228 (set_attr "mode" "<sseinsnmode>")])
19230 (define_insn "*avx2_gathersi<mode>_2"
19231 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
19232 (unspec:VEC_GATHER_MODE
19234 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
19236 [(match_operand:P 2 "vsib_address_operand" "Tv")
19237 (match_operand:<VEC_GATHER_IDXSI> 3 "register_operand" "x")
19238 (match_operand:SI 5 "const1248_operand" "n")]
19240 (mem:BLK (scratch))
19241 (match_operand:VEC_GATHER_MODE 4 "register_operand" "1")]
19243 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
19245 "v<sseintprefix>gatherd<ssemodesuffix>\t{%1, %6, %0|%0, %6, %1}"
19246 [(set_attr "type" "ssemov")
19247 (set_attr "prefix" "vex")
19248 (set_attr "mode" "<sseinsnmode>")])
19250 (define_expand "avx2_gatherdi<mode>"
19251 [(parallel [(set (match_operand:VEC_GATHER_MODE 0 "register_operand")
19252 (unspec:VEC_GATHER_MODE
19253 [(match_operand:<VEC_GATHER_SRCDI> 1 "register_operand")
19254 (mem:<ssescalarmode>
19256 [(match_operand 2 "vsib_address_operand")
19257 (match_operand:<VEC_GATHER_IDXDI>
19258 3 "register_operand")
19259 (match_operand:SI 5 "const1248_operand ")]))
19260 (mem:BLK (scratch))
19261 (match_operand:<VEC_GATHER_SRCDI> 4 "register_operand")]
19263 (clobber (match_scratch:VEC_GATHER_MODE 7))])]
19267 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
19268 operands[5]), UNSPEC_VSIBADDR);
19271 (define_insn "*avx2_gatherdi<mode>"
19272 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
19273 (unspec:VEC_GATHER_MODE
19274 [(match_operand:<VEC_GATHER_SRCDI> 2 "register_operand" "0")
19275 (match_operator:<ssescalarmode> 7 "vsib_mem_operator"
19277 [(match_operand:P 3 "vsib_address_operand" "Tv")
19278 (match_operand:<VEC_GATHER_IDXDI> 4 "register_operand" "x")
19279 (match_operand:SI 6 "const1248_operand" "n")]
19281 (mem:BLK (scratch))
19282 (match_operand:<VEC_GATHER_SRCDI> 5 "register_operand" "1")]
19284 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
19286 "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %7, %2|%2, %7, %5}"
19287 [(set_attr "type" "ssemov")
19288 (set_attr "prefix" "vex")
19289 (set_attr "mode" "<sseinsnmode>")])
19291 (define_insn "*avx2_gatherdi<mode>_2"
19292 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
19293 (unspec:VEC_GATHER_MODE
19295 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
19297 [(match_operand:P 2 "vsib_address_operand" "Tv")
19298 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand" "x")
19299 (match_operand:SI 5 "const1248_operand" "n")]
19301 (mem:BLK (scratch))
19302 (match_operand:<VEC_GATHER_SRCDI> 4 "register_operand" "1")]
19304 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
19307 if (<MODE>mode != <VEC_GATHER_SRCDI>mode)
19308 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%4, %6, %x0|%x0, %6, %4}";
19309 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%4, %6, %0|%0, %6, %4}";
19311 [(set_attr "type" "ssemov")
19312 (set_attr "prefix" "vex")
19313 (set_attr "mode" "<sseinsnmode>")])
19315 (define_insn "*avx2_gatherdi<mode>_3"
19316 [(set (match_operand:<VEC_GATHER_SRCDI> 0 "register_operand" "=&x")
19317 (vec_select:<VEC_GATHER_SRCDI>
19319 [(match_operand:<VEC_GATHER_SRCDI> 2 "register_operand" "0")
19320 (match_operator:<ssescalarmode> 7 "vsib_mem_operator"
19322 [(match_operand:P 3 "vsib_address_operand" "Tv")
19323 (match_operand:<VEC_GATHER_IDXDI> 4 "register_operand" "x")
19324 (match_operand:SI 6 "const1248_operand" "n")]
19326 (mem:BLK (scratch))
19327 (match_operand:<VEC_GATHER_SRCDI> 5 "register_operand" "1")]
19329 (parallel [(const_int 0) (const_int 1)
19330 (const_int 2) (const_int 3)])))
19331 (clobber (match_scratch:VI4F_256 1 "=&x"))]
19333 "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %7, %0|%0, %7, %5}"
19334 [(set_attr "type" "ssemov")
19335 (set_attr "prefix" "vex")
19336 (set_attr "mode" "<sseinsnmode>")])
19338 (define_insn "*avx2_gatherdi<mode>_4"
19339 [(set (match_operand:<VEC_GATHER_SRCDI> 0 "register_operand" "=&x")
19340 (vec_select:<VEC_GATHER_SRCDI>
19343 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
19345 [(match_operand:P 2 "vsib_address_operand" "Tv")
19346 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand" "x")
19347 (match_operand:SI 5 "const1248_operand" "n")]
19349 (mem:BLK (scratch))
19350 (match_operand:<VEC_GATHER_SRCDI> 4 "register_operand" "1")]
19352 (parallel [(const_int 0) (const_int 1)
19353 (const_int 2) (const_int 3)])))
19354 (clobber (match_scratch:VI4F_256 1 "=&x"))]
19356 "v<sseintprefix>gatherq<ssemodesuffix>\t{%4, %6, %0|%0, %6, %4}"
19357 [(set_attr "type" "ssemov")
19358 (set_attr "prefix" "vex")
19359 (set_attr "mode" "<sseinsnmode>")])
19361 ;; Memory operand override for -masm=intel of the v*gatherq* patterns.
19362 (define_mode_attr gatherq_mode
19363 [(V4SI "q") (V2DI "x") (V4SF "q") (V2DF "x")
19364 (V8SI "x") (V4DI "t") (V8SF "x") (V4DF "t")
19365 (V16SI "t") (V8DI "g") (V16SF "t") (V8DF "g")])
19367 (define_expand "<avx512>_gathersi<mode>"
19368 [(parallel [(set (match_operand:VI48F 0 "register_operand")
19370 [(match_operand:VI48F 1 "register_operand")
19371 (match_operand:<avx512fmaskmode> 4 "register_operand")
19372 (mem:<ssescalarmode>
19374 [(match_operand 2 "vsib_address_operand")
19375 (match_operand:<VEC_GATHER_IDXSI> 3 "register_operand")
19376 (match_operand:SI 5 "const1248_operand")]))]
19378 (clobber (match_scratch:<avx512fmaskmode> 7))])]
19382 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
19383 operands[5]), UNSPEC_VSIBADDR);
19386 (define_insn "*avx512f_gathersi<mode>"
19387 [(set (match_operand:VI48F 0 "register_operand" "=&v")
19389 [(match_operand:VI48F 1 "register_operand" "0")
19390 (match_operand:<avx512fmaskmode> 7 "register_operand" "2")
19391 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
19393 [(match_operand:P 4 "vsib_address_operand" "Tv")
19394 (match_operand:<VEC_GATHER_IDXSI> 3 "register_operand" "v")
19395 (match_operand:SI 5 "const1248_operand" "n")]
19396 UNSPEC_VSIBADDR)])]
19398 (clobber (match_scratch:<avx512fmaskmode> 2 "=&Yk"))]
19400 "v<sseintprefix>gatherd<ssemodesuffix>\t{%6, %0%{%2%}|%0%{%2%}, %<xtg_mode>6}"
19401 [(set_attr "type" "ssemov")
19402 (set_attr "prefix" "evex")
19403 (set_attr "mode" "<sseinsnmode>")])
19405 (define_insn "*avx512f_gathersi<mode>_2"
19406 [(set (match_operand:VI48F 0 "register_operand" "=&v")
19409 (match_operand:<avx512fmaskmode> 6 "register_operand" "1")
19410 (match_operator:<ssescalarmode> 5 "vsib_mem_operator"
19412 [(match_operand:P 3 "vsib_address_operand" "Tv")
19413 (match_operand:<VEC_GATHER_IDXSI> 2 "register_operand" "v")
19414 (match_operand:SI 4 "const1248_operand" "n")]
19415 UNSPEC_VSIBADDR)])]
19417 (clobber (match_scratch:<avx512fmaskmode> 1 "=&Yk"))]
19419 "v<sseintprefix>gatherd<ssemodesuffix>\t{%5, %0%{%1%}|%0%{%1%}, %<xtg_mode>5}"
19420 [(set_attr "type" "ssemov")
19421 (set_attr "prefix" "evex")
19422 (set_attr "mode" "<sseinsnmode>")])
19425 (define_expand "<avx512>_gatherdi<mode>"
19426 [(parallel [(set (match_operand:VI48F 0 "register_operand")
19428 [(match_operand:<VEC_GATHER_SRCDI> 1 "register_operand")
19429 (match_operand:QI 4 "register_operand")
19430 (mem:<ssescalarmode>
19432 [(match_operand 2 "vsib_address_operand")
19433 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand")
19434 (match_operand:SI 5 "const1248_operand")]))]
19436 (clobber (match_scratch:QI 7))])]
19440 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
19441 operands[5]), UNSPEC_VSIBADDR);
19444 (define_insn "*avx512f_gatherdi<mode>"
19445 [(set (match_operand:VI48F 0 "register_operand" "=&v")
19447 [(match_operand:<VEC_GATHER_SRCDI> 1 "register_operand" "0")
19448 (match_operand:QI 7 "register_operand" "2")
19449 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
19451 [(match_operand:P 4 "vsib_address_operand" "Tv")
19452 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand" "v")
19453 (match_operand:SI 5 "const1248_operand" "n")]
19454 UNSPEC_VSIBADDR)])]
19456 (clobber (match_scratch:QI 2 "=&Yk"))]
19459 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%6, %1%{%2%}|%1%{%2%}, %<gatherq_mode>6}";
19461 [(set_attr "type" "ssemov")
19462 (set_attr "prefix" "evex")
19463 (set_attr "mode" "<sseinsnmode>")])
19465 (define_insn "*avx512f_gatherdi<mode>_2"
19466 [(set (match_operand:VI48F 0 "register_operand" "=&v")
19469 (match_operand:QI 6 "register_operand" "1")
19470 (match_operator:<ssescalarmode> 5 "vsib_mem_operator"
19472 [(match_operand:P 3 "vsib_address_operand" "Tv")
19473 (match_operand:<VEC_GATHER_IDXDI> 2 "register_operand" "v")
19474 (match_operand:SI 4 "const1248_operand" "n")]
19475 UNSPEC_VSIBADDR)])]
19477 (clobber (match_scratch:QI 1 "=&Yk"))]
19480 if (<MODE>mode != <VEC_GATHER_SRCDI>mode)
19482 if (<MODE_SIZE> != 64)
19483 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %x0%{%1%}|%x0%{%1%}, %<gatherq_mode>5}";
19485 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %t0%{%1%}|%t0%{%1%}, %t5}";
19487 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %0%{%1%}|%0%{%1%}, %<gatherq_mode>5}";
19489 [(set_attr "type" "ssemov")
19490 (set_attr "prefix" "evex")
19491 (set_attr "mode" "<sseinsnmode>")])
19493 (define_expand "<avx512>_scattersi<mode>"
19494 [(parallel [(set (mem:VI48F
19496 [(match_operand 0 "vsib_address_operand")
19497 (match_operand:<VEC_GATHER_IDXSI> 2 "register_operand")
19498 (match_operand:SI 4 "const1248_operand")]))
19500 [(match_operand:<avx512fmaskmode> 1 "register_operand")
19501 (match_operand:VI48F 3 "register_operand")]
19503 (clobber (match_scratch:<avx512fmaskmode> 6))])]
19507 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[0], operands[2],
19508 operands[4]), UNSPEC_VSIBADDR);
19511 (define_insn "*avx512f_scattersi<mode>"
19512 [(set (match_operator:VI48F 5 "vsib_mem_operator"
19514 [(match_operand:P 0 "vsib_address_operand" "Tv")
19515 (match_operand:<VEC_GATHER_IDXSI> 2 "register_operand" "v")
19516 (match_operand:SI 4 "const1248_operand" "n")]
19519 [(match_operand:<avx512fmaskmode> 6 "register_operand" "1")
19520 (match_operand:VI48F 3 "register_operand" "v")]
19522 (clobber (match_scratch:<avx512fmaskmode> 1 "=&Yk"))]
19524 "v<sseintprefix>scatterd<ssemodesuffix>\t{%3, %5%{%1%}|%5%{%1%}, %3}"
19525 [(set_attr "type" "ssemov")
19526 (set_attr "prefix" "evex")
19527 (set_attr "mode" "<sseinsnmode>")])
19529 (define_expand "<avx512>_scatterdi<mode>"
19530 [(parallel [(set (mem:VI48F
19532 [(match_operand 0 "vsib_address_operand")
19533 (match_operand:<VEC_GATHER_IDXDI> 2 "register_operand")
19534 (match_operand:SI 4 "const1248_operand")]))
19536 [(match_operand:QI 1 "register_operand")
19537 (match_operand:<VEC_GATHER_SRCDI> 3 "register_operand")]
19539 (clobber (match_scratch:QI 6))])]
19543 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[0], operands[2],
19544 operands[4]), UNSPEC_VSIBADDR);
19547 (define_insn "*avx512f_scatterdi<mode>"
19548 [(set (match_operator:VI48F 5 "vsib_mem_operator"
19550 [(match_operand:P 0 "vsib_address_operand" "Tv")
19551 (match_operand:<VEC_GATHER_IDXDI> 2 "register_operand" "v")
19552 (match_operand:SI 4 "const1248_operand" "n")]
19555 [(match_operand:QI 6 "register_operand" "1")
19556 (match_operand:<VEC_GATHER_SRCDI> 3 "register_operand" "v")]
19558 (clobber (match_scratch:QI 1 "=&Yk"))]
19561 if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 8)
19562 return "v<sseintprefix>scatterq<ssemodesuffix>\t{%3, %5%{%1%}|%5%{%1%}, %3}";
19563 return "v<sseintprefix>scatterq<ssemodesuffix>\t{%3, %5%{%1%}|%t5%{%1%}, %3}";
19565 [(set_attr "type" "ssemov")
19566 (set_attr "prefix" "evex")
19567 (set_attr "mode" "<sseinsnmode>")])
19569 (define_insn "<avx512>_compress<mode>_mask"
19570 [(set (match_operand:VI48F 0 "register_operand" "=v")
19572 [(match_operand:VI48F 1 "register_operand" "v")
19573 (match_operand:VI48F 2 "vector_move_operand" "0C")
19574 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")]
19577 "v<sseintprefix>compress<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
19578 [(set_attr "type" "ssemov")
19579 (set_attr "prefix" "evex")
19580 (set_attr "mode" "<sseinsnmode>")])
19582 (define_insn "compress<mode>_mask"
19583 [(set (match_operand:VI12_AVX512VLBW 0 "register_operand" "=v")
19584 (unspec:VI12_AVX512VLBW
19585 [(match_operand:VI12_AVX512VLBW 1 "register_operand" "v")
19586 (match_operand:VI12_AVX512VLBW 2 "vector_move_operand" "0C")
19587 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")]
19589 "TARGET_AVX512VBMI2"
19590 "vpcompress<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
19591 [(set_attr "type" "ssemov")
19592 (set_attr "prefix" "evex")
19593 (set_attr "mode" "<sseinsnmode>")])
19595 (define_insn "<avx512>_compressstore<mode>_mask"
19596 [(set (match_operand:VI48F 0 "memory_operand" "=m")
19598 [(match_operand:VI48F 1 "register_operand" "x")
19600 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")]
19601 UNSPEC_COMPRESS_STORE))]
19603 "v<sseintprefix>compress<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}"
19604 [(set_attr "type" "ssemov")
19605 (set_attr "prefix" "evex")
19606 (set_attr "memory" "store")
19607 (set_attr "mode" "<sseinsnmode>")])
19609 (define_insn "compressstore<mode>_mask"
19610 [(set (match_operand:VI12_AVX512VLBW 0 "memory_operand" "=m")
19611 (unspec:VI12_AVX512VLBW
19612 [(match_operand:VI12_AVX512VLBW 1 "register_operand" "x")
19614 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")]
19615 UNSPEC_COMPRESS_STORE))]
19616 "TARGET_AVX512VBMI2"
19617 "vpcompress<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}"
19618 [(set_attr "type" "ssemov")
19619 (set_attr "prefix" "evex")
19620 (set_attr "memory" "store")
19621 (set_attr "mode" "<sseinsnmode>")])
19623 (define_expand "<avx512>_expand<mode>_maskz"
19624 [(set (match_operand:VI48F 0 "register_operand")
19626 [(match_operand:VI48F 1 "nonimmediate_operand")
19627 (match_operand:VI48F 2 "vector_move_operand")
19628 (match_operand:<avx512fmaskmode> 3 "register_operand")]
19631 "operands[2] = CONST0_RTX (<MODE>mode);")
19633 (define_insn "<avx512>_expand<mode>_mask"
19634 [(set (match_operand:VI48F 0 "register_operand" "=v,v")
19636 [(match_operand:VI48F 1 "nonimmediate_operand" "v,m")
19637 (match_operand:VI48F 2 "vector_move_operand" "0C,0C")
19638 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")]
19641 "v<sseintprefix>expand<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
19642 [(set_attr "type" "ssemov")
19643 (set_attr "prefix" "evex")
19644 (set_attr "memory" "none,load")
19645 (set_attr "mode" "<sseinsnmode>")])
19647 (define_insn "expand<mode>_mask"
19648 [(set (match_operand:VI12_AVX512VLBW 0 "register_operand" "=v,v")
19649 (unspec:VI12_AVX512VLBW
19650 [(match_operand:VI12_AVX512VLBW 1 "nonimmediate_operand" "v,m")
19651 (match_operand:VI12_AVX512VLBW 2 "vector_move_operand" "0C,0C")
19652 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")]
19654 "TARGET_AVX512VBMI2"
19655 "v<sseintprefix>expand<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
19656 [(set_attr "type" "ssemov")
19657 (set_attr "prefix" "evex")
19658 (set_attr "memory" "none,load")
19659 (set_attr "mode" "<sseinsnmode>")])
19661 (define_expand "expand<mode>_maskz"
19662 [(set (match_operand:VI12_AVX512VLBW 0 "register_operand")
19663 (unspec:VI12_AVX512VLBW
19664 [(match_operand:VI12_AVX512VLBW 1 "nonimmediate_operand")
19665 (match_operand:VI12_AVX512VLBW 2 "vector_move_operand")
19666 (match_operand:<avx512fmaskmode> 3 "register_operand")]
19668 "TARGET_AVX512VBMI2"
19669 "operands[2] = CONST0_RTX (<MODE>mode);")
19671 (define_insn "avx512dq_rangep<mode><mask_name><round_saeonly_name>"
19672 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
19673 (unspec:VF_AVX512VL
19674 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
19675 (match_operand:VF_AVX512VL 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
19676 (match_operand:SI 3 "const_0_to_15_operand")]
19678 "TARGET_AVX512DQ && <round_saeonly_mode512bit_condition>"
19679 "vrange<ssemodesuffix>\t{%3, <round_saeonly_mask_op4>%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2<round_saeonly_mask_op4>, %3}"
19680 [(set_attr "type" "sse")
19681 (set_attr "prefix" "evex")
19682 (set_attr "mode" "<MODE>")])
19684 (define_insn "avx512dq_ranges<mode><mask_scalar_name><round_saeonly_scalar_name>"
19685 [(set (match_operand:VF_128 0 "register_operand" "=v")
19688 [(match_operand:VF_128 1 "register_operand" "v")
19689 (match_operand:VF_128 2 "<round_saeonly_scalar_nimm_predicate>" "<round_saeonly_scalar_constraint>")
19690 (match_operand:SI 3 "const_0_to_15_operand")]
19695 "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}"
19696 [(set_attr "type" "sse")
19697 (set_attr "prefix" "evex")
19698 (set_attr "mode" "<MODE>")])
19700 (define_insn "avx512dq_fpclass<mode><mask_scalar_merge_name>"
19701 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
19702 (unspec:<avx512fmaskmode>
19703 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
19704 (match_operand:QI 2 "const_0_to_255_operand" "n")]
19707 "vfpclass<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}";
19708 [(set_attr "type" "sse")
19709 (set_attr "length_immediate" "1")
19710 (set_attr "prefix" "evex")
19711 (set_attr "mode" "<MODE>")])
19713 (define_insn "avx512dq_vmfpclass<mode>"
19714 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
19715 (and:<avx512fmaskmode>
19716 (unspec:<avx512fmaskmode>
19717 [(match_operand:VF_128 1 "register_operand" "v")
19718 (match_operand:QI 2 "const_0_to_255_operand" "n")]
19722 "vfpclass<ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %2}";
19723 [(set_attr "type" "sse")
19724 (set_attr "length_immediate" "1")
19725 (set_attr "prefix" "evex")
19726 (set_attr "mode" "<MODE>")])
19728 (define_insn "<avx512>_getmant<mode><mask_name><round_saeonly_name>"
19729 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
19730 (unspec:VF_AVX512VL
19731 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "<round_saeonly_constraint>")
19732 (match_operand:SI 2 "const_0_to_15_operand")]
19735 "vgetmant<ssemodesuffix>\t{%2, <round_saeonly_mask_op3>%1, %0<mask_operand3>|%0<mask_operand3>, %1<round_saeonly_mask_op3>, %2}";
19736 [(set_attr "prefix" "evex")
19737 (set_attr "mode" "<MODE>")])
19739 (define_insn "avx512f_vgetmant<mode><mask_scalar_name><round_saeonly_scalar_name>"
19740 [(set (match_operand:VF_128 0 "register_operand" "=v")
19743 [(match_operand:VF_128 1 "register_operand" "v")
19744 (match_operand:VF_128 2 "<round_saeonly_scalar_nimm_predicate>" "<round_saeonly_scalar_constraint>")
19745 (match_operand:SI 3 "const_0_to_15_operand")]
19750 "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}";
19751 [(set_attr "prefix" "evex")
19752 (set_attr "mode" "<ssescalarmode>")])
19754 ;; The correct representation for this is absolutely enormous, and
19755 ;; surely not generally useful.
19756 (define_insn "<mask_codefor>avx512bw_dbpsadbw<mode><mask_name>"
19757 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
19758 (unspec:VI2_AVX512VL
19759 [(match_operand:<dbpsadbwmode> 1 "register_operand" "v")
19760 (match_operand:<dbpsadbwmode> 2 "nonimmediate_operand" "vm")
19761 (match_operand:SI 3 "const_0_to_255_operand")]
19764 "vdbpsadbw\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3}"
19765 [(set_attr "type" "sselog1")
19766 (set_attr "length_immediate" "1")
19767 (set_attr "prefix" "evex")
19768 (set_attr "mode" "<sseinsnmode>")])
19770 (define_insn "clz<mode>2<mask_name>"
19771 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
19773 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm")))]
19775 "vplzcnt<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
19776 [(set_attr "type" "sse")
19777 (set_attr "prefix" "evex")
19778 (set_attr "mode" "<sseinsnmode>")])
19780 (define_insn "<mask_codefor>conflict<mode><mask_name>"
19781 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
19782 (unspec:VI48_AVX512VL
19783 [(match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm")]
19786 "vpconflict<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
19787 [(set_attr "type" "sse")
19788 (set_attr "prefix" "evex")
19789 (set_attr "mode" "<sseinsnmode>")])
19791 (define_insn "sha1msg1"
19792 [(set (match_operand:V4SI 0 "register_operand" "=x")
19794 [(match_operand:V4SI 1 "register_operand" "0")
19795 (match_operand:V4SI 2 "vector_operand" "xBm")]
19798 "sha1msg1\t{%2, %0|%0, %2}"
19799 [(set_attr "type" "sselog1")
19800 (set_attr "mode" "TI")])
19802 (define_insn "sha1msg2"
19803 [(set (match_operand:V4SI 0 "register_operand" "=x")
19805 [(match_operand:V4SI 1 "register_operand" "0")
19806 (match_operand:V4SI 2 "vector_operand" "xBm")]
19809 "sha1msg2\t{%2, %0|%0, %2}"
19810 [(set_attr "type" "sselog1")
19811 (set_attr "mode" "TI")])
19813 (define_insn "sha1nexte"
19814 [(set (match_operand:V4SI 0 "register_operand" "=x")
19816 [(match_operand:V4SI 1 "register_operand" "0")
19817 (match_operand:V4SI 2 "vector_operand" "xBm")]
19818 UNSPEC_SHA1NEXTE))]
19820 "sha1nexte\t{%2, %0|%0, %2}"
19821 [(set_attr "type" "sselog1")
19822 (set_attr "mode" "TI")])
19824 (define_insn "sha1rnds4"
19825 [(set (match_operand:V4SI 0 "register_operand" "=x")
19827 [(match_operand:V4SI 1 "register_operand" "0")
19828 (match_operand:V4SI 2 "vector_operand" "xBm")
19829 (match_operand:SI 3 "const_0_to_3_operand" "n")]
19830 UNSPEC_SHA1RNDS4))]
19832 "sha1rnds4\t{%3, %2, %0|%0, %2, %3}"
19833 [(set_attr "type" "sselog1")
19834 (set_attr "length_immediate" "1")
19835 (set_attr "mode" "TI")])
19837 (define_insn "sha256msg1"
19838 [(set (match_operand:V4SI 0 "register_operand" "=x")
19840 [(match_operand:V4SI 1 "register_operand" "0")
19841 (match_operand:V4SI 2 "vector_operand" "xBm")]
19842 UNSPEC_SHA256MSG1))]
19844 "sha256msg1\t{%2, %0|%0, %2}"
19845 [(set_attr "type" "sselog1")
19846 (set_attr "mode" "TI")])
19848 (define_insn "sha256msg2"
19849 [(set (match_operand:V4SI 0 "register_operand" "=x")
19851 [(match_operand:V4SI 1 "register_operand" "0")
19852 (match_operand:V4SI 2 "vector_operand" "xBm")]
19853 UNSPEC_SHA256MSG2))]
19855 "sha256msg2\t{%2, %0|%0, %2}"
19856 [(set_attr "type" "sselog1")
19857 (set_attr "mode" "TI")])
19859 (define_insn "sha256rnds2"
19860 [(set (match_operand:V4SI 0 "register_operand" "=x")
19862 [(match_operand:V4SI 1 "register_operand" "0")
19863 (match_operand:V4SI 2 "vector_operand" "xBm")
19864 (match_operand:V4SI 3 "register_operand" "Yz")]
19865 UNSPEC_SHA256RNDS2))]
19867 "sha256rnds2\t{%3, %2, %0|%0, %2, %3}"
19868 [(set_attr "type" "sselog1")
19869 (set_attr "length_immediate" "1")
19870 (set_attr "mode" "TI")])
19872 (define_insn_and_split "avx512f_<castmode><avxsizesuffix>_<castmode>"
19873 [(set (match_operand:AVX512MODE2P 0 "nonimmediate_operand" "=x,m")
19874 (unspec:AVX512MODE2P
19875 [(match_operand:<ssequartermode> 1 "nonimmediate_operand" "xm,x")]
19877 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
19879 "&& reload_completed"
19880 [(set (match_dup 0) (match_dup 1))]
19882 if (REG_P (operands[0]))
19883 operands[0] = gen_lowpart (<ssequartermode>mode, operands[0]);
19885 operands[1] = lowpart_subreg (<MODE>mode, operands[1],
19886 <ssequartermode>mode);
19889 (define_insn_and_split "avx512f_<castmode><avxsizesuffix>_256<castmode>"
19890 [(set (match_operand:AVX512MODE2P 0 "nonimmediate_operand" "=x,m")
19891 (unspec:AVX512MODE2P
19892 [(match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "xm,x")]
19894 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
19896 "&& reload_completed"
19897 [(set (match_dup 0) (match_dup 1))]
19899 if (REG_P (operands[0]))
19900 operands[0] = gen_lowpart (<ssehalfvecmode>mode, operands[0]);
19902 operands[1] = lowpart_subreg (<MODE>mode, operands[1],
19903 <ssehalfvecmode>mode);
19906 (define_int_iterator VPMADD52
19907 [UNSPEC_VPMADD52LUQ
19908 UNSPEC_VPMADD52HUQ])
19910 (define_int_attr vpmadd52type
19911 [(UNSPEC_VPMADD52LUQ "luq") (UNSPEC_VPMADD52HUQ "huq")])
19913 (define_expand "vpamdd52huq<mode>_maskz"
19914 [(match_operand:VI8_AVX512VL 0 "register_operand")
19915 (match_operand:VI8_AVX512VL 1 "register_operand")
19916 (match_operand:VI8_AVX512VL 2 "register_operand")
19917 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand")
19918 (match_operand:<avx512fmaskmode> 4 "register_operand")]
19919 "TARGET_AVX512IFMA"
19921 emit_insn (gen_vpamdd52huq<mode>_maskz_1 (
19922 operands[0], operands[1], operands[2], operands[3],
19923 CONST0_RTX (<MODE>mode), operands[4]));
19927 (define_expand "vpamdd52luq<mode>_maskz"
19928 [(match_operand:VI8_AVX512VL 0 "register_operand")
19929 (match_operand:VI8_AVX512VL 1 "register_operand")
19930 (match_operand:VI8_AVX512VL 2 "register_operand")
19931 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand")
19932 (match_operand:<avx512fmaskmode> 4 "register_operand")]
19933 "TARGET_AVX512IFMA"
19935 emit_insn (gen_vpamdd52luq<mode>_maskz_1 (
19936 operands[0], operands[1], operands[2], operands[3],
19937 CONST0_RTX (<MODE>mode), operands[4]));
19941 (define_insn "vpamdd52<vpmadd52type><mode><sd_maskz_name>"
19942 [(set (match_operand:VI8_AVX512VL 0 "register_operand" "=v")
19943 (unspec:VI8_AVX512VL
19944 [(match_operand:VI8_AVX512VL 1 "register_operand" "0")
19945 (match_operand:VI8_AVX512VL 2 "register_operand" "v")
19946 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand" "vm")]
19948 "TARGET_AVX512IFMA"
19949 "vpmadd52<vpmadd52type>\t{%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3}"
19950 [(set_attr "type" "ssemuladd")
19951 (set_attr "prefix" "evex")
19952 (set_attr "mode" "<sseinsnmode>")])
19954 (define_insn "vpamdd52<vpmadd52type><mode>_mask"
19955 [(set (match_operand:VI8_AVX512VL 0 "register_operand" "=v")
19956 (vec_merge:VI8_AVX512VL
19957 (unspec:VI8_AVX512VL
19958 [(match_operand:VI8_AVX512VL 1 "register_operand" "0")
19959 (match_operand:VI8_AVX512VL 2 "register_operand" "v")
19960 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand" "vm")]
19963 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
19964 "TARGET_AVX512IFMA"
19965 "vpmadd52<vpmadd52type>\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3}"
19966 [(set_attr "type" "ssemuladd")
19967 (set_attr "prefix" "evex")
19968 (set_attr "mode" "<sseinsnmode>")])
19970 (define_insn "vpmultishiftqb<mode><mask_name>"
19971 [(set (match_operand:VI1_AVX512VL 0 "register_operand" "=v")
19972 (unspec:VI1_AVX512VL
19973 [(match_operand:VI1_AVX512VL 1 "register_operand" "v")
19974 (match_operand:VI1_AVX512VL 2 "nonimmediate_operand" "vm")]
19975 UNSPEC_VPMULTISHIFT))]
19976 "TARGET_AVX512VBMI"
19977 "vpmultishiftqb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
19978 [(set_attr "type" "sselog")
19979 (set_attr "prefix" "evex")
19980 (set_attr "mode" "<sseinsnmode>")])
19982 (define_mode_iterator IMOD4
19983 [(V64SF "TARGET_AVX5124FMAPS") (V64SI "TARGET_AVX5124VNNIW")])
19985 (define_mode_attr imod4_narrow
19986 [(V64SF "V16SF") (V64SI "V16SI")])
19988 (define_expand "mov<mode>"
19989 [(set (match_operand:IMOD4 0 "nonimmediate_operand")
19990 (match_operand:IMOD4 1 "vector_move_operand"))]
19993 ix86_expand_vector_move (<MODE>mode, operands);
19997 (define_insn_and_split "*mov<mode>_internal"
19998 [(set (match_operand:IMOD4 0 "nonimmediate_operand" "=v,v ,m")
19999 (match_operand:IMOD4 1 "vector_move_operand" " C,vm,v"))]
20001 && (register_operand (operands[0], <MODE>mode)
20002 || register_operand (operands[1], <MODE>mode))"
20004 "&& reload_completed"
20010 for (i = 0; i < 4; i++)
20012 op0 = simplify_subreg
20013 (<imod4_narrow>mode, operands[0], <MODE>mode, i * 64);
20014 op1 = simplify_subreg
20015 (<imod4_narrow>mode, operands[1], <MODE>mode, i * 64);
20016 emit_move_insn (op0, op1);
20021 (define_insn "avx5124fmaddps_4fmaddps"
20022 [(set (match_operand:V16SF 0 "register_operand" "=v")
20024 [(match_operand:V16SF 1 "register_operand" "0")
20025 (match_operand:V64SF 2 "register_operand" "Yh")
20026 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FMADD))]
20027 "TARGET_AVX5124FMAPS"
20028 "v4fmaddps\t{%3, %g2, %0|%0, %g2, %3}"
20029 [(set_attr ("type") ("ssemuladd"))
20030 (set_attr ("prefix") ("evex"))
20031 (set_attr ("mode") ("V16SF"))])
20033 (define_insn "avx5124fmaddps_4fmaddps_mask"
20034 [(set (match_operand:V16SF 0 "register_operand" "=v")
20037 [(match_operand:V64SF 1 "register_operand" "Yh")
20038 (match_operand:V4SF 2 "memory_operand" "m")] UNSPEC_VP4FMADD)
20039 (match_operand:V16SF 3 "register_operand" "0")
20040 (match_operand:HI 4 "register_operand" "Yk")))]
20041 "TARGET_AVX5124FMAPS"
20042 "v4fmaddps\t{%2, %g1, %0%{%4%}|%0%{%4%}, %g1, %2}"
20043 [(set_attr ("type") ("ssemuladd"))
20044 (set_attr ("prefix") ("evex"))
20045 (set_attr ("mode") ("V16SF"))])
20047 (define_insn "avx5124fmaddps_4fmaddps_maskz"
20048 [(set (match_operand:V16SF 0 "register_operand" "=v")
20051 [(match_operand:V16SF 1 "register_operand" "0")
20052 (match_operand:V64SF 2 "register_operand" "Yh")
20053 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FMADD)
20054 (match_operand:V16SF 4 "const0_operand" "C")
20055 (match_operand:HI 5 "register_operand" "Yk")))]
20056 "TARGET_AVX5124FMAPS"
20057 "v4fmaddps\t{%3, %g2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %g2, %3}"
20058 [(set_attr ("type") ("ssemuladd"))
20059 (set_attr ("prefix") ("evex"))
20060 (set_attr ("mode") ("V16SF"))])
20062 (define_insn "avx5124fmaddps_4fmaddss"
20063 [(set (match_operand:V4SF 0 "register_operand" "=v")
20065 [(match_operand:V4SF 1 "register_operand" "0")
20066 (match_operand:V64SF 2 "register_operand" "Yh")
20067 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FMADD))]
20068 "TARGET_AVX5124FMAPS"
20069 "v4fmaddss\t{%3, %x2, %0|%0, %x2, %3}"
20070 [(set_attr ("type") ("ssemuladd"))
20071 (set_attr ("prefix") ("evex"))
20072 (set_attr ("mode") ("SF"))])
20074 (define_insn "avx5124fmaddps_4fmaddss_mask"
20075 [(set (match_operand:V4SF 0 "register_operand" "=v")
20078 [(match_operand:V64SF 1 "register_operand" "Yh")
20079 (match_operand:V4SF 2 "memory_operand" "m")] UNSPEC_VP4FMADD)
20080 (match_operand:V4SF 3 "register_operand" "0")
20081 (match_operand:QI 4 "register_operand" "Yk")))]
20082 "TARGET_AVX5124FMAPS"
20083 "v4fmaddss\t{%2, %x1, %0%{%4%}|%0%{%4%}, %x1, %2}"
20084 [(set_attr ("type") ("ssemuladd"))
20085 (set_attr ("prefix") ("evex"))
20086 (set_attr ("mode") ("SF"))])
20088 (define_insn "avx5124fmaddps_4fmaddss_maskz"
20089 [(set (match_operand:V4SF 0 "register_operand" "=v")
20092 [(match_operand:V4SF 1 "register_operand" "0")
20093 (match_operand:V64SF 2 "register_operand" "Yh")
20094 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FMADD)
20095 (match_operand:V4SF 4 "const0_operand" "C")
20096 (match_operand:QI 5 "register_operand" "Yk")))]
20097 "TARGET_AVX5124FMAPS"
20098 "v4fmaddss\t{%3, %x2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %x2, %3}"
20099 [(set_attr ("type") ("ssemuladd"))
20100 (set_attr ("prefix") ("evex"))
20101 (set_attr ("mode") ("SF"))])
20103 (define_insn "avx5124fmaddps_4fnmaddps"
20104 [(set (match_operand:V16SF 0 "register_operand" "=v")
20106 [(match_operand:V16SF 1 "register_operand" "0")
20107 (match_operand:V64SF 2 "register_operand" "Yh")
20108 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FNMADD))]
20109 "TARGET_AVX5124FMAPS"
20110 "v4fnmaddps\t{%3, %g2, %0|%0, %g2, %3}"
20111 [(set_attr ("type") ("ssemuladd"))
20112 (set_attr ("prefix") ("evex"))
20113 (set_attr ("mode") ("V16SF"))])
20115 (define_insn "avx5124fmaddps_4fnmaddps_mask"
20116 [(set (match_operand:V16SF 0 "register_operand" "=v")
20119 [(match_operand:V64SF 1 "register_operand" "Yh")
20120 (match_operand:V4SF 2 "memory_operand" "m")] UNSPEC_VP4FNMADD)
20121 (match_operand:V16SF 3 "register_operand" "0")
20122 (match_operand:HI 4 "register_operand" "Yk")))]
20123 "TARGET_AVX5124FMAPS"
20124 "v4fnmaddps\t{%2, %g1, %0%{%4%}|%0%{%4%}, %g1, %2}"
20125 [(set_attr ("type") ("ssemuladd"))
20126 (set_attr ("prefix") ("evex"))
20127 (set_attr ("mode") ("V16SF"))])
20129 (define_insn "avx5124fmaddps_4fnmaddps_maskz"
20130 [(set (match_operand:V16SF 0 "register_operand" "=v")
20133 [(match_operand:V16SF 1 "register_operand" "0")
20134 (match_operand:V64SF 2 "register_operand" "Yh")
20135 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FNMADD)
20136 (match_operand:V16SF 4 "const0_operand" "C")
20137 (match_operand:HI 5 "register_operand" "Yk")))]
20138 "TARGET_AVX5124FMAPS"
20139 "v4fnmaddps\t{%3, %g2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %g2, %3}"
20140 [(set_attr ("type") ("ssemuladd"))
20141 (set_attr ("prefix") ("evex"))
20142 (set_attr ("mode") ("V16SF"))])
20144 (define_insn "avx5124fmaddps_4fnmaddss"
20145 [(set (match_operand:V4SF 0 "register_operand" "=v")
20147 [(match_operand:V4SF 1 "register_operand" "0")
20148 (match_operand:V64SF 2 "register_operand" "Yh")
20149 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FNMADD))]
20150 "TARGET_AVX5124FMAPS"
20151 "v4fnmaddss\t{%3, %x2, %0|%0, %x2, %3}"
20152 [(set_attr ("type") ("ssemuladd"))
20153 (set_attr ("prefix") ("evex"))
20154 (set_attr ("mode") ("SF"))])
20156 (define_insn "avx5124fmaddps_4fnmaddss_mask"
20157 [(set (match_operand:V4SF 0 "register_operand" "=v")
20160 [(match_operand:V64SF 1 "register_operand" "Yh")
20161 (match_operand:V4SF 2 "memory_operand" "m")] UNSPEC_VP4FNMADD)
20162 (match_operand:V4SF 3 "register_operand" "0")
20163 (match_operand:QI 4 "register_operand" "Yk")))]
20164 "TARGET_AVX5124FMAPS"
20165 "v4fnmaddss\t{%2, %x1, %0%{%4%}|%0%{%4%}, %x1, %2}"
20166 [(set_attr ("type") ("ssemuladd"))
20167 (set_attr ("prefix") ("evex"))
20168 (set_attr ("mode") ("SF"))])
20170 (define_insn "avx5124fmaddps_4fnmaddss_maskz"
20171 [(set (match_operand:V4SF 0 "register_operand" "=v")
20174 [(match_operand:V4SF 1 "register_operand" "0")
20175 (match_operand:V64SF 2 "register_operand" "Yh")
20176 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FNMADD)
20177 (match_operand:V4SF 4 "const0_operand" "C")
20178 (match_operand:QI 5 "register_operand" "Yk")))]
20179 "TARGET_AVX5124FMAPS"
20180 "v4fnmaddss\t{%3, %x2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %x2, %3}"
20181 [(set_attr ("type") ("ssemuladd"))
20182 (set_attr ("prefix") ("evex"))
20183 (set_attr ("mode") ("SF"))])
20185 (define_insn "avx5124vnniw_vp4dpwssd"
20186 [(set (match_operand:V16SI 0 "register_operand" "=v")
20188 [(match_operand:V16SI 1 "register_operand" "0")
20189 (match_operand:V64SI 2 "register_operand" "Yh")
20190 (match_operand:V4SI 3 "memory_operand" "m")] UNSPEC_VP4DPWSSD))]
20191 "TARGET_AVX5124VNNIW"
20192 "vp4dpwssd\t{%3, %g2, %0|%0, %g2, %3}"
20193 [(set_attr ("type") ("ssemuladd"))
20194 (set_attr ("prefix") ("evex"))
20195 (set_attr ("mode") ("TI"))])
20197 (define_insn "avx5124vnniw_vp4dpwssd_mask"
20198 [(set (match_operand:V16SI 0 "register_operand" "=v")
20201 [(match_operand:V64SI 1 "register_operand" "Yh")
20202 (match_operand:V4SI 2 "memory_operand" "m")] UNSPEC_VP4DPWSSD)
20203 (match_operand:V16SI 3 "register_operand" "0")
20204 (match_operand:HI 4 "register_operand" "Yk")))]
20205 "TARGET_AVX5124VNNIW"
20206 "vp4dpwssd\t{%2, %g1, %0%{%4%}|%0%{%4%}, %g1, %2}"
20207 [(set_attr ("type") ("ssemuladd"))
20208 (set_attr ("prefix") ("evex"))
20209 (set_attr ("mode") ("TI"))])
20211 (define_insn "avx5124vnniw_vp4dpwssd_maskz"
20212 [(set (match_operand:V16SI 0 "register_operand" "=v")
20215 [(match_operand:V16SI 1 "register_operand" "0")
20216 (match_operand:V64SI 2 "register_operand" "Yh")
20217 (match_operand:V4SI 3 "memory_operand" "m")] UNSPEC_VP4DPWSSD)
20218 (match_operand:V16SI 4 "const0_operand" "C")
20219 (match_operand:HI 5 "register_operand" "Yk")))]
20220 "TARGET_AVX5124VNNIW"
20221 "vp4dpwssd\t{%3, %g2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %g2, %3}"
20222 [(set_attr ("type") ("ssemuladd"))
20223 (set_attr ("prefix") ("evex"))
20224 (set_attr ("mode") ("TI"))])
20226 (define_insn "avx5124vnniw_vp4dpwssds"
20227 [(set (match_operand:V16SI 0 "register_operand" "=v")
20229 [(match_operand:V16SI 1 "register_operand" "0")
20230 (match_operand:V64SI 2 "register_operand" "Yh")
20231 (match_operand:V4SI 3 "memory_operand" "m")] UNSPEC_VP4DPWSSDS))]
20232 "TARGET_AVX5124VNNIW"
20233 "vp4dpwssds\t{%3, %g2, %0|%0, %g2, %3}"
20234 [(set_attr ("type") ("ssemuladd"))
20235 (set_attr ("prefix") ("evex"))
20236 (set_attr ("mode") ("TI"))])
20238 (define_insn "avx5124vnniw_vp4dpwssds_mask"
20239 [(set (match_operand:V16SI 0 "register_operand" "=v")
20242 [(match_operand:V64SI 1 "register_operand" "Yh")
20243 (match_operand:V4SI 2 "memory_operand" "m")] UNSPEC_VP4DPWSSDS)
20244 (match_operand:V16SI 3 "register_operand" "0")
20245 (match_operand:HI 4 "register_operand" "Yk")))]
20246 "TARGET_AVX5124VNNIW"
20247 "vp4dpwssds\t{%2, %g1, %0%{%4%}|%0%{%4%}, %g1, %2}"
20248 [(set_attr ("type") ("ssemuladd"))
20249 (set_attr ("prefix") ("evex"))
20250 (set_attr ("mode") ("TI"))])
20252 (define_insn "avx5124vnniw_vp4dpwssds_maskz"
20253 [(set (match_operand:V16SI 0 "register_operand" "=v")
20256 [(match_operand:V16SI 1 "register_operand" "0")
20257 (match_operand:V64SI 2 "register_operand" "Yh")
20258 (match_operand:V4SI 3 "memory_operand" "m")] UNSPEC_VP4DPWSSDS)
20259 (match_operand:V16SI 4 "const0_operand" "C")
20260 (match_operand:HI 5 "register_operand" "Yk")))]
20261 "TARGET_AVX5124VNNIW"
20262 "vp4dpwssds\t{%3, %g2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %g2, %3}"
20263 [(set_attr ("type") ("ssemuladd"))
20264 (set_attr ("prefix") ("evex"))
20265 (set_attr ("mode") ("TI"))])
20267 (define_insn "vpopcount<mode><mask_name>"
20268 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
20269 (popcount:VI48_AVX512VL
20270 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm")))]
20271 "TARGET_AVX512VPOPCNTDQ"
20272 "vpopcnt<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}")
20274 ;; Save multiple registers out-of-line.
20275 (define_insn "save_multiple<mode>"
20276 [(match_parallel 0 "save_multiple"
20277 [(use (match_operand:P 1 "symbol_operand"))])]
20278 "TARGET_SSE && TARGET_64BIT"
20281 ;; Restore multiple registers out-of-line.
20282 (define_insn "restore_multiple<mode>"
20283 [(match_parallel 0 "restore_multiple"
20284 [(use (match_operand:P 1 "symbol_operand"))])]
20285 "TARGET_SSE && TARGET_64BIT"
20288 ;; Restore multiple registers out-of-line and return.
20289 (define_insn "restore_multiple_and_return<mode>"
20290 [(match_parallel 0 "restore_multiple"
20292 (use (match_operand:P 1 "symbol_operand"))
20293 (set (reg:DI SP_REG) (reg:DI R10_REG))
20295 "TARGET_SSE && TARGET_64BIT"
20298 ;; Restore multiple registers out-of-line when hard frame pointer is used,
20299 ;; perform the leave operation prior to returning (from the function).
20300 (define_insn "restore_multiple_leave_return<mode>"
20301 [(match_parallel 0 "restore_multiple"
20303 (use (match_operand:P 1 "symbol_operand"))
20304 (set (reg:DI SP_REG) (plus:DI (reg:DI BP_REG) (const_int 8)))
20305 (set (reg:DI BP_REG) (mem:DI (reg:DI BP_REG)))
20306 (clobber (mem:BLK (scratch)))
20308 "TARGET_SSE && TARGET_64BIT"
20311 (define_insn "vpopcount<mode><mask_name>"
20312 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
20313 (popcount:VI12_AVX512VL
20314 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "vm")))]
20315 "TARGET_AVX512BITALG"
20316 "vpopcnt<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}")
20318 (define_insn "vgf2p8affineinvqb_<mode><mask_name>"
20319 [(set (match_operand:VI1_AVX512F 0 "register_operand" "=x,x,v")
20320 (unspec:VI1_AVX512F
20321 [(match_operand:VI1_AVX512F 1 "register_operand" "%0,x,v")
20322 (match_operand:VI1_AVX512F 2 "nonimmediate_operand" "xBm,xm,vm")
20323 (match_operand:QI 3 "const_0_to_255_operand" "n,n,n")]
20324 UNSPEC_GF2P8AFFINEINV))]
20327 gf2p8affineinvqb\t{%3, %2, %0| %0, %2, %3}
20328 vgf2p8affineinvqb\t{%3, %2, %1, %0<mask_operand4>| %0<mask_operand4>, %1, %2, %3}
20329 vgf2p8affineinvqb\t{%3, %2, %1, %0<mask_operand4>| %0<mask_operand4>, %1, %2, %3}"
20330 [(set_attr "isa" "noavx,avx,avx512f")
20331 (set_attr "prefix_data16" "1,*,*")
20332 (set_attr "prefix_extra" "1")
20333 (set_attr "prefix" "orig,maybe_evex,evex")
20334 (set_attr "mode" "<sseinsnmode>")])
20336 (define_insn "vgf2p8affineqb_<mode><mask_name>"
20337 [(set (match_operand:VI1_AVX512F 0 "register_operand" "=x,x,v")
20338 (unspec:VI1_AVX512F
20339 [(match_operand:VI1_AVX512F 1 "register_operand" "%0,x,v")
20340 (match_operand:VI1_AVX512F 2 "nonimmediate_operand" "xBm,xm,vm")
20341 (match_operand:QI 3 "const_0_to_255_operand" "n,n,n")]
20342 UNSPEC_GF2P8AFFINE))]
20345 gf2p8affineqb\t{%3, %2, %0| %0, %2, %3}
20346 vgf2p8affineqb\t{%3, %2, %1, %0<mask_operand4>| %0<mask_operand4>, %1, %2, %3}
20347 vgf2p8affineqb\t{%3, %2, %1, %0<mask_operand4>| %0<mask_operand4>, %1, %2, %3}"
20348 [(set_attr "isa" "noavx,avx,avx512f")
20349 (set_attr "prefix_data16" "1,*,*")
20350 (set_attr "prefix_extra" "1")
20351 (set_attr "prefix" "orig,maybe_evex,evex")
20352 (set_attr "mode" "<sseinsnmode>")])
20354 (define_insn "vgf2p8mulb_<mode><mask_name>"
20355 [(set (match_operand:VI1_AVX512F 0 "register_operand" "=x,x,v")
20356 (unspec:VI1_AVX512F
20357 [(match_operand:VI1_AVX512F 1 "register_operand" "%0,x,v")
20358 (match_operand:VI1_AVX512F 2 "nonimmediate_operand" "xBm,xm,vm")]
20362 gf2p8mulb\t{%2, %0| %0, %2}
20363 vgf2p8mulb\t{%2, %1, %0<mask_operand3>| %0<mask_operand3>, %1, %2}
20364 vgf2p8mulb\t{%2, %1, %0<mask_operand3>| %0<mask_operand3>, %1, %2}"
20365 [(set_attr "isa" "noavx,avx,avx512f")
20366 (set_attr "prefix_data16" "1,*,*")
20367 (set_attr "prefix_extra" "1")
20368 (set_attr "prefix" "orig,maybe_evex,evex")
20369 (set_attr "mode" "<sseinsnmode>")])
20371 (define_insn "vpshrd_<mode><mask_name>"
20372 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
20373 (unspec:VI248_AVX512VL
20374 [(match_operand:VI248_AVX512VL 1 "register_operand" "v")
20375 (match_operand:VI248_AVX512VL 2 "nonimmediate_operand" "vm")
20376 (match_operand:SI 3 "const_0_to_255_operand" "n")]
20378 "TARGET_AVX512VBMI2"
20379 "vpshrd<ssemodesuffix>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3 }"
20380 [(set_attr ("prefix") ("evex"))])
20382 (define_insn "vpshld_<mode><mask_name>"
20383 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
20384 (unspec:VI248_AVX512VL
20385 [(match_operand:VI248_AVX512VL 1 "register_operand" "v")
20386 (match_operand:VI248_AVX512VL 2 "nonimmediate_operand" "vm")
20387 (match_operand:SI 3 "const_0_to_255_operand" "n")]
20389 "TARGET_AVX512VBMI2"
20390 "vpshld<ssemodesuffix>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3 }"
20391 [(set_attr ("prefix") ("evex"))])
20393 (define_insn "vpshrdv_<mode>"
20394 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
20395 (unspec:VI248_AVX512VL
20396 [(match_operand:VI248_AVX512VL 1 "register_operand" "0")
20397 (match_operand:VI248_AVX512VL 2 "register_operand" "v")
20398 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand" "vm")]
20400 "TARGET_AVX512VBMI2"
20401 "vpshrdv<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3 }"
20402 [(set_attr ("prefix") ("evex"))
20403 (set_attr "mode" "<sseinsnmode>")])
20405 (define_insn "vpshrdv_<mode>_mask"
20406 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
20407 (vec_merge:VI248_AVX512VL
20408 (unspec:VI248_AVX512VL
20409 [(match_operand:VI248_AVX512VL 1 "register_operand" "0")
20410 (match_operand:VI248_AVX512VL 2 "register_operand" "v")
20411 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand" "vm")]
20414 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
20415 "TARGET_AVX512VBMI2"
20416 "vpshrdv<ssemodesuffix>\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
20417 [(set_attr ("prefix") ("evex"))
20418 (set_attr "mode" "<sseinsnmode>")])
20420 (define_expand "vpshrdv_<mode>_maskz"
20421 [(match_operand:VI248_AVX512VL 0 "register_operand")
20422 (match_operand:VI248_AVX512VL 1 "register_operand")
20423 (match_operand:VI248_AVX512VL 2 "register_operand")
20424 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand")
20425 (match_operand:<avx512fmaskmode> 4 "register_operand")]
20426 "TARGET_AVX512VBMI2"
20428 emit_insn (gen_vpshrdv_<mode>_maskz_1 (operands[0], operands[1],
20429 operands[2], operands[3],
20430 CONST0_RTX (<MODE>mode),
20435 (define_insn "vpshrdv_<mode>_maskz_1"
20436 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
20437 (vec_merge:VI248_AVX512VL
20438 (unspec:VI248_AVX512VL
20439 [(match_operand:VI248_AVX512VL 1 "register_operand" "0")
20440 (match_operand:VI248_AVX512VL 2 "register_operand" "v")
20441 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand" "vm")]
20443 (match_operand:VI248_AVX512VL 4 "const0_operand" "C")
20444 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
20445 "TARGET_AVX512VBMI2"
20446 "vpshrdv<ssemodesuffix>\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
20447 [(set_attr ("prefix") ("evex"))
20448 (set_attr "mode" "<sseinsnmode>")])
20450 (define_insn "vpshldv_<mode>"
20451 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
20452 (unspec:VI248_AVX512VL
20453 [(match_operand:VI248_AVX512VL 1 "register_operand" "0")
20454 (match_operand:VI248_AVX512VL 2 "register_operand" "v")
20455 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand" "vm")]
20457 "TARGET_AVX512VBMI2"
20458 "vpshldv<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3 }"
20459 [(set_attr ("prefix") ("evex"))
20460 (set_attr "mode" "<sseinsnmode>")])
20462 (define_insn "vpshldv_<mode>_mask"
20463 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
20464 (vec_merge:VI248_AVX512VL
20465 (unspec:VI248_AVX512VL
20466 [(match_operand:VI248_AVX512VL 1 "register_operand" "0")
20467 (match_operand:VI248_AVX512VL 2 "register_operand" "v")
20468 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand" "vm")]
20471 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
20472 "TARGET_AVX512VBMI2"
20473 "vpshldv<ssemodesuffix>\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
20474 [(set_attr ("prefix") ("evex"))
20475 (set_attr "mode" "<sseinsnmode>")])
20477 (define_expand "vpshldv_<mode>_maskz"
20478 [(match_operand:VI248_AVX512VL 0 "register_operand")
20479 (match_operand:VI248_AVX512VL 1 "register_operand")
20480 (match_operand:VI248_AVX512VL 2 "register_operand")
20481 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand")
20482 (match_operand:<avx512fmaskmode> 4 "register_operand")]
20483 "TARGET_AVX512VBMI2"
20485 emit_insn (gen_vpshldv_<mode>_maskz_1 (operands[0], operands[1],
20486 operands[2], operands[3],
20487 CONST0_RTX (<MODE>mode),
20492 (define_insn "vpshldv_<mode>_maskz_1"
20493 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
20494 (vec_merge:VI248_AVX512VL
20495 (unspec:VI248_AVX512VL
20496 [(match_operand:VI248_AVX512VL 1 "register_operand" "0")
20497 (match_operand:VI248_AVX512VL 2 "register_operand" "v")
20498 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand" "vm")]
20500 (match_operand:VI248_AVX512VL 4 "const0_operand" "C")
20501 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
20502 "TARGET_AVX512VBMI2"
20503 "vpshldv<ssemodesuffix>\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
20504 [(set_attr ("prefix") ("evex"))
20505 (set_attr "mode" "<sseinsnmode>")])
20507 (define_insn "vpdpbusd_<mode>"
20508 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20509 (unspec:VI4_AVX512VL
20510 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20511 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20512 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20513 UNSPEC_VPMADDUBSWACCD))]
20514 "TARGET_AVX512VNNI"
20515 "vpdpbusd\t{%3, %2, %0|%0, %2, %3 }"
20516 [(set_attr ("prefix") ("evex"))])
20518 (define_insn "vpdpbusd_<mode>_mask"
20519 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20520 (vec_merge:VI4_AVX512VL
20521 (unspec:VI4_AVX512VL
20522 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20523 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20524 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20525 UNSPEC_VPMADDUBSWACCD)
20527 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
20528 "TARGET_AVX512VNNI"
20529 "vpdpbusd\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
20530 [(set_attr ("prefix") ("evex"))])
20532 (define_expand "vpdpbusd_<mode>_maskz"
20533 [(match_operand:VI4_AVX512VL 0 "register_operand")
20534 (match_operand:VI4_AVX512VL 1 "register_operand")
20535 (match_operand:VI4_AVX512VL 2 "register_operand")
20536 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand")
20537 (match_operand:<avx512fmaskmode> 4 "register_operand")]
20538 "TARGET_AVX512VNNI"
20540 emit_insn (gen_vpdpbusd_<mode>_maskz_1 (operands[0], operands[1],
20541 operands[2], operands[3],
20542 CONST0_RTX (<MODE>mode),
20547 (define_insn "vpdpbusd_<mode>_maskz_1"
20548 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20549 (vec_merge:VI4_AVX512VL
20550 (unspec:VI4_AVX512VL
20551 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20552 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20553 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")
20554 ] UNSPEC_VPMADDUBSWACCD)
20555 (match_operand:VI4_AVX512VL 4 "const0_operand" "C")
20556 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
20557 "TARGET_AVX512VNNI"
20558 "vpdpbusd\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
20559 [(set_attr ("prefix") ("evex"))])
20562 (define_insn "vpdpbusds_<mode>"
20563 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20564 (unspec:VI4_AVX512VL
20565 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20566 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20567 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20568 UNSPEC_VPMADDUBSWACCSSD))]
20569 "TARGET_AVX512VNNI"
20570 "vpdpbusds\t{%3, %2, %0|%0, %2, %3 }"
20571 [(set_attr ("prefix") ("evex"))])
20573 (define_insn "vpdpbusds_<mode>_mask"
20574 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20575 (vec_merge:VI4_AVX512VL
20576 (unspec:VI4_AVX512VL
20577 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20578 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20579 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20580 UNSPEC_VPMADDUBSWACCSSD)
20582 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
20583 "TARGET_AVX512VNNI"
20584 "vpdpbusds\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
20585 [(set_attr ("prefix") ("evex"))])
20587 (define_expand "vpdpbusds_<mode>_maskz"
20588 [(match_operand:VI4_AVX512VL 0 "register_operand")
20589 (match_operand:VI4_AVX512VL 1 "register_operand")
20590 (match_operand:VI4_AVX512VL 2 "register_operand")
20591 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand")
20592 (match_operand:<avx512fmaskmode> 4 "register_operand")]
20593 "TARGET_AVX512VNNI"
20595 emit_insn (gen_vpdpbusds_<mode>_maskz_1 (operands[0], operands[1],
20596 operands[2], operands[3],
20597 CONST0_RTX (<MODE>mode),
20602 (define_insn "vpdpbusds_<mode>_maskz_1"
20603 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20604 (vec_merge:VI4_AVX512VL
20605 (unspec:VI4_AVX512VL
20606 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20607 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20608 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20609 UNSPEC_VPMADDUBSWACCSSD)
20610 (match_operand:VI4_AVX512VL 4 "const0_operand" "C")
20611 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
20612 "TARGET_AVX512VNNI"
20613 "vpdpbusds\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
20614 [(set_attr ("prefix") ("evex"))])
20617 (define_insn "vpdpwssd_<mode>"
20618 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20619 (unspec:VI4_AVX512VL
20620 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20621 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20622 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20623 UNSPEC_VPMADDWDACCD))]
20624 "TARGET_AVX512VNNI"
20625 "vpdpwssd\t{%3, %2, %0|%0, %2, %3 }"
20626 [(set_attr ("prefix") ("evex"))])
20628 (define_insn "vpdpwssd_<mode>_mask"
20629 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20630 (vec_merge:VI4_AVX512VL
20631 (unspec:VI4_AVX512VL
20632 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20633 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20634 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20635 UNSPEC_VPMADDWDACCD)
20637 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
20638 "TARGET_AVX512VNNI"
20639 "vpdpwssd\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
20640 [(set_attr ("prefix") ("evex"))])
20642 (define_expand "vpdpwssd_<mode>_maskz"
20643 [(match_operand:VI4_AVX512VL 0 "register_operand")
20644 (match_operand:VI4_AVX512VL 1 "register_operand")
20645 (match_operand:VI4_AVX512VL 2 "register_operand")
20646 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand")
20647 (match_operand:<avx512fmaskmode> 4 "register_operand")]
20648 "TARGET_AVX512VNNI"
20650 emit_insn (gen_vpdpwssd_<mode>_maskz_1 (operands[0], operands[1],
20651 operands[2], operands[3],
20652 CONST0_RTX (<MODE>mode),
20657 (define_insn "vpdpwssd_<mode>_maskz_1"
20658 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20659 (vec_merge:VI4_AVX512VL
20660 (unspec:VI4_AVX512VL
20661 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20662 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20663 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20664 UNSPEC_VPMADDWDACCD)
20665 (match_operand:VI4_AVX512VL 4 "const0_operand" "C")
20666 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
20667 "TARGET_AVX512VNNI"
20668 "vpdpwssd\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
20669 [(set_attr ("prefix") ("evex"))])
20672 (define_insn "vpdpwssds_<mode>"
20673 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20674 (unspec:VI4_AVX512VL
20675 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20676 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20677 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20678 UNSPEC_VPMADDWDACCSSD))]
20679 "TARGET_AVX512VNNI"
20680 "vpdpwssds\t{%3, %2, %0|%0, %2, %3 }"
20681 [(set_attr ("prefix") ("evex"))])
20683 (define_insn "vpdpwssds_<mode>_mask"
20684 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20685 (vec_merge:VI4_AVX512VL
20686 (unspec:VI4_AVX512VL
20687 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20688 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20689 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20690 UNSPEC_VPMADDWDACCSSD)
20692 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
20693 "TARGET_AVX512VNNI"
20694 "vpdpwssds\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
20695 [(set_attr ("prefix") ("evex"))])
20697 (define_expand "vpdpwssds_<mode>_maskz"
20698 [(match_operand:VI4_AVX512VL 0 "register_operand")
20699 (match_operand:VI4_AVX512VL 1 "register_operand")
20700 (match_operand:VI4_AVX512VL 2 "register_operand")
20701 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand")
20702 (match_operand:<avx512fmaskmode> 4 "register_operand")]
20703 "TARGET_AVX512VNNI"
20705 emit_insn (gen_vpdpwssds_<mode>_maskz_1 (operands[0], operands[1],
20706 operands[2], operands[3],
20707 CONST0_RTX (<MODE>mode),
20712 (define_insn "vpdpwssds_<mode>_maskz_1"
20713 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20714 (vec_merge:VI4_AVX512VL
20715 (unspec:VI4_AVX512VL
20716 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20717 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20718 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20719 UNSPEC_VPMADDWDACCSSD)
20720 (match_operand:VI4_AVX512VL 4 "const0_operand" "C")
20721 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
20722 "TARGET_AVX512VNNI"
20723 "vpdpwssds\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
20724 [(set_attr ("prefix") ("evex"))])
20726 (define_insn "vaesdec_<mode>"
20727 [(set (match_operand:VI1_AVX512VL_F 0 "register_operand" "=v")
20728 (unspec:VI1_AVX512VL_F
20729 [(match_operand:VI1_AVX512VL_F 1 "register_operand" "v")
20730 (match_operand:VI1_AVX512VL_F 2 "vector_operand" "v")]
20733 "vaesdec\t{%2, %1, %0|%0, %1, %2}"
20736 (define_insn "vaesdeclast_<mode>"
20737 [(set (match_operand:VI1_AVX512VL_F 0 "register_operand" "=v")
20738 (unspec:VI1_AVX512VL_F
20739 [(match_operand:VI1_AVX512VL_F 1 "register_operand" "v")
20740 (match_operand:VI1_AVX512VL_F 2 "vector_operand" "v")]
20741 UNSPEC_VAESDECLAST))]
20743 "vaesdeclast\t{%2, %1, %0|%0, %1, %2}"
20746 (define_insn "vaesenc_<mode>"
20747 [(set (match_operand:VI1_AVX512VL_F 0 "register_operand" "=v")
20748 (unspec:VI1_AVX512VL_F
20749 [(match_operand:VI1_AVX512VL_F 1 "register_operand" "v")
20750 (match_operand:VI1_AVX512VL_F 2 "vector_operand" "vm")]
20753 "vaesenc\t{%2, %1, %0|%0, %1, %2}"
20756 (define_insn "vaesenclast_<mode>"
20757 [(set (match_operand:VI1_AVX512VL_F 0 "register_operand" "=v")
20758 (unspec:VI1_AVX512VL_F
20759 [(match_operand:VI1_AVX512VL_F 1 "register_operand" "v")
20760 (match_operand:VI1_AVX512VL_F 2 "vector_operand" "vm")]
20761 UNSPEC_VAESENCLAST))]
20763 "vaesenclast\t{%2, %1, %0|%0, %1, %2}"
20766 (define_insn "vpclmulqdq_<mode>"
20767 [(set (match_operand:VI8_FVL 0 "register_operand" "=v")
20768 (unspec:VI8_FVL [(match_operand:VI8_FVL 1 "register_operand" "v")
20769 (match_operand:VI8_FVL 2 "vector_operand" "vm")
20770 (match_operand:SI 3 "const_0_to_255_operand" "n")]
20771 UNSPEC_VPCLMULQDQ))]
20772 "TARGET_VPCLMULQDQ"
20773 "vpclmulqdq\t{%3, %2, %1, %0|%0, %1, %2, %3}"
20774 [(set_attr "mode" "DI")])
20776 (define_insn "avx512vl_vpshufbitqmb<mode><mask_scalar_merge_name>"
20777 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
20778 (unspec:<avx512fmaskmode>
20779 [(match_operand:VI1_AVX512VLBW 1 "register_operand" "v")
20780 (match_operand:VI1_AVX512VLBW 2 "nonimmediate_operand" "vm")]
20781 UNSPEC_VPSHUFBIT))]
20782 "TARGET_AVX512BITALG"
20783 "vpshufbitqmb\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
20784 [(set_attr "prefix" "evex")
20785 (set_attr "mode" "<sseinsnmode>")])