1 ;; GCC machine description for SSE instructions
2 ;; Copyright (C) 2005-2017 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
177 (define_c_enum "unspecv" [
187 ;; All vector modes including V?TImode, used in move patterns.
188 (define_mode_iterator VMOVE
189 [(V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI
190 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX") V8HI
191 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
192 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI
193 (V4TI "TARGET_AVX512F") (V2TI "TARGET_AVX") V1TI
194 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
195 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") V2DF])
197 ;; All AVX-512{F,VL} vector modes. Supposed TARGET_AVX512F baseline.
198 (define_mode_iterator V48_AVX512VL
199 [V16SI (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")
200 V8DI (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")
201 V16SF (V8SF "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
202 V8DF (V4DF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
204 ;; 1,2 byte AVX-512{BW,VL} vector modes. Supposed TARGET_AVX512BW baseline.
205 (define_mode_iterator VI12_AVX512VL
206 [V64QI (V16QI "TARGET_AVX512VL") (V32QI "TARGET_AVX512VL")
207 V32HI (V16HI "TARGET_AVX512VL") (V8HI "TARGET_AVX512VL")])
209 ;; Same iterator, but without supposed TARGET_AVX512BW
210 (define_mode_iterator VI12_AVX512VLBW
211 [(V64QI "TARGET_AVX512BW") (V16QI "TARGET_AVX512VL")
212 (V32QI "TARGET_AVX512VL && TARGET_AVX512BW") (V32HI "TARGET_AVX512BW")
213 (V16HI "TARGET_AVX512VL") (V8HI "TARGET_AVX512VL")])
215 (define_mode_iterator VI1_AVX512VL
216 [V64QI (V16QI "TARGET_AVX512VL") (V32QI "TARGET_AVX512VL")])
219 (define_mode_iterator V
220 [(V32QI "TARGET_AVX") V16QI
221 (V16HI "TARGET_AVX") V8HI
222 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
223 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI
224 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
225 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
227 ;; All 128bit vector modes
228 (define_mode_iterator V_128
229 [V16QI V8HI V4SI V2DI V4SF (V2DF "TARGET_SSE2")])
231 ;; All 256bit vector modes
232 (define_mode_iterator V_256
233 [V32QI V16HI V8SI V4DI V8SF V4DF])
235 ;; All 512bit vector modes
236 (define_mode_iterator V_512 [V64QI V32HI V16SI V8DI V16SF V8DF])
238 ;; All 256bit and 512bit vector modes
239 (define_mode_iterator V_256_512
240 [V32QI V16HI V8SI V4DI V8SF V4DF
241 (V64QI "TARGET_AVX512F") (V32HI "TARGET_AVX512F") (V16SI "TARGET_AVX512F")
242 (V8DI "TARGET_AVX512F") (V16SF "TARGET_AVX512F") (V8DF "TARGET_AVX512F")])
244 ;; All vector float modes
245 (define_mode_iterator VF
246 [(V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
247 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
249 ;; 128- and 256-bit float vector modes
250 (define_mode_iterator VF_128_256
251 [(V8SF "TARGET_AVX") V4SF
252 (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
254 ;; All SFmode vector float modes
255 (define_mode_iterator VF1
256 [(V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF])
258 ;; 128- and 256-bit SF vector modes
259 (define_mode_iterator VF1_128_256
260 [(V8SF "TARGET_AVX") V4SF])
262 (define_mode_iterator VF1_128_256VL
263 [V8SF (V4SF "TARGET_AVX512VL")])
265 ;; All DFmode vector float modes
266 (define_mode_iterator VF2
267 [(V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") V2DF])
269 ;; 128- and 256-bit DF vector modes
270 (define_mode_iterator VF2_128_256
271 [(V4DF "TARGET_AVX") V2DF])
273 (define_mode_iterator VF2_512_256
274 [(V8DF "TARGET_AVX512F") V4DF])
276 (define_mode_iterator VF2_512_256VL
277 [V8DF (V4DF "TARGET_AVX512VL")])
279 ;; All 128bit vector float modes
280 (define_mode_iterator VF_128
281 [V4SF (V2DF "TARGET_SSE2")])
283 ;; All 256bit vector float modes
284 (define_mode_iterator VF_256
287 ;; All 512bit vector float modes
288 (define_mode_iterator VF_512
291 (define_mode_iterator VI48_AVX512VL
292 [V16SI (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")
293 V8DI (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")])
295 (define_mode_iterator VF_AVX512VL
296 [V16SF (V8SF "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
297 V8DF (V4DF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
299 (define_mode_iterator VF2_AVX512VL
300 [V8DF (V4DF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
302 (define_mode_iterator VF1_AVX512VL
303 [V16SF (V8SF "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")])
305 ;; All vector integer modes
306 (define_mode_iterator VI
307 [(V16SI "TARGET_AVX512F") (V8DI "TARGET_AVX512F")
308 (V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX") V16QI
309 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX") V8HI
310 (V8SI "TARGET_AVX") V4SI
311 (V4DI "TARGET_AVX") V2DI])
313 (define_mode_iterator VI_AVX2
314 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI
315 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI
316 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX2") V4SI
317 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX2") V2DI])
319 ;; All QImode vector integer modes
320 (define_mode_iterator VI1
321 [(V32QI "TARGET_AVX") V16QI])
323 ;; All DImode vector integer modes
324 (define_mode_iterator V_AVX
325 [V16QI V8HI V4SI V2DI V4SF V2DF
326 (V32QI "TARGET_AVX") (V16HI "TARGET_AVX")
327 (V8SI "TARGET_AVX") (V4DI "TARGET_AVX")
328 (V8SF "TARGET_AVX") (V4DF"TARGET_AVX")])
330 (define_mode_iterator VI48_AVX
332 (V8SI "TARGET_AVX") (V4DI "TARGET_AVX")])
334 (define_mode_iterator VI8
335 [(V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI])
337 (define_mode_iterator VI8_AVX512VL
338 [V8DI (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")])
340 (define_mode_iterator VI8_256_512
341 [V8DI (V4DI "TARGET_AVX512VL")])
343 (define_mode_iterator VI1_AVX2
344 [(V32QI "TARGET_AVX2") V16QI])
346 (define_mode_iterator VI1_AVX512
347 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI])
349 (define_mode_iterator VI1_AVX512F
350 [(V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI])
352 (define_mode_iterator VI2_AVX2
353 [(V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI])
355 (define_mode_iterator VI2_AVX512F
356 [(V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX2") V8HI])
358 (define_mode_iterator VI4_AVX
359 [(V8SI "TARGET_AVX") V4SI])
361 (define_mode_iterator VI4_AVX2
362 [(V8SI "TARGET_AVX2") V4SI])
364 (define_mode_iterator VI4_AVX512F
365 [(V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX2") V4SI])
367 (define_mode_iterator VI4_AVX512VL
368 [V16SI (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")])
370 (define_mode_iterator VI48_AVX512F_AVX512VL
371 [V4SI V8SI (V16SI "TARGET_AVX512F")
372 (V2DI "TARGET_AVX512VL") (V4DI "TARGET_AVX512VL") (V8DI "TARGET_AVX512F")])
374 (define_mode_iterator VI2_AVX512VL
375 [(V8HI "TARGET_AVX512VL") (V16HI "TARGET_AVX512VL") V32HI])
377 (define_mode_iterator VI8_AVX2_AVX512BW
378 [(V8DI "TARGET_AVX512BW") (V4DI "TARGET_AVX2") V2DI])
380 (define_mode_iterator VI8_AVX2
381 [(V4DI "TARGET_AVX2") V2DI])
383 (define_mode_iterator VI8_AVX2_AVX512F
384 [(V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX2") V2DI])
386 (define_mode_iterator VI4_128_8_256
390 (define_mode_iterator V8FI
394 (define_mode_iterator V16FI
397 ;; ??? We should probably use TImode instead.
398 (define_mode_iterator VIMAX_AVX2_AVX512BW
399 [(V4TI "TARGET_AVX512BW") (V2TI "TARGET_AVX2") V1TI])
401 ;; Suppose TARGET_AVX512BW as baseline
402 (define_mode_iterator VIMAX_AVX512VL
403 [V4TI (V2TI "TARGET_AVX512VL") (V1TI "TARGET_AVX512VL")])
405 (define_mode_iterator VIMAX_AVX2
406 [(V2TI "TARGET_AVX2") V1TI])
408 ;; ??? This should probably be dropped in favor of VIMAX_AVX2_AVX512BW.
409 (define_mode_iterator SSESCALARMODE
410 [(V4TI "TARGET_AVX512BW") (V2TI "TARGET_AVX2") TI])
412 (define_mode_iterator VI12_AVX2
413 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI
414 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI])
416 (define_mode_iterator VI24_AVX2
417 [(V16HI "TARGET_AVX2") V8HI
418 (V8SI "TARGET_AVX2") V4SI])
420 (define_mode_iterator VI124_AVX2_24_AVX512F_1_AVX512BW
421 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI
422 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX2") V8HI
423 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX2") V4SI])
425 (define_mode_iterator VI124_AVX2
426 [(V32QI "TARGET_AVX2") V16QI
427 (V16HI "TARGET_AVX2") V8HI
428 (V8SI "TARGET_AVX2") V4SI])
430 (define_mode_iterator VI2_AVX2_AVX512BW
431 [(V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI])
433 (define_mode_iterator VI248_VLBW
434 [(V32HI "TARGET_AVX512BW") V16SI V8DI
435 (V16HI "TARGET_AVX512VL") (V8SI "TARGET_AVX512VL")
436 (V4DI "TARGET_AVX512VL") (V8HI "TARGET_AVX512VL")
437 (V4SI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")])
439 (define_mode_iterator VI48_AVX2
440 [(V8SI "TARGET_AVX2") V4SI
441 (V4DI "TARGET_AVX2") V2DI])
443 (define_mode_iterator VI248_AVX2
444 [(V16HI "TARGET_AVX2") V8HI
445 (V8SI "TARGET_AVX2") V4SI
446 (V4DI "TARGET_AVX2") V2DI])
448 (define_mode_iterator VI248_AVX2_8_AVX512F_24_AVX512BW
449 [(V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI
450 (V16SI "TARGET_AVX512BW") (V8SI "TARGET_AVX2") V4SI
451 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX2") V2DI])
453 (define_mode_iterator VI248_AVX512BW
454 [(V32HI "TARGET_AVX512BW") V16SI V8DI])
456 (define_mode_iterator VI248_AVX512BW_AVX512VL
457 [(V32HI "TARGET_AVX512BW")
458 (V4DI "TARGET_AVX512VL") V16SI V8DI])
460 ;; Suppose TARGET_AVX512VL as baseline
461 (define_mode_iterator VI248_AVX512BW_1
462 [(V16HI "TARGET_AVX512BW") (V8HI "TARGET_AVX512BW")
466 (define_mode_iterator VI248_AVX512BW_2
467 [(V16HI "TARGET_AVX512BW") (V8HI "TARGET_AVX512BW")
471 (define_mode_iterator VI48_AVX512F
472 [(V16SI "TARGET_AVX512F") V8SI V4SI
473 (V8DI "TARGET_AVX512F") V4DI V2DI])
475 (define_mode_iterator VI48_AVX_AVX512F
476 [(V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
477 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI])
479 (define_mode_iterator VI12_AVX_AVX512F
480 [ (V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI
481 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX") V8HI])
483 (define_mode_iterator V48_AVX2
486 (V4SI "TARGET_AVX2") (V2DI "TARGET_AVX2")
487 (V8SI "TARGET_AVX2") (V4DI "TARGET_AVX2")])
489 (define_mode_attr avx512
490 [(V16QI "avx512vl") (V32QI "avx512vl") (V64QI "avx512bw")
491 (V8HI "avx512vl") (V16HI "avx512vl") (V32HI "avx512bw")
492 (V4SI "avx512vl") (V8SI "avx512vl") (V16SI "avx512f")
493 (V2DI "avx512vl") (V4DI "avx512vl") (V8DI "avx512f")
494 (V4SF "avx512vl") (V8SF "avx512vl") (V16SF "avx512f")
495 (V2DF "avx512vl") (V4DF "avx512vl") (V8DF "avx512f")])
497 (define_mode_attr sse2_avx_avx512f
498 [(V16QI "sse2") (V32QI "avx") (V64QI "avx512f")
499 (V8HI "avx512vl") (V16HI "avx512vl") (V32HI "avx512bw")
500 (V4SI "sse2") (V8SI "avx") (V16SI "avx512f")
501 (V2DI "avx512vl") (V4DI "avx512vl") (V8DI "avx512f")
502 (V16SF "avx512f") (V8SF "avx") (V4SF "avx")
503 (V8DF "avx512f") (V4DF "avx") (V2DF "avx")])
505 (define_mode_attr sse2_avx2
506 [(V16QI "sse2") (V32QI "avx2") (V64QI "avx512bw")
507 (V8HI "sse2") (V16HI "avx2") (V32HI "avx512bw")
508 (V4SI "sse2") (V8SI "avx2") (V16SI "avx512f")
509 (V2DI "sse2") (V4DI "avx2") (V8DI "avx512f")
510 (V1TI "sse2") (V2TI "avx2") (V4TI "avx512bw")])
512 (define_mode_attr ssse3_avx2
513 [(V16QI "ssse3") (V32QI "avx2") (V64QI "avx512bw")
514 (V4HI "ssse3") (V8HI "ssse3") (V16HI "avx2") (V32HI "avx512bw")
515 (V4SI "ssse3") (V8SI "avx2")
516 (V2DI "ssse3") (V4DI "avx2")
517 (TI "ssse3") (V2TI "avx2") (V4TI "avx512bw")])
519 (define_mode_attr sse4_1_avx2
520 [(V16QI "sse4_1") (V32QI "avx2") (V64QI "avx512bw")
521 (V8HI "sse4_1") (V16HI "avx2") (V32HI "avx512bw")
522 (V4SI "sse4_1") (V8SI "avx2") (V16SI "avx512f")
523 (V2DI "sse4_1") (V4DI "avx2") (V8DI "avx512dq")])
525 (define_mode_attr avx_avx2
526 [(V4SF "avx") (V2DF "avx")
527 (V8SF "avx") (V4DF "avx")
528 (V4SI "avx2") (V2DI "avx2")
529 (V8SI "avx2") (V4DI "avx2")])
531 (define_mode_attr vec_avx2
532 [(V16QI "vec") (V32QI "avx2")
533 (V8HI "vec") (V16HI "avx2")
534 (V4SI "vec") (V8SI "avx2")
535 (V2DI "vec") (V4DI "avx2")])
537 (define_mode_attr avx2_avx512
538 [(V4SI "avx2") (V8SI "avx2") (V16SI "avx512f")
539 (V2DI "avx2") (V4DI "avx2") (V8DI "avx512f")
540 (V4SF "avx2") (V8SF "avx2") (V16SF "avx512f")
541 (V2DF "avx2") (V4DF "avx2") (V8DF "avx512f")
542 (V8HI "avx512vl") (V16HI "avx512vl") (V32HI "avx512bw")])
544 (define_mode_attr shuffletype
545 [(V16SF "f") (V16SI "i") (V8DF "f") (V8DI "i")
546 (V8SF "f") (V8SI "i") (V4DF "f") (V4DI "i")
547 (V4SF "f") (V4SI "i") (V2DF "f") (V2DI "i")
548 (V32HI "i") (V16HI "i") (V8HI "i")
549 (V64QI "i") (V32QI "i") (V16QI "i")
550 (V4TI "i") (V2TI "i") (V1TI "i")])
552 (define_mode_attr ssequartermode
553 [(V16SF "V4SF") (V8DF "V2DF") (V16SI "V4SI") (V8DI "V2DI")])
555 (define_mode_attr ssedoublemodelower
556 [(V16QI "v16hi") (V32QI "v32hi") (V64QI "v64hi")
557 (V8HI "v8si") (V16HI "v16si") (V32HI "v32si")
558 (V4SI "v4di") (V8SI "v8di") (V16SI "v16di")])
560 (define_mode_attr ssedoublemode
561 [(V4SF "V8SF") (V8SF "V16SF") (V16SF "V32SF")
562 (V2DF "V4DF") (V4DF "V8DF") (V8DF "V16DF")
563 (V16QI "V16HI") (V32QI "V32HI") (V64QI "V64HI")
564 (V4HI "V4SI") (V8HI "V8SI") (V16HI "V16SI") (V32HI "V32SI")
565 (V4SI "V4DI") (V8SI "V16SI") (V16SI "V32SI")
566 (V4DI "V8DI") (V8DI "V16DI")])
568 (define_mode_attr ssebytemode
569 [(V8DI "V64QI") (V4DI "V32QI") (V2DI "V16QI")])
571 ;; All 128bit vector integer modes
572 (define_mode_iterator VI_128 [V16QI V8HI V4SI V2DI])
574 ;; All 256bit vector integer modes
575 (define_mode_iterator VI_256 [V32QI V16HI V8SI V4DI])
577 ;; Various 128bit vector integer mode combinations
578 (define_mode_iterator VI12_128 [V16QI V8HI])
579 (define_mode_iterator VI14_128 [V16QI V4SI])
580 (define_mode_iterator VI124_128 [V16QI V8HI V4SI])
581 (define_mode_iterator VI24_128 [V8HI V4SI])
582 (define_mode_iterator VI248_128 [V8HI V4SI V2DI])
583 (define_mode_iterator VI48_128 [V4SI V2DI])
585 ;; Various 256bit and 512 vector integer mode combinations
586 (define_mode_iterator VI124_256 [V32QI V16HI V8SI])
587 (define_mode_iterator VI124_256_AVX512F_AVX512BW
589 (V64QI "TARGET_AVX512BW")
590 (V32HI "TARGET_AVX512BW")
591 (V16SI "TARGET_AVX512F")])
592 (define_mode_iterator VI48_256 [V8SI V4DI])
593 (define_mode_iterator VI48_512 [V16SI V8DI])
594 (define_mode_iterator VI4_256_8_512 [V8SI V8DI])
595 (define_mode_iterator VI_AVX512BW
596 [V16SI V8DI (V32HI "TARGET_AVX512BW") (V64QI "TARGET_AVX512BW")])
598 ;; Int-float size matches
599 (define_mode_iterator VI4F_128 [V4SI V4SF])
600 (define_mode_iterator VI8F_128 [V2DI V2DF])
601 (define_mode_iterator VI4F_256 [V8SI V8SF])
602 (define_mode_iterator VI8F_256 [V4DI V4DF])
603 (define_mode_iterator VI48F_256_512
605 (V16SI "TARGET_AVX512F") (V16SF "TARGET_AVX512F")
606 (V8DI "TARGET_AVX512F") (V8DF "TARGET_AVX512F")
607 (V4DI "TARGET_AVX512VL") (V4DF "TARGET_AVX512VL")])
608 (define_mode_iterator VF48_I1248
609 [V16SI V16SF V8DI V8DF V32HI V64QI])
610 (define_mode_iterator VI48F
611 [V16SI V16SF V8DI V8DF
612 (V8SI "TARGET_AVX512VL") (V8SF "TARGET_AVX512VL")
613 (V4DI "TARGET_AVX512VL") (V4DF "TARGET_AVX512VL")
614 (V4SI "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
615 (V2DI "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
616 (define_mode_iterator VI48F_256 [V8SI V8SF V4DI V4DF])
618 ;; Mapping from float mode to required SSE level
619 (define_mode_attr sse
620 [(SF "sse") (DF "sse2")
621 (V4SF "sse") (V2DF "sse2")
622 (V16SF "avx512f") (V8SF "avx")
623 (V8DF "avx512f") (V4DF "avx")])
625 (define_mode_attr sse2
626 [(V16QI "sse2") (V32QI "avx") (V64QI "avx512f")
627 (V2DI "sse2") (V4DI "avx") (V8DI "avx512f")])
629 (define_mode_attr sse3
630 [(V16QI "sse3") (V32QI "avx")])
632 (define_mode_attr sse4_1
633 [(V4SF "sse4_1") (V2DF "sse4_1")
634 (V8SF "avx") (V4DF "avx")
636 (V4DI "avx") (V2DI "sse4_1")
637 (V8SI "avx") (V4SI "sse4_1")
638 (V16QI "sse4_1") (V32QI "avx")
639 (V8HI "sse4_1") (V16HI "avx")])
641 (define_mode_attr avxsizesuffix
642 [(V64QI "512") (V32HI "512") (V16SI "512") (V8DI "512")
643 (V32QI "256") (V16HI "256") (V8SI "256") (V4DI "256")
644 (V16QI "") (V8HI "") (V4SI "") (V2DI "")
645 (V16SF "512") (V8DF "512")
646 (V8SF "256") (V4DF "256")
647 (V4SF "") (V2DF "")])
649 ;; SSE instruction mode
650 (define_mode_attr sseinsnmode
651 [(V64QI "XI") (V32HI "XI") (V16SI "XI") (V8DI "XI") (V4TI "XI")
652 (V32QI "OI") (V16HI "OI") (V8SI "OI") (V4DI "OI") (V2TI "OI")
653 (V16QI "TI") (V8HI "TI") (V4SI "TI") (V2DI "TI") (V1TI "TI")
654 (V16SF "V16SF") (V8DF "V8DF")
655 (V8SF "V8SF") (V4DF "V4DF")
656 (V4SF "V4SF") (V2DF "V2DF")
659 ;; Mapping of vector modes to corresponding mask size
660 (define_mode_attr avx512fmaskmode
661 [(V64QI "DI") (V32QI "SI") (V16QI "HI")
662 (V32HI "SI") (V16HI "HI") (V8HI "QI") (V4HI "QI")
663 (V16SI "HI") (V8SI "QI") (V4SI "QI")
664 (V8DI "QI") (V4DI "QI") (V2DI "QI")
665 (V16SF "HI") (V8SF "QI") (V4SF "QI")
666 (V8DF "QI") (V4DF "QI") (V2DF "QI")])
668 ;; Mapping of vector modes to corresponding mask size
669 (define_mode_attr avx512fmaskmodelower
670 [(V64QI "di") (V32QI "si") (V16QI "hi")
671 (V32HI "si") (V16HI "hi") (V8HI "qi") (V4HI "qi")
672 (V16SI "hi") (V8SI "qi") (V4SI "qi")
673 (V8DI "qi") (V4DI "qi") (V2DI "qi")
674 (V16SF "hi") (V8SF "qi") (V4SF "qi")
675 (V8DF "qi") (V4DF "qi") (V2DF "qi")])
677 ;; Mapping of vector float modes to an integer mode of the same size
678 (define_mode_attr sseintvecmode
679 [(V16SF "V16SI") (V8DF "V8DI")
680 (V8SF "V8SI") (V4DF "V4DI")
681 (V4SF "V4SI") (V2DF "V2DI")
682 (V16SI "V16SI") (V8DI "V8DI")
683 (V8SI "V8SI") (V4DI "V4DI")
684 (V4SI "V4SI") (V2DI "V2DI")
685 (V16HI "V16HI") (V8HI "V8HI")
686 (V32HI "V32HI") (V64QI "V64QI")
687 (V32QI "V32QI") (V16QI "V16QI")])
689 (define_mode_attr sseintvecmode2
690 [(V8DF "XI") (V4DF "OI") (V2DF "TI")
691 (V8SF "OI") (V4SF "TI")])
693 (define_mode_attr sseintvecmodelower
694 [(V16SF "v16si") (V8DF "v8di")
695 (V8SF "v8si") (V4DF "v4di")
696 (V4SF "v4si") (V2DF "v2di")
697 (V8SI "v8si") (V4DI "v4di")
698 (V4SI "v4si") (V2DI "v2di")
699 (V16HI "v16hi") (V8HI "v8hi")
700 (V32QI "v32qi") (V16QI "v16qi")])
702 ;; Mapping of vector modes to a vector mode of double size
703 (define_mode_attr ssedoublevecmode
704 [(V32QI "V64QI") (V16HI "V32HI") (V8SI "V16SI") (V4DI "V8DI")
705 (V16QI "V32QI") (V8HI "V16HI") (V4SI "V8SI") (V2DI "V4DI")
706 (V8SF "V16SF") (V4DF "V8DF")
707 (V4SF "V8SF") (V2DF "V4DF")])
709 ;; Mapping of vector modes to a vector mode of half size
710 (define_mode_attr ssehalfvecmode
711 [(V64QI "V32QI") (V32HI "V16HI") (V16SI "V8SI") (V8DI "V4DI") (V4TI "V2TI")
712 (V32QI "V16QI") (V16HI "V8HI") (V8SI "V4SI") (V4DI "V2DI")
713 (V16QI "V8QI") (V8HI "V4HI") (V4SI "V2SI")
714 (V16SF "V8SF") (V8DF "V4DF")
715 (V8SF "V4SF") (V4DF "V2DF")
718 (define_mode_attr ssehalfvecmodelower
719 [(V64QI "v32qi") (V32HI "v16hi") (V16SI "v8si") (V8DI "v4di") (V4TI "v2ti")
720 (V32QI "v16qi") (V16HI "v8hi") (V8SI "v4si") (V4DI "v2di")
721 (V16QI "v8qi") (V8HI "v4hi") (V4SI "v2si")
722 (V16SF "v8sf") (V8DF "v4df")
723 (V8SF "v4sf") (V4DF "v2df")
726 ;; Mapping of vector modes ti packed single mode of the same size
727 (define_mode_attr ssePSmode
728 [(V16SI "V16SF") (V8DF "V16SF")
729 (V16SF "V16SF") (V8DI "V16SF")
730 (V64QI "V16SF") (V32QI "V8SF") (V16QI "V4SF")
731 (V32HI "V16SF") (V16HI "V8SF") (V8HI "V4SF")
732 (V8SI "V8SF") (V4SI "V4SF")
733 (V4DI "V8SF") (V2DI "V4SF")
734 (V4TI "V16SF") (V2TI "V8SF") (V1TI "V4SF")
735 (V8SF "V8SF") (V4SF "V4SF")
736 (V4DF "V8SF") (V2DF "V4SF")])
738 (define_mode_attr ssePSmode2
739 [(V8DI "V8SF") (V4DI "V4SF")])
741 ;; Mapping of vector modes back to the scalar modes
742 (define_mode_attr ssescalarmode
743 [(V64QI "QI") (V32QI "QI") (V16QI "QI")
744 (V32HI "HI") (V16HI "HI") (V8HI "HI")
745 (V16SI "SI") (V8SI "SI") (V4SI "SI")
746 (V8DI "DI") (V4DI "DI") (V2DI "DI")
747 (V16SF "SF") (V8SF "SF") (V4SF "SF")
748 (V8DF "DF") (V4DF "DF") (V2DF "DF")
749 (V4TI "TI") (V2TI "TI")])
751 ;; Mapping of vector modes back to the scalar modes
752 (define_mode_attr ssescalarmodelower
753 [(V64QI "qi") (V32QI "qi") (V16QI "qi")
754 (V32HI "hi") (V16HI "hi") (V8HI "hi")
755 (V16SI "si") (V8SI "si") (V4SI "si")
756 (V8DI "di") (V4DI "di") (V2DI "di")
757 (V16SF "sf") (V8SF "sf") (V4SF "sf")
758 (V8DF "df") (V4DF "df") (V2DF "df")
759 (V4TI "ti") (V2TI "ti")])
761 ;; Mapping of vector modes to the 128bit modes
762 (define_mode_attr ssexmmmode
763 [(V64QI "V16QI") (V32QI "V16QI") (V16QI "V16QI")
764 (V32HI "V8HI") (V16HI "V8HI") (V8HI "V8HI")
765 (V16SI "V4SI") (V8SI "V4SI") (V4SI "V4SI")
766 (V8DI "V2DI") (V4DI "V2DI") (V2DI "V2DI")
767 (V16SF "V4SF") (V8SF "V4SF") (V4SF "V4SF")
768 (V8DF "V2DF") (V4DF "V2DF") (V2DF "V2DF")])
770 ;; Pointer size override for scalar modes (Intel asm dialect)
771 (define_mode_attr iptr
772 [(V64QI "b") (V32HI "w") (V16SI "k") (V8DI "q")
773 (V32QI "b") (V16HI "w") (V8SI "k") (V4DI "q")
774 (V16QI "b") (V8HI "w") (V4SI "k") (V2DI "q")
775 (V8SF "k") (V4DF "q")
776 (V4SF "k") (V2DF "q")
779 ;; Number of scalar elements in each vector type
780 (define_mode_attr ssescalarnum
781 [(V64QI "64") (V16SI "16") (V8DI "8")
782 (V32QI "32") (V16HI "16") (V8SI "8") (V4DI "4")
783 (V16QI "16") (V8HI "8") (V4SI "4") (V2DI "2")
784 (V16SF "16") (V8DF "8")
785 (V8SF "8") (V4DF "4")
786 (V4SF "4") (V2DF "2")])
788 ;; Mask of scalar elements in each vector type
789 (define_mode_attr ssescalarnummask
790 [(V32QI "31") (V16HI "15") (V8SI "7") (V4DI "3")
791 (V16QI "15") (V8HI "7") (V4SI "3") (V2DI "1")
792 (V8SF "7") (V4DF "3")
793 (V4SF "3") (V2DF "1")])
795 (define_mode_attr ssescalarsize
796 [(V4TI "64") (V2TI "64") (V1TI "64")
797 (V8DI "64") (V4DI "64") (V2DI "64")
798 (V64QI "8") (V32QI "8") (V16QI "8")
799 (V32HI "16") (V16HI "16") (V8HI "16")
800 (V16SI "32") (V8SI "32") (V4SI "32")
801 (V16SF "32") (V8SF "32") (V4SF "32")
802 (V8DF "64") (V4DF "64") (V2DF "64")])
804 ;; SSE prefix for integer vector modes
805 (define_mode_attr sseintprefix
806 [(V2DI "p") (V2DF "")
811 (V16SI "p") (V16SF "")
812 (V16QI "p") (V8HI "p")
813 (V32QI "p") (V16HI "p")
814 (V64QI "p") (V32HI "p")])
816 ;; SSE scalar suffix for vector modes
817 (define_mode_attr ssescalarmodesuffix
819 (V8SF "ss") (V4DF "sd")
820 (V4SF "ss") (V2DF "sd")
821 (V8SI "ss") (V4DI "sd")
824 ;; Pack/unpack vector modes
825 (define_mode_attr sseunpackmode
826 [(V16QI "V8HI") (V8HI "V4SI") (V4SI "V2DI")
827 (V32QI "V16HI") (V16HI "V8SI") (V8SI "V4DI")
828 (V32HI "V16SI") (V64QI "V32HI") (V16SI "V8DI")])
830 (define_mode_attr ssepackmode
831 [(V8HI "V16QI") (V4SI "V8HI") (V2DI "V4SI")
832 (V16HI "V32QI") (V8SI "V16HI") (V4DI "V8SI")
833 (V32HI "V64QI") (V16SI "V32HI") (V8DI "V16SI")])
835 ;; Mapping of the max integer size for xop rotate immediate constraint
836 (define_mode_attr sserotatemax
837 [(V16QI "7") (V8HI "15") (V4SI "31") (V2DI "63")])
839 ;; Mapping of mode to cast intrinsic name
840 (define_mode_attr castmode
841 [(V8SI "si") (V8SF "ps") (V4DF "pd")
842 (V16SI "si") (V16SF "ps") (V8DF "pd")])
844 ;; Instruction suffix for sign and zero extensions.
845 (define_code_attr extsuffix [(sign_extend "sx") (zero_extend "zx")])
847 ;; i128 for integer vectors and TARGET_AVX2, f128 otherwise.
848 ;; i64x4 or f64x4 for 512bit modes.
849 (define_mode_attr i128
850 [(V16SF "f64x4") (V8SF "f128") (V8DF "f64x4") (V4DF "f128")
851 (V64QI "i64x4") (V32QI "%~128") (V32HI "i64x4") (V16HI "%~128")
852 (V16SI "i64x4") (V8SI "%~128") (V8DI "i64x4") (V4DI "%~128")])
854 ;; For 256-bit modes for TARGET_AVX512VL && TARGET_AVX512DQ
855 ;; i32x4, f32x4, i64x2 or f64x2 suffixes.
856 (define_mode_attr i128vldq
857 [(V8SF "f32x4") (V4DF "f64x2")
858 (V32QI "i32x4") (V16HI "i32x4") (V8SI "i32x4") (V4DI "i64x2")])
861 (define_mode_iterator AVX256MODE2P [V8SI V8SF V4DF])
862 (define_mode_iterator AVX512MODE2P [V16SI V16SF V8DF])
864 ;; Mapping for dbpsabbw modes
865 (define_mode_attr dbpsadbwmode
866 [(V32HI "V64QI") (V16HI "V32QI") (V8HI "V16QI")])
868 ;; Mapping suffixes for broadcast
869 (define_mode_attr bcstscalarsuff
870 [(V64QI "b") (V32QI "b") (V16QI "b")
871 (V32HI "w") (V16HI "w") (V8HI "w")
872 (V16SI "d") (V8SI "d") (V4SI "d")
873 (V8DI "q") (V4DI "q") (V2DI "q")
874 (V16SF "ss") (V8SF "ss") (V4SF "ss")
875 (V8DF "sd") (V4DF "sd") (V2DF "sd")])
877 ;; Tie mode of assembler operand to mode iterator
878 (define_mode_attr concat_tg_mode
879 [(V32QI "t") (V16HI "t") (V8SI "t") (V4DI "t") (V8SF "t") (V4DF "t")
880 (V64QI "g") (V32HI "g") (V16SI "g") (V8DI "g") (V16SF "g") (V8DF "g")])
882 ;; Tie mode of assembler operand to mode iterator
883 (define_mode_attr xtg_mode
884 [(V16QI "x") (V8HI "x") (V4SI "x") (V2DI "x") (V4SF "x") (V2DF "x")
885 (V32QI "t") (V16HI "t") (V8SI "t") (V4DI "t") (V8SF "t") (V4DF "t")
886 (V64QI "g") (V32HI "g") (V16SI "g") (V8DI "g") (V16SF "g") (V8DF "g")])
888 ;; Half mask mode for unpacks
889 (define_mode_attr HALFMASKMODE
890 [(DI "SI") (SI "HI")])
892 ;; Double mask mode for packs
893 (define_mode_attr DOUBLEMASKMODE
894 [(HI "SI") (SI "DI")])
897 ;; Include define_subst patterns for instructions with mask
900 ;; Patterns whose name begins with "sse{,2,3}_" are invoked by intrinsics.
902 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
906 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
908 ;; All of these patterns are enabled for SSE1 as well as SSE2.
909 ;; This is essential for maintaining stable calling conventions.
911 (define_expand "mov<mode>"
912 [(set (match_operand:VMOVE 0 "nonimmediate_operand")
913 (match_operand:VMOVE 1 "nonimmediate_operand"))]
916 ix86_expand_vector_move (<MODE>mode, operands);
920 (define_insn "mov<mode>_internal"
921 [(set (match_operand:VMOVE 0 "nonimmediate_operand"
923 (match_operand:VMOVE 1 "nonimmediate_or_sse_const_operand"
926 && (register_operand (operands[0], <MODE>mode)
927 || register_operand (operands[1], <MODE>mode))"
929 switch (get_attr_type (insn))
932 return standard_sse_constant_opcode (insn, operands);
935 /* There is no evex-encoded vmov* for sizes smaller than 64-bytes
936 in avx512f, so we need to use workarounds, to access sse registers
937 16-31, which are evex-only. In avx512vl we don't need workarounds. */
938 if (TARGET_AVX512F && <MODE_SIZE> < 64 && !TARGET_AVX512VL
939 && (EXT_REX_SSE_REG_P (operands[0])
940 || EXT_REX_SSE_REG_P (operands[1])))
942 if (memory_operand (operands[0], <MODE>mode))
944 if (<MODE_SIZE> == 32)
945 return "vextract<shuffletype>64x4\t{$0x0, %g1, %0|%0, %g1, 0x0}";
946 else if (<MODE_SIZE> == 16)
947 return "vextract<shuffletype>32x4\t{$0x0, %g1, %0|%0, %g1, 0x0}";
951 else if (memory_operand (operands[1], <MODE>mode))
953 if (<MODE_SIZE> == 32)
954 return "vbroadcast<shuffletype>64x4\t{%1, %g0|%g0, %1}";
955 else if (<MODE_SIZE> == 16)
956 return "vbroadcast<shuffletype>32x4\t{%1, %g0|%g0, %1}";
961 /* Reg -> reg move is always aligned. Just use wider move. */
962 switch (get_attr_mode (insn))
966 return "vmovaps\t{%g1, %g0|%g0, %g1}";
969 return "vmovapd\t{%g1, %g0|%g0, %g1}";
972 return "vmovdqa64\t{%g1, %g0|%g0, %g1}";
978 switch (get_attr_mode (insn))
983 if (misaligned_operand (operands[0], <MODE>mode)
984 || misaligned_operand (operands[1], <MODE>mode))
985 return "%vmovups\t{%1, %0|%0, %1}";
987 return "%vmovaps\t{%1, %0|%0, %1}";
992 if (misaligned_operand (operands[0], <MODE>mode)
993 || misaligned_operand (operands[1], <MODE>mode))
994 return "%vmovupd\t{%1, %0|%0, %1}";
996 return "%vmovapd\t{%1, %0|%0, %1}";
1000 if (misaligned_operand (operands[0], <MODE>mode)
1001 || misaligned_operand (operands[1], <MODE>mode))
1002 return TARGET_AVX512VL ? "vmovdqu<ssescalarsize>\t{%1, %0|%0, %1}"
1003 : "%vmovdqu\t{%1, %0|%0, %1}";
1005 return TARGET_AVX512VL ? "vmovdqa64\t{%1, %0|%0, %1}"
1006 : "%vmovdqa\t{%1, %0|%0, %1}";
1008 if (misaligned_operand (operands[0], <MODE>mode)
1009 || misaligned_operand (operands[1], <MODE>mode))
1010 return (<MODE>mode == V16SImode
1011 || <MODE>mode == V8DImode
1013 ? "vmovdqu<ssescalarsize>\t{%1, %0|%0, %1}"
1014 : "vmovdqu64\t{%1, %0|%0, %1}";
1016 return "vmovdqa64\t{%1, %0|%0, %1}";
1026 [(set_attr "type" "sselog1,sselog1,ssemov,ssemov")
1027 (set_attr "prefix" "maybe_vex")
1029 (cond [(and (eq_attr "alternative" "1")
1030 (match_test "TARGET_AVX512VL"))
1031 (const_string "<sseinsnmode>")
1032 (and (match_test "<MODE_SIZE> == 16")
1033 (ior (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
1034 (and (eq_attr "alternative" "3")
1035 (match_test "TARGET_SSE_TYPELESS_STORES"))))
1036 (const_string "<ssePSmode>")
1037 (match_test "TARGET_AVX")
1038 (const_string "<sseinsnmode>")
1039 (ior (not (match_test "TARGET_SSE2"))
1040 (match_test "optimize_function_for_size_p (cfun)"))
1041 (const_string "V4SF")
1042 (and (eq_attr "alternative" "0")
1043 (match_test "TARGET_SSE_LOAD0_BY_PXOR"))
1046 (const_string "<sseinsnmode>")))
1047 (set (attr "enabled")
1048 (cond [(and (match_test "<MODE_SIZE> == 16")
1049 (eq_attr "alternative" "1"))
1050 (symbol_ref "TARGET_SSE2")
1051 (and (match_test "<MODE_SIZE> == 32")
1052 (eq_attr "alternative" "1"))
1053 (symbol_ref "TARGET_AVX2")
1055 (symbol_ref "true")))])
1057 (define_insn "<avx512>_load<mode>_mask"
1058 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v,v")
1059 (vec_merge:V48_AVX512VL
1060 (match_operand:V48_AVX512VL 1 "nonimmediate_operand" "v,m")
1061 (match_operand:V48_AVX512VL 2 "vector_move_operand" "0C,0C")
1062 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
1065 if (FLOAT_MODE_P (GET_MODE_INNER (<MODE>mode)))
1067 if (misaligned_operand (operands[1], <MODE>mode))
1068 return "vmovu<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
1070 return "vmova<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
1074 if (misaligned_operand (operands[1], <MODE>mode))
1075 return "vmovdqu<ssescalarsize>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
1077 return "vmovdqa<ssescalarsize>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
1080 [(set_attr "type" "ssemov")
1081 (set_attr "prefix" "evex")
1082 (set_attr "memory" "none,load")
1083 (set_attr "mode" "<sseinsnmode>")])
1085 (define_insn "<avx512>_load<mode>_mask"
1086 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v,v")
1087 (vec_merge:VI12_AVX512VL
1088 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "v,m")
1089 (match_operand:VI12_AVX512VL 2 "vector_move_operand" "0C,0C")
1090 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
1092 "vmovdqu<ssescalarsize>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
1093 [(set_attr "type" "ssemov")
1094 (set_attr "prefix" "evex")
1095 (set_attr "memory" "none,load")
1096 (set_attr "mode" "<sseinsnmode>")])
1098 (define_insn "<avx512>_blendm<mode>"
1099 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v")
1100 (vec_merge:V48_AVX512VL
1101 (match_operand:V48_AVX512VL 2 "nonimmediate_operand" "vm")
1102 (match_operand:V48_AVX512VL 1 "register_operand" "v")
1103 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
1105 "vblendm<ssemodesuffix>\t{%2, %1, %0%{%3%}|%0%{%3%}, %1, %2}"
1106 [(set_attr "type" "ssemov")
1107 (set_attr "prefix" "evex")
1108 (set_attr "mode" "<sseinsnmode>")])
1110 (define_insn "<avx512>_blendm<mode>"
1111 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
1112 (vec_merge:VI12_AVX512VL
1113 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")
1114 (match_operand:VI12_AVX512VL 1 "register_operand" "v")
1115 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
1117 "vpblendm<ssemodesuffix>\t{%2, %1, %0%{%3%}|%0%{%3%}, %1, %2}"
1118 [(set_attr "type" "ssemov")
1119 (set_attr "prefix" "evex")
1120 (set_attr "mode" "<sseinsnmode>")])
1122 (define_insn "<avx512>_store<mode>_mask"
1123 [(set (match_operand:V48_AVX512VL 0 "memory_operand" "=m")
1124 (vec_merge:V48_AVX512VL
1125 (match_operand:V48_AVX512VL 1 "register_operand" "v")
1127 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")))]
1130 if (FLOAT_MODE_P (GET_MODE_INNER (<MODE>mode)))
1132 if (misaligned_operand (operands[0], <MODE>mode))
1133 return "vmovu<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1135 return "vmova<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1139 if (misaligned_operand (operands[0], <MODE>mode))
1140 return "vmovdqu<ssescalarsize>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1142 return "vmovdqa<ssescalarsize>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1145 [(set_attr "type" "ssemov")
1146 (set_attr "prefix" "evex")
1147 (set_attr "memory" "store")
1148 (set_attr "mode" "<sseinsnmode>")])
1150 (define_insn "<avx512>_store<mode>_mask"
1151 [(set (match_operand:VI12_AVX512VL 0 "memory_operand" "=m")
1152 (vec_merge:VI12_AVX512VL
1153 (match_operand:VI12_AVX512VL 1 "register_operand" "v")
1155 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")))]
1157 "vmovdqu<ssescalarsize>\t{%1, %0%{%2%}|%0%{%2%}, %1}"
1158 [(set_attr "type" "ssemov")
1159 (set_attr "prefix" "evex")
1160 (set_attr "memory" "store")
1161 (set_attr "mode" "<sseinsnmode>")])
1163 (define_insn "sse2_movq128"
1164 [(set (match_operand:V2DI 0 "register_operand" "=v")
1167 (match_operand:V2DI 1 "nonimmediate_operand" "vm")
1168 (parallel [(const_int 0)]))
1171 "%vmovq\t{%1, %0|%0, %q1}"
1172 [(set_attr "type" "ssemov")
1173 (set_attr "prefix" "maybe_vex")
1174 (set_attr "mode" "TI")])
1176 ;; Move a DI from a 32-bit register pair (e.g. %edx:%eax) to an xmm.
1177 ;; We'd rather avoid this entirely; if the 32-bit reg pair was loaded
1178 ;; from memory, we'd prefer to load the memory directly into the %xmm
1179 ;; register. To facilitate this happy circumstance, this pattern won't
1180 ;; split until after register allocation. If the 64-bit value didn't
1181 ;; come from memory, this is the best we can do. This is much better
1182 ;; than storing %edx:%eax into a stack temporary and loading an %xmm
1185 (define_insn_and_split "movdi_to_sse"
1187 [(set (match_operand:V4SI 0 "register_operand" "=?x,x")
1188 (subreg:V4SI (match_operand:DI 1 "nonimmediate_operand" "r,m") 0))
1189 (clobber (match_scratch:V4SI 2 "=&x,X"))])]
1190 "!TARGET_64BIT && TARGET_SSE2 && TARGET_INTER_UNIT_MOVES_TO_VEC"
1192 "&& reload_completed"
1195 if (register_operand (operands[1], DImode))
1197 /* The DImode arrived in a pair of integral registers (e.g. %edx:%eax).
1198 Assemble the 64-bit DImode value in an xmm register. */
1199 emit_insn (gen_sse2_loadld (operands[0], CONST0_RTX (V4SImode),
1200 gen_lowpart (SImode, operands[1])));
1201 emit_insn (gen_sse2_loadld (operands[2], CONST0_RTX (V4SImode),
1202 gen_highpart (SImode, operands[1])));
1203 emit_insn (gen_vec_interleave_lowv4si (operands[0], operands[0],
1206 else if (memory_operand (operands[1], DImode))
1208 rtx tmp = gen_reg_rtx (V2DImode);
1209 emit_insn (gen_vec_concatv2di (tmp, operands[1], const0_rtx));
1210 emit_move_insn (operands[0], gen_lowpart (V4SImode, tmp));
1218 [(set (match_operand:V4SF 0 "register_operand")
1219 (match_operand:V4SF 1 "zero_extended_scalar_load_operand"))]
1220 "TARGET_SSE && reload_completed"
1223 (vec_duplicate:V4SF (match_dup 1))
1227 operands[1] = gen_lowpart (SFmode, operands[1]);
1228 operands[2] = CONST0_RTX (V4SFmode);
1232 [(set (match_operand:V2DF 0 "register_operand")
1233 (match_operand:V2DF 1 "zero_extended_scalar_load_operand"))]
1234 "TARGET_SSE2 && reload_completed"
1235 [(set (match_dup 0) (vec_concat:V2DF (match_dup 1) (match_dup 2)))]
1237 operands[1] = gen_lowpart (DFmode, operands[1]);
1238 operands[2] = CONST0_RTX (DFmode);
1241 (define_expand "movmisalign<mode>"
1242 [(set (match_operand:VMOVE 0 "nonimmediate_operand")
1243 (match_operand:VMOVE 1 "nonimmediate_operand"))]
1246 ix86_expand_vector_move_misalign (<MODE>mode, operands);
1250 ;; Merge movsd/movhpd to movupd for TARGET_SSE_UNALIGNED_LOAD_OPTIMAL targets.
1252 [(set (match_operand:V2DF 0 "sse_reg_operand")
1253 (vec_concat:V2DF (match_operand:DF 1 "memory_operand")
1254 (match_operand:DF 4 "const0_operand")))
1255 (set (match_operand:V2DF 2 "sse_reg_operand")
1256 (vec_concat:V2DF (vec_select:DF (match_dup 2)
1257 (parallel [(const_int 0)]))
1258 (match_operand:DF 3 "memory_operand")))]
1259 "TARGET_SSE2 && TARGET_SSE_UNALIGNED_LOAD_OPTIMAL
1260 && ix86_operands_ok_for_move_multiple (operands, true, DFmode)"
1261 [(set (match_dup 2) (match_dup 5))]
1262 "operands[5] = adjust_address (operands[1], V2DFmode, 0);")
1265 [(set (match_operand:DF 0 "sse_reg_operand")
1266 (match_operand:DF 1 "memory_operand"))
1267 (set (match_operand:V2DF 2 "sse_reg_operand")
1268 (vec_concat:V2DF (match_operand:DF 4 "sse_reg_operand")
1269 (match_operand:DF 3 "memory_operand")))]
1270 "TARGET_SSE2 && TARGET_SSE_UNALIGNED_LOAD_OPTIMAL
1271 && REGNO (operands[4]) == REGNO (operands[2])
1272 && ix86_operands_ok_for_move_multiple (operands, true, DFmode)"
1273 [(set (match_dup 2) (match_dup 5))]
1274 "operands[5] = adjust_address (operands[1], V2DFmode, 0);")
1276 ;; Merge movlpd/movhpd to movupd for TARGET_SSE_UNALIGNED_STORE_OPTIMAL targets.
1278 [(set (match_operand:DF 0 "memory_operand")
1279 (vec_select:DF (match_operand:V2DF 1 "sse_reg_operand")
1280 (parallel [(const_int 0)])))
1281 (set (match_operand:DF 2 "memory_operand")
1282 (vec_select:DF (match_operand:V2DF 3 "sse_reg_operand")
1283 (parallel [(const_int 1)])))]
1284 "TARGET_SSE2 && TARGET_SSE_UNALIGNED_STORE_OPTIMAL
1285 && ix86_operands_ok_for_move_multiple (operands, false, DFmode)"
1286 [(set (match_dup 4) (match_dup 1))]
1287 "operands[4] = adjust_address (operands[0], V2DFmode, 0);")
1289 (define_insn "<sse3>_lddqu<avxsizesuffix>"
1290 [(set (match_operand:VI1 0 "register_operand" "=x")
1291 (unspec:VI1 [(match_operand:VI1 1 "memory_operand" "m")]
1294 "%vlddqu\t{%1, %0|%0, %1}"
1295 [(set_attr "type" "ssemov")
1296 (set_attr "movu" "1")
1297 (set (attr "prefix_data16")
1299 (match_test "TARGET_AVX")
1301 (const_string "0")))
1302 (set (attr "prefix_rep")
1304 (match_test "TARGET_AVX")
1306 (const_string "1")))
1307 (set_attr "prefix" "maybe_vex")
1308 (set_attr "mode" "<sseinsnmode>")])
1310 (define_insn "sse2_movnti<mode>"
1311 [(set (match_operand:SWI48 0 "memory_operand" "=m")
1312 (unspec:SWI48 [(match_operand:SWI48 1 "register_operand" "r")]
1315 "movnti\t{%1, %0|%0, %1}"
1316 [(set_attr "type" "ssemov")
1317 (set_attr "prefix_data16" "0")
1318 (set_attr "mode" "<MODE>")])
1320 (define_insn "<sse>_movnt<mode>"
1321 [(set (match_operand:VF 0 "memory_operand" "=m")
1323 [(match_operand:VF 1 "register_operand" "v")]
1326 "%vmovnt<ssemodesuffix>\t{%1, %0|%0, %1}"
1327 [(set_attr "type" "ssemov")
1328 (set_attr "prefix" "maybe_vex")
1329 (set_attr "mode" "<MODE>")])
1331 (define_insn "<sse2>_movnt<mode>"
1332 [(set (match_operand:VI8 0 "memory_operand" "=m")
1333 (unspec:VI8 [(match_operand:VI8 1 "register_operand" "v")]
1336 "%vmovntdq\t{%1, %0|%0, %1}"
1337 [(set_attr "type" "ssecvt")
1338 (set (attr "prefix_data16")
1340 (match_test "TARGET_AVX")
1342 (const_string "1")))
1343 (set_attr "prefix" "maybe_vex")
1344 (set_attr "mode" "<sseinsnmode>")])
1346 ; Expand patterns for non-temporal stores. At the moment, only those
1347 ; that directly map to insns are defined; it would be possible to
1348 ; define patterns for other modes that would expand to several insns.
1350 ;; Modes handled by storent patterns.
1351 (define_mode_iterator STORENT_MODE
1352 [(DI "TARGET_SSE2 && TARGET_64BIT") (SI "TARGET_SSE2")
1353 (SF "TARGET_SSE4A") (DF "TARGET_SSE4A")
1354 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") (V2DI "TARGET_SSE2")
1355 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
1356 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
1358 (define_expand "storent<mode>"
1359 [(set (match_operand:STORENT_MODE 0 "memory_operand")
1360 (unspec:STORENT_MODE
1361 [(match_operand:STORENT_MODE 1 "register_operand")]
1365 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1369 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1371 ;; All integer modes with AVX512BW/DQ.
1372 (define_mode_iterator SWI1248_AVX512BWDQ
1373 [(QI "TARGET_AVX512DQ") HI (SI "TARGET_AVX512BW") (DI "TARGET_AVX512BW")])
1375 ;; All integer modes with AVX512BW, where HImode operation
1376 ;; can be used instead of QImode.
1377 (define_mode_iterator SWI1248_AVX512BW
1378 [QI HI (SI "TARGET_AVX512BW") (DI "TARGET_AVX512BW")])
1380 ;; All integer modes with AVX512BW/DQ, even HImode requires DQ.
1381 (define_mode_iterator SWI1248_AVX512BWDQ2
1382 [(QI "TARGET_AVX512DQ") (HI "TARGET_AVX512DQ")
1383 (SI "TARGET_AVX512BW") (DI "TARGET_AVX512BW")])
1385 (define_expand "kmov<mskmodesuffix>"
1386 [(set (match_operand:SWI1248_AVX512BWDQ 0 "nonimmediate_operand")
1387 (match_operand:SWI1248_AVX512BWDQ 1 "nonimmediate_operand"))]
1389 && !(MEM_P (operands[0]) && MEM_P (operands[1]))")
1391 (define_insn "k<code><mode>"
1392 [(set (match_operand:SWI1248_AVX512BW 0 "register_operand" "=k")
1393 (any_logic:SWI1248_AVX512BW
1394 (match_operand:SWI1248_AVX512BW 1 "register_operand" "k")
1395 (match_operand:SWI1248_AVX512BW 2 "register_operand" "k")))
1396 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1399 if (get_attr_mode (insn) == MODE_HI)
1400 return "k<logic>w\t{%2, %1, %0|%0, %1, %2}";
1402 return "k<logic><mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}";
1404 [(set_attr "type" "msklog")
1405 (set_attr "prefix" "vex")
1407 (cond [(and (match_test "<MODE>mode == QImode")
1408 (not (match_test "TARGET_AVX512DQ")))
1411 (const_string "<MODE>")))])
1413 (define_insn "kandn<mode>"
1414 [(set (match_operand:SWI1248_AVX512BW 0 "register_operand" "=k")
1415 (and:SWI1248_AVX512BW
1416 (not:SWI1248_AVX512BW
1417 (match_operand:SWI1248_AVX512BW 1 "register_operand" "k"))
1418 (match_operand:SWI1248_AVX512BW 2 "register_operand" "k")))
1419 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1422 if (get_attr_mode (insn) == MODE_HI)
1423 return "kandnw\t{%2, %1, %0|%0, %1, %2}";
1425 return "kandn<mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}";
1427 [(set_attr "type" "msklog")
1428 (set_attr "prefix" "vex")
1430 (cond [(and (match_test "<MODE>mode == QImode")
1431 (not (match_test "TARGET_AVX512DQ")))
1434 (const_string "<MODE>")))])
1436 (define_insn "kxnor<mode>"
1437 [(set (match_operand:SWI1248_AVX512BW 0 "register_operand" "=k")
1438 (not:SWI1248_AVX512BW
1439 (xor:SWI1248_AVX512BW
1440 (match_operand:SWI1248_AVX512BW 1 "register_operand" "k")
1441 (match_operand:SWI1248_AVX512BW 2 "register_operand" "k"))))
1442 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1445 if (get_attr_mode (insn) == MODE_HI)
1446 return "kxnorw\t{%2, %1, %0|%0, %1, %2}";
1448 return "kxnor<mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}";
1450 [(set_attr "type" "msklog")
1451 (set_attr "prefix" "vex")
1453 (cond [(and (match_test "<MODE>mode == QImode")
1454 (not (match_test "TARGET_AVX512DQ")))
1457 (const_string "<MODE>")))])
1459 (define_insn "knot<mode>"
1460 [(set (match_operand:SWI1248_AVX512BW 0 "register_operand" "=k")
1461 (not:SWI1248_AVX512BW
1462 (match_operand:SWI1248_AVX512BW 1 "register_operand" "k")))
1463 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1466 if (get_attr_mode (insn) == MODE_HI)
1467 return "knotw\t{%1, %0|%0, %1}";
1469 return "knot<mskmodesuffix>\t{%1, %0|%0, %1}";
1471 [(set_attr "type" "msklog")
1472 (set_attr "prefix" "vex")
1474 (cond [(and (match_test "<MODE>mode == QImode")
1475 (not (match_test "TARGET_AVX512DQ")))
1478 (const_string "<MODE>")))])
1480 (define_insn "kadd<mode>"
1481 [(set (match_operand:SWI1248_AVX512BWDQ2 0 "register_operand" "=k")
1482 (plus:SWI1248_AVX512BWDQ2
1483 (match_operand:SWI1248_AVX512BWDQ2 1 "register_operand" "k")
1484 (match_operand:SWI1248_AVX512BWDQ2 2 "register_operand" "k")))
1485 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1487 "kadd<mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}"
1488 [(set_attr "type" "msklog")
1489 (set_attr "prefix" "vex")
1490 (set_attr "mode" "<MODE>")])
1492 ;; Mask variant shift mnemonics
1493 (define_code_attr mshift [(ashift "shiftl") (lshiftrt "shiftr")])
1495 (define_insn "k<code><mode>"
1496 [(set (match_operand:SWI1248_AVX512BWDQ 0 "register_operand" "=k")
1497 (any_lshift:SWI1248_AVX512BWDQ
1498 (match_operand:SWI1248_AVX512BWDQ 1 "register_operand" "k")
1499 (match_operand:QI 2 "immediate_operand" "n")))
1500 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1502 "k<mshift><mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}"
1503 [(set_attr "type" "msklog")
1504 (set_attr "prefix" "vex")
1505 (set_attr "mode" "<MODE>")])
1507 (define_insn "ktest<mode>"
1508 [(set (reg:CC FLAGS_REG)
1510 [(match_operand:SWI1248_AVX512BWDQ2 0 "register_operand" "k")
1511 (match_operand:SWI1248_AVX512BWDQ2 1 "register_operand" "k")]
1514 "ktest<mskmodesuffix>\t{%1, %0|%0, %1}"
1515 [(set_attr "mode" "<MODE>")
1516 (set_attr "type" "msklog")
1517 (set_attr "prefix" "vex")])
1519 (define_insn "kortest<mode>"
1520 [(set (reg:CC FLAGS_REG)
1522 [(match_operand:SWI1248_AVX512BWDQ 0 "register_operand" "k")
1523 (match_operand:SWI1248_AVX512BWDQ 1 "register_operand" "k")]
1526 "kortest<mskmodesuffix>\t{%1, %0|%0, %1}"
1527 [(set_attr "mode" "<MODE>")
1528 (set_attr "type" "msklog")
1529 (set_attr "prefix" "vex")])
1531 (define_insn "kunpckhi"
1532 [(set (match_operand:HI 0 "register_operand" "=k")
1535 (zero_extend:HI (match_operand:QI 1 "register_operand" "k"))
1537 (zero_extend:HI (match_operand:QI 2 "register_operand" "k"))))]
1539 "kunpckbw\t{%2, %1, %0|%0, %1, %2}"
1540 [(set_attr "mode" "HI")
1541 (set_attr "type" "msklog")
1542 (set_attr "prefix" "vex")])
1544 (define_insn "kunpcksi"
1545 [(set (match_operand:SI 0 "register_operand" "=k")
1548 (zero_extend:SI (match_operand:HI 1 "register_operand" "k"))
1550 (zero_extend:SI (match_operand:HI 2 "register_operand" "k"))))]
1552 "kunpckwd\t{%2, %1, %0|%0, %1, %2}"
1553 [(set_attr "mode" "SI")])
1555 (define_insn "kunpckdi"
1556 [(set (match_operand:DI 0 "register_operand" "=k")
1559 (zero_extend:DI (match_operand:SI 1 "register_operand" "k"))
1561 (zero_extend:DI (match_operand:SI 2 "register_operand" "k"))))]
1563 "kunpckdq\t{%2, %1, %0|%0, %1, %2}"
1564 [(set_attr "mode" "DI")])
1567 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1569 ;; Parallel floating point arithmetic
1571 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1573 (define_expand "<code><mode>2"
1574 [(set (match_operand:VF 0 "register_operand")
1576 (match_operand:VF 1 "register_operand")))]
1578 "ix86_expand_fp_absneg_operator (<CODE>, <MODE>mode, operands); DONE;")
1580 (define_insn_and_split "*absneg<mode>2"
1581 [(set (match_operand:VF 0 "register_operand" "=x,x,v,v")
1582 (match_operator:VF 3 "absneg_operator"
1583 [(match_operand:VF 1 "vector_operand" "0, xBm,v, m")]))
1584 (use (match_operand:VF 2 "vector_operand" "xBm,0, vm,v"))]
1587 "&& reload_completed"
1590 enum rtx_code absneg_op;
1596 if (MEM_P (operands[1]))
1597 op1 = operands[2], op2 = operands[1];
1599 op1 = operands[1], op2 = operands[2];
1604 if (rtx_equal_p (operands[0], operands[1]))
1610 absneg_op = GET_CODE (operands[3]) == NEG ? XOR : AND;
1611 t = gen_rtx_fmt_ee (absneg_op, <MODE>mode, op1, op2);
1612 t = gen_rtx_SET (operands[0], t);
1616 [(set_attr "isa" "noavx,noavx,avx,avx")])
1618 (define_expand "<plusminus_insn><mode>3<mask_name><round_name>"
1619 [(set (match_operand:VF 0 "register_operand")
1621 (match_operand:VF 1 "<round_nimm_predicate>")
1622 (match_operand:VF 2 "<round_nimm_predicate>")))]
1623 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1624 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
1626 (define_insn "*<plusminus_insn><mode>3<mask_name><round_name>"
1627 [(set (match_operand:VF 0 "register_operand" "=x,v")
1629 (match_operand:VF 1 "<round_nimm_predicate>" "<comm>0,v")
1630 (match_operand:VF 2 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
1631 "TARGET_SSE && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)
1632 && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1634 <plusminus_mnemonic><ssemodesuffix>\t{%2, %0|%0, %2}
1635 v<plusminus_mnemonic><ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
1636 [(set_attr "isa" "noavx,avx")
1637 (set_attr "type" "sseadd")
1638 (set_attr "prefix" "<mask_prefix3>")
1639 (set_attr "mode" "<MODE>")])
1641 (define_insn "<sse>_vm<plusminus_insn><mode>3<mask_scalar_name><round_scalar_name>"
1642 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
1645 (match_operand:VF_128 1 "register_operand" "0,v")
1646 (match_operand:VF_128 2 "vector_operand" "xBm,<round_scalar_constraint>"))
1651 <plusminus_mnemonic><ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
1652 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>}"
1653 [(set_attr "isa" "noavx,avx")
1654 (set_attr "type" "sseadd")
1655 (set_attr "prefix" "<round_scalar_prefix>")
1656 (set_attr "mode" "<ssescalarmode>")])
1658 (define_expand "mul<mode>3<mask_name><round_name>"
1659 [(set (match_operand:VF 0 "register_operand")
1661 (match_operand:VF 1 "<round_nimm_predicate>")
1662 (match_operand:VF 2 "<round_nimm_predicate>")))]
1663 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1664 "ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);")
1666 (define_insn "*mul<mode>3<mask_name><round_name>"
1667 [(set (match_operand:VF 0 "register_operand" "=x,v")
1669 (match_operand:VF 1 "<round_nimm_predicate>" "%0,v")
1670 (match_operand:VF 2 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
1672 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
1673 && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1675 mul<ssemodesuffix>\t{%2, %0|%0, %2}
1676 vmul<ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
1677 [(set_attr "isa" "noavx,avx")
1678 (set_attr "type" "ssemul")
1679 (set_attr "prefix" "<mask_prefix3>")
1680 (set_attr "btver2_decode" "direct,double")
1681 (set_attr "mode" "<MODE>")])
1683 (define_insn "<sse>_vm<multdiv_mnemonic><mode>3<mask_scalar_name><round_scalar_name>"
1684 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
1687 (match_operand:VF_128 1 "register_operand" "0,v")
1688 (match_operand:VF_128 2 "vector_operand" "xBm,<round_scalar_constraint>"))
1693 <multdiv_mnemonic><ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
1694 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>}"
1695 [(set_attr "isa" "noavx,avx")
1696 (set_attr "type" "sse<multdiv_mnemonic>")
1697 (set_attr "prefix" "<round_scalar_prefix>")
1698 (set_attr "btver2_decode" "direct,double")
1699 (set_attr "mode" "<ssescalarmode>")])
1701 (define_expand "div<mode>3"
1702 [(set (match_operand:VF2 0 "register_operand")
1703 (div:VF2 (match_operand:VF2 1 "register_operand")
1704 (match_operand:VF2 2 "vector_operand")))]
1706 "ix86_fixup_binary_operands_no_copy (DIV, <MODE>mode, operands);")
1708 (define_expand "div<mode>3"
1709 [(set (match_operand:VF1 0 "register_operand")
1710 (div:VF1 (match_operand:VF1 1 "register_operand")
1711 (match_operand:VF1 2 "vector_operand")))]
1714 ix86_fixup_binary_operands_no_copy (DIV, <MODE>mode, operands);
1717 && TARGET_RECIP_VEC_DIV
1718 && !optimize_insn_for_size_p ()
1719 && flag_finite_math_only && !flag_trapping_math
1720 && flag_unsafe_math_optimizations)
1722 ix86_emit_swdivsf (operands[0], operands[1], operands[2], <MODE>mode);
1727 (define_insn "<sse>_div<mode>3<mask_name><round_name>"
1728 [(set (match_operand:VF 0 "register_operand" "=x,v")
1730 (match_operand:VF 1 "register_operand" "0,v")
1731 (match_operand:VF 2 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
1732 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1734 div<ssemodesuffix>\t{%2, %0|%0, %2}
1735 vdiv<ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
1736 [(set_attr "isa" "noavx,avx")
1737 (set_attr "type" "ssediv")
1738 (set_attr "prefix" "<mask_prefix3>")
1739 (set_attr "mode" "<MODE>")])
1741 (define_insn "<sse>_rcp<mode>2"
1742 [(set (match_operand:VF1_128_256 0 "register_operand" "=x")
1744 [(match_operand:VF1_128_256 1 "vector_operand" "xBm")] UNSPEC_RCP))]
1746 "%vrcpps\t{%1, %0|%0, %1}"
1747 [(set_attr "type" "sse")
1748 (set_attr "atom_sse_attr" "rcp")
1749 (set_attr "btver2_sse_attr" "rcp")
1750 (set_attr "prefix" "maybe_vex")
1751 (set_attr "mode" "<MODE>")])
1753 (define_insn "sse_vmrcpv4sf2"
1754 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
1756 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm,xm")]
1758 (match_operand:V4SF 2 "register_operand" "0,x")
1762 rcpss\t{%1, %0|%0, %k1}
1763 vrcpss\t{%1, %2, %0|%0, %2, %k1}"
1764 [(set_attr "isa" "noavx,avx")
1765 (set_attr "type" "sse")
1766 (set_attr "atom_sse_attr" "rcp")
1767 (set_attr "btver2_sse_attr" "rcp")
1768 (set_attr "prefix" "orig,vex")
1769 (set_attr "mode" "SF")])
1771 (define_insn "<mask_codefor>rcp14<mode><mask_name>"
1772 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
1774 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "vm")]
1777 "vrcp14<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
1778 [(set_attr "type" "sse")
1779 (set_attr "prefix" "evex")
1780 (set_attr "mode" "<MODE>")])
1782 (define_insn "srcp14<mode>"
1783 [(set (match_operand:VF_128 0 "register_operand" "=v")
1786 [(match_operand:VF_128 1 "nonimmediate_operand" "vm")]
1788 (match_operand:VF_128 2 "register_operand" "v")
1791 "vrcp14<ssescalarmodesuffix>\t{%1, %2, %0|%0, %2, %<iptr>1}"
1792 [(set_attr "type" "sse")
1793 (set_attr "prefix" "evex")
1794 (set_attr "mode" "<MODE>")])
1796 (define_insn "srcp14<mode>_mask"
1797 [(set (match_operand:VF_128 0 "register_operand" "=v")
1801 [(match_operand:VF_128 1 "nonimmediate_operand" "vm")]
1803 (match_operand:VF_128 3 "vector_move_operand" "0C")
1804 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk"))
1805 (match_operand:VF_128 2 "register_operand" "v")
1808 "vrcp14<ssescalarmodesuffix>\t{%1, %2, %0%{%4%}%N3|%0%{%4%}%N3, %2, %<iptr>1}"
1809 [(set_attr "type" "sse")
1810 (set_attr "prefix" "evex")
1811 (set_attr "mode" "<MODE>")])
1813 (define_expand "sqrt<mode>2"
1814 [(set (match_operand:VF2 0 "register_operand")
1815 (sqrt:VF2 (match_operand:VF2 1 "vector_operand")))]
1818 (define_expand "sqrt<mode>2"
1819 [(set (match_operand:VF1 0 "register_operand")
1820 (sqrt:VF1 (match_operand:VF1 1 "vector_operand")))]
1824 && TARGET_RECIP_VEC_SQRT
1825 && !optimize_insn_for_size_p ()
1826 && flag_finite_math_only && !flag_trapping_math
1827 && flag_unsafe_math_optimizations)
1829 ix86_emit_swsqrtsf (operands[0], operands[1], <MODE>mode, false);
1834 (define_insn "<sse>_sqrt<mode>2<mask_name><round_name>"
1835 [(set (match_operand:VF 0 "register_operand" "=x,v")
1836 (sqrt:VF (match_operand:VF 1 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
1837 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1839 sqrt<ssemodesuffix>\t{%1, %0|%0, %1}
1840 vsqrt<ssemodesuffix>\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
1841 [(set_attr "isa" "noavx,avx")
1842 (set_attr "type" "sse")
1843 (set_attr "atom_sse_attr" "sqrt")
1844 (set_attr "btver2_sse_attr" "sqrt")
1845 (set_attr "prefix" "maybe_vex")
1846 (set_attr "mode" "<MODE>")])
1848 (define_insn "<sse>_vmsqrt<mode>2<round_name>"
1849 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
1852 (match_operand:VF_128 1 "vector_operand" "xBm,<round_constraint>"))
1853 (match_operand:VF_128 2 "register_operand" "0,v")
1857 sqrt<ssescalarmodesuffix>\t{%1, %0|%0, %<iptr>1}
1858 vsqrt<ssescalarmodesuffix>\t{<round_op3>%1, %2, %0|%0, %2, %<iptr>1<round_op3>}"
1859 [(set_attr "isa" "noavx,avx")
1860 (set_attr "type" "sse")
1861 (set_attr "atom_sse_attr" "sqrt")
1862 (set_attr "prefix" "<round_prefix>")
1863 (set_attr "btver2_sse_attr" "sqrt")
1864 (set_attr "mode" "<ssescalarmode>")])
1866 (define_expand "rsqrt<mode>2"
1867 [(set (match_operand:VF1_128_256 0 "register_operand")
1869 [(match_operand:VF1_128_256 1 "vector_operand")] UNSPEC_RSQRT))]
1872 ix86_emit_swsqrtsf (operands[0], operands[1], <MODE>mode, true);
1876 (define_expand "rsqrtv16sf2"
1877 [(set (match_operand:V16SF 0 "register_operand")
1879 [(match_operand:V16SF 1 "vector_operand")]
1881 "TARGET_SSE_MATH && TARGET_AVX512ER"
1883 ix86_emit_swsqrtsf (operands[0], operands[1], V16SFmode, true);
1887 (define_insn "<sse>_rsqrt<mode>2"
1888 [(set (match_operand:VF1_128_256 0 "register_operand" "=x")
1890 [(match_operand:VF1_128_256 1 "vector_operand" "xBm")] UNSPEC_RSQRT))]
1892 "%vrsqrtps\t{%1, %0|%0, %1}"
1893 [(set_attr "type" "sse")
1894 (set_attr "prefix" "maybe_vex")
1895 (set_attr "mode" "<MODE>")])
1897 (define_insn "<mask_codefor>rsqrt14<mode><mask_name>"
1898 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
1900 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "vm")]
1903 "vrsqrt14<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
1904 [(set_attr "type" "sse")
1905 (set_attr "prefix" "evex")
1906 (set_attr "mode" "<MODE>")])
1908 (define_insn "rsqrt14<mode>"
1909 [(set (match_operand:VF_128 0 "register_operand" "=v")
1912 [(match_operand:VF_128 1 "nonimmediate_operand" "vm")]
1914 (match_operand:VF_128 2 "register_operand" "v")
1917 "vrsqrt14<ssescalarmodesuffix>\t{%1, %2, %0|%0, %2, %<iptr>1}"
1918 [(set_attr "type" "sse")
1919 (set_attr "prefix" "evex")
1920 (set_attr "mode" "<MODE>")])
1922 (define_insn "rsqrt14_<mode>_mask"
1923 [(set (match_operand:VF_128 0 "register_operand" "=v")
1927 [(match_operand:VF_128 1 "nonimmediate_operand" "vm")]
1929 (match_operand:VF_128 3 "vector_move_operand" "0C")
1930 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk"))
1931 (match_operand:VF_128 2 "register_operand" "v")
1934 "vrsqrt14<ssescalarmodesuffix>\t{%1, %2, %0%{%4%}%N3|%0%{%4%}%N3, %2, %<iptr>1}"
1935 [(set_attr "type" "sse")
1936 (set_attr "prefix" "evex")
1937 (set_attr "mode" "<MODE>")])
1939 (define_insn "sse_vmrsqrtv4sf2"
1940 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
1942 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm,xm")]
1944 (match_operand:V4SF 2 "register_operand" "0,x")
1948 rsqrtss\t{%1, %0|%0, %k1}
1949 vrsqrtss\t{%1, %2, %0|%0, %2, %k1}"
1950 [(set_attr "isa" "noavx,avx")
1951 (set_attr "type" "sse")
1952 (set_attr "prefix" "orig,vex")
1953 (set_attr "mode" "SF")])
1955 (define_expand "<code><mode>3<mask_name><round_saeonly_name>"
1956 [(set (match_operand:VF 0 "register_operand")
1958 (match_operand:VF 1 "<round_saeonly_nimm_predicate>")
1959 (match_operand:VF 2 "<round_saeonly_nimm_predicate>")))]
1960 "TARGET_SSE && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
1962 if (!flag_finite_math_only || flag_signed_zeros)
1964 operands[1] = force_reg (<MODE>mode, operands[1]);
1965 emit_insn (gen_ieee_<maxmin_float><mode>3<mask_name><round_saeonly_name>
1966 (operands[0], operands[1], operands[2]
1967 <mask_operand_arg34>
1968 <round_saeonly_mask_arg3>));
1972 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
1975 ;; These versions of the min/max patterns are intentionally ignorant of
1976 ;; their behavior wrt -0.0 and NaN (via the commutative operand mark).
1977 ;; Since both the tree-level MAX_EXPR and the rtl-level SMAX operator
1978 ;; are undefined in this condition, we're certain this is correct.
1980 (define_insn "*<code><mode>3<mask_name><round_saeonly_name>"
1981 [(set (match_operand:VF 0 "register_operand" "=x,v")
1983 (match_operand:VF 1 "<round_saeonly_nimm_predicate>" "%0,v")
1984 (match_operand:VF 2 "<round_saeonly_nimm_predicate>" "xBm,<round_saeonly_constraint>")))]
1986 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
1987 && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
1989 <maxmin_float><ssemodesuffix>\t{%2, %0|%0, %2}
1990 v<maxmin_float><ssemodesuffix>\t{<round_saeonly_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_saeonly_mask_op3>}"
1991 [(set_attr "isa" "noavx,avx")
1992 (set_attr "type" "sseadd")
1993 (set_attr "btver2_sse_attr" "maxmin")
1994 (set_attr "prefix" "<mask_prefix3>")
1995 (set_attr "mode" "<MODE>")])
1997 ;; These versions of the min/max patterns implement exactly the operations
1998 ;; min = (op1 < op2 ? op1 : op2)
1999 ;; max = (!(op1 < op2) ? op1 : op2)
2000 ;; Their operands are not commutative, and thus they may be used in the
2001 ;; presence of -0.0 and NaN.
2003 (define_insn "ieee_<ieee_maxmin><mode>3<mask_name><round_saeonly_name>"
2004 [(set (match_operand:VF 0 "register_operand" "=x,v")
2006 [(match_operand:VF 1 "register_operand" "0,v")
2007 (match_operand:VF 2 "<round_saeonly_nimm_predicate>" "xBm,<round_saeonly_constraint>")]
2010 && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
2012 <ieee_maxmin><ssemodesuffix>\t{%2, %0|%0, %2}
2013 v<ieee_maxmin><ssemodesuffix>\t{<round_saeonly_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_saeonly_mask_op3>}"
2014 [(set_attr "isa" "noavx,avx")
2015 (set_attr "type" "sseadd")
2016 (set_attr "btver2_sse_attr" "maxmin")
2017 (set_attr "prefix" "<mask_prefix3>")
2018 (set_attr "mode" "<MODE>")])
2020 (define_insn "<sse>_vm<code><mode>3<mask_scalar_name><round_saeonly_scalar_name>"
2021 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
2024 (match_operand:VF_128 1 "register_operand" "0,v")
2025 (match_operand:VF_128 2 "vector_operand" "xBm,<round_saeonly_scalar_constraint>"))
2030 <maxmin_float><ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
2031 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>}"
2032 [(set_attr "isa" "noavx,avx")
2033 (set_attr "type" "sse")
2034 (set_attr "btver2_sse_attr" "maxmin")
2035 (set_attr "prefix" "<round_saeonly_scalar_prefix>")
2036 (set_attr "mode" "<ssescalarmode>")])
2038 (define_insn "avx_addsubv4df3"
2039 [(set (match_operand:V4DF 0 "register_operand" "=x")
2042 (match_operand:V4DF 1 "register_operand" "x")
2043 (match_operand:V4DF 2 "nonimmediate_operand" "xm"))
2044 (plus:V4DF (match_dup 1) (match_dup 2))
2047 "vaddsubpd\t{%2, %1, %0|%0, %1, %2}"
2048 [(set_attr "type" "sseadd")
2049 (set_attr "prefix" "vex")
2050 (set_attr "mode" "V4DF")])
2052 (define_insn "sse3_addsubv2df3"
2053 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
2056 (match_operand:V2DF 1 "register_operand" "0,x")
2057 (match_operand:V2DF 2 "vector_operand" "xBm,xm"))
2058 (plus:V2DF (match_dup 1) (match_dup 2))
2062 addsubpd\t{%2, %0|%0, %2}
2063 vaddsubpd\t{%2, %1, %0|%0, %1, %2}"
2064 [(set_attr "isa" "noavx,avx")
2065 (set_attr "type" "sseadd")
2066 (set_attr "atom_unit" "complex")
2067 (set_attr "prefix" "orig,vex")
2068 (set_attr "mode" "V2DF")])
2070 (define_insn "avx_addsubv8sf3"
2071 [(set (match_operand:V8SF 0 "register_operand" "=x")
2074 (match_operand:V8SF 1 "register_operand" "x")
2075 (match_operand:V8SF 2 "nonimmediate_operand" "xm"))
2076 (plus:V8SF (match_dup 1) (match_dup 2))
2079 "vaddsubps\t{%2, %1, %0|%0, %1, %2}"
2080 [(set_attr "type" "sseadd")
2081 (set_attr "prefix" "vex")
2082 (set_attr "mode" "V8SF")])
2084 (define_insn "sse3_addsubv4sf3"
2085 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
2088 (match_operand:V4SF 1 "register_operand" "0,x")
2089 (match_operand:V4SF 2 "vector_operand" "xBm,xm"))
2090 (plus:V4SF (match_dup 1) (match_dup 2))
2094 addsubps\t{%2, %0|%0, %2}
2095 vaddsubps\t{%2, %1, %0|%0, %1, %2}"
2096 [(set_attr "isa" "noavx,avx")
2097 (set_attr "type" "sseadd")
2098 (set_attr "prefix" "orig,vex")
2099 (set_attr "prefix_rep" "1,*")
2100 (set_attr "mode" "V4SF")])
2103 [(set (match_operand:VF_128_256 0 "register_operand")
2104 (match_operator:VF_128_256 6 "addsub_vm_operator"
2106 (match_operand:VF_128_256 1 "register_operand")
2107 (match_operand:VF_128_256 2 "vector_operand"))
2109 (match_operand:VF_128_256 3 "vector_operand")
2110 (match_operand:VF_128_256 4 "vector_operand"))
2111 (match_operand 5 "const_int_operand")]))]
2113 && can_create_pseudo_p ()
2114 && ((rtx_equal_p (operands[1], operands[3])
2115 && rtx_equal_p (operands[2], operands[4]))
2116 || (rtx_equal_p (operands[1], operands[4])
2117 && rtx_equal_p (operands[2], operands[3])))"
2119 (vec_merge:VF_128_256
2120 (minus:VF_128_256 (match_dup 1) (match_dup 2))
2121 (plus:VF_128_256 (match_dup 1) (match_dup 2))
2125 [(set (match_operand:VF_128_256 0 "register_operand")
2126 (match_operator:VF_128_256 6 "addsub_vm_operator"
2128 (match_operand:VF_128_256 1 "vector_operand")
2129 (match_operand:VF_128_256 2 "vector_operand"))
2131 (match_operand:VF_128_256 3 "register_operand")
2132 (match_operand:VF_128_256 4 "vector_operand"))
2133 (match_operand 5 "const_int_operand")]))]
2135 && can_create_pseudo_p ()
2136 && ((rtx_equal_p (operands[1], operands[3])
2137 && rtx_equal_p (operands[2], operands[4]))
2138 || (rtx_equal_p (operands[1], operands[4])
2139 && rtx_equal_p (operands[2], operands[3])))"
2141 (vec_merge:VF_128_256
2142 (minus:VF_128_256 (match_dup 3) (match_dup 4))
2143 (plus:VF_128_256 (match_dup 3) (match_dup 4))
2146 /* Negate mask bits to compensate for swapped PLUS and MINUS RTXes. */
2148 = GEN_INT (~INTVAL (operands[5])
2149 & ((HOST_WIDE_INT_1U << GET_MODE_NUNITS (<MODE>mode)) - 1));
2153 [(set (match_operand:VF_128_256 0 "register_operand")
2154 (match_operator:VF_128_256 7 "addsub_vs_operator"
2155 [(vec_concat:<ssedoublemode>
2157 (match_operand:VF_128_256 1 "register_operand")
2158 (match_operand:VF_128_256 2 "vector_operand"))
2160 (match_operand:VF_128_256 3 "vector_operand")
2161 (match_operand:VF_128_256 4 "vector_operand")))
2162 (match_parallel 5 "addsub_vs_parallel"
2163 [(match_operand 6 "const_int_operand")])]))]
2165 && can_create_pseudo_p ()
2166 && ((rtx_equal_p (operands[1], operands[3])
2167 && rtx_equal_p (operands[2], operands[4]))
2168 || (rtx_equal_p (operands[1], operands[4])
2169 && rtx_equal_p (operands[2], operands[3])))"
2171 (vec_merge:VF_128_256
2172 (minus:VF_128_256 (match_dup 1) (match_dup 2))
2173 (plus:VF_128_256 (match_dup 1) (match_dup 2))
2176 int i, nelt = XVECLEN (operands[5], 0);
2177 HOST_WIDE_INT ival = 0;
2179 for (i = 0; i < nelt; i++)
2180 if (INTVAL (XVECEXP (operands[5], 0, i)) < GET_MODE_NUNITS (<MODE>mode))
2181 ival |= HOST_WIDE_INT_1 << i;
2183 operands[5] = GEN_INT (ival);
2187 [(set (match_operand:VF_128_256 0 "register_operand")
2188 (match_operator:VF_128_256 7 "addsub_vs_operator"
2189 [(vec_concat:<ssedoublemode>
2191 (match_operand:VF_128_256 1 "vector_operand")
2192 (match_operand:VF_128_256 2 "vector_operand"))
2194 (match_operand:VF_128_256 3 "register_operand")
2195 (match_operand:VF_128_256 4 "vector_operand")))
2196 (match_parallel 5 "addsub_vs_parallel"
2197 [(match_operand 6 "const_int_operand")])]))]
2199 && can_create_pseudo_p ()
2200 && ((rtx_equal_p (operands[1], operands[3])
2201 && rtx_equal_p (operands[2], operands[4]))
2202 || (rtx_equal_p (operands[1], operands[4])
2203 && rtx_equal_p (operands[2], operands[3])))"
2205 (vec_merge:VF_128_256
2206 (minus:VF_128_256 (match_dup 3) (match_dup 4))
2207 (plus:VF_128_256 (match_dup 3) (match_dup 4))
2210 int i, nelt = XVECLEN (operands[5], 0);
2211 HOST_WIDE_INT ival = 0;
2213 for (i = 0; i < nelt; i++)
2214 if (INTVAL (XVECEXP (operands[5], 0, i)) >= GET_MODE_NUNITS (<MODE>mode))
2215 ival |= HOST_WIDE_INT_1 << i;
2217 operands[5] = GEN_INT (ival);
2220 (define_insn "avx_h<plusminus_insn>v4df3"
2221 [(set (match_operand:V4DF 0 "register_operand" "=x")
2226 (match_operand:V4DF 1 "register_operand" "x")
2227 (parallel [(const_int 0)]))
2228 (vec_select:DF (match_dup 1) (parallel [(const_int 1)])))
2231 (match_operand:V4DF 2 "nonimmediate_operand" "xm")
2232 (parallel [(const_int 0)]))
2233 (vec_select:DF (match_dup 2) (parallel [(const_int 1)]))))
2236 (vec_select:DF (match_dup 1) (parallel [(const_int 2)]))
2237 (vec_select:DF (match_dup 1) (parallel [(const_int 3)])))
2239 (vec_select:DF (match_dup 2) (parallel [(const_int 2)]))
2240 (vec_select:DF (match_dup 2) (parallel [(const_int 3)]))))))]
2242 "vh<plusminus_mnemonic>pd\t{%2, %1, %0|%0, %1, %2}"
2243 [(set_attr "type" "sseadd")
2244 (set_attr "prefix" "vex")
2245 (set_attr "mode" "V4DF")])
2247 (define_expand "sse3_haddv2df3"
2248 [(set (match_operand:V2DF 0 "register_operand")
2252 (match_operand:V2DF 1 "register_operand")
2253 (parallel [(const_int 0)]))
2254 (vec_select:DF (match_dup 1) (parallel [(const_int 1)])))
2257 (match_operand:V2DF 2 "vector_operand")
2258 (parallel [(const_int 0)]))
2259 (vec_select:DF (match_dup 2) (parallel [(const_int 1)])))))]
2262 (define_insn "*sse3_haddv2df3"
2263 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
2267 (match_operand:V2DF 1 "register_operand" "0,x")
2268 (parallel [(match_operand:SI 3 "const_0_to_1_operand")]))
2271 (parallel [(match_operand:SI 4 "const_0_to_1_operand")])))
2274 (match_operand:V2DF 2 "vector_operand" "xBm,xm")
2275 (parallel [(match_operand:SI 5 "const_0_to_1_operand")]))
2278 (parallel [(match_operand:SI 6 "const_0_to_1_operand")])))))]
2280 && INTVAL (operands[3]) != INTVAL (operands[4])
2281 && INTVAL (operands[5]) != INTVAL (operands[6])"
2283 haddpd\t{%2, %0|%0, %2}
2284 vhaddpd\t{%2, %1, %0|%0, %1, %2}"
2285 [(set_attr "isa" "noavx,avx")
2286 (set_attr "type" "sseadd")
2287 (set_attr "prefix" "orig,vex")
2288 (set_attr "mode" "V2DF")])
2290 (define_insn "sse3_hsubv2df3"
2291 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
2295 (match_operand:V2DF 1 "register_operand" "0,x")
2296 (parallel [(const_int 0)]))
2297 (vec_select:DF (match_dup 1) (parallel [(const_int 1)])))
2300 (match_operand:V2DF 2 "vector_operand" "xBm,xm")
2301 (parallel [(const_int 0)]))
2302 (vec_select:DF (match_dup 2) (parallel [(const_int 1)])))))]
2305 hsubpd\t{%2, %0|%0, %2}
2306 vhsubpd\t{%2, %1, %0|%0, %1, %2}"
2307 [(set_attr "isa" "noavx,avx")
2308 (set_attr "type" "sseadd")
2309 (set_attr "prefix" "orig,vex")
2310 (set_attr "mode" "V2DF")])
2312 (define_insn "*sse3_haddv2df3_low"
2313 [(set (match_operand:DF 0 "register_operand" "=x,x")
2316 (match_operand:V2DF 1 "register_operand" "0,x")
2317 (parallel [(match_operand:SI 2 "const_0_to_1_operand")]))
2320 (parallel [(match_operand:SI 3 "const_0_to_1_operand")]))))]
2322 && INTVAL (operands[2]) != INTVAL (operands[3])"
2324 haddpd\t{%0, %0|%0, %0}
2325 vhaddpd\t{%1, %1, %0|%0, %1, %1}"
2326 [(set_attr "isa" "noavx,avx")
2327 (set_attr "type" "sseadd1")
2328 (set_attr "prefix" "orig,vex")
2329 (set_attr "mode" "V2DF")])
2331 (define_insn "*sse3_hsubv2df3_low"
2332 [(set (match_operand:DF 0 "register_operand" "=x,x")
2335 (match_operand:V2DF 1 "register_operand" "0,x")
2336 (parallel [(const_int 0)]))
2339 (parallel [(const_int 1)]))))]
2342 hsubpd\t{%0, %0|%0, %0}
2343 vhsubpd\t{%1, %1, %0|%0, %1, %1}"
2344 [(set_attr "isa" "noavx,avx")
2345 (set_attr "type" "sseadd1")
2346 (set_attr "prefix" "orig,vex")
2347 (set_attr "mode" "V2DF")])
2349 (define_insn "avx_h<plusminus_insn>v8sf3"
2350 [(set (match_operand:V8SF 0 "register_operand" "=x")
2356 (match_operand:V8SF 1 "register_operand" "x")
2357 (parallel [(const_int 0)]))
2358 (vec_select:SF (match_dup 1) (parallel [(const_int 1)])))
2360 (vec_select:SF (match_dup 1) (parallel [(const_int 2)]))
2361 (vec_select:SF (match_dup 1) (parallel [(const_int 3)]))))
2365 (match_operand:V8SF 2 "nonimmediate_operand" "xm")
2366 (parallel [(const_int 0)]))
2367 (vec_select:SF (match_dup 2) (parallel [(const_int 1)])))
2369 (vec_select:SF (match_dup 2) (parallel [(const_int 2)]))
2370 (vec_select:SF (match_dup 2) (parallel [(const_int 3)])))))
2374 (vec_select:SF (match_dup 1) (parallel [(const_int 4)]))
2375 (vec_select:SF (match_dup 1) (parallel [(const_int 5)])))
2377 (vec_select:SF (match_dup 1) (parallel [(const_int 6)]))
2378 (vec_select:SF (match_dup 1) (parallel [(const_int 7)]))))
2381 (vec_select:SF (match_dup 2) (parallel [(const_int 4)]))
2382 (vec_select:SF (match_dup 2) (parallel [(const_int 5)])))
2384 (vec_select:SF (match_dup 2) (parallel [(const_int 6)]))
2385 (vec_select:SF (match_dup 2) (parallel [(const_int 7)])))))))]
2387 "vh<plusminus_mnemonic>ps\t{%2, %1, %0|%0, %1, %2}"
2388 [(set_attr "type" "sseadd")
2389 (set_attr "prefix" "vex")
2390 (set_attr "mode" "V8SF")])
2392 (define_insn "sse3_h<plusminus_insn>v4sf3"
2393 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
2398 (match_operand:V4SF 1 "register_operand" "0,x")
2399 (parallel [(const_int 0)]))
2400 (vec_select:SF (match_dup 1) (parallel [(const_int 1)])))
2402 (vec_select:SF (match_dup 1) (parallel [(const_int 2)]))
2403 (vec_select:SF (match_dup 1) (parallel [(const_int 3)]))))
2407 (match_operand:V4SF 2 "vector_operand" "xBm,xm")
2408 (parallel [(const_int 0)]))
2409 (vec_select:SF (match_dup 2) (parallel [(const_int 1)])))
2411 (vec_select:SF (match_dup 2) (parallel [(const_int 2)]))
2412 (vec_select:SF (match_dup 2) (parallel [(const_int 3)]))))))]
2415 h<plusminus_mnemonic>ps\t{%2, %0|%0, %2}
2416 vh<plusminus_mnemonic>ps\t{%2, %1, %0|%0, %1, %2}"
2417 [(set_attr "isa" "noavx,avx")
2418 (set_attr "type" "sseadd")
2419 (set_attr "atom_unit" "complex")
2420 (set_attr "prefix" "orig,vex")
2421 (set_attr "prefix_rep" "1,*")
2422 (set_attr "mode" "V4SF")])
2424 (define_expand "reduc_plus_scal_v8df"
2425 [(match_operand:DF 0 "register_operand")
2426 (match_operand:V8DF 1 "register_operand")]
2429 rtx tmp = gen_reg_rtx (V8DFmode);
2430 ix86_expand_reduc (gen_addv8df3, tmp, operands[1]);
2431 emit_insn (gen_vec_extractv8dfdf (operands[0], tmp, const0_rtx));
2435 (define_expand "reduc_plus_scal_v4df"
2436 [(match_operand:DF 0 "register_operand")
2437 (match_operand:V4DF 1 "register_operand")]
2440 rtx tmp = gen_reg_rtx (V4DFmode);
2441 rtx tmp2 = gen_reg_rtx (V4DFmode);
2442 rtx vec_res = gen_reg_rtx (V4DFmode);
2443 emit_insn (gen_avx_haddv4df3 (tmp, operands[1], operands[1]));
2444 emit_insn (gen_avx_vperm2f128v4df3 (tmp2, tmp, tmp, GEN_INT (1)));
2445 emit_insn (gen_addv4df3 (vec_res, tmp, tmp2));
2446 emit_insn (gen_vec_extractv4dfdf (operands[0], vec_res, const0_rtx));
2450 (define_expand "reduc_plus_scal_v2df"
2451 [(match_operand:DF 0 "register_operand")
2452 (match_operand:V2DF 1 "register_operand")]
2455 rtx tmp = gen_reg_rtx (V2DFmode);
2456 emit_insn (gen_sse3_haddv2df3 (tmp, operands[1], operands[1]));
2457 emit_insn (gen_vec_extractv2dfdf (operands[0], tmp, const0_rtx));
2461 (define_expand "reduc_plus_scal_v16sf"
2462 [(match_operand:SF 0 "register_operand")
2463 (match_operand:V16SF 1 "register_operand")]
2466 rtx tmp = gen_reg_rtx (V16SFmode);
2467 ix86_expand_reduc (gen_addv16sf3, tmp, operands[1]);
2468 emit_insn (gen_vec_extractv16sfsf (operands[0], tmp, const0_rtx));
2472 (define_expand "reduc_plus_scal_v8sf"
2473 [(match_operand:SF 0 "register_operand")
2474 (match_operand:V8SF 1 "register_operand")]
2477 rtx tmp = gen_reg_rtx (V8SFmode);
2478 rtx tmp2 = gen_reg_rtx (V8SFmode);
2479 rtx vec_res = gen_reg_rtx (V8SFmode);
2480 emit_insn (gen_avx_haddv8sf3 (tmp, operands[1], operands[1]));
2481 emit_insn (gen_avx_haddv8sf3 (tmp2, tmp, tmp));
2482 emit_insn (gen_avx_vperm2f128v8sf3 (tmp, tmp2, tmp2, GEN_INT (1)));
2483 emit_insn (gen_addv8sf3 (vec_res, tmp, tmp2));
2484 emit_insn (gen_vec_extractv8sfsf (operands[0], vec_res, const0_rtx));
2488 (define_expand "reduc_plus_scal_v4sf"
2489 [(match_operand:SF 0 "register_operand")
2490 (match_operand:V4SF 1 "register_operand")]
2493 rtx vec_res = gen_reg_rtx (V4SFmode);
2496 rtx tmp = gen_reg_rtx (V4SFmode);
2497 emit_insn (gen_sse3_haddv4sf3 (tmp, operands[1], operands[1]));
2498 emit_insn (gen_sse3_haddv4sf3 (vec_res, tmp, tmp));
2501 ix86_expand_reduc (gen_addv4sf3, vec_res, operands[1]);
2502 emit_insn (gen_vec_extractv4sfsf (operands[0], vec_res, const0_rtx));
2506 ;; Modes handled by reduc_sm{in,ax}* patterns.
2507 (define_mode_iterator REDUC_SMINMAX_MODE
2508 [(V32QI "TARGET_AVX2") (V16HI "TARGET_AVX2")
2509 (V8SI "TARGET_AVX2") (V4DI "TARGET_AVX2")
2510 (V8SF "TARGET_AVX") (V4DF "TARGET_AVX")
2511 (V4SF "TARGET_SSE") (V64QI "TARGET_AVX512BW")
2512 (V32HI "TARGET_AVX512BW") (V16SI "TARGET_AVX512F")
2513 (V8DI "TARGET_AVX512F") (V16SF "TARGET_AVX512F")
2514 (V8DF "TARGET_AVX512F")])
2516 (define_expand "reduc_<code>_scal_<mode>"
2517 [(smaxmin:REDUC_SMINMAX_MODE
2518 (match_operand:<ssescalarmode> 0 "register_operand")
2519 (match_operand:REDUC_SMINMAX_MODE 1 "register_operand"))]
2522 rtx tmp = gen_reg_rtx (<MODE>mode);
2523 ix86_expand_reduc (gen_<code><mode>3, tmp, operands[1]);
2524 emit_insn (gen_vec_extract<mode><ssescalarmodelower> (operands[0], tmp,
2529 (define_expand "reduc_<code>_scal_<mode>"
2530 [(umaxmin:VI_AVX512BW
2531 (match_operand:<ssescalarmode> 0 "register_operand")
2532 (match_operand:VI_AVX512BW 1 "register_operand"))]
2535 rtx tmp = gen_reg_rtx (<MODE>mode);
2536 ix86_expand_reduc (gen_<code><mode>3, tmp, operands[1]);
2537 emit_insn (gen_vec_extract<mode><ssescalarmodelower> (operands[0], tmp,
2542 (define_expand "reduc_<code>_scal_<mode>"
2544 (match_operand:<ssescalarmode> 0 "register_operand")
2545 (match_operand:VI_256 1 "register_operand"))]
2548 rtx tmp = gen_reg_rtx (<MODE>mode);
2549 ix86_expand_reduc (gen_<code><mode>3, tmp, operands[1]);
2550 emit_insn (gen_vec_extract<mode><ssescalarmodelower> (operands[0], tmp,
2555 (define_expand "reduc_umin_scal_v8hi"
2557 (match_operand:HI 0 "register_operand")
2558 (match_operand:V8HI 1 "register_operand"))]
2561 rtx tmp = gen_reg_rtx (V8HImode);
2562 ix86_expand_reduc (gen_uminv8hi3, tmp, operands[1]);
2563 emit_insn (gen_vec_extractv8hihi (operands[0], tmp, const0_rtx));
2567 (define_insn "<mask_codefor>reducep<mode><mask_name>"
2568 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
2570 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "vm")
2571 (match_operand:SI 2 "const_0_to_255_operand")]
2574 "vreduce<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
2575 [(set_attr "type" "sse")
2576 (set_attr "prefix" "evex")
2577 (set_attr "mode" "<MODE>")])
2579 (define_insn "reduces<mode><mask_scalar_name>"
2580 [(set (match_operand:VF_128 0 "register_operand" "=v")
2583 [(match_operand:VF_128 1 "register_operand" "v")
2584 (match_operand:VF_128 2 "nonimmediate_operand" "vm")
2585 (match_operand:SI 3 "const_0_to_255_operand")]
2590 "vreduce<ssescalarmodesuffix>\t{%3, %2, %1, %0<mask_scalar_operand4>|%0<mask_scalar_operand4>, %1, %2, %3}"
2591 [(set_attr "type" "sse")
2592 (set_attr "prefix" "evex")
2593 (set_attr "mode" "<MODE>")])
2595 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2597 ;; Parallel floating point comparisons
2599 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2601 (define_insn "avx_cmp<mode>3"
2602 [(set (match_operand:VF_128_256 0 "register_operand" "=x")
2604 [(match_operand:VF_128_256 1 "register_operand" "x")
2605 (match_operand:VF_128_256 2 "nonimmediate_operand" "xm")
2606 (match_operand:SI 3 "const_0_to_31_operand" "n")]
2609 "vcmp<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
2610 [(set_attr "type" "ssecmp")
2611 (set_attr "length_immediate" "1")
2612 (set_attr "prefix" "vex")
2613 (set_attr "mode" "<MODE>")])
2615 (define_insn "avx_vmcmp<mode>3"
2616 [(set (match_operand:VF_128 0 "register_operand" "=x")
2619 [(match_operand:VF_128 1 "register_operand" "x")
2620 (match_operand:VF_128 2 "nonimmediate_operand" "xm")
2621 (match_operand:SI 3 "const_0_to_31_operand" "n")]
2626 "vcmp<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %3}"
2627 [(set_attr "type" "ssecmp")
2628 (set_attr "length_immediate" "1")
2629 (set_attr "prefix" "vex")
2630 (set_attr "mode" "<ssescalarmode>")])
2632 (define_insn "*<sse>_maskcmp<mode>3_comm"
2633 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x")
2634 (match_operator:VF_128_256 3 "sse_comparison_operator"
2635 [(match_operand:VF_128_256 1 "register_operand" "%0,x")
2636 (match_operand:VF_128_256 2 "vector_operand" "xBm,xm")]))]
2638 && GET_RTX_CLASS (GET_CODE (operands[3])) == RTX_COMM_COMPARE"
2640 cmp%D3<ssemodesuffix>\t{%2, %0|%0, %2}
2641 vcmp%D3<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
2642 [(set_attr "isa" "noavx,avx")
2643 (set_attr "type" "ssecmp")
2644 (set_attr "length_immediate" "1")
2645 (set_attr "prefix" "orig,vex")
2646 (set_attr "mode" "<MODE>")])
2648 (define_insn "<sse>_maskcmp<mode>3"
2649 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x")
2650 (match_operator:VF_128_256 3 "sse_comparison_operator"
2651 [(match_operand:VF_128_256 1 "register_operand" "0,x")
2652 (match_operand:VF_128_256 2 "vector_operand" "xBm,xm")]))]
2655 cmp%D3<ssemodesuffix>\t{%2, %0|%0, %2}
2656 vcmp%D3<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
2657 [(set_attr "isa" "noavx,avx")
2658 (set_attr "type" "ssecmp")
2659 (set_attr "length_immediate" "1")
2660 (set_attr "prefix" "orig,vex")
2661 (set_attr "mode" "<MODE>")])
2663 (define_insn "<sse>_vmmaskcmp<mode>3"
2664 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
2666 (match_operator:VF_128 3 "sse_comparison_operator"
2667 [(match_operand:VF_128 1 "register_operand" "0,x")
2668 (match_operand:VF_128 2 "vector_operand" "xBm,xm")])
2673 cmp%D3<ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
2674 vcmp%D3<ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %<iptr>2}"
2675 [(set_attr "isa" "noavx,avx")
2676 (set_attr "type" "ssecmp")
2677 (set_attr "length_immediate" "1,*")
2678 (set_attr "prefix" "orig,vex")
2679 (set_attr "mode" "<ssescalarmode>")])
2681 (define_mode_attr cmp_imm_predicate
2682 [(V16SF "const_0_to_31_operand") (V8DF "const_0_to_31_operand")
2683 (V16SI "const_0_to_7_operand") (V8DI "const_0_to_7_operand")
2684 (V8SF "const_0_to_31_operand") (V4DF "const_0_to_31_operand")
2685 (V8SI "const_0_to_7_operand") (V4DI "const_0_to_7_operand")
2686 (V4SF "const_0_to_31_operand") (V2DF "const_0_to_31_operand")
2687 (V4SI "const_0_to_7_operand") (V2DI "const_0_to_7_operand")
2688 (V32HI "const_0_to_7_operand") (V64QI "const_0_to_7_operand")
2689 (V16HI "const_0_to_7_operand") (V32QI "const_0_to_7_operand")
2690 (V8HI "const_0_to_7_operand") (V16QI "const_0_to_7_operand")])
2692 (define_insn "<avx512>_cmp<mode>3<mask_scalar_merge_name><round_saeonly_name>"
2693 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2694 (unspec:<avx512fmaskmode>
2695 [(match_operand:V48_AVX512VL 1 "register_operand" "v")
2696 (match_operand:V48_AVX512VL 2 "nonimmediate_operand" "<round_saeonly_constraint>")
2697 (match_operand:SI 3 "<cmp_imm_predicate>" "n")]
2699 "TARGET_AVX512F && <round_saeonly_mode512bit_condition>"
2700 "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}"
2701 [(set_attr "type" "ssecmp")
2702 (set_attr "length_immediate" "1")
2703 (set_attr "prefix" "evex")
2704 (set_attr "mode" "<sseinsnmode>")])
2706 (define_insn "<avx512>_cmp<mode>3<mask_scalar_merge_name>"
2707 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2708 (unspec:<avx512fmaskmode>
2709 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
2710 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")
2711 (match_operand:SI 3 "<cmp_imm_predicate>" "n")]
2714 "vpcmp<ssemodesuffix>\t{%3, %2, %1, %0<mask_scalar_merge_operand4>|%0<mask_scalar_merge_operand4>, %1, %2, %3}"
2715 [(set_attr "type" "ssecmp")
2716 (set_attr "length_immediate" "1")
2717 (set_attr "prefix" "evex")
2718 (set_attr "mode" "<sseinsnmode>")])
2720 (define_insn "<avx512>_ucmp<mode>3<mask_scalar_merge_name>"
2721 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2722 (unspec:<avx512fmaskmode>
2723 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
2724 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")
2725 (match_operand:SI 3 "const_0_to_7_operand" "n")]
2726 UNSPEC_UNSIGNED_PCMP))]
2728 "vpcmpu<ssemodesuffix>\t{%3, %2, %1, %0<mask_scalar_merge_operand4>|%0<mask_scalar_merge_operand4>, %1, %2, %3}"
2729 [(set_attr "type" "ssecmp")
2730 (set_attr "length_immediate" "1")
2731 (set_attr "prefix" "evex")
2732 (set_attr "mode" "<sseinsnmode>")])
2734 (define_insn "<avx512>_ucmp<mode>3<mask_scalar_merge_name>"
2735 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2736 (unspec:<avx512fmaskmode>
2737 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
2738 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")
2739 (match_operand:SI 3 "const_0_to_7_operand" "n")]
2740 UNSPEC_UNSIGNED_PCMP))]
2742 "vpcmpu<ssemodesuffix>\t{%3, %2, %1, %0<mask_scalar_merge_operand4>|%0<mask_scalar_merge_operand4>, %1, %2, %3}"
2743 [(set_attr "type" "ssecmp")
2744 (set_attr "length_immediate" "1")
2745 (set_attr "prefix" "evex")
2746 (set_attr "mode" "<sseinsnmode>")])
2748 (define_insn "avx512f_vmcmp<mode>3<round_saeonly_name>"
2749 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2750 (and:<avx512fmaskmode>
2751 (unspec:<avx512fmaskmode>
2752 [(match_operand:VF_128 1 "register_operand" "v")
2753 (match_operand:VF_128 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
2754 (match_operand:SI 3 "const_0_to_31_operand" "n")]
2758 "vcmp<ssescalarmodesuffix>\t{%3, <round_saeonly_op4>%2, %1, %0|%0, %1, %2<round_saeonly_op4>, %3}"
2759 [(set_attr "type" "ssecmp")
2760 (set_attr "length_immediate" "1")
2761 (set_attr "prefix" "evex")
2762 (set_attr "mode" "<ssescalarmode>")])
2764 (define_insn "avx512f_vmcmp<mode>3_mask<round_saeonly_name>"
2765 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2766 (and:<avx512fmaskmode>
2767 (unspec:<avx512fmaskmode>
2768 [(match_operand:VF_128 1 "register_operand" "v")
2769 (match_operand:VF_128 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
2770 (match_operand:SI 3 "const_0_to_31_operand" "n")]
2772 (and:<avx512fmaskmode>
2773 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")
2776 "vcmp<ssescalarmodesuffix>\t{%3, <round_saeonly_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_saeonly_op5>, %3}"
2777 [(set_attr "type" "ssecmp")
2778 (set_attr "length_immediate" "1")
2779 (set_attr "prefix" "evex")
2780 (set_attr "mode" "<ssescalarmode>")])
2782 (define_insn "avx512f_maskcmp<mode>3"
2783 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2784 (match_operator:<avx512fmaskmode> 3 "sse_comparison_operator"
2785 [(match_operand:VF 1 "register_operand" "v")
2786 (match_operand:VF 2 "nonimmediate_operand" "vm")]))]
2788 "vcmp%D3<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
2789 [(set_attr "type" "ssecmp")
2790 (set_attr "length_immediate" "1")
2791 (set_attr "prefix" "evex")
2792 (set_attr "mode" "<sseinsnmode>")])
2794 (define_insn "<sse>_<unord>comi<round_saeonly_name>"
2795 [(set (reg:CCFP FLAGS_REG)
2798 (match_operand:<ssevecmode> 0 "register_operand" "v")
2799 (parallel [(const_int 0)]))
2801 (match_operand:<ssevecmode> 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
2802 (parallel [(const_int 0)]))))]
2803 "SSE_FLOAT_MODE_P (<MODE>mode)"
2804 "%v<unord>comi<ssemodesuffix>\t{<round_saeonly_op2>%1, %0|%0, %<iptr>1<round_saeonly_op2>}"
2805 [(set_attr "type" "ssecomi")
2806 (set_attr "prefix" "maybe_vex")
2807 (set_attr "prefix_rep" "0")
2808 (set (attr "prefix_data16")
2809 (if_then_else (eq_attr "mode" "DF")
2811 (const_string "0")))
2812 (set_attr "mode" "<MODE>")])
2814 (define_expand "vec_cmp<mode><avx512fmaskmodelower>"
2815 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
2816 (match_operator:<avx512fmaskmode> 1 ""
2817 [(match_operand:V48_AVX512VL 2 "register_operand")
2818 (match_operand:V48_AVX512VL 3 "nonimmediate_operand")]))]
2821 bool ok = ix86_expand_mask_vec_cmp (operands);
2826 (define_expand "vec_cmp<mode><avx512fmaskmodelower>"
2827 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
2828 (match_operator:<avx512fmaskmode> 1 ""
2829 [(match_operand:VI12_AVX512VL 2 "register_operand")
2830 (match_operand:VI12_AVX512VL 3 "nonimmediate_operand")]))]
2833 bool ok = ix86_expand_mask_vec_cmp (operands);
2838 (define_expand "vec_cmp<mode><sseintvecmodelower>"
2839 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2840 (match_operator:<sseintvecmode> 1 ""
2841 [(match_operand:VI_256 2 "register_operand")
2842 (match_operand:VI_256 3 "nonimmediate_operand")]))]
2845 bool ok = ix86_expand_int_vec_cmp (operands);
2850 (define_expand "vec_cmp<mode><sseintvecmodelower>"
2851 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2852 (match_operator:<sseintvecmode> 1 ""
2853 [(match_operand:VI124_128 2 "register_operand")
2854 (match_operand:VI124_128 3 "vector_operand")]))]
2857 bool ok = ix86_expand_int_vec_cmp (operands);
2862 (define_expand "vec_cmpv2div2di"
2863 [(set (match_operand:V2DI 0 "register_operand")
2864 (match_operator:V2DI 1 ""
2865 [(match_operand:V2DI 2 "register_operand")
2866 (match_operand:V2DI 3 "vector_operand")]))]
2869 bool ok = ix86_expand_int_vec_cmp (operands);
2874 (define_expand "vec_cmp<mode><sseintvecmodelower>"
2875 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2876 (match_operator:<sseintvecmode> 1 ""
2877 [(match_operand:VF_256 2 "register_operand")
2878 (match_operand:VF_256 3 "nonimmediate_operand")]))]
2881 bool ok = ix86_expand_fp_vec_cmp (operands);
2886 (define_expand "vec_cmp<mode><sseintvecmodelower>"
2887 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2888 (match_operator:<sseintvecmode> 1 ""
2889 [(match_operand:VF_128 2 "register_operand")
2890 (match_operand:VF_128 3 "vector_operand")]))]
2893 bool ok = ix86_expand_fp_vec_cmp (operands);
2898 (define_expand "vec_cmpu<mode><avx512fmaskmodelower>"
2899 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
2900 (match_operator:<avx512fmaskmode> 1 ""
2901 [(match_operand:VI48_AVX512VL 2 "register_operand")
2902 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand")]))]
2905 bool ok = ix86_expand_mask_vec_cmp (operands);
2910 (define_expand "vec_cmpu<mode><avx512fmaskmodelower>"
2911 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
2912 (match_operator:<avx512fmaskmode> 1 ""
2913 [(match_operand:VI12_AVX512VL 2 "register_operand")
2914 (match_operand:VI12_AVX512VL 3 "nonimmediate_operand")]))]
2917 bool ok = ix86_expand_mask_vec_cmp (operands);
2922 (define_expand "vec_cmpu<mode><sseintvecmodelower>"
2923 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2924 (match_operator:<sseintvecmode> 1 ""
2925 [(match_operand:VI_256 2 "register_operand")
2926 (match_operand:VI_256 3 "nonimmediate_operand")]))]
2929 bool ok = ix86_expand_int_vec_cmp (operands);
2934 (define_expand "vec_cmpu<mode><sseintvecmodelower>"
2935 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2936 (match_operator:<sseintvecmode> 1 ""
2937 [(match_operand:VI124_128 2 "register_operand")
2938 (match_operand:VI124_128 3 "vector_operand")]))]
2941 bool ok = ix86_expand_int_vec_cmp (operands);
2946 (define_expand "vec_cmpuv2div2di"
2947 [(set (match_operand:V2DI 0 "register_operand")
2948 (match_operator:V2DI 1 ""
2949 [(match_operand:V2DI 2 "register_operand")
2950 (match_operand:V2DI 3 "vector_operand")]))]
2953 bool ok = ix86_expand_int_vec_cmp (operands);
2958 (define_expand "vec_cmpeqv2div2di"
2959 [(set (match_operand:V2DI 0 "register_operand")
2960 (match_operator:V2DI 1 ""
2961 [(match_operand:V2DI 2 "register_operand")
2962 (match_operand:V2DI 3 "vector_operand")]))]
2965 bool ok = ix86_expand_int_vec_cmp (operands);
2970 (define_expand "vcond<V_512:mode><VF_512:mode>"
2971 [(set (match_operand:V_512 0 "register_operand")
2973 (match_operator 3 ""
2974 [(match_operand:VF_512 4 "nonimmediate_operand")
2975 (match_operand:VF_512 5 "nonimmediate_operand")])
2976 (match_operand:V_512 1 "general_operand")
2977 (match_operand:V_512 2 "general_operand")))]
2979 && (GET_MODE_NUNITS (<V_512:MODE>mode)
2980 == GET_MODE_NUNITS (<VF_512:MODE>mode))"
2982 bool ok = ix86_expand_fp_vcond (operands);
2987 (define_expand "vcond<V_256:mode><VF_256:mode>"
2988 [(set (match_operand:V_256 0 "register_operand")
2990 (match_operator 3 ""
2991 [(match_operand:VF_256 4 "nonimmediate_operand")
2992 (match_operand:VF_256 5 "nonimmediate_operand")])
2993 (match_operand:V_256 1 "general_operand")
2994 (match_operand:V_256 2 "general_operand")))]
2996 && (GET_MODE_NUNITS (<V_256:MODE>mode)
2997 == GET_MODE_NUNITS (<VF_256:MODE>mode))"
2999 bool ok = ix86_expand_fp_vcond (operands);
3004 (define_expand "vcond<V_128:mode><VF_128:mode>"
3005 [(set (match_operand:V_128 0 "register_operand")
3007 (match_operator 3 ""
3008 [(match_operand:VF_128 4 "vector_operand")
3009 (match_operand:VF_128 5 "vector_operand")])
3010 (match_operand:V_128 1 "general_operand")
3011 (match_operand:V_128 2 "general_operand")))]
3013 && (GET_MODE_NUNITS (<V_128:MODE>mode)
3014 == GET_MODE_NUNITS (<VF_128:MODE>mode))"
3016 bool ok = ix86_expand_fp_vcond (operands);
3021 (define_expand "vcond_mask_<mode><avx512fmaskmodelower>"
3022 [(set (match_operand:V48_AVX512VL 0 "register_operand")
3023 (vec_merge:V48_AVX512VL
3024 (match_operand:V48_AVX512VL 1 "nonimmediate_operand")
3025 (match_operand:V48_AVX512VL 2 "vector_move_operand")
3026 (match_operand:<avx512fmaskmode> 3 "register_operand")))]
3029 (define_expand "vcond_mask_<mode><avx512fmaskmodelower>"
3030 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
3031 (vec_merge:VI12_AVX512VL
3032 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand")
3033 (match_operand:VI12_AVX512VL 2 "vector_move_operand")
3034 (match_operand:<avx512fmaskmode> 3 "register_operand")))]
3037 (define_expand "vcond_mask_<mode><sseintvecmodelower>"
3038 [(set (match_operand:VI_256 0 "register_operand")
3040 (match_operand:VI_256 1 "nonimmediate_operand")
3041 (match_operand:VI_256 2 "vector_move_operand")
3042 (match_operand:<sseintvecmode> 3 "register_operand")))]
3045 ix86_expand_sse_movcc (operands[0], operands[3],
3046 operands[1], operands[2]);
3050 (define_expand "vcond_mask_<mode><sseintvecmodelower>"
3051 [(set (match_operand:VI124_128 0 "register_operand")
3052 (vec_merge:VI124_128
3053 (match_operand:VI124_128 1 "vector_operand")
3054 (match_operand:VI124_128 2 "vector_move_operand")
3055 (match_operand:<sseintvecmode> 3 "register_operand")))]
3058 ix86_expand_sse_movcc (operands[0], operands[3],
3059 operands[1], operands[2]);
3063 (define_expand "vcond_mask_v2div2di"
3064 [(set (match_operand:V2DI 0 "register_operand")
3066 (match_operand:V2DI 1 "vector_operand")
3067 (match_operand:V2DI 2 "vector_move_operand")
3068 (match_operand:V2DI 3 "register_operand")))]
3071 ix86_expand_sse_movcc (operands[0], operands[3],
3072 operands[1], operands[2]);
3076 (define_expand "vcond_mask_<mode><sseintvecmodelower>"
3077 [(set (match_operand:VF_256 0 "register_operand")
3079 (match_operand:VF_256 1 "nonimmediate_operand")
3080 (match_operand:VF_256 2 "vector_move_operand")
3081 (match_operand:<sseintvecmode> 3 "register_operand")))]
3084 ix86_expand_sse_movcc (operands[0], operands[3],
3085 operands[1], operands[2]);
3089 (define_expand "vcond_mask_<mode><sseintvecmodelower>"
3090 [(set (match_operand:VF_128 0 "register_operand")
3092 (match_operand:VF_128 1 "vector_operand")
3093 (match_operand:VF_128 2 "vector_move_operand")
3094 (match_operand:<sseintvecmode> 3 "register_operand")))]
3097 ix86_expand_sse_movcc (operands[0], operands[3],
3098 operands[1], operands[2]);
3102 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3104 ;; Parallel floating point logical operations
3106 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3108 (define_insn "<sse>_andnot<mode>3<mask_name>"
3109 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x,v,v")
3112 (match_operand:VF_128_256 1 "register_operand" "0,x,v,v"))
3113 (match_operand:VF_128_256 2 "vector_operand" "xBm,xm,vm,vm")))]
3114 "TARGET_SSE && <mask_avx512vl_condition>"
3116 static char buf[128];
3120 switch (which_alternative)
3123 ops = "andn%s\t{%%2, %%0|%%0, %%2}";
3128 ops = "vandn%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
3134 switch (get_attr_mode (insn))
3142 /* There is no vandnp[sd] in avx512f. Use vpandn[qd]. */
3143 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
3144 ops = "vpandn%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
3147 suffix = "<ssemodesuffix>";
3150 snprintf (buf, sizeof (buf), ops, suffix);
3153 [(set_attr "isa" "noavx,avx,avx512dq,avx512f")
3154 (set_attr "type" "sselog")
3155 (set_attr "prefix" "orig,maybe_vex,evex,evex")
3157 (cond [(and (match_test "<mask_applied>")
3158 (and (eq_attr "alternative" "1")
3159 (match_test "!TARGET_AVX512DQ")))
3160 (const_string "<sseintvecmode2>")
3161 (eq_attr "alternative" "3")
3162 (const_string "<sseintvecmode2>")
3163 (and (match_test "<MODE_SIZE> == 16")
3164 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
3165 (const_string "<ssePSmode>")
3166 (match_test "TARGET_AVX")
3167 (const_string "<MODE>")
3168 (match_test "optimize_function_for_size_p (cfun)")
3169 (const_string "V4SF")
3171 (const_string "<MODE>")))])
3174 (define_insn "<sse>_andnot<mode>3<mask_name>"
3175 [(set (match_operand:VF_512 0 "register_operand" "=v")
3178 (match_operand:VF_512 1 "register_operand" "v"))
3179 (match_operand:VF_512 2 "nonimmediate_operand" "vm")))]
3182 static char buf[128];
3186 suffix = "<ssemodesuffix>";
3189 /* There is no vandnp[sd] in avx512f. Use vpandn[qd]. */
3190 if (!TARGET_AVX512DQ)
3192 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
3196 snprintf (buf, sizeof (buf),
3197 "v%sandn%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}",
3201 [(set_attr "type" "sselog")
3202 (set_attr "prefix" "evex")
3204 (if_then_else (match_test "TARGET_AVX512DQ")
3205 (const_string "<sseinsnmode>")
3206 (const_string "XI")))])
3208 (define_expand "<code><mode>3<mask_name>"
3209 [(set (match_operand:VF_128_256 0 "register_operand")
3210 (any_logic:VF_128_256
3211 (match_operand:VF_128_256 1 "vector_operand")
3212 (match_operand:VF_128_256 2 "vector_operand")))]
3213 "TARGET_SSE && <mask_avx512vl_condition>"
3214 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
3216 (define_expand "<code><mode>3<mask_name>"
3217 [(set (match_operand:VF_512 0 "register_operand")
3219 (match_operand:VF_512 1 "nonimmediate_operand")
3220 (match_operand:VF_512 2 "nonimmediate_operand")))]
3222 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
3224 (define_insn "*<code><mode>3<mask_name>"
3225 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x,v,v")
3226 (any_logic:VF_128_256
3227 (match_operand:VF_128_256 1 "vector_operand" "%0,x,v,v")
3228 (match_operand:VF_128_256 2 "vector_operand" "xBm,xm,vm,vm")))]
3229 "TARGET_SSE && <mask_avx512vl_condition>
3230 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
3232 static char buf[128];
3236 switch (which_alternative)
3239 ops = "<logic>%s\t{%%2, %%0|%%0, %%2}";
3244 ops = "v<logic>%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
3250 switch (get_attr_mode (insn))
3258 /* There is no v<logic>p[sd] in avx512f. Use vp<logic>[qd]. */
3259 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
3260 ops = "vp<logic>%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
3263 suffix = "<ssemodesuffix>";
3266 snprintf (buf, sizeof (buf), ops, suffix);
3269 [(set_attr "isa" "noavx,avx,avx512dq,avx512f")
3270 (set_attr "type" "sselog")
3271 (set_attr "prefix" "orig,maybe_evex,evex,evex")
3273 (cond [(and (match_test "<mask_applied>")
3274 (and (eq_attr "alternative" "1")
3275 (match_test "!TARGET_AVX512DQ")))
3276 (const_string "<sseintvecmode2>")
3277 (eq_attr "alternative" "3")
3278 (const_string "<sseintvecmode2>")
3279 (and (match_test "<MODE_SIZE> == 16")
3280 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
3281 (const_string "<ssePSmode>")
3282 (match_test "TARGET_AVX")
3283 (const_string "<MODE>")
3284 (match_test "optimize_function_for_size_p (cfun)")
3285 (const_string "V4SF")
3287 (const_string "<MODE>")))])
3289 (define_insn "*<code><mode>3<mask_name>"
3290 [(set (match_operand:VF_512 0 "register_operand" "=v")
3292 (match_operand:VF_512 1 "nonimmediate_operand" "%v")
3293 (match_operand:VF_512 2 "nonimmediate_operand" "vm")))]
3294 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
3296 static char buf[128];
3300 suffix = "<ssemodesuffix>";
3303 /* There is no v<logic>p[sd] in avx512f. Use vp<logic>[dq]. */
3304 if (!TARGET_AVX512DQ)
3306 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
3310 snprintf (buf, sizeof (buf),
3311 "v%s<logic>%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}",
3315 [(set_attr "type" "sselog")
3316 (set_attr "prefix" "evex")
3318 (if_then_else (match_test "TARGET_AVX512DQ")
3319 (const_string "<sseinsnmode>")
3320 (const_string "XI")))])
3322 (define_expand "copysign<mode>3"
3325 (not:VF (match_dup 3))
3326 (match_operand:VF 1 "vector_operand")))
3328 (and:VF (match_dup 3)
3329 (match_operand:VF 2 "vector_operand")))
3330 (set (match_operand:VF 0 "register_operand")
3331 (ior:VF (match_dup 4) (match_dup 5)))]
3334 operands[3] = ix86_build_signbit_mask (<MODE>mode, 1, 0);
3336 operands[4] = gen_reg_rtx (<MODE>mode);
3337 operands[5] = gen_reg_rtx (<MODE>mode);
3340 ;; Also define scalar versions. These are used for abs, neg, and
3341 ;; conditional move. Using subregs into vector modes causes register
3342 ;; allocation lossage. These patterns do not allow memory operands
3343 ;; because the native instructions read the full 128-bits.
3345 (define_insn "*andnot<mode>3"
3346 [(set (match_operand:MODEF 0 "register_operand" "=x,x,v,v")
3349 (match_operand:MODEF 1 "register_operand" "0,x,v,v"))
3350 (match_operand:MODEF 2 "register_operand" "x,x,v,v")))]
3351 "SSE_FLOAT_MODE_P (<MODE>mode)"
3353 static char buf[128];
3356 = (get_attr_mode (insn) == MODE_V4SF) ? "ps" : "<ssevecmodesuffix>";
3358 switch (which_alternative)
3361 ops = "andn%s\t{%%2, %%0|%%0, %%2}";
3364 ops = "vandn%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3367 if (TARGET_AVX512DQ)
3368 ops = "vandn%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3371 suffix = <MODE>mode == DFmode ? "q" : "d";
3372 ops = "vpandn%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3376 if (TARGET_AVX512DQ)
3377 ops = "vandn%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3380 suffix = <MODE>mode == DFmode ? "q" : "d";
3381 ops = "vpandn%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3388 snprintf (buf, sizeof (buf), ops, suffix);
3391 [(set_attr "isa" "noavx,avx,avx512vl,avx512f")
3392 (set_attr "type" "sselog")
3393 (set_attr "prefix" "orig,vex,evex,evex")
3395 (cond [(eq_attr "alternative" "2")
3396 (if_then_else (match_test "TARGET_AVX512DQ")
3397 (const_string "<ssevecmode>")
3398 (const_string "TI"))
3399 (eq_attr "alternative" "3")
3400 (if_then_else (match_test "TARGET_AVX512DQ")
3401 (const_string "<avx512fvecmode>")
3402 (const_string "XI"))
3403 (and (match_test "<MODE_SIZE> == 16")
3404 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
3405 (const_string "V4SF")
3406 (match_test "TARGET_AVX")
3407 (const_string "<ssevecmode>")
3408 (match_test "optimize_function_for_size_p (cfun)")
3409 (const_string "V4SF")
3411 (const_string "<ssevecmode>")))])
3413 (define_insn "*andnottf3"
3414 [(set (match_operand:TF 0 "register_operand" "=x,x,v,v")
3416 (not:TF (match_operand:TF 1 "register_operand" "0,x,v,v"))
3417 (match_operand:TF 2 "vector_operand" "xBm,xm,vm,v")))]
3420 static char buf[128];
3423 = (which_alternative >= 2 ? "pandnq"
3424 : get_attr_mode (insn) == MODE_V4SF ? "andnps" : "pandn");
3426 switch (which_alternative)
3429 ops = "%s\t{%%2, %%0|%%0, %%2}";
3433 ops = "v%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3436 ops = "v%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3442 snprintf (buf, sizeof (buf), ops, tmp);
3445 [(set_attr "isa" "noavx,avx,avx512vl,avx512f")
3446 (set_attr "type" "sselog")
3447 (set (attr "prefix_data16")
3449 (and (eq_attr "alternative" "0")
3450 (eq_attr "mode" "TI"))
3452 (const_string "*")))
3453 (set_attr "prefix" "orig,vex,evex,evex")
3455 (cond [(eq_attr "alternative" "2")
3457 (eq_attr "alternative" "3")
3459 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
3460 (const_string "V4SF")
3461 (match_test "TARGET_AVX")
3463 (ior (not (match_test "TARGET_SSE2"))
3464 (match_test "optimize_function_for_size_p (cfun)"))
3465 (const_string "V4SF")
3467 (const_string "TI")))])
3469 (define_insn "*<code><mode>3"
3470 [(set (match_operand:MODEF 0 "register_operand" "=x,x,v,v")
3472 (match_operand:MODEF 1 "register_operand" "%0,x,v,v")
3473 (match_operand:MODEF 2 "register_operand" "x,x,v,v")))]
3474 "SSE_FLOAT_MODE_P (<MODE>mode)"
3476 static char buf[128];
3479 = (get_attr_mode (insn) == MODE_V4SF) ? "ps" : "<ssevecmodesuffix>";
3481 switch (which_alternative)
3484 ops = "<logic>%s\t{%%2, %%0|%%0, %%2}";
3487 if (!TARGET_AVX512DQ)
3489 suffix = <MODE>mode == DFmode ? "q" : "d";
3490 ops = "vp<logic>%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3495 ops = "v<logic>%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3498 if (TARGET_AVX512DQ)
3499 ops = "v<logic>%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3502 suffix = <MODE>mode == DFmode ? "q" : "d";
3503 ops = "vp<logic>%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3510 snprintf (buf, sizeof (buf), ops, suffix);
3513 [(set_attr "isa" "noavx,avx,avx512vl,avx512f")
3514 (set_attr "type" "sselog")
3515 (set_attr "prefix" "orig,vex,evex,evex")
3517 (cond [(eq_attr "alternative" "2")
3518 (if_then_else (match_test "TARGET_AVX512DQ")
3519 (const_string "<ssevecmode>")
3520 (const_string "TI"))
3521 (eq_attr "alternative" "3")
3522 (if_then_else (match_test "TARGET_AVX512DQ")
3523 (const_string "<avx512fvecmode>")
3524 (const_string "XI"))
3525 (and (match_test "<MODE_SIZE> == 16")
3526 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
3527 (const_string "V4SF")
3528 (match_test "TARGET_AVX")
3529 (const_string "<ssevecmode>")
3530 (match_test "optimize_function_for_size_p (cfun)")
3531 (const_string "V4SF")
3533 (const_string "<ssevecmode>")))])
3535 (define_expand "<code>tf3"
3536 [(set (match_operand:TF 0 "register_operand")
3538 (match_operand:TF 1 "vector_operand")
3539 (match_operand:TF 2 "vector_operand")))]
3541 "ix86_fixup_binary_operands_no_copy (<CODE>, TFmode, operands);")
3543 (define_insn "*<code>tf3"
3544 [(set (match_operand:TF 0 "register_operand" "=x,x,v,v")
3546 (match_operand:TF 1 "vector_operand" "%0,x,v,v")
3547 (match_operand:TF 2 "vector_operand" "xBm,xm,vm,v")))]
3548 "TARGET_SSE && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
3550 static char buf[128];
3553 = (which_alternative >= 2 ? "p<logic>q"
3554 : get_attr_mode (insn) == MODE_V4SF ? "<logic>ps" : "p<logic>");
3556 switch (which_alternative)
3559 ops = "%s\t{%%2, %%0|%%0, %%2}";
3563 ops = "v%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3566 ops = "v%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3572 snprintf (buf, sizeof (buf), ops, tmp);
3575 [(set_attr "isa" "noavx,avx,avx512vl,avx512f")
3576 (set_attr "type" "sselog")
3577 (set (attr "prefix_data16")
3579 (and (eq_attr "alternative" "0")
3580 (eq_attr "mode" "TI"))
3582 (const_string "*")))
3583 (set_attr "prefix" "orig,vex,evex,evex")
3585 (cond [(eq_attr "alternative" "2")
3587 (eq_attr "alternative" "3")
3589 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
3590 (const_string "V4SF")
3591 (match_test "TARGET_AVX")
3593 (ior (not (match_test "TARGET_SSE2"))
3594 (match_test "optimize_function_for_size_p (cfun)"))
3595 (const_string "V4SF")
3597 (const_string "TI")))])
3599 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3601 ;; FMA floating point multiply/accumulate instructions. These include
3602 ;; scalar versions of the instructions as well as vector versions.
3604 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3606 ;; The standard names for scalar FMA are only available with SSE math enabled.
3607 ;; CPUID bit AVX512F enables evex encoded scalar and 512-bit fma. It doesn't
3608 ;; care about FMA bit, so we enable fma for TARGET_AVX512F even when TARGET_FMA
3609 ;; and TARGET_FMA4 are both false.
3610 ;; TODO: In theory AVX512F does not automatically imply FMA, and without FMA
3611 ;; one must force the EVEX encoding of the fma insns. Ideally we'd improve
3612 ;; GAS to allow proper prefix selection. However, for the moment all hardware
3613 ;; that supports AVX512F also supports FMA so we can ignore this for now.
3614 (define_mode_iterator FMAMODEM
3615 [(SF "TARGET_SSE_MATH && (TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F)")
3616 (DF "TARGET_SSE_MATH && (TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F)")
3617 (V4SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3618 (V2DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3619 (V8SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3620 (V4DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3621 (V16SF "TARGET_AVX512F")
3622 (V8DF "TARGET_AVX512F")])
3624 (define_expand "fma<mode>4"
3625 [(set (match_operand:FMAMODEM 0 "register_operand")
3627 (match_operand:FMAMODEM 1 "nonimmediate_operand")
3628 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3629 (match_operand:FMAMODEM 3 "nonimmediate_operand")))])
3631 (define_expand "fms<mode>4"
3632 [(set (match_operand:FMAMODEM 0 "register_operand")
3634 (match_operand:FMAMODEM 1 "nonimmediate_operand")
3635 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3636 (neg:FMAMODEM (match_operand:FMAMODEM 3 "nonimmediate_operand"))))])
3638 (define_expand "fnma<mode>4"
3639 [(set (match_operand:FMAMODEM 0 "register_operand")
3641 (neg:FMAMODEM (match_operand:FMAMODEM 1 "nonimmediate_operand"))
3642 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3643 (match_operand:FMAMODEM 3 "nonimmediate_operand")))])
3645 (define_expand "fnms<mode>4"
3646 [(set (match_operand:FMAMODEM 0 "register_operand")
3648 (neg:FMAMODEM (match_operand:FMAMODEM 1 "nonimmediate_operand"))
3649 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3650 (neg:FMAMODEM (match_operand:FMAMODEM 3 "nonimmediate_operand"))))])
3652 ;; The builtins for intrinsics are not constrained by SSE math enabled.
3653 (define_mode_iterator FMAMODE_AVX512
3654 [(SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F")
3655 (DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F")
3656 (V4SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3657 (V2DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3658 (V8SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3659 (V4DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3660 (V16SF "TARGET_AVX512F")
3661 (V8DF "TARGET_AVX512F")])
3663 (define_mode_iterator FMAMODE
3664 [SF DF V4SF V2DF V8SF V4DF])
3666 (define_expand "fma4i_fmadd_<mode>"
3667 [(set (match_operand:FMAMODE_AVX512 0 "register_operand")
3669 (match_operand:FMAMODE_AVX512 1 "nonimmediate_operand")
3670 (match_operand:FMAMODE_AVX512 2 "nonimmediate_operand")
3671 (match_operand:FMAMODE_AVX512 3 "nonimmediate_operand")))])
3673 (define_expand "<avx512>_fmadd_<mode>_maskz<round_expand_name>"
3674 [(match_operand:VF_AVX512VL 0 "register_operand")
3675 (match_operand:VF_AVX512VL 1 "<round_expand_nimm_predicate>")
3676 (match_operand:VF_AVX512VL 2 "<round_expand_nimm_predicate>")
3677 (match_operand:VF_AVX512VL 3 "<round_expand_nimm_predicate>")
3678 (match_operand:<avx512fmaskmode> 4 "register_operand")]
3679 "TARGET_AVX512F && <round_mode512bit_condition>"
3681 emit_insn (gen_fma_fmadd_<mode>_maskz_1<round_expand_name> (
3682 operands[0], operands[1], operands[2], operands[3],
3683 CONST0_RTX (<MODE>mode), operands[4]<round_expand_operand>));
3687 (define_insn "*fma_fmadd_<mode>"
3688 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
3690 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x")
3691 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
3692 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x")))]
3693 "TARGET_FMA || TARGET_FMA4"
3695 vfmadd132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
3696 vfmadd213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
3697 vfmadd231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
3698 vfmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3699 vfmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3700 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3701 (set_attr "type" "ssemuladd")
3702 (set_attr "mode" "<MODE>")])
3704 ;; Suppose AVX-512F as baseline
3705 (define_mode_iterator VF_SF_AVX512VL
3706 [SF V16SF (V8SF "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
3707 DF V8DF (V4DF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
3709 (define_insn "<sd_mask_codefor>fma_fmadd_<mode><sd_maskz_name><round_name>"
3710 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3712 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
3713 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3714 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0")))]
3715 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3717 vfmadd132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3718 vfmadd213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3719 vfmadd231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
3720 [(set_attr "type" "ssemuladd")
3721 (set_attr "mode" "<MODE>")])
3723 (define_insn "<avx512>_fmadd_<mode>_mask<round_name>"
3724 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
3725 (vec_merge:VF_AVX512VL
3727 (match_operand:VF_AVX512VL 1 "register_operand" "0,0")
3728 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
3729 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>"))
3731 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
3732 "TARGET_AVX512F && <round_mode512bit_condition>"
3734 vfmadd132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
3735 vfmadd213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
3736 [(set_attr "type" "ssemuladd")
3737 (set_attr "mode" "<MODE>")])
3739 (define_insn "<avx512>_fmadd_<mode>_mask3<round_name>"
3740 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
3741 (vec_merge:VF_AVX512VL
3743 (match_operand:VF_AVX512VL 1 "register_operand" "v")
3744 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
3745 (match_operand:VF_AVX512VL 3 "register_operand" "0"))
3747 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
3749 "vfmadd231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
3750 [(set_attr "type" "ssemuladd")
3751 (set_attr "mode" "<MODE>")])
3753 (define_insn "*fma_fmsub_<mode>"
3754 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
3756 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x")
3757 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
3759 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x"))))]
3760 "TARGET_FMA || TARGET_FMA4"
3762 vfmsub132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
3763 vfmsub213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
3764 vfmsub231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
3765 vfmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3766 vfmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3767 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3768 (set_attr "type" "ssemuladd")
3769 (set_attr "mode" "<MODE>")])
3771 (define_insn "<sd_mask_codefor>fma_fmsub_<mode><sd_maskz_name><round_name>"
3772 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3774 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
3775 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3777 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0"))))]
3778 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3780 vfmsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3781 vfmsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3782 vfmsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
3783 [(set_attr "type" "ssemuladd")
3784 (set_attr "mode" "<MODE>")])
3786 (define_insn "<avx512>_fmsub_<mode>_mask<round_name>"
3787 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
3788 (vec_merge:VF_AVX512VL
3790 (match_operand:VF_AVX512VL 1 "register_operand" "0,0")
3791 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
3793 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>")))
3795 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
3798 vfmsub132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
3799 vfmsub213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
3800 [(set_attr "type" "ssemuladd")
3801 (set_attr "mode" "<MODE>")])
3803 (define_insn "<avx512>_fmsub_<mode>_mask3<round_name>"
3804 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
3805 (vec_merge:VF_AVX512VL
3807 (match_operand:VF_AVX512VL 1 "register_operand" "v")
3808 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
3810 (match_operand:VF_AVX512VL 3 "register_operand" "0")))
3812 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
3813 "TARGET_AVX512F && <round_mode512bit_condition>"
3814 "vfmsub231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
3815 [(set_attr "type" "ssemuladd")
3816 (set_attr "mode" "<MODE>")])
3818 (define_insn "*fma_fnmadd_<mode>"
3819 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
3822 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x"))
3823 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
3824 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x")))]
3825 "TARGET_FMA || TARGET_FMA4"
3827 vfnmadd132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
3828 vfnmadd213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
3829 vfnmadd231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
3830 vfnmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3831 vfnmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3832 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3833 (set_attr "type" "ssemuladd")
3834 (set_attr "mode" "<MODE>")])
3836 (define_insn "<sd_mask_codefor>fma_fnmadd_<mode><sd_maskz_name><round_name>"
3837 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3840 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v"))
3841 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3842 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0")))]
3843 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3845 vfnmadd132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3846 vfnmadd213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3847 vfnmadd231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
3848 [(set_attr "type" "ssemuladd")
3849 (set_attr "mode" "<MODE>")])
3851 (define_insn "<avx512>_fnmadd_<mode>_mask<round_name>"
3852 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
3853 (vec_merge:VF_AVX512VL
3856 (match_operand:VF_AVX512VL 1 "register_operand" "0,0"))
3857 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
3858 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>"))
3860 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
3861 "TARGET_AVX512F && <round_mode512bit_condition>"
3863 vfnmadd132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
3864 vfnmadd213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
3865 [(set_attr "type" "ssemuladd")
3866 (set_attr "mode" "<MODE>")])
3868 (define_insn "<avx512>_fnmadd_<mode>_mask3<round_name>"
3869 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
3870 (vec_merge:VF_AVX512VL
3873 (match_operand:VF_AVX512VL 1 "register_operand" "v"))
3874 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
3875 (match_operand:VF_AVX512VL 3 "register_operand" "0"))
3877 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
3878 "TARGET_AVX512F && <round_mode512bit_condition>"
3879 "vfnmadd231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
3880 [(set_attr "type" "ssemuladd")
3881 (set_attr "mode" "<MODE>")])
3883 (define_insn "*fma_fnmsub_<mode>"
3884 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
3887 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x"))
3888 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
3890 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x"))))]
3891 "TARGET_FMA || TARGET_FMA4"
3893 vfnmsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3894 vfnmsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3895 vfnmsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}
3896 vfnmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3897 vfnmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3898 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3899 (set_attr "type" "ssemuladd")
3900 (set_attr "mode" "<MODE>")])
3902 (define_insn "<sd_mask_codefor>fma_fnmsub_<mode><sd_maskz_name><round_name>"
3903 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3906 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v"))
3907 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3909 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0"))))]
3910 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3912 vfnmsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3913 vfnmsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3914 vfnmsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
3915 [(set_attr "type" "ssemuladd")
3916 (set_attr "mode" "<MODE>")])
3918 (define_insn "<avx512>_fnmsub_<mode>_mask<round_name>"
3919 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
3920 (vec_merge:VF_AVX512VL
3923 (match_operand:VF_AVX512VL 1 "register_operand" "0,0"))
3924 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
3926 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>")))
3928 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
3929 "TARGET_AVX512F && <round_mode512bit_condition>"
3931 vfnmsub132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
3932 vfnmsub213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
3933 [(set_attr "type" "ssemuladd")
3934 (set_attr "mode" "<MODE>")])
3936 (define_insn "<avx512>_fnmsub_<mode>_mask3<round_name>"
3937 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
3938 (vec_merge:VF_AVX512VL
3941 (match_operand:VF_AVX512VL 1 "register_operand" "v"))
3942 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
3944 (match_operand:VF_AVX512VL 3 "register_operand" "0")))
3946 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
3948 "vfnmsub231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
3949 [(set_attr "type" "ssemuladd")
3950 (set_attr "mode" "<MODE>")])
3952 ;; FMA parallel floating point multiply addsub and subadd operations.
3954 ;; It would be possible to represent these without the UNSPEC as
3957 ;; (fma op1 op2 op3)
3958 ;; (fma op1 op2 (neg op3))
3961 ;; But this doesn't seem useful in practice.
3963 (define_expand "fmaddsub_<mode>"
3964 [(set (match_operand:VF 0 "register_operand")
3966 [(match_operand:VF 1 "nonimmediate_operand")
3967 (match_operand:VF 2 "nonimmediate_operand")
3968 (match_operand:VF 3 "nonimmediate_operand")]
3970 "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F")
3972 (define_expand "<avx512>_fmaddsub_<mode>_maskz<round_expand_name>"
3973 [(match_operand:VF_AVX512VL 0 "register_operand")
3974 (match_operand:VF_AVX512VL 1 "<round_expand_nimm_predicate>")
3975 (match_operand:VF_AVX512VL 2 "<round_expand_nimm_predicate>")
3976 (match_operand:VF_AVX512VL 3 "<round_expand_nimm_predicate>")
3977 (match_operand:<avx512fmaskmode> 4 "register_operand")]
3980 emit_insn (gen_fma_fmaddsub_<mode>_maskz_1<round_expand_name> (
3981 operands[0], operands[1], operands[2], operands[3],
3982 CONST0_RTX (<MODE>mode), operands[4]<round_expand_operand>));
3986 (define_insn "*fma_fmaddsub_<mode>"
3987 [(set (match_operand:VF_128_256 0 "register_operand" "=v,v,v,x,x")
3989 [(match_operand:VF_128_256 1 "nonimmediate_operand" "%0,0,v,x,x")
3990 (match_operand:VF_128_256 2 "nonimmediate_operand" "vm,v,vm,x,m")
3991 (match_operand:VF_128_256 3 "nonimmediate_operand" "v,vm,0,xm,x")]
3993 "TARGET_FMA || TARGET_FMA4"
3995 vfmaddsub132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
3996 vfmaddsub213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
3997 vfmaddsub231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
3998 vfmaddsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3999 vfmaddsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
4000 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
4001 (set_attr "type" "ssemuladd")
4002 (set_attr "mode" "<MODE>")])
4004 (define_insn "<sd_mask_codefor>fma_fmaddsub_<mode><sd_maskz_name><round_name>"
4005 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
4006 (unspec:VF_SF_AVX512VL
4007 [(match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
4008 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
4009 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0")]
4011 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
4013 vfmaddsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
4014 vfmaddsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
4015 vfmaddsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
4016 [(set_attr "type" "ssemuladd")
4017 (set_attr "mode" "<MODE>")])
4019 (define_insn "<avx512>_fmaddsub_<mode>_mask<round_name>"
4020 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
4021 (vec_merge:VF_AVX512VL
4023 [(match_operand:VF_AVX512VL 1 "register_operand" "0,0")
4024 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
4025 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>")]
4028 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
4031 vfmaddsub132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
4032 vfmaddsub213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
4033 [(set_attr "type" "ssemuladd")
4034 (set_attr "mode" "<MODE>")])
4036 (define_insn "<avx512>_fmaddsub_<mode>_mask3<round_name>"
4037 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
4038 (vec_merge:VF_AVX512VL
4040 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
4041 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
4042 (match_operand:VF_AVX512VL 3 "register_operand" "0")]
4045 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
4047 "vfmaddsub231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
4048 [(set_attr "type" "ssemuladd")
4049 (set_attr "mode" "<MODE>")])
4051 (define_insn "*fma_fmsubadd_<mode>"
4052 [(set (match_operand:VF_128_256 0 "register_operand" "=v,v,v,x,x")
4054 [(match_operand:VF_128_256 1 "nonimmediate_operand" "%0,0,v,x,x")
4055 (match_operand:VF_128_256 2 "nonimmediate_operand" "vm,v,vm,x,m")
4057 (match_operand:VF_128_256 3 "nonimmediate_operand" "v,vm,0,xm,x"))]
4059 "TARGET_FMA || TARGET_FMA4"
4061 vfmsubadd132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
4062 vfmsubadd213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
4063 vfmsubadd231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
4064 vfmsubadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
4065 vfmsubadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
4066 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
4067 (set_attr "type" "ssemuladd")
4068 (set_attr "mode" "<MODE>")])
4070 (define_insn "<sd_mask_codefor>fma_fmsubadd_<mode><sd_maskz_name><round_name>"
4071 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
4072 (unspec:VF_SF_AVX512VL
4073 [(match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
4074 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
4076 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0"))]
4078 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
4080 vfmsubadd132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
4081 vfmsubadd213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
4082 vfmsubadd231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
4083 [(set_attr "type" "ssemuladd")
4084 (set_attr "mode" "<MODE>")])
4086 (define_insn "<avx512>_fmsubadd_<mode>_mask<round_name>"
4087 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
4088 (vec_merge:VF_AVX512VL
4090 [(match_operand:VF_AVX512VL 1 "register_operand" "0,0")
4091 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
4093 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>"))]
4096 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
4099 vfmsubadd132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
4100 vfmsubadd213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
4101 [(set_attr "type" "ssemuladd")
4102 (set_attr "mode" "<MODE>")])
4104 (define_insn "<avx512>_fmsubadd_<mode>_mask3<round_name>"
4105 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
4106 (vec_merge:VF_AVX512VL
4108 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
4109 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
4111 (match_operand:VF_AVX512VL 3 "register_operand" "0"))]
4114 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
4116 "vfmsubadd231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
4117 [(set_attr "type" "ssemuladd")
4118 (set_attr "mode" "<MODE>")])
4120 ;; FMA3 floating point scalar intrinsics. These merge result with
4121 ;; high-order elements from the destination register.
4123 (define_expand "fmai_vmfmadd_<mode><round_name>"
4124 [(set (match_operand:VF_128 0 "register_operand")
4127 (match_operand:VF_128 1 "<round_nimm_predicate>")
4128 (match_operand:VF_128 2 "<round_nimm_predicate>")
4129 (match_operand:VF_128 3 "<round_nimm_predicate>"))
4134 (define_insn "*fmai_fmadd_<mode>"
4135 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4138 (match_operand:VF_128 1 "<round_nimm_predicate>" " 0, 0")
4139 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>, v")
4140 (match_operand:VF_128 3 "<round_nimm_predicate>" " v,<round_constraint>"))
4143 "TARGET_FMA || TARGET_AVX512F"
4145 vfmadd132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
4146 vfmadd213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
4147 [(set_attr "type" "ssemuladd")
4148 (set_attr "mode" "<MODE>")])
4150 (define_insn "*fmai_fmsub_<mode>"
4151 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4154 (match_operand:VF_128 1 "<round_nimm_predicate>" "0,0")
4155 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>,v")
4157 (match_operand:VF_128 3 "<round_nimm_predicate>" " v,<round_constraint>")))
4160 "TARGET_FMA || TARGET_AVX512F"
4162 vfmsub132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
4163 vfmsub213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
4164 [(set_attr "type" "ssemuladd")
4165 (set_attr "mode" "<MODE>")])
4167 (define_insn "*fmai_fnmadd_<mode><round_name>"
4168 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4172 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>,v"))
4173 (match_operand:VF_128 1 "<round_nimm_predicate>" "0,0")
4174 (match_operand:VF_128 3 "<round_nimm_predicate>" "v,<round_constraint>"))
4177 "TARGET_FMA || TARGET_AVX512F"
4179 vfnmadd132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
4180 vfnmadd213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
4181 [(set_attr "type" "ssemuladd")
4182 (set_attr "mode" "<MODE>")])
4184 (define_insn "*fmai_fnmsub_<mode><round_name>"
4185 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4189 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>, v"))
4190 (match_operand:VF_128 1 "<round_nimm_predicate>" " 0, 0")
4192 (match_operand:VF_128 3 "<round_nimm_predicate>" " v,<round_constraint>")))
4195 "TARGET_FMA || TARGET_AVX512F"
4197 vfnmsub132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
4198 vfnmsub213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
4199 [(set_attr "type" "ssemuladd")
4200 (set_attr "mode" "<MODE>")])
4202 ;; FMA4 floating point scalar intrinsics. These write the
4203 ;; entire destination register, with the high-order elements zeroed.
4205 (define_expand "fma4i_vmfmadd_<mode>"
4206 [(set (match_operand:VF_128 0 "register_operand")
4209 (match_operand:VF_128 1 "nonimmediate_operand")
4210 (match_operand:VF_128 2 "nonimmediate_operand")
4211 (match_operand:VF_128 3 "nonimmediate_operand"))
4215 "operands[4] = CONST0_RTX (<MODE>mode);")
4217 (define_insn "*fma4i_vmfmadd_<mode>"
4218 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
4221 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x")
4222 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
4223 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x"))
4224 (match_operand:VF_128 4 "const0_operand")
4227 "vfmadd<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
4228 [(set_attr "type" "ssemuladd")
4229 (set_attr "mode" "<MODE>")])
4231 (define_insn "*fma4i_vmfmsub_<mode>"
4232 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
4235 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x")
4236 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
4238 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x")))
4239 (match_operand:VF_128 4 "const0_operand")
4242 "vfmsub<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
4243 [(set_attr "type" "ssemuladd")
4244 (set_attr "mode" "<MODE>")])
4246 (define_insn "*fma4i_vmfnmadd_<mode>"
4247 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
4251 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x"))
4252 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
4253 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x"))
4254 (match_operand:VF_128 4 "const0_operand")
4257 "vfnmadd<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
4258 [(set_attr "type" "ssemuladd")
4259 (set_attr "mode" "<MODE>")])
4261 (define_insn "*fma4i_vmfnmsub_<mode>"
4262 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
4266 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x"))
4267 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
4269 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x")))
4270 (match_operand:VF_128 4 "const0_operand")
4273 "vfnmsub<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
4274 [(set_attr "type" "ssemuladd")
4275 (set_attr "mode" "<MODE>")])
4277 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4279 ;; Parallel single-precision floating point conversion operations
4281 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4283 (define_insn "sse_cvtpi2ps"
4284 [(set (match_operand:V4SF 0 "register_operand" "=x")
4287 (float:V2SF (match_operand:V2SI 2 "nonimmediate_operand" "ym")))
4288 (match_operand:V4SF 1 "register_operand" "0")
4291 "cvtpi2ps\t{%2, %0|%0, %2}"
4292 [(set_attr "type" "ssecvt")
4293 (set_attr "mode" "V4SF")])
4295 (define_insn "sse_cvtps2pi"
4296 [(set (match_operand:V2SI 0 "register_operand" "=y")
4298 (unspec:V4SI [(match_operand:V4SF 1 "nonimmediate_operand" "xm")]
4300 (parallel [(const_int 0) (const_int 1)])))]
4302 "cvtps2pi\t{%1, %0|%0, %q1}"
4303 [(set_attr "type" "ssecvt")
4304 (set_attr "unit" "mmx")
4305 (set_attr "mode" "DI")])
4307 (define_insn "sse_cvttps2pi"
4308 [(set (match_operand:V2SI 0 "register_operand" "=y")
4310 (fix:V4SI (match_operand:V4SF 1 "nonimmediate_operand" "xm"))
4311 (parallel [(const_int 0) (const_int 1)])))]
4313 "cvttps2pi\t{%1, %0|%0, %q1}"
4314 [(set_attr "type" "ssecvt")
4315 (set_attr "unit" "mmx")
4316 (set_attr "prefix_rep" "0")
4317 (set_attr "mode" "SF")])
4319 (define_insn "sse_cvtsi2ss<round_name>"
4320 [(set (match_operand:V4SF 0 "register_operand" "=x,x,v")
4323 (float:SF (match_operand:SI 2 "<round_nimm_scalar_predicate>" "r,m,<round_constraint3>")))
4324 (match_operand:V4SF 1 "register_operand" "0,0,v")
4328 cvtsi2ss\t{%2, %0|%0, %2}
4329 cvtsi2ss\t{%2, %0|%0, %2}
4330 vcvtsi2ss\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4331 [(set_attr "isa" "noavx,noavx,avx")
4332 (set_attr "type" "sseicvt")
4333 (set_attr "athlon_decode" "vector,double,*")
4334 (set_attr "amdfam10_decode" "vector,double,*")
4335 (set_attr "bdver1_decode" "double,direct,*")
4336 (set_attr "btver2_decode" "double,double,double")
4337 (set_attr "znver1_decode" "double,double,double")
4338 (set_attr "prefix" "orig,orig,maybe_evex")
4339 (set_attr "mode" "SF")])
4341 (define_insn "sse_cvtsi2ssq<round_name>"
4342 [(set (match_operand:V4SF 0 "register_operand" "=x,x,v")
4345 (float:SF (match_operand:DI 2 "<round_nimm_scalar_predicate>" "r,m,<round_constraint3>")))
4346 (match_operand:V4SF 1 "register_operand" "0,0,v")
4348 "TARGET_SSE && TARGET_64BIT"
4350 cvtsi2ssq\t{%2, %0|%0, %2}
4351 cvtsi2ssq\t{%2, %0|%0, %2}
4352 vcvtsi2ssq\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4353 [(set_attr "isa" "noavx,noavx,avx")
4354 (set_attr "type" "sseicvt")
4355 (set_attr "athlon_decode" "vector,double,*")
4356 (set_attr "amdfam10_decode" "vector,double,*")
4357 (set_attr "bdver1_decode" "double,direct,*")
4358 (set_attr "btver2_decode" "double,double,double")
4359 (set_attr "length_vex" "*,*,4")
4360 (set_attr "prefix_rex" "1,1,*")
4361 (set_attr "prefix" "orig,orig,maybe_evex")
4362 (set_attr "mode" "SF")])
4364 (define_insn "sse_cvtss2si<round_name>"
4365 [(set (match_operand:SI 0 "register_operand" "=r,r")
4368 (match_operand:V4SF 1 "<round_nimm_scalar_predicate>" "v,<round_constraint2>")
4369 (parallel [(const_int 0)]))]
4370 UNSPEC_FIX_NOTRUNC))]
4372 "%vcvtss2si\t{<round_op2>%1, %0|%0, %k1<round_op2>}"
4373 [(set_attr "type" "sseicvt")
4374 (set_attr "athlon_decode" "double,vector")
4375 (set_attr "bdver1_decode" "double,double")
4376 (set_attr "prefix_rep" "1")
4377 (set_attr "prefix" "maybe_vex")
4378 (set_attr "mode" "SI")])
4380 (define_insn "sse_cvtss2si_2"
4381 [(set (match_operand:SI 0 "register_operand" "=r,r")
4382 (unspec:SI [(match_operand:SF 1 "nonimmediate_operand" "v,m")]
4383 UNSPEC_FIX_NOTRUNC))]
4385 "%vcvtss2si\t{%1, %0|%0, %k1}"
4386 [(set_attr "type" "sseicvt")
4387 (set_attr "athlon_decode" "double,vector")
4388 (set_attr "amdfam10_decode" "double,double")
4389 (set_attr "bdver1_decode" "double,double")
4390 (set_attr "prefix_rep" "1")
4391 (set_attr "prefix" "maybe_vex")
4392 (set_attr "mode" "SI")])
4394 (define_insn "sse_cvtss2siq<round_name>"
4395 [(set (match_operand:DI 0 "register_operand" "=r,r")
4398 (match_operand:V4SF 1 "<round_nimm_scalar_predicate>" "v,<round_constraint2>")
4399 (parallel [(const_int 0)]))]
4400 UNSPEC_FIX_NOTRUNC))]
4401 "TARGET_SSE && TARGET_64BIT"
4402 "%vcvtss2si{q}\t{<round_op2>%1, %0|%0, %k1<round_op2>}"
4403 [(set_attr "type" "sseicvt")
4404 (set_attr "athlon_decode" "double,vector")
4405 (set_attr "bdver1_decode" "double,double")
4406 (set_attr "prefix_rep" "1")
4407 (set_attr "prefix" "maybe_vex")
4408 (set_attr "mode" "DI")])
4410 (define_insn "sse_cvtss2siq_2"
4411 [(set (match_operand:DI 0 "register_operand" "=r,r")
4412 (unspec:DI [(match_operand:SF 1 "nonimmediate_operand" "v,m")]
4413 UNSPEC_FIX_NOTRUNC))]
4414 "TARGET_SSE && TARGET_64BIT"
4415 "%vcvtss2si{q}\t{%1, %0|%0, %k1}"
4416 [(set_attr "type" "sseicvt")
4417 (set_attr "athlon_decode" "double,vector")
4418 (set_attr "amdfam10_decode" "double,double")
4419 (set_attr "bdver1_decode" "double,double")
4420 (set_attr "prefix_rep" "1")
4421 (set_attr "prefix" "maybe_vex")
4422 (set_attr "mode" "DI")])
4424 (define_insn "sse_cvttss2si<round_saeonly_name>"
4425 [(set (match_operand:SI 0 "register_operand" "=r,r")
4428 (match_operand:V4SF 1 "<round_saeonly_nimm_scalar_predicate>" "v,<round_saeonly_constraint2>")
4429 (parallel [(const_int 0)]))))]
4431 "%vcvttss2si\t{<round_saeonly_op2>%1, %0|%0, %k1<round_saeonly_op2>}"
4432 [(set_attr "type" "sseicvt")
4433 (set_attr "athlon_decode" "double,vector")
4434 (set_attr "amdfam10_decode" "double,double")
4435 (set_attr "bdver1_decode" "double,double")
4436 (set_attr "prefix_rep" "1")
4437 (set_attr "prefix" "maybe_vex")
4438 (set_attr "mode" "SI")])
4440 (define_insn "sse_cvttss2siq<round_saeonly_name>"
4441 [(set (match_operand:DI 0 "register_operand" "=r,r")
4444 (match_operand:V4SF 1 "<round_saeonly_nimm_scalar_predicate>" "v,<round_saeonly_constraint>")
4445 (parallel [(const_int 0)]))))]
4446 "TARGET_SSE && TARGET_64BIT"
4447 "%vcvttss2si{q}\t{<round_saeonly_op2>%1, %0|%0, %k1<round_saeonly_op2>}"
4448 [(set_attr "type" "sseicvt")
4449 (set_attr "athlon_decode" "double,vector")
4450 (set_attr "amdfam10_decode" "double,double")
4451 (set_attr "bdver1_decode" "double,double")
4452 (set_attr "prefix_rep" "1")
4453 (set_attr "prefix" "maybe_vex")
4454 (set_attr "mode" "DI")])
4456 (define_insn "cvtusi2<ssescalarmodesuffix>32<round_name>"
4457 [(set (match_operand:VF_128 0 "register_operand" "=v")
4459 (vec_duplicate:VF_128
4460 (unsigned_float:<ssescalarmode>
4461 (match_operand:SI 2 "<round_nimm_predicate>" "<round_constraint3>")))
4462 (match_operand:VF_128 1 "register_operand" "v")
4464 "TARGET_AVX512F && <round_modev4sf_condition>"
4465 "vcvtusi2<ssescalarmodesuffix>\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4466 [(set_attr "type" "sseicvt")
4467 (set_attr "prefix" "evex")
4468 (set_attr "mode" "<ssescalarmode>")])
4470 (define_insn "cvtusi2<ssescalarmodesuffix>64<round_name>"
4471 [(set (match_operand:VF_128 0 "register_operand" "=v")
4473 (vec_duplicate:VF_128
4474 (unsigned_float:<ssescalarmode>
4475 (match_operand:DI 2 "<round_nimm_predicate>" "<round_constraint3>")))
4476 (match_operand:VF_128 1 "register_operand" "v")
4478 "TARGET_AVX512F && TARGET_64BIT"
4479 "vcvtusi2<ssescalarmodesuffix>\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4480 [(set_attr "type" "sseicvt")
4481 (set_attr "prefix" "evex")
4482 (set_attr "mode" "<ssescalarmode>")])
4484 (define_insn "float<sseintvecmodelower><mode>2<mask_name><round_name>"
4485 [(set (match_operand:VF1 0 "register_operand" "=x,v")
4487 (match_operand:<sseintvecmode> 1 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
4488 "TARGET_SSE2 && <mask_mode512bit_condition> && <round_mode512bit_condition>"
4490 cvtdq2ps\t{%1, %0|%0, %1}
4491 vcvtdq2ps\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4492 [(set_attr "isa" "noavx,avx")
4493 (set_attr "type" "ssecvt")
4494 (set_attr "prefix" "maybe_vex")
4495 (set_attr "mode" "<sseinsnmode>")])
4497 (define_insn "ufloat<sseintvecmodelower><mode>2<mask_name><round_name>"
4498 [(set (match_operand:VF1_AVX512VL 0 "register_operand" "=v")
4499 (unsigned_float:VF1_AVX512VL
4500 (match_operand:<sseintvecmode> 1 "nonimmediate_operand" "<round_constraint>")))]
4502 "vcvtudq2ps\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4503 [(set_attr "type" "ssecvt")
4504 (set_attr "prefix" "evex")
4505 (set_attr "mode" "<MODE>")])
4507 (define_expand "floatuns<sseintvecmodelower><mode>2"
4508 [(match_operand:VF1 0 "register_operand")
4509 (match_operand:<sseintvecmode> 1 "register_operand")]
4510 "TARGET_SSE2 && (<MODE>mode == V4SFmode || TARGET_AVX2)"
4512 if (<MODE>mode == V16SFmode)
4513 emit_insn (gen_ufloatv16siv16sf2 (operands[0], operands[1]));
4515 if (TARGET_AVX512VL)
4517 if (<MODE>mode == V4SFmode)
4518 emit_insn (gen_ufloatv4siv4sf2 (operands[0], operands[1]));
4520 emit_insn (gen_ufloatv8siv8sf2 (operands[0], operands[1]));
4523 ix86_expand_vector_convert_uns_vsivsf (operands[0], operands[1]);
4529 ;; For <sse2_avx_avx512f>_fix_notrunc<sf2simodelower><mode> insn pattern
4530 (define_mode_attr sf2simodelower
4531 [(V16SI "v16sf") (V8SI "v8sf") (V4SI "v4sf")])
4533 (define_insn "<sse2_avx_avx512f>_fix_notrunc<sf2simodelower><mode><mask_name>"
4534 [(set (match_operand:VI4_AVX 0 "register_operand" "=v")
4536 [(match_operand:<ssePSmode> 1 "vector_operand" "vBm")]
4537 UNSPEC_FIX_NOTRUNC))]
4538 "TARGET_SSE2 && <mask_mode512bit_condition>"
4539 "%vcvtps2dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4540 [(set_attr "type" "ssecvt")
4541 (set (attr "prefix_data16")
4543 (match_test "TARGET_AVX")
4545 (const_string "1")))
4546 (set_attr "prefix" "maybe_vex")
4547 (set_attr "mode" "<sseinsnmode>")])
4549 (define_insn "avx512f_fix_notruncv16sfv16si<mask_name><round_name>"
4550 [(set (match_operand:V16SI 0 "register_operand" "=v")
4552 [(match_operand:V16SF 1 "<round_nimm_predicate>" "<round_constraint>")]
4553 UNSPEC_FIX_NOTRUNC))]
4555 "vcvtps2dq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4556 [(set_attr "type" "ssecvt")
4557 (set_attr "prefix" "evex")
4558 (set_attr "mode" "XI")])
4560 (define_insn "<mask_codefor><avx512>_ufix_notrunc<sf2simodelower><mode><mask_name><round_name>"
4561 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
4562 (unspec:VI4_AVX512VL
4563 [(match_operand:<ssePSmode> 1 "nonimmediate_operand" "<round_constraint>")]
4564 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4566 "vcvtps2udq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4567 [(set_attr "type" "ssecvt")
4568 (set_attr "prefix" "evex")
4569 (set_attr "mode" "<sseinsnmode>")])
4571 (define_insn "<mask_codefor>avx512dq_cvtps2qq<mode><mask_name><round_name>"
4572 [(set (match_operand:VI8_256_512 0 "register_operand" "=v")
4573 (unspec:VI8_256_512 [(match_operand:<ssePSmode2> 1 "nonimmediate_operand" "<round_constraint>")]
4574 UNSPEC_FIX_NOTRUNC))]
4575 "TARGET_AVX512DQ && <round_mode512bit_condition>"
4576 "vcvtps2qq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4577 [(set_attr "type" "ssecvt")
4578 (set_attr "prefix" "evex")
4579 (set_attr "mode" "<sseinsnmode>")])
4581 (define_insn "<mask_codefor>avx512dq_cvtps2qqv2di<mask_name>"
4582 [(set (match_operand:V2DI 0 "register_operand" "=v")
4585 (match_operand:V4SF 1 "nonimmediate_operand" "vm")
4586 (parallel [(const_int 0) (const_int 1)]))]
4587 UNSPEC_FIX_NOTRUNC))]
4588 "TARGET_AVX512DQ && TARGET_AVX512VL"
4589 "vcvtps2qq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
4590 [(set_attr "type" "ssecvt")
4591 (set_attr "prefix" "evex")
4592 (set_attr "mode" "TI")])
4594 (define_insn "<mask_codefor>avx512dq_cvtps2uqq<mode><mask_name><round_name>"
4595 [(set (match_operand:VI8_256_512 0 "register_operand" "=v")
4596 (unspec:VI8_256_512 [(match_operand:<ssePSmode2> 1 "nonimmediate_operand" "<round_constraint>")]
4597 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4598 "TARGET_AVX512DQ && <round_mode512bit_condition>"
4599 "vcvtps2uqq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4600 [(set_attr "type" "ssecvt")
4601 (set_attr "prefix" "evex")
4602 (set_attr "mode" "<sseinsnmode>")])
4604 (define_insn "<mask_codefor>avx512dq_cvtps2uqqv2di<mask_name>"
4605 [(set (match_operand:V2DI 0 "register_operand" "=v")
4608 (match_operand:V4SF 1 "nonimmediate_operand" "vm")
4609 (parallel [(const_int 0) (const_int 1)]))]
4610 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4611 "TARGET_AVX512DQ && TARGET_AVX512VL"
4612 "vcvtps2uqq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
4613 [(set_attr "type" "ssecvt")
4614 (set_attr "prefix" "evex")
4615 (set_attr "mode" "TI")])
4617 (define_insn "<fixsuffix>fix_truncv16sfv16si2<mask_name><round_saeonly_name>"
4618 [(set (match_operand:V16SI 0 "register_operand" "=v")
4620 (match_operand:V16SF 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
4622 "vcvttps2<fixsuffix>dq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
4623 [(set_attr "type" "ssecvt")
4624 (set_attr "prefix" "evex")
4625 (set_attr "mode" "XI")])
4627 (define_insn "fix_truncv8sfv8si2<mask_name>"
4628 [(set (match_operand:V8SI 0 "register_operand" "=v")
4629 (fix:V8SI (match_operand:V8SF 1 "nonimmediate_operand" "vm")))]
4630 "TARGET_AVX && <mask_avx512vl_condition>"
4631 "vcvttps2dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4632 [(set_attr "type" "ssecvt")
4633 (set_attr "prefix" "<mask_prefix>")
4634 (set_attr "mode" "OI")])
4636 (define_insn "fix_truncv4sfv4si2<mask_name>"
4637 [(set (match_operand:V4SI 0 "register_operand" "=v")
4638 (fix:V4SI (match_operand:V4SF 1 "vector_operand" "vBm")))]
4639 "TARGET_SSE2 && <mask_avx512vl_condition>"
4640 "%vcvttps2dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4641 [(set_attr "type" "ssecvt")
4642 (set (attr "prefix_rep")
4644 (match_test "TARGET_AVX")
4646 (const_string "1")))
4647 (set (attr "prefix_data16")
4649 (match_test "TARGET_AVX")
4651 (const_string "0")))
4652 (set_attr "prefix_data16" "0")
4653 (set_attr "prefix" "<mask_prefix2>")
4654 (set_attr "mode" "TI")])
4656 (define_expand "fixuns_trunc<mode><sseintvecmodelower>2"
4657 [(match_operand:<sseintvecmode> 0 "register_operand")
4658 (match_operand:VF1 1 "register_operand")]
4661 if (<MODE>mode == V16SFmode)
4662 emit_insn (gen_ufix_truncv16sfv16si2 (operands[0],
4667 tmp[0] = ix86_expand_adjust_ufix_to_sfix_si (operands[1], &tmp[2]);
4668 tmp[1] = gen_reg_rtx (<sseintvecmode>mode);
4669 emit_insn (gen_fix_trunc<mode><sseintvecmodelower>2 (tmp[1], tmp[0]));
4670 emit_insn (gen_xor<sseintvecmodelower>3 (operands[0], tmp[1], tmp[2]));
4675 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4677 ;; Parallel double-precision floating point conversion operations
4679 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4681 (define_insn "sse2_cvtpi2pd"
4682 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
4683 (float:V2DF (match_operand:V2SI 1 "nonimmediate_operand" "y,m")))]
4685 "cvtpi2pd\t{%1, %0|%0, %1}"
4686 [(set_attr "type" "ssecvt")
4687 (set_attr "unit" "mmx,*")
4688 (set_attr "prefix_data16" "1,*")
4689 (set_attr "mode" "V2DF")])
4691 (define_insn "sse2_cvtpd2pi"
4692 [(set (match_operand:V2SI 0 "register_operand" "=y")
4693 (unspec:V2SI [(match_operand:V2DF 1 "nonimmediate_operand" "xm")]
4694 UNSPEC_FIX_NOTRUNC))]
4696 "cvtpd2pi\t{%1, %0|%0, %1}"
4697 [(set_attr "type" "ssecvt")
4698 (set_attr "unit" "mmx")
4699 (set_attr "bdver1_decode" "double")
4700 (set_attr "btver2_decode" "direct")
4701 (set_attr "prefix_data16" "1")
4702 (set_attr "mode" "DI")])
4704 (define_insn "sse2_cvttpd2pi"
4705 [(set (match_operand:V2SI 0 "register_operand" "=y")
4706 (fix:V2SI (match_operand:V2DF 1 "nonimmediate_operand" "xm")))]
4708 "cvttpd2pi\t{%1, %0|%0, %1}"
4709 [(set_attr "type" "ssecvt")
4710 (set_attr "unit" "mmx")
4711 (set_attr "bdver1_decode" "double")
4712 (set_attr "prefix_data16" "1")
4713 (set_attr "mode" "TI")])
4715 (define_insn "sse2_cvtsi2sd"
4716 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
4719 (float:DF (match_operand:SI 2 "nonimmediate_operand" "r,m,rm")))
4720 (match_operand:V2DF 1 "register_operand" "0,0,v")
4724 cvtsi2sd\t{%2, %0|%0, %2}
4725 cvtsi2sd\t{%2, %0|%0, %2}
4726 vcvtsi2sd\t{%2, %1, %0|%0, %1, %2}"
4727 [(set_attr "isa" "noavx,noavx,avx")
4728 (set_attr "type" "sseicvt")
4729 (set_attr "athlon_decode" "double,direct,*")
4730 (set_attr "amdfam10_decode" "vector,double,*")
4731 (set_attr "bdver1_decode" "double,direct,*")
4732 (set_attr "btver2_decode" "double,double,double")
4733 (set_attr "znver1_decode" "double,double,double")
4734 (set_attr "prefix" "orig,orig,maybe_evex")
4735 (set_attr "mode" "DF")])
4737 (define_insn "sse2_cvtsi2sdq<round_name>"
4738 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
4741 (float:DF (match_operand:DI 2 "<round_nimm_scalar_predicate>" "r,m,<round_constraint3>")))
4742 (match_operand:V2DF 1 "register_operand" "0,0,v")
4744 "TARGET_SSE2 && TARGET_64BIT"
4746 cvtsi2sdq\t{%2, %0|%0, %2}
4747 cvtsi2sdq\t{%2, %0|%0, %2}
4748 vcvtsi2sdq\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4749 [(set_attr "isa" "noavx,noavx,avx")
4750 (set_attr "type" "sseicvt")
4751 (set_attr "athlon_decode" "double,direct,*")
4752 (set_attr "amdfam10_decode" "vector,double,*")
4753 (set_attr "bdver1_decode" "double,direct,*")
4754 (set_attr "length_vex" "*,*,4")
4755 (set_attr "prefix_rex" "1,1,*")
4756 (set_attr "prefix" "orig,orig,maybe_evex")
4757 (set_attr "mode" "DF")])
4759 (define_insn "avx512f_vcvtss2usi<round_name>"
4760 [(set (match_operand:SI 0 "register_operand" "=r")
4763 (match_operand:V4SF 1 "<round_nimm_predicate>" "<round_constraint>")
4764 (parallel [(const_int 0)]))]
4765 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4767 "vcvtss2usi\t{<round_op2>%1, %0|%0, %1<round_op2>}"
4768 [(set_attr "type" "sseicvt")
4769 (set_attr "prefix" "evex")
4770 (set_attr "mode" "SI")])
4772 (define_insn "avx512f_vcvtss2usiq<round_name>"
4773 [(set (match_operand:DI 0 "register_operand" "=r")
4776 (match_operand:V4SF 1 "<round_nimm_predicate>" "<round_constraint>")
4777 (parallel [(const_int 0)]))]
4778 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4779 "TARGET_AVX512F && TARGET_64BIT"
4780 "vcvtss2usi\t{<round_op2>%1, %0|%0, %1<round_op2>}"
4781 [(set_attr "type" "sseicvt")
4782 (set_attr "prefix" "evex")
4783 (set_attr "mode" "DI")])
4785 (define_insn "avx512f_vcvttss2usi<round_saeonly_name>"
4786 [(set (match_operand:SI 0 "register_operand" "=r")
4789 (match_operand:V4SF 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
4790 (parallel [(const_int 0)]))))]
4792 "vcvttss2usi\t{<round_saeonly_op2>%1, %0|%0, %1<round_saeonly_op2>}"
4793 [(set_attr "type" "sseicvt")
4794 (set_attr "prefix" "evex")
4795 (set_attr "mode" "SI")])
4797 (define_insn "avx512f_vcvttss2usiq<round_saeonly_name>"
4798 [(set (match_operand:DI 0 "register_operand" "=r")
4801 (match_operand:V4SF 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
4802 (parallel [(const_int 0)]))))]
4803 "TARGET_AVX512F && TARGET_64BIT"
4804 "vcvttss2usi\t{<round_saeonly_op2>%1, %0|%0, %1<round_saeonly_op2>}"
4805 [(set_attr "type" "sseicvt")
4806 (set_attr "prefix" "evex")
4807 (set_attr "mode" "DI")])
4809 (define_insn "avx512f_vcvtsd2usi<round_name>"
4810 [(set (match_operand:SI 0 "register_operand" "=r")
4813 (match_operand:V2DF 1 "<round_nimm_predicate>" "<round_constraint>")
4814 (parallel [(const_int 0)]))]
4815 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4817 "vcvtsd2usi\t{<round_op2>%1, %0|%0, %1<round_op2>}"
4818 [(set_attr "type" "sseicvt")
4819 (set_attr "prefix" "evex")
4820 (set_attr "mode" "SI")])
4822 (define_insn "avx512f_vcvtsd2usiq<round_name>"
4823 [(set (match_operand:DI 0 "register_operand" "=r")
4826 (match_operand:V2DF 1 "<round_nimm_predicate>" "<round_constraint>")
4827 (parallel [(const_int 0)]))]
4828 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4829 "TARGET_AVX512F && TARGET_64BIT"
4830 "vcvtsd2usi\t{<round_op2>%1, %0|%0, %1<round_op2>}"
4831 [(set_attr "type" "sseicvt")
4832 (set_attr "prefix" "evex")
4833 (set_attr "mode" "DI")])
4835 (define_insn "avx512f_vcvttsd2usi<round_saeonly_name>"
4836 [(set (match_operand:SI 0 "register_operand" "=r")
4839 (match_operand:V2DF 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
4840 (parallel [(const_int 0)]))))]
4842 "vcvttsd2usi\t{<round_saeonly_op2>%1, %0|%0, %1<round_saeonly_op2>}"
4843 [(set_attr "type" "sseicvt")
4844 (set_attr "prefix" "evex")
4845 (set_attr "mode" "SI")])
4847 (define_insn "avx512f_vcvttsd2usiq<round_saeonly_name>"
4848 [(set (match_operand:DI 0 "register_operand" "=r")
4851 (match_operand:V2DF 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
4852 (parallel [(const_int 0)]))))]
4853 "TARGET_AVX512F && TARGET_64BIT"
4854 "vcvttsd2usi\t{<round_saeonly_op2>%1, %0|%0, %1<round_saeonly_op2>}"
4855 [(set_attr "type" "sseicvt")
4856 (set_attr "prefix" "evex")
4857 (set_attr "mode" "DI")])
4859 (define_insn "sse2_cvtsd2si<round_name>"
4860 [(set (match_operand:SI 0 "register_operand" "=r,r")
4863 (match_operand:V2DF 1 "<round_nimm_scalar_predicate>" "v,<round_constraint2>")
4864 (parallel [(const_int 0)]))]
4865 UNSPEC_FIX_NOTRUNC))]
4867 "%vcvtsd2si\t{<round_op2>%1, %0|%0, %q1<round_op2>}"
4868 [(set_attr "type" "sseicvt")
4869 (set_attr "athlon_decode" "double,vector")
4870 (set_attr "bdver1_decode" "double,double")
4871 (set_attr "btver2_decode" "double,double")
4872 (set_attr "prefix_rep" "1")
4873 (set_attr "prefix" "maybe_vex")
4874 (set_attr "mode" "SI")])
4876 (define_insn "sse2_cvtsd2si_2"
4877 [(set (match_operand:SI 0 "register_operand" "=r,r")
4878 (unspec:SI [(match_operand:DF 1 "nonimmediate_operand" "v,m")]
4879 UNSPEC_FIX_NOTRUNC))]
4881 "%vcvtsd2si\t{%1, %0|%0, %q1}"
4882 [(set_attr "type" "sseicvt")
4883 (set_attr "athlon_decode" "double,vector")
4884 (set_attr "amdfam10_decode" "double,double")
4885 (set_attr "bdver1_decode" "double,double")
4886 (set_attr "prefix_rep" "1")
4887 (set_attr "prefix" "maybe_vex")
4888 (set_attr "mode" "SI")])
4890 (define_insn "sse2_cvtsd2siq<round_name>"
4891 [(set (match_operand:DI 0 "register_operand" "=r,r")
4894 (match_operand:V2DF 1 "<round_nimm_scalar_predicate>" "v,<round_constraint2>")
4895 (parallel [(const_int 0)]))]
4896 UNSPEC_FIX_NOTRUNC))]
4897 "TARGET_SSE2 && TARGET_64BIT"
4898 "%vcvtsd2si{q}\t{<round_op2>%1, %0|%0, %q1<round_op2>}"
4899 [(set_attr "type" "sseicvt")
4900 (set_attr "athlon_decode" "double,vector")
4901 (set_attr "bdver1_decode" "double,double")
4902 (set_attr "prefix_rep" "1")
4903 (set_attr "prefix" "maybe_vex")
4904 (set_attr "mode" "DI")])
4906 (define_insn "sse2_cvtsd2siq_2"
4907 [(set (match_operand:DI 0 "register_operand" "=r,r")
4908 (unspec:DI [(match_operand:DF 1 "nonimmediate_operand" "v,m")]
4909 UNSPEC_FIX_NOTRUNC))]
4910 "TARGET_SSE2 && TARGET_64BIT"
4911 "%vcvtsd2si{q}\t{%1, %0|%0, %q1}"
4912 [(set_attr "type" "sseicvt")
4913 (set_attr "athlon_decode" "double,vector")
4914 (set_attr "amdfam10_decode" "double,double")
4915 (set_attr "bdver1_decode" "double,double")
4916 (set_attr "prefix_rep" "1")
4917 (set_attr "prefix" "maybe_vex")
4918 (set_attr "mode" "DI")])
4920 (define_insn "sse2_cvttsd2si<round_saeonly_name>"
4921 [(set (match_operand:SI 0 "register_operand" "=r,r")
4924 (match_operand:V2DF 1 "<round_saeonly_nimm_scalar_predicate>" "v,<round_saeonly_constraint2>")
4925 (parallel [(const_int 0)]))))]
4927 "%vcvttsd2si\t{<round_saeonly_op2>%1, %0|%0, %q1<round_saeonly_op2>}"
4928 [(set_attr "type" "sseicvt")
4929 (set_attr "athlon_decode" "double,vector")
4930 (set_attr "amdfam10_decode" "double,double")
4931 (set_attr "bdver1_decode" "double,double")
4932 (set_attr "btver2_decode" "double,double")
4933 (set_attr "prefix_rep" "1")
4934 (set_attr "prefix" "maybe_vex")
4935 (set_attr "mode" "SI")])
4937 (define_insn "sse2_cvttsd2siq<round_saeonly_name>"
4938 [(set (match_operand:DI 0 "register_operand" "=r,r")
4941 (match_operand:V2DF 1 "<round_saeonly_nimm_scalar_predicate>" "v,<round_saeonly_constraint2>")
4942 (parallel [(const_int 0)]))))]
4943 "TARGET_SSE2 && TARGET_64BIT"
4944 "%vcvttsd2si{q}\t{<round_saeonly_op2>%1, %0|%0, %q1<round_saeonly_op2>}"
4945 [(set_attr "type" "sseicvt")
4946 (set_attr "athlon_decode" "double,vector")
4947 (set_attr "amdfam10_decode" "double,double")
4948 (set_attr "bdver1_decode" "double,double")
4949 (set_attr "prefix_rep" "1")
4950 (set_attr "prefix" "maybe_vex")
4951 (set_attr "mode" "DI")])
4953 ;; For float<si2dfmode><mode>2 insn pattern
4954 (define_mode_attr si2dfmode
4955 [(V8DF "V8SI") (V4DF "V4SI")])
4956 (define_mode_attr si2dfmodelower
4957 [(V8DF "v8si") (V4DF "v4si")])
4959 (define_insn "float<si2dfmodelower><mode>2<mask_name>"
4960 [(set (match_operand:VF2_512_256 0 "register_operand" "=v")
4961 (float:VF2_512_256 (match_operand:<si2dfmode> 1 "nonimmediate_operand" "vm")))]
4962 "TARGET_AVX && <mask_mode512bit_condition>"
4963 "vcvtdq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4964 [(set_attr "type" "ssecvt")
4965 (set_attr "prefix" "maybe_vex")
4966 (set_attr "mode" "<MODE>")])
4968 (define_insn "<floatsuffix>float<sseintvecmodelower><mode>2<mask_name><round_name>"
4969 [(set (match_operand:VF2_AVX512VL 0 "register_operand" "=v")
4970 (any_float:VF2_AVX512VL
4971 (match_operand:<sseintvecmode> 1 "nonimmediate_operand" "<round_constraint>")))]
4973 "vcvt<floatsuffix>qq2pd\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4974 [(set_attr "type" "ssecvt")
4975 (set_attr "prefix" "evex")
4976 (set_attr "mode" "<MODE>")])
4978 ;; For <floatsuffix>float<sselondveclower><mode> insn patterns
4979 (define_mode_attr qq2pssuff
4980 [(V8SF "") (V4SF "{y}")])
4982 (define_mode_attr sselongvecmode
4983 [(V8SF "V8DI") (V4SF "V4DI")])
4985 (define_mode_attr sselongvecmodelower
4986 [(V8SF "v8di") (V4SF "v4di")])
4988 (define_mode_attr sseintvecmode3
4989 [(V8SF "XI") (V4SF "OI")
4990 (V8DF "OI") (V4DF "TI")])
4992 (define_insn "<floatsuffix>float<sselongvecmodelower><mode>2<mask_name><round_name>"
4993 [(set (match_operand:VF1_128_256VL 0 "register_operand" "=v")
4994 (any_float:VF1_128_256VL
4995 (match_operand:<sselongvecmode> 1 "nonimmediate_operand" "<round_constraint>")))]
4996 "TARGET_AVX512DQ && <round_modev8sf_condition>"
4997 "vcvt<floatsuffix>qq2ps<qq2pssuff>\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4998 [(set_attr "type" "ssecvt")
4999 (set_attr "prefix" "evex")
5000 (set_attr "mode" "<MODE>")])
5002 (define_insn "*<floatsuffix>floatv2div2sf2"
5003 [(set (match_operand:V4SF 0 "register_operand" "=v")
5005 (any_float:V2SF (match_operand:V2DI 1 "nonimmediate_operand" "vm"))
5006 (const_vector:V2SF [(const_int 0) (const_int 0)])))]
5007 "TARGET_AVX512DQ && TARGET_AVX512VL"
5008 "vcvt<floatsuffix>qq2ps{x}\t{%1, %0|%0, %1}"
5009 [(set_attr "type" "ssecvt")
5010 (set_attr "prefix" "evex")
5011 (set_attr "mode" "V4SF")])
5013 (define_insn "<floatsuffix>floatv2div2sf2_mask"
5014 [(set (match_operand:V4SF 0 "register_operand" "=v")
5017 (any_float:V2SF (match_operand:V2DI 1 "nonimmediate_operand" "vm"))
5019 (match_operand:V4SF 2 "vector_move_operand" "0C")
5020 (parallel [(const_int 0) (const_int 1)]))
5021 (match_operand:QI 3 "register_operand" "Yk"))
5022 (const_vector:V2SF [(const_int 0) (const_int 0)])))]
5023 "TARGET_AVX512DQ && TARGET_AVX512VL"
5024 "vcvt<floatsuffix>qq2ps{x}\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
5025 [(set_attr "type" "ssecvt")
5026 (set_attr "prefix" "evex")
5027 (set_attr "mode" "V4SF")])
5029 (define_insn "*<floatsuffix>floatv2div2sf2_mask_1"
5030 [(set (match_operand:V4SF 0 "register_operand" "=v")
5033 (any_float:V2SF (match_operand:V2DI 1
5034 "nonimmediate_operand" "vm"))
5035 (const_vector:V2SF [(const_int 0) (const_int 0)])
5036 (match_operand:QI 2 "register_operand" "Yk"))
5037 (const_vector:V2SF [(const_int 0) (const_int 0)])))]
5038 "TARGET_AVX512DQ && TARGET_AVX512VL"
5039 "vcvt<floatsuffix>qq2ps{x}\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
5040 [(set_attr "type" "ssecvt")
5041 (set_attr "prefix" "evex")
5042 (set_attr "mode" "V4SF")])
5044 (define_insn "ufloat<si2dfmodelower><mode>2<mask_name>"
5045 [(set (match_operand:VF2_512_256VL 0 "register_operand" "=v")
5046 (unsigned_float:VF2_512_256VL
5047 (match_operand:<si2dfmode> 1 "nonimmediate_operand" "vm")))]
5049 "vcvtudq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5050 [(set_attr "type" "ssecvt")
5051 (set_attr "prefix" "evex")
5052 (set_attr "mode" "<MODE>")])
5054 (define_insn "ufloatv2siv2df2<mask_name>"
5055 [(set (match_operand:V2DF 0 "register_operand" "=v")
5056 (unsigned_float:V2DF
5058 (match_operand:V4SI 1 "nonimmediate_operand" "vm")
5059 (parallel [(const_int 0) (const_int 1)]))))]
5061 "vcvtudq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5062 [(set_attr "type" "ssecvt")
5063 (set_attr "prefix" "evex")
5064 (set_attr "mode" "V2DF")])
5066 (define_insn "avx512f_cvtdq2pd512_2"
5067 [(set (match_operand:V8DF 0 "register_operand" "=v")
5070 (match_operand:V16SI 1 "nonimmediate_operand" "vm")
5071 (parallel [(const_int 0) (const_int 1)
5072 (const_int 2) (const_int 3)
5073 (const_int 4) (const_int 5)
5074 (const_int 6) (const_int 7)]))))]
5076 "vcvtdq2pd\t{%t1, %0|%0, %t1}"
5077 [(set_attr "type" "ssecvt")
5078 (set_attr "prefix" "evex")
5079 (set_attr "mode" "V8DF")])
5081 (define_insn "avx_cvtdq2pd256_2"
5082 [(set (match_operand:V4DF 0 "register_operand" "=v")
5085 (match_operand:V8SI 1 "nonimmediate_operand" "vm")
5086 (parallel [(const_int 0) (const_int 1)
5087 (const_int 2) (const_int 3)]))))]
5089 "vcvtdq2pd\t{%x1, %0|%0, %x1}"
5090 [(set_attr "type" "ssecvt")
5091 (set_attr "prefix" "maybe_evex")
5092 (set_attr "mode" "V4DF")])
5094 (define_insn "sse2_cvtdq2pd<mask_name>"
5095 [(set (match_operand:V2DF 0 "register_operand" "=v")
5098 (match_operand:V4SI 1 "nonimmediate_operand" "vm")
5099 (parallel [(const_int 0) (const_int 1)]))))]
5100 "TARGET_SSE2 && <mask_avx512vl_condition>"
5101 "%vcvtdq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
5102 [(set_attr "type" "ssecvt")
5103 (set_attr "prefix" "maybe_vex")
5104 (set_attr "mode" "V2DF")])
5106 (define_insn "avx512f_cvtpd2dq512<mask_name><round_name>"
5107 [(set (match_operand:V8SI 0 "register_operand" "=v")
5109 [(match_operand:V8DF 1 "<round_nimm_predicate>" "<round_constraint>")]
5110 UNSPEC_FIX_NOTRUNC))]
5112 "vcvtpd2dq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5113 [(set_attr "type" "ssecvt")
5114 (set_attr "prefix" "evex")
5115 (set_attr "mode" "OI")])
5117 (define_insn "avx_cvtpd2dq256<mask_name>"
5118 [(set (match_operand:V4SI 0 "register_operand" "=v")
5119 (unspec:V4SI [(match_operand:V4DF 1 "nonimmediate_operand" "vm")]
5120 UNSPEC_FIX_NOTRUNC))]
5121 "TARGET_AVX && <mask_avx512vl_condition>"
5122 "vcvtpd2dq{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5123 [(set_attr "type" "ssecvt")
5124 (set_attr "prefix" "<mask_prefix>")
5125 (set_attr "mode" "OI")])
5127 (define_expand "avx_cvtpd2dq256_2"
5128 [(set (match_operand:V8SI 0 "register_operand")
5130 (unspec:V4SI [(match_operand:V4DF 1 "nonimmediate_operand")]
5134 "operands[2] = CONST0_RTX (V4SImode);")
5136 (define_insn "*avx_cvtpd2dq256_2"
5137 [(set (match_operand:V8SI 0 "register_operand" "=v")
5139 (unspec:V4SI [(match_operand:V4DF 1 "nonimmediate_operand" "vm")]
5141 (match_operand:V4SI 2 "const0_operand")))]
5143 "vcvtpd2dq{y}\t{%1, %x0|%x0, %1}"
5144 [(set_attr "type" "ssecvt")
5145 (set_attr "prefix" "vex")
5146 (set_attr "btver2_decode" "vector")
5147 (set_attr "mode" "OI")])
5149 (define_insn "sse2_cvtpd2dq<mask_name>"
5150 [(set (match_operand:V4SI 0 "register_operand" "=v")
5152 (unspec:V2SI [(match_operand:V2DF 1 "vector_operand" "vBm")]
5154 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
5155 "TARGET_SSE2 && <mask_avx512vl_condition>"
5158 return "vcvtpd2dq{x}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}";
5160 return "cvtpd2dq\t{%1, %0|%0, %1}";
5162 [(set_attr "type" "ssecvt")
5163 (set_attr "prefix_rep" "1")
5164 (set_attr "prefix_data16" "0")
5165 (set_attr "prefix" "maybe_vex")
5166 (set_attr "mode" "TI")
5167 (set_attr "amdfam10_decode" "double")
5168 (set_attr "athlon_decode" "vector")
5169 (set_attr "bdver1_decode" "double")])
5171 ;; For ufix_notrunc* insn patterns
5172 (define_mode_attr pd2udqsuff
5173 [(V8DF "") (V4DF "{y}")])
5175 (define_insn "ufix_notrunc<mode><si2dfmodelower>2<mask_name><round_name>"
5176 [(set (match_operand:<si2dfmode> 0 "register_operand" "=v")
5178 [(match_operand:VF2_512_256VL 1 "nonimmediate_operand" "<round_constraint>")]
5179 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
5181 "vcvtpd2udq<pd2udqsuff>\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5182 [(set_attr "type" "ssecvt")
5183 (set_attr "prefix" "evex")
5184 (set_attr "mode" "<sseinsnmode>")])
5186 (define_insn "ufix_notruncv2dfv2si2<mask_name>"
5187 [(set (match_operand:V4SI 0 "register_operand" "=v")
5190 [(match_operand:V2DF 1 "nonimmediate_operand" "vm")]
5191 UNSPEC_UNSIGNED_FIX_NOTRUNC)
5192 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
5194 "vcvtpd2udq{x}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5195 [(set_attr "type" "ssecvt")
5196 (set_attr "prefix" "evex")
5197 (set_attr "mode" "TI")])
5199 (define_insn "<fixsuffix>fix_truncv8dfv8si2<mask_name><round_saeonly_name>"
5200 [(set (match_operand:V8SI 0 "register_operand" "=v")
5202 (match_operand:V8DF 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
5204 "vcvttpd2<fixsuffix>dq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
5205 [(set_attr "type" "ssecvt")
5206 (set_attr "prefix" "evex")
5207 (set_attr "mode" "OI")])
5209 (define_insn "ufix_truncv2dfv2si2<mask_name>"
5210 [(set (match_operand:V4SI 0 "register_operand" "=v")
5212 (unsigned_fix:V2SI (match_operand:V2DF 1 "nonimmediate_operand" "vm"))
5213 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
5215 "vcvttpd2udq{x}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5216 [(set_attr "type" "ssecvt")
5217 (set_attr "prefix" "evex")
5218 (set_attr "mode" "TI")])
5220 (define_insn "fix_truncv4dfv4si2<mask_name>"
5221 [(set (match_operand:V4SI 0 "register_operand" "=v")
5222 (fix:V4SI (match_operand:V4DF 1 "nonimmediate_operand" "vm")))]
5223 "TARGET_AVX || (TARGET_AVX512VL && TARGET_AVX512F)"
5224 "vcvttpd2dq{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5225 [(set_attr "type" "ssecvt")
5226 (set_attr "prefix" "maybe_evex")
5227 (set_attr "mode" "OI")])
5229 (define_insn "ufix_truncv4dfv4si2<mask_name>"
5230 [(set (match_operand:V4SI 0 "register_operand" "=v")
5231 (unsigned_fix:V4SI (match_operand:V4DF 1 "nonimmediate_operand" "vm")))]
5232 "TARGET_AVX512VL && TARGET_AVX512F"
5233 "vcvttpd2udq{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5234 [(set_attr "type" "ssecvt")
5235 (set_attr "prefix" "maybe_evex")
5236 (set_attr "mode" "OI")])
5238 (define_insn "<fixsuffix>fix_trunc<mode><sseintvecmodelower>2<mask_name><round_saeonly_name>"
5239 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
5240 (any_fix:<sseintvecmode>
5241 (match_operand:VF2_AVX512VL 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
5242 "TARGET_AVX512DQ && <round_saeonly_mode512bit_condition>"
5243 "vcvttpd2<fixsuffix>qq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
5244 [(set_attr "type" "ssecvt")
5245 (set_attr "prefix" "evex")
5246 (set_attr "mode" "<sseintvecmode2>")])
5248 (define_insn "fix_notrunc<mode><sseintvecmodelower>2<mask_name><round_name>"
5249 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
5250 (unspec:<sseintvecmode>
5251 [(match_operand:VF2_AVX512VL 1 "<round_nimm_predicate>" "<round_constraint>")]
5252 UNSPEC_FIX_NOTRUNC))]
5253 "TARGET_AVX512DQ && <round_mode512bit_condition>"
5254 "vcvtpd2qq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5255 [(set_attr "type" "ssecvt")
5256 (set_attr "prefix" "evex")
5257 (set_attr "mode" "<sseintvecmode2>")])
5259 (define_insn "ufix_notrunc<mode><sseintvecmodelower>2<mask_name><round_name>"
5260 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
5261 (unspec:<sseintvecmode>
5262 [(match_operand:VF2_AVX512VL 1 "nonimmediate_operand" "<round_constraint>")]
5263 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
5264 "TARGET_AVX512DQ && <round_mode512bit_condition>"
5265 "vcvtpd2uqq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5266 [(set_attr "type" "ssecvt")
5267 (set_attr "prefix" "evex")
5268 (set_attr "mode" "<sseintvecmode2>")])
5270 (define_insn "<fixsuffix>fix_trunc<mode><sselongvecmodelower>2<mask_name><round_saeonly_name>"
5271 [(set (match_operand:<sselongvecmode> 0 "register_operand" "=v")
5272 (any_fix:<sselongvecmode>
5273 (match_operand:VF1_128_256VL 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
5274 "TARGET_AVX512DQ && <round_saeonly_modev8sf_condition>"
5275 "vcvttps2<fixsuffix>qq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
5276 [(set_attr "type" "ssecvt")
5277 (set_attr "prefix" "evex")
5278 (set_attr "mode" "<sseintvecmode3>")])
5280 (define_insn "<fixsuffix>fix_truncv2sfv2di2<mask_name>"
5281 [(set (match_operand:V2DI 0 "register_operand" "=v")
5284 (match_operand:V4SF 1 "nonimmediate_operand" "vm")
5285 (parallel [(const_int 0) (const_int 1)]))))]
5286 "TARGET_AVX512DQ && TARGET_AVX512VL"
5287 "vcvttps2<fixsuffix>qq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
5288 [(set_attr "type" "ssecvt")
5289 (set_attr "prefix" "evex")
5290 (set_attr "mode" "TI")])
5292 (define_insn "ufix_trunc<mode><sseintvecmodelower>2<mask_name>"
5293 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
5294 (unsigned_fix:<sseintvecmode>
5295 (match_operand:VF1_128_256VL 1 "nonimmediate_operand" "vm")))]
5297 "vcvttps2udq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5298 [(set_attr "type" "ssecvt")
5299 (set_attr "prefix" "evex")
5300 (set_attr "mode" "<sseintvecmode2>")])
5302 (define_expand "avx_cvttpd2dq256_2"
5303 [(set (match_operand:V8SI 0 "register_operand")
5305 (fix:V4SI (match_operand:V4DF 1 "nonimmediate_operand"))
5308 "operands[2] = CONST0_RTX (V4SImode);")
5310 (define_insn "sse2_cvttpd2dq<mask_name>"
5311 [(set (match_operand:V4SI 0 "register_operand" "=v")
5313 (fix:V2SI (match_operand:V2DF 1 "vector_operand" "vBm"))
5314 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
5315 "TARGET_SSE2 && <mask_avx512vl_condition>"
5318 return "vcvttpd2dq{x}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}";
5320 return "cvttpd2dq\t{%1, %0|%0, %1}";
5322 [(set_attr "type" "ssecvt")
5323 (set_attr "amdfam10_decode" "double")
5324 (set_attr "athlon_decode" "vector")
5325 (set_attr "bdver1_decode" "double")
5326 (set_attr "prefix" "maybe_vex")
5327 (set_attr "mode" "TI")])
5329 (define_insn "sse2_cvtsd2ss<round_name>"
5330 [(set (match_operand:V4SF 0 "register_operand" "=x,x,v")
5333 (float_truncate:V2SF
5334 (match_operand:V2DF 2 "nonimmediate_operand" "x,m,<round_constraint>")))
5335 (match_operand:V4SF 1 "register_operand" "0,0,v")
5339 cvtsd2ss\t{%2, %0|%0, %2}
5340 cvtsd2ss\t{%2, %0|%0, %q2}
5341 vcvtsd2ss\t{<round_op3>%2, %1, %0|%0, %1, %q2<round_op3>}"
5342 [(set_attr "isa" "noavx,noavx,avx")
5343 (set_attr "type" "ssecvt")
5344 (set_attr "athlon_decode" "vector,double,*")
5345 (set_attr "amdfam10_decode" "vector,double,*")
5346 (set_attr "bdver1_decode" "direct,direct,*")
5347 (set_attr "btver2_decode" "double,double,double")
5348 (set_attr "prefix" "orig,orig,<round_prefix>")
5349 (set_attr "mode" "SF")])
5351 (define_insn "*sse2_vd_cvtsd2ss"
5352 [(set (match_operand:V4SF 0 "register_operand" "=x,x,v")
5355 (float_truncate:SF (match_operand:DF 2 "nonimmediate_operand" "x,m,vm")))
5356 (match_operand:V4SF 1 "register_operand" "0,0,v")
5360 cvtsd2ss\t{%2, %0|%0, %2}
5361 cvtsd2ss\t{%2, %0|%0, %2}
5362 vcvtsd2ss\t{%2, %1, %0|%0, %1, %2}"
5363 [(set_attr "isa" "noavx,noavx,avx")
5364 (set_attr "type" "ssecvt")
5365 (set_attr "athlon_decode" "vector,double,*")
5366 (set_attr "amdfam10_decode" "vector,double,*")
5367 (set_attr "bdver1_decode" "direct,direct,*")
5368 (set_attr "btver2_decode" "double,double,double")
5369 (set_attr "prefix" "orig,orig,vex")
5370 (set_attr "mode" "SF")])
5372 (define_insn "sse2_cvtss2sd<round_saeonly_name>"
5373 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
5377 (match_operand:V4SF 2 "<round_saeonly_nimm_scalar_predicate>" "x,m,<round_saeonly_constraint>")
5378 (parallel [(const_int 0) (const_int 1)])))
5379 (match_operand:V2DF 1 "register_operand" "0,0,v")
5383 cvtss2sd\t{%2, %0|%0, %2}
5384 cvtss2sd\t{%2, %0|%0, %k2}
5385 vcvtss2sd\t{<round_saeonly_op3>%2, %1, %0|%0, %1, %k2<round_saeonly_op3>}"
5386 [(set_attr "isa" "noavx,noavx,avx")
5387 (set_attr "type" "ssecvt")
5388 (set_attr "amdfam10_decode" "vector,double,*")
5389 (set_attr "athlon_decode" "direct,direct,*")
5390 (set_attr "bdver1_decode" "direct,direct,*")
5391 (set_attr "btver2_decode" "double,double,double")
5392 (set_attr "prefix" "orig,orig,<round_saeonly_prefix>")
5393 (set_attr "mode" "DF")])
5395 (define_insn "*sse2_vd_cvtss2sd"
5396 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
5399 (float_extend:DF (match_operand:SF 2 "nonimmediate_operand" "x,m,vm")))
5400 (match_operand:V2DF 1 "register_operand" "0,0,v")
5404 cvtss2sd\t{%2, %0|%0, %2}
5405 cvtss2sd\t{%2, %0|%0, %2}
5406 vcvtss2sd\t{%2, %1, %0|%0, %1, %2}"
5407 [(set_attr "isa" "noavx,noavx,avx")
5408 (set_attr "type" "ssecvt")
5409 (set_attr "amdfam10_decode" "vector,double,*")
5410 (set_attr "athlon_decode" "direct,direct,*")
5411 (set_attr "bdver1_decode" "direct,direct,*")
5412 (set_attr "btver2_decode" "double,double,double")
5413 (set_attr "prefix" "orig,orig,vex")
5414 (set_attr "mode" "DF")])
5416 (define_insn "<mask_codefor>avx512f_cvtpd2ps512<mask_name><round_name>"
5417 [(set (match_operand:V8SF 0 "register_operand" "=v")
5418 (float_truncate:V8SF
5419 (match_operand:V8DF 1 "<round_nimm_predicate>" "<round_constraint>")))]
5421 "vcvtpd2ps\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5422 [(set_attr "type" "ssecvt")
5423 (set_attr "prefix" "evex")
5424 (set_attr "mode" "V8SF")])
5426 (define_insn "avx_cvtpd2ps256<mask_name>"
5427 [(set (match_operand:V4SF 0 "register_operand" "=v")
5428 (float_truncate:V4SF
5429 (match_operand:V4DF 1 "nonimmediate_operand" "vm")))]
5430 "TARGET_AVX && <mask_avx512vl_condition>"
5431 "vcvtpd2ps{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5432 [(set_attr "type" "ssecvt")
5433 (set_attr "prefix" "maybe_evex")
5434 (set_attr "btver2_decode" "vector")
5435 (set_attr "mode" "V4SF")])
5437 (define_expand "sse2_cvtpd2ps"
5438 [(set (match_operand:V4SF 0 "register_operand")
5440 (float_truncate:V2SF
5441 (match_operand:V2DF 1 "vector_operand"))
5444 "operands[2] = CONST0_RTX (V2SFmode);")
5446 (define_expand "sse2_cvtpd2ps_mask"
5447 [(set (match_operand:V4SF 0 "register_operand")
5450 (float_truncate:V2SF
5451 (match_operand:V2DF 1 "vector_operand"))
5453 (match_operand:V4SF 2 "register_operand")
5454 (match_operand:QI 3 "register_operand")))]
5456 "operands[4] = CONST0_RTX (V2SFmode);")
5458 (define_insn "*sse2_cvtpd2ps<mask_name>"
5459 [(set (match_operand:V4SF 0 "register_operand" "=v")
5461 (float_truncate:V2SF
5462 (match_operand:V2DF 1 "vector_operand" "vBm"))
5463 (match_operand:V2SF 2 "const0_operand")))]
5464 "TARGET_SSE2 && <mask_avx512vl_condition>"
5467 return "vcvtpd2ps{x}\t{%1, %0<mask_operand3>|%0<mask_operand3>, %1}";
5469 return "cvtpd2ps\t{%1, %0|%0, %1}";
5471 [(set_attr "type" "ssecvt")
5472 (set_attr "amdfam10_decode" "double")
5473 (set_attr "athlon_decode" "vector")
5474 (set_attr "bdver1_decode" "double")
5475 (set_attr "prefix_data16" "1")
5476 (set_attr "prefix" "maybe_vex")
5477 (set_attr "mode" "V4SF")])
5479 ;; For <sse2_avx_avx512f>_cvtps2pd<avxsizesuffix> insn pattern
5480 (define_mode_attr sf2dfmode
5481 [(V8DF "V8SF") (V4DF "V4SF")])
5483 (define_insn "<sse2_avx_avx512f>_cvtps2pd<avxsizesuffix><mask_name><round_saeonly_name>"
5484 [(set (match_operand:VF2_512_256 0 "register_operand" "=v")
5485 (float_extend:VF2_512_256
5486 (match_operand:<sf2dfmode> 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
5487 "TARGET_AVX && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
5488 "vcvtps2pd\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
5489 [(set_attr "type" "ssecvt")
5490 (set_attr "prefix" "maybe_vex")
5491 (set_attr "mode" "<MODE>")])
5493 (define_insn "*avx_cvtps2pd256_2"
5494 [(set (match_operand:V4DF 0 "register_operand" "=v")
5497 (match_operand:V8SF 1 "nonimmediate_operand" "vm")
5498 (parallel [(const_int 0) (const_int 1)
5499 (const_int 2) (const_int 3)]))))]
5501 "vcvtps2pd\t{%x1, %0|%0, %x1}"
5502 [(set_attr "type" "ssecvt")
5503 (set_attr "prefix" "vex")
5504 (set_attr "mode" "V4DF")])
5506 (define_insn "vec_unpacks_lo_v16sf"
5507 [(set (match_operand:V8DF 0 "register_operand" "=v")
5510 (match_operand:V16SF 1 "nonimmediate_operand" "vm")
5511 (parallel [(const_int 0) (const_int 1)
5512 (const_int 2) (const_int 3)
5513 (const_int 4) (const_int 5)
5514 (const_int 6) (const_int 7)]))))]
5516 "vcvtps2pd\t{%t1, %0|%0, %t1}"
5517 [(set_attr "type" "ssecvt")
5518 (set_attr "prefix" "evex")
5519 (set_attr "mode" "V8DF")])
5521 (define_insn "<avx512>_cvt<ssemodesuffix>2mask<mode>"
5522 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
5523 (unspec:<avx512fmaskmode>
5524 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")]
5525 UNSPEC_CVTINT2MASK))]
5527 "vpmov<ssemodesuffix>2m\t{%1, %0|%0, %1}"
5528 [(set_attr "prefix" "evex")
5529 (set_attr "mode" "<sseinsnmode>")])
5531 (define_insn "<avx512>_cvt<ssemodesuffix>2mask<mode>"
5532 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
5533 (unspec:<avx512fmaskmode>
5534 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")]
5535 UNSPEC_CVTINT2MASK))]
5537 "vpmov<ssemodesuffix>2m\t{%1, %0|%0, %1}"
5538 [(set_attr "prefix" "evex")
5539 (set_attr "mode" "<sseinsnmode>")])
5541 (define_expand "<avx512>_cvtmask2<ssemodesuffix><mode>"
5542 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
5543 (vec_merge:VI12_AVX512VL
5546 (match_operand:<avx512fmaskmode> 1 "register_operand")))]
5549 operands[2] = CONSTM1_RTX (<MODE>mode);
5550 operands[3] = CONST0_RTX (<MODE>mode);
5553 (define_insn "*<avx512>_cvtmask2<ssemodesuffix><mode>"
5554 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
5555 (vec_merge:VI12_AVX512VL
5556 (match_operand:VI12_AVX512VL 2 "vector_all_ones_operand")
5557 (match_operand:VI12_AVX512VL 3 "const0_operand")
5558 (match_operand:<avx512fmaskmode> 1 "register_operand" "Yk")))]
5560 "vpmovm2<ssemodesuffix>\t{%1, %0|%0, %1}"
5561 [(set_attr "prefix" "evex")
5562 (set_attr "mode" "<sseinsnmode>")])
5564 (define_expand "<avx512>_cvtmask2<ssemodesuffix><mode>"
5565 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
5566 (vec_merge:VI48_AVX512VL
5569 (match_operand:<avx512fmaskmode> 1 "register_operand")))]
5572 operands[2] = CONSTM1_RTX (<MODE>mode);
5573 operands[3] = CONST0_RTX (<MODE>mode);
5576 (define_insn "*<avx512>_cvtmask2<ssemodesuffix><mode>"
5577 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
5578 (vec_merge:VI48_AVX512VL
5579 (match_operand:VI48_AVX512VL 2 "vector_all_ones_operand")
5580 (match_operand:VI48_AVX512VL 3 "const0_operand")
5581 (match_operand:<avx512fmaskmode> 1 "register_operand" "Yk")))]
5583 "vpmovm2<ssemodesuffix>\t{%1, %0|%0, %1}"
5584 [(set_attr "prefix" "evex")
5585 (set_attr "mode" "<sseinsnmode>")])
5587 (define_insn "sse2_cvtps2pd<mask_name>"
5588 [(set (match_operand:V2DF 0 "register_operand" "=v")
5591 (match_operand:V4SF 1 "vector_operand" "vm")
5592 (parallel [(const_int 0) (const_int 1)]))))]
5593 "TARGET_SSE2 && <mask_avx512vl_condition>"
5594 "%vcvtps2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
5595 [(set_attr "type" "ssecvt")
5596 (set_attr "amdfam10_decode" "direct")
5597 (set_attr "athlon_decode" "double")
5598 (set_attr "bdver1_decode" "double")
5599 (set_attr "prefix_data16" "0")
5600 (set_attr "prefix" "maybe_vex")
5601 (set_attr "mode" "V2DF")])
5603 (define_expand "vec_unpacks_hi_v4sf"
5608 (match_operand:V4SF 1 "vector_operand"))
5609 (parallel [(const_int 6) (const_int 7)
5610 (const_int 2) (const_int 3)])))
5611 (set (match_operand:V2DF 0 "register_operand")
5615 (parallel [(const_int 0) (const_int 1)]))))]
5617 "operands[2] = gen_reg_rtx (V4SFmode);")
5619 (define_expand "vec_unpacks_hi_v8sf"
5622 (match_operand:V8SF 1 "register_operand")
5623 (parallel [(const_int 4) (const_int 5)
5624 (const_int 6) (const_int 7)])))
5625 (set (match_operand:V4DF 0 "register_operand")
5629 "operands[2] = gen_reg_rtx (V4SFmode);")
5631 (define_expand "vec_unpacks_hi_v16sf"
5634 (match_operand:V16SF 1 "register_operand")
5635 (parallel [(const_int 8) (const_int 9)
5636 (const_int 10) (const_int 11)
5637 (const_int 12) (const_int 13)
5638 (const_int 14) (const_int 15)])))
5639 (set (match_operand:V8DF 0 "register_operand")
5643 "operands[2] = gen_reg_rtx (V8SFmode);")
5645 (define_expand "vec_unpacks_lo_v4sf"
5646 [(set (match_operand:V2DF 0 "register_operand")
5649 (match_operand:V4SF 1 "vector_operand")
5650 (parallel [(const_int 0) (const_int 1)]))))]
5653 (define_expand "vec_unpacks_lo_v8sf"
5654 [(set (match_operand:V4DF 0 "register_operand")
5657 (match_operand:V8SF 1 "nonimmediate_operand")
5658 (parallel [(const_int 0) (const_int 1)
5659 (const_int 2) (const_int 3)]))))]
5662 (define_mode_attr sseunpackfltmode
5663 [(V8HI "V4SF") (V4SI "V2DF") (V16HI "V8SF")
5664 (V8SI "V4DF") (V32HI "V16SF") (V16SI "V8DF")])
5666 (define_expand "vec_unpacks_float_hi_<mode>"
5667 [(match_operand:<sseunpackfltmode> 0 "register_operand")
5668 (match_operand:VI2_AVX512F 1 "register_operand")]
5671 rtx tmp = gen_reg_rtx (<sseunpackmode>mode);
5673 emit_insn (gen_vec_unpacks_hi_<mode> (tmp, operands[1]));
5674 emit_insn (gen_rtx_SET (operands[0],
5675 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
5679 (define_expand "vec_unpacks_float_lo_<mode>"
5680 [(match_operand:<sseunpackfltmode> 0 "register_operand")
5681 (match_operand:VI2_AVX512F 1 "register_operand")]
5684 rtx tmp = gen_reg_rtx (<sseunpackmode>mode);
5686 emit_insn (gen_vec_unpacks_lo_<mode> (tmp, operands[1]));
5687 emit_insn (gen_rtx_SET (operands[0],
5688 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
5692 (define_expand "vec_unpacku_float_hi_<mode>"
5693 [(match_operand:<sseunpackfltmode> 0 "register_operand")
5694 (match_operand:VI2_AVX512F 1 "register_operand")]
5697 rtx tmp = gen_reg_rtx (<sseunpackmode>mode);
5699 emit_insn (gen_vec_unpacku_hi_<mode> (tmp, operands[1]));
5700 emit_insn (gen_rtx_SET (operands[0],
5701 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
5705 (define_expand "vec_unpacku_float_lo_<mode>"
5706 [(match_operand:<sseunpackfltmode> 0 "register_operand")
5707 (match_operand:VI2_AVX512F 1 "register_operand")]
5710 rtx tmp = gen_reg_rtx (<sseunpackmode>mode);
5712 emit_insn (gen_vec_unpacku_lo_<mode> (tmp, operands[1]));
5713 emit_insn (gen_rtx_SET (operands[0],
5714 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
5718 (define_expand "vec_unpacks_float_hi_v4si"
5721 (match_operand:V4SI 1 "vector_operand")
5722 (parallel [(const_int 2) (const_int 3)
5723 (const_int 2) (const_int 3)])))
5724 (set (match_operand:V2DF 0 "register_operand")
5728 (parallel [(const_int 0) (const_int 1)]))))]
5730 "operands[2] = gen_reg_rtx (V4SImode);")
5732 (define_expand "vec_unpacks_float_lo_v4si"
5733 [(set (match_operand:V2DF 0 "register_operand")
5736 (match_operand:V4SI 1 "vector_operand")
5737 (parallel [(const_int 0) (const_int 1)]))))]
5740 (define_expand "vec_unpacks_float_hi_v8si"
5743 (match_operand:V8SI 1 "vector_operand")
5744 (parallel [(const_int 4) (const_int 5)
5745 (const_int 6) (const_int 7)])))
5746 (set (match_operand:V4DF 0 "register_operand")
5750 "operands[2] = gen_reg_rtx (V4SImode);")
5752 (define_expand "vec_unpacks_float_lo_v8si"
5753 [(set (match_operand:V4DF 0 "register_operand")
5756 (match_operand:V8SI 1 "nonimmediate_operand")
5757 (parallel [(const_int 0) (const_int 1)
5758 (const_int 2) (const_int 3)]))))]
5761 (define_expand "vec_unpacks_float_hi_v16si"
5764 (match_operand:V16SI 1 "nonimmediate_operand")
5765 (parallel [(const_int 8) (const_int 9)
5766 (const_int 10) (const_int 11)
5767 (const_int 12) (const_int 13)
5768 (const_int 14) (const_int 15)])))
5769 (set (match_operand:V8DF 0 "register_operand")
5773 "operands[2] = gen_reg_rtx (V8SImode);")
5775 (define_expand "vec_unpacks_float_lo_v16si"
5776 [(set (match_operand:V8DF 0 "register_operand")
5779 (match_operand:V16SI 1 "nonimmediate_operand")
5780 (parallel [(const_int 0) (const_int 1)
5781 (const_int 2) (const_int 3)
5782 (const_int 4) (const_int 5)
5783 (const_int 6) (const_int 7)]))))]
5786 (define_expand "vec_unpacku_float_hi_v4si"
5789 (match_operand:V4SI 1 "vector_operand")
5790 (parallel [(const_int 2) (const_int 3)
5791 (const_int 2) (const_int 3)])))
5796 (parallel [(const_int 0) (const_int 1)]))))
5798 (lt:V2DF (match_dup 6) (match_dup 3)))
5800 (and:V2DF (match_dup 7) (match_dup 4)))
5801 (set (match_operand:V2DF 0 "register_operand")
5802 (plus:V2DF (match_dup 6) (match_dup 8)))]
5805 REAL_VALUE_TYPE TWO32r;
5809 real_ldexp (&TWO32r, &dconst1, 32);
5810 x = const_double_from_real_value (TWO32r, DFmode);
5812 operands[3] = force_reg (V2DFmode, CONST0_RTX (V2DFmode));
5813 operands[4] = force_reg (V2DFmode,
5814 ix86_build_const_vector (V2DFmode, 1, x));
5816 operands[5] = gen_reg_rtx (V4SImode);
5818 for (i = 6; i < 9; i++)
5819 operands[i] = gen_reg_rtx (V2DFmode);
5822 (define_expand "vec_unpacku_float_lo_v4si"
5826 (match_operand:V4SI 1 "vector_operand")
5827 (parallel [(const_int 0) (const_int 1)]))))
5829 (lt:V2DF (match_dup 5) (match_dup 3)))
5831 (and:V2DF (match_dup 6) (match_dup 4)))
5832 (set (match_operand:V2DF 0 "register_operand")
5833 (plus:V2DF (match_dup 5) (match_dup 7)))]
5836 REAL_VALUE_TYPE TWO32r;
5840 real_ldexp (&TWO32r, &dconst1, 32);
5841 x = const_double_from_real_value (TWO32r, DFmode);
5843 operands[3] = force_reg (V2DFmode, CONST0_RTX (V2DFmode));
5844 operands[4] = force_reg (V2DFmode,
5845 ix86_build_const_vector (V2DFmode, 1, x));
5847 for (i = 5; i < 8; i++)
5848 operands[i] = gen_reg_rtx (V2DFmode);
5851 (define_expand "vec_unpacku_float_hi_v8si"
5852 [(match_operand:V4DF 0 "register_operand")
5853 (match_operand:V8SI 1 "register_operand")]
5856 REAL_VALUE_TYPE TWO32r;
5860 real_ldexp (&TWO32r, &dconst1, 32);
5861 x = const_double_from_real_value (TWO32r, DFmode);
5863 tmp[0] = force_reg (V4DFmode, CONST0_RTX (V4DFmode));
5864 tmp[1] = force_reg (V4DFmode, ix86_build_const_vector (V4DFmode, 1, x));
5865 tmp[5] = gen_reg_rtx (V4SImode);
5867 for (i = 2; i < 5; i++)
5868 tmp[i] = gen_reg_rtx (V4DFmode);
5869 emit_insn (gen_vec_extract_hi_v8si (tmp[5], operands[1]));
5870 emit_insn (gen_floatv4siv4df2 (tmp[2], tmp[5]));
5871 emit_insn (gen_rtx_SET (tmp[3], gen_rtx_LT (V4DFmode, tmp[2], tmp[0])));
5872 emit_insn (gen_andv4df3 (tmp[4], tmp[3], tmp[1]));
5873 emit_insn (gen_addv4df3 (operands[0], tmp[2], tmp[4]));
5877 (define_expand "vec_unpacku_float_hi_v16si"
5878 [(match_operand:V8DF 0 "register_operand")
5879 (match_operand:V16SI 1 "register_operand")]
5882 REAL_VALUE_TYPE TWO32r;
5885 real_ldexp (&TWO32r, &dconst1, 32);
5886 x = const_double_from_real_value (TWO32r, DFmode);
5888 tmp[0] = force_reg (V8DFmode, CONST0_RTX (V8DFmode));
5889 tmp[1] = force_reg (V8DFmode, ix86_build_const_vector (V8DFmode, 1, x));
5890 tmp[2] = gen_reg_rtx (V8DFmode);
5891 tmp[3] = gen_reg_rtx (V8SImode);
5892 k = gen_reg_rtx (QImode);
5894 emit_insn (gen_vec_extract_hi_v16si (tmp[3], operands[1]));
5895 emit_insn (gen_floatv8siv8df2 (tmp[2], tmp[3]));
5896 emit_insn (gen_rtx_SET (k, gen_rtx_LT (QImode, tmp[2], tmp[0])));
5897 emit_insn (gen_addv8df3_mask (tmp[2], tmp[2], tmp[1], tmp[2], k));
5898 emit_move_insn (operands[0], tmp[2]);
5902 (define_expand "vec_unpacku_float_lo_v8si"
5903 [(match_operand:V4DF 0 "register_operand")
5904 (match_operand:V8SI 1 "nonimmediate_operand")]
5907 REAL_VALUE_TYPE TWO32r;
5911 real_ldexp (&TWO32r, &dconst1, 32);
5912 x = const_double_from_real_value (TWO32r, DFmode);
5914 tmp[0] = force_reg (V4DFmode, CONST0_RTX (V4DFmode));
5915 tmp[1] = force_reg (V4DFmode, ix86_build_const_vector (V4DFmode, 1, x));
5917 for (i = 2; i < 5; i++)
5918 tmp[i] = gen_reg_rtx (V4DFmode);
5919 emit_insn (gen_avx_cvtdq2pd256_2 (tmp[2], operands[1]));
5920 emit_insn (gen_rtx_SET (tmp[3], gen_rtx_LT (V4DFmode, tmp[2], tmp[0])));
5921 emit_insn (gen_andv4df3 (tmp[4], tmp[3], tmp[1]));
5922 emit_insn (gen_addv4df3 (operands[0], tmp[2], tmp[4]));
5926 (define_expand "vec_unpacku_float_lo_v16si"
5927 [(match_operand:V8DF 0 "register_operand")
5928 (match_operand:V16SI 1 "nonimmediate_operand")]
5931 REAL_VALUE_TYPE TWO32r;
5934 real_ldexp (&TWO32r, &dconst1, 32);
5935 x = const_double_from_real_value (TWO32r, DFmode);
5937 tmp[0] = force_reg (V8DFmode, CONST0_RTX (V8DFmode));
5938 tmp[1] = force_reg (V8DFmode, ix86_build_const_vector (V8DFmode, 1, x));
5939 tmp[2] = gen_reg_rtx (V8DFmode);
5940 k = gen_reg_rtx (QImode);
5942 emit_insn (gen_avx512f_cvtdq2pd512_2 (tmp[2], operands[1]));
5943 emit_insn (gen_rtx_SET (k, gen_rtx_LT (QImode, tmp[2], tmp[0])));
5944 emit_insn (gen_addv8df3_mask (tmp[2], tmp[2], tmp[1], tmp[2], k));
5945 emit_move_insn (operands[0], tmp[2]);
5949 (define_expand "vec_pack_trunc_<mode>"
5951 (float_truncate:<sf2dfmode>
5952 (match_operand:VF2_512_256 1 "nonimmediate_operand")))
5954 (float_truncate:<sf2dfmode>
5955 (match_operand:VF2_512_256 2 "nonimmediate_operand")))
5956 (set (match_operand:<ssePSmode> 0 "register_operand")
5957 (vec_concat:<ssePSmode>
5962 operands[3] = gen_reg_rtx (<sf2dfmode>mode);
5963 operands[4] = gen_reg_rtx (<sf2dfmode>mode);
5966 (define_expand "vec_pack_trunc_v2df"
5967 [(match_operand:V4SF 0 "register_operand")
5968 (match_operand:V2DF 1 "vector_operand")
5969 (match_operand:V2DF 2 "vector_operand")]
5974 if (TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
5976 tmp0 = gen_reg_rtx (V4DFmode);
5977 tmp1 = force_reg (V2DFmode, operands[1]);
5979 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
5980 emit_insn (gen_avx_cvtpd2ps256 (operands[0], tmp0));
5984 tmp0 = gen_reg_rtx (V4SFmode);
5985 tmp1 = gen_reg_rtx (V4SFmode);
5987 emit_insn (gen_sse2_cvtpd2ps (tmp0, operands[1]));
5988 emit_insn (gen_sse2_cvtpd2ps (tmp1, operands[2]));
5989 emit_insn (gen_sse_movlhps (operands[0], tmp0, tmp1));
5994 (define_expand "vec_pack_sfix_trunc_v8df"
5995 [(match_operand:V16SI 0 "register_operand")
5996 (match_operand:V8DF 1 "nonimmediate_operand")
5997 (match_operand:V8DF 2 "nonimmediate_operand")]
6002 r1 = gen_reg_rtx (V8SImode);
6003 r2 = gen_reg_rtx (V8SImode);
6005 emit_insn (gen_fix_truncv8dfv8si2 (r1, operands[1]));
6006 emit_insn (gen_fix_truncv8dfv8si2 (r2, operands[2]));
6007 emit_insn (gen_avx_vec_concatv16si (operands[0], r1, r2));
6011 (define_expand "vec_pack_sfix_trunc_v4df"
6012 [(match_operand:V8SI 0 "register_operand")
6013 (match_operand:V4DF 1 "nonimmediate_operand")
6014 (match_operand:V4DF 2 "nonimmediate_operand")]
6019 r1 = gen_reg_rtx (V4SImode);
6020 r2 = gen_reg_rtx (V4SImode);
6022 emit_insn (gen_fix_truncv4dfv4si2 (r1, operands[1]));
6023 emit_insn (gen_fix_truncv4dfv4si2 (r2, operands[2]));
6024 emit_insn (gen_avx_vec_concatv8si (operands[0], r1, r2));
6028 (define_expand "vec_pack_sfix_trunc_v2df"
6029 [(match_operand:V4SI 0 "register_operand")
6030 (match_operand:V2DF 1 "vector_operand")
6031 (match_operand:V2DF 2 "vector_operand")]
6034 rtx tmp0, tmp1, tmp2;
6036 if (TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
6038 tmp0 = gen_reg_rtx (V4DFmode);
6039 tmp1 = force_reg (V2DFmode, operands[1]);
6041 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
6042 emit_insn (gen_fix_truncv4dfv4si2 (operands[0], tmp0));
6046 tmp0 = gen_reg_rtx (V4SImode);
6047 tmp1 = gen_reg_rtx (V4SImode);
6048 tmp2 = gen_reg_rtx (V2DImode);
6050 emit_insn (gen_sse2_cvttpd2dq (tmp0, operands[1]));
6051 emit_insn (gen_sse2_cvttpd2dq (tmp1, operands[2]));
6052 emit_insn (gen_vec_interleave_lowv2di (tmp2,
6053 gen_lowpart (V2DImode, tmp0),
6054 gen_lowpart (V2DImode, tmp1)));
6055 emit_move_insn (operands[0], gen_lowpart (V4SImode, tmp2));
6060 (define_mode_attr ssepackfltmode
6061 [(V8DF "V16SI") (V4DF "V8SI") (V2DF "V4SI")])
6063 (define_expand "vec_pack_ufix_trunc_<mode>"
6064 [(match_operand:<ssepackfltmode> 0 "register_operand")
6065 (match_operand:VF2 1 "register_operand")
6066 (match_operand:VF2 2 "register_operand")]
6069 if (<MODE>mode == V8DFmode)
6073 r1 = gen_reg_rtx (V8SImode);
6074 r2 = gen_reg_rtx (V8SImode);
6076 emit_insn (gen_ufix_truncv8dfv8si2 (r1, operands[1]));
6077 emit_insn (gen_ufix_truncv8dfv8si2 (r2, operands[2]));
6078 emit_insn (gen_avx_vec_concatv16si (operands[0], r1, r2));
6083 tmp[0] = ix86_expand_adjust_ufix_to_sfix_si (operands[1], &tmp[2]);
6084 tmp[1] = ix86_expand_adjust_ufix_to_sfix_si (operands[2], &tmp[3]);
6085 tmp[4] = gen_reg_rtx (<ssepackfltmode>mode);
6086 emit_insn (gen_vec_pack_sfix_trunc_<mode> (tmp[4], tmp[0], tmp[1]));
6087 if (<ssepackfltmode>mode == V4SImode || TARGET_AVX2)
6089 tmp[5] = gen_reg_rtx (<ssepackfltmode>mode);
6090 ix86_expand_vec_extract_even_odd (tmp[5], tmp[2], tmp[3], 0);
6094 tmp[5] = gen_reg_rtx (V8SFmode);
6095 ix86_expand_vec_extract_even_odd (tmp[5],
6096 gen_lowpart (V8SFmode, tmp[2]),
6097 gen_lowpart (V8SFmode, tmp[3]), 0);
6098 tmp[5] = gen_lowpart (V8SImode, tmp[5]);
6100 tmp[6] = expand_simple_binop (<ssepackfltmode>mode, XOR, tmp[4], tmp[5],
6101 operands[0], 0, OPTAB_DIRECT);
6102 if (tmp[6] != operands[0])
6103 emit_move_insn (operands[0], tmp[6]);
6109 (define_expand "avx512f_vec_pack_sfix_v8df"
6110 [(match_operand:V16SI 0 "register_operand")
6111 (match_operand:V8DF 1 "nonimmediate_operand")
6112 (match_operand:V8DF 2 "nonimmediate_operand")]
6117 r1 = gen_reg_rtx (V8SImode);
6118 r2 = gen_reg_rtx (V8SImode);
6120 emit_insn (gen_avx512f_cvtpd2dq512 (r1, operands[1]));
6121 emit_insn (gen_avx512f_cvtpd2dq512 (r2, operands[2]));
6122 emit_insn (gen_avx_vec_concatv16si (operands[0], r1, r2));
6126 (define_expand "vec_pack_sfix_v4df"
6127 [(match_operand:V8SI 0 "register_operand")
6128 (match_operand:V4DF 1 "nonimmediate_operand")
6129 (match_operand:V4DF 2 "nonimmediate_operand")]
6134 r1 = gen_reg_rtx (V4SImode);
6135 r2 = gen_reg_rtx (V4SImode);
6137 emit_insn (gen_avx_cvtpd2dq256 (r1, operands[1]));
6138 emit_insn (gen_avx_cvtpd2dq256 (r2, operands[2]));
6139 emit_insn (gen_avx_vec_concatv8si (operands[0], r1, r2));
6143 (define_expand "vec_pack_sfix_v2df"
6144 [(match_operand:V4SI 0 "register_operand")
6145 (match_operand:V2DF 1 "vector_operand")
6146 (match_operand:V2DF 2 "vector_operand")]
6149 rtx tmp0, tmp1, tmp2;
6151 if (TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
6153 tmp0 = gen_reg_rtx (V4DFmode);
6154 tmp1 = force_reg (V2DFmode, operands[1]);
6156 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
6157 emit_insn (gen_avx_cvtpd2dq256 (operands[0], tmp0));
6161 tmp0 = gen_reg_rtx (V4SImode);
6162 tmp1 = gen_reg_rtx (V4SImode);
6163 tmp2 = gen_reg_rtx (V2DImode);
6165 emit_insn (gen_sse2_cvtpd2dq (tmp0, operands[1]));
6166 emit_insn (gen_sse2_cvtpd2dq (tmp1, operands[2]));
6167 emit_insn (gen_vec_interleave_lowv2di (tmp2,
6168 gen_lowpart (V2DImode, tmp0),
6169 gen_lowpart (V2DImode, tmp1)));
6170 emit_move_insn (operands[0], gen_lowpart (V4SImode, tmp2));
6175 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6177 ;; Parallel single-precision floating point element swizzling
6179 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6181 (define_expand "sse_movhlps_exp"
6182 [(set (match_operand:V4SF 0 "nonimmediate_operand")
6185 (match_operand:V4SF 1 "nonimmediate_operand")
6186 (match_operand:V4SF 2 "nonimmediate_operand"))
6187 (parallel [(const_int 6)
6193 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
6195 emit_insn (gen_sse_movhlps (dst, operands[1], operands[2]));
6197 /* Fix up the destination if needed. */
6198 if (dst != operands[0])
6199 emit_move_insn (operands[0], dst);
6204 (define_insn "sse_movhlps"
6205 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,v,x,v,m")
6208 (match_operand:V4SF 1 "nonimmediate_operand" " 0,v,0,v,0")
6209 (match_operand:V4SF 2 "nonimmediate_operand" " x,v,o,o,v"))
6210 (parallel [(const_int 6)
6214 "TARGET_SSE && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
6216 movhlps\t{%2, %0|%0, %2}
6217 vmovhlps\t{%2, %1, %0|%0, %1, %2}
6218 movlps\t{%H2, %0|%0, %H2}
6219 vmovlps\t{%H2, %1, %0|%0, %1, %H2}
6220 %vmovhps\t{%2, %0|%q0, %2}"
6221 [(set_attr "isa" "noavx,avx,noavx,avx,*")
6222 (set_attr "type" "ssemov")
6223 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,maybe_vex")
6224 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF,V2SF")])
6226 (define_expand "sse_movlhps_exp"
6227 [(set (match_operand:V4SF 0 "nonimmediate_operand")
6230 (match_operand:V4SF 1 "nonimmediate_operand")
6231 (match_operand:V4SF 2 "nonimmediate_operand"))
6232 (parallel [(const_int 0)
6238 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
6240 emit_insn (gen_sse_movlhps (dst, operands[1], operands[2]));
6242 /* Fix up the destination if needed. */
6243 if (dst != operands[0])
6244 emit_move_insn (operands[0], dst);
6249 (define_insn "sse_movlhps"
6250 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,v,x,v,o")
6253 (match_operand:V4SF 1 "nonimmediate_operand" " 0,v,0,v,0")
6254 (match_operand:V4SF 2 "nonimmediate_operand" " x,v,m,v,v"))
6255 (parallel [(const_int 0)
6259 "TARGET_SSE && ix86_binary_operator_ok (UNKNOWN, V4SFmode, operands)"
6261 movlhps\t{%2, %0|%0, %2}
6262 vmovlhps\t{%2, %1, %0|%0, %1, %2}
6263 movhps\t{%2, %0|%0, %q2}
6264 vmovhps\t{%2, %1, %0|%0, %1, %q2}
6265 %vmovlps\t{%2, %H0|%H0, %2}"
6266 [(set_attr "isa" "noavx,avx,noavx,avx,*")
6267 (set_attr "type" "ssemov")
6268 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,maybe_vex")
6269 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF,V2SF")])
6271 (define_insn "<mask_codefor>avx512f_unpckhps512<mask_name>"
6272 [(set (match_operand:V16SF 0 "register_operand" "=v")
6275 (match_operand:V16SF 1 "register_operand" "v")
6276 (match_operand:V16SF 2 "nonimmediate_operand" "vm"))
6277 (parallel [(const_int 2) (const_int 18)
6278 (const_int 3) (const_int 19)
6279 (const_int 6) (const_int 22)
6280 (const_int 7) (const_int 23)
6281 (const_int 10) (const_int 26)
6282 (const_int 11) (const_int 27)
6283 (const_int 14) (const_int 30)
6284 (const_int 15) (const_int 31)])))]
6286 "vunpckhps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6287 [(set_attr "type" "sselog")
6288 (set_attr "prefix" "evex")
6289 (set_attr "mode" "V16SF")])
6291 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
6292 (define_insn "avx_unpckhps256<mask_name>"
6293 [(set (match_operand:V8SF 0 "register_operand" "=v")
6296 (match_operand:V8SF 1 "register_operand" "v")
6297 (match_operand:V8SF 2 "nonimmediate_operand" "vm"))
6298 (parallel [(const_int 2) (const_int 10)
6299 (const_int 3) (const_int 11)
6300 (const_int 6) (const_int 14)
6301 (const_int 7) (const_int 15)])))]
6302 "TARGET_AVX && <mask_avx512vl_condition>"
6303 "vunpckhps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6304 [(set_attr "type" "sselog")
6305 (set_attr "prefix" "vex")
6306 (set_attr "mode" "V8SF")])
6308 (define_expand "vec_interleave_highv8sf"
6312 (match_operand:V8SF 1 "register_operand")
6313 (match_operand:V8SF 2 "nonimmediate_operand"))
6314 (parallel [(const_int 0) (const_int 8)
6315 (const_int 1) (const_int 9)
6316 (const_int 4) (const_int 12)
6317 (const_int 5) (const_int 13)])))
6323 (parallel [(const_int 2) (const_int 10)
6324 (const_int 3) (const_int 11)
6325 (const_int 6) (const_int 14)
6326 (const_int 7) (const_int 15)])))
6327 (set (match_operand:V8SF 0 "register_operand")
6332 (parallel [(const_int 4) (const_int 5)
6333 (const_int 6) (const_int 7)
6334 (const_int 12) (const_int 13)
6335 (const_int 14) (const_int 15)])))]
6338 operands[3] = gen_reg_rtx (V8SFmode);
6339 operands[4] = gen_reg_rtx (V8SFmode);
6342 (define_insn "vec_interleave_highv4sf<mask_name>"
6343 [(set (match_operand:V4SF 0 "register_operand" "=x,v")
6346 (match_operand:V4SF 1 "register_operand" "0,v")
6347 (match_operand:V4SF 2 "vector_operand" "xBm,vm"))
6348 (parallel [(const_int 2) (const_int 6)
6349 (const_int 3) (const_int 7)])))]
6350 "TARGET_SSE && <mask_avx512vl_condition>"
6352 unpckhps\t{%2, %0|%0, %2}
6353 vunpckhps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6354 [(set_attr "isa" "noavx,avx")
6355 (set_attr "type" "sselog")
6356 (set_attr "prefix" "orig,vex")
6357 (set_attr "mode" "V4SF")])
6359 (define_insn "<mask_codefor>avx512f_unpcklps512<mask_name>"
6360 [(set (match_operand:V16SF 0 "register_operand" "=v")
6363 (match_operand:V16SF 1 "register_operand" "v")
6364 (match_operand:V16SF 2 "nonimmediate_operand" "vm"))
6365 (parallel [(const_int 0) (const_int 16)
6366 (const_int 1) (const_int 17)
6367 (const_int 4) (const_int 20)
6368 (const_int 5) (const_int 21)
6369 (const_int 8) (const_int 24)
6370 (const_int 9) (const_int 25)
6371 (const_int 12) (const_int 28)
6372 (const_int 13) (const_int 29)])))]
6374 "vunpcklps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6375 [(set_attr "type" "sselog")
6376 (set_attr "prefix" "evex")
6377 (set_attr "mode" "V16SF")])
6379 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
6380 (define_insn "avx_unpcklps256<mask_name>"
6381 [(set (match_operand:V8SF 0 "register_operand" "=v")
6384 (match_operand:V8SF 1 "register_operand" "v")
6385 (match_operand:V8SF 2 "nonimmediate_operand" "vm"))
6386 (parallel [(const_int 0) (const_int 8)
6387 (const_int 1) (const_int 9)
6388 (const_int 4) (const_int 12)
6389 (const_int 5) (const_int 13)])))]
6390 "TARGET_AVX && <mask_avx512vl_condition>"
6391 "vunpcklps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6392 [(set_attr "type" "sselog")
6393 (set_attr "prefix" "vex")
6394 (set_attr "mode" "V8SF")])
6396 (define_insn "unpcklps128_mask"
6397 [(set (match_operand:V4SF 0 "register_operand" "=v")
6401 (match_operand:V4SF 1 "register_operand" "v")
6402 (match_operand:V4SF 2 "nonimmediate_operand" "vm"))
6403 (parallel [(const_int 0) (const_int 4)
6404 (const_int 1) (const_int 5)]))
6405 (match_operand:V4SF 3 "vector_move_operand" "0C")
6406 (match_operand:QI 4 "register_operand" "Yk")))]
6408 "vunpcklps\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
6409 [(set_attr "type" "sselog")
6410 (set_attr "prefix" "evex")
6411 (set_attr "mode" "V4SF")])
6413 (define_expand "vec_interleave_lowv8sf"
6417 (match_operand:V8SF 1 "register_operand")
6418 (match_operand:V8SF 2 "nonimmediate_operand"))
6419 (parallel [(const_int 0) (const_int 8)
6420 (const_int 1) (const_int 9)
6421 (const_int 4) (const_int 12)
6422 (const_int 5) (const_int 13)])))
6428 (parallel [(const_int 2) (const_int 10)
6429 (const_int 3) (const_int 11)
6430 (const_int 6) (const_int 14)
6431 (const_int 7) (const_int 15)])))
6432 (set (match_operand:V8SF 0 "register_operand")
6437 (parallel [(const_int 0) (const_int 1)
6438 (const_int 2) (const_int 3)
6439 (const_int 8) (const_int 9)
6440 (const_int 10) (const_int 11)])))]
6443 operands[3] = gen_reg_rtx (V8SFmode);
6444 operands[4] = gen_reg_rtx (V8SFmode);
6447 (define_insn "vec_interleave_lowv4sf"
6448 [(set (match_operand:V4SF 0 "register_operand" "=x,v")
6451 (match_operand:V4SF 1 "register_operand" "0,v")
6452 (match_operand:V4SF 2 "vector_operand" "xBm,vm"))
6453 (parallel [(const_int 0) (const_int 4)
6454 (const_int 1) (const_int 5)])))]
6457 unpcklps\t{%2, %0|%0, %2}
6458 vunpcklps\t{%2, %1, %0|%0, %1, %2}"
6459 [(set_attr "isa" "noavx,avx")
6460 (set_attr "type" "sselog")
6461 (set_attr "prefix" "orig,maybe_evex")
6462 (set_attr "mode" "V4SF")])
6464 ;; These are modeled with the same vec_concat as the others so that we
6465 ;; capture users of shufps that can use the new instructions
6466 (define_insn "avx_movshdup256<mask_name>"
6467 [(set (match_operand:V8SF 0 "register_operand" "=v")
6470 (match_operand:V8SF 1 "nonimmediate_operand" "vm")
6472 (parallel [(const_int 1) (const_int 1)
6473 (const_int 3) (const_int 3)
6474 (const_int 5) (const_int 5)
6475 (const_int 7) (const_int 7)])))]
6476 "TARGET_AVX && <mask_avx512vl_condition>"
6477 "vmovshdup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6478 [(set_attr "type" "sse")
6479 (set_attr "prefix" "vex")
6480 (set_attr "mode" "V8SF")])
6482 (define_insn "sse3_movshdup<mask_name>"
6483 [(set (match_operand:V4SF 0 "register_operand" "=v")
6486 (match_operand:V4SF 1 "vector_operand" "vBm")
6488 (parallel [(const_int 1)
6492 "TARGET_SSE3 && <mask_avx512vl_condition>"
6493 "%vmovshdup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6494 [(set_attr "type" "sse")
6495 (set_attr "prefix_rep" "1")
6496 (set_attr "prefix" "maybe_vex")
6497 (set_attr "mode" "V4SF")])
6499 (define_insn "<mask_codefor>avx512f_movshdup512<mask_name>"
6500 [(set (match_operand:V16SF 0 "register_operand" "=v")
6503 (match_operand:V16SF 1 "nonimmediate_operand" "vm")
6505 (parallel [(const_int 1) (const_int 1)
6506 (const_int 3) (const_int 3)
6507 (const_int 5) (const_int 5)
6508 (const_int 7) (const_int 7)
6509 (const_int 9) (const_int 9)
6510 (const_int 11) (const_int 11)
6511 (const_int 13) (const_int 13)
6512 (const_int 15) (const_int 15)])))]
6514 "vmovshdup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6515 [(set_attr "type" "sse")
6516 (set_attr "prefix" "evex")
6517 (set_attr "mode" "V16SF")])
6519 (define_insn "avx_movsldup256<mask_name>"
6520 [(set (match_operand:V8SF 0 "register_operand" "=v")
6523 (match_operand:V8SF 1 "nonimmediate_operand" "vm")
6525 (parallel [(const_int 0) (const_int 0)
6526 (const_int 2) (const_int 2)
6527 (const_int 4) (const_int 4)
6528 (const_int 6) (const_int 6)])))]
6529 "TARGET_AVX && <mask_avx512vl_condition>"
6530 "vmovsldup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6531 [(set_attr "type" "sse")
6532 (set_attr "prefix" "vex")
6533 (set_attr "mode" "V8SF")])
6535 (define_insn "sse3_movsldup<mask_name>"
6536 [(set (match_operand:V4SF 0 "register_operand" "=v")
6539 (match_operand:V4SF 1 "vector_operand" "vBm")
6541 (parallel [(const_int 0)
6545 "TARGET_SSE3 && <mask_avx512vl_condition>"
6546 "%vmovsldup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6547 [(set_attr "type" "sse")
6548 (set_attr "prefix_rep" "1")
6549 (set_attr "prefix" "maybe_vex")
6550 (set_attr "mode" "V4SF")])
6552 (define_insn "<mask_codefor>avx512f_movsldup512<mask_name>"
6553 [(set (match_operand:V16SF 0 "register_operand" "=v")
6556 (match_operand:V16SF 1 "nonimmediate_operand" "vm")
6558 (parallel [(const_int 0) (const_int 0)
6559 (const_int 2) (const_int 2)
6560 (const_int 4) (const_int 4)
6561 (const_int 6) (const_int 6)
6562 (const_int 8) (const_int 8)
6563 (const_int 10) (const_int 10)
6564 (const_int 12) (const_int 12)
6565 (const_int 14) (const_int 14)])))]
6567 "vmovsldup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6568 [(set_attr "type" "sse")
6569 (set_attr "prefix" "evex")
6570 (set_attr "mode" "V16SF")])
6572 (define_expand "avx_shufps256<mask_expand4_name>"
6573 [(match_operand:V8SF 0 "register_operand")
6574 (match_operand:V8SF 1 "register_operand")
6575 (match_operand:V8SF 2 "nonimmediate_operand")
6576 (match_operand:SI 3 "const_int_operand")]
6579 int mask = INTVAL (operands[3]);
6580 emit_insn (gen_avx_shufps256_1<mask_expand4_name> (operands[0],
6583 GEN_INT ((mask >> 0) & 3),
6584 GEN_INT ((mask >> 2) & 3),
6585 GEN_INT (((mask >> 4) & 3) + 8),
6586 GEN_INT (((mask >> 6) & 3) + 8),
6587 GEN_INT (((mask >> 0) & 3) + 4),
6588 GEN_INT (((mask >> 2) & 3) + 4),
6589 GEN_INT (((mask >> 4) & 3) + 12),
6590 GEN_INT (((mask >> 6) & 3) + 12)
6591 <mask_expand4_args>));
6595 ;; One bit in mask selects 2 elements.
6596 (define_insn "avx_shufps256_1<mask_name>"
6597 [(set (match_operand:V8SF 0 "register_operand" "=v")
6600 (match_operand:V8SF 1 "register_operand" "v")
6601 (match_operand:V8SF 2 "nonimmediate_operand" "vm"))
6602 (parallel [(match_operand 3 "const_0_to_3_operand" )
6603 (match_operand 4 "const_0_to_3_operand" )
6604 (match_operand 5 "const_8_to_11_operand" )
6605 (match_operand 6 "const_8_to_11_operand" )
6606 (match_operand 7 "const_4_to_7_operand" )
6607 (match_operand 8 "const_4_to_7_operand" )
6608 (match_operand 9 "const_12_to_15_operand")
6609 (match_operand 10 "const_12_to_15_operand")])))]
6611 && <mask_avx512vl_condition>
6612 && (INTVAL (operands[3]) == (INTVAL (operands[7]) - 4)
6613 && INTVAL (operands[4]) == (INTVAL (operands[8]) - 4)
6614 && INTVAL (operands[5]) == (INTVAL (operands[9]) - 4)
6615 && INTVAL (operands[6]) == (INTVAL (operands[10]) - 4))"
6618 mask = INTVAL (operands[3]);
6619 mask |= INTVAL (operands[4]) << 2;
6620 mask |= (INTVAL (operands[5]) - 8) << 4;
6621 mask |= (INTVAL (operands[6]) - 8) << 6;
6622 operands[3] = GEN_INT (mask);
6624 return "vshufps\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
6626 [(set_attr "type" "sseshuf")
6627 (set_attr "length_immediate" "1")
6628 (set_attr "prefix" "<mask_prefix>")
6629 (set_attr "mode" "V8SF")])
6631 (define_expand "sse_shufps<mask_expand4_name>"
6632 [(match_operand:V4SF 0 "register_operand")
6633 (match_operand:V4SF 1 "register_operand")
6634 (match_operand:V4SF 2 "vector_operand")
6635 (match_operand:SI 3 "const_int_operand")]
6638 int mask = INTVAL (operands[3]);
6639 emit_insn (gen_sse_shufps_v4sf<mask_expand4_name> (operands[0],
6642 GEN_INT ((mask >> 0) & 3),
6643 GEN_INT ((mask >> 2) & 3),
6644 GEN_INT (((mask >> 4) & 3) + 4),
6645 GEN_INT (((mask >> 6) & 3) + 4)
6646 <mask_expand4_args>));
6650 (define_insn "sse_shufps_v4sf_mask"
6651 [(set (match_operand:V4SF 0 "register_operand" "=v")
6655 (match_operand:V4SF 1 "register_operand" "v")
6656 (match_operand:V4SF 2 "nonimmediate_operand" "vm"))
6657 (parallel [(match_operand 3 "const_0_to_3_operand")
6658 (match_operand 4 "const_0_to_3_operand")
6659 (match_operand 5 "const_4_to_7_operand")
6660 (match_operand 6 "const_4_to_7_operand")]))
6661 (match_operand:V4SF 7 "vector_move_operand" "0C")
6662 (match_operand:QI 8 "register_operand" "Yk")))]
6666 mask |= INTVAL (operands[3]) << 0;
6667 mask |= INTVAL (operands[4]) << 2;
6668 mask |= (INTVAL (operands[5]) - 4) << 4;
6669 mask |= (INTVAL (operands[6]) - 4) << 6;
6670 operands[3] = GEN_INT (mask);
6672 return "vshufps\t{%3, %2, %1, %0%{%8%}%N7|%0%{%8%}%N7, %1, %2, %3}";
6674 [(set_attr "type" "sseshuf")
6675 (set_attr "length_immediate" "1")
6676 (set_attr "prefix" "evex")
6677 (set_attr "mode" "V4SF")])
6679 (define_insn "sse_shufps_<mode>"
6680 [(set (match_operand:VI4F_128 0 "register_operand" "=x,v")
6681 (vec_select:VI4F_128
6682 (vec_concat:<ssedoublevecmode>
6683 (match_operand:VI4F_128 1 "register_operand" "0,v")
6684 (match_operand:VI4F_128 2 "vector_operand" "xBm,vm"))
6685 (parallel [(match_operand 3 "const_0_to_3_operand")
6686 (match_operand 4 "const_0_to_3_operand")
6687 (match_operand 5 "const_4_to_7_operand")
6688 (match_operand 6 "const_4_to_7_operand")])))]
6692 mask |= INTVAL (operands[3]) << 0;
6693 mask |= INTVAL (operands[4]) << 2;
6694 mask |= (INTVAL (operands[5]) - 4) << 4;
6695 mask |= (INTVAL (operands[6]) - 4) << 6;
6696 operands[3] = GEN_INT (mask);
6698 switch (which_alternative)
6701 return "shufps\t{%3, %2, %0|%0, %2, %3}";
6703 return "vshufps\t{%3, %2, %1, %0|%0, %1, %2, %3}";
6708 [(set_attr "isa" "noavx,avx")
6709 (set_attr "type" "sseshuf")
6710 (set_attr "length_immediate" "1")
6711 (set_attr "prefix" "orig,maybe_evex")
6712 (set_attr "mode" "V4SF")])
6714 (define_insn "sse_storehps"
6715 [(set (match_operand:V2SF 0 "nonimmediate_operand" "=m,v,v")
6717 (match_operand:V4SF 1 "nonimmediate_operand" "v,v,o")
6718 (parallel [(const_int 2) (const_int 3)])))]
6719 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
6721 %vmovhps\t{%1, %0|%q0, %1}
6722 %vmovhlps\t{%1, %d0|%d0, %1}
6723 %vmovlps\t{%H1, %d0|%d0, %H1}"
6724 [(set_attr "type" "ssemov")
6725 (set_attr "prefix" "maybe_vex")
6726 (set_attr "mode" "V2SF,V4SF,V2SF")])
6728 (define_expand "sse_loadhps_exp"
6729 [(set (match_operand:V4SF 0 "nonimmediate_operand")
6732 (match_operand:V4SF 1 "nonimmediate_operand")
6733 (parallel [(const_int 0) (const_int 1)]))
6734 (match_operand:V2SF 2 "nonimmediate_operand")))]
6737 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
6739 emit_insn (gen_sse_loadhps (dst, operands[1], operands[2]));
6741 /* Fix up the destination if needed. */
6742 if (dst != operands[0])
6743 emit_move_insn (operands[0], dst);
6748 (define_insn "sse_loadhps"
6749 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,v,x,v,o")
6752 (match_operand:V4SF 1 "nonimmediate_operand" " 0,v,0,v,0")
6753 (parallel [(const_int 0) (const_int 1)]))
6754 (match_operand:V2SF 2 "nonimmediate_operand" " m,m,x,v,v")))]
6757 movhps\t{%2, %0|%0, %q2}
6758 vmovhps\t{%2, %1, %0|%0, %1, %q2}
6759 movlhps\t{%2, %0|%0, %2}
6760 vmovlhps\t{%2, %1, %0|%0, %1, %2}
6761 %vmovlps\t{%2, %H0|%H0, %2}"
6762 [(set_attr "isa" "noavx,avx,noavx,avx,*")
6763 (set_attr "type" "ssemov")
6764 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,maybe_vex")
6765 (set_attr "mode" "V2SF,V2SF,V4SF,V4SF,V2SF")])
6767 (define_insn "sse_storelps"
6768 [(set (match_operand:V2SF 0 "nonimmediate_operand" "=m,v,v")
6770 (match_operand:V4SF 1 "nonimmediate_operand" " v,v,m")
6771 (parallel [(const_int 0) (const_int 1)])))]
6772 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
6774 %vmovlps\t{%1, %0|%q0, %1}
6775 %vmovaps\t{%1, %0|%0, %1}
6776 %vmovlps\t{%1, %d0|%d0, %q1}"
6777 [(set_attr "type" "ssemov")
6778 (set_attr "prefix" "maybe_vex")
6779 (set_attr "mode" "V2SF,V4SF,V2SF")])
6781 (define_expand "sse_loadlps_exp"
6782 [(set (match_operand:V4SF 0 "nonimmediate_operand")
6784 (match_operand:V2SF 2 "nonimmediate_operand")
6786 (match_operand:V4SF 1 "nonimmediate_operand")
6787 (parallel [(const_int 2) (const_int 3)]))))]
6790 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
6792 emit_insn (gen_sse_loadlps (dst, operands[1], operands[2]));
6794 /* Fix up the destination if needed. */
6795 if (dst != operands[0])
6796 emit_move_insn (operands[0], dst);
6801 (define_insn "sse_loadlps"
6802 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,v,x,v,m")
6804 (match_operand:V2SF 2 "nonimmediate_operand" " 0,v,m,m,v")
6806 (match_operand:V4SF 1 "nonimmediate_operand" " x,v,0,v,0")
6807 (parallel [(const_int 2) (const_int 3)]))))]
6810 shufps\t{$0xe4, %1, %0|%0, %1, 0xe4}
6811 vshufps\t{$0xe4, %1, %2, %0|%0, %2, %1, 0xe4}
6812 movlps\t{%2, %0|%0, %q2}
6813 vmovlps\t{%2, %1, %0|%0, %1, %q2}
6814 %vmovlps\t{%2, %0|%q0, %2}"
6815 [(set_attr "isa" "noavx,avx,noavx,avx,*")
6816 (set_attr "type" "sseshuf,sseshuf,ssemov,ssemov,ssemov")
6817 (set (attr "length_immediate")
6818 (if_then_else (eq_attr "alternative" "0,1")
6820 (const_string "*")))
6821 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,maybe_vex")
6822 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF,V2SF")])
6824 (define_insn "sse_movss"
6825 [(set (match_operand:V4SF 0 "register_operand" "=x,v")
6827 (match_operand:V4SF 2 "register_operand" " x,v")
6828 (match_operand:V4SF 1 "register_operand" " 0,v")
6832 movss\t{%2, %0|%0, %2}
6833 vmovss\t{%2, %1, %0|%0, %1, %2}"
6834 [(set_attr "isa" "noavx,avx")
6835 (set_attr "type" "ssemov")
6836 (set_attr "prefix" "orig,maybe_evex")
6837 (set_attr "mode" "SF")])
6839 (define_insn "avx2_vec_dup<mode>"
6840 [(set (match_operand:VF1_128_256 0 "register_operand" "=v")
6841 (vec_duplicate:VF1_128_256
6843 (match_operand:V4SF 1 "register_operand" "v")
6844 (parallel [(const_int 0)]))))]
6846 "vbroadcastss\t{%1, %0|%0, %1}"
6847 [(set_attr "type" "sselog1")
6848 (set_attr "prefix" "maybe_evex")
6849 (set_attr "mode" "<MODE>")])
6851 (define_insn "avx2_vec_dupv8sf_1"
6852 [(set (match_operand:V8SF 0 "register_operand" "=v")
6855 (match_operand:V8SF 1 "register_operand" "v")
6856 (parallel [(const_int 0)]))))]
6858 "vbroadcastss\t{%x1, %0|%0, %x1}"
6859 [(set_attr "type" "sselog1")
6860 (set_attr "prefix" "maybe_evex")
6861 (set_attr "mode" "V8SF")])
6863 (define_insn "avx512f_vec_dup<mode>_1"
6864 [(set (match_operand:VF_512 0 "register_operand" "=v")
6865 (vec_duplicate:VF_512
6866 (vec_select:<ssescalarmode>
6867 (match_operand:VF_512 1 "register_operand" "v")
6868 (parallel [(const_int 0)]))))]
6870 "vbroadcast<bcstscalarsuff>\t{%x1, %0|%0, %x1}"
6871 [(set_attr "type" "sselog1")
6872 (set_attr "prefix" "evex")
6873 (set_attr "mode" "<MODE>")])
6875 ;; Although insertps takes register source, we prefer
6876 ;; unpcklps with register source since it is shorter.
6877 (define_insn "*vec_concatv2sf_sse4_1"
6878 [(set (match_operand:V2SF 0 "register_operand"
6879 "=Yr,*x, v,Yr,*x,v,v,*y ,*y")
6881 (match_operand:SF 1 "nonimmediate_operand"
6882 " 0, 0,Yv, 0,0, v,m, 0 , m")
6883 (match_operand:SF 2 "vector_move_operand"
6884 " Yr,*x,Yv, m,m, m,C,*ym, C")))]
6885 "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
6887 unpcklps\t{%2, %0|%0, %2}
6888 unpcklps\t{%2, %0|%0, %2}
6889 vunpcklps\t{%2, %1, %0|%0, %1, %2}
6890 insertps\t{$0x10, %2, %0|%0, %2, 0x10}
6891 insertps\t{$0x10, %2, %0|%0, %2, 0x10}
6892 vinsertps\t{$0x10, %2, %1, %0|%0, %1, %2, 0x10}
6893 %vmovss\t{%1, %0|%0, %1}
6894 punpckldq\t{%2, %0|%0, %2}
6895 movd\t{%1, %0|%0, %1}"
6897 (cond [(eq_attr "alternative" "0,1,3,4")
6898 (const_string "noavx")
6899 (eq_attr "alternative" "2,5")
6900 (const_string "avx")
6902 (const_string "*")))
6904 (cond [(eq_attr "alternative" "6")
6905 (const_string "ssemov")
6906 (eq_attr "alternative" "7")
6907 (const_string "mmxcvt")
6908 (eq_attr "alternative" "8")
6909 (const_string "mmxmov")
6911 (const_string "sselog")))
6912 (set (attr "prefix_data16")
6913 (if_then_else (eq_attr "alternative" "3,4")
6915 (const_string "*")))
6916 (set (attr "prefix_extra")
6917 (if_then_else (eq_attr "alternative" "3,4,5")
6919 (const_string "*")))
6920 (set (attr "length_immediate")
6921 (if_then_else (eq_attr "alternative" "3,4,5")
6923 (const_string "*")))
6924 (set (attr "prefix")
6925 (cond [(eq_attr "alternative" "2,5")
6926 (const_string "maybe_evex")
6927 (eq_attr "alternative" "6")
6928 (const_string "maybe_vex")
6930 (const_string "orig")))
6931 (set_attr "mode" "V4SF,V4SF,V4SF,V4SF,V4SF,V4SF,SF,DI,DI")])
6933 ;; ??? In theory we can match memory for the MMX alternative, but allowing
6934 ;; vector_operand for operand 2 and *not* allowing memory for the SSE
6935 ;; alternatives pretty much forces the MMX alternative to be chosen.
6936 (define_insn "*vec_concatv2sf_sse"
6937 [(set (match_operand:V2SF 0 "register_operand" "=x,x,*y,*y")
6939 (match_operand:SF 1 "nonimmediate_operand" " 0,m, 0, m")
6940 (match_operand:SF 2 "reg_or_0_operand" " x,C,*y, C")))]
6943 unpcklps\t{%2, %0|%0, %2}
6944 movss\t{%1, %0|%0, %1}
6945 punpckldq\t{%2, %0|%0, %2}
6946 movd\t{%1, %0|%0, %1}"
6947 [(set_attr "type" "sselog,ssemov,mmxcvt,mmxmov")
6948 (set_attr "mode" "V4SF,SF,DI,DI")])
6950 (define_insn "*vec_concatv4sf"
6951 [(set (match_operand:V4SF 0 "register_operand" "=x,v,x,v")
6953 (match_operand:V2SF 1 "register_operand" " 0,v,0,v")
6954 (match_operand:V2SF 2 "nonimmediate_operand" " x,v,m,m")))]
6957 movlhps\t{%2, %0|%0, %2}
6958 vmovlhps\t{%2, %1, %0|%0, %1, %2}
6959 movhps\t{%2, %0|%0, %q2}
6960 vmovhps\t{%2, %1, %0|%0, %1, %q2}"
6961 [(set_attr "isa" "noavx,avx,noavx,avx")
6962 (set_attr "type" "ssemov")
6963 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex")
6964 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF")])
6966 ;; Avoid combining registers from different units in a single alternative,
6967 ;; see comment above inline_secondary_memory_needed function in i386.c
6968 (define_insn "vec_set<mode>_0"
6969 [(set (match_operand:VI4F_128 0 "nonimmediate_operand"
6970 "=Yr,*x,v,v,Yi,x,x,v,Yr ,*x ,x ,m ,m ,m")
6972 (vec_duplicate:VI4F_128
6973 (match_operand:<ssescalarmode> 2 "general_operand"
6974 " Yr,*x,v,m,r ,m,x,v,*rm,*rm,*rm,!x,!*re,!*fF"))
6975 (match_operand:VI4F_128 1 "vector_move_operand"
6976 " C , C,C,C,C ,C,0,v,0 ,0 ,x ,0 ,0 ,0")
6980 insertps\t{$0xe, %2, %0|%0, %2, 0xe}
6981 insertps\t{$0xe, %2, %0|%0, %2, 0xe}
6982 vinsertps\t{$0xe, %2, %2, %0|%0, %2, %2, 0xe}
6983 %vmov<ssescalarmodesuffix>\t{%2, %0|%0, %2}
6984 %vmovd\t{%2, %0|%0, %2}
6985 movss\t{%2, %0|%0, %2}
6986 movss\t{%2, %0|%0, %2}
6987 vmovss\t{%2, %1, %0|%0, %1, %2}
6988 pinsrd\t{$0, %2, %0|%0, %2, 0}
6989 pinsrd\t{$0, %2, %0|%0, %2, 0}
6990 vpinsrd\t{$0, %2, %1, %0|%0, %1, %2, 0}
6995 (cond [(eq_attr "alternative" "0,1,8,9")
6996 (const_string "sse4_noavx")
6997 (eq_attr "alternative" "2,7,10")
6998 (const_string "avx")
6999 (eq_attr "alternative" "3,4")
7000 (const_string "sse2")
7001 (eq_attr "alternative" "5,6")
7002 (const_string "noavx")
7004 (const_string "*")))
7006 (cond [(eq_attr "alternative" "0,1,2,8,9,10")
7007 (const_string "sselog")
7008 (eq_attr "alternative" "12")
7009 (const_string "imov")
7010 (eq_attr "alternative" "13")
7011 (const_string "fmov")
7013 (const_string "ssemov")))
7014 (set (attr "prefix_extra")
7015 (if_then_else (eq_attr "alternative" "8,9,10")
7017 (const_string "*")))
7018 (set (attr "length_immediate")
7019 (if_then_else (eq_attr "alternative" "8,9,10")
7021 (const_string "*")))
7022 (set (attr "prefix")
7023 (cond [(eq_attr "alternative" "0,1,5,6,8,9")
7024 (const_string "orig")
7025 (eq_attr "alternative" "2")
7026 (const_string "maybe_evex")
7027 (eq_attr "alternative" "3,4")
7028 (const_string "maybe_vex")
7029 (eq_attr "alternative" "7,10")
7030 (const_string "vex")
7032 (const_string "*")))
7033 (set_attr "mode" "SF,SF,SF,<ssescalarmode>,SI,SF,SF,SF,TI,TI,TI,*,*,*")])
7035 ;; A subset is vec_setv4sf.
7036 (define_insn "*vec_setv4sf_sse4_1"
7037 [(set (match_operand:V4SF 0 "register_operand" "=Yr,*x,v")
7040 (match_operand:SF 2 "nonimmediate_operand" "Yrm,*xm,vm"))
7041 (match_operand:V4SF 1 "register_operand" "0,0,v")
7042 (match_operand:SI 3 "const_int_operand")))]
7044 && ((unsigned) exact_log2 (INTVAL (operands[3]))
7045 < GET_MODE_NUNITS (V4SFmode))"
7047 operands[3] = GEN_INT (exact_log2 (INTVAL (operands[3])) << 4);
7048 switch (which_alternative)
7052 return "insertps\t{%3, %2, %0|%0, %2, %3}";
7054 return "vinsertps\t{%3, %2, %1, %0|%0, %1, %2, %3}";
7059 [(set_attr "isa" "noavx,noavx,avx")
7060 (set_attr "type" "sselog")
7061 (set_attr "prefix_data16" "1,1,*")
7062 (set_attr "prefix_extra" "1")
7063 (set_attr "length_immediate" "1")
7064 (set_attr "prefix" "orig,orig,maybe_evex")
7065 (set_attr "mode" "V4SF")])
7067 (define_insn "sse4_1_insertps"
7068 [(set (match_operand:V4SF 0 "register_operand" "=Yr,*x,v")
7069 (unspec:V4SF [(match_operand:V4SF 2 "nonimmediate_operand" "Yrm,*xm,vm")
7070 (match_operand:V4SF 1 "register_operand" "0,0,v")
7071 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")]
7075 if (MEM_P (operands[2]))
7077 unsigned count_s = INTVAL (operands[3]) >> 6;
7079 operands[3] = GEN_INT (INTVAL (operands[3]) & 0x3f);
7080 operands[2] = adjust_address_nv (operands[2], SFmode, count_s * 4);
7082 switch (which_alternative)
7086 return "insertps\t{%3, %2, %0|%0, %2, %3}";
7088 return "vinsertps\t{%3, %2, %1, %0|%0, %1, %2, %3}";
7093 [(set_attr "isa" "noavx,noavx,avx")
7094 (set_attr "type" "sselog")
7095 (set_attr "prefix_data16" "1,1,*")
7096 (set_attr "prefix_extra" "1")
7097 (set_attr "length_immediate" "1")
7098 (set_attr "prefix" "orig,orig,maybe_evex")
7099 (set_attr "mode" "V4SF")])
7102 [(set (match_operand:VI4F_128 0 "memory_operand")
7104 (vec_duplicate:VI4F_128
7105 (match_operand:<ssescalarmode> 1 "nonmemory_operand"))
7108 "TARGET_SSE && reload_completed"
7109 [(set (match_dup 0) (match_dup 1))]
7110 "operands[0] = adjust_address (operands[0], <ssescalarmode>mode, 0);")
7112 (define_expand "vec_set<mode>"
7113 [(match_operand:V 0 "register_operand")
7114 (match_operand:<ssescalarmode> 1 "register_operand")
7115 (match_operand 2 "const_int_operand")]
7118 ix86_expand_vector_set (false, operands[0], operands[1],
7119 INTVAL (operands[2]));
7123 (define_insn_and_split "*vec_extractv4sf_0"
7124 [(set (match_operand:SF 0 "nonimmediate_operand" "=v,m,f,r")
7126 (match_operand:V4SF 1 "nonimmediate_operand" "vm,v,m,m")
7127 (parallel [(const_int 0)])))]
7128 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7130 "&& reload_completed"
7131 [(set (match_dup 0) (match_dup 1))]
7132 "operands[1] = gen_lowpart (SFmode, operands[1]);")
7134 (define_insn_and_split "*sse4_1_extractps"
7135 [(set (match_operand:SF 0 "nonimmediate_operand" "=rm,rm,rm,Yv,Yv")
7137 (match_operand:V4SF 1 "register_operand" "Yr,*x,v,0,v")
7138 (parallel [(match_operand:SI 2 "const_0_to_3_operand" "n,n,n,n,n")])))]
7141 extractps\t{%2, %1, %0|%0, %1, %2}
7142 extractps\t{%2, %1, %0|%0, %1, %2}
7143 vextractps\t{%2, %1, %0|%0, %1, %2}
7146 "&& reload_completed && SSE_REG_P (operands[0])"
7149 rtx dest = lowpart_subreg (V4SFmode, operands[0], SFmode);
7150 switch (INTVAL (operands[2]))
7154 emit_insn (gen_sse_shufps_v4sf (dest, operands[1], operands[1],
7155 operands[2], operands[2],
7156 GEN_INT (INTVAL (operands[2]) + 4),
7157 GEN_INT (INTVAL (operands[2]) + 4)));
7160 emit_insn (gen_vec_interleave_highv4sf (dest, operands[1], operands[1]));
7163 /* 0 should be handled by the *vec_extractv4sf_0 pattern above. */
7168 [(set_attr "isa" "noavx,noavx,avx,noavx,avx")
7169 (set_attr "type" "sselog,sselog,sselog,*,*")
7170 (set_attr "prefix_data16" "1,1,1,*,*")
7171 (set_attr "prefix_extra" "1,1,1,*,*")
7172 (set_attr "length_immediate" "1,1,1,*,*")
7173 (set_attr "prefix" "orig,orig,maybe_evex,*,*")
7174 (set_attr "mode" "V4SF,V4SF,V4SF,*,*")])
7176 (define_insn_and_split "*vec_extractv4sf_mem"
7177 [(set (match_operand:SF 0 "register_operand" "=v,*r,f")
7179 (match_operand:V4SF 1 "memory_operand" "o,o,o")
7180 (parallel [(match_operand 2 "const_0_to_3_operand" "n,n,n")])))]
7183 "&& reload_completed"
7184 [(set (match_dup 0) (match_dup 1))]
7186 operands[1] = adjust_address (operands[1], SFmode, INTVAL (operands[2]) * 4);
7189 (define_mode_attr extract_type
7190 [(V16SF "avx512f") (V16SI "avx512f") (V8DF "avx512dq") (V8DI "avx512dq")])
7192 (define_mode_attr extract_suf
7193 [(V16SF "32x4") (V16SI "32x4") (V8DF "64x2") (V8DI "64x2")])
7195 (define_mode_iterator AVX512_VEC
7196 [(V8DF "TARGET_AVX512DQ") (V8DI "TARGET_AVX512DQ") V16SF V16SI])
7198 (define_expand "<extract_type>_vextract<shuffletype><extract_suf>_mask"
7199 [(match_operand:<ssequartermode> 0 "nonimmediate_operand")
7200 (match_operand:AVX512_VEC 1 "register_operand")
7201 (match_operand:SI 2 "const_0_to_3_operand")
7202 (match_operand:<ssequartermode> 3 "nonimmediate_operand")
7203 (match_operand:QI 4 "register_operand")]
7207 mask = INTVAL (operands[2]);
7208 rtx dest = operands[0];
7210 if (MEM_P (operands[0]) && !rtx_equal_p (operands[0], operands[3]))
7211 dest = gen_reg_rtx (<ssequartermode>mode);
7213 if (<MODE>mode == V16SImode || <MODE>mode == V16SFmode)
7214 emit_insn (gen_avx512f_vextract<shuffletype>32x4_1_mask (dest,
7215 operands[1], GEN_INT (mask * 4), GEN_INT (mask * 4 + 1),
7216 GEN_INT (mask * 4 + 2), GEN_INT (mask * 4 + 3), operands[3],
7219 emit_insn (gen_avx512dq_vextract<shuffletype>64x2_1_mask (dest,
7220 operands[1], GEN_INT (mask * 2), GEN_INT (mask * 2 + 1), operands[3],
7222 if (dest != operands[0])
7223 emit_move_insn (operands[0], dest);
7227 (define_insn "avx512dq_vextract<shuffletype>64x2_1_maskm"
7228 [(set (match_operand:<ssequartermode> 0 "memory_operand" "=m")
7229 (vec_merge:<ssequartermode>
7230 (vec_select:<ssequartermode>
7231 (match_operand:V8FI 1 "register_operand" "v")
7232 (parallel [(match_operand 2 "const_0_to_7_operand")
7233 (match_operand 3 "const_0_to_7_operand")]))
7234 (match_operand:<ssequartermode> 4 "memory_operand" "0")
7235 (match_operand:QI 5 "register_operand" "Yk")))]
7237 && INTVAL (operands[2]) % 2 == 0
7238 && INTVAL (operands[2]) == INTVAL (operands[3]) - 1
7239 && rtx_equal_p (operands[4], operands[0])"
7241 operands[2] = GEN_INT ((INTVAL (operands[2])) >> 1);
7242 return "vextract<shuffletype>64x2\t{%2, %1, %0%{%5%}|%0%{%5%}, %1, %2}";
7244 [(set_attr "type" "sselog")
7245 (set_attr "prefix_extra" "1")
7246 (set_attr "length_immediate" "1")
7247 (set_attr "memory" "store")
7248 (set_attr "prefix" "evex")
7249 (set_attr "mode" "<sseinsnmode>")])
7251 (define_insn "avx512f_vextract<shuffletype>32x4_1_maskm"
7252 [(set (match_operand:<ssequartermode> 0 "memory_operand" "=m")
7253 (vec_merge:<ssequartermode>
7254 (vec_select:<ssequartermode>
7255 (match_operand:V16FI 1 "register_operand" "v")
7256 (parallel [(match_operand 2 "const_0_to_15_operand")
7257 (match_operand 3 "const_0_to_15_operand")
7258 (match_operand 4 "const_0_to_15_operand")
7259 (match_operand 5 "const_0_to_15_operand")]))
7260 (match_operand:<ssequartermode> 6 "memory_operand" "0")
7261 (match_operand:QI 7 "register_operand" "Yk")))]
7263 && INTVAL (operands[2]) % 4 == 0
7264 && INTVAL (operands[2]) == INTVAL (operands[3]) - 1
7265 && INTVAL (operands[3]) == INTVAL (operands[4]) - 1
7266 && INTVAL (operands[4]) == INTVAL (operands[5]) - 1
7267 && rtx_equal_p (operands[6], operands[0])"
7269 operands[2] = GEN_INT (INTVAL (operands[2]) >> 2);
7270 return "vextract<shuffletype>32x4\t{%2, %1, %0%{%7%}|%0%{%7%}, %1, %2}";
7272 [(set_attr "type" "sselog")
7273 (set_attr "prefix_extra" "1")
7274 (set_attr "length_immediate" "1")
7275 (set_attr "memory" "store")
7276 (set_attr "prefix" "evex")
7277 (set_attr "mode" "<sseinsnmode>")])
7279 (define_insn "<mask_codefor>avx512dq_vextract<shuffletype>64x2_1<mask_name>"
7280 [(set (match_operand:<ssequartermode> 0 "<store_mask_predicate>" "=<store_mask_constraint>")
7281 (vec_select:<ssequartermode>
7282 (match_operand:V8FI 1 "register_operand" "v")
7283 (parallel [(match_operand 2 "const_0_to_7_operand")
7284 (match_operand 3 "const_0_to_7_operand")])))]
7286 && INTVAL (operands[2]) % 2 == 0
7287 && INTVAL (operands[2]) == INTVAL (operands[3]) - 1"
7289 operands[2] = GEN_INT (INTVAL (operands[2]) >> 1);
7290 return "vextract<shuffletype>64x2\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}";
7292 [(set_attr "type" "sselog1")
7293 (set_attr "prefix_extra" "1")
7294 (set_attr "length_immediate" "1")
7295 (set_attr "prefix" "evex")
7296 (set_attr "mode" "<sseinsnmode>")])
7298 (define_insn "<mask_codefor>avx512f_vextract<shuffletype>32x4_1<mask_name>"
7299 [(set (match_operand:<ssequartermode> 0 "<store_mask_predicate>" "=<store_mask_constraint>")
7300 (vec_select:<ssequartermode>
7301 (match_operand:V16FI 1 "register_operand" "v")
7302 (parallel [(match_operand 2 "const_0_to_15_operand")
7303 (match_operand 3 "const_0_to_15_operand")
7304 (match_operand 4 "const_0_to_15_operand")
7305 (match_operand 5 "const_0_to_15_operand")])))]
7307 && INTVAL (operands[2]) % 4 == 0
7308 && INTVAL (operands[2]) == INTVAL (operands[3]) - 1
7309 && INTVAL (operands[3]) == INTVAL (operands[4]) - 1
7310 && INTVAL (operands[4]) == INTVAL (operands[5]) - 1"
7312 operands[2] = GEN_INT (INTVAL (operands[2]) >> 2);
7313 return "vextract<shuffletype>32x4\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
7315 [(set_attr "type" "sselog1")
7316 (set_attr "prefix_extra" "1")
7317 (set_attr "length_immediate" "1")
7318 (set_attr "prefix" "evex")
7319 (set_attr "mode" "<sseinsnmode>")])
7321 (define_mode_attr extract_type_2
7322 [(V16SF "avx512dq") (V16SI "avx512dq") (V8DF "avx512f") (V8DI "avx512f")])
7324 (define_mode_attr extract_suf_2
7325 [(V16SF "32x8") (V16SI "32x8") (V8DF "64x4") (V8DI "64x4")])
7327 (define_mode_iterator AVX512_VEC_2
7328 [(V16SF "TARGET_AVX512DQ") (V16SI "TARGET_AVX512DQ") V8DF V8DI])
7330 (define_expand "<extract_type_2>_vextract<shuffletype><extract_suf_2>_mask"
7331 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7332 (match_operand:AVX512_VEC_2 1 "register_operand")
7333 (match_operand:SI 2 "const_0_to_1_operand")
7334 (match_operand:<ssehalfvecmode> 3 "nonimmediate_operand")
7335 (match_operand:QI 4 "register_operand")]
7338 rtx (*insn)(rtx, rtx, rtx, rtx);
7339 rtx dest = operands[0];
7341 if (MEM_P (dest) && !rtx_equal_p (dest, operands[3]))
7342 dest = gen_reg_rtx (<ssehalfvecmode>mode);
7344 switch (INTVAL (operands[2]))
7347 insn = gen_vec_extract_lo_<mode>_mask;
7350 insn = gen_vec_extract_hi_<mode>_mask;
7356 emit_insn (insn (dest, operands[1], operands[3], operands[4]));
7357 if (dest != operands[0])
7358 emit_move_insn (operands[0], dest);
7363 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7364 (vec_select:<ssehalfvecmode>
7365 (match_operand:V8FI 1 "nonimmediate_operand")
7366 (parallel [(const_int 0) (const_int 1)
7367 (const_int 2) (const_int 3)])))]
7368 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))
7371 || (REG_P (operands[0]) && !EXT_REX_SSE_REG_P (operands[1])))"
7372 [(set (match_dup 0) (match_dup 1))]
7373 "operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);")
7375 (define_insn "vec_extract_lo_<mode>_maskm"
7376 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7377 (vec_merge:<ssehalfvecmode>
7378 (vec_select:<ssehalfvecmode>
7379 (match_operand:V8FI 1 "register_operand" "v")
7380 (parallel [(const_int 0) (const_int 1)
7381 (const_int 2) (const_int 3)]))
7382 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7383 (match_operand:QI 3 "register_operand" "Yk")))]
7385 && rtx_equal_p (operands[2], operands[0])"
7386 "vextract<shuffletype>64x4\t{$0x0, %1, %0%{%3%}|%0%{%3%}, %1, 0x0}"
7387 [(set_attr "type" "sselog1")
7388 (set_attr "prefix_extra" "1")
7389 (set_attr "length_immediate" "1")
7390 (set_attr "prefix" "evex")
7391 (set_attr "mode" "<sseinsnmode>")])
7393 (define_insn "vec_extract_lo_<mode><mask_name>"
7394 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=<store_mask_constraint>,v")
7395 (vec_select:<ssehalfvecmode>
7396 (match_operand:V8FI 1 "<store_mask_predicate>" "v,<store_mask_constraint>")
7397 (parallel [(const_int 0) (const_int 1)
7398 (const_int 2) (const_int 3)])))]
7400 && (<mask_applied> || !(MEM_P (operands[0]) && MEM_P (operands[1])))"
7402 if (<mask_applied> || (!TARGET_AVX512VL && !MEM_P (operands[1])))
7403 return "vextract<shuffletype>64x4\t{$0x0, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x0}";
7407 [(set_attr "type" "sselog1")
7408 (set_attr "prefix_extra" "1")
7409 (set_attr "length_immediate" "1")
7410 (set_attr "prefix" "evex")
7411 (set_attr "mode" "<sseinsnmode>")])
7413 (define_insn "vec_extract_hi_<mode>_maskm"
7414 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7415 (vec_merge:<ssehalfvecmode>
7416 (vec_select:<ssehalfvecmode>
7417 (match_operand:V8FI 1 "register_operand" "v")
7418 (parallel [(const_int 4) (const_int 5)
7419 (const_int 6) (const_int 7)]))
7420 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7421 (match_operand:QI 3 "register_operand" "Yk")))]
7423 && rtx_equal_p (operands[2], operands[0])"
7424 "vextract<shuffletype>64x4\t{$0x1, %1, %0%{%3%}|%0%{%3%}, %1, 0x1}"
7425 [(set_attr "type" "sselog")
7426 (set_attr "prefix_extra" "1")
7427 (set_attr "length_immediate" "1")
7428 (set_attr "memory" "store")
7429 (set_attr "prefix" "evex")
7430 (set_attr "mode" "<sseinsnmode>")])
7432 (define_insn "vec_extract_hi_<mode><mask_name>"
7433 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=<store_mask_constraint>")
7434 (vec_select:<ssehalfvecmode>
7435 (match_operand:V8FI 1 "register_operand" "v")
7436 (parallel [(const_int 4) (const_int 5)
7437 (const_int 6) (const_int 7)])))]
7439 "vextract<shuffletype>64x4\t{$0x1, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x1}"
7440 [(set_attr "type" "sselog1")
7441 (set_attr "prefix_extra" "1")
7442 (set_attr "length_immediate" "1")
7443 (set_attr "prefix" "evex")
7444 (set_attr "mode" "<sseinsnmode>")])
7446 (define_insn "vec_extract_hi_<mode>_maskm"
7447 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7448 (vec_merge:<ssehalfvecmode>
7449 (vec_select:<ssehalfvecmode>
7450 (match_operand:V16FI 1 "register_operand" "v")
7451 (parallel [(const_int 8) (const_int 9)
7452 (const_int 10) (const_int 11)
7453 (const_int 12) (const_int 13)
7454 (const_int 14) (const_int 15)]))
7455 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7456 (match_operand:QI 3 "register_operand" "Yk")))]
7458 && rtx_equal_p (operands[2], operands[0])"
7459 "vextract<shuffletype>32x8\t{$0x1, %1, %0%{%3%}|%0%{%3%}, %1, 0x1}"
7460 [(set_attr "type" "sselog1")
7461 (set_attr "prefix_extra" "1")
7462 (set_attr "length_immediate" "1")
7463 (set_attr "prefix" "evex")
7464 (set_attr "mode" "<sseinsnmode>")])
7466 (define_insn "vec_extract_hi_<mode><mask_name>"
7467 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=<store_mask_constraint>,vm")
7468 (vec_select:<ssehalfvecmode>
7469 (match_operand:V16FI 1 "register_operand" "v,v")
7470 (parallel [(const_int 8) (const_int 9)
7471 (const_int 10) (const_int 11)
7472 (const_int 12) (const_int 13)
7473 (const_int 14) (const_int 15)])))]
7474 "TARGET_AVX512F && <mask_avx512dq_condition>"
7476 vextract<shuffletype>32x8\t{$0x1, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x1}
7477 vextracti64x4\t{$0x1, %1, %0|%0, %1, 0x1}"
7478 [(set_attr "type" "sselog1")
7479 (set_attr "prefix_extra" "1")
7480 (set_attr "isa" "avx512dq,noavx512dq")
7481 (set_attr "length_immediate" "1")
7482 (set_attr "prefix" "evex")
7483 (set_attr "mode" "<sseinsnmode>")])
7485 (define_expand "avx512vl_vextractf128<mode>"
7486 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7487 (match_operand:VI48F_256 1 "register_operand")
7488 (match_operand:SI 2 "const_0_to_1_operand")
7489 (match_operand:<ssehalfvecmode> 3 "vector_move_operand")
7490 (match_operand:QI 4 "register_operand")]
7491 "TARGET_AVX512DQ && TARGET_AVX512VL"
7493 rtx (*insn)(rtx, rtx, rtx, rtx);
7494 rtx dest = operands[0];
7497 && (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 4
7498 /* For V8S[IF]mode there are maskm insns with =m and 0
7500 ? !rtx_equal_p (dest, operands[3])
7501 /* For V4D[IF]mode, hi insns don't allow memory, and
7502 lo insns have =m and 0C constraints. */
7503 : (operands[2] != const0_rtx
7504 || (!rtx_equal_p (dest, operands[3])
7505 && GET_CODE (operands[3]) != CONST_VECTOR))))
7506 dest = gen_reg_rtx (<ssehalfvecmode>mode);
7507 switch (INTVAL (operands[2]))
7510 insn = gen_vec_extract_lo_<mode>_mask;
7513 insn = gen_vec_extract_hi_<mode>_mask;
7519 emit_insn (insn (dest, operands[1], operands[3], operands[4]));
7520 if (dest != operands[0])
7521 emit_move_insn (operands[0], dest);
7525 (define_expand "avx_vextractf128<mode>"
7526 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7527 (match_operand:V_256 1 "register_operand")
7528 (match_operand:SI 2 "const_0_to_1_operand")]
7531 rtx (*insn)(rtx, rtx);
7533 switch (INTVAL (operands[2]))
7536 insn = gen_vec_extract_lo_<mode>;
7539 insn = gen_vec_extract_hi_<mode>;
7545 emit_insn (insn (operands[0], operands[1]));
7549 (define_insn "vec_extract_lo_<mode><mask_name>"
7550 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand" "=v,m")
7551 (vec_select:<ssehalfvecmode>
7552 (match_operand:V16FI 1 "<store_mask_predicate>"
7553 "<store_mask_constraint>,v")
7554 (parallel [(const_int 0) (const_int 1)
7555 (const_int 2) (const_int 3)
7556 (const_int 4) (const_int 5)
7557 (const_int 6) (const_int 7)])))]
7559 && <mask_mode512bit_condition>
7560 && (<mask_applied> || !(MEM_P (operands[0]) && MEM_P (operands[1])))"
7563 return "vextract<shuffletype>32x8\t{$0x0, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x0}";
7569 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7570 (vec_select:<ssehalfvecmode>
7571 (match_operand:V16FI 1 "nonimmediate_operand")
7572 (parallel [(const_int 0) (const_int 1)
7573 (const_int 2) (const_int 3)
7574 (const_int 4) (const_int 5)
7575 (const_int 6) (const_int 7)])))]
7576 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))
7577 && reload_completed"
7578 [(set (match_dup 0) (match_dup 1))]
7579 "operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);")
7581 (define_insn "vec_extract_lo_<mode><mask_name>"
7582 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=v,m")
7583 (vec_select:<ssehalfvecmode>
7584 (match_operand:VI8F_256 1 "<store_mask_predicate>"
7585 "<store_mask_constraint>,v")
7586 (parallel [(const_int 0) (const_int 1)])))]
7588 && <mask_avx512vl_condition> && <mask_avx512dq_condition>
7589 && (<mask_applied> || !(MEM_P (operands[0]) && MEM_P (operands[1])))"
7592 return "vextract<shuffletype>64x2\t{$0x0, %1, %0%{%3%}|%0%{%3%}, %1, 0x0}";
7596 [(set_attr "type" "sselog")
7597 (set_attr "prefix_extra" "1")
7598 (set_attr "length_immediate" "1")
7599 (set_attr "memory" "none,store")
7600 (set_attr "prefix" "evex")
7601 (set_attr "mode" "XI")])
7604 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7605 (vec_select:<ssehalfvecmode>
7606 (match_operand:VI8F_256 1 "nonimmediate_operand")
7607 (parallel [(const_int 0) (const_int 1)])))]
7608 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))
7609 && reload_completed"
7610 [(set (match_dup 0) (match_dup 1))]
7611 "operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);")
7613 (define_insn "vec_extract_hi_<mode><mask_name>"
7614 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=v,<store_mask_constraint>")
7615 (vec_select:<ssehalfvecmode>
7616 (match_operand:VI8F_256 1 "register_operand" "v,v")
7617 (parallel [(const_int 2) (const_int 3)])))]
7618 "TARGET_AVX && <mask_avx512vl_condition> && <mask_avx512dq_condition>"
7620 if (TARGET_AVX512VL)
7622 if (TARGET_AVX512DQ)
7623 return "vextract<shuffletype>64x2\t{$0x1, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x1}";
7625 return "vextract<shuffletype>32x4\t{$0x1, %1, %0|%0, %1, 0x1}";
7628 return "vextract<i128>\t{$0x1, %1, %0|%0, %1, 0x1}";
7630 [(set_attr "type" "sselog")
7631 (set_attr "prefix_extra" "1")
7632 (set_attr "length_immediate" "1")
7633 (set_attr "memory" "none,store")
7634 (set_attr "prefix" "vex")
7635 (set_attr "mode" "<sseinsnmode>")])
7638 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7639 (vec_select:<ssehalfvecmode>
7640 (match_operand:VI4F_256 1 "nonimmediate_operand")
7641 (parallel [(const_int 0) (const_int 1)
7642 (const_int 2) (const_int 3)])))]
7643 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))
7644 && reload_completed"
7645 [(set (match_dup 0) (match_dup 1))]
7646 "operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);")
7648 (define_insn "vec_extract_lo_<mode><mask_name>"
7649 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>"
7650 "=<store_mask_constraint>,v")
7651 (vec_select:<ssehalfvecmode>
7652 (match_operand:VI4F_256 1 "<store_mask_predicate>"
7653 "v,<store_mask_constraint>")
7654 (parallel [(const_int 0) (const_int 1)
7655 (const_int 2) (const_int 3)])))]
7657 && <mask_avx512vl_condition> && <mask_avx512dq_condition>
7658 && (<mask_applied> || !(MEM_P (operands[0]) && MEM_P (operands[1])))"
7661 return "vextract<shuffletype>32x4\t{$0x0, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x0}";
7665 [(set_attr "type" "sselog1")
7666 (set_attr "prefix_extra" "1")
7667 (set_attr "length_immediate" "1")
7668 (set_attr "prefix" "evex")
7669 (set_attr "mode" "<sseinsnmode>")])
7671 (define_insn "vec_extract_lo_<mode>_maskm"
7672 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7673 (vec_merge:<ssehalfvecmode>
7674 (vec_select:<ssehalfvecmode>
7675 (match_operand:VI4F_256 1 "register_operand" "v")
7676 (parallel [(const_int 0) (const_int 1)
7677 (const_int 2) (const_int 3)]))
7678 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7679 (match_operand:QI 3 "register_operand" "Yk")))]
7680 "TARGET_AVX512VL && TARGET_AVX512F
7681 && rtx_equal_p (operands[2], operands[0])"
7682 "vextract<shuffletype>32x4\t{$0x0, %1, %0%{%3%}|%0%{%3%}, %1, 0x0}"
7683 [(set_attr "type" "sselog1")
7684 (set_attr "prefix_extra" "1")
7685 (set_attr "length_immediate" "1")
7686 (set_attr "prefix" "evex")
7687 (set_attr "mode" "<sseinsnmode>")])
7689 (define_insn "vec_extract_hi_<mode>_maskm"
7690 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7691 (vec_merge:<ssehalfvecmode>
7692 (vec_select:<ssehalfvecmode>
7693 (match_operand:VI4F_256 1 "register_operand" "v")
7694 (parallel [(const_int 4) (const_int 5)
7695 (const_int 6) (const_int 7)]))
7696 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7697 (match_operand:<ssehalfvecmode> 3 "register_operand" "Yk")))]
7698 "TARGET_AVX512F && TARGET_AVX512VL
7699 && rtx_equal_p (operands[2], operands[0])"
7700 "vextract<shuffletype>32x4\t{$0x1, %1, %0%{%3%}|%0%{%3%}, %1, 0x1}"
7701 [(set_attr "type" "sselog1")
7702 (set_attr "length_immediate" "1")
7703 (set_attr "prefix" "evex")
7704 (set_attr "mode" "<sseinsnmode>")])
7706 (define_insn "vec_extract_hi_<mode>_mask"
7707 [(set (match_operand:<ssehalfvecmode> 0 "register_operand" "=v")
7708 (vec_merge:<ssehalfvecmode>
7709 (vec_select:<ssehalfvecmode>
7710 (match_operand:VI4F_256 1 "register_operand" "v")
7711 (parallel [(const_int 4) (const_int 5)
7712 (const_int 6) (const_int 7)]))
7713 (match_operand:<ssehalfvecmode> 2 "vector_move_operand" "0C")
7714 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
7716 "vextract<shuffletype>32x4\t{$0x1, %1, %0%{%3%}%N2|%0%{%3%}%N2, %1, 0x1}"
7717 [(set_attr "type" "sselog1")
7718 (set_attr "length_immediate" "1")
7719 (set_attr "prefix" "evex")
7720 (set_attr "mode" "<sseinsnmode>")])
7722 (define_insn "vec_extract_hi_<mode>"
7723 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand" "=xm, vm")
7724 (vec_select:<ssehalfvecmode>
7725 (match_operand:VI4F_256 1 "register_operand" "x, v")
7726 (parallel [(const_int 4) (const_int 5)
7727 (const_int 6) (const_int 7)])))]
7730 vextract<i128>\t{$0x1, %1, %0|%0, %1, 0x1}
7731 vextract<shuffletype>32x4\t{$0x1, %1, %0|%0, %1, 0x1}"
7732 [(set_attr "isa" "*, avx512vl")
7733 (set_attr "prefix" "vex, evex")
7734 (set_attr "type" "sselog1")
7735 (set_attr "length_immediate" "1")
7736 (set_attr "mode" "<sseinsnmode>")])
7738 (define_insn_and_split "vec_extract_lo_v32hi"
7739 [(set (match_operand:V16HI 0 "nonimmediate_operand" "=v,m")
7741 (match_operand:V32HI 1 "nonimmediate_operand" "vm,v")
7742 (parallel [(const_int 0) (const_int 1)
7743 (const_int 2) (const_int 3)
7744 (const_int 4) (const_int 5)
7745 (const_int 6) (const_int 7)
7746 (const_int 8) (const_int 9)
7747 (const_int 10) (const_int 11)
7748 (const_int 12) (const_int 13)
7749 (const_int 14) (const_int 15)])))]
7750 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7752 "&& reload_completed"
7753 [(set (match_dup 0) (match_dup 1))]
7754 "operands[1] = gen_lowpart (V16HImode, operands[1]);")
7756 (define_insn "vec_extract_hi_v32hi"
7757 [(set (match_operand:V16HI 0 "nonimmediate_operand" "=v,m")
7759 (match_operand:V32HI 1 "register_operand" "v,v")
7760 (parallel [(const_int 16) (const_int 17)
7761 (const_int 18) (const_int 19)
7762 (const_int 20) (const_int 21)
7763 (const_int 22) (const_int 23)
7764 (const_int 24) (const_int 25)
7765 (const_int 26) (const_int 27)
7766 (const_int 28) (const_int 29)
7767 (const_int 30) (const_int 31)])))]
7769 "vextracti64x4\t{$0x1, %1, %0|%0, %1, 0x1}"
7770 [(set_attr "type" "sselog")
7771 (set_attr "prefix_extra" "1")
7772 (set_attr "length_immediate" "1")
7773 (set_attr "memory" "none,store")
7774 (set_attr "prefix" "evex")
7775 (set_attr "mode" "XI")])
7777 (define_insn_and_split "vec_extract_lo_v16hi"
7778 [(set (match_operand:V8HI 0 "nonimmediate_operand" "=v,m")
7780 (match_operand:V16HI 1 "nonimmediate_operand" "vm,v")
7781 (parallel [(const_int 0) (const_int 1)
7782 (const_int 2) (const_int 3)
7783 (const_int 4) (const_int 5)
7784 (const_int 6) (const_int 7)])))]
7785 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7787 "&& reload_completed"
7788 [(set (match_dup 0) (match_dup 1))]
7789 "operands[1] = gen_lowpart (V8HImode, operands[1]);")
7791 (define_insn "vec_extract_hi_v16hi"
7792 [(set (match_operand:V8HI 0 "nonimmediate_operand" "=x,m,v,m,v,m")
7794 (match_operand:V16HI 1 "register_operand" "x,x,v,v,v,v")
7795 (parallel [(const_int 8) (const_int 9)
7796 (const_int 10) (const_int 11)
7797 (const_int 12) (const_int 13)
7798 (const_int 14) (const_int 15)])))]
7801 vextract%~128\t{$0x1, %1, %0|%0, %1, 0x1}
7802 vextract%~128\t{$0x1, %1, %0|%0, %1, 0x1}
7803 vextracti32x4\t{$0x1, %1, %0|%0, %1, 0x1}
7804 vextracti32x4\t{$0x1, %1, %0|%0, %1, 0x1}
7805 vextracti32x4\t{$0x1, %g1, %0|%0, %g1, 0x1}
7806 vextracti32x4\t{$0x1, %g1, %0|%0, %g1, 0x1}"
7807 [(set_attr "type" "sselog")
7808 (set_attr "prefix_extra" "1")
7809 (set_attr "length_immediate" "1")
7810 (set_attr "isa" "*,*,avx512dq,avx512dq,avx512f,avx512f")
7811 (set_attr "memory" "none,store,none,store,none,store")
7812 (set_attr "prefix" "vex,vex,evex,evex,evex,evex")
7813 (set_attr "mode" "OI")])
7815 (define_insn_and_split "vec_extract_lo_v64qi"
7816 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=v,m")
7818 (match_operand:V64QI 1 "nonimmediate_operand" "vm,v")
7819 (parallel [(const_int 0) (const_int 1)
7820 (const_int 2) (const_int 3)
7821 (const_int 4) (const_int 5)
7822 (const_int 6) (const_int 7)
7823 (const_int 8) (const_int 9)
7824 (const_int 10) (const_int 11)
7825 (const_int 12) (const_int 13)
7826 (const_int 14) (const_int 15)
7827 (const_int 16) (const_int 17)
7828 (const_int 18) (const_int 19)
7829 (const_int 20) (const_int 21)
7830 (const_int 22) (const_int 23)
7831 (const_int 24) (const_int 25)
7832 (const_int 26) (const_int 27)
7833 (const_int 28) (const_int 29)
7834 (const_int 30) (const_int 31)])))]
7835 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7837 "&& reload_completed"
7838 [(set (match_dup 0) (match_dup 1))]
7839 "operands[1] = gen_lowpart (V32QImode, operands[1]);")
7841 (define_insn "vec_extract_hi_v64qi"
7842 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=v,m")
7844 (match_operand:V64QI 1 "register_operand" "v,v")
7845 (parallel [(const_int 32) (const_int 33)
7846 (const_int 34) (const_int 35)
7847 (const_int 36) (const_int 37)
7848 (const_int 38) (const_int 39)
7849 (const_int 40) (const_int 41)
7850 (const_int 42) (const_int 43)
7851 (const_int 44) (const_int 45)
7852 (const_int 46) (const_int 47)
7853 (const_int 48) (const_int 49)
7854 (const_int 50) (const_int 51)
7855 (const_int 52) (const_int 53)
7856 (const_int 54) (const_int 55)
7857 (const_int 56) (const_int 57)
7858 (const_int 58) (const_int 59)
7859 (const_int 60) (const_int 61)
7860 (const_int 62) (const_int 63)])))]
7862 "vextracti64x4\t{$0x1, %1, %0|%0, %1, 0x1}"
7863 [(set_attr "type" "sselog")
7864 (set_attr "prefix_extra" "1")
7865 (set_attr "length_immediate" "1")
7866 (set_attr "memory" "none,store")
7867 (set_attr "prefix" "evex")
7868 (set_attr "mode" "XI")])
7870 (define_insn_and_split "vec_extract_lo_v32qi"
7871 [(set (match_operand:V16QI 0 "nonimmediate_operand" "=v,m")
7873 (match_operand:V32QI 1 "nonimmediate_operand" "vm,v")
7874 (parallel [(const_int 0) (const_int 1)
7875 (const_int 2) (const_int 3)
7876 (const_int 4) (const_int 5)
7877 (const_int 6) (const_int 7)
7878 (const_int 8) (const_int 9)
7879 (const_int 10) (const_int 11)
7880 (const_int 12) (const_int 13)
7881 (const_int 14) (const_int 15)])))]
7882 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7884 "&& reload_completed"
7885 [(set (match_dup 0) (match_dup 1))]
7886 "operands[1] = gen_lowpart (V16QImode, operands[1]);")
7888 (define_insn "vec_extract_hi_v32qi"
7889 [(set (match_operand:V16QI 0 "nonimmediate_operand" "=x,m,v,m,v,m")
7891 (match_operand:V32QI 1 "register_operand" "x,x,v,v,v,v")
7892 (parallel [(const_int 16) (const_int 17)
7893 (const_int 18) (const_int 19)
7894 (const_int 20) (const_int 21)
7895 (const_int 22) (const_int 23)
7896 (const_int 24) (const_int 25)
7897 (const_int 26) (const_int 27)
7898 (const_int 28) (const_int 29)
7899 (const_int 30) (const_int 31)])))]
7902 vextract%~128\t{$0x1, %1, %0|%0, %1, 0x1}
7903 vextract%~128\t{$0x1, %1, %0|%0, %1, 0x1}
7904 vextracti32x4\t{$0x1, %1, %0|%0, %1, 0x1}
7905 vextracti32x4\t{$0x1, %1, %0|%0, %1, 0x1}
7906 vextracti32x4\t{$0x1, %g1, %0|%0, %g1, 0x1}
7907 vextracti32x4\t{$0x1, %g1, %0|%0, %g1, 0x1}"
7908 [(set_attr "type" "sselog")
7909 (set_attr "prefix_extra" "1")
7910 (set_attr "length_immediate" "1")
7911 (set_attr "isa" "*,*,avx512dq,avx512dq,avx512f,avx512f")
7912 (set_attr "memory" "none,store,none,store,none,store")
7913 (set_attr "prefix" "vex,vex,evex,evex,evex,evex")
7914 (set_attr "mode" "OI")])
7916 ;; Modes handled by vec_extract patterns.
7917 (define_mode_iterator VEC_EXTRACT_MODE
7918 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX") V16QI
7919 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX") V8HI
7920 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
7921 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI
7922 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
7923 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") V2DF
7924 (V4TI "TARGET_AVX512F") (V2TI "TARGET_AVX")])
7926 (define_expand "vec_extract<mode><ssescalarmodelower>"
7927 [(match_operand:<ssescalarmode> 0 "register_operand")
7928 (match_operand:VEC_EXTRACT_MODE 1 "register_operand")
7929 (match_operand 2 "const_int_operand")]
7932 ix86_expand_vector_extract (false, operands[0], operands[1],
7933 INTVAL (operands[2]));
7937 (define_expand "vec_extract<mode><ssehalfvecmodelower>"
7938 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7939 (match_operand:V_512 1 "register_operand")
7940 (match_operand 2 "const_0_to_1_operand")]
7943 if (INTVAL (operands[2]))
7944 emit_insn (gen_vec_extract_hi_<mode> (operands[0], operands[1]));
7946 emit_insn (gen_vec_extract_lo_<mode> (operands[0], operands[1]));
7950 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7952 ;; Parallel double-precision floating point element swizzling
7954 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7956 (define_insn "<mask_codefor>avx512f_unpckhpd512<mask_name>"
7957 [(set (match_operand:V8DF 0 "register_operand" "=v")
7960 (match_operand:V8DF 1 "register_operand" "v")
7961 (match_operand:V8DF 2 "nonimmediate_operand" "vm"))
7962 (parallel [(const_int 1) (const_int 9)
7963 (const_int 3) (const_int 11)
7964 (const_int 5) (const_int 13)
7965 (const_int 7) (const_int 15)])))]
7967 "vunpckhpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
7968 [(set_attr "type" "sselog")
7969 (set_attr "prefix" "evex")
7970 (set_attr "mode" "V8DF")])
7972 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
7973 (define_insn "avx_unpckhpd256<mask_name>"
7974 [(set (match_operand:V4DF 0 "register_operand" "=v")
7977 (match_operand:V4DF 1 "register_operand" "v")
7978 (match_operand:V4DF 2 "nonimmediate_operand" "vm"))
7979 (parallel [(const_int 1) (const_int 5)
7980 (const_int 3) (const_int 7)])))]
7981 "TARGET_AVX && <mask_avx512vl_condition>"
7982 "vunpckhpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
7983 [(set_attr "type" "sselog")
7984 (set_attr "prefix" "vex")
7985 (set_attr "mode" "V4DF")])
7987 (define_expand "vec_interleave_highv4df"
7991 (match_operand:V4DF 1 "register_operand")
7992 (match_operand:V4DF 2 "nonimmediate_operand"))
7993 (parallel [(const_int 0) (const_int 4)
7994 (const_int 2) (const_int 6)])))
8000 (parallel [(const_int 1) (const_int 5)
8001 (const_int 3) (const_int 7)])))
8002 (set (match_operand:V4DF 0 "register_operand")
8007 (parallel [(const_int 2) (const_int 3)
8008 (const_int 6) (const_int 7)])))]
8011 operands[3] = gen_reg_rtx (V4DFmode);
8012 operands[4] = gen_reg_rtx (V4DFmode);
8016 (define_insn "avx512vl_unpckhpd128_mask"
8017 [(set (match_operand:V2DF 0 "register_operand" "=v")
8021 (match_operand:V2DF 1 "register_operand" "v")
8022 (match_operand:V2DF 2 "nonimmediate_operand" "vm"))
8023 (parallel [(const_int 1) (const_int 3)]))
8024 (match_operand:V2DF 3 "vector_move_operand" "0C")
8025 (match_operand:QI 4 "register_operand" "Yk")))]
8027 "vunpckhpd\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
8028 [(set_attr "type" "sselog")
8029 (set_attr "prefix" "evex")
8030 (set_attr "mode" "V2DF")])
8032 (define_expand "vec_interleave_highv2df"
8033 [(set (match_operand:V2DF 0 "register_operand")
8036 (match_operand:V2DF 1 "nonimmediate_operand")
8037 (match_operand:V2DF 2 "nonimmediate_operand"))
8038 (parallel [(const_int 1)
8042 if (!ix86_vec_interleave_v2df_operator_ok (operands, 1))
8043 operands[2] = force_reg (V2DFmode, operands[2]);
8046 (define_insn "*vec_interleave_highv2df"
8047 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,v,v,x,v,m")
8050 (match_operand:V2DF 1 "nonimmediate_operand" " 0,v,o,o,o,v")
8051 (match_operand:V2DF 2 "nonimmediate_operand" " x,v,1,0,v,0"))
8052 (parallel [(const_int 1)
8054 "TARGET_SSE2 && ix86_vec_interleave_v2df_operator_ok (operands, 1)"
8056 unpckhpd\t{%2, %0|%0, %2}
8057 vunpckhpd\t{%2, %1, %0|%0, %1, %2}
8058 %vmovddup\t{%H1, %0|%0, %H1}
8059 movlpd\t{%H1, %0|%0, %H1}
8060 vmovlpd\t{%H1, %2, %0|%0, %2, %H1}
8061 %vmovhpd\t{%1, %0|%q0, %1}"
8062 [(set_attr "isa" "noavx,avx,sse3,noavx,avx,*")
8063 (set_attr "type" "sselog,sselog,sselog,ssemov,ssemov,ssemov")
8064 (set (attr "prefix_data16")
8065 (if_then_else (eq_attr "alternative" "3,5")
8067 (const_string "*")))
8068 (set_attr "prefix" "orig,maybe_evex,maybe_vex,orig,maybe_evex,maybe_vex")
8069 (set_attr "mode" "V2DF,V2DF,DF,V1DF,V1DF,V1DF")])
8071 (define_expand "avx512f_movddup512<mask_name>"
8072 [(set (match_operand:V8DF 0 "register_operand")
8075 (match_operand:V8DF 1 "nonimmediate_operand")
8077 (parallel [(const_int 0) (const_int 8)
8078 (const_int 2) (const_int 10)
8079 (const_int 4) (const_int 12)
8080 (const_int 6) (const_int 14)])))]
8083 (define_expand "avx512f_unpcklpd512<mask_name>"
8084 [(set (match_operand:V8DF 0 "register_operand")
8087 (match_operand:V8DF 1 "register_operand")
8088 (match_operand:V8DF 2 "nonimmediate_operand"))
8089 (parallel [(const_int 0) (const_int 8)
8090 (const_int 2) (const_int 10)
8091 (const_int 4) (const_int 12)
8092 (const_int 6) (const_int 14)])))]
8095 (define_insn "*avx512f_unpcklpd512<mask_name>"
8096 [(set (match_operand:V8DF 0 "register_operand" "=v,v")
8099 (match_operand:V8DF 1 "nonimmediate_operand" "vm, v")
8100 (match_operand:V8DF 2 "nonimmediate_operand" "1 ,vm"))
8101 (parallel [(const_int 0) (const_int 8)
8102 (const_int 2) (const_int 10)
8103 (const_int 4) (const_int 12)
8104 (const_int 6) (const_int 14)])))]
8107 vmovddup\t{%1, %0<mask_operand3>|%0<mask_operand3>, %1}
8108 vunpcklpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8109 [(set_attr "type" "sselog")
8110 (set_attr "prefix" "evex")
8111 (set_attr "mode" "V8DF")])
8113 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
8114 (define_expand "avx_movddup256<mask_name>"
8115 [(set (match_operand:V4DF 0 "register_operand")
8118 (match_operand:V4DF 1 "nonimmediate_operand")
8120 (parallel [(const_int 0) (const_int 4)
8121 (const_int 2) (const_int 6)])))]
8122 "TARGET_AVX && <mask_avx512vl_condition>")
8124 (define_expand "avx_unpcklpd256<mask_name>"
8125 [(set (match_operand:V4DF 0 "register_operand")
8128 (match_operand:V4DF 1 "register_operand")
8129 (match_operand:V4DF 2 "nonimmediate_operand"))
8130 (parallel [(const_int 0) (const_int 4)
8131 (const_int 2) (const_int 6)])))]
8132 "TARGET_AVX && <mask_avx512vl_condition>")
8134 (define_insn "*avx_unpcklpd256<mask_name>"
8135 [(set (match_operand:V4DF 0 "register_operand" "=v,v")
8138 (match_operand:V4DF 1 "nonimmediate_operand" " v,m")
8139 (match_operand:V4DF 2 "nonimmediate_operand" "vm,1"))
8140 (parallel [(const_int 0) (const_int 4)
8141 (const_int 2) (const_int 6)])))]
8142 "TARGET_AVX && <mask_avx512vl_condition>"
8144 vunpcklpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
8145 vmovddup\t{%1, %0<mask_operand3>|%0<mask_operand3>, %1}"
8146 [(set_attr "type" "sselog")
8147 (set_attr "prefix" "vex")
8148 (set_attr "mode" "V4DF")])
8150 (define_expand "vec_interleave_lowv4df"
8154 (match_operand:V4DF 1 "register_operand")
8155 (match_operand:V4DF 2 "nonimmediate_operand"))
8156 (parallel [(const_int 0) (const_int 4)
8157 (const_int 2) (const_int 6)])))
8163 (parallel [(const_int 1) (const_int 5)
8164 (const_int 3) (const_int 7)])))
8165 (set (match_operand:V4DF 0 "register_operand")
8170 (parallel [(const_int 0) (const_int 1)
8171 (const_int 4) (const_int 5)])))]
8174 operands[3] = gen_reg_rtx (V4DFmode);
8175 operands[4] = gen_reg_rtx (V4DFmode);
8178 (define_insn "avx512vl_unpcklpd128_mask"
8179 [(set (match_operand:V2DF 0 "register_operand" "=v")
8183 (match_operand:V2DF 1 "register_operand" "v")
8184 (match_operand:V2DF 2 "nonimmediate_operand" "vm"))
8185 (parallel [(const_int 0) (const_int 2)]))
8186 (match_operand:V2DF 3 "vector_move_operand" "0C")
8187 (match_operand:QI 4 "register_operand" "Yk")))]
8189 "vunpcklpd\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
8190 [(set_attr "type" "sselog")
8191 (set_attr "prefix" "evex")
8192 (set_attr "mode" "V2DF")])
8194 (define_expand "vec_interleave_lowv2df"
8195 [(set (match_operand:V2DF 0 "register_operand")
8198 (match_operand:V2DF 1 "nonimmediate_operand")
8199 (match_operand:V2DF 2 "nonimmediate_operand"))
8200 (parallel [(const_int 0)
8204 if (!ix86_vec_interleave_v2df_operator_ok (operands, 0))
8205 operands[1] = force_reg (V2DFmode, operands[1]);
8208 (define_insn "*vec_interleave_lowv2df"
8209 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,v,v,x,v,o")
8212 (match_operand:V2DF 1 "nonimmediate_operand" " 0,v,m,0,v,0")
8213 (match_operand:V2DF 2 "nonimmediate_operand" " x,v,1,m,m,v"))
8214 (parallel [(const_int 0)
8216 "TARGET_SSE2 && ix86_vec_interleave_v2df_operator_ok (operands, 0)"
8218 unpcklpd\t{%2, %0|%0, %2}
8219 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
8220 %vmovddup\t{%1, %0|%0, %q1}
8221 movhpd\t{%2, %0|%0, %q2}
8222 vmovhpd\t{%2, %1, %0|%0, %1, %q2}
8223 %vmovlpd\t{%2, %H0|%H0, %2}"
8224 [(set_attr "isa" "noavx,avx,sse3,noavx,avx,*")
8225 (set_attr "type" "sselog,sselog,sselog,ssemov,ssemov,ssemov")
8226 (set (attr "prefix_data16")
8227 (if_then_else (eq_attr "alternative" "3,5")
8229 (const_string "*")))
8230 (set_attr "prefix" "orig,maybe_evex,maybe_vex,orig,maybe_evex,maybe_vex")
8231 (set_attr "mode" "V2DF,V2DF,DF,V1DF,V1DF,V1DF")])
8234 [(set (match_operand:V2DF 0 "memory_operand")
8237 (match_operand:V2DF 1 "register_operand")
8239 (parallel [(const_int 0)
8241 "TARGET_SSE3 && reload_completed"
8244 rtx low = gen_lowpart (DFmode, operands[1]);
8246 emit_move_insn (adjust_address (operands[0], DFmode, 0), low);
8247 emit_move_insn (adjust_address (operands[0], DFmode, 8), low);
8252 [(set (match_operand:V2DF 0 "register_operand")
8255 (match_operand:V2DF 1 "memory_operand")
8257 (parallel [(match_operand:SI 2 "const_0_to_1_operand")
8258 (match_operand:SI 3 "const_int_operand")])))]
8259 "TARGET_SSE3 && INTVAL (operands[2]) + 2 == INTVAL (operands[3])"
8260 [(set (match_dup 0) (vec_duplicate:V2DF (match_dup 1)))]
8262 operands[1] = adjust_address (operands[1], DFmode, INTVAL (operands[2]) * 8);
8265 (define_insn "avx512f_vmscalef<mode><round_name>"
8266 [(set (match_operand:VF_128 0 "register_operand" "=v")
8269 [(match_operand:VF_128 1 "register_operand" "v")
8270 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>")]
8275 "vscalef<ssescalarmodesuffix>\t{<round_op3>%2, %1, %0|%0, %1, %2<round_op3>}"
8276 [(set_attr "prefix" "evex")
8277 (set_attr "mode" "<ssescalarmode>")])
8279 (define_insn "<avx512>_scalef<mode><mask_name><round_name>"
8280 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8282 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
8283 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")]
8286 "vscalef<ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
8287 [(set_attr "prefix" "evex")
8288 (set_attr "mode" "<MODE>")])
8290 (define_expand "<avx512>_vternlog<mode>_maskz"
8291 [(match_operand:VI48_AVX512VL 0 "register_operand")
8292 (match_operand:VI48_AVX512VL 1 "register_operand")
8293 (match_operand:VI48_AVX512VL 2 "register_operand")
8294 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand")
8295 (match_operand:SI 4 "const_0_to_255_operand")
8296 (match_operand:<avx512fmaskmode> 5 "register_operand")]
8299 emit_insn (gen_<avx512>_vternlog<mode>_maskz_1 (
8300 operands[0], operands[1], operands[2], operands[3],
8301 operands[4], CONST0_RTX (<MODE>mode), operands[5]));
8305 (define_insn "<avx512>_vternlog<mode><sd_maskz_name>"
8306 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
8307 (unspec:VI48_AVX512VL
8308 [(match_operand:VI48_AVX512VL 1 "register_operand" "0")
8309 (match_operand:VI48_AVX512VL 2 "register_operand" "v")
8310 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand" "vm")
8311 (match_operand:SI 4 "const_0_to_255_operand")]
8314 "vpternlog<ssemodesuffix>\t{%4, %3, %2, %0<sd_mask_op5>|%0<sd_mask_op5>, %2, %3, %4}"
8315 [(set_attr "type" "sselog")
8316 (set_attr "prefix" "evex")
8317 (set_attr "mode" "<sseinsnmode>")])
8319 (define_insn "<avx512>_vternlog<mode>_mask"
8320 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
8321 (vec_merge:VI48_AVX512VL
8322 (unspec:VI48_AVX512VL
8323 [(match_operand:VI48_AVX512VL 1 "register_operand" "0")
8324 (match_operand:VI48_AVX512VL 2 "register_operand" "v")
8325 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand" "vm")
8326 (match_operand:SI 4 "const_0_to_255_operand")]
8329 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
8331 "vpternlog<ssemodesuffix>\t{%4, %3, %2, %0%{%5%}|%0%{%5%}, %2, %3, %4}"
8332 [(set_attr "type" "sselog")
8333 (set_attr "prefix" "evex")
8334 (set_attr "mode" "<sseinsnmode>")])
8336 (define_insn "<avx512>_getexp<mode><mask_name><round_saeonly_name>"
8337 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8338 (unspec:VF_AVX512VL [(match_operand:VF_AVX512VL 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
8341 "vgetexp<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}";
8342 [(set_attr "prefix" "evex")
8343 (set_attr "mode" "<MODE>")])
8345 (define_insn "avx512f_sgetexp<mode><mask_scalar_name><round_saeonly_scalar_name>"
8346 [(set (match_operand:VF_128 0 "register_operand" "=v")
8349 [(match_operand:VF_128 1 "register_operand" "v")
8350 (match_operand:VF_128 2 "<round_saeonly_scalar_nimm_predicate>" "<round_saeonly_scalar_constraint>")]
8355 "vgetexp<ssescalarmodesuffix>\t{<round_saeonly_scalar_mask_op3>%2, %1, %0<mask_scalar_operand3>|%0<mask_scalar_operand3>, %1, %2<round_saeonly_scalar_mask_op3>}";
8356 [(set_attr "prefix" "evex")
8357 (set_attr "mode" "<ssescalarmode>")])
8359 (define_insn "<mask_codefor><avx512>_align<mode><mask_name>"
8360 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
8361 (unspec:VI48_AVX512VL [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
8362 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")
8363 (match_operand:SI 3 "const_0_to_255_operand")]
8366 "valign<ssemodesuffix>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3}";
8367 [(set_attr "prefix" "evex")
8368 (set_attr "mode" "<sseinsnmode>")])
8370 (define_expand "avx512f_shufps512_mask"
8371 [(match_operand:V16SF 0 "register_operand")
8372 (match_operand:V16SF 1 "register_operand")
8373 (match_operand:V16SF 2 "nonimmediate_operand")
8374 (match_operand:SI 3 "const_0_to_255_operand")
8375 (match_operand:V16SF 4 "register_operand")
8376 (match_operand:HI 5 "register_operand")]
8379 int mask = INTVAL (operands[3]);
8380 emit_insn (gen_avx512f_shufps512_1_mask (operands[0], operands[1], operands[2],
8381 GEN_INT ((mask >> 0) & 3),
8382 GEN_INT ((mask >> 2) & 3),
8383 GEN_INT (((mask >> 4) & 3) + 16),
8384 GEN_INT (((mask >> 6) & 3) + 16),
8385 GEN_INT (((mask >> 0) & 3) + 4),
8386 GEN_INT (((mask >> 2) & 3) + 4),
8387 GEN_INT (((mask >> 4) & 3) + 20),
8388 GEN_INT (((mask >> 6) & 3) + 20),
8389 GEN_INT (((mask >> 0) & 3) + 8),
8390 GEN_INT (((mask >> 2) & 3) + 8),
8391 GEN_INT (((mask >> 4) & 3) + 24),
8392 GEN_INT (((mask >> 6) & 3) + 24),
8393 GEN_INT (((mask >> 0) & 3) + 12),
8394 GEN_INT (((mask >> 2) & 3) + 12),
8395 GEN_INT (((mask >> 4) & 3) + 28),
8396 GEN_INT (((mask >> 6) & 3) + 28),
8397 operands[4], operands[5]));
8402 (define_expand "<avx512>_fixupimm<mode>_maskz<round_saeonly_expand_name>"
8403 [(match_operand:VF_AVX512VL 0 "register_operand")
8404 (match_operand:VF_AVX512VL 1 "register_operand")
8405 (match_operand:VF_AVX512VL 2 "register_operand")
8406 (match_operand:<sseintvecmode> 3 "<round_saeonly_expand_nimm_predicate>")
8407 (match_operand:SI 4 "const_0_to_255_operand")
8408 (match_operand:<avx512fmaskmode> 5 "register_operand")]
8411 emit_insn (gen_<avx512>_fixupimm<mode>_maskz_1<round_saeonly_expand_name> (
8412 operands[0], operands[1], operands[2], operands[3],
8413 operands[4], CONST0_RTX (<MODE>mode), operands[5]
8414 <round_saeonly_expand_operand6>));
8418 (define_insn "<avx512>_fixupimm<mode><sd_maskz_name><round_saeonly_name>"
8419 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8421 [(match_operand:VF_AVX512VL 1 "register_operand" "0")
8422 (match_operand:VF_AVX512VL 2 "register_operand" "v")
8423 (match_operand:<sseintvecmode> 3 "nonimmediate_operand" "<round_saeonly_constraint>")
8424 (match_operand:SI 4 "const_0_to_255_operand")]
8427 "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}";
8428 [(set_attr "prefix" "evex")
8429 (set_attr "mode" "<MODE>")])
8431 (define_insn "<avx512>_fixupimm<mode>_mask<round_saeonly_name>"
8432 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8433 (vec_merge:VF_AVX512VL
8435 [(match_operand:VF_AVX512VL 1 "register_operand" "0")
8436 (match_operand:VF_AVX512VL 2 "register_operand" "v")
8437 (match_operand:<sseintvecmode> 3 "nonimmediate_operand" "<round_saeonly_constraint>")
8438 (match_operand:SI 4 "const_0_to_255_operand")]
8441 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
8443 "vfixupimm<ssemodesuffix>\t{%4, <round_saeonly_op6>%3, %2, %0%{%5%}|%0%{%5%}, %2, %3<round_saeonly_op6>, %4}";
8444 [(set_attr "prefix" "evex")
8445 (set_attr "mode" "<MODE>")])
8447 (define_expand "avx512f_sfixupimm<mode>_maskz<round_saeonly_expand_name>"
8448 [(match_operand:VF_128 0 "register_operand")
8449 (match_operand:VF_128 1 "register_operand")
8450 (match_operand:VF_128 2 "register_operand")
8451 (match_operand:<sseintvecmode> 3 "<round_saeonly_expand_nimm_predicate>")
8452 (match_operand:SI 4 "const_0_to_255_operand")
8453 (match_operand:<avx512fmaskmode> 5 "register_operand")]
8456 emit_insn (gen_avx512f_sfixupimm<mode>_maskz_1<round_saeonly_expand_name> (
8457 operands[0], operands[1], operands[2], operands[3],
8458 operands[4], CONST0_RTX (<MODE>mode), operands[5]
8459 <round_saeonly_expand_operand6>));
8463 (define_insn "avx512f_sfixupimm<mode><sd_maskz_name><round_saeonly_name>"
8464 [(set (match_operand:VF_128 0 "register_operand" "=v")
8467 [(match_operand:VF_128 1 "register_operand" "0")
8468 (match_operand:VF_128 2 "register_operand" "v")
8469 (match_operand:<sseintvecmode> 3 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
8470 (match_operand:SI 4 "const_0_to_255_operand")]
8475 "vfixupimm<ssescalarmodesuffix>\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}";
8476 [(set_attr "prefix" "evex")
8477 (set_attr "mode" "<ssescalarmode>")])
8479 (define_insn "avx512f_sfixupimm<mode>_mask<round_saeonly_name>"
8480 [(set (match_operand:VF_128 0 "register_operand" "=v")
8484 [(match_operand:VF_128 1 "register_operand" "0")
8485 (match_operand:VF_128 2 "register_operand" "v")
8486 (match_operand:<sseintvecmode> 3 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
8487 (match_operand:SI 4 "const_0_to_255_operand")]
8492 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
8494 "vfixupimm<ssescalarmodesuffix>\t{%4, <round_saeonly_op6>%3, %2, %0%{%5%}|%0%{%5%}, %2, %3<round_saeonly_op6>, %4}";
8495 [(set_attr "prefix" "evex")
8496 (set_attr "mode" "<ssescalarmode>")])
8498 (define_insn "<avx512>_rndscale<mode><mask_name><round_saeonly_name>"
8499 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8501 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "<round_saeonly_constraint>")
8502 (match_operand:SI 2 "const_0_to_255_operand")]
8505 "vrndscale<ssemodesuffix>\t{%2, <round_saeonly_mask_op3>%1, %0<mask_operand3>|%0<mask_operand3>, %1<round_saeonly_mask_op3>, %2}"
8506 [(set_attr "length_immediate" "1")
8507 (set_attr "prefix" "evex")
8508 (set_attr "mode" "<MODE>")])
8510 (define_insn "avx512f_rndscale<mode><round_saeonly_name>"
8511 [(set (match_operand:VF_128 0 "register_operand" "=v")
8514 [(match_operand:VF_128 1 "register_operand" "v")
8515 (match_operand:VF_128 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
8516 (match_operand:SI 3 "const_0_to_255_operand")]
8521 "vrndscale<ssescalarmodesuffix>\t{%3, <round_saeonly_op4>%2, %1, %0|%0, %1, %2<round_saeonly_op4>, %3}"
8522 [(set_attr "length_immediate" "1")
8523 (set_attr "prefix" "evex")
8524 (set_attr "mode" "<MODE>")])
8526 ;; One bit in mask selects 2 elements.
8527 (define_insn "avx512f_shufps512_1<mask_name>"
8528 [(set (match_operand:V16SF 0 "register_operand" "=v")
8531 (match_operand:V16SF 1 "register_operand" "v")
8532 (match_operand:V16SF 2 "nonimmediate_operand" "vm"))
8533 (parallel [(match_operand 3 "const_0_to_3_operand")
8534 (match_operand 4 "const_0_to_3_operand")
8535 (match_operand 5 "const_16_to_19_operand")
8536 (match_operand 6 "const_16_to_19_operand")
8537 (match_operand 7 "const_4_to_7_operand")
8538 (match_operand 8 "const_4_to_7_operand")
8539 (match_operand 9 "const_20_to_23_operand")
8540 (match_operand 10 "const_20_to_23_operand")
8541 (match_operand 11 "const_8_to_11_operand")
8542 (match_operand 12 "const_8_to_11_operand")
8543 (match_operand 13 "const_24_to_27_operand")
8544 (match_operand 14 "const_24_to_27_operand")
8545 (match_operand 15 "const_12_to_15_operand")
8546 (match_operand 16 "const_12_to_15_operand")
8547 (match_operand 17 "const_28_to_31_operand")
8548 (match_operand 18 "const_28_to_31_operand")])))]
8550 && (INTVAL (operands[3]) == (INTVAL (operands[7]) - 4)
8551 && INTVAL (operands[4]) == (INTVAL (operands[8]) - 4)
8552 && INTVAL (operands[5]) == (INTVAL (operands[9]) - 4)
8553 && INTVAL (operands[6]) == (INTVAL (operands[10]) - 4)
8554 && INTVAL (operands[3]) == (INTVAL (operands[11]) - 8)
8555 && INTVAL (operands[4]) == (INTVAL (operands[12]) - 8)
8556 && INTVAL (operands[5]) == (INTVAL (operands[13]) - 8)
8557 && INTVAL (operands[6]) == (INTVAL (operands[14]) - 8)
8558 && INTVAL (operands[3]) == (INTVAL (operands[15]) - 12)
8559 && INTVAL (operands[4]) == (INTVAL (operands[16]) - 12)
8560 && INTVAL (operands[5]) == (INTVAL (operands[17]) - 12)
8561 && INTVAL (operands[6]) == (INTVAL (operands[18]) - 12))"
8564 mask = INTVAL (operands[3]);
8565 mask |= INTVAL (operands[4]) << 2;
8566 mask |= (INTVAL (operands[5]) - 16) << 4;
8567 mask |= (INTVAL (operands[6]) - 16) << 6;
8568 operands[3] = GEN_INT (mask);
8570 return "vshufps\t{%3, %2, %1, %0<mask_operand19>|%0<mask_operand19>, %1, %2, %3}";
8572 [(set_attr "type" "sselog")
8573 (set_attr "length_immediate" "1")
8574 (set_attr "prefix" "evex")
8575 (set_attr "mode" "V16SF")])
8577 (define_expand "avx512f_shufpd512_mask"
8578 [(match_operand:V8DF 0 "register_operand")
8579 (match_operand:V8DF 1 "register_operand")
8580 (match_operand:V8DF 2 "nonimmediate_operand")
8581 (match_operand:SI 3 "const_0_to_255_operand")
8582 (match_operand:V8DF 4 "register_operand")
8583 (match_operand:QI 5 "register_operand")]
8586 int mask = INTVAL (operands[3]);
8587 emit_insn (gen_avx512f_shufpd512_1_mask (operands[0], operands[1], operands[2],
8589 GEN_INT (mask & 2 ? 9 : 8),
8590 GEN_INT (mask & 4 ? 3 : 2),
8591 GEN_INT (mask & 8 ? 11 : 10),
8592 GEN_INT (mask & 16 ? 5 : 4),
8593 GEN_INT (mask & 32 ? 13 : 12),
8594 GEN_INT (mask & 64 ? 7 : 6),
8595 GEN_INT (mask & 128 ? 15 : 14),
8596 operands[4], operands[5]));
8600 (define_insn "avx512f_shufpd512_1<mask_name>"
8601 [(set (match_operand:V8DF 0 "register_operand" "=v")
8604 (match_operand:V8DF 1 "register_operand" "v")
8605 (match_operand:V8DF 2 "nonimmediate_operand" "vm"))
8606 (parallel [(match_operand 3 "const_0_to_1_operand")
8607 (match_operand 4 "const_8_to_9_operand")
8608 (match_operand 5 "const_2_to_3_operand")
8609 (match_operand 6 "const_10_to_11_operand")
8610 (match_operand 7 "const_4_to_5_operand")
8611 (match_operand 8 "const_12_to_13_operand")
8612 (match_operand 9 "const_6_to_7_operand")
8613 (match_operand 10 "const_14_to_15_operand")])))]
8617 mask = INTVAL (operands[3]);
8618 mask |= (INTVAL (operands[4]) - 8) << 1;
8619 mask |= (INTVAL (operands[5]) - 2) << 2;
8620 mask |= (INTVAL (operands[6]) - 10) << 3;
8621 mask |= (INTVAL (operands[7]) - 4) << 4;
8622 mask |= (INTVAL (operands[8]) - 12) << 5;
8623 mask |= (INTVAL (operands[9]) - 6) << 6;
8624 mask |= (INTVAL (operands[10]) - 14) << 7;
8625 operands[3] = GEN_INT (mask);
8627 return "vshufpd\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
8629 [(set_attr "type" "sselog")
8630 (set_attr "length_immediate" "1")
8631 (set_attr "prefix" "evex")
8632 (set_attr "mode" "V8DF")])
8634 (define_expand "avx_shufpd256<mask_expand4_name>"
8635 [(match_operand:V4DF 0 "register_operand")
8636 (match_operand:V4DF 1 "register_operand")
8637 (match_operand:V4DF 2 "nonimmediate_operand")
8638 (match_operand:SI 3 "const_int_operand")]
8641 int mask = INTVAL (operands[3]);
8642 emit_insn (gen_avx_shufpd256_1<mask_expand4_name> (operands[0],
8646 GEN_INT (mask & 2 ? 5 : 4),
8647 GEN_INT (mask & 4 ? 3 : 2),
8648 GEN_INT (mask & 8 ? 7 : 6)
8649 <mask_expand4_args>));
8653 (define_insn "avx_shufpd256_1<mask_name>"
8654 [(set (match_operand:V4DF 0 "register_operand" "=v")
8657 (match_operand:V4DF 1 "register_operand" "v")
8658 (match_operand:V4DF 2 "nonimmediate_operand" "vm"))
8659 (parallel [(match_operand 3 "const_0_to_1_operand")
8660 (match_operand 4 "const_4_to_5_operand")
8661 (match_operand 5 "const_2_to_3_operand")
8662 (match_operand 6 "const_6_to_7_operand")])))]
8663 "TARGET_AVX && <mask_avx512vl_condition>"
8666 mask = INTVAL (operands[3]);
8667 mask |= (INTVAL (operands[4]) - 4) << 1;
8668 mask |= (INTVAL (operands[5]) - 2) << 2;
8669 mask |= (INTVAL (operands[6]) - 6) << 3;
8670 operands[3] = GEN_INT (mask);
8672 return "vshufpd\t{%3, %2, %1, %0<mask_operand7>|%0<mask_operand7>, %1, %2, %3}";
8674 [(set_attr "type" "sseshuf")
8675 (set_attr "length_immediate" "1")
8676 (set_attr "prefix" "vex")
8677 (set_attr "mode" "V4DF")])
8679 (define_expand "sse2_shufpd<mask_expand4_name>"
8680 [(match_operand:V2DF 0 "register_operand")
8681 (match_operand:V2DF 1 "register_operand")
8682 (match_operand:V2DF 2 "vector_operand")
8683 (match_operand:SI 3 "const_int_operand")]
8686 int mask = INTVAL (operands[3]);
8687 emit_insn (gen_sse2_shufpd_v2df<mask_expand4_name> (operands[0], operands[1],
8688 operands[2], GEN_INT (mask & 1),
8689 GEN_INT (mask & 2 ? 3 : 2)
8690 <mask_expand4_args>));
8694 (define_insn "sse2_shufpd_v2df_mask"
8695 [(set (match_operand:V2DF 0 "register_operand" "=v")
8699 (match_operand:V2DF 1 "register_operand" "v")
8700 (match_operand:V2DF 2 "nonimmediate_operand" "vm"))
8701 (parallel [(match_operand 3 "const_0_to_1_operand")
8702 (match_operand 4 "const_2_to_3_operand")]))
8703 (match_operand:V2DF 5 "vector_move_operand" "0C")
8704 (match_operand:QI 6 "register_operand" "Yk")))]
8708 mask = INTVAL (operands[3]);
8709 mask |= (INTVAL (operands[4]) - 2) << 1;
8710 operands[3] = GEN_INT (mask);
8712 return "vshufpd\t{%3, %2, %1, %0%{%6%}%N5|%0%{6%}%N5, %1, %2, %3}";
8714 [(set_attr "type" "sseshuf")
8715 (set_attr "length_immediate" "1")
8716 (set_attr "prefix" "evex")
8717 (set_attr "mode" "V2DF")])
8719 ;; punpcklqdq and punpckhqdq are shorter than shufpd.
8720 (define_insn "avx2_interleave_highv4di<mask_name>"
8721 [(set (match_operand:V4DI 0 "register_operand" "=v")
8724 (match_operand:V4DI 1 "register_operand" "v")
8725 (match_operand:V4DI 2 "nonimmediate_operand" "vm"))
8726 (parallel [(const_int 1)
8730 "TARGET_AVX2 && <mask_avx512vl_condition>"
8731 "vpunpckhqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8732 [(set_attr "type" "sselog")
8733 (set_attr "prefix" "vex")
8734 (set_attr "mode" "OI")])
8736 (define_insn "<mask_codefor>avx512f_interleave_highv8di<mask_name>"
8737 [(set (match_operand:V8DI 0 "register_operand" "=v")
8740 (match_operand:V8DI 1 "register_operand" "v")
8741 (match_operand:V8DI 2 "nonimmediate_operand" "vm"))
8742 (parallel [(const_int 1) (const_int 9)
8743 (const_int 3) (const_int 11)
8744 (const_int 5) (const_int 13)
8745 (const_int 7) (const_int 15)])))]
8747 "vpunpckhqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8748 [(set_attr "type" "sselog")
8749 (set_attr "prefix" "evex")
8750 (set_attr "mode" "XI")])
8752 (define_insn "vec_interleave_highv2di<mask_name>"
8753 [(set (match_operand:V2DI 0 "register_operand" "=x,v")
8756 (match_operand:V2DI 1 "register_operand" "0,v")
8757 (match_operand:V2DI 2 "vector_operand" "xBm,vm"))
8758 (parallel [(const_int 1)
8760 "TARGET_SSE2 && <mask_avx512vl_condition>"
8762 punpckhqdq\t{%2, %0|%0, %2}
8763 vpunpckhqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8764 [(set_attr "isa" "noavx,avx")
8765 (set_attr "type" "sselog")
8766 (set_attr "prefix_data16" "1,*")
8767 (set_attr "prefix" "orig,<mask_prefix>")
8768 (set_attr "mode" "TI")])
8770 (define_insn "avx2_interleave_lowv4di<mask_name>"
8771 [(set (match_operand:V4DI 0 "register_operand" "=v")
8774 (match_operand:V4DI 1 "register_operand" "v")
8775 (match_operand:V4DI 2 "nonimmediate_operand" "vm"))
8776 (parallel [(const_int 0)
8780 "TARGET_AVX2 && <mask_avx512vl_condition>"
8781 "vpunpcklqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8782 [(set_attr "type" "sselog")
8783 (set_attr "prefix" "vex")
8784 (set_attr "mode" "OI")])
8786 (define_insn "<mask_codefor>avx512f_interleave_lowv8di<mask_name>"
8787 [(set (match_operand:V8DI 0 "register_operand" "=v")
8790 (match_operand:V8DI 1 "register_operand" "v")
8791 (match_operand:V8DI 2 "nonimmediate_operand" "vm"))
8792 (parallel [(const_int 0) (const_int 8)
8793 (const_int 2) (const_int 10)
8794 (const_int 4) (const_int 12)
8795 (const_int 6) (const_int 14)])))]
8797 "vpunpcklqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8798 [(set_attr "type" "sselog")
8799 (set_attr "prefix" "evex")
8800 (set_attr "mode" "XI")])
8802 (define_insn "vec_interleave_lowv2di<mask_name>"
8803 [(set (match_operand:V2DI 0 "register_operand" "=x,v")
8806 (match_operand:V2DI 1 "register_operand" "0,v")
8807 (match_operand:V2DI 2 "vector_operand" "xBm,vm"))
8808 (parallel [(const_int 0)
8810 "TARGET_SSE2 && <mask_avx512vl_condition>"
8812 punpcklqdq\t{%2, %0|%0, %2}
8813 vpunpcklqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8814 [(set_attr "isa" "noavx,avx")
8815 (set_attr "type" "sselog")
8816 (set_attr "prefix_data16" "1,*")
8817 (set_attr "prefix" "orig,vex")
8818 (set_attr "mode" "TI")])
8820 (define_insn "sse2_shufpd_<mode>"
8821 [(set (match_operand:VI8F_128 0 "register_operand" "=x,v")
8822 (vec_select:VI8F_128
8823 (vec_concat:<ssedoublevecmode>
8824 (match_operand:VI8F_128 1 "register_operand" "0,v")
8825 (match_operand:VI8F_128 2 "vector_operand" "xBm,vm"))
8826 (parallel [(match_operand 3 "const_0_to_1_operand")
8827 (match_operand 4 "const_2_to_3_operand")])))]
8831 mask = INTVAL (operands[3]);
8832 mask |= (INTVAL (operands[4]) - 2) << 1;
8833 operands[3] = GEN_INT (mask);
8835 switch (which_alternative)
8838 return "shufpd\t{%3, %2, %0|%0, %2, %3}";
8840 return "vshufpd\t{%3, %2, %1, %0|%0, %1, %2, %3}";
8845 [(set_attr "isa" "noavx,avx")
8846 (set_attr "type" "sseshuf")
8847 (set_attr "length_immediate" "1")
8848 (set_attr "prefix" "orig,maybe_evex")
8849 (set_attr "mode" "V2DF")])
8851 ;; Avoid combining registers from different units in a single alternative,
8852 ;; see comment above inline_secondary_memory_needed function in i386.c
8853 (define_insn "sse2_storehpd"
8854 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,Yv,x,*f,r")
8856 (match_operand:V2DF 1 "nonimmediate_operand" " v,0, v,o,o,o")
8857 (parallel [(const_int 1)])))]
8858 "TARGET_SSE2 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
8860 %vmovhpd\t{%1, %0|%0, %1}
8862 vunpckhpd\t{%d1, %0|%0, %d1}
8866 [(set_attr "isa" "*,noavx,avx,*,*,*")
8867 (set_attr "type" "ssemov,sselog1,sselog1,ssemov,fmov,imov")
8868 (set (attr "prefix_data16")
8870 (and (eq_attr "alternative" "0")
8871 (not (match_test "TARGET_AVX")))
8873 (const_string "*")))
8874 (set_attr "prefix" "maybe_vex,orig,maybe_evex,*,*,*")
8875 (set_attr "mode" "V1DF,V1DF,V2DF,DF,DF,DF")])
8878 [(set (match_operand:DF 0 "register_operand")
8880 (match_operand:V2DF 1 "memory_operand")
8881 (parallel [(const_int 1)])))]
8882 "TARGET_SSE2 && reload_completed"
8883 [(set (match_dup 0) (match_dup 1))]
8884 "operands[1] = adjust_address (operands[1], DFmode, 8);")
8886 (define_insn "*vec_extractv2df_1_sse"
8887 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,x")
8889 (match_operand:V2DF 1 "nonimmediate_operand" "x,x,o")
8890 (parallel [(const_int 1)])))]
8891 "!TARGET_SSE2 && TARGET_SSE
8892 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
8894 movhps\t{%1, %0|%q0, %1}
8895 movhlps\t{%1, %0|%0, %1}
8896 movlps\t{%H1, %0|%0, %H1}"
8897 [(set_attr "type" "ssemov")
8898 (set_attr "mode" "V2SF,V4SF,V2SF")])
8900 ;; Avoid combining registers from different units in a single alternative,
8901 ;; see comment above inline_secondary_memory_needed function in i386.c
8902 (define_insn "sse2_storelpd"
8903 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,x,*f,r")
8905 (match_operand:V2DF 1 "nonimmediate_operand" " v,x,m,m,m")
8906 (parallel [(const_int 0)])))]
8907 "TARGET_SSE2 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
8909 %vmovlpd\t{%1, %0|%0, %1}
8914 [(set_attr "type" "ssemov,ssemov,ssemov,fmov,imov")
8915 (set (attr "prefix_data16")
8916 (if_then_else (eq_attr "alternative" "0")
8918 (const_string "*")))
8919 (set_attr "prefix" "maybe_vex")
8920 (set_attr "mode" "V1DF,DF,DF,DF,DF")])
8923 [(set (match_operand:DF 0 "register_operand")
8925 (match_operand:V2DF 1 "nonimmediate_operand")
8926 (parallel [(const_int 0)])))]
8927 "TARGET_SSE2 && reload_completed"
8928 [(set (match_dup 0) (match_dup 1))]
8929 "operands[1] = gen_lowpart (DFmode, operands[1]);")
8931 (define_insn "*vec_extractv2df_0_sse"
8932 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,x")
8934 (match_operand:V2DF 1 "nonimmediate_operand" "x,x,m")
8935 (parallel [(const_int 0)])))]
8936 "!TARGET_SSE2 && TARGET_SSE
8937 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
8939 movlps\t{%1, %0|%0, %1}
8940 movaps\t{%1, %0|%0, %1}
8941 movlps\t{%1, %0|%0, %q1}"
8942 [(set_attr "type" "ssemov")
8943 (set_attr "mode" "V2SF,V4SF,V2SF")])
8945 (define_expand "sse2_loadhpd_exp"
8946 [(set (match_operand:V2DF 0 "nonimmediate_operand")
8949 (match_operand:V2DF 1 "nonimmediate_operand")
8950 (parallel [(const_int 0)]))
8951 (match_operand:DF 2 "nonimmediate_operand")))]
8954 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V2DFmode, operands);
8956 emit_insn (gen_sse2_loadhpd (dst, operands[1], operands[2]));
8958 /* Fix up the destination if needed. */
8959 if (dst != operands[0])
8960 emit_move_insn (operands[0], dst);
8965 ;; Avoid combining registers from different units in a single alternative,
8966 ;; see comment above inline_secondary_memory_needed function in i386.c
8967 (define_insn "sse2_loadhpd"
8968 [(set (match_operand:V2DF 0 "nonimmediate_operand"
8972 (match_operand:V2DF 1 "nonimmediate_operand"
8974 (parallel [(const_int 0)]))
8975 (match_operand:DF 2 "nonimmediate_operand"
8976 " m,m,x,v,x,*f,r")))]
8977 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
8979 movhpd\t{%2, %0|%0, %2}
8980 vmovhpd\t{%2, %1, %0|%0, %1, %2}
8981 unpcklpd\t{%2, %0|%0, %2}
8982 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
8986 [(set_attr "isa" "noavx,avx,noavx,avx,*,*,*")
8987 (set_attr "type" "ssemov,ssemov,sselog,sselog,ssemov,fmov,imov")
8988 (set (attr "prefix_data16")
8989 (if_then_else (eq_attr "alternative" "0")
8991 (const_string "*")))
8992 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,*,*,*")
8993 (set_attr "mode" "V1DF,V1DF,V2DF,V2DF,DF,DF,DF")])
8996 [(set (match_operand:V2DF 0 "memory_operand")
8998 (vec_select:DF (match_dup 0) (parallel [(const_int 0)]))
8999 (match_operand:DF 1 "register_operand")))]
9000 "TARGET_SSE2 && reload_completed"
9001 [(set (match_dup 0) (match_dup 1))]
9002 "operands[0] = adjust_address (operands[0], DFmode, 8);")
9004 (define_expand "sse2_loadlpd_exp"
9005 [(set (match_operand:V2DF 0 "nonimmediate_operand")
9007 (match_operand:DF 2 "nonimmediate_operand")
9009 (match_operand:V2DF 1 "nonimmediate_operand")
9010 (parallel [(const_int 1)]))))]
9013 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V2DFmode, operands);
9015 emit_insn (gen_sse2_loadlpd (dst, operands[1], operands[2]));
9017 /* Fix up the destination if needed. */
9018 if (dst != operands[0])
9019 emit_move_insn (operands[0], dst);
9024 ;; Avoid combining registers from different units in a single alternative,
9025 ;; see comment above inline_secondary_memory_needed function in i386.c
9026 (define_insn "sse2_loadlpd"
9027 [(set (match_operand:V2DF 0 "nonimmediate_operand"
9028 "=v,x,v,x,v,x,x,v,m,m ,m")
9030 (match_operand:DF 2 "nonimmediate_operand"
9031 "vm,m,m,x,v,0,0,v,x,*f,r")
9033 (match_operand:V2DF 1 "vector_move_operand"
9034 " C,0,v,0,v,x,o,o,0,0 ,0")
9035 (parallel [(const_int 1)]))))]
9036 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
9038 %vmovq\t{%2, %0|%0, %2}
9039 movlpd\t{%2, %0|%0, %2}
9040 vmovlpd\t{%2, %1, %0|%0, %1, %2}
9041 movsd\t{%2, %0|%0, %2}
9042 vmovsd\t{%2, %1, %0|%0, %1, %2}
9043 shufpd\t{$2, %1, %0|%0, %1, 2}
9044 movhpd\t{%H1, %0|%0, %H1}
9045 vmovhpd\t{%H1, %2, %0|%0, %2, %H1}
9049 [(set_attr "isa" "*,noavx,avx,noavx,avx,noavx,noavx,avx,*,*,*")
9051 (cond [(eq_attr "alternative" "5")
9052 (const_string "sselog")
9053 (eq_attr "alternative" "9")
9054 (const_string "fmov")
9055 (eq_attr "alternative" "10")
9056 (const_string "imov")
9058 (const_string "ssemov")))
9059 (set (attr "prefix_data16")
9060 (if_then_else (eq_attr "alternative" "1,6")
9062 (const_string "*")))
9063 (set (attr "length_immediate")
9064 (if_then_else (eq_attr "alternative" "5")
9066 (const_string "*")))
9067 (set (attr "prefix")
9068 (cond [(eq_attr "alternative" "0")
9069 (const_string "maybe_vex")
9070 (eq_attr "alternative" "1,3,5,6")
9071 (const_string "orig")
9072 (eq_attr "alternative" "2,4,7")
9073 (const_string "maybe_evex")
9075 (const_string "*")))
9076 (set_attr "mode" "DF,V1DF,V1DF,V1DF,V1DF,V2DF,V1DF,V1DF,DF,DF,DF")])
9079 [(set (match_operand:V2DF 0 "memory_operand")
9081 (match_operand:DF 1 "register_operand")
9082 (vec_select:DF (match_dup 0) (parallel [(const_int 1)]))))]
9083 "TARGET_SSE2 && reload_completed"
9084 [(set (match_dup 0) (match_dup 1))]
9085 "operands[0] = adjust_address (operands[0], DFmode, 0);")
9087 (define_insn "sse2_movsd"
9088 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,v,x,v,m,x,x,v,o")
9090 (match_operand:V2DF 2 "nonimmediate_operand" " x,v,m,m,v,0,0,v,0")
9091 (match_operand:V2DF 1 "nonimmediate_operand" " 0,v,0,v,0,x,o,o,v")
9095 movsd\t{%2, %0|%0, %2}
9096 vmovsd\t{%2, %1, %0|%0, %1, %2}
9097 movlpd\t{%2, %0|%0, %q2}
9098 vmovlpd\t{%2, %1, %0|%0, %1, %q2}
9099 %vmovlpd\t{%2, %0|%q0, %2}
9100 shufpd\t{$2, %1, %0|%0, %1, 2}
9101 movhps\t{%H1, %0|%0, %H1}
9102 vmovhps\t{%H1, %2, %0|%0, %2, %H1}
9103 %vmovhps\t{%1, %H0|%H0, %1}"
9104 [(set_attr "isa" "noavx,avx,noavx,avx,*,noavx,noavx,avx,*")
9107 (eq_attr "alternative" "5")
9108 (const_string "sselog")
9109 (const_string "ssemov")))
9110 (set (attr "prefix_data16")
9112 (and (eq_attr "alternative" "2,4")
9113 (not (match_test "TARGET_AVX")))
9115 (const_string "*")))
9116 (set (attr "length_immediate")
9117 (if_then_else (eq_attr "alternative" "5")
9119 (const_string "*")))
9120 (set (attr "prefix")
9121 (cond [(eq_attr "alternative" "1,3,7")
9122 (const_string "maybe_evex")
9123 (eq_attr "alternative" "4,8")
9124 (const_string "maybe_vex")
9126 (const_string "orig")))
9127 (set_attr "mode" "DF,DF,V1DF,V1DF,V1DF,V2DF,V1DF,V1DF,V1DF")])
9129 (define_insn "vec_dupv2df<mask_name>"
9130 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
9132 (match_operand:DF 1 "nonimmediate_operand" " 0,xm,vm")))]
9133 "TARGET_SSE2 && <mask_avx512vl_condition>"
9136 %vmovddup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}
9137 vmovddup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
9138 [(set_attr "isa" "noavx,sse3,avx512vl")
9139 (set_attr "type" "sselog1")
9140 (set_attr "prefix" "orig,maybe_vex,evex")
9141 (set_attr "mode" "V2DF,DF,DF")])
9143 (define_insn "vec_concatv2df"
9144 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v,x,v,x,x, v,x,x")
9146 (match_operand:DF 1 "nonimmediate_operand" " 0,x,v,m,m,0,x,xm,0,0")
9147 (match_operand:DF 2 "vector_move_operand" " x,x,v,1,1,m,m, C,x,m")))]
9149 && (!(MEM_P (operands[1]) && MEM_P (operands[2]))
9150 || (TARGET_SSE3 && rtx_equal_p (operands[1], operands[2])))"
9152 unpcklpd\t{%2, %0|%0, %2}
9153 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
9154 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
9155 %vmovddup\t{%1, %0|%0, %1}
9156 vmovddup\t{%1, %0|%0, %1}
9157 movhpd\t{%2, %0|%0, %2}
9158 vmovhpd\t{%2, %1, %0|%0, %1, %2}
9159 %vmovq\t{%1, %0|%0, %1}
9160 movlhps\t{%2, %0|%0, %2}
9161 movhps\t{%2, %0|%0, %2}"
9163 (cond [(eq_attr "alternative" "0,5")
9164 (const_string "sse2_noavx")
9165 (eq_attr "alternative" "1,6")
9166 (const_string "avx")
9167 (eq_attr "alternative" "2,4")
9168 (const_string "avx512vl")
9169 (eq_attr "alternative" "3")
9170 (const_string "sse3")
9171 (eq_attr "alternative" "7")
9172 (const_string "sse2")
9174 (const_string "noavx")))
9177 (eq_attr "alternative" "0,1,2,3,4")
9178 (const_string "sselog")
9179 (const_string "ssemov")))
9180 (set (attr "prefix_data16")
9181 (if_then_else (eq_attr "alternative" "5")
9183 (const_string "*")))
9184 (set (attr "prefix")
9185 (cond [(eq_attr "alternative" "1,6")
9186 (const_string "vex")
9187 (eq_attr "alternative" "2,4")
9188 (const_string "evex")
9189 (eq_attr "alternative" "3,7")
9190 (const_string "maybe_vex")
9192 (const_string "orig")))
9193 (set_attr "mode" "V2DF,V2DF,V2DF, DF, DF, V1DF,V1DF,DF,V4SF,V2SF")])
9195 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9197 ;; Parallel integer down-conversion operations
9199 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9201 (define_mode_iterator PMOV_DST_MODE_1 [V16QI V16HI V8SI V8HI])
9202 (define_mode_attr pmov_src_mode
9203 [(V16QI "V16SI") (V16HI "V16SI") (V8SI "V8DI") (V8HI "V8DI")])
9204 (define_mode_attr pmov_src_lower
9205 [(V16QI "v16si") (V16HI "v16si") (V8SI "v8di") (V8HI "v8di")])
9206 (define_mode_attr pmov_suff_1
9207 [(V16QI "db") (V16HI "dw") (V8SI "qd") (V8HI "qw")])
9209 (define_insn "*avx512f_<code><pmov_src_lower><mode>2"
9210 [(set (match_operand:PMOV_DST_MODE_1 0 "nonimmediate_operand" "=v,m")
9211 (any_truncate:PMOV_DST_MODE_1
9212 (match_operand:<pmov_src_mode> 1 "register_operand" "v,v")))]
9214 "vpmov<trunsuffix><pmov_suff_1>\t{%1, %0|%0, %1}"
9215 [(set_attr "type" "ssemov")
9216 (set_attr "memory" "none,store")
9217 (set_attr "prefix" "evex")
9218 (set_attr "mode" "<sseinsnmode>")])
9220 (define_insn "avx512f_<code><pmov_src_lower><mode>2_mask"
9221 [(set (match_operand:PMOV_DST_MODE_1 0 "nonimmediate_operand" "=v,m")
9222 (vec_merge:PMOV_DST_MODE_1
9223 (any_truncate:PMOV_DST_MODE_1
9224 (match_operand:<pmov_src_mode> 1 "register_operand" "v,v"))
9225 (match_operand:PMOV_DST_MODE_1 2 "vector_move_operand" "0C,0")
9226 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
9228 "vpmov<trunsuffix><pmov_suff_1>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9229 [(set_attr "type" "ssemov")
9230 (set_attr "memory" "none,store")
9231 (set_attr "prefix" "evex")
9232 (set_attr "mode" "<sseinsnmode>")])
9234 (define_expand "avx512f_<code><pmov_src_lower><mode>2_mask_store"
9235 [(set (match_operand:PMOV_DST_MODE_1 0 "memory_operand")
9236 (vec_merge:PMOV_DST_MODE_1
9237 (any_truncate:PMOV_DST_MODE_1
9238 (match_operand:<pmov_src_mode> 1 "register_operand"))
9240 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
9243 (define_insn "avx512bw_<code>v32hiv32qi2"
9244 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=v,m")
9246 (match_operand:V32HI 1 "register_operand" "v,v")))]
9248 "vpmov<trunsuffix>wb\t{%1, %0|%0, %1}"
9249 [(set_attr "type" "ssemov")
9250 (set_attr "memory" "none,store")
9251 (set_attr "prefix" "evex")
9252 (set_attr "mode" "XI")])
9254 (define_insn "avx512bw_<code>v32hiv32qi2_mask"
9255 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=v,m")
9258 (match_operand:V32HI 1 "register_operand" "v,v"))
9259 (match_operand:V32QI 2 "vector_move_operand" "0C,0")
9260 (match_operand:SI 3 "register_operand" "Yk,Yk")))]
9262 "vpmov<trunsuffix>wb\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9263 [(set_attr "type" "ssemov")
9264 (set_attr "memory" "none,store")
9265 (set_attr "prefix" "evex")
9266 (set_attr "mode" "XI")])
9268 (define_expand "avx512bw_<code>v32hiv32qi2_mask_store"
9269 [(set (match_operand:V32QI 0 "nonimmediate_operand")
9272 (match_operand:V32HI 1 "register_operand"))
9274 (match_operand:SI 2 "register_operand")))]
9277 (define_mode_iterator PMOV_DST_MODE_2
9278 [V4SI V8HI (V16QI "TARGET_AVX512BW")])
9279 (define_mode_attr pmov_suff_2
9280 [(V16QI "wb") (V8HI "dw") (V4SI "qd")])
9282 (define_insn "*avx512vl_<code><ssedoublemodelower><mode>2"
9283 [(set (match_operand:PMOV_DST_MODE_2 0 "nonimmediate_operand" "=v,m")
9284 (any_truncate:PMOV_DST_MODE_2
9285 (match_operand:<ssedoublemode> 1 "register_operand" "v,v")))]
9287 "vpmov<trunsuffix><pmov_suff_2>\t{%1, %0|%0, %1}"
9288 [(set_attr "type" "ssemov")
9289 (set_attr "memory" "none,store")
9290 (set_attr "prefix" "evex")
9291 (set_attr "mode" "<sseinsnmode>")])
9293 (define_insn "<avx512>_<code><ssedoublemodelower><mode>2_mask"
9294 [(set (match_operand:PMOV_DST_MODE_2 0 "nonimmediate_operand" "=v,m")
9295 (vec_merge:PMOV_DST_MODE_2
9296 (any_truncate:PMOV_DST_MODE_2
9297 (match_operand:<ssedoublemode> 1 "register_operand" "v,v"))
9298 (match_operand:PMOV_DST_MODE_2 2 "vector_move_operand" "0C,0")
9299 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
9301 "vpmov<trunsuffix><pmov_suff_2>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9302 [(set_attr "type" "ssemov")
9303 (set_attr "memory" "none,store")
9304 (set_attr "prefix" "evex")
9305 (set_attr "mode" "<sseinsnmode>")])
9307 (define_expand "<avx512>_<code><ssedoublemodelower><mode>2_mask_store"
9308 [(set (match_operand:PMOV_DST_MODE_2 0 "nonimmediate_operand")
9309 (vec_merge:PMOV_DST_MODE_2
9310 (any_truncate:PMOV_DST_MODE_2
9311 (match_operand:<ssedoublemode> 1 "register_operand"))
9313 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
9316 (define_mode_iterator PMOV_SRC_MODE_3 [V4DI V2DI V8SI V4SI (V8HI "TARGET_AVX512BW")])
9317 (define_mode_attr pmov_dst_3
9318 [(V4DI "V4QI") (V2DI "V2QI") (V8SI "V8QI") (V4SI "V4QI") (V8HI "V8QI")])
9319 (define_mode_attr pmov_dst_zeroed_3
9320 [(V4DI "V12QI") (V2DI "V14QI") (V8SI "V8QI") (V4SI "V12QI") (V8HI "V8QI")])
9321 (define_mode_attr pmov_suff_3
9322 [(V4DI "qb") (V2DI "qb") (V8SI "db") (V4SI "db") (V8HI "wb")])
9324 (define_insn "*avx512vl_<code><mode>v<ssescalarnum>qi2"
9325 [(set (match_operand:V16QI 0 "register_operand" "=v")
9327 (any_truncate:<pmov_dst_3>
9328 (match_operand:PMOV_SRC_MODE_3 1 "register_operand" "v"))
9329 (match_operand:<pmov_dst_zeroed_3> 2 "const0_operand")))]
9331 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0|%0, %1}"
9332 [(set_attr "type" "ssemov")
9333 (set_attr "prefix" "evex")
9334 (set_attr "mode" "TI")])
9336 (define_insn "*avx512vl_<code>v2div2qi2_store"
9337 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9340 (match_operand:V2DI 1 "register_operand" "v"))
9343 (parallel [(const_int 2) (const_int 3)
9344 (const_int 4) (const_int 5)
9345 (const_int 6) (const_int 7)
9346 (const_int 8) (const_int 9)
9347 (const_int 10) (const_int 11)
9348 (const_int 12) (const_int 13)
9349 (const_int 14) (const_int 15)]))))]
9351 "vpmov<trunsuffix>qb\t{%1, %0|%0, %1}"
9352 [(set_attr "type" "ssemov")
9353 (set_attr "memory" "store")
9354 (set_attr "prefix" "evex")
9355 (set_attr "mode" "TI")])
9357 (define_insn "avx512vl_<code>v2div2qi2_mask"
9358 [(set (match_operand:V16QI 0 "register_operand" "=v")
9362 (match_operand:V2DI 1 "register_operand" "v"))
9364 (match_operand:V16QI 2 "vector_move_operand" "0C")
9365 (parallel [(const_int 0) (const_int 1)]))
9366 (match_operand:QI 3 "register_operand" "Yk"))
9367 (const_vector:V14QI [(const_int 0) (const_int 0)
9368 (const_int 0) (const_int 0)
9369 (const_int 0) (const_int 0)
9370 (const_int 0) (const_int 0)
9371 (const_int 0) (const_int 0)
9372 (const_int 0) (const_int 0)
9373 (const_int 0) (const_int 0)])))]
9375 "vpmov<trunsuffix>qb\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9376 [(set_attr "type" "ssemov")
9377 (set_attr "prefix" "evex")
9378 (set_attr "mode" "TI")])
9380 (define_insn "*avx512vl_<code>v2div2qi2_mask_1"
9381 [(set (match_operand:V16QI 0 "register_operand" "=v")
9385 (match_operand:V2DI 1 "register_operand" "v"))
9386 (const_vector:V2QI [(const_int 0) (const_int 0)])
9387 (match_operand:QI 2 "register_operand" "Yk"))
9388 (const_vector:V14QI [(const_int 0) (const_int 0)
9389 (const_int 0) (const_int 0)
9390 (const_int 0) (const_int 0)
9391 (const_int 0) (const_int 0)
9392 (const_int 0) (const_int 0)
9393 (const_int 0) (const_int 0)
9394 (const_int 0) (const_int 0)])))]
9396 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9397 [(set_attr "type" "ssemov")
9398 (set_attr "prefix" "evex")
9399 (set_attr "mode" "TI")])
9401 (define_insn "avx512vl_<code>v2div2qi2_mask_store"
9402 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9406 (match_operand:V2DI 1 "register_operand" "v"))
9409 (parallel [(const_int 0) (const_int 1)]))
9410 (match_operand:QI 2 "register_operand" "Yk"))
9413 (parallel [(const_int 2) (const_int 3)
9414 (const_int 4) (const_int 5)
9415 (const_int 6) (const_int 7)
9416 (const_int 8) (const_int 9)
9417 (const_int 10) (const_int 11)
9418 (const_int 12) (const_int 13)
9419 (const_int 14) (const_int 15)]))))]
9421 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}|%w0%{%2%}, %1}"
9422 [(set_attr "type" "ssemov")
9423 (set_attr "memory" "store")
9424 (set_attr "prefix" "evex")
9425 (set_attr "mode" "TI")])
9427 (define_insn "*avx512vl_<code><mode>v4qi2_store"
9428 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9431 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9434 (parallel [(const_int 4) (const_int 5)
9435 (const_int 6) (const_int 7)
9436 (const_int 8) (const_int 9)
9437 (const_int 10) (const_int 11)
9438 (const_int 12) (const_int 13)
9439 (const_int 14) (const_int 15)]))))]
9441 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0|%0, %1}"
9442 [(set_attr "type" "ssemov")
9443 (set_attr "memory" "store")
9444 (set_attr "prefix" "evex")
9445 (set_attr "mode" "TI")])
9447 (define_insn "avx512vl_<code><mode>v4qi2_mask"
9448 [(set (match_operand:V16QI 0 "register_operand" "=v")
9452 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9454 (match_operand:V16QI 2 "vector_move_operand" "0C")
9455 (parallel [(const_int 0) (const_int 1)
9456 (const_int 2) (const_int 3)]))
9457 (match_operand:QI 3 "register_operand" "Yk"))
9458 (const_vector:V12QI [(const_int 0) (const_int 0)
9459 (const_int 0) (const_int 0)
9460 (const_int 0) (const_int 0)
9461 (const_int 0) (const_int 0)
9462 (const_int 0) (const_int 0)
9463 (const_int 0) (const_int 0)])))]
9465 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9466 [(set_attr "type" "ssemov")
9467 (set_attr "prefix" "evex")
9468 (set_attr "mode" "TI")])
9470 (define_insn "*avx512vl_<code><mode>v4qi2_mask_1"
9471 [(set (match_operand:V16QI 0 "register_operand" "=v")
9475 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9476 (const_vector:V4QI [(const_int 0) (const_int 0)
9477 (const_int 0) (const_int 0)])
9478 (match_operand:QI 2 "register_operand" "Yk"))
9479 (const_vector:V12QI [(const_int 0) (const_int 0)
9480 (const_int 0) (const_int 0)
9481 (const_int 0) (const_int 0)
9482 (const_int 0) (const_int 0)
9483 (const_int 0) (const_int 0)
9484 (const_int 0) (const_int 0)])))]
9486 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9487 [(set_attr "type" "ssemov")
9488 (set_attr "prefix" "evex")
9489 (set_attr "mode" "TI")])
9491 (define_insn "avx512vl_<code><mode>v4qi2_mask_store"
9492 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9496 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9499 (parallel [(const_int 0) (const_int 1)
9500 (const_int 2) (const_int 3)]))
9501 (match_operand:QI 2 "register_operand" "Yk"))
9504 (parallel [(const_int 4) (const_int 5)
9505 (const_int 6) (const_int 7)
9506 (const_int 8) (const_int 9)
9507 (const_int 10) (const_int 11)
9508 (const_int 12) (const_int 13)
9509 (const_int 14) (const_int 15)]))))]
9512 if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 8)
9513 return "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}|%k0%{%2%}, %1}";
9514 return "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}|%0%{%2%}, %g1}";
9516 [(set_attr "type" "ssemov")
9517 (set_attr "memory" "store")
9518 (set_attr "prefix" "evex")
9519 (set_attr "mode" "TI")])
9521 (define_mode_iterator VI2_128_BW_4_256
9522 [(V8HI "TARGET_AVX512BW") V8SI])
9524 (define_insn "*avx512vl_<code><mode>v8qi2_store"
9525 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9528 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9531 (parallel [(const_int 8) (const_int 9)
9532 (const_int 10) (const_int 11)
9533 (const_int 12) (const_int 13)
9534 (const_int 14) (const_int 15)]))))]
9536 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0|%0, %1}"
9537 [(set_attr "type" "ssemov")
9538 (set_attr "memory" "store")
9539 (set_attr "prefix" "evex")
9540 (set_attr "mode" "TI")])
9542 (define_insn "avx512vl_<code><mode>v8qi2_mask"
9543 [(set (match_operand:V16QI 0 "register_operand" "=v")
9547 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9549 (match_operand:V16QI 2 "vector_move_operand" "0C")
9550 (parallel [(const_int 0) (const_int 1)
9551 (const_int 2) (const_int 3)
9552 (const_int 4) (const_int 5)
9553 (const_int 6) (const_int 7)]))
9554 (match_operand:QI 3 "register_operand" "Yk"))
9555 (const_vector:V8QI [(const_int 0) (const_int 0)
9556 (const_int 0) (const_int 0)
9557 (const_int 0) (const_int 0)
9558 (const_int 0) (const_int 0)])))]
9560 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9561 [(set_attr "type" "ssemov")
9562 (set_attr "prefix" "evex")
9563 (set_attr "mode" "TI")])
9565 (define_insn "*avx512vl_<code><mode>v8qi2_mask_1"
9566 [(set (match_operand:V16QI 0 "register_operand" "=v")
9570 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9571 (const_vector:V8QI [(const_int 0) (const_int 0)
9572 (const_int 0) (const_int 0)
9573 (const_int 0) (const_int 0)
9574 (const_int 0) (const_int 0)])
9575 (match_operand:QI 2 "register_operand" "Yk"))
9576 (const_vector:V8QI [(const_int 0) (const_int 0)
9577 (const_int 0) (const_int 0)
9578 (const_int 0) (const_int 0)
9579 (const_int 0) (const_int 0)])))]
9581 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9582 [(set_attr "type" "ssemov")
9583 (set_attr "prefix" "evex")
9584 (set_attr "mode" "TI")])
9586 (define_insn "avx512vl_<code><mode>v8qi2_mask_store"
9587 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9591 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9594 (parallel [(const_int 0) (const_int 1)
9595 (const_int 2) (const_int 3)
9596 (const_int 4) (const_int 5)
9597 (const_int 6) (const_int 7)]))
9598 (match_operand:QI 2 "register_operand" "Yk"))
9601 (parallel [(const_int 8) (const_int 9)
9602 (const_int 10) (const_int 11)
9603 (const_int 12) (const_int 13)
9604 (const_int 14) (const_int 15)]))))]
9607 if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 4)
9608 return "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}|%0%{%2%}, %g1}";
9609 return "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
9611 [(set_attr "type" "ssemov")
9612 (set_attr "memory" "store")
9613 (set_attr "prefix" "evex")
9614 (set_attr "mode" "TI")])
9616 (define_mode_iterator PMOV_SRC_MODE_4 [V4DI V2DI V4SI])
9617 (define_mode_attr pmov_dst_4
9618 [(V4DI "V4HI") (V2DI "V2HI") (V4SI "V4HI")])
9619 (define_mode_attr pmov_dst_zeroed_4
9620 [(V4DI "V4HI") (V2DI "V6HI") (V4SI "V4HI")])
9621 (define_mode_attr pmov_suff_4
9622 [(V4DI "qw") (V2DI "qw") (V4SI "dw")])
9624 (define_insn "*avx512vl_<code><mode>v<ssescalarnum>hi2"
9625 [(set (match_operand:V8HI 0 "register_operand" "=v")
9627 (any_truncate:<pmov_dst_4>
9628 (match_operand:PMOV_SRC_MODE_4 1 "register_operand" "v"))
9629 (match_operand:<pmov_dst_zeroed_4> 2 "const0_operand")))]
9631 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0|%0, %1}"
9632 [(set_attr "type" "ssemov")
9633 (set_attr "prefix" "evex")
9634 (set_attr "mode" "TI")])
9636 (define_insn "*avx512vl_<code><mode>v4hi2_store"
9637 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9640 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9643 (parallel [(const_int 4) (const_int 5)
9644 (const_int 6) (const_int 7)]))))]
9646 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0|%0, %1}"
9647 [(set_attr "type" "ssemov")
9648 (set_attr "memory" "store")
9649 (set_attr "prefix" "evex")
9650 (set_attr "mode" "TI")])
9652 (define_insn "avx512vl_<code><mode>v4hi2_mask"
9653 [(set (match_operand:V8HI 0 "register_operand" "=v")
9657 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9659 (match_operand:V8HI 2 "vector_move_operand" "0C")
9660 (parallel [(const_int 0) (const_int 1)
9661 (const_int 2) (const_int 3)]))
9662 (match_operand:QI 3 "register_operand" "Yk"))
9663 (const_vector:V4HI [(const_int 0) (const_int 0)
9664 (const_int 0) (const_int 0)])))]
9666 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9667 [(set_attr "type" "ssemov")
9668 (set_attr "prefix" "evex")
9669 (set_attr "mode" "TI")])
9671 (define_insn "*avx512vl_<code><mode>v4hi2_mask_1"
9672 [(set (match_operand:V8HI 0 "register_operand" "=v")
9676 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9677 (const_vector:V4HI [(const_int 0) (const_int 0)
9678 (const_int 0) (const_int 0)])
9679 (match_operand:QI 2 "register_operand" "Yk"))
9680 (const_vector:V4HI [(const_int 0) (const_int 0)
9681 (const_int 0) (const_int 0)])))]
9683 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9684 [(set_attr "type" "ssemov")
9685 (set_attr "prefix" "evex")
9686 (set_attr "mode" "TI")])
9688 (define_insn "avx512vl_<code><mode>v4hi2_mask_store"
9689 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9693 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9696 (parallel [(const_int 0) (const_int 1)
9697 (const_int 2) (const_int 3)]))
9698 (match_operand:QI 2 "register_operand" "Yk"))
9701 (parallel [(const_int 4) (const_int 5)
9702 (const_int 6) (const_int 7)]))))]
9705 if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 4)
9706 return "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%2%}|%0%{%2%}, %t1}";
9707 return "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%2%}|%0%{%2%}, %g1}";
9709 [(set_attr "type" "ssemov")
9710 (set_attr "memory" "store")
9711 (set_attr "prefix" "evex")
9712 (set_attr "mode" "TI")])
9714 (define_insn "*avx512vl_<code>v2div2hi2_store"
9715 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9718 (match_operand:V2DI 1 "register_operand" "v"))
9721 (parallel [(const_int 2) (const_int 3)
9722 (const_int 4) (const_int 5)
9723 (const_int 6) (const_int 7)]))))]
9725 "vpmov<trunsuffix>qw\t{%1, %0|%0, %1}"
9726 [(set_attr "type" "ssemov")
9727 (set_attr "memory" "store")
9728 (set_attr "prefix" "evex")
9729 (set_attr "mode" "TI")])
9731 (define_insn "avx512vl_<code>v2div2hi2_mask"
9732 [(set (match_operand:V8HI 0 "register_operand" "=v")
9736 (match_operand:V2DI 1 "register_operand" "v"))
9738 (match_operand:V8HI 2 "vector_move_operand" "0C")
9739 (parallel [(const_int 0) (const_int 1)]))
9740 (match_operand:QI 3 "register_operand" "Yk"))
9741 (const_vector:V6HI [(const_int 0) (const_int 0)
9742 (const_int 0) (const_int 0)
9743 (const_int 0) (const_int 0)])))]
9745 "vpmov<trunsuffix>qw\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9746 [(set_attr "type" "ssemov")
9747 (set_attr "prefix" "evex")
9748 (set_attr "mode" "TI")])
9750 (define_insn "*avx512vl_<code>v2div2hi2_mask_1"
9751 [(set (match_operand:V8HI 0 "register_operand" "=v")
9755 (match_operand:V2DI 1 "register_operand" "v"))
9756 (const_vector:V2HI [(const_int 0) (const_int 0)])
9757 (match_operand:QI 2 "register_operand" "Yk"))
9758 (const_vector:V6HI [(const_int 0) (const_int 0)
9759 (const_int 0) (const_int 0)
9760 (const_int 0) (const_int 0)])))]
9762 "vpmov<trunsuffix>qw\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9763 [(set_attr "type" "ssemov")
9764 (set_attr "prefix" "evex")
9765 (set_attr "mode" "TI")])
9767 (define_insn "avx512vl_<code>v2div2hi2_mask_store"
9768 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9772 (match_operand:V2DI 1 "register_operand" "v"))
9775 (parallel [(const_int 0) (const_int 1)]))
9776 (match_operand:QI 2 "register_operand" "Yk"))
9779 (parallel [(const_int 2) (const_int 3)
9780 (const_int 4) (const_int 5)
9781 (const_int 6) (const_int 7)]))))]
9783 "vpmov<trunsuffix>qw\t{%1, %0%{%2%}|%0%{%2%}, %g1}"
9784 [(set_attr "type" "ssemov")
9785 (set_attr "memory" "store")
9786 (set_attr "prefix" "evex")
9787 (set_attr "mode" "TI")])
9789 (define_insn "*avx512vl_<code>v2div2si2"
9790 [(set (match_operand:V4SI 0 "register_operand" "=v")
9793 (match_operand:V2DI 1 "register_operand" "v"))
9794 (match_operand:V2SI 2 "const0_operand")))]
9796 "vpmov<trunsuffix>qd\t{%1, %0|%0, %1}"
9797 [(set_attr "type" "ssemov")
9798 (set_attr "prefix" "evex")
9799 (set_attr "mode" "TI")])
9801 (define_insn "*avx512vl_<code>v2div2si2_store"
9802 [(set (match_operand:V4SI 0 "memory_operand" "=m")
9805 (match_operand:V2DI 1 "register_operand" "v"))
9808 (parallel [(const_int 2) (const_int 3)]))))]
9810 "vpmov<trunsuffix>qd\t{%1, %0|%0, %1}"
9811 [(set_attr "type" "ssemov")
9812 (set_attr "memory" "store")
9813 (set_attr "prefix" "evex")
9814 (set_attr "mode" "TI")])
9816 (define_insn "avx512vl_<code>v2div2si2_mask"
9817 [(set (match_operand:V4SI 0 "register_operand" "=v")
9821 (match_operand:V2DI 1 "register_operand" "v"))
9823 (match_operand:V4SI 2 "vector_move_operand" "0C")
9824 (parallel [(const_int 0) (const_int 1)]))
9825 (match_operand:QI 3 "register_operand" "Yk"))
9826 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
9828 "vpmov<trunsuffix>qd\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9829 [(set_attr "type" "ssemov")
9830 (set_attr "prefix" "evex")
9831 (set_attr "mode" "TI")])
9833 (define_insn "*avx512vl_<code>v2div2si2_mask_1"
9834 [(set (match_operand:V4SI 0 "register_operand" "=v")
9838 (match_operand:V2DI 1 "register_operand" "v"))
9839 (const_vector:V2SI [(const_int 0) (const_int 0)])
9840 (match_operand:QI 2 "register_operand" "Yk"))
9841 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
9843 "vpmov<trunsuffix>qd\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9844 [(set_attr "type" "ssemov")
9845 (set_attr "prefix" "evex")
9846 (set_attr "mode" "TI")])
9848 (define_insn "avx512vl_<code>v2div2si2_mask_store"
9849 [(set (match_operand:V4SI 0 "memory_operand" "=m")
9853 (match_operand:V2DI 1 "register_operand" "v"))
9856 (parallel [(const_int 0) (const_int 1)]))
9857 (match_operand:QI 2 "register_operand" "Yk"))
9860 (parallel [(const_int 2) (const_int 3)]))))]
9862 "vpmov<trunsuffix>qd\t{%1, %0%{%2%}|%0%{%2%}, %t1}"
9863 [(set_attr "type" "ssemov")
9864 (set_attr "memory" "store")
9865 (set_attr "prefix" "evex")
9866 (set_attr "mode" "TI")])
9868 (define_insn "*avx512f_<code>v8div16qi2"
9869 [(set (match_operand:V16QI 0 "register_operand" "=v")
9872 (match_operand:V8DI 1 "register_operand" "v"))
9873 (const_vector:V8QI [(const_int 0) (const_int 0)
9874 (const_int 0) (const_int 0)
9875 (const_int 0) (const_int 0)
9876 (const_int 0) (const_int 0)])))]
9878 "vpmov<trunsuffix>qb\t{%1, %0|%0, %1}"
9879 [(set_attr "type" "ssemov")
9880 (set_attr "prefix" "evex")
9881 (set_attr "mode" "TI")])
9883 (define_insn "*avx512f_<code>v8div16qi2_store"
9884 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9887 (match_operand:V8DI 1 "register_operand" "v"))
9890 (parallel [(const_int 8) (const_int 9)
9891 (const_int 10) (const_int 11)
9892 (const_int 12) (const_int 13)
9893 (const_int 14) (const_int 15)]))))]
9895 "vpmov<trunsuffix>qb\t{%1, %0|%0, %1}"
9896 [(set_attr "type" "ssemov")
9897 (set_attr "memory" "store")
9898 (set_attr "prefix" "evex")
9899 (set_attr "mode" "TI")])
9901 (define_insn "avx512f_<code>v8div16qi2_mask"
9902 [(set (match_operand:V16QI 0 "register_operand" "=v")
9906 (match_operand:V8DI 1 "register_operand" "v"))
9908 (match_operand:V16QI 2 "vector_move_operand" "0C")
9909 (parallel [(const_int 0) (const_int 1)
9910 (const_int 2) (const_int 3)
9911 (const_int 4) (const_int 5)
9912 (const_int 6) (const_int 7)]))
9913 (match_operand:QI 3 "register_operand" "Yk"))
9914 (const_vector:V8QI [(const_int 0) (const_int 0)
9915 (const_int 0) (const_int 0)
9916 (const_int 0) (const_int 0)
9917 (const_int 0) (const_int 0)])))]
9919 "vpmov<trunsuffix>qb\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9920 [(set_attr "type" "ssemov")
9921 (set_attr "prefix" "evex")
9922 (set_attr "mode" "TI")])
9924 (define_insn "*avx512f_<code>v8div16qi2_mask_1"
9925 [(set (match_operand:V16QI 0 "register_operand" "=v")
9929 (match_operand:V8DI 1 "register_operand" "v"))
9930 (const_vector:V8QI [(const_int 0) (const_int 0)
9931 (const_int 0) (const_int 0)
9932 (const_int 0) (const_int 0)
9933 (const_int 0) (const_int 0)])
9934 (match_operand:QI 2 "register_operand" "Yk"))
9935 (const_vector:V8QI [(const_int 0) (const_int 0)
9936 (const_int 0) (const_int 0)
9937 (const_int 0) (const_int 0)
9938 (const_int 0) (const_int 0)])))]
9940 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9941 [(set_attr "type" "ssemov")
9942 (set_attr "prefix" "evex")
9943 (set_attr "mode" "TI")])
9945 (define_insn "avx512f_<code>v8div16qi2_mask_store"
9946 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9950 (match_operand:V8DI 1 "register_operand" "v"))
9953 (parallel [(const_int 0) (const_int 1)
9954 (const_int 2) (const_int 3)
9955 (const_int 4) (const_int 5)
9956 (const_int 6) (const_int 7)]))
9957 (match_operand:QI 2 "register_operand" "Yk"))
9960 (parallel [(const_int 8) (const_int 9)
9961 (const_int 10) (const_int 11)
9962 (const_int 12) (const_int 13)
9963 (const_int 14) (const_int 15)]))))]
9965 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}|%q0%{%2%}, %1}"
9966 [(set_attr "type" "ssemov")
9967 (set_attr "memory" "store")
9968 (set_attr "prefix" "evex")
9969 (set_attr "mode" "TI")])
9971 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9973 ;; Parallel integral arithmetic
9975 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9977 (define_expand "neg<mode>2"
9978 [(set (match_operand:VI_AVX2 0 "register_operand")
9981 (match_operand:VI_AVX2 1 "vector_operand")))]
9983 "operands[2] = force_reg (<MODE>mode, CONST0_RTX (<MODE>mode));")
9985 (define_expand "<plusminus_insn><mode>3"
9986 [(set (match_operand:VI_AVX2 0 "register_operand")
9988 (match_operand:VI_AVX2 1 "vector_operand")
9989 (match_operand:VI_AVX2 2 "vector_operand")))]
9991 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
9993 (define_expand "<plusminus_insn><mode>3_mask"
9994 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
9995 (vec_merge:VI48_AVX512VL
9996 (plusminus:VI48_AVX512VL
9997 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand")
9998 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand"))
9999 (match_operand:VI48_AVX512VL 3 "vector_move_operand")
10000 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
10002 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
10004 (define_expand "<plusminus_insn><mode>3_mask"
10005 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
10006 (vec_merge:VI12_AVX512VL
10007 (plusminus:VI12_AVX512VL
10008 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand")
10009 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand"))
10010 (match_operand:VI12_AVX512VL 3 "vector_move_operand")
10011 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
10013 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
10015 (define_insn "*<plusminus_insn><mode>3"
10016 [(set (match_operand:VI_AVX2 0 "register_operand" "=x,v")
10018 (match_operand:VI_AVX2 1 "vector_operand" "<comm>0,v")
10019 (match_operand:VI_AVX2 2 "vector_operand" "xBm,vm")))]
10020 "TARGET_SSE2 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
10022 p<plusminus_mnemonic><ssemodesuffix>\t{%2, %0|%0, %2}
10023 vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10024 [(set_attr "isa" "noavx,avx")
10025 (set_attr "type" "sseiadd")
10026 (set_attr "prefix_data16" "1,*")
10027 (set_attr "prefix" "<mask_prefix3>")
10028 (set_attr "mode" "<sseinsnmode>")])
10030 (define_insn "*<plusminus_insn><mode>3_mask"
10031 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
10032 (vec_merge:VI48_AVX512VL
10033 (plusminus:VI48_AVX512VL
10034 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "<comm>v")
10035 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm"))
10036 (match_operand:VI48_AVX512VL 3 "vector_move_operand" "0C")
10037 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
10038 "TARGET_AVX512F && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
10039 "vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
10040 [(set_attr "type" "sseiadd")
10041 (set_attr "prefix" "evex")
10042 (set_attr "mode" "<sseinsnmode>")])
10044 (define_insn "*<plusminus_insn><mode>3_mask"
10045 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
10046 (vec_merge:VI12_AVX512VL
10047 (plusminus:VI12_AVX512VL
10048 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "<comm>v")
10049 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm"))
10050 (match_operand:VI12_AVX512VL 3 "vector_move_operand" "0C")
10051 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
10052 "TARGET_AVX512BW && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
10053 "vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
10054 [(set_attr "type" "sseiadd")
10055 (set_attr "prefix" "evex")
10056 (set_attr "mode" "<sseinsnmode>")])
10058 (define_expand "<sse2_avx2>_<plusminus_insn><mode>3<mask_name>"
10059 [(set (match_operand:VI12_AVX2 0 "register_operand")
10060 (sat_plusminus:VI12_AVX2
10061 (match_operand:VI12_AVX2 1 "vector_operand")
10062 (match_operand:VI12_AVX2 2 "vector_operand")))]
10063 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10064 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
10066 (define_insn "*<sse2_avx2>_<plusminus_insn><mode>3<mask_name>"
10067 [(set (match_operand:VI12_AVX2 0 "register_operand" "=x,v")
10068 (sat_plusminus:VI12_AVX2
10069 (match_operand:VI12_AVX2 1 "vector_operand" "<comm>0,v")
10070 (match_operand:VI12_AVX2 2 "vector_operand" "xBm,vm")))]
10071 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>
10072 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
10074 p<plusminus_mnemonic><ssemodesuffix>\t{%2, %0|%0, %2}
10075 vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10076 [(set_attr "isa" "noavx,avx")
10077 (set_attr "type" "sseiadd")
10078 (set_attr "prefix_data16" "1,*")
10079 (set_attr "prefix" "orig,maybe_evex")
10080 (set_attr "mode" "TI")])
10082 (define_expand "mul<mode>3<mask_name>"
10083 [(set (match_operand:VI1_AVX512 0 "register_operand")
10084 (mult:VI1_AVX512 (match_operand:VI1_AVX512 1 "register_operand")
10085 (match_operand:VI1_AVX512 2 "register_operand")))]
10086 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10088 ix86_expand_vecop_qihi (MULT, operands[0], operands[1], operands[2]);
10092 (define_expand "mul<mode>3<mask_name>"
10093 [(set (match_operand:VI2_AVX2 0 "register_operand")
10094 (mult:VI2_AVX2 (match_operand:VI2_AVX2 1 "vector_operand")
10095 (match_operand:VI2_AVX2 2 "vector_operand")))]
10096 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10097 "ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);")
10099 (define_insn "*mul<mode>3<mask_name>"
10100 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,v")
10101 (mult:VI2_AVX2 (match_operand:VI2_AVX2 1 "vector_operand" "%0,v")
10102 (match_operand:VI2_AVX2 2 "vector_operand" "xBm,vm")))]
10103 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
10104 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10106 pmullw\t{%2, %0|%0, %2}
10107 vpmullw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10108 [(set_attr "isa" "noavx,avx")
10109 (set_attr "type" "sseimul")
10110 (set_attr "prefix_data16" "1,*")
10111 (set_attr "prefix" "orig,vex")
10112 (set_attr "mode" "<sseinsnmode>")])
10114 (define_expand "<s>mul<mode>3_highpart<mask_name>"
10115 [(set (match_operand:VI2_AVX2 0 "register_operand")
10117 (lshiftrt:<ssedoublemode>
10118 (mult:<ssedoublemode>
10119 (any_extend:<ssedoublemode>
10120 (match_operand:VI2_AVX2 1 "vector_operand"))
10121 (any_extend:<ssedoublemode>
10122 (match_operand:VI2_AVX2 2 "vector_operand")))
10125 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10126 "ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);")
10128 (define_insn "*<s>mul<mode>3_highpart<mask_name>"
10129 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,v")
10131 (lshiftrt:<ssedoublemode>
10132 (mult:<ssedoublemode>
10133 (any_extend:<ssedoublemode>
10134 (match_operand:VI2_AVX2 1 "vector_operand" "%0,v"))
10135 (any_extend:<ssedoublemode>
10136 (match_operand:VI2_AVX2 2 "vector_operand" "xBm,vm")))
10138 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
10139 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10141 pmulh<u>w\t{%2, %0|%0, %2}
10142 vpmulh<u>w\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10143 [(set_attr "isa" "noavx,avx")
10144 (set_attr "type" "sseimul")
10145 (set_attr "prefix_data16" "1,*")
10146 (set_attr "prefix" "orig,vex")
10147 (set_attr "mode" "<sseinsnmode>")])
10149 (define_expand "vec_widen_umult_even_v16si<mask_name>"
10150 [(set (match_operand:V8DI 0 "register_operand")
10154 (match_operand:V16SI 1 "nonimmediate_operand")
10155 (parallel [(const_int 0) (const_int 2)
10156 (const_int 4) (const_int 6)
10157 (const_int 8) (const_int 10)
10158 (const_int 12) (const_int 14)])))
10161 (match_operand:V16SI 2 "nonimmediate_operand")
10162 (parallel [(const_int 0) (const_int 2)
10163 (const_int 4) (const_int 6)
10164 (const_int 8) (const_int 10)
10165 (const_int 12) (const_int 14)])))))]
10167 "ix86_fixup_binary_operands_no_copy (MULT, V16SImode, operands);")
10169 (define_insn "*vec_widen_umult_even_v16si<mask_name>"
10170 [(set (match_operand:V8DI 0 "register_operand" "=v")
10174 (match_operand:V16SI 1 "nonimmediate_operand" "%v")
10175 (parallel [(const_int 0) (const_int 2)
10176 (const_int 4) (const_int 6)
10177 (const_int 8) (const_int 10)
10178 (const_int 12) (const_int 14)])))
10181 (match_operand:V16SI 2 "nonimmediate_operand" "vm")
10182 (parallel [(const_int 0) (const_int 2)
10183 (const_int 4) (const_int 6)
10184 (const_int 8) (const_int 10)
10185 (const_int 12) (const_int 14)])))))]
10186 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10187 "vpmuludq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10188 [(set_attr "type" "sseimul")
10189 (set_attr "prefix_extra" "1")
10190 (set_attr "prefix" "evex")
10191 (set_attr "mode" "XI")])
10193 (define_expand "vec_widen_umult_even_v8si<mask_name>"
10194 [(set (match_operand:V4DI 0 "register_operand")
10198 (match_operand:V8SI 1 "nonimmediate_operand")
10199 (parallel [(const_int 0) (const_int 2)
10200 (const_int 4) (const_int 6)])))
10203 (match_operand:V8SI 2 "nonimmediate_operand")
10204 (parallel [(const_int 0) (const_int 2)
10205 (const_int 4) (const_int 6)])))))]
10206 "TARGET_AVX2 && <mask_avx512vl_condition>"
10207 "ix86_fixup_binary_operands_no_copy (MULT, V8SImode, operands);")
10209 (define_insn "*vec_widen_umult_even_v8si<mask_name>"
10210 [(set (match_operand:V4DI 0 "register_operand" "=v")
10214 (match_operand:V8SI 1 "nonimmediate_operand" "%v")
10215 (parallel [(const_int 0) (const_int 2)
10216 (const_int 4) (const_int 6)])))
10219 (match_operand:V8SI 2 "nonimmediate_operand" "vm")
10220 (parallel [(const_int 0) (const_int 2)
10221 (const_int 4) (const_int 6)])))))]
10222 "TARGET_AVX2 && <mask_avx512vl_condition>
10223 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10224 "vpmuludq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10225 [(set_attr "type" "sseimul")
10226 (set_attr "prefix" "maybe_evex")
10227 (set_attr "mode" "OI")])
10229 (define_expand "vec_widen_umult_even_v4si<mask_name>"
10230 [(set (match_operand:V2DI 0 "register_operand")
10234 (match_operand:V4SI 1 "vector_operand")
10235 (parallel [(const_int 0) (const_int 2)])))
10238 (match_operand:V4SI 2 "vector_operand")
10239 (parallel [(const_int 0) (const_int 2)])))))]
10240 "TARGET_SSE2 && <mask_avx512vl_condition>"
10241 "ix86_fixup_binary_operands_no_copy (MULT, V4SImode, operands);")
10243 (define_insn "*vec_widen_umult_even_v4si<mask_name>"
10244 [(set (match_operand:V2DI 0 "register_operand" "=x,v")
10248 (match_operand:V4SI 1 "vector_operand" "%0,v")
10249 (parallel [(const_int 0) (const_int 2)])))
10252 (match_operand:V4SI 2 "vector_operand" "xBm,vm")
10253 (parallel [(const_int 0) (const_int 2)])))))]
10254 "TARGET_SSE2 && <mask_avx512vl_condition>
10255 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10257 pmuludq\t{%2, %0|%0, %2}
10258 vpmuludq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10259 [(set_attr "isa" "noavx,avx")
10260 (set_attr "type" "sseimul")
10261 (set_attr "prefix_data16" "1,*")
10262 (set_attr "prefix" "orig,maybe_evex")
10263 (set_attr "mode" "TI")])
10265 (define_expand "vec_widen_smult_even_v16si<mask_name>"
10266 [(set (match_operand:V8DI 0 "register_operand")
10270 (match_operand:V16SI 1 "nonimmediate_operand")
10271 (parallel [(const_int 0) (const_int 2)
10272 (const_int 4) (const_int 6)
10273 (const_int 8) (const_int 10)
10274 (const_int 12) (const_int 14)])))
10277 (match_operand:V16SI 2 "nonimmediate_operand")
10278 (parallel [(const_int 0) (const_int 2)
10279 (const_int 4) (const_int 6)
10280 (const_int 8) (const_int 10)
10281 (const_int 12) (const_int 14)])))))]
10283 "ix86_fixup_binary_operands_no_copy (MULT, V16SImode, operands);")
10285 (define_insn "*vec_widen_smult_even_v16si<mask_name>"
10286 [(set (match_operand:V8DI 0 "register_operand" "=v")
10290 (match_operand:V16SI 1 "nonimmediate_operand" "%v")
10291 (parallel [(const_int 0) (const_int 2)
10292 (const_int 4) (const_int 6)
10293 (const_int 8) (const_int 10)
10294 (const_int 12) (const_int 14)])))
10297 (match_operand:V16SI 2 "nonimmediate_operand" "vm")
10298 (parallel [(const_int 0) (const_int 2)
10299 (const_int 4) (const_int 6)
10300 (const_int 8) (const_int 10)
10301 (const_int 12) (const_int 14)])))))]
10302 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10303 "vpmuldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10304 [(set_attr "type" "sseimul")
10305 (set_attr "prefix_extra" "1")
10306 (set_attr "prefix" "evex")
10307 (set_attr "mode" "XI")])
10309 (define_expand "vec_widen_smult_even_v8si<mask_name>"
10310 [(set (match_operand:V4DI 0 "register_operand")
10314 (match_operand:V8SI 1 "nonimmediate_operand")
10315 (parallel [(const_int 0) (const_int 2)
10316 (const_int 4) (const_int 6)])))
10319 (match_operand:V8SI 2 "nonimmediate_operand")
10320 (parallel [(const_int 0) (const_int 2)
10321 (const_int 4) (const_int 6)])))))]
10322 "TARGET_AVX2 && <mask_avx512vl_condition>"
10323 "ix86_fixup_binary_operands_no_copy (MULT, V8SImode, operands);")
10325 (define_insn "*vec_widen_smult_even_v8si<mask_name>"
10326 [(set (match_operand:V4DI 0 "register_operand" "=v")
10330 (match_operand:V8SI 1 "nonimmediate_operand" "%v")
10331 (parallel [(const_int 0) (const_int 2)
10332 (const_int 4) (const_int 6)])))
10335 (match_operand:V8SI 2 "nonimmediate_operand" "vm")
10336 (parallel [(const_int 0) (const_int 2)
10337 (const_int 4) (const_int 6)])))))]
10338 "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10339 "vpmuldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10340 [(set_attr "type" "sseimul")
10341 (set_attr "prefix_extra" "1")
10342 (set_attr "prefix" "vex")
10343 (set_attr "mode" "OI")])
10345 (define_expand "sse4_1_mulv2siv2di3<mask_name>"
10346 [(set (match_operand:V2DI 0 "register_operand")
10350 (match_operand:V4SI 1 "vector_operand")
10351 (parallel [(const_int 0) (const_int 2)])))
10354 (match_operand:V4SI 2 "vector_operand")
10355 (parallel [(const_int 0) (const_int 2)])))))]
10356 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
10357 "ix86_fixup_binary_operands_no_copy (MULT, V4SImode, operands);")
10359 (define_insn "*sse4_1_mulv2siv2di3<mask_name>"
10360 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
10364 (match_operand:V4SI 1 "vector_operand" "%0,0,v")
10365 (parallel [(const_int 0) (const_int 2)])))
10368 (match_operand:V4SI 2 "vector_operand" "YrBm,*xBm,vm")
10369 (parallel [(const_int 0) (const_int 2)])))))]
10370 "TARGET_SSE4_1 && <mask_avx512vl_condition>
10371 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10373 pmuldq\t{%2, %0|%0, %2}
10374 pmuldq\t{%2, %0|%0, %2}
10375 vpmuldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10376 [(set_attr "isa" "noavx,noavx,avx")
10377 (set_attr "type" "sseimul")
10378 (set_attr "prefix_data16" "1,1,*")
10379 (set_attr "prefix_extra" "1")
10380 (set_attr "prefix" "orig,orig,vex")
10381 (set_attr "mode" "TI")])
10383 (define_insn "avx512bw_pmaddwd512<mode><mask_name>"
10384 [(set (match_operand:<sseunpackmode> 0 "register_operand" "=v")
10385 (unspec:<sseunpackmode>
10386 [(match_operand:VI2_AVX2 1 "register_operand" "v")
10387 (match_operand:VI2_AVX2 2 "nonimmediate_operand" "vm")]
10388 UNSPEC_PMADDWD512))]
10389 "TARGET_AVX512BW && <mask_mode512bit_condition>"
10390 "vpmaddwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}";
10391 [(set_attr "type" "sseiadd")
10392 (set_attr "prefix" "evex")
10393 (set_attr "mode" "XI")])
10395 (define_expand "avx2_pmaddwd"
10396 [(set (match_operand:V8SI 0 "register_operand")
10401 (match_operand:V16HI 1 "nonimmediate_operand")
10402 (parallel [(const_int 0) (const_int 2)
10403 (const_int 4) (const_int 6)
10404 (const_int 8) (const_int 10)
10405 (const_int 12) (const_int 14)])))
10408 (match_operand:V16HI 2 "nonimmediate_operand")
10409 (parallel [(const_int 0) (const_int 2)
10410 (const_int 4) (const_int 6)
10411 (const_int 8) (const_int 10)
10412 (const_int 12) (const_int 14)]))))
10415 (vec_select:V8HI (match_dup 1)
10416 (parallel [(const_int 1) (const_int 3)
10417 (const_int 5) (const_int 7)
10418 (const_int 9) (const_int 11)
10419 (const_int 13) (const_int 15)])))
10421 (vec_select:V8HI (match_dup 2)
10422 (parallel [(const_int 1) (const_int 3)
10423 (const_int 5) (const_int 7)
10424 (const_int 9) (const_int 11)
10425 (const_int 13) (const_int 15)]))))))]
10427 "ix86_fixup_binary_operands_no_copy (MULT, V16HImode, operands);")
10429 (define_insn "*avx2_pmaddwd"
10430 [(set (match_operand:V8SI 0 "register_operand" "=x,v")
10435 (match_operand:V16HI 1 "nonimmediate_operand" "%x,v")
10436 (parallel [(const_int 0) (const_int 2)
10437 (const_int 4) (const_int 6)
10438 (const_int 8) (const_int 10)
10439 (const_int 12) (const_int 14)])))
10442 (match_operand:V16HI 2 "nonimmediate_operand" "xm,vm")
10443 (parallel [(const_int 0) (const_int 2)
10444 (const_int 4) (const_int 6)
10445 (const_int 8) (const_int 10)
10446 (const_int 12) (const_int 14)]))))
10449 (vec_select:V8HI (match_dup 1)
10450 (parallel [(const_int 1) (const_int 3)
10451 (const_int 5) (const_int 7)
10452 (const_int 9) (const_int 11)
10453 (const_int 13) (const_int 15)])))
10455 (vec_select:V8HI (match_dup 2)
10456 (parallel [(const_int 1) (const_int 3)
10457 (const_int 5) (const_int 7)
10458 (const_int 9) (const_int 11)
10459 (const_int 13) (const_int 15)]))))))]
10460 "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10461 "vpmaddwd\t{%2, %1, %0|%0, %1, %2}"
10462 [(set_attr "type" "sseiadd")
10463 (set_attr "isa" "*,avx512bw")
10464 (set_attr "prefix" "vex,evex")
10465 (set_attr "mode" "OI")])
10467 (define_expand "sse2_pmaddwd"
10468 [(set (match_operand:V4SI 0 "register_operand")
10473 (match_operand:V8HI 1 "vector_operand")
10474 (parallel [(const_int 0) (const_int 2)
10475 (const_int 4) (const_int 6)])))
10478 (match_operand:V8HI 2 "vector_operand")
10479 (parallel [(const_int 0) (const_int 2)
10480 (const_int 4) (const_int 6)]))))
10483 (vec_select:V4HI (match_dup 1)
10484 (parallel [(const_int 1) (const_int 3)
10485 (const_int 5) (const_int 7)])))
10487 (vec_select:V4HI (match_dup 2)
10488 (parallel [(const_int 1) (const_int 3)
10489 (const_int 5) (const_int 7)]))))))]
10491 "ix86_fixup_binary_operands_no_copy (MULT, V8HImode, operands);")
10493 (define_insn "*sse2_pmaddwd"
10494 [(set (match_operand:V4SI 0 "register_operand" "=x,x,v")
10499 (match_operand:V8HI 1 "vector_operand" "%0,x,v")
10500 (parallel [(const_int 0) (const_int 2)
10501 (const_int 4) (const_int 6)])))
10504 (match_operand:V8HI 2 "vector_operand" "xBm,xm,vm")
10505 (parallel [(const_int 0) (const_int 2)
10506 (const_int 4) (const_int 6)]))))
10509 (vec_select:V4HI (match_dup 1)
10510 (parallel [(const_int 1) (const_int 3)
10511 (const_int 5) (const_int 7)])))
10513 (vec_select:V4HI (match_dup 2)
10514 (parallel [(const_int 1) (const_int 3)
10515 (const_int 5) (const_int 7)]))))))]
10516 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10518 pmaddwd\t{%2, %0|%0, %2}
10519 vpmaddwd\t{%2, %1, %0|%0, %1, %2}
10520 vpmaddwd\t{%2, %1, %0|%0, %1, %2}"
10521 [(set_attr "isa" "noavx,avx,avx512bw")
10522 (set_attr "type" "sseiadd")
10523 (set_attr "atom_unit" "simul")
10524 (set_attr "prefix_data16" "1,*,*")
10525 (set_attr "prefix" "orig,vex,evex")
10526 (set_attr "mode" "TI")])
10528 (define_insn "avx512dq_mul<mode>3<mask_name>"
10529 [(set (match_operand:VI8 0 "register_operand" "=v")
10531 (match_operand:VI8 1 "register_operand" "v")
10532 (match_operand:VI8 2 "nonimmediate_operand" "vm")))]
10533 "TARGET_AVX512DQ && <mask_mode512bit_condition>"
10534 "vpmullq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10535 [(set_attr "type" "sseimul")
10536 (set_attr "prefix" "evex")
10537 (set_attr "mode" "<sseinsnmode>")])
10539 (define_expand "mul<mode>3<mask_name>"
10540 [(set (match_operand:VI4_AVX512F 0 "register_operand")
10542 (match_operand:VI4_AVX512F 1 "general_vector_operand")
10543 (match_operand:VI4_AVX512F 2 "general_vector_operand")))]
10544 "TARGET_SSE2 && <mask_mode512bit_condition>"
10548 if (!vector_operand (operands[1], <MODE>mode))
10549 operands[1] = force_reg (<MODE>mode, operands[1]);
10550 if (!vector_operand (operands[2], <MODE>mode))
10551 operands[2] = force_reg (<MODE>mode, operands[2]);
10552 ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);
10556 ix86_expand_sse2_mulv4si3 (operands[0], operands[1], operands[2]);
10561 (define_insn "*<sse4_1_avx2>_mul<mode>3<mask_name>"
10562 [(set (match_operand:VI4_AVX512F 0 "register_operand" "=Yr,*x,v")
10564 (match_operand:VI4_AVX512F 1 "vector_operand" "%0,0,v")
10565 (match_operand:VI4_AVX512F 2 "vector_operand" "YrBm,*xBm,vm")))]
10566 "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
10567 && <mask_mode512bit_condition>"
10569 pmulld\t{%2, %0|%0, %2}
10570 pmulld\t{%2, %0|%0, %2}
10571 vpmulld\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10572 [(set_attr "isa" "noavx,noavx,avx")
10573 (set_attr "type" "sseimul")
10574 (set_attr "prefix_extra" "1")
10575 (set_attr "prefix" "<mask_prefix4>")
10576 (set_attr "btver2_decode" "vector,vector,vector")
10577 (set_attr "mode" "<sseinsnmode>")])
10579 (define_expand "mul<mode>3"
10580 [(set (match_operand:VI8_AVX2_AVX512F 0 "register_operand")
10581 (mult:VI8_AVX2_AVX512F
10582 (match_operand:VI8_AVX2_AVX512F 1 "register_operand")
10583 (match_operand:VI8_AVX2_AVX512F 2 "register_operand")))]
10586 ix86_expand_sse2_mulvxdi3 (operands[0], operands[1], operands[2]);
10590 (define_expand "vec_widen_<s>mult_hi_<mode>"
10591 [(match_operand:<sseunpackmode> 0 "register_operand")
10592 (any_extend:<sseunpackmode>
10593 (match_operand:VI124_AVX2 1 "register_operand"))
10594 (match_operand:VI124_AVX2 2 "register_operand")]
10597 ix86_expand_mul_widen_hilo (operands[0], operands[1], operands[2],
10602 (define_expand "vec_widen_<s>mult_lo_<mode>"
10603 [(match_operand:<sseunpackmode> 0 "register_operand")
10604 (any_extend:<sseunpackmode>
10605 (match_operand:VI124_AVX2 1 "register_operand"))
10606 (match_operand:VI124_AVX2 2 "register_operand")]
10609 ix86_expand_mul_widen_hilo (operands[0], operands[1], operands[2],
10614 ;; Most widen_<s>mult_even_<mode> can be handled directly from other
10615 ;; named patterns, but signed V4SI needs special help for plain SSE2.
10616 (define_expand "vec_widen_smult_even_v4si"
10617 [(match_operand:V2DI 0 "register_operand")
10618 (match_operand:V4SI 1 "vector_operand")
10619 (match_operand:V4SI 2 "vector_operand")]
10622 ix86_expand_mul_widen_evenodd (operands[0], operands[1], operands[2],
10627 (define_expand "vec_widen_<s>mult_odd_<mode>"
10628 [(match_operand:<sseunpackmode> 0 "register_operand")
10629 (any_extend:<sseunpackmode>
10630 (match_operand:VI4_AVX512F 1 "general_vector_operand"))
10631 (match_operand:VI4_AVX512F 2 "general_vector_operand")]
10634 ix86_expand_mul_widen_evenodd (operands[0], operands[1], operands[2],
10639 (define_mode_attr SDOT_PMADD_SUF
10640 [(V32HI "512v32hi") (V16HI "") (V8HI "")])
10642 (define_expand "sdot_prod<mode>"
10643 [(match_operand:<sseunpackmode> 0 "register_operand")
10644 (match_operand:VI2_AVX2 1 "register_operand")
10645 (match_operand:VI2_AVX2 2 "register_operand")
10646 (match_operand:<sseunpackmode> 3 "register_operand")]
10649 rtx t = gen_reg_rtx (<sseunpackmode>mode);
10650 emit_insn (gen_<sse2_avx2>_pmaddwd<SDOT_PMADD_SUF> (t, operands[1], operands[2]));
10651 emit_insn (gen_rtx_SET (operands[0],
10652 gen_rtx_PLUS (<sseunpackmode>mode,
10657 ;; Normally we use widen_mul_even/odd, but combine can't quite get it all
10658 ;; back together when madd is available.
10659 (define_expand "sdot_prodv4si"
10660 [(match_operand:V2DI 0 "register_operand")
10661 (match_operand:V4SI 1 "register_operand")
10662 (match_operand:V4SI 2 "register_operand")
10663 (match_operand:V2DI 3 "register_operand")]
10666 rtx t = gen_reg_rtx (V2DImode);
10667 emit_insn (gen_xop_pmacsdqh (t, operands[1], operands[2], operands[3]));
10668 emit_insn (gen_xop_pmacsdql (operands[0], operands[1], operands[2], t));
10672 (define_expand "usadv16qi"
10673 [(match_operand:V4SI 0 "register_operand")
10674 (match_operand:V16QI 1 "register_operand")
10675 (match_operand:V16QI 2 "vector_operand")
10676 (match_operand:V4SI 3 "vector_operand")]
10679 rtx t1 = gen_reg_rtx (V2DImode);
10680 rtx t2 = gen_reg_rtx (V4SImode);
10681 emit_insn (gen_sse2_psadbw (t1, operands[1], operands[2]));
10682 convert_move (t2, t1, 0);
10683 emit_insn (gen_addv4si3 (operands[0], t2, operands[3]));
10687 (define_expand "usadv32qi"
10688 [(match_operand:V8SI 0 "register_operand")
10689 (match_operand:V32QI 1 "register_operand")
10690 (match_operand:V32QI 2 "nonimmediate_operand")
10691 (match_operand:V8SI 3 "nonimmediate_operand")]
10694 rtx t1 = gen_reg_rtx (V4DImode);
10695 rtx t2 = gen_reg_rtx (V8SImode);
10696 emit_insn (gen_avx2_psadbw (t1, operands[1], operands[2]));
10697 convert_move (t2, t1, 0);
10698 emit_insn (gen_addv8si3 (operands[0], t2, operands[3]));
10702 (define_insn "<mask_codefor>ashr<mode>3<mask_name>"
10703 [(set (match_operand:VI248_AVX512BW_1 0 "register_operand" "=v,v")
10704 (ashiftrt:VI248_AVX512BW_1
10705 (match_operand:VI248_AVX512BW_1 1 "nonimmediate_operand" "v,vm")
10706 (match_operand:DI 2 "nonmemory_operand" "v,N")))]
10708 "vpsra<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10709 [(set_attr "type" "sseishft")
10710 (set (attr "length_immediate")
10711 (if_then_else (match_operand 2 "const_int_operand")
10713 (const_string "0")))
10714 (set_attr "mode" "<sseinsnmode>")])
10716 (define_insn "ashr<mode>3"
10717 [(set (match_operand:VI24_AVX2 0 "register_operand" "=x,x")
10718 (ashiftrt:VI24_AVX2
10719 (match_operand:VI24_AVX2 1 "register_operand" "0,x")
10720 (match_operand:DI 2 "nonmemory_operand" "xN,xN")))]
10723 psra<ssemodesuffix>\t{%2, %0|%0, %2}
10724 vpsra<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
10725 [(set_attr "isa" "noavx,avx")
10726 (set_attr "type" "sseishft")
10727 (set (attr "length_immediate")
10728 (if_then_else (match_operand 2 "const_int_operand")
10730 (const_string "0")))
10731 (set_attr "prefix_data16" "1,*")
10732 (set_attr "prefix" "orig,vex")
10733 (set_attr "mode" "<sseinsnmode>")])
10735 (define_insn "ashr<mode>3<mask_name>"
10736 [(set (match_operand:VI248_AVX512BW_AVX512VL 0 "register_operand" "=v,v")
10737 (ashiftrt:VI248_AVX512BW_AVX512VL
10738 (match_operand:VI248_AVX512BW_AVX512VL 1 "nonimmediate_operand" "v,vm")
10739 (match_operand:DI 2 "nonmemory_operand" "v,N")))]
10741 "vpsra<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10742 [(set_attr "type" "sseishft")
10743 (set (attr "length_immediate")
10744 (if_then_else (match_operand 2 "const_int_operand")
10746 (const_string "0")))
10747 (set_attr "mode" "<sseinsnmode>")])
10749 (define_insn "<mask_codefor><shift_insn><mode>3<mask_name>"
10750 [(set (match_operand:VI248_AVX512BW_2 0 "register_operand" "=v,v")
10751 (any_lshift:VI248_AVX512BW_2
10752 (match_operand:VI248_AVX512BW_2 1 "nonimmediate_operand" "v,vm")
10753 (match_operand:DI 2 "nonmemory_operand" "v,N")))]
10755 "vp<vshift><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10756 [(set_attr "type" "sseishft")
10757 (set (attr "length_immediate")
10758 (if_then_else (match_operand 2 "const_int_operand")
10760 (const_string "0")))
10761 (set_attr "mode" "<sseinsnmode>")])
10763 (define_insn "<shift_insn><mode>3"
10764 [(set (match_operand:VI248_AVX2 0 "register_operand" "=x,x")
10765 (any_lshift:VI248_AVX2
10766 (match_operand:VI248_AVX2 1 "register_operand" "0,x")
10767 (match_operand:DI 2 "nonmemory_operand" "xN,xN")))]
10770 p<vshift><ssemodesuffix>\t{%2, %0|%0, %2}
10771 vp<vshift><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
10772 [(set_attr "isa" "noavx,avx")
10773 (set_attr "type" "sseishft")
10774 (set (attr "length_immediate")
10775 (if_then_else (match_operand 2 "const_int_operand")
10777 (const_string "0")))
10778 (set_attr "prefix_data16" "1,*")
10779 (set_attr "prefix" "orig,vex")
10780 (set_attr "mode" "<sseinsnmode>")])
10782 (define_insn "<shift_insn><mode>3<mask_name>"
10783 [(set (match_operand:VI248_AVX512BW 0 "register_operand" "=v,v")
10784 (any_lshift:VI248_AVX512BW
10785 (match_operand:VI248_AVX512BW 1 "nonimmediate_operand" "v,m")
10786 (match_operand:DI 2 "nonmemory_operand" "vN,N")))]
10788 "vp<vshift><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10789 [(set_attr "type" "sseishft")
10790 (set (attr "length_immediate")
10791 (if_then_else (match_operand 2 "const_int_operand")
10793 (const_string "0")))
10794 (set_attr "mode" "<sseinsnmode>")])
10797 (define_expand "vec_shr_<mode>"
10798 [(set (match_dup 3)
10800 (match_operand:VI_128 1 "register_operand")
10801 (match_operand:SI 2 "const_0_to_255_mul_8_operand")))
10802 (set (match_operand:VI_128 0 "register_operand") (match_dup 4))]
10805 operands[1] = gen_lowpart (V1TImode, operands[1]);
10806 operands[3] = gen_reg_rtx (V1TImode);
10807 operands[4] = gen_lowpart (<MODE>mode, operands[3]);
10810 (define_insn "avx512bw_<shift_insn><mode>3"
10811 [(set (match_operand:VIMAX_AVX512VL 0 "register_operand" "=v")
10812 (any_lshift:VIMAX_AVX512VL
10813 (match_operand:VIMAX_AVX512VL 1 "nonimmediate_operand" "vm")
10814 (match_operand:SI 2 "const_0_to_255_mul_8_operand" "n")))]
10817 operands[2] = GEN_INT (INTVAL (operands[2]) / 8);
10818 return "vp<vshift>dq\t{%2, %1, %0|%0, %1, %2}";
10820 [(set_attr "type" "sseishft")
10821 (set_attr "length_immediate" "1")
10822 (set_attr "prefix" "maybe_evex")
10823 (set_attr "mode" "<sseinsnmode>")])
10825 (define_insn "<sse2_avx2>_<shift_insn><mode>3"
10826 [(set (match_operand:VIMAX_AVX2 0 "register_operand" "=x,v")
10827 (any_lshift:VIMAX_AVX2
10828 (match_operand:VIMAX_AVX2 1 "register_operand" "0,v")
10829 (match_operand:SI 2 "const_0_to_255_mul_8_operand" "n,n")))]
10832 operands[2] = GEN_INT (INTVAL (operands[2]) / 8);
10834 switch (which_alternative)
10837 return "p<vshift>dq\t{%2, %0|%0, %2}";
10839 return "vp<vshift>dq\t{%2, %1, %0|%0, %1, %2}";
10841 gcc_unreachable ();
10844 [(set_attr "isa" "noavx,avx")
10845 (set_attr "type" "sseishft")
10846 (set_attr "length_immediate" "1")
10847 (set_attr "atom_unit" "sishuf")
10848 (set_attr "prefix_data16" "1,*")
10849 (set_attr "prefix" "orig,vex")
10850 (set_attr "mode" "<sseinsnmode>")])
10852 (define_insn "<avx512>_<rotate>v<mode><mask_name>"
10853 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
10854 (any_rotate:VI48_AVX512VL
10855 (match_operand:VI48_AVX512VL 1 "register_operand" "v")
10856 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")))]
10858 "vp<rotate>v<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10859 [(set_attr "prefix" "evex")
10860 (set_attr "mode" "<sseinsnmode>")])
10862 (define_insn "<avx512>_<rotate><mode><mask_name>"
10863 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
10864 (any_rotate:VI48_AVX512VL
10865 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm")
10866 (match_operand:SI 2 "const_0_to_255_operand")))]
10868 "vp<rotate><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10869 [(set_attr "prefix" "evex")
10870 (set_attr "mode" "<sseinsnmode>")])
10872 (define_expand "<code><mode>3"
10873 [(set (match_operand:VI124_256_AVX512F_AVX512BW 0 "register_operand")
10874 (maxmin:VI124_256_AVX512F_AVX512BW
10875 (match_operand:VI124_256_AVX512F_AVX512BW 1 "nonimmediate_operand")
10876 (match_operand:VI124_256_AVX512F_AVX512BW 2 "nonimmediate_operand")))]
10878 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
10880 (define_insn "*avx2_<code><mode>3"
10881 [(set (match_operand:VI124_256 0 "register_operand" "=v")
10883 (match_operand:VI124_256 1 "nonimmediate_operand" "%v")
10884 (match_operand:VI124_256 2 "nonimmediate_operand" "vm")))]
10885 "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10886 "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
10887 [(set_attr "type" "sseiadd")
10888 (set_attr "prefix_extra" "1")
10889 (set_attr "prefix" "vex")
10890 (set_attr "mode" "OI")])
10892 (define_expand "<code><mode>3_mask"
10893 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
10894 (vec_merge:VI48_AVX512VL
10895 (maxmin:VI48_AVX512VL
10896 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand")
10897 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand"))
10898 (match_operand:VI48_AVX512VL 3 "vector_move_operand")
10899 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
10901 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
10903 (define_insn "*avx512f_<code><mode>3<mask_name>"
10904 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
10905 (maxmin:VI48_AVX512VL
10906 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "%v")
10907 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")))]
10908 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10909 "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10910 [(set_attr "type" "sseiadd")
10911 (set_attr "prefix_extra" "1")
10912 (set_attr "prefix" "maybe_evex")
10913 (set_attr "mode" "<sseinsnmode>")])
10915 (define_insn "<mask_codefor><code><mode>3<mask_name>"
10916 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
10917 (maxmin:VI12_AVX512VL
10918 (match_operand:VI12_AVX512VL 1 "register_operand" "v")
10919 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")))]
10921 "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10922 [(set_attr "type" "sseiadd")
10923 (set_attr "prefix" "evex")
10924 (set_attr "mode" "<sseinsnmode>")])
10926 (define_expand "<code><mode>3"
10927 [(set (match_operand:VI8_AVX2_AVX512F 0 "register_operand")
10928 (maxmin:VI8_AVX2_AVX512F
10929 (match_operand:VI8_AVX2_AVX512F 1 "register_operand")
10930 (match_operand:VI8_AVX2_AVX512F 2 "register_operand")))]
10934 && (<MODE>mode == V8DImode || TARGET_AVX512VL))
10935 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
10938 enum rtx_code code;
10943 xops[0] = operands[0];
10945 if (<CODE> == SMAX || <CODE> == UMAX)
10947 xops[1] = operands[1];
10948 xops[2] = operands[2];
10952 xops[1] = operands[2];
10953 xops[2] = operands[1];
10956 code = (<CODE> == UMAX || <CODE> == UMIN) ? GTU : GT;
10958 xops[3] = gen_rtx_fmt_ee (code, VOIDmode, operands[1], operands[2]);
10959 xops[4] = operands[1];
10960 xops[5] = operands[2];
10962 ok = ix86_expand_int_vcond (xops);
10968 (define_expand "<code><mode>3"
10969 [(set (match_operand:VI124_128 0 "register_operand")
10971 (match_operand:VI124_128 1 "vector_operand")
10972 (match_operand:VI124_128 2 "vector_operand")))]
10975 if (TARGET_SSE4_1 || <MODE>mode == V8HImode)
10976 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
10982 xops[0] = operands[0];
10983 operands[1] = force_reg (<MODE>mode, operands[1]);
10984 operands[2] = force_reg (<MODE>mode, operands[2]);
10986 if (<CODE> == SMAX)
10988 xops[1] = operands[1];
10989 xops[2] = operands[2];
10993 xops[1] = operands[2];
10994 xops[2] = operands[1];
10997 xops[3] = gen_rtx_GT (VOIDmode, operands[1], operands[2]);
10998 xops[4] = operands[1];
10999 xops[5] = operands[2];
11001 ok = ix86_expand_int_vcond (xops);
11007 (define_insn "*sse4_1_<code><mode>3<mask_name>"
11008 [(set (match_operand:VI14_128 0 "register_operand" "=Yr,*x,v")
11010 (match_operand:VI14_128 1 "vector_operand" "%0,0,v")
11011 (match_operand:VI14_128 2 "vector_operand" "YrBm,*xBm,vm")))]
11013 && <mask_mode512bit_condition>
11014 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11016 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
11017 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
11018 vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11019 [(set_attr "isa" "noavx,noavx,avx")
11020 (set_attr "type" "sseiadd")
11021 (set_attr "prefix_extra" "1,1,*")
11022 (set_attr "prefix" "orig,orig,vex")
11023 (set_attr "mode" "TI")])
11025 (define_insn "*<code>v8hi3"
11026 [(set (match_operand:V8HI 0 "register_operand" "=x,x,v")
11028 (match_operand:V8HI 1 "vector_operand" "%0,x,v")
11029 (match_operand:V8HI 2 "vector_operand" "xBm,xm,vm")))]
11030 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11032 p<maxmin_int>w\t{%2, %0|%0, %2}
11033 vp<maxmin_int>w\t{%2, %1, %0|%0, %1, %2}
11034 vp<maxmin_int>w\t{%2, %1, %0|%0, %1, %2}"
11035 [(set_attr "isa" "noavx,avx,avx512bw")
11036 (set_attr "type" "sseiadd")
11037 (set_attr "prefix_data16" "1,*,*")
11038 (set_attr "prefix_extra" "*,1,1")
11039 (set_attr "prefix" "orig,vex,evex")
11040 (set_attr "mode" "TI")])
11042 (define_expand "<code><mode>3"
11043 [(set (match_operand:VI124_128 0 "register_operand")
11045 (match_operand:VI124_128 1 "vector_operand")
11046 (match_operand:VI124_128 2 "vector_operand")))]
11049 if (TARGET_SSE4_1 || <MODE>mode == V16QImode)
11050 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
11051 else if (<CODE> == UMAX && <MODE>mode == V8HImode)
11053 rtx op0 = operands[0], op2 = operands[2], op3 = op0;
11054 operands[1] = force_reg (<MODE>mode, operands[1]);
11055 if (rtx_equal_p (op3, op2))
11056 op3 = gen_reg_rtx (V8HImode);
11057 emit_insn (gen_sse2_ussubv8hi3 (op3, operands[1], op2));
11058 emit_insn (gen_addv8hi3 (op0, op3, op2));
11066 operands[1] = force_reg (<MODE>mode, operands[1]);
11067 operands[2] = force_reg (<MODE>mode, operands[2]);
11069 xops[0] = operands[0];
11071 if (<CODE> == UMAX)
11073 xops[1] = operands[1];
11074 xops[2] = operands[2];
11078 xops[1] = operands[2];
11079 xops[2] = operands[1];
11082 xops[3] = gen_rtx_GTU (VOIDmode, operands[1], operands[2]);
11083 xops[4] = operands[1];
11084 xops[5] = operands[2];
11086 ok = ix86_expand_int_vcond (xops);
11092 (define_insn "*sse4_1_<code><mode>3<mask_name>"
11093 [(set (match_operand:VI24_128 0 "register_operand" "=Yr,*x,v")
11095 (match_operand:VI24_128 1 "vector_operand" "%0,0,v")
11096 (match_operand:VI24_128 2 "vector_operand" "YrBm,*xBm,vm")))]
11098 && <mask_mode512bit_condition>
11099 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11101 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
11102 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
11103 vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11104 [(set_attr "isa" "noavx,noavx,avx")
11105 (set_attr "type" "sseiadd")
11106 (set_attr "prefix_extra" "1,1,*")
11107 (set_attr "prefix" "orig,orig,vex")
11108 (set_attr "mode" "TI")])
11110 (define_insn "*<code>v16qi3"
11111 [(set (match_operand:V16QI 0 "register_operand" "=x,x,v")
11113 (match_operand:V16QI 1 "vector_operand" "%0,x,v")
11114 (match_operand:V16QI 2 "vector_operand" "xBm,xm,vm")))]
11115 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11117 p<maxmin_int>b\t{%2, %0|%0, %2}
11118 vp<maxmin_int>b\t{%2, %1, %0|%0, %1, %2}
11119 vp<maxmin_int>b\t{%2, %1, %0|%0, %1, %2}"
11120 [(set_attr "isa" "noavx,avx,avx512bw")
11121 (set_attr "type" "sseiadd")
11122 (set_attr "prefix_data16" "1,*,*")
11123 (set_attr "prefix_extra" "*,1,1")
11124 (set_attr "prefix" "orig,vex,evex")
11125 (set_attr "mode" "TI")])
11127 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11129 ;; Parallel integral comparisons
11131 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11133 (define_expand "avx2_eq<mode>3"
11134 [(set (match_operand:VI_256 0 "register_operand")
11136 (match_operand:VI_256 1 "nonimmediate_operand")
11137 (match_operand:VI_256 2 "nonimmediate_operand")))]
11139 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
11141 (define_insn "*avx2_eq<mode>3"
11142 [(set (match_operand:VI_256 0 "register_operand" "=x")
11144 (match_operand:VI_256 1 "nonimmediate_operand" "%x")
11145 (match_operand:VI_256 2 "nonimmediate_operand" "xm")))]
11146 "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11147 "vpcmpeq<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11148 [(set_attr "type" "ssecmp")
11149 (set_attr "prefix_extra" "1")
11150 (set_attr "prefix" "vex")
11151 (set_attr "mode" "OI")])
11153 (define_expand "<avx512>_eq<mode>3<mask_scalar_merge_name>"
11154 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
11155 (unspec:<avx512fmaskmode>
11156 [(match_operand:VI12_AVX512VL 1 "nonimmediate_operand")
11157 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand")]
11158 UNSPEC_MASKED_EQ))]
11160 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
11162 (define_expand "<avx512>_eq<mode>3<mask_scalar_merge_name>"
11163 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
11164 (unspec:<avx512fmaskmode>
11165 [(match_operand:VI48_AVX512VL 1 "nonimmediate_operand")
11166 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand")]
11167 UNSPEC_MASKED_EQ))]
11169 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
11171 (define_insn "<avx512>_eq<mode>3<mask_scalar_merge_name>_1"
11172 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11173 (unspec:<avx512fmaskmode>
11174 [(match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "%v")
11175 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")]
11176 UNSPEC_MASKED_EQ))]
11177 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11178 "vpcmpeq<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11179 [(set_attr "type" "ssecmp")
11180 (set_attr "prefix_extra" "1")
11181 (set_attr "prefix" "evex")
11182 (set_attr "mode" "<sseinsnmode>")])
11184 (define_insn "<avx512>_eq<mode>3<mask_scalar_merge_name>_1"
11185 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11186 (unspec:<avx512fmaskmode>
11187 [(match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "%v")
11188 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")]
11189 UNSPEC_MASKED_EQ))]
11190 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11191 "vpcmpeq<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11192 [(set_attr "type" "ssecmp")
11193 (set_attr "prefix_extra" "1")
11194 (set_attr "prefix" "evex")
11195 (set_attr "mode" "<sseinsnmode>")])
11197 (define_insn "*sse4_1_eqv2di3"
11198 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,x")
11200 (match_operand:V2DI 1 "vector_operand" "%0,0,x")
11201 (match_operand:V2DI 2 "vector_operand" "YrBm,*xBm,xm")))]
11202 "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11204 pcmpeqq\t{%2, %0|%0, %2}
11205 pcmpeqq\t{%2, %0|%0, %2}
11206 vpcmpeqq\t{%2, %1, %0|%0, %1, %2}"
11207 [(set_attr "isa" "noavx,noavx,avx")
11208 (set_attr "type" "ssecmp")
11209 (set_attr "prefix_extra" "1")
11210 (set_attr "prefix" "orig,orig,vex")
11211 (set_attr "mode" "TI")])
11213 (define_insn "*sse2_eq<mode>3"
11214 [(set (match_operand:VI124_128 0 "register_operand" "=x,x")
11216 (match_operand:VI124_128 1 "vector_operand" "%0,x")
11217 (match_operand:VI124_128 2 "vector_operand" "xBm,xm")))]
11218 "TARGET_SSE2 && !TARGET_XOP
11219 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11221 pcmpeq<ssemodesuffix>\t{%2, %0|%0, %2}
11222 vpcmpeq<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11223 [(set_attr "isa" "noavx,avx")
11224 (set_attr "type" "ssecmp")
11225 (set_attr "prefix_data16" "1,*")
11226 (set_attr "prefix" "orig,vex")
11227 (set_attr "mode" "TI")])
11229 (define_expand "sse2_eq<mode>3"
11230 [(set (match_operand:VI124_128 0 "register_operand")
11232 (match_operand:VI124_128 1 "vector_operand")
11233 (match_operand:VI124_128 2 "vector_operand")))]
11234 "TARGET_SSE2 && !TARGET_XOP "
11235 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
11237 (define_expand "sse4_1_eqv2di3"
11238 [(set (match_operand:V2DI 0 "register_operand")
11240 (match_operand:V2DI 1 "vector_operand")
11241 (match_operand:V2DI 2 "vector_operand")))]
11243 "ix86_fixup_binary_operands_no_copy (EQ, V2DImode, operands);")
11245 (define_insn "sse4_2_gtv2di3"
11246 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,x")
11248 (match_operand:V2DI 1 "register_operand" "0,0,x")
11249 (match_operand:V2DI 2 "vector_operand" "YrBm,*xBm,xm")))]
11252 pcmpgtq\t{%2, %0|%0, %2}
11253 pcmpgtq\t{%2, %0|%0, %2}
11254 vpcmpgtq\t{%2, %1, %0|%0, %1, %2}"
11255 [(set_attr "isa" "noavx,noavx,avx")
11256 (set_attr "type" "ssecmp")
11257 (set_attr "prefix_extra" "1")
11258 (set_attr "prefix" "orig,orig,vex")
11259 (set_attr "mode" "TI")])
11261 (define_insn "avx2_gt<mode>3"
11262 [(set (match_operand:VI_256 0 "register_operand" "=x")
11264 (match_operand:VI_256 1 "register_operand" "x")
11265 (match_operand:VI_256 2 "nonimmediate_operand" "xm")))]
11267 "vpcmpgt<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11268 [(set_attr "type" "ssecmp")
11269 (set_attr "prefix_extra" "1")
11270 (set_attr "prefix" "vex")
11271 (set_attr "mode" "OI")])
11273 (define_insn "<avx512>_gt<mode>3<mask_scalar_merge_name>"
11274 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11275 (unspec:<avx512fmaskmode>
11276 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
11277 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")] UNSPEC_MASKED_GT))]
11279 "vpcmpgt<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11280 [(set_attr "type" "ssecmp")
11281 (set_attr "prefix_extra" "1")
11282 (set_attr "prefix" "evex")
11283 (set_attr "mode" "<sseinsnmode>")])
11285 (define_insn "<avx512>_gt<mode>3<mask_scalar_merge_name>"
11286 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11287 (unspec:<avx512fmaskmode>
11288 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
11289 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")] UNSPEC_MASKED_GT))]
11291 "vpcmpgt<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11292 [(set_attr "type" "ssecmp")
11293 (set_attr "prefix_extra" "1")
11294 (set_attr "prefix" "evex")
11295 (set_attr "mode" "<sseinsnmode>")])
11297 (define_insn "sse2_gt<mode>3"
11298 [(set (match_operand:VI124_128 0 "register_operand" "=x,x")
11300 (match_operand:VI124_128 1 "register_operand" "0,x")
11301 (match_operand:VI124_128 2 "vector_operand" "xBm,xm")))]
11302 "TARGET_SSE2 && !TARGET_XOP"
11304 pcmpgt<ssemodesuffix>\t{%2, %0|%0, %2}
11305 vpcmpgt<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11306 [(set_attr "isa" "noavx,avx")
11307 (set_attr "type" "ssecmp")
11308 (set_attr "prefix_data16" "1,*")
11309 (set_attr "prefix" "orig,vex")
11310 (set_attr "mode" "TI")])
11312 (define_expand "vcond<V_512:mode><VI_AVX512BW:mode>"
11313 [(set (match_operand:V_512 0 "register_operand")
11314 (if_then_else:V_512
11315 (match_operator 3 ""
11316 [(match_operand:VI_AVX512BW 4 "nonimmediate_operand")
11317 (match_operand:VI_AVX512BW 5 "general_operand")])
11318 (match_operand:V_512 1)
11319 (match_operand:V_512 2)))]
11321 && (GET_MODE_NUNITS (<V_512:MODE>mode)
11322 == GET_MODE_NUNITS (<VI_AVX512BW:MODE>mode))"
11324 bool ok = ix86_expand_int_vcond (operands);
11329 (define_expand "vcond<V_256:mode><VI_256:mode>"
11330 [(set (match_operand:V_256 0 "register_operand")
11331 (if_then_else:V_256
11332 (match_operator 3 ""
11333 [(match_operand:VI_256 4 "nonimmediate_operand")
11334 (match_operand:VI_256 5 "general_operand")])
11335 (match_operand:V_256 1)
11336 (match_operand:V_256 2)))]
11338 && (GET_MODE_NUNITS (<V_256:MODE>mode)
11339 == GET_MODE_NUNITS (<VI_256:MODE>mode))"
11341 bool ok = ix86_expand_int_vcond (operands);
11346 (define_expand "vcond<V_128:mode><VI124_128:mode>"
11347 [(set (match_operand:V_128 0 "register_operand")
11348 (if_then_else:V_128
11349 (match_operator 3 ""
11350 [(match_operand:VI124_128 4 "vector_operand")
11351 (match_operand:VI124_128 5 "general_operand")])
11352 (match_operand:V_128 1)
11353 (match_operand:V_128 2)))]
11355 && (GET_MODE_NUNITS (<V_128:MODE>mode)
11356 == GET_MODE_NUNITS (<VI124_128:MODE>mode))"
11358 bool ok = ix86_expand_int_vcond (operands);
11363 (define_expand "vcond<VI8F_128:mode>v2di"
11364 [(set (match_operand:VI8F_128 0 "register_operand")
11365 (if_then_else:VI8F_128
11366 (match_operator 3 ""
11367 [(match_operand:V2DI 4 "vector_operand")
11368 (match_operand:V2DI 5 "general_operand")])
11369 (match_operand:VI8F_128 1)
11370 (match_operand:VI8F_128 2)))]
11373 bool ok = ix86_expand_int_vcond (operands);
11378 (define_expand "vcondu<V_512:mode><VI_AVX512BW:mode>"
11379 [(set (match_operand:V_512 0 "register_operand")
11380 (if_then_else:V_512
11381 (match_operator 3 ""
11382 [(match_operand:VI_AVX512BW 4 "nonimmediate_operand")
11383 (match_operand:VI_AVX512BW 5 "nonimmediate_operand")])
11384 (match_operand:V_512 1 "general_operand")
11385 (match_operand:V_512 2 "general_operand")))]
11387 && (GET_MODE_NUNITS (<V_512:MODE>mode)
11388 == GET_MODE_NUNITS (<VI_AVX512BW:MODE>mode))"
11390 bool ok = ix86_expand_int_vcond (operands);
11395 (define_expand "vcondu<V_256:mode><VI_256:mode>"
11396 [(set (match_operand:V_256 0 "register_operand")
11397 (if_then_else:V_256
11398 (match_operator 3 ""
11399 [(match_operand:VI_256 4 "nonimmediate_operand")
11400 (match_operand:VI_256 5 "nonimmediate_operand")])
11401 (match_operand:V_256 1 "general_operand")
11402 (match_operand:V_256 2 "general_operand")))]
11404 && (GET_MODE_NUNITS (<V_256:MODE>mode)
11405 == GET_MODE_NUNITS (<VI_256:MODE>mode))"
11407 bool ok = ix86_expand_int_vcond (operands);
11412 (define_expand "vcondu<V_128:mode><VI124_128:mode>"
11413 [(set (match_operand:V_128 0 "register_operand")
11414 (if_then_else:V_128
11415 (match_operator 3 ""
11416 [(match_operand:VI124_128 4 "vector_operand")
11417 (match_operand:VI124_128 5 "vector_operand")])
11418 (match_operand:V_128 1 "general_operand")
11419 (match_operand:V_128 2 "general_operand")))]
11421 && (GET_MODE_NUNITS (<V_128:MODE>mode)
11422 == GET_MODE_NUNITS (<VI124_128:MODE>mode))"
11424 bool ok = ix86_expand_int_vcond (operands);
11429 (define_expand "vcondu<VI8F_128:mode>v2di"
11430 [(set (match_operand:VI8F_128 0 "register_operand")
11431 (if_then_else:VI8F_128
11432 (match_operator 3 ""
11433 [(match_operand:V2DI 4 "vector_operand")
11434 (match_operand:V2DI 5 "vector_operand")])
11435 (match_operand:VI8F_128 1 "general_operand")
11436 (match_operand:VI8F_128 2 "general_operand")))]
11439 bool ok = ix86_expand_int_vcond (operands);
11444 (define_expand "vcondeq<VI8F_128:mode>v2di"
11445 [(set (match_operand:VI8F_128 0 "register_operand")
11446 (if_then_else:VI8F_128
11447 (match_operator 3 ""
11448 [(match_operand:V2DI 4 "vector_operand")
11449 (match_operand:V2DI 5 "general_operand")])
11450 (match_operand:VI8F_128 1)
11451 (match_operand:VI8F_128 2)))]
11454 bool ok = ix86_expand_int_vcond (operands);
11459 (define_mode_iterator VEC_PERM_AVX2
11460 [V16QI V8HI V4SI V2DI V4SF V2DF
11461 (V32QI "TARGET_AVX2") (V16HI "TARGET_AVX2")
11462 (V8SI "TARGET_AVX2") (V4DI "TARGET_AVX2")
11463 (V8SF "TARGET_AVX2") (V4DF "TARGET_AVX2")
11464 (V16SF "TARGET_AVX512F") (V8DF "TARGET_AVX512F")
11465 (V16SI "TARGET_AVX512F") (V8DI "TARGET_AVX512F")
11466 (V32HI "TARGET_AVX512BW") (V64QI "TARGET_AVX512VBMI")])
11468 (define_expand "vec_perm<mode>"
11469 [(match_operand:VEC_PERM_AVX2 0 "register_operand")
11470 (match_operand:VEC_PERM_AVX2 1 "register_operand")
11471 (match_operand:VEC_PERM_AVX2 2 "register_operand")
11472 (match_operand:<sseintvecmode> 3 "register_operand")]
11473 "TARGET_SSSE3 || TARGET_AVX || TARGET_XOP"
11475 ix86_expand_vec_perm (operands);
11479 (define_mode_iterator VEC_PERM_CONST
11480 [(V4SF "TARGET_SSE") (V4SI "TARGET_SSE")
11481 (V2DF "TARGET_SSE") (V2DI "TARGET_SSE")
11482 (V16QI "TARGET_SSE2") (V8HI "TARGET_SSE2")
11483 (V8SF "TARGET_AVX") (V4DF "TARGET_AVX")
11484 (V8SI "TARGET_AVX") (V4DI "TARGET_AVX")
11485 (V32QI "TARGET_AVX2") (V16HI "TARGET_AVX2")
11486 (V16SI "TARGET_AVX512F") (V8DI "TARGET_AVX512F")
11487 (V16SF "TARGET_AVX512F") (V8DF "TARGET_AVX512F")
11488 (V32HI "TARGET_AVX512BW") (V64QI "TARGET_AVX512BW")])
11490 (define_expand "vec_perm_const<mode>"
11491 [(match_operand:VEC_PERM_CONST 0 "register_operand")
11492 (match_operand:VEC_PERM_CONST 1 "register_operand")
11493 (match_operand:VEC_PERM_CONST 2 "register_operand")
11494 (match_operand:<sseintvecmode> 3)]
11497 if (ix86_expand_vec_perm_const (operands))
11503 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11505 ;; Parallel bitwise logical operations
11507 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11509 (define_expand "one_cmpl<mode>2"
11510 [(set (match_operand:VI 0 "register_operand")
11511 (xor:VI (match_operand:VI 1 "vector_operand")
11515 operands[2] = force_reg (<MODE>mode, CONSTM1_RTX (<MODE>mode));
11518 (define_expand "<sse2_avx2>_andnot<mode>3"
11519 [(set (match_operand:VI_AVX2 0 "register_operand")
11521 (not:VI_AVX2 (match_operand:VI_AVX2 1 "register_operand"))
11522 (match_operand:VI_AVX2 2 "vector_operand")))]
11525 (define_expand "<sse2_avx2>_andnot<mode>3_mask"
11526 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
11527 (vec_merge:VI48_AVX512VL
11530 (match_operand:VI48_AVX512VL 1 "register_operand"))
11531 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand"))
11532 (match_operand:VI48_AVX512VL 3 "vector_move_operand")
11533 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
11536 (define_expand "<sse2_avx2>_andnot<mode>3_mask"
11537 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
11538 (vec_merge:VI12_AVX512VL
11541 (match_operand:VI12_AVX512VL 1 "register_operand"))
11542 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand"))
11543 (match_operand:VI12_AVX512VL 3 "vector_move_operand")
11544 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
11547 (define_insn "*andnot<mode>3"
11548 [(set (match_operand:VI 0 "register_operand" "=x,x,v")
11550 (not:VI (match_operand:VI 1 "register_operand" "0,x,v"))
11551 (match_operand:VI 2 "vector_operand" "xBm,xm,vm")))]
11554 static char buf[64];
11557 const char *ssesuffix;
11559 switch (get_attr_mode (insn))
11562 gcc_assert (TARGET_AVX512F);
11565 gcc_assert (TARGET_AVX2);
11568 gcc_assert (TARGET_SSE2);
11570 switch (<MODE>mode)
11574 /* There is no vpandnb or vpandnw instruction, nor vpandn for
11575 512-bit vectors. Use vpandnq instead. */
11580 ssesuffix = "<ssemodesuffix>";
11586 ssesuffix = (TARGET_AVX512VL && which_alternative == 2
11587 ? "<ssemodesuffix>" : "");
11590 ssesuffix = TARGET_AVX512VL && which_alternative == 2 ? "q" : "";
11595 gcc_assert (TARGET_AVX512F);
11598 gcc_assert (TARGET_AVX);
11601 gcc_assert (TARGET_SSE);
11607 gcc_unreachable ();
11610 switch (which_alternative)
11613 ops = "%s%s\t{%%2, %%0|%%0, %%2}";
11617 ops = "v%s%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
11620 gcc_unreachable ();
11623 snprintf (buf, sizeof (buf), ops, tmp, ssesuffix);
11626 [(set_attr "isa" "noavx,avx,avx")
11627 (set_attr "type" "sselog")
11628 (set (attr "prefix_data16")
11630 (and (eq_attr "alternative" "0")
11631 (eq_attr "mode" "TI"))
11633 (const_string "*")))
11634 (set_attr "prefix" "orig,vex,evex")
11636 (cond [(and (match_test "<MODE_SIZE> == 16")
11637 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
11638 (const_string "<ssePSmode>")
11639 (match_test "TARGET_AVX2")
11640 (const_string "<sseinsnmode>")
11641 (match_test "TARGET_AVX")
11643 (match_test "<MODE_SIZE> > 16")
11644 (const_string "V8SF")
11645 (const_string "<sseinsnmode>"))
11646 (ior (not (match_test "TARGET_SSE2"))
11647 (match_test "optimize_function_for_size_p (cfun)"))
11648 (const_string "V4SF")
11650 (const_string "<sseinsnmode>")))])
11652 (define_insn "*andnot<mode>3_mask"
11653 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
11654 (vec_merge:VI48_AVX512VL
11657 (match_operand:VI48_AVX512VL 1 "register_operand" "v"))
11658 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm"))
11659 (match_operand:VI48_AVX512VL 3 "vector_move_operand" "0C")
11660 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
11662 "vpandn<ssemodesuffix>\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}";
11663 [(set_attr "type" "sselog")
11664 (set_attr "prefix" "evex")
11665 (set_attr "mode" "<sseinsnmode>")])
11667 (define_expand "<code><mode>3"
11668 [(set (match_operand:VI 0 "register_operand")
11670 (match_operand:VI 1 "nonimmediate_or_const_vector_operand")
11671 (match_operand:VI 2 "nonimmediate_or_const_vector_operand")))]
11674 ix86_expand_vector_logical_operator (<CODE>, <MODE>mode, operands);
11678 (define_insn "<mask_codefor><code><mode>3<mask_name>"
11679 [(set (match_operand:VI48_AVX_AVX512F 0 "register_operand" "=x,x,v")
11680 (any_logic:VI48_AVX_AVX512F
11681 (match_operand:VI48_AVX_AVX512F 1 "vector_operand" "%0,x,v")
11682 (match_operand:VI48_AVX_AVX512F 2 "vector_operand" "xBm,xm,vm")))]
11683 "TARGET_SSE && <mask_mode512bit_condition>
11684 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11686 static char buf[64];
11689 const char *ssesuffix;
11691 switch (get_attr_mode (insn))
11694 gcc_assert (TARGET_AVX512F);
11697 gcc_assert (TARGET_AVX2);
11700 gcc_assert (TARGET_SSE2);
11702 switch (<MODE>mode)
11706 ssesuffix = "<ssemodesuffix>";
11712 ssesuffix = (TARGET_AVX512VL
11713 && (<mask_applied> || which_alternative == 2)
11714 ? "<ssemodesuffix>" : "");
11717 gcc_unreachable ();
11722 gcc_assert (TARGET_AVX);
11725 gcc_assert (TARGET_SSE);
11731 gcc_unreachable ();
11734 switch (which_alternative)
11737 if (<mask_applied>)
11738 ops = "v%s%s\t{%%2, %%0, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%0, %%2}";
11740 ops = "%s%s\t{%%2, %%0|%%0, %%2}";
11744 ops = "v%s%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
11747 gcc_unreachable ();
11750 snprintf (buf, sizeof (buf), ops, tmp, ssesuffix);
11753 [(set_attr "isa" "noavx,avx,avx")
11754 (set_attr "type" "sselog")
11755 (set (attr "prefix_data16")
11757 (and (eq_attr "alternative" "0")
11758 (eq_attr "mode" "TI"))
11760 (const_string "*")))
11761 (set_attr "prefix" "<mask_prefix3>,evex")
11763 (cond [(and (match_test "<MODE_SIZE> == 16")
11764 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
11765 (const_string "<ssePSmode>")
11766 (match_test "TARGET_AVX2")
11767 (const_string "<sseinsnmode>")
11768 (match_test "TARGET_AVX")
11770 (match_test "<MODE_SIZE> > 16")
11771 (const_string "V8SF")
11772 (const_string "<sseinsnmode>"))
11773 (ior (not (match_test "TARGET_SSE2"))
11774 (match_test "optimize_function_for_size_p (cfun)"))
11775 (const_string "V4SF")
11777 (const_string "<sseinsnmode>")))])
11779 (define_insn "*<code><mode>3"
11780 [(set (match_operand:VI12_AVX_AVX512F 0 "register_operand" "=x,x,v")
11781 (any_logic:VI12_AVX_AVX512F
11782 (match_operand:VI12_AVX_AVX512F 1 "vector_operand" "%0,x,v")
11783 (match_operand:VI12_AVX_AVX512F 2 "vector_operand" "xBm,xm,vm")))]
11784 "TARGET_SSE && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11786 static char buf[64];
11789 const char *ssesuffix;
11791 switch (get_attr_mode (insn))
11794 gcc_assert (TARGET_AVX512F);
11797 gcc_assert (TARGET_AVX2);
11800 gcc_assert (TARGET_SSE2);
11802 switch (<MODE>mode)
11812 ssesuffix = TARGET_AVX512VL && which_alternative == 2 ? "q" : "";
11815 gcc_unreachable ();
11820 gcc_assert (TARGET_AVX);
11823 gcc_assert (TARGET_SSE);
11829 gcc_unreachable ();
11832 switch (which_alternative)
11835 ops = "%s%s\t{%%2, %%0|%%0, %%2}";
11839 ops = "v%s%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
11842 gcc_unreachable ();
11845 snprintf (buf, sizeof (buf), ops, tmp, ssesuffix);
11848 [(set_attr "isa" "noavx,avx,avx")
11849 (set_attr "type" "sselog")
11850 (set (attr "prefix_data16")
11852 (and (eq_attr "alternative" "0")
11853 (eq_attr "mode" "TI"))
11855 (const_string "*")))
11856 (set_attr "prefix" "<mask_prefix3>,evex")
11858 (cond [(and (match_test "<MODE_SIZE> == 16")
11859 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
11860 (const_string "<ssePSmode>")
11861 (match_test "TARGET_AVX2")
11862 (const_string "<sseinsnmode>")
11863 (match_test "TARGET_AVX")
11865 (match_test "<MODE_SIZE> > 16")
11866 (const_string "V8SF")
11867 (const_string "<sseinsnmode>"))
11868 (ior (not (match_test "TARGET_SSE2"))
11869 (match_test "optimize_function_for_size_p (cfun)"))
11870 (const_string "V4SF")
11872 (const_string "<sseinsnmode>")))])
11874 (define_insn "<avx512>_testm<mode>3<mask_scalar_merge_name>"
11875 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11876 (unspec:<avx512fmaskmode>
11877 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
11878 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")]
11881 "vptestm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11882 [(set_attr "prefix" "evex")
11883 (set_attr "mode" "<sseinsnmode>")])
11885 (define_insn "<avx512>_testm<mode>3<mask_scalar_merge_name>"
11886 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11887 (unspec:<avx512fmaskmode>
11888 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
11889 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")]
11892 "vptestm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11893 [(set_attr "prefix" "evex")
11894 (set_attr "mode" "<sseinsnmode>")])
11896 (define_insn "<avx512>_testnm<mode>3<mask_scalar_merge_name>"
11897 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11898 (unspec:<avx512fmaskmode>
11899 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
11900 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")]
11903 "vptestnm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11904 [(set_attr "prefix" "evex")
11905 (set_attr "mode" "<sseinsnmode>")])
11907 (define_insn "<avx512>_testnm<mode>3<mask_scalar_merge_name>"
11908 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11909 (unspec:<avx512fmaskmode>
11910 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
11911 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")]
11914 "vptestnm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11915 [(set_attr "prefix" "evex")
11916 (set_attr "mode" "<sseinsnmode>")])
11918 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11920 ;; Parallel integral element swizzling
11922 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11924 (define_expand "vec_pack_trunc_<mode>"
11925 [(match_operand:<ssepackmode> 0 "register_operand")
11926 (match_operand:VI248_AVX2_8_AVX512F_24_AVX512BW 1 "register_operand")
11927 (match_operand:VI248_AVX2_8_AVX512F_24_AVX512BW 2 "register_operand")]
11930 rtx op1 = gen_lowpart (<ssepackmode>mode, operands[1]);
11931 rtx op2 = gen_lowpart (<ssepackmode>mode, operands[2]);
11932 ix86_expand_vec_extract_even_odd (operands[0], op1, op2, 0);
11936 (define_expand "vec_pack_trunc_qi"
11937 [(set (match_operand:HI 0 ("register_operand"))
11938 (ior:HI (ashift:HI (zero_extend:HI (match_operand:QI 2 ("register_operand")))
11940 (zero_extend:HI (match_operand:QI 1 ("register_operand")))))]
11943 (define_expand "vec_pack_trunc_<mode>"
11944 [(set (match_operand:<DOUBLEMASKMODE> 0 ("register_operand"))
11945 (ior:<DOUBLEMASKMODE> (ashift:<DOUBLEMASKMODE> (zero_extend:<DOUBLEMASKMODE> (match_operand:SWI24 2 ("register_operand")))
11947 (zero_extend:<DOUBLEMASKMODE> (match_operand:SWI24 1 ("register_operand")))))]
11950 operands[3] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
11953 (define_insn "<sse2_avx2>_packsswb<mask_name>"
11954 [(set (match_operand:VI1_AVX512 0 "register_operand" "=x,x,v")
11955 (vec_concat:VI1_AVX512
11956 (ss_truncate:<ssehalfvecmode>
11957 (match_operand:<sseunpackmode> 1 "register_operand" "0,x,v"))
11958 (ss_truncate:<ssehalfvecmode>
11959 (match_operand:<sseunpackmode> 2 "vector_operand" "xBm,xm,vm"))))]
11960 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
11962 packsswb\t{%2, %0|%0, %2}
11963 vpacksswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
11964 vpacksswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11965 [(set_attr "isa" "noavx,avx,avx512bw")
11966 (set_attr "type" "sselog")
11967 (set_attr "prefix_data16" "1,*,*")
11968 (set_attr "prefix" "orig,<mask_prefix>,evex")
11969 (set_attr "mode" "<sseinsnmode>")])
11971 (define_insn "<sse2_avx2>_packssdw<mask_name>"
11972 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,x,v")
11973 (vec_concat:VI2_AVX2
11974 (ss_truncate:<ssehalfvecmode>
11975 (match_operand:<sseunpackmode> 1 "register_operand" "0,x,v"))
11976 (ss_truncate:<ssehalfvecmode>
11977 (match_operand:<sseunpackmode> 2 "vector_operand" "xBm,xm,vm"))))]
11978 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
11980 packssdw\t{%2, %0|%0, %2}
11981 vpackssdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
11982 vpackssdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11983 [(set_attr "isa" "noavx,avx,avx512bw")
11984 (set_attr "type" "sselog")
11985 (set_attr "prefix_data16" "1,*,*")
11986 (set_attr "prefix" "orig,<mask_prefix>,evex")
11987 (set_attr "mode" "<sseinsnmode>")])
11989 (define_insn "<sse2_avx2>_packuswb<mask_name>"
11990 [(set (match_operand:VI1_AVX512 0 "register_operand" "=x,x,v")
11991 (vec_concat:VI1_AVX512
11992 (us_truncate:<ssehalfvecmode>
11993 (match_operand:<sseunpackmode> 1 "register_operand" "0,x,v"))
11994 (us_truncate:<ssehalfvecmode>
11995 (match_operand:<sseunpackmode> 2 "vector_operand" "xBm,xm,vm"))))]
11996 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
11998 packuswb\t{%2, %0|%0, %2}
11999 vpackuswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
12000 vpackuswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12001 [(set_attr "isa" "noavx,avx,avx512bw")
12002 (set_attr "type" "sselog")
12003 (set_attr "prefix_data16" "1,*,*")
12004 (set_attr "prefix" "orig,<mask_prefix>,evex")
12005 (set_attr "mode" "<sseinsnmode>")])
12007 (define_insn "avx512bw_interleave_highv64qi<mask_name>"
12008 [(set (match_operand:V64QI 0 "register_operand" "=v")
12011 (match_operand:V64QI 1 "register_operand" "v")
12012 (match_operand:V64QI 2 "nonimmediate_operand" "vm"))
12013 (parallel [(const_int 8) (const_int 72)
12014 (const_int 9) (const_int 73)
12015 (const_int 10) (const_int 74)
12016 (const_int 11) (const_int 75)
12017 (const_int 12) (const_int 76)
12018 (const_int 13) (const_int 77)
12019 (const_int 14) (const_int 78)
12020 (const_int 15) (const_int 79)
12021 (const_int 24) (const_int 88)
12022 (const_int 25) (const_int 89)
12023 (const_int 26) (const_int 90)
12024 (const_int 27) (const_int 91)
12025 (const_int 28) (const_int 92)
12026 (const_int 29) (const_int 93)
12027 (const_int 30) (const_int 94)
12028 (const_int 31) (const_int 95)
12029 (const_int 40) (const_int 104)
12030 (const_int 41) (const_int 105)
12031 (const_int 42) (const_int 106)
12032 (const_int 43) (const_int 107)
12033 (const_int 44) (const_int 108)
12034 (const_int 45) (const_int 109)
12035 (const_int 46) (const_int 110)
12036 (const_int 47) (const_int 111)
12037 (const_int 56) (const_int 120)
12038 (const_int 57) (const_int 121)
12039 (const_int 58) (const_int 122)
12040 (const_int 59) (const_int 123)
12041 (const_int 60) (const_int 124)
12042 (const_int 61) (const_int 125)
12043 (const_int 62) (const_int 126)
12044 (const_int 63) (const_int 127)])))]
12046 "vpunpckhbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12047 [(set_attr "type" "sselog")
12048 (set_attr "prefix" "evex")
12049 (set_attr "mode" "XI")])
12051 (define_insn "avx2_interleave_highv32qi<mask_name>"
12052 [(set (match_operand:V32QI 0 "register_operand" "=v")
12055 (match_operand:V32QI 1 "register_operand" "v")
12056 (match_operand:V32QI 2 "nonimmediate_operand" "vm"))
12057 (parallel [(const_int 8) (const_int 40)
12058 (const_int 9) (const_int 41)
12059 (const_int 10) (const_int 42)
12060 (const_int 11) (const_int 43)
12061 (const_int 12) (const_int 44)
12062 (const_int 13) (const_int 45)
12063 (const_int 14) (const_int 46)
12064 (const_int 15) (const_int 47)
12065 (const_int 24) (const_int 56)
12066 (const_int 25) (const_int 57)
12067 (const_int 26) (const_int 58)
12068 (const_int 27) (const_int 59)
12069 (const_int 28) (const_int 60)
12070 (const_int 29) (const_int 61)
12071 (const_int 30) (const_int 62)
12072 (const_int 31) (const_int 63)])))]
12073 "TARGET_AVX2 && <mask_avx512vl_condition>"
12074 "vpunpckhbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12075 [(set_attr "type" "sselog")
12076 (set_attr "prefix" "<mask_prefix>")
12077 (set_attr "mode" "OI")])
12079 (define_insn "vec_interleave_highv16qi<mask_name>"
12080 [(set (match_operand:V16QI 0 "register_operand" "=x,v")
12083 (match_operand:V16QI 1 "register_operand" "0,v")
12084 (match_operand:V16QI 2 "vector_operand" "xBm,vm"))
12085 (parallel [(const_int 8) (const_int 24)
12086 (const_int 9) (const_int 25)
12087 (const_int 10) (const_int 26)
12088 (const_int 11) (const_int 27)
12089 (const_int 12) (const_int 28)
12090 (const_int 13) (const_int 29)
12091 (const_int 14) (const_int 30)
12092 (const_int 15) (const_int 31)])))]
12093 "TARGET_SSE2 && <mask_avx512vl_condition>"
12095 punpckhbw\t{%2, %0|%0, %2}
12096 vpunpckhbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12097 [(set_attr "isa" "noavx,avx")
12098 (set_attr "type" "sselog")
12099 (set_attr "prefix_data16" "1,*")
12100 (set_attr "prefix" "orig,<mask_prefix>")
12101 (set_attr "mode" "TI")])
12103 (define_insn "avx512bw_interleave_lowv64qi<mask_name>"
12104 [(set (match_operand:V64QI 0 "register_operand" "=v")
12107 (match_operand:V64QI 1 "register_operand" "v")
12108 (match_operand:V64QI 2 "nonimmediate_operand" "vm"))
12109 (parallel [(const_int 0) (const_int 64)
12110 (const_int 1) (const_int 65)
12111 (const_int 2) (const_int 66)
12112 (const_int 3) (const_int 67)
12113 (const_int 4) (const_int 68)
12114 (const_int 5) (const_int 69)
12115 (const_int 6) (const_int 70)
12116 (const_int 7) (const_int 71)
12117 (const_int 16) (const_int 80)
12118 (const_int 17) (const_int 81)
12119 (const_int 18) (const_int 82)
12120 (const_int 19) (const_int 83)
12121 (const_int 20) (const_int 84)
12122 (const_int 21) (const_int 85)
12123 (const_int 22) (const_int 86)
12124 (const_int 23) (const_int 87)
12125 (const_int 32) (const_int 96)
12126 (const_int 33) (const_int 97)
12127 (const_int 34) (const_int 98)
12128 (const_int 35) (const_int 99)
12129 (const_int 36) (const_int 100)
12130 (const_int 37) (const_int 101)
12131 (const_int 38) (const_int 102)
12132 (const_int 39) (const_int 103)
12133 (const_int 48) (const_int 112)
12134 (const_int 49) (const_int 113)
12135 (const_int 50) (const_int 114)
12136 (const_int 51) (const_int 115)
12137 (const_int 52) (const_int 116)
12138 (const_int 53) (const_int 117)
12139 (const_int 54) (const_int 118)
12140 (const_int 55) (const_int 119)])))]
12142 "vpunpcklbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12143 [(set_attr "type" "sselog")
12144 (set_attr "prefix" "evex")
12145 (set_attr "mode" "XI")])
12147 (define_insn "avx2_interleave_lowv32qi<mask_name>"
12148 [(set (match_operand:V32QI 0 "register_operand" "=v")
12151 (match_operand:V32QI 1 "register_operand" "v")
12152 (match_operand:V32QI 2 "nonimmediate_operand" "vm"))
12153 (parallel [(const_int 0) (const_int 32)
12154 (const_int 1) (const_int 33)
12155 (const_int 2) (const_int 34)
12156 (const_int 3) (const_int 35)
12157 (const_int 4) (const_int 36)
12158 (const_int 5) (const_int 37)
12159 (const_int 6) (const_int 38)
12160 (const_int 7) (const_int 39)
12161 (const_int 16) (const_int 48)
12162 (const_int 17) (const_int 49)
12163 (const_int 18) (const_int 50)
12164 (const_int 19) (const_int 51)
12165 (const_int 20) (const_int 52)
12166 (const_int 21) (const_int 53)
12167 (const_int 22) (const_int 54)
12168 (const_int 23) (const_int 55)])))]
12169 "TARGET_AVX2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12170 "vpunpcklbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12171 [(set_attr "type" "sselog")
12172 (set_attr "prefix" "maybe_vex")
12173 (set_attr "mode" "OI")])
12175 (define_insn "vec_interleave_lowv16qi<mask_name>"
12176 [(set (match_operand:V16QI 0 "register_operand" "=x,v")
12179 (match_operand:V16QI 1 "register_operand" "0,v")
12180 (match_operand:V16QI 2 "vector_operand" "xBm,vm"))
12181 (parallel [(const_int 0) (const_int 16)
12182 (const_int 1) (const_int 17)
12183 (const_int 2) (const_int 18)
12184 (const_int 3) (const_int 19)
12185 (const_int 4) (const_int 20)
12186 (const_int 5) (const_int 21)
12187 (const_int 6) (const_int 22)
12188 (const_int 7) (const_int 23)])))]
12189 "TARGET_SSE2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12191 punpcklbw\t{%2, %0|%0, %2}
12192 vpunpcklbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12193 [(set_attr "isa" "noavx,avx")
12194 (set_attr "type" "sselog")
12195 (set_attr "prefix_data16" "1,*")
12196 (set_attr "prefix" "orig,vex")
12197 (set_attr "mode" "TI")])
12199 (define_insn "avx512bw_interleave_highv32hi<mask_name>"
12200 [(set (match_operand:V32HI 0 "register_operand" "=v")
12203 (match_operand:V32HI 1 "register_operand" "v")
12204 (match_operand:V32HI 2 "nonimmediate_operand" "vm"))
12205 (parallel [(const_int 4) (const_int 36)
12206 (const_int 5) (const_int 37)
12207 (const_int 6) (const_int 38)
12208 (const_int 7) (const_int 39)
12209 (const_int 12) (const_int 44)
12210 (const_int 13) (const_int 45)
12211 (const_int 14) (const_int 46)
12212 (const_int 15) (const_int 47)
12213 (const_int 20) (const_int 52)
12214 (const_int 21) (const_int 53)
12215 (const_int 22) (const_int 54)
12216 (const_int 23) (const_int 55)
12217 (const_int 28) (const_int 60)
12218 (const_int 29) (const_int 61)
12219 (const_int 30) (const_int 62)
12220 (const_int 31) (const_int 63)])))]
12222 "vpunpckhwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12223 [(set_attr "type" "sselog")
12224 (set_attr "prefix" "evex")
12225 (set_attr "mode" "XI")])
12227 (define_insn "avx2_interleave_highv16hi<mask_name>"
12228 [(set (match_operand:V16HI 0 "register_operand" "=v")
12231 (match_operand:V16HI 1 "register_operand" "v")
12232 (match_operand:V16HI 2 "nonimmediate_operand" "vm"))
12233 (parallel [(const_int 4) (const_int 20)
12234 (const_int 5) (const_int 21)
12235 (const_int 6) (const_int 22)
12236 (const_int 7) (const_int 23)
12237 (const_int 12) (const_int 28)
12238 (const_int 13) (const_int 29)
12239 (const_int 14) (const_int 30)
12240 (const_int 15) (const_int 31)])))]
12241 "TARGET_AVX2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12242 "vpunpckhwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12243 [(set_attr "type" "sselog")
12244 (set_attr "prefix" "maybe_evex")
12245 (set_attr "mode" "OI")])
12247 (define_insn "vec_interleave_highv8hi<mask_name>"
12248 [(set (match_operand:V8HI 0 "register_operand" "=x,v")
12251 (match_operand:V8HI 1 "register_operand" "0,v")
12252 (match_operand:V8HI 2 "vector_operand" "xBm,vm"))
12253 (parallel [(const_int 4) (const_int 12)
12254 (const_int 5) (const_int 13)
12255 (const_int 6) (const_int 14)
12256 (const_int 7) (const_int 15)])))]
12257 "TARGET_SSE2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12259 punpckhwd\t{%2, %0|%0, %2}
12260 vpunpckhwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12261 [(set_attr "isa" "noavx,avx")
12262 (set_attr "type" "sselog")
12263 (set_attr "prefix_data16" "1,*")
12264 (set_attr "prefix" "orig,maybe_vex")
12265 (set_attr "mode" "TI")])
12267 (define_insn "<mask_codefor>avx512bw_interleave_lowv32hi<mask_name>"
12268 [(set (match_operand:V32HI 0 "register_operand" "=v")
12271 (match_operand:V32HI 1 "register_operand" "v")
12272 (match_operand:V32HI 2 "nonimmediate_operand" "vm"))
12273 (parallel [(const_int 0) (const_int 32)
12274 (const_int 1) (const_int 33)
12275 (const_int 2) (const_int 34)
12276 (const_int 3) (const_int 35)
12277 (const_int 8) (const_int 40)
12278 (const_int 9) (const_int 41)
12279 (const_int 10) (const_int 42)
12280 (const_int 11) (const_int 43)
12281 (const_int 16) (const_int 48)
12282 (const_int 17) (const_int 49)
12283 (const_int 18) (const_int 50)
12284 (const_int 19) (const_int 51)
12285 (const_int 24) (const_int 56)
12286 (const_int 25) (const_int 57)
12287 (const_int 26) (const_int 58)
12288 (const_int 27) (const_int 59)])))]
12290 "vpunpcklwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12291 [(set_attr "type" "sselog")
12292 (set_attr "prefix" "evex")
12293 (set_attr "mode" "XI")])
12295 (define_insn "avx2_interleave_lowv16hi<mask_name>"
12296 [(set (match_operand:V16HI 0 "register_operand" "=v")
12299 (match_operand:V16HI 1 "register_operand" "v")
12300 (match_operand:V16HI 2 "nonimmediate_operand" "vm"))
12301 (parallel [(const_int 0) (const_int 16)
12302 (const_int 1) (const_int 17)
12303 (const_int 2) (const_int 18)
12304 (const_int 3) (const_int 19)
12305 (const_int 8) (const_int 24)
12306 (const_int 9) (const_int 25)
12307 (const_int 10) (const_int 26)
12308 (const_int 11) (const_int 27)])))]
12309 "TARGET_AVX2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12310 "vpunpcklwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12311 [(set_attr "type" "sselog")
12312 (set_attr "prefix" "maybe_evex")
12313 (set_attr "mode" "OI")])
12315 (define_insn "vec_interleave_lowv8hi<mask_name>"
12316 [(set (match_operand:V8HI 0 "register_operand" "=x,v")
12319 (match_operand:V8HI 1 "register_operand" "0,v")
12320 (match_operand:V8HI 2 "vector_operand" "xBm,vm"))
12321 (parallel [(const_int 0) (const_int 8)
12322 (const_int 1) (const_int 9)
12323 (const_int 2) (const_int 10)
12324 (const_int 3) (const_int 11)])))]
12325 "TARGET_SSE2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12327 punpcklwd\t{%2, %0|%0, %2}
12328 vpunpcklwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12329 [(set_attr "isa" "noavx,avx")
12330 (set_attr "type" "sselog")
12331 (set_attr "prefix_data16" "1,*")
12332 (set_attr "prefix" "orig,maybe_evex")
12333 (set_attr "mode" "TI")])
12335 (define_insn "avx2_interleave_highv8si<mask_name>"
12336 [(set (match_operand:V8SI 0 "register_operand" "=v")
12339 (match_operand:V8SI 1 "register_operand" "v")
12340 (match_operand:V8SI 2 "nonimmediate_operand" "vm"))
12341 (parallel [(const_int 2) (const_int 10)
12342 (const_int 3) (const_int 11)
12343 (const_int 6) (const_int 14)
12344 (const_int 7) (const_int 15)])))]
12345 "TARGET_AVX2 && <mask_avx512vl_condition>"
12346 "vpunpckhdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12347 [(set_attr "type" "sselog")
12348 (set_attr "prefix" "maybe_evex")
12349 (set_attr "mode" "OI")])
12351 (define_insn "<mask_codefor>avx512f_interleave_highv16si<mask_name>"
12352 [(set (match_operand:V16SI 0 "register_operand" "=v")
12355 (match_operand:V16SI 1 "register_operand" "v")
12356 (match_operand:V16SI 2 "nonimmediate_operand" "vm"))
12357 (parallel [(const_int 2) (const_int 18)
12358 (const_int 3) (const_int 19)
12359 (const_int 6) (const_int 22)
12360 (const_int 7) (const_int 23)
12361 (const_int 10) (const_int 26)
12362 (const_int 11) (const_int 27)
12363 (const_int 14) (const_int 30)
12364 (const_int 15) (const_int 31)])))]
12366 "vpunpckhdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12367 [(set_attr "type" "sselog")
12368 (set_attr "prefix" "evex")
12369 (set_attr "mode" "XI")])
12372 (define_insn "vec_interleave_highv4si<mask_name>"
12373 [(set (match_operand:V4SI 0 "register_operand" "=x,v")
12376 (match_operand:V4SI 1 "register_operand" "0,v")
12377 (match_operand:V4SI 2 "vector_operand" "xBm,vm"))
12378 (parallel [(const_int 2) (const_int 6)
12379 (const_int 3) (const_int 7)])))]
12380 "TARGET_SSE2 && <mask_avx512vl_condition>"
12382 punpckhdq\t{%2, %0|%0, %2}
12383 vpunpckhdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12384 [(set_attr "isa" "noavx,avx")
12385 (set_attr "type" "sselog")
12386 (set_attr "prefix_data16" "1,*")
12387 (set_attr "prefix" "orig,maybe_vex")
12388 (set_attr "mode" "TI")])
12390 (define_insn "avx2_interleave_lowv8si<mask_name>"
12391 [(set (match_operand:V8SI 0 "register_operand" "=v")
12394 (match_operand:V8SI 1 "register_operand" "v")
12395 (match_operand:V8SI 2 "nonimmediate_operand" "vm"))
12396 (parallel [(const_int 0) (const_int 8)
12397 (const_int 1) (const_int 9)
12398 (const_int 4) (const_int 12)
12399 (const_int 5) (const_int 13)])))]
12400 "TARGET_AVX2 && <mask_avx512vl_condition>"
12401 "vpunpckldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12402 [(set_attr "type" "sselog")
12403 (set_attr "prefix" "maybe_evex")
12404 (set_attr "mode" "OI")])
12406 (define_insn "<mask_codefor>avx512f_interleave_lowv16si<mask_name>"
12407 [(set (match_operand:V16SI 0 "register_operand" "=v")
12410 (match_operand:V16SI 1 "register_operand" "v")
12411 (match_operand:V16SI 2 "nonimmediate_operand" "vm"))
12412 (parallel [(const_int 0) (const_int 16)
12413 (const_int 1) (const_int 17)
12414 (const_int 4) (const_int 20)
12415 (const_int 5) (const_int 21)
12416 (const_int 8) (const_int 24)
12417 (const_int 9) (const_int 25)
12418 (const_int 12) (const_int 28)
12419 (const_int 13) (const_int 29)])))]
12421 "vpunpckldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12422 [(set_attr "type" "sselog")
12423 (set_attr "prefix" "evex")
12424 (set_attr "mode" "XI")])
12426 (define_insn "vec_interleave_lowv4si<mask_name>"
12427 [(set (match_operand:V4SI 0 "register_operand" "=x,v")
12430 (match_operand:V4SI 1 "register_operand" "0,v")
12431 (match_operand:V4SI 2 "vector_operand" "xBm,vm"))
12432 (parallel [(const_int 0) (const_int 4)
12433 (const_int 1) (const_int 5)])))]
12434 "TARGET_SSE2 && <mask_avx512vl_condition>"
12436 punpckldq\t{%2, %0|%0, %2}
12437 vpunpckldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12438 [(set_attr "isa" "noavx,avx")
12439 (set_attr "type" "sselog")
12440 (set_attr "prefix_data16" "1,*")
12441 (set_attr "prefix" "orig,vex")
12442 (set_attr "mode" "TI")])
12444 (define_expand "vec_interleave_high<mode>"
12445 [(match_operand:VI_256 0 "register_operand")
12446 (match_operand:VI_256 1 "register_operand")
12447 (match_operand:VI_256 2 "nonimmediate_operand")]
12450 rtx t1 = gen_reg_rtx (<MODE>mode);
12451 rtx t2 = gen_reg_rtx (<MODE>mode);
12452 rtx t3 = gen_reg_rtx (V4DImode);
12453 emit_insn (gen_avx2_interleave_low<mode> (t1, operands[1], operands[2]));
12454 emit_insn (gen_avx2_interleave_high<mode> (t2, operands[1], operands[2]));
12455 emit_insn (gen_avx2_permv2ti (t3, gen_lowpart (V4DImode, t1),
12456 gen_lowpart (V4DImode, t2),
12457 GEN_INT (1 + (3 << 4))));
12458 emit_move_insn (operands[0], gen_lowpart (<MODE>mode, t3));
12462 (define_expand "vec_interleave_low<mode>"
12463 [(match_operand:VI_256 0 "register_operand")
12464 (match_operand:VI_256 1 "register_operand")
12465 (match_operand:VI_256 2 "nonimmediate_operand")]
12468 rtx t1 = gen_reg_rtx (<MODE>mode);
12469 rtx t2 = gen_reg_rtx (<MODE>mode);
12470 rtx t3 = gen_reg_rtx (V4DImode);
12471 emit_insn (gen_avx2_interleave_low<mode> (t1, operands[1], operands[2]));
12472 emit_insn (gen_avx2_interleave_high<mode> (t2, operands[1], operands[2]));
12473 emit_insn (gen_avx2_permv2ti (t3, gen_lowpart (V4DImode, t1),
12474 gen_lowpart (V4DImode, t2),
12475 GEN_INT (0 + (2 << 4))));
12476 emit_move_insn (operands[0], gen_lowpart (<MODE>mode, t3));
12480 ;; Modes handled by pinsr patterns.
12481 (define_mode_iterator PINSR_MODE
12482 [(V16QI "TARGET_SSE4_1") V8HI
12483 (V4SI "TARGET_SSE4_1")
12484 (V2DI "TARGET_SSE4_1 && TARGET_64BIT")])
12486 (define_mode_attr sse2p4_1
12487 [(V16QI "sse4_1") (V8HI "sse2")
12488 (V4SI "sse4_1") (V2DI "sse4_1")])
12490 (define_mode_attr pinsr_evex_isa
12491 [(V16QI "avx512bw") (V8HI "avx512bw")
12492 (V4SI "avx512dq") (V2DI "avx512dq")])
12494 ;; sse4_1_pinsrd must come before sse2_loadld since it is preferred.
12495 (define_insn "<sse2p4_1>_pinsr<ssemodesuffix>"
12496 [(set (match_operand:PINSR_MODE 0 "register_operand" "=x,x,x,x,v,v")
12497 (vec_merge:PINSR_MODE
12498 (vec_duplicate:PINSR_MODE
12499 (match_operand:<ssescalarmode> 2 "nonimmediate_operand" "r,m,r,m,r,m"))
12500 (match_operand:PINSR_MODE 1 "register_operand" "0,0,x,x,v,v")
12501 (match_operand:SI 3 "const_int_operand")))]
12503 && ((unsigned) exact_log2 (INTVAL (operands[3]))
12504 < GET_MODE_NUNITS (<MODE>mode))"
12506 operands[3] = GEN_INT (exact_log2 (INTVAL (operands[3])));
12508 switch (which_alternative)
12511 if (GET_MODE_SIZE (<ssescalarmode>mode) < GET_MODE_SIZE (SImode))
12512 return "pinsr<ssemodesuffix>\t{%3, %k2, %0|%0, %k2, %3}";
12515 return "pinsr<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}";
12518 if (GET_MODE_SIZE (<ssescalarmode>mode) < GET_MODE_SIZE (SImode))
12519 return "vpinsr<ssemodesuffix>\t{%3, %k2, %1, %0|%0, %1, %k2, %3}";
12523 return "vpinsr<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}";
12525 gcc_unreachable ();
12528 [(set_attr "isa" "noavx,noavx,avx,avx,<pinsr_evex_isa>,<pinsr_evex_isa>")
12529 (set_attr "type" "sselog")
12530 (set (attr "prefix_rex")
12532 (and (not (match_test "TARGET_AVX"))
12533 (eq (const_string "<MODE>mode") (const_string "V2DImode")))
12535 (const_string "*")))
12536 (set (attr "prefix_data16")
12538 (and (not (match_test "TARGET_AVX"))
12539 (eq (const_string "<MODE>mode") (const_string "V8HImode")))
12541 (const_string "*")))
12542 (set (attr "prefix_extra")
12544 (and (not (match_test "TARGET_AVX"))
12545 (eq (const_string "<MODE>mode") (const_string "V8HImode")))
12547 (const_string "1")))
12548 (set_attr "length_immediate" "1")
12549 (set_attr "prefix" "orig,orig,vex,vex,evex,evex")
12550 (set_attr "mode" "TI")])
12552 (define_expand "<extract_type>_vinsert<shuffletype><extract_suf>_mask"
12553 [(match_operand:AVX512_VEC 0 "register_operand")
12554 (match_operand:AVX512_VEC 1 "register_operand")
12555 (match_operand:<ssequartermode> 2 "nonimmediate_operand")
12556 (match_operand:SI 3 "const_0_to_3_operand")
12557 (match_operand:AVX512_VEC 4 "register_operand")
12558 (match_operand:<avx512fmaskmode> 5 "register_operand")]
12562 mask = INTVAL (operands[3]);
12563 selector = GET_MODE_UNIT_SIZE (<MODE>mode) == 4 ?
12564 0xFFFF ^ (0xF000 >> mask * 4)
12565 : 0xFF ^ (0xC0 >> mask * 2);
12566 emit_insn (gen_<extract_type>_vinsert<shuffletype><extract_suf>_1_mask
12567 (operands[0], operands[1], operands[2], GEN_INT (selector),
12568 operands[4], operands[5]));
12572 (define_insn "<mask_codefor><extract_type>_vinsert<shuffletype><extract_suf>_1<mask_name>"
12573 [(set (match_operand:AVX512_VEC 0 "register_operand" "=v")
12574 (vec_merge:AVX512_VEC
12575 (match_operand:AVX512_VEC 1 "register_operand" "v")
12576 (vec_duplicate:AVX512_VEC
12577 (match_operand:<ssequartermode> 2 "nonimmediate_operand" "vm"))
12578 (match_operand:SI 3 "const_int_operand" "n")))]
12582 int selector = INTVAL (operands[3]);
12584 if (selector == 0xFFF || selector == 0x3F)
12586 else if ( selector == 0xF0FF || selector == 0xCF)
12588 else if ( selector == 0xFF0F || selector == 0xF3)
12590 else if ( selector == 0xFFF0 || selector == 0xFC)
12593 gcc_unreachable ();
12595 operands[3] = GEN_INT (mask);
12597 return "vinsert<shuffletype><extract_suf>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3}";
12599 [(set_attr "type" "sselog")
12600 (set_attr "length_immediate" "1")
12601 (set_attr "prefix" "evex")
12602 (set_attr "mode" "<sseinsnmode>")])
12604 (define_expand "<extract_type_2>_vinsert<shuffletype><extract_suf_2>_mask"
12605 [(match_operand:AVX512_VEC_2 0 "register_operand")
12606 (match_operand:AVX512_VEC_2 1 "register_operand")
12607 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand")
12608 (match_operand:SI 3 "const_0_to_1_operand")
12609 (match_operand:AVX512_VEC_2 4 "register_operand")
12610 (match_operand:<avx512fmaskmode> 5 "register_operand")]
12613 int mask = INTVAL (operands[3]);
12615 emit_insn (gen_vec_set_lo_<mode>_mask (operands[0], operands[1],
12616 operands[2], operands[4],
12619 emit_insn (gen_vec_set_hi_<mode>_mask (operands[0], operands[1],
12620 operands[2], operands[4],
12625 (define_insn "vec_set_lo_<mode><mask_name>"
12626 [(set (match_operand:V16FI 0 "register_operand" "=v")
12628 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
12629 (vec_select:<ssehalfvecmode>
12630 (match_operand:V16FI 1 "register_operand" "v")
12631 (parallel [(const_int 8) (const_int 9)
12632 (const_int 10) (const_int 11)
12633 (const_int 12) (const_int 13)
12634 (const_int 14) (const_int 15)]))))]
12636 "vinsert<shuffletype>32x8\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}"
12637 [(set_attr "type" "sselog")
12638 (set_attr "length_immediate" "1")
12639 (set_attr "prefix" "evex")
12640 (set_attr "mode" "<sseinsnmode>")])
12642 (define_insn "vec_set_hi_<mode><mask_name>"
12643 [(set (match_operand:V16FI 0 "register_operand" "=v")
12645 (vec_select:<ssehalfvecmode>
12646 (match_operand:V16FI 1 "register_operand" "v")
12647 (parallel [(const_int 0) (const_int 1)
12648 (const_int 2) (const_int 3)
12649 (const_int 4) (const_int 5)
12650 (const_int 6) (const_int 7)]))
12651 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
12653 "vinsert<shuffletype>32x8\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}"
12654 [(set_attr "type" "sselog")
12655 (set_attr "length_immediate" "1")
12656 (set_attr "prefix" "evex")
12657 (set_attr "mode" "<sseinsnmode>")])
12659 (define_insn "vec_set_lo_<mode><mask_name>"
12660 [(set (match_operand:V8FI 0 "register_operand" "=v")
12662 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
12663 (vec_select:<ssehalfvecmode>
12664 (match_operand:V8FI 1 "register_operand" "v")
12665 (parallel [(const_int 4) (const_int 5)
12666 (const_int 6) (const_int 7)]))))]
12668 "vinsert<shuffletype>64x4\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}"
12669 [(set_attr "type" "sselog")
12670 (set_attr "length_immediate" "1")
12671 (set_attr "prefix" "evex")
12672 (set_attr "mode" "XI")])
12674 (define_insn "vec_set_hi_<mode><mask_name>"
12675 [(set (match_operand:V8FI 0 "register_operand" "=v")
12677 (vec_select:<ssehalfvecmode>
12678 (match_operand:V8FI 1 "register_operand" "v")
12679 (parallel [(const_int 0) (const_int 1)
12680 (const_int 2) (const_int 3)]))
12681 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
12683 "vinsert<shuffletype>64x4\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}"
12684 [(set_attr "type" "sselog")
12685 (set_attr "length_immediate" "1")
12686 (set_attr "prefix" "evex")
12687 (set_attr "mode" "XI")])
12689 (define_expand "avx512dq_shuf_<shuffletype>64x2_mask"
12690 [(match_operand:VI8F_256 0 "register_operand")
12691 (match_operand:VI8F_256 1 "register_operand")
12692 (match_operand:VI8F_256 2 "nonimmediate_operand")
12693 (match_operand:SI 3 "const_0_to_3_operand")
12694 (match_operand:VI8F_256 4 "register_operand")
12695 (match_operand:QI 5 "register_operand")]
12698 int mask = INTVAL (operands[3]);
12699 emit_insn (gen_avx512dq_shuf_<shuffletype>64x2_1_mask
12700 (operands[0], operands[1], operands[2],
12701 GEN_INT (((mask >> 0) & 1) * 2 + 0),
12702 GEN_INT (((mask >> 0) & 1) * 2 + 1),
12703 GEN_INT (((mask >> 1) & 1) * 2 + 4),
12704 GEN_INT (((mask >> 1) & 1) * 2 + 5),
12705 operands[4], operands[5]));
12709 (define_insn "<mask_codefor>avx512dq_shuf_<shuffletype>64x2_1<mask_name>"
12710 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
12711 (vec_select:VI8F_256
12712 (vec_concat:<ssedoublemode>
12713 (match_operand:VI8F_256 1 "register_operand" "v")
12714 (match_operand:VI8F_256 2 "nonimmediate_operand" "vm"))
12715 (parallel [(match_operand 3 "const_0_to_3_operand")
12716 (match_operand 4 "const_0_to_3_operand")
12717 (match_operand 5 "const_4_to_7_operand")
12718 (match_operand 6 "const_4_to_7_operand")])))]
12720 && (INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
12721 && INTVAL (operands[5]) == (INTVAL (operands[6]) - 1))"
12724 mask = INTVAL (operands[3]) / 2;
12725 mask |= (INTVAL (operands[5]) - 4) / 2 << 1;
12726 operands[3] = GEN_INT (mask);
12727 return "vshuf<shuffletype>64x2\t{%3, %2, %1, %0<mask_operand7>|%0<mask_operand7>, %1, %2, %3}";
12729 [(set_attr "type" "sselog")
12730 (set_attr "length_immediate" "1")
12731 (set_attr "prefix" "evex")
12732 (set_attr "mode" "XI")])
12734 (define_expand "avx512f_shuf_<shuffletype>64x2_mask"
12735 [(match_operand:V8FI 0 "register_operand")
12736 (match_operand:V8FI 1 "register_operand")
12737 (match_operand:V8FI 2 "nonimmediate_operand")
12738 (match_operand:SI 3 "const_0_to_255_operand")
12739 (match_operand:V8FI 4 "register_operand")
12740 (match_operand:QI 5 "register_operand")]
12743 int mask = INTVAL (operands[3]);
12744 emit_insn (gen_avx512f_shuf_<shuffletype>64x2_1_mask
12745 (operands[0], operands[1], operands[2],
12746 GEN_INT (((mask >> 0) & 3) * 2),
12747 GEN_INT (((mask >> 0) & 3) * 2 + 1),
12748 GEN_INT (((mask >> 2) & 3) * 2),
12749 GEN_INT (((mask >> 2) & 3) * 2 + 1),
12750 GEN_INT (((mask >> 4) & 3) * 2 + 8),
12751 GEN_INT (((mask >> 4) & 3) * 2 + 9),
12752 GEN_INT (((mask >> 6) & 3) * 2 + 8),
12753 GEN_INT (((mask >> 6) & 3) * 2 + 9),
12754 operands[4], operands[5]));
12758 (define_insn "avx512f_shuf_<shuffletype>64x2_1<mask_name>"
12759 [(set (match_operand:V8FI 0 "register_operand" "=v")
12761 (vec_concat:<ssedoublemode>
12762 (match_operand:V8FI 1 "register_operand" "v")
12763 (match_operand:V8FI 2 "nonimmediate_operand" "vm"))
12764 (parallel [(match_operand 3 "const_0_to_7_operand")
12765 (match_operand 4 "const_0_to_7_operand")
12766 (match_operand 5 "const_0_to_7_operand")
12767 (match_operand 6 "const_0_to_7_operand")
12768 (match_operand 7 "const_8_to_15_operand")
12769 (match_operand 8 "const_8_to_15_operand")
12770 (match_operand 9 "const_8_to_15_operand")
12771 (match_operand 10 "const_8_to_15_operand")])))]
12773 && (INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
12774 && INTVAL (operands[5]) == (INTVAL (operands[6]) - 1)
12775 && INTVAL (operands[7]) == (INTVAL (operands[8]) - 1)
12776 && INTVAL (operands[9]) == (INTVAL (operands[10]) - 1))"
12779 mask = INTVAL (operands[3]) / 2;
12780 mask |= INTVAL (operands[5]) / 2 << 2;
12781 mask |= (INTVAL (operands[7]) - 8) / 2 << 4;
12782 mask |= (INTVAL (operands[9]) - 8) / 2 << 6;
12783 operands[3] = GEN_INT (mask);
12785 return "vshuf<shuffletype>64x2\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
12787 [(set_attr "type" "sselog")
12788 (set_attr "length_immediate" "1")
12789 (set_attr "prefix" "evex")
12790 (set_attr "mode" "<sseinsnmode>")])
12792 (define_expand "avx512vl_shuf_<shuffletype>32x4_mask"
12793 [(match_operand:VI4F_256 0 "register_operand")
12794 (match_operand:VI4F_256 1 "register_operand")
12795 (match_operand:VI4F_256 2 "nonimmediate_operand")
12796 (match_operand:SI 3 "const_0_to_3_operand")
12797 (match_operand:VI4F_256 4 "register_operand")
12798 (match_operand:QI 5 "register_operand")]
12801 int mask = INTVAL (operands[3]);
12802 emit_insn (gen_avx512vl_shuf_<shuffletype>32x4_1_mask
12803 (operands[0], operands[1], operands[2],
12804 GEN_INT (((mask >> 0) & 1) * 4 + 0),
12805 GEN_INT (((mask >> 0) & 1) * 4 + 1),
12806 GEN_INT (((mask >> 0) & 1) * 4 + 2),
12807 GEN_INT (((mask >> 0) & 1) * 4 + 3),
12808 GEN_INT (((mask >> 1) & 1) * 4 + 8),
12809 GEN_INT (((mask >> 1) & 1) * 4 + 9),
12810 GEN_INT (((mask >> 1) & 1) * 4 + 10),
12811 GEN_INT (((mask >> 1) & 1) * 4 + 11),
12812 operands[4], operands[5]));
12816 (define_insn "avx512vl_shuf_<shuffletype>32x4_1<mask_name>"
12817 [(set (match_operand:VI4F_256 0 "register_operand" "=v")
12818 (vec_select:VI4F_256
12819 (vec_concat:<ssedoublemode>
12820 (match_operand:VI4F_256 1 "register_operand" "v")
12821 (match_operand:VI4F_256 2 "nonimmediate_operand" "vm"))
12822 (parallel [(match_operand 3 "const_0_to_7_operand")
12823 (match_operand 4 "const_0_to_7_operand")
12824 (match_operand 5 "const_0_to_7_operand")
12825 (match_operand 6 "const_0_to_7_operand")
12826 (match_operand 7 "const_8_to_15_operand")
12827 (match_operand 8 "const_8_to_15_operand")
12828 (match_operand 9 "const_8_to_15_operand")
12829 (match_operand 10 "const_8_to_15_operand")])))]
12831 && (INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
12832 && INTVAL (operands[3]) == (INTVAL (operands[5]) - 2)
12833 && INTVAL (operands[3]) == (INTVAL (operands[6]) - 3)
12834 && INTVAL (operands[7]) == (INTVAL (operands[8]) - 1)
12835 && INTVAL (operands[7]) == (INTVAL (operands[9]) - 2)
12836 && INTVAL (operands[7]) == (INTVAL (operands[10]) - 3))"
12839 mask = INTVAL (operands[3]) / 4;
12840 mask |= (INTVAL (operands[7]) - 8) / 4 << 1;
12841 operands[3] = GEN_INT (mask);
12843 return "vshuf<shuffletype>32x4\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
12845 [(set_attr "type" "sselog")
12846 (set_attr "length_immediate" "1")
12847 (set_attr "prefix" "evex")
12848 (set_attr "mode" "<sseinsnmode>")])
12850 (define_expand "avx512f_shuf_<shuffletype>32x4_mask"
12851 [(match_operand:V16FI 0 "register_operand")
12852 (match_operand:V16FI 1 "register_operand")
12853 (match_operand:V16FI 2 "nonimmediate_operand")
12854 (match_operand:SI 3 "const_0_to_255_operand")
12855 (match_operand:V16FI 4 "register_operand")
12856 (match_operand:HI 5 "register_operand")]
12859 int mask = INTVAL (operands[3]);
12860 emit_insn (gen_avx512f_shuf_<shuffletype>32x4_1_mask
12861 (operands[0], operands[1], operands[2],
12862 GEN_INT (((mask >> 0) & 3) * 4),
12863 GEN_INT (((mask >> 0) & 3) * 4 + 1),
12864 GEN_INT (((mask >> 0) & 3) * 4 + 2),
12865 GEN_INT (((mask >> 0) & 3) * 4 + 3),
12866 GEN_INT (((mask >> 2) & 3) * 4),
12867 GEN_INT (((mask >> 2) & 3) * 4 + 1),
12868 GEN_INT (((mask >> 2) & 3) * 4 + 2),
12869 GEN_INT (((mask >> 2) & 3) * 4 + 3),
12870 GEN_INT (((mask >> 4) & 3) * 4 + 16),
12871 GEN_INT (((mask >> 4) & 3) * 4 + 17),
12872 GEN_INT (((mask >> 4) & 3) * 4 + 18),
12873 GEN_INT (((mask >> 4) & 3) * 4 + 19),
12874 GEN_INT (((mask >> 6) & 3) * 4 + 16),
12875 GEN_INT (((mask >> 6) & 3) * 4 + 17),
12876 GEN_INT (((mask >> 6) & 3) * 4 + 18),
12877 GEN_INT (((mask >> 6) & 3) * 4 + 19),
12878 operands[4], operands[5]));
12882 (define_insn "avx512f_shuf_<shuffletype>32x4_1<mask_name>"
12883 [(set (match_operand:V16FI 0 "register_operand" "=v")
12885 (vec_concat:<ssedoublemode>
12886 (match_operand:V16FI 1 "register_operand" "v")
12887 (match_operand:V16FI 2 "nonimmediate_operand" "vm"))
12888 (parallel [(match_operand 3 "const_0_to_15_operand")
12889 (match_operand 4 "const_0_to_15_operand")
12890 (match_operand 5 "const_0_to_15_operand")
12891 (match_operand 6 "const_0_to_15_operand")
12892 (match_operand 7 "const_0_to_15_operand")
12893 (match_operand 8 "const_0_to_15_operand")
12894 (match_operand 9 "const_0_to_15_operand")
12895 (match_operand 10 "const_0_to_15_operand")
12896 (match_operand 11 "const_16_to_31_operand")
12897 (match_operand 12 "const_16_to_31_operand")
12898 (match_operand 13 "const_16_to_31_operand")
12899 (match_operand 14 "const_16_to_31_operand")
12900 (match_operand 15 "const_16_to_31_operand")
12901 (match_operand 16 "const_16_to_31_operand")
12902 (match_operand 17 "const_16_to_31_operand")
12903 (match_operand 18 "const_16_to_31_operand")])))]
12905 && (INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
12906 && INTVAL (operands[3]) == (INTVAL (operands[5]) - 2)
12907 && INTVAL (operands[3]) == (INTVAL (operands[6]) - 3)
12908 && INTVAL (operands[7]) == (INTVAL (operands[8]) - 1)
12909 && INTVAL (operands[7]) == (INTVAL (operands[9]) - 2)
12910 && INTVAL (operands[7]) == (INTVAL (operands[10]) - 3)
12911 && INTVAL (operands[11]) == (INTVAL (operands[12]) - 1)
12912 && INTVAL (operands[11]) == (INTVAL (operands[13]) - 2)
12913 && INTVAL (operands[11]) == (INTVAL (operands[14]) - 3)
12914 && INTVAL (operands[15]) == (INTVAL (operands[16]) - 1)
12915 && INTVAL (operands[15]) == (INTVAL (operands[17]) - 2)
12916 && INTVAL (operands[15]) == (INTVAL (operands[18]) - 3))"
12919 mask = INTVAL (operands[3]) / 4;
12920 mask |= INTVAL (operands[7]) / 4 << 2;
12921 mask |= (INTVAL (operands[11]) - 16) / 4 << 4;
12922 mask |= (INTVAL (operands[15]) - 16) / 4 << 6;
12923 operands[3] = GEN_INT (mask);
12925 return "vshuf<shuffletype>32x4\t{%3, %2, %1, %0<mask_operand19>|%0<mask_operand19>, %1, %2, %3}";
12927 [(set_attr "type" "sselog")
12928 (set_attr "length_immediate" "1")
12929 (set_attr "prefix" "evex")
12930 (set_attr "mode" "<sseinsnmode>")])
12932 (define_expand "avx512f_pshufdv3_mask"
12933 [(match_operand:V16SI 0 "register_operand")
12934 (match_operand:V16SI 1 "nonimmediate_operand")
12935 (match_operand:SI 2 "const_0_to_255_operand")
12936 (match_operand:V16SI 3 "register_operand")
12937 (match_operand:HI 4 "register_operand")]
12940 int mask = INTVAL (operands[2]);
12941 emit_insn (gen_avx512f_pshufd_1_mask (operands[0], operands[1],
12942 GEN_INT ((mask >> 0) & 3),
12943 GEN_INT ((mask >> 2) & 3),
12944 GEN_INT ((mask >> 4) & 3),
12945 GEN_INT ((mask >> 6) & 3),
12946 GEN_INT (((mask >> 0) & 3) + 4),
12947 GEN_INT (((mask >> 2) & 3) + 4),
12948 GEN_INT (((mask >> 4) & 3) + 4),
12949 GEN_INT (((mask >> 6) & 3) + 4),
12950 GEN_INT (((mask >> 0) & 3) + 8),
12951 GEN_INT (((mask >> 2) & 3) + 8),
12952 GEN_INT (((mask >> 4) & 3) + 8),
12953 GEN_INT (((mask >> 6) & 3) + 8),
12954 GEN_INT (((mask >> 0) & 3) + 12),
12955 GEN_INT (((mask >> 2) & 3) + 12),
12956 GEN_INT (((mask >> 4) & 3) + 12),
12957 GEN_INT (((mask >> 6) & 3) + 12),
12958 operands[3], operands[4]));
12962 (define_insn "avx512f_pshufd_1<mask_name>"
12963 [(set (match_operand:V16SI 0 "register_operand" "=v")
12965 (match_operand:V16SI 1 "nonimmediate_operand" "vm")
12966 (parallel [(match_operand 2 "const_0_to_3_operand")
12967 (match_operand 3 "const_0_to_3_operand")
12968 (match_operand 4 "const_0_to_3_operand")
12969 (match_operand 5 "const_0_to_3_operand")
12970 (match_operand 6 "const_4_to_7_operand")
12971 (match_operand 7 "const_4_to_7_operand")
12972 (match_operand 8 "const_4_to_7_operand")
12973 (match_operand 9 "const_4_to_7_operand")
12974 (match_operand 10 "const_8_to_11_operand")
12975 (match_operand 11 "const_8_to_11_operand")
12976 (match_operand 12 "const_8_to_11_operand")
12977 (match_operand 13 "const_8_to_11_operand")
12978 (match_operand 14 "const_12_to_15_operand")
12979 (match_operand 15 "const_12_to_15_operand")
12980 (match_operand 16 "const_12_to_15_operand")
12981 (match_operand 17 "const_12_to_15_operand")])))]
12983 && INTVAL (operands[2]) + 4 == INTVAL (operands[6])
12984 && INTVAL (operands[3]) + 4 == INTVAL (operands[7])
12985 && INTVAL (operands[4]) + 4 == INTVAL (operands[8])
12986 && INTVAL (operands[5]) + 4 == INTVAL (operands[9])
12987 && INTVAL (operands[2]) + 8 == INTVAL (operands[10])
12988 && INTVAL (operands[3]) + 8 == INTVAL (operands[11])
12989 && INTVAL (operands[4]) + 8 == INTVAL (operands[12])
12990 && INTVAL (operands[5]) + 8 == INTVAL (operands[13])
12991 && INTVAL (operands[2]) + 12 == INTVAL (operands[14])
12992 && INTVAL (operands[3]) + 12 == INTVAL (operands[15])
12993 && INTVAL (operands[4]) + 12 == INTVAL (operands[16])
12994 && INTVAL (operands[5]) + 12 == INTVAL (operands[17])"
12997 mask |= INTVAL (operands[2]) << 0;
12998 mask |= INTVAL (operands[3]) << 2;
12999 mask |= INTVAL (operands[4]) << 4;
13000 mask |= INTVAL (operands[5]) << 6;
13001 operands[2] = GEN_INT (mask);
13003 return "vpshufd\t{%2, %1, %0<mask_operand18>|%0<mask_operand18>, %1, %2}";
13005 [(set_attr "type" "sselog1")
13006 (set_attr "prefix" "evex")
13007 (set_attr "length_immediate" "1")
13008 (set_attr "mode" "XI")])
13010 (define_expand "avx512vl_pshufdv3_mask"
13011 [(match_operand:V8SI 0 "register_operand")
13012 (match_operand:V8SI 1 "nonimmediate_operand")
13013 (match_operand:SI 2 "const_0_to_255_operand")
13014 (match_operand:V8SI 3 "register_operand")
13015 (match_operand:QI 4 "register_operand")]
13018 int mask = INTVAL (operands[2]);
13019 emit_insn (gen_avx2_pshufd_1_mask (operands[0], operands[1],
13020 GEN_INT ((mask >> 0) & 3),
13021 GEN_INT ((mask >> 2) & 3),
13022 GEN_INT ((mask >> 4) & 3),
13023 GEN_INT ((mask >> 6) & 3),
13024 GEN_INT (((mask >> 0) & 3) + 4),
13025 GEN_INT (((mask >> 2) & 3) + 4),
13026 GEN_INT (((mask >> 4) & 3) + 4),
13027 GEN_INT (((mask >> 6) & 3) + 4),
13028 operands[3], operands[4]));
13032 (define_expand "avx2_pshufdv3"
13033 [(match_operand:V8SI 0 "register_operand")
13034 (match_operand:V8SI 1 "nonimmediate_operand")
13035 (match_operand:SI 2 "const_0_to_255_operand")]
13038 int mask = INTVAL (operands[2]);
13039 emit_insn (gen_avx2_pshufd_1 (operands[0], operands[1],
13040 GEN_INT ((mask >> 0) & 3),
13041 GEN_INT ((mask >> 2) & 3),
13042 GEN_INT ((mask >> 4) & 3),
13043 GEN_INT ((mask >> 6) & 3),
13044 GEN_INT (((mask >> 0) & 3) + 4),
13045 GEN_INT (((mask >> 2) & 3) + 4),
13046 GEN_INT (((mask >> 4) & 3) + 4),
13047 GEN_INT (((mask >> 6) & 3) + 4)));
13051 (define_insn "avx2_pshufd_1<mask_name>"
13052 [(set (match_operand:V8SI 0 "register_operand" "=v")
13054 (match_operand:V8SI 1 "nonimmediate_operand" "vm")
13055 (parallel [(match_operand 2 "const_0_to_3_operand")
13056 (match_operand 3 "const_0_to_3_operand")
13057 (match_operand 4 "const_0_to_3_operand")
13058 (match_operand 5 "const_0_to_3_operand")
13059 (match_operand 6 "const_4_to_7_operand")
13060 (match_operand 7 "const_4_to_7_operand")
13061 (match_operand 8 "const_4_to_7_operand")
13062 (match_operand 9 "const_4_to_7_operand")])))]
13064 && <mask_avx512vl_condition>
13065 && INTVAL (operands[2]) + 4 == INTVAL (operands[6])
13066 && INTVAL (operands[3]) + 4 == INTVAL (operands[7])
13067 && INTVAL (operands[4]) + 4 == INTVAL (operands[8])
13068 && INTVAL (operands[5]) + 4 == INTVAL (operands[9])"
13071 mask |= INTVAL (operands[2]) << 0;
13072 mask |= INTVAL (operands[3]) << 2;
13073 mask |= INTVAL (operands[4]) << 4;
13074 mask |= INTVAL (operands[5]) << 6;
13075 operands[2] = GEN_INT (mask);
13077 return "vpshufd\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
13079 [(set_attr "type" "sselog1")
13080 (set_attr "prefix" "maybe_evex")
13081 (set_attr "length_immediate" "1")
13082 (set_attr "mode" "OI")])
13084 (define_expand "avx512vl_pshufd_mask"
13085 [(match_operand:V4SI 0 "register_operand")
13086 (match_operand:V4SI 1 "nonimmediate_operand")
13087 (match_operand:SI 2 "const_0_to_255_operand")
13088 (match_operand:V4SI 3 "register_operand")
13089 (match_operand:QI 4 "register_operand")]
13092 int mask = INTVAL (operands[2]);
13093 emit_insn (gen_sse2_pshufd_1_mask (operands[0], operands[1],
13094 GEN_INT ((mask >> 0) & 3),
13095 GEN_INT ((mask >> 2) & 3),
13096 GEN_INT ((mask >> 4) & 3),
13097 GEN_INT ((mask >> 6) & 3),
13098 operands[3], operands[4]));
13102 (define_expand "sse2_pshufd"
13103 [(match_operand:V4SI 0 "register_operand")
13104 (match_operand:V4SI 1 "vector_operand")
13105 (match_operand:SI 2 "const_int_operand")]
13108 int mask = INTVAL (operands[2]);
13109 emit_insn (gen_sse2_pshufd_1 (operands[0], operands[1],
13110 GEN_INT ((mask >> 0) & 3),
13111 GEN_INT ((mask >> 2) & 3),
13112 GEN_INT ((mask >> 4) & 3),
13113 GEN_INT ((mask >> 6) & 3)));
13117 (define_insn "sse2_pshufd_1<mask_name>"
13118 [(set (match_operand:V4SI 0 "register_operand" "=v")
13120 (match_operand:V4SI 1 "vector_operand" "vBm")
13121 (parallel [(match_operand 2 "const_0_to_3_operand")
13122 (match_operand 3 "const_0_to_3_operand")
13123 (match_operand 4 "const_0_to_3_operand")
13124 (match_operand 5 "const_0_to_3_operand")])))]
13125 "TARGET_SSE2 && <mask_avx512vl_condition>"
13128 mask |= INTVAL (operands[2]) << 0;
13129 mask |= INTVAL (operands[3]) << 2;
13130 mask |= INTVAL (operands[4]) << 4;
13131 mask |= INTVAL (operands[5]) << 6;
13132 operands[2] = GEN_INT (mask);
13134 return "%vpshufd\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
13136 [(set_attr "type" "sselog1")
13137 (set_attr "prefix_data16" "1")
13138 (set_attr "prefix" "<mask_prefix2>")
13139 (set_attr "length_immediate" "1")
13140 (set_attr "mode" "TI")])
13142 (define_insn "<mask_codefor>avx512bw_pshuflwv32hi<mask_name>"
13143 [(set (match_operand:V32HI 0 "register_operand" "=v")
13145 [(match_operand:V32HI 1 "nonimmediate_operand" "vm")
13146 (match_operand:SI 2 "const_0_to_255_operand" "n")]
13149 "vpshuflw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13150 [(set_attr "type" "sselog")
13151 (set_attr "prefix" "evex")
13152 (set_attr "mode" "XI")])
13154 (define_expand "avx512vl_pshuflwv3_mask"
13155 [(match_operand:V16HI 0 "register_operand")
13156 (match_operand:V16HI 1 "nonimmediate_operand")
13157 (match_operand:SI 2 "const_0_to_255_operand")
13158 (match_operand:V16HI 3 "register_operand")
13159 (match_operand:HI 4 "register_operand")]
13160 "TARGET_AVX512VL && TARGET_AVX512BW"
13162 int mask = INTVAL (operands[2]);
13163 emit_insn (gen_avx2_pshuflw_1_mask (operands[0], operands[1],
13164 GEN_INT ((mask >> 0) & 3),
13165 GEN_INT ((mask >> 2) & 3),
13166 GEN_INT ((mask >> 4) & 3),
13167 GEN_INT ((mask >> 6) & 3),
13168 GEN_INT (((mask >> 0) & 3) + 8),
13169 GEN_INT (((mask >> 2) & 3) + 8),
13170 GEN_INT (((mask >> 4) & 3) + 8),
13171 GEN_INT (((mask >> 6) & 3) + 8),
13172 operands[3], operands[4]));
13176 (define_expand "avx2_pshuflwv3"
13177 [(match_operand:V16HI 0 "register_operand")
13178 (match_operand:V16HI 1 "nonimmediate_operand")
13179 (match_operand:SI 2 "const_0_to_255_operand")]
13182 int mask = INTVAL (operands[2]);
13183 emit_insn (gen_avx2_pshuflw_1 (operands[0], operands[1],
13184 GEN_INT ((mask >> 0) & 3),
13185 GEN_INT ((mask >> 2) & 3),
13186 GEN_INT ((mask >> 4) & 3),
13187 GEN_INT ((mask >> 6) & 3),
13188 GEN_INT (((mask >> 0) & 3) + 8),
13189 GEN_INT (((mask >> 2) & 3) + 8),
13190 GEN_INT (((mask >> 4) & 3) + 8),
13191 GEN_INT (((mask >> 6) & 3) + 8)));
13195 (define_insn "avx2_pshuflw_1<mask_name>"
13196 [(set (match_operand:V16HI 0 "register_operand" "=v")
13198 (match_operand:V16HI 1 "nonimmediate_operand" "vm")
13199 (parallel [(match_operand 2 "const_0_to_3_operand")
13200 (match_operand 3 "const_0_to_3_operand")
13201 (match_operand 4 "const_0_to_3_operand")
13202 (match_operand 5 "const_0_to_3_operand")
13207 (match_operand 6 "const_8_to_11_operand")
13208 (match_operand 7 "const_8_to_11_operand")
13209 (match_operand 8 "const_8_to_11_operand")
13210 (match_operand 9 "const_8_to_11_operand")
13214 (const_int 15)])))]
13216 && <mask_avx512bw_condition> && <mask_avx512vl_condition>
13217 && INTVAL (operands[2]) + 8 == INTVAL (operands[6])
13218 && INTVAL (operands[3]) + 8 == INTVAL (operands[7])
13219 && INTVAL (operands[4]) + 8 == INTVAL (operands[8])
13220 && INTVAL (operands[5]) + 8 == INTVAL (operands[9])"
13223 mask |= INTVAL (operands[2]) << 0;
13224 mask |= INTVAL (operands[3]) << 2;
13225 mask |= INTVAL (operands[4]) << 4;
13226 mask |= INTVAL (operands[5]) << 6;
13227 operands[2] = GEN_INT (mask);
13229 return "vpshuflw\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
13231 [(set_attr "type" "sselog")
13232 (set_attr "prefix" "maybe_evex")
13233 (set_attr "length_immediate" "1")
13234 (set_attr "mode" "OI")])
13236 (define_expand "avx512vl_pshuflw_mask"
13237 [(match_operand:V8HI 0 "register_operand")
13238 (match_operand:V8HI 1 "nonimmediate_operand")
13239 (match_operand:SI 2 "const_0_to_255_operand")
13240 (match_operand:V8HI 3 "register_operand")
13241 (match_operand:QI 4 "register_operand")]
13242 "TARGET_AVX512VL && TARGET_AVX512BW"
13244 int mask = INTVAL (operands[2]);
13245 emit_insn (gen_sse2_pshuflw_1_mask (operands[0], operands[1],
13246 GEN_INT ((mask >> 0) & 3),
13247 GEN_INT ((mask >> 2) & 3),
13248 GEN_INT ((mask >> 4) & 3),
13249 GEN_INT ((mask >> 6) & 3),
13250 operands[3], operands[4]));
13254 (define_expand "sse2_pshuflw"
13255 [(match_operand:V8HI 0 "register_operand")
13256 (match_operand:V8HI 1 "vector_operand")
13257 (match_operand:SI 2 "const_int_operand")]
13260 int mask = INTVAL (operands[2]);
13261 emit_insn (gen_sse2_pshuflw_1 (operands[0], operands[1],
13262 GEN_INT ((mask >> 0) & 3),
13263 GEN_INT ((mask >> 2) & 3),
13264 GEN_INT ((mask >> 4) & 3),
13265 GEN_INT ((mask >> 6) & 3)));
13269 (define_insn "sse2_pshuflw_1<mask_name>"
13270 [(set (match_operand:V8HI 0 "register_operand" "=v")
13272 (match_operand:V8HI 1 "vector_operand" "vBm")
13273 (parallel [(match_operand 2 "const_0_to_3_operand")
13274 (match_operand 3 "const_0_to_3_operand")
13275 (match_operand 4 "const_0_to_3_operand")
13276 (match_operand 5 "const_0_to_3_operand")
13281 "TARGET_SSE2 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
13284 mask |= INTVAL (operands[2]) << 0;
13285 mask |= INTVAL (operands[3]) << 2;
13286 mask |= INTVAL (operands[4]) << 4;
13287 mask |= INTVAL (operands[5]) << 6;
13288 operands[2] = GEN_INT (mask);
13290 return "%vpshuflw\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
13292 [(set_attr "type" "sselog")
13293 (set_attr "prefix_data16" "0")
13294 (set_attr "prefix_rep" "1")
13295 (set_attr "prefix" "maybe_vex")
13296 (set_attr "length_immediate" "1")
13297 (set_attr "mode" "TI")])
13299 (define_expand "avx2_pshufhwv3"
13300 [(match_operand:V16HI 0 "register_operand")
13301 (match_operand:V16HI 1 "nonimmediate_operand")
13302 (match_operand:SI 2 "const_0_to_255_operand")]
13305 int mask = INTVAL (operands[2]);
13306 emit_insn (gen_avx2_pshufhw_1 (operands[0], operands[1],
13307 GEN_INT (((mask >> 0) & 3) + 4),
13308 GEN_INT (((mask >> 2) & 3) + 4),
13309 GEN_INT (((mask >> 4) & 3) + 4),
13310 GEN_INT (((mask >> 6) & 3) + 4),
13311 GEN_INT (((mask >> 0) & 3) + 12),
13312 GEN_INT (((mask >> 2) & 3) + 12),
13313 GEN_INT (((mask >> 4) & 3) + 12),
13314 GEN_INT (((mask >> 6) & 3) + 12)));
13318 (define_insn "<mask_codefor>avx512bw_pshufhwv32hi<mask_name>"
13319 [(set (match_operand:V32HI 0 "register_operand" "=v")
13321 [(match_operand:V32HI 1 "nonimmediate_operand" "vm")
13322 (match_operand:SI 2 "const_0_to_255_operand" "n")]
13325 "vpshufhw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13326 [(set_attr "type" "sselog")
13327 (set_attr "prefix" "evex")
13328 (set_attr "mode" "XI")])
13330 (define_expand "avx512vl_pshufhwv3_mask"
13331 [(match_operand:V16HI 0 "register_operand")
13332 (match_operand:V16HI 1 "nonimmediate_operand")
13333 (match_operand:SI 2 "const_0_to_255_operand")
13334 (match_operand:V16HI 3 "register_operand")
13335 (match_operand:HI 4 "register_operand")]
13336 "TARGET_AVX512VL && TARGET_AVX512BW"
13338 int mask = INTVAL (operands[2]);
13339 emit_insn (gen_avx2_pshufhw_1_mask (operands[0], operands[1],
13340 GEN_INT (((mask >> 0) & 3) + 4),
13341 GEN_INT (((mask >> 2) & 3) + 4),
13342 GEN_INT (((mask >> 4) & 3) + 4),
13343 GEN_INT (((mask >> 6) & 3) + 4),
13344 GEN_INT (((mask >> 0) & 3) + 12),
13345 GEN_INT (((mask >> 2) & 3) + 12),
13346 GEN_INT (((mask >> 4) & 3) + 12),
13347 GEN_INT (((mask >> 6) & 3) + 12),
13348 operands[3], operands[4]));
13352 (define_insn "avx2_pshufhw_1<mask_name>"
13353 [(set (match_operand:V16HI 0 "register_operand" "=v")
13355 (match_operand:V16HI 1 "nonimmediate_operand" "vm")
13356 (parallel [(const_int 0)
13360 (match_operand 2 "const_4_to_7_operand")
13361 (match_operand 3 "const_4_to_7_operand")
13362 (match_operand 4 "const_4_to_7_operand")
13363 (match_operand 5 "const_4_to_7_operand")
13368 (match_operand 6 "const_12_to_15_operand")
13369 (match_operand 7 "const_12_to_15_operand")
13370 (match_operand 8 "const_12_to_15_operand")
13371 (match_operand 9 "const_12_to_15_operand")])))]
13373 && <mask_avx512bw_condition> && <mask_avx512vl_condition>
13374 && INTVAL (operands[2]) + 8 == INTVAL (operands[6])
13375 && INTVAL (operands[3]) + 8 == INTVAL (operands[7])
13376 && INTVAL (operands[4]) + 8 == INTVAL (operands[8])
13377 && INTVAL (operands[5]) + 8 == INTVAL (operands[9])"
13380 mask |= (INTVAL (operands[2]) - 4) << 0;
13381 mask |= (INTVAL (operands[3]) - 4) << 2;
13382 mask |= (INTVAL (operands[4]) - 4) << 4;
13383 mask |= (INTVAL (operands[5]) - 4) << 6;
13384 operands[2] = GEN_INT (mask);
13386 return "vpshufhw\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
13388 [(set_attr "type" "sselog")
13389 (set_attr "prefix" "maybe_evex")
13390 (set_attr "length_immediate" "1")
13391 (set_attr "mode" "OI")])
13393 (define_expand "avx512vl_pshufhw_mask"
13394 [(match_operand:V8HI 0 "register_operand")
13395 (match_operand:V8HI 1 "nonimmediate_operand")
13396 (match_operand:SI 2 "const_0_to_255_operand")
13397 (match_operand:V8HI 3 "register_operand")
13398 (match_operand:QI 4 "register_operand")]
13399 "TARGET_AVX512VL && TARGET_AVX512BW"
13401 int mask = INTVAL (operands[2]);
13402 emit_insn (gen_sse2_pshufhw_1_mask (operands[0], operands[1],
13403 GEN_INT (((mask >> 0) & 3) + 4),
13404 GEN_INT (((mask >> 2) & 3) + 4),
13405 GEN_INT (((mask >> 4) & 3) + 4),
13406 GEN_INT (((mask >> 6) & 3) + 4),
13407 operands[3], operands[4]));
13411 (define_expand "sse2_pshufhw"
13412 [(match_operand:V8HI 0 "register_operand")
13413 (match_operand:V8HI 1 "vector_operand")
13414 (match_operand:SI 2 "const_int_operand")]
13417 int mask = INTVAL (operands[2]);
13418 emit_insn (gen_sse2_pshufhw_1 (operands[0], operands[1],
13419 GEN_INT (((mask >> 0) & 3) + 4),
13420 GEN_INT (((mask >> 2) & 3) + 4),
13421 GEN_INT (((mask >> 4) & 3) + 4),
13422 GEN_INT (((mask >> 6) & 3) + 4)));
13426 (define_insn "sse2_pshufhw_1<mask_name>"
13427 [(set (match_operand:V8HI 0 "register_operand" "=v")
13429 (match_operand:V8HI 1 "vector_operand" "vBm")
13430 (parallel [(const_int 0)
13434 (match_operand 2 "const_4_to_7_operand")
13435 (match_operand 3 "const_4_to_7_operand")
13436 (match_operand 4 "const_4_to_7_operand")
13437 (match_operand 5 "const_4_to_7_operand")])))]
13438 "TARGET_SSE2 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
13441 mask |= (INTVAL (operands[2]) - 4) << 0;
13442 mask |= (INTVAL (operands[3]) - 4) << 2;
13443 mask |= (INTVAL (operands[4]) - 4) << 4;
13444 mask |= (INTVAL (operands[5]) - 4) << 6;
13445 operands[2] = GEN_INT (mask);
13447 return "%vpshufhw\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
13449 [(set_attr "type" "sselog")
13450 (set_attr "prefix_rep" "1")
13451 (set_attr "prefix_data16" "0")
13452 (set_attr "prefix" "maybe_vex")
13453 (set_attr "length_immediate" "1")
13454 (set_attr "mode" "TI")])
13456 (define_expand "sse2_loadd"
13457 [(set (match_operand:V4SI 0 "register_operand")
13459 (vec_duplicate:V4SI
13460 (match_operand:SI 1 "nonimmediate_operand"))
13464 "operands[2] = CONST0_RTX (V4SImode);")
13466 (define_insn "sse2_loadld"
13467 [(set (match_operand:V4SI 0 "register_operand" "=v,Yi,x,x,v")
13469 (vec_duplicate:V4SI
13470 (match_operand:SI 2 "nonimmediate_operand" "m ,r ,m,x,v"))
13471 (match_operand:V4SI 1 "reg_or_0_operand" "C ,C ,C,0,v")
13475 %vmovd\t{%2, %0|%0, %2}
13476 %vmovd\t{%2, %0|%0, %2}
13477 movss\t{%2, %0|%0, %2}
13478 movss\t{%2, %0|%0, %2}
13479 vmovss\t{%2, %1, %0|%0, %1, %2}"
13480 [(set_attr "isa" "sse2,sse2,noavx,noavx,avx")
13481 (set_attr "type" "ssemov")
13482 (set_attr "prefix" "maybe_vex,maybe_vex,orig,orig,maybe_evex")
13483 (set_attr "mode" "TI,TI,V4SF,SF,SF")])
13485 ;; QI and HI modes handled by pextr patterns.
13486 (define_mode_iterator PEXTR_MODE12
13487 [(V16QI "TARGET_SSE4_1") V8HI])
13489 (define_insn "*vec_extract<mode>"
13490 [(set (match_operand:<ssescalarmode> 0 "register_sse4nonimm_operand" "=r,m,r,m")
13491 (vec_select:<ssescalarmode>
13492 (match_operand:PEXTR_MODE12 1 "register_operand" "x,x,v,v")
13494 [(match_operand:SI 2 "const_0_to_<ssescalarnummask>_operand")])))]
13497 %vpextr<ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}
13498 %vpextr<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
13499 vpextr<ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}
13500 vpextr<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
13501 [(set_attr "isa" "*,sse4,avx512bw,avx512bw")
13502 (set_attr "type" "sselog1")
13503 (set_attr "prefix_data16" "1")
13504 (set (attr "prefix_extra")
13506 (and (eq_attr "alternative" "0,2")
13507 (eq (const_string "<MODE>mode") (const_string "V8HImode")))
13509 (const_string "1")))
13510 (set_attr "length_immediate" "1")
13511 (set_attr "prefix" "maybe_vex,maybe_vex,evex,evex")
13512 (set_attr "mode" "TI")])
13514 (define_insn "*vec_extract<PEXTR_MODE12:mode>_zext"
13515 [(set (match_operand:SWI48 0 "register_operand" "=r,r")
13517 (vec_select:<PEXTR_MODE12:ssescalarmode>
13518 (match_operand:PEXTR_MODE12 1 "register_operand" "x,v")
13520 [(match_operand:SI 2
13521 "const_0_to_<PEXTR_MODE12:ssescalarnummask>_operand")]))))]
13524 %vpextr<PEXTR_MODE12:ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}
13525 vpextr<PEXTR_MODE12:ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}"
13526 [(set_attr "isa" "*,avx512bw")
13527 (set_attr "type" "sselog1")
13528 (set_attr "prefix_data16" "1")
13529 (set (attr "prefix_extra")
13531 (eq (const_string "<PEXTR_MODE12:MODE>mode") (const_string "V8HImode"))
13533 (const_string "1")))
13534 (set_attr "length_immediate" "1")
13535 (set_attr "prefix" "maybe_vex")
13536 (set_attr "mode" "TI")])
13538 (define_insn "*vec_extract<mode>_mem"
13539 [(set (match_operand:<ssescalarmode> 0 "register_operand" "=r")
13540 (vec_select:<ssescalarmode>
13541 (match_operand:VI12_128 1 "memory_operand" "o")
13543 [(match_operand 2 "const_0_to_<ssescalarnummask>_operand")])))]
13547 (define_insn "*vec_extract<ssevecmodelower>_0"
13548 [(set (match_operand:SWI48 0 "nonimmediate_operand" "=r ,v ,m")
13550 (match_operand:<ssevecmode> 1 "nonimmediate_operand" "mYj,vm,v")
13551 (parallel [(const_int 0)])))]
13552 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
13555 (define_insn "*vec_extractv2di_0_sse"
13556 [(set (match_operand:DI 0 "nonimmediate_operand" "=v,m")
13558 (match_operand:V2DI 1 "nonimmediate_operand" "vm,v")
13559 (parallel [(const_int 0)])))]
13560 "TARGET_SSE && !TARGET_64BIT
13561 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
13565 [(set (match_operand:SWI48x 0 "nonimmediate_operand")
13567 (match_operand:<ssevecmode> 1 "register_operand")
13568 (parallel [(const_int 0)])))]
13569 "TARGET_SSE && reload_completed"
13570 [(set (match_dup 0) (match_dup 1))]
13571 "operands[1] = gen_lowpart (<MODE>mode, operands[1]);")
13573 (define_insn "*vec_extractv4si_0_zext_sse4"
13574 [(set (match_operand:DI 0 "register_operand" "=r,x,v")
13577 (match_operand:V4SI 1 "register_operand" "Yj,x,v")
13578 (parallel [(const_int 0)]))))]
13581 [(set_attr "isa" "x64,*,avx512f")])
13583 (define_insn "*vec_extractv4si_0_zext"
13584 [(set (match_operand:DI 0 "register_operand" "=r")
13587 (match_operand:V4SI 1 "register_operand" "x")
13588 (parallel [(const_int 0)]))))]
13589 "TARGET_64BIT && TARGET_SSE2 && TARGET_INTER_UNIT_MOVES_FROM_VEC"
13593 [(set (match_operand:DI 0 "register_operand")
13596 (match_operand:V4SI 1 "register_operand")
13597 (parallel [(const_int 0)]))))]
13598 "TARGET_SSE2 && reload_completed"
13599 [(set (match_dup 0) (zero_extend:DI (match_dup 1)))]
13600 "operands[1] = gen_lowpart (SImode, operands[1]);")
13602 (define_insn "*vec_extractv4si"
13603 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,rm,Yr,*x,x,Yv")
13605 (match_operand:V4SI 1 "register_operand" "x,v,0,0,x,v")
13606 (parallel [(match_operand:SI 2 "const_0_to_3_operand")])))]
13609 switch (which_alternative)
13613 return "%vpextrd\t{%2, %1, %0|%0, %1, %2}";
13617 operands[2] = GEN_INT (INTVAL (operands[2]) * 4);
13618 return "psrldq\t{%2, %0|%0, %2}";
13622 operands[2] = GEN_INT (INTVAL (operands[2]) * 4);
13623 return "vpsrldq\t{%2, %1, %0|%0, %1, %2}";
13626 gcc_unreachable ();
13629 [(set_attr "isa" "*,avx512dq,noavx,noavx,avx,avx512bw")
13630 (set_attr "type" "sselog1,sselog1,sseishft1,sseishft1,sseishft1,sseishft1")
13631 (set (attr "prefix_extra")
13632 (if_then_else (eq_attr "alternative" "0,1")
13634 (const_string "*")))
13635 (set_attr "length_immediate" "1")
13636 (set_attr "prefix" "maybe_vex,evex,orig,orig,vex,evex")
13637 (set_attr "mode" "TI")])
13639 (define_insn "*vec_extractv4si_zext"
13640 [(set (match_operand:DI 0 "register_operand" "=r,r")
13643 (match_operand:V4SI 1 "register_operand" "x,v")
13644 (parallel [(match_operand:SI 2 "const_0_to_3_operand")]))))]
13645 "TARGET_64BIT && TARGET_SSE4_1"
13646 "%vpextrd\t{%2, %1, %k0|%k0, %1, %2}"
13647 [(set_attr "isa" "*,avx512dq")
13648 (set_attr "type" "sselog1")
13649 (set_attr "prefix_extra" "1")
13650 (set_attr "length_immediate" "1")
13651 (set_attr "prefix" "maybe_vex")
13652 (set_attr "mode" "TI")])
13654 (define_insn "*vec_extractv4si_mem"
13655 [(set (match_operand:SI 0 "register_operand" "=x,r")
13657 (match_operand:V4SI 1 "memory_operand" "o,o")
13658 (parallel [(match_operand 2 "const_0_to_3_operand")])))]
13662 (define_insn_and_split "*vec_extractv4si_zext_mem"
13663 [(set (match_operand:DI 0 "register_operand" "=x,r")
13666 (match_operand:V4SI 1 "memory_operand" "o,o")
13667 (parallel [(match_operand:SI 2 "const_0_to_3_operand")]))))]
13668 "TARGET_64BIT && TARGET_SSE"
13670 "&& reload_completed"
13671 [(set (match_dup 0) (zero_extend:DI (match_dup 1)))]
13673 operands[1] = adjust_address (operands[1], SImode, INTVAL (operands[2]) * 4);
13676 (define_insn "*vec_extractv2di_1"
13677 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,rm,m,x,x,Yv,x,v,r")
13679 (match_operand:V2DI 1 "nonimmediate_operand" "x ,v ,v,0,x, v,x,o,o")
13680 (parallel [(const_int 1)])))]
13681 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
13683 %vpextrq\t{$1, %1, %0|%0, %1, 1}
13684 vpextrq\t{$1, %1, %0|%0, %1, 1}
13685 %vmovhps\t{%1, %0|%0, %1}
13686 psrldq\t{$8, %0|%0, 8}
13687 vpsrldq\t{$8, %1, %0|%0, %1, 8}
13688 vpsrldq\t{$8, %1, %0|%0, %1, 8}
13689 movhlps\t{%1, %0|%0, %1}
13693 (cond [(eq_attr "alternative" "0")
13694 (const_string "x64_sse4")
13695 (eq_attr "alternative" "1")
13696 (const_string "x64_avx512dq")
13697 (eq_attr "alternative" "3")
13698 (const_string "sse2_noavx")
13699 (eq_attr "alternative" "4")
13700 (const_string "avx")
13701 (eq_attr "alternative" "5")
13702 (const_string "avx512bw")
13703 (eq_attr "alternative" "6")
13704 (const_string "noavx")
13705 (eq_attr "alternative" "8")
13706 (const_string "x64")
13708 (const_string "*")))
13710 (cond [(eq_attr "alternative" "2,6,7")
13711 (const_string "ssemov")
13712 (eq_attr "alternative" "3,4,5")
13713 (const_string "sseishft1")
13714 (eq_attr "alternative" "8")
13715 (const_string "imov")
13717 (const_string "sselog1")))
13718 (set (attr "length_immediate")
13719 (if_then_else (eq_attr "alternative" "0,1,3,4,5")
13721 (const_string "*")))
13722 (set (attr "prefix_rex")
13723 (if_then_else (eq_attr "alternative" "0,1")
13725 (const_string "*")))
13726 (set (attr "prefix_extra")
13727 (if_then_else (eq_attr "alternative" "0,1")
13729 (const_string "*")))
13730 (set_attr "prefix" "maybe_vex,evex,maybe_vex,orig,vex,evex,orig,*,*")
13731 (set_attr "mode" "TI,TI,V2SF,TI,TI,TI,V4SF,DI,DI")])
13734 [(set (match_operand:<ssescalarmode> 0 "register_operand")
13735 (vec_select:<ssescalarmode>
13736 (match_operand:VI_128 1 "memory_operand")
13738 [(match_operand 2 "const_0_to_<ssescalarnummask>_operand")])))]
13739 "TARGET_SSE && reload_completed"
13740 [(set (match_dup 0) (match_dup 1))]
13742 int offs = INTVAL (operands[2]) * GET_MODE_SIZE (<ssescalarmode>mode);
13744 operands[1] = adjust_address (operands[1], <ssescalarmode>mode, offs);
13747 (define_insn "*vec_extractv2ti"
13748 [(set (match_operand:TI 0 "nonimmediate_operand" "=xm,vm")
13750 (match_operand:V2TI 1 "register_operand" "x,v")
13752 [(match_operand:SI 2 "const_0_to_1_operand")])))]
13755 vextract%~128\t{%2, %1, %0|%0, %1, %2}
13756 vextracti32x4\t{%2, %g1, %0|%0, %g1, %2}"
13757 [(set_attr "type" "sselog")
13758 (set_attr "prefix_extra" "1")
13759 (set_attr "length_immediate" "1")
13760 (set_attr "prefix" "vex,evex")
13761 (set_attr "mode" "OI")])
13763 (define_insn "*vec_extractv4ti"
13764 [(set (match_operand:TI 0 "nonimmediate_operand" "=vm")
13766 (match_operand:V4TI 1 "register_operand" "v")
13768 [(match_operand:SI 2 "const_0_to_3_operand")])))]
13770 "vextracti32x4\t{%2, %1, %0|%0, %1, %2}"
13771 [(set_attr "type" "sselog")
13772 (set_attr "prefix_extra" "1")
13773 (set_attr "length_immediate" "1")
13774 (set_attr "prefix" "evex")
13775 (set_attr "mode" "XI")])
13777 (define_mode_iterator VEXTRACTI128_MODE
13778 [(V4TI "TARGET_AVX512F") V2TI])
13781 [(set (match_operand:TI 0 "nonimmediate_operand")
13783 (match_operand:VEXTRACTI128_MODE 1 "register_operand")
13784 (parallel [(const_int 0)])))]
13786 && reload_completed
13787 && (TARGET_AVX512VL || !EXT_REX_SSE_REG_P (operands[1]))"
13788 [(set (match_dup 0) (match_dup 1))]
13789 "operands[1] = gen_lowpart (TImode, operands[1]);")
13791 ;; Turn SImode or DImode extraction from arbitrary SSE/AVX/AVX512F
13792 ;; vector modes into vec_extract*.
13794 [(set (match_operand:SWI48x 0 "nonimmediate_operand")
13795 (subreg:SWI48x (match_operand 1 "register_operand") 0))]
13796 "can_create_pseudo_p ()
13797 && REG_P (operands[1])
13798 && VECTOR_MODE_P (GET_MODE (operands[1]))
13799 && ((TARGET_SSE && GET_MODE_SIZE (GET_MODE (operands[1])) == 16)
13800 || (TARGET_AVX && GET_MODE_SIZE (GET_MODE (operands[1])) == 32)
13801 || (TARGET_AVX512F && GET_MODE_SIZE (GET_MODE (operands[1])) == 64))
13802 && (<MODE>mode == SImode || TARGET_64BIT || MEM_P (operands[0]))"
13803 [(set (match_dup 0) (vec_select:SWI48x (match_dup 1)
13804 (parallel [(const_int 0)])))]
13808 switch (GET_MODE_SIZE (GET_MODE (operands[1])))
13811 if (<MODE>mode == SImode)
13813 tmp = gen_reg_rtx (V8SImode);
13814 emit_insn (gen_vec_extract_lo_v16si (tmp,
13815 gen_lowpart (V16SImode,
13820 tmp = gen_reg_rtx (V4DImode);
13821 emit_insn (gen_vec_extract_lo_v8di (tmp,
13822 gen_lowpart (V8DImode,
13828 tmp = gen_reg_rtx (<ssevecmode>mode);
13829 if (<MODE>mode == SImode)
13830 emit_insn (gen_vec_extract_lo_v8si (tmp, gen_lowpart (V8SImode,
13833 emit_insn (gen_vec_extract_lo_v4di (tmp, gen_lowpart (V4DImode,
13838 operands[1] = gen_lowpart (<ssevecmode>mode, operands[1]);
13843 (define_insn "*vec_concatv2si_sse4_1"
13844 [(set (match_operand:V2SI 0 "register_operand"
13845 "=Yr,*x, x, v,Yr,*x, v, v, *y,*y")
13847 (match_operand:SI 1 "nonimmediate_operand"
13848 " 0, 0, x,Yv, 0, 0,Yv,rm, 0,rm")
13849 (match_operand:SI 2 "vector_move_operand"
13850 " rm,rm,rm,rm,Yr,*x,Yv, C,*ym, C")))]
13851 "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
13853 pinsrd\t{$1, %2, %0|%0, %2, 1}
13854 pinsrd\t{$1, %2, %0|%0, %2, 1}
13855 vpinsrd\t{$1, %2, %1, %0|%0, %1, %2, 1}
13856 vpinsrd\t{$1, %2, %1, %0|%0, %1, %2, 1}
13857 punpckldq\t{%2, %0|%0, %2}
13858 punpckldq\t{%2, %0|%0, %2}
13859 vpunpckldq\t{%2, %1, %0|%0, %1, %2}
13860 %vmovd\t{%1, %0|%0, %1}
13861 punpckldq\t{%2, %0|%0, %2}
13862 movd\t{%1, %0|%0, %1}"
13863 [(set_attr "isa" "noavx,noavx,avx,avx512dq,noavx,noavx,avx,*,*,*")
13865 (cond [(eq_attr "alternative" "7")
13866 (const_string "ssemov")
13867 (eq_attr "alternative" "8")
13868 (const_string "mmxcvt")
13869 (eq_attr "alternative" "9")
13870 (const_string "mmxmov")
13872 (const_string "sselog")))
13873 (set (attr "prefix_extra")
13874 (if_then_else (eq_attr "alternative" "0,1,2,3")
13876 (const_string "*")))
13877 (set (attr "length_immediate")
13878 (if_then_else (eq_attr "alternative" "0,1,2,3")
13880 (const_string "*")))
13881 (set_attr "prefix" "orig,orig,vex,evex,orig,orig,maybe_evex,maybe_vex,orig,orig")
13882 (set_attr "mode" "TI,TI,TI,TI,TI,TI,TI,TI,DI,DI")])
13884 ;; ??? In theory we can match memory for the MMX alternative, but allowing
13885 ;; nonimmediate_operand for operand 2 and *not* allowing memory for the SSE
13886 ;; alternatives pretty much forces the MMX alternative to be chosen.
13887 (define_insn "*vec_concatv2si"
13888 [(set (match_operand:V2SI 0 "register_operand" "=x,x ,*y,x,x,*y,*y")
13890 (match_operand:SI 1 "nonimmediate_operand" " 0,rm,rm,0,m, 0,*rm")
13891 (match_operand:SI 2 "reg_or_0_operand" " x,C ,C, x,C,*y,C")))]
13892 "TARGET_SSE && !TARGET_SSE4_1"
13894 punpckldq\t{%2, %0|%0, %2}
13895 movd\t{%1, %0|%0, %1}
13896 movd\t{%1, %0|%0, %1}
13897 unpcklps\t{%2, %0|%0, %2}
13898 movss\t{%1, %0|%0, %1}
13899 punpckldq\t{%2, %0|%0, %2}
13900 movd\t{%1, %0|%0, %1}"
13901 [(set_attr "isa" "sse2,sse2,sse2,*,*,*,*")
13902 (set_attr "type" "sselog,ssemov,mmxmov,sselog,ssemov,mmxcvt,mmxmov")
13903 (set_attr "mode" "TI,TI,DI,V4SF,SF,DI,DI")])
13905 (define_insn "*vec_concatv4si"
13906 [(set (match_operand:V4SI 0 "register_operand" "=x,v,x,x,v")
13908 (match_operand:V2SI 1 "register_operand" " 0,v,0,0,v")
13909 (match_operand:V2SI 2 "nonimmediate_operand" " x,v,x,m,m")))]
13912 punpcklqdq\t{%2, %0|%0, %2}
13913 vpunpcklqdq\t{%2, %1, %0|%0, %1, %2}
13914 movlhps\t{%2, %0|%0, %2}
13915 movhps\t{%2, %0|%0, %q2}
13916 vmovhps\t{%2, %1, %0|%0, %1, %q2}"
13917 [(set_attr "isa" "sse2_noavx,avx,noavx,noavx,avx")
13918 (set_attr "type" "sselog,sselog,ssemov,ssemov,ssemov")
13919 (set_attr "prefix" "orig,maybe_evex,orig,orig,maybe_evex")
13920 (set_attr "mode" "TI,TI,V4SF,V2SF,V2SF")])
13922 ;; movd instead of movq is required to handle broken assemblers.
13923 (define_insn "vec_concatv2di"
13924 [(set (match_operand:V2DI 0 "register_operand"
13925 "=Yr,*x,x ,v ,Yi,v ,x ,x,v ,x,x,v")
13927 (match_operand:DI 1 "nonimmediate_operand"
13928 " 0, 0,x ,Yv,r ,vm,?!*Yn,0,Yv,0,0,v")
13929 (match_operand:DI 2 "vector_move_operand"
13930 " rm,rm,rm,rm,C ,C ,C ,x,Yv,x,m,m")))]
13933 pinsrq\t{$1, %2, %0|%0, %2, 1}
13934 pinsrq\t{$1, %2, %0|%0, %2, 1}
13935 vpinsrq\t{$1, %2, %1, %0|%0, %1, %2, 1}
13936 vpinsrq\t{$1, %2, %1, %0|%0, %1, %2, 1}
13937 * return HAVE_AS_IX86_INTERUNIT_MOVQ ? \"%vmovq\t{%1, %0|%0, %1}\" : \"%vmovd\t{%1, %0|%0, %1}\";
13938 %vmovq\t{%1, %0|%0, %1}
13939 movq2dq\t{%1, %0|%0, %1}
13940 punpcklqdq\t{%2, %0|%0, %2}
13941 vpunpcklqdq\t{%2, %1, %0|%0, %1, %2}
13942 movlhps\t{%2, %0|%0, %2}
13943 movhps\t{%2, %0|%0, %2}
13944 vmovhps\t{%2, %1, %0|%0, %1, %2}"
13946 (cond [(eq_attr "alternative" "0,1")
13947 (const_string "x64_sse4_noavx")
13948 (eq_attr "alternative" "2")
13949 (const_string "x64_avx")
13950 (eq_attr "alternative" "3")
13951 (const_string "x64_avx512dq")
13952 (eq_attr "alternative" "4")
13953 (const_string "x64")
13954 (eq_attr "alternative" "5,6")
13955 (const_string "sse2")
13956 (eq_attr "alternative" "7")
13957 (const_string "sse2_noavx")
13958 (eq_attr "alternative" "8,11")
13959 (const_string "avx")
13961 (const_string "noavx")))
13964 (eq_attr "alternative" "0,1,2,3,7,8")
13965 (const_string "sselog")
13966 (const_string "ssemov")))
13967 (set (attr "prefix_rex")
13968 (if_then_else (eq_attr "alternative" "0,1,2,3,4")
13970 (const_string "*")))
13971 (set (attr "prefix_extra")
13972 (if_then_else (eq_attr "alternative" "0,1,2,3")
13974 (const_string "*")))
13975 (set (attr "length_immediate")
13976 (if_then_else (eq_attr "alternative" "0,1,2,3")
13978 (const_string "*")))
13979 (set (attr "prefix")
13980 (cond [(eq_attr "alternative" "2")
13981 (const_string "vex")
13982 (eq_attr "alternative" "3")
13983 (const_string "evex")
13984 (eq_attr "alternative" "4,5")
13985 (const_string "maybe_vex")
13986 (eq_attr "alternative" "8,11")
13987 (const_string "maybe_evex")
13989 (const_string "orig")))
13990 (set_attr "mode" "TI,TI,TI,TI,TI,TI,TI,TI,TI,V4SF,V2SF,V2SF")])
13992 (define_expand "vec_unpacks_lo_<mode>"
13993 [(match_operand:<sseunpackmode> 0 "register_operand")
13994 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
13996 "ix86_expand_sse_unpack (operands[0], operands[1], false, false); DONE;")
13998 (define_expand "vec_unpacks_hi_<mode>"
13999 [(match_operand:<sseunpackmode> 0 "register_operand")
14000 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
14002 "ix86_expand_sse_unpack (operands[0], operands[1], false, true); DONE;")
14004 (define_expand "vec_unpacku_lo_<mode>"
14005 [(match_operand:<sseunpackmode> 0 "register_operand")
14006 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
14008 "ix86_expand_sse_unpack (operands[0], operands[1], true, false); DONE;")
14010 (define_expand "vec_unpacks_lo_hi"
14011 [(set (subreg:HI (match_operand:QI 0 "register_operand") 0)
14012 (match_operand:HI 1 "register_operand"))]
14015 (define_expand "vec_unpacks_lo_si"
14016 [(set (match_operand:HI 0 "register_operand")
14017 (subreg:HI (match_operand:SI 1 "register_operand") 0))]
14020 (define_expand "vec_unpacks_lo_di"
14021 [(set (match_operand:SI 0 "register_operand")
14022 (subreg:SI (match_operand:DI 1 "register_operand") 0))]
14025 (define_expand "vec_unpacku_hi_<mode>"
14026 [(match_operand:<sseunpackmode> 0 "register_operand")
14027 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
14029 "ix86_expand_sse_unpack (operands[0], operands[1], true, true); DONE;")
14031 (define_expand "vec_unpacks_hi_hi"
14033 [(set (subreg:HI (match_operand:QI 0 "register_operand") 0)
14034 (lshiftrt:HI (match_operand:HI 1 "register_operand")
14036 (unspec [(const_int 0)] UNSPEC_MASKOP)])]
14039 (define_expand "vec_unpacks_hi_<mode>"
14041 [(set (subreg:SWI48x
14042 (match_operand:<HALFMASKMODE> 0 "register_operand") 0)
14043 (lshiftrt:SWI48x (match_operand:SWI48x 1 "register_operand")
14045 (unspec [(const_int 0)] UNSPEC_MASKOP)])]
14047 "operands[2] = GEN_INT (GET_MODE_BITSIZE (<HALFMASKMODE>mode));")
14049 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14053 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14055 (define_expand "<sse2_avx2>_uavg<mode>3<mask_name>"
14056 [(set (match_operand:VI12_AVX2 0 "register_operand")
14057 (truncate:VI12_AVX2
14058 (lshiftrt:<ssedoublemode>
14059 (plus:<ssedoublemode>
14060 (plus:<ssedoublemode>
14061 (zero_extend:<ssedoublemode>
14062 (match_operand:VI12_AVX2 1 "vector_operand"))
14063 (zero_extend:<ssedoublemode>
14064 (match_operand:VI12_AVX2 2 "vector_operand")))
14065 (match_dup <mask_expand_op3>))
14067 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
14070 if (<mask_applied>)
14072 operands[3] = CONST1_RTX(<MODE>mode);
14073 ix86_fixup_binary_operands_no_copy (PLUS, <MODE>mode, operands);
14075 if (<mask_applied>)
14077 operands[5] = operands[3];
14082 (define_insn "*<sse2_avx2>_uavg<mode>3<mask_name>"
14083 [(set (match_operand:VI12_AVX2 0 "register_operand" "=x,v")
14084 (truncate:VI12_AVX2
14085 (lshiftrt:<ssedoublemode>
14086 (plus:<ssedoublemode>
14087 (plus:<ssedoublemode>
14088 (zero_extend:<ssedoublemode>
14089 (match_operand:VI12_AVX2 1 "vector_operand" "%0,v"))
14090 (zero_extend:<ssedoublemode>
14091 (match_operand:VI12_AVX2 2 "vector_operand" "xBm,vm")))
14092 (match_operand:VI12_AVX2 <mask_expand_op3> "const1_operand"))
14094 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>
14095 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
14097 pavg<ssemodesuffix>\t{%2, %0|%0, %2}
14098 vpavg<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
14099 [(set_attr "isa" "noavx,avx")
14100 (set_attr "type" "sseiadd")
14101 (set_attr "prefix_data16" "1,*")
14102 (set_attr "prefix" "orig,<mask_prefix>")
14103 (set_attr "mode" "<sseinsnmode>")])
14105 ;; The correct representation for this is absolutely enormous, and
14106 ;; surely not generally useful.
14107 (define_insn "<sse2_avx2>_psadbw"
14108 [(set (match_operand:VI8_AVX2_AVX512BW 0 "register_operand" "=x,v")
14109 (unspec:VI8_AVX2_AVX512BW
14110 [(match_operand:<ssebytemode> 1 "register_operand" "0,v")
14111 (match_operand:<ssebytemode> 2 "vector_operand" "xBm,vm")]
14115 psadbw\t{%2, %0|%0, %2}
14116 vpsadbw\t{%2, %1, %0|%0, %1, %2}"
14117 [(set_attr "isa" "noavx,avx")
14118 (set_attr "type" "sseiadd")
14119 (set_attr "atom_unit" "simul")
14120 (set_attr "prefix_data16" "1,*")
14121 (set_attr "prefix" "orig,maybe_evex")
14122 (set_attr "mode" "<sseinsnmode>")])
14124 (define_insn "<sse>_movmsk<ssemodesuffix><avxsizesuffix>"
14125 [(set (match_operand:SI 0 "register_operand" "=r")
14127 [(match_operand:VF_128_256 1 "register_operand" "x")]
14130 "%vmovmsk<ssemodesuffix>\t{%1, %0|%0, %1}"
14131 [(set_attr "type" "ssemov")
14132 (set_attr "prefix" "maybe_vex")
14133 (set_attr "mode" "<MODE>")])
14135 (define_insn "*<sse>_movmsk<ssemodesuffix><avxsizesuffix>_zext"
14136 [(set (match_operand:DI 0 "register_operand" "=r")
14139 [(match_operand:VF_128_256 1 "register_operand" "x")]
14141 "TARGET_64BIT && TARGET_SSE"
14142 "%vmovmsk<ssemodesuffix>\t{%1, %k0|%k0, %1}"
14143 [(set_attr "type" "ssemov")
14144 (set_attr "prefix" "maybe_vex")
14145 (set_attr "mode" "<MODE>")])
14147 (define_insn "<sse2_avx2>_pmovmskb"
14148 [(set (match_operand:SI 0 "register_operand" "=r")
14150 [(match_operand:VI1_AVX2 1 "register_operand" "x")]
14153 "%vpmovmskb\t{%1, %0|%0, %1}"
14154 [(set_attr "type" "ssemov")
14155 (set (attr "prefix_data16")
14157 (match_test "TARGET_AVX")
14159 (const_string "1")))
14160 (set_attr "prefix" "maybe_vex")
14161 (set_attr "mode" "SI")])
14163 (define_insn "*<sse2_avx2>_pmovmskb_zext"
14164 [(set (match_operand:DI 0 "register_operand" "=r")
14167 [(match_operand:VI1_AVX2 1 "register_operand" "x")]
14169 "TARGET_64BIT && TARGET_SSE2"
14170 "%vpmovmskb\t{%1, %k0|%k0, %1}"
14171 [(set_attr "type" "ssemov")
14172 (set (attr "prefix_data16")
14174 (match_test "TARGET_AVX")
14176 (const_string "1")))
14177 (set_attr "prefix" "maybe_vex")
14178 (set_attr "mode" "SI")])
14180 (define_expand "sse2_maskmovdqu"
14181 [(set (match_operand:V16QI 0 "memory_operand")
14182 (unspec:V16QI [(match_operand:V16QI 1 "register_operand")
14183 (match_operand:V16QI 2 "register_operand")
14188 (define_insn "*sse2_maskmovdqu"
14189 [(set (mem:V16QI (match_operand:P 0 "register_operand" "D"))
14190 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "x")
14191 (match_operand:V16QI 2 "register_operand" "x")
14192 (mem:V16QI (match_dup 0))]
14196 /* We can't use %^ here due to ASM_OUTPUT_OPCODE processing
14197 that requires %v to be at the beginning of the opcode name. */
14198 if (Pmode != word_mode)
14199 fputs ("\taddr32", asm_out_file);
14200 return "%vmaskmovdqu\t{%2, %1|%1, %2}";
14202 [(set_attr "type" "ssemov")
14203 (set_attr "prefix_data16" "1")
14204 (set (attr "length_address")
14205 (symbol_ref ("Pmode != word_mode")))
14206 ;; The implicit %rdi operand confuses default length_vex computation.
14207 (set (attr "length_vex")
14208 (symbol_ref ("3 + REX_SSE_REGNO_P (REGNO (operands[2]))")))
14209 (set_attr "prefix" "maybe_vex")
14210 (set_attr "znver1_decode" "vector")
14211 (set_attr "mode" "TI")])
14213 (define_insn "sse_ldmxcsr"
14214 [(unspec_volatile [(match_operand:SI 0 "memory_operand" "m")]
14218 [(set_attr "type" "sse")
14219 (set_attr "atom_sse_attr" "mxcsr")
14220 (set_attr "prefix" "maybe_vex")
14221 (set_attr "memory" "load")])
14223 (define_insn "sse_stmxcsr"
14224 [(set (match_operand:SI 0 "memory_operand" "=m")
14225 (unspec_volatile:SI [(const_int 0)] UNSPECV_STMXCSR))]
14228 [(set_attr "type" "sse")
14229 (set_attr "atom_sse_attr" "mxcsr")
14230 (set_attr "prefix" "maybe_vex")
14231 (set_attr "memory" "store")])
14233 (define_insn "sse2_clflush"
14234 [(unspec_volatile [(match_operand 0 "address_operand" "p")]
14238 [(set_attr "type" "sse")
14239 (set_attr "atom_sse_attr" "fence")
14240 (set_attr "memory" "unknown")])
14242 ;; As per AMD and Intel ISA manuals, the first operand is extensions
14243 ;; and it goes to %ecx. The second operand received is hints and it goes
14245 (define_insn "sse3_mwait"
14246 [(unspec_volatile [(match_operand:SI 0 "register_operand" "c")
14247 (match_operand:SI 1 "register_operand" "a")]
14250 ;; 64bit version is "mwait %rax,%rcx". But only lower 32bits are used.
14251 ;; Since 32bit register operands are implicitly zero extended to 64bit,
14252 ;; we only need to set up 32bit registers.
14254 [(set_attr "length" "3")])
14256 (define_insn "sse3_monitor_<mode>"
14257 [(unspec_volatile [(match_operand:P 0 "register_operand" "a")
14258 (match_operand:SI 1 "register_operand" "c")
14259 (match_operand:SI 2 "register_operand" "d")]
14262 ;; 64bit version is "monitor %rax,%rcx,%rdx". But only lower 32bits in
14263 ;; RCX and RDX are used. Since 32bit register operands are implicitly
14264 ;; zero extended to 64bit, we only need to set up 32bit registers.
14266 [(set (attr "length")
14267 (symbol_ref ("(Pmode != word_mode) + 3")))])
14269 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14271 ;; SSSE3 instructions
14273 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14275 (define_code_iterator ssse3_plusminus [plus ss_plus minus ss_minus])
14277 (define_insn "avx2_ph<plusminus_mnemonic>wv16hi3"
14278 [(set (match_operand:V16HI 0 "register_operand" "=x")
14283 (ssse3_plusminus:HI
14285 (match_operand:V16HI 1 "register_operand" "x")
14286 (parallel [(const_int 0)]))
14287 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
14288 (ssse3_plusminus:HI
14289 (vec_select:HI (match_dup 1) (parallel [(const_int 2)]))
14290 (vec_select:HI (match_dup 1) (parallel [(const_int 3)]))))
14292 (ssse3_plusminus:HI
14293 (vec_select:HI (match_dup 1) (parallel [(const_int 4)]))
14294 (vec_select:HI (match_dup 1) (parallel [(const_int 5)])))
14295 (ssse3_plusminus:HI
14296 (vec_select:HI (match_dup 1) (parallel [(const_int 6)]))
14297 (vec_select:HI (match_dup 1) (parallel [(const_int 7)])))))
14300 (ssse3_plusminus:HI
14301 (vec_select:HI (match_dup 1) (parallel [(const_int 8)]))
14302 (vec_select:HI (match_dup 1) (parallel [(const_int 9)])))
14303 (ssse3_plusminus:HI
14304 (vec_select:HI (match_dup 1) (parallel [(const_int 10)]))
14305 (vec_select:HI (match_dup 1) (parallel [(const_int 11)]))))
14307 (ssse3_plusminus:HI
14308 (vec_select:HI (match_dup 1) (parallel [(const_int 12)]))
14309 (vec_select:HI (match_dup 1) (parallel [(const_int 13)])))
14310 (ssse3_plusminus:HI
14311 (vec_select:HI (match_dup 1) (parallel [(const_int 14)]))
14312 (vec_select:HI (match_dup 1) (parallel [(const_int 15)]))))))
14316 (ssse3_plusminus:HI
14318 (match_operand:V16HI 2 "nonimmediate_operand" "xm")
14319 (parallel [(const_int 0)]))
14320 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))
14321 (ssse3_plusminus:HI
14322 (vec_select:HI (match_dup 2) (parallel [(const_int 2)]))
14323 (vec_select:HI (match_dup 2) (parallel [(const_int 3)]))))
14325 (ssse3_plusminus:HI
14326 (vec_select:HI (match_dup 2) (parallel [(const_int 4)]))
14327 (vec_select:HI (match_dup 2) (parallel [(const_int 5)])))
14328 (ssse3_plusminus:HI
14329 (vec_select:HI (match_dup 2) (parallel [(const_int 6)]))
14330 (vec_select:HI (match_dup 2) (parallel [(const_int 7)])))))
14333 (ssse3_plusminus:HI
14334 (vec_select:HI (match_dup 2) (parallel [(const_int 8)]))
14335 (vec_select:HI (match_dup 2) (parallel [(const_int 9)])))
14336 (ssse3_plusminus:HI
14337 (vec_select:HI (match_dup 2) (parallel [(const_int 10)]))
14338 (vec_select:HI (match_dup 2) (parallel [(const_int 11)]))))
14340 (ssse3_plusminus:HI
14341 (vec_select:HI (match_dup 2) (parallel [(const_int 12)]))
14342 (vec_select:HI (match_dup 2) (parallel [(const_int 13)])))
14343 (ssse3_plusminus:HI
14344 (vec_select:HI (match_dup 2) (parallel [(const_int 14)]))
14345 (vec_select:HI (match_dup 2) (parallel [(const_int 15)]))))))))]
14347 "vph<plusminus_mnemonic>w\t{%2, %1, %0|%0, %1, %2}"
14348 [(set_attr "type" "sseiadd")
14349 (set_attr "prefix_extra" "1")
14350 (set_attr "prefix" "vex")
14351 (set_attr "mode" "OI")])
14353 (define_insn "ssse3_ph<plusminus_mnemonic>wv8hi3"
14354 [(set (match_operand:V8HI 0 "register_operand" "=x,x")
14358 (ssse3_plusminus:HI
14360 (match_operand:V8HI 1 "register_operand" "0,x")
14361 (parallel [(const_int 0)]))
14362 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
14363 (ssse3_plusminus:HI
14364 (vec_select:HI (match_dup 1) (parallel [(const_int 2)]))
14365 (vec_select:HI (match_dup 1) (parallel [(const_int 3)]))))
14367 (ssse3_plusminus:HI
14368 (vec_select:HI (match_dup 1) (parallel [(const_int 4)]))
14369 (vec_select:HI (match_dup 1) (parallel [(const_int 5)])))
14370 (ssse3_plusminus:HI
14371 (vec_select:HI (match_dup 1) (parallel [(const_int 6)]))
14372 (vec_select:HI (match_dup 1) (parallel [(const_int 7)])))))
14375 (ssse3_plusminus:HI
14377 (match_operand:V8HI 2 "vector_operand" "xBm,xm")
14378 (parallel [(const_int 0)]))
14379 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))
14380 (ssse3_plusminus:HI
14381 (vec_select:HI (match_dup 2) (parallel [(const_int 2)]))
14382 (vec_select:HI (match_dup 2) (parallel [(const_int 3)]))))
14384 (ssse3_plusminus:HI
14385 (vec_select:HI (match_dup 2) (parallel [(const_int 4)]))
14386 (vec_select:HI (match_dup 2) (parallel [(const_int 5)])))
14387 (ssse3_plusminus:HI
14388 (vec_select:HI (match_dup 2) (parallel [(const_int 6)]))
14389 (vec_select:HI (match_dup 2) (parallel [(const_int 7)])))))))]
14392 ph<plusminus_mnemonic>w\t{%2, %0|%0, %2}
14393 vph<plusminus_mnemonic>w\t{%2, %1, %0|%0, %1, %2}"
14394 [(set_attr "isa" "noavx,avx")
14395 (set_attr "type" "sseiadd")
14396 (set_attr "atom_unit" "complex")
14397 (set_attr "prefix_data16" "1,*")
14398 (set_attr "prefix_extra" "1")
14399 (set_attr "prefix" "orig,vex")
14400 (set_attr "mode" "TI")])
14402 (define_insn "ssse3_ph<plusminus_mnemonic>wv4hi3"
14403 [(set (match_operand:V4HI 0 "register_operand" "=y")
14406 (ssse3_plusminus:HI
14408 (match_operand:V4HI 1 "register_operand" "0")
14409 (parallel [(const_int 0)]))
14410 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
14411 (ssse3_plusminus:HI
14412 (vec_select:HI (match_dup 1) (parallel [(const_int 2)]))
14413 (vec_select:HI (match_dup 1) (parallel [(const_int 3)]))))
14415 (ssse3_plusminus:HI
14417 (match_operand:V4HI 2 "nonimmediate_operand" "ym")
14418 (parallel [(const_int 0)]))
14419 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))
14420 (ssse3_plusminus:HI
14421 (vec_select:HI (match_dup 2) (parallel [(const_int 2)]))
14422 (vec_select:HI (match_dup 2) (parallel [(const_int 3)]))))))]
14424 "ph<plusminus_mnemonic>w\t{%2, %0|%0, %2}"
14425 [(set_attr "type" "sseiadd")
14426 (set_attr "atom_unit" "complex")
14427 (set_attr "prefix_extra" "1")
14428 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14429 (set_attr "mode" "DI")])
14431 (define_insn "avx2_ph<plusminus_mnemonic>dv8si3"
14432 [(set (match_operand:V8SI 0 "register_operand" "=x")
14438 (match_operand:V8SI 1 "register_operand" "x")
14439 (parallel [(const_int 0)]))
14440 (vec_select:SI (match_dup 1) (parallel [(const_int 1)])))
14442 (vec_select:SI (match_dup 1) (parallel [(const_int 2)]))
14443 (vec_select:SI (match_dup 1) (parallel [(const_int 3)]))))
14446 (vec_select:SI (match_dup 1) (parallel [(const_int 4)]))
14447 (vec_select:SI (match_dup 1) (parallel [(const_int 5)])))
14449 (vec_select:SI (match_dup 1) (parallel [(const_int 6)]))
14450 (vec_select:SI (match_dup 1) (parallel [(const_int 7)])))))
14455 (match_operand:V8SI 2 "nonimmediate_operand" "xm")
14456 (parallel [(const_int 0)]))
14457 (vec_select:SI (match_dup 2) (parallel [(const_int 1)])))
14459 (vec_select:SI (match_dup 2) (parallel [(const_int 2)]))
14460 (vec_select:SI (match_dup 2) (parallel [(const_int 3)]))))
14463 (vec_select:SI (match_dup 2) (parallel [(const_int 4)]))
14464 (vec_select:SI (match_dup 2) (parallel [(const_int 5)])))
14466 (vec_select:SI (match_dup 2) (parallel [(const_int 6)]))
14467 (vec_select:SI (match_dup 2) (parallel [(const_int 7)])))))))]
14469 "vph<plusminus_mnemonic>d\t{%2, %1, %0|%0, %1, %2}"
14470 [(set_attr "type" "sseiadd")
14471 (set_attr "prefix_extra" "1")
14472 (set_attr "prefix" "vex")
14473 (set_attr "mode" "OI")])
14475 (define_insn "ssse3_ph<plusminus_mnemonic>dv4si3"
14476 [(set (match_operand:V4SI 0 "register_operand" "=x,x")
14481 (match_operand:V4SI 1 "register_operand" "0,x")
14482 (parallel [(const_int 0)]))
14483 (vec_select:SI (match_dup 1) (parallel [(const_int 1)])))
14485 (vec_select:SI (match_dup 1) (parallel [(const_int 2)]))
14486 (vec_select:SI (match_dup 1) (parallel [(const_int 3)]))))
14490 (match_operand:V4SI 2 "vector_operand" "xBm,xm")
14491 (parallel [(const_int 0)]))
14492 (vec_select:SI (match_dup 2) (parallel [(const_int 1)])))
14494 (vec_select:SI (match_dup 2) (parallel [(const_int 2)]))
14495 (vec_select:SI (match_dup 2) (parallel [(const_int 3)]))))))]
14498 ph<plusminus_mnemonic>d\t{%2, %0|%0, %2}
14499 vph<plusminus_mnemonic>d\t{%2, %1, %0|%0, %1, %2}"
14500 [(set_attr "isa" "noavx,avx")
14501 (set_attr "type" "sseiadd")
14502 (set_attr "atom_unit" "complex")
14503 (set_attr "prefix_data16" "1,*")
14504 (set_attr "prefix_extra" "1")
14505 (set_attr "prefix" "orig,vex")
14506 (set_attr "mode" "TI")])
14508 (define_insn "ssse3_ph<plusminus_mnemonic>dv2si3"
14509 [(set (match_operand:V2SI 0 "register_operand" "=y")
14513 (match_operand:V2SI 1 "register_operand" "0")
14514 (parallel [(const_int 0)]))
14515 (vec_select:SI (match_dup 1) (parallel [(const_int 1)])))
14518 (match_operand:V2SI 2 "nonimmediate_operand" "ym")
14519 (parallel [(const_int 0)]))
14520 (vec_select:SI (match_dup 2) (parallel [(const_int 1)])))))]
14522 "ph<plusminus_mnemonic>d\t{%2, %0|%0, %2}"
14523 [(set_attr "type" "sseiadd")
14524 (set_attr "atom_unit" "complex")
14525 (set_attr "prefix_extra" "1")
14526 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14527 (set_attr "mode" "DI")])
14529 (define_insn "avx2_pmaddubsw256"
14530 [(set (match_operand:V16HI 0 "register_operand" "=x,v")
14535 (match_operand:V32QI 1 "register_operand" "x,v")
14536 (parallel [(const_int 0) (const_int 2)
14537 (const_int 4) (const_int 6)
14538 (const_int 8) (const_int 10)
14539 (const_int 12) (const_int 14)
14540 (const_int 16) (const_int 18)
14541 (const_int 20) (const_int 22)
14542 (const_int 24) (const_int 26)
14543 (const_int 28) (const_int 30)])))
14546 (match_operand:V32QI 2 "nonimmediate_operand" "xm,vm")
14547 (parallel [(const_int 0) (const_int 2)
14548 (const_int 4) (const_int 6)
14549 (const_int 8) (const_int 10)
14550 (const_int 12) (const_int 14)
14551 (const_int 16) (const_int 18)
14552 (const_int 20) (const_int 22)
14553 (const_int 24) (const_int 26)
14554 (const_int 28) (const_int 30)]))))
14557 (vec_select:V16QI (match_dup 1)
14558 (parallel [(const_int 1) (const_int 3)
14559 (const_int 5) (const_int 7)
14560 (const_int 9) (const_int 11)
14561 (const_int 13) (const_int 15)
14562 (const_int 17) (const_int 19)
14563 (const_int 21) (const_int 23)
14564 (const_int 25) (const_int 27)
14565 (const_int 29) (const_int 31)])))
14567 (vec_select:V16QI (match_dup 2)
14568 (parallel [(const_int 1) (const_int 3)
14569 (const_int 5) (const_int 7)
14570 (const_int 9) (const_int 11)
14571 (const_int 13) (const_int 15)
14572 (const_int 17) (const_int 19)
14573 (const_int 21) (const_int 23)
14574 (const_int 25) (const_int 27)
14575 (const_int 29) (const_int 31)]))))))]
14577 "vpmaddubsw\t{%2, %1, %0|%0, %1, %2}"
14578 [(set_attr "isa" "*,avx512bw")
14579 (set_attr "type" "sseiadd")
14580 (set_attr "prefix_extra" "1")
14581 (set_attr "prefix" "vex,evex")
14582 (set_attr "mode" "OI")])
14584 ;; The correct representation for this is absolutely enormous, and
14585 ;; surely not generally useful.
14586 (define_insn "avx512bw_pmaddubsw512<mode><mask_name>"
14587 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
14588 (unspec:VI2_AVX512VL
14589 [(match_operand:<dbpsadbwmode> 1 "register_operand" "v")
14590 (match_operand:<dbpsadbwmode> 2 "nonimmediate_operand" "vm")]
14591 UNSPEC_PMADDUBSW512))]
14593 "vpmaddubsw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}";
14594 [(set_attr "type" "sseiadd")
14595 (set_attr "prefix" "evex")
14596 (set_attr "mode" "XI")])
14598 (define_insn "avx512bw_umulhrswv32hi3<mask_name>"
14599 [(set (match_operand:V32HI 0 "register_operand" "=v")
14606 (match_operand:V32HI 1 "nonimmediate_operand" "%v"))
14608 (match_operand:V32HI 2 "nonimmediate_operand" "vm")))
14610 (const_vector:V32HI [(const_int 1) (const_int 1)
14611 (const_int 1) (const_int 1)
14612 (const_int 1) (const_int 1)
14613 (const_int 1) (const_int 1)
14614 (const_int 1) (const_int 1)
14615 (const_int 1) (const_int 1)
14616 (const_int 1) (const_int 1)
14617 (const_int 1) (const_int 1)
14618 (const_int 1) (const_int 1)
14619 (const_int 1) (const_int 1)
14620 (const_int 1) (const_int 1)
14621 (const_int 1) (const_int 1)
14622 (const_int 1) (const_int 1)
14623 (const_int 1) (const_int 1)
14624 (const_int 1) (const_int 1)
14625 (const_int 1) (const_int 1)]))
14628 "vpmulhrsw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
14629 [(set_attr "type" "sseimul")
14630 (set_attr "prefix" "evex")
14631 (set_attr "mode" "XI")])
14633 (define_insn "ssse3_pmaddubsw128"
14634 [(set (match_operand:V8HI 0 "register_operand" "=x,x,v")
14639 (match_operand:V16QI 1 "register_operand" "0,x,v")
14640 (parallel [(const_int 0) (const_int 2)
14641 (const_int 4) (const_int 6)
14642 (const_int 8) (const_int 10)
14643 (const_int 12) (const_int 14)])))
14646 (match_operand:V16QI 2 "vector_operand" "xBm,xm,vm")
14647 (parallel [(const_int 0) (const_int 2)
14648 (const_int 4) (const_int 6)
14649 (const_int 8) (const_int 10)
14650 (const_int 12) (const_int 14)]))))
14653 (vec_select:V8QI (match_dup 1)
14654 (parallel [(const_int 1) (const_int 3)
14655 (const_int 5) (const_int 7)
14656 (const_int 9) (const_int 11)
14657 (const_int 13) (const_int 15)])))
14659 (vec_select:V8QI (match_dup 2)
14660 (parallel [(const_int 1) (const_int 3)
14661 (const_int 5) (const_int 7)
14662 (const_int 9) (const_int 11)
14663 (const_int 13) (const_int 15)]))))))]
14666 pmaddubsw\t{%2, %0|%0, %2}
14667 vpmaddubsw\t{%2, %1, %0|%0, %1, %2}
14668 vpmaddubsw\t{%2, %1, %0|%0, %1, %2}"
14669 [(set_attr "isa" "noavx,avx,avx512bw")
14670 (set_attr "type" "sseiadd")
14671 (set_attr "atom_unit" "simul")
14672 (set_attr "prefix_data16" "1,*,*")
14673 (set_attr "prefix_extra" "1")
14674 (set_attr "prefix" "orig,vex,evex")
14675 (set_attr "mode" "TI")])
14677 (define_insn "ssse3_pmaddubsw"
14678 [(set (match_operand:V4HI 0 "register_operand" "=y")
14683 (match_operand:V8QI 1 "register_operand" "0")
14684 (parallel [(const_int 0) (const_int 2)
14685 (const_int 4) (const_int 6)])))
14688 (match_operand:V8QI 2 "nonimmediate_operand" "ym")
14689 (parallel [(const_int 0) (const_int 2)
14690 (const_int 4) (const_int 6)]))))
14693 (vec_select:V4QI (match_dup 1)
14694 (parallel [(const_int 1) (const_int 3)
14695 (const_int 5) (const_int 7)])))
14697 (vec_select:V4QI (match_dup 2)
14698 (parallel [(const_int 1) (const_int 3)
14699 (const_int 5) (const_int 7)]))))))]
14701 "pmaddubsw\t{%2, %0|%0, %2}"
14702 [(set_attr "type" "sseiadd")
14703 (set_attr "atom_unit" "simul")
14704 (set_attr "prefix_extra" "1")
14705 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14706 (set_attr "mode" "DI")])
14708 (define_mode_iterator PMULHRSW
14709 [V4HI V8HI (V16HI "TARGET_AVX2")])
14711 (define_expand "<ssse3_avx2>_pmulhrsw<mode>3_mask"
14712 [(set (match_operand:PMULHRSW 0 "register_operand")
14713 (vec_merge:PMULHRSW
14715 (lshiftrt:<ssedoublemode>
14716 (plus:<ssedoublemode>
14717 (lshiftrt:<ssedoublemode>
14718 (mult:<ssedoublemode>
14719 (sign_extend:<ssedoublemode>
14720 (match_operand:PMULHRSW 1 "nonimmediate_operand"))
14721 (sign_extend:<ssedoublemode>
14722 (match_operand:PMULHRSW 2 "nonimmediate_operand")))
14726 (match_operand:PMULHRSW 3 "register_operand")
14727 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
14728 "TARGET_AVX512BW && TARGET_AVX512VL"
14730 operands[5] = CONST1_RTX(<MODE>mode);
14731 ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);
14734 (define_expand "<ssse3_avx2>_pmulhrsw<mode>3"
14735 [(set (match_operand:PMULHRSW 0 "register_operand")
14737 (lshiftrt:<ssedoublemode>
14738 (plus:<ssedoublemode>
14739 (lshiftrt:<ssedoublemode>
14740 (mult:<ssedoublemode>
14741 (sign_extend:<ssedoublemode>
14742 (match_operand:PMULHRSW 1 "nonimmediate_operand"))
14743 (sign_extend:<ssedoublemode>
14744 (match_operand:PMULHRSW 2 "nonimmediate_operand")))
14750 operands[3] = CONST1_RTX(<MODE>mode);
14751 ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);
14754 (define_insn "*<ssse3_avx2>_pmulhrsw<mode>3<mask_name>"
14755 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,x,v")
14757 (lshiftrt:<ssedoublemode>
14758 (plus:<ssedoublemode>
14759 (lshiftrt:<ssedoublemode>
14760 (mult:<ssedoublemode>
14761 (sign_extend:<ssedoublemode>
14762 (match_operand:VI2_AVX2 1 "vector_operand" "%0,x,v"))
14763 (sign_extend:<ssedoublemode>
14764 (match_operand:VI2_AVX2 2 "vector_operand" "xBm,xm,vm")))
14766 (match_operand:VI2_AVX2 3 "const1_operand"))
14768 "TARGET_SSSE3 && <mask_mode512bit_condition> && <mask_avx512bw_condition>
14769 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
14771 pmulhrsw\t{%2, %0|%0, %2}
14772 vpmulhrsw\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}
14773 vpmulhrsw\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}"
14774 [(set_attr "isa" "noavx,avx,avx512bw")
14775 (set_attr "type" "sseimul")
14776 (set_attr "prefix_data16" "1,*,*")
14777 (set_attr "prefix_extra" "1")
14778 (set_attr "prefix" "orig,maybe_evex,evex")
14779 (set_attr "mode" "<sseinsnmode>")])
14781 (define_insn "*ssse3_pmulhrswv4hi3"
14782 [(set (match_operand:V4HI 0 "register_operand" "=y")
14789 (match_operand:V4HI 1 "nonimmediate_operand" "%0"))
14791 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))
14793 (match_operand:V4HI 3 "const1_operand"))
14795 "TARGET_SSSE3 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
14796 "pmulhrsw\t{%2, %0|%0, %2}"
14797 [(set_attr "type" "sseimul")
14798 (set_attr "prefix_extra" "1")
14799 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14800 (set_attr "mode" "DI")])
14802 (define_insn "<ssse3_avx2>_pshufb<mode>3<mask_name>"
14803 [(set (match_operand:VI1_AVX512 0 "register_operand" "=x,x,v")
14805 [(match_operand:VI1_AVX512 1 "register_operand" "0,x,v")
14806 (match_operand:VI1_AVX512 2 "vector_operand" "xBm,xm,vm")]
14808 "TARGET_SSSE3 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
14810 pshufb\t{%2, %0|%0, %2}
14811 vpshufb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
14812 vpshufb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
14813 [(set_attr "isa" "noavx,avx,avx512bw")
14814 (set_attr "type" "sselog1")
14815 (set_attr "prefix_data16" "1,*,*")
14816 (set_attr "prefix_extra" "1")
14817 (set_attr "prefix" "orig,maybe_evex,evex")
14818 (set_attr "btver2_decode" "vector")
14819 (set_attr "mode" "<sseinsnmode>")])
14821 (define_insn "ssse3_pshufbv8qi3"
14822 [(set (match_operand:V8QI 0 "register_operand" "=y")
14823 (unspec:V8QI [(match_operand:V8QI 1 "register_operand" "0")
14824 (match_operand:V8QI 2 "nonimmediate_operand" "ym")]
14827 "pshufb\t{%2, %0|%0, %2}";
14828 [(set_attr "type" "sselog1")
14829 (set_attr "prefix_extra" "1")
14830 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14831 (set_attr "mode" "DI")])
14833 (define_insn "<ssse3_avx2>_psign<mode>3"
14834 [(set (match_operand:VI124_AVX2 0 "register_operand" "=x,x")
14836 [(match_operand:VI124_AVX2 1 "register_operand" "0,x")
14837 (match_operand:VI124_AVX2 2 "vector_operand" "xBm,xm")]
14841 psign<ssemodesuffix>\t{%2, %0|%0, %2}
14842 vpsign<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
14843 [(set_attr "isa" "noavx,avx")
14844 (set_attr "type" "sselog1")
14845 (set_attr "prefix_data16" "1,*")
14846 (set_attr "prefix_extra" "1")
14847 (set_attr "prefix" "orig,vex")
14848 (set_attr "mode" "<sseinsnmode>")])
14850 (define_insn "ssse3_psign<mode>3"
14851 [(set (match_operand:MMXMODEI 0 "register_operand" "=y")
14853 [(match_operand:MMXMODEI 1 "register_operand" "0")
14854 (match_operand:MMXMODEI 2 "nonimmediate_operand" "ym")]
14857 "psign<mmxvecsize>\t{%2, %0|%0, %2}";
14858 [(set_attr "type" "sselog1")
14859 (set_attr "prefix_extra" "1")
14860 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14861 (set_attr "mode" "DI")])
14863 (define_insn "<ssse3_avx2>_palignr<mode>_mask"
14864 [(set (match_operand:VI1_AVX512 0 "register_operand" "=v")
14865 (vec_merge:VI1_AVX512
14867 [(match_operand:VI1_AVX512 1 "register_operand" "v")
14868 (match_operand:VI1_AVX512 2 "nonimmediate_operand" "vm")
14869 (match_operand:SI 3 "const_0_to_255_mul_8_operand" "n")]
14871 (match_operand:VI1_AVX512 4 "vector_move_operand" "0C")
14872 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
14873 "TARGET_AVX512BW && (<MODE_SIZE> == 64 || TARGET_AVX512VL)"
14875 operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
14876 return "vpalignr\t{%3, %2, %1, %0%{%5%}%N4|%0%{%5%}%N4, %1, %2, %3}";
14878 [(set_attr "type" "sseishft")
14879 (set_attr "atom_unit" "sishuf")
14880 (set_attr "prefix_extra" "1")
14881 (set_attr "length_immediate" "1")
14882 (set_attr "prefix" "evex")
14883 (set_attr "mode" "<sseinsnmode>")])
14885 (define_insn "<ssse3_avx2>_palignr<mode>"
14886 [(set (match_operand:SSESCALARMODE 0 "register_operand" "=x,x,v")
14887 (unspec:SSESCALARMODE
14888 [(match_operand:SSESCALARMODE 1 "register_operand" "0,x,v")
14889 (match_operand:SSESCALARMODE 2 "vector_operand" "xBm,xm,vm")
14890 (match_operand:SI 3 "const_0_to_255_mul_8_operand" "n,n,n")]
14894 operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
14896 switch (which_alternative)
14899 return "palignr\t{%3, %2, %0|%0, %2, %3}";
14902 return "vpalignr\t{%3, %2, %1, %0|%0, %1, %2, %3}";
14904 gcc_unreachable ();
14907 [(set_attr "isa" "noavx,avx,avx512bw")
14908 (set_attr "type" "sseishft")
14909 (set_attr "atom_unit" "sishuf")
14910 (set_attr "prefix_data16" "1,*,*")
14911 (set_attr "prefix_extra" "1")
14912 (set_attr "length_immediate" "1")
14913 (set_attr "prefix" "orig,vex,evex")
14914 (set_attr "mode" "<sseinsnmode>")])
14916 (define_insn "ssse3_palignrdi"
14917 [(set (match_operand:DI 0 "register_operand" "=y")
14918 (unspec:DI [(match_operand:DI 1 "register_operand" "0")
14919 (match_operand:DI 2 "nonimmediate_operand" "ym")
14920 (match_operand:SI 3 "const_0_to_255_mul_8_operand" "n")]
14924 operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
14925 return "palignr\t{%3, %2, %0|%0, %2, %3}";
14927 [(set_attr "type" "sseishft")
14928 (set_attr "atom_unit" "sishuf")
14929 (set_attr "prefix_extra" "1")
14930 (set_attr "length_immediate" "1")
14931 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14932 (set_attr "mode" "DI")])
14934 ;; Mode iterator to handle singularity w/ absence of V2DI and V4DI
14935 ;; modes for abs instruction on pre AVX-512 targets.
14936 (define_mode_iterator VI1248_AVX512VL_AVX512BW
14937 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI
14938 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI
14939 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX2") V4SI
14940 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")])
14942 (define_insn "*abs<mode>2"
14943 [(set (match_operand:VI1248_AVX512VL_AVX512BW 0 "register_operand" "=v")
14944 (abs:VI1248_AVX512VL_AVX512BW
14945 (match_operand:VI1248_AVX512VL_AVX512BW 1 "vector_operand" "vBm")))]
14947 "%vpabs<ssemodesuffix>\t{%1, %0|%0, %1}"
14948 [(set_attr "type" "sselog1")
14949 (set_attr "prefix_data16" "1")
14950 (set_attr "prefix_extra" "1")
14951 (set_attr "prefix" "maybe_vex")
14952 (set_attr "mode" "<sseinsnmode>")])
14954 (define_insn "abs<mode>2_mask"
14955 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
14956 (vec_merge:VI48_AVX512VL
14958 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm"))
14959 (match_operand:VI48_AVX512VL 2 "vector_move_operand" "0C")
14960 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
14962 "vpabs<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
14963 [(set_attr "type" "sselog1")
14964 (set_attr "prefix" "evex")
14965 (set_attr "mode" "<sseinsnmode>")])
14967 (define_insn "abs<mode>2_mask"
14968 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
14969 (vec_merge:VI12_AVX512VL
14971 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "vm"))
14972 (match_operand:VI12_AVX512VL 2 "vector_move_operand" "0C")
14973 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
14975 "vpabs<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
14976 [(set_attr "type" "sselog1")
14977 (set_attr "prefix" "evex")
14978 (set_attr "mode" "<sseinsnmode>")])
14980 (define_expand "abs<mode>2"
14981 [(set (match_operand:VI1248_AVX512VL_AVX512BW 0 "register_operand")
14982 (abs:VI1248_AVX512VL_AVX512BW
14983 (match_operand:VI1248_AVX512VL_AVX512BW 1 "vector_operand")))]
14988 ix86_expand_sse2_abs (operands[0], operands[1]);
14993 (define_insn "abs<mode>2"
14994 [(set (match_operand:MMXMODEI 0 "register_operand" "=y")
14996 (match_operand:MMXMODEI 1 "nonimmediate_operand" "ym")))]
14998 "pabs<mmxvecsize>\t{%1, %0|%0, %1}";
14999 [(set_attr "type" "sselog1")
15000 (set_attr "prefix_rep" "0")
15001 (set_attr "prefix_extra" "1")
15002 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
15003 (set_attr "mode" "DI")])
15005 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15007 ;; AMD SSE4A instructions
15009 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15011 (define_insn "sse4a_movnt<mode>"
15012 [(set (match_operand:MODEF 0 "memory_operand" "=m")
15014 [(match_operand:MODEF 1 "register_operand" "x")]
15017 "movnt<ssemodesuffix>\t{%1, %0|%0, %1}"
15018 [(set_attr "type" "ssemov")
15019 (set_attr "mode" "<MODE>")])
15021 (define_insn "sse4a_vmmovnt<mode>"
15022 [(set (match_operand:<ssescalarmode> 0 "memory_operand" "=m")
15023 (unspec:<ssescalarmode>
15024 [(vec_select:<ssescalarmode>
15025 (match_operand:VF_128 1 "register_operand" "x")
15026 (parallel [(const_int 0)]))]
15029 "movnt<ssescalarmodesuffix>\t{%1, %0|%0, %1}"
15030 [(set_attr "type" "ssemov")
15031 (set_attr "mode" "<ssescalarmode>")])
15033 (define_insn "sse4a_extrqi"
15034 [(set (match_operand:V2DI 0 "register_operand" "=x")
15035 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
15036 (match_operand 2 "const_0_to_255_operand")
15037 (match_operand 3 "const_0_to_255_operand")]
15040 "extrq\t{%3, %2, %0|%0, %2, %3}"
15041 [(set_attr "type" "sse")
15042 (set_attr "prefix_data16" "1")
15043 (set_attr "length_immediate" "2")
15044 (set_attr "mode" "TI")])
15046 (define_insn "sse4a_extrq"
15047 [(set (match_operand:V2DI 0 "register_operand" "=x")
15048 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
15049 (match_operand:V16QI 2 "register_operand" "x")]
15052 "extrq\t{%2, %0|%0, %2}"
15053 [(set_attr "type" "sse")
15054 (set_attr "prefix_data16" "1")
15055 (set_attr "mode" "TI")])
15057 (define_insn "sse4a_insertqi"
15058 [(set (match_operand:V2DI 0 "register_operand" "=x")
15059 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
15060 (match_operand:V2DI 2 "register_operand" "x")
15061 (match_operand 3 "const_0_to_255_operand")
15062 (match_operand 4 "const_0_to_255_operand")]
15065 "insertq\t{%4, %3, %2, %0|%0, %2, %3, %4}"
15066 [(set_attr "type" "sseins")
15067 (set_attr "prefix_data16" "0")
15068 (set_attr "prefix_rep" "1")
15069 (set_attr "length_immediate" "2")
15070 (set_attr "mode" "TI")])
15072 (define_insn "sse4a_insertq"
15073 [(set (match_operand:V2DI 0 "register_operand" "=x")
15074 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
15075 (match_operand:V2DI 2 "register_operand" "x")]
15078 "insertq\t{%2, %0|%0, %2}"
15079 [(set_attr "type" "sseins")
15080 (set_attr "prefix_data16" "0")
15081 (set_attr "prefix_rep" "1")
15082 (set_attr "mode" "TI")])
15084 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15086 ;; Intel SSE4.1 instructions
15088 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15090 ;; Mapping of immediate bits for blend instructions
15091 (define_mode_attr blendbits
15092 [(V8SF "255") (V4SF "15") (V4DF "15") (V2DF "3")])
15094 (define_insn "<sse4_1>_blend<ssemodesuffix><avxsizesuffix>"
15095 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
15096 (vec_merge:VF_128_256
15097 (match_operand:VF_128_256 2 "vector_operand" "YrBm,*xBm,xm")
15098 (match_operand:VF_128_256 1 "register_operand" "0,0,x")
15099 (match_operand:SI 3 "const_0_to_<blendbits>_operand")))]
15102 blend<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15103 blend<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15104 vblend<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15105 [(set_attr "isa" "noavx,noavx,avx")
15106 (set_attr "type" "ssemov")
15107 (set_attr "length_immediate" "1")
15108 (set_attr "prefix_data16" "1,1,*")
15109 (set_attr "prefix_extra" "1")
15110 (set_attr "prefix" "orig,orig,vex")
15111 (set_attr "mode" "<MODE>")])
15113 (define_insn "<sse4_1>_blendv<ssemodesuffix><avxsizesuffix>"
15114 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
15116 [(match_operand:VF_128_256 1 "register_operand" "0,0,x")
15117 (match_operand:VF_128_256 2 "vector_operand" "YrBm,*xBm,xm")
15118 (match_operand:VF_128_256 3 "register_operand" "Yz,Yz,x")]
15122 blendv<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15123 blendv<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15124 vblendv<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15125 [(set_attr "isa" "noavx,noavx,avx")
15126 (set_attr "type" "ssemov")
15127 (set_attr "length_immediate" "1")
15128 (set_attr "prefix_data16" "1,1,*")
15129 (set_attr "prefix_extra" "1")
15130 (set_attr "prefix" "orig,orig,vex")
15131 (set_attr "btver2_decode" "vector,vector,vector")
15132 (set_attr "mode" "<MODE>")])
15134 (define_insn "<sse4_1>_dp<ssemodesuffix><avxsizesuffix>"
15135 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
15137 [(match_operand:VF_128_256 1 "vector_operand" "%0,0,x")
15138 (match_operand:VF_128_256 2 "vector_operand" "YrBm,*xBm,xm")
15139 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")]
15143 dp<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15144 dp<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15145 vdp<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15146 [(set_attr "isa" "noavx,noavx,avx")
15147 (set_attr "type" "ssemul")
15148 (set_attr "length_immediate" "1")
15149 (set_attr "prefix_data16" "1,1,*")
15150 (set_attr "prefix_extra" "1")
15151 (set_attr "prefix" "orig,orig,vex")
15152 (set_attr "btver2_decode" "vector,vector,vector")
15153 (set_attr "znver1_decode" "vector,vector,vector")
15154 (set_attr "mode" "<MODE>")])
15156 ;; Mode attribute used by `vmovntdqa' pattern
15157 (define_mode_attr vi8_sse4_1_avx2_avx512
15158 [(V2DI "sse4_1") (V4DI "avx2") (V8DI "avx512f")])
15160 (define_insn "<vi8_sse4_1_avx2_avx512>_movntdqa"
15161 [(set (match_operand:VI8_AVX2_AVX512F 0 "register_operand" "=Yr,*x,v")
15162 (unspec:VI8_AVX2_AVX512F [(match_operand:VI8_AVX2_AVX512F 1 "memory_operand" "m,m,m")]
15165 "%vmovntdqa\t{%1, %0|%0, %1}"
15166 [(set_attr "isa" "noavx,noavx,avx")
15167 (set_attr "type" "ssemov")
15168 (set_attr "prefix_extra" "1,1,*")
15169 (set_attr "prefix" "orig,orig,maybe_evex")
15170 (set_attr "mode" "<sseinsnmode>")])
15172 (define_insn "<sse4_1_avx2>_mpsadbw"
15173 [(set (match_operand:VI1_AVX2 0 "register_operand" "=Yr,*x,x")
15175 [(match_operand:VI1_AVX2 1 "register_operand" "0,0,x")
15176 (match_operand:VI1_AVX2 2 "vector_operand" "YrBm,*xBm,xm")
15177 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")]
15181 mpsadbw\t{%3, %2, %0|%0, %2, %3}
15182 mpsadbw\t{%3, %2, %0|%0, %2, %3}
15183 vmpsadbw\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15184 [(set_attr "isa" "noavx,noavx,avx")
15185 (set_attr "type" "sselog1")
15186 (set_attr "length_immediate" "1")
15187 (set_attr "prefix_extra" "1")
15188 (set_attr "prefix" "orig,orig,vex")
15189 (set_attr "btver2_decode" "vector,vector,vector")
15190 (set_attr "znver1_decode" "vector,vector,vector")
15191 (set_attr "mode" "<sseinsnmode>")])
15193 (define_insn "<sse4_1_avx2>_packusdw<mask_name>"
15194 [(set (match_operand:VI2_AVX2 0 "register_operand" "=Yr,*x,x,v")
15195 (vec_concat:VI2_AVX2
15196 (us_truncate:<ssehalfvecmode>
15197 (match_operand:<sseunpackmode> 1 "register_operand" "0,0,x,v"))
15198 (us_truncate:<ssehalfvecmode>
15199 (match_operand:<sseunpackmode> 2 "vector_operand" "YrBm,*xBm,xm,vm"))))]
15200 "TARGET_SSE4_1 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
15202 packusdw\t{%2, %0|%0, %2}
15203 packusdw\t{%2, %0|%0, %2}
15204 vpackusdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
15205 vpackusdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
15206 [(set_attr "isa" "noavx,noavx,avx,avx512bw")
15207 (set_attr "type" "sselog")
15208 (set_attr "prefix_extra" "1")
15209 (set_attr "prefix" "orig,orig,<mask_prefix>,evex")
15210 (set_attr "mode" "<sseinsnmode>")])
15212 (define_insn "<sse4_1_avx2>_pblendvb"
15213 [(set (match_operand:VI1_AVX2 0 "register_operand" "=Yr,*x,x")
15215 [(match_operand:VI1_AVX2 1 "register_operand" "0,0,x")
15216 (match_operand:VI1_AVX2 2 "vector_operand" "YrBm,*xBm,xm")
15217 (match_operand:VI1_AVX2 3 "register_operand" "Yz,Yz,x")]
15221 pblendvb\t{%3, %2, %0|%0, %2, %3}
15222 pblendvb\t{%3, %2, %0|%0, %2, %3}
15223 vpblendvb\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15224 [(set_attr "isa" "noavx,noavx,avx")
15225 (set_attr "type" "ssemov")
15226 (set_attr "prefix_extra" "1")
15227 (set_attr "length_immediate" "*,*,1")
15228 (set_attr "prefix" "orig,orig,vex")
15229 (set_attr "btver2_decode" "vector,vector,vector")
15230 (set_attr "mode" "<sseinsnmode>")])
15232 (define_insn "sse4_1_pblendw"
15233 [(set (match_operand:V8HI 0 "register_operand" "=Yr,*x,x")
15235 (match_operand:V8HI 2 "vector_operand" "YrBm,*xBm,xm")
15236 (match_operand:V8HI 1 "register_operand" "0,0,x")
15237 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")))]
15240 pblendw\t{%3, %2, %0|%0, %2, %3}
15241 pblendw\t{%3, %2, %0|%0, %2, %3}
15242 vpblendw\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15243 [(set_attr "isa" "noavx,noavx,avx")
15244 (set_attr "type" "ssemov")
15245 (set_attr "prefix_extra" "1")
15246 (set_attr "length_immediate" "1")
15247 (set_attr "prefix" "orig,orig,vex")
15248 (set_attr "mode" "TI")])
15250 ;; The builtin uses an 8-bit immediate. Expand that.
15251 (define_expand "avx2_pblendw"
15252 [(set (match_operand:V16HI 0 "register_operand")
15254 (match_operand:V16HI 2 "nonimmediate_operand")
15255 (match_operand:V16HI 1 "register_operand")
15256 (match_operand:SI 3 "const_0_to_255_operand")))]
15259 HOST_WIDE_INT val = INTVAL (operands[3]) & 0xff;
15260 operands[3] = GEN_INT (val << 8 | val);
15263 (define_insn "*avx2_pblendw"
15264 [(set (match_operand:V16HI 0 "register_operand" "=x")
15266 (match_operand:V16HI 2 "nonimmediate_operand" "xm")
15267 (match_operand:V16HI 1 "register_operand" "x")
15268 (match_operand:SI 3 "avx2_pblendw_operand" "n")))]
15271 operands[3] = GEN_INT (INTVAL (operands[3]) & 0xff);
15272 return "vpblendw\t{%3, %2, %1, %0|%0, %1, %2, %3}";
15274 [(set_attr "type" "ssemov")
15275 (set_attr "prefix_extra" "1")
15276 (set_attr "length_immediate" "1")
15277 (set_attr "prefix" "vex")
15278 (set_attr "mode" "OI")])
15280 (define_insn "avx2_pblendd<mode>"
15281 [(set (match_operand:VI4_AVX2 0 "register_operand" "=x")
15282 (vec_merge:VI4_AVX2
15283 (match_operand:VI4_AVX2 2 "nonimmediate_operand" "xm")
15284 (match_operand:VI4_AVX2 1 "register_operand" "x")
15285 (match_operand:SI 3 "const_0_to_255_operand" "n")))]
15287 "vpblendd\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15288 [(set_attr "type" "ssemov")
15289 (set_attr "prefix_extra" "1")
15290 (set_attr "length_immediate" "1")
15291 (set_attr "prefix" "vex")
15292 (set_attr "mode" "<sseinsnmode>")])
15294 (define_insn "sse4_1_phminposuw"
15295 [(set (match_operand:V8HI 0 "register_operand" "=Yr,*x,x")
15296 (unspec:V8HI [(match_operand:V8HI 1 "vector_operand" "YrBm,*xBm,xm")]
15297 UNSPEC_PHMINPOSUW))]
15299 "%vphminposuw\t{%1, %0|%0, %1}"
15300 [(set_attr "isa" "noavx,noavx,avx")
15301 (set_attr "type" "sselog1")
15302 (set_attr "prefix_extra" "1")
15303 (set_attr "prefix" "orig,orig,vex")
15304 (set_attr "mode" "TI")])
15306 (define_insn "avx2_<code>v16qiv16hi2<mask_name>"
15307 [(set (match_operand:V16HI 0 "register_operand" "=v")
15309 (match_operand:V16QI 1 "nonimmediate_operand" "vm")))]
15310 "TARGET_AVX2 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
15311 "vpmov<extsuffix>bw\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15312 [(set_attr "type" "ssemov")
15313 (set_attr "prefix_extra" "1")
15314 (set_attr "prefix" "maybe_evex")
15315 (set_attr "mode" "OI")])
15317 (define_insn "avx512bw_<code>v32qiv32hi2<mask_name>"
15318 [(set (match_operand:V32HI 0 "register_operand" "=v")
15320 (match_operand:V32QI 1 "nonimmediate_operand" "vm")))]
15322 "vpmov<extsuffix>bw\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15323 [(set_attr "type" "ssemov")
15324 (set_attr "prefix_extra" "1")
15325 (set_attr "prefix" "evex")
15326 (set_attr "mode" "XI")])
15328 (define_insn "sse4_1_<code>v8qiv8hi2<mask_name>"
15329 [(set (match_operand:V8HI 0 "register_operand" "=Yr,*x,v")
15332 (match_operand:V16QI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15333 (parallel [(const_int 0) (const_int 1)
15334 (const_int 2) (const_int 3)
15335 (const_int 4) (const_int 5)
15336 (const_int 6) (const_int 7)]))))]
15337 "TARGET_SSE4_1 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
15338 "%vpmov<extsuffix>bw\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15339 [(set_attr "isa" "noavx,noavx,avx")
15340 (set_attr "type" "ssemov")
15341 (set_attr "prefix_extra" "1")
15342 (set_attr "prefix" "orig,orig,maybe_evex")
15343 (set_attr "mode" "TI")])
15345 (define_insn "<mask_codefor>avx512f_<code>v16qiv16si2<mask_name>"
15346 [(set (match_operand:V16SI 0 "register_operand" "=v")
15348 (match_operand:V16QI 1 "nonimmediate_operand" "vm")))]
15350 "vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15351 [(set_attr "type" "ssemov")
15352 (set_attr "prefix" "evex")
15353 (set_attr "mode" "XI")])
15355 (define_insn "avx2_<code>v8qiv8si2<mask_name>"
15356 [(set (match_operand:V8SI 0 "register_operand" "=v")
15359 (match_operand:V16QI 1 "nonimmediate_operand" "vm")
15360 (parallel [(const_int 0) (const_int 1)
15361 (const_int 2) (const_int 3)
15362 (const_int 4) (const_int 5)
15363 (const_int 6) (const_int 7)]))))]
15364 "TARGET_AVX2 && <mask_avx512vl_condition>"
15365 "vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15366 [(set_attr "type" "ssemov")
15367 (set_attr "prefix_extra" "1")
15368 (set_attr "prefix" "maybe_evex")
15369 (set_attr "mode" "OI")])
15371 (define_insn "sse4_1_<code>v4qiv4si2<mask_name>"
15372 [(set (match_operand:V4SI 0 "register_operand" "=Yr,*x,v")
15375 (match_operand:V16QI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15376 (parallel [(const_int 0) (const_int 1)
15377 (const_int 2) (const_int 3)]))))]
15378 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15379 "%vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
15380 [(set_attr "isa" "noavx,noavx,avx")
15381 (set_attr "type" "ssemov")
15382 (set_attr "prefix_extra" "1")
15383 (set_attr "prefix" "orig,orig,maybe_evex")
15384 (set_attr "mode" "TI")])
15386 (define_insn "avx512f_<code>v16hiv16si2<mask_name>"
15387 [(set (match_operand:V16SI 0 "register_operand" "=v")
15389 (match_operand:V16HI 1 "nonimmediate_operand" "vm")))]
15391 "vpmov<extsuffix>wd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15392 [(set_attr "type" "ssemov")
15393 (set_attr "prefix" "evex")
15394 (set_attr "mode" "XI")])
15396 (define_insn "avx2_<code>v8hiv8si2<mask_name>"
15397 [(set (match_operand:V8SI 0 "register_operand" "=v")
15399 (match_operand:V8HI 1 "nonimmediate_operand" "vm")))]
15400 "TARGET_AVX2 && <mask_avx512vl_condition>"
15401 "vpmov<extsuffix>wd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15402 [(set_attr "type" "ssemov")
15403 (set_attr "prefix_extra" "1")
15404 (set_attr "prefix" "maybe_evex")
15405 (set_attr "mode" "OI")])
15407 (define_insn "sse4_1_<code>v4hiv4si2<mask_name>"
15408 [(set (match_operand:V4SI 0 "register_operand" "=Yr,*x,v")
15411 (match_operand:V8HI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15412 (parallel [(const_int 0) (const_int 1)
15413 (const_int 2) (const_int 3)]))))]
15414 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15415 "%vpmov<extsuffix>wd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15416 [(set_attr "isa" "noavx,noavx,avx")
15417 (set_attr "type" "ssemov")
15418 (set_attr "prefix_extra" "1")
15419 (set_attr "prefix" "orig,orig,maybe_evex")
15420 (set_attr "mode" "TI")])
15422 (define_insn "avx512f_<code>v8qiv8di2<mask_name>"
15423 [(set (match_operand:V8DI 0 "register_operand" "=v")
15426 (match_operand:V16QI 1 "nonimmediate_operand" "vm")
15427 (parallel [(const_int 0) (const_int 1)
15428 (const_int 2) (const_int 3)
15429 (const_int 4) (const_int 5)
15430 (const_int 6) (const_int 7)]))))]
15432 "vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
15433 [(set_attr "type" "ssemov")
15434 (set_attr "prefix" "evex")
15435 (set_attr "mode" "XI")])
15437 (define_insn "avx2_<code>v4qiv4di2<mask_name>"
15438 [(set (match_operand:V4DI 0 "register_operand" "=v")
15441 (match_operand:V16QI 1 "nonimmediate_operand" "vm")
15442 (parallel [(const_int 0) (const_int 1)
15443 (const_int 2) (const_int 3)]))))]
15444 "TARGET_AVX2 && <mask_avx512vl_condition>"
15445 "vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
15446 [(set_attr "type" "ssemov")
15447 (set_attr "prefix_extra" "1")
15448 (set_attr "prefix" "maybe_evex")
15449 (set_attr "mode" "OI")])
15451 (define_insn "sse4_1_<code>v2qiv2di2<mask_name>"
15452 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
15455 (match_operand:V16QI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15456 (parallel [(const_int 0) (const_int 1)]))))]
15457 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15458 "%vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %w1}"
15459 [(set_attr "isa" "noavx,noavx,avx")
15460 (set_attr "type" "ssemov")
15461 (set_attr "prefix_extra" "1")
15462 (set_attr "prefix" "orig,orig,maybe_evex")
15463 (set_attr "mode" "TI")])
15465 (define_insn "avx512f_<code>v8hiv8di2<mask_name>"
15466 [(set (match_operand:V8DI 0 "register_operand" "=v")
15468 (match_operand:V8HI 1 "nonimmediate_operand" "vm")))]
15470 "vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15471 [(set_attr "type" "ssemov")
15472 (set_attr "prefix" "evex")
15473 (set_attr "mode" "XI")])
15475 (define_insn "avx2_<code>v4hiv4di2<mask_name>"
15476 [(set (match_operand:V4DI 0 "register_operand" "=v")
15479 (match_operand:V8HI 1 "nonimmediate_operand" "vm")
15480 (parallel [(const_int 0) (const_int 1)
15481 (const_int 2) (const_int 3)]))))]
15482 "TARGET_AVX2 && <mask_avx512vl_condition>"
15483 "vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15484 [(set_attr "type" "ssemov")
15485 (set_attr "prefix_extra" "1")
15486 (set_attr "prefix" "maybe_evex")
15487 (set_attr "mode" "OI")])
15489 (define_insn "sse4_1_<code>v2hiv2di2<mask_name>"
15490 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
15493 (match_operand:V8HI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15494 (parallel [(const_int 0) (const_int 1)]))))]
15495 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15496 "%vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
15497 [(set_attr "isa" "noavx,noavx,avx")
15498 (set_attr "type" "ssemov")
15499 (set_attr "prefix_extra" "1")
15500 (set_attr "prefix" "orig,orig,maybe_evex")
15501 (set_attr "mode" "TI")])
15503 (define_insn "avx512f_<code>v8siv8di2<mask_name>"
15504 [(set (match_operand:V8DI 0 "register_operand" "=v")
15506 (match_operand:V8SI 1 "nonimmediate_operand" "vm")))]
15508 "vpmov<extsuffix>dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15509 [(set_attr "type" "ssemov")
15510 (set_attr "prefix" "evex")
15511 (set_attr "mode" "XI")])
15513 (define_insn "avx2_<code>v4siv4di2<mask_name>"
15514 [(set (match_operand:V4DI 0 "register_operand" "=v")
15516 (match_operand:V4SI 1 "nonimmediate_operand" "vm")))]
15517 "TARGET_AVX2 && <mask_avx512vl_condition>"
15518 "vpmov<extsuffix>dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15519 [(set_attr "type" "ssemov")
15520 (set_attr "prefix" "maybe_evex")
15521 (set_attr "prefix_extra" "1")
15522 (set_attr "mode" "OI")])
15524 (define_insn "sse4_1_<code>v2siv2di2<mask_name>"
15525 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
15528 (match_operand:V4SI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15529 (parallel [(const_int 0) (const_int 1)]))))]
15530 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15531 "%vpmov<extsuffix>dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15532 [(set_attr "isa" "noavx,noavx,avx")
15533 (set_attr "type" "ssemov")
15534 (set_attr "prefix_extra" "1")
15535 (set_attr "prefix" "orig,orig,maybe_evex")
15536 (set_attr "mode" "TI")])
15538 ;; ptestps/ptestpd are very similar to comiss and ucomiss when
15539 ;; setting FLAGS_REG. But it is not a really compare instruction.
15540 (define_insn "avx_vtest<ssemodesuffix><avxsizesuffix>"
15541 [(set (reg:CC FLAGS_REG)
15542 (unspec:CC [(match_operand:VF_128_256 0 "register_operand" "x")
15543 (match_operand:VF_128_256 1 "nonimmediate_operand" "xm")]
15546 "vtest<ssemodesuffix>\t{%1, %0|%0, %1}"
15547 [(set_attr "type" "ssecomi")
15548 (set_attr "prefix_extra" "1")
15549 (set_attr "prefix" "vex")
15550 (set_attr "mode" "<MODE>")])
15552 ;; ptest is very similar to comiss and ucomiss when setting FLAGS_REG.
15553 ;; But it is not a really compare instruction.
15554 (define_insn "<sse4_1>_ptest<mode>"
15555 [(set (reg:CC FLAGS_REG)
15556 (unspec:CC [(match_operand:V_AVX 0 "register_operand" "Yr, *x, x")
15557 (match_operand:V_AVX 1 "vector_operand" "YrBm, *xBm, xm")]
15560 "%vptest\t{%1, %0|%0, %1}"
15561 [(set_attr "isa" "noavx,noavx,avx")
15562 (set_attr "type" "ssecomi")
15563 (set_attr "prefix_extra" "1")
15564 (set_attr "prefix" "orig,orig,vex")
15565 (set (attr "btver2_decode")
15567 (match_test "<sseinsnmode>mode==OImode")
15568 (const_string "vector")
15569 (const_string "*")))
15570 (set_attr "mode" "<sseinsnmode>")])
15572 (define_insn "ptesttf2"
15573 [(set (reg:CC FLAGS_REG)
15574 (unspec:CC [(match_operand:TF 0 "register_operand" "Yr, *x, x")
15575 (match_operand:TF 1 "vector_operand" "YrBm, *xBm, xm")]
15578 "%vptest\t{%1, %0|%0, %1}"
15579 [(set_attr "isa" "noavx,noavx,avx")
15580 (set_attr "type" "ssecomi")
15581 (set_attr "prefix_extra" "1")
15582 (set_attr "prefix" "orig,orig,vex")
15583 (set_attr "mode" "TI")])
15585 (define_insn "<sse4_1>_round<ssemodesuffix><avxsizesuffix>"
15586 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
15588 [(match_operand:VF_128_256 1 "vector_operand" "YrBm,*xBm,xm")
15589 (match_operand:SI 2 "const_0_to_15_operand" "n,n,n")]
15592 "%vround<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
15593 [(set_attr "isa" "noavx,noavx,avx")
15594 (set_attr "type" "ssecvt")
15595 (set_attr "prefix_data16" "1,1,*")
15596 (set_attr "prefix_extra" "1")
15597 (set_attr "length_immediate" "1")
15598 (set_attr "prefix" "orig,orig,vex")
15599 (set_attr "mode" "<MODE>")])
15601 (define_expand "<sse4_1>_round<ssemodesuffix>_sfix<avxsizesuffix>"
15602 [(match_operand:<sseintvecmode> 0 "register_operand")
15603 (match_operand:VF1_128_256 1 "vector_operand")
15604 (match_operand:SI 2 "const_0_to_15_operand")]
15607 rtx tmp = gen_reg_rtx (<MODE>mode);
15610 (gen_<sse4_1>_round<ssemodesuffix><avxsizesuffix> (tmp, operands[1],
15613 (gen_fix_trunc<mode><sseintvecmodelower>2 (operands[0], tmp));
15617 (define_expand "avx512f_round<castmode>512"
15618 [(match_operand:VF_512 0 "register_operand")
15619 (match_operand:VF_512 1 "nonimmediate_operand")
15620 (match_operand:SI 2 "const_0_to_15_operand")]
15623 emit_insn (gen_avx512f_rndscale<mode> (operands[0], operands[1], operands[2]));
15627 (define_expand "avx512f_roundps512_sfix"
15628 [(match_operand:V16SI 0 "register_operand")
15629 (match_operand:V16SF 1 "nonimmediate_operand")
15630 (match_operand:SI 2 "const_0_to_15_operand")]
15633 rtx tmp = gen_reg_rtx (V16SFmode);
15634 emit_insn (gen_avx512f_rndscalev16sf (tmp, operands[1], operands[2]));
15635 emit_insn (gen_fix_truncv16sfv16si2 (operands[0], tmp));
15639 (define_expand "<sse4_1>_round<ssemodesuffix>_vec_pack_sfix<avxsizesuffix>"
15640 [(match_operand:<ssepackfltmode> 0 "register_operand")
15641 (match_operand:VF2 1 "vector_operand")
15642 (match_operand:VF2 2 "vector_operand")
15643 (match_operand:SI 3 "const_0_to_15_operand")]
15648 if (<MODE>mode == V2DFmode
15649 && TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
15651 rtx tmp2 = gen_reg_rtx (V4DFmode);
15653 tmp0 = gen_reg_rtx (V4DFmode);
15654 tmp1 = force_reg (V2DFmode, operands[1]);
15656 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
15657 emit_insn (gen_avx_roundpd256 (tmp2, tmp0, operands[3]));
15658 emit_insn (gen_fix_truncv4dfv4si2 (operands[0], tmp2));
15662 tmp0 = gen_reg_rtx (<MODE>mode);
15663 tmp1 = gen_reg_rtx (<MODE>mode);
15666 (gen_<sse4_1>_round<ssemodesuffix><avxsizesuffix> (tmp0, operands[1],
15669 (gen_<sse4_1>_round<ssemodesuffix><avxsizesuffix> (tmp1, operands[2],
15672 (gen_vec_pack_sfix_trunc_<mode> (operands[0], tmp0, tmp1));
15677 (define_insn "sse4_1_round<ssescalarmodesuffix>"
15678 [(set (match_operand:VF_128 0 "register_operand" "=Yr,*x,x,v")
15681 [(match_operand:VF_128 2 "register_operand" "Yr,*x,x,v")
15682 (match_operand:SI 3 "const_0_to_15_operand" "n,n,n,n")]
15684 (match_operand:VF_128 1 "register_operand" "0,0,x,v")
15688 round<ssescalarmodesuffix>\t{%3, %2, %0|%0, %2, %3}
15689 round<ssescalarmodesuffix>\t{%3, %2, %0|%0, %2, %3}
15690 vround<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
15691 vrndscale<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15692 [(set_attr "isa" "noavx,noavx,avx,avx512f")
15693 (set_attr "type" "ssecvt")
15694 (set_attr "length_immediate" "1")
15695 (set_attr "prefix_data16" "1,1,*,*")
15696 (set_attr "prefix_extra" "1")
15697 (set_attr "prefix" "orig,orig,vex,evex")
15698 (set_attr "mode" "<MODE>")])
15700 (define_expand "round<mode>2"
15701 [(set (match_dup 3)
15703 (match_operand:VF 1 "register_operand")
15705 (set (match_operand:VF 0 "register_operand")
15707 [(match_dup 3) (match_dup 4)]
15709 "TARGET_SSE4_1 && !flag_trapping_math"
15711 machine_mode scalar_mode;
15712 const struct real_format *fmt;
15713 REAL_VALUE_TYPE pred_half, half_minus_pred_half;
15714 rtx half, vec_half;
15716 scalar_mode = GET_MODE_INNER (<MODE>mode);
15718 /* load nextafter (0.5, 0.0) */
15719 fmt = REAL_MODE_FORMAT (scalar_mode);
15720 real_2expN (&half_minus_pred_half, -(fmt->p) - 1, scalar_mode);
15721 real_arithmetic (&pred_half, MINUS_EXPR, &dconsthalf, &half_minus_pred_half);
15722 half = const_double_from_real_value (pred_half, scalar_mode);
15724 vec_half = ix86_build_const_vector (<MODE>mode, true, half);
15725 vec_half = force_reg (<MODE>mode, vec_half);
15727 operands[2] = gen_reg_rtx (<MODE>mode);
15728 emit_insn (gen_copysign<mode>3 (operands[2], vec_half, operands[1]));
15730 operands[3] = gen_reg_rtx (<MODE>mode);
15731 operands[4] = GEN_INT (ROUND_TRUNC);
15734 (define_expand "round<mode>2_sfix"
15735 [(match_operand:<sseintvecmode> 0 "register_operand")
15736 (match_operand:VF1 1 "register_operand")]
15737 "TARGET_SSE4_1 && !flag_trapping_math"
15739 rtx tmp = gen_reg_rtx (<MODE>mode);
15741 emit_insn (gen_round<mode>2 (tmp, operands[1]));
15744 (gen_fix_trunc<mode><sseintvecmodelower>2 (operands[0], tmp));
15748 (define_expand "round<mode>2_vec_pack_sfix"
15749 [(match_operand:<ssepackfltmode> 0 "register_operand")
15750 (match_operand:VF2 1 "register_operand")
15751 (match_operand:VF2 2 "register_operand")]
15752 "TARGET_SSE4_1 && !flag_trapping_math"
15756 if (<MODE>mode == V2DFmode
15757 && TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
15759 rtx tmp2 = gen_reg_rtx (V4DFmode);
15761 tmp0 = gen_reg_rtx (V4DFmode);
15762 tmp1 = force_reg (V2DFmode, operands[1]);
15764 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
15765 emit_insn (gen_roundv4df2 (tmp2, tmp0));
15766 emit_insn (gen_fix_truncv4dfv4si2 (operands[0], tmp2));
15770 tmp0 = gen_reg_rtx (<MODE>mode);
15771 tmp1 = gen_reg_rtx (<MODE>mode);
15773 emit_insn (gen_round<mode>2 (tmp0, operands[1]));
15774 emit_insn (gen_round<mode>2 (tmp1, operands[2]));
15777 (gen_vec_pack_sfix_trunc_<mode> (operands[0], tmp0, tmp1));
15782 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15784 ;; Intel SSE4.2 string/text processing instructions
15786 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15788 (define_insn_and_split "sse4_2_pcmpestr"
15789 [(set (match_operand:SI 0 "register_operand" "=c,c")
15791 [(match_operand:V16QI 2 "register_operand" "x,x")
15792 (match_operand:SI 3 "register_operand" "a,a")
15793 (match_operand:V16QI 4 "nonimmediate_operand" "x,m")
15794 (match_operand:SI 5 "register_operand" "d,d")
15795 (match_operand:SI 6 "const_0_to_255_operand" "n,n")]
15797 (set (match_operand:V16QI 1 "register_operand" "=Yz,Yz")
15805 (set (reg:CC FLAGS_REG)
15814 && can_create_pseudo_p ()"
15819 int ecx = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[0]));
15820 int xmm0 = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[1]));
15821 int flags = !find_regno_note (curr_insn, REG_UNUSED, FLAGS_REG);
15824 emit_insn (gen_sse4_2_pcmpestri (operands[0], operands[2],
15825 operands[3], operands[4],
15826 operands[5], operands[6]));
15828 emit_insn (gen_sse4_2_pcmpestrm (operands[1], operands[2],
15829 operands[3], operands[4],
15830 operands[5], operands[6]));
15831 if (flags && !(ecx || xmm0))
15832 emit_insn (gen_sse4_2_pcmpestr_cconly (NULL, NULL,
15833 operands[2], operands[3],
15834 operands[4], operands[5],
15836 if (!(flags || ecx || xmm0))
15837 emit_note (NOTE_INSN_DELETED);
15841 [(set_attr "type" "sselog")
15842 (set_attr "prefix_data16" "1")
15843 (set_attr "prefix_extra" "1")
15844 (set_attr "length_immediate" "1")
15845 (set_attr "memory" "none,load")
15846 (set_attr "mode" "TI")])
15848 (define_insn "sse4_2_pcmpestri"
15849 [(set (match_operand:SI 0 "register_operand" "=c,c")
15851 [(match_operand:V16QI 1 "register_operand" "x,x")
15852 (match_operand:SI 2 "register_operand" "a,a")
15853 (match_operand:V16QI 3 "nonimmediate_operand" "x,m")
15854 (match_operand:SI 4 "register_operand" "d,d")
15855 (match_operand:SI 5 "const_0_to_255_operand" "n,n")]
15857 (set (reg:CC FLAGS_REG)
15866 "%vpcmpestri\t{%5, %3, %1|%1, %3, %5}"
15867 [(set_attr "type" "sselog")
15868 (set_attr "prefix_data16" "1")
15869 (set_attr "prefix_extra" "1")
15870 (set_attr "prefix" "maybe_vex")
15871 (set_attr "length_immediate" "1")
15872 (set_attr "btver2_decode" "vector")
15873 (set_attr "memory" "none,load")
15874 (set_attr "mode" "TI")])
15876 (define_insn "sse4_2_pcmpestrm"
15877 [(set (match_operand:V16QI 0 "register_operand" "=Yz,Yz")
15879 [(match_operand:V16QI 1 "register_operand" "x,x")
15880 (match_operand:SI 2 "register_operand" "a,a")
15881 (match_operand:V16QI 3 "nonimmediate_operand" "x,m")
15882 (match_operand:SI 4 "register_operand" "d,d")
15883 (match_operand:SI 5 "const_0_to_255_operand" "n,n")]
15885 (set (reg:CC FLAGS_REG)
15894 "%vpcmpestrm\t{%5, %3, %1|%1, %3, %5}"
15895 [(set_attr "type" "sselog")
15896 (set_attr "prefix_data16" "1")
15897 (set_attr "prefix_extra" "1")
15898 (set_attr "length_immediate" "1")
15899 (set_attr "prefix" "maybe_vex")
15900 (set_attr "btver2_decode" "vector")
15901 (set_attr "memory" "none,load")
15902 (set_attr "mode" "TI")])
15904 (define_insn "sse4_2_pcmpestr_cconly"
15905 [(set (reg:CC FLAGS_REG)
15907 [(match_operand:V16QI 2 "register_operand" "x,x,x,x")
15908 (match_operand:SI 3 "register_operand" "a,a,a,a")
15909 (match_operand:V16QI 4 "nonimmediate_operand" "x,m,x,m")
15910 (match_operand:SI 5 "register_operand" "d,d,d,d")
15911 (match_operand:SI 6 "const_0_to_255_operand" "n,n,n,n")]
15913 (clobber (match_scratch:V16QI 0 "=Yz,Yz,X,X"))
15914 (clobber (match_scratch:SI 1 "= X, X,c,c"))]
15917 %vpcmpestrm\t{%6, %4, %2|%2, %4, %6}
15918 %vpcmpestrm\t{%6, %4, %2|%2, %4, %6}
15919 %vpcmpestri\t{%6, %4, %2|%2, %4, %6}
15920 %vpcmpestri\t{%6, %4, %2|%2, %4, %6}"
15921 [(set_attr "type" "sselog")
15922 (set_attr "prefix_data16" "1")
15923 (set_attr "prefix_extra" "1")
15924 (set_attr "length_immediate" "1")
15925 (set_attr "memory" "none,load,none,load")
15926 (set_attr "btver2_decode" "vector,vector,vector,vector")
15927 (set_attr "prefix" "maybe_vex")
15928 (set_attr "mode" "TI")])
15930 (define_insn_and_split "sse4_2_pcmpistr"
15931 [(set (match_operand:SI 0 "register_operand" "=c,c")
15933 [(match_operand:V16QI 2 "register_operand" "x,x")
15934 (match_operand:V16QI 3 "nonimmediate_operand" "x,m")
15935 (match_operand:SI 4 "const_0_to_255_operand" "n,n")]
15937 (set (match_operand:V16QI 1 "register_operand" "=Yz,Yz")
15943 (set (reg:CC FLAGS_REG)
15950 && can_create_pseudo_p ()"
15955 int ecx = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[0]));
15956 int xmm0 = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[1]));
15957 int flags = !find_regno_note (curr_insn, REG_UNUSED, FLAGS_REG);
15960 emit_insn (gen_sse4_2_pcmpistri (operands[0], operands[2],
15961 operands[3], operands[4]));
15963 emit_insn (gen_sse4_2_pcmpistrm (operands[1], operands[2],
15964 operands[3], operands[4]));
15965 if (flags && !(ecx || xmm0))
15966 emit_insn (gen_sse4_2_pcmpistr_cconly (NULL, NULL,
15967 operands[2], operands[3],
15969 if (!(flags || ecx || xmm0))
15970 emit_note (NOTE_INSN_DELETED);
15974 [(set_attr "type" "sselog")
15975 (set_attr "prefix_data16" "1")
15976 (set_attr "prefix_extra" "1")
15977 (set_attr "length_immediate" "1")
15978 (set_attr "memory" "none,load")
15979 (set_attr "mode" "TI")])
15981 (define_insn "sse4_2_pcmpistri"
15982 [(set (match_operand:SI 0 "register_operand" "=c,c")
15984 [(match_operand:V16QI 1 "register_operand" "x,x")
15985 (match_operand:V16QI 2 "nonimmediate_operand" "x,m")
15986 (match_operand:SI 3 "const_0_to_255_operand" "n,n")]
15988 (set (reg:CC FLAGS_REG)
15995 "%vpcmpistri\t{%3, %2, %1|%1, %2, %3}"
15996 [(set_attr "type" "sselog")
15997 (set_attr "prefix_data16" "1")
15998 (set_attr "prefix_extra" "1")
15999 (set_attr "length_immediate" "1")
16000 (set_attr "prefix" "maybe_vex")
16001 (set_attr "memory" "none,load")
16002 (set_attr "btver2_decode" "vector")
16003 (set_attr "mode" "TI")])
16005 (define_insn "sse4_2_pcmpistrm"
16006 [(set (match_operand:V16QI 0 "register_operand" "=Yz,Yz")
16008 [(match_operand:V16QI 1 "register_operand" "x,x")
16009 (match_operand:V16QI 2 "nonimmediate_operand" "x,m")
16010 (match_operand:SI 3 "const_0_to_255_operand" "n,n")]
16012 (set (reg:CC FLAGS_REG)
16019 "%vpcmpistrm\t{%3, %2, %1|%1, %2, %3}"
16020 [(set_attr "type" "sselog")
16021 (set_attr "prefix_data16" "1")
16022 (set_attr "prefix_extra" "1")
16023 (set_attr "length_immediate" "1")
16024 (set_attr "prefix" "maybe_vex")
16025 (set_attr "memory" "none,load")
16026 (set_attr "btver2_decode" "vector")
16027 (set_attr "mode" "TI")])
16029 (define_insn "sse4_2_pcmpistr_cconly"
16030 [(set (reg:CC FLAGS_REG)
16032 [(match_operand:V16QI 2 "register_operand" "x,x,x,x")
16033 (match_operand:V16QI 3 "nonimmediate_operand" "x,m,x,m")
16034 (match_operand:SI 4 "const_0_to_255_operand" "n,n,n,n")]
16036 (clobber (match_scratch:V16QI 0 "=Yz,Yz,X,X"))
16037 (clobber (match_scratch:SI 1 "= X, X,c,c"))]
16040 %vpcmpistrm\t{%4, %3, %2|%2, %3, %4}
16041 %vpcmpistrm\t{%4, %3, %2|%2, %3, %4}
16042 %vpcmpistri\t{%4, %3, %2|%2, %3, %4}
16043 %vpcmpistri\t{%4, %3, %2|%2, %3, %4}"
16044 [(set_attr "type" "sselog")
16045 (set_attr "prefix_data16" "1")
16046 (set_attr "prefix_extra" "1")
16047 (set_attr "length_immediate" "1")
16048 (set_attr "memory" "none,load,none,load")
16049 (set_attr "prefix" "maybe_vex")
16050 (set_attr "btver2_decode" "vector,vector,vector,vector")
16051 (set_attr "mode" "TI")])
16053 ;; Packed float variants
16054 (define_mode_attr GATHER_SCATTER_SF_MEM_MODE
16055 [(V8DI "V8SF") (V16SI "V16SF")])
16057 (define_expand "avx512pf_gatherpf<mode>sf"
16059 [(match_operand:<avx512fmaskmode> 0 "register_operand")
16060 (mem:<GATHER_SCATTER_SF_MEM_MODE>
16062 [(match_operand 2 "vsib_address_operand")
16063 (match_operand:VI48_512 1 "register_operand")
16064 (match_operand:SI 3 "const1248_operand")]))
16065 (match_operand:SI 4 "const_2_to_3_operand")]
16066 UNSPEC_GATHER_PREFETCH)]
16070 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
16071 operands[3]), UNSPEC_VSIBADDR);
16074 (define_insn "*avx512pf_gatherpf<mode>sf_mask"
16076 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
16077 (match_operator:<GATHER_SCATTER_SF_MEM_MODE> 5 "vsib_mem_operator"
16079 [(match_operand:P 2 "vsib_address_operand" "Tv")
16080 (match_operand:VI48_512 1 "register_operand" "v")
16081 (match_operand:SI 3 "const1248_operand" "n")]
16083 (match_operand:SI 4 "const_2_to_3_operand" "n")]
16084 UNSPEC_GATHER_PREFETCH)]
16087 switch (INTVAL (operands[4]))
16090 return "vgatherpf0<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
16092 return "vgatherpf1<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
16094 gcc_unreachable ();
16097 [(set_attr "type" "sse")
16098 (set_attr "prefix" "evex")
16099 (set_attr "mode" "XI")])
16101 ;; Packed double variants
16102 (define_expand "avx512pf_gatherpf<mode>df"
16104 [(match_operand:<avx512fmaskmode> 0 "register_operand")
16107 [(match_operand 2 "vsib_address_operand")
16108 (match_operand:VI4_256_8_512 1 "register_operand")
16109 (match_operand:SI 3 "const1248_operand")]))
16110 (match_operand:SI 4 "const_2_to_3_operand")]
16111 UNSPEC_GATHER_PREFETCH)]
16115 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
16116 operands[3]), UNSPEC_VSIBADDR);
16119 (define_insn "*avx512pf_gatherpf<mode>df_mask"
16121 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
16122 (match_operator:V8DF 5 "vsib_mem_operator"
16124 [(match_operand:P 2 "vsib_address_operand" "Tv")
16125 (match_operand:VI4_256_8_512 1 "register_operand" "v")
16126 (match_operand:SI 3 "const1248_operand" "n")]
16128 (match_operand:SI 4 "const_2_to_3_operand" "n")]
16129 UNSPEC_GATHER_PREFETCH)]
16132 switch (INTVAL (operands[4]))
16135 return "vgatherpf0<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
16137 return "vgatherpf1<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
16139 gcc_unreachable ();
16142 [(set_attr "type" "sse")
16143 (set_attr "prefix" "evex")
16144 (set_attr "mode" "XI")])
16146 ;; Packed float variants
16147 (define_expand "avx512pf_scatterpf<mode>sf"
16149 [(match_operand:<avx512fmaskmode> 0 "register_operand")
16150 (mem:<GATHER_SCATTER_SF_MEM_MODE>
16152 [(match_operand 2 "vsib_address_operand")
16153 (match_operand:VI48_512 1 "register_operand")
16154 (match_operand:SI 3 "const1248_operand")]))
16155 (match_operand:SI 4 "const2367_operand")]
16156 UNSPEC_SCATTER_PREFETCH)]
16160 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
16161 operands[3]), UNSPEC_VSIBADDR);
16164 (define_insn "*avx512pf_scatterpf<mode>sf_mask"
16166 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
16167 (match_operator:<GATHER_SCATTER_SF_MEM_MODE> 5 "vsib_mem_operator"
16169 [(match_operand:P 2 "vsib_address_operand" "Tv")
16170 (match_operand:VI48_512 1 "register_operand" "v")
16171 (match_operand:SI 3 "const1248_operand" "n")]
16173 (match_operand:SI 4 "const2367_operand" "n")]
16174 UNSPEC_SCATTER_PREFETCH)]
16177 switch (INTVAL (operands[4]))
16181 return "vscatterpf0<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
16184 return "vscatterpf1<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
16186 gcc_unreachable ();
16189 [(set_attr "type" "sse")
16190 (set_attr "prefix" "evex")
16191 (set_attr "mode" "XI")])
16193 ;; Packed double variants
16194 (define_expand "avx512pf_scatterpf<mode>df"
16196 [(match_operand:<avx512fmaskmode> 0 "register_operand")
16199 [(match_operand 2 "vsib_address_operand")
16200 (match_operand:VI4_256_8_512 1 "register_operand")
16201 (match_operand:SI 3 "const1248_operand")]))
16202 (match_operand:SI 4 "const2367_operand")]
16203 UNSPEC_SCATTER_PREFETCH)]
16207 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
16208 operands[3]), UNSPEC_VSIBADDR);
16211 (define_insn "*avx512pf_scatterpf<mode>df_mask"
16213 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
16214 (match_operator:V8DF 5 "vsib_mem_operator"
16216 [(match_operand:P 2 "vsib_address_operand" "Tv")
16217 (match_operand:VI4_256_8_512 1 "register_operand" "v")
16218 (match_operand:SI 3 "const1248_operand" "n")]
16220 (match_operand:SI 4 "const2367_operand" "n")]
16221 UNSPEC_SCATTER_PREFETCH)]
16224 switch (INTVAL (operands[4]))
16228 return "vscatterpf0<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
16231 return "vscatterpf1<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
16233 gcc_unreachable ();
16236 [(set_attr "type" "sse")
16237 (set_attr "prefix" "evex")
16238 (set_attr "mode" "XI")])
16240 (define_insn "avx512er_exp2<mode><mask_name><round_saeonly_name>"
16241 [(set (match_operand:VF_512 0 "register_operand" "=v")
16243 [(match_operand:VF_512 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16246 "vexp2<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
16247 [(set_attr "prefix" "evex")
16248 (set_attr "type" "sse")
16249 (set_attr "mode" "<MODE>")])
16251 (define_insn "<mask_codefor>avx512er_rcp28<mode><mask_name><round_saeonly_name>"
16252 [(set (match_operand:VF_512 0 "register_operand" "=v")
16254 [(match_operand:VF_512 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16257 "vrcp28<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
16258 [(set_attr "prefix" "evex")
16259 (set_attr "type" "sse")
16260 (set_attr "mode" "<MODE>")])
16262 (define_insn "avx512er_vmrcp28<mode><round_saeonly_name>"
16263 [(set (match_operand:VF_128 0 "register_operand" "=v")
16266 [(match_operand:VF_128 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16268 (match_operand:VF_128 2 "register_operand" "v")
16271 "vrcp28<ssescalarmodesuffix>\t{<round_saeonly_op3>%1, %2, %0|%0, %2, %1<round_saeonly_op3>}"
16272 [(set_attr "length_immediate" "1")
16273 (set_attr "prefix" "evex")
16274 (set_attr "type" "sse")
16275 (set_attr "mode" "<MODE>")])
16277 (define_insn "<mask_codefor>avx512er_rsqrt28<mode><mask_name><round_saeonly_name>"
16278 [(set (match_operand:VF_512 0 "register_operand" "=v")
16280 [(match_operand:VF_512 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16283 "vrsqrt28<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
16284 [(set_attr "prefix" "evex")
16285 (set_attr "type" "sse")
16286 (set_attr "mode" "<MODE>")])
16288 (define_insn "avx512er_vmrsqrt28<mode><round_saeonly_name>"
16289 [(set (match_operand:VF_128 0 "register_operand" "=v")
16292 [(match_operand:VF_128 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16294 (match_operand:VF_128 2 "register_operand" "v")
16297 "vrsqrt28<ssescalarmodesuffix>\t{<round_saeonly_op3>%1, %2, %0|%0, %2, %1<round_saeonly_op3>}"
16298 [(set_attr "length_immediate" "1")
16299 (set_attr "type" "sse")
16300 (set_attr "prefix" "evex")
16301 (set_attr "mode" "<MODE>")])
16303 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16305 ;; XOP instructions
16307 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16309 (define_code_iterator xop_plus [plus ss_plus])
16311 (define_code_attr macs [(plus "macs") (ss_plus "macss")])
16312 (define_code_attr madcs [(plus "madcs") (ss_plus "madcss")])
16314 ;; XOP parallel integer multiply/add instructions.
16316 (define_insn "xop_p<macs><ssemodesuffix><ssemodesuffix>"
16317 [(set (match_operand:VI24_128 0 "register_operand" "=x")
16320 (match_operand:VI24_128 1 "nonimmediate_operand" "%x")
16321 (match_operand:VI24_128 2 "nonimmediate_operand" "xm"))
16322 (match_operand:VI24_128 3 "register_operand" "x")))]
16324 "vp<macs><ssemodesuffix><ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16325 [(set_attr "type" "ssemuladd")
16326 (set_attr "mode" "TI")])
16328 (define_insn "xop_p<macs>dql"
16329 [(set (match_operand:V2DI 0 "register_operand" "=x")
16334 (match_operand:V4SI 1 "nonimmediate_operand" "%x")
16335 (parallel [(const_int 0) (const_int 2)])))
16338 (match_operand:V4SI 2 "nonimmediate_operand" "xm")
16339 (parallel [(const_int 0) (const_int 2)]))))
16340 (match_operand:V2DI 3 "register_operand" "x")))]
16342 "vp<macs>dql\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16343 [(set_attr "type" "ssemuladd")
16344 (set_attr "mode" "TI")])
16346 (define_insn "xop_p<macs>dqh"
16347 [(set (match_operand:V2DI 0 "register_operand" "=x")
16352 (match_operand:V4SI 1 "nonimmediate_operand" "%x")
16353 (parallel [(const_int 1) (const_int 3)])))
16356 (match_operand:V4SI 2 "nonimmediate_operand" "xm")
16357 (parallel [(const_int 1) (const_int 3)]))))
16358 (match_operand:V2DI 3 "register_operand" "x")))]
16360 "vp<macs>dqh\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16361 [(set_attr "type" "ssemuladd")
16362 (set_attr "mode" "TI")])
16364 ;; XOP parallel integer multiply/add instructions for the intrinisics
16365 (define_insn "xop_p<macs>wd"
16366 [(set (match_operand:V4SI 0 "register_operand" "=x")
16371 (match_operand:V8HI 1 "nonimmediate_operand" "%x")
16372 (parallel [(const_int 1) (const_int 3)
16373 (const_int 5) (const_int 7)])))
16376 (match_operand:V8HI 2 "nonimmediate_operand" "xm")
16377 (parallel [(const_int 1) (const_int 3)
16378 (const_int 5) (const_int 7)]))))
16379 (match_operand:V4SI 3 "register_operand" "x")))]
16381 "vp<macs>wd\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16382 [(set_attr "type" "ssemuladd")
16383 (set_attr "mode" "TI")])
16385 (define_insn "xop_p<madcs>wd"
16386 [(set (match_operand:V4SI 0 "register_operand" "=x")
16392 (match_operand:V8HI 1 "nonimmediate_operand" "%x")
16393 (parallel [(const_int 0) (const_int 2)
16394 (const_int 4) (const_int 6)])))
16397 (match_operand:V8HI 2 "nonimmediate_operand" "xm")
16398 (parallel [(const_int 0) (const_int 2)
16399 (const_int 4) (const_int 6)]))))
16404 (parallel [(const_int 1) (const_int 3)
16405 (const_int 5) (const_int 7)])))
16409 (parallel [(const_int 1) (const_int 3)
16410 (const_int 5) (const_int 7)])))))
16411 (match_operand:V4SI 3 "register_operand" "x")))]
16413 "vp<madcs>wd\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16414 [(set_attr "type" "ssemuladd")
16415 (set_attr "mode" "TI")])
16417 ;; XOP parallel XMM conditional moves
16418 (define_insn "xop_pcmov_<mode><avxsizesuffix>"
16419 [(set (match_operand:V 0 "register_operand" "=x,x")
16421 (match_operand:V 3 "nonimmediate_operand" "x,m")
16422 (match_operand:V 1 "register_operand" "x,x")
16423 (match_operand:V 2 "nonimmediate_operand" "xm,x")))]
16425 "vpcmov\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16426 [(set_attr "type" "sse4arg")])
16428 ;; XOP horizontal add/subtract instructions
16429 (define_insn "xop_phadd<u>bw"
16430 [(set (match_operand:V8HI 0 "register_operand" "=x")
16434 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
16435 (parallel [(const_int 0) (const_int 2)
16436 (const_int 4) (const_int 6)
16437 (const_int 8) (const_int 10)
16438 (const_int 12) (const_int 14)])))
16442 (parallel [(const_int 1) (const_int 3)
16443 (const_int 5) (const_int 7)
16444 (const_int 9) (const_int 11)
16445 (const_int 13) (const_int 15)])))))]
16447 "vphadd<u>bw\t{%1, %0|%0, %1}"
16448 [(set_attr "type" "sseiadd1")])
16450 (define_insn "xop_phadd<u>bd"
16451 [(set (match_operand:V4SI 0 "register_operand" "=x")
16456 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
16457 (parallel [(const_int 0) (const_int 4)
16458 (const_int 8) (const_int 12)])))
16462 (parallel [(const_int 1) (const_int 5)
16463 (const_int 9) (const_int 13)]))))
16468 (parallel [(const_int 2) (const_int 6)
16469 (const_int 10) (const_int 14)])))
16473 (parallel [(const_int 3) (const_int 7)
16474 (const_int 11) (const_int 15)]))))))]
16476 "vphadd<u>bd\t{%1, %0|%0, %1}"
16477 [(set_attr "type" "sseiadd1")])
16479 (define_insn "xop_phadd<u>bq"
16480 [(set (match_operand:V2DI 0 "register_operand" "=x")
16486 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
16487 (parallel [(const_int 0) (const_int 8)])))
16491 (parallel [(const_int 1) (const_int 9)]))))
16496 (parallel [(const_int 2) (const_int 10)])))
16500 (parallel [(const_int 3) (const_int 11)])))))
16506 (parallel [(const_int 4) (const_int 12)])))
16510 (parallel [(const_int 5) (const_int 13)]))))
16515 (parallel [(const_int 6) (const_int 14)])))
16519 (parallel [(const_int 7) (const_int 15)])))))))]
16521 "vphadd<u>bq\t{%1, %0|%0, %1}"
16522 [(set_attr "type" "sseiadd1")])
16524 (define_insn "xop_phadd<u>wd"
16525 [(set (match_operand:V4SI 0 "register_operand" "=x")
16529 (match_operand:V8HI 1 "nonimmediate_operand" "xm")
16530 (parallel [(const_int 0) (const_int 2)
16531 (const_int 4) (const_int 6)])))
16535 (parallel [(const_int 1) (const_int 3)
16536 (const_int 5) (const_int 7)])))))]
16538 "vphadd<u>wd\t{%1, %0|%0, %1}"
16539 [(set_attr "type" "sseiadd1")])
16541 (define_insn "xop_phadd<u>wq"
16542 [(set (match_operand:V2DI 0 "register_operand" "=x")
16547 (match_operand:V8HI 1 "nonimmediate_operand" "xm")
16548 (parallel [(const_int 0) (const_int 4)])))
16552 (parallel [(const_int 1) (const_int 5)]))))
16557 (parallel [(const_int 2) (const_int 6)])))
16561 (parallel [(const_int 3) (const_int 7)]))))))]
16563 "vphadd<u>wq\t{%1, %0|%0, %1}"
16564 [(set_attr "type" "sseiadd1")])
16566 (define_insn "xop_phadd<u>dq"
16567 [(set (match_operand:V2DI 0 "register_operand" "=x")
16571 (match_operand:V4SI 1 "nonimmediate_operand" "xm")
16572 (parallel [(const_int 0) (const_int 2)])))
16576 (parallel [(const_int 1) (const_int 3)])))))]
16578 "vphadd<u>dq\t{%1, %0|%0, %1}"
16579 [(set_attr "type" "sseiadd1")])
16581 (define_insn "xop_phsubbw"
16582 [(set (match_operand:V8HI 0 "register_operand" "=x")
16586 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
16587 (parallel [(const_int 0) (const_int 2)
16588 (const_int 4) (const_int 6)
16589 (const_int 8) (const_int 10)
16590 (const_int 12) (const_int 14)])))
16594 (parallel [(const_int 1) (const_int 3)
16595 (const_int 5) (const_int 7)
16596 (const_int 9) (const_int 11)
16597 (const_int 13) (const_int 15)])))))]
16599 "vphsubbw\t{%1, %0|%0, %1}"
16600 [(set_attr "type" "sseiadd1")])
16602 (define_insn "xop_phsubwd"
16603 [(set (match_operand:V4SI 0 "register_operand" "=x")
16607 (match_operand:V8HI 1 "nonimmediate_operand" "xm")
16608 (parallel [(const_int 0) (const_int 2)
16609 (const_int 4) (const_int 6)])))
16613 (parallel [(const_int 1) (const_int 3)
16614 (const_int 5) (const_int 7)])))))]
16616 "vphsubwd\t{%1, %0|%0, %1}"
16617 [(set_attr "type" "sseiadd1")])
16619 (define_insn "xop_phsubdq"
16620 [(set (match_operand:V2DI 0 "register_operand" "=x")
16624 (match_operand:V4SI 1 "nonimmediate_operand" "xm")
16625 (parallel [(const_int 0) (const_int 2)])))
16629 (parallel [(const_int 1) (const_int 3)])))))]
16631 "vphsubdq\t{%1, %0|%0, %1}"
16632 [(set_attr "type" "sseiadd1")])
16634 ;; XOP permute instructions
16635 (define_insn "xop_pperm"
16636 [(set (match_operand:V16QI 0 "register_operand" "=x,x")
16638 [(match_operand:V16QI 1 "register_operand" "x,x")
16639 (match_operand:V16QI 2 "nonimmediate_operand" "x,m")
16640 (match_operand:V16QI 3 "nonimmediate_operand" "xm,x")]
16641 UNSPEC_XOP_PERMUTE))]
16642 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
16643 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16644 [(set_attr "type" "sse4arg")
16645 (set_attr "mode" "TI")])
16647 ;; XOP pack instructions that combine two vectors into a smaller vector
16648 (define_insn "xop_pperm_pack_v2di_v4si"
16649 [(set (match_operand:V4SI 0 "register_operand" "=x,x")
16652 (match_operand:V2DI 1 "register_operand" "x,x"))
16654 (match_operand:V2DI 2 "nonimmediate_operand" "x,m"))))
16655 (use (match_operand:V16QI 3 "nonimmediate_operand" "xm,x"))]
16656 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
16657 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16658 [(set_attr "type" "sse4arg")
16659 (set_attr "mode" "TI")])
16661 (define_insn "xop_pperm_pack_v4si_v8hi"
16662 [(set (match_operand:V8HI 0 "register_operand" "=x,x")
16665 (match_operand:V4SI 1 "register_operand" "x,x"))
16667 (match_operand:V4SI 2 "nonimmediate_operand" "x,m"))))
16668 (use (match_operand:V16QI 3 "nonimmediate_operand" "xm,x"))]
16669 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
16670 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16671 [(set_attr "type" "sse4arg")
16672 (set_attr "mode" "TI")])
16674 (define_insn "xop_pperm_pack_v8hi_v16qi"
16675 [(set (match_operand:V16QI 0 "register_operand" "=x,x")
16678 (match_operand:V8HI 1 "register_operand" "x,x"))
16680 (match_operand:V8HI 2 "nonimmediate_operand" "x,m"))))
16681 (use (match_operand:V16QI 3 "nonimmediate_operand" "xm,x"))]
16682 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
16683 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16684 [(set_attr "type" "sse4arg")
16685 (set_attr "mode" "TI")])
16687 ;; XOP packed rotate instructions
16688 (define_expand "rotl<mode>3"
16689 [(set (match_operand:VI_128 0 "register_operand")
16691 (match_operand:VI_128 1 "nonimmediate_operand")
16692 (match_operand:SI 2 "general_operand")))]
16695 /* If we were given a scalar, convert it to parallel */
16696 if (! const_0_to_<sserotatemax>_operand (operands[2], SImode))
16698 rtvec vs = rtvec_alloc (<ssescalarnum>);
16699 rtx par = gen_rtx_PARALLEL (<MODE>mode, vs);
16700 rtx reg = gen_reg_rtx (<MODE>mode);
16701 rtx op2 = operands[2];
16704 if (GET_MODE (op2) != <ssescalarmode>mode)
16706 op2 = gen_reg_rtx (<ssescalarmode>mode);
16707 convert_move (op2, operands[2], false);
16710 for (i = 0; i < <ssescalarnum>; i++)
16711 RTVEC_ELT (vs, i) = op2;
16713 emit_insn (gen_vec_init<mode><ssescalarmodelower> (reg, par));
16714 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], reg));
16719 (define_expand "rotr<mode>3"
16720 [(set (match_operand:VI_128 0 "register_operand")
16722 (match_operand:VI_128 1 "nonimmediate_operand")
16723 (match_operand:SI 2 "general_operand")))]
16726 /* If we were given a scalar, convert it to parallel */
16727 if (! const_0_to_<sserotatemax>_operand (operands[2], SImode))
16729 rtvec vs = rtvec_alloc (<ssescalarnum>);
16730 rtx par = gen_rtx_PARALLEL (<MODE>mode, vs);
16731 rtx neg = gen_reg_rtx (<MODE>mode);
16732 rtx reg = gen_reg_rtx (<MODE>mode);
16733 rtx op2 = operands[2];
16736 if (GET_MODE (op2) != <ssescalarmode>mode)
16738 op2 = gen_reg_rtx (<ssescalarmode>mode);
16739 convert_move (op2, operands[2], false);
16742 for (i = 0; i < <ssescalarnum>; i++)
16743 RTVEC_ELT (vs, i) = op2;
16745 emit_insn (gen_vec_init<mode><ssescalarmodelower> (reg, par));
16746 emit_insn (gen_neg<mode>2 (neg, reg));
16747 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], neg));
16752 (define_insn "xop_rotl<mode>3"
16753 [(set (match_operand:VI_128 0 "register_operand" "=x")
16755 (match_operand:VI_128 1 "nonimmediate_operand" "xm")
16756 (match_operand:SI 2 "const_0_to_<sserotatemax>_operand" "n")))]
16758 "vprot<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
16759 [(set_attr "type" "sseishft")
16760 (set_attr "length_immediate" "1")
16761 (set_attr "mode" "TI")])
16763 (define_insn "xop_rotr<mode>3"
16764 [(set (match_operand:VI_128 0 "register_operand" "=x")
16766 (match_operand:VI_128 1 "nonimmediate_operand" "xm")
16767 (match_operand:SI 2 "const_0_to_<sserotatemax>_operand" "n")))]
16771 = GEN_INT (GET_MODE_BITSIZE (<ssescalarmode>mode) - INTVAL (operands[2]));
16772 return \"vprot<ssemodesuffix>\t{%3, %1, %0|%0, %1, %3}\";
16774 [(set_attr "type" "sseishft")
16775 (set_attr "length_immediate" "1")
16776 (set_attr "mode" "TI")])
16778 (define_expand "vrotr<mode>3"
16779 [(match_operand:VI_128 0 "register_operand")
16780 (match_operand:VI_128 1 "register_operand")
16781 (match_operand:VI_128 2 "register_operand")]
16784 rtx reg = gen_reg_rtx (<MODE>mode);
16785 emit_insn (gen_neg<mode>2 (reg, operands[2]));
16786 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], reg));
16790 (define_expand "vrotl<mode>3"
16791 [(match_operand:VI_128 0 "register_operand")
16792 (match_operand:VI_128 1 "register_operand")
16793 (match_operand:VI_128 2 "register_operand")]
16796 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], operands[2]));
16800 (define_insn "xop_vrotl<mode>3"
16801 [(set (match_operand:VI_128 0 "register_operand" "=x,x")
16802 (if_then_else:VI_128
16804 (match_operand:VI_128 2 "nonimmediate_operand" "x,m")
16807 (match_operand:VI_128 1 "nonimmediate_operand" "xm,x")
16811 (neg:VI_128 (match_dup 2)))))]
16812 "TARGET_XOP && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
16813 "vprot<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
16814 [(set_attr "type" "sseishft")
16815 (set_attr "prefix_data16" "0")
16816 (set_attr "prefix_extra" "2")
16817 (set_attr "mode" "TI")])
16819 ;; XOP packed shift instructions.
16820 (define_expand "vlshr<mode>3"
16821 [(set (match_operand:VI12_128 0 "register_operand")
16823 (match_operand:VI12_128 1 "register_operand")
16824 (match_operand:VI12_128 2 "nonimmediate_operand")))]
16827 rtx neg = gen_reg_rtx (<MODE>mode);
16828 emit_insn (gen_neg<mode>2 (neg, operands[2]));
16829 emit_insn (gen_xop_shl<mode>3 (operands[0], operands[1], neg));
16833 (define_expand "vlshr<mode>3"
16834 [(set (match_operand:VI48_128 0 "register_operand")
16836 (match_operand:VI48_128 1 "register_operand")
16837 (match_operand:VI48_128 2 "nonimmediate_operand")))]
16838 "TARGET_AVX2 || TARGET_XOP"
16842 rtx neg = gen_reg_rtx (<MODE>mode);
16843 emit_insn (gen_neg<mode>2 (neg, operands[2]));
16844 emit_insn (gen_xop_shl<mode>3 (operands[0], operands[1], neg));
16849 (define_expand "vlshr<mode>3"
16850 [(set (match_operand:VI48_512 0 "register_operand")
16852 (match_operand:VI48_512 1 "register_operand")
16853 (match_operand:VI48_512 2 "nonimmediate_operand")))]
16856 (define_expand "vlshr<mode>3"
16857 [(set (match_operand:VI48_256 0 "register_operand")
16859 (match_operand:VI48_256 1 "register_operand")
16860 (match_operand:VI48_256 2 "nonimmediate_operand")))]
16863 (define_expand "vashrv8hi3<mask_name>"
16864 [(set (match_operand:V8HI 0 "register_operand")
16866 (match_operand:V8HI 1 "register_operand")
16867 (match_operand:V8HI 2 "nonimmediate_operand")))]
16868 "TARGET_XOP || (TARGET_AVX512BW && TARGET_AVX512VL)"
16872 rtx neg = gen_reg_rtx (V8HImode);
16873 emit_insn (gen_negv8hi2 (neg, operands[2]));
16874 emit_insn (gen_xop_shav8hi3 (operands[0], operands[1], neg));
16879 (define_expand "vashrv16qi3"
16880 [(set (match_operand:V16QI 0 "register_operand")
16882 (match_operand:V16QI 1 "register_operand")
16883 (match_operand:V16QI 2 "nonimmediate_operand")))]
16886 rtx neg = gen_reg_rtx (V16QImode);
16887 emit_insn (gen_negv16qi2 (neg, operands[2]));
16888 emit_insn (gen_xop_shav16qi3 (operands[0], operands[1], neg));
16892 (define_expand "vashrv2di3<mask_name>"
16893 [(set (match_operand:V2DI 0 "register_operand")
16895 (match_operand:V2DI 1 "register_operand")
16896 (match_operand:V2DI 2 "nonimmediate_operand")))]
16897 "TARGET_XOP || TARGET_AVX512VL"
16901 rtx neg = gen_reg_rtx (V2DImode);
16902 emit_insn (gen_negv2di2 (neg, operands[2]));
16903 emit_insn (gen_xop_shav2di3 (operands[0], operands[1], neg));
16908 (define_expand "vashrv4si3"
16909 [(set (match_operand:V4SI 0 "register_operand")
16910 (ashiftrt:V4SI (match_operand:V4SI 1 "register_operand")
16911 (match_operand:V4SI 2 "nonimmediate_operand")))]
16912 "TARGET_AVX2 || TARGET_XOP"
16916 rtx neg = gen_reg_rtx (V4SImode);
16917 emit_insn (gen_negv4si2 (neg, operands[2]));
16918 emit_insn (gen_xop_shav4si3 (operands[0], operands[1], neg));
16923 (define_expand "vashrv16si3"
16924 [(set (match_operand:V16SI 0 "register_operand")
16925 (ashiftrt:V16SI (match_operand:V16SI 1 "register_operand")
16926 (match_operand:V16SI 2 "nonimmediate_operand")))]
16929 (define_expand "vashrv8si3"
16930 [(set (match_operand:V8SI 0 "register_operand")
16931 (ashiftrt:V8SI (match_operand:V8SI 1 "register_operand")
16932 (match_operand:V8SI 2 "nonimmediate_operand")))]
16935 (define_expand "vashl<mode>3"
16936 [(set (match_operand:VI12_128 0 "register_operand")
16938 (match_operand:VI12_128 1 "register_operand")
16939 (match_operand:VI12_128 2 "nonimmediate_operand")))]
16942 emit_insn (gen_xop_sha<mode>3 (operands[0], operands[1], operands[2]));
16946 (define_expand "vashl<mode>3"
16947 [(set (match_operand:VI48_128 0 "register_operand")
16949 (match_operand:VI48_128 1 "register_operand")
16950 (match_operand:VI48_128 2 "nonimmediate_operand")))]
16951 "TARGET_AVX2 || TARGET_XOP"
16955 operands[2] = force_reg (<MODE>mode, operands[2]);
16956 emit_insn (gen_xop_sha<mode>3 (operands[0], operands[1], operands[2]));
16961 (define_expand "vashl<mode>3"
16962 [(set (match_operand:VI48_512 0 "register_operand")
16964 (match_operand:VI48_512 1 "register_operand")
16965 (match_operand:VI48_512 2 "nonimmediate_operand")))]
16968 (define_expand "vashl<mode>3"
16969 [(set (match_operand:VI48_256 0 "register_operand")
16971 (match_operand:VI48_256 1 "register_operand")
16972 (match_operand:VI48_256 2 "nonimmediate_operand")))]
16975 (define_insn "xop_sha<mode>3"
16976 [(set (match_operand:VI_128 0 "register_operand" "=x,x")
16977 (if_then_else:VI_128
16979 (match_operand:VI_128 2 "nonimmediate_operand" "x,m")
16982 (match_operand:VI_128 1 "nonimmediate_operand" "xm,x")
16986 (neg:VI_128 (match_dup 2)))))]
16987 "TARGET_XOP && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
16988 "vpsha<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
16989 [(set_attr "type" "sseishft")
16990 (set_attr "prefix_data16" "0")
16991 (set_attr "prefix_extra" "2")
16992 (set_attr "mode" "TI")])
16994 (define_insn "xop_shl<mode>3"
16995 [(set (match_operand:VI_128 0 "register_operand" "=x,x")
16996 (if_then_else:VI_128
16998 (match_operand:VI_128 2 "nonimmediate_operand" "x,m")
17001 (match_operand:VI_128 1 "nonimmediate_operand" "xm,x")
17005 (neg:VI_128 (match_dup 2)))))]
17006 "TARGET_XOP && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
17007 "vpshl<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
17008 [(set_attr "type" "sseishft")
17009 (set_attr "prefix_data16" "0")
17010 (set_attr "prefix_extra" "2")
17011 (set_attr "mode" "TI")])
17013 (define_expand "<shift_insn><mode>3"
17014 [(set (match_operand:VI1_AVX512 0 "register_operand")
17015 (any_shift:VI1_AVX512
17016 (match_operand:VI1_AVX512 1 "register_operand")
17017 (match_operand:SI 2 "nonmemory_operand")))]
17020 if (TARGET_XOP && <MODE>mode == V16QImode)
17022 bool negate = false;
17023 rtx (*gen) (rtx, rtx, rtx);
17027 if (<CODE> != ASHIFT)
17029 if (CONST_INT_P (operands[2]))
17030 operands[2] = GEN_INT (-INTVAL (operands[2]));
17034 par = gen_rtx_PARALLEL (V16QImode, rtvec_alloc (16));
17035 for (i = 0; i < 16; i++)
17036 XVECEXP (par, 0, i) = operands[2];
17038 tmp = gen_reg_rtx (V16QImode);
17039 emit_insn (gen_vec_initv16qiqi (tmp, par));
17042 emit_insn (gen_negv16qi2 (tmp, tmp));
17044 gen = (<CODE> == LSHIFTRT ? gen_xop_shlv16qi3 : gen_xop_shav16qi3);
17045 emit_insn (gen (operands[0], operands[1], tmp));
17048 ix86_expand_vecop_qihi (<CODE>, operands[0], operands[1], operands[2]);
17052 (define_expand "ashrv2di3"
17053 [(set (match_operand:V2DI 0 "register_operand")
17055 (match_operand:V2DI 1 "register_operand")
17056 (match_operand:DI 2 "nonmemory_operand")))]
17057 "TARGET_XOP || TARGET_AVX512VL"
17059 if (!TARGET_AVX512VL)
17061 rtx reg = gen_reg_rtx (V2DImode);
17063 bool negate = false;
17066 if (CONST_INT_P (operands[2]))
17067 operands[2] = GEN_INT (-INTVAL (operands[2]));
17071 par = gen_rtx_PARALLEL (V2DImode, rtvec_alloc (2));
17072 for (i = 0; i < 2; i++)
17073 XVECEXP (par, 0, i) = operands[2];
17075 emit_insn (gen_vec_initv2didi (reg, par));
17078 emit_insn (gen_negv2di2 (reg, reg));
17080 emit_insn (gen_xop_shav2di3 (operands[0], operands[1], reg));
17085 ;; XOP FRCZ support
17086 (define_insn "xop_frcz<mode>2"
17087 [(set (match_operand:FMAMODE 0 "register_operand" "=x")
17089 [(match_operand:FMAMODE 1 "nonimmediate_operand" "xm")]
17092 "vfrcz<ssemodesuffix>\t{%1, %0|%0, %1}"
17093 [(set_attr "type" "ssecvt1")
17094 (set_attr "mode" "<MODE>")])
17096 (define_expand "xop_vmfrcz<mode>2"
17097 [(set (match_operand:VF_128 0 "register_operand")
17100 [(match_operand:VF_128 1 "nonimmediate_operand")]
17105 "operands[2] = CONST0_RTX (<MODE>mode);")
17107 (define_insn "*xop_vmfrcz<mode>2"
17108 [(set (match_operand:VF_128 0 "register_operand" "=x")
17111 [(match_operand:VF_128 1 "nonimmediate_operand" "xm")]
17113 (match_operand:VF_128 2 "const0_operand")
17116 "vfrcz<ssescalarmodesuffix>\t{%1, %0|%0, %<iptr>1}"
17117 [(set_attr "type" "ssecvt1")
17118 (set_attr "mode" "<MODE>")])
17120 (define_insn "xop_maskcmp<mode>3"
17121 [(set (match_operand:VI_128 0 "register_operand" "=x")
17122 (match_operator:VI_128 1 "ix86_comparison_int_operator"
17123 [(match_operand:VI_128 2 "register_operand" "x")
17124 (match_operand:VI_128 3 "nonimmediate_operand" "xm")]))]
17126 "vpcom%Y1<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}"
17127 [(set_attr "type" "sse4arg")
17128 (set_attr "prefix_data16" "0")
17129 (set_attr "prefix_rep" "0")
17130 (set_attr "prefix_extra" "2")
17131 (set_attr "length_immediate" "1")
17132 (set_attr "mode" "TI")])
17134 (define_insn "xop_maskcmp_uns<mode>3"
17135 [(set (match_operand:VI_128 0 "register_operand" "=x")
17136 (match_operator:VI_128 1 "ix86_comparison_uns_operator"
17137 [(match_operand:VI_128 2 "register_operand" "x")
17138 (match_operand:VI_128 3 "nonimmediate_operand" "xm")]))]
17140 "vpcom%Y1u<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}"
17141 [(set_attr "type" "ssecmp")
17142 (set_attr "prefix_data16" "0")
17143 (set_attr "prefix_rep" "0")
17144 (set_attr "prefix_extra" "2")
17145 (set_attr "length_immediate" "1")
17146 (set_attr "mode" "TI")])
17148 ;; Version of pcom*u* that is called from the intrinsics that allows pcomequ*
17149 ;; and pcomneu* not to be converted to the signed ones in case somebody needs
17150 ;; the exact instruction generated for the intrinsic.
17151 (define_insn "xop_maskcmp_uns2<mode>3"
17152 [(set (match_operand:VI_128 0 "register_operand" "=x")
17154 [(match_operator:VI_128 1 "ix86_comparison_uns_operator"
17155 [(match_operand:VI_128 2 "register_operand" "x")
17156 (match_operand:VI_128 3 "nonimmediate_operand" "xm")])]
17157 UNSPEC_XOP_UNSIGNED_CMP))]
17159 "vpcom%Y1u<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}"
17160 [(set_attr "type" "ssecmp")
17161 (set_attr "prefix_data16" "0")
17162 (set_attr "prefix_extra" "2")
17163 (set_attr "length_immediate" "1")
17164 (set_attr "mode" "TI")])
17166 ;; Pcomtrue and pcomfalse support. These are useless instructions, but are
17167 ;; being added here to be complete.
17168 (define_insn "xop_pcom_tf<mode>3"
17169 [(set (match_operand:VI_128 0 "register_operand" "=x")
17171 [(match_operand:VI_128 1 "register_operand" "x")
17172 (match_operand:VI_128 2 "nonimmediate_operand" "xm")
17173 (match_operand:SI 3 "const_int_operand" "n")]
17174 UNSPEC_XOP_TRUEFALSE))]
17177 return ((INTVAL (operands[3]) != 0)
17178 ? "vpcomtrue<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
17179 : "vpcomfalse<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}");
17181 [(set_attr "type" "ssecmp")
17182 (set_attr "prefix_data16" "0")
17183 (set_attr "prefix_extra" "2")
17184 (set_attr "length_immediate" "1")
17185 (set_attr "mode" "TI")])
17187 (define_insn "xop_vpermil2<mode>3"
17188 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x")
17190 [(match_operand:VF_128_256 1 "register_operand" "x,x")
17191 (match_operand:VF_128_256 2 "nonimmediate_operand" "x,m")
17192 (match_operand:<sseintvecmode> 3 "nonimmediate_operand" "xm,x")
17193 (match_operand:SI 4 "const_0_to_3_operand" "n,n")]
17196 "vpermil2<ssemodesuffix>\t{%4, %3, %2, %1, %0|%0, %1, %2, %3, %4}"
17197 [(set_attr "type" "sse4arg")
17198 (set_attr "length_immediate" "1")
17199 (set_attr "mode" "<MODE>")])
17201 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
17203 (define_insn "aesenc"
17204 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17205 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17206 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
17210 aesenc\t{%2, %0|%0, %2}
17211 vaesenc\t{%2, %1, %0|%0, %1, %2}"
17212 [(set_attr "isa" "noavx,avx")
17213 (set_attr "type" "sselog1")
17214 (set_attr "prefix_extra" "1")
17215 (set_attr "prefix" "orig,vex")
17216 (set_attr "btver2_decode" "double,double")
17217 (set_attr "mode" "TI")])
17219 (define_insn "aesenclast"
17220 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17221 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17222 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
17223 UNSPEC_AESENCLAST))]
17226 aesenclast\t{%2, %0|%0, %2}
17227 vaesenclast\t{%2, %1, %0|%0, %1, %2}"
17228 [(set_attr "isa" "noavx,avx")
17229 (set_attr "type" "sselog1")
17230 (set_attr "prefix_extra" "1")
17231 (set_attr "prefix" "orig,vex")
17232 (set_attr "btver2_decode" "double,double")
17233 (set_attr "mode" "TI")])
17235 (define_insn "aesdec"
17236 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17237 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17238 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
17242 aesdec\t{%2, %0|%0, %2}
17243 vaesdec\t{%2, %1, %0|%0, %1, %2}"
17244 [(set_attr "isa" "noavx,avx")
17245 (set_attr "type" "sselog1")
17246 (set_attr "prefix_extra" "1")
17247 (set_attr "prefix" "orig,vex")
17248 (set_attr "btver2_decode" "double,double")
17249 (set_attr "mode" "TI")])
17251 (define_insn "aesdeclast"
17252 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17253 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17254 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
17255 UNSPEC_AESDECLAST))]
17258 aesdeclast\t{%2, %0|%0, %2}
17259 vaesdeclast\t{%2, %1, %0|%0, %1, %2}"
17260 [(set_attr "isa" "noavx,avx")
17261 (set_attr "type" "sselog1")
17262 (set_attr "prefix_extra" "1")
17263 (set_attr "prefix" "orig,vex")
17264 (set_attr "btver2_decode" "double,double")
17265 (set_attr "mode" "TI")])
17267 (define_insn "aesimc"
17268 [(set (match_operand:V2DI 0 "register_operand" "=x")
17269 (unspec:V2DI [(match_operand:V2DI 1 "vector_operand" "xBm")]
17272 "%vaesimc\t{%1, %0|%0, %1}"
17273 [(set_attr "type" "sselog1")
17274 (set_attr "prefix_extra" "1")
17275 (set_attr "prefix" "maybe_vex")
17276 (set_attr "mode" "TI")])
17278 (define_insn "aeskeygenassist"
17279 [(set (match_operand:V2DI 0 "register_operand" "=x")
17280 (unspec:V2DI [(match_operand:V2DI 1 "vector_operand" "xBm")
17281 (match_operand:SI 2 "const_0_to_255_operand" "n")]
17282 UNSPEC_AESKEYGENASSIST))]
17284 "%vaeskeygenassist\t{%2, %1, %0|%0, %1, %2}"
17285 [(set_attr "type" "sselog1")
17286 (set_attr "prefix_extra" "1")
17287 (set_attr "length_immediate" "1")
17288 (set_attr "prefix" "maybe_vex")
17289 (set_attr "mode" "TI")])
17291 (define_insn "pclmulqdq"
17292 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17293 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17294 (match_operand:V2DI 2 "vector_operand" "xBm,xm")
17295 (match_operand:SI 3 "const_0_to_255_operand" "n,n")]
17299 pclmulqdq\t{%3, %2, %0|%0, %2, %3}
17300 vpclmulqdq\t{%3, %2, %1, %0|%0, %1, %2, %3}"
17301 [(set_attr "isa" "noavx,avx")
17302 (set_attr "type" "sselog1")
17303 (set_attr "prefix_extra" "1")
17304 (set_attr "length_immediate" "1")
17305 (set_attr "prefix" "orig,vex")
17306 (set_attr "mode" "TI")])
17308 (define_expand "avx_vzeroall"
17309 [(match_par_dup 0 [(const_int 0)])]
17312 int nregs = TARGET_64BIT ? 16 : 8;
17315 operands[0] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (nregs + 1));
17317 XVECEXP (operands[0], 0, 0)
17318 = gen_rtx_UNSPEC_VOLATILE (VOIDmode, gen_rtvec (1, const0_rtx),
17321 for (regno = 0; regno < nregs; regno++)
17322 XVECEXP (operands[0], 0, regno + 1)
17323 = gen_rtx_SET (gen_rtx_REG (V8SImode, SSE_REGNO (regno)),
17324 CONST0_RTX (V8SImode));
17327 (define_insn "*avx_vzeroall"
17328 [(match_parallel 0 "vzeroall_operation"
17329 [(unspec_volatile [(const_int 0)] UNSPECV_VZEROALL)])]
17332 [(set_attr "type" "sse")
17333 (set_attr "modrm" "0")
17334 (set_attr "memory" "none")
17335 (set_attr "prefix" "vex")
17336 (set_attr "btver2_decode" "vector")
17337 (set_attr "mode" "OI")])
17339 ;; Clear the upper 128bits of AVX registers, equivalent to a NOP
17340 ;; if the upper 128bits are unused.
17341 (define_insn "avx_vzeroupper"
17342 [(unspec_volatile [(const_int 0)] UNSPECV_VZEROUPPER)]
17345 [(set_attr "type" "sse")
17346 (set_attr "modrm" "0")
17347 (set_attr "memory" "none")
17348 (set_attr "prefix" "vex")
17349 (set_attr "btver2_decode" "vector")
17350 (set_attr "mode" "OI")])
17352 (define_mode_attr pbroadcast_evex_isa
17353 [(V64QI "avx512bw") (V32QI "avx512bw") (V16QI "avx512bw")
17354 (V32HI "avx512bw") (V16HI "avx512bw") (V8HI "avx512bw")
17355 (V16SI "avx512f") (V8SI "avx512f") (V4SI "avx512f")
17356 (V8DI "avx512f") (V4DI "avx512f") (V2DI "avx512f")])
17358 (define_insn "avx2_pbroadcast<mode>"
17359 [(set (match_operand:VI 0 "register_operand" "=x,v")
17361 (vec_select:<ssescalarmode>
17362 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "xm,vm")
17363 (parallel [(const_int 0)]))))]
17365 "vpbroadcast<ssemodesuffix>\t{%1, %0|%0, %<iptr>1}"
17366 [(set_attr "isa" "*,<pbroadcast_evex_isa>")
17367 (set_attr "type" "ssemov")
17368 (set_attr "prefix_extra" "1")
17369 (set_attr "prefix" "vex,evex")
17370 (set_attr "mode" "<sseinsnmode>")])
17372 (define_insn "avx2_pbroadcast<mode>_1"
17373 [(set (match_operand:VI_256 0 "register_operand" "=x,x,v,v")
17374 (vec_duplicate:VI_256
17375 (vec_select:<ssescalarmode>
17376 (match_operand:VI_256 1 "nonimmediate_operand" "m,x,m,v")
17377 (parallel [(const_int 0)]))))]
17380 vpbroadcast<ssemodesuffix>\t{%1, %0|%0, %<iptr>1}
17381 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %x1}
17382 vpbroadcast<ssemodesuffix>\t{%1, %0|%0, %<iptr>1}
17383 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %x1}"
17384 [(set_attr "isa" "*,*,<pbroadcast_evex_isa>,<pbroadcast_evex_isa>")
17385 (set_attr "type" "ssemov")
17386 (set_attr "prefix_extra" "1")
17387 (set_attr "prefix" "vex")
17388 (set_attr "mode" "<sseinsnmode>")])
17390 (define_insn "<avx2_avx512>_permvar<mode><mask_name>"
17391 [(set (match_operand:VI48F_256_512 0 "register_operand" "=v")
17392 (unspec:VI48F_256_512
17393 [(match_operand:VI48F_256_512 1 "nonimmediate_operand" "vm")
17394 (match_operand:<sseintvecmode> 2 "register_operand" "v")]
17396 "TARGET_AVX2 && <mask_mode512bit_condition>"
17397 "vperm<ssemodesuffix>\t{%1, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1}"
17398 [(set_attr "type" "sselog")
17399 (set_attr "prefix" "<mask_prefix2>")
17400 (set_attr "mode" "<sseinsnmode>")])
17402 (define_insn "<avx512>_permvar<mode><mask_name>"
17403 [(set (match_operand:VI1_AVX512VL 0 "register_operand" "=v")
17404 (unspec:VI1_AVX512VL
17405 [(match_operand:VI1_AVX512VL 1 "nonimmediate_operand" "vm")
17406 (match_operand:<sseintvecmode> 2 "register_operand" "v")]
17408 "TARGET_AVX512VBMI && <mask_mode512bit_condition>"
17409 "vperm<ssemodesuffix>\t{%1, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1}"
17410 [(set_attr "type" "sselog")
17411 (set_attr "prefix" "<mask_prefix2>")
17412 (set_attr "mode" "<sseinsnmode>")])
17414 (define_insn "<avx512>_permvar<mode><mask_name>"
17415 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
17416 (unspec:VI2_AVX512VL
17417 [(match_operand:VI2_AVX512VL 1 "nonimmediate_operand" "vm")
17418 (match_operand:<sseintvecmode> 2 "register_operand" "v")]
17420 "TARGET_AVX512BW && <mask_mode512bit_condition>"
17421 "vperm<ssemodesuffix>\t{%1, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1}"
17422 [(set_attr "type" "sselog")
17423 (set_attr "prefix" "<mask_prefix2>")
17424 (set_attr "mode" "<sseinsnmode>")])
17426 (define_expand "avx2_perm<mode>"
17427 [(match_operand:VI8F_256 0 "register_operand")
17428 (match_operand:VI8F_256 1 "nonimmediate_operand")
17429 (match_operand:SI 2 "const_0_to_255_operand")]
17432 int mask = INTVAL (operands[2]);
17433 emit_insn (gen_avx2_perm<mode>_1 (operands[0], operands[1],
17434 GEN_INT ((mask >> 0) & 3),
17435 GEN_INT ((mask >> 2) & 3),
17436 GEN_INT ((mask >> 4) & 3),
17437 GEN_INT ((mask >> 6) & 3)));
17441 (define_expand "avx512vl_perm<mode>_mask"
17442 [(match_operand:VI8F_256 0 "register_operand")
17443 (match_operand:VI8F_256 1 "nonimmediate_operand")
17444 (match_operand:SI 2 "const_0_to_255_operand")
17445 (match_operand:VI8F_256 3 "vector_move_operand")
17446 (match_operand:<avx512fmaskmode> 4 "register_operand")]
17449 int mask = INTVAL (operands[2]);
17450 emit_insn (gen_<avx2_avx512>_perm<mode>_1_mask (operands[0], operands[1],
17451 GEN_INT ((mask >> 0) & 3),
17452 GEN_INT ((mask >> 2) & 3),
17453 GEN_INT ((mask >> 4) & 3),
17454 GEN_INT ((mask >> 6) & 3),
17455 operands[3], operands[4]));
17459 (define_insn "avx2_perm<mode>_1<mask_name>"
17460 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
17461 (vec_select:VI8F_256
17462 (match_operand:VI8F_256 1 "nonimmediate_operand" "vm")
17463 (parallel [(match_operand 2 "const_0_to_3_operand")
17464 (match_operand 3 "const_0_to_3_operand")
17465 (match_operand 4 "const_0_to_3_operand")
17466 (match_operand 5 "const_0_to_3_operand")])))]
17467 "TARGET_AVX2 && <mask_mode512bit_condition>"
17470 mask |= INTVAL (operands[2]) << 0;
17471 mask |= INTVAL (operands[3]) << 2;
17472 mask |= INTVAL (operands[4]) << 4;
17473 mask |= INTVAL (operands[5]) << 6;
17474 operands[2] = GEN_INT (mask);
17475 return "vperm<ssemodesuffix>\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
17477 [(set_attr "type" "sselog")
17478 (set_attr "prefix" "<mask_prefix2>")
17479 (set_attr "mode" "<sseinsnmode>")])
17481 (define_expand "avx512f_perm<mode>"
17482 [(match_operand:V8FI 0 "register_operand")
17483 (match_operand:V8FI 1 "nonimmediate_operand")
17484 (match_operand:SI 2 "const_0_to_255_operand")]
17487 int mask = INTVAL (operands[2]);
17488 emit_insn (gen_avx512f_perm<mode>_1 (operands[0], operands[1],
17489 GEN_INT ((mask >> 0) & 3),
17490 GEN_INT ((mask >> 2) & 3),
17491 GEN_INT ((mask >> 4) & 3),
17492 GEN_INT ((mask >> 6) & 3),
17493 GEN_INT (((mask >> 0) & 3) + 4),
17494 GEN_INT (((mask >> 2) & 3) + 4),
17495 GEN_INT (((mask >> 4) & 3) + 4),
17496 GEN_INT (((mask >> 6) & 3) + 4)));
17500 (define_expand "avx512f_perm<mode>_mask"
17501 [(match_operand:V8FI 0 "register_operand")
17502 (match_operand:V8FI 1 "nonimmediate_operand")
17503 (match_operand:SI 2 "const_0_to_255_operand")
17504 (match_operand:V8FI 3 "vector_move_operand")
17505 (match_operand:<avx512fmaskmode> 4 "register_operand")]
17508 int mask = INTVAL (operands[2]);
17509 emit_insn (gen_avx512f_perm<mode>_1_mask (operands[0], operands[1],
17510 GEN_INT ((mask >> 0) & 3),
17511 GEN_INT ((mask >> 2) & 3),
17512 GEN_INT ((mask >> 4) & 3),
17513 GEN_INT ((mask >> 6) & 3),
17514 GEN_INT (((mask >> 0) & 3) + 4),
17515 GEN_INT (((mask >> 2) & 3) + 4),
17516 GEN_INT (((mask >> 4) & 3) + 4),
17517 GEN_INT (((mask >> 6) & 3) + 4),
17518 operands[3], operands[4]));
17522 (define_insn "avx512f_perm<mode>_1<mask_name>"
17523 [(set (match_operand:V8FI 0 "register_operand" "=v")
17525 (match_operand:V8FI 1 "nonimmediate_operand" "vm")
17526 (parallel [(match_operand 2 "const_0_to_3_operand")
17527 (match_operand 3 "const_0_to_3_operand")
17528 (match_operand 4 "const_0_to_3_operand")
17529 (match_operand 5 "const_0_to_3_operand")
17530 (match_operand 6 "const_4_to_7_operand")
17531 (match_operand 7 "const_4_to_7_operand")
17532 (match_operand 8 "const_4_to_7_operand")
17533 (match_operand 9 "const_4_to_7_operand")])))]
17534 "TARGET_AVX512F && <mask_mode512bit_condition>
17535 && (INTVAL (operands[2]) == (INTVAL (operands[6]) - 4)
17536 && INTVAL (operands[3]) == (INTVAL (operands[7]) - 4)
17537 && INTVAL (operands[4]) == (INTVAL (operands[8]) - 4)
17538 && INTVAL (operands[5]) == (INTVAL (operands[9]) - 4))"
17541 mask |= INTVAL (operands[2]) << 0;
17542 mask |= INTVAL (operands[3]) << 2;
17543 mask |= INTVAL (operands[4]) << 4;
17544 mask |= INTVAL (operands[5]) << 6;
17545 operands[2] = GEN_INT (mask);
17546 return "vperm<ssemodesuffix>\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
17548 [(set_attr "type" "sselog")
17549 (set_attr "prefix" "<mask_prefix2>")
17550 (set_attr "mode" "<sseinsnmode>")])
17552 (define_insn "avx2_permv2ti"
17553 [(set (match_operand:V4DI 0 "register_operand" "=x")
17555 [(match_operand:V4DI 1 "register_operand" "x")
17556 (match_operand:V4DI 2 "nonimmediate_operand" "xm")
17557 (match_operand:SI 3 "const_0_to_255_operand" "n")]
17560 "vperm2i128\t{%3, %2, %1, %0|%0, %1, %2, %3}"
17561 [(set_attr "type" "sselog")
17562 (set_attr "prefix" "vex")
17563 (set_attr "mode" "OI")])
17565 (define_insn "avx2_vec_dupv4df"
17566 [(set (match_operand:V4DF 0 "register_operand" "=v")
17567 (vec_duplicate:V4DF
17569 (match_operand:V2DF 1 "register_operand" "v")
17570 (parallel [(const_int 0)]))))]
17572 "vbroadcastsd\t{%1, %0|%0, %1}"
17573 [(set_attr "type" "sselog1")
17574 (set_attr "prefix" "maybe_evex")
17575 (set_attr "mode" "V4DF")])
17577 (define_insn "<avx512>_vec_dup<mode>_1"
17578 [(set (match_operand:VI_AVX512BW 0 "register_operand" "=v,v")
17579 (vec_duplicate:VI_AVX512BW
17580 (vec_select:<ssescalarmode>
17581 (match_operand:VI_AVX512BW 1 "nonimmediate_operand" "v,m")
17582 (parallel [(const_int 0)]))))]
17585 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %x1}
17586 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %<iptr>1}"
17587 [(set_attr "type" "ssemov")
17588 (set_attr "prefix" "evex")
17589 (set_attr "mode" "<sseinsnmode>")])
17591 (define_insn "<avx512>_vec_dup<mode><mask_name>"
17592 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v")
17593 (vec_duplicate:V48_AVX512VL
17594 (vec_select:<ssescalarmode>
17595 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "vm")
17596 (parallel [(const_int 0)]))))]
17599 /* There is no DF broadcast (in AVX-512*) to 128b register.
17600 Mimic it with integer variant. */
17601 if (<MODE>mode == V2DFmode)
17602 return "vpbroadcastq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}";
17604 if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 4)
17605 return "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}";
17607 return "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}";
17609 [(set_attr "type" "ssemov")
17610 (set_attr "prefix" "evex")
17611 (set_attr "mode" "<sseinsnmode>")])
17613 (define_insn "<avx512>_vec_dup<mode><mask_name>"
17614 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
17615 (vec_duplicate:VI12_AVX512VL
17616 (vec_select:<ssescalarmode>
17617 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "vm")
17618 (parallel [(const_int 0)]))))]
17620 "vpbroadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17621 [(set_attr "type" "ssemov")
17622 (set_attr "prefix" "evex")
17623 (set_attr "mode" "<sseinsnmode>")])
17625 (define_insn "<mask_codefor>avx512f_broadcast<mode><mask_name>"
17626 [(set (match_operand:V16FI 0 "register_operand" "=v,v")
17627 (vec_duplicate:V16FI
17628 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "v,m")))]
17631 vshuf<shuffletype>32x4\t{$0x0, %g1, %g1, %0<mask_operand2>|%0<mask_operand2>, %g1, %g1, 0x0}
17632 vbroadcast<shuffletype>32x4\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17633 [(set_attr "type" "ssemov")
17634 (set_attr "prefix" "evex")
17635 (set_attr "mode" "<sseinsnmode>")])
17637 (define_insn "<mask_codefor>avx512f_broadcast<mode><mask_name>"
17638 [(set (match_operand:V8FI 0 "register_operand" "=v,v")
17639 (vec_duplicate:V8FI
17640 (match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "v,m")))]
17643 vshuf<shuffletype>64x2\t{$0x44, %g1, %g1, %0<mask_operand2>|%0<mask_operand2>, %g1, %g1, 0x44}
17644 vbroadcast<shuffletype>64x4\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17645 [(set_attr "type" "ssemov")
17646 (set_attr "prefix" "evex")
17647 (set_attr "mode" "<sseinsnmode>")])
17649 (define_insn "<mask_codefor><avx512>_vec_dup_gpr<mode><mask_name>"
17650 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v,v")
17651 (vec_duplicate:VI12_AVX512VL
17652 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "vm,r")))]
17655 vpbroadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}
17656 vpbroadcast<bcstscalarsuff>\t{%k1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
17657 [(set_attr "type" "ssemov")
17658 (set_attr "prefix" "evex")
17659 (set_attr "mode" "<sseinsnmode>")])
17661 (define_insn "<mask_codefor><avx512>_vec_dup_gpr<mode><mask_name>"
17662 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v,v")
17663 (vec_duplicate:V48_AVX512VL
17664 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "vm,r")))]
17666 "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17667 [(set_attr "type" "ssemov")
17668 (set_attr "prefix" "evex")
17669 (set_attr "mode" "<sseinsnmode>")
17670 (set (attr "enabled")
17671 (if_then_else (eq_attr "alternative" "1")
17672 (symbol_ref "GET_MODE_CLASS (<ssescalarmode>mode) == MODE_INT
17673 && (<ssescalarmode>mode != DImode || TARGET_64BIT)")
17676 (define_insn "vec_dupv4sf"
17677 [(set (match_operand:V4SF 0 "register_operand" "=v,v,x")
17678 (vec_duplicate:V4SF
17679 (match_operand:SF 1 "nonimmediate_operand" "Yv,m,0")))]
17682 vshufps\t{$0, %1, %1, %0|%0, %1, %1, 0}
17683 vbroadcastss\t{%1, %0|%0, %1}
17684 shufps\t{$0, %0, %0|%0, %0, 0}"
17685 [(set_attr "isa" "avx,avx,noavx")
17686 (set_attr "type" "sseshuf1,ssemov,sseshuf1")
17687 (set_attr "length_immediate" "1,0,1")
17688 (set_attr "prefix_extra" "0,1,*")
17689 (set_attr "prefix" "maybe_evex,maybe_evex,orig")
17690 (set_attr "mode" "V4SF")])
17692 (define_insn "*vec_dupv4si"
17693 [(set (match_operand:V4SI 0 "register_operand" "=v,v,x")
17694 (vec_duplicate:V4SI
17695 (match_operand:SI 1 "nonimmediate_operand" "Yv,m,0")))]
17698 %vpshufd\t{$0, %1, %0|%0, %1, 0}
17699 vbroadcastss\t{%1, %0|%0, %1}
17700 shufps\t{$0, %0, %0|%0, %0, 0}"
17701 [(set_attr "isa" "sse2,avx,noavx")
17702 (set_attr "type" "sselog1,ssemov,sselog1")
17703 (set_attr "length_immediate" "1,0,1")
17704 (set_attr "prefix_extra" "0,1,*")
17705 (set_attr "prefix" "maybe_vex,maybe_evex,orig")
17706 (set_attr "mode" "TI,V4SF,V4SF")])
17708 (define_insn "*vec_dupv2di"
17709 [(set (match_operand:V2DI 0 "register_operand" "=x,v,v,x")
17710 (vec_duplicate:V2DI
17711 (match_operand:DI 1 "nonimmediate_operand" " 0,Yv,m,0")))]
17715 vpunpcklqdq\t{%d1, %0|%0, %d1}
17716 %vmovddup\t{%1, %0|%0, %1}
17718 [(set_attr "isa" "sse2_noavx,avx,sse3,noavx")
17719 (set_attr "type" "sselog1,sselog1,sselog1,ssemov")
17720 (set_attr "prefix" "orig,maybe_evex,maybe_vex,orig")
17721 (set_attr "mode" "TI,TI,DF,V4SF")])
17723 (define_insn "avx2_vbroadcasti128_<mode>"
17724 [(set (match_operand:VI_256 0 "register_operand" "=x,v,v")
17726 (match_operand:<ssehalfvecmode> 1 "memory_operand" "m,m,m")
17730 vbroadcasti128\t{%1, %0|%0, %1}
17731 vbroadcast<i128vldq>\t{%1, %0|%0, %1}
17732 vbroadcast<shuffletype>32x4\t{%1, %0|%0, %1}"
17733 [(set_attr "isa" "*,avx512dq,avx512vl")
17734 (set_attr "type" "ssemov")
17735 (set_attr "prefix_extra" "1")
17736 (set_attr "prefix" "vex,evex,evex")
17737 (set_attr "mode" "OI")])
17739 ;; Modes handled by AVX vec_dup patterns.
17740 (define_mode_iterator AVX_VEC_DUP_MODE
17741 [V8SI V8SF V4DI V4DF])
17742 ;; Modes handled by AVX2 vec_dup patterns.
17743 (define_mode_iterator AVX2_VEC_DUP_MODE
17744 [V32QI V16QI V16HI V8HI V8SI V4SI])
17746 (define_insn "*vec_dup<mode>"
17747 [(set (match_operand:AVX2_VEC_DUP_MODE 0 "register_operand" "=x,x,Yi")
17748 (vec_duplicate:AVX2_VEC_DUP_MODE
17749 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "m,x,$r")))]
17752 v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0|%0, %1}
17753 v<sseintprefix>broadcast<bcstscalarsuff>\t{%x1, %0|%0, %x1}
17755 [(set_attr "isa" "*,*,noavx512vl")
17756 (set_attr "type" "ssemov")
17757 (set_attr "prefix_extra" "1")
17758 (set_attr "prefix" "maybe_evex")
17759 (set_attr "mode" "<sseinsnmode>")])
17761 (define_insn "vec_dup<mode>"
17762 [(set (match_operand:AVX_VEC_DUP_MODE 0 "register_operand" "=x,x,x,v,x")
17763 (vec_duplicate:AVX_VEC_DUP_MODE
17764 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "m,m,x,v,?x")))]
17767 v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0|%0, %1}
17768 vbroadcast<ssescalarmodesuffix>\t{%1, %0|%0, %1}
17769 v<sseintprefix>broadcast<bcstscalarsuff>\t{%x1, %0|%0, %x1}
17770 v<sseintprefix>broadcast<bcstscalarsuff>\t{%x1, %g0|%g0, %x1}
17772 [(set_attr "type" "ssemov")
17773 (set_attr "prefix_extra" "1")
17774 (set_attr "prefix" "maybe_evex")
17775 (set_attr "isa" "avx2,noavx2,avx2,avx512f,noavx2")
17776 (set_attr "mode" "<sseinsnmode>,V8SF,<sseinsnmode>,<sseinsnmode>,V8SF")])
17779 [(set (match_operand:AVX2_VEC_DUP_MODE 0 "register_operand")
17780 (vec_duplicate:AVX2_VEC_DUP_MODE
17781 (match_operand:<ssescalarmode> 1 "register_operand")))]
17783 /* Disable this splitter if avx512vl_vec_dup_gprv*[qhs]i insn is
17784 available, because then we can broadcast from GPRs directly.
17785 For V*[QH]I modes it requires both -mavx512vl and -mavx512bw,
17786 for V*SI mode it requires just -mavx512vl. */
17787 && !(TARGET_AVX512VL
17788 && (TARGET_AVX512BW || <ssescalarmode>mode == SImode))
17789 && reload_completed && GENERAL_REG_P (operands[1])"
17792 emit_insn (gen_vec_setv4si_0 (gen_lowpart (V4SImode, operands[0]),
17793 CONST0_RTX (V4SImode),
17794 gen_lowpart (SImode, operands[1])));
17795 emit_insn (gen_avx2_pbroadcast<mode> (operands[0],
17796 gen_lowpart (<ssexmmmode>mode,
17802 [(set (match_operand:AVX_VEC_DUP_MODE 0 "register_operand")
17803 (vec_duplicate:AVX_VEC_DUP_MODE
17804 (match_operand:<ssescalarmode> 1 "register_operand")))]
17805 "TARGET_AVX && !TARGET_AVX2 && reload_completed"
17806 [(set (match_dup 2)
17807 (vec_duplicate:<ssehalfvecmode> (match_dup 1)))
17809 (vec_concat:AVX_VEC_DUP_MODE (match_dup 2) (match_dup 2)))]
17810 "operands[2] = gen_lowpart (<ssehalfvecmode>mode, operands[0]);")
17812 (define_insn "avx_vbroadcastf128_<mode>"
17813 [(set (match_operand:V_256 0 "register_operand" "=x,x,x,v,v,v,v")
17815 (match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "m,0,?x,m,0,m,0")
17819 vbroadcast<i128>\t{%1, %0|%0, %1}
17820 vinsert<i128>\t{$1, %1, %0, %0|%0, %0, %1, 1}
17821 vperm2<i128>\t{$0, %t1, %t1, %0|%0, %t1, %t1, 0}
17822 vbroadcast<i128vldq>\t{%1, %0|%0, %1}
17823 vinsert<i128vldq>\t{$1, %1, %0, %0|%0, %0, %1, 1}
17824 vbroadcast<shuffletype>32x4\t{%1, %0|%0, %1}
17825 vinsert<shuffletype>32x4\t{$1, %1, %0, %0|%0, %0, %1, 1}"
17826 [(set_attr "isa" "*,*,*,avx512dq,avx512dq,avx512vl,avx512vl")
17827 (set_attr "type" "ssemov,sselog1,sselog1,ssemov,sselog1,ssemov,sselog1")
17828 (set_attr "prefix_extra" "1")
17829 (set_attr "length_immediate" "0,1,1,0,1,0,1")
17830 (set_attr "prefix" "vex,vex,vex,evex,evex,evex,evex")
17831 (set_attr "mode" "<sseinsnmode>")])
17833 ;; For broadcast[i|f]32x2. Yes there is no v4sf version, only v4si.
17834 (define_mode_iterator VI4F_BRCST32x2
17835 [V16SI (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")
17836 V16SF (V8SF "TARGET_AVX512VL")])
17838 (define_mode_attr 64x2mode
17839 [(V8DF "V2DF") (V8DI "V2DI") (V4DI "V2DI") (V4DF "V2DF")])
17841 (define_mode_attr 32x2mode
17842 [(V16SF "V2SF") (V16SI "V2SI") (V8SI "V2SI")
17843 (V8SF "V2SF") (V4SI "V2SI")])
17845 (define_insn "<mask_codefor>avx512dq_broadcast<mode><mask_name>"
17846 [(set (match_operand:VI4F_BRCST32x2 0 "register_operand" "=v")
17847 (vec_duplicate:VI4F_BRCST32x2
17848 (vec_select:<32x2mode>
17849 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "vm")
17850 (parallel [(const_int 0) (const_int 1)]))))]
17852 "vbroadcast<shuffletype>32x2\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
17853 [(set_attr "type" "ssemov")
17854 (set_attr "prefix_extra" "1")
17855 (set_attr "prefix" "evex")
17856 (set_attr "mode" "<sseinsnmode>")])
17858 (define_insn "<mask_codefor>avx512vl_broadcast<mode><mask_name>_1"
17859 [(set (match_operand:VI4F_256 0 "register_operand" "=v,v")
17860 (vec_duplicate:VI4F_256
17861 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "v,m")))]
17864 vshuf<shuffletype>32x4\t{$0x0, %t1, %t1, %0<mask_operand2>|%0<mask_operand2>, %t1, %t1, 0x0}
17865 vbroadcast<shuffletype>32x4\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17866 [(set_attr "type" "ssemov")
17867 (set_attr "prefix_extra" "1")
17868 (set_attr "prefix" "evex")
17869 (set_attr "mode" "<sseinsnmode>")])
17871 (define_insn "<mask_codefor>avx512dq_broadcast<mode><mask_name>_1"
17872 [(set (match_operand:V16FI 0 "register_operand" "=v,v")
17873 (vec_duplicate:V16FI
17874 (match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "v,m")))]
17877 vshuf<shuffletype>32x4\t{$0x44, %g1, %g1, %0<mask_operand2>|%0<mask_operand2>, %g1, %g1, 0x44}
17878 vbroadcast<shuffletype>32x8\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17879 [(set_attr "type" "ssemov")
17880 (set_attr "prefix_extra" "1")
17881 (set_attr "prefix" "evex")
17882 (set_attr "mode" "<sseinsnmode>")])
17884 ;; For broadcast[i|f]64x2
17885 (define_mode_iterator VI8F_BRCST64x2
17886 [V8DI V8DF (V4DI "TARGET_AVX512VL") (V4DF "TARGET_AVX512VL")])
17888 (define_insn "<mask_codefor>avx512dq_broadcast<mode><mask_name>_1"
17889 [(set (match_operand:VI8F_BRCST64x2 0 "register_operand" "=v,v")
17890 (vec_duplicate:VI8F_BRCST64x2
17891 (match_operand:<64x2mode> 1 "nonimmediate_operand" "v,m")))]
17894 vshuf<shuffletype>64x2\t{$0x0, %<concat_tg_mode>1, %<concat_tg_mode>1, %0<mask_operand2>|%0<mask_operand2>, %<concat_tg_mode>1, %<concat_tg_mode>1, 0x0}
17895 vbroadcast<shuffletype>64x2\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17896 [(set_attr "type" "ssemov")
17897 (set_attr "prefix_extra" "1")
17898 (set_attr "prefix" "evex")
17899 (set_attr "mode" "<sseinsnmode>")])
17901 (define_insn "avx512cd_maskb_vec_dup<mode>"
17902 [(set (match_operand:VI8_AVX512VL 0 "register_operand" "=v")
17903 (vec_duplicate:VI8_AVX512VL
17905 (match_operand:QI 1 "register_operand" "Yk"))))]
17907 "vpbroadcastmb2q\t{%1, %0|%0, %1}"
17908 [(set_attr "type" "mskmov")
17909 (set_attr "prefix" "evex")
17910 (set_attr "mode" "XI")])
17912 (define_insn "avx512cd_maskw_vec_dup<mode>"
17913 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
17914 (vec_duplicate:VI4_AVX512VL
17916 (match_operand:HI 1 "register_operand" "Yk"))))]
17918 "vpbroadcastmw2d\t{%1, %0|%0, %1}"
17919 [(set_attr "type" "mskmov")
17920 (set_attr "prefix" "evex")
17921 (set_attr "mode" "XI")])
17923 ;; Recognize broadcast as a vec_select as produced by builtin_vec_perm.
17924 ;; If it so happens that the input is in memory, use vbroadcast.
17925 ;; Otherwise use vpermilp (and in the case of 256-bit modes, vperm2f128).
17926 (define_insn "*avx_vperm_broadcast_v4sf"
17927 [(set (match_operand:V4SF 0 "register_operand" "=v,v,v")
17929 (match_operand:V4SF 1 "nonimmediate_operand" "m,o,v")
17930 (match_parallel 2 "avx_vbroadcast_operand"
17931 [(match_operand 3 "const_int_operand" "C,n,n")])))]
17934 int elt = INTVAL (operands[3]);
17935 switch (which_alternative)
17939 operands[1] = adjust_address_nv (operands[1], SFmode, elt * 4);
17940 return "vbroadcastss\t{%1, %0|%0, %k1}";
17942 operands[2] = GEN_INT (elt * 0x55);
17943 return "vpermilps\t{%2, %1, %0|%0, %1, %2}";
17945 gcc_unreachable ();
17948 [(set_attr "type" "ssemov,ssemov,sselog1")
17949 (set_attr "prefix_extra" "1")
17950 (set_attr "length_immediate" "0,0,1")
17951 (set_attr "prefix" "maybe_evex")
17952 (set_attr "mode" "SF,SF,V4SF")])
17954 (define_insn_and_split "*avx_vperm_broadcast_<mode>"
17955 [(set (match_operand:VF_256 0 "register_operand" "=v,v,v")
17957 (match_operand:VF_256 1 "nonimmediate_operand" "m,o,?v")
17958 (match_parallel 2 "avx_vbroadcast_operand"
17959 [(match_operand 3 "const_int_operand" "C,n,n")])))]
17962 "&& reload_completed && (<MODE>mode != V4DFmode || !TARGET_AVX2)"
17963 [(set (match_dup 0) (vec_duplicate:VF_256 (match_dup 1)))]
17965 rtx op0 = operands[0], op1 = operands[1];
17966 int elt = INTVAL (operands[3]);
17972 if (TARGET_AVX2 && elt == 0)
17974 emit_insn (gen_vec_dup<mode> (op0, gen_lowpart (<ssescalarmode>mode,
17979 /* Shuffle element we care about into all elements of the 128-bit lane.
17980 The other lane gets shuffled too, but we don't care. */
17981 if (<MODE>mode == V4DFmode)
17982 mask = (elt & 1 ? 15 : 0);
17984 mask = (elt & 3) * 0x55;
17985 emit_insn (gen_avx_vpermil<mode> (op0, op1, GEN_INT (mask)));
17987 /* Shuffle the lane we care about into both lanes of the dest. */
17988 mask = (elt / (<ssescalarnum> / 2)) * 0x11;
17989 if (EXT_REX_SSE_REG_P (op0))
17991 /* There is no EVEX VPERM2F128, but we can use either VBROADCASTSS
17993 gcc_assert (<MODE>mode == V8SFmode);
17994 if ((mask & 1) == 0)
17995 emit_insn (gen_avx2_vec_dupv8sf (op0,
17996 gen_lowpart (V4SFmode, op0)));
17998 emit_insn (gen_avx512vl_shuf_f32x4_1 (op0, op0, op0,
17999 GEN_INT (4), GEN_INT (5),
18000 GEN_INT (6), GEN_INT (7),
18001 GEN_INT (12), GEN_INT (13),
18002 GEN_INT (14), GEN_INT (15)));
18006 emit_insn (gen_avx_vperm2f128<mode>3 (op0, op0, op0, GEN_INT (mask)));
18010 operands[1] = adjust_address (op1, <ssescalarmode>mode,
18011 elt * GET_MODE_SIZE (<ssescalarmode>mode));
18014 (define_expand "<sse2_avx_avx512f>_vpermil<mode><mask_name>"
18015 [(set (match_operand:VF2 0 "register_operand")
18017 (match_operand:VF2 1 "nonimmediate_operand")
18018 (match_operand:SI 2 "const_0_to_255_operand")))]
18019 "TARGET_AVX && <mask_mode512bit_condition>"
18021 int mask = INTVAL (operands[2]);
18022 rtx perm[<ssescalarnum>];
18025 for (i = 0; i < <ssescalarnum>; i = i + 2)
18027 perm[i] = GEN_INT (((mask >> i) & 1) + i);
18028 perm[i + 1] = GEN_INT (((mask >> (i + 1)) & 1) + i);
18032 = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (<ssescalarnum>, perm));
18035 (define_expand "<sse2_avx_avx512f>_vpermil<mode><mask_name>"
18036 [(set (match_operand:VF1 0 "register_operand")
18038 (match_operand:VF1 1 "nonimmediate_operand")
18039 (match_operand:SI 2 "const_0_to_255_operand")))]
18040 "TARGET_AVX && <mask_mode512bit_condition>"
18042 int mask = INTVAL (operands[2]);
18043 rtx perm[<ssescalarnum>];
18046 for (i = 0; i < <ssescalarnum>; i = i + 4)
18048 perm[i] = GEN_INT (((mask >> 0) & 3) + i);
18049 perm[i + 1] = GEN_INT (((mask >> 2) & 3) + i);
18050 perm[i + 2] = GEN_INT (((mask >> 4) & 3) + i);
18051 perm[i + 3] = GEN_INT (((mask >> 6) & 3) + i);
18055 = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (<ssescalarnum>, perm));
18058 (define_insn "*<sse2_avx_avx512f>_vpermilp<mode><mask_name>"
18059 [(set (match_operand:VF 0 "register_operand" "=v")
18061 (match_operand:VF 1 "nonimmediate_operand" "vm")
18062 (match_parallel 2 ""
18063 [(match_operand 3 "const_int_operand")])))]
18064 "TARGET_AVX && <mask_mode512bit_condition>
18065 && avx_vpermilp_parallel (operands[2], <MODE>mode)"
18067 int mask = avx_vpermilp_parallel (operands[2], <MODE>mode) - 1;
18068 operands[2] = GEN_INT (mask);
18069 return "vpermil<ssemodesuffix>\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}";
18071 [(set_attr "type" "sselog")
18072 (set_attr "prefix_extra" "1")
18073 (set_attr "length_immediate" "1")
18074 (set_attr "prefix" "<mask_prefix>")
18075 (set_attr "mode" "<sseinsnmode>")])
18077 (define_insn "<sse2_avx_avx512f>_vpermilvar<mode>3<mask_name>"
18078 [(set (match_operand:VF 0 "register_operand" "=v")
18080 [(match_operand:VF 1 "register_operand" "v")
18081 (match_operand:<sseintvecmode> 2 "nonimmediate_operand" "vm")]
18083 "TARGET_AVX && <mask_mode512bit_condition>"
18084 "vpermil<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18085 [(set_attr "type" "sselog")
18086 (set_attr "prefix_extra" "1")
18087 (set_attr "btver2_decode" "vector")
18088 (set_attr "prefix" "<mask_prefix>")
18089 (set_attr "mode" "<sseinsnmode>")])
18091 (define_mode_iterator VPERMI2
18092 [V16SI V16SF V8DI V8DF
18093 (V8SI "TARGET_AVX512VL") (V8SF "TARGET_AVX512VL")
18094 (V4DI "TARGET_AVX512VL") (V4DF "TARGET_AVX512VL")
18095 (V4SI "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
18096 (V2DI "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")
18097 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX512BW && TARGET_AVX512VL")
18098 (V8HI "TARGET_AVX512BW && TARGET_AVX512VL")
18099 (V64QI "TARGET_AVX512VBMI") (V32QI "TARGET_AVX512VBMI && TARGET_AVX512VL")
18100 (V16QI "TARGET_AVX512VBMI && TARGET_AVX512VL")])
18102 (define_mode_iterator VPERMI2I
18104 (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")
18105 (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")
18106 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX512BW && TARGET_AVX512VL")
18107 (V8HI "TARGET_AVX512BW && TARGET_AVX512VL")
18108 (V64QI "TARGET_AVX512VBMI") (V32QI "TARGET_AVX512VBMI && TARGET_AVX512VL")
18109 (V16QI "TARGET_AVX512VBMI && TARGET_AVX512VL")])
18111 (define_expand "<avx512>_vpermi2var<mode>3_mask"
18112 [(set (match_operand:VPERMI2 0 "register_operand")
18115 [(match_operand:<sseintvecmode> 2 "register_operand")
18116 (match_operand:VPERMI2 1 "register_operand")
18117 (match_operand:VPERMI2 3 "nonimmediate_operand")]
18120 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
18122 "operands[5] = gen_lowpart (<MODE>mode, operands[2]);")
18124 (define_insn "*<avx512>_vpermi2var<mode>3_mask"
18125 [(set (match_operand:VPERMI2I 0 "register_operand" "=v")
18126 (vec_merge:VPERMI2I
18128 [(match_operand:<sseintvecmode> 2 "register_operand" "0")
18129 (match_operand:VPERMI2I 1 "register_operand" "v")
18130 (match_operand:VPERMI2I 3 "nonimmediate_operand" "vm")]
18133 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
18135 "vpermi2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
18136 [(set_attr "type" "sselog")
18137 (set_attr "prefix" "evex")
18138 (set_attr "mode" "<sseinsnmode>")])
18140 (define_insn "*<avx512>_vpermi2var<mode>3_mask"
18141 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
18142 (vec_merge:VF_AVX512VL
18143 (unspec:VF_AVX512VL
18144 [(match_operand:<sseintvecmode> 2 "register_operand" "0")
18145 (match_operand:VF_AVX512VL 1 "register_operand" "v")
18146 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "vm")]
18148 (subreg:VF_AVX512VL (match_dup 2) 0)
18149 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
18151 "vpermi2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
18152 [(set_attr "type" "sselog")
18153 (set_attr "prefix" "evex")
18154 (set_attr "mode" "<sseinsnmode>")])
18156 (define_expand "<avx512>_vpermt2var<mode>3_maskz"
18157 [(match_operand:VPERMI2 0 "register_operand")
18158 (match_operand:<sseintvecmode> 1 "register_operand")
18159 (match_operand:VPERMI2 2 "register_operand")
18160 (match_operand:VPERMI2 3 "nonimmediate_operand")
18161 (match_operand:<avx512fmaskmode> 4 "register_operand")]
18164 emit_insn (gen_<avx512>_vpermt2var<mode>3_maskz_1 (
18165 operands[0], operands[1], operands[2], operands[3],
18166 CONST0_RTX (<MODE>mode), operands[4]));
18170 (define_insn "<avx512>_vpermt2var<mode>3<sd_maskz_name>"
18171 [(set (match_operand:VPERMI2 0 "register_operand" "=v,v")
18173 [(match_operand:<sseintvecmode> 1 "register_operand" "v,0")
18174 (match_operand:VPERMI2 2 "register_operand" "0,v")
18175 (match_operand:VPERMI2 3 "nonimmediate_operand" "vm,vm")]
18179 vpermt2<ssemodesuffix>\t{%3, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %3}
18180 vpermi2<ssemodesuffix>\t{%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3}"
18181 [(set_attr "type" "sselog")
18182 (set_attr "prefix" "evex")
18183 (set_attr "mode" "<sseinsnmode>")])
18185 (define_insn "<avx512>_vpermt2var<mode>3_mask"
18186 [(set (match_operand:VPERMI2 0 "register_operand" "=v")
18189 [(match_operand:<sseintvecmode> 1 "register_operand" "v")
18190 (match_operand:VPERMI2 2 "register_operand" "0")
18191 (match_operand:VPERMI2 3 "nonimmediate_operand" "vm")]
18194 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
18196 "vpermt2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
18197 [(set_attr "type" "sselog")
18198 (set_attr "prefix" "evex")
18199 (set_attr "mode" "<sseinsnmode>")])
18201 (define_expand "avx_vperm2f128<mode>3"
18202 [(set (match_operand:AVX256MODE2P 0 "register_operand")
18203 (unspec:AVX256MODE2P
18204 [(match_operand:AVX256MODE2P 1 "register_operand")
18205 (match_operand:AVX256MODE2P 2 "nonimmediate_operand")
18206 (match_operand:SI 3 "const_0_to_255_operand")]
18207 UNSPEC_VPERMIL2F128))]
18210 int mask = INTVAL (operands[3]);
18211 if ((mask & 0x88) == 0)
18213 rtx perm[<ssescalarnum>], t1, t2;
18214 int i, base, nelt = <ssescalarnum>, nelt2 = nelt / 2;
18216 base = (mask & 3) * nelt2;
18217 for (i = 0; i < nelt2; ++i)
18218 perm[i] = GEN_INT (base + i);
18220 base = ((mask >> 4) & 3) * nelt2;
18221 for (i = 0; i < nelt2; ++i)
18222 perm[i + nelt2] = GEN_INT (base + i);
18224 t2 = gen_rtx_VEC_CONCAT (<ssedoublevecmode>mode,
18225 operands[1], operands[2]);
18226 t1 = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (nelt, perm));
18227 t2 = gen_rtx_VEC_SELECT (<MODE>mode, t2, t1);
18228 t2 = gen_rtx_SET (operands[0], t2);
18234 ;; Note that bits 7 and 3 of the imm8 allow lanes to be zeroed, which
18235 ;; means that in order to represent this properly in rtl we'd have to
18236 ;; nest *another* vec_concat with a zero operand and do the select from
18237 ;; a 4x wide vector. That doesn't seem very nice.
18238 (define_insn "*avx_vperm2f128<mode>_full"
18239 [(set (match_operand:AVX256MODE2P 0 "register_operand" "=x")
18240 (unspec:AVX256MODE2P
18241 [(match_operand:AVX256MODE2P 1 "register_operand" "x")
18242 (match_operand:AVX256MODE2P 2 "nonimmediate_operand" "xm")
18243 (match_operand:SI 3 "const_0_to_255_operand" "n")]
18244 UNSPEC_VPERMIL2F128))]
18246 "vperm2<i128>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
18247 [(set_attr "type" "sselog")
18248 (set_attr "prefix_extra" "1")
18249 (set_attr "length_immediate" "1")
18250 (set_attr "prefix" "vex")
18251 (set_attr "mode" "<sseinsnmode>")])
18253 (define_insn "*avx_vperm2f128<mode>_nozero"
18254 [(set (match_operand:AVX256MODE2P 0 "register_operand" "=x")
18255 (vec_select:AVX256MODE2P
18256 (vec_concat:<ssedoublevecmode>
18257 (match_operand:AVX256MODE2P 1 "register_operand" "x")
18258 (match_operand:AVX256MODE2P 2 "nonimmediate_operand" "xm"))
18259 (match_parallel 3 ""
18260 [(match_operand 4 "const_int_operand")])))]
18262 && avx_vperm2f128_parallel (operands[3], <MODE>mode)"
18264 int mask = avx_vperm2f128_parallel (operands[3], <MODE>mode) - 1;
18266 return "vinsert<i128>\t{$0, %x2, %1, %0|%0, %1, %x2, 0}";
18268 return "vinsert<i128>\t{$1, %x2, %1, %0|%0, %1, %x2, 1}";
18269 operands[3] = GEN_INT (mask);
18270 return "vperm2<i128>\t{%3, %2, %1, %0|%0, %1, %2, %3}";
18272 [(set_attr "type" "sselog")
18273 (set_attr "prefix_extra" "1")
18274 (set_attr "length_immediate" "1")
18275 (set_attr "prefix" "vex")
18276 (set_attr "mode" "<sseinsnmode>")])
18278 (define_insn "*ssse3_palignr<mode>_perm"
18279 [(set (match_operand:V_128 0 "register_operand" "=x,x,v")
18281 (match_operand:V_128 1 "register_operand" "0,x,v")
18282 (match_parallel 2 "palignr_operand"
18283 [(match_operand 3 "const_int_operand" "n,n,n")])))]
18286 operands[2] = (GEN_INT (INTVAL (operands[3])
18287 * GET_MODE_UNIT_SIZE (GET_MODE (operands[0]))));
18289 switch (which_alternative)
18292 return "palignr\t{%2, %1, %0|%0, %1, %2}";
18295 return "vpalignr\t{%2, %1, %1, %0|%0, %1, %1, %2}";
18297 gcc_unreachable ();
18300 [(set_attr "isa" "noavx,avx,avx512bw")
18301 (set_attr "type" "sseishft")
18302 (set_attr "atom_unit" "sishuf")
18303 (set_attr "prefix_data16" "1,*,*")
18304 (set_attr "prefix_extra" "1")
18305 (set_attr "length_immediate" "1")
18306 (set_attr "prefix" "orig,vex,evex")])
18308 (define_expand "avx512vl_vinsert<mode>"
18309 [(match_operand:VI48F_256 0 "register_operand")
18310 (match_operand:VI48F_256 1 "register_operand")
18311 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand")
18312 (match_operand:SI 3 "const_0_to_1_operand")
18313 (match_operand:VI48F_256 4 "register_operand")
18314 (match_operand:<avx512fmaskmode> 5 "register_operand")]
18317 rtx (*insn)(rtx, rtx, rtx, rtx, rtx);
18319 switch (INTVAL (operands[3]))
18322 insn = gen_vec_set_lo_<mode>_mask;
18325 insn = gen_vec_set_hi_<mode>_mask;
18328 gcc_unreachable ();
18331 emit_insn (insn (operands[0], operands[1], operands[2], operands[4],
18336 (define_expand "avx_vinsertf128<mode>"
18337 [(match_operand:V_256 0 "register_operand")
18338 (match_operand:V_256 1 "register_operand")
18339 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand")
18340 (match_operand:SI 3 "const_0_to_1_operand")]
18343 rtx (*insn)(rtx, rtx, rtx);
18345 switch (INTVAL (operands[3]))
18348 insn = gen_vec_set_lo_<mode>;
18351 insn = gen_vec_set_hi_<mode>;
18354 gcc_unreachable ();
18357 emit_insn (insn (operands[0], operands[1], operands[2]));
18361 (define_insn "vec_set_lo_<mode><mask_name>"
18362 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
18363 (vec_concat:VI8F_256
18364 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
18365 (vec_select:<ssehalfvecmode>
18366 (match_operand:VI8F_256 1 "register_operand" "v")
18367 (parallel [(const_int 2) (const_int 3)]))))]
18368 "TARGET_AVX && <mask_avx512dq_condition>"
18370 if (TARGET_AVX512DQ)
18371 return "vinsert<shuffletype>64x2\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}";
18372 else if (TARGET_AVX512VL)
18373 return "vinsert<shuffletype>32x4\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}";
18375 return "vinsert<i128>\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}";
18377 [(set_attr "type" "sselog")
18378 (set_attr "prefix_extra" "1")
18379 (set_attr "length_immediate" "1")
18380 (set_attr "prefix" "vex")
18381 (set_attr "mode" "<sseinsnmode>")])
18383 (define_insn "vec_set_hi_<mode><mask_name>"
18384 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
18385 (vec_concat:VI8F_256
18386 (vec_select:<ssehalfvecmode>
18387 (match_operand:VI8F_256 1 "register_operand" "v")
18388 (parallel [(const_int 0) (const_int 1)]))
18389 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
18390 "TARGET_AVX && <mask_avx512dq_condition>"
18392 if (TARGET_AVX512DQ)
18393 return "vinsert<shuffletype>64x2\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}";
18394 else if (TARGET_AVX512VL)
18395 return "vinsert<shuffletype>32x4\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}";
18397 return "vinsert<i128>\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}";
18399 [(set_attr "type" "sselog")
18400 (set_attr "prefix_extra" "1")
18401 (set_attr "length_immediate" "1")
18402 (set_attr "prefix" "vex")
18403 (set_attr "mode" "<sseinsnmode>")])
18405 (define_insn "vec_set_lo_<mode><mask_name>"
18406 [(set (match_operand:VI4F_256 0 "register_operand" "=v")
18407 (vec_concat:VI4F_256
18408 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
18409 (vec_select:<ssehalfvecmode>
18410 (match_operand:VI4F_256 1 "register_operand" "v")
18411 (parallel [(const_int 4) (const_int 5)
18412 (const_int 6) (const_int 7)]))))]
18415 if (TARGET_AVX512VL)
18416 return "vinsert<shuffletype>32x4\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}";
18418 return "vinsert<i128>\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}";
18420 [(set_attr "type" "sselog")
18421 (set_attr "prefix_extra" "1")
18422 (set_attr "length_immediate" "1")
18423 (set_attr "prefix" "vex")
18424 (set_attr "mode" "<sseinsnmode>")])
18426 (define_insn "vec_set_hi_<mode><mask_name>"
18427 [(set (match_operand:VI4F_256 0 "register_operand" "=v")
18428 (vec_concat:VI4F_256
18429 (vec_select:<ssehalfvecmode>
18430 (match_operand:VI4F_256 1 "register_operand" "v")
18431 (parallel [(const_int 0) (const_int 1)
18432 (const_int 2) (const_int 3)]))
18433 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
18436 if (TARGET_AVX512VL)
18437 return "vinsert<shuffletype>32x4\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}";
18439 return "vinsert<i128>\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}";
18441 [(set_attr "type" "sselog")
18442 (set_attr "prefix_extra" "1")
18443 (set_attr "length_immediate" "1")
18444 (set_attr "prefix" "vex")
18445 (set_attr "mode" "<sseinsnmode>")])
18447 (define_insn "vec_set_lo_v16hi"
18448 [(set (match_operand:V16HI 0 "register_operand" "=x,v")
18450 (match_operand:V8HI 2 "nonimmediate_operand" "xm,vm")
18452 (match_operand:V16HI 1 "register_operand" "x,v")
18453 (parallel [(const_int 8) (const_int 9)
18454 (const_int 10) (const_int 11)
18455 (const_int 12) (const_int 13)
18456 (const_int 14) (const_int 15)]))))]
18459 vinsert%~128\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}
18460 vinserti32x4\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}"
18461 [(set_attr "type" "sselog")
18462 (set_attr "prefix_extra" "1")
18463 (set_attr "length_immediate" "1")
18464 (set_attr "prefix" "vex,evex")
18465 (set_attr "mode" "OI")])
18467 (define_insn "vec_set_hi_v16hi"
18468 [(set (match_operand:V16HI 0 "register_operand" "=x,v")
18471 (match_operand:V16HI 1 "register_operand" "x,v")
18472 (parallel [(const_int 0) (const_int 1)
18473 (const_int 2) (const_int 3)
18474 (const_int 4) (const_int 5)
18475 (const_int 6) (const_int 7)]))
18476 (match_operand:V8HI 2 "nonimmediate_operand" "xm,vm")))]
18479 vinsert%~128\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}
18480 vinserti32x4\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}"
18481 [(set_attr "type" "sselog")
18482 (set_attr "prefix_extra" "1")
18483 (set_attr "length_immediate" "1")
18484 (set_attr "prefix" "vex,evex")
18485 (set_attr "mode" "OI")])
18487 (define_insn "vec_set_lo_v32qi"
18488 [(set (match_operand:V32QI 0 "register_operand" "=x,v")
18490 (match_operand:V16QI 2 "nonimmediate_operand" "xm,v")
18492 (match_operand:V32QI 1 "register_operand" "x,v")
18493 (parallel [(const_int 16) (const_int 17)
18494 (const_int 18) (const_int 19)
18495 (const_int 20) (const_int 21)
18496 (const_int 22) (const_int 23)
18497 (const_int 24) (const_int 25)
18498 (const_int 26) (const_int 27)
18499 (const_int 28) (const_int 29)
18500 (const_int 30) (const_int 31)]))))]
18503 vinsert%~128\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}
18504 vinserti32x4\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}"
18505 [(set_attr "type" "sselog")
18506 (set_attr "prefix_extra" "1")
18507 (set_attr "length_immediate" "1")
18508 (set_attr "prefix" "vex,evex")
18509 (set_attr "mode" "OI")])
18511 (define_insn "vec_set_hi_v32qi"
18512 [(set (match_operand:V32QI 0 "register_operand" "=x,v")
18515 (match_operand:V32QI 1 "register_operand" "x,v")
18516 (parallel [(const_int 0) (const_int 1)
18517 (const_int 2) (const_int 3)
18518 (const_int 4) (const_int 5)
18519 (const_int 6) (const_int 7)
18520 (const_int 8) (const_int 9)
18521 (const_int 10) (const_int 11)
18522 (const_int 12) (const_int 13)
18523 (const_int 14) (const_int 15)]))
18524 (match_operand:V16QI 2 "nonimmediate_operand" "xm,vm")))]
18527 vinsert%~128\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}
18528 vinserti32x4\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}"
18529 [(set_attr "type" "sselog")
18530 (set_attr "prefix_extra" "1")
18531 (set_attr "length_immediate" "1")
18532 (set_attr "prefix" "vex,evex")
18533 (set_attr "mode" "OI")])
18535 (define_insn "<avx_avx2>_maskload<ssemodesuffix><avxsizesuffix>"
18536 [(set (match_operand:V48_AVX2 0 "register_operand" "=x")
18538 [(match_operand:<sseintvecmode> 2 "register_operand" "x")
18539 (match_operand:V48_AVX2 1 "memory_operand" "m")]
18542 "v<sseintprefix>maskmov<ssemodesuffix>\t{%1, %2, %0|%0, %2, %1}"
18543 [(set_attr "type" "sselog1")
18544 (set_attr "prefix_extra" "1")
18545 (set_attr "prefix" "vex")
18546 (set_attr "btver2_decode" "vector")
18547 (set_attr "mode" "<sseinsnmode>")])
18549 (define_insn "<avx_avx2>_maskstore<ssemodesuffix><avxsizesuffix>"
18550 [(set (match_operand:V48_AVX2 0 "memory_operand" "+m")
18552 [(match_operand:<sseintvecmode> 1 "register_operand" "x")
18553 (match_operand:V48_AVX2 2 "register_operand" "x")
18557 "v<sseintprefix>maskmov<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
18558 [(set_attr "type" "sselog1")
18559 (set_attr "prefix_extra" "1")
18560 (set_attr "prefix" "vex")
18561 (set_attr "btver2_decode" "vector")
18562 (set_attr "mode" "<sseinsnmode>")])
18564 (define_expand "maskload<mode><sseintvecmodelower>"
18565 [(set (match_operand:V48_AVX2 0 "register_operand")
18567 [(match_operand:<sseintvecmode> 2 "register_operand")
18568 (match_operand:V48_AVX2 1 "memory_operand")]
18572 (define_expand "maskload<mode><avx512fmaskmodelower>"
18573 [(set (match_operand:V48_AVX512VL 0 "register_operand")
18574 (vec_merge:V48_AVX512VL
18575 (match_operand:V48_AVX512VL 1 "memory_operand")
18577 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18580 (define_expand "maskload<mode><avx512fmaskmodelower>"
18581 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
18582 (vec_merge:VI12_AVX512VL
18583 (match_operand:VI12_AVX512VL 1 "memory_operand")
18585 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18588 (define_expand "maskstore<mode><sseintvecmodelower>"
18589 [(set (match_operand:V48_AVX2 0 "memory_operand")
18591 [(match_operand:<sseintvecmode> 2 "register_operand")
18592 (match_operand:V48_AVX2 1 "register_operand")
18597 (define_expand "maskstore<mode><avx512fmaskmodelower>"
18598 [(set (match_operand:V48_AVX512VL 0 "memory_operand")
18599 (vec_merge:V48_AVX512VL
18600 (match_operand:V48_AVX512VL 1 "register_operand")
18602 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18605 (define_expand "maskstore<mode><avx512fmaskmodelower>"
18606 [(set (match_operand:VI12_AVX512VL 0 "memory_operand")
18607 (vec_merge:VI12_AVX512VL
18608 (match_operand:VI12_AVX512VL 1 "register_operand")
18610 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18613 (define_expand "cbranch<mode>4"
18614 [(set (reg:CC FLAGS_REG)
18615 (compare:CC (match_operand:VI48_AVX 1 "register_operand")
18616 (match_operand:VI48_AVX 2 "nonimmediate_operand")))
18617 (set (pc) (if_then_else
18618 (match_operator 0 "bt_comparison_operator"
18619 [(reg:CC FLAGS_REG) (const_int 0)])
18620 (label_ref (match_operand 3))
18624 ix86_expand_branch (GET_CODE (operands[0]),
18625 operands[1], operands[2], operands[3]);
18630 (define_insn_and_split "avx_<castmode><avxsizesuffix>_<castmode>"
18631 [(set (match_operand:AVX256MODE2P 0 "nonimmediate_operand" "=x,m")
18632 (unspec:AVX256MODE2P
18633 [(match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "xm,x")]
18635 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
18637 "&& reload_completed"
18638 [(set (match_dup 0) (match_dup 1))]
18640 if (REG_P (operands[0]))
18641 operands[0] = gen_lowpart (<ssehalfvecmode>mode, operands[0]);
18643 operands[1] = lowpart_subreg (<MODE>mode, operands[1],
18644 <ssehalfvecmode>mode);
18647 ;; Modes handled by vec_init expanders.
18648 (define_mode_iterator VEC_INIT_MODE
18649 [(V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI
18650 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX") V8HI
18651 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
18652 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI
18653 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
18654 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")
18655 (V4TI "TARGET_AVX512F") (V2TI "TARGET_AVX")])
18657 ;; Likewise, but for initialization from half sized vectors.
18658 ;; Thus, these are all VEC_INIT_MODE modes except V2??.
18659 (define_mode_iterator VEC_INIT_HALF_MODE
18660 [(V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI
18661 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX") V8HI
18662 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
18663 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX")
18664 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
18665 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX")
18666 (V4TI "TARGET_AVX512F")])
18668 (define_expand "vec_init<mode><ssescalarmodelower>"
18669 [(match_operand:VEC_INIT_MODE 0 "register_operand")
18673 ix86_expand_vector_init (false, operands[0], operands[1]);
18677 (define_expand "vec_init<mode><ssehalfvecmodelower>"
18678 [(match_operand:VEC_INIT_HALF_MODE 0 "register_operand")
18682 ix86_expand_vector_init (false, operands[0], operands[1]);
18686 (define_insn "<avx2_avx512>_ashrv<mode><mask_name>"
18687 [(set (match_operand:VI48_AVX512F_AVX512VL 0 "register_operand" "=v")
18688 (ashiftrt:VI48_AVX512F_AVX512VL
18689 (match_operand:VI48_AVX512F_AVX512VL 1 "register_operand" "v")
18690 (match_operand:VI48_AVX512F_AVX512VL 2 "nonimmediate_operand" "vm")))]
18691 "TARGET_AVX2 && <mask_mode512bit_condition>"
18692 "vpsrav<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18693 [(set_attr "type" "sseishft")
18694 (set_attr "prefix" "maybe_evex")
18695 (set_attr "mode" "<sseinsnmode>")])
18697 (define_insn "<avx2_avx512>_ashrv<mode><mask_name>"
18698 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
18699 (ashiftrt:VI2_AVX512VL
18700 (match_operand:VI2_AVX512VL 1 "register_operand" "v")
18701 (match_operand:VI2_AVX512VL 2 "nonimmediate_operand" "vm")))]
18703 "vpsravw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18704 [(set_attr "type" "sseishft")
18705 (set_attr "prefix" "maybe_evex")
18706 (set_attr "mode" "<sseinsnmode>")])
18708 (define_insn "<avx2_avx512>_<shift_insn>v<mode><mask_name>"
18709 [(set (match_operand:VI48_AVX512F 0 "register_operand" "=v")
18710 (any_lshift:VI48_AVX512F
18711 (match_operand:VI48_AVX512F 1 "register_operand" "v")
18712 (match_operand:VI48_AVX512F 2 "nonimmediate_operand" "vm")))]
18713 "TARGET_AVX2 && <mask_mode512bit_condition>"
18714 "vp<vshift>v<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18715 [(set_attr "type" "sseishft")
18716 (set_attr "prefix" "maybe_evex")
18717 (set_attr "mode" "<sseinsnmode>")])
18719 (define_insn "<avx2_avx512>_<shift_insn>v<mode><mask_name>"
18720 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
18721 (any_lshift:VI2_AVX512VL
18722 (match_operand:VI2_AVX512VL 1 "register_operand" "v")
18723 (match_operand:VI2_AVX512VL 2 "nonimmediate_operand" "vm")))]
18725 "vp<vshift>v<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18726 [(set_attr "type" "sseishft")
18727 (set_attr "prefix" "maybe_evex")
18728 (set_attr "mode" "<sseinsnmode>")])
18730 (define_insn "avx_vec_concat<mode>"
18731 [(set (match_operand:V_256_512 0 "register_operand" "=x,v,x,Yv")
18732 (vec_concat:V_256_512
18733 (match_operand:<ssehalfvecmode> 1 "register_operand" "x,v,x,v")
18734 (match_operand:<ssehalfvecmode> 2 "vector_move_operand" "xm,vm,C,C")))]
18737 switch (which_alternative)
18740 return "vinsert<i128>\t{$0x1, %2, %<concat_tg_mode>1, %0|%0, %<concat_tg_mode>1, %2, 0x1}";
18742 if (<MODE_SIZE> == 64)
18744 if (TARGET_AVX512DQ && GET_MODE_SIZE (<ssescalarmode>mode) == 4)
18745 return "vinsert<shuffletype>32x8\t{$0x1, %2, %<concat_tg_mode>1, %0|%0, %<concat_tg_mode>1, %2, 0x1}";
18747 return "vinsert<shuffletype>64x4\t{$0x1, %2, %<concat_tg_mode>1, %0|%0, %<concat_tg_mode>1, %2, 0x1}";
18751 if (TARGET_AVX512DQ && GET_MODE_SIZE (<ssescalarmode>mode) == 8)
18752 return "vinsert<shuffletype>64x2\t{$0x1, %2, %<concat_tg_mode>1, %0|%0, %<concat_tg_mode>1, %2, 0x1}";
18754 return "vinsert<shuffletype>32x4\t{$0x1, %2, %<concat_tg_mode>1, %0|%0, %<concat_tg_mode>1, %2, 0x1}";
18758 switch (get_attr_mode (insn))
18761 return "vmovaps\t{%1, %t0|%t0, %1}";
18763 return "vmovapd\t{%1, %t0|%t0, %1}";
18765 return "vmovaps\t{%1, %x0|%x0, %1}";
18767 return "vmovapd\t{%1, %x0|%x0, %1}";
18769 if (which_alternative == 2)
18770 return "vmovdqa\t{%1, %t0|%t0, %1}";
18771 else if (GET_MODE_SIZE (<ssescalarmode>mode) == 8)
18772 return "vmovdqa64\t{%1, %t0|%t0, %1}";
18774 return "vmovdqa32\t{%1, %t0|%t0, %1}";
18776 if (which_alternative == 2)
18777 return "vmovdqa\t{%1, %x0|%x0, %1}";
18778 else if (GET_MODE_SIZE (<ssescalarmode>mode) == 8)
18779 return "vmovdqa64\t{%1, %x0|%x0, %1}";
18781 return "vmovdqa32\t{%1, %x0|%x0, %1}";
18783 gcc_unreachable ();
18786 gcc_unreachable ();
18789 [(set_attr "type" "sselog,sselog,ssemov,ssemov")
18790 (set_attr "prefix_extra" "1,1,*,*")
18791 (set_attr "length_immediate" "1,1,*,*")
18792 (set_attr "prefix" "maybe_evex")
18793 (set_attr "mode" "<sseinsnmode>")])
18795 (define_insn "vcvtph2ps<mask_name>"
18796 [(set (match_operand:V4SF 0 "register_operand" "=v")
18798 (unspec:V8SF [(match_operand:V8HI 1 "register_operand" "v")]
18800 (parallel [(const_int 0) (const_int 1)
18801 (const_int 2) (const_int 3)])))]
18802 "TARGET_F16C || TARGET_AVX512VL"
18803 "vcvtph2ps\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
18804 [(set_attr "type" "ssecvt")
18805 (set_attr "prefix" "maybe_evex")
18806 (set_attr "mode" "V4SF")])
18808 (define_insn "*vcvtph2ps_load<mask_name>"
18809 [(set (match_operand:V4SF 0 "register_operand" "=v")
18810 (unspec:V4SF [(match_operand:V4HI 1 "memory_operand" "m")]
18811 UNSPEC_VCVTPH2PS))]
18812 "TARGET_F16C || TARGET_AVX512VL"
18813 "vcvtph2ps\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
18814 [(set_attr "type" "ssecvt")
18815 (set_attr "prefix" "vex")
18816 (set_attr "mode" "V8SF")])
18818 (define_insn "vcvtph2ps256<mask_name>"
18819 [(set (match_operand:V8SF 0 "register_operand" "=v")
18820 (unspec:V8SF [(match_operand:V8HI 1 "nonimmediate_operand" "vm")]
18821 UNSPEC_VCVTPH2PS))]
18822 "TARGET_F16C || TARGET_AVX512VL"
18823 "vcvtph2ps\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
18824 [(set_attr "type" "ssecvt")
18825 (set_attr "prefix" "vex")
18826 (set_attr "btver2_decode" "double")
18827 (set_attr "mode" "V8SF")])
18829 (define_insn "<mask_codefor>avx512f_vcvtph2ps512<mask_name><round_saeonly_name>"
18830 [(set (match_operand:V16SF 0 "register_operand" "=v")
18832 [(match_operand:V16HI 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
18833 UNSPEC_VCVTPH2PS))]
18835 "vcvtph2ps\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
18836 [(set_attr "type" "ssecvt")
18837 (set_attr "prefix" "evex")
18838 (set_attr "mode" "V16SF")])
18840 (define_expand "vcvtps2ph_mask"
18841 [(set (match_operand:V8HI 0 "register_operand")
18844 (unspec:V4HI [(match_operand:V4SF 1 "register_operand")
18845 (match_operand:SI 2 "const_0_to_255_operand")]
18848 (match_operand:V8HI 3 "vector_move_operand")
18849 (match_operand:QI 4 "register_operand")))]
18851 "operands[5] = CONST0_RTX (V4HImode);")
18853 (define_expand "vcvtps2ph"
18854 [(set (match_operand:V8HI 0 "register_operand")
18856 (unspec:V4HI [(match_operand:V4SF 1 "register_operand")
18857 (match_operand:SI 2 "const_0_to_255_operand")]
18861 "operands[3] = CONST0_RTX (V4HImode);")
18863 (define_insn "*vcvtps2ph<mask_name>"
18864 [(set (match_operand:V8HI 0 "register_operand" "=v")
18866 (unspec:V4HI [(match_operand:V4SF 1 "register_operand" "v")
18867 (match_operand:SI 2 "const_0_to_255_operand" "N")]
18869 (match_operand:V4HI 3 "const0_operand")))]
18870 "(TARGET_F16C || TARGET_AVX512VL) && <mask_avx512vl_condition>"
18871 "vcvtps2ph\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}"
18872 [(set_attr "type" "ssecvt")
18873 (set_attr "prefix" "maybe_evex")
18874 (set_attr "mode" "V4SF")])
18876 (define_insn "*vcvtps2ph_store<mask_name>"
18877 [(set (match_operand:V4HI 0 "memory_operand" "=m")
18878 (unspec:V4HI [(match_operand:V4SF 1 "register_operand" "v")
18879 (match_operand:SI 2 "const_0_to_255_operand" "N")]
18880 UNSPEC_VCVTPS2PH))]
18881 "TARGET_F16C || TARGET_AVX512VL"
18882 "vcvtps2ph\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18883 [(set_attr "type" "ssecvt")
18884 (set_attr "prefix" "maybe_evex")
18885 (set_attr "mode" "V4SF")])
18887 (define_insn "vcvtps2ph256<mask_name>"
18888 [(set (match_operand:V8HI 0 "nonimmediate_operand" "=vm")
18889 (unspec:V8HI [(match_operand:V8SF 1 "register_operand" "v")
18890 (match_operand:SI 2 "const_0_to_255_operand" "N")]
18891 UNSPEC_VCVTPS2PH))]
18892 "TARGET_F16C || TARGET_AVX512VL"
18893 "vcvtps2ph\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18894 [(set_attr "type" "ssecvt")
18895 (set_attr "prefix" "maybe_evex")
18896 (set_attr "btver2_decode" "vector")
18897 (set_attr "mode" "V8SF")])
18899 (define_insn "<mask_codefor>avx512f_vcvtps2ph512<mask_name>"
18900 [(set (match_operand:V16HI 0 "nonimmediate_operand" "=vm")
18902 [(match_operand:V16SF 1 "register_operand" "v")
18903 (match_operand:SI 2 "const_0_to_255_operand" "N")]
18904 UNSPEC_VCVTPS2PH))]
18906 "vcvtps2ph\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18907 [(set_attr "type" "ssecvt")
18908 (set_attr "prefix" "evex")
18909 (set_attr "mode" "V16SF")])
18911 ;; For gather* insn patterns
18912 (define_mode_iterator VEC_GATHER_MODE
18913 [V2DI V2DF V4DI V4DF V4SI V4SF V8SI V8SF])
18914 (define_mode_attr VEC_GATHER_IDXSI
18915 [(V2DI "V4SI") (V4DI "V4SI") (V8DI "V8SI")
18916 (V2DF "V4SI") (V4DF "V4SI") (V8DF "V8SI")
18917 (V4SI "V4SI") (V8SI "V8SI") (V16SI "V16SI")
18918 (V4SF "V4SI") (V8SF "V8SI") (V16SF "V16SI")])
18920 (define_mode_attr VEC_GATHER_IDXDI
18921 [(V2DI "V2DI") (V4DI "V4DI") (V8DI "V8DI")
18922 (V2DF "V2DI") (V4DF "V4DI") (V8DF "V8DI")
18923 (V4SI "V2DI") (V8SI "V4DI") (V16SI "V8DI")
18924 (V4SF "V2DI") (V8SF "V4DI") (V16SF "V8DI")])
18926 (define_mode_attr VEC_GATHER_SRCDI
18927 [(V2DI "V2DI") (V4DI "V4DI") (V8DI "V8DI")
18928 (V2DF "V2DF") (V4DF "V4DF") (V8DF "V8DF")
18929 (V4SI "V4SI") (V8SI "V4SI") (V16SI "V8SI")
18930 (V4SF "V4SF") (V8SF "V4SF") (V16SF "V8SF")])
18932 (define_expand "avx2_gathersi<mode>"
18933 [(parallel [(set (match_operand:VEC_GATHER_MODE 0 "register_operand")
18934 (unspec:VEC_GATHER_MODE
18935 [(match_operand:VEC_GATHER_MODE 1 "register_operand")
18936 (mem:<ssescalarmode>
18938 [(match_operand 2 "vsib_address_operand")
18939 (match_operand:<VEC_GATHER_IDXSI>
18940 3 "register_operand")
18941 (match_operand:SI 5 "const1248_operand ")]))
18942 (mem:BLK (scratch))
18943 (match_operand:VEC_GATHER_MODE 4 "register_operand")]
18945 (clobber (match_scratch:VEC_GATHER_MODE 7))])]
18949 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
18950 operands[5]), UNSPEC_VSIBADDR);
18953 (define_insn "*avx2_gathersi<mode>"
18954 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
18955 (unspec:VEC_GATHER_MODE
18956 [(match_operand:VEC_GATHER_MODE 2 "register_operand" "0")
18957 (match_operator:<ssescalarmode> 7 "vsib_mem_operator"
18959 [(match_operand:P 3 "vsib_address_operand" "Tv")
18960 (match_operand:<VEC_GATHER_IDXSI> 4 "register_operand" "x")
18961 (match_operand:SI 6 "const1248_operand" "n")]
18963 (mem:BLK (scratch))
18964 (match_operand:VEC_GATHER_MODE 5 "register_operand" "1")]
18966 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
18968 "v<sseintprefix>gatherd<ssemodesuffix>\t{%1, %7, %0|%0, %7, %1}"
18969 [(set_attr "type" "ssemov")
18970 (set_attr "prefix" "vex")
18971 (set_attr "mode" "<sseinsnmode>")])
18973 (define_insn "*avx2_gathersi<mode>_2"
18974 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
18975 (unspec:VEC_GATHER_MODE
18977 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
18979 [(match_operand:P 2 "vsib_address_operand" "Tv")
18980 (match_operand:<VEC_GATHER_IDXSI> 3 "register_operand" "x")
18981 (match_operand:SI 5 "const1248_operand" "n")]
18983 (mem:BLK (scratch))
18984 (match_operand:VEC_GATHER_MODE 4 "register_operand" "1")]
18986 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
18988 "v<sseintprefix>gatherd<ssemodesuffix>\t{%1, %6, %0|%0, %6, %1}"
18989 [(set_attr "type" "ssemov")
18990 (set_attr "prefix" "vex")
18991 (set_attr "mode" "<sseinsnmode>")])
18993 (define_expand "avx2_gatherdi<mode>"
18994 [(parallel [(set (match_operand:VEC_GATHER_MODE 0 "register_operand")
18995 (unspec:VEC_GATHER_MODE
18996 [(match_operand:<VEC_GATHER_SRCDI> 1 "register_operand")
18997 (mem:<ssescalarmode>
18999 [(match_operand 2 "vsib_address_operand")
19000 (match_operand:<VEC_GATHER_IDXDI>
19001 3 "register_operand")
19002 (match_operand:SI 5 "const1248_operand ")]))
19003 (mem:BLK (scratch))
19004 (match_operand:<VEC_GATHER_SRCDI> 4 "register_operand")]
19006 (clobber (match_scratch:VEC_GATHER_MODE 7))])]
19010 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
19011 operands[5]), UNSPEC_VSIBADDR);
19014 (define_insn "*avx2_gatherdi<mode>"
19015 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
19016 (unspec:VEC_GATHER_MODE
19017 [(match_operand:<VEC_GATHER_SRCDI> 2 "register_operand" "0")
19018 (match_operator:<ssescalarmode> 7 "vsib_mem_operator"
19020 [(match_operand:P 3 "vsib_address_operand" "Tv")
19021 (match_operand:<VEC_GATHER_IDXDI> 4 "register_operand" "x")
19022 (match_operand:SI 6 "const1248_operand" "n")]
19024 (mem:BLK (scratch))
19025 (match_operand:<VEC_GATHER_SRCDI> 5 "register_operand" "1")]
19027 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
19029 "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %7, %2|%2, %7, %5}"
19030 [(set_attr "type" "ssemov")
19031 (set_attr "prefix" "vex")
19032 (set_attr "mode" "<sseinsnmode>")])
19034 (define_insn "*avx2_gatherdi<mode>_2"
19035 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
19036 (unspec:VEC_GATHER_MODE
19038 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
19040 [(match_operand:P 2 "vsib_address_operand" "Tv")
19041 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand" "x")
19042 (match_operand:SI 5 "const1248_operand" "n")]
19044 (mem:BLK (scratch))
19045 (match_operand:<VEC_GATHER_SRCDI> 4 "register_operand" "1")]
19047 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
19050 if (<MODE>mode != <VEC_GATHER_SRCDI>mode)
19051 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%4, %6, %x0|%x0, %6, %4}";
19052 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%4, %6, %0|%0, %6, %4}";
19054 [(set_attr "type" "ssemov")
19055 (set_attr "prefix" "vex")
19056 (set_attr "mode" "<sseinsnmode>")])
19058 (define_insn "*avx2_gatherdi<mode>_3"
19059 [(set (match_operand:<VEC_GATHER_SRCDI> 0 "register_operand" "=&x")
19060 (vec_select:<VEC_GATHER_SRCDI>
19062 [(match_operand:<VEC_GATHER_SRCDI> 2 "register_operand" "0")
19063 (match_operator:<ssescalarmode> 7 "vsib_mem_operator"
19065 [(match_operand:P 3 "vsib_address_operand" "Tv")
19066 (match_operand:<VEC_GATHER_IDXDI> 4 "register_operand" "x")
19067 (match_operand:SI 6 "const1248_operand" "n")]
19069 (mem:BLK (scratch))
19070 (match_operand:<VEC_GATHER_SRCDI> 5 "register_operand" "1")]
19072 (parallel [(const_int 0) (const_int 1)
19073 (const_int 2) (const_int 3)])))
19074 (clobber (match_scratch:VI4F_256 1 "=&x"))]
19076 "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %7, %0|%0, %7, %5}"
19077 [(set_attr "type" "ssemov")
19078 (set_attr "prefix" "vex")
19079 (set_attr "mode" "<sseinsnmode>")])
19081 (define_insn "*avx2_gatherdi<mode>_4"
19082 [(set (match_operand:<VEC_GATHER_SRCDI> 0 "register_operand" "=&x")
19083 (vec_select:<VEC_GATHER_SRCDI>
19086 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
19088 [(match_operand:P 2 "vsib_address_operand" "Tv")
19089 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand" "x")
19090 (match_operand:SI 5 "const1248_operand" "n")]
19092 (mem:BLK (scratch))
19093 (match_operand:<VEC_GATHER_SRCDI> 4 "register_operand" "1")]
19095 (parallel [(const_int 0) (const_int 1)
19096 (const_int 2) (const_int 3)])))
19097 (clobber (match_scratch:VI4F_256 1 "=&x"))]
19099 "v<sseintprefix>gatherq<ssemodesuffix>\t{%4, %6, %0|%0, %6, %4}"
19100 [(set_attr "type" "ssemov")
19101 (set_attr "prefix" "vex")
19102 (set_attr "mode" "<sseinsnmode>")])
19104 ;; Memory operand override for -masm=intel of the v*gatherq* patterns.
19105 (define_mode_attr gatherq_mode
19106 [(V4SI "q") (V2DI "x") (V4SF "q") (V2DF "x")
19107 (V8SI "x") (V4DI "t") (V8SF "x") (V4DF "t")
19108 (V16SI "t") (V8DI "g") (V16SF "t") (V8DF "g")])
19110 (define_expand "<avx512>_gathersi<mode>"
19111 [(parallel [(set (match_operand:VI48F 0 "register_operand")
19113 [(match_operand:VI48F 1 "register_operand")
19114 (match_operand:<avx512fmaskmode> 4 "register_operand")
19115 (mem:<ssescalarmode>
19117 [(match_operand 2 "vsib_address_operand")
19118 (match_operand:<VEC_GATHER_IDXSI> 3 "register_operand")
19119 (match_operand:SI 5 "const1248_operand")]))]
19121 (clobber (match_scratch:<avx512fmaskmode> 7))])]
19125 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
19126 operands[5]), UNSPEC_VSIBADDR);
19129 (define_insn "*avx512f_gathersi<mode>"
19130 [(set (match_operand:VI48F 0 "register_operand" "=&v")
19132 [(match_operand:VI48F 1 "register_operand" "0")
19133 (match_operand:<avx512fmaskmode> 7 "register_operand" "2")
19134 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
19136 [(match_operand:P 4 "vsib_address_operand" "Tv")
19137 (match_operand:<VEC_GATHER_IDXSI> 3 "register_operand" "v")
19138 (match_operand:SI 5 "const1248_operand" "n")]
19139 UNSPEC_VSIBADDR)])]
19141 (clobber (match_scratch:<avx512fmaskmode> 2 "=&Yk"))]
19143 "v<sseintprefix>gatherd<ssemodesuffix>\t{%6, %0%{%2%}|%0%{%2%}, %<xtg_mode>6}"
19144 [(set_attr "type" "ssemov")
19145 (set_attr "prefix" "evex")
19146 (set_attr "mode" "<sseinsnmode>")])
19148 (define_insn "*avx512f_gathersi<mode>_2"
19149 [(set (match_operand:VI48F 0 "register_operand" "=&v")
19152 (match_operand:<avx512fmaskmode> 6 "register_operand" "1")
19153 (match_operator:<ssescalarmode> 5 "vsib_mem_operator"
19155 [(match_operand:P 3 "vsib_address_operand" "Tv")
19156 (match_operand:<VEC_GATHER_IDXSI> 2 "register_operand" "v")
19157 (match_operand:SI 4 "const1248_operand" "n")]
19158 UNSPEC_VSIBADDR)])]
19160 (clobber (match_scratch:<avx512fmaskmode> 1 "=&Yk"))]
19162 "v<sseintprefix>gatherd<ssemodesuffix>\t{%5, %0%{%1%}|%0%{%1%}, %<xtg_mode>5}"
19163 [(set_attr "type" "ssemov")
19164 (set_attr "prefix" "evex")
19165 (set_attr "mode" "<sseinsnmode>")])
19168 (define_expand "<avx512>_gatherdi<mode>"
19169 [(parallel [(set (match_operand:VI48F 0 "register_operand")
19171 [(match_operand:<VEC_GATHER_SRCDI> 1 "register_operand")
19172 (match_operand:QI 4 "register_operand")
19173 (mem:<ssescalarmode>
19175 [(match_operand 2 "vsib_address_operand")
19176 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand")
19177 (match_operand:SI 5 "const1248_operand")]))]
19179 (clobber (match_scratch:QI 7))])]
19183 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
19184 operands[5]), UNSPEC_VSIBADDR);
19187 (define_insn "*avx512f_gatherdi<mode>"
19188 [(set (match_operand:VI48F 0 "register_operand" "=&v")
19190 [(match_operand:<VEC_GATHER_SRCDI> 1 "register_operand" "0")
19191 (match_operand:QI 7 "register_operand" "2")
19192 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
19194 [(match_operand:P 4 "vsib_address_operand" "Tv")
19195 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand" "v")
19196 (match_operand:SI 5 "const1248_operand" "n")]
19197 UNSPEC_VSIBADDR)])]
19199 (clobber (match_scratch:QI 2 "=&Yk"))]
19202 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%6, %1%{%2%}|%1%{%2%}, %<gatherq_mode>6}";
19204 [(set_attr "type" "ssemov")
19205 (set_attr "prefix" "evex")
19206 (set_attr "mode" "<sseinsnmode>")])
19208 (define_insn "*avx512f_gatherdi<mode>_2"
19209 [(set (match_operand:VI48F 0 "register_operand" "=&v")
19212 (match_operand:QI 6 "register_operand" "1")
19213 (match_operator:<ssescalarmode> 5 "vsib_mem_operator"
19215 [(match_operand:P 3 "vsib_address_operand" "Tv")
19216 (match_operand:<VEC_GATHER_IDXDI> 2 "register_operand" "v")
19217 (match_operand:SI 4 "const1248_operand" "n")]
19218 UNSPEC_VSIBADDR)])]
19220 (clobber (match_scratch:QI 1 "=&Yk"))]
19223 if (<MODE>mode != <VEC_GATHER_SRCDI>mode)
19225 if (<MODE_SIZE> != 64)
19226 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %x0%{%1%}|%x0%{%1%}, %<gatherq_mode>5}";
19228 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %t0%{%1%}|%t0%{%1%}, %t5}";
19230 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %0%{%1%}|%0%{%1%}, %<gatherq_mode>5}";
19232 [(set_attr "type" "ssemov")
19233 (set_attr "prefix" "evex")
19234 (set_attr "mode" "<sseinsnmode>")])
19236 (define_expand "<avx512>_scattersi<mode>"
19237 [(parallel [(set (mem:VI48F
19239 [(match_operand 0 "vsib_address_operand")
19240 (match_operand:<VEC_GATHER_IDXSI> 2 "register_operand")
19241 (match_operand:SI 4 "const1248_operand")]))
19243 [(match_operand:<avx512fmaskmode> 1 "register_operand")
19244 (match_operand:VI48F 3 "register_operand")]
19246 (clobber (match_scratch:<avx512fmaskmode> 6))])]
19250 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[0], operands[2],
19251 operands[4]), UNSPEC_VSIBADDR);
19254 (define_insn "*avx512f_scattersi<mode>"
19255 [(set (match_operator:VI48F 5 "vsib_mem_operator"
19257 [(match_operand:P 0 "vsib_address_operand" "Tv")
19258 (match_operand:<VEC_GATHER_IDXSI> 2 "register_operand" "v")
19259 (match_operand:SI 4 "const1248_operand" "n")]
19262 [(match_operand:<avx512fmaskmode> 6 "register_operand" "1")
19263 (match_operand:VI48F 3 "register_operand" "v")]
19265 (clobber (match_scratch:<avx512fmaskmode> 1 "=&Yk"))]
19267 "v<sseintprefix>scatterd<ssemodesuffix>\t{%3, %5%{%1%}|%5%{%1%}, %3}"
19268 [(set_attr "type" "ssemov")
19269 (set_attr "prefix" "evex")
19270 (set_attr "mode" "<sseinsnmode>")])
19272 (define_expand "<avx512>_scatterdi<mode>"
19273 [(parallel [(set (mem:VI48F
19275 [(match_operand 0 "vsib_address_operand")
19276 (match_operand:<VEC_GATHER_IDXDI> 2 "register_operand")
19277 (match_operand:SI 4 "const1248_operand")]))
19279 [(match_operand:QI 1 "register_operand")
19280 (match_operand:<VEC_GATHER_SRCDI> 3 "register_operand")]
19282 (clobber (match_scratch:QI 6))])]
19286 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[0], operands[2],
19287 operands[4]), UNSPEC_VSIBADDR);
19290 (define_insn "*avx512f_scatterdi<mode>"
19291 [(set (match_operator:VI48F 5 "vsib_mem_operator"
19293 [(match_operand:P 0 "vsib_address_operand" "Tv")
19294 (match_operand:<VEC_GATHER_IDXDI> 2 "register_operand" "v")
19295 (match_operand:SI 4 "const1248_operand" "n")]
19298 [(match_operand:QI 6 "register_operand" "1")
19299 (match_operand:<VEC_GATHER_SRCDI> 3 "register_operand" "v")]
19301 (clobber (match_scratch:QI 1 "=&Yk"))]
19304 if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 8)
19305 return "v<sseintprefix>scatterq<ssemodesuffix>\t{%3, %5%{%1%}|%5%{%1%}, %3}";
19306 return "v<sseintprefix>scatterq<ssemodesuffix>\t{%3, %5%{%1%}|%t5%{%1%}, %3}";
19308 [(set_attr "type" "ssemov")
19309 (set_attr "prefix" "evex")
19310 (set_attr "mode" "<sseinsnmode>")])
19312 (define_insn "<avx512>_compress<mode>_mask"
19313 [(set (match_operand:VI48F 0 "register_operand" "=v")
19315 [(match_operand:VI48F 1 "register_operand" "v")
19316 (match_operand:VI48F 2 "vector_move_operand" "0C")
19317 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")]
19320 "v<sseintprefix>compress<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
19321 [(set_attr "type" "ssemov")
19322 (set_attr "prefix" "evex")
19323 (set_attr "mode" "<sseinsnmode>")])
19325 (define_insn "compress<mode>_mask"
19326 [(set (match_operand:VI12_AVX512VLBW 0 "register_operand" "=v")
19327 (unspec:VI12_AVX512VLBW
19328 [(match_operand:VI12_AVX512VLBW 1 "register_operand" "v")
19329 (match_operand:VI12_AVX512VLBW 2 "vector_move_operand" "0C")
19330 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")]
19332 "TARGET_AVX512VBMI2"
19333 "vpcompress<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
19334 [(set_attr "type" "ssemov")
19335 (set_attr "prefix" "evex")
19336 (set_attr "mode" "<sseinsnmode>")])
19338 (define_insn "<avx512>_compressstore<mode>_mask"
19339 [(set (match_operand:VI48F 0 "memory_operand" "=m")
19341 [(match_operand:VI48F 1 "register_operand" "x")
19343 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")]
19344 UNSPEC_COMPRESS_STORE))]
19346 "v<sseintprefix>compress<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}"
19347 [(set_attr "type" "ssemov")
19348 (set_attr "prefix" "evex")
19349 (set_attr "memory" "store")
19350 (set_attr "mode" "<sseinsnmode>")])
19352 (define_insn "compressstore<mode>_mask"
19353 [(set (match_operand:VI12_AVX512VLBW 0 "memory_operand" "=m")
19354 (unspec:VI12_AVX512VLBW
19355 [(match_operand:VI12_AVX512VLBW 1 "register_operand" "x")
19357 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")]
19358 UNSPEC_COMPRESS_STORE))]
19359 "TARGET_AVX512VBMI2"
19360 "vpcompress<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}"
19361 [(set_attr "type" "ssemov")
19362 (set_attr "prefix" "evex")
19363 (set_attr "memory" "store")
19364 (set_attr "mode" "<sseinsnmode>")])
19366 (define_expand "<avx512>_expand<mode>_maskz"
19367 [(set (match_operand:VI48F 0 "register_operand")
19369 [(match_operand:VI48F 1 "nonimmediate_operand")
19370 (match_operand:VI48F 2 "vector_move_operand")
19371 (match_operand:<avx512fmaskmode> 3 "register_operand")]
19374 "operands[2] = CONST0_RTX (<MODE>mode);")
19376 (define_insn "<avx512>_expand<mode>_mask"
19377 [(set (match_operand:VI48F 0 "register_operand" "=v,v")
19379 [(match_operand:VI48F 1 "nonimmediate_operand" "v,m")
19380 (match_operand:VI48F 2 "vector_move_operand" "0C,0C")
19381 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")]
19384 "v<sseintprefix>expand<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
19385 [(set_attr "type" "ssemov")
19386 (set_attr "prefix" "evex")
19387 (set_attr "memory" "none,load")
19388 (set_attr "mode" "<sseinsnmode>")])
19390 (define_insn "expand<mode>_mask"
19391 [(set (match_operand:VI12_AVX512VLBW 0 "register_operand" "=v,v")
19392 (unspec:VI12_AVX512VLBW
19393 [(match_operand:VI12_AVX512VLBW 1 "nonimmediate_operand" "v,m")
19394 (match_operand:VI12_AVX512VLBW 2 "vector_move_operand" "0C,0C")
19395 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")]
19397 "TARGET_AVX512VBMI2"
19398 "v<sseintprefix>expand<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
19399 [(set_attr "type" "ssemov")
19400 (set_attr "prefix" "evex")
19401 (set_attr "memory" "none,load")
19402 (set_attr "mode" "<sseinsnmode>")])
19404 (define_expand "expand<mode>_maskz"
19405 [(set (match_operand:VI12_AVX512VLBW 0 "register_operand")
19406 (unspec:VI12_AVX512VLBW
19407 [(match_operand:VI12_AVX512VLBW 1 "nonimmediate_operand")
19408 (match_operand:VI12_AVX512VLBW 2 "vector_move_operand")
19409 (match_operand:<avx512fmaskmode> 3 "register_operand")]
19411 "TARGET_AVX512VBMI2"
19412 "operands[2] = CONST0_RTX (<MODE>mode);")
19414 (define_insn "avx512dq_rangep<mode><mask_name><round_saeonly_name>"
19415 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
19416 (unspec:VF_AVX512VL
19417 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
19418 (match_operand:VF_AVX512VL 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
19419 (match_operand:SI 3 "const_0_to_15_operand")]
19421 "TARGET_AVX512DQ && <round_saeonly_mode512bit_condition>"
19422 "vrange<ssemodesuffix>\t{%3, <round_saeonly_mask_op4>%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2<round_saeonly_mask_op4>, %3}"
19423 [(set_attr "type" "sse")
19424 (set_attr "prefix" "evex")
19425 (set_attr "mode" "<MODE>")])
19427 (define_insn "avx512dq_ranges<mode><round_saeonly_name>"
19428 [(set (match_operand:VF_128 0 "register_operand" "=v")
19431 [(match_operand:VF_128 1 "register_operand" "v")
19432 (match_operand:VF_128 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
19433 (match_operand:SI 3 "const_0_to_15_operand")]
19438 "vrange<ssescalarmodesuffix>\t{%3, <round_saeonly_op4>%2, %1, %0|%0, %1, %2<round_saeonly_op4>, %3}"
19439 [(set_attr "type" "sse")
19440 (set_attr "prefix" "evex")
19441 (set_attr "mode" "<MODE>")])
19443 (define_insn "avx512dq_fpclass<mode><mask_scalar_merge_name>"
19444 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
19445 (unspec:<avx512fmaskmode>
19446 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
19447 (match_operand:QI 2 "const_0_to_255_operand" "n")]
19450 "vfpclass<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}";
19451 [(set_attr "type" "sse")
19452 (set_attr "length_immediate" "1")
19453 (set_attr "prefix" "evex")
19454 (set_attr "mode" "<MODE>")])
19456 (define_insn "avx512dq_vmfpclass<mode>"
19457 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
19458 (and:<avx512fmaskmode>
19459 (unspec:<avx512fmaskmode>
19460 [(match_operand:VF_128 1 "register_operand" "v")
19461 (match_operand:QI 2 "const_0_to_255_operand" "n")]
19465 "vfpclass<ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %2}";
19466 [(set_attr "type" "sse")
19467 (set_attr "length_immediate" "1")
19468 (set_attr "prefix" "evex")
19469 (set_attr "mode" "<MODE>")])
19471 (define_insn "<avx512>_getmant<mode><mask_name><round_saeonly_name>"
19472 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
19473 (unspec:VF_AVX512VL
19474 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "<round_saeonly_constraint>")
19475 (match_operand:SI 2 "const_0_to_15_operand")]
19478 "vgetmant<ssemodesuffix>\t{%2, <round_saeonly_mask_op3>%1, %0<mask_operand3>|%0<mask_operand3>, %1<round_saeonly_mask_op3>, %2}";
19479 [(set_attr "prefix" "evex")
19480 (set_attr "mode" "<MODE>")])
19482 (define_insn "avx512f_vgetmant<mode><mask_scalar_name><round_saeonly_scalar_name>"
19483 [(set (match_operand:VF_128 0 "register_operand" "=v")
19486 [(match_operand:VF_128 1 "register_operand" "v")
19487 (match_operand:VF_128 2 "<round_saeonly_scalar_nimm_predicate>" "<round_saeonly_scalar_constraint>")
19488 (match_operand:SI 3 "const_0_to_15_operand")]
19493 "vgetmant<ssescalarmodesuffix>\t{%3, <round_saeonly_scalar_mask_op4>%2, %1, %0<mask_scalar_operand4>|%0<mask_scalar_operand4>, %1, %2<round_saeonly_scalar_mask_op4>, %3}";
19494 [(set_attr "prefix" "evex")
19495 (set_attr "mode" "<ssescalarmode>")])
19497 ;; The correct representation for this is absolutely enormous, and
19498 ;; surely not generally useful.
19499 (define_insn "<mask_codefor>avx512bw_dbpsadbw<mode><mask_name>"
19500 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
19501 (unspec:VI2_AVX512VL
19502 [(match_operand:<dbpsadbwmode> 1 "register_operand" "v")
19503 (match_operand:<dbpsadbwmode> 2 "nonimmediate_operand" "vm")
19504 (match_operand:SI 3 "const_0_to_255_operand")]
19507 "vdbpsadbw\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3}"
19508 [(set_attr "type" "sselog1")
19509 (set_attr "length_immediate" "1")
19510 (set_attr "prefix" "evex")
19511 (set_attr "mode" "<sseinsnmode>")])
19513 (define_insn "clz<mode>2<mask_name>"
19514 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
19516 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm")))]
19518 "vplzcnt<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
19519 [(set_attr "type" "sse")
19520 (set_attr "prefix" "evex")
19521 (set_attr "mode" "<sseinsnmode>")])
19523 (define_insn "<mask_codefor>conflict<mode><mask_name>"
19524 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
19525 (unspec:VI48_AVX512VL
19526 [(match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm")]
19529 "vpconflict<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
19530 [(set_attr "type" "sse")
19531 (set_attr "prefix" "evex")
19532 (set_attr "mode" "<sseinsnmode>")])
19534 (define_insn "sha1msg1"
19535 [(set (match_operand:V4SI 0 "register_operand" "=x")
19537 [(match_operand:V4SI 1 "register_operand" "0")
19538 (match_operand:V4SI 2 "vector_operand" "xBm")]
19541 "sha1msg1\t{%2, %0|%0, %2}"
19542 [(set_attr "type" "sselog1")
19543 (set_attr "mode" "TI")])
19545 (define_insn "sha1msg2"
19546 [(set (match_operand:V4SI 0 "register_operand" "=x")
19548 [(match_operand:V4SI 1 "register_operand" "0")
19549 (match_operand:V4SI 2 "vector_operand" "xBm")]
19552 "sha1msg2\t{%2, %0|%0, %2}"
19553 [(set_attr "type" "sselog1")
19554 (set_attr "mode" "TI")])
19556 (define_insn "sha1nexte"
19557 [(set (match_operand:V4SI 0 "register_operand" "=x")
19559 [(match_operand:V4SI 1 "register_operand" "0")
19560 (match_operand:V4SI 2 "vector_operand" "xBm")]
19561 UNSPEC_SHA1NEXTE))]
19563 "sha1nexte\t{%2, %0|%0, %2}"
19564 [(set_attr "type" "sselog1")
19565 (set_attr "mode" "TI")])
19567 (define_insn "sha1rnds4"
19568 [(set (match_operand:V4SI 0 "register_operand" "=x")
19570 [(match_operand:V4SI 1 "register_operand" "0")
19571 (match_operand:V4SI 2 "vector_operand" "xBm")
19572 (match_operand:SI 3 "const_0_to_3_operand" "n")]
19573 UNSPEC_SHA1RNDS4))]
19575 "sha1rnds4\t{%3, %2, %0|%0, %2, %3}"
19576 [(set_attr "type" "sselog1")
19577 (set_attr "length_immediate" "1")
19578 (set_attr "mode" "TI")])
19580 (define_insn "sha256msg1"
19581 [(set (match_operand:V4SI 0 "register_operand" "=x")
19583 [(match_operand:V4SI 1 "register_operand" "0")
19584 (match_operand:V4SI 2 "vector_operand" "xBm")]
19585 UNSPEC_SHA256MSG1))]
19587 "sha256msg1\t{%2, %0|%0, %2}"
19588 [(set_attr "type" "sselog1")
19589 (set_attr "mode" "TI")])
19591 (define_insn "sha256msg2"
19592 [(set (match_operand:V4SI 0 "register_operand" "=x")
19594 [(match_operand:V4SI 1 "register_operand" "0")
19595 (match_operand:V4SI 2 "vector_operand" "xBm")]
19596 UNSPEC_SHA256MSG2))]
19598 "sha256msg2\t{%2, %0|%0, %2}"
19599 [(set_attr "type" "sselog1")
19600 (set_attr "mode" "TI")])
19602 (define_insn "sha256rnds2"
19603 [(set (match_operand:V4SI 0 "register_operand" "=x")
19605 [(match_operand:V4SI 1 "register_operand" "0")
19606 (match_operand:V4SI 2 "vector_operand" "xBm")
19607 (match_operand:V4SI 3 "register_operand" "Yz")]
19608 UNSPEC_SHA256RNDS2))]
19610 "sha256rnds2\t{%3, %2, %0|%0, %2, %3}"
19611 [(set_attr "type" "sselog1")
19612 (set_attr "length_immediate" "1")
19613 (set_attr "mode" "TI")])
19615 (define_insn_and_split "avx512f_<castmode><avxsizesuffix>_<castmode>"
19616 [(set (match_operand:AVX512MODE2P 0 "nonimmediate_operand" "=x,m")
19617 (unspec:AVX512MODE2P
19618 [(match_operand:<ssequartermode> 1 "nonimmediate_operand" "xm,x")]
19620 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
19622 "&& reload_completed"
19623 [(set (match_dup 0) (match_dup 1))]
19625 if (REG_P (operands[0]))
19626 operands[0] = gen_lowpart (<ssequartermode>mode, operands[0]);
19628 operands[1] = lowpart_subreg (<MODE>mode, operands[1],
19629 <ssequartermode>mode);
19632 (define_insn_and_split "avx512f_<castmode><avxsizesuffix>_256<castmode>"
19633 [(set (match_operand:AVX512MODE2P 0 "nonimmediate_operand" "=x,m")
19634 (unspec:AVX512MODE2P
19635 [(match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "xm,x")]
19637 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
19639 "&& reload_completed"
19640 [(set (match_dup 0) (match_dup 1))]
19642 if (REG_P (operands[0]))
19643 operands[0] = gen_lowpart (<ssehalfvecmode>mode, operands[0]);
19645 operands[1] = lowpart_subreg (<MODE>mode, operands[1],
19646 <ssehalfvecmode>mode);
19649 (define_int_iterator VPMADD52
19650 [UNSPEC_VPMADD52LUQ
19651 UNSPEC_VPMADD52HUQ])
19653 (define_int_attr vpmadd52type
19654 [(UNSPEC_VPMADD52LUQ "luq") (UNSPEC_VPMADD52HUQ "huq")])
19656 (define_expand "vpamdd52huq<mode>_maskz"
19657 [(match_operand:VI8_AVX512VL 0 "register_operand")
19658 (match_operand:VI8_AVX512VL 1 "register_operand")
19659 (match_operand:VI8_AVX512VL 2 "register_operand")
19660 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand")
19661 (match_operand:<avx512fmaskmode> 4 "register_operand")]
19662 "TARGET_AVX512IFMA"
19664 emit_insn (gen_vpamdd52huq<mode>_maskz_1 (
19665 operands[0], operands[1], operands[2], operands[3],
19666 CONST0_RTX (<MODE>mode), operands[4]));
19670 (define_expand "vpamdd52luq<mode>_maskz"
19671 [(match_operand:VI8_AVX512VL 0 "register_operand")
19672 (match_operand:VI8_AVX512VL 1 "register_operand")
19673 (match_operand:VI8_AVX512VL 2 "register_operand")
19674 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand")
19675 (match_operand:<avx512fmaskmode> 4 "register_operand")]
19676 "TARGET_AVX512IFMA"
19678 emit_insn (gen_vpamdd52luq<mode>_maskz_1 (
19679 operands[0], operands[1], operands[2], operands[3],
19680 CONST0_RTX (<MODE>mode), operands[4]));
19684 (define_insn "vpamdd52<vpmadd52type><mode><sd_maskz_name>"
19685 [(set (match_operand:VI8_AVX512VL 0 "register_operand" "=v")
19686 (unspec:VI8_AVX512VL
19687 [(match_operand:VI8_AVX512VL 1 "register_operand" "0")
19688 (match_operand:VI8_AVX512VL 2 "register_operand" "v")
19689 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand" "vm")]
19691 "TARGET_AVX512IFMA"
19692 "vpmadd52<vpmadd52type>\t{%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3}"
19693 [(set_attr "type" "ssemuladd")
19694 (set_attr "prefix" "evex")
19695 (set_attr "mode" "<sseinsnmode>")])
19697 (define_insn "vpamdd52<vpmadd52type><mode>_mask"
19698 [(set (match_operand:VI8_AVX512VL 0 "register_operand" "=v")
19699 (vec_merge:VI8_AVX512VL
19700 (unspec:VI8_AVX512VL
19701 [(match_operand:VI8_AVX512VL 1 "register_operand" "0")
19702 (match_operand:VI8_AVX512VL 2 "register_operand" "v")
19703 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand" "vm")]
19706 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
19707 "TARGET_AVX512IFMA"
19708 "vpmadd52<vpmadd52type>\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3}"
19709 [(set_attr "type" "ssemuladd")
19710 (set_attr "prefix" "evex")
19711 (set_attr "mode" "<sseinsnmode>")])
19713 (define_insn "vpmultishiftqb<mode><mask_name>"
19714 [(set (match_operand:VI1_AVX512VL 0 "register_operand" "=v")
19715 (unspec:VI1_AVX512VL
19716 [(match_operand:VI1_AVX512VL 1 "register_operand" "v")
19717 (match_operand:VI1_AVX512VL 2 "nonimmediate_operand" "vm")]
19718 UNSPEC_VPMULTISHIFT))]
19719 "TARGET_AVX512VBMI"
19720 "vpmultishiftqb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
19721 [(set_attr "type" "sselog")
19722 (set_attr "prefix" "evex")
19723 (set_attr "mode" "<sseinsnmode>")])
19725 (define_mode_iterator IMOD4
19726 [(V64SF "TARGET_AVX5124FMAPS") (V64SI "TARGET_AVX5124VNNIW")])
19728 (define_mode_attr imod4_narrow
19729 [(V64SF "V16SF") (V64SI "V16SI")])
19731 (define_expand "mov<mode>"
19732 [(set (match_operand:IMOD4 0 "nonimmediate_operand")
19733 (match_operand:IMOD4 1 "vector_move_operand"))]
19736 ix86_expand_vector_move (<MODE>mode, operands);
19740 (define_insn_and_split "*mov<mode>_internal"
19741 [(set (match_operand:IMOD4 0 "nonimmediate_operand" "=v,v ,m")
19742 (match_operand:IMOD4 1 "vector_move_operand" " C,vm,v"))]
19744 && (register_operand (operands[0], <MODE>mode)
19745 || register_operand (operands[1], <MODE>mode))"
19747 "&& reload_completed"
19753 for (i = 0; i < 4; i++)
19755 op0 = simplify_subreg
19756 (<imod4_narrow>mode, operands[0], <MODE>mode, i * 64);
19757 op1 = simplify_subreg
19758 (<imod4_narrow>mode, operands[1], <MODE>mode, i * 64);
19759 emit_move_insn (op0, op1);
19764 (define_insn "avx5124fmaddps_4fmaddps"
19765 [(set (match_operand:V16SF 0 "register_operand" "=v")
19767 [(match_operand:V16SF 1 "register_operand" "0")
19768 (match_operand:V64SF 2 "register_operand" "Yh")
19769 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FMADD))]
19770 "TARGET_AVX5124FMAPS"
19771 "v4fmaddps\t{%3, %g2, %0|%0, %g2, %3}"
19772 [(set_attr ("type") ("ssemuladd"))
19773 (set_attr ("prefix") ("evex"))
19774 (set_attr ("mode") ("V16SF"))])
19776 (define_insn "avx5124fmaddps_4fmaddps_mask"
19777 [(set (match_operand:V16SF 0 "register_operand" "=v")
19780 [(match_operand:V64SF 1 "register_operand" "Yh")
19781 (match_operand:V4SF 2 "memory_operand" "m")] UNSPEC_VP4FMADD)
19782 (match_operand:V16SF 3 "register_operand" "0")
19783 (match_operand:HI 4 "register_operand" "Yk")))]
19784 "TARGET_AVX5124FMAPS"
19785 "v4fmaddps\t{%2, %g1, %0%{%4%}|%{%4%}%0, %g1, %2}"
19786 [(set_attr ("type") ("ssemuladd"))
19787 (set_attr ("prefix") ("evex"))
19788 (set_attr ("mode") ("V16SF"))])
19790 (define_insn "avx5124fmaddps_4fmaddps_maskz"
19791 [(set (match_operand:V16SF 0 "register_operand" "=v")
19794 [(match_operand:V16SF 1 "register_operand" "0")
19795 (match_operand:V64SF 2 "register_operand" "Yh")
19796 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FMADD)
19797 (match_operand:V16SF 4 "const0_operand" "C")
19798 (match_operand:HI 5 "register_operand" "Yk")))]
19799 "TARGET_AVX5124FMAPS"
19800 "v4fmaddps\t{%3, %g2, %0%{%5%}%{z%}|%{%5%}%{z%}%0, %g2, %3}"
19801 [(set_attr ("type") ("ssemuladd"))
19802 (set_attr ("prefix") ("evex"))
19803 (set_attr ("mode") ("V16SF"))])
19805 (define_insn "avx5124fmaddps_4fmaddss"
19806 [(set (match_operand:V4SF 0 "register_operand" "=v")
19808 [(match_operand:V4SF 1 "register_operand" "0")
19809 (match_operand:V64SF 2 "register_operand" "Yh")
19810 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FMADD))]
19811 "TARGET_AVX5124FMAPS"
19812 "v4fmaddss\t{%3, %x2, %0|%0, %x2, %3}"
19813 [(set_attr ("type") ("ssemuladd"))
19814 (set_attr ("prefix") ("evex"))
19815 (set_attr ("mode") ("SF"))])
19817 (define_insn "avx5124fmaddps_4fmaddss_mask"
19818 [(set (match_operand:V4SF 0 "register_operand" "=v")
19821 [(match_operand:V64SF 1 "register_operand" "Yh")
19822 (match_operand:V4SF 2 "memory_operand" "m")] UNSPEC_VP4FMADD)
19823 (match_operand:V4SF 3 "register_operand" "0")
19824 (match_operand:QI 4 "register_operand" "Yk")))]
19825 "TARGET_AVX5124FMAPS"
19826 "v4fmaddss\t{%2, %x1, %0%{%4%}|%{%4%}%0, %x1, %2}"
19827 [(set_attr ("type") ("ssemuladd"))
19828 (set_attr ("prefix") ("evex"))
19829 (set_attr ("mode") ("SF"))])
19831 (define_insn "avx5124fmaddps_4fmaddss_maskz"
19832 [(set (match_operand:V4SF 0 "register_operand" "=v")
19835 [(match_operand:V4SF 1 "register_operand" "0")
19836 (match_operand:V64SF 2 "register_operand" "Yh")
19837 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FMADD)
19838 (match_operand:V4SF 4 "const0_operand" "C")
19839 (match_operand:QI 5 "register_operand" "Yk")))]
19840 "TARGET_AVX5124FMAPS"
19841 "v4fmaddss\t{%3, %x2, %0%{%5%}%{z%}|%{%5%}%{z%}%0, %x2, %3}"
19842 [(set_attr ("type") ("ssemuladd"))
19843 (set_attr ("prefix") ("evex"))
19844 (set_attr ("mode") ("SF"))])
19846 (define_insn "avx5124fmaddps_4fnmaddps"
19847 [(set (match_operand:V16SF 0 "register_operand" "=v")
19849 [(match_operand:V16SF 1 "register_operand" "0")
19850 (match_operand:V64SF 2 "register_operand" "Yh")
19851 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FNMADD))]
19852 "TARGET_AVX5124FMAPS"
19853 "v4fnmaddps\t{%3, %g2, %0|%0, %g2, %3}"
19854 [(set_attr ("type") ("ssemuladd"))
19855 (set_attr ("prefix") ("evex"))
19856 (set_attr ("mode") ("V16SF"))])
19858 (define_insn "avx5124fmaddps_4fnmaddps_mask"
19859 [(set (match_operand:V16SF 0 "register_operand" "=v")
19862 [(match_operand:V64SF 1 "register_operand" "Yh")
19863 (match_operand:V4SF 2 "memory_operand" "m")] UNSPEC_VP4FNMADD)
19864 (match_operand:V16SF 3 "register_operand" "0")
19865 (match_operand:HI 4 "register_operand" "Yk")))]
19866 "TARGET_AVX5124FMAPS"
19867 "v4fnmaddps\t{%2, %g1, %0%{%4%}|%{%4%}%0, %g1, %2}"
19868 [(set_attr ("type") ("ssemuladd"))
19869 (set_attr ("prefix") ("evex"))
19870 (set_attr ("mode") ("V16SF"))])
19872 (define_insn "avx5124fmaddps_4fnmaddps_maskz"
19873 [(set (match_operand:V16SF 0 "register_operand" "=v")
19876 [(match_operand:V16SF 1 "register_operand" "0")
19877 (match_operand:V64SF 2 "register_operand" "Yh")
19878 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FNMADD)
19879 (match_operand:V16SF 4 "const0_operand" "C")
19880 (match_operand:HI 5 "register_operand" "Yk")))]
19881 "TARGET_AVX5124FMAPS"
19882 "v4fnmaddps\t{%3, %g2, %0%{%5%}%{z%}|%{%5%}%{z%}%0, %g2, %3}"
19883 [(set_attr ("type") ("ssemuladd"))
19884 (set_attr ("prefix") ("evex"))
19885 (set_attr ("mode") ("V16SF"))])
19887 (define_insn "avx5124fmaddps_4fnmaddss"
19888 [(set (match_operand:V4SF 0 "register_operand" "=v")
19890 [(match_operand:V4SF 1 "register_operand" "0")
19891 (match_operand:V64SF 2 "register_operand" "Yh")
19892 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FNMADD))]
19893 "TARGET_AVX5124FMAPS"
19894 "v4fnmaddss\t{%3, %x2, %0|%0, %x2, %3}"
19895 [(set_attr ("type") ("ssemuladd"))
19896 (set_attr ("prefix") ("evex"))
19897 (set_attr ("mode") ("SF"))])
19899 (define_insn "avx5124fmaddps_4fnmaddss_mask"
19900 [(set (match_operand:V4SF 0 "register_operand" "=v")
19903 [(match_operand:V64SF 1 "register_operand" "Yh")
19904 (match_operand:V4SF 2 "memory_operand" "m")] UNSPEC_VP4FNMADD)
19905 (match_operand:V4SF 3 "register_operand" "0")
19906 (match_operand:QI 4 "register_operand" "Yk")))]
19907 "TARGET_AVX5124FMAPS"
19908 "v4fnmaddss\t{%2, %x1, %0%{%4%}|%{%4%}%0, %x1, %2}"
19909 [(set_attr ("type") ("ssemuladd"))
19910 (set_attr ("prefix") ("evex"))
19911 (set_attr ("mode") ("SF"))])
19913 (define_insn "avx5124fmaddps_4fnmaddss_maskz"
19914 [(set (match_operand:V4SF 0 "register_operand" "=v")
19917 [(match_operand:V4SF 1 "register_operand" "0")
19918 (match_operand:V64SF 2 "register_operand" "Yh")
19919 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FNMADD)
19920 (match_operand:V4SF 4 "const0_operand" "C")
19921 (match_operand:QI 5 "register_operand" "Yk")))]
19922 "TARGET_AVX5124FMAPS"
19923 "v4fnmaddss\t{%3, %x2, %0%{%5%}%{z%}|%{%5%}%{z%}%0, %x2, %3}"
19924 [(set_attr ("type") ("ssemuladd"))
19925 (set_attr ("prefix") ("evex"))
19926 (set_attr ("mode") ("SF"))])
19928 (define_insn "avx5124vnniw_vp4dpwssd"
19929 [(set (match_operand:V16SI 0 "register_operand" "=v")
19931 [(match_operand:V16SI 1 "register_operand" "0")
19932 (match_operand:V64SI 2 "register_operand" "Yh")
19933 (match_operand:V4SI 3 "memory_operand" "m")] UNSPEC_VP4DPWSSD))]
19934 "TARGET_AVX5124VNNIW"
19935 "vp4dpwssd\t{%3, %g2, %0|%0, %g2, %3}"
19936 [(set_attr ("type") ("ssemuladd"))
19937 (set_attr ("prefix") ("evex"))
19938 (set_attr ("mode") ("TI"))])
19940 (define_insn "avx5124vnniw_vp4dpwssd_mask"
19941 [(set (match_operand:V16SI 0 "register_operand" "=v")
19944 [(match_operand:V64SI 1 "register_operand" "Yh")
19945 (match_operand:V4SI 2 "memory_operand" "m")] UNSPEC_VP4DPWSSD)
19946 (match_operand:V16SI 3 "register_operand" "0")
19947 (match_operand:HI 4 "register_operand" "Yk")))]
19948 "TARGET_AVX5124VNNIW"
19949 "vp4dpwssd\t{%2, %g1, %0%{%4%}|%{%4%}%0, %g1, %2}"
19950 [(set_attr ("type") ("ssemuladd"))
19951 (set_attr ("prefix") ("evex"))
19952 (set_attr ("mode") ("TI"))])
19954 (define_insn "avx5124vnniw_vp4dpwssd_maskz"
19955 [(set (match_operand:V16SI 0 "register_operand" "=v")
19958 [(match_operand:V16SI 1 "register_operand" "0")
19959 (match_operand:V64SI 2 "register_operand" "Yh")
19960 (match_operand:V4SI 3 "memory_operand" "m")] UNSPEC_VP4DPWSSD)
19961 (match_operand:V16SI 4 "const0_operand" "C")
19962 (match_operand:HI 5 "register_operand" "Yk")))]
19963 "TARGET_AVX5124VNNIW"
19964 "vp4dpwssd\t{%3, %g2, %0%{%5%}%{z%}|%{%5%}%{z%}%0, %g2, %3}"
19965 [(set_attr ("type") ("ssemuladd"))
19966 (set_attr ("prefix") ("evex"))
19967 (set_attr ("mode") ("TI"))])
19969 (define_insn "avx5124vnniw_vp4dpwssds"
19970 [(set (match_operand:V16SI 0 "register_operand" "=v")
19972 [(match_operand:V16SI 1 "register_operand" "0")
19973 (match_operand:V64SI 2 "register_operand" "Yh")
19974 (match_operand:V4SI 3 "memory_operand" "m")] UNSPEC_VP4DPWSSDS))]
19975 "TARGET_AVX5124VNNIW"
19976 "vp4dpwssds\t{%3, %g2, %0|%0, %g2, %3}"
19977 [(set_attr ("type") ("ssemuladd"))
19978 (set_attr ("prefix") ("evex"))
19979 (set_attr ("mode") ("TI"))])
19981 (define_insn "avx5124vnniw_vp4dpwssds_mask"
19982 [(set (match_operand:V16SI 0 "register_operand" "=v")
19985 [(match_operand:V64SI 1 "register_operand" "Yh")
19986 (match_operand:V4SI 2 "memory_operand" "m")] UNSPEC_VP4DPWSSDS)
19987 (match_operand:V16SI 3 "register_operand" "0")
19988 (match_operand:HI 4 "register_operand" "Yk")))]
19989 "TARGET_AVX5124VNNIW"
19990 "vp4dpwssds\t{%2, %g1, %0%{%4%}|%{%4%}%0, %g1, %2}"
19991 [(set_attr ("type") ("ssemuladd"))
19992 (set_attr ("prefix") ("evex"))
19993 (set_attr ("mode") ("TI"))])
19995 (define_insn "avx5124vnniw_vp4dpwssds_maskz"
19996 [(set (match_operand:V16SI 0 "register_operand" "=v")
19999 [(match_operand:V16SI 1 "register_operand" "0")
20000 (match_operand:V64SI 2 "register_operand" "Yh")
20001 (match_operand:V4SI 3 "memory_operand" "m")] UNSPEC_VP4DPWSSDS)
20002 (match_operand:V16SI 4 "const0_operand" "C")
20003 (match_operand:HI 5 "register_operand" "Yk")))]
20004 "TARGET_AVX5124VNNIW"
20005 "vp4dpwssds\t{%3, %g2, %0%{%5%}%{z%}|%{%5%}%{z%}%0, %g2, %3}"
20006 [(set_attr ("type") ("ssemuladd"))
20007 (set_attr ("prefix") ("evex"))
20008 (set_attr ("mode") ("TI"))])
20010 (define_insn "vpopcount<mode><mask_name>"
20011 [(set (match_operand:VI48_512 0 "register_operand" "=v")
20013 (match_operand:VI48_512 1 "nonimmediate_operand" "vm")))]
20014 "TARGET_AVX512VPOPCNTDQ"
20015 "vpopcnt<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}")
20017 ;; Save multiple registers out-of-line.
20018 (define_insn "save_multiple<mode>"
20019 [(match_parallel 0 "save_multiple"
20020 [(use (match_operand:P 1 "symbol_operand"))])]
20021 "TARGET_SSE && TARGET_64BIT"
20024 ;; Restore multiple registers out-of-line.
20025 (define_insn "restore_multiple<mode>"
20026 [(match_parallel 0 "restore_multiple"
20027 [(use (match_operand:P 1 "symbol_operand"))])]
20028 "TARGET_SSE && TARGET_64BIT"
20031 ;; Restore multiple registers out-of-line and return.
20032 (define_insn "restore_multiple_and_return<mode>"
20033 [(match_parallel 0 "restore_multiple"
20035 (use (match_operand:P 1 "symbol_operand"))
20036 (set (reg:DI SP_REG) (reg:DI R10_REG))
20038 "TARGET_SSE && TARGET_64BIT"
20041 ;; Restore multiple registers out-of-line when hard frame pointer is used,
20042 ;; perform the leave operation prior to returning (from the function).
20043 (define_insn "restore_multiple_leave_return<mode>"
20044 [(match_parallel 0 "restore_multiple"
20046 (use (match_operand:P 1 "symbol_operand"))
20047 (set (reg:DI SP_REG) (plus:DI (reg:DI BP_REG) (const_int 8)))
20048 (set (reg:DI BP_REG) (mem:DI (reg:DI BP_REG)))
20049 (clobber (mem:BLK (scratch)))
20051 "TARGET_SSE && TARGET_64BIT"
20054 (define_insn "vgf2p8affineinvqb_<mode><mask_name>"
20055 [(set (match_operand:VI1_AVX512F 0 "register_operand" "=x,x,v")
20056 (unspec:VI1_AVX512F [(match_operand:VI1_AVX512F 1 "register_operand" "%0,x,v")
20057 (match_operand:VI1_AVX512F 2 "nonimmediate_operand" "xBm,xm,vm")
20058 (match_operand:QI 3 "const_0_to_255_operand" "n,n,n")]
20059 UNSPEC_GF2P8AFFINEINV))]
20062 gf2p8affineinvqb\t{%3, %2, %0| %0, %2, %3}
20063 vgf2p8affineinvqb\t{%3, %2, %1, %0<mask_operand4>| %0<mask_operand4>, %1, %2, %3}
20064 vgf2p8affineinvqb\t{%3, %2, %1, %0<mask_operand4>| %0<mask_operand4>, %1, %2, %3}"
20065 [(set_attr "isa" "noavx,avx,avx512bw")
20066 (set_attr "prefix_data16" "1,*,*")
20067 (set_attr "prefix_extra" "1")
20068 (set_attr "prefix" "orig,maybe_evex,evex")
20069 (set_attr "mode" "<sseinsnmode>")])
20071 (define_insn "vgf2p8affineqb_<mode><mask_name>"
20072 [(set (match_operand:VI1_AVX512F 0 "register_operand" "=x,x,v")
20073 (unspec:VI1_AVX512F [(match_operand:VI1_AVX512F 1 "register_operand" "%0,x,v")
20074 (match_operand:VI1_AVX512F 2 "nonimmediate_operand" "xBm,xm,vm")
20075 (match_operand:QI 3 "const_0_to_255_operand" "n,n,n")]
20076 UNSPEC_GF2P8AFFINE))]
20079 gf2p8affineqb\t{%3, %2, %0| %0, %2, %3}
20080 vgf2p8affineqb\t{%3, %2, %1, %0<mask_operand4>| %0<mask_operand4>, %1, %2, %3}
20081 vgf2p8affineqb\t{%3, %2, %1, %0<mask_operand4>| %0<mask_operand4>, %1, %2, %3}"
20082 [(set_attr "isa" "noavx,avx,avx512bw")
20083 (set_attr "prefix_data16" "1,*,*")
20084 (set_attr "prefix_extra" "1")
20085 (set_attr "prefix" "orig,maybe_evex,evex")
20086 (set_attr "mode" "<sseinsnmode>")])
20088 (define_insn "vgf2p8mulb_<mode><mask_name>"
20089 [(set (match_operand:VI1_AVX512F 0 "register_operand" "=x,x,v")
20090 (unspec:VI1_AVX512F [(match_operand:VI1_AVX512F 1 "register_operand" "%0,x,v")
20091 (match_operand:VI1_AVX512F 2 "nonimmediate_operand" "xBm,xm,vm")]
20095 gf2p8mulb\t{%2, %0| %0, %2}
20096 vgf2p8mulb\t{%2, %1, %0<mask_operand3>| %0<mask_operand3>, %1, %2}
20097 vgf2p8mulb\t{%2, %1, %0<mask_operand3>| %0<mask_operand3>, %1, %2}"
20098 [(set_attr "isa" "noavx,avx,avx512bw")
20099 (set_attr "prefix_data16" "1,*,*")
20100 (set_attr "prefix_extra" "1")
20101 (set_attr "prefix" "orig,maybe_evex,evex")
20102 (set_attr "mode" "<sseinsnmode>")])
20104 (define_insn "vpshrd_<mode><mask_name>"
20105 [(set (match_operand:VI248_VLBW 0 "register_operand" "=v")
20107 [(match_operand:VI248_VLBW 1 "register_operand" "v")
20108 (match_operand:VI248_VLBW 2 "nonimmediate_operand" "vm")
20109 (match_operand:SI 3 "const_0_to_255_operand" "n")
20111 "TARGET_AVX512VBMI2"
20112 "vpshrd<ssemodesuffix>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3 }"
20113 [(set_attr ("prefix") ("evex"))])
20115 (define_insn "vpshld_<mode><mask_name>"
20116 [(set (match_operand:VI248_VLBW 0 "register_operand" "=v")
20118 [(match_operand:VI248_VLBW 1 "register_operand" "v")
20119 (match_operand:VI248_VLBW 2 "nonimmediate_operand" "vm")
20120 (match_operand:SI 3 "const_0_to_255_operand" "n")
20122 "TARGET_AVX512VBMI2"
20123 "vpshld<ssemodesuffix>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3 }"
20124 [(set_attr ("prefix") ("evex"))])
20126 (define_insn "vpshrdv_<mode>"
20127 [(set (match_operand:VI248_VLBW 0 "register_operand" "=v")
20129 [(match_operand:VI248_VLBW 1 "register_operand" "0")
20130 (match_operand:VI248_VLBW 2 "register_operand" "v")
20131 (match_operand:VI248_VLBW 3 "nonimmediate_operand" "vm")
20132 ] UNSPEC_VPSHRDV))]
20133 "TARGET_AVX512VBMI2"
20134 "vpshrdv<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3 }"
20135 [(set_attr ("prefix") ("evex"))
20136 (set_attr "mode" "<sseinsnmode>")])
20138 (define_insn "vpshrdv_<mode>_mask"
20139 [(set (match_operand:VI248_VLBW 0 "register_operand" "=v")
20140 (vec_merge:VI248_VLBW (unspec:VI248_VLBW
20141 [(match_operand:VI248_VLBW 1 "register_operand" "0")
20142 (match_operand:VI248_VLBW 2 "register_operand" "v")
20143 (match_operand:VI248_VLBW 3 "nonimmediate_operand" "vm")
20146 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk"))
20148 "TARGET_AVX512VBMI2"
20149 "vpshrdv<ssemodesuffix>\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
20150 [(set_attr ("prefix") ("evex"))
20151 (set_attr "mode" "<sseinsnmode>")])
20153 (define_expand "vpshrdv_<mode>_maskz"
20154 [(match_operand:VI248_VLBW 0 "register_operand")
20155 (match_operand:VI248_VLBW 1 "register_operand")
20156 (match_operand:VI248_VLBW 2 "register_operand")
20157 (match_operand:VI248_VLBW 3 "nonimmediate_operand")
20158 (match_operand:<avx512fmaskmode> 4 "register_operand")]
20159 "TARGET_AVX512VBMI2"
20161 emit_insn (gen_vpshrdv_<mode>_maskz_1 (
20162 operands[0], operands[1], operands[2], operands[3],
20163 CONST0_RTX (<MODE>mode), operands[4]));
20167 (define_insn "vpshrdv_<mode>_maskz_1"
20168 [(set (match_operand:VI248_VLBW 0 "register_operand" "=v")
20169 (vec_merge:VI248_VLBW (unspec:VI248_VLBW
20170 [(match_operand:VI248_VLBW 1 "register_operand" "0")
20171 (match_operand:VI248_VLBW 2 "register_operand" "v")
20172 (match_operand:VI248_VLBW 3 "nonimmediate_operand" "vm")
20174 (match_operand:VI248_VLBW 4 "const0_operand" "C")
20175 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk"))
20177 "TARGET_AVX512VBMI2"
20178 "vpshrdv<ssemodesuffix>\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
20179 [(set_attr ("prefix") ("evex"))
20180 (set_attr "mode" "<sseinsnmode>")])
20182 (define_insn "vpshldv_<mode>"
20183 [(set (match_operand:VI248_VLBW 0 "register_operand" "=v")
20185 [(match_operand:VI248_VLBW 1 "register_operand" "0")
20186 (match_operand:VI248_VLBW 2 "register_operand" "v")
20187 (match_operand:VI248_VLBW 3 "nonimmediate_operand" "vm")
20188 ] UNSPEC_VPSHLDV))]
20189 "TARGET_AVX512VBMI2"
20190 "vpshldv<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3 }"
20191 [(set_attr ("prefix") ("evex"))
20192 (set_attr "mode" "<sseinsnmode>")])
20194 (define_insn "vpshldv_<mode>_mask"
20195 [(set (match_operand:VI248_VLBW 0 "register_operand" "=v")
20196 (vec_merge:VI248_VLBW (unspec:VI248_VLBW
20197 [(match_operand:VI248_VLBW 1 "register_operand" "0")
20198 (match_operand:VI248_VLBW 2 "register_operand" "v")
20199 (match_operand:VI248_VLBW 3 "nonimmediate_operand" "vm")
20202 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk"))
20204 "TARGET_AVX512VBMI2"
20205 "vpshldv<ssemodesuffix>\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
20206 [(set_attr ("prefix") ("evex"))
20207 (set_attr "mode" "<sseinsnmode>")])
20209 (define_expand "vpshldv_<mode>_maskz"
20210 [(match_operand:VI248_VLBW 0 "register_operand")
20211 (match_operand:VI248_VLBW 1 "register_operand")
20212 (match_operand:VI248_VLBW 2 "register_operand")
20213 (match_operand:VI248_VLBW 3 "nonimmediate_operand")
20214 (match_operand:<avx512fmaskmode> 4 "register_operand")]
20215 "TARGET_AVX512VBMI2"
20217 emit_insn (gen_vpshldv_<mode>_maskz_1 (
20218 operands[0], operands[1], operands[2], operands[3],
20219 CONST0_RTX (<MODE>mode), operands[4]));
20223 (define_insn "vpshldv_<mode>_maskz_1"
20224 [(set (match_operand:VI248_VLBW 0 "register_operand" "=v")
20225 (vec_merge:VI248_VLBW (unspec:VI248_VLBW
20226 [(match_operand:VI248_VLBW 1 "register_operand" "0")
20227 (match_operand:VI248_VLBW 2 "register_operand" "v")
20228 (match_operand:VI248_VLBW 3 "nonimmediate_operand" "vm")
20230 (match_operand:VI248_VLBW 4 "const0_operand" "C")
20231 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk"))
20233 "TARGET_AVX512VBMI2"
20234 "vpshldv<ssemodesuffix>\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
20235 [(set_attr ("prefix") ("evex"))
20236 (set_attr "mode" "<sseinsnmode>")])
20238 (define_insn "vpdpbusd_<mode>"
20239 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20240 (unspec:VI4_AVX512VL
20241 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20242 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20243 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")
20244 ] UNSPEC_VPMADDUBSWACCD))]
20245 "TARGET_AVX512VNNI"
20246 "vpdpbusd\t{%3, %2, %0|%0, %2, %3 }"
20247 [(set_attr ("prefix") ("evex"))])
20249 (define_insn "vpdpbusd_<mode>_mask"
20250 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20251 (vec_merge:VI4_AVX512VL (unspec:VI4_AVX512VL
20252 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20253 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20254 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")
20255 ] UNSPEC_VPMADDUBSWACCD)
20257 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk"))
20259 "TARGET_AVX512VNNI"
20260 "vpdpbusd\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
20261 [(set_attr ("prefix") ("evex"))])
20263 (define_expand "vpdpbusd_<mode>_maskz"
20264 [(match_operand:VI4_AVX512VL 0 "register_operand")
20265 (match_operand:VI4_AVX512VL 1 "register_operand")
20266 (match_operand:VI4_AVX512VL 2 "register_operand")
20267 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand")
20268 (match_operand:<avx512fmaskmode> 4 "register_operand")]
20269 "TARGET_AVX512VNNI"
20271 emit_insn (gen_vpdpbusd_<mode>_maskz_1 (
20272 operands[0], operands[1], operands[2], operands[3],
20273 CONST0_RTX (<MODE>mode), operands[4]));
20277 (define_insn "vpdpbusd_<mode>_maskz_1"
20278 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20279 (vec_merge:VI4_AVX512VL (unspec:VI4_AVX512VL
20280 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20281 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20282 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")
20283 ] UNSPEC_VPMADDUBSWACCD)
20284 (match_operand:VI4_AVX512VL 4 "const0_operand" "C")
20285 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk"))
20287 "TARGET_AVX512VNNI"
20288 "vpdpbusd\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
20289 [(set_attr ("prefix") ("evex"))])
20292 (define_insn "vpdpbusds_<mode>"
20293 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20294 (unspec:VI4_AVX512VL
20295 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20296 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20297 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")
20298 ] UNSPEC_VPMADDUBSWACCSSD))]
20299 "TARGET_AVX512VNNI"
20300 "vpdpbusds\t{%3, %2, %0|%0, %2, %3 }"
20301 [(set_attr ("prefix") ("evex"))])
20303 (define_insn "vpdpbusds_<mode>_mask"
20304 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20305 (vec_merge:VI4_AVX512VL (unspec:VI4_AVX512VL
20306 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20307 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20308 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")
20309 ] UNSPEC_VPMADDUBSWACCSSD)
20311 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk"))
20313 "TARGET_AVX512VNNI"
20314 "vpdpbusds\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
20315 [(set_attr ("prefix") ("evex"))])
20317 (define_expand "vpdpbusds_<mode>_maskz"
20318 [(match_operand:VI4_AVX512VL 0 "register_operand")
20319 (match_operand:VI4_AVX512VL 1 "register_operand")
20320 (match_operand:VI4_AVX512VL 2 "register_operand")
20321 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand")
20322 (match_operand:<avx512fmaskmode> 4 "register_operand")]
20323 "TARGET_AVX512VNNI"
20325 emit_insn (gen_vpdpbusds_<mode>_maskz_1 (
20326 operands[0], operands[1], operands[2], operands[3],
20327 CONST0_RTX (<MODE>mode), operands[4]));
20331 (define_insn "vpdpbusds_<mode>_maskz_1"
20332 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20333 (vec_merge:VI4_AVX512VL (unspec:VI4_AVX512VL
20334 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20335 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20336 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")
20337 ] UNSPEC_VPMADDUBSWACCSSD)
20338 (match_operand:VI4_AVX512VL 4 "const0_operand" "C")
20339 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk"))
20341 "TARGET_AVX512VNNI"
20342 "vpdpbusds\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
20343 [(set_attr ("prefix") ("evex"))])
20346 (define_insn "vpdpwssd_<mode>"
20347 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20348 (unspec:VI4_AVX512VL
20349 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20350 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20351 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")
20352 ] UNSPEC_VPMADDWDACCD))]
20353 "TARGET_AVX512VNNI"
20354 "vpdpwssd\t{%3, %2, %0|%0, %2, %3 }"
20355 [(set_attr ("prefix") ("evex"))])
20357 (define_insn "vpdpwssd_<mode>_mask"
20358 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20359 (vec_merge:VI4_AVX512VL (unspec:VI4_AVX512VL
20360 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20361 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20362 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")
20363 ] UNSPEC_VPMADDWDACCD)
20365 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk"))
20367 "TARGET_AVX512VNNI"
20368 "vpdpwssd\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
20369 [(set_attr ("prefix") ("evex"))])
20371 (define_expand "vpdpwssd_<mode>_maskz"
20372 [(match_operand:VI4_AVX512VL 0 "register_operand")
20373 (match_operand:VI4_AVX512VL 1 "register_operand")
20374 (match_operand:VI4_AVX512VL 2 "register_operand")
20375 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand")
20376 (match_operand:<avx512fmaskmode> 4 "register_operand")]
20377 "TARGET_AVX512VNNI"
20379 emit_insn (gen_vpdpwssd_<mode>_maskz_1 (
20380 operands[0], operands[1], operands[2], operands[3],
20381 CONST0_RTX (<MODE>mode), operands[4]));
20385 (define_insn "vpdpwssd_<mode>_maskz_1"
20386 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20387 (vec_merge:VI4_AVX512VL (unspec:VI4_AVX512VL
20388 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20389 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20390 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")
20391 ] UNSPEC_VPMADDWDACCD)
20392 (match_operand:VI4_AVX512VL 4 "const0_operand" "C")
20393 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk"))
20395 "TARGET_AVX512VNNI"
20396 "vpdpwssd\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
20397 [(set_attr ("prefix") ("evex"))])
20400 (define_insn "vpdpwssds_<mode>"
20401 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20402 (unspec:VI4_AVX512VL
20403 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20404 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20405 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")
20406 ] UNSPEC_VPMADDWDACCSSD))]
20407 "TARGET_AVX512VNNI"
20408 "vpdpwssds\t{%3, %2, %0|%0, %2, %3 }"
20409 [(set_attr ("prefix") ("evex"))])
20411 (define_insn "vpdpwssds_<mode>_mask"
20412 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20413 (vec_merge:VI4_AVX512VL (unspec:VI4_AVX512VL
20414 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20415 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20416 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")
20417 ] UNSPEC_VPMADDWDACCSSD)
20419 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk"))
20421 "TARGET_AVX512VNNI"
20422 "vpdpwssds\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
20423 [(set_attr ("prefix") ("evex"))])
20425 (define_expand "vpdpwssds_<mode>_maskz"
20426 [(match_operand:VI4_AVX512VL 0 "register_operand")
20427 (match_operand:VI4_AVX512VL 1 "register_operand")
20428 (match_operand:VI4_AVX512VL 2 "register_operand")
20429 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand")
20430 (match_operand:<avx512fmaskmode> 4 "register_operand")]
20431 "TARGET_AVX512VNNI"
20433 emit_insn (gen_vpdpwssds_<mode>_maskz_1 (
20434 operands[0], operands[1], operands[2], operands[3],
20435 CONST0_RTX (<MODE>mode), operands[4]));
20439 (define_insn "vpdpwssds_<mode>_maskz_1"
20440 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
20441 (vec_merge:VI4_AVX512VL (unspec:VI4_AVX512VL
20442 [(match_operand:VI4_AVX512VL 1 "register_operand" "0")
20443 (match_operand:VI4_AVX512VL 2 "register_operand" "v")
20444 (match_operand:VI4_AVX512VL 3 "nonimmediate_operand" "vm")
20445 ] UNSPEC_VPMADDWDACCSSD)
20446 (match_operand:VI4_AVX512VL 4 "const0_operand" "C")
20447 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk"))
20449 "TARGET_AVX512VNNI"
20450 "vpdpwssds\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
20451 [(set_attr ("prefix") ("evex"))])