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
163 (define_c_enum "unspecv" [
173 ;; All vector modes including V?TImode, used in move patterns.
174 (define_mode_iterator VMOVE
175 [(V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI
176 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX") V8HI
177 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
178 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI
179 (V4TI "TARGET_AVX512F") (V2TI "TARGET_AVX") V1TI
180 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
181 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") V2DF])
183 ;; All AVX-512{F,VL} vector modes. Supposed TARGET_AVX512F baseline.
184 (define_mode_iterator V48_AVX512VL
185 [V16SI (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")
186 V8DI (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")
187 V16SF (V8SF "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
188 V8DF (V4DF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
190 ;; 1,2 byte AVX-512{BW,VL} vector modes. Supposed TARGET_AVX512BW baseline.
191 (define_mode_iterator VI12_AVX512VL
192 [V64QI (V16QI "TARGET_AVX512VL") (V32QI "TARGET_AVX512VL")
193 V32HI (V16HI "TARGET_AVX512VL") (V8HI "TARGET_AVX512VL")])
195 (define_mode_iterator VI1_AVX512VL
196 [V64QI (V16QI "TARGET_AVX512VL") (V32QI "TARGET_AVX512VL")])
199 (define_mode_iterator V
200 [(V32QI "TARGET_AVX") V16QI
201 (V16HI "TARGET_AVX") V8HI
202 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
203 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI
204 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
205 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
207 ;; All 128bit vector modes
208 (define_mode_iterator V_128
209 [V16QI V8HI V4SI V2DI V4SF (V2DF "TARGET_SSE2")])
211 ;; All 256bit vector modes
212 (define_mode_iterator V_256
213 [V32QI V16HI V8SI V4DI V8SF V4DF])
215 ;; All 512bit vector modes
216 (define_mode_iterator V_512 [V64QI V32HI V16SI V8DI V16SF V8DF])
218 ;; All 256bit and 512bit vector modes
219 (define_mode_iterator V_256_512
220 [V32QI V16HI V8SI V4DI V8SF V4DF
221 (V64QI "TARGET_AVX512F") (V32HI "TARGET_AVX512F") (V16SI "TARGET_AVX512F")
222 (V8DI "TARGET_AVX512F") (V16SF "TARGET_AVX512F") (V8DF "TARGET_AVX512F")])
224 ;; All vector float modes
225 (define_mode_iterator VF
226 [(V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
227 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
229 ;; 128- and 256-bit float vector modes
230 (define_mode_iterator VF_128_256
231 [(V8SF "TARGET_AVX") V4SF
232 (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
234 ;; All SFmode vector float modes
235 (define_mode_iterator VF1
236 [(V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF])
238 ;; 128- and 256-bit SF vector modes
239 (define_mode_iterator VF1_128_256
240 [(V8SF "TARGET_AVX") V4SF])
242 (define_mode_iterator VF1_128_256VL
243 [V8SF (V4SF "TARGET_AVX512VL")])
245 ;; All DFmode vector float modes
246 (define_mode_iterator VF2
247 [(V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") V2DF])
249 ;; 128- and 256-bit DF vector modes
250 (define_mode_iterator VF2_128_256
251 [(V4DF "TARGET_AVX") V2DF])
253 (define_mode_iterator VF2_512_256
254 [(V8DF "TARGET_AVX512F") V4DF])
256 (define_mode_iterator VF2_512_256VL
257 [V8DF (V4DF "TARGET_AVX512VL")])
259 ;; All 128bit vector float modes
260 (define_mode_iterator VF_128
261 [V4SF (V2DF "TARGET_SSE2")])
263 ;; All 256bit vector float modes
264 (define_mode_iterator VF_256
267 ;; All 512bit vector float modes
268 (define_mode_iterator VF_512
271 (define_mode_iterator VI48_AVX512VL
272 [V16SI (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")
273 V8DI (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")])
275 (define_mode_iterator VF_AVX512VL
276 [V16SF (V8SF "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
277 V8DF (V4DF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
279 (define_mode_iterator VF2_AVX512VL
280 [V8DF (V4DF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
282 (define_mode_iterator VF1_AVX512VL
283 [V16SF (V8SF "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")])
285 ;; All vector integer modes
286 (define_mode_iterator VI
287 [(V16SI "TARGET_AVX512F") (V8DI "TARGET_AVX512F")
288 (V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX") V16QI
289 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX") V8HI
290 (V8SI "TARGET_AVX") V4SI
291 (V4DI "TARGET_AVX") V2DI])
293 (define_mode_iterator VI_AVX2
294 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI
295 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI
296 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX2") V4SI
297 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX2") V2DI])
299 ;; All QImode vector integer modes
300 (define_mode_iterator VI1
301 [(V32QI "TARGET_AVX") V16QI])
303 ;; All DImode vector integer modes
304 (define_mode_iterator V_AVX
305 [V16QI V8HI V4SI V2DI V4SF V2DF
306 (V32QI "TARGET_AVX") (V16HI "TARGET_AVX")
307 (V8SI "TARGET_AVX") (V4DI "TARGET_AVX")
308 (V8SF "TARGET_AVX") (V4DF"TARGET_AVX")])
310 (define_mode_iterator VI48_AVX
312 (V8SI "TARGET_AVX") (V4DI "TARGET_AVX")])
314 (define_mode_iterator VI8
315 [(V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI])
317 (define_mode_iterator VI8_AVX512VL
318 [V8DI (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")])
320 (define_mode_iterator VI8_256_512
321 [V8DI (V4DI "TARGET_AVX512VL")])
323 (define_mode_iterator VI1_AVX2
324 [(V32QI "TARGET_AVX2") V16QI])
326 (define_mode_iterator VI1_AVX512
327 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI])
329 (define_mode_iterator VI1_AVX512F
330 [(V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI])
332 (define_mode_iterator VI2_AVX2
333 [(V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI])
335 (define_mode_iterator VI2_AVX512F
336 [(V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX2") V8HI])
338 (define_mode_iterator VI4_AVX
339 [(V8SI "TARGET_AVX") V4SI])
341 (define_mode_iterator VI4_AVX2
342 [(V8SI "TARGET_AVX2") V4SI])
344 (define_mode_iterator VI4_AVX512F
345 [(V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX2") V4SI])
347 (define_mode_iterator VI4_AVX512VL
348 [V16SI (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")])
350 (define_mode_iterator VI48_AVX512F_AVX512VL
351 [V4SI V8SI (V16SI "TARGET_AVX512F")
352 (V2DI "TARGET_AVX512VL") (V4DI "TARGET_AVX512VL") (V8DI "TARGET_AVX512F")])
354 (define_mode_iterator VI2_AVX512VL
355 [(V8HI "TARGET_AVX512VL") (V16HI "TARGET_AVX512VL") V32HI])
357 (define_mode_iterator VI8_AVX2_AVX512BW
358 [(V8DI "TARGET_AVX512BW") (V4DI "TARGET_AVX2") V2DI])
360 (define_mode_iterator VI8_AVX2
361 [(V4DI "TARGET_AVX2") V2DI])
363 (define_mode_iterator VI8_AVX2_AVX512F
364 [(V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX2") V2DI])
366 (define_mode_iterator VI4_128_8_256
370 (define_mode_iterator V8FI
374 (define_mode_iterator V16FI
377 ;; ??? We should probably use TImode instead.
378 (define_mode_iterator VIMAX_AVX2_AVX512BW
379 [(V4TI "TARGET_AVX512BW") (V2TI "TARGET_AVX2") V1TI])
381 ;; Suppose TARGET_AVX512BW as baseline
382 (define_mode_iterator VIMAX_AVX512VL
383 [V4TI (V2TI "TARGET_AVX512VL") (V1TI "TARGET_AVX512VL")])
385 (define_mode_iterator VIMAX_AVX2
386 [(V2TI "TARGET_AVX2") V1TI])
388 ;; ??? This should probably be dropped in favor of VIMAX_AVX2_AVX512BW.
389 (define_mode_iterator SSESCALARMODE
390 [(V4TI "TARGET_AVX512BW") (V2TI "TARGET_AVX2") TI])
392 (define_mode_iterator VI12_AVX2
393 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI
394 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI])
396 (define_mode_iterator VI24_AVX2
397 [(V16HI "TARGET_AVX2") V8HI
398 (V8SI "TARGET_AVX2") V4SI])
400 (define_mode_iterator VI124_AVX2_24_AVX512F_1_AVX512BW
401 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI
402 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX2") V8HI
403 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX2") V4SI])
405 (define_mode_iterator VI124_AVX2
406 [(V32QI "TARGET_AVX2") V16QI
407 (V16HI "TARGET_AVX2") V8HI
408 (V8SI "TARGET_AVX2") V4SI])
410 (define_mode_iterator VI2_AVX2_AVX512BW
411 [(V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI])
413 (define_mode_iterator VI48_AVX2
414 [(V8SI "TARGET_AVX2") V4SI
415 (V4DI "TARGET_AVX2") V2DI])
417 (define_mode_iterator VI248_AVX2
418 [(V16HI "TARGET_AVX2") V8HI
419 (V8SI "TARGET_AVX2") V4SI
420 (V4DI "TARGET_AVX2") V2DI])
422 (define_mode_iterator VI248_AVX2_8_AVX512F_24_AVX512BW
423 [(V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI
424 (V16SI "TARGET_AVX512BW") (V8SI "TARGET_AVX2") V4SI
425 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX2") V2DI])
427 (define_mode_iterator VI248_AVX512BW
428 [(V32HI "TARGET_AVX512BW") V16SI V8DI])
430 (define_mode_iterator VI248_AVX512BW_AVX512VL
431 [(V32HI "TARGET_AVX512BW")
432 (V4DI "TARGET_AVX512VL") V16SI V8DI])
434 ;; Suppose TARGET_AVX512VL as baseline
435 (define_mode_iterator VI248_AVX512BW_1
436 [(V16HI "TARGET_AVX512BW") (V8HI "TARGET_AVX512BW")
440 (define_mode_iterator VI248_AVX512BW_2
441 [(V16HI "TARGET_AVX512BW") (V8HI "TARGET_AVX512BW")
445 (define_mode_iterator VI48_AVX512F
446 [(V16SI "TARGET_AVX512F") V8SI V4SI
447 (V8DI "TARGET_AVX512F") V4DI V2DI])
449 (define_mode_iterator VI48_AVX_AVX512F
450 [(V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
451 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI])
453 (define_mode_iterator VI12_AVX_AVX512F
454 [ (V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI
455 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX") V8HI])
457 (define_mode_iterator V48_AVX2
460 (V4SI "TARGET_AVX2") (V2DI "TARGET_AVX2")
461 (V8SI "TARGET_AVX2") (V4DI "TARGET_AVX2")])
463 (define_mode_attr avx512
464 [(V16QI "avx512vl") (V32QI "avx512vl") (V64QI "avx512bw")
465 (V8HI "avx512vl") (V16HI "avx512vl") (V32HI "avx512bw")
466 (V4SI "avx512vl") (V8SI "avx512vl") (V16SI "avx512f")
467 (V2DI "avx512vl") (V4DI "avx512vl") (V8DI "avx512f")
468 (V4SF "avx512vl") (V8SF "avx512vl") (V16SF "avx512f")
469 (V2DF "avx512vl") (V4DF "avx512vl") (V8DF "avx512f")])
471 (define_mode_attr sse2_avx_avx512f
472 [(V16QI "sse2") (V32QI "avx") (V64QI "avx512f")
473 (V8HI "avx512vl") (V16HI "avx512vl") (V32HI "avx512bw")
474 (V4SI "sse2") (V8SI "avx") (V16SI "avx512f")
475 (V2DI "avx512vl") (V4DI "avx512vl") (V8DI "avx512f")
476 (V16SF "avx512f") (V8SF "avx") (V4SF "avx")
477 (V8DF "avx512f") (V4DF "avx") (V2DF "avx")])
479 (define_mode_attr sse2_avx2
480 [(V16QI "sse2") (V32QI "avx2") (V64QI "avx512bw")
481 (V8HI "sse2") (V16HI "avx2") (V32HI "avx512bw")
482 (V4SI "sse2") (V8SI "avx2") (V16SI "avx512f")
483 (V2DI "sse2") (V4DI "avx2") (V8DI "avx512f")
484 (V1TI "sse2") (V2TI "avx2") (V4TI "avx512bw")])
486 (define_mode_attr ssse3_avx2
487 [(V16QI "ssse3") (V32QI "avx2") (V64QI "avx512bw")
488 (V4HI "ssse3") (V8HI "ssse3") (V16HI "avx2") (V32HI "avx512bw")
489 (V4SI "ssse3") (V8SI "avx2")
490 (V2DI "ssse3") (V4DI "avx2")
491 (TI "ssse3") (V2TI "avx2") (V4TI "avx512bw")])
493 (define_mode_attr sse4_1_avx2
494 [(V16QI "sse4_1") (V32QI "avx2") (V64QI "avx512bw")
495 (V8HI "sse4_1") (V16HI "avx2") (V32HI "avx512bw")
496 (V4SI "sse4_1") (V8SI "avx2") (V16SI "avx512f")
497 (V2DI "sse4_1") (V4DI "avx2") (V8DI "avx512dq")])
499 (define_mode_attr avx_avx2
500 [(V4SF "avx") (V2DF "avx")
501 (V8SF "avx") (V4DF "avx")
502 (V4SI "avx2") (V2DI "avx2")
503 (V8SI "avx2") (V4DI "avx2")])
505 (define_mode_attr vec_avx2
506 [(V16QI "vec") (V32QI "avx2")
507 (V8HI "vec") (V16HI "avx2")
508 (V4SI "vec") (V8SI "avx2")
509 (V2DI "vec") (V4DI "avx2")])
511 (define_mode_attr avx2_avx512
512 [(V4SI "avx2") (V8SI "avx2") (V16SI "avx512f")
513 (V2DI "avx2") (V4DI "avx2") (V8DI "avx512f")
514 (V4SF "avx2") (V8SF "avx2") (V16SF "avx512f")
515 (V2DF "avx2") (V4DF "avx2") (V8DF "avx512f")
516 (V8HI "avx512vl") (V16HI "avx512vl") (V32HI "avx512bw")])
518 (define_mode_attr shuffletype
519 [(V16SF "f") (V16SI "i") (V8DF "f") (V8DI "i")
520 (V8SF "f") (V8SI "i") (V4DF "f") (V4DI "i")
521 (V4SF "f") (V4SI "i") (V2DF "f") (V2DI "i")
522 (V32HI "i") (V16HI "i") (V8HI "i")
523 (V64QI "i") (V32QI "i") (V16QI "i")
524 (V4TI "i") (V2TI "i") (V1TI "i")])
526 (define_mode_attr ssequartermode
527 [(V16SF "V4SF") (V8DF "V2DF") (V16SI "V4SI") (V8DI "V2DI")])
529 (define_mode_attr ssedoublemodelower
530 [(V16QI "v16hi") (V32QI "v32hi") (V64QI "v64hi")
531 (V8HI "v8si") (V16HI "v16si") (V32HI "v32si")
532 (V4SI "v4di") (V8SI "v8di") (V16SI "v16di")])
534 (define_mode_attr ssedoublemode
535 [(V4SF "V8SF") (V8SF "V16SF") (V16SF "V32SF")
536 (V2DF "V4DF") (V4DF "V8DF") (V8DF "V16DF")
537 (V16QI "V16HI") (V32QI "V32HI") (V64QI "V64HI")
538 (V4HI "V4SI") (V8HI "V8SI") (V16HI "V16SI") (V32HI "V32SI")
539 (V4SI "V4DI") (V8SI "V16SI") (V16SI "V32SI")
540 (V4DI "V8DI") (V8DI "V16DI")])
542 (define_mode_attr ssebytemode
543 [(V8DI "V64QI") (V4DI "V32QI") (V2DI "V16QI")])
545 ;; All 128bit vector integer modes
546 (define_mode_iterator VI_128 [V16QI V8HI V4SI V2DI])
548 ;; All 256bit vector integer modes
549 (define_mode_iterator VI_256 [V32QI V16HI V8SI V4DI])
551 ;; Various 128bit vector integer mode combinations
552 (define_mode_iterator VI12_128 [V16QI V8HI])
553 (define_mode_iterator VI14_128 [V16QI V4SI])
554 (define_mode_iterator VI124_128 [V16QI V8HI V4SI])
555 (define_mode_iterator VI24_128 [V8HI V4SI])
556 (define_mode_iterator VI248_128 [V8HI V4SI V2DI])
557 (define_mode_iterator VI48_128 [V4SI V2DI])
559 ;; Various 256bit and 512 vector integer mode combinations
560 (define_mode_iterator VI124_256 [V32QI V16HI V8SI])
561 (define_mode_iterator VI124_256_AVX512F_AVX512BW
563 (V64QI "TARGET_AVX512BW")
564 (V32HI "TARGET_AVX512BW")
565 (V16SI "TARGET_AVX512F")])
566 (define_mode_iterator VI48_256 [V8SI V4DI])
567 (define_mode_iterator VI48_512 [V16SI V8DI])
568 (define_mode_iterator VI4_256_8_512 [V8SI V8DI])
569 (define_mode_iterator VI_AVX512BW
570 [V16SI V8DI (V32HI "TARGET_AVX512BW") (V64QI "TARGET_AVX512BW")])
572 ;; Int-float size matches
573 (define_mode_iterator VI4F_128 [V4SI V4SF])
574 (define_mode_iterator VI8F_128 [V2DI V2DF])
575 (define_mode_iterator VI4F_256 [V8SI V8SF])
576 (define_mode_iterator VI8F_256 [V4DI V4DF])
577 (define_mode_iterator VI48F_256_512
579 (V16SI "TARGET_AVX512F") (V16SF "TARGET_AVX512F")
580 (V8DI "TARGET_AVX512F") (V8DF "TARGET_AVX512F")
581 (V4DI "TARGET_AVX512VL") (V4DF "TARGET_AVX512VL")])
582 (define_mode_iterator VF48_I1248
583 [V16SI V16SF V8DI V8DF V32HI V64QI])
584 (define_mode_iterator VI48F
585 [V16SI V16SF V8DI V8DF
586 (V8SI "TARGET_AVX512VL") (V8SF "TARGET_AVX512VL")
587 (V4DI "TARGET_AVX512VL") (V4DF "TARGET_AVX512VL")
588 (V4SI "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
589 (V2DI "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
590 (define_mode_iterator VI48F_256 [V8SI V8SF V4DI V4DF])
592 ;; Mapping from float mode to required SSE level
593 (define_mode_attr sse
594 [(SF "sse") (DF "sse2")
595 (V4SF "sse") (V2DF "sse2")
596 (V16SF "avx512f") (V8SF "avx")
597 (V8DF "avx512f") (V4DF "avx")])
599 (define_mode_attr sse2
600 [(V16QI "sse2") (V32QI "avx") (V64QI "avx512f")
601 (V2DI "sse2") (V4DI "avx") (V8DI "avx512f")])
603 (define_mode_attr sse3
604 [(V16QI "sse3") (V32QI "avx")])
606 (define_mode_attr sse4_1
607 [(V4SF "sse4_1") (V2DF "sse4_1")
608 (V8SF "avx") (V4DF "avx")
610 (V4DI "avx") (V2DI "sse4_1")
611 (V8SI "avx") (V4SI "sse4_1")
612 (V16QI "sse4_1") (V32QI "avx")
613 (V8HI "sse4_1") (V16HI "avx")])
615 (define_mode_attr avxsizesuffix
616 [(V64QI "512") (V32HI "512") (V16SI "512") (V8DI "512")
617 (V32QI "256") (V16HI "256") (V8SI "256") (V4DI "256")
618 (V16QI "") (V8HI "") (V4SI "") (V2DI "")
619 (V16SF "512") (V8DF "512")
620 (V8SF "256") (V4DF "256")
621 (V4SF "") (V2DF "")])
623 ;; SSE instruction mode
624 (define_mode_attr sseinsnmode
625 [(V64QI "XI") (V32HI "XI") (V16SI "XI") (V8DI "XI") (V4TI "XI")
626 (V32QI "OI") (V16HI "OI") (V8SI "OI") (V4DI "OI") (V2TI "OI")
627 (V16QI "TI") (V8HI "TI") (V4SI "TI") (V2DI "TI") (V1TI "TI")
628 (V16SF "V16SF") (V8DF "V8DF")
629 (V8SF "V8SF") (V4DF "V4DF")
630 (V4SF "V4SF") (V2DF "V2DF")
633 ;; Mapping of vector modes to corresponding mask size
634 (define_mode_attr avx512fmaskmode
635 [(V64QI "DI") (V32QI "SI") (V16QI "HI")
636 (V32HI "SI") (V16HI "HI") (V8HI "QI") (V4HI "QI")
637 (V16SI "HI") (V8SI "QI") (V4SI "QI")
638 (V8DI "QI") (V4DI "QI") (V2DI "QI")
639 (V16SF "HI") (V8SF "QI") (V4SF "QI")
640 (V8DF "QI") (V4DF "QI") (V2DF "QI")])
642 ;; Mapping of vector modes to corresponding mask size
643 (define_mode_attr avx512fmaskmodelower
644 [(V64QI "di") (V32QI "si") (V16QI "hi")
645 (V32HI "si") (V16HI "hi") (V8HI "qi") (V4HI "qi")
646 (V16SI "hi") (V8SI "qi") (V4SI "qi")
647 (V8DI "qi") (V4DI "qi") (V2DI "qi")
648 (V16SF "hi") (V8SF "qi") (V4SF "qi")
649 (V8DF "qi") (V4DF "qi") (V2DF "qi")])
651 ;; Mapping of vector float modes to an integer mode of the same size
652 (define_mode_attr sseintvecmode
653 [(V16SF "V16SI") (V8DF "V8DI")
654 (V8SF "V8SI") (V4DF "V4DI")
655 (V4SF "V4SI") (V2DF "V2DI")
656 (V16SI "V16SI") (V8DI "V8DI")
657 (V8SI "V8SI") (V4DI "V4DI")
658 (V4SI "V4SI") (V2DI "V2DI")
659 (V16HI "V16HI") (V8HI "V8HI")
660 (V32HI "V32HI") (V64QI "V64QI")
661 (V32QI "V32QI") (V16QI "V16QI")])
663 (define_mode_attr sseintvecmode2
664 [(V8DF "XI") (V4DF "OI") (V2DF "TI")
665 (V8SF "OI") (V4SF "TI")])
667 (define_mode_attr sseintvecmodelower
668 [(V16SF "v16si") (V8DF "v8di")
669 (V8SF "v8si") (V4DF "v4di")
670 (V4SF "v4si") (V2DF "v2di")
671 (V8SI "v8si") (V4DI "v4di")
672 (V4SI "v4si") (V2DI "v2di")
673 (V16HI "v16hi") (V8HI "v8hi")
674 (V32QI "v32qi") (V16QI "v16qi")])
676 ;; Mapping of vector modes to a vector mode of double size
677 (define_mode_attr ssedoublevecmode
678 [(V32QI "V64QI") (V16HI "V32HI") (V8SI "V16SI") (V4DI "V8DI")
679 (V16QI "V32QI") (V8HI "V16HI") (V4SI "V8SI") (V2DI "V4DI")
680 (V8SF "V16SF") (V4DF "V8DF")
681 (V4SF "V8SF") (V2DF "V4DF")])
683 ;; Mapping of vector modes to a vector mode of half size
684 (define_mode_attr ssehalfvecmode
685 [(V64QI "V32QI") (V32HI "V16HI") (V16SI "V8SI") (V8DI "V4DI") (V4TI "V2TI")
686 (V32QI "V16QI") (V16HI "V8HI") (V8SI "V4SI") (V4DI "V2DI")
687 (V16QI "V8QI") (V8HI "V4HI") (V4SI "V2SI")
688 (V16SF "V8SF") (V8DF "V4DF")
689 (V8SF "V4SF") (V4DF "V2DF")
692 (define_mode_attr ssehalfvecmodelower
693 [(V64QI "v32qi") (V32HI "v16hi") (V16SI "v8si") (V8DI "v4di") (V4TI "v2ti")
694 (V32QI "v16qi") (V16HI "v8hi") (V8SI "v4si") (V4DI "v2di")
695 (V16QI "v8qi") (V8HI "v4hi") (V4SI "v2si")
696 (V16SF "v8sf") (V8DF "v4df")
697 (V8SF "v4sf") (V4DF "v2df")
700 ;; Mapping of vector modes ti packed single mode of the same size
701 (define_mode_attr ssePSmode
702 [(V16SI "V16SF") (V8DF "V16SF")
703 (V16SF "V16SF") (V8DI "V16SF")
704 (V64QI "V16SF") (V32QI "V8SF") (V16QI "V4SF")
705 (V32HI "V16SF") (V16HI "V8SF") (V8HI "V4SF")
706 (V8SI "V8SF") (V4SI "V4SF")
707 (V4DI "V8SF") (V2DI "V4SF")
708 (V4TI "V16SF") (V2TI "V8SF") (V1TI "V4SF")
709 (V8SF "V8SF") (V4SF "V4SF")
710 (V4DF "V8SF") (V2DF "V4SF")])
712 (define_mode_attr ssePSmode2
713 [(V8DI "V8SF") (V4DI "V4SF")])
715 ;; Mapping of vector modes back to the scalar modes
716 (define_mode_attr ssescalarmode
717 [(V64QI "QI") (V32QI "QI") (V16QI "QI")
718 (V32HI "HI") (V16HI "HI") (V8HI "HI")
719 (V16SI "SI") (V8SI "SI") (V4SI "SI")
720 (V8DI "DI") (V4DI "DI") (V2DI "DI")
721 (V16SF "SF") (V8SF "SF") (V4SF "SF")
722 (V8DF "DF") (V4DF "DF") (V2DF "DF")
723 (V4TI "TI") (V2TI "TI")])
725 ;; Mapping of vector modes back to the scalar modes
726 (define_mode_attr ssescalarmodelower
727 [(V64QI "qi") (V32QI "qi") (V16QI "qi")
728 (V32HI "hi") (V16HI "hi") (V8HI "hi")
729 (V16SI "si") (V8SI "si") (V4SI "si")
730 (V8DI "di") (V4DI "di") (V2DI "di")
731 (V16SF "sf") (V8SF "sf") (V4SF "sf")
732 (V8DF "df") (V4DF "df") (V2DF "df")
733 (V4TI "ti") (V2TI "ti")])
735 ;; Mapping of vector modes to the 128bit modes
736 (define_mode_attr ssexmmmode
737 [(V64QI "V16QI") (V32QI "V16QI") (V16QI "V16QI")
738 (V32HI "V8HI") (V16HI "V8HI") (V8HI "V8HI")
739 (V16SI "V4SI") (V8SI "V4SI") (V4SI "V4SI")
740 (V8DI "V2DI") (V4DI "V2DI") (V2DI "V2DI")
741 (V16SF "V4SF") (V8SF "V4SF") (V4SF "V4SF")
742 (V8DF "V2DF") (V4DF "V2DF") (V2DF "V2DF")])
744 ;; Pointer size override for scalar modes (Intel asm dialect)
745 (define_mode_attr iptr
746 [(V64QI "b") (V32HI "w") (V16SI "k") (V8DI "q")
747 (V32QI "b") (V16HI "w") (V8SI "k") (V4DI "q")
748 (V16QI "b") (V8HI "w") (V4SI "k") (V2DI "q")
749 (V8SF "k") (V4DF "q")
750 (V4SF "k") (V2DF "q")
753 ;; Number of scalar elements in each vector type
754 (define_mode_attr ssescalarnum
755 [(V64QI "64") (V16SI "16") (V8DI "8")
756 (V32QI "32") (V16HI "16") (V8SI "8") (V4DI "4")
757 (V16QI "16") (V8HI "8") (V4SI "4") (V2DI "2")
758 (V16SF "16") (V8DF "8")
759 (V8SF "8") (V4DF "4")
760 (V4SF "4") (V2DF "2")])
762 ;; Mask of scalar elements in each vector type
763 (define_mode_attr ssescalarnummask
764 [(V32QI "31") (V16HI "15") (V8SI "7") (V4DI "3")
765 (V16QI "15") (V8HI "7") (V4SI "3") (V2DI "1")
766 (V8SF "7") (V4DF "3")
767 (V4SF "3") (V2DF "1")])
769 (define_mode_attr ssescalarsize
770 [(V4TI "64") (V2TI "64") (V1TI "64")
771 (V8DI "64") (V4DI "64") (V2DI "64")
772 (V64QI "8") (V32QI "8") (V16QI "8")
773 (V32HI "16") (V16HI "16") (V8HI "16")
774 (V16SI "32") (V8SI "32") (V4SI "32")
775 (V16SF "32") (V8SF "32") (V4SF "32")
776 (V8DF "64") (V4DF "64") (V2DF "64")])
778 ;; SSE prefix for integer vector modes
779 (define_mode_attr sseintprefix
780 [(V2DI "p") (V2DF "")
785 (V16SI "p") (V16SF "")
786 (V16QI "p") (V8HI "p")
787 (V32QI "p") (V16HI "p")
788 (V64QI "p") (V32HI "p")])
790 ;; SSE scalar suffix for vector modes
791 (define_mode_attr ssescalarmodesuffix
793 (V8SF "ss") (V4DF "sd")
794 (V4SF "ss") (V2DF "sd")
795 (V8SI "ss") (V4DI "sd")
798 ;; Pack/unpack vector modes
799 (define_mode_attr sseunpackmode
800 [(V16QI "V8HI") (V8HI "V4SI") (V4SI "V2DI")
801 (V32QI "V16HI") (V16HI "V8SI") (V8SI "V4DI")
802 (V32HI "V16SI") (V64QI "V32HI") (V16SI "V8DI")])
804 (define_mode_attr ssepackmode
805 [(V8HI "V16QI") (V4SI "V8HI") (V2DI "V4SI")
806 (V16HI "V32QI") (V8SI "V16HI") (V4DI "V8SI")
807 (V32HI "V64QI") (V16SI "V32HI") (V8DI "V16SI")])
809 ;; Mapping of the max integer size for xop rotate immediate constraint
810 (define_mode_attr sserotatemax
811 [(V16QI "7") (V8HI "15") (V4SI "31") (V2DI "63")])
813 ;; Mapping of mode to cast intrinsic name
814 (define_mode_attr castmode
815 [(V8SI "si") (V8SF "ps") (V4DF "pd")
816 (V16SI "si") (V16SF "ps") (V8DF "pd")])
818 ;; Instruction suffix for sign and zero extensions.
819 (define_code_attr extsuffix [(sign_extend "sx") (zero_extend "zx")])
821 ;; i128 for integer vectors and TARGET_AVX2, f128 otherwise.
822 ;; i64x4 or f64x4 for 512bit modes.
823 (define_mode_attr i128
824 [(V16SF "f64x4") (V8SF "f128") (V8DF "f64x4") (V4DF "f128")
825 (V64QI "i64x4") (V32QI "%~128") (V32HI "i64x4") (V16HI "%~128")
826 (V16SI "i64x4") (V8SI "%~128") (V8DI "i64x4") (V4DI "%~128")])
828 ;; For 256-bit modes for TARGET_AVX512VL && TARGET_AVX512DQ
829 ;; i32x4, f32x4, i64x2 or f64x2 suffixes.
830 (define_mode_attr i128vldq
831 [(V8SF "f32x4") (V4DF "f64x2")
832 (V32QI "i32x4") (V16HI "i32x4") (V8SI "i32x4") (V4DI "i64x2")])
835 (define_mode_iterator AVX256MODE2P [V8SI V8SF V4DF])
836 (define_mode_iterator AVX512MODE2P [V16SI V16SF V8DF])
838 ;; Mapping for dbpsabbw modes
839 (define_mode_attr dbpsadbwmode
840 [(V32HI "V64QI") (V16HI "V32QI") (V8HI "V16QI")])
842 ;; Mapping suffixes for broadcast
843 (define_mode_attr bcstscalarsuff
844 [(V64QI "b") (V32QI "b") (V16QI "b")
845 (V32HI "w") (V16HI "w") (V8HI "w")
846 (V16SI "d") (V8SI "d") (V4SI "d")
847 (V8DI "q") (V4DI "q") (V2DI "q")
848 (V16SF "ss") (V8SF "ss") (V4SF "ss")
849 (V8DF "sd") (V4DF "sd") (V2DF "sd")])
851 ;; Tie mode of assembler operand to mode iterator
852 (define_mode_attr concat_tg_mode
853 [(V32QI "t") (V16HI "t") (V8SI "t") (V4DI "t") (V8SF "t") (V4DF "t")
854 (V64QI "g") (V32HI "g") (V16SI "g") (V8DI "g") (V16SF "g") (V8DF "g")])
856 ;; Tie mode of assembler operand to mode iterator
857 (define_mode_attr xtg_mode
858 [(V16QI "x") (V8HI "x") (V4SI "x") (V2DI "x") (V4SF "x") (V2DF "x")
859 (V32QI "t") (V16HI "t") (V8SI "t") (V4DI "t") (V8SF "t") (V4DF "t")
860 (V64QI "g") (V32HI "g") (V16SI "g") (V8DI "g") (V16SF "g") (V8DF "g")])
862 ;; Half mask mode for unpacks
863 (define_mode_attr HALFMASKMODE
864 [(DI "SI") (SI "HI")])
866 ;; Double mask mode for packs
867 (define_mode_attr DOUBLEMASKMODE
868 [(HI "SI") (SI "DI")])
871 ;; Include define_subst patterns for instructions with mask
874 ;; Patterns whose name begins with "sse{,2,3}_" are invoked by intrinsics.
876 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
880 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
882 ;; All of these patterns are enabled for SSE1 as well as SSE2.
883 ;; This is essential for maintaining stable calling conventions.
885 (define_expand "mov<mode>"
886 [(set (match_operand:VMOVE 0 "nonimmediate_operand")
887 (match_operand:VMOVE 1 "nonimmediate_operand"))]
890 ix86_expand_vector_move (<MODE>mode, operands);
894 (define_insn "mov<mode>_internal"
895 [(set (match_operand:VMOVE 0 "nonimmediate_operand"
897 (match_operand:VMOVE 1 "nonimmediate_or_sse_const_operand"
900 && (register_operand (operands[0], <MODE>mode)
901 || register_operand (operands[1], <MODE>mode))"
903 switch (get_attr_type (insn))
906 return standard_sse_constant_opcode (insn, operands[1]);
909 /* There is no evex-encoded vmov* for sizes smaller than 64-bytes
910 in avx512f, so we need to use workarounds, to access sse registers
911 16-31, which are evex-only. In avx512vl we don't need workarounds. */
912 if (TARGET_AVX512F && <MODE_SIZE> < 64 && !TARGET_AVX512VL
913 && (EXT_REX_SSE_REG_P (operands[0])
914 || EXT_REX_SSE_REG_P (operands[1])))
916 if (memory_operand (operands[0], <MODE>mode))
918 if (<MODE_SIZE> == 32)
919 return "vextract<shuffletype>64x4\t{$0x0, %g1, %0|%0, %g1, 0x0}";
920 else if (<MODE_SIZE> == 16)
921 return "vextract<shuffletype>32x4\t{$0x0, %g1, %0|%0, %g1, 0x0}";
925 else if (memory_operand (operands[1], <MODE>mode))
927 if (<MODE_SIZE> == 32)
928 return "vbroadcast<shuffletype>64x4\t{%1, %g0|%g0, %1}";
929 else if (<MODE_SIZE> == 16)
930 return "vbroadcast<shuffletype>32x4\t{%1, %g0|%g0, %1}";
935 /* Reg -> reg move is always aligned. Just use wider move. */
936 switch (get_attr_mode (insn))
940 return "vmovaps\t{%g1, %g0|%g0, %g1}";
943 return "vmovapd\t{%g1, %g0|%g0, %g1}";
946 return "vmovdqa64\t{%g1, %g0|%g0, %g1}";
952 switch (get_attr_mode (insn))
957 if (misaligned_operand (operands[0], <MODE>mode)
958 || misaligned_operand (operands[1], <MODE>mode))
959 return "%vmovups\t{%1, %0|%0, %1}";
961 return "%vmovaps\t{%1, %0|%0, %1}";
966 if (misaligned_operand (operands[0], <MODE>mode)
967 || misaligned_operand (operands[1], <MODE>mode))
968 return "%vmovupd\t{%1, %0|%0, %1}";
970 return "%vmovapd\t{%1, %0|%0, %1}";
974 if (misaligned_operand (operands[0], <MODE>mode)
975 || misaligned_operand (operands[1], <MODE>mode))
976 return TARGET_AVX512VL ? "vmovdqu<ssescalarsize>\t{%1, %0|%0, %1}"
977 : "%vmovdqu\t{%1, %0|%0, %1}";
979 return TARGET_AVX512VL ? "vmovdqa64\t{%1, %0|%0, %1}"
980 : "%vmovdqa\t{%1, %0|%0, %1}";
982 if (misaligned_operand (operands[0], <MODE>mode)
983 || misaligned_operand (operands[1], <MODE>mode))
984 return (<MODE>mode == V16SImode
985 || <MODE>mode == V8DImode
987 ? "vmovdqu<ssescalarsize>\t{%1, %0|%0, %1}"
988 : "vmovdqu64\t{%1, %0|%0, %1}";
990 return "vmovdqa64\t{%1, %0|%0, %1}";
1000 [(set_attr "type" "sselog1,sselog1,ssemov,ssemov")
1001 (set_attr "prefix" "maybe_vex")
1003 (cond [(and (eq_attr "alternative" "1")
1004 (match_test "TARGET_AVX512VL"))
1005 (const_string "<sseinsnmode>")
1006 (and (match_test "<MODE_SIZE> == 16")
1007 (ior (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
1008 (and (eq_attr "alternative" "3")
1009 (match_test "TARGET_SSE_TYPELESS_STORES"))))
1010 (const_string "<ssePSmode>")
1011 (match_test "TARGET_AVX")
1012 (const_string "<sseinsnmode>")
1013 (ior (not (match_test "TARGET_SSE2"))
1014 (match_test "optimize_function_for_size_p (cfun)"))
1015 (const_string "V4SF")
1016 (and (eq_attr "alternative" "0")
1017 (match_test "TARGET_SSE_LOAD0_BY_PXOR"))
1020 (const_string "<sseinsnmode>")))
1021 (set (attr "enabled")
1022 (cond [(and (match_test "<MODE_SIZE> == 16")
1023 (eq_attr "alternative" "1"))
1024 (symbol_ref "TARGET_SSE2")
1025 (and (match_test "<MODE_SIZE> == 32")
1026 (eq_attr "alternative" "1"))
1027 (symbol_ref "TARGET_AVX2")
1029 (symbol_ref "true")))])
1031 (define_insn "<avx512>_load<mode>_mask"
1032 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v,v")
1033 (vec_merge:V48_AVX512VL
1034 (match_operand:V48_AVX512VL 1 "nonimmediate_operand" "v,m")
1035 (match_operand:V48_AVX512VL 2 "vector_move_operand" "0C,0C")
1036 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
1039 if (FLOAT_MODE_P (GET_MODE_INNER (<MODE>mode)))
1041 if (misaligned_operand (operands[1], <MODE>mode))
1042 return "vmovu<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
1044 return "vmova<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
1048 if (misaligned_operand (operands[1], <MODE>mode))
1049 return "vmovdqu<ssescalarsize>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
1051 return "vmovdqa<ssescalarsize>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
1054 [(set_attr "type" "ssemov")
1055 (set_attr "prefix" "evex")
1056 (set_attr "memory" "none,load")
1057 (set_attr "mode" "<sseinsnmode>")])
1059 (define_insn "<avx512>_load<mode>_mask"
1060 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v,v")
1061 (vec_merge:VI12_AVX512VL
1062 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "v,m")
1063 (match_operand:VI12_AVX512VL 2 "vector_move_operand" "0C,0C")
1064 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
1066 "vmovdqu<ssescalarsize>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
1067 [(set_attr "type" "ssemov")
1068 (set_attr "prefix" "evex")
1069 (set_attr "memory" "none,load")
1070 (set_attr "mode" "<sseinsnmode>")])
1072 (define_insn "<avx512>_blendm<mode>"
1073 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v")
1074 (vec_merge:V48_AVX512VL
1075 (match_operand:V48_AVX512VL 2 "nonimmediate_operand" "vm")
1076 (match_operand:V48_AVX512VL 1 "register_operand" "v")
1077 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
1079 "vblendm<ssemodesuffix>\t{%2, %1, %0%{%3%}|%0%{%3%}, %1, %2}"
1080 [(set_attr "type" "ssemov")
1081 (set_attr "prefix" "evex")
1082 (set_attr "mode" "<sseinsnmode>")])
1084 (define_insn "<avx512>_blendm<mode>"
1085 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
1086 (vec_merge:VI12_AVX512VL
1087 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")
1088 (match_operand:VI12_AVX512VL 1 "register_operand" "v")
1089 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
1091 "vpblendm<ssemodesuffix>\t{%2, %1, %0%{%3%}|%0%{%3%}, %1, %2}"
1092 [(set_attr "type" "ssemov")
1093 (set_attr "prefix" "evex")
1094 (set_attr "mode" "<sseinsnmode>")])
1096 (define_insn "<avx512>_store<mode>_mask"
1097 [(set (match_operand:V48_AVX512VL 0 "memory_operand" "=m")
1098 (vec_merge:V48_AVX512VL
1099 (match_operand:V48_AVX512VL 1 "register_operand" "v")
1101 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")))]
1104 if (FLOAT_MODE_P (GET_MODE_INNER (<MODE>mode)))
1106 if (misaligned_operand (operands[0], <MODE>mode))
1107 return "vmovu<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1109 return "vmova<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1113 if (misaligned_operand (operands[0], <MODE>mode))
1114 return "vmovdqu<ssescalarsize>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1116 return "vmovdqa<ssescalarsize>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1119 [(set_attr "type" "ssemov")
1120 (set_attr "prefix" "evex")
1121 (set_attr "memory" "store")
1122 (set_attr "mode" "<sseinsnmode>")])
1124 (define_insn "<avx512>_store<mode>_mask"
1125 [(set (match_operand:VI12_AVX512VL 0 "memory_operand" "=m")
1126 (vec_merge:VI12_AVX512VL
1127 (match_operand:VI12_AVX512VL 1 "register_operand" "v")
1129 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")))]
1131 "vmovdqu<ssescalarsize>\t{%1, %0%{%2%}|%0%{%2%}, %1}"
1132 [(set_attr "type" "ssemov")
1133 (set_attr "prefix" "evex")
1134 (set_attr "memory" "store")
1135 (set_attr "mode" "<sseinsnmode>")])
1137 (define_insn "sse2_movq128"
1138 [(set (match_operand:V2DI 0 "register_operand" "=v")
1141 (match_operand:V2DI 1 "nonimmediate_operand" "vm")
1142 (parallel [(const_int 0)]))
1145 "%vmovq\t{%1, %0|%0, %q1}"
1146 [(set_attr "type" "ssemov")
1147 (set_attr "prefix" "maybe_vex")
1148 (set_attr "mode" "TI")])
1150 ;; Move a DI from a 32-bit register pair (e.g. %edx:%eax) to an xmm.
1151 ;; We'd rather avoid this entirely; if the 32-bit reg pair was loaded
1152 ;; from memory, we'd prefer to load the memory directly into the %xmm
1153 ;; register. To facilitate this happy circumstance, this pattern won't
1154 ;; split until after register allocation. If the 64-bit value didn't
1155 ;; come from memory, this is the best we can do. This is much better
1156 ;; than storing %edx:%eax into a stack temporary and loading an %xmm
1159 (define_insn_and_split "movdi_to_sse"
1161 [(set (match_operand:V4SI 0 "register_operand" "=?x,x")
1162 (subreg:V4SI (match_operand:DI 1 "nonimmediate_operand" "r,m") 0))
1163 (clobber (match_scratch:V4SI 2 "=&x,X"))])]
1164 "!TARGET_64BIT && TARGET_SSE2 && TARGET_INTER_UNIT_MOVES_TO_VEC"
1166 "&& reload_completed"
1169 if (register_operand (operands[1], DImode))
1171 /* The DImode arrived in a pair of integral registers (e.g. %edx:%eax).
1172 Assemble the 64-bit DImode value in an xmm register. */
1173 emit_insn (gen_sse2_loadld (operands[0], CONST0_RTX (V4SImode),
1174 gen_lowpart (SImode, operands[1])));
1175 emit_insn (gen_sse2_loadld (operands[2], CONST0_RTX (V4SImode),
1176 gen_highpart (SImode, operands[1])));
1177 emit_insn (gen_vec_interleave_lowv4si (operands[0], operands[0],
1180 else if (memory_operand (operands[1], DImode))
1182 rtx tmp = gen_reg_rtx (V2DImode);
1183 emit_insn (gen_vec_concatv2di (tmp, operands[1], const0_rtx));
1184 emit_move_insn (operands[0], gen_lowpart (V4SImode, tmp));
1192 [(set (match_operand:V4SF 0 "register_operand")
1193 (match_operand:V4SF 1 "zero_extended_scalar_load_operand"))]
1194 "TARGET_SSE && reload_completed"
1197 (vec_duplicate:V4SF (match_dup 1))
1201 operands[1] = gen_lowpart (SFmode, operands[1]);
1202 operands[2] = CONST0_RTX (V4SFmode);
1206 [(set (match_operand:V2DF 0 "register_operand")
1207 (match_operand:V2DF 1 "zero_extended_scalar_load_operand"))]
1208 "TARGET_SSE2 && reload_completed"
1209 [(set (match_dup 0) (vec_concat:V2DF (match_dup 1) (match_dup 2)))]
1211 operands[1] = gen_lowpart (DFmode, operands[1]);
1212 operands[2] = CONST0_RTX (DFmode);
1215 (define_expand "movmisalign<mode>"
1216 [(set (match_operand:VMOVE 0 "nonimmediate_operand")
1217 (match_operand:VMOVE 1 "nonimmediate_operand"))]
1220 ix86_expand_vector_move_misalign (<MODE>mode, operands);
1224 ;; Merge movsd/movhpd to movupd for TARGET_SSE_UNALIGNED_LOAD_OPTIMAL targets.
1226 [(set (match_operand:V2DF 0 "sse_reg_operand")
1227 (vec_concat:V2DF (match_operand:DF 1 "memory_operand")
1228 (match_operand:DF 4 "const0_operand")))
1229 (set (match_operand:V2DF 2 "sse_reg_operand")
1230 (vec_concat:V2DF (vec_select:DF (match_dup 2)
1231 (parallel [(const_int 0)]))
1232 (match_operand:DF 3 "memory_operand")))]
1233 "TARGET_SSE2 && TARGET_SSE_UNALIGNED_LOAD_OPTIMAL
1234 && ix86_operands_ok_for_move_multiple (operands, true, DFmode)"
1235 [(set (match_dup 2) (match_dup 5))]
1236 "operands[5] = adjust_address (operands[1], V2DFmode, 0);")
1239 [(set (match_operand:DF 0 "sse_reg_operand")
1240 (match_operand:DF 1 "memory_operand"))
1241 (set (match_operand:V2DF 2 "sse_reg_operand")
1242 (vec_concat:V2DF (match_operand:DF 4 "sse_reg_operand")
1243 (match_operand:DF 3 "memory_operand")))]
1244 "TARGET_SSE2 && TARGET_SSE_UNALIGNED_LOAD_OPTIMAL
1245 && REGNO (operands[4]) == REGNO (operands[2])
1246 && ix86_operands_ok_for_move_multiple (operands, true, DFmode)"
1247 [(set (match_dup 2) (match_dup 5))]
1248 "operands[5] = adjust_address (operands[1], V2DFmode, 0);")
1250 ;; Merge movlpd/movhpd to movupd for TARGET_SSE_UNALIGNED_STORE_OPTIMAL targets.
1252 [(set (match_operand:DF 0 "memory_operand")
1253 (vec_select:DF (match_operand:V2DF 1 "sse_reg_operand")
1254 (parallel [(const_int 0)])))
1255 (set (match_operand:DF 2 "memory_operand")
1256 (vec_select:DF (match_operand:V2DF 3 "sse_reg_operand")
1257 (parallel [(const_int 1)])))]
1258 "TARGET_SSE2 && TARGET_SSE_UNALIGNED_STORE_OPTIMAL
1259 && ix86_operands_ok_for_move_multiple (operands, false, DFmode)"
1260 [(set (match_dup 4) (match_dup 1))]
1261 "operands[4] = adjust_address (operands[0], V2DFmode, 0);")
1263 (define_insn "<sse3>_lddqu<avxsizesuffix>"
1264 [(set (match_operand:VI1 0 "register_operand" "=x")
1265 (unspec:VI1 [(match_operand:VI1 1 "memory_operand" "m")]
1268 "%vlddqu\t{%1, %0|%0, %1}"
1269 [(set_attr "type" "ssemov")
1270 (set_attr "movu" "1")
1271 (set (attr "prefix_data16")
1273 (match_test "TARGET_AVX")
1275 (const_string "0")))
1276 (set (attr "prefix_rep")
1278 (match_test "TARGET_AVX")
1280 (const_string "1")))
1281 (set_attr "prefix" "maybe_vex")
1282 (set_attr "mode" "<sseinsnmode>")])
1284 (define_insn "sse2_movnti<mode>"
1285 [(set (match_operand:SWI48 0 "memory_operand" "=m")
1286 (unspec:SWI48 [(match_operand:SWI48 1 "register_operand" "r")]
1289 "movnti\t{%1, %0|%0, %1}"
1290 [(set_attr "type" "ssemov")
1291 (set_attr "prefix_data16" "0")
1292 (set_attr "mode" "<MODE>")])
1294 (define_insn "<sse>_movnt<mode>"
1295 [(set (match_operand:VF 0 "memory_operand" "=m")
1297 [(match_operand:VF 1 "register_operand" "v")]
1300 "%vmovnt<ssemodesuffix>\t{%1, %0|%0, %1}"
1301 [(set_attr "type" "ssemov")
1302 (set_attr "prefix" "maybe_vex")
1303 (set_attr "mode" "<MODE>")])
1305 (define_insn "<sse2>_movnt<mode>"
1306 [(set (match_operand:VI8 0 "memory_operand" "=m")
1307 (unspec:VI8 [(match_operand:VI8 1 "register_operand" "v")]
1310 "%vmovntdq\t{%1, %0|%0, %1}"
1311 [(set_attr "type" "ssecvt")
1312 (set (attr "prefix_data16")
1314 (match_test "TARGET_AVX")
1316 (const_string "1")))
1317 (set_attr "prefix" "maybe_vex")
1318 (set_attr "mode" "<sseinsnmode>")])
1320 ; Expand patterns for non-temporal stores. At the moment, only those
1321 ; that directly map to insns are defined; it would be possible to
1322 ; define patterns for other modes that would expand to several insns.
1324 ;; Modes handled by storent patterns.
1325 (define_mode_iterator STORENT_MODE
1326 [(DI "TARGET_SSE2 && TARGET_64BIT") (SI "TARGET_SSE2")
1327 (SF "TARGET_SSE4A") (DF "TARGET_SSE4A")
1328 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") (V2DI "TARGET_SSE2")
1329 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
1330 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
1332 (define_expand "storent<mode>"
1333 [(set (match_operand:STORENT_MODE 0 "memory_operand")
1334 (unspec:STORENT_MODE
1335 [(match_operand:STORENT_MODE 1 "register_operand")]
1339 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1343 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1345 ;; All integer modes with AVX512BW/DQ.
1346 (define_mode_iterator SWI1248_AVX512BWDQ
1347 [(QI "TARGET_AVX512DQ") HI (SI "TARGET_AVX512BW") (DI "TARGET_AVX512BW")])
1349 ;; All integer modes with AVX512BW, where HImode operation
1350 ;; can be used instead of QImode.
1351 (define_mode_iterator SWI1248_AVX512BW
1352 [QI HI (SI "TARGET_AVX512BW") (DI "TARGET_AVX512BW")])
1354 ;; All integer modes with AVX512BW/DQ, even HImode requires DQ.
1355 (define_mode_iterator SWI1248_AVX512BWDQ2
1356 [(QI "TARGET_AVX512DQ") (HI "TARGET_AVX512DQ")
1357 (SI "TARGET_AVX512BW") (DI "TARGET_AVX512BW")])
1359 (define_expand "kmov<mskmodesuffix>"
1360 [(set (match_operand:SWI1248_AVX512BWDQ 0 "nonimmediate_operand")
1361 (match_operand:SWI1248_AVX512BWDQ 1 "nonimmediate_operand"))]
1363 && !(MEM_P (operands[0]) && MEM_P (operands[1]))")
1365 (define_insn "k<code><mode>"
1366 [(set (match_operand:SWI1248_AVX512BW 0 "register_operand" "=k")
1367 (any_logic:SWI1248_AVX512BW
1368 (match_operand:SWI1248_AVX512BW 1 "register_operand" "k")
1369 (match_operand:SWI1248_AVX512BW 2 "register_operand" "k")))
1370 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1373 if (get_attr_mode (insn) == MODE_HI)
1374 return "k<logic>w\t{%2, %1, %0|%0, %1, %2}";
1376 return "k<logic><mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}";
1378 [(set_attr "type" "msklog")
1379 (set_attr "prefix" "vex")
1381 (cond [(and (match_test "<MODE>mode == QImode")
1382 (not (match_test "TARGET_AVX512DQ")))
1385 (const_string "<MODE>")))])
1387 (define_insn "kandn<mode>"
1388 [(set (match_operand:SWI1248_AVX512BW 0 "register_operand" "=k")
1389 (and:SWI1248_AVX512BW
1390 (not:SWI1248_AVX512BW
1391 (match_operand:SWI1248_AVX512BW 1 "register_operand" "k"))
1392 (match_operand:SWI1248_AVX512BW 2 "register_operand" "k")))
1393 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1396 if (get_attr_mode (insn) == MODE_HI)
1397 return "kandnw\t{%2, %1, %0|%0, %1, %2}";
1399 return "kandn<mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}";
1401 [(set_attr "type" "msklog")
1402 (set_attr "prefix" "vex")
1404 (cond [(and (match_test "<MODE>mode == QImode")
1405 (not (match_test "TARGET_AVX512DQ")))
1408 (const_string "<MODE>")))])
1410 (define_insn "kxnor<mode>"
1411 [(set (match_operand:SWI1248_AVX512BW 0 "register_operand" "=k")
1412 (not:SWI1248_AVX512BW
1413 (xor:SWI1248_AVX512BW
1414 (match_operand:SWI1248_AVX512BW 1 "register_operand" "k")
1415 (match_operand:SWI1248_AVX512BW 2 "register_operand" "k"))))
1416 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1419 if (get_attr_mode (insn) == MODE_HI)
1420 return "kxnorw\t{%2, %1, %0|%0, %1, %2}";
1422 return "kxnor<mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}";
1424 [(set_attr "type" "msklog")
1425 (set_attr "prefix" "vex")
1427 (cond [(and (match_test "<MODE>mode == QImode")
1428 (not (match_test "TARGET_AVX512DQ")))
1431 (const_string "<MODE>")))])
1433 (define_insn "knot<mode>"
1434 [(set (match_operand:SWI1248_AVX512BW 0 "register_operand" "=k")
1435 (not:SWI1248_AVX512BW
1436 (match_operand:SWI1248_AVX512BW 1 "register_operand" "k")))
1437 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1440 if (get_attr_mode (insn) == MODE_HI)
1441 return "knotw\t{%1, %0|%0, %1}";
1443 return "knot<mskmodesuffix>\t{%1, %0|%0, %1}";
1445 [(set_attr "type" "msklog")
1446 (set_attr "prefix" "vex")
1448 (cond [(and (match_test "<MODE>mode == QImode")
1449 (not (match_test "TARGET_AVX512DQ")))
1452 (const_string "<MODE>")))])
1454 (define_insn "kadd<mode>"
1455 [(set (match_operand:SWI1248_AVX512BWDQ2 0 "register_operand" "=k")
1456 (plus:SWI1248_AVX512BWDQ2
1457 (match_operand:SWI1248_AVX512BWDQ2 1 "register_operand" "k")
1458 (match_operand:SWI1248_AVX512BWDQ2 2 "register_operand" "k")))
1459 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1461 "kadd<mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}"
1462 [(set_attr "type" "msklog")
1463 (set_attr "prefix" "vex")
1464 (set_attr "mode" "<MODE>")])
1466 ;; Mask variant shift mnemonics
1467 (define_code_attr mshift [(ashift "shiftl") (lshiftrt "shiftr")])
1469 (define_insn "k<code><mode>"
1470 [(set (match_operand:SWI1248_AVX512BWDQ 0 "register_operand" "=k")
1471 (any_lshift:SWI1248_AVX512BWDQ
1472 (match_operand:SWI1248_AVX512BWDQ 1 "register_operand" "k")
1473 (match_operand:QI 2 "immediate_operand" "n")))
1474 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1476 "k<mshift><mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}"
1477 [(set_attr "type" "msklog")
1478 (set_attr "prefix" "vex")
1479 (set_attr "mode" "<MODE>")])
1481 (define_insn "ktest<mode>"
1482 [(set (reg:CC FLAGS_REG)
1484 [(match_operand:SWI1248_AVX512BWDQ2 0 "register_operand" "k")
1485 (match_operand:SWI1248_AVX512BWDQ2 1 "register_operand" "k")]
1488 "ktest<mskmodesuffix>\t{%1, %0|%0, %1}"
1489 [(set_attr "mode" "<MODE>")
1490 (set_attr "type" "msklog")
1491 (set_attr "prefix" "vex")])
1493 (define_insn "kortest<mode>"
1494 [(set (reg:CC FLAGS_REG)
1496 [(match_operand:SWI1248_AVX512BWDQ 0 "register_operand" "k")
1497 (match_operand:SWI1248_AVX512BWDQ 1 "register_operand" "k")]
1500 "kortest<mskmodesuffix>\t{%1, %0|%0, %1}"
1501 [(set_attr "mode" "<MODE>")
1502 (set_attr "type" "msklog")
1503 (set_attr "prefix" "vex")])
1505 (define_insn "kunpckhi"
1506 [(set (match_operand:HI 0 "register_operand" "=k")
1509 (zero_extend:HI (match_operand:QI 1 "register_operand" "k"))
1511 (zero_extend:HI (match_operand:QI 2 "register_operand" "k"))))]
1513 "kunpckbw\t{%2, %1, %0|%0, %1, %2}"
1514 [(set_attr "mode" "HI")
1515 (set_attr "type" "msklog")
1516 (set_attr "prefix" "vex")])
1518 (define_insn "kunpcksi"
1519 [(set (match_operand:SI 0 "register_operand" "=k")
1522 (zero_extend:SI (match_operand:HI 1 "register_operand" "k"))
1524 (zero_extend:SI (match_operand:HI 2 "register_operand" "k"))))]
1526 "kunpckwd\t{%2, %1, %0|%0, %1, %2}"
1527 [(set_attr "mode" "SI")])
1529 (define_insn "kunpckdi"
1530 [(set (match_operand:DI 0 "register_operand" "=k")
1533 (zero_extend:DI (match_operand:SI 1 "register_operand" "k"))
1535 (zero_extend:DI (match_operand:SI 2 "register_operand" "k"))))]
1537 "kunpckdq\t{%2, %1, %0|%0, %1, %2}"
1538 [(set_attr "mode" "DI")])
1541 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1543 ;; Parallel floating point arithmetic
1545 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1547 (define_expand "<code><mode>2"
1548 [(set (match_operand:VF 0 "register_operand")
1550 (match_operand:VF 1 "register_operand")))]
1552 "ix86_expand_fp_absneg_operator (<CODE>, <MODE>mode, operands); DONE;")
1554 (define_insn_and_split "*absneg<mode>2"
1555 [(set (match_operand:VF 0 "register_operand" "=x,x,v,v")
1556 (match_operator:VF 3 "absneg_operator"
1557 [(match_operand:VF 1 "vector_operand" "0, xBm,v, m")]))
1558 (use (match_operand:VF 2 "vector_operand" "xBm,0, vm,v"))]
1561 "&& reload_completed"
1564 enum rtx_code absneg_op;
1570 if (MEM_P (operands[1]))
1571 op1 = operands[2], op2 = operands[1];
1573 op1 = operands[1], op2 = operands[2];
1578 if (rtx_equal_p (operands[0], operands[1]))
1584 absneg_op = GET_CODE (operands[3]) == NEG ? XOR : AND;
1585 t = gen_rtx_fmt_ee (absneg_op, <MODE>mode, op1, op2);
1586 t = gen_rtx_SET (operands[0], t);
1590 [(set_attr "isa" "noavx,noavx,avx,avx")])
1592 (define_expand "<plusminus_insn><mode>3<mask_name><round_name>"
1593 [(set (match_operand:VF 0 "register_operand")
1595 (match_operand:VF 1 "<round_nimm_predicate>")
1596 (match_operand:VF 2 "<round_nimm_predicate>")))]
1597 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1598 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
1600 (define_insn "*<plusminus_insn><mode>3<mask_name><round_name>"
1601 [(set (match_operand:VF 0 "register_operand" "=x,v")
1603 (match_operand:VF 1 "<round_nimm_predicate>" "<comm>0,v")
1604 (match_operand:VF 2 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
1605 "TARGET_SSE && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)
1606 && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1608 <plusminus_mnemonic><ssemodesuffix>\t{%2, %0|%0, %2}
1609 v<plusminus_mnemonic><ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
1610 [(set_attr "isa" "noavx,avx")
1611 (set_attr "type" "sseadd")
1612 (set_attr "prefix" "<mask_prefix3>")
1613 (set_attr "mode" "<MODE>")])
1615 (define_insn "<sse>_vm<plusminus_insn><mode>3<mask_scalar_name><round_scalar_name>"
1616 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
1619 (match_operand:VF_128 1 "register_operand" "0,v")
1620 (match_operand:VF_128 2 "vector_operand" "xBm,<round_scalar_constraint>"))
1625 <plusminus_mnemonic><ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
1626 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>}"
1627 [(set_attr "isa" "noavx,avx")
1628 (set_attr "type" "sseadd")
1629 (set_attr "prefix" "<round_scalar_prefix>")
1630 (set_attr "mode" "<ssescalarmode>")])
1632 (define_expand "mul<mode>3<mask_name><round_name>"
1633 [(set (match_operand:VF 0 "register_operand")
1635 (match_operand:VF 1 "<round_nimm_predicate>")
1636 (match_operand:VF 2 "<round_nimm_predicate>")))]
1637 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1638 "ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);")
1640 (define_insn "*mul<mode>3<mask_name><round_name>"
1641 [(set (match_operand:VF 0 "register_operand" "=x,v")
1643 (match_operand:VF 1 "<round_nimm_predicate>" "%0,v")
1644 (match_operand:VF 2 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
1646 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
1647 && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1649 mul<ssemodesuffix>\t{%2, %0|%0, %2}
1650 vmul<ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
1651 [(set_attr "isa" "noavx,avx")
1652 (set_attr "type" "ssemul")
1653 (set_attr "prefix" "<mask_prefix3>")
1654 (set_attr "btver2_decode" "direct,double")
1655 (set_attr "mode" "<MODE>")])
1657 (define_insn "<sse>_vm<multdiv_mnemonic><mode>3<mask_scalar_name><round_scalar_name>"
1658 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
1661 (match_operand:VF_128 1 "register_operand" "0,v")
1662 (match_operand:VF_128 2 "vector_operand" "xBm,<round_scalar_constraint>"))
1667 <multdiv_mnemonic><ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
1668 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>}"
1669 [(set_attr "isa" "noavx,avx")
1670 (set_attr "type" "sse<multdiv_mnemonic>")
1671 (set_attr "prefix" "<round_scalar_prefix>")
1672 (set_attr "btver2_decode" "direct,double")
1673 (set_attr "mode" "<ssescalarmode>")])
1675 (define_expand "div<mode>3"
1676 [(set (match_operand:VF2 0 "register_operand")
1677 (div:VF2 (match_operand:VF2 1 "register_operand")
1678 (match_operand:VF2 2 "vector_operand")))]
1680 "ix86_fixup_binary_operands_no_copy (DIV, <MODE>mode, operands);")
1682 (define_expand "div<mode>3"
1683 [(set (match_operand:VF1 0 "register_operand")
1684 (div:VF1 (match_operand:VF1 1 "register_operand")
1685 (match_operand:VF1 2 "vector_operand")))]
1688 ix86_fixup_binary_operands_no_copy (DIV, <MODE>mode, operands);
1691 && TARGET_RECIP_VEC_DIV
1692 && !optimize_insn_for_size_p ()
1693 && flag_finite_math_only && !flag_trapping_math
1694 && flag_unsafe_math_optimizations)
1696 ix86_emit_swdivsf (operands[0], operands[1], operands[2], <MODE>mode);
1701 (define_insn "<sse>_div<mode>3<mask_name><round_name>"
1702 [(set (match_operand:VF 0 "register_operand" "=x,v")
1704 (match_operand:VF 1 "register_operand" "0,v")
1705 (match_operand:VF 2 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
1706 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1708 div<ssemodesuffix>\t{%2, %0|%0, %2}
1709 vdiv<ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
1710 [(set_attr "isa" "noavx,avx")
1711 (set_attr "type" "ssediv")
1712 (set_attr "prefix" "<mask_prefix3>")
1713 (set_attr "mode" "<MODE>")])
1715 (define_insn "<sse>_rcp<mode>2"
1716 [(set (match_operand:VF1_128_256 0 "register_operand" "=x")
1718 [(match_operand:VF1_128_256 1 "vector_operand" "xBm")] UNSPEC_RCP))]
1720 "%vrcpps\t{%1, %0|%0, %1}"
1721 [(set_attr "type" "sse")
1722 (set_attr "atom_sse_attr" "rcp")
1723 (set_attr "btver2_sse_attr" "rcp")
1724 (set_attr "prefix" "maybe_vex")
1725 (set_attr "mode" "<MODE>")])
1727 (define_insn "sse_vmrcpv4sf2"
1728 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
1730 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm,xm")]
1732 (match_operand:V4SF 2 "register_operand" "0,x")
1736 rcpss\t{%1, %0|%0, %k1}
1737 vrcpss\t{%1, %2, %0|%0, %2, %k1}"
1738 [(set_attr "isa" "noavx,avx")
1739 (set_attr "type" "sse")
1740 (set_attr "atom_sse_attr" "rcp")
1741 (set_attr "btver2_sse_attr" "rcp")
1742 (set_attr "prefix" "orig,vex")
1743 (set_attr "mode" "SF")])
1745 (define_insn "<mask_codefor>rcp14<mode><mask_name>"
1746 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
1748 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "vm")]
1751 "vrcp14<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
1752 [(set_attr "type" "sse")
1753 (set_attr "prefix" "evex")
1754 (set_attr "mode" "<MODE>")])
1756 (define_insn "srcp14<mode>"
1757 [(set (match_operand:VF_128 0 "register_operand" "=v")
1760 [(match_operand:VF_128 1 "nonimmediate_operand" "vm")]
1762 (match_operand:VF_128 2 "register_operand" "v")
1765 "vrcp14<ssescalarmodesuffix>\t{%1, %2, %0|%0, %2, %<iptr>1}"
1766 [(set_attr "type" "sse")
1767 (set_attr "prefix" "evex")
1768 (set_attr "mode" "<MODE>")])
1770 (define_insn "srcp14<mode>_mask"
1771 [(set (match_operand:VF_128 0 "register_operand" "=v")
1775 [(match_operand:VF_128 1 "nonimmediate_operand" "vm")]
1777 (match_operand:VF_128 3 "vector_move_operand" "0C")
1778 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk"))
1779 (match_operand:VF_128 2 "register_operand" "v")
1782 "vrcp14<ssescalarmodesuffix>\t{%1, %2, %0%{%4%}%N3|%0%{%4%}%N3, %2, %<iptr>1}"
1783 [(set_attr "type" "sse")
1784 (set_attr "prefix" "evex")
1785 (set_attr "mode" "<MODE>")])
1787 (define_expand "sqrt<mode>2"
1788 [(set (match_operand:VF2 0 "register_operand")
1789 (sqrt:VF2 (match_operand:VF2 1 "vector_operand")))]
1792 (define_expand "sqrt<mode>2"
1793 [(set (match_operand:VF1 0 "register_operand")
1794 (sqrt:VF1 (match_operand:VF1 1 "vector_operand")))]
1798 && TARGET_RECIP_VEC_SQRT
1799 && !optimize_insn_for_size_p ()
1800 && flag_finite_math_only && !flag_trapping_math
1801 && flag_unsafe_math_optimizations)
1803 ix86_emit_swsqrtsf (operands[0], operands[1], <MODE>mode, false);
1808 (define_insn "<sse>_sqrt<mode>2<mask_name><round_name>"
1809 [(set (match_operand:VF 0 "register_operand" "=x,v")
1810 (sqrt:VF (match_operand:VF 1 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
1811 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1813 sqrt<ssemodesuffix>\t{%1, %0|%0, %1}
1814 vsqrt<ssemodesuffix>\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
1815 [(set_attr "isa" "noavx,avx")
1816 (set_attr "type" "sse")
1817 (set_attr "atom_sse_attr" "sqrt")
1818 (set_attr "btver2_sse_attr" "sqrt")
1819 (set_attr "prefix" "maybe_vex")
1820 (set_attr "mode" "<MODE>")])
1822 (define_insn "<sse>_vmsqrt<mode>2<round_name>"
1823 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
1826 (match_operand:VF_128 1 "vector_operand" "xBm,<round_constraint>"))
1827 (match_operand:VF_128 2 "register_operand" "0,v")
1831 sqrt<ssescalarmodesuffix>\t{%1, %0|%0, %<iptr>1}
1832 vsqrt<ssescalarmodesuffix>\t{<round_op3>%1, %2, %0|%0, %2, %<iptr>1<round_op3>}"
1833 [(set_attr "isa" "noavx,avx")
1834 (set_attr "type" "sse")
1835 (set_attr "atom_sse_attr" "sqrt")
1836 (set_attr "prefix" "<round_prefix>")
1837 (set_attr "btver2_sse_attr" "sqrt")
1838 (set_attr "mode" "<ssescalarmode>")])
1840 (define_expand "rsqrt<mode>2"
1841 [(set (match_operand:VF1_128_256 0 "register_operand")
1843 [(match_operand:VF1_128_256 1 "vector_operand")] UNSPEC_RSQRT))]
1846 ix86_emit_swsqrtsf (operands[0], operands[1], <MODE>mode, true);
1850 (define_expand "rsqrtv16sf2"
1851 [(set (match_operand:V16SF 0 "register_operand")
1853 [(match_operand:V16SF 1 "vector_operand")]
1855 "TARGET_SSE_MATH && TARGET_AVX512ER"
1857 ix86_emit_swsqrtsf (operands[0], operands[1], V16SFmode, true);
1861 (define_insn "<sse>_rsqrt<mode>2"
1862 [(set (match_operand:VF1_128_256 0 "register_operand" "=x")
1864 [(match_operand:VF1_128_256 1 "vector_operand" "xBm")] UNSPEC_RSQRT))]
1866 "%vrsqrtps\t{%1, %0|%0, %1}"
1867 [(set_attr "type" "sse")
1868 (set_attr "prefix" "maybe_vex")
1869 (set_attr "mode" "<MODE>")])
1871 (define_insn "<mask_codefor>rsqrt14<mode><mask_name>"
1872 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
1874 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "vm")]
1877 "vrsqrt14<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
1878 [(set_attr "type" "sse")
1879 (set_attr "prefix" "evex")
1880 (set_attr "mode" "<MODE>")])
1882 (define_insn "rsqrt14<mode>"
1883 [(set (match_operand:VF_128 0 "register_operand" "=v")
1886 [(match_operand:VF_128 1 "nonimmediate_operand" "vm")]
1888 (match_operand:VF_128 2 "register_operand" "v")
1891 "vrsqrt14<ssescalarmodesuffix>\t{%1, %2, %0|%0, %2, %<iptr>1}"
1892 [(set_attr "type" "sse")
1893 (set_attr "prefix" "evex")
1894 (set_attr "mode" "<MODE>")])
1896 (define_insn "rsqrt14_<mode>_mask"
1897 [(set (match_operand:VF_128 0 "register_operand" "=v")
1901 [(match_operand:VF_128 1 "nonimmediate_operand" "vm")]
1903 (match_operand:VF_128 3 "vector_move_operand" "0C")
1904 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk"))
1905 (match_operand:VF_128 2 "register_operand" "v")
1908 "vrsqrt14<ssescalarmodesuffix>\t{%1, %2, %0%{%4%}%N3|%0%{%4%}%N3, %2, %<iptr>1}"
1909 [(set_attr "type" "sse")
1910 (set_attr "prefix" "evex")
1911 (set_attr "mode" "<MODE>")])
1913 (define_insn "sse_vmrsqrtv4sf2"
1914 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
1916 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm,xm")]
1918 (match_operand:V4SF 2 "register_operand" "0,x")
1922 rsqrtss\t{%1, %0|%0, %k1}
1923 vrsqrtss\t{%1, %2, %0|%0, %2, %k1}"
1924 [(set_attr "isa" "noavx,avx")
1925 (set_attr "type" "sse")
1926 (set_attr "prefix" "orig,vex")
1927 (set_attr "mode" "SF")])
1929 (define_expand "<code><mode>3<mask_name><round_saeonly_name>"
1930 [(set (match_operand:VF 0 "register_operand")
1932 (match_operand:VF 1 "<round_saeonly_nimm_predicate>")
1933 (match_operand:VF 2 "<round_saeonly_nimm_predicate>")))]
1934 "TARGET_SSE && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
1936 if (!flag_finite_math_only || flag_signed_zeros)
1938 operands[1] = force_reg (<MODE>mode, operands[1]);
1939 emit_insn (gen_ieee_<maxmin_float><mode>3<mask_name><round_saeonly_name>
1940 (operands[0], operands[1], operands[2]
1941 <mask_operand_arg34>
1942 <round_saeonly_mask_arg3>));
1946 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
1949 ;; These versions of the min/max patterns are intentionally ignorant of
1950 ;; their behavior wrt -0.0 and NaN (via the commutative operand mark).
1951 ;; Since both the tree-level MAX_EXPR and the rtl-level SMAX operator
1952 ;; are undefined in this condition, we're certain this is correct.
1954 (define_insn "*<code><mode>3<mask_name><round_saeonly_name>"
1955 [(set (match_operand:VF 0 "register_operand" "=x,v")
1957 (match_operand:VF 1 "<round_saeonly_nimm_predicate>" "%0,v")
1958 (match_operand:VF 2 "<round_saeonly_nimm_predicate>" "xBm,<round_saeonly_constraint>")))]
1960 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
1961 && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
1963 <maxmin_float><ssemodesuffix>\t{%2, %0|%0, %2}
1964 v<maxmin_float><ssemodesuffix>\t{<round_saeonly_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_saeonly_mask_op3>}"
1965 [(set_attr "isa" "noavx,avx")
1966 (set_attr "type" "sseadd")
1967 (set_attr "btver2_sse_attr" "maxmin")
1968 (set_attr "prefix" "<mask_prefix3>")
1969 (set_attr "mode" "<MODE>")])
1971 ;; These versions of the min/max patterns implement exactly the operations
1972 ;; min = (op1 < op2 ? op1 : op2)
1973 ;; max = (!(op1 < op2) ? op1 : op2)
1974 ;; Their operands are not commutative, and thus they may be used in the
1975 ;; presence of -0.0 and NaN.
1977 (define_insn "ieee_<ieee_maxmin><mode>3<mask_name><round_saeonly_name>"
1978 [(set (match_operand:VF 0 "register_operand" "=x,v")
1980 [(match_operand:VF 1 "register_operand" "0,v")
1981 (match_operand:VF 2 "<round_saeonly_nimm_predicate>" "xBm,<round_saeonly_constraint>")]
1984 && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
1986 <ieee_maxmin><ssemodesuffix>\t{%2, %0|%0, %2}
1987 v<ieee_maxmin><ssemodesuffix>\t{<round_saeonly_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_saeonly_mask_op3>}"
1988 [(set_attr "isa" "noavx,avx")
1989 (set_attr "type" "sseadd")
1990 (set_attr "btver2_sse_attr" "maxmin")
1991 (set_attr "prefix" "<mask_prefix3>")
1992 (set_attr "mode" "<MODE>")])
1994 (define_insn "<sse>_vm<code><mode>3<mask_scalar_name><round_saeonly_scalar_name>"
1995 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
1998 (match_operand:VF_128 1 "register_operand" "0,v")
1999 (match_operand:VF_128 2 "vector_operand" "xBm,<round_saeonly_scalar_constraint>"))
2004 <maxmin_float><ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
2005 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>}"
2006 [(set_attr "isa" "noavx,avx")
2007 (set_attr "type" "sse")
2008 (set_attr "btver2_sse_attr" "maxmin")
2009 (set_attr "prefix" "<round_saeonly_scalar_prefix>")
2010 (set_attr "mode" "<ssescalarmode>")])
2012 (define_insn "avx_addsubv4df3"
2013 [(set (match_operand:V4DF 0 "register_operand" "=x")
2016 (match_operand:V4DF 1 "register_operand" "x")
2017 (match_operand:V4DF 2 "nonimmediate_operand" "xm"))
2018 (plus:V4DF (match_dup 1) (match_dup 2))
2021 "vaddsubpd\t{%2, %1, %0|%0, %1, %2}"
2022 [(set_attr "type" "sseadd")
2023 (set_attr "prefix" "vex")
2024 (set_attr "mode" "V4DF")])
2026 (define_insn "sse3_addsubv2df3"
2027 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
2030 (match_operand:V2DF 1 "register_operand" "0,x")
2031 (match_operand:V2DF 2 "vector_operand" "xBm,xm"))
2032 (plus:V2DF (match_dup 1) (match_dup 2))
2036 addsubpd\t{%2, %0|%0, %2}
2037 vaddsubpd\t{%2, %1, %0|%0, %1, %2}"
2038 [(set_attr "isa" "noavx,avx")
2039 (set_attr "type" "sseadd")
2040 (set_attr "atom_unit" "complex")
2041 (set_attr "prefix" "orig,vex")
2042 (set_attr "mode" "V2DF")])
2044 (define_insn "avx_addsubv8sf3"
2045 [(set (match_operand:V8SF 0 "register_operand" "=x")
2048 (match_operand:V8SF 1 "register_operand" "x")
2049 (match_operand:V8SF 2 "nonimmediate_operand" "xm"))
2050 (plus:V8SF (match_dup 1) (match_dup 2))
2053 "vaddsubps\t{%2, %1, %0|%0, %1, %2}"
2054 [(set_attr "type" "sseadd")
2055 (set_attr "prefix" "vex")
2056 (set_attr "mode" "V8SF")])
2058 (define_insn "sse3_addsubv4sf3"
2059 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
2062 (match_operand:V4SF 1 "register_operand" "0,x")
2063 (match_operand:V4SF 2 "vector_operand" "xBm,xm"))
2064 (plus:V4SF (match_dup 1) (match_dup 2))
2068 addsubps\t{%2, %0|%0, %2}
2069 vaddsubps\t{%2, %1, %0|%0, %1, %2}"
2070 [(set_attr "isa" "noavx,avx")
2071 (set_attr "type" "sseadd")
2072 (set_attr "prefix" "orig,vex")
2073 (set_attr "prefix_rep" "1,*")
2074 (set_attr "mode" "V4SF")])
2077 [(set (match_operand:VF_128_256 0 "register_operand")
2078 (match_operator:VF_128_256 6 "addsub_vm_operator"
2080 (match_operand:VF_128_256 1 "register_operand")
2081 (match_operand:VF_128_256 2 "vector_operand"))
2083 (match_operand:VF_128_256 3 "vector_operand")
2084 (match_operand:VF_128_256 4 "vector_operand"))
2085 (match_operand 5 "const_int_operand")]))]
2087 && can_create_pseudo_p ()
2088 && ((rtx_equal_p (operands[1], operands[3])
2089 && rtx_equal_p (operands[2], operands[4]))
2090 || (rtx_equal_p (operands[1], operands[4])
2091 && rtx_equal_p (operands[2], operands[3])))"
2093 (vec_merge:VF_128_256
2094 (minus:VF_128_256 (match_dup 1) (match_dup 2))
2095 (plus:VF_128_256 (match_dup 1) (match_dup 2))
2099 [(set (match_operand:VF_128_256 0 "register_operand")
2100 (match_operator:VF_128_256 6 "addsub_vm_operator"
2102 (match_operand:VF_128_256 1 "vector_operand")
2103 (match_operand:VF_128_256 2 "vector_operand"))
2105 (match_operand:VF_128_256 3 "register_operand")
2106 (match_operand:VF_128_256 4 "vector_operand"))
2107 (match_operand 5 "const_int_operand")]))]
2109 && can_create_pseudo_p ()
2110 && ((rtx_equal_p (operands[1], operands[3])
2111 && rtx_equal_p (operands[2], operands[4]))
2112 || (rtx_equal_p (operands[1], operands[4])
2113 && rtx_equal_p (operands[2], operands[3])))"
2115 (vec_merge:VF_128_256
2116 (minus:VF_128_256 (match_dup 3) (match_dup 4))
2117 (plus:VF_128_256 (match_dup 3) (match_dup 4))
2120 /* Negate mask bits to compensate for swapped PLUS and MINUS RTXes. */
2122 = GEN_INT (~INTVAL (operands[5])
2123 & ((HOST_WIDE_INT_1U << GET_MODE_NUNITS (<MODE>mode)) - 1));
2127 [(set (match_operand:VF_128_256 0 "register_operand")
2128 (match_operator:VF_128_256 7 "addsub_vs_operator"
2129 [(vec_concat:<ssedoublemode>
2131 (match_operand:VF_128_256 1 "register_operand")
2132 (match_operand:VF_128_256 2 "vector_operand"))
2134 (match_operand:VF_128_256 3 "vector_operand")
2135 (match_operand:VF_128_256 4 "vector_operand")))
2136 (match_parallel 5 "addsub_vs_parallel"
2137 [(match_operand 6 "const_int_operand")])]))]
2139 && can_create_pseudo_p ()
2140 && ((rtx_equal_p (operands[1], operands[3])
2141 && rtx_equal_p (operands[2], operands[4]))
2142 || (rtx_equal_p (operands[1], operands[4])
2143 && rtx_equal_p (operands[2], operands[3])))"
2145 (vec_merge:VF_128_256
2146 (minus:VF_128_256 (match_dup 1) (match_dup 2))
2147 (plus:VF_128_256 (match_dup 1) (match_dup 2))
2150 int i, nelt = XVECLEN (operands[5], 0);
2151 HOST_WIDE_INT ival = 0;
2153 for (i = 0; i < nelt; i++)
2154 if (INTVAL (XVECEXP (operands[5], 0, i)) < GET_MODE_NUNITS (<MODE>mode))
2155 ival |= HOST_WIDE_INT_1 << i;
2157 operands[5] = GEN_INT (ival);
2161 [(set (match_operand:VF_128_256 0 "register_operand")
2162 (match_operator:VF_128_256 7 "addsub_vs_operator"
2163 [(vec_concat:<ssedoublemode>
2165 (match_operand:VF_128_256 1 "vector_operand")
2166 (match_operand:VF_128_256 2 "vector_operand"))
2168 (match_operand:VF_128_256 3 "register_operand")
2169 (match_operand:VF_128_256 4 "vector_operand")))
2170 (match_parallel 5 "addsub_vs_parallel"
2171 [(match_operand 6 "const_int_operand")])]))]
2173 && can_create_pseudo_p ()
2174 && ((rtx_equal_p (operands[1], operands[3])
2175 && rtx_equal_p (operands[2], operands[4]))
2176 || (rtx_equal_p (operands[1], operands[4])
2177 && rtx_equal_p (operands[2], operands[3])))"
2179 (vec_merge:VF_128_256
2180 (minus:VF_128_256 (match_dup 3) (match_dup 4))
2181 (plus:VF_128_256 (match_dup 3) (match_dup 4))
2184 int i, nelt = XVECLEN (operands[5], 0);
2185 HOST_WIDE_INT ival = 0;
2187 for (i = 0; i < nelt; i++)
2188 if (INTVAL (XVECEXP (operands[5], 0, i)) >= GET_MODE_NUNITS (<MODE>mode))
2189 ival |= HOST_WIDE_INT_1 << i;
2191 operands[5] = GEN_INT (ival);
2194 (define_insn "avx_h<plusminus_insn>v4df3"
2195 [(set (match_operand:V4DF 0 "register_operand" "=x")
2200 (match_operand:V4DF 1 "register_operand" "x")
2201 (parallel [(const_int 0)]))
2202 (vec_select:DF (match_dup 1) (parallel [(const_int 1)])))
2205 (match_operand:V4DF 2 "nonimmediate_operand" "xm")
2206 (parallel [(const_int 0)]))
2207 (vec_select:DF (match_dup 2) (parallel [(const_int 1)]))))
2210 (vec_select:DF (match_dup 1) (parallel [(const_int 2)]))
2211 (vec_select:DF (match_dup 1) (parallel [(const_int 3)])))
2213 (vec_select:DF (match_dup 2) (parallel [(const_int 2)]))
2214 (vec_select:DF (match_dup 2) (parallel [(const_int 3)]))))))]
2216 "vh<plusminus_mnemonic>pd\t{%2, %1, %0|%0, %1, %2}"
2217 [(set_attr "type" "sseadd")
2218 (set_attr "prefix" "vex")
2219 (set_attr "mode" "V4DF")])
2221 (define_expand "sse3_haddv2df3"
2222 [(set (match_operand:V2DF 0 "register_operand")
2226 (match_operand:V2DF 1 "register_operand")
2227 (parallel [(const_int 0)]))
2228 (vec_select:DF (match_dup 1) (parallel [(const_int 1)])))
2231 (match_operand:V2DF 2 "vector_operand")
2232 (parallel [(const_int 0)]))
2233 (vec_select:DF (match_dup 2) (parallel [(const_int 1)])))))]
2236 (define_insn "*sse3_haddv2df3"
2237 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
2241 (match_operand:V2DF 1 "register_operand" "0,x")
2242 (parallel [(match_operand:SI 3 "const_0_to_1_operand")]))
2245 (parallel [(match_operand:SI 4 "const_0_to_1_operand")])))
2248 (match_operand:V2DF 2 "vector_operand" "xBm,xm")
2249 (parallel [(match_operand:SI 5 "const_0_to_1_operand")]))
2252 (parallel [(match_operand:SI 6 "const_0_to_1_operand")])))))]
2254 && INTVAL (operands[3]) != INTVAL (operands[4])
2255 && INTVAL (operands[5]) != INTVAL (operands[6])"
2257 haddpd\t{%2, %0|%0, %2}
2258 vhaddpd\t{%2, %1, %0|%0, %1, %2}"
2259 [(set_attr "isa" "noavx,avx")
2260 (set_attr "type" "sseadd")
2261 (set_attr "prefix" "orig,vex")
2262 (set_attr "mode" "V2DF")])
2264 (define_insn "sse3_hsubv2df3"
2265 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
2269 (match_operand:V2DF 1 "register_operand" "0,x")
2270 (parallel [(const_int 0)]))
2271 (vec_select:DF (match_dup 1) (parallel [(const_int 1)])))
2274 (match_operand:V2DF 2 "vector_operand" "xBm,xm")
2275 (parallel [(const_int 0)]))
2276 (vec_select:DF (match_dup 2) (parallel [(const_int 1)])))))]
2279 hsubpd\t{%2, %0|%0, %2}
2280 vhsubpd\t{%2, %1, %0|%0, %1, %2}"
2281 [(set_attr "isa" "noavx,avx")
2282 (set_attr "type" "sseadd")
2283 (set_attr "prefix" "orig,vex")
2284 (set_attr "mode" "V2DF")])
2286 (define_insn "*sse3_haddv2df3_low"
2287 [(set (match_operand:DF 0 "register_operand" "=x,x")
2290 (match_operand:V2DF 1 "register_operand" "0,x")
2291 (parallel [(match_operand:SI 2 "const_0_to_1_operand")]))
2294 (parallel [(match_operand:SI 3 "const_0_to_1_operand")]))))]
2296 && INTVAL (operands[2]) != INTVAL (operands[3])"
2298 haddpd\t{%0, %0|%0, %0}
2299 vhaddpd\t{%1, %1, %0|%0, %1, %1}"
2300 [(set_attr "isa" "noavx,avx")
2301 (set_attr "type" "sseadd1")
2302 (set_attr "prefix" "orig,vex")
2303 (set_attr "mode" "V2DF")])
2305 (define_insn "*sse3_hsubv2df3_low"
2306 [(set (match_operand:DF 0 "register_operand" "=x,x")
2309 (match_operand:V2DF 1 "register_operand" "0,x")
2310 (parallel [(const_int 0)]))
2313 (parallel [(const_int 1)]))))]
2316 hsubpd\t{%0, %0|%0, %0}
2317 vhsubpd\t{%1, %1, %0|%0, %1, %1}"
2318 [(set_attr "isa" "noavx,avx")
2319 (set_attr "type" "sseadd1")
2320 (set_attr "prefix" "orig,vex")
2321 (set_attr "mode" "V2DF")])
2323 (define_insn "avx_h<plusminus_insn>v8sf3"
2324 [(set (match_operand:V8SF 0 "register_operand" "=x")
2330 (match_operand:V8SF 1 "register_operand" "x")
2331 (parallel [(const_int 0)]))
2332 (vec_select:SF (match_dup 1) (parallel [(const_int 1)])))
2334 (vec_select:SF (match_dup 1) (parallel [(const_int 2)]))
2335 (vec_select:SF (match_dup 1) (parallel [(const_int 3)]))))
2339 (match_operand:V8SF 2 "nonimmediate_operand" "xm")
2340 (parallel [(const_int 0)]))
2341 (vec_select:SF (match_dup 2) (parallel [(const_int 1)])))
2343 (vec_select:SF (match_dup 2) (parallel [(const_int 2)]))
2344 (vec_select:SF (match_dup 2) (parallel [(const_int 3)])))))
2348 (vec_select:SF (match_dup 1) (parallel [(const_int 4)]))
2349 (vec_select:SF (match_dup 1) (parallel [(const_int 5)])))
2351 (vec_select:SF (match_dup 1) (parallel [(const_int 6)]))
2352 (vec_select:SF (match_dup 1) (parallel [(const_int 7)]))))
2355 (vec_select:SF (match_dup 2) (parallel [(const_int 4)]))
2356 (vec_select:SF (match_dup 2) (parallel [(const_int 5)])))
2358 (vec_select:SF (match_dup 2) (parallel [(const_int 6)]))
2359 (vec_select:SF (match_dup 2) (parallel [(const_int 7)])))))))]
2361 "vh<plusminus_mnemonic>ps\t{%2, %1, %0|%0, %1, %2}"
2362 [(set_attr "type" "sseadd")
2363 (set_attr "prefix" "vex")
2364 (set_attr "mode" "V8SF")])
2366 (define_insn "sse3_h<plusminus_insn>v4sf3"
2367 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
2372 (match_operand:V4SF 1 "register_operand" "0,x")
2373 (parallel [(const_int 0)]))
2374 (vec_select:SF (match_dup 1) (parallel [(const_int 1)])))
2376 (vec_select:SF (match_dup 1) (parallel [(const_int 2)]))
2377 (vec_select:SF (match_dup 1) (parallel [(const_int 3)]))))
2381 (match_operand:V4SF 2 "vector_operand" "xBm,xm")
2382 (parallel [(const_int 0)]))
2383 (vec_select:SF (match_dup 2) (parallel [(const_int 1)])))
2385 (vec_select:SF (match_dup 2) (parallel [(const_int 2)]))
2386 (vec_select:SF (match_dup 2) (parallel [(const_int 3)]))))))]
2389 h<plusminus_mnemonic>ps\t{%2, %0|%0, %2}
2390 vh<plusminus_mnemonic>ps\t{%2, %1, %0|%0, %1, %2}"
2391 [(set_attr "isa" "noavx,avx")
2392 (set_attr "type" "sseadd")
2393 (set_attr "atom_unit" "complex")
2394 (set_attr "prefix" "orig,vex")
2395 (set_attr "prefix_rep" "1,*")
2396 (set_attr "mode" "V4SF")])
2398 (define_expand "reduc_plus_scal_v8df"
2399 [(match_operand:DF 0 "register_operand")
2400 (match_operand:V8DF 1 "register_operand")]
2403 rtx tmp = gen_reg_rtx (V8DFmode);
2404 ix86_expand_reduc (gen_addv8df3, tmp, operands[1]);
2405 emit_insn (gen_vec_extractv8dfdf (operands[0], tmp, const0_rtx));
2409 (define_expand "reduc_plus_scal_v4df"
2410 [(match_operand:DF 0 "register_operand")
2411 (match_operand:V4DF 1 "register_operand")]
2414 rtx tmp = gen_reg_rtx (V4DFmode);
2415 rtx tmp2 = gen_reg_rtx (V4DFmode);
2416 rtx vec_res = gen_reg_rtx (V4DFmode);
2417 emit_insn (gen_avx_haddv4df3 (tmp, operands[1], operands[1]));
2418 emit_insn (gen_avx_vperm2f128v4df3 (tmp2, tmp, tmp, GEN_INT (1)));
2419 emit_insn (gen_addv4df3 (vec_res, tmp, tmp2));
2420 emit_insn (gen_vec_extractv4dfdf (operands[0], vec_res, const0_rtx));
2424 (define_expand "reduc_plus_scal_v2df"
2425 [(match_operand:DF 0 "register_operand")
2426 (match_operand:V2DF 1 "register_operand")]
2429 rtx tmp = gen_reg_rtx (V2DFmode);
2430 emit_insn (gen_sse3_haddv2df3 (tmp, operands[1], operands[1]));
2431 emit_insn (gen_vec_extractv2dfdf (operands[0], tmp, const0_rtx));
2435 (define_expand "reduc_plus_scal_v16sf"
2436 [(match_operand:SF 0 "register_operand")
2437 (match_operand:V16SF 1 "register_operand")]
2440 rtx tmp = gen_reg_rtx (V16SFmode);
2441 ix86_expand_reduc (gen_addv16sf3, tmp, operands[1]);
2442 emit_insn (gen_vec_extractv16sfsf (operands[0], tmp, const0_rtx));
2446 (define_expand "reduc_plus_scal_v8sf"
2447 [(match_operand:SF 0 "register_operand")
2448 (match_operand:V8SF 1 "register_operand")]
2451 rtx tmp = gen_reg_rtx (V8SFmode);
2452 rtx tmp2 = gen_reg_rtx (V8SFmode);
2453 rtx vec_res = gen_reg_rtx (V8SFmode);
2454 emit_insn (gen_avx_haddv8sf3 (tmp, operands[1], operands[1]));
2455 emit_insn (gen_avx_haddv8sf3 (tmp2, tmp, tmp));
2456 emit_insn (gen_avx_vperm2f128v8sf3 (tmp, tmp2, tmp2, GEN_INT (1)));
2457 emit_insn (gen_addv8sf3 (vec_res, tmp, tmp2));
2458 emit_insn (gen_vec_extractv8sfsf (operands[0], vec_res, const0_rtx));
2462 (define_expand "reduc_plus_scal_v4sf"
2463 [(match_operand:SF 0 "register_operand")
2464 (match_operand:V4SF 1 "register_operand")]
2467 rtx vec_res = gen_reg_rtx (V4SFmode);
2470 rtx tmp = gen_reg_rtx (V4SFmode);
2471 emit_insn (gen_sse3_haddv4sf3 (tmp, operands[1], operands[1]));
2472 emit_insn (gen_sse3_haddv4sf3 (vec_res, tmp, tmp));
2475 ix86_expand_reduc (gen_addv4sf3, vec_res, operands[1]);
2476 emit_insn (gen_vec_extractv4sfsf (operands[0], vec_res, const0_rtx));
2480 ;; Modes handled by reduc_sm{in,ax}* patterns.
2481 (define_mode_iterator REDUC_SMINMAX_MODE
2482 [(V32QI "TARGET_AVX2") (V16HI "TARGET_AVX2")
2483 (V8SI "TARGET_AVX2") (V4DI "TARGET_AVX2")
2484 (V8SF "TARGET_AVX") (V4DF "TARGET_AVX")
2485 (V4SF "TARGET_SSE") (V64QI "TARGET_AVX512BW")
2486 (V32HI "TARGET_AVX512BW") (V16SI "TARGET_AVX512F")
2487 (V8DI "TARGET_AVX512F") (V16SF "TARGET_AVX512F")
2488 (V8DF "TARGET_AVX512F")])
2490 (define_expand "reduc_<code>_scal_<mode>"
2491 [(smaxmin:REDUC_SMINMAX_MODE
2492 (match_operand:<ssescalarmode> 0 "register_operand")
2493 (match_operand:REDUC_SMINMAX_MODE 1 "register_operand"))]
2496 rtx tmp = gen_reg_rtx (<MODE>mode);
2497 ix86_expand_reduc (gen_<code><mode>3, tmp, operands[1]);
2498 emit_insn (gen_vec_extract<mode><ssescalarmodelower> (operands[0], tmp,
2503 (define_expand "reduc_<code>_scal_<mode>"
2504 [(umaxmin:VI_AVX512BW
2505 (match_operand:<ssescalarmode> 0 "register_operand")
2506 (match_operand:VI_AVX512BW 1 "register_operand"))]
2509 rtx tmp = gen_reg_rtx (<MODE>mode);
2510 ix86_expand_reduc (gen_<code><mode>3, tmp, operands[1]);
2511 emit_insn (gen_vec_extract<mode><ssescalarmodelower> (operands[0], tmp,
2516 (define_expand "reduc_<code>_scal_<mode>"
2518 (match_operand:<ssescalarmode> 0 "register_operand")
2519 (match_operand:VI_256 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_umin_scal_v8hi"
2531 (match_operand:HI 0 "register_operand")
2532 (match_operand:V8HI 1 "register_operand"))]
2535 rtx tmp = gen_reg_rtx (V8HImode);
2536 ix86_expand_reduc (gen_uminv8hi3, tmp, operands[1]);
2537 emit_insn (gen_vec_extractv8hihi (operands[0], tmp, const0_rtx));
2541 (define_insn "<mask_codefor>reducep<mode><mask_name>"
2542 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
2544 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "vm")
2545 (match_operand:SI 2 "const_0_to_255_operand")]
2548 "vreduce<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
2549 [(set_attr "type" "sse")
2550 (set_attr "prefix" "evex")
2551 (set_attr "mode" "<MODE>")])
2553 (define_insn "reduces<mode><mask_scalar_name>"
2554 [(set (match_operand:VF_128 0 "register_operand" "=v")
2557 [(match_operand:VF_128 1 "register_operand" "v")
2558 (match_operand:VF_128 2 "nonimmediate_operand" "vm")
2559 (match_operand:SI 3 "const_0_to_255_operand")]
2564 "vreduce<ssescalarmodesuffix>\t{%3, %2, %1, %0<mask_scalar_operand4>|%0<mask_scalar_operand4>, %1, %2, %3}"
2565 [(set_attr "type" "sse")
2566 (set_attr "prefix" "evex")
2567 (set_attr "mode" "<MODE>")])
2569 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2571 ;; Parallel floating point comparisons
2573 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2575 (define_insn "avx_cmp<mode>3"
2576 [(set (match_operand:VF_128_256 0 "register_operand" "=x")
2578 [(match_operand:VF_128_256 1 "register_operand" "x")
2579 (match_operand:VF_128_256 2 "nonimmediate_operand" "xm")
2580 (match_operand:SI 3 "const_0_to_31_operand" "n")]
2583 "vcmp<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
2584 [(set_attr "type" "ssecmp")
2585 (set_attr "length_immediate" "1")
2586 (set_attr "prefix" "vex")
2587 (set_attr "mode" "<MODE>")])
2589 (define_insn "avx_vmcmp<mode>3"
2590 [(set (match_operand:VF_128 0 "register_operand" "=x")
2593 [(match_operand:VF_128 1 "register_operand" "x")
2594 (match_operand:VF_128 2 "nonimmediate_operand" "xm")
2595 (match_operand:SI 3 "const_0_to_31_operand" "n")]
2600 "vcmp<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %3}"
2601 [(set_attr "type" "ssecmp")
2602 (set_attr "length_immediate" "1")
2603 (set_attr "prefix" "vex")
2604 (set_attr "mode" "<ssescalarmode>")])
2606 (define_insn "*<sse>_maskcmp<mode>3_comm"
2607 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x")
2608 (match_operator:VF_128_256 3 "sse_comparison_operator"
2609 [(match_operand:VF_128_256 1 "register_operand" "%0,x")
2610 (match_operand:VF_128_256 2 "vector_operand" "xBm,xm")]))]
2612 && GET_RTX_CLASS (GET_CODE (operands[3])) == RTX_COMM_COMPARE"
2614 cmp%D3<ssemodesuffix>\t{%2, %0|%0, %2}
2615 vcmp%D3<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
2616 [(set_attr "isa" "noavx,avx")
2617 (set_attr "type" "ssecmp")
2618 (set_attr "length_immediate" "1")
2619 (set_attr "prefix" "orig,vex")
2620 (set_attr "mode" "<MODE>")])
2622 (define_insn "<sse>_maskcmp<mode>3"
2623 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x")
2624 (match_operator:VF_128_256 3 "sse_comparison_operator"
2625 [(match_operand:VF_128_256 1 "register_operand" "0,x")
2626 (match_operand:VF_128_256 2 "vector_operand" "xBm,xm")]))]
2629 cmp%D3<ssemodesuffix>\t{%2, %0|%0, %2}
2630 vcmp%D3<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
2631 [(set_attr "isa" "noavx,avx")
2632 (set_attr "type" "ssecmp")
2633 (set_attr "length_immediate" "1")
2634 (set_attr "prefix" "orig,vex")
2635 (set_attr "mode" "<MODE>")])
2637 (define_insn "<sse>_vmmaskcmp<mode>3"
2638 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
2640 (match_operator:VF_128 3 "sse_comparison_operator"
2641 [(match_operand:VF_128 1 "register_operand" "0,x")
2642 (match_operand:VF_128 2 "vector_operand" "xBm,xm")])
2647 cmp%D3<ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
2648 vcmp%D3<ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %<iptr>2}"
2649 [(set_attr "isa" "noavx,avx")
2650 (set_attr "type" "ssecmp")
2651 (set_attr "length_immediate" "1,*")
2652 (set_attr "prefix" "orig,vex")
2653 (set_attr "mode" "<ssescalarmode>")])
2655 (define_mode_attr cmp_imm_predicate
2656 [(V16SF "const_0_to_31_operand") (V8DF "const_0_to_31_operand")
2657 (V16SI "const_0_to_7_operand") (V8DI "const_0_to_7_operand")
2658 (V8SF "const_0_to_31_operand") (V4DF "const_0_to_31_operand")
2659 (V8SI "const_0_to_7_operand") (V4DI "const_0_to_7_operand")
2660 (V4SF "const_0_to_31_operand") (V2DF "const_0_to_31_operand")
2661 (V4SI "const_0_to_7_operand") (V2DI "const_0_to_7_operand")
2662 (V32HI "const_0_to_7_operand") (V64QI "const_0_to_7_operand")
2663 (V16HI "const_0_to_7_operand") (V32QI "const_0_to_7_operand")
2664 (V8HI "const_0_to_7_operand") (V16QI "const_0_to_7_operand")])
2666 (define_insn "<avx512>_cmp<mode>3<mask_scalar_merge_name><round_saeonly_name>"
2667 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2668 (unspec:<avx512fmaskmode>
2669 [(match_operand:V48_AVX512VL 1 "register_operand" "v")
2670 (match_operand:V48_AVX512VL 2 "nonimmediate_operand" "<round_saeonly_constraint>")
2671 (match_operand:SI 3 "<cmp_imm_predicate>" "n")]
2673 "TARGET_AVX512F && <round_saeonly_mode512bit_condition>"
2674 "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}"
2675 [(set_attr "type" "ssecmp")
2676 (set_attr "length_immediate" "1")
2677 (set_attr "prefix" "evex")
2678 (set_attr "mode" "<sseinsnmode>")])
2680 (define_insn "<avx512>_cmp<mode>3<mask_scalar_merge_name>"
2681 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2682 (unspec:<avx512fmaskmode>
2683 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
2684 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")
2685 (match_operand:SI 3 "<cmp_imm_predicate>" "n")]
2688 "vpcmp<ssemodesuffix>\t{%3, %2, %1, %0<mask_scalar_merge_operand4>|%0<mask_scalar_merge_operand4>, %1, %2, %3}"
2689 [(set_attr "type" "ssecmp")
2690 (set_attr "length_immediate" "1")
2691 (set_attr "prefix" "evex")
2692 (set_attr "mode" "<sseinsnmode>")])
2694 (define_insn "<avx512>_ucmp<mode>3<mask_scalar_merge_name>"
2695 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2696 (unspec:<avx512fmaskmode>
2697 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
2698 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")
2699 (match_operand:SI 3 "const_0_to_7_operand" "n")]
2700 UNSPEC_UNSIGNED_PCMP))]
2702 "vpcmpu<ssemodesuffix>\t{%3, %2, %1, %0<mask_scalar_merge_operand4>|%0<mask_scalar_merge_operand4>, %1, %2, %3}"
2703 [(set_attr "type" "ssecmp")
2704 (set_attr "length_immediate" "1")
2705 (set_attr "prefix" "evex")
2706 (set_attr "mode" "<sseinsnmode>")])
2708 (define_insn "<avx512>_ucmp<mode>3<mask_scalar_merge_name>"
2709 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2710 (unspec:<avx512fmaskmode>
2711 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
2712 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")
2713 (match_operand:SI 3 "const_0_to_7_operand" "n")]
2714 UNSPEC_UNSIGNED_PCMP))]
2716 "vpcmpu<ssemodesuffix>\t{%3, %2, %1, %0<mask_scalar_merge_operand4>|%0<mask_scalar_merge_operand4>, %1, %2, %3}"
2717 [(set_attr "type" "ssecmp")
2718 (set_attr "length_immediate" "1")
2719 (set_attr "prefix" "evex")
2720 (set_attr "mode" "<sseinsnmode>")])
2722 (define_insn "avx512f_vmcmp<mode>3<round_saeonly_name>"
2723 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2724 (and:<avx512fmaskmode>
2725 (unspec:<avx512fmaskmode>
2726 [(match_operand:VF_128 1 "register_operand" "v")
2727 (match_operand:VF_128 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
2728 (match_operand:SI 3 "const_0_to_31_operand" "n")]
2732 "vcmp<ssescalarmodesuffix>\t{%3, <round_saeonly_op4>%2, %1, %0|%0, %1, %2<round_saeonly_op4>, %3}"
2733 [(set_attr "type" "ssecmp")
2734 (set_attr "length_immediate" "1")
2735 (set_attr "prefix" "evex")
2736 (set_attr "mode" "<ssescalarmode>")])
2738 (define_insn "avx512f_vmcmp<mode>3_mask<round_saeonly_name>"
2739 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2740 (and:<avx512fmaskmode>
2741 (unspec:<avx512fmaskmode>
2742 [(match_operand:VF_128 1 "register_operand" "v")
2743 (match_operand:VF_128 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
2744 (match_operand:SI 3 "const_0_to_31_operand" "n")]
2746 (and:<avx512fmaskmode>
2747 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")
2750 "vcmp<ssescalarmodesuffix>\t{%3, <round_saeonly_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_saeonly_op5>, %3}"
2751 [(set_attr "type" "ssecmp")
2752 (set_attr "length_immediate" "1")
2753 (set_attr "prefix" "evex")
2754 (set_attr "mode" "<ssescalarmode>")])
2756 (define_insn "avx512f_maskcmp<mode>3"
2757 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2758 (match_operator:<avx512fmaskmode> 3 "sse_comparison_operator"
2759 [(match_operand:VF 1 "register_operand" "v")
2760 (match_operand:VF 2 "nonimmediate_operand" "vm")]))]
2762 "vcmp%D3<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
2763 [(set_attr "type" "ssecmp")
2764 (set_attr "length_immediate" "1")
2765 (set_attr "prefix" "evex")
2766 (set_attr "mode" "<sseinsnmode>")])
2768 (define_insn "<sse>_<unord>comi<round_saeonly_name>"
2769 [(set (reg:CCFP FLAGS_REG)
2772 (match_operand:<ssevecmode> 0 "register_operand" "v")
2773 (parallel [(const_int 0)]))
2775 (match_operand:<ssevecmode> 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
2776 (parallel [(const_int 0)]))))]
2777 "SSE_FLOAT_MODE_P (<MODE>mode)"
2778 "%v<unord>comi<ssemodesuffix>\t{<round_saeonly_op2>%1, %0|%0, %<iptr>1<round_saeonly_op2>}"
2779 [(set_attr "type" "ssecomi")
2780 (set_attr "prefix" "maybe_vex")
2781 (set_attr "prefix_rep" "0")
2782 (set (attr "prefix_data16")
2783 (if_then_else (eq_attr "mode" "DF")
2785 (const_string "0")))
2786 (set_attr "mode" "<MODE>")])
2788 (define_expand "vec_cmp<mode><avx512fmaskmodelower>"
2789 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
2790 (match_operator:<avx512fmaskmode> 1 ""
2791 [(match_operand:V48_AVX512VL 2 "register_operand")
2792 (match_operand:V48_AVX512VL 3 "nonimmediate_operand")]))]
2795 bool ok = ix86_expand_mask_vec_cmp (operands);
2800 (define_expand "vec_cmp<mode><avx512fmaskmodelower>"
2801 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
2802 (match_operator:<avx512fmaskmode> 1 ""
2803 [(match_operand:VI12_AVX512VL 2 "register_operand")
2804 (match_operand:VI12_AVX512VL 3 "nonimmediate_operand")]))]
2807 bool ok = ix86_expand_mask_vec_cmp (operands);
2812 (define_expand "vec_cmp<mode><sseintvecmodelower>"
2813 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2814 (match_operator:<sseintvecmode> 1 ""
2815 [(match_operand:VI_256 2 "register_operand")
2816 (match_operand:VI_256 3 "nonimmediate_operand")]))]
2819 bool ok = ix86_expand_int_vec_cmp (operands);
2824 (define_expand "vec_cmp<mode><sseintvecmodelower>"
2825 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2826 (match_operator:<sseintvecmode> 1 ""
2827 [(match_operand:VI124_128 2 "register_operand")
2828 (match_operand:VI124_128 3 "vector_operand")]))]
2831 bool ok = ix86_expand_int_vec_cmp (operands);
2836 (define_expand "vec_cmpv2div2di"
2837 [(set (match_operand:V2DI 0 "register_operand")
2838 (match_operator:V2DI 1 ""
2839 [(match_operand:V2DI 2 "register_operand")
2840 (match_operand:V2DI 3 "vector_operand")]))]
2843 bool ok = ix86_expand_int_vec_cmp (operands);
2848 (define_expand "vec_cmp<mode><sseintvecmodelower>"
2849 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2850 (match_operator:<sseintvecmode> 1 ""
2851 [(match_operand:VF_256 2 "register_operand")
2852 (match_operand:VF_256 3 "nonimmediate_operand")]))]
2855 bool ok = ix86_expand_fp_vec_cmp (operands);
2860 (define_expand "vec_cmp<mode><sseintvecmodelower>"
2861 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2862 (match_operator:<sseintvecmode> 1 ""
2863 [(match_operand:VF_128 2 "register_operand")
2864 (match_operand:VF_128 3 "vector_operand")]))]
2867 bool ok = ix86_expand_fp_vec_cmp (operands);
2872 (define_expand "vec_cmpu<mode><avx512fmaskmodelower>"
2873 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
2874 (match_operator:<avx512fmaskmode> 1 ""
2875 [(match_operand:VI48_AVX512VL 2 "register_operand")
2876 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand")]))]
2879 bool ok = ix86_expand_mask_vec_cmp (operands);
2884 (define_expand "vec_cmpu<mode><avx512fmaskmodelower>"
2885 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
2886 (match_operator:<avx512fmaskmode> 1 ""
2887 [(match_operand:VI12_AVX512VL 2 "register_operand")
2888 (match_operand:VI12_AVX512VL 3 "nonimmediate_operand")]))]
2891 bool ok = ix86_expand_mask_vec_cmp (operands);
2896 (define_expand "vec_cmpu<mode><sseintvecmodelower>"
2897 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2898 (match_operator:<sseintvecmode> 1 ""
2899 [(match_operand:VI_256 2 "register_operand")
2900 (match_operand:VI_256 3 "nonimmediate_operand")]))]
2903 bool ok = ix86_expand_int_vec_cmp (operands);
2908 (define_expand "vec_cmpu<mode><sseintvecmodelower>"
2909 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2910 (match_operator:<sseintvecmode> 1 ""
2911 [(match_operand:VI124_128 2 "register_operand")
2912 (match_operand:VI124_128 3 "vector_operand")]))]
2915 bool ok = ix86_expand_int_vec_cmp (operands);
2920 (define_expand "vec_cmpuv2div2di"
2921 [(set (match_operand:V2DI 0 "register_operand")
2922 (match_operator:V2DI 1 ""
2923 [(match_operand:V2DI 2 "register_operand")
2924 (match_operand:V2DI 3 "vector_operand")]))]
2927 bool ok = ix86_expand_int_vec_cmp (operands);
2932 (define_expand "vec_cmpeqv2div2di"
2933 [(set (match_operand:V2DI 0 "register_operand")
2934 (match_operator:V2DI 1 ""
2935 [(match_operand:V2DI 2 "register_operand")
2936 (match_operand:V2DI 3 "vector_operand")]))]
2939 bool ok = ix86_expand_int_vec_cmp (operands);
2944 (define_expand "vcond<V_512:mode><VF_512:mode>"
2945 [(set (match_operand:V_512 0 "register_operand")
2947 (match_operator 3 ""
2948 [(match_operand:VF_512 4 "nonimmediate_operand")
2949 (match_operand:VF_512 5 "nonimmediate_operand")])
2950 (match_operand:V_512 1 "general_operand")
2951 (match_operand:V_512 2 "general_operand")))]
2953 && (GET_MODE_NUNITS (<V_512:MODE>mode)
2954 == GET_MODE_NUNITS (<VF_512:MODE>mode))"
2956 bool ok = ix86_expand_fp_vcond (operands);
2961 (define_expand "vcond<V_256:mode><VF_256:mode>"
2962 [(set (match_operand:V_256 0 "register_operand")
2964 (match_operator 3 ""
2965 [(match_operand:VF_256 4 "nonimmediate_operand")
2966 (match_operand:VF_256 5 "nonimmediate_operand")])
2967 (match_operand:V_256 1 "general_operand")
2968 (match_operand:V_256 2 "general_operand")))]
2970 && (GET_MODE_NUNITS (<V_256:MODE>mode)
2971 == GET_MODE_NUNITS (<VF_256:MODE>mode))"
2973 bool ok = ix86_expand_fp_vcond (operands);
2978 (define_expand "vcond<V_128:mode><VF_128:mode>"
2979 [(set (match_operand:V_128 0 "register_operand")
2981 (match_operator 3 ""
2982 [(match_operand:VF_128 4 "vector_operand")
2983 (match_operand:VF_128 5 "vector_operand")])
2984 (match_operand:V_128 1 "general_operand")
2985 (match_operand:V_128 2 "general_operand")))]
2987 && (GET_MODE_NUNITS (<V_128:MODE>mode)
2988 == GET_MODE_NUNITS (<VF_128:MODE>mode))"
2990 bool ok = ix86_expand_fp_vcond (operands);
2995 (define_expand "vcond_mask_<mode><avx512fmaskmodelower>"
2996 [(set (match_operand:V48_AVX512VL 0 "register_operand")
2997 (vec_merge:V48_AVX512VL
2998 (match_operand:V48_AVX512VL 1 "nonimmediate_operand")
2999 (match_operand:V48_AVX512VL 2 "vector_move_operand")
3000 (match_operand:<avx512fmaskmode> 3 "register_operand")))]
3003 (define_expand "vcond_mask_<mode><avx512fmaskmodelower>"
3004 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
3005 (vec_merge:VI12_AVX512VL
3006 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand")
3007 (match_operand:VI12_AVX512VL 2 "vector_move_operand")
3008 (match_operand:<avx512fmaskmode> 3 "register_operand")))]
3011 (define_expand "vcond_mask_<mode><sseintvecmodelower>"
3012 [(set (match_operand:VI_256 0 "register_operand")
3014 (match_operand:VI_256 1 "nonimmediate_operand")
3015 (match_operand:VI_256 2 "vector_move_operand")
3016 (match_operand:<sseintvecmode> 3 "register_operand")))]
3019 ix86_expand_sse_movcc (operands[0], operands[3],
3020 operands[1], operands[2]);
3024 (define_expand "vcond_mask_<mode><sseintvecmodelower>"
3025 [(set (match_operand:VI124_128 0 "register_operand")
3026 (vec_merge:VI124_128
3027 (match_operand:VI124_128 1 "vector_operand")
3028 (match_operand:VI124_128 2 "vector_move_operand")
3029 (match_operand:<sseintvecmode> 3 "register_operand")))]
3032 ix86_expand_sse_movcc (operands[0], operands[3],
3033 operands[1], operands[2]);
3037 (define_expand "vcond_mask_v2div2di"
3038 [(set (match_operand:V2DI 0 "register_operand")
3040 (match_operand:V2DI 1 "vector_operand")
3041 (match_operand:V2DI 2 "vector_move_operand")
3042 (match_operand:V2DI 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:VF_256 0 "register_operand")
3053 (match_operand:VF_256 1 "nonimmediate_operand")
3054 (match_operand:VF_256 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_<mode><sseintvecmodelower>"
3064 [(set (match_operand:VF_128 0 "register_operand")
3066 (match_operand:VF_128 1 "vector_operand")
3067 (match_operand:VF_128 2 "vector_move_operand")
3068 (match_operand:<sseintvecmode> 3 "register_operand")))]
3071 ix86_expand_sse_movcc (operands[0], operands[3],
3072 operands[1], operands[2]);
3076 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3078 ;; Parallel floating point logical operations
3080 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3082 (define_insn "<sse>_andnot<mode>3<mask_name>"
3083 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x,v,v")
3086 (match_operand:VF_128_256 1 "register_operand" "0,x,v,v"))
3087 (match_operand:VF_128_256 2 "vector_operand" "xBm,xm,vm,vm")))]
3088 "TARGET_SSE && <mask_avx512vl_condition>"
3090 static char buf[128];
3094 switch (which_alternative)
3097 ops = "andn%s\t{%%2, %%0|%%0, %%2}";
3102 ops = "vandn%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
3108 switch (get_attr_mode (insn))
3116 /* There is no vandnp[sd] in avx512f. Use vpandn[qd]. */
3117 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
3118 ops = "vpandn%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
3121 suffix = "<ssemodesuffix>";
3124 snprintf (buf, sizeof (buf), ops, suffix);
3127 [(set_attr "isa" "noavx,avx,avx512dq,avx512f")
3128 (set_attr "type" "sselog")
3129 (set_attr "prefix" "orig,maybe_vex,evex,evex")
3131 (cond [(and (match_test "<mask_applied>")
3132 (and (eq_attr "alternative" "1")
3133 (match_test "!TARGET_AVX512DQ")))
3134 (const_string "<sseintvecmode2>")
3135 (eq_attr "alternative" "3")
3136 (const_string "<sseintvecmode2>")
3137 (and (match_test "<MODE_SIZE> == 16")
3138 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
3139 (const_string "<ssePSmode>")
3140 (match_test "TARGET_AVX")
3141 (const_string "<MODE>")
3142 (match_test "optimize_function_for_size_p (cfun)")
3143 (const_string "V4SF")
3145 (const_string "<MODE>")))])
3148 (define_insn "<sse>_andnot<mode>3<mask_name>"
3149 [(set (match_operand:VF_512 0 "register_operand" "=v")
3152 (match_operand:VF_512 1 "register_operand" "v"))
3153 (match_operand:VF_512 2 "nonimmediate_operand" "vm")))]
3156 static char buf[128];
3160 suffix = "<ssemodesuffix>";
3163 /* There is no vandnp[sd] in avx512f. Use vpandn[qd]. */
3164 if (!TARGET_AVX512DQ)
3166 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
3170 snprintf (buf, sizeof (buf),
3171 "v%sandn%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}",
3175 [(set_attr "type" "sselog")
3176 (set_attr "prefix" "evex")
3178 (if_then_else (match_test "TARGET_AVX512DQ")
3179 (const_string "<sseinsnmode>")
3180 (const_string "XI")))])
3182 (define_expand "<code><mode>3<mask_name>"
3183 [(set (match_operand:VF_128_256 0 "register_operand")
3184 (any_logic:VF_128_256
3185 (match_operand:VF_128_256 1 "vector_operand")
3186 (match_operand:VF_128_256 2 "vector_operand")))]
3187 "TARGET_SSE && <mask_avx512vl_condition>"
3188 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
3190 (define_expand "<code><mode>3<mask_name>"
3191 [(set (match_operand:VF_512 0 "register_operand")
3193 (match_operand:VF_512 1 "nonimmediate_operand")
3194 (match_operand:VF_512 2 "nonimmediate_operand")))]
3196 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
3198 (define_insn "*<code><mode>3<mask_name>"
3199 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x,v,v")
3200 (any_logic:VF_128_256
3201 (match_operand:VF_128_256 1 "vector_operand" "%0,x,v,v")
3202 (match_operand:VF_128_256 2 "vector_operand" "xBm,xm,vm,vm")))]
3203 "TARGET_SSE && <mask_avx512vl_condition>
3204 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
3206 static char buf[128];
3210 switch (which_alternative)
3213 ops = "<logic>%s\t{%%2, %%0|%%0, %%2}";
3218 ops = "v<logic>%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
3224 switch (get_attr_mode (insn))
3232 /* There is no v<logic>p[sd] in avx512f. Use vp<logic>[qd]. */
3233 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
3234 ops = "vp<logic>%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
3237 suffix = "<ssemodesuffix>";
3240 snprintf (buf, sizeof (buf), ops, suffix);
3243 [(set_attr "isa" "noavx,avx,avx512dq,avx512f")
3244 (set_attr "type" "sselog")
3245 (set_attr "prefix" "orig,maybe_evex,evex,evex")
3247 (cond [(and (match_test "<mask_applied>")
3248 (and (eq_attr "alternative" "1")
3249 (match_test "!TARGET_AVX512DQ")))
3250 (const_string "<sseintvecmode2>")
3251 (eq_attr "alternative" "3")
3252 (const_string "<sseintvecmode2>")
3253 (and (match_test "<MODE_SIZE> == 16")
3254 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
3255 (const_string "<ssePSmode>")
3256 (match_test "TARGET_AVX")
3257 (const_string "<MODE>")
3258 (match_test "optimize_function_for_size_p (cfun)")
3259 (const_string "V4SF")
3261 (const_string "<MODE>")))])
3263 (define_insn "*<code><mode>3<mask_name>"
3264 [(set (match_operand:VF_512 0 "register_operand" "=v")
3266 (match_operand:VF_512 1 "nonimmediate_operand" "%v")
3267 (match_operand:VF_512 2 "nonimmediate_operand" "vm")))]
3268 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
3270 static char buf[128];
3274 suffix = "<ssemodesuffix>";
3277 /* There is no v<logic>p[sd] in avx512f. Use vp<logic>[dq]. */
3278 if (!TARGET_AVX512DQ)
3280 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
3284 snprintf (buf, sizeof (buf),
3285 "v%s<logic>%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}",
3289 [(set_attr "type" "sselog")
3290 (set_attr "prefix" "evex")
3292 (if_then_else (match_test "TARGET_AVX512DQ")
3293 (const_string "<sseinsnmode>")
3294 (const_string "XI")))])
3296 (define_expand "copysign<mode>3"
3299 (not:VF (match_dup 3))
3300 (match_operand:VF 1 "vector_operand")))
3302 (and:VF (match_dup 3)
3303 (match_operand:VF 2 "vector_operand")))
3304 (set (match_operand:VF 0 "register_operand")
3305 (ior:VF (match_dup 4) (match_dup 5)))]
3308 operands[3] = ix86_build_signbit_mask (<MODE>mode, 1, 0);
3310 operands[4] = gen_reg_rtx (<MODE>mode);
3311 operands[5] = gen_reg_rtx (<MODE>mode);
3314 ;; Also define scalar versions. These are used for abs, neg, and
3315 ;; conditional move. Using subregs into vector modes causes register
3316 ;; allocation lossage. These patterns do not allow memory operands
3317 ;; because the native instructions read the full 128-bits.
3319 (define_insn "*andnot<mode>3"
3320 [(set (match_operand:MODEF 0 "register_operand" "=x,x,v,v")
3323 (match_operand:MODEF 1 "register_operand" "0,x,v,v"))
3324 (match_operand:MODEF 2 "register_operand" "x,x,v,v")))]
3325 "SSE_FLOAT_MODE_P (<MODE>mode)"
3327 static char buf[128];
3330 = (get_attr_mode (insn) == MODE_V4SF) ? "ps" : "<ssevecmodesuffix>";
3332 switch (which_alternative)
3335 ops = "andn%s\t{%%2, %%0|%%0, %%2}";
3338 ops = "vandn%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3341 if (TARGET_AVX512DQ)
3342 ops = "vandn%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3345 suffix = <MODE>mode == DFmode ? "q" : "d";
3346 ops = "vpandn%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3350 if (TARGET_AVX512DQ)
3351 ops = "vandn%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3354 suffix = <MODE>mode == DFmode ? "q" : "d";
3355 ops = "vpandn%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3362 snprintf (buf, sizeof (buf), ops, suffix);
3365 [(set_attr "isa" "noavx,avx,avx512vl,avx512f")
3366 (set_attr "type" "sselog")
3367 (set_attr "prefix" "orig,vex,evex,evex")
3369 (cond [(eq_attr "alternative" "2")
3370 (if_then_else (match_test "TARGET_AVX512DQ")
3371 (const_string "<ssevecmode>")
3372 (const_string "TI"))
3373 (eq_attr "alternative" "3")
3374 (if_then_else (match_test "TARGET_AVX512DQ")
3375 (const_string "<avx512fvecmode>")
3376 (const_string "XI"))
3377 (and (match_test "<MODE_SIZE> == 16")
3378 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
3379 (const_string "V4SF")
3380 (match_test "TARGET_AVX")
3381 (const_string "<ssevecmode>")
3382 (match_test "optimize_function_for_size_p (cfun)")
3383 (const_string "V4SF")
3385 (const_string "<ssevecmode>")))])
3387 (define_insn "*andnottf3"
3388 [(set (match_operand:TF 0 "register_operand" "=x,x,v,v")
3390 (not:TF (match_operand:TF 1 "register_operand" "0,x,v,v"))
3391 (match_operand:TF 2 "vector_operand" "xBm,xm,vm,v")))]
3394 static char buf[128];
3397 = (which_alternative >= 2 ? "pandnq"
3398 : get_attr_mode (insn) == MODE_V4SF ? "andnps" : "pandn");
3400 switch (which_alternative)
3403 ops = "%s\t{%%2, %%0|%%0, %%2}";
3407 ops = "v%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3410 ops = "v%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3416 snprintf (buf, sizeof (buf), ops, tmp);
3419 [(set_attr "isa" "noavx,avx,avx512vl,avx512f")
3420 (set_attr "type" "sselog")
3421 (set (attr "prefix_data16")
3423 (and (eq_attr "alternative" "0")
3424 (eq_attr "mode" "TI"))
3426 (const_string "*")))
3427 (set_attr "prefix" "orig,vex,evex,evex")
3429 (cond [(eq_attr "alternative" "2")
3431 (eq_attr "alternative" "3")
3433 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
3434 (const_string "V4SF")
3435 (match_test "TARGET_AVX")
3437 (ior (not (match_test "TARGET_SSE2"))
3438 (match_test "optimize_function_for_size_p (cfun)"))
3439 (const_string "V4SF")
3441 (const_string "TI")))])
3443 (define_insn "*<code><mode>3"
3444 [(set (match_operand:MODEF 0 "register_operand" "=x,x,v,v")
3446 (match_operand:MODEF 1 "register_operand" "%0,x,v,v")
3447 (match_operand:MODEF 2 "register_operand" "x,x,v,v")))]
3448 "SSE_FLOAT_MODE_P (<MODE>mode)"
3450 static char buf[128];
3453 = (get_attr_mode (insn) == MODE_V4SF) ? "ps" : "<ssevecmodesuffix>";
3455 switch (which_alternative)
3458 ops = "<logic>%s\t{%%2, %%0|%%0, %%2}";
3461 if (!TARGET_AVX512DQ)
3463 suffix = <MODE>mode == DFmode ? "q" : "d";
3464 ops = "vp<logic>%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3469 ops = "v<logic>%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3472 if (TARGET_AVX512DQ)
3473 ops = "v<logic>%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3476 suffix = <MODE>mode == DFmode ? "q" : "d";
3477 ops = "vp<logic>%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3484 snprintf (buf, sizeof (buf), ops, suffix);
3487 [(set_attr "isa" "noavx,avx,avx512vl,avx512f")
3488 (set_attr "type" "sselog")
3489 (set_attr "prefix" "orig,vex,evex,evex")
3491 (cond [(eq_attr "alternative" "2")
3492 (if_then_else (match_test "TARGET_AVX512DQ")
3493 (const_string "<ssevecmode>")
3494 (const_string "TI"))
3495 (eq_attr "alternative" "3")
3496 (if_then_else (match_test "TARGET_AVX512DQ")
3497 (const_string "<avx512fvecmode>")
3498 (const_string "XI"))
3499 (and (match_test "<MODE_SIZE> == 16")
3500 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
3501 (const_string "V4SF")
3502 (match_test "TARGET_AVX")
3503 (const_string "<ssevecmode>")
3504 (match_test "optimize_function_for_size_p (cfun)")
3505 (const_string "V4SF")
3507 (const_string "<ssevecmode>")))])
3509 (define_expand "<code>tf3"
3510 [(set (match_operand:TF 0 "register_operand")
3512 (match_operand:TF 1 "vector_operand")
3513 (match_operand:TF 2 "vector_operand")))]
3515 "ix86_fixup_binary_operands_no_copy (<CODE>, TFmode, operands);")
3517 (define_insn "*<code>tf3"
3518 [(set (match_operand:TF 0 "register_operand" "=x,x,v,v")
3520 (match_operand:TF 1 "vector_operand" "%0,x,v,v")
3521 (match_operand:TF 2 "vector_operand" "xBm,xm,vm,v")))]
3522 "TARGET_SSE && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
3524 static char buf[128];
3527 = (which_alternative >= 2 ? "p<logic>q"
3528 : get_attr_mode (insn) == MODE_V4SF ? "<logic>ps" : "p<logic>");
3530 switch (which_alternative)
3533 ops = "%s\t{%%2, %%0|%%0, %%2}";
3537 ops = "v%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3540 ops = "v%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3546 snprintf (buf, sizeof (buf), ops, tmp);
3549 [(set_attr "isa" "noavx,avx,avx512vl,avx512f")
3550 (set_attr "type" "sselog")
3551 (set (attr "prefix_data16")
3553 (and (eq_attr "alternative" "0")
3554 (eq_attr "mode" "TI"))
3556 (const_string "*")))
3557 (set_attr "prefix" "orig,vex,evex,evex")
3559 (cond [(eq_attr "alternative" "2")
3561 (eq_attr "alternative" "3")
3563 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
3564 (const_string "V4SF")
3565 (match_test "TARGET_AVX")
3567 (ior (not (match_test "TARGET_SSE2"))
3568 (match_test "optimize_function_for_size_p (cfun)"))
3569 (const_string "V4SF")
3571 (const_string "TI")))])
3573 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3575 ;; FMA floating point multiply/accumulate instructions. These include
3576 ;; scalar versions of the instructions as well as vector versions.
3578 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3580 ;; The standard names for scalar FMA are only available with SSE math enabled.
3581 ;; CPUID bit AVX512F enables evex encoded scalar and 512-bit fma. It doesn't
3582 ;; care about FMA bit, so we enable fma for TARGET_AVX512F even when TARGET_FMA
3583 ;; and TARGET_FMA4 are both false.
3584 ;; TODO: In theory AVX512F does not automatically imply FMA, and without FMA
3585 ;; one must force the EVEX encoding of the fma insns. Ideally we'd improve
3586 ;; GAS to allow proper prefix selection. However, for the moment all hardware
3587 ;; that supports AVX512F also supports FMA so we can ignore this for now.
3588 (define_mode_iterator FMAMODEM
3589 [(SF "TARGET_SSE_MATH && (TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F)")
3590 (DF "TARGET_SSE_MATH && (TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F)")
3591 (V4SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3592 (V2DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3593 (V8SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3594 (V4DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3595 (V16SF "TARGET_AVX512F")
3596 (V8DF "TARGET_AVX512F")])
3598 (define_expand "fma<mode>4"
3599 [(set (match_operand:FMAMODEM 0 "register_operand")
3601 (match_operand:FMAMODEM 1 "nonimmediate_operand")
3602 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3603 (match_operand:FMAMODEM 3 "nonimmediate_operand")))])
3605 (define_expand "fms<mode>4"
3606 [(set (match_operand:FMAMODEM 0 "register_operand")
3608 (match_operand:FMAMODEM 1 "nonimmediate_operand")
3609 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3610 (neg:FMAMODEM (match_operand:FMAMODEM 3 "nonimmediate_operand"))))])
3612 (define_expand "fnma<mode>4"
3613 [(set (match_operand:FMAMODEM 0 "register_operand")
3615 (neg:FMAMODEM (match_operand:FMAMODEM 1 "nonimmediate_operand"))
3616 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3617 (match_operand:FMAMODEM 3 "nonimmediate_operand")))])
3619 (define_expand "fnms<mode>4"
3620 [(set (match_operand:FMAMODEM 0 "register_operand")
3622 (neg:FMAMODEM (match_operand:FMAMODEM 1 "nonimmediate_operand"))
3623 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3624 (neg:FMAMODEM (match_operand:FMAMODEM 3 "nonimmediate_operand"))))])
3626 ;; The builtins for intrinsics are not constrained by SSE math enabled.
3627 (define_mode_iterator FMAMODE_AVX512
3628 [(SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F")
3629 (DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F")
3630 (V4SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3631 (V2DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3632 (V8SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3633 (V4DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3634 (V16SF "TARGET_AVX512F")
3635 (V8DF "TARGET_AVX512F")])
3637 (define_mode_iterator FMAMODE
3638 [SF DF V4SF V2DF V8SF V4DF])
3640 (define_expand "fma4i_fmadd_<mode>"
3641 [(set (match_operand:FMAMODE_AVX512 0 "register_operand")
3643 (match_operand:FMAMODE_AVX512 1 "nonimmediate_operand")
3644 (match_operand:FMAMODE_AVX512 2 "nonimmediate_operand")
3645 (match_operand:FMAMODE_AVX512 3 "nonimmediate_operand")))])
3647 (define_expand "<avx512>_fmadd_<mode>_maskz<round_expand_name>"
3648 [(match_operand:VF_AVX512VL 0 "register_operand")
3649 (match_operand:VF_AVX512VL 1 "<round_expand_nimm_predicate>")
3650 (match_operand:VF_AVX512VL 2 "<round_expand_nimm_predicate>")
3651 (match_operand:VF_AVX512VL 3 "<round_expand_nimm_predicate>")
3652 (match_operand:<avx512fmaskmode> 4 "register_operand")]
3653 "TARGET_AVX512F && <round_mode512bit_condition>"
3655 emit_insn (gen_fma_fmadd_<mode>_maskz_1<round_expand_name> (
3656 operands[0], operands[1], operands[2], operands[3],
3657 CONST0_RTX (<MODE>mode), operands[4]<round_expand_operand>));
3661 (define_insn "*fma_fmadd_<mode>"
3662 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
3664 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x")
3665 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
3666 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x")))]
3667 "TARGET_FMA || TARGET_FMA4"
3669 vfmadd132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
3670 vfmadd213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
3671 vfmadd231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
3672 vfmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3673 vfmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3674 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3675 (set_attr "type" "ssemuladd")
3676 (set_attr "mode" "<MODE>")])
3678 ;; Suppose AVX-512F as baseline
3679 (define_mode_iterator VF_SF_AVX512VL
3680 [SF V16SF (V8SF "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
3681 DF V8DF (V4DF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
3683 (define_insn "<sd_mask_codefor>fma_fmadd_<mode><sd_maskz_name><round_name>"
3684 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3686 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
3687 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3688 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0")))]
3689 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3691 vfmadd132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3692 vfmadd213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3693 vfmadd231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
3694 [(set_attr "type" "ssemuladd")
3695 (set_attr "mode" "<MODE>")])
3697 (define_insn "<avx512>_fmadd_<mode>_mask<round_name>"
3698 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
3699 (vec_merge:VF_AVX512VL
3701 (match_operand:VF_AVX512VL 1 "register_operand" "0,0")
3702 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
3703 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>"))
3705 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
3706 "TARGET_AVX512F && <round_mode512bit_condition>"
3708 vfmadd132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
3709 vfmadd213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
3710 [(set_attr "type" "ssemuladd")
3711 (set_attr "mode" "<MODE>")])
3713 (define_insn "<avx512>_fmadd_<mode>_mask3<round_name>"
3714 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
3715 (vec_merge:VF_AVX512VL
3717 (match_operand:VF_AVX512VL 1 "register_operand" "v")
3718 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
3719 (match_operand:VF_AVX512VL 3 "register_operand" "0"))
3721 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
3723 "vfmadd231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
3724 [(set_attr "type" "ssemuladd")
3725 (set_attr "mode" "<MODE>")])
3727 (define_insn "*fma_fmsub_<mode>"
3728 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
3730 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x")
3731 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
3733 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x"))))]
3734 "TARGET_FMA || TARGET_FMA4"
3736 vfmsub132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
3737 vfmsub213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
3738 vfmsub231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
3739 vfmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3740 vfmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3741 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3742 (set_attr "type" "ssemuladd")
3743 (set_attr "mode" "<MODE>")])
3745 (define_insn "<sd_mask_codefor>fma_fmsub_<mode><sd_maskz_name><round_name>"
3746 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3748 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
3749 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3751 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0"))))]
3752 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3754 vfmsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3755 vfmsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3756 vfmsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
3757 [(set_attr "type" "ssemuladd")
3758 (set_attr "mode" "<MODE>")])
3760 (define_insn "<avx512>_fmsub_<mode>_mask<round_name>"
3761 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
3762 (vec_merge:VF_AVX512VL
3764 (match_operand:VF_AVX512VL 1 "register_operand" "0,0")
3765 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
3767 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>")))
3769 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
3772 vfmsub132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
3773 vfmsub213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
3774 [(set_attr "type" "ssemuladd")
3775 (set_attr "mode" "<MODE>")])
3777 (define_insn "<avx512>_fmsub_<mode>_mask3<round_name>"
3778 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
3779 (vec_merge:VF_AVX512VL
3781 (match_operand:VF_AVX512VL 1 "register_operand" "v")
3782 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
3784 (match_operand:VF_AVX512VL 3 "register_operand" "0")))
3786 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
3787 "TARGET_AVX512F && <round_mode512bit_condition>"
3788 "vfmsub231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
3789 [(set_attr "type" "ssemuladd")
3790 (set_attr "mode" "<MODE>")])
3792 (define_insn "*fma_fnmadd_<mode>"
3793 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
3796 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x"))
3797 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
3798 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x")))]
3799 "TARGET_FMA || TARGET_FMA4"
3801 vfnmadd132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
3802 vfnmadd213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
3803 vfnmadd231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
3804 vfnmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3805 vfnmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3806 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3807 (set_attr "type" "ssemuladd")
3808 (set_attr "mode" "<MODE>")])
3810 (define_insn "<sd_mask_codefor>fma_fnmadd_<mode><sd_maskz_name><round_name>"
3811 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3814 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v"))
3815 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3816 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0")))]
3817 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3819 vfnmadd132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3820 vfnmadd213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3821 vfnmadd231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
3822 [(set_attr "type" "ssemuladd")
3823 (set_attr "mode" "<MODE>")])
3825 (define_insn "<avx512>_fnmadd_<mode>_mask<round_name>"
3826 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
3827 (vec_merge:VF_AVX512VL
3830 (match_operand:VF_AVX512VL 1 "register_operand" "0,0"))
3831 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
3832 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>"))
3834 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
3835 "TARGET_AVX512F && <round_mode512bit_condition>"
3837 vfnmadd132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
3838 vfnmadd213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
3839 [(set_attr "type" "ssemuladd")
3840 (set_attr "mode" "<MODE>")])
3842 (define_insn "<avx512>_fnmadd_<mode>_mask3<round_name>"
3843 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
3844 (vec_merge:VF_AVX512VL
3847 (match_operand:VF_AVX512VL 1 "register_operand" "v"))
3848 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
3849 (match_operand:VF_AVX512VL 3 "register_operand" "0"))
3851 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
3852 "TARGET_AVX512F && <round_mode512bit_condition>"
3853 "vfnmadd231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
3854 [(set_attr "type" "ssemuladd")
3855 (set_attr "mode" "<MODE>")])
3857 (define_insn "*fma_fnmsub_<mode>"
3858 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
3861 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x"))
3862 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
3864 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x"))))]
3865 "TARGET_FMA || TARGET_FMA4"
3867 vfnmsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3868 vfnmsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3869 vfnmsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}
3870 vfnmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3871 vfnmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3872 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3873 (set_attr "type" "ssemuladd")
3874 (set_attr "mode" "<MODE>")])
3876 (define_insn "<sd_mask_codefor>fma_fnmsub_<mode><sd_maskz_name><round_name>"
3877 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3880 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v"))
3881 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3883 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0"))))]
3884 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3886 vfnmsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3887 vfnmsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3888 vfnmsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
3889 [(set_attr "type" "ssemuladd")
3890 (set_attr "mode" "<MODE>")])
3892 (define_insn "<avx512>_fnmsub_<mode>_mask<round_name>"
3893 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
3894 (vec_merge:VF_AVX512VL
3897 (match_operand:VF_AVX512VL 1 "register_operand" "0,0"))
3898 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
3900 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>")))
3902 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
3903 "TARGET_AVX512F && <round_mode512bit_condition>"
3905 vfnmsub132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
3906 vfnmsub213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
3907 [(set_attr "type" "ssemuladd")
3908 (set_attr "mode" "<MODE>")])
3910 (define_insn "<avx512>_fnmsub_<mode>_mask3<round_name>"
3911 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
3912 (vec_merge:VF_AVX512VL
3915 (match_operand:VF_AVX512VL 1 "register_operand" "v"))
3916 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
3918 (match_operand:VF_AVX512VL 3 "register_operand" "0")))
3920 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
3922 "vfnmsub231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
3923 [(set_attr "type" "ssemuladd")
3924 (set_attr "mode" "<MODE>")])
3926 ;; FMA parallel floating point multiply addsub and subadd operations.
3928 ;; It would be possible to represent these without the UNSPEC as
3931 ;; (fma op1 op2 op3)
3932 ;; (fma op1 op2 (neg op3))
3935 ;; But this doesn't seem useful in practice.
3937 (define_expand "fmaddsub_<mode>"
3938 [(set (match_operand:VF 0 "register_operand")
3940 [(match_operand:VF 1 "nonimmediate_operand")
3941 (match_operand:VF 2 "nonimmediate_operand")
3942 (match_operand:VF 3 "nonimmediate_operand")]
3944 "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F")
3946 (define_expand "<avx512>_fmaddsub_<mode>_maskz<round_expand_name>"
3947 [(match_operand:VF_AVX512VL 0 "register_operand")
3948 (match_operand:VF_AVX512VL 1 "<round_expand_nimm_predicate>")
3949 (match_operand:VF_AVX512VL 2 "<round_expand_nimm_predicate>")
3950 (match_operand:VF_AVX512VL 3 "<round_expand_nimm_predicate>")
3951 (match_operand:<avx512fmaskmode> 4 "register_operand")]
3954 emit_insn (gen_fma_fmaddsub_<mode>_maskz_1<round_expand_name> (
3955 operands[0], operands[1], operands[2], operands[3],
3956 CONST0_RTX (<MODE>mode), operands[4]<round_expand_operand>));
3960 (define_insn "*fma_fmaddsub_<mode>"
3961 [(set (match_operand:VF_128_256 0 "register_operand" "=v,v,v,x,x")
3963 [(match_operand:VF_128_256 1 "nonimmediate_operand" "%0,0,v,x,x")
3964 (match_operand:VF_128_256 2 "nonimmediate_operand" "vm,v,vm,x,m")
3965 (match_operand:VF_128_256 3 "nonimmediate_operand" "v,vm,0,xm,x")]
3967 "TARGET_FMA || TARGET_FMA4"
3969 vfmaddsub132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
3970 vfmaddsub213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
3971 vfmaddsub231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
3972 vfmaddsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3973 vfmaddsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3974 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3975 (set_attr "type" "ssemuladd")
3976 (set_attr "mode" "<MODE>")])
3978 (define_insn "<sd_mask_codefor>fma_fmaddsub_<mode><sd_maskz_name><round_name>"
3979 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3980 (unspec:VF_SF_AVX512VL
3981 [(match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
3982 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3983 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0")]
3985 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3987 vfmaddsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3988 vfmaddsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3989 vfmaddsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
3990 [(set_attr "type" "ssemuladd")
3991 (set_attr "mode" "<MODE>")])
3993 (define_insn "<avx512>_fmaddsub_<mode>_mask<round_name>"
3994 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
3995 (vec_merge:VF_AVX512VL
3997 [(match_operand:VF_AVX512VL 1 "register_operand" "0,0")
3998 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
3999 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>")]
4002 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
4005 vfmaddsub132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
4006 vfmaddsub213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
4007 [(set_attr "type" "ssemuladd")
4008 (set_attr "mode" "<MODE>")])
4010 (define_insn "<avx512>_fmaddsub_<mode>_mask3<round_name>"
4011 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
4012 (vec_merge:VF_AVX512VL
4014 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
4015 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
4016 (match_operand:VF_AVX512VL 3 "register_operand" "0")]
4019 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
4021 "vfmaddsub231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
4022 [(set_attr "type" "ssemuladd")
4023 (set_attr "mode" "<MODE>")])
4025 (define_insn "*fma_fmsubadd_<mode>"
4026 [(set (match_operand:VF_128_256 0 "register_operand" "=v,v,v,x,x")
4028 [(match_operand:VF_128_256 1 "nonimmediate_operand" "%0,0,v,x,x")
4029 (match_operand:VF_128_256 2 "nonimmediate_operand" "vm,v,vm,x,m")
4031 (match_operand:VF_128_256 3 "nonimmediate_operand" "v,vm,0,xm,x"))]
4033 "TARGET_FMA || TARGET_FMA4"
4035 vfmsubadd132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
4036 vfmsubadd213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
4037 vfmsubadd231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
4038 vfmsubadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
4039 vfmsubadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
4040 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
4041 (set_attr "type" "ssemuladd")
4042 (set_attr "mode" "<MODE>")])
4044 (define_insn "<sd_mask_codefor>fma_fmsubadd_<mode><sd_maskz_name><round_name>"
4045 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
4046 (unspec:VF_SF_AVX512VL
4047 [(match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
4048 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
4050 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0"))]
4052 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
4054 vfmsubadd132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
4055 vfmsubadd213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
4056 vfmsubadd231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
4057 [(set_attr "type" "ssemuladd")
4058 (set_attr "mode" "<MODE>")])
4060 (define_insn "<avx512>_fmsubadd_<mode>_mask<round_name>"
4061 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
4062 (vec_merge:VF_AVX512VL
4064 [(match_operand:VF_AVX512VL 1 "register_operand" "0,0")
4065 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
4067 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>"))]
4070 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
4073 vfmsubadd132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
4074 vfmsubadd213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
4075 [(set_attr "type" "ssemuladd")
4076 (set_attr "mode" "<MODE>")])
4078 (define_insn "<avx512>_fmsubadd_<mode>_mask3<round_name>"
4079 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
4080 (vec_merge:VF_AVX512VL
4082 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
4083 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
4085 (match_operand:VF_AVX512VL 3 "register_operand" "0"))]
4088 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
4090 "vfmsubadd231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
4091 [(set_attr "type" "ssemuladd")
4092 (set_attr "mode" "<MODE>")])
4094 ;; FMA3 floating point scalar intrinsics. These merge result with
4095 ;; high-order elements from the destination register.
4097 (define_expand "fmai_vmfmadd_<mode><round_name>"
4098 [(set (match_operand:VF_128 0 "register_operand")
4101 (match_operand:VF_128 1 "<round_nimm_predicate>")
4102 (match_operand:VF_128 2 "<round_nimm_predicate>")
4103 (match_operand:VF_128 3 "<round_nimm_predicate>"))
4108 (define_insn "*fmai_fmadd_<mode>"
4109 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4112 (match_operand:VF_128 1 "<round_nimm_predicate>" " 0, 0")
4113 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>, v")
4114 (match_operand:VF_128 3 "<round_nimm_predicate>" " v,<round_constraint>"))
4117 "TARGET_FMA || TARGET_AVX512F"
4119 vfmadd132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
4120 vfmadd213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
4121 [(set_attr "type" "ssemuladd")
4122 (set_attr "mode" "<MODE>")])
4124 (define_insn "*fmai_fmsub_<mode>"
4125 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4128 (match_operand:VF_128 1 "<round_nimm_predicate>" "0,0")
4129 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>,v")
4131 (match_operand:VF_128 3 "<round_nimm_predicate>" " v,<round_constraint>")))
4134 "TARGET_FMA || TARGET_AVX512F"
4136 vfmsub132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
4137 vfmsub213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
4138 [(set_attr "type" "ssemuladd")
4139 (set_attr "mode" "<MODE>")])
4141 (define_insn "*fmai_fnmadd_<mode><round_name>"
4142 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4146 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>,v"))
4147 (match_operand:VF_128 1 "<round_nimm_predicate>" "0,0")
4148 (match_operand:VF_128 3 "<round_nimm_predicate>" "v,<round_constraint>"))
4151 "TARGET_FMA || TARGET_AVX512F"
4153 vfnmadd132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
4154 vfnmadd213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
4155 [(set_attr "type" "ssemuladd")
4156 (set_attr "mode" "<MODE>")])
4158 (define_insn "*fmai_fnmsub_<mode><round_name>"
4159 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4163 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>, v"))
4164 (match_operand:VF_128 1 "<round_nimm_predicate>" " 0, 0")
4166 (match_operand:VF_128 3 "<round_nimm_predicate>" " v,<round_constraint>")))
4169 "TARGET_FMA || TARGET_AVX512F"
4171 vfnmsub132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
4172 vfnmsub213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
4173 [(set_attr "type" "ssemuladd")
4174 (set_attr "mode" "<MODE>")])
4176 ;; FMA4 floating point scalar intrinsics. These write the
4177 ;; entire destination register, with the high-order elements zeroed.
4179 (define_expand "fma4i_vmfmadd_<mode>"
4180 [(set (match_operand:VF_128 0 "register_operand")
4183 (match_operand:VF_128 1 "nonimmediate_operand")
4184 (match_operand:VF_128 2 "nonimmediate_operand")
4185 (match_operand:VF_128 3 "nonimmediate_operand"))
4189 "operands[4] = CONST0_RTX (<MODE>mode);")
4191 (define_insn "*fma4i_vmfmadd_<mode>"
4192 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
4195 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x")
4196 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
4197 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x"))
4198 (match_operand:VF_128 4 "const0_operand")
4201 "vfmadd<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
4202 [(set_attr "type" "ssemuladd")
4203 (set_attr "mode" "<MODE>")])
4205 (define_insn "*fma4i_vmfmsub_<mode>"
4206 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
4209 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x")
4210 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
4212 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x")))
4213 (match_operand:VF_128 4 "const0_operand")
4216 "vfmsub<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
4217 [(set_attr "type" "ssemuladd")
4218 (set_attr "mode" "<MODE>")])
4220 (define_insn "*fma4i_vmfnmadd_<mode>"
4221 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
4225 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x"))
4226 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
4227 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x"))
4228 (match_operand:VF_128 4 "const0_operand")
4231 "vfnmadd<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
4232 [(set_attr "type" "ssemuladd")
4233 (set_attr "mode" "<MODE>")])
4235 (define_insn "*fma4i_vmfnmsub_<mode>"
4236 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
4240 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x"))
4241 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
4243 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x")))
4244 (match_operand:VF_128 4 "const0_operand")
4247 "vfnmsub<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
4248 [(set_attr "type" "ssemuladd")
4249 (set_attr "mode" "<MODE>")])
4251 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4253 ;; Parallel single-precision floating point conversion operations
4255 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4257 (define_insn "sse_cvtpi2ps"
4258 [(set (match_operand:V4SF 0 "register_operand" "=x")
4261 (float:V2SF (match_operand:V2SI 2 "nonimmediate_operand" "ym")))
4262 (match_operand:V4SF 1 "register_operand" "0")
4265 "cvtpi2ps\t{%2, %0|%0, %2}"
4266 [(set_attr "type" "ssecvt")
4267 (set_attr "mode" "V4SF")])
4269 (define_insn "sse_cvtps2pi"
4270 [(set (match_operand:V2SI 0 "register_operand" "=y")
4272 (unspec:V4SI [(match_operand:V4SF 1 "nonimmediate_operand" "xm")]
4274 (parallel [(const_int 0) (const_int 1)])))]
4276 "cvtps2pi\t{%1, %0|%0, %q1}"
4277 [(set_attr "type" "ssecvt")
4278 (set_attr "unit" "mmx")
4279 (set_attr "mode" "DI")])
4281 (define_insn "sse_cvttps2pi"
4282 [(set (match_operand:V2SI 0 "register_operand" "=y")
4284 (fix:V4SI (match_operand:V4SF 1 "nonimmediate_operand" "xm"))
4285 (parallel [(const_int 0) (const_int 1)])))]
4287 "cvttps2pi\t{%1, %0|%0, %q1}"
4288 [(set_attr "type" "ssecvt")
4289 (set_attr "unit" "mmx")
4290 (set_attr "prefix_rep" "0")
4291 (set_attr "mode" "SF")])
4293 (define_insn "sse_cvtsi2ss<round_name>"
4294 [(set (match_operand:V4SF 0 "register_operand" "=x,x,v")
4297 (float:SF (match_operand:SI 2 "<round_nimm_scalar_predicate>" "r,m,<round_constraint3>")))
4298 (match_operand:V4SF 1 "register_operand" "0,0,v")
4302 cvtsi2ss\t{%2, %0|%0, %2}
4303 cvtsi2ss\t{%2, %0|%0, %2}
4304 vcvtsi2ss\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4305 [(set_attr "isa" "noavx,noavx,avx")
4306 (set_attr "type" "sseicvt")
4307 (set_attr "athlon_decode" "vector,double,*")
4308 (set_attr "amdfam10_decode" "vector,double,*")
4309 (set_attr "bdver1_decode" "double,direct,*")
4310 (set_attr "btver2_decode" "double,double,double")
4311 (set_attr "znver1_decode" "double,double,double")
4312 (set_attr "prefix" "orig,orig,maybe_evex")
4313 (set_attr "mode" "SF")])
4315 (define_insn "sse_cvtsi2ssq<round_name>"
4316 [(set (match_operand:V4SF 0 "register_operand" "=x,x,v")
4319 (float:SF (match_operand:DI 2 "<round_nimm_scalar_predicate>" "r,m,<round_constraint3>")))
4320 (match_operand:V4SF 1 "register_operand" "0,0,v")
4322 "TARGET_SSE && TARGET_64BIT"
4324 cvtsi2ssq\t{%2, %0|%0, %2}
4325 cvtsi2ssq\t{%2, %0|%0, %2}
4326 vcvtsi2ssq\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4327 [(set_attr "isa" "noavx,noavx,avx")
4328 (set_attr "type" "sseicvt")
4329 (set_attr "athlon_decode" "vector,double,*")
4330 (set_attr "amdfam10_decode" "vector,double,*")
4331 (set_attr "bdver1_decode" "double,direct,*")
4332 (set_attr "btver2_decode" "double,double,double")
4333 (set_attr "length_vex" "*,*,4")
4334 (set_attr "prefix_rex" "1,1,*")
4335 (set_attr "prefix" "orig,orig,maybe_evex")
4336 (set_attr "mode" "SF")])
4338 (define_insn "sse_cvtss2si<round_name>"
4339 [(set (match_operand:SI 0 "register_operand" "=r,r")
4342 (match_operand:V4SF 1 "<round_nimm_scalar_predicate>" "v,<round_constraint2>")
4343 (parallel [(const_int 0)]))]
4344 UNSPEC_FIX_NOTRUNC))]
4346 "%vcvtss2si\t{<round_op2>%1, %0|%0, %k1<round_op2>}"
4347 [(set_attr "type" "sseicvt")
4348 (set_attr "athlon_decode" "double,vector")
4349 (set_attr "bdver1_decode" "double,double")
4350 (set_attr "prefix_rep" "1")
4351 (set_attr "prefix" "maybe_vex")
4352 (set_attr "mode" "SI")])
4354 (define_insn "sse_cvtss2si_2"
4355 [(set (match_operand:SI 0 "register_operand" "=r,r")
4356 (unspec:SI [(match_operand:SF 1 "nonimmediate_operand" "v,m")]
4357 UNSPEC_FIX_NOTRUNC))]
4359 "%vcvtss2si\t{%1, %0|%0, %k1}"
4360 [(set_attr "type" "sseicvt")
4361 (set_attr "athlon_decode" "double,vector")
4362 (set_attr "amdfam10_decode" "double,double")
4363 (set_attr "bdver1_decode" "double,double")
4364 (set_attr "prefix_rep" "1")
4365 (set_attr "prefix" "maybe_vex")
4366 (set_attr "mode" "SI")])
4368 (define_insn "sse_cvtss2siq<round_name>"
4369 [(set (match_operand:DI 0 "register_operand" "=r,r")
4372 (match_operand:V4SF 1 "<round_nimm_scalar_predicate>" "v,<round_constraint2>")
4373 (parallel [(const_int 0)]))]
4374 UNSPEC_FIX_NOTRUNC))]
4375 "TARGET_SSE && TARGET_64BIT"
4376 "%vcvtss2si{q}\t{<round_op2>%1, %0|%0, %k1<round_op2>}"
4377 [(set_attr "type" "sseicvt")
4378 (set_attr "athlon_decode" "double,vector")
4379 (set_attr "bdver1_decode" "double,double")
4380 (set_attr "prefix_rep" "1")
4381 (set_attr "prefix" "maybe_vex")
4382 (set_attr "mode" "DI")])
4384 (define_insn "sse_cvtss2siq_2"
4385 [(set (match_operand:DI 0 "register_operand" "=r,r")
4386 (unspec:DI [(match_operand:SF 1 "nonimmediate_operand" "v,m")]
4387 UNSPEC_FIX_NOTRUNC))]
4388 "TARGET_SSE && TARGET_64BIT"
4389 "%vcvtss2si{q}\t{%1, %0|%0, %k1}"
4390 [(set_attr "type" "sseicvt")
4391 (set_attr "athlon_decode" "double,vector")
4392 (set_attr "amdfam10_decode" "double,double")
4393 (set_attr "bdver1_decode" "double,double")
4394 (set_attr "prefix_rep" "1")
4395 (set_attr "prefix" "maybe_vex")
4396 (set_attr "mode" "DI")])
4398 (define_insn "sse_cvttss2si<round_saeonly_name>"
4399 [(set (match_operand:SI 0 "register_operand" "=r,r")
4402 (match_operand:V4SF 1 "<round_saeonly_nimm_scalar_predicate>" "v,<round_saeonly_constraint2>")
4403 (parallel [(const_int 0)]))))]
4405 "%vcvttss2si\t{<round_saeonly_op2>%1, %0|%0, %k1<round_saeonly_op2>}"
4406 [(set_attr "type" "sseicvt")
4407 (set_attr "athlon_decode" "double,vector")
4408 (set_attr "amdfam10_decode" "double,double")
4409 (set_attr "bdver1_decode" "double,double")
4410 (set_attr "prefix_rep" "1")
4411 (set_attr "prefix" "maybe_vex")
4412 (set_attr "mode" "SI")])
4414 (define_insn "sse_cvttss2siq<round_saeonly_name>"
4415 [(set (match_operand:DI 0 "register_operand" "=r,r")
4418 (match_operand:V4SF 1 "<round_saeonly_nimm_scalar_predicate>" "v,<round_saeonly_constraint>")
4419 (parallel [(const_int 0)]))))]
4420 "TARGET_SSE && TARGET_64BIT"
4421 "%vcvttss2si{q}\t{<round_saeonly_op2>%1, %0|%0, %k1<round_saeonly_op2>}"
4422 [(set_attr "type" "sseicvt")
4423 (set_attr "athlon_decode" "double,vector")
4424 (set_attr "amdfam10_decode" "double,double")
4425 (set_attr "bdver1_decode" "double,double")
4426 (set_attr "prefix_rep" "1")
4427 (set_attr "prefix" "maybe_vex")
4428 (set_attr "mode" "DI")])
4430 (define_insn "cvtusi2<ssescalarmodesuffix>32<round_name>"
4431 [(set (match_operand:VF_128 0 "register_operand" "=v")
4433 (vec_duplicate:VF_128
4434 (unsigned_float:<ssescalarmode>
4435 (match_operand:SI 2 "<round_nimm_predicate>" "<round_constraint3>")))
4436 (match_operand:VF_128 1 "register_operand" "v")
4438 "TARGET_AVX512F && <round_modev4sf_condition>"
4439 "vcvtusi2<ssescalarmodesuffix>\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4440 [(set_attr "type" "sseicvt")
4441 (set_attr "prefix" "evex")
4442 (set_attr "mode" "<ssescalarmode>")])
4444 (define_insn "cvtusi2<ssescalarmodesuffix>64<round_name>"
4445 [(set (match_operand:VF_128 0 "register_operand" "=v")
4447 (vec_duplicate:VF_128
4448 (unsigned_float:<ssescalarmode>
4449 (match_operand:DI 2 "<round_nimm_predicate>" "<round_constraint3>")))
4450 (match_operand:VF_128 1 "register_operand" "v")
4452 "TARGET_AVX512F && TARGET_64BIT"
4453 "vcvtusi2<ssescalarmodesuffix>\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4454 [(set_attr "type" "sseicvt")
4455 (set_attr "prefix" "evex")
4456 (set_attr "mode" "<ssescalarmode>")])
4458 (define_insn "float<sseintvecmodelower><mode>2<mask_name><round_name>"
4459 [(set (match_operand:VF1 0 "register_operand" "=x,v")
4461 (match_operand:<sseintvecmode> 1 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
4462 "TARGET_SSE2 && <mask_mode512bit_condition> && <round_mode512bit_condition>"
4464 cvtdq2ps\t{%1, %0|%0, %1}
4465 vcvtdq2ps\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4466 [(set_attr "isa" "noavx,avx")
4467 (set_attr "type" "ssecvt")
4468 (set_attr "prefix" "maybe_vex")
4469 (set_attr "mode" "<sseinsnmode>")])
4471 (define_insn "ufloat<sseintvecmodelower><mode>2<mask_name><round_name>"
4472 [(set (match_operand:VF1_AVX512VL 0 "register_operand" "=v")
4473 (unsigned_float:VF1_AVX512VL
4474 (match_operand:<sseintvecmode> 1 "nonimmediate_operand" "<round_constraint>")))]
4476 "vcvtudq2ps\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4477 [(set_attr "type" "ssecvt")
4478 (set_attr "prefix" "evex")
4479 (set_attr "mode" "<MODE>")])
4481 (define_expand "floatuns<sseintvecmodelower><mode>2"
4482 [(match_operand:VF1 0 "register_operand")
4483 (match_operand:<sseintvecmode> 1 "register_operand")]
4484 "TARGET_SSE2 && (<MODE>mode == V4SFmode || TARGET_AVX2)"
4486 if (<MODE>mode == V16SFmode)
4487 emit_insn (gen_ufloatv16siv16sf2 (operands[0], operands[1]));
4489 if (TARGET_AVX512VL)
4491 if (<MODE>mode == V4SFmode)
4492 emit_insn (gen_ufloatv4siv4sf2 (operands[0], operands[1]));
4494 emit_insn (gen_ufloatv8siv8sf2 (operands[0], operands[1]));
4497 ix86_expand_vector_convert_uns_vsivsf (operands[0], operands[1]);
4503 ;; For <sse2_avx_avx512f>_fix_notrunc<sf2simodelower><mode> insn pattern
4504 (define_mode_attr sf2simodelower
4505 [(V16SI "v16sf") (V8SI "v8sf") (V4SI "v4sf")])
4507 (define_insn "<sse2_avx_avx512f>_fix_notrunc<sf2simodelower><mode><mask_name>"
4508 [(set (match_operand:VI4_AVX 0 "register_operand" "=v")
4510 [(match_operand:<ssePSmode> 1 "vector_operand" "vBm")]
4511 UNSPEC_FIX_NOTRUNC))]
4512 "TARGET_SSE2 && <mask_mode512bit_condition>"
4513 "%vcvtps2dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4514 [(set_attr "type" "ssecvt")
4515 (set (attr "prefix_data16")
4517 (match_test "TARGET_AVX")
4519 (const_string "1")))
4520 (set_attr "prefix" "maybe_vex")
4521 (set_attr "mode" "<sseinsnmode>")])
4523 (define_insn "avx512f_fix_notruncv16sfv16si<mask_name><round_name>"
4524 [(set (match_operand:V16SI 0 "register_operand" "=v")
4526 [(match_operand:V16SF 1 "<round_nimm_predicate>" "<round_constraint>")]
4527 UNSPEC_FIX_NOTRUNC))]
4529 "vcvtps2dq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4530 [(set_attr "type" "ssecvt")
4531 (set_attr "prefix" "evex")
4532 (set_attr "mode" "XI")])
4534 (define_insn "<mask_codefor><avx512>_ufix_notrunc<sf2simodelower><mode><mask_name><round_name>"
4535 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
4536 (unspec:VI4_AVX512VL
4537 [(match_operand:<ssePSmode> 1 "nonimmediate_operand" "<round_constraint>")]
4538 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4540 "vcvtps2udq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4541 [(set_attr "type" "ssecvt")
4542 (set_attr "prefix" "evex")
4543 (set_attr "mode" "<sseinsnmode>")])
4545 (define_insn "<mask_codefor>avx512dq_cvtps2qq<mode><mask_name><round_name>"
4546 [(set (match_operand:VI8_256_512 0 "register_operand" "=v")
4547 (unspec:VI8_256_512 [(match_operand:<ssePSmode2> 1 "nonimmediate_operand" "<round_constraint>")]
4548 UNSPEC_FIX_NOTRUNC))]
4549 "TARGET_AVX512DQ && <round_mode512bit_condition>"
4550 "vcvtps2qq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4551 [(set_attr "type" "ssecvt")
4552 (set_attr "prefix" "evex")
4553 (set_attr "mode" "<sseinsnmode>")])
4555 (define_insn "<mask_codefor>avx512dq_cvtps2qqv2di<mask_name>"
4556 [(set (match_operand:V2DI 0 "register_operand" "=v")
4559 (match_operand:V4SF 1 "nonimmediate_operand" "vm")
4560 (parallel [(const_int 0) (const_int 1)]))]
4561 UNSPEC_FIX_NOTRUNC))]
4562 "TARGET_AVX512DQ && TARGET_AVX512VL"
4563 "vcvtps2qq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
4564 [(set_attr "type" "ssecvt")
4565 (set_attr "prefix" "evex")
4566 (set_attr "mode" "TI")])
4568 (define_insn "<mask_codefor>avx512dq_cvtps2uqq<mode><mask_name><round_name>"
4569 [(set (match_operand:VI8_256_512 0 "register_operand" "=v")
4570 (unspec:VI8_256_512 [(match_operand:<ssePSmode2> 1 "nonimmediate_operand" "<round_constraint>")]
4571 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4572 "TARGET_AVX512DQ && <round_mode512bit_condition>"
4573 "vcvtps2uqq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4574 [(set_attr "type" "ssecvt")
4575 (set_attr "prefix" "evex")
4576 (set_attr "mode" "<sseinsnmode>")])
4578 (define_insn "<mask_codefor>avx512dq_cvtps2uqqv2di<mask_name>"
4579 [(set (match_operand:V2DI 0 "register_operand" "=v")
4582 (match_operand:V4SF 1 "nonimmediate_operand" "vm")
4583 (parallel [(const_int 0) (const_int 1)]))]
4584 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4585 "TARGET_AVX512DQ && TARGET_AVX512VL"
4586 "vcvtps2uqq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
4587 [(set_attr "type" "ssecvt")
4588 (set_attr "prefix" "evex")
4589 (set_attr "mode" "TI")])
4591 (define_insn "<fixsuffix>fix_truncv16sfv16si2<mask_name><round_saeonly_name>"
4592 [(set (match_operand:V16SI 0 "register_operand" "=v")
4594 (match_operand:V16SF 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
4596 "vcvttps2<fixsuffix>dq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
4597 [(set_attr "type" "ssecvt")
4598 (set_attr "prefix" "evex")
4599 (set_attr "mode" "XI")])
4601 (define_insn "fix_truncv8sfv8si2<mask_name>"
4602 [(set (match_operand:V8SI 0 "register_operand" "=v")
4603 (fix:V8SI (match_operand:V8SF 1 "nonimmediate_operand" "vm")))]
4604 "TARGET_AVX && <mask_avx512vl_condition>"
4605 "vcvttps2dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4606 [(set_attr "type" "ssecvt")
4607 (set_attr "prefix" "<mask_prefix>")
4608 (set_attr "mode" "OI")])
4610 (define_insn "fix_truncv4sfv4si2<mask_name>"
4611 [(set (match_operand:V4SI 0 "register_operand" "=v")
4612 (fix:V4SI (match_operand:V4SF 1 "vector_operand" "vBm")))]
4613 "TARGET_SSE2 && <mask_avx512vl_condition>"
4614 "%vcvttps2dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4615 [(set_attr "type" "ssecvt")
4616 (set (attr "prefix_rep")
4618 (match_test "TARGET_AVX")
4620 (const_string "1")))
4621 (set (attr "prefix_data16")
4623 (match_test "TARGET_AVX")
4625 (const_string "0")))
4626 (set_attr "prefix_data16" "0")
4627 (set_attr "prefix" "<mask_prefix2>")
4628 (set_attr "mode" "TI")])
4630 (define_expand "fixuns_trunc<mode><sseintvecmodelower>2"
4631 [(match_operand:<sseintvecmode> 0 "register_operand")
4632 (match_operand:VF1 1 "register_operand")]
4635 if (<MODE>mode == V16SFmode)
4636 emit_insn (gen_ufix_truncv16sfv16si2 (operands[0],
4641 tmp[0] = ix86_expand_adjust_ufix_to_sfix_si (operands[1], &tmp[2]);
4642 tmp[1] = gen_reg_rtx (<sseintvecmode>mode);
4643 emit_insn (gen_fix_trunc<mode><sseintvecmodelower>2 (tmp[1], tmp[0]));
4644 emit_insn (gen_xor<sseintvecmodelower>3 (operands[0], tmp[1], tmp[2]));
4649 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4651 ;; Parallel double-precision floating point conversion operations
4653 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4655 (define_insn "sse2_cvtpi2pd"
4656 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
4657 (float:V2DF (match_operand:V2SI 1 "nonimmediate_operand" "y,m")))]
4659 "cvtpi2pd\t{%1, %0|%0, %1}"
4660 [(set_attr "type" "ssecvt")
4661 (set_attr "unit" "mmx,*")
4662 (set_attr "prefix_data16" "1,*")
4663 (set_attr "mode" "V2DF")])
4665 (define_insn "sse2_cvtpd2pi"
4666 [(set (match_operand:V2SI 0 "register_operand" "=y")
4667 (unspec:V2SI [(match_operand:V2DF 1 "nonimmediate_operand" "xm")]
4668 UNSPEC_FIX_NOTRUNC))]
4670 "cvtpd2pi\t{%1, %0|%0, %1}"
4671 [(set_attr "type" "ssecvt")
4672 (set_attr "unit" "mmx")
4673 (set_attr "bdver1_decode" "double")
4674 (set_attr "btver2_decode" "direct")
4675 (set_attr "prefix_data16" "1")
4676 (set_attr "mode" "DI")])
4678 (define_insn "sse2_cvttpd2pi"
4679 [(set (match_operand:V2SI 0 "register_operand" "=y")
4680 (fix:V2SI (match_operand:V2DF 1 "nonimmediate_operand" "xm")))]
4682 "cvttpd2pi\t{%1, %0|%0, %1}"
4683 [(set_attr "type" "ssecvt")
4684 (set_attr "unit" "mmx")
4685 (set_attr "bdver1_decode" "double")
4686 (set_attr "prefix_data16" "1")
4687 (set_attr "mode" "TI")])
4689 (define_insn "sse2_cvtsi2sd"
4690 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
4693 (float:DF (match_operand:SI 2 "nonimmediate_operand" "r,m,rm")))
4694 (match_operand:V2DF 1 "register_operand" "0,0,v")
4698 cvtsi2sd\t{%2, %0|%0, %2}
4699 cvtsi2sd\t{%2, %0|%0, %2}
4700 vcvtsi2sd\t{%2, %1, %0|%0, %1, %2}"
4701 [(set_attr "isa" "noavx,noavx,avx")
4702 (set_attr "type" "sseicvt")
4703 (set_attr "athlon_decode" "double,direct,*")
4704 (set_attr "amdfam10_decode" "vector,double,*")
4705 (set_attr "bdver1_decode" "double,direct,*")
4706 (set_attr "btver2_decode" "double,double,double")
4707 (set_attr "znver1_decode" "double,double,double")
4708 (set_attr "prefix" "orig,orig,maybe_evex")
4709 (set_attr "mode" "DF")])
4711 (define_insn "sse2_cvtsi2sdq<round_name>"
4712 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
4715 (float:DF (match_operand:DI 2 "<round_nimm_scalar_predicate>" "r,m,<round_constraint3>")))
4716 (match_operand:V2DF 1 "register_operand" "0,0,v")
4718 "TARGET_SSE2 && TARGET_64BIT"
4720 cvtsi2sdq\t{%2, %0|%0, %2}
4721 cvtsi2sdq\t{%2, %0|%0, %2}
4722 vcvtsi2sdq\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4723 [(set_attr "isa" "noavx,noavx,avx")
4724 (set_attr "type" "sseicvt")
4725 (set_attr "athlon_decode" "double,direct,*")
4726 (set_attr "amdfam10_decode" "vector,double,*")
4727 (set_attr "bdver1_decode" "double,direct,*")
4728 (set_attr "length_vex" "*,*,4")
4729 (set_attr "prefix_rex" "1,1,*")
4730 (set_attr "prefix" "orig,orig,maybe_evex")
4731 (set_attr "mode" "DF")])
4733 (define_insn "avx512f_vcvtss2usi<round_name>"
4734 [(set (match_operand:SI 0 "register_operand" "=r")
4737 (match_operand:V4SF 1 "<round_nimm_predicate>" "<round_constraint>")
4738 (parallel [(const_int 0)]))]
4739 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4741 "vcvtss2usi\t{<round_op2>%1, %0|%0, %1<round_op2>}"
4742 [(set_attr "type" "sseicvt")
4743 (set_attr "prefix" "evex")
4744 (set_attr "mode" "SI")])
4746 (define_insn "avx512f_vcvtss2usiq<round_name>"
4747 [(set (match_operand:DI 0 "register_operand" "=r")
4750 (match_operand:V4SF 1 "<round_nimm_predicate>" "<round_constraint>")
4751 (parallel [(const_int 0)]))]
4752 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4753 "TARGET_AVX512F && TARGET_64BIT"
4754 "vcvtss2usi\t{<round_op2>%1, %0|%0, %1<round_op2>}"
4755 [(set_attr "type" "sseicvt")
4756 (set_attr "prefix" "evex")
4757 (set_attr "mode" "DI")])
4759 (define_insn "avx512f_vcvttss2usi<round_saeonly_name>"
4760 [(set (match_operand:SI 0 "register_operand" "=r")
4763 (match_operand:V4SF 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
4764 (parallel [(const_int 0)]))))]
4766 "vcvttss2usi\t{<round_saeonly_op2>%1, %0|%0, %1<round_saeonly_op2>}"
4767 [(set_attr "type" "sseicvt")
4768 (set_attr "prefix" "evex")
4769 (set_attr "mode" "SI")])
4771 (define_insn "avx512f_vcvttss2usiq<round_saeonly_name>"
4772 [(set (match_operand:DI 0 "register_operand" "=r")
4775 (match_operand:V4SF 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
4776 (parallel [(const_int 0)]))))]
4777 "TARGET_AVX512F && TARGET_64BIT"
4778 "vcvttss2usi\t{<round_saeonly_op2>%1, %0|%0, %1<round_saeonly_op2>}"
4779 [(set_attr "type" "sseicvt")
4780 (set_attr "prefix" "evex")
4781 (set_attr "mode" "DI")])
4783 (define_insn "avx512f_vcvtsd2usi<round_name>"
4784 [(set (match_operand:SI 0 "register_operand" "=r")
4787 (match_operand:V2DF 1 "<round_nimm_predicate>" "<round_constraint>")
4788 (parallel [(const_int 0)]))]
4789 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4791 "vcvtsd2usi\t{<round_op2>%1, %0|%0, %1<round_op2>}"
4792 [(set_attr "type" "sseicvt")
4793 (set_attr "prefix" "evex")
4794 (set_attr "mode" "SI")])
4796 (define_insn "avx512f_vcvtsd2usiq<round_name>"
4797 [(set (match_operand:DI 0 "register_operand" "=r")
4800 (match_operand:V2DF 1 "<round_nimm_predicate>" "<round_constraint>")
4801 (parallel [(const_int 0)]))]
4802 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4803 "TARGET_AVX512F && TARGET_64BIT"
4804 "vcvtsd2usi\t{<round_op2>%1, %0|%0, %1<round_op2>}"
4805 [(set_attr "type" "sseicvt")
4806 (set_attr "prefix" "evex")
4807 (set_attr "mode" "DI")])
4809 (define_insn "avx512f_vcvttsd2usi<round_saeonly_name>"
4810 [(set (match_operand:SI 0 "register_operand" "=r")
4813 (match_operand:V2DF 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
4814 (parallel [(const_int 0)]))))]
4816 "vcvttsd2usi\t{<round_saeonly_op2>%1, %0|%0, %1<round_saeonly_op2>}"
4817 [(set_attr "type" "sseicvt")
4818 (set_attr "prefix" "evex")
4819 (set_attr "mode" "SI")])
4821 (define_insn "avx512f_vcvttsd2usiq<round_saeonly_name>"
4822 [(set (match_operand:DI 0 "register_operand" "=r")
4825 (match_operand:V2DF 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
4826 (parallel [(const_int 0)]))))]
4827 "TARGET_AVX512F && TARGET_64BIT"
4828 "vcvttsd2usi\t{<round_saeonly_op2>%1, %0|%0, %1<round_saeonly_op2>}"
4829 [(set_attr "type" "sseicvt")
4830 (set_attr "prefix" "evex")
4831 (set_attr "mode" "DI")])
4833 (define_insn "sse2_cvtsd2si<round_name>"
4834 [(set (match_operand:SI 0 "register_operand" "=r,r")
4837 (match_operand:V2DF 1 "<round_nimm_scalar_predicate>" "v,<round_constraint2>")
4838 (parallel [(const_int 0)]))]
4839 UNSPEC_FIX_NOTRUNC))]
4841 "%vcvtsd2si\t{<round_op2>%1, %0|%0, %q1<round_op2>}"
4842 [(set_attr "type" "sseicvt")
4843 (set_attr "athlon_decode" "double,vector")
4844 (set_attr "bdver1_decode" "double,double")
4845 (set_attr "btver2_decode" "double,double")
4846 (set_attr "prefix_rep" "1")
4847 (set_attr "prefix" "maybe_vex")
4848 (set_attr "mode" "SI")])
4850 (define_insn "sse2_cvtsd2si_2"
4851 [(set (match_operand:SI 0 "register_operand" "=r,r")
4852 (unspec:SI [(match_operand:DF 1 "nonimmediate_operand" "v,m")]
4853 UNSPEC_FIX_NOTRUNC))]
4855 "%vcvtsd2si\t{%1, %0|%0, %q1}"
4856 [(set_attr "type" "sseicvt")
4857 (set_attr "athlon_decode" "double,vector")
4858 (set_attr "amdfam10_decode" "double,double")
4859 (set_attr "bdver1_decode" "double,double")
4860 (set_attr "prefix_rep" "1")
4861 (set_attr "prefix" "maybe_vex")
4862 (set_attr "mode" "SI")])
4864 (define_insn "sse2_cvtsd2siq<round_name>"
4865 [(set (match_operand:DI 0 "register_operand" "=r,r")
4868 (match_operand:V2DF 1 "<round_nimm_scalar_predicate>" "v,<round_constraint2>")
4869 (parallel [(const_int 0)]))]
4870 UNSPEC_FIX_NOTRUNC))]
4871 "TARGET_SSE2 && TARGET_64BIT"
4872 "%vcvtsd2si{q}\t{<round_op2>%1, %0|%0, %q1<round_op2>}"
4873 [(set_attr "type" "sseicvt")
4874 (set_attr "athlon_decode" "double,vector")
4875 (set_attr "bdver1_decode" "double,double")
4876 (set_attr "prefix_rep" "1")
4877 (set_attr "prefix" "maybe_vex")
4878 (set_attr "mode" "DI")])
4880 (define_insn "sse2_cvtsd2siq_2"
4881 [(set (match_operand:DI 0 "register_operand" "=r,r")
4882 (unspec:DI [(match_operand:DF 1 "nonimmediate_operand" "v,m")]
4883 UNSPEC_FIX_NOTRUNC))]
4884 "TARGET_SSE2 && TARGET_64BIT"
4885 "%vcvtsd2si{q}\t{%1, %0|%0, %q1}"
4886 [(set_attr "type" "sseicvt")
4887 (set_attr "athlon_decode" "double,vector")
4888 (set_attr "amdfam10_decode" "double,double")
4889 (set_attr "bdver1_decode" "double,double")
4890 (set_attr "prefix_rep" "1")
4891 (set_attr "prefix" "maybe_vex")
4892 (set_attr "mode" "DI")])
4894 (define_insn "sse2_cvttsd2si<round_saeonly_name>"
4895 [(set (match_operand:SI 0 "register_operand" "=r,r")
4898 (match_operand:V2DF 1 "<round_saeonly_nimm_scalar_predicate>" "v,<round_saeonly_constraint2>")
4899 (parallel [(const_int 0)]))))]
4901 "%vcvttsd2si\t{<round_saeonly_op2>%1, %0|%0, %q1<round_saeonly_op2>}"
4902 [(set_attr "type" "sseicvt")
4903 (set_attr "athlon_decode" "double,vector")
4904 (set_attr "amdfam10_decode" "double,double")
4905 (set_attr "bdver1_decode" "double,double")
4906 (set_attr "btver2_decode" "double,double")
4907 (set_attr "prefix_rep" "1")
4908 (set_attr "prefix" "maybe_vex")
4909 (set_attr "mode" "SI")])
4911 (define_insn "sse2_cvttsd2siq<round_saeonly_name>"
4912 [(set (match_operand:DI 0 "register_operand" "=r,r")
4915 (match_operand:V2DF 1 "<round_saeonly_nimm_scalar_predicate>" "v,<round_saeonly_constraint2>")
4916 (parallel [(const_int 0)]))))]
4917 "TARGET_SSE2 && TARGET_64BIT"
4918 "%vcvttsd2si{q}\t{<round_saeonly_op2>%1, %0|%0, %q1<round_saeonly_op2>}"
4919 [(set_attr "type" "sseicvt")
4920 (set_attr "athlon_decode" "double,vector")
4921 (set_attr "amdfam10_decode" "double,double")
4922 (set_attr "bdver1_decode" "double,double")
4923 (set_attr "prefix_rep" "1")
4924 (set_attr "prefix" "maybe_vex")
4925 (set_attr "mode" "DI")])
4927 ;; For float<si2dfmode><mode>2 insn pattern
4928 (define_mode_attr si2dfmode
4929 [(V8DF "V8SI") (V4DF "V4SI")])
4930 (define_mode_attr si2dfmodelower
4931 [(V8DF "v8si") (V4DF "v4si")])
4933 (define_insn "float<si2dfmodelower><mode>2<mask_name>"
4934 [(set (match_operand:VF2_512_256 0 "register_operand" "=v")
4935 (float:VF2_512_256 (match_operand:<si2dfmode> 1 "nonimmediate_operand" "vm")))]
4936 "TARGET_AVX && <mask_mode512bit_condition>"
4937 "vcvtdq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4938 [(set_attr "type" "ssecvt")
4939 (set_attr "prefix" "maybe_vex")
4940 (set_attr "mode" "<MODE>")])
4942 (define_insn "<floatsuffix>float<sseintvecmodelower><mode>2<mask_name><round_name>"
4943 [(set (match_operand:VF2_AVX512VL 0 "register_operand" "=v")
4944 (any_float:VF2_AVX512VL
4945 (match_operand:<sseintvecmode> 1 "nonimmediate_operand" "<round_constraint>")))]
4947 "vcvt<floatsuffix>qq2pd\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4948 [(set_attr "type" "ssecvt")
4949 (set_attr "prefix" "evex")
4950 (set_attr "mode" "<MODE>")])
4952 ;; For <floatsuffix>float<sselondveclower><mode> insn patterns
4953 (define_mode_attr qq2pssuff
4954 [(V8SF "") (V4SF "{y}")])
4956 (define_mode_attr sselongvecmode
4957 [(V8SF "V8DI") (V4SF "V4DI")])
4959 (define_mode_attr sselongvecmodelower
4960 [(V8SF "v8di") (V4SF "v4di")])
4962 (define_mode_attr sseintvecmode3
4963 [(V8SF "XI") (V4SF "OI")
4964 (V8DF "OI") (V4DF "TI")])
4966 (define_insn "<floatsuffix>float<sselongvecmodelower><mode>2<mask_name><round_name>"
4967 [(set (match_operand:VF1_128_256VL 0 "register_operand" "=v")
4968 (any_float:VF1_128_256VL
4969 (match_operand:<sselongvecmode> 1 "nonimmediate_operand" "<round_constraint>")))]
4970 "TARGET_AVX512DQ && <round_modev8sf_condition>"
4971 "vcvt<floatsuffix>qq2ps<qq2pssuff>\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4972 [(set_attr "type" "ssecvt")
4973 (set_attr "prefix" "evex")
4974 (set_attr "mode" "<MODE>")])
4976 (define_insn "*<floatsuffix>floatv2div2sf2"
4977 [(set (match_operand:V4SF 0 "register_operand" "=v")
4979 (any_float:V2SF (match_operand:V2DI 1 "nonimmediate_operand" "vm"))
4980 (const_vector:V2SF [(const_int 0) (const_int 0)])))]
4981 "TARGET_AVX512DQ && TARGET_AVX512VL"
4982 "vcvt<floatsuffix>qq2ps{x}\t{%1, %0|%0, %1}"
4983 [(set_attr "type" "ssecvt")
4984 (set_attr "prefix" "evex")
4985 (set_attr "mode" "V4SF")])
4987 (define_insn "<floatsuffix>floatv2div2sf2_mask"
4988 [(set (match_operand:V4SF 0 "register_operand" "=v")
4991 (any_float:V2SF (match_operand:V2DI 1 "nonimmediate_operand" "vm"))
4993 (match_operand:V4SF 2 "vector_move_operand" "0C")
4994 (parallel [(const_int 0) (const_int 1)]))
4995 (match_operand:QI 3 "register_operand" "Yk"))
4996 (const_vector:V2SF [(const_int 0) (const_int 0)])))]
4997 "TARGET_AVX512DQ && TARGET_AVX512VL"
4998 "vcvt<floatsuffix>qq2ps{x}\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
4999 [(set_attr "type" "ssecvt")
5000 (set_attr "prefix" "evex")
5001 (set_attr "mode" "V4SF")])
5003 (define_insn "*<floatsuffix>floatv2div2sf2_mask_1"
5004 [(set (match_operand:V4SF 0 "register_operand" "=v")
5007 (any_float:V2SF (match_operand:V2DI 1
5008 "nonimmediate_operand" "vm"))
5009 (const_vector:V2SF [(const_int 0) (const_int 0)])
5010 (match_operand:QI 2 "register_operand" "Yk"))
5011 (const_vector:V2SF [(const_int 0) (const_int 0)])))]
5012 "TARGET_AVX512DQ && TARGET_AVX512VL"
5013 "vcvt<floatsuffix>qq2ps{x}\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
5014 [(set_attr "type" "ssecvt")
5015 (set_attr "prefix" "evex")
5016 (set_attr "mode" "V4SF")])
5018 (define_insn "ufloat<si2dfmodelower><mode>2<mask_name>"
5019 [(set (match_operand:VF2_512_256VL 0 "register_operand" "=v")
5020 (unsigned_float:VF2_512_256VL
5021 (match_operand:<si2dfmode> 1 "nonimmediate_operand" "vm")))]
5023 "vcvtudq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5024 [(set_attr "type" "ssecvt")
5025 (set_attr "prefix" "evex")
5026 (set_attr "mode" "<MODE>")])
5028 (define_insn "ufloatv2siv2df2<mask_name>"
5029 [(set (match_operand:V2DF 0 "register_operand" "=v")
5030 (unsigned_float:V2DF
5032 (match_operand:V4SI 1 "nonimmediate_operand" "vm")
5033 (parallel [(const_int 0) (const_int 1)]))))]
5035 "vcvtudq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5036 [(set_attr "type" "ssecvt")
5037 (set_attr "prefix" "evex")
5038 (set_attr "mode" "V2DF")])
5040 (define_insn "avx512f_cvtdq2pd512_2"
5041 [(set (match_operand:V8DF 0 "register_operand" "=v")
5044 (match_operand:V16SI 1 "nonimmediate_operand" "vm")
5045 (parallel [(const_int 0) (const_int 1)
5046 (const_int 2) (const_int 3)
5047 (const_int 4) (const_int 5)
5048 (const_int 6) (const_int 7)]))))]
5050 "vcvtdq2pd\t{%t1, %0|%0, %t1}"
5051 [(set_attr "type" "ssecvt")
5052 (set_attr "prefix" "evex")
5053 (set_attr "mode" "V8DF")])
5055 (define_insn "avx_cvtdq2pd256_2"
5056 [(set (match_operand:V4DF 0 "register_operand" "=v")
5059 (match_operand:V8SI 1 "nonimmediate_operand" "vm")
5060 (parallel [(const_int 0) (const_int 1)
5061 (const_int 2) (const_int 3)]))))]
5063 "vcvtdq2pd\t{%x1, %0|%0, %x1}"
5064 [(set_attr "type" "ssecvt")
5065 (set_attr "prefix" "maybe_evex")
5066 (set_attr "mode" "V4DF")])
5068 (define_insn "sse2_cvtdq2pd<mask_name>"
5069 [(set (match_operand:V2DF 0 "register_operand" "=v")
5072 (match_operand:V4SI 1 "nonimmediate_operand" "vm")
5073 (parallel [(const_int 0) (const_int 1)]))))]
5074 "TARGET_SSE2 && <mask_avx512vl_condition>"
5075 "%vcvtdq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
5076 [(set_attr "type" "ssecvt")
5077 (set_attr "prefix" "maybe_vex")
5078 (set_attr "mode" "V2DF")])
5080 (define_insn "avx512f_cvtpd2dq512<mask_name><round_name>"
5081 [(set (match_operand:V8SI 0 "register_operand" "=v")
5083 [(match_operand:V8DF 1 "<round_nimm_predicate>" "<round_constraint>")]
5084 UNSPEC_FIX_NOTRUNC))]
5086 "vcvtpd2dq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5087 [(set_attr "type" "ssecvt")
5088 (set_attr "prefix" "evex")
5089 (set_attr "mode" "OI")])
5091 (define_insn "avx_cvtpd2dq256<mask_name>"
5092 [(set (match_operand:V4SI 0 "register_operand" "=v")
5093 (unspec:V4SI [(match_operand:V4DF 1 "nonimmediate_operand" "vm")]
5094 UNSPEC_FIX_NOTRUNC))]
5095 "TARGET_AVX && <mask_avx512vl_condition>"
5096 "vcvtpd2dq{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5097 [(set_attr "type" "ssecvt")
5098 (set_attr "prefix" "<mask_prefix>")
5099 (set_attr "mode" "OI")])
5101 (define_expand "avx_cvtpd2dq256_2"
5102 [(set (match_operand:V8SI 0 "register_operand")
5104 (unspec:V4SI [(match_operand:V4DF 1 "nonimmediate_operand")]
5108 "operands[2] = CONST0_RTX (V4SImode);")
5110 (define_insn "*avx_cvtpd2dq256_2"
5111 [(set (match_operand:V8SI 0 "register_operand" "=v")
5113 (unspec:V4SI [(match_operand:V4DF 1 "nonimmediate_operand" "vm")]
5115 (match_operand:V4SI 2 "const0_operand")))]
5117 "vcvtpd2dq{y}\t{%1, %x0|%x0, %1}"
5118 [(set_attr "type" "ssecvt")
5119 (set_attr "prefix" "vex")
5120 (set_attr "btver2_decode" "vector")
5121 (set_attr "mode" "OI")])
5123 (define_insn "sse2_cvtpd2dq<mask_name>"
5124 [(set (match_operand:V4SI 0 "register_operand" "=v")
5126 (unspec:V2SI [(match_operand:V2DF 1 "vector_operand" "vBm")]
5128 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
5129 "TARGET_SSE2 && <mask_avx512vl_condition>"
5132 return "vcvtpd2dq{x}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}";
5134 return "cvtpd2dq\t{%1, %0|%0, %1}";
5136 [(set_attr "type" "ssecvt")
5137 (set_attr "prefix_rep" "1")
5138 (set_attr "prefix_data16" "0")
5139 (set_attr "prefix" "maybe_vex")
5140 (set_attr "mode" "TI")
5141 (set_attr "amdfam10_decode" "double")
5142 (set_attr "athlon_decode" "vector")
5143 (set_attr "bdver1_decode" "double")])
5145 ;; For ufix_notrunc* insn patterns
5146 (define_mode_attr pd2udqsuff
5147 [(V8DF "") (V4DF "{y}")])
5149 (define_insn "ufix_notrunc<mode><si2dfmodelower>2<mask_name><round_name>"
5150 [(set (match_operand:<si2dfmode> 0 "register_operand" "=v")
5152 [(match_operand:VF2_512_256VL 1 "nonimmediate_operand" "<round_constraint>")]
5153 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
5155 "vcvtpd2udq<pd2udqsuff>\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5156 [(set_attr "type" "ssecvt")
5157 (set_attr "prefix" "evex")
5158 (set_attr "mode" "<sseinsnmode>")])
5160 (define_insn "ufix_notruncv2dfv2si2<mask_name>"
5161 [(set (match_operand:V4SI 0 "register_operand" "=v")
5164 [(match_operand:V2DF 1 "nonimmediate_operand" "vm")]
5165 UNSPEC_UNSIGNED_FIX_NOTRUNC)
5166 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
5168 "vcvtpd2udq{x}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5169 [(set_attr "type" "ssecvt")
5170 (set_attr "prefix" "evex")
5171 (set_attr "mode" "TI")])
5173 (define_insn "<fixsuffix>fix_truncv8dfv8si2<mask_name><round_saeonly_name>"
5174 [(set (match_operand:V8SI 0 "register_operand" "=v")
5176 (match_operand:V8DF 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
5178 "vcvttpd2<fixsuffix>dq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
5179 [(set_attr "type" "ssecvt")
5180 (set_attr "prefix" "evex")
5181 (set_attr "mode" "OI")])
5183 (define_insn "ufix_truncv2dfv2si2<mask_name>"
5184 [(set (match_operand:V4SI 0 "register_operand" "=v")
5186 (unsigned_fix:V2SI (match_operand:V2DF 1 "nonimmediate_operand" "vm"))
5187 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
5189 "vcvttpd2udq{x}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5190 [(set_attr "type" "ssecvt")
5191 (set_attr "prefix" "evex")
5192 (set_attr "mode" "TI")])
5194 (define_insn "fix_truncv4dfv4si2<mask_name>"
5195 [(set (match_operand:V4SI 0 "register_operand" "=v")
5196 (fix:V4SI (match_operand:V4DF 1 "nonimmediate_operand" "vm")))]
5197 "TARGET_AVX || (TARGET_AVX512VL && TARGET_AVX512F)"
5198 "vcvttpd2dq{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5199 [(set_attr "type" "ssecvt")
5200 (set_attr "prefix" "maybe_evex")
5201 (set_attr "mode" "OI")])
5203 (define_insn "ufix_truncv4dfv4si2<mask_name>"
5204 [(set (match_operand:V4SI 0 "register_operand" "=v")
5205 (unsigned_fix:V4SI (match_operand:V4DF 1 "nonimmediate_operand" "vm")))]
5206 "TARGET_AVX512VL && TARGET_AVX512F"
5207 "vcvttpd2udq{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5208 [(set_attr "type" "ssecvt")
5209 (set_attr "prefix" "maybe_evex")
5210 (set_attr "mode" "OI")])
5212 (define_insn "<fixsuffix>fix_trunc<mode><sseintvecmodelower>2<mask_name><round_saeonly_name>"
5213 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
5214 (any_fix:<sseintvecmode>
5215 (match_operand:VF2_AVX512VL 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
5216 "TARGET_AVX512DQ && <round_saeonly_mode512bit_condition>"
5217 "vcvttpd2<fixsuffix>qq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
5218 [(set_attr "type" "ssecvt")
5219 (set_attr "prefix" "evex")
5220 (set_attr "mode" "<sseintvecmode2>")])
5222 (define_insn "fix_notrunc<mode><sseintvecmodelower>2<mask_name><round_name>"
5223 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
5224 (unspec:<sseintvecmode>
5225 [(match_operand:VF2_AVX512VL 1 "<round_nimm_predicate>" "<round_constraint>")]
5226 UNSPEC_FIX_NOTRUNC))]
5227 "TARGET_AVX512DQ && <round_mode512bit_condition>"
5228 "vcvtpd2qq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5229 [(set_attr "type" "ssecvt")
5230 (set_attr "prefix" "evex")
5231 (set_attr "mode" "<sseintvecmode2>")])
5233 (define_insn "ufix_notrunc<mode><sseintvecmodelower>2<mask_name><round_name>"
5234 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
5235 (unspec:<sseintvecmode>
5236 [(match_operand:VF2_AVX512VL 1 "nonimmediate_operand" "<round_constraint>")]
5237 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
5238 "TARGET_AVX512DQ && <round_mode512bit_condition>"
5239 "vcvtpd2uqq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5240 [(set_attr "type" "ssecvt")
5241 (set_attr "prefix" "evex")
5242 (set_attr "mode" "<sseintvecmode2>")])
5244 (define_insn "<fixsuffix>fix_trunc<mode><sselongvecmodelower>2<mask_name><round_saeonly_name>"
5245 [(set (match_operand:<sselongvecmode> 0 "register_operand" "=v")
5246 (any_fix:<sselongvecmode>
5247 (match_operand:VF1_128_256VL 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
5248 "TARGET_AVX512DQ && <round_saeonly_modev8sf_condition>"
5249 "vcvttps2<fixsuffix>qq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
5250 [(set_attr "type" "ssecvt")
5251 (set_attr "prefix" "evex")
5252 (set_attr "mode" "<sseintvecmode3>")])
5254 (define_insn "<fixsuffix>fix_truncv2sfv2di2<mask_name>"
5255 [(set (match_operand:V2DI 0 "register_operand" "=v")
5258 (match_operand:V4SF 1 "nonimmediate_operand" "vm")
5259 (parallel [(const_int 0) (const_int 1)]))))]
5260 "TARGET_AVX512DQ && TARGET_AVX512VL"
5261 "vcvttps2<fixsuffix>qq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
5262 [(set_attr "type" "ssecvt")
5263 (set_attr "prefix" "evex")
5264 (set_attr "mode" "TI")])
5266 (define_insn "ufix_trunc<mode><sseintvecmodelower>2<mask_name>"
5267 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
5268 (unsigned_fix:<sseintvecmode>
5269 (match_operand:VF1_128_256VL 1 "nonimmediate_operand" "vm")))]
5271 "vcvttps2udq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5272 [(set_attr "type" "ssecvt")
5273 (set_attr "prefix" "evex")
5274 (set_attr "mode" "<sseintvecmode2>")])
5276 (define_expand "avx_cvttpd2dq256_2"
5277 [(set (match_operand:V8SI 0 "register_operand")
5279 (fix:V4SI (match_operand:V4DF 1 "nonimmediate_operand"))
5282 "operands[2] = CONST0_RTX (V4SImode);")
5284 (define_insn "sse2_cvttpd2dq<mask_name>"
5285 [(set (match_operand:V4SI 0 "register_operand" "=v")
5287 (fix:V2SI (match_operand:V2DF 1 "vector_operand" "vBm"))
5288 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
5289 "TARGET_SSE2 && <mask_avx512vl_condition>"
5292 return "vcvttpd2dq{x}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}";
5294 return "cvttpd2dq\t{%1, %0|%0, %1}";
5296 [(set_attr "type" "ssecvt")
5297 (set_attr "amdfam10_decode" "double")
5298 (set_attr "athlon_decode" "vector")
5299 (set_attr "bdver1_decode" "double")
5300 (set_attr "prefix" "maybe_vex")
5301 (set_attr "mode" "TI")])
5303 (define_insn "sse2_cvtsd2ss<round_name>"
5304 [(set (match_operand:V4SF 0 "register_operand" "=x,x,v")
5307 (float_truncate:V2SF
5308 (match_operand:V2DF 2 "nonimmediate_operand" "x,m,<round_constraint>")))
5309 (match_operand:V4SF 1 "register_operand" "0,0,v")
5313 cvtsd2ss\t{%2, %0|%0, %2}
5314 cvtsd2ss\t{%2, %0|%0, %q2}
5315 vcvtsd2ss\t{<round_op3>%2, %1, %0|%0, %1, %q2<round_op3>}"
5316 [(set_attr "isa" "noavx,noavx,avx")
5317 (set_attr "type" "ssecvt")
5318 (set_attr "athlon_decode" "vector,double,*")
5319 (set_attr "amdfam10_decode" "vector,double,*")
5320 (set_attr "bdver1_decode" "direct,direct,*")
5321 (set_attr "btver2_decode" "double,double,double")
5322 (set_attr "prefix" "orig,orig,<round_prefix>")
5323 (set_attr "mode" "SF")])
5325 (define_insn "*sse2_vd_cvtsd2ss"
5326 [(set (match_operand:V4SF 0 "register_operand" "=x,x,v")
5329 (float_truncate:SF (match_operand:DF 2 "nonimmediate_operand" "x,m,vm")))
5330 (match_operand:V4SF 1 "register_operand" "0,0,v")
5334 cvtsd2ss\t{%2, %0|%0, %2}
5335 cvtsd2ss\t{%2, %0|%0, %2}
5336 vcvtsd2ss\t{%2, %1, %0|%0, %1, %2}"
5337 [(set_attr "isa" "noavx,noavx,avx")
5338 (set_attr "type" "ssecvt")
5339 (set_attr "athlon_decode" "vector,double,*")
5340 (set_attr "amdfam10_decode" "vector,double,*")
5341 (set_attr "bdver1_decode" "direct,direct,*")
5342 (set_attr "btver2_decode" "double,double,double")
5343 (set_attr "prefix" "orig,orig,vex")
5344 (set_attr "mode" "SF")])
5346 (define_insn "sse2_cvtss2sd<round_saeonly_name>"
5347 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
5351 (match_operand:V4SF 2 "<round_saeonly_nimm_scalar_predicate>" "x,m,<round_saeonly_constraint>")
5352 (parallel [(const_int 0) (const_int 1)])))
5353 (match_operand:V2DF 1 "register_operand" "0,0,v")
5357 cvtss2sd\t{%2, %0|%0, %2}
5358 cvtss2sd\t{%2, %0|%0, %k2}
5359 vcvtss2sd\t{<round_saeonly_op3>%2, %1, %0|%0, %1, %k2<round_saeonly_op3>}"
5360 [(set_attr "isa" "noavx,noavx,avx")
5361 (set_attr "type" "ssecvt")
5362 (set_attr "amdfam10_decode" "vector,double,*")
5363 (set_attr "athlon_decode" "direct,direct,*")
5364 (set_attr "bdver1_decode" "direct,direct,*")
5365 (set_attr "btver2_decode" "double,double,double")
5366 (set_attr "prefix" "orig,orig,<round_saeonly_prefix>")
5367 (set_attr "mode" "DF")])
5369 (define_insn "*sse2_vd_cvtss2sd"
5370 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
5373 (float_extend:DF (match_operand:SF 2 "nonimmediate_operand" "x,m,vm")))
5374 (match_operand:V2DF 1 "register_operand" "0,0,v")
5378 cvtss2sd\t{%2, %0|%0, %2}
5379 cvtss2sd\t{%2, %0|%0, %2}
5380 vcvtss2sd\t{%2, %1, %0|%0, %1, %2}"
5381 [(set_attr "isa" "noavx,noavx,avx")
5382 (set_attr "type" "ssecvt")
5383 (set_attr "amdfam10_decode" "vector,double,*")
5384 (set_attr "athlon_decode" "direct,direct,*")
5385 (set_attr "bdver1_decode" "direct,direct,*")
5386 (set_attr "btver2_decode" "double,double,double")
5387 (set_attr "prefix" "orig,orig,vex")
5388 (set_attr "mode" "DF")])
5390 (define_insn "<mask_codefor>avx512f_cvtpd2ps512<mask_name><round_name>"
5391 [(set (match_operand:V8SF 0 "register_operand" "=v")
5392 (float_truncate:V8SF
5393 (match_operand:V8DF 1 "<round_nimm_predicate>" "<round_constraint>")))]
5395 "vcvtpd2ps\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5396 [(set_attr "type" "ssecvt")
5397 (set_attr "prefix" "evex")
5398 (set_attr "mode" "V8SF")])
5400 (define_insn "avx_cvtpd2ps256<mask_name>"
5401 [(set (match_operand:V4SF 0 "register_operand" "=v")
5402 (float_truncate:V4SF
5403 (match_operand:V4DF 1 "nonimmediate_operand" "vm")))]
5404 "TARGET_AVX && <mask_avx512vl_condition>"
5405 "vcvtpd2ps{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5406 [(set_attr "type" "ssecvt")
5407 (set_attr "prefix" "maybe_evex")
5408 (set_attr "btver2_decode" "vector")
5409 (set_attr "mode" "V4SF")])
5411 (define_expand "sse2_cvtpd2ps"
5412 [(set (match_operand:V4SF 0 "register_operand")
5414 (float_truncate:V2SF
5415 (match_operand:V2DF 1 "vector_operand"))
5418 "operands[2] = CONST0_RTX (V2SFmode);")
5420 (define_expand "sse2_cvtpd2ps_mask"
5421 [(set (match_operand:V4SF 0 "register_operand")
5424 (float_truncate:V2SF
5425 (match_operand:V2DF 1 "vector_operand"))
5427 (match_operand:V4SF 2 "register_operand")
5428 (match_operand:QI 3 "register_operand")))]
5430 "operands[4] = CONST0_RTX (V2SFmode);")
5432 (define_insn "*sse2_cvtpd2ps<mask_name>"
5433 [(set (match_operand:V4SF 0 "register_operand" "=v")
5435 (float_truncate:V2SF
5436 (match_operand:V2DF 1 "vector_operand" "vBm"))
5437 (match_operand:V2SF 2 "const0_operand")))]
5438 "TARGET_SSE2 && <mask_avx512vl_condition>"
5441 return "vcvtpd2ps{x}\t{%1, %0<mask_operand3>|%0<mask_operand3>, %1}";
5443 return "cvtpd2ps\t{%1, %0|%0, %1}";
5445 [(set_attr "type" "ssecvt")
5446 (set_attr "amdfam10_decode" "double")
5447 (set_attr "athlon_decode" "vector")
5448 (set_attr "bdver1_decode" "double")
5449 (set_attr "prefix_data16" "1")
5450 (set_attr "prefix" "maybe_vex")
5451 (set_attr "mode" "V4SF")])
5453 ;; For <sse2_avx_avx512f>_cvtps2pd<avxsizesuffix> insn pattern
5454 (define_mode_attr sf2dfmode
5455 [(V8DF "V8SF") (V4DF "V4SF")])
5457 (define_insn "<sse2_avx_avx512f>_cvtps2pd<avxsizesuffix><mask_name><round_saeonly_name>"
5458 [(set (match_operand:VF2_512_256 0 "register_operand" "=v")
5459 (float_extend:VF2_512_256
5460 (match_operand:<sf2dfmode> 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
5461 "TARGET_AVX && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
5462 "vcvtps2pd\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
5463 [(set_attr "type" "ssecvt")
5464 (set_attr "prefix" "maybe_vex")
5465 (set_attr "mode" "<MODE>")])
5467 (define_insn "*avx_cvtps2pd256_2"
5468 [(set (match_operand:V4DF 0 "register_operand" "=v")
5471 (match_operand:V8SF 1 "nonimmediate_operand" "vm")
5472 (parallel [(const_int 0) (const_int 1)
5473 (const_int 2) (const_int 3)]))))]
5475 "vcvtps2pd\t{%x1, %0|%0, %x1}"
5476 [(set_attr "type" "ssecvt")
5477 (set_attr "prefix" "vex")
5478 (set_attr "mode" "V4DF")])
5480 (define_insn "vec_unpacks_lo_v16sf"
5481 [(set (match_operand:V8DF 0 "register_operand" "=v")
5484 (match_operand:V16SF 1 "nonimmediate_operand" "vm")
5485 (parallel [(const_int 0) (const_int 1)
5486 (const_int 2) (const_int 3)
5487 (const_int 4) (const_int 5)
5488 (const_int 6) (const_int 7)]))))]
5490 "vcvtps2pd\t{%t1, %0|%0, %t1}"
5491 [(set_attr "type" "ssecvt")
5492 (set_attr "prefix" "evex")
5493 (set_attr "mode" "V8DF")])
5495 (define_insn "<avx512>_cvt<ssemodesuffix>2mask<mode>"
5496 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
5497 (unspec:<avx512fmaskmode>
5498 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")]
5499 UNSPEC_CVTINT2MASK))]
5501 "vpmov<ssemodesuffix>2m\t{%1, %0|%0, %1}"
5502 [(set_attr "prefix" "evex")
5503 (set_attr "mode" "<sseinsnmode>")])
5505 (define_insn "<avx512>_cvt<ssemodesuffix>2mask<mode>"
5506 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
5507 (unspec:<avx512fmaskmode>
5508 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")]
5509 UNSPEC_CVTINT2MASK))]
5511 "vpmov<ssemodesuffix>2m\t{%1, %0|%0, %1}"
5512 [(set_attr "prefix" "evex")
5513 (set_attr "mode" "<sseinsnmode>")])
5515 (define_expand "<avx512>_cvtmask2<ssemodesuffix><mode>"
5516 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
5517 (vec_merge:VI12_AVX512VL
5520 (match_operand:<avx512fmaskmode> 1 "register_operand")))]
5523 operands[2] = CONSTM1_RTX (<MODE>mode);
5524 operands[3] = CONST0_RTX (<MODE>mode);
5527 (define_insn "*<avx512>_cvtmask2<ssemodesuffix><mode>"
5528 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
5529 (vec_merge:VI12_AVX512VL
5530 (match_operand:VI12_AVX512VL 2 "vector_all_ones_operand")
5531 (match_operand:VI12_AVX512VL 3 "const0_operand")
5532 (match_operand:<avx512fmaskmode> 1 "register_operand" "Yk")))]
5534 "vpmovm2<ssemodesuffix>\t{%1, %0|%0, %1}"
5535 [(set_attr "prefix" "evex")
5536 (set_attr "mode" "<sseinsnmode>")])
5538 (define_expand "<avx512>_cvtmask2<ssemodesuffix><mode>"
5539 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
5540 (vec_merge:VI48_AVX512VL
5543 (match_operand:<avx512fmaskmode> 1 "register_operand")))]
5546 operands[2] = CONSTM1_RTX (<MODE>mode);
5547 operands[3] = CONST0_RTX (<MODE>mode);
5550 (define_insn "*<avx512>_cvtmask2<ssemodesuffix><mode>"
5551 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
5552 (vec_merge:VI48_AVX512VL
5553 (match_operand:VI48_AVX512VL 2 "vector_all_ones_operand")
5554 (match_operand:VI48_AVX512VL 3 "const0_operand")
5555 (match_operand:<avx512fmaskmode> 1 "register_operand" "Yk")))]
5557 "vpmovm2<ssemodesuffix>\t{%1, %0|%0, %1}"
5558 [(set_attr "prefix" "evex")
5559 (set_attr "mode" "<sseinsnmode>")])
5561 (define_insn "sse2_cvtps2pd<mask_name>"
5562 [(set (match_operand:V2DF 0 "register_operand" "=v")
5565 (match_operand:V4SF 1 "vector_operand" "vm")
5566 (parallel [(const_int 0) (const_int 1)]))))]
5567 "TARGET_SSE2 && <mask_avx512vl_condition>"
5568 "%vcvtps2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
5569 [(set_attr "type" "ssecvt")
5570 (set_attr "amdfam10_decode" "direct")
5571 (set_attr "athlon_decode" "double")
5572 (set_attr "bdver1_decode" "double")
5573 (set_attr "prefix_data16" "0")
5574 (set_attr "prefix" "maybe_vex")
5575 (set_attr "mode" "V2DF")])
5577 (define_expand "vec_unpacks_hi_v4sf"
5582 (match_operand:V4SF 1 "vector_operand"))
5583 (parallel [(const_int 6) (const_int 7)
5584 (const_int 2) (const_int 3)])))
5585 (set (match_operand:V2DF 0 "register_operand")
5589 (parallel [(const_int 0) (const_int 1)]))))]
5591 "operands[2] = gen_reg_rtx (V4SFmode);")
5593 (define_expand "vec_unpacks_hi_v8sf"
5596 (match_operand:V8SF 1 "register_operand")
5597 (parallel [(const_int 4) (const_int 5)
5598 (const_int 6) (const_int 7)])))
5599 (set (match_operand:V4DF 0 "register_operand")
5603 "operands[2] = gen_reg_rtx (V4SFmode);")
5605 (define_expand "vec_unpacks_hi_v16sf"
5608 (match_operand:V16SF 1 "register_operand")
5609 (parallel [(const_int 8) (const_int 9)
5610 (const_int 10) (const_int 11)
5611 (const_int 12) (const_int 13)
5612 (const_int 14) (const_int 15)])))
5613 (set (match_operand:V8DF 0 "register_operand")
5617 "operands[2] = gen_reg_rtx (V8SFmode);")
5619 (define_expand "vec_unpacks_lo_v4sf"
5620 [(set (match_operand:V2DF 0 "register_operand")
5623 (match_operand:V4SF 1 "vector_operand")
5624 (parallel [(const_int 0) (const_int 1)]))))]
5627 (define_expand "vec_unpacks_lo_v8sf"
5628 [(set (match_operand:V4DF 0 "register_operand")
5631 (match_operand:V8SF 1 "nonimmediate_operand")
5632 (parallel [(const_int 0) (const_int 1)
5633 (const_int 2) (const_int 3)]))))]
5636 (define_mode_attr sseunpackfltmode
5637 [(V8HI "V4SF") (V4SI "V2DF") (V16HI "V8SF")
5638 (V8SI "V4DF") (V32HI "V16SF") (V16SI "V8DF")])
5640 (define_expand "vec_unpacks_float_hi_<mode>"
5641 [(match_operand:<sseunpackfltmode> 0 "register_operand")
5642 (match_operand:VI2_AVX512F 1 "register_operand")]
5645 rtx tmp = gen_reg_rtx (<sseunpackmode>mode);
5647 emit_insn (gen_vec_unpacks_hi_<mode> (tmp, operands[1]));
5648 emit_insn (gen_rtx_SET (operands[0],
5649 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
5653 (define_expand "vec_unpacks_float_lo_<mode>"
5654 [(match_operand:<sseunpackfltmode> 0 "register_operand")
5655 (match_operand:VI2_AVX512F 1 "register_operand")]
5658 rtx tmp = gen_reg_rtx (<sseunpackmode>mode);
5660 emit_insn (gen_vec_unpacks_lo_<mode> (tmp, operands[1]));
5661 emit_insn (gen_rtx_SET (operands[0],
5662 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
5666 (define_expand "vec_unpacku_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_unpacku_hi_<mode> (tmp, operands[1]));
5674 emit_insn (gen_rtx_SET (operands[0],
5675 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
5679 (define_expand "vec_unpacku_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_unpacku_lo_<mode> (tmp, operands[1]));
5687 emit_insn (gen_rtx_SET (operands[0],
5688 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
5692 (define_expand "vec_unpacks_float_hi_v4si"
5695 (match_operand:V4SI 1 "vector_operand")
5696 (parallel [(const_int 2) (const_int 3)
5697 (const_int 2) (const_int 3)])))
5698 (set (match_operand:V2DF 0 "register_operand")
5702 (parallel [(const_int 0) (const_int 1)]))))]
5704 "operands[2] = gen_reg_rtx (V4SImode);")
5706 (define_expand "vec_unpacks_float_lo_v4si"
5707 [(set (match_operand:V2DF 0 "register_operand")
5710 (match_operand:V4SI 1 "vector_operand")
5711 (parallel [(const_int 0) (const_int 1)]))))]
5714 (define_expand "vec_unpacks_float_hi_v8si"
5717 (match_operand:V8SI 1 "vector_operand")
5718 (parallel [(const_int 4) (const_int 5)
5719 (const_int 6) (const_int 7)])))
5720 (set (match_operand:V4DF 0 "register_operand")
5724 "operands[2] = gen_reg_rtx (V4SImode);")
5726 (define_expand "vec_unpacks_float_lo_v8si"
5727 [(set (match_operand:V4DF 0 "register_operand")
5730 (match_operand:V8SI 1 "nonimmediate_operand")
5731 (parallel [(const_int 0) (const_int 1)
5732 (const_int 2) (const_int 3)]))))]
5735 (define_expand "vec_unpacks_float_hi_v16si"
5738 (match_operand:V16SI 1 "nonimmediate_operand")
5739 (parallel [(const_int 8) (const_int 9)
5740 (const_int 10) (const_int 11)
5741 (const_int 12) (const_int 13)
5742 (const_int 14) (const_int 15)])))
5743 (set (match_operand:V8DF 0 "register_operand")
5747 "operands[2] = gen_reg_rtx (V8SImode);")
5749 (define_expand "vec_unpacks_float_lo_v16si"
5750 [(set (match_operand:V8DF 0 "register_operand")
5753 (match_operand:V16SI 1 "nonimmediate_operand")
5754 (parallel [(const_int 0) (const_int 1)
5755 (const_int 2) (const_int 3)
5756 (const_int 4) (const_int 5)
5757 (const_int 6) (const_int 7)]))))]
5760 (define_expand "vec_unpacku_float_hi_v4si"
5763 (match_operand:V4SI 1 "vector_operand")
5764 (parallel [(const_int 2) (const_int 3)
5765 (const_int 2) (const_int 3)])))
5770 (parallel [(const_int 0) (const_int 1)]))))
5772 (lt:V2DF (match_dup 6) (match_dup 3)))
5774 (and:V2DF (match_dup 7) (match_dup 4)))
5775 (set (match_operand:V2DF 0 "register_operand")
5776 (plus:V2DF (match_dup 6) (match_dup 8)))]
5779 REAL_VALUE_TYPE TWO32r;
5783 real_ldexp (&TWO32r, &dconst1, 32);
5784 x = const_double_from_real_value (TWO32r, DFmode);
5786 operands[3] = force_reg (V2DFmode, CONST0_RTX (V2DFmode));
5787 operands[4] = force_reg (V2DFmode,
5788 ix86_build_const_vector (V2DFmode, 1, x));
5790 operands[5] = gen_reg_rtx (V4SImode);
5792 for (i = 6; i < 9; i++)
5793 operands[i] = gen_reg_rtx (V2DFmode);
5796 (define_expand "vec_unpacku_float_lo_v4si"
5800 (match_operand:V4SI 1 "vector_operand")
5801 (parallel [(const_int 0) (const_int 1)]))))
5803 (lt:V2DF (match_dup 5) (match_dup 3)))
5805 (and:V2DF (match_dup 6) (match_dup 4)))
5806 (set (match_operand:V2DF 0 "register_operand")
5807 (plus:V2DF (match_dup 5) (match_dup 7)))]
5810 REAL_VALUE_TYPE TWO32r;
5814 real_ldexp (&TWO32r, &dconst1, 32);
5815 x = const_double_from_real_value (TWO32r, DFmode);
5817 operands[3] = force_reg (V2DFmode, CONST0_RTX (V2DFmode));
5818 operands[4] = force_reg (V2DFmode,
5819 ix86_build_const_vector (V2DFmode, 1, x));
5821 for (i = 5; i < 8; i++)
5822 operands[i] = gen_reg_rtx (V2DFmode);
5825 (define_expand "vec_unpacku_float_hi_v8si"
5826 [(match_operand:V4DF 0 "register_operand")
5827 (match_operand:V8SI 1 "register_operand")]
5830 REAL_VALUE_TYPE TWO32r;
5834 real_ldexp (&TWO32r, &dconst1, 32);
5835 x = const_double_from_real_value (TWO32r, DFmode);
5837 tmp[0] = force_reg (V4DFmode, CONST0_RTX (V4DFmode));
5838 tmp[1] = force_reg (V4DFmode, ix86_build_const_vector (V4DFmode, 1, x));
5839 tmp[5] = gen_reg_rtx (V4SImode);
5841 for (i = 2; i < 5; i++)
5842 tmp[i] = gen_reg_rtx (V4DFmode);
5843 emit_insn (gen_vec_extract_hi_v8si (tmp[5], operands[1]));
5844 emit_insn (gen_floatv4siv4df2 (tmp[2], tmp[5]));
5845 emit_insn (gen_rtx_SET (tmp[3], gen_rtx_LT (V4DFmode, tmp[2], tmp[0])));
5846 emit_insn (gen_andv4df3 (tmp[4], tmp[3], tmp[1]));
5847 emit_insn (gen_addv4df3 (operands[0], tmp[2], tmp[4]));
5851 (define_expand "vec_unpacku_float_hi_v16si"
5852 [(match_operand:V8DF 0 "register_operand")
5853 (match_operand:V16SI 1 "register_operand")]
5856 REAL_VALUE_TYPE TWO32r;
5859 real_ldexp (&TWO32r, &dconst1, 32);
5860 x = const_double_from_real_value (TWO32r, DFmode);
5862 tmp[0] = force_reg (V8DFmode, CONST0_RTX (V8DFmode));
5863 tmp[1] = force_reg (V8DFmode, ix86_build_const_vector (V8DFmode, 1, x));
5864 tmp[2] = gen_reg_rtx (V8DFmode);
5865 tmp[3] = gen_reg_rtx (V8SImode);
5866 k = gen_reg_rtx (QImode);
5868 emit_insn (gen_vec_extract_hi_v16si (tmp[3], operands[1]));
5869 emit_insn (gen_floatv8siv8df2 (tmp[2], tmp[3]));
5870 emit_insn (gen_rtx_SET (k, gen_rtx_LT (QImode, tmp[2], tmp[0])));
5871 emit_insn (gen_addv8df3_mask (tmp[2], tmp[2], tmp[1], tmp[2], k));
5872 emit_move_insn (operands[0], tmp[2]);
5876 (define_expand "vec_unpacku_float_lo_v8si"
5877 [(match_operand:V4DF 0 "register_operand")
5878 (match_operand:V8SI 1 "nonimmediate_operand")]
5881 REAL_VALUE_TYPE TWO32r;
5885 real_ldexp (&TWO32r, &dconst1, 32);
5886 x = const_double_from_real_value (TWO32r, DFmode);
5888 tmp[0] = force_reg (V4DFmode, CONST0_RTX (V4DFmode));
5889 tmp[1] = force_reg (V4DFmode, ix86_build_const_vector (V4DFmode, 1, x));
5891 for (i = 2; i < 5; i++)
5892 tmp[i] = gen_reg_rtx (V4DFmode);
5893 emit_insn (gen_avx_cvtdq2pd256_2 (tmp[2], operands[1]));
5894 emit_insn (gen_rtx_SET (tmp[3], gen_rtx_LT (V4DFmode, tmp[2], tmp[0])));
5895 emit_insn (gen_andv4df3 (tmp[4], tmp[3], tmp[1]));
5896 emit_insn (gen_addv4df3 (operands[0], tmp[2], tmp[4]));
5900 (define_expand "vec_unpacku_float_lo_v16si"
5901 [(match_operand:V8DF 0 "register_operand")
5902 (match_operand:V16SI 1 "nonimmediate_operand")]
5905 REAL_VALUE_TYPE TWO32r;
5908 real_ldexp (&TWO32r, &dconst1, 32);
5909 x = const_double_from_real_value (TWO32r, DFmode);
5911 tmp[0] = force_reg (V8DFmode, CONST0_RTX (V8DFmode));
5912 tmp[1] = force_reg (V8DFmode, ix86_build_const_vector (V8DFmode, 1, x));
5913 tmp[2] = gen_reg_rtx (V8DFmode);
5914 k = gen_reg_rtx (QImode);
5916 emit_insn (gen_avx512f_cvtdq2pd512_2 (tmp[2], operands[1]));
5917 emit_insn (gen_rtx_SET (k, gen_rtx_LT (QImode, tmp[2], tmp[0])));
5918 emit_insn (gen_addv8df3_mask (tmp[2], tmp[2], tmp[1], tmp[2], k));
5919 emit_move_insn (operands[0], tmp[2]);
5923 (define_expand "vec_pack_trunc_<mode>"
5925 (float_truncate:<sf2dfmode>
5926 (match_operand:VF2_512_256 1 "nonimmediate_operand")))
5928 (float_truncate:<sf2dfmode>
5929 (match_operand:VF2_512_256 2 "nonimmediate_operand")))
5930 (set (match_operand:<ssePSmode> 0 "register_operand")
5931 (vec_concat:<ssePSmode>
5936 operands[3] = gen_reg_rtx (<sf2dfmode>mode);
5937 operands[4] = gen_reg_rtx (<sf2dfmode>mode);
5940 (define_expand "vec_pack_trunc_v2df"
5941 [(match_operand:V4SF 0 "register_operand")
5942 (match_operand:V2DF 1 "vector_operand")
5943 (match_operand:V2DF 2 "vector_operand")]
5948 if (TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
5950 tmp0 = gen_reg_rtx (V4DFmode);
5951 tmp1 = force_reg (V2DFmode, operands[1]);
5953 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
5954 emit_insn (gen_avx_cvtpd2ps256 (operands[0], tmp0));
5958 tmp0 = gen_reg_rtx (V4SFmode);
5959 tmp1 = gen_reg_rtx (V4SFmode);
5961 emit_insn (gen_sse2_cvtpd2ps (tmp0, operands[1]));
5962 emit_insn (gen_sse2_cvtpd2ps (tmp1, operands[2]));
5963 emit_insn (gen_sse_movlhps (operands[0], tmp0, tmp1));
5968 (define_expand "vec_pack_sfix_trunc_v8df"
5969 [(match_operand:V16SI 0 "register_operand")
5970 (match_operand:V8DF 1 "nonimmediate_operand")
5971 (match_operand:V8DF 2 "nonimmediate_operand")]
5976 r1 = gen_reg_rtx (V8SImode);
5977 r2 = gen_reg_rtx (V8SImode);
5979 emit_insn (gen_fix_truncv8dfv8si2 (r1, operands[1]));
5980 emit_insn (gen_fix_truncv8dfv8si2 (r2, operands[2]));
5981 emit_insn (gen_avx_vec_concatv16si (operands[0], r1, r2));
5985 (define_expand "vec_pack_sfix_trunc_v4df"
5986 [(match_operand:V8SI 0 "register_operand")
5987 (match_operand:V4DF 1 "nonimmediate_operand")
5988 (match_operand:V4DF 2 "nonimmediate_operand")]
5993 r1 = gen_reg_rtx (V4SImode);
5994 r2 = gen_reg_rtx (V4SImode);
5996 emit_insn (gen_fix_truncv4dfv4si2 (r1, operands[1]));
5997 emit_insn (gen_fix_truncv4dfv4si2 (r2, operands[2]));
5998 emit_insn (gen_avx_vec_concatv8si (operands[0], r1, r2));
6002 (define_expand "vec_pack_sfix_trunc_v2df"
6003 [(match_operand:V4SI 0 "register_operand")
6004 (match_operand:V2DF 1 "vector_operand")
6005 (match_operand:V2DF 2 "vector_operand")]
6008 rtx tmp0, tmp1, tmp2;
6010 if (TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
6012 tmp0 = gen_reg_rtx (V4DFmode);
6013 tmp1 = force_reg (V2DFmode, operands[1]);
6015 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
6016 emit_insn (gen_fix_truncv4dfv4si2 (operands[0], tmp0));
6020 tmp0 = gen_reg_rtx (V4SImode);
6021 tmp1 = gen_reg_rtx (V4SImode);
6022 tmp2 = gen_reg_rtx (V2DImode);
6024 emit_insn (gen_sse2_cvttpd2dq (tmp0, operands[1]));
6025 emit_insn (gen_sse2_cvttpd2dq (tmp1, operands[2]));
6026 emit_insn (gen_vec_interleave_lowv2di (tmp2,
6027 gen_lowpart (V2DImode, tmp0),
6028 gen_lowpart (V2DImode, tmp1)));
6029 emit_move_insn (operands[0], gen_lowpart (V4SImode, tmp2));
6034 (define_mode_attr ssepackfltmode
6035 [(V8DF "V16SI") (V4DF "V8SI") (V2DF "V4SI")])
6037 (define_expand "vec_pack_ufix_trunc_<mode>"
6038 [(match_operand:<ssepackfltmode> 0 "register_operand")
6039 (match_operand:VF2 1 "register_operand")
6040 (match_operand:VF2 2 "register_operand")]
6043 if (<MODE>mode == V8DFmode)
6047 r1 = gen_reg_rtx (V8SImode);
6048 r2 = gen_reg_rtx (V8SImode);
6050 emit_insn (gen_ufix_truncv8dfv8si2 (r1, operands[1]));
6051 emit_insn (gen_ufix_truncv8dfv8si2 (r2, operands[2]));
6052 emit_insn (gen_avx_vec_concatv16si (operands[0], r1, r2));
6057 tmp[0] = ix86_expand_adjust_ufix_to_sfix_si (operands[1], &tmp[2]);
6058 tmp[1] = ix86_expand_adjust_ufix_to_sfix_si (operands[2], &tmp[3]);
6059 tmp[4] = gen_reg_rtx (<ssepackfltmode>mode);
6060 emit_insn (gen_vec_pack_sfix_trunc_<mode> (tmp[4], tmp[0], tmp[1]));
6061 if (<ssepackfltmode>mode == V4SImode || TARGET_AVX2)
6063 tmp[5] = gen_reg_rtx (<ssepackfltmode>mode);
6064 ix86_expand_vec_extract_even_odd (tmp[5], tmp[2], tmp[3], 0);
6068 tmp[5] = gen_reg_rtx (V8SFmode);
6069 ix86_expand_vec_extract_even_odd (tmp[5],
6070 gen_lowpart (V8SFmode, tmp[2]),
6071 gen_lowpart (V8SFmode, tmp[3]), 0);
6072 tmp[5] = gen_lowpart (V8SImode, tmp[5]);
6074 tmp[6] = expand_simple_binop (<ssepackfltmode>mode, XOR, tmp[4], tmp[5],
6075 operands[0], 0, OPTAB_DIRECT);
6076 if (tmp[6] != operands[0])
6077 emit_move_insn (operands[0], tmp[6]);
6083 (define_expand "avx512f_vec_pack_sfix_v8df"
6084 [(match_operand:V16SI 0 "register_operand")
6085 (match_operand:V8DF 1 "nonimmediate_operand")
6086 (match_operand:V8DF 2 "nonimmediate_operand")]
6091 r1 = gen_reg_rtx (V8SImode);
6092 r2 = gen_reg_rtx (V8SImode);
6094 emit_insn (gen_avx512f_cvtpd2dq512 (r1, operands[1]));
6095 emit_insn (gen_avx512f_cvtpd2dq512 (r2, operands[2]));
6096 emit_insn (gen_avx_vec_concatv16si (operands[0], r1, r2));
6100 (define_expand "vec_pack_sfix_v4df"
6101 [(match_operand:V8SI 0 "register_operand")
6102 (match_operand:V4DF 1 "nonimmediate_operand")
6103 (match_operand:V4DF 2 "nonimmediate_operand")]
6108 r1 = gen_reg_rtx (V4SImode);
6109 r2 = gen_reg_rtx (V4SImode);
6111 emit_insn (gen_avx_cvtpd2dq256 (r1, operands[1]));
6112 emit_insn (gen_avx_cvtpd2dq256 (r2, operands[2]));
6113 emit_insn (gen_avx_vec_concatv8si (operands[0], r1, r2));
6117 (define_expand "vec_pack_sfix_v2df"
6118 [(match_operand:V4SI 0 "register_operand")
6119 (match_operand:V2DF 1 "vector_operand")
6120 (match_operand:V2DF 2 "vector_operand")]
6123 rtx tmp0, tmp1, tmp2;
6125 if (TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
6127 tmp0 = gen_reg_rtx (V4DFmode);
6128 tmp1 = force_reg (V2DFmode, operands[1]);
6130 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
6131 emit_insn (gen_avx_cvtpd2dq256 (operands[0], tmp0));
6135 tmp0 = gen_reg_rtx (V4SImode);
6136 tmp1 = gen_reg_rtx (V4SImode);
6137 tmp2 = gen_reg_rtx (V2DImode);
6139 emit_insn (gen_sse2_cvtpd2dq (tmp0, operands[1]));
6140 emit_insn (gen_sse2_cvtpd2dq (tmp1, operands[2]));
6141 emit_insn (gen_vec_interleave_lowv2di (tmp2,
6142 gen_lowpart (V2DImode, tmp0),
6143 gen_lowpart (V2DImode, tmp1)));
6144 emit_move_insn (operands[0], gen_lowpart (V4SImode, tmp2));
6149 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6151 ;; Parallel single-precision floating point element swizzling
6153 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6155 (define_expand "sse_movhlps_exp"
6156 [(set (match_operand:V4SF 0 "nonimmediate_operand")
6159 (match_operand:V4SF 1 "nonimmediate_operand")
6160 (match_operand:V4SF 2 "nonimmediate_operand"))
6161 (parallel [(const_int 6)
6167 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
6169 emit_insn (gen_sse_movhlps (dst, operands[1], operands[2]));
6171 /* Fix up the destination if needed. */
6172 if (dst != operands[0])
6173 emit_move_insn (operands[0], dst);
6178 (define_insn "sse_movhlps"
6179 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,v,x,v,m")
6182 (match_operand:V4SF 1 "nonimmediate_operand" " 0,v,0,v,0")
6183 (match_operand:V4SF 2 "nonimmediate_operand" " x,v,o,o,v"))
6184 (parallel [(const_int 6)
6188 "TARGET_SSE && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
6190 movhlps\t{%2, %0|%0, %2}
6191 vmovhlps\t{%2, %1, %0|%0, %1, %2}
6192 movlps\t{%H2, %0|%0, %H2}
6193 vmovlps\t{%H2, %1, %0|%0, %1, %H2}
6194 %vmovhps\t{%2, %0|%q0, %2}"
6195 [(set_attr "isa" "noavx,avx,noavx,avx,*")
6196 (set_attr "type" "ssemov")
6197 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,maybe_vex")
6198 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF,V2SF")])
6200 (define_expand "sse_movlhps_exp"
6201 [(set (match_operand:V4SF 0 "nonimmediate_operand")
6204 (match_operand:V4SF 1 "nonimmediate_operand")
6205 (match_operand:V4SF 2 "nonimmediate_operand"))
6206 (parallel [(const_int 0)
6212 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
6214 emit_insn (gen_sse_movlhps (dst, operands[1], operands[2]));
6216 /* Fix up the destination if needed. */
6217 if (dst != operands[0])
6218 emit_move_insn (operands[0], dst);
6223 (define_insn "sse_movlhps"
6224 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,v,x,v,o")
6227 (match_operand:V4SF 1 "nonimmediate_operand" " 0,v,0,v,0")
6228 (match_operand:V4SF 2 "nonimmediate_operand" " x,v,m,v,v"))
6229 (parallel [(const_int 0)
6233 "TARGET_SSE && ix86_binary_operator_ok (UNKNOWN, V4SFmode, operands)"
6235 movlhps\t{%2, %0|%0, %2}
6236 vmovlhps\t{%2, %1, %0|%0, %1, %2}
6237 movhps\t{%2, %0|%0, %q2}
6238 vmovhps\t{%2, %1, %0|%0, %1, %q2}
6239 %vmovlps\t{%2, %H0|%H0, %2}"
6240 [(set_attr "isa" "noavx,avx,noavx,avx,*")
6241 (set_attr "type" "ssemov")
6242 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,maybe_vex")
6243 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF,V2SF")])
6245 (define_insn "<mask_codefor>avx512f_unpckhps512<mask_name>"
6246 [(set (match_operand:V16SF 0 "register_operand" "=v")
6249 (match_operand:V16SF 1 "register_operand" "v")
6250 (match_operand:V16SF 2 "nonimmediate_operand" "vm"))
6251 (parallel [(const_int 2) (const_int 18)
6252 (const_int 3) (const_int 19)
6253 (const_int 6) (const_int 22)
6254 (const_int 7) (const_int 23)
6255 (const_int 10) (const_int 26)
6256 (const_int 11) (const_int 27)
6257 (const_int 14) (const_int 30)
6258 (const_int 15) (const_int 31)])))]
6260 "vunpckhps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6261 [(set_attr "type" "sselog")
6262 (set_attr "prefix" "evex")
6263 (set_attr "mode" "V16SF")])
6265 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
6266 (define_insn "avx_unpckhps256<mask_name>"
6267 [(set (match_operand:V8SF 0 "register_operand" "=v")
6270 (match_operand:V8SF 1 "register_operand" "v")
6271 (match_operand:V8SF 2 "nonimmediate_operand" "vm"))
6272 (parallel [(const_int 2) (const_int 10)
6273 (const_int 3) (const_int 11)
6274 (const_int 6) (const_int 14)
6275 (const_int 7) (const_int 15)])))]
6276 "TARGET_AVX && <mask_avx512vl_condition>"
6277 "vunpckhps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6278 [(set_attr "type" "sselog")
6279 (set_attr "prefix" "vex")
6280 (set_attr "mode" "V8SF")])
6282 (define_expand "vec_interleave_highv8sf"
6286 (match_operand:V8SF 1 "register_operand")
6287 (match_operand:V8SF 2 "nonimmediate_operand"))
6288 (parallel [(const_int 0) (const_int 8)
6289 (const_int 1) (const_int 9)
6290 (const_int 4) (const_int 12)
6291 (const_int 5) (const_int 13)])))
6297 (parallel [(const_int 2) (const_int 10)
6298 (const_int 3) (const_int 11)
6299 (const_int 6) (const_int 14)
6300 (const_int 7) (const_int 15)])))
6301 (set (match_operand:V8SF 0 "register_operand")
6306 (parallel [(const_int 4) (const_int 5)
6307 (const_int 6) (const_int 7)
6308 (const_int 12) (const_int 13)
6309 (const_int 14) (const_int 15)])))]
6312 operands[3] = gen_reg_rtx (V8SFmode);
6313 operands[4] = gen_reg_rtx (V8SFmode);
6316 (define_insn "vec_interleave_highv4sf<mask_name>"
6317 [(set (match_operand:V4SF 0 "register_operand" "=x,v")
6320 (match_operand:V4SF 1 "register_operand" "0,v")
6321 (match_operand:V4SF 2 "vector_operand" "xBm,vm"))
6322 (parallel [(const_int 2) (const_int 6)
6323 (const_int 3) (const_int 7)])))]
6324 "TARGET_SSE && <mask_avx512vl_condition>"
6326 unpckhps\t{%2, %0|%0, %2}
6327 vunpckhps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6328 [(set_attr "isa" "noavx,avx")
6329 (set_attr "type" "sselog")
6330 (set_attr "prefix" "orig,vex")
6331 (set_attr "mode" "V4SF")])
6333 (define_insn "<mask_codefor>avx512f_unpcklps512<mask_name>"
6334 [(set (match_operand:V16SF 0 "register_operand" "=v")
6337 (match_operand:V16SF 1 "register_operand" "v")
6338 (match_operand:V16SF 2 "nonimmediate_operand" "vm"))
6339 (parallel [(const_int 0) (const_int 16)
6340 (const_int 1) (const_int 17)
6341 (const_int 4) (const_int 20)
6342 (const_int 5) (const_int 21)
6343 (const_int 8) (const_int 24)
6344 (const_int 9) (const_int 25)
6345 (const_int 12) (const_int 28)
6346 (const_int 13) (const_int 29)])))]
6348 "vunpcklps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6349 [(set_attr "type" "sselog")
6350 (set_attr "prefix" "evex")
6351 (set_attr "mode" "V16SF")])
6353 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
6354 (define_insn "avx_unpcklps256<mask_name>"
6355 [(set (match_operand:V8SF 0 "register_operand" "=v")
6358 (match_operand:V8SF 1 "register_operand" "v")
6359 (match_operand:V8SF 2 "nonimmediate_operand" "vm"))
6360 (parallel [(const_int 0) (const_int 8)
6361 (const_int 1) (const_int 9)
6362 (const_int 4) (const_int 12)
6363 (const_int 5) (const_int 13)])))]
6364 "TARGET_AVX && <mask_avx512vl_condition>"
6365 "vunpcklps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6366 [(set_attr "type" "sselog")
6367 (set_attr "prefix" "vex")
6368 (set_attr "mode" "V8SF")])
6370 (define_insn "unpcklps128_mask"
6371 [(set (match_operand:V4SF 0 "register_operand" "=v")
6375 (match_operand:V4SF 1 "register_operand" "v")
6376 (match_operand:V4SF 2 "nonimmediate_operand" "vm"))
6377 (parallel [(const_int 0) (const_int 4)
6378 (const_int 1) (const_int 5)]))
6379 (match_operand:V4SF 3 "vector_move_operand" "0C")
6380 (match_operand:QI 4 "register_operand" "Yk")))]
6382 "vunpcklps\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
6383 [(set_attr "type" "sselog")
6384 (set_attr "prefix" "evex")
6385 (set_attr "mode" "V4SF")])
6387 (define_expand "vec_interleave_lowv8sf"
6391 (match_operand:V8SF 1 "register_operand")
6392 (match_operand:V8SF 2 "nonimmediate_operand"))
6393 (parallel [(const_int 0) (const_int 8)
6394 (const_int 1) (const_int 9)
6395 (const_int 4) (const_int 12)
6396 (const_int 5) (const_int 13)])))
6402 (parallel [(const_int 2) (const_int 10)
6403 (const_int 3) (const_int 11)
6404 (const_int 6) (const_int 14)
6405 (const_int 7) (const_int 15)])))
6406 (set (match_operand:V8SF 0 "register_operand")
6411 (parallel [(const_int 0) (const_int 1)
6412 (const_int 2) (const_int 3)
6413 (const_int 8) (const_int 9)
6414 (const_int 10) (const_int 11)])))]
6417 operands[3] = gen_reg_rtx (V8SFmode);
6418 operands[4] = gen_reg_rtx (V8SFmode);
6421 (define_insn "vec_interleave_lowv4sf"
6422 [(set (match_operand:V4SF 0 "register_operand" "=x,v")
6425 (match_operand:V4SF 1 "register_operand" "0,v")
6426 (match_operand:V4SF 2 "vector_operand" "xBm,vm"))
6427 (parallel [(const_int 0) (const_int 4)
6428 (const_int 1) (const_int 5)])))]
6431 unpcklps\t{%2, %0|%0, %2}
6432 vunpcklps\t{%2, %1, %0|%0, %1, %2}"
6433 [(set_attr "isa" "noavx,avx")
6434 (set_attr "type" "sselog")
6435 (set_attr "prefix" "orig,maybe_evex")
6436 (set_attr "mode" "V4SF")])
6438 ;; These are modeled with the same vec_concat as the others so that we
6439 ;; capture users of shufps that can use the new instructions
6440 (define_insn "avx_movshdup256<mask_name>"
6441 [(set (match_operand:V8SF 0 "register_operand" "=v")
6444 (match_operand:V8SF 1 "nonimmediate_operand" "vm")
6446 (parallel [(const_int 1) (const_int 1)
6447 (const_int 3) (const_int 3)
6448 (const_int 5) (const_int 5)
6449 (const_int 7) (const_int 7)])))]
6450 "TARGET_AVX && <mask_avx512vl_condition>"
6451 "vmovshdup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6452 [(set_attr "type" "sse")
6453 (set_attr "prefix" "vex")
6454 (set_attr "mode" "V8SF")])
6456 (define_insn "sse3_movshdup<mask_name>"
6457 [(set (match_operand:V4SF 0 "register_operand" "=v")
6460 (match_operand:V4SF 1 "vector_operand" "vBm")
6462 (parallel [(const_int 1)
6466 "TARGET_SSE3 && <mask_avx512vl_condition>"
6467 "%vmovshdup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6468 [(set_attr "type" "sse")
6469 (set_attr "prefix_rep" "1")
6470 (set_attr "prefix" "maybe_vex")
6471 (set_attr "mode" "V4SF")])
6473 (define_insn "<mask_codefor>avx512f_movshdup512<mask_name>"
6474 [(set (match_operand:V16SF 0 "register_operand" "=v")
6477 (match_operand:V16SF 1 "nonimmediate_operand" "vm")
6479 (parallel [(const_int 1) (const_int 1)
6480 (const_int 3) (const_int 3)
6481 (const_int 5) (const_int 5)
6482 (const_int 7) (const_int 7)
6483 (const_int 9) (const_int 9)
6484 (const_int 11) (const_int 11)
6485 (const_int 13) (const_int 13)
6486 (const_int 15) (const_int 15)])))]
6488 "vmovshdup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6489 [(set_attr "type" "sse")
6490 (set_attr "prefix" "evex")
6491 (set_attr "mode" "V16SF")])
6493 (define_insn "avx_movsldup256<mask_name>"
6494 [(set (match_operand:V8SF 0 "register_operand" "=v")
6497 (match_operand:V8SF 1 "nonimmediate_operand" "vm")
6499 (parallel [(const_int 0) (const_int 0)
6500 (const_int 2) (const_int 2)
6501 (const_int 4) (const_int 4)
6502 (const_int 6) (const_int 6)])))]
6503 "TARGET_AVX && <mask_avx512vl_condition>"
6504 "vmovsldup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6505 [(set_attr "type" "sse")
6506 (set_attr "prefix" "vex")
6507 (set_attr "mode" "V8SF")])
6509 (define_insn "sse3_movsldup<mask_name>"
6510 [(set (match_operand:V4SF 0 "register_operand" "=v")
6513 (match_operand:V4SF 1 "vector_operand" "vBm")
6515 (parallel [(const_int 0)
6519 "TARGET_SSE3 && <mask_avx512vl_condition>"
6520 "%vmovsldup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6521 [(set_attr "type" "sse")
6522 (set_attr "prefix_rep" "1")
6523 (set_attr "prefix" "maybe_vex")
6524 (set_attr "mode" "V4SF")])
6526 (define_insn "<mask_codefor>avx512f_movsldup512<mask_name>"
6527 [(set (match_operand:V16SF 0 "register_operand" "=v")
6530 (match_operand:V16SF 1 "nonimmediate_operand" "vm")
6532 (parallel [(const_int 0) (const_int 0)
6533 (const_int 2) (const_int 2)
6534 (const_int 4) (const_int 4)
6535 (const_int 6) (const_int 6)
6536 (const_int 8) (const_int 8)
6537 (const_int 10) (const_int 10)
6538 (const_int 12) (const_int 12)
6539 (const_int 14) (const_int 14)])))]
6541 "vmovsldup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6542 [(set_attr "type" "sse")
6543 (set_attr "prefix" "evex")
6544 (set_attr "mode" "V16SF")])
6546 (define_expand "avx_shufps256<mask_expand4_name>"
6547 [(match_operand:V8SF 0 "register_operand")
6548 (match_operand:V8SF 1 "register_operand")
6549 (match_operand:V8SF 2 "nonimmediate_operand")
6550 (match_operand:SI 3 "const_int_operand")]
6553 int mask = INTVAL (operands[3]);
6554 emit_insn (gen_avx_shufps256_1<mask_expand4_name> (operands[0],
6557 GEN_INT ((mask >> 0) & 3),
6558 GEN_INT ((mask >> 2) & 3),
6559 GEN_INT (((mask >> 4) & 3) + 8),
6560 GEN_INT (((mask >> 6) & 3) + 8),
6561 GEN_INT (((mask >> 0) & 3) + 4),
6562 GEN_INT (((mask >> 2) & 3) + 4),
6563 GEN_INT (((mask >> 4) & 3) + 12),
6564 GEN_INT (((mask >> 6) & 3) + 12)
6565 <mask_expand4_args>));
6569 ;; One bit in mask selects 2 elements.
6570 (define_insn "avx_shufps256_1<mask_name>"
6571 [(set (match_operand:V8SF 0 "register_operand" "=v")
6574 (match_operand:V8SF 1 "register_operand" "v")
6575 (match_operand:V8SF 2 "nonimmediate_operand" "vm"))
6576 (parallel [(match_operand 3 "const_0_to_3_operand" )
6577 (match_operand 4 "const_0_to_3_operand" )
6578 (match_operand 5 "const_8_to_11_operand" )
6579 (match_operand 6 "const_8_to_11_operand" )
6580 (match_operand 7 "const_4_to_7_operand" )
6581 (match_operand 8 "const_4_to_7_operand" )
6582 (match_operand 9 "const_12_to_15_operand")
6583 (match_operand 10 "const_12_to_15_operand")])))]
6585 && <mask_avx512vl_condition>
6586 && (INTVAL (operands[3]) == (INTVAL (operands[7]) - 4)
6587 && INTVAL (operands[4]) == (INTVAL (operands[8]) - 4)
6588 && INTVAL (operands[5]) == (INTVAL (operands[9]) - 4)
6589 && INTVAL (operands[6]) == (INTVAL (operands[10]) - 4))"
6592 mask = INTVAL (operands[3]);
6593 mask |= INTVAL (operands[4]) << 2;
6594 mask |= (INTVAL (operands[5]) - 8) << 4;
6595 mask |= (INTVAL (operands[6]) - 8) << 6;
6596 operands[3] = GEN_INT (mask);
6598 return "vshufps\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
6600 [(set_attr "type" "sseshuf")
6601 (set_attr "length_immediate" "1")
6602 (set_attr "prefix" "<mask_prefix>")
6603 (set_attr "mode" "V8SF")])
6605 (define_expand "sse_shufps<mask_expand4_name>"
6606 [(match_operand:V4SF 0 "register_operand")
6607 (match_operand:V4SF 1 "register_operand")
6608 (match_operand:V4SF 2 "vector_operand")
6609 (match_operand:SI 3 "const_int_operand")]
6612 int mask = INTVAL (operands[3]);
6613 emit_insn (gen_sse_shufps_v4sf<mask_expand4_name> (operands[0],
6616 GEN_INT ((mask >> 0) & 3),
6617 GEN_INT ((mask >> 2) & 3),
6618 GEN_INT (((mask >> 4) & 3) + 4),
6619 GEN_INT (((mask >> 6) & 3) + 4)
6620 <mask_expand4_args>));
6624 (define_insn "sse_shufps_v4sf_mask"
6625 [(set (match_operand:V4SF 0 "register_operand" "=v")
6629 (match_operand:V4SF 1 "register_operand" "v")
6630 (match_operand:V4SF 2 "nonimmediate_operand" "vm"))
6631 (parallel [(match_operand 3 "const_0_to_3_operand")
6632 (match_operand 4 "const_0_to_3_operand")
6633 (match_operand 5 "const_4_to_7_operand")
6634 (match_operand 6 "const_4_to_7_operand")]))
6635 (match_operand:V4SF 7 "vector_move_operand" "0C")
6636 (match_operand:QI 8 "register_operand" "Yk")))]
6640 mask |= INTVAL (operands[3]) << 0;
6641 mask |= INTVAL (operands[4]) << 2;
6642 mask |= (INTVAL (operands[5]) - 4) << 4;
6643 mask |= (INTVAL (operands[6]) - 4) << 6;
6644 operands[3] = GEN_INT (mask);
6646 return "vshufps\t{%3, %2, %1, %0%{%8%}%N7|%0%{%8%}%N7, %1, %2, %3}";
6648 [(set_attr "type" "sseshuf")
6649 (set_attr "length_immediate" "1")
6650 (set_attr "prefix" "evex")
6651 (set_attr "mode" "V4SF")])
6653 (define_insn "sse_shufps_<mode>"
6654 [(set (match_operand:VI4F_128 0 "register_operand" "=x,v")
6655 (vec_select:VI4F_128
6656 (vec_concat:<ssedoublevecmode>
6657 (match_operand:VI4F_128 1 "register_operand" "0,v")
6658 (match_operand:VI4F_128 2 "vector_operand" "xBm,vm"))
6659 (parallel [(match_operand 3 "const_0_to_3_operand")
6660 (match_operand 4 "const_0_to_3_operand")
6661 (match_operand 5 "const_4_to_7_operand")
6662 (match_operand 6 "const_4_to_7_operand")])))]
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 switch (which_alternative)
6675 return "shufps\t{%3, %2, %0|%0, %2, %3}";
6677 return "vshufps\t{%3, %2, %1, %0|%0, %1, %2, %3}";
6682 [(set_attr "isa" "noavx,avx")
6683 (set_attr "type" "sseshuf")
6684 (set_attr "length_immediate" "1")
6685 (set_attr "prefix" "orig,maybe_evex")
6686 (set_attr "mode" "V4SF")])
6688 (define_insn "sse_storehps"
6689 [(set (match_operand:V2SF 0 "nonimmediate_operand" "=m,v,v")
6691 (match_operand:V4SF 1 "nonimmediate_operand" "v,v,o")
6692 (parallel [(const_int 2) (const_int 3)])))]
6693 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
6695 %vmovhps\t{%1, %0|%q0, %1}
6696 %vmovhlps\t{%1, %d0|%d0, %1}
6697 %vmovlps\t{%H1, %d0|%d0, %H1}"
6698 [(set_attr "type" "ssemov")
6699 (set_attr "prefix" "maybe_vex")
6700 (set_attr "mode" "V2SF,V4SF,V2SF")])
6702 (define_expand "sse_loadhps_exp"
6703 [(set (match_operand:V4SF 0 "nonimmediate_operand")
6706 (match_operand:V4SF 1 "nonimmediate_operand")
6707 (parallel [(const_int 0) (const_int 1)]))
6708 (match_operand:V2SF 2 "nonimmediate_operand")))]
6711 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
6713 emit_insn (gen_sse_loadhps (dst, operands[1], operands[2]));
6715 /* Fix up the destination if needed. */
6716 if (dst != operands[0])
6717 emit_move_insn (operands[0], dst);
6722 (define_insn "sse_loadhps"
6723 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,v,x,v,o")
6726 (match_operand:V4SF 1 "nonimmediate_operand" " 0,v,0,v,0")
6727 (parallel [(const_int 0) (const_int 1)]))
6728 (match_operand:V2SF 2 "nonimmediate_operand" " m,m,x,v,v")))]
6731 movhps\t{%2, %0|%0, %q2}
6732 vmovhps\t{%2, %1, %0|%0, %1, %q2}
6733 movlhps\t{%2, %0|%0, %2}
6734 vmovlhps\t{%2, %1, %0|%0, %1, %2}
6735 %vmovlps\t{%2, %H0|%H0, %2}"
6736 [(set_attr "isa" "noavx,avx,noavx,avx,*")
6737 (set_attr "type" "ssemov")
6738 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,maybe_vex")
6739 (set_attr "mode" "V2SF,V2SF,V4SF,V4SF,V2SF")])
6741 (define_insn "sse_storelps"
6742 [(set (match_operand:V2SF 0 "nonimmediate_operand" "=m,v,v")
6744 (match_operand:V4SF 1 "nonimmediate_operand" " v,v,m")
6745 (parallel [(const_int 0) (const_int 1)])))]
6746 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
6748 %vmovlps\t{%1, %0|%q0, %1}
6749 %vmovaps\t{%1, %0|%0, %1}
6750 %vmovlps\t{%1, %d0|%d0, %q1}"
6751 [(set_attr "type" "ssemov")
6752 (set_attr "prefix" "maybe_vex")
6753 (set_attr "mode" "V2SF,V4SF,V2SF")])
6755 (define_expand "sse_loadlps_exp"
6756 [(set (match_operand:V4SF 0 "nonimmediate_operand")
6758 (match_operand:V2SF 2 "nonimmediate_operand")
6760 (match_operand:V4SF 1 "nonimmediate_operand")
6761 (parallel [(const_int 2) (const_int 3)]))))]
6764 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
6766 emit_insn (gen_sse_loadlps (dst, operands[1], operands[2]));
6768 /* Fix up the destination if needed. */
6769 if (dst != operands[0])
6770 emit_move_insn (operands[0], dst);
6775 (define_insn "sse_loadlps"
6776 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,v,x,v,m")
6778 (match_operand:V2SF 2 "nonimmediate_operand" " 0,v,m,m,v")
6780 (match_operand:V4SF 1 "nonimmediate_operand" " x,v,0,v,0")
6781 (parallel [(const_int 2) (const_int 3)]))))]
6784 shufps\t{$0xe4, %1, %0|%0, %1, 0xe4}
6785 vshufps\t{$0xe4, %1, %2, %0|%0, %2, %1, 0xe4}
6786 movlps\t{%2, %0|%0, %q2}
6787 vmovlps\t{%2, %1, %0|%0, %1, %q2}
6788 %vmovlps\t{%2, %0|%q0, %2}"
6789 [(set_attr "isa" "noavx,avx,noavx,avx,*")
6790 (set_attr "type" "sseshuf,sseshuf,ssemov,ssemov,ssemov")
6791 (set (attr "length_immediate")
6792 (if_then_else (eq_attr "alternative" "0,1")
6794 (const_string "*")))
6795 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,maybe_vex")
6796 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF,V2SF")])
6798 (define_insn "sse_movss"
6799 [(set (match_operand:V4SF 0 "register_operand" "=x,v")
6801 (match_operand:V4SF 2 "register_operand" " x,v")
6802 (match_operand:V4SF 1 "register_operand" " 0,v")
6806 movss\t{%2, %0|%0, %2}
6807 vmovss\t{%2, %1, %0|%0, %1, %2}"
6808 [(set_attr "isa" "noavx,avx")
6809 (set_attr "type" "ssemov")
6810 (set_attr "prefix" "orig,maybe_evex")
6811 (set_attr "mode" "SF")])
6813 (define_insn "avx2_vec_dup<mode>"
6814 [(set (match_operand:VF1_128_256 0 "register_operand" "=v")
6815 (vec_duplicate:VF1_128_256
6817 (match_operand:V4SF 1 "register_operand" "v")
6818 (parallel [(const_int 0)]))))]
6820 "vbroadcastss\t{%1, %0|%0, %1}"
6821 [(set_attr "type" "sselog1")
6822 (set_attr "prefix" "maybe_evex")
6823 (set_attr "mode" "<MODE>")])
6825 (define_insn "avx2_vec_dupv8sf_1"
6826 [(set (match_operand:V8SF 0 "register_operand" "=v")
6829 (match_operand:V8SF 1 "register_operand" "v")
6830 (parallel [(const_int 0)]))))]
6832 "vbroadcastss\t{%x1, %0|%0, %x1}"
6833 [(set_attr "type" "sselog1")
6834 (set_attr "prefix" "maybe_evex")
6835 (set_attr "mode" "V8SF")])
6837 (define_insn "avx512f_vec_dup<mode>_1"
6838 [(set (match_operand:VF_512 0 "register_operand" "=v")
6839 (vec_duplicate:VF_512
6840 (vec_select:<ssescalarmode>
6841 (match_operand:VF_512 1 "register_operand" "v")
6842 (parallel [(const_int 0)]))))]
6844 "vbroadcast<bcstscalarsuff>\t{%x1, %0|%0, %x1}"
6845 [(set_attr "type" "sselog1")
6846 (set_attr "prefix" "evex")
6847 (set_attr "mode" "<MODE>")])
6849 ;; Although insertps takes register source, we prefer
6850 ;; unpcklps with register source since it is shorter.
6851 (define_insn "*vec_concatv2sf_sse4_1"
6852 [(set (match_operand:V2SF 0 "register_operand"
6853 "=Yr,*x, v,Yr,*x,v,v,*y ,*y")
6855 (match_operand:SF 1 "nonimmediate_operand"
6856 " 0, 0,Yv, 0,0, v,m, 0 , m")
6857 (match_operand:SF 2 "vector_move_operand"
6858 " Yr,*x,Yv, m,m, m,C,*ym, C")))]
6859 "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
6861 unpcklps\t{%2, %0|%0, %2}
6862 unpcklps\t{%2, %0|%0, %2}
6863 vunpcklps\t{%2, %1, %0|%0, %1, %2}
6864 insertps\t{$0x10, %2, %0|%0, %2, 0x10}
6865 insertps\t{$0x10, %2, %0|%0, %2, 0x10}
6866 vinsertps\t{$0x10, %2, %1, %0|%0, %1, %2, 0x10}
6867 %vmovss\t{%1, %0|%0, %1}
6868 punpckldq\t{%2, %0|%0, %2}
6869 movd\t{%1, %0|%0, %1}"
6871 (cond [(eq_attr "alternative" "0,1,3,4")
6872 (const_string "noavx")
6873 (eq_attr "alternative" "2,5")
6874 (const_string "avx")
6876 (const_string "*")))
6878 (cond [(eq_attr "alternative" "6")
6879 (const_string "ssemov")
6880 (eq_attr "alternative" "7")
6881 (const_string "mmxcvt")
6882 (eq_attr "alternative" "8")
6883 (const_string "mmxmov")
6885 (const_string "sselog")))
6886 (set (attr "prefix_data16")
6887 (if_then_else (eq_attr "alternative" "3,4")
6889 (const_string "*")))
6890 (set (attr "prefix_extra")
6891 (if_then_else (eq_attr "alternative" "3,4,5")
6893 (const_string "*")))
6894 (set (attr "length_immediate")
6895 (if_then_else (eq_attr "alternative" "3,4,5")
6897 (const_string "*")))
6898 (set (attr "prefix")
6899 (cond [(eq_attr "alternative" "2,5")
6900 (const_string "maybe_evex")
6901 (eq_attr "alternative" "6")
6902 (const_string "maybe_vex")
6904 (const_string "orig")))
6905 (set_attr "mode" "V4SF,V4SF,V4SF,V4SF,V4SF,V4SF,SF,DI,DI")])
6907 ;; ??? In theory we can match memory for the MMX alternative, but allowing
6908 ;; vector_operand for operand 2 and *not* allowing memory for the SSE
6909 ;; alternatives pretty much forces the MMX alternative to be chosen.
6910 (define_insn "*vec_concatv2sf_sse"
6911 [(set (match_operand:V2SF 0 "register_operand" "=x,x,*y,*y")
6913 (match_operand:SF 1 "nonimmediate_operand" " 0,m, 0, m")
6914 (match_operand:SF 2 "reg_or_0_operand" " x,C,*y, C")))]
6917 unpcklps\t{%2, %0|%0, %2}
6918 movss\t{%1, %0|%0, %1}
6919 punpckldq\t{%2, %0|%0, %2}
6920 movd\t{%1, %0|%0, %1}"
6921 [(set_attr "type" "sselog,ssemov,mmxcvt,mmxmov")
6922 (set_attr "mode" "V4SF,SF,DI,DI")])
6924 (define_insn "*vec_concatv4sf"
6925 [(set (match_operand:V4SF 0 "register_operand" "=x,v,x,v")
6927 (match_operand:V2SF 1 "register_operand" " 0,v,0,v")
6928 (match_operand:V2SF 2 "nonimmediate_operand" " x,v,m,m")))]
6931 movlhps\t{%2, %0|%0, %2}
6932 vmovlhps\t{%2, %1, %0|%0, %1, %2}
6933 movhps\t{%2, %0|%0, %q2}
6934 vmovhps\t{%2, %1, %0|%0, %1, %q2}"
6935 [(set_attr "isa" "noavx,avx,noavx,avx")
6936 (set_attr "type" "ssemov")
6937 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex")
6938 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF")])
6940 ;; Avoid combining registers from different units in a single alternative,
6941 ;; see comment above inline_secondary_memory_needed function in i386.c
6942 (define_insn "vec_set<mode>_0"
6943 [(set (match_operand:VI4F_128 0 "nonimmediate_operand"
6944 "=Yr,*x,v,v,Yi,x,x,v,Yr ,*x ,x ,m ,m ,m")
6946 (vec_duplicate:VI4F_128
6947 (match_operand:<ssescalarmode> 2 "general_operand"
6948 " Yr,*x,v,m,r ,m,x,v,*rm,*rm,*rm,!x,!*re,!*fF"))
6949 (match_operand:VI4F_128 1 "vector_move_operand"
6950 " C , C,C,C,C ,C,0,v,0 ,0 ,x ,0 ,0 ,0")
6954 insertps\t{$0xe, %2, %0|%0, %2, 0xe}
6955 insertps\t{$0xe, %2, %0|%0, %2, 0xe}
6956 vinsertps\t{$0xe, %2, %2, %0|%0, %2, %2, 0xe}
6957 %vmov<ssescalarmodesuffix>\t{%2, %0|%0, %2}
6958 %vmovd\t{%2, %0|%0, %2}
6959 movss\t{%2, %0|%0, %2}
6960 movss\t{%2, %0|%0, %2}
6961 vmovss\t{%2, %1, %0|%0, %1, %2}
6962 pinsrd\t{$0, %2, %0|%0, %2, 0}
6963 pinsrd\t{$0, %2, %0|%0, %2, 0}
6964 vpinsrd\t{$0, %2, %1, %0|%0, %1, %2, 0}
6969 (cond [(eq_attr "alternative" "0,1,8,9")
6970 (const_string "sse4_noavx")
6971 (eq_attr "alternative" "2,7,10")
6972 (const_string "avx")
6973 (eq_attr "alternative" "3,4")
6974 (const_string "sse2")
6975 (eq_attr "alternative" "5,6")
6976 (const_string "noavx")
6978 (const_string "*")))
6980 (cond [(eq_attr "alternative" "0,1,2,8,9,10")
6981 (const_string "sselog")
6982 (eq_attr "alternative" "12")
6983 (const_string "imov")
6984 (eq_attr "alternative" "13")
6985 (const_string "fmov")
6987 (const_string "ssemov")))
6988 (set (attr "prefix_extra")
6989 (if_then_else (eq_attr "alternative" "8,9,10")
6991 (const_string "*")))
6992 (set (attr "length_immediate")
6993 (if_then_else (eq_attr "alternative" "8,9,10")
6995 (const_string "*")))
6996 (set (attr "prefix")
6997 (cond [(eq_attr "alternative" "0,1,5,6,8,9")
6998 (const_string "orig")
6999 (eq_attr "alternative" "2")
7000 (const_string "maybe_evex")
7001 (eq_attr "alternative" "3,4")
7002 (const_string "maybe_vex")
7003 (eq_attr "alternative" "7,10")
7004 (const_string "vex")
7006 (const_string "*")))
7007 (set_attr "mode" "SF,SF,SF,<ssescalarmode>,SI,SF,SF,SF,TI,TI,TI,*,*,*")])
7009 ;; A subset is vec_setv4sf.
7010 (define_insn "*vec_setv4sf_sse4_1"
7011 [(set (match_operand:V4SF 0 "register_operand" "=Yr,*x,v")
7014 (match_operand:SF 2 "nonimmediate_operand" "Yrm,*xm,vm"))
7015 (match_operand:V4SF 1 "register_operand" "0,0,v")
7016 (match_operand:SI 3 "const_int_operand")))]
7018 && ((unsigned) exact_log2 (INTVAL (operands[3]))
7019 < GET_MODE_NUNITS (V4SFmode))"
7021 operands[3] = GEN_INT (exact_log2 (INTVAL (operands[3])) << 4);
7022 switch (which_alternative)
7026 return "insertps\t{%3, %2, %0|%0, %2, %3}";
7028 return "vinsertps\t{%3, %2, %1, %0|%0, %1, %2, %3}";
7033 [(set_attr "isa" "noavx,noavx,avx")
7034 (set_attr "type" "sselog")
7035 (set_attr "prefix_data16" "1,1,*")
7036 (set_attr "prefix_extra" "1")
7037 (set_attr "length_immediate" "1")
7038 (set_attr "prefix" "orig,orig,maybe_evex")
7039 (set_attr "mode" "V4SF")])
7041 (define_insn "sse4_1_insertps"
7042 [(set (match_operand:V4SF 0 "register_operand" "=Yr,*x,v")
7043 (unspec:V4SF [(match_operand:V4SF 2 "nonimmediate_operand" "Yrm,*xm,vm")
7044 (match_operand:V4SF 1 "register_operand" "0,0,v")
7045 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")]
7049 if (MEM_P (operands[2]))
7051 unsigned count_s = INTVAL (operands[3]) >> 6;
7053 operands[3] = GEN_INT (INTVAL (operands[3]) & 0x3f);
7054 operands[2] = adjust_address_nv (operands[2], SFmode, count_s * 4);
7056 switch (which_alternative)
7060 return "insertps\t{%3, %2, %0|%0, %2, %3}";
7062 return "vinsertps\t{%3, %2, %1, %0|%0, %1, %2, %3}";
7067 [(set_attr "isa" "noavx,noavx,avx")
7068 (set_attr "type" "sselog")
7069 (set_attr "prefix_data16" "1,1,*")
7070 (set_attr "prefix_extra" "1")
7071 (set_attr "length_immediate" "1")
7072 (set_attr "prefix" "orig,orig,maybe_evex")
7073 (set_attr "mode" "V4SF")])
7076 [(set (match_operand:VI4F_128 0 "memory_operand")
7078 (vec_duplicate:VI4F_128
7079 (match_operand:<ssescalarmode> 1 "nonmemory_operand"))
7082 "TARGET_SSE && reload_completed"
7083 [(set (match_dup 0) (match_dup 1))]
7084 "operands[0] = adjust_address (operands[0], <ssescalarmode>mode, 0);")
7086 (define_expand "vec_set<mode>"
7087 [(match_operand:V 0 "register_operand")
7088 (match_operand:<ssescalarmode> 1 "register_operand")
7089 (match_operand 2 "const_int_operand")]
7092 ix86_expand_vector_set (false, operands[0], operands[1],
7093 INTVAL (operands[2]));
7097 (define_insn_and_split "*vec_extractv4sf_0"
7098 [(set (match_operand:SF 0 "nonimmediate_operand" "=v,m,f,r")
7100 (match_operand:V4SF 1 "nonimmediate_operand" "vm,v,m,m")
7101 (parallel [(const_int 0)])))]
7102 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7104 "&& reload_completed"
7105 [(set (match_dup 0) (match_dup 1))]
7106 "operands[1] = gen_lowpart (SFmode, operands[1]);")
7108 (define_insn_and_split "*sse4_1_extractps"
7109 [(set (match_operand:SF 0 "nonimmediate_operand" "=rm,rm,rm,Yv,Yv")
7111 (match_operand:V4SF 1 "register_operand" "Yr,*x,v,0,v")
7112 (parallel [(match_operand:SI 2 "const_0_to_3_operand" "n,n,n,n,n")])))]
7115 extractps\t{%2, %1, %0|%0, %1, %2}
7116 extractps\t{%2, %1, %0|%0, %1, %2}
7117 vextractps\t{%2, %1, %0|%0, %1, %2}
7120 "&& reload_completed && SSE_REG_P (operands[0])"
7123 rtx dest = lowpart_subreg (V4SFmode, operands[0], SFmode);
7124 switch (INTVAL (operands[2]))
7128 emit_insn (gen_sse_shufps_v4sf (dest, operands[1], operands[1],
7129 operands[2], operands[2],
7130 GEN_INT (INTVAL (operands[2]) + 4),
7131 GEN_INT (INTVAL (operands[2]) + 4)));
7134 emit_insn (gen_vec_interleave_highv4sf (dest, operands[1], operands[1]));
7137 /* 0 should be handled by the *vec_extractv4sf_0 pattern above. */
7142 [(set_attr "isa" "noavx,noavx,avx,noavx,avx")
7143 (set_attr "type" "sselog,sselog,sselog,*,*")
7144 (set_attr "prefix_data16" "1,1,1,*,*")
7145 (set_attr "prefix_extra" "1,1,1,*,*")
7146 (set_attr "length_immediate" "1,1,1,*,*")
7147 (set_attr "prefix" "orig,orig,maybe_evex,*,*")
7148 (set_attr "mode" "V4SF,V4SF,V4SF,*,*")])
7150 (define_insn_and_split "*vec_extractv4sf_mem"
7151 [(set (match_operand:SF 0 "register_operand" "=v,*r,f")
7153 (match_operand:V4SF 1 "memory_operand" "o,o,o")
7154 (parallel [(match_operand 2 "const_0_to_3_operand" "n,n,n")])))]
7157 "&& reload_completed"
7158 [(set (match_dup 0) (match_dup 1))]
7160 operands[1] = adjust_address (operands[1], SFmode, INTVAL (operands[2]) * 4);
7163 (define_mode_attr extract_type
7164 [(V16SF "avx512f") (V16SI "avx512f") (V8DF "avx512dq") (V8DI "avx512dq")])
7166 (define_mode_attr extract_suf
7167 [(V16SF "32x4") (V16SI "32x4") (V8DF "64x2") (V8DI "64x2")])
7169 (define_mode_iterator AVX512_VEC
7170 [(V8DF "TARGET_AVX512DQ") (V8DI "TARGET_AVX512DQ") V16SF V16SI])
7172 (define_expand "<extract_type>_vextract<shuffletype><extract_suf>_mask"
7173 [(match_operand:<ssequartermode> 0 "nonimmediate_operand")
7174 (match_operand:AVX512_VEC 1 "register_operand")
7175 (match_operand:SI 2 "const_0_to_3_operand")
7176 (match_operand:<ssequartermode> 3 "nonimmediate_operand")
7177 (match_operand:QI 4 "register_operand")]
7181 mask = INTVAL (operands[2]);
7182 rtx dest = operands[0];
7184 if (MEM_P (operands[0]) && !rtx_equal_p (operands[0], operands[3]))
7185 dest = gen_reg_rtx (<ssequartermode>mode);
7187 if (<MODE>mode == V16SImode || <MODE>mode == V16SFmode)
7188 emit_insn (gen_avx512f_vextract<shuffletype>32x4_1_mask (dest,
7189 operands[1], GEN_INT (mask * 4), GEN_INT (mask * 4 + 1),
7190 GEN_INT (mask * 4 + 2), GEN_INT (mask * 4 + 3), operands[3],
7193 emit_insn (gen_avx512dq_vextract<shuffletype>64x2_1_mask (dest,
7194 operands[1], GEN_INT (mask * 2), GEN_INT (mask * 2 + 1), operands[3],
7196 if (dest != operands[0])
7197 emit_move_insn (operands[0], dest);
7201 (define_insn "avx512dq_vextract<shuffletype>64x2_1_maskm"
7202 [(set (match_operand:<ssequartermode> 0 "memory_operand" "=m")
7203 (vec_merge:<ssequartermode>
7204 (vec_select:<ssequartermode>
7205 (match_operand:V8FI 1 "register_operand" "v")
7206 (parallel [(match_operand 2 "const_0_to_7_operand")
7207 (match_operand 3 "const_0_to_7_operand")]))
7208 (match_operand:<ssequartermode> 4 "memory_operand" "0")
7209 (match_operand:QI 5 "register_operand" "Yk")))]
7211 && INTVAL (operands[2]) % 2 == 0
7212 && INTVAL (operands[2]) == INTVAL (operands[3]) - 1
7213 && rtx_equal_p (operands[4], operands[0])"
7215 operands[2] = GEN_INT ((INTVAL (operands[2])) >> 1);
7216 return "vextract<shuffletype>64x2\t{%2, %1, %0%{%5%}|%0%{%5%}, %1, %2}";
7218 [(set_attr "type" "sselog")
7219 (set_attr "prefix_extra" "1")
7220 (set_attr "length_immediate" "1")
7221 (set_attr "memory" "store")
7222 (set_attr "prefix" "evex")
7223 (set_attr "mode" "<sseinsnmode>")])
7225 (define_insn "avx512f_vextract<shuffletype>32x4_1_maskm"
7226 [(set (match_operand:<ssequartermode> 0 "memory_operand" "=m")
7227 (vec_merge:<ssequartermode>
7228 (vec_select:<ssequartermode>
7229 (match_operand:V16FI 1 "register_operand" "v")
7230 (parallel [(match_operand 2 "const_0_to_15_operand")
7231 (match_operand 3 "const_0_to_15_operand")
7232 (match_operand 4 "const_0_to_15_operand")
7233 (match_operand 5 "const_0_to_15_operand")]))
7234 (match_operand:<ssequartermode> 6 "memory_operand" "0")
7235 (match_operand:QI 7 "register_operand" "Yk")))]
7237 && INTVAL (operands[2]) % 4 == 0
7238 && INTVAL (operands[2]) == INTVAL (operands[3]) - 1
7239 && INTVAL (operands[3]) == INTVAL (operands[4]) - 1
7240 && INTVAL (operands[4]) == INTVAL (operands[5]) - 1
7241 && rtx_equal_p (operands[6], operands[0])"
7243 operands[2] = GEN_INT (INTVAL (operands[2]) >> 2);
7244 return "vextract<shuffletype>32x4\t{%2, %1, %0%{%7%}|%0%{%7%}, %1, %2}";
7246 [(set_attr "type" "sselog")
7247 (set_attr "prefix_extra" "1")
7248 (set_attr "length_immediate" "1")
7249 (set_attr "memory" "store")
7250 (set_attr "prefix" "evex")
7251 (set_attr "mode" "<sseinsnmode>")])
7253 (define_insn "<mask_codefor>avx512dq_vextract<shuffletype>64x2_1<mask_name>"
7254 [(set (match_operand:<ssequartermode> 0 "<store_mask_predicate>" "=<store_mask_constraint>")
7255 (vec_select:<ssequartermode>
7256 (match_operand:V8FI 1 "register_operand" "v")
7257 (parallel [(match_operand 2 "const_0_to_7_operand")
7258 (match_operand 3 "const_0_to_7_operand")])))]
7260 && INTVAL (operands[2]) % 2 == 0
7261 && INTVAL (operands[2]) == INTVAL (operands[3]) - 1"
7263 operands[2] = GEN_INT (INTVAL (operands[2]) >> 1);
7264 return "vextract<shuffletype>64x2\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}";
7266 [(set_attr "type" "sselog1")
7267 (set_attr "prefix_extra" "1")
7268 (set_attr "length_immediate" "1")
7269 (set_attr "prefix" "evex")
7270 (set_attr "mode" "<sseinsnmode>")])
7272 (define_insn "<mask_codefor>avx512f_vextract<shuffletype>32x4_1<mask_name>"
7273 [(set (match_operand:<ssequartermode> 0 "<store_mask_predicate>" "=<store_mask_constraint>")
7274 (vec_select:<ssequartermode>
7275 (match_operand:V16FI 1 "register_operand" "v")
7276 (parallel [(match_operand 2 "const_0_to_15_operand")
7277 (match_operand 3 "const_0_to_15_operand")
7278 (match_operand 4 "const_0_to_15_operand")
7279 (match_operand 5 "const_0_to_15_operand")])))]
7281 && INTVAL (operands[2]) % 4 == 0
7282 && INTVAL (operands[2]) == INTVAL (operands[3]) - 1
7283 && INTVAL (operands[3]) == INTVAL (operands[4]) - 1
7284 && INTVAL (operands[4]) == INTVAL (operands[5]) - 1"
7286 operands[2] = GEN_INT (INTVAL (operands[2]) >> 2);
7287 return "vextract<shuffletype>32x4\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
7289 [(set_attr "type" "sselog1")
7290 (set_attr "prefix_extra" "1")
7291 (set_attr "length_immediate" "1")
7292 (set_attr "prefix" "evex")
7293 (set_attr "mode" "<sseinsnmode>")])
7295 (define_mode_attr extract_type_2
7296 [(V16SF "avx512dq") (V16SI "avx512dq") (V8DF "avx512f") (V8DI "avx512f")])
7298 (define_mode_attr extract_suf_2
7299 [(V16SF "32x8") (V16SI "32x8") (V8DF "64x4") (V8DI "64x4")])
7301 (define_mode_iterator AVX512_VEC_2
7302 [(V16SF "TARGET_AVX512DQ") (V16SI "TARGET_AVX512DQ") V8DF V8DI])
7304 (define_expand "<extract_type_2>_vextract<shuffletype><extract_suf_2>_mask"
7305 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7306 (match_operand:AVX512_VEC_2 1 "register_operand")
7307 (match_operand:SI 2 "const_0_to_1_operand")
7308 (match_operand:<ssehalfvecmode> 3 "nonimmediate_operand")
7309 (match_operand:QI 4 "register_operand")]
7312 rtx (*insn)(rtx, rtx, rtx, rtx);
7313 rtx dest = operands[0];
7315 if (MEM_P (dest) && !rtx_equal_p (dest, operands[3]))
7316 dest = gen_reg_rtx (<ssehalfvecmode>mode);
7318 switch (INTVAL (operands[2]))
7321 insn = gen_vec_extract_lo_<mode>_mask;
7324 insn = gen_vec_extract_hi_<mode>_mask;
7330 emit_insn (insn (dest, operands[1], operands[3], operands[4]));
7331 if (dest != operands[0])
7332 emit_move_insn (operands[0], dest);
7337 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7338 (vec_select:<ssehalfvecmode>
7339 (match_operand:V8FI 1 "nonimmediate_operand")
7340 (parallel [(const_int 0) (const_int 1)
7341 (const_int 2) (const_int 3)])))]
7342 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))
7345 || (REG_P (operands[0]) && !EXT_REX_SSE_REG_P (operands[1])))"
7346 [(set (match_dup 0) (match_dup 1))]
7347 "operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);")
7349 (define_insn "vec_extract_lo_<mode>_maskm"
7350 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7351 (vec_merge:<ssehalfvecmode>
7352 (vec_select:<ssehalfvecmode>
7353 (match_operand:V8FI 1 "register_operand" "v")
7354 (parallel [(const_int 0) (const_int 1)
7355 (const_int 2) (const_int 3)]))
7356 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7357 (match_operand:QI 3 "register_operand" "Yk")))]
7359 && rtx_equal_p (operands[2], operands[0])"
7360 "vextract<shuffletype>64x4\t{$0x0, %1, %0%{%3%}|%0%{%3%}, %1, 0x0}"
7361 [(set_attr "type" "sselog1")
7362 (set_attr "prefix_extra" "1")
7363 (set_attr "length_immediate" "1")
7364 (set_attr "prefix" "evex")
7365 (set_attr "mode" "<sseinsnmode>")])
7367 (define_insn "vec_extract_lo_<mode><mask_name>"
7368 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=<store_mask_constraint>,v")
7369 (vec_select:<ssehalfvecmode>
7370 (match_operand:V8FI 1 "<store_mask_predicate>" "v,<store_mask_constraint>")
7371 (parallel [(const_int 0) (const_int 1)
7372 (const_int 2) (const_int 3)])))]
7374 && (<mask_applied> || !(MEM_P (operands[0]) && MEM_P (operands[1])))"
7376 if (<mask_applied> || (!TARGET_AVX512VL && !MEM_P (operands[1])))
7377 return "vextract<shuffletype>64x4\t{$0x0, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x0}";
7381 [(set_attr "type" "sselog1")
7382 (set_attr "prefix_extra" "1")
7383 (set_attr "length_immediate" "1")
7384 (set_attr "prefix" "evex")
7385 (set_attr "mode" "<sseinsnmode>")])
7387 (define_insn "vec_extract_hi_<mode>_maskm"
7388 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7389 (vec_merge:<ssehalfvecmode>
7390 (vec_select:<ssehalfvecmode>
7391 (match_operand:V8FI 1 "register_operand" "v")
7392 (parallel [(const_int 4) (const_int 5)
7393 (const_int 6) (const_int 7)]))
7394 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7395 (match_operand:QI 3 "register_operand" "Yk")))]
7397 && rtx_equal_p (operands[2], operands[0])"
7398 "vextract<shuffletype>64x4\t{$0x1, %1, %0%{%3%}|%0%{%3%}, %1, 0x1}"
7399 [(set_attr "type" "sselog")
7400 (set_attr "prefix_extra" "1")
7401 (set_attr "length_immediate" "1")
7402 (set_attr "memory" "store")
7403 (set_attr "prefix" "evex")
7404 (set_attr "mode" "<sseinsnmode>")])
7406 (define_insn "vec_extract_hi_<mode><mask_name>"
7407 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=<store_mask_constraint>")
7408 (vec_select:<ssehalfvecmode>
7409 (match_operand:V8FI 1 "register_operand" "v")
7410 (parallel [(const_int 4) (const_int 5)
7411 (const_int 6) (const_int 7)])))]
7413 "vextract<shuffletype>64x4\t{$0x1, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x1}"
7414 [(set_attr "type" "sselog1")
7415 (set_attr "prefix_extra" "1")
7416 (set_attr "length_immediate" "1")
7417 (set_attr "prefix" "evex")
7418 (set_attr "mode" "<sseinsnmode>")])
7420 (define_insn "vec_extract_hi_<mode>_maskm"
7421 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7422 (vec_merge:<ssehalfvecmode>
7423 (vec_select:<ssehalfvecmode>
7424 (match_operand:V16FI 1 "register_operand" "v")
7425 (parallel [(const_int 8) (const_int 9)
7426 (const_int 10) (const_int 11)
7427 (const_int 12) (const_int 13)
7428 (const_int 14) (const_int 15)]))
7429 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7430 (match_operand:QI 3 "register_operand" "Yk")))]
7432 && rtx_equal_p (operands[2], operands[0])"
7433 "vextract<shuffletype>32x8\t{$0x1, %1, %0%{%3%}|%0%{%3%}, %1, 0x1}"
7434 [(set_attr "type" "sselog1")
7435 (set_attr "prefix_extra" "1")
7436 (set_attr "length_immediate" "1")
7437 (set_attr "prefix" "evex")
7438 (set_attr "mode" "<sseinsnmode>")])
7440 (define_insn "vec_extract_hi_<mode><mask_name>"
7441 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=<store_mask_constraint>,vm")
7442 (vec_select:<ssehalfvecmode>
7443 (match_operand:V16FI 1 "register_operand" "v,v")
7444 (parallel [(const_int 8) (const_int 9)
7445 (const_int 10) (const_int 11)
7446 (const_int 12) (const_int 13)
7447 (const_int 14) (const_int 15)])))]
7448 "TARGET_AVX512F && <mask_avx512dq_condition>"
7450 vextract<shuffletype>32x8\t{$0x1, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x1}
7451 vextracti64x4\t{$0x1, %1, %0|%0, %1, 0x1}"
7452 [(set_attr "type" "sselog1")
7453 (set_attr "prefix_extra" "1")
7454 (set_attr "isa" "avx512dq,noavx512dq")
7455 (set_attr "length_immediate" "1")
7456 (set_attr "prefix" "evex")
7457 (set_attr "mode" "<sseinsnmode>")])
7459 (define_expand "avx512vl_vextractf128<mode>"
7460 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7461 (match_operand:VI48F_256 1 "register_operand")
7462 (match_operand:SI 2 "const_0_to_1_operand")
7463 (match_operand:<ssehalfvecmode> 3 "vector_move_operand")
7464 (match_operand:QI 4 "register_operand")]
7465 "TARGET_AVX512DQ && TARGET_AVX512VL"
7467 rtx (*insn)(rtx, rtx, rtx, rtx);
7468 rtx dest = operands[0];
7471 && (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 4
7472 /* For V8S[IF]mode there are maskm insns with =m and 0
7474 ? !rtx_equal_p (dest, operands[3])
7475 /* For V4D[IF]mode, hi insns don't allow memory, and
7476 lo insns have =m and 0C constraints. */
7477 : (operands[2] != const0_rtx
7478 || (!rtx_equal_p (dest, operands[3])
7479 && GET_CODE (operands[3]) != CONST_VECTOR))))
7480 dest = gen_reg_rtx (<ssehalfvecmode>mode);
7481 switch (INTVAL (operands[2]))
7484 insn = gen_vec_extract_lo_<mode>_mask;
7487 insn = gen_vec_extract_hi_<mode>_mask;
7493 emit_insn (insn (dest, operands[1], operands[3], operands[4]));
7494 if (dest != operands[0])
7495 emit_move_insn (operands[0], dest);
7499 (define_expand "avx_vextractf128<mode>"
7500 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7501 (match_operand:V_256 1 "register_operand")
7502 (match_operand:SI 2 "const_0_to_1_operand")]
7505 rtx (*insn)(rtx, rtx);
7507 switch (INTVAL (operands[2]))
7510 insn = gen_vec_extract_lo_<mode>;
7513 insn = gen_vec_extract_hi_<mode>;
7519 emit_insn (insn (operands[0], operands[1]));
7523 (define_insn "vec_extract_lo_<mode><mask_name>"
7524 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand" "=v,m")
7525 (vec_select:<ssehalfvecmode>
7526 (match_operand:V16FI 1 "<store_mask_predicate>"
7527 "<store_mask_constraint>,v")
7528 (parallel [(const_int 0) (const_int 1)
7529 (const_int 2) (const_int 3)
7530 (const_int 4) (const_int 5)
7531 (const_int 6) (const_int 7)])))]
7533 && <mask_mode512bit_condition>
7534 && (<mask_applied> || !(MEM_P (operands[0]) && MEM_P (operands[1])))"
7537 return "vextract<shuffletype>32x8\t{$0x0, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x0}";
7543 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7544 (vec_select:<ssehalfvecmode>
7545 (match_operand:V16FI 1 "nonimmediate_operand")
7546 (parallel [(const_int 0) (const_int 1)
7547 (const_int 2) (const_int 3)
7548 (const_int 4) (const_int 5)
7549 (const_int 6) (const_int 7)])))]
7550 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))
7551 && reload_completed"
7552 [(set (match_dup 0) (match_dup 1))]
7553 "operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);")
7555 (define_insn "vec_extract_lo_<mode><mask_name>"
7556 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=v,m")
7557 (vec_select:<ssehalfvecmode>
7558 (match_operand:VI8F_256 1 "<store_mask_predicate>"
7559 "<store_mask_constraint>,v")
7560 (parallel [(const_int 0) (const_int 1)])))]
7562 && <mask_avx512vl_condition> && <mask_avx512dq_condition>
7563 && (<mask_applied> || !(MEM_P (operands[0]) && MEM_P (operands[1])))"
7566 return "vextract<shuffletype>64x2\t{$0x0, %1, %0%{%3%}|%0%{%3%}, %1, 0x0}";
7570 [(set_attr "type" "sselog")
7571 (set_attr "prefix_extra" "1")
7572 (set_attr "length_immediate" "1")
7573 (set_attr "memory" "none,store")
7574 (set_attr "prefix" "evex")
7575 (set_attr "mode" "XI")])
7578 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7579 (vec_select:<ssehalfvecmode>
7580 (match_operand:VI8F_256 1 "nonimmediate_operand")
7581 (parallel [(const_int 0) (const_int 1)])))]
7582 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))
7583 && reload_completed"
7584 [(set (match_dup 0) (match_dup 1))]
7585 "operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);")
7587 (define_insn "vec_extract_hi_<mode><mask_name>"
7588 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=v,<store_mask_constraint>")
7589 (vec_select:<ssehalfvecmode>
7590 (match_operand:VI8F_256 1 "register_operand" "v,v")
7591 (parallel [(const_int 2) (const_int 3)])))]
7592 "TARGET_AVX && <mask_avx512vl_condition> && <mask_avx512dq_condition>"
7594 if (TARGET_AVX512VL)
7596 if (TARGET_AVX512DQ)
7597 return "vextract<shuffletype>64x2\t{$0x1, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x1}";
7599 return "vextract<shuffletype>32x4\t{$0x1, %1, %0|%0, %1, 0x1}";
7602 return "vextract<i128>\t{$0x1, %1, %0|%0, %1, 0x1}";
7604 [(set_attr "type" "sselog")
7605 (set_attr "prefix_extra" "1")
7606 (set_attr "length_immediate" "1")
7607 (set_attr "memory" "none,store")
7608 (set_attr "prefix" "vex")
7609 (set_attr "mode" "<sseinsnmode>")])
7612 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7613 (vec_select:<ssehalfvecmode>
7614 (match_operand:VI4F_256 1 "nonimmediate_operand")
7615 (parallel [(const_int 0) (const_int 1)
7616 (const_int 2) (const_int 3)])))]
7617 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))
7618 && reload_completed"
7619 [(set (match_dup 0) (match_dup 1))]
7620 "operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);")
7622 (define_insn "vec_extract_lo_<mode><mask_name>"
7623 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>"
7624 "=<store_mask_constraint>,v")
7625 (vec_select:<ssehalfvecmode>
7626 (match_operand:VI4F_256 1 "<store_mask_predicate>"
7627 "v,<store_mask_constraint>")
7628 (parallel [(const_int 0) (const_int 1)
7629 (const_int 2) (const_int 3)])))]
7631 && <mask_avx512vl_condition> && <mask_avx512dq_condition>
7632 && (<mask_applied> || !(MEM_P (operands[0]) && MEM_P (operands[1])))"
7635 return "vextract<shuffletype>32x4\t{$0x0, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x0}";
7639 [(set_attr "type" "sselog1")
7640 (set_attr "prefix_extra" "1")
7641 (set_attr "length_immediate" "1")
7642 (set_attr "prefix" "evex")
7643 (set_attr "mode" "<sseinsnmode>")])
7645 (define_insn "vec_extract_lo_<mode>_maskm"
7646 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7647 (vec_merge:<ssehalfvecmode>
7648 (vec_select:<ssehalfvecmode>
7649 (match_operand:VI4F_256 1 "register_operand" "v")
7650 (parallel [(const_int 0) (const_int 1)
7651 (const_int 2) (const_int 3)]))
7652 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7653 (match_operand:QI 3 "register_operand" "Yk")))]
7654 "TARGET_AVX512VL && TARGET_AVX512F
7655 && rtx_equal_p (operands[2], operands[0])"
7656 "vextract<shuffletype>32x4\t{$0x0, %1, %0%{%3%}|%0%{%3%}, %1, 0x0}"
7657 [(set_attr "type" "sselog1")
7658 (set_attr "prefix_extra" "1")
7659 (set_attr "length_immediate" "1")
7660 (set_attr "prefix" "evex")
7661 (set_attr "mode" "<sseinsnmode>")])
7663 (define_insn "vec_extract_hi_<mode>_maskm"
7664 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7665 (vec_merge:<ssehalfvecmode>
7666 (vec_select:<ssehalfvecmode>
7667 (match_operand:VI4F_256 1 "register_operand" "v")
7668 (parallel [(const_int 4) (const_int 5)
7669 (const_int 6) (const_int 7)]))
7670 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7671 (match_operand:<ssehalfvecmode> 3 "register_operand" "Yk")))]
7672 "TARGET_AVX512F && TARGET_AVX512VL
7673 && rtx_equal_p (operands[2], operands[0])"
7674 "vextract<shuffletype>32x4\t{$0x1, %1, %0%{%3%}|%0%{%3%}, %1, 0x1}"
7675 [(set_attr "type" "sselog1")
7676 (set_attr "length_immediate" "1")
7677 (set_attr "prefix" "evex")
7678 (set_attr "mode" "<sseinsnmode>")])
7680 (define_insn "vec_extract_hi_<mode>_mask"
7681 [(set (match_operand:<ssehalfvecmode> 0 "register_operand" "=v")
7682 (vec_merge:<ssehalfvecmode>
7683 (vec_select:<ssehalfvecmode>
7684 (match_operand:VI4F_256 1 "register_operand" "v")
7685 (parallel [(const_int 4) (const_int 5)
7686 (const_int 6) (const_int 7)]))
7687 (match_operand:<ssehalfvecmode> 2 "vector_move_operand" "0C")
7688 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
7690 "vextract<shuffletype>32x4\t{$0x1, %1, %0%{%3%}%N2|%0%{%3%}%N2, %1, 0x1}"
7691 [(set_attr "type" "sselog1")
7692 (set_attr "length_immediate" "1")
7693 (set_attr "prefix" "evex")
7694 (set_attr "mode" "<sseinsnmode>")])
7696 (define_insn "vec_extract_hi_<mode>"
7697 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand" "=xm, vm")
7698 (vec_select:<ssehalfvecmode>
7699 (match_operand:VI4F_256 1 "register_operand" "x, v")
7700 (parallel [(const_int 4) (const_int 5)
7701 (const_int 6) (const_int 7)])))]
7704 vextract<i128>\t{$0x1, %1, %0|%0, %1, 0x1}
7705 vextract<shuffletype>32x4\t{$0x1, %1, %0|%0, %1, 0x1}"
7706 [(set_attr "isa" "*, avx512vl")
7707 (set_attr "prefix" "vex, evex")
7708 (set_attr "type" "sselog1")
7709 (set_attr "length_immediate" "1")
7710 (set_attr "mode" "<sseinsnmode>")])
7712 (define_insn_and_split "vec_extract_lo_v32hi"
7713 [(set (match_operand:V16HI 0 "nonimmediate_operand" "=v,m")
7715 (match_operand:V32HI 1 "nonimmediate_operand" "vm,v")
7716 (parallel [(const_int 0) (const_int 1)
7717 (const_int 2) (const_int 3)
7718 (const_int 4) (const_int 5)
7719 (const_int 6) (const_int 7)
7720 (const_int 8) (const_int 9)
7721 (const_int 10) (const_int 11)
7722 (const_int 12) (const_int 13)
7723 (const_int 14) (const_int 15)])))]
7724 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7726 "&& reload_completed"
7727 [(set (match_dup 0) (match_dup 1))]
7728 "operands[1] = gen_lowpart (V16HImode, operands[1]);")
7730 (define_insn "vec_extract_hi_v32hi"
7731 [(set (match_operand:V16HI 0 "nonimmediate_operand" "=v,m")
7733 (match_operand:V32HI 1 "register_operand" "v,v")
7734 (parallel [(const_int 16) (const_int 17)
7735 (const_int 18) (const_int 19)
7736 (const_int 20) (const_int 21)
7737 (const_int 22) (const_int 23)
7738 (const_int 24) (const_int 25)
7739 (const_int 26) (const_int 27)
7740 (const_int 28) (const_int 29)
7741 (const_int 30) (const_int 31)])))]
7743 "vextracti64x4\t{$0x1, %1, %0|%0, %1, 0x1}"
7744 [(set_attr "type" "sselog")
7745 (set_attr "prefix_extra" "1")
7746 (set_attr "length_immediate" "1")
7747 (set_attr "memory" "none,store")
7748 (set_attr "prefix" "evex")
7749 (set_attr "mode" "XI")])
7751 (define_insn_and_split "vec_extract_lo_v16hi"
7752 [(set (match_operand:V8HI 0 "nonimmediate_operand" "=v,m")
7754 (match_operand:V16HI 1 "nonimmediate_operand" "vm,v")
7755 (parallel [(const_int 0) (const_int 1)
7756 (const_int 2) (const_int 3)
7757 (const_int 4) (const_int 5)
7758 (const_int 6) (const_int 7)])))]
7759 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7761 "&& reload_completed"
7762 [(set (match_dup 0) (match_dup 1))]
7763 "operands[1] = gen_lowpart (V8HImode, operands[1]);")
7765 (define_insn "vec_extract_hi_v16hi"
7766 [(set (match_operand:V8HI 0 "nonimmediate_operand" "=x,m,v,m,v,m")
7768 (match_operand:V16HI 1 "register_operand" "x,x,v,v,v,v")
7769 (parallel [(const_int 8) (const_int 9)
7770 (const_int 10) (const_int 11)
7771 (const_int 12) (const_int 13)
7772 (const_int 14) (const_int 15)])))]
7775 vextract%~128\t{$0x1, %1, %0|%0, %1, 0x1}
7776 vextract%~128\t{$0x1, %1, %0|%0, %1, 0x1}
7777 vextracti32x4\t{$0x1, %1, %0|%0, %1, 0x1}
7778 vextracti32x4\t{$0x1, %1, %0|%0, %1, 0x1}
7779 vextracti32x4\t{$0x1, %g1, %0|%0, %g1, 0x1}
7780 vextracti32x4\t{$0x1, %g1, %0|%0, %g1, 0x1}"
7781 [(set_attr "type" "sselog")
7782 (set_attr "prefix_extra" "1")
7783 (set_attr "length_immediate" "1")
7784 (set_attr "isa" "*,*,avx512dq,avx512dq,avx512f,avx512f")
7785 (set_attr "memory" "none,store,none,store,none,store")
7786 (set_attr "prefix" "vex,vex,evex,evex,evex,evex")
7787 (set_attr "mode" "OI")])
7789 (define_insn_and_split "vec_extract_lo_v64qi"
7790 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=v,m")
7792 (match_operand:V64QI 1 "nonimmediate_operand" "vm,v")
7793 (parallel [(const_int 0) (const_int 1)
7794 (const_int 2) (const_int 3)
7795 (const_int 4) (const_int 5)
7796 (const_int 6) (const_int 7)
7797 (const_int 8) (const_int 9)
7798 (const_int 10) (const_int 11)
7799 (const_int 12) (const_int 13)
7800 (const_int 14) (const_int 15)
7801 (const_int 16) (const_int 17)
7802 (const_int 18) (const_int 19)
7803 (const_int 20) (const_int 21)
7804 (const_int 22) (const_int 23)
7805 (const_int 24) (const_int 25)
7806 (const_int 26) (const_int 27)
7807 (const_int 28) (const_int 29)
7808 (const_int 30) (const_int 31)])))]
7809 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7811 "&& reload_completed"
7812 [(set (match_dup 0) (match_dup 1))]
7813 "operands[1] = gen_lowpart (V32QImode, operands[1]);")
7815 (define_insn "vec_extract_hi_v64qi"
7816 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=v,m")
7818 (match_operand:V64QI 1 "register_operand" "v,v")
7819 (parallel [(const_int 32) (const_int 33)
7820 (const_int 34) (const_int 35)
7821 (const_int 36) (const_int 37)
7822 (const_int 38) (const_int 39)
7823 (const_int 40) (const_int 41)
7824 (const_int 42) (const_int 43)
7825 (const_int 44) (const_int 45)
7826 (const_int 46) (const_int 47)
7827 (const_int 48) (const_int 49)
7828 (const_int 50) (const_int 51)
7829 (const_int 52) (const_int 53)
7830 (const_int 54) (const_int 55)
7831 (const_int 56) (const_int 57)
7832 (const_int 58) (const_int 59)
7833 (const_int 60) (const_int 61)
7834 (const_int 62) (const_int 63)])))]
7836 "vextracti64x4\t{$0x1, %1, %0|%0, %1, 0x1}"
7837 [(set_attr "type" "sselog")
7838 (set_attr "prefix_extra" "1")
7839 (set_attr "length_immediate" "1")
7840 (set_attr "memory" "none,store")
7841 (set_attr "prefix" "evex")
7842 (set_attr "mode" "XI")])
7844 (define_insn_and_split "vec_extract_lo_v32qi"
7845 [(set (match_operand:V16QI 0 "nonimmediate_operand" "=v,m")
7847 (match_operand:V32QI 1 "nonimmediate_operand" "vm,v")
7848 (parallel [(const_int 0) (const_int 1)
7849 (const_int 2) (const_int 3)
7850 (const_int 4) (const_int 5)
7851 (const_int 6) (const_int 7)
7852 (const_int 8) (const_int 9)
7853 (const_int 10) (const_int 11)
7854 (const_int 12) (const_int 13)
7855 (const_int 14) (const_int 15)])))]
7856 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7858 "&& reload_completed"
7859 [(set (match_dup 0) (match_dup 1))]
7860 "operands[1] = gen_lowpart (V16QImode, operands[1]);")
7862 (define_insn "vec_extract_hi_v32qi"
7863 [(set (match_operand:V16QI 0 "nonimmediate_operand" "=x,m,v,m,v,m")
7865 (match_operand:V32QI 1 "register_operand" "x,x,v,v,v,v")
7866 (parallel [(const_int 16) (const_int 17)
7867 (const_int 18) (const_int 19)
7868 (const_int 20) (const_int 21)
7869 (const_int 22) (const_int 23)
7870 (const_int 24) (const_int 25)
7871 (const_int 26) (const_int 27)
7872 (const_int 28) (const_int 29)
7873 (const_int 30) (const_int 31)])))]
7876 vextract%~128\t{$0x1, %1, %0|%0, %1, 0x1}
7877 vextract%~128\t{$0x1, %1, %0|%0, %1, 0x1}
7878 vextracti32x4\t{$0x1, %1, %0|%0, %1, 0x1}
7879 vextracti32x4\t{$0x1, %1, %0|%0, %1, 0x1}
7880 vextracti32x4\t{$0x1, %g1, %0|%0, %g1, 0x1}
7881 vextracti32x4\t{$0x1, %g1, %0|%0, %g1, 0x1}"
7882 [(set_attr "type" "sselog")
7883 (set_attr "prefix_extra" "1")
7884 (set_attr "length_immediate" "1")
7885 (set_attr "isa" "*,*,avx512dq,avx512dq,avx512f,avx512f")
7886 (set_attr "memory" "none,store,none,store,none,store")
7887 (set_attr "prefix" "vex,vex,evex,evex,evex,evex")
7888 (set_attr "mode" "OI")])
7890 ;; Modes handled by vec_extract patterns.
7891 (define_mode_iterator VEC_EXTRACT_MODE
7892 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX") V16QI
7893 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX") V8HI
7894 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
7895 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI
7896 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
7897 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") V2DF
7898 (V4TI "TARGET_AVX512F") (V2TI "TARGET_AVX")])
7900 (define_expand "vec_extract<mode><ssescalarmodelower>"
7901 [(match_operand:<ssescalarmode> 0 "register_operand")
7902 (match_operand:VEC_EXTRACT_MODE 1 "register_operand")
7903 (match_operand 2 "const_int_operand")]
7906 ix86_expand_vector_extract (false, operands[0], operands[1],
7907 INTVAL (operands[2]));
7911 (define_expand "vec_extract<mode><ssehalfvecmodelower>"
7912 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7913 (match_operand:V_512 1 "register_operand")
7914 (match_operand 2 "const_0_to_1_operand")]
7917 if (INTVAL (operands[2]))
7918 emit_insn (gen_vec_extract_hi_<mode> (operands[0], operands[1]));
7920 emit_insn (gen_vec_extract_lo_<mode> (operands[0], operands[1]));
7924 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7926 ;; Parallel double-precision floating point element swizzling
7928 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7930 (define_insn "<mask_codefor>avx512f_unpckhpd512<mask_name>"
7931 [(set (match_operand:V8DF 0 "register_operand" "=v")
7934 (match_operand:V8DF 1 "register_operand" "v")
7935 (match_operand:V8DF 2 "nonimmediate_operand" "vm"))
7936 (parallel [(const_int 1) (const_int 9)
7937 (const_int 3) (const_int 11)
7938 (const_int 5) (const_int 13)
7939 (const_int 7) (const_int 15)])))]
7941 "vunpckhpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
7942 [(set_attr "type" "sselog")
7943 (set_attr "prefix" "evex")
7944 (set_attr "mode" "V8DF")])
7946 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
7947 (define_insn "avx_unpckhpd256<mask_name>"
7948 [(set (match_operand:V4DF 0 "register_operand" "=v")
7951 (match_operand:V4DF 1 "register_operand" "v")
7952 (match_operand:V4DF 2 "nonimmediate_operand" "vm"))
7953 (parallel [(const_int 1) (const_int 5)
7954 (const_int 3) (const_int 7)])))]
7955 "TARGET_AVX && <mask_avx512vl_condition>"
7956 "vunpckhpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
7957 [(set_attr "type" "sselog")
7958 (set_attr "prefix" "vex")
7959 (set_attr "mode" "V4DF")])
7961 (define_expand "vec_interleave_highv4df"
7965 (match_operand:V4DF 1 "register_operand")
7966 (match_operand:V4DF 2 "nonimmediate_operand"))
7967 (parallel [(const_int 0) (const_int 4)
7968 (const_int 2) (const_int 6)])))
7974 (parallel [(const_int 1) (const_int 5)
7975 (const_int 3) (const_int 7)])))
7976 (set (match_operand:V4DF 0 "register_operand")
7981 (parallel [(const_int 2) (const_int 3)
7982 (const_int 6) (const_int 7)])))]
7985 operands[3] = gen_reg_rtx (V4DFmode);
7986 operands[4] = gen_reg_rtx (V4DFmode);
7990 (define_insn "avx512vl_unpckhpd128_mask"
7991 [(set (match_operand:V2DF 0 "register_operand" "=v")
7995 (match_operand:V2DF 1 "register_operand" "v")
7996 (match_operand:V2DF 2 "nonimmediate_operand" "vm"))
7997 (parallel [(const_int 1) (const_int 3)]))
7998 (match_operand:V2DF 3 "vector_move_operand" "0C")
7999 (match_operand:QI 4 "register_operand" "Yk")))]
8001 "vunpckhpd\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
8002 [(set_attr "type" "sselog")
8003 (set_attr "prefix" "evex")
8004 (set_attr "mode" "V2DF")])
8006 (define_expand "vec_interleave_highv2df"
8007 [(set (match_operand:V2DF 0 "register_operand")
8010 (match_operand:V2DF 1 "nonimmediate_operand")
8011 (match_operand:V2DF 2 "nonimmediate_operand"))
8012 (parallel [(const_int 1)
8016 if (!ix86_vec_interleave_v2df_operator_ok (operands, 1))
8017 operands[2] = force_reg (V2DFmode, operands[2]);
8020 (define_insn "*vec_interleave_highv2df"
8021 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,v,v,x,v,m")
8024 (match_operand:V2DF 1 "nonimmediate_operand" " 0,v,o,o,o,v")
8025 (match_operand:V2DF 2 "nonimmediate_operand" " x,v,1,0,v,0"))
8026 (parallel [(const_int 1)
8028 "TARGET_SSE2 && ix86_vec_interleave_v2df_operator_ok (operands, 1)"
8030 unpckhpd\t{%2, %0|%0, %2}
8031 vunpckhpd\t{%2, %1, %0|%0, %1, %2}
8032 %vmovddup\t{%H1, %0|%0, %H1}
8033 movlpd\t{%H1, %0|%0, %H1}
8034 vmovlpd\t{%H1, %2, %0|%0, %2, %H1}
8035 %vmovhpd\t{%1, %0|%q0, %1}"
8036 [(set_attr "isa" "noavx,avx,sse3,noavx,avx,*")
8037 (set_attr "type" "sselog,sselog,sselog,ssemov,ssemov,ssemov")
8038 (set (attr "prefix_data16")
8039 (if_then_else (eq_attr "alternative" "3,5")
8041 (const_string "*")))
8042 (set_attr "prefix" "orig,maybe_evex,maybe_vex,orig,maybe_evex,maybe_vex")
8043 (set_attr "mode" "V2DF,V2DF,DF,V1DF,V1DF,V1DF")])
8045 (define_expand "avx512f_movddup512<mask_name>"
8046 [(set (match_operand:V8DF 0 "register_operand")
8049 (match_operand:V8DF 1 "nonimmediate_operand")
8051 (parallel [(const_int 0) (const_int 8)
8052 (const_int 2) (const_int 10)
8053 (const_int 4) (const_int 12)
8054 (const_int 6) (const_int 14)])))]
8057 (define_expand "avx512f_unpcklpd512<mask_name>"
8058 [(set (match_operand:V8DF 0 "register_operand")
8061 (match_operand:V8DF 1 "register_operand")
8062 (match_operand:V8DF 2 "nonimmediate_operand"))
8063 (parallel [(const_int 0) (const_int 8)
8064 (const_int 2) (const_int 10)
8065 (const_int 4) (const_int 12)
8066 (const_int 6) (const_int 14)])))]
8069 (define_insn "*avx512f_unpcklpd512<mask_name>"
8070 [(set (match_operand:V8DF 0 "register_operand" "=v,v")
8073 (match_operand:V8DF 1 "nonimmediate_operand" "vm, v")
8074 (match_operand:V8DF 2 "nonimmediate_operand" "1 ,vm"))
8075 (parallel [(const_int 0) (const_int 8)
8076 (const_int 2) (const_int 10)
8077 (const_int 4) (const_int 12)
8078 (const_int 6) (const_int 14)])))]
8081 vmovddup\t{%1, %0<mask_operand3>|%0<mask_operand3>, %1}
8082 vunpcklpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8083 [(set_attr "type" "sselog")
8084 (set_attr "prefix" "evex")
8085 (set_attr "mode" "V8DF")])
8087 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
8088 (define_expand "avx_movddup256<mask_name>"
8089 [(set (match_operand:V4DF 0 "register_operand")
8092 (match_operand:V4DF 1 "nonimmediate_operand")
8094 (parallel [(const_int 0) (const_int 4)
8095 (const_int 2) (const_int 6)])))]
8096 "TARGET_AVX && <mask_avx512vl_condition>")
8098 (define_expand "avx_unpcklpd256<mask_name>"
8099 [(set (match_operand:V4DF 0 "register_operand")
8102 (match_operand:V4DF 1 "register_operand")
8103 (match_operand:V4DF 2 "nonimmediate_operand"))
8104 (parallel [(const_int 0) (const_int 4)
8105 (const_int 2) (const_int 6)])))]
8106 "TARGET_AVX && <mask_avx512vl_condition>")
8108 (define_insn "*avx_unpcklpd256<mask_name>"
8109 [(set (match_operand:V4DF 0 "register_operand" "=v,v")
8112 (match_operand:V4DF 1 "nonimmediate_operand" " v,m")
8113 (match_operand:V4DF 2 "nonimmediate_operand" "vm,1"))
8114 (parallel [(const_int 0) (const_int 4)
8115 (const_int 2) (const_int 6)])))]
8116 "TARGET_AVX && <mask_avx512vl_condition>"
8118 vunpcklpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
8119 vmovddup\t{%1, %0<mask_operand3>|%0<mask_operand3>, %1}"
8120 [(set_attr "type" "sselog")
8121 (set_attr "prefix" "vex")
8122 (set_attr "mode" "V4DF")])
8124 (define_expand "vec_interleave_lowv4df"
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)])))
8137 (parallel [(const_int 1) (const_int 5)
8138 (const_int 3) (const_int 7)])))
8139 (set (match_operand:V4DF 0 "register_operand")
8144 (parallel [(const_int 0) (const_int 1)
8145 (const_int 4) (const_int 5)])))]
8148 operands[3] = gen_reg_rtx (V4DFmode);
8149 operands[4] = gen_reg_rtx (V4DFmode);
8152 (define_insn "avx512vl_unpcklpd128_mask"
8153 [(set (match_operand:V2DF 0 "register_operand" "=v")
8157 (match_operand:V2DF 1 "register_operand" "v")
8158 (match_operand:V2DF 2 "nonimmediate_operand" "vm"))
8159 (parallel [(const_int 0) (const_int 2)]))
8160 (match_operand:V2DF 3 "vector_move_operand" "0C")
8161 (match_operand:QI 4 "register_operand" "Yk")))]
8163 "vunpcklpd\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
8164 [(set_attr "type" "sselog")
8165 (set_attr "prefix" "evex")
8166 (set_attr "mode" "V2DF")])
8168 (define_expand "vec_interleave_lowv2df"
8169 [(set (match_operand:V2DF 0 "register_operand")
8172 (match_operand:V2DF 1 "nonimmediate_operand")
8173 (match_operand:V2DF 2 "nonimmediate_operand"))
8174 (parallel [(const_int 0)
8178 if (!ix86_vec_interleave_v2df_operator_ok (operands, 0))
8179 operands[1] = force_reg (V2DFmode, operands[1]);
8182 (define_insn "*vec_interleave_lowv2df"
8183 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,v,v,x,v,o")
8186 (match_operand:V2DF 1 "nonimmediate_operand" " 0,v,m,0,v,0")
8187 (match_operand:V2DF 2 "nonimmediate_operand" " x,v,1,m,m,v"))
8188 (parallel [(const_int 0)
8190 "TARGET_SSE2 && ix86_vec_interleave_v2df_operator_ok (operands, 0)"
8192 unpcklpd\t{%2, %0|%0, %2}
8193 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
8194 %vmovddup\t{%1, %0|%0, %q1}
8195 movhpd\t{%2, %0|%0, %q2}
8196 vmovhpd\t{%2, %1, %0|%0, %1, %q2}
8197 %vmovlpd\t{%2, %H0|%H0, %2}"
8198 [(set_attr "isa" "noavx,avx,sse3,noavx,avx,*")
8199 (set_attr "type" "sselog,sselog,sselog,ssemov,ssemov,ssemov")
8200 (set (attr "prefix_data16")
8201 (if_then_else (eq_attr "alternative" "3,5")
8203 (const_string "*")))
8204 (set_attr "prefix" "orig,maybe_evex,maybe_vex,orig,maybe_evex,maybe_vex")
8205 (set_attr "mode" "V2DF,V2DF,DF,V1DF,V1DF,V1DF")])
8208 [(set (match_operand:V2DF 0 "memory_operand")
8211 (match_operand:V2DF 1 "register_operand")
8213 (parallel [(const_int 0)
8215 "TARGET_SSE3 && reload_completed"
8218 rtx low = gen_lowpart (DFmode, operands[1]);
8220 emit_move_insn (adjust_address (operands[0], DFmode, 0), low);
8221 emit_move_insn (adjust_address (operands[0], DFmode, 8), low);
8226 [(set (match_operand:V2DF 0 "register_operand")
8229 (match_operand:V2DF 1 "memory_operand")
8231 (parallel [(match_operand:SI 2 "const_0_to_1_operand")
8232 (match_operand:SI 3 "const_int_operand")])))]
8233 "TARGET_SSE3 && INTVAL (operands[2]) + 2 == INTVAL (operands[3])"
8234 [(set (match_dup 0) (vec_duplicate:V2DF (match_dup 1)))]
8236 operands[1] = adjust_address (operands[1], DFmode, INTVAL (operands[2]) * 8);
8239 (define_insn "avx512f_vmscalef<mode><round_name>"
8240 [(set (match_operand:VF_128 0 "register_operand" "=v")
8243 [(match_operand:VF_128 1 "register_operand" "v")
8244 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>")]
8249 "vscalef<ssescalarmodesuffix>\t{<round_op3>%2, %1, %0|%0, %1, %2<round_op3>}"
8250 [(set_attr "prefix" "evex")
8251 (set_attr "mode" "<ssescalarmode>")])
8253 (define_insn "<avx512>_scalef<mode><mask_name><round_name>"
8254 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8256 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
8257 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")]
8260 "vscalef<ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
8261 [(set_attr "prefix" "evex")
8262 (set_attr "mode" "<MODE>")])
8264 (define_expand "<avx512>_vternlog<mode>_maskz"
8265 [(match_operand:VI48_AVX512VL 0 "register_operand")
8266 (match_operand:VI48_AVX512VL 1 "register_operand")
8267 (match_operand:VI48_AVX512VL 2 "register_operand")
8268 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand")
8269 (match_operand:SI 4 "const_0_to_255_operand")
8270 (match_operand:<avx512fmaskmode> 5 "register_operand")]
8273 emit_insn (gen_<avx512>_vternlog<mode>_maskz_1 (
8274 operands[0], operands[1], operands[2], operands[3],
8275 operands[4], CONST0_RTX (<MODE>mode), operands[5]));
8279 (define_insn "<avx512>_vternlog<mode><sd_maskz_name>"
8280 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
8281 (unspec:VI48_AVX512VL
8282 [(match_operand:VI48_AVX512VL 1 "register_operand" "0")
8283 (match_operand:VI48_AVX512VL 2 "register_operand" "v")
8284 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand" "vm")
8285 (match_operand:SI 4 "const_0_to_255_operand")]
8288 "vpternlog<ssemodesuffix>\t{%4, %3, %2, %0<sd_mask_op5>|%0<sd_mask_op5>, %2, %3, %4}"
8289 [(set_attr "type" "sselog")
8290 (set_attr "prefix" "evex")
8291 (set_attr "mode" "<sseinsnmode>")])
8293 (define_insn "<avx512>_vternlog<mode>_mask"
8294 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
8295 (vec_merge:VI48_AVX512VL
8296 (unspec:VI48_AVX512VL
8297 [(match_operand:VI48_AVX512VL 1 "register_operand" "0")
8298 (match_operand:VI48_AVX512VL 2 "register_operand" "v")
8299 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand" "vm")
8300 (match_operand:SI 4 "const_0_to_255_operand")]
8303 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
8305 "vpternlog<ssemodesuffix>\t{%4, %3, %2, %0%{%5%}|%0%{%5%}, %2, %3, %4}"
8306 [(set_attr "type" "sselog")
8307 (set_attr "prefix" "evex")
8308 (set_attr "mode" "<sseinsnmode>")])
8310 (define_insn "<avx512>_getexp<mode><mask_name><round_saeonly_name>"
8311 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8312 (unspec:VF_AVX512VL [(match_operand:VF_AVX512VL 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
8315 "vgetexp<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}";
8316 [(set_attr "prefix" "evex")
8317 (set_attr "mode" "<MODE>")])
8319 (define_insn "avx512f_sgetexp<mode><mask_scalar_name><round_saeonly_scalar_name>"
8320 [(set (match_operand:VF_128 0 "register_operand" "=v")
8323 [(match_operand:VF_128 1 "register_operand" "v")
8324 (match_operand:VF_128 2 "<round_saeonly_scalar_nimm_predicate>" "<round_saeonly_scalar_constraint>")]
8329 "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>}";
8330 [(set_attr "prefix" "evex")
8331 (set_attr "mode" "<ssescalarmode>")])
8333 (define_insn "<mask_codefor><avx512>_align<mode><mask_name>"
8334 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
8335 (unspec:VI48_AVX512VL [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
8336 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")
8337 (match_operand:SI 3 "const_0_to_255_operand")]
8340 "valign<ssemodesuffix>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3}";
8341 [(set_attr "prefix" "evex")
8342 (set_attr "mode" "<sseinsnmode>")])
8344 (define_expand "avx512f_shufps512_mask"
8345 [(match_operand:V16SF 0 "register_operand")
8346 (match_operand:V16SF 1 "register_operand")
8347 (match_operand:V16SF 2 "nonimmediate_operand")
8348 (match_operand:SI 3 "const_0_to_255_operand")
8349 (match_operand:V16SF 4 "register_operand")
8350 (match_operand:HI 5 "register_operand")]
8353 int mask = INTVAL (operands[3]);
8354 emit_insn (gen_avx512f_shufps512_1_mask (operands[0], operands[1], operands[2],
8355 GEN_INT ((mask >> 0) & 3),
8356 GEN_INT ((mask >> 2) & 3),
8357 GEN_INT (((mask >> 4) & 3) + 16),
8358 GEN_INT (((mask >> 6) & 3) + 16),
8359 GEN_INT (((mask >> 0) & 3) + 4),
8360 GEN_INT (((mask >> 2) & 3) + 4),
8361 GEN_INT (((mask >> 4) & 3) + 20),
8362 GEN_INT (((mask >> 6) & 3) + 20),
8363 GEN_INT (((mask >> 0) & 3) + 8),
8364 GEN_INT (((mask >> 2) & 3) + 8),
8365 GEN_INT (((mask >> 4) & 3) + 24),
8366 GEN_INT (((mask >> 6) & 3) + 24),
8367 GEN_INT (((mask >> 0) & 3) + 12),
8368 GEN_INT (((mask >> 2) & 3) + 12),
8369 GEN_INT (((mask >> 4) & 3) + 28),
8370 GEN_INT (((mask >> 6) & 3) + 28),
8371 operands[4], operands[5]));
8376 (define_expand "<avx512>_fixupimm<mode>_maskz<round_saeonly_expand_name>"
8377 [(match_operand:VF_AVX512VL 0 "register_operand")
8378 (match_operand:VF_AVX512VL 1 "register_operand")
8379 (match_operand:VF_AVX512VL 2 "register_operand")
8380 (match_operand:<sseintvecmode> 3 "<round_saeonly_expand_nimm_predicate>")
8381 (match_operand:SI 4 "const_0_to_255_operand")
8382 (match_operand:<avx512fmaskmode> 5 "register_operand")]
8385 emit_insn (gen_<avx512>_fixupimm<mode>_maskz_1<round_saeonly_expand_name> (
8386 operands[0], operands[1], operands[2], operands[3],
8387 operands[4], CONST0_RTX (<MODE>mode), operands[5]
8388 <round_saeonly_expand_operand6>));
8392 (define_insn "<avx512>_fixupimm<mode><sd_maskz_name><round_saeonly_name>"
8393 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8395 [(match_operand:VF_AVX512VL 1 "register_operand" "0")
8396 (match_operand:VF_AVX512VL 2 "register_operand" "v")
8397 (match_operand:<sseintvecmode> 3 "nonimmediate_operand" "<round_saeonly_constraint>")
8398 (match_operand:SI 4 "const_0_to_255_operand")]
8401 "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}";
8402 [(set_attr "prefix" "evex")
8403 (set_attr "mode" "<MODE>")])
8405 (define_insn "<avx512>_fixupimm<mode>_mask<round_saeonly_name>"
8406 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8407 (vec_merge:VF_AVX512VL
8409 [(match_operand:VF_AVX512VL 1 "register_operand" "0")
8410 (match_operand:VF_AVX512VL 2 "register_operand" "v")
8411 (match_operand:<sseintvecmode> 3 "nonimmediate_operand" "<round_saeonly_constraint>")
8412 (match_operand:SI 4 "const_0_to_255_operand")]
8415 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
8417 "vfixupimm<ssemodesuffix>\t{%4, <round_saeonly_op6>%3, %2, %0%{%5%}|%0%{%5%}, %2, %3<round_saeonly_op6>, %4}";
8418 [(set_attr "prefix" "evex")
8419 (set_attr "mode" "<MODE>")])
8421 (define_expand "avx512f_sfixupimm<mode>_maskz<round_saeonly_expand_name>"
8422 [(match_operand:VF_128 0 "register_operand")
8423 (match_operand:VF_128 1 "register_operand")
8424 (match_operand:VF_128 2 "register_operand")
8425 (match_operand:<sseintvecmode> 3 "<round_saeonly_expand_nimm_predicate>")
8426 (match_operand:SI 4 "const_0_to_255_operand")
8427 (match_operand:<avx512fmaskmode> 5 "register_operand")]
8430 emit_insn (gen_avx512f_sfixupimm<mode>_maskz_1<round_saeonly_expand_name> (
8431 operands[0], operands[1], operands[2], operands[3],
8432 operands[4], CONST0_RTX (<MODE>mode), operands[5]
8433 <round_saeonly_expand_operand6>));
8437 (define_insn "avx512f_sfixupimm<mode><sd_maskz_name><round_saeonly_name>"
8438 [(set (match_operand:VF_128 0 "register_operand" "=v")
8441 [(match_operand:VF_128 1 "register_operand" "0")
8442 (match_operand:VF_128 2 "register_operand" "v")
8443 (match_operand:<sseintvecmode> 3 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
8444 (match_operand:SI 4 "const_0_to_255_operand")]
8449 "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}";
8450 [(set_attr "prefix" "evex")
8451 (set_attr "mode" "<ssescalarmode>")])
8453 (define_insn "avx512f_sfixupimm<mode>_mask<round_saeonly_name>"
8454 [(set (match_operand:VF_128 0 "register_operand" "=v")
8458 [(match_operand:VF_128 1 "register_operand" "0")
8459 (match_operand:VF_128 2 "register_operand" "v")
8460 (match_operand:<sseintvecmode> 3 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
8461 (match_operand:SI 4 "const_0_to_255_operand")]
8466 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
8468 "vfixupimm<ssescalarmodesuffix>\t{%4, <round_saeonly_op6>%3, %2, %0%{%5%}|%0%{%5%}, %2, %3<round_saeonly_op6>, %4}";
8469 [(set_attr "prefix" "evex")
8470 (set_attr "mode" "<ssescalarmode>")])
8472 (define_insn "<avx512>_rndscale<mode><mask_name><round_saeonly_name>"
8473 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8475 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "<round_saeonly_constraint>")
8476 (match_operand:SI 2 "const_0_to_255_operand")]
8479 "vrndscale<ssemodesuffix>\t{%2, <round_saeonly_mask_op3>%1, %0<mask_operand3>|%0<mask_operand3>, %1<round_saeonly_mask_op3>, %2}"
8480 [(set_attr "length_immediate" "1")
8481 (set_attr "prefix" "evex")
8482 (set_attr "mode" "<MODE>")])
8484 (define_insn "avx512f_rndscale<mode><round_saeonly_name>"
8485 [(set (match_operand:VF_128 0 "register_operand" "=v")
8488 [(match_operand:VF_128 1 "register_operand" "v")
8489 (match_operand:VF_128 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
8490 (match_operand:SI 3 "const_0_to_255_operand")]
8495 "vrndscale<ssescalarmodesuffix>\t{%3, <round_saeonly_op4>%2, %1, %0|%0, %1, %2<round_saeonly_op4>, %3}"
8496 [(set_attr "length_immediate" "1")
8497 (set_attr "prefix" "evex")
8498 (set_attr "mode" "<MODE>")])
8500 ;; One bit in mask selects 2 elements.
8501 (define_insn "avx512f_shufps512_1<mask_name>"
8502 [(set (match_operand:V16SF 0 "register_operand" "=v")
8505 (match_operand:V16SF 1 "register_operand" "v")
8506 (match_operand:V16SF 2 "nonimmediate_operand" "vm"))
8507 (parallel [(match_operand 3 "const_0_to_3_operand")
8508 (match_operand 4 "const_0_to_3_operand")
8509 (match_operand 5 "const_16_to_19_operand")
8510 (match_operand 6 "const_16_to_19_operand")
8511 (match_operand 7 "const_4_to_7_operand")
8512 (match_operand 8 "const_4_to_7_operand")
8513 (match_operand 9 "const_20_to_23_operand")
8514 (match_operand 10 "const_20_to_23_operand")
8515 (match_operand 11 "const_8_to_11_operand")
8516 (match_operand 12 "const_8_to_11_operand")
8517 (match_operand 13 "const_24_to_27_operand")
8518 (match_operand 14 "const_24_to_27_operand")
8519 (match_operand 15 "const_12_to_15_operand")
8520 (match_operand 16 "const_12_to_15_operand")
8521 (match_operand 17 "const_28_to_31_operand")
8522 (match_operand 18 "const_28_to_31_operand")])))]
8524 && (INTVAL (operands[3]) == (INTVAL (operands[7]) - 4)
8525 && INTVAL (operands[4]) == (INTVAL (operands[8]) - 4)
8526 && INTVAL (operands[5]) == (INTVAL (operands[9]) - 4)
8527 && INTVAL (operands[6]) == (INTVAL (operands[10]) - 4)
8528 && INTVAL (operands[3]) == (INTVAL (operands[11]) - 8)
8529 && INTVAL (operands[4]) == (INTVAL (operands[12]) - 8)
8530 && INTVAL (operands[5]) == (INTVAL (operands[13]) - 8)
8531 && INTVAL (operands[6]) == (INTVAL (operands[14]) - 8)
8532 && INTVAL (operands[3]) == (INTVAL (operands[15]) - 12)
8533 && INTVAL (operands[4]) == (INTVAL (operands[16]) - 12)
8534 && INTVAL (operands[5]) == (INTVAL (operands[17]) - 12)
8535 && INTVAL (operands[6]) == (INTVAL (operands[18]) - 12))"
8538 mask = INTVAL (operands[3]);
8539 mask |= INTVAL (operands[4]) << 2;
8540 mask |= (INTVAL (operands[5]) - 16) << 4;
8541 mask |= (INTVAL (operands[6]) - 16) << 6;
8542 operands[3] = GEN_INT (mask);
8544 return "vshufps\t{%3, %2, %1, %0<mask_operand19>|%0<mask_operand19>, %1, %2, %3}";
8546 [(set_attr "type" "sselog")
8547 (set_attr "length_immediate" "1")
8548 (set_attr "prefix" "evex")
8549 (set_attr "mode" "V16SF")])
8551 (define_expand "avx512f_shufpd512_mask"
8552 [(match_operand:V8DF 0 "register_operand")
8553 (match_operand:V8DF 1 "register_operand")
8554 (match_operand:V8DF 2 "nonimmediate_operand")
8555 (match_operand:SI 3 "const_0_to_255_operand")
8556 (match_operand:V8DF 4 "register_operand")
8557 (match_operand:QI 5 "register_operand")]
8560 int mask = INTVAL (operands[3]);
8561 emit_insn (gen_avx512f_shufpd512_1_mask (operands[0], operands[1], operands[2],
8563 GEN_INT (mask & 2 ? 9 : 8),
8564 GEN_INT (mask & 4 ? 3 : 2),
8565 GEN_INT (mask & 8 ? 11 : 10),
8566 GEN_INT (mask & 16 ? 5 : 4),
8567 GEN_INT (mask & 32 ? 13 : 12),
8568 GEN_INT (mask & 64 ? 7 : 6),
8569 GEN_INT (mask & 128 ? 15 : 14),
8570 operands[4], operands[5]));
8574 (define_insn "avx512f_shufpd512_1<mask_name>"
8575 [(set (match_operand:V8DF 0 "register_operand" "=v")
8578 (match_operand:V8DF 1 "register_operand" "v")
8579 (match_operand:V8DF 2 "nonimmediate_operand" "vm"))
8580 (parallel [(match_operand 3 "const_0_to_1_operand")
8581 (match_operand 4 "const_8_to_9_operand")
8582 (match_operand 5 "const_2_to_3_operand")
8583 (match_operand 6 "const_10_to_11_operand")
8584 (match_operand 7 "const_4_to_5_operand")
8585 (match_operand 8 "const_12_to_13_operand")
8586 (match_operand 9 "const_6_to_7_operand")
8587 (match_operand 10 "const_14_to_15_operand")])))]
8591 mask = INTVAL (operands[3]);
8592 mask |= (INTVAL (operands[4]) - 8) << 1;
8593 mask |= (INTVAL (operands[5]) - 2) << 2;
8594 mask |= (INTVAL (operands[6]) - 10) << 3;
8595 mask |= (INTVAL (operands[7]) - 4) << 4;
8596 mask |= (INTVAL (operands[8]) - 12) << 5;
8597 mask |= (INTVAL (operands[9]) - 6) << 6;
8598 mask |= (INTVAL (operands[10]) - 14) << 7;
8599 operands[3] = GEN_INT (mask);
8601 return "vshufpd\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
8603 [(set_attr "type" "sselog")
8604 (set_attr "length_immediate" "1")
8605 (set_attr "prefix" "evex")
8606 (set_attr "mode" "V8DF")])
8608 (define_expand "avx_shufpd256<mask_expand4_name>"
8609 [(match_operand:V4DF 0 "register_operand")
8610 (match_operand:V4DF 1 "register_operand")
8611 (match_operand:V4DF 2 "nonimmediate_operand")
8612 (match_operand:SI 3 "const_int_operand")]
8615 int mask = INTVAL (operands[3]);
8616 emit_insn (gen_avx_shufpd256_1<mask_expand4_name> (operands[0],
8620 GEN_INT (mask & 2 ? 5 : 4),
8621 GEN_INT (mask & 4 ? 3 : 2),
8622 GEN_INT (mask & 8 ? 7 : 6)
8623 <mask_expand4_args>));
8627 (define_insn "avx_shufpd256_1<mask_name>"
8628 [(set (match_operand:V4DF 0 "register_operand" "=v")
8631 (match_operand:V4DF 1 "register_operand" "v")
8632 (match_operand:V4DF 2 "nonimmediate_operand" "vm"))
8633 (parallel [(match_operand 3 "const_0_to_1_operand")
8634 (match_operand 4 "const_4_to_5_operand")
8635 (match_operand 5 "const_2_to_3_operand")
8636 (match_operand 6 "const_6_to_7_operand")])))]
8637 "TARGET_AVX && <mask_avx512vl_condition>"
8640 mask = INTVAL (operands[3]);
8641 mask |= (INTVAL (operands[4]) - 4) << 1;
8642 mask |= (INTVAL (operands[5]) - 2) << 2;
8643 mask |= (INTVAL (operands[6]) - 6) << 3;
8644 operands[3] = GEN_INT (mask);
8646 return "vshufpd\t{%3, %2, %1, %0<mask_operand7>|%0<mask_operand7>, %1, %2, %3}";
8648 [(set_attr "type" "sseshuf")
8649 (set_attr "length_immediate" "1")
8650 (set_attr "prefix" "vex")
8651 (set_attr "mode" "V4DF")])
8653 (define_expand "sse2_shufpd<mask_expand4_name>"
8654 [(match_operand:V2DF 0 "register_operand")
8655 (match_operand:V2DF 1 "register_operand")
8656 (match_operand:V2DF 2 "vector_operand")
8657 (match_operand:SI 3 "const_int_operand")]
8660 int mask = INTVAL (operands[3]);
8661 emit_insn (gen_sse2_shufpd_v2df<mask_expand4_name> (operands[0], operands[1],
8662 operands[2], GEN_INT (mask & 1),
8663 GEN_INT (mask & 2 ? 3 : 2)
8664 <mask_expand4_args>));
8668 (define_insn "sse2_shufpd_v2df_mask"
8669 [(set (match_operand:V2DF 0 "register_operand" "=v")
8673 (match_operand:V2DF 1 "register_operand" "v")
8674 (match_operand:V2DF 2 "nonimmediate_operand" "vm"))
8675 (parallel [(match_operand 3 "const_0_to_1_operand")
8676 (match_operand 4 "const_2_to_3_operand")]))
8677 (match_operand:V2DF 5 "vector_move_operand" "0C")
8678 (match_operand:QI 6 "register_operand" "Yk")))]
8682 mask = INTVAL (operands[3]);
8683 mask |= (INTVAL (operands[4]) - 2) << 1;
8684 operands[3] = GEN_INT (mask);
8686 return "vshufpd\t{%3, %2, %1, %0%{%6%}%N5|%0%{6%}%N5, %1, %2, %3}";
8688 [(set_attr "type" "sseshuf")
8689 (set_attr "length_immediate" "1")
8690 (set_attr "prefix" "evex")
8691 (set_attr "mode" "V2DF")])
8693 ;; punpcklqdq and punpckhqdq are shorter than shufpd.
8694 (define_insn "avx2_interleave_highv4di<mask_name>"
8695 [(set (match_operand:V4DI 0 "register_operand" "=v")
8698 (match_operand:V4DI 1 "register_operand" "v")
8699 (match_operand:V4DI 2 "nonimmediate_operand" "vm"))
8700 (parallel [(const_int 1)
8704 "TARGET_AVX2 && <mask_avx512vl_condition>"
8705 "vpunpckhqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8706 [(set_attr "type" "sselog")
8707 (set_attr "prefix" "vex")
8708 (set_attr "mode" "OI")])
8710 (define_insn "<mask_codefor>avx512f_interleave_highv8di<mask_name>"
8711 [(set (match_operand:V8DI 0 "register_operand" "=v")
8714 (match_operand:V8DI 1 "register_operand" "v")
8715 (match_operand:V8DI 2 "nonimmediate_operand" "vm"))
8716 (parallel [(const_int 1) (const_int 9)
8717 (const_int 3) (const_int 11)
8718 (const_int 5) (const_int 13)
8719 (const_int 7) (const_int 15)])))]
8721 "vpunpckhqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8722 [(set_attr "type" "sselog")
8723 (set_attr "prefix" "evex")
8724 (set_attr "mode" "XI")])
8726 (define_insn "vec_interleave_highv2di<mask_name>"
8727 [(set (match_operand:V2DI 0 "register_operand" "=x,v")
8730 (match_operand:V2DI 1 "register_operand" "0,v")
8731 (match_operand:V2DI 2 "vector_operand" "xBm,vm"))
8732 (parallel [(const_int 1)
8734 "TARGET_SSE2 && <mask_avx512vl_condition>"
8736 punpckhqdq\t{%2, %0|%0, %2}
8737 vpunpckhqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8738 [(set_attr "isa" "noavx,avx")
8739 (set_attr "type" "sselog")
8740 (set_attr "prefix_data16" "1,*")
8741 (set_attr "prefix" "orig,<mask_prefix>")
8742 (set_attr "mode" "TI")])
8744 (define_insn "avx2_interleave_lowv4di<mask_name>"
8745 [(set (match_operand:V4DI 0 "register_operand" "=v")
8748 (match_operand:V4DI 1 "register_operand" "v")
8749 (match_operand:V4DI 2 "nonimmediate_operand" "vm"))
8750 (parallel [(const_int 0)
8754 "TARGET_AVX2 && <mask_avx512vl_condition>"
8755 "vpunpcklqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8756 [(set_attr "type" "sselog")
8757 (set_attr "prefix" "vex")
8758 (set_attr "mode" "OI")])
8760 (define_insn "<mask_codefor>avx512f_interleave_lowv8di<mask_name>"
8761 [(set (match_operand:V8DI 0 "register_operand" "=v")
8764 (match_operand:V8DI 1 "register_operand" "v")
8765 (match_operand:V8DI 2 "nonimmediate_operand" "vm"))
8766 (parallel [(const_int 0) (const_int 8)
8767 (const_int 2) (const_int 10)
8768 (const_int 4) (const_int 12)
8769 (const_int 6) (const_int 14)])))]
8771 "vpunpcklqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8772 [(set_attr "type" "sselog")
8773 (set_attr "prefix" "evex")
8774 (set_attr "mode" "XI")])
8776 (define_insn "vec_interleave_lowv2di<mask_name>"
8777 [(set (match_operand:V2DI 0 "register_operand" "=x,v")
8780 (match_operand:V2DI 1 "register_operand" "0,v")
8781 (match_operand:V2DI 2 "vector_operand" "xBm,vm"))
8782 (parallel [(const_int 0)
8784 "TARGET_SSE2 && <mask_avx512vl_condition>"
8786 punpcklqdq\t{%2, %0|%0, %2}
8787 vpunpcklqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8788 [(set_attr "isa" "noavx,avx")
8789 (set_attr "type" "sselog")
8790 (set_attr "prefix_data16" "1,*")
8791 (set_attr "prefix" "orig,vex")
8792 (set_attr "mode" "TI")])
8794 (define_insn "sse2_shufpd_<mode>"
8795 [(set (match_operand:VI8F_128 0 "register_operand" "=x,v")
8796 (vec_select:VI8F_128
8797 (vec_concat:<ssedoublevecmode>
8798 (match_operand:VI8F_128 1 "register_operand" "0,v")
8799 (match_operand:VI8F_128 2 "vector_operand" "xBm,vm"))
8800 (parallel [(match_operand 3 "const_0_to_1_operand")
8801 (match_operand 4 "const_2_to_3_operand")])))]
8805 mask = INTVAL (operands[3]);
8806 mask |= (INTVAL (operands[4]) - 2) << 1;
8807 operands[3] = GEN_INT (mask);
8809 switch (which_alternative)
8812 return "shufpd\t{%3, %2, %0|%0, %2, %3}";
8814 return "vshufpd\t{%3, %2, %1, %0|%0, %1, %2, %3}";
8819 [(set_attr "isa" "noavx,avx")
8820 (set_attr "type" "sseshuf")
8821 (set_attr "length_immediate" "1")
8822 (set_attr "prefix" "orig,maybe_evex")
8823 (set_attr "mode" "V2DF")])
8825 ;; Avoid combining registers from different units in a single alternative,
8826 ;; see comment above inline_secondary_memory_needed function in i386.c
8827 (define_insn "sse2_storehpd"
8828 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,Yv,x,*f,r")
8830 (match_operand:V2DF 1 "nonimmediate_operand" " v,0, v,o,o,o")
8831 (parallel [(const_int 1)])))]
8832 "TARGET_SSE2 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
8834 %vmovhpd\t{%1, %0|%0, %1}
8836 vunpckhpd\t{%d1, %0|%0, %d1}
8840 [(set_attr "isa" "*,noavx,avx,*,*,*")
8841 (set_attr "type" "ssemov,sselog1,sselog1,ssemov,fmov,imov")
8842 (set (attr "prefix_data16")
8844 (and (eq_attr "alternative" "0")
8845 (not (match_test "TARGET_AVX")))
8847 (const_string "*")))
8848 (set_attr "prefix" "maybe_vex,orig,maybe_evex,*,*,*")
8849 (set_attr "mode" "V1DF,V1DF,V2DF,DF,DF,DF")])
8852 [(set (match_operand:DF 0 "register_operand")
8854 (match_operand:V2DF 1 "memory_operand")
8855 (parallel [(const_int 1)])))]
8856 "TARGET_SSE2 && reload_completed"
8857 [(set (match_dup 0) (match_dup 1))]
8858 "operands[1] = adjust_address (operands[1], DFmode, 8);")
8860 (define_insn "*vec_extractv2df_1_sse"
8861 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,x")
8863 (match_operand:V2DF 1 "nonimmediate_operand" "x,x,o")
8864 (parallel [(const_int 1)])))]
8865 "!TARGET_SSE2 && TARGET_SSE
8866 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
8868 movhps\t{%1, %0|%q0, %1}
8869 movhlps\t{%1, %0|%0, %1}
8870 movlps\t{%H1, %0|%0, %H1}"
8871 [(set_attr "type" "ssemov")
8872 (set_attr "mode" "V2SF,V4SF,V2SF")])
8874 ;; Avoid combining registers from different units in a single alternative,
8875 ;; see comment above inline_secondary_memory_needed function in i386.c
8876 (define_insn "sse2_storelpd"
8877 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,x,*f,r")
8879 (match_operand:V2DF 1 "nonimmediate_operand" " v,x,m,m,m")
8880 (parallel [(const_int 0)])))]
8881 "TARGET_SSE2 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
8883 %vmovlpd\t{%1, %0|%0, %1}
8888 [(set_attr "type" "ssemov,ssemov,ssemov,fmov,imov")
8889 (set (attr "prefix_data16")
8890 (if_then_else (eq_attr "alternative" "0")
8892 (const_string "*")))
8893 (set_attr "prefix" "maybe_vex")
8894 (set_attr "mode" "V1DF,DF,DF,DF,DF")])
8897 [(set (match_operand:DF 0 "register_operand")
8899 (match_operand:V2DF 1 "nonimmediate_operand")
8900 (parallel [(const_int 0)])))]
8901 "TARGET_SSE2 && reload_completed"
8902 [(set (match_dup 0) (match_dup 1))]
8903 "operands[1] = gen_lowpart (DFmode, operands[1]);")
8905 (define_insn "*vec_extractv2df_0_sse"
8906 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,x")
8908 (match_operand:V2DF 1 "nonimmediate_operand" "x,x,m")
8909 (parallel [(const_int 0)])))]
8910 "!TARGET_SSE2 && TARGET_SSE
8911 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
8913 movlps\t{%1, %0|%0, %1}
8914 movaps\t{%1, %0|%0, %1}
8915 movlps\t{%1, %0|%0, %q1}"
8916 [(set_attr "type" "ssemov")
8917 (set_attr "mode" "V2SF,V4SF,V2SF")])
8919 (define_expand "sse2_loadhpd_exp"
8920 [(set (match_operand:V2DF 0 "nonimmediate_operand")
8923 (match_operand:V2DF 1 "nonimmediate_operand")
8924 (parallel [(const_int 0)]))
8925 (match_operand:DF 2 "nonimmediate_operand")))]
8928 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V2DFmode, operands);
8930 emit_insn (gen_sse2_loadhpd (dst, operands[1], operands[2]));
8932 /* Fix up the destination if needed. */
8933 if (dst != operands[0])
8934 emit_move_insn (operands[0], dst);
8939 ;; Avoid combining registers from different units in a single alternative,
8940 ;; see comment above inline_secondary_memory_needed function in i386.c
8941 (define_insn "sse2_loadhpd"
8942 [(set (match_operand:V2DF 0 "nonimmediate_operand"
8946 (match_operand:V2DF 1 "nonimmediate_operand"
8948 (parallel [(const_int 0)]))
8949 (match_operand:DF 2 "nonimmediate_operand"
8950 " m,m,x,v,x,*f,r")))]
8951 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
8953 movhpd\t{%2, %0|%0, %2}
8954 vmovhpd\t{%2, %1, %0|%0, %1, %2}
8955 unpcklpd\t{%2, %0|%0, %2}
8956 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
8960 [(set_attr "isa" "noavx,avx,noavx,avx,*,*,*")
8961 (set_attr "type" "ssemov,ssemov,sselog,sselog,ssemov,fmov,imov")
8962 (set (attr "prefix_data16")
8963 (if_then_else (eq_attr "alternative" "0")
8965 (const_string "*")))
8966 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,*,*,*")
8967 (set_attr "mode" "V1DF,V1DF,V2DF,V2DF,DF,DF,DF")])
8970 [(set (match_operand:V2DF 0 "memory_operand")
8972 (vec_select:DF (match_dup 0) (parallel [(const_int 0)]))
8973 (match_operand:DF 1 "register_operand")))]
8974 "TARGET_SSE2 && reload_completed"
8975 [(set (match_dup 0) (match_dup 1))]
8976 "operands[0] = adjust_address (operands[0], DFmode, 8);")
8978 (define_expand "sse2_loadlpd_exp"
8979 [(set (match_operand:V2DF 0 "nonimmediate_operand")
8981 (match_operand:DF 2 "nonimmediate_operand")
8983 (match_operand:V2DF 1 "nonimmediate_operand")
8984 (parallel [(const_int 1)]))))]
8987 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V2DFmode, operands);
8989 emit_insn (gen_sse2_loadlpd (dst, operands[1], operands[2]));
8991 /* Fix up the destination if needed. */
8992 if (dst != operands[0])
8993 emit_move_insn (operands[0], dst);
8998 ;; Avoid combining registers from different units in a single alternative,
8999 ;; see comment above inline_secondary_memory_needed function in i386.c
9000 (define_insn "sse2_loadlpd"
9001 [(set (match_operand:V2DF 0 "nonimmediate_operand"
9002 "=v,x,v,x,v,x,x,v,m,m ,m")
9004 (match_operand:DF 2 "nonimmediate_operand"
9005 "vm,m,m,x,v,0,0,v,x,*f,r")
9007 (match_operand:V2DF 1 "vector_move_operand"
9008 " C,0,v,0,v,x,o,o,0,0 ,0")
9009 (parallel [(const_int 1)]))))]
9010 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
9012 %vmovq\t{%2, %0|%0, %2}
9013 movlpd\t{%2, %0|%0, %2}
9014 vmovlpd\t{%2, %1, %0|%0, %1, %2}
9015 movsd\t{%2, %0|%0, %2}
9016 vmovsd\t{%2, %1, %0|%0, %1, %2}
9017 shufpd\t{$2, %1, %0|%0, %1, 2}
9018 movhpd\t{%H1, %0|%0, %H1}
9019 vmovhpd\t{%H1, %2, %0|%0, %2, %H1}
9023 [(set_attr "isa" "*,noavx,avx,noavx,avx,noavx,noavx,avx,*,*,*")
9025 (cond [(eq_attr "alternative" "5")
9026 (const_string "sselog")
9027 (eq_attr "alternative" "9")
9028 (const_string "fmov")
9029 (eq_attr "alternative" "10")
9030 (const_string "imov")
9032 (const_string "ssemov")))
9033 (set (attr "prefix_data16")
9034 (if_then_else (eq_attr "alternative" "1,6")
9036 (const_string "*")))
9037 (set (attr "length_immediate")
9038 (if_then_else (eq_attr "alternative" "5")
9040 (const_string "*")))
9041 (set (attr "prefix")
9042 (cond [(eq_attr "alternative" "0")
9043 (const_string "maybe_vex")
9044 (eq_attr "alternative" "1,3,5,6")
9045 (const_string "orig")
9046 (eq_attr "alternative" "2,4,7")
9047 (const_string "maybe_evex")
9049 (const_string "*")))
9050 (set_attr "mode" "DF,V1DF,V1DF,V1DF,V1DF,V2DF,V1DF,V1DF,DF,DF,DF")])
9053 [(set (match_operand:V2DF 0 "memory_operand")
9055 (match_operand:DF 1 "register_operand")
9056 (vec_select:DF (match_dup 0) (parallel [(const_int 1)]))))]
9057 "TARGET_SSE2 && reload_completed"
9058 [(set (match_dup 0) (match_dup 1))]
9059 "operands[0] = adjust_address (operands[0], DFmode, 0);")
9061 (define_insn "sse2_movsd"
9062 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,v,x,v,m,x,x,v,o")
9064 (match_operand:V2DF 2 "nonimmediate_operand" " x,v,m,m,v,0,0,v,0")
9065 (match_operand:V2DF 1 "nonimmediate_operand" " 0,v,0,v,0,x,o,o,v")
9069 movsd\t{%2, %0|%0, %2}
9070 vmovsd\t{%2, %1, %0|%0, %1, %2}
9071 movlpd\t{%2, %0|%0, %q2}
9072 vmovlpd\t{%2, %1, %0|%0, %1, %q2}
9073 %vmovlpd\t{%2, %0|%q0, %2}
9074 shufpd\t{$2, %1, %0|%0, %1, 2}
9075 movhps\t{%H1, %0|%0, %H1}
9076 vmovhps\t{%H1, %2, %0|%0, %2, %H1}
9077 %vmovhps\t{%1, %H0|%H0, %1}"
9078 [(set_attr "isa" "noavx,avx,noavx,avx,*,noavx,noavx,avx,*")
9081 (eq_attr "alternative" "5")
9082 (const_string "sselog")
9083 (const_string "ssemov")))
9084 (set (attr "prefix_data16")
9086 (and (eq_attr "alternative" "2,4")
9087 (not (match_test "TARGET_AVX")))
9089 (const_string "*")))
9090 (set (attr "length_immediate")
9091 (if_then_else (eq_attr "alternative" "5")
9093 (const_string "*")))
9094 (set (attr "prefix")
9095 (cond [(eq_attr "alternative" "1,3,7")
9096 (const_string "maybe_evex")
9097 (eq_attr "alternative" "4,8")
9098 (const_string "maybe_vex")
9100 (const_string "orig")))
9101 (set_attr "mode" "DF,DF,V1DF,V1DF,V1DF,V2DF,V1DF,V1DF,V1DF")])
9103 (define_insn "vec_dupv2df<mask_name>"
9104 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
9106 (match_operand:DF 1 "nonimmediate_operand" " 0,xm,vm")))]
9107 "TARGET_SSE2 && <mask_avx512vl_condition>"
9110 %vmovddup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}
9111 vmovddup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
9112 [(set_attr "isa" "noavx,sse3,avx512vl")
9113 (set_attr "type" "sselog1")
9114 (set_attr "prefix" "orig,maybe_vex,evex")
9115 (set_attr "mode" "V2DF,DF,DF")])
9117 (define_insn "vec_concatv2df"
9118 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v,x,v,x,x, v,x,x")
9120 (match_operand:DF 1 "nonimmediate_operand" " 0,x,v,m,m,0,x,xm,0,0")
9121 (match_operand:DF 2 "vector_move_operand" " x,x,v,1,1,m,m, C,x,m")))]
9123 && (!(MEM_P (operands[1]) && MEM_P (operands[2]))
9124 || (TARGET_SSE3 && rtx_equal_p (operands[1], operands[2])))"
9126 unpcklpd\t{%2, %0|%0, %2}
9127 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
9128 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
9129 %vmovddup\t{%1, %0|%0, %1}
9130 vmovddup\t{%1, %0|%0, %1}
9131 movhpd\t{%2, %0|%0, %2}
9132 vmovhpd\t{%2, %1, %0|%0, %1, %2}
9133 %vmovq\t{%1, %0|%0, %1}
9134 movlhps\t{%2, %0|%0, %2}
9135 movhps\t{%2, %0|%0, %2}"
9137 (cond [(eq_attr "alternative" "0,5")
9138 (const_string "sse2_noavx")
9139 (eq_attr "alternative" "1,6")
9140 (const_string "avx")
9141 (eq_attr "alternative" "2,4")
9142 (const_string "avx512vl")
9143 (eq_attr "alternative" "3")
9144 (const_string "sse3")
9145 (eq_attr "alternative" "7")
9146 (const_string "sse2")
9148 (const_string "noavx")))
9151 (eq_attr "alternative" "0,1,2,3,4")
9152 (const_string "sselog")
9153 (const_string "ssemov")))
9154 (set (attr "prefix_data16")
9155 (if_then_else (eq_attr "alternative" "5")
9157 (const_string "*")))
9158 (set (attr "prefix")
9159 (cond [(eq_attr "alternative" "1,6")
9160 (const_string "vex")
9161 (eq_attr "alternative" "2,4")
9162 (const_string "evex")
9163 (eq_attr "alternative" "3,7")
9164 (const_string "maybe_vex")
9166 (const_string "orig")))
9167 (set_attr "mode" "V2DF,V2DF,V2DF, DF, DF, V1DF,V1DF,DF,V4SF,V2SF")])
9169 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9171 ;; Parallel integer down-conversion operations
9173 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9175 (define_mode_iterator PMOV_DST_MODE_1 [V16QI V16HI V8SI V8HI])
9176 (define_mode_attr pmov_src_mode
9177 [(V16QI "V16SI") (V16HI "V16SI") (V8SI "V8DI") (V8HI "V8DI")])
9178 (define_mode_attr pmov_src_lower
9179 [(V16QI "v16si") (V16HI "v16si") (V8SI "v8di") (V8HI "v8di")])
9180 (define_mode_attr pmov_suff_1
9181 [(V16QI "db") (V16HI "dw") (V8SI "qd") (V8HI "qw")])
9183 (define_insn "*avx512f_<code><pmov_src_lower><mode>2"
9184 [(set (match_operand:PMOV_DST_MODE_1 0 "nonimmediate_operand" "=v,m")
9185 (any_truncate:PMOV_DST_MODE_1
9186 (match_operand:<pmov_src_mode> 1 "register_operand" "v,v")))]
9188 "vpmov<trunsuffix><pmov_suff_1>\t{%1, %0|%0, %1}"
9189 [(set_attr "type" "ssemov")
9190 (set_attr "memory" "none,store")
9191 (set_attr "prefix" "evex")
9192 (set_attr "mode" "<sseinsnmode>")])
9194 (define_insn "avx512f_<code><pmov_src_lower><mode>2_mask"
9195 [(set (match_operand:PMOV_DST_MODE_1 0 "nonimmediate_operand" "=v,m")
9196 (vec_merge:PMOV_DST_MODE_1
9197 (any_truncate:PMOV_DST_MODE_1
9198 (match_operand:<pmov_src_mode> 1 "register_operand" "v,v"))
9199 (match_operand:PMOV_DST_MODE_1 2 "vector_move_operand" "0C,0")
9200 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
9202 "vpmov<trunsuffix><pmov_suff_1>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9203 [(set_attr "type" "ssemov")
9204 (set_attr "memory" "none,store")
9205 (set_attr "prefix" "evex")
9206 (set_attr "mode" "<sseinsnmode>")])
9208 (define_expand "avx512f_<code><pmov_src_lower><mode>2_mask_store"
9209 [(set (match_operand:PMOV_DST_MODE_1 0 "memory_operand")
9210 (vec_merge:PMOV_DST_MODE_1
9211 (any_truncate:PMOV_DST_MODE_1
9212 (match_operand:<pmov_src_mode> 1 "register_operand"))
9214 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
9217 (define_insn "avx512bw_<code>v32hiv32qi2"
9218 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=v,m")
9220 (match_operand:V32HI 1 "register_operand" "v,v")))]
9222 "vpmov<trunsuffix>wb\t{%1, %0|%0, %1}"
9223 [(set_attr "type" "ssemov")
9224 (set_attr "memory" "none,store")
9225 (set_attr "prefix" "evex")
9226 (set_attr "mode" "XI")])
9228 (define_insn "avx512bw_<code>v32hiv32qi2_mask"
9229 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=v,m")
9232 (match_operand:V32HI 1 "register_operand" "v,v"))
9233 (match_operand:V32QI 2 "vector_move_operand" "0C,0")
9234 (match_operand:SI 3 "register_operand" "Yk,Yk")))]
9236 "vpmov<trunsuffix>wb\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9237 [(set_attr "type" "ssemov")
9238 (set_attr "memory" "none,store")
9239 (set_attr "prefix" "evex")
9240 (set_attr "mode" "XI")])
9242 (define_expand "avx512bw_<code>v32hiv32qi2_mask_store"
9243 [(set (match_operand:V32QI 0 "nonimmediate_operand")
9246 (match_operand:V32HI 1 "register_operand"))
9248 (match_operand:SI 2 "register_operand")))]
9251 (define_mode_iterator PMOV_DST_MODE_2
9252 [V4SI V8HI (V16QI "TARGET_AVX512BW")])
9253 (define_mode_attr pmov_suff_2
9254 [(V16QI "wb") (V8HI "dw") (V4SI "qd")])
9256 (define_insn "*avx512vl_<code><ssedoublemodelower><mode>2"
9257 [(set (match_operand:PMOV_DST_MODE_2 0 "nonimmediate_operand" "=v,m")
9258 (any_truncate:PMOV_DST_MODE_2
9259 (match_operand:<ssedoublemode> 1 "register_operand" "v,v")))]
9261 "vpmov<trunsuffix><pmov_suff_2>\t{%1, %0|%0, %1}"
9262 [(set_attr "type" "ssemov")
9263 (set_attr "memory" "none,store")
9264 (set_attr "prefix" "evex")
9265 (set_attr "mode" "<sseinsnmode>")])
9267 (define_insn "<avx512>_<code><ssedoublemodelower><mode>2_mask"
9268 [(set (match_operand:PMOV_DST_MODE_2 0 "nonimmediate_operand" "=v,m")
9269 (vec_merge:PMOV_DST_MODE_2
9270 (any_truncate:PMOV_DST_MODE_2
9271 (match_operand:<ssedoublemode> 1 "register_operand" "v,v"))
9272 (match_operand:PMOV_DST_MODE_2 2 "vector_move_operand" "0C,0")
9273 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
9275 "vpmov<trunsuffix><pmov_suff_2>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9276 [(set_attr "type" "ssemov")
9277 (set_attr "memory" "none,store")
9278 (set_attr "prefix" "evex")
9279 (set_attr "mode" "<sseinsnmode>")])
9281 (define_expand "<avx512>_<code><ssedoublemodelower><mode>2_mask_store"
9282 [(set (match_operand:PMOV_DST_MODE_2 0 "nonimmediate_operand")
9283 (vec_merge:PMOV_DST_MODE_2
9284 (any_truncate:PMOV_DST_MODE_2
9285 (match_operand:<ssedoublemode> 1 "register_operand"))
9287 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
9290 (define_mode_iterator PMOV_SRC_MODE_3 [V4DI V2DI V8SI V4SI (V8HI "TARGET_AVX512BW")])
9291 (define_mode_attr pmov_dst_3
9292 [(V4DI "V4QI") (V2DI "V2QI") (V8SI "V8QI") (V4SI "V4QI") (V8HI "V8QI")])
9293 (define_mode_attr pmov_dst_zeroed_3
9294 [(V4DI "V12QI") (V2DI "V14QI") (V8SI "V8QI") (V4SI "V12QI") (V8HI "V8QI")])
9295 (define_mode_attr pmov_suff_3
9296 [(V4DI "qb") (V2DI "qb") (V8SI "db") (V4SI "db") (V8HI "wb")])
9298 (define_insn "*avx512vl_<code><mode>v<ssescalarnum>qi2"
9299 [(set (match_operand:V16QI 0 "register_operand" "=v")
9301 (any_truncate:<pmov_dst_3>
9302 (match_operand:PMOV_SRC_MODE_3 1 "register_operand" "v"))
9303 (match_operand:<pmov_dst_zeroed_3> 2 "const0_operand")))]
9305 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0|%0, %1}"
9306 [(set_attr "type" "ssemov")
9307 (set_attr "prefix" "evex")
9308 (set_attr "mode" "TI")])
9310 (define_insn "*avx512vl_<code>v2div2qi2_store"
9311 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9314 (match_operand:V2DI 1 "register_operand" "v"))
9317 (parallel [(const_int 2) (const_int 3)
9318 (const_int 4) (const_int 5)
9319 (const_int 6) (const_int 7)
9320 (const_int 8) (const_int 9)
9321 (const_int 10) (const_int 11)
9322 (const_int 12) (const_int 13)
9323 (const_int 14) (const_int 15)]))))]
9325 "vpmov<trunsuffix>qb\t{%1, %0|%0, %1}"
9326 [(set_attr "type" "ssemov")
9327 (set_attr "memory" "store")
9328 (set_attr "prefix" "evex")
9329 (set_attr "mode" "TI")])
9331 (define_insn "avx512vl_<code>v2div2qi2_mask"
9332 [(set (match_operand:V16QI 0 "register_operand" "=v")
9336 (match_operand:V2DI 1 "register_operand" "v"))
9338 (match_operand:V16QI 2 "vector_move_operand" "0C")
9339 (parallel [(const_int 0) (const_int 1)]))
9340 (match_operand:QI 3 "register_operand" "Yk"))
9341 (const_vector:V14QI [(const_int 0) (const_int 0)
9342 (const_int 0) (const_int 0)
9343 (const_int 0) (const_int 0)
9344 (const_int 0) (const_int 0)
9345 (const_int 0) (const_int 0)
9346 (const_int 0) (const_int 0)
9347 (const_int 0) (const_int 0)])))]
9349 "vpmov<trunsuffix>qb\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9350 [(set_attr "type" "ssemov")
9351 (set_attr "prefix" "evex")
9352 (set_attr "mode" "TI")])
9354 (define_insn "*avx512vl_<code>v2div2qi2_mask_1"
9355 [(set (match_operand:V16QI 0 "register_operand" "=v")
9359 (match_operand:V2DI 1 "register_operand" "v"))
9360 (const_vector:V2QI [(const_int 0) (const_int 0)])
9361 (match_operand:QI 2 "register_operand" "Yk"))
9362 (const_vector:V14QI [(const_int 0) (const_int 0)
9363 (const_int 0) (const_int 0)
9364 (const_int 0) (const_int 0)
9365 (const_int 0) (const_int 0)
9366 (const_int 0) (const_int 0)
9367 (const_int 0) (const_int 0)
9368 (const_int 0) (const_int 0)])))]
9370 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9371 [(set_attr "type" "ssemov")
9372 (set_attr "prefix" "evex")
9373 (set_attr "mode" "TI")])
9375 (define_insn "avx512vl_<code>v2div2qi2_mask_store"
9376 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9380 (match_operand:V2DI 1 "register_operand" "v"))
9383 (parallel [(const_int 0) (const_int 1)]))
9384 (match_operand:QI 2 "register_operand" "Yk"))
9387 (parallel [(const_int 2) (const_int 3)
9388 (const_int 4) (const_int 5)
9389 (const_int 6) (const_int 7)
9390 (const_int 8) (const_int 9)
9391 (const_int 10) (const_int 11)
9392 (const_int 12) (const_int 13)
9393 (const_int 14) (const_int 15)]))))]
9395 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}|%w0%{%2%}, %1}"
9396 [(set_attr "type" "ssemov")
9397 (set_attr "memory" "store")
9398 (set_attr "prefix" "evex")
9399 (set_attr "mode" "TI")])
9401 (define_insn "*avx512vl_<code><mode>v4qi2_store"
9402 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9405 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9408 (parallel [(const_int 4) (const_int 5)
9409 (const_int 6) (const_int 7)
9410 (const_int 8) (const_int 9)
9411 (const_int 10) (const_int 11)
9412 (const_int 12) (const_int 13)
9413 (const_int 14) (const_int 15)]))))]
9415 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0|%0, %1}"
9416 [(set_attr "type" "ssemov")
9417 (set_attr "memory" "store")
9418 (set_attr "prefix" "evex")
9419 (set_attr "mode" "TI")])
9421 (define_insn "avx512vl_<code><mode>v4qi2_mask"
9422 [(set (match_operand:V16QI 0 "register_operand" "=v")
9426 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9428 (match_operand:V16QI 2 "vector_move_operand" "0C")
9429 (parallel [(const_int 0) (const_int 1)
9430 (const_int 2) (const_int 3)]))
9431 (match_operand:QI 3 "register_operand" "Yk"))
9432 (const_vector:V12QI [(const_int 0) (const_int 0)
9433 (const_int 0) (const_int 0)
9434 (const_int 0) (const_int 0)
9435 (const_int 0) (const_int 0)
9436 (const_int 0) (const_int 0)
9437 (const_int 0) (const_int 0)])))]
9439 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9440 [(set_attr "type" "ssemov")
9441 (set_attr "prefix" "evex")
9442 (set_attr "mode" "TI")])
9444 (define_insn "*avx512vl_<code><mode>v4qi2_mask_1"
9445 [(set (match_operand:V16QI 0 "register_operand" "=v")
9449 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9450 (const_vector:V4QI [(const_int 0) (const_int 0)
9451 (const_int 0) (const_int 0)])
9452 (match_operand:QI 2 "register_operand" "Yk"))
9453 (const_vector:V12QI [(const_int 0) (const_int 0)
9454 (const_int 0) (const_int 0)
9455 (const_int 0) (const_int 0)
9456 (const_int 0) (const_int 0)
9457 (const_int 0) (const_int 0)
9458 (const_int 0) (const_int 0)])))]
9460 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9461 [(set_attr "type" "ssemov")
9462 (set_attr "prefix" "evex")
9463 (set_attr "mode" "TI")])
9465 (define_insn "avx512vl_<code><mode>v4qi2_mask_store"
9466 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9470 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9473 (parallel [(const_int 0) (const_int 1)
9474 (const_int 2) (const_int 3)]))
9475 (match_operand:QI 2 "register_operand" "Yk"))
9478 (parallel [(const_int 4) (const_int 5)
9479 (const_int 6) (const_int 7)
9480 (const_int 8) (const_int 9)
9481 (const_int 10) (const_int 11)
9482 (const_int 12) (const_int 13)
9483 (const_int 14) (const_int 15)]))))]
9486 if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 8)
9487 return "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}|%k0%{%2%}, %1}";
9488 return "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}|%0%{%2%}, %g1}";
9490 [(set_attr "type" "ssemov")
9491 (set_attr "memory" "store")
9492 (set_attr "prefix" "evex")
9493 (set_attr "mode" "TI")])
9495 (define_mode_iterator VI2_128_BW_4_256
9496 [(V8HI "TARGET_AVX512BW") V8SI])
9498 (define_insn "*avx512vl_<code><mode>v8qi2_store"
9499 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9502 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9505 (parallel [(const_int 8) (const_int 9)
9506 (const_int 10) (const_int 11)
9507 (const_int 12) (const_int 13)
9508 (const_int 14) (const_int 15)]))))]
9510 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0|%0, %1}"
9511 [(set_attr "type" "ssemov")
9512 (set_attr "memory" "store")
9513 (set_attr "prefix" "evex")
9514 (set_attr "mode" "TI")])
9516 (define_insn "avx512vl_<code><mode>v8qi2_mask"
9517 [(set (match_operand:V16QI 0 "register_operand" "=v")
9521 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9523 (match_operand:V16QI 2 "vector_move_operand" "0C")
9524 (parallel [(const_int 0) (const_int 1)
9525 (const_int 2) (const_int 3)
9526 (const_int 4) (const_int 5)
9527 (const_int 6) (const_int 7)]))
9528 (match_operand:QI 3 "register_operand" "Yk"))
9529 (const_vector:V8QI [(const_int 0) (const_int 0)
9530 (const_int 0) (const_int 0)
9531 (const_int 0) (const_int 0)
9532 (const_int 0) (const_int 0)])))]
9534 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9535 [(set_attr "type" "ssemov")
9536 (set_attr "prefix" "evex")
9537 (set_attr "mode" "TI")])
9539 (define_insn "*avx512vl_<code><mode>v8qi2_mask_1"
9540 [(set (match_operand:V16QI 0 "register_operand" "=v")
9544 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9545 (const_vector:V8QI [(const_int 0) (const_int 0)
9546 (const_int 0) (const_int 0)
9547 (const_int 0) (const_int 0)
9548 (const_int 0) (const_int 0)])
9549 (match_operand:QI 2 "register_operand" "Yk"))
9550 (const_vector:V8QI [(const_int 0) (const_int 0)
9551 (const_int 0) (const_int 0)
9552 (const_int 0) (const_int 0)
9553 (const_int 0) (const_int 0)])))]
9555 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9556 [(set_attr "type" "ssemov")
9557 (set_attr "prefix" "evex")
9558 (set_attr "mode" "TI")])
9560 (define_insn "avx512vl_<code><mode>v8qi2_mask_store"
9561 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9565 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9568 (parallel [(const_int 0) (const_int 1)
9569 (const_int 2) (const_int 3)
9570 (const_int 4) (const_int 5)
9571 (const_int 6) (const_int 7)]))
9572 (match_operand:QI 2 "register_operand" "Yk"))
9575 (parallel [(const_int 8) (const_int 9)
9576 (const_int 10) (const_int 11)
9577 (const_int 12) (const_int 13)
9578 (const_int 14) (const_int 15)]))))]
9581 if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 4)
9582 return "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}|%0%{%2%}, %g1}";
9583 return "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
9585 [(set_attr "type" "ssemov")
9586 (set_attr "memory" "store")
9587 (set_attr "prefix" "evex")
9588 (set_attr "mode" "TI")])
9590 (define_mode_iterator PMOV_SRC_MODE_4 [V4DI V2DI V4SI])
9591 (define_mode_attr pmov_dst_4
9592 [(V4DI "V4HI") (V2DI "V2HI") (V4SI "V4HI")])
9593 (define_mode_attr pmov_dst_zeroed_4
9594 [(V4DI "V4HI") (V2DI "V6HI") (V4SI "V4HI")])
9595 (define_mode_attr pmov_suff_4
9596 [(V4DI "qw") (V2DI "qw") (V4SI "dw")])
9598 (define_insn "*avx512vl_<code><mode>v<ssescalarnum>hi2"
9599 [(set (match_operand:V8HI 0 "register_operand" "=v")
9601 (any_truncate:<pmov_dst_4>
9602 (match_operand:PMOV_SRC_MODE_4 1 "register_operand" "v"))
9603 (match_operand:<pmov_dst_zeroed_4> 2 "const0_operand")))]
9605 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0|%0, %1}"
9606 [(set_attr "type" "ssemov")
9607 (set_attr "prefix" "evex")
9608 (set_attr "mode" "TI")])
9610 (define_insn "*avx512vl_<code><mode>v4hi2_store"
9611 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9614 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9617 (parallel [(const_int 4) (const_int 5)
9618 (const_int 6) (const_int 7)]))))]
9620 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0|%0, %1}"
9621 [(set_attr "type" "ssemov")
9622 (set_attr "memory" "store")
9623 (set_attr "prefix" "evex")
9624 (set_attr "mode" "TI")])
9626 (define_insn "avx512vl_<code><mode>v4hi2_mask"
9627 [(set (match_operand:V8HI 0 "register_operand" "=v")
9631 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9633 (match_operand:V8HI 2 "vector_move_operand" "0C")
9634 (parallel [(const_int 0) (const_int 1)
9635 (const_int 2) (const_int 3)]))
9636 (match_operand:QI 3 "register_operand" "Yk"))
9637 (const_vector:V4HI [(const_int 0) (const_int 0)
9638 (const_int 0) (const_int 0)])))]
9640 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9641 [(set_attr "type" "ssemov")
9642 (set_attr "prefix" "evex")
9643 (set_attr "mode" "TI")])
9645 (define_insn "*avx512vl_<code><mode>v4hi2_mask_1"
9646 [(set (match_operand:V8HI 0 "register_operand" "=v")
9650 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9651 (const_vector:V4HI [(const_int 0) (const_int 0)
9652 (const_int 0) (const_int 0)])
9653 (match_operand:QI 2 "register_operand" "Yk"))
9654 (const_vector:V4HI [(const_int 0) (const_int 0)
9655 (const_int 0) (const_int 0)])))]
9657 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9658 [(set_attr "type" "ssemov")
9659 (set_attr "prefix" "evex")
9660 (set_attr "mode" "TI")])
9662 (define_insn "avx512vl_<code><mode>v4hi2_mask_store"
9663 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9667 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9670 (parallel [(const_int 0) (const_int 1)
9671 (const_int 2) (const_int 3)]))
9672 (match_operand:QI 2 "register_operand" "Yk"))
9675 (parallel [(const_int 4) (const_int 5)
9676 (const_int 6) (const_int 7)]))))]
9679 if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 4)
9680 return "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%2%}|%0%{%2%}, %t1}";
9681 return "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%2%}|%0%{%2%}, %g1}";
9683 [(set_attr "type" "ssemov")
9684 (set_attr "memory" "store")
9685 (set_attr "prefix" "evex")
9686 (set_attr "mode" "TI")])
9688 (define_insn "*avx512vl_<code>v2div2hi2_store"
9689 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9692 (match_operand:V2DI 1 "register_operand" "v"))
9695 (parallel [(const_int 2) (const_int 3)
9696 (const_int 4) (const_int 5)
9697 (const_int 6) (const_int 7)]))))]
9699 "vpmov<trunsuffix>qw\t{%1, %0|%0, %1}"
9700 [(set_attr "type" "ssemov")
9701 (set_attr "memory" "store")
9702 (set_attr "prefix" "evex")
9703 (set_attr "mode" "TI")])
9705 (define_insn "avx512vl_<code>v2div2hi2_mask"
9706 [(set (match_operand:V8HI 0 "register_operand" "=v")
9710 (match_operand:V2DI 1 "register_operand" "v"))
9712 (match_operand:V8HI 2 "vector_move_operand" "0C")
9713 (parallel [(const_int 0) (const_int 1)]))
9714 (match_operand:QI 3 "register_operand" "Yk"))
9715 (const_vector:V6HI [(const_int 0) (const_int 0)
9716 (const_int 0) (const_int 0)
9717 (const_int 0) (const_int 0)])))]
9719 "vpmov<trunsuffix>qw\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9720 [(set_attr "type" "ssemov")
9721 (set_attr "prefix" "evex")
9722 (set_attr "mode" "TI")])
9724 (define_insn "*avx512vl_<code>v2div2hi2_mask_1"
9725 [(set (match_operand:V8HI 0 "register_operand" "=v")
9729 (match_operand:V2DI 1 "register_operand" "v"))
9730 (const_vector:V2HI [(const_int 0) (const_int 0)])
9731 (match_operand:QI 2 "register_operand" "Yk"))
9732 (const_vector:V6HI [(const_int 0) (const_int 0)
9733 (const_int 0) (const_int 0)
9734 (const_int 0) (const_int 0)])))]
9736 "vpmov<trunsuffix>qw\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9737 [(set_attr "type" "ssemov")
9738 (set_attr "prefix" "evex")
9739 (set_attr "mode" "TI")])
9741 (define_insn "avx512vl_<code>v2div2hi2_mask_store"
9742 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9746 (match_operand:V2DI 1 "register_operand" "v"))
9749 (parallel [(const_int 0) (const_int 1)]))
9750 (match_operand:QI 2 "register_operand" "Yk"))
9753 (parallel [(const_int 2) (const_int 3)
9754 (const_int 4) (const_int 5)
9755 (const_int 6) (const_int 7)]))))]
9757 "vpmov<trunsuffix>qw\t{%1, %0%{%2%}|%0%{%2%}, %g1}"
9758 [(set_attr "type" "ssemov")
9759 (set_attr "memory" "store")
9760 (set_attr "prefix" "evex")
9761 (set_attr "mode" "TI")])
9763 (define_insn "*avx512vl_<code>v2div2si2"
9764 [(set (match_operand:V4SI 0 "register_operand" "=v")
9767 (match_operand:V2DI 1 "register_operand" "v"))
9768 (match_operand:V2SI 2 "const0_operand")))]
9770 "vpmov<trunsuffix>qd\t{%1, %0|%0, %1}"
9771 [(set_attr "type" "ssemov")
9772 (set_attr "prefix" "evex")
9773 (set_attr "mode" "TI")])
9775 (define_insn "*avx512vl_<code>v2div2si2_store"
9776 [(set (match_operand:V4SI 0 "memory_operand" "=m")
9779 (match_operand:V2DI 1 "register_operand" "v"))
9782 (parallel [(const_int 2) (const_int 3)]))))]
9784 "vpmov<trunsuffix>qd\t{%1, %0|%0, %1}"
9785 [(set_attr "type" "ssemov")
9786 (set_attr "memory" "store")
9787 (set_attr "prefix" "evex")
9788 (set_attr "mode" "TI")])
9790 (define_insn "avx512vl_<code>v2div2si2_mask"
9791 [(set (match_operand:V4SI 0 "register_operand" "=v")
9795 (match_operand:V2DI 1 "register_operand" "v"))
9797 (match_operand:V4SI 2 "vector_move_operand" "0C")
9798 (parallel [(const_int 0) (const_int 1)]))
9799 (match_operand:QI 3 "register_operand" "Yk"))
9800 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
9802 "vpmov<trunsuffix>qd\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9803 [(set_attr "type" "ssemov")
9804 (set_attr "prefix" "evex")
9805 (set_attr "mode" "TI")])
9807 (define_insn "*avx512vl_<code>v2div2si2_mask_1"
9808 [(set (match_operand:V4SI 0 "register_operand" "=v")
9812 (match_operand:V2DI 1 "register_operand" "v"))
9813 (const_vector:V2SI [(const_int 0) (const_int 0)])
9814 (match_operand:QI 2 "register_operand" "Yk"))
9815 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
9817 "vpmov<trunsuffix>qd\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9818 [(set_attr "type" "ssemov")
9819 (set_attr "prefix" "evex")
9820 (set_attr "mode" "TI")])
9822 (define_insn "avx512vl_<code>v2div2si2_mask_store"
9823 [(set (match_operand:V4SI 0 "memory_operand" "=m")
9827 (match_operand:V2DI 1 "register_operand" "v"))
9830 (parallel [(const_int 0) (const_int 1)]))
9831 (match_operand:QI 2 "register_operand" "Yk"))
9834 (parallel [(const_int 2) (const_int 3)]))))]
9836 "vpmov<trunsuffix>qd\t{%1, %0%{%2%}|%0%{%2%}, %t1}"
9837 [(set_attr "type" "ssemov")
9838 (set_attr "memory" "store")
9839 (set_attr "prefix" "evex")
9840 (set_attr "mode" "TI")])
9842 (define_insn "*avx512f_<code>v8div16qi2"
9843 [(set (match_operand:V16QI 0 "register_operand" "=v")
9846 (match_operand:V8DI 1 "register_operand" "v"))
9847 (const_vector:V8QI [(const_int 0) (const_int 0)
9848 (const_int 0) (const_int 0)
9849 (const_int 0) (const_int 0)
9850 (const_int 0) (const_int 0)])))]
9852 "vpmov<trunsuffix>qb\t{%1, %0|%0, %1}"
9853 [(set_attr "type" "ssemov")
9854 (set_attr "prefix" "evex")
9855 (set_attr "mode" "TI")])
9857 (define_insn "*avx512f_<code>v8div16qi2_store"
9858 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9861 (match_operand:V8DI 1 "register_operand" "v"))
9864 (parallel [(const_int 8) (const_int 9)
9865 (const_int 10) (const_int 11)
9866 (const_int 12) (const_int 13)
9867 (const_int 14) (const_int 15)]))))]
9869 "vpmov<trunsuffix>qb\t{%1, %0|%0, %1}"
9870 [(set_attr "type" "ssemov")
9871 (set_attr "memory" "store")
9872 (set_attr "prefix" "evex")
9873 (set_attr "mode" "TI")])
9875 (define_insn "avx512f_<code>v8div16qi2_mask"
9876 [(set (match_operand:V16QI 0 "register_operand" "=v")
9880 (match_operand:V8DI 1 "register_operand" "v"))
9882 (match_operand:V16QI 2 "vector_move_operand" "0C")
9883 (parallel [(const_int 0) (const_int 1)
9884 (const_int 2) (const_int 3)
9885 (const_int 4) (const_int 5)
9886 (const_int 6) (const_int 7)]))
9887 (match_operand:QI 3 "register_operand" "Yk"))
9888 (const_vector:V8QI [(const_int 0) (const_int 0)
9889 (const_int 0) (const_int 0)
9890 (const_int 0) (const_int 0)
9891 (const_int 0) (const_int 0)])))]
9893 "vpmov<trunsuffix>qb\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9894 [(set_attr "type" "ssemov")
9895 (set_attr "prefix" "evex")
9896 (set_attr "mode" "TI")])
9898 (define_insn "*avx512f_<code>v8div16qi2_mask_1"
9899 [(set (match_operand:V16QI 0 "register_operand" "=v")
9903 (match_operand:V8DI 1 "register_operand" "v"))
9904 (const_vector:V8QI [(const_int 0) (const_int 0)
9905 (const_int 0) (const_int 0)
9906 (const_int 0) (const_int 0)
9907 (const_int 0) (const_int 0)])
9908 (match_operand:QI 2 "register_operand" "Yk"))
9909 (const_vector:V8QI [(const_int 0) (const_int 0)
9910 (const_int 0) (const_int 0)
9911 (const_int 0) (const_int 0)
9912 (const_int 0) (const_int 0)])))]
9914 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9915 [(set_attr "type" "ssemov")
9916 (set_attr "prefix" "evex")
9917 (set_attr "mode" "TI")])
9919 (define_insn "avx512f_<code>v8div16qi2_mask_store"
9920 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9924 (match_operand:V8DI 1 "register_operand" "v"))
9927 (parallel [(const_int 0) (const_int 1)
9928 (const_int 2) (const_int 3)
9929 (const_int 4) (const_int 5)
9930 (const_int 6) (const_int 7)]))
9931 (match_operand:QI 2 "register_operand" "Yk"))
9934 (parallel [(const_int 8) (const_int 9)
9935 (const_int 10) (const_int 11)
9936 (const_int 12) (const_int 13)
9937 (const_int 14) (const_int 15)]))))]
9939 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}|%q0%{%2%}, %1}"
9940 [(set_attr "type" "ssemov")
9941 (set_attr "memory" "store")
9942 (set_attr "prefix" "evex")
9943 (set_attr "mode" "TI")])
9945 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9947 ;; Parallel integral arithmetic
9949 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9951 (define_expand "neg<mode>2"
9952 [(set (match_operand:VI_AVX2 0 "register_operand")
9955 (match_operand:VI_AVX2 1 "vector_operand")))]
9957 "operands[2] = force_reg (<MODE>mode, CONST0_RTX (<MODE>mode));")
9959 (define_expand "<plusminus_insn><mode>3"
9960 [(set (match_operand:VI_AVX2 0 "register_operand")
9962 (match_operand:VI_AVX2 1 "vector_operand")
9963 (match_operand:VI_AVX2 2 "vector_operand")))]
9965 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
9967 (define_expand "<plusminus_insn><mode>3_mask"
9968 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
9969 (vec_merge:VI48_AVX512VL
9970 (plusminus:VI48_AVX512VL
9971 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand")
9972 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand"))
9973 (match_operand:VI48_AVX512VL 3 "vector_move_operand")
9974 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
9976 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
9978 (define_expand "<plusminus_insn><mode>3_mask"
9979 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
9980 (vec_merge:VI12_AVX512VL
9981 (plusminus:VI12_AVX512VL
9982 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand")
9983 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand"))
9984 (match_operand:VI12_AVX512VL 3 "vector_move_operand")
9985 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
9987 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
9989 (define_insn "*<plusminus_insn><mode>3"
9990 [(set (match_operand:VI_AVX2 0 "register_operand" "=x,v")
9992 (match_operand:VI_AVX2 1 "vector_operand" "<comm>0,v")
9993 (match_operand:VI_AVX2 2 "vector_operand" "xBm,vm")))]
9994 "TARGET_SSE2 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
9996 p<plusminus_mnemonic><ssemodesuffix>\t{%2, %0|%0, %2}
9997 vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
9998 [(set_attr "isa" "noavx,avx")
9999 (set_attr "type" "sseiadd")
10000 (set_attr "prefix_data16" "1,*")
10001 (set_attr "prefix" "<mask_prefix3>")
10002 (set_attr "mode" "<sseinsnmode>")])
10004 (define_insn "*<plusminus_insn><mode>3_mask"
10005 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
10006 (vec_merge:VI48_AVX512VL
10007 (plusminus:VI48_AVX512VL
10008 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "<comm>v")
10009 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm"))
10010 (match_operand:VI48_AVX512VL 3 "vector_move_operand" "0C")
10011 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
10012 "TARGET_AVX512F && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
10013 "vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
10014 [(set_attr "type" "sseiadd")
10015 (set_attr "prefix" "evex")
10016 (set_attr "mode" "<sseinsnmode>")])
10018 (define_insn "*<plusminus_insn><mode>3_mask"
10019 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
10020 (vec_merge:VI12_AVX512VL
10021 (plusminus:VI12_AVX512VL
10022 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "<comm>v")
10023 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm"))
10024 (match_operand:VI12_AVX512VL 3 "vector_move_operand" "0C")
10025 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
10026 "TARGET_AVX512BW && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
10027 "vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
10028 [(set_attr "type" "sseiadd")
10029 (set_attr "prefix" "evex")
10030 (set_attr "mode" "<sseinsnmode>")])
10032 (define_expand "<sse2_avx2>_<plusminus_insn><mode>3<mask_name>"
10033 [(set (match_operand:VI12_AVX2 0 "register_operand")
10034 (sat_plusminus:VI12_AVX2
10035 (match_operand:VI12_AVX2 1 "vector_operand")
10036 (match_operand:VI12_AVX2 2 "vector_operand")))]
10037 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10038 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
10040 (define_insn "*<sse2_avx2>_<plusminus_insn><mode>3<mask_name>"
10041 [(set (match_operand:VI12_AVX2 0 "register_operand" "=x,v")
10042 (sat_plusminus:VI12_AVX2
10043 (match_operand:VI12_AVX2 1 "vector_operand" "<comm>0,v")
10044 (match_operand:VI12_AVX2 2 "vector_operand" "xBm,vm")))]
10045 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>
10046 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
10048 p<plusminus_mnemonic><ssemodesuffix>\t{%2, %0|%0, %2}
10049 vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10050 [(set_attr "isa" "noavx,avx")
10051 (set_attr "type" "sseiadd")
10052 (set_attr "prefix_data16" "1,*")
10053 (set_attr "prefix" "orig,maybe_evex")
10054 (set_attr "mode" "TI")])
10056 (define_expand "mul<mode>3<mask_name>"
10057 [(set (match_operand:VI1_AVX512 0 "register_operand")
10058 (mult:VI1_AVX512 (match_operand:VI1_AVX512 1 "register_operand")
10059 (match_operand:VI1_AVX512 2 "register_operand")))]
10060 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10062 ix86_expand_vecop_qihi (MULT, operands[0], operands[1], operands[2]);
10066 (define_expand "mul<mode>3<mask_name>"
10067 [(set (match_operand:VI2_AVX2 0 "register_operand")
10068 (mult:VI2_AVX2 (match_operand:VI2_AVX2 1 "vector_operand")
10069 (match_operand:VI2_AVX2 2 "vector_operand")))]
10070 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10071 "ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);")
10073 (define_insn "*mul<mode>3<mask_name>"
10074 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,v")
10075 (mult:VI2_AVX2 (match_operand:VI2_AVX2 1 "vector_operand" "%0,v")
10076 (match_operand:VI2_AVX2 2 "vector_operand" "xBm,vm")))]
10077 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
10078 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10080 pmullw\t{%2, %0|%0, %2}
10081 vpmullw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10082 [(set_attr "isa" "noavx,avx")
10083 (set_attr "type" "sseimul")
10084 (set_attr "prefix_data16" "1,*")
10085 (set_attr "prefix" "orig,vex")
10086 (set_attr "mode" "<sseinsnmode>")])
10088 (define_expand "<s>mul<mode>3_highpart<mask_name>"
10089 [(set (match_operand:VI2_AVX2 0 "register_operand")
10091 (lshiftrt:<ssedoublemode>
10092 (mult:<ssedoublemode>
10093 (any_extend:<ssedoublemode>
10094 (match_operand:VI2_AVX2 1 "vector_operand"))
10095 (any_extend:<ssedoublemode>
10096 (match_operand:VI2_AVX2 2 "vector_operand")))
10099 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10100 "ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);")
10102 (define_insn "*<s>mul<mode>3_highpart<mask_name>"
10103 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,v")
10105 (lshiftrt:<ssedoublemode>
10106 (mult:<ssedoublemode>
10107 (any_extend:<ssedoublemode>
10108 (match_operand:VI2_AVX2 1 "vector_operand" "%0,v"))
10109 (any_extend:<ssedoublemode>
10110 (match_operand:VI2_AVX2 2 "vector_operand" "xBm,vm")))
10112 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
10113 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10115 pmulh<u>w\t{%2, %0|%0, %2}
10116 vpmulh<u>w\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10117 [(set_attr "isa" "noavx,avx")
10118 (set_attr "type" "sseimul")
10119 (set_attr "prefix_data16" "1,*")
10120 (set_attr "prefix" "orig,vex")
10121 (set_attr "mode" "<sseinsnmode>")])
10123 (define_expand "vec_widen_umult_even_v16si<mask_name>"
10124 [(set (match_operand:V8DI 0 "register_operand")
10128 (match_operand:V16SI 1 "nonimmediate_operand")
10129 (parallel [(const_int 0) (const_int 2)
10130 (const_int 4) (const_int 6)
10131 (const_int 8) (const_int 10)
10132 (const_int 12) (const_int 14)])))
10135 (match_operand:V16SI 2 "nonimmediate_operand")
10136 (parallel [(const_int 0) (const_int 2)
10137 (const_int 4) (const_int 6)
10138 (const_int 8) (const_int 10)
10139 (const_int 12) (const_int 14)])))))]
10141 "ix86_fixup_binary_operands_no_copy (MULT, V16SImode, operands);")
10143 (define_insn "*vec_widen_umult_even_v16si<mask_name>"
10144 [(set (match_operand:V8DI 0 "register_operand" "=v")
10148 (match_operand:V16SI 1 "nonimmediate_operand" "%v")
10149 (parallel [(const_int 0) (const_int 2)
10150 (const_int 4) (const_int 6)
10151 (const_int 8) (const_int 10)
10152 (const_int 12) (const_int 14)])))
10155 (match_operand:V16SI 2 "nonimmediate_operand" "vm")
10156 (parallel [(const_int 0) (const_int 2)
10157 (const_int 4) (const_int 6)
10158 (const_int 8) (const_int 10)
10159 (const_int 12) (const_int 14)])))))]
10160 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10161 "vpmuludq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10162 [(set_attr "type" "sseimul")
10163 (set_attr "prefix_extra" "1")
10164 (set_attr "prefix" "evex")
10165 (set_attr "mode" "XI")])
10167 (define_expand "vec_widen_umult_even_v8si<mask_name>"
10168 [(set (match_operand:V4DI 0 "register_operand")
10172 (match_operand:V8SI 1 "nonimmediate_operand")
10173 (parallel [(const_int 0) (const_int 2)
10174 (const_int 4) (const_int 6)])))
10177 (match_operand:V8SI 2 "nonimmediate_operand")
10178 (parallel [(const_int 0) (const_int 2)
10179 (const_int 4) (const_int 6)])))))]
10180 "TARGET_AVX2 && <mask_avx512vl_condition>"
10181 "ix86_fixup_binary_operands_no_copy (MULT, V8SImode, operands);")
10183 (define_insn "*vec_widen_umult_even_v8si<mask_name>"
10184 [(set (match_operand:V4DI 0 "register_operand" "=v")
10188 (match_operand:V8SI 1 "nonimmediate_operand" "%v")
10189 (parallel [(const_int 0) (const_int 2)
10190 (const_int 4) (const_int 6)])))
10193 (match_operand:V8SI 2 "nonimmediate_operand" "vm")
10194 (parallel [(const_int 0) (const_int 2)
10195 (const_int 4) (const_int 6)])))))]
10196 "TARGET_AVX2 && <mask_avx512vl_condition>
10197 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10198 "vpmuludq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10199 [(set_attr "type" "sseimul")
10200 (set_attr "prefix" "maybe_evex")
10201 (set_attr "mode" "OI")])
10203 (define_expand "vec_widen_umult_even_v4si<mask_name>"
10204 [(set (match_operand:V2DI 0 "register_operand")
10208 (match_operand:V4SI 1 "vector_operand")
10209 (parallel [(const_int 0) (const_int 2)])))
10212 (match_operand:V4SI 2 "vector_operand")
10213 (parallel [(const_int 0) (const_int 2)])))))]
10214 "TARGET_SSE2 && <mask_avx512vl_condition>"
10215 "ix86_fixup_binary_operands_no_copy (MULT, V4SImode, operands);")
10217 (define_insn "*vec_widen_umult_even_v4si<mask_name>"
10218 [(set (match_operand:V2DI 0 "register_operand" "=x,v")
10222 (match_operand:V4SI 1 "vector_operand" "%0,v")
10223 (parallel [(const_int 0) (const_int 2)])))
10226 (match_operand:V4SI 2 "vector_operand" "xBm,vm")
10227 (parallel [(const_int 0) (const_int 2)])))))]
10228 "TARGET_SSE2 && <mask_avx512vl_condition>
10229 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10231 pmuludq\t{%2, %0|%0, %2}
10232 vpmuludq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10233 [(set_attr "isa" "noavx,avx")
10234 (set_attr "type" "sseimul")
10235 (set_attr "prefix_data16" "1,*")
10236 (set_attr "prefix" "orig,maybe_evex")
10237 (set_attr "mode" "TI")])
10239 (define_expand "vec_widen_smult_even_v16si<mask_name>"
10240 [(set (match_operand:V8DI 0 "register_operand")
10244 (match_operand:V16SI 1 "nonimmediate_operand")
10245 (parallel [(const_int 0) (const_int 2)
10246 (const_int 4) (const_int 6)
10247 (const_int 8) (const_int 10)
10248 (const_int 12) (const_int 14)])))
10251 (match_operand:V16SI 2 "nonimmediate_operand")
10252 (parallel [(const_int 0) (const_int 2)
10253 (const_int 4) (const_int 6)
10254 (const_int 8) (const_int 10)
10255 (const_int 12) (const_int 14)])))))]
10257 "ix86_fixup_binary_operands_no_copy (MULT, V16SImode, operands);")
10259 (define_insn "*vec_widen_smult_even_v16si<mask_name>"
10260 [(set (match_operand:V8DI 0 "register_operand" "=v")
10264 (match_operand:V16SI 1 "nonimmediate_operand" "%v")
10265 (parallel [(const_int 0) (const_int 2)
10266 (const_int 4) (const_int 6)
10267 (const_int 8) (const_int 10)
10268 (const_int 12) (const_int 14)])))
10271 (match_operand:V16SI 2 "nonimmediate_operand" "vm")
10272 (parallel [(const_int 0) (const_int 2)
10273 (const_int 4) (const_int 6)
10274 (const_int 8) (const_int 10)
10275 (const_int 12) (const_int 14)])))))]
10276 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10277 "vpmuldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10278 [(set_attr "type" "sseimul")
10279 (set_attr "prefix_extra" "1")
10280 (set_attr "prefix" "evex")
10281 (set_attr "mode" "XI")])
10283 (define_expand "vec_widen_smult_even_v8si<mask_name>"
10284 [(set (match_operand:V4DI 0 "register_operand")
10288 (match_operand:V8SI 1 "nonimmediate_operand")
10289 (parallel [(const_int 0) (const_int 2)
10290 (const_int 4) (const_int 6)])))
10293 (match_operand:V8SI 2 "nonimmediate_operand")
10294 (parallel [(const_int 0) (const_int 2)
10295 (const_int 4) (const_int 6)])))))]
10296 "TARGET_AVX2 && <mask_avx512vl_condition>"
10297 "ix86_fixup_binary_operands_no_copy (MULT, V8SImode, operands);")
10299 (define_insn "*vec_widen_smult_even_v8si<mask_name>"
10300 [(set (match_operand:V4DI 0 "register_operand" "=v")
10304 (match_operand:V8SI 1 "nonimmediate_operand" "%v")
10305 (parallel [(const_int 0) (const_int 2)
10306 (const_int 4) (const_int 6)])))
10309 (match_operand:V8SI 2 "nonimmediate_operand" "vm")
10310 (parallel [(const_int 0) (const_int 2)
10311 (const_int 4) (const_int 6)])))))]
10312 "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10313 "vpmuldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10314 [(set_attr "type" "sseimul")
10315 (set_attr "prefix_extra" "1")
10316 (set_attr "prefix" "vex")
10317 (set_attr "mode" "OI")])
10319 (define_expand "sse4_1_mulv2siv2di3<mask_name>"
10320 [(set (match_operand:V2DI 0 "register_operand")
10324 (match_operand:V4SI 1 "vector_operand")
10325 (parallel [(const_int 0) (const_int 2)])))
10328 (match_operand:V4SI 2 "vector_operand")
10329 (parallel [(const_int 0) (const_int 2)])))))]
10330 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
10331 "ix86_fixup_binary_operands_no_copy (MULT, V4SImode, operands);")
10333 (define_insn "*sse4_1_mulv2siv2di3<mask_name>"
10334 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
10338 (match_operand:V4SI 1 "vector_operand" "%0,0,v")
10339 (parallel [(const_int 0) (const_int 2)])))
10342 (match_operand:V4SI 2 "vector_operand" "YrBm,*xBm,vm")
10343 (parallel [(const_int 0) (const_int 2)])))))]
10344 "TARGET_SSE4_1 && <mask_avx512vl_condition>
10345 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10347 pmuldq\t{%2, %0|%0, %2}
10348 pmuldq\t{%2, %0|%0, %2}
10349 vpmuldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10350 [(set_attr "isa" "noavx,noavx,avx")
10351 (set_attr "type" "sseimul")
10352 (set_attr "prefix_data16" "1,1,*")
10353 (set_attr "prefix_extra" "1")
10354 (set_attr "prefix" "orig,orig,vex")
10355 (set_attr "mode" "TI")])
10357 (define_insn "avx512bw_pmaddwd512<mode><mask_name>"
10358 [(set (match_operand:<sseunpackmode> 0 "register_operand" "=v")
10359 (unspec:<sseunpackmode>
10360 [(match_operand:VI2_AVX2 1 "register_operand" "v")
10361 (match_operand:VI2_AVX2 2 "nonimmediate_operand" "vm")]
10362 UNSPEC_PMADDWD512))]
10363 "TARGET_AVX512BW && <mask_mode512bit_condition>"
10364 "vpmaddwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}";
10365 [(set_attr "type" "sseiadd")
10366 (set_attr "prefix" "evex")
10367 (set_attr "mode" "XI")])
10369 (define_expand "avx2_pmaddwd"
10370 [(set (match_operand:V8SI 0 "register_operand")
10375 (match_operand:V16HI 1 "nonimmediate_operand")
10376 (parallel [(const_int 0) (const_int 2)
10377 (const_int 4) (const_int 6)
10378 (const_int 8) (const_int 10)
10379 (const_int 12) (const_int 14)])))
10382 (match_operand:V16HI 2 "nonimmediate_operand")
10383 (parallel [(const_int 0) (const_int 2)
10384 (const_int 4) (const_int 6)
10385 (const_int 8) (const_int 10)
10386 (const_int 12) (const_int 14)]))))
10389 (vec_select:V8HI (match_dup 1)
10390 (parallel [(const_int 1) (const_int 3)
10391 (const_int 5) (const_int 7)
10392 (const_int 9) (const_int 11)
10393 (const_int 13) (const_int 15)])))
10395 (vec_select:V8HI (match_dup 2)
10396 (parallel [(const_int 1) (const_int 3)
10397 (const_int 5) (const_int 7)
10398 (const_int 9) (const_int 11)
10399 (const_int 13) (const_int 15)]))))))]
10401 "ix86_fixup_binary_operands_no_copy (MULT, V16HImode, operands);")
10403 (define_insn "*avx2_pmaddwd"
10404 [(set (match_operand:V8SI 0 "register_operand" "=x,v")
10409 (match_operand:V16HI 1 "nonimmediate_operand" "%x,v")
10410 (parallel [(const_int 0) (const_int 2)
10411 (const_int 4) (const_int 6)
10412 (const_int 8) (const_int 10)
10413 (const_int 12) (const_int 14)])))
10416 (match_operand:V16HI 2 "nonimmediate_operand" "xm,vm")
10417 (parallel [(const_int 0) (const_int 2)
10418 (const_int 4) (const_int 6)
10419 (const_int 8) (const_int 10)
10420 (const_int 12) (const_int 14)]))))
10423 (vec_select:V8HI (match_dup 1)
10424 (parallel [(const_int 1) (const_int 3)
10425 (const_int 5) (const_int 7)
10426 (const_int 9) (const_int 11)
10427 (const_int 13) (const_int 15)])))
10429 (vec_select:V8HI (match_dup 2)
10430 (parallel [(const_int 1) (const_int 3)
10431 (const_int 5) (const_int 7)
10432 (const_int 9) (const_int 11)
10433 (const_int 13) (const_int 15)]))))))]
10434 "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10435 "vpmaddwd\t{%2, %1, %0|%0, %1, %2}"
10436 [(set_attr "type" "sseiadd")
10437 (set_attr "isa" "*,avx512bw")
10438 (set_attr "prefix" "vex,evex")
10439 (set_attr "mode" "OI")])
10441 (define_expand "sse2_pmaddwd"
10442 [(set (match_operand:V4SI 0 "register_operand")
10447 (match_operand:V8HI 1 "vector_operand")
10448 (parallel [(const_int 0) (const_int 2)
10449 (const_int 4) (const_int 6)])))
10452 (match_operand:V8HI 2 "vector_operand")
10453 (parallel [(const_int 0) (const_int 2)
10454 (const_int 4) (const_int 6)]))))
10457 (vec_select:V4HI (match_dup 1)
10458 (parallel [(const_int 1) (const_int 3)
10459 (const_int 5) (const_int 7)])))
10461 (vec_select:V4HI (match_dup 2)
10462 (parallel [(const_int 1) (const_int 3)
10463 (const_int 5) (const_int 7)]))))))]
10465 "ix86_fixup_binary_operands_no_copy (MULT, V8HImode, operands);")
10467 (define_insn "*sse2_pmaddwd"
10468 [(set (match_operand:V4SI 0 "register_operand" "=x,x,v")
10473 (match_operand:V8HI 1 "vector_operand" "%0,x,v")
10474 (parallel [(const_int 0) (const_int 2)
10475 (const_int 4) (const_int 6)])))
10478 (match_operand:V8HI 2 "vector_operand" "xBm,xm,vm")
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)]))))))]
10490 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10492 pmaddwd\t{%2, %0|%0, %2}
10493 vpmaddwd\t{%2, %1, %0|%0, %1, %2}
10494 vpmaddwd\t{%2, %1, %0|%0, %1, %2}"
10495 [(set_attr "isa" "noavx,avx,avx512bw")
10496 (set_attr "type" "sseiadd")
10497 (set_attr "atom_unit" "simul")
10498 (set_attr "prefix_data16" "1,*,*")
10499 (set_attr "prefix" "orig,vex,evex")
10500 (set_attr "mode" "TI")])
10502 (define_insn "avx512dq_mul<mode>3<mask_name>"
10503 [(set (match_operand:VI8 0 "register_operand" "=v")
10505 (match_operand:VI8 1 "register_operand" "v")
10506 (match_operand:VI8 2 "nonimmediate_operand" "vm")))]
10507 "TARGET_AVX512DQ && <mask_mode512bit_condition>"
10508 "vpmullq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10509 [(set_attr "type" "sseimul")
10510 (set_attr "prefix" "evex")
10511 (set_attr "mode" "<sseinsnmode>")])
10513 (define_expand "mul<mode>3<mask_name>"
10514 [(set (match_operand:VI4_AVX512F 0 "register_operand")
10516 (match_operand:VI4_AVX512F 1 "general_vector_operand")
10517 (match_operand:VI4_AVX512F 2 "general_vector_operand")))]
10518 "TARGET_SSE2 && <mask_mode512bit_condition>"
10522 if (!vector_operand (operands[1], <MODE>mode))
10523 operands[1] = force_reg (<MODE>mode, operands[1]);
10524 if (!vector_operand (operands[2], <MODE>mode))
10525 operands[2] = force_reg (<MODE>mode, operands[2]);
10526 ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);
10530 ix86_expand_sse2_mulv4si3 (operands[0], operands[1], operands[2]);
10535 (define_insn "*<sse4_1_avx2>_mul<mode>3<mask_name>"
10536 [(set (match_operand:VI4_AVX512F 0 "register_operand" "=Yr,*x,v")
10538 (match_operand:VI4_AVX512F 1 "vector_operand" "%0,0,v")
10539 (match_operand:VI4_AVX512F 2 "vector_operand" "YrBm,*xBm,vm")))]
10540 "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
10541 && <mask_mode512bit_condition>"
10543 pmulld\t{%2, %0|%0, %2}
10544 pmulld\t{%2, %0|%0, %2}
10545 vpmulld\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10546 [(set_attr "isa" "noavx,noavx,avx")
10547 (set_attr "type" "sseimul")
10548 (set_attr "prefix_extra" "1")
10549 (set_attr "prefix" "<mask_prefix4>")
10550 (set_attr "btver2_decode" "vector,vector,vector")
10551 (set_attr "mode" "<sseinsnmode>")])
10553 (define_expand "mul<mode>3"
10554 [(set (match_operand:VI8_AVX2_AVX512F 0 "register_operand")
10555 (mult:VI8_AVX2_AVX512F
10556 (match_operand:VI8_AVX2_AVX512F 1 "register_operand")
10557 (match_operand:VI8_AVX2_AVX512F 2 "register_operand")))]
10560 ix86_expand_sse2_mulvxdi3 (operands[0], operands[1], operands[2]);
10564 (define_expand "vec_widen_<s>mult_hi_<mode>"
10565 [(match_operand:<sseunpackmode> 0 "register_operand")
10566 (any_extend:<sseunpackmode>
10567 (match_operand:VI124_AVX2 1 "register_operand"))
10568 (match_operand:VI124_AVX2 2 "register_operand")]
10571 ix86_expand_mul_widen_hilo (operands[0], operands[1], operands[2],
10576 (define_expand "vec_widen_<s>mult_lo_<mode>"
10577 [(match_operand:<sseunpackmode> 0 "register_operand")
10578 (any_extend:<sseunpackmode>
10579 (match_operand:VI124_AVX2 1 "register_operand"))
10580 (match_operand:VI124_AVX2 2 "register_operand")]
10583 ix86_expand_mul_widen_hilo (operands[0], operands[1], operands[2],
10588 ;; Most widen_<s>mult_even_<mode> can be handled directly from other
10589 ;; named patterns, but signed V4SI needs special help for plain SSE2.
10590 (define_expand "vec_widen_smult_even_v4si"
10591 [(match_operand:V2DI 0 "register_operand")
10592 (match_operand:V4SI 1 "vector_operand")
10593 (match_operand:V4SI 2 "vector_operand")]
10596 ix86_expand_mul_widen_evenodd (operands[0], operands[1], operands[2],
10601 (define_expand "vec_widen_<s>mult_odd_<mode>"
10602 [(match_operand:<sseunpackmode> 0 "register_operand")
10603 (any_extend:<sseunpackmode>
10604 (match_operand:VI4_AVX512F 1 "general_vector_operand"))
10605 (match_operand:VI4_AVX512F 2 "general_vector_operand")]
10608 ix86_expand_mul_widen_evenodd (operands[0], operands[1], operands[2],
10613 (define_mode_attr SDOT_PMADD_SUF
10614 [(V32HI "512v32hi") (V16HI "") (V8HI "")])
10616 (define_expand "sdot_prod<mode>"
10617 [(match_operand:<sseunpackmode> 0 "register_operand")
10618 (match_operand:VI2_AVX2 1 "register_operand")
10619 (match_operand:VI2_AVX2 2 "register_operand")
10620 (match_operand:<sseunpackmode> 3 "register_operand")]
10623 rtx t = gen_reg_rtx (<sseunpackmode>mode);
10624 emit_insn (gen_<sse2_avx2>_pmaddwd<SDOT_PMADD_SUF> (t, operands[1], operands[2]));
10625 emit_insn (gen_rtx_SET (operands[0],
10626 gen_rtx_PLUS (<sseunpackmode>mode,
10631 ;; Normally we use widen_mul_even/odd, but combine can't quite get it all
10632 ;; back together when madd is available.
10633 (define_expand "sdot_prodv4si"
10634 [(match_operand:V2DI 0 "register_operand")
10635 (match_operand:V4SI 1 "register_operand")
10636 (match_operand:V4SI 2 "register_operand")
10637 (match_operand:V2DI 3 "register_operand")]
10640 rtx t = gen_reg_rtx (V2DImode);
10641 emit_insn (gen_xop_pmacsdqh (t, operands[1], operands[2], operands[3]));
10642 emit_insn (gen_xop_pmacsdql (operands[0], operands[1], operands[2], t));
10646 (define_expand "usadv16qi"
10647 [(match_operand:V4SI 0 "register_operand")
10648 (match_operand:V16QI 1 "register_operand")
10649 (match_operand:V16QI 2 "vector_operand")
10650 (match_operand:V4SI 3 "vector_operand")]
10653 rtx t1 = gen_reg_rtx (V2DImode);
10654 rtx t2 = gen_reg_rtx (V4SImode);
10655 emit_insn (gen_sse2_psadbw (t1, operands[1], operands[2]));
10656 convert_move (t2, t1, 0);
10657 emit_insn (gen_addv4si3 (operands[0], t2, operands[3]));
10661 (define_expand "usadv32qi"
10662 [(match_operand:V8SI 0 "register_operand")
10663 (match_operand:V32QI 1 "register_operand")
10664 (match_operand:V32QI 2 "nonimmediate_operand")
10665 (match_operand:V8SI 3 "nonimmediate_operand")]
10668 rtx t1 = gen_reg_rtx (V4DImode);
10669 rtx t2 = gen_reg_rtx (V8SImode);
10670 emit_insn (gen_avx2_psadbw (t1, operands[1], operands[2]));
10671 convert_move (t2, t1, 0);
10672 emit_insn (gen_addv8si3 (operands[0], t2, operands[3]));
10676 (define_insn "<mask_codefor>ashr<mode>3<mask_name>"
10677 [(set (match_operand:VI248_AVX512BW_1 0 "register_operand" "=v,v")
10678 (ashiftrt:VI248_AVX512BW_1
10679 (match_operand:VI248_AVX512BW_1 1 "nonimmediate_operand" "v,vm")
10680 (match_operand:DI 2 "nonmemory_operand" "v,N")))]
10682 "vpsra<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10683 [(set_attr "type" "sseishft")
10684 (set (attr "length_immediate")
10685 (if_then_else (match_operand 2 "const_int_operand")
10687 (const_string "0")))
10688 (set_attr "mode" "<sseinsnmode>")])
10690 (define_insn "ashr<mode>3"
10691 [(set (match_operand:VI24_AVX2 0 "register_operand" "=x,x")
10692 (ashiftrt:VI24_AVX2
10693 (match_operand:VI24_AVX2 1 "register_operand" "0,x")
10694 (match_operand:DI 2 "nonmemory_operand" "xN,xN")))]
10697 psra<ssemodesuffix>\t{%2, %0|%0, %2}
10698 vpsra<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
10699 [(set_attr "isa" "noavx,avx")
10700 (set_attr "type" "sseishft")
10701 (set (attr "length_immediate")
10702 (if_then_else (match_operand 2 "const_int_operand")
10704 (const_string "0")))
10705 (set_attr "prefix_data16" "1,*")
10706 (set_attr "prefix" "orig,vex")
10707 (set_attr "mode" "<sseinsnmode>")])
10709 (define_insn "ashr<mode>3<mask_name>"
10710 [(set (match_operand:VI248_AVX512BW_AVX512VL 0 "register_operand" "=v,v")
10711 (ashiftrt:VI248_AVX512BW_AVX512VL
10712 (match_operand:VI248_AVX512BW_AVX512VL 1 "nonimmediate_operand" "v,vm")
10713 (match_operand:DI 2 "nonmemory_operand" "v,N")))]
10715 "vpsra<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10716 [(set_attr "type" "sseishft")
10717 (set (attr "length_immediate")
10718 (if_then_else (match_operand 2 "const_int_operand")
10720 (const_string "0")))
10721 (set_attr "mode" "<sseinsnmode>")])
10723 (define_insn "<mask_codefor><shift_insn><mode>3<mask_name>"
10724 [(set (match_operand:VI248_AVX512BW_2 0 "register_operand" "=v,v")
10725 (any_lshift:VI248_AVX512BW_2
10726 (match_operand:VI248_AVX512BW_2 1 "nonimmediate_operand" "v,vm")
10727 (match_operand:DI 2 "nonmemory_operand" "v,N")))]
10729 "vp<vshift><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10730 [(set_attr "type" "sseishft")
10731 (set (attr "length_immediate")
10732 (if_then_else (match_operand 2 "const_int_operand")
10734 (const_string "0")))
10735 (set_attr "mode" "<sseinsnmode>")])
10737 (define_insn "<shift_insn><mode>3"
10738 [(set (match_operand:VI248_AVX2 0 "register_operand" "=x,x")
10739 (any_lshift:VI248_AVX2
10740 (match_operand:VI248_AVX2 1 "register_operand" "0,x")
10741 (match_operand:DI 2 "nonmemory_operand" "xN,xN")))]
10744 p<vshift><ssemodesuffix>\t{%2, %0|%0, %2}
10745 vp<vshift><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
10746 [(set_attr "isa" "noavx,avx")
10747 (set_attr "type" "sseishft")
10748 (set (attr "length_immediate")
10749 (if_then_else (match_operand 2 "const_int_operand")
10751 (const_string "0")))
10752 (set_attr "prefix_data16" "1,*")
10753 (set_attr "prefix" "orig,vex")
10754 (set_attr "mode" "<sseinsnmode>")])
10756 (define_insn "<shift_insn><mode>3<mask_name>"
10757 [(set (match_operand:VI248_AVX512BW 0 "register_operand" "=v,v")
10758 (any_lshift:VI248_AVX512BW
10759 (match_operand:VI248_AVX512BW 1 "nonimmediate_operand" "v,m")
10760 (match_operand:DI 2 "nonmemory_operand" "vN,N")))]
10762 "vp<vshift><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10763 [(set_attr "type" "sseishft")
10764 (set (attr "length_immediate")
10765 (if_then_else (match_operand 2 "const_int_operand")
10767 (const_string "0")))
10768 (set_attr "mode" "<sseinsnmode>")])
10771 (define_expand "vec_shr_<mode>"
10772 [(set (match_dup 3)
10774 (match_operand:VI_128 1 "register_operand")
10775 (match_operand:SI 2 "const_0_to_255_mul_8_operand")))
10776 (set (match_operand:VI_128 0 "register_operand") (match_dup 4))]
10779 operands[1] = gen_lowpart (V1TImode, operands[1]);
10780 operands[3] = gen_reg_rtx (V1TImode);
10781 operands[4] = gen_lowpart (<MODE>mode, operands[3]);
10784 (define_insn "avx512bw_<shift_insn><mode>3"
10785 [(set (match_operand:VIMAX_AVX512VL 0 "register_operand" "=v")
10786 (any_lshift:VIMAX_AVX512VL
10787 (match_operand:VIMAX_AVX512VL 1 "nonimmediate_operand" "vm")
10788 (match_operand:SI 2 "const_0_to_255_mul_8_operand" "n")))]
10791 operands[2] = GEN_INT (INTVAL (operands[2]) / 8);
10792 return "vp<vshift>dq\t{%2, %1, %0|%0, %1, %2}";
10794 [(set_attr "type" "sseishft")
10795 (set_attr "length_immediate" "1")
10796 (set_attr "prefix" "maybe_evex")
10797 (set_attr "mode" "<sseinsnmode>")])
10799 (define_insn "<sse2_avx2>_<shift_insn><mode>3"
10800 [(set (match_operand:VIMAX_AVX2 0 "register_operand" "=x,v")
10801 (any_lshift:VIMAX_AVX2
10802 (match_operand:VIMAX_AVX2 1 "register_operand" "0,v")
10803 (match_operand:SI 2 "const_0_to_255_mul_8_operand" "n,n")))]
10806 operands[2] = GEN_INT (INTVAL (operands[2]) / 8);
10808 switch (which_alternative)
10811 return "p<vshift>dq\t{%2, %0|%0, %2}";
10813 return "vp<vshift>dq\t{%2, %1, %0|%0, %1, %2}";
10815 gcc_unreachable ();
10818 [(set_attr "isa" "noavx,avx")
10819 (set_attr "type" "sseishft")
10820 (set_attr "length_immediate" "1")
10821 (set_attr "atom_unit" "sishuf")
10822 (set_attr "prefix_data16" "1,*")
10823 (set_attr "prefix" "orig,vex")
10824 (set_attr "mode" "<sseinsnmode>")])
10826 (define_insn "<avx512>_<rotate>v<mode><mask_name>"
10827 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
10828 (any_rotate:VI48_AVX512VL
10829 (match_operand:VI48_AVX512VL 1 "register_operand" "v")
10830 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")))]
10832 "vp<rotate>v<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10833 [(set_attr "prefix" "evex")
10834 (set_attr "mode" "<sseinsnmode>")])
10836 (define_insn "<avx512>_<rotate><mode><mask_name>"
10837 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
10838 (any_rotate:VI48_AVX512VL
10839 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm")
10840 (match_operand:SI 2 "const_0_to_255_operand")))]
10842 "vp<rotate><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10843 [(set_attr "prefix" "evex")
10844 (set_attr "mode" "<sseinsnmode>")])
10846 (define_expand "<code><mode>3"
10847 [(set (match_operand:VI124_256_AVX512F_AVX512BW 0 "register_operand")
10848 (maxmin:VI124_256_AVX512F_AVX512BW
10849 (match_operand:VI124_256_AVX512F_AVX512BW 1 "nonimmediate_operand")
10850 (match_operand:VI124_256_AVX512F_AVX512BW 2 "nonimmediate_operand")))]
10852 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
10854 (define_insn "*avx2_<code><mode>3"
10855 [(set (match_operand:VI124_256 0 "register_operand" "=v")
10857 (match_operand:VI124_256 1 "nonimmediate_operand" "%v")
10858 (match_operand:VI124_256 2 "nonimmediate_operand" "vm")))]
10859 "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10860 "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
10861 [(set_attr "type" "sseiadd")
10862 (set_attr "prefix_extra" "1")
10863 (set_attr "prefix" "vex")
10864 (set_attr "mode" "OI")])
10866 (define_expand "<code><mode>3_mask"
10867 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
10868 (vec_merge:VI48_AVX512VL
10869 (maxmin:VI48_AVX512VL
10870 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand")
10871 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand"))
10872 (match_operand:VI48_AVX512VL 3 "vector_move_operand")
10873 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
10875 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
10877 (define_insn "*avx512f_<code><mode>3<mask_name>"
10878 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
10879 (maxmin:VI48_AVX512VL
10880 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "%v")
10881 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")))]
10882 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10883 "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10884 [(set_attr "type" "sseiadd")
10885 (set_attr "prefix_extra" "1")
10886 (set_attr "prefix" "maybe_evex")
10887 (set_attr "mode" "<sseinsnmode>")])
10889 (define_insn "<mask_codefor><code><mode>3<mask_name>"
10890 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
10891 (maxmin:VI12_AVX512VL
10892 (match_operand:VI12_AVX512VL 1 "register_operand" "v")
10893 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")))]
10895 "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10896 [(set_attr "type" "sseiadd")
10897 (set_attr "prefix" "evex")
10898 (set_attr "mode" "<sseinsnmode>")])
10900 (define_expand "<code><mode>3"
10901 [(set (match_operand:VI8_AVX2_AVX512F 0 "register_operand")
10902 (maxmin:VI8_AVX2_AVX512F
10903 (match_operand:VI8_AVX2_AVX512F 1 "register_operand")
10904 (match_operand:VI8_AVX2_AVX512F 2 "register_operand")))]
10908 && (<MODE>mode == V8DImode || TARGET_AVX512VL))
10909 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
10912 enum rtx_code code;
10917 xops[0] = operands[0];
10919 if (<CODE> == SMAX || <CODE> == UMAX)
10921 xops[1] = operands[1];
10922 xops[2] = operands[2];
10926 xops[1] = operands[2];
10927 xops[2] = operands[1];
10930 code = (<CODE> == UMAX || <CODE> == UMIN) ? GTU : GT;
10932 xops[3] = gen_rtx_fmt_ee (code, VOIDmode, operands[1], operands[2]);
10933 xops[4] = operands[1];
10934 xops[5] = operands[2];
10936 ok = ix86_expand_int_vcond (xops);
10942 (define_expand "<code><mode>3"
10943 [(set (match_operand:VI124_128 0 "register_operand")
10945 (match_operand:VI124_128 1 "vector_operand")
10946 (match_operand:VI124_128 2 "vector_operand")))]
10949 if (TARGET_SSE4_1 || <MODE>mode == V8HImode)
10950 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
10956 xops[0] = operands[0];
10957 operands[1] = force_reg (<MODE>mode, operands[1]);
10958 operands[2] = force_reg (<MODE>mode, operands[2]);
10960 if (<CODE> == SMAX)
10962 xops[1] = operands[1];
10963 xops[2] = operands[2];
10967 xops[1] = operands[2];
10968 xops[2] = operands[1];
10971 xops[3] = gen_rtx_GT (VOIDmode, operands[1], operands[2]);
10972 xops[4] = operands[1];
10973 xops[5] = operands[2];
10975 ok = ix86_expand_int_vcond (xops);
10981 (define_insn "*sse4_1_<code><mode>3<mask_name>"
10982 [(set (match_operand:VI14_128 0 "register_operand" "=Yr,*x,v")
10984 (match_operand:VI14_128 1 "vector_operand" "%0,0,v")
10985 (match_operand:VI14_128 2 "vector_operand" "YrBm,*xBm,vm")))]
10987 && <mask_mode512bit_condition>
10988 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10990 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
10991 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
10992 vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10993 [(set_attr "isa" "noavx,noavx,avx")
10994 (set_attr "type" "sseiadd")
10995 (set_attr "prefix_extra" "1,1,*")
10996 (set_attr "prefix" "orig,orig,vex")
10997 (set_attr "mode" "TI")])
10999 (define_insn "*<code>v8hi3"
11000 [(set (match_operand:V8HI 0 "register_operand" "=x,x,v")
11002 (match_operand:V8HI 1 "vector_operand" "%0,x,v")
11003 (match_operand:V8HI 2 "vector_operand" "xBm,xm,vm")))]
11004 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11006 p<maxmin_int>w\t{%2, %0|%0, %2}
11007 vp<maxmin_int>w\t{%2, %1, %0|%0, %1, %2}
11008 vp<maxmin_int>w\t{%2, %1, %0|%0, %1, %2}"
11009 [(set_attr "isa" "noavx,avx,avx512bw")
11010 (set_attr "type" "sseiadd")
11011 (set_attr "prefix_data16" "1,*,*")
11012 (set_attr "prefix_extra" "*,1,1")
11013 (set_attr "prefix" "orig,vex,evex")
11014 (set_attr "mode" "TI")])
11016 (define_expand "<code><mode>3"
11017 [(set (match_operand:VI124_128 0 "register_operand")
11019 (match_operand:VI124_128 1 "vector_operand")
11020 (match_operand:VI124_128 2 "vector_operand")))]
11023 if (TARGET_SSE4_1 || <MODE>mode == V16QImode)
11024 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
11025 else if (<CODE> == UMAX && <MODE>mode == V8HImode)
11027 rtx op0 = operands[0], op2 = operands[2], op3 = op0;
11028 operands[1] = force_reg (<MODE>mode, operands[1]);
11029 if (rtx_equal_p (op3, op2))
11030 op3 = gen_reg_rtx (V8HImode);
11031 emit_insn (gen_sse2_ussubv8hi3 (op3, operands[1], op2));
11032 emit_insn (gen_addv8hi3 (op0, op3, op2));
11040 operands[1] = force_reg (<MODE>mode, operands[1]);
11041 operands[2] = force_reg (<MODE>mode, operands[2]);
11043 xops[0] = operands[0];
11045 if (<CODE> == UMAX)
11047 xops[1] = operands[1];
11048 xops[2] = operands[2];
11052 xops[1] = operands[2];
11053 xops[2] = operands[1];
11056 xops[3] = gen_rtx_GTU (VOIDmode, operands[1], operands[2]);
11057 xops[4] = operands[1];
11058 xops[5] = operands[2];
11060 ok = ix86_expand_int_vcond (xops);
11066 (define_insn "*sse4_1_<code><mode>3<mask_name>"
11067 [(set (match_operand:VI24_128 0 "register_operand" "=Yr,*x,v")
11069 (match_operand:VI24_128 1 "vector_operand" "%0,0,v")
11070 (match_operand:VI24_128 2 "vector_operand" "YrBm,*xBm,vm")))]
11072 && <mask_mode512bit_condition>
11073 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11075 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
11076 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
11077 vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11078 [(set_attr "isa" "noavx,noavx,avx")
11079 (set_attr "type" "sseiadd")
11080 (set_attr "prefix_extra" "1,1,*")
11081 (set_attr "prefix" "orig,orig,vex")
11082 (set_attr "mode" "TI")])
11084 (define_insn "*<code>v16qi3"
11085 [(set (match_operand:V16QI 0 "register_operand" "=x,x,v")
11087 (match_operand:V16QI 1 "vector_operand" "%0,x,v")
11088 (match_operand:V16QI 2 "vector_operand" "xBm,xm,vm")))]
11089 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11091 p<maxmin_int>b\t{%2, %0|%0, %2}
11092 vp<maxmin_int>b\t{%2, %1, %0|%0, %1, %2}
11093 vp<maxmin_int>b\t{%2, %1, %0|%0, %1, %2}"
11094 [(set_attr "isa" "noavx,avx,avx512bw")
11095 (set_attr "type" "sseiadd")
11096 (set_attr "prefix_data16" "1,*,*")
11097 (set_attr "prefix_extra" "*,1,1")
11098 (set_attr "prefix" "orig,vex,evex")
11099 (set_attr "mode" "TI")])
11101 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11103 ;; Parallel integral comparisons
11105 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11107 (define_expand "avx2_eq<mode>3"
11108 [(set (match_operand:VI_256 0 "register_operand")
11110 (match_operand:VI_256 1 "nonimmediate_operand")
11111 (match_operand:VI_256 2 "nonimmediate_operand")))]
11113 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
11115 (define_insn "*avx2_eq<mode>3"
11116 [(set (match_operand:VI_256 0 "register_operand" "=x")
11118 (match_operand:VI_256 1 "nonimmediate_operand" "%x")
11119 (match_operand:VI_256 2 "nonimmediate_operand" "xm")))]
11120 "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11121 "vpcmpeq<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11122 [(set_attr "type" "ssecmp")
11123 (set_attr "prefix_extra" "1")
11124 (set_attr "prefix" "vex")
11125 (set_attr "mode" "OI")])
11127 (define_expand "<avx512>_eq<mode>3<mask_scalar_merge_name>"
11128 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
11129 (unspec:<avx512fmaskmode>
11130 [(match_operand:VI12_AVX512VL 1 "register_operand")
11131 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand")]
11132 UNSPEC_MASKED_EQ))]
11134 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
11136 (define_expand "<avx512>_eq<mode>3<mask_scalar_merge_name>"
11137 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
11138 (unspec:<avx512fmaskmode>
11139 [(match_operand:VI48_AVX512VL 1 "register_operand")
11140 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand")]
11141 UNSPEC_MASKED_EQ))]
11143 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
11145 (define_insn "<avx512>_eq<mode>3<mask_scalar_merge_name>_1"
11146 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11147 (unspec:<avx512fmaskmode>
11148 [(match_operand:VI12_AVX512VL 1 "register_operand" "%v")
11149 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")]
11150 UNSPEC_MASKED_EQ))]
11151 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11152 "vpcmpeq<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11153 [(set_attr "type" "ssecmp")
11154 (set_attr "prefix_extra" "1")
11155 (set_attr "prefix" "evex")
11156 (set_attr "mode" "<sseinsnmode>")])
11158 (define_insn "<avx512>_eq<mode>3<mask_scalar_merge_name>_1"
11159 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11160 (unspec:<avx512fmaskmode>
11161 [(match_operand:VI48_AVX512VL 1 "register_operand" "%v")
11162 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")]
11163 UNSPEC_MASKED_EQ))]
11164 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11165 "vpcmpeq<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11166 [(set_attr "type" "ssecmp")
11167 (set_attr "prefix_extra" "1")
11168 (set_attr "prefix" "evex")
11169 (set_attr "mode" "<sseinsnmode>")])
11171 (define_insn "*sse4_1_eqv2di3"
11172 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,x")
11174 (match_operand:V2DI 1 "vector_operand" "%0,0,x")
11175 (match_operand:V2DI 2 "vector_operand" "YrBm,*xBm,xm")))]
11176 "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11178 pcmpeqq\t{%2, %0|%0, %2}
11179 pcmpeqq\t{%2, %0|%0, %2}
11180 vpcmpeqq\t{%2, %1, %0|%0, %1, %2}"
11181 [(set_attr "isa" "noavx,noavx,avx")
11182 (set_attr "type" "ssecmp")
11183 (set_attr "prefix_extra" "1")
11184 (set_attr "prefix" "orig,orig,vex")
11185 (set_attr "mode" "TI")])
11187 (define_insn "*sse2_eq<mode>3"
11188 [(set (match_operand:VI124_128 0 "register_operand" "=x,x")
11190 (match_operand:VI124_128 1 "vector_operand" "%0,x")
11191 (match_operand:VI124_128 2 "vector_operand" "xBm,xm")))]
11192 "TARGET_SSE2 && !TARGET_XOP
11193 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11195 pcmpeq<ssemodesuffix>\t{%2, %0|%0, %2}
11196 vpcmpeq<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11197 [(set_attr "isa" "noavx,avx")
11198 (set_attr "type" "ssecmp")
11199 (set_attr "prefix_data16" "1,*")
11200 (set_attr "prefix" "orig,vex")
11201 (set_attr "mode" "TI")])
11203 (define_expand "sse2_eq<mode>3"
11204 [(set (match_operand:VI124_128 0 "register_operand")
11206 (match_operand:VI124_128 1 "vector_operand")
11207 (match_operand:VI124_128 2 "vector_operand")))]
11208 "TARGET_SSE2 && !TARGET_XOP "
11209 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
11211 (define_expand "sse4_1_eqv2di3"
11212 [(set (match_operand:V2DI 0 "register_operand")
11214 (match_operand:V2DI 1 "vector_operand")
11215 (match_operand:V2DI 2 "vector_operand")))]
11217 "ix86_fixup_binary_operands_no_copy (EQ, V2DImode, operands);")
11219 (define_insn "sse4_2_gtv2di3"
11220 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,x")
11222 (match_operand:V2DI 1 "register_operand" "0,0,x")
11223 (match_operand:V2DI 2 "vector_operand" "YrBm,*xBm,xm")))]
11226 pcmpgtq\t{%2, %0|%0, %2}
11227 pcmpgtq\t{%2, %0|%0, %2}
11228 vpcmpgtq\t{%2, %1, %0|%0, %1, %2}"
11229 [(set_attr "isa" "noavx,noavx,avx")
11230 (set_attr "type" "ssecmp")
11231 (set_attr "prefix_extra" "1")
11232 (set_attr "prefix" "orig,orig,vex")
11233 (set_attr "mode" "TI")])
11235 (define_insn "avx2_gt<mode>3"
11236 [(set (match_operand:VI_256 0 "register_operand" "=x")
11238 (match_operand:VI_256 1 "register_operand" "x")
11239 (match_operand:VI_256 2 "nonimmediate_operand" "xm")))]
11241 "vpcmpgt<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11242 [(set_attr "type" "ssecmp")
11243 (set_attr "prefix_extra" "1")
11244 (set_attr "prefix" "vex")
11245 (set_attr "mode" "OI")])
11247 (define_insn "<avx512>_gt<mode>3<mask_scalar_merge_name>"
11248 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11249 (unspec:<avx512fmaskmode>
11250 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
11251 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")] UNSPEC_MASKED_GT))]
11253 "vpcmpgt<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11254 [(set_attr "type" "ssecmp")
11255 (set_attr "prefix_extra" "1")
11256 (set_attr "prefix" "evex")
11257 (set_attr "mode" "<sseinsnmode>")])
11259 (define_insn "<avx512>_gt<mode>3<mask_scalar_merge_name>"
11260 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11261 (unspec:<avx512fmaskmode>
11262 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
11263 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")] UNSPEC_MASKED_GT))]
11265 "vpcmpgt<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11266 [(set_attr "type" "ssecmp")
11267 (set_attr "prefix_extra" "1")
11268 (set_attr "prefix" "evex")
11269 (set_attr "mode" "<sseinsnmode>")])
11271 (define_insn "sse2_gt<mode>3"
11272 [(set (match_operand:VI124_128 0 "register_operand" "=x,x")
11274 (match_operand:VI124_128 1 "register_operand" "0,x")
11275 (match_operand:VI124_128 2 "vector_operand" "xBm,xm")))]
11276 "TARGET_SSE2 && !TARGET_XOP"
11278 pcmpgt<ssemodesuffix>\t{%2, %0|%0, %2}
11279 vpcmpgt<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11280 [(set_attr "isa" "noavx,avx")
11281 (set_attr "type" "ssecmp")
11282 (set_attr "prefix_data16" "1,*")
11283 (set_attr "prefix" "orig,vex")
11284 (set_attr "mode" "TI")])
11286 (define_expand "vcond<V_512:mode><VI_AVX512BW:mode>"
11287 [(set (match_operand:V_512 0 "register_operand")
11288 (if_then_else:V_512
11289 (match_operator 3 ""
11290 [(match_operand:VI_AVX512BW 4 "nonimmediate_operand")
11291 (match_operand:VI_AVX512BW 5 "general_operand")])
11292 (match_operand:V_512 1)
11293 (match_operand:V_512 2)))]
11295 && (GET_MODE_NUNITS (<V_512:MODE>mode)
11296 == GET_MODE_NUNITS (<VI_AVX512BW:MODE>mode))"
11298 bool ok = ix86_expand_int_vcond (operands);
11303 (define_expand "vcond<V_256:mode><VI_256:mode>"
11304 [(set (match_operand:V_256 0 "register_operand")
11305 (if_then_else:V_256
11306 (match_operator 3 ""
11307 [(match_operand:VI_256 4 "nonimmediate_operand")
11308 (match_operand:VI_256 5 "general_operand")])
11309 (match_operand:V_256 1)
11310 (match_operand:V_256 2)))]
11312 && (GET_MODE_NUNITS (<V_256:MODE>mode)
11313 == GET_MODE_NUNITS (<VI_256:MODE>mode))"
11315 bool ok = ix86_expand_int_vcond (operands);
11320 (define_expand "vcond<V_128:mode><VI124_128:mode>"
11321 [(set (match_operand:V_128 0 "register_operand")
11322 (if_then_else:V_128
11323 (match_operator 3 ""
11324 [(match_operand:VI124_128 4 "vector_operand")
11325 (match_operand:VI124_128 5 "general_operand")])
11326 (match_operand:V_128 1)
11327 (match_operand:V_128 2)))]
11329 && (GET_MODE_NUNITS (<V_128:MODE>mode)
11330 == GET_MODE_NUNITS (<VI124_128:MODE>mode))"
11332 bool ok = ix86_expand_int_vcond (operands);
11337 (define_expand "vcond<VI8F_128:mode>v2di"
11338 [(set (match_operand:VI8F_128 0 "register_operand")
11339 (if_then_else:VI8F_128
11340 (match_operator 3 ""
11341 [(match_operand:V2DI 4 "vector_operand")
11342 (match_operand:V2DI 5 "general_operand")])
11343 (match_operand:VI8F_128 1)
11344 (match_operand:VI8F_128 2)))]
11347 bool ok = ix86_expand_int_vcond (operands);
11352 (define_expand "vcondu<V_512:mode><VI_AVX512BW:mode>"
11353 [(set (match_operand:V_512 0 "register_operand")
11354 (if_then_else:V_512
11355 (match_operator 3 ""
11356 [(match_operand:VI_AVX512BW 4 "nonimmediate_operand")
11357 (match_operand:VI_AVX512BW 5 "nonimmediate_operand")])
11358 (match_operand:V_512 1 "general_operand")
11359 (match_operand:V_512 2 "general_operand")))]
11361 && (GET_MODE_NUNITS (<V_512:MODE>mode)
11362 == GET_MODE_NUNITS (<VI_AVX512BW:MODE>mode))"
11364 bool ok = ix86_expand_int_vcond (operands);
11369 (define_expand "vcondu<V_256:mode><VI_256:mode>"
11370 [(set (match_operand:V_256 0 "register_operand")
11371 (if_then_else:V_256
11372 (match_operator 3 ""
11373 [(match_operand:VI_256 4 "nonimmediate_operand")
11374 (match_operand:VI_256 5 "nonimmediate_operand")])
11375 (match_operand:V_256 1 "general_operand")
11376 (match_operand:V_256 2 "general_operand")))]
11378 && (GET_MODE_NUNITS (<V_256:MODE>mode)
11379 == GET_MODE_NUNITS (<VI_256:MODE>mode))"
11381 bool ok = ix86_expand_int_vcond (operands);
11386 (define_expand "vcondu<V_128:mode><VI124_128:mode>"
11387 [(set (match_operand:V_128 0 "register_operand")
11388 (if_then_else:V_128
11389 (match_operator 3 ""
11390 [(match_operand:VI124_128 4 "vector_operand")
11391 (match_operand:VI124_128 5 "vector_operand")])
11392 (match_operand:V_128 1 "general_operand")
11393 (match_operand:V_128 2 "general_operand")))]
11395 && (GET_MODE_NUNITS (<V_128:MODE>mode)
11396 == GET_MODE_NUNITS (<VI124_128:MODE>mode))"
11398 bool ok = ix86_expand_int_vcond (operands);
11403 (define_expand "vcondu<VI8F_128:mode>v2di"
11404 [(set (match_operand:VI8F_128 0 "register_operand")
11405 (if_then_else:VI8F_128
11406 (match_operator 3 ""
11407 [(match_operand:V2DI 4 "vector_operand")
11408 (match_operand:V2DI 5 "vector_operand")])
11409 (match_operand:VI8F_128 1 "general_operand")
11410 (match_operand:VI8F_128 2 "general_operand")))]
11413 bool ok = ix86_expand_int_vcond (operands);
11418 (define_expand "vcondeq<VI8F_128:mode>v2di"
11419 [(set (match_operand:VI8F_128 0 "register_operand")
11420 (if_then_else:VI8F_128
11421 (match_operator 3 ""
11422 [(match_operand:V2DI 4 "vector_operand")
11423 (match_operand:V2DI 5 "general_operand")])
11424 (match_operand:VI8F_128 1)
11425 (match_operand:VI8F_128 2)))]
11428 bool ok = ix86_expand_int_vcond (operands);
11433 (define_mode_iterator VEC_PERM_AVX2
11434 [V16QI V8HI V4SI V2DI V4SF V2DF
11435 (V32QI "TARGET_AVX2") (V16HI "TARGET_AVX2")
11436 (V8SI "TARGET_AVX2") (V4DI "TARGET_AVX2")
11437 (V8SF "TARGET_AVX2") (V4DF "TARGET_AVX2")
11438 (V16SF "TARGET_AVX512F") (V8DF "TARGET_AVX512F")
11439 (V16SI "TARGET_AVX512F") (V8DI "TARGET_AVX512F")
11440 (V32HI "TARGET_AVX512BW") (V64QI "TARGET_AVX512VBMI")])
11442 (define_expand "vec_perm<mode>"
11443 [(match_operand:VEC_PERM_AVX2 0 "register_operand")
11444 (match_operand:VEC_PERM_AVX2 1 "register_operand")
11445 (match_operand:VEC_PERM_AVX2 2 "register_operand")
11446 (match_operand:<sseintvecmode> 3 "register_operand")]
11447 "TARGET_SSSE3 || TARGET_AVX || TARGET_XOP"
11449 ix86_expand_vec_perm (operands);
11453 (define_mode_iterator VEC_PERM_CONST
11454 [(V4SF "TARGET_SSE") (V4SI "TARGET_SSE")
11455 (V2DF "TARGET_SSE") (V2DI "TARGET_SSE")
11456 (V16QI "TARGET_SSE2") (V8HI "TARGET_SSE2")
11457 (V8SF "TARGET_AVX") (V4DF "TARGET_AVX")
11458 (V8SI "TARGET_AVX") (V4DI "TARGET_AVX")
11459 (V32QI "TARGET_AVX2") (V16HI "TARGET_AVX2")
11460 (V16SI "TARGET_AVX512F") (V8DI "TARGET_AVX512F")
11461 (V16SF "TARGET_AVX512F") (V8DF "TARGET_AVX512F")
11462 (V32HI "TARGET_AVX512BW") (V64QI "TARGET_AVX512BW")])
11464 (define_expand "vec_perm_const<mode>"
11465 [(match_operand:VEC_PERM_CONST 0 "register_operand")
11466 (match_operand:VEC_PERM_CONST 1 "register_operand")
11467 (match_operand:VEC_PERM_CONST 2 "register_operand")
11468 (match_operand:<sseintvecmode> 3)]
11471 if (ix86_expand_vec_perm_const (operands))
11477 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11479 ;; Parallel bitwise logical operations
11481 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11483 (define_expand "one_cmpl<mode>2"
11484 [(set (match_operand:VI 0 "register_operand")
11485 (xor:VI (match_operand:VI 1 "vector_operand")
11489 operands[2] = force_reg (<MODE>mode, CONSTM1_RTX (<MODE>mode));
11492 (define_expand "<sse2_avx2>_andnot<mode>3"
11493 [(set (match_operand:VI_AVX2 0 "register_operand")
11495 (not:VI_AVX2 (match_operand:VI_AVX2 1 "register_operand"))
11496 (match_operand:VI_AVX2 2 "vector_operand")))]
11499 (define_expand "<sse2_avx2>_andnot<mode>3_mask"
11500 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
11501 (vec_merge:VI48_AVX512VL
11504 (match_operand:VI48_AVX512VL 1 "register_operand"))
11505 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand"))
11506 (match_operand:VI48_AVX512VL 3 "vector_move_operand")
11507 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
11510 (define_expand "<sse2_avx2>_andnot<mode>3_mask"
11511 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
11512 (vec_merge:VI12_AVX512VL
11515 (match_operand:VI12_AVX512VL 1 "register_operand"))
11516 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand"))
11517 (match_operand:VI12_AVX512VL 3 "vector_move_operand")
11518 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
11521 (define_insn "*andnot<mode>3"
11522 [(set (match_operand:VI 0 "register_operand" "=x,x,v")
11524 (not:VI (match_operand:VI 1 "register_operand" "0,x,v"))
11525 (match_operand:VI 2 "vector_operand" "xBm,xm,vm")))]
11528 static char buf[64];
11531 const char *ssesuffix;
11533 switch (get_attr_mode (insn))
11536 gcc_assert (TARGET_AVX512F);
11539 gcc_assert (TARGET_AVX2);
11542 gcc_assert (TARGET_SSE2);
11544 switch (<MODE>mode)
11548 /* There is no vpandnb or vpandnw instruction, nor vpandn for
11549 512-bit vectors. Use vpandnq instead. */
11554 ssesuffix = "<ssemodesuffix>";
11560 ssesuffix = (TARGET_AVX512VL && which_alternative == 2
11561 ? "<ssemodesuffix>" : "");
11564 ssesuffix = TARGET_AVX512VL && which_alternative == 2 ? "q" : "";
11569 gcc_assert (TARGET_AVX512F);
11572 gcc_assert (TARGET_AVX);
11575 gcc_assert (TARGET_SSE);
11581 gcc_unreachable ();
11584 switch (which_alternative)
11587 ops = "%s%s\t{%%2, %%0|%%0, %%2}";
11591 ops = "v%s%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
11594 gcc_unreachable ();
11597 snprintf (buf, sizeof (buf), ops, tmp, ssesuffix);
11600 [(set_attr "isa" "noavx,avx,avx")
11601 (set_attr "type" "sselog")
11602 (set (attr "prefix_data16")
11604 (and (eq_attr "alternative" "0")
11605 (eq_attr "mode" "TI"))
11607 (const_string "*")))
11608 (set_attr "prefix" "orig,vex,evex")
11610 (cond [(and (match_test "<MODE_SIZE> == 16")
11611 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
11612 (const_string "<ssePSmode>")
11613 (match_test "TARGET_AVX2")
11614 (const_string "<sseinsnmode>")
11615 (match_test "TARGET_AVX")
11617 (match_test "<MODE_SIZE> > 16")
11618 (const_string "V8SF")
11619 (const_string "<sseinsnmode>"))
11620 (ior (not (match_test "TARGET_SSE2"))
11621 (match_test "optimize_function_for_size_p (cfun)"))
11622 (const_string "V4SF")
11624 (const_string "<sseinsnmode>")))])
11626 (define_insn "*andnot<mode>3_mask"
11627 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
11628 (vec_merge:VI48_AVX512VL
11631 (match_operand:VI48_AVX512VL 1 "register_operand" "v"))
11632 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm"))
11633 (match_operand:VI48_AVX512VL 3 "vector_move_operand" "0C")
11634 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
11636 "vpandn<ssemodesuffix>\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}";
11637 [(set_attr "type" "sselog")
11638 (set_attr "prefix" "evex")
11639 (set_attr "mode" "<sseinsnmode>")])
11641 (define_expand "<code><mode>3"
11642 [(set (match_operand:VI 0 "register_operand")
11644 (match_operand:VI 1 "nonimmediate_or_const_vector_operand")
11645 (match_operand:VI 2 "nonimmediate_or_const_vector_operand")))]
11648 ix86_expand_vector_logical_operator (<CODE>, <MODE>mode, operands);
11652 (define_insn "<mask_codefor><code><mode>3<mask_name>"
11653 [(set (match_operand:VI48_AVX_AVX512F 0 "register_operand" "=x,x,v")
11654 (any_logic:VI48_AVX_AVX512F
11655 (match_operand:VI48_AVX_AVX512F 1 "vector_operand" "%0,x,v")
11656 (match_operand:VI48_AVX_AVX512F 2 "vector_operand" "xBm,xm,vm")))]
11657 "TARGET_SSE && <mask_mode512bit_condition>
11658 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11660 static char buf[64];
11663 const char *ssesuffix;
11665 switch (get_attr_mode (insn))
11668 gcc_assert (TARGET_AVX512F);
11671 gcc_assert (TARGET_AVX2);
11674 gcc_assert (TARGET_SSE2);
11676 switch (<MODE>mode)
11680 ssesuffix = "<ssemodesuffix>";
11686 ssesuffix = (TARGET_AVX512VL
11687 && (<mask_applied> || which_alternative == 2)
11688 ? "<ssemodesuffix>" : "");
11691 gcc_unreachable ();
11696 gcc_assert (TARGET_AVX);
11699 gcc_assert (TARGET_SSE);
11705 gcc_unreachable ();
11708 switch (which_alternative)
11711 if (<mask_applied>)
11712 ops = "v%s%s\t{%%2, %%0, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%0, %%2}";
11714 ops = "%s%s\t{%%2, %%0|%%0, %%2}";
11718 ops = "v%s%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
11721 gcc_unreachable ();
11724 snprintf (buf, sizeof (buf), ops, tmp, ssesuffix);
11727 [(set_attr "isa" "noavx,avx,avx")
11728 (set_attr "type" "sselog")
11729 (set (attr "prefix_data16")
11731 (and (eq_attr "alternative" "0")
11732 (eq_attr "mode" "TI"))
11734 (const_string "*")))
11735 (set_attr "prefix" "<mask_prefix3>,evex")
11737 (cond [(and (match_test "<MODE_SIZE> == 16")
11738 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
11739 (const_string "<ssePSmode>")
11740 (match_test "TARGET_AVX2")
11741 (const_string "<sseinsnmode>")
11742 (match_test "TARGET_AVX")
11744 (match_test "<MODE_SIZE> > 16")
11745 (const_string "V8SF")
11746 (const_string "<sseinsnmode>"))
11747 (ior (not (match_test "TARGET_SSE2"))
11748 (match_test "optimize_function_for_size_p (cfun)"))
11749 (const_string "V4SF")
11751 (const_string "<sseinsnmode>")))])
11753 (define_insn "*<code><mode>3"
11754 [(set (match_operand:VI12_AVX_AVX512F 0 "register_operand" "=x,x,v")
11755 (any_logic:VI12_AVX_AVX512F
11756 (match_operand:VI12_AVX_AVX512F 1 "vector_operand" "%0,x,v")
11757 (match_operand:VI12_AVX_AVX512F 2 "vector_operand" "xBm,xm,vm")))]
11758 "TARGET_SSE && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11760 static char buf[64];
11763 const char *ssesuffix;
11765 switch (get_attr_mode (insn))
11768 gcc_assert (TARGET_AVX512F);
11771 gcc_assert (TARGET_AVX2);
11774 gcc_assert (TARGET_SSE2);
11776 switch (<MODE>mode)
11786 ssesuffix = TARGET_AVX512VL && which_alternative == 2 ? "q" : "";
11789 gcc_unreachable ();
11794 gcc_assert (TARGET_AVX);
11797 gcc_assert (TARGET_SSE);
11803 gcc_unreachable ();
11806 switch (which_alternative)
11809 ops = "%s%s\t{%%2, %%0|%%0, %%2}";
11813 ops = "v%s%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
11816 gcc_unreachable ();
11819 snprintf (buf, sizeof (buf), ops, tmp, ssesuffix);
11822 [(set_attr "isa" "noavx,avx,avx")
11823 (set_attr "type" "sselog")
11824 (set (attr "prefix_data16")
11826 (and (eq_attr "alternative" "0")
11827 (eq_attr "mode" "TI"))
11829 (const_string "*")))
11830 (set_attr "prefix" "<mask_prefix3>,evex")
11832 (cond [(and (match_test "<MODE_SIZE> == 16")
11833 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
11834 (const_string "<ssePSmode>")
11835 (match_test "TARGET_AVX2")
11836 (const_string "<sseinsnmode>")
11837 (match_test "TARGET_AVX")
11839 (match_test "<MODE_SIZE> > 16")
11840 (const_string "V8SF")
11841 (const_string "<sseinsnmode>"))
11842 (ior (not (match_test "TARGET_SSE2"))
11843 (match_test "optimize_function_for_size_p (cfun)"))
11844 (const_string "V4SF")
11846 (const_string "<sseinsnmode>")))])
11848 (define_insn "<avx512>_testm<mode>3<mask_scalar_merge_name>"
11849 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11850 (unspec:<avx512fmaskmode>
11851 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
11852 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")]
11855 "vptestm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11856 [(set_attr "prefix" "evex")
11857 (set_attr "mode" "<sseinsnmode>")])
11859 (define_insn "<avx512>_testm<mode>3<mask_scalar_merge_name>"
11860 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11861 (unspec:<avx512fmaskmode>
11862 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
11863 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")]
11866 "vptestm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11867 [(set_attr "prefix" "evex")
11868 (set_attr "mode" "<sseinsnmode>")])
11870 (define_insn "<avx512>_testnm<mode>3<mask_scalar_merge_name>"
11871 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11872 (unspec:<avx512fmaskmode>
11873 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
11874 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")]
11877 "vptestnm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11878 [(set_attr "prefix" "evex")
11879 (set_attr "mode" "<sseinsnmode>")])
11881 (define_insn "<avx512>_testnm<mode>3<mask_scalar_merge_name>"
11882 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11883 (unspec:<avx512fmaskmode>
11884 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
11885 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")]
11888 "vptestnm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11889 [(set_attr "prefix" "evex")
11890 (set_attr "mode" "<sseinsnmode>")])
11892 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11894 ;; Parallel integral element swizzling
11896 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11898 (define_expand "vec_pack_trunc_<mode>"
11899 [(match_operand:<ssepackmode> 0 "register_operand")
11900 (match_operand:VI248_AVX2_8_AVX512F_24_AVX512BW 1 "register_operand")
11901 (match_operand:VI248_AVX2_8_AVX512F_24_AVX512BW 2 "register_operand")]
11904 rtx op1 = gen_lowpart (<ssepackmode>mode, operands[1]);
11905 rtx op2 = gen_lowpart (<ssepackmode>mode, operands[2]);
11906 ix86_expand_vec_extract_even_odd (operands[0], op1, op2, 0);
11910 (define_expand "vec_pack_trunc_qi"
11911 [(set (match_operand:HI 0 ("register_operand"))
11912 (ior:HI (ashift:HI (zero_extend:HI (match_operand:QI 2 ("register_operand")))
11914 (zero_extend:HI (match_operand:QI 1 ("register_operand")))))]
11917 (define_expand "vec_pack_trunc_<mode>"
11918 [(set (match_operand:<DOUBLEMASKMODE> 0 ("register_operand"))
11919 (ior:<DOUBLEMASKMODE> (ashift:<DOUBLEMASKMODE> (zero_extend:<DOUBLEMASKMODE> (match_operand:SWI24 2 ("register_operand")))
11921 (zero_extend:<DOUBLEMASKMODE> (match_operand:SWI24 1 ("register_operand")))))]
11924 operands[3] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
11927 (define_insn "<sse2_avx2>_packsswb<mask_name>"
11928 [(set (match_operand:VI1_AVX512 0 "register_operand" "=x,x,v")
11929 (vec_concat:VI1_AVX512
11930 (ss_truncate:<ssehalfvecmode>
11931 (match_operand:<sseunpackmode> 1 "register_operand" "0,x,v"))
11932 (ss_truncate:<ssehalfvecmode>
11933 (match_operand:<sseunpackmode> 2 "vector_operand" "xBm,xm,vm"))))]
11934 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
11936 packsswb\t{%2, %0|%0, %2}
11937 vpacksswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
11938 vpacksswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11939 [(set_attr "isa" "noavx,avx,avx512bw")
11940 (set_attr "type" "sselog")
11941 (set_attr "prefix_data16" "1,*,*")
11942 (set_attr "prefix" "orig,<mask_prefix>,evex")
11943 (set_attr "mode" "<sseinsnmode>")])
11945 (define_insn "<sse2_avx2>_packssdw<mask_name>"
11946 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,x,v")
11947 (vec_concat:VI2_AVX2
11948 (ss_truncate:<ssehalfvecmode>
11949 (match_operand:<sseunpackmode> 1 "register_operand" "0,x,v"))
11950 (ss_truncate:<ssehalfvecmode>
11951 (match_operand:<sseunpackmode> 2 "vector_operand" "xBm,xm,vm"))))]
11952 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
11954 packssdw\t{%2, %0|%0, %2}
11955 vpackssdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
11956 vpackssdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11957 [(set_attr "isa" "noavx,avx,avx512bw")
11958 (set_attr "type" "sselog")
11959 (set_attr "prefix_data16" "1,*,*")
11960 (set_attr "prefix" "orig,<mask_prefix>,evex")
11961 (set_attr "mode" "<sseinsnmode>")])
11963 (define_insn "<sse2_avx2>_packuswb<mask_name>"
11964 [(set (match_operand:VI1_AVX512 0 "register_operand" "=x,x,v")
11965 (vec_concat:VI1_AVX512
11966 (us_truncate:<ssehalfvecmode>
11967 (match_operand:<sseunpackmode> 1 "register_operand" "0,x,v"))
11968 (us_truncate:<ssehalfvecmode>
11969 (match_operand:<sseunpackmode> 2 "vector_operand" "xBm,xm,vm"))))]
11970 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
11972 packuswb\t{%2, %0|%0, %2}
11973 vpackuswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
11974 vpackuswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11975 [(set_attr "isa" "noavx,avx,avx512bw")
11976 (set_attr "type" "sselog")
11977 (set_attr "prefix_data16" "1,*,*")
11978 (set_attr "prefix" "orig,<mask_prefix>,evex")
11979 (set_attr "mode" "<sseinsnmode>")])
11981 (define_insn "avx512bw_interleave_highv64qi<mask_name>"
11982 [(set (match_operand:V64QI 0 "register_operand" "=v")
11985 (match_operand:V64QI 1 "register_operand" "v")
11986 (match_operand:V64QI 2 "nonimmediate_operand" "vm"))
11987 (parallel [(const_int 8) (const_int 72)
11988 (const_int 9) (const_int 73)
11989 (const_int 10) (const_int 74)
11990 (const_int 11) (const_int 75)
11991 (const_int 12) (const_int 76)
11992 (const_int 13) (const_int 77)
11993 (const_int 14) (const_int 78)
11994 (const_int 15) (const_int 79)
11995 (const_int 24) (const_int 88)
11996 (const_int 25) (const_int 89)
11997 (const_int 26) (const_int 90)
11998 (const_int 27) (const_int 91)
11999 (const_int 28) (const_int 92)
12000 (const_int 29) (const_int 93)
12001 (const_int 30) (const_int 94)
12002 (const_int 31) (const_int 95)
12003 (const_int 40) (const_int 104)
12004 (const_int 41) (const_int 105)
12005 (const_int 42) (const_int 106)
12006 (const_int 43) (const_int 107)
12007 (const_int 44) (const_int 108)
12008 (const_int 45) (const_int 109)
12009 (const_int 46) (const_int 110)
12010 (const_int 47) (const_int 111)
12011 (const_int 56) (const_int 120)
12012 (const_int 57) (const_int 121)
12013 (const_int 58) (const_int 122)
12014 (const_int 59) (const_int 123)
12015 (const_int 60) (const_int 124)
12016 (const_int 61) (const_int 125)
12017 (const_int 62) (const_int 126)
12018 (const_int 63) (const_int 127)])))]
12020 "vpunpckhbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12021 [(set_attr "type" "sselog")
12022 (set_attr "prefix" "evex")
12023 (set_attr "mode" "XI")])
12025 (define_insn "avx2_interleave_highv32qi<mask_name>"
12026 [(set (match_operand:V32QI 0 "register_operand" "=v")
12029 (match_operand:V32QI 1 "register_operand" "v")
12030 (match_operand:V32QI 2 "nonimmediate_operand" "vm"))
12031 (parallel [(const_int 8) (const_int 40)
12032 (const_int 9) (const_int 41)
12033 (const_int 10) (const_int 42)
12034 (const_int 11) (const_int 43)
12035 (const_int 12) (const_int 44)
12036 (const_int 13) (const_int 45)
12037 (const_int 14) (const_int 46)
12038 (const_int 15) (const_int 47)
12039 (const_int 24) (const_int 56)
12040 (const_int 25) (const_int 57)
12041 (const_int 26) (const_int 58)
12042 (const_int 27) (const_int 59)
12043 (const_int 28) (const_int 60)
12044 (const_int 29) (const_int 61)
12045 (const_int 30) (const_int 62)
12046 (const_int 31) (const_int 63)])))]
12047 "TARGET_AVX2 && <mask_avx512vl_condition>"
12048 "vpunpckhbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12049 [(set_attr "type" "sselog")
12050 (set_attr "prefix" "<mask_prefix>")
12051 (set_attr "mode" "OI")])
12053 (define_insn "vec_interleave_highv16qi<mask_name>"
12054 [(set (match_operand:V16QI 0 "register_operand" "=x,v")
12057 (match_operand:V16QI 1 "register_operand" "0,v")
12058 (match_operand:V16QI 2 "vector_operand" "xBm,vm"))
12059 (parallel [(const_int 8) (const_int 24)
12060 (const_int 9) (const_int 25)
12061 (const_int 10) (const_int 26)
12062 (const_int 11) (const_int 27)
12063 (const_int 12) (const_int 28)
12064 (const_int 13) (const_int 29)
12065 (const_int 14) (const_int 30)
12066 (const_int 15) (const_int 31)])))]
12067 "TARGET_SSE2 && <mask_avx512vl_condition>"
12069 punpckhbw\t{%2, %0|%0, %2}
12070 vpunpckhbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12071 [(set_attr "isa" "noavx,avx")
12072 (set_attr "type" "sselog")
12073 (set_attr "prefix_data16" "1,*")
12074 (set_attr "prefix" "orig,<mask_prefix>")
12075 (set_attr "mode" "TI")])
12077 (define_insn "avx512bw_interleave_lowv64qi<mask_name>"
12078 [(set (match_operand:V64QI 0 "register_operand" "=v")
12081 (match_operand:V64QI 1 "register_operand" "v")
12082 (match_operand:V64QI 2 "nonimmediate_operand" "vm"))
12083 (parallel [(const_int 0) (const_int 64)
12084 (const_int 1) (const_int 65)
12085 (const_int 2) (const_int 66)
12086 (const_int 3) (const_int 67)
12087 (const_int 4) (const_int 68)
12088 (const_int 5) (const_int 69)
12089 (const_int 6) (const_int 70)
12090 (const_int 7) (const_int 71)
12091 (const_int 16) (const_int 80)
12092 (const_int 17) (const_int 81)
12093 (const_int 18) (const_int 82)
12094 (const_int 19) (const_int 83)
12095 (const_int 20) (const_int 84)
12096 (const_int 21) (const_int 85)
12097 (const_int 22) (const_int 86)
12098 (const_int 23) (const_int 87)
12099 (const_int 32) (const_int 96)
12100 (const_int 33) (const_int 97)
12101 (const_int 34) (const_int 98)
12102 (const_int 35) (const_int 99)
12103 (const_int 36) (const_int 100)
12104 (const_int 37) (const_int 101)
12105 (const_int 38) (const_int 102)
12106 (const_int 39) (const_int 103)
12107 (const_int 48) (const_int 112)
12108 (const_int 49) (const_int 113)
12109 (const_int 50) (const_int 114)
12110 (const_int 51) (const_int 115)
12111 (const_int 52) (const_int 116)
12112 (const_int 53) (const_int 117)
12113 (const_int 54) (const_int 118)
12114 (const_int 55) (const_int 119)])))]
12116 "vpunpcklbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12117 [(set_attr "type" "sselog")
12118 (set_attr "prefix" "evex")
12119 (set_attr "mode" "XI")])
12121 (define_insn "avx2_interleave_lowv32qi<mask_name>"
12122 [(set (match_operand:V32QI 0 "register_operand" "=v")
12125 (match_operand:V32QI 1 "register_operand" "v")
12126 (match_operand:V32QI 2 "nonimmediate_operand" "vm"))
12127 (parallel [(const_int 0) (const_int 32)
12128 (const_int 1) (const_int 33)
12129 (const_int 2) (const_int 34)
12130 (const_int 3) (const_int 35)
12131 (const_int 4) (const_int 36)
12132 (const_int 5) (const_int 37)
12133 (const_int 6) (const_int 38)
12134 (const_int 7) (const_int 39)
12135 (const_int 16) (const_int 48)
12136 (const_int 17) (const_int 49)
12137 (const_int 18) (const_int 50)
12138 (const_int 19) (const_int 51)
12139 (const_int 20) (const_int 52)
12140 (const_int 21) (const_int 53)
12141 (const_int 22) (const_int 54)
12142 (const_int 23) (const_int 55)])))]
12143 "TARGET_AVX2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12144 "vpunpcklbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12145 [(set_attr "type" "sselog")
12146 (set_attr "prefix" "maybe_vex")
12147 (set_attr "mode" "OI")])
12149 (define_insn "vec_interleave_lowv16qi<mask_name>"
12150 [(set (match_operand:V16QI 0 "register_operand" "=x,v")
12153 (match_operand:V16QI 1 "register_operand" "0,v")
12154 (match_operand:V16QI 2 "vector_operand" "xBm,vm"))
12155 (parallel [(const_int 0) (const_int 16)
12156 (const_int 1) (const_int 17)
12157 (const_int 2) (const_int 18)
12158 (const_int 3) (const_int 19)
12159 (const_int 4) (const_int 20)
12160 (const_int 5) (const_int 21)
12161 (const_int 6) (const_int 22)
12162 (const_int 7) (const_int 23)])))]
12163 "TARGET_SSE2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12165 punpcklbw\t{%2, %0|%0, %2}
12166 vpunpcklbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12167 [(set_attr "isa" "noavx,avx")
12168 (set_attr "type" "sselog")
12169 (set_attr "prefix_data16" "1,*")
12170 (set_attr "prefix" "orig,vex")
12171 (set_attr "mode" "TI")])
12173 (define_insn "avx512bw_interleave_highv32hi<mask_name>"
12174 [(set (match_operand:V32HI 0 "register_operand" "=v")
12177 (match_operand:V32HI 1 "register_operand" "v")
12178 (match_operand:V32HI 2 "nonimmediate_operand" "vm"))
12179 (parallel [(const_int 4) (const_int 36)
12180 (const_int 5) (const_int 37)
12181 (const_int 6) (const_int 38)
12182 (const_int 7) (const_int 39)
12183 (const_int 12) (const_int 44)
12184 (const_int 13) (const_int 45)
12185 (const_int 14) (const_int 46)
12186 (const_int 15) (const_int 47)
12187 (const_int 20) (const_int 52)
12188 (const_int 21) (const_int 53)
12189 (const_int 22) (const_int 54)
12190 (const_int 23) (const_int 55)
12191 (const_int 28) (const_int 60)
12192 (const_int 29) (const_int 61)
12193 (const_int 30) (const_int 62)
12194 (const_int 31) (const_int 63)])))]
12196 "vpunpckhwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12197 [(set_attr "type" "sselog")
12198 (set_attr "prefix" "evex")
12199 (set_attr "mode" "XI")])
12201 (define_insn "avx2_interleave_highv16hi<mask_name>"
12202 [(set (match_operand:V16HI 0 "register_operand" "=v")
12205 (match_operand:V16HI 1 "register_operand" "v")
12206 (match_operand:V16HI 2 "nonimmediate_operand" "vm"))
12207 (parallel [(const_int 4) (const_int 20)
12208 (const_int 5) (const_int 21)
12209 (const_int 6) (const_int 22)
12210 (const_int 7) (const_int 23)
12211 (const_int 12) (const_int 28)
12212 (const_int 13) (const_int 29)
12213 (const_int 14) (const_int 30)
12214 (const_int 15) (const_int 31)])))]
12215 "TARGET_AVX2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12216 "vpunpckhwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12217 [(set_attr "type" "sselog")
12218 (set_attr "prefix" "maybe_evex")
12219 (set_attr "mode" "OI")])
12221 (define_insn "vec_interleave_highv8hi<mask_name>"
12222 [(set (match_operand:V8HI 0 "register_operand" "=x,v")
12225 (match_operand:V8HI 1 "register_operand" "0,v")
12226 (match_operand:V8HI 2 "vector_operand" "xBm,vm"))
12227 (parallel [(const_int 4) (const_int 12)
12228 (const_int 5) (const_int 13)
12229 (const_int 6) (const_int 14)
12230 (const_int 7) (const_int 15)])))]
12231 "TARGET_SSE2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12233 punpckhwd\t{%2, %0|%0, %2}
12234 vpunpckhwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12235 [(set_attr "isa" "noavx,avx")
12236 (set_attr "type" "sselog")
12237 (set_attr "prefix_data16" "1,*")
12238 (set_attr "prefix" "orig,maybe_vex")
12239 (set_attr "mode" "TI")])
12241 (define_insn "<mask_codefor>avx512bw_interleave_lowv32hi<mask_name>"
12242 [(set (match_operand:V32HI 0 "register_operand" "=v")
12245 (match_operand:V32HI 1 "register_operand" "v")
12246 (match_operand:V32HI 2 "nonimmediate_operand" "vm"))
12247 (parallel [(const_int 0) (const_int 32)
12248 (const_int 1) (const_int 33)
12249 (const_int 2) (const_int 34)
12250 (const_int 3) (const_int 35)
12251 (const_int 8) (const_int 40)
12252 (const_int 9) (const_int 41)
12253 (const_int 10) (const_int 42)
12254 (const_int 11) (const_int 43)
12255 (const_int 16) (const_int 48)
12256 (const_int 17) (const_int 49)
12257 (const_int 18) (const_int 50)
12258 (const_int 19) (const_int 51)
12259 (const_int 24) (const_int 56)
12260 (const_int 25) (const_int 57)
12261 (const_int 26) (const_int 58)
12262 (const_int 27) (const_int 59)])))]
12264 "vpunpcklwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12265 [(set_attr "type" "sselog")
12266 (set_attr "prefix" "evex")
12267 (set_attr "mode" "XI")])
12269 (define_insn "avx2_interleave_lowv16hi<mask_name>"
12270 [(set (match_operand:V16HI 0 "register_operand" "=v")
12273 (match_operand:V16HI 1 "register_operand" "v")
12274 (match_operand:V16HI 2 "nonimmediate_operand" "vm"))
12275 (parallel [(const_int 0) (const_int 16)
12276 (const_int 1) (const_int 17)
12277 (const_int 2) (const_int 18)
12278 (const_int 3) (const_int 19)
12279 (const_int 8) (const_int 24)
12280 (const_int 9) (const_int 25)
12281 (const_int 10) (const_int 26)
12282 (const_int 11) (const_int 27)])))]
12283 "TARGET_AVX2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12284 "vpunpcklwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12285 [(set_attr "type" "sselog")
12286 (set_attr "prefix" "maybe_evex")
12287 (set_attr "mode" "OI")])
12289 (define_insn "vec_interleave_lowv8hi<mask_name>"
12290 [(set (match_operand:V8HI 0 "register_operand" "=x,v")
12293 (match_operand:V8HI 1 "register_operand" "0,v")
12294 (match_operand:V8HI 2 "vector_operand" "xBm,vm"))
12295 (parallel [(const_int 0) (const_int 8)
12296 (const_int 1) (const_int 9)
12297 (const_int 2) (const_int 10)
12298 (const_int 3) (const_int 11)])))]
12299 "TARGET_SSE2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12301 punpcklwd\t{%2, %0|%0, %2}
12302 vpunpcklwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12303 [(set_attr "isa" "noavx,avx")
12304 (set_attr "type" "sselog")
12305 (set_attr "prefix_data16" "1,*")
12306 (set_attr "prefix" "orig,maybe_evex")
12307 (set_attr "mode" "TI")])
12309 (define_insn "avx2_interleave_highv8si<mask_name>"
12310 [(set (match_operand:V8SI 0 "register_operand" "=v")
12313 (match_operand:V8SI 1 "register_operand" "v")
12314 (match_operand:V8SI 2 "nonimmediate_operand" "vm"))
12315 (parallel [(const_int 2) (const_int 10)
12316 (const_int 3) (const_int 11)
12317 (const_int 6) (const_int 14)
12318 (const_int 7) (const_int 15)])))]
12319 "TARGET_AVX2 && <mask_avx512vl_condition>"
12320 "vpunpckhdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12321 [(set_attr "type" "sselog")
12322 (set_attr "prefix" "maybe_evex")
12323 (set_attr "mode" "OI")])
12325 (define_insn "<mask_codefor>avx512f_interleave_highv16si<mask_name>"
12326 [(set (match_operand:V16SI 0 "register_operand" "=v")
12329 (match_operand:V16SI 1 "register_operand" "v")
12330 (match_operand:V16SI 2 "nonimmediate_operand" "vm"))
12331 (parallel [(const_int 2) (const_int 18)
12332 (const_int 3) (const_int 19)
12333 (const_int 6) (const_int 22)
12334 (const_int 7) (const_int 23)
12335 (const_int 10) (const_int 26)
12336 (const_int 11) (const_int 27)
12337 (const_int 14) (const_int 30)
12338 (const_int 15) (const_int 31)])))]
12340 "vpunpckhdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12341 [(set_attr "type" "sselog")
12342 (set_attr "prefix" "evex")
12343 (set_attr "mode" "XI")])
12346 (define_insn "vec_interleave_highv4si<mask_name>"
12347 [(set (match_operand:V4SI 0 "register_operand" "=x,v")
12350 (match_operand:V4SI 1 "register_operand" "0,v")
12351 (match_operand:V4SI 2 "vector_operand" "xBm,vm"))
12352 (parallel [(const_int 2) (const_int 6)
12353 (const_int 3) (const_int 7)])))]
12354 "TARGET_SSE2 && <mask_avx512vl_condition>"
12356 punpckhdq\t{%2, %0|%0, %2}
12357 vpunpckhdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12358 [(set_attr "isa" "noavx,avx")
12359 (set_attr "type" "sselog")
12360 (set_attr "prefix_data16" "1,*")
12361 (set_attr "prefix" "orig,maybe_vex")
12362 (set_attr "mode" "TI")])
12364 (define_insn "avx2_interleave_lowv8si<mask_name>"
12365 [(set (match_operand:V8SI 0 "register_operand" "=v")
12368 (match_operand:V8SI 1 "register_operand" "v")
12369 (match_operand:V8SI 2 "nonimmediate_operand" "vm"))
12370 (parallel [(const_int 0) (const_int 8)
12371 (const_int 1) (const_int 9)
12372 (const_int 4) (const_int 12)
12373 (const_int 5) (const_int 13)])))]
12374 "TARGET_AVX2 && <mask_avx512vl_condition>"
12375 "vpunpckldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12376 [(set_attr "type" "sselog")
12377 (set_attr "prefix" "maybe_evex")
12378 (set_attr "mode" "OI")])
12380 (define_insn "<mask_codefor>avx512f_interleave_lowv16si<mask_name>"
12381 [(set (match_operand:V16SI 0 "register_operand" "=v")
12384 (match_operand:V16SI 1 "register_operand" "v")
12385 (match_operand:V16SI 2 "nonimmediate_operand" "vm"))
12386 (parallel [(const_int 0) (const_int 16)
12387 (const_int 1) (const_int 17)
12388 (const_int 4) (const_int 20)
12389 (const_int 5) (const_int 21)
12390 (const_int 8) (const_int 24)
12391 (const_int 9) (const_int 25)
12392 (const_int 12) (const_int 28)
12393 (const_int 13) (const_int 29)])))]
12395 "vpunpckldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12396 [(set_attr "type" "sselog")
12397 (set_attr "prefix" "evex")
12398 (set_attr "mode" "XI")])
12400 (define_insn "vec_interleave_lowv4si<mask_name>"
12401 [(set (match_operand:V4SI 0 "register_operand" "=x,v")
12404 (match_operand:V4SI 1 "register_operand" "0,v")
12405 (match_operand:V4SI 2 "vector_operand" "xBm,vm"))
12406 (parallel [(const_int 0) (const_int 4)
12407 (const_int 1) (const_int 5)])))]
12408 "TARGET_SSE2 && <mask_avx512vl_condition>"
12410 punpckldq\t{%2, %0|%0, %2}
12411 vpunpckldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12412 [(set_attr "isa" "noavx,avx")
12413 (set_attr "type" "sselog")
12414 (set_attr "prefix_data16" "1,*")
12415 (set_attr "prefix" "orig,vex")
12416 (set_attr "mode" "TI")])
12418 (define_expand "vec_interleave_high<mode>"
12419 [(match_operand:VI_256 0 "register_operand")
12420 (match_operand:VI_256 1 "register_operand")
12421 (match_operand:VI_256 2 "nonimmediate_operand")]
12424 rtx t1 = gen_reg_rtx (<MODE>mode);
12425 rtx t2 = gen_reg_rtx (<MODE>mode);
12426 rtx t3 = gen_reg_rtx (V4DImode);
12427 emit_insn (gen_avx2_interleave_low<mode> (t1, operands[1], operands[2]));
12428 emit_insn (gen_avx2_interleave_high<mode> (t2, operands[1], operands[2]));
12429 emit_insn (gen_avx2_permv2ti (t3, gen_lowpart (V4DImode, t1),
12430 gen_lowpart (V4DImode, t2),
12431 GEN_INT (1 + (3 << 4))));
12432 emit_move_insn (operands[0], gen_lowpart (<MODE>mode, t3));
12436 (define_expand "vec_interleave_low<mode>"
12437 [(match_operand:VI_256 0 "register_operand")
12438 (match_operand:VI_256 1 "register_operand")
12439 (match_operand:VI_256 2 "nonimmediate_operand")]
12442 rtx t1 = gen_reg_rtx (<MODE>mode);
12443 rtx t2 = gen_reg_rtx (<MODE>mode);
12444 rtx t3 = gen_reg_rtx (V4DImode);
12445 emit_insn (gen_avx2_interleave_low<mode> (t1, operands[1], operands[2]));
12446 emit_insn (gen_avx2_interleave_high<mode> (t2, operands[1], operands[2]));
12447 emit_insn (gen_avx2_permv2ti (t3, gen_lowpart (V4DImode, t1),
12448 gen_lowpart (V4DImode, t2),
12449 GEN_INT (0 + (2 << 4))));
12450 emit_move_insn (operands[0], gen_lowpart (<MODE>mode, t3));
12454 ;; Modes handled by pinsr patterns.
12455 (define_mode_iterator PINSR_MODE
12456 [(V16QI "TARGET_SSE4_1") V8HI
12457 (V4SI "TARGET_SSE4_1")
12458 (V2DI "TARGET_SSE4_1 && TARGET_64BIT")])
12460 (define_mode_attr sse2p4_1
12461 [(V16QI "sse4_1") (V8HI "sse2")
12462 (V4SI "sse4_1") (V2DI "sse4_1")])
12464 (define_mode_attr pinsr_evex_isa
12465 [(V16QI "avx512bw") (V8HI "avx512bw")
12466 (V4SI "avx512dq") (V2DI "avx512dq")])
12468 ;; sse4_1_pinsrd must come before sse2_loadld since it is preferred.
12469 (define_insn "<sse2p4_1>_pinsr<ssemodesuffix>"
12470 [(set (match_operand:PINSR_MODE 0 "register_operand" "=x,x,x,x,v,v")
12471 (vec_merge:PINSR_MODE
12472 (vec_duplicate:PINSR_MODE
12473 (match_operand:<ssescalarmode> 2 "nonimmediate_operand" "r,m,r,m,r,m"))
12474 (match_operand:PINSR_MODE 1 "register_operand" "0,0,x,x,v,v")
12475 (match_operand:SI 3 "const_int_operand")))]
12477 && ((unsigned) exact_log2 (INTVAL (operands[3]))
12478 < GET_MODE_NUNITS (<MODE>mode))"
12480 operands[3] = GEN_INT (exact_log2 (INTVAL (operands[3])));
12482 switch (which_alternative)
12485 if (GET_MODE_SIZE (<ssescalarmode>mode) < GET_MODE_SIZE (SImode))
12486 return "pinsr<ssemodesuffix>\t{%3, %k2, %0|%0, %k2, %3}";
12489 return "pinsr<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}";
12492 if (GET_MODE_SIZE (<ssescalarmode>mode) < GET_MODE_SIZE (SImode))
12493 return "vpinsr<ssemodesuffix>\t{%3, %k2, %1, %0|%0, %1, %k2, %3}";
12497 return "vpinsr<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}";
12499 gcc_unreachable ();
12502 [(set_attr "isa" "noavx,noavx,avx,avx,<pinsr_evex_isa>,<pinsr_evex_isa>")
12503 (set_attr "type" "sselog")
12504 (set (attr "prefix_rex")
12506 (and (not (match_test "TARGET_AVX"))
12507 (eq (const_string "<MODE>mode") (const_string "V2DImode")))
12509 (const_string "*")))
12510 (set (attr "prefix_data16")
12512 (and (not (match_test "TARGET_AVX"))
12513 (eq (const_string "<MODE>mode") (const_string "V8HImode")))
12515 (const_string "*")))
12516 (set (attr "prefix_extra")
12518 (and (not (match_test "TARGET_AVX"))
12519 (eq (const_string "<MODE>mode") (const_string "V8HImode")))
12521 (const_string "1")))
12522 (set_attr "length_immediate" "1")
12523 (set_attr "prefix" "orig,orig,vex,vex,evex,evex")
12524 (set_attr "mode" "TI")])
12526 (define_expand "<extract_type>_vinsert<shuffletype><extract_suf>_mask"
12527 [(match_operand:AVX512_VEC 0 "register_operand")
12528 (match_operand:AVX512_VEC 1 "register_operand")
12529 (match_operand:<ssequartermode> 2 "nonimmediate_operand")
12530 (match_operand:SI 3 "const_0_to_3_operand")
12531 (match_operand:AVX512_VEC 4 "register_operand")
12532 (match_operand:<avx512fmaskmode> 5 "register_operand")]
12536 mask = INTVAL (operands[3]);
12537 selector = GET_MODE_UNIT_SIZE (<MODE>mode) == 4 ?
12538 0xFFFF ^ (0xF000 >> mask * 4)
12539 : 0xFF ^ (0xC0 >> mask * 2);
12540 emit_insn (gen_<extract_type>_vinsert<shuffletype><extract_suf>_1_mask
12541 (operands[0], operands[1], operands[2], GEN_INT (selector),
12542 operands[4], operands[5]));
12546 (define_insn "<mask_codefor><extract_type>_vinsert<shuffletype><extract_suf>_1<mask_name>"
12547 [(set (match_operand:AVX512_VEC 0 "register_operand" "=v")
12548 (vec_merge:AVX512_VEC
12549 (match_operand:AVX512_VEC 1 "register_operand" "v")
12550 (vec_duplicate:AVX512_VEC
12551 (match_operand:<ssequartermode> 2 "nonimmediate_operand" "vm"))
12552 (match_operand:SI 3 "const_int_operand" "n")))]
12556 int selector = INTVAL (operands[3]);
12558 if (selector == 0xFFF || selector == 0x3F)
12560 else if ( selector == 0xF0FF || selector == 0xCF)
12562 else if ( selector == 0xFF0F || selector == 0xF3)
12564 else if ( selector == 0xFFF0 || selector == 0xFC)
12567 gcc_unreachable ();
12569 operands[3] = GEN_INT (mask);
12571 return "vinsert<shuffletype><extract_suf>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3}";
12573 [(set_attr "type" "sselog")
12574 (set_attr "length_immediate" "1")
12575 (set_attr "prefix" "evex")
12576 (set_attr "mode" "<sseinsnmode>")])
12578 (define_expand "<extract_type_2>_vinsert<shuffletype><extract_suf_2>_mask"
12579 [(match_operand:AVX512_VEC_2 0 "register_operand")
12580 (match_operand:AVX512_VEC_2 1 "register_operand")
12581 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand")
12582 (match_operand:SI 3 "const_0_to_1_operand")
12583 (match_operand:AVX512_VEC_2 4 "register_operand")
12584 (match_operand:<avx512fmaskmode> 5 "register_operand")]
12587 int mask = INTVAL (operands[3]);
12589 emit_insn (gen_vec_set_lo_<mode>_mask (operands[0], operands[1],
12590 operands[2], operands[4],
12593 emit_insn (gen_vec_set_hi_<mode>_mask (operands[0], operands[1],
12594 operands[2], operands[4],
12599 (define_insn "vec_set_lo_<mode><mask_name>"
12600 [(set (match_operand:V16FI 0 "register_operand" "=v")
12602 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
12603 (vec_select:<ssehalfvecmode>
12604 (match_operand:V16FI 1 "register_operand" "v")
12605 (parallel [(const_int 8) (const_int 9)
12606 (const_int 10) (const_int 11)
12607 (const_int 12) (const_int 13)
12608 (const_int 14) (const_int 15)]))))]
12610 "vinsert<shuffletype>32x8\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}"
12611 [(set_attr "type" "sselog")
12612 (set_attr "length_immediate" "1")
12613 (set_attr "prefix" "evex")
12614 (set_attr "mode" "<sseinsnmode>")])
12616 (define_insn "vec_set_hi_<mode><mask_name>"
12617 [(set (match_operand:V16FI 0 "register_operand" "=v")
12619 (vec_select:<ssehalfvecmode>
12620 (match_operand:V16FI 1 "register_operand" "v")
12621 (parallel [(const_int 0) (const_int 1)
12622 (const_int 2) (const_int 3)
12623 (const_int 4) (const_int 5)
12624 (const_int 6) (const_int 7)]))
12625 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
12627 "vinsert<shuffletype>32x8\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}"
12628 [(set_attr "type" "sselog")
12629 (set_attr "length_immediate" "1")
12630 (set_attr "prefix" "evex")
12631 (set_attr "mode" "<sseinsnmode>")])
12633 (define_insn "vec_set_lo_<mode><mask_name>"
12634 [(set (match_operand:V8FI 0 "register_operand" "=v")
12636 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
12637 (vec_select:<ssehalfvecmode>
12638 (match_operand:V8FI 1 "register_operand" "v")
12639 (parallel [(const_int 4) (const_int 5)
12640 (const_int 6) (const_int 7)]))))]
12642 "vinsert<shuffletype>64x4\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}"
12643 [(set_attr "type" "sselog")
12644 (set_attr "length_immediate" "1")
12645 (set_attr "prefix" "evex")
12646 (set_attr "mode" "XI")])
12648 (define_insn "vec_set_hi_<mode><mask_name>"
12649 [(set (match_operand:V8FI 0 "register_operand" "=v")
12651 (vec_select:<ssehalfvecmode>
12652 (match_operand:V8FI 1 "register_operand" "v")
12653 (parallel [(const_int 0) (const_int 1)
12654 (const_int 2) (const_int 3)]))
12655 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
12657 "vinsert<shuffletype>64x4\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}"
12658 [(set_attr "type" "sselog")
12659 (set_attr "length_immediate" "1")
12660 (set_attr "prefix" "evex")
12661 (set_attr "mode" "XI")])
12663 (define_expand "avx512dq_shuf_<shuffletype>64x2_mask"
12664 [(match_operand:VI8F_256 0 "register_operand")
12665 (match_operand:VI8F_256 1 "register_operand")
12666 (match_operand:VI8F_256 2 "nonimmediate_operand")
12667 (match_operand:SI 3 "const_0_to_3_operand")
12668 (match_operand:VI8F_256 4 "register_operand")
12669 (match_operand:QI 5 "register_operand")]
12672 int mask = INTVAL (operands[3]);
12673 emit_insn (gen_avx512dq_shuf_<shuffletype>64x2_1_mask
12674 (operands[0], operands[1], operands[2],
12675 GEN_INT (((mask >> 0) & 1) * 2 + 0),
12676 GEN_INT (((mask >> 0) & 1) * 2 + 1),
12677 GEN_INT (((mask >> 1) & 1) * 2 + 4),
12678 GEN_INT (((mask >> 1) & 1) * 2 + 5),
12679 operands[4], operands[5]));
12683 (define_insn "<mask_codefor>avx512dq_shuf_<shuffletype>64x2_1<mask_name>"
12684 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
12685 (vec_select:VI8F_256
12686 (vec_concat:<ssedoublemode>
12687 (match_operand:VI8F_256 1 "register_operand" "v")
12688 (match_operand:VI8F_256 2 "nonimmediate_operand" "vm"))
12689 (parallel [(match_operand 3 "const_0_to_3_operand")
12690 (match_operand 4 "const_0_to_3_operand")
12691 (match_operand 5 "const_4_to_7_operand")
12692 (match_operand 6 "const_4_to_7_operand")])))]
12694 && (INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
12695 && INTVAL (operands[5]) == (INTVAL (operands[6]) - 1))"
12698 mask = INTVAL (operands[3]) / 2;
12699 mask |= (INTVAL (operands[5]) - 4) / 2 << 1;
12700 operands[3] = GEN_INT (mask);
12701 return "vshuf<shuffletype>64x2\t{%3, %2, %1, %0<mask_operand7>|%0<mask_operand7>, %1, %2, %3}";
12703 [(set_attr "type" "sselog")
12704 (set_attr "length_immediate" "1")
12705 (set_attr "prefix" "evex")
12706 (set_attr "mode" "XI")])
12708 (define_expand "avx512f_shuf_<shuffletype>64x2_mask"
12709 [(match_operand:V8FI 0 "register_operand")
12710 (match_operand:V8FI 1 "register_operand")
12711 (match_operand:V8FI 2 "nonimmediate_operand")
12712 (match_operand:SI 3 "const_0_to_255_operand")
12713 (match_operand:V8FI 4 "register_operand")
12714 (match_operand:QI 5 "register_operand")]
12717 int mask = INTVAL (operands[3]);
12718 emit_insn (gen_avx512f_shuf_<shuffletype>64x2_1_mask
12719 (operands[0], operands[1], operands[2],
12720 GEN_INT (((mask >> 0) & 3) * 2),
12721 GEN_INT (((mask >> 0) & 3) * 2 + 1),
12722 GEN_INT (((mask >> 2) & 3) * 2),
12723 GEN_INT (((mask >> 2) & 3) * 2 + 1),
12724 GEN_INT (((mask >> 4) & 3) * 2 + 8),
12725 GEN_INT (((mask >> 4) & 3) * 2 + 9),
12726 GEN_INT (((mask >> 6) & 3) * 2 + 8),
12727 GEN_INT (((mask >> 6) & 3) * 2 + 9),
12728 operands[4], operands[5]));
12732 (define_insn "avx512f_shuf_<shuffletype>64x2_1<mask_name>"
12733 [(set (match_operand:V8FI 0 "register_operand" "=v")
12735 (vec_concat:<ssedoublemode>
12736 (match_operand:V8FI 1 "register_operand" "v")
12737 (match_operand:V8FI 2 "nonimmediate_operand" "vm"))
12738 (parallel [(match_operand 3 "const_0_to_7_operand")
12739 (match_operand 4 "const_0_to_7_operand")
12740 (match_operand 5 "const_0_to_7_operand")
12741 (match_operand 6 "const_0_to_7_operand")
12742 (match_operand 7 "const_8_to_15_operand")
12743 (match_operand 8 "const_8_to_15_operand")
12744 (match_operand 9 "const_8_to_15_operand")
12745 (match_operand 10 "const_8_to_15_operand")])))]
12747 && (INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
12748 && INTVAL (operands[5]) == (INTVAL (operands[6]) - 1)
12749 && INTVAL (operands[7]) == (INTVAL (operands[8]) - 1)
12750 && INTVAL (operands[9]) == (INTVAL (operands[10]) - 1))"
12753 mask = INTVAL (operands[3]) / 2;
12754 mask |= INTVAL (operands[5]) / 2 << 2;
12755 mask |= (INTVAL (operands[7]) - 8) / 2 << 4;
12756 mask |= (INTVAL (operands[9]) - 8) / 2 << 6;
12757 operands[3] = GEN_INT (mask);
12759 return "vshuf<shuffletype>64x2\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
12761 [(set_attr "type" "sselog")
12762 (set_attr "length_immediate" "1")
12763 (set_attr "prefix" "evex")
12764 (set_attr "mode" "<sseinsnmode>")])
12766 (define_expand "avx512vl_shuf_<shuffletype>32x4_mask"
12767 [(match_operand:VI4F_256 0 "register_operand")
12768 (match_operand:VI4F_256 1 "register_operand")
12769 (match_operand:VI4F_256 2 "nonimmediate_operand")
12770 (match_operand:SI 3 "const_0_to_3_operand")
12771 (match_operand:VI4F_256 4 "register_operand")
12772 (match_operand:QI 5 "register_operand")]
12775 int mask = INTVAL (operands[3]);
12776 emit_insn (gen_avx512vl_shuf_<shuffletype>32x4_1_mask
12777 (operands[0], operands[1], operands[2],
12778 GEN_INT (((mask >> 0) & 1) * 4 + 0),
12779 GEN_INT (((mask >> 0) & 1) * 4 + 1),
12780 GEN_INT (((mask >> 0) & 1) * 4 + 2),
12781 GEN_INT (((mask >> 0) & 1) * 4 + 3),
12782 GEN_INT (((mask >> 1) & 1) * 4 + 8),
12783 GEN_INT (((mask >> 1) & 1) * 4 + 9),
12784 GEN_INT (((mask >> 1) & 1) * 4 + 10),
12785 GEN_INT (((mask >> 1) & 1) * 4 + 11),
12786 operands[4], operands[5]));
12790 (define_insn "avx512vl_shuf_<shuffletype>32x4_1<mask_name>"
12791 [(set (match_operand:VI4F_256 0 "register_operand" "=v")
12792 (vec_select:VI4F_256
12793 (vec_concat:<ssedoublemode>
12794 (match_operand:VI4F_256 1 "register_operand" "v")
12795 (match_operand:VI4F_256 2 "nonimmediate_operand" "vm"))
12796 (parallel [(match_operand 3 "const_0_to_7_operand")
12797 (match_operand 4 "const_0_to_7_operand")
12798 (match_operand 5 "const_0_to_7_operand")
12799 (match_operand 6 "const_0_to_7_operand")
12800 (match_operand 7 "const_8_to_15_operand")
12801 (match_operand 8 "const_8_to_15_operand")
12802 (match_operand 9 "const_8_to_15_operand")
12803 (match_operand 10 "const_8_to_15_operand")])))]
12805 && (INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
12806 && INTVAL (operands[3]) == (INTVAL (operands[5]) - 2)
12807 && INTVAL (operands[3]) == (INTVAL (operands[6]) - 3)
12808 && INTVAL (operands[7]) == (INTVAL (operands[8]) - 1)
12809 && INTVAL (operands[7]) == (INTVAL (operands[9]) - 2)
12810 && INTVAL (operands[7]) == (INTVAL (operands[10]) - 3))"
12813 mask = INTVAL (operands[3]) / 4;
12814 mask |= (INTVAL (operands[7]) - 8) / 4 << 1;
12815 operands[3] = GEN_INT (mask);
12817 return "vshuf<shuffletype>32x4\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
12819 [(set_attr "type" "sselog")
12820 (set_attr "length_immediate" "1")
12821 (set_attr "prefix" "evex")
12822 (set_attr "mode" "<sseinsnmode>")])
12824 (define_expand "avx512f_shuf_<shuffletype>32x4_mask"
12825 [(match_operand:V16FI 0 "register_operand")
12826 (match_operand:V16FI 1 "register_operand")
12827 (match_operand:V16FI 2 "nonimmediate_operand")
12828 (match_operand:SI 3 "const_0_to_255_operand")
12829 (match_operand:V16FI 4 "register_operand")
12830 (match_operand:HI 5 "register_operand")]
12833 int mask = INTVAL (operands[3]);
12834 emit_insn (gen_avx512f_shuf_<shuffletype>32x4_1_mask
12835 (operands[0], operands[1], operands[2],
12836 GEN_INT (((mask >> 0) & 3) * 4),
12837 GEN_INT (((mask >> 0) & 3) * 4 + 1),
12838 GEN_INT (((mask >> 0) & 3) * 4 + 2),
12839 GEN_INT (((mask >> 0) & 3) * 4 + 3),
12840 GEN_INT (((mask >> 2) & 3) * 4),
12841 GEN_INT (((mask >> 2) & 3) * 4 + 1),
12842 GEN_INT (((mask >> 2) & 3) * 4 + 2),
12843 GEN_INT (((mask >> 2) & 3) * 4 + 3),
12844 GEN_INT (((mask >> 4) & 3) * 4 + 16),
12845 GEN_INT (((mask >> 4) & 3) * 4 + 17),
12846 GEN_INT (((mask >> 4) & 3) * 4 + 18),
12847 GEN_INT (((mask >> 4) & 3) * 4 + 19),
12848 GEN_INT (((mask >> 6) & 3) * 4 + 16),
12849 GEN_INT (((mask >> 6) & 3) * 4 + 17),
12850 GEN_INT (((mask >> 6) & 3) * 4 + 18),
12851 GEN_INT (((mask >> 6) & 3) * 4 + 19),
12852 operands[4], operands[5]));
12856 (define_insn "avx512f_shuf_<shuffletype>32x4_1<mask_name>"
12857 [(set (match_operand:V16FI 0 "register_operand" "=v")
12859 (vec_concat:<ssedoublemode>
12860 (match_operand:V16FI 1 "register_operand" "v")
12861 (match_operand:V16FI 2 "nonimmediate_operand" "vm"))
12862 (parallel [(match_operand 3 "const_0_to_15_operand")
12863 (match_operand 4 "const_0_to_15_operand")
12864 (match_operand 5 "const_0_to_15_operand")
12865 (match_operand 6 "const_0_to_15_operand")
12866 (match_operand 7 "const_0_to_15_operand")
12867 (match_operand 8 "const_0_to_15_operand")
12868 (match_operand 9 "const_0_to_15_operand")
12869 (match_operand 10 "const_0_to_15_operand")
12870 (match_operand 11 "const_16_to_31_operand")
12871 (match_operand 12 "const_16_to_31_operand")
12872 (match_operand 13 "const_16_to_31_operand")
12873 (match_operand 14 "const_16_to_31_operand")
12874 (match_operand 15 "const_16_to_31_operand")
12875 (match_operand 16 "const_16_to_31_operand")
12876 (match_operand 17 "const_16_to_31_operand")
12877 (match_operand 18 "const_16_to_31_operand")])))]
12879 && (INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
12880 && INTVAL (operands[3]) == (INTVAL (operands[5]) - 2)
12881 && INTVAL (operands[3]) == (INTVAL (operands[6]) - 3)
12882 && INTVAL (operands[7]) == (INTVAL (operands[8]) - 1)
12883 && INTVAL (operands[7]) == (INTVAL (operands[9]) - 2)
12884 && INTVAL (operands[7]) == (INTVAL (operands[10]) - 3)
12885 && INTVAL (operands[11]) == (INTVAL (operands[12]) - 1)
12886 && INTVAL (operands[11]) == (INTVAL (operands[13]) - 2)
12887 && INTVAL (operands[11]) == (INTVAL (operands[14]) - 3)
12888 && INTVAL (operands[15]) == (INTVAL (operands[16]) - 1)
12889 && INTVAL (operands[15]) == (INTVAL (operands[17]) - 2)
12890 && INTVAL (operands[15]) == (INTVAL (operands[18]) - 3))"
12893 mask = INTVAL (operands[3]) / 4;
12894 mask |= INTVAL (operands[7]) / 4 << 2;
12895 mask |= (INTVAL (operands[11]) - 16) / 4 << 4;
12896 mask |= (INTVAL (operands[15]) - 16) / 4 << 6;
12897 operands[3] = GEN_INT (mask);
12899 return "vshuf<shuffletype>32x4\t{%3, %2, %1, %0<mask_operand19>|%0<mask_operand19>, %1, %2, %3}";
12901 [(set_attr "type" "sselog")
12902 (set_attr "length_immediate" "1")
12903 (set_attr "prefix" "evex")
12904 (set_attr "mode" "<sseinsnmode>")])
12906 (define_expand "avx512f_pshufdv3_mask"
12907 [(match_operand:V16SI 0 "register_operand")
12908 (match_operand:V16SI 1 "nonimmediate_operand")
12909 (match_operand:SI 2 "const_0_to_255_operand")
12910 (match_operand:V16SI 3 "register_operand")
12911 (match_operand:HI 4 "register_operand")]
12914 int mask = INTVAL (operands[2]);
12915 emit_insn (gen_avx512f_pshufd_1_mask (operands[0], operands[1],
12916 GEN_INT ((mask >> 0) & 3),
12917 GEN_INT ((mask >> 2) & 3),
12918 GEN_INT ((mask >> 4) & 3),
12919 GEN_INT ((mask >> 6) & 3),
12920 GEN_INT (((mask >> 0) & 3) + 4),
12921 GEN_INT (((mask >> 2) & 3) + 4),
12922 GEN_INT (((mask >> 4) & 3) + 4),
12923 GEN_INT (((mask >> 6) & 3) + 4),
12924 GEN_INT (((mask >> 0) & 3) + 8),
12925 GEN_INT (((mask >> 2) & 3) + 8),
12926 GEN_INT (((mask >> 4) & 3) + 8),
12927 GEN_INT (((mask >> 6) & 3) + 8),
12928 GEN_INT (((mask >> 0) & 3) + 12),
12929 GEN_INT (((mask >> 2) & 3) + 12),
12930 GEN_INT (((mask >> 4) & 3) + 12),
12931 GEN_INT (((mask >> 6) & 3) + 12),
12932 operands[3], operands[4]));
12936 (define_insn "avx512f_pshufd_1<mask_name>"
12937 [(set (match_operand:V16SI 0 "register_operand" "=v")
12939 (match_operand:V16SI 1 "nonimmediate_operand" "vm")
12940 (parallel [(match_operand 2 "const_0_to_3_operand")
12941 (match_operand 3 "const_0_to_3_operand")
12942 (match_operand 4 "const_0_to_3_operand")
12943 (match_operand 5 "const_0_to_3_operand")
12944 (match_operand 6 "const_4_to_7_operand")
12945 (match_operand 7 "const_4_to_7_operand")
12946 (match_operand 8 "const_4_to_7_operand")
12947 (match_operand 9 "const_4_to_7_operand")
12948 (match_operand 10 "const_8_to_11_operand")
12949 (match_operand 11 "const_8_to_11_operand")
12950 (match_operand 12 "const_8_to_11_operand")
12951 (match_operand 13 "const_8_to_11_operand")
12952 (match_operand 14 "const_12_to_15_operand")
12953 (match_operand 15 "const_12_to_15_operand")
12954 (match_operand 16 "const_12_to_15_operand")
12955 (match_operand 17 "const_12_to_15_operand")])))]
12957 && INTVAL (operands[2]) + 4 == INTVAL (operands[6])
12958 && INTVAL (operands[3]) + 4 == INTVAL (operands[7])
12959 && INTVAL (operands[4]) + 4 == INTVAL (operands[8])
12960 && INTVAL (operands[5]) + 4 == INTVAL (operands[9])
12961 && INTVAL (operands[2]) + 8 == INTVAL (operands[10])
12962 && INTVAL (operands[3]) + 8 == INTVAL (operands[11])
12963 && INTVAL (operands[4]) + 8 == INTVAL (operands[12])
12964 && INTVAL (operands[5]) + 8 == INTVAL (operands[13])
12965 && INTVAL (operands[2]) + 12 == INTVAL (operands[14])
12966 && INTVAL (operands[3]) + 12 == INTVAL (operands[15])
12967 && INTVAL (operands[4]) + 12 == INTVAL (operands[16])
12968 && INTVAL (operands[5]) + 12 == INTVAL (operands[17])"
12971 mask |= INTVAL (operands[2]) << 0;
12972 mask |= INTVAL (operands[3]) << 2;
12973 mask |= INTVAL (operands[4]) << 4;
12974 mask |= INTVAL (operands[5]) << 6;
12975 operands[2] = GEN_INT (mask);
12977 return "vpshufd\t{%2, %1, %0<mask_operand18>|%0<mask_operand18>, %1, %2}";
12979 [(set_attr "type" "sselog1")
12980 (set_attr "prefix" "evex")
12981 (set_attr "length_immediate" "1")
12982 (set_attr "mode" "XI")])
12984 (define_expand "avx512vl_pshufdv3_mask"
12985 [(match_operand:V8SI 0 "register_operand")
12986 (match_operand:V8SI 1 "nonimmediate_operand")
12987 (match_operand:SI 2 "const_0_to_255_operand")
12988 (match_operand:V8SI 3 "register_operand")
12989 (match_operand:QI 4 "register_operand")]
12992 int mask = INTVAL (operands[2]);
12993 emit_insn (gen_avx2_pshufd_1_mask (operands[0], operands[1],
12994 GEN_INT ((mask >> 0) & 3),
12995 GEN_INT ((mask >> 2) & 3),
12996 GEN_INT ((mask >> 4) & 3),
12997 GEN_INT ((mask >> 6) & 3),
12998 GEN_INT (((mask >> 0) & 3) + 4),
12999 GEN_INT (((mask >> 2) & 3) + 4),
13000 GEN_INT (((mask >> 4) & 3) + 4),
13001 GEN_INT (((mask >> 6) & 3) + 4),
13002 operands[3], operands[4]));
13006 (define_expand "avx2_pshufdv3"
13007 [(match_operand:V8SI 0 "register_operand")
13008 (match_operand:V8SI 1 "nonimmediate_operand")
13009 (match_operand:SI 2 "const_0_to_255_operand")]
13012 int mask = INTVAL (operands[2]);
13013 emit_insn (gen_avx2_pshufd_1 (operands[0], operands[1],
13014 GEN_INT ((mask >> 0) & 3),
13015 GEN_INT ((mask >> 2) & 3),
13016 GEN_INT ((mask >> 4) & 3),
13017 GEN_INT ((mask >> 6) & 3),
13018 GEN_INT (((mask >> 0) & 3) + 4),
13019 GEN_INT (((mask >> 2) & 3) + 4),
13020 GEN_INT (((mask >> 4) & 3) + 4),
13021 GEN_INT (((mask >> 6) & 3) + 4)));
13025 (define_insn "avx2_pshufd_1<mask_name>"
13026 [(set (match_operand:V8SI 0 "register_operand" "=v")
13028 (match_operand:V8SI 1 "nonimmediate_operand" "vm")
13029 (parallel [(match_operand 2 "const_0_to_3_operand")
13030 (match_operand 3 "const_0_to_3_operand")
13031 (match_operand 4 "const_0_to_3_operand")
13032 (match_operand 5 "const_0_to_3_operand")
13033 (match_operand 6 "const_4_to_7_operand")
13034 (match_operand 7 "const_4_to_7_operand")
13035 (match_operand 8 "const_4_to_7_operand")
13036 (match_operand 9 "const_4_to_7_operand")])))]
13038 && <mask_avx512vl_condition>
13039 && INTVAL (operands[2]) + 4 == INTVAL (operands[6])
13040 && INTVAL (operands[3]) + 4 == INTVAL (operands[7])
13041 && INTVAL (operands[4]) + 4 == INTVAL (operands[8])
13042 && INTVAL (operands[5]) + 4 == INTVAL (operands[9])"
13045 mask |= INTVAL (operands[2]) << 0;
13046 mask |= INTVAL (operands[3]) << 2;
13047 mask |= INTVAL (operands[4]) << 4;
13048 mask |= INTVAL (operands[5]) << 6;
13049 operands[2] = GEN_INT (mask);
13051 return "vpshufd\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
13053 [(set_attr "type" "sselog1")
13054 (set_attr "prefix" "maybe_evex")
13055 (set_attr "length_immediate" "1")
13056 (set_attr "mode" "OI")])
13058 (define_expand "avx512vl_pshufd_mask"
13059 [(match_operand:V4SI 0 "register_operand")
13060 (match_operand:V4SI 1 "nonimmediate_operand")
13061 (match_operand:SI 2 "const_0_to_255_operand")
13062 (match_operand:V4SI 3 "register_operand")
13063 (match_operand:QI 4 "register_operand")]
13066 int mask = INTVAL (operands[2]);
13067 emit_insn (gen_sse2_pshufd_1_mask (operands[0], operands[1],
13068 GEN_INT ((mask >> 0) & 3),
13069 GEN_INT ((mask >> 2) & 3),
13070 GEN_INT ((mask >> 4) & 3),
13071 GEN_INT ((mask >> 6) & 3),
13072 operands[3], operands[4]));
13076 (define_expand "sse2_pshufd"
13077 [(match_operand:V4SI 0 "register_operand")
13078 (match_operand:V4SI 1 "vector_operand")
13079 (match_operand:SI 2 "const_int_operand")]
13082 int mask = INTVAL (operands[2]);
13083 emit_insn (gen_sse2_pshufd_1 (operands[0], operands[1],
13084 GEN_INT ((mask >> 0) & 3),
13085 GEN_INT ((mask >> 2) & 3),
13086 GEN_INT ((mask >> 4) & 3),
13087 GEN_INT ((mask >> 6) & 3)));
13091 (define_insn "sse2_pshufd_1<mask_name>"
13092 [(set (match_operand:V4SI 0 "register_operand" "=v")
13094 (match_operand:V4SI 1 "vector_operand" "vBm")
13095 (parallel [(match_operand 2 "const_0_to_3_operand")
13096 (match_operand 3 "const_0_to_3_operand")
13097 (match_operand 4 "const_0_to_3_operand")
13098 (match_operand 5 "const_0_to_3_operand")])))]
13099 "TARGET_SSE2 && <mask_avx512vl_condition>"
13102 mask |= INTVAL (operands[2]) << 0;
13103 mask |= INTVAL (operands[3]) << 2;
13104 mask |= INTVAL (operands[4]) << 4;
13105 mask |= INTVAL (operands[5]) << 6;
13106 operands[2] = GEN_INT (mask);
13108 return "%vpshufd\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
13110 [(set_attr "type" "sselog1")
13111 (set_attr "prefix_data16" "1")
13112 (set_attr "prefix" "<mask_prefix2>")
13113 (set_attr "length_immediate" "1")
13114 (set_attr "mode" "TI")])
13116 (define_insn "<mask_codefor>avx512bw_pshuflwv32hi<mask_name>"
13117 [(set (match_operand:V32HI 0 "register_operand" "=v")
13119 [(match_operand:V32HI 1 "nonimmediate_operand" "vm")
13120 (match_operand:SI 2 "const_0_to_255_operand" "n")]
13123 "vpshuflw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13124 [(set_attr "type" "sselog")
13125 (set_attr "prefix" "evex")
13126 (set_attr "mode" "XI")])
13128 (define_expand "avx512vl_pshuflwv3_mask"
13129 [(match_operand:V16HI 0 "register_operand")
13130 (match_operand:V16HI 1 "nonimmediate_operand")
13131 (match_operand:SI 2 "const_0_to_255_operand")
13132 (match_operand:V16HI 3 "register_operand")
13133 (match_operand:HI 4 "register_operand")]
13134 "TARGET_AVX512VL && TARGET_AVX512BW"
13136 int mask = INTVAL (operands[2]);
13137 emit_insn (gen_avx2_pshuflw_1_mask (operands[0], operands[1],
13138 GEN_INT ((mask >> 0) & 3),
13139 GEN_INT ((mask >> 2) & 3),
13140 GEN_INT ((mask >> 4) & 3),
13141 GEN_INT ((mask >> 6) & 3),
13142 GEN_INT (((mask >> 0) & 3) + 8),
13143 GEN_INT (((mask >> 2) & 3) + 8),
13144 GEN_INT (((mask >> 4) & 3) + 8),
13145 GEN_INT (((mask >> 6) & 3) + 8),
13146 operands[3], operands[4]));
13150 (define_expand "avx2_pshuflwv3"
13151 [(match_operand:V16HI 0 "register_operand")
13152 (match_operand:V16HI 1 "nonimmediate_operand")
13153 (match_operand:SI 2 "const_0_to_255_operand")]
13156 int mask = INTVAL (operands[2]);
13157 emit_insn (gen_avx2_pshuflw_1 (operands[0], operands[1],
13158 GEN_INT ((mask >> 0) & 3),
13159 GEN_INT ((mask >> 2) & 3),
13160 GEN_INT ((mask >> 4) & 3),
13161 GEN_INT ((mask >> 6) & 3),
13162 GEN_INT (((mask >> 0) & 3) + 8),
13163 GEN_INT (((mask >> 2) & 3) + 8),
13164 GEN_INT (((mask >> 4) & 3) + 8),
13165 GEN_INT (((mask >> 6) & 3) + 8)));
13169 (define_insn "avx2_pshuflw_1<mask_name>"
13170 [(set (match_operand:V16HI 0 "register_operand" "=v")
13172 (match_operand:V16HI 1 "nonimmediate_operand" "vm")
13173 (parallel [(match_operand 2 "const_0_to_3_operand")
13174 (match_operand 3 "const_0_to_3_operand")
13175 (match_operand 4 "const_0_to_3_operand")
13176 (match_operand 5 "const_0_to_3_operand")
13181 (match_operand 6 "const_8_to_11_operand")
13182 (match_operand 7 "const_8_to_11_operand")
13183 (match_operand 8 "const_8_to_11_operand")
13184 (match_operand 9 "const_8_to_11_operand")
13188 (const_int 15)])))]
13190 && <mask_avx512bw_condition> && <mask_avx512vl_condition>
13191 && INTVAL (operands[2]) + 8 == INTVAL (operands[6])
13192 && INTVAL (operands[3]) + 8 == INTVAL (operands[7])
13193 && INTVAL (operands[4]) + 8 == INTVAL (operands[8])
13194 && INTVAL (operands[5]) + 8 == INTVAL (operands[9])"
13197 mask |= INTVAL (operands[2]) << 0;
13198 mask |= INTVAL (operands[3]) << 2;
13199 mask |= INTVAL (operands[4]) << 4;
13200 mask |= INTVAL (operands[5]) << 6;
13201 operands[2] = GEN_INT (mask);
13203 return "vpshuflw\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
13205 [(set_attr "type" "sselog")
13206 (set_attr "prefix" "maybe_evex")
13207 (set_attr "length_immediate" "1")
13208 (set_attr "mode" "OI")])
13210 (define_expand "avx512vl_pshuflw_mask"
13211 [(match_operand:V8HI 0 "register_operand")
13212 (match_operand:V8HI 1 "nonimmediate_operand")
13213 (match_operand:SI 2 "const_0_to_255_operand")
13214 (match_operand:V8HI 3 "register_operand")
13215 (match_operand:QI 4 "register_operand")]
13216 "TARGET_AVX512VL && TARGET_AVX512BW"
13218 int mask = INTVAL (operands[2]);
13219 emit_insn (gen_sse2_pshuflw_1_mask (operands[0], operands[1],
13220 GEN_INT ((mask >> 0) & 3),
13221 GEN_INT ((mask >> 2) & 3),
13222 GEN_INT ((mask >> 4) & 3),
13223 GEN_INT ((mask >> 6) & 3),
13224 operands[3], operands[4]));
13228 (define_expand "sse2_pshuflw"
13229 [(match_operand:V8HI 0 "register_operand")
13230 (match_operand:V8HI 1 "vector_operand")
13231 (match_operand:SI 2 "const_int_operand")]
13234 int mask = INTVAL (operands[2]);
13235 emit_insn (gen_sse2_pshuflw_1 (operands[0], operands[1],
13236 GEN_INT ((mask >> 0) & 3),
13237 GEN_INT ((mask >> 2) & 3),
13238 GEN_INT ((mask >> 4) & 3),
13239 GEN_INT ((mask >> 6) & 3)));
13243 (define_insn "sse2_pshuflw_1<mask_name>"
13244 [(set (match_operand:V8HI 0 "register_operand" "=v")
13246 (match_operand:V8HI 1 "vector_operand" "vBm")
13247 (parallel [(match_operand 2 "const_0_to_3_operand")
13248 (match_operand 3 "const_0_to_3_operand")
13249 (match_operand 4 "const_0_to_3_operand")
13250 (match_operand 5 "const_0_to_3_operand")
13255 "TARGET_SSE2 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
13258 mask |= INTVAL (operands[2]) << 0;
13259 mask |= INTVAL (operands[3]) << 2;
13260 mask |= INTVAL (operands[4]) << 4;
13261 mask |= INTVAL (operands[5]) << 6;
13262 operands[2] = GEN_INT (mask);
13264 return "%vpshuflw\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
13266 [(set_attr "type" "sselog")
13267 (set_attr "prefix_data16" "0")
13268 (set_attr "prefix_rep" "1")
13269 (set_attr "prefix" "maybe_vex")
13270 (set_attr "length_immediate" "1")
13271 (set_attr "mode" "TI")])
13273 (define_expand "avx2_pshufhwv3"
13274 [(match_operand:V16HI 0 "register_operand")
13275 (match_operand:V16HI 1 "nonimmediate_operand")
13276 (match_operand:SI 2 "const_0_to_255_operand")]
13279 int mask = INTVAL (operands[2]);
13280 emit_insn (gen_avx2_pshufhw_1 (operands[0], operands[1],
13281 GEN_INT (((mask >> 0) & 3) + 4),
13282 GEN_INT (((mask >> 2) & 3) + 4),
13283 GEN_INT (((mask >> 4) & 3) + 4),
13284 GEN_INT (((mask >> 6) & 3) + 4),
13285 GEN_INT (((mask >> 0) & 3) + 12),
13286 GEN_INT (((mask >> 2) & 3) + 12),
13287 GEN_INT (((mask >> 4) & 3) + 12),
13288 GEN_INT (((mask >> 6) & 3) + 12)));
13292 (define_insn "<mask_codefor>avx512bw_pshufhwv32hi<mask_name>"
13293 [(set (match_operand:V32HI 0 "register_operand" "=v")
13295 [(match_operand:V32HI 1 "nonimmediate_operand" "vm")
13296 (match_operand:SI 2 "const_0_to_255_operand" "n")]
13299 "vpshufhw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13300 [(set_attr "type" "sselog")
13301 (set_attr "prefix" "evex")
13302 (set_attr "mode" "XI")])
13304 (define_expand "avx512vl_pshufhwv3_mask"
13305 [(match_operand:V16HI 0 "register_operand")
13306 (match_operand:V16HI 1 "nonimmediate_operand")
13307 (match_operand:SI 2 "const_0_to_255_operand")
13308 (match_operand:V16HI 3 "register_operand")
13309 (match_operand:HI 4 "register_operand")]
13310 "TARGET_AVX512VL && TARGET_AVX512BW"
13312 int mask = INTVAL (operands[2]);
13313 emit_insn (gen_avx2_pshufhw_1_mask (operands[0], operands[1],
13314 GEN_INT (((mask >> 0) & 3) + 4),
13315 GEN_INT (((mask >> 2) & 3) + 4),
13316 GEN_INT (((mask >> 4) & 3) + 4),
13317 GEN_INT (((mask >> 6) & 3) + 4),
13318 GEN_INT (((mask >> 0) & 3) + 12),
13319 GEN_INT (((mask >> 2) & 3) + 12),
13320 GEN_INT (((mask >> 4) & 3) + 12),
13321 GEN_INT (((mask >> 6) & 3) + 12),
13322 operands[3], operands[4]));
13326 (define_insn "avx2_pshufhw_1<mask_name>"
13327 [(set (match_operand:V16HI 0 "register_operand" "=v")
13329 (match_operand:V16HI 1 "nonimmediate_operand" "vm")
13330 (parallel [(const_int 0)
13334 (match_operand 2 "const_4_to_7_operand")
13335 (match_operand 3 "const_4_to_7_operand")
13336 (match_operand 4 "const_4_to_7_operand")
13337 (match_operand 5 "const_4_to_7_operand")
13342 (match_operand 6 "const_12_to_15_operand")
13343 (match_operand 7 "const_12_to_15_operand")
13344 (match_operand 8 "const_12_to_15_operand")
13345 (match_operand 9 "const_12_to_15_operand")])))]
13347 && <mask_avx512bw_condition> && <mask_avx512vl_condition>
13348 && INTVAL (operands[2]) + 8 == INTVAL (operands[6])
13349 && INTVAL (operands[3]) + 8 == INTVAL (operands[7])
13350 && INTVAL (operands[4]) + 8 == INTVAL (operands[8])
13351 && INTVAL (operands[5]) + 8 == INTVAL (operands[9])"
13354 mask |= (INTVAL (operands[2]) - 4) << 0;
13355 mask |= (INTVAL (operands[3]) - 4) << 2;
13356 mask |= (INTVAL (operands[4]) - 4) << 4;
13357 mask |= (INTVAL (operands[5]) - 4) << 6;
13358 operands[2] = GEN_INT (mask);
13360 return "vpshufhw\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
13362 [(set_attr "type" "sselog")
13363 (set_attr "prefix" "maybe_evex")
13364 (set_attr "length_immediate" "1")
13365 (set_attr "mode" "OI")])
13367 (define_expand "avx512vl_pshufhw_mask"
13368 [(match_operand:V8HI 0 "register_operand")
13369 (match_operand:V8HI 1 "nonimmediate_operand")
13370 (match_operand:SI 2 "const_0_to_255_operand")
13371 (match_operand:V8HI 3 "register_operand")
13372 (match_operand:QI 4 "register_operand")]
13373 "TARGET_AVX512VL && TARGET_AVX512BW"
13375 int mask = INTVAL (operands[2]);
13376 emit_insn (gen_sse2_pshufhw_1_mask (operands[0], operands[1],
13377 GEN_INT (((mask >> 0) & 3) + 4),
13378 GEN_INT (((mask >> 2) & 3) + 4),
13379 GEN_INT (((mask >> 4) & 3) + 4),
13380 GEN_INT (((mask >> 6) & 3) + 4),
13381 operands[3], operands[4]));
13385 (define_expand "sse2_pshufhw"
13386 [(match_operand:V8HI 0 "register_operand")
13387 (match_operand:V8HI 1 "vector_operand")
13388 (match_operand:SI 2 "const_int_operand")]
13391 int mask = INTVAL (operands[2]);
13392 emit_insn (gen_sse2_pshufhw_1 (operands[0], operands[1],
13393 GEN_INT (((mask >> 0) & 3) + 4),
13394 GEN_INT (((mask >> 2) & 3) + 4),
13395 GEN_INT (((mask >> 4) & 3) + 4),
13396 GEN_INT (((mask >> 6) & 3) + 4)));
13400 (define_insn "sse2_pshufhw_1<mask_name>"
13401 [(set (match_operand:V8HI 0 "register_operand" "=v")
13403 (match_operand:V8HI 1 "vector_operand" "vBm")
13404 (parallel [(const_int 0)
13408 (match_operand 2 "const_4_to_7_operand")
13409 (match_operand 3 "const_4_to_7_operand")
13410 (match_operand 4 "const_4_to_7_operand")
13411 (match_operand 5 "const_4_to_7_operand")])))]
13412 "TARGET_SSE2 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
13415 mask |= (INTVAL (operands[2]) - 4) << 0;
13416 mask |= (INTVAL (operands[3]) - 4) << 2;
13417 mask |= (INTVAL (operands[4]) - 4) << 4;
13418 mask |= (INTVAL (operands[5]) - 4) << 6;
13419 operands[2] = GEN_INT (mask);
13421 return "%vpshufhw\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
13423 [(set_attr "type" "sselog")
13424 (set_attr "prefix_rep" "1")
13425 (set_attr "prefix_data16" "0")
13426 (set_attr "prefix" "maybe_vex")
13427 (set_attr "length_immediate" "1")
13428 (set_attr "mode" "TI")])
13430 (define_expand "sse2_loadd"
13431 [(set (match_operand:V4SI 0 "register_operand")
13433 (vec_duplicate:V4SI
13434 (match_operand:SI 1 "nonimmediate_operand"))
13438 "operands[2] = CONST0_RTX (V4SImode);")
13440 (define_insn "sse2_loadld"
13441 [(set (match_operand:V4SI 0 "register_operand" "=v,Yi,x,x,v")
13443 (vec_duplicate:V4SI
13444 (match_operand:SI 2 "nonimmediate_operand" "m ,r ,m,x,v"))
13445 (match_operand:V4SI 1 "reg_or_0_operand" "C ,C ,C,0,v")
13449 %vmovd\t{%2, %0|%0, %2}
13450 %vmovd\t{%2, %0|%0, %2}
13451 movss\t{%2, %0|%0, %2}
13452 movss\t{%2, %0|%0, %2}
13453 vmovss\t{%2, %1, %0|%0, %1, %2}"
13454 [(set_attr "isa" "sse2,sse2,noavx,noavx,avx")
13455 (set_attr "type" "ssemov")
13456 (set_attr "prefix" "maybe_vex,maybe_vex,orig,orig,maybe_evex")
13457 (set_attr "mode" "TI,TI,V4SF,SF,SF")])
13459 ;; QI and HI modes handled by pextr patterns.
13460 (define_mode_iterator PEXTR_MODE12
13461 [(V16QI "TARGET_SSE4_1") V8HI])
13463 (define_insn "*vec_extract<mode>"
13464 [(set (match_operand:<ssescalarmode> 0 "register_sse4nonimm_operand" "=r,m,r,m")
13465 (vec_select:<ssescalarmode>
13466 (match_operand:PEXTR_MODE12 1 "register_operand" "x,x,v,v")
13468 [(match_operand:SI 2 "const_0_to_<ssescalarnummask>_operand")])))]
13471 %vpextr<ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}
13472 %vpextr<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
13473 vpextr<ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}
13474 vpextr<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
13475 [(set_attr "isa" "*,sse4,avx512bw,avx512bw")
13476 (set_attr "type" "sselog1")
13477 (set_attr "prefix_data16" "1")
13478 (set (attr "prefix_extra")
13480 (and (eq_attr "alternative" "0,2")
13481 (eq (const_string "<MODE>mode") (const_string "V8HImode")))
13483 (const_string "1")))
13484 (set_attr "length_immediate" "1")
13485 (set_attr "prefix" "maybe_vex,maybe_vex,evex,evex")
13486 (set_attr "mode" "TI")])
13488 (define_insn "*vec_extract<PEXTR_MODE12:mode>_zext"
13489 [(set (match_operand:SWI48 0 "register_operand" "=r,r")
13491 (vec_select:<PEXTR_MODE12:ssescalarmode>
13492 (match_operand:PEXTR_MODE12 1 "register_operand" "x,v")
13494 [(match_operand:SI 2
13495 "const_0_to_<PEXTR_MODE12:ssescalarnummask>_operand")]))))]
13498 %vpextr<PEXTR_MODE12:ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}
13499 vpextr<PEXTR_MODE12:ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}"
13500 [(set_attr "isa" "*,avx512bw")
13501 (set_attr "type" "sselog1")
13502 (set_attr "prefix_data16" "1")
13503 (set (attr "prefix_extra")
13505 (eq (const_string "<PEXTR_MODE12:MODE>mode") (const_string "V8HImode"))
13507 (const_string "1")))
13508 (set_attr "length_immediate" "1")
13509 (set_attr "prefix" "maybe_vex")
13510 (set_attr "mode" "TI")])
13512 (define_insn "*vec_extract<mode>_mem"
13513 [(set (match_operand:<ssescalarmode> 0 "register_operand" "=r")
13514 (vec_select:<ssescalarmode>
13515 (match_operand:VI12_128 1 "memory_operand" "o")
13517 [(match_operand 2 "const_0_to_<ssescalarnummask>_operand")])))]
13521 (define_insn "*vec_extract<ssevecmodelower>_0"
13522 [(set (match_operand:SWI48 0 "nonimmediate_operand" "=r ,v ,m")
13524 (match_operand:<ssevecmode> 1 "nonimmediate_operand" "mYj,vm,v")
13525 (parallel [(const_int 0)])))]
13526 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
13529 (define_insn "*vec_extractv2di_0_sse"
13530 [(set (match_operand:DI 0 "nonimmediate_operand" "=v,m")
13532 (match_operand:V2DI 1 "nonimmediate_operand" "vm,v")
13533 (parallel [(const_int 0)])))]
13534 "TARGET_SSE && !TARGET_64BIT
13535 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
13539 [(set (match_operand:SWI48x 0 "nonimmediate_operand")
13541 (match_operand:<ssevecmode> 1 "register_operand")
13542 (parallel [(const_int 0)])))]
13543 "TARGET_SSE && reload_completed"
13544 [(set (match_dup 0) (match_dup 1))]
13545 "operands[1] = gen_lowpart (<MODE>mode, operands[1]);")
13547 (define_insn "*vec_extractv4si_0_zext_sse4"
13548 [(set (match_operand:DI 0 "register_operand" "=r,x,v")
13551 (match_operand:V4SI 1 "register_operand" "Yj,x,v")
13552 (parallel [(const_int 0)]))))]
13555 [(set_attr "isa" "x64,*,avx512f")])
13557 (define_insn "*vec_extractv4si_0_zext"
13558 [(set (match_operand:DI 0 "register_operand" "=r")
13561 (match_operand:V4SI 1 "register_operand" "x")
13562 (parallel [(const_int 0)]))))]
13563 "TARGET_64BIT && TARGET_SSE2 && TARGET_INTER_UNIT_MOVES_FROM_VEC"
13567 [(set (match_operand:DI 0 "register_operand")
13570 (match_operand:V4SI 1 "register_operand")
13571 (parallel [(const_int 0)]))))]
13572 "TARGET_SSE2 && reload_completed"
13573 [(set (match_dup 0) (zero_extend:DI (match_dup 1)))]
13574 "operands[1] = gen_lowpart (SImode, operands[1]);")
13576 (define_insn "*vec_extractv4si"
13577 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,rm,Yr,*x,x,Yv")
13579 (match_operand:V4SI 1 "register_operand" "x,v,0,0,x,v")
13580 (parallel [(match_operand:SI 2 "const_0_to_3_operand")])))]
13583 switch (which_alternative)
13587 return "%vpextrd\t{%2, %1, %0|%0, %1, %2}";
13591 operands[2] = GEN_INT (INTVAL (operands[2]) * 4);
13592 return "psrldq\t{%2, %0|%0, %2}";
13596 operands[2] = GEN_INT (INTVAL (operands[2]) * 4);
13597 return "vpsrldq\t{%2, %1, %0|%0, %1, %2}";
13600 gcc_unreachable ();
13603 [(set_attr "isa" "*,avx512dq,noavx,noavx,avx,avx512bw")
13604 (set_attr "type" "sselog1,sselog1,sseishft1,sseishft1,sseishft1,sseishft1")
13605 (set (attr "prefix_extra")
13606 (if_then_else (eq_attr "alternative" "0,1")
13608 (const_string "*")))
13609 (set_attr "length_immediate" "1")
13610 (set_attr "prefix" "maybe_vex,evex,orig,orig,vex,evex")
13611 (set_attr "mode" "TI")])
13613 (define_insn "*vec_extractv4si_zext"
13614 [(set (match_operand:DI 0 "register_operand" "=r,r")
13617 (match_operand:V4SI 1 "register_operand" "x,v")
13618 (parallel [(match_operand:SI 2 "const_0_to_3_operand")]))))]
13619 "TARGET_64BIT && TARGET_SSE4_1"
13620 "%vpextrd\t{%2, %1, %k0|%k0, %1, %2}"
13621 [(set_attr "isa" "*,avx512dq")
13622 (set_attr "type" "sselog1")
13623 (set_attr "prefix_extra" "1")
13624 (set_attr "length_immediate" "1")
13625 (set_attr "prefix" "maybe_vex")
13626 (set_attr "mode" "TI")])
13628 (define_insn "*vec_extractv4si_mem"
13629 [(set (match_operand:SI 0 "register_operand" "=x,r")
13631 (match_operand:V4SI 1 "memory_operand" "o,o")
13632 (parallel [(match_operand 2 "const_0_to_3_operand")])))]
13636 (define_insn_and_split "*vec_extractv4si_zext_mem"
13637 [(set (match_operand:DI 0 "register_operand" "=x,r")
13640 (match_operand:V4SI 1 "memory_operand" "o,o")
13641 (parallel [(match_operand:SI 2 "const_0_to_3_operand")]))))]
13642 "TARGET_64BIT && TARGET_SSE"
13644 "&& reload_completed"
13645 [(set (match_dup 0) (zero_extend:DI (match_dup 1)))]
13647 operands[1] = adjust_address (operands[1], SImode, INTVAL (operands[2]) * 4);
13650 (define_insn "*vec_extractv2di_1"
13651 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,rm,m,x,x,Yv,x,v,r")
13653 (match_operand:V2DI 1 "nonimmediate_operand" "x ,v ,v,0,x, v,x,o,o")
13654 (parallel [(const_int 1)])))]
13655 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
13657 %vpextrq\t{$1, %1, %0|%0, %1, 1}
13658 vpextrq\t{$1, %1, %0|%0, %1, 1}
13659 %vmovhps\t{%1, %0|%0, %1}
13660 psrldq\t{$8, %0|%0, 8}
13661 vpsrldq\t{$8, %1, %0|%0, %1, 8}
13662 vpsrldq\t{$8, %1, %0|%0, %1, 8}
13663 movhlps\t{%1, %0|%0, %1}
13667 (cond [(eq_attr "alternative" "0")
13668 (const_string "x64_sse4")
13669 (eq_attr "alternative" "1")
13670 (const_string "x64_avx512dq")
13671 (eq_attr "alternative" "3")
13672 (const_string "sse2_noavx")
13673 (eq_attr "alternative" "4")
13674 (const_string "avx")
13675 (eq_attr "alternative" "5")
13676 (const_string "avx512bw")
13677 (eq_attr "alternative" "6")
13678 (const_string "noavx")
13679 (eq_attr "alternative" "8")
13680 (const_string "x64")
13682 (const_string "*")))
13684 (cond [(eq_attr "alternative" "2,6,7")
13685 (const_string "ssemov")
13686 (eq_attr "alternative" "3,4,5")
13687 (const_string "sseishft1")
13688 (eq_attr "alternative" "8")
13689 (const_string "imov")
13691 (const_string "sselog1")))
13692 (set (attr "length_immediate")
13693 (if_then_else (eq_attr "alternative" "0,1,3,4,5")
13695 (const_string "*")))
13696 (set (attr "prefix_rex")
13697 (if_then_else (eq_attr "alternative" "0,1")
13699 (const_string "*")))
13700 (set (attr "prefix_extra")
13701 (if_then_else (eq_attr "alternative" "0,1")
13703 (const_string "*")))
13704 (set_attr "prefix" "maybe_vex,evex,maybe_vex,orig,vex,evex,orig,*,*")
13705 (set_attr "mode" "TI,TI,V2SF,TI,TI,TI,V4SF,DI,DI")])
13708 [(set (match_operand:<ssescalarmode> 0 "register_operand")
13709 (vec_select:<ssescalarmode>
13710 (match_operand:VI_128 1 "memory_operand")
13712 [(match_operand 2 "const_0_to_<ssescalarnummask>_operand")])))]
13713 "TARGET_SSE && reload_completed"
13714 [(set (match_dup 0) (match_dup 1))]
13716 int offs = INTVAL (operands[2]) * GET_MODE_SIZE (<ssescalarmode>mode);
13718 operands[1] = adjust_address (operands[1], <ssescalarmode>mode, offs);
13721 (define_insn "*vec_extractv2ti"
13722 [(set (match_operand:TI 0 "nonimmediate_operand" "=xm,vm")
13724 (match_operand:V2TI 1 "register_operand" "x,v")
13726 [(match_operand:SI 2 "const_0_to_1_operand")])))]
13729 vextract%~128\t{%2, %1, %0|%0, %1, %2}
13730 vextracti32x4\t{%2, %g1, %0|%0, %g1, %2}"
13731 [(set_attr "type" "sselog")
13732 (set_attr "prefix_extra" "1")
13733 (set_attr "length_immediate" "1")
13734 (set_attr "prefix" "vex,evex")
13735 (set_attr "mode" "OI")])
13737 (define_insn "*vec_extractv4ti"
13738 [(set (match_operand:TI 0 "nonimmediate_operand" "=vm")
13740 (match_operand:V4TI 1 "register_operand" "v")
13742 [(match_operand:SI 2 "const_0_to_3_operand")])))]
13744 "vextracti32x4\t{%2, %1, %0|%0, %1, %2}"
13745 [(set_attr "type" "sselog")
13746 (set_attr "prefix_extra" "1")
13747 (set_attr "length_immediate" "1")
13748 (set_attr "prefix" "evex")
13749 (set_attr "mode" "XI")])
13751 (define_mode_iterator VEXTRACTI128_MODE
13752 [(V4TI "TARGET_AVX512F") V2TI])
13755 [(set (match_operand:TI 0 "nonimmediate_operand")
13757 (match_operand:VEXTRACTI128_MODE 1 "register_operand")
13758 (parallel [(const_int 0)])))]
13760 && reload_completed
13761 && (TARGET_AVX512VL || !EXT_REX_SSE_REG_P (operands[1]))"
13762 [(set (match_dup 0) (match_dup 1))]
13763 "operands[1] = gen_lowpart (TImode, operands[1]);")
13765 ;; Turn SImode or DImode extraction from arbitrary SSE/AVX/AVX512F
13766 ;; vector modes into vec_extract*.
13768 [(set (match_operand:SWI48x 0 "nonimmediate_operand")
13769 (subreg:SWI48x (match_operand 1 "register_operand") 0))]
13770 "can_create_pseudo_p ()
13771 && REG_P (operands[1])
13772 && VECTOR_MODE_P (GET_MODE (operands[1]))
13773 && ((TARGET_SSE && GET_MODE_SIZE (GET_MODE (operands[1])) == 16)
13774 || (TARGET_AVX && GET_MODE_SIZE (GET_MODE (operands[1])) == 32)
13775 || (TARGET_AVX512F && GET_MODE_SIZE (GET_MODE (operands[1])) == 64))
13776 && (<MODE>mode == SImode || TARGET_64BIT || MEM_P (operands[0]))"
13777 [(set (match_dup 0) (vec_select:SWI48x (match_dup 1)
13778 (parallel [(const_int 0)])))]
13782 switch (GET_MODE_SIZE (GET_MODE (operands[1])))
13785 if (<MODE>mode == SImode)
13787 tmp = gen_reg_rtx (V8SImode);
13788 emit_insn (gen_vec_extract_lo_v16si (tmp,
13789 gen_lowpart (V16SImode,
13794 tmp = gen_reg_rtx (V4DImode);
13795 emit_insn (gen_vec_extract_lo_v8di (tmp,
13796 gen_lowpart (V8DImode,
13802 tmp = gen_reg_rtx (<ssevecmode>mode);
13803 if (<MODE>mode == SImode)
13804 emit_insn (gen_vec_extract_lo_v8si (tmp, gen_lowpart (V8SImode,
13807 emit_insn (gen_vec_extract_lo_v4di (tmp, gen_lowpart (V4DImode,
13812 operands[1] = gen_lowpart (<ssevecmode>mode, operands[1]);
13817 (define_insn "*vec_concatv2si_sse4_1"
13818 [(set (match_operand:V2SI 0 "register_operand"
13819 "=Yr,*x, x, v,Yr,*x, v, v, *y,*y")
13821 (match_operand:SI 1 "nonimmediate_operand"
13822 " 0, 0, x,Yv, 0, 0,Yv,rm, 0,rm")
13823 (match_operand:SI 2 "vector_move_operand"
13824 " rm,rm,rm,rm,Yr,*x,Yv, C,*ym, C")))]
13825 "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
13827 pinsrd\t{$1, %2, %0|%0, %2, 1}
13828 pinsrd\t{$1, %2, %0|%0, %2, 1}
13829 vpinsrd\t{$1, %2, %1, %0|%0, %1, %2, 1}
13830 vpinsrd\t{$1, %2, %1, %0|%0, %1, %2, 1}
13831 punpckldq\t{%2, %0|%0, %2}
13832 punpckldq\t{%2, %0|%0, %2}
13833 vpunpckldq\t{%2, %1, %0|%0, %1, %2}
13834 %vmovd\t{%1, %0|%0, %1}
13835 punpckldq\t{%2, %0|%0, %2}
13836 movd\t{%1, %0|%0, %1}"
13837 [(set_attr "isa" "noavx,noavx,avx,avx512dq,noavx,noavx,avx,*,*,*")
13839 (cond [(eq_attr "alternative" "7")
13840 (const_string "ssemov")
13841 (eq_attr "alternative" "8")
13842 (const_string "mmxcvt")
13843 (eq_attr "alternative" "9")
13844 (const_string "mmxmov")
13846 (const_string "sselog")))
13847 (set (attr "prefix_extra")
13848 (if_then_else (eq_attr "alternative" "0,1,2,3")
13850 (const_string "*")))
13851 (set (attr "length_immediate")
13852 (if_then_else (eq_attr "alternative" "0,1,2,3")
13854 (const_string "*")))
13855 (set_attr "prefix" "orig,orig,vex,evex,orig,orig,maybe_evex,maybe_vex,orig,orig")
13856 (set_attr "mode" "TI,TI,TI,TI,TI,TI,TI,TI,DI,DI")])
13858 ;; ??? In theory we can match memory for the MMX alternative, but allowing
13859 ;; nonimmediate_operand for operand 2 and *not* allowing memory for the SSE
13860 ;; alternatives pretty much forces the MMX alternative to be chosen.
13861 (define_insn "*vec_concatv2si"
13862 [(set (match_operand:V2SI 0 "register_operand" "=x,x ,*y,x,x,*y,*y")
13864 (match_operand:SI 1 "nonimmediate_operand" " 0,rm,rm,0,m, 0,*rm")
13865 (match_operand:SI 2 "reg_or_0_operand" " x,C ,C, x,C,*y,C")))]
13866 "TARGET_SSE && !TARGET_SSE4_1"
13868 punpckldq\t{%2, %0|%0, %2}
13869 movd\t{%1, %0|%0, %1}
13870 movd\t{%1, %0|%0, %1}
13871 unpcklps\t{%2, %0|%0, %2}
13872 movss\t{%1, %0|%0, %1}
13873 punpckldq\t{%2, %0|%0, %2}
13874 movd\t{%1, %0|%0, %1}"
13875 [(set_attr "isa" "sse2,sse2,sse2,*,*,*,*")
13876 (set_attr "type" "sselog,ssemov,mmxmov,sselog,ssemov,mmxcvt,mmxmov")
13877 (set_attr "mode" "TI,TI,DI,V4SF,SF,DI,DI")])
13879 (define_insn "*vec_concatv4si"
13880 [(set (match_operand:V4SI 0 "register_operand" "=x,v,x,x,v")
13882 (match_operand:V2SI 1 "register_operand" " 0,v,0,0,v")
13883 (match_operand:V2SI 2 "nonimmediate_operand" " x,v,x,m,m")))]
13886 punpcklqdq\t{%2, %0|%0, %2}
13887 vpunpcklqdq\t{%2, %1, %0|%0, %1, %2}
13888 movlhps\t{%2, %0|%0, %2}
13889 movhps\t{%2, %0|%0, %q2}
13890 vmovhps\t{%2, %1, %0|%0, %1, %q2}"
13891 [(set_attr "isa" "sse2_noavx,avx,noavx,noavx,avx")
13892 (set_attr "type" "sselog,sselog,ssemov,ssemov,ssemov")
13893 (set_attr "prefix" "orig,maybe_evex,orig,orig,maybe_evex")
13894 (set_attr "mode" "TI,TI,V4SF,V2SF,V2SF")])
13896 ;; movd instead of movq is required to handle broken assemblers.
13897 (define_insn "vec_concatv2di"
13898 [(set (match_operand:V2DI 0 "register_operand"
13899 "=Yr,*x,x ,v ,Yi,v ,x ,x,v ,x,x,v")
13901 (match_operand:DI 1 "nonimmediate_operand"
13902 " 0, 0,x ,Yv,r ,vm,?!*Yn,0,Yv,0,0,v")
13903 (match_operand:DI 2 "vector_move_operand"
13904 "*rm,rm,rm,rm,C ,C ,C ,x,Yv,x,m,m")))]
13907 pinsrq\t{$1, %2, %0|%0, %2, 1}
13908 pinsrq\t{$1, %2, %0|%0, %2, 1}
13909 vpinsrq\t{$1, %2, %1, %0|%0, %1, %2, 1}
13910 vpinsrq\t{$1, %2, %1, %0|%0, %1, %2, 1}
13911 * return HAVE_AS_IX86_INTERUNIT_MOVQ ? \"%vmovq\t{%1, %0|%0, %1}\" : \"%vmovd\t{%1, %0|%0, %1}\";
13912 %vmovq\t{%1, %0|%0, %1}
13913 movq2dq\t{%1, %0|%0, %1}
13914 punpcklqdq\t{%2, %0|%0, %2}
13915 vpunpcklqdq\t{%2, %1, %0|%0, %1, %2}
13916 movlhps\t{%2, %0|%0, %2}
13917 movhps\t{%2, %0|%0, %2}
13918 vmovhps\t{%2, %1, %0|%0, %1, %2}"
13920 (cond [(eq_attr "alternative" "0,1")
13921 (const_string "x64_sse4_noavx")
13922 (eq_attr "alternative" "2")
13923 (const_string "x64_avx")
13924 (eq_attr "alternative" "3")
13925 (const_string "x64_avx512dq")
13926 (eq_attr "alternative" "4")
13927 (const_string "x64")
13928 (eq_attr "alternative" "5,6")
13929 (const_string "sse2")
13930 (eq_attr "alternative" "7")
13931 (const_string "sse2_noavx")
13932 (eq_attr "alternative" "8,11")
13933 (const_string "avx")
13935 (const_string "noavx")))
13938 (eq_attr "alternative" "0,1,2,3,7,8")
13939 (const_string "sselog")
13940 (const_string "ssemov")))
13941 (set (attr "prefix_rex")
13942 (if_then_else (eq_attr "alternative" "0,1,2,3,4")
13944 (const_string "*")))
13945 (set (attr "prefix_extra")
13946 (if_then_else (eq_attr "alternative" "0,1,2,3")
13948 (const_string "*")))
13949 (set (attr "length_immediate")
13950 (if_then_else (eq_attr "alternative" "0,1,2,3")
13952 (const_string "*")))
13953 (set (attr "prefix")
13954 (cond [(eq_attr "alternative" "2")
13955 (const_string "vex")
13956 (eq_attr "alternative" "3")
13957 (const_string "evex")
13958 (eq_attr "alternative" "4,5")
13959 (const_string "maybe_vex")
13960 (eq_attr "alternative" "8,11")
13961 (const_string "maybe_evex")
13963 (const_string "orig")))
13964 (set_attr "mode" "TI,TI,TI,TI,TI,TI,TI,TI,TI,V4SF,V2SF,V2SF")])
13966 (define_expand "vec_unpacks_lo_<mode>"
13967 [(match_operand:<sseunpackmode> 0 "register_operand")
13968 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
13970 "ix86_expand_sse_unpack (operands[0], operands[1], false, false); DONE;")
13972 (define_expand "vec_unpacks_hi_<mode>"
13973 [(match_operand:<sseunpackmode> 0 "register_operand")
13974 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
13976 "ix86_expand_sse_unpack (operands[0], operands[1], false, true); DONE;")
13978 (define_expand "vec_unpacku_lo_<mode>"
13979 [(match_operand:<sseunpackmode> 0 "register_operand")
13980 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
13982 "ix86_expand_sse_unpack (operands[0], operands[1], true, false); DONE;")
13984 (define_expand "vec_unpacks_lo_hi"
13985 [(set (subreg:HI (match_operand:QI 0 "register_operand") 0)
13986 (match_operand:HI 1 "register_operand"))]
13989 (define_expand "vec_unpacks_lo_si"
13990 [(set (match_operand:HI 0 "register_operand")
13991 (subreg:HI (match_operand:SI 1 "register_operand") 0))]
13994 (define_expand "vec_unpacks_lo_di"
13995 [(set (match_operand:SI 0 "register_operand")
13996 (subreg:SI (match_operand:DI 1 "register_operand") 0))]
13999 (define_expand "vec_unpacku_hi_<mode>"
14000 [(match_operand:<sseunpackmode> 0 "register_operand")
14001 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
14003 "ix86_expand_sse_unpack (operands[0], operands[1], true, true); DONE;")
14005 (define_expand "vec_unpacks_hi_hi"
14007 [(set (subreg:HI (match_operand:QI 0 "register_operand") 0)
14008 (lshiftrt:HI (match_operand:HI 1 "register_operand")
14010 (unspec [(const_int 0)] UNSPEC_MASKOP)])]
14013 (define_expand "vec_unpacks_hi_<mode>"
14015 [(set (subreg:SWI48x
14016 (match_operand:<HALFMASKMODE> 0 "register_operand") 0)
14017 (lshiftrt:SWI48x (match_operand:SWI48x 1 "register_operand")
14019 (unspec [(const_int 0)] UNSPEC_MASKOP)])]
14021 "operands[2] = GEN_INT (GET_MODE_BITSIZE (<HALFMASKMODE>mode));")
14023 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14027 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14029 (define_expand "<sse2_avx2>_uavg<mode>3<mask_name>"
14030 [(set (match_operand:VI12_AVX2 0 "register_operand")
14031 (truncate:VI12_AVX2
14032 (lshiftrt:<ssedoublemode>
14033 (plus:<ssedoublemode>
14034 (plus:<ssedoublemode>
14035 (zero_extend:<ssedoublemode>
14036 (match_operand:VI12_AVX2 1 "vector_operand"))
14037 (zero_extend:<ssedoublemode>
14038 (match_operand:VI12_AVX2 2 "vector_operand")))
14039 (match_dup <mask_expand_op3>))
14041 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
14044 if (<mask_applied>)
14046 operands[3] = CONST1_RTX(<MODE>mode);
14047 ix86_fixup_binary_operands_no_copy (PLUS, <MODE>mode, operands);
14049 if (<mask_applied>)
14051 operands[5] = operands[3];
14056 (define_insn "*<sse2_avx2>_uavg<mode>3<mask_name>"
14057 [(set (match_operand:VI12_AVX2 0 "register_operand" "=x,v")
14058 (truncate:VI12_AVX2
14059 (lshiftrt:<ssedoublemode>
14060 (plus:<ssedoublemode>
14061 (plus:<ssedoublemode>
14062 (zero_extend:<ssedoublemode>
14063 (match_operand:VI12_AVX2 1 "vector_operand" "%0,v"))
14064 (zero_extend:<ssedoublemode>
14065 (match_operand:VI12_AVX2 2 "vector_operand" "xBm,vm")))
14066 (match_operand:VI12_AVX2 <mask_expand_op3> "const1_operand"))
14068 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>
14069 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
14071 pavg<ssemodesuffix>\t{%2, %0|%0, %2}
14072 vpavg<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
14073 [(set_attr "isa" "noavx,avx")
14074 (set_attr "type" "sseiadd")
14075 (set_attr "prefix_data16" "1,*")
14076 (set_attr "prefix" "orig,<mask_prefix>")
14077 (set_attr "mode" "<sseinsnmode>")])
14079 ;; The correct representation for this is absolutely enormous, and
14080 ;; surely not generally useful.
14081 (define_insn "<sse2_avx2>_psadbw"
14082 [(set (match_operand:VI8_AVX2_AVX512BW 0 "register_operand" "=x,v")
14083 (unspec:VI8_AVX2_AVX512BW
14084 [(match_operand:<ssebytemode> 1 "register_operand" "0,v")
14085 (match_operand:<ssebytemode> 2 "vector_operand" "xBm,vm")]
14089 psadbw\t{%2, %0|%0, %2}
14090 vpsadbw\t{%2, %1, %0|%0, %1, %2}"
14091 [(set_attr "isa" "noavx,avx")
14092 (set_attr "type" "sseiadd")
14093 (set_attr "atom_unit" "simul")
14094 (set_attr "prefix_data16" "1,*")
14095 (set_attr "prefix" "orig,maybe_evex")
14096 (set_attr "mode" "<sseinsnmode>")])
14098 (define_insn "<sse>_movmsk<ssemodesuffix><avxsizesuffix>"
14099 [(set (match_operand:SI 0 "register_operand" "=r")
14101 [(match_operand:VF_128_256 1 "register_operand" "x")]
14104 "%vmovmsk<ssemodesuffix>\t{%1, %0|%0, %1}"
14105 [(set_attr "type" "ssemov")
14106 (set_attr "prefix" "maybe_vex")
14107 (set_attr "mode" "<MODE>")])
14109 (define_insn "*<sse>_movmsk<ssemodesuffix><avxsizesuffix>_zext"
14110 [(set (match_operand:DI 0 "register_operand" "=r")
14113 [(match_operand:VF_128_256 1 "register_operand" "x")]
14115 "TARGET_64BIT && TARGET_SSE"
14116 "%vmovmsk<ssemodesuffix>\t{%1, %k0|%k0, %1}"
14117 [(set_attr "type" "ssemov")
14118 (set_attr "prefix" "maybe_vex")
14119 (set_attr "mode" "<MODE>")])
14121 (define_insn "<sse2_avx2>_pmovmskb"
14122 [(set (match_operand:SI 0 "register_operand" "=r")
14124 [(match_operand:VI1_AVX2 1 "register_operand" "x")]
14127 "%vpmovmskb\t{%1, %0|%0, %1}"
14128 [(set_attr "type" "ssemov")
14129 (set (attr "prefix_data16")
14131 (match_test "TARGET_AVX")
14133 (const_string "1")))
14134 (set_attr "prefix" "maybe_vex")
14135 (set_attr "mode" "SI")])
14137 (define_insn "*<sse2_avx2>_pmovmskb_zext"
14138 [(set (match_operand:DI 0 "register_operand" "=r")
14141 [(match_operand:VI1_AVX2 1 "register_operand" "x")]
14143 "TARGET_64BIT && TARGET_SSE2"
14144 "%vpmovmskb\t{%1, %k0|%k0, %1}"
14145 [(set_attr "type" "ssemov")
14146 (set (attr "prefix_data16")
14148 (match_test "TARGET_AVX")
14150 (const_string "1")))
14151 (set_attr "prefix" "maybe_vex")
14152 (set_attr "mode" "SI")])
14154 (define_expand "sse2_maskmovdqu"
14155 [(set (match_operand:V16QI 0 "memory_operand")
14156 (unspec:V16QI [(match_operand:V16QI 1 "register_operand")
14157 (match_operand:V16QI 2 "register_operand")
14162 (define_insn "*sse2_maskmovdqu"
14163 [(set (mem:V16QI (match_operand:P 0 "register_operand" "D"))
14164 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "x")
14165 (match_operand:V16QI 2 "register_operand" "x")
14166 (mem:V16QI (match_dup 0))]
14170 /* We can't use %^ here due to ASM_OUTPUT_OPCODE processing
14171 that requires %v to be at the beginning of the opcode name. */
14172 if (Pmode != word_mode)
14173 fputs ("\taddr32", asm_out_file);
14174 return "%vmaskmovdqu\t{%2, %1|%1, %2}";
14176 [(set_attr "type" "ssemov")
14177 (set_attr "prefix_data16" "1")
14178 (set (attr "length_address")
14179 (symbol_ref ("Pmode != word_mode")))
14180 ;; The implicit %rdi operand confuses default length_vex computation.
14181 (set (attr "length_vex")
14182 (symbol_ref ("3 + REX_SSE_REGNO_P (REGNO (operands[2]))")))
14183 (set_attr "prefix" "maybe_vex")
14184 (set_attr "znver1_decode" "vector")
14185 (set_attr "mode" "TI")])
14187 (define_insn "sse_ldmxcsr"
14188 [(unspec_volatile [(match_operand:SI 0 "memory_operand" "m")]
14192 [(set_attr "type" "sse")
14193 (set_attr "atom_sse_attr" "mxcsr")
14194 (set_attr "prefix" "maybe_vex")
14195 (set_attr "memory" "load")])
14197 (define_insn "sse_stmxcsr"
14198 [(set (match_operand:SI 0 "memory_operand" "=m")
14199 (unspec_volatile:SI [(const_int 0)] UNSPECV_STMXCSR))]
14202 [(set_attr "type" "sse")
14203 (set_attr "atom_sse_attr" "mxcsr")
14204 (set_attr "prefix" "maybe_vex")
14205 (set_attr "memory" "store")])
14207 (define_insn "sse2_clflush"
14208 [(unspec_volatile [(match_operand 0 "address_operand" "p")]
14212 [(set_attr "type" "sse")
14213 (set_attr "atom_sse_attr" "fence")
14214 (set_attr "memory" "unknown")])
14216 ;; As per AMD and Intel ISA manuals, the first operand is extensions
14217 ;; and it goes to %ecx. The second operand received is hints and it goes
14219 (define_insn "sse3_mwait"
14220 [(unspec_volatile [(match_operand:SI 0 "register_operand" "c")
14221 (match_operand:SI 1 "register_operand" "a")]
14224 ;; 64bit version is "mwait %rax,%rcx". But only lower 32bits are used.
14225 ;; Since 32bit register operands are implicitly zero extended to 64bit,
14226 ;; we only need to set up 32bit registers.
14228 [(set_attr "length" "3")])
14230 (define_insn "sse3_monitor_<mode>"
14231 [(unspec_volatile [(match_operand:P 0 "register_operand" "a")
14232 (match_operand:SI 1 "register_operand" "c")
14233 (match_operand:SI 2 "register_operand" "d")]
14236 ;; 64bit version is "monitor %rax,%rcx,%rdx". But only lower 32bits in
14237 ;; RCX and RDX are used. Since 32bit register operands are implicitly
14238 ;; zero extended to 64bit, we only need to set up 32bit registers.
14240 [(set (attr "length")
14241 (symbol_ref ("(Pmode != word_mode) + 3")))])
14243 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14245 ;; SSSE3 instructions
14247 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14249 (define_code_iterator ssse3_plusminus [plus ss_plus minus ss_minus])
14251 (define_insn "avx2_ph<plusminus_mnemonic>wv16hi3"
14252 [(set (match_operand:V16HI 0 "register_operand" "=x")
14257 (ssse3_plusminus:HI
14259 (match_operand:V16HI 1 "register_operand" "x")
14260 (parallel [(const_int 0)]))
14261 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
14262 (ssse3_plusminus:HI
14263 (vec_select:HI (match_dup 1) (parallel [(const_int 2)]))
14264 (vec_select:HI (match_dup 1) (parallel [(const_int 3)]))))
14266 (ssse3_plusminus:HI
14267 (vec_select:HI (match_dup 1) (parallel [(const_int 4)]))
14268 (vec_select:HI (match_dup 1) (parallel [(const_int 5)])))
14269 (ssse3_plusminus:HI
14270 (vec_select:HI (match_dup 1) (parallel [(const_int 6)]))
14271 (vec_select:HI (match_dup 1) (parallel [(const_int 7)])))))
14274 (ssse3_plusminus:HI
14275 (vec_select:HI (match_dup 1) (parallel [(const_int 8)]))
14276 (vec_select:HI (match_dup 1) (parallel [(const_int 9)])))
14277 (ssse3_plusminus:HI
14278 (vec_select:HI (match_dup 1) (parallel [(const_int 10)]))
14279 (vec_select:HI (match_dup 1) (parallel [(const_int 11)]))))
14281 (ssse3_plusminus:HI
14282 (vec_select:HI (match_dup 1) (parallel [(const_int 12)]))
14283 (vec_select:HI (match_dup 1) (parallel [(const_int 13)])))
14284 (ssse3_plusminus:HI
14285 (vec_select:HI (match_dup 1) (parallel [(const_int 14)]))
14286 (vec_select:HI (match_dup 1) (parallel [(const_int 15)]))))))
14290 (ssse3_plusminus:HI
14292 (match_operand:V16HI 2 "nonimmediate_operand" "xm")
14293 (parallel [(const_int 0)]))
14294 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))
14295 (ssse3_plusminus:HI
14296 (vec_select:HI (match_dup 2) (parallel [(const_int 2)]))
14297 (vec_select:HI (match_dup 2) (parallel [(const_int 3)]))))
14299 (ssse3_plusminus:HI
14300 (vec_select:HI (match_dup 2) (parallel [(const_int 4)]))
14301 (vec_select:HI (match_dup 2) (parallel [(const_int 5)])))
14302 (ssse3_plusminus:HI
14303 (vec_select:HI (match_dup 2) (parallel [(const_int 6)]))
14304 (vec_select:HI (match_dup 2) (parallel [(const_int 7)])))))
14307 (ssse3_plusminus:HI
14308 (vec_select:HI (match_dup 2) (parallel [(const_int 8)]))
14309 (vec_select:HI (match_dup 2) (parallel [(const_int 9)])))
14310 (ssse3_plusminus:HI
14311 (vec_select:HI (match_dup 2) (parallel [(const_int 10)]))
14312 (vec_select:HI (match_dup 2) (parallel [(const_int 11)]))))
14314 (ssse3_plusminus:HI
14315 (vec_select:HI (match_dup 2) (parallel [(const_int 12)]))
14316 (vec_select:HI (match_dup 2) (parallel [(const_int 13)])))
14317 (ssse3_plusminus:HI
14318 (vec_select:HI (match_dup 2) (parallel [(const_int 14)]))
14319 (vec_select:HI (match_dup 2) (parallel [(const_int 15)]))))))))]
14321 "vph<plusminus_mnemonic>w\t{%2, %1, %0|%0, %1, %2}"
14322 [(set_attr "type" "sseiadd")
14323 (set_attr "prefix_extra" "1")
14324 (set_attr "prefix" "vex")
14325 (set_attr "mode" "OI")])
14327 (define_insn "ssse3_ph<plusminus_mnemonic>wv8hi3"
14328 [(set (match_operand:V8HI 0 "register_operand" "=x,x")
14332 (ssse3_plusminus:HI
14334 (match_operand:V8HI 1 "register_operand" "0,x")
14335 (parallel [(const_int 0)]))
14336 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
14337 (ssse3_plusminus:HI
14338 (vec_select:HI (match_dup 1) (parallel [(const_int 2)]))
14339 (vec_select:HI (match_dup 1) (parallel [(const_int 3)]))))
14341 (ssse3_plusminus:HI
14342 (vec_select:HI (match_dup 1) (parallel [(const_int 4)]))
14343 (vec_select:HI (match_dup 1) (parallel [(const_int 5)])))
14344 (ssse3_plusminus:HI
14345 (vec_select:HI (match_dup 1) (parallel [(const_int 6)]))
14346 (vec_select:HI (match_dup 1) (parallel [(const_int 7)])))))
14349 (ssse3_plusminus:HI
14351 (match_operand:V8HI 2 "vector_operand" "xBm,xm")
14352 (parallel [(const_int 0)]))
14353 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))
14354 (ssse3_plusminus:HI
14355 (vec_select:HI (match_dup 2) (parallel [(const_int 2)]))
14356 (vec_select:HI (match_dup 2) (parallel [(const_int 3)]))))
14358 (ssse3_plusminus:HI
14359 (vec_select:HI (match_dup 2) (parallel [(const_int 4)]))
14360 (vec_select:HI (match_dup 2) (parallel [(const_int 5)])))
14361 (ssse3_plusminus:HI
14362 (vec_select:HI (match_dup 2) (parallel [(const_int 6)]))
14363 (vec_select:HI (match_dup 2) (parallel [(const_int 7)])))))))]
14366 ph<plusminus_mnemonic>w\t{%2, %0|%0, %2}
14367 vph<plusminus_mnemonic>w\t{%2, %1, %0|%0, %1, %2}"
14368 [(set_attr "isa" "noavx,avx")
14369 (set_attr "type" "sseiadd")
14370 (set_attr "atom_unit" "complex")
14371 (set_attr "prefix_data16" "1,*")
14372 (set_attr "prefix_extra" "1")
14373 (set_attr "prefix" "orig,vex")
14374 (set_attr "mode" "TI")])
14376 (define_insn "ssse3_ph<plusminus_mnemonic>wv4hi3"
14377 [(set (match_operand:V4HI 0 "register_operand" "=y")
14380 (ssse3_plusminus:HI
14382 (match_operand:V4HI 1 "register_operand" "0")
14383 (parallel [(const_int 0)]))
14384 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
14385 (ssse3_plusminus:HI
14386 (vec_select:HI (match_dup 1) (parallel [(const_int 2)]))
14387 (vec_select:HI (match_dup 1) (parallel [(const_int 3)]))))
14389 (ssse3_plusminus:HI
14391 (match_operand:V4HI 2 "nonimmediate_operand" "ym")
14392 (parallel [(const_int 0)]))
14393 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))
14394 (ssse3_plusminus:HI
14395 (vec_select:HI (match_dup 2) (parallel [(const_int 2)]))
14396 (vec_select:HI (match_dup 2) (parallel [(const_int 3)]))))))]
14398 "ph<plusminus_mnemonic>w\t{%2, %0|%0, %2}"
14399 [(set_attr "type" "sseiadd")
14400 (set_attr "atom_unit" "complex")
14401 (set_attr "prefix_extra" "1")
14402 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14403 (set_attr "mode" "DI")])
14405 (define_insn "avx2_ph<plusminus_mnemonic>dv8si3"
14406 [(set (match_operand:V8SI 0 "register_operand" "=x")
14412 (match_operand:V8SI 1 "register_operand" "x")
14413 (parallel [(const_int 0)]))
14414 (vec_select:SI (match_dup 1) (parallel [(const_int 1)])))
14416 (vec_select:SI (match_dup 1) (parallel [(const_int 2)]))
14417 (vec_select:SI (match_dup 1) (parallel [(const_int 3)]))))
14420 (vec_select:SI (match_dup 1) (parallel [(const_int 4)]))
14421 (vec_select:SI (match_dup 1) (parallel [(const_int 5)])))
14423 (vec_select:SI (match_dup 1) (parallel [(const_int 6)]))
14424 (vec_select:SI (match_dup 1) (parallel [(const_int 7)])))))
14429 (match_operand:V8SI 2 "nonimmediate_operand" "xm")
14430 (parallel [(const_int 0)]))
14431 (vec_select:SI (match_dup 2) (parallel [(const_int 1)])))
14433 (vec_select:SI (match_dup 2) (parallel [(const_int 2)]))
14434 (vec_select:SI (match_dup 2) (parallel [(const_int 3)]))))
14437 (vec_select:SI (match_dup 2) (parallel [(const_int 4)]))
14438 (vec_select:SI (match_dup 2) (parallel [(const_int 5)])))
14440 (vec_select:SI (match_dup 2) (parallel [(const_int 6)]))
14441 (vec_select:SI (match_dup 2) (parallel [(const_int 7)])))))))]
14443 "vph<plusminus_mnemonic>d\t{%2, %1, %0|%0, %1, %2}"
14444 [(set_attr "type" "sseiadd")
14445 (set_attr "prefix_extra" "1")
14446 (set_attr "prefix" "vex")
14447 (set_attr "mode" "OI")])
14449 (define_insn "ssse3_ph<plusminus_mnemonic>dv4si3"
14450 [(set (match_operand:V4SI 0 "register_operand" "=x,x")
14455 (match_operand:V4SI 1 "register_operand" "0,x")
14456 (parallel [(const_int 0)]))
14457 (vec_select:SI (match_dup 1) (parallel [(const_int 1)])))
14459 (vec_select:SI (match_dup 1) (parallel [(const_int 2)]))
14460 (vec_select:SI (match_dup 1) (parallel [(const_int 3)]))))
14464 (match_operand:V4SI 2 "vector_operand" "xBm,xm")
14465 (parallel [(const_int 0)]))
14466 (vec_select:SI (match_dup 2) (parallel [(const_int 1)])))
14468 (vec_select:SI (match_dup 2) (parallel [(const_int 2)]))
14469 (vec_select:SI (match_dup 2) (parallel [(const_int 3)]))))))]
14472 ph<plusminus_mnemonic>d\t{%2, %0|%0, %2}
14473 vph<plusminus_mnemonic>d\t{%2, %1, %0|%0, %1, %2}"
14474 [(set_attr "isa" "noavx,avx")
14475 (set_attr "type" "sseiadd")
14476 (set_attr "atom_unit" "complex")
14477 (set_attr "prefix_data16" "1,*")
14478 (set_attr "prefix_extra" "1")
14479 (set_attr "prefix" "orig,vex")
14480 (set_attr "mode" "TI")])
14482 (define_insn "ssse3_ph<plusminus_mnemonic>dv2si3"
14483 [(set (match_operand:V2SI 0 "register_operand" "=y")
14487 (match_operand:V2SI 1 "register_operand" "0")
14488 (parallel [(const_int 0)]))
14489 (vec_select:SI (match_dup 1) (parallel [(const_int 1)])))
14492 (match_operand:V2SI 2 "nonimmediate_operand" "ym")
14493 (parallel [(const_int 0)]))
14494 (vec_select:SI (match_dup 2) (parallel [(const_int 1)])))))]
14496 "ph<plusminus_mnemonic>d\t{%2, %0|%0, %2}"
14497 [(set_attr "type" "sseiadd")
14498 (set_attr "atom_unit" "complex")
14499 (set_attr "prefix_extra" "1")
14500 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14501 (set_attr "mode" "DI")])
14503 (define_insn "avx2_pmaddubsw256"
14504 [(set (match_operand:V16HI 0 "register_operand" "=x,v")
14509 (match_operand:V32QI 1 "register_operand" "x,v")
14510 (parallel [(const_int 0) (const_int 2)
14511 (const_int 4) (const_int 6)
14512 (const_int 8) (const_int 10)
14513 (const_int 12) (const_int 14)
14514 (const_int 16) (const_int 18)
14515 (const_int 20) (const_int 22)
14516 (const_int 24) (const_int 26)
14517 (const_int 28) (const_int 30)])))
14520 (match_operand:V32QI 2 "nonimmediate_operand" "xm,vm")
14521 (parallel [(const_int 0) (const_int 2)
14522 (const_int 4) (const_int 6)
14523 (const_int 8) (const_int 10)
14524 (const_int 12) (const_int 14)
14525 (const_int 16) (const_int 18)
14526 (const_int 20) (const_int 22)
14527 (const_int 24) (const_int 26)
14528 (const_int 28) (const_int 30)]))))
14531 (vec_select:V16QI (match_dup 1)
14532 (parallel [(const_int 1) (const_int 3)
14533 (const_int 5) (const_int 7)
14534 (const_int 9) (const_int 11)
14535 (const_int 13) (const_int 15)
14536 (const_int 17) (const_int 19)
14537 (const_int 21) (const_int 23)
14538 (const_int 25) (const_int 27)
14539 (const_int 29) (const_int 31)])))
14541 (vec_select:V16QI (match_dup 2)
14542 (parallel [(const_int 1) (const_int 3)
14543 (const_int 5) (const_int 7)
14544 (const_int 9) (const_int 11)
14545 (const_int 13) (const_int 15)
14546 (const_int 17) (const_int 19)
14547 (const_int 21) (const_int 23)
14548 (const_int 25) (const_int 27)
14549 (const_int 29) (const_int 31)]))))))]
14551 "vpmaddubsw\t{%2, %1, %0|%0, %1, %2}"
14552 [(set_attr "isa" "*,avx512bw")
14553 (set_attr "type" "sseiadd")
14554 (set_attr "prefix_extra" "1")
14555 (set_attr "prefix" "vex,evex")
14556 (set_attr "mode" "OI")])
14558 ;; The correct representation for this is absolutely enormous, and
14559 ;; surely not generally useful.
14560 (define_insn "avx512bw_pmaddubsw512<mode><mask_name>"
14561 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
14562 (unspec:VI2_AVX512VL
14563 [(match_operand:<dbpsadbwmode> 1 "register_operand" "v")
14564 (match_operand:<dbpsadbwmode> 2 "nonimmediate_operand" "vm")]
14565 UNSPEC_PMADDUBSW512))]
14567 "vpmaddubsw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}";
14568 [(set_attr "type" "sseiadd")
14569 (set_attr "prefix" "evex")
14570 (set_attr "mode" "XI")])
14572 (define_insn "avx512bw_umulhrswv32hi3<mask_name>"
14573 [(set (match_operand:V32HI 0 "register_operand" "=v")
14580 (match_operand:V32HI 1 "nonimmediate_operand" "%v"))
14582 (match_operand:V32HI 2 "nonimmediate_operand" "vm")))
14584 (const_vector:V32HI [(const_int 1) (const_int 1)
14585 (const_int 1) (const_int 1)
14586 (const_int 1) (const_int 1)
14587 (const_int 1) (const_int 1)
14588 (const_int 1) (const_int 1)
14589 (const_int 1) (const_int 1)
14590 (const_int 1) (const_int 1)
14591 (const_int 1) (const_int 1)
14592 (const_int 1) (const_int 1)
14593 (const_int 1) (const_int 1)
14594 (const_int 1) (const_int 1)
14595 (const_int 1) (const_int 1)
14596 (const_int 1) (const_int 1)
14597 (const_int 1) (const_int 1)
14598 (const_int 1) (const_int 1)
14599 (const_int 1) (const_int 1)]))
14602 "vpmulhrsw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
14603 [(set_attr "type" "sseimul")
14604 (set_attr "prefix" "evex")
14605 (set_attr "mode" "XI")])
14607 (define_insn "ssse3_pmaddubsw128"
14608 [(set (match_operand:V8HI 0 "register_operand" "=x,x,v")
14613 (match_operand:V16QI 1 "register_operand" "0,x,v")
14614 (parallel [(const_int 0) (const_int 2)
14615 (const_int 4) (const_int 6)
14616 (const_int 8) (const_int 10)
14617 (const_int 12) (const_int 14)])))
14620 (match_operand:V16QI 2 "vector_operand" "xBm,xm,vm")
14621 (parallel [(const_int 0) (const_int 2)
14622 (const_int 4) (const_int 6)
14623 (const_int 8) (const_int 10)
14624 (const_int 12) (const_int 14)]))))
14627 (vec_select:V8QI (match_dup 1)
14628 (parallel [(const_int 1) (const_int 3)
14629 (const_int 5) (const_int 7)
14630 (const_int 9) (const_int 11)
14631 (const_int 13) (const_int 15)])))
14633 (vec_select:V8QI (match_dup 2)
14634 (parallel [(const_int 1) (const_int 3)
14635 (const_int 5) (const_int 7)
14636 (const_int 9) (const_int 11)
14637 (const_int 13) (const_int 15)]))))))]
14640 pmaddubsw\t{%2, %0|%0, %2}
14641 vpmaddubsw\t{%2, %1, %0|%0, %1, %2}
14642 vpmaddubsw\t{%2, %1, %0|%0, %1, %2}"
14643 [(set_attr "isa" "noavx,avx,avx512bw")
14644 (set_attr "type" "sseiadd")
14645 (set_attr "atom_unit" "simul")
14646 (set_attr "prefix_data16" "1,*,*")
14647 (set_attr "prefix_extra" "1")
14648 (set_attr "prefix" "orig,vex,evex")
14649 (set_attr "mode" "TI")])
14651 (define_insn "ssse3_pmaddubsw"
14652 [(set (match_operand:V4HI 0 "register_operand" "=y")
14657 (match_operand:V8QI 1 "register_operand" "0")
14658 (parallel [(const_int 0) (const_int 2)
14659 (const_int 4) (const_int 6)])))
14662 (match_operand:V8QI 2 "nonimmediate_operand" "ym")
14663 (parallel [(const_int 0) (const_int 2)
14664 (const_int 4) (const_int 6)]))))
14667 (vec_select:V4QI (match_dup 1)
14668 (parallel [(const_int 1) (const_int 3)
14669 (const_int 5) (const_int 7)])))
14671 (vec_select:V4QI (match_dup 2)
14672 (parallel [(const_int 1) (const_int 3)
14673 (const_int 5) (const_int 7)]))))))]
14675 "pmaddubsw\t{%2, %0|%0, %2}"
14676 [(set_attr "type" "sseiadd")
14677 (set_attr "atom_unit" "simul")
14678 (set_attr "prefix_extra" "1")
14679 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14680 (set_attr "mode" "DI")])
14682 (define_mode_iterator PMULHRSW
14683 [V4HI V8HI (V16HI "TARGET_AVX2")])
14685 (define_expand "<ssse3_avx2>_pmulhrsw<mode>3_mask"
14686 [(set (match_operand:PMULHRSW 0 "register_operand")
14687 (vec_merge:PMULHRSW
14689 (lshiftrt:<ssedoublemode>
14690 (plus:<ssedoublemode>
14691 (lshiftrt:<ssedoublemode>
14692 (mult:<ssedoublemode>
14693 (sign_extend:<ssedoublemode>
14694 (match_operand:PMULHRSW 1 "nonimmediate_operand"))
14695 (sign_extend:<ssedoublemode>
14696 (match_operand:PMULHRSW 2 "nonimmediate_operand")))
14700 (match_operand:PMULHRSW 3 "register_operand")
14701 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
14702 "TARGET_AVX512BW && TARGET_AVX512VL"
14704 operands[5] = CONST1_RTX(<MODE>mode);
14705 ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);
14708 (define_expand "<ssse3_avx2>_pmulhrsw<mode>3"
14709 [(set (match_operand:PMULHRSW 0 "register_operand")
14711 (lshiftrt:<ssedoublemode>
14712 (plus:<ssedoublemode>
14713 (lshiftrt:<ssedoublemode>
14714 (mult:<ssedoublemode>
14715 (sign_extend:<ssedoublemode>
14716 (match_operand:PMULHRSW 1 "nonimmediate_operand"))
14717 (sign_extend:<ssedoublemode>
14718 (match_operand:PMULHRSW 2 "nonimmediate_operand")))
14724 operands[3] = CONST1_RTX(<MODE>mode);
14725 ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);
14728 (define_insn "*<ssse3_avx2>_pmulhrsw<mode>3<mask_name>"
14729 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,x,v")
14731 (lshiftrt:<ssedoublemode>
14732 (plus:<ssedoublemode>
14733 (lshiftrt:<ssedoublemode>
14734 (mult:<ssedoublemode>
14735 (sign_extend:<ssedoublemode>
14736 (match_operand:VI2_AVX2 1 "vector_operand" "%0,x,v"))
14737 (sign_extend:<ssedoublemode>
14738 (match_operand:VI2_AVX2 2 "vector_operand" "xBm,xm,vm")))
14740 (match_operand:VI2_AVX2 3 "const1_operand"))
14742 "TARGET_SSSE3 && <mask_mode512bit_condition> && <mask_avx512bw_condition>
14743 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
14745 pmulhrsw\t{%2, %0|%0, %2}
14746 vpmulhrsw\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}
14747 vpmulhrsw\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}"
14748 [(set_attr "isa" "noavx,avx,avx512bw")
14749 (set_attr "type" "sseimul")
14750 (set_attr "prefix_data16" "1,*,*")
14751 (set_attr "prefix_extra" "1")
14752 (set_attr "prefix" "orig,maybe_evex,evex")
14753 (set_attr "mode" "<sseinsnmode>")])
14755 (define_insn "*ssse3_pmulhrswv4hi3"
14756 [(set (match_operand:V4HI 0 "register_operand" "=y")
14763 (match_operand:V4HI 1 "nonimmediate_operand" "%0"))
14765 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))
14767 (match_operand:V4HI 3 "const1_operand"))
14769 "TARGET_SSSE3 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
14770 "pmulhrsw\t{%2, %0|%0, %2}"
14771 [(set_attr "type" "sseimul")
14772 (set_attr "prefix_extra" "1")
14773 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14774 (set_attr "mode" "DI")])
14776 (define_insn "<ssse3_avx2>_pshufb<mode>3<mask_name>"
14777 [(set (match_operand:VI1_AVX512 0 "register_operand" "=x,x,v")
14779 [(match_operand:VI1_AVX512 1 "register_operand" "0,x,v")
14780 (match_operand:VI1_AVX512 2 "vector_operand" "xBm,xm,vm")]
14782 "TARGET_SSSE3 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
14784 pshufb\t{%2, %0|%0, %2}
14785 vpshufb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
14786 vpshufb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
14787 [(set_attr "isa" "noavx,avx,avx512bw")
14788 (set_attr "type" "sselog1")
14789 (set_attr "prefix_data16" "1,*,*")
14790 (set_attr "prefix_extra" "1")
14791 (set_attr "prefix" "orig,maybe_evex,evex")
14792 (set_attr "btver2_decode" "vector")
14793 (set_attr "mode" "<sseinsnmode>")])
14795 (define_insn "ssse3_pshufbv8qi3"
14796 [(set (match_operand:V8QI 0 "register_operand" "=y")
14797 (unspec:V8QI [(match_operand:V8QI 1 "register_operand" "0")
14798 (match_operand:V8QI 2 "nonimmediate_operand" "ym")]
14801 "pshufb\t{%2, %0|%0, %2}";
14802 [(set_attr "type" "sselog1")
14803 (set_attr "prefix_extra" "1")
14804 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14805 (set_attr "mode" "DI")])
14807 (define_insn "<ssse3_avx2>_psign<mode>3"
14808 [(set (match_operand:VI124_AVX2 0 "register_operand" "=x,x")
14810 [(match_operand:VI124_AVX2 1 "register_operand" "0,x")
14811 (match_operand:VI124_AVX2 2 "vector_operand" "xBm,xm")]
14815 psign<ssemodesuffix>\t{%2, %0|%0, %2}
14816 vpsign<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
14817 [(set_attr "isa" "noavx,avx")
14818 (set_attr "type" "sselog1")
14819 (set_attr "prefix_data16" "1,*")
14820 (set_attr "prefix_extra" "1")
14821 (set_attr "prefix" "orig,vex")
14822 (set_attr "mode" "<sseinsnmode>")])
14824 (define_insn "ssse3_psign<mode>3"
14825 [(set (match_operand:MMXMODEI 0 "register_operand" "=y")
14827 [(match_operand:MMXMODEI 1 "register_operand" "0")
14828 (match_operand:MMXMODEI 2 "nonimmediate_operand" "ym")]
14831 "psign<mmxvecsize>\t{%2, %0|%0, %2}";
14832 [(set_attr "type" "sselog1")
14833 (set_attr "prefix_extra" "1")
14834 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14835 (set_attr "mode" "DI")])
14837 (define_insn "<ssse3_avx2>_palignr<mode>_mask"
14838 [(set (match_operand:VI1_AVX512 0 "register_operand" "=v")
14839 (vec_merge:VI1_AVX512
14841 [(match_operand:VI1_AVX512 1 "register_operand" "v")
14842 (match_operand:VI1_AVX512 2 "nonimmediate_operand" "vm")
14843 (match_operand:SI 3 "const_0_to_255_mul_8_operand" "n")]
14845 (match_operand:VI1_AVX512 4 "vector_move_operand" "0C")
14846 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
14847 "TARGET_AVX512BW && (<MODE_SIZE> == 64 || TARGET_AVX512VL)"
14849 operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
14850 return "vpalignr\t{%3, %2, %1, %0%{%5%}%N4|%0%{%5%}%N4, %1, %2, %3}";
14852 [(set_attr "type" "sseishft")
14853 (set_attr "atom_unit" "sishuf")
14854 (set_attr "prefix_extra" "1")
14855 (set_attr "length_immediate" "1")
14856 (set_attr "prefix" "evex")
14857 (set_attr "mode" "<sseinsnmode>")])
14859 (define_insn "<ssse3_avx2>_palignr<mode>"
14860 [(set (match_operand:SSESCALARMODE 0 "register_operand" "=x,x,v")
14861 (unspec:SSESCALARMODE
14862 [(match_operand:SSESCALARMODE 1 "register_operand" "0,x,v")
14863 (match_operand:SSESCALARMODE 2 "vector_operand" "xBm,xm,vm")
14864 (match_operand:SI 3 "const_0_to_255_mul_8_operand" "n,n,n")]
14868 operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
14870 switch (which_alternative)
14873 return "palignr\t{%3, %2, %0|%0, %2, %3}";
14876 return "vpalignr\t{%3, %2, %1, %0|%0, %1, %2, %3}";
14878 gcc_unreachable ();
14881 [(set_attr "isa" "noavx,avx,avx512bw")
14882 (set_attr "type" "sseishft")
14883 (set_attr "atom_unit" "sishuf")
14884 (set_attr "prefix_data16" "1,*,*")
14885 (set_attr "prefix_extra" "1")
14886 (set_attr "length_immediate" "1")
14887 (set_attr "prefix" "orig,vex,evex")
14888 (set_attr "mode" "<sseinsnmode>")])
14890 (define_insn "ssse3_palignrdi"
14891 [(set (match_operand:DI 0 "register_operand" "=y")
14892 (unspec:DI [(match_operand:DI 1 "register_operand" "0")
14893 (match_operand:DI 2 "nonimmediate_operand" "ym")
14894 (match_operand:SI 3 "const_0_to_255_mul_8_operand" "n")]
14898 operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
14899 return "palignr\t{%3, %2, %0|%0, %2, %3}";
14901 [(set_attr "type" "sseishft")
14902 (set_attr "atom_unit" "sishuf")
14903 (set_attr "prefix_extra" "1")
14904 (set_attr "length_immediate" "1")
14905 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14906 (set_attr "mode" "DI")])
14908 ;; Mode iterator to handle singularity w/ absence of V2DI and V4DI
14909 ;; modes for abs instruction on pre AVX-512 targets.
14910 (define_mode_iterator VI1248_AVX512VL_AVX512BW
14911 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI
14912 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI
14913 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX2") V4SI
14914 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")])
14916 (define_insn "*abs<mode>2"
14917 [(set (match_operand:VI1248_AVX512VL_AVX512BW 0 "register_operand" "=v")
14918 (abs:VI1248_AVX512VL_AVX512BW
14919 (match_operand:VI1248_AVX512VL_AVX512BW 1 "vector_operand" "vBm")))]
14921 "%vpabs<ssemodesuffix>\t{%1, %0|%0, %1}"
14922 [(set_attr "type" "sselog1")
14923 (set_attr "prefix_data16" "1")
14924 (set_attr "prefix_extra" "1")
14925 (set_attr "prefix" "maybe_vex")
14926 (set_attr "mode" "<sseinsnmode>")])
14928 (define_insn "abs<mode>2_mask"
14929 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
14930 (vec_merge:VI48_AVX512VL
14932 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm"))
14933 (match_operand:VI48_AVX512VL 2 "vector_move_operand" "0C")
14934 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
14936 "vpabs<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
14937 [(set_attr "type" "sselog1")
14938 (set_attr "prefix" "evex")
14939 (set_attr "mode" "<sseinsnmode>")])
14941 (define_insn "abs<mode>2_mask"
14942 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
14943 (vec_merge:VI12_AVX512VL
14945 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "vm"))
14946 (match_operand:VI12_AVX512VL 2 "vector_move_operand" "0C")
14947 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
14949 "vpabs<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
14950 [(set_attr "type" "sselog1")
14951 (set_attr "prefix" "evex")
14952 (set_attr "mode" "<sseinsnmode>")])
14954 (define_expand "abs<mode>2"
14955 [(set (match_operand:VI1248_AVX512VL_AVX512BW 0 "register_operand")
14956 (abs:VI1248_AVX512VL_AVX512BW
14957 (match_operand:VI1248_AVX512VL_AVX512BW 1 "vector_operand")))]
14962 ix86_expand_sse2_abs (operands[0], operands[1]);
14967 (define_insn "abs<mode>2"
14968 [(set (match_operand:MMXMODEI 0 "register_operand" "=y")
14970 (match_operand:MMXMODEI 1 "nonimmediate_operand" "ym")))]
14972 "pabs<mmxvecsize>\t{%1, %0|%0, %1}";
14973 [(set_attr "type" "sselog1")
14974 (set_attr "prefix_rep" "0")
14975 (set_attr "prefix_extra" "1")
14976 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14977 (set_attr "mode" "DI")])
14979 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14981 ;; AMD SSE4A instructions
14983 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14985 (define_insn "sse4a_movnt<mode>"
14986 [(set (match_operand:MODEF 0 "memory_operand" "=m")
14988 [(match_operand:MODEF 1 "register_operand" "x")]
14991 "movnt<ssemodesuffix>\t{%1, %0|%0, %1}"
14992 [(set_attr "type" "ssemov")
14993 (set_attr "mode" "<MODE>")])
14995 (define_insn "sse4a_vmmovnt<mode>"
14996 [(set (match_operand:<ssescalarmode> 0 "memory_operand" "=m")
14997 (unspec:<ssescalarmode>
14998 [(vec_select:<ssescalarmode>
14999 (match_operand:VF_128 1 "register_operand" "x")
15000 (parallel [(const_int 0)]))]
15003 "movnt<ssescalarmodesuffix>\t{%1, %0|%0, %1}"
15004 [(set_attr "type" "ssemov")
15005 (set_attr "mode" "<ssescalarmode>")])
15007 (define_insn "sse4a_extrqi"
15008 [(set (match_operand:V2DI 0 "register_operand" "=x")
15009 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
15010 (match_operand 2 "const_0_to_255_operand")
15011 (match_operand 3 "const_0_to_255_operand")]
15014 "extrq\t{%3, %2, %0|%0, %2, %3}"
15015 [(set_attr "type" "sse")
15016 (set_attr "prefix_data16" "1")
15017 (set_attr "length_immediate" "2")
15018 (set_attr "mode" "TI")])
15020 (define_insn "sse4a_extrq"
15021 [(set (match_operand:V2DI 0 "register_operand" "=x")
15022 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
15023 (match_operand:V16QI 2 "register_operand" "x")]
15026 "extrq\t{%2, %0|%0, %2}"
15027 [(set_attr "type" "sse")
15028 (set_attr "prefix_data16" "1")
15029 (set_attr "mode" "TI")])
15031 (define_insn "sse4a_insertqi"
15032 [(set (match_operand:V2DI 0 "register_operand" "=x")
15033 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
15034 (match_operand:V2DI 2 "register_operand" "x")
15035 (match_operand 3 "const_0_to_255_operand")
15036 (match_operand 4 "const_0_to_255_operand")]
15039 "insertq\t{%4, %3, %2, %0|%0, %2, %3, %4}"
15040 [(set_attr "type" "sseins")
15041 (set_attr "prefix_data16" "0")
15042 (set_attr "prefix_rep" "1")
15043 (set_attr "length_immediate" "2")
15044 (set_attr "mode" "TI")])
15046 (define_insn "sse4a_insertq"
15047 [(set (match_operand:V2DI 0 "register_operand" "=x")
15048 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
15049 (match_operand:V2DI 2 "register_operand" "x")]
15052 "insertq\t{%2, %0|%0, %2}"
15053 [(set_attr "type" "sseins")
15054 (set_attr "prefix_data16" "0")
15055 (set_attr "prefix_rep" "1")
15056 (set_attr "mode" "TI")])
15058 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15060 ;; Intel SSE4.1 instructions
15062 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15064 ;; Mapping of immediate bits for blend instructions
15065 (define_mode_attr blendbits
15066 [(V8SF "255") (V4SF "15") (V4DF "15") (V2DF "3")])
15068 (define_insn "<sse4_1>_blend<ssemodesuffix><avxsizesuffix>"
15069 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
15070 (vec_merge:VF_128_256
15071 (match_operand:VF_128_256 2 "vector_operand" "YrBm,*xBm,xm")
15072 (match_operand:VF_128_256 1 "register_operand" "0,0,x")
15073 (match_operand:SI 3 "const_0_to_<blendbits>_operand")))]
15076 blend<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15077 blend<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15078 vblend<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15079 [(set_attr "isa" "noavx,noavx,avx")
15080 (set_attr "type" "ssemov")
15081 (set_attr "length_immediate" "1")
15082 (set_attr "prefix_data16" "1,1,*")
15083 (set_attr "prefix_extra" "1")
15084 (set_attr "prefix" "orig,orig,vex")
15085 (set_attr "mode" "<MODE>")])
15087 (define_insn "<sse4_1>_blendv<ssemodesuffix><avxsizesuffix>"
15088 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
15090 [(match_operand:VF_128_256 1 "register_operand" "0,0,x")
15091 (match_operand:VF_128_256 2 "vector_operand" "YrBm,*xBm,xm")
15092 (match_operand:VF_128_256 3 "register_operand" "Yz,Yz,x")]
15096 blendv<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15097 blendv<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15098 vblendv<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15099 [(set_attr "isa" "noavx,noavx,avx")
15100 (set_attr "type" "ssemov")
15101 (set_attr "length_immediate" "1")
15102 (set_attr "prefix_data16" "1,1,*")
15103 (set_attr "prefix_extra" "1")
15104 (set_attr "prefix" "orig,orig,vex")
15105 (set_attr "btver2_decode" "vector,vector,vector")
15106 (set_attr "mode" "<MODE>")])
15108 (define_insn "<sse4_1>_dp<ssemodesuffix><avxsizesuffix>"
15109 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
15111 [(match_operand:VF_128_256 1 "vector_operand" "%0,0,x")
15112 (match_operand:VF_128_256 2 "vector_operand" "YrBm,*xBm,xm")
15113 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")]
15117 dp<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15118 dp<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15119 vdp<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15120 [(set_attr "isa" "noavx,noavx,avx")
15121 (set_attr "type" "ssemul")
15122 (set_attr "length_immediate" "1")
15123 (set_attr "prefix_data16" "1,1,*")
15124 (set_attr "prefix_extra" "1")
15125 (set_attr "prefix" "orig,orig,vex")
15126 (set_attr "btver2_decode" "vector,vector,vector")
15127 (set_attr "znver1_decode" "vector,vector,vector")
15128 (set_attr "mode" "<MODE>")])
15130 ;; Mode attribute used by `vmovntdqa' pattern
15131 (define_mode_attr vi8_sse4_1_avx2_avx512
15132 [(V2DI "sse4_1") (V4DI "avx2") (V8DI "avx512f")])
15134 (define_insn "<vi8_sse4_1_avx2_avx512>_movntdqa"
15135 [(set (match_operand:VI8_AVX2_AVX512F 0 "register_operand" "=Yr,*x,v")
15136 (unspec:VI8_AVX2_AVX512F [(match_operand:VI8_AVX2_AVX512F 1 "memory_operand" "m,m,m")]
15139 "%vmovntdqa\t{%1, %0|%0, %1}"
15140 [(set_attr "isa" "noavx,noavx,avx")
15141 (set_attr "type" "ssemov")
15142 (set_attr "prefix_extra" "1,1,*")
15143 (set_attr "prefix" "orig,orig,maybe_evex")
15144 (set_attr "mode" "<sseinsnmode>")])
15146 (define_insn "<sse4_1_avx2>_mpsadbw"
15147 [(set (match_operand:VI1_AVX2 0 "register_operand" "=Yr,*x,x")
15149 [(match_operand:VI1_AVX2 1 "register_operand" "0,0,x")
15150 (match_operand:VI1_AVX2 2 "vector_operand" "YrBm,*xBm,xm")
15151 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")]
15155 mpsadbw\t{%3, %2, %0|%0, %2, %3}
15156 mpsadbw\t{%3, %2, %0|%0, %2, %3}
15157 vmpsadbw\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15158 [(set_attr "isa" "noavx,noavx,avx")
15159 (set_attr "type" "sselog1")
15160 (set_attr "length_immediate" "1")
15161 (set_attr "prefix_extra" "1")
15162 (set_attr "prefix" "orig,orig,vex")
15163 (set_attr "btver2_decode" "vector,vector,vector")
15164 (set_attr "znver1_decode" "vector,vector,vector")
15165 (set_attr "mode" "<sseinsnmode>")])
15167 (define_insn "<sse4_1_avx2>_packusdw<mask_name>"
15168 [(set (match_operand:VI2_AVX2 0 "register_operand" "=Yr,*x,x,v")
15169 (vec_concat:VI2_AVX2
15170 (us_truncate:<ssehalfvecmode>
15171 (match_operand:<sseunpackmode> 1 "register_operand" "0,0,x,v"))
15172 (us_truncate:<ssehalfvecmode>
15173 (match_operand:<sseunpackmode> 2 "vector_operand" "YrBm,*xBm,xm,vm"))))]
15174 "TARGET_SSE4_1 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
15176 packusdw\t{%2, %0|%0, %2}
15177 packusdw\t{%2, %0|%0, %2}
15178 vpackusdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
15179 vpackusdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
15180 [(set_attr "isa" "noavx,noavx,avx,avx512bw")
15181 (set_attr "type" "sselog")
15182 (set_attr "prefix_extra" "1")
15183 (set_attr "prefix" "orig,orig,<mask_prefix>,evex")
15184 (set_attr "mode" "<sseinsnmode>")])
15186 (define_insn "<sse4_1_avx2>_pblendvb"
15187 [(set (match_operand:VI1_AVX2 0 "register_operand" "=Yr,*x,x")
15189 [(match_operand:VI1_AVX2 1 "register_operand" "0,0,x")
15190 (match_operand:VI1_AVX2 2 "vector_operand" "YrBm,*xBm,xm")
15191 (match_operand:VI1_AVX2 3 "register_operand" "Yz,Yz,x")]
15195 pblendvb\t{%3, %2, %0|%0, %2, %3}
15196 pblendvb\t{%3, %2, %0|%0, %2, %3}
15197 vpblendvb\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15198 [(set_attr "isa" "noavx,noavx,avx")
15199 (set_attr "type" "ssemov")
15200 (set_attr "prefix_extra" "1")
15201 (set_attr "length_immediate" "*,*,1")
15202 (set_attr "prefix" "orig,orig,vex")
15203 (set_attr "btver2_decode" "vector,vector,vector")
15204 (set_attr "mode" "<sseinsnmode>")])
15206 (define_insn "sse4_1_pblendw"
15207 [(set (match_operand:V8HI 0 "register_operand" "=Yr,*x,x")
15209 (match_operand:V8HI 2 "vector_operand" "YrBm,*xBm,xm")
15210 (match_operand:V8HI 1 "register_operand" "0,0,x")
15211 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")))]
15214 pblendw\t{%3, %2, %0|%0, %2, %3}
15215 pblendw\t{%3, %2, %0|%0, %2, %3}
15216 vpblendw\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15217 [(set_attr "isa" "noavx,noavx,avx")
15218 (set_attr "type" "ssemov")
15219 (set_attr "prefix_extra" "1")
15220 (set_attr "length_immediate" "1")
15221 (set_attr "prefix" "orig,orig,vex")
15222 (set_attr "mode" "TI")])
15224 ;; The builtin uses an 8-bit immediate. Expand that.
15225 (define_expand "avx2_pblendw"
15226 [(set (match_operand:V16HI 0 "register_operand")
15228 (match_operand:V16HI 2 "nonimmediate_operand")
15229 (match_operand:V16HI 1 "register_operand")
15230 (match_operand:SI 3 "const_0_to_255_operand")))]
15233 HOST_WIDE_INT val = INTVAL (operands[3]) & 0xff;
15234 operands[3] = GEN_INT (val << 8 | val);
15237 (define_insn "*avx2_pblendw"
15238 [(set (match_operand:V16HI 0 "register_operand" "=x")
15240 (match_operand:V16HI 2 "nonimmediate_operand" "xm")
15241 (match_operand:V16HI 1 "register_operand" "x")
15242 (match_operand:SI 3 "avx2_pblendw_operand" "n")))]
15245 operands[3] = GEN_INT (INTVAL (operands[3]) & 0xff);
15246 return "vpblendw\t{%3, %2, %1, %0|%0, %1, %2, %3}";
15248 [(set_attr "type" "ssemov")
15249 (set_attr "prefix_extra" "1")
15250 (set_attr "length_immediate" "1")
15251 (set_attr "prefix" "vex")
15252 (set_attr "mode" "OI")])
15254 (define_insn "avx2_pblendd<mode>"
15255 [(set (match_operand:VI4_AVX2 0 "register_operand" "=x")
15256 (vec_merge:VI4_AVX2
15257 (match_operand:VI4_AVX2 2 "nonimmediate_operand" "xm")
15258 (match_operand:VI4_AVX2 1 "register_operand" "x")
15259 (match_operand:SI 3 "const_0_to_255_operand" "n")))]
15261 "vpblendd\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15262 [(set_attr "type" "ssemov")
15263 (set_attr "prefix_extra" "1")
15264 (set_attr "length_immediate" "1")
15265 (set_attr "prefix" "vex")
15266 (set_attr "mode" "<sseinsnmode>")])
15268 (define_insn "sse4_1_phminposuw"
15269 [(set (match_operand:V8HI 0 "register_operand" "=Yr,*x,x")
15270 (unspec:V8HI [(match_operand:V8HI 1 "vector_operand" "YrBm,*xBm,xm")]
15271 UNSPEC_PHMINPOSUW))]
15273 "%vphminposuw\t{%1, %0|%0, %1}"
15274 [(set_attr "isa" "noavx,noavx,avx")
15275 (set_attr "type" "sselog1")
15276 (set_attr "prefix_extra" "1")
15277 (set_attr "prefix" "orig,orig,vex")
15278 (set_attr "mode" "TI")])
15280 (define_insn "avx2_<code>v16qiv16hi2<mask_name>"
15281 [(set (match_operand:V16HI 0 "register_operand" "=v")
15283 (match_operand:V16QI 1 "nonimmediate_operand" "vm")))]
15284 "TARGET_AVX2 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
15285 "vpmov<extsuffix>bw\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15286 [(set_attr "type" "ssemov")
15287 (set_attr "prefix_extra" "1")
15288 (set_attr "prefix" "maybe_evex")
15289 (set_attr "mode" "OI")])
15291 (define_insn "avx512bw_<code>v32qiv32hi2<mask_name>"
15292 [(set (match_operand:V32HI 0 "register_operand" "=v")
15294 (match_operand:V32QI 1 "nonimmediate_operand" "vm")))]
15296 "vpmov<extsuffix>bw\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15297 [(set_attr "type" "ssemov")
15298 (set_attr "prefix_extra" "1")
15299 (set_attr "prefix" "evex")
15300 (set_attr "mode" "XI")])
15302 (define_insn "sse4_1_<code>v8qiv8hi2<mask_name>"
15303 [(set (match_operand:V8HI 0 "register_operand" "=Yr,*x,v")
15306 (match_operand:V16QI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15307 (parallel [(const_int 0) (const_int 1)
15308 (const_int 2) (const_int 3)
15309 (const_int 4) (const_int 5)
15310 (const_int 6) (const_int 7)]))))]
15311 "TARGET_SSE4_1 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
15312 "%vpmov<extsuffix>bw\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15313 [(set_attr "isa" "noavx,noavx,avx")
15314 (set_attr "type" "ssemov")
15315 (set_attr "prefix_extra" "1")
15316 (set_attr "prefix" "orig,orig,maybe_evex")
15317 (set_attr "mode" "TI")])
15319 (define_insn "<mask_codefor>avx512f_<code>v16qiv16si2<mask_name>"
15320 [(set (match_operand:V16SI 0 "register_operand" "=v")
15322 (match_operand:V16QI 1 "nonimmediate_operand" "vm")))]
15324 "vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15325 [(set_attr "type" "ssemov")
15326 (set_attr "prefix" "evex")
15327 (set_attr "mode" "XI")])
15329 (define_insn "avx2_<code>v8qiv8si2<mask_name>"
15330 [(set (match_operand:V8SI 0 "register_operand" "=v")
15333 (match_operand:V16QI 1 "nonimmediate_operand" "vm")
15334 (parallel [(const_int 0) (const_int 1)
15335 (const_int 2) (const_int 3)
15336 (const_int 4) (const_int 5)
15337 (const_int 6) (const_int 7)]))))]
15338 "TARGET_AVX2 && <mask_avx512vl_condition>"
15339 "vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15340 [(set_attr "type" "ssemov")
15341 (set_attr "prefix_extra" "1")
15342 (set_attr "prefix" "maybe_evex")
15343 (set_attr "mode" "OI")])
15345 (define_insn "sse4_1_<code>v4qiv4si2<mask_name>"
15346 [(set (match_operand:V4SI 0 "register_operand" "=Yr,*x,v")
15349 (match_operand:V16QI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15350 (parallel [(const_int 0) (const_int 1)
15351 (const_int 2) (const_int 3)]))))]
15352 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15353 "%vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
15354 [(set_attr "isa" "noavx,noavx,avx")
15355 (set_attr "type" "ssemov")
15356 (set_attr "prefix_extra" "1")
15357 (set_attr "prefix" "orig,orig,maybe_evex")
15358 (set_attr "mode" "TI")])
15360 (define_insn "avx512f_<code>v16hiv16si2<mask_name>"
15361 [(set (match_operand:V16SI 0 "register_operand" "=v")
15363 (match_operand:V16HI 1 "nonimmediate_operand" "vm")))]
15365 "vpmov<extsuffix>wd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15366 [(set_attr "type" "ssemov")
15367 (set_attr "prefix" "evex")
15368 (set_attr "mode" "XI")])
15370 (define_insn "avx2_<code>v8hiv8si2<mask_name>"
15371 [(set (match_operand:V8SI 0 "register_operand" "=v")
15373 (match_operand:V8HI 1 "nonimmediate_operand" "vm")))]
15374 "TARGET_AVX2 && <mask_avx512vl_condition>"
15375 "vpmov<extsuffix>wd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15376 [(set_attr "type" "ssemov")
15377 (set_attr "prefix_extra" "1")
15378 (set_attr "prefix" "maybe_evex")
15379 (set_attr "mode" "OI")])
15381 (define_insn "sse4_1_<code>v4hiv4si2<mask_name>"
15382 [(set (match_operand:V4SI 0 "register_operand" "=Yr,*x,v")
15385 (match_operand:V8HI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15386 (parallel [(const_int 0) (const_int 1)
15387 (const_int 2) (const_int 3)]))))]
15388 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15389 "%vpmov<extsuffix>wd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15390 [(set_attr "isa" "noavx,noavx,avx")
15391 (set_attr "type" "ssemov")
15392 (set_attr "prefix_extra" "1")
15393 (set_attr "prefix" "orig,orig,maybe_evex")
15394 (set_attr "mode" "TI")])
15396 (define_insn "avx512f_<code>v8qiv8di2<mask_name>"
15397 [(set (match_operand:V8DI 0 "register_operand" "=v")
15400 (match_operand:V16QI 1 "nonimmediate_operand" "vm")
15401 (parallel [(const_int 0) (const_int 1)
15402 (const_int 2) (const_int 3)
15403 (const_int 4) (const_int 5)
15404 (const_int 6) (const_int 7)]))))]
15406 "vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
15407 [(set_attr "type" "ssemov")
15408 (set_attr "prefix" "evex")
15409 (set_attr "mode" "XI")])
15411 (define_insn "avx2_<code>v4qiv4di2<mask_name>"
15412 [(set (match_operand:V4DI 0 "register_operand" "=v")
15415 (match_operand:V16QI 1 "nonimmediate_operand" "vm")
15416 (parallel [(const_int 0) (const_int 1)
15417 (const_int 2) (const_int 3)]))))]
15418 "TARGET_AVX2 && <mask_avx512vl_condition>"
15419 "vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
15420 [(set_attr "type" "ssemov")
15421 (set_attr "prefix_extra" "1")
15422 (set_attr "prefix" "maybe_evex")
15423 (set_attr "mode" "OI")])
15425 (define_insn "sse4_1_<code>v2qiv2di2<mask_name>"
15426 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
15429 (match_operand:V16QI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15430 (parallel [(const_int 0) (const_int 1)]))))]
15431 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15432 "%vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %w1}"
15433 [(set_attr "isa" "noavx,noavx,avx")
15434 (set_attr "type" "ssemov")
15435 (set_attr "prefix_extra" "1")
15436 (set_attr "prefix" "orig,orig,maybe_evex")
15437 (set_attr "mode" "TI")])
15439 (define_insn "avx512f_<code>v8hiv8di2<mask_name>"
15440 [(set (match_operand:V8DI 0 "register_operand" "=v")
15442 (match_operand:V8HI 1 "nonimmediate_operand" "vm")))]
15444 "vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15445 [(set_attr "type" "ssemov")
15446 (set_attr "prefix" "evex")
15447 (set_attr "mode" "XI")])
15449 (define_insn "avx2_<code>v4hiv4di2<mask_name>"
15450 [(set (match_operand:V4DI 0 "register_operand" "=v")
15453 (match_operand:V8HI 1 "nonimmediate_operand" "vm")
15454 (parallel [(const_int 0) (const_int 1)
15455 (const_int 2) (const_int 3)]))))]
15456 "TARGET_AVX2 && <mask_avx512vl_condition>"
15457 "vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15458 [(set_attr "type" "ssemov")
15459 (set_attr "prefix_extra" "1")
15460 (set_attr "prefix" "maybe_evex")
15461 (set_attr "mode" "OI")])
15463 (define_insn "sse4_1_<code>v2hiv2di2<mask_name>"
15464 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
15467 (match_operand:V8HI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15468 (parallel [(const_int 0) (const_int 1)]))))]
15469 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15470 "%vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
15471 [(set_attr "isa" "noavx,noavx,avx")
15472 (set_attr "type" "ssemov")
15473 (set_attr "prefix_extra" "1")
15474 (set_attr "prefix" "orig,orig,maybe_evex")
15475 (set_attr "mode" "TI")])
15477 (define_insn "avx512f_<code>v8siv8di2<mask_name>"
15478 [(set (match_operand:V8DI 0 "register_operand" "=v")
15480 (match_operand:V8SI 1 "nonimmediate_operand" "vm")))]
15482 "vpmov<extsuffix>dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15483 [(set_attr "type" "ssemov")
15484 (set_attr "prefix" "evex")
15485 (set_attr "mode" "XI")])
15487 (define_insn "avx2_<code>v4siv4di2<mask_name>"
15488 [(set (match_operand:V4DI 0 "register_operand" "=v")
15490 (match_operand:V4SI 1 "nonimmediate_operand" "vm")))]
15491 "TARGET_AVX2 && <mask_avx512vl_condition>"
15492 "vpmov<extsuffix>dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15493 [(set_attr "type" "ssemov")
15494 (set_attr "prefix" "maybe_evex")
15495 (set_attr "prefix_extra" "1")
15496 (set_attr "mode" "OI")])
15498 (define_insn "sse4_1_<code>v2siv2di2<mask_name>"
15499 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
15502 (match_operand:V4SI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15503 (parallel [(const_int 0) (const_int 1)]))))]
15504 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15505 "%vpmov<extsuffix>dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15506 [(set_attr "isa" "noavx,noavx,avx")
15507 (set_attr "type" "ssemov")
15508 (set_attr "prefix_extra" "1")
15509 (set_attr "prefix" "orig,orig,maybe_evex")
15510 (set_attr "mode" "TI")])
15512 ;; ptestps/ptestpd are very similar to comiss and ucomiss when
15513 ;; setting FLAGS_REG. But it is not a really compare instruction.
15514 (define_insn "avx_vtest<ssemodesuffix><avxsizesuffix>"
15515 [(set (reg:CC FLAGS_REG)
15516 (unspec:CC [(match_operand:VF_128_256 0 "register_operand" "x")
15517 (match_operand:VF_128_256 1 "nonimmediate_operand" "xm")]
15520 "vtest<ssemodesuffix>\t{%1, %0|%0, %1}"
15521 [(set_attr "type" "ssecomi")
15522 (set_attr "prefix_extra" "1")
15523 (set_attr "prefix" "vex")
15524 (set_attr "mode" "<MODE>")])
15526 ;; ptest is very similar to comiss and ucomiss when setting FLAGS_REG.
15527 ;; But it is not a really compare instruction.
15528 (define_insn "<sse4_1>_ptest<mode>"
15529 [(set (reg:CC FLAGS_REG)
15530 (unspec:CC [(match_operand:V_AVX 0 "register_operand" "Yr, *x, x")
15531 (match_operand:V_AVX 1 "vector_operand" "YrBm, *xBm, xm")]
15534 "%vptest\t{%1, %0|%0, %1}"
15535 [(set_attr "isa" "noavx,noavx,avx")
15536 (set_attr "type" "ssecomi")
15537 (set_attr "prefix_extra" "1")
15538 (set_attr "prefix" "orig,orig,vex")
15539 (set (attr "btver2_decode")
15541 (match_test "<sseinsnmode>mode==OImode")
15542 (const_string "vector")
15543 (const_string "*")))
15544 (set_attr "mode" "<sseinsnmode>")])
15546 (define_insn "ptesttf2"
15547 [(set (reg:CC FLAGS_REG)
15548 (unspec:CC [(match_operand:TF 0 "register_operand" "Yr, *x, x")
15549 (match_operand:TF 1 "vector_operand" "YrBm, *xBm, xm")]
15552 "%vptest\t{%1, %0|%0, %1}"
15553 [(set_attr "isa" "noavx,noavx,avx")
15554 (set_attr "type" "ssecomi")
15555 (set_attr "prefix_extra" "1")
15556 (set_attr "prefix" "orig,orig,vex")
15557 (set_attr "mode" "TI")])
15559 (define_insn "<sse4_1>_round<ssemodesuffix><avxsizesuffix>"
15560 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
15562 [(match_operand:VF_128_256 1 "vector_operand" "YrBm,*xBm,xm")
15563 (match_operand:SI 2 "const_0_to_15_operand" "n,n,n")]
15566 "%vround<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
15567 [(set_attr "isa" "noavx,noavx,avx")
15568 (set_attr "type" "ssecvt")
15569 (set_attr "prefix_data16" "1,1,*")
15570 (set_attr "prefix_extra" "1")
15571 (set_attr "length_immediate" "1")
15572 (set_attr "prefix" "orig,orig,vex")
15573 (set_attr "mode" "<MODE>")])
15575 (define_expand "<sse4_1>_round<ssemodesuffix>_sfix<avxsizesuffix>"
15576 [(match_operand:<sseintvecmode> 0 "register_operand")
15577 (match_operand:VF1_128_256 1 "vector_operand")
15578 (match_operand:SI 2 "const_0_to_15_operand")]
15581 rtx tmp = gen_reg_rtx (<MODE>mode);
15584 (gen_<sse4_1>_round<ssemodesuffix><avxsizesuffix> (tmp, operands[1],
15587 (gen_fix_trunc<mode><sseintvecmodelower>2 (operands[0], tmp));
15591 (define_expand "avx512f_round<castmode>512"
15592 [(match_operand:VF_512 0 "register_operand")
15593 (match_operand:VF_512 1 "nonimmediate_operand")
15594 (match_operand:SI 2 "const_0_to_15_operand")]
15597 emit_insn (gen_avx512f_rndscale<mode> (operands[0], operands[1], operands[2]));
15601 (define_expand "avx512f_roundps512_sfix"
15602 [(match_operand:V16SI 0 "register_operand")
15603 (match_operand:V16SF 1 "nonimmediate_operand")
15604 (match_operand:SI 2 "const_0_to_15_operand")]
15607 rtx tmp = gen_reg_rtx (V16SFmode);
15608 emit_insn (gen_avx512f_rndscalev16sf (tmp, operands[1], operands[2]));
15609 emit_insn (gen_fix_truncv16sfv16si2 (operands[0], tmp));
15613 (define_expand "<sse4_1>_round<ssemodesuffix>_vec_pack_sfix<avxsizesuffix>"
15614 [(match_operand:<ssepackfltmode> 0 "register_operand")
15615 (match_operand:VF2 1 "vector_operand")
15616 (match_operand:VF2 2 "vector_operand")
15617 (match_operand:SI 3 "const_0_to_15_operand")]
15622 if (<MODE>mode == V2DFmode
15623 && TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
15625 rtx tmp2 = gen_reg_rtx (V4DFmode);
15627 tmp0 = gen_reg_rtx (V4DFmode);
15628 tmp1 = force_reg (V2DFmode, operands[1]);
15630 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
15631 emit_insn (gen_avx_roundpd256 (tmp2, tmp0, operands[3]));
15632 emit_insn (gen_fix_truncv4dfv4si2 (operands[0], tmp2));
15636 tmp0 = gen_reg_rtx (<MODE>mode);
15637 tmp1 = gen_reg_rtx (<MODE>mode);
15640 (gen_<sse4_1>_round<ssemodesuffix><avxsizesuffix> (tmp0, operands[1],
15643 (gen_<sse4_1>_round<ssemodesuffix><avxsizesuffix> (tmp1, operands[2],
15646 (gen_vec_pack_sfix_trunc_<mode> (operands[0], tmp0, tmp1));
15651 (define_insn "sse4_1_round<ssescalarmodesuffix>"
15652 [(set (match_operand:VF_128 0 "register_operand" "=Yr,*x,x,v")
15655 [(match_operand:VF_128 2 "register_operand" "Yr,*x,x,v")
15656 (match_operand:SI 3 "const_0_to_15_operand" "n,n,n,n")]
15658 (match_operand:VF_128 1 "register_operand" "0,0,x,v")
15662 round<ssescalarmodesuffix>\t{%3, %2, %0|%0, %2, %3}
15663 round<ssescalarmodesuffix>\t{%3, %2, %0|%0, %2, %3}
15664 vround<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
15665 vrndscale<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15666 [(set_attr "isa" "noavx,noavx,avx,avx512f")
15667 (set_attr "type" "ssecvt")
15668 (set_attr "length_immediate" "1")
15669 (set_attr "prefix_data16" "1,1,*,*")
15670 (set_attr "prefix_extra" "1")
15671 (set_attr "prefix" "orig,orig,vex,evex")
15672 (set_attr "mode" "<MODE>")])
15674 (define_expand "round<mode>2"
15675 [(set (match_dup 3)
15677 (match_operand:VF 1 "register_operand")
15679 (set (match_operand:VF 0 "register_operand")
15681 [(match_dup 3) (match_dup 4)]
15683 "TARGET_SSE4_1 && !flag_trapping_math"
15685 machine_mode scalar_mode;
15686 const struct real_format *fmt;
15687 REAL_VALUE_TYPE pred_half, half_minus_pred_half;
15688 rtx half, vec_half;
15690 scalar_mode = GET_MODE_INNER (<MODE>mode);
15692 /* load nextafter (0.5, 0.0) */
15693 fmt = REAL_MODE_FORMAT (scalar_mode);
15694 real_2expN (&half_minus_pred_half, -(fmt->p) - 1, scalar_mode);
15695 real_arithmetic (&pred_half, MINUS_EXPR, &dconsthalf, &half_minus_pred_half);
15696 half = const_double_from_real_value (pred_half, scalar_mode);
15698 vec_half = ix86_build_const_vector (<MODE>mode, true, half);
15699 vec_half = force_reg (<MODE>mode, vec_half);
15701 operands[2] = gen_reg_rtx (<MODE>mode);
15702 emit_insn (gen_copysign<mode>3 (operands[2], vec_half, operands[1]));
15704 operands[3] = gen_reg_rtx (<MODE>mode);
15705 operands[4] = GEN_INT (ROUND_TRUNC);
15708 (define_expand "round<mode>2_sfix"
15709 [(match_operand:<sseintvecmode> 0 "register_operand")
15710 (match_operand:VF1 1 "register_operand")]
15711 "TARGET_SSE4_1 && !flag_trapping_math"
15713 rtx tmp = gen_reg_rtx (<MODE>mode);
15715 emit_insn (gen_round<mode>2 (tmp, operands[1]));
15718 (gen_fix_trunc<mode><sseintvecmodelower>2 (operands[0], tmp));
15722 (define_expand "round<mode>2_vec_pack_sfix"
15723 [(match_operand:<ssepackfltmode> 0 "register_operand")
15724 (match_operand:VF2 1 "register_operand")
15725 (match_operand:VF2 2 "register_operand")]
15726 "TARGET_SSE4_1 && !flag_trapping_math"
15730 if (<MODE>mode == V2DFmode
15731 && TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
15733 rtx tmp2 = gen_reg_rtx (V4DFmode);
15735 tmp0 = gen_reg_rtx (V4DFmode);
15736 tmp1 = force_reg (V2DFmode, operands[1]);
15738 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
15739 emit_insn (gen_roundv4df2 (tmp2, tmp0));
15740 emit_insn (gen_fix_truncv4dfv4si2 (operands[0], tmp2));
15744 tmp0 = gen_reg_rtx (<MODE>mode);
15745 tmp1 = gen_reg_rtx (<MODE>mode);
15747 emit_insn (gen_round<mode>2 (tmp0, operands[1]));
15748 emit_insn (gen_round<mode>2 (tmp1, operands[2]));
15751 (gen_vec_pack_sfix_trunc_<mode> (operands[0], tmp0, tmp1));
15756 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15758 ;; Intel SSE4.2 string/text processing instructions
15760 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15762 (define_insn_and_split "sse4_2_pcmpestr"
15763 [(set (match_operand:SI 0 "register_operand" "=c,c")
15765 [(match_operand:V16QI 2 "register_operand" "x,x")
15766 (match_operand:SI 3 "register_operand" "a,a")
15767 (match_operand:V16QI 4 "nonimmediate_operand" "x,m")
15768 (match_operand:SI 5 "register_operand" "d,d")
15769 (match_operand:SI 6 "const_0_to_255_operand" "n,n")]
15771 (set (match_operand:V16QI 1 "register_operand" "=Yz,Yz")
15779 (set (reg:CC FLAGS_REG)
15788 && can_create_pseudo_p ()"
15793 int ecx = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[0]));
15794 int xmm0 = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[1]));
15795 int flags = !find_regno_note (curr_insn, REG_UNUSED, FLAGS_REG);
15798 emit_insn (gen_sse4_2_pcmpestri (operands[0], operands[2],
15799 operands[3], operands[4],
15800 operands[5], operands[6]));
15802 emit_insn (gen_sse4_2_pcmpestrm (operands[1], operands[2],
15803 operands[3], operands[4],
15804 operands[5], operands[6]));
15805 if (flags && !(ecx || xmm0))
15806 emit_insn (gen_sse4_2_pcmpestr_cconly (NULL, NULL,
15807 operands[2], operands[3],
15808 operands[4], operands[5],
15810 if (!(flags || ecx || xmm0))
15811 emit_note (NOTE_INSN_DELETED);
15815 [(set_attr "type" "sselog")
15816 (set_attr "prefix_data16" "1")
15817 (set_attr "prefix_extra" "1")
15818 (set_attr "length_immediate" "1")
15819 (set_attr "memory" "none,load")
15820 (set_attr "mode" "TI")])
15822 (define_insn "sse4_2_pcmpestri"
15823 [(set (match_operand:SI 0 "register_operand" "=c,c")
15825 [(match_operand:V16QI 1 "register_operand" "x,x")
15826 (match_operand:SI 2 "register_operand" "a,a")
15827 (match_operand:V16QI 3 "nonimmediate_operand" "x,m")
15828 (match_operand:SI 4 "register_operand" "d,d")
15829 (match_operand:SI 5 "const_0_to_255_operand" "n,n")]
15831 (set (reg:CC FLAGS_REG)
15840 "%vpcmpestri\t{%5, %3, %1|%1, %3, %5}"
15841 [(set_attr "type" "sselog")
15842 (set_attr "prefix_data16" "1")
15843 (set_attr "prefix_extra" "1")
15844 (set_attr "prefix" "maybe_vex")
15845 (set_attr "length_immediate" "1")
15846 (set_attr "btver2_decode" "vector")
15847 (set_attr "memory" "none,load")
15848 (set_attr "mode" "TI")])
15850 (define_insn "sse4_2_pcmpestrm"
15851 [(set (match_operand:V16QI 0 "register_operand" "=Yz,Yz")
15853 [(match_operand:V16QI 1 "register_operand" "x,x")
15854 (match_operand:SI 2 "register_operand" "a,a")
15855 (match_operand:V16QI 3 "nonimmediate_operand" "x,m")
15856 (match_operand:SI 4 "register_operand" "d,d")
15857 (match_operand:SI 5 "const_0_to_255_operand" "n,n")]
15859 (set (reg:CC FLAGS_REG)
15868 "%vpcmpestrm\t{%5, %3, %1|%1, %3, %5}"
15869 [(set_attr "type" "sselog")
15870 (set_attr "prefix_data16" "1")
15871 (set_attr "prefix_extra" "1")
15872 (set_attr "length_immediate" "1")
15873 (set_attr "prefix" "maybe_vex")
15874 (set_attr "btver2_decode" "vector")
15875 (set_attr "memory" "none,load")
15876 (set_attr "mode" "TI")])
15878 (define_insn "sse4_2_pcmpestr_cconly"
15879 [(set (reg:CC FLAGS_REG)
15881 [(match_operand:V16QI 2 "register_operand" "x,x,x,x")
15882 (match_operand:SI 3 "register_operand" "a,a,a,a")
15883 (match_operand:V16QI 4 "nonimmediate_operand" "x,m,x,m")
15884 (match_operand:SI 5 "register_operand" "d,d,d,d")
15885 (match_operand:SI 6 "const_0_to_255_operand" "n,n,n,n")]
15887 (clobber (match_scratch:V16QI 0 "=Yz,Yz,X,X"))
15888 (clobber (match_scratch:SI 1 "= X, X,c,c"))]
15891 %vpcmpestrm\t{%6, %4, %2|%2, %4, %6}
15892 %vpcmpestrm\t{%6, %4, %2|%2, %4, %6}
15893 %vpcmpestri\t{%6, %4, %2|%2, %4, %6}
15894 %vpcmpestri\t{%6, %4, %2|%2, %4, %6}"
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 "memory" "none,load,none,load")
15900 (set_attr "btver2_decode" "vector,vector,vector,vector")
15901 (set_attr "prefix" "maybe_vex")
15902 (set_attr "mode" "TI")])
15904 (define_insn_and_split "sse4_2_pcmpistr"
15905 [(set (match_operand:SI 0 "register_operand" "=c,c")
15907 [(match_operand:V16QI 2 "register_operand" "x,x")
15908 (match_operand:V16QI 3 "nonimmediate_operand" "x,m")
15909 (match_operand:SI 4 "const_0_to_255_operand" "n,n")]
15911 (set (match_operand:V16QI 1 "register_operand" "=Yz,Yz")
15917 (set (reg:CC FLAGS_REG)
15924 && can_create_pseudo_p ()"
15929 int ecx = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[0]));
15930 int xmm0 = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[1]));
15931 int flags = !find_regno_note (curr_insn, REG_UNUSED, FLAGS_REG);
15934 emit_insn (gen_sse4_2_pcmpistri (operands[0], operands[2],
15935 operands[3], operands[4]));
15937 emit_insn (gen_sse4_2_pcmpistrm (operands[1], operands[2],
15938 operands[3], operands[4]));
15939 if (flags && !(ecx || xmm0))
15940 emit_insn (gen_sse4_2_pcmpistr_cconly (NULL, NULL,
15941 operands[2], operands[3],
15943 if (!(flags || ecx || xmm0))
15944 emit_note (NOTE_INSN_DELETED);
15948 [(set_attr "type" "sselog")
15949 (set_attr "prefix_data16" "1")
15950 (set_attr "prefix_extra" "1")
15951 (set_attr "length_immediate" "1")
15952 (set_attr "memory" "none,load")
15953 (set_attr "mode" "TI")])
15955 (define_insn "sse4_2_pcmpistri"
15956 [(set (match_operand:SI 0 "register_operand" "=c,c")
15958 [(match_operand:V16QI 1 "register_operand" "x,x")
15959 (match_operand:V16QI 2 "nonimmediate_operand" "x,m")
15960 (match_operand:SI 3 "const_0_to_255_operand" "n,n")]
15962 (set (reg:CC FLAGS_REG)
15969 "%vpcmpistri\t{%3, %2, %1|%1, %2, %3}"
15970 [(set_attr "type" "sselog")
15971 (set_attr "prefix_data16" "1")
15972 (set_attr "prefix_extra" "1")
15973 (set_attr "length_immediate" "1")
15974 (set_attr "prefix" "maybe_vex")
15975 (set_attr "memory" "none,load")
15976 (set_attr "btver2_decode" "vector")
15977 (set_attr "mode" "TI")])
15979 (define_insn "sse4_2_pcmpistrm"
15980 [(set (match_operand:V16QI 0 "register_operand" "=Yz,Yz")
15982 [(match_operand:V16QI 1 "register_operand" "x,x")
15983 (match_operand:V16QI 2 "nonimmediate_operand" "x,m")
15984 (match_operand:SI 3 "const_0_to_255_operand" "n,n")]
15986 (set (reg:CC FLAGS_REG)
15993 "%vpcmpistrm\t{%3, %2, %1|%1, %2, %3}"
15994 [(set_attr "type" "sselog")
15995 (set_attr "prefix_data16" "1")
15996 (set_attr "prefix_extra" "1")
15997 (set_attr "length_immediate" "1")
15998 (set_attr "prefix" "maybe_vex")
15999 (set_attr "memory" "none,load")
16000 (set_attr "btver2_decode" "vector")
16001 (set_attr "mode" "TI")])
16003 (define_insn "sse4_2_pcmpistr_cconly"
16004 [(set (reg:CC FLAGS_REG)
16006 [(match_operand:V16QI 2 "register_operand" "x,x,x,x")
16007 (match_operand:V16QI 3 "nonimmediate_operand" "x,m,x,m")
16008 (match_operand:SI 4 "const_0_to_255_operand" "n,n,n,n")]
16010 (clobber (match_scratch:V16QI 0 "=Yz,Yz,X,X"))
16011 (clobber (match_scratch:SI 1 "= X, X,c,c"))]
16014 %vpcmpistrm\t{%4, %3, %2|%2, %3, %4}
16015 %vpcmpistrm\t{%4, %3, %2|%2, %3, %4}
16016 %vpcmpistri\t{%4, %3, %2|%2, %3, %4}
16017 %vpcmpistri\t{%4, %3, %2|%2, %3, %4}"
16018 [(set_attr "type" "sselog")
16019 (set_attr "prefix_data16" "1")
16020 (set_attr "prefix_extra" "1")
16021 (set_attr "length_immediate" "1")
16022 (set_attr "memory" "none,load,none,load")
16023 (set_attr "prefix" "maybe_vex")
16024 (set_attr "btver2_decode" "vector,vector,vector,vector")
16025 (set_attr "mode" "TI")])
16027 ;; Packed float variants
16028 (define_mode_attr GATHER_SCATTER_SF_MEM_MODE
16029 [(V8DI "V8SF") (V16SI "V16SF")])
16031 (define_expand "avx512pf_gatherpf<mode>sf"
16033 [(match_operand:<avx512fmaskmode> 0 "register_operand")
16034 (mem:<GATHER_SCATTER_SF_MEM_MODE>
16036 [(match_operand 2 "vsib_address_operand")
16037 (match_operand:VI48_512 1 "register_operand")
16038 (match_operand:SI 3 "const1248_operand")]))
16039 (match_operand:SI 4 "const_2_to_3_operand")]
16040 UNSPEC_GATHER_PREFETCH)]
16044 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
16045 operands[3]), UNSPEC_VSIBADDR);
16048 (define_insn "*avx512pf_gatherpf<mode>sf_mask"
16050 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
16051 (match_operator:<GATHER_SCATTER_SF_MEM_MODE> 5 "vsib_mem_operator"
16053 [(match_operand:P 2 "vsib_address_operand" "Tv")
16054 (match_operand:VI48_512 1 "register_operand" "v")
16055 (match_operand:SI 3 "const1248_operand" "n")]
16057 (match_operand:SI 4 "const_2_to_3_operand" "n")]
16058 UNSPEC_GATHER_PREFETCH)]
16061 switch (INTVAL (operands[4]))
16064 return "vgatherpf0<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
16066 return "vgatherpf1<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
16068 gcc_unreachable ();
16071 [(set_attr "type" "sse")
16072 (set_attr "prefix" "evex")
16073 (set_attr "mode" "XI")])
16075 ;; Packed double variants
16076 (define_expand "avx512pf_gatherpf<mode>df"
16078 [(match_operand:<avx512fmaskmode> 0 "register_operand")
16081 [(match_operand 2 "vsib_address_operand")
16082 (match_operand:VI4_256_8_512 1 "register_operand")
16083 (match_operand:SI 3 "const1248_operand")]))
16084 (match_operand:SI 4 "const_2_to_3_operand")]
16085 UNSPEC_GATHER_PREFETCH)]
16089 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
16090 operands[3]), UNSPEC_VSIBADDR);
16093 (define_insn "*avx512pf_gatherpf<mode>df_mask"
16095 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
16096 (match_operator:V8DF 5 "vsib_mem_operator"
16098 [(match_operand:P 2 "vsib_address_operand" "Tv")
16099 (match_operand:VI4_256_8_512 1 "register_operand" "v")
16100 (match_operand:SI 3 "const1248_operand" "n")]
16102 (match_operand:SI 4 "const_2_to_3_operand" "n")]
16103 UNSPEC_GATHER_PREFETCH)]
16106 switch (INTVAL (operands[4]))
16109 return "vgatherpf0<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
16111 return "vgatherpf1<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
16113 gcc_unreachable ();
16116 [(set_attr "type" "sse")
16117 (set_attr "prefix" "evex")
16118 (set_attr "mode" "XI")])
16120 ;; Packed float variants
16121 (define_expand "avx512pf_scatterpf<mode>sf"
16123 [(match_operand:<avx512fmaskmode> 0 "register_operand")
16124 (mem:<GATHER_SCATTER_SF_MEM_MODE>
16126 [(match_operand 2 "vsib_address_operand")
16127 (match_operand:VI48_512 1 "register_operand")
16128 (match_operand:SI 3 "const1248_operand")]))
16129 (match_operand:SI 4 "const2367_operand")]
16130 UNSPEC_SCATTER_PREFETCH)]
16134 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
16135 operands[3]), UNSPEC_VSIBADDR);
16138 (define_insn "*avx512pf_scatterpf<mode>sf_mask"
16140 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
16141 (match_operator:<GATHER_SCATTER_SF_MEM_MODE> 5 "vsib_mem_operator"
16143 [(match_operand:P 2 "vsib_address_operand" "Tv")
16144 (match_operand:VI48_512 1 "register_operand" "v")
16145 (match_operand:SI 3 "const1248_operand" "n")]
16147 (match_operand:SI 4 "const2367_operand" "n")]
16148 UNSPEC_SCATTER_PREFETCH)]
16151 switch (INTVAL (operands[4]))
16155 return "vscatterpf0<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
16158 return "vscatterpf1<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
16160 gcc_unreachable ();
16163 [(set_attr "type" "sse")
16164 (set_attr "prefix" "evex")
16165 (set_attr "mode" "XI")])
16167 ;; Packed double variants
16168 (define_expand "avx512pf_scatterpf<mode>df"
16170 [(match_operand:<avx512fmaskmode> 0 "register_operand")
16173 [(match_operand 2 "vsib_address_operand")
16174 (match_operand:VI4_256_8_512 1 "register_operand")
16175 (match_operand:SI 3 "const1248_operand")]))
16176 (match_operand:SI 4 "const2367_operand")]
16177 UNSPEC_SCATTER_PREFETCH)]
16181 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
16182 operands[3]), UNSPEC_VSIBADDR);
16185 (define_insn "*avx512pf_scatterpf<mode>df_mask"
16187 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
16188 (match_operator:V8DF 5 "vsib_mem_operator"
16190 [(match_operand:P 2 "vsib_address_operand" "Tv")
16191 (match_operand:VI4_256_8_512 1 "register_operand" "v")
16192 (match_operand:SI 3 "const1248_operand" "n")]
16194 (match_operand:SI 4 "const2367_operand" "n")]
16195 UNSPEC_SCATTER_PREFETCH)]
16198 switch (INTVAL (operands[4]))
16202 return "vscatterpf0<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
16205 return "vscatterpf1<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
16207 gcc_unreachable ();
16210 [(set_attr "type" "sse")
16211 (set_attr "prefix" "evex")
16212 (set_attr "mode" "XI")])
16214 (define_insn "avx512er_exp2<mode><mask_name><round_saeonly_name>"
16215 [(set (match_operand:VF_512 0 "register_operand" "=v")
16217 [(match_operand:VF_512 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16220 "vexp2<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
16221 [(set_attr "prefix" "evex")
16222 (set_attr "type" "sse")
16223 (set_attr "mode" "<MODE>")])
16225 (define_insn "<mask_codefor>avx512er_rcp28<mode><mask_name><round_saeonly_name>"
16226 [(set (match_operand:VF_512 0 "register_operand" "=v")
16228 [(match_operand:VF_512 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16231 "vrcp28<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
16232 [(set_attr "prefix" "evex")
16233 (set_attr "type" "sse")
16234 (set_attr "mode" "<MODE>")])
16236 (define_insn "avx512er_vmrcp28<mode><round_saeonly_name>"
16237 [(set (match_operand:VF_128 0 "register_operand" "=v")
16240 [(match_operand:VF_128 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16242 (match_operand:VF_128 2 "register_operand" "v")
16245 "vrcp28<ssescalarmodesuffix>\t{<round_saeonly_op3>%1, %2, %0|%0, %2, %1<round_saeonly_op3>}"
16246 [(set_attr "length_immediate" "1")
16247 (set_attr "prefix" "evex")
16248 (set_attr "type" "sse")
16249 (set_attr "mode" "<MODE>")])
16251 (define_insn "<mask_codefor>avx512er_rsqrt28<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 "vrsqrt28<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_vmrsqrt28<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 "vrsqrt28<ssescalarmodesuffix>\t{<round_saeonly_op3>%1, %2, %0|%0, %2, %1<round_saeonly_op3>}"
16272 [(set_attr "length_immediate" "1")
16273 (set_attr "type" "sse")
16274 (set_attr "prefix" "evex")
16275 (set_attr "mode" "<MODE>")])
16277 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16279 ;; XOP instructions
16281 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16283 (define_code_iterator xop_plus [plus ss_plus])
16285 (define_code_attr macs [(plus "macs") (ss_plus "macss")])
16286 (define_code_attr madcs [(plus "madcs") (ss_plus "madcss")])
16288 ;; XOP parallel integer multiply/add instructions.
16290 (define_insn "xop_p<macs><ssemodesuffix><ssemodesuffix>"
16291 [(set (match_operand:VI24_128 0 "register_operand" "=x")
16294 (match_operand:VI24_128 1 "nonimmediate_operand" "%x")
16295 (match_operand:VI24_128 2 "nonimmediate_operand" "xm"))
16296 (match_operand:VI24_128 3 "register_operand" "x")))]
16298 "vp<macs><ssemodesuffix><ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16299 [(set_attr "type" "ssemuladd")
16300 (set_attr "mode" "TI")])
16302 (define_insn "xop_p<macs>dql"
16303 [(set (match_operand:V2DI 0 "register_operand" "=x")
16308 (match_operand:V4SI 1 "nonimmediate_operand" "%x")
16309 (parallel [(const_int 0) (const_int 2)])))
16312 (match_operand:V4SI 2 "nonimmediate_operand" "xm")
16313 (parallel [(const_int 0) (const_int 2)]))))
16314 (match_operand:V2DI 3 "register_operand" "x")))]
16316 "vp<macs>dql\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16317 [(set_attr "type" "ssemuladd")
16318 (set_attr "mode" "TI")])
16320 (define_insn "xop_p<macs>dqh"
16321 [(set (match_operand:V2DI 0 "register_operand" "=x")
16326 (match_operand:V4SI 1 "nonimmediate_operand" "%x")
16327 (parallel [(const_int 1) (const_int 3)])))
16330 (match_operand:V4SI 2 "nonimmediate_operand" "xm")
16331 (parallel [(const_int 1) (const_int 3)]))))
16332 (match_operand:V2DI 3 "register_operand" "x")))]
16334 "vp<macs>dqh\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16335 [(set_attr "type" "ssemuladd")
16336 (set_attr "mode" "TI")])
16338 ;; XOP parallel integer multiply/add instructions for the intrinisics
16339 (define_insn "xop_p<macs>wd"
16340 [(set (match_operand:V4SI 0 "register_operand" "=x")
16345 (match_operand:V8HI 1 "nonimmediate_operand" "%x")
16346 (parallel [(const_int 1) (const_int 3)
16347 (const_int 5) (const_int 7)])))
16350 (match_operand:V8HI 2 "nonimmediate_operand" "xm")
16351 (parallel [(const_int 1) (const_int 3)
16352 (const_int 5) (const_int 7)]))))
16353 (match_operand:V4SI 3 "register_operand" "x")))]
16355 "vp<macs>wd\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16356 [(set_attr "type" "ssemuladd")
16357 (set_attr "mode" "TI")])
16359 (define_insn "xop_p<madcs>wd"
16360 [(set (match_operand:V4SI 0 "register_operand" "=x")
16366 (match_operand:V8HI 1 "nonimmediate_operand" "%x")
16367 (parallel [(const_int 0) (const_int 2)
16368 (const_int 4) (const_int 6)])))
16371 (match_operand:V8HI 2 "nonimmediate_operand" "xm")
16372 (parallel [(const_int 0) (const_int 2)
16373 (const_int 4) (const_int 6)]))))
16378 (parallel [(const_int 1) (const_int 3)
16379 (const_int 5) (const_int 7)])))
16383 (parallel [(const_int 1) (const_int 3)
16384 (const_int 5) (const_int 7)])))))
16385 (match_operand:V4SI 3 "register_operand" "x")))]
16387 "vp<madcs>wd\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16388 [(set_attr "type" "ssemuladd")
16389 (set_attr "mode" "TI")])
16391 ;; XOP parallel XMM conditional moves
16392 (define_insn "xop_pcmov_<mode><avxsizesuffix>"
16393 [(set (match_operand:V 0 "register_operand" "=x,x")
16395 (match_operand:V 3 "nonimmediate_operand" "x,m")
16396 (match_operand:V 1 "register_operand" "x,x")
16397 (match_operand:V 2 "nonimmediate_operand" "xm,x")))]
16399 "vpcmov\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16400 [(set_attr "type" "sse4arg")])
16402 ;; XOP horizontal add/subtract instructions
16403 (define_insn "xop_phadd<u>bw"
16404 [(set (match_operand:V8HI 0 "register_operand" "=x")
16408 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
16409 (parallel [(const_int 0) (const_int 2)
16410 (const_int 4) (const_int 6)
16411 (const_int 8) (const_int 10)
16412 (const_int 12) (const_int 14)])))
16416 (parallel [(const_int 1) (const_int 3)
16417 (const_int 5) (const_int 7)
16418 (const_int 9) (const_int 11)
16419 (const_int 13) (const_int 15)])))))]
16421 "vphadd<u>bw\t{%1, %0|%0, %1}"
16422 [(set_attr "type" "sseiadd1")])
16424 (define_insn "xop_phadd<u>bd"
16425 [(set (match_operand:V4SI 0 "register_operand" "=x")
16430 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
16431 (parallel [(const_int 0) (const_int 4)
16432 (const_int 8) (const_int 12)])))
16436 (parallel [(const_int 1) (const_int 5)
16437 (const_int 9) (const_int 13)]))))
16442 (parallel [(const_int 2) (const_int 6)
16443 (const_int 10) (const_int 14)])))
16447 (parallel [(const_int 3) (const_int 7)
16448 (const_int 11) (const_int 15)]))))))]
16450 "vphadd<u>bd\t{%1, %0|%0, %1}"
16451 [(set_attr "type" "sseiadd1")])
16453 (define_insn "xop_phadd<u>bq"
16454 [(set (match_operand:V2DI 0 "register_operand" "=x")
16460 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
16461 (parallel [(const_int 0) (const_int 8)])))
16465 (parallel [(const_int 1) (const_int 9)]))))
16470 (parallel [(const_int 2) (const_int 10)])))
16474 (parallel [(const_int 3) (const_int 11)])))))
16480 (parallel [(const_int 4) (const_int 12)])))
16484 (parallel [(const_int 5) (const_int 13)]))))
16489 (parallel [(const_int 6) (const_int 14)])))
16493 (parallel [(const_int 7) (const_int 15)])))))))]
16495 "vphadd<u>bq\t{%1, %0|%0, %1}"
16496 [(set_attr "type" "sseiadd1")])
16498 (define_insn "xop_phadd<u>wd"
16499 [(set (match_operand:V4SI 0 "register_operand" "=x")
16503 (match_operand:V8HI 1 "nonimmediate_operand" "xm")
16504 (parallel [(const_int 0) (const_int 2)
16505 (const_int 4) (const_int 6)])))
16509 (parallel [(const_int 1) (const_int 3)
16510 (const_int 5) (const_int 7)])))))]
16512 "vphadd<u>wd\t{%1, %0|%0, %1}"
16513 [(set_attr "type" "sseiadd1")])
16515 (define_insn "xop_phadd<u>wq"
16516 [(set (match_operand:V2DI 0 "register_operand" "=x")
16521 (match_operand:V8HI 1 "nonimmediate_operand" "xm")
16522 (parallel [(const_int 0) (const_int 4)])))
16526 (parallel [(const_int 1) (const_int 5)]))))
16531 (parallel [(const_int 2) (const_int 6)])))
16535 (parallel [(const_int 3) (const_int 7)]))))))]
16537 "vphadd<u>wq\t{%1, %0|%0, %1}"
16538 [(set_attr "type" "sseiadd1")])
16540 (define_insn "xop_phadd<u>dq"
16541 [(set (match_operand:V2DI 0 "register_operand" "=x")
16545 (match_operand:V4SI 1 "nonimmediate_operand" "xm")
16546 (parallel [(const_int 0) (const_int 2)])))
16550 (parallel [(const_int 1) (const_int 3)])))))]
16552 "vphadd<u>dq\t{%1, %0|%0, %1}"
16553 [(set_attr "type" "sseiadd1")])
16555 (define_insn "xop_phsubbw"
16556 [(set (match_operand:V8HI 0 "register_operand" "=x")
16560 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
16561 (parallel [(const_int 0) (const_int 2)
16562 (const_int 4) (const_int 6)
16563 (const_int 8) (const_int 10)
16564 (const_int 12) (const_int 14)])))
16568 (parallel [(const_int 1) (const_int 3)
16569 (const_int 5) (const_int 7)
16570 (const_int 9) (const_int 11)
16571 (const_int 13) (const_int 15)])))))]
16573 "vphsubbw\t{%1, %0|%0, %1}"
16574 [(set_attr "type" "sseiadd1")])
16576 (define_insn "xop_phsubwd"
16577 [(set (match_operand:V4SI 0 "register_operand" "=x")
16581 (match_operand:V8HI 1 "nonimmediate_operand" "xm")
16582 (parallel [(const_int 0) (const_int 2)
16583 (const_int 4) (const_int 6)])))
16587 (parallel [(const_int 1) (const_int 3)
16588 (const_int 5) (const_int 7)])))))]
16590 "vphsubwd\t{%1, %0|%0, %1}"
16591 [(set_attr "type" "sseiadd1")])
16593 (define_insn "xop_phsubdq"
16594 [(set (match_operand:V2DI 0 "register_operand" "=x")
16598 (match_operand:V4SI 1 "nonimmediate_operand" "xm")
16599 (parallel [(const_int 0) (const_int 2)])))
16603 (parallel [(const_int 1) (const_int 3)])))))]
16605 "vphsubdq\t{%1, %0|%0, %1}"
16606 [(set_attr "type" "sseiadd1")])
16608 ;; XOP permute instructions
16609 (define_insn "xop_pperm"
16610 [(set (match_operand:V16QI 0 "register_operand" "=x,x")
16612 [(match_operand:V16QI 1 "register_operand" "x,x")
16613 (match_operand:V16QI 2 "nonimmediate_operand" "x,m")
16614 (match_operand:V16QI 3 "nonimmediate_operand" "xm,x")]
16615 UNSPEC_XOP_PERMUTE))]
16616 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
16617 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16618 [(set_attr "type" "sse4arg")
16619 (set_attr "mode" "TI")])
16621 ;; XOP pack instructions that combine two vectors into a smaller vector
16622 (define_insn "xop_pperm_pack_v2di_v4si"
16623 [(set (match_operand:V4SI 0 "register_operand" "=x,x")
16626 (match_operand:V2DI 1 "register_operand" "x,x"))
16628 (match_operand:V2DI 2 "nonimmediate_operand" "x,m"))))
16629 (use (match_operand:V16QI 3 "nonimmediate_operand" "xm,x"))]
16630 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
16631 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16632 [(set_attr "type" "sse4arg")
16633 (set_attr "mode" "TI")])
16635 (define_insn "xop_pperm_pack_v4si_v8hi"
16636 [(set (match_operand:V8HI 0 "register_operand" "=x,x")
16639 (match_operand:V4SI 1 "register_operand" "x,x"))
16641 (match_operand:V4SI 2 "nonimmediate_operand" "x,m"))))
16642 (use (match_operand:V16QI 3 "nonimmediate_operand" "xm,x"))]
16643 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
16644 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16645 [(set_attr "type" "sse4arg")
16646 (set_attr "mode" "TI")])
16648 (define_insn "xop_pperm_pack_v8hi_v16qi"
16649 [(set (match_operand:V16QI 0 "register_operand" "=x,x")
16652 (match_operand:V8HI 1 "register_operand" "x,x"))
16654 (match_operand:V8HI 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 ;; XOP packed rotate instructions
16662 (define_expand "rotl<mode>3"
16663 [(set (match_operand:VI_128 0 "register_operand")
16665 (match_operand:VI_128 1 "nonimmediate_operand")
16666 (match_operand:SI 2 "general_operand")))]
16669 /* If we were given a scalar, convert it to parallel */
16670 if (! const_0_to_<sserotatemax>_operand (operands[2], SImode))
16672 rtvec vs = rtvec_alloc (<ssescalarnum>);
16673 rtx par = gen_rtx_PARALLEL (<MODE>mode, vs);
16674 rtx reg = gen_reg_rtx (<MODE>mode);
16675 rtx op2 = operands[2];
16678 if (GET_MODE (op2) != <ssescalarmode>mode)
16680 op2 = gen_reg_rtx (<ssescalarmode>mode);
16681 convert_move (op2, operands[2], false);
16684 for (i = 0; i < <ssescalarnum>; i++)
16685 RTVEC_ELT (vs, i) = op2;
16687 emit_insn (gen_vec_init<mode><ssescalarmodelower> (reg, par));
16688 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], reg));
16693 (define_expand "rotr<mode>3"
16694 [(set (match_operand:VI_128 0 "register_operand")
16696 (match_operand:VI_128 1 "nonimmediate_operand")
16697 (match_operand:SI 2 "general_operand")))]
16700 /* If we were given a scalar, convert it to parallel */
16701 if (! const_0_to_<sserotatemax>_operand (operands[2], SImode))
16703 rtvec vs = rtvec_alloc (<ssescalarnum>);
16704 rtx par = gen_rtx_PARALLEL (<MODE>mode, vs);
16705 rtx neg = gen_reg_rtx (<MODE>mode);
16706 rtx reg = gen_reg_rtx (<MODE>mode);
16707 rtx op2 = operands[2];
16710 if (GET_MODE (op2) != <ssescalarmode>mode)
16712 op2 = gen_reg_rtx (<ssescalarmode>mode);
16713 convert_move (op2, operands[2], false);
16716 for (i = 0; i < <ssescalarnum>; i++)
16717 RTVEC_ELT (vs, i) = op2;
16719 emit_insn (gen_vec_init<mode><ssescalarmodelower> (reg, par));
16720 emit_insn (gen_neg<mode>2 (neg, reg));
16721 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], neg));
16726 (define_insn "xop_rotl<mode>3"
16727 [(set (match_operand:VI_128 0 "register_operand" "=x")
16729 (match_operand:VI_128 1 "nonimmediate_operand" "xm")
16730 (match_operand:SI 2 "const_0_to_<sserotatemax>_operand" "n")))]
16732 "vprot<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
16733 [(set_attr "type" "sseishft")
16734 (set_attr "length_immediate" "1")
16735 (set_attr "mode" "TI")])
16737 (define_insn "xop_rotr<mode>3"
16738 [(set (match_operand:VI_128 0 "register_operand" "=x")
16740 (match_operand:VI_128 1 "nonimmediate_operand" "xm")
16741 (match_operand:SI 2 "const_0_to_<sserotatemax>_operand" "n")))]
16745 = GEN_INT (GET_MODE_BITSIZE (<ssescalarmode>mode) - INTVAL (operands[2]));
16746 return \"vprot<ssemodesuffix>\t{%3, %1, %0|%0, %1, %3}\";
16748 [(set_attr "type" "sseishft")
16749 (set_attr "length_immediate" "1")
16750 (set_attr "mode" "TI")])
16752 (define_expand "vrotr<mode>3"
16753 [(match_operand:VI_128 0 "register_operand")
16754 (match_operand:VI_128 1 "register_operand")
16755 (match_operand:VI_128 2 "register_operand")]
16758 rtx reg = gen_reg_rtx (<MODE>mode);
16759 emit_insn (gen_neg<mode>2 (reg, operands[2]));
16760 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], reg));
16764 (define_expand "vrotl<mode>3"
16765 [(match_operand:VI_128 0 "register_operand")
16766 (match_operand:VI_128 1 "register_operand")
16767 (match_operand:VI_128 2 "register_operand")]
16770 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], operands[2]));
16774 (define_insn "xop_vrotl<mode>3"
16775 [(set (match_operand:VI_128 0 "register_operand" "=x,x")
16776 (if_then_else:VI_128
16778 (match_operand:VI_128 2 "nonimmediate_operand" "x,m")
16781 (match_operand:VI_128 1 "nonimmediate_operand" "xm,x")
16785 (neg:VI_128 (match_dup 2)))))]
16786 "TARGET_XOP && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
16787 "vprot<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
16788 [(set_attr "type" "sseishft")
16789 (set_attr "prefix_data16" "0")
16790 (set_attr "prefix_extra" "2")
16791 (set_attr "mode" "TI")])
16793 ;; XOP packed shift instructions.
16794 (define_expand "vlshr<mode>3"
16795 [(set (match_operand:VI12_128 0 "register_operand")
16797 (match_operand:VI12_128 1 "register_operand")
16798 (match_operand:VI12_128 2 "nonimmediate_operand")))]
16801 rtx neg = gen_reg_rtx (<MODE>mode);
16802 emit_insn (gen_neg<mode>2 (neg, operands[2]));
16803 emit_insn (gen_xop_shl<mode>3 (operands[0], operands[1], neg));
16807 (define_expand "vlshr<mode>3"
16808 [(set (match_operand:VI48_128 0 "register_operand")
16810 (match_operand:VI48_128 1 "register_operand")
16811 (match_operand:VI48_128 2 "nonimmediate_operand")))]
16812 "TARGET_AVX2 || TARGET_XOP"
16816 rtx neg = gen_reg_rtx (<MODE>mode);
16817 emit_insn (gen_neg<mode>2 (neg, operands[2]));
16818 emit_insn (gen_xop_shl<mode>3 (operands[0], operands[1], neg));
16823 (define_expand "vlshr<mode>3"
16824 [(set (match_operand:VI48_512 0 "register_operand")
16826 (match_operand:VI48_512 1 "register_operand")
16827 (match_operand:VI48_512 2 "nonimmediate_operand")))]
16830 (define_expand "vlshr<mode>3"
16831 [(set (match_operand:VI48_256 0 "register_operand")
16833 (match_operand:VI48_256 1 "register_operand")
16834 (match_operand:VI48_256 2 "nonimmediate_operand")))]
16837 (define_expand "vashrv8hi3<mask_name>"
16838 [(set (match_operand:V8HI 0 "register_operand")
16840 (match_operand:V8HI 1 "register_operand")
16841 (match_operand:V8HI 2 "nonimmediate_operand")))]
16842 "TARGET_XOP || (TARGET_AVX512BW && TARGET_AVX512VL)"
16846 rtx neg = gen_reg_rtx (V8HImode);
16847 emit_insn (gen_negv8hi2 (neg, operands[2]));
16848 emit_insn (gen_xop_shav8hi3 (operands[0], operands[1], neg));
16853 (define_expand "vashrv16qi3"
16854 [(set (match_operand:V16QI 0 "register_operand")
16856 (match_operand:V16QI 1 "register_operand")
16857 (match_operand:V16QI 2 "nonimmediate_operand")))]
16860 rtx neg = gen_reg_rtx (V16QImode);
16861 emit_insn (gen_negv16qi2 (neg, operands[2]));
16862 emit_insn (gen_xop_shav16qi3 (operands[0], operands[1], neg));
16866 (define_expand "vashrv2di3<mask_name>"
16867 [(set (match_operand:V2DI 0 "register_operand")
16869 (match_operand:V2DI 1 "register_operand")
16870 (match_operand:V2DI 2 "nonimmediate_operand")))]
16871 "TARGET_XOP || TARGET_AVX512VL"
16875 rtx neg = gen_reg_rtx (V2DImode);
16876 emit_insn (gen_negv2di2 (neg, operands[2]));
16877 emit_insn (gen_xop_shav2di3 (operands[0], operands[1], neg));
16882 (define_expand "vashrv4si3"
16883 [(set (match_operand:V4SI 0 "register_operand")
16884 (ashiftrt:V4SI (match_operand:V4SI 1 "register_operand")
16885 (match_operand:V4SI 2 "nonimmediate_operand")))]
16886 "TARGET_AVX2 || TARGET_XOP"
16890 rtx neg = gen_reg_rtx (V4SImode);
16891 emit_insn (gen_negv4si2 (neg, operands[2]));
16892 emit_insn (gen_xop_shav4si3 (operands[0], operands[1], neg));
16897 (define_expand "vashrv16si3"
16898 [(set (match_operand:V16SI 0 "register_operand")
16899 (ashiftrt:V16SI (match_operand:V16SI 1 "register_operand")
16900 (match_operand:V16SI 2 "nonimmediate_operand")))]
16903 (define_expand "vashrv8si3"
16904 [(set (match_operand:V8SI 0 "register_operand")
16905 (ashiftrt:V8SI (match_operand:V8SI 1 "register_operand")
16906 (match_operand:V8SI 2 "nonimmediate_operand")))]
16909 (define_expand "vashl<mode>3"
16910 [(set (match_operand:VI12_128 0 "register_operand")
16912 (match_operand:VI12_128 1 "register_operand")
16913 (match_operand:VI12_128 2 "nonimmediate_operand")))]
16916 emit_insn (gen_xop_sha<mode>3 (operands[0], operands[1], operands[2]));
16920 (define_expand "vashl<mode>3"
16921 [(set (match_operand:VI48_128 0 "register_operand")
16923 (match_operand:VI48_128 1 "register_operand")
16924 (match_operand:VI48_128 2 "nonimmediate_operand")))]
16925 "TARGET_AVX2 || TARGET_XOP"
16929 operands[2] = force_reg (<MODE>mode, operands[2]);
16930 emit_insn (gen_xop_sha<mode>3 (operands[0], operands[1], operands[2]));
16935 (define_expand "vashl<mode>3"
16936 [(set (match_operand:VI48_512 0 "register_operand")
16938 (match_operand:VI48_512 1 "register_operand")
16939 (match_operand:VI48_512 2 "nonimmediate_operand")))]
16942 (define_expand "vashl<mode>3"
16943 [(set (match_operand:VI48_256 0 "register_operand")
16945 (match_operand:VI48_256 1 "register_operand")
16946 (match_operand:VI48_256 2 "nonimmediate_operand")))]
16949 (define_insn "xop_sha<mode>3"
16950 [(set (match_operand:VI_128 0 "register_operand" "=x,x")
16951 (if_then_else:VI_128
16953 (match_operand:VI_128 2 "nonimmediate_operand" "x,m")
16956 (match_operand:VI_128 1 "nonimmediate_operand" "xm,x")
16960 (neg:VI_128 (match_dup 2)))))]
16961 "TARGET_XOP && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
16962 "vpsha<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
16963 [(set_attr "type" "sseishft")
16964 (set_attr "prefix_data16" "0")
16965 (set_attr "prefix_extra" "2")
16966 (set_attr "mode" "TI")])
16968 (define_insn "xop_shl<mode>3"
16969 [(set (match_operand:VI_128 0 "register_operand" "=x,x")
16970 (if_then_else:VI_128
16972 (match_operand:VI_128 2 "nonimmediate_operand" "x,m")
16975 (match_operand:VI_128 1 "nonimmediate_operand" "xm,x")
16979 (neg:VI_128 (match_dup 2)))))]
16980 "TARGET_XOP && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
16981 "vpshl<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
16982 [(set_attr "type" "sseishft")
16983 (set_attr "prefix_data16" "0")
16984 (set_attr "prefix_extra" "2")
16985 (set_attr "mode" "TI")])
16987 (define_expand "<shift_insn><mode>3"
16988 [(set (match_operand:VI1_AVX512 0 "register_operand")
16989 (any_shift:VI1_AVX512
16990 (match_operand:VI1_AVX512 1 "register_operand")
16991 (match_operand:SI 2 "nonmemory_operand")))]
16994 if (TARGET_XOP && <MODE>mode == V16QImode)
16996 bool negate = false;
16997 rtx (*gen) (rtx, rtx, rtx);
17001 if (<CODE> != ASHIFT)
17003 if (CONST_INT_P (operands[2]))
17004 operands[2] = GEN_INT (-INTVAL (operands[2]));
17008 par = gen_rtx_PARALLEL (V16QImode, rtvec_alloc (16));
17009 for (i = 0; i < 16; i++)
17010 XVECEXP (par, 0, i) = operands[2];
17012 tmp = gen_reg_rtx (V16QImode);
17013 emit_insn (gen_vec_initv16qiqi (tmp, par));
17016 emit_insn (gen_negv16qi2 (tmp, tmp));
17018 gen = (<CODE> == LSHIFTRT ? gen_xop_shlv16qi3 : gen_xop_shav16qi3);
17019 emit_insn (gen (operands[0], operands[1], tmp));
17022 ix86_expand_vecop_qihi (<CODE>, operands[0], operands[1], operands[2]);
17026 (define_expand "ashrv2di3"
17027 [(set (match_operand:V2DI 0 "register_operand")
17029 (match_operand:V2DI 1 "register_operand")
17030 (match_operand:DI 2 "nonmemory_operand")))]
17031 "TARGET_XOP || TARGET_AVX512VL"
17033 if (!TARGET_AVX512VL)
17035 rtx reg = gen_reg_rtx (V2DImode);
17037 bool negate = false;
17040 if (CONST_INT_P (operands[2]))
17041 operands[2] = GEN_INT (-INTVAL (operands[2]));
17045 par = gen_rtx_PARALLEL (V2DImode, rtvec_alloc (2));
17046 for (i = 0; i < 2; i++)
17047 XVECEXP (par, 0, i) = operands[2];
17049 emit_insn (gen_vec_initv2didi (reg, par));
17052 emit_insn (gen_negv2di2 (reg, reg));
17054 emit_insn (gen_xop_shav2di3 (operands[0], operands[1], reg));
17059 ;; XOP FRCZ support
17060 (define_insn "xop_frcz<mode>2"
17061 [(set (match_operand:FMAMODE 0 "register_operand" "=x")
17063 [(match_operand:FMAMODE 1 "nonimmediate_operand" "xm")]
17066 "vfrcz<ssemodesuffix>\t{%1, %0|%0, %1}"
17067 [(set_attr "type" "ssecvt1")
17068 (set_attr "mode" "<MODE>")])
17070 (define_expand "xop_vmfrcz<mode>2"
17071 [(set (match_operand:VF_128 0 "register_operand")
17074 [(match_operand:VF_128 1 "nonimmediate_operand")]
17079 "operands[2] = CONST0_RTX (<MODE>mode);")
17081 (define_insn "*xop_vmfrcz<mode>2"
17082 [(set (match_operand:VF_128 0 "register_operand" "=x")
17085 [(match_operand:VF_128 1 "nonimmediate_operand" "xm")]
17087 (match_operand:VF_128 2 "const0_operand")
17090 "vfrcz<ssescalarmodesuffix>\t{%1, %0|%0, %<iptr>1}"
17091 [(set_attr "type" "ssecvt1")
17092 (set_attr "mode" "<MODE>")])
17094 (define_insn "xop_maskcmp<mode>3"
17095 [(set (match_operand:VI_128 0 "register_operand" "=x")
17096 (match_operator:VI_128 1 "ix86_comparison_int_operator"
17097 [(match_operand:VI_128 2 "register_operand" "x")
17098 (match_operand:VI_128 3 "nonimmediate_operand" "xm")]))]
17100 "vpcom%Y1<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}"
17101 [(set_attr "type" "sse4arg")
17102 (set_attr "prefix_data16" "0")
17103 (set_attr "prefix_rep" "0")
17104 (set_attr "prefix_extra" "2")
17105 (set_attr "length_immediate" "1")
17106 (set_attr "mode" "TI")])
17108 (define_insn "xop_maskcmp_uns<mode>3"
17109 [(set (match_operand:VI_128 0 "register_operand" "=x")
17110 (match_operator:VI_128 1 "ix86_comparison_uns_operator"
17111 [(match_operand:VI_128 2 "register_operand" "x")
17112 (match_operand:VI_128 3 "nonimmediate_operand" "xm")]))]
17114 "vpcom%Y1u<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}"
17115 [(set_attr "type" "ssecmp")
17116 (set_attr "prefix_data16" "0")
17117 (set_attr "prefix_rep" "0")
17118 (set_attr "prefix_extra" "2")
17119 (set_attr "length_immediate" "1")
17120 (set_attr "mode" "TI")])
17122 ;; Version of pcom*u* that is called from the intrinsics that allows pcomequ*
17123 ;; and pcomneu* not to be converted to the signed ones in case somebody needs
17124 ;; the exact instruction generated for the intrinsic.
17125 (define_insn "xop_maskcmp_uns2<mode>3"
17126 [(set (match_operand:VI_128 0 "register_operand" "=x")
17128 [(match_operator:VI_128 1 "ix86_comparison_uns_operator"
17129 [(match_operand:VI_128 2 "register_operand" "x")
17130 (match_operand:VI_128 3 "nonimmediate_operand" "xm")])]
17131 UNSPEC_XOP_UNSIGNED_CMP))]
17133 "vpcom%Y1u<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}"
17134 [(set_attr "type" "ssecmp")
17135 (set_attr "prefix_data16" "0")
17136 (set_attr "prefix_extra" "2")
17137 (set_attr "length_immediate" "1")
17138 (set_attr "mode" "TI")])
17140 ;; Pcomtrue and pcomfalse support. These are useless instructions, but are
17141 ;; being added here to be complete.
17142 (define_insn "xop_pcom_tf<mode>3"
17143 [(set (match_operand:VI_128 0 "register_operand" "=x")
17145 [(match_operand:VI_128 1 "register_operand" "x")
17146 (match_operand:VI_128 2 "nonimmediate_operand" "xm")
17147 (match_operand:SI 3 "const_int_operand" "n")]
17148 UNSPEC_XOP_TRUEFALSE))]
17151 return ((INTVAL (operands[3]) != 0)
17152 ? "vpcomtrue<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
17153 : "vpcomfalse<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}");
17155 [(set_attr "type" "ssecmp")
17156 (set_attr "prefix_data16" "0")
17157 (set_attr "prefix_extra" "2")
17158 (set_attr "length_immediate" "1")
17159 (set_attr "mode" "TI")])
17161 (define_insn "xop_vpermil2<mode>3"
17162 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x")
17164 [(match_operand:VF_128_256 1 "register_operand" "x,x")
17165 (match_operand:VF_128_256 2 "nonimmediate_operand" "x,m")
17166 (match_operand:<sseintvecmode> 3 "nonimmediate_operand" "xm,x")
17167 (match_operand:SI 4 "const_0_to_3_operand" "n,n")]
17170 "vpermil2<ssemodesuffix>\t{%4, %3, %2, %1, %0|%0, %1, %2, %3, %4}"
17171 [(set_attr "type" "sse4arg")
17172 (set_attr "length_immediate" "1")
17173 (set_attr "mode" "<MODE>")])
17175 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
17177 (define_insn "aesenc"
17178 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17179 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17180 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
17184 aesenc\t{%2, %0|%0, %2}
17185 vaesenc\t{%2, %1, %0|%0, %1, %2}"
17186 [(set_attr "isa" "noavx,avx")
17187 (set_attr "type" "sselog1")
17188 (set_attr "prefix_extra" "1")
17189 (set_attr "prefix" "orig,vex")
17190 (set_attr "btver2_decode" "double,double")
17191 (set_attr "mode" "TI")])
17193 (define_insn "aesenclast"
17194 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17195 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17196 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
17197 UNSPEC_AESENCLAST))]
17200 aesenclast\t{%2, %0|%0, %2}
17201 vaesenclast\t{%2, %1, %0|%0, %1, %2}"
17202 [(set_attr "isa" "noavx,avx")
17203 (set_attr "type" "sselog1")
17204 (set_attr "prefix_extra" "1")
17205 (set_attr "prefix" "orig,vex")
17206 (set_attr "btver2_decode" "double,double")
17207 (set_attr "mode" "TI")])
17209 (define_insn "aesdec"
17210 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17211 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17212 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
17216 aesdec\t{%2, %0|%0, %2}
17217 vaesdec\t{%2, %1, %0|%0, %1, %2}"
17218 [(set_attr "isa" "noavx,avx")
17219 (set_attr "type" "sselog1")
17220 (set_attr "prefix_extra" "1")
17221 (set_attr "prefix" "orig,vex")
17222 (set_attr "btver2_decode" "double,double")
17223 (set_attr "mode" "TI")])
17225 (define_insn "aesdeclast"
17226 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17227 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17228 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
17229 UNSPEC_AESDECLAST))]
17232 aesdeclast\t{%2, %0|%0, %2}
17233 vaesdeclast\t{%2, %1, %0|%0, %1, %2}"
17234 [(set_attr "isa" "noavx,avx")
17235 (set_attr "type" "sselog1")
17236 (set_attr "prefix_extra" "1")
17237 (set_attr "prefix" "orig,vex")
17238 (set_attr "btver2_decode" "double,double")
17239 (set_attr "mode" "TI")])
17241 (define_insn "aesimc"
17242 [(set (match_operand:V2DI 0 "register_operand" "=x")
17243 (unspec:V2DI [(match_operand:V2DI 1 "vector_operand" "xBm")]
17246 "%vaesimc\t{%1, %0|%0, %1}"
17247 [(set_attr "type" "sselog1")
17248 (set_attr "prefix_extra" "1")
17249 (set_attr "prefix" "maybe_vex")
17250 (set_attr "mode" "TI")])
17252 (define_insn "aeskeygenassist"
17253 [(set (match_operand:V2DI 0 "register_operand" "=x")
17254 (unspec:V2DI [(match_operand:V2DI 1 "vector_operand" "xBm")
17255 (match_operand:SI 2 "const_0_to_255_operand" "n")]
17256 UNSPEC_AESKEYGENASSIST))]
17258 "%vaeskeygenassist\t{%2, %1, %0|%0, %1, %2}"
17259 [(set_attr "type" "sselog1")
17260 (set_attr "prefix_extra" "1")
17261 (set_attr "length_immediate" "1")
17262 (set_attr "prefix" "maybe_vex")
17263 (set_attr "mode" "TI")])
17265 (define_insn "pclmulqdq"
17266 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17267 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17268 (match_operand:V2DI 2 "vector_operand" "xBm,xm")
17269 (match_operand:SI 3 "const_0_to_255_operand" "n,n")]
17273 pclmulqdq\t{%3, %2, %0|%0, %2, %3}
17274 vpclmulqdq\t{%3, %2, %1, %0|%0, %1, %2, %3}"
17275 [(set_attr "isa" "noavx,avx")
17276 (set_attr "type" "sselog1")
17277 (set_attr "prefix_extra" "1")
17278 (set_attr "length_immediate" "1")
17279 (set_attr "prefix" "orig,vex")
17280 (set_attr "mode" "TI")])
17282 (define_expand "avx_vzeroall"
17283 [(match_par_dup 0 [(const_int 0)])]
17286 int nregs = TARGET_64BIT ? 16 : 8;
17289 operands[0] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (nregs + 1));
17291 XVECEXP (operands[0], 0, 0)
17292 = gen_rtx_UNSPEC_VOLATILE (VOIDmode, gen_rtvec (1, const0_rtx),
17295 for (regno = 0; regno < nregs; regno++)
17296 XVECEXP (operands[0], 0, regno + 1)
17297 = gen_rtx_SET (gen_rtx_REG (V8SImode, SSE_REGNO (regno)),
17298 CONST0_RTX (V8SImode));
17301 (define_insn "*avx_vzeroall"
17302 [(match_parallel 0 "vzeroall_operation"
17303 [(unspec_volatile [(const_int 0)] UNSPECV_VZEROALL)])]
17306 [(set_attr "type" "sse")
17307 (set_attr "modrm" "0")
17308 (set_attr "memory" "none")
17309 (set_attr "prefix" "vex")
17310 (set_attr "btver2_decode" "vector")
17311 (set_attr "mode" "OI")])
17313 ;; Clear the upper 128bits of AVX registers, equivalent to a NOP
17314 ;; if the upper 128bits are unused.
17315 (define_insn "avx_vzeroupper"
17316 [(unspec_volatile [(const_int 0)] UNSPECV_VZEROUPPER)]
17319 [(set_attr "type" "sse")
17320 (set_attr "modrm" "0")
17321 (set_attr "memory" "none")
17322 (set_attr "prefix" "vex")
17323 (set_attr "btver2_decode" "vector")
17324 (set_attr "mode" "OI")])
17326 (define_mode_attr pbroadcast_evex_isa
17327 [(V64QI "avx512bw") (V32QI "avx512bw") (V16QI "avx512bw")
17328 (V32HI "avx512bw") (V16HI "avx512bw") (V8HI "avx512bw")
17329 (V16SI "avx512f") (V8SI "avx512f") (V4SI "avx512f")
17330 (V8DI "avx512f") (V4DI "avx512f") (V2DI "avx512f")])
17332 (define_insn "avx2_pbroadcast<mode>"
17333 [(set (match_operand:VI 0 "register_operand" "=x,v")
17335 (vec_select:<ssescalarmode>
17336 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "xm,vm")
17337 (parallel [(const_int 0)]))))]
17339 "vpbroadcast<ssemodesuffix>\t{%1, %0|%0, %<iptr>1}"
17340 [(set_attr "isa" "*,<pbroadcast_evex_isa>")
17341 (set_attr "type" "ssemov")
17342 (set_attr "prefix_extra" "1")
17343 (set_attr "prefix" "vex,evex")
17344 (set_attr "mode" "<sseinsnmode>")])
17346 (define_insn "avx2_pbroadcast<mode>_1"
17347 [(set (match_operand:VI_256 0 "register_operand" "=x,x,v,v")
17348 (vec_duplicate:VI_256
17349 (vec_select:<ssescalarmode>
17350 (match_operand:VI_256 1 "nonimmediate_operand" "m,x,m,v")
17351 (parallel [(const_int 0)]))))]
17354 vpbroadcast<ssemodesuffix>\t{%1, %0|%0, %<iptr>1}
17355 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %x1}
17356 vpbroadcast<ssemodesuffix>\t{%1, %0|%0, %<iptr>1}
17357 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %x1}"
17358 [(set_attr "isa" "*,*,<pbroadcast_evex_isa>,<pbroadcast_evex_isa>")
17359 (set_attr "type" "ssemov")
17360 (set_attr "prefix_extra" "1")
17361 (set_attr "prefix" "vex")
17362 (set_attr "mode" "<sseinsnmode>")])
17364 (define_insn "<avx2_avx512>_permvar<mode><mask_name>"
17365 [(set (match_operand:VI48F_256_512 0 "register_operand" "=v")
17366 (unspec:VI48F_256_512
17367 [(match_operand:VI48F_256_512 1 "nonimmediate_operand" "vm")
17368 (match_operand:<sseintvecmode> 2 "register_operand" "v")]
17370 "TARGET_AVX2 && <mask_mode512bit_condition>"
17371 "vperm<ssemodesuffix>\t{%1, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1}"
17372 [(set_attr "type" "sselog")
17373 (set_attr "prefix" "<mask_prefix2>")
17374 (set_attr "mode" "<sseinsnmode>")])
17376 (define_insn "<avx512>_permvar<mode><mask_name>"
17377 [(set (match_operand:VI1_AVX512VL 0 "register_operand" "=v")
17378 (unspec:VI1_AVX512VL
17379 [(match_operand:VI1_AVX512VL 1 "nonimmediate_operand" "vm")
17380 (match_operand:<sseintvecmode> 2 "register_operand" "v")]
17382 "TARGET_AVX512VBMI && <mask_mode512bit_condition>"
17383 "vperm<ssemodesuffix>\t{%1, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1}"
17384 [(set_attr "type" "sselog")
17385 (set_attr "prefix" "<mask_prefix2>")
17386 (set_attr "mode" "<sseinsnmode>")])
17388 (define_insn "<avx512>_permvar<mode><mask_name>"
17389 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
17390 (unspec:VI2_AVX512VL
17391 [(match_operand:VI2_AVX512VL 1 "nonimmediate_operand" "vm")
17392 (match_operand:<sseintvecmode> 2 "register_operand" "v")]
17394 "TARGET_AVX512BW && <mask_mode512bit_condition>"
17395 "vperm<ssemodesuffix>\t{%1, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1}"
17396 [(set_attr "type" "sselog")
17397 (set_attr "prefix" "<mask_prefix2>")
17398 (set_attr "mode" "<sseinsnmode>")])
17400 (define_expand "avx2_perm<mode>"
17401 [(match_operand:VI8F_256 0 "register_operand")
17402 (match_operand:VI8F_256 1 "nonimmediate_operand")
17403 (match_operand:SI 2 "const_0_to_255_operand")]
17406 int mask = INTVAL (operands[2]);
17407 emit_insn (gen_avx2_perm<mode>_1 (operands[0], operands[1],
17408 GEN_INT ((mask >> 0) & 3),
17409 GEN_INT ((mask >> 2) & 3),
17410 GEN_INT ((mask >> 4) & 3),
17411 GEN_INT ((mask >> 6) & 3)));
17415 (define_expand "avx512vl_perm<mode>_mask"
17416 [(match_operand:VI8F_256 0 "register_operand")
17417 (match_operand:VI8F_256 1 "nonimmediate_operand")
17418 (match_operand:SI 2 "const_0_to_255_operand")
17419 (match_operand:VI8F_256 3 "vector_move_operand")
17420 (match_operand:<avx512fmaskmode> 4 "register_operand")]
17423 int mask = INTVAL (operands[2]);
17424 emit_insn (gen_<avx2_avx512>_perm<mode>_1_mask (operands[0], operands[1],
17425 GEN_INT ((mask >> 0) & 3),
17426 GEN_INT ((mask >> 2) & 3),
17427 GEN_INT ((mask >> 4) & 3),
17428 GEN_INT ((mask >> 6) & 3),
17429 operands[3], operands[4]));
17433 (define_insn "avx2_perm<mode>_1<mask_name>"
17434 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
17435 (vec_select:VI8F_256
17436 (match_operand:VI8F_256 1 "nonimmediate_operand" "vm")
17437 (parallel [(match_operand 2 "const_0_to_3_operand")
17438 (match_operand 3 "const_0_to_3_operand")
17439 (match_operand 4 "const_0_to_3_operand")
17440 (match_operand 5 "const_0_to_3_operand")])))]
17441 "TARGET_AVX2 && <mask_mode512bit_condition>"
17444 mask |= INTVAL (operands[2]) << 0;
17445 mask |= INTVAL (operands[3]) << 2;
17446 mask |= INTVAL (operands[4]) << 4;
17447 mask |= INTVAL (operands[5]) << 6;
17448 operands[2] = GEN_INT (mask);
17449 return "vperm<ssemodesuffix>\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
17451 [(set_attr "type" "sselog")
17452 (set_attr "prefix" "<mask_prefix2>")
17453 (set_attr "mode" "<sseinsnmode>")])
17455 (define_expand "avx512f_perm<mode>"
17456 [(match_operand:V8FI 0 "register_operand")
17457 (match_operand:V8FI 1 "nonimmediate_operand")
17458 (match_operand:SI 2 "const_0_to_255_operand")]
17461 int mask = INTVAL (operands[2]);
17462 emit_insn (gen_avx512f_perm<mode>_1 (operands[0], operands[1],
17463 GEN_INT ((mask >> 0) & 3),
17464 GEN_INT ((mask >> 2) & 3),
17465 GEN_INT ((mask >> 4) & 3),
17466 GEN_INT ((mask >> 6) & 3),
17467 GEN_INT (((mask >> 0) & 3) + 4),
17468 GEN_INT (((mask >> 2) & 3) + 4),
17469 GEN_INT (((mask >> 4) & 3) + 4),
17470 GEN_INT (((mask >> 6) & 3) + 4)));
17474 (define_expand "avx512f_perm<mode>_mask"
17475 [(match_operand:V8FI 0 "register_operand")
17476 (match_operand:V8FI 1 "nonimmediate_operand")
17477 (match_operand:SI 2 "const_0_to_255_operand")
17478 (match_operand:V8FI 3 "vector_move_operand")
17479 (match_operand:<avx512fmaskmode> 4 "register_operand")]
17482 int mask = INTVAL (operands[2]);
17483 emit_insn (gen_avx512f_perm<mode>_1_mask (operands[0], operands[1],
17484 GEN_INT ((mask >> 0) & 3),
17485 GEN_INT ((mask >> 2) & 3),
17486 GEN_INT ((mask >> 4) & 3),
17487 GEN_INT ((mask >> 6) & 3),
17488 GEN_INT (((mask >> 0) & 3) + 4),
17489 GEN_INT (((mask >> 2) & 3) + 4),
17490 GEN_INT (((mask >> 4) & 3) + 4),
17491 GEN_INT (((mask >> 6) & 3) + 4),
17492 operands[3], operands[4]));
17496 (define_insn "avx512f_perm<mode>_1<mask_name>"
17497 [(set (match_operand:V8FI 0 "register_operand" "=v")
17499 (match_operand:V8FI 1 "nonimmediate_operand" "vm")
17500 (parallel [(match_operand 2 "const_0_to_3_operand")
17501 (match_operand 3 "const_0_to_3_operand")
17502 (match_operand 4 "const_0_to_3_operand")
17503 (match_operand 5 "const_0_to_3_operand")
17504 (match_operand 6 "const_4_to_7_operand")
17505 (match_operand 7 "const_4_to_7_operand")
17506 (match_operand 8 "const_4_to_7_operand")
17507 (match_operand 9 "const_4_to_7_operand")])))]
17508 "TARGET_AVX512F && <mask_mode512bit_condition>
17509 && (INTVAL (operands[2]) == (INTVAL (operands[6]) - 4)
17510 && INTVAL (operands[3]) == (INTVAL (operands[7]) - 4)
17511 && INTVAL (operands[4]) == (INTVAL (operands[8]) - 4)
17512 && INTVAL (operands[5]) == (INTVAL (operands[9]) - 4))"
17515 mask |= INTVAL (operands[2]) << 0;
17516 mask |= INTVAL (operands[3]) << 2;
17517 mask |= INTVAL (operands[4]) << 4;
17518 mask |= INTVAL (operands[5]) << 6;
17519 operands[2] = GEN_INT (mask);
17520 return "vperm<ssemodesuffix>\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
17522 [(set_attr "type" "sselog")
17523 (set_attr "prefix" "<mask_prefix2>")
17524 (set_attr "mode" "<sseinsnmode>")])
17526 (define_insn "avx2_permv2ti"
17527 [(set (match_operand:V4DI 0 "register_operand" "=x")
17529 [(match_operand:V4DI 1 "register_operand" "x")
17530 (match_operand:V4DI 2 "nonimmediate_operand" "xm")
17531 (match_operand:SI 3 "const_0_to_255_operand" "n")]
17534 "vperm2i128\t{%3, %2, %1, %0|%0, %1, %2, %3}"
17535 [(set_attr "type" "sselog")
17536 (set_attr "prefix" "vex")
17537 (set_attr "mode" "OI")])
17539 (define_insn "avx2_vec_dupv4df"
17540 [(set (match_operand:V4DF 0 "register_operand" "=v")
17541 (vec_duplicate:V4DF
17543 (match_operand:V2DF 1 "register_operand" "v")
17544 (parallel [(const_int 0)]))))]
17546 "vbroadcastsd\t{%1, %0|%0, %1}"
17547 [(set_attr "type" "sselog1")
17548 (set_attr "prefix" "maybe_evex")
17549 (set_attr "mode" "V4DF")])
17551 (define_insn "<avx512>_vec_dup<mode>_1"
17552 [(set (match_operand:VI_AVX512BW 0 "register_operand" "=v,v")
17553 (vec_duplicate:VI_AVX512BW
17554 (vec_select:<ssescalarmode>
17555 (match_operand:VI_AVX512BW 1 "nonimmediate_operand" "v,m")
17556 (parallel [(const_int 0)]))))]
17559 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %x1}
17560 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %<iptr>1}"
17561 [(set_attr "type" "ssemov")
17562 (set_attr "prefix" "evex")
17563 (set_attr "mode" "<sseinsnmode>")])
17565 (define_insn "<avx512>_vec_dup<mode><mask_name>"
17566 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v")
17567 (vec_duplicate:V48_AVX512VL
17568 (vec_select:<ssescalarmode>
17569 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "vm")
17570 (parallel [(const_int 0)]))))]
17573 /* There is no DF broadcast (in AVX-512*) to 128b register.
17574 Mimic it with integer variant. */
17575 if (<MODE>mode == V2DFmode)
17576 return "vpbroadcastq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}";
17578 if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 4)
17579 return "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}";
17581 return "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}";
17583 [(set_attr "type" "ssemov")
17584 (set_attr "prefix" "evex")
17585 (set_attr "mode" "<sseinsnmode>")])
17587 (define_insn "<avx512>_vec_dup<mode><mask_name>"
17588 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
17589 (vec_duplicate:VI12_AVX512VL
17590 (vec_select:<ssescalarmode>
17591 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "vm")
17592 (parallel [(const_int 0)]))))]
17594 "vpbroadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17595 [(set_attr "type" "ssemov")
17596 (set_attr "prefix" "evex")
17597 (set_attr "mode" "<sseinsnmode>")])
17599 (define_insn "<mask_codefor>avx512f_broadcast<mode><mask_name>"
17600 [(set (match_operand:V16FI 0 "register_operand" "=v,v")
17601 (vec_duplicate:V16FI
17602 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "v,m")))]
17605 vshuf<shuffletype>32x4\t{$0x0, %g1, %g1, %0<mask_operand2>|%0<mask_operand2>, %g1, %g1, 0x0}
17606 vbroadcast<shuffletype>32x4\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17607 [(set_attr "type" "ssemov")
17608 (set_attr "prefix" "evex")
17609 (set_attr "mode" "<sseinsnmode>")])
17611 (define_insn "<mask_codefor>avx512f_broadcast<mode><mask_name>"
17612 [(set (match_operand:V8FI 0 "register_operand" "=v,v")
17613 (vec_duplicate:V8FI
17614 (match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "v,m")))]
17617 vshuf<shuffletype>64x2\t{$0x44, %g1, %g1, %0<mask_operand2>|%0<mask_operand2>, %g1, %g1, 0x44}
17618 vbroadcast<shuffletype>64x4\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17619 [(set_attr "type" "ssemov")
17620 (set_attr "prefix" "evex")
17621 (set_attr "mode" "<sseinsnmode>")])
17623 (define_insn "<mask_codefor><avx512>_vec_dup_gpr<mode><mask_name>"
17624 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v,v")
17625 (vec_duplicate:VI12_AVX512VL
17626 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "vm,r")))]
17629 vpbroadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}
17630 vpbroadcast<bcstscalarsuff>\t{%k1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
17631 [(set_attr "type" "ssemov")
17632 (set_attr "prefix" "evex")
17633 (set_attr "mode" "<sseinsnmode>")])
17635 (define_insn "<mask_codefor><avx512>_vec_dup_gpr<mode><mask_name>"
17636 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v,v")
17637 (vec_duplicate:V48_AVX512VL
17638 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "vm,r")))]
17640 "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17641 [(set_attr "type" "ssemov")
17642 (set_attr "prefix" "evex")
17643 (set_attr "mode" "<sseinsnmode>")
17644 (set (attr "enabled")
17645 (if_then_else (eq_attr "alternative" "1")
17646 (symbol_ref "GET_MODE_CLASS (<ssescalarmode>mode) == MODE_INT
17647 && (<ssescalarmode>mode != DImode || TARGET_64BIT)")
17650 (define_insn "vec_dupv4sf"
17651 [(set (match_operand:V4SF 0 "register_operand" "=v,v,x")
17652 (vec_duplicate:V4SF
17653 (match_operand:SF 1 "nonimmediate_operand" "Yv,m,0")))]
17656 vshufps\t{$0, %1, %1, %0|%0, %1, %1, 0}
17657 vbroadcastss\t{%1, %0|%0, %1}
17658 shufps\t{$0, %0, %0|%0, %0, 0}"
17659 [(set_attr "isa" "avx,avx,noavx")
17660 (set_attr "type" "sseshuf1,ssemov,sseshuf1")
17661 (set_attr "length_immediate" "1,0,1")
17662 (set_attr "prefix_extra" "0,1,*")
17663 (set_attr "prefix" "maybe_evex,maybe_evex,orig")
17664 (set_attr "mode" "V4SF")])
17666 (define_insn "*vec_dupv4si"
17667 [(set (match_operand:V4SI 0 "register_operand" "=v,v,x")
17668 (vec_duplicate:V4SI
17669 (match_operand:SI 1 "nonimmediate_operand" "Yv,m,0")))]
17672 %vpshufd\t{$0, %1, %0|%0, %1, 0}
17673 vbroadcastss\t{%1, %0|%0, %1}
17674 shufps\t{$0, %0, %0|%0, %0, 0}"
17675 [(set_attr "isa" "sse2,avx,noavx")
17676 (set_attr "type" "sselog1,ssemov,sselog1")
17677 (set_attr "length_immediate" "1,0,1")
17678 (set_attr "prefix_extra" "0,1,*")
17679 (set_attr "prefix" "maybe_vex,maybe_evex,orig")
17680 (set_attr "mode" "TI,V4SF,V4SF")])
17682 (define_insn "*vec_dupv2di"
17683 [(set (match_operand:V2DI 0 "register_operand" "=x,v,v,x")
17684 (vec_duplicate:V2DI
17685 (match_operand:DI 1 "nonimmediate_operand" " 0,Yv,m,0")))]
17689 vpunpcklqdq\t{%d1, %0|%0, %d1}
17690 %vmovddup\t{%1, %0|%0, %1}
17692 [(set_attr "isa" "sse2_noavx,avx,sse3,noavx")
17693 (set_attr "type" "sselog1,sselog1,sselog1,ssemov")
17694 (set_attr "prefix" "orig,maybe_evex,maybe_vex,orig")
17695 (set_attr "mode" "TI,TI,DF,V4SF")])
17697 (define_insn "avx2_vbroadcasti128_<mode>"
17698 [(set (match_operand:VI_256 0 "register_operand" "=x,v,v")
17700 (match_operand:<ssehalfvecmode> 1 "memory_operand" "m,m,m")
17704 vbroadcasti128\t{%1, %0|%0, %1}
17705 vbroadcast<i128vldq>\t{%1, %0|%0, %1}
17706 vbroadcast<shuffletype>32x4\t{%1, %0|%0, %1}"
17707 [(set_attr "isa" "*,avx512dq,avx512vl")
17708 (set_attr "type" "ssemov")
17709 (set_attr "prefix_extra" "1")
17710 (set_attr "prefix" "vex,evex,evex")
17711 (set_attr "mode" "OI")])
17713 ;; Modes handled by AVX vec_dup patterns.
17714 (define_mode_iterator AVX_VEC_DUP_MODE
17715 [V8SI V8SF V4DI V4DF])
17716 ;; Modes handled by AVX2 vec_dup patterns.
17717 (define_mode_iterator AVX2_VEC_DUP_MODE
17718 [V32QI V16QI V16HI V8HI V8SI V4SI])
17720 (define_insn "*vec_dup<mode>"
17721 [(set (match_operand:AVX2_VEC_DUP_MODE 0 "register_operand" "=x,x,Yi")
17722 (vec_duplicate:AVX2_VEC_DUP_MODE
17723 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "m,x,$r")))]
17726 v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0|%0, %1}
17727 v<sseintprefix>broadcast<bcstscalarsuff>\t{%x1, %0|%0, %x1}
17729 [(set_attr "isa" "*,*,noavx512vl")
17730 (set_attr "type" "ssemov")
17731 (set_attr "prefix_extra" "1")
17732 (set_attr "prefix" "maybe_evex")
17733 (set_attr "mode" "<sseinsnmode>")])
17735 (define_insn "vec_dup<mode>"
17736 [(set (match_operand:AVX_VEC_DUP_MODE 0 "register_operand" "=x,x,x,v,x")
17737 (vec_duplicate:AVX_VEC_DUP_MODE
17738 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "m,m,x,v,?x")))]
17741 v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0|%0, %1}
17742 vbroadcast<ssescalarmodesuffix>\t{%1, %0|%0, %1}
17743 v<sseintprefix>broadcast<bcstscalarsuff>\t{%x1, %0|%0, %x1}
17744 v<sseintprefix>broadcast<bcstscalarsuff>\t{%x1, %g0|%g0, %x1}
17746 [(set_attr "type" "ssemov")
17747 (set_attr "prefix_extra" "1")
17748 (set_attr "prefix" "maybe_evex")
17749 (set_attr "isa" "avx2,noavx2,avx2,avx512f,noavx2")
17750 (set_attr "mode" "<sseinsnmode>,V8SF,<sseinsnmode>,<sseinsnmode>,V8SF")])
17753 [(set (match_operand:AVX2_VEC_DUP_MODE 0 "register_operand")
17754 (vec_duplicate:AVX2_VEC_DUP_MODE
17755 (match_operand:<ssescalarmode> 1 "register_operand")))]
17757 /* Disable this splitter if avx512vl_vec_dup_gprv*[qhs]i insn is
17758 available, because then we can broadcast from GPRs directly.
17759 For V*[QH]I modes it requires both -mavx512vl and -mavx512bw,
17760 for V*SI mode it requires just -mavx512vl. */
17761 && !(TARGET_AVX512VL
17762 && (TARGET_AVX512BW || <ssescalarmode>mode == SImode))
17763 && reload_completed && GENERAL_REG_P (operands[1])"
17766 emit_insn (gen_vec_setv4si_0 (gen_lowpart (V4SImode, operands[0]),
17767 CONST0_RTX (V4SImode),
17768 gen_lowpart (SImode, operands[1])));
17769 emit_insn (gen_avx2_pbroadcast<mode> (operands[0],
17770 gen_lowpart (<ssexmmmode>mode,
17776 [(set (match_operand:AVX_VEC_DUP_MODE 0 "register_operand")
17777 (vec_duplicate:AVX_VEC_DUP_MODE
17778 (match_operand:<ssescalarmode> 1 "register_operand")))]
17779 "TARGET_AVX && !TARGET_AVX2 && reload_completed"
17780 [(set (match_dup 2)
17781 (vec_duplicate:<ssehalfvecmode> (match_dup 1)))
17783 (vec_concat:AVX_VEC_DUP_MODE (match_dup 2) (match_dup 2)))]
17784 "operands[2] = gen_lowpart (<ssehalfvecmode>mode, operands[0]);")
17786 (define_insn "avx_vbroadcastf128_<mode>"
17787 [(set (match_operand:V_256 0 "register_operand" "=x,x,x,v,v,v,v")
17789 (match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "m,0,?x,m,0,m,0")
17793 vbroadcast<i128>\t{%1, %0|%0, %1}
17794 vinsert<i128>\t{$1, %1, %0, %0|%0, %0, %1, 1}
17795 vperm2<i128>\t{$0, %t1, %t1, %0|%0, %t1, %t1, 0}
17796 vbroadcast<i128vldq>\t{%1, %0|%0, %1}
17797 vinsert<i128vldq>\t{$1, %1, %0, %0|%0, %0, %1, 1}
17798 vbroadcast<shuffletype>32x4\t{%1, %0|%0, %1}
17799 vinsert<shuffletype>32x4\t{$1, %1, %0, %0|%0, %0, %1, 1}"
17800 [(set_attr "isa" "*,*,*,avx512dq,avx512dq,avx512vl,avx512vl")
17801 (set_attr "type" "ssemov,sselog1,sselog1,ssemov,sselog1,ssemov,sselog1")
17802 (set_attr "prefix_extra" "1")
17803 (set_attr "length_immediate" "0,1,1,0,1,0,1")
17804 (set_attr "prefix" "vex,vex,vex,evex,evex,evex,evex")
17805 (set_attr "mode" "<sseinsnmode>")])
17807 ;; For broadcast[i|f]32x2. Yes there is no v4sf version, only v4si.
17808 (define_mode_iterator VI4F_BRCST32x2
17809 [V16SI (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")
17810 V16SF (V8SF "TARGET_AVX512VL")])
17812 (define_mode_attr 64x2mode
17813 [(V8DF "V2DF") (V8DI "V2DI") (V4DI "V2DI") (V4DF "V2DF")])
17815 (define_mode_attr 32x2mode
17816 [(V16SF "V2SF") (V16SI "V2SI") (V8SI "V2SI")
17817 (V8SF "V2SF") (V4SI "V2SI")])
17819 (define_insn "<mask_codefor>avx512dq_broadcast<mode><mask_name>"
17820 [(set (match_operand:VI4F_BRCST32x2 0 "register_operand" "=v")
17821 (vec_duplicate:VI4F_BRCST32x2
17822 (vec_select:<32x2mode>
17823 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "vm")
17824 (parallel [(const_int 0) (const_int 1)]))))]
17826 "vbroadcast<shuffletype>32x2\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
17827 [(set_attr "type" "ssemov")
17828 (set_attr "prefix_extra" "1")
17829 (set_attr "prefix" "evex")
17830 (set_attr "mode" "<sseinsnmode>")])
17832 (define_insn "<mask_codefor>avx512vl_broadcast<mode><mask_name>_1"
17833 [(set (match_operand:VI4F_256 0 "register_operand" "=v,v")
17834 (vec_duplicate:VI4F_256
17835 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "v,m")))]
17838 vshuf<shuffletype>32x4\t{$0x0, %t1, %t1, %0<mask_operand2>|%0<mask_operand2>, %t1, %t1, 0x0}
17839 vbroadcast<shuffletype>32x4\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17840 [(set_attr "type" "ssemov")
17841 (set_attr "prefix_extra" "1")
17842 (set_attr "prefix" "evex")
17843 (set_attr "mode" "<sseinsnmode>")])
17845 (define_insn "<mask_codefor>avx512dq_broadcast<mode><mask_name>_1"
17846 [(set (match_operand:V16FI 0 "register_operand" "=v,v")
17847 (vec_duplicate:V16FI
17848 (match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "v,m")))]
17851 vshuf<shuffletype>32x4\t{$0x44, %g1, %g1, %0<mask_operand2>|%0<mask_operand2>, %g1, %g1, 0x44}
17852 vbroadcast<shuffletype>32x8\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17853 [(set_attr "type" "ssemov")
17854 (set_attr "prefix_extra" "1")
17855 (set_attr "prefix" "evex")
17856 (set_attr "mode" "<sseinsnmode>")])
17858 ;; For broadcast[i|f]64x2
17859 (define_mode_iterator VI8F_BRCST64x2
17860 [V8DI V8DF (V4DI "TARGET_AVX512VL") (V4DF "TARGET_AVX512VL")])
17862 (define_insn "<mask_codefor>avx512dq_broadcast<mode><mask_name>_1"
17863 [(set (match_operand:VI8F_BRCST64x2 0 "register_operand" "=v,v")
17864 (vec_duplicate:VI8F_BRCST64x2
17865 (match_operand:<64x2mode> 1 "nonimmediate_operand" "v,m")))]
17868 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}
17869 vbroadcast<shuffletype>64x2\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17870 [(set_attr "type" "ssemov")
17871 (set_attr "prefix_extra" "1")
17872 (set_attr "prefix" "evex")
17873 (set_attr "mode" "<sseinsnmode>")])
17875 (define_insn "avx512cd_maskb_vec_dup<mode>"
17876 [(set (match_operand:VI8_AVX512VL 0 "register_operand" "=v")
17877 (vec_duplicate:VI8_AVX512VL
17879 (match_operand:QI 1 "register_operand" "Yk"))))]
17881 "vpbroadcastmb2q\t{%1, %0|%0, %1}"
17882 [(set_attr "type" "mskmov")
17883 (set_attr "prefix" "evex")
17884 (set_attr "mode" "XI")])
17886 (define_insn "avx512cd_maskw_vec_dup<mode>"
17887 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
17888 (vec_duplicate:VI4_AVX512VL
17890 (match_operand:HI 1 "register_operand" "Yk"))))]
17892 "vpbroadcastmw2d\t{%1, %0|%0, %1}"
17893 [(set_attr "type" "mskmov")
17894 (set_attr "prefix" "evex")
17895 (set_attr "mode" "XI")])
17897 ;; Recognize broadcast as a vec_select as produced by builtin_vec_perm.
17898 ;; If it so happens that the input is in memory, use vbroadcast.
17899 ;; Otherwise use vpermilp (and in the case of 256-bit modes, vperm2f128).
17900 (define_insn "*avx_vperm_broadcast_v4sf"
17901 [(set (match_operand:V4SF 0 "register_operand" "=v,v,v")
17903 (match_operand:V4SF 1 "nonimmediate_operand" "m,o,v")
17904 (match_parallel 2 "avx_vbroadcast_operand"
17905 [(match_operand 3 "const_int_operand" "C,n,n")])))]
17908 int elt = INTVAL (operands[3]);
17909 switch (which_alternative)
17913 operands[1] = adjust_address_nv (operands[1], SFmode, elt * 4);
17914 return "vbroadcastss\t{%1, %0|%0, %k1}";
17916 operands[2] = GEN_INT (elt * 0x55);
17917 return "vpermilps\t{%2, %1, %0|%0, %1, %2}";
17919 gcc_unreachable ();
17922 [(set_attr "type" "ssemov,ssemov,sselog1")
17923 (set_attr "prefix_extra" "1")
17924 (set_attr "length_immediate" "0,0,1")
17925 (set_attr "prefix" "maybe_evex")
17926 (set_attr "mode" "SF,SF,V4SF")])
17928 (define_insn_and_split "*avx_vperm_broadcast_<mode>"
17929 [(set (match_operand:VF_256 0 "register_operand" "=v,v,v")
17931 (match_operand:VF_256 1 "nonimmediate_operand" "m,o,?v")
17932 (match_parallel 2 "avx_vbroadcast_operand"
17933 [(match_operand 3 "const_int_operand" "C,n,n")])))]
17936 "&& reload_completed && (<MODE>mode != V4DFmode || !TARGET_AVX2)"
17937 [(set (match_dup 0) (vec_duplicate:VF_256 (match_dup 1)))]
17939 rtx op0 = operands[0], op1 = operands[1];
17940 int elt = INTVAL (operands[3]);
17946 if (TARGET_AVX2 && elt == 0)
17948 emit_insn (gen_vec_dup<mode> (op0, gen_lowpart (<ssescalarmode>mode,
17953 /* Shuffle element we care about into all elements of the 128-bit lane.
17954 The other lane gets shuffled too, but we don't care. */
17955 if (<MODE>mode == V4DFmode)
17956 mask = (elt & 1 ? 15 : 0);
17958 mask = (elt & 3) * 0x55;
17959 emit_insn (gen_avx_vpermil<mode> (op0, op1, GEN_INT (mask)));
17961 /* Shuffle the lane we care about into both lanes of the dest. */
17962 mask = (elt / (<ssescalarnum> / 2)) * 0x11;
17963 if (EXT_REX_SSE_REG_P (op0))
17965 /* There is no EVEX VPERM2F128, but we can use either VBROADCASTSS
17967 gcc_assert (<MODE>mode == V8SFmode);
17968 if ((mask & 1) == 0)
17969 emit_insn (gen_avx2_vec_dupv8sf (op0,
17970 gen_lowpart (V4SFmode, op0)));
17972 emit_insn (gen_avx512vl_shuf_f32x4_1 (op0, op0, op0,
17973 GEN_INT (4), GEN_INT (5),
17974 GEN_INT (6), GEN_INT (7),
17975 GEN_INT (12), GEN_INT (13),
17976 GEN_INT (14), GEN_INT (15)));
17980 emit_insn (gen_avx_vperm2f128<mode>3 (op0, op0, op0, GEN_INT (mask)));
17984 operands[1] = adjust_address (op1, <ssescalarmode>mode,
17985 elt * GET_MODE_SIZE (<ssescalarmode>mode));
17988 (define_expand "<sse2_avx_avx512f>_vpermil<mode><mask_name>"
17989 [(set (match_operand:VF2 0 "register_operand")
17991 (match_operand:VF2 1 "nonimmediate_operand")
17992 (match_operand:SI 2 "const_0_to_255_operand")))]
17993 "TARGET_AVX && <mask_mode512bit_condition>"
17995 int mask = INTVAL (operands[2]);
17996 rtx perm[<ssescalarnum>];
17999 for (i = 0; i < <ssescalarnum>; i = i + 2)
18001 perm[i] = GEN_INT (((mask >> i) & 1) + i);
18002 perm[i + 1] = GEN_INT (((mask >> (i + 1)) & 1) + i);
18006 = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (<ssescalarnum>, perm));
18009 (define_expand "<sse2_avx_avx512f>_vpermil<mode><mask_name>"
18010 [(set (match_operand:VF1 0 "register_operand")
18012 (match_operand:VF1 1 "nonimmediate_operand")
18013 (match_operand:SI 2 "const_0_to_255_operand")))]
18014 "TARGET_AVX && <mask_mode512bit_condition>"
18016 int mask = INTVAL (operands[2]);
18017 rtx perm[<ssescalarnum>];
18020 for (i = 0; i < <ssescalarnum>; i = i + 4)
18022 perm[i] = GEN_INT (((mask >> 0) & 3) + i);
18023 perm[i + 1] = GEN_INT (((mask >> 2) & 3) + i);
18024 perm[i + 2] = GEN_INT (((mask >> 4) & 3) + i);
18025 perm[i + 3] = GEN_INT (((mask >> 6) & 3) + i);
18029 = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (<ssescalarnum>, perm));
18032 (define_insn "*<sse2_avx_avx512f>_vpermilp<mode><mask_name>"
18033 [(set (match_operand:VF 0 "register_operand" "=v")
18035 (match_operand:VF 1 "nonimmediate_operand" "vm")
18036 (match_parallel 2 ""
18037 [(match_operand 3 "const_int_operand")])))]
18038 "TARGET_AVX && <mask_mode512bit_condition>
18039 && avx_vpermilp_parallel (operands[2], <MODE>mode)"
18041 int mask = avx_vpermilp_parallel (operands[2], <MODE>mode) - 1;
18042 operands[2] = GEN_INT (mask);
18043 return "vpermil<ssemodesuffix>\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}";
18045 [(set_attr "type" "sselog")
18046 (set_attr "prefix_extra" "1")
18047 (set_attr "length_immediate" "1")
18048 (set_attr "prefix" "<mask_prefix>")
18049 (set_attr "mode" "<sseinsnmode>")])
18051 (define_insn "<sse2_avx_avx512f>_vpermilvar<mode>3<mask_name>"
18052 [(set (match_operand:VF 0 "register_operand" "=v")
18054 [(match_operand:VF 1 "register_operand" "v")
18055 (match_operand:<sseintvecmode> 2 "nonimmediate_operand" "vm")]
18057 "TARGET_AVX && <mask_mode512bit_condition>"
18058 "vpermil<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18059 [(set_attr "type" "sselog")
18060 (set_attr "prefix_extra" "1")
18061 (set_attr "btver2_decode" "vector")
18062 (set_attr "prefix" "<mask_prefix>")
18063 (set_attr "mode" "<sseinsnmode>")])
18065 (define_mode_iterator VPERMI2
18066 [V16SI V16SF V8DI V8DF
18067 (V8SI "TARGET_AVX512VL") (V8SF "TARGET_AVX512VL")
18068 (V4DI "TARGET_AVX512VL") (V4DF "TARGET_AVX512VL")
18069 (V4SI "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
18070 (V2DI "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")
18071 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX512BW && TARGET_AVX512VL")
18072 (V8HI "TARGET_AVX512BW && TARGET_AVX512VL")
18073 (V64QI "TARGET_AVX512VBMI") (V32QI "TARGET_AVX512VBMI && TARGET_AVX512VL")
18074 (V16QI "TARGET_AVX512VBMI && TARGET_AVX512VL")])
18076 (define_mode_iterator VPERMI2I
18078 (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")
18079 (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")
18080 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX512BW && TARGET_AVX512VL")
18081 (V8HI "TARGET_AVX512BW && TARGET_AVX512VL")
18082 (V64QI "TARGET_AVX512VBMI") (V32QI "TARGET_AVX512VBMI && TARGET_AVX512VL")
18083 (V16QI "TARGET_AVX512VBMI && TARGET_AVX512VL")])
18085 (define_expand "<avx512>_vpermi2var<mode>3_mask"
18086 [(set (match_operand:VPERMI2 0 "register_operand")
18089 [(match_operand:<sseintvecmode> 2 "register_operand")
18090 (match_operand:VPERMI2 1 "register_operand")
18091 (match_operand:VPERMI2 3 "nonimmediate_operand")]
18094 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
18096 "operands[5] = gen_lowpart (<MODE>mode, operands[2]);")
18098 (define_insn "*<avx512>_vpermi2var<mode>3_mask"
18099 [(set (match_operand:VPERMI2I 0 "register_operand" "=v")
18100 (vec_merge:VPERMI2I
18102 [(match_operand:<sseintvecmode> 2 "register_operand" "0")
18103 (match_operand:VPERMI2I 1 "register_operand" "v")
18104 (match_operand:VPERMI2I 3 "nonimmediate_operand" "vm")]
18107 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
18109 "vpermi2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
18110 [(set_attr "type" "sselog")
18111 (set_attr "prefix" "evex")
18112 (set_attr "mode" "<sseinsnmode>")])
18114 (define_insn "*<avx512>_vpermi2var<mode>3_mask"
18115 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
18116 (vec_merge:VF_AVX512VL
18117 (unspec:VF_AVX512VL
18118 [(match_operand:<sseintvecmode> 2 "register_operand" "0")
18119 (match_operand:VF_AVX512VL 1 "register_operand" "v")
18120 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "vm")]
18122 (subreg:VF_AVX512VL (match_dup 2) 0)
18123 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
18125 "vpermi2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
18126 [(set_attr "type" "sselog")
18127 (set_attr "prefix" "evex")
18128 (set_attr "mode" "<sseinsnmode>")])
18130 (define_expand "<avx512>_vpermt2var<mode>3_maskz"
18131 [(match_operand:VPERMI2 0 "register_operand")
18132 (match_operand:<sseintvecmode> 1 "register_operand")
18133 (match_operand:VPERMI2 2 "register_operand")
18134 (match_operand:VPERMI2 3 "nonimmediate_operand")
18135 (match_operand:<avx512fmaskmode> 4 "register_operand")]
18138 emit_insn (gen_<avx512>_vpermt2var<mode>3_maskz_1 (
18139 operands[0], operands[1], operands[2], operands[3],
18140 CONST0_RTX (<MODE>mode), operands[4]));
18144 (define_insn "<avx512>_vpermt2var<mode>3<sd_maskz_name>"
18145 [(set (match_operand:VPERMI2 0 "register_operand" "=v,v")
18147 [(match_operand:<sseintvecmode> 1 "register_operand" "v,0")
18148 (match_operand:VPERMI2 2 "register_operand" "0,v")
18149 (match_operand:VPERMI2 3 "nonimmediate_operand" "vm,vm")]
18153 vpermt2<ssemodesuffix>\t{%3, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %3}
18154 vpermi2<ssemodesuffix>\t{%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3}"
18155 [(set_attr "type" "sselog")
18156 (set_attr "prefix" "evex")
18157 (set_attr "mode" "<sseinsnmode>")])
18159 (define_insn "<avx512>_vpermt2var<mode>3_mask"
18160 [(set (match_operand:VPERMI2 0 "register_operand" "=v")
18163 [(match_operand:<sseintvecmode> 1 "register_operand" "v")
18164 (match_operand:VPERMI2 2 "register_operand" "0")
18165 (match_operand:VPERMI2 3 "nonimmediate_operand" "vm")]
18168 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
18170 "vpermt2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
18171 [(set_attr "type" "sselog")
18172 (set_attr "prefix" "evex")
18173 (set_attr "mode" "<sseinsnmode>")])
18175 (define_expand "avx_vperm2f128<mode>3"
18176 [(set (match_operand:AVX256MODE2P 0 "register_operand")
18177 (unspec:AVX256MODE2P
18178 [(match_operand:AVX256MODE2P 1 "register_operand")
18179 (match_operand:AVX256MODE2P 2 "nonimmediate_operand")
18180 (match_operand:SI 3 "const_0_to_255_operand")]
18181 UNSPEC_VPERMIL2F128))]
18184 int mask = INTVAL (operands[3]);
18185 if ((mask & 0x88) == 0)
18187 rtx perm[<ssescalarnum>], t1, t2;
18188 int i, base, nelt = <ssescalarnum>, nelt2 = nelt / 2;
18190 base = (mask & 3) * nelt2;
18191 for (i = 0; i < nelt2; ++i)
18192 perm[i] = GEN_INT (base + i);
18194 base = ((mask >> 4) & 3) * nelt2;
18195 for (i = 0; i < nelt2; ++i)
18196 perm[i + nelt2] = GEN_INT (base + i);
18198 t2 = gen_rtx_VEC_CONCAT (<ssedoublevecmode>mode,
18199 operands[1], operands[2]);
18200 t1 = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (nelt, perm));
18201 t2 = gen_rtx_VEC_SELECT (<MODE>mode, t2, t1);
18202 t2 = gen_rtx_SET (operands[0], t2);
18208 ;; Note that bits 7 and 3 of the imm8 allow lanes to be zeroed, which
18209 ;; means that in order to represent this properly in rtl we'd have to
18210 ;; nest *another* vec_concat with a zero operand and do the select from
18211 ;; a 4x wide vector. That doesn't seem very nice.
18212 (define_insn "*avx_vperm2f128<mode>_full"
18213 [(set (match_operand:AVX256MODE2P 0 "register_operand" "=x")
18214 (unspec:AVX256MODE2P
18215 [(match_operand:AVX256MODE2P 1 "register_operand" "x")
18216 (match_operand:AVX256MODE2P 2 "nonimmediate_operand" "xm")
18217 (match_operand:SI 3 "const_0_to_255_operand" "n")]
18218 UNSPEC_VPERMIL2F128))]
18220 "vperm2<i128>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
18221 [(set_attr "type" "sselog")
18222 (set_attr "prefix_extra" "1")
18223 (set_attr "length_immediate" "1")
18224 (set_attr "prefix" "vex")
18225 (set_attr "mode" "<sseinsnmode>")])
18227 (define_insn "*avx_vperm2f128<mode>_nozero"
18228 [(set (match_operand:AVX256MODE2P 0 "register_operand" "=x")
18229 (vec_select:AVX256MODE2P
18230 (vec_concat:<ssedoublevecmode>
18231 (match_operand:AVX256MODE2P 1 "register_operand" "x")
18232 (match_operand:AVX256MODE2P 2 "nonimmediate_operand" "xm"))
18233 (match_parallel 3 ""
18234 [(match_operand 4 "const_int_operand")])))]
18236 && avx_vperm2f128_parallel (operands[3], <MODE>mode)"
18238 int mask = avx_vperm2f128_parallel (operands[3], <MODE>mode) - 1;
18240 return "vinsert<i128>\t{$0, %x2, %1, %0|%0, %1, %x2, 0}";
18242 return "vinsert<i128>\t{$1, %x2, %1, %0|%0, %1, %x2, 1}";
18243 operands[3] = GEN_INT (mask);
18244 return "vperm2<i128>\t{%3, %2, %1, %0|%0, %1, %2, %3}";
18246 [(set_attr "type" "sselog")
18247 (set_attr "prefix_extra" "1")
18248 (set_attr "length_immediate" "1")
18249 (set_attr "prefix" "vex")
18250 (set_attr "mode" "<sseinsnmode>")])
18252 (define_insn "*ssse3_palignr<mode>_perm"
18253 [(set (match_operand:V_128 0 "register_operand" "=x,x,v")
18255 (match_operand:V_128 1 "register_operand" "0,x,v")
18256 (match_parallel 2 "palignr_operand"
18257 [(match_operand 3 "const_int_operand" "n,n,n")])))]
18260 operands[2] = (GEN_INT (INTVAL (operands[3])
18261 * GET_MODE_UNIT_SIZE (GET_MODE (operands[0]))));
18263 switch (which_alternative)
18266 return "palignr\t{%2, %1, %0|%0, %1, %2}";
18269 return "vpalignr\t{%2, %1, %1, %0|%0, %1, %1, %2}";
18271 gcc_unreachable ();
18274 [(set_attr "isa" "noavx,avx,avx512bw")
18275 (set_attr "type" "sseishft")
18276 (set_attr "atom_unit" "sishuf")
18277 (set_attr "prefix_data16" "1,*,*")
18278 (set_attr "prefix_extra" "1")
18279 (set_attr "length_immediate" "1")
18280 (set_attr "prefix" "orig,vex,evex")])
18282 (define_expand "avx512vl_vinsert<mode>"
18283 [(match_operand:VI48F_256 0 "register_operand")
18284 (match_operand:VI48F_256 1 "register_operand")
18285 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand")
18286 (match_operand:SI 3 "const_0_to_1_operand")
18287 (match_operand:VI48F_256 4 "register_operand")
18288 (match_operand:<avx512fmaskmode> 5 "register_operand")]
18291 rtx (*insn)(rtx, rtx, rtx, rtx, rtx);
18293 switch (INTVAL (operands[3]))
18296 insn = gen_vec_set_lo_<mode>_mask;
18299 insn = gen_vec_set_hi_<mode>_mask;
18302 gcc_unreachable ();
18305 emit_insn (insn (operands[0], operands[1], operands[2], operands[4],
18310 (define_expand "avx_vinsertf128<mode>"
18311 [(match_operand:V_256 0 "register_operand")
18312 (match_operand:V_256 1 "register_operand")
18313 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand")
18314 (match_operand:SI 3 "const_0_to_1_operand")]
18317 rtx (*insn)(rtx, rtx, rtx);
18319 switch (INTVAL (operands[3]))
18322 insn = gen_vec_set_lo_<mode>;
18325 insn = gen_vec_set_hi_<mode>;
18328 gcc_unreachable ();
18331 emit_insn (insn (operands[0], operands[1], operands[2]));
18335 (define_insn "vec_set_lo_<mode><mask_name>"
18336 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
18337 (vec_concat:VI8F_256
18338 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
18339 (vec_select:<ssehalfvecmode>
18340 (match_operand:VI8F_256 1 "register_operand" "v")
18341 (parallel [(const_int 2) (const_int 3)]))))]
18342 "TARGET_AVX && <mask_avx512dq_condition>"
18344 if (TARGET_AVX512DQ)
18345 return "vinsert<shuffletype>64x2\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}";
18346 else if (TARGET_AVX512VL)
18347 return "vinsert<shuffletype>32x4\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}";
18349 return "vinsert<i128>\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}";
18351 [(set_attr "type" "sselog")
18352 (set_attr "prefix_extra" "1")
18353 (set_attr "length_immediate" "1")
18354 (set_attr "prefix" "vex")
18355 (set_attr "mode" "<sseinsnmode>")])
18357 (define_insn "vec_set_hi_<mode><mask_name>"
18358 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
18359 (vec_concat:VI8F_256
18360 (vec_select:<ssehalfvecmode>
18361 (match_operand:VI8F_256 1 "register_operand" "v")
18362 (parallel [(const_int 0) (const_int 1)]))
18363 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
18364 "TARGET_AVX && <mask_avx512dq_condition>"
18366 if (TARGET_AVX512DQ)
18367 return "vinsert<shuffletype>64x2\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}";
18368 else if (TARGET_AVX512VL)
18369 return "vinsert<shuffletype>32x4\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}";
18371 return "vinsert<i128>\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}";
18373 [(set_attr "type" "sselog")
18374 (set_attr "prefix_extra" "1")
18375 (set_attr "length_immediate" "1")
18376 (set_attr "prefix" "vex")
18377 (set_attr "mode" "<sseinsnmode>")])
18379 (define_insn "vec_set_lo_<mode><mask_name>"
18380 [(set (match_operand:VI4F_256 0 "register_operand" "=v")
18381 (vec_concat:VI4F_256
18382 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
18383 (vec_select:<ssehalfvecmode>
18384 (match_operand:VI4F_256 1 "register_operand" "v")
18385 (parallel [(const_int 4) (const_int 5)
18386 (const_int 6) (const_int 7)]))))]
18389 if (TARGET_AVX512VL)
18390 return "vinsert<shuffletype>32x4\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}";
18392 return "vinsert<i128>\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}";
18394 [(set_attr "type" "sselog")
18395 (set_attr "prefix_extra" "1")
18396 (set_attr "length_immediate" "1")
18397 (set_attr "prefix" "vex")
18398 (set_attr "mode" "<sseinsnmode>")])
18400 (define_insn "vec_set_hi_<mode><mask_name>"
18401 [(set (match_operand:VI4F_256 0 "register_operand" "=v")
18402 (vec_concat:VI4F_256
18403 (vec_select:<ssehalfvecmode>
18404 (match_operand:VI4F_256 1 "register_operand" "v")
18405 (parallel [(const_int 0) (const_int 1)
18406 (const_int 2) (const_int 3)]))
18407 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
18410 if (TARGET_AVX512VL)
18411 return "vinsert<shuffletype>32x4\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}";
18413 return "vinsert<i128>\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}";
18415 [(set_attr "type" "sselog")
18416 (set_attr "prefix_extra" "1")
18417 (set_attr "length_immediate" "1")
18418 (set_attr "prefix" "vex")
18419 (set_attr "mode" "<sseinsnmode>")])
18421 (define_insn "vec_set_lo_v16hi"
18422 [(set (match_operand:V16HI 0 "register_operand" "=x,v")
18424 (match_operand:V8HI 2 "nonimmediate_operand" "xm,vm")
18426 (match_operand:V16HI 1 "register_operand" "x,v")
18427 (parallel [(const_int 8) (const_int 9)
18428 (const_int 10) (const_int 11)
18429 (const_int 12) (const_int 13)
18430 (const_int 14) (const_int 15)]))))]
18433 vinsert%~128\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}
18434 vinserti32x4\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}"
18435 [(set_attr "type" "sselog")
18436 (set_attr "prefix_extra" "1")
18437 (set_attr "length_immediate" "1")
18438 (set_attr "prefix" "vex,evex")
18439 (set_attr "mode" "OI")])
18441 (define_insn "vec_set_hi_v16hi"
18442 [(set (match_operand:V16HI 0 "register_operand" "=x,v")
18445 (match_operand:V16HI 1 "register_operand" "x,v")
18446 (parallel [(const_int 0) (const_int 1)
18447 (const_int 2) (const_int 3)
18448 (const_int 4) (const_int 5)
18449 (const_int 6) (const_int 7)]))
18450 (match_operand:V8HI 2 "nonimmediate_operand" "xm,vm")))]
18453 vinsert%~128\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}
18454 vinserti32x4\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}"
18455 [(set_attr "type" "sselog")
18456 (set_attr "prefix_extra" "1")
18457 (set_attr "length_immediate" "1")
18458 (set_attr "prefix" "vex,evex")
18459 (set_attr "mode" "OI")])
18461 (define_insn "vec_set_lo_v32qi"
18462 [(set (match_operand:V32QI 0 "register_operand" "=x,v")
18464 (match_operand:V16QI 2 "nonimmediate_operand" "xm,v")
18466 (match_operand:V32QI 1 "register_operand" "x,v")
18467 (parallel [(const_int 16) (const_int 17)
18468 (const_int 18) (const_int 19)
18469 (const_int 20) (const_int 21)
18470 (const_int 22) (const_int 23)
18471 (const_int 24) (const_int 25)
18472 (const_int 26) (const_int 27)
18473 (const_int 28) (const_int 29)
18474 (const_int 30) (const_int 31)]))))]
18477 vinsert%~128\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}
18478 vinserti32x4\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}"
18479 [(set_attr "type" "sselog")
18480 (set_attr "prefix_extra" "1")
18481 (set_attr "length_immediate" "1")
18482 (set_attr "prefix" "vex,evex")
18483 (set_attr "mode" "OI")])
18485 (define_insn "vec_set_hi_v32qi"
18486 [(set (match_operand:V32QI 0 "register_operand" "=x,v")
18489 (match_operand:V32QI 1 "register_operand" "x,v")
18490 (parallel [(const_int 0) (const_int 1)
18491 (const_int 2) (const_int 3)
18492 (const_int 4) (const_int 5)
18493 (const_int 6) (const_int 7)
18494 (const_int 8) (const_int 9)
18495 (const_int 10) (const_int 11)
18496 (const_int 12) (const_int 13)
18497 (const_int 14) (const_int 15)]))
18498 (match_operand:V16QI 2 "nonimmediate_operand" "xm,vm")))]
18501 vinsert%~128\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}
18502 vinserti32x4\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}"
18503 [(set_attr "type" "sselog")
18504 (set_attr "prefix_extra" "1")
18505 (set_attr "length_immediate" "1")
18506 (set_attr "prefix" "vex,evex")
18507 (set_attr "mode" "OI")])
18509 (define_insn "<avx_avx2>_maskload<ssemodesuffix><avxsizesuffix>"
18510 [(set (match_operand:V48_AVX2 0 "register_operand" "=x")
18512 [(match_operand:<sseintvecmode> 2 "register_operand" "x")
18513 (match_operand:V48_AVX2 1 "memory_operand" "m")]
18516 "v<sseintprefix>maskmov<ssemodesuffix>\t{%1, %2, %0|%0, %2, %1}"
18517 [(set_attr "type" "sselog1")
18518 (set_attr "prefix_extra" "1")
18519 (set_attr "prefix" "vex")
18520 (set_attr "btver2_decode" "vector")
18521 (set_attr "mode" "<sseinsnmode>")])
18523 (define_insn "<avx_avx2>_maskstore<ssemodesuffix><avxsizesuffix>"
18524 [(set (match_operand:V48_AVX2 0 "memory_operand" "+m")
18526 [(match_operand:<sseintvecmode> 1 "register_operand" "x")
18527 (match_operand:V48_AVX2 2 "register_operand" "x")
18531 "v<sseintprefix>maskmov<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
18532 [(set_attr "type" "sselog1")
18533 (set_attr "prefix_extra" "1")
18534 (set_attr "prefix" "vex")
18535 (set_attr "btver2_decode" "vector")
18536 (set_attr "mode" "<sseinsnmode>")])
18538 (define_expand "maskload<mode><sseintvecmodelower>"
18539 [(set (match_operand:V48_AVX2 0 "register_operand")
18541 [(match_operand:<sseintvecmode> 2 "register_operand")
18542 (match_operand:V48_AVX2 1 "memory_operand")]
18546 (define_expand "maskload<mode><avx512fmaskmodelower>"
18547 [(set (match_operand:V48_AVX512VL 0 "register_operand")
18548 (vec_merge:V48_AVX512VL
18549 (match_operand:V48_AVX512VL 1 "memory_operand")
18551 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18554 (define_expand "maskload<mode><avx512fmaskmodelower>"
18555 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
18556 (vec_merge:VI12_AVX512VL
18557 (match_operand:VI12_AVX512VL 1 "memory_operand")
18559 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18562 (define_expand "maskstore<mode><sseintvecmodelower>"
18563 [(set (match_operand:V48_AVX2 0 "memory_operand")
18565 [(match_operand:<sseintvecmode> 2 "register_operand")
18566 (match_operand:V48_AVX2 1 "register_operand")
18571 (define_expand "maskstore<mode><avx512fmaskmodelower>"
18572 [(set (match_operand:V48_AVX512VL 0 "memory_operand")
18573 (vec_merge:V48_AVX512VL
18574 (match_operand:V48_AVX512VL 1 "register_operand")
18576 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18579 (define_expand "maskstore<mode><avx512fmaskmodelower>"
18580 [(set (match_operand:VI12_AVX512VL 0 "memory_operand")
18581 (vec_merge:VI12_AVX512VL
18582 (match_operand:VI12_AVX512VL 1 "register_operand")
18584 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18587 (define_expand "cbranch<mode>4"
18588 [(set (reg:CC FLAGS_REG)
18589 (compare:CC (match_operand:VI48_AVX 1 "register_operand")
18590 (match_operand:VI48_AVX 2 "nonimmediate_operand")))
18591 (set (pc) (if_then_else
18592 (match_operator 0 "bt_comparison_operator"
18593 [(reg:CC FLAGS_REG) (const_int 0)])
18594 (label_ref (match_operand 3))
18598 ix86_expand_branch (GET_CODE (operands[0]),
18599 operands[1], operands[2], operands[3]);
18604 (define_insn_and_split "avx_<castmode><avxsizesuffix>_<castmode>"
18605 [(set (match_operand:AVX256MODE2P 0 "nonimmediate_operand" "=x,m")
18606 (unspec:AVX256MODE2P
18607 [(match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "xm,x")]
18609 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
18611 "&& reload_completed"
18612 [(set (match_dup 0) (match_dup 1))]
18614 if (REG_P (operands[0]))
18615 operands[0] = gen_lowpart (<ssehalfvecmode>mode, operands[0]);
18617 operands[1] = lowpart_subreg (<MODE>mode, operands[1],
18618 <ssehalfvecmode>mode);
18621 ;; Modes handled by vec_init expanders.
18622 (define_mode_iterator VEC_INIT_MODE
18623 [(V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI
18624 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX") V8HI
18625 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
18626 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI
18627 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
18628 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")
18629 (V4TI "TARGET_AVX512F") (V2TI "TARGET_AVX")])
18631 ;; Likewise, but for initialization from half sized vectors.
18632 ;; Thus, these are all VEC_INIT_MODE modes except V2??.
18633 (define_mode_iterator VEC_INIT_HALF_MODE
18634 [(V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI
18635 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX") V8HI
18636 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
18637 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX")
18638 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
18639 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX")
18640 (V4TI "TARGET_AVX512F")])
18642 (define_expand "vec_init<mode><ssescalarmodelower>"
18643 [(match_operand:VEC_INIT_MODE 0 "register_operand")
18647 ix86_expand_vector_init (false, operands[0], operands[1]);
18651 (define_expand "vec_init<mode><ssehalfvecmodelower>"
18652 [(match_operand:VEC_INIT_HALF_MODE 0 "register_operand")
18656 ix86_expand_vector_init (false, operands[0], operands[1]);
18660 (define_insn "<avx2_avx512>_ashrv<mode><mask_name>"
18661 [(set (match_operand:VI48_AVX512F_AVX512VL 0 "register_operand" "=v")
18662 (ashiftrt:VI48_AVX512F_AVX512VL
18663 (match_operand:VI48_AVX512F_AVX512VL 1 "register_operand" "v")
18664 (match_operand:VI48_AVX512F_AVX512VL 2 "nonimmediate_operand" "vm")))]
18665 "TARGET_AVX2 && <mask_mode512bit_condition>"
18666 "vpsrav<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18667 [(set_attr "type" "sseishft")
18668 (set_attr "prefix" "maybe_evex")
18669 (set_attr "mode" "<sseinsnmode>")])
18671 (define_insn "<avx2_avx512>_ashrv<mode><mask_name>"
18672 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
18673 (ashiftrt:VI2_AVX512VL
18674 (match_operand:VI2_AVX512VL 1 "register_operand" "v")
18675 (match_operand:VI2_AVX512VL 2 "nonimmediate_operand" "vm")))]
18677 "vpsravw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18678 [(set_attr "type" "sseishft")
18679 (set_attr "prefix" "maybe_evex")
18680 (set_attr "mode" "<sseinsnmode>")])
18682 (define_insn "<avx2_avx512>_<shift_insn>v<mode><mask_name>"
18683 [(set (match_operand:VI48_AVX512F 0 "register_operand" "=v")
18684 (any_lshift:VI48_AVX512F
18685 (match_operand:VI48_AVX512F 1 "register_operand" "v")
18686 (match_operand:VI48_AVX512F 2 "nonimmediate_operand" "vm")))]
18687 "TARGET_AVX2 && <mask_mode512bit_condition>"
18688 "vp<vshift>v<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18689 [(set_attr "type" "sseishft")
18690 (set_attr "prefix" "maybe_evex")
18691 (set_attr "mode" "<sseinsnmode>")])
18693 (define_insn "<avx2_avx512>_<shift_insn>v<mode><mask_name>"
18694 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
18695 (any_lshift:VI2_AVX512VL
18696 (match_operand:VI2_AVX512VL 1 "register_operand" "v")
18697 (match_operand:VI2_AVX512VL 2 "nonimmediate_operand" "vm")))]
18699 "vp<vshift>v<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18700 [(set_attr "type" "sseishft")
18701 (set_attr "prefix" "maybe_evex")
18702 (set_attr "mode" "<sseinsnmode>")])
18704 (define_insn "avx_vec_concat<mode>"
18705 [(set (match_operand:V_256_512 0 "register_operand" "=x,v,x,Yv")
18706 (vec_concat:V_256_512
18707 (match_operand:<ssehalfvecmode> 1 "register_operand" "x,v,x,v")
18708 (match_operand:<ssehalfvecmode> 2 "vector_move_operand" "xm,vm,C,C")))]
18711 switch (which_alternative)
18714 return "vinsert<i128>\t{$0x1, %2, %<concat_tg_mode>1, %0|%0, %<concat_tg_mode>1, %2, 0x1}";
18716 if (<MODE_SIZE> == 64)
18718 if (TARGET_AVX512DQ && GET_MODE_SIZE (<ssescalarmode>mode) == 4)
18719 return "vinsert<shuffletype>32x8\t{$0x1, %2, %<concat_tg_mode>1, %0|%0, %<concat_tg_mode>1, %2, 0x1}";
18721 return "vinsert<shuffletype>64x4\t{$0x1, %2, %<concat_tg_mode>1, %0|%0, %<concat_tg_mode>1, %2, 0x1}";
18725 if (TARGET_AVX512DQ && GET_MODE_SIZE (<ssescalarmode>mode) == 8)
18726 return "vinsert<shuffletype>64x2\t{$0x1, %2, %<concat_tg_mode>1, %0|%0, %<concat_tg_mode>1, %2, 0x1}";
18728 return "vinsert<shuffletype>32x4\t{$0x1, %2, %<concat_tg_mode>1, %0|%0, %<concat_tg_mode>1, %2, 0x1}";
18732 switch (get_attr_mode (insn))
18735 return "vmovaps\t{%1, %t0|%t0, %1}";
18737 return "vmovapd\t{%1, %t0|%t0, %1}";
18739 return "vmovaps\t{%1, %x0|%x0, %1}";
18741 return "vmovapd\t{%1, %x0|%x0, %1}";
18743 if (which_alternative == 2)
18744 return "vmovdqa\t{%1, %t0|%t0, %1}";
18745 else if (GET_MODE_SIZE (<ssescalarmode>mode) == 8)
18746 return "vmovdqa64\t{%1, %t0|%t0, %1}";
18748 return "vmovdqa32\t{%1, %t0|%t0, %1}";
18750 if (which_alternative == 2)
18751 return "vmovdqa\t{%1, %x0|%x0, %1}";
18752 else if (GET_MODE_SIZE (<ssescalarmode>mode) == 8)
18753 return "vmovdqa64\t{%1, %x0|%x0, %1}";
18755 return "vmovdqa32\t{%1, %x0|%x0, %1}";
18757 gcc_unreachable ();
18760 gcc_unreachable ();
18763 [(set_attr "type" "sselog,sselog,ssemov,ssemov")
18764 (set_attr "prefix_extra" "1,1,*,*")
18765 (set_attr "length_immediate" "1,1,*,*")
18766 (set_attr "prefix" "maybe_evex")
18767 (set_attr "mode" "<sseinsnmode>")])
18769 (define_insn "vcvtph2ps<mask_name>"
18770 [(set (match_operand:V4SF 0 "register_operand" "=v")
18772 (unspec:V8SF [(match_operand:V8HI 1 "register_operand" "v")]
18774 (parallel [(const_int 0) (const_int 1)
18775 (const_int 2) (const_int 3)])))]
18776 "TARGET_F16C || TARGET_AVX512VL"
18777 "vcvtph2ps\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
18778 [(set_attr "type" "ssecvt")
18779 (set_attr "prefix" "maybe_evex")
18780 (set_attr "mode" "V4SF")])
18782 (define_insn "*vcvtph2ps_load<mask_name>"
18783 [(set (match_operand:V4SF 0 "register_operand" "=v")
18784 (unspec:V4SF [(match_operand:V4HI 1 "memory_operand" "m")]
18785 UNSPEC_VCVTPH2PS))]
18786 "TARGET_F16C || TARGET_AVX512VL"
18787 "vcvtph2ps\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
18788 [(set_attr "type" "ssecvt")
18789 (set_attr "prefix" "vex")
18790 (set_attr "mode" "V8SF")])
18792 (define_insn "vcvtph2ps256<mask_name>"
18793 [(set (match_operand:V8SF 0 "register_operand" "=v")
18794 (unspec:V8SF [(match_operand:V8HI 1 "nonimmediate_operand" "vm")]
18795 UNSPEC_VCVTPH2PS))]
18796 "TARGET_F16C || TARGET_AVX512VL"
18797 "vcvtph2ps\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
18798 [(set_attr "type" "ssecvt")
18799 (set_attr "prefix" "vex")
18800 (set_attr "btver2_decode" "double")
18801 (set_attr "mode" "V8SF")])
18803 (define_insn "<mask_codefor>avx512f_vcvtph2ps512<mask_name><round_saeonly_name>"
18804 [(set (match_operand:V16SF 0 "register_operand" "=v")
18806 [(match_operand:V16HI 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
18807 UNSPEC_VCVTPH2PS))]
18809 "vcvtph2ps\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
18810 [(set_attr "type" "ssecvt")
18811 (set_attr "prefix" "evex")
18812 (set_attr "mode" "V16SF")])
18814 (define_expand "vcvtps2ph_mask"
18815 [(set (match_operand:V8HI 0 "register_operand")
18818 (unspec:V4HI [(match_operand:V4SF 1 "register_operand")
18819 (match_operand:SI 2 "const_0_to_255_operand")]
18822 (match_operand:V8HI 3 "vector_move_operand")
18823 (match_operand:QI 4 "register_operand")))]
18825 "operands[5] = CONST0_RTX (V4HImode);")
18827 (define_expand "vcvtps2ph"
18828 [(set (match_operand:V8HI 0 "register_operand")
18830 (unspec:V4HI [(match_operand:V4SF 1 "register_operand")
18831 (match_operand:SI 2 "const_0_to_255_operand")]
18835 "operands[3] = CONST0_RTX (V4HImode);")
18837 (define_insn "*vcvtps2ph<mask_name>"
18838 [(set (match_operand:V8HI 0 "register_operand" "=v")
18840 (unspec:V4HI [(match_operand:V4SF 1 "register_operand" "v")
18841 (match_operand:SI 2 "const_0_to_255_operand" "N")]
18843 (match_operand:V4HI 3 "const0_operand")))]
18844 "(TARGET_F16C || TARGET_AVX512VL) && <mask_avx512vl_condition>"
18845 "vcvtps2ph\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}"
18846 [(set_attr "type" "ssecvt")
18847 (set_attr "prefix" "maybe_evex")
18848 (set_attr "mode" "V4SF")])
18850 (define_insn "*vcvtps2ph_store<mask_name>"
18851 [(set (match_operand:V4HI 0 "memory_operand" "=m")
18852 (unspec:V4HI [(match_operand:V4SF 1 "register_operand" "v")
18853 (match_operand:SI 2 "const_0_to_255_operand" "N")]
18854 UNSPEC_VCVTPS2PH))]
18855 "TARGET_F16C || TARGET_AVX512VL"
18856 "vcvtps2ph\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18857 [(set_attr "type" "ssecvt")
18858 (set_attr "prefix" "maybe_evex")
18859 (set_attr "mode" "V4SF")])
18861 (define_insn "vcvtps2ph256<mask_name>"
18862 [(set (match_operand:V8HI 0 "nonimmediate_operand" "=vm")
18863 (unspec:V8HI [(match_operand:V8SF 1 "register_operand" "v")
18864 (match_operand:SI 2 "const_0_to_255_operand" "N")]
18865 UNSPEC_VCVTPS2PH))]
18866 "TARGET_F16C || TARGET_AVX512VL"
18867 "vcvtps2ph\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18868 [(set_attr "type" "ssecvt")
18869 (set_attr "prefix" "maybe_evex")
18870 (set_attr "btver2_decode" "vector")
18871 (set_attr "mode" "V8SF")])
18873 (define_insn "<mask_codefor>avx512f_vcvtps2ph512<mask_name>"
18874 [(set (match_operand:V16HI 0 "nonimmediate_operand" "=vm")
18876 [(match_operand:V16SF 1 "register_operand" "v")
18877 (match_operand:SI 2 "const_0_to_255_operand" "N")]
18878 UNSPEC_VCVTPS2PH))]
18880 "vcvtps2ph\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18881 [(set_attr "type" "ssecvt")
18882 (set_attr "prefix" "evex")
18883 (set_attr "mode" "V16SF")])
18885 ;; For gather* insn patterns
18886 (define_mode_iterator VEC_GATHER_MODE
18887 [V2DI V2DF V4DI V4DF V4SI V4SF V8SI V8SF])
18888 (define_mode_attr VEC_GATHER_IDXSI
18889 [(V2DI "V4SI") (V4DI "V4SI") (V8DI "V8SI")
18890 (V2DF "V4SI") (V4DF "V4SI") (V8DF "V8SI")
18891 (V4SI "V4SI") (V8SI "V8SI") (V16SI "V16SI")
18892 (V4SF "V4SI") (V8SF "V8SI") (V16SF "V16SI")])
18894 (define_mode_attr VEC_GATHER_IDXDI
18895 [(V2DI "V2DI") (V4DI "V4DI") (V8DI "V8DI")
18896 (V2DF "V2DI") (V4DF "V4DI") (V8DF "V8DI")
18897 (V4SI "V2DI") (V8SI "V4DI") (V16SI "V8DI")
18898 (V4SF "V2DI") (V8SF "V4DI") (V16SF "V8DI")])
18900 (define_mode_attr VEC_GATHER_SRCDI
18901 [(V2DI "V2DI") (V4DI "V4DI") (V8DI "V8DI")
18902 (V2DF "V2DF") (V4DF "V4DF") (V8DF "V8DF")
18903 (V4SI "V4SI") (V8SI "V4SI") (V16SI "V8SI")
18904 (V4SF "V4SF") (V8SF "V4SF") (V16SF "V8SF")])
18906 (define_expand "avx2_gathersi<mode>"
18907 [(parallel [(set (match_operand:VEC_GATHER_MODE 0 "register_operand")
18908 (unspec:VEC_GATHER_MODE
18909 [(match_operand:VEC_GATHER_MODE 1 "register_operand")
18910 (mem:<ssescalarmode>
18912 [(match_operand 2 "vsib_address_operand")
18913 (match_operand:<VEC_GATHER_IDXSI>
18914 3 "register_operand")
18915 (match_operand:SI 5 "const1248_operand ")]))
18916 (mem:BLK (scratch))
18917 (match_operand:VEC_GATHER_MODE 4 "register_operand")]
18919 (clobber (match_scratch:VEC_GATHER_MODE 7))])]
18923 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
18924 operands[5]), UNSPEC_VSIBADDR);
18927 (define_insn "*avx2_gathersi<mode>"
18928 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
18929 (unspec:VEC_GATHER_MODE
18930 [(match_operand:VEC_GATHER_MODE 2 "register_operand" "0")
18931 (match_operator:<ssescalarmode> 7 "vsib_mem_operator"
18933 [(match_operand:P 3 "vsib_address_operand" "Tv")
18934 (match_operand:<VEC_GATHER_IDXSI> 4 "register_operand" "x")
18935 (match_operand:SI 6 "const1248_operand" "n")]
18937 (mem:BLK (scratch))
18938 (match_operand:VEC_GATHER_MODE 5 "register_operand" "1")]
18940 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
18942 "v<sseintprefix>gatherd<ssemodesuffix>\t{%1, %7, %0|%0, %7, %1}"
18943 [(set_attr "type" "ssemov")
18944 (set_attr "prefix" "vex")
18945 (set_attr "mode" "<sseinsnmode>")])
18947 (define_insn "*avx2_gathersi<mode>_2"
18948 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
18949 (unspec:VEC_GATHER_MODE
18951 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
18953 [(match_operand:P 2 "vsib_address_operand" "Tv")
18954 (match_operand:<VEC_GATHER_IDXSI> 3 "register_operand" "x")
18955 (match_operand:SI 5 "const1248_operand" "n")]
18957 (mem:BLK (scratch))
18958 (match_operand:VEC_GATHER_MODE 4 "register_operand" "1")]
18960 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
18962 "v<sseintprefix>gatherd<ssemodesuffix>\t{%1, %6, %0|%0, %6, %1}"
18963 [(set_attr "type" "ssemov")
18964 (set_attr "prefix" "vex")
18965 (set_attr "mode" "<sseinsnmode>")])
18967 (define_expand "avx2_gatherdi<mode>"
18968 [(parallel [(set (match_operand:VEC_GATHER_MODE 0 "register_operand")
18969 (unspec:VEC_GATHER_MODE
18970 [(match_operand:<VEC_GATHER_SRCDI> 1 "register_operand")
18971 (mem:<ssescalarmode>
18973 [(match_operand 2 "vsib_address_operand")
18974 (match_operand:<VEC_GATHER_IDXDI>
18975 3 "register_operand")
18976 (match_operand:SI 5 "const1248_operand ")]))
18977 (mem:BLK (scratch))
18978 (match_operand:<VEC_GATHER_SRCDI> 4 "register_operand")]
18980 (clobber (match_scratch:VEC_GATHER_MODE 7))])]
18984 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
18985 operands[5]), UNSPEC_VSIBADDR);
18988 (define_insn "*avx2_gatherdi<mode>"
18989 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
18990 (unspec:VEC_GATHER_MODE
18991 [(match_operand:<VEC_GATHER_SRCDI> 2 "register_operand" "0")
18992 (match_operator:<ssescalarmode> 7 "vsib_mem_operator"
18994 [(match_operand:P 3 "vsib_address_operand" "Tv")
18995 (match_operand:<VEC_GATHER_IDXDI> 4 "register_operand" "x")
18996 (match_operand:SI 6 "const1248_operand" "n")]
18998 (mem:BLK (scratch))
18999 (match_operand:<VEC_GATHER_SRCDI> 5 "register_operand" "1")]
19001 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
19003 "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %7, %2|%2, %7, %5}"
19004 [(set_attr "type" "ssemov")
19005 (set_attr "prefix" "vex")
19006 (set_attr "mode" "<sseinsnmode>")])
19008 (define_insn "*avx2_gatherdi<mode>_2"
19009 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
19010 (unspec:VEC_GATHER_MODE
19012 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
19014 [(match_operand:P 2 "vsib_address_operand" "Tv")
19015 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand" "x")
19016 (match_operand:SI 5 "const1248_operand" "n")]
19018 (mem:BLK (scratch))
19019 (match_operand:<VEC_GATHER_SRCDI> 4 "register_operand" "1")]
19021 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
19024 if (<MODE>mode != <VEC_GATHER_SRCDI>mode)
19025 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%4, %6, %x0|%x0, %6, %4}";
19026 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%4, %6, %0|%0, %6, %4}";
19028 [(set_attr "type" "ssemov")
19029 (set_attr "prefix" "vex")
19030 (set_attr "mode" "<sseinsnmode>")])
19032 (define_insn "*avx2_gatherdi<mode>_3"
19033 [(set (match_operand:<VEC_GATHER_SRCDI> 0 "register_operand" "=&x")
19034 (vec_select:<VEC_GATHER_SRCDI>
19036 [(match_operand:<VEC_GATHER_SRCDI> 2 "register_operand" "0")
19037 (match_operator:<ssescalarmode> 7 "vsib_mem_operator"
19039 [(match_operand:P 3 "vsib_address_operand" "Tv")
19040 (match_operand:<VEC_GATHER_IDXDI> 4 "register_operand" "x")
19041 (match_operand:SI 6 "const1248_operand" "n")]
19043 (mem:BLK (scratch))
19044 (match_operand:<VEC_GATHER_SRCDI> 5 "register_operand" "1")]
19046 (parallel [(const_int 0) (const_int 1)
19047 (const_int 2) (const_int 3)])))
19048 (clobber (match_scratch:VI4F_256 1 "=&x"))]
19050 "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %7, %0|%0, %7, %5}"
19051 [(set_attr "type" "ssemov")
19052 (set_attr "prefix" "vex")
19053 (set_attr "mode" "<sseinsnmode>")])
19055 (define_insn "*avx2_gatherdi<mode>_4"
19056 [(set (match_operand:<VEC_GATHER_SRCDI> 0 "register_operand" "=&x")
19057 (vec_select:<VEC_GATHER_SRCDI>
19060 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
19062 [(match_operand:P 2 "vsib_address_operand" "Tv")
19063 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand" "x")
19064 (match_operand:SI 5 "const1248_operand" "n")]
19066 (mem:BLK (scratch))
19067 (match_operand:<VEC_GATHER_SRCDI> 4 "register_operand" "1")]
19069 (parallel [(const_int 0) (const_int 1)
19070 (const_int 2) (const_int 3)])))
19071 (clobber (match_scratch:VI4F_256 1 "=&x"))]
19073 "v<sseintprefix>gatherq<ssemodesuffix>\t{%4, %6, %0|%0, %6, %4}"
19074 [(set_attr "type" "ssemov")
19075 (set_attr "prefix" "vex")
19076 (set_attr "mode" "<sseinsnmode>")])
19078 ;; Memory operand override for -masm=intel of the v*gatherq* patterns.
19079 (define_mode_attr gatherq_mode
19080 [(V4SI "q") (V2DI "x") (V4SF "q") (V2DF "x")
19081 (V8SI "x") (V4DI "t") (V8SF "x") (V4DF "t")
19082 (V16SI "t") (V8DI "g") (V16SF "t") (V8DF "g")])
19084 (define_expand "<avx512>_gathersi<mode>"
19085 [(parallel [(set (match_operand:VI48F 0 "register_operand")
19087 [(match_operand:VI48F 1 "register_operand")
19088 (match_operand:<avx512fmaskmode> 4 "register_operand")
19089 (mem:<ssescalarmode>
19091 [(match_operand 2 "vsib_address_operand")
19092 (match_operand:<VEC_GATHER_IDXSI> 3 "register_operand")
19093 (match_operand:SI 5 "const1248_operand")]))]
19095 (clobber (match_scratch:<avx512fmaskmode> 7))])]
19099 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
19100 operands[5]), UNSPEC_VSIBADDR);
19103 (define_insn "*avx512f_gathersi<mode>"
19104 [(set (match_operand:VI48F 0 "register_operand" "=&v")
19106 [(match_operand:VI48F 1 "register_operand" "0")
19107 (match_operand:<avx512fmaskmode> 7 "register_operand" "2")
19108 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
19110 [(match_operand:P 4 "vsib_address_operand" "Tv")
19111 (match_operand:<VEC_GATHER_IDXSI> 3 "register_operand" "v")
19112 (match_operand:SI 5 "const1248_operand" "n")]
19113 UNSPEC_VSIBADDR)])]
19115 (clobber (match_scratch:<avx512fmaskmode> 2 "=&Yk"))]
19117 "v<sseintprefix>gatherd<ssemodesuffix>\t{%6, %0%{%2%}|%0%{%2%}, %<xtg_mode>6}"
19118 [(set_attr "type" "ssemov")
19119 (set_attr "prefix" "evex")
19120 (set_attr "mode" "<sseinsnmode>")])
19122 (define_insn "*avx512f_gathersi<mode>_2"
19123 [(set (match_operand:VI48F 0 "register_operand" "=&v")
19126 (match_operand:<avx512fmaskmode> 6 "register_operand" "1")
19127 (match_operator:<ssescalarmode> 5 "vsib_mem_operator"
19129 [(match_operand:P 3 "vsib_address_operand" "Tv")
19130 (match_operand:<VEC_GATHER_IDXSI> 2 "register_operand" "v")
19131 (match_operand:SI 4 "const1248_operand" "n")]
19132 UNSPEC_VSIBADDR)])]
19134 (clobber (match_scratch:<avx512fmaskmode> 1 "=&Yk"))]
19136 "v<sseintprefix>gatherd<ssemodesuffix>\t{%5, %0%{%1%}|%0%{%1%}, %<xtg_mode>5}"
19137 [(set_attr "type" "ssemov")
19138 (set_attr "prefix" "evex")
19139 (set_attr "mode" "<sseinsnmode>")])
19142 (define_expand "<avx512>_gatherdi<mode>"
19143 [(parallel [(set (match_operand:VI48F 0 "register_operand")
19145 [(match_operand:<VEC_GATHER_SRCDI> 1 "register_operand")
19146 (match_operand:QI 4 "register_operand")
19147 (mem:<ssescalarmode>
19149 [(match_operand 2 "vsib_address_operand")
19150 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand")
19151 (match_operand:SI 5 "const1248_operand")]))]
19153 (clobber (match_scratch:QI 7))])]
19157 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
19158 operands[5]), UNSPEC_VSIBADDR);
19161 (define_insn "*avx512f_gatherdi<mode>"
19162 [(set (match_operand:VI48F 0 "register_operand" "=&v")
19164 [(match_operand:<VEC_GATHER_SRCDI> 1 "register_operand" "0")
19165 (match_operand:QI 7 "register_operand" "2")
19166 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
19168 [(match_operand:P 4 "vsib_address_operand" "Tv")
19169 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand" "v")
19170 (match_operand:SI 5 "const1248_operand" "n")]
19171 UNSPEC_VSIBADDR)])]
19173 (clobber (match_scratch:QI 2 "=&Yk"))]
19176 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%6, %1%{%2%}|%1%{%2%}, %<gatherq_mode>6}";
19178 [(set_attr "type" "ssemov")
19179 (set_attr "prefix" "evex")
19180 (set_attr "mode" "<sseinsnmode>")])
19182 (define_insn "*avx512f_gatherdi<mode>_2"
19183 [(set (match_operand:VI48F 0 "register_operand" "=&v")
19186 (match_operand:QI 6 "register_operand" "1")
19187 (match_operator:<ssescalarmode> 5 "vsib_mem_operator"
19189 [(match_operand:P 3 "vsib_address_operand" "Tv")
19190 (match_operand:<VEC_GATHER_IDXDI> 2 "register_operand" "v")
19191 (match_operand:SI 4 "const1248_operand" "n")]
19192 UNSPEC_VSIBADDR)])]
19194 (clobber (match_scratch:QI 1 "=&Yk"))]
19197 if (<MODE>mode != <VEC_GATHER_SRCDI>mode)
19199 if (<MODE_SIZE> != 64)
19200 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %x0%{%1%}|%x0%{%1%}, %<gatherq_mode>5}";
19202 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %t0%{%1%}|%t0%{%1%}, %t5}";
19204 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %0%{%1%}|%0%{%1%}, %<gatherq_mode>5}";
19206 [(set_attr "type" "ssemov")
19207 (set_attr "prefix" "evex")
19208 (set_attr "mode" "<sseinsnmode>")])
19210 (define_expand "<avx512>_scattersi<mode>"
19211 [(parallel [(set (mem:VI48F
19213 [(match_operand 0 "vsib_address_operand")
19214 (match_operand:<VEC_GATHER_IDXSI> 2 "register_operand")
19215 (match_operand:SI 4 "const1248_operand")]))
19217 [(match_operand:<avx512fmaskmode> 1 "register_operand")
19218 (match_operand:VI48F 3 "register_operand")]
19220 (clobber (match_scratch:<avx512fmaskmode> 6))])]
19224 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[0], operands[2],
19225 operands[4]), UNSPEC_VSIBADDR);
19228 (define_insn "*avx512f_scattersi<mode>"
19229 [(set (match_operator:VI48F 5 "vsib_mem_operator"
19231 [(match_operand:P 0 "vsib_address_operand" "Tv")
19232 (match_operand:<VEC_GATHER_IDXSI> 2 "register_operand" "v")
19233 (match_operand:SI 4 "const1248_operand" "n")]
19236 [(match_operand:<avx512fmaskmode> 6 "register_operand" "1")
19237 (match_operand:VI48F 3 "register_operand" "v")]
19239 (clobber (match_scratch:<avx512fmaskmode> 1 "=&Yk"))]
19241 "v<sseintprefix>scatterd<ssemodesuffix>\t{%3, %5%{%1%}|%5%{%1%}, %3}"
19242 [(set_attr "type" "ssemov")
19243 (set_attr "prefix" "evex")
19244 (set_attr "mode" "<sseinsnmode>")])
19246 (define_expand "<avx512>_scatterdi<mode>"
19247 [(parallel [(set (mem:VI48F
19249 [(match_operand 0 "vsib_address_operand")
19250 (match_operand:<VEC_GATHER_IDXDI> 2 "register_operand")
19251 (match_operand:SI 4 "const1248_operand")]))
19253 [(match_operand:QI 1 "register_operand")
19254 (match_operand:<VEC_GATHER_SRCDI> 3 "register_operand")]
19256 (clobber (match_scratch:QI 6))])]
19260 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[0], operands[2],
19261 operands[4]), UNSPEC_VSIBADDR);
19264 (define_insn "*avx512f_scatterdi<mode>"
19265 [(set (match_operator:VI48F 5 "vsib_mem_operator"
19267 [(match_operand:P 0 "vsib_address_operand" "Tv")
19268 (match_operand:<VEC_GATHER_IDXDI> 2 "register_operand" "v")
19269 (match_operand:SI 4 "const1248_operand" "n")]
19272 [(match_operand:QI 6 "register_operand" "1")
19273 (match_operand:<VEC_GATHER_SRCDI> 3 "register_operand" "v")]
19275 (clobber (match_scratch:QI 1 "=&Yk"))]
19278 if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 8)
19279 return "v<sseintprefix>scatterq<ssemodesuffix>\t{%3, %5%{%1%}|%5%{%1%}, %3}";
19280 return "v<sseintprefix>scatterq<ssemodesuffix>\t{%3, %5%{%1%}|%t5%{%1%}, %3}";
19282 [(set_attr "type" "ssemov")
19283 (set_attr "prefix" "evex")
19284 (set_attr "mode" "<sseinsnmode>")])
19286 (define_insn "<avx512>_compress<mode>_mask"
19287 [(set (match_operand:VI48F 0 "register_operand" "=v")
19289 [(match_operand:VI48F 1 "register_operand" "v")
19290 (match_operand:VI48F 2 "vector_move_operand" "0C")
19291 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")]
19294 "v<sseintprefix>compress<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
19295 [(set_attr "type" "ssemov")
19296 (set_attr "prefix" "evex")
19297 (set_attr "mode" "<sseinsnmode>")])
19299 (define_insn "<avx512>_compressstore<mode>_mask"
19300 [(set (match_operand:VI48F 0 "memory_operand" "=m")
19302 [(match_operand:VI48F 1 "register_operand" "x")
19304 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")]
19305 UNSPEC_COMPRESS_STORE))]
19307 "v<sseintprefix>compress<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}"
19308 [(set_attr "type" "ssemov")
19309 (set_attr "prefix" "evex")
19310 (set_attr "memory" "store")
19311 (set_attr "mode" "<sseinsnmode>")])
19313 (define_expand "<avx512>_expand<mode>_maskz"
19314 [(set (match_operand:VI48F 0 "register_operand")
19316 [(match_operand:VI48F 1 "nonimmediate_operand")
19317 (match_operand:VI48F 2 "vector_move_operand")
19318 (match_operand:<avx512fmaskmode> 3 "register_operand")]
19321 "operands[2] = CONST0_RTX (<MODE>mode);")
19323 (define_insn "<avx512>_expand<mode>_mask"
19324 [(set (match_operand:VI48F 0 "register_operand" "=v,v")
19326 [(match_operand:VI48F 1 "nonimmediate_operand" "v,m")
19327 (match_operand:VI48F 2 "vector_move_operand" "0C,0C")
19328 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")]
19331 "v<sseintprefix>expand<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
19332 [(set_attr "type" "ssemov")
19333 (set_attr "prefix" "evex")
19334 (set_attr "memory" "none,load")
19335 (set_attr "mode" "<sseinsnmode>")])
19337 (define_insn "avx512dq_rangep<mode><mask_name><round_saeonly_name>"
19338 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
19339 (unspec:VF_AVX512VL
19340 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
19341 (match_operand:VF_AVX512VL 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
19342 (match_operand:SI 3 "const_0_to_15_operand")]
19344 "TARGET_AVX512DQ && <round_saeonly_mode512bit_condition>"
19345 "vrange<ssemodesuffix>\t{%3, <round_saeonly_mask_op4>%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2<round_saeonly_mask_op4>, %3}"
19346 [(set_attr "type" "sse")
19347 (set_attr "prefix" "evex")
19348 (set_attr "mode" "<MODE>")])
19350 (define_insn "avx512dq_ranges<mode><round_saeonly_name>"
19351 [(set (match_operand:VF_128 0 "register_operand" "=v")
19354 [(match_operand:VF_128 1 "register_operand" "v")
19355 (match_operand:VF_128 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
19356 (match_operand:SI 3 "const_0_to_15_operand")]
19361 "vrange<ssescalarmodesuffix>\t{%3, <round_saeonly_op4>%2, %1, %0|%0, %1, %2<round_saeonly_op4>, %3}"
19362 [(set_attr "type" "sse")
19363 (set_attr "prefix" "evex")
19364 (set_attr "mode" "<MODE>")])
19366 (define_insn "avx512dq_fpclass<mode><mask_scalar_merge_name>"
19367 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
19368 (unspec:<avx512fmaskmode>
19369 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
19370 (match_operand:QI 2 "const_0_to_255_operand" "n")]
19373 "vfpclass<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}";
19374 [(set_attr "type" "sse")
19375 (set_attr "length_immediate" "1")
19376 (set_attr "prefix" "evex")
19377 (set_attr "mode" "<MODE>")])
19379 (define_insn "avx512dq_vmfpclass<mode>"
19380 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
19381 (and:<avx512fmaskmode>
19382 (unspec:<avx512fmaskmode>
19383 [(match_operand:VF_128 1 "register_operand" "v")
19384 (match_operand:QI 2 "const_0_to_255_operand" "n")]
19388 "vfpclass<ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %2}";
19389 [(set_attr "type" "sse")
19390 (set_attr "length_immediate" "1")
19391 (set_attr "prefix" "evex")
19392 (set_attr "mode" "<MODE>")])
19394 (define_insn "<avx512>_getmant<mode><mask_name><round_saeonly_name>"
19395 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
19396 (unspec:VF_AVX512VL
19397 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "<round_saeonly_constraint>")
19398 (match_operand:SI 2 "const_0_to_15_operand")]
19401 "vgetmant<ssemodesuffix>\t{%2, <round_saeonly_mask_op3>%1, %0<mask_operand3>|%0<mask_operand3>, %1<round_saeonly_mask_op3>, %2}";
19402 [(set_attr "prefix" "evex")
19403 (set_attr "mode" "<MODE>")])
19405 (define_insn "avx512f_vgetmant<mode><mask_scalar_name><round_saeonly_scalar_name>"
19406 [(set (match_operand:VF_128 0 "register_operand" "=v")
19409 [(match_operand:VF_128 1 "register_operand" "v")
19410 (match_operand:VF_128 2 "<round_saeonly_scalar_nimm_predicate>" "<round_saeonly_scalar_constraint>")
19411 (match_operand:SI 3 "const_0_to_15_operand")]
19416 "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}";
19417 [(set_attr "prefix" "evex")
19418 (set_attr "mode" "<ssescalarmode>")])
19420 ;; The correct representation for this is absolutely enormous, and
19421 ;; surely not generally useful.
19422 (define_insn "<mask_codefor>avx512bw_dbpsadbw<mode><mask_name>"
19423 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
19424 (unspec:VI2_AVX512VL
19425 [(match_operand:<dbpsadbwmode> 1 "register_operand" "v")
19426 (match_operand:<dbpsadbwmode> 2 "nonimmediate_operand" "vm")
19427 (match_operand:SI 3 "const_0_to_255_operand")]
19430 "vdbpsadbw\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3}"
19431 [(set_attr "type" "sselog1")
19432 (set_attr "length_immediate" "1")
19433 (set_attr "prefix" "evex")
19434 (set_attr "mode" "<sseinsnmode>")])
19436 (define_insn "clz<mode>2<mask_name>"
19437 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
19439 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm")))]
19441 "vplzcnt<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
19442 [(set_attr "type" "sse")
19443 (set_attr "prefix" "evex")
19444 (set_attr "mode" "<sseinsnmode>")])
19446 (define_insn "<mask_codefor>conflict<mode><mask_name>"
19447 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
19448 (unspec:VI48_AVX512VL
19449 [(match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm")]
19452 "vpconflict<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
19453 [(set_attr "type" "sse")
19454 (set_attr "prefix" "evex")
19455 (set_attr "mode" "<sseinsnmode>")])
19457 (define_insn "sha1msg1"
19458 [(set (match_operand:V4SI 0 "register_operand" "=x")
19460 [(match_operand:V4SI 1 "register_operand" "0")
19461 (match_operand:V4SI 2 "vector_operand" "xBm")]
19464 "sha1msg1\t{%2, %0|%0, %2}"
19465 [(set_attr "type" "sselog1")
19466 (set_attr "mode" "TI")])
19468 (define_insn "sha1msg2"
19469 [(set (match_operand:V4SI 0 "register_operand" "=x")
19471 [(match_operand:V4SI 1 "register_operand" "0")
19472 (match_operand:V4SI 2 "vector_operand" "xBm")]
19475 "sha1msg2\t{%2, %0|%0, %2}"
19476 [(set_attr "type" "sselog1")
19477 (set_attr "mode" "TI")])
19479 (define_insn "sha1nexte"
19480 [(set (match_operand:V4SI 0 "register_operand" "=x")
19482 [(match_operand:V4SI 1 "register_operand" "0")
19483 (match_operand:V4SI 2 "vector_operand" "xBm")]
19484 UNSPEC_SHA1NEXTE))]
19486 "sha1nexte\t{%2, %0|%0, %2}"
19487 [(set_attr "type" "sselog1")
19488 (set_attr "mode" "TI")])
19490 (define_insn "sha1rnds4"
19491 [(set (match_operand:V4SI 0 "register_operand" "=x")
19493 [(match_operand:V4SI 1 "register_operand" "0")
19494 (match_operand:V4SI 2 "vector_operand" "xBm")
19495 (match_operand:SI 3 "const_0_to_3_operand" "n")]
19496 UNSPEC_SHA1RNDS4))]
19498 "sha1rnds4\t{%3, %2, %0|%0, %2, %3}"
19499 [(set_attr "type" "sselog1")
19500 (set_attr "length_immediate" "1")
19501 (set_attr "mode" "TI")])
19503 (define_insn "sha256msg1"
19504 [(set (match_operand:V4SI 0 "register_operand" "=x")
19506 [(match_operand:V4SI 1 "register_operand" "0")
19507 (match_operand:V4SI 2 "vector_operand" "xBm")]
19508 UNSPEC_SHA256MSG1))]
19510 "sha256msg1\t{%2, %0|%0, %2}"
19511 [(set_attr "type" "sselog1")
19512 (set_attr "mode" "TI")])
19514 (define_insn "sha256msg2"
19515 [(set (match_operand:V4SI 0 "register_operand" "=x")
19517 [(match_operand:V4SI 1 "register_operand" "0")
19518 (match_operand:V4SI 2 "vector_operand" "xBm")]
19519 UNSPEC_SHA256MSG2))]
19521 "sha256msg2\t{%2, %0|%0, %2}"
19522 [(set_attr "type" "sselog1")
19523 (set_attr "mode" "TI")])
19525 (define_insn "sha256rnds2"
19526 [(set (match_operand:V4SI 0 "register_operand" "=x")
19528 [(match_operand:V4SI 1 "register_operand" "0")
19529 (match_operand:V4SI 2 "vector_operand" "xBm")
19530 (match_operand:V4SI 3 "register_operand" "Yz")]
19531 UNSPEC_SHA256RNDS2))]
19533 "sha256rnds2\t{%3, %2, %0|%0, %2, %3}"
19534 [(set_attr "type" "sselog1")
19535 (set_attr "length_immediate" "1")
19536 (set_attr "mode" "TI")])
19538 (define_insn_and_split "avx512f_<castmode><avxsizesuffix>_<castmode>"
19539 [(set (match_operand:AVX512MODE2P 0 "nonimmediate_operand" "=x,m")
19540 (unspec:AVX512MODE2P
19541 [(match_operand:<ssequartermode> 1 "nonimmediate_operand" "xm,x")]
19543 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
19545 "&& reload_completed"
19546 [(set (match_dup 0) (match_dup 1))]
19548 if (REG_P (operands[0]))
19549 operands[0] = gen_lowpart (<ssequartermode>mode, operands[0]);
19551 operands[1] = lowpart_subreg (<MODE>mode, operands[1],
19552 <ssequartermode>mode);
19555 (define_insn_and_split "avx512f_<castmode><avxsizesuffix>_256<castmode>"
19556 [(set (match_operand:AVX512MODE2P 0 "nonimmediate_operand" "=x,m")
19557 (unspec:AVX512MODE2P
19558 [(match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "xm,x")]
19560 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
19562 "&& reload_completed"
19563 [(set (match_dup 0) (match_dup 1))]
19565 if (REG_P (operands[0]))
19566 operands[0] = gen_lowpart (<ssehalfvecmode>mode, operands[0]);
19568 operands[1] = lowpart_subreg (<MODE>mode, operands[1],
19569 <ssehalfvecmode>mode);
19572 (define_int_iterator VPMADD52
19573 [UNSPEC_VPMADD52LUQ
19574 UNSPEC_VPMADD52HUQ])
19576 (define_int_attr vpmadd52type
19577 [(UNSPEC_VPMADD52LUQ "luq") (UNSPEC_VPMADD52HUQ "huq")])
19579 (define_expand "vpamdd52huq<mode>_maskz"
19580 [(match_operand:VI8_AVX512VL 0 "register_operand")
19581 (match_operand:VI8_AVX512VL 1 "register_operand")
19582 (match_operand:VI8_AVX512VL 2 "register_operand")
19583 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand")
19584 (match_operand:<avx512fmaskmode> 4 "register_operand")]
19585 "TARGET_AVX512IFMA"
19587 emit_insn (gen_vpamdd52huq<mode>_maskz_1 (
19588 operands[0], operands[1], operands[2], operands[3],
19589 CONST0_RTX (<MODE>mode), operands[4]));
19593 (define_expand "vpamdd52luq<mode>_maskz"
19594 [(match_operand:VI8_AVX512VL 0 "register_operand")
19595 (match_operand:VI8_AVX512VL 1 "register_operand")
19596 (match_operand:VI8_AVX512VL 2 "register_operand")
19597 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand")
19598 (match_operand:<avx512fmaskmode> 4 "register_operand")]
19599 "TARGET_AVX512IFMA"
19601 emit_insn (gen_vpamdd52luq<mode>_maskz_1 (
19602 operands[0], operands[1], operands[2], operands[3],
19603 CONST0_RTX (<MODE>mode), operands[4]));
19607 (define_insn "vpamdd52<vpmadd52type><mode><sd_maskz_name>"
19608 [(set (match_operand:VI8_AVX512VL 0 "register_operand" "=v")
19609 (unspec:VI8_AVX512VL
19610 [(match_operand:VI8_AVX512VL 1 "register_operand" "0")
19611 (match_operand:VI8_AVX512VL 2 "register_operand" "v")
19612 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand" "vm")]
19614 "TARGET_AVX512IFMA"
19615 "vpmadd52<vpmadd52type>\t{%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3}"
19616 [(set_attr "type" "ssemuladd")
19617 (set_attr "prefix" "evex")
19618 (set_attr "mode" "<sseinsnmode>")])
19620 (define_insn "vpamdd52<vpmadd52type><mode>_mask"
19621 [(set (match_operand:VI8_AVX512VL 0 "register_operand" "=v")
19622 (vec_merge:VI8_AVX512VL
19623 (unspec:VI8_AVX512VL
19624 [(match_operand:VI8_AVX512VL 1 "register_operand" "0")
19625 (match_operand:VI8_AVX512VL 2 "register_operand" "v")
19626 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand" "vm")]
19629 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
19630 "TARGET_AVX512IFMA"
19631 "vpmadd52<vpmadd52type>\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3}"
19632 [(set_attr "type" "ssemuladd")
19633 (set_attr "prefix" "evex")
19634 (set_attr "mode" "<sseinsnmode>")])
19636 (define_insn "vpmultishiftqb<mode><mask_name>"
19637 [(set (match_operand:VI1_AVX512VL 0 "register_operand" "=v")
19638 (unspec:VI1_AVX512VL
19639 [(match_operand:VI1_AVX512VL 1 "register_operand" "v")
19640 (match_operand:VI1_AVX512VL 2 "nonimmediate_operand" "vm")]
19641 UNSPEC_VPMULTISHIFT))]
19642 "TARGET_AVX512VBMI"
19643 "vpmultishiftqb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
19644 [(set_attr "type" "sselog")
19645 (set_attr "prefix" "evex")
19646 (set_attr "mode" "<sseinsnmode>")])
19648 (define_mode_iterator IMOD4
19649 [(V64SF "TARGET_AVX5124FMAPS") (V64SI "TARGET_AVX5124VNNIW")])
19651 (define_mode_attr imod4_narrow
19652 [(V64SF "V16SF") (V64SI "V16SI")])
19654 (define_expand "mov<mode>"
19655 [(set (match_operand:IMOD4 0 "nonimmediate_operand")
19656 (match_operand:IMOD4 1 "vector_move_operand"))]
19659 ix86_expand_vector_move (<MODE>mode, operands);
19663 (define_insn_and_split "*mov<mode>_internal"
19664 [(set (match_operand:IMOD4 0 "nonimmediate_operand" "=v,v ,m")
19665 (match_operand:IMOD4 1 "vector_move_operand" " C,vm,v"))]
19667 && (register_operand (operands[0], <MODE>mode)
19668 || register_operand (operands[1], <MODE>mode))"
19670 "&& reload_completed"
19676 for (i = 0; i < 4; i++)
19678 op0 = simplify_subreg
19679 (<imod4_narrow>mode, operands[0], <MODE>mode, i * 64);
19680 op1 = simplify_subreg
19681 (<imod4_narrow>mode, operands[1], <MODE>mode, i * 64);
19682 emit_move_insn (op0, op1);
19687 (define_insn "avx5124fmaddps_4fmaddps"
19688 [(set (match_operand:V16SF 0 "register_operand" "=v")
19690 [(match_operand:V16SF 1 "register_operand" "0")
19691 (match_operand:V64SF 2 "register_operand" "Yh")
19692 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FMADD))]
19693 "TARGET_AVX5124FMAPS"
19694 "v4fmaddps\t{%3, %g2, %0|%0, %g2, %3}"
19695 [(set_attr ("type") ("ssemuladd"))
19696 (set_attr ("prefix") ("evex"))
19697 (set_attr ("mode") ("V16SF"))])
19699 (define_insn "avx5124fmaddps_4fmaddps_mask"
19700 [(set (match_operand:V16SF 0 "register_operand" "=v")
19703 [(match_operand:V64SF 1 "register_operand" "Yh")
19704 (match_operand:V4SF 2 "memory_operand" "m")] UNSPEC_VP4FMADD)
19705 (match_operand:V16SF 3 "register_operand" "0")
19706 (match_operand:HI 4 "register_operand" "Yk")))]
19707 "TARGET_AVX5124FMAPS"
19708 "v4fmaddps\t{%2, %g1, %0%{%4%}|%{%4%}%0, %g1, %2}"
19709 [(set_attr ("type") ("ssemuladd"))
19710 (set_attr ("prefix") ("evex"))
19711 (set_attr ("mode") ("V16SF"))])
19713 (define_insn "avx5124fmaddps_4fmaddps_maskz"
19714 [(set (match_operand:V16SF 0 "register_operand" "=v")
19717 [(match_operand:V16SF 1 "register_operand" "0")
19718 (match_operand:V64SF 2 "register_operand" "Yh")
19719 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FMADD)
19720 (match_operand:V16SF 4 "const0_operand" "C")
19721 (match_operand:HI 5 "register_operand" "Yk")))]
19722 "TARGET_AVX5124FMAPS"
19723 "v4fmaddps\t{%3, %g2, %0%{%5%}%{z%}|%{%5%}%{z%}%0, %g2, %3}"
19724 [(set_attr ("type") ("ssemuladd"))
19725 (set_attr ("prefix") ("evex"))
19726 (set_attr ("mode") ("V16SF"))])
19728 (define_insn "avx5124fmaddps_4fmaddss"
19729 [(set (match_operand:V4SF 0 "register_operand" "=v")
19731 [(match_operand:V4SF 1 "register_operand" "0")
19732 (match_operand:V64SF 2 "register_operand" "Yh")
19733 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FMADD))]
19734 "TARGET_AVX5124FMAPS"
19735 "v4fmaddss\t{%3, %x2, %0|%0, %x2, %3}"
19736 [(set_attr ("type") ("ssemuladd"))
19737 (set_attr ("prefix") ("evex"))
19738 (set_attr ("mode") ("SF"))])
19740 (define_insn "avx5124fmaddps_4fmaddss_mask"
19741 [(set (match_operand:V4SF 0 "register_operand" "=v")
19744 [(match_operand:V64SF 1 "register_operand" "Yh")
19745 (match_operand:V4SF 2 "memory_operand" "m")] UNSPEC_VP4FMADD)
19746 (match_operand:V4SF 3 "register_operand" "0")
19747 (match_operand:QI 4 "register_operand" "Yk")))]
19748 "TARGET_AVX5124FMAPS"
19749 "v4fmaddss\t{%2, %x1, %0%{%4%}|%{%4%}%0, %x1, %2}"
19750 [(set_attr ("type") ("ssemuladd"))
19751 (set_attr ("prefix") ("evex"))
19752 (set_attr ("mode") ("SF"))])
19754 (define_insn "avx5124fmaddps_4fmaddss_maskz"
19755 [(set (match_operand:V4SF 0 "register_operand" "=v")
19758 [(match_operand:V4SF 1 "register_operand" "0")
19759 (match_operand:V64SF 2 "register_operand" "Yh")
19760 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FMADD)
19761 (match_operand:V4SF 4 "const0_operand" "C")
19762 (match_operand:QI 5 "register_operand" "Yk")))]
19763 "TARGET_AVX5124FMAPS"
19764 "v4fmaddss\t{%3, %x2, %0%{%5%}%{z%}|%{%5%}%{z%}%0, %x2, %3}"
19765 [(set_attr ("type") ("ssemuladd"))
19766 (set_attr ("prefix") ("evex"))
19767 (set_attr ("mode") ("SF"))])
19769 (define_insn "avx5124fmaddps_4fnmaddps"
19770 [(set (match_operand:V16SF 0 "register_operand" "=v")
19772 [(match_operand:V16SF 1 "register_operand" "0")
19773 (match_operand:V64SF 2 "register_operand" "Yh")
19774 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FNMADD))]
19775 "TARGET_AVX5124FMAPS"
19776 "v4fnmaddps\t{%3, %g2, %0|%0, %g2, %3}"
19777 [(set_attr ("type") ("ssemuladd"))
19778 (set_attr ("prefix") ("evex"))
19779 (set_attr ("mode") ("V16SF"))])
19781 (define_insn "avx5124fmaddps_4fnmaddps_mask"
19782 [(set (match_operand:V16SF 0 "register_operand" "=v")
19785 [(match_operand:V64SF 1 "register_operand" "Yh")
19786 (match_operand:V4SF 2 "memory_operand" "m")] UNSPEC_VP4FNMADD)
19787 (match_operand:V16SF 3 "register_operand" "0")
19788 (match_operand:HI 4 "register_operand" "Yk")))]
19789 "TARGET_AVX5124FMAPS"
19790 "v4fnmaddps\t{%2, %g1, %0%{%4%}|%{%4%}%0, %g1, %2}"
19791 [(set_attr ("type") ("ssemuladd"))
19792 (set_attr ("prefix") ("evex"))
19793 (set_attr ("mode") ("V16SF"))])
19795 (define_insn "avx5124fmaddps_4fnmaddps_maskz"
19796 [(set (match_operand:V16SF 0 "register_operand" "=v")
19799 [(match_operand:V16SF 1 "register_operand" "0")
19800 (match_operand:V64SF 2 "register_operand" "Yh")
19801 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FNMADD)
19802 (match_operand:V16SF 4 "const0_operand" "C")
19803 (match_operand:HI 5 "register_operand" "Yk")))]
19804 "TARGET_AVX5124FMAPS"
19805 "v4fnmaddps\t{%3, %g2, %0%{%5%}%{z%}|%{%5%}%{z%}%0, %g2, %3}"
19806 [(set_attr ("type") ("ssemuladd"))
19807 (set_attr ("prefix") ("evex"))
19808 (set_attr ("mode") ("V16SF"))])
19810 (define_insn "avx5124fmaddps_4fnmaddss"
19811 [(set (match_operand:V4SF 0 "register_operand" "=v")
19813 [(match_operand:V4SF 1 "register_operand" "0")
19814 (match_operand:V64SF 2 "register_operand" "Yh")
19815 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FNMADD))]
19816 "TARGET_AVX5124FMAPS"
19817 "v4fnmaddss\t{%3, %x2, %0|%0, %x2, %3}"
19818 [(set_attr ("type") ("ssemuladd"))
19819 (set_attr ("prefix") ("evex"))
19820 (set_attr ("mode") ("SF"))])
19822 (define_insn "avx5124fmaddps_4fnmaddss_mask"
19823 [(set (match_operand:V4SF 0 "register_operand" "=v")
19826 [(match_operand:V64SF 1 "register_operand" "Yh")
19827 (match_operand:V4SF 2 "memory_operand" "m")] UNSPEC_VP4FNMADD)
19828 (match_operand:V4SF 3 "register_operand" "0")
19829 (match_operand:QI 4 "register_operand" "Yk")))]
19830 "TARGET_AVX5124FMAPS"
19831 "v4fnmaddss\t{%2, %x1, %0%{%4%}|%{%4%}%0, %x1, %2}"
19832 [(set_attr ("type") ("ssemuladd"))
19833 (set_attr ("prefix") ("evex"))
19834 (set_attr ("mode") ("SF"))])
19836 (define_insn "avx5124fmaddps_4fnmaddss_maskz"
19837 [(set (match_operand:V4SF 0 "register_operand" "=v")
19840 [(match_operand:V4SF 1 "register_operand" "0")
19841 (match_operand:V64SF 2 "register_operand" "Yh")
19842 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FNMADD)
19843 (match_operand:V4SF 4 "const0_operand" "C")
19844 (match_operand:QI 5 "register_operand" "Yk")))]
19845 "TARGET_AVX5124FMAPS"
19846 "v4fnmaddss\t{%3, %x2, %0%{%5%}%{z%}|%{%5%}%{z%}%0, %x2, %3}"
19847 [(set_attr ("type") ("ssemuladd"))
19848 (set_attr ("prefix") ("evex"))
19849 (set_attr ("mode") ("SF"))])
19851 (define_insn "avx5124vnniw_vp4dpwssd"
19852 [(set (match_operand:V16SI 0 "register_operand" "=v")
19854 [(match_operand:V16SI 1 "register_operand" "0")
19855 (match_operand:V64SI 2 "register_operand" "Yh")
19856 (match_operand:V4SI 3 "memory_operand" "m")] UNSPEC_VP4DPWSSD))]
19857 "TARGET_AVX5124VNNIW"
19858 "vp4dpwssd\t{%3, %g2, %0|%0, %g2, %3}"
19859 [(set_attr ("type") ("ssemuladd"))
19860 (set_attr ("prefix") ("evex"))
19861 (set_attr ("mode") ("TI"))])
19863 (define_insn "avx5124vnniw_vp4dpwssd_mask"
19864 [(set (match_operand:V16SI 0 "register_operand" "=v")
19867 [(match_operand:V64SI 1 "register_operand" "Yh")
19868 (match_operand:V4SI 2 "memory_operand" "m")] UNSPEC_VP4DPWSSD)
19869 (match_operand:V16SI 3 "register_operand" "0")
19870 (match_operand:HI 4 "register_operand" "Yk")))]
19871 "TARGET_AVX5124VNNIW"
19872 "vp4dpwssd\t{%2, %g1, %0%{%4%}|%{%4%}%0, %g1, %2}"
19873 [(set_attr ("type") ("ssemuladd"))
19874 (set_attr ("prefix") ("evex"))
19875 (set_attr ("mode") ("TI"))])
19877 (define_insn "avx5124vnniw_vp4dpwssd_maskz"
19878 [(set (match_operand:V16SI 0 "register_operand" "=v")
19881 [(match_operand:V16SI 1 "register_operand" "0")
19882 (match_operand:V64SI 2 "register_operand" "Yh")
19883 (match_operand:V4SI 3 "memory_operand" "m")] UNSPEC_VP4DPWSSD)
19884 (match_operand:V16SI 4 "const0_operand" "C")
19885 (match_operand:HI 5 "register_operand" "Yk")))]
19886 "TARGET_AVX5124VNNIW"
19887 "vp4dpwssd\t{%3, %g2, %0%{%5%}%{z%}|%{%5%}%{z%}%0, %g2, %3}"
19888 [(set_attr ("type") ("ssemuladd"))
19889 (set_attr ("prefix") ("evex"))
19890 (set_attr ("mode") ("TI"))])
19892 (define_insn "avx5124vnniw_vp4dpwssds"
19893 [(set (match_operand:V16SI 0 "register_operand" "=v")
19895 [(match_operand:V16SI 1 "register_operand" "0")
19896 (match_operand:V64SI 2 "register_operand" "Yh")
19897 (match_operand:V4SI 3 "memory_operand" "m")] UNSPEC_VP4DPWSSDS))]
19898 "TARGET_AVX5124VNNIW"
19899 "vp4dpwssds\t{%3, %g2, %0|%0, %g2, %3}"
19900 [(set_attr ("type") ("ssemuladd"))
19901 (set_attr ("prefix") ("evex"))
19902 (set_attr ("mode") ("TI"))])
19904 (define_insn "avx5124vnniw_vp4dpwssds_mask"
19905 [(set (match_operand:V16SI 0 "register_operand" "=v")
19908 [(match_operand:V64SI 1 "register_operand" "Yh")
19909 (match_operand:V4SI 2 "memory_operand" "m")] UNSPEC_VP4DPWSSDS)
19910 (match_operand:V16SI 3 "register_operand" "0")
19911 (match_operand:HI 4 "register_operand" "Yk")))]
19912 "TARGET_AVX5124VNNIW"
19913 "vp4dpwssds\t{%2, %g1, %0%{%4%}|%{%4%}%0, %g1, %2}"
19914 [(set_attr ("type") ("ssemuladd"))
19915 (set_attr ("prefix") ("evex"))
19916 (set_attr ("mode") ("TI"))])
19918 (define_insn "avx5124vnniw_vp4dpwssds_maskz"
19919 [(set (match_operand:V16SI 0 "register_operand" "=v")
19922 [(match_operand:V16SI 1 "register_operand" "0")
19923 (match_operand:V64SI 2 "register_operand" "Yh")
19924 (match_operand:V4SI 3 "memory_operand" "m")] UNSPEC_VP4DPWSSDS)
19925 (match_operand:V16SI 4 "const0_operand" "C")
19926 (match_operand:HI 5 "register_operand" "Yk")))]
19927 "TARGET_AVX5124VNNIW"
19928 "vp4dpwssds\t{%3, %g2, %0%{%5%}%{z%}|%{%5%}%{z%}%0, %g2, %3}"
19929 [(set_attr ("type") ("ssemuladd"))
19930 (set_attr ("prefix") ("evex"))
19931 (set_attr ("mode") ("TI"))])
19933 (define_insn "vpopcount<mode><mask_name>"
19934 [(set (match_operand:VI48_512 0 "register_operand" "=v")
19936 (match_operand:VI48_512 1 "nonimmediate_operand" "vm")))]
19937 "TARGET_AVX512VPOPCNTDQ"
19938 "vpopcnt<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}")
19940 ;; Save multiple registers out-of-line.
19941 (define_insn "save_multiple<mode>"
19942 [(match_parallel 0 "save_multiple"
19943 [(use (match_operand:P 1 "symbol_operand"))])]
19944 "TARGET_SSE && TARGET_64BIT"
19947 ;; Restore multiple registers out-of-line.
19948 (define_insn "restore_multiple<mode>"
19949 [(match_parallel 0 "restore_multiple"
19950 [(use (match_operand:P 1 "symbol_operand"))])]
19951 "TARGET_SSE && TARGET_64BIT"
19954 ;; Restore multiple registers out-of-line and return.
19955 (define_insn "restore_multiple_and_return<mode>"
19956 [(match_parallel 0 "restore_multiple"
19958 (use (match_operand:P 1 "symbol_operand"))
19959 (set (reg:DI SP_REG) (reg:DI R10_REG))
19961 "TARGET_SSE && TARGET_64BIT"
19964 ;; Restore multiple registers out-of-line when hard frame pointer is used,
19965 ;; perform the leave operation prior to returning (from the function).
19966 (define_insn "restore_multiple_leave_return<mode>"
19967 [(match_parallel 0 "restore_multiple"
19969 (use (match_operand:P 1 "symbol_operand"))
19970 (set (reg:DI SP_REG) (plus:DI (reg:DI BP_REG) (const_int 8)))
19971 (set (reg:DI BP_REG) (mem:DI (reg:DI BP_REG)))
19972 (clobber (mem:BLK (scratch)))
19974 "TARGET_SSE && TARGET_64BIT"
19977 (define_insn "vgf2p8affineinvqb_<mode><mask_name>"
19978 [(set (match_operand:VI1_AVX512F 0 "register_operand" "=x,x,v")
19979 (unspec:VI1_AVX512F [(match_operand:VI1_AVX512F 1 "register_operand" "%0,x,v")
19980 (match_operand:VI1_AVX512F 2 "nonimmediate_operand" "xBm,xm,vm")
19981 (match_operand:QI 3 "const_0_to_255_operand" "n,n,n")]
19982 UNSPEC_GF2P8AFFINEINV))]
19985 gf2p8affineinvqb\t{%3, %2, %0| %0, %2, %3}
19986 vgf2p8affineinvqb\t{%3, %2, %1, %0<mask_operand4>| %0<mask_operand4>, %1, %2, %3}
19987 vgf2p8affineinvqb\t{%3, %2, %1, %0<mask_operand4>| %0<mask_operand4>, %1, %2, %3}"
19988 [(set_attr "isa" "noavx,avx,avx512bw")
19989 (set_attr "prefix_data16" "1,*,*")
19990 (set_attr "prefix_extra" "1")
19991 (set_attr "prefix" "orig,maybe_evex,evex")
19992 (set_attr "mode" "<sseinsnmode>")])