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 xtg_mode
917 [(V16QI "x") (V8HI "x") (V4SI "x") (V2DI "x") (V4SF "x") (V2DF "x")
918 (V32QI "t") (V16HI "t") (V8SI "t") (V4DI "t") (V8SF "t") (V4DF "t")
919 (V64QI "g") (V32HI "g") (V16SI "g") (V8DI "g") (V16SF "g") (V8DF "g")])
921 ;; Half mask mode for unpacks
922 (define_mode_attr HALFMASKMODE
923 [(DI "SI") (SI "HI")])
925 ;; Double mask mode for packs
926 (define_mode_attr DOUBLEMASKMODE
927 [(HI "SI") (SI "DI")])
930 ;; Include define_subst patterns for instructions with mask
933 ;; Patterns whose name begins with "sse{,2,3}_" are invoked by intrinsics.
935 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
939 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
941 ;; All of these patterns are enabled for SSE1 as well as SSE2.
942 ;; This is essential for maintaining stable calling conventions.
944 (define_expand "mov<mode>"
945 [(set (match_operand:VMOVE 0 "nonimmediate_operand")
946 (match_operand:VMOVE 1 "nonimmediate_operand"))]
949 ix86_expand_vector_move (<MODE>mode, operands);
953 (define_insn "mov<mode>_internal"
954 [(set (match_operand:VMOVE 0 "nonimmediate_operand"
956 (match_operand:VMOVE 1 "nonimmediate_or_sse_const_operand"
959 && (register_operand (operands[0], <MODE>mode)
960 || register_operand (operands[1], <MODE>mode))"
962 switch (get_attr_type (insn))
965 return standard_sse_constant_opcode (insn, operands);
968 /* There is no evex-encoded vmov* for sizes smaller than 64-bytes
969 in avx512f, so we need to use workarounds, to access sse registers
970 16-31, which are evex-only. In avx512vl we don't need workarounds. */
971 if (TARGET_AVX512F && <MODE_SIZE> < 64 && !TARGET_AVX512VL
972 && (EXT_REX_SSE_REG_P (operands[0])
973 || EXT_REX_SSE_REG_P (operands[1])))
975 if (memory_operand (operands[0], <MODE>mode))
977 if (<MODE_SIZE> == 32)
978 return "vextract<shuffletype>64x4\t{$0x0, %g1, %0|%0, %g1, 0x0}";
979 else if (<MODE_SIZE> == 16)
980 return "vextract<shuffletype>32x4\t{$0x0, %g1, %0|%0, %g1, 0x0}";
984 else if (memory_operand (operands[1], <MODE>mode))
986 if (<MODE_SIZE> == 32)
987 return "vbroadcast<shuffletype>64x4\t{%1, %g0|%g0, %1}";
988 else if (<MODE_SIZE> == 16)
989 return "vbroadcast<shuffletype>32x4\t{%1, %g0|%g0, %1}";
994 /* Reg -> reg move is always aligned. Just use wider move. */
995 switch (get_attr_mode (insn))
999 return "vmovaps\t{%g1, %g0|%g0, %g1}";
1002 return "vmovapd\t{%g1, %g0|%g0, %g1}";
1005 return "vmovdqa64\t{%g1, %g0|%g0, %g1}";
1011 switch (get_attr_mode (insn))
1016 if (misaligned_operand (operands[0], <MODE>mode)
1017 || misaligned_operand (operands[1], <MODE>mode))
1018 return "%vmovups\t{%1, %0|%0, %1}";
1020 return "%vmovaps\t{%1, %0|%0, %1}";
1025 if (misaligned_operand (operands[0], <MODE>mode)
1026 || misaligned_operand (operands[1], <MODE>mode))
1027 return "%vmovupd\t{%1, %0|%0, %1}";
1029 return "%vmovapd\t{%1, %0|%0, %1}";
1033 if (misaligned_operand (operands[0], <MODE>mode)
1034 || misaligned_operand (operands[1], <MODE>mode))
1035 return TARGET_AVX512VL
1036 && (<MODE>mode == V4SImode
1037 || <MODE>mode == V2DImode
1038 || <MODE>mode == V8SImode
1039 || <MODE>mode == V4DImode
1041 ? "vmovdqu<ssescalarsize>\t{%1, %0|%0, %1}"
1042 : "%vmovdqu\t{%1, %0|%0, %1}";
1044 return TARGET_AVX512VL ? "vmovdqa64\t{%1, %0|%0, %1}"
1045 : "%vmovdqa\t{%1, %0|%0, %1}";
1047 if (misaligned_operand (operands[0], <MODE>mode)
1048 || misaligned_operand (operands[1], <MODE>mode))
1049 return (<MODE>mode == V16SImode
1050 || <MODE>mode == V8DImode
1052 ? "vmovdqu<ssescalarsize>\t{%1, %0|%0, %1}"
1053 : "vmovdqu64\t{%1, %0|%0, %1}";
1055 return "vmovdqa64\t{%1, %0|%0, %1}";
1065 [(set_attr "type" "sselog1,sselog1,ssemov,ssemov")
1066 (set_attr "prefix" "maybe_vex")
1068 (cond [(and (eq_attr "alternative" "1")
1069 (match_test "TARGET_AVX512VL"))
1070 (const_string "<sseinsnmode>")
1071 (and (match_test "<MODE_SIZE> == 16")
1072 (ior (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
1073 (and (eq_attr "alternative" "3")
1074 (match_test "TARGET_SSE_TYPELESS_STORES"))))
1075 (const_string "<ssePSmode>")
1076 (match_test "TARGET_AVX")
1077 (const_string "<sseinsnmode>")
1078 (ior (not (match_test "TARGET_SSE2"))
1079 (match_test "optimize_function_for_size_p (cfun)"))
1080 (const_string "V4SF")
1081 (and (eq_attr "alternative" "0")
1082 (match_test "TARGET_SSE_LOAD0_BY_PXOR"))
1085 (const_string "<sseinsnmode>")))
1086 (set (attr "enabled")
1087 (cond [(and (match_test "<MODE_SIZE> == 16")
1088 (eq_attr "alternative" "1"))
1089 (symbol_ref "TARGET_SSE2")
1090 (and (match_test "<MODE_SIZE> == 32")
1091 (eq_attr "alternative" "1"))
1092 (symbol_ref "TARGET_AVX2")
1094 (symbol_ref "true")))])
1096 (define_insn "<avx512>_load<mode>_mask"
1097 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v,v")
1098 (vec_merge:V48_AVX512VL
1099 (match_operand:V48_AVX512VL 1 "nonimmediate_operand" "v,m")
1100 (match_operand:V48_AVX512VL 2 "vector_move_operand" "0C,0C")
1101 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
1104 if (FLOAT_MODE_P (GET_MODE_INNER (<MODE>mode)))
1106 if (misaligned_operand (operands[1], <MODE>mode))
1107 return "vmovu<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
1109 return "vmova<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
1113 if (misaligned_operand (operands[1], <MODE>mode))
1114 return "vmovdqu<ssescalarsize>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
1116 return "vmovdqa<ssescalarsize>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
1119 [(set_attr "type" "ssemov")
1120 (set_attr "prefix" "evex")
1121 (set_attr "memory" "none,load")
1122 (set_attr "mode" "<sseinsnmode>")])
1124 (define_insn "<avx512>_load<mode>_mask"
1125 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v,v")
1126 (vec_merge:VI12_AVX512VL
1127 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "v,m")
1128 (match_operand:VI12_AVX512VL 2 "vector_move_operand" "0C,0C")
1129 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
1131 "vmovdqu<ssescalarsize>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
1132 [(set_attr "type" "ssemov")
1133 (set_attr "prefix" "evex")
1134 (set_attr "memory" "none,load")
1135 (set_attr "mode" "<sseinsnmode>")])
1137 (define_insn "<avx512>_blendm<mode>"
1138 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v")
1139 (vec_merge:V48_AVX512VL
1140 (match_operand:V48_AVX512VL 2 "nonimmediate_operand" "vm")
1141 (match_operand:V48_AVX512VL 1 "register_operand" "v")
1142 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
1144 "v<sseintprefix>blendm<ssemodesuffix>\t{%2, %1, %0%{%3%}|%0%{%3%}, %1, %2}"
1145 [(set_attr "type" "ssemov")
1146 (set_attr "prefix" "evex")
1147 (set_attr "mode" "<sseinsnmode>")])
1149 (define_insn "<avx512>_blendm<mode>"
1150 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
1151 (vec_merge:VI12_AVX512VL
1152 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")
1153 (match_operand:VI12_AVX512VL 1 "register_operand" "v")
1154 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
1156 "vpblendm<ssemodesuffix>\t{%2, %1, %0%{%3%}|%0%{%3%}, %1, %2}"
1157 [(set_attr "type" "ssemov")
1158 (set_attr "prefix" "evex")
1159 (set_attr "mode" "<sseinsnmode>")])
1161 (define_insn "<avx512>_store<mode>_mask"
1162 [(set (match_operand:V48_AVX512VL 0 "memory_operand" "=m")
1163 (vec_merge:V48_AVX512VL
1164 (match_operand:V48_AVX512VL 1 "register_operand" "v")
1166 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")))]
1169 if (FLOAT_MODE_P (GET_MODE_INNER (<MODE>mode)))
1171 if (misaligned_operand (operands[0], <MODE>mode))
1172 return "vmovu<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1174 return "vmova<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1178 if (misaligned_operand (operands[0], <MODE>mode))
1179 return "vmovdqu<ssescalarsize>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1181 return "vmovdqa<ssescalarsize>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1184 [(set_attr "type" "ssemov")
1185 (set_attr "prefix" "evex")
1186 (set_attr "memory" "store")
1187 (set_attr "mode" "<sseinsnmode>")])
1189 (define_insn "<avx512>_store<mode>_mask"
1190 [(set (match_operand:VI12_AVX512VL 0 "memory_operand" "=m")
1191 (vec_merge:VI12_AVX512VL
1192 (match_operand:VI12_AVX512VL 1 "register_operand" "v")
1194 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")))]
1196 "vmovdqu<ssescalarsize>\t{%1, %0%{%2%}|%0%{%2%}, %1}"
1197 [(set_attr "type" "ssemov")
1198 (set_attr "prefix" "evex")
1199 (set_attr "memory" "store")
1200 (set_attr "mode" "<sseinsnmode>")])
1202 (define_insn "sse2_movq128"
1203 [(set (match_operand:V2DI 0 "register_operand" "=v")
1206 (match_operand:V2DI 1 "nonimmediate_operand" "vm")
1207 (parallel [(const_int 0)]))
1210 "%vmovq\t{%1, %0|%0, %q1}"
1211 [(set_attr "type" "ssemov")
1212 (set_attr "prefix" "maybe_vex")
1213 (set_attr "mode" "TI")])
1215 ;; Move a DI from a 32-bit register pair (e.g. %edx:%eax) to an xmm.
1216 ;; We'd rather avoid this entirely; if the 32-bit reg pair was loaded
1217 ;; from memory, we'd prefer to load the memory directly into the %xmm
1218 ;; register. To facilitate this happy circumstance, this pattern won't
1219 ;; split until after register allocation. If the 64-bit value didn't
1220 ;; come from memory, this is the best we can do. This is much better
1221 ;; than storing %edx:%eax into a stack temporary and loading an %xmm
1224 (define_insn_and_split "movdi_to_sse"
1226 [(set (match_operand:V4SI 0 "register_operand" "=?x,x")
1227 (subreg:V4SI (match_operand:DI 1 "nonimmediate_operand" "r,m") 0))
1228 (clobber (match_scratch:V4SI 2 "=&x,X"))])]
1229 "!TARGET_64BIT && TARGET_SSE2 && TARGET_INTER_UNIT_MOVES_TO_VEC"
1231 "&& reload_completed"
1234 if (register_operand (operands[1], DImode))
1236 /* The DImode arrived in a pair of integral registers (e.g. %edx:%eax).
1237 Assemble the 64-bit DImode value in an xmm register. */
1238 emit_insn (gen_sse2_loadld (operands[0], CONST0_RTX (V4SImode),
1239 gen_lowpart (SImode, operands[1])));
1240 emit_insn (gen_sse2_loadld (operands[2], CONST0_RTX (V4SImode),
1241 gen_highpart (SImode, operands[1])));
1242 emit_insn (gen_vec_interleave_lowv4si (operands[0], operands[0],
1245 else if (memory_operand (operands[1], DImode))
1246 emit_insn (gen_vec_concatv2di (gen_lowpart (V2DImode, operands[0]),
1247 operands[1], const0_rtx));
1254 [(set (match_operand:V4SF 0 "register_operand")
1255 (match_operand:V4SF 1 "zero_extended_scalar_load_operand"))]
1256 "TARGET_SSE && reload_completed"
1259 (vec_duplicate:V4SF (match_dup 1))
1263 operands[1] = gen_lowpart (SFmode, operands[1]);
1264 operands[2] = CONST0_RTX (V4SFmode);
1268 [(set (match_operand:V2DF 0 "register_operand")
1269 (match_operand:V2DF 1 "zero_extended_scalar_load_operand"))]
1270 "TARGET_SSE2 && reload_completed"
1271 [(set (match_dup 0) (vec_concat:V2DF (match_dup 1) (match_dup 2)))]
1273 operands[1] = gen_lowpart (DFmode, operands[1]);
1274 operands[2] = CONST0_RTX (DFmode);
1277 (define_expand "movmisalign<mode>"
1278 [(set (match_operand:VMOVE 0 "nonimmediate_operand")
1279 (match_operand:VMOVE 1 "nonimmediate_operand"))]
1282 ix86_expand_vector_move_misalign (<MODE>mode, operands);
1286 ;; Merge movsd/movhpd to movupd for TARGET_SSE_UNALIGNED_LOAD_OPTIMAL targets.
1288 [(set (match_operand:V2DF 0 "sse_reg_operand")
1289 (vec_concat:V2DF (match_operand:DF 1 "memory_operand")
1290 (match_operand:DF 4 "const0_operand")))
1291 (set (match_operand:V2DF 2 "sse_reg_operand")
1292 (vec_concat:V2DF (vec_select:DF (match_dup 2)
1293 (parallel [(const_int 0)]))
1294 (match_operand:DF 3 "memory_operand")))]
1295 "TARGET_SSE2 && TARGET_SSE_UNALIGNED_LOAD_OPTIMAL
1296 && ix86_operands_ok_for_move_multiple (operands, true, DFmode)"
1297 [(set (match_dup 2) (match_dup 5))]
1298 "operands[5] = adjust_address (operands[1], V2DFmode, 0);")
1301 [(set (match_operand:DF 0 "sse_reg_operand")
1302 (match_operand:DF 1 "memory_operand"))
1303 (set (match_operand:V2DF 2 "sse_reg_operand")
1304 (vec_concat:V2DF (match_operand:DF 4 "sse_reg_operand")
1305 (match_operand:DF 3 "memory_operand")))]
1306 "TARGET_SSE2 && TARGET_SSE_UNALIGNED_LOAD_OPTIMAL
1307 && REGNO (operands[4]) == REGNO (operands[2])
1308 && ix86_operands_ok_for_move_multiple (operands, true, DFmode)"
1309 [(set (match_dup 2) (match_dup 5))]
1310 "operands[5] = adjust_address (operands[1], V2DFmode, 0);")
1312 ;; Merge movlpd/movhpd to movupd for TARGET_SSE_UNALIGNED_STORE_OPTIMAL targets.
1314 [(set (match_operand:DF 0 "memory_operand")
1315 (vec_select:DF (match_operand:V2DF 1 "sse_reg_operand")
1316 (parallel [(const_int 0)])))
1317 (set (match_operand:DF 2 "memory_operand")
1318 (vec_select:DF (match_operand:V2DF 3 "sse_reg_operand")
1319 (parallel [(const_int 1)])))]
1320 "TARGET_SSE2 && TARGET_SSE_UNALIGNED_STORE_OPTIMAL
1321 && ix86_operands_ok_for_move_multiple (operands, false, DFmode)"
1322 [(set (match_dup 4) (match_dup 1))]
1323 "operands[4] = adjust_address (operands[0], V2DFmode, 0);")
1325 (define_insn "<sse3>_lddqu<avxsizesuffix>"
1326 [(set (match_operand:VI1 0 "register_operand" "=x")
1327 (unspec:VI1 [(match_operand:VI1 1 "memory_operand" "m")]
1330 "%vlddqu\t{%1, %0|%0, %1}"
1331 [(set_attr "type" "ssemov")
1332 (set_attr "movu" "1")
1333 (set (attr "prefix_data16")
1335 (match_test "TARGET_AVX")
1337 (const_string "0")))
1338 (set (attr "prefix_rep")
1340 (match_test "TARGET_AVX")
1342 (const_string "1")))
1343 (set_attr "prefix" "maybe_vex")
1344 (set_attr "mode" "<sseinsnmode>")])
1346 (define_insn "sse2_movnti<mode>"
1347 [(set (match_operand:SWI48 0 "memory_operand" "=m")
1348 (unspec:SWI48 [(match_operand:SWI48 1 "register_operand" "r")]
1351 "movnti\t{%1, %0|%0, %1}"
1352 [(set_attr "type" "ssemov")
1353 (set_attr "prefix_data16" "0")
1354 (set_attr "mode" "<MODE>")])
1356 (define_insn "<sse>_movnt<mode>"
1357 [(set (match_operand:VF 0 "memory_operand" "=m")
1359 [(match_operand:VF 1 "register_operand" "v")]
1362 "%vmovnt<ssemodesuffix>\t{%1, %0|%0, %1}"
1363 [(set_attr "type" "ssemov")
1364 (set_attr "prefix" "maybe_vex")
1365 (set_attr "mode" "<MODE>")])
1367 (define_insn "<sse2>_movnt<mode>"
1368 [(set (match_operand:VI8 0 "memory_operand" "=m")
1369 (unspec:VI8 [(match_operand:VI8 1 "register_operand" "v")]
1372 "%vmovntdq\t{%1, %0|%0, %1}"
1373 [(set_attr "type" "ssecvt")
1374 (set (attr "prefix_data16")
1376 (match_test "TARGET_AVX")
1378 (const_string "1")))
1379 (set_attr "prefix" "maybe_vex")
1380 (set_attr "mode" "<sseinsnmode>")])
1382 ; Expand patterns for non-temporal stores. At the moment, only those
1383 ; that directly map to insns are defined; it would be possible to
1384 ; define patterns for other modes that would expand to several insns.
1386 ;; Modes handled by storent patterns.
1387 (define_mode_iterator STORENT_MODE
1388 [(DI "TARGET_SSE2 && TARGET_64BIT") (SI "TARGET_SSE2")
1389 (SF "TARGET_SSE4A") (DF "TARGET_SSE4A")
1390 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") (V2DI "TARGET_SSE2")
1391 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
1392 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
1394 (define_expand "storent<mode>"
1395 [(set (match_operand:STORENT_MODE 0 "memory_operand")
1396 (unspec:STORENT_MODE
1397 [(match_operand:STORENT_MODE 1 "register_operand")]
1401 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1405 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1407 ;; All integer modes with AVX512BW/DQ.
1408 (define_mode_iterator SWI1248_AVX512BWDQ
1409 [(QI "TARGET_AVX512DQ") HI (SI "TARGET_AVX512BW") (DI "TARGET_AVX512BW")])
1411 ;; All integer modes with AVX512BW, where HImode operation
1412 ;; can be used instead of QImode.
1413 (define_mode_iterator SWI1248_AVX512BW
1414 [QI HI (SI "TARGET_AVX512BW") (DI "TARGET_AVX512BW")])
1416 ;; All integer modes with AVX512BW/DQ, even HImode requires DQ.
1417 (define_mode_iterator SWI1248_AVX512BWDQ2
1418 [(QI "TARGET_AVX512DQ") (HI "TARGET_AVX512DQ")
1419 (SI "TARGET_AVX512BW") (DI "TARGET_AVX512BW")])
1421 (define_expand "kmov<mskmodesuffix>"
1422 [(set (match_operand:SWI1248_AVX512BWDQ 0 "nonimmediate_operand")
1423 (match_operand:SWI1248_AVX512BWDQ 1 "nonimmediate_operand"))]
1425 && !(MEM_P (operands[0]) && MEM_P (operands[1]))")
1427 (define_insn "k<code><mode>"
1428 [(set (match_operand:SWI1248_AVX512BW 0 "register_operand" "=k")
1429 (any_logic:SWI1248_AVX512BW
1430 (match_operand:SWI1248_AVX512BW 1 "register_operand" "k")
1431 (match_operand:SWI1248_AVX512BW 2 "register_operand" "k")))
1432 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1435 if (get_attr_mode (insn) == MODE_HI)
1436 return "k<logic>w\t{%2, %1, %0|%0, %1, %2}";
1438 return "k<logic><mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}";
1440 [(set_attr "type" "msklog")
1441 (set_attr "prefix" "vex")
1443 (cond [(and (match_test "<MODE>mode == QImode")
1444 (not (match_test "TARGET_AVX512DQ")))
1447 (const_string "<MODE>")))])
1449 (define_insn "kandn<mode>"
1450 [(set (match_operand:SWI1248_AVX512BW 0 "register_operand" "=k")
1451 (and:SWI1248_AVX512BW
1452 (not:SWI1248_AVX512BW
1453 (match_operand:SWI1248_AVX512BW 1 "register_operand" "k"))
1454 (match_operand:SWI1248_AVX512BW 2 "register_operand" "k")))
1455 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1458 if (get_attr_mode (insn) == MODE_HI)
1459 return "kandnw\t{%2, %1, %0|%0, %1, %2}";
1461 return "kandn<mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}";
1463 [(set_attr "type" "msklog")
1464 (set_attr "prefix" "vex")
1466 (cond [(and (match_test "<MODE>mode == QImode")
1467 (not (match_test "TARGET_AVX512DQ")))
1470 (const_string "<MODE>")))])
1472 (define_insn "kxnor<mode>"
1473 [(set (match_operand:SWI1248_AVX512BW 0 "register_operand" "=k")
1474 (not:SWI1248_AVX512BW
1475 (xor:SWI1248_AVX512BW
1476 (match_operand:SWI1248_AVX512BW 1 "register_operand" "k")
1477 (match_operand:SWI1248_AVX512BW 2 "register_operand" "k"))))
1478 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1481 if (get_attr_mode (insn) == MODE_HI)
1482 return "kxnorw\t{%2, %1, %0|%0, %1, %2}";
1484 return "kxnor<mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}";
1486 [(set_attr "type" "msklog")
1487 (set_attr "prefix" "vex")
1489 (cond [(and (match_test "<MODE>mode == QImode")
1490 (not (match_test "TARGET_AVX512DQ")))
1493 (const_string "<MODE>")))])
1495 (define_insn "knot<mode>"
1496 [(set (match_operand:SWI1248_AVX512BW 0 "register_operand" "=k")
1497 (not:SWI1248_AVX512BW
1498 (match_operand:SWI1248_AVX512BW 1 "register_operand" "k")))
1499 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1502 if (get_attr_mode (insn) == MODE_HI)
1503 return "knotw\t{%1, %0|%0, %1}";
1505 return "knot<mskmodesuffix>\t{%1, %0|%0, %1}";
1507 [(set_attr "type" "msklog")
1508 (set_attr "prefix" "vex")
1510 (cond [(and (match_test "<MODE>mode == QImode")
1511 (not (match_test "TARGET_AVX512DQ")))
1514 (const_string "<MODE>")))])
1516 (define_insn "kadd<mode>"
1517 [(set (match_operand:SWI1248_AVX512BWDQ2 0 "register_operand" "=k")
1518 (plus:SWI1248_AVX512BWDQ2
1519 (match_operand:SWI1248_AVX512BWDQ2 1 "register_operand" "k")
1520 (match_operand:SWI1248_AVX512BWDQ2 2 "register_operand" "k")))
1521 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1523 "kadd<mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}"
1524 [(set_attr "type" "msklog")
1525 (set_attr "prefix" "vex")
1526 (set_attr "mode" "<MODE>")])
1528 ;; Mask variant shift mnemonics
1529 (define_code_attr mshift [(ashift "shiftl") (lshiftrt "shiftr")])
1531 (define_insn "k<code><mode>"
1532 [(set (match_operand:SWI1248_AVX512BWDQ 0 "register_operand" "=k")
1533 (any_lshift:SWI1248_AVX512BWDQ
1534 (match_operand:SWI1248_AVX512BWDQ 1 "register_operand" "k")
1535 (match_operand:QI 2 "immediate_operand" "n")))
1536 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1538 "k<mshift><mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}"
1539 [(set_attr "type" "msklog")
1540 (set_attr "prefix" "vex")
1541 (set_attr "mode" "<MODE>")])
1543 (define_insn "ktest<mode>"
1544 [(set (reg:CC FLAGS_REG)
1546 [(match_operand:SWI1248_AVX512BWDQ2 0 "register_operand" "k")
1547 (match_operand:SWI1248_AVX512BWDQ2 1 "register_operand" "k")]
1550 "ktest<mskmodesuffix>\t{%1, %0|%0, %1}"
1551 [(set_attr "mode" "<MODE>")
1552 (set_attr "type" "msklog")
1553 (set_attr "prefix" "vex")])
1555 (define_insn "kortest<mode>"
1556 [(set (reg:CC FLAGS_REG)
1558 [(match_operand:SWI1248_AVX512BWDQ 0 "register_operand" "k")
1559 (match_operand:SWI1248_AVX512BWDQ 1 "register_operand" "k")]
1562 "kortest<mskmodesuffix>\t{%1, %0|%0, %1}"
1563 [(set_attr "mode" "<MODE>")
1564 (set_attr "type" "msklog")
1565 (set_attr "prefix" "vex")])
1567 (define_insn "kunpckhi"
1568 [(set (match_operand:HI 0 "register_operand" "=k")
1571 (zero_extend:HI (match_operand:QI 1 "register_operand" "k"))
1573 (zero_extend:HI (match_operand:QI 2 "register_operand" "k"))))]
1575 "kunpckbw\t{%2, %1, %0|%0, %1, %2}"
1576 [(set_attr "mode" "HI")
1577 (set_attr "type" "msklog")
1578 (set_attr "prefix" "vex")])
1580 (define_insn "kunpcksi"
1581 [(set (match_operand:SI 0 "register_operand" "=k")
1584 (zero_extend:SI (match_operand:HI 1 "register_operand" "k"))
1586 (zero_extend:SI (match_operand:HI 2 "register_operand" "k"))))]
1588 "kunpckwd\t{%2, %1, %0|%0, %1, %2}"
1589 [(set_attr "mode" "SI")])
1591 (define_insn "kunpckdi"
1592 [(set (match_operand:DI 0 "register_operand" "=k")
1595 (zero_extend:DI (match_operand:SI 1 "register_operand" "k"))
1597 (zero_extend:DI (match_operand:SI 2 "register_operand" "k"))))]
1599 "kunpckdq\t{%2, %1, %0|%0, %1, %2}"
1600 [(set_attr "mode" "DI")])
1603 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1605 ;; Parallel floating point arithmetic
1607 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1609 (define_expand "<code><mode>2"
1610 [(set (match_operand:VF 0 "register_operand")
1612 (match_operand:VF 1 "register_operand")))]
1614 "ix86_expand_fp_absneg_operator (<CODE>, <MODE>mode, operands); DONE;")
1616 (define_insn_and_split "*absneg<mode>2"
1617 [(set (match_operand:VF 0 "register_operand" "=x,x,v,v")
1618 (match_operator:VF 3 "absneg_operator"
1619 [(match_operand:VF 1 "vector_operand" "0, xBm,v, m")]))
1620 (use (match_operand:VF 2 "vector_operand" "xBm,0, vm,v"))]
1623 "&& reload_completed"
1626 enum rtx_code absneg_op;
1632 if (MEM_P (operands[1]))
1633 op1 = operands[2], op2 = operands[1];
1635 op1 = operands[1], op2 = operands[2];
1640 if (rtx_equal_p (operands[0], operands[1]))
1646 absneg_op = GET_CODE (operands[3]) == NEG ? XOR : AND;
1647 t = gen_rtx_fmt_ee (absneg_op, <MODE>mode, op1, op2);
1648 t = gen_rtx_SET (operands[0], t);
1652 [(set_attr "isa" "noavx,noavx,avx,avx")])
1654 (define_expand "<plusminus_insn><mode>3<mask_name><round_name>"
1655 [(set (match_operand:VF 0 "register_operand")
1657 (match_operand:VF 1 "<round_nimm_predicate>")
1658 (match_operand:VF 2 "<round_nimm_predicate>")))]
1659 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1660 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
1662 (define_insn "*<plusminus_insn><mode>3<mask_name><round_name>"
1663 [(set (match_operand:VF 0 "register_operand" "=x,v")
1665 (match_operand:VF 1 "<round_nimm_predicate>" "<comm>0,v")
1666 (match_operand:VF 2 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
1667 "TARGET_SSE && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)
1668 && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1670 <plusminus_mnemonic><ssemodesuffix>\t{%2, %0|%0, %2}
1671 v<plusminus_mnemonic><ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
1672 [(set_attr "isa" "noavx,avx")
1673 (set_attr "type" "sseadd")
1674 (set_attr "prefix" "<mask_prefix3>")
1675 (set_attr "mode" "<MODE>")])
1677 (define_insn "<sse>_vm<plusminus_insn><mode>3<mask_scalar_name><round_scalar_name>"
1678 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
1681 (match_operand:VF_128 1 "register_operand" "0,v")
1682 (match_operand:VF_128 2 "vector_operand" "xBm,<round_scalar_constraint>"))
1687 <plusminus_mnemonic><ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
1688 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>}"
1689 [(set_attr "isa" "noavx,avx")
1690 (set_attr "type" "sseadd")
1691 (set_attr "prefix" "<round_scalar_prefix>")
1692 (set_attr "mode" "<ssescalarmode>")])
1694 (define_expand "mul<mode>3<mask_name><round_name>"
1695 [(set (match_operand:VF 0 "register_operand")
1697 (match_operand:VF 1 "<round_nimm_predicate>")
1698 (match_operand:VF 2 "<round_nimm_predicate>")))]
1699 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1700 "ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);")
1702 (define_insn "*mul<mode>3<mask_name><round_name>"
1703 [(set (match_operand:VF 0 "register_operand" "=x,v")
1705 (match_operand:VF 1 "<round_nimm_predicate>" "%0,v")
1706 (match_operand:VF 2 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
1708 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
1709 && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1711 mul<ssemodesuffix>\t{%2, %0|%0, %2}
1712 vmul<ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
1713 [(set_attr "isa" "noavx,avx")
1714 (set_attr "type" "ssemul")
1715 (set_attr "prefix" "<mask_prefix3>")
1716 (set_attr "btver2_decode" "direct,double")
1717 (set_attr "mode" "<MODE>")])
1719 (define_insn "<sse>_vm<multdiv_mnemonic><mode>3<mask_scalar_name><round_scalar_name>"
1720 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
1723 (match_operand:VF_128 1 "register_operand" "0,v")
1724 (match_operand:VF_128 2 "vector_operand" "xBm,<round_scalar_constraint>"))
1729 <multdiv_mnemonic><ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
1730 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>}"
1731 [(set_attr "isa" "noavx,avx")
1732 (set_attr "type" "sse<multdiv_mnemonic>")
1733 (set_attr "prefix" "<round_scalar_prefix>")
1734 (set_attr "btver2_decode" "direct,double")
1735 (set_attr "mode" "<ssescalarmode>")])
1737 (define_expand "div<mode>3"
1738 [(set (match_operand:VF2 0 "register_operand")
1739 (div:VF2 (match_operand:VF2 1 "register_operand")
1740 (match_operand:VF2 2 "vector_operand")))]
1742 "ix86_fixup_binary_operands_no_copy (DIV, <MODE>mode, operands);")
1744 (define_expand "div<mode>3"
1745 [(set (match_operand:VF1 0 "register_operand")
1746 (div:VF1 (match_operand:VF1 1 "register_operand")
1747 (match_operand:VF1 2 "vector_operand")))]
1750 ix86_fixup_binary_operands_no_copy (DIV, <MODE>mode, operands);
1753 && TARGET_RECIP_VEC_DIV
1754 && !optimize_insn_for_size_p ()
1755 && flag_finite_math_only && !flag_trapping_math
1756 && flag_unsafe_math_optimizations)
1758 ix86_emit_swdivsf (operands[0], operands[1], operands[2], <MODE>mode);
1763 (define_insn "<sse>_div<mode>3<mask_name><round_name>"
1764 [(set (match_operand:VF 0 "register_operand" "=x,v")
1766 (match_operand:VF 1 "register_operand" "0,v")
1767 (match_operand:VF 2 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
1768 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1770 div<ssemodesuffix>\t{%2, %0|%0, %2}
1771 vdiv<ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
1772 [(set_attr "isa" "noavx,avx")
1773 (set_attr "type" "ssediv")
1774 (set_attr "prefix" "<mask_prefix3>")
1775 (set_attr "mode" "<MODE>")])
1777 (define_insn "<sse>_rcp<mode>2"
1778 [(set (match_operand:VF1_128_256 0 "register_operand" "=x")
1780 [(match_operand:VF1_128_256 1 "vector_operand" "xBm")] UNSPEC_RCP))]
1782 "%vrcpps\t{%1, %0|%0, %1}"
1783 [(set_attr "type" "sse")
1784 (set_attr "atom_sse_attr" "rcp")
1785 (set_attr "btver2_sse_attr" "rcp")
1786 (set_attr "prefix" "maybe_vex")
1787 (set_attr "mode" "<MODE>")])
1789 (define_insn "sse_vmrcpv4sf2"
1790 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
1792 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm,xm")]
1794 (match_operand:V4SF 2 "register_operand" "0,x")
1798 rcpss\t{%1, %0|%0, %k1}
1799 vrcpss\t{%1, %2, %0|%0, %2, %k1}"
1800 [(set_attr "isa" "noavx,avx")
1801 (set_attr "type" "sse")
1802 (set_attr "atom_sse_attr" "rcp")
1803 (set_attr "btver2_sse_attr" "rcp")
1804 (set_attr "prefix" "orig,vex")
1805 (set_attr "mode" "SF")])
1807 (define_insn "<mask_codefor>rcp14<mode><mask_name>"
1808 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
1810 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "vm")]
1813 "vrcp14<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
1814 [(set_attr "type" "sse")
1815 (set_attr "prefix" "evex")
1816 (set_attr "mode" "<MODE>")])
1818 (define_insn "srcp14<mode>"
1819 [(set (match_operand:VF_128 0 "register_operand" "=v")
1822 [(match_operand:VF_128 1 "nonimmediate_operand" "vm")]
1824 (match_operand:VF_128 2 "register_operand" "v")
1827 "vrcp14<ssescalarmodesuffix>\t{%1, %2, %0|%0, %2, %<iptr>1}"
1828 [(set_attr "type" "sse")
1829 (set_attr "prefix" "evex")
1830 (set_attr "mode" "<MODE>")])
1832 (define_insn "srcp14<mode>_mask"
1833 [(set (match_operand:VF_128 0 "register_operand" "=v")
1837 [(match_operand:VF_128 1 "nonimmediate_operand" "vm")]
1839 (match_operand:VF_128 3 "vector_move_operand" "0C")
1840 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk"))
1841 (match_operand:VF_128 2 "register_operand" "v")
1844 "vrcp14<ssescalarmodesuffix>\t{%1, %2, %0%{%4%}%N3|%0%{%4%}%N3, %2, %<iptr>1}"
1845 [(set_attr "type" "sse")
1846 (set_attr "prefix" "evex")
1847 (set_attr "mode" "<MODE>")])
1849 (define_expand "sqrt<mode>2"
1850 [(set (match_operand:VF2 0 "register_operand")
1851 (sqrt:VF2 (match_operand:VF2 1 "vector_operand")))]
1854 (define_expand "sqrt<mode>2"
1855 [(set (match_operand:VF1 0 "register_operand")
1856 (sqrt:VF1 (match_operand:VF1 1 "vector_operand")))]
1860 && TARGET_RECIP_VEC_SQRT
1861 && !optimize_insn_for_size_p ()
1862 && flag_finite_math_only && !flag_trapping_math
1863 && flag_unsafe_math_optimizations)
1865 ix86_emit_swsqrtsf (operands[0], operands[1], <MODE>mode, false);
1870 (define_insn "<sse>_sqrt<mode>2<mask_name><round_name>"
1871 [(set (match_operand:VF 0 "register_operand" "=x,v")
1872 (sqrt:VF (match_operand:VF 1 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
1873 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1875 sqrt<ssemodesuffix>\t{%1, %0|%0, %1}
1876 vsqrt<ssemodesuffix>\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
1877 [(set_attr "isa" "noavx,avx")
1878 (set_attr "type" "sse")
1879 (set_attr "atom_sse_attr" "sqrt")
1880 (set_attr "btver2_sse_attr" "sqrt")
1881 (set_attr "prefix" "maybe_vex")
1882 (set_attr "mode" "<MODE>")])
1884 (define_insn "<sse>_vmsqrt<mode>2<mask_scalar_name><round_scalar_name>"
1885 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
1888 (match_operand:VF_128 1 "vector_operand" "xBm,<round_scalar_constraint>"))
1889 (match_operand:VF_128 2 "register_operand" "0,v")
1893 sqrt<ssescalarmodesuffix>\t{%1, %0|%0, %<iptr>1}
1894 vsqrt<ssescalarmodesuffix>\t{<round_scalar_mask_op3>%1, %2, %0<mask_scalar_operand3>|%0<mask_scalar_operand3>, %2, %<iptr>1<round_scalar_mask_op3>}"
1895 [(set_attr "isa" "noavx,avx")
1896 (set_attr "type" "sse")
1897 (set_attr "atom_sse_attr" "sqrt")
1898 (set_attr "prefix" "<round_scalar_prefix>")
1899 (set_attr "btver2_sse_attr" "sqrt")
1900 (set_attr "mode" "<ssescalarmode>")])
1902 (define_expand "rsqrt<mode>2"
1903 [(set (match_operand:VF1_128_256 0 "register_operand")
1905 [(match_operand:VF1_128_256 1 "vector_operand")] UNSPEC_RSQRT))]
1908 ix86_emit_swsqrtsf (operands[0], operands[1], <MODE>mode, true);
1912 (define_expand "rsqrtv16sf2"
1913 [(set (match_operand:V16SF 0 "register_operand")
1915 [(match_operand:V16SF 1 "vector_operand")]
1917 "TARGET_SSE_MATH && TARGET_AVX512ER"
1919 ix86_emit_swsqrtsf (operands[0], operands[1], V16SFmode, true);
1923 (define_insn "<sse>_rsqrt<mode>2"
1924 [(set (match_operand:VF1_128_256 0 "register_operand" "=x")
1926 [(match_operand:VF1_128_256 1 "vector_operand" "xBm")] UNSPEC_RSQRT))]
1928 "%vrsqrtps\t{%1, %0|%0, %1}"
1929 [(set_attr "type" "sse")
1930 (set_attr "prefix" "maybe_vex")
1931 (set_attr "mode" "<MODE>")])
1933 (define_insn "<mask_codefor>rsqrt14<mode><mask_name>"
1934 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
1936 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "vm")]
1939 "vrsqrt14<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
1940 [(set_attr "type" "sse")
1941 (set_attr "prefix" "evex")
1942 (set_attr "mode" "<MODE>")])
1944 (define_insn "rsqrt14<mode>"
1945 [(set (match_operand:VF_128 0 "register_operand" "=v")
1948 [(match_operand:VF_128 1 "nonimmediate_operand" "vm")]
1950 (match_operand:VF_128 2 "register_operand" "v")
1953 "vrsqrt14<ssescalarmodesuffix>\t{%1, %2, %0|%0, %2, %<iptr>1}"
1954 [(set_attr "type" "sse")
1955 (set_attr "prefix" "evex")
1956 (set_attr "mode" "<MODE>")])
1958 (define_insn "rsqrt14_<mode>_mask"
1959 [(set (match_operand:VF_128 0 "register_operand" "=v")
1963 [(match_operand:VF_128 1 "nonimmediate_operand" "vm")]
1965 (match_operand:VF_128 3 "vector_move_operand" "0C")
1966 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk"))
1967 (match_operand:VF_128 2 "register_operand" "v")
1970 "vrsqrt14<ssescalarmodesuffix>\t{%1, %2, %0%{%4%}%N3|%0%{%4%}%N3, %2, %<iptr>1}"
1971 [(set_attr "type" "sse")
1972 (set_attr "prefix" "evex")
1973 (set_attr "mode" "<MODE>")])
1975 (define_insn "sse_vmrsqrtv4sf2"
1976 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
1978 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm,xm")]
1980 (match_operand:V4SF 2 "register_operand" "0,x")
1984 rsqrtss\t{%1, %0|%0, %k1}
1985 vrsqrtss\t{%1, %2, %0|%0, %2, %k1}"
1986 [(set_attr "isa" "noavx,avx")
1987 (set_attr "type" "sse")
1988 (set_attr "prefix" "orig,vex")
1989 (set_attr "mode" "SF")])
1991 (define_expand "<code><mode>3<mask_name><round_saeonly_name>"
1992 [(set (match_operand:VF 0 "register_operand")
1994 (match_operand:VF 1 "<round_saeonly_nimm_predicate>")
1995 (match_operand:VF 2 "<round_saeonly_nimm_predicate>")))]
1996 "TARGET_SSE && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
1998 if (!flag_finite_math_only || flag_signed_zeros)
2000 operands[1] = force_reg (<MODE>mode, operands[1]);
2001 emit_insn (gen_ieee_<maxmin_float><mode>3<mask_name><round_saeonly_name>
2002 (operands[0], operands[1], operands[2]
2003 <mask_operand_arg34>
2004 <round_saeonly_mask_arg3>));
2008 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
2011 ;; These versions of the min/max patterns are intentionally ignorant of
2012 ;; their behavior wrt -0.0 and NaN (via the commutative operand mark).
2013 ;; Since both the tree-level MAX_EXPR and the rtl-level SMAX operator
2014 ;; are undefined in this condition, we're certain this is correct.
2016 (define_insn "*<code><mode>3<mask_name><round_saeonly_name>"
2017 [(set (match_operand:VF 0 "register_operand" "=x,v")
2019 (match_operand:VF 1 "<round_saeonly_nimm_predicate>" "%0,v")
2020 (match_operand:VF 2 "<round_saeonly_nimm_predicate>" "xBm,<round_saeonly_constraint>")))]
2022 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
2023 && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
2025 <maxmin_float><ssemodesuffix>\t{%2, %0|%0, %2}
2026 v<maxmin_float><ssemodesuffix>\t{<round_saeonly_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_saeonly_mask_op3>}"
2027 [(set_attr "isa" "noavx,avx")
2028 (set_attr "type" "sseadd")
2029 (set_attr "btver2_sse_attr" "maxmin")
2030 (set_attr "prefix" "<mask_prefix3>")
2031 (set_attr "mode" "<MODE>")])
2033 ;; These versions of the min/max patterns implement exactly the operations
2034 ;; min = (op1 < op2 ? op1 : op2)
2035 ;; max = (!(op1 < op2) ? op1 : op2)
2036 ;; Their operands are not commutative, and thus they may be used in the
2037 ;; presence of -0.0 and NaN.
2039 (define_insn "ieee_<ieee_maxmin><mode>3<mask_name><round_saeonly_name>"
2040 [(set (match_operand:VF 0 "register_operand" "=x,v")
2042 [(match_operand:VF 1 "register_operand" "0,v")
2043 (match_operand:VF 2 "<round_saeonly_nimm_predicate>" "xBm,<round_saeonly_constraint>")]
2046 && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
2048 <ieee_maxmin><ssemodesuffix>\t{%2, %0|%0, %2}
2049 v<ieee_maxmin><ssemodesuffix>\t{<round_saeonly_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_saeonly_mask_op3>}"
2050 [(set_attr "isa" "noavx,avx")
2051 (set_attr "type" "sseadd")
2052 (set_attr "btver2_sse_attr" "maxmin")
2053 (set_attr "prefix" "<mask_prefix3>")
2054 (set_attr "mode" "<MODE>")])
2056 (define_insn "<sse>_vm<code><mode>3<mask_scalar_name><round_saeonly_scalar_name>"
2057 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
2060 (match_operand:VF_128 1 "register_operand" "0,v")
2061 (match_operand:VF_128 2 "vector_operand" "xBm,<round_saeonly_scalar_constraint>"))
2066 <maxmin_float><ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
2067 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>}"
2068 [(set_attr "isa" "noavx,avx")
2069 (set_attr "type" "sse")
2070 (set_attr "btver2_sse_attr" "maxmin")
2071 (set_attr "prefix" "<round_saeonly_scalar_prefix>")
2072 (set_attr "mode" "<ssescalarmode>")])
2074 (define_insn "avx_addsubv4df3"
2075 [(set (match_operand:V4DF 0 "register_operand" "=x")
2078 (match_operand:V4DF 1 "register_operand" "x")
2079 (match_operand:V4DF 2 "nonimmediate_operand" "xm"))
2080 (plus:V4DF (match_dup 1) (match_dup 2))
2083 "vaddsubpd\t{%2, %1, %0|%0, %1, %2}"
2084 [(set_attr "type" "sseadd")
2085 (set_attr "prefix" "vex")
2086 (set_attr "mode" "V4DF")])
2088 (define_insn "sse3_addsubv2df3"
2089 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
2092 (match_operand:V2DF 1 "register_operand" "0,x")
2093 (match_operand:V2DF 2 "vector_operand" "xBm,xm"))
2094 (plus:V2DF (match_dup 1) (match_dup 2))
2098 addsubpd\t{%2, %0|%0, %2}
2099 vaddsubpd\t{%2, %1, %0|%0, %1, %2}"
2100 [(set_attr "isa" "noavx,avx")
2101 (set_attr "type" "sseadd")
2102 (set_attr "atom_unit" "complex")
2103 (set_attr "prefix" "orig,vex")
2104 (set_attr "mode" "V2DF")])
2106 (define_insn "avx_addsubv8sf3"
2107 [(set (match_operand:V8SF 0 "register_operand" "=x")
2110 (match_operand:V8SF 1 "register_operand" "x")
2111 (match_operand:V8SF 2 "nonimmediate_operand" "xm"))
2112 (plus:V8SF (match_dup 1) (match_dup 2))
2115 "vaddsubps\t{%2, %1, %0|%0, %1, %2}"
2116 [(set_attr "type" "sseadd")
2117 (set_attr "prefix" "vex")
2118 (set_attr "mode" "V8SF")])
2120 (define_insn "sse3_addsubv4sf3"
2121 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
2124 (match_operand:V4SF 1 "register_operand" "0,x")
2125 (match_operand:V4SF 2 "vector_operand" "xBm,xm"))
2126 (plus:V4SF (match_dup 1) (match_dup 2))
2130 addsubps\t{%2, %0|%0, %2}
2131 vaddsubps\t{%2, %1, %0|%0, %1, %2}"
2132 [(set_attr "isa" "noavx,avx")
2133 (set_attr "type" "sseadd")
2134 (set_attr "prefix" "orig,vex")
2135 (set_attr "prefix_rep" "1,*")
2136 (set_attr "mode" "V4SF")])
2139 [(set (match_operand:VF_128_256 0 "register_operand")
2140 (match_operator:VF_128_256 6 "addsub_vm_operator"
2142 (match_operand:VF_128_256 1 "register_operand")
2143 (match_operand:VF_128_256 2 "vector_operand"))
2145 (match_operand:VF_128_256 3 "vector_operand")
2146 (match_operand:VF_128_256 4 "vector_operand"))
2147 (match_operand 5 "const_int_operand")]))]
2149 && can_create_pseudo_p ()
2150 && ((rtx_equal_p (operands[1], operands[3])
2151 && rtx_equal_p (operands[2], operands[4]))
2152 || (rtx_equal_p (operands[1], operands[4])
2153 && rtx_equal_p (operands[2], operands[3])))"
2155 (vec_merge:VF_128_256
2156 (minus:VF_128_256 (match_dup 1) (match_dup 2))
2157 (plus:VF_128_256 (match_dup 1) (match_dup 2))
2161 [(set (match_operand:VF_128_256 0 "register_operand")
2162 (match_operator:VF_128_256 6 "addsub_vm_operator"
2164 (match_operand:VF_128_256 1 "vector_operand")
2165 (match_operand:VF_128_256 2 "vector_operand"))
2167 (match_operand:VF_128_256 3 "register_operand")
2168 (match_operand:VF_128_256 4 "vector_operand"))
2169 (match_operand 5 "const_int_operand")]))]
2171 && can_create_pseudo_p ()
2172 && ((rtx_equal_p (operands[1], operands[3])
2173 && rtx_equal_p (operands[2], operands[4]))
2174 || (rtx_equal_p (operands[1], operands[4])
2175 && rtx_equal_p (operands[2], operands[3])))"
2177 (vec_merge:VF_128_256
2178 (minus:VF_128_256 (match_dup 3) (match_dup 4))
2179 (plus:VF_128_256 (match_dup 3) (match_dup 4))
2182 /* Negate mask bits to compensate for swapped PLUS and MINUS RTXes. */
2184 = GEN_INT (~INTVAL (operands[5])
2185 & ((HOST_WIDE_INT_1U << GET_MODE_NUNITS (<MODE>mode)) - 1));
2189 [(set (match_operand:VF_128_256 0 "register_operand")
2190 (match_operator:VF_128_256 7 "addsub_vs_operator"
2191 [(vec_concat:<ssedoublemode>
2193 (match_operand:VF_128_256 1 "register_operand")
2194 (match_operand:VF_128_256 2 "vector_operand"))
2196 (match_operand:VF_128_256 3 "vector_operand")
2197 (match_operand:VF_128_256 4 "vector_operand")))
2198 (match_parallel 5 "addsub_vs_parallel"
2199 [(match_operand 6 "const_int_operand")])]))]
2201 && can_create_pseudo_p ()
2202 && ((rtx_equal_p (operands[1], operands[3])
2203 && rtx_equal_p (operands[2], operands[4]))
2204 || (rtx_equal_p (operands[1], operands[4])
2205 && rtx_equal_p (operands[2], operands[3])))"
2207 (vec_merge:VF_128_256
2208 (minus:VF_128_256 (match_dup 1) (match_dup 2))
2209 (plus:VF_128_256 (match_dup 1) (match_dup 2))
2212 int i, nelt = XVECLEN (operands[5], 0);
2213 HOST_WIDE_INT ival = 0;
2215 for (i = 0; i < nelt; i++)
2216 if (INTVAL (XVECEXP (operands[5], 0, i)) < GET_MODE_NUNITS (<MODE>mode))
2217 ival |= HOST_WIDE_INT_1 << i;
2219 operands[5] = GEN_INT (ival);
2223 [(set (match_operand:VF_128_256 0 "register_operand")
2224 (match_operator:VF_128_256 7 "addsub_vs_operator"
2225 [(vec_concat:<ssedoublemode>
2227 (match_operand:VF_128_256 1 "vector_operand")
2228 (match_operand:VF_128_256 2 "vector_operand"))
2230 (match_operand:VF_128_256 3 "register_operand")
2231 (match_operand:VF_128_256 4 "vector_operand")))
2232 (match_parallel 5 "addsub_vs_parallel"
2233 [(match_operand 6 "const_int_operand")])]))]
2235 && can_create_pseudo_p ()
2236 && ((rtx_equal_p (operands[1], operands[3])
2237 && rtx_equal_p (operands[2], operands[4]))
2238 || (rtx_equal_p (operands[1], operands[4])
2239 && rtx_equal_p (operands[2], operands[3])))"
2241 (vec_merge:VF_128_256
2242 (minus:VF_128_256 (match_dup 3) (match_dup 4))
2243 (plus:VF_128_256 (match_dup 3) (match_dup 4))
2246 int i, nelt = XVECLEN (operands[5], 0);
2247 HOST_WIDE_INT ival = 0;
2249 for (i = 0; i < nelt; i++)
2250 if (INTVAL (XVECEXP (operands[5], 0, i)) >= GET_MODE_NUNITS (<MODE>mode))
2251 ival |= HOST_WIDE_INT_1 << i;
2253 operands[5] = GEN_INT (ival);
2256 (define_insn "avx_h<plusminus_insn>v4df3"
2257 [(set (match_operand:V4DF 0 "register_operand" "=x")
2262 (match_operand:V4DF 1 "register_operand" "x")
2263 (parallel [(const_int 0)]))
2264 (vec_select:DF (match_dup 1) (parallel [(const_int 1)])))
2267 (match_operand:V4DF 2 "nonimmediate_operand" "xm")
2268 (parallel [(const_int 0)]))
2269 (vec_select:DF (match_dup 2) (parallel [(const_int 1)]))))
2272 (vec_select:DF (match_dup 1) (parallel [(const_int 2)]))
2273 (vec_select:DF (match_dup 1) (parallel [(const_int 3)])))
2275 (vec_select:DF (match_dup 2) (parallel [(const_int 2)]))
2276 (vec_select:DF (match_dup 2) (parallel [(const_int 3)]))))))]
2278 "vh<plusminus_mnemonic>pd\t{%2, %1, %0|%0, %1, %2}"
2279 [(set_attr "type" "sseadd")
2280 (set_attr "prefix" "vex")
2281 (set_attr "mode" "V4DF")])
2283 (define_expand "sse3_haddv2df3"
2284 [(set (match_operand:V2DF 0 "register_operand")
2288 (match_operand:V2DF 1 "register_operand")
2289 (parallel [(const_int 0)]))
2290 (vec_select:DF (match_dup 1) (parallel [(const_int 1)])))
2293 (match_operand:V2DF 2 "vector_operand")
2294 (parallel [(const_int 0)]))
2295 (vec_select:DF (match_dup 2) (parallel [(const_int 1)])))))]
2298 (define_insn "*sse3_haddv2df3"
2299 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
2303 (match_operand:V2DF 1 "register_operand" "0,x")
2304 (parallel [(match_operand:SI 3 "const_0_to_1_operand")]))
2307 (parallel [(match_operand:SI 4 "const_0_to_1_operand")])))
2310 (match_operand:V2DF 2 "vector_operand" "xBm,xm")
2311 (parallel [(match_operand:SI 5 "const_0_to_1_operand")]))
2314 (parallel [(match_operand:SI 6 "const_0_to_1_operand")])))))]
2316 && INTVAL (operands[3]) != INTVAL (operands[4])
2317 && INTVAL (operands[5]) != INTVAL (operands[6])"
2319 haddpd\t{%2, %0|%0, %2}
2320 vhaddpd\t{%2, %1, %0|%0, %1, %2}"
2321 [(set_attr "isa" "noavx,avx")
2322 (set_attr "type" "sseadd")
2323 (set_attr "prefix" "orig,vex")
2324 (set_attr "mode" "V2DF")])
2326 (define_insn "sse3_hsubv2df3"
2327 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
2331 (match_operand:V2DF 1 "register_operand" "0,x")
2332 (parallel [(const_int 0)]))
2333 (vec_select:DF (match_dup 1) (parallel [(const_int 1)])))
2336 (match_operand:V2DF 2 "vector_operand" "xBm,xm")
2337 (parallel [(const_int 0)]))
2338 (vec_select:DF (match_dup 2) (parallel [(const_int 1)])))))]
2341 hsubpd\t{%2, %0|%0, %2}
2342 vhsubpd\t{%2, %1, %0|%0, %1, %2}"
2343 [(set_attr "isa" "noavx,avx")
2344 (set_attr "type" "sseadd")
2345 (set_attr "prefix" "orig,vex")
2346 (set_attr "mode" "V2DF")])
2348 (define_insn "*sse3_haddv2df3_low"
2349 [(set (match_operand:DF 0 "register_operand" "=x,x")
2352 (match_operand:V2DF 1 "register_operand" "0,x")
2353 (parallel [(match_operand:SI 2 "const_0_to_1_operand")]))
2356 (parallel [(match_operand:SI 3 "const_0_to_1_operand")]))))]
2358 && INTVAL (operands[2]) != INTVAL (operands[3])"
2360 haddpd\t{%0, %0|%0, %0}
2361 vhaddpd\t{%1, %1, %0|%0, %1, %1}"
2362 [(set_attr "isa" "noavx,avx")
2363 (set_attr "type" "sseadd1")
2364 (set_attr "prefix" "orig,vex")
2365 (set_attr "mode" "V2DF")])
2367 (define_insn "*sse3_hsubv2df3_low"
2368 [(set (match_operand:DF 0 "register_operand" "=x,x")
2371 (match_operand:V2DF 1 "register_operand" "0,x")
2372 (parallel [(const_int 0)]))
2375 (parallel [(const_int 1)]))))]
2378 hsubpd\t{%0, %0|%0, %0}
2379 vhsubpd\t{%1, %1, %0|%0, %1, %1}"
2380 [(set_attr "isa" "noavx,avx")
2381 (set_attr "type" "sseadd1")
2382 (set_attr "prefix" "orig,vex")
2383 (set_attr "mode" "V2DF")])
2385 (define_insn "avx_h<plusminus_insn>v8sf3"
2386 [(set (match_operand:V8SF 0 "register_operand" "=x")
2392 (match_operand:V8SF 1 "register_operand" "x")
2393 (parallel [(const_int 0)]))
2394 (vec_select:SF (match_dup 1) (parallel [(const_int 1)])))
2396 (vec_select:SF (match_dup 1) (parallel [(const_int 2)]))
2397 (vec_select:SF (match_dup 1) (parallel [(const_int 3)]))))
2401 (match_operand:V8SF 2 "nonimmediate_operand" "xm")
2402 (parallel [(const_int 0)]))
2403 (vec_select:SF (match_dup 2) (parallel [(const_int 1)])))
2405 (vec_select:SF (match_dup 2) (parallel [(const_int 2)]))
2406 (vec_select:SF (match_dup 2) (parallel [(const_int 3)])))))
2410 (vec_select:SF (match_dup 1) (parallel [(const_int 4)]))
2411 (vec_select:SF (match_dup 1) (parallel [(const_int 5)])))
2413 (vec_select:SF (match_dup 1) (parallel [(const_int 6)]))
2414 (vec_select:SF (match_dup 1) (parallel [(const_int 7)]))))
2417 (vec_select:SF (match_dup 2) (parallel [(const_int 4)]))
2418 (vec_select:SF (match_dup 2) (parallel [(const_int 5)])))
2420 (vec_select:SF (match_dup 2) (parallel [(const_int 6)]))
2421 (vec_select:SF (match_dup 2) (parallel [(const_int 7)])))))))]
2423 "vh<plusminus_mnemonic>ps\t{%2, %1, %0|%0, %1, %2}"
2424 [(set_attr "type" "sseadd")
2425 (set_attr "prefix" "vex")
2426 (set_attr "mode" "V8SF")])
2428 (define_insn "sse3_h<plusminus_insn>v4sf3"
2429 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
2434 (match_operand:V4SF 1 "register_operand" "0,x")
2435 (parallel [(const_int 0)]))
2436 (vec_select:SF (match_dup 1) (parallel [(const_int 1)])))
2438 (vec_select:SF (match_dup 1) (parallel [(const_int 2)]))
2439 (vec_select:SF (match_dup 1) (parallel [(const_int 3)]))))
2443 (match_operand:V4SF 2 "vector_operand" "xBm,xm")
2444 (parallel [(const_int 0)]))
2445 (vec_select:SF (match_dup 2) (parallel [(const_int 1)])))
2447 (vec_select:SF (match_dup 2) (parallel [(const_int 2)]))
2448 (vec_select:SF (match_dup 2) (parallel [(const_int 3)]))))))]
2451 h<plusminus_mnemonic>ps\t{%2, %0|%0, %2}
2452 vh<plusminus_mnemonic>ps\t{%2, %1, %0|%0, %1, %2}"
2453 [(set_attr "isa" "noavx,avx")
2454 (set_attr "type" "sseadd")
2455 (set_attr "atom_unit" "complex")
2456 (set_attr "prefix" "orig,vex")
2457 (set_attr "prefix_rep" "1,*")
2458 (set_attr "mode" "V4SF")])
2460 (define_expand "reduc_plus_scal_v8df"
2461 [(match_operand:DF 0 "register_operand")
2462 (match_operand:V8DF 1 "register_operand")]
2465 rtx tmp = gen_reg_rtx (V8DFmode);
2466 ix86_expand_reduc (gen_addv8df3, tmp, operands[1]);
2467 emit_insn (gen_vec_extractv8dfdf (operands[0], tmp, const0_rtx));
2471 (define_expand "reduc_plus_scal_v4df"
2472 [(match_operand:DF 0 "register_operand")
2473 (match_operand:V4DF 1 "register_operand")]
2476 rtx tmp = gen_reg_rtx (V2DFmode);
2477 emit_insn (gen_vec_extract_hi_v4df (tmp, operands[1]));
2478 rtx tmp2 = gen_reg_rtx (V2DFmode);
2479 emit_insn (gen_addv2df3 (tmp2, tmp, gen_lowpart (V2DFmode, operands[1])));
2480 rtx tmp3 = gen_reg_rtx (V2DFmode);
2481 emit_insn (gen_vec_interleave_highv2df (tmp3, tmp2, tmp2));
2482 emit_insn (gen_adddf3 (operands[0],
2483 gen_lowpart (DFmode, tmp2),
2484 gen_lowpart (DFmode, tmp3)));
2488 (define_expand "reduc_plus_scal_v2df"
2489 [(match_operand:DF 0 "register_operand")
2490 (match_operand:V2DF 1 "register_operand")]
2493 rtx tmp = gen_reg_rtx (V2DFmode);
2494 emit_insn (gen_vec_interleave_highv2df (tmp, operands[1], operands[1]));
2495 emit_insn (gen_adddf3 (operands[0],
2496 gen_lowpart (DFmode, tmp),
2497 gen_lowpart (DFmode, operands[1])));
2501 (define_expand "reduc_plus_scal_v16sf"
2502 [(match_operand:SF 0 "register_operand")
2503 (match_operand:V16SF 1 "register_operand")]
2506 rtx tmp = gen_reg_rtx (V16SFmode);
2507 ix86_expand_reduc (gen_addv16sf3, tmp, operands[1]);
2508 emit_insn (gen_vec_extractv16sfsf (operands[0], tmp, const0_rtx));
2512 (define_expand "reduc_plus_scal_v8sf"
2513 [(match_operand:SF 0 "register_operand")
2514 (match_operand:V8SF 1 "register_operand")]
2517 rtx tmp = gen_reg_rtx (V8SFmode);
2518 rtx tmp2 = gen_reg_rtx (V8SFmode);
2519 rtx vec_res = gen_reg_rtx (V8SFmode);
2520 emit_insn (gen_avx_haddv8sf3 (tmp, operands[1], operands[1]));
2521 emit_insn (gen_avx_haddv8sf3 (tmp2, tmp, tmp));
2522 emit_insn (gen_avx_vperm2f128v8sf3 (tmp, tmp2, tmp2, GEN_INT (1)));
2523 emit_insn (gen_addv8sf3 (vec_res, tmp, tmp2));
2524 emit_insn (gen_vec_extractv8sfsf (operands[0], vec_res, const0_rtx));
2528 (define_expand "reduc_plus_scal_v4sf"
2529 [(match_operand:SF 0 "register_operand")
2530 (match_operand:V4SF 1 "register_operand")]
2533 rtx vec_res = gen_reg_rtx (V4SFmode);
2536 rtx tmp = gen_reg_rtx (V4SFmode);
2537 emit_insn (gen_sse3_haddv4sf3 (tmp, operands[1], operands[1]));
2538 emit_insn (gen_sse3_haddv4sf3 (vec_res, tmp, tmp));
2541 ix86_expand_reduc (gen_addv4sf3, vec_res, operands[1]);
2542 emit_insn (gen_vec_extractv4sfsf (operands[0], vec_res, const0_rtx));
2546 ;; Modes handled by reduc_sm{in,ax}* patterns.
2547 (define_mode_iterator REDUC_SMINMAX_MODE
2548 [(V32QI "TARGET_AVX2") (V16HI "TARGET_AVX2")
2549 (V8SI "TARGET_AVX2") (V4DI "TARGET_AVX2")
2550 (V8SF "TARGET_AVX") (V4DF "TARGET_AVX")
2551 (V4SF "TARGET_SSE") (V64QI "TARGET_AVX512BW")
2552 (V32HI "TARGET_AVX512BW") (V16SI "TARGET_AVX512F")
2553 (V8DI "TARGET_AVX512F") (V16SF "TARGET_AVX512F")
2554 (V8DF "TARGET_AVX512F")])
2556 (define_expand "reduc_<code>_scal_<mode>"
2557 [(smaxmin:REDUC_SMINMAX_MODE
2558 (match_operand:<ssescalarmode> 0 "register_operand")
2559 (match_operand:REDUC_SMINMAX_MODE 1 "register_operand"))]
2562 rtx tmp = gen_reg_rtx (<MODE>mode);
2563 ix86_expand_reduc (gen_<code><mode>3, tmp, operands[1]);
2564 emit_insn (gen_vec_extract<mode><ssescalarmodelower> (operands[0], tmp,
2569 (define_expand "reduc_<code>_scal_<mode>"
2570 [(umaxmin:VI_AVX512BW
2571 (match_operand:<ssescalarmode> 0 "register_operand")
2572 (match_operand:VI_AVX512BW 1 "register_operand"))]
2575 rtx tmp = gen_reg_rtx (<MODE>mode);
2576 ix86_expand_reduc (gen_<code><mode>3, tmp, operands[1]);
2577 emit_insn (gen_vec_extract<mode><ssescalarmodelower> (operands[0], tmp,
2582 (define_expand "reduc_<code>_scal_<mode>"
2584 (match_operand:<ssescalarmode> 0 "register_operand")
2585 (match_operand:VI_256 1 "register_operand"))]
2588 rtx tmp = gen_reg_rtx (<MODE>mode);
2589 ix86_expand_reduc (gen_<code><mode>3, tmp, operands[1]);
2590 emit_insn (gen_vec_extract<mode><ssescalarmodelower> (operands[0], tmp,
2595 (define_expand "reduc_umin_scal_v8hi"
2597 (match_operand:HI 0 "register_operand")
2598 (match_operand:V8HI 1 "register_operand"))]
2601 rtx tmp = gen_reg_rtx (V8HImode);
2602 ix86_expand_reduc (gen_uminv8hi3, tmp, operands[1]);
2603 emit_insn (gen_vec_extractv8hihi (operands[0], tmp, const0_rtx));
2607 (define_insn "<mask_codefor>reducep<mode><mask_name>"
2608 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
2610 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "vm")
2611 (match_operand:SI 2 "const_0_to_255_operand")]
2614 "vreduce<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
2615 [(set_attr "type" "sse")
2616 (set_attr "prefix" "evex")
2617 (set_attr "mode" "<MODE>")])
2619 (define_insn "reduces<mode><mask_scalar_name>"
2620 [(set (match_operand:VF_128 0 "register_operand" "=v")
2623 [(match_operand:VF_128 1 "register_operand" "v")
2624 (match_operand:VF_128 2 "nonimmediate_operand" "vm")
2625 (match_operand:SI 3 "const_0_to_255_operand")]
2630 "vreduce<ssescalarmodesuffix>\t{%3, %2, %1, %0<mask_scalar_operand4>|%0<mask_scalar_operand4>, %1, %<iptr>2, %3}"
2631 [(set_attr "type" "sse")
2632 (set_attr "prefix" "evex")
2633 (set_attr "mode" "<MODE>")])
2635 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2637 ;; Parallel floating point comparisons
2639 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2641 (define_insn "avx_cmp<mode>3"
2642 [(set (match_operand:VF_128_256 0 "register_operand" "=x")
2644 [(match_operand:VF_128_256 1 "register_operand" "x")
2645 (match_operand:VF_128_256 2 "nonimmediate_operand" "xm")
2646 (match_operand:SI 3 "const_0_to_31_operand" "n")]
2649 "vcmp<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
2650 [(set_attr "type" "ssecmp")
2651 (set_attr "length_immediate" "1")
2652 (set_attr "prefix" "vex")
2653 (set_attr "mode" "<MODE>")])
2655 (define_insn "avx_vmcmp<mode>3"
2656 [(set (match_operand:VF_128 0 "register_operand" "=x")
2659 [(match_operand:VF_128 1 "register_operand" "x")
2660 (match_operand:VF_128 2 "nonimmediate_operand" "xm")
2661 (match_operand:SI 3 "const_0_to_31_operand" "n")]
2666 "vcmp<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %3}"
2667 [(set_attr "type" "ssecmp")
2668 (set_attr "length_immediate" "1")
2669 (set_attr "prefix" "vex")
2670 (set_attr "mode" "<ssescalarmode>")])
2672 (define_insn "*<sse>_maskcmp<mode>3_comm"
2673 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x")
2674 (match_operator:VF_128_256 3 "sse_comparison_operator"
2675 [(match_operand:VF_128_256 1 "register_operand" "%0,x")
2676 (match_operand:VF_128_256 2 "vector_operand" "xBm,xm")]))]
2678 && GET_RTX_CLASS (GET_CODE (operands[3])) == RTX_COMM_COMPARE"
2680 cmp%D3<ssemodesuffix>\t{%2, %0|%0, %2}
2681 vcmp%D3<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
2682 [(set_attr "isa" "noavx,avx")
2683 (set_attr "type" "ssecmp")
2684 (set_attr "length_immediate" "1")
2685 (set_attr "prefix" "orig,vex")
2686 (set_attr "mode" "<MODE>")])
2688 (define_insn "<sse>_maskcmp<mode>3"
2689 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x")
2690 (match_operator:VF_128_256 3 "sse_comparison_operator"
2691 [(match_operand:VF_128_256 1 "register_operand" "0,x")
2692 (match_operand:VF_128_256 2 "vector_operand" "xBm,xm")]))]
2695 cmp%D3<ssemodesuffix>\t{%2, %0|%0, %2}
2696 vcmp%D3<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
2697 [(set_attr "isa" "noavx,avx")
2698 (set_attr "type" "ssecmp")
2699 (set_attr "length_immediate" "1")
2700 (set_attr "prefix" "orig,vex")
2701 (set_attr "mode" "<MODE>")])
2703 (define_insn "<sse>_vmmaskcmp<mode>3"
2704 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
2706 (match_operator:VF_128 3 "sse_comparison_operator"
2707 [(match_operand:VF_128 1 "register_operand" "0,x")
2708 (match_operand:VF_128 2 "vector_operand" "xBm,xm")])
2713 cmp%D3<ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
2714 vcmp%D3<ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %<iptr>2}"
2715 [(set_attr "isa" "noavx,avx")
2716 (set_attr "type" "ssecmp")
2717 (set_attr "length_immediate" "1,*")
2718 (set_attr "prefix" "orig,vex")
2719 (set_attr "mode" "<ssescalarmode>")])
2721 (define_mode_attr cmp_imm_predicate
2722 [(V16SF "const_0_to_31_operand") (V8DF "const_0_to_31_operand")
2723 (V16SI "const_0_to_7_operand") (V8DI "const_0_to_7_operand")
2724 (V8SF "const_0_to_31_operand") (V4DF "const_0_to_31_operand")
2725 (V8SI "const_0_to_7_operand") (V4DI "const_0_to_7_operand")
2726 (V4SF "const_0_to_31_operand") (V2DF "const_0_to_31_operand")
2727 (V4SI "const_0_to_7_operand") (V2DI "const_0_to_7_operand")
2728 (V32HI "const_0_to_7_operand") (V64QI "const_0_to_7_operand")
2729 (V16HI "const_0_to_7_operand") (V32QI "const_0_to_7_operand")
2730 (V8HI "const_0_to_7_operand") (V16QI "const_0_to_7_operand")])
2732 (define_insn "<avx512>_cmp<mode>3<mask_scalar_merge_name><round_saeonly_name>"
2733 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2734 (unspec:<avx512fmaskmode>
2735 [(match_operand:V48_AVX512VL 1 "register_operand" "v")
2736 (match_operand:V48_AVX512VL 2 "nonimmediate_operand" "<round_saeonly_constraint>")
2737 (match_operand:SI 3 "<cmp_imm_predicate>" "n")]
2739 "TARGET_AVX512F && <round_saeonly_mode512bit_condition>"
2740 "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}"
2741 [(set_attr "type" "ssecmp")
2742 (set_attr "length_immediate" "1")
2743 (set_attr "prefix" "evex")
2744 (set_attr "mode" "<sseinsnmode>")])
2746 (define_insn "<avx512>_cmp<mode>3<mask_scalar_merge_name>"
2747 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2748 (unspec:<avx512fmaskmode>
2749 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
2750 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")
2751 (match_operand:SI 3 "<cmp_imm_predicate>" "n")]
2754 "vpcmp<ssemodesuffix>\t{%3, %2, %1, %0<mask_scalar_merge_operand4>|%0<mask_scalar_merge_operand4>, %1, %2, %3}"
2755 [(set_attr "type" "ssecmp")
2756 (set_attr "length_immediate" "1")
2757 (set_attr "prefix" "evex")
2758 (set_attr "mode" "<sseinsnmode>")])
2760 (define_insn "<avx512>_ucmp<mode>3<mask_scalar_merge_name>"
2761 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2762 (unspec:<avx512fmaskmode>
2763 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
2764 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")
2765 (match_operand:SI 3 "const_0_to_7_operand" "n")]
2766 UNSPEC_UNSIGNED_PCMP))]
2768 "vpcmpu<ssemodesuffix>\t{%3, %2, %1, %0<mask_scalar_merge_operand4>|%0<mask_scalar_merge_operand4>, %1, %2, %3}"
2769 [(set_attr "type" "ssecmp")
2770 (set_attr "length_immediate" "1")
2771 (set_attr "prefix" "evex")
2772 (set_attr "mode" "<sseinsnmode>")])
2774 (define_insn "<avx512>_ucmp<mode>3<mask_scalar_merge_name>"
2775 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2776 (unspec:<avx512fmaskmode>
2777 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
2778 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")
2779 (match_operand:SI 3 "const_0_to_7_operand" "n")]
2780 UNSPEC_UNSIGNED_PCMP))]
2782 "vpcmpu<ssemodesuffix>\t{%3, %2, %1, %0<mask_scalar_merge_operand4>|%0<mask_scalar_merge_operand4>, %1, %2, %3}"
2783 [(set_attr "type" "ssecmp")
2784 (set_attr "length_immediate" "1")
2785 (set_attr "prefix" "evex")
2786 (set_attr "mode" "<sseinsnmode>")])
2788 (define_insn "avx512f_vmcmp<mode>3<round_saeonly_name>"
2789 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2790 (and:<avx512fmaskmode>
2791 (unspec:<avx512fmaskmode>
2792 [(match_operand:VF_128 1 "register_operand" "v")
2793 (match_operand:VF_128 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
2794 (match_operand:SI 3 "const_0_to_31_operand" "n")]
2798 "vcmp<ssescalarmodesuffix>\t{%3, <round_saeonly_op4>%2, %1, %0|%0, %1, %<iptr>2<round_saeonly_op4>, %3}"
2799 [(set_attr "type" "ssecmp")
2800 (set_attr "length_immediate" "1")
2801 (set_attr "prefix" "evex")
2802 (set_attr "mode" "<ssescalarmode>")])
2804 (define_insn "avx512f_vmcmp<mode>3_mask<round_saeonly_name>"
2805 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2806 (and:<avx512fmaskmode>
2807 (unspec:<avx512fmaskmode>
2808 [(match_operand:VF_128 1 "register_operand" "v")
2809 (match_operand:VF_128 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
2810 (match_operand:SI 3 "const_0_to_31_operand" "n")]
2812 (and:<avx512fmaskmode>
2813 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")
2816 "vcmp<ssescalarmodesuffix>\t{%3, <round_saeonly_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %<iptr>2<round_saeonly_op5>, %3}"
2817 [(set_attr "type" "ssecmp")
2818 (set_attr "length_immediate" "1")
2819 (set_attr "prefix" "evex")
2820 (set_attr "mode" "<ssescalarmode>")])
2822 (define_insn "avx512f_maskcmp<mode>3"
2823 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2824 (match_operator:<avx512fmaskmode> 3 "sse_comparison_operator"
2825 [(match_operand:VF 1 "register_operand" "v")
2826 (match_operand:VF 2 "nonimmediate_operand" "vm")]))]
2828 "vcmp%D3<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
2829 [(set_attr "type" "ssecmp")
2830 (set_attr "length_immediate" "1")
2831 (set_attr "prefix" "evex")
2832 (set_attr "mode" "<sseinsnmode>")])
2834 (define_insn "<sse>_<unord>comi<round_saeonly_name>"
2835 [(set (reg:CCFP FLAGS_REG)
2838 (match_operand:<ssevecmode> 0 "register_operand" "v")
2839 (parallel [(const_int 0)]))
2841 (match_operand:<ssevecmode> 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
2842 (parallel [(const_int 0)]))))]
2843 "SSE_FLOAT_MODE_P (<MODE>mode)"
2844 "%v<unord>comi<ssemodesuffix>\t{<round_saeonly_op2>%1, %0|%0, %<iptr>1<round_saeonly_op2>}"
2845 [(set_attr "type" "ssecomi")
2846 (set_attr "prefix" "maybe_vex")
2847 (set_attr "prefix_rep" "0")
2848 (set (attr "prefix_data16")
2849 (if_then_else (eq_attr "mode" "DF")
2851 (const_string "0")))
2852 (set_attr "mode" "<MODE>")])
2854 (define_expand "vec_cmp<mode><avx512fmaskmodelower>"
2855 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
2856 (match_operator:<avx512fmaskmode> 1 ""
2857 [(match_operand:V48_AVX512VL 2 "register_operand")
2858 (match_operand:V48_AVX512VL 3 "nonimmediate_operand")]))]
2861 bool ok = ix86_expand_mask_vec_cmp (operands);
2866 (define_expand "vec_cmp<mode><avx512fmaskmodelower>"
2867 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
2868 (match_operator:<avx512fmaskmode> 1 ""
2869 [(match_operand:VI12_AVX512VL 2 "register_operand")
2870 (match_operand:VI12_AVX512VL 3 "nonimmediate_operand")]))]
2873 bool ok = ix86_expand_mask_vec_cmp (operands);
2878 (define_expand "vec_cmp<mode><sseintvecmodelower>"
2879 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2880 (match_operator:<sseintvecmode> 1 ""
2881 [(match_operand:VI_256 2 "register_operand")
2882 (match_operand:VI_256 3 "nonimmediate_operand")]))]
2885 bool ok = ix86_expand_int_vec_cmp (operands);
2890 (define_expand "vec_cmp<mode><sseintvecmodelower>"
2891 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2892 (match_operator:<sseintvecmode> 1 ""
2893 [(match_operand:VI124_128 2 "register_operand")
2894 (match_operand:VI124_128 3 "vector_operand")]))]
2897 bool ok = ix86_expand_int_vec_cmp (operands);
2902 (define_expand "vec_cmpv2div2di"
2903 [(set (match_operand:V2DI 0 "register_operand")
2904 (match_operator:V2DI 1 ""
2905 [(match_operand:V2DI 2 "register_operand")
2906 (match_operand:V2DI 3 "vector_operand")]))]
2909 bool ok = ix86_expand_int_vec_cmp (operands);
2914 (define_expand "vec_cmp<mode><sseintvecmodelower>"
2915 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2916 (match_operator:<sseintvecmode> 1 ""
2917 [(match_operand:VF_256 2 "register_operand")
2918 (match_operand:VF_256 3 "nonimmediate_operand")]))]
2921 bool ok = ix86_expand_fp_vec_cmp (operands);
2926 (define_expand "vec_cmp<mode><sseintvecmodelower>"
2927 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2928 (match_operator:<sseintvecmode> 1 ""
2929 [(match_operand:VF_128 2 "register_operand")
2930 (match_operand:VF_128 3 "vector_operand")]))]
2933 bool ok = ix86_expand_fp_vec_cmp (operands);
2938 (define_expand "vec_cmpu<mode><avx512fmaskmodelower>"
2939 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
2940 (match_operator:<avx512fmaskmode> 1 ""
2941 [(match_operand:VI48_AVX512VL 2 "register_operand")
2942 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand")]))]
2945 bool ok = ix86_expand_mask_vec_cmp (operands);
2950 (define_expand "vec_cmpu<mode><avx512fmaskmodelower>"
2951 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
2952 (match_operator:<avx512fmaskmode> 1 ""
2953 [(match_operand:VI12_AVX512VL 2 "register_operand")
2954 (match_operand:VI12_AVX512VL 3 "nonimmediate_operand")]))]
2957 bool ok = ix86_expand_mask_vec_cmp (operands);
2962 (define_expand "vec_cmpu<mode><sseintvecmodelower>"
2963 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2964 (match_operator:<sseintvecmode> 1 ""
2965 [(match_operand:VI_256 2 "register_operand")
2966 (match_operand:VI_256 3 "nonimmediate_operand")]))]
2969 bool ok = ix86_expand_int_vec_cmp (operands);
2974 (define_expand "vec_cmpu<mode><sseintvecmodelower>"
2975 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2976 (match_operator:<sseintvecmode> 1 ""
2977 [(match_operand:VI124_128 2 "register_operand")
2978 (match_operand:VI124_128 3 "vector_operand")]))]
2981 bool ok = ix86_expand_int_vec_cmp (operands);
2986 (define_expand "vec_cmpuv2div2di"
2987 [(set (match_operand:V2DI 0 "register_operand")
2988 (match_operator:V2DI 1 ""
2989 [(match_operand:V2DI 2 "register_operand")
2990 (match_operand:V2DI 3 "vector_operand")]))]
2993 bool ok = ix86_expand_int_vec_cmp (operands);
2998 (define_expand "vec_cmpeqv2div2di"
2999 [(set (match_operand:V2DI 0 "register_operand")
3000 (match_operator:V2DI 1 ""
3001 [(match_operand:V2DI 2 "register_operand")
3002 (match_operand:V2DI 3 "vector_operand")]))]
3005 bool ok = ix86_expand_int_vec_cmp (operands);
3010 (define_expand "vcond<V_512:mode><VF_512:mode>"
3011 [(set (match_operand:V_512 0 "register_operand")
3013 (match_operator 3 ""
3014 [(match_operand:VF_512 4 "nonimmediate_operand")
3015 (match_operand:VF_512 5 "nonimmediate_operand")])
3016 (match_operand:V_512 1 "general_operand")
3017 (match_operand:V_512 2 "general_operand")))]
3019 && (GET_MODE_NUNITS (<V_512:MODE>mode)
3020 == GET_MODE_NUNITS (<VF_512:MODE>mode))"
3022 bool ok = ix86_expand_fp_vcond (operands);
3027 (define_expand "vcond<V_256:mode><VF_256:mode>"
3028 [(set (match_operand:V_256 0 "register_operand")
3030 (match_operator 3 ""
3031 [(match_operand:VF_256 4 "nonimmediate_operand")
3032 (match_operand:VF_256 5 "nonimmediate_operand")])
3033 (match_operand:V_256 1 "general_operand")
3034 (match_operand:V_256 2 "general_operand")))]
3036 && (GET_MODE_NUNITS (<V_256:MODE>mode)
3037 == GET_MODE_NUNITS (<VF_256:MODE>mode))"
3039 bool ok = ix86_expand_fp_vcond (operands);
3044 (define_expand "vcond<V_128:mode><VF_128:mode>"
3045 [(set (match_operand:V_128 0 "register_operand")
3047 (match_operator 3 ""
3048 [(match_operand:VF_128 4 "vector_operand")
3049 (match_operand:VF_128 5 "vector_operand")])
3050 (match_operand:V_128 1 "general_operand")
3051 (match_operand:V_128 2 "general_operand")))]
3053 && (GET_MODE_NUNITS (<V_128:MODE>mode)
3054 == GET_MODE_NUNITS (<VF_128:MODE>mode))"
3056 bool ok = ix86_expand_fp_vcond (operands);
3061 (define_expand "vcond_mask_<mode><avx512fmaskmodelower>"
3062 [(set (match_operand:V48_AVX512VL 0 "register_operand")
3063 (vec_merge:V48_AVX512VL
3064 (match_operand:V48_AVX512VL 1 "nonimmediate_operand")
3065 (match_operand:V48_AVX512VL 2 "vector_move_operand")
3066 (match_operand:<avx512fmaskmode> 3 "register_operand")))]
3069 (define_expand "vcond_mask_<mode><avx512fmaskmodelower>"
3070 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
3071 (vec_merge:VI12_AVX512VL
3072 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand")
3073 (match_operand:VI12_AVX512VL 2 "vector_move_operand")
3074 (match_operand:<avx512fmaskmode> 3 "register_operand")))]
3077 (define_expand "vcond_mask_<mode><sseintvecmodelower>"
3078 [(set (match_operand:VI_256 0 "register_operand")
3080 (match_operand:VI_256 1 "nonimmediate_operand")
3081 (match_operand:VI_256 2 "vector_move_operand")
3082 (match_operand:<sseintvecmode> 3 "register_operand")))]
3085 ix86_expand_sse_movcc (operands[0], operands[3],
3086 operands[1], operands[2]);
3090 (define_expand "vcond_mask_<mode><sseintvecmodelower>"
3091 [(set (match_operand:VI124_128 0 "register_operand")
3092 (vec_merge:VI124_128
3093 (match_operand:VI124_128 1 "vector_operand")
3094 (match_operand:VI124_128 2 "vector_move_operand")
3095 (match_operand:<sseintvecmode> 3 "register_operand")))]
3098 ix86_expand_sse_movcc (operands[0], operands[3],
3099 operands[1], operands[2]);
3103 (define_expand "vcond_mask_v2div2di"
3104 [(set (match_operand:V2DI 0 "register_operand")
3106 (match_operand:V2DI 1 "vector_operand")
3107 (match_operand:V2DI 2 "vector_move_operand")
3108 (match_operand:V2DI 3 "register_operand")))]
3111 ix86_expand_sse_movcc (operands[0], operands[3],
3112 operands[1], operands[2]);
3116 (define_expand "vcond_mask_<mode><sseintvecmodelower>"
3117 [(set (match_operand:VF_256 0 "register_operand")
3119 (match_operand:VF_256 1 "nonimmediate_operand")
3120 (match_operand:VF_256 2 "vector_move_operand")
3121 (match_operand:<sseintvecmode> 3 "register_operand")))]
3124 ix86_expand_sse_movcc (operands[0], operands[3],
3125 operands[1], operands[2]);
3129 (define_expand "vcond_mask_<mode><sseintvecmodelower>"
3130 [(set (match_operand:VF_128 0 "register_operand")
3132 (match_operand:VF_128 1 "vector_operand")
3133 (match_operand:VF_128 2 "vector_move_operand")
3134 (match_operand:<sseintvecmode> 3 "register_operand")))]
3137 ix86_expand_sse_movcc (operands[0], operands[3],
3138 operands[1], operands[2]);
3142 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3144 ;; Parallel floating point logical operations
3146 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3148 (define_insn "<sse>_andnot<mode>3<mask_name>"
3149 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x,v,v")
3152 (match_operand:VF_128_256 1 "register_operand" "0,x,v,v"))
3153 (match_operand:VF_128_256 2 "vector_operand" "xBm,xm,vm,vm")))]
3154 "TARGET_SSE && <mask_avx512vl_condition>"
3156 static char buf[128];
3160 switch (which_alternative)
3163 ops = "andn%s\t{%%2, %%0|%%0, %%2}";
3168 ops = "vandn%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
3174 switch (get_attr_mode (insn))
3182 /* There is no vandnp[sd] in avx512f. Use vpandn[qd]. */
3183 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
3184 ops = "vpandn%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
3187 suffix = "<ssemodesuffix>";
3190 snprintf (buf, sizeof (buf), ops, suffix);
3193 [(set_attr "isa" "noavx,avx,avx512dq,avx512f")
3194 (set_attr "type" "sselog")
3195 (set_attr "prefix" "orig,maybe_vex,evex,evex")
3197 (cond [(and (match_test "<mask_applied>")
3198 (and (eq_attr "alternative" "1")
3199 (match_test "!TARGET_AVX512DQ")))
3200 (const_string "<sseintvecmode2>")
3201 (eq_attr "alternative" "3")
3202 (const_string "<sseintvecmode2>")
3203 (and (match_test "<MODE_SIZE> == 16")
3204 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
3205 (const_string "<ssePSmode>")
3206 (match_test "TARGET_AVX")
3207 (const_string "<MODE>")
3208 (match_test "optimize_function_for_size_p (cfun)")
3209 (const_string "V4SF")
3211 (const_string "<MODE>")))])
3214 (define_insn "<sse>_andnot<mode>3<mask_name>"
3215 [(set (match_operand:VF_512 0 "register_operand" "=v")
3218 (match_operand:VF_512 1 "register_operand" "v"))
3219 (match_operand:VF_512 2 "nonimmediate_operand" "vm")))]
3222 static char buf[128];
3226 suffix = "<ssemodesuffix>";
3229 /* There is no vandnp[sd] in avx512f. Use vpandn[qd]. */
3230 if (!TARGET_AVX512DQ)
3232 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
3236 snprintf (buf, sizeof (buf),
3237 "v%sandn%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}",
3241 [(set_attr "type" "sselog")
3242 (set_attr "prefix" "evex")
3244 (if_then_else (match_test "TARGET_AVX512DQ")
3245 (const_string "<sseinsnmode>")
3246 (const_string "XI")))])
3248 (define_expand "<code><mode>3<mask_name>"
3249 [(set (match_operand:VF_128_256 0 "register_operand")
3250 (any_logic:VF_128_256
3251 (match_operand:VF_128_256 1 "vector_operand")
3252 (match_operand:VF_128_256 2 "vector_operand")))]
3253 "TARGET_SSE && <mask_avx512vl_condition>"
3254 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
3256 (define_expand "<code><mode>3<mask_name>"
3257 [(set (match_operand:VF_512 0 "register_operand")
3259 (match_operand:VF_512 1 "nonimmediate_operand")
3260 (match_operand:VF_512 2 "nonimmediate_operand")))]
3262 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
3264 (define_insn "*<code><mode>3<mask_name>"
3265 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x,v,v")
3266 (any_logic:VF_128_256
3267 (match_operand:VF_128_256 1 "vector_operand" "%0,x,v,v")
3268 (match_operand:VF_128_256 2 "vector_operand" "xBm,xm,vm,vm")))]
3269 "TARGET_SSE && <mask_avx512vl_condition>
3270 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
3272 static char buf[128];
3276 switch (which_alternative)
3279 ops = "<logic>%s\t{%%2, %%0|%%0, %%2}";
3284 ops = "v<logic>%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
3290 switch (get_attr_mode (insn))
3298 /* There is no v<logic>p[sd] in avx512f. Use vp<logic>[qd]. */
3299 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
3300 ops = "vp<logic>%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
3303 suffix = "<ssemodesuffix>";
3306 snprintf (buf, sizeof (buf), ops, suffix);
3309 [(set_attr "isa" "noavx,avx,avx512dq,avx512f")
3310 (set_attr "type" "sselog")
3311 (set_attr "prefix" "orig,maybe_evex,evex,evex")
3313 (cond [(and (match_test "<mask_applied>")
3314 (and (eq_attr "alternative" "1")
3315 (match_test "!TARGET_AVX512DQ")))
3316 (const_string "<sseintvecmode2>")
3317 (eq_attr "alternative" "3")
3318 (const_string "<sseintvecmode2>")
3319 (and (match_test "<MODE_SIZE> == 16")
3320 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
3321 (const_string "<ssePSmode>")
3322 (match_test "TARGET_AVX")
3323 (const_string "<MODE>")
3324 (match_test "optimize_function_for_size_p (cfun)")
3325 (const_string "V4SF")
3327 (const_string "<MODE>")))])
3329 (define_insn "*<code><mode>3<mask_name>"
3330 [(set (match_operand:VF_512 0 "register_operand" "=v")
3332 (match_operand:VF_512 1 "nonimmediate_operand" "%v")
3333 (match_operand:VF_512 2 "nonimmediate_operand" "vm")))]
3334 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
3336 static char buf[128];
3340 suffix = "<ssemodesuffix>";
3343 /* There is no v<logic>p[sd] in avx512f. Use vp<logic>[dq]. */
3344 if (!TARGET_AVX512DQ)
3346 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
3350 snprintf (buf, sizeof (buf),
3351 "v%s<logic>%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}",
3355 [(set_attr "type" "sselog")
3356 (set_attr "prefix" "evex")
3358 (if_then_else (match_test "TARGET_AVX512DQ")
3359 (const_string "<sseinsnmode>")
3360 (const_string "XI")))])
3362 (define_expand "copysign<mode>3"
3365 (not:VF (match_dup 3))
3366 (match_operand:VF 1 "vector_operand")))
3368 (and:VF (match_dup 3)
3369 (match_operand:VF 2 "vector_operand")))
3370 (set (match_operand:VF 0 "register_operand")
3371 (ior:VF (match_dup 4) (match_dup 5)))]
3374 operands[3] = ix86_build_signbit_mask (<MODE>mode, 1, 0);
3376 operands[4] = gen_reg_rtx (<MODE>mode);
3377 operands[5] = gen_reg_rtx (<MODE>mode);
3380 ;; Also define scalar versions. These are used for abs, neg, and
3381 ;; conditional move. Using subregs into vector modes causes register
3382 ;; allocation lossage. These patterns do not allow memory operands
3383 ;; because the native instructions read the full 128-bits.
3385 (define_insn "*andnot<mode>3"
3386 [(set (match_operand:MODEF 0 "register_operand" "=x,x,v,v")
3389 (match_operand:MODEF 1 "register_operand" "0,x,v,v"))
3390 (match_operand:MODEF 2 "register_operand" "x,x,v,v")))]
3391 "SSE_FLOAT_MODE_P (<MODE>mode)"
3393 static char buf[128];
3396 = (get_attr_mode (insn) == MODE_V4SF) ? "ps" : "<ssevecmodesuffix>";
3398 switch (which_alternative)
3401 ops = "andn%s\t{%%2, %%0|%%0, %%2}";
3404 ops = "vandn%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3407 if (TARGET_AVX512DQ)
3408 ops = "vandn%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3411 suffix = <MODE>mode == DFmode ? "q" : "d";
3412 ops = "vpandn%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3416 if (TARGET_AVX512DQ)
3417 ops = "vandn%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3420 suffix = <MODE>mode == DFmode ? "q" : "d";
3421 ops = "vpandn%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3428 snprintf (buf, sizeof (buf), ops, suffix);
3431 [(set_attr "isa" "noavx,avx,avx512vl,avx512f")
3432 (set_attr "type" "sselog")
3433 (set_attr "prefix" "orig,vex,evex,evex")
3435 (cond [(eq_attr "alternative" "2")
3436 (if_then_else (match_test "TARGET_AVX512DQ")
3437 (const_string "<ssevecmode>")
3438 (const_string "TI"))
3439 (eq_attr "alternative" "3")
3440 (if_then_else (match_test "TARGET_AVX512DQ")
3441 (const_string "<avx512fvecmode>")
3442 (const_string "XI"))
3443 (and (match_test "<MODE_SIZE> == 16")
3444 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
3445 (const_string "V4SF")
3446 (match_test "TARGET_AVX")
3447 (const_string "<ssevecmode>")
3448 (match_test "optimize_function_for_size_p (cfun)")
3449 (const_string "V4SF")
3451 (const_string "<ssevecmode>")))])
3453 (define_insn "*andnottf3"
3454 [(set (match_operand:TF 0 "register_operand" "=x,x,v,v")
3456 (not:TF (match_operand:TF 1 "register_operand" "0,x,v,v"))
3457 (match_operand:TF 2 "vector_operand" "xBm,xm,vm,v")))]
3460 static char buf[128];
3463 = (which_alternative >= 2 ? "pandnq"
3464 : get_attr_mode (insn) == MODE_V4SF ? "andnps" : "pandn");
3466 switch (which_alternative)
3469 ops = "%s\t{%%2, %%0|%%0, %%2}";
3473 ops = "v%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3476 ops = "v%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3482 snprintf (buf, sizeof (buf), ops, tmp);
3485 [(set_attr "isa" "noavx,avx,avx512vl,avx512f")
3486 (set_attr "type" "sselog")
3487 (set (attr "prefix_data16")
3489 (and (eq_attr "alternative" "0")
3490 (eq_attr "mode" "TI"))
3492 (const_string "*")))
3493 (set_attr "prefix" "orig,vex,evex,evex")
3495 (cond [(eq_attr "alternative" "2")
3497 (eq_attr "alternative" "3")
3499 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
3500 (const_string "V4SF")
3501 (match_test "TARGET_AVX")
3503 (ior (not (match_test "TARGET_SSE2"))
3504 (match_test "optimize_function_for_size_p (cfun)"))
3505 (const_string "V4SF")
3507 (const_string "TI")))])
3509 (define_insn "*<code><mode>3"
3510 [(set (match_operand:MODEF 0 "register_operand" "=x,x,v,v")
3512 (match_operand:MODEF 1 "register_operand" "%0,x,v,v")
3513 (match_operand:MODEF 2 "register_operand" "x,x,v,v")))]
3514 "SSE_FLOAT_MODE_P (<MODE>mode)"
3516 static char buf[128];
3519 = (get_attr_mode (insn) == MODE_V4SF) ? "ps" : "<ssevecmodesuffix>";
3521 switch (which_alternative)
3524 ops = "<logic>%s\t{%%2, %%0|%%0, %%2}";
3527 if (!TARGET_AVX512DQ)
3529 suffix = <MODE>mode == DFmode ? "q" : "d";
3530 ops = "vp<logic>%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3535 ops = "v<logic>%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3538 if (TARGET_AVX512DQ)
3539 ops = "v<logic>%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3542 suffix = <MODE>mode == DFmode ? "q" : "d";
3543 ops = "vp<logic>%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3550 snprintf (buf, sizeof (buf), ops, suffix);
3553 [(set_attr "isa" "noavx,avx,avx512vl,avx512f")
3554 (set_attr "type" "sselog")
3555 (set_attr "prefix" "orig,vex,evex,evex")
3557 (cond [(eq_attr "alternative" "2")
3558 (if_then_else (match_test "TARGET_AVX512DQ")
3559 (const_string "<ssevecmode>")
3560 (const_string "TI"))
3561 (eq_attr "alternative" "3")
3562 (if_then_else (match_test "TARGET_AVX512DQ")
3563 (const_string "<avx512fvecmode>")
3564 (const_string "XI"))
3565 (and (match_test "<MODE_SIZE> == 16")
3566 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
3567 (const_string "V4SF")
3568 (match_test "TARGET_AVX")
3569 (const_string "<ssevecmode>")
3570 (match_test "optimize_function_for_size_p (cfun)")
3571 (const_string "V4SF")
3573 (const_string "<ssevecmode>")))])
3575 (define_expand "<code>tf3"
3576 [(set (match_operand:TF 0 "register_operand")
3578 (match_operand:TF 1 "vector_operand")
3579 (match_operand:TF 2 "vector_operand")))]
3581 "ix86_fixup_binary_operands_no_copy (<CODE>, TFmode, operands);")
3583 (define_insn "*<code>tf3"
3584 [(set (match_operand:TF 0 "register_operand" "=x,x,v,v")
3586 (match_operand:TF 1 "vector_operand" "%0,x,v,v")
3587 (match_operand:TF 2 "vector_operand" "xBm,xm,vm,v")))]
3588 "TARGET_SSE && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
3590 static char buf[128];
3593 = (which_alternative >= 2 ? "p<logic>q"
3594 : get_attr_mode (insn) == MODE_V4SF ? "<logic>ps" : "p<logic>");
3596 switch (which_alternative)
3599 ops = "%s\t{%%2, %%0|%%0, %%2}";
3603 ops = "v%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3606 ops = "v%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3612 snprintf (buf, sizeof (buf), ops, tmp);
3615 [(set_attr "isa" "noavx,avx,avx512vl,avx512f")
3616 (set_attr "type" "sselog")
3617 (set (attr "prefix_data16")
3619 (and (eq_attr "alternative" "0")
3620 (eq_attr "mode" "TI"))
3622 (const_string "*")))
3623 (set_attr "prefix" "orig,vex,evex,evex")
3625 (cond [(eq_attr "alternative" "2")
3627 (eq_attr "alternative" "3")
3629 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
3630 (const_string "V4SF")
3631 (match_test "TARGET_AVX")
3633 (ior (not (match_test "TARGET_SSE2"))
3634 (match_test "optimize_function_for_size_p (cfun)"))
3635 (const_string "V4SF")
3637 (const_string "TI")))])
3639 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3641 ;; FMA floating point multiply/accumulate instructions. These include
3642 ;; scalar versions of the instructions as well as vector versions.
3644 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3646 ;; The standard names for scalar FMA are only available with SSE math enabled.
3647 ;; CPUID bit AVX512F enables evex encoded scalar and 512-bit fma. It doesn't
3648 ;; care about FMA bit, so we enable fma for TARGET_AVX512F even when TARGET_FMA
3649 ;; and TARGET_FMA4 are both false.
3650 ;; TODO: In theory AVX512F does not automatically imply FMA, and without FMA
3651 ;; one must force the EVEX encoding of the fma insns. Ideally we'd improve
3652 ;; GAS to allow proper prefix selection. However, for the moment all hardware
3653 ;; that supports AVX512F also supports FMA so we can ignore this for now.
3654 (define_mode_iterator FMAMODEM
3655 [(SF "TARGET_SSE_MATH && (TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F)")
3656 (DF "TARGET_SSE_MATH && (TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F)")
3657 (V4SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3658 (V2DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3659 (V8SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3660 (V4DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3661 (V16SF "TARGET_AVX512F")
3662 (V8DF "TARGET_AVX512F")])
3664 (define_expand "fma<mode>4"
3665 [(set (match_operand:FMAMODEM 0 "register_operand")
3667 (match_operand:FMAMODEM 1 "nonimmediate_operand")
3668 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3669 (match_operand:FMAMODEM 3 "nonimmediate_operand")))])
3671 (define_expand "fms<mode>4"
3672 [(set (match_operand:FMAMODEM 0 "register_operand")
3674 (match_operand:FMAMODEM 1 "nonimmediate_operand")
3675 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3676 (neg:FMAMODEM (match_operand:FMAMODEM 3 "nonimmediate_operand"))))])
3678 (define_expand "fnma<mode>4"
3679 [(set (match_operand:FMAMODEM 0 "register_operand")
3681 (neg:FMAMODEM (match_operand:FMAMODEM 1 "nonimmediate_operand"))
3682 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3683 (match_operand:FMAMODEM 3 "nonimmediate_operand")))])
3685 (define_expand "fnms<mode>4"
3686 [(set (match_operand:FMAMODEM 0 "register_operand")
3688 (neg:FMAMODEM (match_operand:FMAMODEM 1 "nonimmediate_operand"))
3689 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3690 (neg:FMAMODEM (match_operand:FMAMODEM 3 "nonimmediate_operand"))))])
3692 ;; The builtins for intrinsics are not constrained by SSE math enabled.
3693 (define_mode_iterator FMAMODE_AVX512
3694 [(SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F")
3695 (DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F")
3696 (V4SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3697 (V2DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3698 (V8SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3699 (V4DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3700 (V16SF "TARGET_AVX512F")
3701 (V8DF "TARGET_AVX512F")])
3703 (define_mode_iterator FMAMODE
3704 [SF DF V4SF V2DF V8SF V4DF])
3706 (define_expand "fma4i_fmadd_<mode>"
3707 [(set (match_operand:FMAMODE_AVX512 0 "register_operand")
3709 (match_operand:FMAMODE_AVX512 1 "nonimmediate_operand")
3710 (match_operand:FMAMODE_AVX512 2 "nonimmediate_operand")
3711 (match_operand:FMAMODE_AVX512 3 "nonimmediate_operand")))])
3713 (define_expand "<avx512>_fmadd_<mode>_maskz<round_expand_name>"
3714 [(match_operand:VF_AVX512VL 0 "register_operand")
3715 (match_operand:VF_AVX512VL 1 "<round_expand_nimm_predicate>")
3716 (match_operand:VF_AVX512VL 2 "<round_expand_nimm_predicate>")
3717 (match_operand:VF_AVX512VL 3 "<round_expand_nimm_predicate>")
3718 (match_operand:<avx512fmaskmode> 4 "register_operand")]
3719 "TARGET_AVX512F && <round_mode512bit_condition>"
3721 emit_insn (gen_fma_fmadd_<mode>_maskz_1<round_expand_name> (
3722 operands[0], operands[1], operands[2], operands[3],
3723 CONST0_RTX (<MODE>mode), operands[4]<round_expand_operand>));
3727 (define_insn "*fma_fmadd_<mode>"
3728 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
3730 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x")
3731 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
3732 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x")))]
3733 "TARGET_FMA || TARGET_FMA4"
3735 vfmadd132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
3736 vfmadd213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
3737 vfmadd231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
3738 vfmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3739 vfmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3740 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3741 (set_attr "type" "ssemuladd")
3742 (set_attr "mode" "<MODE>")])
3744 ;; Suppose AVX-512F as baseline
3745 (define_mode_iterator VF_SF_AVX512VL
3746 [SF V16SF (V8SF "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
3747 DF V8DF (V4DF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
3749 (define_insn "<sd_mask_codefor>fma_fmadd_<mode><sd_maskz_name><round_name>"
3750 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3752 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
3753 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3754 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0")))]
3755 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3757 vfmadd132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3758 vfmadd213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3759 vfmadd231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
3760 [(set_attr "type" "ssemuladd")
3761 (set_attr "mode" "<MODE>")])
3763 (define_insn "<avx512>_fmadd_<mode>_mask<round_name>"
3764 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
3765 (vec_merge:VF_AVX512VL
3767 (match_operand:VF_AVX512VL 1 "register_operand" "0,0")
3768 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
3769 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>"))
3771 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
3772 "TARGET_AVX512F && <round_mode512bit_condition>"
3774 vfmadd132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
3775 vfmadd213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
3776 [(set_attr "type" "ssemuladd")
3777 (set_attr "mode" "<MODE>")])
3779 (define_insn "<avx512>_fmadd_<mode>_mask3<round_name>"
3780 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
3781 (vec_merge:VF_AVX512VL
3783 (match_operand:VF_AVX512VL 1 "register_operand" "v")
3784 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
3785 (match_operand:VF_AVX512VL 3 "register_operand" "0"))
3787 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
3789 "vfmadd231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
3790 [(set_attr "type" "ssemuladd")
3791 (set_attr "mode" "<MODE>")])
3793 (define_insn "*fma_fmsub_<mode>"
3794 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
3796 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x")
3797 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
3799 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x"))))]
3800 "TARGET_FMA || TARGET_FMA4"
3802 vfmsub132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
3803 vfmsub213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
3804 vfmsub231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
3805 vfmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3806 vfmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3807 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3808 (set_attr "type" "ssemuladd")
3809 (set_attr "mode" "<MODE>")])
3811 (define_insn "<sd_mask_codefor>fma_fmsub_<mode><sd_maskz_name><round_name>"
3812 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3814 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
3815 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3817 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0"))))]
3818 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3820 vfmsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3821 vfmsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3822 vfmsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
3823 [(set_attr "type" "ssemuladd")
3824 (set_attr "mode" "<MODE>")])
3826 (define_insn "<avx512>_fmsub_<mode>_mask<round_name>"
3827 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
3828 (vec_merge:VF_AVX512VL
3830 (match_operand:VF_AVX512VL 1 "register_operand" "0,0")
3831 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
3833 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>")))
3835 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
3838 vfmsub132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
3839 vfmsub213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
3840 [(set_attr "type" "ssemuladd")
3841 (set_attr "mode" "<MODE>")])
3843 (define_insn "<avx512>_fmsub_<mode>_mask3<round_name>"
3844 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
3845 (vec_merge:VF_AVX512VL
3847 (match_operand:VF_AVX512VL 1 "register_operand" "v")
3848 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
3850 (match_operand:VF_AVX512VL 3 "register_operand" "0")))
3852 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
3853 "TARGET_AVX512F && <round_mode512bit_condition>"
3854 "vfmsub231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
3855 [(set_attr "type" "ssemuladd")
3856 (set_attr "mode" "<MODE>")])
3858 (define_insn "*fma_fnmadd_<mode>"
3859 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
3862 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x"))
3863 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
3864 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x")))]
3865 "TARGET_FMA || TARGET_FMA4"
3867 vfnmadd132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
3868 vfnmadd213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
3869 vfnmadd231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
3870 vfnmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3871 vfnmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3872 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3873 (set_attr "type" "ssemuladd")
3874 (set_attr "mode" "<MODE>")])
3876 (define_insn "<sd_mask_codefor>fma_fnmadd_<mode><sd_maskz_name><round_name>"
3877 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3880 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v"))
3881 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3882 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0")))]
3883 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3885 vfnmadd132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3886 vfnmadd213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3887 vfnmadd231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
3888 [(set_attr "type" "ssemuladd")
3889 (set_attr "mode" "<MODE>")])
3891 (define_insn "<avx512>_fnmadd_<mode>_mask<round_name>"
3892 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
3893 (vec_merge:VF_AVX512VL
3896 (match_operand:VF_AVX512VL 1 "register_operand" "0,0"))
3897 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
3898 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>"))
3900 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
3901 "TARGET_AVX512F && <round_mode512bit_condition>"
3903 vfnmadd132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
3904 vfnmadd213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
3905 [(set_attr "type" "ssemuladd")
3906 (set_attr "mode" "<MODE>")])
3908 (define_insn "<avx512>_fnmadd_<mode>_mask3<round_name>"
3909 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
3910 (vec_merge:VF_AVX512VL
3913 (match_operand:VF_AVX512VL 1 "register_operand" "v"))
3914 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
3915 (match_operand:VF_AVX512VL 3 "register_operand" "0"))
3917 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
3918 "TARGET_AVX512F && <round_mode512bit_condition>"
3919 "vfnmadd231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
3920 [(set_attr "type" "ssemuladd")
3921 (set_attr "mode" "<MODE>")])
3923 (define_insn "*fma_fnmsub_<mode>"
3924 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
3927 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x"))
3928 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
3930 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x"))))]
3931 "TARGET_FMA || TARGET_FMA4"
3933 vfnmsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3934 vfnmsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3935 vfnmsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}
3936 vfnmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3937 vfnmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3938 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3939 (set_attr "type" "ssemuladd")
3940 (set_attr "mode" "<MODE>")])
3942 (define_insn "<sd_mask_codefor>fma_fnmsub_<mode><sd_maskz_name><round_name>"
3943 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3946 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v"))
3947 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3949 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0"))))]
3950 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3952 vfnmsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3953 vfnmsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3954 vfnmsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
3955 [(set_attr "type" "ssemuladd")
3956 (set_attr "mode" "<MODE>")])
3958 (define_insn "<avx512>_fnmsub_<mode>_mask<round_name>"
3959 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
3960 (vec_merge:VF_AVX512VL
3963 (match_operand:VF_AVX512VL 1 "register_operand" "0,0"))
3964 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
3966 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>")))
3968 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
3969 "TARGET_AVX512F && <round_mode512bit_condition>"
3971 vfnmsub132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
3972 vfnmsub213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
3973 [(set_attr "type" "ssemuladd")
3974 (set_attr "mode" "<MODE>")])
3976 (define_insn "<avx512>_fnmsub_<mode>_mask3<round_name>"
3977 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
3978 (vec_merge:VF_AVX512VL
3981 (match_operand:VF_AVX512VL 1 "register_operand" "v"))
3982 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
3984 (match_operand:VF_AVX512VL 3 "register_operand" "0")))
3986 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
3988 "vfnmsub231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
3989 [(set_attr "type" "ssemuladd")
3990 (set_attr "mode" "<MODE>")])
3992 ;; FMA parallel floating point multiply addsub and subadd operations.
3994 ;; It would be possible to represent these without the UNSPEC as
3997 ;; (fma op1 op2 op3)
3998 ;; (fma op1 op2 (neg op3))
4001 ;; But this doesn't seem useful in practice.
4003 (define_expand "fmaddsub_<mode>"
4004 [(set (match_operand:VF 0 "register_operand")
4006 [(match_operand:VF 1 "nonimmediate_operand")
4007 (match_operand:VF 2 "nonimmediate_operand")
4008 (match_operand:VF 3 "nonimmediate_operand")]
4010 "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F")
4012 (define_expand "<avx512>_fmaddsub_<mode>_maskz<round_expand_name>"
4013 [(match_operand:VF_AVX512VL 0 "register_operand")
4014 (match_operand:VF_AVX512VL 1 "<round_expand_nimm_predicate>")
4015 (match_operand:VF_AVX512VL 2 "<round_expand_nimm_predicate>")
4016 (match_operand:VF_AVX512VL 3 "<round_expand_nimm_predicate>")
4017 (match_operand:<avx512fmaskmode> 4 "register_operand")]
4020 emit_insn (gen_fma_fmaddsub_<mode>_maskz_1<round_expand_name> (
4021 operands[0], operands[1], operands[2], operands[3],
4022 CONST0_RTX (<MODE>mode), operands[4]<round_expand_operand>));
4026 (define_insn "*fma_fmaddsub_<mode>"
4027 [(set (match_operand:VF_128_256 0 "register_operand" "=v,v,v,x,x")
4029 [(match_operand:VF_128_256 1 "nonimmediate_operand" "%0,0,v,x,x")
4030 (match_operand:VF_128_256 2 "nonimmediate_operand" "vm,v,vm,x,m")
4031 (match_operand:VF_128_256 3 "nonimmediate_operand" "v,vm,0,xm,x")]
4033 "TARGET_FMA || TARGET_FMA4"
4035 vfmaddsub132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
4036 vfmaddsub213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
4037 vfmaddsub231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
4038 vfmaddsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
4039 vfmaddsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
4040 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
4041 (set_attr "type" "ssemuladd")
4042 (set_attr "mode" "<MODE>")])
4044 (define_insn "<sd_mask_codefor>fma_fmaddsub_<mode><sd_maskz_name><round_name>"
4045 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
4046 (unspec:VF_SF_AVX512VL
4047 [(match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
4048 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
4049 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0")]
4051 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
4053 vfmaddsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
4054 vfmaddsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
4055 vfmaddsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
4056 [(set_attr "type" "ssemuladd")
4057 (set_attr "mode" "<MODE>")])
4059 (define_insn "<avx512>_fmaddsub_<mode>_mask<round_name>"
4060 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
4061 (vec_merge:VF_AVX512VL
4063 [(match_operand:VF_AVX512VL 1 "register_operand" "0,0")
4064 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
4065 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>")]
4068 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
4071 vfmaddsub132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
4072 vfmaddsub213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
4073 [(set_attr "type" "ssemuladd")
4074 (set_attr "mode" "<MODE>")])
4076 (define_insn "<avx512>_fmaddsub_<mode>_mask3<round_name>"
4077 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
4078 (vec_merge:VF_AVX512VL
4080 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
4081 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
4082 (match_operand:VF_AVX512VL 3 "register_operand" "0")]
4085 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
4087 "vfmaddsub231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
4088 [(set_attr "type" "ssemuladd")
4089 (set_attr "mode" "<MODE>")])
4091 (define_insn "*fma_fmsubadd_<mode>"
4092 [(set (match_operand:VF_128_256 0 "register_operand" "=v,v,v,x,x")
4094 [(match_operand:VF_128_256 1 "nonimmediate_operand" "%0,0,v,x,x")
4095 (match_operand:VF_128_256 2 "nonimmediate_operand" "vm,v,vm,x,m")
4097 (match_operand:VF_128_256 3 "nonimmediate_operand" "v,vm,0,xm,x"))]
4099 "TARGET_FMA || TARGET_FMA4"
4101 vfmsubadd132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
4102 vfmsubadd213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
4103 vfmsubadd231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
4104 vfmsubadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
4105 vfmsubadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
4106 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
4107 (set_attr "type" "ssemuladd")
4108 (set_attr "mode" "<MODE>")])
4110 (define_insn "<sd_mask_codefor>fma_fmsubadd_<mode><sd_maskz_name><round_name>"
4111 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
4112 (unspec:VF_SF_AVX512VL
4113 [(match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
4114 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
4116 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0"))]
4118 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
4120 vfmsubadd132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
4121 vfmsubadd213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
4122 vfmsubadd231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
4123 [(set_attr "type" "ssemuladd")
4124 (set_attr "mode" "<MODE>")])
4126 (define_insn "<avx512>_fmsubadd_<mode>_mask<round_name>"
4127 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
4128 (vec_merge:VF_AVX512VL
4130 [(match_operand:VF_AVX512VL 1 "register_operand" "0,0")
4131 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
4133 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>"))]
4136 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
4139 vfmsubadd132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
4140 vfmsubadd213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
4141 [(set_attr "type" "ssemuladd")
4142 (set_attr "mode" "<MODE>")])
4144 (define_insn "<avx512>_fmsubadd_<mode>_mask3<round_name>"
4145 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
4146 (vec_merge:VF_AVX512VL
4148 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
4149 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
4151 (match_operand:VF_AVX512VL 3 "register_operand" "0"))]
4154 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
4156 "vfmsubadd231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
4157 [(set_attr "type" "ssemuladd")
4158 (set_attr "mode" "<MODE>")])
4160 ;; FMA3 floating point scalar intrinsics. These merge result with
4161 ;; high-order elements from the destination register.
4163 (define_expand "fmai_vmfmadd_<mode><round_name>"
4164 [(set (match_operand:VF_128 0 "register_operand")
4167 (match_operand:VF_128 1 "<round_nimm_predicate>")
4168 (match_operand:VF_128 2 "<round_nimm_predicate>")
4169 (match_operand:VF_128 3 "<round_nimm_predicate>"))
4174 (define_insn "*fmai_fmadd_<mode>"
4175 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4178 (match_operand:VF_128 1 "<round_nimm_predicate>" " 0, 0")
4179 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>, v")
4180 (match_operand:VF_128 3 "<round_nimm_predicate>" " v,<round_constraint>"))
4183 "TARGET_FMA || TARGET_AVX512F"
4185 vfmadd132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
4186 vfmadd213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
4187 [(set_attr "type" "ssemuladd")
4188 (set_attr "mode" "<MODE>")])
4190 (define_insn "*fmai_fmsub_<mode>"
4191 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4194 (match_operand:VF_128 1 "<round_nimm_predicate>" "0,0")
4195 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>,v")
4197 (match_operand:VF_128 3 "<round_nimm_predicate>" " v,<round_constraint>")))
4200 "TARGET_FMA || TARGET_AVX512F"
4202 vfmsub132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
4203 vfmsub213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
4204 [(set_attr "type" "ssemuladd")
4205 (set_attr "mode" "<MODE>")])
4207 (define_insn "*fmai_fnmadd_<mode><round_name>"
4208 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4212 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>,v"))
4213 (match_operand:VF_128 1 "<round_nimm_predicate>" "0,0")
4214 (match_operand:VF_128 3 "<round_nimm_predicate>" "v,<round_constraint>"))
4217 "TARGET_FMA || TARGET_AVX512F"
4219 vfnmadd132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
4220 vfnmadd213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
4221 [(set_attr "type" "ssemuladd")
4222 (set_attr "mode" "<MODE>")])
4224 (define_insn "*fmai_fnmsub_<mode><round_name>"
4225 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4229 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>, v"))
4230 (match_operand:VF_128 1 "<round_nimm_predicate>" " 0, 0")
4232 (match_operand:VF_128 3 "<round_nimm_predicate>" " v,<round_constraint>")))
4235 "TARGET_FMA || TARGET_AVX512F"
4237 vfnmsub132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
4238 vfnmsub213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
4239 [(set_attr "type" "ssemuladd")
4240 (set_attr "mode" "<MODE>")])
4242 ;; FMA4 floating point scalar intrinsics. These write the
4243 ;; entire destination register, with the high-order elements zeroed.
4245 (define_expand "fma4i_vmfmadd_<mode>"
4246 [(set (match_operand:VF_128 0 "register_operand")
4249 (match_operand:VF_128 1 "nonimmediate_operand")
4250 (match_operand:VF_128 2 "nonimmediate_operand")
4251 (match_operand:VF_128 3 "nonimmediate_operand"))
4255 "operands[4] = CONST0_RTX (<MODE>mode);")
4257 (define_insn "*fma4i_vmfmadd_<mode>"
4258 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
4261 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x")
4262 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
4263 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x"))
4264 (match_operand:VF_128 4 "const0_operand")
4267 "vfmadd<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
4268 [(set_attr "type" "ssemuladd")
4269 (set_attr "mode" "<MODE>")])
4271 (define_insn "*fma4i_vmfmsub_<mode>"
4272 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
4275 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x")
4276 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
4278 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x")))
4279 (match_operand:VF_128 4 "const0_operand")
4282 "vfmsub<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
4283 [(set_attr "type" "ssemuladd")
4284 (set_attr "mode" "<MODE>")])
4286 (define_insn "*fma4i_vmfnmadd_<mode>"
4287 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
4291 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x"))
4292 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
4293 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x"))
4294 (match_operand:VF_128 4 "const0_operand")
4297 "vfnmadd<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
4298 [(set_attr "type" "ssemuladd")
4299 (set_attr "mode" "<MODE>")])
4301 (define_insn "*fma4i_vmfnmsub_<mode>"
4302 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
4306 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x"))
4307 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
4309 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x")))
4310 (match_operand:VF_128 4 "const0_operand")
4313 "vfnmsub<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
4314 [(set_attr "type" "ssemuladd")
4315 (set_attr "mode" "<MODE>")])
4317 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4319 ;; Parallel single-precision floating point conversion operations
4321 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4323 (define_insn "sse_cvtpi2ps"
4324 [(set (match_operand:V4SF 0 "register_operand" "=x")
4327 (float:V2SF (match_operand:V2SI 2 "nonimmediate_operand" "ym")))
4328 (match_operand:V4SF 1 "register_operand" "0")
4331 "cvtpi2ps\t{%2, %0|%0, %2}"
4332 [(set_attr "type" "ssecvt")
4333 (set_attr "mode" "V4SF")])
4335 (define_insn "sse_cvtps2pi"
4336 [(set (match_operand:V2SI 0 "register_operand" "=y")
4338 (unspec:V4SI [(match_operand:V4SF 1 "nonimmediate_operand" "xm")]
4340 (parallel [(const_int 0) (const_int 1)])))]
4342 "cvtps2pi\t{%1, %0|%0, %q1}"
4343 [(set_attr "type" "ssecvt")
4344 (set_attr "unit" "mmx")
4345 (set_attr "mode" "DI")])
4347 (define_insn "sse_cvttps2pi"
4348 [(set (match_operand:V2SI 0 "register_operand" "=y")
4350 (fix:V4SI (match_operand:V4SF 1 "nonimmediate_operand" "xm"))
4351 (parallel [(const_int 0) (const_int 1)])))]
4353 "cvttps2pi\t{%1, %0|%0, %q1}"
4354 [(set_attr "type" "ssecvt")
4355 (set_attr "unit" "mmx")
4356 (set_attr "prefix_rep" "0")
4357 (set_attr "mode" "SF")])
4359 (define_insn "sse_cvtsi2ss<rex64namesuffix><round_name>"
4360 [(set (match_operand:V4SF 0 "register_operand" "=x,x,v")
4363 (float:SF (match_operand:SWI48 2 "<round_nimm_scalar_predicate>" "r,m,<round_constraint3>")))
4364 (match_operand:V4SF 1 "register_operand" "0,0,v")
4368 cvtsi2ss<rex64suffix>\t{%2, %0|%0, %2}
4369 cvtsi2ss<rex64suffix>\t{%2, %0|%0, %2}
4370 vcvtsi2ss<rex64suffix>\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4371 [(set_attr "isa" "noavx,noavx,avx")
4372 (set_attr "type" "sseicvt")
4373 (set_attr "athlon_decode" "vector,double,*")
4374 (set_attr "amdfam10_decode" "vector,double,*")
4375 (set_attr "bdver1_decode" "double,direct,*")
4376 (set_attr "btver2_decode" "double,double,double")
4377 (set_attr "znver1_decode" "double,double,double")
4378 (set (attr "length_vex")
4380 (and (match_test "<MODE>mode == DImode")
4381 (eq_attr "alternative" "2"))
4383 (const_string "*")))
4384 (set (attr "prefix_rex")
4386 (and (match_test "<MODE>mode == DImode")
4387 (eq_attr "alternative" "0,1"))
4389 (const_string "*")))
4390 (set_attr "prefix" "orig,orig,maybe_evex")
4391 (set_attr "mode" "SF")])
4393 (define_insn "sse_cvtss2si<rex64namesuffix><round_name>"
4394 [(set (match_operand:SWI48 0 "register_operand" "=r,r")
4397 (match_operand:V4SF 1 "<round_nimm_scalar_predicate>" "v,<round_constraint2>")
4398 (parallel [(const_int 0)]))]
4399 UNSPEC_FIX_NOTRUNC))]
4401 "%vcvtss2si<rex64suffix>\t{<round_op2>%1, %0|%0, %k1<round_op2>}"
4402 [(set_attr "type" "sseicvt")
4403 (set_attr "athlon_decode" "double,vector")
4404 (set_attr "bdver1_decode" "double,double")
4405 (set_attr "prefix_rep" "1")
4406 (set_attr "prefix" "maybe_vex")
4407 (set_attr "mode" "<MODE>")])
4409 (define_insn "sse_cvtss2si<rex64namesuffix>_2"
4410 [(set (match_operand:SWI48 0 "register_operand" "=r,r")
4411 (unspec:SWI48 [(match_operand:SF 1 "nonimmediate_operand" "v,m")]
4412 UNSPEC_FIX_NOTRUNC))]
4414 "%vcvtss2si<rex64suffix>\t{%1, %0|%0, %k1}"
4415 [(set_attr "type" "sseicvt")
4416 (set_attr "athlon_decode" "double,vector")
4417 (set_attr "amdfam10_decode" "double,double")
4418 (set_attr "bdver1_decode" "double,double")
4419 (set_attr "prefix_rep" "1")
4420 (set_attr "prefix" "maybe_vex")
4421 (set_attr "mode" "<MODE>")])
4423 (define_insn "sse_cvttss2si<rex64namesuffix><round_saeonly_name>"
4424 [(set (match_operand:SWI48 0 "register_operand" "=r,r")
4427 (match_operand:V4SF 1 "<round_saeonly_nimm_scalar_predicate>" "v,<round_saeonly_constraint>")
4428 (parallel [(const_int 0)]))))]
4430 "%vcvttss2si<rex64suffix>\t{<round_saeonly_op2>%1, %0|%0, %k1<round_saeonly_op2>}"
4431 [(set_attr "type" "sseicvt")
4432 (set_attr "athlon_decode" "double,vector")
4433 (set_attr "amdfam10_decode" "double,double")
4434 (set_attr "bdver1_decode" "double,double")
4435 (set_attr "prefix_rep" "1")
4436 (set_attr "prefix" "maybe_vex")
4437 (set_attr "mode" "<MODE>")])
4439 (define_insn "cvtusi2<ssescalarmodesuffix>32<round_name>"
4440 [(set (match_operand:VF_128 0 "register_operand" "=v")
4442 (vec_duplicate:VF_128
4443 (unsigned_float:<ssescalarmode>
4444 (match_operand:SI 2 "<round_nimm_predicate>" "<round_constraint3>")))
4445 (match_operand:VF_128 1 "register_operand" "v")
4447 "TARGET_AVX512F && <round_modev4sf_condition>"
4448 "vcvtusi2<ssescalarmodesuffix>\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4449 [(set_attr "type" "sseicvt")
4450 (set_attr "prefix" "evex")
4451 (set_attr "mode" "<ssescalarmode>")])
4453 (define_insn "cvtusi2<ssescalarmodesuffix>64<round_name>"
4454 [(set (match_operand:VF_128 0 "register_operand" "=v")
4456 (vec_duplicate:VF_128
4457 (unsigned_float:<ssescalarmode>
4458 (match_operand:DI 2 "<round_nimm_predicate>" "<round_constraint3>")))
4459 (match_operand:VF_128 1 "register_operand" "v")
4461 "TARGET_AVX512F && TARGET_64BIT"
4462 "vcvtusi2<ssescalarmodesuffix>{q}\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4463 [(set_attr "type" "sseicvt")
4464 (set_attr "prefix" "evex")
4465 (set_attr "mode" "<ssescalarmode>")])
4467 (define_insn "float<sseintvecmodelower><mode>2<mask_name><round_name>"
4468 [(set (match_operand:VF1 0 "register_operand" "=x,v")
4470 (match_operand:<sseintvecmode> 1 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
4471 "TARGET_SSE2 && <mask_mode512bit_condition> && <round_mode512bit_condition>"
4473 cvtdq2ps\t{%1, %0|%0, %1}
4474 vcvtdq2ps\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4475 [(set_attr "isa" "noavx,avx")
4476 (set_attr "type" "ssecvt")
4477 (set_attr "prefix" "maybe_vex")
4478 (set_attr "mode" "<sseinsnmode>")])
4480 (define_insn "ufloat<sseintvecmodelower><mode>2<mask_name><round_name>"
4481 [(set (match_operand:VF1_AVX512VL 0 "register_operand" "=v")
4482 (unsigned_float:VF1_AVX512VL
4483 (match_operand:<sseintvecmode> 1 "nonimmediate_operand" "<round_constraint>")))]
4485 "vcvtudq2ps\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4486 [(set_attr "type" "ssecvt")
4487 (set_attr "prefix" "evex")
4488 (set_attr "mode" "<MODE>")])
4490 (define_expand "floatuns<sseintvecmodelower><mode>2"
4491 [(match_operand:VF1 0 "register_operand")
4492 (match_operand:<sseintvecmode> 1 "register_operand")]
4493 "TARGET_SSE2 && (<MODE>mode == V4SFmode || TARGET_AVX2)"
4495 if (<MODE>mode == V16SFmode)
4496 emit_insn (gen_ufloatv16siv16sf2 (operands[0], operands[1]));
4498 if (TARGET_AVX512VL)
4500 if (<MODE>mode == V4SFmode)
4501 emit_insn (gen_ufloatv4siv4sf2 (operands[0], operands[1]));
4503 emit_insn (gen_ufloatv8siv8sf2 (operands[0], operands[1]));
4506 ix86_expand_vector_convert_uns_vsivsf (operands[0], operands[1]);
4512 ;; For <sse2_avx_avx512f>_fix_notrunc<sf2simodelower><mode> insn pattern
4513 (define_mode_attr sf2simodelower
4514 [(V16SI "v16sf") (V8SI "v8sf") (V4SI "v4sf")])
4516 (define_insn "<sse2_avx_avx512f>_fix_notrunc<sf2simodelower><mode><mask_name>"
4517 [(set (match_operand:VI4_AVX 0 "register_operand" "=v")
4519 [(match_operand:<ssePSmode> 1 "vector_operand" "vBm")]
4520 UNSPEC_FIX_NOTRUNC))]
4521 "TARGET_SSE2 && <mask_mode512bit_condition>"
4522 "%vcvtps2dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4523 [(set_attr "type" "ssecvt")
4524 (set (attr "prefix_data16")
4526 (match_test "TARGET_AVX")
4528 (const_string "1")))
4529 (set_attr "prefix" "maybe_vex")
4530 (set_attr "mode" "<sseinsnmode>")])
4532 (define_insn "avx512f_fix_notruncv16sfv16si<mask_name><round_name>"
4533 [(set (match_operand:V16SI 0 "register_operand" "=v")
4535 [(match_operand:V16SF 1 "<round_nimm_predicate>" "<round_constraint>")]
4536 UNSPEC_FIX_NOTRUNC))]
4538 "vcvtps2dq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4539 [(set_attr "type" "ssecvt")
4540 (set_attr "prefix" "evex")
4541 (set_attr "mode" "XI")])
4543 (define_insn "<mask_codefor><avx512>_ufix_notrunc<sf2simodelower><mode><mask_name><round_name>"
4544 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
4545 (unspec:VI4_AVX512VL
4546 [(match_operand:<ssePSmode> 1 "nonimmediate_operand" "<round_constraint>")]
4547 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4549 "vcvtps2udq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4550 [(set_attr "type" "ssecvt")
4551 (set_attr "prefix" "evex")
4552 (set_attr "mode" "<sseinsnmode>")])
4554 (define_insn "<mask_codefor>avx512dq_cvtps2qq<mode><mask_name><round_name>"
4555 [(set (match_operand:VI8_256_512 0 "register_operand" "=v")
4556 (unspec:VI8_256_512 [(match_operand:<ssePSmode2> 1 "nonimmediate_operand" "<round_constraint>")]
4557 UNSPEC_FIX_NOTRUNC))]
4558 "TARGET_AVX512DQ && <round_mode512bit_condition>"
4559 "vcvtps2qq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4560 [(set_attr "type" "ssecvt")
4561 (set_attr "prefix" "evex")
4562 (set_attr "mode" "<sseinsnmode>")])
4564 (define_insn "<mask_codefor>avx512dq_cvtps2qqv2di<mask_name>"
4565 [(set (match_operand:V2DI 0 "register_operand" "=v")
4568 (match_operand:V4SF 1 "nonimmediate_operand" "vm")
4569 (parallel [(const_int 0) (const_int 1)]))]
4570 UNSPEC_FIX_NOTRUNC))]
4571 "TARGET_AVX512DQ && TARGET_AVX512VL"
4572 "vcvtps2qq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
4573 [(set_attr "type" "ssecvt")
4574 (set_attr "prefix" "evex")
4575 (set_attr "mode" "TI")])
4577 (define_insn "<mask_codefor>avx512dq_cvtps2uqq<mode><mask_name><round_name>"
4578 [(set (match_operand:VI8_256_512 0 "register_operand" "=v")
4579 (unspec:VI8_256_512 [(match_operand:<ssePSmode2> 1 "nonimmediate_operand" "<round_constraint>")]
4580 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4581 "TARGET_AVX512DQ && <round_mode512bit_condition>"
4582 "vcvtps2uqq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4583 [(set_attr "type" "ssecvt")
4584 (set_attr "prefix" "evex")
4585 (set_attr "mode" "<sseinsnmode>")])
4587 (define_insn "<mask_codefor>avx512dq_cvtps2uqqv2di<mask_name>"
4588 [(set (match_operand:V2DI 0 "register_operand" "=v")
4591 (match_operand:V4SF 1 "nonimmediate_operand" "vm")
4592 (parallel [(const_int 0) (const_int 1)]))]
4593 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4594 "TARGET_AVX512DQ && TARGET_AVX512VL"
4595 "vcvtps2uqq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
4596 [(set_attr "type" "ssecvt")
4597 (set_attr "prefix" "evex")
4598 (set_attr "mode" "TI")])
4600 (define_insn "<fixsuffix>fix_truncv16sfv16si2<mask_name><round_saeonly_name>"
4601 [(set (match_operand:V16SI 0 "register_operand" "=v")
4603 (match_operand:V16SF 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
4605 "vcvttps2<fixsuffix>dq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
4606 [(set_attr "type" "ssecvt")
4607 (set_attr "prefix" "evex")
4608 (set_attr "mode" "XI")])
4610 (define_insn "fix_truncv8sfv8si2<mask_name>"
4611 [(set (match_operand:V8SI 0 "register_operand" "=v")
4612 (fix:V8SI (match_operand:V8SF 1 "nonimmediate_operand" "vm")))]
4613 "TARGET_AVX && <mask_avx512vl_condition>"
4614 "vcvttps2dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4615 [(set_attr "type" "ssecvt")
4616 (set_attr "prefix" "<mask_prefix>")
4617 (set_attr "mode" "OI")])
4619 (define_insn "fix_truncv4sfv4si2<mask_name>"
4620 [(set (match_operand:V4SI 0 "register_operand" "=v")
4621 (fix:V4SI (match_operand:V4SF 1 "vector_operand" "vBm")))]
4622 "TARGET_SSE2 && <mask_avx512vl_condition>"
4623 "%vcvttps2dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4624 [(set_attr "type" "ssecvt")
4625 (set (attr "prefix_rep")
4627 (match_test "TARGET_AVX")
4629 (const_string "1")))
4630 (set (attr "prefix_data16")
4632 (match_test "TARGET_AVX")
4634 (const_string "0")))
4635 (set_attr "prefix_data16" "0")
4636 (set_attr "prefix" "<mask_prefix2>")
4637 (set_attr "mode" "TI")])
4639 (define_expand "fixuns_trunc<mode><sseintvecmodelower>2"
4640 [(match_operand:<sseintvecmode> 0 "register_operand")
4641 (match_operand:VF1 1 "register_operand")]
4644 if (<MODE>mode == V16SFmode)
4645 emit_insn (gen_ufix_truncv16sfv16si2 (operands[0],
4650 tmp[0] = ix86_expand_adjust_ufix_to_sfix_si (operands[1], &tmp[2]);
4651 tmp[1] = gen_reg_rtx (<sseintvecmode>mode);
4652 emit_insn (gen_fix_trunc<mode><sseintvecmodelower>2 (tmp[1], tmp[0]));
4653 emit_insn (gen_xor<sseintvecmodelower>3 (operands[0], tmp[1], tmp[2]));
4658 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4660 ;; Parallel double-precision floating point conversion operations
4662 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4664 (define_insn "sse2_cvtpi2pd"
4665 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
4666 (float:V2DF (match_operand:V2SI 1 "nonimmediate_operand" "y,m")))]
4668 "cvtpi2pd\t{%1, %0|%0, %1}"
4669 [(set_attr "type" "ssecvt")
4670 (set_attr "unit" "mmx,*")
4671 (set_attr "prefix_data16" "1,*")
4672 (set_attr "mode" "V2DF")])
4674 (define_insn "sse2_cvtpd2pi"
4675 [(set (match_operand:V2SI 0 "register_operand" "=y")
4676 (unspec:V2SI [(match_operand:V2DF 1 "nonimmediate_operand" "xm")]
4677 UNSPEC_FIX_NOTRUNC))]
4679 "cvtpd2pi\t{%1, %0|%0, %1}"
4680 [(set_attr "type" "ssecvt")
4681 (set_attr "unit" "mmx")
4682 (set_attr "bdver1_decode" "double")
4683 (set_attr "btver2_decode" "direct")
4684 (set_attr "prefix_data16" "1")
4685 (set_attr "mode" "DI")])
4687 (define_insn "sse2_cvttpd2pi"
4688 [(set (match_operand:V2SI 0 "register_operand" "=y")
4689 (fix:V2SI (match_operand:V2DF 1 "nonimmediate_operand" "xm")))]
4691 "cvttpd2pi\t{%1, %0|%0, %1}"
4692 [(set_attr "type" "ssecvt")
4693 (set_attr "unit" "mmx")
4694 (set_attr "bdver1_decode" "double")
4695 (set_attr "prefix_data16" "1")
4696 (set_attr "mode" "TI")])
4698 (define_insn "sse2_cvtsi2sd"
4699 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
4702 (float:DF (match_operand:SI 2 "nonimmediate_operand" "r,m,rm")))
4703 (match_operand:V2DF 1 "register_operand" "0,0,v")
4707 cvtsi2sd\t{%2, %0|%0, %2}
4708 cvtsi2sd\t{%2, %0|%0, %2}
4709 vcvtsi2sd\t{%2, %1, %0|%0, %1, %2}"
4710 [(set_attr "isa" "noavx,noavx,avx")
4711 (set_attr "type" "sseicvt")
4712 (set_attr "athlon_decode" "double,direct,*")
4713 (set_attr "amdfam10_decode" "vector,double,*")
4714 (set_attr "bdver1_decode" "double,direct,*")
4715 (set_attr "btver2_decode" "double,double,double")
4716 (set_attr "znver1_decode" "double,double,double")
4717 (set_attr "prefix" "orig,orig,maybe_evex")
4718 (set_attr "mode" "DF")])
4720 (define_insn "sse2_cvtsi2sdq<round_name>"
4721 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
4724 (float:DF (match_operand:DI 2 "<round_nimm_scalar_predicate>" "r,m,<round_constraint3>")))
4725 (match_operand:V2DF 1 "register_operand" "0,0,v")
4727 "TARGET_SSE2 && TARGET_64BIT"
4729 cvtsi2sdq\t{%2, %0|%0, %2}
4730 cvtsi2sdq\t{%2, %0|%0, %2}
4731 vcvtsi2sdq\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4732 [(set_attr "isa" "noavx,noavx,avx")
4733 (set_attr "type" "sseicvt")
4734 (set_attr "athlon_decode" "double,direct,*")
4735 (set_attr "amdfam10_decode" "vector,double,*")
4736 (set_attr "bdver1_decode" "double,direct,*")
4737 (set_attr "length_vex" "*,*,4")
4738 (set_attr "prefix_rex" "1,1,*")
4739 (set_attr "prefix" "orig,orig,maybe_evex")
4740 (set_attr "mode" "DF")])
4742 (define_insn "avx512f_vcvtss2usi<rex64namesuffix><round_name>"
4743 [(set (match_operand:SWI48 0 "register_operand" "=r")
4746 (match_operand:V4SF 1 "<round_nimm_predicate>" "<round_constraint>")
4747 (parallel [(const_int 0)]))]
4748 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4750 "vcvtss2usi\t{<round_op2>%1, %0|%0, %k1<round_op2>}"
4751 [(set_attr "type" "sseicvt")
4752 (set_attr "prefix" "evex")
4753 (set_attr "mode" "<MODE>")])
4755 (define_insn "avx512f_vcvttss2usi<rex64namesuffix><round_saeonly_name>"
4756 [(set (match_operand:SWI48 0 "register_operand" "=r")
4759 (match_operand:V4SF 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
4760 (parallel [(const_int 0)]))))]
4762 "vcvttss2usi\t{<round_saeonly_op2>%1, %0|%0, %k1<round_saeonly_op2>}"
4763 [(set_attr "type" "sseicvt")
4764 (set_attr "prefix" "evex")
4765 (set_attr "mode" "<MODE>")])
4767 (define_insn "avx512f_vcvtsd2usi<rex64namesuffix><round_name>"
4768 [(set (match_operand:SWI48 0 "register_operand" "=r")
4771 (match_operand:V2DF 1 "<round_nimm_predicate>" "<round_constraint>")
4772 (parallel [(const_int 0)]))]
4773 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4775 "vcvtsd2usi\t{<round_op2>%1, %0|%0, %q1<round_op2>}"
4776 [(set_attr "type" "sseicvt")
4777 (set_attr "prefix" "evex")
4778 (set_attr "mode" "<MODE>")])
4780 (define_insn "avx512f_vcvttsd2usi<rex64namesuffix><round_saeonly_name>"
4781 [(set (match_operand:SWI48 0 "register_operand" "=r")
4784 (match_operand:V2DF 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
4785 (parallel [(const_int 0)]))))]
4787 "vcvttsd2usi\t{<round_saeonly_op2>%1, %0|%0, %q1<round_saeonly_op2>}"
4788 [(set_attr "type" "sseicvt")
4789 (set_attr "prefix" "evex")
4790 (set_attr "mode" "<MODE>")])
4792 (define_insn "sse2_cvtsd2si<rex64namesuffix><round_name>"
4793 [(set (match_operand:SWI48 0 "register_operand" "=r,r")
4796 (match_operand:V2DF 1 "<round_nimm_scalar_predicate>" "v,<round_constraint2>")
4797 (parallel [(const_int 0)]))]
4798 UNSPEC_FIX_NOTRUNC))]
4800 "%vcvtsd2si<rex64suffix>\t{<round_op2>%1, %0|%0, %q1<round_op2>}"
4801 [(set_attr "type" "sseicvt")
4802 (set_attr "athlon_decode" "double,vector")
4803 (set_attr "bdver1_decode" "double,double")
4804 (set_attr "btver2_decode" "double,double")
4805 (set_attr "prefix_rep" "1")
4806 (set_attr "prefix" "maybe_vex")
4807 (set_attr "mode" "<MODE>")])
4809 (define_insn "sse2_cvtsd2si<rex64namesuffix>_2"
4810 [(set (match_operand:SWI48 0 "register_operand" "=r,r")
4811 (unspec:SWI48 [(match_operand:DF 1 "nonimmediate_operand" "v,m")]
4812 UNSPEC_FIX_NOTRUNC))]
4814 "%vcvtsd2si<rex64suffix>\t{%1, %0|%0, %q1}"
4815 [(set_attr "type" "sseicvt")
4816 (set_attr "athlon_decode" "double,vector")
4817 (set_attr "amdfam10_decode" "double,double")
4818 (set_attr "bdver1_decode" "double,double")
4819 (set_attr "prefix_rep" "1")
4820 (set_attr "prefix" "maybe_vex")
4821 (set_attr "mode" "<MODE>")])
4823 (define_insn "sse2_cvttsd2si<rex64namesuffix><round_saeonly_name>"
4824 [(set (match_operand:SWI48 0 "register_operand" "=r,r")
4827 (match_operand:V2DF 1 "<round_saeonly_nimm_scalar_predicate>" "v,<round_saeonly_constraint2>")
4828 (parallel [(const_int 0)]))))]
4830 "%vcvttsd2si<rex64suffix>\t{<round_saeonly_op2>%1, %0|%0, %q1<round_saeonly_op2>}"
4831 [(set_attr "type" "sseicvt")
4832 (set_attr "athlon_decode" "double,vector")
4833 (set_attr "amdfam10_decode" "double,double")
4834 (set_attr "bdver1_decode" "double,double")
4835 (set_attr "btver2_decode" "double,double")
4836 (set_attr "prefix_rep" "1")
4837 (set_attr "prefix" "maybe_vex")
4838 (set_attr "mode" "<MODE>")])
4840 ;; For float<si2dfmode><mode>2 insn pattern
4841 (define_mode_attr si2dfmode
4842 [(V8DF "V8SI") (V4DF "V4SI")])
4843 (define_mode_attr si2dfmodelower
4844 [(V8DF "v8si") (V4DF "v4si")])
4846 (define_insn "float<si2dfmodelower><mode>2<mask_name>"
4847 [(set (match_operand:VF2_512_256 0 "register_operand" "=v")
4848 (float:VF2_512_256 (match_operand:<si2dfmode> 1 "nonimmediate_operand" "vm")))]
4849 "TARGET_AVX && <mask_mode512bit_condition>"
4850 "vcvtdq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4851 [(set_attr "type" "ssecvt")
4852 (set_attr "prefix" "maybe_vex")
4853 (set_attr "mode" "<MODE>")])
4855 (define_insn "float<floatunssuffix><sseintvecmodelower><mode>2<mask_name><round_name>"
4856 [(set (match_operand:VF2_AVX512VL 0 "register_operand" "=v")
4857 (any_float:VF2_AVX512VL
4858 (match_operand:<sseintvecmode> 1 "nonimmediate_operand" "<round_constraint>")))]
4860 "vcvt<floatsuffix>qq2pd\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4861 [(set_attr "type" "ssecvt")
4862 (set_attr "prefix" "evex")
4863 (set_attr "mode" "<MODE>")])
4865 ;; For float<floatunssuffix><sselondveclower><mode> insn patterns
4866 (define_mode_attr qq2pssuff
4867 [(V8SF "") (V4SF "{y}")])
4869 (define_mode_attr sselongvecmode
4870 [(V8SF "V8DI") (V4SF "V4DI")])
4872 (define_mode_attr sselongvecmodelower
4873 [(V8SF "v8di") (V4SF "v4di")])
4875 (define_mode_attr sseintvecmode3
4876 [(V8SF "XI") (V4SF "OI")
4877 (V8DF "OI") (V4DF "TI")])
4879 (define_insn "float<floatunssuffix><sselongvecmodelower><mode>2<mask_name><round_name>"
4880 [(set (match_operand:VF1_128_256VL 0 "register_operand" "=v")
4881 (any_float:VF1_128_256VL
4882 (match_operand:<sselongvecmode> 1 "nonimmediate_operand" "<round_constraint>")))]
4883 "TARGET_AVX512DQ && <round_modev8sf_condition>"
4884 "vcvt<floatsuffix>qq2ps<qq2pssuff>\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4885 [(set_attr "type" "ssecvt")
4886 (set_attr "prefix" "evex")
4887 (set_attr "mode" "<MODE>")])
4889 (define_insn "float<floatunssuffix>v2div2sf2"
4890 [(set (match_operand:V4SF 0 "register_operand" "=v")
4892 (any_float:V2SF (match_operand:V2DI 1 "nonimmediate_operand" "vm"))
4893 (const_vector:V2SF [(const_int 0) (const_int 0)])))]
4894 "TARGET_AVX512DQ && TARGET_AVX512VL"
4895 "vcvt<floatsuffix>qq2ps{x}\t{%1, %0|%0, %1}"
4896 [(set_attr "type" "ssecvt")
4897 (set_attr "prefix" "evex")
4898 (set_attr "mode" "V4SF")])
4900 (define_mode_attr vpckfloat_concat_mode
4901 [(V8DI "v16sf") (V4DI "v8sf") (V2DI "v8sf")])
4902 (define_mode_attr vpckfloat_temp_mode
4903 [(V8DI "V8SF") (V4DI "V4SF") (V2DI "V4SF")])
4904 (define_mode_attr vpckfloat_op_mode
4905 [(V8DI "v8sf") (V4DI "v4sf") (V2DI "v2sf")])
4907 (define_expand "vec_pack<floatprefix>_float_<mode>"
4908 [(match_operand:<ssePSmode> 0 "register_operand")
4909 (any_float:<ssePSmode>
4910 (match_operand:VI8_AVX512VL 1 "register_operand"))
4911 (match_operand:VI8_AVX512VL 2 "register_operand")]
4914 rtx r1 = gen_reg_rtx (<vpckfloat_temp_mode>mode);
4915 rtx r2 = gen_reg_rtx (<vpckfloat_temp_mode>mode);
4916 rtx (*gen) (rtx, rtx) = gen_float<floatunssuffix><mode><vpckfloat_op_mode>2;
4917 emit_insn (gen (r1, operands[1]));
4918 emit_insn (gen (r2, operands[2]));
4919 if (<MODE>mode == V2DImode)
4920 emit_insn (gen_sse_movlhps (operands[0], r1, r2));
4922 emit_insn (gen_avx_vec_concat<vpckfloat_concat_mode> (operands[0],
4927 (define_insn "float<floatunssuffix>v2div2sf2_mask"
4928 [(set (match_operand:V4SF 0 "register_operand" "=v")
4931 (any_float:V2SF (match_operand:V2DI 1 "nonimmediate_operand" "vm"))
4933 (match_operand:V4SF 2 "vector_move_operand" "0C")
4934 (parallel [(const_int 0) (const_int 1)]))
4935 (match_operand:QI 3 "register_operand" "Yk"))
4936 (const_vector:V2SF [(const_int 0) (const_int 0)])))]
4937 "TARGET_AVX512DQ && TARGET_AVX512VL"
4938 "vcvt<floatsuffix>qq2ps{x}\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
4939 [(set_attr "type" "ssecvt")
4940 (set_attr "prefix" "evex")
4941 (set_attr "mode" "V4SF")])
4943 (define_insn "*float<floatunssuffix>v2div2sf2_mask_1"
4944 [(set (match_operand:V4SF 0 "register_operand" "=v")
4947 (any_float:V2SF (match_operand:V2DI 1
4948 "nonimmediate_operand" "vm"))
4949 (const_vector:V2SF [(const_int 0) (const_int 0)])
4950 (match_operand:QI 2 "register_operand" "Yk"))
4951 (const_vector:V2SF [(const_int 0) (const_int 0)])))]
4952 "TARGET_AVX512DQ && TARGET_AVX512VL"
4953 "vcvt<floatsuffix>qq2ps{x}\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
4954 [(set_attr "type" "ssecvt")
4955 (set_attr "prefix" "evex")
4956 (set_attr "mode" "V4SF")])
4958 (define_insn "ufloat<si2dfmodelower><mode>2<mask_name>"
4959 [(set (match_operand:VF2_512_256VL 0 "register_operand" "=v")
4960 (unsigned_float:VF2_512_256VL
4961 (match_operand:<si2dfmode> 1 "nonimmediate_operand" "vm")))]
4963 "vcvtudq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4964 [(set_attr "type" "ssecvt")
4965 (set_attr "prefix" "evex")
4966 (set_attr "mode" "<MODE>")])
4968 (define_insn "ufloatv2siv2df2<mask_name>"
4969 [(set (match_operand:V2DF 0 "register_operand" "=v")
4970 (unsigned_float:V2DF
4972 (match_operand:V4SI 1 "nonimmediate_operand" "vm")
4973 (parallel [(const_int 0) (const_int 1)]))))]
4975 "vcvtudq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
4976 [(set_attr "type" "ssecvt")
4977 (set_attr "prefix" "evex")
4978 (set_attr "mode" "V2DF")])
4980 (define_insn "avx512f_cvtdq2pd512_2"
4981 [(set (match_operand:V8DF 0 "register_operand" "=v")
4984 (match_operand:V16SI 1 "nonimmediate_operand" "vm")
4985 (parallel [(const_int 0) (const_int 1)
4986 (const_int 2) (const_int 3)
4987 (const_int 4) (const_int 5)
4988 (const_int 6) (const_int 7)]))))]
4990 "vcvtdq2pd\t{%t1, %0|%0, %t1}"
4991 [(set_attr "type" "ssecvt")
4992 (set_attr "prefix" "evex")
4993 (set_attr "mode" "V8DF")])
4995 (define_insn "avx_cvtdq2pd256_2"
4996 [(set (match_operand:V4DF 0 "register_operand" "=v")
4999 (match_operand:V8SI 1 "nonimmediate_operand" "vm")
5000 (parallel [(const_int 0) (const_int 1)
5001 (const_int 2) (const_int 3)]))))]
5003 "vcvtdq2pd\t{%x1, %0|%0, %x1}"
5004 [(set_attr "type" "ssecvt")
5005 (set_attr "prefix" "maybe_evex")
5006 (set_attr "mode" "V4DF")])
5008 (define_insn "sse2_cvtdq2pd<mask_name>"
5009 [(set (match_operand:V2DF 0 "register_operand" "=v")
5012 (match_operand:V4SI 1 "nonimmediate_operand" "vm")
5013 (parallel [(const_int 0) (const_int 1)]))))]
5014 "TARGET_SSE2 && <mask_avx512vl_condition>"
5015 "%vcvtdq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
5016 [(set_attr "type" "ssecvt")
5017 (set_attr "prefix" "maybe_vex")
5018 (set_attr "mode" "V2DF")])
5020 (define_insn "avx512f_cvtpd2dq512<mask_name><round_name>"
5021 [(set (match_operand:V8SI 0 "register_operand" "=v")
5023 [(match_operand:V8DF 1 "<round_nimm_predicate>" "<round_constraint>")]
5024 UNSPEC_FIX_NOTRUNC))]
5026 "vcvtpd2dq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5027 [(set_attr "type" "ssecvt")
5028 (set_attr "prefix" "evex")
5029 (set_attr "mode" "OI")])
5031 (define_insn "avx_cvtpd2dq256<mask_name>"
5032 [(set (match_operand:V4SI 0 "register_operand" "=v")
5033 (unspec:V4SI [(match_operand:V4DF 1 "nonimmediate_operand" "vm")]
5034 UNSPEC_FIX_NOTRUNC))]
5035 "TARGET_AVX && <mask_avx512vl_condition>"
5036 "vcvtpd2dq{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5037 [(set_attr "type" "ssecvt")
5038 (set_attr "prefix" "<mask_prefix>")
5039 (set_attr "mode" "OI")])
5041 (define_expand "avx_cvtpd2dq256_2"
5042 [(set (match_operand:V8SI 0 "register_operand")
5044 (unspec:V4SI [(match_operand:V4DF 1 "nonimmediate_operand")]
5048 "operands[2] = CONST0_RTX (V4SImode);")
5050 (define_insn "*avx_cvtpd2dq256_2"
5051 [(set (match_operand:V8SI 0 "register_operand" "=v")
5053 (unspec:V4SI [(match_operand:V4DF 1 "nonimmediate_operand" "vm")]
5055 (match_operand:V4SI 2 "const0_operand")))]
5057 "vcvtpd2dq{y}\t{%1, %x0|%x0, %1}"
5058 [(set_attr "type" "ssecvt")
5059 (set_attr "prefix" "vex")
5060 (set_attr "btver2_decode" "vector")
5061 (set_attr "mode" "OI")])
5063 (define_insn "sse2_cvtpd2dq<mask_name>"
5064 [(set (match_operand:V4SI 0 "register_operand" "=v")
5066 (unspec:V2SI [(match_operand:V2DF 1 "vector_operand" "vBm")]
5068 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
5069 "TARGET_SSE2 && <mask_avx512vl_condition>"
5072 return "vcvtpd2dq{x}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}";
5074 return "cvtpd2dq\t{%1, %0|%0, %1}";
5076 [(set_attr "type" "ssecvt")
5077 (set_attr "prefix_rep" "1")
5078 (set_attr "prefix_data16" "0")
5079 (set_attr "prefix" "maybe_vex")
5080 (set_attr "mode" "TI")
5081 (set_attr "amdfam10_decode" "double")
5082 (set_attr "athlon_decode" "vector")
5083 (set_attr "bdver1_decode" "double")])
5085 ;; For ufix_notrunc* insn patterns
5086 (define_mode_attr pd2udqsuff
5087 [(V8DF "") (V4DF "{y}")])
5089 (define_insn "ufix_notrunc<mode><si2dfmodelower>2<mask_name><round_name>"
5090 [(set (match_operand:<si2dfmode> 0 "register_operand" "=v")
5092 [(match_operand:VF2_512_256VL 1 "nonimmediate_operand" "<round_constraint>")]
5093 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
5095 "vcvtpd2udq<pd2udqsuff>\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5096 [(set_attr "type" "ssecvt")
5097 (set_attr "prefix" "evex")
5098 (set_attr "mode" "<sseinsnmode>")])
5100 (define_insn "ufix_notruncv2dfv2si2<mask_name>"
5101 [(set (match_operand:V4SI 0 "register_operand" "=v")
5104 [(match_operand:V2DF 1 "nonimmediate_operand" "vm")]
5105 UNSPEC_UNSIGNED_FIX_NOTRUNC)
5106 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
5108 "vcvtpd2udq{x}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5109 [(set_attr "type" "ssecvt")
5110 (set_attr "prefix" "evex")
5111 (set_attr "mode" "TI")])
5113 (define_insn "fix<fixunssuffix>_truncv8dfv8si2<mask_name><round_saeonly_name>"
5114 [(set (match_operand:V8SI 0 "register_operand" "=v")
5116 (match_operand:V8DF 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
5118 "vcvttpd2<fixsuffix>dq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
5119 [(set_attr "type" "ssecvt")
5120 (set_attr "prefix" "evex")
5121 (set_attr "mode" "OI")])
5123 (define_insn "ufix_truncv2dfv2si2<mask_name>"
5124 [(set (match_operand:V4SI 0 "register_operand" "=v")
5126 (unsigned_fix:V2SI (match_operand:V2DF 1 "nonimmediate_operand" "vm"))
5127 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
5129 "vcvttpd2udq{x}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5130 [(set_attr "type" "ssecvt")
5131 (set_attr "prefix" "evex")
5132 (set_attr "mode" "TI")])
5134 (define_insn "fix_truncv4dfv4si2<mask_name>"
5135 [(set (match_operand:V4SI 0 "register_operand" "=v")
5136 (fix:V4SI (match_operand:V4DF 1 "nonimmediate_operand" "vm")))]
5137 "TARGET_AVX || (TARGET_AVX512VL && TARGET_AVX512F)"
5138 "vcvttpd2dq{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5139 [(set_attr "type" "ssecvt")
5140 (set_attr "prefix" "maybe_evex")
5141 (set_attr "mode" "OI")])
5143 (define_insn "ufix_truncv4dfv4si2<mask_name>"
5144 [(set (match_operand:V4SI 0 "register_operand" "=v")
5145 (unsigned_fix:V4SI (match_operand:V4DF 1 "nonimmediate_operand" "vm")))]
5146 "TARGET_AVX512VL && TARGET_AVX512F"
5147 "vcvttpd2udq{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5148 [(set_attr "type" "ssecvt")
5149 (set_attr "prefix" "maybe_evex")
5150 (set_attr "mode" "OI")])
5152 (define_insn "fix<fixunssuffix>_trunc<mode><sseintvecmodelower>2<mask_name><round_saeonly_name>"
5153 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
5154 (any_fix:<sseintvecmode>
5155 (match_operand:VF2_AVX512VL 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
5156 "TARGET_AVX512DQ && <round_saeonly_mode512bit_condition>"
5157 "vcvttpd2<fixsuffix>qq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
5158 [(set_attr "type" "ssecvt")
5159 (set_attr "prefix" "evex")
5160 (set_attr "mode" "<sseintvecmode2>")])
5162 (define_insn "fix_notrunc<mode><sseintvecmodelower>2<mask_name><round_name>"
5163 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
5164 (unspec:<sseintvecmode>
5165 [(match_operand:VF2_AVX512VL 1 "<round_nimm_predicate>" "<round_constraint>")]
5166 UNSPEC_FIX_NOTRUNC))]
5167 "TARGET_AVX512DQ && <round_mode512bit_condition>"
5168 "vcvtpd2qq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5169 [(set_attr "type" "ssecvt")
5170 (set_attr "prefix" "evex")
5171 (set_attr "mode" "<sseintvecmode2>")])
5173 (define_insn "ufix_notrunc<mode><sseintvecmodelower>2<mask_name><round_name>"
5174 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
5175 (unspec:<sseintvecmode>
5176 [(match_operand:VF2_AVX512VL 1 "nonimmediate_operand" "<round_constraint>")]
5177 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
5178 "TARGET_AVX512DQ && <round_mode512bit_condition>"
5179 "vcvtpd2uqq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5180 [(set_attr "type" "ssecvt")
5181 (set_attr "prefix" "evex")
5182 (set_attr "mode" "<sseintvecmode2>")])
5184 (define_insn "fix<fixunssuffix>_trunc<mode><sselongvecmodelower>2<mask_name><round_saeonly_name>"
5185 [(set (match_operand:<sselongvecmode> 0 "register_operand" "=v")
5186 (any_fix:<sselongvecmode>
5187 (match_operand:VF1_128_256VL 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
5188 "TARGET_AVX512DQ && <round_saeonly_modev8sf_condition>"
5189 "vcvttps2<fixsuffix>qq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
5190 [(set_attr "type" "ssecvt")
5191 (set_attr "prefix" "evex")
5192 (set_attr "mode" "<sseintvecmode3>")])
5194 (define_insn "fix<fixunssuffix>_truncv2sfv2di2<mask_name>"
5195 [(set (match_operand:V2DI 0 "register_operand" "=v")
5198 (match_operand:V4SF 1 "nonimmediate_operand" "vm")
5199 (parallel [(const_int 0) (const_int 1)]))))]
5200 "TARGET_AVX512DQ && TARGET_AVX512VL"
5201 "vcvttps2<fixsuffix>qq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
5202 [(set_attr "type" "ssecvt")
5203 (set_attr "prefix" "evex")
5204 (set_attr "mode" "TI")])
5206 (define_mode_attr vunpckfixt_mode
5207 [(V16SF "V8DI") (V8SF "V4DI") (V4SF "V2DI")])
5208 (define_mode_attr vunpckfixt_model
5209 [(V16SF "v8di") (V8SF "v4di") (V4SF "v2di")])
5210 (define_mode_attr vunpckfixt_extract_mode
5211 [(V16SF "v16sf") (V8SF "v8sf") (V4SF "v8sf")])
5213 (define_expand "vec_unpack_<fixprefix>fix_trunc_lo_<mode>"
5214 [(match_operand:<vunpckfixt_mode> 0 "register_operand")
5215 (any_fix:<vunpckfixt_mode>
5216 (match_operand:VF1_AVX512VL 1 "register_operand"))]
5219 rtx tem = operands[1];
5220 if (<MODE>mode != V4SFmode)
5222 tem = gen_reg_rtx (<ssehalfvecmode>mode);
5223 emit_insn (gen_vec_extract_lo_<vunpckfixt_extract_mode> (tem,
5226 rtx (*gen) (rtx, rtx)
5227 = gen_fix<fixunssuffix>_trunc<ssehalfvecmodelower><vunpckfixt_model>2;
5228 emit_insn (gen (operands[0], tem));
5232 (define_expand "vec_unpack_<fixprefix>fix_trunc_hi_<mode>"
5233 [(match_operand:<vunpckfixt_mode> 0 "register_operand")
5234 (any_fix:<vunpckfixt_mode>
5235 (match_operand:VF1_AVX512VL 1 "register_operand"))]
5239 if (<MODE>mode != V4SFmode)
5241 tem = gen_reg_rtx (<ssehalfvecmode>mode);
5242 emit_insn (gen_vec_extract_hi_<vunpckfixt_extract_mode> (tem,
5247 tem = gen_reg_rtx (V4SFmode);
5248 emit_insn (gen_avx_vpermilv4sf (tem, operands[1], GEN_INT (0x4e)));
5250 rtx (*gen) (rtx, rtx)
5251 = gen_fix<fixunssuffix>_trunc<ssehalfvecmodelower><vunpckfixt_model>2;
5252 emit_insn (gen (operands[0], tem));
5256 (define_insn "ufix_trunc<mode><sseintvecmodelower>2<mask_name>"
5257 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
5258 (unsigned_fix:<sseintvecmode>
5259 (match_operand:VF1_128_256VL 1 "nonimmediate_operand" "vm")))]
5261 "vcvttps2udq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5262 [(set_attr "type" "ssecvt")
5263 (set_attr "prefix" "evex")
5264 (set_attr "mode" "<sseintvecmode2>")])
5266 (define_expand "avx_cvttpd2dq256_2"
5267 [(set (match_operand:V8SI 0 "register_operand")
5269 (fix:V4SI (match_operand:V4DF 1 "nonimmediate_operand"))
5272 "operands[2] = CONST0_RTX (V4SImode);")
5274 (define_insn "sse2_cvttpd2dq<mask_name>"
5275 [(set (match_operand:V4SI 0 "register_operand" "=v")
5277 (fix:V2SI (match_operand:V2DF 1 "vector_operand" "vBm"))
5278 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
5279 "TARGET_SSE2 && <mask_avx512vl_condition>"
5282 return "vcvttpd2dq{x}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}";
5284 return "cvttpd2dq\t{%1, %0|%0, %1}";
5286 [(set_attr "type" "ssecvt")
5287 (set_attr "amdfam10_decode" "double")
5288 (set_attr "athlon_decode" "vector")
5289 (set_attr "bdver1_decode" "double")
5290 (set_attr "prefix" "maybe_vex")
5291 (set_attr "mode" "TI")])
5293 (define_insn "sse2_cvtsd2ss<round_name>"
5294 [(set (match_operand:V4SF 0 "register_operand" "=x,x,v")
5297 (float_truncate:V2SF
5298 (match_operand:V2DF 2 "nonimmediate_operand" "x,m,<round_constraint>")))
5299 (match_operand:V4SF 1 "register_operand" "0,0,v")
5303 cvtsd2ss\t{%2, %0|%0, %2}
5304 cvtsd2ss\t{%2, %0|%0, %q2}
5305 vcvtsd2ss\t{<round_op3>%2, %1, %0|%0, %1, %q2<round_op3>}"
5306 [(set_attr "isa" "noavx,noavx,avx")
5307 (set_attr "type" "ssecvt")
5308 (set_attr "athlon_decode" "vector,double,*")
5309 (set_attr "amdfam10_decode" "vector,double,*")
5310 (set_attr "bdver1_decode" "direct,direct,*")
5311 (set_attr "btver2_decode" "double,double,double")
5312 (set_attr "prefix" "orig,orig,<round_prefix>")
5313 (set_attr "mode" "SF")])
5315 (define_insn "*sse2_vd_cvtsd2ss"
5316 [(set (match_operand:V4SF 0 "register_operand" "=x,x,v")
5319 (float_truncate:SF (match_operand:DF 2 "nonimmediate_operand" "x,m,vm")))
5320 (match_operand:V4SF 1 "register_operand" "0,0,v")
5324 cvtsd2ss\t{%2, %0|%0, %2}
5325 cvtsd2ss\t{%2, %0|%0, %2}
5326 vcvtsd2ss\t{%2, %1, %0|%0, %1, %2}"
5327 [(set_attr "isa" "noavx,noavx,avx")
5328 (set_attr "type" "ssecvt")
5329 (set_attr "athlon_decode" "vector,double,*")
5330 (set_attr "amdfam10_decode" "vector,double,*")
5331 (set_attr "bdver1_decode" "direct,direct,*")
5332 (set_attr "btver2_decode" "double,double,double")
5333 (set_attr "prefix" "orig,orig,vex")
5334 (set_attr "mode" "SF")])
5336 (define_insn "sse2_cvtss2sd<round_saeonly_name>"
5337 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
5341 (match_operand:V4SF 2 "<round_saeonly_nimm_scalar_predicate>" "x,m,<round_saeonly_constraint>")
5342 (parallel [(const_int 0) (const_int 1)])))
5343 (match_operand:V2DF 1 "register_operand" "0,0,v")
5347 cvtss2sd\t{%2, %0|%0, %2}
5348 cvtss2sd\t{%2, %0|%0, %k2}
5349 vcvtss2sd\t{<round_saeonly_op3>%2, %1, %0|%0, %1, %k2<round_saeonly_op3>}"
5350 [(set_attr "isa" "noavx,noavx,avx")
5351 (set_attr "type" "ssecvt")
5352 (set_attr "amdfam10_decode" "vector,double,*")
5353 (set_attr "athlon_decode" "direct,direct,*")
5354 (set_attr "bdver1_decode" "direct,direct,*")
5355 (set_attr "btver2_decode" "double,double,double")
5356 (set_attr "prefix" "orig,orig,<round_saeonly_prefix>")
5357 (set_attr "mode" "DF")])
5359 (define_insn "*sse2_vd_cvtss2sd"
5360 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
5363 (float_extend:DF (match_operand:SF 2 "nonimmediate_operand" "x,m,vm")))
5364 (match_operand:V2DF 1 "register_operand" "0,0,v")
5368 cvtss2sd\t{%2, %0|%0, %2}
5369 cvtss2sd\t{%2, %0|%0, %2}
5370 vcvtss2sd\t{%2, %1, %0|%0, %1, %2}"
5371 [(set_attr "isa" "noavx,noavx,avx")
5372 (set_attr "type" "ssecvt")
5373 (set_attr "amdfam10_decode" "vector,double,*")
5374 (set_attr "athlon_decode" "direct,direct,*")
5375 (set_attr "bdver1_decode" "direct,direct,*")
5376 (set_attr "btver2_decode" "double,double,double")
5377 (set_attr "prefix" "orig,orig,vex")
5378 (set_attr "mode" "DF")])
5380 (define_insn "<mask_codefor>avx512f_cvtpd2ps512<mask_name><round_name>"
5381 [(set (match_operand:V8SF 0 "register_operand" "=v")
5382 (float_truncate:V8SF
5383 (match_operand:V8DF 1 "<round_nimm_predicate>" "<round_constraint>")))]
5385 "vcvtpd2ps\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5386 [(set_attr "type" "ssecvt")
5387 (set_attr "prefix" "evex")
5388 (set_attr "mode" "V8SF")])
5390 (define_insn "avx_cvtpd2ps256<mask_name>"
5391 [(set (match_operand:V4SF 0 "register_operand" "=v")
5392 (float_truncate:V4SF
5393 (match_operand:V4DF 1 "nonimmediate_operand" "vm")))]
5394 "TARGET_AVX && <mask_avx512vl_condition>"
5395 "vcvtpd2ps{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5396 [(set_attr "type" "ssecvt")
5397 (set_attr "prefix" "maybe_evex")
5398 (set_attr "btver2_decode" "vector")
5399 (set_attr "mode" "V4SF")])
5401 (define_expand "sse2_cvtpd2ps"
5402 [(set (match_operand:V4SF 0 "register_operand")
5404 (float_truncate:V2SF
5405 (match_operand:V2DF 1 "vector_operand"))
5408 "operands[2] = CONST0_RTX (V2SFmode);")
5410 (define_expand "sse2_cvtpd2ps_mask"
5411 [(set (match_operand:V4SF 0 "register_operand")
5414 (float_truncate:V2SF
5415 (match_operand:V2DF 1 "vector_operand"))
5417 (match_operand:V4SF 2 "register_operand")
5418 (match_operand:QI 3 "register_operand")))]
5420 "operands[4] = CONST0_RTX (V2SFmode);")
5422 (define_insn "*sse2_cvtpd2ps<mask_name>"
5423 [(set (match_operand:V4SF 0 "register_operand" "=v")
5425 (float_truncate:V2SF
5426 (match_operand:V2DF 1 "vector_operand" "vBm"))
5427 (match_operand:V2SF 2 "const0_operand")))]
5428 "TARGET_SSE2 && <mask_avx512vl_condition>"
5431 return "vcvtpd2ps{x}\t{%1, %0<mask_operand3>|%0<mask_operand3>, %1}";
5433 return "cvtpd2ps\t{%1, %0|%0, %1}";
5435 [(set_attr "type" "ssecvt")
5436 (set_attr "amdfam10_decode" "double")
5437 (set_attr "athlon_decode" "vector")
5438 (set_attr "bdver1_decode" "double")
5439 (set_attr "prefix_data16" "1")
5440 (set_attr "prefix" "maybe_vex")
5441 (set_attr "mode" "V4SF")])
5443 ;; For <sse2_avx_avx512f>_cvtps2pd<avxsizesuffix> insn pattern
5444 (define_mode_attr sf2dfmode
5445 [(V8DF "V8SF") (V4DF "V4SF")])
5447 (define_insn "<sse2_avx_avx512f>_cvtps2pd<avxsizesuffix><mask_name><round_saeonly_name>"
5448 [(set (match_operand:VF2_512_256 0 "register_operand" "=v")
5449 (float_extend:VF2_512_256
5450 (match_operand:<sf2dfmode> 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
5451 "TARGET_AVX && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
5452 "vcvtps2pd\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
5453 [(set_attr "type" "ssecvt")
5454 (set_attr "prefix" "maybe_vex")
5455 (set_attr "mode" "<MODE>")])
5457 (define_insn "*avx_cvtps2pd256_2"
5458 [(set (match_operand:V4DF 0 "register_operand" "=v")
5461 (match_operand:V8SF 1 "nonimmediate_operand" "vm")
5462 (parallel [(const_int 0) (const_int 1)
5463 (const_int 2) (const_int 3)]))))]
5465 "vcvtps2pd\t{%x1, %0|%0, %x1}"
5466 [(set_attr "type" "ssecvt")
5467 (set_attr "prefix" "vex")
5468 (set_attr "mode" "V4DF")])
5470 (define_insn "vec_unpacks_lo_v16sf"
5471 [(set (match_operand:V8DF 0 "register_operand" "=v")
5474 (match_operand:V16SF 1 "nonimmediate_operand" "vm")
5475 (parallel [(const_int 0) (const_int 1)
5476 (const_int 2) (const_int 3)
5477 (const_int 4) (const_int 5)
5478 (const_int 6) (const_int 7)]))))]
5480 "vcvtps2pd\t{%t1, %0|%0, %t1}"
5481 [(set_attr "type" "ssecvt")
5482 (set_attr "prefix" "evex")
5483 (set_attr "mode" "V8DF")])
5485 (define_insn "<avx512>_cvt<ssemodesuffix>2mask<mode>"
5486 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
5487 (unspec:<avx512fmaskmode>
5488 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")]
5489 UNSPEC_CVTINT2MASK))]
5491 "vpmov<ssemodesuffix>2m\t{%1, %0|%0, %1}"
5492 [(set_attr "prefix" "evex")
5493 (set_attr "mode" "<sseinsnmode>")])
5495 (define_insn "<avx512>_cvt<ssemodesuffix>2mask<mode>"
5496 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
5497 (unspec:<avx512fmaskmode>
5498 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")]
5499 UNSPEC_CVTINT2MASK))]
5501 "vpmov<ssemodesuffix>2m\t{%1, %0|%0, %1}"
5502 [(set_attr "prefix" "evex")
5503 (set_attr "mode" "<sseinsnmode>")])
5505 (define_expand "<avx512>_cvtmask2<ssemodesuffix><mode>"
5506 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
5507 (vec_merge:VI12_AVX512VL
5510 (match_operand:<avx512fmaskmode> 1 "register_operand")))]
5513 operands[2] = CONSTM1_RTX (<MODE>mode);
5514 operands[3] = CONST0_RTX (<MODE>mode);
5517 (define_insn "*<avx512>_cvtmask2<ssemodesuffix><mode>"
5518 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
5519 (vec_merge:VI12_AVX512VL
5520 (match_operand:VI12_AVX512VL 2 "vector_all_ones_operand")
5521 (match_operand:VI12_AVX512VL 3 "const0_operand")
5522 (match_operand:<avx512fmaskmode> 1 "register_operand" "Yk")))]
5524 "vpmovm2<ssemodesuffix>\t{%1, %0|%0, %1}"
5525 [(set_attr "prefix" "evex")
5526 (set_attr "mode" "<sseinsnmode>")])
5528 (define_expand "<avx512>_cvtmask2<ssemodesuffix><mode>"
5529 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
5530 (vec_merge:VI48_AVX512VL
5533 (match_operand:<avx512fmaskmode> 1 "register_operand")))]
5536 operands[2] = CONSTM1_RTX (<MODE>mode);
5537 operands[3] = CONST0_RTX (<MODE>mode);
5540 (define_insn "*<avx512>_cvtmask2<ssemodesuffix><mode>"
5541 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
5542 (vec_merge:VI48_AVX512VL
5543 (match_operand:VI48_AVX512VL 2 "vector_all_ones_operand")
5544 (match_operand:VI48_AVX512VL 3 "const0_operand")
5545 (match_operand:<avx512fmaskmode> 1 "register_operand" "Yk")))]
5547 "vpmovm2<ssemodesuffix>\t{%1, %0|%0, %1}"
5548 [(set_attr "prefix" "evex")
5549 (set_attr "mode" "<sseinsnmode>")])
5551 (define_insn "sse2_cvtps2pd<mask_name>"
5552 [(set (match_operand:V2DF 0 "register_operand" "=v")
5555 (match_operand:V4SF 1 "vector_operand" "vm")
5556 (parallel [(const_int 0) (const_int 1)]))))]
5557 "TARGET_SSE2 && <mask_avx512vl_condition>"
5558 "%vcvtps2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
5559 [(set_attr "type" "ssecvt")
5560 (set_attr "amdfam10_decode" "direct")
5561 (set_attr "athlon_decode" "double")
5562 (set_attr "bdver1_decode" "double")
5563 (set_attr "prefix_data16" "0")
5564 (set_attr "prefix" "maybe_vex")
5565 (set_attr "mode" "V2DF")])
5567 (define_expand "vec_unpacks_hi_v4sf"
5572 (match_operand:V4SF 1 "vector_operand"))
5573 (parallel [(const_int 6) (const_int 7)
5574 (const_int 2) (const_int 3)])))
5575 (set (match_operand:V2DF 0 "register_operand")
5579 (parallel [(const_int 0) (const_int 1)]))))]
5581 "operands[2] = gen_reg_rtx (V4SFmode);")
5583 (define_expand "vec_unpacks_hi_v8sf"
5586 (match_operand:V8SF 1 "register_operand")
5587 (parallel [(const_int 4) (const_int 5)
5588 (const_int 6) (const_int 7)])))
5589 (set (match_operand:V4DF 0 "register_operand")
5593 "operands[2] = gen_reg_rtx (V4SFmode);")
5595 (define_expand "vec_unpacks_hi_v16sf"
5598 (match_operand:V16SF 1 "register_operand")
5599 (parallel [(const_int 8) (const_int 9)
5600 (const_int 10) (const_int 11)
5601 (const_int 12) (const_int 13)
5602 (const_int 14) (const_int 15)])))
5603 (set (match_operand:V8DF 0 "register_operand")
5607 "operands[2] = gen_reg_rtx (V8SFmode);")
5609 (define_expand "vec_unpacks_lo_v4sf"
5610 [(set (match_operand:V2DF 0 "register_operand")
5613 (match_operand:V4SF 1 "vector_operand")
5614 (parallel [(const_int 0) (const_int 1)]))))]
5617 (define_expand "vec_unpacks_lo_v8sf"
5618 [(set (match_operand:V4DF 0 "register_operand")
5621 (match_operand:V8SF 1 "nonimmediate_operand")
5622 (parallel [(const_int 0) (const_int 1)
5623 (const_int 2) (const_int 3)]))))]
5626 (define_mode_attr sseunpackfltmode
5627 [(V8HI "V4SF") (V4SI "V2DF") (V16HI "V8SF")
5628 (V8SI "V4DF") (V32HI "V16SF") (V16SI "V8DF")])
5630 (define_expand "vec_unpacks_float_hi_<mode>"
5631 [(match_operand:<sseunpackfltmode> 0 "register_operand")
5632 (match_operand:VI2_AVX512F 1 "register_operand")]
5635 rtx tmp = gen_reg_rtx (<sseunpackmode>mode);
5637 emit_insn (gen_vec_unpacks_hi_<mode> (tmp, operands[1]));
5638 emit_insn (gen_rtx_SET (operands[0],
5639 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
5643 (define_expand "vec_unpacks_float_lo_<mode>"
5644 [(match_operand:<sseunpackfltmode> 0 "register_operand")
5645 (match_operand:VI2_AVX512F 1 "register_operand")]
5648 rtx tmp = gen_reg_rtx (<sseunpackmode>mode);
5650 emit_insn (gen_vec_unpacks_lo_<mode> (tmp, operands[1]));
5651 emit_insn (gen_rtx_SET (operands[0],
5652 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
5656 (define_expand "vec_unpacku_float_hi_<mode>"
5657 [(match_operand:<sseunpackfltmode> 0 "register_operand")
5658 (match_operand:VI2_AVX512F 1 "register_operand")]
5661 rtx tmp = gen_reg_rtx (<sseunpackmode>mode);
5663 emit_insn (gen_vec_unpacku_hi_<mode> (tmp, operands[1]));
5664 emit_insn (gen_rtx_SET (operands[0],
5665 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
5669 (define_expand "vec_unpacku_float_lo_<mode>"
5670 [(match_operand:<sseunpackfltmode> 0 "register_operand")
5671 (match_operand:VI2_AVX512F 1 "register_operand")]
5674 rtx tmp = gen_reg_rtx (<sseunpackmode>mode);
5676 emit_insn (gen_vec_unpacku_lo_<mode> (tmp, operands[1]));
5677 emit_insn (gen_rtx_SET (operands[0],
5678 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
5682 (define_expand "vec_unpacks_float_hi_v4si"
5685 (match_operand:V4SI 1 "vector_operand")
5686 (parallel [(const_int 2) (const_int 3)
5687 (const_int 2) (const_int 3)])))
5688 (set (match_operand:V2DF 0 "register_operand")
5692 (parallel [(const_int 0) (const_int 1)]))))]
5694 "operands[2] = gen_reg_rtx (V4SImode);")
5696 (define_expand "vec_unpacks_float_lo_v4si"
5697 [(set (match_operand:V2DF 0 "register_operand")
5700 (match_operand:V4SI 1 "vector_operand")
5701 (parallel [(const_int 0) (const_int 1)]))))]
5704 (define_expand "vec_unpacks_float_hi_v8si"
5707 (match_operand:V8SI 1 "vector_operand")
5708 (parallel [(const_int 4) (const_int 5)
5709 (const_int 6) (const_int 7)])))
5710 (set (match_operand:V4DF 0 "register_operand")
5714 "operands[2] = gen_reg_rtx (V4SImode);")
5716 (define_expand "vec_unpacks_float_lo_v8si"
5717 [(set (match_operand:V4DF 0 "register_operand")
5720 (match_operand:V8SI 1 "nonimmediate_operand")
5721 (parallel [(const_int 0) (const_int 1)
5722 (const_int 2) (const_int 3)]))))]
5725 (define_expand "vec_unpacks_float_hi_v16si"
5728 (match_operand:V16SI 1 "nonimmediate_operand")
5729 (parallel [(const_int 8) (const_int 9)
5730 (const_int 10) (const_int 11)
5731 (const_int 12) (const_int 13)
5732 (const_int 14) (const_int 15)])))
5733 (set (match_operand:V8DF 0 "register_operand")
5737 "operands[2] = gen_reg_rtx (V8SImode);")
5739 (define_expand "vec_unpacks_float_lo_v16si"
5740 [(set (match_operand:V8DF 0 "register_operand")
5743 (match_operand:V16SI 1 "nonimmediate_operand")
5744 (parallel [(const_int 0) (const_int 1)
5745 (const_int 2) (const_int 3)
5746 (const_int 4) (const_int 5)
5747 (const_int 6) (const_int 7)]))))]
5750 (define_expand "vec_unpacku_float_hi_v4si"
5753 (match_operand:V4SI 1 "vector_operand")
5754 (parallel [(const_int 2) (const_int 3)
5755 (const_int 2) (const_int 3)])))
5760 (parallel [(const_int 0) (const_int 1)]))))
5762 (lt:V2DF (match_dup 6) (match_dup 3)))
5764 (and:V2DF (match_dup 7) (match_dup 4)))
5765 (set (match_operand:V2DF 0 "register_operand")
5766 (plus:V2DF (match_dup 6) (match_dup 8)))]
5769 REAL_VALUE_TYPE TWO32r;
5773 real_ldexp (&TWO32r, &dconst1, 32);
5774 x = const_double_from_real_value (TWO32r, DFmode);
5776 operands[3] = force_reg (V2DFmode, CONST0_RTX (V2DFmode));
5777 operands[4] = force_reg (V2DFmode,
5778 ix86_build_const_vector (V2DFmode, 1, x));
5780 operands[5] = gen_reg_rtx (V4SImode);
5782 for (i = 6; i < 9; i++)
5783 operands[i] = gen_reg_rtx (V2DFmode);
5786 (define_expand "vec_unpacku_float_lo_v4si"
5790 (match_operand:V4SI 1 "vector_operand")
5791 (parallel [(const_int 0) (const_int 1)]))))
5793 (lt:V2DF (match_dup 5) (match_dup 3)))
5795 (and:V2DF (match_dup 6) (match_dup 4)))
5796 (set (match_operand:V2DF 0 "register_operand")
5797 (plus:V2DF (match_dup 5) (match_dup 7)))]
5800 REAL_VALUE_TYPE TWO32r;
5804 real_ldexp (&TWO32r, &dconst1, 32);
5805 x = const_double_from_real_value (TWO32r, DFmode);
5807 operands[3] = force_reg (V2DFmode, CONST0_RTX (V2DFmode));
5808 operands[4] = force_reg (V2DFmode,
5809 ix86_build_const_vector (V2DFmode, 1, x));
5811 for (i = 5; i < 8; i++)
5812 operands[i] = gen_reg_rtx (V2DFmode);
5815 (define_expand "vec_unpacku_float_hi_v8si"
5816 [(match_operand:V4DF 0 "register_operand")
5817 (match_operand:V8SI 1 "register_operand")]
5820 REAL_VALUE_TYPE TWO32r;
5824 real_ldexp (&TWO32r, &dconst1, 32);
5825 x = const_double_from_real_value (TWO32r, DFmode);
5827 tmp[0] = force_reg (V4DFmode, CONST0_RTX (V4DFmode));
5828 tmp[1] = force_reg (V4DFmode, ix86_build_const_vector (V4DFmode, 1, x));
5829 tmp[5] = gen_reg_rtx (V4SImode);
5831 for (i = 2; i < 5; i++)
5832 tmp[i] = gen_reg_rtx (V4DFmode);
5833 emit_insn (gen_vec_extract_hi_v8si (tmp[5], operands[1]));
5834 emit_insn (gen_floatv4siv4df2 (tmp[2], tmp[5]));
5835 emit_insn (gen_rtx_SET (tmp[3], gen_rtx_LT (V4DFmode, tmp[2], tmp[0])));
5836 emit_insn (gen_andv4df3 (tmp[4], tmp[3], tmp[1]));
5837 emit_insn (gen_addv4df3 (operands[0], tmp[2], tmp[4]));
5841 (define_expand "vec_unpacku_float_hi_v16si"
5842 [(match_operand:V8DF 0 "register_operand")
5843 (match_operand:V16SI 1 "register_operand")]
5846 REAL_VALUE_TYPE TWO32r;
5849 real_ldexp (&TWO32r, &dconst1, 32);
5850 x = const_double_from_real_value (TWO32r, DFmode);
5852 tmp[0] = force_reg (V8DFmode, CONST0_RTX (V8DFmode));
5853 tmp[1] = force_reg (V8DFmode, ix86_build_const_vector (V8DFmode, 1, x));
5854 tmp[2] = gen_reg_rtx (V8DFmode);
5855 tmp[3] = gen_reg_rtx (V8SImode);
5856 k = gen_reg_rtx (QImode);
5858 emit_insn (gen_vec_extract_hi_v16si (tmp[3], operands[1]));
5859 emit_insn (gen_floatv8siv8df2 (tmp[2], tmp[3]));
5860 emit_insn (gen_rtx_SET (k, gen_rtx_LT (QImode, tmp[2], tmp[0])));
5861 emit_insn (gen_addv8df3_mask (tmp[2], tmp[2], tmp[1], tmp[2], k));
5862 emit_move_insn (operands[0], tmp[2]);
5866 (define_expand "vec_unpacku_float_lo_v8si"
5867 [(match_operand:V4DF 0 "register_operand")
5868 (match_operand:V8SI 1 "nonimmediate_operand")]
5871 REAL_VALUE_TYPE TWO32r;
5875 real_ldexp (&TWO32r, &dconst1, 32);
5876 x = const_double_from_real_value (TWO32r, DFmode);
5878 tmp[0] = force_reg (V4DFmode, CONST0_RTX (V4DFmode));
5879 tmp[1] = force_reg (V4DFmode, ix86_build_const_vector (V4DFmode, 1, x));
5881 for (i = 2; i < 5; i++)
5882 tmp[i] = gen_reg_rtx (V4DFmode);
5883 emit_insn (gen_avx_cvtdq2pd256_2 (tmp[2], operands[1]));
5884 emit_insn (gen_rtx_SET (tmp[3], gen_rtx_LT (V4DFmode, tmp[2], tmp[0])));
5885 emit_insn (gen_andv4df3 (tmp[4], tmp[3], tmp[1]));
5886 emit_insn (gen_addv4df3 (operands[0], tmp[2], tmp[4]));
5890 (define_expand "vec_unpacku_float_lo_v16si"
5891 [(match_operand:V8DF 0 "register_operand")
5892 (match_operand:V16SI 1 "nonimmediate_operand")]
5895 REAL_VALUE_TYPE TWO32r;
5898 real_ldexp (&TWO32r, &dconst1, 32);
5899 x = const_double_from_real_value (TWO32r, DFmode);
5901 tmp[0] = force_reg (V8DFmode, CONST0_RTX (V8DFmode));
5902 tmp[1] = force_reg (V8DFmode, ix86_build_const_vector (V8DFmode, 1, x));
5903 tmp[2] = gen_reg_rtx (V8DFmode);
5904 k = gen_reg_rtx (QImode);
5906 emit_insn (gen_avx512f_cvtdq2pd512_2 (tmp[2], operands[1]));
5907 emit_insn (gen_rtx_SET (k, gen_rtx_LT (QImode, tmp[2], tmp[0])));
5908 emit_insn (gen_addv8df3_mask (tmp[2], tmp[2], tmp[1], tmp[2], k));
5909 emit_move_insn (operands[0], tmp[2]);
5913 (define_expand "vec_pack_trunc_<mode>"
5915 (float_truncate:<sf2dfmode>
5916 (match_operand:VF2_512_256 1 "nonimmediate_operand")))
5918 (float_truncate:<sf2dfmode>
5919 (match_operand:VF2_512_256 2 "nonimmediate_operand")))
5920 (set (match_operand:<ssePSmode> 0 "register_operand")
5921 (vec_concat:<ssePSmode>
5926 operands[3] = gen_reg_rtx (<sf2dfmode>mode);
5927 operands[4] = gen_reg_rtx (<sf2dfmode>mode);
5930 (define_expand "vec_pack_trunc_v2df"
5931 [(match_operand:V4SF 0 "register_operand")
5932 (match_operand:V2DF 1 "vector_operand")
5933 (match_operand:V2DF 2 "vector_operand")]
5938 if (TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
5940 tmp0 = gen_reg_rtx (V4DFmode);
5941 tmp1 = force_reg (V2DFmode, operands[1]);
5943 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
5944 emit_insn (gen_avx_cvtpd2ps256 (operands[0], tmp0));
5948 tmp0 = gen_reg_rtx (V4SFmode);
5949 tmp1 = gen_reg_rtx (V4SFmode);
5951 emit_insn (gen_sse2_cvtpd2ps (tmp0, operands[1]));
5952 emit_insn (gen_sse2_cvtpd2ps (tmp1, operands[2]));
5953 emit_insn (gen_sse_movlhps (operands[0], tmp0, tmp1));
5958 (define_expand "vec_pack_sfix_trunc_v8df"
5959 [(match_operand:V16SI 0 "register_operand")
5960 (match_operand:V8DF 1 "nonimmediate_operand")
5961 (match_operand:V8DF 2 "nonimmediate_operand")]
5966 r1 = gen_reg_rtx (V8SImode);
5967 r2 = gen_reg_rtx (V8SImode);
5969 emit_insn (gen_fix_truncv8dfv8si2 (r1, operands[1]));
5970 emit_insn (gen_fix_truncv8dfv8si2 (r2, operands[2]));
5971 emit_insn (gen_avx_vec_concatv16si (operands[0], r1, r2));
5975 (define_expand "vec_pack_sfix_trunc_v4df"
5976 [(match_operand:V8SI 0 "register_operand")
5977 (match_operand:V4DF 1 "nonimmediate_operand")
5978 (match_operand:V4DF 2 "nonimmediate_operand")]
5983 r1 = gen_reg_rtx (V4SImode);
5984 r2 = gen_reg_rtx (V4SImode);
5986 emit_insn (gen_fix_truncv4dfv4si2 (r1, operands[1]));
5987 emit_insn (gen_fix_truncv4dfv4si2 (r2, operands[2]));
5988 emit_insn (gen_avx_vec_concatv8si (operands[0], r1, r2));
5992 (define_expand "vec_pack_sfix_trunc_v2df"
5993 [(match_operand:V4SI 0 "register_operand")
5994 (match_operand:V2DF 1 "vector_operand")
5995 (match_operand:V2DF 2 "vector_operand")]
5998 rtx tmp0, tmp1, tmp2;
6000 if (TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
6002 tmp0 = gen_reg_rtx (V4DFmode);
6003 tmp1 = force_reg (V2DFmode, operands[1]);
6005 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
6006 emit_insn (gen_fix_truncv4dfv4si2 (operands[0], tmp0));
6010 tmp0 = gen_reg_rtx (V4SImode);
6011 tmp1 = gen_reg_rtx (V4SImode);
6012 tmp2 = gen_reg_rtx (V2DImode);
6014 emit_insn (gen_sse2_cvttpd2dq (tmp0, operands[1]));
6015 emit_insn (gen_sse2_cvttpd2dq (tmp1, operands[2]));
6016 emit_insn (gen_vec_interleave_lowv2di (tmp2,
6017 gen_lowpart (V2DImode, tmp0),
6018 gen_lowpart (V2DImode, tmp1)));
6019 emit_move_insn (operands[0], gen_lowpart (V4SImode, tmp2));
6024 (define_mode_attr ssepackfltmode
6025 [(V8DF "V16SI") (V4DF "V8SI") (V2DF "V4SI")])
6027 (define_expand "vec_pack_ufix_trunc_<mode>"
6028 [(match_operand:<ssepackfltmode> 0 "register_operand")
6029 (match_operand:VF2 1 "register_operand")
6030 (match_operand:VF2 2 "register_operand")]
6033 if (<MODE>mode == V8DFmode)
6037 r1 = gen_reg_rtx (V8SImode);
6038 r2 = gen_reg_rtx (V8SImode);
6040 emit_insn (gen_fixuns_truncv8dfv8si2 (r1, operands[1]));
6041 emit_insn (gen_fixuns_truncv8dfv8si2 (r2, operands[2]));
6042 emit_insn (gen_avx_vec_concatv16si (operands[0], r1, r2));
6047 tmp[0] = ix86_expand_adjust_ufix_to_sfix_si (operands[1], &tmp[2]);
6048 tmp[1] = ix86_expand_adjust_ufix_to_sfix_si (operands[2], &tmp[3]);
6049 tmp[4] = gen_reg_rtx (<ssepackfltmode>mode);
6050 emit_insn (gen_vec_pack_sfix_trunc_<mode> (tmp[4], tmp[0], tmp[1]));
6051 if (<ssepackfltmode>mode == V4SImode || TARGET_AVX2)
6053 tmp[5] = gen_reg_rtx (<ssepackfltmode>mode);
6054 ix86_expand_vec_extract_even_odd (tmp[5], tmp[2], tmp[3], 0);
6058 tmp[5] = gen_reg_rtx (V8SFmode);
6059 ix86_expand_vec_extract_even_odd (tmp[5],
6060 gen_lowpart (V8SFmode, tmp[2]),
6061 gen_lowpart (V8SFmode, tmp[3]), 0);
6062 tmp[5] = gen_lowpart (V8SImode, tmp[5]);
6064 tmp[6] = expand_simple_binop (<ssepackfltmode>mode, XOR, tmp[4], tmp[5],
6065 operands[0], 0, OPTAB_DIRECT);
6066 if (tmp[6] != operands[0])
6067 emit_move_insn (operands[0], tmp[6]);
6073 (define_expand "avx512f_vec_pack_sfix_v8df"
6074 [(match_operand:V16SI 0 "register_operand")
6075 (match_operand:V8DF 1 "nonimmediate_operand")
6076 (match_operand:V8DF 2 "nonimmediate_operand")]
6081 r1 = gen_reg_rtx (V8SImode);
6082 r2 = gen_reg_rtx (V8SImode);
6084 emit_insn (gen_avx512f_cvtpd2dq512 (r1, operands[1]));
6085 emit_insn (gen_avx512f_cvtpd2dq512 (r2, operands[2]));
6086 emit_insn (gen_avx_vec_concatv16si (operands[0], r1, r2));
6090 (define_expand "vec_pack_sfix_v4df"
6091 [(match_operand:V8SI 0 "register_operand")
6092 (match_operand:V4DF 1 "nonimmediate_operand")
6093 (match_operand:V4DF 2 "nonimmediate_operand")]
6098 r1 = gen_reg_rtx (V4SImode);
6099 r2 = gen_reg_rtx (V4SImode);
6101 emit_insn (gen_avx_cvtpd2dq256 (r1, operands[1]));
6102 emit_insn (gen_avx_cvtpd2dq256 (r2, operands[2]));
6103 emit_insn (gen_avx_vec_concatv8si (operands[0], r1, r2));
6107 (define_expand "vec_pack_sfix_v2df"
6108 [(match_operand:V4SI 0 "register_operand")
6109 (match_operand:V2DF 1 "vector_operand")
6110 (match_operand:V2DF 2 "vector_operand")]
6113 rtx tmp0, tmp1, tmp2;
6115 if (TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
6117 tmp0 = gen_reg_rtx (V4DFmode);
6118 tmp1 = force_reg (V2DFmode, operands[1]);
6120 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
6121 emit_insn (gen_avx_cvtpd2dq256 (operands[0], tmp0));
6125 tmp0 = gen_reg_rtx (V4SImode);
6126 tmp1 = gen_reg_rtx (V4SImode);
6127 tmp2 = gen_reg_rtx (V2DImode);
6129 emit_insn (gen_sse2_cvtpd2dq (tmp0, operands[1]));
6130 emit_insn (gen_sse2_cvtpd2dq (tmp1, operands[2]));
6131 emit_insn (gen_vec_interleave_lowv2di (tmp2,
6132 gen_lowpart (V2DImode, tmp0),
6133 gen_lowpart (V2DImode, tmp1)));
6134 emit_move_insn (operands[0], gen_lowpart (V4SImode, tmp2));
6139 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6141 ;; Parallel single-precision floating point element swizzling
6143 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6145 (define_expand "sse_movhlps_exp"
6146 [(set (match_operand:V4SF 0 "nonimmediate_operand")
6149 (match_operand:V4SF 1 "nonimmediate_operand")
6150 (match_operand:V4SF 2 "nonimmediate_operand"))
6151 (parallel [(const_int 6)
6157 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
6159 emit_insn (gen_sse_movhlps (dst, operands[1], operands[2]));
6161 /* Fix up the destination if needed. */
6162 if (dst != operands[0])
6163 emit_move_insn (operands[0], dst);
6168 (define_insn "sse_movhlps"
6169 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,v,x,v,m")
6172 (match_operand:V4SF 1 "nonimmediate_operand" " 0,v,0,v,0")
6173 (match_operand:V4SF 2 "nonimmediate_operand" " x,v,o,o,v"))
6174 (parallel [(const_int 6)
6178 "TARGET_SSE && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
6180 movhlps\t{%2, %0|%0, %2}
6181 vmovhlps\t{%2, %1, %0|%0, %1, %2}
6182 movlps\t{%H2, %0|%0, %H2}
6183 vmovlps\t{%H2, %1, %0|%0, %1, %H2}
6184 %vmovhps\t{%2, %0|%q0, %2}"
6185 [(set_attr "isa" "noavx,avx,noavx,avx,*")
6186 (set_attr "type" "ssemov")
6187 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,maybe_vex")
6188 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF,V2SF")])
6190 (define_expand "sse_movlhps_exp"
6191 [(set (match_operand:V4SF 0 "nonimmediate_operand")
6194 (match_operand:V4SF 1 "nonimmediate_operand")
6195 (match_operand:V4SF 2 "nonimmediate_operand"))
6196 (parallel [(const_int 0)
6202 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
6204 emit_insn (gen_sse_movlhps (dst, operands[1], operands[2]));
6206 /* Fix up the destination if needed. */
6207 if (dst != operands[0])
6208 emit_move_insn (operands[0], dst);
6213 (define_insn "sse_movlhps"
6214 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,v,x,v,o")
6217 (match_operand:V4SF 1 "nonimmediate_operand" " 0,v,0,v,0")
6218 (match_operand:V4SF 2 "nonimmediate_operand" " x,v,m,v,v"))
6219 (parallel [(const_int 0)
6223 "TARGET_SSE && ix86_binary_operator_ok (UNKNOWN, V4SFmode, operands)"
6225 movlhps\t{%2, %0|%0, %2}
6226 vmovlhps\t{%2, %1, %0|%0, %1, %2}
6227 movhps\t{%2, %0|%0, %q2}
6228 vmovhps\t{%2, %1, %0|%0, %1, %q2}
6229 %vmovlps\t{%2, %H0|%H0, %2}"
6230 [(set_attr "isa" "noavx,avx,noavx,avx,*")
6231 (set_attr "type" "ssemov")
6232 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,maybe_vex")
6233 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF,V2SF")])
6235 (define_insn "<mask_codefor>avx512f_unpckhps512<mask_name>"
6236 [(set (match_operand:V16SF 0 "register_operand" "=v")
6239 (match_operand:V16SF 1 "register_operand" "v")
6240 (match_operand:V16SF 2 "nonimmediate_operand" "vm"))
6241 (parallel [(const_int 2) (const_int 18)
6242 (const_int 3) (const_int 19)
6243 (const_int 6) (const_int 22)
6244 (const_int 7) (const_int 23)
6245 (const_int 10) (const_int 26)
6246 (const_int 11) (const_int 27)
6247 (const_int 14) (const_int 30)
6248 (const_int 15) (const_int 31)])))]
6250 "vunpckhps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6251 [(set_attr "type" "sselog")
6252 (set_attr "prefix" "evex")
6253 (set_attr "mode" "V16SF")])
6255 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
6256 (define_insn "avx_unpckhps256<mask_name>"
6257 [(set (match_operand:V8SF 0 "register_operand" "=v")
6260 (match_operand:V8SF 1 "register_operand" "v")
6261 (match_operand:V8SF 2 "nonimmediate_operand" "vm"))
6262 (parallel [(const_int 2) (const_int 10)
6263 (const_int 3) (const_int 11)
6264 (const_int 6) (const_int 14)
6265 (const_int 7) (const_int 15)])))]
6266 "TARGET_AVX && <mask_avx512vl_condition>"
6267 "vunpckhps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6268 [(set_attr "type" "sselog")
6269 (set_attr "prefix" "vex")
6270 (set_attr "mode" "V8SF")])
6272 (define_expand "vec_interleave_highv8sf"
6276 (match_operand:V8SF 1 "register_operand")
6277 (match_operand:V8SF 2 "nonimmediate_operand"))
6278 (parallel [(const_int 0) (const_int 8)
6279 (const_int 1) (const_int 9)
6280 (const_int 4) (const_int 12)
6281 (const_int 5) (const_int 13)])))
6287 (parallel [(const_int 2) (const_int 10)
6288 (const_int 3) (const_int 11)
6289 (const_int 6) (const_int 14)
6290 (const_int 7) (const_int 15)])))
6291 (set (match_operand:V8SF 0 "register_operand")
6296 (parallel [(const_int 4) (const_int 5)
6297 (const_int 6) (const_int 7)
6298 (const_int 12) (const_int 13)
6299 (const_int 14) (const_int 15)])))]
6302 operands[3] = gen_reg_rtx (V8SFmode);
6303 operands[4] = gen_reg_rtx (V8SFmode);
6306 (define_insn "vec_interleave_highv4sf<mask_name>"
6307 [(set (match_operand:V4SF 0 "register_operand" "=x,v")
6310 (match_operand:V4SF 1 "register_operand" "0,v")
6311 (match_operand:V4SF 2 "vector_operand" "xBm,vm"))
6312 (parallel [(const_int 2) (const_int 6)
6313 (const_int 3) (const_int 7)])))]
6314 "TARGET_SSE && <mask_avx512vl_condition>"
6316 unpckhps\t{%2, %0|%0, %2}
6317 vunpckhps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6318 [(set_attr "isa" "noavx,avx")
6319 (set_attr "type" "sselog")
6320 (set_attr "prefix" "orig,vex")
6321 (set_attr "mode" "V4SF")])
6323 (define_insn "<mask_codefor>avx512f_unpcklps512<mask_name>"
6324 [(set (match_operand:V16SF 0 "register_operand" "=v")
6327 (match_operand:V16SF 1 "register_operand" "v")
6328 (match_operand:V16SF 2 "nonimmediate_operand" "vm"))
6329 (parallel [(const_int 0) (const_int 16)
6330 (const_int 1) (const_int 17)
6331 (const_int 4) (const_int 20)
6332 (const_int 5) (const_int 21)
6333 (const_int 8) (const_int 24)
6334 (const_int 9) (const_int 25)
6335 (const_int 12) (const_int 28)
6336 (const_int 13) (const_int 29)])))]
6338 "vunpcklps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6339 [(set_attr "type" "sselog")
6340 (set_attr "prefix" "evex")
6341 (set_attr "mode" "V16SF")])
6343 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
6344 (define_insn "avx_unpcklps256<mask_name>"
6345 [(set (match_operand:V8SF 0 "register_operand" "=v")
6348 (match_operand:V8SF 1 "register_operand" "v")
6349 (match_operand:V8SF 2 "nonimmediate_operand" "vm"))
6350 (parallel [(const_int 0) (const_int 8)
6351 (const_int 1) (const_int 9)
6352 (const_int 4) (const_int 12)
6353 (const_int 5) (const_int 13)])))]
6354 "TARGET_AVX && <mask_avx512vl_condition>"
6355 "vunpcklps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6356 [(set_attr "type" "sselog")
6357 (set_attr "prefix" "vex")
6358 (set_attr "mode" "V8SF")])
6360 (define_insn "unpcklps128_mask"
6361 [(set (match_operand:V4SF 0 "register_operand" "=v")
6365 (match_operand:V4SF 1 "register_operand" "v")
6366 (match_operand:V4SF 2 "nonimmediate_operand" "vm"))
6367 (parallel [(const_int 0) (const_int 4)
6368 (const_int 1) (const_int 5)]))
6369 (match_operand:V4SF 3 "vector_move_operand" "0C")
6370 (match_operand:QI 4 "register_operand" "Yk")))]
6372 "vunpcklps\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
6373 [(set_attr "type" "sselog")
6374 (set_attr "prefix" "evex")
6375 (set_attr "mode" "V4SF")])
6377 (define_expand "vec_interleave_lowv8sf"
6381 (match_operand:V8SF 1 "register_operand")
6382 (match_operand:V8SF 2 "nonimmediate_operand"))
6383 (parallel [(const_int 0) (const_int 8)
6384 (const_int 1) (const_int 9)
6385 (const_int 4) (const_int 12)
6386 (const_int 5) (const_int 13)])))
6392 (parallel [(const_int 2) (const_int 10)
6393 (const_int 3) (const_int 11)
6394 (const_int 6) (const_int 14)
6395 (const_int 7) (const_int 15)])))
6396 (set (match_operand:V8SF 0 "register_operand")
6401 (parallel [(const_int 0) (const_int 1)
6402 (const_int 2) (const_int 3)
6403 (const_int 8) (const_int 9)
6404 (const_int 10) (const_int 11)])))]
6407 operands[3] = gen_reg_rtx (V8SFmode);
6408 operands[4] = gen_reg_rtx (V8SFmode);
6411 (define_insn "vec_interleave_lowv4sf"
6412 [(set (match_operand:V4SF 0 "register_operand" "=x,v")
6415 (match_operand:V4SF 1 "register_operand" "0,v")
6416 (match_operand:V4SF 2 "vector_operand" "xBm,vm"))
6417 (parallel [(const_int 0) (const_int 4)
6418 (const_int 1) (const_int 5)])))]
6421 unpcklps\t{%2, %0|%0, %2}
6422 vunpcklps\t{%2, %1, %0|%0, %1, %2}"
6423 [(set_attr "isa" "noavx,avx")
6424 (set_attr "type" "sselog")
6425 (set_attr "prefix" "orig,maybe_evex")
6426 (set_attr "mode" "V4SF")])
6428 ;; These are modeled with the same vec_concat as the others so that we
6429 ;; capture users of shufps that can use the new instructions
6430 (define_insn "avx_movshdup256<mask_name>"
6431 [(set (match_operand:V8SF 0 "register_operand" "=v")
6434 (match_operand:V8SF 1 "nonimmediate_operand" "vm")
6436 (parallel [(const_int 1) (const_int 1)
6437 (const_int 3) (const_int 3)
6438 (const_int 5) (const_int 5)
6439 (const_int 7) (const_int 7)])))]
6440 "TARGET_AVX && <mask_avx512vl_condition>"
6441 "vmovshdup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6442 [(set_attr "type" "sse")
6443 (set_attr "prefix" "vex")
6444 (set_attr "mode" "V8SF")])
6446 (define_insn "sse3_movshdup<mask_name>"
6447 [(set (match_operand:V4SF 0 "register_operand" "=v")
6450 (match_operand:V4SF 1 "vector_operand" "vBm")
6452 (parallel [(const_int 1)
6456 "TARGET_SSE3 && <mask_avx512vl_condition>"
6457 "%vmovshdup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6458 [(set_attr "type" "sse")
6459 (set_attr "prefix_rep" "1")
6460 (set_attr "prefix" "maybe_vex")
6461 (set_attr "mode" "V4SF")])
6463 (define_insn "<mask_codefor>avx512f_movshdup512<mask_name>"
6464 [(set (match_operand:V16SF 0 "register_operand" "=v")
6467 (match_operand:V16SF 1 "nonimmediate_operand" "vm")
6469 (parallel [(const_int 1) (const_int 1)
6470 (const_int 3) (const_int 3)
6471 (const_int 5) (const_int 5)
6472 (const_int 7) (const_int 7)
6473 (const_int 9) (const_int 9)
6474 (const_int 11) (const_int 11)
6475 (const_int 13) (const_int 13)
6476 (const_int 15) (const_int 15)])))]
6478 "vmovshdup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6479 [(set_attr "type" "sse")
6480 (set_attr "prefix" "evex")
6481 (set_attr "mode" "V16SF")])
6483 (define_insn "avx_movsldup256<mask_name>"
6484 [(set (match_operand:V8SF 0 "register_operand" "=v")
6487 (match_operand:V8SF 1 "nonimmediate_operand" "vm")
6489 (parallel [(const_int 0) (const_int 0)
6490 (const_int 2) (const_int 2)
6491 (const_int 4) (const_int 4)
6492 (const_int 6) (const_int 6)])))]
6493 "TARGET_AVX && <mask_avx512vl_condition>"
6494 "vmovsldup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6495 [(set_attr "type" "sse")
6496 (set_attr "prefix" "vex")
6497 (set_attr "mode" "V8SF")])
6499 (define_insn "sse3_movsldup<mask_name>"
6500 [(set (match_operand:V4SF 0 "register_operand" "=v")
6503 (match_operand:V4SF 1 "vector_operand" "vBm")
6505 (parallel [(const_int 0)
6509 "TARGET_SSE3 && <mask_avx512vl_condition>"
6510 "%vmovsldup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6511 [(set_attr "type" "sse")
6512 (set_attr "prefix_rep" "1")
6513 (set_attr "prefix" "maybe_vex")
6514 (set_attr "mode" "V4SF")])
6516 (define_insn "<mask_codefor>avx512f_movsldup512<mask_name>"
6517 [(set (match_operand:V16SF 0 "register_operand" "=v")
6520 (match_operand:V16SF 1 "nonimmediate_operand" "vm")
6522 (parallel [(const_int 0) (const_int 0)
6523 (const_int 2) (const_int 2)
6524 (const_int 4) (const_int 4)
6525 (const_int 6) (const_int 6)
6526 (const_int 8) (const_int 8)
6527 (const_int 10) (const_int 10)
6528 (const_int 12) (const_int 12)
6529 (const_int 14) (const_int 14)])))]
6531 "vmovsldup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6532 [(set_attr "type" "sse")
6533 (set_attr "prefix" "evex")
6534 (set_attr "mode" "V16SF")])
6536 (define_expand "avx_shufps256<mask_expand4_name>"
6537 [(match_operand:V8SF 0 "register_operand")
6538 (match_operand:V8SF 1 "register_operand")
6539 (match_operand:V8SF 2 "nonimmediate_operand")
6540 (match_operand:SI 3 "const_int_operand")]
6543 int mask = INTVAL (operands[3]);
6544 emit_insn (gen_avx_shufps256_1<mask_expand4_name> (operands[0],
6547 GEN_INT ((mask >> 0) & 3),
6548 GEN_INT ((mask >> 2) & 3),
6549 GEN_INT (((mask >> 4) & 3) + 8),
6550 GEN_INT (((mask >> 6) & 3) + 8),
6551 GEN_INT (((mask >> 0) & 3) + 4),
6552 GEN_INT (((mask >> 2) & 3) + 4),
6553 GEN_INT (((mask >> 4) & 3) + 12),
6554 GEN_INT (((mask >> 6) & 3) + 12)
6555 <mask_expand4_args>));
6559 ;; One bit in mask selects 2 elements.
6560 (define_insn "avx_shufps256_1<mask_name>"
6561 [(set (match_operand:V8SF 0 "register_operand" "=v")
6564 (match_operand:V8SF 1 "register_operand" "v")
6565 (match_operand:V8SF 2 "nonimmediate_operand" "vm"))
6566 (parallel [(match_operand 3 "const_0_to_3_operand" )
6567 (match_operand 4 "const_0_to_3_operand" )
6568 (match_operand 5 "const_8_to_11_operand" )
6569 (match_operand 6 "const_8_to_11_operand" )
6570 (match_operand 7 "const_4_to_7_operand" )
6571 (match_operand 8 "const_4_to_7_operand" )
6572 (match_operand 9 "const_12_to_15_operand")
6573 (match_operand 10 "const_12_to_15_operand")])))]
6575 && <mask_avx512vl_condition>
6576 && (INTVAL (operands[3]) == (INTVAL (operands[7]) - 4)
6577 && INTVAL (operands[4]) == (INTVAL (operands[8]) - 4)
6578 && INTVAL (operands[5]) == (INTVAL (operands[9]) - 4)
6579 && INTVAL (operands[6]) == (INTVAL (operands[10]) - 4))"
6582 mask = INTVAL (operands[3]);
6583 mask |= INTVAL (operands[4]) << 2;
6584 mask |= (INTVAL (operands[5]) - 8) << 4;
6585 mask |= (INTVAL (operands[6]) - 8) << 6;
6586 operands[3] = GEN_INT (mask);
6588 return "vshufps\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
6590 [(set_attr "type" "sseshuf")
6591 (set_attr "length_immediate" "1")
6592 (set_attr "prefix" "<mask_prefix>")
6593 (set_attr "mode" "V8SF")])
6595 (define_expand "sse_shufps<mask_expand4_name>"
6596 [(match_operand:V4SF 0 "register_operand")
6597 (match_operand:V4SF 1 "register_operand")
6598 (match_operand:V4SF 2 "vector_operand")
6599 (match_operand:SI 3 "const_int_operand")]
6602 int mask = INTVAL (operands[3]);
6603 emit_insn (gen_sse_shufps_v4sf<mask_expand4_name> (operands[0],
6606 GEN_INT ((mask >> 0) & 3),
6607 GEN_INT ((mask >> 2) & 3),
6608 GEN_INT (((mask >> 4) & 3) + 4),
6609 GEN_INT (((mask >> 6) & 3) + 4)
6610 <mask_expand4_args>));
6614 (define_insn "sse_shufps_v4sf_mask"
6615 [(set (match_operand:V4SF 0 "register_operand" "=v")
6619 (match_operand:V4SF 1 "register_operand" "v")
6620 (match_operand:V4SF 2 "nonimmediate_operand" "vm"))
6621 (parallel [(match_operand 3 "const_0_to_3_operand")
6622 (match_operand 4 "const_0_to_3_operand")
6623 (match_operand 5 "const_4_to_7_operand")
6624 (match_operand 6 "const_4_to_7_operand")]))
6625 (match_operand:V4SF 7 "vector_move_operand" "0C")
6626 (match_operand:QI 8 "register_operand" "Yk")))]
6630 mask |= INTVAL (operands[3]) << 0;
6631 mask |= INTVAL (operands[4]) << 2;
6632 mask |= (INTVAL (operands[5]) - 4) << 4;
6633 mask |= (INTVAL (operands[6]) - 4) << 6;
6634 operands[3] = GEN_INT (mask);
6636 return "vshufps\t{%3, %2, %1, %0%{%8%}%N7|%0%{%8%}%N7, %1, %2, %3}";
6638 [(set_attr "type" "sseshuf")
6639 (set_attr "length_immediate" "1")
6640 (set_attr "prefix" "evex")
6641 (set_attr "mode" "V4SF")])
6643 (define_insn "sse_shufps_<mode>"
6644 [(set (match_operand:VI4F_128 0 "register_operand" "=x,v")
6645 (vec_select:VI4F_128
6646 (vec_concat:<ssedoublevecmode>
6647 (match_operand:VI4F_128 1 "register_operand" "0,v")
6648 (match_operand:VI4F_128 2 "vector_operand" "xBm,vm"))
6649 (parallel [(match_operand 3 "const_0_to_3_operand")
6650 (match_operand 4 "const_0_to_3_operand")
6651 (match_operand 5 "const_4_to_7_operand")
6652 (match_operand 6 "const_4_to_7_operand")])))]
6656 mask |= INTVAL (operands[3]) << 0;
6657 mask |= INTVAL (operands[4]) << 2;
6658 mask |= (INTVAL (operands[5]) - 4) << 4;
6659 mask |= (INTVAL (operands[6]) - 4) << 6;
6660 operands[3] = GEN_INT (mask);
6662 switch (which_alternative)
6665 return "shufps\t{%3, %2, %0|%0, %2, %3}";
6667 return "vshufps\t{%3, %2, %1, %0|%0, %1, %2, %3}";
6672 [(set_attr "isa" "noavx,avx")
6673 (set_attr "type" "sseshuf")
6674 (set_attr "length_immediate" "1")
6675 (set_attr "prefix" "orig,maybe_evex")
6676 (set_attr "mode" "V4SF")])
6678 (define_insn "sse_storehps"
6679 [(set (match_operand:V2SF 0 "nonimmediate_operand" "=m,v,v")
6681 (match_operand:V4SF 1 "nonimmediate_operand" "v,v,o")
6682 (parallel [(const_int 2) (const_int 3)])))]
6683 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
6685 %vmovhps\t{%1, %0|%q0, %1}
6686 %vmovhlps\t{%1, %d0|%d0, %1}
6687 %vmovlps\t{%H1, %d0|%d0, %H1}"
6688 [(set_attr "type" "ssemov")
6689 (set_attr "prefix" "maybe_vex")
6690 (set_attr "mode" "V2SF,V4SF,V2SF")])
6692 (define_expand "sse_loadhps_exp"
6693 [(set (match_operand:V4SF 0 "nonimmediate_operand")
6696 (match_operand:V4SF 1 "nonimmediate_operand")
6697 (parallel [(const_int 0) (const_int 1)]))
6698 (match_operand:V2SF 2 "nonimmediate_operand")))]
6701 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
6703 emit_insn (gen_sse_loadhps (dst, operands[1], operands[2]));
6705 /* Fix up the destination if needed. */
6706 if (dst != operands[0])
6707 emit_move_insn (operands[0], dst);
6712 (define_insn "sse_loadhps"
6713 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,v,x,v,o")
6716 (match_operand:V4SF 1 "nonimmediate_operand" " 0,v,0,v,0")
6717 (parallel [(const_int 0) (const_int 1)]))
6718 (match_operand:V2SF 2 "nonimmediate_operand" " m,m,x,v,v")))]
6721 movhps\t{%2, %0|%0, %q2}
6722 vmovhps\t{%2, %1, %0|%0, %1, %q2}
6723 movlhps\t{%2, %0|%0, %2}
6724 vmovlhps\t{%2, %1, %0|%0, %1, %2}
6725 %vmovlps\t{%2, %H0|%H0, %2}"
6726 [(set_attr "isa" "noavx,avx,noavx,avx,*")
6727 (set_attr "type" "ssemov")
6728 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,maybe_vex")
6729 (set_attr "mode" "V2SF,V2SF,V4SF,V4SF,V2SF")])
6731 (define_insn "sse_storelps"
6732 [(set (match_operand:V2SF 0 "nonimmediate_operand" "=m,v,v")
6734 (match_operand:V4SF 1 "nonimmediate_operand" " v,v,m")
6735 (parallel [(const_int 0) (const_int 1)])))]
6736 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
6738 %vmovlps\t{%1, %0|%q0, %1}
6739 %vmovaps\t{%1, %0|%0, %1}
6740 %vmovlps\t{%1, %d0|%d0, %q1}"
6741 [(set_attr "type" "ssemov")
6742 (set_attr "prefix" "maybe_vex")
6743 (set_attr "mode" "V2SF,V4SF,V2SF")])
6745 (define_expand "sse_loadlps_exp"
6746 [(set (match_operand:V4SF 0 "nonimmediate_operand")
6748 (match_operand:V2SF 2 "nonimmediate_operand")
6750 (match_operand:V4SF 1 "nonimmediate_operand")
6751 (parallel [(const_int 2) (const_int 3)]))))]
6754 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
6756 emit_insn (gen_sse_loadlps (dst, operands[1], operands[2]));
6758 /* Fix up the destination if needed. */
6759 if (dst != operands[0])
6760 emit_move_insn (operands[0], dst);
6765 (define_insn "sse_loadlps"
6766 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,v,x,v,m")
6768 (match_operand:V2SF 2 "nonimmediate_operand" " 0,v,m,m,v")
6770 (match_operand:V4SF 1 "nonimmediate_operand" " x,v,0,v,0")
6771 (parallel [(const_int 2) (const_int 3)]))))]
6774 shufps\t{$0xe4, %1, %0|%0, %1, 0xe4}
6775 vshufps\t{$0xe4, %1, %2, %0|%0, %2, %1, 0xe4}
6776 movlps\t{%2, %0|%0, %q2}
6777 vmovlps\t{%2, %1, %0|%0, %1, %q2}
6778 %vmovlps\t{%2, %0|%q0, %2}"
6779 [(set_attr "isa" "noavx,avx,noavx,avx,*")
6780 (set_attr "type" "sseshuf,sseshuf,ssemov,ssemov,ssemov")
6781 (set (attr "length_immediate")
6782 (if_then_else (eq_attr "alternative" "0,1")
6784 (const_string "*")))
6785 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,maybe_vex")
6786 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF,V2SF")])
6788 (define_insn "sse_movss"
6789 [(set (match_operand:V4SF 0 "register_operand" "=x,v")
6791 (match_operand:V4SF 2 "register_operand" " x,v")
6792 (match_operand:V4SF 1 "register_operand" " 0,v")
6796 movss\t{%2, %0|%0, %2}
6797 vmovss\t{%2, %1, %0|%0, %1, %2}"
6798 [(set_attr "isa" "noavx,avx")
6799 (set_attr "type" "ssemov")
6800 (set_attr "prefix" "orig,maybe_evex")
6801 (set_attr "mode" "SF")])
6803 (define_insn "avx2_vec_dup<mode>"
6804 [(set (match_operand:VF1_128_256 0 "register_operand" "=v")
6805 (vec_duplicate:VF1_128_256
6807 (match_operand:V4SF 1 "register_operand" "v")
6808 (parallel [(const_int 0)]))))]
6810 "vbroadcastss\t{%1, %0|%0, %1}"
6811 [(set_attr "type" "sselog1")
6812 (set_attr "prefix" "maybe_evex")
6813 (set_attr "mode" "<MODE>")])
6815 (define_insn "avx2_vec_dupv8sf_1"
6816 [(set (match_operand:V8SF 0 "register_operand" "=v")
6819 (match_operand:V8SF 1 "register_operand" "v")
6820 (parallel [(const_int 0)]))))]
6822 "vbroadcastss\t{%x1, %0|%0, %x1}"
6823 [(set_attr "type" "sselog1")
6824 (set_attr "prefix" "maybe_evex")
6825 (set_attr "mode" "V8SF")])
6827 (define_insn "avx512f_vec_dup<mode>_1"
6828 [(set (match_operand:VF_512 0 "register_operand" "=v")
6829 (vec_duplicate:VF_512
6830 (vec_select:<ssescalarmode>
6831 (match_operand:VF_512 1 "register_operand" "v")
6832 (parallel [(const_int 0)]))))]
6834 "vbroadcast<bcstscalarsuff>\t{%x1, %0|%0, %x1}"
6835 [(set_attr "type" "sselog1")
6836 (set_attr "prefix" "evex")
6837 (set_attr "mode" "<MODE>")])
6839 ;; Although insertps takes register source, we prefer
6840 ;; unpcklps with register source since it is shorter.
6841 (define_insn "*vec_concatv2sf_sse4_1"
6842 [(set (match_operand:V2SF 0 "register_operand"
6843 "=Yr,*x, v,Yr,*x,v,v,*y ,*y")
6845 (match_operand:SF 1 "nonimmediate_operand"
6846 " 0, 0,Yv, 0,0, v,m, 0 , m")
6847 (match_operand:SF 2 "vector_move_operand"
6848 " Yr,*x,Yv, m,m, m,C,*ym, C")))]
6849 "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
6851 unpcklps\t{%2, %0|%0, %2}
6852 unpcklps\t{%2, %0|%0, %2}
6853 vunpcklps\t{%2, %1, %0|%0, %1, %2}
6854 insertps\t{$0x10, %2, %0|%0, %2, 0x10}
6855 insertps\t{$0x10, %2, %0|%0, %2, 0x10}
6856 vinsertps\t{$0x10, %2, %1, %0|%0, %1, %2, 0x10}
6857 %vmovss\t{%1, %0|%0, %1}
6858 punpckldq\t{%2, %0|%0, %2}
6859 movd\t{%1, %0|%0, %1}"
6861 (cond [(eq_attr "alternative" "0,1,3,4")
6862 (const_string "noavx")
6863 (eq_attr "alternative" "2,5")
6864 (const_string "avx")
6866 (const_string "*")))
6868 (cond [(eq_attr "alternative" "6")
6869 (const_string "ssemov")
6870 (eq_attr "alternative" "7")
6871 (const_string "mmxcvt")
6872 (eq_attr "alternative" "8")
6873 (const_string "mmxmov")
6875 (const_string "sselog")))
6876 (set (attr "prefix_data16")
6877 (if_then_else (eq_attr "alternative" "3,4")
6879 (const_string "*")))
6880 (set (attr "prefix_extra")
6881 (if_then_else (eq_attr "alternative" "3,4,5")
6883 (const_string "*")))
6884 (set (attr "length_immediate")
6885 (if_then_else (eq_attr "alternative" "3,4,5")
6887 (const_string "*")))
6888 (set (attr "prefix")
6889 (cond [(eq_attr "alternative" "2,5")
6890 (const_string "maybe_evex")
6891 (eq_attr "alternative" "6")
6892 (const_string "maybe_vex")
6894 (const_string "orig")))
6895 (set_attr "mode" "V4SF,V4SF,V4SF,V4SF,V4SF,V4SF,SF,DI,DI")])
6897 ;; ??? In theory we can match memory for the MMX alternative, but allowing
6898 ;; vector_operand for operand 2 and *not* allowing memory for the SSE
6899 ;; alternatives pretty much forces the MMX alternative to be chosen.
6900 (define_insn "*vec_concatv2sf_sse"
6901 [(set (match_operand:V2SF 0 "register_operand" "=x,x,*y,*y")
6903 (match_operand:SF 1 "nonimmediate_operand" " 0,m, 0, m")
6904 (match_operand:SF 2 "reg_or_0_operand" " x,C,*y, C")))]
6907 unpcklps\t{%2, %0|%0, %2}
6908 movss\t{%1, %0|%0, %1}
6909 punpckldq\t{%2, %0|%0, %2}
6910 movd\t{%1, %0|%0, %1}"
6911 [(set_attr "type" "sselog,ssemov,mmxcvt,mmxmov")
6912 (set_attr "mode" "V4SF,SF,DI,DI")])
6914 (define_insn "*vec_concatv4sf"
6915 [(set (match_operand:V4SF 0 "register_operand" "=x,v,x,v")
6917 (match_operand:V2SF 1 "register_operand" " 0,v,0,v")
6918 (match_operand:V2SF 2 "nonimmediate_operand" " x,v,m,m")))]
6921 movlhps\t{%2, %0|%0, %2}
6922 vmovlhps\t{%2, %1, %0|%0, %1, %2}
6923 movhps\t{%2, %0|%0, %q2}
6924 vmovhps\t{%2, %1, %0|%0, %1, %q2}"
6925 [(set_attr "isa" "noavx,avx,noavx,avx")
6926 (set_attr "type" "ssemov")
6927 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex")
6928 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF")])
6930 ;; Avoid combining registers from different units in a single alternative,
6931 ;; see comment above inline_secondary_memory_needed function in i386.c
6932 (define_insn "vec_set<mode>_0"
6933 [(set (match_operand:VI4F_128 0 "nonimmediate_operand"
6934 "=Yr,*x,v,v,v,x,x,v,Yr ,*x ,x ,m ,m ,m")
6936 (vec_duplicate:VI4F_128
6937 (match_operand:<ssescalarmode> 2 "general_operand"
6938 " Yr,*x,v,m,r ,m,x,v,*rm,*rm,*rm,!x,!*re,!*fF"))
6939 (match_operand:VI4F_128 1 "vector_move_operand"
6940 " C , C,C,C,C ,C,0,v,0 ,0 ,x ,0 ,0 ,0")
6944 insertps\t{$0xe, %2, %0|%0, %2, 0xe}
6945 insertps\t{$0xe, %2, %0|%0, %2, 0xe}
6946 vinsertps\t{$0xe, %2, %2, %0|%0, %2, %2, 0xe}
6947 %vmov<ssescalarmodesuffix>\t{%2, %0|%0, %2}
6948 %vmovd\t{%2, %0|%0, %2}
6949 movss\t{%2, %0|%0, %2}
6950 movss\t{%2, %0|%0, %2}
6951 vmovss\t{%2, %1, %0|%0, %1, %2}
6952 pinsrd\t{$0, %2, %0|%0, %2, 0}
6953 pinsrd\t{$0, %2, %0|%0, %2, 0}
6954 vpinsrd\t{$0, %2, %1, %0|%0, %1, %2, 0}
6959 (cond [(eq_attr "alternative" "0,1,8,9")
6960 (const_string "sse4_noavx")
6961 (eq_attr "alternative" "2,7,10")
6962 (const_string "avx")
6963 (eq_attr "alternative" "3,4")
6964 (const_string "sse2")
6965 (eq_attr "alternative" "5,6")
6966 (const_string "noavx")
6968 (const_string "*")))
6970 (cond [(eq_attr "alternative" "0,1,2,8,9,10")
6971 (const_string "sselog")
6972 (eq_attr "alternative" "12")
6973 (const_string "imov")
6974 (eq_attr "alternative" "13")
6975 (const_string "fmov")
6977 (const_string "ssemov")))
6978 (set (attr "prefix_extra")
6979 (if_then_else (eq_attr "alternative" "8,9,10")
6981 (const_string "*")))
6982 (set (attr "length_immediate")
6983 (if_then_else (eq_attr "alternative" "8,9,10")
6985 (const_string "*")))
6986 (set (attr "prefix")
6987 (cond [(eq_attr "alternative" "0,1,5,6,8,9")
6988 (const_string "orig")
6989 (eq_attr "alternative" "2")
6990 (const_string "maybe_evex")
6991 (eq_attr "alternative" "3,4")
6992 (const_string "maybe_vex")
6993 (eq_attr "alternative" "7,10")
6994 (const_string "vex")
6996 (const_string "*")))
6997 (set_attr "mode" "SF,SF,SF,<ssescalarmode>,SI,SF,SF,SF,TI,TI,TI,*,*,*")
6998 (set (attr "preferred_for_speed")
6999 (cond [(eq_attr "alternative" "4")
7000 (symbol_ref "TARGET_INTER_UNIT_MOVES_TO_VEC")
7002 (symbol_ref "true")))])
7004 ;; A subset is vec_setv4sf.
7005 (define_insn "*vec_setv4sf_sse4_1"
7006 [(set (match_operand:V4SF 0 "register_operand" "=Yr,*x,v")
7009 (match_operand:SF 2 "nonimmediate_operand" "Yrm,*xm,vm"))
7010 (match_operand:V4SF 1 "register_operand" "0,0,v")
7011 (match_operand:SI 3 "const_int_operand")))]
7013 && ((unsigned) exact_log2 (INTVAL (operands[3]))
7014 < GET_MODE_NUNITS (V4SFmode))"
7016 operands[3] = GEN_INT (exact_log2 (INTVAL (operands[3])) << 4);
7017 switch (which_alternative)
7021 return "insertps\t{%3, %2, %0|%0, %2, %3}";
7023 return "vinsertps\t{%3, %2, %1, %0|%0, %1, %2, %3}";
7028 [(set_attr "isa" "noavx,noavx,avx")
7029 (set_attr "type" "sselog")
7030 (set_attr "prefix_data16" "1,1,*")
7031 (set_attr "prefix_extra" "1")
7032 (set_attr "length_immediate" "1")
7033 (set_attr "prefix" "orig,orig,maybe_evex")
7034 (set_attr "mode" "V4SF")])
7036 ;; All of vinsertps, vmovss, vmovd clear also the higher bits.
7037 (define_insn "vec_set<mode>_0"
7038 [(set (match_operand:VI4F_256_512 0 "register_operand" "=v,v,v")
7039 (vec_merge:VI4F_256_512
7040 (vec_duplicate:VI4F_256_512
7041 (match_operand:<ssescalarmode> 2 "general_operand" "v,m,r"))
7042 (match_operand:VI4F_256_512 1 "const0_operand" "C,C,C")
7046 vinsertps\t{$0xe, %2, %2, %x0|%x0, %2, %2, 0xe}
7047 vmov<ssescalarmodesuffix>\t{%x2, %x0|%x0, %2}
7048 vmovd\t{%2, %x0|%x0, %2}"
7050 (if_then_else (eq_attr "alternative" "0")
7051 (const_string "sselog")
7052 (const_string "ssemov")))
7053 (set_attr "prefix" "maybe_evex")
7054 (set_attr "mode" "SF,<ssescalarmode>,SI")
7055 (set (attr "preferred_for_speed")
7056 (cond [(eq_attr "alternative" "2")
7057 (symbol_ref "TARGET_INTER_UNIT_MOVES_TO_VEC")
7059 (symbol_ref "true")))])
7061 (define_insn "sse4_1_insertps"
7062 [(set (match_operand:V4SF 0 "register_operand" "=Yr,*x,v")
7063 (unspec:V4SF [(match_operand:V4SF 2 "nonimmediate_operand" "Yrm,*xm,vm")
7064 (match_operand:V4SF 1 "register_operand" "0,0,v")
7065 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")]
7069 if (MEM_P (operands[2]))
7071 unsigned count_s = INTVAL (operands[3]) >> 6;
7073 operands[3] = GEN_INT (INTVAL (operands[3]) & 0x3f);
7074 operands[2] = adjust_address_nv (operands[2], SFmode, count_s * 4);
7076 switch (which_alternative)
7080 return "insertps\t{%3, %2, %0|%0, %2, %3}";
7082 return "vinsertps\t{%3, %2, %1, %0|%0, %1, %2, %3}";
7087 [(set_attr "isa" "noavx,noavx,avx")
7088 (set_attr "type" "sselog")
7089 (set_attr "prefix_data16" "1,1,*")
7090 (set_attr "prefix_extra" "1")
7091 (set_attr "length_immediate" "1")
7092 (set_attr "prefix" "orig,orig,maybe_evex")
7093 (set_attr "mode" "V4SF")])
7096 [(set (match_operand:VI4F_128 0 "memory_operand")
7098 (vec_duplicate:VI4F_128
7099 (match_operand:<ssescalarmode> 1 "nonmemory_operand"))
7102 "TARGET_SSE && reload_completed"
7103 [(set (match_dup 0) (match_dup 1))]
7104 "operands[0] = adjust_address (operands[0], <ssescalarmode>mode, 0);")
7106 (define_expand "vec_set<mode>"
7107 [(match_operand:V 0 "register_operand")
7108 (match_operand:<ssescalarmode> 1 "register_operand")
7109 (match_operand 2 "const_int_operand")]
7112 ix86_expand_vector_set (false, operands[0], operands[1],
7113 INTVAL (operands[2]));
7117 (define_insn_and_split "*vec_extractv4sf_0"
7118 [(set (match_operand:SF 0 "nonimmediate_operand" "=v,m,f,r")
7120 (match_operand:V4SF 1 "nonimmediate_operand" "vm,v,m,m")
7121 (parallel [(const_int 0)])))]
7122 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7124 "&& reload_completed"
7125 [(set (match_dup 0) (match_dup 1))]
7126 "operands[1] = gen_lowpart (SFmode, operands[1]);")
7128 (define_insn_and_split "*sse4_1_extractps"
7129 [(set (match_operand:SF 0 "nonimmediate_operand" "=rm,rm,rm,Yv,Yv")
7131 (match_operand:V4SF 1 "register_operand" "Yr,*x,v,0,v")
7132 (parallel [(match_operand:SI 2 "const_0_to_3_operand" "n,n,n,n,n")])))]
7135 extractps\t{%2, %1, %0|%0, %1, %2}
7136 extractps\t{%2, %1, %0|%0, %1, %2}
7137 vextractps\t{%2, %1, %0|%0, %1, %2}
7140 "&& reload_completed && SSE_REG_P (operands[0])"
7143 rtx dest = lowpart_subreg (V4SFmode, operands[0], SFmode);
7144 switch (INTVAL (operands[2]))
7148 emit_insn (gen_sse_shufps_v4sf (dest, operands[1], operands[1],
7149 operands[2], operands[2],
7150 GEN_INT (INTVAL (operands[2]) + 4),
7151 GEN_INT (INTVAL (operands[2]) + 4)));
7154 emit_insn (gen_vec_interleave_highv4sf (dest, operands[1], operands[1]));
7157 /* 0 should be handled by the *vec_extractv4sf_0 pattern above. */
7162 [(set_attr "isa" "noavx,noavx,avx,noavx,avx")
7163 (set_attr "type" "sselog,sselog,sselog,*,*")
7164 (set_attr "prefix_data16" "1,1,1,*,*")
7165 (set_attr "prefix_extra" "1,1,1,*,*")
7166 (set_attr "length_immediate" "1,1,1,*,*")
7167 (set_attr "prefix" "orig,orig,maybe_evex,*,*")
7168 (set_attr "mode" "V4SF,V4SF,V4SF,*,*")])
7170 (define_insn_and_split "*vec_extractv4sf_mem"
7171 [(set (match_operand:SF 0 "register_operand" "=v,*r,f")
7173 (match_operand:V4SF 1 "memory_operand" "o,o,o")
7174 (parallel [(match_operand 2 "const_0_to_3_operand" "n,n,n")])))]
7177 "&& reload_completed"
7178 [(set (match_dup 0) (match_dup 1))]
7180 operands[1] = adjust_address (operands[1], SFmode, INTVAL (operands[2]) * 4);
7183 (define_mode_attr extract_type
7184 [(V16SF "avx512f") (V16SI "avx512f") (V8DF "avx512dq") (V8DI "avx512dq")])
7186 (define_mode_attr extract_suf
7187 [(V16SF "32x4") (V16SI "32x4") (V8DF "64x2") (V8DI "64x2")])
7189 (define_mode_iterator AVX512_VEC
7190 [(V8DF "TARGET_AVX512DQ") (V8DI "TARGET_AVX512DQ") V16SF V16SI])
7192 (define_expand "<extract_type>_vextract<shuffletype><extract_suf>_mask"
7193 [(match_operand:<ssequartermode> 0 "nonimmediate_operand")
7194 (match_operand:AVX512_VEC 1 "register_operand")
7195 (match_operand:SI 2 "const_0_to_3_operand")
7196 (match_operand:<ssequartermode> 3 "nonimmediate_operand")
7197 (match_operand:QI 4 "register_operand")]
7201 mask = INTVAL (operands[2]);
7202 rtx dest = operands[0];
7204 if (MEM_P (operands[0]) && !rtx_equal_p (operands[0], operands[3]))
7205 dest = gen_reg_rtx (<ssequartermode>mode);
7207 if (<MODE>mode == V16SImode || <MODE>mode == V16SFmode)
7208 emit_insn (gen_avx512f_vextract<shuffletype>32x4_1_mask (dest,
7209 operands[1], GEN_INT (mask * 4), GEN_INT (mask * 4 + 1),
7210 GEN_INT (mask * 4 + 2), GEN_INT (mask * 4 + 3), operands[3],
7213 emit_insn (gen_avx512dq_vextract<shuffletype>64x2_1_mask (dest,
7214 operands[1], GEN_INT (mask * 2), GEN_INT (mask * 2 + 1), operands[3],
7216 if (dest != operands[0])
7217 emit_move_insn (operands[0], dest);
7221 (define_insn "avx512dq_vextract<shuffletype>64x2_1_maskm"
7222 [(set (match_operand:<ssequartermode> 0 "memory_operand" "=m")
7223 (vec_merge:<ssequartermode>
7224 (vec_select:<ssequartermode>
7225 (match_operand:V8FI 1 "register_operand" "v")
7226 (parallel [(match_operand 2 "const_0_to_7_operand")
7227 (match_operand 3 "const_0_to_7_operand")]))
7228 (match_operand:<ssequartermode> 4 "memory_operand" "0")
7229 (match_operand:QI 5 "register_operand" "Yk")))]
7231 && INTVAL (operands[2]) % 2 == 0
7232 && INTVAL (operands[2]) == INTVAL (operands[3]) - 1
7233 && rtx_equal_p (operands[4], operands[0])"
7235 operands[2] = GEN_INT ((INTVAL (operands[2])) >> 1);
7236 return "vextract<shuffletype>64x2\t{%2, %1, %0%{%5%}|%0%{%5%}, %1, %2}";
7238 [(set_attr "type" "sselog")
7239 (set_attr "prefix_extra" "1")
7240 (set_attr "length_immediate" "1")
7241 (set_attr "memory" "store")
7242 (set_attr "prefix" "evex")
7243 (set_attr "mode" "<sseinsnmode>")])
7245 (define_insn "avx512f_vextract<shuffletype>32x4_1_maskm"
7246 [(set (match_operand:<ssequartermode> 0 "memory_operand" "=m")
7247 (vec_merge:<ssequartermode>
7248 (vec_select:<ssequartermode>
7249 (match_operand:V16FI 1 "register_operand" "v")
7250 (parallel [(match_operand 2 "const_0_to_15_operand")
7251 (match_operand 3 "const_0_to_15_operand")
7252 (match_operand 4 "const_0_to_15_operand")
7253 (match_operand 5 "const_0_to_15_operand")]))
7254 (match_operand:<ssequartermode> 6 "memory_operand" "0")
7255 (match_operand:QI 7 "register_operand" "Yk")))]
7257 && INTVAL (operands[2]) % 4 == 0
7258 && INTVAL (operands[2]) == INTVAL (operands[3]) - 1
7259 && INTVAL (operands[3]) == INTVAL (operands[4]) - 1
7260 && INTVAL (operands[4]) == INTVAL (operands[5]) - 1
7261 && rtx_equal_p (operands[6], operands[0])"
7263 operands[2] = GEN_INT (INTVAL (operands[2]) >> 2);
7264 return "vextract<shuffletype>32x4\t{%2, %1, %0%{%7%}|%0%{%7%}, %1, %2}";
7266 [(set_attr "type" "sselog")
7267 (set_attr "prefix_extra" "1")
7268 (set_attr "length_immediate" "1")
7269 (set_attr "memory" "store")
7270 (set_attr "prefix" "evex")
7271 (set_attr "mode" "<sseinsnmode>")])
7273 (define_insn "<mask_codefor>avx512dq_vextract<shuffletype>64x2_1<mask_name>"
7274 [(set (match_operand:<ssequartermode> 0 "<store_mask_predicate>" "=<store_mask_constraint>")
7275 (vec_select:<ssequartermode>
7276 (match_operand:V8FI 1 "register_operand" "v")
7277 (parallel [(match_operand 2 "const_0_to_7_operand")
7278 (match_operand 3 "const_0_to_7_operand")])))]
7280 && INTVAL (operands[2]) % 2 == 0
7281 && INTVAL (operands[2]) == INTVAL (operands[3]) - 1"
7283 operands[2] = GEN_INT (INTVAL (operands[2]) >> 1);
7284 return "vextract<shuffletype>64x2\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}";
7286 [(set_attr "type" "sselog1")
7287 (set_attr "prefix_extra" "1")
7288 (set_attr "length_immediate" "1")
7289 (set_attr "prefix" "evex")
7290 (set_attr "mode" "<sseinsnmode>")])
7293 [(set (match_operand:<ssequartermode> 0 "nonimmediate_operand")
7294 (vec_select:<ssequartermode>
7295 (match_operand:V8FI 1 "register_operand")
7296 (parallel [(const_int 0) (const_int 1)])))]
7300 || REG_P (operands[0])
7301 || !EXT_REX_SSE_REG_P (operands[1]))"
7302 [(set (match_dup 0) (match_dup 1))]
7304 if (!TARGET_AVX512VL
7305 && REG_P (operands[0])
7306 && EXT_REX_SSE_REG_P (operands[1]))
7308 = lowpart_subreg (<MODE>mode, operands[0], <ssequartermode>mode);
7310 operands[1] = gen_lowpart (<ssequartermode>mode, operands[1]);
7313 (define_insn "<mask_codefor>avx512f_vextract<shuffletype>32x4_1<mask_name>"
7314 [(set (match_operand:<ssequartermode> 0 "<store_mask_predicate>" "=<store_mask_constraint>")
7315 (vec_select:<ssequartermode>
7316 (match_operand:V16FI 1 "register_operand" "v")
7317 (parallel [(match_operand 2 "const_0_to_15_operand")
7318 (match_operand 3 "const_0_to_15_operand")
7319 (match_operand 4 "const_0_to_15_operand")
7320 (match_operand 5 "const_0_to_15_operand")])))]
7322 && INTVAL (operands[2]) % 4 == 0
7323 && INTVAL (operands[2]) == INTVAL (operands[3]) - 1
7324 && INTVAL (operands[3]) == INTVAL (operands[4]) - 1
7325 && INTVAL (operands[4]) == INTVAL (operands[5]) - 1"
7327 operands[2] = GEN_INT (INTVAL (operands[2]) >> 2);
7328 return "vextract<shuffletype>32x4\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
7330 [(set_attr "type" "sselog1")
7331 (set_attr "prefix_extra" "1")
7332 (set_attr "length_immediate" "1")
7333 (set_attr "prefix" "evex")
7334 (set_attr "mode" "<sseinsnmode>")])
7337 [(set (match_operand:<ssequartermode> 0 "nonimmediate_operand")
7338 (vec_select:<ssequartermode>
7339 (match_operand:V16FI 1 "register_operand")
7340 (parallel [(const_int 0) (const_int 1)
7341 (const_int 2) (const_int 3)])))]
7345 || REG_P (operands[0])
7346 || !EXT_REX_SSE_REG_P (operands[1]))"
7347 [(set (match_dup 0) (match_dup 1))]
7349 if (!TARGET_AVX512VL
7350 && REG_P (operands[0])
7351 && EXT_REX_SSE_REG_P (operands[1]))
7353 = lowpart_subreg (<MODE>mode, operands[0], <ssequartermode>mode);
7355 operands[1] = gen_lowpart (<ssequartermode>mode, operands[1]);
7358 (define_mode_attr extract_type_2
7359 [(V16SF "avx512dq") (V16SI "avx512dq") (V8DF "avx512f") (V8DI "avx512f")])
7361 (define_mode_attr extract_suf_2
7362 [(V16SF "32x8") (V16SI "32x8") (V8DF "64x4") (V8DI "64x4")])
7364 (define_mode_iterator AVX512_VEC_2
7365 [(V16SF "TARGET_AVX512DQ") (V16SI "TARGET_AVX512DQ") V8DF V8DI])
7367 (define_expand "<extract_type_2>_vextract<shuffletype><extract_suf_2>_mask"
7368 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7369 (match_operand:AVX512_VEC_2 1 "register_operand")
7370 (match_operand:SI 2 "const_0_to_1_operand")
7371 (match_operand:<ssehalfvecmode> 3 "nonimmediate_operand")
7372 (match_operand:QI 4 "register_operand")]
7375 rtx (*insn)(rtx, rtx, rtx, rtx);
7376 rtx dest = operands[0];
7378 if (MEM_P (dest) && !rtx_equal_p (dest, operands[3]))
7379 dest = gen_reg_rtx (<ssehalfvecmode>mode);
7381 switch (INTVAL (operands[2]))
7384 insn = gen_vec_extract_lo_<mode>_mask;
7387 insn = gen_vec_extract_hi_<mode>_mask;
7393 emit_insn (insn (dest, operands[1], operands[3], operands[4]));
7394 if (dest != operands[0])
7395 emit_move_insn (operands[0], dest);
7400 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7401 (vec_select:<ssehalfvecmode>
7402 (match_operand:V8FI 1 "nonimmediate_operand")
7403 (parallel [(const_int 0) (const_int 1)
7404 (const_int 2) (const_int 3)])))]
7405 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))
7408 || (REG_P (operands[0]) && !EXT_REX_SSE_REG_P (operands[1])))"
7409 [(set (match_dup 0) (match_dup 1))]
7410 "operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);")
7412 (define_insn "vec_extract_lo_<mode>_maskm"
7413 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7414 (vec_merge:<ssehalfvecmode>
7415 (vec_select:<ssehalfvecmode>
7416 (match_operand:V8FI 1 "register_operand" "v")
7417 (parallel [(const_int 0) (const_int 1)
7418 (const_int 2) (const_int 3)]))
7419 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7420 (match_operand:QI 3 "register_operand" "Yk")))]
7422 && rtx_equal_p (operands[2], operands[0])"
7423 "vextract<shuffletype>64x4\t{$0x0, %1, %0%{%3%}|%0%{%3%}, %1, 0x0}"
7424 [(set_attr "type" "sselog1")
7425 (set_attr "prefix_extra" "1")
7426 (set_attr "length_immediate" "1")
7427 (set_attr "prefix" "evex")
7428 (set_attr "mode" "<sseinsnmode>")])
7430 (define_insn "vec_extract_lo_<mode><mask_name>"
7431 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=v,<store_mask_constraint>,v")
7432 (vec_select:<ssehalfvecmode>
7433 (match_operand:V8FI 1 "<store_mask_predicate>" "v,v,<store_mask_constraint>")
7434 (parallel [(const_int 0) (const_int 1)
7435 (const_int 2) (const_int 3)])))]
7437 && (<mask_applied> || !(MEM_P (operands[0]) && MEM_P (operands[1])))"
7439 if (<mask_applied> || (!TARGET_AVX512VL && !MEM_P (operands[1])))
7440 return "vextract<shuffletype>64x4\t{$0x0, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x0}";
7444 [(set_attr "type" "sselog1")
7445 (set_attr "prefix_extra" "1")
7446 (set_attr "length_immediate" "1")
7447 (set_attr "memory" "none,store,load")
7448 (set_attr "prefix" "evex")
7449 (set_attr "mode" "<sseinsnmode>")])
7451 (define_insn "vec_extract_hi_<mode>_maskm"
7452 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7453 (vec_merge:<ssehalfvecmode>
7454 (vec_select:<ssehalfvecmode>
7455 (match_operand:V8FI 1 "register_operand" "v")
7456 (parallel [(const_int 4) (const_int 5)
7457 (const_int 6) (const_int 7)]))
7458 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7459 (match_operand:QI 3 "register_operand" "Yk")))]
7461 && rtx_equal_p (operands[2], operands[0])"
7462 "vextract<shuffletype>64x4\t{$0x1, %1, %0%{%3%}|%0%{%3%}, %1, 0x1}"
7463 [(set_attr "type" "sselog")
7464 (set_attr "prefix_extra" "1")
7465 (set_attr "length_immediate" "1")
7466 (set_attr "memory" "store")
7467 (set_attr "prefix" "evex")
7468 (set_attr "mode" "<sseinsnmode>")])
7470 (define_insn "vec_extract_hi_<mode><mask_name>"
7471 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=<store_mask_constraint>")
7472 (vec_select:<ssehalfvecmode>
7473 (match_operand:V8FI 1 "register_operand" "v")
7474 (parallel [(const_int 4) (const_int 5)
7475 (const_int 6) (const_int 7)])))]
7477 "vextract<shuffletype>64x4\t{$0x1, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x1}"
7478 [(set_attr "type" "sselog1")
7479 (set_attr "prefix_extra" "1")
7480 (set_attr "length_immediate" "1")
7481 (set_attr "prefix" "evex")
7482 (set_attr "mode" "<sseinsnmode>")])
7484 (define_insn "vec_extract_hi_<mode>_maskm"
7485 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7486 (vec_merge:<ssehalfvecmode>
7487 (vec_select:<ssehalfvecmode>
7488 (match_operand:V16FI 1 "register_operand" "v")
7489 (parallel [(const_int 8) (const_int 9)
7490 (const_int 10) (const_int 11)
7491 (const_int 12) (const_int 13)
7492 (const_int 14) (const_int 15)]))
7493 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7494 (match_operand:QI 3 "register_operand" "Yk")))]
7496 && rtx_equal_p (operands[2], operands[0])"
7497 "vextract<shuffletype>32x8\t{$0x1, %1, %0%{%3%}|%0%{%3%}, %1, 0x1}"
7498 [(set_attr "type" "sselog1")
7499 (set_attr "prefix_extra" "1")
7500 (set_attr "length_immediate" "1")
7501 (set_attr "prefix" "evex")
7502 (set_attr "mode" "<sseinsnmode>")])
7504 (define_insn "vec_extract_hi_<mode><mask_name>"
7505 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=<store_mask_constraint>,vm")
7506 (vec_select:<ssehalfvecmode>
7507 (match_operand:V16FI 1 "register_operand" "v,v")
7508 (parallel [(const_int 8) (const_int 9)
7509 (const_int 10) (const_int 11)
7510 (const_int 12) (const_int 13)
7511 (const_int 14) (const_int 15)])))]
7512 "TARGET_AVX512F && <mask_avx512dq_condition>"
7514 vextract<shuffletype>32x8\t{$0x1, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x1}
7515 vextracti64x4\t{$0x1, %1, %0|%0, %1, 0x1}"
7516 [(set_attr "type" "sselog1")
7517 (set_attr "prefix_extra" "1")
7518 (set_attr "isa" "avx512dq,noavx512dq")
7519 (set_attr "length_immediate" "1")
7520 (set_attr "prefix" "evex")
7521 (set_attr "mode" "<sseinsnmode>")])
7523 (define_expand "avx512vl_vextractf128<mode>"
7524 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7525 (match_operand:VI48F_256 1 "register_operand")
7526 (match_operand:SI 2 "const_0_to_1_operand")
7527 (match_operand:<ssehalfvecmode> 3 "vector_move_operand")
7528 (match_operand:QI 4 "register_operand")]
7529 "TARGET_AVX512DQ && TARGET_AVX512VL"
7531 rtx (*insn)(rtx, rtx, rtx, rtx);
7532 rtx dest = operands[0];
7535 && (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 4
7536 /* For V8S[IF]mode there are maskm insns with =m and 0
7538 ? !rtx_equal_p (dest, operands[3])
7539 /* For V4D[IF]mode, hi insns don't allow memory, and
7540 lo insns have =m and 0C constraints. */
7541 : (operands[2] != const0_rtx
7542 || (!rtx_equal_p (dest, operands[3])
7543 && GET_CODE (operands[3]) != CONST_VECTOR))))
7544 dest = gen_reg_rtx (<ssehalfvecmode>mode);
7545 switch (INTVAL (operands[2]))
7548 insn = gen_vec_extract_lo_<mode>_mask;
7551 insn = gen_vec_extract_hi_<mode>_mask;
7557 emit_insn (insn (dest, operands[1], operands[3], operands[4]));
7558 if (dest != operands[0])
7559 emit_move_insn (operands[0], dest);
7563 (define_expand "avx_vextractf128<mode>"
7564 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7565 (match_operand:V_256 1 "register_operand")
7566 (match_operand:SI 2 "const_0_to_1_operand")]
7569 rtx (*insn)(rtx, rtx);
7571 switch (INTVAL (operands[2]))
7574 insn = gen_vec_extract_lo_<mode>;
7577 insn = gen_vec_extract_hi_<mode>;
7583 emit_insn (insn (operands[0], operands[1]));
7587 (define_insn "vec_extract_lo_<mode><mask_name>"
7588 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand" "=v,v,m")
7589 (vec_select:<ssehalfvecmode>
7590 (match_operand:V16FI 1 "<store_mask_predicate>"
7591 "v,<store_mask_constraint>,v")
7592 (parallel [(const_int 0) (const_int 1)
7593 (const_int 2) (const_int 3)
7594 (const_int 4) (const_int 5)
7595 (const_int 6) (const_int 7)])))]
7597 && <mask_mode512bit_condition>
7598 && (<mask_applied> || !(MEM_P (operands[0]) && MEM_P (operands[1])))"
7601 || (!TARGET_AVX512VL
7602 && !REG_P (operands[0])
7603 && EXT_REX_SSE_REG_P (operands[1])))
7604 return "vextract<shuffletype>32x8\t{$0x0, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x0}";
7608 [(set_attr "type" "sselog1")
7609 (set_attr "prefix_extra" "1")
7610 (set_attr "length_immediate" "1")
7611 (set_attr "memory" "none,load,store")
7612 (set_attr "prefix" "evex")
7613 (set_attr "mode" "<sseinsnmode>")])
7616 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7617 (vec_select:<ssehalfvecmode>
7618 (match_operand:V16FI 1 "nonimmediate_operand")
7619 (parallel [(const_int 0) (const_int 1)
7620 (const_int 2) (const_int 3)
7621 (const_int 4) (const_int 5)
7622 (const_int 6) (const_int 7)])))]
7623 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))
7626 || REG_P (operands[0])
7627 || !EXT_REX_SSE_REG_P (operands[1]))"
7628 [(set (match_dup 0) (match_dup 1))]
7630 if (!TARGET_AVX512VL
7631 && REG_P (operands[0])
7632 && EXT_REX_SSE_REG_P (operands[1]))
7634 = lowpart_subreg (<MODE>mode, operands[0], <ssehalfvecmode>mode);
7636 operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);
7639 (define_insn "vec_extract_lo_<mode><mask_name>"
7640 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=v,v,m")
7641 (vec_select:<ssehalfvecmode>
7642 (match_operand:VI8F_256 1 "<store_mask_predicate>"
7643 "v,<store_mask_constraint>,v")
7644 (parallel [(const_int 0) (const_int 1)])))]
7646 && <mask_avx512vl_condition> && <mask_avx512dq_condition>
7647 && (<mask_applied> || !(MEM_P (operands[0]) && MEM_P (operands[1])))"
7650 return "vextract<shuffletype>64x2\t{$0x0, %1, %0%{%3%}|%0%{%3%}, %1, 0x0}";
7654 [(set_attr "type" "sselog1")
7655 (set_attr "prefix_extra" "1")
7656 (set_attr "length_immediate" "1")
7657 (set_attr "memory" "none,load,store")
7658 (set_attr "prefix" "evex")
7659 (set_attr "mode" "XI")])
7662 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7663 (vec_select:<ssehalfvecmode>
7664 (match_operand:VI8F_256 1 "nonimmediate_operand")
7665 (parallel [(const_int 0) (const_int 1)])))]
7666 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))
7667 && reload_completed"
7668 [(set (match_dup 0) (match_dup 1))]
7669 "operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);")
7671 (define_insn "vec_extract_hi_<mode><mask_name>"
7672 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=v,<store_mask_constraint>")
7673 (vec_select:<ssehalfvecmode>
7674 (match_operand:VI8F_256 1 "register_operand" "v,v")
7675 (parallel [(const_int 2) (const_int 3)])))]
7676 "TARGET_AVX && <mask_avx512vl_condition> && <mask_avx512dq_condition>"
7678 if (TARGET_AVX512VL)
7680 if (TARGET_AVX512DQ)
7681 return "vextract<shuffletype>64x2\t{$0x1, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x1}";
7683 return "vextract<shuffletype>32x4\t{$0x1, %1, %0|%0, %1, 0x1}";
7686 return "vextract<i128>\t{$0x1, %1, %0|%0, %1, 0x1}";
7688 [(set_attr "type" "sselog1")
7689 (set_attr "prefix_extra" "1")
7690 (set_attr "length_immediate" "1")
7691 (set_attr "prefix" "vex")
7692 (set_attr "mode" "<sseinsnmode>")])
7695 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7696 (vec_select:<ssehalfvecmode>
7697 (match_operand:VI4F_256 1 "nonimmediate_operand")
7698 (parallel [(const_int 0) (const_int 1)
7699 (const_int 2) (const_int 3)])))]
7700 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))
7701 && reload_completed"
7702 [(set (match_dup 0) (match_dup 1))]
7703 "operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);")
7705 (define_insn "vec_extract_lo_<mode><mask_name>"
7706 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>"
7707 "=<store_mask_constraint>,v")
7708 (vec_select:<ssehalfvecmode>
7709 (match_operand:VI4F_256 1 "<store_mask_predicate>"
7710 "v,<store_mask_constraint>")
7711 (parallel [(const_int 0) (const_int 1)
7712 (const_int 2) (const_int 3)])))]
7714 && <mask_avx512vl_condition> && <mask_avx512dq_condition>
7715 && (<mask_applied> || !(MEM_P (operands[0]) && MEM_P (operands[1])))"
7718 return "vextract<shuffletype>32x4\t{$0x0, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x0}";
7722 [(set_attr "type" "sselog1")
7723 (set_attr "prefix_extra" "1")
7724 (set_attr "length_immediate" "1")
7725 (set_attr "prefix" "evex")
7726 (set_attr "mode" "<sseinsnmode>")])
7728 (define_insn "vec_extract_lo_<mode>_maskm"
7729 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7730 (vec_merge:<ssehalfvecmode>
7731 (vec_select:<ssehalfvecmode>
7732 (match_operand:VI4F_256 1 "register_operand" "v")
7733 (parallel [(const_int 0) (const_int 1)
7734 (const_int 2) (const_int 3)]))
7735 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7736 (match_operand:QI 3 "register_operand" "Yk")))]
7737 "TARGET_AVX512VL && TARGET_AVX512F
7738 && rtx_equal_p (operands[2], operands[0])"
7739 "vextract<shuffletype>32x4\t{$0x0, %1, %0%{%3%}|%0%{%3%}, %1, 0x0}"
7740 [(set_attr "type" "sselog1")
7741 (set_attr "prefix_extra" "1")
7742 (set_attr "length_immediate" "1")
7743 (set_attr "prefix" "evex")
7744 (set_attr "mode" "<sseinsnmode>")])
7746 (define_insn "vec_extract_hi_<mode>_maskm"
7747 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7748 (vec_merge:<ssehalfvecmode>
7749 (vec_select:<ssehalfvecmode>
7750 (match_operand:VI4F_256 1 "register_operand" "v")
7751 (parallel [(const_int 4) (const_int 5)
7752 (const_int 6) (const_int 7)]))
7753 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7754 (match_operand:<ssehalfvecmode> 3 "register_operand" "Yk")))]
7755 "TARGET_AVX512F && TARGET_AVX512VL
7756 && rtx_equal_p (operands[2], operands[0])"
7757 "vextract<shuffletype>32x4\t{$0x1, %1, %0%{%3%}|%0%{%3%}, %1, 0x1}"
7758 [(set_attr "type" "sselog1")
7759 (set_attr "length_immediate" "1")
7760 (set_attr "prefix" "evex")
7761 (set_attr "mode" "<sseinsnmode>")])
7763 (define_insn "vec_extract_hi_<mode>_mask"
7764 [(set (match_operand:<ssehalfvecmode> 0 "register_operand" "=v")
7765 (vec_merge:<ssehalfvecmode>
7766 (vec_select:<ssehalfvecmode>
7767 (match_operand:VI4F_256 1 "register_operand" "v")
7768 (parallel [(const_int 4) (const_int 5)
7769 (const_int 6) (const_int 7)]))
7770 (match_operand:<ssehalfvecmode> 2 "vector_move_operand" "0C")
7771 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
7773 "vextract<shuffletype>32x4\t{$0x1, %1, %0%{%3%}%N2|%0%{%3%}%N2, %1, 0x1}"
7774 [(set_attr "type" "sselog1")
7775 (set_attr "length_immediate" "1")
7776 (set_attr "prefix" "evex")
7777 (set_attr "mode" "<sseinsnmode>")])
7779 (define_insn "vec_extract_hi_<mode>"
7780 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand" "=xm, vm")
7781 (vec_select:<ssehalfvecmode>
7782 (match_operand:VI4F_256 1 "register_operand" "x, v")
7783 (parallel [(const_int 4) (const_int 5)
7784 (const_int 6) (const_int 7)])))]
7787 vextract<i128>\t{$0x1, %1, %0|%0, %1, 0x1}
7788 vextract<shuffletype>32x4\t{$0x1, %1, %0|%0, %1, 0x1}"
7789 [(set_attr "isa" "*, avx512vl")
7790 (set_attr "prefix" "vex, evex")
7791 (set_attr "type" "sselog1")
7792 (set_attr "length_immediate" "1")
7793 (set_attr "mode" "<sseinsnmode>")])
7795 (define_insn_and_split "vec_extract_lo_v32hi"
7796 [(set (match_operand:V16HI 0 "nonimmediate_operand" "=v,v,m")
7798 (match_operand:V32HI 1 "nonimmediate_operand" "v,m,v")
7799 (parallel [(const_int 0) (const_int 1)
7800 (const_int 2) (const_int 3)
7801 (const_int 4) (const_int 5)
7802 (const_int 6) (const_int 7)
7803 (const_int 8) (const_int 9)
7804 (const_int 10) (const_int 11)
7805 (const_int 12) (const_int 13)
7806 (const_int 14) (const_int 15)])))]
7807 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7810 || REG_P (operands[0])
7811 || !EXT_REX_SSE_REG_P (operands[1]))
7814 return "vextracti64x4\t{$0x0, %1, %0|%0, %1, 0x0}";
7816 "&& reload_completed
7818 || REG_P (operands[0])
7819 || !EXT_REX_SSE_REG_P (operands[1]))"
7820 [(set (match_dup 0) (match_dup 1))]
7822 if (!TARGET_AVX512VL
7823 && REG_P (operands[0])
7824 && EXT_REX_SSE_REG_P (operands[1]))
7825 operands[0] = lowpart_subreg (V32HImode, operands[0], V16HImode);
7827 operands[1] = gen_lowpart (V16HImode, operands[1]);
7829 [(set_attr "type" "sselog1")
7830 (set_attr "prefix_extra" "1")
7831 (set_attr "length_immediate" "1")
7832 (set_attr "memory" "none,load,store")
7833 (set_attr "prefix" "evex")
7834 (set_attr "mode" "XI")])
7836 (define_insn "vec_extract_hi_v32hi"
7837 [(set (match_operand:V16HI 0 "nonimmediate_operand" "=vm")
7839 (match_operand:V32HI 1 "register_operand" "v")
7840 (parallel [(const_int 16) (const_int 17)
7841 (const_int 18) (const_int 19)
7842 (const_int 20) (const_int 21)
7843 (const_int 22) (const_int 23)
7844 (const_int 24) (const_int 25)
7845 (const_int 26) (const_int 27)
7846 (const_int 28) (const_int 29)
7847 (const_int 30) (const_int 31)])))]
7849 "vextracti64x4\t{$0x1, %1, %0|%0, %1, 0x1}"
7850 [(set_attr "type" "sselog1")
7851 (set_attr "prefix_extra" "1")
7852 (set_attr "length_immediate" "1")
7853 (set_attr "prefix" "evex")
7854 (set_attr "mode" "XI")])
7856 (define_insn_and_split "vec_extract_lo_v16hi"
7857 [(set (match_operand:V8HI 0 "nonimmediate_operand" "=v,m")
7859 (match_operand:V16HI 1 "nonimmediate_operand" "vm,v")
7860 (parallel [(const_int 0) (const_int 1)
7861 (const_int 2) (const_int 3)
7862 (const_int 4) (const_int 5)
7863 (const_int 6) (const_int 7)])))]
7864 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7866 "&& reload_completed"
7867 [(set (match_dup 0) (match_dup 1))]
7868 "operands[1] = gen_lowpart (V8HImode, operands[1]);")
7870 (define_insn "vec_extract_hi_v16hi"
7871 [(set (match_operand:V8HI 0 "nonimmediate_operand" "=xm,vm,vm")
7873 (match_operand:V16HI 1 "register_operand" "x,v,v")
7874 (parallel [(const_int 8) (const_int 9)
7875 (const_int 10) (const_int 11)
7876 (const_int 12) (const_int 13)
7877 (const_int 14) (const_int 15)])))]
7880 vextract%~128\t{$0x1, %1, %0|%0, %1, 0x1}
7881 vextracti32x4\t{$0x1, %1, %0|%0, %1, 0x1}
7882 vextracti32x4\t{$0x1, %g1, %0|%0, %g1, 0x1}"
7883 [(set_attr "type" "sselog1")
7884 (set_attr "prefix_extra" "1")
7885 (set_attr "length_immediate" "1")
7886 (set_attr "isa" "*,avx512dq,avx512f")
7887 (set_attr "prefix" "vex,evex,evex")
7888 (set_attr "mode" "OI")])
7890 (define_insn_and_split "vec_extract_lo_v64qi"
7891 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=v,v,m")
7893 (match_operand:V64QI 1 "nonimmediate_operand" "v,m,v")
7894 (parallel [(const_int 0) (const_int 1)
7895 (const_int 2) (const_int 3)
7896 (const_int 4) (const_int 5)
7897 (const_int 6) (const_int 7)
7898 (const_int 8) (const_int 9)
7899 (const_int 10) (const_int 11)
7900 (const_int 12) (const_int 13)
7901 (const_int 14) (const_int 15)
7902 (const_int 16) (const_int 17)
7903 (const_int 18) (const_int 19)
7904 (const_int 20) (const_int 21)
7905 (const_int 22) (const_int 23)
7906 (const_int 24) (const_int 25)
7907 (const_int 26) (const_int 27)
7908 (const_int 28) (const_int 29)
7909 (const_int 30) (const_int 31)])))]
7910 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7913 || REG_P (operands[0])
7914 || !EXT_REX_SSE_REG_P (operands[1]))
7917 return "vextracti64x4\t{$0x0, %1, %0|%0, %1, 0x0}";
7919 "&& reload_completed
7921 || REG_P (operands[0])
7922 || !EXT_REX_SSE_REG_P (operands[1]))"
7923 [(set (match_dup 0) (match_dup 1))]
7925 if (!TARGET_AVX512VL
7926 && REG_P (operands[0])
7927 && EXT_REX_SSE_REG_P (operands[1]))
7928 operands[0] = lowpart_subreg (V64QImode, operands[0], V32QImode);
7930 operands[1] = gen_lowpart (V32QImode, operands[1]);
7932 [(set_attr "type" "sselog1")
7933 (set_attr "prefix_extra" "1")
7934 (set_attr "length_immediate" "1")
7935 (set_attr "memory" "none,load,store")
7936 (set_attr "prefix" "evex")
7937 (set_attr "mode" "XI")])
7939 (define_insn "vec_extract_hi_v64qi"
7940 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=vm")
7942 (match_operand:V64QI 1 "register_operand" "v")
7943 (parallel [(const_int 32) (const_int 33)
7944 (const_int 34) (const_int 35)
7945 (const_int 36) (const_int 37)
7946 (const_int 38) (const_int 39)
7947 (const_int 40) (const_int 41)
7948 (const_int 42) (const_int 43)
7949 (const_int 44) (const_int 45)
7950 (const_int 46) (const_int 47)
7951 (const_int 48) (const_int 49)
7952 (const_int 50) (const_int 51)
7953 (const_int 52) (const_int 53)
7954 (const_int 54) (const_int 55)
7955 (const_int 56) (const_int 57)
7956 (const_int 58) (const_int 59)
7957 (const_int 60) (const_int 61)
7958 (const_int 62) (const_int 63)])))]
7960 "vextracti64x4\t{$0x1, %1, %0|%0, %1, 0x1}"
7961 [(set_attr "type" "sselog1")
7962 (set_attr "prefix_extra" "1")
7963 (set_attr "length_immediate" "1")
7964 (set_attr "prefix" "evex")
7965 (set_attr "mode" "XI")])
7967 (define_insn_and_split "vec_extract_lo_v32qi"
7968 [(set (match_operand:V16QI 0 "nonimmediate_operand" "=v,m")
7970 (match_operand:V32QI 1 "nonimmediate_operand" "vm,v")
7971 (parallel [(const_int 0) (const_int 1)
7972 (const_int 2) (const_int 3)
7973 (const_int 4) (const_int 5)
7974 (const_int 6) (const_int 7)
7975 (const_int 8) (const_int 9)
7976 (const_int 10) (const_int 11)
7977 (const_int 12) (const_int 13)
7978 (const_int 14) (const_int 15)])))]
7979 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7981 "&& reload_completed"
7982 [(set (match_dup 0) (match_dup 1))]
7983 "operands[1] = gen_lowpart (V16QImode, operands[1]);")
7985 (define_insn "vec_extract_hi_v32qi"
7986 [(set (match_operand:V16QI 0 "nonimmediate_operand" "=xm,vm,vm")
7988 (match_operand:V32QI 1 "register_operand" "x,v,v")
7989 (parallel [(const_int 16) (const_int 17)
7990 (const_int 18) (const_int 19)
7991 (const_int 20) (const_int 21)
7992 (const_int 22) (const_int 23)
7993 (const_int 24) (const_int 25)
7994 (const_int 26) (const_int 27)
7995 (const_int 28) (const_int 29)
7996 (const_int 30) (const_int 31)])))]
7999 vextract%~128\t{$0x1, %1, %0|%0, %1, 0x1}
8000 vextracti32x4\t{$0x1, %1, %0|%0, %1, 0x1}
8001 vextracti32x4\t{$0x1, %g1, %0|%0, %g1, 0x1}"
8002 [(set_attr "type" "sselog1")
8003 (set_attr "prefix_extra" "1")
8004 (set_attr "length_immediate" "1")
8005 (set_attr "isa" "*,avx512dq,avx512f")
8006 (set_attr "prefix" "vex,evex,evex")
8007 (set_attr "mode" "OI")])
8009 ;; Modes handled by vec_extract patterns.
8010 (define_mode_iterator VEC_EXTRACT_MODE
8011 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX") V16QI
8012 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX") V8HI
8013 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
8014 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI
8015 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
8016 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") V2DF
8017 (V4TI "TARGET_AVX512F") (V2TI "TARGET_AVX")])
8019 (define_expand "vec_extract<mode><ssescalarmodelower>"
8020 [(match_operand:<ssescalarmode> 0 "register_operand")
8021 (match_operand:VEC_EXTRACT_MODE 1 "register_operand")
8022 (match_operand 2 "const_int_operand")]
8025 ix86_expand_vector_extract (false, operands[0], operands[1],
8026 INTVAL (operands[2]));
8030 (define_expand "vec_extract<mode><ssehalfvecmodelower>"
8031 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
8032 (match_operand:V_512 1 "register_operand")
8033 (match_operand 2 "const_0_to_1_operand")]
8036 if (INTVAL (operands[2]))
8037 emit_insn (gen_vec_extract_hi_<mode> (operands[0], operands[1]));
8039 emit_insn (gen_vec_extract_lo_<mode> (operands[0], operands[1]));
8043 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8045 ;; Parallel double-precision floating point element swizzling
8047 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8049 (define_insn "<mask_codefor>avx512f_unpckhpd512<mask_name>"
8050 [(set (match_operand:V8DF 0 "register_operand" "=v")
8053 (match_operand:V8DF 1 "register_operand" "v")
8054 (match_operand:V8DF 2 "nonimmediate_operand" "vm"))
8055 (parallel [(const_int 1) (const_int 9)
8056 (const_int 3) (const_int 11)
8057 (const_int 5) (const_int 13)
8058 (const_int 7) (const_int 15)])))]
8060 "vunpckhpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8061 [(set_attr "type" "sselog")
8062 (set_attr "prefix" "evex")
8063 (set_attr "mode" "V8DF")])
8065 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
8066 (define_insn "avx_unpckhpd256<mask_name>"
8067 [(set (match_operand:V4DF 0 "register_operand" "=v")
8070 (match_operand:V4DF 1 "register_operand" "v")
8071 (match_operand:V4DF 2 "nonimmediate_operand" "vm"))
8072 (parallel [(const_int 1) (const_int 5)
8073 (const_int 3) (const_int 7)])))]
8074 "TARGET_AVX && <mask_avx512vl_condition>"
8075 "vunpckhpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8076 [(set_attr "type" "sselog")
8077 (set_attr "prefix" "vex")
8078 (set_attr "mode" "V4DF")])
8080 (define_expand "vec_interleave_highv4df"
8084 (match_operand:V4DF 1 "register_operand")
8085 (match_operand:V4DF 2 "nonimmediate_operand"))
8086 (parallel [(const_int 0) (const_int 4)
8087 (const_int 2) (const_int 6)])))
8093 (parallel [(const_int 1) (const_int 5)
8094 (const_int 3) (const_int 7)])))
8095 (set (match_operand:V4DF 0 "register_operand")
8100 (parallel [(const_int 2) (const_int 3)
8101 (const_int 6) (const_int 7)])))]
8104 operands[3] = gen_reg_rtx (V4DFmode);
8105 operands[4] = gen_reg_rtx (V4DFmode);
8109 (define_insn "avx512vl_unpckhpd128_mask"
8110 [(set (match_operand:V2DF 0 "register_operand" "=v")
8114 (match_operand:V2DF 1 "register_operand" "v")
8115 (match_operand:V2DF 2 "nonimmediate_operand" "vm"))
8116 (parallel [(const_int 1) (const_int 3)]))
8117 (match_operand:V2DF 3 "vector_move_operand" "0C")
8118 (match_operand:QI 4 "register_operand" "Yk")))]
8120 "vunpckhpd\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
8121 [(set_attr "type" "sselog")
8122 (set_attr "prefix" "evex")
8123 (set_attr "mode" "V2DF")])
8125 (define_expand "vec_interleave_highv2df"
8126 [(set (match_operand:V2DF 0 "register_operand")
8129 (match_operand:V2DF 1 "nonimmediate_operand")
8130 (match_operand:V2DF 2 "nonimmediate_operand"))
8131 (parallel [(const_int 1)
8135 if (!ix86_vec_interleave_v2df_operator_ok (operands, 1))
8136 operands[2] = force_reg (V2DFmode, operands[2]);
8139 (define_insn "*vec_interleave_highv2df"
8140 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,v,v,x,v,m")
8143 (match_operand:V2DF 1 "nonimmediate_operand" " 0,v,o,o,o,v")
8144 (match_operand:V2DF 2 "nonimmediate_operand" " x,v,1,0,v,0"))
8145 (parallel [(const_int 1)
8147 "TARGET_SSE2 && ix86_vec_interleave_v2df_operator_ok (operands, 1)"
8149 unpckhpd\t{%2, %0|%0, %2}
8150 vunpckhpd\t{%2, %1, %0|%0, %1, %2}
8151 %vmovddup\t{%H1, %0|%0, %H1}
8152 movlpd\t{%H1, %0|%0, %H1}
8153 vmovlpd\t{%H1, %2, %0|%0, %2, %H1}
8154 %vmovhpd\t{%1, %0|%q0, %1}"
8155 [(set_attr "isa" "noavx,avx,sse3,noavx,avx,*")
8156 (set_attr "type" "sselog,sselog,sselog,ssemov,ssemov,ssemov")
8157 (set (attr "prefix_data16")
8158 (if_then_else (eq_attr "alternative" "3,5")
8160 (const_string "*")))
8161 (set_attr "prefix" "orig,maybe_evex,maybe_vex,orig,maybe_evex,maybe_vex")
8162 (set_attr "mode" "V2DF,V2DF,DF,V1DF,V1DF,V1DF")])
8164 (define_expand "avx512f_movddup512<mask_name>"
8165 [(set (match_operand:V8DF 0 "register_operand")
8168 (match_operand:V8DF 1 "nonimmediate_operand")
8170 (parallel [(const_int 0) (const_int 8)
8171 (const_int 2) (const_int 10)
8172 (const_int 4) (const_int 12)
8173 (const_int 6) (const_int 14)])))]
8176 (define_expand "avx512f_unpcklpd512<mask_name>"
8177 [(set (match_operand:V8DF 0 "register_operand")
8180 (match_operand:V8DF 1 "register_operand")
8181 (match_operand:V8DF 2 "nonimmediate_operand"))
8182 (parallel [(const_int 0) (const_int 8)
8183 (const_int 2) (const_int 10)
8184 (const_int 4) (const_int 12)
8185 (const_int 6) (const_int 14)])))]
8188 (define_insn "*avx512f_unpcklpd512<mask_name>"
8189 [(set (match_operand:V8DF 0 "register_operand" "=v,v")
8192 (match_operand:V8DF 1 "nonimmediate_operand" "vm, v")
8193 (match_operand:V8DF 2 "nonimmediate_operand" "1 ,vm"))
8194 (parallel [(const_int 0) (const_int 8)
8195 (const_int 2) (const_int 10)
8196 (const_int 4) (const_int 12)
8197 (const_int 6) (const_int 14)])))]
8200 vmovddup\t{%1, %0<mask_operand3>|%0<mask_operand3>, %1}
8201 vunpcklpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8202 [(set_attr "type" "sselog")
8203 (set_attr "prefix" "evex")
8204 (set_attr "mode" "V8DF")])
8206 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
8207 (define_expand "avx_movddup256<mask_name>"
8208 [(set (match_operand:V4DF 0 "register_operand")
8211 (match_operand:V4DF 1 "nonimmediate_operand")
8213 (parallel [(const_int 0) (const_int 4)
8214 (const_int 2) (const_int 6)])))]
8215 "TARGET_AVX && <mask_avx512vl_condition>")
8217 (define_expand "avx_unpcklpd256<mask_name>"
8218 [(set (match_operand:V4DF 0 "register_operand")
8221 (match_operand:V4DF 1 "register_operand")
8222 (match_operand:V4DF 2 "nonimmediate_operand"))
8223 (parallel [(const_int 0) (const_int 4)
8224 (const_int 2) (const_int 6)])))]
8225 "TARGET_AVX && <mask_avx512vl_condition>")
8227 (define_insn "*avx_unpcklpd256<mask_name>"
8228 [(set (match_operand:V4DF 0 "register_operand" "=v,v")
8231 (match_operand:V4DF 1 "nonimmediate_operand" " v,m")
8232 (match_operand:V4DF 2 "nonimmediate_operand" "vm,1"))
8233 (parallel [(const_int 0) (const_int 4)
8234 (const_int 2) (const_int 6)])))]
8235 "TARGET_AVX && <mask_avx512vl_condition>"
8237 vunpcklpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
8238 vmovddup\t{%1, %0<mask_operand3>|%0<mask_operand3>, %1}"
8239 [(set_attr "type" "sselog")
8240 (set_attr "prefix" "vex")
8241 (set_attr "mode" "V4DF")])
8243 (define_expand "vec_interleave_lowv4df"
8247 (match_operand:V4DF 1 "register_operand")
8248 (match_operand:V4DF 2 "nonimmediate_operand"))
8249 (parallel [(const_int 0) (const_int 4)
8250 (const_int 2) (const_int 6)])))
8256 (parallel [(const_int 1) (const_int 5)
8257 (const_int 3) (const_int 7)])))
8258 (set (match_operand:V4DF 0 "register_operand")
8263 (parallel [(const_int 0) (const_int 1)
8264 (const_int 4) (const_int 5)])))]
8267 operands[3] = gen_reg_rtx (V4DFmode);
8268 operands[4] = gen_reg_rtx (V4DFmode);
8271 (define_insn "avx512vl_unpcklpd128_mask"
8272 [(set (match_operand:V2DF 0 "register_operand" "=v")
8276 (match_operand:V2DF 1 "register_operand" "v")
8277 (match_operand:V2DF 2 "nonimmediate_operand" "vm"))
8278 (parallel [(const_int 0) (const_int 2)]))
8279 (match_operand:V2DF 3 "vector_move_operand" "0C")
8280 (match_operand:QI 4 "register_operand" "Yk")))]
8282 "vunpcklpd\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
8283 [(set_attr "type" "sselog")
8284 (set_attr "prefix" "evex")
8285 (set_attr "mode" "V2DF")])
8287 (define_expand "vec_interleave_lowv2df"
8288 [(set (match_operand:V2DF 0 "register_operand")
8291 (match_operand:V2DF 1 "nonimmediate_operand")
8292 (match_operand:V2DF 2 "nonimmediate_operand"))
8293 (parallel [(const_int 0)
8297 if (!ix86_vec_interleave_v2df_operator_ok (operands, 0))
8298 operands[1] = force_reg (V2DFmode, operands[1]);
8301 (define_insn "*vec_interleave_lowv2df"
8302 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,v,v,x,v,o")
8305 (match_operand:V2DF 1 "nonimmediate_operand" " 0,v,m,0,v,0")
8306 (match_operand:V2DF 2 "nonimmediate_operand" " x,v,1,m,m,v"))
8307 (parallel [(const_int 0)
8309 "TARGET_SSE2 && ix86_vec_interleave_v2df_operator_ok (operands, 0)"
8311 unpcklpd\t{%2, %0|%0, %2}
8312 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
8313 %vmovddup\t{%1, %0|%0, %q1}
8314 movhpd\t{%2, %0|%0, %q2}
8315 vmovhpd\t{%2, %1, %0|%0, %1, %q2}
8316 %vmovlpd\t{%2, %H0|%H0, %2}"
8317 [(set_attr "isa" "noavx,avx,sse3,noavx,avx,*")
8318 (set_attr "type" "sselog,sselog,sselog,ssemov,ssemov,ssemov")
8319 (set (attr "prefix_data16")
8320 (if_then_else (eq_attr "alternative" "3,5")
8322 (const_string "*")))
8323 (set_attr "prefix" "orig,maybe_evex,maybe_vex,orig,maybe_evex,maybe_vex")
8324 (set_attr "mode" "V2DF,V2DF,DF,V1DF,V1DF,V1DF")])
8327 [(set (match_operand:V2DF 0 "memory_operand")
8330 (match_operand:V2DF 1 "register_operand")
8332 (parallel [(const_int 0)
8334 "TARGET_SSE3 && reload_completed"
8337 rtx low = gen_lowpart (DFmode, operands[1]);
8339 emit_move_insn (adjust_address (operands[0], DFmode, 0), low);
8340 emit_move_insn (adjust_address (operands[0], DFmode, 8), low);
8345 [(set (match_operand:V2DF 0 "register_operand")
8348 (match_operand:V2DF 1 "memory_operand")
8350 (parallel [(match_operand:SI 2 "const_0_to_1_operand")
8351 (match_operand:SI 3 "const_int_operand")])))]
8352 "TARGET_SSE3 && INTVAL (operands[2]) + 2 == INTVAL (operands[3])"
8353 [(set (match_dup 0) (vec_duplicate:V2DF (match_dup 1)))]
8355 operands[1] = adjust_address (operands[1], DFmode, INTVAL (operands[2]) * 8);
8358 (define_insn "avx512f_vmscalef<mode><mask_scalar_name><round_scalar_name>"
8359 [(set (match_operand:VF_128 0 "register_operand" "=v")
8362 [(match_operand:VF_128 1 "register_operand" "v")
8363 (match_operand:VF_128 2 "<round_scalar_nimm_predicate>" "<round_scalar_constraint>")]
8368 "vscalef<ssescalarmodesuffix>\t{<round_scalar_mask_op3>%2, %1, %0<mask_scalar_operand3>|%0<mask_scalar_operand3>, %1, %2<round_scalar_mask_op3>}"
8369 [(set_attr "prefix" "evex")
8370 (set_attr "mode" "<ssescalarmode>")])
8372 (define_insn "<avx512>_scalef<mode><mask_name><round_name>"
8373 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8375 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
8376 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")]
8379 "vscalef<ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
8380 [(set_attr "prefix" "evex")
8381 (set_attr "mode" "<MODE>")])
8383 (define_expand "<avx512>_vternlog<mode>_maskz"
8384 [(match_operand:VI48_AVX512VL 0 "register_operand")
8385 (match_operand:VI48_AVX512VL 1 "register_operand")
8386 (match_operand:VI48_AVX512VL 2 "register_operand")
8387 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand")
8388 (match_operand:SI 4 "const_0_to_255_operand")
8389 (match_operand:<avx512fmaskmode> 5 "register_operand")]
8392 emit_insn (gen_<avx512>_vternlog<mode>_maskz_1 (
8393 operands[0], operands[1], operands[2], operands[3],
8394 operands[4], CONST0_RTX (<MODE>mode), operands[5]));
8398 (define_insn "<avx512>_vternlog<mode><sd_maskz_name>"
8399 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
8400 (unspec:VI48_AVX512VL
8401 [(match_operand:VI48_AVX512VL 1 "register_operand" "0")
8402 (match_operand:VI48_AVX512VL 2 "register_operand" "v")
8403 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand" "vm")
8404 (match_operand:SI 4 "const_0_to_255_operand")]
8407 "vpternlog<ssemodesuffix>\t{%4, %3, %2, %0<sd_mask_op5>|%0<sd_mask_op5>, %2, %3, %4}"
8408 [(set_attr "type" "sselog")
8409 (set_attr "prefix" "evex")
8410 (set_attr "mode" "<sseinsnmode>")])
8412 (define_insn "<avx512>_vternlog<mode>_mask"
8413 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
8414 (vec_merge:VI48_AVX512VL
8415 (unspec:VI48_AVX512VL
8416 [(match_operand:VI48_AVX512VL 1 "register_operand" "0")
8417 (match_operand:VI48_AVX512VL 2 "register_operand" "v")
8418 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand" "vm")
8419 (match_operand:SI 4 "const_0_to_255_operand")]
8422 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
8424 "vpternlog<ssemodesuffix>\t{%4, %3, %2, %0%{%5%}|%0%{%5%}, %2, %3, %4}"
8425 [(set_attr "type" "sselog")
8426 (set_attr "prefix" "evex")
8427 (set_attr "mode" "<sseinsnmode>")])
8429 (define_insn "<avx512>_getexp<mode><mask_name><round_saeonly_name>"
8430 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8431 (unspec:VF_AVX512VL [(match_operand:VF_AVX512VL 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
8434 "vgetexp<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}";
8435 [(set_attr "prefix" "evex")
8436 (set_attr "mode" "<MODE>")])
8438 (define_insn "avx512f_sgetexp<mode><mask_scalar_name><round_saeonly_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_saeonly_scalar_nimm_predicate>" "<round_saeonly_scalar_constraint>")]
8448 "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>}";
8449 [(set_attr "prefix" "evex")
8450 (set_attr "mode" "<ssescalarmode>")])
8452 (define_insn "<mask_codefor><avx512>_align<mode><mask_name>"
8453 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
8454 (unspec:VI48_AVX512VL [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
8455 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")
8456 (match_operand:SI 3 "const_0_to_255_operand")]
8459 "valign<ssemodesuffix>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3}";
8460 [(set_attr "prefix" "evex")
8461 (set_attr "mode" "<sseinsnmode>")])
8463 (define_expand "avx512f_shufps512_mask"
8464 [(match_operand:V16SF 0 "register_operand")
8465 (match_operand:V16SF 1 "register_operand")
8466 (match_operand:V16SF 2 "nonimmediate_operand")
8467 (match_operand:SI 3 "const_0_to_255_operand")
8468 (match_operand:V16SF 4 "register_operand")
8469 (match_operand:HI 5 "register_operand")]
8472 int mask = INTVAL (operands[3]);
8473 emit_insn (gen_avx512f_shufps512_1_mask (operands[0], operands[1], operands[2],
8474 GEN_INT ((mask >> 0) & 3),
8475 GEN_INT ((mask >> 2) & 3),
8476 GEN_INT (((mask >> 4) & 3) + 16),
8477 GEN_INT (((mask >> 6) & 3) + 16),
8478 GEN_INT (((mask >> 0) & 3) + 4),
8479 GEN_INT (((mask >> 2) & 3) + 4),
8480 GEN_INT (((mask >> 4) & 3) + 20),
8481 GEN_INT (((mask >> 6) & 3) + 20),
8482 GEN_INT (((mask >> 0) & 3) + 8),
8483 GEN_INT (((mask >> 2) & 3) + 8),
8484 GEN_INT (((mask >> 4) & 3) + 24),
8485 GEN_INT (((mask >> 6) & 3) + 24),
8486 GEN_INT (((mask >> 0) & 3) + 12),
8487 GEN_INT (((mask >> 2) & 3) + 12),
8488 GEN_INT (((mask >> 4) & 3) + 28),
8489 GEN_INT (((mask >> 6) & 3) + 28),
8490 operands[4], operands[5]));
8495 (define_expand "<avx512>_fixupimm<mode>_maskz<round_saeonly_expand_name>"
8496 [(match_operand:VF_AVX512VL 0 "register_operand")
8497 (match_operand:VF_AVX512VL 1 "register_operand")
8498 (match_operand:VF_AVX512VL 2 "register_operand")
8499 (match_operand:<sseintvecmode> 3 "<round_saeonly_expand_nimm_predicate>")
8500 (match_operand:SI 4 "const_0_to_255_operand")
8501 (match_operand:<avx512fmaskmode> 5 "register_operand")]
8504 emit_insn (gen_<avx512>_fixupimm<mode>_maskz_1<round_saeonly_expand_name> (
8505 operands[0], operands[1], operands[2], operands[3],
8506 operands[4], CONST0_RTX (<MODE>mode), operands[5]
8507 <round_saeonly_expand_operand6>));
8511 (define_insn "<avx512>_fixupimm<mode><sd_maskz_name><round_saeonly_name>"
8512 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8514 [(match_operand:VF_AVX512VL 1 "register_operand" "0")
8515 (match_operand:VF_AVX512VL 2 "register_operand" "v")
8516 (match_operand:<sseintvecmode> 3 "nonimmediate_operand" "<round_saeonly_constraint>")
8517 (match_operand:SI 4 "const_0_to_255_operand")]
8520 "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}";
8521 [(set_attr "prefix" "evex")
8522 (set_attr "mode" "<MODE>")])
8524 (define_insn "<avx512>_fixupimm<mode>_mask<round_saeonly_name>"
8525 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8526 (vec_merge:VF_AVX512VL
8528 [(match_operand:VF_AVX512VL 1 "register_operand" "0")
8529 (match_operand:VF_AVX512VL 2 "register_operand" "v")
8530 (match_operand:<sseintvecmode> 3 "nonimmediate_operand" "<round_saeonly_constraint>")
8531 (match_operand:SI 4 "const_0_to_255_operand")]
8534 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
8536 "vfixupimm<ssemodesuffix>\t{%4, <round_saeonly_op6>%3, %2, %0%{%5%}|%0%{%5%}, %2, %3<round_saeonly_op6>, %4}";
8537 [(set_attr "prefix" "evex")
8538 (set_attr "mode" "<MODE>")])
8540 (define_expand "avx512f_sfixupimm<mode>_maskz<round_saeonly_expand_name>"
8541 [(match_operand:VF_128 0 "register_operand")
8542 (match_operand:VF_128 1 "register_operand")
8543 (match_operand:VF_128 2 "register_operand")
8544 (match_operand:<sseintvecmode> 3 "<round_saeonly_expand_nimm_predicate>")
8545 (match_operand:SI 4 "const_0_to_255_operand")
8546 (match_operand:<avx512fmaskmode> 5 "register_operand")]
8549 emit_insn (gen_avx512f_sfixupimm<mode>_maskz_1<round_saeonly_expand_name> (
8550 operands[0], operands[1], operands[2], operands[3],
8551 operands[4], CONST0_RTX (<MODE>mode), operands[5]
8552 <round_saeonly_expand_operand6>));
8556 (define_insn "avx512f_sfixupimm<mode><sd_maskz_name><round_saeonly_name>"
8557 [(set (match_operand:VF_128 0 "register_operand" "=v")
8560 [(match_operand:VF_128 1 "register_operand" "0")
8561 (match_operand:VF_128 2 "register_operand" "v")
8562 (match_operand:<sseintvecmode> 3 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
8563 (match_operand:SI 4 "const_0_to_255_operand")]
8568 "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}";
8569 [(set_attr "prefix" "evex")
8570 (set_attr "mode" "<ssescalarmode>")])
8572 (define_insn "avx512f_sfixupimm<mode>_mask<round_saeonly_name>"
8573 [(set (match_operand:VF_128 0 "register_operand" "=v")
8577 [(match_operand:VF_128 1 "register_operand" "0")
8578 (match_operand:VF_128 2 "register_operand" "v")
8579 (match_operand:<sseintvecmode> 3 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
8580 (match_operand:SI 4 "const_0_to_255_operand")]
8585 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
8587 "vfixupimm<ssescalarmodesuffix>\t{%4, <round_saeonly_op6>%3, %2, %0%{%5%}|%0%{%5%}, %2, %<iptr>3<round_saeonly_op6>, %4}";
8588 [(set_attr "prefix" "evex")
8589 (set_attr "mode" "<ssescalarmode>")])
8591 (define_insn "<avx512>_rndscale<mode><mask_name><round_saeonly_name>"
8592 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8594 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "<round_saeonly_constraint>")
8595 (match_operand:SI 2 "const_0_to_255_operand")]
8598 "vrndscale<ssemodesuffix>\t{%2, <round_saeonly_mask_op3>%1, %0<mask_operand3>|%0<mask_operand3>, %1<round_saeonly_mask_op3>, %2}"
8599 [(set_attr "length_immediate" "1")
8600 (set_attr "prefix" "evex")
8601 (set_attr "mode" "<MODE>")])
8603 (define_insn "avx512f_rndscale<mode><round_saeonly_name>"
8604 [(set (match_operand:VF_128 0 "register_operand" "=v")
8607 [(match_operand:VF_128 1 "register_operand" "v")
8608 (match_operand:VF_128 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
8609 (match_operand:SI 3 "const_0_to_255_operand")]
8614 "vrndscale<ssescalarmodesuffix>\t{%3, <round_saeonly_op4>%2, %1, %0|%0, %1, %<iptr>2<round_saeonly_op4>, %3}"
8615 [(set_attr "length_immediate" "1")
8616 (set_attr "prefix" "evex")
8617 (set_attr "mode" "<MODE>")])
8619 ;; One bit in mask selects 2 elements.
8620 (define_insn "avx512f_shufps512_1<mask_name>"
8621 [(set (match_operand:V16SF 0 "register_operand" "=v")
8624 (match_operand:V16SF 1 "register_operand" "v")
8625 (match_operand:V16SF 2 "nonimmediate_operand" "vm"))
8626 (parallel [(match_operand 3 "const_0_to_3_operand")
8627 (match_operand 4 "const_0_to_3_operand")
8628 (match_operand 5 "const_16_to_19_operand")
8629 (match_operand 6 "const_16_to_19_operand")
8630 (match_operand 7 "const_4_to_7_operand")
8631 (match_operand 8 "const_4_to_7_operand")
8632 (match_operand 9 "const_20_to_23_operand")
8633 (match_operand 10 "const_20_to_23_operand")
8634 (match_operand 11 "const_8_to_11_operand")
8635 (match_operand 12 "const_8_to_11_operand")
8636 (match_operand 13 "const_24_to_27_operand")
8637 (match_operand 14 "const_24_to_27_operand")
8638 (match_operand 15 "const_12_to_15_operand")
8639 (match_operand 16 "const_12_to_15_operand")
8640 (match_operand 17 "const_28_to_31_operand")
8641 (match_operand 18 "const_28_to_31_operand")])))]
8643 && (INTVAL (operands[3]) == (INTVAL (operands[7]) - 4)
8644 && INTVAL (operands[4]) == (INTVAL (operands[8]) - 4)
8645 && INTVAL (operands[5]) == (INTVAL (operands[9]) - 4)
8646 && INTVAL (operands[6]) == (INTVAL (operands[10]) - 4)
8647 && INTVAL (operands[3]) == (INTVAL (operands[11]) - 8)
8648 && INTVAL (operands[4]) == (INTVAL (operands[12]) - 8)
8649 && INTVAL (operands[5]) == (INTVAL (operands[13]) - 8)
8650 && INTVAL (operands[6]) == (INTVAL (operands[14]) - 8)
8651 && INTVAL (operands[3]) == (INTVAL (operands[15]) - 12)
8652 && INTVAL (operands[4]) == (INTVAL (operands[16]) - 12)
8653 && INTVAL (operands[5]) == (INTVAL (operands[17]) - 12)
8654 && INTVAL (operands[6]) == (INTVAL (operands[18]) - 12))"
8657 mask = INTVAL (operands[3]);
8658 mask |= INTVAL (operands[4]) << 2;
8659 mask |= (INTVAL (operands[5]) - 16) << 4;
8660 mask |= (INTVAL (operands[6]) - 16) << 6;
8661 operands[3] = GEN_INT (mask);
8663 return "vshufps\t{%3, %2, %1, %0<mask_operand19>|%0<mask_operand19>, %1, %2, %3}";
8665 [(set_attr "type" "sselog")
8666 (set_attr "length_immediate" "1")
8667 (set_attr "prefix" "evex")
8668 (set_attr "mode" "V16SF")])
8670 (define_expand "avx512f_shufpd512_mask"
8671 [(match_operand:V8DF 0 "register_operand")
8672 (match_operand:V8DF 1 "register_operand")
8673 (match_operand:V8DF 2 "nonimmediate_operand")
8674 (match_operand:SI 3 "const_0_to_255_operand")
8675 (match_operand:V8DF 4 "register_operand")
8676 (match_operand:QI 5 "register_operand")]
8679 int mask = INTVAL (operands[3]);
8680 emit_insn (gen_avx512f_shufpd512_1_mask (operands[0], operands[1], operands[2],
8682 GEN_INT (mask & 2 ? 9 : 8),
8683 GEN_INT (mask & 4 ? 3 : 2),
8684 GEN_INT (mask & 8 ? 11 : 10),
8685 GEN_INT (mask & 16 ? 5 : 4),
8686 GEN_INT (mask & 32 ? 13 : 12),
8687 GEN_INT (mask & 64 ? 7 : 6),
8688 GEN_INT (mask & 128 ? 15 : 14),
8689 operands[4], operands[5]));
8693 (define_insn "avx512f_shufpd512_1<mask_name>"
8694 [(set (match_operand:V8DF 0 "register_operand" "=v")
8697 (match_operand:V8DF 1 "register_operand" "v")
8698 (match_operand:V8DF 2 "nonimmediate_operand" "vm"))
8699 (parallel [(match_operand 3 "const_0_to_1_operand")
8700 (match_operand 4 "const_8_to_9_operand")
8701 (match_operand 5 "const_2_to_3_operand")
8702 (match_operand 6 "const_10_to_11_operand")
8703 (match_operand 7 "const_4_to_5_operand")
8704 (match_operand 8 "const_12_to_13_operand")
8705 (match_operand 9 "const_6_to_7_operand")
8706 (match_operand 10 "const_14_to_15_operand")])))]
8710 mask = INTVAL (operands[3]);
8711 mask |= (INTVAL (operands[4]) - 8) << 1;
8712 mask |= (INTVAL (operands[5]) - 2) << 2;
8713 mask |= (INTVAL (operands[6]) - 10) << 3;
8714 mask |= (INTVAL (operands[7]) - 4) << 4;
8715 mask |= (INTVAL (operands[8]) - 12) << 5;
8716 mask |= (INTVAL (operands[9]) - 6) << 6;
8717 mask |= (INTVAL (operands[10]) - 14) << 7;
8718 operands[3] = GEN_INT (mask);
8720 return "vshufpd\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
8722 [(set_attr "type" "sselog")
8723 (set_attr "length_immediate" "1")
8724 (set_attr "prefix" "evex")
8725 (set_attr "mode" "V8DF")])
8727 (define_expand "avx_shufpd256<mask_expand4_name>"
8728 [(match_operand:V4DF 0 "register_operand")
8729 (match_operand:V4DF 1 "register_operand")
8730 (match_operand:V4DF 2 "nonimmediate_operand")
8731 (match_operand:SI 3 "const_int_operand")]
8734 int mask = INTVAL (operands[3]);
8735 emit_insn (gen_avx_shufpd256_1<mask_expand4_name> (operands[0],
8739 GEN_INT (mask & 2 ? 5 : 4),
8740 GEN_INT (mask & 4 ? 3 : 2),
8741 GEN_INT (mask & 8 ? 7 : 6)
8742 <mask_expand4_args>));
8746 (define_insn "avx_shufpd256_1<mask_name>"
8747 [(set (match_operand:V4DF 0 "register_operand" "=v")
8750 (match_operand:V4DF 1 "register_operand" "v")
8751 (match_operand:V4DF 2 "nonimmediate_operand" "vm"))
8752 (parallel [(match_operand 3 "const_0_to_1_operand")
8753 (match_operand 4 "const_4_to_5_operand")
8754 (match_operand 5 "const_2_to_3_operand")
8755 (match_operand 6 "const_6_to_7_operand")])))]
8756 "TARGET_AVX && <mask_avx512vl_condition>"
8759 mask = INTVAL (operands[3]);
8760 mask |= (INTVAL (operands[4]) - 4) << 1;
8761 mask |= (INTVAL (operands[5]) - 2) << 2;
8762 mask |= (INTVAL (operands[6]) - 6) << 3;
8763 operands[3] = GEN_INT (mask);
8765 return "vshufpd\t{%3, %2, %1, %0<mask_operand7>|%0<mask_operand7>, %1, %2, %3}";
8767 [(set_attr "type" "sseshuf")
8768 (set_attr "length_immediate" "1")
8769 (set_attr "prefix" "vex")
8770 (set_attr "mode" "V4DF")])
8772 (define_expand "sse2_shufpd<mask_expand4_name>"
8773 [(match_operand:V2DF 0 "register_operand")
8774 (match_operand:V2DF 1 "register_operand")
8775 (match_operand:V2DF 2 "vector_operand")
8776 (match_operand:SI 3 "const_int_operand")]
8779 int mask = INTVAL (operands[3]);
8780 emit_insn (gen_sse2_shufpd_v2df<mask_expand4_name> (operands[0], operands[1],
8781 operands[2], GEN_INT (mask & 1),
8782 GEN_INT (mask & 2 ? 3 : 2)
8783 <mask_expand4_args>));
8787 (define_insn "sse2_shufpd_v2df_mask"
8788 [(set (match_operand:V2DF 0 "register_operand" "=v")
8792 (match_operand:V2DF 1 "register_operand" "v")
8793 (match_operand:V2DF 2 "nonimmediate_operand" "vm"))
8794 (parallel [(match_operand 3 "const_0_to_1_operand")
8795 (match_operand 4 "const_2_to_3_operand")]))
8796 (match_operand:V2DF 5 "vector_move_operand" "0C")
8797 (match_operand:QI 6 "register_operand" "Yk")))]
8801 mask = INTVAL (operands[3]);
8802 mask |= (INTVAL (operands[4]) - 2) << 1;
8803 operands[3] = GEN_INT (mask);
8805 return "vshufpd\t{%3, %2, %1, %0%{%6%}%N5|%0%{%6%}%N5, %1, %2, %3}";
8807 [(set_attr "type" "sseshuf")
8808 (set_attr "length_immediate" "1")
8809 (set_attr "prefix" "evex")
8810 (set_attr "mode" "V2DF")])
8812 ;; punpcklqdq and punpckhqdq are shorter than shufpd.
8813 (define_insn "avx2_interleave_highv4di<mask_name>"
8814 [(set (match_operand:V4DI 0 "register_operand" "=v")
8817 (match_operand:V4DI 1 "register_operand" "v")
8818 (match_operand:V4DI 2 "nonimmediate_operand" "vm"))
8819 (parallel [(const_int 1)
8823 "TARGET_AVX2 && <mask_avx512vl_condition>"
8824 "vpunpckhqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8825 [(set_attr "type" "sselog")
8826 (set_attr "prefix" "vex")
8827 (set_attr "mode" "OI")])
8829 (define_insn "<mask_codefor>avx512f_interleave_highv8di<mask_name>"
8830 [(set (match_operand:V8DI 0 "register_operand" "=v")
8833 (match_operand:V8DI 1 "register_operand" "v")
8834 (match_operand:V8DI 2 "nonimmediate_operand" "vm"))
8835 (parallel [(const_int 1) (const_int 9)
8836 (const_int 3) (const_int 11)
8837 (const_int 5) (const_int 13)
8838 (const_int 7) (const_int 15)])))]
8840 "vpunpckhqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8841 [(set_attr "type" "sselog")
8842 (set_attr "prefix" "evex")
8843 (set_attr "mode" "XI")])
8845 (define_insn "vec_interleave_highv2di<mask_name>"
8846 [(set (match_operand:V2DI 0 "register_operand" "=x,v")
8849 (match_operand:V2DI 1 "register_operand" "0,v")
8850 (match_operand:V2DI 2 "vector_operand" "xBm,vm"))
8851 (parallel [(const_int 1)
8853 "TARGET_SSE2 && <mask_avx512vl_condition>"
8855 punpckhqdq\t{%2, %0|%0, %2}
8856 vpunpckhqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8857 [(set_attr "isa" "noavx,avx")
8858 (set_attr "type" "sselog")
8859 (set_attr "prefix_data16" "1,*")
8860 (set_attr "prefix" "orig,<mask_prefix>")
8861 (set_attr "mode" "TI")])
8863 (define_insn "avx2_interleave_lowv4di<mask_name>"
8864 [(set (match_operand:V4DI 0 "register_operand" "=v")
8867 (match_operand:V4DI 1 "register_operand" "v")
8868 (match_operand:V4DI 2 "nonimmediate_operand" "vm"))
8869 (parallel [(const_int 0)
8873 "TARGET_AVX2 && <mask_avx512vl_condition>"
8874 "vpunpcklqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8875 [(set_attr "type" "sselog")
8876 (set_attr "prefix" "vex")
8877 (set_attr "mode" "OI")])
8879 (define_insn "<mask_codefor>avx512f_interleave_lowv8di<mask_name>"
8880 [(set (match_operand:V8DI 0 "register_operand" "=v")
8883 (match_operand:V8DI 1 "register_operand" "v")
8884 (match_operand:V8DI 2 "nonimmediate_operand" "vm"))
8885 (parallel [(const_int 0) (const_int 8)
8886 (const_int 2) (const_int 10)
8887 (const_int 4) (const_int 12)
8888 (const_int 6) (const_int 14)])))]
8890 "vpunpcklqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8891 [(set_attr "type" "sselog")
8892 (set_attr "prefix" "evex")
8893 (set_attr "mode" "XI")])
8895 (define_insn "vec_interleave_lowv2di<mask_name>"
8896 [(set (match_operand:V2DI 0 "register_operand" "=x,v")
8899 (match_operand:V2DI 1 "register_operand" "0,v")
8900 (match_operand:V2DI 2 "vector_operand" "xBm,vm"))
8901 (parallel [(const_int 0)
8903 "TARGET_SSE2 && <mask_avx512vl_condition>"
8905 punpcklqdq\t{%2, %0|%0, %2}
8906 vpunpcklqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8907 [(set_attr "isa" "noavx,avx")
8908 (set_attr "type" "sselog")
8909 (set_attr "prefix_data16" "1,*")
8910 (set_attr "prefix" "orig,vex")
8911 (set_attr "mode" "TI")])
8913 (define_insn "sse2_shufpd_<mode>"
8914 [(set (match_operand:VI8F_128 0 "register_operand" "=x,v")
8915 (vec_select:VI8F_128
8916 (vec_concat:<ssedoublevecmode>
8917 (match_operand:VI8F_128 1 "register_operand" "0,v")
8918 (match_operand:VI8F_128 2 "vector_operand" "xBm,vm"))
8919 (parallel [(match_operand 3 "const_0_to_1_operand")
8920 (match_operand 4 "const_2_to_3_operand")])))]
8924 mask = INTVAL (operands[3]);
8925 mask |= (INTVAL (operands[4]) - 2) << 1;
8926 operands[3] = GEN_INT (mask);
8928 switch (which_alternative)
8931 return "shufpd\t{%3, %2, %0|%0, %2, %3}";
8933 return "vshufpd\t{%3, %2, %1, %0|%0, %1, %2, %3}";
8938 [(set_attr "isa" "noavx,avx")
8939 (set_attr "type" "sseshuf")
8940 (set_attr "length_immediate" "1")
8941 (set_attr "prefix" "orig,maybe_evex")
8942 (set_attr "mode" "V2DF")])
8944 ;; Avoid combining registers from different units in a single alternative,
8945 ;; see comment above inline_secondary_memory_needed function in i386.c
8946 (define_insn "sse2_storehpd"
8947 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,Yv,x,*f,r")
8949 (match_operand:V2DF 1 "nonimmediate_operand" " v,0, v,o,o,o")
8950 (parallel [(const_int 1)])))]
8951 "TARGET_SSE2 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
8953 %vmovhpd\t{%1, %0|%0, %1}
8955 vunpckhpd\t{%d1, %0|%0, %d1}
8959 [(set_attr "isa" "*,noavx,avx,*,*,*")
8960 (set_attr "type" "ssemov,sselog1,sselog1,ssemov,fmov,imov")
8961 (set (attr "prefix_data16")
8963 (and (eq_attr "alternative" "0")
8964 (not (match_test "TARGET_AVX")))
8966 (const_string "*")))
8967 (set_attr "prefix" "maybe_vex,orig,maybe_evex,*,*,*")
8968 (set_attr "mode" "V1DF,V1DF,V2DF,DF,DF,DF")])
8971 [(set (match_operand:DF 0 "register_operand")
8973 (match_operand:V2DF 1 "memory_operand")
8974 (parallel [(const_int 1)])))]
8975 "TARGET_SSE2 && reload_completed"
8976 [(set (match_dup 0) (match_dup 1))]
8977 "operands[1] = adjust_address (operands[1], DFmode, 8);")
8979 (define_insn "*vec_extractv2df_1_sse"
8980 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,x")
8982 (match_operand:V2DF 1 "nonimmediate_operand" "x,x,o")
8983 (parallel [(const_int 1)])))]
8984 "!TARGET_SSE2 && TARGET_SSE
8985 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
8987 movhps\t{%1, %0|%q0, %1}
8988 movhlps\t{%1, %0|%0, %1}
8989 movlps\t{%H1, %0|%0, %H1}"
8990 [(set_attr "type" "ssemov")
8991 (set_attr "mode" "V2SF,V4SF,V2SF")])
8993 ;; Avoid combining registers from different units in a single alternative,
8994 ;; see comment above inline_secondary_memory_needed function in i386.c
8995 (define_insn "sse2_storelpd"
8996 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,x,*f,r")
8998 (match_operand:V2DF 1 "nonimmediate_operand" " v,x,m,m,m")
8999 (parallel [(const_int 0)])))]
9000 "TARGET_SSE2 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
9002 %vmovlpd\t{%1, %0|%0, %1}
9007 [(set_attr "type" "ssemov,ssemov,ssemov,fmov,imov")
9008 (set (attr "prefix_data16")
9009 (if_then_else (eq_attr "alternative" "0")
9011 (const_string "*")))
9012 (set_attr "prefix" "maybe_vex")
9013 (set_attr "mode" "V1DF,DF,DF,DF,DF")])
9016 [(set (match_operand:DF 0 "register_operand")
9018 (match_operand:V2DF 1 "nonimmediate_operand")
9019 (parallel [(const_int 0)])))]
9020 "TARGET_SSE2 && reload_completed"
9021 [(set (match_dup 0) (match_dup 1))]
9022 "operands[1] = gen_lowpart (DFmode, operands[1]);")
9024 (define_insn "*vec_extractv2df_0_sse"
9025 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,x")
9027 (match_operand:V2DF 1 "nonimmediate_operand" "x,x,m")
9028 (parallel [(const_int 0)])))]
9029 "!TARGET_SSE2 && TARGET_SSE
9030 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
9032 movlps\t{%1, %0|%0, %1}
9033 movaps\t{%1, %0|%0, %1}
9034 movlps\t{%1, %0|%0, %q1}"
9035 [(set_attr "type" "ssemov")
9036 (set_attr "mode" "V2SF,V4SF,V2SF")])
9038 (define_expand "sse2_loadhpd_exp"
9039 [(set (match_operand:V2DF 0 "nonimmediate_operand")
9042 (match_operand:V2DF 1 "nonimmediate_operand")
9043 (parallel [(const_int 0)]))
9044 (match_operand:DF 2 "nonimmediate_operand")))]
9047 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V2DFmode, operands);
9049 emit_insn (gen_sse2_loadhpd (dst, operands[1], operands[2]));
9051 /* Fix up the destination if needed. */
9052 if (dst != operands[0])
9053 emit_move_insn (operands[0], dst);
9058 ;; Avoid combining registers from different units in a single alternative,
9059 ;; see comment above inline_secondary_memory_needed function in i386.c
9060 (define_insn "sse2_loadhpd"
9061 [(set (match_operand:V2DF 0 "nonimmediate_operand"
9065 (match_operand:V2DF 1 "nonimmediate_operand"
9067 (parallel [(const_int 0)]))
9068 (match_operand:DF 2 "nonimmediate_operand"
9069 " m,m,x,Yv,x,*f,r")))]
9070 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
9072 movhpd\t{%2, %0|%0, %2}
9073 vmovhpd\t{%2, %1, %0|%0, %1, %2}
9074 unpcklpd\t{%2, %0|%0, %2}
9075 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
9079 [(set_attr "isa" "noavx,avx,noavx,avx,*,*,*")
9080 (set_attr "type" "ssemov,ssemov,sselog,sselog,ssemov,fmov,imov")
9081 (set (attr "prefix_data16")
9082 (if_then_else (eq_attr "alternative" "0")
9084 (const_string "*")))
9085 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,*,*,*")
9086 (set_attr "mode" "V1DF,V1DF,V2DF,V2DF,DF,DF,DF")])
9089 [(set (match_operand:V2DF 0 "memory_operand")
9091 (vec_select:DF (match_dup 0) (parallel [(const_int 0)]))
9092 (match_operand:DF 1 "register_operand")))]
9093 "TARGET_SSE2 && reload_completed"
9094 [(set (match_dup 0) (match_dup 1))]
9095 "operands[0] = adjust_address (operands[0], DFmode, 8);")
9097 (define_expand "sse2_loadlpd_exp"
9098 [(set (match_operand:V2DF 0 "nonimmediate_operand")
9100 (match_operand:DF 2 "nonimmediate_operand")
9102 (match_operand:V2DF 1 "nonimmediate_operand")
9103 (parallel [(const_int 1)]))))]
9106 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V2DFmode, operands);
9108 emit_insn (gen_sse2_loadlpd (dst, operands[1], operands[2]));
9110 /* Fix up the destination if needed. */
9111 if (dst != operands[0])
9112 emit_move_insn (operands[0], dst);
9117 ;; Avoid combining registers from different units in a single alternative,
9118 ;; see comment above inline_secondary_memory_needed function in i386.c
9119 (define_insn "sse2_loadlpd"
9120 [(set (match_operand:V2DF 0 "nonimmediate_operand"
9121 "=v,x,v,x,v,x,x,v,m,m ,m")
9123 (match_operand:DF 2 "nonimmediate_operand"
9124 "vm,m,m,x,v,0,0,v,x,*f,r")
9126 (match_operand:V2DF 1 "vector_move_operand"
9127 " C,0,v,0,v,x,o,o,0,0 ,0")
9128 (parallel [(const_int 1)]))))]
9129 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
9131 %vmovq\t{%2, %0|%0, %2}
9132 movlpd\t{%2, %0|%0, %2}
9133 vmovlpd\t{%2, %1, %0|%0, %1, %2}
9134 movsd\t{%2, %0|%0, %2}
9135 vmovsd\t{%2, %1, %0|%0, %1, %2}
9136 shufpd\t{$2, %1, %0|%0, %1, 2}
9137 movhpd\t{%H1, %0|%0, %H1}
9138 vmovhpd\t{%H1, %2, %0|%0, %2, %H1}
9142 [(set_attr "isa" "*,noavx,avx,noavx,avx,noavx,noavx,avx,*,*,*")
9144 (cond [(eq_attr "alternative" "5")
9145 (const_string "sselog")
9146 (eq_attr "alternative" "9")
9147 (const_string "fmov")
9148 (eq_attr "alternative" "10")
9149 (const_string "imov")
9151 (const_string "ssemov")))
9152 (set (attr "prefix_data16")
9153 (if_then_else (eq_attr "alternative" "1,6")
9155 (const_string "*")))
9156 (set (attr "length_immediate")
9157 (if_then_else (eq_attr "alternative" "5")
9159 (const_string "*")))
9160 (set (attr "prefix")
9161 (cond [(eq_attr "alternative" "0")
9162 (const_string "maybe_vex")
9163 (eq_attr "alternative" "1,3,5,6")
9164 (const_string "orig")
9165 (eq_attr "alternative" "2,4,7")
9166 (const_string "maybe_evex")
9168 (const_string "*")))
9169 (set_attr "mode" "DF,V1DF,V1DF,V1DF,V1DF,V2DF,V1DF,V1DF,DF,DF,DF")])
9172 [(set (match_operand:V2DF 0 "memory_operand")
9174 (match_operand:DF 1 "register_operand")
9175 (vec_select:DF (match_dup 0) (parallel [(const_int 1)]))))]
9176 "TARGET_SSE2 && reload_completed"
9177 [(set (match_dup 0) (match_dup 1))]
9178 "operands[0] = adjust_address (operands[0], DFmode, 0);")
9180 (define_insn "sse2_movsd"
9181 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,v,x,v,m,x,x,v,o")
9183 (match_operand:V2DF 2 "nonimmediate_operand" " x,v,m,m,v,0,0,v,0")
9184 (match_operand:V2DF 1 "nonimmediate_operand" " 0,v,0,v,0,x,o,o,v")
9188 movsd\t{%2, %0|%0, %2}
9189 vmovsd\t{%2, %1, %0|%0, %1, %2}
9190 movlpd\t{%2, %0|%0, %q2}
9191 vmovlpd\t{%2, %1, %0|%0, %1, %q2}
9192 %vmovlpd\t{%2, %0|%q0, %2}
9193 shufpd\t{$2, %1, %0|%0, %1, 2}
9194 movhps\t{%H1, %0|%0, %H1}
9195 vmovhps\t{%H1, %2, %0|%0, %2, %H1}
9196 %vmovhps\t{%1, %H0|%H0, %1}"
9197 [(set_attr "isa" "noavx,avx,noavx,avx,*,noavx,noavx,avx,*")
9200 (eq_attr "alternative" "5")
9201 (const_string "sselog")
9202 (const_string "ssemov")))
9203 (set (attr "prefix_data16")
9205 (and (eq_attr "alternative" "2,4")
9206 (not (match_test "TARGET_AVX")))
9208 (const_string "*")))
9209 (set (attr "length_immediate")
9210 (if_then_else (eq_attr "alternative" "5")
9212 (const_string "*")))
9213 (set (attr "prefix")
9214 (cond [(eq_attr "alternative" "1,3,7")
9215 (const_string "maybe_evex")
9216 (eq_attr "alternative" "4,8")
9217 (const_string "maybe_vex")
9219 (const_string "orig")))
9220 (set_attr "mode" "DF,DF,V1DF,V1DF,V1DF,V2DF,V1DF,V1DF,V1DF")])
9222 (define_insn "vec_dupv2df<mask_name>"
9223 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
9225 (match_operand:DF 1 "nonimmediate_operand" " 0,xm,vm")))]
9226 "TARGET_SSE2 && <mask_avx512vl_condition>"
9229 %vmovddup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}
9230 vmovddup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
9231 [(set_attr "isa" "noavx,sse3,avx512vl")
9232 (set_attr "type" "sselog1")
9233 (set_attr "prefix" "orig,maybe_vex,evex")
9234 (set_attr "mode" "V2DF,DF,DF")])
9236 (define_insn "vec_concatv2df"
9237 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v,x,v,x,x, v,x,x")
9239 (match_operand:DF 1 "nonimmediate_operand" " 0,x,v,m,m,0,x,xm,0,0")
9240 (match_operand:DF 2 "vector_move_operand" " x,x,v,1,1,m,m, C,x,m")))]
9242 && (!(MEM_P (operands[1]) && MEM_P (operands[2]))
9243 || (TARGET_SSE3 && rtx_equal_p (operands[1], operands[2])))"
9245 unpcklpd\t{%2, %0|%0, %2}
9246 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
9247 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
9248 %vmovddup\t{%1, %0|%0, %1}
9249 vmovddup\t{%1, %0|%0, %1}
9250 movhpd\t{%2, %0|%0, %2}
9251 vmovhpd\t{%2, %1, %0|%0, %1, %2}
9252 %vmovq\t{%1, %0|%0, %1}
9253 movlhps\t{%2, %0|%0, %2}
9254 movhps\t{%2, %0|%0, %2}"
9256 (cond [(eq_attr "alternative" "0,5")
9257 (const_string "sse2_noavx")
9258 (eq_attr "alternative" "1,6")
9259 (const_string "avx")
9260 (eq_attr "alternative" "2,4")
9261 (const_string "avx512vl")
9262 (eq_attr "alternative" "3")
9263 (const_string "sse3")
9264 (eq_attr "alternative" "7")
9265 (const_string "sse2")
9267 (const_string "noavx")))
9270 (eq_attr "alternative" "0,1,2,3,4")
9271 (const_string "sselog")
9272 (const_string "ssemov")))
9273 (set (attr "prefix_data16")
9274 (if_then_else (eq_attr "alternative" "5")
9276 (const_string "*")))
9277 (set (attr "prefix")
9278 (cond [(eq_attr "alternative" "1,6")
9279 (const_string "vex")
9280 (eq_attr "alternative" "2,4")
9281 (const_string "evex")
9282 (eq_attr "alternative" "3,7")
9283 (const_string "maybe_vex")
9285 (const_string "orig")))
9286 (set_attr "mode" "V2DF,V2DF,V2DF, DF, DF, V1DF,V1DF,DF,V4SF,V2SF")])
9288 ;; vmovq clears also the higher bits.
9289 (define_insn "vec_set<mode>_0"
9290 [(set (match_operand:VF2_512_256 0 "register_operand" "=v")
9291 (vec_merge:VF2_512_256
9292 (vec_duplicate:VF2_512_256
9293 (match_operand:<ssescalarmode> 2 "general_operand" "xm"))
9294 (match_operand:VF2_512_256 1 "const0_operand" "C")
9297 "vmovq\t{%2, %x0|%x0, %2}"
9298 [(set_attr "type" "ssemov")
9299 (set_attr "prefix" "maybe_evex")
9300 (set_attr "mode" "DF")])
9302 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9304 ;; Parallel integer down-conversion operations
9306 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9308 (define_mode_iterator PMOV_DST_MODE_1 [V16QI V16HI V8SI V8HI])
9309 (define_mode_attr pmov_src_mode
9310 [(V16QI "V16SI") (V16HI "V16SI") (V8SI "V8DI") (V8HI "V8DI")])
9311 (define_mode_attr pmov_src_lower
9312 [(V16QI "v16si") (V16HI "v16si") (V8SI "v8di") (V8HI "v8di")])
9313 (define_mode_attr pmov_suff_1
9314 [(V16QI "db") (V16HI "dw") (V8SI "qd") (V8HI "qw")])
9316 (define_insn "*avx512f_<code><pmov_src_lower><mode>2"
9317 [(set (match_operand:PMOV_DST_MODE_1 0 "nonimmediate_operand" "=v,m")
9318 (any_truncate:PMOV_DST_MODE_1
9319 (match_operand:<pmov_src_mode> 1 "register_operand" "v,v")))]
9321 "vpmov<trunsuffix><pmov_suff_1>\t{%1, %0|%0, %1}"
9322 [(set_attr "type" "ssemov")
9323 (set_attr "memory" "none,store")
9324 (set_attr "prefix" "evex")
9325 (set_attr "mode" "<sseinsnmode>")])
9327 (define_insn "avx512f_<code><pmov_src_lower><mode>2_mask"
9328 [(set (match_operand:PMOV_DST_MODE_1 0 "nonimmediate_operand" "=v,m")
9329 (vec_merge:PMOV_DST_MODE_1
9330 (any_truncate:PMOV_DST_MODE_1
9331 (match_operand:<pmov_src_mode> 1 "register_operand" "v,v"))
9332 (match_operand:PMOV_DST_MODE_1 2 "vector_move_operand" "0C,0")
9333 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
9335 "vpmov<trunsuffix><pmov_suff_1>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9336 [(set_attr "type" "ssemov")
9337 (set_attr "memory" "none,store")
9338 (set_attr "prefix" "evex")
9339 (set_attr "mode" "<sseinsnmode>")])
9341 (define_expand "avx512f_<code><pmov_src_lower><mode>2_mask_store"
9342 [(set (match_operand:PMOV_DST_MODE_1 0 "memory_operand")
9343 (vec_merge:PMOV_DST_MODE_1
9344 (any_truncate:PMOV_DST_MODE_1
9345 (match_operand:<pmov_src_mode> 1 "register_operand"))
9347 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
9350 (define_insn "avx512bw_<code>v32hiv32qi2"
9351 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=v,m")
9353 (match_operand:V32HI 1 "register_operand" "v,v")))]
9355 "vpmov<trunsuffix>wb\t{%1, %0|%0, %1}"
9356 [(set_attr "type" "ssemov")
9357 (set_attr "memory" "none,store")
9358 (set_attr "prefix" "evex")
9359 (set_attr "mode" "XI")])
9361 (define_insn "avx512bw_<code>v32hiv32qi2_mask"
9362 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=v,m")
9365 (match_operand:V32HI 1 "register_operand" "v,v"))
9366 (match_operand:V32QI 2 "vector_move_operand" "0C,0")
9367 (match_operand:SI 3 "register_operand" "Yk,Yk")))]
9369 "vpmov<trunsuffix>wb\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9370 [(set_attr "type" "ssemov")
9371 (set_attr "memory" "none,store")
9372 (set_attr "prefix" "evex")
9373 (set_attr "mode" "XI")])
9375 (define_expand "avx512bw_<code>v32hiv32qi2_mask_store"
9376 [(set (match_operand:V32QI 0 "nonimmediate_operand")
9379 (match_operand:V32HI 1 "register_operand"))
9381 (match_operand:SI 2 "register_operand")))]
9384 (define_mode_iterator PMOV_DST_MODE_2
9385 [V4SI V8HI (V16QI "TARGET_AVX512BW")])
9386 (define_mode_attr pmov_suff_2
9387 [(V16QI "wb") (V8HI "dw") (V4SI "qd")])
9389 (define_insn "*avx512vl_<code><ssedoublemodelower><mode>2"
9390 [(set (match_operand:PMOV_DST_MODE_2 0 "nonimmediate_operand" "=v,m")
9391 (any_truncate:PMOV_DST_MODE_2
9392 (match_operand:<ssedoublemode> 1 "register_operand" "v,v")))]
9394 "vpmov<trunsuffix><pmov_suff_2>\t{%1, %0|%0, %1}"
9395 [(set_attr "type" "ssemov")
9396 (set_attr "memory" "none,store")
9397 (set_attr "prefix" "evex")
9398 (set_attr "mode" "<sseinsnmode>")])
9400 (define_insn "<avx512>_<code><ssedoublemodelower><mode>2_mask"
9401 [(set (match_operand:PMOV_DST_MODE_2 0 "nonimmediate_operand" "=v,m")
9402 (vec_merge:PMOV_DST_MODE_2
9403 (any_truncate:PMOV_DST_MODE_2
9404 (match_operand:<ssedoublemode> 1 "register_operand" "v,v"))
9405 (match_operand:PMOV_DST_MODE_2 2 "vector_move_operand" "0C,0")
9406 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
9408 "vpmov<trunsuffix><pmov_suff_2>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9409 [(set_attr "type" "ssemov")
9410 (set_attr "memory" "none,store")
9411 (set_attr "prefix" "evex")
9412 (set_attr "mode" "<sseinsnmode>")])
9414 (define_expand "<avx512>_<code><ssedoublemodelower><mode>2_mask_store"
9415 [(set (match_operand:PMOV_DST_MODE_2 0 "nonimmediate_operand")
9416 (vec_merge:PMOV_DST_MODE_2
9417 (any_truncate:PMOV_DST_MODE_2
9418 (match_operand:<ssedoublemode> 1 "register_operand"))
9420 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
9423 (define_mode_iterator PMOV_SRC_MODE_3 [V4DI V2DI V8SI V4SI (V8HI "TARGET_AVX512BW")])
9424 (define_mode_attr pmov_dst_3
9425 [(V4DI "V4QI") (V2DI "V2QI") (V8SI "V8QI") (V4SI "V4QI") (V8HI "V8QI")])
9426 (define_mode_attr pmov_dst_zeroed_3
9427 [(V4DI "V12QI") (V2DI "V14QI") (V8SI "V8QI") (V4SI "V12QI") (V8HI "V8QI")])
9428 (define_mode_attr pmov_suff_3
9429 [(V4DI "qb") (V2DI "qb") (V8SI "db") (V4SI "db") (V8HI "wb")])
9431 (define_insn "*avx512vl_<code><mode>v<ssescalarnum>qi2"
9432 [(set (match_operand:V16QI 0 "register_operand" "=v")
9434 (any_truncate:<pmov_dst_3>
9435 (match_operand:PMOV_SRC_MODE_3 1 "register_operand" "v"))
9436 (match_operand:<pmov_dst_zeroed_3> 2 "const0_operand")))]
9438 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0|%0, %1}"
9439 [(set_attr "type" "ssemov")
9440 (set_attr "prefix" "evex")
9441 (set_attr "mode" "TI")])
9443 (define_insn "*avx512vl_<code>v2div2qi2_store"
9444 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9447 (match_operand:V2DI 1 "register_operand" "v"))
9450 (parallel [(const_int 2) (const_int 3)
9451 (const_int 4) (const_int 5)
9452 (const_int 6) (const_int 7)
9453 (const_int 8) (const_int 9)
9454 (const_int 10) (const_int 11)
9455 (const_int 12) (const_int 13)
9456 (const_int 14) (const_int 15)]))))]
9458 "vpmov<trunsuffix>qb\t{%1, %0|%w0, %1}"
9459 [(set_attr "type" "ssemov")
9460 (set_attr "memory" "store")
9461 (set_attr "prefix" "evex")
9462 (set_attr "mode" "TI")])
9464 (define_insn "avx512vl_<code>v2div2qi2_mask"
9465 [(set (match_operand:V16QI 0 "register_operand" "=v")
9469 (match_operand:V2DI 1 "register_operand" "v"))
9471 (match_operand:V16QI 2 "vector_move_operand" "0C")
9472 (parallel [(const_int 0) (const_int 1)]))
9473 (match_operand:QI 3 "register_operand" "Yk"))
9474 (const_vector:V14QI [(const_int 0) (const_int 0)
9475 (const_int 0) (const_int 0)
9476 (const_int 0) (const_int 0)
9477 (const_int 0) (const_int 0)
9478 (const_int 0) (const_int 0)
9479 (const_int 0) (const_int 0)
9480 (const_int 0) (const_int 0)])))]
9482 "vpmov<trunsuffix>qb\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9483 [(set_attr "type" "ssemov")
9484 (set_attr "prefix" "evex")
9485 (set_attr "mode" "TI")])
9487 (define_insn "*avx512vl_<code>v2div2qi2_mask_1"
9488 [(set (match_operand:V16QI 0 "register_operand" "=v")
9492 (match_operand:V2DI 1 "register_operand" "v"))
9493 (const_vector:V2QI [(const_int 0) (const_int 0)])
9494 (match_operand:QI 2 "register_operand" "Yk"))
9495 (const_vector:V14QI [(const_int 0) (const_int 0)
9496 (const_int 0) (const_int 0)
9497 (const_int 0) (const_int 0)
9498 (const_int 0) (const_int 0)
9499 (const_int 0) (const_int 0)
9500 (const_int 0) (const_int 0)
9501 (const_int 0) (const_int 0)])))]
9503 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9504 [(set_attr "type" "ssemov")
9505 (set_attr "prefix" "evex")
9506 (set_attr "mode" "TI")])
9508 (define_insn "avx512vl_<code>v2div2qi2_mask_store"
9509 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9513 (match_operand:V2DI 1 "register_operand" "v"))
9516 (parallel [(const_int 0) (const_int 1)]))
9517 (match_operand:QI 2 "register_operand" "Yk"))
9520 (parallel [(const_int 2) (const_int 3)
9521 (const_int 4) (const_int 5)
9522 (const_int 6) (const_int 7)
9523 (const_int 8) (const_int 9)
9524 (const_int 10) (const_int 11)
9525 (const_int 12) (const_int 13)
9526 (const_int 14) (const_int 15)]))))]
9528 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}|%w0%{%2%}, %1}"
9529 [(set_attr "type" "ssemov")
9530 (set_attr "memory" "store")
9531 (set_attr "prefix" "evex")
9532 (set_attr "mode" "TI")])
9534 (define_insn "*avx512vl_<code><mode>v4qi2_store"
9535 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9538 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9541 (parallel [(const_int 4) (const_int 5)
9542 (const_int 6) (const_int 7)
9543 (const_int 8) (const_int 9)
9544 (const_int 10) (const_int 11)
9545 (const_int 12) (const_int 13)
9546 (const_int 14) (const_int 15)]))))]
9548 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0|%k0, %1}"
9549 [(set_attr "type" "ssemov")
9550 (set_attr "memory" "store")
9551 (set_attr "prefix" "evex")
9552 (set_attr "mode" "TI")])
9554 (define_insn "avx512vl_<code><mode>v4qi2_mask"
9555 [(set (match_operand:V16QI 0 "register_operand" "=v")
9559 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9561 (match_operand:V16QI 2 "vector_move_operand" "0C")
9562 (parallel [(const_int 0) (const_int 1)
9563 (const_int 2) (const_int 3)]))
9564 (match_operand:QI 3 "register_operand" "Yk"))
9565 (const_vector:V12QI [(const_int 0) (const_int 0)
9566 (const_int 0) (const_int 0)
9567 (const_int 0) (const_int 0)
9568 (const_int 0) (const_int 0)
9569 (const_int 0) (const_int 0)
9570 (const_int 0) (const_int 0)])))]
9572 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9573 [(set_attr "type" "ssemov")
9574 (set_attr "prefix" "evex")
9575 (set_attr "mode" "TI")])
9577 (define_insn "*avx512vl_<code><mode>v4qi2_mask_1"
9578 [(set (match_operand:V16QI 0 "register_operand" "=v")
9582 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9583 (const_vector:V4QI [(const_int 0) (const_int 0)
9584 (const_int 0) (const_int 0)])
9585 (match_operand:QI 2 "register_operand" "Yk"))
9586 (const_vector:V12QI [(const_int 0) (const_int 0)
9587 (const_int 0) (const_int 0)
9588 (const_int 0) (const_int 0)
9589 (const_int 0) (const_int 0)
9590 (const_int 0) (const_int 0)
9591 (const_int 0) (const_int 0)])))]
9593 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9594 [(set_attr "type" "ssemov")
9595 (set_attr "prefix" "evex")
9596 (set_attr "mode" "TI")])
9598 (define_insn "avx512vl_<code><mode>v4qi2_mask_store"
9599 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9603 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9606 (parallel [(const_int 0) (const_int 1)
9607 (const_int 2) (const_int 3)]))
9608 (match_operand:QI 2 "register_operand" "Yk"))
9611 (parallel [(const_int 4) (const_int 5)
9612 (const_int 6) (const_int 7)
9613 (const_int 8) (const_int 9)
9614 (const_int 10) (const_int 11)
9615 (const_int 12) (const_int 13)
9616 (const_int 14) (const_int 15)]))))]
9618 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}|%k0%{%2%}, %1}"
9619 [(set_attr "type" "ssemov")
9620 (set_attr "memory" "store")
9621 (set_attr "prefix" "evex")
9622 (set_attr "mode" "TI")])
9624 (define_mode_iterator VI2_128_BW_4_256
9625 [(V8HI "TARGET_AVX512BW") V8SI])
9627 (define_insn "*avx512vl_<code><mode>v8qi2_store"
9628 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9631 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9634 (parallel [(const_int 8) (const_int 9)
9635 (const_int 10) (const_int 11)
9636 (const_int 12) (const_int 13)
9637 (const_int 14) (const_int 15)]))))]
9639 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0|%q0, %1}"
9640 [(set_attr "type" "ssemov")
9641 (set_attr "memory" "store")
9642 (set_attr "prefix" "evex")
9643 (set_attr "mode" "TI")])
9645 (define_insn "avx512vl_<code><mode>v8qi2_mask"
9646 [(set (match_operand:V16QI 0 "register_operand" "=v")
9650 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9652 (match_operand:V16QI 2 "vector_move_operand" "0C")
9653 (parallel [(const_int 0) (const_int 1)
9654 (const_int 2) (const_int 3)
9655 (const_int 4) (const_int 5)
9656 (const_int 6) (const_int 7)]))
9657 (match_operand:QI 3 "register_operand" "Yk"))
9658 (const_vector:V8QI [(const_int 0) (const_int 0)
9659 (const_int 0) (const_int 0)
9660 (const_int 0) (const_int 0)
9661 (const_int 0) (const_int 0)])))]
9663 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9664 [(set_attr "type" "ssemov")
9665 (set_attr "prefix" "evex")
9666 (set_attr "mode" "TI")])
9668 (define_insn "*avx512vl_<code><mode>v8qi2_mask_1"
9669 [(set (match_operand:V16QI 0 "register_operand" "=v")
9673 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9674 (const_vector:V8QI [(const_int 0) (const_int 0)
9675 (const_int 0) (const_int 0)
9676 (const_int 0) (const_int 0)
9677 (const_int 0) (const_int 0)])
9678 (match_operand:QI 2 "register_operand" "Yk"))
9679 (const_vector:V8QI [(const_int 0) (const_int 0)
9680 (const_int 0) (const_int 0)
9681 (const_int 0) (const_int 0)
9682 (const_int 0) (const_int 0)])))]
9684 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9685 [(set_attr "type" "ssemov")
9686 (set_attr "prefix" "evex")
9687 (set_attr "mode" "TI")])
9689 (define_insn "avx512vl_<code><mode>v8qi2_mask_store"
9690 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9694 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9697 (parallel [(const_int 0) (const_int 1)
9698 (const_int 2) (const_int 3)
9699 (const_int 4) (const_int 5)
9700 (const_int 6) (const_int 7)]))
9701 (match_operand:QI 2 "register_operand" "Yk"))
9704 (parallel [(const_int 8) (const_int 9)
9705 (const_int 10) (const_int 11)
9706 (const_int 12) (const_int 13)
9707 (const_int 14) (const_int 15)]))))]
9709 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}|%q0%{%2%}, %1}"
9710 [(set_attr "type" "ssemov")
9711 (set_attr "memory" "store")
9712 (set_attr "prefix" "evex")
9713 (set_attr "mode" "TI")])
9715 (define_mode_iterator PMOV_SRC_MODE_4 [V4DI V2DI V4SI])
9716 (define_mode_attr pmov_dst_4
9717 [(V4DI "V4HI") (V2DI "V2HI") (V4SI "V4HI")])
9718 (define_mode_attr pmov_dst_zeroed_4
9719 [(V4DI "V4HI") (V2DI "V6HI") (V4SI "V4HI")])
9720 (define_mode_attr pmov_suff_4
9721 [(V4DI "qw") (V2DI "qw") (V4SI "dw")])
9723 (define_insn "*avx512vl_<code><mode>v<ssescalarnum>hi2"
9724 [(set (match_operand:V8HI 0 "register_operand" "=v")
9726 (any_truncate:<pmov_dst_4>
9727 (match_operand:PMOV_SRC_MODE_4 1 "register_operand" "v"))
9728 (match_operand:<pmov_dst_zeroed_4> 2 "const0_operand")))]
9730 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0|%0, %1}"
9731 [(set_attr "type" "ssemov")
9732 (set_attr "prefix" "evex")
9733 (set_attr "mode" "TI")])
9735 (define_insn "*avx512vl_<code><mode>v4hi2_store"
9736 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9739 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9742 (parallel [(const_int 4) (const_int 5)
9743 (const_int 6) (const_int 7)]))))]
9745 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0|%0, %1}"
9746 [(set_attr "type" "ssemov")
9747 (set_attr "memory" "store")
9748 (set_attr "prefix" "evex")
9749 (set_attr "mode" "TI")])
9751 (define_insn "avx512vl_<code><mode>v4hi2_mask"
9752 [(set (match_operand:V8HI 0 "register_operand" "=v")
9756 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9758 (match_operand:V8HI 2 "vector_move_operand" "0C")
9759 (parallel [(const_int 0) (const_int 1)
9760 (const_int 2) (const_int 3)]))
9761 (match_operand:QI 3 "register_operand" "Yk"))
9762 (const_vector:V4HI [(const_int 0) (const_int 0)
9763 (const_int 0) (const_int 0)])))]
9765 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9766 [(set_attr "type" "ssemov")
9767 (set_attr "prefix" "evex")
9768 (set_attr "mode" "TI")])
9770 (define_insn "*avx512vl_<code><mode>v4hi2_mask_1"
9771 [(set (match_operand:V8HI 0 "register_operand" "=v")
9775 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9776 (const_vector:V4HI [(const_int 0) (const_int 0)
9777 (const_int 0) (const_int 0)])
9778 (match_operand:QI 2 "register_operand" "Yk"))
9779 (const_vector:V4HI [(const_int 0) (const_int 0)
9780 (const_int 0) (const_int 0)])))]
9782 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9783 [(set_attr "type" "ssemov")
9784 (set_attr "prefix" "evex")
9785 (set_attr "mode" "TI")])
9787 (define_insn "avx512vl_<code><mode>v4hi2_mask_store"
9788 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9792 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9795 (parallel [(const_int 0) (const_int 1)
9796 (const_int 2) (const_int 3)]))
9797 (match_operand:QI 2 "register_operand" "Yk"))
9800 (parallel [(const_int 4) (const_int 5)
9801 (const_int 6) (const_int 7)]))))]
9804 if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 4)
9805 return "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%2%}|%0%{%2%}, %t1}";
9806 return "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%2%}|%0%{%2%}, %g1}";
9808 [(set_attr "type" "ssemov")
9809 (set_attr "memory" "store")
9810 (set_attr "prefix" "evex")
9811 (set_attr "mode" "TI")])
9813 (define_insn "*avx512vl_<code>v2div2hi2_store"
9814 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9817 (match_operand:V2DI 1 "register_operand" "v"))
9820 (parallel [(const_int 2) (const_int 3)
9821 (const_int 4) (const_int 5)
9822 (const_int 6) (const_int 7)]))))]
9824 "vpmov<trunsuffix>qw\t{%1, %0|%0, %1}"
9825 [(set_attr "type" "ssemov")
9826 (set_attr "memory" "store")
9827 (set_attr "prefix" "evex")
9828 (set_attr "mode" "TI")])
9830 (define_insn "avx512vl_<code>v2div2hi2_mask"
9831 [(set (match_operand:V8HI 0 "register_operand" "=v")
9835 (match_operand:V2DI 1 "register_operand" "v"))
9837 (match_operand:V8HI 2 "vector_move_operand" "0C")
9838 (parallel [(const_int 0) (const_int 1)]))
9839 (match_operand:QI 3 "register_operand" "Yk"))
9840 (const_vector:V6HI [(const_int 0) (const_int 0)
9841 (const_int 0) (const_int 0)
9842 (const_int 0) (const_int 0)])))]
9844 "vpmov<trunsuffix>qw\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9845 [(set_attr "type" "ssemov")
9846 (set_attr "prefix" "evex")
9847 (set_attr "mode" "TI")])
9849 (define_insn "*avx512vl_<code>v2div2hi2_mask_1"
9850 [(set (match_operand:V8HI 0 "register_operand" "=v")
9854 (match_operand:V2DI 1 "register_operand" "v"))
9855 (const_vector:V2HI [(const_int 0) (const_int 0)])
9856 (match_operand:QI 2 "register_operand" "Yk"))
9857 (const_vector:V6HI [(const_int 0) (const_int 0)
9858 (const_int 0) (const_int 0)
9859 (const_int 0) (const_int 0)])))]
9861 "vpmov<trunsuffix>qw\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9862 [(set_attr "type" "ssemov")
9863 (set_attr "prefix" "evex")
9864 (set_attr "mode" "TI")])
9866 (define_insn "avx512vl_<code>v2div2hi2_mask_store"
9867 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9871 (match_operand:V2DI 1 "register_operand" "v"))
9874 (parallel [(const_int 0) (const_int 1)]))
9875 (match_operand:QI 2 "register_operand" "Yk"))
9878 (parallel [(const_int 2) (const_int 3)
9879 (const_int 4) (const_int 5)
9880 (const_int 6) (const_int 7)]))))]
9882 "vpmov<trunsuffix>qw\t{%1, %0%{%2%}|%0%{%2%}, %g1}"
9883 [(set_attr "type" "ssemov")
9884 (set_attr "memory" "store")
9885 (set_attr "prefix" "evex")
9886 (set_attr "mode" "TI")])
9888 (define_insn "*avx512vl_<code>v2div2si2"
9889 [(set (match_operand:V4SI 0 "register_operand" "=v")
9892 (match_operand:V2DI 1 "register_operand" "v"))
9893 (match_operand:V2SI 2 "const0_operand")))]
9895 "vpmov<trunsuffix>qd\t{%1, %0|%0, %1}"
9896 [(set_attr "type" "ssemov")
9897 (set_attr "prefix" "evex")
9898 (set_attr "mode" "TI")])
9900 (define_insn "*avx512vl_<code>v2div2si2_store"
9901 [(set (match_operand:V4SI 0 "memory_operand" "=m")
9904 (match_operand:V2DI 1 "register_operand" "v"))
9907 (parallel [(const_int 2) (const_int 3)]))))]
9909 "vpmov<trunsuffix>qd\t{%1, %0|%0, %1}"
9910 [(set_attr "type" "ssemov")
9911 (set_attr "memory" "store")
9912 (set_attr "prefix" "evex")
9913 (set_attr "mode" "TI")])
9915 (define_insn "avx512vl_<code>v2div2si2_mask"
9916 [(set (match_operand:V4SI 0 "register_operand" "=v")
9920 (match_operand:V2DI 1 "register_operand" "v"))
9922 (match_operand:V4SI 2 "vector_move_operand" "0C")
9923 (parallel [(const_int 0) (const_int 1)]))
9924 (match_operand:QI 3 "register_operand" "Yk"))
9925 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
9927 "vpmov<trunsuffix>qd\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9928 [(set_attr "type" "ssemov")
9929 (set_attr "prefix" "evex")
9930 (set_attr "mode" "TI")])
9932 (define_insn "*avx512vl_<code>v2div2si2_mask_1"
9933 [(set (match_operand:V4SI 0 "register_operand" "=v")
9937 (match_operand:V2DI 1 "register_operand" "v"))
9938 (const_vector:V2SI [(const_int 0) (const_int 0)])
9939 (match_operand:QI 2 "register_operand" "Yk"))
9940 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
9942 "vpmov<trunsuffix>qd\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9943 [(set_attr "type" "ssemov")
9944 (set_attr "prefix" "evex")
9945 (set_attr "mode" "TI")])
9947 (define_insn "avx512vl_<code>v2div2si2_mask_store"
9948 [(set (match_operand:V4SI 0 "memory_operand" "=m")
9952 (match_operand:V2DI 1 "register_operand" "v"))
9955 (parallel [(const_int 0) (const_int 1)]))
9956 (match_operand:QI 2 "register_operand" "Yk"))
9959 (parallel [(const_int 2) (const_int 3)]))))]
9961 "vpmov<trunsuffix>qd\t{%1, %0%{%2%}|%0%{%2%}, %t1}"
9962 [(set_attr "type" "ssemov")
9963 (set_attr "memory" "store")
9964 (set_attr "prefix" "evex")
9965 (set_attr "mode" "TI")])
9967 (define_insn "*avx512f_<code>v8div16qi2"
9968 [(set (match_operand:V16QI 0 "register_operand" "=v")
9971 (match_operand:V8DI 1 "register_operand" "v"))
9972 (const_vector:V8QI [(const_int 0) (const_int 0)
9973 (const_int 0) (const_int 0)
9974 (const_int 0) (const_int 0)
9975 (const_int 0) (const_int 0)])))]
9977 "vpmov<trunsuffix>qb\t{%1, %0|%0, %1}"
9978 [(set_attr "type" "ssemov")
9979 (set_attr "prefix" "evex")
9980 (set_attr "mode" "TI")])
9982 (define_insn "*avx512f_<code>v8div16qi2_store"
9983 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9986 (match_operand:V8DI 1 "register_operand" "v"))
9989 (parallel [(const_int 8) (const_int 9)
9990 (const_int 10) (const_int 11)
9991 (const_int 12) (const_int 13)
9992 (const_int 14) (const_int 15)]))))]
9994 "vpmov<trunsuffix>qb\t{%1, %0|%0, %1}"
9995 [(set_attr "type" "ssemov")
9996 (set_attr "memory" "store")
9997 (set_attr "prefix" "evex")
9998 (set_attr "mode" "TI")])
10000 (define_insn "avx512f_<code>v8div16qi2_mask"
10001 [(set (match_operand:V16QI 0 "register_operand" "=v")
10005 (match_operand:V8DI 1 "register_operand" "v"))
10007 (match_operand:V16QI 2 "vector_move_operand" "0C")
10008 (parallel [(const_int 0) (const_int 1)
10009 (const_int 2) (const_int 3)
10010 (const_int 4) (const_int 5)
10011 (const_int 6) (const_int 7)]))
10012 (match_operand:QI 3 "register_operand" "Yk"))
10013 (const_vector:V8QI [(const_int 0) (const_int 0)
10014 (const_int 0) (const_int 0)
10015 (const_int 0) (const_int 0)
10016 (const_int 0) (const_int 0)])))]
10018 "vpmov<trunsuffix>qb\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
10019 [(set_attr "type" "ssemov")
10020 (set_attr "prefix" "evex")
10021 (set_attr "mode" "TI")])
10023 (define_insn "*avx512f_<code>v8div16qi2_mask_1"
10024 [(set (match_operand:V16QI 0 "register_operand" "=v")
10028 (match_operand:V8DI 1 "register_operand" "v"))
10029 (const_vector:V8QI [(const_int 0) (const_int 0)
10030 (const_int 0) (const_int 0)
10031 (const_int 0) (const_int 0)
10032 (const_int 0) (const_int 0)])
10033 (match_operand:QI 2 "register_operand" "Yk"))
10034 (const_vector:V8QI [(const_int 0) (const_int 0)
10035 (const_int 0) (const_int 0)
10036 (const_int 0) (const_int 0)
10037 (const_int 0) (const_int 0)])))]
10039 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
10040 [(set_attr "type" "ssemov")
10041 (set_attr "prefix" "evex")
10042 (set_attr "mode" "TI")])
10044 (define_insn "avx512f_<code>v8div16qi2_mask_store"
10045 [(set (match_operand:V16QI 0 "memory_operand" "=m")
10049 (match_operand:V8DI 1 "register_operand" "v"))
10052 (parallel [(const_int 0) (const_int 1)
10053 (const_int 2) (const_int 3)
10054 (const_int 4) (const_int 5)
10055 (const_int 6) (const_int 7)]))
10056 (match_operand:QI 2 "register_operand" "Yk"))
10059 (parallel [(const_int 8) (const_int 9)
10060 (const_int 10) (const_int 11)
10061 (const_int 12) (const_int 13)
10062 (const_int 14) (const_int 15)]))))]
10064 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}|%q0%{%2%}, %1}"
10065 [(set_attr "type" "ssemov")
10066 (set_attr "memory" "store")
10067 (set_attr "prefix" "evex")
10068 (set_attr "mode" "TI")])
10070 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
10072 ;; Parallel integral arithmetic
10074 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
10076 (define_expand "neg<mode>2"
10077 [(set (match_operand:VI_AVX2 0 "register_operand")
10080 (match_operand:VI_AVX2 1 "vector_operand")))]
10082 "operands[2] = force_reg (<MODE>mode, CONST0_RTX (<MODE>mode));")
10084 (define_expand "<plusminus_insn><mode>3"
10085 [(set (match_operand:VI_AVX2 0 "register_operand")
10087 (match_operand:VI_AVX2 1 "vector_operand")
10088 (match_operand:VI_AVX2 2 "vector_operand")))]
10090 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
10092 (define_expand "<plusminus_insn><mode>3_mask"
10093 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
10094 (vec_merge:VI48_AVX512VL
10095 (plusminus:VI48_AVX512VL
10096 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand")
10097 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand"))
10098 (match_operand:VI48_AVX512VL 3 "vector_move_operand")
10099 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
10101 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
10103 (define_expand "<plusminus_insn><mode>3_mask"
10104 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
10105 (vec_merge:VI12_AVX512VL
10106 (plusminus:VI12_AVX512VL
10107 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand")
10108 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand"))
10109 (match_operand:VI12_AVX512VL 3 "vector_move_operand")
10110 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
10112 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
10114 (define_insn "*<plusminus_insn><mode>3"
10115 [(set (match_operand:VI_AVX2 0 "register_operand" "=x,v")
10117 (match_operand:VI_AVX2 1 "vector_operand" "<comm>0,v")
10118 (match_operand:VI_AVX2 2 "vector_operand" "xBm,vm")))]
10119 "TARGET_SSE2 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
10121 p<plusminus_mnemonic><ssemodesuffix>\t{%2, %0|%0, %2}
10122 vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
10123 [(set_attr "isa" "noavx,avx")
10124 (set_attr "type" "sseiadd")
10125 (set_attr "prefix_data16" "1,*")
10126 (set_attr "prefix" "orig,vex")
10127 (set_attr "mode" "<sseinsnmode>")])
10129 (define_insn "*<plusminus_insn><mode>3_mask"
10130 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
10131 (vec_merge:VI48_AVX512VL
10132 (plusminus:VI48_AVX512VL
10133 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "<comm>v")
10134 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm"))
10135 (match_operand:VI48_AVX512VL 3 "vector_move_operand" "0C")
10136 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
10137 "TARGET_AVX512F && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
10138 "vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
10139 [(set_attr "type" "sseiadd")
10140 (set_attr "prefix" "evex")
10141 (set_attr "mode" "<sseinsnmode>")])
10143 (define_insn "*<plusminus_insn><mode>3_mask"
10144 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
10145 (vec_merge:VI12_AVX512VL
10146 (plusminus:VI12_AVX512VL
10147 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "<comm>v")
10148 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm"))
10149 (match_operand:VI12_AVX512VL 3 "vector_move_operand" "0C")
10150 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
10151 "TARGET_AVX512BW && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
10152 "vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
10153 [(set_attr "type" "sseiadd")
10154 (set_attr "prefix" "evex")
10155 (set_attr "mode" "<sseinsnmode>")])
10157 (define_expand "<sse2_avx2>_<plusminus_insn><mode>3<mask_name>"
10158 [(set (match_operand:VI12_AVX2 0 "register_operand")
10159 (sat_plusminus:VI12_AVX2
10160 (match_operand:VI12_AVX2 1 "vector_operand")
10161 (match_operand:VI12_AVX2 2 "vector_operand")))]
10162 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10163 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
10165 (define_insn "*<sse2_avx2>_<plusminus_insn><mode>3<mask_name>"
10166 [(set (match_operand:VI12_AVX2 0 "register_operand" "=x,v")
10167 (sat_plusminus:VI12_AVX2
10168 (match_operand:VI12_AVX2 1 "vector_operand" "<comm>0,v")
10169 (match_operand:VI12_AVX2 2 "vector_operand" "xBm,vm")))]
10170 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>
10171 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
10173 p<plusminus_mnemonic><ssemodesuffix>\t{%2, %0|%0, %2}
10174 vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10175 [(set_attr "isa" "noavx,avx")
10176 (set_attr "type" "sseiadd")
10177 (set_attr "prefix_data16" "1,*")
10178 (set_attr "prefix" "orig,maybe_evex")
10179 (set_attr "mode" "TI")])
10181 (define_expand "mul<mode>3<mask_name>"
10182 [(set (match_operand:VI1_AVX512 0 "register_operand")
10183 (mult:VI1_AVX512 (match_operand:VI1_AVX512 1 "register_operand")
10184 (match_operand:VI1_AVX512 2 "register_operand")))]
10185 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10187 ix86_expand_vecop_qihi (MULT, operands[0], operands[1], operands[2]);
10191 (define_expand "mul<mode>3<mask_name>"
10192 [(set (match_operand:VI2_AVX2 0 "register_operand")
10193 (mult:VI2_AVX2 (match_operand:VI2_AVX2 1 "vector_operand")
10194 (match_operand:VI2_AVX2 2 "vector_operand")))]
10195 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10196 "ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);")
10198 (define_insn "*mul<mode>3<mask_name>"
10199 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,v")
10200 (mult:VI2_AVX2 (match_operand:VI2_AVX2 1 "vector_operand" "%0,v")
10201 (match_operand:VI2_AVX2 2 "vector_operand" "xBm,vm")))]
10202 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
10203 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10205 pmullw\t{%2, %0|%0, %2}
10206 vpmullw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10207 [(set_attr "isa" "noavx,avx")
10208 (set_attr "type" "sseimul")
10209 (set_attr "prefix_data16" "1,*")
10210 (set_attr "prefix" "orig,vex")
10211 (set_attr "mode" "<sseinsnmode>")])
10213 (define_expand "<s>mul<mode>3_highpart<mask_name>"
10214 [(set (match_operand:VI2_AVX2 0 "register_operand")
10216 (lshiftrt:<ssedoublemode>
10217 (mult:<ssedoublemode>
10218 (any_extend:<ssedoublemode>
10219 (match_operand:VI2_AVX2 1 "vector_operand"))
10220 (any_extend:<ssedoublemode>
10221 (match_operand:VI2_AVX2 2 "vector_operand")))
10224 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10225 "ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);")
10227 (define_insn "*<s>mul<mode>3_highpart<mask_name>"
10228 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,v")
10230 (lshiftrt:<ssedoublemode>
10231 (mult:<ssedoublemode>
10232 (any_extend:<ssedoublemode>
10233 (match_operand:VI2_AVX2 1 "vector_operand" "%0,v"))
10234 (any_extend:<ssedoublemode>
10235 (match_operand:VI2_AVX2 2 "vector_operand" "xBm,vm")))
10237 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
10238 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10240 pmulh<u>w\t{%2, %0|%0, %2}
10241 vpmulh<u>w\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10242 [(set_attr "isa" "noavx,avx")
10243 (set_attr "type" "sseimul")
10244 (set_attr "prefix_data16" "1,*")
10245 (set_attr "prefix" "orig,vex")
10246 (set_attr "mode" "<sseinsnmode>")])
10248 (define_expand "vec_widen_umult_even_v16si<mask_name>"
10249 [(set (match_operand:V8DI 0 "register_operand")
10253 (match_operand:V16SI 1 "nonimmediate_operand")
10254 (parallel [(const_int 0) (const_int 2)
10255 (const_int 4) (const_int 6)
10256 (const_int 8) (const_int 10)
10257 (const_int 12) (const_int 14)])))
10260 (match_operand:V16SI 2 "nonimmediate_operand")
10261 (parallel [(const_int 0) (const_int 2)
10262 (const_int 4) (const_int 6)
10263 (const_int 8) (const_int 10)
10264 (const_int 12) (const_int 14)])))))]
10266 "ix86_fixup_binary_operands_no_copy (MULT, V16SImode, operands);")
10268 (define_insn "*vec_widen_umult_even_v16si<mask_name>"
10269 [(set (match_operand:V8DI 0 "register_operand" "=v")
10273 (match_operand:V16SI 1 "nonimmediate_operand" "%v")
10274 (parallel [(const_int 0) (const_int 2)
10275 (const_int 4) (const_int 6)
10276 (const_int 8) (const_int 10)
10277 (const_int 12) (const_int 14)])))
10280 (match_operand:V16SI 2 "nonimmediate_operand" "vm")
10281 (parallel [(const_int 0) (const_int 2)
10282 (const_int 4) (const_int 6)
10283 (const_int 8) (const_int 10)
10284 (const_int 12) (const_int 14)])))))]
10285 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10286 "vpmuludq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10287 [(set_attr "type" "sseimul")
10288 (set_attr "prefix_extra" "1")
10289 (set_attr "prefix" "evex")
10290 (set_attr "mode" "XI")])
10292 (define_expand "vec_widen_umult_even_v8si<mask_name>"
10293 [(set (match_operand:V4DI 0 "register_operand")
10297 (match_operand:V8SI 1 "nonimmediate_operand")
10298 (parallel [(const_int 0) (const_int 2)
10299 (const_int 4) (const_int 6)])))
10302 (match_operand:V8SI 2 "nonimmediate_operand")
10303 (parallel [(const_int 0) (const_int 2)
10304 (const_int 4) (const_int 6)])))))]
10305 "TARGET_AVX2 && <mask_avx512vl_condition>"
10306 "ix86_fixup_binary_operands_no_copy (MULT, V8SImode, operands);")
10308 (define_insn "*vec_widen_umult_even_v8si<mask_name>"
10309 [(set (match_operand:V4DI 0 "register_operand" "=v")
10313 (match_operand:V8SI 1 "nonimmediate_operand" "%v")
10314 (parallel [(const_int 0) (const_int 2)
10315 (const_int 4) (const_int 6)])))
10318 (match_operand:V8SI 2 "nonimmediate_operand" "vm")
10319 (parallel [(const_int 0) (const_int 2)
10320 (const_int 4) (const_int 6)])))))]
10321 "TARGET_AVX2 && <mask_avx512vl_condition>
10322 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10323 "vpmuludq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10324 [(set_attr "type" "sseimul")
10325 (set_attr "prefix" "maybe_evex")
10326 (set_attr "mode" "OI")])
10328 (define_expand "vec_widen_umult_even_v4si<mask_name>"
10329 [(set (match_operand:V2DI 0 "register_operand")
10333 (match_operand:V4SI 1 "vector_operand")
10334 (parallel [(const_int 0) (const_int 2)])))
10337 (match_operand:V4SI 2 "vector_operand")
10338 (parallel [(const_int 0) (const_int 2)])))))]
10339 "TARGET_SSE2 && <mask_avx512vl_condition>"
10340 "ix86_fixup_binary_operands_no_copy (MULT, V4SImode, operands);")
10342 (define_insn "*vec_widen_umult_even_v4si<mask_name>"
10343 [(set (match_operand:V2DI 0 "register_operand" "=x,v")
10347 (match_operand:V4SI 1 "vector_operand" "%0,v")
10348 (parallel [(const_int 0) (const_int 2)])))
10351 (match_operand:V4SI 2 "vector_operand" "xBm,vm")
10352 (parallel [(const_int 0) (const_int 2)])))))]
10353 "TARGET_SSE2 && <mask_avx512vl_condition>
10354 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10356 pmuludq\t{%2, %0|%0, %2}
10357 vpmuludq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10358 [(set_attr "isa" "noavx,avx")
10359 (set_attr "type" "sseimul")
10360 (set_attr "prefix_data16" "1,*")
10361 (set_attr "prefix" "orig,maybe_evex")
10362 (set_attr "mode" "TI")])
10364 (define_expand "vec_widen_smult_even_v16si<mask_name>"
10365 [(set (match_operand:V8DI 0 "register_operand")
10369 (match_operand:V16SI 1 "nonimmediate_operand")
10370 (parallel [(const_int 0) (const_int 2)
10371 (const_int 4) (const_int 6)
10372 (const_int 8) (const_int 10)
10373 (const_int 12) (const_int 14)])))
10376 (match_operand:V16SI 2 "nonimmediate_operand")
10377 (parallel [(const_int 0) (const_int 2)
10378 (const_int 4) (const_int 6)
10379 (const_int 8) (const_int 10)
10380 (const_int 12) (const_int 14)])))))]
10382 "ix86_fixup_binary_operands_no_copy (MULT, V16SImode, operands);")
10384 (define_insn "*vec_widen_smult_even_v16si<mask_name>"
10385 [(set (match_operand:V8DI 0 "register_operand" "=v")
10389 (match_operand:V16SI 1 "nonimmediate_operand" "%v")
10390 (parallel [(const_int 0) (const_int 2)
10391 (const_int 4) (const_int 6)
10392 (const_int 8) (const_int 10)
10393 (const_int 12) (const_int 14)])))
10396 (match_operand:V16SI 2 "nonimmediate_operand" "vm")
10397 (parallel [(const_int 0) (const_int 2)
10398 (const_int 4) (const_int 6)
10399 (const_int 8) (const_int 10)
10400 (const_int 12) (const_int 14)])))))]
10401 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10402 "vpmuldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10403 [(set_attr "type" "sseimul")
10404 (set_attr "prefix_extra" "1")
10405 (set_attr "prefix" "evex")
10406 (set_attr "mode" "XI")])
10408 (define_expand "vec_widen_smult_even_v8si<mask_name>"
10409 [(set (match_operand:V4DI 0 "register_operand")
10413 (match_operand:V8SI 1 "nonimmediate_operand")
10414 (parallel [(const_int 0) (const_int 2)
10415 (const_int 4) (const_int 6)])))
10418 (match_operand:V8SI 2 "nonimmediate_operand")
10419 (parallel [(const_int 0) (const_int 2)
10420 (const_int 4) (const_int 6)])))))]
10421 "TARGET_AVX2 && <mask_avx512vl_condition>"
10422 "ix86_fixup_binary_operands_no_copy (MULT, V8SImode, operands);")
10424 (define_insn "*vec_widen_smult_even_v8si<mask_name>"
10425 [(set (match_operand:V4DI 0 "register_operand" "=v")
10429 (match_operand:V8SI 1 "nonimmediate_operand" "%v")
10430 (parallel [(const_int 0) (const_int 2)
10431 (const_int 4) (const_int 6)])))
10434 (match_operand:V8SI 2 "nonimmediate_operand" "vm")
10435 (parallel [(const_int 0) (const_int 2)
10436 (const_int 4) (const_int 6)])))))]
10437 "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10438 "vpmuldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10439 [(set_attr "type" "sseimul")
10440 (set_attr "prefix_extra" "1")
10441 (set_attr "prefix" "vex")
10442 (set_attr "mode" "OI")])
10444 (define_expand "sse4_1_mulv2siv2di3<mask_name>"
10445 [(set (match_operand:V2DI 0 "register_operand")
10449 (match_operand:V4SI 1 "vector_operand")
10450 (parallel [(const_int 0) (const_int 2)])))
10453 (match_operand:V4SI 2 "vector_operand")
10454 (parallel [(const_int 0) (const_int 2)])))))]
10455 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
10456 "ix86_fixup_binary_operands_no_copy (MULT, V4SImode, operands);")
10458 (define_insn "*sse4_1_mulv2siv2di3<mask_name>"
10459 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
10463 (match_operand:V4SI 1 "vector_operand" "%0,0,v")
10464 (parallel [(const_int 0) (const_int 2)])))
10467 (match_operand:V4SI 2 "vector_operand" "YrBm,*xBm,vm")
10468 (parallel [(const_int 0) (const_int 2)])))))]
10469 "TARGET_SSE4_1 && <mask_avx512vl_condition>
10470 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10472 pmuldq\t{%2, %0|%0, %2}
10473 pmuldq\t{%2, %0|%0, %2}
10474 vpmuldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10475 [(set_attr "isa" "noavx,noavx,avx")
10476 (set_attr "type" "sseimul")
10477 (set_attr "prefix_data16" "1,1,*")
10478 (set_attr "prefix_extra" "1")
10479 (set_attr "prefix" "orig,orig,vex")
10480 (set_attr "mode" "TI")])
10482 (define_insn "avx512bw_pmaddwd512<mode><mask_name>"
10483 [(set (match_operand:<sseunpackmode> 0 "register_operand" "=v")
10484 (unspec:<sseunpackmode>
10485 [(match_operand:VI2_AVX2 1 "register_operand" "v")
10486 (match_operand:VI2_AVX2 2 "nonimmediate_operand" "vm")]
10487 UNSPEC_PMADDWD512))]
10488 "TARGET_AVX512BW && <mask_mode512bit_condition>"
10489 "vpmaddwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}";
10490 [(set_attr "type" "sseiadd")
10491 (set_attr "prefix" "evex")
10492 (set_attr "mode" "XI")])
10494 (define_expand "avx2_pmaddwd"
10495 [(set (match_operand:V8SI 0 "register_operand")
10500 (match_operand:V16HI 1 "nonimmediate_operand")
10501 (parallel [(const_int 0) (const_int 2)
10502 (const_int 4) (const_int 6)
10503 (const_int 8) (const_int 10)
10504 (const_int 12) (const_int 14)])))
10507 (match_operand:V16HI 2 "nonimmediate_operand")
10508 (parallel [(const_int 0) (const_int 2)
10509 (const_int 4) (const_int 6)
10510 (const_int 8) (const_int 10)
10511 (const_int 12) (const_int 14)]))))
10514 (vec_select:V8HI (match_dup 1)
10515 (parallel [(const_int 1) (const_int 3)
10516 (const_int 5) (const_int 7)
10517 (const_int 9) (const_int 11)
10518 (const_int 13) (const_int 15)])))
10520 (vec_select:V8HI (match_dup 2)
10521 (parallel [(const_int 1) (const_int 3)
10522 (const_int 5) (const_int 7)
10523 (const_int 9) (const_int 11)
10524 (const_int 13) (const_int 15)]))))))]
10526 "ix86_fixup_binary_operands_no_copy (MULT, V16HImode, operands);")
10528 (define_insn "*avx2_pmaddwd"
10529 [(set (match_operand:V8SI 0 "register_operand" "=x,v")
10534 (match_operand:V16HI 1 "nonimmediate_operand" "%x,v")
10535 (parallel [(const_int 0) (const_int 2)
10536 (const_int 4) (const_int 6)
10537 (const_int 8) (const_int 10)
10538 (const_int 12) (const_int 14)])))
10541 (match_operand:V16HI 2 "nonimmediate_operand" "xm,vm")
10542 (parallel [(const_int 0) (const_int 2)
10543 (const_int 4) (const_int 6)
10544 (const_int 8) (const_int 10)
10545 (const_int 12) (const_int 14)]))))
10548 (vec_select:V8HI (match_dup 1)
10549 (parallel [(const_int 1) (const_int 3)
10550 (const_int 5) (const_int 7)
10551 (const_int 9) (const_int 11)
10552 (const_int 13) (const_int 15)])))
10554 (vec_select:V8HI (match_dup 2)
10555 (parallel [(const_int 1) (const_int 3)
10556 (const_int 5) (const_int 7)
10557 (const_int 9) (const_int 11)
10558 (const_int 13) (const_int 15)]))))))]
10559 "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10560 "vpmaddwd\t{%2, %1, %0|%0, %1, %2}"
10561 [(set_attr "type" "sseiadd")
10562 (set_attr "isa" "*,avx512bw")
10563 (set_attr "prefix" "vex,evex")
10564 (set_attr "mode" "OI")])
10566 (define_expand "sse2_pmaddwd"
10567 [(set (match_operand:V4SI 0 "register_operand")
10572 (match_operand:V8HI 1 "vector_operand")
10573 (parallel [(const_int 0) (const_int 2)
10574 (const_int 4) (const_int 6)])))
10577 (match_operand:V8HI 2 "vector_operand")
10578 (parallel [(const_int 0) (const_int 2)
10579 (const_int 4) (const_int 6)]))))
10582 (vec_select:V4HI (match_dup 1)
10583 (parallel [(const_int 1) (const_int 3)
10584 (const_int 5) (const_int 7)])))
10586 (vec_select:V4HI (match_dup 2)
10587 (parallel [(const_int 1) (const_int 3)
10588 (const_int 5) (const_int 7)]))))))]
10590 "ix86_fixup_binary_operands_no_copy (MULT, V8HImode, operands);")
10592 (define_insn "*sse2_pmaddwd"
10593 [(set (match_operand:V4SI 0 "register_operand" "=x,x,v")
10598 (match_operand:V8HI 1 "vector_operand" "%0,x,v")
10599 (parallel [(const_int 0) (const_int 2)
10600 (const_int 4) (const_int 6)])))
10603 (match_operand:V8HI 2 "vector_operand" "xBm,xm,vm")
10604 (parallel [(const_int 0) (const_int 2)
10605 (const_int 4) (const_int 6)]))))
10608 (vec_select:V4HI (match_dup 1)
10609 (parallel [(const_int 1) (const_int 3)
10610 (const_int 5) (const_int 7)])))
10612 (vec_select:V4HI (match_dup 2)
10613 (parallel [(const_int 1) (const_int 3)
10614 (const_int 5) (const_int 7)]))))))]
10615 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10617 pmaddwd\t{%2, %0|%0, %2}
10618 vpmaddwd\t{%2, %1, %0|%0, %1, %2}
10619 vpmaddwd\t{%2, %1, %0|%0, %1, %2}"
10620 [(set_attr "isa" "noavx,avx,avx512bw")
10621 (set_attr "type" "sseiadd")
10622 (set_attr "atom_unit" "simul")
10623 (set_attr "prefix_data16" "1,*,*")
10624 (set_attr "prefix" "orig,vex,evex")
10625 (set_attr "mode" "TI")])
10627 (define_insn "avx512dq_mul<mode>3<mask_name>"
10628 [(set (match_operand:VI8 0 "register_operand" "=v")
10630 (match_operand:VI8 1 "register_operand" "v")
10631 (match_operand:VI8 2 "nonimmediate_operand" "vm")))]
10632 "TARGET_AVX512DQ && <mask_mode512bit_condition>"
10633 "vpmullq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10634 [(set_attr "type" "sseimul")
10635 (set_attr "prefix" "evex")
10636 (set_attr "mode" "<sseinsnmode>")])
10638 (define_expand "mul<mode>3<mask_name>"
10639 [(set (match_operand:VI4_AVX512F 0 "register_operand")
10641 (match_operand:VI4_AVX512F 1 "general_vector_operand")
10642 (match_operand:VI4_AVX512F 2 "general_vector_operand")))]
10643 "TARGET_SSE2 && <mask_mode512bit_condition>"
10647 if (!vector_operand (operands[1], <MODE>mode))
10648 operands[1] = force_reg (<MODE>mode, operands[1]);
10649 if (!vector_operand (operands[2], <MODE>mode))
10650 operands[2] = force_reg (<MODE>mode, operands[2]);
10651 ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);
10655 ix86_expand_sse2_mulv4si3 (operands[0], operands[1], operands[2]);
10660 (define_insn "*<sse4_1_avx2>_mul<mode>3<mask_name>"
10661 [(set (match_operand:VI4_AVX512F 0 "register_operand" "=Yr,*x,v")
10663 (match_operand:VI4_AVX512F 1 "vector_operand" "%0,0,v")
10664 (match_operand:VI4_AVX512F 2 "vector_operand" "YrBm,*xBm,vm")))]
10665 "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
10666 && <mask_mode512bit_condition>"
10668 pmulld\t{%2, %0|%0, %2}
10669 pmulld\t{%2, %0|%0, %2}
10670 vpmulld\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10671 [(set_attr "isa" "noavx,noavx,avx")
10672 (set_attr "type" "sseimul")
10673 (set_attr "prefix_extra" "1")
10674 (set_attr "prefix" "<mask_prefix4>")
10675 (set_attr "btver2_decode" "vector,vector,vector")
10676 (set_attr "mode" "<sseinsnmode>")])
10678 (define_expand "mul<mode>3"
10679 [(set (match_operand:VI8_AVX2_AVX512F 0 "register_operand")
10680 (mult:VI8_AVX2_AVX512F
10681 (match_operand:VI8_AVX2_AVX512F 1 "register_operand")
10682 (match_operand:VI8_AVX2_AVX512F 2 "register_operand")))]
10685 ix86_expand_sse2_mulvxdi3 (operands[0], operands[1], operands[2]);
10689 (define_expand "vec_widen_<s>mult_hi_<mode>"
10690 [(match_operand:<sseunpackmode> 0 "register_operand")
10691 (any_extend:<sseunpackmode>
10692 (match_operand:VI124_AVX2 1 "register_operand"))
10693 (match_operand:VI124_AVX2 2 "register_operand")]
10696 ix86_expand_mul_widen_hilo (operands[0], operands[1], operands[2],
10701 (define_expand "vec_widen_<s>mult_lo_<mode>"
10702 [(match_operand:<sseunpackmode> 0 "register_operand")
10703 (any_extend:<sseunpackmode>
10704 (match_operand:VI124_AVX2 1 "register_operand"))
10705 (match_operand:VI124_AVX2 2 "register_operand")]
10708 ix86_expand_mul_widen_hilo (operands[0], operands[1], operands[2],
10713 ;; Most widen_<s>mult_even_<mode> can be handled directly from other
10714 ;; named patterns, but signed V4SI needs special help for plain SSE2.
10715 (define_expand "vec_widen_smult_even_v4si"
10716 [(match_operand:V2DI 0 "register_operand")
10717 (match_operand:V4SI 1 "vector_operand")
10718 (match_operand:V4SI 2 "vector_operand")]
10721 ix86_expand_mul_widen_evenodd (operands[0], operands[1], operands[2],
10726 (define_expand "vec_widen_<s>mult_odd_<mode>"
10727 [(match_operand:<sseunpackmode> 0 "register_operand")
10728 (any_extend:<sseunpackmode>
10729 (match_operand:VI4_AVX512F 1 "general_vector_operand"))
10730 (match_operand:VI4_AVX512F 2 "general_vector_operand")]
10733 ix86_expand_mul_widen_evenodd (operands[0], operands[1], operands[2],
10738 (define_mode_attr SDOT_PMADD_SUF
10739 [(V32HI "512v32hi") (V16HI "") (V8HI "")])
10741 (define_expand "sdot_prod<mode>"
10742 [(match_operand:<sseunpackmode> 0 "register_operand")
10743 (match_operand:VI2_AVX2 1 "register_operand")
10744 (match_operand:VI2_AVX2 2 "register_operand")
10745 (match_operand:<sseunpackmode> 3 "register_operand")]
10748 rtx t = gen_reg_rtx (<sseunpackmode>mode);
10749 emit_insn (gen_<sse2_avx2>_pmaddwd<SDOT_PMADD_SUF> (t, operands[1], operands[2]));
10750 emit_insn (gen_rtx_SET (operands[0],
10751 gen_rtx_PLUS (<sseunpackmode>mode,
10756 ;; Normally we use widen_mul_even/odd, but combine can't quite get it all
10757 ;; back together when madd is available.
10758 (define_expand "sdot_prodv4si"
10759 [(match_operand:V2DI 0 "register_operand")
10760 (match_operand:V4SI 1 "register_operand")
10761 (match_operand:V4SI 2 "register_operand")
10762 (match_operand:V2DI 3 "register_operand")]
10765 rtx t = gen_reg_rtx (V2DImode);
10766 emit_insn (gen_xop_pmacsdqh (t, operands[1], operands[2], operands[3]));
10767 emit_insn (gen_xop_pmacsdql (operands[0], operands[1], operands[2], t));
10771 (define_expand "uavg<mode>3_ceil"
10772 [(set (match_operand:VI12_AVX2 0 "register_operand")
10773 (truncate:VI12_AVX2
10774 (lshiftrt:<ssedoublemode>
10775 (plus:<ssedoublemode>
10776 (plus:<ssedoublemode>
10777 (zero_extend:<ssedoublemode>
10778 (match_operand:VI12_AVX2 1 "vector_operand"))
10779 (zero_extend:<ssedoublemode>
10780 (match_operand:VI12_AVX2 2 "vector_operand")))
10785 operands[3] = CONST1_RTX(<MODE>mode);
10786 ix86_fixup_binary_operands_no_copy (PLUS, <MODE>mode, operands);
10789 (define_expand "usadv16qi"
10790 [(match_operand:V4SI 0 "register_operand")
10791 (match_operand:V16QI 1 "register_operand")
10792 (match_operand:V16QI 2 "vector_operand")
10793 (match_operand:V4SI 3 "vector_operand")]
10796 rtx t1 = gen_reg_rtx (V2DImode);
10797 rtx t2 = gen_reg_rtx (V4SImode);
10798 emit_insn (gen_sse2_psadbw (t1, operands[1], operands[2]));
10799 convert_move (t2, t1, 0);
10800 emit_insn (gen_addv4si3 (operands[0], t2, operands[3]));
10804 (define_expand "usadv32qi"
10805 [(match_operand:V8SI 0 "register_operand")
10806 (match_operand:V32QI 1 "register_operand")
10807 (match_operand:V32QI 2 "nonimmediate_operand")
10808 (match_operand:V8SI 3 "nonimmediate_operand")]
10811 rtx t1 = gen_reg_rtx (V4DImode);
10812 rtx t2 = gen_reg_rtx (V8SImode);
10813 emit_insn (gen_avx2_psadbw (t1, operands[1], operands[2]));
10814 convert_move (t2, t1, 0);
10815 emit_insn (gen_addv8si3 (operands[0], t2, operands[3]));
10819 (define_expand "usadv64qi"
10820 [(match_operand:V16SI 0 "register_operand")
10821 (match_operand:V64QI 1 "register_operand")
10822 (match_operand:V64QI 2 "nonimmediate_operand")
10823 (match_operand:V16SI 3 "nonimmediate_operand")]
10826 rtx t1 = gen_reg_rtx (V8DImode);
10827 rtx t2 = gen_reg_rtx (V16SImode);
10828 emit_insn (gen_avx512f_psadbw (t1, operands[1], operands[2]));
10829 convert_move (t2, t1, 0);
10830 emit_insn (gen_addv16si3 (operands[0], t2, operands[3]));
10834 (define_insn "<mask_codefor>ashr<mode>3<mask_name>"
10835 [(set (match_operand:VI248_AVX512BW_1 0 "register_operand" "=v,v")
10836 (ashiftrt:VI248_AVX512BW_1
10837 (match_operand:VI248_AVX512BW_1 1 "nonimmediate_operand" "v,vm")
10838 (match_operand:DI 2 "nonmemory_operand" "v,N")))]
10840 "vpsra<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10841 [(set_attr "type" "sseishft")
10842 (set (attr "length_immediate")
10843 (if_then_else (match_operand 2 "const_int_operand")
10845 (const_string "0")))
10846 (set_attr "mode" "<sseinsnmode>")])
10848 (define_insn "ashr<mode>3"
10849 [(set (match_operand:VI24_AVX2 0 "register_operand" "=x,x")
10850 (ashiftrt:VI24_AVX2
10851 (match_operand:VI24_AVX2 1 "register_operand" "0,x")
10852 (match_operand:DI 2 "nonmemory_operand" "xN,xN")))]
10855 psra<ssemodesuffix>\t{%2, %0|%0, %2}
10856 vpsra<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
10857 [(set_attr "isa" "noavx,avx")
10858 (set_attr "type" "sseishft")
10859 (set (attr "length_immediate")
10860 (if_then_else (match_operand 2 "const_int_operand")
10862 (const_string "0")))
10863 (set_attr "prefix_data16" "1,*")
10864 (set_attr "prefix" "orig,vex")
10865 (set_attr "mode" "<sseinsnmode>")])
10867 (define_insn "ashr<mode>3<mask_name>"
10868 [(set (match_operand:VI248_AVX512BW_AVX512VL 0 "register_operand" "=v,v")
10869 (ashiftrt:VI248_AVX512BW_AVX512VL
10870 (match_operand:VI248_AVX512BW_AVX512VL 1 "nonimmediate_operand" "v,vm")
10871 (match_operand:DI 2 "nonmemory_operand" "v,N")))]
10873 "vpsra<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10874 [(set_attr "type" "sseishft")
10875 (set (attr "length_immediate")
10876 (if_then_else (match_operand 2 "const_int_operand")
10878 (const_string "0")))
10879 (set_attr "mode" "<sseinsnmode>")])
10881 (define_insn "<mask_codefor><shift_insn><mode>3<mask_name>"
10882 [(set (match_operand:VI248_AVX512BW_2 0 "register_operand" "=v,v")
10883 (any_lshift:VI248_AVX512BW_2
10884 (match_operand:VI248_AVX512BW_2 1 "nonimmediate_operand" "v,vm")
10885 (match_operand:DI 2 "nonmemory_operand" "v,N")))]
10887 "vp<vshift><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10888 [(set_attr "type" "sseishft")
10889 (set (attr "length_immediate")
10890 (if_then_else (match_operand 2 "const_int_operand")
10892 (const_string "0")))
10893 (set_attr "mode" "<sseinsnmode>")])
10895 (define_insn "<shift_insn><mode>3"
10896 [(set (match_operand:VI248_AVX2 0 "register_operand" "=x,x")
10897 (any_lshift:VI248_AVX2
10898 (match_operand:VI248_AVX2 1 "register_operand" "0,x")
10899 (match_operand:DI 2 "nonmemory_operand" "xN,xN")))]
10902 p<vshift><ssemodesuffix>\t{%2, %0|%0, %2}
10903 vp<vshift><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
10904 [(set_attr "isa" "noavx,avx")
10905 (set_attr "type" "sseishft")
10906 (set (attr "length_immediate")
10907 (if_then_else (match_operand 2 "const_int_operand")
10909 (const_string "0")))
10910 (set_attr "prefix_data16" "1,*")
10911 (set_attr "prefix" "orig,vex")
10912 (set_attr "mode" "<sseinsnmode>")])
10914 (define_insn "<shift_insn><mode>3<mask_name>"
10915 [(set (match_operand:VI248_AVX512BW 0 "register_operand" "=v,v")
10916 (any_lshift:VI248_AVX512BW
10917 (match_operand:VI248_AVX512BW 1 "nonimmediate_operand" "v,m")
10918 (match_operand:DI 2 "nonmemory_operand" "vN,N")))]
10920 "vp<vshift><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10921 [(set_attr "type" "sseishft")
10922 (set (attr "length_immediate")
10923 (if_then_else (match_operand 2 "const_int_operand")
10925 (const_string "0")))
10926 (set_attr "mode" "<sseinsnmode>")])
10929 (define_expand "vec_shr_<mode>"
10930 [(set (match_dup 3)
10932 (match_operand:VI_128 1 "register_operand")
10933 (match_operand:SI 2 "const_0_to_255_mul_8_operand")))
10934 (set (match_operand:VI_128 0 "register_operand") (match_dup 4))]
10937 operands[1] = gen_lowpart (V1TImode, operands[1]);
10938 operands[3] = gen_reg_rtx (V1TImode);
10939 operands[4] = gen_lowpart (<MODE>mode, operands[3]);
10942 (define_insn "avx512bw_<shift_insn><mode>3"
10943 [(set (match_operand:VIMAX_AVX512VL 0 "register_operand" "=v")
10944 (any_lshift:VIMAX_AVX512VL
10945 (match_operand:VIMAX_AVX512VL 1 "nonimmediate_operand" "vm")
10946 (match_operand:SI 2 "const_0_to_255_mul_8_operand" "n")))]
10949 operands[2] = GEN_INT (INTVAL (operands[2]) / 8);
10950 return "vp<vshift>dq\t{%2, %1, %0|%0, %1, %2}";
10952 [(set_attr "type" "sseishft")
10953 (set_attr "length_immediate" "1")
10954 (set_attr "prefix" "maybe_evex")
10955 (set_attr "mode" "<sseinsnmode>")])
10957 (define_insn "<sse2_avx2>_<shift_insn><mode>3"
10958 [(set (match_operand:VIMAX_AVX2 0 "register_operand" "=x,v")
10959 (any_lshift:VIMAX_AVX2
10960 (match_operand:VIMAX_AVX2 1 "register_operand" "0,v")
10961 (match_operand:SI 2 "const_0_to_255_mul_8_operand" "n,n")))]
10964 operands[2] = GEN_INT (INTVAL (operands[2]) / 8);
10966 switch (which_alternative)
10969 return "p<vshift>dq\t{%2, %0|%0, %2}";
10971 return "vp<vshift>dq\t{%2, %1, %0|%0, %1, %2}";
10973 gcc_unreachable ();
10976 [(set_attr "isa" "noavx,avx")
10977 (set_attr "type" "sseishft")
10978 (set_attr "length_immediate" "1")
10979 (set_attr "atom_unit" "sishuf")
10980 (set_attr "prefix_data16" "1,*")
10981 (set_attr "prefix" "orig,vex")
10982 (set_attr "mode" "<sseinsnmode>")])
10984 (define_insn "<avx512>_<rotate>v<mode><mask_name>"
10985 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
10986 (any_rotate:VI48_AVX512VL
10987 (match_operand:VI48_AVX512VL 1 "register_operand" "v")
10988 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")))]
10990 "vp<rotate>v<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10991 [(set_attr "prefix" "evex")
10992 (set_attr "mode" "<sseinsnmode>")])
10994 (define_insn "<avx512>_<rotate><mode><mask_name>"
10995 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
10996 (any_rotate:VI48_AVX512VL
10997 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm")
10998 (match_operand:SI 2 "const_0_to_255_operand")))]
11000 "vp<rotate><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11001 [(set_attr "prefix" "evex")
11002 (set_attr "mode" "<sseinsnmode>")])
11004 (define_expand "<code><mode>3"
11005 [(set (match_operand:VI124_256_AVX512F_AVX512BW 0 "register_operand")
11006 (maxmin:VI124_256_AVX512F_AVX512BW
11007 (match_operand:VI124_256_AVX512F_AVX512BW 1 "nonimmediate_operand")
11008 (match_operand:VI124_256_AVX512F_AVX512BW 2 "nonimmediate_operand")))]
11010 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
11012 (define_insn "*avx2_<code><mode>3"
11013 [(set (match_operand:VI124_256 0 "register_operand" "=v")
11015 (match_operand:VI124_256 1 "nonimmediate_operand" "%v")
11016 (match_operand:VI124_256 2 "nonimmediate_operand" "vm")))]
11017 "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11018 "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11019 [(set_attr "type" "sseiadd")
11020 (set_attr "prefix_extra" "1")
11021 (set_attr "prefix" "vex")
11022 (set_attr "mode" "OI")])
11024 (define_expand "<code><mode>3_mask"
11025 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
11026 (vec_merge:VI48_AVX512VL
11027 (maxmin:VI48_AVX512VL
11028 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand")
11029 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand"))
11030 (match_operand:VI48_AVX512VL 3 "vector_move_operand")
11031 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
11033 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
11035 (define_insn "*avx512f_<code><mode>3<mask_name>"
11036 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
11037 (maxmin:VI48_AVX512VL
11038 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "%v")
11039 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")))]
11040 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11041 "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11042 [(set_attr "type" "sseiadd")
11043 (set_attr "prefix_extra" "1")
11044 (set_attr "prefix" "maybe_evex")
11045 (set_attr "mode" "<sseinsnmode>")])
11047 (define_insn "<mask_codefor><code><mode>3<mask_name>"
11048 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
11049 (maxmin:VI12_AVX512VL
11050 (match_operand:VI12_AVX512VL 1 "register_operand" "v")
11051 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")))]
11053 "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11054 [(set_attr "type" "sseiadd")
11055 (set_attr "prefix" "evex")
11056 (set_attr "mode" "<sseinsnmode>")])
11058 (define_expand "<code><mode>3"
11059 [(set (match_operand:VI8_AVX2_AVX512F 0 "register_operand")
11060 (maxmin:VI8_AVX2_AVX512F
11061 (match_operand:VI8_AVX2_AVX512F 1 "register_operand")
11062 (match_operand:VI8_AVX2_AVX512F 2 "register_operand")))]
11066 && (<MODE>mode == V8DImode || TARGET_AVX512VL))
11067 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
11070 enum rtx_code code;
11075 xops[0] = operands[0];
11077 if (<CODE> == SMAX || <CODE> == UMAX)
11079 xops[1] = operands[1];
11080 xops[2] = operands[2];
11084 xops[1] = operands[2];
11085 xops[2] = operands[1];
11088 code = (<CODE> == UMAX || <CODE> == UMIN) ? GTU : GT;
11090 xops[3] = gen_rtx_fmt_ee (code, VOIDmode, operands[1], operands[2]);
11091 xops[4] = operands[1];
11092 xops[5] = operands[2];
11094 ok = ix86_expand_int_vcond (xops);
11100 (define_expand "<code><mode>3"
11101 [(set (match_operand:VI124_128 0 "register_operand")
11103 (match_operand:VI124_128 1 "vector_operand")
11104 (match_operand:VI124_128 2 "vector_operand")))]
11107 if (TARGET_SSE4_1 || <MODE>mode == V8HImode)
11108 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
11114 xops[0] = operands[0];
11115 operands[1] = force_reg (<MODE>mode, operands[1]);
11116 operands[2] = force_reg (<MODE>mode, operands[2]);
11118 if (<CODE> == SMAX)
11120 xops[1] = operands[1];
11121 xops[2] = operands[2];
11125 xops[1] = operands[2];
11126 xops[2] = operands[1];
11129 xops[3] = gen_rtx_GT (VOIDmode, operands[1], operands[2]);
11130 xops[4] = operands[1];
11131 xops[5] = operands[2];
11133 ok = ix86_expand_int_vcond (xops);
11139 (define_insn "*sse4_1_<code><mode>3<mask_name>"
11140 [(set (match_operand:VI14_128 0 "register_operand" "=Yr,*x,v")
11142 (match_operand:VI14_128 1 "vector_operand" "%0,0,v")
11143 (match_operand:VI14_128 2 "vector_operand" "YrBm,*xBm,vm")))]
11145 && <mask_mode512bit_condition>
11146 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11148 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
11149 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
11150 vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11151 [(set_attr "isa" "noavx,noavx,avx")
11152 (set_attr "type" "sseiadd")
11153 (set_attr "prefix_extra" "1,1,*")
11154 (set_attr "prefix" "orig,orig,vex")
11155 (set_attr "mode" "TI")])
11157 (define_insn "*<code>v8hi3"
11158 [(set (match_operand:V8HI 0 "register_operand" "=x,x,v")
11160 (match_operand:V8HI 1 "vector_operand" "%0,x,v")
11161 (match_operand:V8HI 2 "vector_operand" "xBm,xm,vm")))]
11162 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11164 p<maxmin_int>w\t{%2, %0|%0, %2}
11165 vp<maxmin_int>w\t{%2, %1, %0|%0, %1, %2}
11166 vp<maxmin_int>w\t{%2, %1, %0|%0, %1, %2}"
11167 [(set_attr "isa" "noavx,avx,avx512bw")
11168 (set_attr "type" "sseiadd")
11169 (set_attr "prefix_data16" "1,*,*")
11170 (set_attr "prefix_extra" "*,1,1")
11171 (set_attr "prefix" "orig,vex,evex")
11172 (set_attr "mode" "TI")])
11174 (define_expand "<code><mode>3"
11175 [(set (match_operand:VI124_128 0 "register_operand")
11177 (match_operand:VI124_128 1 "vector_operand")
11178 (match_operand:VI124_128 2 "vector_operand")))]
11181 if (TARGET_SSE4_1 || <MODE>mode == V16QImode)
11182 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
11183 else if (<CODE> == UMAX && <MODE>mode == V8HImode)
11185 rtx op0 = operands[0], op2 = operands[2], op3 = op0;
11186 operands[1] = force_reg (<MODE>mode, operands[1]);
11187 if (rtx_equal_p (op3, op2))
11188 op3 = gen_reg_rtx (V8HImode);
11189 emit_insn (gen_sse2_ussubv8hi3 (op3, operands[1], op2));
11190 emit_insn (gen_addv8hi3 (op0, op3, op2));
11198 operands[1] = force_reg (<MODE>mode, operands[1]);
11199 operands[2] = force_reg (<MODE>mode, operands[2]);
11201 xops[0] = operands[0];
11203 if (<CODE> == UMAX)
11205 xops[1] = operands[1];
11206 xops[2] = operands[2];
11210 xops[1] = operands[2];
11211 xops[2] = operands[1];
11214 xops[3] = gen_rtx_GTU (VOIDmode, operands[1], operands[2]);
11215 xops[4] = operands[1];
11216 xops[5] = operands[2];
11218 ok = ix86_expand_int_vcond (xops);
11224 (define_insn "*sse4_1_<code><mode>3<mask_name>"
11225 [(set (match_operand:VI24_128 0 "register_operand" "=Yr,*x,v")
11227 (match_operand:VI24_128 1 "vector_operand" "%0,0,v")
11228 (match_operand:VI24_128 2 "vector_operand" "YrBm,*xBm,vm")))]
11230 && <mask_mode512bit_condition>
11231 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11233 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
11234 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
11235 vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11236 [(set_attr "isa" "noavx,noavx,avx")
11237 (set_attr "type" "sseiadd")
11238 (set_attr "prefix_extra" "1,1,*")
11239 (set_attr "prefix" "orig,orig,vex")
11240 (set_attr "mode" "TI")])
11242 (define_insn "*<code>v16qi3"
11243 [(set (match_operand:V16QI 0 "register_operand" "=x,x,v")
11245 (match_operand:V16QI 1 "vector_operand" "%0,x,v")
11246 (match_operand:V16QI 2 "vector_operand" "xBm,xm,vm")))]
11247 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11249 p<maxmin_int>b\t{%2, %0|%0, %2}
11250 vp<maxmin_int>b\t{%2, %1, %0|%0, %1, %2}
11251 vp<maxmin_int>b\t{%2, %1, %0|%0, %1, %2}"
11252 [(set_attr "isa" "noavx,avx,avx512bw")
11253 (set_attr "type" "sseiadd")
11254 (set_attr "prefix_data16" "1,*,*")
11255 (set_attr "prefix_extra" "*,1,1")
11256 (set_attr "prefix" "orig,vex,evex")
11257 (set_attr "mode" "TI")])
11259 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11261 ;; Parallel integral comparisons
11263 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11265 (define_expand "avx2_eq<mode>3"
11266 [(set (match_operand:VI_256 0 "register_operand")
11268 (match_operand:VI_256 1 "nonimmediate_operand")
11269 (match_operand:VI_256 2 "nonimmediate_operand")))]
11271 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
11273 (define_insn "*avx2_eq<mode>3"
11274 [(set (match_operand:VI_256 0 "register_operand" "=x")
11276 (match_operand:VI_256 1 "nonimmediate_operand" "%x")
11277 (match_operand:VI_256 2 "nonimmediate_operand" "xm")))]
11278 "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11279 "vpcmpeq<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11280 [(set_attr "type" "ssecmp")
11281 (set_attr "prefix_extra" "1")
11282 (set_attr "prefix" "vex")
11283 (set_attr "mode" "OI")])
11285 (define_expand "<avx512>_eq<mode>3<mask_scalar_merge_name>"
11286 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
11287 (unspec:<avx512fmaskmode>
11288 [(match_operand:VI12_AVX512VL 1 "nonimmediate_operand")
11289 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand")]
11290 UNSPEC_MASKED_EQ))]
11292 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
11294 (define_expand "<avx512>_eq<mode>3<mask_scalar_merge_name>"
11295 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
11296 (unspec:<avx512fmaskmode>
11297 [(match_operand:VI48_AVX512VL 1 "nonimmediate_operand")
11298 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand")]
11299 UNSPEC_MASKED_EQ))]
11301 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
11303 (define_insn "<avx512>_eq<mode>3<mask_scalar_merge_name>_1"
11304 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk,Yk")
11305 (unspec:<avx512fmaskmode>
11306 [(match_operand:VI12_AVX512VL 1 "vector_move_operand" "%v,v")
11307 (match_operand:VI12_AVX512VL 2 "vector_move_operand" "vm,C")]
11308 UNSPEC_MASKED_EQ))]
11309 "TARGET_AVX512BW && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11311 vpcmpeq<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}
11312 vptestnm<ssemodesuffix>\t{%1, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %1}"
11313 [(set_attr "type" "ssecmp")
11314 (set_attr "prefix_extra" "1")
11315 (set_attr "prefix" "evex")
11316 (set_attr "mode" "<sseinsnmode>")])
11318 (define_insn "<avx512>_eq<mode>3<mask_scalar_merge_name>_1"
11319 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk,Yk")
11320 (unspec:<avx512fmaskmode>
11321 [(match_operand:VI48_AVX512VL 1 "vector_move_operand" "%v,v")
11322 (match_operand:VI48_AVX512VL 2 "vector_move_operand" "vm,C")]
11323 UNSPEC_MASKED_EQ))]
11324 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11326 vpcmpeq<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}
11327 vptestnm<ssemodesuffix>\t{%1, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %1}"
11328 [(set_attr "type" "ssecmp")
11329 (set_attr "prefix_extra" "1")
11330 (set_attr "prefix" "evex")
11331 (set_attr "mode" "<sseinsnmode>")])
11333 (define_insn "*sse4_1_eqv2di3"
11334 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,x")
11336 (match_operand:V2DI 1 "vector_operand" "%0,0,x")
11337 (match_operand:V2DI 2 "vector_operand" "YrBm,*xBm,xm")))]
11338 "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11340 pcmpeqq\t{%2, %0|%0, %2}
11341 pcmpeqq\t{%2, %0|%0, %2}
11342 vpcmpeqq\t{%2, %1, %0|%0, %1, %2}"
11343 [(set_attr "isa" "noavx,noavx,avx")
11344 (set_attr "type" "ssecmp")
11345 (set_attr "prefix_extra" "1")
11346 (set_attr "prefix" "orig,orig,vex")
11347 (set_attr "mode" "TI")])
11349 (define_insn "*sse2_eq<mode>3"
11350 [(set (match_operand:VI124_128 0 "register_operand" "=x,x")
11352 (match_operand:VI124_128 1 "vector_operand" "%0,x")
11353 (match_operand:VI124_128 2 "vector_operand" "xBm,xm")))]
11354 "TARGET_SSE2 && !TARGET_XOP
11355 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11357 pcmpeq<ssemodesuffix>\t{%2, %0|%0, %2}
11358 vpcmpeq<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11359 [(set_attr "isa" "noavx,avx")
11360 (set_attr "type" "ssecmp")
11361 (set_attr "prefix_data16" "1,*")
11362 (set_attr "prefix" "orig,vex")
11363 (set_attr "mode" "TI")])
11365 (define_expand "sse2_eq<mode>3"
11366 [(set (match_operand:VI124_128 0 "register_operand")
11368 (match_operand:VI124_128 1 "vector_operand")
11369 (match_operand:VI124_128 2 "vector_operand")))]
11370 "TARGET_SSE2 && !TARGET_XOP "
11371 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
11373 (define_expand "sse4_1_eqv2di3"
11374 [(set (match_operand:V2DI 0 "register_operand")
11376 (match_operand:V2DI 1 "vector_operand")
11377 (match_operand:V2DI 2 "vector_operand")))]
11379 "ix86_fixup_binary_operands_no_copy (EQ, V2DImode, operands);")
11381 (define_insn "sse4_2_gtv2di3"
11382 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,x")
11384 (match_operand:V2DI 1 "register_operand" "0,0,x")
11385 (match_operand:V2DI 2 "vector_operand" "YrBm,*xBm,xm")))]
11388 pcmpgtq\t{%2, %0|%0, %2}
11389 pcmpgtq\t{%2, %0|%0, %2}
11390 vpcmpgtq\t{%2, %1, %0|%0, %1, %2}"
11391 [(set_attr "isa" "noavx,noavx,avx")
11392 (set_attr "type" "ssecmp")
11393 (set_attr "prefix_extra" "1")
11394 (set_attr "prefix" "orig,orig,vex")
11395 (set_attr "mode" "TI")])
11397 (define_insn "avx2_gt<mode>3"
11398 [(set (match_operand:VI_256 0 "register_operand" "=x")
11400 (match_operand:VI_256 1 "register_operand" "x")
11401 (match_operand:VI_256 2 "nonimmediate_operand" "xm")))]
11403 "vpcmpgt<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11404 [(set_attr "type" "ssecmp")
11405 (set_attr "prefix_extra" "1")
11406 (set_attr "prefix" "vex")
11407 (set_attr "mode" "OI")])
11409 (define_insn "<avx512>_gt<mode>3<mask_scalar_merge_name>"
11410 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11411 (unspec:<avx512fmaskmode>
11412 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
11413 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")] UNSPEC_MASKED_GT))]
11415 "vpcmpgt<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11416 [(set_attr "type" "ssecmp")
11417 (set_attr "prefix_extra" "1")
11418 (set_attr "prefix" "evex")
11419 (set_attr "mode" "<sseinsnmode>")])
11421 (define_insn "<avx512>_gt<mode>3<mask_scalar_merge_name>"
11422 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11423 (unspec:<avx512fmaskmode>
11424 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
11425 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")] UNSPEC_MASKED_GT))]
11427 "vpcmpgt<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11428 [(set_attr "type" "ssecmp")
11429 (set_attr "prefix_extra" "1")
11430 (set_attr "prefix" "evex")
11431 (set_attr "mode" "<sseinsnmode>")])
11433 (define_insn "sse2_gt<mode>3"
11434 [(set (match_operand:VI124_128 0 "register_operand" "=x,x")
11436 (match_operand:VI124_128 1 "register_operand" "0,x")
11437 (match_operand:VI124_128 2 "vector_operand" "xBm,xm")))]
11438 "TARGET_SSE2 && !TARGET_XOP"
11440 pcmpgt<ssemodesuffix>\t{%2, %0|%0, %2}
11441 vpcmpgt<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11442 [(set_attr "isa" "noavx,avx")
11443 (set_attr "type" "ssecmp")
11444 (set_attr "prefix_data16" "1,*")
11445 (set_attr "prefix" "orig,vex")
11446 (set_attr "mode" "TI")])
11448 (define_expand "vcond<V_512:mode><VI_AVX512BW:mode>"
11449 [(set (match_operand:V_512 0 "register_operand")
11450 (if_then_else:V_512
11451 (match_operator 3 ""
11452 [(match_operand:VI_AVX512BW 4 "nonimmediate_operand")
11453 (match_operand:VI_AVX512BW 5 "general_operand")])
11454 (match_operand:V_512 1)
11455 (match_operand:V_512 2)))]
11457 && (GET_MODE_NUNITS (<V_512:MODE>mode)
11458 == GET_MODE_NUNITS (<VI_AVX512BW:MODE>mode))"
11460 bool ok = ix86_expand_int_vcond (operands);
11465 (define_expand "vcond<V_256:mode><VI_256:mode>"
11466 [(set (match_operand:V_256 0 "register_operand")
11467 (if_then_else:V_256
11468 (match_operator 3 ""
11469 [(match_operand:VI_256 4 "nonimmediate_operand")
11470 (match_operand:VI_256 5 "general_operand")])
11471 (match_operand:V_256 1)
11472 (match_operand:V_256 2)))]
11474 && (GET_MODE_NUNITS (<V_256:MODE>mode)
11475 == GET_MODE_NUNITS (<VI_256:MODE>mode))"
11477 bool ok = ix86_expand_int_vcond (operands);
11482 (define_expand "vcond<V_128:mode><VI124_128:mode>"
11483 [(set (match_operand:V_128 0 "register_operand")
11484 (if_then_else:V_128
11485 (match_operator 3 ""
11486 [(match_operand:VI124_128 4 "vector_operand")
11487 (match_operand:VI124_128 5 "general_operand")])
11488 (match_operand:V_128 1)
11489 (match_operand:V_128 2)))]
11491 && (GET_MODE_NUNITS (<V_128:MODE>mode)
11492 == GET_MODE_NUNITS (<VI124_128:MODE>mode))"
11494 bool ok = ix86_expand_int_vcond (operands);
11499 (define_expand "vcond<VI8F_128:mode>v2di"
11500 [(set (match_operand:VI8F_128 0 "register_operand")
11501 (if_then_else:VI8F_128
11502 (match_operator 3 ""
11503 [(match_operand:V2DI 4 "vector_operand")
11504 (match_operand:V2DI 5 "general_operand")])
11505 (match_operand:VI8F_128 1)
11506 (match_operand:VI8F_128 2)))]
11509 bool ok = ix86_expand_int_vcond (operands);
11514 (define_expand "vcondu<V_512:mode><VI_AVX512BW:mode>"
11515 [(set (match_operand:V_512 0 "register_operand")
11516 (if_then_else:V_512
11517 (match_operator 3 ""
11518 [(match_operand:VI_AVX512BW 4 "nonimmediate_operand")
11519 (match_operand:VI_AVX512BW 5 "nonimmediate_operand")])
11520 (match_operand:V_512 1 "general_operand")
11521 (match_operand:V_512 2 "general_operand")))]
11523 && (GET_MODE_NUNITS (<V_512:MODE>mode)
11524 == GET_MODE_NUNITS (<VI_AVX512BW:MODE>mode))"
11526 bool ok = ix86_expand_int_vcond (operands);
11531 (define_expand "vcondu<V_256:mode><VI_256:mode>"
11532 [(set (match_operand:V_256 0 "register_operand")
11533 (if_then_else:V_256
11534 (match_operator 3 ""
11535 [(match_operand:VI_256 4 "nonimmediate_operand")
11536 (match_operand:VI_256 5 "nonimmediate_operand")])
11537 (match_operand:V_256 1 "general_operand")
11538 (match_operand:V_256 2 "general_operand")))]
11540 && (GET_MODE_NUNITS (<V_256:MODE>mode)
11541 == GET_MODE_NUNITS (<VI_256:MODE>mode))"
11543 bool ok = ix86_expand_int_vcond (operands);
11548 (define_expand "vcondu<V_128:mode><VI124_128:mode>"
11549 [(set (match_operand:V_128 0 "register_operand")
11550 (if_then_else:V_128
11551 (match_operator 3 ""
11552 [(match_operand:VI124_128 4 "vector_operand")
11553 (match_operand:VI124_128 5 "vector_operand")])
11554 (match_operand:V_128 1 "general_operand")
11555 (match_operand:V_128 2 "general_operand")))]
11557 && (GET_MODE_NUNITS (<V_128:MODE>mode)
11558 == GET_MODE_NUNITS (<VI124_128:MODE>mode))"
11560 bool ok = ix86_expand_int_vcond (operands);
11565 (define_expand "vcondu<VI8F_128:mode>v2di"
11566 [(set (match_operand:VI8F_128 0 "register_operand")
11567 (if_then_else:VI8F_128
11568 (match_operator 3 ""
11569 [(match_operand:V2DI 4 "vector_operand")
11570 (match_operand:V2DI 5 "vector_operand")])
11571 (match_operand:VI8F_128 1 "general_operand")
11572 (match_operand:VI8F_128 2 "general_operand")))]
11575 bool ok = ix86_expand_int_vcond (operands);
11580 (define_expand "vcondeq<VI8F_128:mode>v2di"
11581 [(set (match_operand:VI8F_128 0 "register_operand")
11582 (if_then_else:VI8F_128
11583 (match_operator 3 ""
11584 [(match_operand:V2DI 4 "vector_operand")
11585 (match_operand:V2DI 5 "general_operand")])
11586 (match_operand:VI8F_128 1)
11587 (match_operand:VI8F_128 2)))]
11590 bool ok = ix86_expand_int_vcond (operands);
11595 (define_mode_iterator VEC_PERM_AVX2
11596 [V16QI V8HI V4SI V2DI V4SF V2DF
11597 (V32QI "TARGET_AVX2") (V16HI "TARGET_AVX2")
11598 (V8SI "TARGET_AVX2") (V4DI "TARGET_AVX2")
11599 (V8SF "TARGET_AVX2") (V4DF "TARGET_AVX2")
11600 (V16SF "TARGET_AVX512F") (V8DF "TARGET_AVX512F")
11601 (V16SI "TARGET_AVX512F") (V8DI "TARGET_AVX512F")
11602 (V32HI "TARGET_AVX512BW") (V64QI "TARGET_AVX512VBMI")])
11604 (define_expand "vec_perm<mode>"
11605 [(match_operand:VEC_PERM_AVX2 0 "register_operand")
11606 (match_operand:VEC_PERM_AVX2 1 "register_operand")
11607 (match_operand:VEC_PERM_AVX2 2 "register_operand")
11608 (match_operand:<sseintvecmode> 3 "register_operand")]
11609 "TARGET_SSSE3 || TARGET_AVX || TARGET_XOP"
11611 ix86_expand_vec_perm (operands);
11615 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11617 ;; Parallel bitwise logical operations
11619 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11621 (define_expand "one_cmpl<mode>2"
11622 [(set (match_operand:VI 0 "register_operand")
11623 (xor:VI (match_operand:VI 1 "vector_operand")
11627 operands[2] = force_reg (<MODE>mode, CONSTM1_RTX (<MODE>mode));
11630 (define_expand "<sse2_avx2>_andnot<mode>3"
11631 [(set (match_operand:VI_AVX2 0 "register_operand")
11633 (not:VI_AVX2 (match_operand:VI_AVX2 1 "register_operand"))
11634 (match_operand:VI_AVX2 2 "vector_operand")))]
11637 (define_expand "<sse2_avx2>_andnot<mode>3_mask"
11638 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
11639 (vec_merge:VI48_AVX512VL
11642 (match_operand:VI48_AVX512VL 1 "register_operand"))
11643 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand"))
11644 (match_operand:VI48_AVX512VL 3 "vector_move_operand")
11645 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
11648 (define_expand "<sse2_avx2>_andnot<mode>3_mask"
11649 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
11650 (vec_merge:VI12_AVX512VL
11653 (match_operand:VI12_AVX512VL 1 "register_operand"))
11654 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand"))
11655 (match_operand:VI12_AVX512VL 3 "vector_move_operand")
11656 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
11659 (define_insn "*andnot<mode>3"
11660 [(set (match_operand:VI 0 "register_operand" "=x,x,v")
11662 (not:VI (match_operand:VI 1 "register_operand" "0,x,v"))
11663 (match_operand:VI 2 "vector_operand" "xBm,xm,vm")))]
11666 static char buf[64];
11669 const char *ssesuffix;
11671 switch (get_attr_mode (insn))
11674 gcc_assert (TARGET_AVX512F);
11677 gcc_assert (TARGET_AVX2);
11680 gcc_assert (TARGET_SSE2);
11682 switch (<MODE>mode)
11686 /* There is no vpandnb or vpandnw instruction, nor vpandn for
11687 512-bit vectors. Use vpandnq instead. */
11692 ssesuffix = "<ssemodesuffix>";
11698 ssesuffix = (TARGET_AVX512VL && which_alternative == 2
11699 ? "<ssemodesuffix>" : "");
11702 ssesuffix = TARGET_AVX512VL && which_alternative == 2 ? "q" : "";
11707 gcc_assert (TARGET_AVX512F);
11710 gcc_assert (TARGET_AVX);
11713 gcc_assert (TARGET_SSE);
11719 gcc_unreachable ();
11722 switch (which_alternative)
11725 ops = "%s%s\t{%%2, %%0|%%0, %%2}";
11729 ops = "v%s%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
11732 gcc_unreachable ();
11735 snprintf (buf, sizeof (buf), ops, tmp, ssesuffix);
11738 [(set_attr "isa" "noavx,avx,avx")
11739 (set_attr "type" "sselog")
11740 (set (attr "prefix_data16")
11742 (and (eq_attr "alternative" "0")
11743 (eq_attr "mode" "TI"))
11745 (const_string "*")))
11746 (set_attr "prefix" "orig,vex,evex")
11748 (cond [(and (match_test "<MODE_SIZE> == 16")
11749 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
11750 (const_string "<ssePSmode>")
11751 (match_test "TARGET_AVX2")
11752 (const_string "<sseinsnmode>")
11753 (match_test "TARGET_AVX")
11755 (match_test "<MODE_SIZE> > 16")
11756 (const_string "V8SF")
11757 (const_string "<sseinsnmode>"))
11758 (ior (not (match_test "TARGET_SSE2"))
11759 (match_test "optimize_function_for_size_p (cfun)"))
11760 (const_string "V4SF")
11762 (const_string "<sseinsnmode>")))])
11764 (define_insn "*andnot<mode>3_mask"
11765 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
11766 (vec_merge:VI48_AVX512VL
11769 (match_operand:VI48_AVX512VL 1 "register_operand" "v"))
11770 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm"))
11771 (match_operand:VI48_AVX512VL 3 "vector_move_operand" "0C")
11772 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
11774 "vpandn<ssemodesuffix>\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}";
11775 [(set_attr "type" "sselog")
11776 (set_attr "prefix" "evex")
11777 (set_attr "mode" "<sseinsnmode>")])
11779 (define_expand "<code><mode>3"
11780 [(set (match_operand:VI 0 "register_operand")
11782 (match_operand:VI 1 "nonimmediate_or_const_vector_operand")
11783 (match_operand:VI 2 "nonimmediate_or_const_vector_operand")))]
11786 ix86_expand_vector_logical_operator (<CODE>, <MODE>mode, operands);
11790 (define_insn "<mask_codefor><code><mode>3<mask_name>"
11791 [(set (match_operand:VI48_AVX_AVX512F 0 "register_operand" "=x,x,v")
11792 (any_logic:VI48_AVX_AVX512F
11793 (match_operand:VI48_AVX_AVX512F 1 "vector_operand" "%0,x,v")
11794 (match_operand:VI48_AVX_AVX512F 2 "vector_operand" "xBm,xm,vm")))]
11795 "TARGET_SSE && <mask_mode512bit_condition>
11796 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11798 static char buf[64];
11801 const char *ssesuffix;
11803 switch (get_attr_mode (insn))
11806 gcc_assert (TARGET_AVX512F);
11809 gcc_assert (TARGET_AVX2);
11812 gcc_assert (TARGET_SSE2);
11814 switch (<MODE>mode)
11818 ssesuffix = "<ssemodesuffix>";
11824 ssesuffix = (TARGET_AVX512VL
11825 && (<mask_applied> || which_alternative == 2)
11826 ? "<ssemodesuffix>" : "");
11829 gcc_unreachable ();
11834 gcc_assert (TARGET_AVX);
11837 gcc_assert (TARGET_SSE);
11843 gcc_unreachable ();
11846 switch (which_alternative)
11849 if (<mask_applied>)
11850 ops = "v%s%s\t{%%2, %%0, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%0, %%2}";
11852 ops = "%s%s\t{%%2, %%0|%%0, %%2}";
11856 ops = "v%s%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
11859 gcc_unreachable ();
11862 snprintf (buf, sizeof (buf), ops, tmp, ssesuffix);
11865 [(set_attr "isa" "noavx,avx,avx")
11866 (set_attr "type" "sselog")
11867 (set (attr "prefix_data16")
11869 (and (eq_attr "alternative" "0")
11870 (eq_attr "mode" "TI"))
11872 (const_string "*")))
11873 (set_attr "prefix" "<mask_prefix3>,evex")
11875 (cond [(and (match_test "<MODE_SIZE> == 16")
11876 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
11877 (const_string "<ssePSmode>")
11878 (match_test "TARGET_AVX2")
11879 (const_string "<sseinsnmode>")
11880 (match_test "TARGET_AVX")
11882 (match_test "<MODE_SIZE> > 16")
11883 (const_string "V8SF")
11884 (const_string "<sseinsnmode>"))
11885 (ior (not (match_test "TARGET_SSE2"))
11886 (match_test "optimize_function_for_size_p (cfun)"))
11887 (const_string "V4SF")
11889 (const_string "<sseinsnmode>")))])
11891 (define_insn "*<code><mode>3"
11892 [(set (match_operand:VI12_AVX_AVX512F 0 "register_operand" "=x,x,v")
11893 (any_logic:VI12_AVX_AVX512F
11894 (match_operand:VI12_AVX_AVX512F 1 "vector_operand" "%0,x,v")
11895 (match_operand:VI12_AVX_AVX512F 2 "vector_operand" "xBm,xm,vm")))]
11896 "TARGET_SSE && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11898 static char buf[64];
11901 const char *ssesuffix;
11903 switch (get_attr_mode (insn))
11906 gcc_assert (TARGET_AVX512F);
11909 gcc_assert (TARGET_AVX2);
11912 gcc_assert (TARGET_SSE2);
11914 switch (<MODE>mode)
11924 ssesuffix = TARGET_AVX512VL && which_alternative == 2 ? "q" : "";
11927 gcc_unreachable ();
11932 gcc_assert (TARGET_AVX);
11935 gcc_assert (TARGET_SSE);
11941 gcc_unreachable ();
11944 switch (which_alternative)
11947 ops = "%s%s\t{%%2, %%0|%%0, %%2}";
11951 ops = "v%s%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
11954 gcc_unreachable ();
11957 snprintf (buf, sizeof (buf), ops, tmp, ssesuffix);
11960 [(set_attr "isa" "noavx,avx,avx")
11961 (set_attr "type" "sselog")
11962 (set (attr "prefix_data16")
11964 (and (eq_attr "alternative" "0")
11965 (eq_attr "mode" "TI"))
11967 (const_string "*")))
11968 (set_attr "prefix" "orig,vex,evex")
11970 (cond [(and (match_test "<MODE_SIZE> == 16")
11971 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
11972 (const_string "<ssePSmode>")
11973 (match_test "TARGET_AVX2")
11974 (const_string "<sseinsnmode>")
11975 (match_test "TARGET_AVX")
11977 (match_test "<MODE_SIZE> > 16")
11978 (const_string "V8SF")
11979 (const_string "<sseinsnmode>"))
11980 (ior (not (match_test "TARGET_SSE2"))
11981 (match_test "optimize_function_for_size_p (cfun)"))
11982 (const_string "V4SF")
11984 (const_string "<sseinsnmode>")))])
11986 (define_insn "<avx512>_testm<mode>3<mask_scalar_merge_name>"
11987 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11988 (unspec:<avx512fmaskmode>
11989 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
11990 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")]
11993 "vptestm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11994 [(set_attr "prefix" "evex")
11995 (set_attr "mode" "<sseinsnmode>")])
11997 (define_insn "<avx512>_testm<mode>3<mask_scalar_merge_name>"
11998 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11999 (unspec:<avx512fmaskmode>
12000 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
12001 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")]
12004 "vptestm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
12005 [(set_attr "prefix" "evex")
12006 (set_attr "mode" "<sseinsnmode>")])
12008 (define_insn "<avx512>_testnm<mode>3<mask_scalar_merge_name>"
12009 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
12010 (unspec:<avx512fmaskmode>
12011 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
12012 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")]
12015 "vptestnm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
12016 [(set_attr "prefix" "evex")
12017 (set_attr "mode" "<sseinsnmode>")])
12019 (define_insn "<avx512>_testnm<mode>3<mask_scalar_merge_name>"
12020 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
12021 (unspec:<avx512fmaskmode>
12022 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
12023 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")]
12026 "vptestnm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
12027 [(set_attr "prefix" "evex")
12028 (set_attr "mode" "<sseinsnmode>")])
12030 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12032 ;; Parallel integral element swizzling
12034 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12036 (define_expand "vec_pack_trunc_<mode>"
12037 [(match_operand:<ssepackmode> 0 "register_operand")
12038 (match_operand:VI248_AVX2_8_AVX512F_24_AVX512BW 1 "register_operand")
12039 (match_operand:VI248_AVX2_8_AVX512F_24_AVX512BW 2 "register_operand")]
12042 rtx op1 = gen_lowpart (<ssepackmode>mode, operands[1]);
12043 rtx op2 = gen_lowpart (<ssepackmode>mode, operands[2]);
12044 ix86_expand_vec_extract_even_odd (operands[0], op1, op2, 0);
12048 (define_expand "vec_pack_trunc_qi"
12049 [(set (match_operand:HI 0 ("register_operand"))
12050 (ior:HI (ashift:HI (zero_extend:HI (match_operand:QI 2 ("register_operand")))
12052 (zero_extend:HI (match_operand:QI 1 ("register_operand")))))]
12055 (define_expand "vec_pack_trunc_<mode>"
12056 [(set (match_operand:<DOUBLEMASKMODE> 0 ("register_operand"))
12057 (ior:<DOUBLEMASKMODE> (ashift:<DOUBLEMASKMODE> (zero_extend:<DOUBLEMASKMODE> (match_operand:SWI24 2 ("register_operand")))
12059 (zero_extend:<DOUBLEMASKMODE> (match_operand:SWI24 1 ("register_operand")))))]
12062 operands[3] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
12065 (define_insn "<sse2_avx2>_packsswb<mask_name>"
12066 [(set (match_operand:VI1_AVX512 0 "register_operand" "=x,x,v")
12067 (vec_concat:VI1_AVX512
12068 (ss_truncate:<ssehalfvecmode>
12069 (match_operand:<sseunpackmode> 1 "register_operand" "0,x,v"))
12070 (ss_truncate:<ssehalfvecmode>
12071 (match_operand:<sseunpackmode> 2 "vector_operand" "xBm,xm,vm"))))]
12072 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
12074 packsswb\t{%2, %0|%0, %2}
12075 vpacksswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
12076 vpacksswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12077 [(set_attr "isa" "noavx,avx,avx512bw")
12078 (set_attr "type" "sselog")
12079 (set_attr "prefix_data16" "1,*,*")
12080 (set_attr "prefix" "orig,<mask_prefix>,evex")
12081 (set_attr "mode" "<sseinsnmode>")])
12083 (define_insn "<sse2_avx2>_packssdw<mask_name>"
12084 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,x,v")
12085 (vec_concat:VI2_AVX2
12086 (ss_truncate:<ssehalfvecmode>
12087 (match_operand:<sseunpackmode> 1 "register_operand" "0,x,v"))
12088 (ss_truncate:<ssehalfvecmode>
12089 (match_operand:<sseunpackmode> 2 "vector_operand" "xBm,xm,vm"))))]
12090 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
12092 packssdw\t{%2, %0|%0, %2}
12093 vpackssdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
12094 vpackssdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12095 [(set_attr "isa" "noavx,avx,avx512bw")
12096 (set_attr "type" "sselog")
12097 (set_attr "prefix_data16" "1,*,*")
12098 (set_attr "prefix" "orig,<mask_prefix>,evex")
12099 (set_attr "mode" "<sseinsnmode>")])
12101 (define_insn "<sse2_avx2>_packuswb<mask_name>"
12102 [(set (match_operand:VI1_AVX512 0 "register_operand" "=x,x,v")
12103 (vec_concat:VI1_AVX512
12104 (us_truncate:<ssehalfvecmode>
12105 (match_operand:<sseunpackmode> 1 "register_operand" "0,x,v"))
12106 (us_truncate:<ssehalfvecmode>
12107 (match_operand:<sseunpackmode> 2 "vector_operand" "xBm,xm,vm"))))]
12108 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
12110 packuswb\t{%2, %0|%0, %2}
12111 vpackuswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
12112 vpackuswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12113 [(set_attr "isa" "noavx,avx,avx512bw")
12114 (set_attr "type" "sselog")
12115 (set_attr "prefix_data16" "1,*,*")
12116 (set_attr "prefix" "orig,<mask_prefix>,evex")
12117 (set_attr "mode" "<sseinsnmode>")])
12119 (define_insn "avx512bw_interleave_highv64qi<mask_name>"
12120 [(set (match_operand:V64QI 0 "register_operand" "=v")
12123 (match_operand:V64QI 1 "register_operand" "v")
12124 (match_operand:V64QI 2 "nonimmediate_operand" "vm"))
12125 (parallel [(const_int 8) (const_int 72)
12126 (const_int 9) (const_int 73)
12127 (const_int 10) (const_int 74)
12128 (const_int 11) (const_int 75)
12129 (const_int 12) (const_int 76)
12130 (const_int 13) (const_int 77)
12131 (const_int 14) (const_int 78)
12132 (const_int 15) (const_int 79)
12133 (const_int 24) (const_int 88)
12134 (const_int 25) (const_int 89)
12135 (const_int 26) (const_int 90)
12136 (const_int 27) (const_int 91)
12137 (const_int 28) (const_int 92)
12138 (const_int 29) (const_int 93)
12139 (const_int 30) (const_int 94)
12140 (const_int 31) (const_int 95)
12141 (const_int 40) (const_int 104)
12142 (const_int 41) (const_int 105)
12143 (const_int 42) (const_int 106)
12144 (const_int 43) (const_int 107)
12145 (const_int 44) (const_int 108)
12146 (const_int 45) (const_int 109)
12147 (const_int 46) (const_int 110)
12148 (const_int 47) (const_int 111)
12149 (const_int 56) (const_int 120)
12150 (const_int 57) (const_int 121)
12151 (const_int 58) (const_int 122)
12152 (const_int 59) (const_int 123)
12153 (const_int 60) (const_int 124)
12154 (const_int 61) (const_int 125)
12155 (const_int 62) (const_int 126)
12156 (const_int 63) (const_int 127)])))]
12158 "vpunpckhbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12159 [(set_attr "type" "sselog")
12160 (set_attr "prefix" "evex")
12161 (set_attr "mode" "XI")])
12163 (define_insn "avx2_interleave_highv32qi<mask_name>"
12164 [(set (match_operand:V32QI 0 "register_operand" "=v")
12167 (match_operand:V32QI 1 "register_operand" "v")
12168 (match_operand:V32QI 2 "nonimmediate_operand" "vm"))
12169 (parallel [(const_int 8) (const_int 40)
12170 (const_int 9) (const_int 41)
12171 (const_int 10) (const_int 42)
12172 (const_int 11) (const_int 43)
12173 (const_int 12) (const_int 44)
12174 (const_int 13) (const_int 45)
12175 (const_int 14) (const_int 46)
12176 (const_int 15) (const_int 47)
12177 (const_int 24) (const_int 56)
12178 (const_int 25) (const_int 57)
12179 (const_int 26) (const_int 58)
12180 (const_int 27) (const_int 59)
12181 (const_int 28) (const_int 60)
12182 (const_int 29) (const_int 61)
12183 (const_int 30) (const_int 62)
12184 (const_int 31) (const_int 63)])))]
12185 "TARGET_AVX2 && <mask_avx512vl_condition>"
12186 "vpunpckhbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12187 [(set_attr "type" "sselog")
12188 (set_attr "prefix" "<mask_prefix>")
12189 (set_attr "mode" "OI")])
12191 (define_insn "vec_interleave_highv16qi<mask_name>"
12192 [(set (match_operand:V16QI 0 "register_operand" "=x,v")
12195 (match_operand:V16QI 1 "register_operand" "0,v")
12196 (match_operand:V16QI 2 "vector_operand" "xBm,vm"))
12197 (parallel [(const_int 8) (const_int 24)
12198 (const_int 9) (const_int 25)
12199 (const_int 10) (const_int 26)
12200 (const_int 11) (const_int 27)
12201 (const_int 12) (const_int 28)
12202 (const_int 13) (const_int 29)
12203 (const_int 14) (const_int 30)
12204 (const_int 15) (const_int 31)])))]
12205 "TARGET_SSE2 && <mask_avx512vl_condition>"
12207 punpckhbw\t{%2, %0|%0, %2}
12208 vpunpckhbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12209 [(set_attr "isa" "noavx,avx")
12210 (set_attr "type" "sselog")
12211 (set_attr "prefix_data16" "1,*")
12212 (set_attr "prefix" "orig,<mask_prefix>")
12213 (set_attr "mode" "TI")])
12215 (define_insn "avx512bw_interleave_lowv64qi<mask_name>"
12216 [(set (match_operand:V64QI 0 "register_operand" "=v")
12219 (match_operand:V64QI 1 "register_operand" "v")
12220 (match_operand:V64QI 2 "nonimmediate_operand" "vm"))
12221 (parallel [(const_int 0) (const_int 64)
12222 (const_int 1) (const_int 65)
12223 (const_int 2) (const_int 66)
12224 (const_int 3) (const_int 67)
12225 (const_int 4) (const_int 68)
12226 (const_int 5) (const_int 69)
12227 (const_int 6) (const_int 70)
12228 (const_int 7) (const_int 71)
12229 (const_int 16) (const_int 80)
12230 (const_int 17) (const_int 81)
12231 (const_int 18) (const_int 82)
12232 (const_int 19) (const_int 83)
12233 (const_int 20) (const_int 84)
12234 (const_int 21) (const_int 85)
12235 (const_int 22) (const_int 86)
12236 (const_int 23) (const_int 87)
12237 (const_int 32) (const_int 96)
12238 (const_int 33) (const_int 97)
12239 (const_int 34) (const_int 98)
12240 (const_int 35) (const_int 99)
12241 (const_int 36) (const_int 100)
12242 (const_int 37) (const_int 101)
12243 (const_int 38) (const_int 102)
12244 (const_int 39) (const_int 103)
12245 (const_int 48) (const_int 112)
12246 (const_int 49) (const_int 113)
12247 (const_int 50) (const_int 114)
12248 (const_int 51) (const_int 115)
12249 (const_int 52) (const_int 116)
12250 (const_int 53) (const_int 117)
12251 (const_int 54) (const_int 118)
12252 (const_int 55) (const_int 119)])))]
12254 "vpunpcklbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12255 [(set_attr "type" "sselog")
12256 (set_attr "prefix" "evex")
12257 (set_attr "mode" "XI")])
12259 (define_insn "avx2_interleave_lowv32qi<mask_name>"
12260 [(set (match_operand:V32QI 0 "register_operand" "=v")
12263 (match_operand:V32QI 1 "register_operand" "v")
12264 (match_operand:V32QI 2 "nonimmediate_operand" "vm"))
12265 (parallel [(const_int 0) (const_int 32)
12266 (const_int 1) (const_int 33)
12267 (const_int 2) (const_int 34)
12268 (const_int 3) (const_int 35)
12269 (const_int 4) (const_int 36)
12270 (const_int 5) (const_int 37)
12271 (const_int 6) (const_int 38)
12272 (const_int 7) (const_int 39)
12273 (const_int 16) (const_int 48)
12274 (const_int 17) (const_int 49)
12275 (const_int 18) (const_int 50)
12276 (const_int 19) (const_int 51)
12277 (const_int 20) (const_int 52)
12278 (const_int 21) (const_int 53)
12279 (const_int 22) (const_int 54)
12280 (const_int 23) (const_int 55)])))]
12281 "TARGET_AVX2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12282 "vpunpcklbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12283 [(set_attr "type" "sselog")
12284 (set_attr "prefix" "maybe_vex")
12285 (set_attr "mode" "OI")])
12287 (define_insn "vec_interleave_lowv16qi<mask_name>"
12288 [(set (match_operand:V16QI 0 "register_operand" "=x,v")
12291 (match_operand:V16QI 1 "register_operand" "0,v")
12292 (match_operand:V16QI 2 "vector_operand" "xBm,vm"))
12293 (parallel [(const_int 0) (const_int 16)
12294 (const_int 1) (const_int 17)
12295 (const_int 2) (const_int 18)
12296 (const_int 3) (const_int 19)
12297 (const_int 4) (const_int 20)
12298 (const_int 5) (const_int 21)
12299 (const_int 6) (const_int 22)
12300 (const_int 7) (const_int 23)])))]
12301 "TARGET_SSE2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12303 punpcklbw\t{%2, %0|%0, %2}
12304 vpunpcklbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12305 [(set_attr "isa" "noavx,avx")
12306 (set_attr "type" "sselog")
12307 (set_attr "prefix_data16" "1,*")
12308 (set_attr "prefix" "orig,vex")
12309 (set_attr "mode" "TI")])
12311 (define_insn "avx512bw_interleave_highv32hi<mask_name>"
12312 [(set (match_operand:V32HI 0 "register_operand" "=v")
12315 (match_operand:V32HI 1 "register_operand" "v")
12316 (match_operand:V32HI 2 "nonimmediate_operand" "vm"))
12317 (parallel [(const_int 4) (const_int 36)
12318 (const_int 5) (const_int 37)
12319 (const_int 6) (const_int 38)
12320 (const_int 7) (const_int 39)
12321 (const_int 12) (const_int 44)
12322 (const_int 13) (const_int 45)
12323 (const_int 14) (const_int 46)
12324 (const_int 15) (const_int 47)
12325 (const_int 20) (const_int 52)
12326 (const_int 21) (const_int 53)
12327 (const_int 22) (const_int 54)
12328 (const_int 23) (const_int 55)
12329 (const_int 28) (const_int 60)
12330 (const_int 29) (const_int 61)
12331 (const_int 30) (const_int 62)
12332 (const_int 31) (const_int 63)])))]
12334 "vpunpckhwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12335 [(set_attr "type" "sselog")
12336 (set_attr "prefix" "evex")
12337 (set_attr "mode" "XI")])
12339 (define_insn "avx2_interleave_highv16hi<mask_name>"
12340 [(set (match_operand:V16HI 0 "register_operand" "=v")
12343 (match_operand:V16HI 1 "register_operand" "v")
12344 (match_operand:V16HI 2 "nonimmediate_operand" "vm"))
12345 (parallel [(const_int 4) (const_int 20)
12346 (const_int 5) (const_int 21)
12347 (const_int 6) (const_int 22)
12348 (const_int 7) (const_int 23)
12349 (const_int 12) (const_int 28)
12350 (const_int 13) (const_int 29)
12351 (const_int 14) (const_int 30)
12352 (const_int 15) (const_int 31)])))]
12353 "TARGET_AVX2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12354 "vpunpckhwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12355 [(set_attr "type" "sselog")
12356 (set_attr "prefix" "maybe_evex")
12357 (set_attr "mode" "OI")])
12359 (define_insn "vec_interleave_highv8hi<mask_name>"
12360 [(set (match_operand:V8HI 0 "register_operand" "=x,v")
12363 (match_operand:V8HI 1 "register_operand" "0,v")
12364 (match_operand:V8HI 2 "vector_operand" "xBm,vm"))
12365 (parallel [(const_int 4) (const_int 12)
12366 (const_int 5) (const_int 13)
12367 (const_int 6) (const_int 14)
12368 (const_int 7) (const_int 15)])))]
12369 "TARGET_SSE2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12371 punpckhwd\t{%2, %0|%0, %2}
12372 vpunpckhwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12373 [(set_attr "isa" "noavx,avx")
12374 (set_attr "type" "sselog")
12375 (set_attr "prefix_data16" "1,*")
12376 (set_attr "prefix" "orig,maybe_vex")
12377 (set_attr "mode" "TI")])
12379 (define_insn "<mask_codefor>avx512bw_interleave_lowv32hi<mask_name>"
12380 [(set (match_operand:V32HI 0 "register_operand" "=v")
12383 (match_operand:V32HI 1 "register_operand" "v")
12384 (match_operand:V32HI 2 "nonimmediate_operand" "vm"))
12385 (parallel [(const_int 0) (const_int 32)
12386 (const_int 1) (const_int 33)
12387 (const_int 2) (const_int 34)
12388 (const_int 3) (const_int 35)
12389 (const_int 8) (const_int 40)
12390 (const_int 9) (const_int 41)
12391 (const_int 10) (const_int 42)
12392 (const_int 11) (const_int 43)
12393 (const_int 16) (const_int 48)
12394 (const_int 17) (const_int 49)
12395 (const_int 18) (const_int 50)
12396 (const_int 19) (const_int 51)
12397 (const_int 24) (const_int 56)
12398 (const_int 25) (const_int 57)
12399 (const_int 26) (const_int 58)
12400 (const_int 27) (const_int 59)])))]
12402 "vpunpcklwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12403 [(set_attr "type" "sselog")
12404 (set_attr "prefix" "evex")
12405 (set_attr "mode" "XI")])
12407 (define_insn "avx2_interleave_lowv16hi<mask_name>"
12408 [(set (match_operand:V16HI 0 "register_operand" "=v")
12411 (match_operand:V16HI 1 "register_operand" "v")
12412 (match_operand:V16HI 2 "nonimmediate_operand" "vm"))
12413 (parallel [(const_int 0) (const_int 16)
12414 (const_int 1) (const_int 17)
12415 (const_int 2) (const_int 18)
12416 (const_int 3) (const_int 19)
12417 (const_int 8) (const_int 24)
12418 (const_int 9) (const_int 25)
12419 (const_int 10) (const_int 26)
12420 (const_int 11) (const_int 27)])))]
12421 "TARGET_AVX2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12422 "vpunpcklwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12423 [(set_attr "type" "sselog")
12424 (set_attr "prefix" "maybe_evex")
12425 (set_attr "mode" "OI")])
12427 (define_insn "vec_interleave_lowv8hi<mask_name>"
12428 [(set (match_operand:V8HI 0 "register_operand" "=x,v")
12431 (match_operand:V8HI 1 "register_operand" "0,v")
12432 (match_operand:V8HI 2 "vector_operand" "xBm,vm"))
12433 (parallel [(const_int 0) (const_int 8)
12434 (const_int 1) (const_int 9)
12435 (const_int 2) (const_int 10)
12436 (const_int 3) (const_int 11)])))]
12437 "TARGET_SSE2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12439 punpcklwd\t{%2, %0|%0, %2}
12440 vpunpcklwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12441 [(set_attr "isa" "noavx,avx")
12442 (set_attr "type" "sselog")
12443 (set_attr "prefix_data16" "1,*")
12444 (set_attr "prefix" "orig,maybe_evex")
12445 (set_attr "mode" "TI")])
12447 (define_insn "avx2_interleave_highv8si<mask_name>"
12448 [(set (match_operand:V8SI 0 "register_operand" "=v")
12451 (match_operand:V8SI 1 "register_operand" "v")
12452 (match_operand:V8SI 2 "nonimmediate_operand" "vm"))
12453 (parallel [(const_int 2) (const_int 10)
12454 (const_int 3) (const_int 11)
12455 (const_int 6) (const_int 14)
12456 (const_int 7) (const_int 15)])))]
12457 "TARGET_AVX2 && <mask_avx512vl_condition>"
12458 "vpunpckhdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12459 [(set_attr "type" "sselog")
12460 (set_attr "prefix" "maybe_evex")
12461 (set_attr "mode" "OI")])
12463 (define_insn "<mask_codefor>avx512f_interleave_highv16si<mask_name>"
12464 [(set (match_operand:V16SI 0 "register_operand" "=v")
12467 (match_operand:V16SI 1 "register_operand" "v")
12468 (match_operand:V16SI 2 "nonimmediate_operand" "vm"))
12469 (parallel [(const_int 2) (const_int 18)
12470 (const_int 3) (const_int 19)
12471 (const_int 6) (const_int 22)
12472 (const_int 7) (const_int 23)
12473 (const_int 10) (const_int 26)
12474 (const_int 11) (const_int 27)
12475 (const_int 14) (const_int 30)
12476 (const_int 15) (const_int 31)])))]
12478 "vpunpckhdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12479 [(set_attr "type" "sselog")
12480 (set_attr "prefix" "evex")
12481 (set_attr "mode" "XI")])
12484 (define_insn "vec_interleave_highv4si<mask_name>"
12485 [(set (match_operand:V4SI 0 "register_operand" "=x,v")
12488 (match_operand:V4SI 1 "register_operand" "0,v")
12489 (match_operand:V4SI 2 "vector_operand" "xBm,vm"))
12490 (parallel [(const_int 2) (const_int 6)
12491 (const_int 3) (const_int 7)])))]
12492 "TARGET_SSE2 && <mask_avx512vl_condition>"
12494 punpckhdq\t{%2, %0|%0, %2}
12495 vpunpckhdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12496 [(set_attr "isa" "noavx,avx")
12497 (set_attr "type" "sselog")
12498 (set_attr "prefix_data16" "1,*")
12499 (set_attr "prefix" "orig,maybe_vex")
12500 (set_attr "mode" "TI")])
12502 (define_insn "avx2_interleave_lowv8si<mask_name>"
12503 [(set (match_operand:V8SI 0 "register_operand" "=v")
12506 (match_operand:V8SI 1 "register_operand" "v")
12507 (match_operand:V8SI 2 "nonimmediate_operand" "vm"))
12508 (parallel [(const_int 0) (const_int 8)
12509 (const_int 1) (const_int 9)
12510 (const_int 4) (const_int 12)
12511 (const_int 5) (const_int 13)])))]
12512 "TARGET_AVX2 && <mask_avx512vl_condition>"
12513 "vpunpckldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12514 [(set_attr "type" "sselog")
12515 (set_attr "prefix" "maybe_evex")
12516 (set_attr "mode" "OI")])
12518 (define_insn "<mask_codefor>avx512f_interleave_lowv16si<mask_name>"
12519 [(set (match_operand:V16SI 0 "register_operand" "=v")
12522 (match_operand:V16SI 1 "register_operand" "v")
12523 (match_operand:V16SI 2 "nonimmediate_operand" "vm"))
12524 (parallel [(const_int 0) (const_int 16)
12525 (const_int 1) (const_int 17)
12526 (const_int 4) (const_int 20)
12527 (const_int 5) (const_int 21)
12528 (const_int 8) (const_int 24)
12529 (const_int 9) (const_int 25)
12530 (const_int 12) (const_int 28)
12531 (const_int 13) (const_int 29)])))]
12533 "vpunpckldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12534 [(set_attr "type" "sselog")
12535 (set_attr "prefix" "evex")
12536 (set_attr "mode" "XI")])
12538 (define_insn "vec_interleave_lowv4si<mask_name>"
12539 [(set (match_operand:V4SI 0 "register_operand" "=x,v")
12542 (match_operand:V4SI 1 "register_operand" "0,v")
12543 (match_operand:V4SI 2 "vector_operand" "xBm,vm"))
12544 (parallel [(const_int 0) (const_int 4)
12545 (const_int 1) (const_int 5)])))]
12546 "TARGET_SSE2 && <mask_avx512vl_condition>"
12548 punpckldq\t{%2, %0|%0, %2}
12549 vpunpckldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12550 [(set_attr "isa" "noavx,avx")
12551 (set_attr "type" "sselog")
12552 (set_attr "prefix_data16" "1,*")
12553 (set_attr "prefix" "orig,vex")
12554 (set_attr "mode" "TI")])
12556 (define_expand "vec_interleave_high<mode>"
12557 [(match_operand:VI_256 0 "register_operand")
12558 (match_operand:VI_256 1 "register_operand")
12559 (match_operand:VI_256 2 "nonimmediate_operand")]
12562 rtx t1 = gen_reg_rtx (<MODE>mode);
12563 rtx t2 = gen_reg_rtx (<MODE>mode);
12564 rtx t3 = gen_reg_rtx (V4DImode);
12565 emit_insn (gen_avx2_interleave_low<mode> (t1, operands[1], operands[2]));
12566 emit_insn (gen_avx2_interleave_high<mode> (t2, operands[1], operands[2]));
12567 emit_insn (gen_avx2_permv2ti (t3, gen_lowpart (V4DImode, t1),
12568 gen_lowpart (V4DImode, t2),
12569 GEN_INT (1 + (3 << 4))));
12570 emit_move_insn (operands[0], gen_lowpart (<MODE>mode, t3));
12574 (define_expand "vec_interleave_low<mode>"
12575 [(match_operand:VI_256 0 "register_operand")
12576 (match_operand:VI_256 1 "register_operand")
12577 (match_operand:VI_256 2 "nonimmediate_operand")]
12580 rtx t1 = gen_reg_rtx (<MODE>mode);
12581 rtx t2 = gen_reg_rtx (<MODE>mode);
12582 rtx t3 = gen_reg_rtx (V4DImode);
12583 emit_insn (gen_avx2_interleave_low<mode> (t1, operands[1], operands[2]));
12584 emit_insn (gen_avx2_interleave_high<mode> (t2, operands[1], operands[2]));
12585 emit_insn (gen_avx2_permv2ti (t3, gen_lowpart (V4DImode, t1),
12586 gen_lowpart (V4DImode, t2),
12587 GEN_INT (0 + (2 << 4))));
12588 emit_move_insn (operands[0], gen_lowpart (<MODE>mode, t3));
12592 ;; Modes handled by pinsr patterns.
12593 (define_mode_iterator PINSR_MODE
12594 [(V16QI "TARGET_SSE4_1") V8HI
12595 (V4SI "TARGET_SSE4_1")
12596 (V2DI "TARGET_SSE4_1 && TARGET_64BIT")])
12598 (define_mode_attr sse2p4_1
12599 [(V16QI "sse4_1") (V8HI "sse2")
12600 (V4SI "sse4_1") (V2DI "sse4_1")])
12602 (define_mode_attr pinsr_evex_isa
12603 [(V16QI "avx512bw") (V8HI "avx512bw")
12604 (V4SI "avx512dq") (V2DI "avx512dq")])
12606 ;; sse4_1_pinsrd must come before sse2_loadld since it is preferred.
12607 (define_insn "<sse2p4_1>_pinsr<ssemodesuffix>"
12608 [(set (match_operand:PINSR_MODE 0 "register_operand" "=x,x,x,x,v,v")
12609 (vec_merge:PINSR_MODE
12610 (vec_duplicate:PINSR_MODE
12611 (match_operand:<ssescalarmode> 2 "nonimmediate_operand" "r,m,r,m,r,m"))
12612 (match_operand:PINSR_MODE 1 "register_operand" "0,0,x,x,v,v")
12613 (match_operand:SI 3 "const_int_operand")))]
12615 && ((unsigned) exact_log2 (INTVAL (operands[3]))
12616 < GET_MODE_NUNITS (<MODE>mode))"
12618 operands[3] = GEN_INT (exact_log2 (INTVAL (operands[3])));
12620 switch (which_alternative)
12623 if (GET_MODE_SIZE (<ssescalarmode>mode) < GET_MODE_SIZE (SImode))
12624 return "pinsr<ssemodesuffix>\t{%3, %k2, %0|%0, %k2, %3}";
12627 return "pinsr<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}";
12630 if (GET_MODE_SIZE (<ssescalarmode>mode) < GET_MODE_SIZE (SImode))
12631 return "vpinsr<ssemodesuffix>\t{%3, %k2, %1, %0|%0, %1, %k2, %3}";
12635 return "vpinsr<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}";
12637 gcc_unreachable ();
12640 [(set_attr "isa" "noavx,noavx,avx,avx,<pinsr_evex_isa>,<pinsr_evex_isa>")
12641 (set_attr "type" "sselog")
12642 (set (attr "prefix_rex")
12644 (and (not (match_test "TARGET_AVX"))
12645 (eq (const_string "<MODE>mode") (const_string "V2DImode")))
12647 (const_string "*")))
12648 (set (attr "prefix_data16")
12650 (and (not (match_test "TARGET_AVX"))
12651 (eq (const_string "<MODE>mode") (const_string "V8HImode")))
12653 (const_string "*")))
12654 (set (attr "prefix_extra")
12656 (and (not (match_test "TARGET_AVX"))
12657 (eq (const_string "<MODE>mode") (const_string "V8HImode")))
12659 (const_string "1")))
12660 (set_attr "length_immediate" "1")
12661 (set_attr "prefix" "orig,orig,vex,vex,evex,evex")
12662 (set_attr "mode" "TI")])
12664 (define_expand "<extract_type>_vinsert<shuffletype><extract_suf>_mask"
12665 [(match_operand:AVX512_VEC 0 "register_operand")
12666 (match_operand:AVX512_VEC 1 "register_operand")
12667 (match_operand:<ssequartermode> 2 "nonimmediate_operand")
12668 (match_operand:SI 3 "const_0_to_3_operand")
12669 (match_operand:AVX512_VEC 4 "register_operand")
12670 (match_operand:<avx512fmaskmode> 5 "register_operand")]
12673 int mask, selector;
12674 mask = INTVAL (operands[3]);
12675 selector = (GET_MODE_UNIT_SIZE (<MODE>mode) == 4
12676 ? 0xFFFF ^ (0x000F << mask * 4)
12677 : 0xFF ^ (0x03 << mask * 2));
12678 emit_insn (gen_<extract_type>_vinsert<shuffletype><extract_suf>_1_mask
12679 (operands[0], operands[1], operands[2], GEN_INT (selector),
12680 operands[4], operands[5]));
12684 (define_insn "*<extract_type>_vinsert<shuffletype><extract_suf>_0"
12685 [(set (match_operand:AVX512_VEC 0 "register_operand" "=v,x,Yv")
12686 (vec_merge:AVX512_VEC
12687 (match_operand:AVX512_VEC 1 "reg_or_0_operand" "v,C,C")
12688 (vec_duplicate:AVX512_VEC
12689 (match_operand:<ssequartermode> 2 "nonimmediate_operand" "vm,xm,vm"))
12690 (match_operand:SI 3 "const_int_operand" "n,n,n")))]
12692 && (INTVAL (operands[3])
12693 == (GET_MODE_UNIT_SIZE (<MODE>mode) == 4 ? 0xFFF0 : 0xFC))"
12695 if (which_alternative == 0)
12696 return "vinsert<shuffletype><extract_suf>\t{$0, %2, %1, %0|%0, %1, %2, 0}";
12697 switch (<MODE>mode)
12700 return "vmovapd\t{%2, %x0|%x0, %2}";
12702 return "vmovaps\t{%2, %x0|%x0, %2}";
12704 return which_alternative == 2 ? "vmovdqa64\t{%2, %x0|%x0, %2}"
12705 : "vmovdqa\t{%2, %x0|%x0, %2}";
12707 return which_alternative == 2 ? "vmovdqa32\t{%2, %x0|%x0, %2}"
12708 : "vmovdqa\t{%2, %x0|%x0, %2}";
12710 gcc_unreachable ();
12713 [(set_attr "type" "sselog,ssemov,ssemov")
12714 (set_attr "length_immediate" "1,0,0")
12715 (set_attr "prefix" "evex,vex,evex")
12716 (set_attr "mode" "<sseinsnmode>,<ssequarterinsnmode>,<ssequarterinsnmode>")])
12718 (define_insn "<mask_codefor><extract_type>_vinsert<shuffletype><extract_suf>_1<mask_name>"
12719 [(set (match_operand:AVX512_VEC 0 "register_operand" "=v")
12720 (vec_merge:AVX512_VEC
12721 (match_operand:AVX512_VEC 1 "register_operand" "v")
12722 (vec_duplicate:AVX512_VEC
12723 (match_operand:<ssequartermode> 2 "nonimmediate_operand" "vm"))
12724 (match_operand:SI 3 "const_int_operand" "n")))]
12728 int selector = INTVAL (operands[3]);
12730 if (selector == (GET_MODE_UNIT_SIZE (<MODE>mode) == 4 ? 0xFFF0 : 0xFC))
12732 else if (selector == (GET_MODE_UNIT_SIZE (<MODE>mode) == 4 ? 0xFF0F : 0xF3))
12734 else if (selector == (GET_MODE_UNIT_SIZE (<MODE>mode) == 4 ? 0xF0FF : 0xCF))
12736 else if (selector == (GET_MODE_UNIT_SIZE (<MODE>mode) == 4 ? 0x0FFF : 0x3F))
12739 gcc_unreachable ();
12741 operands[3] = GEN_INT (mask);
12743 return "vinsert<shuffletype><extract_suf>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3}";
12745 [(set_attr "type" "sselog")
12746 (set_attr "length_immediate" "1")
12747 (set_attr "prefix" "evex")
12748 (set_attr "mode" "<sseinsnmode>")])
12750 (define_expand "<extract_type_2>_vinsert<shuffletype><extract_suf_2>_mask"
12751 [(match_operand:AVX512_VEC_2 0 "register_operand")
12752 (match_operand:AVX512_VEC_2 1 "register_operand")
12753 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand")
12754 (match_operand:SI 3 "const_0_to_1_operand")
12755 (match_operand:AVX512_VEC_2 4 "register_operand")
12756 (match_operand:<avx512fmaskmode> 5 "register_operand")]
12759 int mask = INTVAL (operands[3]);
12761 emit_insn (gen_vec_set_lo_<mode>_mask (operands[0], operands[1],
12762 operands[2], operands[4],
12765 emit_insn (gen_vec_set_hi_<mode>_mask (operands[0], operands[1],
12766 operands[2], operands[4],
12771 (define_insn "vec_set_lo_<mode><mask_name>"
12772 [(set (match_operand:V16FI 0 "register_operand" "=v")
12774 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
12775 (vec_select:<ssehalfvecmode>
12776 (match_operand:V16FI 1 "register_operand" "v")
12777 (parallel [(const_int 8) (const_int 9)
12778 (const_int 10) (const_int 11)
12779 (const_int 12) (const_int 13)
12780 (const_int 14) (const_int 15)]))))]
12782 "vinsert<shuffletype>32x8\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}"
12783 [(set_attr "type" "sselog")
12784 (set_attr "length_immediate" "1")
12785 (set_attr "prefix" "evex")
12786 (set_attr "mode" "<sseinsnmode>")])
12788 (define_insn "vec_set_hi_<mode><mask_name>"
12789 [(set (match_operand:V16FI 0 "register_operand" "=v")
12791 (vec_select:<ssehalfvecmode>
12792 (match_operand:V16FI 1 "register_operand" "v")
12793 (parallel [(const_int 0) (const_int 1)
12794 (const_int 2) (const_int 3)
12795 (const_int 4) (const_int 5)
12796 (const_int 6) (const_int 7)]))
12797 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
12799 "vinsert<shuffletype>32x8\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}"
12800 [(set_attr "type" "sselog")
12801 (set_attr "length_immediate" "1")
12802 (set_attr "prefix" "evex")
12803 (set_attr "mode" "<sseinsnmode>")])
12805 (define_insn "vec_set_lo_<mode><mask_name>"
12806 [(set (match_operand:V8FI 0 "register_operand" "=v")
12808 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
12809 (vec_select:<ssehalfvecmode>
12810 (match_operand:V8FI 1 "register_operand" "v")
12811 (parallel [(const_int 4) (const_int 5)
12812 (const_int 6) (const_int 7)]))))]
12814 "vinsert<shuffletype>64x4\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}"
12815 [(set_attr "type" "sselog")
12816 (set_attr "length_immediate" "1")
12817 (set_attr "prefix" "evex")
12818 (set_attr "mode" "XI")])
12820 (define_insn "vec_set_hi_<mode><mask_name>"
12821 [(set (match_operand:V8FI 0 "register_operand" "=v")
12823 (vec_select:<ssehalfvecmode>
12824 (match_operand:V8FI 1 "register_operand" "v")
12825 (parallel [(const_int 0) (const_int 1)
12826 (const_int 2) (const_int 3)]))
12827 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
12829 "vinsert<shuffletype>64x4\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}"
12830 [(set_attr "type" "sselog")
12831 (set_attr "length_immediate" "1")
12832 (set_attr "prefix" "evex")
12833 (set_attr "mode" "XI")])
12835 (define_expand "avx512dq_shuf_<shuffletype>64x2_mask"
12836 [(match_operand:VI8F_256 0 "register_operand")
12837 (match_operand:VI8F_256 1 "register_operand")
12838 (match_operand:VI8F_256 2 "nonimmediate_operand")
12839 (match_operand:SI 3 "const_0_to_3_operand")
12840 (match_operand:VI8F_256 4 "register_operand")
12841 (match_operand:QI 5 "register_operand")]
12844 int mask = INTVAL (operands[3]);
12845 emit_insn (gen_avx512dq_shuf_<shuffletype>64x2_1_mask
12846 (operands[0], operands[1], operands[2],
12847 GEN_INT (((mask >> 0) & 1) * 2 + 0),
12848 GEN_INT (((mask >> 0) & 1) * 2 + 1),
12849 GEN_INT (((mask >> 1) & 1) * 2 + 4),
12850 GEN_INT (((mask >> 1) & 1) * 2 + 5),
12851 operands[4], operands[5]));
12855 (define_insn "<mask_codefor>avx512dq_shuf_<shuffletype>64x2_1<mask_name>"
12856 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
12857 (vec_select:VI8F_256
12858 (vec_concat:<ssedoublemode>
12859 (match_operand:VI8F_256 1 "register_operand" "v")
12860 (match_operand:VI8F_256 2 "nonimmediate_operand" "vm"))
12861 (parallel [(match_operand 3 "const_0_to_3_operand")
12862 (match_operand 4 "const_0_to_3_operand")
12863 (match_operand 5 "const_4_to_7_operand")
12864 (match_operand 6 "const_4_to_7_operand")])))]
12866 && (INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
12867 && INTVAL (operands[5]) == (INTVAL (operands[6]) - 1))"
12870 mask = INTVAL (operands[3]) / 2;
12871 mask |= (INTVAL (operands[5]) - 4) / 2 << 1;
12872 operands[3] = GEN_INT (mask);
12873 return "vshuf<shuffletype>64x2\t{%3, %2, %1, %0<mask_operand7>|%0<mask_operand7>, %1, %2, %3}";
12875 [(set_attr "type" "sselog")
12876 (set_attr "length_immediate" "1")
12877 (set_attr "prefix" "evex")
12878 (set_attr "mode" "XI")])
12880 (define_expand "avx512f_shuf_<shuffletype>64x2_mask"
12881 [(match_operand:V8FI 0 "register_operand")
12882 (match_operand:V8FI 1 "register_operand")
12883 (match_operand:V8FI 2 "nonimmediate_operand")
12884 (match_operand:SI 3 "const_0_to_255_operand")
12885 (match_operand:V8FI 4 "register_operand")
12886 (match_operand:QI 5 "register_operand")]
12889 int mask = INTVAL (operands[3]);
12890 emit_insn (gen_avx512f_shuf_<shuffletype>64x2_1_mask
12891 (operands[0], operands[1], operands[2],
12892 GEN_INT (((mask >> 0) & 3) * 2),
12893 GEN_INT (((mask >> 0) & 3) * 2 + 1),
12894 GEN_INT (((mask >> 2) & 3) * 2),
12895 GEN_INT (((mask >> 2) & 3) * 2 + 1),
12896 GEN_INT (((mask >> 4) & 3) * 2 + 8),
12897 GEN_INT (((mask >> 4) & 3) * 2 + 9),
12898 GEN_INT (((mask >> 6) & 3) * 2 + 8),
12899 GEN_INT (((mask >> 6) & 3) * 2 + 9),
12900 operands[4], operands[5]));
12904 (define_insn "avx512f_shuf_<shuffletype>64x2_1<mask_name>"
12905 [(set (match_operand:V8FI 0 "register_operand" "=v")
12907 (vec_concat:<ssedoublemode>
12908 (match_operand:V8FI 1 "register_operand" "v")
12909 (match_operand:V8FI 2 "nonimmediate_operand" "vm"))
12910 (parallel [(match_operand 3 "const_0_to_7_operand")
12911 (match_operand 4 "const_0_to_7_operand")
12912 (match_operand 5 "const_0_to_7_operand")
12913 (match_operand 6 "const_0_to_7_operand")
12914 (match_operand 7 "const_8_to_15_operand")
12915 (match_operand 8 "const_8_to_15_operand")
12916 (match_operand 9 "const_8_to_15_operand")
12917 (match_operand 10 "const_8_to_15_operand")])))]
12919 && (INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
12920 && INTVAL (operands[5]) == (INTVAL (operands[6]) - 1)
12921 && INTVAL (operands[7]) == (INTVAL (operands[8]) - 1)
12922 && INTVAL (operands[9]) == (INTVAL (operands[10]) - 1))"
12925 mask = INTVAL (operands[3]) / 2;
12926 mask |= INTVAL (operands[5]) / 2 << 2;
12927 mask |= (INTVAL (operands[7]) - 8) / 2 << 4;
12928 mask |= (INTVAL (operands[9]) - 8) / 2 << 6;
12929 operands[3] = GEN_INT (mask);
12931 return "vshuf<shuffletype>64x2\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
12933 [(set_attr "type" "sselog")
12934 (set_attr "length_immediate" "1")
12935 (set_attr "prefix" "evex")
12936 (set_attr "mode" "<sseinsnmode>")])
12938 (define_expand "avx512vl_shuf_<shuffletype>32x4_mask"
12939 [(match_operand:VI4F_256 0 "register_operand")
12940 (match_operand:VI4F_256 1 "register_operand")
12941 (match_operand:VI4F_256 2 "nonimmediate_operand")
12942 (match_operand:SI 3 "const_0_to_3_operand")
12943 (match_operand:VI4F_256 4 "register_operand")
12944 (match_operand:QI 5 "register_operand")]
12947 int mask = INTVAL (operands[3]);
12948 emit_insn (gen_avx512vl_shuf_<shuffletype>32x4_1_mask
12949 (operands[0], operands[1], operands[2],
12950 GEN_INT (((mask >> 0) & 1) * 4 + 0),
12951 GEN_INT (((mask >> 0) & 1) * 4 + 1),
12952 GEN_INT (((mask >> 0) & 1) * 4 + 2),
12953 GEN_INT (((mask >> 0) & 1) * 4 + 3),
12954 GEN_INT (((mask >> 1) & 1) * 4 + 8),
12955 GEN_INT (((mask >> 1) & 1) * 4 + 9),
12956 GEN_INT (((mask >> 1) & 1) * 4 + 10),
12957 GEN_INT (((mask >> 1) & 1) * 4 + 11),
12958 operands[4], operands[5]));
12962 (define_insn "avx512vl_shuf_<shuffletype>32x4_1<mask_name>"
12963 [(set (match_operand:VI4F_256 0 "register_operand" "=v")
12964 (vec_select:VI4F_256
12965 (vec_concat:<ssedoublemode>
12966 (match_operand:VI4F_256 1 "register_operand" "v")
12967 (match_operand:VI4F_256 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[3]) == (INTVAL (operands[5]) - 2)
12979 && INTVAL (operands[3]) == (INTVAL (operands[6]) - 3)
12980 && INTVAL (operands[7]) == (INTVAL (operands[8]) - 1)
12981 && INTVAL (operands[7]) == (INTVAL (operands[9]) - 2)
12982 && INTVAL (operands[7]) == (INTVAL (operands[10]) - 3))"
12985 mask = INTVAL (operands[3]) / 4;
12986 mask |= (INTVAL (operands[7]) - 8) / 4 << 1;
12987 operands[3] = GEN_INT (mask);
12989 return "vshuf<shuffletype>32x4\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 "avx512f_shuf_<shuffletype>32x4_mask"
12997 [(match_operand:V16FI 0 "register_operand")
12998 (match_operand:V16FI 1 "register_operand")
12999 (match_operand:V16FI 2 "nonimmediate_operand")
13000 (match_operand:SI 3 "const_0_to_255_operand")
13001 (match_operand:V16FI 4 "register_operand")
13002 (match_operand:HI 5 "register_operand")]
13005 int mask = INTVAL (operands[3]);
13006 emit_insn (gen_avx512f_shuf_<shuffletype>32x4_1_mask
13007 (operands[0], operands[1], operands[2],
13008 GEN_INT (((mask >> 0) & 3) * 4),
13009 GEN_INT (((mask >> 0) & 3) * 4 + 1),
13010 GEN_INT (((mask >> 0) & 3) * 4 + 2),
13011 GEN_INT (((mask >> 0) & 3) * 4 + 3),
13012 GEN_INT (((mask >> 2) & 3) * 4),
13013 GEN_INT (((mask >> 2) & 3) * 4 + 1),
13014 GEN_INT (((mask >> 2) & 3) * 4 + 2),
13015 GEN_INT (((mask >> 2) & 3) * 4 + 3),
13016 GEN_INT (((mask >> 4) & 3) * 4 + 16),
13017 GEN_INT (((mask >> 4) & 3) * 4 + 17),
13018 GEN_INT (((mask >> 4) & 3) * 4 + 18),
13019 GEN_INT (((mask >> 4) & 3) * 4 + 19),
13020 GEN_INT (((mask >> 6) & 3) * 4 + 16),
13021 GEN_INT (((mask >> 6) & 3) * 4 + 17),
13022 GEN_INT (((mask >> 6) & 3) * 4 + 18),
13023 GEN_INT (((mask >> 6) & 3) * 4 + 19),
13024 operands[4], operands[5]));
13028 (define_insn "avx512f_shuf_<shuffletype>32x4_1<mask_name>"
13029 [(set (match_operand:V16FI 0 "register_operand" "=v")
13031 (vec_concat:<ssedoublemode>
13032 (match_operand:V16FI 1 "register_operand" "v")
13033 (match_operand:V16FI 2 "nonimmediate_operand" "vm"))
13034 (parallel [(match_operand 3 "const_0_to_15_operand")
13035 (match_operand 4 "const_0_to_15_operand")
13036 (match_operand 5 "const_0_to_15_operand")
13037 (match_operand 6 "const_0_to_15_operand")
13038 (match_operand 7 "const_0_to_15_operand")
13039 (match_operand 8 "const_0_to_15_operand")
13040 (match_operand 9 "const_0_to_15_operand")
13041 (match_operand 10 "const_0_to_15_operand")
13042 (match_operand 11 "const_16_to_31_operand")
13043 (match_operand 12 "const_16_to_31_operand")
13044 (match_operand 13 "const_16_to_31_operand")
13045 (match_operand 14 "const_16_to_31_operand")
13046 (match_operand 15 "const_16_to_31_operand")
13047 (match_operand 16 "const_16_to_31_operand")
13048 (match_operand 17 "const_16_to_31_operand")
13049 (match_operand 18 "const_16_to_31_operand")])))]
13051 && (INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
13052 && INTVAL (operands[3]) == (INTVAL (operands[5]) - 2)
13053 && INTVAL (operands[3]) == (INTVAL (operands[6]) - 3)
13054 && INTVAL (operands[7]) == (INTVAL (operands[8]) - 1)
13055 && INTVAL (operands[7]) == (INTVAL (operands[9]) - 2)
13056 && INTVAL (operands[7]) == (INTVAL (operands[10]) - 3)
13057 && INTVAL (operands[11]) == (INTVAL (operands[12]) - 1)
13058 && INTVAL (operands[11]) == (INTVAL (operands[13]) - 2)
13059 && INTVAL (operands[11]) == (INTVAL (operands[14]) - 3)
13060 && INTVAL (operands[15]) == (INTVAL (operands[16]) - 1)
13061 && INTVAL (operands[15]) == (INTVAL (operands[17]) - 2)
13062 && INTVAL (operands[15]) == (INTVAL (operands[18]) - 3))"
13065 mask = INTVAL (operands[3]) / 4;
13066 mask |= INTVAL (operands[7]) / 4 << 2;
13067 mask |= (INTVAL (operands[11]) - 16) / 4 << 4;
13068 mask |= (INTVAL (operands[15]) - 16) / 4 << 6;
13069 operands[3] = GEN_INT (mask);
13071 return "vshuf<shuffletype>32x4\t{%3, %2, %1, %0<mask_operand19>|%0<mask_operand19>, %1, %2, %3}";
13073 [(set_attr "type" "sselog")
13074 (set_attr "length_immediate" "1")
13075 (set_attr "prefix" "evex")
13076 (set_attr "mode" "<sseinsnmode>")])
13078 (define_expand "avx512f_pshufdv3_mask"
13079 [(match_operand:V16SI 0 "register_operand")
13080 (match_operand:V16SI 1 "nonimmediate_operand")
13081 (match_operand:SI 2 "const_0_to_255_operand")
13082 (match_operand:V16SI 3 "register_operand")
13083 (match_operand:HI 4 "register_operand")]
13086 int mask = INTVAL (operands[2]);
13087 emit_insn (gen_avx512f_pshufd_1_mask (operands[0], operands[1],
13088 GEN_INT ((mask >> 0) & 3),
13089 GEN_INT ((mask >> 2) & 3),
13090 GEN_INT ((mask >> 4) & 3),
13091 GEN_INT ((mask >> 6) & 3),
13092 GEN_INT (((mask >> 0) & 3) + 4),
13093 GEN_INT (((mask >> 2) & 3) + 4),
13094 GEN_INT (((mask >> 4) & 3) + 4),
13095 GEN_INT (((mask >> 6) & 3) + 4),
13096 GEN_INT (((mask >> 0) & 3) + 8),
13097 GEN_INT (((mask >> 2) & 3) + 8),
13098 GEN_INT (((mask >> 4) & 3) + 8),
13099 GEN_INT (((mask >> 6) & 3) + 8),
13100 GEN_INT (((mask >> 0) & 3) + 12),
13101 GEN_INT (((mask >> 2) & 3) + 12),
13102 GEN_INT (((mask >> 4) & 3) + 12),
13103 GEN_INT (((mask >> 6) & 3) + 12),
13104 operands[3], operands[4]));
13108 (define_insn "avx512f_pshufd_1<mask_name>"
13109 [(set (match_operand:V16SI 0 "register_operand" "=v")
13111 (match_operand:V16SI 1 "nonimmediate_operand" "vm")
13112 (parallel [(match_operand 2 "const_0_to_3_operand")
13113 (match_operand 3 "const_0_to_3_operand")
13114 (match_operand 4 "const_0_to_3_operand")
13115 (match_operand 5 "const_0_to_3_operand")
13116 (match_operand 6 "const_4_to_7_operand")
13117 (match_operand 7 "const_4_to_7_operand")
13118 (match_operand 8 "const_4_to_7_operand")
13119 (match_operand 9 "const_4_to_7_operand")
13120 (match_operand 10 "const_8_to_11_operand")
13121 (match_operand 11 "const_8_to_11_operand")
13122 (match_operand 12 "const_8_to_11_operand")
13123 (match_operand 13 "const_8_to_11_operand")
13124 (match_operand 14 "const_12_to_15_operand")
13125 (match_operand 15 "const_12_to_15_operand")
13126 (match_operand 16 "const_12_to_15_operand")
13127 (match_operand 17 "const_12_to_15_operand")])))]
13129 && INTVAL (operands[2]) + 4 == INTVAL (operands[6])
13130 && INTVAL (operands[3]) + 4 == INTVAL (operands[7])
13131 && INTVAL (operands[4]) + 4 == INTVAL (operands[8])
13132 && INTVAL (operands[5]) + 4 == INTVAL (operands[9])
13133 && INTVAL (operands[2]) + 8 == INTVAL (operands[10])
13134 && INTVAL (operands[3]) + 8 == INTVAL (operands[11])
13135 && INTVAL (operands[4]) + 8 == INTVAL (operands[12])
13136 && INTVAL (operands[5]) + 8 == INTVAL (operands[13])
13137 && INTVAL (operands[2]) + 12 == INTVAL (operands[14])
13138 && INTVAL (operands[3]) + 12 == INTVAL (operands[15])
13139 && INTVAL (operands[4]) + 12 == INTVAL (operands[16])
13140 && INTVAL (operands[5]) + 12 == INTVAL (operands[17])"
13143 mask |= INTVAL (operands[2]) << 0;
13144 mask |= INTVAL (operands[3]) << 2;
13145 mask |= INTVAL (operands[4]) << 4;
13146 mask |= INTVAL (operands[5]) << 6;
13147 operands[2] = GEN_INT (mask);
13149 return "vpshufd\t{%2, %1, %0<mask_operand18>|%0<mask_operand18>, %1, %2}";
13151 [(set_attr "type" "sselog1")
13152 (set_attr "prefix" "evex")
13153 (set_attr "length_immediate" "1")
13154 (set_attr "mode" "XI")])
13156 (define_expand "avx512vl_pshufdv3_mask"
13157 [(match_operand:V8SI 0 "register_operand")
13158 (match_operand:V8SI 1 "nonimmediate_operand")
13159 (match_operand:SI 2 "const_0_to_255_operand")
13160 (match_operand:V8SI 3 "register_operand")
13161 (match_operand:QI 4 "register_operand")]
13164 int mask = INTVAL (operands[2]);
13165 emit_insn (gen_avx2_pshufd_1_mask (operands[0], operands[1],
13166 GEN_INT ((mask >> 0) & 3),
13167 GEN_INT ((mask >> 2) & 3),
13168 GEN_INT ((mask >> 4) & 3),
13169 GEN_INT ((mask >> 6) & 3),
13170 GEN_INT (((mask >> 0) & 3) + 4),
13171 GEN_INT (((mask >> 2) & 3) + 4),
13172 GEN_INT (((mask >> 4) & 3) + 4),
13173 GEN_INT (((mask >> 6) & 3) + 4),
13174 operands[3], operands[4]));
13178 (define_expand "avx2_pshufdv3"
13179 [(match_operand:V8SI 0 "register_operand")
13180 (match_operand:V8SI 1 "nonimmediate_operand")
13181 (match_operand:SI 2 "const_0_to_255_operand")]
13184 int mask = INTVAL (operands[2]);
13185 emit_insn (gen_avx2_pshufd_1 (operands[0], operands[1],
13186 GEN_INT ((mask >> 0) & 3),
13187 GEN_INT ((mask >> 2) & 3),
13188 GEN_INT ((mask >> 4) & 3),
13189 GEN_INT ((mask >> 6) & 3),
13190 GEN_INT (((mask >> 0) & 3) + 4),
13191 GEN_INT (((mask >> 2) & 3) + 4),
13192 GEN_INT (((mask >> 4) & 3) + 4),
13193 GEN_INT (((mask >> 6) & 3) + 4)));
13197 (define_insn "avx2_pshufd_1<mask_name>"
13198 [(set (match_operand:V8SI 0 "register_operand" "=v")
13200 (match_operand:V8SI 1 "nonimmediate_operand" "vm")
13201 (parallel [(match_operand 2 "const_0_to_3_operand")
13202 (match_operand 3 "const_0_to_3_operand")
13203 (match_operand 4 "const_0_to_3_operand")
13204 (match_operand 5 "const_0_to_3_operand")
13205 (match_operand 6 "const_4_to_7_operand")
13206 (match_operand 7 "const_4_to_7_operand")
13207 (match_operand 8 "const_4_to_7_operand")
13208 (match_operand 9 "const_4_to_7_operand")])))]
13210 && <mask_avx512vl_condition>
13211 && INTVAL (operands[2]) + 4 == INTVAL (operands[6])
13212 && INTVAL (operands[3]) + 4 == INTVAL (operands[7])
13213 && INTVAL (operands[4]) + 4 == INTVAL (operands[8])
13214 && INTVAL (operands[5]) + 4 == INTVAL (operands[9])"
13217 mask |= INTVAL (operands[2]) << 0;
13218 mask |= INTVAL (operands[3]) << 2;
13219 mask |= INTVAL (operands[4]) << 4;
13220 mask |= INTVAL (operands[5]) << 6;
13221 operands[2] = GEN_INT (mask);
13223 return "vpshufd\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
13225 [(set_attr "type" "sselog1")
13226 (set_attr "prefix" "maybe_evex")
13227 (set_attr "length_immediate" "1")
13228 (set_attr "mode" "OI")])
13230 (define_expand "avx512vl_pshufd_mask"
13231 [(match_operand:V4SI 0 "register_operand")
13232 (match_operand:V4SI 1 "nonimmediate_operand")
13233 (match_operand:SI 2 "const_0_to_255_operand")
13234 (match_operand:V4SI 3 "register_operand")
13235 (match_operand:QI 4 "register_operand")]
13238 int mask = INTVAL (operands[2]);
13239 emit_insn (gen_sse2_pshufd_1_mask (operands[0], operands[1],
13240 GEN_INT ((mask >> 0) & 3),
13241 GEN_INT ((mask >> 2) & 3),
13242 GEN_INT ((mask >> 4) & 3),
13243 GEN_INT ((mask >> 6) & 3),
13244 operands[3], operands[4]));
13248 (define_expand "sse2_pshufd"
13249 [(match_operand:V4SI 0 "register_operand")
13250 (match_operand:V4SI 1 "vector_operand")
13251 (match_operand:SI 2 "const_int_operand")]
13254 int mask = INTVAL (operands[2]);
13255 emit_insn (gen_sse2_pshufd_1 (operands[0], operands[1],
13256 GEN_INT ((mask >> 0) & 3),
13257 GEN_INT ((mask >> 2) & 3),
13258 GEN_INT ((mask >> 4) & 3),
13259 GEN_INT ((mask >> 6) & 3)));
13263 (define_insn "sse2_pshufd_1<mask_name>"
13264 [(set (match_operand:V4SI 0 "register_operand" "=v")
13266 (match_operand:V4SI 1 "vector_operand" "vBm")
13267 (parallel [(match_operand 2 "const_0_to_3_operand")
13268 (match_operand 3 "const_0_to_3_operand")
13269 (match_operand 4 "const_0_to_3_operand")
13270 (match_operand 5 "const_0_to_3_operand")])))]
13271 "TARGET_SSE2 && <mask_avx512vl_condition>"
13274 mask |= INTVAL (operands[2]) << 0;
13275 mask |= INTVAL (operands[3]) << 2;
13276 mask |= INTVAL (operands[4]) << 4;
13277 mask |= INTVAL (operands[5]) << 6;
13278 operands[2] = GEN_INT (mask);
13280 return "%vpshufd\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
13282 [(set_attr "type" "sselog1")
13283 (set_attr "prefix_data16" "1")
13284 (set_attr "prefix" "<mask_prefix2>")
13285 (set_attr "length_immediate" "1")
13286 (set_attr "mode" "TI")])
13288 (define_insn "<mask_codefor>avx512bw_pshuflwv32hi<mask_name>"
13289 [(set (match_operand:V32HI 0 "register_operand" "=v")
13291 [(match_operand:V32HI 1 "nonimmediate_operand" "vm")
13292 (match_operand:SI 2 "const_0_to_255_operand" "n")]
13295 "vpshuflw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13296 [(set_attr "type" "sselog")
13297 (set_attr "prefix" "evex")
13298 (set_attr "mode" "XI")])
13300 (define_expand "avx512vl_pshuflwv3_mask"
13301 [(match_operand:V16HI 0 "register_operand")
13302 (match_operand:V16HI 1 "nonimmediate_operand")
13303 (match_operand:SI 2 "const_0_to_255_operand")
13304 (match_operand:V16HI 3 "register_operand")
13305 (match_operand:HI 4 "register_operand")]
13306 "TARGET_AVX512VL && TARGET_AVX512BW"
13308 int mask = INTVAL (operands[2]);
13309 emit_insn (gen_avx2_pshuflw_1_mask (operands[0], operands[1],
13310 GEN_INT ((mask >> 0) & 3),
13311 GEN_INT ((mask >> 2) & 3),
13312 GEN_INT ((mask >> 4) & 3),
13313 GEN_INT ((mask >> 6) & 3),
13314 GEN_INT (((mask >> 0) & 3) + 8),
13315 GEN_INT (((mask >> 2) & 3) + 8),
13316 GEN_INT (((mask >> 4) & 3) + 8),
13317 GEN_INT (((mask >> 6) & 3) + 8),
13318 operands[3], operands[4]));
13322 (define_expand "avx2_pshuflwv3"
13323 [(match_operand:V16HI 0 "register_operand")
13324 (match_operand:V16HI 1 "nonimmediate_operand")
13325 (match_operand:SI 2 "const_0_to_255_operand")]
13328 int mask = INTVAL (operands[2]);
13329 emit_insn (gen_avx2_pshuflw_1 (operands[0], operands[1],
13330 GEN_INT ((mask >> 0) & 3),
13331 GEN_INT ((mask >> 2) & 3),
13332 GEN_INT ((mask >> 4) & 3),
13333 GEN_INT ((mask >> 6) & 3),
13334 GEN_INT (((mask >> 0) & 3) + 8),
13335 GEN_INT (((mask >> 2) & 3) + 8),
13336 GEN_INT (((mask >> 4) & 3) + 8),
13337 GEN_INT (((mask >> 6) & 3) + 8)));
13341 (define_insn "avx2_pshuflw_1<mask_name>"
13342 [(set (match_operand:V16HI 0 "register_operand" "=v")
13344 (match_operand:V16HI 1 "nonimmediate_operand" "vm")
13345 (parallel [(match_operand 2 "const_0_to_3_operand")
13346 (match_operand 3 "const_0_to_3_operand")
13347 (match_operand 4 "const_0_to_3_operand")
13348 (match_operand 5 "const_0_to_3_operand")
13353 (match_operand 6 "const_8_to_11_operand")
13354 (match_operand 7 "const_8_to_11_operand")
13355 (match_operand 8 "const_8_to_11_operand")
13356 (match_operand 9 "const_8_to_11_operand")
13360 (const_int 15)])))]
13362 && <mask_avx512bw_condition> && <mask_avx512vl_condition>
13363 && INTVAL (operands[2]) + 8 == INTVAL (operands[6])
13364 && INTVAL (operands[3]) + 8 == INTVAL (operands[7])
13365 && INTVAL (operands[4]) + 8 == INTVAL (operands[8])
13366 && INTVAL (operands[5]) + 8 == INTVAL (operands[9])"
13369 mask |= INTVAL (operands[2]) << 0;
13370 mask |= INTVAL (operands[3]) << 2;
13371 mask |= INTVAL (operands[4]) << 4;
13372 mask |= INTVAL (operands[5]) << 6;
13373 operands[2] = GEN_INT (mask);
13375 return "vpshuflw\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
13377 [(set_attr "type" "sselog")
13378 (set_attr "prefix" "maybe_evex")
13379 (set_attr "length_immediate" "1")
13380 (set_attr "mode" "OI")])
13382 (define_expand "avx512vl_pshuflw_mask"
13383 [(match_operand:V8HI 0 "register_operand")
13384 (match_operand:V8HI 1 "nonimmediate_operand")
13385 (match_operand:SI 2 "const_0_to_255_operand")
13386 (match_operand:V8HI 3 "register_operand")
13387 (match_operand:QI 4 "register_operand")]
13388 "TARGET_AVX512VL && TARGET_AVX512BW"
13390 int mask = INTVAL (operands[2]);
13391 emit_insn (gen_sse2_pshuflw_1_mask (operands[0], operands[1],
13392 GEN_INT ((mask >> 0) & 3),
13393 GEN_INT ((mask >> 2) & 3),
13394 GEN_INT ((mask >> 4) & 3),
13395 GEN_INT ((mask >> 6) & 3),
13396 operands[3], operands[4]));
13400 (define_expand "sse2_pshuflw"
13401 [(match_operand:V8HI 0 "register_operand")
13402 (match_operand:V8HI 1 "vector_operand")
13403 (match_operand:SI 2 "const_int_operand")]
13406 int mask = INTVAL (operands[2]);
13407 emit_insn (gen_sse2_pshuflw_1 (operands[0], operands[1],
13408 GEN_INT ((mask >> 0) & 3),
13409 GEN_INT ((mask >> 2) & 3),
13410 GEN_INT ((mask >> 4) & 3),
13411 GEN_INT ((mask >> 6) & 3)));
13415 (define_insn "sse2_pshuflw_1<mask_name>"
13416 [(set (match_operand:V8HI 0 "register_operand" "=v")
13418 (match_operand:V8HI 1 "vector_operand" "vBm")
13419 (parallel [(match_operand 2 "const_0_to_3_operand")
13420 (match_operand 3 "const_0_to_3_operand")
13421 (match_operand 4 "const_0_to_3_operand")
13422 (match_operand 5 "const_0_to_3_operand")
13427 "TARGET_SSE2 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
13430 mask |= INTVAL (operands[2]) << 0;
13431 mask |= INTVAL (operands[3]) << 2;
13432 mask |= INTVAL (operands[4]) << 4;
13433 mask |= INTVAL (operands[5]) << 6;
13434 operands[2] = GEN_INT (mask);
13436 return "%vpshuflw\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
13438 [(set_attr "type" "sselog")
13439 (set_attr "prefix_data16" "0")
13440 (set_attr "prefix_rep" "1")
13441 (set_attr "prefix" "maybe_vex")
13442 (set_attr "length_immediate" "1")
13443 (set_attr "mode" "TI")])
13445 (define_expand "avx2_pshufhwv3"
13446 [(match_operand:V16HI 0 "register_operand")
13447 (match_operand:V16HI 1 "nonimmediate_operand")
13448 (match_operand:SI 2 "const_0_to_255_operand")]
13451 int mask = INTVAL (operands[2]);
13452 emit_insn (gen_avx2_pshufhw_1 (operands[0], operands[1],
13453 GEN_INT (((mask >> 0) & 3) + 4),
13454 GEN_INT (((mask >> 2) & 3) + 4),
13455 GEN_INT (((mask >> 4) & 3) + 4),
13456 GEN_INT (((mask >> 6) & 3) + 4),
13457 GEN_INT (((mask >> 0) & 3) + 12),
13458 GEN_INT (((mask >> 2) & 3) + 12),
13459 GEN_INT (((mask >> 4) & 3) + 12),
13460 GEN_INT (((mask >> 6) & 3) + 12)));
13464 (define_insn "<mask_codefor>avx512bw_pshufhwv32hi<mask_name>"
13465 [(set (match_operand:V32HI 0 "register_operand" "=v")
13467 [(match_operand:V32HI 1 "nonimmediate_operand" "vm")
13468 (match_operand:SI 2 "const_0_to_255_operand" "n")]
13471 "vpshufhw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13472 [(set_attr "type" "sselog")
13473 (set_attr "prefix" "evex")
13474 (set_attr "mode" "XI")])
13476 (define_expand "avx512vl_pshufhwv3_mask"
13477 [(match_operand:V16HI 0 "register_operand")
13478 (match_operand:V16HI 1 "nonimmediate_operand")
13479 (match_operand:SI 2 "const_0_to_255_operand")
13480 (match_operand:V16HI 3 "register_operand")
13481 (match_operand:HI 4 "register_operand")]
13482 "TARGET_AVX512VL && TARGET_AVX512BW"
13484 int mask = INTVAL (operands[2]);
13485 emit_insn (gen_avx2_pshufhw_1_mask (operands[0], operands[1],
13486 GEN_INT (((mask >> 0) & 3) + 4),
13487 GEN_INT (((mask >> 2) & 3) + 4),
13488 GEN_INT (((mask >> 4) & 3) + 4),
13489 GEN_INT (((mask >> 6) & 3) + 4),
13490 GEN_INT (((mask >> 0) & 3) + 12),
13491 GEN_INT (((mask >> 2) & 3) + 12),
13492 GEN_INT (((mask >> 4) & 3) + 12),
13493 GEN_INT (((mask >> 6) & 3) + 12),
13494 operands[3], operands[4]));
13498 (define_insn "avx2_pshufhw_1<mask_name>"
13499 [(set (match_operand:V16HI 0 "register_operand" "=v")
13501 (match_operand:V16HI 1 "nonimmediate_operand" "vm")
13502 (parallel [(const_int 0)
13506 (match_operand 2 "const_4_to_7_operand")
13507 (match_operand 3 "const_4_to_7_operand")
13508 (match_operand 4 "const_4_to_7_operand")
13509 (match_operand 5 "const_4_to_7_operand")
13514 (match_operand 6 "const_12_to_15_operand")
13515 (match_operand 7 "const_12_to_15_operand")
13516 (match_operand 8 "const_12_to_15_operand")
13517 (match_operand 9 "const_12_to_15_operand")])))]
13519 && <mask_avx512bw_condition> && <mask_avx512vl_condition>
13520 && INTVAL (operands[2]) + 8 == INTVAL (operands[6])
13521 && INTVAL (operands[3]) + 8 == INTVAL (operands[7])
13522 && INTVAL (operands[4]) + 8 == INTVAL (operands[8])
13523 && INTVAL (operands[5]) + 8 == INTVAL (operands[9])"
13526 mask |= (INTVAL (operands[2]) - 4) << 0;
13527 mask |= (INTVAL (operands[3]) - 4) << 2;
13528 mask |= (INTVAL (operands[4]) - 4) << 4;
13529 mask |= (INTVAL (operands[5]) - 4) << 6;
13530 operands[2] = GEN_INT (mask);
13532 return "vpshufhw\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
13534 [(set_attr "type" "sselog")
13535 (set_attr "prefix" "maybe_evex")
13536 (set_attr "length_immediate" "1")
13537 (set_attr "mode" "OI")])
13539 (define_expand "avx512vl_pshufhw_mask"
13540 [(match_operand:V8HI 0 "register_operand")
13541 (match_operand:V8HI 1 "nonimmediate_operand")
13542 (match_operand:SI 2 "const_0_to_255_operand")
13543 (match_operand:V8HI 3 "register_operand")
13544 (match_operand:QI 4 "register_operand")]
13545 "TARGET_AVX512VL && TARGET_AVX512BW"
13547 int mask = INTVAL (operands[2]);
13548 emit_insn (gen_sse2_pshufhw_1_mask (operands[0], operands[1],
13549 GEN_INT (((mask >> 0) & 3) + 4),
13550 GEN_INT (((mask >> 2) & 3) + 4),
13551 GEN_INT (((mask >> 4) & 3) + 4),
13552 GEN_INT (((mask >> 6) & 3) + 4),
13553 operands[3], operands[4]));
13557 (define_expand "sse2_pshufhw"
13558 [(match_operand:V8HI 0 "register_operand")
13559 (match_operand:V8HI 1 "vector_operand")
13560 (match_operand:SI 2 "const_int_operand")]
13563 int mask = INTVAL (operands[2]);
13564 emit_insn (gen_sse2_pshufhw_1 (operands[0], operands[1],
13565 GEN_INT (((mask >> 0) & 3) + 4),
13566 GEN_INT (((mask >> 2) & 3) + 4),
13567 GEN_INT (((mask >> 4) & 3) + 4),
13568 GEN_INT (((mask >> 6) & 3) + 4)));
13572 (define_insn "sse2_pshufhw_1<mask_name>"
13573 [(set (match_operand:V8HI 0 "register_operand" "=v")
13575 (match_operand:V8HI 1 "vector_operand" "vBm")
13576 (parallel [(const_int 0)
13580 (match_operand 2 "const_4_to_7_operand")
13581 (match_operand 3 "const_4_to_7_operand")
13582 (match_operand 4 "const_4_to_7_operand")
13583 (match_operand 5 "const_4_to_7_operand")])))]
13584 "TARGET_SSE2 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
13587 mask |= (INTVAL (operands[2]) - 4) << 0;
13588 mask |= (INTVAL (operands[3]) - 4) << 2;
13589 mask |= (INTVAL (operands[4]) - 4) << 4;
13590 mask |= (INTVAL (operands[5]) - 4) << 6;
13591 operands[2] = GEN_INT (mask);
13593 return "%vpshufhw\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
13595 [(set_attr "type" "sselog")
13596 (set_attr "prefix_rep" "1")
13597 (set_attr "prefix_data16" "0")
13598 (set_attr "prefix" "maybe_vex")
13599 (set_attr "length_immediate" "1")
13600 (set_attr "mode" "TI")])
13602 (define_expand "sse2_loadd"
13603 [(set (match_operand:V4SI 0 "register_operand")
13605 (vec_duplicate:V4SI
13606 (match_operand:SI 1 "nonimmediate_operand"))
13610 "operands[2] = CONST0_RTX (V4SImode);")
13612 (define_insn "sse2_loadld"
13613 [(set (match_operand:V4SI 0 "register_operand" "=v,v,x,x,v")
13615 (vec_duplicate:V4SI
13616 (match_operand:SI 2 "nonimmediate_operand" "m ,r ,m,x,v"))
13617 (match_operand:V4SI 1 "reg_or_0_operand" "C ,C ,C,0,v")
13621 %vmovd\t{%2, %0|%0, %2}
13622 %vmovd\t{%2, %0|%0, %2}
13623 movss\t{%2, %0|%0, %2}
13624 movss\t{%2, %0|%0, %2}
13625 vmovss\t{%2, %1, %0|%0, %1, %2}"
13626 [(set_attr "isa" "sse2,sse2,noavx,noavx,avx")
13627 (set_attr "type" "ssemov")
13628 (set_attr "prefix" "maybe_vex,maybe_vex,orig,orig,maybe_evex")
13629 (set_attr "mode" "TI,TI,V4SF,SF,SF")
13630 (set (attr "preferred_for_speed")
13631 (cond [(eq_attr "alternative" "1")
13632 (symbol_ref "TARGET_INTER_UNIT_MOVES_TO_VEC")
13634 (symbol_ref "true")))])
13636 ;; QI and HI modes handled by pextr patterns.
13637 (define_mode_iterator PEXTR_MODE12
13638 [(V16QI "TARGET_SSE4_1") V8HI])
13640 (define_insn "*vec_extract<mode>"
13641 [(set (match_operand:<ssescalarmode> 0 "register_sse4nonimm_operand" "=r,m,r,m")
13642 (vec_select:<ssescalarmode>
13643 (match_operand:PEXTR_MODE12 1 "register_operand" "x,x,v,v")
13645 [(match_operand:SI 2 "const_0_to_<ssescalarnummask>_operand")])))]
13648 %vpextr<ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}
13649 %vpextr<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
13650 vpextr<ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}
13651 vpextr<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
13652 [(set_attr "isa" "*,sse4,avx512bw,avx512bw")
13653 (set_attr "type" "sselog1")
13654 (set_attr "prefix_data16" "1")
13655 (set (attr "prefix_extra")
13657 (and (eq_attr "alternative" "0,2")
13658 (eq (const_string "<MODE>mode") (const_string "V8HImode")))
13660 (const_string "1")))
13661 (set_attr "length_immediate" "1")
13662 (set_attr "prefix" "maybe_vex,maybe_vex,evex,evex")
13663 (set_attr "mode" "TI")])
13665 (define_insn "*vec_extract<PEXTR_MODE12:mode>_zext"
13666 [(set (match_operand:SWI48 0 "register_operand" "=r,r")
13668 (vec_select:<PEXTR_MODE12:ssescalarmode>
13669 (match_operand:PEXTR_MODE12 1 "register_operand" "x,v")
13671 [(match_operand:SI 2
13672 "const_0_to_<PEXTR_MODE12:ssescalarnummask>_operand")]))))]
13675 %vpextr<PEXTR_MODE12:ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}
13676 vpextr<PEXTR_MODE12:ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}"
13677 [(set_attr "isa" "*,avx512bw")
13678 (set_attr "type" "sselog1")
13679 (set_attr "prefix_data16" "1")
13680 (set (attr "prefix_extra")
13682 (eq (const_string "<PEXTR_MODE12:MODE>mode") (const_string "V8HImode"))
13684 (const_string "1")))
13685 (set_attr "length_immediate" "1")
13686 (set_attr "prefix" "maybe_vex")
13687 (set_attr "mode" "TI")])
13689 (define_insn "*vec_extract<mode>_mem"
13690 [(set (match_operand:<ssescalarmode> 0 "register_operand" "=r")
13691 (vec_select:<ssescalarmode>
13692 (match_operand:VI12_128 1 "memory_operand" "o")
13694 [(match_operand 2 "const_0_to_<ssescalarnummask>_operand")])))]
13698 (define_insn "*vec_extract<ssevecmodelower>_0"
13699 [(set (match_operand:SWI48 0 "nonimmediate_operand" "=r,r,v ,m")
13701 (match_operand:<ssevecmode> 1 "nonimmediate_operand" "m ,v,vm,v")
13702 (parallel [(const_int 0)])))]
13703 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
13705 [(set_attr "isa" "*,sse2,*,*")
13706 (set (attr "preferred_for_speed")
13707 (cond [(eq_attr "alternative" "1")
13708 (symbol_ref "TARGET_INTER_UNIT_MOVES_FROM_VEC")
13710 (symbol_ref "true")))])
13712 (define_insn "*vec_extractv2di_0_sse"
13713 [(set (match_operand:DI 0 "nonimmediate_operand" "=v,m")
13715 (match_operand:V2DI 1 "nonimmediate_operand" "vm,v")
13716 (parallel [(const_int 0)])))]
13717 "TARGET_SSE && !TARGET_64BIT
13718 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
13722 [(set (match_operand:SWI48x 0 "nonimmediate_operand")
13724 (match_operand:<ssevecmode> 1 "register_operand")
13725 (parallel [(const_int 0)])))]
13726 "TARGET_SSE && reload_completed"
13727 [(set (match_dup 0) (match_dup 1))]
13728 "operands[1] = gen_lowpart (<MODE>mode, operands[1]);")
13730 (define_insn "*vec_extractv4si_0_zext_sse4"
13731 [(set (match_operand:DI 0 "register_operand" "=r,x,v")
13734 (match_operand:V4SI 1 "register_operand" "v,x,v")
13735 (parallel [(const_int 0)]))))]
13738 [(set_attr "isa" "x64,*,avx512f")
13739 (set (attr "preferred_for_speed")
13740 (cond [(eq_attr "alternative" "0")
13741 (symbol_ref "TARGET_INTER_UNIT_MOVES_FROM_VEC")
13743 (symbol_ref "true")))])
13745 (define_insn "*vec_extractv4si_0_zext"
13746 [(set (match_operand:DI 0 "register_operand" "=r")
13749 (match_operand:V4SI 1 "register_operand" "x")
13750 (parallel [(const_int 0)]))))]
13751 "TARGET_64BIT && TARGET_SSE2 && TARGET_INTER_UNIT_MOVES_FROM_VEC"
13755 [(set (match_operand:DI 0 "register_operand")
13758 (match_operand:V4SI 1 "register_operand")
13759 (parallel [(const_int 0)]))))]
13760 "TARGET_SSE2 && reload_completed"
13761 [(set (match_dup 0) (zero_extend:DI (match_dup 1)))]
13762 "operands[1] = gen_lowpart (SImode, operands[1]);")
13764 (define_insn "*vec_extractv4si"
13765 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,rm,Yr,*x,x,Yv")
13767 (match_operand:V4SI 1 "register_operand" "x,v,0,0,x,v")
13768 (parallel [(match_operand:SI 2 "const_0_to_3_operand")])))]
13771 switch (which_alternative)
13775 return "%vpextrd\t{%2, %1, %0|%0, %1, %2}";
13779 operands[2] = GEN_INT (INTVAL (operands[2]) * 4);
13780 return "psrldq\t{%2, %0|%0, %2}";
13784 operands[2] = GEN_INT (INTVAL (operands[2]) * 4);
13785 return "vpsrldq\t{%2, %1, %0|%0, %1, %2}";
13788 gcc_unreachable ();
13791 [(set_attr "isa" "*,avx512dq,noavx,noavx,avx,avx512bw")
13792 (set_attr "type" "sselog1,sselog1,sseishft1,sseishft1,sseishft1,sseishft1")
13793 (set (attr "prefix_extra")
13794 (if_then_else (eq_attr "alternative" "0,1")
13796 (const_string "*")))
13797 (set_attr "length_immediate" "1")
13798 (set_attr "prefix" "maybe_vex,evex,orig,orig,vex,evex")
13799 (set_attr "mode" "TI")])
13801 (define_insn "*vec_extractv4si_zext"
13802 [(set (match_operand:DI 0 "register_operand" "=r,r")
13805 (match_operand:V4SI 1 "register_operand" "x,v")
13806 (parallel [(match_operand:SI 2 "const_0_to_3_operand")]))))]
13807 "TARGET_64BIT && TARGET_SSE4_1"
13808 "%vpextrd\t{%2, %1, %k0|%k0, %1, %2}"
13809 [(set_attr "isa" "*,avx512dq")
13810 (set_attr "type" "sselog1")
13811 (set_attr "prefix_extra" "1")
13812 (set_attr "length_immediate" "1")
13813 (set_attr "prefix" "maybe_vex")
13814 (set_attr "mode" "TI")])
13816 (define_insn "*vec_extractv4si_mem"
13817 [(set (match_operand:SI 0 "register_operand" "=x,r")
13819 (match_operand:V4SI 1 "memory_operand" "o,o")
13820 (parallel [(match_operand 2 "const_0_to_3_operand")])))]
13824 (define_insn_and_split "*vec_extractv4si_zext_mem"
13825 [(set (match_operand:DI 0 "register_operand" "=x,r")
13828 (match_operand:V4SI 1 "memory_operand" "o,o")
13829 (parallel [(match_operand:SI 2 "const_0_to_3_operand")]))))]
13830 "TARGET_64BIT && TARGET_SSE"
13832 "&& reload_completed"
13833 [(set (match_dup 0) (zero_extend:DI (match_dup 1)))]
13835 operands[1] = adjust_address (operands[1], SImode, INTVAL (operands[2]) * 4);
13838 (define_insn "*vec_extractv2di_1"
13839 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,rm,m,x,x,Yv,x,v,r")
13841 (match_operand:V2DI 1 "nonimmediate_operand" "x ,v ,v,0,x, v,x,o,o")
13842 (parallel [(const_int 1)])))]
13843 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
13845 %vpextrq\t{$1, %1, %0|%0, %1, 1}
13846 vpextrq\t{$1, %1, %0|%0, %1, 1}
13847 %vmovhps\t{%1, %0|%0, %1}
13848 psrldq\t{$8, %0|%0, 8}
13849 vpsrldq\t{$8, %1, %0|%0, %1, 8}
13850 vpsrldq\t{$8, %1, %0|%0, %1, 8}
13851 movhlps\t{%1, %0|%0, %1}
13855 (cond [(eq_attr "alternative" "0")
13856 (const_string "x64_sse4")
13857 (eq_attr "alternative" "1")
13858 (const_string "x64_avx512dq")
13859 (eq_attr "alternative" "3")
13860 (const_string "sse2_noavx")
13861 (eq_attr "alternative" "4")
13862 (const_string "avx")
13863 (eq_attr "alternative" "5")
13864 (const_string "avx512bw")
13865 (eq_attr "alternative" "6")
13866 (const_string "noavx")
13867 (eq_attr "alternative" "8")
13868 (const_string "x64")
13870 (const_string "*")))
13872 (cond [(eq_attr "alternative" "2,6,7")
13873 (const_string "ssemov")
13874 (eq_attr "alternative" "3,4,5")
13875 (const_string "sseishft1")
13876 (eq_attr "alternative" "8")
13877 (const_string "imov")
13879 (const_string "sselog1")))
13880 (set (attr "length_immediate")
13881 (if_then_else (eq_attr "alternative" "0,1,3,4,5")
13883 (const_string "*")))
13884 (set (attr "prefix_rex")
13885 (if_then_else (eq_attr "alternative" "0,1")
13887 (const_string "*")))
13888 (set (attr "prefix_extra")
13889 (if_then_else (eq_attr "alternative" "0,1")
13891 (const_string "*")))
13892 (set_attr "prefix" "maybe_vex,evex,maybe_vex,orig,vex,evex,orig,*,*")
13893 (set_attr "mode" "TI,TI,V2SF,TI,TI,TI,V4SF,DI,DI")])
13896 [(set (match_operand:<ssescalarmode> 0 "register_operand")
13897 (vec_select:<ssescalarmode>
13898 (match_operand:VI_128 1 "memory_operand")
13900 [(match_operand 2 "const_0_to_<ssescalarnummask>_operand")])))]
13901 "TARGET_SSE && reload_completed"
13902 [(set (match_dup 0) (match_dup 1))]
13904 int offs = INTVAL (operands[2]) * GET_MODE_SIZE (<ssescalarmode>mode);
13906 operands[1] = adjust_address (operands[1], <ssescalarmode>mode, offs);
13909 (define_insn "*vec_extractv2ti"
13910 [(set (match_operand:TI 0 "nonimmediate_operand" "=xm,vm")
13912 (match_operand:V2TI 1 "register_operand" "x,v")
13914 [(match_operand:SI 2 "const_0_to_1_operand")])))]
13917 vextract%~128\t{%2, %1, %0|%0, %1, %2}
13918 vextracti32x4\t{%2, %g1, %0|%0, %g1, %2}"
13919 [(set_attr "type" "sselog")
13920 (set_attr "prefix_extra" "1")
13921 (set_attr "length_immediate" "1")
13922 (set_attr "prefix" "vex,evex")
13923 (set_attr "mode" "OI")])
13925 (define_insn "*vec_extractv4ti"
13926 [(set (match_operand:TI 0 "nonimmediate_operand" "=vm")
13928 (match_operand:V4TI 1 "register_operand" "v")
13930 [(match_operand:SI 2 "const_0_to_3_operand")])))]
13932 "vextracti32x4\t{%2, %1, %0|%0, %1, %2}"
13933 [(set_attr "type" "sselog")
13934 (set_attr "prefix_extra" "1")
13935 (set_attr "length_immediate" "1")
13936 (set_attr "prefix" "evex")
13937 (set_attr "mode" "XI")])
13939 (define_mode_iterator VEXTRACTI128_MODE
13940 [(V4TI "TARGET_AVX512F") V2TI])
13943 [(set (match_operand:TI 0 "nonimmediate_operand")
13945 (match_operand:VEXTRACTI128_MODE 1 "register_operand")
13946 (parallel [(const_int 0)])))]
13948 && reload_completed
13949 && (TARGET_AVX512VL || !EXT_REX_SSE_REG_P (operands[1]))"
13950 [(set (match_dup 0) (match_dup 1))]
13951 "operands[1] = gen_lowpart (TImode, operands[1]);")
13953 ;; Turn SImode or DImode extraction from arbitrary SSE/AVX/AVX512F
13954 ;; vector modes into vec_extract*.
13956 [(set (match_operand:SWI48x 0 "nonimmediate_operand")
13957 (subreg:SWI48x (match_operand 1 "register_operand") 0))]
13958 "can_create_pseudo_p ()
13959 && REG_P (operands[1])
13960 && VECTOR_MODE_P (GET_MODE (operands[1]))
13961 && ((TARGET_SSE && GET_MODE_SIZE (GET_MODE (operands[1])) == 16)
13962 || (TARGET_AVX && GET_MODE_SIZE (GET_MODE (operands[1])) == 32)
13963 || (TARGET_AVX512F && GET_MODE_SIZE (GET_MODE (operands[1])) == 64))
13964 && (<MODE>mode == SImode || TARGET_64BIT || MEM_P (operands[0]))"
13965 [(set (match_dup 0) (vec_select:SWI48x (match_dup 1)
13966 (parallel [(const_int 0)])))]
13970 switch (GET_MODE_SIZE (GET_MODE (operands[1])))
13973 if (<MODE>mode == SImode)
13975 tmp = gen_reg_rtx (V8SImode);
13976 emit_insn (gen_vec_extract_lo_v16si (tmp,
13977 gen_lowpart (V16SImode,
13982 tmp = gen_reg_rtx (V4DImode);
13983 emit_insn (gen_vec_extract_lo_v8di (tmp,
13984 gen_lowpart (V8DImode,
13990 tmp = gen_reg_rtx (<ssevecmode>mode);
13991 if (<MODE>mode == SImode)
13992 emit_insn (gen_vec_extract_lo_v8si (tmp, gen_lowpart (V8SImode,
13995 emit_insn (gen_vec_extract_lo_v4di (tmp, gen_lowpart (V4DImode,
14000 operands[1] = gen_lowpart (<ssevecmode>mode, operands[1]);
14005 (define_insn "*vec_concatv2si_sse4_1"
14006 [(set (match_operand:V2SI 0 "register_operand"
14007 "=Yr,*x, x, v,Yr,*x, v, v, *y,*y")
14009 (match_operand:SI 1 "nonimmediate_operand"
14010 " 0, 0, x,Yv, 0, 0,Yv,rm, 0,rm")
14011 (match_operand:SI 2 "vector_move_operand"
14012 " rm,rm,rm,rm,Yr,*x,Yv, C,*ym, C")))]
14013 "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
14015 pinsrd\t{$1, %2, %0|%0, %2, 1}
14016 pinsrd\t{$1, %2, %0|%0, %2, 1}
14017 vpinsrd\t{$1, %2, %1, %0|%0, %1, %2, 1}
14018 vpinsrd\t{$1, %2, %1, %0|%0, %1, %2, 1}
14019 punpckldq\t{%2, %0|%0, %2}
14020 punpckldq\t{%2, %0|%0, %2}
14021 vpunpckldq\t{%2, %1, %0|%0, %1, %2}
14022 %vmovd\t{%1, %0|%0, %1}
14023 punpckldq\t{%2, %0|%0, %2}
14024 movd\t{%1, %0|%0, %1}"
14025 [(set_attr "isa" "noavx,noavx,avx,avx512dq,noavx,noavx,avx,*,*,*")
14027 (cond [(eq_attr "alternative" "7")
14028 (const_string "ssemov")
14029 (eq_attr "alternative" "8")
14030 (const_string "mmxcvt")
14031 (eq_attr "alternative" "9")
14032 (const_string "mmxmov")
14034 (const_string "sselog")))
14035 (set (attr "prefix_extra")
14036 (if_then_else (eq_attr "alternative" "0,1,2,3")
14038 (const_string "*")))
14039 (set (attr "length_immediate")
14040 (if_then_else (eq_attr "alternative" "0,1,2,3")
14042 (const_string "*")))
14043 (set_attr "prefix" "orig,orig,vex,evex,orig,orig,maybe_evex,maybe_vex,orig,orig")
14044 (set_attr "mode" "TI,TI,TI,TI,TI,TI,TI,TI,DI,DI")])
14046 ;; ??? In theory we can match memory for the MMX alternative, but allowing
14047 ;; nonimmediate_operand for operand 2 and *not* allowing memory for the SSE
14048 ;; alternatives pretty much forces the MMX alternative to be chosen.
14049 (define_insn "*vec_concatv2si"
14050 [(set (match_operand:V2SI 0 "register_operand" "=x,x ,*y,x,x,*y,*y")
14052 (match_operand:SI 1 "nonimmediate_operand" " 0,rm,rm,0,m, 0,*rm")
14053 (match_operand:SI 2 "reg_or_0_operand" " x,C ,C, x,C,*y,C")))]
14054 "TARGET_SSE && !TARGET_SSE4_1"
14056 punpckldq\t{%2, %0|%0, %2}
14057 movd\t{%1, %0|%0, %1}
14058 movd\t{%1, %0|%0, %1}
14059 unpcklps\t{%2, %0|%0, %2}
14060 movss\t{%1, %0|%0, %1}
14061 punpckldq\t{%2, %0|%0, %2}
14062 movd\t{%1, %0|%0, %1}"
14063 [(set_attr "isa" "sse2,sse2,sse2,*,*,*,*")
14064 (set_attr "type" "sselog,ssemov,mmxmov,sselog,ssemov,mmxcvt,mmxmov")
14065 (set_attr "mode" "TI,TI,DI,V4SF,SF,DI,DI")])
14067 (define_insn "*vec_concatv4si"
14068 [(set (match_operand:V4SI 0 "register_operand" "=x,v,x,x,v")
14070 (match_operand:V2SI 1 "register_operand" " 0,v,0,0,v")
14071 (match_operand:V2SI 2 "nonimmediate_operand" " x,v,x,m,m")))]
14074 punpcklqdq\t{%2, %0|%0, %2}
14075 vpunpcklqdq\t{%2, %1, %0|%0, %1, %2}
14076 movlhps\t{%2, %0|%0, %2}
14077 movhps\t{%2, %0|%0, %q2}
14078 vmovhps\t{%2, %1, %0|%0, %1, %q2}"
14079 [(set_attr "isa" "sse2_noavx,avx,noavx,noavx,avx")
14080 (set_attr "type" "sselog,sselog,ssemov,ssemov,ssemov")
14081 (set_attr "prefix" "orig,maybe_evex,orig,orig,maybe_evex")
14082 (set_attr "mode" "TI,TI,V4SF,V2SF,V2SF")])
14084 ;; movd instead of movq is required to handle broken assemblers.
14085 (define_insn "vec_concatv2di"
14086 [(set (match_operand:V2DI 0 "register_operand"
14087 "=Yr,*x,x ,v ,v,v ,x ,x,v ,x,x,v")
14089 (match_operand:DI 1 "nonimmediate_operand"
14090 " 0, 0,x ,Yv,r,vm,?!*y,0,Yv,0,0,v")
14091 (match_operand:DI 2 "vector_move_operand"
14092 " rm,rm,rm,rm,C ,C ,C ,x,Yv,x,m,m")))]
14095 pinsrq\t{$1, %2, %0|%0, %2, 1}
14096 pinsrq\t{$1, %2, %0|%0, %2, 1}
14097 vpinsrq\t{$1, %2, %1, %0|%0, %1, %2, 1}
14098 vpinsrq\t{$1, %2, %1, %0|%0, %1, %2, 1}
14099 * return HAVE_AS_IX86_INTERUNIT_MOVQ ? \"%vmovq\t{%1, %0|%0, %1}\" : \"%vmovd\t{%1, %0|%0, %1}\";
14100 %vmovq\t{%1, %0|%0, %1}
14101 movq2dq\t{%1, %0|%0, %1}
14102 punpcklqdq\t{%2, %0|%0, %2}
14103 vpunpcklqdq\t{%2, %1, %0|%0, %1, %2}
14104 movlhps\t{%2, %0|%0, %2}
14105 movhps\t{%2, %0|%0, %2}
14106 vmovhps\t{%2, %1, %0|%0, %1, %2}"
14108 (cond [(eq_attr "alternative" "0,1")
14109 (const_string "x64_sse4_noavx")
14110 (eq_attr "alternative" "2")
14111 (const_string "x64_avx")
14112 (eq_attr "alternative" "3")
14113 (const_string "x64_avx512dq")
14114 (eq_attr "alternative" "4")
14115 (const_string "x64_sse2")
14116 (eq_attr "alternative" "5,6")
14117 (const_string "sse2")
14118 (eq_attr "alternative" "7")
14119 (const_string "sse2_noavx")
14120 (eq_attr "alternative" "8,11")
14121 (const_string "avx")
14123 (const_string "noavx")))
14126 (eq_attr "alternative" "0,1,2,3,7,8")
14127 (const_string "sselog")
14128 (const_string "ssemov")))
14129 (set (attr "prefix_rex")
14130 (if_then_else (eq_attr "alternative" "0,1,2,3,4")
14132 (const_string "*")))
14133 (set (attr "prefix_extra")
14134 (if_then_else (eq_attr "alternative" "0,1,2,3")
14136 (const_string "*")))
14137 (set (attr "length_immediate")
14138 (if_then_else (eq_attr "alternative" "0,1,2,3")
14140 (const_string "*")))
14141 (set (attr "prefix")
14142 (cond [(eq_attr "alternative" "2")
14143 (const_string "vex")
14144 (eq_attr "alternative" "3")
14145 (const_string "evex")
14146 (eq_attr "alternative" "4,5")
14147 (const_string "maybe_vex")
14148 (eq_attr "alternative" "8,11")
14149 (const_string "maybe_evex")
14151 (const_string "orig")))
14152 (set_attr "mode" "TI,TI,TI,TI,TI,TI,TI,TI,TI,V4SF,V2SF,V2SF")
14153 (set (attr "preferred_for_speed")
14154 (cond [(eq_attr "alternative" "4")
14155 (symbol_ref "TARGET_INTER_UNIT_MOVES_TO_VEC")
14156 (eq_attr "alternative" "6")
14157 (symbol_ref "TARGET_INTER_UNIT_MOVES_FROM_VEC")
14159 (symbol_ref "true")))])
14161 ;; vmovq clears also the higher bits.
14162 (define_insn "vec_set<mode>_0"
14163 [(set (match_operand:VI8_AVX_AVX512F 0 "register_operand" "=v,v")
14164 (vec_merge:VI8_AVX_AVX512F
14165 (vec_duplicate:VI8_AVX_AVX512F
14166 (match_operand:<ssescalarmode> 2 "general_operand" "r,vm"))
14167 (match_operand:VI8_AVX_AVX512F 1 "const0_operand" "C,C")
14170 "vmovq\t{%2, %x0|%x0, %2}"
14171 [(set_attr "isa" "x64,*")
14172 (set_attr "type" "ssemov")
14173 (set_attr "prefix_rex" "1,*")
14174 (set_attr "prefix" "maybe_evex")
14175 (set_attr "mode" "TI")
14176 (set (attr "preferred_for_speed")
14177 (cond [(eq_attr "alternative" "0")
14178 (symbol_ref "TARGET_INTER_UNIT_MOVES_TO_VEC")
14180 (symbol_ref "true")))])
14182 (define_expand "vec_unpacks_lo_<mode>"
14183 [(match_operand:<sseunpackmode> 0 "register_operand")
14184 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
14186 "ix86_expand_sse_unpack (operands[0], operands[1], false, false); DONE;")
14188 (define_expand "vec_unpacks_hi_<mode>"
14189 [(match_operand:<sseunpackmode> 0 "register_operand")
14190 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
14192 "ix86_expand_sse_unpack (operands[0], operands[1], false, true); DONE;")
14194 (define_expand "vec_unpacku_lo_<mode>"
14195 [(match_operand:<sseunpackmode> 0 "register_operand")
14196 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
14198 "ix86_expand_sse_unpack (operands[0], operands[1], true, false); DONE;")
14200 (define_expand "vec_unpacks_lo_hi"
14201 [(set (subreg:HI (match_operand:QI 0 "register_operand") 0)
14202 (match_operand:HI 1 "register_operand"))]
14205 (define_expand "vec_unpacks_lo_si"
14206 [(set (match_operand:HI 0 "register_operand")
14207 (subreg:HI (match_operand:SI 1 "register_operand") 0))]
14210 (define_expand "vec_unpacks_lo_di"
14211 [(set (match_operand:SI 0 "register_operand")
14212 (subreg:SI (match_operand:DI 1 "register_operand") 0))]
14215 (define_expand "vec_unpacku_hi_<mode>"
14216 [(match_operand:<sseunpackmode> 0 "register_operand")
14217 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
14219 "ix86_expand_sse_unpack (operands[0], operands[1], true, true); DONE;")
14221 (define_expand "vec_unpacks_hi_hi"
14223 [(set (subreg:HI (match_operand:QI 0 "register_operand") 0)
14224 (lshiftrt:HI (match_operand:HI 1 "register_operand")
14226 (unspec [(const_int 0)] UNSPEC_MASKOP)])]
14229 (define_expand "vec_unpacks_hi_<mode>"
14231 [(set (subreg:SWI48x
14232 (match_operand:<HALFMASKMODE> 0 "register_operand") 0)
14233 (lshiftrt:SWI48x (match_operand:SWI48x 1 "register_operand")
14235 (unspec [(const_int 0)] UNSPEC_MASKOP)])]
14237 "operands[2] = GEN_INT (GET_MODE_BITSIZE (<HALFMASKMODE>mode));")
14239 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14243 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14245 (define_expand "<sse2_avx2>_uavg<mode>3<mask_name>"
14246 [(set (match_operand:VI12_AVX2 0 "register_operand")
14247 (truncate:VI12_AVX2
14248 (lshiftrt:<ssedoublemode>
14249 (plus:<ssedoublemode>
14250 (plus:<ssedoublemode>
14251 (zero_extend:<ssedoublemode>
14252 (match_operand:VI12_AVX2 1 "vector_operand"))
14253 (zero_extend:<ssedoublemode>
14254 (match_operand:VI12_AVX2 2 "vector_operand")))
14255 (match_dup <mask_expand_op3>))
14257 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
14259 operands[<mask_expand_op3>] = CONST1_RTX(<MODE>mode);
14260 ix86_fixup_binary_operands_no_copy (PLUS, <MODE>mode, operands);
14263 (define_insn "*<sse2_avx2>_uavg<mode>3<mask_name>"
14264 [(set (match_operand:VI12_AVX2 0 "register_operand" "=x,v")
14265 (truncate:VI12_AVX2
14266 (lshiftrt:<ssedoublemode>
14267 (plus:<ssedoublemode>
14268 (plus:<ssedoublemode>
14269 (zero_extend:<ssedoublemode>
14270 (match_operand:VI12_AVX2 1 "vector_operand" "%0,v"))
14271 (zero_extend:<ssedoublemode>
14272 (match_operand:VI12_AVX2 2 "vector_operand" "xBm,vm")))
14273 (match_operand:VI12_AVX2 <mask_expand_op3> "const1_operand"))
14275 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>
14276 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
14278 pavg<ssemodesuffix>\t{%2, %0|%0, %2}
14279 vpavg<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
14280 [(set_attr "isa" "noavx,avx")
14281 (set_attr "type" "sseiadd")
14282 (set_attr "prefix_data16" "1,*")
14283 (set_attr "prefix" "orig,<mask_prefix>")
14284 (set_attr "mode" "<sseinsnmode>")])
14286 ;; The correct representation for this is absolutely enormous, and
14287 ;; surely not generally useful.
14288 (define_insn "<sse2_avx2>_psadbw"
14289 [(set (match_operand:VI8_AVX2_AVX512BW 0 "register_operand" "=x,v")
14290 (unspec:VI8_AVX2_AVX512BW
14291 [(match_operand:<ssebytemode> 1 "register_operand" "0,v")
14292 (match_operand:<ssebytemode> 2 "vector_operand" "xBm,vm")]
14296 psadbw\t{%2, %0|%0, %2}
14297 vpsadbw\t{%2, %1, %0|%0, %1, %2}"
14298 [(set_attr "isa" "noavx,avx")
14299 (set_attr "type" "sseiadd")
14300 (set_attr "atom_unit" "simul")
14301 (set_attr "prefix_data16" "1,*")
14302 (set_attr "prefix" "orig,maybe_evex")
14303 (set_attr "mode" "<sseinsnmode>")])
14305 (define_insn "<sse>_movmsk<ssemodesuffix><avxsizesuffix>"
14306 [(set (match_operand:SI 0 "register_operand" "=r")
14308 [(match_operand:VF_128_256 1 "register_operand" "x")]
14311 "%vmovmsk<ssemodesuffix>\t{%1, %0|%0, %1}"
14312 [(set_attr "type" "ssemov")
14313 (set_attr "prefix" "maybe_vex")
14314 (set_attr "mode" "<MODE>")])
14316 (define_insn "*<sse>_movmsk<ssemodesuffix><avxsizesuffix>_zext"
14317 [(set (match_operand:DI 0 "register_operand" "=r")
14320 [(match_operand:VF_128_256 1 "register_operand" "x")]
14322 "TARGET_64BIT && TARGET_SSE"
14323 "%vmovmsk<ssemodesuffix>\t{%1, %k0|%k0, %1}"
14324 [(set_attr "type" "ssemov")
14325 (set_attr "prefix" "maybe_vex")
14326 (set_attr "mode" "<MODE>")])
14328 (define_insn "<sse2_avx2>_pmovmskb"
14329 [(set (match_operand:SI 0 "register_operand" "=r")
14331 [(match_operand:VI1_AVX2 1 "register_operand" "x")]
14334 "%vpmovmskb\t{%1, %0|%0, %1}"
14335 [(set_attr "type" "ssemov")
14336 (set (attr "prefix_data16")
14338 (match_test "TARGET_AVX")
14340 (const_string "1")))
14341 (set_attr "prefix" "maybe_vex")
14342 (set_attr "mode" "SI")])
14344 (define_insn "*<sse2_avx2>_pmovmskb_zext"
14345 [(set (match_operand:DI 0 "register_operand" "=r")
14348 [(match_operand:VI1_AVX2 1 "register_operand" "x")]
14350 "TARGET_64BIT && TARGET_SSE2"
14351 "%vpmovmskb\t{%1, %k0|%k0, %1}"
14352 [(set_attr "type" "ssemov")
14353 (set (attr "prefix_data16")
14355 (match_test "TARGET_AVX")
14357 (const_string "1")))
14358 (set_attr "prefix" "maybe_vex")
14359 (set_attr "mode" "SI")])
14361 (define_expand "sse2_maskmovdqu"
14362 [(set (match_operand:V16QI 0 "memory_operand")
14363 (unspec:V16QI [(match_operand:V16QI 1 "register_operand")
14364 (match_operand:V16QI 2 "register_operand")
14369 (define_insn "*sse2_maskmovdqu"
14370 [(set (mem:V16QI (match_operand:P 0 "register_operand" "D"))
14371 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "x")
14372 (match_operand:V16QI 2 "register_operand" "x")
14373 (mem:V16QI (match_dup 0))]
14377 /* We can't use %^ here due to ASM_OUTPUT_OPCODE processing
14378 that requires %v to be at the beginning of the opcode name. */
14379 if (Pmode != word_mode)
14380 fputs ("\taddr32", asm_out_file);
14381 return "%vmaskmovdqu\t{%2, %1|%1, %2}";
14383 [(set_attr "type" "ssemov")
14384 (set_attr "prefix_data16" "1")
14385 (set (attr "length_address")
14386 (symbol_ref ("Pmode != word_mode")))
14387 ;; The implicit %rdi operand confuses default length_vex computation.
14388 (set (attr "length_vex")
14389 (symbol_ref ("3 + REX_SSE_REGNO_P (REGNO (operands[2]))")))
14390 (set_attr "prefix" "maybe_vex")
14391 (set_attr "znver1_decode" "vector")
14392 (set_attr "mode" "TI")])
14394 (define_insn "sse_ldmxcsr"
14395 [(unspec_volatile [(match_operand:SI 0 "memory_operand" "m")]
14399 [(set_attr "type" "sse")
14400 (set_attr "atom_sse_attr" "mxcsr")
14401 (set_attr "prefix" "maybe_vex")
14402 (set_attr "memory" "load")])
14404 (define_insn "sse_stmxcsr"
14405 [(set (match_operand:SI 0 "memory_operand" "=m")
14406 (unspec_volatile:SI [(const_int 0)] UNSPECV_STMXCSR))]
14409 [(set_attr "type" "sse")
14410 (set_attr "atom_sse_attr" "mxcsr")
14411 (set_attr "prefix" "maybe_vex")
14412 (set_attr "memory" "store")])
14414 (define_insn "sse2_clflush"
14415 [(unspec_volatile [(match_operand 0 "address_operand" "p")]
14419 [(set_attr "type" "sse")
14420 (set_attr "atom_sse_attr" "fence")
14421 (set_attr "memory" "unknown")])
14423 ;; As per AMD and Intel ISA manuals, the first operand is extensions
14424 ;; and it goes to %ecx. The second operand received is hints and it goes
14426 (define_insn "sse3_mwait"
14427 [(unspec_volatile [(match_operand:SI 0 "register_operand" "c")
14428 (match_operand:SI 1 "register_operand" "a")]
14431 ;; 64bit version is "mwait %rax,%rcx". But only lower 32bits are used.
14432 ;; Since 32bit register operands are implicitly zero extended to 64bit,
14433 ;; we only need to set up 32bit registers.
14435 [(set_attr "length" "3")])
14437 (define_insn "sse3_monitor_<mode>"
14438 [(unspec_volatile [(match_operand:P 0 "register_operand" "a")
14439 (match_operand:SI 1 "register_operand" "c")
14440 (match_operand:SI 2 "register_operand" "d")]
14443 ;; 64bit version is "monitor %rax,%rcx,%rdx". But only lower 32bits in
14444 ;; RCX and RDX are used. Since 32bit register operands are implicitly
14445 ;; zero extended to 64bit, we only need to set up 32bit registers.
14447 [(set (attr "length")
14448 (symbol_ref ("(Pmode != word_mode) + 3")))])
14450 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14452 ;; SSSE3 instructions
14454 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14456 (define_code_iterator ssse3_plusminus [plus ss_plus minus ss_minus])
14458 (define_insn "avx2_ph<plusminus_mnemonic>wv16hi3"
14459 [(set (match_operand:V16HI 0 "register_operand" "=x")
14464 (ssse3_plusminus:HI
14466 (match_operand:V16HI 1 "register_operand" "x")
14467 (parallel [(const_int 0)]))
14468 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
14469 (ssse3_plusminus:HI
14470 (vec_select:HI (match_dup 1) (parallel [(const_int 2)]))
14471 (vec_select:HI (match_dup 1) (parallel [(const_int 3)]))))
14473 (ssse3_plusminus:HI
14474 (vec_select:HI (match_dup 1) (parallel [(const_int 4)]))
14475 (vec_select:HI (match_dup 1) (parallel [(const_int 5)])))
14476 (ssse3_plusminus:HI
14477 (vec_select:HI (match_dup 1) (parallel [(const_int 6)]))
14478 (vec_select:HI (match_dup 1) (parallel [(const_int 7)])))))
14481 (ssse3_plusminus:HI
14482 (vec_select:HI (match_dup 1) (parallel [(const_int 8)]))
14483 (vec_select:HI (match_dup 1) (parallel [(const_int 9)])))
14484 (ssse3_plusminus:HI
14485 (vec_select:HI (match_dup 1) (parallel [(const_int 10)]))
14486 (vec_select:HI (match_dup 1) (parallel [(const_int 11)]))))
14488 (ssse3_plusminus:HI
14489 (vec_select:HI (match_dup 1) (parallel [(const_int 12)]))
14490 (vec_select:HI (match_dup 1) (parallel [(const_int 13)])))
14491 (ssse3_plusminus:HI
14492 (vec_select:HI (match_dup 1) (parallel [(const_int 14)]))
14493 (vec_select:HI (match_dup 1) (parallel [(const_int 15)]))))))
14497 (ssse3_plusminus:HI
14499 (match_operand:V16HI 2 "nonimmediate_operand" "xm")
14500 (parallel [(const_int 0)]))
14501 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))
14502 (ssse3_plusminus:HI
14503 (vec_select:HI (match_dup 2) (parallel [(const_int 2)]))
14504 (vec_select:HI (match_dup 2) (parallel [(const_int 3)]))))
14506 (ssse3_plusminus:HI
14507 (vec_select:HI (match_dup 2) (parallel [(const_int 4)]))
14508 (vec_select:HI (match_dup 2) (parallel [(const_int 5)])))
14509 (ssse3_plusminus:HI
14510 (vec_select:HI (match_dup 2) (parallel [(const_int 6)]))
14511 (vec_select:HI (match_dup 2) (parallel [(const_int 7)])))))
14514 (ssse3_plusminus:HI
14515 (vec_select:HI (match_dup 2) (parallel [(const_int 8)]))
14516 (vec_select:HI (match_dup 2) (parallel [(const_int 9)])))
14517 (ssse3_plusminus:HI
14518 (vec_select:HI (match_dup 2) (parallel [(const_int 10)]))
14519 (vec_select:HI (match_dup 2) (parallel [(const_int 11)]))))
14521 (ssse3_plusminus:HI
14522 (vec_select:HI (match_dup 2) (parallel [(const_int 12)]))
14523 (vec_select:HI (match_dup 2) (parallel [(const_int 13)])))
14524 (ssse3_plusminus:HI
14525 (vec_select:HI (match_dup 2) (parallel [(const_int 14)]))
14526 (vec_select:HI (match_dup 2) (parallel [(const_int 15)]))))))))]
14528 "vph<plusminus_mnemonic>w\t{%2, %1, %0|%0, %1, %2}"
14529 [(set_attr "type" "sseiadd")
14530 (set_attr "prefix_extra" "1")
14531 (set_attr "prefix" "vex")
14532 (set_attr "mode" "OI")])
14534 (define_insn "ssse3_ph<plusminus_mnemonic>wv8hi3"
14535 [(set (match_operand:V8HI 0 "register_operand" "=x,x")
14539 (ssse3_plusminus:HI
14541 (match_operand:V8HI 1 "register_operand" "0,x")
14542 (parallel [(const_int 0)]))
14543 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
14544 (ssse3_plusminus:HI
14545 (vec_select:HI (match_dup 1) (parallel [(const_int 2)]))
14546 (vec_select:HI (match_dup 1) (parallel [(const_int 3)]))))
14548 (ssse3_plusminus:HI
14549 (vec_select:HI (match_dup 1) (parallel [(const_int 4)]))
14550 (vec_select:HI (match_dup 1) (parallel [(const_int 5)])))
14551 (ssse3_plusminus:HI
14552 (vec_select:HI (match_dup 1) (parallel [(const_int 6)]))
14553 (vec_select:HI (match_dup 1) (parallel [(const_int 7)])))))
14556 (ssse3_plusminus:HI
14558 (match_operand:V8HI 2 "vector_operand" "xBm,xm")
14559 (parallel [(const_int 0)]))
14560 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))
14561 (ssse3_plusminus:HI
14562 (vec_select:HI (match_dup 2) (parallel [(const_int 2)]))
14563 (vec_select:HI (match_dup 2) (parallel [(const_int 3)]))))
14565 (ssse3_plusminus:HI
14566 (vec_select:HI (match_dup 2) (parallel [(const_int 4)]))
14567 (vec_select:HI (match_dup 2) (parallel [(const_int 5)])))
14568 (ssse3_plusminus:HI
14569 (vec_select:HI (match_dup 2) (parallel [(const_int 6)]))
14570 (vec_select:HI (match_dup 2) (parallel [(const_int 7)])))))))]
14573 ph<plusminus_mnemonic>w\t{%2, %0|%0, %2}
14574 vph<plusminus_mnemonic>w\t{%2, %1, %0|%0, %1, %2}"
14575 [(set_attr "isa" "noavx,avx")
14576 (set_attr "type" "sseiadd")
14577 (set_attr "atom_unit" "complex")
14578 (set_attr "prefix_data16" "1,*")
14579 (set_attr "prefix_extra" "1")
14580 (set_attr "prefix" "orig,vex")
14581 (set_attr "mode" "TI")])
14583 (define_insn "ssse3_ph<plusminus_mnemonic>wv4hi3"
14584 [(set (match_operand:V4HI 0 "register_operand" "=y")
14587 (ssse3_plusminus:HI
14589 (match_operand:V4HI 1 "register_operand" "0")
14590 (parallel [(const_int 0)]))
14591 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
14592 (ssse3_plusminus:HI
14593 (vec_select:HI (match_dup 1) (parallel [(const_int 2)]))
14594 (vec_select:HI (match_dup 1) (parallel [(const_int 3)]))))
14596 (ssse3_plusminus:HI
14598 (match_operand:V4HI 2 "nonimmediate_operand" "ym")
14599 (parallel [(const_int 0)]))
14600 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))
14601 (ssse3_plusminus:HI
14602 (vec_select:HI (match_dup 2) (parallel [(const_int 2)]))
14603 (vec_select:HI (match_dup 2) (parallel [(const_int 3)]))))))]
14605 "ph<plusminus_mnemonic>w\t{%2, %0|%0, %2}"
14606 [(set_attr "type" "sseiadd")
14607 (set_attr "atom_unit" "complex")
14608 (set_attr "prefix_extra" "1")
14609 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14610 (set_attr "mode" "DI")])
14612 (define_insn "avx2_ph<plusminus_mnemonic>dv8si3"
14613 [(set (match_operand:V8SI 0 "register_operand" "=x")
14619 (match_operand:V8SI 1 "register_operand" "x")
14620 (parallel [(const_int 0)]))
14621 (vec_select:SI (match_dup 1) (parallel [(const_int 1)])))
14623 (vec_select:SI (match_dup 1) (parallel [(const_int 2)]))
14624 (vec_select:SI (match_dup 1) (parallel [(const_int 3)]))))
14627 (vec_select:SI (match_dup 1) (parallel [(const_int 4)]))
14628 (vec_select:SI (match_dup 1) (parallel [(const_int 5)])))
14630 (vec_select:SI (match_dup 1) (parallel [(const_int 6)]))
14631 (vec_select:SI (match_dup 1) (parallel [(const_int 7)])))))
14636 (match_operand:V8SI 2 "nonimmediate_operand" "xm")
14637 (parallel [(const_int 0)]))
14638 (vec_select:SI (match_dup 2) (parallel [(const_int 1)])))
14640 (vec_select:SI (match_dup 2) (parallel [(const_int 2)]))
14641 (vec_select:SI (match_dup 2) (parallel [(const_int 3)]))))
14644 (vec_select:SI (match_dup 2) (parallel [(const_int 4)]))
14645 (vec_select:SI (match_dup 2) (parallel [(const_int 5)])))
14647 (vec_select:SI (match_dup 2) (parallel [(const_int 6)]))
14648 (vec_select:SI (match_dup 2) (parallel [(const_int 7)])))))))]
14650 "vph<plusminus_mnemonic>d\t{%2, %1, %0|%0, %1, %2}"
14651 [(set_attr "type" "sseiadd")
14652 (set_attr "prefix_extra" "1")
14653 (set_attr "prefix" "vex")
14654 (set_attr "mode" "OI")])
14656 (define_insn "ssse3_ph<plusminus_mnemonic>dv4si3"
14657 [(set (match_operand:V4SI 0 "register_operand" "=x,x")
14662 (match_operand:V4SI 1 "register_operand" "0,x")
14663 (parallel [(const_int 0)]))
14664 (vec_select:SI (match_dup 1) (parallel [(const_int 1)])))
14666 (vec_select:SI (match_dup 1) (parallel [(const_int 2)]))
14667 (vec_select:SI (match_dup 1) (parallel [(const_int 3)]))))
14671 (match_operand:V4SI 2 "vector_operand" "xBm,xm")
14672 (parallel [(const_int 0)]))
14673 (vec_select:SI (match_dup 2) (parallel [(const_int 1)])))
14675 (vec_select:SI (match_dup 2) (parallel [(const_int 2)]))
14676 (vec_select:SI (match_dup 2) (parallel [(const_int 3)]))))))]
14679 ph<plusminus_mnemonic>d\t{%2, %0|%0, %2}
14680 vph<plusminus_mnemonic>d\t{%2, %1, %0|%0, %1, %2}"
14681 [(set_attr "isa" "noavx,avx")
14682 (set_attr "type" "sseiadd")
14683 (set_attr "atom_unit" "complex")
14684 (set_attr "prefix_data16" "1,*")
14685 (set_attr "prefix_extra" "1")
14686 (set_attr "prefix" "orig,vex")
14687 (set_attr "mode" "TI")])
14689 (define_insn "ssse3_ph<plusminus_mnemonic>dv2si3"
14690 [(set (match_operand:V2SI 0 "register_operand" "=y")
14694 (match_operand:V2SI 1 "register_operand" "0")
14695 (parallel [(const_int 0)]))
14696 (vec_select:SI (match_dup 1) (parallel [(const_int 1)])))
14699 (match_operand:V2SI 2 "nonimmediate_operand" "ym")
14700 (parallel [(const_int 0)]))
14701 (vec_select:SI (match_dup 2) (parallel [(const_int 1)])))))]
14703 "ph<plusminus_mnemonic>d\t{%2, %0|%0, %2}"
14704 [(set_attr "type" "sseiadd")
14705 (set_attr "atom_unit" "complex")
14706 (set_attr "prefix_extra" "1")
14707 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14708 (set_attr "mode" "DI")])
14710 (define_insn "avx2_pmaddubsw256"
14711 [(set (match_operand:V16HI 0 "register_operand" "=x,v")
14716 (match_operand:V32QI 1 "register_operand" "x,v")
14717 (parallel [(const_int 0) (const_int 2)
14718 (const_int 4) (const_int 6)
14719 (const_int 8) (const_int 10)
14720 (const_int 12) (const_int 14)
14721 (const_int 16) (const_int 18)
14722 (const_int 20) (const_int 22)
14723 (const_int 24) (const_int 26)
14724 (const_int 28) (const_int 30)])))
14727 (match_operand:V32QI 2 "nonimmediate_operand" "xm,vm")
14728 (parallel [(const_int 0) (const_int 2)
14729 (const_int 4) (const_int 6)
14730 (const_int 8) (const_int 10)
14731 (const_int 12) (const_int 14)
14732 (const_int 16) (const_int 18)
14733 (const_int 20) (const_int 22)
14734 (const_int 24) (const_int 26)
14735 (const_int 28) (const_int 30)]))))
14738 (vec_select:V16QI (match_dup 1)
14739 (parallel [(const_int 1) (const_int 3)
14740 (const_int 5) (const_int 7)
14741 (const_int 9) (const_int 11)
14742 (const_int 13) (const_int 15)
14743 (const_int 17) (const_int 19)
14744 (const_int 21) (const_int 23)
14745 (const_int 25) (const_int 27)
14746 (const_int 29) (const_int 31)])))
14748 (vec_select:V16QI (match_dup 2)
14749 (parallel [(const_int 1) (const_int 3)
14750 (const_int 5) (const_int 7)
14751 (const_int 9) (const_int 11)
14752 (const_int 13) (const_int 15)
14753 (const_int 17) (const_int 19)
14754 (const_int 21) (const_int 23)
14755 (const_int 25) (const_int 27)
14756 (const_int 29) (const_int 31)]))))))]
14758 "vpmaddubsw\t{%2, %1, %0|%0, %1, %2}"
14759 [(set_attr "isa" "*,avx512bw")
14760 (set_attr "type" "sseiadd")
14761 (set_attr "prefix_extra" "1")
14762 (set_attr "prefix" "vex,evex")
14763 (set_attr "mode" "OI")])
14765 ;; The correct representation for this is absolutely enormous, and
14766 ;; surely not generally useful.
14767 (define_insn "avx512bw_pmaddubsw512<mode><mask_name>"
14768 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
14769 (unspec:VI2_AVX512VL
14770 [(match_operand:<dbpsadbwmode> 1 "register_operand" "v")
14771 (match_operand:<dbpsadbwmode> 2 "nonimmediate_operand" "vm")]
14772 UNSPEC_PMADDUBSW512))]
14774 "vpmaddubsw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}";
14775 [(set_attr "type" "sseiadd")
14776 (set_attr "prefix" "evex")
14777 (set_attr "mode" "XI")])
14779 (define_insn "avx512bw_umulhrswv32hi3<mask_name>"
14780 [(set (match_operand:V32HI 0 "register_operand" "=v")
14787 (match_operand:V32HI 1 "nonimmediate_operand" "%v"))
14789 (match_operand:V32HI 2 "nonimmediate_operand" "vm")))
14791 (const_vector:V32HI [(const_int 1) (const_int 1)
14792 (const_int 1) (const_int 1)
14793 (const_int 1) (const_int 1)
14794 (const_int 1) (const_int 1)
14795 (const_int 1) (const_int 1)
14796 (const_int 1) (const_int 1)
14797 (const_int 1) (const_int 1)
14798 (const_int 1) (const_int 1)
14799 (const_int 1) (const_int 1)
14800 (const_int 1) (const_int 1)
14801 (const_int 1) (const_int 1)
14802 (const_int 1) (const_int 1)
14803 (const_int 1) (const_int 1)
14804 (const_int 1) (const_int 1)
14805 (const_int 1) (const_int 1)
14806 (const_int 1) (const_int 1)]))
14809 "vpmulhrsw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
14810 [(set_attr "type" "sseimul")
14811 (set_attr "prefix" "evex")
14812 (set_attr "mode" "XI")])
14814 (define_insn "ssse3_pmaddubsw128"
14815 [(set (match_operand:V8HI 0 "register_operand" "=x,x,v")
14820 (match_operand:V16QI 1 "register_operand" "0,x,v")
14821 (parallel [(const_int 0) (const_int 2)
14822 (const_int 4) (const_int 6)
14823 (const_int 8) (const_int 10)
14824 (const_int 12) (const_int 14)])))
14827 (match_operand:V16QI 2 "vector_operand" "xBm,xm,vm")
14828 (parallel [(const_int 0) (const_int 2)
14829 (const_int 4) (const_int 6)
14830 (const_int 8) (const_int 10)
14831 (const_int 12) (const_int 14)]))))
14834 (vec_select:V8QI (match_dup 1)
14835 (parallel [(const_int 1) (const_int 3)
14836 (const_int 5) (const_int 7)
14837 (const_int 9) (const_int 11)
14838 (const_int 13) (const_int 15)])))
14840 (vec_select:V8QI (match_dup 2)
14841 (parallel [(const_int 1) (const_int 3)
14842 (const_int 5) (const_int 7)
14843 (const_int 9) (const_int 11)
14844 (const_int 13) (const_int 15)]))))))]
14847 pmaddubsw\t{%2, %0|%0, %2}
14848 vpmaddubsw\t{%2, %1, %0|%0, %1, %2}
14849 vpmaddubsw\t{%2, %1, %0|%0, %1, %2}"
14850 [(set_attr "isa" "noavx,avx,avx512bw")
14851 (set_attr "type" "sseiadd")
14852 (set_attr "atom_unit" "simul")
14853 (set_attr "prefix_data16" "1,*,*")
14854 (set_attr "prefix_extra" "1")
14855 (set_attr "prefix" "orig,vex,evex")
14856 (set_attr "mode" "TI")])
14858 (define_insn "ssse3_pmaddubsw"
14859 [(set (match_operand:V4HI 0 "register_operand" "=y")
14864 (match_operand:V8QI 1 "register_operand" "0")
14865 (parallel [(const_int 0) (const_int 2)
14866 (const_int 4) (const_int 6)])))
14869 (match_operand:V8QI 2 "nonimmediate_operand" "ym")
14870 (parallel [(const_int 0) (const_int 2)
14871 (const_int 4) (const_int 6)]))))
14874 (vec_select:V4QI (match_dup 1)
14875 (parallel [(const_int 1) (const_int 3)
14876 (const_int 5) (const_int 7)])))
14878 (vec_select:V4QI (match_dup 2)
14879 (parallel [(const_int 1) (const_int 3)
14880 (const_int 5) (const_int 7)]))))))]
14882 "pmaddubsw\t{%2, %0|%0, %2}"
14883 [(set_attr "type" "sseiadd")
14884 (set_attr "atom_unit" "simul")
14885 (set_attr "prefix_extra" "1")
14886 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14887 (set_attr "mode" "DI")])
14889 (define_mode_iterator PMULHRSW
14890 [V4HI V8HI (V16HI "TARGET_AVX2")])
14892 (define_expand "<ssse3_avx2>_pmulhrsw<mode>3_mask"
14893 [(set (match_operand:PMULHRSW 0 "register_operand")
14894 (vec_merge:PMULHRSW
14896 (lshiftrt:<ssedoublemode>
14897 (plus:<ssedoublemode>
14898 (lshiftrt:<ssedoublemode>
14899 (mult:<ssedoublemode>
14900 (sign_extend:<ssedoublemode>
14901 (match_operand:PMULHRSW 1 "nonimmediate_operand"))
14902 (sign_extend:<ssedoublemode>
14903 (match_operand:PMULHRSW 2 "nonimmediate_operand")))
14907 (match_operand:PMULHRSW 3 "register_operand")
14908 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
14909 "TARGET_AVX512BW && TARGET_AVX512VL"
14911 operands[5] = CONST1_RTX(<MODE>mode);
14912 ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);
14915 (define_expand "<ssse3_avx2>_pmulhrsw<mode>3"
14916 [(set (match_operand:PMULHRSW 0 "register_operand")
14918 (lshiftrt:<ssedoublemode>
14919 (plus:<ssedoublemode>
14920 (lshiftrt:<ssedoublemode>
14921 (mult:<ssedoublemode>
14922 (sign_extend:<ssedoublemode>
14923 (match_operand:PMULHRSW 1 "nonimmediate_operand"))
14924 (sign_extend:<ssedoublemode>
14925 (match_operand:PMULHRSW 2 "nonimmediate_operand")))
14931 operands[3] = CONST1_RTX(<MODE>mode);
14932 ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);
14935 (define_insn "*<ssse3_avx2>_pmulhrsw<mode>3<mask_name>"
14936 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,x,v")
14938 (lshiftrt:<ssedoublemode>
14939 (plus:<ssedoublemode>
14940 (lshiftrt:<ssedoublemode>
14941 (mult:<ssedoublemode>
14942 (sign_extend:<ssedoublemode>
14943 (match_operand:VI2_AVX2 1 "vector_operand" "%0,x,v"))
14944 (sign_extend:<ssedoublemode>
14945 (match_operand:VI2_AVX2 2 "vector_operand" "xBm,xm,vm")))
14947 (match_operand:VI2_AVX2 3 "const1_operand"))
14949 "TARGET_SSSE3 && <mask_mode512bit_condition> && <mask_avx512bw_condition>
14950 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
14952 pmulhrsw\t{%2, %0|%0, %2}
14953 vpmulhrsw\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}
14954 vpmulhrsw\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}"
14955 [(set_attr "isa" "noavx,avx,avx512bw")
14956 (set_attr "type" "sseimul")
14957 (set_attr "prefix_data16" "1,*,*")
14958 (set_attr "prefix_extra" "1")
14959 (set_attr "prefix" "orig,maybe_evex,evex")
14960 (set_attr "mode" "<sseinsnmode>")])
14962 (define_insn "*ssse3_pmulhrswv4hi3"
14963 [(set (match_operand:V4HI 0 "register_operand" "=y")
14970 (match_operand:V4HI 1 "nonimmediate_operand" "%0"))
14972 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))
14974 (match_operand:V4HI 3 "const1_operand"))
14976 "TARGET_SSSE3 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
14977 "pmulhrsw\t{%2, %0|%0, %2}"
14978 [(set_attr "type" "sseimul")
14979 (set_attr "prefix_extra" "1")
14980 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14981 (set_attr "mode" "DI")])
14983 (define_insn "<ssse3_avx2>_pshufb<mode>3<mask_name>"
14984 [(set (match_operand:VI1_AVX512 0 "register_operand" "=x,x,v")
14986 [(match_operand:VI1_AVX512 1 "register_operand" "0,x,v")
14987 (match_operand:VI1_AVX512 2 "vector_operand" "xBm,xm,vm")]
14989 "TARGET_SSSE3 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
14991 pshufb\t{%2, %0|%0, %2}
14992 vpshufb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
14993 vpshufb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
14994 [(set_attr "isa" "noavx,avx,avx512bw")
14995 (set_attr "type" "sselog1")
14996 (set_attr "prefix_data16" "1,*,*")
14997 (set_attr "prefix_extra" "1")
14998 (set_attr "prefix" "orig,maybe_evex,evex")
14999 (set_attr "btver2_decode" "vector")
15000 (set_attr "mode" "<sseinsnmode>")])
15002 (define_insn "ssse3_pshufbv8qi3"
15003 [(set (match_operand:V8QI 0 "register_operand" "=y")
15004 (unspec:V8QI [(match_operand:V8QI 1 "register_operand" "0")
15005 (match_operand:V8QI 2 "nonimmediate_operand" "ym")]
15008 "pshufb\t{%2, %0|%0, %2}";
15009 [(set_attr "type" "sselog1")
15010 (set_attr "prefix_extra" "1")
15011 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
15012 (set_attr "mode" "DI")])
15014 (define_insn "<ssse3_avx2>_psign<mode>3"
15015 [(set (match_operand:VI124_AVX2 0 "register_operand" "=x,x")
15017 [(match_operand:VI124_AVX2 1 "register_operand" "0,x")
15018 (match_operand:VI124_AVX2 2 "vector_operand" "xBm,xm")]
15022 psign<ssemodesuffix>\t{%2, %0|%0, %2}
15023 vpsign<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
15024 [(set_attr "isa" "noavx,avx")
15025 (set_attr "type" "sselog1")
15026 (set_attr "prefix_data16" "1,*")
15027 (set_attr "prefix_extra" "1")
15028 (set_attr "prefix" "orig,vex")
15029 (set_attr "mode" "<sseinsnmode>")])
15031 (define_insn "ssse3_psign<mode>3"
15032 [(set (match_operand:MMXMODEI 0 "register_operand" "=y")
15034 [(match_operand:MMXMODEI 1 "register_operand" "0")
15035 (match_operand:MMXMODEI 2 "nonimmediate_operand" "ym")]
15038 "psign<mmxvecsize>\t{%2, %0|%0, %2}";
15039 [(set_attr "type" "sselog1")
15040 (set_attr "prefix_extra" "1")
15041 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
15042 (set_attr "mode" "DI")])
15044 (define_insn "<ssse3_avx2>_palignr<mode>_mask"
15045 [(set (match_operand:VI1_AVX512 0 "register_operand" "=v")
15046 (vec_merge:VI1_AVX512
15048 [(match_operand:VI1_AVX512 1 "register_operand" "v")
15049 (match_operand:VI1_AVX512 2 "nonimmediate_operand" "vm")
15050 (match_operand:SI 3 "const_0_to_255_mul_8_operand" "n")]
15052 (match_operand:VI1_AVX512 4 "vector_move_operand" "0C")
15053 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
15054 "TARGET_AVX512BW && (<MODE_SIZE> == 64 || TARGET_AVX512VL)"
15056 operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
15057 return "vpalignr\t{%3, %2, %1, %0%{%5%}%N4|%0%{%5%}%N4, %1, %2, %3}";
15059 [(set_attr "type" "sseishft")
15060 (set_attr "atom_unit" "sishuf")
15061 (set_attr "prefix_extra" "1")
15062 (set_attr "length_immediate" "1")
15063 (set_attr "prefix" "evex")
15064 (set_attr "mode" "<sseinsnmode>")])
15066 (define_insn "<ssse3_avx2>_palignr<mode>"
15067 [(set (match_operand:SSESCALARMODE 0 "register_operand" "=x,x,v")
15068 (unspec:SSESCALARMODE
15069 [(match_operand:SSESCALARMODE 1 "register_operand" "0,x,v")
15070 (match_operand:SSESCALARMODE 2 "vector_operand" "xBm,xm,vm")
15071 (match_operand:SI 3 "const_0_to_255_mul_8_operand" "n,n,n")]
15075 operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
15077 switch (which_alternative)
15080 return "palignr\t{%3, %2, %0|%0, %2, %3}";
15083 return "vpalignr\t{%3, %2, %1, %0|%0, %1, %2, %3}";
15085 gcc_unreachable ();
15088 [(set_attr "isa" "noavx,avx,avx512bw")
15089 (set_attr "type" "sseishft")
15090 (set_attr "atom_unit" "sishuf")
15091 (set_attr "prefix_data16" "1,*,*")
15092 (set_attr "prefix_extra" "1")
15093 (set_attr "length_immediate" "1")
15094 (set_attr "prefix" "orig,vex,evex")
15095 (set_attr "mode" "<sseinsnmode>")])
15097 (define_insn "ssse3_palignrdi"
15098 [(set (match_operand:DI 0 "register_operand" "=y")
15099 (unspec:DI [(match_operand:DI 1 "register_operand" "0")
15100 (match_operand:DI 2 "nonimmediate_operand" "ym")
15101 (match_operand:SI 3 "const_0_to_255_mul_8_operand" "n")]
15105 operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
15106 return "palignr\t{%3, %2, %0|%0, %2, %3}";
15108 [(set_attr "type" "sseishft")
15109 (set_attr "atom_unit" "sishuf")
15110 (set_attr "prefix_extra" "1")
15111 (set_attr "length_immediate" "1")
15112 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
15113 (set_attr "mode" "DI")])
15115 ;; Mode iterator to handle singularity w/ absence of V2DI and V4DI
15116 ;; modes for abs instruction on pre AVX-512 targets.
15117 (define_mode_iterator VI1248_AVX512VL_AVX512BW
15118 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI
15119 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI
15120 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX2") V4SI
15121 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")])
15123 (define_insn "*abs<mode>2"
15124 [(set (match_operand:VI1248_AVX512VL_AVX512BW 0 "register_operand" "=v")
15125 (abs:VI1248_AVX512VL_AVX512BW
15126 (match_operand:VI1248_AVX512VL_AVX512BW 1 "vector_operand" "vBm")))]
15128 "%vpabs<ssemodesuffix>\t{%1, %0|%0, %1}"
15129 [(set_attr "type" "sselog1")
15130 (set_attr "prefix_data16" "1")
15131 (set_attr "prefix_extra" "1")
15132 (set_attr "prefix" "maybe_vex")
15133 (set_attr "mode" "<sseinsnmode>")])
15135 (define_insn "abs<mode>2_mask"
15136 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
15137 (vec_merge:VI48_AVX512VL
15139 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm"))
15140 (match_operand:VI48_AVX512VL 2 "vector_move_operand" "0C")
15141 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
15143 "vpabs<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
15144 [(set_attr "type" "sselog1")
15145 (set_attr "prefix" "evex")
15146 (set_attr "mode" "<sseinsnmode>")])
15148 (define_insn "abs<mode>2_mask"
15149 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
15150 (vec_merge:VI12_AVX512VL
15152 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "vm"))
15153 (match_operand:VI12_AVX512VL 2 "vector_move_operand" "0C")
15154 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
15156 "vpabs<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
15157 [(set_attr "type" "sselog1")
15158 (set_attr "prefix" "evex")
15159 (set_attr "mode" "<sseinsnmode>")])
15161 (define_expand "abs<mode>2"
15162 [(set (match_operand:VI_AVX2 0 "register_operand")
15164 (match_operand:VI_AVX2 1 "vector_operand")))]
15168 || ((<MODE>mode == V2DImode || <MODE>mode == V4DImode)
15169 && !TARGET_AVX512VL))
15171 ix86_expand_sse2_abs (operands[0], operands[1]);
15176 (define_insn "abs<mode>2"
15177 [(set (match_operand:MMXMODEI 0 "register_operand" "=y")
15179 (match_operand:MMXMODEI 1 "nonimmediate_operand" "ym")))]
15181 "pabs<mmxvecsize>\t{%1, %0|%0, %1}";
15182 [(set_attr "type" "sselog1")
15183 (set_attr "prefix_rep" "0")
15184 (set_attr "prefix_extra" "1")
15185 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
15186 (set_attr "mode" "DI")])
15188 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15190 ;; AMD SSE4A instructions
15192 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15194 (define_insn "sse4a_movnt<mode>"
15195 [(set (match_operand:MODEF 0 "memory_operand" "=m")
15197 [(match_operand:MODEF 1 "register_operand" "x")]
15200 "movnt<ssemodesuffix>\t{%1, %0|%0, %1}"
15201 [(set_attr "type" "ssemov")
15202 (set_attr "mode" "<MODE>")])
15204 (define_insn "sse4a_vmmovnt<mode>"
15205 [(set (match_operand:<ssescalarmode> 0 "memory_operand" "=m")
15206 (unspec:<ssescalarmode>
15207 [(vec_select:<ssescalarmode>
15208 (match_operand:VF_128 1 "register_operand" "x")
15209 (parallel [(const_int 0)]))]
15212 "movnt<ssescalarmodesuffix>\t{%1, %0|%0, %1}"
15213 [(set_attr "type" "ssemov")
15214 (set_attr "mode" "<ssescalarmode>")])
15216 (define_insn "sse4a_extrqi"
15217 [(set (match_operand:V2DI 0 "register_operand" "=x")
15218 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
15219 (match_operand 2 "const_0_to_255_operand")
15220 (match_operand 3 "const_0_to_255_operand")]
15223 "extrq\t{%3, %2, %0|%0, %2, %3}"
15224 [(set_attr "type" "sse")
15225 (set_attr "prefix_data16" "1")
15226 (set_attr "length_immediate" "2")
15227 (set_attr "mode" "TI")])
15229 (define_insn "sse4a_extrq"
15230 [(set (match_operand:V2DI 0 "register_operand" "=x")
15231 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
15232 (match_operand:V16QI 2 "register_operand" "x")]
15235 "extrq\t{%2, %0|%0, %2}"
15236 [(set_attr "type" "sse")
15237 (set_attr "prefix_data16" "1")
15238 (set_attr "mode" "TI")])
15240 (define_insn "sse4a_insertqi"
15241 [(set (match_operand:V2DI 0 "register_operand" "=x")
15242 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
15243 (match_operand:V2DI 2 "register_operand" "x")
15244 (match_operand 3 "const_0_to_255_operand")
15245 (match_operand 4 "const_0_to_255_operand")]
15248 "insertq\t{%4, %3, %2, %0|%0, %2, %3, %4}"
15249 [(set_attr "type" "sseins")
15250 (set_attr "prefix_data16" "0")
15251 (set_attr "prefix_rep" "1")
15252 (set_attr "length_immediate" "2")
15253 (set_attr "mode" "TI")])
15255 (define_insn "sse4a_insertq"
15256 [(set (match_operand:V2DI 0 "register_operand" "=x")
15257 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
15258 (match_operand:V2DI 2 "register_operand" "x")]
15261 "insertq\t{%2, %0|%0, %2}"
15262 [(set_attr "type" "sseins")
15263 (set_attr "prefix_data16" "0")
15264 (set_attr "prefix_rep" "1")
15265 (set_attr "mode" "TI")])
15267 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15269 ;; Intel SSE4.1 instructions
15271 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15273 ;; Mapping of immediate bits for blend instructions
15274 (define_mode_attr blendbits
15275 [(V8SF "255") (V4SF "15") (V4DF "15") (V2DF "3")])
15277 (define_insn "<sse4_1>_blend<ssemodesuffix><avxsizesuffix>"
15278 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
15279 (vec_merge:VF_128_256
15280 (match_operand:VF_128_256 2 "vector_operand" "YrBm,*xBm,xm")
15281 (match_operand:VF_128_256 1 "register_operand" "0,0,x")
15282 (match_operand:SI 3 "const_0_to_<blendbits>_operand")))]
15285 blend<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15286 blend<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15287 vblend<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15288 [(set_attr "isa" "noavx,noavx,avx")
15289 (set_attr "type" "ssemov")
15290 (set_attr "length_immediate" "1")
15291 (set_attr "prefix_data16" "1,1,*")
15292 (set_attr "prefix_extra" "1")
15293 (set_attr "prefix" "orig,orig,vex")
15294 (set_attr "mode" "<MODE>")])
15296 (define_insn "<sse4_1>_blendv<ssemodesuffix><avxsizesuffix>"
15297 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
15299 [(match_operand:VF_128_256 1 "register_operand" "0,0,x")
15300 (match_operand:VF_128_256 2 "vector_operand" "YrBm,*xBm,xm")
15301 (match_operand:VF_128_256 3 "register_operand" "Yz,Yz,x")]
15305 blendv<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15306 blendv<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15307 vblendv<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15308 [(set_attr "isa" "noavx,noavx,avx")
15309 (set_attr "type" "ssemov")
15310 (set_attr "length_immediate" "1")
15311 (set_attr "prefix_data16" "1,1,*")
15312 (set_attr "prefix_extra" "1")
15313 (set_attr "prefix" "orig,orig,vex")
15314 (set_attr "btver2_decode" "vector,vector,vector")
15315 (set_attr "mode" "<MODE>")])
15317 (define_insn "<sse4_1>_dp<ssemodesuffix><avxsizesuffix>"
15318 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
15320 [(match_operand:VF_128_256 1 "vector_operand" "%0,0,x")
15321 (match_operand:VF_128_256 2 "vector_operand" "YrBm,*xBm,xm")
15322 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")]
15326 dp<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15327 dp<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15328 vdp<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15329 [(set_attr "isa" "noavx,noavx,avx")
15330 (set_attr "type" "ssemul")
15331 (set_attr "length_immediate" "1")
15332 (set_attr "prefix_data16" "1,1,*")
15333 (set_attr "prefix_extra" "1")
15334 (set_attr "prefix" "orig,orig,vex")
15335 (set_attr "btver2_decode" "vector,vector,vector")
15336 (set_attr "znver1_decode" "vector,vector,vector")
15337 (set_attr "mode" "<MODE>")])
15339 ;; Mode attribute used by `vmovntdqa' pattern
15340 (define_mode_attr vi8_sse4_1_avx2_avx512
15341 [(V2DI "sse4_1") (V4DI "avx2") (V8DI "avx512f")])
15343 (define_insn "<vi8_sse4_1_avx2_avx512>_movntdqa"
15344 [(set (match_operand:VI8_AVX2_AVX512F 0 "register_operand" "=Yr,*x,v")
15345 (unspec:VI8_AVX2_AVX512F [(match_operand:VI8_AVX2_AVX512F 1 "memory_operand" "m,m,m")]
15348 "%vmovntdqa\t{%1, %0|%0, %1}"
15349 [(set_attr "isa" "noavx,noavx,avx")
15350 (set_attr "type" "ssemov")
15351 (set_attr "prefix_extra" "1,1,*")
15352 (set_attr "prefix" "orig,orig,maybe_evex")
15353 (set_attr "mode" "<sseinsnmode>")])
15355 (define_insn "<sse4_1_avx2>_mpsadbw"
15356 [(set (match_operand:VI1_AVX2 0 "register_operand" "=Yr,*x,x")
15358 [(match_operand:VI1_AVX2 1 "register_operand" "0,0,x")
15359 (match_operand:VI1_AVX2 2 "vector_operand" "YrBm,*xBm,xm")
15360 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")]
15364 mpsadbw\t{%3, %2, %0|%0, %2, %3}
15365 mpsadbw\t{%3, %2, %0|%0, %2, %3}
15366 vmpsadbw\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15367 [(set_attr "isa" "noavx,noavx,avx")
15368 (set_attr "type" "sselog1")
15369 (set_attr "length_immediate" "1")
15370 (set_attr "prefix_extra" "1")
15371 (set_attr "prefix" "orig,orig,vex")
15372 (set_attr "btver2_decode" "vector,vector,vector")
15373 (set_attr "znver1_decode" "vector,vector,vector")
15374 (set_attr "mode" "<sseinsnmode>")])
15376 (define_insn "<sse4_1_avx2>_packusdw<mask_name>"
15377 [(set (match_operand:VI2_AVX2 0 "register_operand" "=Yr,*x,x,v")
15378 (vec_concat:VI2_AVX2
15379 (us_truncate:<ssehalfvecmode>
15380 (match_operand:<sseunpackmode> 1 "register_operand" "0,0,x,v"))
15381 (us_truncate:<ssehalfvecmode>
15382 (match_operand:<sseunpackmode> 2 "vector_operand" "YrBm,*xBm,xm,vm"))))]
15383 "TARGET_SSE4_1 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
15385 packusdw\t{%2, %0|%0, %2}
15386 packusdw\t{%2, %0|%0, %2}
15387 vpackusdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
15388 vpackusdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
15389 [(set_attr "isa" "noavx,noavx,avx,avx512bw")
15390 (set_attr "type" "sselog")
15391 (set_attr "prefix_extra" "1")
15392 (set_attr "prefix" "orig,orig,<mask_prefix>,evex")
15393 (set_attr "mode" "<sseinsnmode>")])
15395 (define_insn "<sse4_1_avx2>_pblendvb"
15396 [(set (match_operand:VI1_AVX2 0 "register_operand" "=Yr,*x,x")
15398 [(match_operand:VI1_AVX2 1 "register_operand" "0,0,x")
15399 (match_operand:VI1_AVX2 2 "vector_operand" "YrBm,*xBm,xm")
15400 (match_operand:VI1_AVX2 3 "register_operand" "Yz,Yz,x")]
15404 pblendvb\t{%3, %2, %0|%0, %2, %3}
15405 pblendvb\t{%3, %2, %0|%0, %2, %3}
15406 vpblendvb\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15407 [(set_attr "isa" "noavx,noavx,avx")
15408 (set_attr "type" "ssemov")
15409 (set_attr "prefix_extra" "1")
15410 (set_attr "length_immediate" "*,*,1")
15411 (set_attr "prefix" "orig,orig,vex")
15412 (set_attr "btver2_decode" "vector,vector,vector")
15413 (set_attr "mode" "<sseinsnmode>")])
15415 (define_insn "sse4_1_pblendw"
15416 [(set (match_operand:V8HI 0 "register_operand" "=Yr,*x,x")
15418 (match_operand:V8HI 2 "vector_operand" "YrBm,*xBm,xm")
15419 (match_operand:V8HI 1 "register_operand" "0,0,x")
15420 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")))]
15423 pblendw\t{%3, %2, %0|%0, %2, %3}
15424 pblendw\t{%3, %2, %0|%0, %2, %3}
15425 vpblendw\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15426 [(set_attr "isa" "noavx,noavx,avx")
15427 (set_attr "type" "ssemov")
15428 (set_attr "prefix_extra" "1")
15429 (set_attr "length_immediate" "1")
15430 (set_attr "prefix" "orig,orig,vex")
15431 (set_attr "mode" "TI")])
15433 ;; The builtin uses an 8-bit immediate. Expand that.
15434 (define_expand "avx2_pblendw"
15435 [(set (match_operand:V16HI 0 "register_operand")
15437 (match_operand:V16HI 2 "nonimmediate_operand")
15438 (match_operand:V16HI 1 "register_operand")
15439 (match_operand:SI 3 "const_0_to_255_operand")))]
15442 HOST_WIDE_INT val = INTVAL (operands[3]) & 0xff;
15443 operands[3] = GEN_INT (val << 8 | val);
15446 (define_insn "*avx2_pblendw"
15447 [(set (match_operand:V16HI 0 "register_operand" "=x")
15449 (match_operand:V16HI 2 "nonimmediate_operand" "xm")
15450 (match_operand:V16HI 1 "register_operand" "x")
15451 (match_operand:SI 3 "avx2_pblendw_operand" "n")))]
15454 operands[3] = GEN_INT (INTVAL (operands[3]) & 0xff);
15455 return "vpblendw\t{%3, %2, %1, %0|%0, %1, %2, %3}";
15457 [(set_attr "type" "ssemov")
15458 (set_attr "prefix_extra" "1")
15459 (set_attr "length_immediate" "1")
15460 (set_attr "prefix" "vex")
15461 (set_attr "mode" "OI")])
15463 (define_insn "avx2_pblendd<mode>"
15464 [(set (match_operand:VI4_AVX2 0 "register_operand" "=x")
15465 (vec_merge:VI4_AVX2
15466 (match_operand:VI4_AVX2 2 "nonimmediate_operand" "xm")
15467 (match_operand:VI4_AVX2 1 "register_operand" "x")
15468 (match_operand:SI 3 "const_0_to_255_operand" "n")))]
15470 "vpblendd\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15471 [(set_attr "type" "ssemov")
15472 (set_attr "prefix_extra" "1")
15473 (set_attr "length_immediate" "1")
15474 (set_attr "prefix" "vex")
15475 (set_attr "mode" "<sseinsnmode>")])
15477 (define_insn "sse4_1_phminposuw"
15478 [(set (match_operand:V8HI 0 "register_operand" "=Yr,*x,x")
15479 (unspec:V8HI [(match_operand:V8HI 1 "vector_operand" "YrBm,*xBm,xm")]
15480 UNSPEC_PHMINPOSUW))]
15482 "%vphminposuw\t{%1, %0|%0, %1}"
15483 [(set_attr "isa" "noavx,noavx,avx")
15484 (set_attr "type" "sselog1")
15485 (set_attr "prefix_extra" "1")
15486 (set_attr "prefix" "orig,orig,vex")
15487 (set_attr "mode" "TI")])
15489 (define_insn "avx2_<code>v16qiv16hi2<mask_name>"
15490 [(set (match_operand:V16HI 0 "register_operand" "=v")
15492 (match_operand:V16QI 1 "nonimmediate_operand" "vm")))]
15493 "TARGET_AVX2 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
15494 "vpmov<extsuffix>bw\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15495 [(set_attr "type" "ssemov")
15496 (set_attr "prefix_extra" "1")
15497 (set_attr "prefix" "maybe_evex")
15498 (set_attr "mode" "OI")])
15500 (define_insn "avx512bw_<code>v32qiv32hi2<mask_name>"
15501 [(set (match_operand:V32HI 0 "register_operand" "=v")
15503 (match_operand:V32QI 1 "nonimmediate_operand" "vm")))]
15505 "vpmov<extsuffix>bw\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15506 [(set_attr "type" "ssemov")
15507 (set_attr "prefix_extra" "1")
15508 (set_attr "prefix" "evex")
15509 (set_attr "mode" "XI")])
15511 (define_insn "sse4_1_<code>v8qiv8hi2<mask_name>"
15512 [(set (match_operand:V8HI 0 "register_operand" "=Yr,*x,v")
15515 (match_operand:V16QI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15516 (parallel [(const_int 0) (const_int 1)
15517 (const_int 2) (const_int 3)
15518 (const_int 4) (const_int 5)
15519 (const_int 6) (const_int 7)]))))]
15520 "TARGET_SSE4_1 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
15521 "%vpmov<extsuffix>bw\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15522 [(set_attr "isa" "noavx,noavx,avx")
15523 (set_attr "type" "ssemov")
15524 (set_attr "prefix_extra" "1")
15525 (set_attr "prefix" "orig,orig,maybe_evex")
15526 (set_attr "mode" "TI")])
15528 (define_insn "<mask_codefor>avx512f_<code>v16qiv16si2<mask_name>"
15529 [(set (match_operand:V16SI 0 "register_operand" "=v")
15531 (match_operand:V16QI 1 "nonimmediate_operand" "vm")))]
15533 "vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15534 [(set_attr "type" "ssemov")
15535 (set_attr "prefix" "evex")
15536 (set_attr "mode" "XI")])
15538 (define_insn "avx2_<code>v8qiv8si2<mask_name>"
15539 [(set (match_operand:V8SI 0 "register_operand" "=v")
15542 (match_operand:V16QI 1 "nonimmediate_operand" "vm")
15543 (parallel [(const_int 0) (const_int 1)
15544 (const_int 2) (const_int 3)
15545 (const_int 4) (const_int 5)
15546 (const_int 6) (const_int 7)]))))]
15547 "TARGET_AVX2 && <mask_avx512vl_condition>"
15548 "vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15549 [(set_attr "type" "ssemov")
15550 (set_attr "prefix_extra" "1")
15551 (set_attr "prefix" "maybe_evex")
15552 (set_attr "mode" "OI")])
15554 (define_insn "sse4_1_<code>v4qiv4si2<mask_name>"
15555 [(set (match_operand:V4SI 0 "register_operand" "=Yr,*x,v")
15558 (match_operand:V16QI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15559 (parallel [(const_int 0) (const_int 1)
15560 (const_int 2) (const_int 3)]))))]
15561 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15562 "%vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
15563 [(set_attr "isa" "noavx,noavx,avx")
15564 (set_attr "type" "ssemov")
15565 (set_attr "prefix_extra" "1")
15566 (set_attr "prefix" "orig,orig,maybe_evex")
15567 (set_attr "mode" "TI")])
15569 (define_insn "avx512f_<code>v16hiv16si2<mask_name>"
15570 [(set (match_operand:V16SI 0 "register_operand" "=v")
15572 (match_operand:V16HI 1 "nonimmediate_operand" "vm")))]
15574 "vpmov<extsuffix>wd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15575 [(set_attr "type" "ssemov")
15576 (set_attr "prefix" "evex")
15577 (set_attr "mode" "XI")])
15579 (define_insn "avx2_<code>v8hiv8si2<mask_name>"
15580 [(set (match_operand:V8SI 0 "register_operand" "=v")
15582 (match_operand:V8HI 1 "nonimmediate_operand" "vm")))]
15583 "TARGET_AVX2 && <mask_avx512vl_condition>"
15584 "vpmov<extsuffix>wd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15585 [(set_attr "type" "ssemov")
15586 (set_attr "prefix_extra" "1")
15587 (set_attr "prefix" "maybe_evex")
15588 (set_attr "mode" "OI")])
15590 (define_insn "sse4_1_<code>v4hiv4si2<mask_name>"
15591 [(set (match_operand:V4SI 0 "register_operand" "=Yr,*x,v")
15594 (match_operand:V8HI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15595 (parallel [(const_int 0) (const_int 1)
15596 (const_int 2) (const_int 3)]))))]
15597 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15598 "%vpmov<extsuffix>wd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15599 [(set_attr "isa" "noavx,noavx,avx")
15600 (set_attr "type" "ssemov")
15601 (set_attr "prefix_extra" "1")
15602 (set_attr "prefix" "orig,orig,maybe_evex")
15603 (set_attr "mode" "TI")])
15605 (define_insn "avx512f_<code>v8qiv8di2<mask_name>"
15606 [(set (match_operand:V8DI 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)]))))]
15615 "vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
15616 [(set_attr "type" "ssemov")
15617 (set_attr "prefix" "evex")
15618 (set_attr "mode" "XI")])
15620 (define_insn "avx2_<code>v4qiv4di2<mask_name>"
15621 [(set (match_operand:V4DI 0 "register_operand" "=v")
15624 (match_operand:V16QI 1 "nonimmediate_operand" "vm")
15625 (parallel [(const_int 0) (const_int 1)
15626 (const_int 2) (const_int 3)]))))]
15627 "TARGET_AVX2 && <mask_avx512vl_condition>"
15628 "vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
15629 [(set_attr "type" "ssemov")
15630 (set_attr "prefix_extra" "1")
15631 (set_attr "prefix" "maybe_evex")
15632 (set_attr "mode" "OI")])
15634 (define_insn "sse4_1_<code>v2qiv2di2<mask_name>"
15635 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
15638 (match_operand:V16QI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15639 (parallel [(const_int 0) (const_int 1)]))))]
15640 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15641 "%vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %w1}"
15642 [(set_attr "isa" "noavx,noavx,avx")
15643 (set_attr "type" "ssemov")
15644 (set_attr "prefix_extra" "1")
15645 (set_attr "prefix" "orig,orig,maybe_evex")
15646 (set_attr "mode" "TI")])
15648 (define_insn "avx512f_<code>v8hiv8di2<mask_name>"
15649 [(set (match_operand:V8DI 0 "register_operand" "=v")
15651 (match_operand:V8HI 1 "nonimmediate_operand" "vm")))]
15653 "vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15654 [(set_attr "type" "ssemov")
15655 (set_attr "prefix" "evex")
15656 (set_attr "mode" "XI")])
15658 (define_insn "avx2_<code>v4hiv4di2<mask_name>"
15659 [(set (match_operand:V4DI 0 "register_operand" "=v")
15662 (match_operand:V8HI 1 "nonimmediate_operand" "vm")
15663 (parallel [(const_int 0) (const_int 1)
15664 (const_int 2) (const_int 3)]))))]
15665 "TARGET_AVX2 && <mask_avx512vl_condition>"
15666 "vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15667 [(set_attr "type" "ssemov")
15668 (set_attr "prefix_extra" "1")
15669 (set_attr "prefix" "maybe_evex")
15670 (set_attr "mode" "OI")])
15672 (define_insn "sse4_1_<code>v2hiv2di2<mask_name>"
15673 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
15676 (match_operand:V8HI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15677 (parallel [(const_int 0) (const_int 1)]))))]
15678 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15679 "%vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
15680 [(set_attr "isa" "noavx,noavx,avx")
15681 (set_attr "type" "ssemov")
15682 (set_attr "prefix_extra" "1")
15683 (set_attr "prefix" "orig,orig,maybe_evex")
15684 (set_attr "mode" "TI")])
15686 (define_insn "avx512f_<code>v8siv8di2<mask_name>"
15687 [(set (match_operand:V8DI 0 "register_operand" "=v")
15689 (match_operand:V8SI 1 "nonimmediate_operand" "vm")))]
15691 "vpmov<extsuffix>dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15692 [(set_attr "type" "ssemov")
15693 (set_attr "prefix" "evex")
15694 (set_attr "mode" "XI")])
15696 (define_insn "avx2_<code>v4siv4di2<mask_name>"
15697 [(set (match_operand:V4DI 0 "register_operand" "=v")
15699 (match_operand:V4SI 1 "nonimmediate_operand" "vm")))]
15700 "TARGET_AVX2 && <mask_avx512vl_condition>"
15701 "vpmov<extsuffix>dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15702 [(set_attr "type" "ssemov")
15703 (set_attr "prefix" "maybe_evex")
15704 (set_attr "prefix_extra" "1")
15705 (set_attr "mode" "OI")])
15707 (define_insn "sse4_1_<code>v2siv2di2<mask_name>"
15708 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
15711 (match_operand:V4SI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15712 (parallel [(const_int 0) (const_int 1)]))))]
15713 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15714 "%vpmov<extsuffix>dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15715 [(set_attr "isa" "noavx,noavx,avx")
15716 (set_attr "type" "ssemov")
15717 (set_attr "prefix_extra" "1")
15718 (set_attr "prefix" "orig,orig,maybe_evex")
15719 (set_attr "mode" "TI")])
15721 ;; ptestps/ptestpd are very similar to comiss and ucomiss when
15722 ;; setting FLAGS_REG. But it is not a really compare instruction.
15723 (define_insn "avx_vtest<ssemodesuffix><avxsizesuffix>"
15724 [(set (reg:CC FLAGS_REG)
15725 (unspec:CC [(match_operand:VF_128_256 0 "register_operand" "x")
15726 (match_operand:VF_128_256 1 "nonimmediate_operand" "xm")]
15729 "vtest<ssemodesuffix>\t{%1, %0|%0, %1}"
15730 [(set_attr "type" "ssecomi")
15731 (set_attr "prefix_extra" "1")
15732 (set_attr "prefix" "vex")
15733 (set_attr "mode" "<MODE>")])
15735 ;; ptest is very similar to comiss and ucomiss when setting FLAGS_REG.
15736 ;; But it is not a really compare instruction.
15737 (define_insn "<sse4_1>_ptest<mode>"
15738 [(set (reg:CC FLAGS_REG)
15739 (unspec:CC [(match_operand:V_AVX 0 "register_operand" "Yr, *x, x")
15740 (match_operand:V_AVX 1 "vector_operand" "YrBm, *xBm, xm")]
15743 "%vptest\t{%1, %0|%0, %1}"
15744 [(set_attr "isa" "noavx,noavx,avx")
15745 (set_attr "type" "ssecomi")
15746 (set_attr "prefix_extra" "1")
15747 (set_attr "prefix" "orig,orig,vex")
15748 (set (attr "btver2_decode")
15750 (match_test "<sseinsnmode>mode==OImode")
15751 (const_string "vector")
15752 (const_string "*")))
15753 (set_attr "mode" "<sseinsnmode>")])
15755 (define_insn "ptesttf2"
15756 [(set (reg:CC FLAGS_REG)
15757 (unspec:CC [(match_operand:TF 0 "register_operand" "Yr, *x, x")
15758 (match_operand:TF 1 "vector_operand" "YrBm, *xBm, xm")]
15761 "%vptest\t{%1, %0|%0, %1}"
15762 [(set_attr "isa" "noavx,noavx,avx")
15763 (set_attr "type" "ssecomi")
15764 (set_attr "prefix_extra" "1")
15765 (set_attr "prefix" "orig,orig,vex")
15766 (set_attr "mode" "TI")])
15768 (define_insn "<sse4_1>_round<ssemodesuffix><avxsizesuffix>"
15769 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
15771 [(match_operand:VF_128_256 1 "vector_operand" "YrBm,*xBm,xm")
15772 (match_operand:SI 2 "const_0_to_15_operand" "n,n,n")]
15775 "%vround<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
15776 [(set_attr "isa" "noavx,noavx,avx")
15777 (set_attr "type" "ssecvt")
15778 (set_attr "prefix_data16" "1,1,*")
15779 (set_attr "prefix_extra" "1")
15780 (set_attr "length_immediate" "1")
15781 (set_attr "prefix" "orig,orig,vex")
15782 (set_attr "mode" "<MODE>")])
15784 (define_expand "<sse4_1>_round<ssemodesuffix>_sfix<avxsizesuffix>"
15785 [(match_operand:<sseintvecmode> 0 "register_operand")
15786 (match_operand:VF1_128_256 1 "vector_operand")
15787 (match_operand:SI 2 "const_0_to_15_operand")]
15790 rtx tmp = gen_reg_rtx (<MODE>mode);
15793 (gen_<sse4_1>_round<ssemodesuffix><avxsizesuffix> (tmp, operands[1],
15796 (gen_fix_trunc<mode><sseintvecmodelower>2 (operands[0], tmp));
15800 (define_expand "avx512f_round<castmode>512"
15801 [(match_operand:VF_512 0 "register_operand")
15802 (match_operand:VF_512 1 "nonimmediate_operand")
15803 (match_operand:SI 2 "const_0_to_15_operand")]
15806 emit_insn (gen_avx512f_rndscale<mode> (operands[0], operands[1], operands[2]));
15810 (define_expand "avx512f_roundps512_sfix"
15811 [(match_operand:V16SI 0 "register_operand")
15812 (match_operand:V16SF 1 "nonimmediate_operand")
15813 (match_operand:SI 2 "const_0_to_15_operand")]
15816 rtx tmp = gen_reg_rtx (V16SFmode);
15817 emit_insn (gen_avx512f_rndscalev16sf (tmp, operands[1], operands[2]));
15818 emit_insn (gen_fix_truncv16sfv16si2 (operands[0], tmp));
15822 (define_expand "<sse4_1>_round<ssemodesuffix>_vec_pack_sfix<avxsizesuffix>"
15823 [(match_operand:<ssepackfltmode> 0 "register_operand")
15824 (match_operand:VF2 1 "vector_operand")
15825 (match_operand:VF2 2 "vector_operand")
15826 (match_operand:SI 3 "const_0_to_15_operand")]
15831 if (<MODE>mode == V2DFmode
15832 && TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
15834 rtx tmp2 = gen_reg_rtx (V4DFmode);
15836 tmp0 = gen_reg_rtx (V4DFmode);
15837 tmp1 = force_reg (V2DFmode, operands[1]);
15839 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
15840 emit_insn (gen_avx_roundpd256 (tmp2, tmp0, operands[3]));
15841 emit_insn (gen_fix_truncv4dfv4si2 (operands[0], tmp2));
15845 tmp0 = gen_reg_rtx (<MODE>mode);
15846 tmp1 = gen_reg_rtx (<MODE>mode);
15849 (gen_<sse4_1>_round<ssemodesuffix><avxsizesuffix> (tmp0, operands[1],
15852 (gen_<sse4_1>_round<ssemodesuffix><avxsizesuffix> (tmp1, operands[2],
15855 (gen_vec_pack_sfix_trunc_<mode> (operands[0], tmp0, tmp1));
15860 (define_insn "sse4_1_round<ssescalarmodesuffix>"
15861 [(set (match_operand:VF_128 0 "register_operand" "=Yr,*x,x,v")
15864 [(match_operand:VF_128 2 "register_operand" "Yr,*x,x,v")
15865 (match_operand:SI 3 "const_0_to_15_operand" "n,n,n,n")]
15867 (match_operand:VF_128 1 "register_operand" "0,0,x,v")
15871 round<ssescalarmodesuffix>\t{%3, %2, %0|%0, %2, %3}
15872 round<ssescalarmodesuffix>\t{%3, %2, %0|%0, %2, %3}
15873 vround<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
15874 vrndscale<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15875 [(set_attr "isa" "noavx,noavx,avx,avx512f")
15876 (set_attr "type" "ssecvt")
15877 (set_attr "length_immediate" "1")
15878 (set_attr "prefix_data16" "1,1,*,*")
15879 (set_attr "prefix_extra" "1")
15880 (set_attr "prefix" "orig,orig,vex,evex")
15881 (set_attr "mode" "<MODE>")])
15883 (define_expand "round<mode>2"
15884 [(set (match_dup 3)
15886 (match_operand:VF 1 "register_operand")
15888 (set (match_operand:VF 0 "register_operand")
15890 [(match_dup 3) (match_dup 4)]
15892 "TARGET_SSE4_1 && !flag_trapping_math"
15894 machine_mode scalar_mode;
15895 const struct real_format *fmt;
15896 REAL_VALUE_TYPE pred_half, half_minus_pred_half;
15897 rtx half, vec_half;
15899 scalar_mode = GET_MODE_INNER (<MODE>mode);
15901 /* load nextafter (0.5, 0.0) */
15902 fmt = REAL_MODE_FORMAT (scalar_mode);
15903 real_2expN (&half_minus_pred_half, -(fmt->p) - 1, scalar_mode);
15904 real_arithmetic (&pred_half, MINUS_EXPR, &dconsthalf, &half_minus_pred_half);
15905 half = const_double_from_real_value (pred_half, scalar_mode);
15907 vec_half = ix86_build_const_vector (<MODE>mode, true, half);
15908 vec_half = force_reg (<MODE>mode, vec_half);
15910 operands[2] = gen_reg_rtx (<MODE>mode);
15911 emit_insn (gen_copysign<mode>3 (operands[2], vec_half, operands[1]));
15913 operands[3] = gen_reg_rtx (<MODE>mode);
15914 operands[4] = GEN_INT (ROUND_TRUNC);
15917 (define_expand "round<mode>2_sfix"
15918 [(match_operand:<sseintvecmode> 0 "register_operand")
15919 (match_operand:VF1 1 "register_operand")]
15920 "TARGET_SSE4_1 && !flag_trapping_math"
15922 rtx tmp = gen_reg_rtx (<MODE>mode);
15924 emit_insn (gen_round<mode>2 (tmp, operands[1]));
15927 (gen_fix_trunc<mode><sseintvecmodelower>2 (operands[0], tmp));
15931 (define_expand "round<mode>2_vec_pack_sfix"
15932 [(match_operand:<ssepackfltmode> 0 "register_operand")
15933 (match_operand:VF2 1 "register_operand")
15934 (match_operand:VF2 2 "register_operand")]
15935 "TARGET_SSE4_1 && !flag_trapping_math"
15939 if (<MODE>mode == V2DFmode
15940 && TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
15942 rtx tmp2 = gen_reg_rtx (V4DFmode);
15944 tmp0 = gen_reg_rtx (V4DFmode);
15945 tmp1 = force_reg (V2DFmode, operands[1]);
15947 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
15948 emit_insn (gen_roundv4df2 (tmp2, tmp0));
15949 emit_insn (gen_fix_truncv4dfv4si2 (operands[0], tmp2));
15953 tmp0 = gen_reg_rtx (<MODE>mode);
15954 tmp1 = gen_reg_rtx (<MODE>mode);
15956 emit_insn (gen_round<mode>2 (tmp0, operands[1]));
15957 emit_insn (gen_round<mode>2 (tmp1, operands[2]));
15960 (gen_vec_pack_sfix_trunc_<mode> (operands[0], tmp0, tmp1));
15965 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15967 ;; Intel SSE4.2 string/text processing instructions
15969 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15971 (define_insn_and_split "sse4_2_pcmpestr"
15972 [(set (match_operand:SI 0 "register_operand" "=c,c")
15974 [(match_operand:V16QI 2 "register_operand" "x,x")
15975 (match_operand:SI 3 "register_operand" "a,a")
15976 (match_operand:V16QI 4 "nonimmediate_operand" "x,m")
15977 (match_operand:SI 5 "register_operand" "d,d")
15978 (match_operand:SI 6 "const_0_to_255_operand" "n,n")]
15980 (set (match_operand:V16QI 1 "register_operand" "=Yz,Yz")
15988 (set (reg:CC FLAGS_REG)
15997 && can_create_pseudo_p ()"
16002 int ecx = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[0]));
16003 int xmm0 = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[1]));
16004 int flags = !find_regno_note (curr_insn, REG_UNUSED, FLAGS_REG);
16007 emit_insn (gen_sse4_2_pcmpestri (operands[0], operands[2],
16008 operands[3], operands[4],
16009 operands[5], operands[6]));
16011 emit_insn (gen_sse4_2_pcmpestrm (operands[1], operands[2],
16012 operands[3], operands[4],
16013 operands[5], operands[6]));
16014 if (flags && !(ecx || xmm0))
16015 emit_insn (gen_sse4_2_pcmpestr_cconly (NULL, NULL,
16016 operands[2], operands[3],
16017 operands[4], operands[5],
16019 if (!(flags || ecx || xmm0))
16020 emit_note (NOTE_INSN_DELETED);
16024 [(set_attr "type" "sselog")
16025 (set_attr "prefix_data16" "1")
16026 (set_attr "prefix_extra" "1")
16027 (set_attr "length_immediate" "1")
16028 (set_attr "memory" "none,load")
16029 (set_attr "mode" "TI")])
16031 (define_insn "sse4_2_pcmpestri"
16032 [(set (match_operand:SI 0 "register_operand" "=c,c")
16034 [(match_operand:V16QI 1 "register_operand" "x,x")
16035 (match_operand:SI 2 "register_operand" "a,a")
16036 (match_operand:V16QI 3 "nonimmediate_operand" "x,m")
16037 (match_operand:SI 4 "register_operand" "d,d")
16038 (match_operand:SI 5 "const_0_to_255_operand" "n,n")]
16040 (set (reg:CC FLAGS_REG)
16049 "%vpcmpestri\t{%5, %3, %1|%1, %3, %5}"
16050 [(set_attr "type" "sselog")
16051 (set_attr "prefix_data16" "1")
16052 (set_attr "prefix_extra" "1")
16053 (set_attr "prefix" "maybe_vex")
16054 (set_attr "length_immediate" "1")
16055 (set_attr "btver2_decode" "vector")
16056 (set_attr "memory" "none,load")
16057 (set_attr "mode" "TI")])
16059 (define_insn "sse4_2_pcmpestrm"
16060 [(set (match_operand:V16QI 0 "register_operand" "=Yz,Yz")
16062 [(match_operand:V16QI 1 "register_operand" "x,x")
16063 (match_operand:SI 2 "register_operand" "a,a")
16064 (match_operand:V16QI 3 "nonimmediate_operand" "x,m")
16065 (match_operand:SI 4 "register_operand" "d,d")
16066 (match_operand:SI 5 "const_0_to_255_operand" "n,n")]
16068 (set (reg:CC FLAGS_REG)
16077 "%vpcmpestrm\t{%5, %3, %1|%1, %3, %5}"
16078 [(set_attr "type" "sselog")
16079 (set_attr "prefix_data16" "1")
16080 (set_attr "prefix_extra" "1")
16081 (set_attr "length_immediate" "1")
16082 (set_attr "prefix" "maybe_vex")
16083 (set_attr "btver2_decode" "vector")
16084 (set_attr "memory" "none,load")
16085 (set_attr "mode" "TI")])
16087 (define_insn "sse4_2_pcmpestr_cconly"
16088 [(set (reg:CC FLAGS_REG)
16090 [(match_operand:V16QI 2 "register_operand" "x,x,x,x")
16091 (match_operand:SI 3 "register_operand" "a,a,a,a")
16092 (match_operand:V16QI 4 "nonimmediate_operand" "x,m,x,m")
16093 (match_operand:SI 5 "register_operand" "d,d,d,d")
16094 (match_operand:SI 6 "const_0_to_255_operand" "n,n,n,n")]
16096 (clobber (match_scratch:V16QI 0 "=Yz,Yz,X,X"))
16097 (clobber (match_scratch:SI 1 "= X, X,c,c"))]
16100 %vpcmpestrm\t{%6, %4, %2|%2, %4, %6}
16101 %vpcmpestrm\t{%6, %4, %2|%2, %4, %6}
16102 %vpcmpestri\t{%6, %4, %2|%2, %4, %6}
16103 %vpcmpestri\t{%6, %4, %2|%2, %4, %6}"
16104 [(set_attr "type" "sselog")
16105 (set_attr "prefix_data16" "1")
16106 (set_attr "prefix_extra" "1")
16107 (set_attr "length_immediate" "1")
16108 (set_attr "memory" "none,load,none,load")
16109 (set_attr "btver2_decode" "vector,vector,vector,vector")
16110 (set_attr "prefix" "maybe_vex")
16111 (set_attr "mode" "TI")])
16113 (define_insn_and_split "sse4_2_pcmpistr"
16114 [(set (match_operand:SI 0 "register_operand" "=c,c")
16116 [(match_operand:V16QI 2 "register_operand" "x,x")
16117 (match_operand:V16QI 3 "nonimmediate_operand" "x,m")
16118 (match_operand:SI 4 "const_0_to_255_operand" "n,n")]
16120 (set (match_operand:V16QI 1 "register_operand" "=Yz,Yz")
16126 (set (reg:CC FLAGS_REG)
16133 && can_create_pseudo_p ()"
16138 int ecx = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[0]));
16139 int xmm0 = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[1]));
16140 int flags = !find_regno_note (curr_insn, REG_UNUSED, FLAGS_REG);
16143 emit_insn (gen_sse4_2_pcmpistri (operands[0], operands[2],
16144 operands[3], operands[4]));
16146 emit_insn (gen_sse4_2_pcmpistrm (operands[1], operands[2],
16147 operands[3], operands[4]));
16148 if (flags && !(ecx || xmm0))
16149 emit_insn (gen_sse4_2_pcmpistr_cconly (NULL, NULL,
16150 operands[2], operands[3],
16152 if (!(flags || ecx || xmm0))
16153 emit_note (NOTE_INSN_DELETED);
16157 [(set_attr "type" "sselog")
16158 (set_attr "prefix_data16" "1")
16159 (set_attr "prefix_extra" "1")
16160 (set_attr "length_immediate" "1")
16161 (set_attr "memory" "none,load")
16162 (set_attr "mode" "TI")])
16164 (define_insn "sse4_2_pcmpistri"
16165 [(set (match_operand:SI 0 "register_operand" "=c,c")
16167 [(match_operand:V16QI 1 "register_operand" "x,x")
16168 (match_operand:V16QI 2 "nonimmediate_operand" "x,m")
16169 (match_operand:SI 3 "const_0_to_255_operand" "n,n")]
16171 (set (reg:CC FLAGS_REG)
16178 "%vpcmpistri\t{%3, %2, %1|%1, %2, %3}"
16179 [(set_attr "type" "sselog")
16180 (set_attr "prefix_data16" "1")
16181 (set_attr "prefix_extra" "1")
16182 (set_attr "length_immediate" "1")
16183 (set_attr "prefix" "maybe_vex")
16184 (set_attr "memory" "none,load")
16185 (set_attr "btver2_decode" "vector")
16186 (set_attr "mode" "TI")])
16188 (define_insn "sse4_2_pcmpistrm"
16189 [(set (match_operand:V16QI 0 "register_operand" "=Yz,Yz")
16191 [(match_operand:V16QI 1 "register_operand" "x,x")
16192 (match_operand:V16QI 2 "nonimmediate_operand" "x,m")
16193 (match_operand:SI 3 "const_0_to_255_operand" "n,n")]
16195 (set (reg:CC FLAGS_REG)
16202 "%vpcmpistrm\t{%3, %2, %1|%1, %2, %3}"
16203 [(set_attr "type" "sselog")
16204 (set_attr "prefix_data16" "1")
16205 (set_attr "prefix_extra" "1")
16206 (set_attr "length_immediate" "1")
16207 (set_attr "prefix" "maybe_vex")
16208 (set_attr "memory" "none,load")
16209 (set_attr "btver2_decode" "vector")
16210 (set_attr "mode" "TI")])
16212 (define_insn "sse4_2_pcmpistr_cconly"
16213 [(set (reg:CC FLAGS_REG)
16215 [(match_operand:V16QI 2 "register_operand" "x,x,x,x")
16216 (match_operand:V16QI 3 "nonimmediate_operand" "x,m,x,m")
16217 (match_operand:SI 4 "const_0_to_255_operand" "n,n,n,n")]
16219 (clobber (match_scratch:V16QI 0 "=Yz,Yz,X,X"))
16220 (clobber (match_scratch:SI 1 "= X, X,c,c"))]
16223 %vpcmpistrm\t{%4, %3, %2|%2, %3, %4}
16224 %vpcmpistrm\t{%4, %3, %2|%2, %3, %4}
16225 %vpcmpistri\t{%4, %3, %2|%2, %3, %4}
16226 %vpcmpistri\t{%4, %3, %2|%2, %3, %4}"
16227 [(set_attr "type" "sselog")
16228 (set_attr "prefix_data16" "1")
16229 (set_attr "prefix_extra" "1")
16230 (set_attr "length_immediate" "1")
16231 (set_attr "memory" "none,load,none,load")
16232 (set_attr "prefix" "maybe_vex")
16233 (set_attr "btver2_decode" "vector,vector,vector,vector")
16234 (set_attr "mode" "TI")])
16236 ;; Packed float variants
16237 (define_mode_attr GATHER_SCATTER_SF_MEM_MODE
16238 [(V8DI "V8SF") (V16SI "V16SF")])
16240 (define_expand "avx512pf_gatherpf<mode>sf"
16242 [(match_operand:<avx512fmaskmode> 0 "register_operand")
16243 (mem:<GATHER_SCATTER_SF_MEM_MODE>
16245 [(match_operand 2 "vsib_address_operand")
16246 (match_operand:VI48_512 1 "register_operand")
16247 (match_operand:SI 3 "const1248_operand")]))
16248 (match_operand:SI 4 "const_2_to_3_operand")]
16249 UNSPEC_GATHER_PREFETCH)]
16253 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
16254 operands[3]), UNSPEC_VSIBADDR);
16257 (define_insn "*avx512pf_gatherpf<mode>sf_mask"
16259 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
16260 (match_operator:<GATHER_SCATTER_SF_MEM_MODE> 5 "vsib_mem_operator"
16262 [(match_operand:P 2 "vsib_address_operand" "Tv")
16263 (match_operand:VI48_512 1 "register_operand" "v")
16264 (match_operand:SI 3 "const1248_operand" "n")]
16266 (match_operand:SI 4 "const_2_to_3_operand" "n")]
16267 UNSPEC_GATHER_PREFETCH)]
16270 switch (INTVAL (operands[4]))
16273 return "vgatherpf0<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
16275 return "vgatherpf1<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
16277 gcc_unreachable ();
16280 [(set_attr "type" "sse")
16281 (set_attr "prefix" "evex")
16282 (set_attr "mode" "XI")])
16284 ;; Packed double variants
16285 (define_expand "avx512pf_gatherpf<mode>df"
16287 [(match_operand:<avx512fmaskmode> 0 "register_operand")
16290 [(match_operand 2 "vsib_address_operand")
16291 (match_operand:VI4_256_8_512 1 "register_operand")
16292 (match_operand:SI 3 "const1248_operand")]))
16293 (match_operand:SI 4 "const_2_to_3_operand")]
16294 UNSPEC_GATHER_PREFETCH)]
16298 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
16299 operands[3]), UNSPEC_VSIBADDR);
16302 (define_insn "*avx512pf_gatherpf<mode>df_mask"
16304 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
16305 (match_operator:V8DF 5 "vsib_mem_operator"
16307 [(match_operand:P 2 "vsib_address_operand" "Tv")
16308 (match_operand:VI4_256_8_512 1 "register_operand" "v")
16309 (match_operand:SI 3 "const1248_operand" "n")]
16311 (match_operand:SI 4 "const_2_to_3_operand" "n")]
16312 UNSPEC_GATHER_PREFETCH)]
16315 switch (INTVAL (operands[4]))
16318 return "vgatherpf0<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
16320 return "vgatherpf1<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
16322 gcc_unreachable ();
16325 [(set_attr "type" "sse")
16326 (set_attr "prefix" "evex")
16327 (set_attr "mode" "XI")])
16329 ;; Packed float variants
16330 (define_expand "avx512pf_scatterpf<mode>sf"
16332 [(match_operand:<avx512fmaskmode> 0 "register_operand")
16333 (mem:<GATHER_SCATTER_SF_MEM_MODE>
16335 [(match_operand 2 "vsib_address_operand")
16336 (match_operand:VI48_512 1 "register_operand")
16337 (match_operand:SI 3 "const1248_operand")]))
16338 (match_operand:SI 4 "const2367_operand")]
16339 UNSPEC_SCATTER_PREFETCH)]
16343 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
16344 operands[3]), UNSPEC_VSIBADDR);
16347 (define_insn "*avx512pf_scatterpf<mode>sf_mask"
16349 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
16350 (match_operator:<GATHER_SCATTER_SF_MEM_MODE> 5 "vsib_mem_operator"
16352 [(match_operand:P 2 "vsib_address_operand" "Tv")
16353 (match_operand:VI48_512 1 "register_operand" "v")
16354 (match_operand:SI 3 "const1248_operand" "n")]
16356 (match_operand:SI 4 "const2367_operand" "n")]
16357 UNSPEC_SCATTER_PREFETCH)]
16360 switch (INTVAL (operands[4]))
16364 return "vscatterpf0<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
16367 return "vscatterpf1<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
16369 gcc_unreachable ();
16372 [(set_attr "type" "sse")
16373 (set_attr "prefix" "evex")
16374 (set_attr "mode" "XI")])
16376 ;; Packed double variants
16377 (define_expand "avx512pf_scatterpf<mode>df"
16379 [(match_operand:<avx512fmaskmode> 0 "register_operand")
16382 [(match_operand 2 "vsib_address_operand")
16383 (match_operand:VI4_256_8_512 1 "register_operand")
16384 (match_operand:SI 3 "const1248_operand")]))
16385 (match_operand:SI 4 "const2367_operand")]
16386 UNSPEC_SCATTER_PREFETCH)]
16390 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
16391 operands[3]), UNSPEC_VSIBADDR);
16394 (define_insn "*avx512pf_scatterpf<mode>df_mask"
16396 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
16397 (match_operator:V8DF 5 "vsib_mem_operator"
16399 [(match_operand:P 2 "vsib_address_operand" "Tv")
16400 (match_operand:VI4_256_8_512 1 "register_operand" "v")
16401 (match_operand:SI 3 "const1248_operand" "n")]
16403 (match_operand:SI 4 "const2367_operand" "n")]
16404 UNSPEC_SCATTER_PREFETCH)]
16407 switch (INTVAL (operands[4]))
16411 return "vscatterpf0<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
16414 return "vscatterpf1<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
16416 gcc_unreachable ();
16419 [(set_attr "type" "sse")
16420 (set_attr "prefix" "evex")
16421 (set_attr "mode" "XI")])
16423 (define_insn "avx512er_exp2<mode><mask_name><round_saeonly_name>"
16424 [(set (match_operand:VF_512 0 "register_operand" "=v")
16426 [(match_operand:VF_512 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16429 "vexp2<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
16430 [(set_attr "prefix" "evex")
16431 (set_attr "type" "sse")
16432 (set_attr "mode" "<MODE>")])
16434 (define_insn "<mask_codefor>avx512er_rcp28<mode><mask_name><round_saeonly_name>"
16435 [(set (match_operand:VF_512 0 "register_operand" "=v")
16437 [(match_operand:VF_512 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16440 "vrcp28<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
16441 [(set_attr "prefix" "evex")
16442 (set_attr "type" "sse")
16443 (set_attr "mode" "<MODE>")])
16445 (define_insn "avx512er_vmrcp28<mode><round_saeonly_name>"
16446 [(set (match_operand:VF_128 0 "register_operand" "=v")
16449 [(match_operand:VF_128 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16451 (match_operand:VF_128 2 "register_operand" "v")
16454 "vrcp28<ssescalarmodesuffix>\t{<round_saeonly_op3>%1, %2, %0|%0, %2, %<iptr>1<round_saeonly_op3>}"
16455 [(set_attr "length_immediate" "1")
16456 (set_attr "prefix" "evex")
16457 (set_attr "type" "sse")
16458 (set_attr "mode" "<MODE>")])
16460 (define_insn "<mask_codefor>avx512er_rsqrt28<mode><mask_name><round_saeonly_name>"
16461 [(set (match_operand:VF_512 0 "register_operand" "=v")
16463 [(match_operand:VF_512 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16466 "vrsqrt28<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
16467 [(set_attr "prefix" "evex")
16468 (set_attr "type" "sse")
16469 (set_attr "mode" "<MODE>")])
16471 (define_insn "avx512er_vmrsqrt28<mode><round_saeonly_name>"
16472 [(set (match_operand:VF_128 0 "register_operand" "=v")
16475 [(match_operand:VF_128 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16477 (match_operand:VF_128 2 "register_operand" "v")
16480 "vrsqrt28<ssescalarmodesuffix>\t{<round_saeonly_op3>%1, %2, %0|%0, %2, %<iptr>1<round_saeonly_op3>}"
16481 [(set_attr "length_immediate" "1")
16482 (set_attr "type" "sse")
16483 (set_attr "prefix" "evex")
16484 (set_attr "mode" "<MODE>")])
16486 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16488 ;; XOP instructions
16490 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16492 (define_code_iterator xop_plus [plus ss_plus])
16494 (define_code_attr macs [(plus "macs") (ss_plus "macss")])
16495 (define_code_attr madcs [(plus "madcs") (ss_plus "madcss")])
16497 ;; XOP parallel integer multiply/add instructions.
16499 (define_insn "xop_p<macs><ssemodesuffix><ssemodesuffix>"
16500 [(set (match_operand:VI24_128 0 "register_operand" "=x")
16503 (match_operand:VI24_128 1 "nonimmediate_operand" "%x")
16504 (match_operand:VI24_128 2 "nonimmediate_operand" "xm"))
16505 (match_operand:VI24_128 3 "register_operand" "x")))]
16507 "vp<macs><ssemodesuffix><ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16508 [(set_attr "type" "ssemuladd")
16509 (set_attr "mode" "TI")])
16511 (define_insn "xop_p<macs>dql"
16512 [(set (match_operand:V2DI 0 "register_operand" "=x")
16517 (match_operand:V4SI 1 "nonimmediate_operand" "%x")
16518 (parallel [(const_int 0) (const_int 2)])))
16521 (match_operand:V4SI 2 "nonimmediate_operand" "xm")
16522 (parallel [(const_int 0) (const_int 2)]))))
16523 (match_operand:V2DI 3 "register_operand" "x")))]
16525 "vp<macs>dql\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16526 [(set_attr "type" "ssemuladd")
16527 (set_attr "mode" "TI")])
16529 (define_insn "xop_p<macs>dqh"
16530 [(set (match_operand:V2DI 0 "register_operand" "=x")
16535 (match_operand:V4SI 1 "nonimmediate_operand" "%x")
16536 (parallel [(const_int 1) (const_int 3)])))
16539 (match_operand:V4SI 2 "nonimmediate_operand" "xm")
16540 (parallel [(const_int 1) (const_int 3)]))))
16541 (match_operand:V2DI 3 "register_operand" "x")))]
16543 "vp<macs>dqh\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16544 [(set_attr "type" "ssemuladd")
16545 (set_attr "mode" "TI")])
16547 ;; XOP parallel integer multiply/add instructions for the intrinisics
16548 (define_insn "xop_p<macs>wd"
16549 [(set (match_operand:V4SI 0 "register_operand" "=x")
16554 (match_operand:V8HI 1 "nonimmediate_operand" "%x")
16555 (parallel [(const_int 1) (const_int 3)
16556 (const_int 5) (const_int 7)])))
16559 (match_operand:V8HI 2 "nonimmediate_operand" "xm")
16560 (parallel [(const_int 1) (const_int 3)
16561 (const_int 5) (const_int 7)]))))
16562 (match_operand:V4SI 3 "register_operand" "x")))]
16564 "vp<macs>wd\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16565 [(set_attr "type" "ssemuladd")
16566 (set_attr "mode" "TI")])
16568 (define_insn "xop_p<madcs>wd"
16569 [(set (match_operand:V4SI 0 "register_operand" "=x")
16575 (match_operand:V8HI 1 "nonimmediate_operand" "%x")
16576 (parallel [(const_int 0) (const_int 2)
16577 (const_int 4) (const_int 6)])))
16580 (match_operand:V8HI 2 "nonimmediate_operand" "xm")
16581 (parallel [(const_int 0) (const_int 2)
16582 (const_int 4) (const_int 6)]))))
16587 (parallel [(const_int 1) (const_int 3)
16588 (const_int 5) (const_int 7)])))
16592 (parallel [(const_int 1) (const_int 3)
16593 (const_int 5) (const_int 7)])))))
16594 (match_operand:V4SI 3 "register_operand" "x")))]
16596 "vp<madcs>wd\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16597 [(set_attr "type" "ssemuladd")
16598 (set_attr "mode" "TI")])
16600 ;; XOP parallel XMM conditional moves
16601 (define_insn "xop_pcmov_<mode><avxsizesuffix>"
16602 [(set (match_operand:V_128_256 0 "register_operand" "=x,x")
16603 (if_then_else:V_128_256
16604 (match_operand:V_128_256 3 "nonimmediate_operand" "x,m")
16605 (match_operand:V_128_256 1 "register_operand" "x,x")
16606 (match_operand:V_128_256 2 "nonimmediate_operand" "xm,x")))]
16608 "vpcmov\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16609 [(set_attr "type" "sse4arg")])
16611 ;; XOP horizontal add/subtract instructions
16612 (define_insn "xop_phadd<u>bw"
16613 [(set (match_operand:V8HI 0 "register_operand" "=x")
16617 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
16618 (parallel [(const_int 0) (const_int 2)
16619 (const_int 4) (const_int 6)
16620 (const_int 8) (const_int 10)
16621 (const_int 12) (const_int 14)])))
16625 (parallel [(const_int 1) (const_int 3)
16626 (const_int 5) (const_int 7)
16627 (const_int 9) (const_int 11)
16628 (const_int 13) (const_int 15)])))))]
16630 "vphadd<u>bw\t{%1, %0|%0, %1}"
16631 [(set_attr "type" "sseiadd1")])
16633 (define_insn "xop_phadd<u>bd"
16634 [(set (match_operand:V4SI 0 "register_operand" "=x")
16639 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
16640 (parallel [(const_int 0) (const_int 4)
16641 (const_int 8) (const_int 12)])))
16645 (parallel [(const_int 1) (const_int 5)
16646 (const_int 9) (const_int 13)]))))
16651 (parallel [(const_int 2) (const_int 6)
16652 (const_int 10) (const_int 14)])))
16656 (parallel [(const_int 3) (const_int 7)
16657 (const_int 11) (const_int 15)]))))))]
16659 "vphadd<u>bd\t{%1, %0|%0, %1}"
16660 [(set_attr "type" "sseiadd1")])
16662 (define_insn "xop_phadd<u>bq"
16663 [(set (match_operand:V2DI 0 "register_operand" "=x")
16669 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
16670 (parallel [(const_int 0) (const_int 8)])))
16674 (parallel [(const_int 1) (const_int 9)]))))
16679 (parallel [(const_int 2) (const_int 10)])))
16683 (parallel [(const_int 3) (const_int 11)])))))
16689 (parallel [(const_int 4) (const_int 12)])))
16693 (parallel [(const_int 5) (const_int 13)]))))
16698 (parallel [(const_int 6) (const_int 14)])))
16702 (parallel [(const_int 7) (const_int 15)])))))))]
16704 "vphadd<u>bq\t{%1, %0|%0, %1}"
16705 [(set_attr "type" "sseiadd1")])
16707 (define_insn "xop_phadd<u>wd"
16708 [(set (match_operand:V4SI 0 "register_operand" "=x")
16712 (match_operand:V8HI 1 "nonimmediate_operand" "xm")
16713 (parallel [(const_int 0) (const_int 2)
16714 (const_int 4) (const_int 6)])))
16718 (parallel [(const_int 1) (const_int 3)
16719 (const_int 5) (const_int 7)])))))]
16721 "vphadd<u>wd\t{%1, %0|%0, %1}"
16722 [(set_attr "type" "sseiadd1")])
16724 (define_insn "xop_phadd<u>wq"
16725 [(set (match_operand:V2DI 0 "register_operand" "=x")
16730 (match_operand:V8HI 1 "nonimmediate_operand" "xm")
16731 (parallel [(const_int 0) (const_int 4)])))
16735 (parallel [(const_int 1) (const_int 5)]))))
16740 (parallel [(const_int 2) (const_int 6)])))
16744 (parallel [(const_int 3) (const_int 7)]))))))]
16746 "vphadd<u>wq\t{%1, %0|%0, %1}"
16747 [(set_attr "type" "sseiadd1")])
16749 (define_insn "xop_phadd<u>dq"
16750 [(set (match_operand:V2DI 0 "register_operand" "=x")
16754 (match_operand:V4SI 1 "nonimmediate_operand" "xm")
16755 (parallel [(const_int 0) (const_int 2)])))
16759 (parallel [(const_int 1) (const_int 3)])))))]
16761 "vphadd<u>dq\t{%1, %0|%0, %1}"
16762 [(set_attr "type" "sseiadd1")])
16764 (define_insn "xop_phsubbw"
16765 [(set (match_operand:V8HI 0 "register_operand" "=x")
16769 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
16770 (parallel [(const_int 0) (const_int 2)
16771 (const_int 4) (const_int 6)
16772 (const_int 8) (const_int 10)
16773 (const_int 12) (const_int 14)])))
16777 (parallel [(const_int 1) (const_int 3)
16778 (const_int 5) (const_int 7)
16779 (const_int 9) (const_int 11)
16780 (const_int 13) (const_int 15)])))))]
16782 "vphsubbw\t{%1, %0|%0, %1}"
16783 [(set_attr "type" "sseiadd1")])
16785 (define_insn "xop_phsubwd"
16786 [(set (match_operand:V4SI 0 "register_operand" "=x")
16790 (match_operand:V8HI 1 "nonimmediate_operand" "xm")
16791 (parallel [(const_int 0) (const_int 2)
16792 (const_int 4) (const_int 6)])))
16796 (parallel [(const_int 1) (const_int 3)
16797 (const_int 5) (const_int 7)])))))]
16799 "vphsubwd\t{%1, %0|%0, %1}"
16800 [(set_attr "type" "sseiadd1")])
16802 (define_insn "xop_phsubdq"
16803 [(set (match_operand:V2DI 0 "register_operand" "=x")
16807 (match_operand:V4SI 1 "nonimmediate_operand" "xm")
16808 (parallel [(const_int 0) (const_int 2)])))
16812 (parallel [(const_int 1) (const_int 3)])))))]
16814 "vphsubdq\t{%1, %0|%0, %1}"
16815 [(set_attr "type" "sseiadd1")])
16817 ;; XOP permute instructions
16818 (define_insn "xop_pperm"
16819 [(set (match_operand:V16QI 0 "register_operand" "=x,x")
16821 [(match_operand:V16QI 1 "register_operand" "x,x")
16822 (match_operand:V16QI 2 "nonimmediate_operand" "x,m")
16823 (match_operand:V16QI 3 "nonimmediate_operand" "xm,x")]
16824 UNSPEC_XOP_PERMUTE))]
16825 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
16826 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16827 [(set_attr "type" "sse4arg")
16828 (set_attr "mode" "TI")])
16830 ;; XOP pack instructions that combine two vectors into a smaller vector
16831 (define_insn "xop_pperm_pack_v2di_v4si"
16832 [(set (match_operand:V4SI 0 "register_operand" "=x,x")
16835 (match_operand:V2DI 1 "register_operand" "x,x"))
16837 (match_operand:V2DI 2 "nonimmediate_operand" "x,m"))))
16838 (use (match_operand:V16QI 3 "nonimmediate_operand" "xm,x"))]
16839 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
16840 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16841 [(set_attr "type" "sse4arg")
16842 (set_attr "mode" "TI")])
16844 (define_insn "xop_pperm_pack_v4si_v8hi"
16845 [(set (match_operand:V8HI 0 "register_operand" "=x,x")
16848 (match_operand:V4SI 1 "register_operand" "x,x"))
16850 (match_operand:V4SI 2 "nonimmediate_operand" "x,m"))))
16851 (use (match_operand:V16QI 3 "nonimmediate_operand" "xm,x"))]
16852 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
16853 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16854 [(set_attr "type" "sse4arg")
16855 (set_attr "mode" "TI")])
16857 (define_insn "xop_pperm_pack_v8hi_v16qi"
16858 [(set (match_operand:V16QI 0 "register_operand" "=x,x")
16861 (match_operand:V8HI 1 "register_operand" "x,x"))
16863 (match_operand:V8HI 2 "nonimmediate_operand" "x,m"))))
16864 (use (match_operand:V16QI 3 "nonimmediate_operand" "xm,x"))]
16865 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
16866 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16867 [(set_attr "type" "sse4arg")
16868 (set_attr "mode" "TI")])
16870 ;; XOP packed rotate instructions
16871 (define_expand "rotl<mode>3"
16872 [(set (match_operand:VI_128 0 "register_operand")
16874 (match_operand:VI_128 1 "nonimmediate_operand")
16875 (match_operand:SI 2 "general_operand")))]
16878 /* If we were given a scalar, convert it to parallel */
16879 if (! const_0_to_<sserotatemax>_operand (operands[2], SImode))
16881 rtvec vs = rtvec_alloc (<ssescalarnum>);
16882 rtx par = gen_rtx_PARALLEL (<MODE>mode, vs);
16883 rtx reg = gen_reg_rtx (<MODE>mode);
16884 rtx op2 = operands[2];
16887 if (GET_MODE (op2) != <ssescalarmode>mode)
16889 op2 = gen_reg_rtx (<ssescalarmode>mode);
16890 convert_move (op2, operands[2], false);
16893 for (i = 0; i < <ssescalarnum>; i++)
16894 RTVEC_ELT (vs, i) = op2;
16896 emit_insn (gen_vec_init<mode><ssescalarmodelower> (reg, par));
16897 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], reg));
16902 (define_expand "rotr<mode>3"
16903 [(set (match_operand:VI_128 0 "register_operand")
16905 (match_operand:VI_128 1 "nonimmediate_operand")
16906 (match_operand:SI 2 "general_operand")))]
16909 /* If we were given a scalar, convert it to parallel */
16910 if (! const_0_to_<sserotatemax>_operand (operands[2], SImode))
16912 rtvec vs = rtvec_alloc (<ssescalarnum>);
16913 rtx par = gen_rtx_PARALLEL (<MODE>mode, vs);
16914 rtx neg = gen_reg_rtx (<MODE>mode);
16915 rtx reg = gen_reg_rtx (<MODE>mode);
16916 rtx op2 = operands[2];
16919 if (GET_MODE (op2) != <ssescalarmode>mode)
16921 op2 = gen_reg_rtx (<ssescalarmode>mode);
16922 convert_move (op2, operands[2], false);
16925 for (i = 0; i < <ssescalarnum>; i++)
16926 RTVEC_ELT (vs, i) = op2;
16928 emit_insn (gen_vec_init<mode><ssescalarmodelower> (reg, par));
16929 emit_insn (gen_neg<mode>2 (neg, reg));
16930 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], neg));
16935 (define_insn "xop_rotl<mode>3"
16936 [(set (match_operand:VI_128 0 "register_operand" "=x")
16938 (match_operand:VI_128 1 "nonimmediate_operand" "xm")
16939 (match_operand:SI 2 "const_0_to_<sserotatemax>_operand" "n")))]
16941 "vprot<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
16942 [(set_attr "type" "sseishft")
16943 (set_attr "length_immediate" "1")
16944 (set_attr "mode" "TI")])
16946 (define_insn "xop_rotr<mode>3"
16947 [(set (match_operand:VI_128 0 "register_operand" "=x")
16949 (match_operand:VI_128 1 "nonimmediate_operand" "xm")
16950 (match_operand:SI 2 "const_0_to_<sserotatemax>_operand" "n")))]
16954 = GEN_INT (GET_MODE_BITSIZE (<ssescalarmode>mode) - INTVAL (operands[2]));
16955 return \"vprot<ssemodesuffix>\t{%3, %1, %0|%0, %1, %3}\";
16957 [(set_attr "type" "sseishft")
16958 (set_attr "length_immediate" "1")
16959 (set_attr "mode" "TI")])
16961 (define_expand "vrotr<mode>3"
16962 [(match_operand:VI_128 0 "register_operand")
16963 (match_operand:VI_128 1 "register_operand")
16964 (match_operand:VI_128 2 "register_operand")]
16967 rtx reg = gen_reg_rtx (<MODE>mode);
16968 emit_insn (gen_neg<mode>2 (reg, operands[2]));
16969 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], reg));
16973 (define_expand "vrotl<mode>3"
16974 [(match_operand:VI_128 0 "register_operand")
16975 (match_operand:VI_128 1 "register_operand")
16976 (match_operand:VI_128 2 "register_operand")]
16979 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], operands[2]));
16983 (define_insn "xop_vrotl<mode>3"
16984 [(set (match_operand:VI_128 0 "register_operand" "=x,x")
16985 (if_then_else:VI_128
16987 (match_operand:VI_128 2 "nonimmediate_operand" "x,m")
16990 (match_operand:VI_128 1 "nonimmediate_operand" "xm,x")
16994 (neg:VI_128 (match_dup 2)))))]
16995 "TARGET_XOP && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
16996 "vprot<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
16997 [(set_attr "type" "sseishft")
16998 (set_attr "prefix_data16" "0")
16999 (set_attr "prefix_extra" "2")
17000 (set_attr "mode" "TI")])
17002 ;; XOP packed shift instructions.
17003 (define_expand "vlshr<mode>3"
17004 [(set (match_operand:VI12_128 0 "register_operand")
17006 (match_operand:VI12_128 1 "register_operand")
17007 (match_operand:VI12_128 2 "nonimmediate_operand")))]
17010 rtx neg = gen_reg_rtx (<MODE>mode);
17011 emit_insn (gen_neg<mode>2 (neg, operands[2]));
17012 emit_insn (gen_xop_shl<mode>3 (operands[0], operands[1], neg));
17016 (define_expand "vlshr<mode>3"
17017 [(set (match_operand:VI48_128 0 "register_operand")
17019 (match_operand:VI48_128 1 "register_operand")
17020 (match_operand:VI48_128 2 "nonimmediate_operand")))]
17021 "TARGET_AVX2 || TARGET_XOP"
17025 rtx neg = gen_reg_rtx (<MODE>mode);
17026 emit_insn (gen_neg<mode>2 (neg, operands[2]));
17027 emit_insn (gen_xop_shl<mode>3 (operands[0], operands[1], neg));
17032 (define_expand "vlshr<mode>3"
17033 [(set (match_operand:VI48_512 0 "register_operand")
17035 (match_operand:VI48_512 1 "register_operand")
17036 (match_operand:VI48_512 2 "nonimmediate_operand")))]
17039 (define_expand "vlshr<mode>3"
17040 [(set (match_operand:VI48_256 0 "register_operand")
17042 (match_operand:VI48_256 1 "register_operand")
17043 (match_operand:VI48_256 2 "nonimmediate_operand")))]
17046 (define_expand "vashrv8hi3<mask_name>"
17047 [(set (match_operand:V8HI 0 "register_operand")
17049 (match_operand:V8HI 1 "register_operand")
17050 (match_operand:V8HI 2 "nonimmediate_operand")))]
17051 "TARGET_XOP || (TARGET_AVX512BW && TARGET_AVX512VL)"
17055 rtx neg = gen_reg_rtx (V8HImode);
17056 emit_insn (gen_negv8hi2 (neg, operands[2]));
17057 emit_insn (gen_xop_shav8hi3 (operands[0], operands[1], neg));
17062 (define_expand "vashrv16qi3"
17063 [(set (match_operand:V16QI 0 "register_operand")
17065 (match_operand:V16QI 1 "register_operand")
17066 (match_operand:V16QI 2 "nonimmediate_operand")))]
17069 rtx neg = gen_reg_rtx (V16QImode);
17070 emit_insn (gen_negv16qi2 (neg, operands[2]));
17071 emit_insn (gen_xop_shav16qi3 (operands[0], operands[1], neg));
17075 (define_expand "vashrv2di3<mask_name>"
17076 [(set (match_operand:V2DI 0 "register_operand")
17078 (match_operand:V2DI 1 "register_operand")
17079 (match_operand:V2DI 2 "nonimmediate_operand")))]
17080 "TARGET_XOP || TARGET_AVX512VL"
17084 rtx neg = gen_reg_rtx (V2DImode);
17085 emit_insn (gen_negv2di2 (neg, operands[2]));
17086 emit_insn (gen_xop_shav2di3 (operands[0], operands[1], neg));
17091 (define_expand "vashrv4si3"
17092 [(set (match_operand:V4SI 0 "register_operand")
17093 (ashiftrt:V4SI (match_operand:V4SI 1 "register_operand")
17094 (match_operand:V4SI 2 "nonimmediate_operand")))]
17095 "TARGET_AVX2 || TARGET_XOP"
17099 rtx neg = gen_reg_rtx (V4SImode);
17100 emit_insn (gen_negv4si2 (neg, operands[2]));
17101 emit_insn (gen_xop_shav4si3 (operands[0], operands[1], neg));
17106 (define_expand "vashrv16si3"
17107 [(set (match_operand:V16SI 0 "register_operand")
17108 (ashiftrt:V16SI (match_operand:V16SI 1 "register_operand")
17109 (match_operand:V16SI 2 "nonimmediate_operand")))]
17112 (define_expand "vashrv8si3"
17113 [(set (match_operand:V8SI 0 "register_operand")
17114 (ashiftrt:V8SI (match_operand:V8SI 1 "register_operand")
17115 (match_operand:V8SI 2 "nonimmediate_operand")))]
17118 (define_expand "vashl<mode>3"
17119 [(set (match_operand:VI12_128 0 "register_operand")
17121 (match_operand:VI12_128 1 "register_operand")
17122 (match_operand:VI12_128 2 "nonimmediate_operand")))]
17125 emit_insn (gen_xop_sha<mode>3 (operands[0], operands[1], operands[2]));
17129 (define_expand "vashl<mode>3"
17130 [(set (match_operand:VI48_128 0 "register_operand")
17132 (match_operand:VI48_128 1 "register_operand")
17133 (match_operand:VI48_128 2 "nonimmediate_operand")))]
17134 "TARGET_AVX2 || TARGET_XOP"
17138 operands[2] = force_reg (<MODE>mode, operands[2]);
17139 emit_insn (gen_xop_sha<mode>3 (operands[0], operands[1], operands[2]));
17144 (define_expand "vashl<mode>3"
17145 [(set (match_operand:VI48_512 0 "register_operand")
17147 (match_operand:VI48_512 1 "register_operand")
17148 (match_operand:VI48_512 2 "nonimmediate_operand")))]
17151 (define_expand "vashl<mode>3"
17152 [(set (match_operand:VI48_256 0 "register_operand")
17154 (match_operand:VI48_256 1 "register_operand")
17155 (match_operand:VI48_256 2 "nonimmediate_operand")))]
17158 (define_insn "xop_sha<mode>3"
17159 [(set (match_operand:VI_128 0 "register_operand" "=x,x")
17160 (if_then_else:VI_128
17162 (match_operand:VI_128 2 "nonimmediate_operand" "x,m")
17165 (match_operand:VI_128 1 "nonimmediate_operand" "xm,x")
17169 (neg:VI_128 (match_dup 2)))))]
17170 "TARGET_XOP && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
17171 "vpsha<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
17172 [(set_attr "type" "sseishft")
17173 (set_attr "prefix_data16" "0")
17174 (set_attr "prefix_extra" "2")
17175 (set_attr "mode" "TI")])
17177 (define_insn "xop_shl<mode>3"
17178 [(set (match_operand:VI_128 0 "register_operand" "=x,x")
17179 (if_then_else:VI_128
17181 (match_operand:VI_128 2 "nonimmediate_operand" "x,m")
17184 (match_operand:VI_128 1 "nonimmediate_operand" "xm,x")
17188 (neg:VI_128 (match_dup 2)))))]
17189 "TARGET_XOP && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
17190 "vpshl<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
17191 [(set_attr "type" "sseishft")
17192 (set_attr "prefix_data16" "0")
17193 (set_attr "prefix_extra" "2")
17194 (set_attr "mode" "TI")])
17196 (define_expand "<shift_insn><mode>3"
17197 [(set (match_operand:VI1_AVX512 0 "register_operand")
17198 (any_shift:VI1_AVX512
17199 (match_operand:VI1_AVX512 1 "register_operand")
17200 (match_operand:SI 2 "nonmemory_operand")))]
17203 if (TARGET_XOP && <MODE>mode == V16QImode)
17205 bool negate = false;
17206 rtx (*gen) (rtx, rtx, rtx);
17210 if (<CODE> != ASHIFT)
17212 if (CONST_INT_P (operands[2]))
17213 operands[2] = GEN_INT (-INTVAL (operands[2]));
17217 par = gen_rtx_PARALLEL (V16QImode, rtvec_alloc (16));
17218 for (i = 0; i < 16; i++)
17219 XVECEXP (par, 0, i) = operands[2];
17221 tmp = gen_reg_rtx (V16QImode);
17222 emit_insn (gen_vec_initv16qiqi (tmp, par));
17225 emit_insn (gen_negv16qi2 (tmp, tmp));
17227 gen = (<CODE> == LSHIFTRT ? gen_xop_shlv16qi3 : gen_xop_shav16qi3);
17228 emit_insn (gen (operands[0], operands[1], tmp));
17231 ix86_expand_vecop_qihi (<CODE>, operands[0], operands[1], operands[2]);
17235 (define_expand "ashrv2di3"
17236 [(set (match_operand:V2DI 0 "register_operand")
17238 (match_operand:V2DI 1 "register_operand")
17239 (match_operand:DI 2 "nonmemory_operand")))]
17240 "TARGET_XOP || TARGET_AVX512VL"
17242 if (!TARGET_AVX512VL)
17244 rtx reg = gen_reg_rtx (V2DImode);
17246 bool negate = false;
17249 if (CONST_INT_P (operands[2]))
17250 operands[2] = GEN_INT (-INTVAL (operands[2]));
17254 par = gen_rtx_PARALLEL (V2DImode, rtvec_alloc (2));
17255 for (i = 0; i < 2; i++)
17256 XVECEXP (par, 0, i) = operands[2];
17258 emit_insn (gen_vec_initv2didi (reg, par));
17261 emit_insn (gen_negv2di2 (reg, reg));
17263 emit_insn (gen_xop_shav2di3 (operands[0], operands[1], reg));
17268 ;; XOP FRCZ support
17269 (define_insn "xop_frcz<mode>2"
17270 [(set (match_operand:FMAMODE 0 "register_operand" "=x")
17272 [(match_operand:FMAMODE 1 "nonimmediate_operand" "xm")]
17275 "vfrcz<ssemodesuffix>\t{%1, %0|%0, %1}"
17276 [(set_attr "type" "ssecvt1")
17277 (set_attr "mode" "<MODE>")])
17279 (define_expand "xop_vmfrcz<mode>2"
17280 [(set (match_operand:VF_128 0 "register_operand")
17283 [(match_operand:VF_128 1 "nonimmediate_operand")]
17288 "operands[2] = CONST0_RTX (<MODE>mode);")
17290 (define_insn "*xop_vmfrcz<mode>2"
17291 [(set (match_operand:VF_128 0 "register_operand" "=x")
17294 [(match_operand:VF_128 1 "nonimmediate_operand" "xm")]
17296 (match_operand:VF_128 2 "const0_operand")
17299 "vfrcz<ssescalarmodesuffix>\t{%1, %0|%0, %<iptr>1}"
17300 [(set_attr "type" "ssecvt1")
17301 (set_attr "mode" "<MODE>")])
17303 (define_insn "xop_maskcmp<mode>3"
17304 [(set (match_operand:VI_128 0 "register_operand" "=x")
17305 (match_operator:VI_128 1 "ix86_comparison_int_operator"
17306 [(match_operand:VI_128 2 "register_operand" "x")
17307 (match_operand:VI_128 3 "nonimmediate_operand" "xm")]))]
17309 "vpcom%Y1<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}"
17310 [(set_attr "type" "sse4arg")
17311 (set_attr "prefix_data16" "0")
17312 (set_attr "prefix_rep" "0")
17313 (set_attr "prefix_extra" "2")
17314 (set_attr "length_immediate" "1")
17315 (set_attr "mode" "TI")])
17317 (define_insn "xop_maskcmp_uns<mode>3"
17318 [(set (match_operand:VI_128 0 "register_operand" "=x")
17319 (match_operator:VI_128 1 "ix86_comparison_uns_operator"
17320 [(match_operand:VI_128 2 "register_operand" "x")
17321 (match_operand:VI_128 3 "nonimmediate_operand" "xm")]))]
17323 "vpcom%Y1u<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}"
17324 [(set_attr "type" "ssecmp")
17325 (set_attr "prefix_data16" "0")
17326 (set_attr "prefix_rep" "0")
17327 (set_attr "prefix_extra" "2")
17328 (set_attr "length_immediate" "1")
17329 (set_attr "mode" "TI")])
17331 ;; Version of pcom*u* that is called from the intrinsics that allows pcomequ*
17332 ;; and pcomneu* not to be converted to the signed ones in case somebody needs
17333 ;; the exact instruction generated for the intrinsic.
17334 (define_insn "xop_maskcmp_uns2<mode>3"
17335 [(set (match_operand:VI_128 0 "register_operand" "=x")
17337 [(match_operator:VI_128 1 "ix86_comparison_uns_operator"
17338 [(match_operand:VI_128 2 "register_operand" "x")
17339 (match_operand:VI_128 3 "nonimmediate_operand" "xm")])]
17340 UNSPEC_XOP_UNSIGNED_CMP))]
17342 "vpcom%Y1u<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}"
17343 [(set_attr "type" "ssecmp")
17344 (set_attr "prefix_data16" "0")
17345 (set_attr "prefix_extra" "2")
17346 (set_attr "length_immediate" "1")
17347 (set_attr "mode" "TI")])
17349 ;; Pcomtrue and pcomfalse support. These are useless instructions, but are
17350 ;; being added here to be complete.
17351 (define_insn "xop_pcom_tf<mode>3"
17352 [(set (match_operand:VI_128 0 "register_operand" "=x")
17354 [(match_operand:VI_128 1 "register_operand" "x")
17355 (match_operand:VI_128 2 "nonimmediate_operand" "xm")
17356 (match_operand:SI 3 "const_int_operand" "n")]
17357 UNSPEC_XOP_TRUEFALSE))]
17360 return ((INTVAL (operands[3]) != 0)
17361 ? "vpcomtrue<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
17362 : "vpcomfalse<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}");
17364 [(set_attr "type" "ssecmp")
17365 (set_attr "prefix_data16" "0")
17366 (set_attr "prefix_extra" "2")
17367 (set_attr "length_immediate" "1")
17368 (set_attr "mode" "TI")])
17370 (define_insn "xop_vpermil2<mode>3"
17371 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x")
17373 [(match_operand:VF_128_256 1 "register_operand" "x,x")
17374 (match_operand:VF_128_256 2 "nonimmediate_operand" "x,m")
17375 (match_operand:<sseintvecmode> 3 "nonimmediate_operand" "xm,x")
17376 (match_operand:SI 4 "const_0_to_3_operand" "n,n")]
17379 "vpermil2<ssemodesuffix>\t{%4, %3, %2, %1, %0|%0, %1, %2, %3, %4}"
17380 [(set_attr "type" "sse4arg")
17381 (set_attr "length_immediate" "1")
17382 (set_attr "mode" "<MODE>")])
17384 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
17386 (define_insn "aesenc"
17387 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17388 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17389 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
17393 aesenc\t{%2, %0|%0, %2}
17394 vaesenc\t{%2, %1, %0|%0, %1, %2}"
17395 [(set_attr "isa" "noavx,avx")
17396 (set_attr "type" "sselog1")
17397 (set_attr "prefix_extra" "1")
17398 (set_attr "prefix" "orig,vex")
17399 (set_attr "btver2_decode" "double,double")
17400 (set_attr "mode" "TI")])
17402 (define_insn "aesenclast"
17403 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17404 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17405 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
17406 UNSPEC_AESENCLAST))]
17409 aesenclast\t{%2, %0|%0, %2}
17410 vaesenclast\t{%2, %1, %0|%0, %1, %2}"
17411 [(set_attr "isa" "noavx,avx")
17412 (set_attr "type" "sselog1")
17413 (set_attr "prefix_extra" "1")
17414 (set_attr "prefix" "orig,vex")
17415 (set_attr "btver2_decode" "double,double")
17416 (set_attr "mode" "TI")])
17418 (define_insn "aesdec"
17419 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17420 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17421 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
17425 aesdec\t{%2, %0|%0, %2}
17426 vaesdec\t{%2, %1, %0|%0, %1, %2}"
17427 [(set_attr "isa" "noavx,avx")
17428 (set_attr "type" "sselog1")
17429 (set_attr "prefix_extra" "1")
17430 (set_attr "prefix" "orig,vex")
17431 (set_attr "btver2_decode" "double,double")
17432 (set_attr "mode" "TI")])
17434 (define_insn "aesdeclast"
17435 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17436 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17437 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
17438 UNSPEC_AESDECLAST))]
17441 aesdeclast\t{%2, %0|%0, %2}
17442 vaesdeclast\t{%2, %1, %0|%0, %1, %2}"
17443 [(set_attr "isa" "noavx,avx")
17444 (set_attr "type" "sselog1")
17445 (set_attr "prefix_extra" "1")
17446 (set_attr "prefix" "orig,vex")
17447 (set_attr "btver2_decode" "double,double")
17448 (set_attr "mode" "TI")])
17450 (define_insn "aesimc"
17451 [(set (match_operand:V2DI 0 "register_operand" "=x")
17452 (unspec:V2DI [(match_operand:V2DI 1 "vector_operand" "xBm")]
17455 "%vaesimc\t{%1, %0|%0, %1}"
17456 [(set_attr "type" "sselog1")
17457 (set_attr "prefix_extra" "1")
17458 (set_attr "prefix" "maybe_vex")
17459 (set_attr "mode" "TI")])
17461 (define_insn "aeskeygenassist"
17462 [(set (match_operand:V2DI 0 "register_operand" "=x")
17463 (unspec:V2DI [(match_operand:V2DI 1 "vector_operand" "xBm")
17464 (match_operand:SI 2 "const_0_to_255_operand" "n")]
17465 UNSPEC_AESKEYGENASSIST))]
17467 "%vaeskeygenassist\t{%2, %1, %0|%0, %1, %2}"
17468 [(set_attr "type" "sselog1")
17469 (set_attr "prefix_extra" "1")
17470 (set_attr "length_immediate" "1")
17471 (set_attr "prefix" "maybe_vex")
17472 (set_attr "mode" "TI")])
17474 (define_insn "pclmulqdq"
17475 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17476 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17477 (match_operand:V2DI 2 "vector_operand" "xBm,xm")
17478 (match_operand:SI 3 "const_0_to_255_operand" "n,n")]
17482 pclmulqdq\t{%3, %2, %0|%0, %2, %3}
17483 vpclmulqdq\t{%3, %2, %1, %0|%0, %1, %2, %3}"
17484 [(set_attr "isa" "noavx,avx")
17485 (set_attr "type" "sselog1")
17486 (set_attr "prefix_extra" "1")
17487 (set_attr "length_immediate" "1")
17488 (set_attr "prefix" "orig,vex")
17489 (set_attr "mode" "TI")])
17491 (define_expand "avx_vzeroall"
17492 [(match_par_dup 0 [(const_int 0)])]
17495 int nregs = TARGET_64BIT ? 16 : 8;
17498 operands[0] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (nregs + 1));
17500 XVECEXP (operands[0], 0, 0)
17501 = gen_rtx_UNSPEC_VOLATILE (VOIDmode, gen_rtvec (1, const0_rtx),
17504 for (regno = 0; regno < nregs; regno++)
17505 XVECEXP (operands[0], 0, regno + 1)
17506 = gen_rtx_SET (gen_rtx_REG (V8SImode, GET_SSE_REGNO (regno)),
17507 CONST0_RTX (V8SImode));
17510 (define_insn "*avx_vzeroall"
17511 [(match_parallel 0 "vzeroall_operation"
17512 [(unspec_volatile [(const_int 0)] UNSPECV_VZEROALL)])]
17515 [(set_attr "type" "sse")
17516 (set_attr "modrm" "0")
17517 (set_attr "memory" "none")
17518 (set_attr "prefix" "vex")
17519 (set_attr "btver2_decode" "vector")
17520 (set_attr "mode" "OI")])
17522 ;; Clear the upper 128bits of AVX registers, equivalent to a NOP
17523 ;; if the upper 128bits are unused.
17524 (define_insn "avx_vzeroupper"
17525 [(unspec_volatile [(const_int 0)] UNSPECV_VZEROUPPER)]
17528 [(set_attr "type" "sse")
17529 (set_attr "modrm" "0")
17530 (set_attr "memory" "none")
17531 (set_attr "prefix" "vex")
17532 (set_attr "btver2_decode" "vector")
17533 (set_attr "mode" "OI")])
17535 (define_mode_attr pbroadcast_evex_isa
17536 [(V64QI "avx512bw") (V32QI "avx512bw") (V16QI "avx512bw")
17537 (V32HI "avx512bw") (V16HI "avx512bw") (V8HI "avx512bw")
17538 (V16SI "avx512f") (V8SI "avx512f") (V4SI "avx512f")
17539 (V8DI "avx512f") (V4DI "avx512f") (V2DI "avx512f")])
17541 (define_insn "avx2_pbroadcast<mode>"
17542 [(set (match_operand:VI 0 "register_operand" "=x,v")
17544 (vec_select:<ssescalarmode>
17545 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "xm,vm")
17546 (parallel [(const_int 0)]))))]
17548 "vpbroadcast<ssemodesuffix>\t{%1, %0|%0, %<iptr>1}"
17549 [(set_attr "isa" "*,<pbroadcast_evex_isa>")
17550 (set_attr "type" "ssemov")
17551 (set_attr "prefix_extra" "1")
17552 (set_attr "prefix" "vex,evex")
17553 (set_attr "mode" "<sseinsnmode>")])
17555 (define_insn "avx2_pbroadcast<mode>_1"
17556 [(set (match_operand:VI_256 0 "register_operand" "=x,x,v,v")
17557 (vec_duplicate:VI_256
17558 (vec_select:<ssescalarmode>
17559 (match_operand:VI_256 1 "nonimmediate_operand" "m,x,m,v")
17560 (parallel [(const_int 0)]))))]
17563 vpbroadcast<ssemodesuffix>\t{%1, %0|%0, %<iptr>1}
17564 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %x1}
17565 vpbroadcast<ssemodesuffix>\t{%1, %0|%0, %<iptr>1}
17566 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %x1}"
17567 [(set_attr "isa" "*,*,<pbroadcast_evex_isa>,<pbroadcast_evex_isa>")
17568 (set_attr "type" "ssemov")
17569 (set_attr "prefix_extra" "1")
17570 (set_attr "prefix" "vex")
17571 (set_attr "mode" "<sseinsnmode>")])
17573 (define_insn "<avx2_avx512>_permvar<mode><mask_name>"
17574 [(set (match_operand:VI48F_256_512 0 "register_operand" "=v")
17575 (unspec:VI48F_256_512
17576 [(match_operand:VI48F_256_512 1 "nonimmediate_operand" "vm")
17577 (match_operand:<sseintvecmode> 2 "register_operand" "v")]
17579 "TARGET_AVX2 && <mask_mode512bit_condition>"
17580 "vperm<ssemodesuffix>\t{%1, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1}"
17581 [(set_attr "type" "sselog")
17582 (set_attr "prefix" "<mask_prefix2>")
17583 (set_attr "mode" "<sseinsnmode>")])
17585 (define_insn "<avx512>_permvar<mode><mask_name>"
17586 [(set (match_operand:VI1_AVX512VL 0 "register_operand" "=v")
17587 (unspec:VI1_AVX512VL
17588 [(match_operand:VI1_AVX512VL 1 "nonimmediate_operand" "vm")
17589 (match_operand:<sseintvecmode> 2 "register_operand" "v")]
17591 "TARGET_AVX512VBMI && <mask_mode512bit_condition>"
17592 "vperm<ssemodesuffix>\t{%1, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1}"
17593 [(set_attr "type" "sselog")
17594 (set_attr "prefix" "<mask_prefix2>")
17595 (set_attr "mode" "<sseinsnmode>")])
17597 (define_insn "<avx512>_permvar<mode><mask_name>"
17598 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
17599 (unspec:VI2_AVX512VL
17600 [(match_operand:VI2_AVX512VL 1 "nonimmediate_operand" "vm")
17601 (match_operand:<sseintvecmode> 2 "register_operand" "v")]
17603 "TARGET_AVX512BW && <mask_mode512bit_condition>"
17604 "vperm<ssemodesuffix>\t{%1, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1}"
17605 [(set_attr "type" "sselog")
17606 (set_attr "prefix" "<mask_prefix2>")
17607 (set_attr "mode" "<sseinsnmode>")])
17609 (define_expand "avx2_perm<mode>"
17610 [(match_operand:VI8F_256 0 "register_operand")
17611 (match_operand:VI8F_256 1 "nonimmediate_operand")
17612 (match_operand:SI 2 "const_0_to_255_operand")]
17615 int mask = INTVAL (operands[2]);
17616 emit_insn (gen_avx2_perm<mode>_1 (operands[0], operands[1],
17617 GEN_INT ((mask >> 0) & 3),
17618 GEN_INT ((mask >> 2) & 3),
17619 GEN_INT ((mask >> 4) & 3),
17620 GEN_INT ((mask >> 6) & 3)));
17624 (define_expand "avx512vl_perm<mode>_mask"
17625 [(match_operand:VI8F_256 0 "register_operand")
17626 (match_operand:VI8F_256 1 "nonimmediate_operand")
17627 (match_operand:SI 2 "const_0_to_255_operand")
17628 (match_operand:VI8F_256 3 "vector_move_operand")
17629 (match_operand:<avx512fmaskmode> 4 "register_operand")]
17632 int mask = INTVAL (operands[2]);
17633 emit_insn (gen_<avx2_avx512>_perm<mode>_1_mask (operands[0], operands[1],
17634 GEN_INT ((mask >> 0) & 3),
17635 GEN_INT ((mask >> 2) & 3),
17636 GEN_INT ((mask >> 4) & 3),
17637 GEN_INT ((mask >> 6) & 3),
17638 operands[3], operands[4]));
17642 (define_insn "avx2_perm<mode>_1<mask_name>"
17643 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
17644 (vec_select:VI8F_256
17645 (match_operand:VI8F_256 1 "nonimmediate_operand" "vm")
17646 (parallel [(match_operand 2 "const_0_to_3_operand")
17647 (match_operand 3 "const_0_to_3_operand")
17648 (match_operand 4 "const_0_to_3_operand")
17649 (match_operand 5 "const_0_to_3_operand")])))]
17650 "TARGET_AVX2 && <mask_mode512bit_condition>"
17653 mask |= INTVAL (operands[2]) << 0;
17654 mask |= INTVAL (operands[3]) << 2;
17655 mask |= INTVAL (operands[4]) << 4;
17656 mask |= INTVAL (operands[5]) << 6;
17657 operands[2] = GEN_INT (mask);
17658 return "vperm<ssemodesuffix>\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
17660 [(set_attr "type" "sselog")
17661 (set_attr "prefix" "<mask_prefix2>")
17662 (set_attr "mode" "<sseinsnmode>")])
17664 (define_expand "avx512f_perm<mode>"
17665 [(match_operand:V8FI 0 "register_operand")
17666 (match_operand:V8FI 1 "nonimmediate_operand")
17667 (match_operand:SI 2 "const_0_to_255_operand")]
17670 int mask = INTVAL (operands[2]);
17671 emit_insn (gen_avx512f_perm<mode>_1 (operands[0], operands[1],
17672 GEN_INT ((mask >> 0) & 3),
17673 GEN_INT ((mask >> 2) & 3),
17674 GEN_INT ((mask >> 4) & 3),
17675 GEN_INT ((mask >> 6) & 3),
17676 GEN_INT (((mask >> 0) & 3) + 4),
17677 GEN_INT (((mask >> 2) & 3) + 4),
17678 GEN_INT (((mask >> 4) & 3) + 4),
17679 GEN_INT (((mask >> 6) & 3) + 4)));
17683 (define_expand "avx512f_perm<mode>_mask"
17684 [(match_operand:V8FI 0 "register_operand")
17685 (match_operand:V8FI 1 "nonimmediate_operand")
17686 (match_operand:SI 2 "const_0_to_255_operand")
17687 (match_operand:V8FI 3 "vector_move_operand")
17688 (match_operand:<avx512fmaskmode> 4 "register_operand")]
17691 int mask = INTVAL (operands[2]);
17692 emit_insn (gen_avx512f_perm<mode>_1_mask (operands[0], operands[1],
17693 GEN_INT ((mask >> 0) & 3),
17694 GEN_INT ((mask >> 2) & 3),
17695 GEN_INT ((mask >> 4) & 3),
17696 GEN_INT ((mask >> 6) & 3),
17697 GEN_INT (((mask >> 0) & 3) + 4),
17698 GEN_INT (((mask >> 2) & 3) + 4),
17699 GEN_INT (((mask >> 4) & 3) + 4),
17700 GEN_INT (((mask >> 6) & 3) + 4),
17701 operands[3], operands[4]));
17705 (define_insn "avx512f_perm<mode>_1<mask_name>"
17706 [(set (match_operand:V8FI 0 "register_operand" "=v")
17708 (match_operand:V8FI 1 "nonimmediate_operand" "vm")
17709 (parallel [(match_operand 2 "const_0_to_3_operand")
17710 (match_operand 3 "const_0_to_3_operand")
17711 (match_operand 4 "const_0_to_3_operand")
17712 (match_operand 5 "const_0_to_3_operand")
17713 (match_operand 6 "const_4_to_7_operand")
17714 (match_operand 7 "const_4_to_7_operand")
17715 (match_operand 8 "const_4_to_7_operand")
17716 (match_operand 9 "const_4_to_7_operand")])))]
17717 "TARGET_AVX512F && <mask_mode512bit_condition>
17718 && (INTVAL (operands[2]) == (INTVAL (operands[6]) - 4)
17719 && INTVAL (operands[3]) == (INTVAL (operands[7]) - 4)
17720 && INTVAL (operands[4]) == (INTVAL (operands[8]) - 4)
17721 && INTVAL (operands[5]) == (INTVAL (operands[9]) - 4))"
17724 mask |= INTVAL (operands[2]) << 0;
17725 mask |= INTVAL (operands[3]) << 2;
17726 mask |= INTVAL (operands[4]) << 4;
17727 mask |= INTVAL (operands[5]) << 6;
17728 operands[2] = GEN_INT (mask);
17729 return "vperm<ssemodesuffix>\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
17731 [(set_attr "type" "sselog")
17732 (set_attr "prefix" "<mask_prefix2>")
17733 (set_attr "mode" "<sseinsnmode>")])
17735 (define_insn "avx2_permv2ti"
17736 [(set (match_operand:V4DI 0 "register_operand" "=x")
17738 [(match_operand:V4DI 1 "register_operand" "x")
17739 (match_operand:V4DI 2 "nonimmediate_operand" "xm")
17740 (match_operand:SI 3 "const_0_to_255_operand" "n")]
17743 "vperm2i128\t{%3, %2, %1, %0|%0, %1, %2, %3}"
17744 [(set_attr "type" "sselog")
17745 (set_attr "prefix" "vex")
17746 (set_attr "mode" "OI")])
17748 (define_insn "avx2_vec_dupv4df"
17749 [(set (match_operand:V4DF 0 "register_operand" "=v")
17750 (vec_duplicate:V4DF
17752 (match_operand:V2DF 1 "register_operand" "v")
17753 (parallel [(const_int 0)]))))]
17755 "vbroadcastsd\t{%1, %0|%0, %1}"
17756 [(set_attr "type" "sselog1")
17757 (set_attr "prefix" "maybe_evex")
17758 (set_attr "mode" "V4DF")])
17760 (define_insn "<avx512>_vec_dup<mode>_1"
17761 [(set (match_operand:VI_AVX512BW 0 "register_operand" "=v,v")
17762 (vec_duplicate:VI_AVX512BW
17763 (vec_select:<ssescalarmode>
17764 (match_operand:VI_AVX512BW 1 "nonimmediate_operand" "v,m")
17765 (parallel [(const_int 0)]))))]
17768 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %x1}
17769 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %<iptr>1}"
17770 [(set_attr "type" "ssemov")
17771 (set_attr "prefix" "evex")
17772 (set_attr "mode" "<sseinsnmode>")])
17774 (define_insn "<avx512>_vec_dup<mode><mask_name>"
17775 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v")
17776 (vec_duplicate:V48_AVX512VL
17777 (vec_select:<ssescalarmode>
17778 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "vm")
17779 (parallel [(const_int 0)]))))]
17782 /* There is no DF broadcast (in AVX-512*) to 128b register.
17783 Mimic it with integer variant. */
17784 if (<MODE>mode == V2DFmode)
17785 return "vpbroadcastq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}";
17787 return "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %<iptr>1}";
17789 [(set_attr "type" "ssemov")
17790 (set_attr "prefix" "evex")
17791 (set_attr "mode" "<sseinsnmode>")])
17793 (define_insn "<avx512>_vec_dup<mode><mask_name>"
17794 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
17795 (vec_duplicate:VI12_AVX512VL
17796 (vec_select:<ssescalarmode>
17797 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "vm")
17798 (parallel [(const_int 0)]))))]
17800 "vpbroadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %<iptr>1}"
17801 [(set_attr "type" "ssemov")
17802 (set_attr "prefix" "evex")
17803 (set_attr "mode" "<sseinsnmode>")])
17805 (define_insn "<mask_codefor>avx512f_broadcast<mode><mask_name>"
17806 [(set (match_operand:V16FI 0 "register_operand" "=v,v")
17807 (vec_duplicate:V16FI
17808 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "v,m")))]
17811 vshuf<shuffletype>32x4\t{$0x0, %g1, %g1, %0<mask_operand2>|%0<mask_operand2>, %g1, %g1, 0x0}
17812 vbroadcast<shuffletype>32x4\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17813 [(set_attr "type" "ssemov")
17814 (set_attr "prefix" "evex")
17815 (set_attr "mode" "<sseinsnmode>")])
17817 (define_insn "<mask_codefor>avx512f_broadcast<mode><mask_name>"
17818 [(set (match_operand:V8FI 0 "register_operand" "=v,v")
17819 (vec_duplicate:V8FI
17820 (match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "v,m")))]
17823 vshuf<shuffletype>64x2\t{$0x44, %g1, %g1, %0<mask_operand2>|%0<mask_operand2>, %g1, %g1, 0x44}
17824 vbroadcast<shuffletype>64x4\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17825 [(set_attr "type" "ssemov")
17826 (set_attr "prefix" "evex")
17827 (set_attr "mode" "<sseinsnmode>")])
17829 (define_insn "<mask_codefor><avx512>_vec_dup_gpr<mode><mask_name>"
17830 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v,v")
17831 (vec_duplicate:VI12_AVX512VL
17832 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "vm,r")))]
17835 vpbroadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}
17836 vpbroadcast<bcstscalarsuff>\t{%k1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
17837 [(set_attr "type" "ssemov")
17838 (set_attr "prefix" "evex")
17839 (set_attr "mode" "<sseinsnmode>")])
17841 (define_insn "<mask_codefor><avx512>_vec_dup_gpr<mode><mask_name>"
17842 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v,v")
17843 (vec_duplicate:V48_AVX512VL
17844 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "vm,r")))]
17846 "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17847 [(set_attr "type" "ssemov")
17848 (set_attr "prefix" "evex")
17849 (set_attr "mode" "<sseinsnmode>")
17850 (set (attr "enabled")
17851 (if_then_else (eq_attr "alternative" "1")
17852 (symbol_ref "GET_MODE_CLASS (<ssescalarmode>mode) == MODE_INT
17853 && (<ssescalarmode>mode != DImode || TARGET_64BIT)")
17856 (define_insn "vec_dupv4sf"
17857 [(set (match_operand:V4SF 0 "register_operand" "=v,v,x")
17858 (vec_duplicate:V4SF
17859 (match_operand:SF 1 "nonimmediate_operand" "Yv,m,0")))]
17862 vshufps\t{$0, %1, %1, %0|%0, %1, %1, 0}
17863 vbroadcastss\t{%1, %0|%0, %1}
17864 shufps\t{$0, %0, %0|%0, %0, 0}"
17865 [(set_attr "isa" "avx,avx,noavx")
17866 (set_attr "type" "sseshuf1,ssemov,sseshuf1")
17867 (set_attr "length_immediate" "1,0,1")
17868 (set_attr "prefix_extra" "0,1,*")
17869 (set_attr "prefix" "maybe_evex,maybe_evex,orig")
17870 (set_attr "mode" "V4SF")])
17872 (define_insn "*vec_dupv4si"
17873 [(set (match_operand:V4SI 0 "register_operand" "=v,v,x")
17874 (vec_duplicate:V4SI
17875 (match_operand:SI 1 "nonimmediate_operand" "Yv,m,0")))]
17878 %vpshufd\t{$0, %1, %0|%0, %1, 0}
17879 vbroadcastss\t{%1, %0|%0, %1}
17880 shufps\t{$0, %0, %0|%0, %0, 0}"
17881 [(set_attr "isa" "sse2,avx,noavx")
17882 (set_attr "type" "sselog1,ssemov,sselog1")
17883 (set_attr "length_immediate" "1,0,1")
17884 (set_attr "prefix_extra" "0,1,*")
17885 (set_attr "prefix" "maybe_vex,maybe_evex,orig")
17886 (set_attr "mode" "TI,V4SF,V4SF")])
17888 (define_insn "*vec_dupv2di"
17889 [(set (match_operand:V2DI 0 "register_operand" "=x,v,v,x")
17890 (vec_duplicate:V2DI
17891 (match_operand:DI 1 "nonimmediate_operand" " 0,Yv,m,0")))]
17895 vpunpcklqdq\t{%d1, %0|%0, %d1}
17896 %vmovddup\t{%1, %0|%0, %1}
17898 [(set_attr "isa" "sse2_noavx,avx,sse3,noavx")
17899 (set_attr "type" "sselog1,sselog1,sselog1,ssemov")
17900 (set_attr "prefix" "orig,maybe_evex,maybe_vex,orig")
17901 (set_attr "mode" "TI,TI,DF,V4SF")])
17903 (define_insn "avx2_vbroadcasti128_<mode>"
17904 [(set (match_operand:VI_256 0 "register_operand" "=x,v,v")
17906 (match_operand:<ssehalfvecmode> 1 "memory_operand" "m,m,m")
17910 vbroadcasti128\t{%1, %0|%0, %1}
17911 vbroadcast<i128vldq>\t{%1, %0|%0, %1}
17912 vbroadcast<shuffletype>32x4\t{%1, %0|%0, %1}"
17913 [(set_attr "isa" "*,avx512dq,avx512vl")
17914 (set_attr "type" "ssemov")
17915 (set_attr "prefix_extra" "1")
17916 (set_attr "prefix" "vex,evex,evex")
17917 (set_attr "mode" "OI")])
17919 ;; Modes handled by AVX vec_dup patterns.
17920 (define_mode_iterator AVX_VEC_DUP_MODE
17921 [V8SI V8SF V4DI V4DF])
17922 (define_mode_attr vecdupssescalarmodesuffix
17923 [(V8SF "ss") (V4DF "sd") (V8SI "ss") (V4DI "sd")])
17924 ;; Modes handled by AVX2 vec_dup patterns.
17925 (define_mode_iterator AVX2_VEC_DUP_MODE
17926 [V32QI V16QI V16HI V8HI V8SI V4SI])
17928 (define_insn "*vec_dup<mode>"
17929 [(set (match_operand:AVX2_VEC_DUP_MODE 0 "register_operand" "=x,x,v")
17930 (vec_duplicate:AVX2_VEC_DUP_MODE
17931 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "m,x,$r")))]
17934 v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0|%0, %1}
17935 v<sseintprefix>broadcast<bcstscalarsuff>\t{%x1, %0|%0, %x1}
17937 [(set_attr "isa" "*,*,noavx512vl")
17938 (set_attr "type" "ssemov")
17939 (set_attr "prefix_extra" "1")
17940 (set_attr "prefix" "maybe_evex")
17941 (set_attr "mode" "<sseinsnmode>")
17942 (set (attr "preferred_for_speed")
17943 (cond [(eq_attr "alternative" "2")
17944 (symbol_ref "TARGET_INTER_UNIT_MOVES_TO_VEC")
17946 (symbol_ref "true")))])
17948 (define_insn "vec_dup<mode>"
17949 [(set (match_operand:AVX_VEC_DUP_MODE 0 "register_operand" "=x,x,x,v,x")
17950 (vec_duplicate:AVX_VEC_DUP_MODE
17951 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "m,m,x,v,?x")))]
17954 v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0|%0, %1}
17955 vbroadcast<vecdupssescalarmodesuffix>\t{%1, %0|%0, %1}
17956 v<sseintprefix>broadcast<bcstscalarsuff>\t{%x1, %0|%0, %x1}
17957 v<sseintprefix>broadcast<bcstscalarsuff>\t{%x1, %g0|%g0, %x1}
17959 [(set_attr "type" "ssemov")
17960 (set_attr "prefix_extra" "1")
17961 (set_attr "prefix" "maybe_evex")
17962 (set_attr "isa" "avx2,noavx2,avx2,avx512f,noavx2")
17963 (set_attr "mode" "<sseinsnmode>,V8SF,<sseinsnmode>,<sseinsnmode>,V8SF")])
17966 [(set (match_operand:AVX2_VEC_DUP_MODE 0 "register_operand")
17967 (vec_duplicate:AVX2_VEC_DUP_MODE
17968 (match_operand:<ssescalarmode> 1 "register_operand")))]
17970 /* Disable this splitter if avx512vl_vec_dup_gprv*[qhs]i insn is
17971 available, because then we can broadcast from GPRs directly.
17972 For V*[QH]I modes it requires both -mavx512vl and -mavx512bw,
17973 for V*SI mode it requires just -mavx512vl. */
17974 && !(TARGET_AVX512VL
17975 && (TARGET_AVX512BW || <ssescalarmode>mode == SImode))
17976 && reload_completed && GENERAL_REG_P (operands[1])"
17979 emit_insn (gen_vec_setv4si_0 (gen_lowpart (V4SImode, operands[0]),
17980 CONST0_RTX (V4SImode),
17981 gen_lowpart (SImode, operands[1])));
17982 emit_insn (gen_avx2_pbroadcast<mode> (operands[0],
17983 gen_lowpart (<ssexmmmode>mode,
17989 [(set (match_operand:AVX_VEC_DUP_MODE 0 "register_operand")
17990 (vec_duplicate:AVX_VEC_DUP_MODE
17991 (match_operand:<ssescalarmode> 1 "register_operand")))]
17992 "TARGET_AVX && !TARGET_AVX2 && reload_completed"
17993 [(set (match_dup 2)
17994 (vec_duplicate:<ssehalfvecmode> (match_dup 1)))
17996 (vec_concat:AVX_VEC_DUP_MODE (match_dup 2) (match_dup 2)))]
17997 "operands[2] = gen_lowpart (<ssehalfvecmode>mode, operands[0]);")
17999 (define_insn "avx_vbroadcastf128_<mode>"
18000 [(set (match_operand:V_256 0 "register_operand" "=x,x,x,v,v,v,v")
18002 (match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "m,0,?x,m,0,m,0")
18006 vbroadcast<i128>\t{%1, %0|%0, %1}
18007 vinsert<i128>\t{$1, %1, %0, %0|%0, %0, %1, 1}
18008 vperm2<i128>\t{$0, %t1, %t1, %0|%0, %t1, %t1, 0}
18009 vbroadcast<i128vldq>\t{%1, %0|%0, %1}
18010 vinsert<i128vldq>\t{$1, %1, %0, %0|%0, %0, %1, 1}
18011 vbroadcast<shuffletype>32x4\t{%1, %0|%0, %1}
18012 vinsert<shuffletype>32x4\t{$1, %1, %0, %0|%0, %0, %1, 1}"
18013 [(set_attr "isa" "*,*,*,avx512dq,avx512dq,avx512vl,avx512vl")
18014 (set_attr "type" "ssemov,sselog1,sselog1,ssemov,sselog1,ssemov,sselog1")
18015 (set_attr "prefix_extra" "1")
18016 (set_attr "length_immediate" "0,1,1,0,1,0,1")
18017 (set_attr "prefix" "vex,vex,vex,evex,evex,evex,evex")
18018 (set_attr "mode" "<sseinsnmode>")])
18020 ;; For broadcast[i|f]32x2. Yes there is no v4sf version, only v4si.
18021 (define_mode_iterator VI4F_BRCST32x2
18022 [V16SI (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")
18023 V16SF (V8SF "TARGET_AVX512VL")])
18025 (define_mode_attr 64x2mode
18026 [(V8DF "V2DF") (V8DI "V2DI") (V4DI "V2DI") (V4DF "V2DF")])
18028 (define_mode_attr 32x2mode
18029 [(V16SF "V2SF") (V16SI "V2SI") (V8SI "V2SI")
18030 (V8SF "V2SF") (V4SI "V2SI")])
18032 (define_insn "<mask_codefor>avx512dq_broadcast<mode><mask_name>"
18033 [(set (match_operand:VI4F_BRCST32x2 0 "register_operand" "=v")
18034 (vec_duplicate:VI4F_BRCST32x2
18035 (vec_select:<32x2mode>
18036 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "vm")
18037 (parallel [(const_int 0) (const_int 1)]))))]
18039 "vbroadcast<shuffletype>32x2\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
18040 [(set_attr "type" "ssemov")
18041 (set_attr "prefix_extra" "1")
18042 (set_attr "prefix" "evex")
18043 (set_attr "mode" "<sseinsnmode>")])
18045 (define_insn "<mask_codefor>avx512vl_broadcast<mode><mask_name>_1"
18046 [(set (match_operand:VI4F_256 0 "register_operand" "=v,v")
18047 (vec_duplicate:VI4F_256
18048 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "v,m")))]
18051 vshuf<shuffletype>32x4\t{$0x0, %t1, %t1, %0<mask_operand2>|%0<mask_operand2>, %t1, %t1, 0x0}
18052 vbroadcast<shuffletype>32x4\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
18053 [(set_attr "type" "ssemov")
18054 (set_attr "prefix_extra" "1")
18055 (set_attr "prefix" "evex")
18056 (set_attr "mode" "<sseinsnmode>")])
18058 (define_insn "<mask_codefor>avx512dq_broadcast<mode><mask_name>_1"
18059 [(set (match_operand:V16FI 0 "register_operand" "=v,v")
18060 (vec_duplicate:V16FI
18061 (match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "v,m")))]
18064 vshuf<shuffletype>32x4\t{$0x44, %g1, %g1, %0<mask_operand2>|%0<mask_operand2>, %g1, %g1, 0x44}
18065 vbroadcast<shuffletype>32x8\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
18066 [(set_attr "type" "ssemov")
18067 (set_attr "prefix_extra" "1")
18068 (set_attr "prefix" "evex")
18069 (set_attr "mode" "<sseinsnmode>")])
18071 ;; For broadcast[i|f]64x2
18072 (define_mode_iterator VI8F_BRCST64x2
18073 [V8DI V8DF (V4DI "TARGET_AVX512VL") (V4DF "TARGET_AVX512VL")])
18075 (define_insn "<mask_codefor>avx512dq_broadcast<mode><mask_name>_1"
18076 [(set (match_operand:VI8F_BRCST64x2 0 "register_operand" "=v,v")
18077 (vec_duplicate:VI8F_BRCST64x2
18078 (match_operand:<64x2mode> 1 "nonimmediate_operand" "v,m")))]
18081 vshuf<shuffletype>64x2\t{$0x0, %<xtg_mode>1, %<xtg_mode>1, %0<mask_operand2>|%0<mask_operand2>, %<xtg_mode>1, %<xtg_mode>1, 0x0}
18082 vbroadcast<shuffletype>64x2\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
18083 [(set_attr "type" "ssemov")
18084 (set_attr "prefix_extra" "1")
18085 (set_attr "prefix" "evex")
18086 (set_attr "mode" "<sseinsnmode>")])
18088 (define_insn "avx512cd_maskb_vec_dup<mode>"
18089 [(set (match_operand:VI8_AVX512VL 0 "register_operand" "=v")
18090 (vec_duplicate:VI8_AVX512VL
18092 (match_operand:QI 1 "register_operand" "Yk"))))]
18094 "vpbroadcastmb2q\t{%1, %0|%0, %1}"
18095 [(set_attr "type" "mskmov")
18096 (set_attr "prefix" "evex")
18097 (set_attr "mode" "XI")])
18099 (define_insn "avx512cd_maskw_vec_dup<mode>"
18100 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
18101 (vec_duplicate:VI4_AVX512VL
18103 (match_operand:HI 1 "register_operand" "Yk"))))]
18105 "vpbroadcastmw2d\t{%1, %0|%0, %1}"
18106 [(set_attr "type" "mskmov")
18107 (set_attr "prefix" "evex")
18108 (set_attr "mode" "XI")])
18110 ;; Recognize broadcast as a vec_select as produced by builtin_vec_perm.
18111 ;; If it so happens that the input is in memory, use vbroadcast.
18112 ;; Otherwise use vpermilp (and in the case of 256-bit modes, vperm2f128).
18113 (define_insn "*avx_vperm_broadcast_v4sf"
18114 [(set (match_operand:V4SF 0 "register_operand" "=v,v,v")
18116 (match_operand:V4SF 1 "nonimmediate_operand" "m,o,v")
18117 (match_parallel 2 "avx_vbroadcast_operand"
18118 [(match_operand 3 "const_int_operand" "C,n,n")])))]
18121 int elt = INTVAL (operands[3]);
18122 switch (which_alternative)
18126 operands[1] = adjust_address_nv (operands[1], SFmode, elt * 4);
18127 return "vbroadcastss\t{%1, %0|%0, %k1}";
18129 operands[2] = GEN_INT (elt * 0x55);
18130 return "vpermilps\t{%2, %1, %0|%0, %1, %2}";
18132 gcc_unreachable ();
18135 [(set_attr "type" "ssemov,ssemov,sselog1")
18136 (set_attr "prefix_extra" "1")
18137 (set_attr "length_immediate" "0,0,1")
18138 (set_attr "prefix" "maybe_evex")
18139 (set_attr "mode" "SF,SF,V4SF")])
18141 (define_insn_and_split "*avx_vperm_broadcast_<mode>"
18142 [(set (match_operand:VF_256 0 "register_operand" "=v,v,v")
18144 (match_operand:VF_256 1 "nonimmediate_operand" "m,o,?v")
18145 (match_parallel 2 "avx_vbroadcast_operand"
18146 [(match_operand 3 "const_int_operand" "C,n,n")])))]
18149 "&& reload_completed && (<MODE>mode != V4DFmode || !TARGET_AVX2)"
18150 [(set (match_dup 0) (vec_duplicate:VF_256 (match_dup 1)))]
18152 rtx op0 = operands[0], op1 = operands[1];
18153 int elt = INTVAL (operands[3]);
18159 if (TARGET_AVX2 && elt == 0)
18161 emit_insn (gen_vec_dup<mode> (op0, gen_lowpart (<ssescalarmode>mode,
18166 /* Shuffle element we care about into all elements of the 128-bit lane.
18167 The other lane gets shuffled too, but we don't care. */
18168 if (<MODE>mode == V4DFmode)
18169 mask = (elt & 1 ? 15 : 0);
18171 mask = (elt & 3) * 0x55;
18172 emit_insn (gen_avx_vpermil<mode> (op0, op1, GEN_INT (mask)));
18174 /* Shuffle the lane we care about into both lanes of the dest. */
18175 mask = (elt / (<ssescalarnum> / 2)) * 0x11;
18176 if (EXT_REX_SSE_REG_P (op0))
18178 /* There is no EVEX VPERM2F128, but we can use either VBROADCASTSS
18180 gcc_assert (<MODE>mode == V8SFmode);
18181 if ((mask & 1) == 0)
18182 emit_insn (gen_avx2_vec_dupv8sf (op0,
18183 gen_lowpart (V4SFmode, op0)));
18185 emit_insn (gen_avx512vl_shuf_f32x4_1 (op0, op0, op0,
18186 GEN_INT (4), GEN_INT (5),
18187 GEN_INT (6), GEN_INT (7),
18188 GEN_INT (12), GEN_INT (13),
18189 GEN_INT (14), GEN_INT (15)));
18193 emit_insn (gen_avx_vperm2f128<mode>3 (op0, op0, op0, GEN_INT (mask)));
18197 operands[1] = adjust_address (op1, <ssescalarmode>mode,
18198 elt * GET_MODE_SIZE (<ssescalarmode>mode));
18201 (define_expand "<sse2_avx_avx512f>_vpermil<mode><mask_name>"
18202 [(set (match_operand:VF2 0 "register_operand")
18204 (match_operand:VF2 1 "nonimmediate_operand")
18205 (match_operand:SI 2 "const_0_to_255_operand")))]
18206 "TARGET_AVX && <mask_mode512bit_condition>"
18208 int mask = INTVAL (operands[2]);
18209 rtx perm[<ssescalarnum>];
18212 for (i = 0; i < <ssescalarnum>; i = i + 2)
18214 perm[i] = GEN_INT (((mask >> i) & 1) + i);
18215 perm[i + 1] = GEN_INT (((mask >> (i + 1)) & 1) + i);
18219 = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (<ssescalarnum>, perm));
18222 (define_expand "<sse2_avx_avx512f>_vpermil<mode><mask_name>"
18223 [(set (match_operand:VF1 0 "register_operand")
18225 (match_operand:VF1 1 "nonimmediate_operand")
18226 (match_operand:SI 2 "const_0_to_255_operand")))]
18227 "TARGET_AVX && <mask_mode512bit_condition>"
18229 int mask = INTVAL (operands[2]);
18230 rtx perm[<ssescalarnum>];
18233 for (i = 0; i < <ssescalarnum>; i = i + 4)
18235 perm[i] = GEN_INT (((mask >> 0) & 3) + i);
18236 perm[i + 1] = GEN_INT (((mask >> 2) & 3) + i);
18237 perm[i + 2] = GEN_INT (((mask >> 4) & 3) + i);
18238 perm[i + 3] = GEN_INT (((mask >> 6) & 3) + i);
18242 = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (<ssescalarnum>, perm));
18245 (define_insn "*<sse2_avx_avx512f>_vpermilp<mode><mask_name>"
18246 [(set (match_operand:VF 0 "register_operand" "=v")
18248 (match_operand:VF 1 "nonimmediate_operand" "vm")
18249 (match_parallel 2 ""
18250 [(match_operand 3 "const_int_operand")])))]
18251 "TARGET_AVX && <mask_mode512bit_condition>
18252 && avx_vpermilp_parallel (operands[2], <MODE>mode)"
18254 int mask = avx_vpermilp_parallel (operands[2], <MODE>mode) - 1;
18255 operands[2] = GEN_INT (mask);
18256 return "vpermil<ssemodesuffix>\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}";
18258 [(set_attr "type" "sselog")
18259 (set_attr "prefix_extra" "1")
18260 (set_attr "length_immediate" "1")
18261 (set_attr "prefix" "<mask_prefix>")
18262 (set_attr "mode" "<sseinsnmode>")])
18264 (define_insn "<sse2_avx_avx512f>_vpermilvar<mode>3<mask_name>"
18265 [(set (match_operand:VF 0 "register_operand" "=v")
18267 [(match_operand:VF 1 "register_operand" "v")
18268 (match_operand:<sseintvecmode> 2 "nonimmediate_operand" "vm")]
18270 "TARGET_AVX && <mask_mode512bit_condition>"
18271 "vpermil<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18272 [(set_attr "type" "sselog")
18273 (set_attr "prefix_extra" "1")
18274 (set_attr "btver2_decode" "vector")
18275 (set_attr "prefix" "<mask_prefix>")
18276 (set_attr "mode" "<sseinsnmode>")])
18278 (define_mode_iterator VPERMI2
18279 [V16SI V16SF V8DI V8DF
18280 (V8SI "TARGET_AVX512VL") (V8SF "TARGET_AVX512VL")
18281 (V4DI "TARGET_AVX512VL") (V4DF "TARGET_AVX512VL")
18282 (V4SI "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
18283 (V2DI "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")
18284 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX512BW && TARGET_AVX512VL")
18285 (V8HI "TARGET_AVX512BW && TARGET_AVX512VL")
18286 (V64QI "TARGET_AVX512VBMI") (V32QI "TARGET_AVX512VBMI && TARGET_AVX512VL")
18287 (V16QI "TARGET_AVX512VBMI && TARGET_AVX512VL")])
18289 (define_mode_iterator VPERMI2I
18291 (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")
18292 (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")
18293 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX512BW && TARGET_AVX512VL")
18294 (V8HI "TARGET_AVX512BW && TARGET_AVX512VL")
18295 (V64QI "TARGET_AVX512VBMI") (V32QI "TARGET_AVX512VBMI && TARGET_AVX512VL")
18296 (V16QI "TARGET_AVX512VBMI && TARGET_AVX512VL")])
18298 (define_expand "<avx512>_vpermi2var<mode>3_mask"
18299 [(set (match_operand:VPERMI2 0 "register_operand")
18302 [(match_operand:<sseintvecmode> 2 "register_operand")
18303 (match_operand:VPERMI2 1 "register_operand")
18304 (match_operand:VPERMI2 3 "nonimmediate_operand")]
18307 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
18310 operands[2] = force_reg (<sseintvecmode>mode, operands[2]);
18311 operands[5] = gen_lowpart (<MODE>mode, operands[2]);
18314 (define_insn "*<avx512>_vpermi2var<mode>3_mask"
18315 [(set (match_operand:VPERMI2I 0 "register_operand" "=v")
18316 (vec_merge:VPERMI2I
18318 [(match_operand:<sseintvecmode> 2 "register_operand" "0")
18319 (match_operand:VPERMI2I 1 "register_operand" "v")
18320 (match_operand:VPERMI2I 3 "nonimmediate_operand" "vm")]
18323 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
18325 "vpermi2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
18326 [(set_attr "type" "sselog")
18327 (set_attr "prefix" "evex")
18328 (set_attr "mode" "<sseinsnmode>")])
18330 (define_insn "*<avx512>_vpermi2var<mode>3_mask"
18331 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
18332 (vec_merge:VF_AVX512VL
18333 (unspec:VF_AVX512VL
18334 [(match_operand:<sseintvecmode> 2 "register_operand" "0")
18335 (match_operand:VF_AVX512VL 1 "register_operand" "v")
18336 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "vm")]
18338 (subreg:VF_AVX512VL (match_dup 2) 0)
18339 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
18341 "vpermi2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
18342 [(set_attr "type" "sselog")
18343 (set_attr "prefix" "evex")
18344 (set_attr "mode" "<sseinsnmode>")])
18346 (define_expand "<avx512>_vpermt2var<mode>3_maskz"
18347 [(match_operand:VPERMI2 0 "register_operand")
18348 (match_operand:<sseintvecmode> 1 "register_operand")
18349 (match_operand:VPERMI2 2 "register_operand")
18350 (match_operand:VPERMI2 3 "nonimmediate_operand")
18351 (match_operand:<avx512fmaskmode> 4 "register_operand")]
18354 emit_insn (gen_<avx512>_vpermt2var<mode>3_maskz_1 (
18355 operands[0], operands[1], operands[2], operands[3],
18356 CONST0_RTX (<MODE>mode), operands[4]));
18360 (define_insn "<avx512>_vpermt2var<mode>3<sd_maskz_name>"
18361 [(set (match_operand:VPERMI2 0 "register_operand" "=v,v")
18363 [(match_operand:<sseintvecmode> 1 "register_operand" "v,0")
18364 (match_operand:VPERMI2 2 "register_operand" "0,v")
18365 (match_operand:VPERMI2 3 "nonimmediate_operand" "vm,vm")]
18369 vpermt2<ssemodesuffix>\t{%3, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %3}
18370 vpermi2<ssemodesuffix>\t{%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3}"
18371 [(set_attr "type" "sselog")
18372 (set_attr "prefix" "evex")
18373 (set_attr "mode" "<sseinsnmode>")])
18375 (define_insn "<avx512>_vpermt2var<mode>3_mask"
18376 [(set (match_operand:VPERMI2 0 "register_operand" "=v")
18379 [(match_operand:<sseintvecmode> 1 "register_operand" "v")
18380 (match_operand:VPERMI2 2 "register_operand" "0")
18381 (match_operand:VPERMI2 3 "nonimmediate_operand" "vm")]
18384 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
18386 "vpermt2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
18387 [(set_attr "type" "sselog")
18388 (set_attr "prefix" "evex")
18389 (set_attr "mode" "<sseinsnmode>")])
18391 (define_expand "avx_vperm2f128<mode>3"
18392 [(set (match_operand:AVX256MODE2P 0 "register_operand")
18393 (unspec:AVX256MODE2P
18394 [(match_operand:AVX256MODE2P 1 "register_operand")
18395 (match_operand:AVX256MODE2P 2 "nonimmediate_operand")
18396 (match_operand:SI 3 "const_0_to_255_operand")]
18397 UNSPEC_VPERMIL2F128))]
18400 int mask = INTVAL (operands[3]);
18401 if ((mask & 0x88) == 0)
18403 rtx perm[<ssescalarnum>], t1, t2;
18404 int i, base, nelt = <ssescalarnum>, nelt2 = nelt / 2;
18406 base = (mask & 3) * nelt2;
18407 for (i = 0; i < nelt2; ++i)
18408 perm[i] = GEN_INT (base + i);
18410 base = ((mask >> 4) & 3) * nelt2;
18411 for (i = 0; i < nelt2; ++i)
18412 perm[i + nelt2] = GEN_INT (base + i);
18414 t2 = gen_rtx_VEC_CONCAT (<ssedoublevecmode>mode,
18415 operands[1], operands[2]);
18416 t1 = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (nelt, perm));
18417 t2 = gen_rtx_VEC_SELECT (<MODE>mode, t2, t1);
18418 t2 = gen_rtx_SET (operands[0], t2);
18424 ;; Note that bits 7 and 3 of the imm8 allow lanes to be zeroed, which
18425 ;; means that in order to represent this properly in rtl we'd have to
18426 ;; nest *another* vec_concat with a zero operand and do the select from
18427 ;; a 4x wide vector. That doesn't seem very nice.
18428 (define_insn "*avx_vperm2f128<mode>_full"
18429 [(set (match_operand:AVX256MODE2P 0 "register_operand" "=x")
18430 (unspec:AVX256MODE2P
18431 [(match_operand:AVX256MODE2P 1 "register_operand" "x")
18432 (match_operand:AVX256MODE2P 2 "nonimmediate_operand" "xm")
18433 (match_operand:SI 3 "const_0_to_255_operand" "n")]
18434 UNSPEC_VPERMIL2F128))]
18436 "vperm2<i128>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
18437 [(set_attr "type" "sselog")
18438 (set_attr "prefix_extra" "1")
18439 (set_attr "length_immediate" "1")
18440 (set_attr "prefix" "vex")
18441 (set_attr "mode" "<sseinsnmode>")])
18443 (define_insn "*avx_vperm2f128<mode>_nozero"
18444 [(set (match_operand:AVX256MODE2P 0 "register_operand" "=x")
18445 (vec_select:AVX256MODE2P
18446 (vec_concat:<ssedoublevecmode>
18447 (match_operand:AVX256MODE2P 1 "register_operand" "x")
18448 (match_operand:AVX256MODE2P 2 "nonimmediate_operand" "xm"))
18449 (match_parallel 3 ""
18450 [(match_operand 4 "const_int_operand")])))]
18452 && avx_vperm2f128_parallel (operands[3], <MODE>mode)"
18454 int mask = avx_vperm2f128_parallel (operands[3], <MODE>mode) - 1;
18456 return "vinsert<i128>\t{$0, %x2, %1, %0|%0, %1, %x2, 0}";
18458 return "vinsert<i128>\t{$1, %x2, %1, %0|%0, %1, %x2, 1}";
18459 operands[3] = GEN_INT (mask);
18460 return "vperm2<i128>\t{%3, %2, %1, %0|%0, %1, %2, %3}";
18462 [(set_attr "type" "sselog")
18463 (set_attr "prefix_extra" "1")
18464 (set_attr "length_immediate" "1")
18465 (set_attr "prefix" "vex")
18466 (set_attr "mode" "<sseinsnmode>")])
18468 (define_insn "*ssse3_palignr<mode>_perm"
18469 [(set (match_operand:V_128 0 "register_operand" "=x,x,v")
18471 (match_operand:V_128 1 "register_operand" "0,x,v")
18472 (match_parallel 2 "palignr_operand"
18473 [(match_operand 3 "const_int_operand" "n,n,n")])))]
18476 operands[2] = (GEN_INT (INTVAL (operands[3])
18477 * GET_MODE_UNIT_SIZE (GET_MODE (operands[0]))));
18479 switch (which_alternative)
18482 return "palignr\t{%2, %1, %0|%0, %1, %2}";
18485 return "vpalignr\t{%2, %1, %1, %0|%0, %1, %1, %2}";
18487 gcc_unreachable ();
18490 [(set_attr "isa" "noavx,avx,avx512bw")
18491 (set_attr "type" "sseishft")
18492 (set_attr "atom_unit" "sishuf")
18493 (set_attr "prefix_data16" "1,*,*")
18494 (set_attr "prefix_extra" "1")
18495 (set_attr "length_immediate" "1")
18496 (set_attr "prefix" "orig,vex,evex")])
18498 (define_expand "avx512vl_vinsert<mode>"
18499 [(match_operand:VI48F_256 0 "register_operand")
18500 (match_operand:VI48F_256 1 "register_operand")
18501 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand")
18502 (match_operand:SI 3 "const_0_to_1_operand")
18503 (match_operand:VI48F_256 4 "register_operand")
18504 (match_operand:<avx512fmaskmode> 5 "register_operand")]
18507 rtx (*insn)(rtx, rtx, rtx, rtx, rtx);
18509 switch (INTVAL (operands[3]))
18512 insn = gen_vec_set_lo_<mode>_mask;
18515 insn = gen_vec_set_hi_<mode>_mask;
18518 gcc_unreachable ();
18521 emit_insn (insn (operands[0], operands[1], operands[2], operands[4],
18526 (define_expand "avx_vinsertf128<mode>"
18527 [(match_operand:V_256 0 "register_operand")
18528 (match_operand:V_256 1 "register_operand")
18529 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand")
18530 (match_operand:SI 3 "const_0_to_1_operand")]
18533 rtx (*insn)(rtx, rtx, rtx);
18535 switch (INTVAL (operands[3]))
18538 insn = gen_vec_set_lo_<mode>;
18541 insn = gen_vec_set_hi_<mode>;
18544 gcc_unreachable ();
18547 emit_insn (insn (operands[0], operands[1], operands[2]));
18551 (define_insn "vec_set_lo_<mode><mask_name>"
18552 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
18553 (vec_concat:VI8F_256
18554 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
18555 (vec_select:<ssehalfvecmode>
18556 (match_operand:VI8F_256 1 "register_operand" "v")
18557 (parallel [(const_int 2) (const_int 3)]))))]
18558 "TARGET_AVX && <mask_avx512dq_condition>"
18560 if (TARGET_AVX512DQ)
18561 return "vinsert<shuffletype>64x2\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}";
18562 else if (TARGET_AVX512VL)
18563 return "vinsert<shuffletype>32x4\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}";
18565 return "vinsert<i128>\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}";
18567 [(set_attr "type" "sselog")
18568 (set_attr "prefix_extra" "1")
18569 (set_attr "length_immediate" "1")
18570 (set_attr "prefix" "vex")
18571 (set_attr "mode" "<sseinsnmode>")])
18573 (define_insn "vec_set_hi_<mode><mask_name>"
18574 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
18575 (vec_concat:VI8F_256
18576 (vec_select:<ssehalfvecmode>
18577 (match_operand:VI8F_256 1 "register_operand" "v")
18578 (parallel [(const_int 0) (const_int 1)]))
18579 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
18580 "TARGET_AVX && <mask_avx512dq_condition>"
18582 if (TARGET_AVX512DQ)
18583 return "vinsert<shuffletype>64x2\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}";
18584 else if (TARGET_AVX512VL)
18585 return "vinsert<shuffletype>32x4\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}";
18587 return "vinsert<i128>\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}";
18589 [(set_attr "type" "sselog")
18590 (set_attr "prefix_extra" "1")
18591 (set_attr "length_immediate" "1")
18592 (set_attr "prefix" "vex")
18593 (set_attr "mode" "<sseinsnmode>")])
18595 (define_insn "vec_set_lo_<mode><mask_name>"
18596 [(set (match_operand:VI4F_256 0 "register_operand" "=v")
18597 (vec_concat:VI4F_256
18598 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
18599 (vec_select:<ssehalfvecmode>
18600 (match_operand:VI4F_256 1 "register_operand" "v")
18601 (parallel [(const_int 4) (const_int 5)
18602 (const_int 6) (const_int 7)]))))]
18605 if (TARGET_AVX512VL)
18606 return "vinsert<shuffletype>32x4\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}";
18608 return "vinsert<i128>\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}";
18610 [(set_attr "type" "sselog")
18611 (set_attr "prefix_extra" "1")
18612 (set_attr "length_immediate" "1")
18613 (set_attr "prefix" "vex")
18614 (set_attr "mode" "<sseinsnmode>")])
18616 (define_insn "vec_set_hi_<mode><mask_name>"
18617 [(set (match_operand:VI4F_256 0 "register_operand" "=v")
18618 (vec_concat:VI4F_256
18619 (vec_select:<ssehalfvecmode>
18620 (match_operand:VI4F_256 1 "register_operand" "v")
18621 (parallel [(const_int 0) (const_int 1)
18622 (const_int 2) (const_int 3)]))
18623 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
18626 if (TARGET_AVX512VL)
18627 return "vinsert<shuffletype>32x4\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}";
18629 return "vinsert<i128>\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}";
18631 [(set_attr "type" "sselog")
18632 (set_attr "prefix_extra" "1")
18633 (set_attr "length_immediate" "1")
18634 (set_attr "prefix" "vex")
18635 (set_attr "mode" "<sseinsnmode>")])
18637 (define_insn "vec_set_lo_v16hi"
18638 [(set (match_operand:V16HI 0 "register_operand" "=x,v")
18640 (match_operand:V8HI 2 "nonimmediate_operand" "xm,vm")
18642 (match_operand:V16HI 1 "register_operand" "x,v")
18643 (parallel [(const_int 8) (const_int 9)
18644 (const_int 10) (const_int 11)
18645 (const_int 12) (const_int 13)
18646 (const_int 14) (const_int 15)]))))]
18649 vinsert%~128\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}
18650 vinserti32x4\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}"
18651 [(set_attr "type" "sselog")
18652 (set_attr "prefix_extra" "1")
18653 (set_attr "length_immediate" "1")
18654 (set_attr "prefix" "vex,evex")
18655 (set_attr "mode" "OI")])
18657 (define_insn "vec_set_hi_v16hi"
18658 [(set (match_operand:V16HI 0 "register_operand" "=x,v")
18661 (match_operand:V16HI 1 "register_operand" "x,v")
18662 (parallel [(const_int 0) (const_int 1)
18663 (const_int 2) (const_int 3)
18664 (const_int 4) (const_int 5)
18665 (const_int 6) (const_int 7)]))
18666 (match_operand:V8HI 2 "nonimmediate_operand" "xm,vm")))]
18669 vinsert%~128\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}
18670 vinserti32x4\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}"
18671 [(set_attr "type" "sselog")
18672 (set_attr "prefix_extra" "1")
18673 (set_attr "length_immediate" "1")
18674 (set_attr "prefix" "vex,evex")
18675 (set_attr "mode" "OI")])
18677 (define_insn "vec_set_lo_v32qi"
18678 [(set (match_operand:V32QI 0 "register_operand" "=x,v")
18680 (match_operand:V16QI 2 "nonimmediate_operand" "xm,v")
18682 (match_operand:V32QI 1 "register_operand" "x,v")
18683 (parallel [(const_int 16) (const_int 17)
18684 (const_int 18) (const_int 19)
18685 (const_int 20) (const_int 21)
18686 (const_int 22) (const_int 23)
18687 (const_int 24) (const_int 25)
18688 (const_int 26) (const_int 27)
18689 (const_int 28) (const_int 29)
18690 (const_int 30) (const_int 31)]))))]
18693 vinsert%~128\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}
18694 vinserti32x4\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}"
18695 [(set_attr "type" "sselog")
18696 (set_attr "prefix_extra" "1")
18697 (set_attr "length_immediate" "1")
18698 (set_attr "prefix" "vex,evex")
18699 (set_attr "mode" "OI")])
18701 (define_insn "vec_set_hi_v32qi"
18702 [(set (match_operand:V32QI 0 "register_operand" "=x,v")
18705 (match_operand:V32QI 1 "register_operand" "x,v")
18706 (parallel [(const_int 0) (const_int 1)
18707 (const_int 2) (const_int 3)
18708 (const_int 4) (const_int 5)
18709 (const_int 6) (const_int 7)
18710 (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)]))
18714 (match_operand:V16QI 2 "nonimmediate_operand" "xm,vm")))]
18717 vinsert%~128\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}
18718 vinserti32x4\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}"
18719 [(set_attr "type" "sselog")
18720 (set_attr "prefix_extra" "1")
18721 (set_attr "length_immediate" "1")
18722 (set_attr "prefix" "vex,evex")
18723 (set_attr "mode" "OI")])
18725 (define_insn "<avx_avx2>_maskload<ssemodesuffix><avxsizesuffix>"
18726 [(set (match_operand:V48_AVX2 0 "register_operand" "=x")
18728 [(match_operand:<sseintvecmode> 2 "register_operand" "x")
18729 (match_operand:V48_AVX2 1 "memory_operand" "m")]
18732 "v<sseintprefix>maskmov<ssemodesuffix>\t{%1, %2, %0|%0, %2, %1}"
18733 [(set_attr "type" "sselog1")
18734 (set_attr "prefix_extra" "1")
18735 (set_attr "prefix" "vex")
18736 (set_attr "btver2_decode" "vector")
18737 (set_attr "mode" "<sseinsnmode>")])
18739 (define_insn "<avx_avx2>_maskstore<ssemodesuffix><avxsizesuffix>"
18740 [(set (match_operand:V48_AVX2 0 "memory_operand" "+m")
18742 [(match_operand:<sseintvecmode> 1 "register_operand" "x")
18743 (match_operand:V48_AVX2 2 "register_operand" "x")
18747 "v<sseintprefix>maskmov<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
18748 [(set_attr "type" "sselog1")
18749 (set_attr "prefix_extra" "1")
18750 (set_attr "prefix" "vex")
18751 (set_attr "btver2_decode" "vector")
18752 (set_attr "mode" "<sseinsnmode>")])
18754 (define_expand "maskload<mode><sseintvecmodelower>"
18755 [(set (match_operand:V48_AVX2 0 "register_operand")
18757 [(match_operand:<sseintvecmode> 2 "register_operand")
18758 (match_operand:V48_AVX2 1 "memory_operand")]
18762 (define_expand "maskload<mode><avx512fmaskmodelower>"
18763 [(set (match_operand:V48_AVX512VL 0 "register_operand")
18764 (vec_merge:V48_AVX512VL
18765 (match_operand:V48_AVX512VL 1 "memory_operand")
18767 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18770 (define_expand "maskload<mode><avx512fmaskmodelower>"
18771 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
18772 (vec_merge:VI12_AVX512VL
18773 (match_operand:VI12_AVX512VL 1 "memory_operand")
18775 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18778 (define_expand "maskstore<mode><sseintvecmodelower>"
18779 [(set (match_operand:V48_AVX2 0 "memory_operand")
18781 [(match_operand:<sseintvecmode> 2 "register_operand")
18782 (match_operand:V48_AVX2 1 "register_operand")
18787 (define_expand "maskstore<mode><avx512fmaskmodelower>"
18788 [(set (match_operand:V48_AVX512VL 0 "memory_operand")
18789 (vec_merge:V48_AVX512VL
18790 (match_operand:V48_AVX512VL 1 "register_operand")
18792 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18795 (define_expand "maskstore<mode><avx512fmaskmodelower>"
18796 [(set (match_operand:VI12_AVX512VL 0 "memory_operand")
18797 (vec_merge:VI12_AVX512VL
18798 (match_operand:VI12_AVX512VL 1 "register_operand")
18800 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18803 (define_expand "cbranch<mode>4"
18804 [(set (reg:CC FLAGS_REG)
18805 (compare:CC (match_operand:VI48_AVX 1 "register_operand")
18806 (match_operand:VI48_AVX 2 "nonimmediate_operand")))
18807 (set (pc) (if_then_else
18808 (match_operator 0 "bt_comparison_operator"
18809 [(reg:CC FLAGS_REG) (const_int 0)])
18810 (label_ref (match_operand 3))
18814 ix86_expand_branch (GET_CODE (operands[0]),
18815 operands[1], operands[2], operands[3]);
18820 (define_insn_and_split "avx_<castmode><avxsizesuffix>_<castmode>"
18821 [(set (match_operand:AVX256MODE2P 0 "nonimmediate_operand" "=x,m")
18822 (unspec:AVX256MODE2P
18823 [(match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "xm,x")]
18825 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
18827 "&& reload_completed"
18828 [(set (match_dup 0) (match_dup 1))]
18830 if (REG_P (operands[0]))
18831 operands[0] = gen_lowpart (<ssehalfvecmode>mode, operands[0]);
18833 operands[1] = lowpart_subreg (<MODE>mode, operands[1],
18834 <ssehalfvecmode>mode);
18837 ;; Modes handled by vec_init expanders.
18838 (define_mode_iterator VEC_INIT_MODE
18839 [(V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI
18840 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX") V8HI
18841 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
18842 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI
18843 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
18844 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")
18845 (V4TI "TARGET_AVX512F") (V2TI "TARGET_AVX")])
18847 ;; Likewise, but for initialization from half sized vectors.
18848 ;; Thus, these are all VEC_INIT_MODE modes except V2??.
18849 (define_mode_iterator VEC_INIT_HALF_MODE
18850 [(V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI
18851 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX") V8HI
18852 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
18853 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX")
18854 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
18855 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX")
18856 (V4TI "TARGET_AVX512F")])
18858 (define_expand "vec_init<mode><ssescalarmodelower>"
18859 [(match_operand:VEC_INIT_MODE 0 "register_operand")
18863 ix86_expand_vector_init (false, operands[0], operands[1]);
18867 (define_expand "vec_init<mode><ssehalfvecmodelower>"
18868 [(match_operand:VEC_INIT_HALF_MODE 0 "register_operand")
18872 ix86_expand_vector_init (false, operands[0], operands[1]);
18876 (define_insn "<avx2_avx512>_ashrv<mode><mask_name>"
18877 [(set (match_operand:VI48_AVX512F_AVX512VL 0 "register_operand" "=v")
18878 (ashiftrt:VI48_AVX512F_AVX512VL
18879 (match_operand:VI48_AVX512F_AVX512VL 1 "register_operand" "v")
18880 (match_operand:VI48_AVX512F_AVX512VL 2 "nonimmediate_operand" "vm")))]
18881 "TARGET_AVX2 && <mask_mode512bit_condition>"
18882 "vpsrav<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18883 [(set_attr "type" "sseishft")
18884 (set_attr "prefix" "maybe_evex")
18885 (set_attr "mode" "<sseinsnmode>")])
18887 (define_insn "<avx2_avx512>_ashrv<mode><mask_name>"
18888 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
18889 (ashiftrt:VI2_AVX512VL
18890 (match_operand:VI2_AVX512VL 1 "register_operand" "v")
18891 (match_operand:VI2_AVX512VL 2 "nonimmediate_operand" "vm")))]
18893 "vpsravw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18894 [(set_attr "type" "sseishft")
18895 (set_attr "prefix" "maybe_evex")
18896 (set_attr "mode" "<sseinsnmode>")])
18898 (define_insn "<avx2_avx512>_<shift_insn>v<mode><mask_name>"
18899 [(set (match_operand:VI48_AVX512F 0 "register_operand" "=v")
18900 (any_lshift:VI48_AVX512F
18901 (match_operand:VI48_AVX512F 1 "register_operand" "v")
18902 (match_operand:VI48_AVX512F 2 "nonimmediate_operand" "vm")))]
18903 "TARGET_AVX2 && <mask_mode512bit_condition>"
18904 "vp<vshift>v<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18905 [(set_attr "type" "sseishft")
18906 (set_attr "prefix" "maybe_evex")
18907 (set_attr "mode" "<sseinsnmode>")])
18909 (define_insn "<avx2_avx512>_<shift_insn>v<mode><mask_name>"
18910 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
18911 (any_lshift:VI2_AVX512VL
18912 (match_operand:VI2_AVX512VL 1 "register_operand" "v")
18913 (match_operand:VI2_AVX512VL 2 "nonimmediate_operand" "vm")))]
18915 "vp<vshift>v<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18916 [(set_attr "type" "sseishft")
18917 (set_attr "prefix" "maybe_evex")
18918 (set_attr "mode" "<sseinsnmode>")])
18920 (define_insn "avx_vec_concat<mode>"
18921 [(set (match_operand:V_256_512 0 "register_operand" "=x,v,x,Yv")
18922 (vec_concat:V_256_512
18923 (match_operand:<ssehalfvecmode> 1 "register_operand" "x,v,x,v")
18924 (match_operand:<ssehalfvecmode> 2 "vector_move_operand" "xm,vm,C,C")))]
18927 switch (which_alternative)
18930 return "vinsert<i128>\t{$0x1, %2, %<xtg_mode>1, %0|%0, %<xtg_mode>1, %2, 0x1}";
18932 if (<MODE_SIZE> == 64)
18934 if (TARGET_AVX512DQ && GET_MODE_SIZE (<ssescalarmode>mode) == 4)
18935 return "vinsert<shuffletype>32x8\t{$0x1, %2, %<xtg_mode>1, %0|%0, %<xtg_mode>1, %2, 0x1}";
18937 return "vinsert<shuffletype>64x4\t{$0x1, %2, %<xtg_mode>1, %0|%0, %<xtg_mode>1, %2, 0x1}";
18941 if (TARGET_AVX512DQ && GET_MODE_SIZE (<ssescalarmode>mode) == 8)
18942 return "vinsert<shuffletype>64x2\t{$0x1, %2, %<xtg_mode>1, %0|%0, %<xtg_mode>1, %2, 0x1}";
18944 return "vinsert<shuffletype>32x4\t{$0x1, %2, %<xtg_mode>1, %0|%0, %<xtg_mode>1, %2, 0x1}";
18948 switch (get_attr_mode (insn))
18951 return "vmovaps\t{%1, %t0|%t0, %1}";
18953 return "vmovapd\t{%1, %t0|%t0, %1}";
18955 return "vmovaps\t{%1, %x0|%x0, %1}";
18957 return "vmovapd\t{%1, %x0|%x0, %1}";
18959 if (which_alternative == 2)
18960 return "vmovdqa\t{%1, %t0|%t0, %1}";
18961 else if (GET_MODE_SIZE (<ssescalarmode>mode) == 8)
18962 return "vmovdqa64\t{%1, %t0|%t0, %1}";
18964 return "vmovdqa32\t{%1, %t0|%t0, %1}";
18966 if (which_alternative == 2)
18967 return "vmovdqa\t{%1, %x0|%x0, %1}";
18968 else if (GET_MODE_SIZE (<ssescalarmode>mode) == 8)
18969 return "vmovdqa64\t{%1, %x0|%x0, %1}";
18971 return "vmovdqa32\t{%1, %x0|%x0, %1}";
18973 gcc_unreachable ();
18976 gcc_unreachable ();
18979 [(set_attr "type" "sselog,sselog,ssemov,ssemov")
18980 (set_attr "prefix_extra" "1,1,*,*")
18981 (set_attr "length_immediate" "1,1,*,*")
18982 (set_attr "prefix" "maybe_evex")
18983 (set_attr "mode" "<sseinsnmode>")])
18985 (define_insn "vcvtph2ps<mask_name>"
18986 [(set (match_operand:V4SF 0 "register_operand" "=v")
18988 (unspec:V8SF [(match_operand:V8HI 1 "register_operand" "v")]
18990 (parallel [(const_int 0) (const_int 1)
18991 (const_int 2) (const_int 3)])))]
18992 "TARGET_F16C || TARGET_AVX512VL"
18993 "vcvtph2ps\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
18994 [(set_attr "type" "ssecvt")
18995 (set_attr "prefix" "maybe_evex")
18996 (set_attr "mode" "V4SF")])
18998 (define_insn "*vcvtph2ps_load<mask_name>"
18999 [(set (match_operand:V4SF 0 "register_operand" "=v")
19000 (unspec:V4SF [(match_operand:V4HI 1 "memory_operand" "m")]
19001 UNSPEC_VCVTPH2PS))]
19002 "TARGET_F16C || TARGET_AVX512VL"
19003 "vcvtph2ps\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
19004 [(set_attr "type" "ssecvt")
19005 (set_attr "prefix" "vex")
19006 (set_attr "mode" "V8SF")])
19008 (define_insn "vcvtph2ps256<mask_name>"
19009 [(set (match_operand:V8SF 0 "register_operand" "=v")
19010 (unspec:V8SF [(match_operand:V8HI 1 "nonimmediate_operand" "vm")]
19011 UNSPEC_VCVTPH2PS))]
19012 "TARGET_F16C || TARGET_AVX512VL"
19013 "vcvtph2ps\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
19014 [(set_attr "type" "ssecvt")
19015 (set_attr "prefix" "vex")
19016 (set_attr "btver2_decode" "double")
19017 (set_attr "mode" "V8SF")])
19019 (define_insn "<mask_codefor>avx512f_vcvtph2ps512<mask_name><round_saeonly_name>"
19020 [(set (match_operand:V16SF 0 "register_operand" "=v")
19022 [(match_operand:V16HI 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
19023 UNSPEC_VCVTPH2PS))]
19025 "vcvtph2ps\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
19026 [(set_attr "type" "ssecvt")
19027 (set_attr "prefix" "evex")
19028 (set_attr "mode" "V16SF")])
19030 (define_expand "vcvtps2ph_mask"
19031 [(set (match_operand:V8HI 0 "register_operand")
19034 (unspec:V4HI [(match_operand:V4SF 1 "register_operand")
19035 (match_operand:SI 2 "const_0_to_255_operand")]
19038 (match_operand:V8HI 3 "vector_move_operand")
19039 (match_operand:QI 4 "register_operand")))]
19041 "operands[5] = CONST0_RTX (V4HImode);")
19043 (define_expand "vcvtps2ph"
19044 [(set (match_operand:V8HI 0 "register_operand")
19046 (unspec:V4HI [(match_operand:V4SF 1 "register_operand")
19047 (match_operand:SI 2 "const_0_to_255_operand")]
19051 "operands[3] = CONST0_RTX (V4HImode);")
19053 (define_insn "*vcvtps2ph<mask_name>"
19054 [(set (match_operand:V8HI 0 "register_operand" "=v")
19056 (unspec:V4HI [(match_operand:V4SF 1 "register_operand" "v")
19057 (match_operand:SI 2 "const_0_to_255_operand" "N")]
19059 (match_operand:V4HI 3 "const0_operand")))]
19060 "(TARGET_F16C || TARGET_AVX512VL) && <mask_avx512vl_condition>"
19061 "vcvtps2ph\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}"
19062 [(set_attr "type" "ssecvt")
19063 (set_attr "prefix" "maybe_evex")
19064 (set_attr "mode" "V4SF")])
19066 (define_insn "*vcvtps2ph_store<mask_name>"
19067 [(set (match_operand:V4HI 0 "memory_operand" "=m")
19068 (unspec:V4HI [(match_operand:V4SF 1 "register_operand" "v")
19069 (match_operand:SI 2 "const_0_to_255_operand" "N")]
19070 UNSPEC_VCVTPS2PH))]
19071 "TARGET_F16C || TARGET_AVX512VL"
19072 "vcvtps2ph\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
19073 [(set_attr "type" "ssecvt")
19074 (set_attr "prefix" "maybe_evex")
19075 (set_attr "mode" "V4SF")])
19077 (define_insn "vcvtps2ph256<mask_name>"
19078 [(set (match_operand:V8HI 0 "nonimmediate_operand" "=vm")
19079 (unspec:V8HI [(match_operand:V8SF 1 "register_operand" "v")
19080 (match_operand:SI 2 "const_0_to_255_operand" "N")]
19081 UNSPEC_VCVTPS2PH))]
19082 "TARGET_F16C || TARGET_AVX512VL"
19083 "vcvtps2ph\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
19084 [(set_attr "type" "ssecvt")
19085 (set_attr "prefix" "maybe_evex")
19086 (set_attr "btver2_decode" "vector")
19087 (set_attr "mode" "V8SF")])
19089 (define_insn "<mask_codefor>avx512f_vcvtps2ph512<mask_name>"
19090 [(set (match_operand:V16HI 0 "nonimmediate_operand" "=vm")
19092 [(match_operand:V16SF 1 "register_operand" "v")
19093 (match_operand:SI 2 "const_0_to_255_operand" "N")]
19094 UNSPEC_VCVTPS2PH))]
19096 "vcvtps2ph\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
19097 [(set_attr "type" "ssecvt")
19098 (set_attr "prefix" "evex")
19099 (set_attr "mode" "V16SF")])
19101 ;; For gather* insn patterns
19102 (define_mode_iterator VEC_GATHER_MODE
19103 [V2DI V2DF V4DI V4DF V4SI V4SF V8SI V8SF])
19104 (define_mode_attr VEC_GATHER_IDXSI
19105 [(V2DI "V4SI") (V4DI "V4SI") (V8DI "V8SI")
19106 (V2DF "V4SI") (V4DF "V4SI") (V8DF "V8SI")
19107 (V4SI "V4SI") (V8SI "V8SI") (V16SI "V16SI")
19108 (V4SF "V4SI") (V8SF "V8SI") (V16SF "V16SI")])
19110 (define_mode_attr VEC_GATHER_IDXDI
19111 [(V2DI "V2DI") (V4DI "V4DI") (V8DI "V8DI")
19112 (V2DF "V2DI") (V4DF "V4DI") (V8DF "V8DI")
19113 (V4SI "V2DI") (V8SI "V4DI") (V16SI "V8DI")
19114 (V4SF "V2DI") (V8SF "V4DI") (V16SF "V8DI")])
19116 (define_mode_attr VEC_GATHER_SRCDI
19117 [(V2DI "V2DI") (V4DI "V4DI") (V8DI "V8DI")
19118 (V2DF "V2DF") (V4DF "V4DF") (V8DF "V8DF")
19119 (V4SI "V4SI") (V8SI "V4SI") (V16SI "V8SI")
19120 (V4SF "V4SF") (V8SF "V4SF") (V16SF "V8SF")])
19122 (define_expand "avx2_gathersi<mode>"
19123 [(parallel [(set (match_operand:VEC_GATHER_MODE 0 "register_operand")
19124 (unspec:VEC_GATHER_MODE
19125 [(match_operand:VEC_GATHER_MODE 1 "register_operand")
19126 (mem:<ssescalarmode>
19128 [(match_operand 2 "vsib_address_operand")
19129 (match_operand:<VEC_GATHER_IDXSI>
19130 3 "register_operand")
19131 (match_operand:SI 5 "const1248_operand ")]))
19132 (mem:BLK (scratch))
19133 (match_operand:VEC_GATHER_MODE 4 "register_operand")]
19135 (clobber (match_scratch:VEC_GATHER_MODE 7))])]
19139 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
19140 operands[5]), UNSPEC_VSIBADDR);
19143 (define_insn "*avx2_gathersi<mode>"
19144 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
19145 (unspec:VEC_GATHER_MODE
19146 [(match_operand:VEC_GATHER_MODE 2 "register_operand" "0")
19147 (match_operator:<ssescalarmode> 7 "vsib_mem_operator"
19149 [(match_operand:P 3 "vsib_address_operand" "Tv")
19150 (match_operand:<VEC_GATHER_IDXSI> 4 "register_operand" "x")
19151 (match_operand:SI 6 "const1248_operand" "n")]
19153 (mem:BLK (scratch))
19154 (match_operand:VEC_GATHER_MODE 5 "register_operand" "1")]
19156 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
19158 "v<sseintprefix>gatherd<ssemodesuffix>\t{%1, %7, %0|%0, %7, %1}"
19159 [(set_attr "type" "ssemov")
19160 (set_attr "prefix" "vex")
19161 (set_attr "mode" "<sseinsnmode>")])
19163 (define_insn "*avx2_gathersi<mode>_2"
19164 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
19165 (unspec:VEC_GATHER_MODE
19167 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
19169 [(match_operand:P 2 "vsib_address_operand" "Tv")
19170 (match_operand:<VEC_GATHER_IDXSI> 3 "register_operand" "x")
19171 (match_operand:SI 5 "const1248_operand" "n")]
19173 (mem:BLK (scratch))
19174 (match_operand:VEC_GATHER_MODE 4 "register_operand" "1")]
19176 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
19178 "v<sseintprefix>gatherd<ssemodesuffix>\t{%1, %6, %0|%0, %6, %1}"
19179 [(set_attr "type" "ssemov")
19180 (set_attr "prefix" "vex")
19181 (set_attr "mode" "<sseinsnmode>")])
19183 (define_expand "avx2_gatherdi<mode>"
19184 [(parallel [(set (match_operand:VEC_GATHER_MODE 0 "register_operand")
19185 (unspec:VEC_GATHER_MODE
19186 [(match_operand:<VEC_GATHER_SRCDI> 1 "register_operand")
19187 (mem:<ssescalarmode>
19189 [(match_operand 2 "vsib_address_operand")
19190 (match_operand:<VEC_GATHER_IDXDI>
19191 3 "register_operand")
19192 (match_operand:SI 5 "const1248_operand ")]))
19193 (mem:BLK (scratch))
19194 (match_operand:<VEC_GATHER_SRCDI> 4 "register_operand")]
19196 (clobber (match_scratch:VEC_GATHER_MODE 7))])]
19200 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
19201 operands[5]), UNSPEC_VSIBADDR);
19204 (define_insn "*avx2_gatherdi<mode>"
19205 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
19206 (unspec:VEC_GATHER_MODE
19207 [(match_operand:<VEC_GATHER_SRCDI> 2 "register_operand" "0")
19208 (match_operator:<ssescalarmode> 7 "vsib_mem_operator"
19210 [(match_operand:P 3 "vsib_address_operand" "Tv")
19211 (match_operand:<VEC_GATHER_IDXDI> 4 "register_operand" "x")
19212 (match_operand:SI 6 "const1248_operand" "n")]
19214 (mem:BLK (scratch))
19215 (match_operand:<VEC_GATHER_SRCDI> 5 "register_operand" "1")]
19217 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
19219 "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %7, %2|%2, %7, %5}"
19220 [(set_attr "type" "ssemov")
19221 (set_attr "prefix" "vex")
19222 (set_attr "mode" "<sseinsnmode>")])
19224 (define_insn "*avx2_gatherdi<mode>_2"
19225 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
19226 (unspec:VEC_GATHER_MODE
19228 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
19230 [(match_operand:P 2 "vsib_address_operand" "Tv")
19231 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand" "x")
19232 (match_operand:SI 5 "const1248_operand" "n")]
19234 (mem:BLK (scratch))
19235 (match_operand:<VEC_GATHER_SRCDI> 4 "register_operand" "1")]
19237 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
19240 if (<MODE>mode != <VEC_GATHER_SRCDI>mode)
19241 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%4, %6, %x0|%x0, %6, %4}";
19242 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%4, %6, %0|%0, %6, %4}";
19244 [(set_attr "type" "ssemov")
19245 (set_attr "prefix" "vex")
19246 (set_attr "mode" "<sseinsnmode>")])
19248 (define_insn "*avx2_gatherdi<mode>_3"
19249 [(set (match_operand:<VEC_GATHER_SRCDI> 0 "register_operand" "=&x")
19250 (vec_select:<VEC_GATHER_SRCDI>
19252 [(match_operand:<VEC_GATHER_SRCDI> 2 "register_operand" "0")
19253 (match_operator:<ssescalarmode> 7 "vsib_mem_operator"
19255 [(match_operand:P 3 "vsib_address_operand" "Tv")
19256 (match_operand:<VEC_GATHER_IDXDI> 4 "register_operand" "x")
19257 (match_operand:SI 6 "const1248_operand" "n")]
19259 (mem:BLK (scratch))
19260 (match_operand:<VEC_GATHER_SRCDI> 5 "register_operand" "1")]
19262 (parallel [(const_int 0) (const_int 1)
19263 (const_int 2) (const_int 3)])))
19264 (clobber (match_scratch:VI4F_256 1 "=&x"))]
19266 "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %7, %0|%0, %7, %5}"
19267 [(set_attr "type" "ssemov")
19268 (set_attr "prefix" "vex")
19269 (set_attr "mode" "<sseinsnmode>")])
19271 (define_insn "*avx2_gatherdi<mode>_4"
19272 [(set (match_operand:<VEC_GATHER_SRCDI> 0 "register_operand" "=&x")
19273 (vec_select:<VEC_GATHER_SRCDI>
19276 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
19278 [(match_operand:P 2 "vsib_address_operand" "Tv")
19279 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand" "x")
19280 (match_operand:SI 5 "const1248_operand" "n")]
19282 (mem:BLK (scratch))
19283 (match_operand:<VEC_GATHER_SRCDI> 4 "register_operand" "1")]
19285 (parallel [(const_int 0) (const_int 1)
19286 (const_int 2) (const_int 3)])))
19287 (clobber (match_scratch:VI4F_256 1 "=&x"))]
19289 "v<sseintprefix>gatherq<ssemodesuffix>\t{%4, %6, %0|%0, %6, %4}"
19290 [(set_attr "type" "ssemov")
19291 (set_attr "prefix" "vex")
19292 (set_attr "mode" "<sseinsnmode>")])
19294 ;; Memory operand override for -masm=intel of the v*gatherq* patterns.
19295 (define_mode_attr gatherq_mode
19296 [(V4SI "q") (V2DI "x") (V4SF "q") (V2DF "x")
19297 (V8SI "x") (V4DI "t") (V8SF "x") (V4DF "t")
19298 (V16SI "t") (V8DI "g") (V16SF "t") (V8DF "g")])
19300 (define_expand "<avx512>_gathersi<mode>"
19301 [(parallel [(set (match_operand:VI48F 0 "register_operand")
19303 [(match_operand:VI48F 1 "register_operand")
19304 (match_operand:<avx512fmaskmode> 4 "register_operand")
19305 (mem:<ssescalarmode>
19307 [(match_operand 2 "vsib_address_operand")
19308 (match_operand:<VEC_GATHER_IDXSI> 3 "register_operand")
19309 (match_operand:SI 5 "const1248_operand")]))]
19311 (clobber (match_scratch:<avx512fmaskmode> 7))])]
19315 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
19316 operands[5]), UNSPEC_VSIBADDR);
19319 (define_insn "*avx512f_gathersi<mode>"
19320 [(set (match_operand:VI48F 0 "register_operand" "=&v")
19322 [(match_operand:VI48F 1 "register_operand" "0")
19323 (match_operand:<avx512fmaskmode> 7 "register_operand" "2")
19324 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
19326 [(match_operand:P 4 "vsib_address_operand" "Tv")
19327 (match_operand:<VEC_GATHER_IDXSI> 3 "register_operand" "v")
19328 (match_operand:SI 5 "const1248_operand" "n")]
19329 UNSPEC_VSIBADDR)])]
19331 (clobber (match_scratch:<avx512fmaskmode> 2 "=&Yk"))]
19333 "v<sseintprefix>gatherd<ssemodesuffix>\t{%6, %0%{%2%}|%0%{%2%}, %<xtg_mode>6}"
19334 [(set_attr "type" "ssemov")
19335 (set_attr "prefix" "evex")
19336 (set_attr "mode" "<sseinsnmode>")])
19338 (define_insn "*avx512f_gathersi<mode>_2"
19339 [(set (match_operand:VI48F 0 "register_operand" "=&v")
19342 (match_operand:<avx512fmaskmode> 6 "register_operand" "1")
19343 (match_operator:<ssescalarmode> 5 "vsib_mem_operator"
19345 [(match_operand:P 3 "vsib_address_operand" "Tv")
19346 (match_operand:<VEC_GATHER_IDXSI> 2 "register_operand" "v")
19347 (match_operand:SI 4 "const1248_operand" "n")]
19348 UNSPEC_VSIBADDR)])]
19350 (clobber (match_scratch:<avx512fmaskmode> 1 "=&Yk"))]
19352 "v<sseintprefix>gatherd<ssemodesuffix>\t{%5, %0%{%1%}|%0%{%1%}, %<xtg_mode>5}"
19353 [(set_attr "type" "ssemov")
19354 (set_attr "prefix" "evex")
19355 (set_attr "mode" "<sseinsnmode>")])
19358 (define_expand "<avx512>_gatherdi<mode>"
19359 [(parallel [(set (match_operand:VI48F 0 "register_operand")
19361 [(match_operand:<VEC_GATHER_SRCDI> 1 "register_operand")
19362 (match_operand:QI 4 "register_operand")
19363 (mem:<ssescalarmode>
19365 [(match_operand 2 "vsib_address_operand")
19366 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand")
19367 (match_operand:SI 5 "const1248_operand")]))]
19369 (clobber (match_scratch:QI 7))])]
19373 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
19374 operands[5]), UNSPEC_VSIBADDR);
19377 (define_insn "*avx512f_gatherdi<mode>"
19378 [(set (match_operand:VI48F 0 "register_operand" "=&v")
19380 [(match_operand:<VEC_GATHER_SRCDI> 1 "register_operand" "0")
19381 (match_operand:QI 7 "register_operand" "2")
19382 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
19384 [(match_operand:P 4 "vsib_address_operand" "Tv")
19385 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand" "v")
19386 (match_operand:SI 5 "const1248_operand" "n")]
19387 UNSPEC_VSIBADDR)])]
19389 (clobber (match_scratch:QI 2 "=&Yk"))]
19392 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%6, %1%{%2%}|%1%{%2%}, %<gatherq_mode>6}";
19394 [(set_attr "type" "ssemov")
19395 (set_attr "prefix" "evex")
19396 (set_attr "mode" "<sseinsnmode>")])
19398 (define_insn "*avx512f_gatherdi<mode>_2"
19399 [(set (match_operand:VI48F 0 "register_operand" "=&v")
19402 (match_operand:QI 6 "register_operand" "1")
19403 (match_operator:<ssescalarmode> 5 "vsib_mem_operator"
19405 [(match_operand:P 3 "vsib_address_operand" "Tv")
19406 (match_operand:<VEC_GATHER_IDXDI> 2 "register_operand" "v")
19407 (match_operand:SI 4 "const1248_operand" "n")]
19408 UNSPEC_VSIBADDR)])]
19410 (clobber (match_scratch:QI 1 "=&Yk"))]
19413 if (<MODE>mode != <VEC_GATHER_SRCDI>mode)
19415 if (<MODE_SIZE> != 64)
19416 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %x0%{%1%}|%x0%{%1%}, %<gatherq_mode>5}";
19418 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %t0%{%1%}|%t0%{%1%}, %t5}";
19420 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %0%{%1%}|%0%{%1%}, %<gatherq_mode>5}";
19422 [(set_attr "type" "ssemov")
19423 (set_attr "prefix" "evex")
19424 (set_attr "mode" "<sseinsnmode>")])
19426 (define_expand "<avx512>_scattersi<mode>"
19427 [(parallel [(set (mem:VI48F
19429 [(match_operand 0 "vsib_address_operand")
19430 (match_operand:<VEC_GATHER_IDXSI> 2 "register_operand")
19431 (match_operand:SI 4 "const1248_operand")]))
19433 [(match_operand:<avx512fmaskmode> 1 "register_operand")
19434 (match_operand:VI48F 3 "register_operand")]
19436 (clobber (match_scratch:<avx512fmaskmode> 6))])]
19440 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[0], operands[2],
19441 operands[4]), UNSPEC_VSIBADDR);
19444 (define_insn "*avx512f_scattersi<mode>"
19445 [(set (match_operator:VI48F 5 "vsib_mem_operator"
19447 [(match_operand:P 0 "vsib_address_operand" "Tv")
19448 (match_operand:<VEC_GATHER_IDXSI> 2 "register_operand" "v")
19449 (match_operand:SI 4 "const1248_operand" "n")]
19452 [(match_operand:<avx512fmaskmode> 6 "register_operand" "1")
19453 (match_operand:VI48F 3 "register_operand" "v")]
19455 (clobber (match_scratch:<avx512fmaskmode> 1 "=&Yk"))]
19457 "v<sseintprefix>scatterd<ssemodesuffix>\t{%3, %5%{%1%}|%5%{%1%}, %3}"
19458 [(set_attr "type" "ssemov")
19459 (set_attr "prefix" "evex")
19460 (set_attr "mode" "<sseinsnmode>")])
19462 (define_expand "<avx512>_scatterdi<mode>"
19463 [(parallel [(set (mem:VI48F
19465 [(match_operand 0 "vsib_address_operand")
19466 (match_operand:<VEC_GATHER_IDXDI> 2 "register_operand")
19467 (match_operand:SI 4 "const1248_operand")]))
19469 [(match_operand:QI 1 "register_operand")
19470 (match_operand:<VEC_GATHER_SRCDI> 3 "register_operand")]
19472 (clobber (match_scratch:QI 6))])]
19476 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[0], operands[2],
19477 operands[4]), UNSPEC_VSIBADDR);
19480 (define_insn "*avx512f_scatterdi<mode>"
19481 [(set (match_operator:VI48F 5 "vsib_mem_operator"
19483 [(match_operand:P 0 "vsib_address_operand" "Tv")
19484 (match_operand:<VEC_GATHER_IDXDI> 2 "register_operand" "v")
19485 (match_operand:SI 4 "const1248_operand" "n")]
19488 [(match_operand:QI 6 "register_operand" "1")
19489 (match_operand:<VEC_GATHER_SRCDI> 3 "register_operand" "v")]
19491 (clobber (match_scratch:QI 1 "=&Yk"))]
19494 if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 8)
19495 return "v<sseintprefix>scatterq<ssemodesuffix>\t{%3, %5%{%1%}|%5%{%1%}, %3}";
19496 return "v<sseintprefix>scatterq<ssemodesuffix>\t{%3, %5%{%1%}|%t5%{%1%}, %3}";
19498 [(set_attr "type" "ssemov")
19499 (set_attr "prefix" "evex")
19500 (set_attr "mode" "<sseinsnmode>")])
19502 (define_insn "<avx512>_compress<mode>_mask"
19503 [(set (match_operand:VI48F 0 "register_operand" "=v")
19505 [(match_operand:VI48F 1 "register_operand" "v")
19506 (match_operand:VI48F 2 "vector_move_operand" "0C")
19507 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")]
19510 "v<sseintprefix>compress<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
19511 [(set_attr "type" "ssemov")
19512 (set_attr "prefix" "evex")
19513 (set_attr "mode" "<sseinsnmode>")])
19515 (define_insn "compress<mode>_mask"
19516 [(set (match_operand:VI12_AVX512VLBW 0 "register_operand" "=v")
19517 (unspec:VI12_AVX512VLBW
19518 [(match_operand:VI12_AVX512VLBW 1 "register_operand" "v")
19519 (match_operand:VI12_AVX512VLBW 2 "vector_move_operand" "0C")
19520 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")]
19522 "TARGET_AVX512VBMI2"
19523 "vpcompress<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
19524 [(set_attr "type" "ssemov")
19525 (set_attr "prefix" "evex")
19526 (set_attr "mode" "<sseinsnmode>")])
19528 (define_insn "<avx512>_compressstore<mode>_mask"
19529 [(set (match_operand:VI48F 0 "memory_operand" "=m")
19531 [(match_operand:VI48F 1 "register_operand" "x")
19533 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")]
19534 UNSPEC_COMPRESS_STORE))]
19536 "v<sseintprefix>compress<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}"
19537 [(set_attr "type" "ssemov")
19538 (set_attr "prefix" "evex")
19539 (set_attr "memory" "store")
19540 (set_attr "mode" "<sseinsnmode>")])
19542 (define_insn "compressstore<mode>_mask"
19543 [(set (match_operand:VI12_AVX512VLBW 0 "memory_operand" "=m")
19544 (unspec:VI12_AVX512VLBW
19545 [(match_operand:VI12_AVX512VLBW 1 "register_operand" "x")
19547 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")]
19548 UNSPEC_COMPRESS_STORE))]
19549 "TARGET_AVX512VBMI2"
19550 "vpcompress<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}"
19551 [(set_attr "type" "ssemov")
19552 (set_attr "prefix" "evex")
19553 (set_attr "memory" "store")
19554 (set_attr "mode" "<sseinsnmode>")])
19556 (define_expand "<avx512>_expand<mode>_maskz"
19557 [(set (match_operand:VI48F 0 "register_operand")
19559 [(match_operand:VI48F 1 "nonimmediate_operand")
19560 (match_operand:VI48F 2 "vector_move_operand")
19561 (match_operand:<avx512fmaskmode> 3 "register_operand")]
19564 "operands[2] = CONST0_RTX (<MODE>mode);")
19566 (define_insn "<avx512>_expand<mode>_mask"
19567 [(set (match_operand:VI48F 0 "register_operand" "=v,v")
19569 [(match_operand:VI48F 1 "nonimmediate_operand" "v,m")
19570 (match_operand:VI48F 2 "vector_move_operand" "0C,0C")
19571 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")]
19574 "v<sseintprefix>expand<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
19575 [(set_attr "type" "ssemov")
19576 (set_attr "prefix" "evex")
19577 (set_attr "memory" "none,load")
19578 (set_attr "mode" "<sseinsnmode>")])
19580 (define_insn "expand<mode>_mask"
19581 [(set (match_operand:VI12_AVX512VLBW 0 "register_operand" "=v,v")
19582 (unspec:VI12_AVX512VLBW
19583 [(match_operand:VI12_AVX512VLBW 1 "nonimmediate_operand" "v,m")
19584 (match_operand:VI12_AVX512VLBW 2 "vector_move_operand" "0C,0C")
19585 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")]
19587 "TARGET_AVX512VBMI2"
19588 "v<sseintprefix>expand<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
19589 [(set_attr "type" "ssemov")
19590 (set_attr "prefix" "evex")
19591 (set_attr "memory" "none,load")
19592 (set_attr "mode" "<sseinsnmode>")])
19594 (define_expand "expand<mode>_maskz"
19595 [(set (match_operand:VI12_AVX512VLBW 0 "register_operand")
19596 (unspec:VI12_AVX512VLBW
19597 [(match_operand:VI12_AVX512VLBW 1 "nonimmediate_operand")
19598 (match_operand:VI12_AVX512VLBW 2 "vector_move_operand")
19599 (match_operand:<avx512fmaskmode> 3 "register_operand")]
19601 "TARGET_AVX512VBMI2"
19602 "operands[2] = CONST0_RTX (<MODE>mode);")
19604 (define_insn "avx512dq_rangep<mode><mask_name><round_saeonly_name>"
19605 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
19606 (unspec:VF_AVX512VL
19607 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
19608 (match_operand:VF_AVX512VL 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
19609 (match_operand:SI 3 "const_0_to_15_operand")]
19611 "TARGET_AVX512DQ && <round_saeonly_mode512bit_condition>"
19612 "vrange<ssemodesuffix>\t{%3, <round_saeonly_mask_op4>%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2<round_saeonly_mask_op4>, %3}"
19613 [(set_attr "type" "sse")
19614 (set_attr "prefix" "evex")
19615 (set_attr "mode" "<MODE>")])
19617 (define_insn "avx512dq_ranges<mode><mask_scalar_name><round_saeonly_scalar_name>"
19618 [(set (match_operand:VF_128 0 "register_operand" "=v")
19621 [(match_operand:VF_128 1 "register_operand" "v")
19622 (match_operand:VF_128 2 "<round_saeonly_scalar_nimm_predicate>" "<round_saeonly_scalar_constraint>")
19623 (match_operand:SI 3 "const_0_to_15_operand")]
19628 "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}"
19629 [(set_attr "type" "sse")
19630 (set_attr "prefix" "evex")
19631 (set_attr "mode" "<MODE>")])
19633 (define_insn "avx512dq_fpclass<mode><mask_scalar_merge_name>"
19634 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
19635 (unspec:<avx512fmaskmode>
19636 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
19637 (match_operand:QI 2 "const_0_to_255_operand" "n")]
19640 "vfpclass<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}";
19641 [(set_attr "type" "sse")
19642 (set_attr "length_immediate" "1")
19643 (set_attr "prefix" "evex")
19644 (set_attr "mode" "<MODE>")])
19646 (define_insn "avx512dq_vmfpclass<mode>"
19647 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
19648 (and:<avx512fmaskmode>
19649 (unspec:<avx512fmaskmode>
19650 [(match_operand:VF_128 1 "register_operand" "v")
19651 (match_operand:QI 2 "const_0_to_255_operand" "n")]
19655 "vfpclass<ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %2}";
19656 [(set_attr "type" "sse")
19657 (set_attr "length_immediate" "1")
19658 (set_attr "prefix" "evex")
19659 (set_attr "mode" "<MODE>")])
19661 (define_insn "<avx512>_getmant<mode><mask_name><round_saeonly_name>"
19662 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
19663 (unspec:VF_AVX512VL
19664 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "<round_saeonly_constraint>")
19665 (match_operand:SI 2 "const_0_to_15_operand")]
19668 "vgetmant<ssemodesuffix>\t{%2, <round_saeonly_mask_op3>%1, %0<mask_operand3>|%0<mask_operand3>, %1<round_saeonly_mask_op3>, %2}";
19669 [(set_attr "prefix" "evex")
19670 (set_attr "mode" "<MODE>")])
19672 (define_insn "avx512f_vgetmant<mode><mask_scalar_name><round_saeonly_scalar_name>"
19673 [(set (match_operand:VF_128 0 "register_operand" "=v")
19676 [(match_operand:VF_128 1 "register_operand" "v")
19677 (match_operand:VF_128 2 "<round_saeonly_scalar_nimm_predicate>" "<round_saeonly_scalar_constraint>")
19678 (match_operand:SI 3 "const_0_to_15_operand")]
19683 "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}";
19684 [(set_attr "prefix" "evex")
19685 (set_attr "mode" "<ssescalarmode>")])
19687 ;; The correct representation for this is absolutely enormous, and
19688 ;; surely not generally useful.
19689 (define_insn "<mask_codefor>avx512bw_dbpsadbw<mode><mask_name>"
19690 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
19691 (unspec:VI2_AVX512VL
19692 [(match_operand:<dbpsadbwmode> 1 "register_operand" "v")
19693 (match_operand:<dbpsadbwmode> 2 "nonimmediate_operand" "vm")
19694 (match_operand:SI 3 "const_0_to_255_operand")]
19697 "vdbpsadbw\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3}"
19698 [(set_attr "type" "sselog1")
19699 (set_attr "length_immediate" "1")
19700 (set_attr "prefix" "evex")
19701 (set_attr "mode" "<sseinsnmode>")])
19703 (define_insn "clz<mode>2<mask_name>"
19704 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
19706 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm")))]
19708 "vplzcnt<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
19709 [(set_attr "type" "sse")
19710 (set_attr "prefix" "evex")
19711 (set_attr "mode" "<sseinsnmode>")])
19713 (define_insn "<mask_codefor>conflict<mode><mask_name>"
19714 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
19715 (unspec:VI48_AVX512VL
19716 [(match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm")]
19719 "vpconflict<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
19720 [(set_attr "type" "sse")
19721 (set_attr "prefix" "evex")
19722 (set_attr "mode" "<sseinsnmode>")])
19724 (define_insn "sha1msg1"
19725 [(set (match_operand:V4SI 0 "register_operand" "=x")
19727 [(match_operand:V4SI 1 "register_operand" "0")
19728 (match_operand:V4SI 2 "vector_operand" "xBm")]
19731 "sha1msg1\t{%2, %0|%0, %2}"
19732 [(set_attr "type" "sselog1")
19733 (set_attr "mode" "TI")])
19735 (define_insn "sha1msg2"
19736 [(set (match_operand:V4SI 0 "register_operand" "=x")
19738 [(match_operand:V4SI 1 "register_operand" "0")
19739 (match_operand:V4SI 2 "vector_operand" "xBm")]
19742 "sha1msg2\t{%2, %0|%0, %2}"
19743 [(set_attr "type" "sselog1")
19744 (set_attr "mode" "TI")])
19746 (define_insn "sha1nexte"
19747 [(set (match_operand:V4SI 0 "register_operand" "=x")
19749 [(match_operand:V4SI 1 "register_operand" "0")
19750 (match_operand:V4SI 2 "vector_operand" "xBm")]
19751 UNSPEC_SHA1NEXTE))]
19753 "sha1nexte\t{%2, %0|%0, %2}"
19754 [(set_attr "type" "sselog1")
19755 (set_attr "mode" "TI")])
19757 (define_insn "sha1rnds4"
19758 [(set (match_operand:V4SI 0 "register_operand" "=x")
19760 [(match_operand:V4SI 1 "register_operand" "0")
19761 (match_operand:V4SI 2 "vector_operand" "xBm")
19762 (match_operand:SI 3 "const_0_to_3_operand" "n")]
19763 UNSPEC_SHA1RNDS4))]
19765 "sha1rnds4\t{%3, %2, %0|%0, %2, %3}"
19766 [(set_attr "type" "sselog1")
19767 (set_attr "length_immediate" "1")
19768 (set_attr "mode" "TI")])
19770 (define_insn "sha256msg1"
19771 [(set (match_operand:V4SI 0 "register_operand" "=x")
19773 [(match_operand:V4SI 1 "register_operand" "0")
19774 (match_operand:V4SI 2 "vector_operand" "xBm")]
19775 UNSPEC_SHA256MSG1))]
19777 "sha256msg1\t{%2, %0|%0, %2}"
19778 [(set_attr "type" "sselog1")
19779 (set_attr "mode" "TI")])
19781 (define_insn "sha256msg2"
19782 [(set (match_operand:V4SI 0 "register_operand" "=x")
19784 [(match_operand:V4SI 1 "register_operand" "0")
19785 (match_operand:V4SI 2 "vector_operand" "xBm")]
19786 UNSPEC_SHA256MSG2))]
19788 "sha256msg2\t{%2, %0|%0, %2}"
19789 [(set_attr "type" "sselog1")
19790 (set_attr "mode" "TI")])
19792 (define_insn "sha256rnds2"
19793 [(set (match_operand:V4SI 0 "register_operand" "=x")
19795 [(match_operand:V4SI 1 "register_operand" "0")
19796 (match_operand:V4SI 2 "vector_operand" "xBm")
19797 (match_operand:V4SI 3 "register_operand" "Yz")]
19798 UNSPEC_SHA256RNDS2))]
19800 "sha256rnds2\t{%3, %2, %0|%0, %2, %3}"
19801 [(set_attr "type" "sselog1")
19802 (set_attr "length_immediate" "1")
19803 (set_attr "mode" "TI")])
19805 (define_insn_and_split "avx512f_<castmode><avxsizesuffix>_<castmode>"
19806 [(set (match_operand:AVX512MODE2P 0 "nonimmediate_operand" "=x,m")
19807 (unspec:AVX512MODE2P
19808 [(match_operand:<ssequartermode> 1 "nonimmediate_operand" "xm,x")]
19810 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
19812 "&& reload_completed"
19813 [(set (match_dup 0) (match_dup 1))]
19815 if (REG_P (operands[0]))
19816 operands[0] = gen_lowpart (<ssequartermode>mode, operands[0]);
19818 operands[1] = lowpart_subreg (<MODE>mode, operands[1],
19819 <ssequartermode>mode);
19822 (define_insn_and_split "avx512f_<castmode><avxsizesuffix>_256<castmode>"
19823 [(set (match_operand:AVX512MODE2P 0 "nonimmediate_operand" "=x,m")
19824 (unspec:AVX512MODE2P
19825 [(match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "xm,x")]
19827 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
19829 "&& reload_completed"
19830 [(set (match_dup 0) (match_dup 1))]
19832 if (REG_P (operands[0]))
19833 operands[0] = gen_lowpart (<ssehalfvecmode>mode, operands[0]);
19835 operands[1] = lowpart_subreg (<MODE>mode, operands[1],
19836 <ssehalfvecmode>mode);
19839 (define_int_iterator VPMADD52
19840 [UNSPEC_VPMADD52LUQ
19841 UNSPEC_VPMADD52HUQ])
19843 (define_int_attr vpmadd52type
19844 [(UNSPEC_VPMADD52LUQ "luq") (UNSPEC_VPMADD52HUQ "huq")])
19846 (define_expand "vpamdd52huq<mode>_maskz"
19847 [(match_operand:VI8_AVX512VL 0 "register_operand")
19848 (match_operand:VI8_AVX512VL 1 "register_operand")
19849 (match_operand:VI8_AVX512VL 2 "register_operand")
19850 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand")
19851 (match_operand:<avx512fmaskmode> 4 "register_operand")]
19852 "TARGET_AVX512IFMA"
19854 emit_insn (gen_vpamdd52huq<mode>_maskz_1 (
19855 operands[0], operands[1], operands[2], operands[3],
19856 CONST0_RTX (<MODE>mode), operands[4]));
19860 (define_expand "vpamdd52luq<mode>_maskz"
19861 [(match_operand:VI8_AVX512VL 0 "register_operand")
19862 (match_operand:VI8_AVX512VL 1 "register_operand")
19863 (match_operand:VI8_AVX512VL 2 "register_operand")
19864 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand")
19865 (match_operand:<avx512fmaskmode> 4 "register_operand")]
19866 "TARGET_AVX512IFMA"
19868 emit_insn (gen_vpamdd52luq<mode>_maskz_1 (
19869 operands[0], operands[1], operands[2], operands[3],
19870 CONST0_RTX (<MODE>mode), operands[4]));
19874 (define_insn "vpamdd52<vpmadd52type><mode><sd_maskz_name>"
19875 [(set (match_operand:VI8_AVX512VL 0 "register_operand" "=v")
19876 (unspec:VI8_AVX512VL
19877 [(match_operand:VI8_AVX512VL 1 "register_operand" "0")
19878 (match_operand:VI8_AVX512VL 2 "register_operand" "v")
19879 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand" "vm")]
19881 "TARGET_AVX512IFMA"
19882 "vpmadd52<vpmadd52type>\t{%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3}"
19883 [(set_attr "type" "ssemuladd")
19884 (set_attr "prefix" "evex")
19885 (set_attr "mode" "<sseinsnmode>")])
19887 (define_insn "vpamdd52<vpmadd52type><mode>_mask"
19888 [(set (match_operand:VI8_AVX512VL 0 "register_operand" "=v")
19889 (vec_merge:VI8_AVX512VL
19890 (unspec:VI8_AVX512VL
19891 [(match_operand:VI8_AVX512VL 1 "register_operand" "0")
19892 (match_operand:VI8_AVX512VL 2 "register_operand" "v")
19893 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand" "vm")]
19896 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
19897 "TARGET_AVX512IFMA"
19898 "vpmadd52<vpmadd52type>\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3}"
19899 [(set_attr "type" "ssemuladd")
19900 (set_attr "prefix" "evex")
19901 (set_attr "mode" "<sseinsnmode>")])
19903 (define_insn "vpmultishiftqb<mode><mask_name>"
19904 [(set (match_operand:VI1_AVX512VL 0 "register_operand" "=v")
19905 (unspec:VI1_AVX512VL
19906 [(match_operand:VI1_AVX512VL 1 "register_operand" "v")
19907 (match_operand:VI1_AVX512VL 2 "nonimmediate_operand" "vm")]
19908 UNSPEC_VPMULTISHIFT))]
19909 "TARGET_AVX512VBMI"
19910 "vpmultishiftqb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
19911 [(set_attr "type" "sselog")
19912 (set_attr "prefix" "evex")
19913 (set_attr "mode" "<sseinsnmode>")])
19915 (define_mode_iterator IMOD4
19916 [(V64SF "TARGET_AVX5124FMAPS") (V64SI "TARGET_AVX5124VNNIW")])
19918 (define_mode_attr imod4_narrow
19919 [(V64SF "V16SF") (V64SI "V16SI")])
19921 (define_expand "mov<mode>"
19922 [(set (match_operand:IMOD4 0 "nonimmediate_operand")
19923 (match_operand:IMOD4 1 "vector_move_operand"))]
19926 ix86_expand_vector_move (<MODE>mode, operands);
19930 (define_insn_and_split "*mov<mode>_internal"
19931 [(set (match_operand:IMOD4 0 "nonimmediate_operand" "=v,v ,m")
19932 (match_operand:IMOD4 1 "vector_move_operand" " C,vm,v"))]
19934 && (register_operand (operands[0], <MODE>mode)
19935 || register_operand (operands[1], <MODE>mode))"
19937 "&& reload_completed"
19943 for (i = 0; i < 4; i++)
19945 op0 = simplify_subreg
19946 (<imod4_narrow>mode, operands[0], <MODE>mode, i * 64);
19947 op1 = simplify_subreg
19948 (<imod4_narrow>mode, operands[1], <MODE>mode, i * 64);
19949 emit_move_insn (op0, op1);
19954 (define_insn "avx5124fmaddps_4fmaddps"
19955 [(set (match_operand:V16SF 0 "register_operand" "=v")
19957 [(match_operand:V16SF 1 "register_operand" "0")
19958 (match_operand:V64SF 2 "register_operand" "v")
19959 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FMADD))]
19960 "TARGET_AVX5124FMAPS"
19961 "v4fmaddps\t{%3, %g2, %0|%0, %g2, %3}"
19962 [(set_attr ("type") ("ssemuladd"))
19963 (set_attr ("prefix") ("evex"))
19964 (set_attr ("mode") ("V16SF"))])
19966 (define_insn "avx5124fmaddps_4fmaddps_mask"
19967 [(set (match_operand:V16SF 0 "register_operand" "=v")
19970 [(match_operand:V64SF 1 "register_operand" "v")
19971 (match_operand:V4SF 2 "memory_operand" "m")] UNSPEC_VP4FMADD)
19972 (match_operand:V16SF 3 "register_operand" "0")
19973 (match_operand:HI 4 "register_operand" "Yk")))]
19974 "TARGET_AVX5124FMAPS"
19975 "v4fmaddps\t{%2, %g1, %0%{%4%}|%0%{%4%}, %g1, %2}"
19976 [(set_attr ("type") ("ssemuladd"))
19977 (set_attr ("prefix") ("evex"))
19978 (set_attr ("mode") ("V16SF"))])
19980 (define_insn "avx5124fmaddps_4fmaddps_maskz"
19981 [(set (match_operand:V16SF 0 "register_operand" "=v")
19984 [(match_operand:V16SF 1 "register_operand" "0")
19985 (match_operand:V64SF 2 "register_operand" "v")
19986 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FMADD)
19987 (match_operand:V16SF 4 "const0_operand" "C")
19988 (match_operand:HI 5 "register_operand" "Yk")))]
19989 "TARGET_AVX5124FMAPS"
19990 "v4fmaddps\t{%3, %g2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %g2, %3}"
19991 [(set_attr ("type") ("ssemuladd"))
19992 (set_attr ("prefix") ("evex"))
19993 (set_attr ("mode") ("V16SF"))])
19995 (define_insn "avx5124fmaddps_4fmaddss"
19996 [(set (match_operand:V4SF 0 "register_operand" "=v")
19998 [(match_operand:V4SF 1 "register_operand" "0")
19999 (match_operand:V64SF 2 "register_operand" "v")
20000 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FMADD))]
20001 "TARGET_AVX5124FMAPS"
20002 "v4fmaddss\t{%3, %x2, %0|%0, %x2, %3}"
20003 [(set_attr ("type") ("ssemuladd"))
20004 (set_attr ("prefix") ("evex"))
20005 (set_attr ("mode") ("SF"))])
20007 (define_insn "avx5124fmaddps_4fmaddss_mask"
20008 [(set (match_operand:V4SF 0 "register_operand" "=v")
20011 [(match_operand:V64SF 1 "register_operand" "v")
20012 (match_operand:V4SF 2 "memory_operand" "m")] UNSPEC_VP4FMADD)
20013 (match_operand:V4SF 3 "register_operand" "0")
20014 (match_operand:QI 4 "register_operand" "Yk")))]
20015 "TARGET_AVX5124FMAPS"
20016 "v4fmaddss\t{%2, %x1, %0%{%4%}|%0%{%4%}, %x1, %2}"
20017 [(set_attr ("type") ("ssemuladd"))
20018 (set_attr ("prefix") ("evex"))
20019 (set_attr ("mode") ("SF"))])
20021 (define_insn "avx5124fmaddps_4fmaddss_maskz"
20022 [(set (match_operand:V4SF 0 "register_operand" "=v")
20025 [(match_operand:V4SF 1 "register_operand" "0")
20026 (match_operand:V64SF 2 "register_operand" "v")
20027 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FMADD)
20028 (match_operand:V4SF 4 "const0_operand" "C")
20029 (match_operand:QI 5 "register_operand" "Yk")))]
20030 "TARGET_AVX5124FMAPS"
20031 "v4fmaddss\t{%3, %x2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %x2, %3}"
20032 [(set_attr ("type") ("ssemuladd"))
20033 (set_attr ("prefix") ("evex"))
20034 (set_attr ("mode") ("SF"))])
20036 (define_insn "avx5124fmaddps_4fnmaddps"
20037 [(set (match_operand:V16SF 0 "register_operand" "=v")
20039 [(match_operand:V16SF 1 "register_operand" "0")
20040 (match_operand:V64SF 2 "register_operand" "v")
20041 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FNMADD))]
20042 "TARGET_AVX5124FMAPS"
20043 "v4fnmaddps\t{%3, %g2, %0|%0, %g2, %3}"
20044 [(set_attr ("type") ("ssemuladd"))
20045 (set_attr ("prefix") ("evex"))
20046 (set_attr ("mode") ("V16SF"))])
20048 (define_insn "avx5124fmaddps_4fnmaddps_mask"
20049 [(set (match_operand:V16SF 0 "register_operand" "=v")
20052 [(match_operand:V64SF 1 "register_operand" "v")
20053 (match_operand:V4SF 2 "memory_operand" "m")] UNSPEC_VP4FNMADD)
20054 (match_operand:V16SF 3 "register_operand" "0")
20055 (match_operand:HI 4 "register_operand" "Yk")))]
20056 "TARGET_AVX5124FMAPS"
20057 "v4fnmaddps\t{%2, %g1, %0%{%4%}|%0%{%4%}, %g1, %2}"
20058 [(set_attr ("type") ("ssemuladd"))
20059 (set_attr ("prefix") ("evex"))
20060 (set_attr ("mode") ("V16SF"))])
20062 (define_insn "avx5124fmaddps_4fnmaddps_maskz"
20063 [(set (match_operand:V16SF 0 "register_operand" "=v")
20066 [(match_operand:V16SF 1 "register_operand" "0")
20067 (match_operand:V64SF 2 "register_operand" "v")
20068 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FNMADD)
20069 (match_operand:V16SF 4 "const0_operand" "C")
20070 (match_operand:HI 5 "register_operand" "Yk")))]
20071 "TARGET_AVX5124FMAPS"
20072 "v4fnmaddps\t{%3, %g2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %g2, %3}"
20073 [(set_attr ("type") ("ssemuladd"))
20074 (set_attr ("prefix") ("evex"))
20075 (set_attr ("mode") ("V16SF"))])
20077 (define_insn "avx5124fmaddps_4fnmaddss"
20078 [(set (match_operand:V4SF 0 "register_operand" "=v")
20080 [(match_operand:V4SF 1 "register_operand" "0")
20081 (match_operand:V64SF 2 "register_operand" "v")
20082 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FNMADD))]
20083 "TARGET_AVX5124FMAPS"
20084 "v4fnmaddss\t{%3, %x2, %0|%0, %x2, %3}"
20085 [(set_attr ("type") ("ssemuladd"))
20086 (set_attr ("prefix") ("evex"))
20087 (set_attr ("mode") ("SF"))])
20089 (define_insn "avx5124fmaddps_4fnmaddss_mask"
20090 [(set (match_operand:V4SF 0 "register_operand" "=v")
20093 [(match_operand:V64SF 1 "register_operand" "v")
20094 (match_operand:V4SF 2 "memory_operand" "m")] UNSPEC_VP4FNMADD)
20095 (match_operand:V4SF 3 "register_operand" "0")
20096 (match_operand:QI 4 "register_operand" "Yk")))]
20097 "TARGET_AVX5124FMAPS"
20098 "v4fnmaddss\t{%2, %x1, %0%{%4%}|%0%{%4%}, %x1, %2}"
20099 [(set_attr ("type") ("ssemuladd"))
20100 (set_attr ("prefix") ("evex"))
20101 (set_attr ("mode") ("SF"))])
20103 (define_insn "avx5124fmaddps_4fnmaddss_maskz"
20104 [(set (match_operand:V4SF 0 "register_operand" "=v")
20107 [(match_operand:V4SF 1 "register_operand" "0")
20108 (match_operand:V64SF 2 "register_operand" "v")
20109 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FNMADD)
20110 (match_operand:V4SF 4 "const0_operand" "C")
20111 (match_operand:QI 5 "register_operand" "Yk")))]
20112 "TARGET_AVX5124FMAPS"
20113 "v4fnmaddss\t{%3, %x2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %x2, %3}"
20114 [(set_attr ("type") ("ssemuladd"))
20115 (set_attr ("prefix") ("evex"))
20116 (set_attr ("mode") ("SF"))])
20118 (define_insn "avx5124vnniw_vp4dpwssd"
20119 [(set (match_operand:V16SI 0 "register_operand" "=v")
20121 [(match_operand:V16SI 1 "register_operand" "0")
20122 (match_operand:V64SI 2 "register_operand" "v")
20123 (match_operand:V4SI 3 "memory_operand" "m")] UNSPEC_VP4DPWSSD))]
20124 "TARGET_AVX5124VNNIW"
20125 "vp4dpwssd\t{%3, %g2, %0|%0, %g2, %3}"
20126 [(set_attr ("type") ("ssemuladd"))
20127 (set_attr ("prefix") ("evex"))
20128 (set_attr ("mode") ("TI"))])
20130 (define_insn "avx5124vnniw_vp4dpwssd_mask"
20131 [(set (match_operand:V16SI 0 "register_operand" "=v")
20134 [(match_operand:V64SI 1 "register_operand" "v")
20135 (match_operand:V4SI 2 "memory_operand" "m")] UNSPEC_VP4DPWSSD)
20136 (match_operand:V16SI 3 "register_operand" "0")
20137 (match_operand:HI 4 "register_operand" "Yk")))]
20138 "TARGET_AVX5124VNNIW"
20139 "vp4dpwssd\t{%2, %g1, %0%{%4%}|%0%{%4%}, %g1, %2}"
20140 [(set_attr ("type") ("ssemuladd"))
20141 (set_attr ("prefix") ("evex"))
20142 (set_attr ("mode") ("TI"))])
20144 (define_insn "avx5124vnniw_vp4dpwssd_maskz"
20145 [(set (match_operand:V16SI 0 "register_operand" "=v")
20148 [(match_operand:V16SI 1 "register_operand" "0")
20149 (match_operand:V64SI 2 "register_operand" "v")
20150 (match_operand:V4SI 3 "memory_operand" "m")] UNSPEC_VP4DPWSSD)
20151 (match_operand:V16SI 4 "const0_operand" "C")
20152 (match_operand:HI 5 "register_operand" "Yk")))]
20153 "TARGET_AVX5124VNNIW"
20154 "vp4dpwssd\t{%3, %g2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %g2, %3}"
20155 [(set_attr ("type") ("ssemuladd"))
20156 (set_attr ("prefix") ("evex"))
20157 (set_attr ("mode") ("TI"))])
20159 (define_insn "avx5124vnniw_vp4dpwssds"
20160 [(set (match_operand:V16SI 0 "register_operand" "=v")
20162 [(match_operand:V16SI 1 "register_operand" "0")
20163 (match_operand:V64SI 2 "register_operand" "v")
20164 (match_operand:V4SI 3 "memory_operand" "m")] UNSPEC_VP4DPWSSDS))]
20165 "TARGET_AVX5124VNNIW"
20166 "vp4dpwssds\t{%3, %g2, %0|%0, %g2, %3}"
20167 [(set_attr ("type") ("ssemuladd"))
20168 (set_attr ("prefix") ("evex"))
20169 (set_attr ("mode") ("TI"))])
20171 (define_insn "avx5124vnniw_vp4dpwssds_mask"
20172 [(set (match_operand:V16SI 0 "register_operand" "=v")
20175 [(match_operand:V64SI 1 "register_operand" "v")
20176 (match_operand:V4SI 2 "memory_operand" "m")] UNSPEC_VP4DPWSSDS)
20177 (match_operand:V16SI 3 "register_operand" "0")
20178 (match_operand:HI 4 "register_operand" "Yk")))]
20179 "TARGET_AVX5124VNNIW"
20180 "vp4dpwssds\t{%2, %g1, %0%{%4%}|%0%{%4%}, %g1, %2}"
20181 [(set_attr ("type") ("ssemuladd"))
20182 (set_attr ("prefix") ("evex"))
20183 (set_attr ("mode") ("TI"))])
20185 (define_insn "avx5124vnniw_vp4dpwssds_maskz"
20186 [(set (match_operand:V16SI 0 "register_operand" "=v")
20189 [(match_operand:V16SI 1 "register_operand" "0")
20190 (match_operand:V64SI 2 "register_operand" "v")
20191 (match_operand:V4SI 3 "memory_operand" "m")] UNSPEC_VP4DPWSSDS)
20192 (match_operand:V16SI 4 "const0_operand" "C")
20193 (match_operand:HI 5 "register_operand" "Yk")))]
20194 "TARGET_AVX5124VNNIW"
20195 "vp4dpwssds\t{%3, %g2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %g2, %3}"
20196 [(set_attr ("type") ("ssemuladd"))
20197 (set_attr ("prefix") ("evex"))
20198 (set_attr ("mode") ("TI"))])
20200 (define_insn "vpopcount<mode><mask_name>"
20201 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
20202 (popcount:VI48_AVX512VL
20203 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm")))]
20204 "TARGET_AVX512VPOPCNTDQ"
20205 "vpopcnt<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}")
20207 ;; Save multiple registers out-of-line.
20208 (define_insn "save_multiple<mode>"
20209 [(match_parallel 0 "save_multiple"
20210 [(use (match_operand:P 1 "symbol_operand"))])]
20211 "TARGET_SSE && TARGET_64BIT"
20214 ;; Restore multiple registers out-of-line.
20215 (define_insn "restore_multiple<mode>"
20216 [(match_parallel 0 "restore_multiple"
20217 [(use (match_operand:P 1 "symbol_operand"))])]
20218 "TARGET_SSE && TARGET_64BIT"
20221 ;; Restore multiple registers out-of-line and return.
20222 (define_insn "restore_multiple_and_return<mode>"
20223 [(match_parallel 0 "restore_multiple"
20225 (use (match_operand:P 1 "symbol_operand"))
20226 (set (reg:DI SP_REG) (reg:DI R10_REG))
20228 "TARGET_SSE && TARGET_64BIT"
20231 ;; Restore multiple registers out-of-line when hard frame pointer is used,
20232 ;; perform the leave operation prior to returning (from the function).
20233 (define_insn "restore_multiple_leave_return<mode>"
20234 [(match_parallel 0 "restore_multiple"
20236 (use (match_operand:P 1 "symbol_operand"))
20237 (set (reg:DI SP_REG) (plus:DI (reg:DI BP_REG) (const_int 8)))
20238 (set (reg:DI BP_REG) (mem:DI (reg:DI BP_REG)))
20239 (clobber (mem:BLK (scratch)))
20241 "TARGET_SSE && TARGET_64BIT"
20244 (define_insn "vpopcount<mode><mask_name>"
20245 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
20246 (popcount:VI12_AVX512VL
20247 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "vm")))]
20248 "TARGET_AVX512BITALG"
20249 "vpopcnt<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}")
20251 (define_insn "vgf2p8affineinvqb_<mode><mask_name>"
20252 [(set (match_operand:VI1_AVX512F 0 "register_operand" "=x,x,v")
20253 (unspec:VI1_AVX512F
20254 [(match_operand:VI1_AVX512F 1 "register_operand" "%0,x,v")
20255 (match_operand:VI1_AVX512F 2 "nonimmediate_operand" "xBm,xm,vm")
20256 (match_operand:QI 3 "const_0_to_255_operand" "n,n,n")]
20257 UNSPEC_GF2P8AFFINEINV))]
20260 gf2p8affineinvqb\t{%3, %2, %0| %0, %2, %3}
20261 vgf2p8affineinvqb\t{%3, %2, %1, %0<mask_operand4>| %0<mask_operand4>, %1, %2, %3}
20262 vgf2p8affineinvqb\t{%3, %2, %1, %0<mask_operand4>| %0<mask_operand4>, %1, %2, %3}"
20263 [(set_attr "isa" "noavx,avx,avx512f")
20264 (set_attr "prefix_data16" "1,*,*")
20265 (set_attr "prefix_extra" "1")
20266 (set_attr "prefix" "orig,maybe_evex,evex")
20267 (set_attr "mode" "<sseinsnmode>")])
20269 (define_insn "vgf2p8affineqb_<mode><mask_name>"
20270 [(set (match_operand:VI1_AVX512F 0 "register_operand" "=x,x,v")
20271 (unspec:VI1_AVX512F
20272 [(match_operand:VI1_AVX512F 1 "register_operand" "%0,x,v")
20273 (match_operand:VI1_AVX512F 2 "nonimmediate_operand" "xBm,xm,vm")
20274 (match_operand:QI 3 "const_0_to_255_operand" "n,n,n")]
20275 UNSPEC_GF2P8AFFINE))]
20278 gf2p8affineqb\t{%3, %2, %0| %0, %2, %3}
20279 vgf2p8affineqb\t{%3, %2, %1, %0<mask_operand4>| %0<mask_operand4>, %1, %2, %3}
20280 vgf2p8affineqb\t{%3, %2, %1, %0<mask_operand4>| %0<mask_operand4>, %1, %2, %3}"
20281 [(set_attr "isa" "noavx,avx,avx512f")
20282 (set_attr "prefix_data16" "1,*,*")
20283 (set_attr "prefix_extra" "1")
20284 (set_attr "prefix" "orig,maybe_evex,evex")
20285 (set_attr "mode" "<sseinsnmode>")])
20287 (define_insn "vgf2p8mulb_<mode><mask_name>"
20288 [(set (match_operand:VI1_AVX512F 0 "register_operand" "=x,x,v")
20289 (unspec:VI1_AVX512F
20290 [(match_operand:VI1_AVX512F 1 "register_operand" "%0,x,v")
20291 (match_operand:VI1_AVX512F 2 "nonimmediate_operand" "xBm,xm,vm")]
20295 gf2p8mulb\t{%2, %0| %0, %2}
20296 vgf2p8mulb\t{%2, %1, %0<mask_operand3>| %0<mask_operand3>, %1, %2}
20297 vgf2p8mulb\t{%2, %1, %0<mask_operand3>| %0<mask_operand3>, %1, %2}"
20298 [(set_attr "isa" "noavx,avx,avx512f")
20299 (set_attr "prefix_data16" "1,*,*")
20300 (set_attr "prefix_extra" "1")
20301 (set_attr "prefix" "orig,maybe_evex,evex")
20302 (set_attr "mode" "<sseinsnmode>")])
20304 (define_insn "vpshrd_<mode><mask_name>"
20305 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
20306 (unspec:VI248_AVX512VL
20307 [(match_operand:VI248_AVX512VL 1 "register_operand" "v")
20308 (match_operand:VI248_AVX512VL 2 "nonimmediate_operand" "vm")
20309 (match_operand:SI 3 "const_0_to_255_operand" "n")]
20311 "TARGET_AVX512VBMI2"
20312 "vpshrd<ssemodesuffix>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3 }"
20313 [(set_attr ("prefix") ("evex"))])
20315 (define_insn "vpshld_<mode><mask_name>"
20316 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
20317 (unspec:VI248_AVX512VL
20318 [(match_operand:VI248_AVX512VL 1 "register_operand" "v")
20319 (match_operand:VI248_AVX512VL 2 "nonimmediate_operand" "vm")
20320 (match_operand:SI 3 "const_0_to_255_operand" "n")]
20322 "TARGET_AVX512VBMI2"
20323 "vpshld<ssemodesuffix>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3 }"
20324 [(set_attr ("prefix") ("evex"))])
20326 (define_insn "vpshrdv_<mode>"
20327 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
20328 (unspec:VI248_AVX512VL
20329 [(match_operand:VI248_AVX512VL 1 "register_operand" "0")
20330 (match_operand:VI248_AVX512VL 2 "register_operand" "v")
20331 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand" "vm")]
20333 "TARGET_AVX512VBMI2"
20334 "vpshrdv<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3 }"
20335 [(set_attr ("prefix") ("evex"))
20336 (set_attr "mode" "<sseinsnmode>")])
20338 (define_insn "vpshrdv_<mode>_mask"
20339 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
20340 (vec_merge:VI248_AVX512VL
20341 (unspec:VI248_AVX512VL
20342 [(match_operand:VI248_AVX512VL 1 "register_operand" "0")
20343 (match_operand:VI248_AVX512VL 2 "register_operand" "v")
20344 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand" "vm")]
20347 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
20348 "TARGET_AVX512VBMI2"
20349 "vpshrdv<ssemodesuffix>\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
20350 [(set_attr ("prefix") ("evex"))
20351 (set_attr "mode" "<sseinsnmode>")])
20353 (define_expand "vpshrdv_<mode>_maskz"
20354 [(match_operand:VI248_AVX512VL 0 "register_operand")
20355 (match_operand:VI248_AVX512VL 1 "register_operand")
20356 (match_operand:VI248_AVX512VL 2 "register_operand")
20357 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand")
20358 (match_operand:<avx512fmaskmode> 4 "register_operand")]
20359 "TARGET_AVX512VBMI2"
20361 emit_insn (gen_vpshrdv_<mode>_maskz_1 (operands[0], operands[1],
20362 operands[2], operands[3],
20363 CONST0_RTX (<MODE>mode),
20368 (define_insn "vpshrdv_<mode>_maskz_1"
20369 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
20370 (vec_merge:VI248_AVX512VL
20371 (unspec:VI248_AVX512VL
20372 [(match_operand:VI248_AVX512VL 1 "register_operand" "0")
20373 (match_operand:VI248_AVX512VL 2 "register_operand" "v")
20374 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand" "vm")]
20376 (match_operand:VI248_AVX512VL 4 "const0_operand" "C")
20377 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
20378 "TARGET_AVX512VBMI2"
20379 "vpshrdv<ssemodesuffix>\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
20380 [(set_attr ("prefix") ("evex"))
20381 (set_attr "mode" "<sseinsnmode>")])
20383 (define_insn "vpshldv_<mode>"
20384 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
20385 (unspec:VI248_AVX512VL
20386 [(match_operand:VI248_AVX512VL 1 "register_operand" "0")
20387 (match_operand:VI248_AVX512VL 2 "register_operand" "v")
20388 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand" "vm")]
20390 "TARGET_AVX512VBMI2"
20391 "vpshldv<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3 }"
20392 [(set_attr ("prefix") ("evex"))
20393 (set_attr "mode" "<sseinsnmode>")])
20395 (define_insn "vpshldv_<mode>_mask"
20396 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
20397 (vec_merge:VI248_AVX512VL
20398 (unspec:VI248_AVX512VL
20399 [(match_operand:VI248_AVX512VL 1 "register_operand" "0")
20400 (match_operand:VI248_AVX512VL 2 "register_operand" "v")
20401 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand" "vm")]
20404 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
20405 "TARGET_AVX512VBMI2"
20406 "vpshldv<ssemodesuffix>\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
20407 [(set_attr ("prefix") ("evex"))
20408 (set_attr "mode" "<sseinsnmode>")])
20410 (define_expand "vpshldv_<mode>_maskz"
20411 [(match_operand:VI248_AVX512VL 0 "register_operand")
20412 (match_operand:VI248_AVX512VL 1 "register_operand")
20413 (match_operand:VI248_AVX512VL 2 "register_operand")
20414 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand")
20415 (match_operand:<avx512fmaskmode> 4 "register_operand")]
20416 "TARGET_AVX512VBMI2"
20418 emit_insn (gen_vpshldv_<mode>_maskz_1 (operands[0], operands[1],
20419 operands[2], operands[3],
20420 CONST0_RTX (<MODE>mode),
20425 (define_insn "vpshldv_<mode>_maskz_1"
20426 [(set (match_operand:VI248_AVX512VL 0 "register_operand" "=v")
20427 (vec_merge:VI248_AVX512VL
20428 (unspec:VI248_AVX512VL
20429 [(match_operand:VI248_AVX512VL 1 "register_operand" "0")
20430 (match_operand:VI248_AVX512VL 2 "register_operand" "v")
20431 (match_operand:VI248_AVX512VL 3 "nonimmediate_operand" "vm")]
20433 (match_operand:VI248_AVX512VL 4 "const0_operand" "C")
20434 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
20435 "TARGET_AVX512VBMI2"
20436 "vpshldv<ssemodesuffix>\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
20437 [(set_attr ("prefix") ("evex"))
20438 (set_attr "mode" "<sseinsnmode>")])
20440 (define_insn "vpdpbusd_<mode>"
20441 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20442 (unspec:VI4_AVX512VL
20443 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20444 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20445 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20446 UNSPEC_VPMADDUBSWACCD))]
20447 "TARGET_AVX512VNNI"
20448 "vpdpbusd\t{%3, %2, %0|%0, %2, %3 }"
20449 [(set_attr ("prefix") ("evex"))])
20451 (define_insn "vpdpbusd_<mode>_mask"
20452 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20453 (vec_merge:VI4_AVX512VL
20454 (unspec:VI4_AVX512VL
20455 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20456 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20457 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20458 UNSPEC_VPMADDUBSWACCD)
20460 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
20461 "TARGET_AVX512VNNI"
20462 "vpdpbusd\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
20463 [(set_attr ("prefix") ("evex"))])
20465 (define_expand "vpdpbusd_<mode>_maskz"
20466 [(match_operand:VI4_AVX512VL 0 "register_operand")
20467 (match_operand:VI4_AVX512VL 1 "register_operand")
20468 (match_operand:VI4_AVX512VL 2 "register_operand")
20469 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand")
20470 (match_operand:<avx512fmaskmode> 4 "register_operand")]
20471 "TARGET_AVX512VNNI"
20473 emit_insn (gen_vpdpbusd_<mode>_maskz_1 (operands[0], operands[1],
20474 operands[2], operands[3],
20475 CONST0_RTX (<MODE>mode),
20480 (define_insn "vpdpbusd_<mode>_maskz_1"
20481 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20482 (vec_merge:VI4_AVX512VL
20483 (unspec:VI4_AVX512VL
20484 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20485 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20486 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")
20487 ] UNSPEC_VPMADDUBSWACCD)
20488 (match_operand:VI4_AVX512VL 4 "const0_operand" "C")
20489 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
20490 "TARGET_AVX512VNNI"
20491 "vpdpbusd\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
20492 [(set_attr ("prefix") ("evex"))])
20495 (define_insn "vpdpbusds_<mode>"
20496 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20497 (unspec:VI4_AVX512VL
20498 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20499 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20500 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20501 UNSPEC_VPMADDUBSWACCSSD))]
20502 "TARGET_AVX512VNNI"
20503 "vpdpbusds\t{%3, %2, %0|%0, %2, %3 }"
20504 [(set_attr ("prefix") ("evex"))])
20506 (define_insn "vpdpbusds_<mode>_mask"
20507 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20508 (vec_merge:VI4_AVX512VL
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_VPMADDUBSWACCSSD)
20515 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
20516 "TARGET_AVX512VNNI"
20517 "vpdpbusds\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
20518 [(set_attr ("prefix") ("evex"))])
20520 (define_expand "vpdpbusds_<mode>_maskz"
20521 [(match_operand:VI4_AVX512VL 0 "register_operand")
20522 (match_operand:VI4_AVX512VL 1 "register_operand")
20523 (match_operand:VI4_AVX512VL 2 "register_operand")
20524 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand")
20525 (match_operand:<avx512fmaskmode> 4 "register_operand")]
20526 "TARGET_AVX512VNNI"
20528 emit_insn (gen_vpdpbusds_<mode>_maskz_1 (operands[0], operands[1],
20529 operands[2], operands[3],
20530 CONST0_RTX (<MODE>mode),
20535 (define_insn "vpdpbusds_<mode>_maskz_1"
20536 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20537 (vec_merge:VI4_AVX512VL
20538 (unspec:VI4_AVX512VL
20539 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20540 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20541 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20542 UNSPEC_VPMADDUBSWACCSSD)
20543 (match_operand:VI4_AVX512VL 4 "const0_operand" "C")
20544 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
20545 "TARGET_AVX512VNNI"
20546 "vpdpbusds\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
20547 [(set_attr ("prefix") ("evex"))])
20550 (define_insn "vpdpwssd_<mode>"
20551 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20552 (unspec:VI4_AVX512VL
20553 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20554 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20555 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20556 UNSPEC_VPMADDWDACCD))]
20557 "TARGET_AVX512VNNI"
20558 "vpdpwssd\t{%3, %2, %0|%0, %2, %3 }"
20559 [(set_attr ("prefix") ("evex"))])
20561 (define_insn "vpdpwssd_<mode>_mask"
20562 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20563 (vec_merge:VI4_AVX512VL
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_VPMADDWDACCD)
20570 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
20571 "TARGET_AVX512VNNI"
20572 "vpdpwssd\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
20573 [(set_attr ("prefix") ("evex"))])
20575 (define_expand "vpdpwssd_<mode>_maskz"
20576 [(match_operand:VI4_AVX512VL 0 "register_operand")
20577 (match_operand:VI4_AVX512VL 1 "register_operand")
20578 (match_operand:VI4_AVX512VL 2 "register_operand")
20579 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand")
20580 (match_operand:<avx512fmaskmode> 4 "register_operand")]
20581 "TARGET_AVX512VNNI"
20583 emit_insn (gen_vpdpwssd_<mode>_maskz_1 (operands[0], operands[1],
20584 operands[2], operands[3],
20585 CONST0_RTX (<MODE>mode),
20590 (define_insn "vpdpwssd_<mode>_maskz_1"
20591 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20592 (vec_merge:VI4_AVX512VL
20593 (unspec:VI4_AVX512VL
20594 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20595 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20596 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20597 UNSPEC_VPMADDWDACCD)
20598 (match_operand:VI4_AVX512VL 4 "const0_operand" "C")
20599 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
20600 "TARGET_AVX512VNNI"
20601 "vpdpwssd\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
20602 [(set_attr ("prefix") ("evex"))])
20605 (define_insn "vpdpwssds_<mode>"
20606 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20607 (unspec:VI4_AVX512VL
20608 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20609 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20610 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20611 UNSPEC_VPMADDWDACCSSD))]
20612 "TARGET_AVX512VNNI"
20613 "vpdpwssds\t{%3, %2, %0|%0, %2, %3 }"
20614 [(set_attr ("prefix") ("evex"))])
20616 (define_insn "vpdpwssds_<mode>_mask"
20617 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20618 (vec_merge:VI4_AVX512VL
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_VPMADDWDACCSSD)
20625 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
20626 "TARGET_AVX512VNNI"
20627 "vpdpwssds\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
20628 [(set_attr ("prefix") ("evex"))])
20630 (define_expand "vpdpwssds_<mode>_maskz"
20631 [(match_operand:VI4_AVX512VL 0 "register_operand")
20632 (match_operand:VI4_AVX512VL 1 "register_operand")
20633 (match_operand:VI4_AVX512VL 2 "register_operand")
20634 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand")
20635 (match_operand:<avx512fmaskmode> 4 "register_operand")]
20636 "TARGET_AVX512VNNI"
20638 emit_insn (gen_vpdpwssds_<mode>_maskz_1 (operands[0], operands[1],
20639 operands[2], operands[3],
20640 CONST0_RTX (<MODE>mode),
20645 (define_insn "vpdpwssds_<mode>_maskz_1"
20646 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20647 (vec_merge:VI4_AVX512VL
20648 (unspec:VI4_AVX512VL
20649 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20650 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20651 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")]
20652 UNSPEC_VPMADDWDACCSSD)
20653 (match_operand:VI4_AVX512VL 4 "const0_operand" "C")
20654 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
20655 "TARGET_AVX512VNNI"
20656 "vpdpwssds\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
20657 [(set_attr ("prefix") ("evex"))])
20659 (define_insn "vaesdec_<mode>"
20660 [(set (match_operand:VI1_AVX512VL_F 0 "register_operand" "=v")
20661 (unspec:VI1_AVX512VL_F
20662 [(match_operand:VI1_AVX512VL_F 1 "register_operand" "v")
20663 (match_operand:VI1_AVX512VL_F 2 "vector_operand" "v")]
20666 "vaesdec\t{%2, %1, %0|%0, %1, %2}"
20669 (define_insn "vaesdeclast_<mode>"
20670 [(set (match_operand:VI1_AVX512VL_F 0 "register_operand" "=v")
20671 (unspec:VI1_AVX512VL_F
20672 [(match_operand:VI1_AVX512VL_F 1 "register_operand" "v")
20673 (match_operand:VI1_AVX512VL_F 2 "vector_operand" "v")]
20674 UNSPEC_VAESDECLAST))]
20676 "vaesdeclast\t{%2, %1, %0|%0, %1, %2}"
20679 (define_insn "vaesenc_<mode>"
20680 [(set (match_operand:VI1_AVX512VL_F 0 "register_operand" "=v")
20681 (unspec:VI1_AVX512VL_F
20682 [(match_operand:VI1_AVX512VL_F 1 "register_operand" "v")
20683 (match_operand:VI1_AVX512VL_F 2 "vector_operand" "vm")]
20686 "vaesenc\t{%2, %1, %0|%0, %1, %2}"
20689 (define_insn "vaesenclast_<mode>"
20690 [(set (match_operand:VI1_AVX512VL_F 0 "register_operand" "=v")
20691 (unspec:VI1_AVX512VL_F
20692 [(match_operand:VI1_AVX512VL_F 1 "register_operand" "v")
20693 (match_operand:VI1_AVX512VL_F 2 "vector_operand" "vm")]
20694 UNSPEC_VAESENCLAST))]
20696 "vaesenclast\t{%2, %1, %0|%0, %1, %2}"
20699 (define_insn "vpclmulqdq_<mode>"
20700 [(set (match_operand:VI8_FVL 0 "register_operand" "=v")
20701 (unspec:VI8_FVL [(match_operand:VI8_FVL 1 "register_operand" "v")
20702 (match_operand:VI8_FVL 2 "vector_operand" "vm")
20703 (match_operand:SI 3 "const_0_to_255_operand" "n")]
20704 UNSPEC_VPCLMULQDQ))]
20705 "TARGET_VPCLMULQDQ"
20706 "vpclmulqdq\t{%3, %2, %1, %0|%0, %1, %2, %3}"
20707 [(set_attr "mode" "DI")])
20709 (define_insn "avx512vl_vpshufbitqmb<mode><mask_scalar_merge_name>"
20710 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
20711 (unspec:<avx512fmaskmode>
20712 [(match_operand:VI1_AVX512VLBW 1 "register_operand" "v")
20713 (match_operand:VI1_AVX512VLBW 2 "nonimmediate_operand" "vm")]
20714 UNSPEC_VPSHUFBIT))]
20715 "TARGET_AVX512BITALG"
20716 "vpshufbitqmb\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
20717 [(set_attr "prefix" "evex")
20718 (set_attr "mode" "<sseinsnmode>")])