1 ;; GCC machine description for SSE instructions
2 ;; Copyright (C) 2005-2017 Free Software Foundation, Inc.
4 ;; This file is part of GCC.
6 ;; GCC is free software; you can redistribute it and/or modify
7 ;; it under the terms of the GNU General Public License as published by
8 ;; the Free Software Foundation; either version 3, or (at your option)
11 ;; GCC is distributed in the hope that it will be useful,
12 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;; GNU General Public License for more details.
16 ;; You should have received a copy of the GNU General Public License
17 ;; along with GCC; see the file COPYING3. If not see
18 ;; <http://www.gnu.org/licenses/>.
20 (define_c_enum "unspec" [
53 UNSPEC_XOP_UNSIGNED_CMP
64 UNSPEC_AESKEYGENASSIST
85 ;; For AVX512F support
87 UNSPEC_UNSIGNED_FIX_NOTRUNC
102 UNSPEC_COMPRESS_STORE
112 ;; For embed. rounding feature
113 UNSPEC_EMBEDDED_ROUNDING
115 ;; For AVX512PF support
116 UNSPEC_GATHER_PREFETCH
117 UNSPEC_SCATTER_PREFETCH
119 ;; For AVX512ER support
133 ;; For AVX512BW support
141 ;; For AVX512DQ support
146 ;; For AVX512IFMA support
150 ;; For AVX512VBMI support
153 ;; For AVX5124FMAPS/AVX5124VNNIW support
160 UNSPEC_GF2P8AFFINEINV
164 ;; For AVX512VBMI2 support
171 (define_c_enum "unspecv" [
181 ;; All vector modes including V?TImode, used in move patterns.
182 (define_mode_iterator VMOVE
183 [(V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI
184 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX") V8HI
185 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
186 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI
187 (V4TI "TARGET_AVX512F") (V2TI "TARGET_AVX") V1TI
188 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
189 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") V2DF])
191 ;; All AVX-512{F,VL} vector modes. Supposed TARGET_AVX512F baseline.
192 (define_mode_iterator V48_AVX512VL
193 [V16SI (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")
194 V8DI (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")
195 V16SF (V8SF "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
196 V8DF (V4DF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
198 ;; 1,2 byte AVX-512{BW,VL} vector modes. Supposed TARGET_AVX512BW baseline.
199 (define_mode_iterator VI12_AVX512VL
200 [V64QI (V16QI "TARGET_AVX512VL") (V32QI "TARGET_AVX512VL")
201 V32HI (V16HI "TARGET_AVX512VL") (V8HI "TARGET_AVX512VL")])
203 ;; Same iterator, but without supposed TARGET_AVX512BW
204 (define_mode_iterator VI12_AVX512VLBW
205 [(V64QI "TARGET_AVX512BW") (V16QI "TARGET_AVX512VL")
206 (V32QI "TARGET_AVX512VL && TARGET_AVX512BW") (V32HI "TARGET_AVX512BW")
207 (V16HI "TARGET_AVX512VL") (V8HI "TARGET_AVX512VL")])
209 (define_mode_iterator VI1_AVX512VL
210 [V64QI (V16QI "TARGET_AVX512VL") (V32QI "TARGET_AVX512VL")])
213 (define_mode_iterator V
214 [(V32QI "TARGET_AVX") V16QI
215 (V16HI "TARGET_AVX") V8HI
216 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
217 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI
218 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
219 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
221 ;; All 128bit vector modes
222 (define_mode_iterator V_128
223 [V16QI V8HI V4SI V2DI V4SF (V2DF "TARGET_SSE2")])
225 ;; All 256bit vector modes
226 (define_mode_iterator V_256
227 [V32QI V16HI V8SI V4DI V8SF V4DF])
229 ;; All 512bit vector modes
230 (define_mode_iterator V_512 [V64QI V32HI V16SI V8DI V16SF V8DF])
232 ;; All 256bit and 512bit vector modes
233 (define_mode_iterator V_256_512
234 [V32QI V16HI V8SI V4DI V8SF V4DF
235 (V64QI "TARGET_AVX512F") (V32HI "TARGET_AVX512F") (V16SI "TARGET_AVX512F")
236 (V8DI "TARGET_AVX512F") (V16SF "TARGET_AVX512F") (V8DF "TARGET_AVX512F")])
238 ;; All vector float modes
239 (define_mode_iterator VF
240 [(V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
241 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
243 ;; 128- and 256-bit float vector modes
244 (define_mode_iterator VF_128_256
245 [(V8SF "TARGET_AVX") V4SF
246 (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
248 ;; All SFmode vector float modes
249 (define_mode_iterator VF1
250 [(V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF])
252 ;; 128- and 256-bit SF vector modes
253 (define_mode_iterator VF1_128_256
254 [(V8SF "TARGET_AVX") V4SF])
256 (define_mode_iterator VF1_128_256VL
257 [V8SF (V4SF "TARGET_AVX512VL")])
259 ;; All DFmode vector float modes
260 (define_mode_iterator VF2
261 [(V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") V2DF])
263 ;; 128- and 256-bit DF vector modes
264 (define_mode_iterator VF2_128_256
265 [(V4DF "TARGET_AVX") V2DF])
267 (define_mode_iterator VF2_512_256
268 [(V8DF "TARGET_AVX512F") V4DF])
270 (define_mode_iterator VF2_512_256VL
271 [V8DF (V4DF "TARGET_AVX512VL")])
273 ;; All 128bit vector float modes
274 (define_mode_iterator VF_128
275 [V4SF (V2DF "TARGET_SSE2")])
277 ;; All 256bit vector float modes
278 (define_mode_iterator VF_256
281 ;; All 512bit vector float modes
282 (define_mode_iterator VF_512
285 (define_mode_iterator VI48_AVX512VL
286 [V16SI (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")
287 V8DI (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")])
289 (define_mode_iterator VF_AVX512VL
290 [V16SF (V8SF "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
291 V8DF (V4DF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
293 (define_mode_iterator VF2_AVX512VL
294 [V8DF (V4DF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
296 (define_mode_iterator VF1_AVX512VL
297 [V16SF (V8SF "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")])
299 ;; All vector integer modes
300 (define_mode_iterator VI
301 [(V16SI "TARGET_AVX512F") (V8DI "TARGET_AVX512F")
302 (V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX") V16QI
303 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX") V8HI
304 (V8SI "TARGET_AVX") V4SI
305 (V4DI "TARGET_AVX") V2DI])
307 (define_mode_iterator VI_AVX2
308 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI
309 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI
310 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX2") V4SI
311 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX2") V2DI])
313 ;; All QImode vector integer modes
314 (define_mode_iterator VI1
315 [(V32QI "TARGET_AVX") V16QI])
317 ;; All DImode vector integer modes
318 (define_mode_iterator V_AVX
319 [V16QI V8HI V4SI V2DI V4SF V2DF
320 (V32QI "TARGET_AVX") (V16HI "TARGET_AVX")
321 (V8SI "TARGET_AVX") (V4DI "TARGET_AVX")
322 (V8SF "TARGET_AVX") (V4DF"TARGET_AVX")])
324 (define_mode_iterator VI48_AVX
326 (V8SI "TARGET_AVX") (V4DI "TARGET_AVX")])
328 (define_mode_iterator VI8
329 [(V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI])
331 (define_mode_iterator VI8_AVX512VL
332 [V8DI (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")])
334 (define_mode_iterator VI8_256_512
335 [V8DI (V4DI "TARGET_AVX512VL")])
337 (define_mode_iterator VI1_AVX2
338 [(V32QI "TARGET_AVX2") V16QI])
340 (define_mode_iterator VI1_AVX512
341 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI])
343 (define_mode_iterator VI1_AVX512F
344 [(V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI])
346 (define_mode_iterator VI2_AVX2
347 [(V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI])
349 (define_mode_iterator VI2_AVX512F
350 [(V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX2") V8HI])
352 (define_mode_iterator VI4_AVX
353 [(V8SI "TARGET_AVX") V4SI])
355 (define_mode_iterator VI4_AVX2
356 [(V8SI "TARGET_AVX2") V4SI])
358 (define_mode_iterator VI4_AVX512F
359 [(V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX2") V4SI])
361 (define_mode_iterator VI4_AVX512VL
362 [V16SI (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")])
364 (define_mode_iterator VI48_AVX512F_AVX512VL
365 [V4SI V8SI (V16SI "TARGET_AVX512F")
366 (V2DI "TARGET_AVX512VL") (V4DI "TARGET_AVX512VL") (V8DI "TARGET_AVX512F")])
368 (define_mode_iterator VI2_AVX512VL
369 [(V8HI "TARGET_AVX512VL") (V16HI "TARGET_AVX512VL") V32HI])
371 (define_mode_iterator VI8_AVX2_AVX512BW
372 [(V8DI "TARGET_AVX512BW") (V4DI "TARGET_AVX2") V2DI])
374 (define_mode_iterator VI8_AVX2
375 [(V4DI "TARGET_AVX2") V2DI])
377 (define_mode_iterator VI8_AVX2_AVX512F
378 [(V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX2") V2DI])
380 (define_mode_iterator VI4_128_8_256
384 (define_mode_iterator V8FI
388 (define_mode_iterator V16FI
391 ;; ??? We should probably use TImode instead.
392 (define_mode_iterator VIMAX_AVX2_AVX512BW
393 [(V4TI "TARGET_AVX512BW") (V2TI "TARGET_AVX2") V1TI])
395 ;; Suppose TARGET_AVX512BW as baseline
396 (define_mode_iterator VIMAX_AVX512VL
397 [V4TI (V2TI "TARGET_AVX512VL") (V1TI "TARGET_AVX512VL")])
399 (define_mode_iterator VIMAX_AVX2
400 [(V2TI "TARGET_AVX2") V1TI])
402 ;; ??? This should probably be dropped in favor of VIMAX_AVX2_AVX512BW.
403 (define_mode_iterator SSESCALARMODE
404 [(V4TI "TARGET_AVX512BW") (V2TI "TARGET_AVX2") TI])
406 (define_mode_iterator VI12_AVX2
407 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI
408 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI])
410 (define_mode_iterator VI24_AVX2
411 [(V16HI "TARGET_AVX2") V8HI
412 (V8SI "TARGET_AVX2") V4SI])
414 (define_mode_iterator VI124_AVX2_24_AVX512F_1_AVX512BW
415 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI
416 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX2") V8HI
417 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX2") V4SI])
419 (define_mode_iterator VI124_AVX2
420 [(V32QI "TARGET_AVX2") V16QI
421 (V16HI "TARGET_AVX2") V8HI
422 (V8SI "TARGET_AVX2") V4SI])
424 (define_mode_iterator VI2_AVX2_AVX512BW
425 [(V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI])
427 (define_mode_iterator VI248_VLBW
428 [(V32HI "TARGET_AVX512BW") V16SI V8DI
429 (V16HI "TARGET_AVX512VL") (V8SI "TARGET_AVX512VL")
430 (V4DI "TARGET_AVX512VL") (V8HI "TARGET_AVX512VL")
431 (V4SI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")])
433 (define_mode_iterator VI48_AVX2
434 [(V8SI "TARGET_AVX2") V4SI
435 (V4DI "TARGET_AVX2") V2DI])
437 (define_mode_iterator VI248_AVX2
438 [(V16HI "TARGET_AVX2") V8HI
439 (V8SI "TARGET_AVX2") V4SI
440 (V4DI "TARGET_AVX2") V2DI])
442 (define_mode_iterator VI248_AVX2_8_AVX512F_24_AVX512BW
443 [(V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI
444 (V16SI "TARGET_AVX512BW") (V8SI "TARGET_AVX2") V4SI
445 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX2") V2DI])
447 (define_mode_iterator VI248_AVX512BW
448 [(V32HI "TARGET_AVX512BW") V16SI V8DI])
450 (define_mode_iterator VI248_AVX512BW_AVX512VL
451 [(V32HI "TARGET_AVX512BW")
452 (V4DI "TARGET_AVX512VL") V16SI V8DI])
454 ;; Suppose TARGET_AVX512VL as baseline
455 (define_mode_iterator VI248_AVX512BW_1
456 [(V16HI "TARGET_AVX512BW") (V8HI "TARGET_AVX512BW")
460 (define_mode_iterator VI248_AVX512BW_2
461 [(V16HI "TARGET_AVX512BW") (V8HI "TARGET_AVX512BW")
465 (define_mode_iterator VI48_AVX512F
466 [(V16SI "TARGET_AVX512F") V8SI V4SI
467 (V8DI "TARGET_AVX512F") V4DI V2DI])
469 (define_mode_iterator VI48_AVX_AVX512F
470 [(V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
471 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI])
473 (define_mode_iterator VI12_AVX_AVX512F
474 [ (V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI
475 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX") V8HI])
477 (define_mode_iterator V48_AVX2
480 (V4SI "TARGET_AVX2") (V2DI "TARGET_AVX2")
481 (V8SI "TARGET_AVX2") (V4DI "TARGET_AVX2")])
483 (define_mode_attr avx512
484 [(V16QI "avx512vl") (V32QI "avx512vl") (V64QI "avx512bw")
485 (V8HI "avx512vl") (V16HI "avx512vl") (V32HI "avx512bw")
486 (V4SI "avx512vl") (V8SI "avx512vl") (V16SI "avx512f")
487 (V2DI "avx512vl") (V4DI "avx512vl") (V8DI "avx512f")
488 (V4SF "avx512vl") (V8SF "avx512vl") (V16SF "avx512f")
489 (V2DF "avx512vl") (V4DF "avx512vl") (V8DF "avx512f")])
491 (define_mode_attr sse2_avx_avx512f
492 [(V16QI "sse2") (V32QI "avx") (V64QI "avx512f")
493 (V8HI "avx512vl") (V16HI "avx512vl") (V32HI "avx512bw")
494 (V4SI "sse2") (V8SI "avx") (V16SI "avx512f")
495 (V2DI "avx512vl") (V4DI "avx512vl") (V8DI "avx512f")
496 (V16SF "avx512f") (V8SF "avx") (V4SF "avx")
497 (V8DF "avx512f") (V4DF "avx") (V2DF "avx")])
499 (define_mode_attr sse2_avx2
500 [(V16QI "sse2") (V32QI "avx2") (V64QI "avx512bw")
501 (V8HI "sse2") (V16HI "avx2") (V32HI "avx512bw")
502 (V4SI "sse2") (V8SI "avx2") (V16SI "avx512f")
503 (V2DI "sse2") (V4DI "avx2") (V8DI "avx512f")
504 (V1TI "sse2") (V2TI "avx2") (V4TI "avx512bw")])
506 (define_mode_attr ssse3_avx2
507 [(V16QI "ssse3") (V32QI "avx2") (V64QI "avx512bw")
508 (V4HI "ssse3") (V8HI "ssse3") (V16HI "avx2") (V32HI "avx512bw")
509 (V4SI "ssse3") (V8SI "avx2")
510 (V2DI "ssse3") (V4DI "avx2")
511 (TI "ssse3") (V2TI "avx2") (V4TI "avx512bw")])
513 (define_mode_attr sse4_1_avx2
514 [(V16QI "sse4_1") (V32QI "avx2") (V64QI "avx512bw")
515 (V8HI "sse4_1") (V16HI "avx2") (V32HI "avx512bw")
516 (V4SI "sse4_1") (V8SI "avx2") (V16SI "avx512f")
517 (V2DI "sse4_1") (V4DI "avx2") (V8DI "avx512dq")])
519 (define_mode_attr avx_avx2
520 [(V4SF "avx") (V2DF "avx")
521 (V8SF "avx") (V4DF "avx")
522 (V4SI "avx2") (V2DI "avx2")
523 (V8SI "avx2") (V4DI "avx2")])
525 (define_mode_attr vec_avx2
526 [(V16QI "vec") (V32QI "avx2")
527 (V8HI "vec") (V16HI "avx2")
528 (V4SI "vec") (V8SI "avx2")
529 (V2DI "vec") (V4DI "avx2")])
531 (define_mode_attr avx2_avx512
532 [(V4SI "avx2") (V8SI "avx2") (V16SI "avx512f")
533 (V2DI "avx2") (V4DI "avx2") (V8DI "avx512f")
534 (V4SF "avx2") (V8SF "avx2") (V16SF "avx512f")
535 (V2DF "avx2") (V4DF "avx2") (V8DF "avx512f")
536 (V8HI "avx512vl") (V16HI "avx512vl") (V32HI "avx512bw")])
538 (define_mode_attr shuffletype
539 [(V16SF "f") (V16SI "i") (V8DF "f") (V8DI "i")
540 (V8SF "f") (V8SI "i") (V4DF "f") (V4DI "i")
541 (V4SF "f") (V4SI "i") (V2DF "f") (V2DI "i")
542 (V32HI "i") (V16HI "i") (V8HI "i")
543 (V64QI "i") (V32QI "i") (V16QI "i")
544 (V4TI "i") (V2TI "i") (V1TI "i")])
546 (define_mode_attr ssequartermode
547 [(V16SF "V4SF") (V8DF "V2DF") (V16SI "V4SI") (V8DI "V2DI")])
549 (define_mode_attr ssedoublemodelower
550 [(V16QI "v16hi") (V32QI "v32hi") (V64QI "v64hi")
551 (V8HI "v8si") (V16HI "v16si") (V32HI "v32si")
552 (V4SI "v4di") (V8SI "v8di") (V16SI "v16di")])
554 (define_mode_attr ssedoublemode
555 [(V4SF "V8SF") (V8SF "V16SF") (V16SF "V32SF")
556 (V2DF "V4DF") (V4DF "V8DF") (V8DF "V16DF")
557 (V16QI "V16HI") (V32QI "V32HI") (V64QI "V64HI")
558 (V4HI "V4SI") (V8HI "V8SI") (V16HI "V16SI") (V32HI "V32SI")
559 (V4SI "V4DI") (V8SI "V16SI") (V16SI "V32SI")
560 (V4DI "V8DI") (V8DI "V16DI")])
562 (define_mode_attr ssebytemode
563 [(V8DI "V64QI") (V4DI "V32QI") (V2DI "V16QI")])
565 ;; All 128bit vector integer modes
566 (define_mode_iterator VI_128 [V16QI V8HI V4SI V2DI])
568 ;; All 256bit vector integer modes
569 (define_mode_iterator VI_256 [V32QI V16HI V8SI V4DI])
571 ;; Various 128bit vector integer mode combinations
572 (define_mode_iterator VI12_128 [V16QI V8HI])
573 (define_mode_iterator VI14_128 [V16QI V4SI])
574 (define_mode_iterator VI124_128 [V16QI V8HI V4SI])
575 (define_mode_iterator VI24_128 [V8HI V4SI])
576 (define_mode_iterator VI248_128 [V8HI V4SI V2DI])
577 (define_mode_iterator VI48_128 [V4SI V2DI])
579 ;; Various 256bit and 512 vector integer mode combinations
580 (define_mode_iterator VI124_256 [V32QI V16HI V8SI])
581 (define_mode_iterator VI124_256_AVX512F_AVX512BW
583 (V64QI "TARGET_AVX512BW")
584 (V32HI "TARGET_AVX512BW")
585 (V16SI "TARGET_AVX512F")])
586 (define_mode_iterator VI48_256 [V8SI V4DI])
587 (define_mode_iterator VI48_512 [V16SI V8DI])
588 (define_mode_iterator VI4_256_8_512 [V8SI V8DI])
589 (define_mode_iterator VI_AVX512BW
590 [V16SI V8DI (V32HI "TARGET_AVX512BW") (V64QI "TARGET_AVX512BW")])
592 ;; Int-float size matches
593 (define_mode_iterator VI4F_128 [V4SI V4SF])
594 (define_mode_iterator VI8F_128 [V2DI V2DF])
595 (define_mode_iterator VI4F_256 [V8SI V8SF])
596 (define_mode_iterator VI8F_256 [V4DI V4DF])
597 (define_mode_iterator VI48F_256_512
599 (V16SI "TARGET_AVX512F") (V16SF "TARGET_AVX512F")
600 (V8DI "TARGET_AVX512F") (V8DF "TARGET_AVX512F")
601 (V4DI "TARGET_AVX512VL") (V4DF "TARGET_AVX512VL")])
602 (define_mode_iterator VF48_I1248
603 [V16SI V16SF V8DI V8DF V32HI V64QI])
604 (define_mode_iterator VI48F
605 [V16SI V16SF V8DI V8DF
606 (V8SI "TARGET_AVX512VL") (V8SF "TARGET_AVX512VL")
607 (V4DI "TARGET_AVX512VL") (V4DF "TARGET_AVX512VL")
608 (V4SI "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
609 (V2DI "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
610 (define_mode_iterator VI48F_256 [V8SI V8SF V4DI V4DF])
612 ;; Mapping from float mode to required SSE level
613 (define_mode_attr sse
614 [(SF "sse") (DF "sse2")
615 (V4SF "sse") (V2DF "sse2")
616 (V16SF "avx512f") (V8SF "avx")
617 (V8DF "avx512f") (V4DF "avx")])
619 (define_mode_attr sse2
620 [(V16QI "sse2") (V32QI "avx") (V64QI "avx512f")
621 (V2DI "sse2") (V4DI "avx") (V8DI "avx512f")])
623 (define_mode_attr sse3
624 [(V16QI "sse3") (V32QI "avx")])
626 (define_mode_attr sse4_1
627 [(V4SF "sse4_1") (V2DF "sse4_1")
628 (V8SF "avx") (V4DF "avx")
630 (V4DI "avx") (V2DI "sse4_1")
631 (V8SI "avx") (V4SI "sse4_1")
632 (V16QI "sse4_1") (V32QI "avx")
633 (V8HI "sse4_1") (V16HI "avx")])
635 (define_mode_attr avxsizesuffix
636 [(V64QI "512") (V32HI "512") (V16SI "512") (V8DI "512")
637 (V32QI "256") (V16HI "256") (V8SI "256") (V4DI "256")
638 (V16QI "") (V8HI "") (V4SI "") (V2DI "")
639 (V16SF "512") (V8DF "512")
640 (V8SF "256") (V4DF "256")
641 (V4SF "") (V2DF "")])
643 ;; SSE instruction mode
644 (define_mode_attr sseinsnmode
645 [(V64QI "XI") (V32HI "XI") (V16SI "XI") (V8DI "XI") (V4TI "XI")
646 (V32QI "OI") (V16HI "OI") (V8SI "OI") (V4DI "OI") (V2TI "OI")
647 (V16QI "TI") (V8HI "TI") (V4SI "TI") (V2DI "TI") (V1TI "TI")
648 (V16SF "V16SF") (V8DF "V8DF")
649 (V8SF "V8SF") (V4DF "V4DF")
650 (V4SF "V4SF") (V2DF "V2DF")
653 ;; Mapping of vector modes to corresponding mask size
654 (define_mode_attr avx512fmaskmode
655 [(V64QI "DI") (V32QI "SI") (V16QI "HI")
656 (V32HI "SI") (V16HI "HI") (V8HI "QI") (V4HI "QI")
657 (V16SI "HI") (V8SI "QI") (V4SI "QI")
658 (V8DI "QI") (V4DI "QI") (V2DI "QI")
659 (V16SF "HI") (V8SF "QI") (V4SF "QI")
660 (V8DF "QI") (V4DF "QI") (V2DF "QI")])
662 ;; Mapping of vector modes to corresponding mask size
663 (define_mode_attr avx512fmaskmodelower
664 [(V64QI "di") (V32QI "si") (V16QI "hi")
665 (V32HI "si") (V16HI "hi") (V8HI "qi") (V4HI "qi")
666 (V16SI "hi") (V8SI "qi") (V4SI "qi")
667 (V8DI "qi") (V4DI "qi") (V2DI "qi")
668 (V16SF "hi") (V8SF "qi") (V4SF "qi")
669 (V8DF "qi") (V4DF "qi") (V2DF "qi")])
671 ;; Mapping of vector float modes to an integer mode of the same size
672 (define_mode_attr sseintvecmode
673 [(V16SF "V16SI") (V8DF "V8DI")
674 (V8SF "V8SI") (V4DF "V4DI")
675 (V4SF "V4SI") (V2DF "V2DI")
676 (V16SI "V16SI") (V8DI "V8DI")
677 (V8SI "V8SI") (V4DI "V4DI")
678 (V4SI "V4SI") (V2DI "V2DI")
679 (V16HI "V16HI") (V8HI "V8HI")
680 (V32HI "V32HI") (V64QI "V64QI")
681 (V32QI "V32QI") (V16QI "V16QI")])
683 (define_mode_attr sseintvecmode2
684 [(V8DF "XI") (V4DF "OI") (V2DF "TI")
685 (V8SF "OI") (V4SF "TI")])
687 (define_mode_attr sseintvecmodelower
688 [(V16SF "v16si") (V8DF "v8di")
689 (V8SF "v8si") (V4DF "v4di")
690 (V4SF "v4si") (V2DF "v2di")
691 (V8SI "v8si") (V4DI "v4di")
692 (V4SI "v4si") (V2DI "v2di")
693 (V16HI "v16hi") (V8HI "v8hi")
694 (V32QI "v32qi") (V16QI "v16qi")])
696 ;; Mapping of vector modes to a vector mode of double size
697 (define_mode_attr ssedoublevecmode
698 [(V32QI "V64QI") (V16HI "V32HI") (V8SI "V16SI") (V4DI "V8DI")
699 (V16QI "V32QI") (V8HI "V16HI") (V4SI "V8SI") (V2DI "V4DI")
700 (V8SF "V16SF") (V4DF "V8DF")
701 (V4SF "V8SF") (V2DF "V4DF")])
703 ;; Mapping of vector modes to a vector mode of half size
704 (define_mode_attr ssehalfvecmode
705 [(V64QI "V32QI") (V32HI "V16HI") (V16SI "V8SI") (V8DI "V4DI") (V4TI "V2TI")
706 (V32QI "V16QI") (V16HI "V8HI") (V8SI "V4SI") (V4DI "V2DI")
707 (V16QI "V8QI") (V8HI "V4HI") (V4SI "V2SI")
708 (V16SF "V8SF") (V8DF "V4DF")
709 (V8SF "V4SF") (V4DF "V2DF")
712 (define_mode_attr ssehalfvecmodelower
713 [(V64QI "v32qi") (V32HI "v16hi") (V16SI "v8si") (V8DI "v4di") (V4TI "v2ti")
714 (V32QI "v16qi") (V16HI "v8hi") (V8SI "v4si") (V4DI "v2di")
715 (V16QI "v8qi") (V8HI "v4hi") (V4SI "v2si")
716 (V16SF "v8sf") (V8DF "v4df")
717 (V8SF "v4sf") (V4DF "v2df")
720 ;; Mapping of vector modes ti packed single mode of the same size
721 (define_mode_attr ssePSmode
722 [(V16SI "V16SF") (V8DF "V16SF")
723 (V16SF "V16SF") (V8DI "V16SF")
724 (V64QI "V16SF") (V32QI "V8SF") (V16QI "V4SF")
725 (V32HI "V16SF") (V16HI "V8SF") (V8HI "V4SF")
726 (V8SI "V8SF") (V4SI "V4SF")
727 (V4DI "V8SF") (V2DI "V4SF")
728 (V4TI "V16SF") (V2TI "V8SF") (V1TI "V4SF")
729 (V8SF "V8SF") (V4SF "V4SF")
730 (V4DF "V8SF") (V2DF "V4SF")])
732 (define_mode_attr ssePSmode2
733 [(V8DI "V8SF") (V4DI "V4SF")])
735 ;; Mapping of vector modes back to the scalar modes
736 (define_mode_attr ssescalarmode
737 [(V64QI "QI") (V32QI "QI") (V16QI "QI")
738 (V32HI "HI") (V16HI "HI") (V8HI "HI")
739 (V16SI "SI") (V8SI "SI") (V4SI "SI")
740 (V8DI "DI") (V4DI "DI") (V2DI "DI")
741 (V16SF "SF") (V8SF "SF") (V4SF "SF")
742 (V8DF "DF") (V4DF "DF") (V2DF "DF")
743 (V4TI "TI") (V2TI "TI")])
745 ;; Mapping of vector modes back to the scalar modes
746 (define_mode_attr ssescalarmodelower
747 [(V64QI "qi") (V32QI "qi") (V16QI "qi")
748 (V32HI "hi") (V16HI "hi") (V8HI "hi")
749 (V16SI "si") (V8SI "si") (V4SI "si")
750 (V8DI "di") (V4DI "di") (V2DI "di")
751 (V16SF "sf") (V8SF "sf") (V4SF "sf")
752 (V8DF "df") (V4DF "df") (V2DF "df")
753 (V4TI "ti") (V2TI "ti")])
755 ;; Mapping of vector modes to the 128bit modes
756 (define_mode_attr ssexmmmode
757 [(V64QI "V16QI") (V32QI "V16QI") (V16QI "V16QI")
758 (V32HI "V8HI") (V16HI "V8HI") (V8HI "V8HI")
759 (V16SI "V4SI") (V8SI "V4SI") (V4SI "V4SI")
760 (V8DI "V2DI") (V4DI "V2DI") (V2DI "V2DI")
761 (V16SF "V4SF") (V8SF "V4SF") (V4SF "V4SF")
762 (V8DF "V2DF") (V4DF "V2DF") (V2DF "V2DF")])
764 ;; Pointer size override for scalar modes (Intel asm dialect)
765 (define_mode_attr iptr
766 [(V64QI "b") (V32HI "w") (V16SI "k") (V8DI "q")
767 (V32QI "b") (V16HI "w") (V8SI "k") (V4DI "q")
768 (V16QI "b") (V8HI "w") (V4SI "k") (V2DI "q")
769 (V8SF "k") (V4DF "q")
770 (V4SF "k") (V2DF "q")
773 ;; Number of scalar elements in each vector type
774 (define_mode_attr ssescalarnum
775 [(V64QI "64") (V16SI "16") (V8DI "8")
776 (V32QI "32") (V16HI "16") (V8SI "8") (V4DI "4")
777 (V16QI "16") (V8HI "8") (V4SI "4") (V2DI "2")
778 (V16SF "16") (V8DF "8")
779 (V8SF "8") (V4DF "4")
780 (V4SF "4") (V2DF "2")])
782 ;; Mask of scalar elements in each vector type
783 (define_mode_attr ssescalarnummask
784 [(V32QI "31") (V16HI "15") (V8SI "7") (V4DI "3")
785 (V16QI "15") (V8HI "7") (V4SI "3") (V2DI "1")
786 (V8SF "7") (V4DF "3")
787 (V4SF "3") (V2DF "1")])
789 (define_mode_attr ssescalarsize
790 [(V4TI "64") (V2TI "64") (V1TI "64")
791 (V8DI "64") (V4DI "64") (V2DI "64")
792 (V64QI "8") (V32QI "8") (V16QI "8")
793 (V32HI "16") (V16HI "16") (V8HI "16")
794 (V16SI "32") (V8SI "32") (V4SI "32")
795 (V16SF "32") (V8SF "32") (V4SF "32")
796 (V8DF "64") (V4DF "64") (V2DF "64")])
798 ;; SSE prefix for integer vector modes
799 (define_mode_attr sseintprefix
800 [(V2DI "p") (V2DF "")
805 (V16SI "p") (V16SF "")
806 (V16QI "p") (V8HI "p")
807 (V32QI "p") (V16HI "p")
808 (V64QI "p") (V32HI "p")])
810 ;; SSE scalar suffix for vector modes
811 (define_mode_attr ssescalarmodesuffix
813 (V8SF "ss") (V4DF "sd")
814 (V4SF "ss") (V2DF "sd")
815 (V8SI "ss") (V4DI "sd")
818 ;; Pack/unpack vector modes
819 (define_mode_attr sseunpackmode
820 [(V16QI "V8HI") (V8HI "V4SI") (V4SI "V2DI")
821 (V32QI "V16HI") (V16HI "V8SI") (V8SI "V4DI")
822 (V32HI "V16SI") (V64QI "V32HI") (V16SI "V8DI")])
824 (define_mode_attr ssepackmode
825 [(V8HI "V16QI") (V4SI "V8HI") (V2DI "V4SI")
826 (V16HI "V32QI") (V8SI "V16HI") (V4DI "V8SI")
827 (V32HI "V64QI") (V16SI "V32HI") (V8DI "V16SI")])
829 ;; Mapping of the max integer size for xop rotate immediate constraint
830 (define_mode_attr sserotatemax
831 [(V16QI "7") (V8HI "15") (V4SI "31") (V2DI "63")])
833 ;; Mapping of mode to cast intrinsic name
834 (define_mode_attr castmode
835 [(V8SI "si") (V8SF "ps") (V4DF "pd")
836 (V16SI "si") (V16SF "ps") (V8DF "pd")])
838 ;; Instruction suffix for sign and zero extensions.
839 (define_code_attr extsuffix [(sign_extend "sx") (zero_extend "zx")])
841 ;; i128 for integer vectors and TARGET_AVX2, f128 otherwise.
842 ;; i64x4 or f64x4 for 512bit modes.
843 (define_mode_attr i128
844 [(V16SF "f64x4") (V8SF "f128") (V8DF "f64x4") (V4DF "f128")
845 (V64QI "i64x4") (V32QI "%~128") (V32HI "i64x4") (V16HI "%~128")
846 (V16SI "i64x4") (V8SI "%~128") (V8DI "i64x4") (V4DI "%~128")])
848 ;; For 256-bit modes for TARGET_AVX512VL && TARGET_AVX512DQ
849 ;; i32x4, f32x4, i64x2 or f64x2 suffixes.
850 (define_mode_attr i128vldq
851 [(V8SF "f32x4") (V4DF "f64x2")
852 (V32QI "i32x4") (V16HI "i32x4") (V8SI "i32x4") (V4DI "i64x2")])
855 (define_mode_iterator AVX256MODE2P [V8SI V8SF V4DF])
856 (define_mode_iterator AVX512MODE2P [V16SI V16SF V8DF])
858 ;; Mapping for dbpsabbw modes
859 (define_mode_attr dbpsadbwmode
860 [(V32HI "V64QI") (V16HI "V32QI") (V8HI "V16QI")])
862 ;; Mapping suffixes for broadcast
863 (define_mode_attr bcstscalarsuff
864 [(V64QI "b") (V32QI "b") (V16QI "b")
865 (V32HI "w") (V16HI "w") (V8HI "w")
866 (V16SI "d") (V8SI "d") (V4SI "d")
867 (V8DI "q") (V4DI "q") (V2DI "q")
868 (V16SF "ss") (V8SF "ss") (V4SF "ss")
869 (V8DF "sd") (V4DF "sd") (V2DF "sd")])
871 ;; Tie mode of assembler operand to mode iterator
872 (define_mode_attr concat_tg_mode
873 [(V32QI "t") (V16HI "t") (V8SI "t") (V4DI "t") (V8SF "t") (V4DF "t")
874 (V64QI "g") (V32HI "g") (V16SI "g") (V8DI "g") (V16SF "g") (V8DF "g")])
876 ;; Tie mode of assembler operand to mode iterator
877 (define_mode_attr xtg_mode
878 [(V16QI "x") (V8HI "x") (V4SI "x") (V2DI "x") (V4SF "x") (V2DF "x")
879 (V32QI "t") (V16HI "t") (V8SI "t") (V4DI "t") (V8SF "t") (V4DF "t")
880 (V64QI "g") (V32HI "g") (V16SI "g") (V8DI "g") (V16SF "g") (V8DF "g")])
882 ;; Half mask mode for unpacks
883 (define_mode_attr HALFMASKMODE
884 [(DI "SI") (SI "HI")])
886 ;; Double mask mode for packs
887 (define_mode_attr DOUBLEMASKMODE
888 [(HI "SI") (SI "DI")])
891 ;; Include define_subst patterns for instructions with mask
894 ;; Patterns whose name begins with "sse{,2,3}_" are invoked by intrinsics.
896 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
900 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
902 ;; All of these patterns are enabled for SSE1 as well as SSE2.
903 ;; This is essential for maintaining stable calling conventions.
905 (define_expand "mov<mode>"
906 [(set (match_operand:VMOVE 0 "nonimmediate_operand")
907 (match_operand:VMOVE 1 "nonimmediate_operand"))]
910 ix86_expand_vector_move (<MODE>mode, operands);
914 (define_insn "mov<mode>_internal"
915 [(set (match_operand:VMOVE 0 "nonimmediate_operand"
917 (match_operand:VMOVE 1 "nonimmediate_or_sse_const_operand"
920 && (register_operand (operands[0], <MODE>mode)
921 || register_operand (operands[1], <MODE>mode))"
923 switch (get_attr_type (insn))
926 return standard_sse_constant_opcode (insn, operands);
929 /* There is no evex-encoded vmov* for sizes smaller than 64-bytes
930 in avx512f, so we need to use workarounds, to access sse registers
931 16-31, which are evex-only. In avx512vl we don't need workarounds. */
932 if (TARGET_AVX512F && <MODE_SIZE> < 64 && !TARGET_AVX512VL
933 && (EXT_REX_SSE_REG_P (operands[0])
934 || EXT_REX_SSE_REG_P (operands[1])))
936 if (memory_operand (operands[0], <MODE>mode))
938 if (<MODE_SIZE> == 32)
939 return "vextract<shuffletype>64x4\t{$0x0, %g1, %0|%0, %g1, 0x0}";
940 else if (<MODE_SIZE> == 16)
941 return "vextract<shuffletype>32x4\t{$0x0, %g1, %0|%0, %g1, 0x0}";
945 else if (memory_operand (operands[1], <MODE>mode))
947 if (<MODE_SIZE> == 32)
948 return "vbroadcast<shuffletype>64x4\t{%1, %g0|%g0, %1}";
949 else if (<MODE_SIZE> == 16)
950 return "vbroadcast<shuffletype>32x4\t{%1, %g0|%g0, %1}";
955 /* Reg -> reg move is always aligned. Just use wider move. */
956 switch (get_attr_mode (insn))
960 return "vmovaps\t{%g1, %g0|%g0, %g1}";
963 return "vmovapd\t{%g1, %g0|%g0, %g1}";
966 return "vmovdqa64\t{%g1, %g0|%g0, %g1}";
972 switch (get_attr_mode (insn))
977 if (misaligned_operand (operands[0], <MODE>mode)
978 || misaligned_operand (operands[1], <MODE>mode))
979 return "%vmovups\t{%1, %0|%0, %1}";
981 return "%vmovaps\t{%1, %0|%0, %1}";
986 if (misaligned_operand (operands[0], <MODE>mode)
987 || misaligned_operand (operands[1], <MODE>mode))
988 return "%vmovupd\t{%1, %0|%0, %1}";
990 return "%vmovapd\t{%1, %0|%0, %1}";
994 if (misaligned_operand (operands[0], <MODE>mode)
995 || misaligned_operand (operands[1], <MODE>mode))
996 return TARGET_AVX512VL ? "vmovdqu<ssescalarsize>\t{%1, %0|%0, %1}"
997 : "%vmovdqu\t{%1, %0|%0, %1}";
999 return TARGET_AVX512VL ? "vmovdqa64\t{%1, %0|%0, %1}"
1000 : "%vmovdqa\t{%1, %0|%0, %1}";
1002 if (misaligned_operand (operands[0], <MODE>mode)
1003 || misaligned_operand (operands[1], <MODE>mode))
1004 return (<MODE>mode == V16SImode
1005 || <MODE>mode == V8DImode
1007 ? "vmovdqu<ssescalarsize>\t{%1, %0|%0, %1}"
1008 : "vmovdqu64\t{%1, %0|%0, %1}";
1010 return "vmovdqa64\t{%1, %0|%0, %1}";
1020 [(set_attr "type" "sselog1,sselog1,ssemov,ssemov")
1021 (set_attr "prefix" "maybe_vex")
1023 (cond [(and (eq_attr "alternative" "1")
1024 (match_test "TARGET_AVX512VL"))
1025 (const_string "<sseinsnmode>")
1026 (and (match_test "<MODE_SIZE> == 16")
1027 (ior (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
1028 (and (eq_attr "alternative" "3")
1029 (match_test "TARGET_SSE_TYPELESS_STORES"))))
1030 (const_string "<ssePSmode>")
1031 (match_test "TARGET_AVX")
1032 (const_string "<sseinsnmode>")
1033 (ior (not (match_test "TARGET_SSE2"))
1034 (match_test "optimize_function_for_size_p (cfun)"))
1035 (const_string "V4SF")
1036 (and (eq_attr "alternative" "0")
1037 (match_test "TARGET_SSE_LOAD0_BY_PXOR"))
1040 (const_string "<sseinsnmode>")))
1041 (set (attr "enabled")
1042 (cond [(and (match_test "<MODE_SIZE> == 16")
1043 (eq_attr "alternative" "1"))
1044 (symbol_ref "TARGET_SSE2")
1045 (and (match_test "<MODE_SIZE> == 32")
1046 (eq_attr "alternative" "1"))
1047 (symbol_ref "TARGET_AVX2")
1049 (symbol_ref "true")))])
1051 (define_insn "<avx512>_load<mode>_mask"
1052 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v,v")
1053 (vec_merge:V48_AVX512VL
1054 (match_operand:V48_AVX512VL 1 "nonimmediate_operand" "v,m")
1055 (match_operand:V48_AVX512VL 2 "vector_move_operand" "0C,0C")
1056 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
1059 if (FLOAT_MODE_P (GET_MODE_INNER (<MODE>mode)))
1061 if (misaligned_operand (operands[1], <MODE>mode))
1062 return "vmovu<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
1064 return "vmova<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
1068 if (misaligned_operand (operands[1], <MODE>mode))
1069 return "vmovdqu<ssescalarsize>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
1071 return "vmovdqa<ssescalarsize>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
1074 [(set_attr "type" "ssemov")
1075 (set_attr "prefix" "evex")
1076 (set_attr "memory" "none,load")
1077 (set_attr "mode" "<sseinsnmode>")])
1079 (define_insn "<avx512>_load<mode>_mask"
1080 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v,v")
1081 (vec_merge:VI12_AVX512VL
1082 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "v,m")
1083 (match_operand:VI12_AVX512VL 2 "vector_move_operand" "0C,0C")
1084 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
1086 "vmovdqu<ssescalarsize>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
1087 [(set_attr "type" "ssemov")
1088 (set_attr "prefix" "evex")
1089 (set_attr "memory" "none,load")
1090 (set_attr "mode" "<sseinsnmode>")])
1092 (define_insn "<avx512>_blendm<mode>"
1093 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v")
1094 (vec_merge:V48_AVX512VL
1095 (match_operand:V48_AVX512VL 2 "nonimmediate_operand" "vm")
1096 (match_operand:V48_AVX512VL 1 "register_operand" "v")
1097 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
1099 "vblendm<ssemodesuffix>\t{%2, %1, %0%{%3%}|%0%{%3%}, %1, %2}"
1100 [(set_attr "type" "ssemov")
1101 (set_attr "prefix" "evex")
1102 (set_attr "mode" "<sseinsnmode>")])
1104 (define_insn "<avx512>_blendm<mode>"
1105 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
1106 (vec_merge:VI12_AVX512VL
1107 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")
1108 (match_operand:VI12_AVX512VL 1 "register_operand" "v")
1109 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
1111 "vpblendm<ssemodesuffix>\t{%2, %1, %0%{%3%}|%0%{%3%}, %1, %2}"
1112 [(set_attr "type" "ssemov")
1113 (set_attr "prefix" "evex")
1114 (set_attr "mode" "<sseinsnmode>")])
1116 (define_insn "<avx512>_store<mode>_mask"
1117 [(set (match_operand:V48_AVX512VL 0 "memory_operand" "=m")
1118 (vec_merge:V48_AVX512VL
1119 (match_operand:V48_AVX512VL 1 "register_operand" "v")
1121 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")))]
1124 if (FLOAT_MODE_P (GET_MODE_INNER (<MODE>mode)))
1126 if (misaligned_operand (operands[0], <MODE>mode))
1127 return "vmovu<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1129 return "vmova<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1133 if (misaligned_operand (operands[0], <MODE>mode))
1134 return "vmovdqu<ssescalarsize>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1136 return "vmovdqa<ssescalarsize>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1139 [(set_attr "type" "ssemov")
1140 (set_attr "prefix" "evex")
1141 (set_attr "memory" "store")
1142 (set_attr "mode" "<sseinsnmode>")])
1144 (define_insn "<avx512>_store<mode>_mask"
1145 [(set (match_operand:VI12_AVX512VL 0 "memory_operand" "=m")
1146 (vec_merge:VI12_AVX512VL
1147 (match_operand:VI12_AVX512VL 1 "register_operand" "v")
1149 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")))]
1151 "vmovdqu<ssescalarsize>\t{%1, %0%{%2%}|%0%{%2%}, %1}"
1152 [(set_attr "type" "ssemov")
1153 (set_attr "prefix" "evex")
1154 (set_attr "memory" "store")
1155 (set_attr "mode" "<sseinsnmode>")])
1157 (define_insn "sse2_movq128"
1158 [(set (match_operand:V2DI 0 "register_operand" "=v")
1161 (match_operand:V2DI 1 "nonimmediate_operand" "vm")
1162 (parallel [(const_int 0)]))
1165 "%vmovq\t{%1, %0|%0, %q1}"
1166 [(set_attr "type" "ssemov")
1167 (set_attr "prefix" "maybe_vex")
1168 (set_attr "mode" "TI")])
1170 ;; Move a DI from a 32-bit register pair (e.g. %edx:%eax) to an xmm.
1171 ;; We'd rather avoid this entirely; if the 32-bit reg pair was loaded
1172 ;; from memory, we'd prefer to load the memory directly into the %xmm
1173 ;; register. To facilitate this happy circumstance, this pattern won't
1174 ;; split until after register allocation. If the 64-bit value didn't
1175 ;; come from memory, this is the best we can do. This is much better
1176 ;; than storing %edx:%eax into a stack temporary and loading an %xmm
1179 (define_insn_and_split "movdi_to_sse"
1181 [(set (match_operand:V4SI 0 "register_operand" "=?x,x")
1182 (subreg:V4SI (match_operand:DI 1 "nonimmediate_operand" "r,m") 0))
1183 (clobber (match_scratch:V4SI 2 "=&x,X"))])]
1184 "!TARGET_64BIT && TARGET_SSE2 && TARGET_INTER_UNIT_MOVES_TO_VEC"
1186 "&& reload_completed"
1189 if (register_operand (operands[1], DImode))
1191 /* The DImode arrived in a pair of integral registers (e.g. %edx:%eax).
1192 Assemble the 64-bit DImode value in an xmm register. */
1193 emit_insn (gen_sse2_loadld (operands[0], CONST0_RTX (V4SImode),
1194 gen_lowpart (SImode, operands[1])));
1195 emit_insn (gen_sse2_loadld (operands[2], CONST0_RTX (V4SImode),
1196 gen_highpart (SImode, operands[1])));
1197 emit_insn (gen_vec_interleave_lowv4si (operands[0], operands[0],
1200 else if (memory_operand (operands[1], DImode))
1202 rtx tmp = gen_reg_rtx (V2DImode);
1203 emit_insn (gen_vec_concatv2di (tmp, operands[1], const0_rtx));
1204 emit_move_insn (operands[0], gen_lowpart (V4SImode, tmp));
1212 [(set (match_operand:V4SF 0 "register_operand")
1213 (match_operand:V4SF 1 "zero_extended_scalar_load_operand"))]
1214 "TARGET_SSE && reload_completed"
1217 (vec_duplicate:V4SF (match_dup 1))
1221 operands[1] = gen_lowpart (SFmode, operands[1]);
1222 operands[2] = CONST0_RTX (V4SFmode);
1226 [(set (match_operand:V2DF 0 "register_operand")
1227 (match_operand:V2DF 1 "zero_extended_scalar_load_operand"))]
1228 "TARGET_SSE2 && reload_completed"
1229 [(set (match_dup 0) (vec_concat:V2DF (match_dup 1) (match_dup 2)))]
1231 operands[1] = gen_lowpart (DFmode, operands[1]);
1232 operands[2] = CONST0_RTX (DFmode);
1235 (define_expand "movmisalign<mode>"
1236 [(set (match_operand:VMOVE 0 "nonimmediate_operand")
1237 (match_operand:VMOVE 1 "nonimmediate_operand"))]
1240 ix86_expand_vector_move_misalign (<MODE>mode, operands);
1244 ;; Merge movsd/movhpd to movupd for TARGET_SSE_UNALIGNED_LOAD_OPTIMAL targets.
1246 [(set (match_operand:V2DF 0 "sse_reg_operand")
1247 (vec_concat:V2DF (match_operand:DF 1 "memory_operand")
1248 (match_operand:DF 4 "const0_operand")))
1249 (set (match_operand:V2DF 2 "sse_reg_operand")
1250 (vec_concat:V2DF (vec_select:DF (match_dup 2)
1251 (parallel [(const_int 0)]))
1252 (match_operand:DF 3 "memory_operand")))]
1253 "TARGET_SSE2 && TARGET_SSE_UNALIGNED_LOAD_OPTIMAL
1254 && ix86_operands_ok_for_move_multiple (operands, true, DFmode)"
1255 [(set (match_dup 2) (match_dup 5))]
1256 "operands[5] = adjust_address (operands[1], V2DFmode, 0);")
1259 [(set (match_operand:DF 0 "sse_reg_operand")
1260 (match_operand:DF 1 "memory_operand"))
1261 (set (match_operand:V2DF 2 "sse_reg_operand")
1262 (vec_concat:V2DF (match_operand:DF 4 "sse_reg_operand")
1263 (match_operand:DF 3 "memory_operand")))]
1264 "TARGET_SSE2 && TARGET_SSE_UNALIGNED_LOAD_OPTIMAL
1265 && REGNO (operands[4]) == REGNO (operands[2])
1266 && ix86_operands_ok_for_move_multiple (operands, true, DFmode)"
1267 [(set (match_dup 2) (match_dup 5))]
1268 "operands[5] = adjust_address (operands[1], V2DFmode, 0);")
1270 ;; Merge movlpd/movhpd to movupd for TARGET_SSE_UNALIGNED_STORE_OPTIMAL targets.
1272 [(set (match_operand:DF 0 "memory_operand")
1273 (vec_select:DF (match_operand:V2DF 1 "sse_reg_operand")
1274 (parallel [(const_int 0)])))
1275 (set (match_operand:DF 2 "memory_operand")
1276 (vec_select:DF (match_operand:V2DF 3 "sse_reg_operand")
1277 (parallel [(const_int 1)])))]
1278 "TARGET_SSE2 && TARGET_SSE_UNALIGNED_STORE_OPTIMAL
1279 && ix86_operands_ok_for_move_multiple (operands, false, DFmode)"
1280 [(set (match_dup 4) (match_dup 1))]
1281 "operands[4] = adjust_address (operands[0], V2DFmode, 0);")
1283 (define_insn "<sse3>_lddqu<avxsizesuffix>"
1284 [(set (match_operand:VI1 0 "register_operand" "=x")
1285 (unspec:VI1 [(match_operand:VI1 1 "memory_operand" "m")]
1288 "%vlddqu\t{%1, %0|%0, %1}"
1289 [(set_attr "type" "ssemov")
1290 (set_attr "movu" "1")
1291 (set (attr "prefix_data16")
1293 (match_test "TARGET_AVX")
1295 (const_string "0")))
1296 (set (attr "prefix_rep")
1298 (match_test "TARGET_AVX")
1300 (const_string "1")))
1301 (set_attr "prefix" "maybe_vex")
1302 (set_attr "mode" "<sseinsnmode>")])
1304 (define_insn "sse2_movnti<mode>"
1305 [(set (match_operand:SWI48 0 "memory_operand" "=m")
1306 (unspec:SWI48 [(match_operand:SWI48 1 "register_operand" "r")]
1309 "movnti\t{%1, %0|%0, %1}"
1310 [(set_attr "type" "ssemov")
1311 (set_attr "prefix_data16" "0")
1312 (set_attr "mode" "<MODE>")])
1314 (define_insn "<sse>_movnt<mode>"
1315 [(set (match_operand:VF 0 "memory_operand" "=m")
1317 [(match_operand:VF 1 "register_operand" "v")]
1320 "%vmovnt<ssemodesuffix>\t{%1, %0|%0, %1}"
1321 [(set_attr "type" "ssemov")
1322 (set_attr "prefix" "maybe_vex")
1323 (set_attr "mode" "<MODE>")])
1325 (define_insn "<sse2>_movnt<mode>"
1326 [(set (match_operand:VI8 0 "memory_operand" "=m")
1327 (unspec:VI8 [(match_operand:VI8 1 "register_operand" "v")]
1330 "%vmovntdq\t{%1, %0|%0, %1}"
1331 [(set_attr "type" "ssecvt")
1332 (set (attr "prefix_data16")
1334 (match_test "TARGET_AVX")
1336 (const_string "1")))
1337 (set_attr "prefix" "maybe_vex")
1338 (set_attr "mode" "<sseinsnmode>")])
1340 ; Expand patterns for non-temporal stores. At the moment, only those
1341 ; that directly map to insns are defined; it would be possible to
1342 ; define patterns for other modes that would expand to several insns.
1344 ;; Modes handled by storent patterns.
1345 (define_mode_iterator STORENT_MODE
1346 [(DI "TARGET_SSE2 && TARGET_64BIT") (SI "TARGET_SSE2")
1347 (SF "TARGET_SSE4A") (DF "TARGET_SSE4A")
1348 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") (V2DI "TARGET_SSE2")
1349 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
1350 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
1352 (define_expand "storent<mode>"
1353 [(set (match_operand:STORENT_MODE 0 "memory_operand")
1354 (unspec:STORENT_MODE
1355 [(match_operand:STORENT_MODE 1 "register_operand")]
1359 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1363 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1365 ;; All integer modes with AVX512BW/DQ.
1366 (define_mode_iterator SWI1248_AVX512BWDQ
1367 [(QI "TARGET_AVX512DQ") HI (SI "TARGET_AVX512BW") (DI "TARGET_AVX512BW")])
1369 ;; All integer modes with AVX512BW, where HImode operation
1370 ;; can be used instead of QImode.
1371 (define_mode_iterator SWI1248_AVX512BW
1372 [QI HI (SI "TARGET_AVX512BW") (DI "TARGET_AVX512BW")])
1374 ;; All integer modes with AVX512BW/DQ, even HImode requires DQ.
1375 (define_mode_iterator SWI1248_AVX512BWDQ2
1376 [(QI "TARGET_AVX512DQ") (HI "TARGET_AVX512DQ")
1377 (SI "TARGET_AVX512BW") (DI "TARGET_AVX512BW")])
1379 (define_expand "kmov<mskmodesuffix>"
1380 [(set (match_operand:SWI1248_AVX512BWDQ 0 "nonimmediate_operand")
1381 (match_operand:SWI1248_AVX512BWDQ 1 "nonimmediate_operand"))]
1383 && !(MEM_P (operands[0]) && MEM_P (operands[1]))")
1385 (define_insn "k<code><mode>"
1386 [(set (match_operand:SWI1248_AVX512BW 0 "register_operand" "=k")
1387 (any_logic:SWI1248_AVX512BW
1388 (match_operand:SWI1248_AVX512BW 1 "register_operand" "k")
1389 (match_operand:SWI1248_AVX512BW 2 "register_operand" "k")))
1390 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1393 if (get_attr_mode (insn) == MODE_HI)
1394 return "k<logic>w\t{%2, %1, %0|%0, %1, %2}";
1396 return "k<logic><mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}";
1398 [(set_attr "type" "msklog")
1399 (set_attr "prefix" "vex")
1401 (cond [(and (match_test "<MODE>mode == QImode")
1402 (not (match_test "TARGET_AVX512DQ")))
1405 (const_string "<MODE>")))])
1407 (define_insn "kandn<mode>"
1408 [(set (match_operand:SWI1248_AVX512BW 0 "register_operand" "=k")
1409 (and:SWI1248_AVX512BW
1410 (not:SWI1248_AVX512BW
1411 (match_operand:SWI1248_AVX512BW 1 "register_operand" "k"))
1412 (match_operand:SWI1248_AVX512BW 2 "register_operand" "k")))
1413 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1416 if (get_attr_mode (insn) == MODE_HI)
1417 return "kandnw\t{%2, %1, %0|%0, %1, %2}";
1419 return "kandn<mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}";
1421 [(set_attr "type" "msklog")
1422 (set_attr "prefix" "vex")
1424 (cond [(and (match_test "<MODE>mode == QImode")
1425 (not (match_test "TARGET_AVX512DQ")))
1428 (const_string "<MODE>")))])
1430 (define_insn "kxnor<mode>"
1431 [(set (match_operand:SWI1248_AVX512BW 0 "register_operand" "=k")
1432 (not:SWI1248_AVX512BW
1433 (xor:SWI1248_AVX512BW
1434 (match_operand:SWI1248_AVX512BW 1 "register_operand" "k")
1435 (match_operand:SWI1248_AVX512BW 2 "register_operand" "k"))))
1436 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1439 if (get_attr_mode (insn) == MODE_HI)
1440 return "kxnorw\t{%2, %1, %0|%0, %1, %2}";
1442 return "kxnor<mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}";
1444 [(set_attr "type" "msklog")
1445 (set_attr "prefix" "vex")
1447 (cond [(and (match_test "<MODE>mode == QImode")
1448 (not (match_test "TARGET_AVX512DQ")))
1451 (const_string "<MODE>")))])
1453 (define_insn "knot<mode>"
1454 [(set (match_operand:SWI1248_AVX512BW 0 "register_operand" "=k")
1455 (not:SWI1248_AVX512BW
1456 (match_operand:SWI1248_AVX512BW 1 "register_operand" "k")))
1457 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1460 if (get_attr_mode (insn) == MODE_HI)
1461 return "knotw\t{%1, %0|%0, %1}";
1463 return "knot<mskmodesuffix>\t{%1, %0|%0, %1}";
1465 [(set_attr "type" "msklog")
1466 (set_attr "prefix" "vex")
1468 (cond [(and (match_test "<MODE>mode == QImode")
1469 (not (match_test "TARGET_AVX512DQ")))
1472 (const_string "<MODE>")))])
1474 (define_insn "kadd<mode>"
1475 [(set (match_operand:SWI1248_AVX512BWDQ2 0 "register_operand" "=k")
1476 (plus:SWI1248_AVX512BWDQ2
1477 (match_operand:SWI1248_AVX512BWDQ2 1 "register_operand" "k")
1478 (match_operand:SWI1248_AVX512BWDQ2 2 "register_operand" "k")))
1479 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1481 "kadd<mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}"
1482 [(set_attr "type" "msklog")
1483 (set_attr "prefix" "vex")
1484 (set_attr "mode" "<MODE>")])
1486 ;; Mask variant shift mnemonics
1487 (define_code_attr mshift [(ashift "shiftl") (lshiftrt "shiftr")])
1489 (define_insn "k<code><mode>"
1490 [(set (match_operand:SWI1248_AVX512BWDQ 0 "register_operand" "=k")
1491 (any_lshift:SWI1248_AVX512BWDQ
1492 (match_operand:SWI1248_AVX512BWDQ 1 "register_operand" "k")
1493 (match_operand:QI 2 "immediate_operand" "n")))
1494 (unspec [(const_int 0)] UNSPEC_MASKOP)]
1496 "k<mshift><mskmodesuffix>\t{%2, %1, %0|%0, %1, %2}"
1497 [(set_attr "type" "msklog")
1498 (set_attr "prefix" "vex")
1499 (set_attr "mode" "<MODE>")])
1501 (define_insn "ktest<mode>"
1502 [(set (reg:CC FLAGS_REG)
1504 [(match_operand:SWI1248_AVX512BWDQ2 0 "register_operand" "k")
1505 (match_operand:SWI1248_AVX512BWDQ2 1 "register_operand" "k")]
1508 "ktest<mskmodesuffix>\t{%1, %0|%0, %1}"
1509 [(set_attr "mode" "<MODE>")
1510 (set_attr "type" "msklog")
1511 (set_attr "prefix" "vex")])
1513 (define_insn "kortest<mode>"
1514 [(set (reg:CC FLAGS_REG)
1516 [(match_operand:SWI1248_AVX512BWDQ 0 "register_operand" "k")
1517 (match_operand:SWI1248_AVX512BWDQ 1 "register_operand" "k")]
1520 "kortest<mskmodesuffix>\t{%1, %0|%0, %1}"
1521 [(set_attr "mode" "<MODE>")
1522 (set_attr "type" "msklog")
1523 (set_attr "prefix" "vex")])
1525 (define_insn "kunpckhi"
1526 [(set (match_operand:HI 0 "register_operand" "=k")
1529 (zero_extend:HI (match_operand:QI 1 "register_operand" "k"))
1531 (zero_extend:HI (match_operand:QI 2 "register_operand" "k"))))]
1533 "kunpckbw\t{%2, %1, %0|%0, %1, %2}"
1534 [(set_attr "mode" "HI")
1535 (set_attr "type" "msklog")
1536 (set_attr "prefix" "vex")])
1538 (define_insn "kunpcksi"
1539 [(set (match_operand:SI 0 "register_operand" "=k")
1542 (zero_extend:SI (match_operand:HI 1 "register_operand" "k"))
1544 (zero_extend:SI (match_operand:HI 2 "register_operand" "k"))))]
1546 "kunpckwd\t{%2, %1, %0|%0, %1, %2}"
1547 [(set_attr "mode" "SI")])
1549 (define_insn "kunpckdi"
1550 [(set (match_operand:DI 0 "register_operand" "=k")
1553 (zero_extend:DI (match_operand:SI 1 "register_operand" "k"))
1555 (zero_extend:DI (match_operand:SI 2 "register_operand" "k"))))]
1557 "kunpckdq\t{%2, %1, %0|%0, %1, %2}"
1558 [(set_attr "mode" "DI")])
1561 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1563 ;; Parallel floating point arithmetic
1565 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1567 (define_expand "<code><mode>2"
1568 [(set (match_operand:VF 0 "register_operand")
1570 (match_operand:VF 1 "register_operand")))]
1572 "ix86_expand_fp_absneg_operator (<CODE>, <MODE>mode, operands); DONE;")
1574 (define_insn_and_split "*absneg<mode>2"
1575 [(set (match_operand:VF 0 "register_operand" "=x,x,v,v")
1576 (match_operator:VF 3 "absneg_operator"
1577 [(match_operand:VF 1 "vector_operand" "0, xBm,v, m")]))
1578 (use (match_operand:VF 2 "vector_operand" "xBm,0, vm,v"))]
1581 "&& reload_completed"
1584 enum rtx_code absneg_op;
1590 if (MEM_P (operands[1]))
1591 op1 = operands[2], op2 = operands[1];
1593 op1 = operands[1], op2 = operands[2];
1598 if (rtx_equal_p (operands[0], operands[1]))
1604 absneg_op = GET_CODE (operands[3]) == NEG ? XOR : AND;
1605 t = gen_rtx_fmt_ee (absneg_op, <MODE>mode, op1, op2);
1606 t = gen_rtx_SET (operands[0], t);
1610 [(set_attr "isa" "noavx,noavx,avx,avx")])
1612 (define_expand "<plusminus_insn><mode>3<mask_name><round_name>"
1613 [(set (match_operand:VF 0 "register_operand")
1615 (match_operand:VF 1 "<round_nimm_predicate>")
1616 (match_operand:VF 2 "<round_nimm_predicate>")))]
1617 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1618 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
1620 (define_insn "*<plusminus_insn><mode>3<mask_name><round_name>"
1621 [(set (match_operand:VF 0 "register_operand" "=x,v")
1623 (match_operand:VF 1 "<round_nimm_predicate>" "<comm>0,v")
1624 (match_operand:VF 2 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
1625 "TARGET_SSE && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)
1626 && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1628 <plusminus_mnemonic><ssemodesuffix>\t{%2, %0|%0, %2}
1629 v<plusminus_mnemonic><ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
1630 [(set_attr "isa" "noavx,avx")
1631 (set_attr "type" "sseadd")
1632 (set_attr "prefix" "<mask_prefix3>")
1633 (set_attr "mode" "<MODE>")])
1635 (define_insn "<sse>_vm<plusminus_insn><mode>3<mask_scalar_name><round_scalar_name>"
1636 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
1639 (match_operand:VF_128 1 "register_operand" "0,v")
1640 (match_operand:VF_128 2 "vector_operand" "xBm,<round_scalar_constraint>"))
1645 <plusminus_mnemonic><ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
1646 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>}"
1647 [(set_attr "isa" "noavx,avx")
1648 (set_attr "type" "sseadd")
1649 (set_attr "prefix" "<round_scalar_prefix>")
1650 (set_attr "mode" "<ssescalarmode>")])
1652 (define_expand "mul<mode>3<mask_name><round_name>"
1653 [(set (match_operand:VF 0 "register_operand")
1655 (match_operand:VF 1 "<round_nimm_predicate>")
1656 (match_operand:VF 2 "<round_nimm_predicate>")))]
1657 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1658 "ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);")
1660 (define_insn "*mul<mode>3<mask_name><round_name>"
1661 [(set (match_operand:VF 0 "register_operand" "=x,v")
1663 (match_operand:VF 1 "<round_nimm_predicate>" "%0,v")
1664 (match_operand:VF 2 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
1666 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
1667 && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1669 mul<ssemodesuffix>\t{%2, %0|%0, %2}
1670 vmul<ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
1671 [(set_attr "isa" "noavx,avx")
1672 (set_attr "type" "ssemul")
1673 (set_attr "prefix" "<mask_prefix3>")
1674 (set_attr "btver2_decode" "direct,double")
1675 (set_attr "mode" "<MODE>")])
1677 (define_insn "<sse>_vm<multdiv_mnemonic><mode>3<mask_scalar_name><round_scalar_name>"
1678 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
1681 (match_operand:VF_128 1 "register_operand" "0,v")
1682 (match_operand:VF_128 2 "vector_operand" "xBm,<round_scalar_constraint>"))
1687 <multdiv_mnemonic><ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
1688 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>}"
1689 [(set_attr "isa" "noavx,avx")
1690 (set_attr "type" "sse<multdiv_mnemonic>")
1691 (set_attr "prefix" "<round_scalar_prefix>")
1692 (set_attr "btver2_decode" "direct,double")
1693 (set_attr "mode" "<ssescalarmode>")])
1695 (define_expand "div<mode>3"
1696 [(set (match_operand:VF2 0 "register_operand")
1697 (div:VF2 (match_operand:VF2 1 "register_operand")
1698 (match_operand:VF2 2 "vector_operand")))]
1700 "ix86_fixup_binary_operands_no_copy (DIV, <MODE>mode, operands);")
1702 (define_expand "div<mode>3"
1703 [(set (match_operand:VF1 0 "register_operand")
1704 (div:VF1 (match_operand:VF1 1 "register_operand")
1705 (match_operand:VF1 2 "vector_operand")))]
1708 ix86_fixup_binary_operands_no_copy (DIV, <MODE>mode, operands);
1711 && TARGET_RECIP_VEC_DIV
1712 && !optimize_insn_for_size_p ()
1713 && flag_finite_math_only && !flag_trapping_math
1714 && flag_unsafe_math_optimizations)
1716 ix86_emit_swdivsf (operands[0], operands[1], operands[2], <MODE>mode);
1721 (define_insn "<sse>_div<mode>3<mask_name><round_name>"
1722 [(set (match_operand:VF 0 "register_operand" "=x,v")
1724 (match_operand:VF 1 "register_operand" "0,v")
1725 (match_operand:VF 2 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
1726 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1728 div<ssemodesuffix>\t{%2, %0|%0, %2}
1729 vdiv<ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
1730 [(set_attr "isa" "noavx,avx")
1731 (set_attr "type" "ssediv")
1732 (set_attr "prefix" "<mask_prefix3>")
1733 (set_attr "mode" "<MODE>")])
1735 (define_insn "<sse>_rcp<mode>2"
1736 [(set (match_operand:VF1_128_256 0 "register_operand" "=x")
1738 [(match_operand:VF1_128_256 1 "vector_operand" "xBm")] UNSPEC_RCP))]
1740 "%vrcpps\t{%1, %0|%0, %1}"
1741 [(set_attr "type" "sse")
1742 (set_attr "atom_sse_attr" "rcp")
1743 (set_attr "btver2_sse_attr" "rcp")
1744 (set_attr "prefix" "maybe_vex")
1745 (set_attr "mode" "<MODE>")])
1747 (define_insn "sse_vmrcpv4sf2"
1748 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
1750 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm,xm")]
1752 (match_operand:V4SF 2 "register_operand" "0,x")
1756 rcpss\t{%1, %0|%0, %k1}
1757 vrcpss\t{%1, %2, %0|%0, %2, %k1}"
1758 [(set_attr "isa" "noavx,avx")
1759 (set_attr "type" "sse")
1760 (set_attr "atom_sse_attr" "rcp")
1761 (set_attr "btver2_sse_attr" "rcp")
1762 (set_attr "prefix" "orig,vex")
1763 (set_attr "mode" "SF")])
1765 (define_insn "<mask_codefor>rcp14<mode><mask_name>"
1766 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
1768 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "vm")]
1771 "vrcp14<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
1772 [(set_attr "type" "sse")
1773 (set_attr "prefix" "evex")
1774 (set_attr "mode" "<MODE>")])
1776 (define_insn "srcp14<mode>"
1777 [(set (match_operand:VF_128 0 "register_operand" "=v")
1780 [(match_operand:VF_128 1 "nonimmediate_operand" "vm")]
1782 (match_operand:VF_128 2 "register_operand" "v")
1785 "vrcp14<ssescalarmodesuffix>\t{%1, %2, %0|%0, %2, %<iptr>1}"
1786 [(set_attr "type" "sse")
1787 (set_attr "prefix" "evex")
1788 (set_attr "mode" "<MODE>")])
1790 (define_insn "srcp14<mode>_mask"
1791 [(set (match_operand:VF_128 0 "register_operand" "=v")
1795 [(match_operand:VF_128 1 "nonimmediate_operand" "vm")]
1797 (match_operand:VF_128 3 "vector_move_operand" "0C")
1798 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk"))
1799 (match_operand:VF_128 2 "register_operand" "v")
1802 "vrcp14<ssescalarmodesuffix>\t{%1, %2, %0%{%4%}%N3|%0%{%4%}%N3, %2, %<iptr>1}"
1803 [(set_attr "type" "sse")
1804 (set_attr "prefix" "evex")
1805 (set_attr "mode" "<MODE>")])
1807 (define_expand "sqrt<mode>2"
1808 [(set (match_operand:VF2 0 "register_operand")
1809 (sqrt:VF2 (match_operand:VF2 1 "vector_operand")))]
1812 (define_expand "sqrt<mode>2"
1813 [(set (match_operand:VF1 0 "register_operand")
1814 (sqrt:VF1 (match_operand:VF1 1 "vector_operand")))]
1818 && TARGET_RECIP_VEC_SQRT
1819 && !optimize_insn_for_size_p ()
1820 && flag_finite_math_only && !flag_trapping_math
1821 && flag_unsafe_math_optimizations)
1823 ix86_emit_swsqrtsf (operands[0], operands[1], <MODE>mode, false);
1828 (define_insn "<sse>_sqrt<mode>2<mask_name><round_name>"
1829 [(set (match_operand:VF 0 "register_operand" "=x,v")
1830 (sqrt:VF (match_operand:VF 1 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
1831 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1833 sqrt<ssemodesuffix>\t{%1, %0|%0, %1}
1834 vsqrt<ssemodesuffix>\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
1835 [(set_attr "isa" "noavx,avx")
1836 (set_attr "type" "sse")
1837 (set_attr "atom_sse_attr" "sqrt")
1838 (set_attr "btver2_sse_attr" "sqrt")
1839 (set_attr "prefix" "maybe_vex")
1840 (set_attr "mode" "<MODE>")])
1842 (define_insn "<sse>_vmsqrt<mode>2<round_name>"
1843 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
1846 (match_operand:VF_128 1 "vector_operand" "xBm,<round_constraint>"))
1847 (match_operand:VF_128 2 "register_operand" "0,v")
1851 sqrt<ssescalarmodesuffix>\t{%1, %0|%0, %<iptr>1}
1852 vsqrt<ssescalarmodesuffix>\t{<round_op3>%1, %2, %0|%0, %2, %<iptr>1<round_op3>}"
1853 [(set_attr "isa" "noavx,avx")
1854 (set_attr "type" "sse")
1855 (set_attr "atom_sse_attr" "sqrt")
1856 (set_attr "prefix" "<round_prefix>")
1857 (set_attr "btver2_sse_attr" "sqrt")
1858 (set_attr "mode" "<ssescalarmode>")])
1860 (define_expand "rsqrt<mode>2"
1861 [(set (match_operand:VF1_128_256 0 "register_operand")
1863 [(match_operand:VF1_128_256 1 "vector_operand")] UNSPEC_RSQRT))]
1866 ix86_emit_swsqrtsf (operands[0], operands[1], <MODE>mode, true);
1870 (define_expand "rsqrtv16sf2"
1871 [(set (match_operand:V16SF 0 "register_operand")
1873 [(match_operand:V16SF 1 "vector_operand")]
1875 "TARGET_SSE_MATH && TARGET_AVX512ER"
1877 ix86_emit_swsqrtsf (operands[0], operands[1], V16SFmode, true);
1881 (define_insn "<sse>_rsqrt<mode>2"
1882 [(set (match_operand:VF1_128_256 0 "register_operand" "=x")
1884 [(match_operand:VF1_128_256 1 "vector_operand" "xBm")] UNSPEC_RSQRT))]
1886 "%vrsqrtps\t{%1, %0|%0, %1}"
1887 [(set_attr "type" "sse")
1888 (set_attr "prefix" "maybe_vex")
1889 (set_attr "mode" "<MODE>")])
1891 (define_insn "<mask_codefor>rsqrt14<mode><mask_name>"
1892 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
1894 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "vm")]
1897 "vrsqrt14<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
1898 [(set_attr "type" "sse")
1899 (set_attr "prefix" "evex")
1900 (set_attr "mode" "<MODE>")])
1902 (define_insn "rsqrt14<mode>"
1903 [(set (match_operand:VF_128 0 "register_operand" "=v")
1906 [(match_operand:VF_128 1 "nonimmediate_operand" "vm")]
1908 (match_operand:VF_128 2 "register_operand" "v")
1911 "vrsqrt14<ssescalarmodesuffix>\t{%1, %2, %0|%0, %2, %<iptr>1}"
1912 [(set_attr "type" "sse")
1913 (set_attr "prefix" "evex")
1914 (set_attr "mode" "<MODE>")])
1916 (define_insn "rsqrt14_<mode>_mask"
1917 [(set (match_operand:VF_128 0 "register_operand" "=v")
1921 [(match_operand:VF_128 1 "nonimmediate_operand" "vm")]
1923 (match_operand:VF_128 3 "vector_move_operand" "0C")
1924 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk"))
1925 (match_operand:VF_128 2 "register_operand" "v")
1928 "vrsqrt14<ssescalarmodesuffix>\t{%1, %2, %0%{%4%}%N3|%0%{%4%}%N3, %2, %<iptr>1}"
1929 [(set_attr "type" "sse")
1930 (set_attr "prefix" "evex")
1931 (set_attr "mode" "<MODE>")])
1933 (define_insn "sse_vmrsqrtv4sf2"
1934 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
1936 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm,xm")]
1938 (match_operand:V4SF 2 "register_operand" "0,x")
1942 rsqrtss\t{%1, %0|%0, %k1}
1943 vrsqrtss\t{%1, %2, %0|%0, %2, %k1}"
1944 [(set_attr "isa" "noavx,avx")
1945 (set_attr "type" "sse")
1946 (set_attr "prefix" "orig,vex")
1947 (set_attr "mode" "SF")])
1949 (define_expand "<code><mode>3<mask_name><round_saeonly_name>"
1950 [(set (match_operand:VF 0 "register_operand")
1952 (match_operand:VF 1 "<round_saeonly_nimm_predicate>")
1953 (match_operand:VF 2 "<round_saeonly_nimm_predicate>")))]
1954 "TARGET_SSE && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
1956 if (!flag_finite_math_only || flag_signed_zeros)
1958 operands[1] = force_reg (<MODE>mode, operands[1]);
1959 emit_insn (gen_ieee_<maxmin_float><mode>3<mask_name><round_saeonly_name>
1960 (operands[0], operands[1], operands[2]
1961 <mask_operand_arg34>
1962 <round_saeonly_mask_arg3>));
1966 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
1969 ;; These versions of the min/max patterns are intentionally ignorant of
1970 ;; their behavior wrt -0.0 and NaN (via the commutative operand mark).
1971 ;; Since both the tree-level MAX_EXPR and the rtl-level SMAX operator
1972 ;; are undefined in this condition, we're certain this is correct.
1974 (define_insn "*<code><mode>3<mask_name><round_saeonly_name>"
1975 [(set (match_operand:VF 0 "register_operand" "=x,v")
1977 (match_operand:VF 1 "<round_saeonly_nimm_predicate>" "%0,v")
1978 (match_operand:VF 2 "<round_saeonly_nimm_predicate>" "xBm,<round_saeonly_constraint>")))]
1980 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
1981 && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
1983 <maxmin_float><ssemodesuffix>\t{%2, %0|%0, %2}
1984 v<maxmin_float><ssemodesuffix>\t{<round_saeonly_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_saeonly_mask_op3>}"
1985 [(set_attr "isa" "noavx,avx")
1986 (set_attr "type" "sseadd")
1987 (set_attr "btver2_sse_attr" "maxmin")
1988 (set_attr "prefix" "<mask_prefix3>")
1989 (set_attr "mode" "<MODE>")])
1991 ;; These versions of the min/max patterns implement exactly the operations
1992 ;; min = (op1 < op2 ? op1 : op2)
1993 ;; max = (!(op1 < op2) ? op1 : op2)
1994 ;; Their operands are not commutative, and thus they may be used in the
1995 ;; presence of -0.0 and NaN.
1997 (define_insn "ieee_<ieee_maxmin><mode>3<mask_name><round_saeonly_name>"
1998 [(set (match_operand:VF 0 "register_operand" "=x,v")
2000 [(match_operand:VF 1 "register_operand" "0,v")
2001 (match_operand:VF 2 "<round_saeonly_nimm_predicate>" "xBm,<round_saeonly_constraint>")]
2004 && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
2006 <ieee_maxmin><ssemodesuffix>\t{%2, %0|%0, %2}
2007 v<ieee_maxmin><ssemodesuffix>\t{<round_saeonly_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_saeonly_mask_op3>}"
2008 [(set_attr "isa" "noavx,avx")
2009 (set_attr "type" "sseadd")
2010 (set_attr "btver2_sse_attr" "maxmin")
2011 (set_attr "prefix" "<mask_prefix3>")
2012 (set_attr "mode" "<MODE>")])
2014 (define_insn "<sse>_vm<code><mode>3<mask_scalar_name><round_saeonly_scalar_name>"
2015 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
2018 (match_operand:VF_128 1 "register_operand" "0,v")
2019 (match_operand:VF_128 2 "vector_operand" "xBm,<round_saeonly_scalar_constraint>"))
2024 <maxmin_float><ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
2025 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>}"
2026 [(set_attr "isa" "noavx,avx")
2027 (set_attr "type" "sse")
2028 (set_attr "btver2_sse_attr" "maxmin")
2029 (set_attr "prefix" "<round_saeonly_scalar_prefix>")
2030 (set_attr "mode" "<ssescalarmode>")])
2032 (define_insn "avx_addsubv4df3"
2033 [(set (match_operand:V4DF 0 "register_operand" "=x")
2036 (match_operand:V4DF 1 "register_operand" "x")
2037 (match_operand:V4DF 2 "nonimmediate_operand" "xm"))
2038 (plus:V4DF (match_dup 1) (match_dup 2))
2041 "vaddsubpd\t{%2, %1, %0|%0, %1, %2}"
2042 [(set_attr "type" "sseadd")
2043 (set_attr "prefix" "vex")
2044 (set_attr "mode" "V4DF")])
2046 (define_insn "sse3_addsubv2df3"
2047 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
2050 (match_operand:V2DF 1 "register_operand" "0,x")
2051 (match_operand:V2DF 2 "vector_operand" "xBm,xm"))
2052 (plus:V2DF (match_dup 1) (match_dup 2))
2056 addsubpd\t{%2, %0|%0, %2}
2057 vaddsubpd\t{%2, %1, %0|%0, %1, %2}"
2058 [(set_attr "isa" "noavx,avx")
2059 (set_attr "type" "sseadd")
2060 (set_attr "atom_unit" "complex")
2061 (set_attr "prefix" "orig,vex")
2062 (set_attr "mode" "V2DF")])
2064 (define_insn "avx_addsubv8sf3"
2065 [(set (match_operand:V8SF 0 "register_operand" "=x")
2068 (match_operand:V8SF 1 "register_operand" "x")
2069 (match_operand:V8SF 2 "nonimmediate_operand" "xm"))
2070 (plus:V8SF (match_dup 1) (match_dup 2))
2073 "vaddsubps\t{%2, %1, %0|%0, %1, %2}"
2074 [(set_attr "type" "sseadd")
2075 (set_attr "prefix" "vex")
2076 (set_attr "mode" "V8SF")])
2078 (define_insn "sse3_addsubv4sf3"
2079 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
2082 (match_operand:V4SF 1 "register_operand" "0,x")
2083 (match_operand:V4SF 2 "vector_operand" "xBm,xm"))
2084 (plus:V4SF (match_dup 1) (match_dup 2))
2088 addsubps\t{%2, %0|%0, %2}
2089 vaddsubps\t{%2, %1, %0|%0, %1, %2}"
2090 [(set_attr "isa" "noavx,avx")
2091 (set_attr "type" "sseadd")
2092 (set_attr "prefix" "orig,vex")
2093 (set_attr "prefix_rep" "1,*")
2094 (set_attr "mode" "V4SF")])
2097 [(set (match_operand:VF_128_256 0 "register_operand")
2098 (match_operator:VF_128_256 6 "addsub_vm_operator"
2100 (match_operand:VF_128_256 1 "register_operand")
2101 (match_operand:VF_128_256 2 "vector_operand"))
2103 (match_operand:VF_128_256 3 "vector_operand")
2104 (match_operand:VF_128_256 4 "vector_operand"))
2105 (match_operand 5 "const_int_operand")]))]
2107 && can_create_pseudo_p ()
2108 && ((rtx_equal_p (operands[1], operands[3])
2109 && rtx_equal_p (operands[2], operands[4]))
2110 || (rtx_equal_p (operands[1], operands[4])
2111 && rtx_equal_p (operands[2], operands[3])))"
2113 (vec_merge:VF_128_256
2114 (minus:VF_128_256 (match_dup 1) (match_dup 2))
2115 (plus:VF_128_256 (match_dup 1) (match_dup 2))
2119 [(set (match_operand:VF_128_256 0 "register_operand")
2120 (match_operator:VF_128_256 6 "addsub_vm_operator"
2122 (match_operand:VF_128_256 1 "vector_operand")
2123 (match_operand:VF_128_256 2 "vector_operand"))
2125 (match_operand:VF_128_256 3 "register_operand")
2126 (match_operand:VF_128_256 4 "vector_operand"))
2127 (match_operand 5 "const_int_operand")]))]
2129 && can_create_pseudo_p ()
2130 && ((rtx_equal_p (operands[1], operands[3])
2131 && rtx_equal_p (operands[2], operands[4]))
2132 || (rtx_equal_p (operands[1], operands[4])
2133 && rtx_equal_p (operands[2], operands[3])))"
2135 (vec_merge:VF_128_256
2136 (minus:VF_128_256 (match_dup 3) (match_dup 4))
2137 (plus:VF_128_256 (match_dup 3) (match_dup 4))
2140 /* Negate mask bits to compensate for swapped PLUS and MINUS RTXes. */
2142 = GEN_INT (~INTVAL (operands[5])
2143 & ((HOST_WIDE_INT_1U << GET_MODE_NUNITS (<MODE>mode)) - 1));
2147 [(set (match_operand:VF_128_256 0 "register_operand")
2148 (match_operator:VF_128_256 7 "addsub_vs_operator"
2149 [(vec_concat:<ssedoublemode>
2151 (match_operand:VF_128_256 1 "register_operand")
2152 (match_operand:VF_128_256 2 "vector_operand"))
2154 (match_operand:VF_128_256 3 "vector_operand")
2155 (match_operand:VF_128_256 4 "vector_operand")))
2156 (match_parallel 5 "addsub_vs_parallel"
2157 [(match_operand 6 "const_int_operand")])]))]
2159 && can_create_pseudo_p ()
2160 && ((rtx_equal_p (operands[1], operands[3])
2161 && rtx_equal_p (operands[2], operands[4]))
2162 || (rtx_equal_p (operands[1], operands[4])
2163 && rtx_equal_p (operands[2], operands[3])))"
2165 (vec_merge:VF_128_256
2166 (minus:VF_128_256 (match_dup 1) (match_dup 2))
2167 (plus:VF_128_256 (match_dup 1) (match_dup 2))
2170 int i, nelt = XVECLEN (operands[5], 0);
2171 HOST_WIDE_INT ival = 0;
2173 for (i = 0; i < nelt; i++)
2174 if (INTVAL (XVECEXP (operands[5], 0, i)) < GET_MODE_NUNITS (<MODE>mode))
2175 ival |= HOST_WIDE_INT_1 << i;
2177 operands[5] = GEN_INT (ival);
2181 [(set (match_operand:VF_128_256 0 "register_operand")
2182 (match_operator:VF_128_256 7 "addsub_vs_operator"
2183 [(vec_concat:<ssedoublemode>
2185 (match_operand:VF_128_256 1 "vector_operand")
2186 (match_operand:VF_128_256 2 "vector_operand"))
2188 (match_operand:VF_128_256 3 "register_operand")
2189 (match_operand:VF_128_256 4 "vector_operand")))
2190 (match_parallel 5 "addsub_vs_parallel"
2191 [(match_operand 6 "const_int_operand")])]))]
2193 && can_create_pseudo_p ()
2194 && ((rtx_equal_p (operands[1], operands[3])
2195 && rtx_equal_p (operands[2], operands[4]))
2196 || (rtx_equal_p (operands[1], operands[4])
2197 && rtx_equal_p (operands[2], operands[3])))"
2199 (vec_merge:VF_128_256
2200 (minus:VF_128_256 (match_dup 3) (match_dup 4))
2201 (plus:VF_128_256 (match_dup 3) (match_dup 4))
2204 int i, nelt = XVECLEN (operands[5], 0);
2205 HOST_WIDE_INT ival = 0;
2207 for (i = 0; i < nelt; i++)
2208 if (INTVAL (XVECEXP (operands[5], 0, i)) >= GET_MODE_NUNITS (<MODE>mode))
2209 ival |= HOST_WIDE_INT_1 << i;
2211 operands[5] = GEN_INT (ival);
2214 (define_insn "avx_h<plusminus_insn>v4df3"
2215 [(set (match_operand:V4DF 0 "register_operand" "=x")
2220 (match_operand:V4DF 1 "register_operand" "x")
2221 (parallel [(const_int 0)]))
2222 (vec_select:DF (match_dup 1) (parallel [(const_int 1)])))
2225 (match_operand:V4DF 2 "nonimmediate_operand" "xm")
2226 (parallel [(const_int 0)]))
2227 (vec_select:DF (match_dup 2) (parallel [(const_int 1)]))))
2230 (vec_select:DF (match_dup 1) (parallel [(const_int 2)]))
2231 (vec_select:DF (match_dup 1) (parallel [(const_int 3)])))
2233 (vec_select:DF (match_dup 2) (parallel [(const_int 2)]))
2234 (vec_select:DF (match_dup 2) (parallel [(const_int 3)]))))))]
2236 "vh<plusminus_mnemonic>pd\t{%2, %1, %0|%0, %1, %2}"
2237 [(set_attr "type" "sseadd")
2238 (set_attr "prefix" "vex")
2239 (set_attr "mode" "V4DF")])
2241 (define_expand "sse3_haddv2df3"
2242 [(set (match_operand:V2DF 0 "register_operand")
2246 (match_operand:V2DF 1 "register_operand")
2247 (parallel [(const_int 0)]))
2248 (vec_select:DF (match_dup 1) (parallel [(const_int 1)])))
2251 (match_operand:V2DF 2 "vector_operand")
2252 (parallel [(const_int 0)]))
2253 (vec_select:DF (match_dup 2) (parallel [(const_int 1)])))))]
2256 (define_insn "*sse3_haddv2df3"
2257 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
2261 (match_operand:V2DF 1 "register_operand" "0,x")
2262 (parallel [(match_operand:SI 3 "const_0_to_1_operand")]))
2265 (parallel [(match_operand:SI 4 "const_0_to_1_operand")])))
2268 (match_operand:V2DF 2 "vector_operand" "xBm,xm")
2269 (parallel [(match_operand:SI 5 "const_0_to_1_operand")]))
2272 (parallel [(match_operand:SI 6 "const_0_to_1_operand")])))))]
2274 && INTVAL (operands[3]) != INTVAL (operands[4])
2275 && INTVAL (operands[5]) != INTVAL (operands[6])"
2277 haddpd\t{%2, %0|%0, %2}
2278 vhaddpd\t{%2, %1, %0|%0, %1, %2}"
2279 [(set_attr "isa" "noavx,avx")
2280 (set_attr "type" "sseadd")
2281 (set_attr "prefix" "orig,vex")
2282 (set_attr "mode" "V2DF")])
2284 (define_insn "sse3_hsubv2df3"
2285 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
2289 (match_operand:V2DF 1 "register_operand" "0,x")
2290 (parallel [(const_int 0)]))
2291 (vec_select:DF (match_dup 1) (parallel [(const_int 1)])))
2294 (match_operand:V2DF 2 "vector_operand" "xBm,xm")
2295 (parallel [(const_int 0)]))
2296 (vec_select:DF (match_dup 2) (parallel [(const_int 1)])))))]
2299 hsubpd\t{%2, %0|%0, %2}
2300 vhsubpd\t{%2, %1, %0|%0, %1, %2}"
2301 [(set_attr "isa" "noavx,avx")
2302 (set_attr "type" "sseadd")
2303 (set_attr "prefix" "orig,vex")
2304 (set_attr "mode" "V2DF")])
2306 (define_insn "*sse3_haddv2df3_low"
2307 [(set (match_operand:DF 0 "register_operand" "=x,x")
2310 (match_operand:V2DF 1 "register_operand" "0,x")
2311 (parallel [(match_operand:SI 2 "const_0_to_1_operand")]))
2314 (parallel [(match_operand:SI 3 "const_0_to_1_operand")]))))]
2316 && INTVAL (operands[2]) != INTVAL (operands[3])"
2318 haddpd\t{%0, %0|%0, %0}
2319 vhaddpd\t{%1, %1, %0|%0, %1, %1}"
2320 [(set_attr "isa" "noavx,avx")
2321 (set_attr "type" "sseadd1")
2322 (set_attr "prefix" "orig,vex")
2323 (set_attr "mode" "V2DF")])
2325 (define_insn "*sse3_hsubv2df3_low"
2326 [(set (match_operand:DF 0 "register_operand" "=x,x")
2329 (match_operand:V2DF 1 "register_operand" "0,x")
2330 (parallel [(const_int 0)]))
2333 (parallel [(const_int 1)]))))]
2336 hsubpd\t{%0, %0|%0, %0}
2337 vhsubpd\t{%1, %1, %0|%0, %1, %1}"
2338 [(set_attr "isa" "noavx,avx")
2339 (set_attr "type" "sseadd1")
2340 (set_attr "prefix" "orig,vex")
2341 (set_attr "mode" "V2DF")])
2343 (define_insn "avx_h<plusminus_insn>v8sf3"
2344 [(set (match_operand:V8SF 0 "register_operand" "=x")
2350 (match_operand:V8SF 1 "register_operand" "x")
2351 (parallel [(const_int 0)]))
2352 (vec_select:SF (match_dup 1) (parallel [(const_int 1)])))
2354 (vec_select:SF (match_dup 1) (parallel [(const_int 2)]))
2355 (vec_select:SF (match_dup 1) (parallel [(const_int 3)]))))
2359 (match_operand:V8SF 2 "nonimmediate_operand" "xm")
2360 (parallel [(const_int 0)]))
2361 (vec_select:SF (match_dup 2) (parallel [(const_int 1)])))
2363 (vec_select:SF (match_dup 2) (parallel [(const_int 2)]))
2364 (vec_select:SF (match_dup 2) (parallel [(const_int 3)])))))
2368 (vec_select:SF (match_dup 1) (parallel [(const_int 4)]))
2369 (vec_select:SF (match_dup 1) (parallel [(const_int 5)])))
2371 (vec_select:SF (match_dup 1) (parallel [(const_int 6)]))
2372 (vec_select:SF (match_dup 1) (parallel [(const_int 7)]))))
2375 (vec_select:SF (match_dup 2) (parallel [(const_int 4)]))
2376 (vec_select:SF (match_dup 2) (parallel [(const_int 5)])))
2378 (vec_select:SF (match_dup 2) (parallel [(const_int 6)]))
2379 (vec_select:SF (match_dup 2) (parallel [(const_int 7)])))))))]
2381 "vh<plusminus_mnemonic>ps\t{%2, %1, %0|%0, %1, %2}"
2382 [(set_attr "type" "sseadd")
2383 (set_attr "prefix" "vex")
2384 (set_attr "mode" "V8SF")])
2386 (define_insn "sse3_h<plusminus_insn>v4sf3"
2387 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
2392 (match_operand:V4SF 1 "register_operand" "0,x")
2393 (parallel [(const_int 0)]))
2394 (vec_select:SF (match_dup 1) (parallel [(const_int 1)])))
2396 (vec_select:SF (match_dup 1) (parallel [(const_int 2)]))
2397 (vec_select:SF (match_dup 1) (parallel [(const_int 3)]))))
2401 (match_operand:V4SF 2 "vector_operand" "xBm,xm")
2402 (parallel [(const_int 0)]))
2403 (vec_select:SF (match_dup 2) (parallel [(const_int 1)])))
2405 (vec_select:SF (match_dup 2) (parallel [(const_int 2)]))
2406 (vec_select:SF (match_dup 2) (parallel [(const_int 3)]))))))]
2409 h<plusminus_mnemonic>ps\t{%2, %0|%0, %2}
2410 vh<plusminus_mnemonic>ps\t{%2, %1, %0|%0, %1, %2}"
2411 [(set_attr "isa" "noavx,avx")
2412 (set_attr "type" "sseadd")
2413 (set_attr "atom_unit" "complex")
2414 (set_attr "prefix" "orig,vex")
2415 (set_attr "prefix_rep" "1,*")
2416 (set_attr "mode" "V4SF")])
2418 (define_expand "reduc_plus_scal_v8df"
2419 [(match_operand:DF 0 "register_operand")
2420 (match_operand:V8DF 1 "register_operand")]
2423 rtx tmp = gen_reg_rtx (V8DFmode);
2424 ix86_expand_reduc (gen_addv8df3, tmp, operands[1]);
2425 emit_insn (gen_vec_extractv8dfdf (operands[0], tmp, const0_rtx));
2429 (define_expand "reduc_plus_scal_v4df"
2430 [(match_operand:DF 0 "register_operand")
2431 (match_operand:V4DF 1 "register_operand")]
2434 rtx tmp = gen_reg_rtx (V4DFmode);
2435 rtx tmp2 = gen_reg_rtx (V4DFmode);
2436 rtx vec_res = gen_reg_rtx (V4DFmode);
2437 emit_insn (gen_avx_haddv4df3 (tmp, operands[1], operands[1]));
2438 emit_insn (gen_avx_vperm2f128v4df3 (tmp2, tmp, tmp, GEN_INT (1)));
2439 emit_insn (gen_addv4df3 (vec_res, tmp, tmp2));
2440 emit_insn (gen_vec_extractv4dfdf (operands[0], vec_res, const0_rtx));
2444 (define_expand "reduc_plus_scal_v2df"
2445 [(match_operand:DF 0 "register_operand")
2446 (match_operand:V2DF 1 "register_operand")]
2449 rtx tmp = gen_reg_rtx (V2DFmode);
2450 emit_insn (gen_sse3_haddv2df3 (tmp, operands[1], operands[1]));
2451 emit_insn (gen_vec_extractv2dfdf (operands[0], tmp, const0_rtx));
2455 (define_expand "reduc_plus_scal_v16sf"
2456 [(match_operand:SF 0 "register_operand")
2457 (match_operand:V16SF 1 "register_operand")]
2460 rtx tmp = gen_reg_rtx (V16SFmode);
2461 ix86_expand_reduc (gen_addv16sf3, tmp, operands[1]);
2462 emit_insn (gen_vec_extractv16sfsf (operands[0], tmp, const0_rtx));
2466 (define_expand "reduc_plus_scal_v8sf"
2467 [(match_operand:SF 0 "register_operand")
2468 (match_operand:V8SF 1 "register_operand")]
2471 rtx tmp = gen_reg_rtx (V8SFmode);
2472 rtx tmp2 = gen_reg_rtx (V8SFmode);
2473 rtx vec_res = gen_reg_rtx (V8SFmode);
2474 emit_insn (gen_avx_haddv8sf3 (tmp, operands[1], operands[1]));
2475 emit_insn (gen_avx_haddv8sf3 (tmp2, tmp, tmp));
2476 emit_insn (gen_avx_vperm2f128v8sf3 (tmp, tmp2, tmp2, GEN_INT (1)));
2477 emit_insn (gen_addv8sf3 (vec_res, tmp, tmp2));
2478 emit_insn (gen_vec_extractv8sfsf (operands[0], vec_res, const0_rtx));
2482 (define_expand "reduc_plus_scal_v4sf"
2483 [(match_operand:SF 0 "register_operand")
2484 (match_operand:V4SF 1 "register_operand")]
2487 rtx vec_res = gen_reg_rtx (V4SFmode);
2490 rtx tmp = gen_reg_rtx (V4SFmode);
2491 emit_insn (gen_sse3_haddv4sf3 (tmp, operands[1], operands[1]));
2492 emit_insn (gen_sse3_haddv4sf3 (vec_res, tmp, tmp));
2495 ix86_expand_reduc (gen_addv4sf3, vec_res, operands[1]);
2496 emit_insn (gen_vec_extractv4sfsf (operands[0], vec_res, const0_rtx));
2500 ;; Modes handled by reduc_sm{in,ax}* patterns.
2501 (define_mode_iterator REDUC_SMINMAX_MODE
2502 [(V32QI "TARGET_AVX2") (V16HI "TARGET_AVX2")
2503 (V8SI "TARGET_AVX2") (V4DI "TARGET_AVX2")
2504 (V8SF "TARGET_AVX") (V4DF "TARGET_AVX")
2505 (V4SF "TARGET_SSE") (V64QI "TARGET_AVX512BW")
2506 (V32HI "TARGET_AVX512BW") (V16SI "TARGET_AVX512F")
2507 (V8DI "TARGET_AVX512F") (V16SF "TARGET_AVX512F")
2508 (V8DF "TARGET_AVX512F")])
2510 (define_expand "reduc_<code>_scal_<mode>"
2511 [(smaxmin:REDUC_SMINMAX_MODE
2512 (match_operand:<ssescalarmode> 0 "register_operand")
2513 (match_operand:REDUC_SMINMAX_MODE 1 "register_operand"))]
2516 rtx tmp = gen_reg_rtx (<MODE>mode);
2517 ix86_expand_reduc (gen_<code><mode>3, tmp, operands[1]);
2518 emit_insn (gen_vec_extract<mode><ssescalarmodelower> (operands[0], tmp,
2523 (define_expand "reduc_<code>_scal_<mode>"
2524 [(umaxmin:VI_AVX512BW
2525 (match_operand:<ssescalarmode> 0 "register_operand")
2526 (match_operand:VI_AVX512BW 1 "register_operand"))]
2529 rtx tmp = gen_reg_rtx (<MODE>mode);
2530 ix86_expand_reduc (gen_<code><mode>3, tmp, operands[1]);
2531 emit_insn (gen_vec_extract<mode><ssescalarmodelower> (operands[0], tmp,
2536 (define_expand "reduc_<code>_scal_<mode>"
2538 (match_operand:<ssescalarmode> 0 "register_operand")
2539 (match_operand:VI_256 1 "register_operand"))]
2542 rtx tmp = gen_reg_rtx (<MODE>mode);
2543 ix86_expand_reduc (gen_<code><mode>3, tmp, operands[1]);
2544 emit_insn (gen_vec_extract<mode><ssescalarmodelower> (operands[0], tmp,
2549 (define_expand "reduc_umin_scal_v8hi"
2551 (match_operand:HI 0 "register_operand")
2552 (match_operand:V8HI 1 "register_operand"))]
2555 rtx tmp = gen_reg_rtx (V8HImode);
2556 ix86_expand_reduc (gen_uminv8hi3, tmp, operands[1]);
2557 emit_insn (gen_vec_extractv8hihi (operands[0], tmp, const0_rtx));
2561 (define_insn "<mask_codefor>reducep<mode><mask_name>"
2562 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
2564 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "vm")
2565 (match_operand:SI 2 "const_0_to_255_operand")]
2568 "vreduce<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
2569 [(set_attr "type" "sse")
2570 (set_attr "prefix" "evex")
2571 (set_attr "mode" "<MODE>")])
2573 (define_insn "reduces<mode><mask_scalar_name>"
2574 [(set (match_operand:VF_128 0 "register_operand" "=v")
2577 [(match_operand:VF_128 1 "register_operand" "v")
2578 (match_operand:VF_128 2 "nonimmediate_operand" "vm")
2579 (match_operand:SI 3 "const_0_to_255_operand")]
2584 "vreduce<ssescalarmodesuffix>\t{%3, %2, %1, %0<mask_scalar_operand4>|%0<mask_scalar_operand4>, %1, %2, %3}"
2585 [(set_attr "type" "sse")
2586 (set_attr "prefix" "evex")
2587 (set_attr "mode" "<MODE>")])
2589 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2591 ;; Parallel floating point comparisons
2593 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2595 (define_insn "avx_cmp<mode>3"
2596 [(set (match_operand:VF_128_256 0 "register_operand" "=x")
2598 [(match_operand:VF_128_256 1 "register_operand" "x")
2599 (match_operand:VF_128_256 2 "nonimmediate_operand" "xm")
2600 (match_operand:SI 3 "const_0_to_31_operand" "n")]
2603 "vcmp<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
2604 [(set_attr "type" "ssecmp")
2605 (set_attr "length_immediate" "1")
2606 (set_attr "prefix" "vex")
2607 (set_attr "mode" "<MODE>")])
2609 (define_insn "avx_vmcmp<mode>3"
2610 [(set (match_operand:VF_128 0 "register_operand" "=x")
2613 [(match_operand:VF_128 1 "register_operand" "x")
2614 (match_operand:VF_128 2 "nonimmediate_operand" "xm")
2615 (match_operand:SI 3 "const_0_to_31_operand" "n")]
2620 "vcmp<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %3}"
2621 [(set_attr "type" "ssecmp")
2622 (set_attr "length_immediate" "1")
2623 (set_attr "prefix" "vex")
2624 (set_attr "mode" "<ssescalarmode>")])
2626 (define_insn "*<sse>_maskcmp<mode>3_comm"
2627 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x")
2628 (match_operator:VF_128_256 3 "sse_comparison_operator"
2629 [(match_operand:VF_128_256 1 "register_operand" "%0,x")
2630 (match_operand:VF_128_256 2 "vector_operand" "xBm,xm")]))]
2632 && GET_RTX_CLASS (GET_CODE (operands[3])) == RTX_COMM_COMPARE"
2634 cmp%D3<ssemodesuffix>\t{%2, %0|%0, %2}
2635 vcmp%D3<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
2636 [(set_attr "isa" "noavx,avx")
2637 (set_attr "type" "ssecmp")
2638 (set_attr "length_immediate" "1")
2639 (set_attr "prefix" "orig,vex")
2640 (set_attr "mode" "<MODE>")])
2642 (define_insn "<sse>_maskcmp<mode>3"
2643 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x")
2644 (match_operator:VF_128_256 3 "sse_comparison_operator"
2645 [(match_operand:VF_128_256 1 "register_operand" "0,x")
2646 (match_operand:VF_128_256 2 "vector_operand" "xBm,xm")]))]
2649 cmp%D3<ssemodesuffix>\t{%2, %0|%0, %2}
2650 vcmp%D3<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
2651 [(set_attr "isa" "noavx,avx")
2652 (set_attr "type" "ssecmp")
2653 (set_attr "length_immediate" "1")
2654 (set_attr "prefix" "orig,vex")
2655 (set_attr "mode" "<MODE>")])
2657 (define_insn "<sse>_vmmaskcmp<mode>3"
2658 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
2660 (match_operator:VF_128 3 "sse_comparison_operator"
2661 [(match_operand:VF_128 1 "register_operand" "0,x")
2662 (match_operand:VF_128 2 "vector_operand" "xBm,xm")])
2667 cmp%D3<ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
2668 vcmp%D3<ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %<iptr>2}"
2669 [(set_attr "isa" "noavx,avx")
2670 (set_attr "type" "ssecmp")
2671 (set_attr "length_immediate" "1,*")
2672 (set_attr "prefix" "orig,vex")
2673 (set_attr "mode" "<ssescalarmode>")])
2675 (define_mode_attr cmp_imm_predicate
2676 [(V16SF "const_0_to_31_operand") (V8DF "const_0_to_31_operand")
2677 (V16SI "const_0_to_7_operand") (V8DI "const_0_to_7_operand")
2678 (V8SF "const_0_to_31_operand") (V4DF "const_0_to_31_operand")
2679 (V8SI "const_0_to_7_operand") (V4DI "const_0_to_7_operand")
2680 (V4SF "const_0_to_31_operand") (V2DF "const_0_to_31_operand")
2681 (V4SI "const_0_to_7_operand") (V2DI "const_0_to_7_operand")
2682 (V32HI "const_0_to_7_operand") (V64QI "const_0_to_7_operand")
2683 (V16HI "const_0_to_7_operand") (V32QI "const_0_to_7_operand")
2684 (V8HI "const_0_to_7_operand") (V16QI "const_0_to_7_operand")])
2686 (define_insn "<avx512>_cmp<mode>3<mask_scalar_merge_name><round_saeonly_name>"
2687 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2688 (unspec:<avx512fmaskmode>
2689 [(match_operand:V48_AVX512VL 1 "register_operand" "v")
2690 (match_operand:V48_AVX512VL 2 "nonimmediate_operand" "<round_saeonly_constraint>")
2691 (match_operand:SI 3 "<cmp_imm_predicate>" "n")]
2693 "TARGET_AVX512F && <round_saeonly_mode512bit_condition>"
2694 "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}"
2695 [(set_attr "type" "ssecmp")
2696 (set_attr "length_immediate" "1")
2697 (set_attr "prefix" "evex")
2698 (set_attr "mode" "<sseinsnmode>")])
2700 (define_insn "<avx512>_cmp<mode>3<mask_scalar_merge_name>"
2701 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2702 (unspec:<avx512fmaskmode>
2703 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
2704 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")
2705 (match_operand:SI 3 "<cmp_imm_predicate>" "n")]
2708 "vpcmp<ssemodesuffix>\t{%3, %2, %1, %0<mask_scalar_merge_operand4>|%0<mask_scalar_merge_operand4>, %1, %2, %3}"
2709 [(set_attr "type" "ssecmp")
2710 (set_attr "length_immediate" "1")
2711 (set_attr "prefix" "evex")
2712 (set_attr "mode" "<sseinsnmode>")])
2714 (define_insn "<avx512>_ucmp<mode>3<mask_scalar_merge_name>"
2715 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2716 (unspec:<avx512fmaskmode>
2717 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
2718 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")
2719 (match_operand:SI 3 "const_0_to_7_operand" "n")]
2720 UNSPEC_UNSIGNED_PCMP))]
2722 "vpcmpu<ssemodesuffix>\t{%3, %2, %1, %0<mask_scalar_merge_operand4>|%0<mask_scalar_merge_operand4>, %1, %2, %3}"
2723 [(set_attr "type" "ssecmp")
2724 (set_attr "length_immediate" "1")
2725 (set_attr "prefix" "evex")
2726 (set_attr "mode" "<sseinsnmode>")])
2728 (define_insn "<avx512>_ucmp<mode>3<mask_scalar_merge_name>"
2729 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2730 (unspec:<avx512fmaskmode>
2731 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
2732 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")
2733 (match_operand:SI 3 "const_0_to_7_operand" "n")]
2734 UNSPEC_UNSIGNED_PCMP))]
2736 "vpcmpu<ssemodesuffix>\t{%3, %2, %1, %0<mask_scalar_merge_operand4>|%0<mask_scalar_merge_operand4>, %1, %2, %3}"
2737 [(set_attr "type" "ssecmp")
2738 (set_attr "length_immediate" "1")
2739 (set_attr "prefix" "evex")
2740 (set_attr "mode" "<sseinsnmode>")])
2742 (define_insn "avx512f_vmcmp<mode>3<round_saeonly_name>"
2743 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2744 (and:<avx512fmaskmode>
2745 (unspec:<avx512fmaskmode>
2746 [(match_operand:VF_128 1 "register_operand" "v")
2747 (match_operand:VF_128 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
2748 (match_operand:SI 3 "const_0_to_31_operand" "n")]
2752 "vcmp<ssescalarmodesuffix>\t{%3, <round_saeonly_op4>%2, %1, %0|%0, %1, %2<round_saeonly_op4>, %3}"
2753 [(set_attr "type" "ssecmp")
2754 (set_attr "length_immediate" "1")
2755 (set_attr "prefix" "evex")
2756 (set_attr "mode" "<ssescalarmode>")])
2758 (define_insn "avx512f_vmcmp<mode>3_mask<round_saeonly_name>"
2759 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2760 (and:<avx512fmaskmode>
2761 (unspec:<avx512fmaskmode>
2762 [(match_operand:VF_128 1 "register_operand" "v")
2763 (match_operand:VF_128 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
2764 (match_operand:SI 3 "const_0_to_31_operand" "n")]
2766 (and:<avx512fmaskmode>
2767 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")
2770 "vcmp<ssescalarmodesuffix>\t{%3, <round_saeonly_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_saeonly_op5>, %3}"
2771 [(set_attr "type" "ssecmp")
2772 (set_attr "length_immediate" "1")
2773 (set_attr "prefix" "evex")
2774 (set_attr "mode" "<ssescalarmode>")])
2776 (define_insn "avx512f_maskcmp<mode>3"
2777 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2778 (match_operator:<avx512fmaskmode> 3 "sse_comparison_operator"
2779 [(match_operand:VF 1 "register_operand" "v")
2780 (match_operand:VF 2 "nonimmediate_operand" "vm")]))]
2782 "vcmp%D3<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
2783 [(set_attr "type" "ssecmp")
2784 (set_attr "length_immediate" "1")
2785 (set_attr "prefix" "evex")
2786 (set_attr "mode" "<sseinsnmode>")])
2788 (define_insn "<sse>_<unord>comi<round_saeonly_name>"
2789 [(set (reg:CCFP FLAGS_REG)
2792 (match_operand:<ssevecmode> 0 "register_operand" "v")
2793 (parallel [(const_int 0)]))
2795 (match_operand:<ssevecmode> 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
2796 (parallel [(const_int 0)]))))]
2797 "SSE_FLOAT_MODE_P (<MODE>mode)"
2798 "%v<unord>comi<ssemodesuffix>\t{<round_saeonly_op2>%1, %0|%0, %<iptr>1<round_saeonly_op2>}"
2799 [(set_attr "type" "ssecomi")
2800 (set_attr "prefix" "maybe_vex")
2801 (set_attr "prefix_rep" "0")
2802 (set (attr "prefix_data16")
2803 (if_then_else (eq_attr "mode" "DF")
2805 (const_string "0")))
2806 (set_attr "mode" "<MODE>")])
2808 (define_expand "vec_cmp<mode><avx512fmaskmodelower>"
2809 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
2810 (match_operator:<avx512fmaskmode> 1 ""
2811 [(match_operand:V48_AVX512VL 2 "register_operand")
2812 (match_operand:V48_AVX512VL 3 "nonimmediate_operand")]))]
2815 bool ok = ix86_expand_mask_vec_cmp (operands);
2820 (define_expand "vec_cmp<mode><avx512fmaskmodelower>"
2821 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
2822 (match_operator:<avx512fmaskmode> 1 ""
2823 [(match_operand:VI12_AVX512VL 2 "register_operand")
2824 (match_operand:VI12_AVX512VL 3 "nonimmediate_operand")]))]
2827 bool ok = ix86_expand_mask_vec_cmp (operands);
2832 (define_expand "vec_cmp<mode><sseintvecmodelower>"
2833 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2834 (match_operator:<sseintvecmode> 1 ""
2835 [(match_operand:VI_256 2 "register_operand")
2836 (match_operand:VI_256 3 "nonimmediate_operand")]))]
2839 bool ok = ix86_expand_int_vec_cmp (operands);
2844 (define_expand "vec_cmp<mode><sseintvecmodelower>"
2845 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2846 (match_operator:<sseintvecmode> 1 ""
2847 [(match_operand:VI124_128 2 "register_operand")
2848 (match_operand:VI124_128 3 "vector_operand")]))]
2851 bool ok = ix86_expand_int_vec_cmp (operands);
2856 (define_expand "vec_cmpv2div2di"
2857 [(set (match_operand:V2DI 0 "register_operand")
2858 (match_operator:V2DI 1 ""
2859 [(match_operand:V2DI 2 "register_operand")
2860 (match_operand:V2DI 3 "vector_operand")]))]
2863 bool ok = ix86_expand_int_vec_cmp (operands);
2868 (define_expand "vec_cmp<mode><sseintvecmodelower>"
2869 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2870 (match_operator:<sseintvecmode> 1 ""
2871 [(match_operand:VF_256 2 "register_operand")
2872 (match_operand:VF_256 3 "nonimmediate_operand")]))]
2875 bool ok = ix86_expand_fp_vec_cmp (operands);
2880 (define_expand "vec_cmp<mode><sseintvecmodelower>"
2881 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2882 (match_operator:<sseintvecmode> 1 ""
2883 [(match_operand:VF_128 2 "register_operand")
2884 (match_operand:VF_128 3 "vector_operand")]))]
2887 bool ok = ix86_expand_fp_vec_cmp (operands);
2892 (define_expand "vec_cmpu<mode><avx512fmaskmodelower>"
2893 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
2894 (match_operator:<avx512fmaskmode> 1 ""
2895 [(match_operand:VI48_AVX512VL 2 "register_operand")
2896 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand")]))]
2899 bool ok = ix86_expand_mask_vec_cmp (operands);
2904 (define_expand "vec_cmpu<mode><avx512fmaskmodelower>"
2905 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
2906 (match_operator:<avx512fmaskmode> 1 ""
2907 [(match_operand:VI12_AVX512VL 2 "register_operand")
2908 (match_operand:VI12_AVX512VL 3 "nonimmediate_operand")]))]
2911 bool ok = ix86_expand_mask_vec_cmp (operands);
2916 (define_expand "vec_cmpu<mode><sseintvecmodelower>"
2917 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2918 (match_operator:<sseintvecmode> 1 ""
2919 [(match_operand:VI_256 2 "register_operand")
2920 (match_operand:VI_256 3 "nonimmediate_operand")]))]
2923 bool ok = ix86_expand_int_vec_cmp (operands);
2928 (define_expand "vec_cmpu<mode><sseintvecmodelower>"
2929 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2930 (match_operator:<sseintvecmode> 1 ""
2931 [(match_operand:VI124_128 2 "register_operand")
2932 (match_operand:VI124_128 3 "vector_operand")]))]
2935 bool ok = ix86_expand_int_vec_cmp (operands);
2940 (define_expand "vec_cmpuv2div2di"
2941 [(set (match_operand:V2DI 0 "register_operand")
2942 (match_operator:V2DI 1 ""
2943 [(match_operand:V2DI 2 "register_operand")
2944 (match_operand:V2DI 3 "vector_operand")]))]
2947 bool ok = ix86_expand_int_vec_cmp (operands);
2952 (define_expand "vec_cmpeqv2div2di"
2953 [(set (match_operand:V2DI 0 "register_operand")
2954 (match_operator:V2DI 1 ""
2955 [(match_operand:V2DI 2 "register_operand")
2956 (match_operand:V2DI 3 "vector_operand")]))]
2959 bool ok = ix86_expand_int_vec_cmp (operands);
2964 (define_expand "vcond<V_512:mode><VF_512:mode>"
2965 [(set (match_operand:V_512 0 "register_operand")
2967 (match_operator 3 ""
2968 [(match_operand:VF_512 4 "nonimmediate_operand")
2969 (match_operand:VF_512 5 "nonimmediate_operand")])
2970 (match_operand:V_512 1 "general_operand")
2971 (match_operand:V_512 2 "general_operand")))]
2973 && (GET_MODE_NUNITS (<V_512:MODE>mode)
2974 == GET_MODE_NUNITS (<VF_512:MODE>mode))"
2976 bool ok = ix86_expand_fp_vcond (operands);
2981 (define_expand "vcond<V_256:mode><VF_256:mode>"
2982 [(set (match_operand:V_256 0 "register_operand")
2984 (match_operator 3 ""
2985 [(match_operand:VF_256 4 "nonimmediate_operand")
2986 (match_operand:VF_256 5 "nonimmediate_operand")])
2987 (match_operand:V_256 1 "general_operand")
2988 (match_operand:V_256 2 "general_operand")))]
2990 && (GET_MODE_NUNITS (<V_256:MODE>mode)
2991 == GET_MODE_NUNITS (<VF_256:MODE>mode))"
2993 bool ok = ix86_expand_fp_vcond (operands);
2998 (define_expand "vcond<V_128:mode><VF_128:mode>"
2999 [(set (match_operand:V_128 0 "register_operand")
3001 (match_operator 3 ""
3002 [(match_operand:VF_128 4 "vector_operand")
3003 (match_operand:VF_128 5 "vector_operand")])
3004 (match_operand:V_128 1 "general_operand")
3005 (match_operand:V_128 2 "general_operand")))]
3007 && (GET_MODE_NUNITS (<V_128:MODE>mode)
3008 == GET_MODE_NUNITS (<VF_128:MODE>mode))"
3010 bool ok = ix86_expand_fp_vcond (operands);
3015 (define_expand "vcond_mask_<mode><avx512fmaskmodelower>"
3016 [(set (match_operand:V48_AVX512VL 0 "register_operand")
3017 (vec_merge:V48_AVX512VL
3018 (match_operand:V48_AVX512VL 1 "nonimmediate_operand")
3019 (match_operand:V48_AVX512VL 2 "vector_move_operand")
3020 (match_operand:<avx512fmaskmode> 3 "register_operand")))]
3023 (define_expand "vcond_mask_<mode><avx512fmaskmodelower>"
3024 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
3025 (vec_merge:VI12_AVX512VL
3026 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand")
3027 (match_operand:VI12_AVX512VL 2 "vector_move_operand")
3028 (match_operand:<avx512fmaskmode> 3 "register_operand")))]
3031 (define_expand "vcond_mask_<mode><sseintvecmodelower>"
3032 [(set (match_operand:VI_256 0 "register_operand")
3034 (match_operand:VI_256 1 "nonimmediate_operand")
3035 (match_operand:VI_256 2 "vector_move_operand")
3036 (match_operand:<sseintvecmode> 3 "register_operand")))]
3039 ix86_expand_sse_movcc (operands[0], operands[3],
3040 operands[1], operands[2]);
3044 (define_expand "vcond_mask_<mode><sseintvecmodelower>"
3045 [(set (match_operand:VI124_128 0 "register_operand")
3046 (vec_merge:VI124_128
3047 (match_operand:VI124_128 1 "vector_operand")
3048 (match_operand:VI124_128 2 "vector_move_operand")
3049 (match_operand:<sseintvecmode> 3 "register_operand")))]
3052 ix86_expand_sse_movcc (operands[0], operands[3],
3053 operands[1], operands[2]);
3057 (define_expand "vcond_mask_v2div2di"
3058 [(set (match_operand:V2DI 0 "register_operand")
3060 (match_operand:V2DI 1 "vector_operand")
3061 (match_operand:V2DI 2 "vector_move_operand")
3062 (match_operand:V2DI 3 "register_operand")))]
3065 ix86_expand_sse_movcc (operands[0], operands[3],
3066 operands[1], operands[2]);
3070 (define_expand "vcond_mask_<mode><sseintvecmodelower>"
3071 [(set (match_operand:VF_256 0 "register_operand")
3073 (match_operand:VF_256 1 "nonimmediate_operand")
3074 (match_operand:VF_256 2 "vector_move_operand")
3075 (match_operand:<sseintvecmode> 3 "register_operand")))]
3078 ix86_expand_sse_movcc (operands[0], operands[3],
3079 operands[1], operands[2]);
3083 (define_expand "vcond_mask_<mode><sseintvecmodelower>"
3084 [(set (match_operand:VF_128 0 "register_operand")
3086 (match_operand:VF_128 1 "vector_operand")
3087 (match_operand:VF_128 2 "vector_move_operand")
3088 (match_operand:<sseintvecmode> 3 "register_operand")))]
3091 ix86_expand_sse_movcc (operands[0], operands[3],
3092 operands[1], operands[2]);
3096 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3098 ;; Parallel floating point logical operations
3100 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3102 (define_insn "<sse>_andnot<mode>3<mask_name>"
3103 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x,v,v")
3106 (match_operand:VF_128_256 1 "register_operand" "0,x,v,v"))
3107 (match_operand:VF_128_256 2 "vector_operand" "xBm,xm,vm,vm")))]
3108 "TARGET_SSE && <mask_avx512vl_condition>"
3110 static char buf[128];
3114 switch (which_alternative)
3117 ops = "andn%s\t{%%2, %%0|%%0, %%2}";
3122 ops = "vandn%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
3128 switch (get_attr_mode (insn))
3136 /* There is no vandnp[sd] in avx512f. Use vpandn[qd]. */
3137 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
3138 ops = "vpandn%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
3141 suffix = "<ssemodesuffix>";
3144 snprintf (buf, sizeof (buf), ops, suffix);
3147 [(set_attr "isa" "noavx,avx,avx512dq,avx512f")
3148 (set_attr "type" "sselog")
3149 (set_attr "prefix" "orig,maybe_vex,evex,evex")
3151 (cond [(and (match_test "<mask_applied>")
3152 (and (eq_attr "alternative" "1")
3153 (match_test "!TARGET_AVX512DQ")))
3154 (const_string "<sseintvecmode2>")
3155 (eq_attr "alternative" "3")
3156 (const_string "<sseintvecmode2>")
3157 (and (match_test "<MODE_SIZE> == 16")
3158 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
3159 (const_string "<ssePSmode>")
3160 (match_test "TARGET_AVX")
3161 (const_string "<MODE>")
3162 (match_test "optimize_function_for_size_p (cfun)")
3163 (const_string "V4SF")
3165 (const_string "<MODE>")))])
3168 (define_insn "<sse>_andnot<mode>3<mask_name>"
3169 [(set (match_operand:VF_512 0 "register_operand" "=v")
3172 (match_operand:VF_512 1 "register_operand" "v"))
3173 (match_operand:VF_512 2 "nonimmediate_operand" "vm")))]
3176 static char buf[128];
3180 suffix = "<ssemodesuffix>";
3183 /* There is no vandnp[sd] in avx512f. Use vpandn[qd]. */
3184 if (!TARGET_AVX512DQ)
3186 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
3190 snprintf (buf, sizeof (buf),
3191 "v%sandn%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}",
3195 [(set_attr "type" "sselog")
3196 (set_attr "prefix" "evex")
3198 (if_then_else (match_test "TARGET_AVX512DQ")
3199 (const_string "<sseinsnmode>")
3200 (const_string "XI")))])
3202 (define_expand "<code><mode>3<mask_name>"
3203 [(set (match_operand:VF_128_256 0 "register_operand")
3204 (any_logic:VF_128_256
3205 (match_operand:VF_128_256 1 "vector_operand")
3206 (match_operand:VF_128_256 2 "vector_operand")))]
3207 "TARGET_SSE && <mask_avx512vl_condition>"
3208 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
3210 (define_expand "<code><mode>3<mask_name>"
3211 [(set (match_operand:VF_512 0 "register_operand")
3213 (match_operand:VF_512 1 "nonimmediate_operand")
3214 (match_operand:VF_512 2 "nonimmediate_operand")))]
3216 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
3218 (define_insn "*<code><mode>3<mask_name>"
3219 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x,v,v")
3220 (any_logic:VF_128_256
3221 (match_operand:VF_128_256 1 "vector_operand" "%0,x,v,v")
3222 (match_operand:VF_128_256 2 "vector_operand" "xBm,xm,vm,vm")))]
3223 "TARGET_SSE && <mask_avx512vl_condition>
3224 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
3226 static char buf[128];
3230 switch (which_alternative)
3233 ops = "<logic>%s\t{%%2, %%0|%%0, %%2}";
3238 ops = "v<logic>%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
3244 switch (get_attr_mode (insn))
3252 /* There is no v<logic>p[sd] in avx512f. Use vp<logic>[qd]. */
3253 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
3254 ops = "vp<logic>%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
3257 suffix = "<ssemodesuffix>";
3260 snprintf (buf, sizeof (buf), ops, suffix);
3263 [(set_attr "isa" "noavx,avx,avx512dq,avx512f")
3264 (set_attr "type" "sselog")
3265 (set_attr "prefix" "orig,maybe_evex,evex,evex")
3267 (cond [(and (match_test "<mask_applied>")
3268 (and (eq_attr "alternative" "1")
3269 (match_test "!TARGET_AVX512DQ")))
3270 (const_string "<sseintvecmode2>")
3271 (eq_attr "alternative" "3")
3272 (const_string "<sseintvecmode2>")
3273 (and (match_test "<MODE_SIZE> == 16")
3274 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
3275 (const_string "<ssePSmode>")
3276 (match_test "TARGET_AVX")
3277 (const_string "<MODE>")
3278 (match_test "optimize_function_for_size_p (cfun)")
3279 (const_string "V4SF")
3281 (const_string "<MODE>")))])
3283 (define_insn "*<code><mode>3<mask_name>"
3284 [(set (match_operand:VF_512 0 "register_operand" "=v")
3286 (match_operand:VF_512 1 "nonimmediate_operand" "%v")
3287 (match_operand:VF_512 2 "nonimmediate_operand" "vm")))]
3288 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
3290 static char buf[128];
3294 suffix = "<ssemodesuffix>";
3297 /* There is no v<logic>p[sd] in avx512f. Use vp<logic>[dq]. */
3298 if (!TARGET_AVX512DQ)
3300 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
3304 snprintf (buf, sizeof (buf),
3305 "v%s<logic>%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}",
3309 [(set_attr "type" "sselog")
3310 (set_attr "prefix" "evex")
3312 (if_then_else (match_test "TARGET_AVX512DQ")
3313 (const_string "<sseinsnmode>")
3314 (const_string "XI")))])
3316 (define_expand "copysign<mode>3"
3319 (not:VF (match_dup 3))
3320 (match_operand:VF 1 "vector_operand")))
3322 (and:VF (match_dup 3)
3323 (match_operand:VF 2 "vector_operand")))
3324 (set (match_operand:VF 0 "register_operand")
3325 (ior:VF (match_dup 4) (match_dup 5)))]
3328 operands[3] = ix86_build_signbit_mask (<MODE>mode, 1, 0);
3330 operands[4] = gen_reg_rtx (<MODE>mode);
3331 operands[5] = gen_reg_rtx (<MODE>mode);
3334 ;; Also define scalar versions. These are used for abs, neg, and
3335 ;; conditional move. Using subregs into vector modes causes register
3336 ;; allocation lossage. These patterns do not allow memory operands
3337 ;; because the native instructions read the full 128-bits.
3339 (define_insn "*andnot<mode>3"
3340 [(set (match_operand:MODEF 0 "register_operand" "=x,x,v,v")
3343 (match_operand:MODEF 1 "register_operand" "0,x,v,v"))
3344 (match_operand:MODEF 2 "register_operand" "x,x,v,v")))]
3345 "SSE_FLOAT_MODE_P (<MODE>mode)"
3347 static char buf[128];
3350 = (get_attr_mode (insn) == MODE_V4SF) ? "ps" : "<ssevecmodesuffix>";
3352 switch (which_alternative)
3355 ops = "andn%s\t{%%2, %%0|%%0, %%2}";
3358 ops = "vandn%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3361 if (TARGET_AVX512DQ)
3362 ops = "vandn%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3365 suffix = <MODE>mode == DFmode ? "q" : "d";
3366 ops = "vpandn%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3370 if (TARGET_AVX512DQ)
3371 ops = "vandn%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3374 suffix = <MODE>mode == DFmode ? "q" : "d";
3375 ops = "vpandn%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3382 snprintf (buf, sizeof (buf), ops, suffix);
3385 [(set_attr "isa" "noavx,avx,avx512vl,avx512f")
3386 (set_attr "type" "sselog")
3387 (set_attr "prefix" "orig,vex,evex,evex")
3389 (cond [(eq_attr "alternative" "2")
3390 (if_then_else (match_test "TARGET_AVX512DQ")
3391 (const_string "<ssevecmode>")
3392 (const_string "TI"))
3393 (eq_attr "alternative" "3")
3394 (if_then_else (match_test "TARGET_AVX512DQ")
3395 (const_string "<avx512fvecmode>")
3396 (const_string "XI"))
3397 (and (match_test "<MODE_SIZE> == 16")
3398 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
3399 (const_string "V4SF")
3400 (match_test "TARGET_AVX")
3401 (const_string "<ssevecmode>")
3402 (match_test "optimize_function_for_size_p (cfun)")
3403 (const_string "V4SF")
3405 (const_string "<ssevecmode>")))])
3407 (define_insn "*andnottf3"
3408 [(set (match_operand:TF 0 "register_operand" "=x,x,v,v")
3410 (not:TF (match_operand:TF 1 "register_operand" "0,x,v,v"))
3411 (match_operand:TF 2 "vector_operand" "xBm,xm,vm,v")))]
3414 static char buf[128];
3417 = (which_alternative >= 2 ? "pandnq"
3418 : get_attr_mode (insn) == MODE_V4SF ? "andnps" : "pandn");
3420 switch (which_alternative)
3423 ops = "%s\t{%%2, %%0|%%0, %%2}";
3427 ops = "v%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3430 ops = "v%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3436 snprintf (buf, sizeof (buf), ops, tmp);
3439 [(set_attr "isa" "noavx,avx,avx512vl,avx512f")
3440 (set_attr "type" "sselog")
3441 (set (attr "prefix_data16")
3443 (and (eq_attr "alternative" "0")
3444 (eq_attr "mode" "TI"))
3446 (const_string "*")))
3447 (set_attr "prefix" "orig,vex,evex,evex")
3449 (cond [(eq_attr "alternative" "2")
3451 (eq_attr "alternative" "3")
3453 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
3454 (const_string "V4SF")
3455 (match_test "TARGET_AVX")
3457 (ior (not (match_test "TARGET_SSE2"))
3458 (match_test "optimize_function_for_size_p (cfun)"))
3459 (const_string "V4SF")
3461 (const_string "TI")))])
3463 (define_insn "*<code><mode>3"
3464 [(set (match_operand:MODEF 0 "register_operand" "=x,x,v,v")
3466 (match_operand:MODEF 1 "register_operand" "%0,x,v,v")
3467 (match_operand:MODEF 2 "register_operand" "x,x,v,v")))]
3468 "SSE_FLOAT_MODE_P (<MODE>mode)"
3470 static char buf[128];
3473 = (get_attr_mode (insn) == MODE_V4SF) ? "ps" : "<ssevecmodesuffix>";
3475 switch (which_alternative)
3478 ops = "<logic>%s\t{%%2, %%0|%%0, %%2}";
3481 if (!TARGET_AVX512DQ)
3483 suffix = <MODE>mode == DFmode ? "q" : "d";
3484 ops = "vp<logic>%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3489 ops = "v<logic>%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3492 if (TARGET_AVX512DQ)
3493 ops = "v<logic>%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3496 suffix = <MODE>mode == DFmode ? "q" : "d";
3497 ops = "vp<logic>%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3504 snprintf (buf, sizeof (buf), ops, suffix);
3507 [(set_attr "isa" "noavx,avx,avx512vl,avx512f")
3508 (set_attr "type" "sselog")
3509 (set_attr "prefix" "orig,vex,evex,evex")
3511 (cond [(eq_attr "alternative" "2")
3512 (if_then_else (match_test "TARGET_AVX512DQ")
3513 (const_string "<ssevecmode>")
3514 (const_string "TI"))
3515 (eq_attr "alternative" "3")
3516 (if_then_else (match_test "TARGET_AVX512DQ")
3517 (const_string "<avx512fvecmode>")
3518 (const_string "XI"))
3519 (and (match_test "<MODE_SIZE> == 16")
3520 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
3521 (const_string "V4SF")
3522 (match_test "TARGET_AVX")
3523 (const_string "<ssevecmode>")
3524 (match_test "optimize_function_for_size_p (cfun)")
3525 (const_string "V4SF")
3527 (const_string "<ssevecmode>")))])
3529 (define_expand "<code>tf3"
3530 [(set (match_operand:TF 0 "register_operand")
3532 (match_operand:TF 1 "vector_operand")
3533 (match_operand:TF 2 "vector_operand")))]
3535 "ix86_fixup_binary_operands_no_copy (<CODE>, TFmode, operands);")
3537 (define_insn "*<code>tf3"
3538 [(set (match_operand:TF 0 "register_operand" "=x,x,v,v")
3540 (match_operand:TF 1 "vector_operand" "%0,x,v,v")
3541 (match_operand:TF 2 "vector_operand" "xBm,xm,vm,v")))]
3542 "TARGET_SSE && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
3544 static char buf[128];
3547 = (which_alternative >= 2 ? "p<logic>q"
3548 : get_attr_mode (insn) == MODE_V4SF ? "<logic>ps" : "p<logic>");
3550 switch (which_alternative)
3553 ops = "%s\t{%%2, %%0|%%0, %%2}";
3557 ops = "v%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3560 ops = "v%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3566 snprintf (buf, sizeof (buf), ops, tmp);
3569 [(set_attr "isa" "noavx,avx,avx512vl,avx512f")
3570 (set_attr "type" "sselog")
3571 (set (attr "prefix_data16")
3573 (and (eq_attr "alternative" "0")
3574 (eq_attr "mode" "TI"))
3576 (const_string "*")))
3577 (set_attr "prefix" "orig,vex,evex,evex")
3579 (cond [(eq_attr "alternative" "2")
3581 (eq_attr "alternative" "3")
3583 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
3584 (const_string "V4SF")
3585 (match_test "TARGET_AVX")
3587 (ior (not (match_test "TARGET_SSE2"))
3588 (match_test "optimize_function_for_size_p (cfun)"))
3589 (const_string "V4SF")
3591 (const_string "TI")))])
3593 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3595 ;; FMA floating point multiply/accumulate instructions. These include
3596 ;; scalar versions of the instructions as well as vector versions.
3598 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3600 ;; The standard names for scalar FMA are only available with SSE math enabled.
3601 ;; CPUID bit AVX512F enables evex encoded scalar and 512-bit fma. It doesn't
3602 ;; care about FMA bit, so we enable fma for TARGET_AVX512F even when TARGET_FMA
3603 ;; and TARGET_FMA4 are both false.
3604 ;; TODO: In theory AVX512F does not automatically imply FMA, and without FMA
3605 ;; one must force the EVEX encoding of the fma insns. Ideally we'd improve
3606 ;; GAS to allow proper prefix selection. However, for the moment all hardware
3607 ;; that supports AVX512F also supports FMA so we can ignore this for now.
3608 (define_mode_iterator FMAMODEM
3609 [(SF "TARGET_SSE_MATH && (TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F)")
3610 (DF "TARGET_SSE_MATH && (TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F)")
3611 (V4SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3612 (V2DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3613 (V8SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3614 (V4DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3615 (V16SF "TARGET_AVX512F")
3616 (V8DF "TARGET_AVX512F")])
3618 (define_expand "fma<mode>4"
3619 [(set (match_operand:FMAMODEM 0 "register_operand")
3621 (match_operand:FMAMODEM 1 "nonimmediate_operand")
3622 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3623 (match_operand:FMAMODEM 3 "nonimmediate_operand")))])
3625 (define_expand "fms<mode>4"
3626 [(set (match_operand:FMAMODEM 0 "register_operand")
3628 (match_operand:FMAMODEM 1 "nonimmediate_operand")
3629 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3630 (neg:FMAMODEM (match_operand:FMAMODEM 3 "nonimmediate_operand"))))])
3632 (define_expand "fnma<mode>4"
3633 [(set (match_operand:FMAMODEM 0 "register_operand")
3635 (neg:FMAMODEM (match_operand:FMAMODEM 1 "nonimmediate_operand"))
3636 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3637 (match_operand:FMAMODEM 3 "nonimmediate_operand")))])
3639 (define_expand "fnms<mode>4"
3640 [(set (match_operand:FMAMODEM 0 "register_operand")
3642 (neg:FMAMODEM (match_operand:FMAMODEM 1 "nonimmediate_operand"))
3643 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3644 (neg:FMAMODEM (match_operand:FMAMODEM 3 "nonimmediate_operand"))))])
3646 ;; The builtins for intrinsics are not constrained by SSE math enabled.
3647 (define_mode_iterator FMAMODE_AVX512
3648 [(SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F")
3649 (DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F")
3650 (V4SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3651 (V2DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3652 (V8SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3653 (V4DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3654 (V16SF "TARGET_AVX512F")
3655 (V8DF "TARGET_AVX512F")])
3657 (define_mode_iterator FMAMODE
3658 [SF DF V4SF V2DF V8SF V4DF])
3660 (define_expand "fma4i_fmadd_<mode>"
3661 [(set (match_operand:FMAMODE_AVX512 0 "register_operand")
3663 (match_operand:FMAMODE_AVX512 1 "nonimmediate_operand")
3664 (match_operand:FMAMODE_AVX512 2 "nonimmediate_operand")
3665 (match_operand:FMAMODE_AVX512 3 "nonimmediate_operand")))])
3667 (define_expand "<avx512>_fmadd_<mode>_maskz<round_expand_name>"
3668 [(match_operand:VF_AVX512VL 0 "register_operand")
3669 (match_operand:VF_AVX512VL 1 "<round_expand_nimm_predicate>")
3670 (match_operand:VF_AVX512VL 2 "<round_expand_nimm_predicate>")
3671 (match_operand:VF_AVX512VL 3 "<round_expand_nimm_predicate>")
3672 (match_operand:<avx512fmaskmode> 4 "register_operand")]
3673 "TARGET_AVX512F && <round_mode512bit_condition>"
3675 emit_insn (gen_fma_fmadd_<mode>_maskz_1<round_expand_name> (
3676 operands[0], operands[1], operands[2], operands[3],
3677 CONST0_RTX (<MODE>mode), operands[4]<round_expand_operand>));
3681 (define_insn "*fma_fmadd_<mode>"
3682 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
3684 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x")
3685 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
3686 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x")))]
3687 "TARGET_FMA || TARGET_FMA4"
3689 vfmadd132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
3690 vfmadd213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
3691 vfmadd231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
3692 vfmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3693 vfmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3694 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3695 (set_attr "type" "ssemuladd")
3696 (set_attr "mode" "<MODE>")])
3698 ;; Suppose AVX-512F as baseline
3699 (define_mode_iterator VF_SF_AVX512VL
3700 [SF V16SF (V8SF "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
3701 DF V8DF (V4DF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
3703 (define_insn "<sd_mask_codefor>fma_fmadd_<mode><sd_maskz_name><round_name>"
3704 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3706 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
3707 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3708 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0")))]
3709 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3711 vfmadd132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3712 vfmadd213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3713 vfmadd231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
3714 [(set_attr "type" "ssemuladd")
3715 (set_attr "mode" "<MODE>")])
3717 (define_insn "<avx512>_fmadd_<mode>_mask<round_name>"
3718 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
3719 (vec_merge:VF_AVX512VL
3721 (match_operand:VF_AVX512VL 1 "register_operand" "0,0")
3722 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
3723 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>"))
3725 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
3726 "TARGET_AVX512F && <round_mode512bit_condition>"
3728 vfmadd132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
3729 vfmadd213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
3730 [(set_attr "type" "ssemuladd")
3731 (set_attr "mode" "<MODE>")])
3733 (define_insn "<avx512>_fmadd_<mode>_mask3<round_name>"
3734 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
3735 (vec_merge:VF_AVX512VL
3737 (match_operand:VF_AVX512VL 1 "register_operand" "v")
3738 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
3739 (match_operand:VF_AVX512VL 3 "register_operand" "0"))
3741 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
3743 "vfmadd231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
3744 [(set_attr "type" "ssemuladd")
3745 (set_attr "mode" "<MODE>")])
3747 (define_insn "*fma_fmsub_<mode>"
3748 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
3750 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x")
3751 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
3753 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x"))))]
3754 "TARGET_FMA || TARGET_FMA4"
3756 vfmsub132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
3757 vfmsub213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
3758 vfmsub231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
3759 vfmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3760 vfmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3761 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3762 (set_attr "type" "ssemuladd")
3763 (set_attr "mode" "<MODE>")])
3765 (define_insn "<sd_mask_codefor>fma_fmsub_<mode><sd_maskz_name><round_name>"
3766 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3768 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
3769 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3771 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0"))))]
3772 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3774 vfmsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3775 vfmsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3776 vfmsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
3777 [(set_attr "type" "ssemuladd")
3778 (set_attr "mode" "<MODE>")])
3780 (define_insn "<avx512>_fmsub_<mode>_mask<round_name>"
3781 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
3782 (vec_merge:VF_AVX512VL
3784 (match_operand:VF_AVX512VL 1 "register_operand" "0,0")
3785 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
3787 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>")))
3789 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
3792 vfmsub132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
3793 vfmsub213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
3794 [(set_attr "type" "ssemuladd")
3795 (set_attr "mode" "<MODE>")])
3797 (define_insn "<avx512>_fmsub_<mode>_mask3<round_name>"
3798 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
3799 (vec_merge:VF_AVX512VL
3801 (match_operand:VF_AVX512VL 1 "register_operand" "v")
3802 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
3804 (match_operand:VF_AVX512VL 3 "register_operand" "0")))
3806 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
3807 "TARGET_AVX512F && <round_mode512bit_condition>"
3808 "vfmsub231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
3809 [(set_attr "type" "ssemuladd")
3810 (set_attr "mode" "<MODE>")])
3812 (define_insn "*fma_fnmadd_<mode>"
3813 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
3816 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x"))
3817 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
3818 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x")))]
3819 "TARGET_FMA || TARGET_FMA4"
3821 vfnmadd132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
3822 vfnmadd213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
3823 vfnmadd231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
3824 vfnmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3825 vfnmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3826 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3827 (set_attr "type" "ssemuladd")
3828 (set_attr "mode" "<MODE>")])
3830 (define_insn "<sd_mask_codefor>fma_fnmadd_<mode><sd_maskz_name><round_name>"
3831 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3834 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v"))
3835 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3836 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0")))]
3837 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3839 vfnmadd132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3840 vfnmadd213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3841 vfnmadd231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
3842 [(set_attr "type" "ssemuladd")
3843 (set_attr "mode" "<MODE>")])
3845 (define_insn "<avx512>_fnmadd_<mode>_mask<round_name>"
3846 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
3847 (vec_merge:VF_AVX512VL
3850 (match_operand:VF_AVX512VL 1 "register_operand" "0,0"))
3851 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
3852 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>"))
3854 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
3855 "TARGET_AVX512F && <round_mode512bit_condition>"
3857 vfnmadd132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
3858 vfnmadd213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
3859 [(set_attr "type" "ssemuladd")
3860 (set_attr "mode" "<MODE>")])
3862 (define_insn "<avx512>_fnmadd_<mode>_mask3<round_name>"
3863 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
3864 (vec_merge:VF_AVX512VL
3867 (match_operand:VF_AVX512VL 1 "register_operand" "v"))
3868 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
3869 (match_operand:VF_AVX512VL 3 "register_operand" "0"))
3871 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
3872 "TARGET_AVX512F && <round_mode512bit_condition>"
3873 "vfnmadd231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
3874 [(set_attr "type" "ssemuladd")
3875 (set_attr "mode" "<MODE>")])
3877 (define_insn "*fma_fnmsub_<mode>"
3878 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
3881 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x"))
3882 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
3884 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x"))))]
3885 "TARGET_FMA || TARGET_FMA4"
3887 vfnmsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3888 vfnmsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3889 vfnmsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}
3890 vfnmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3891 vfnmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3892 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3893 (set_attr "type" "ssemuladd")
3894 (set_attr "mode" "<MODE>")])
3896 (define_insn "<sd_mask_codefor>fma_fnmsub_<mode><sd_maskz_name><round_name>"
3897 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3900 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v"))
3901 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3903 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0"))))]
3904 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3906 vfnmsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3907 vfnmsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3908 vfnmsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
3909 [(set_attr "type" "ssemuladd")
3910 (set_attr "mode" "<MODE>")])
3912 (define_insn "<avx512>_fnmsub_<mode>_mask<round_name>"
3913 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
3914 (vec_merge:VF_AVX512VL
3917 (match_operand:VF_AVX512VL 1 "register_operand" "0,0"))
3918 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
3920 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>")))
3922 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
3923 "TARGET_AVX512F && <round_mode512bit_condition>"
3925 vfnmsub132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
3926 vfnmsub213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
3927 [(set_attr "type" "ssemuladd")
3928 (set_attr "mode" "<MODE>")])
3930 (define_insn "<avx512>_fnmsub_<mode>_mask3<round_name>"
3931 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
3932 (vec_merge:VF_AVX512VL
3935 (match_operand:VF_AVX512VL 1 "register_operand" "v"))
3936 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
3938 (match_operand:VF_AVX512VL 3 "register_operand" "0")))
3940 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
3942 "vfnmsub231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
3943 [(set_attr "type" "ssemuladd")
3944 (set_attr "mode" "<MODE>")])
3946 ;; FMA parallel floating point multiply addsub and subadd operations.
3948 ;; It would be possible to represent these without the UNSPEC as
3951 ;; (fma op1 op2 op3)
3952 ;; (fma op1 op2 (neg op3))
3955 ;; But this doesn't seem useful in practice.
3957 (define_expand "fmaddsub_<mode>"
3958 [(set (match_operand:VF 0 "register_operand")
3960 [(match_operand:VF 1 "nonimmediate_operand")
3961 (match_operand:VF 2 "nonimmediate_operand")
3962 (match_operand:VF 3 "nonimmediate_operand")]
3964 "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F")
3966 (define_expand "<avx512>_fmaddsub_<mode>_maskz<round_expand_name>"
3967 [(match_operand:VF_AVX512VL 0 "register_operand")
3968 (match_operand:VF_AVX512VL 1 "<round_expand_nimm_predicate>")
3969 (match_operand:VF_AVX512VL 2 "<round_expand_nimm_predicate>")
3970 (match_operand:VF_AVX512VL 3 "<round_expand_nimm_predicate>")
3971 (match_operand:<avx512fmaskmode> 4 "register_operand")]
3974 emit_insn (gen_fma_fmaddsub_<mode>_maskz_1<round_expand_name> (
3975 operands[0], operands[1], operands[2], operands[3],
3976 CONST0_RTX (<MODE>mode), operands[4]<round_expand_operand>));
3980 (define_insn "*fma_fmaddsub_<mode>"
3981 [(set (match_operand:VF_128_256 0 "register_operand" "=v,v,v,x,x")
3983 [(match_operand:VF_128_256 1 "nonimmediate_operand" "%0,0,v,x,x")
3984 (match_operand:VF_128_256 2 "nonimmediate_operand" "vm,v,vm,x,m")
3985 (match_operand:VF_128_256 3 "nonimmediate_operand" "v,vm,0,xm,x")]
3987 "TARGET_FMA || TARGET_FMA4"
3989 vfmaddsub132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
3990 vfmaddsub213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
3991 vfmaddsub231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
3992 vfmaddsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3993 vfmaddsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3994 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3995 (set_attr "type" "ssemuladd")
3996 (set_attr "mode" "<MODE>")])
3998 (define_insn "<sd_mask_codefor>fma_fmaddsub_<mode><sd_maskz_name><round_name>"
3999 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
4000 (unspec:VF_SF_AVX512VL
4001 [(match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
4002 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
4003 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0")]
4005 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
4007 vfmaddsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
4008 vfmaddsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
4009 vfmaddsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
4010 [(set_attr "type" "ssemuladd")
4011 (set_attr "mode" "<MODE>")])
4013 (define_insn "<avx512>_fmaddsub_<mode>_mask<round_name>"
4014 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
4015 (vec_merge:VF_AVX512VL
4017 [(match_operand:VF_AVX512VL 1 "register_operand" "0,0")
4018 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
4019 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>")]
4022 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
4025 vfmaddsub132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
4026 vfmaddsub213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
4027 [(set_attr "type" "ssemuladd")
4028 (set_attr "mode" "<MODE>")])
4030 (define_insn "<avx512>_fmaddsub_<mode>_mask3<round_name>"
4031 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
4032 (vec_merge:VF_AVX512VL
4034 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
4035 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
4036 (match_operand:VF_AVX512VL 3 "register_operand" "0")]
4039 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
4041 "vfmaddsub231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
4042 [(set_attr "type" "ssemuladd")
4043 (set_attr "mode" "<MODE>")])
4045 (define_insn "*fma_fmsubadd_<mode>"
4046 [(set (match_operand:VF_128_256 0 "register_operand" "=v,v,v,x,x")
4048 [(match_operand:VF_128_256 1 "nonimmediate_operand" "%0,0,v,x,x")
4049 (match_operand:VF_128_256 2 "nonimmediate_operand" "vm,v,vm,x,m")
4051 (match_operand:VF_128_256 3 "nonimmediate_operand" "v,vm,0,xm,x"))]
4053 "TARGET_FMA || TARGET_FMA4"
4055 vfmsubadd132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
4056 vfmsubadd213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
4057 vfmsubadd231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
4058 vfmsubadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
4059 vfmsubadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
4060 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
4061 (set_attr "type" "ssemuladd")
4062 (set_attr "mode" "<MODE>")])
4064 (define_insn "<sd_mask_codefor>fma_fmsubadd_<mode><sd_maskz_name><round_name>"
4065 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
4066 (unspec:VF_SF_AVX512VL
4067 [(match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
4068 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
4070 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0"))]
4072 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
4074 vfmsubadd132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
4075 vfmsubadd213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
4076 vfmsubadd231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
4077 [(set_attr "type" "ssemuladd")
4078 (set_attr "mode" "<MODE>")])
4080 (define_insn "<avx512>_fmsubadd_<mode>_mask<round_name>"
4081 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
4082 (vec_merge:VF_AVX512VL
4084 [(match_operand:VF_AVX512VL 1 "register_operand" "0,0")
4085 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
4087 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>"))]
4090 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
4093 vfmsubadd132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
4094 vfmsubadd213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
4095 [(set_attr "type" "ssemuladd")
4096 (set_attr "mode" "<MODE>")])
4098 (define_insn "<avx512>_fmsubadd_<mode>_mask3<round_name>"
4099 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
4100 (vec_merge:VF_AVX512VL
4102 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
4103 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
4105 (match_operand:VF_AVX512VL 3 "register_operand" "0"))]
4108 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
4110 "vfmsubadd231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
4111 [(set_attr "type" "ssemuladd")
4112 (set_attr "mode" "<MODE>")])
4114 ;; FMA3 floating point scalar intrinsics. These merge result with
4115 ;; high-order elements from the destination register.
4117 (define_expand "fmai_vmfmadd_<mode><round_name>"
4118 [(set (match_operand:VF_128 0 "register_operand")
4121 (match_operand:VF_128 1 "<round_nimm_predicate>")
4122 (match_operand:VF_128 2 "<round_nimm_predicate>")
4123 (match_operand:VF_128 3 "<round_nimm_predicate>"))
4128 (define_insn "*fmai_fmadd_<mode>"
4129 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4132 (match_operand:VF_128 1 "<round_nimm_predicate>" " 0, 0")
4133 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>, v")
4134 (match_operand:VF_128 3 "<round_nimm_predicate>" " v,<round_constraint>"))
4137 "TARGET_FMA || TARGET_AVX512F"
4139 vfmadd132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
4140 vfmadd213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
4141 [(set_attr "type" "ssemuladd")
4142 (set_attr "mode" "<MODE>")])
4144 (define_insn "*fmai_fmsub_<mode>"
4145 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4148 (match_operand:VF_128 1 "<round_nimm_predicate>" "0,0")
4149 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>,v")
4151 (match_operand:VF_128 3 "<round_nimm_predicate>" " v,<round_constraint>")))
4154 "TARGET_FMA || TARGET_AVX512F"
4156 vfmsub132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
4157 vfmsub213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
4158 [(set_attr "type" "ssemuladd")
4159 (set_attr "mode" "<MODE>")])
4161 (define_insn "*fmai_fnmadd_<mode><round_name>"
4162 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4166 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>,v"))
4167 (match_operand:VF_128 1 "<round_nimm_predicate>" "0,0")
4168 (match_operand:VF_128 3 "<round_nimm_predicate>" "v,<round_constraint>"))
4171 "TARGET_FMA || TARGET_AVX512F"
4173 vfnmadd132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
4174 vfnmadd213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
4175 [(set_attr "type" "ssemuladd")
4176 (set_attr "mode" "<MODE>")])
4178 (define_insn "*fmai_fnmsub_<mode><round_name>"
4179 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
4183 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>, v"))
4184 (match_operand:VF_128 1 "<round_nimm_predicate>" " 0, 0")
4186 (match_operand:VF_128 3 "<round_nimm_predicate>" " v,<round_constraint>")))
4189 "TARGET_FMA || TARGET_AVX512F"
4191 vfnmsub132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
4192 vfnmsub213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
4193 [(set_attr "type" "ssemuladd")
4194 (set_attr "mode" "<MODE>")])
4196 ;; FMA4 floating point scalar intrinsics. These write the
4197 ;; entire destination register, with the high-order elements zeroed.
4199 (define_expand "fma4i_vmfmadd_<mode>"
4200 [(set (match_operand:VF_128 0 "register_operand")
4203 (match_operand:VF_128 1 "nonimmediate_operand")
4204 (match_operand:VF_128 2 "nonimmediate_operand")
4205 (match_operand:VF_128 3 "nonimmediate_operand"))
4209 "operands[4] = CONST0_RTX (<MODE>mode);")
4211 (define_insn "*fma4i_vmfmadd_<mode>"
4212 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
4215 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x")
4216 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
4217 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x"))
4218 (match_operand:VF_128 4 "const0_operand")
4221 "vfmadd<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
4222 [(set_attr "type" "ssemuladd")
4223 (set_attr "mode" "<MODE>")])
4225 (define_insn "*fma4i_vmfmsub_<mode>"
4226 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
4229 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x")
4230 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
4232 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x")))
4233 (match_operand:VF_128 4 "const0_operand")
4236 "vfmsub<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
4237 [(set_attr "type" "ssemuladd")
4238 (set_attr "mode" "<MODE>")])
4240 (define_insn "*fma4i_vmfnmadd_<mode>"
4241 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
4245 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x"))
4246 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
4247 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x"))
4248 (match_operand:VF_128 4 "const0_operand")
4251 "vfnmadd<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
4252 [(set_attr "type" "ssemuladd")
4253 (set_attr "mode" "<MODE>")])
4255 (define_insn "*fma4i_vmfnmsub_<mode>"
4256 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
4260 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x"))
4261 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
4263 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x")))
4264 (match_operand:VF_128 4 "const0_operand")
4267 "vfnmsub<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
4268 [(set_attr "type" "ssemuladd")
4269 (set_attr "mode" "<MODE>")])
4271 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4273 ;; Parallel single-precision floating point conversion operations
4275 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4277 (define_insn "sse_cvtpi2ps"
4278 [(set (match_operand:V4SF 0 "register_operand" "=x")
4281 (float:V2SF (match_operand:V2SI 2 "nonimmediate_operand" "ym")))
4282 (match_operand:V4SF 1 "register_operand" "0")
4285 "cvtpi2ps\t{%2, %0|%0, %2}"
4286 [(set_attr "type" "ssecvt")
4287 (set_attr "mode" "V4SF")])
4289 (define_insn "sse_cvtps2pi"
4290 [(set (match_operand:V2SI 0 "register_operand" "=y")
4292 (unspec:V4SI [(match_operand:V4SF 1 "nonimmediate_operand" "xm")]
4294 (parallel [(const_int 0) (const_int 1)])))]
4296 "cvtps2pi\t{%1, %0|%0, %q1}"
4297 [(set_attr "type" "ssecvt")
4298 (set_attr "unit" "mmx")
4299 (set_attr "mode" "DI")])
4301 (define_insn "sse_cvttps2pi"
4302 [(set (match_operand:V2SI 0 "register_operand" "=y")
4304 (fix:V4SI (match_operand:V4SF 1 "nonimmediate_operand" "xm"))
4305 (parallel [(const_int 0) (const_int 1)])))]
4307 "cvttps2pi\t{%1, %0|%0, %q1}"
4308 [(set_attr "type" "ssecvt")
4309 (set_attr "unit" "mmx")
4310 (set_attr "prefix_rep" "0")
4311 (set_attr "mode" "SF")])
4313 (define_insn "sse_cvtsi2ss<round_name>"
4314 [(set (match_operand:V4SF 0 "register_operand" "=x,x,v")
4317 (float:SF (match_operand:SI 2 "<round_nimm_scalar_predicate>" "r,m,<round_constraint3>")))
4318 (match_operand:V4SF 1 "register_operand" "0,0,v")
4322 cvtsi2ss\t{%2, %0|%0, %2}
4323 cvtsi2ss\t{%2, %0|%0, %2}
4324 vcvtsi2ss\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4325 [(set_attr "isa" "noavx,noavx,avx")
4326 (set_attr "type" "sseicvt")
4327 (set_attr "athlon_decode" "vector,double,*")
4328 (set_attr "amdfam10_decode" "vector,double,*")
4329 (set_attr "bdver1_decode" "double,direct,*")
4330 (set_attr "btver2_decode" "double,double,double")
4331 (set_attr "znver1_decode" "double,double,double")
4332 (set_attr "prefix" "orig,orig,maybe_evex")
4333 (set_attr "mode" "SF")])
4335 (define_insn "sse_cvtsi2ssq<round_name>"
4336 [(set (match_operand:V4SF 0 "register_operand" "=x,x,v")
4339 (float:SF (match_operand:DI 2 "<round_nimm_scalar_predicate>" "r,m,<round_constraint3>")))
4340 (match_operand:V4SF 1 "register_operand" "0,0,v")
4342 "TARGET_SSE && TARGET_64BIT"
4344 cvtsi2ssq\t{%2, %0|%0, %2}
4345 cvtsi2ssq\t{%2, %0|%0, %2}
4346 vcvtsi2ssq\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4347 [(set_attr "isa" "noavx,noavx,avx")
4348 (set_attr "type" "sseicvt")
4349 (set_attr "athlon_decode" "vector,double,*")
4350 (set_attr "amdfam10_decode" "vector,double,*")
4351 (set_attr "bdver1_decode" "double,direct,*")
4352 (set_attr "btver2_decode" "double,double,double")
4353 (set_attr "length_vex" "*,*,4")
4354 (set_attr "prefix_rex" "1,1,*")
4355 (set_attr "prefix" "orig,orig,maybe_evex")
4356 (set_attr "mode" "SF")])
4358 (define_insn "sse_cvtss2si<round_name>"
4359 [(set (match_operand:SI 0 "register_operand" "=r,r")
4362 (match_operand:V4SF 1 "<round_nimm_scalar_predicate>" "v,<round_constraint2>")
4363 (parallel [(const_int 0)]))]
4364 UNSPEC_FIX_NOTRUNC))]
4366 "%vcvtss2si\t{<round_op2>%1, %0|%0, %k1<round_op2>}"
4367 [(set_attr "type" "sseicvt")
4368 (set_attr "athlon_decode" "double,vector")
4369 (set_attr "bdver1_decode" "double,double")
4370 (set_attr "prefix_rep" "1")
4371 (set_attr "prefix" "maybe_vex")
4372 (set_attr "mode" "SI")])
4374 (define_insn "sse_cvtss2si_2"
4375 [(set (match_operand:SI 0 "register_operand" "=r,r")
4376 (unspec:SI [(match_operand:SF 1 "nonimmediate_operand" "v,m")]
4377 UNSPEC_FIX_NOTRUNC))]
4379 "%vcvtss2si\t{%1, %0|%0, %k1}"
4380 [(set_attr "type" "sseicvt")
4381 (set_attr "athlon_decode" "double,vector")
4382 (set_attr "amdfam10_decode" "double,double")
4383 (set_attr "bdver1_decode" "double,double")
4384 (set_attr "prefix_rep" "1")
4385 (set_attr "prefix" "maybe_vex")
4386 (set_attr "mode" "SI")])
4388 (define_insn "sse_cvtss2siq<round_name>"
4389 [(set (match_operand:DI 0 "register_operand" "=r,r")
4392 (match_operand:V4SF 1 "<round_nimm_scalar_predicate>" "v,<round_constraint2>")
4393 (parallel [(const_int 0)]))]
4394 UNSPEC_FIX_NOTRUNC))]
4395 "TARGET_SSE && TARGET_64BIT"
4396 "%vcvtss2si{q}\t{<round_op2>%1, %0|%0, %k1<round_op2>}"
4397 [(set_attr "type" "sseicvt")
4398 (set_attr "athlon_decode" "double,vector")
4399 (set_attr "bdver1_decode" "double,double")
4400 (set_attr "prefix_rep" "1")
4401 (set_attr "prefix" "maybe_vex")
4402 (set_attr "mode" "DI")])
4404 (define_insn "sse_cvtss2siq_2"
4405 [(set (match_operand:DI 0 "register_operand" "=r,r")
4406 (unspec:DI [(match_operand:SF 1 "nonimmediate_operand" "v,m")]
4407 UNSPEC_FIX_NOTRUNC))]
4408 "TARGET_SSE && TARGET_64BIT"
4409 "%vcvtss2si{q}\t{%1, %0|%0, %k1}"
4410 [(set_attr "type" "sseicvt")
4411 (set_attr "athlon_decode" "double,vector")
4412 (set_attr "amdfam10_decode" "double,double")
4413 (set_attr "bdver1_decode" "double,double")
4414 (set_attr "prefix_rep" "1")
4415 (set_attr "prefix" "maybe_vex")
4416 (set_attr "mode" "DI")])
4418 (define_insn "sse_cvttss2si<round_saeonly_name>"
4419 [(set (match_operand:SI 0 "register_operand" "=r,r")
4422 (match_operand:V4SF 1 "<round_saeonly_nimm_scalar_predicate>" "v,<round_saeonly_constraint2>")
4423 (parallel [(const_int 0)]))))]
4425 "%vcvttss2si\t{<round_saeonly_op2>%1, %0|%0, %k1<round_saeonly_op2>}"
4426 [(set_attr "type" "sseicvt")
4427 (set_attr "athlon_decode" "double,vector")
4428 (set_attr "amdfam10_decode" "double,double")
4429 (set_attr "bdver1_decode" "double,double")
4430 (set_attr "prefix_rep" "1")
4431 (set_attr "prefix" "maybe_vex")
4432 (set_attr "mode" "SI")])
4434 (define_insn "sse_cvttss2siq<round_saeonly_name>"
4435 [(set (match_operand:DI 0 "register_operand" "=r,r")
4438 (match_operand:V4SF 1 "<round_saeonly_nimm_scalar_predicate>" "v,<round_saeonly_constraint>")
4439 (parallel [(const_int 0)]))))]
4440 "TARGET_SSE && TARGET_64BIT"
4441 "%vcvttss2si{q}\t{<round_saeonly_op2>%1, %0|%0, %k1<round_saeonly_op2>}"
4442 [(set_attr "type" "sseicvt")
4443 (set_attr "athlon_decode" "double,vector")
4444 (set_attr "amdfam10_decode" "double,double")
4445 (set_attr "bdver1_decode" "double,double")
4446 (set_attr "prefix_rep" "1")
4447 (set_attr "prefix" "maybe_vex")
4448 (set_attr "mode" "DI")])
4450 (define_insn "cvtusi2<ssescalarmodesuffix>32<round_name>"
4451 [(set (match_operand:VF_128 0 "register_operand" "=v")
4453 (vec_duplicate:VF_128
4454 (unsigned_float:<ssescalarmode>
4455 (match_operand:SI 2 "<round_nimm_predicate>" "<round_constraint3>")))
4456 (match_operand:VF_128 1 "register_operand" "v")
4458 "TARGET_AVX512F && <round_modev4sf_condition>"
4459 "vcvtusi2<ssescalarmodesuffix>\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4460 [(set_attr "type" "sseicvt")
4461 (set_attr "prefix" "evex")
4462 (set_attr "mode" "<ssescalarmode>")])
4464 (define_insn "cvtusi2<ssescalarmodesuffix>64<round_name>"
4465 [(set (match_operand:VF_128 0 "register_operand" "=v")
4467 (vec_duplicate:VF_128
4468 (unsigned_float:<ssescalarmode>
4469 (match_operand:DI 2 "<round_nimm_predicate>" "<round_constraint3>")))
4470 (match_operand:VF_128 1 "register_operand" "v")
4472 "TARGET_AVX512F && TARGET_64BIT"
4473 "vcvtusi2<ssescalarmodesuffix>\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4474 [(set_attr "type" "sseicvt")
4475 (set_attr "prefix" "evex")
4476 (set_attr "mode" "<ssescalarmode>")])
4478 (define_insn "float<sseintvecmodelower><mode>2<mask_name><round_name>"
4479 [(set (match_operand:VF1 0 "register_operand" "=x,v")
4481 (match_operand:<sseintvecmode> 1 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
4482 "TARGET_SSE2 && <mask_mode512bit_condition> && <round_mode512bit_condition>"
4484 cvtdq2ps\t{%1, %0|%0, %1}
4485 vcvtdq2ps\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4486 [(set_attr "isa" "noavx,avx")
4487 (set_attr "type" "ssecvt")
4488 (set_attr "prefix" "maybe_vex")
4489 (set_attr "mode" "<sseinsnmode>")])
4491 (define_insn "ufloat<sseintvecmodelower><mode>2<mask_name><round_name>"
4492 [(set (match_operand:VF1_AVX512VL 0 "register_operand" "=v")
4493 (unsigned_float:VF1_AVX512VL
4494 (match_operand:<sseintvecmode> 1 "nonimmediate_operand" "<round_constraint>")))]
4496 "vcvtudq2ps\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4497 [(set_attr "type" "ssecvt")
4498 (set_attr "prefix" "evex")
4499 (set_attr "mode" "<MODE>")])
4501 (define_expand "floatuns<sseintvecmodelower><mode>2"
4502 [(match_operand:VF1 0 "register_operand")
4503 (match_operand:<sseintvecmode> 1 "register_operand")]
4504 "TARGET_SSE2 && (<MODE>mode == V4SFmode || TARGET_AVX2)"
4506 if (<MODE>mode == V16SFmode)
4507 emit_insn (gen_ufloatv16siv16sf2 (operands[0], operands[1]));
4509 if (TARGET_AVX512VL)
4511 if (<MODE>mode == V4SFmode)
4512 emit_insn (gen_ufloatv4siv4sf2 (operands[0], operands[1]));
4514 emit_insn (gen_ufloatv8siv8sf2 (operands[0], operands[1]));
4517 ix86_expand_vector_convert_uns_vsivsf (operands[0], operands[1]);
4523 ;; For <sse2_avx_avx512f>_fix_notrunc<sf2simodelower><mode> insn pattern
4524 (define_mode_attr sf2simodelower
4525 [(V16SI "v16sf") (V8SI "v8sf") (V4SI "v4sf")])
4527 (define_insn "<sse2_avx_avx512f>_fix_notrunc<sf2simodelower><mode><mask_name>"
4528 [(set (match_operand:VI4_AVX 0 "register_operand" "=v")
4530 [(match_operand:<ssePSmode> 1 "vector_operand" "vBm")]
4531 UNSPEC_FIX_NOTRUNC))]
4532 "TARGET_SSE2 && <mask_mode512bit_condition>"
4533 "%vcvtps2dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4534 [(set_attr "type" "ssecvt")
4535 (set (attr "prefix_data16")
4537 (match_test "TARGET_AVX")
4539 (const_string "1")))
4540 (set_attr "prefix" "maybe_vex")
4541 (set_attr "mode" "<sseinsnmode>")])
4543 (define_insn "avx512f_fix_notruncv16sfv16si<mask_name><round_name>"
4544 [(set (match_operand:V16SI 0 "register_operand" "=v")
4546 [(match_operand:V16SF 1 "<round_nimm_predicate>" "<round_constraint>")]
4547 UNSPEC_FIX_NOTRUNC))]
4549 "vcvtps2dq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4550 [(set_attr "type" "ssecvt")
4551 (set_attr "prefix" "evex")
4552 (set_attr "mode" "XI")])
4554 (define_insn "<mask_codefor><avx512>_ufix_notrunc<sf2simodelower><mode><mask_name><round_name>"
4555 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
4556 (unspec:VI4_AVX512VL
4557 [(match_operand:<ssePSmode> 1 "nonimmediate_operand" "<round_constraint>")]
4558 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4560 "vcvtps2udq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4561 [(set_attr "type" "ssecvt")
4562 (set_attr "prefix" "evex")
4563 (set_attr "mode" "<sseinsnmode>")])
4565 (define_insn "<mask_codefor>avx512dq_cvtps2qq<mode><mask_name><round_name>"
4566 [(set (match_operand:VI8_256_512 0 "register_operand" "=v")
4567 (unspec:VI8_256_512 [(match_operand:<ssePSmode2> 1 "nonimmediate_operand" "<round_constraint>")]
4568 UNSPEC_FIX_NOTRUNC))]
4569 "TARGET_AVX512DQ && <round_mode512bit_condition>"
4570 "vcvtps2qq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4571 [(set_attr "type" "ssecvt")
4572 (set_attr "prefix" "evex")
4573 (set_attr "mode" "<sseinsnmode>")])
4575 (define_insn "<mask_codefor>avx512dq_cvtps2qqv2di<mask_name>"
4576 [(set (match_operand:V2DI 0 "register_operand" "=v")
4579 (match_operand:V4SF 1 "nonimmediate_operand" "vm")
4580 (parallel [(const_int 0) (const_int 1)]))]
4581 UNSPEC_FIX_NOTRUNC))]
4582 "TARGET_AVX512DQ && TARGET_AVX512VL"
4583 "vcvtps2qq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
4584 [(set_attr "type" "ssecvt")
4585 (set_attr "prefix" "evex")
4586 (set_attr "mode" "TI")])
4588 (define_insn "<mask_codefor>avx512dq_cvtps2uqq<mode><mask_name><round_name>"
4589 [(set (match_operand:VI8_256_512 0 "register_operand" "=v")
4590 (unspec:VI8_256_512 [(match_operand:<ssePSmode2> 1 "nonimmediate_operand" "<round_constraint>")]
4591 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4592 "TARGET_AVX512DQ && <round_mode512bit_condition>"
4593 "vcvtps2uqq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4594 [(set_attr "type" "ssecvt")
4595 (set_attr "prefix" "evex")
4596 (set_attr "mode" "<sseinsnmode>")])
4598 (define_insn "<mask_codefor>avx512dq_cvtps2uqqv2di<mask_name>"
4599 [(set (match_operand:V2DI 0 "register_operand" "=v")
4602 (match_operand:V4SF 1 "nonimmediate_operand" "vm")
4603 (parallel [(const_int 0) (const_int 1)]))]
4604 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4605 "TARGET_AVX512DQ && TARGET_AVX512VL"
4606 "vcvtps2uqq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
4607 [(set_attr "type" "ssecvt")
4608 (set_attr "prefix" "evex")
4609 (set_attr "mode" "TI")])
4611 (define_insn "<fixsuffix>fix_truncv16sfv16si2<mask_name><round_saeonly_name>"
4612 [(set (match_operand:V16SI 0 "register_operand" "=v")
4614 (match_operand:V16SF 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
4616 "vcvttps2<fixsuffix>dq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
4617 [(set_attr "type" "ssecvt")
4618 (set_attr "prefix" "evex")
4619 (set_attr "mode" "XI")])
4621 (define_insn "fix_truncv8sfv8si2<mask_name>"
4622 [(set (match_operand:V8SI 0 "register_operand" "=v")
4623 (fix:V8SI (match_operand:V8SF 1 "nonimmediate_operand" "vm")))]
4624 "TARGET_AVX && <mask_avx512vl_condition>"
4625 "vcvttps2dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4626 [(set_attr "type" "ssecvt")
4627 (set_attr "prefix" "<mask_prefix>")
4628 (set_attr "mode" "OI")])
4630 (define_insn "fix_truncv4sfv4si2<mask_name>"
4631 [(set (match_operand:V4SI 0 "register_operand" "=v")
4632 (fix:V4SI (match_operand:V4SF 1 "vector_operand" "vBm")))]
4633 "TARGET_SSE2 && <mask_avx512vl_condition>"
4634 "%vcvttps2dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4635 [(set_attr "type" "ssecvt")
4636 (set (attr "prefix_rep")
4638 (match_test "TARGET_AVX")
4640 (const_string "1")))
4641 (set (attr "prefix_data16")
4643 (match_test "TARGET_AVX")
4645 (const_string "0")))
4646 (set_attr "prefix_data16" "0")
4647 (set_attr "prefix" "<mask_prefix2>")
4648 (set_attr "mode" "TI")])
4650 (define_expand "fixuns_trunc<mode><sseintvecmodelower>2"
4651 [(match_operand:<sseintvecmode> 0 "register_operand")
4652 (match_operand:VF1 1 "register_operand")]
4655 if (<MODE>mode == V16SFmode)
4656 emit_insn (gen_ufix_truncv16sfv16si2 (operands[0],
4661 tmp[0] = ix86_expand_adjust_ufix_to_sfix_si (operands[1], &tmp[2]);
4662 tmp[1] = gen_reg_rtx (<sseintvecmode>mode);
4663 emit_insn (gen_fix_trunc<mode><sseintvecmodelower>2 (tmp[1], tmp[0]));
4664 emit_insn (gen_xor<sseintvecmodelower>3 (operands[0], tmp[1], tmp[2]));
4669 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4671 ;; Parallel double-precision floating point conversion operations
4673 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4675 (define_insn "sse2_cvtpi2pd"
4676 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
4677 (float:V2DF (match_operand:V2SI 1 "nonimmediate_operand" "y,m")))]
4679 "cvtpi2pd\t{%1, %0|%0, %1}"
4680 [(set_attr "type" "ssecvt")
4681 (set_attr "unit" "mmx,*")
4682 (set_attr "prefix_data16" "1,*")
4683 (set_attr "mode" "V2DF")])
4685 (define_insn "sse2_cvtpd2pi"
4686 [(set (match_operand:V2SI 0 "register_operand" "=y")
4687 (unspec:V2SI [(match_operand:V2DF 1 "nonimmediate_operand" "xm")]
4688 UNSPEC_FIX_NOTRUNC))]
4690 "cvtpd2pi\t{%1, %0|%0, %1}"
4691 [(set_attr "type" "ssecvt")
4692 (set_attr "unit" "mmx")
4693 (set_attr "bdver1_decode" "double")
4694 (set_attr "btver2_decode" "direct")
4695 (set_attr "prefix_data16" "1")
4696 (set_attr "mode" "DI")])
4698 (define_insn "sse2_cvttpd2pi"
4699 [(set (match_operand:V2SI 0 "register_operand" "=y")
4700 (fix:V2SI (match_operand:V2DF 1 "nonimmediate_operand" "xm")))]
4702 "cvttpd2pi\t{%1, %0|%0, %1}"
4703 [(set_attr "type" "ssecvt")
4704 (set_attr "unit" "mmx")
4705 (set_attr "bdver1_decode" "double")
4706 (set_attr "prefix_data16" "1")
4707 (set_attr "mode" "TI")])
4709 (define_insn "sse2_cvtsi2sd"
4710 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
4713 (float:DF (match_operand:SI 2 "nonimmediate_operand" "r,m,rm")))
4714 (match_operand:V2DF 1 "register_operand" "0,0,v")
4718 cvtsi2sd\t{%2, %0|%0, %2}
4719 cvtsi2sd\t{%2, %0|%0, %2}
4720 vcvtsi2sd\t{%2, %1, %0|%0, %1, %2}"
4721 [(set_attr "isa" "noavx,noavx,avx")
4722 (set_attr "type" "sseicvt")
4723 (set_attr "athlon_decode" "double,direct,*")
4724 (set_attr "amdfam10_decode" "vector,double,*")
4725 (set_attr "bdver1_decode" "double,direct,*")
4726 (set_attr "btver2_decode" "double,double,double")
4727 (set_attr "znver1_decode" "double,double,double")
4728 (set_attr "prefix" "orig,orig,maybe_evex")
4729 (set_attr "mode" "DF")])
4731 (define_insn "sse2_cvtsi2sdq<round_name>"
4732 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
4735 (float:DF (match_operand:DI 2 "<round_nimm_scalar_predicate>" "r,m,<round_constraint3>")))
4736 (match_operand:V2DF 1 "register_operand" "0,0,v")
4738 "TARGET_SSE2 && TARGET_64BIT"
4740 cvtsi2sdq\t{%2, %0|%0, %2}
4741 cvtsi2sdq\t{%2, %0|%0, %2}
4742 vcvtsi2sdq\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4743 [(set_attr "isa" "noavx,noavx,avx")
4744 (set_attr "type" "sseicvt")
4745 (set_attr "athlon_decode" "double,direct,*")
4746 (set_attr "amdfam10_decode" "vector,double,*")
4747 (set_attr "bdver1_decode" "double,direct,*")
4748 (set_attr "length_vex" "*,*,4")
4749 (set_attr "prefix_rex" "1,1,*")
4750 (set_attr "prefix" "orig,orig,maybe_evex")
4751 (set_attr "mode" "DF")])
4753 (define_insn "avx512f_vcvtss2usi<round_name>"
4754 [(set (match_operand:SI 0 "register_operand" "=r")
4757 (match_operand:V4SF 1 "<round_nimm_predicate>" "<round_constraint>")
4758 (parallel [(const_int 0)]))]
4759 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4761 "vcvtss2usi\t{<round_op2>%1, %0|%0, %1<round_op2>}"
4762 [(set_attr "type" "sseicvt")
4763 (set_attr "prefix" "evex")
4764 (set_attr "mode" "SI")])
4766 (define_insn "avx512f_vcvtss2usiq<round_name>"
4767 [(set (match_operand:DI 0 "register_operand" "=r")
4770 (match_operand:V4SF 1 "<round_nimm_predicate>" "<round_constraint>")
4771 (parallel [(const_int 0)]))]
4772 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4773 "TARGET_AVX512F && TARGET_64BIT"
4774 "vcvtss2usi\t{<round_op2>%1, %0|%0, %1<round_op2>}"
4775 [(set_attr "type" "sseicvt")
4776 (set_attr "prefix" "evex")
4777 (set_attr "mode" "DI")])
4779 (define_insn "avx512f_vcvttss2usi<round_saeonly_name>"
4780 [(set (match_operand:SI 0 "register_operand" "=r")
4783 (match_operand:V4SF 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
4784 (parallel [(const_int 0)]))))]
4786 "vcvttss2usi\t{<round_saeonly_op2>%1, %0|%0, %1<round_saeonly_op2>}"
4787 [(set_attr "type" "sseicvt")
4788 (set_attr "prefix" "evex")
4789 (set_attr "mode" "SI")])
4791 (define_insn "avx512f_vcvttss2usiq<round_saeonly_name>"
4792 [(set (match_operand:DI 0 "register_operand" "=r")
4795 (match_operand:V4SF 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
4796 (parallel [(const_int 0)]))))]
4797 "TARGET_AVX512F && TARGET_64BIT"
4798 "vcvttss2usi\t{<round_saeonly_op2>%1, %0|%0, %1<round_saeonly_op2>}"
4799 [(set_attr "type" "sseicvt")
4800 (set_attr "prefix" "evex")
4801 (set_attr "mode" "DI")])
4803 (define_insn "avx512f_vcvtsd2usi<round_name>"
4804 [(set (match_operand:SI 0 "register_operand" "=r")
4807 (match_operand:V2DF 1 "<round_nimm_predicate>" "<round_constraint>")
4808 (parallel [(const_int 0)]))]
4809 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4811 "vcvtsd2usi\t{<round_op2>%1, %0|%0, %1<round_op2>}"
4812 [(set_attr "type" "sseicvt")
4813 (set_attr "prefix" "evex")
4814 (set_attr "mode" "SI")])
4816 (define_insn "avx512f_vcvtsd2usiq<round_name>"
4817 [(set (match_operand:DI 0 "register_operand" "=r")
4820 (match_operand:V2DF 1 "<round_nimm_predicate>" "<round_constraint>")
4821 (parallel [(const_int 0)]))]
4822 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4823 "TARGET_AVX512F && TARGET_64BIT"
4824 "vcvtsd2usi\t{<round_op2>%1, %0|%0, %1<round_op2>}"
4825 [(set_attr "type" "sseicvt")
4826 (set_attr "prefix" "evex")
4827 (set_attr "mode" "DI")])
4829 (define_insn "avx512f_vcvttsd2usi<round_saeonly_name>"
4830 [(set (match_operand:SI 0 "register_operand" "=r")
4833 (match_operand:V2DF 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
4834 (parallel [(const_int 0)]))))]
4836 "vcvttsd2usi\t{<round_saeonly_op2>%1, %0|%0, %1<round_saeonly_op2>}"
4837 [(set_attr "type" "sseicvt")
4838 (set_attr "prefix" "evex")
4839 (set_attr "mode" "SI")])
4841 (define_insn "avx512f_vcvttsd2usiq<round_saeonly_name>"
4842 [(set (match_operand:DI 0 "register_operand" "=r")
4845 (match_operand:V2DF 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
4846 (parallel [(const_int 0)]))))]
4847 "TARGET_AVX512F && TARGET_64BIT"
4848 "vcvttsd2usi\t{<round_saeonly_op2>%1, %0|%0, %1<round_saeonly_op2>}"
4849 [(set_attr "type" "sseicvt")
4850 (set_attr "prefix" "evex")
4851 (set_attr "mode" "DI")])
4853 (define_insn "sse2_cvtsd2si<round_name>"
4854 [(set (match_operand:SI 0 "register_operand" "=r,r")
4857 (match_operand:V2DF 1 "<round_nimm_scalar_predicate>" "v,<round_constraint2>")
4858 (parallel [(const_int 0)]))]
4859 UNSPEC_FIX_NOTRUNC))]
4861 "%vcvtsd2si\t{<round_op2>%1, %0|%0, %q1<round_op2>}"
4862 [(set_attr "type" "sseicvt")
4863 (set_attr "athlon_decode" "double,vector")
4864 (set_attr "bdver1_decode" "double,double")
4865 (set_attr "btver2_decode" "double,double")
4866 (set_attr "prefix_rep" "1")
4867 (set_attr "prefix" "maybe_vex")
4868 (set_attr "mode" "SI")])
4870 (define_insn "sse2_cvtsd2si_2"
4871 [(set (match_operand:SI 0 "register_operand" "=r,r")
4872 (unspec:SI [(match_operand:DF 1 "nonimmediate_operand" "v,m")]
4873 UNSPEC_FIX_NOTRUNC))]
4875 "%vcvtsd2si\t{%1, %0|%0, %q1}"
4876 [(set_attr "type" "sseicvt")
4877 (set_attr "athlon_decode" "double,vector")
4878 (set_attr "amdfam10_decode" "double,double")
4879 (set_attr "bdver1_decode" "double,double")
4880 (set_attr "prefix_rep" "1")
4881 (set_attr "prefix" "maybe_vex")
4882 (set_attr "mode" "SI")])
4884 (define_insn "sse2_cvtsd2siq<round_name>"
4885 [(set (match_operand:DI 0 "register_operand" "=r,r")
4888 (match_operand:V2DF 1 "<round_nimm_scalar_predicate>" "v,<round_constraint2>")
4889 (parallel [(const_int 0)]))]
4890 UNSPEC_FIX_NOTRUNC))]
4891 "TARGET_SSE2 && TARGET_64BIT"
4892 "%vcvtsd2si{q}\t{<round_op2>%1, %0|%0, %q1<round_op2>}"
4893 [(set_attr "type" "sseicvt")
4894 (set_attr "athlon_decode" "double,vector")
4895 (set_attr "bdver1_decode" "double,double")
4896 (set_attr "prefix_rep" "1")
4897 (set_attr "prefix" "maybe_vex")
4898 (set_attr "mode" "DI")])
4900 (define_insn "sse2_cvtsd2siq_2"
4901 [(set (match_operand:DI 0 "register_operand" "=r,r")
4902 (unspec:DI [(match_operand:DF 1 "nonimmediate_operand" "v,m")]
4903 UNSPEC_FIX_NOTRUNC))]
4904 "TARGET_SSE2 && TARGET_64BIT"
4905 "%vcvtsd2si{q}\t{%1, %0|%0, %q1}"
4906 [(set_attr "type" "sseicvt")
4907 (set_attr "athlon_decode" "double,vector")
4908 (set_attr "amdfam10_decode" "double,double")
4909 (set_attr "bdver1_decode" "double,double")
4910 (set_attr "prefix_rep" "1")
4911 (set_attr "prefix" "maybe_vex")
4912 (set_attr "mode" "DI")])
4914 (define_insn "sse2_cvttsd2si<round_saeonly_name>"
4915 [(set (match_operand:SI 0 "register_operand" "=r,r")
4918 (match_operand:V2DF 1 "<round_saeonly_nimm_scalar_predicate>" "v,<round_saeonly_constraint2>")
4919 (parallel [(const_int 0)]))))]
4921 "%vcvttsd2si\t{<round_saeonly_op2>%1, %0|%0, %q1<round_saeonly_op2>}"
4922 [(set_attr "type" "sseicvt")
4923 (set_attr "athlon_decode" "double,vector")
4924 (set_attr "amdfam10_decode" "double,double")
4925 (set_attr "bdver1_decode" "double,double")
4926 (set_attr "btver2_decode" "double,double")
4927 (set_attr "prefix_rep" "1")
4928 (set_attr "prefix" "maybe_vex")
4929 (set_attr "mode" "SI")])
4931 (define_insn "sse2_cvttsd2siq<round_saeonly_name>"
4932 [(set (match_operand:DI 0 "register_operand" "=r,r")
4935 (match_operand:V2DF 1 "<round_saeonly_nimm_scalar_predicate>" "v,<round_saeonly_constraint2>")
4936 (parallel [(const_int 0)]))))]
4937 "TARGET_SSE2 && TARGET_64BIT"
4938 "%vcvttsd2si{q}\t{<round_saeonly_op2>%1, %0|%0, %q1<round_saeonly_op2>}"
4939 [(set_attr "type" "sseicvt")
4940 (set_attr "athlon_decode" "double,vector")
4941 (set_attr "amdfam10_decode" "double,double")
4942 (set_attr "bdver1_decode" "double,double")
4943 (set_attr "prefix_rep" "1")
4944 (set_attr "prefix" "maybe_vex")
4945 (set_attr "mode" "DI")])
4947 ;; For float<si2dfmode><mode>2 insn pattern
4948 (define_mode_attr si2dfmode
4949 [(V8DF "V8SI") (V4DF "V4SI")])
4950 (define_mode_attr si2dfmodelower
4951 [(V8DF "v8si") (V4DF "v4si")])
4953 (define_insn "float<si2dfmodelower><mode>2<mask_name>"
4954 [(set (match_operand:VF2_512_256 0 "register_operand" "=v")
4955 (float:VF2_512_256 (match_operand:<si2dfmode> 1 "nonimmediate_operand" "vm")))]
4956 "TARGET_AVX && <mask_mode512bit_condition>"
4957 "vcvtdq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4958 [(set_attr "type" "ssecvt")
4959 (set_attr "prefix" "maybe_vex")
4960 (set_attr "mode" "<MODE>")])
4962 (define_insn "<floatsuffix>float<sseintvecmodelower><mode>2<mask_name><round_name>"
4963 [(set (match_operand:VF2_AVX512VL 0 "register_operand" "=v")
4964 (any_float:VF2_AVX512VL
4965 (match_operand:<sseintvecmode> 1 "nonimmediate_operand" "<round_constraint>")))]
4967 "vcvt<floatsuffix>qq2pd\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4968 [(set_attr "type" "ssecvt")
4969 (set_attr "prefix" "evex")
4970 (set_attr "mode" "<MODE>")])
4972 ;; For <floatsuffix>float<sselondveclower><mode> insn patterns
4973 (define_mode_attr qq2pssuff
4974 [(V8SF "") (V4SF "{y}")])
4976 (define_mode_attr sselongvecmode
4977 [(V8SF "V8DI") (V4SF "V4DI")])
4979 (define_mode_attr sselongvecmodelower
4980 [(V8SF "v8di") (V4SF "v4di")])
4982 (define_mode_attr sseintvecmode3
4983 [(V8SF "XI") (V4SF "OI")
4984 (V8DF "OI") (V4DF "TI")])
4986 (define_insn "<floatsuffix>float<sselongvecmodelower><mode>2<mask_name><round_name>"
4987 [(set (match_operand:VF1_128_256VL 0 "register_operand" "=v")
4988 (any_float:VF1_128_256VL
4989 (match_operand:<sselongvecmode> 1 "nonimmediate_operand" "<round_constraint>")))]
4990 "TARGET_AVX512DQ && <round_modev8sf_condition>"
4991 "vcvt<floatsuffix>qq2ps<qq2pssuff>\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4992 [(set_attr "type" "ssecvt")
4993 (set_attr "prefix" "evex")
4994 (set_attr "mode" "<MODE>")])
4996 (define_insn "*<floatsuffix>floatv2div2sf2"
4997 [(set (match_operand:V4SF 0 "register_operand" "=v")
4999 (any_float:V2SF (match_operand:V2DI 1 "nonimmediate_operand" "vm"))
5000 (const_vector:V2SF [(const_int 0) (const_int 0)])))]
5001 "TARGET_AVX512DQ && TARGET_AVX512VL"
5002 "vcvt<floatsuffix>qq2ps{x}\t{%1, %0|%0, %1}"
5003 [(set_attr "type" "ssecvt")
5004 (set_attr "prefix" "evex")
5005 (set_attr "mode" "V4SF")])
5007 (define_insn "<floatsuffix>floatv2div2sf2_mask"
5008 [(set (match_operand:V4SF 0 "register_operand" "=v")
5011 (any_float:V2SF (match_operand:V2DI 1 "nonimmediate_operand" "vm"))
5013 (match_operand:V4SF 2 "vector_move_operand" "0C")
5014 (parallel [(const_int 0) (const_int 1)]))
5015 (match_operand:QI 3 "register_operand" "Yk"))
5016 (const_vector:V2SF [(const_int 0) (const_int 0)])))]
5017 "TARGET_AVX512DQ && TARGET_AVX512VL"
5018 "vcvt<floatsuffix>qq2ps{x}\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
5019 [(set_attr "type" "ssecvt")
5020 (set_attr "prefix" "evex")
5021 (set_attr "mode" "V4SF")])
5023 (define_insn "*<floatsuffix>floatv2div2sf2_mask_1"
5024 [(set (match_operand:V4SF 0 "register_operand" "=v")
5027 (any_float:V2SF (match_operand:V2DI 1
5028 "nonimmediate_operand" "vm"))
5029 (const_vector:V2SF [(const_int 0) (const_int 0)])
5030 (match_operand:QI 2 "register_operand" "Yk"))
5031 (const_vector:V2SF [(const_int 0) (const_int 0)])))]
5032 "TARGET_AVX512DQ && TARGET_AVX512VL"
5033 "vcvt<floatsuffix>qq2ps{x}\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
5034 [(set_attr "type" "ssecvt")
5035 (set_attr "prefix" "evex")
5036 (set_attr "mode" "V4SF")])
5038 (define_insn "ufloat<si2dfmodelower><mode>2<mask_name>"
5039 [(set (match_operand:VF2_512_256VL 0 "register_operand" "=v")
5040 (unsigned_float:VF2_512_256VL
5041 (match_operand:<si2dfmode> 1 "nonimmediate_operand" "vm")))]
5043 "vcvtudq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5044 [(set_attr "type" "ssecvt")
5045 (set_attr "prefix" "evex")
5046 (set_attr "mode" "<MODE>")])
5048 (define_insn "ufloatv2siv2df2<mask_name>"
5049 [(set (match_operand:V2DF 0 "register_operand" "=v")
5050 (unsigned_float:V2DF
5052 (match_operand:V4SI 1 "nonimmediate_operand" "vm")
5053 (parallel [(const_int 0) (const_int 1)]))))]
5055 "vcvtudq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5056 [(set_attr "type" "ssecvt")
5057 (set_attr "prefix" "evex")
5058 (set_attr "mode" "V2DF")])
5060 (define_insn "avx512f_cvtdq2pd512_2"
5061 [(set (match_operand:V8DF 0 "register_operand" "=v")
5064 (match_operand:V16SI 1 "nonimmediate_operand" "vm")
5065 (parallel [(const_int 0) (const_int 1)
5066 (const_int 2) (const_int 3)
5067 (const_int 4) (const_int 5)
5068 (const_int 6) (const_int 7)]))))]
5070 "vcvtdq2pd\t{%t1, %0|%0, %t1}"
5071 [(set_attr "type" "ssecvt")
5072 (set_attr "prefix" "evex")
5073 (set_attr "mode" "V8DF")])
5075 (define_insn "avx_cvtdq2pd256_2"
5076 [(set (match_operand:V4DF 0 "register_operand" "=v")
5079 (match_operand:V8SI 1 "nonimmediate_operand" "vm")
5080 (parallel [(const_int 0) (const_int 1)
5081 (const_int 2) (const_int 3)]))))]
5083 "vcvtdq2pd\t{%x1, %0|%0, %x1}"
5084 [(set_attr "type" "ssecvt")
5085 (set_attr "prefix" "maybe_evex")
5086 (set_attr "mode" "V4DF")])
5088 (define_insn "sse2_cvtdq2pd<mask_name>"
5089 [(set (match_operand:V2DF 0 "register_operand" "=v")
5092 (match_operand:V4SI 1 "nonimmediate_operand" "vm")
5093 (parallel [(const_int 0) (const_int 1)]))))]
5094 "TARGET_SSE2 && <mask_avx512vl_condition>"
5095 "%vcvtdq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
5096 [(set_attr "type" "ssecvt")
5097 (set_attr "prefix" "maybe_vex")
5098 (set_attr "mode" "V2DF")])
5100 (define_insn "avx512f_cvtpd2dq512<mask_name><round_name>"
5101 [(set (match_operand:V8SI 0 "register_operand" "=v")
5103 [(match_operand:V8DF 1 "<round_nimm_predicate>" "<round_constraint>")]
5104 UNSPEC_FIX_NOTRUNC))]
5106 "vcvtpd2dq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5107 [(set_attr "type" "ssecvt")
5108 (set_attr "prefix" "evex")
5109 (set_attr "mode" "OI")])
5111 (define_insn "avx_cvtpd2dq256<mask_name>"
5112 [(set (match_operand:V4SI 0 "register_operand" "=v")
5113 (unspec:V4SI [(match_operand:V4DF 1 "nonimmediate_operand" "vm")]
5114 UNSPEC_FIX_NOTRUNC))]
5115 "TARGET_AVX && <mask_avx512vl_condition>"
5116 "vcvtpd2dq{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5117 [(set_attr "type" "ssecvt")
5118 (set_attr "prefix" "<mask_prefix>")
5119 (set_attr "mode" "OI")])
5121 (define_expand "avx_cvtpd2dq256_2"
5122 [(set (match_operand:V8SI 0 "register_operand")
5124 (unspec:V4SI [(match_operand:V4DF 1 "nonimmediate_operand")]
5128 "operands[2] = CONST0_RTX (V4SImode);")
5130 (define_insn "*avx_cvtpd2dq256_2"
5131 [(set (match_operand:V8SI 0 "register_operand" "=v")
5133 (unspec:V4SI [(match_operand:V4DF 1 "nonimmediate_operand" "vm")]
5135 (match_operand:V4SI 2 "const0_operand")))]
5137 "vcvtpd2dq{y}\t{%1, %x0|%x0, %1}"
5138 [(set_attr "type" "ssecvt")
5139 (set_attr "prefix" "vex")
5140 (set_attr "btver2_decode" "vector")
5141 (set_attr "mode" "OI")])
5143 (define_insn "sse2_cvtpd2dq<mask_name>"
5144 [(set (match_operand:V4SI 0 "register_operand" "=v")
5146 (unspec:V2SI [(match_operand:V2DF 1 "vector_operand" "vBm")]
5148 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
5149 "TARGET_SSE2 && <mask_avx512vl_condition>"
5152 return "vcvtpd2dq{x}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}";
5154 return "cvtpd2dq\t{%1, %0|%0, %1}";
5156 [(set_attr "type" "ssecvt")
5157 (set_attr "prefix_rep" "1")
5158 (set_attr "prefix_data16" "0")
5159 (set_attr "prefix" "maybe_vex")
5160 (set_attr "mode" "TI")
5161 (set_attr "amdfam10_decode" "double")
5162 (set_attr "athlon_decode" "vector")
5163 (set_attr "bdver1_decode" "double")])
5165 ;; For ufix_notrunc* insn patterns
5166 (define_mode_attr pd2udqsuff
5167 [(V8DF "") (V4DF "{y}")])
5169 (define_insn "ufix_notrunc<mode><si2dfmodelower>2<mask_name><round_name>"
5170 [(set (match_operand:<si2dfmode> 0 "register_operand" "=v")
5172 [(match_operand:VF2_512_256VL 1 "nonimmediate_operand" "<round_constraint>")]
5173 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
5175 "vcvtpd2udq<pd2udqsuff>\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5176 [(set_attr "type" "ssecvt")
5177 (set_attr "prefix" "evex")
5178 (set_attr "mode" "<sseinsnmode>")])
5180 (define_insn "ufix_notruncv2dfv2si2<mask_name>"
5181 [(set (match_operand:V4SI 0 "register_operand" "=v")
5184 [(match_operand:V2DF 1 "nonimmediate_operand" "vm")]
5185 UNSPEC_UNSIGNED_FIX_NOTRUNC)
5186 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
5188 "vcvtpd2udq{x}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5189 [(set_attr "type" "ssecvt")
5190 (set_attr "prefix" "evex")
5191 (set_attr "mode" "TI")])
5193 (define_insn "<fixsuffix>fix_truncv8dfv8si2<mask_name><round_saeonly_name>"
5194 [(set (match_operand:V8SI 0 "register_operand" "=v")
5196 (match_operand:V8DF 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
5198 "vcvttpd2<fixsuffix>dq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
5199 [(set_attr "type" "ssecvt")
5200 (set_attr "prefix" "evex")
5201 (set_attr "mode" "OI")])
5203 (define_insn "ufix_truncv2dfv2si2<mask_name>"
5204 [(set (match_operand:V4SI 0 "register_operand" "=v")
5206 (unsigned_fix:V2SI (match_operand:V2DF 1 "nonimmediate_operand" "vm"))
5207 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
5209 "vcvttpd2udq{x}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5210 [(set_attr "type" "ssecvt")
5211 (set_attr "prefix" "evex")
5212 (set_attr "mode" "TI")])
5214 (define_insn "fix_truncv4dfv4si2<mask_name>"
5215 [(set (match_operand:V4SI 0 "register_operand" "=v")
5216 (fix:V4SI (match_operand:V4DF 1 "nonimmediate_operand" "vm")))]
5217 "TARGET_AVX || (TARGET_AVX512VL && TARGET_AVX512F)"
5218 "vcvttpd2dq{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5219 [(set_attr "type" "ssecvt")
5220 (set_attr "prefix" "maybe_evex")
5221 (set_attr "mode" "OI")])
5223 (define_insn "ufix_truncv4dfv4si2<mask_name>"
5224 [(set (match_operand:V4SI 0 "register_operand" "=v")
5225 (unsigned_fix:V4SI (match_operand:V4DF 1 "nonimmediate_operand" "vm")))]
5226 "TARGET_AVX512VL && TARGET_AVX512F"
5227 "vcvttpd2udq{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5228 [(set_attr "type" "ssecvt")
5229 (set_attr "prefix" "maybe_evex")
5230 (set_attr "mode" "OI")])
5232 (define_insn "<fixsuffix>fix_trunc<mode><sseintvecmodelower>2<mask_name><round_saeonly_name>"
5233 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
5234 (any_fix:<sseintvecmode>
5235 (match_operand:VF2_AVX512VL 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
5236 "TARGET_AVX512DQ && <round_saeonly_mode512bit_condition>"
5237 "vcvttpd2<fixsuffix>qq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
5238 [(set_attr "type" "ssecvt")
5239 (set_attr "prefix" "evex")
5240 (set_attr "mode" "<sseintvecmode2>")])
5242 (define_insn "fix_notrunc<mode><sseintvecmodelower>2<mask_name><round_name>"
5243 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
5244 (unspec:<sseintvecmode>
5245 [(match_operand:VF2_AVX512VL 1 "<round_nimm_predicate>" "<round_constraint>")]
5246 UNSPEC_FIX_NOTRUNC))]
5247 "TARGET_AVX512DQ && <round_mode512bit_condition>"
5248 "vcvtpd2qq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5249 [(set_attr "type" "ssecvt")
5250 (set_attr "prefix" "evex")
5251 (set_attr "mode" "<sseintvecmode2>")])
5253 (define_insn "ufix_notrunc<mode><sseintvecmodelower>2<mask_name><round_name>"
5254 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
5255 (unspec:<sseintvecmode>
5256 [(match_operand:VF2_AVX512VL 1 "nonimmediate_operand" "<round_constraint>")]
5257 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
5258 "TARGET_AVX512DQ && <round_mode512bit_condition>"
5259 "vcvtpd2uqq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5260 [(set_attr "type" "ssecvt")
5261 (set_attr "prefix" "evex")
5262 (set_attr "mode" "<sseintvecmode2>")])
5264 (define_insn "<fixsuffix>fix_trunc<mode><sselongvecmodelower>2<mask_name><round_saeonly_name>"
5265 [(set (match_operand:<sselongvecmode> 0 "register_operand" "=v")
5266 (any_fix:<sselongvecmode>
5267 (match_operand:VF1_128_256VL 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
5268 "TARGET_AVX512DQ && <round_saeonly_modev8sf_condition>"
5269 "vcvttps2<fixsuffix>qq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
5270 [(set_attr "type" "ssecvt")
5271 (set_attr "prefix" "evex")
5272 (set_attr "mode" "<sseintvecmode3>")])
5274 (define_insn "<fixsuffix>fix_truncv2sfv2di2<mask_name>"
5275 [(set (match_operand:V2DI 0 "register_operand" "=v")
5278 (match_operand:V4SF 1 "nonimmediate_operand" "vm")
5279 (parallel [(const_int 0) (const_int 1)]))))]
5280 "TARGET_AVX512DQ && TARGET_AVX512VL"
5281 "vcvttps2<fixsuffix>qq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
5282 [(set_attr "type" "ssecvt")
5283 (set_attr "prefix" "evex")
5284 (set_attr "mode" "TI")])
5286 (define_insn "ufix_trunc<mode><sseintvecmodelower>2<mask_name>"
5287 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
5288 (unsigned_fix:<sseintvecmode>
5289 (match_operand:VF1_128_256VL 1 "nonimmediate_operand" "vm")))]
5291 "vcvttps2udq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5292 [(set_attr "type" "ssecvt")
5293 (set_attr "prefix" "evex")
5294 (set_attr "mode" "<sseintvecmode2>")])
5296 (define_expand "avx_cvttpd2dq256_2"
5297 [(set (match_operand:V8SI 0 "register_operand")
5299 (fix:V4SI (match_operand:V4DF 1 "nonimmediate_operand"))
5302 "operands[2] = CONST0_RTX (V4SImode);")
5304 (define_insn "sse2_cvttpd2dq<mask_name>"
5305 [(set (match_operand:V4SI 0 "register_operand" "=v")
5307 (fix:V2SI (match_operand:V2DF 1 "vector_operand" "vBm"))
5308 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
5309 "TARGET_SSE2 && <mask_avx512vl_condition>"
5312 return "vcvttpd2dq{x}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}";
5314 return "cvttpd2dq\t{%1, %0|%0, %1}";
5316 [(set_attr "type" "ssecvt")
5317 (set_attr "amdfam10_decode" "double")
5318 (set_attr "athlon_decode" "vector")
5319 (set_attr "bdver1_decode" "double")
5320 (set_attr "prefix" "maybe_vex")
5321 (set_attr "mode" "TI")])
5323 (define_insn "sse2_cvtsd2ss<round_name>"
5324 [(set (match_operand:V4SF 0 "register_operand" "=x,x,v")
5327 (float_truncate:V2SF
5328 (match_operand:V2DF 2 "nonimmediate_operand" "x,m,<round_constraint>")))
5329 (match_operand:V4SF 1 "register_operand" "0,0,v")
5333 cvtsd2ss\t{%2, %0|%0, %2}
5334 cvtsd2ss\t{%2, %0|%0, %q2}
5335 vcvtsd2ss\t{<round_op3>%2, %1, %0|%0, %1, %q2<round_op3>}"
5336 [(set_attr "isa" "noavx,noavx,avx")
5337 (set_attr "type" "ssecvt")
5338 (set_attr "athlon_decode" "vector,double,*")
5339 (set_attr "amdfam10_decode" "vector,double,*")
5340 (set_attr "bdver1_decode" "direct,direct,*")
5341 (set_attr "btver2_decode" "double,double,double")
5342 (set_attr "prefix" "orig,orig,<round_prefix>")
5343 (set_attr "mode" "SF")])
5345 (define_insn "*sse2_vd_cvtsd2ss"
5346 [(set (match_operand:V4SF 0 "register_operand" "=x,x,v")
5349 (float_truncate:SF (match_operand:DF 2 "nonimmediate_operand" "x,m,vm")))
5350 (match_operand:V4SF 1 "register_operand" "0,0,v")
5354 cvtsd2ss\t{%2, %0|%0, %2}
5355 cvtsd2ss\t{%2, %0|%0, %2}
5356 vcvtsd2ss\t{%2, %1, %0|%0, %1, %2}"
5357 [(set_attr "isa" "noavx,noavx,avx")
5358 (set_attr "type" "ssecvt")
5359 (set_attr "athlon_decode" "vector,double,*")
5360 (set_attr "amdfam10_decode" "vector,double,*")
5361 (set_attr "bdver1_decode" "direct,direct,*")
5362 (set_attr "btver2_decode" "double,double,double")
5363 (set_attr "prefix" "orig,orig,vex")
5364 (set_attr "mode" "SF")])
5366 (define_insn "sse2_cvtss2sd<round_saeonly_name>"
5367 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
5371 (match_operand:V4SF 2 "<round_saeonly_nimm_scalar_predicate>" "x,m,<round_saeonly_constraint>")
5372 (parallel [(const_int 0) (const_int 1)])))
5373 (match_operand:V2DF 1 "register_operand" "0,0,v")
5377 cvtss2sd\t{%2, %0|%0, %2}
5378 cvtss2sd\t{%2, %0|%0, %k2}
5379 vcvtss2sd\t{<round_saeonly_op3>%2, %1, %0|%0, %1, %k2<round_saeonly_op3>}"
5380 [(set_attr "isa" "noavx,noavx,avx")
5381 (set_attr "type" "ssecvt")
5382 (set_attr "amdfam10_decode" "vector,double,*")
5383 (set_attr "athlon_decode" "direct,direct,*")
5384 (set_attr "bdver1_decode" "direct,direct,*")
5385 (set_attr "btver2_decode" "double,double,double")
5386 (set_attr "prefix" "orig,orig,<round_saeonly_prefix>")
5387 (set_attr "mode" "DF")])
5389 (define_insn "*sse2_vd_cvtss2sd"
5390 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
5393 (float_extend:DF (match_operand:SF 2 "nonimmediate_operand" "x,m,vm")))
5394 (match_operand:V2DF 1 "register_operand" "0,0,v")
5398 cvtss2sd\t{%2, %0|%0, %2}
5399 cvtss2sd\t{%2, %0|%0, %2}
5400 vcvtss2sd\t{%2, %1, %0|%0, %1, %2}"
5401 [(set_attr "isa" "noavx,noavx,avx")
5402 (set_attr "type" "ssecvt")
5403 (set_attr "amdfam10_decode" "vector,double,*")
5404 (set_attr "athlon_decode" "direct,direct,*")
5405 (set_attr "bdver1_decode" "direct,direct,*")
5406 (set_attr "btver2_decode" "double,double,double")
5407 (set_attr "prefix" "orig,orig,vex")
5408 (set_attr "mode" "DF")])
5410 (define_insn "<mask_codefor>avx512f_cvtpd2ps512<mask_name><round_name>"
5411 [(set (match_operand:V8SF 0 "register_operand" "=v")
5412 (float_truncate:V8SF
5413 (match_operand:V8DF 1 "<round_nimm_predicate>" "<round_constraint>")))]
5415 "vcvtpd2ps\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5416 [(set_attr "type" "ssecvt")
5417 (set_attr "prefix" "evex")
5418 (set_attr "mode" "V8SF")])
5420 (define_insn "avx_cvtpd2ps256<mask_name>"
5421 [(set (match_operand:V4SF 0 "register_operand" "=v")
5422 (float_truncate:V4SF
5423 (match_operand:V4DF 1 "nonimmediate_operand" "vm")))]
5424 "TARGET_AVX && <mask_avx512vl_condition>"
5425 "vcvtpd2ps{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5426 [(set_attr "type" "ssecvt")
5427 (set_attr "prefix" "maybe_evex")
5428 (set_attr "btver2_decode" "vector")
5429 (set_attr "mode" "V4SF")])
5431 (define_expand "sse2_cvtpd2ps"
5432 [(set (match_operand:V4SF 0 "register_operand")
5434 (float_truncate:V2SF
5435 (match_operand:V2DF 1 "vector_operand"))
5438 "operands[2] = CONST0_RTX (V2SFmode);")
5440 (define_expand "sse2_cvtpd2ps_mask"
5441 [(set (match_operand:V4SF 0 "register_operand")
5444 (float_truncate:V2SF
5445 (match_operand:V2DF 1 "vector_operand"))
5447 (match_operand:V4SF 2 "register_operand")
5448 (match_operand:QI 3 "register_operand")))]
5450 "operands[4] = CONST0_RTX (V2SFmode);")
5452 (define_insn "*sse2_cvtpd2ps<mask_name>"
5453 [(set (match_operand:V4SF 0 "register_operand" "=v")
5455 (float_truncate:V2SF
5456 (match_operand:V2DF 1 "vector_operand" "vBm"))
5457 (match_operand:V2SF 2 "const0_operand")))]
5458 "TARGET_SSE2 && <mask_avx512vl_condition>"
5461 return "vcvtpd2ps{x}\t{%1, %0<mask_operand3>|%0<mask_operand3>, %1}";
5463 return "cvtpd2ps\t{%1, %0|%0, %1}";
5465 [(set_attr "type" "ssecvt")
5466 (set_attr "amdfam10_decode" "double")
5467 (set_attr "athlon_decode" "vector")
5468 (set_attr "bdver1_decode" "double")
5469 (set_attr "prefix_data16" "1")
5470 (set_attr "prefix" "maybe_vex")
5471 (set_attr "mode" "V4SF")])
5473 ;; For <sse2_avx_avx512f>_cvtps2pd<avxsizesuffix> insn pattern
5474 (define_mode_attr sf2dfmode
5475 [(V8DF "V8SF") (V4DF "V4SF")])
5477 (define_insn "<sse2_avx_avx512f>_cvtps2pd<avxsizesuffix><mask_name><round_saeonly_name>"
5478 [(set (match_operand:VF2_512_256 0 "register_operand" "=v")
5479 (float_extend:VF2_512_256
5480 (match_operand:<sf2dfmode> 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
5481 "TARGET_AVX && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
5482 "vcvtps2pd\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
5483 [(set_attr "type" "ssecvt")
5484 (set_attr "prefix" "maybe_vex")
5485 (set_attr "mode" "<MODE>")])
5487 (define_insn "*avx_cvtps2pd256_2"
5488 [(set (match_operand:V4DF 0 "register_operand" "=v")
5491 (match_operand:V8SF 1 "nonimmediate_operand" "vm")
5492 (parallel [(const_int 0) (const_int 1)
5493 (const_int 2) (const_int 3)]))))]
5495 "vcvtps2pd\t{%x1, %0|%0, %x1}"
5496 [(set_attr "type" "ssecvt")
5497 (set_attr "prefix" "vex")
5498 (set_attr "mode" "V4DF")])
5500 (define_insn "vec_unpacks_lo_v16sf"
5501 [(set (match_operand:V8DF 0 "register_operand" "=v")
5504 (match_operand:V16SF 1 "nonimmediate_operand" "vm")
5505 (parallel [(const_int 0) (const_int 1)
5506 (const_int 2) (const_int 3)
5507 (const_int 4) (const_int 5)
5508 (const_int 6) (const_int 7)]))))]
5510 "vcvtps2pd\t{%t1, %0|%0, %t1}"
5511 [(set_attr "type" "ssecvt")
5512 (set_attr "prefix" "evex")
5513 (set_attr "mode" "V8DF")])
5515 (define_insn "<avx512>_cvt<ssemodesuffix>2mask<mode>"
5516 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
5517 (unspec:<avx512fmaskmode>
5518 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")]
5519 UNSPEC_CVTINT2MASK))]
5521 "vpmov<ssemodesuffix>2m\t{%1, %0|%0, %1}"
5522 [(set_attr "prefix" "evex")
5523 (set_attr "mode" "<sseinsnmode>")])
5525 (define_insn "<avx512>_cvt<ssemodesuffix>2mask<mode>"
5526 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
5527 (unspec:<avx512fmaskmode>
5528 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")]
5529 UNSPEC_CVTINT2MASK))]
5531 "vpmov<ssemodesuffix>2m\t{%1, %0|%0, %1}"
5532 [(set_attr "prefix" "evex")
5533 (set_attr "mode" "<sseinsnmode>")])
5535 (define_expand "<avx512>_cvtmask2<ssemodesuffix><mode>"
5536 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
5537 (vec_merge:VI12_AVX512VL
5540 (match_operand:<avx512fmaskmode> 1 "register_operand")))]
5543 operands[2] = CONSTM1_RTX (<MODE>mode);
5544 operands[3] = CONST0_RTX (<MODE>mode);
5547 (define_insn "*<avx512>_cvtmask2<ssemodesuffix><mode>"
5548 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
5549 (vec_merge:VI12_AVX512VL
5550 (match_operand:VI12_AVX512VL 2 "vector_all_ones_operand")
5551 (match_operand:VI12_AVX512VL 3 "const0_operand")
5552 (match_operand:<avx512fmaskmode> 1 "register_operand" "Yk")))]
5554 "vpmovm2<ssemodesuffix>\t{%1, %0|%0, %1}"
5555 [(set_attr "prefix" "evex")
5556 (set_attr "mode" "<sseinsnmode>")])
5558 (define_expand "<avx512>_cvtmask2<ssemodesuffix><mode>"
5559 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
5560 (vec_merge:VI48_AVX512VL
5563 (match_operand:<avx512fmaskmode> 1 "register_operand")))]
5566 operands[2] = CONSTM1_RTX (<MODE>mode);
5567 operands[3] = CONST0_RTX (<MODE>mode);
5570 (define_insn "*<avx512>_cvtmask2<ssemodesuffix><mode>"
5571 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
5572 (vec_merge:VI48_AVX512VL
5573 (match_operand:VI48_AVX512VL 2 "vector_all_ones_operand")
5574 (match_operand:VI48_AVX512VL 3 "const0_operand")
5575 (match_operand:<avx512fmaskmode> 1 "register_operand" "Yk")))]
5577 "vpmovm2<ssemodesuffix>\t{%1, %0|%0, %1}"
5578 [(set_attr "prefix" "evex")
5579 (set_attr "mode" "<sseinsnmode>")])
5581 (define_insn "sse2_cvtps2pd<mask_name>"
5582 [(set (match_operand:V2DF 0 "register_operand" "=v")
5585 (match_operand:V4SF 1 "vector_operand" "vm")
5586 (parallel [(const_int 0) (const_int 1)]))))]
5587 "TARGET_SSE2 && <mask_avx512vl_condition>"
5588 "%vcvtps2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
5589 [(set_attr "type" "ssecvt")
5590 (set_attr "amdfam10_decode" "direct")
5591 (set_attr "athlon_decode" "double")
5592 (set_attr "bdver1_decode" "double")
5593 (set_attr "prefix_data16" "0")
5594 (set_attr "prefix" "maybe_vex")
5595 (set_attr "mode" "V2DF")])
5597 (define_expand "vec_unpacks_hi_v4sf"
5602 (match_operand:V4SF 1 "vector_operand"))
5603 (parallel [(const_int 6) (const_int 7)
5604 (const_int 2) (const_int 3)])))
5605 (set (match_operand:V2DF 0 "register_operand")
5609 (parallel [(const_int 0) (const_int 1)]))))]
5611 "operands[2] = gen_reg_rtx (V4SFmode);")
5613 (define_expand "vec_unpacks_hi_v8sf"
5616 (match_operand:V8SF 1 "register_operand")
5617 (parallel [(const_int 4) (const_int 5)
5618 (const_int 6) (const_int 7)])))
5619 (set (match_operand:V4DF 0 "register_operand")
5623 "operands[2] = gen_reg_rtx (V4SFmode);")
5625 (define_expand "vec_unpacks_hi_v16sf"
5628 (match_operand:V16SF 1 "register_operand")
5629 (parallel [(const_int 8) (const_int 9)
5630 (const_int 10) (const_int 11)
5631 (const_int 12) (const_int 13)
5632 (const_int 14) (const_int 15)])))
5633 (set (match_operand:V8DF 0 "register_operand")
5637 "operands[2] = gen_reg_rtx (V8SFmode);")
5639 (define_expand "vec_unpacks_lo_v4sf"
5640 [(set (match_operand:V2DF 0 "register_operand")
5643 (match_operand:V4SF 1 "vector_operand")
5644 (parallel [(const_int 0) (const_int 1)]))))]
5647 (define_expand "vec_unpacks_lo_v8sf"
5648 [(set (match_operand:V4DF 0 "register_operand")
5651 (match_operand:V8SF 1 "nonimmediate_operand")
5652 (parallel [(const_int 0) (const_int 1)
5653 (const_int 2) (const_int 3)]))))]
5656 (define_mode_attr sseunpackfltmode
5657 [(V8HI "V4SF") (V4SI "V2DF") (V16HI "V8SF")
5658 (V8SI "V4DF") (V32HI "V16SF") (V16SI "V8DF")])
5660 (define_expand "vec_unpacks_float_hi_<mode>"
5661 [(match_operand:<sseunpackfltmode> 0 "register_operand")
5662 (match_operand:VI2_AVX512F 1 "register_operand")]
5665 rtx tmp = gen_reg_rtx (<sseunpackmode>mode);
5667 emit_insn (gen_vec_unpacks_hi_<mode> (tmp, operands[1]));
5668 emit_insn (gen_rtx_SET (operands[0],
5669 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
5673 (define_expand "vec_unpacks_float_lo_<mode>"
5674 [(match_operand:<sseunpackfltmode> 0 "register_operand")
5675 (match_operand:VI2_AVX512F 1 "register_operand")]
5678 rtx tmp = gen_reg_rtx (<sseunpackmode>mode);
5680 emit_insn (gen_vec_unpacks_lo_<mode> (tmp, operands[1]));
5681 emit_insn (gen_rtx_SET (operands[0],
5682 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
5686 (define_expand "vec_unpacku_float_hi_<mode>"
5687 [(match_operand:<sseunpackfltmode> 0 "register_operand")
5688 (match_operand:VI2_AVX512F 1 "register_operand")]
5691 rtx tmp = gen_reg_rtx (<sseunpackmode>mode);
5693 emit_insn (gen_vec_unpacku_hi_<mode> (tmp, operands[1]));
5694 emit_insn (gen_rtx_SET (operands[0],
5695 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
5699 (define_expand "vec_unpacku_float_lo_<mode>"
5700 [(match_operand:<sseunpackfltmode> 0 "register_operand")
5701 (match_operand:VI2_AVX512F 1 "register_operand")]
5704 rtx tmp = gen_reg_rtx (<sseunpackmode>mode);
5706 emit_insn (gen_vec_unpacku_lo_<mode> (tmp, operands[1]));
5707 emit_insn (gen_rtx_SET (operands[0],
5708 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
5712 (define_expand "vec_unpacks_float_hi_v4si"
5715 (match_operand:V4SI 1 "vector_operand")
5716 (parallel [(const_int 2) (const_int 3)
5717 (const_int 2) (const_int 3)])))
5718 (set (match_operand:V2DF 0 "register_operand")
5722 (parallel [(const_int 0) (const_int 1)]))))]
5724 "operands[2] = gen_reg_rtx (V4SImode);")
5726 (define_expand "vec_unpacks_float_lo_v4si"
5727 [(set (match_operand:V2DF 0 "register_operand")
5730 (match_operand:V4SI 1 "vector_operand")
5731 (parallel [(const_int 0) (const_int 1)]))))]
5734 (define_expand "vec_unpacks_float_hi_v8si"
5737 (match_operand:V8SI 1 "vector_operand")
5738 (parallel [(const_int 4) (const_int 5)
5739 (const_int 6) (const_int 7)])))
5740 (set (match_operand:V4DF 0 "register_operand")
5744 "operands[2] = gen_reg_rtx (V4SImode);")
5746 (define_expand "vec_unpacks_float_lo_v8si"
5747 [(set (match_operand:V4DF 0 "register_operand")
5750 (match_operand:V8SI 1 "nonimmediate_operand")
5751 (parallel [(const_int 0) (const_int 1)
5752 (const_int 2) (const_int 3)]))))]
5755 (define_expand "vec_unpacks_float_hi_v16si"
5758 (match_operand:V16SI 1 "nonimmediate_operand")
5759 (parallel [(const_int 8) (const_int 9)
5760 (const_int 10) (const_int 11)
5761 (const_int 12) (const_int 13)
5762 (const_int 14) (const_int 15)])))
5763 (set (match_operand:V8DF 0 "register_operand")
5767 "operands[2] = gen_reg_rtx (V8SImode);")
5769 (define_expand "vec_unpacks_float_lo_v16si"
5770 [(set (match_operand:V8DF 0 "register_operand")
5773 (match_operand:V16SI 1 "nonimmediate_operand")
5774 (parallel [(const_int 0) (const_int 1)
5775 (const_int 2) (const_int 3)
5776 (const_int 4) (const_int 5)
5777 (const_int 6) (const_int 7)]))))]
5780 (define_expand "vec_unpacku_float_hi_v4si"
5783 (match_operand:V4SI 1 "vector_operand")
5784 (parallel [(const_int 2) (const_int 3)
5785 (const_int 2) (const_int 3)])))
5790 (parallel [(const_int 0) (const_int 1)]))))
5792 (lt:V2DF (match_dup 6) (match_dup 3)))
5794 (and:V2DF (match_dup 7) (match_dup 4)))
5795 (set (match_operand:V2DF 0 "register_operand")
5796 (plus:V2DF (match_dup 6) (match_dup 8)))]
5799 REAL_VALUE_TYPE TWO32r;
5803 real_ldexp (&TWO32r, &dconst1, 32);
5804 x = const_double_from_real_value (TWO32r, DFmode);
5806 operands[3] = force_reg (V2DFmode, CONST0_RTX (V2DFmode));
5807 operands[4] = force_reg (V2DFmode,
5808 ix86_build_const_vector (V2DFmode, 1, x));
5810 operands[5] = gen_reg_rtx (V4SImode);
5812 for (i = 6; i < 9; i++)
5813 operands[i] = gen_reg_rtx (V2DFmode);
5816 (define_expand "vec_unpacku_float_lo_v4si"
5820 (match_operand:V4SI 1 "vector_operand")
5821 (parallel [(const_int 0) (const_int 1)]))))
5823 (lt:V2DF (match_dup 5) (match_dup 3)))
5825 (and:V2DF (match_dup 6) (match_dup 4)))
5826 (set (match_operand:V2DF 0 "register_operand")
5827 (plus:V2DF (match_dup 5) (match_dup 7)))]
5830 REAL_VALUE_TYPE TWO32r;
5834 real_ldexp (&TWO32r, &dconst1, 32);
5835 x = const_double_from_real_value (TWO32r, DFmode);
5837 operands[3] = force_reg (V2DFmode, CONST0_RTX (V2DFmode));
5838 operands[4] = force_reg (V2DFmode,
5839 ix86_build_const_vector (V2DFmode, 1, x));
5841 for (i = 5; i < 8; i++)
5842 operands[i] = gen_reg_rtx (V2DFmode);
5845 (define_expand "vec_unpacku_float_hi_v8si"
5846 [(match_operand:V4DF 0 "register_operand")
5847 (match_operand:V8SI 1 "register_operand")]
5850 REAL_VALUE_TYPE TWO32r;
5854 real_ldexp (&TWO32r, &dconst1, 32);
5855 x = const_double_from_real_value (TWO32r, DFmode);
5857 tmp[0] = force_reg (V4DFmode, CONST0_RTX (V4DFmode));
5858 tmp[1] = force_reg (V4DFmode, ix86_build_const_vector (V4DFmode, 1, x));
5859 tmp[5] = gen_reg_rtx (V4SImode);
5861 for (i = 2; i < 5; i++)
5862 tmp[i] = gen_reg_rtx (V4DFmode);
5863 emit_insn (gen_vec_extract_hi_v8si (tmp[5], operands[1]));
5864 emit_insn (gen_floatv4siv4df2 (tmp[2], tmp[5]));
5865 emit_insn (gen_rtx_SET (tmp[3], gen_rtx_LT (V4DFmode, tmp[2], tmp[0])));
5866 emit_insn (gen_andv4df3 (tmp[4], tmp[3], tmp[1]));
5867 emit_insn (gen_addv4df3 (operands[0], tmp[2], tmp[4]));
5871 (define_expand "vec_unpacku_float_hi_v16si"
5872 [(match_operand:V8DF 0 "register_operand")
5873 (match_operand:V16SI 1 "register_operand")]
5876 REAL_VALUE_TYPE TWO32r;
5879 real_ldexp (&TWO32r, &dconst1, 32);
5880 x = const_double_from_real_value (TWO32r, DFmode);
5882 tmp[0] = force_reg (V8DFmode, CONST0_RTX (V8DFmode));
5883 tmp[1] = force_reg (V8DFmode, ix86_build_const_vector (V8DFmode, 1, x));
5884 tmp[2] = gen_reg_rtx (V8DFmode);
5885 tmp[3] = gen_reg_rtx (V8SImode);
5886 k = gen_reg_rtx (QImode);
5888 emit_insn (gen_vec_extract_hi_v16si (tmp[3], operands[1]));
5889 emit_insn (gen_floatv8siv8df2 (tmp[2], tmp[3]));
5890 emit_insn (gen_rtx_SET (k, gen_rtx_LT (QImode, tmp[2], tmp[0])));
5891 emit_insn (gen_addv8df3_mask (tmp[2], tmp[2], tmp[1], tmp[2], k));
5892 emit_move_insn (operands[0], tmp[2]);
5896 (define_expand "vec_unpacku_float_lo_v8si"
5897 [(match_operand:V4DF 0 "register_operand")
5898 (match_operand:V8SI 1 "nonimmediate_operand")]
5901 REAL_VALUE_TYPE TWO32r;
5905 real_ldexp (&TWO32r, &dconst1, 32);
5906 x = const_double_from_real_value (TWO32r, DFmode);
5908 tmp[0] = force_reg (V4DFmode, CONST0_RTX (V4DFmode));
5909 tmp[1] = force_reg (V4DFmode, ix86_build_const_vector (V4DFmode, 1, x));
5911 for (i = 2; i < 5; i++)
5912 tmp[i] = gen_reg_rtx (V4DFmode);
5913 emit_insn (gen_avx_cvtdq2pd256_2 (tmp[2], operands[1]));
5914 emit_insn (gen_rtx_SET (tmp[3], gen_rtx_LT (V4DFmode, tmp[2], tmp[0])));
5915 emit_insn (gen_andv4df3 (tmp[4], tmp[3], tmp[1]));
5916 emit_insn (gen_addv4df3 (operands[0], tmp[2], tmp[4]));
5920 (define_expand "vec_unpacku_float_lo_v16si"
5921 [(match_operand:V8DF 0 "register_operand")
5922 (match_operand:V16SI 1 "nonimmediate_operand")]
5925 REAL_VALUE_TYPE TWO32r;
5928 real_ldexp (&TWO32r, &dconst1, 32);
5929 x = const_double_from_real_value (TWO32r, DFmode);
5931 tmp[0] = force_reg (V8DFmode, CONST0_RTX (V8DFmode));
5932 tmp[1] = force_reg (V8DFmode, ix86_build_const_vector (V8DFmode, 1, x));
5933 tmp[2] = gen_reg_rtx (V8DFmode);
5934 k = gen_reg_rtx (QImode);
5936 emit_insn (gen_avx512f_cvtdq2pd512_2 (tmp[2], operands[1]));
5937 emit_insn (gen_rtx_SET (k, gen_rtx_LT (QImode, tmp[2], tmp[0])));
5938 emit_insn (gen_addv8df3_mask (tmp[2], tmp[2], tmp[1], tmp[2], k));
5939 emit_move_insn (operands[0], tmp[2]);
5943 (define_expand "vec_pack_trunc_<mode>"
5945 (float_truncate:<sf2dfmode>
5946 (match_operand:VF2_512_256 1 "nonimmediate_operand")))
5948 (float_truncate:<sf2dfmode>
5949 (match_operand:VF2_512_256 2 "nonimmediate_operand")))
5950 (set (match_operand:<ssePSmode> 0 "register_operand")
5951 (vec_concat:<ssePSmode>
5956 operands[3] = gen_reg_rtx (<sf2dfmode>mode);
5957 operands[4] = gen_reg_rtx (<sf2dfmode>mode);
5960 (define_expand "vec_pack_trunc_v2df"
5961 [(match_operand:V4SF 0 "register_operand")
5962 (match_operand:V2DF 1 "vector_operand")
5963 (match_operand:V2DF 2 "vector_operand")]
5968 if (TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
5970 tmp0 = gen_reg_rtx (V4DFmode);
5971 tmp1 = force_reg (V2DFmode, operands[1]);
5973 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
5974 emit_insn (gen_avx_cvtpd2ps256 (operands[0], tmp0));
5978 tmp0 = gen_reg_rtx (V4SFmode);
5979 tmp1 = gen_reg_rtx (V4SFmode);
5981 emit_insn (gen_sse2_cvtpd2ps (tmp0, operands[1]));
5982 emit_insn (gen_sse2_cvtpd2ps (tmp1, operands[2]));
5983 emit_insn (gen_sse_movlhps (operands[0], tmp0, tmp1));
5988 (define_expand "vec_pack_sfix_trunc_v8df"
5989 [(match_operand:V16SI 0 "register_operand")
5990 (match_operand:V8DF 1 "nonimmediate_operand")
5991 (match_operand:V8DF 2 "nonimmediate_operand")]
5996 r1 = gen_reg_rtx (V8SImode);
5997 r2 = gen_reg_rtx (V8SImode);
5999 emit_insn (gen_fix_truncv8dfv8si2 (r1, operands[1]));
6000 emit_insn (gen_fix_truncv8dfv8si2 (r2, operands[2]));
6001 emit_insn (gen_avx_vec_concatv16si (operands[0], r1, r2));
6005 (define_expand "vec_pack_sfix_trunc_v4df"
6006 [(match_operand:V8SI 0 "register_operand")
6007 (match_operand:V4DF 1 "nonimmediate_operand")
6008 (match_operand:V4DF 2 "nonimmediate_operand")]
6013 r1 = gen_reg_rtx (V4SImode);
6014 r2 = gen_reg_rtx (V4SImode);
6016 emit_insn (gen_fix_truncv4dfv4si2 (r1, operands[1]));
6017 emit_insn (gen_fix_truncv4dfv4si2 (r2, operands[2]));
6018 emit_insn (gen_avx_vec_concatv8si (operands[0], r1, r2));
6022 (define_expand "vec_pack_sfix_trunc_v2df"
6023 [(match_operand:V4SI 0 "register_operand")
6024 (match_operand:V2DF 1 "vector_operand")
6025 (match_operand:V2DF 2 "vector_operand")]
6028 rtx tmp0, tmp1, tmp2;
6030 if (TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
6032 tmp0 = gen_reg_rtx (V4DFmode);
6033 tmp1 = force_reg (V2DFmode, operands[1]);
6035 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
6036 emit_insn (gen_fix_truncv4dfv4si2 (operands[0], tmp0));
6040 tmp0 = gen_reg_rtx (V4SImode);
6041 tmp1 = gen_reg_rtx (V4SImode);
6042 tmp2 = gen_reg_rtx (V2DImode);
6044 emit_insn (gen_sse2_cvttpd2dq (tmp0, operands[1]));
6045 emit_insn (gen_sse2_cvttpd2dq (tmp1, operands[2]));
6046 emit_insn (gen_vec_interleave_lowv2di (tmp2,
6047 gen_lowpart (V2DImode, tmp0),
6048 gen_lowpart (V2DImode, tmp1)));
6049 emit_move_insn (operands[0], gen_lowpart (V4SImode, tmp2));
6054 (define_mode_attr ssepackfltmode
6055 [(V8DF "V16SI") (V4DF "V8SI") (V2DF "V4SI")])
6057 (define_expand "vec_pack_ufix_trunc_<mode>"
6058 [(match_operand:<ssepackfltmode> 0 "register_operand")
6059 (match_operand:VF2 1 "register_operand")
6060 (match_operand:VF2 2 "register_operand")]
6063 if (<MODE>mode == V8DFmode)
6067 r1 = gen_reg_rtx (V8SImode);
6068 r2 = gen_reg_rtx (V8SImode);
6070 emit_insn (gen_ufix_truncv8dfv8si2 (r1, operands[1]));
6071 emit_insn (gen_ufix_truncv8dfv8si2 (r2, operands[2]));
6072 emit_insn (gen_avx_vec_concatv16si (operands[0], r1, r2));
6077 tmp[0] = ix86_expand_adjust_ufix_to_sfix_si (operands[1], &tmp[2]);
6078 tmp[1] = ix86_expand_adjust_ufix_to_sfix_si (operands[2], &tmp[3]);
6079 tmp[4] = gen_reg_rtx (<ssepackfltmode>mode);
6080 emit_insn (gen_vec_pack_sfix_trunc_<mode> (tmp[4], tmp[0], tmp[1]));
6081 if (<ssepackfltmode>mode == V4SImode || TARGET_AVX2)
6083 tmp[5] = gen_reg_rtx (<ssepackfltmode>mode);
6084 ix86_expand_vec_extract_even_odd (tmp[5], tmp[2], tmp[3], 0);
6088 tmp[5] = gen_reg_rtx (V8SFmode);
6089 ix86_expand_vec_extract_even_odd (tmp[5],
6090 gen_lowpart (V8SFmode, tmp[2]),
6091 gen_lowpart (V8SFmode, tmp[3]), 0);
6092 tmp[5] = gen_lowpart (V8SImode, tmp[5]);
6094 tmp[6] = expand_simple_binop (<ssepackfltmode>mode, XOR, tmp[4], tmp[5],
6095 operands[0], 0, OPTAB_DIRECT);
6096 if (tmp[6] != operands[0])
6097 emit_move_insn (operands[0], tmp[6]);
6103 (define_expand "avx512f_vec_pack_sfix_v8df"
6104 [(match_operand:V16SI 0 "register_operand")
6105 (match_operand:V8DF 1 "nonimmediate_operand")
6106 (match_operand:V8DF 2 "nonimmediate_operand")]
6111 r1 = gen_reg_rtx (V8SImode);
6112 r2 = gen_reg_rtx (V8SImode);
6114 emit_insn (gen_avx512f_cvtpd2dq512 (r1, operands[1]));
6115 emit_insn (gen_avx512f_cvtpd2dq512 (r2, operands[2]));
6116 emit_insn (gen_avx_vec_concatv16si (operands[0], r1, r2));
6120 (define_expand "vec_pack_sfix_v4df"
6121 [(match_operand:V8SI 0 "register_operand")
6122 (match_operand:V4DF 1 "nonimmediate_operand")
6123 (match_operand:V4DF 2 "nonimmediate_operand")]
6128 r1 = gen_reg_rtx (V4SImode);
6129 r2 = gen_reg_rtx (V4SImode);
6131 emit_insn (gen_avx_cvtpd2dq256 (r1, operands[1]));
6132 emit_insn (gen_avx_cvtpd2dq256 (r2, operands[2]));
6133 emit_insn (gen_avx_vec_concatv8si (operands[0], r1, r2));
6137 (define_expand "vec_pack_sfix_v2df"
6138 [(match_operand:V4SI 0 "register_operand")
6139 (match_operand:V2DF 1 "vector_operand")
6140 (match_operand:V2DF 2 "vector_operand")]
6143 rtx tmp0, tmp1, tmp2;
6145 if (TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
6147 tmp0 = gen_reg_rtx (V4DFmode);
6148 tmp1 = force_reg (V2DFmode, operands[1]);
6150 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
6151 emit_insn (gen_avx_cvtpd2dq256 (operands[0], tmp0));
6155 tmp0 = gen_reg_rtx (V4SImode);
6156 tmp1 = gen_reg_rtx (V4SImode);
6157 tmp2 = gen_reg_rtx (V2DImode);
6159 emit_insn (gen_sse2_cvtpd2dq (tmp0, operands[1]));
6160 emit_insn (gen_sse2_cvtpd2dq (tmp1, operands[2]));
6161 emit_insn (gen_vec_interleave_lowv2di (tmp2,
6162 gen_lowpart (V2DImode, tmp0),
6163 gen_lowpart (V2DImode, tmp1)));
6164 emit_move_insn (operands[0], gen_lowpart (V4SImode, tmp2));
6169 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6171 ;; Parallel single-precision floating point element swizzling
6173 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6175 (define_expand "sse_movhlps_exp"
6176 [(set (match_operand:V4SF 0 "nonimmediate_operand")
6179 (match_operand:V4SF 1 "nonimmediate_operand")
6180 (match_operand:V4SF 2 "nonimmediate_operand"))
6181 (parallel [(const_int 6)
6187 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
6189 emit_insn (gen_sse_movhlps (dst, operands[1], operands[2]));
6191 /* Fix up the destination if needed. */
6192 if (dst != operands[0])
6193 emit_move_insn (operands[0], dst);
6198 (define_insn "sse_movhlps"
6199 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,v,x,v,m")
6202 (match_operand:V4SF 1 "nonimmediate_operand" " 0,v,0,v,0")
6203 (match_operand:V4SF 2 "nonimmediate_operand" " x,v,o,o,v"))
6204 (parallel [(const_int 6)
6208 "TARGET_SSE && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
6210 movhlps\t{%2, %0|%0, %2}
6211 vmovhlps\t{%2, %1, %0|%0, %1, %2}
6212 movlps\t{%H2, %0|%0, %H2}
6213 vmovlps\t{%H2, %1, %0|%0, %1, %H2}
6214 %vmovhps\t{%2, %0|%q0, %2}"
6215 [(set_attr "isa" "noavx,avx,noavx,avx,*")
6216 (set_attr "type" "ssemov")
6217 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,maybe_vex")
6218 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF,V2SF")])
6220 (define_expand "sse_movlhps_exp"
6221 [(set (match_operand:V4SF 0 "nonimmediate_operand")
6224 (match_operand:V4SF 1 "nonimmediate_operand")
6225 (match_operand:V4SF 2 "nonimmediate_operand"))
6226 (parallel [(const_int 0)
6232 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
6234 emit_insn (gen_sse_movlhps (dst, operands[1], operands[2]));
6236 /* Fix up the destination if needed. */
6237 if (dst != operands[0])
6238 emit_move_insn (operands[0], dst);
6243 (define_insn "sse_movlhps"
6244 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,v,x,v,o")
6247 (match_operand:V4SF 1 "nonimmediate_operand" " 0,v,0,v,0")
6248 (match_operand:V4SF 2 "nonimmediate_operand" " x,v,m,v,v"))
6249 (parallel [(const_int 0)
6253 "TARGET_SSE && ix86_binary_operator_ok (UNKNOWN, V4SFmode, operands)"
6255 movlhps\t{%2, %0|%0, %2}
6256 vmovlhps\t{%2, %1, %0|%0, %1, %2}
6257 movhps\t{%2, %0|%0, %q2}
6258 vmovhps\t{%2, %1, %0|%0, %1, %q2}
6259 %vmovlps\t{%2, %H0|%H0, %2}"
6260 [(set_attr "isa" "noavx,avx,noavx,avx,*")
6261 (set_attr "type" "ssemov")
6262 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,maybe_vex")
6263 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF,V2SF")])
6265 (define_insn "<mask_codefor>avx512f_unpckhps512<mask_name>"
6266 [(set (match_operand:V16SF 0 "register_operand" "=v")
6269 (match_operand:V16SF 1 "register_operand" "v")
6270 (match_operand:V16SF 2 "nonimmediate_operand" "vm"))
6271 (parallel [(const_int 2) (const_int 18)
6272 (const_int 3) (const_int 19)
6273 (const_int 6) (const_int 22)
6274 (const_int 7) (const_int 23)
6275 (const_int 10) (const_int 26)
6276 (const_int 11) (const_int 27)
6277 (const_int 14) (const_int 30)
6278 (const_int 15) (const_int 31)])))]
6280 "vunpckhps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6281 [(set_attr "type" "sselog")
6282 (set_attr "prefix" "evex")
6283 (set_attr "mode" "V16SF")])
6285 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
6286 (define_insn "avx_unpckhps256<mask_name>"
6287 [(set (match_operand:V8SF 0 "register_operand" "=v")
6290 (match_operand:V8SF 1 "register_operand" "v")
6291 (match_operand:V8SF 2 "nonimmediate_operand" "vm"))
6292 (parallel [(const_int 2) (const_int 10)
6293 (const_int 3) (const_int 11)
6294 (const_int 6) (const_int 14)
6295 (const_int 7) (const_int 15)])))]
6296 "TARGET_AVX && <mask_avx512vl_condition>"
6297 "vunpckhps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6298 [(set_attr "type" "sselog")
6299 (set_attr "prefix" "vex")
6300 (set_attr "mode" "V8SF")])
6302 (define_expand "vec_interleave_highv8sf"
6306 (match_operand:V8SF 1 "register_operand")
6307 (match_operand:V8SF 2 "nonimmediate_operand"))
6308 (parallel [(const_int 0) (const_int 8)
6309 (const_int 1) (const_int 9)
6310 (const_int 4) (const_int 12)
6311 (const_int 5) (const_int 13)])))
6317 (parallel [(const_int 2) (const_int 10)
6318 (const_int 3) (const_int 11)
6319 (const_int 6) (const_int 14)
6320 (const_int 7) (const_int 15)])))
6321 (set (match_operand:V8SF 0 "register_operand")
6326 (parallel [(const_int 4) (const_int 5)
6327 (const_int 6) (const_int 7)
6328 (const_int 12) (const_int 13)
6329 (const_int 14) (const_int 15)])))]
6332 operands[3] = gen_reg_rtx (V8SFmode);
6333 operands[4] = gen_reg_rtx (V8SFmode);
6336 (define_insn "vec_interleave_highv4sf<mask_name>"
6337 [(set (match_operand:V4SF 0 "register_operand" "=x,v")
6340 (match_operand:V4SF 1 "register_operand" "0,v")
6341 (match_operand:V4SF 2 "vector_operand" "xBm,vm"))
6342 (parallel [(const_int 2) (const_int 6)
6343 (const_int 3) (const_int 7)])))]
6344 "TARGET_SSE && <mask_avx512vl_condition>"
6346 unpckhps\t{%2, %0|%0, %2}
6347 vunpckhps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6348 [(set_attr "isa" "noavx,avx")
6349 (set_attr "type" "sselog")
6350 (set_attr "prefix" "orig,vex")
6351 (set_attr "mode" "V4SF")])
6353 (define_insn "<mask_codefor>avx512f_unpcklps512<mask_name>"
6354 [(set (match_operand:V16SF 0 "register_operand" "=v")
6357 (match_operand:V16SF 1 "register_operand" "v")
6358 (match_operand:V16SF 2 "nonimmediate_operand" "vm"))
6359 (parallel [(const_int 0) (const_int 16)
6360 (const_int 1) (const_int 17)
6361 (const_int 4) (const_int 20)
6362 (const_int 5) (const_int 21)
6363 (const_int 8) (const_int 24)
6364 (const_int 9) (const_int 25)
6365 (const_int 12) (const_int 28)
6366 (const_int 13) (const_int 29)])))]
6368 "vunpcklps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6369 [(set_attr "type" "sselog")
6370 (set_attr "prefix" "evex")
6371 (set_attr "mode" "V16SF")])
6373 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
6374 (define_insn "avx_unpcklps256<mask_name>"
6375 [(set (match_operand:V8SF 0 "register_operand" "=v")
6378 (match_operand:V8SF 1 "register_operand" "v")
6379 (match_operand:V8SF 2 "nonimmediate_operand" "vm"))
6380 (parallel [(const_int 0) (const_int 8)
6381 (const_int 1) (const_int 9)
6382 (const_int 4) (const_int 12)
6383 (const_int 5) (const_int 13)])))]
6384 "TARGET_AVX && <mask_avx512vl_condition>"
6385 "vunpcklps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6386 [(set_attr "type" "sselog")
6387 (set_attr "prefix" "vex")
6388 (set_attr "mode" "V8SF")])
6390 (define_insn "unpcklps128_mask"
6391 [(set (match_operand:V4SF 0 "register_operand" "=v")
6395 (match_operand:V4SF 1 "register_operand" "v")
6396 (match_operand:V4SF 2 "nonimmediate_operand" "vm"))
6397 (parallel [(const_int 0) (const_int 4)
6398 (const_int 1) (const_int 5)]))
6399 (match_operand:V4SF 3 "vector_move_operand" "0C")
6400 (match_operand:QI 4 "register_operand" "Yk")))]
6402 "vunpcklps\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
6403 [(set_attr "type" "sselog")
6404 (set_attr "prefix" "evex")
6405 (set_attr "mode" "V4SF")])
6407 (define_expand "vec_interleave_lowv8sf"
6411 (match_operand:V8SF 1 "register_operand")
6412 (match_operand:V8SF 2 "nonimmediate_operand"))
6413 (parallel [(const_int 0) (const_int 8)
6414 (const_int 1) (const_int 9)
6415 (const_int 4) (const_int 12)
6416 (const_int 5) (const_int 13)])))
6422 (parallel [(const_int 2) (const_int 10)
6423 (const_int 3) (const_int 11)
6424 (const_int 6) (const_int 14)
6425 (const_int 7) (const_int 15)])))
6426 (set (match_operand:V8SF 0 "register_operand")
6431 (parallel [(const_int 0) (const_int 1)
6432 (const_int 2) (const_int 3)
6433 (const_int 8) (const_int 9)
6434 (const_int 10) (const_int 11)])))]
6437 operands[3] = gen_reg_rtx (V8SFmode);
6438 operands[4] = gen_reg_rtx (V8SFmode);
6441 (define_insn "vec_interleave_lowv4sf"
6442 [(set (match_operand:V4SF 0 "register_operand" "=x,v")
6445 (match_operand:V4SF 1 "register_operand" "0,v")
6446 (match_operand:V4SF 2 "vector_operand" "xBm,vm"))
6447 (parallel [(const_int 0) (const_int 4)
6448 (const_int 1) (const_int 5)])))]
6451 unpcklps\t{%2, %0|%0, %2}
6452 vunpcklps\t{%2, %1, %0|%0, %1, %2}"
6453 [(set_attr "isa" "noavx,avx")
6454 (set_attr "type" "sselog")
6455 (set_attr "prefix" "orig,maybe_evex")
6456 (set_attr "mode" "V4SF")])
6458 ;; These are modeled with the same vec_concat as the others so that we
6459 ;; capture users of shufps that can use the new instructions
6460 (define_insn "avx_movshdup256<mask_name>"
6461 [(set (match_operand:V8SF 0 "register_operand" "=v")
6464 (match_operand:V8SF 1 "nonimmediate_operand" "vm")
6466 (parallel [(const_int 1) (const_int 1)
6467 (const_int 3) (const_int 3)
6468 (const_int 5) (const_int 5)
6469 (const_int 7) (const_int 7)])))]
6470 "TARGET_AVX && <mask_avx512vl_condition>"
6471 "vmovshdup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6472 [(set_attr "type" "sse")
6473 (set_attr "prefix" "vex")
6474 (set_attr "mode" "V8SF")])
6476 (define_insn "sse3_movshdup<mask_name>"
6477 [(set (match_operand:V4SF 0 "register_operand" "=v")
6480 (match_operand:V4SF 1 "vector_operand" "vBm")
6482 (parallel [(const_int 1)
6486 "TARGET_SSE3 && <mask_avx512vl_condition>"
6487 "%vmovshdup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6488 [(set_attr "type" "sse")
6489 (set_attr "prefix_rep" "1")
6490 (set_attr "prefix" "maybe_vex")
6491 (set_attr "mode" "V4SF")])
6493 (define_insn "<mask_codefor>avx512f_movshdup512<mask_name>"
6494 [(set (match_operand:V16SF 0 "register_operand" "=v")
6497 (match_operand:V16SF 1 "nonimmediate_operand" "vm")
6499 (parallel [(const_int 1) (const_int 1)
6500 (const_int 3) (const_int 3)
6501 (const_int 5) (const_int 5)
6502 (const_int 7) (const_int 7)
6503 (const_int 9) (const_int 9)
6504 (const_int 11) (const_int 11)
6505 (const_int 13) (const_int 13)
6506 (const_int 15) (const_int 15)])))]
6508 "vmovshdup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6509 [(set_attr "type" "sse")
6510 (set_attr "prefix" "evex")
6511 (set_attr "mode" "V16SF")])
6513 (define_insn "avx_movsldup256<mask_name>"
6514 [(set (match_operand:V8SF 0 "register_operand" "=v")
6517 (match_operand:V8SF 1 "nonimmediate_operand" "vm")
6519 (parallel [(const_int 0) (const_int 0)
6520 (const_int 2) (const_int 2)
6521 (const_int 4) (const_int 4)
6522 (const_int 6) (const_int 6)])))]
6523 "TARGET_AVX && <mask_avx512vl_condition>"
6524 "vmovsldup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6525 [(set_attr "type" "sse")
6526 (set_attr "prefix" "vex")
6527 (set_attr "mode" "V8SF")])
6529 (define_insn "sse3_movsldup<mask_name>"
6530 [(set (match_operand:V4SF 0 "register_operand" "=v")
6533 (match_operand:V4SF 1 "vector_operand" "vBm")
6535 (parallel [(const_int 0)
6539 "TARGET_SSE3 && <mask_avx512vl_condition>"
6540 "%vmovsldup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6541 [(set_attr "type" "sse")
6542 (set_attr "prefix_rep" "1")
6543 (set_attr "prefix" "maybe_vex")
6544 (set_attr "mode" "V4SF")])
6546 (define_insn "<mask_codefor>avx512f_movsldup512<mask_name>"
6547 [(set (match_operand:V16SF 0 "register_operand" "=v")
6550 (match_operand:V16SF 1 "nonimmediate_operand" "vm")
6552 (parallel [(const_int 0) (const_int 0)
6553 (const_int 2) (const_int 2)
6554 (const_int 4) (const_int 4)
6555 (const_int 6) (const_int 6)
6556 (const_int 8) (const_int 8)
6557 (const_int 10) (const_int 10)
6558 (const_int 12) (const_int 12)
6559 (const_int 14) (const_int 14)])))]
6561 "vmovsldup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6562 [(set_attr "type" "sse")
6563 (set_attr "prefix" "evex")
6564 (set_attr "mode" "V16SF")])
6566 (define_expand "avx_shufps256<mask_expand4_name>"
6567 [(match_operand:V8SF 0 "register_operand")
6568 (match_operand:V8SF 1 "register_operand")
6569 (match_operand:V8SF 2 "nonimmediate_operand")
6570 (match_operand:SI 3 "const_int_operand")]
6573 int mask = INTVAL (operands[3]);
6574 emit_insn (gen_avx_shufps256_1<mask_expand4_name> (operands[0],
6577 GEN_INT ((mask >> 0) & 3),
6578 GEN_INT ((mask >> 2) & 3),
6579 GEN_INT (((mask >> 4) & 3) + 8),
6580 GEN_INT (((mask >> 6) & 3) + 8),
6581 GEN_INT (((mask >> 0) & 3) + 4),
6582 GEN_INT (((mask >> 2) & 3) + 4),
6583 GEN_INT (((mask >> 4) & 3) + 12),
6584 GEN_INT (((mask >> 6) & 3) + 12)
6585 <mask_expand4_args>));
6589 ;; One bit in mask selects 2 elements.
6590 (define_insn "avx_shufps256_1<mask_name>"
6591 [(set (match_operand:V8SF 0 "register_operand" "=v")
6594 (match_operand:V8SF 1 "register_operand" "v")
6595 (match_operand:V8SF 2 "nonimmediate_operand" "vm"))
6596 (parallel [(match_operand 3 "const_0_to_3_operand" )
6597 (match_operand 4 "const_0_to_3_operand" )
6598 (match_operand 5 "const_8_to_11_operand" )
6599 (match_operand 6 "const_8_to_11_operand" )
6600 (match_operand 7 "const_4_to_7_operand" )
6601 (match_operand 8 "const_4_to_7_operand" )
6602 (match_operand 9 "const_12_to_15_operand")
6603 (match_operand 10 "const_12_to_15_operand")])))]
6605 && <mask_avx512vl_condition>
6606 && (INTVAL (operands[3]) == (INTVAL (operands[7]) - 4)
6607 && INTVAL (operands[4]) == (INTVAL (operands[8]) - 4)
6608 && INTVAL (operands[5]) == (INTVAL (operands[9]) - 4)
6609 && INTVAL (operands[6]) == (INTVAL (operands[10]) - 4))"
6612 mask = INTVAL (operands[3]);
6613 mask |= INTVAL (operands[4]) << 2;
6614 mask |= (INTVAL (operands[5]) - 8) << 4;
6615 mask |= (INTVAL (operands[6]) - 8) << 6;
6616 operands[3] = GEN_INT (mask);
6618 return "vshufps\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
6620 [(set_attr "type" "sseshuf")
6621 (set_attr "length_immediate" "1")
6622 (set_attr "prefix" "<mask_prefix>")
6623 (set_attr "mode" "V8SF")])
6625 (define_expand "sse_shufps<mask_expand4_name>"
6626 [(match_operand:V4SF 0 "register_operand")
6627 (match_operand:V4SF 1 "register_operand")
6628 (match_operand:V4SF 2 "vector_operand")
6629 (match_operand:SI 3 "const_int_operand")]
6632 int mask = INTVAL (operands[3]);
6633 emit_insn (gen_sse_shufps_v4sf<mask_expand4_name> (operands[0],
6636 GEN_INT ((mask >> 0) & 3),
6637 GEN_INT ((mask >> 2) & 3),
6638 GEN_INT (((mask >> 4) & 3) + 4),
6639 GEN_INT (((mask >> 6) & 3) + 4)
6640 <mask_expand4_args>));
6644 (define_insn "sse_shufps_v4sf_mask"
6645 [(set (match_operand:V4SF 0 "register_operand" "=v")
6649 (match_operand:V4SF 1 "register_operand" "v")
6650 (match_operand:V4SF 2 "nonimmediate_operand" "vm"))
6651 (parallel [(match_operand 3 "const_0_to_3_operand")
6652 (match_operand 4 "const_0_to_3_operand")
6653 (match_operand 5 "const_4_to_7_operand")
6654 (match_operand 6 "const_4_to_7_operand")]))
6655 (match_operand:V4SF 7 "vector_move_operand" "0C")
6656 (match_operand:QI 8 "register_operand" "Yk")))]
6660 mask |= INTVAL (operands[3]) << 0;
6661 mask |= INTVAL (operands[4]) << 2;
6662 mask |= (INTVAL (operands[5]) - 4) << 4;
6663 mask |= (INTVAL (operands[6]) - 4) << 6;
6664 operands[3] = GEN_INT (mask);
6666 return "vshufps\t{%3, %2, %1, %0%{%8%}%N7|%0%{%8%}%N7, %1, %2, %3}";
6668 [(set_attr "type" "sseshuf")
6669 (set_attr "length_immediate" "1")
6670 (set_attr "prefix" "evex")
6671 (set_attr "mode" "V4SF")])
6673 (define_insn "sse_shufps_<mode>"
6674 [(set (match_operand:VI4F_128 0 "register_operand" "=x,v")
6675 (vec_select:VI4F_128
6676 (vec_concat:<ssedoublevecmode>
6677 (match_operand:VI4F_128 1 "register_operand" "0,v")
6678 (match_operand:VI4F_128 2 "vector_operand" "xBm,vm"))
6679 (parallel [(match_operand 3 "const_0_to_3_operand")
6680 (match_operand 4 "const_0_to_3_operand")
6681 (match_operand 5 "const_4_to_7_operand")
6682 (match_operand 6 "const_4_to_7_operand")])))]
6686 mask |= INTVAL (operands[3]) << 0;
6687 mask |= INTVAL (operands[4]) << 2;
6688 mask |= (INTVAL (operands[5]) - 4) << 4;
6689 mask |= (INTVAL (operands[6]) - 4) << 6;
6690 operands[3] = GEN_INT (mask);
6692 switch (which_alternative)
6695 return "shufps\t{%3, %2, %0|%0, %2, %3}";
6697 return "vshufps\t{%3, %2, %1, %0|%0, %1, %2, %3}";
6702 [(set_attr "isa" "noavx,avx")
6703 (set_attr "type" "sseshuf")
6704 (set_attr "length_immediate" "1")
6705 (set_attr "prefix" "orig,maybe_evex")
6706 (set_attr "mode" "V4SF")])
6708 (define_insn "sse_storehps"
6709 [(set (match_operand:V2SF 0 "nonimmediate_operand" "=m,v,v")
6711 (match_operand:V4SF 1 "nonimmediate_operand" "v,v,o")
6712 (parallel [(const_int 2) (const_int 3)])))]
6713 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
6715 %vmovhps\t{%1, %0|%q0, %1}
6716 %vmovhlps\t{%1, %d0|%d0, %1}
6717 %vmovlps\t{%H1, %d0|%d0, %H1}"
6718 [(set_attr "type" "ssemov")
6719 (set_attr "prefix" "maybe_vex")
6720 (set_attr "mode" "V2SF,V4SF,V2SF")])
6722 (define_expand "sse_loadhps_exp"
6723 [(set (match_operand:V4SF 0 "nonimmediate_operand")
6726 (match_operand:V4SF 1 "nonimmediate_operand")
6727 (parallel [(const_int 0) (const_int 1)]))
6728 (match_operand:V2SF 2 "nonimmediate_operand")))]
6731 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
6733 emit_insn (gen_sse_loadhps (dst, operands[1], operands[2]));
6735 /* Fix up the destination if needed. */
6736 if (dst != operands[0])
6737 emit_move_insn (operands[0], dst);
6742 (define_insn "sse_loadhps"
6743 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,v,x,v,o")
6746 (match_operand:V4SF 1 "nonimmediate_operand" " 0,v,0,v,0")
6747 (parallel [(const_int 0) (const_int 1)]))
6748 (match_operand:V2SF 2 "nonimmediate_operand" " m,m,x,v,v")))]
6751 movhps\t{%2, %0|%0, %q2}
6752 vmovhps\t{%2, %1, %0|%0, %1, %q2}
6753 movlhps\t{%2, %0|%0, %2}
6754 vmovlhps\t{%2, %1, %0|%0, %1, %2}
6755 %vmovlps\t{%2, %H0|%H0, %2}"
6756 [(set_attr "isa" "noavx,avx,noavx,avx,*")
6757 (set_attr "type" "ssemov")
6758 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,maybe_vex")
6759 (set_attr "mode" "V2SF,V2SF,V4SF,V4SF,V2SF")])
6761 (define_insn "sse_storelps"
6762 [(set (match_operand:V2SF 0 "nonimmediate_operand" "=m,v,v")
6764 (match_operand:V4SF 1 "nonimmediate_operand" " v,v,m")
6765 (parallel [(const_int 0) (const_int 1)])))]
6766 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
6768 %vmovlps\t{%1, %0|%q0, %1}
6769 %vmovaps\t{%1, %0|%0, %1}
6770 %vmovlps\t{%1, %d0|%d0, %q1}"
6771 [(set_attr "type" "ssemov")
6772 (set_attr "prefix" "maybe_vex")
6773 (set_attr "mode" "V2SF,V4SF,V2SF")])
6775 (define_expand "sse_loadlps_exp"
6776 [(set (match_operand:V4SF 0 "nonimmediate_operand")
6778 (match_operand:V2SF 2 "nonimmediate_operand")
6780 (match_operand:V4SF 1 "nonimmediate_operand")
6781 (parallel [(const_int 2) (const_int 3)]))))]
6784 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
6786 emit_insn (gen_sse_loadlps (dst, operands[1], operands[2]));
6788 /* Fix up the destination if needed. */
6789 if (dst != operands[0])
6790 emit_move_insn (operands[0], dst);
6795 (define_insn "sse_loadlps"
6796 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,v,x,v,m")
6798 (match_operand:V2SF 2 "nonimmediate_operand" " 0,v,m,m,v")
6800 (match_operand:V4SF 1 "nonimmediate_operand" " x,v,0,v,0")
6801 (parallel [(const_int 2) (const_int 3)]))))]
6804 shufps\t{$0xe4, %1, %0|%0, %1, 0xe4}
6805 vshufps\t{$0xe4, %1, %2, %0|%0, %2, %1, 0xe4}
6806 movlps\t{%2, %0|%0, %q2}
6807 vmovlps\t{%2, %1, %0|%0, %1, %q2}
6808 %vmovlps\t{%2, %0|%q0, %2}"
6809 [(set_attr "isa" "noavx,avx,noavx,avx,*")
6810 (set_attr "type" "sseshuf,sseshuf,ssemov,ssemov,ssemov")
6811 (set (attr "length_immediate")
6812 (if_then_else (eq_attr "alternative" "0,1")
6814 (const_string "*")))
6815 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,maybe_vex")
6816 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF,V2SF")])
6818 (define_insn "sse_movss"
6819 [(set (match_operand:V4SF 0 "register_operand" "=x,v")
6821 (match_operand:V4SF 2 "register_operand" " x,v")
6822 (match_operand:V4SF 1 "register_operand" " 0,v")
6826 movss\t{%2, %0|%0, %2}
6827 vmovss\t{%2, %1, %0|%0, %1, %2}"
6828 [(set_attr "isa" "noavx,avx")
6829 (set_attr "type" "ssemov")
6830 (set_attr "prefix" "orig,maybe_evex")
6831 (set_attr "mode" "SF")])
6833 (define_insn "avx2_vec_dup<mode>"
6834 [(set (match_operand:VF1_128_256 0 "register_operand" "=v")
6835 (vec_duplicate:VF1_128_256
6837 (match_operand:V4SF 1 "register_operand" "v")
6838 (parallel [(const_int 0)]))))]
6840 "vbroadcastss\t{%1, %0|%0, %1}"
6841 [(set_attr "type" "sselog1")
6842 (set_attr "prefix" "maybe_evex")
6843 (set_attr "mode" "<MODE>")])
6845 (define_insn "avx2_vec_dupv8sf_1"
6846 [(set (match_operand:V8SF 0 "register_operand" "=v")
6849 (match_operand:V8SF 1 "register_operand" "v")
6850 (parallel [(const_int 0)]))))]
6852 "vbroadcastss\t{%x1, %0|%0, %x1}"
6853 [(set_attr "type" "sselog1")
6854 (set_attr "prefix" "maybe_evex")
6855 (set_attr "mode" "V8SF")])
6857 (define_insn "avx512f_vec_dup<mode>_1"
6858 [(set (match_operand:VF_512 0 "register_operand" "=v")
6859 (vec_duplicate:VF_512
6860 (vec_select:<ssescalarmode>
6861 (match_operand:VF_512 1 "register_operand" "v")
6862 (parallel [(const_int 0)]))))]
6864 "vbroadcast<bcstscalarsuff>\t{%x1, %0|%0, %x1}"
6865 [(set_attr "type" "sselog1")
6866 (set_attr "prefix" "evex")
6867 (set_attr "mode" "<MODE>")])
6869 ;; Although insertps takes register source, we prefer
6870 ;; unpcklps with register source since it is shorter.
6871 (define_insn "*vec_concatv2sf_sse4_1"
6872 [(set (match_operand:V2SF 0 "register_operand"
6873 "=Yr,*x, v,Yr,*x,v,v,*y ,*y")
6875 (match_operand:SF 1 "nonimmediate_operand"
6876 " 0, 0,Yv, 0,0, v,m, 0 , m")
6877 (match_operand:SF 2 "vector_move_operand"
6878 " Yr,*x,Yv, m,m, m,C,*ym, C")))]
6879 "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
6881 unpcklps\t{%2, %0|%0, %2}
6882 unpcklps\t{%2, %0|%0, %2}
6883 vunpcklps\t{%2, %1, %0|%0, %1, %2}
6884 insertps\t{$0x10, %2, %0|%0, %2, 0x10}
6885 insertps\t{$0x10, %2, %0|%0, %2, 0x10}
6886 vinsertps\t{$0x10, %2, %1, %0|%0, %1, %2, 0x10}
6887 %vmovss\t{%1, %0|%0, %1}
6888 punpckldq\t{%2, %0|%0, %2}
6889 movd\t{%1, %0|%0, %1}"
6891 (cond [(eq_attr "alternative" "0,1,3,4")
6892 (const_string "noavx")
6893 (eq_attr "alternative" "2,5")
6894 (const_string "avx")
6896 (const_string "*")))
6898 (cond [(eq_attr "alternative" "6")
6899 (const_string "ssemov")
6900 (eq_attr "alternative" "7")
6901 (const_string "mmxcvt")
6902 (eq_attr "alternative" "8")
6903 (const_string "mmxmov")
6905 (const_string "sselog")))
6906 (set (attr "prefix_data16")
6907 (if_then_else (eq_attr "alternative" "3,4")
6909 (const_string "*")))
6910 (set (attr "prefix_extra")
6911 (if_then_else (eq_attr "alternative" "3,4,5")
6913 (const_string "*")))
6914 (set (attr "length_immediate")
6915 (if_then_else (eq_attr "alternative" "3,4,5")
6917 (const_string "*")))
6918 (set (attr "prefix")
6919 (cond [(eq_attr "alternative" "2,5")
6920 (const_string "maybe_evex")
6921 (eq_attr "alternative" "6")
6922 (const_string "maybe_vex")
6924 (const_string "orig")))
6925 (set_attr "mode" "V4SF,V4SF,V4SF,V4SF,V4SF,V4SF,SF,DI,DI")])
6927 ;; ??? In theory we can match memory for the MMX alternative, but allowing
6928 ;; vector_operand for operand 2 and *not* allowing memory for the SSE
6929 ;; alternatives pretty much forces the MMX alternative to be chosen.
6930 (define_insn "*vec_concatv2sf_sse"
6931 [(set (match_operand:V2SF 0 "register_operand" "=x,x,*y,*y")
6933 (match_operand:SF 1 "nonimmediate_operand" " 0,m, 0, m")
6934 (match_operand:SF 2 "reg_or_0_operand" " x,C,*y, C")))]
6937 unpcklps\t{%2, %0|%0, %2}
6938 movss\t{%1, %0|%0, %1}
6939 punpckldq\t{%2, %0|%0, %2}
6940 movd\t{%1, %0|%0, %1}"
6941 [(set_attr "type" "sselog,ssemov,mmxcvt,mmxmov")
6942 (set_attr "mode" "V4SF,SF,DI,DI")])
6944 (define_insn "*vec_concatv4sf"
6945 [(set (match_operand:V4SF 0 "register_operand" "=x,v,x,v")
6947 (match_operand:V2SF 1 "register_operand" " 0,v,0,v")
6948 (match_operand:V2SF 2 "nonimmediate_operand" " x,v,m,m")))]
6951 movlhps\t{%2, %0|%0, %2}
6952 vmovlhps\t{%2, %1, %0|%0, %1, %2}
6953 movhps\t{%2, %0|%0, %q2}
6954 vmovhps\t{%2, %1, %0|%0, %1, %q2}"
6955 [(set_attr "isa" "noavx,avx,noavx,avx")
6956 (set_attr "type" "ssemov")
6957 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex")
6958 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF")])
6960 ;; Avoid combining registers from different units in a single alternative,
6961 ;; see comment above inline_secondary_memory_needed function in i386.c
6962 (define_insn "vec_set<mode>_0"
6963 [(set (match_operand:VI4F_128 0 "nonimmediate_operand"
6964 "=Yr,*x,v,v,Yi,x,x,v,Yr ,*x ,x ,m ,m ,m")
6966 (vec_duplicate:VI4F_128
6967 (match_operand:<ssescalarmode> 2 "general_operand"
6968 " Yr,*x,v,m,r ,m,x,v,*rm,*rm,*rm,!x,!*re,!*fF"))
6969 (match_operand:VI4F_128 1 "vector_move_operand"
6970 " C , C,C,C,C ,C,0,v,0 ,0 ,x ,0 ,0 ,0")
6974 insertps\t{$0xe, %2, %0|%0, %2, 0xe}
6975 insertps\t{$0xe, %2, %0|%0, %2, 0xe}
6976 vinsertps\t{$0xe, %2, %2, %0|%0, %2, %2, 0xe}
6977 %vmov<ssescalarmodesuffix>\t{%2, %0|%0, %2}
6978 %vmovd\t{%2, %0|%0, %2}
6979 movss\t{%2, %0|%0, %2}
6980 movss\t{%2, %0|%0, %2}
6981 vmovss\t{%2, %1, %0|%0, %1, %2}
6982 pinsrd\t{$0, %2, %0|%0, %2, 0}
6983 pinsrd\t{$0, %2, %0|%0, %2, 0}
6984 vpinsrd\t{$0, %2, %1, %0|%0, %1, %2, 0}
6989 (cond [(eq_attr "alternative" "0,1,8,9")
6990 (const_string "sse4_noavx")
6991 (eq_attr "alternative" "2,7,10")
6992 (const_string "avx")
6993 (eq_attr "alternative" "3,4")
6994 (const_string "sse2")
6995 (eq_attr "alternative" "5,6")
6996 (const_string "noavx")
6998 (const_string "*")))
7000 (cond [(eq_attr "alternative" "0,1,2,8,9,10")
7001 (const_string "sselog")
7002 (eq_attr "alternative" "12")
7003 (const_string "imov")
7004 (eq_attr "alternative" "13")
7005 (const_string "fmov")
7007 (const_string "ssemov")))
7008 (set (attr "prefix_extra")
7009 (if_then_else (eq_attr "alternative" "8,9,10")
7011 (const_string "*")))
7012 (set (attr "length_immediate")
7013 (if_then_else (eq_attr "alternative" "8,9,10")
7015 (const_string "*")))
7016 (set (attr "prefix")
7017 (cond [(eq_attr "alternative" "0,1,5,6,8,9")
7018 (const_string "orig")
7019 (eq_attr "alternative" "2")
7020 (const_string "maybe_evex")
7021 (eq_attr "alternative" "3,4")
7022 (const_string "maybe_vex")
7023 (eq_attr "alternative" "7,10")
7024 (const_string "vex")
7026 (const_string "*")))
7027 (set_attr "mode" "SF,SF,SF,<ssescalarmode>,SI,SF,SF,SF,TI,TI,TI,*,*,*")])
7029 ;; A subset is vec_setv4sf.
7030 (define_insn "*vec_setv4sf_sse4_1"
7031 [(set (match_operand:V4SF 0 "register_operand" "=Yr,*x,v")
7034 (match_operand:SF 2 "nonimmediate_operand" "Yrm,*xm,vm"))
7035 (match_operand:V4SF 1 "register_operand" "0,0,v")
7036 (match_operand:SI 3 "const_int_operand")))]
7038 && ((unsigned) exact_log2 (INTVAL (operands[3]))
7039 < GET_MODE_NUNITS (V4SFmode))"
7041 operands[3] = GEN_INT (exact_log2 (INTVAL (operands[3])) << 4);
7042 switch (which_alternative)
7046 return "insertps\t{%3, %2, %0|%0, %2, %3}";
7048 return "vinsertps\t{%3, %2, %1, %0|%0, %1, %2, %3}";
7053 [(set_attr "isa" "noavx,noavx,avx")
7054 (set_attr "type" "sselog")
7055 (set_attr "prefix_data16" "1,1,*")
7056 (set_attr "prefix_extra" "1")
7057 (set_attr "length_immediate" "1")
7058 (set_attr "prefix" "orig,orig,maybe_evex")
7059 (set_attr "mode" "V4SF")])
7061 (define_insn "sse4_1_insertps"
7062 [(set (match_operand:V4SF 0 "register_operand" "=Yr,*x,v")
7063 (unspec:V4SF [(match_operand:V4SF 2 "nonimmediate_operand" "Yrm,*xm,vm")
7064 (match_operand:V4SF 1 "register_operand" "0,0,v")
7065 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")]
7069 if (MEM_P (operands[2]))
7071 unsigned count_s = INTVAL (operands[3]) >> 6;
7073 operands[3] = GEN_INT (INTVAL (operands[3]) & 0x3f);
7074 operands[2] = adjust_address_nv (operands[2], SFmode, count_s * 4);
7076 switch (which_alternative)
7080 return "insertps\t{%3, %2, %0|%0, %2, %3}";
7082 return "vinsertps\t{%3, %2, %1, %0|%0, %1, %2, %3}";
7087 [(set_attr "isa" "noavx,noavx,avx")
7088 (set_attr "type" "sselog")
7089 (set_attr "prefix_data16" "1,1,*")
7090 (set_attr "prefix_extra" "1")
7091 (set_attr "length_immediate" "1")
7092 (set_attr "prefix" "orig,orig,maybe_evex")
7093 (set_attr "mode" "V4SF")])
7096 [(set (match_operand:VI4F_128 0 "memory_operand")
7098 (vec_duplicate:VI4F_128
7099 (match_operand:<ssescalarmode> 1 "nonmemory_operand"))
7102 "TARGET_SSE && reload_completed"
7103 [(set (match_dup 0) (match_dup 1))]
7104 "operands[0] = adjust_address (operands[0], <ssescalarmode>mode, 0);")
7106 (define_expand "vec_set<mode>"
7107 [(match_operand:V 0 "register_operand")
7108 (match_operand:<ssescalarmode> 1 "register_operand")
7109 (match_operand 2 "const_int_operand")]
7112 ix86_expand_vector_set (false, operands[0], operands[1],
7113 INTVAL (operands[2]));
7117 (define_insn_and_split "*vec_extractv4sf_0"
7118 [(set (match_operand:SF 0 "nonimmediate_operand" "=v,m,f,r")
7120 (match_operand:V4SF 1 "nonimmediate_operand" "vm,v,m,m")
7121 (parallel [(const_int 0)])))]
7122 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7124 "&& reload_completed"
7125 [(set (match_dup 0) (match_dup 1))]
7126 "operands[1] = gen_lowpart (SFmode, operands[1]);")
7128 (define_insn_and_split "*sse4_1_extractps"
7129 [(set (match_operand:SF 0 "nonimmediate_operand" "=rm,rm,rm,Yv,Yv")
7131 (match_operand:V4SF 1 "register_operand" "Yr,*x,v,0,v")
7132 (parallel [(match_operand:SI 2 "const_0_to_3_operand" "n,n,n,n,n")])))]
7135 extractps\t{%2, %1, %0|%0, %1, %2}
7136 extractps\t{%2, %1, %0|%0, %1, %2}
7137 vextractps\t{%2, %1, %0|%0, %1, %2}
7140 "&& reload_completed && SSE_REG_P (operands[0])"
7143 rtx dest = lowpart_subreg (V4SFmode, operands[0], SFmode);
7144 switch (INTVAL (operands[2]))
7148 emit_insn (gen_sse_shufps_v4sf (dest, operands[1], operands[1],
7149 operands[2], operands[2],
7150 GEN_INT (INTVAL (operands[2]) + 4),
7151 GEN_INT (INTVAL (operands[2]) + 4)));
7154 emit_insn (gen_vec_interleave_highv4sf (dest, operands[1], operands[1]));
7157 /* 0 should be handled by the *vec_extractv4sf_0 pattern above. */
7162 [(set_attr "isa" "noavx,noavx,avx,noavx,avx")
7163 (set_attr "type" "sselog,sselog,sselog,*,*")
7164 (set_attr "prefix_data16" "1,1,1,*,*")
7165 (set_attr "prefix_extra" "1,1,1,*,*")
7166 (set_attr "length_immediate" "1,1,1,*,*")
7167 (set_attr "prefix" "orig,orig,maybe_evex,*,*")
7168 (set_attr "mode" "V4SF,V4SF,V4SF,*,*")])
7170 (define_insn_and_split "*vec_extractv4sf_mem"
7171 [(set (match_operand:SF 0 "register_operand" "=v,*r,f")
7173 (match_operand:V4SF 1 "memory_operand" "o,o,o")
7174 (parallel [(match_operand 2 "const_0_to_3_operand" "n,n,n")])))]
7177 "&& reload_completed"
7178 [(set (match_dup 0) (match_dup 1))]
7180 operands[1] = adjust_address (operands[1], SFmode, INTVAL (operands[2]) * 4);
7183 (define_mode_attr extract_type
7184 [(V16SF "avx512f") (V16SI "avx512f") (V8DF "avx512dq") (V8DI "avx512dq")])
7186 (define_mode_attr extract_suf
7187 [(V16SF "32x4") (V16SI "32x4") (V8DF "64x2") (V8DI "64x2")])
7189 (define_mode_iterator AVX512_VEC
7190 [(V8DF "TARGET_AVX512DQ") (V8DI "TARGET_AVX512DQ") V16SF V16SI])
7192 (define_expand "<extract_type>_vextract<shuffletype><extract_suf>_mask"
7193 [(match_operand:<ssequartermode> 0 "nonimmediate_operand")
7194 (match_operand:AVX512_VEC 1 "register_operand")
7195 (match_operand:SI 2 "const_0_to_3_operand")
7196 (match_operand:<ssequartermode> 3 "nonimmediate_operand")
7197 (match_operand:QI 4 "register_operand")]
7201 mask = INTVAL (operands[2]);
7202 rtx dest = operands[0];
7204 if (MEM_P (operands[0]) && !rtx_equal_p (operands[0], operands[3]))
7205 dest = gen_reg_rtx (<ssequartermode>mode);
7207 if (<MODE>mode == V16SImode || <MODE>mode == V16SFmode)
7208 emit_insn (gen_avx512f_vextract<shuffletype>32x4_1_mask (dest,
7209 operands[1], GEN_INT (mask * 4), GEN_INT (mask * 4 + 1),
7210 GEN_INT (mask * 4 + 2), GEN_INT (mask * 4 + 3), operands[3],
7213 emit_insn (gen_avx512dq_vextract<shuffletype>64x2_1_mask (dest,
7214 operands[1], GEN_INT (mask * 2), GEN_INT (mask * 2 + 1), operands[3],
7216 if (dest != operands[0])
7217 emit_move_insn (operands[0], dest);
7221 (define_insn "avx512dq_vextract<shuffletype>64x2_1_maskm"
7222 [(set (match_operand:<ssequartermode> 0 "memory_operand" "=m")
7223 (vec_merge:<ssequartermode>
7224 (vec_select:<ssequartermode>
7225 (match_operand:V8FI 1 "register_operand" "v")
7226 (parallel [(match_operand 2 "const_0_to_7_operand")
7227 (match_operand 3 "const_0_to_7_operand")]))
7228 (match_operand:<ssequartermode> 4 "memory_operand" "0")
7229 (match_operand:QI 5 "register_operand" "Yk")))]
7231 && INTVAL (operands[2]) % 2 == 0
7232 && INTVAL (operands[2]) == INTVAL (operands[3]) - 1
7233 && rtx_equal_p (operands[4], operands[0])"
7235 operands[2] = GEN_INT ((INTVAL (operands[2])) >> 1);
7236 return "vextract<shuffletype>64x2\t{%2, %1, %0%{%5%}|%0%{%5%}, %1, %2}";
7238 [(set_attr "type" "sselog")
7239 (set_attr "prefix_extra" "1")
7240 (set_attr "length_immediate" "1")
7241 (set_attr "memory" "store")
7242 (set_attr "prefix" "evex")
7243 (set_attr "mode" "<sseinsnmode>")])
7245 (define_insn "avx512f_vextract<shuffletype>32x4_1_maskm"
7246 [(set (match_operand:<ssequartermode> 0 "memory_operand" "=m")
7247 (vec_merge:<ssequartermode>
7248 (vec_select:<ssequartermode>
7249 (match_operand:V16FI 1 "register_operand" "v")
7250 (parallel [(match_operand 2 "const_0_to_15_operand")
7251 (match_operand 3 "const_0_to_15_operand")
7252 (match_operand 4 "const_0_to_15_operand")
7253 (match_operand 5 "const_0_to_15_operand")]))
7254 (match_operand:<ssequartermode> 6 "memory_operand" "0")
7255 (match_operand:QI 7 "register_operand" "Yk")))]
7257 && INTVAL (operands[2]) % 4 == 0
7258 && INTVAL (operands[2]) == INTVAL (operands[3]) - 1
7259 && INTVAL (operands[3]) == INTVAL (operands[4]) - 1
7260 && INTVAL (operands[4]) == INTVAL (operands[5]) - 1
7261 && rtx_equal_p (operands[6], operands[0])"
7263 operands[2] = GEN_INT (INTVAL (operands[2]) >> 2);
7264 return "vextract<shuffletype>32x4\t{%2, %1, %0%{%7%}|%0%{%7%}, %1, %2}";
7266 [(set_attr "type" "sselog")
7267 (set_attr "prefix_extra" "1")
7268 (set_attr "length_immediate" "1")
7269 (set_attr "memory" "store")
7270 (set_attr "prefix" "evex")
7271 (set_attr "mode" "<sseinsnmode>")])
7273 (define_insn "<mask_codefor>avx512dq_vextract<shuffletype>64x2_1<mask_name>"
7274 [(set (match_operand:<ssequartermode> 0 "<store_mask_predicate>" "=<store_mask_constraint>")
7275 (vec_select:<ssequartermode>
7276 (match_operand:V8FI 1 "register_operand" "v")
7277 (parallel [(match_operand 2 "const_0_to_7_operand")
7278 (match_operand 3 "const_0_to_7_operand")])))]
7280 && INTVAL (operands[2]) % 2 == 0
7281 && INTVAL (operands[2]) == INTVAL (operands[3]) - 1"
7283 operands[2] = GEN_INT (INTVAL (operands[2]) >> 1);
7284 return "vextract<shuffletype>64x2\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}";
7286 [(set_attr "type" "sselog1")
7287 (set_attr "prefix_extra" "1")
7288 (set_attr "length_immediate" "1")
7289 (set_attr "prefix" "evex")
7290 (set_attr "mode" "<sseinsnmode>")])
7292 (define_insn "<mask_codefor>avx512f_vextract<shuffletype>32x4_1<mask_name>"
7293 [(set (match_operand:<ssequartermode> 0 "<store_mask_predicate>" "=<store_mask_constraint>")
7294 (vec_select:<ssequartermode>
7295 (match_operand:V16FI 1 "register_operand" "v")
7296 (parallel [(match_operand 2 "const_0_to_15_operand")
7297 (match_operand 3 "const_0_to_15_operand")
7298 (match_operand 4 "const_0_to_15_operand")
7299 (match_operand 5 "const_0_to_15_operand")])))]
7301 && INTVAL (operands[2]) % 4 == 0
7302 && INTVAL (operands[2]) == INTVAL (operands[3]) - 1
7303 && INTVAL (operands[3]) == INTVAL (operands[4]) - 1
7304 && INTVAL (operands[4]) == INTVAL (operands[5]) - 1"
7306 operands[2] = GEN_INT (INTVAL (operands[2]) >> 2);
7307 return "vextract<shuffletype>32x4\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
7309 [(set_attr "type" "sselog1")
7310 (set_attr "prefix_extra" "1")
7311 (set_attr "length_immediate" "1")
7312 (set_attr "prefix" "evex")
7313 (set_attr "mode" "<sseinsnmode>")])
7315 (define_mode_attr extract_type_2
7316 [(V16SF "avx512dq") (V16SI "avx512dq") (V8DF "avx512f") (V8DI "avx512f")])
7318 (define_mode_attr extract_suf_2
7319 [(V16SF "32x8") (V16SI "32x8") (V8DF "64x4") (V8DI "64x4")])
7321 (define_mode_iterator AVX512_VEC_2
7322 [(V16SF "TARGET_AVX512DQ") (V16SI "TARGET_AVX512DQ") V8DF V8DI])
7324 (define_expand "<extract_type_2>_vextract<shuffletype><extract_suf_2>_mask"
7325 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7326 (match_operand:AVX512_VEC_2 1 "register_operand")
7327 (match_operand:SI 2 "const_0_to_1_operand")
7328 (match_operand:<ssehalfvecmode> 3 "nonimmediate_operand")
7329 (match_operand:QI 4 "register_operand")]
7332 rtx (*insn)(rtx, rtx, rtx, rtx);
7333 rtx dest = operands[0];
7335 if (MEM_P (dest) && !rtx_equal_p (dest, operands[3]))
7336 dest = gen_reg_rtx (<ssehalfvecmode>mode);
7338 switch (INTVAL (operands[2]))
7341 insn = gen_vec_extract_lo_<mode>_mask;
7344 insn = gen_vec_extract_hi_<mode>_mask;
7350 emit_insn (insn (dest, operands[1], operands[3], operands[4]));
7351 if (dest != operands[0])
7352 emit_move_insn (operands[0], dest);
7357 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7358 (vec_select:<ssehalfvecmode>
7359 (match_operand:V8FI 1 "nonimmediate_operand")
7360 (parallel [(const_int 0) (const_int 1)
7361 (const_int 2) (const_int 3)])))]
7362 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))
7365 || (REG_P (operands[0]) && !EXT_REX_SSE_REG_P (operands[1])))"
7366 [(set (match_dup 0) (match_dup 1))]
7367 "operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);")
7369 (define_insn "vec_extract_lo_<mode>_maskm"
7370 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7371 (vec_merge:<ssehalfvecmode>
7372 (vec_select:<ssehalfvecmode>
7373 (match_operand:V8FI 1 "register_operand" "v")
7374 (parallel [(const_int 0) (const_int 1)
7375 (const_int 2) (const_int 3)]))
7376 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7377 (match_operand:QI 3 "register_operand" "Yk")))]
7379 && rtx_equal_p (operands[2], operands[0])"
7380 "vextract<shuffletype>64x4\t{$0x0, %1, %0%{%3%}|%0%{%3%}, %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_lo_<mode><mask_name>"
7388 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=<store_mask_constraint>,v")
7389 (vec_select:<ssehalfvecmode>
7390 (match_operand:V8FI 1 "<store_mask_predicate>" "v,<store_mask_constraint>")
7391 (parallel [(const_int 0) (const_int 1)
7392 (const_int 2) (const_int 3)])))]
7394 && (<mask_applied> || !(MEM_P (operands[0]) && MEM_P (operands[1])))"
7396 if (<mask_applied> || (!TARGET_AVX512VL && !MEM_P (operands[1])))
7397 return "vextract<shuffletype>64x4\t{$0x0, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x0}";
7401 [(set_attr "type" "sselog1")
7402 (set_attr "prefix_extra" "1")
7403 (set_attr "length_immediate" "1")
7404 (set_attr "prefix" "evex")
7405 (set_attr "mode" "<sseinsnmode>")])
7407 (define_insn "vec_extract_hi_<mode>_maskm"
7408 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7409 (vec_merge:<ssehalfvecmode>
7410 (vec_select:<ssehalfvecmode>
7411 (match_operand:V8FI 1 "register_operand" "v")
7412 (parallel [(const_int 4) (const_int 5)
7413 (const_int 6) (const_int 7)]))
7414 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7415 (match_operand:QI 3 "register_operand" "Yk")))]
7417 && rtx_equal_p (operands[2], operands[0])"
7418 "vextract<shuffletype>64x4\t{$0x1, %1, %0%{%3%}|%0%{%3%}, %1, 0x1}"
7419 [(set_attr "type" "sselog")
7420 (set_attr "prefix_extra" "1")
7421 (set_attr "length_immediate" "1")
7422 (set_attr "memory" "store")
7423 (set_attr "prefix" "evex")
7424 (set_attr "mode" "<sseinsnmode>")])
7426 (define_insn "vec_extract_hi_<mode><mask_name>"
7427 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=<store_mask_constraint>")
7428 (vec_select:<ssehalfvecmode>
7429 (match_operand:V8FI 1 "register_operand" "v")
7430 (parallel [(const_int 4) (const_int 5)
7431 (const_int 6) (const_int 7)])))]
7433 "vextract<shuffletype>64x4\t{$0x1, %1, %0<mask_operand2>|%0<mask_operand2>, %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>_maskm"
7441 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7442 (vec_merge:<ssehalfvecmode>
7443 (vec_select:<ssehalfvecmode>
7444 (match_operand:V16FI 1 "register_operand" "v")
7445 (parallel [(const_int 8) (const_int 9)
7446 (const_int 10) (const_int 11)
7447 (const_int 12) (const_int 13)
7448 (const_int 14) (const_int 15)]))
7449 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7450 (match_operand:QI 3 "register_operand" "Yk")))]
7452 && rtx_equal_p (operands[2], operands[0])"
7453 "vextract<shuffletype>32x8\t{$0x1, %1, %0%{%3%}|%0%{%3%}, %1, 0x1}"
7454 [(set_attr "type" "sselog1")
7455 (set_attr "prefix_extra" "1")
7456 (set_attr "length_immediate" "1")
7457 (set_attr "prefix" "evex")
7458 (set_attr "mode" "<sseinsnmode>")])
7460 (define_insn "vec_extract_hi_<mode><mask_name>"
7461 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=<store_mask_constraint>,vm")
7462 (vec_select:<ssehalfvecmode>
7463 (match_operand:V16FI 1 "register_operand" "v,v")
7464 (parallel [(const_int 8) (const_int 9)
7465 (const_int 10) (const_int 11)
7466 (const_int 12) (const_int 13)
7467 (const_int 14) (const_int 15)])))]
7468 "TARGET_AVX512F && <mask_avx512dq_condition>"
7470 vextract<shuffletype>32x8\t{$0x1, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x1}
7471 vextracti64x4\t{$0x1, %1, %0|%0, %1, 0x1}"
7472 [(set_attr "type" "sselog1")
7473 (set_attr "prefix_extra" "1")
7474 (set_attr "isa" "avx512dq,noavx512dq")
7475 (set_attr "length_immediate" "1")
7476 (set_attr "prefix" "evex")
7477 (set_attr "mode" "<sseinsnmode>")])
7479 (define_expand "avx512vl_vextractf128<mode>"
7480 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7481 (match_operand:VI48F_256 1 "register_operand")
7482 (match_operand:SI 2 "const_0_to_1_operand")
7483 (match_operand:<ssehalfvecmode> 3 "vector_move_operand")
7484 (match_operand:QI 4 "register_operand")]
7485 "TARGET_AVX512DQ && TARGET_AVX512VL"
7487 rtx (*insn)(rtx, rtx, rtx, rtx);
7488 rtx dest = operands[0];
7491 && (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 4
7492 /* For V8S[IF]mode there are maskm insns with =m and 0
7494 ? !rtx_equal_p (dest, operands[3])
7495 /* For V4D[IF]mode, hi insns don't allow memory, and
7496 lo insns have =m and 0C constraints. */
7497 : (operands[2] != const0_rtx
7498 || (!rtx_equal_p (dest, operands[3])
7499 && GET_CODE (operands[3]) != CONST_VECTOR))))
7500 dest = gen_reg_rtx (<ssehalfvecmode>mode);
7501 switch (INTVAL (operands[2]))
7504 insn = gen_vec_extract_lo_<mode>_mask;
7507 insn = gen_vec_extract_hi_<mode>_mask;
7513 emit_insn (insn (dest, operands[1], operands[3], operands[4]));
7514 if (dest != operands[0])
7515 emit_move_insn (operands[0], dest);
7519 (define_expand "avx_vextractf128<mode>"
7520 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7521 (match_operand:V_256 1 "register_operand")
7522 (match_operand:SI 2 "const_0_to_1_operand")]
7525 rtx (*insn)(rtx, rtx);
7527 switch (INTVAL (operands[2]))
7530 insn = gen_vec_extract_lo_<mode>;
7533 insn = gen_vec_extract_hi_<mode>;
7539 emit_insn (insn (operands[0], operands[1]));
7543 (define_insn "vec_extract_lo_<mode><mask_name>"
7544 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand" "=v,m")
7545 (vec_select:<ssehalfvecmode>
7546 (match_operand:V16FI 1 "<store_mask_predicate>"
7547 "<store_mask_constraint>,v")
7548 (parallel [(const_int 0) (const_int 1)
7549 (const_int 2) (const_int 3)
7550 (const_int 4) (const_int 5)
7551 (const_int 6) (const_int 7)])))]
7553 && <mask_mode512bit_condition>
7554 && (<mask_applied> || !(MEM_P (operands[0]) && MEM_P (operands[1])))"
7557 return "vextract<shuffletype>32x8\t{$0x0, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x0}";
7563 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7564 (vec_select:<ssehalfvecmode>
7565 (match_operand:V16FI 1 "nonimmediate_operand")
7566 (parallel [(const_int 0) (const_int 1)
7567 (const_int 2) (const_int 3)
7568 (const_int 4) (const_int 5)
7569 (const_int 6) (const_int 7)])))]
7570 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))
7571 && reload_completed"
7572 [(set (match_dup 0) (match_dup 1))]
7573 "operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);")
7575 (define_insn "vec_extract_lo_<mode><mask_name>"
7576 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=v,m")
7577 (vec_select:<ssehalfvecmode>
7578 (match_operand:VI8F_256 1 "<store_mask_predicate>"
7579 "<store_mask_constraint>,v")
7580 (parallel [(const_int 0) (const_int 1)])))]
7582 && <mask_avx512vl_condition> && <mask_avx512dq_condition>
7583 && (<mask_applied> || !(MEM_P (operands[0]) && MEM_P (operands[1])))"
7586 return "vextract<shuffletype>64x2\t{$0x0, %1, %0%{%3%}|%0%{%3%}, %1, 0x0}";
7590 [(set_attr "type" "sselog")
7591 (set_attr "prefix_extra" "1")
7592 (set_attr "length_immediate" "1")
7593 (set_attr "memory" "none,store")
7594 (set_attr "prefix" "evex")
7595 (set_attr "mode" "XI")])
7598 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7599 (vec_select:<ssehalfvecmode>
7600 (match_operand:VI8F_256 1 "nonimmediate_operand")
7601 (parallel [(const_int 0) (const_int 1)])))]
7602 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))
7603 && reload_completed"
7604 [(set (match_dup 0) (match_dup 1))]
7605 "operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);")
7607 (define_insn "vec_extract_hi_<mode><mask_name>"
7608 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=v,<store_mask_constraint>")
7609 (vec_select:<ssehalfvecmode>
7610 (match_operand:VI8F_256 1 "register_operand" "v,v")
7611 (parallel [(const_int 2) (const_int 3)])))]
7612 "TARGET_AVX && <mask_avx512vl_condition> && <mask_avx512dq_condition>"
7614 if (TARGET_AVX512VL)
7616 if (TARGET_AVX512DQ)
7617 return "vextract<shuffletype>64x2\t{$0x1, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x1}";
7619 return "vextract<shuffletype>32x4\t{$0x1, %1, %0|%0, %1, 0x1}";
7622 return "vextract<i128>\t{$0x1, %1, %0|%0, %1, 0x1}";
7624 [(set_attr "type" "sselog")
7625 (set_attr "prefix_extra" "1")
7626 (set_attr "length_immediate" "1")
7627 (set_attr "memory" "none,store")
7628 (set_attr "prefix" "vex")
7629 (set_attr "mode" "<sseinsnmode>")])
7632 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7633 (vec_select:<ssehalfvecmode>
7634 (match_operand:VI4F_256 1 "nonimmediate_operand")
7635 (parallel [(const_int 0) (const_int 1)
7636 (const_int 2) (const_int 3)])))]
7637 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))
7638 && reload_completed"
7639 [(set (match_dup 0) (match_dup 1))]
7640 "operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);")
7642 (define_insn "vec_extract_lo_<mode><mask_name>"
7643 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>"
7644 "=<store_mask_constraint>,v")
7645 (vec_select:<ssehalfvecmode>
7646 (match_operand:VI4F_256 1 "<store_mask_predicate>"
7647 "v,<store_mask_constraint>")
7648 (parallel [(const_int 0) (const_int 1)
7649 (const_int 2) (const_int 3)])))]
7651 && <mask_avx512vl_condition> && <mask_avx512dq_condition>
7652 && (<mask_applied> || !(MEM_P (operands[0]) && MEM_P (operands[1])))"
7655 return "vextract<shuffletype>32x4\t{$0x0, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x0}";
7659 [(set_attr "type" "sselog1")
7660 (set_attr "prefix_extra" "1")
7661 (set_attr "length_immediate" "1")
7662 (set_attr "prefix" "evex")
7663 (set_attr "mode" "<sseinsnmode>")])
7665 (define_insn "vec_extract_lo_<mode>_maskm"
7666 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7667 (vec_merge:<ssehalfvecmode>
7668 (vec_select:<ssehalfvecmode>
7669 (match_operand:VI4F_256 1 "register_operand" "v")
7670 (parallel [(const_int 0) (const_int 1)
7671 (const_int 2) (const_int 3)]))
7672 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7673 (match_operand:QI 3 "register_operand" "Yk")))]
7674 "TARGET_AVX512VL && TARGET_AVX512F
7675 && rtx_equal_p (operands[2], operands[0])"
7676 "vextract<shuffletype>32x4\t{$0x0, %1, %0%{%3%}|%0%{%3%}, %1, 0x0}"
7677 [(set_attr "type" "sselog1")
7678 (set_attr "prefix_extra" "1")
7679 (set_attr "length_immediate" "1")
7680 (set_attr "prefix" "evex")
7681 (set_attr "mode" "<sseinsnmode>")])
7683 (define_insn "vec_extract_hi_<mode>_maskm"
7684 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7685 (vec_merge:<ssehalfvecmode>
7686 (vec_select:<ssehalfvecmode>
7687 (match_operand:VI4F_256 1 "register_operand" "v")
7688 (parallel [(const_int 4) (const_int 5)
7689 (const_int 6) (const_int 7)]))
7690 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7691 (match_operand:<ssehalfvecmode> 3 "register_operand" "Yk")))]
7692 "TARGET_AVX512F && TARGET_AVX512VL
7693 && rtx_equal_p (operands[2], operands[0])"
7694 "vextract<shuffletype>32x4\t{$0x1, %1, %0%{%3%}|%0%{%3%}, %1, 0x1}"
7695 [(set_attr "type" "sselog1")
7696 (set_attr "length_immediate" "1")
7697 (set_attr "prefix" "evex")
7698 (set_attr "mode" "<sseinsnmode>")])
7700 (define_insn "vec_extract_hi_<mode>_mask"
7701 [(set (match_operand:<ssehalfvecmode> 0 "register_operand" "=v")
7702 (vec_merge:<ssehalfvecmode>
7703 (vec_select:<ssehalfvecmode>
7704 (match_operand:VI4F_256 1 "register_operand" "v")
7705 (parallel [(const_int 4) (const_int 5)
7706 (const_int 6) (const_int 7)]))
7707 (match_operand:<ssehalfvecmode> 2 "vector_move_operand" "0C")
7708 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
7710 "vextract<shuffletype>32x4\t{$0x1, %1, %0%{%3%}%N2|%0%{%3%}%N2, %1, 0x1}"
7711 [(set_attr "type" "sselog1")
7712 (set_attr "length_immediate" "1")
7713 (set_attr "prefix" "evex")
7714 (set_attr "mode" "<sseinsnmode>")])
7716 (define_insn "vec_extract_hi_<mode>"
7717 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand" "=xm, vm")
7718 (vec_select:<ssehalfvecmode>
7719 (match_operand:VI4F_256 1 "register_operand" "x, v")
7720 (parallel [(const_int 4) (const_int 5)
7721 (const_int 6) (const_int 7)])))]
7724 vextract<i128>\t{$0x1, %1, %0|%0, %1, 0x1}
7725 vextract<shuffletype>32x4\t{$0x1, %1, %0|%0, %1, 0x1}"
7726 [(set_attr "isa" "*, avx512vl")
7727 (set_attr "prefix" "vex, evex")
7728 (set_attr "type" "sselog1")
7729 (set_attr "length_immediate" "1")
7730 (set_attr "mode" "<sseinsnmode>")])
7732 (define_insn_and_split "vec_extract_lo_v32hi"
7733 [(set (match_operand:V16HI 0 "nonimmediate_operand" "=v,m")
7735 (match_operand:V32HI 1 "nonimmediate_operand" "vm,v")
7736 (parallel [(const_int 0) (const_int 1)
7737 (const_int 2) (const_int 3)
7738 (const_int 4) (const_int 5)
7739 (const_int 6) (const_int 7)
7740 (const_int 8) (const_int 9)
7741 (const_int 10) (const_int 11)
7742 (const_int 12) (const_int 13)
7743 (const_int 14) (const_int 15)])))]
7744 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7746 "&& reload_completed"
7747 [(set (match_dup 0) (match_dup 1))]
7748 "operands[1] = gen_lowpart (V16HImode, operands[1]);")
7750 (define_insn "vec_extract_hi_v32hi"
7751 [(set (match_operand:V16HI 0 "nonimmediate_operand" "=v,m")
7753 (match_operand:V32HI 1 "register_operand" "v,v")
7754 (parallel [(const_int 16) (const_int 17)
7755 (const_int 18) (const_int 19)
7756 (const_int 20) (const_int 21)
7757 (const_int 22) (const_int 23)
7758 (const_int 24) (const_int 25)
7759 (const_int 26) (const_int 27)
7760 (const_int 28) (const_int 29)
7761 (const_int 30) (const_int 31)])))]
7763 "vextracti64x4\t{$0x1, %1, %0|%0, %1, 0x1}"
7764 [(set_attr "type" "sselog")
7765 (set_attr "prefix_extra" "1")
7766 (set_attr "length_immediate" "1")
7767 (set_attr "memory" "none,store")
7768 (set_attr "prefix" "evex")
7769 (set_attr "mode" "XI")])
7771 (define_insn_and_split "vec_extract_lo_v16hi"
7772 [(set (match_operand:V8HI 0 "nonimmediate_operand" "=v,m")
7774 (match_operand:V16HI 1 "nonimmediate_operand" "vm,v")
7775 (parallel [(const_int 0) (const_int 1)
7776 (const_int 2) (const_int 3)
7777 (const_int 4) (const_int 5)
7778 (const_int 6) (const_int 7)])))]
7779 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7781 "&& reload_completed"
7782 [(set (match_dup 0) (match_dup 1))]
7783 "operands[1] = gen_lowpart (V8HImode, operands[1]);")
7785 (define_insn "vec_extract_hi_v16hi"
7786 [(set (match_operand:V8HI 0 "nonimmediate_operand" "=x,m,v,m,v,m")
7788 (match_operand:V16HI 1 "register_operand" "x,x,v,v,v,v")
7789 (parallel [(const_int 8) (const_int 9)
7790 (const_int 10) (const_int 11)
7791 (const_int 12) (const_int 13)
7792 (const_int 14) (const_int 15)])))]
7795 vextract%~128\t{$0x1, %1, %0|%0, %1, 0x1}
7796 vextract%~128\t{$0x1, %1, %0|%0, %1, 0x1}
7797 vextracti32x4\t{$0x1, %1, %0|%0, %1, 0x1}
7798 vextracti32x4\t{$0x1, %1, %0|%0, %1, 0x1}
7799 vextracti32x4\t{$0x1, %g1, %0|%0, %g1, 0x1}
7800 vextracti32x4\t{$0x1, %g1, %0|%0, %g1, 0x1}"
7801 [(set_attr "type" "sselog")
7802 (set_attr "prefix_extra" "1")
7803 (set_attr "length_immediate" "1")
7804 (set_attr "isa" "*,*,avx512dq,avx512dq,avx512f,avx512f")
7805 (set_attr "memory" "none,store,none,store,none,store")
7806 (set_attr "prefix" "vex,vex,evex,evex,evex,evex")
7807 (set_attr "mode" "OI")])
7809 (define_insn_and_split "vec_extract_lo_v64qi"
7810 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=v,m")
7812 (match_operand:V64QI 1 "nonimmediate_operand" "vm,v")
7813 (parallel [(const_int 0) (const_int 1)
7814 (const_int 2) (const_int 3)
7815 (const_int 4) (const_int 5)
7816 (const_int 6) (const_int 7)
7817 (const_int 8) (const_int 9)
7818 (const_int 10) (const_int 11)
7819 (const_int 12) (const_int 13)
7820 (const_int 14) (const_int 15)
7821 (const_int 16) (const_int 17)
7822 (const_int 18) (const_int 19)
7823 (const_int 20) (const_int 21)
7824 (const_int 22) (const_int 23)
7825 (const_int 24) (const_int 25)
7826 (const_int 26) (const_int 27)
7827 (const_int 28) (const_int 29)
7828 (const_int 30) (const_int 31)])))]
7829 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7831 "&& reload_completed"
7832 [(set (match_dup 0) (match_dup 1))]
7833 "operands[1] = gen_lowpart (V32QImode, operands[1]);")
7835 (define_insn "vec_extract_hi_v64qi"
7836 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=v,m")
7838 (match_operand:V64QI 1 "register_operand" "v,v")
7839 (parallel [(const_int 32) (const_int 33)
7840 (const_int 34) (const_int 35)
7841 (const_int 36) (const_int 37)
7842 (const_int 38) (const_int 39)
7843 (const_int 40) (const_int 41)
7844 (const_int 42) (const_int 43)
7845 (const_int 44) (const_int 45)
7846 (const_int 46) (const_int 47)
7847 (const_int 48) (const_int 49)
7848 (const_int 50) (const_int 51)
7849 (const_int 52) (const_int 53)
7850 (const_int 54) (const_int 55)
7851 (const_int 56) (const_int 57)
7852 (const_int 58) (const_int 59)
7853 (const_int 60) (const_int 61)
7854 (const_int 62) (const_int 63)])))]
7856 "vextracti64x4\t{$0x1, %1, %0|%0, %1, 0x1}"
7857 [(set_attr "type" "sselog")
7858 (set_attr "prefix_extra" "1")
7859 (set_attr "length_immediate" "1")
7860 (set_attr "memory" "none,store")
7861 (set_attr "prefix" "evex")
7862 (set_attr "mode" "XI")])
7864 (define_insn_and_split "vec_extract_lo_v32qi"
7865 [(set (match_operand:V16QI 0 "nonimmediate_operand" "=v,m")
7867 (match_operand:V32QI 1 "nonimmediate_operand" "vm,v")
7868 (parallel [(const_int 0) (const_int 1)
7869 (const_int 2) (const_int 3)
7870 (const_int 4) (const_int 5)
7871 (const_int 6) (const_int 7)
7872 (const_int 8) (const_int 9)
7873 (const_int 10) (const_int 11)
7874 (const_int 12) (const_int 13)
7875 (const_int 14) (const_int 15)])))]
7876 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7878 "&& reload_completed"
7879 [(set (match_dup 0) (match_dup 1))]
7880 "operands[1] = gen_lowpart (V16QImode, operands[1]);")
7882 (define_insn "vec_extract_hi_v32qi"
7883 [(set (match_operand:V16QI 0 "nonimmediate_operand" "=x,m,v,m,v,m")
7885 (match_operand:V32QI 1 "register_operand" "x,x,v,v,v,v")
7886 (parallel [(const_int 16) (const_int 17)
7887 (const_int 18) (const_int 19)
7888 (const_int 20) (const_int 21)
7889 (const_int 22) (const_int 23)
7890 (const_int 24) (const_int 25)
7891 (const_int 26) (const_int 27)
7892 (const_int 28) (const_int 29)
7893 (const_int 30) (const_int 31)])))]
7896 vextract%~128\t{$0x1, %1, %0|%0, %1, 0x1}
7897 vextract%~128\t{$0x1, %1, %0|%0, %1, 0x1}
7898 vextracti32x4\t{$0x1, %1, %0|%0, %1, 0x1}
7899 vextracti32x4\t{$0x1, %1, %0|%0, %1, 0x1}
7900 vextracti32x4\t{$0x1, %g1, %0|%0, %g1, 0x1}
7901 vextracti32x4\t{$0x1, %g1, %0|%0, %g1, 0x1}"
7902 [(set_attr "type" "sselog")
7903 (set_attr "prefix_extra" "1")
7904 (set_attr "length_immediate" "1")
7905 (set_attr "isa" "*,*,avx512dq,avx512dq,avx512f,avx512f")
7906 (set_attr "memory" "none,store,none,store,none,store")
7907 (set_attr "prefix" "vex,vex,evex,evex,evex,evex")
7908 (set_attr "mode" "OI")])
7910 ;; Modes handled by vec_extract patterns.
7911 (define_mode_iterator VEC_EXTRACT_MODE
7912 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX") V16QI
7913 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX") V8HI
7914 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
7915 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI
7916 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
7917 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") V2DF
7918 (V4TI "TARGET_AVX512F") (V2TI "TARGET_AVX")])
7920 (define_expand "vec_extract<mode><ssescalarmodelower>"
7921 [(match_operand:<ssescalarmode> 0 "register_operand")
7922 (match_operand:VEC_EXTRACT_MODE 1 "register_operand")
7923 (match_operand 2 "const_int_operand")]
7926 ix86_expand_vector_extract (false, operands[0], operands[1],
7927 INTVAL (operands[2]));
7931 (define_expand "vec_extract<mode><ssehalfvecmodelower>"
7932 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7933 (match_operand:V_512 1 "register_operand")
7934 (match_operand 2 "const_0_to_1_operand")]
7937 if (INTVAL (operands[2]))
7938 emit_insn (gen_vec_extract_hi_<mode> (operands[0], operands[1]));
7940 emit_insn (gen_vec_extract_lo_<mode> (operands[0], operands[1]));
7944 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7946 ;; Parallel double-precision floating point element swizzling
7948 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7950 (define_insn "<mask_codefor>avx512f_unpckhpd512<mask_name>"
7951 [(set (match_operand:V8DF 0 "register_operand" "=v")
7954 (match_operand:V8DF 1 "register_operand" "v")
7955 (match_operand:V8DF 2 "nonimmediate_operand" "vm"))
7956 (parallel [(const_int 1) (const_int 9)
7957 (const_int 3) (const_int 11)
7958 (const_int 5) (const_int 13)
7959 (const_int 7) (const_int 15)])))]
7961 "vunpckhpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
7962 [(set_attr "type" "sselog")
7963 (set_attr "prefix" "evex")
7964 (set_attr "mode" "V8DF")])
7966 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
7967 (define_insn "avx_unpckhpd256<mask_name>"
7968 [(set (match_operand:V4DF 0 "register_operand" "=v")
7971 (match_operand:V4DF 1 "register_operand" "v")
7972 (match_operand:V4DF 2 "nonimmediate_operand" "vm"))
7973 (parallel [(const_int 1) (const_int 5)
7974 (const_int 3) (const_int 7)])))]
7975 "TARGET_AVX && <mask_avx512vl_condition>"
7976 "vunpckhpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
7977 [(set_attr "type" "sselog")
7978 (set_attr "prefix" "vex")
7979 (set_attr "mode" "V4DF")])
7981 (define_expand "vec_interleave_highv4df"
7985 (match_operand:V4DF 1 "register_operand")
7986 (match_operand:V4DF 2 "nonimmediate_operand"))
7987 (parallel [(const_int 0) (const_int 4)
7988 (const_int 2) (const_int 6)])))
7994 (parallel [(const_int 1) (const_int 5)
7995 (const_int 3) (const_int 7)])))
7996 (set (match_operand:V4DF 0 "register_operand")
8001 (parallel [(const_int 2) (const_int 3)
8002 (const_int 6) (const_int 7)])))]
8005 operands[3] = gen_reg_rtx (V4DFmode);
8006 operands[4] = gen_reg_rtx (V4DFmode);
8010 (define_insn "avx512vl_unpckhpd128_mask"
8011 [(set (match_operand:V2DF 0 "register_operand" "=v")
8015 (match_operand:V2DF 1 "register_operand" "v")
8016 (match_operand:V2DF 2 "nonimmediate_operand" "vm"))
8017 (parallel [(const_int 1) (const_int 3)]))
8018 (match_operand:V2DF 3 "vector_move_operand" "0C")
8019 (match_operand:QI 4 "register_operand" "Yk")))]
8021 "vunpckhpd\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
8022 [(set_attr "type" "sselog")
8023 (set_attr "prefix" "evex")
8024 (set_attr "mode" "V2DF")])
8026 (define_expand "vec_interleave_highv2df"
8027 [(set (match_operand:V2DF 0 "register_operand")
8030 (match_operand:V2DF 1 "nonimmediate_operand")
8031 (match_operand:V2DF 2 "nonimmediate_operand"))
8032 (parallel [(const_int 1)
8036 if (!ix86_vec_interleave_v2df_operator_ok (operands, 1))
8037 operands[2] = force_reg (V2DFmode, operands[2]);
8040 (define_insn "*vec_interleave_highv2df"
8041 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,v,v,x,v,m")
8044 (match_operand:V2DF 1 "nonimmediate_operand" " 0,v,o,o,o,v")
8045 (match_operand:V2DF 2 "nonimmediate_operand" " x,v,1,0,v,0"))
8046 (parallel [(const_int 1)
8048 "TARGET_SSE2 && ix86_vec_interleave_v2df_operator_ok (operands, 1)"
8050 unpckhpd\t{%2, %0|%0, %2}
8051 vunpckhpd\t{%2, %1, %0|%0, %1, %2}
8052 %vmovddup\t{%H1, %0|%0, %H1}
8053 movlpd\t{%H1, %0|%0, %H1}
8054 vmovlpd\t{%H1, %2, %0|%0, %2, %H1}
8055 %vmovhpd\t{%1, %0|%q0, %1}"
8056 [(set_attr "isa" "noavx,avx,sse3,noavx,avx,*")
8057 (set_attr "type" "sselog,sselog,sselog,ssemov,ssemov,ssemov")
8058 (set (attr "prefix_data16")
8059 (if_then_else (eq_attr "alternative" "3,5")
8061 (const_string "*")))
8062 (set_attr "prefix" "orig,maybe_evex,maybe_vex,orig,maybe_evex,maybe_vex")
8063 (set_attr "mode" "V2DF,V2DF,DF,V1DF,V1DF,V1DF")])
8065 (define_expand "avx512f_movddup512<mask_name>"
8066 [(set (match_operand:V8DF 0 "register_operand")
8069 (match_operand:V8DF 1 "nonimmediate_operand")
8071 (parallel [(const_int 0) (const_int 8)
8072 (const_int 2) (const_int 10)
8073 (const_int 4) (const_int 12)
8074 (const_int 6) (const_int 14)])))]
8077 (define_expand "avx512f_unpcklpd512<mask_name>"
8078 [(set (match_operand:V8DF 0 "register_operand")
8081 (match_operand:V8DF 1 "register_operand")
8082 (match_operand:V8DF 2 "nonimmediate_operand"))
8083 (parallel [(const_int 0) (const_int 8)
8084 (const_int 2) (const_int 10)
8085 (const_int 4) (const_int 12)
8086 (const_int 6) (const_int 14)])))]
8089 (define_insn "*avx512f_unpcklpd512<mask_name>"
8090 [(set (match_operand:V8DF 0 "register_operand" "=v,v")
8093 (match_operand:V8DF 1 "nonimmediate_operand" "vm, v")
8094 (match_operand:V8DF 2 "nonimmediate_operand" "1 ,vm"))
8095 (parallel [(const_int 0) (const_int 8)
8096 (const_int 2) (const_int 10)
8097 (const_int 4) (const_int 12)
8098 (const_int 6) (const_int 14)])))]
8101 vmovddup\t{%1, %0<mask_operand3>|%0<mask_operand3>, %1}
8102 vunpcklpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8103 [(set_attr "type" "sselog")
8104 (set_attr "prefix" "evex")
8105 (set_attr "mode" "V8DF")])
8107 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
8108 (define_expand "avx_movddup256<mask_name>"
8109 [(set (match_operand:V4DF 0 "register_operand")
8112 (match_operand:V4DF 1 "nonimmediate_operand")
8114 (parallel [(const_int 0) (const_int 4)
8115 (const_int 2) (const_int 6)])))]
8116 "TARGET_AVX && <mask_avx512vl_condition>")
8118 (define_expand "avx_unpcklpd256<mask_name>"
8119 [(set (match_operand:V4DF 0 "register_operand")
8122 (match_operand:V4DF 1 "register_operand")
8123 (match_operand:V4DF 2 "nonimmediate_operand"))
8124 (parallel [(const_int 0) (const_int 4)
8125 (const_int 2) (const_int 6)])))]
8126 "TARGET_AVX && <mask_avx512vl_condition>")
8128 (define_insn "*avx_unpcklpd256<mask_name>"
8129 [(set (match_operand:V4DF 0 "register_operand" "=v,v")
8132 (match_operand:V4DF 1 "nonimmediate_operand" " v,m")
8133 (match_operand:V4DF 2 "nonimmediate_operand" "vm,1"))
8134 (parallel [(const_int 0) (const_int 4)
8135 (const_int 2) (const_int 6)])))]
8136 "TARGET_AVX && <mask_avx512vl_condition>"
8138 vunpcklpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
8139 vmovddup\t{%1, %0<mask_operand3>|%0<mask_operand3>, %1}"
8140 [(set_attr "type" "sselog")
8141 (set_attr "prefix" "vex")
8142 (set_attr "mode" "V4DF")])
8144 (define_expand "vec_interleave_lowv4df"
8148 (match_operand:V4DF 1 "register_operand")
8149 (match_operand:V4DF 2 "nonimmediate_operand"))
8150 (parallel [(const_int 0) (const_int 4)
8151 (const_int 2) (const_int 6)])))
8157 (parallel [(const_int 1) (const_int 5)
8158 (const_int 3) (const_int 7)])))
8159 (set (match_operand:V4DF 0 "register_operand")
8164 (parallel [(const_int 0) (const_int 1)
8165 (const_int 4) (const_int 5)])))]
8168 operands[3] = gen_reg_rtx (V4DFmode);
8169 operands[4] = gen_reg_rtx (V4DFmode);
8172 (define_insn "avx512vl_unpcklpd128_mask"
8173 [(set (match_operand:V2DF 0 "register_operand" "=v")
8177 (match_operand:V2DF 1 "register_operand" "v")
8178 (match_operand:V2DF 2 "nonimmediate_operand" "vm"))
8179 (parallel [(const_int 0) (const_int 2)]))
8180 (match_operand:V2DF 3 "vector_move_operand" "0C")
8181 (match_operand:QI 4 "register_operand" "Yk")))]
8183 "vunpcklpd\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
8184 [(set_attr "type" "sselog")
8185 (set_attr "prefix" "evex")
8186 (set_attr "mode" "V2DF")])
8188 (define_expand "vec_interleave_lowv2df"
8189 [(set (match_operand:V2DF 0 "register_operand")
8192 (match_operand:V2DF 1 "nonimmediate_operand")
8193 (match_operand:V2DF 2 "nonimmediate_operand"))
8194 (parallel [(const_int 0)
8198 if (!ix86_vec_interleave_v2df_operator_ok (operands, 0))
8199 operands[1] = force_reg (V2DFmode, operands[1]);
8202 (define_insn "*vec_interleave_lowv2df"
8203 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,v,v,x,v,o")
8206 (match_operand:V2DF 1 "nonimmediate_operand" " 0,v,m,0,v,0")
8207 (match_operand:V2DF 2 "nonimmediate_operand" " x,v,1,m,m,v"))
8208 (parallel [(const_int 0)
8210 "TARGET_SSE2 && ix86_vec_interleave_v2df_operator_ok (operands, 0)"
8212 unpcklpd\t{%2, %0|%0, %2}
8213 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
8214 %vmovddup\t{%1, %0|%0, %q1}
8215 movhpd\t{%2, %0|%0, %q2}
8216 vmovhpd\t{%2, %1, %0|%0, %1, %q2}
8217 %vmovlpd\t{%2, %H0|%H0, %2}"
8218 [(set_attr "isa" "noavx,avx,sse3,noavx,avx,*")
8219 (set_attr "type" "sselog,sselog,sselog,ssemov,ssemov,ssemov")
8220 (set (attr "prefix_data16")
8221 (if_then_else (eq_attr "alternative" "3,5")
8223 (const_string "*")))
8224 (set_attr "prefix" "orig,maybe_evex,maybe_vex,orig,maybe_evex,maybe_vex")
8225 (set_attr "mode" "V2DF,V2DF,DF,V1DF,V1DF,V1DF")])
8228 [(set (match_operand:V2DF 0 "memory_operand")
8231 (match_operand:V2DF 1 "register_operand")
8233 (parallel [(const_int 0)
8235 "TARGET_SSE3 && reload_completed"
8238 rtx low = gen_lowpart (DFmode, operands[1]);
8240 emit_move_insn (adjust_address (operands[0], DFmode, 0), low);
8241 emit_move_insn (adjust_address (operands[0], DFmode, 8), low);
8246 [(set (match_operand:V2DF 0 "register_operand")
8249 (match_operand:V2DF 1 "memory_operand")
8251 (parallel [(match_operand:SI 2 "const_0_to_1_operand")
8252 (match_operand:SI 3 "const_int_operand")])))]
8253 "TARGET_SSE3 && INTVAL (operands[2]) + 2 == INTVAL (operands[3])"
8254 [(set (match_dup 0) (vec_duplicate:V2DF (match_dup 1)))]
8256 operands[1] = adjust_address (operands[1], DFmode, INTVAL (operands[2]) * 8);
8259 (define_insn "avx512f_vmscalef<mode><round_name>"
8260 [(set (match_operand:VF_128 0 "register_operand" "=v")
8263 [(match_operand:VF_128 1 "register_operand" "v")
8264 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>")]
8269 "vscalef<ssescalarmodesuffix>\t{<round_op3>%2, %1, %0|%0, %1, %2<round_op3>}"
8270 [(set_attr "prefix" "evex")
8271 (set_attr "mode" "<ssescalarmode>")])
8273 (define_insn "<avx512>_scalef<mode><mask_name><round_name>"
8274 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8276 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
8277 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")]
8280 "vscalef<ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
8281 [(set_attr "prefix" "evex")
8282 (set_attr "mode" "<MODE>")])
8284 (define_expand "<avx512>_vternlog<mode>_maskz"
8285 [(match_operand:VI48_AVX512VL 0 "register_operand")
8286 (match_operand:VI48_AVX512VL 1 "register_operand")
8287 (match_operand:VI48_AVX512VL 2 "register_operand")
8288 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand")
8289 (match_operand:SI 4 "const_0_to_255_operand")
8290 (match_operand:<avx512fmaskmode> 5 "register_operand")]
8293 emit_insn (gen_<avx512>_vternlog<mode>_maskz_1 (
8294 operands[0], operands[1], operands[2], operands[3],
8295 operands[4], CONST0_RTX (<MODE>mode), operands[5]));
8299 (define_insn "<avx512>_vternlog<mode><sd_maskz_name>"
8300 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
8301 (unspec:VI48_AVX512VL
8302 [(match_operand:VI48_AVX512VL 1 "register_operand" "0")
8303 (match_operand:VI48_AVX512VL 2 "register_operand" "v")
8304 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand" "vm")
8305 (match_operand:SI 4 "const_0_to_255_operand")]
8308 "vpternlog<ssemodesuffix>\t{%4, %3, %2, %0<sd_mask_op5>|%0<sd_mask_op5>, %2, %3, %4}"
8309 [(set_attr "type" "sselog")
8310 (set_attr "prefix" "evex")
8311 (set_attr "mode" "<sseinsnmode>")])
8313 (define_insn "<avx512>_vternlog<mode>_mask"
8314 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
8315 (vec_merge:VI48_AVX512VL
8316 (unspec:VI48_AVX512VL
8317 [(match_operand:VI48_AVX512VL 1 "register_operand" "0")
8318 (match_operand:VI48_AVX512VL 2 "register_operand" "v")
8319 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand" "vm")
8320 (match_operand:SI 4 "const_0_to_255_operand")]
8323 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
8325 "vpternlog<ssemodesuffix>\t{%4, %3, %2, %0%{%5%}|%0%{%5%}, %2, %3, %4}"
8326 [(set_attr "type" "sselog")
8327 (set_attr "prefix" "evex")
8328 (set_attr "mode" "<sseinsnmode>")])
8330 (define_insn "<avx512>_getexp<mode><mask_name><round_saeonly_name>"
8331 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8332 (unspec:VF_AVX512VL [(match_operand:VF_AVX512VL 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
8335 "vgetexp<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}";
8336 [(set_attr "prefix" "evex")
8337 (set_attr "mode" "<MODE>")])
8339 (define_insn "avx512f_sgetexp<mode><mask_scalar_name><round_saeonly_scalar_name>"
8340 [(set (match_operand:VF_128 0 "register_operand" "=v")
8343 [(match_operand:VF_128 1 "register_operand" "v")
8344 (match_operand:VF_128 2 "<round_saeonly_scalar_nimm_predicate>" "<round_saeonly_scalar_constraint>")]
8349 "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>}";
8350 [(set_attr "prefix" "evex")
8351 (set_attr "mode" "<ssescalarmode>")])
8353 (define_insn "<mask_codefor><avx512>_align<mode><mask_name>"
8354 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
8355 (unspec:VI48_AVX512VL [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
8356 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")
8357 (match_operand:SI 3 "const_0_to_255_operand")]
8360 "valign<ssemodesuffix>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3}";
8361 [(set_attr "prefix" "evex")
8362 (set_attr "mode" "<sseinsnmode>")])
8364 (define_expand "avx512f_shufps512_mask"
8365 [(match_operand:V16SF 0 "register_operand")
8366 (match_operand:V16SF 1 "register_operand")
8367 (match_operand:V16SF 2 "nonimmediate_operand")
8368 (match_operand:SI 3 "const_0_to_255_operand")
8369 (match_operand:V16SF 4 "register_operand")
8370 (match_operand:HI 5 "register_operand")]
8373 int mask = INTVAL (operands[3]);
8374 emit_insn (gen_avx512f_shufps512_1_mask (operands[0], operands[1], operands[2],
8375 GEN_INT ((mask >> 0) & 3),
8376 GEN_INT ((mask >> 2) & 3),
8377 GEN_INT (((mask >> 4) & 3) + 16),
8378 GEN_INT (((mask >> 6) & 3) + 16),
8379 GEN_INT (((mask >> 0) & 3) + 4),
8380 GEN_INT (((mask >> 2) & 3) + 4),
8381 GEN_INT (((mask >> 4) & 3) + 20),
8382 GEN_INT (((mask >> 6) & 3) + 20),
8383 GEN_INT (((mask >> 0) & 3) + 8),
8384 GEN_INT (((mask >> 2) & 3) + 8),
8385 GEN_INT (((mask >> 4) & 3) + 24),
8386 GEN_INT (((mask >> 6) & 3) + 24),
8387 GEN_INT (((mask >> 0) & 3) + 12),
8388 GEN_INT (((mask >> 2) & 3) + 12),
8389 GEN_INT (((mask >> 4) & 3) + 28),
8390 GEN_INT (((mask >> 6) & 3) + 28),
8391 operands[4], operands[5]));
8396 (define_expand "<avx512>_fixupimm<mode>_maskz<round_saeonly_expand_name>"
8397 [(match_operand:VF_AVX512VL 0 "register_operand")
8398 (match_operand:VF_AVX512VL 1 "register_operand")
8399 (match_operand:VF_AVX512VL 2 "register_operand")
8400 (match_operand:<sseintvecmode> 3 "<round_saeonly_expand_nimm_predicate>")
8401 (match_operand:SI 4 "const_0_to_255_operand")
8402 (match_operand:<avx512fmaskmode> 5 "register_operand")]
8405 emit_insn (gen_<avx512>_fixupimm<mode>_maskz_1<round_saeonly_expand_name> (
8406 operands[0], operands[1], operands[2], operands[3],
8407 operands[4], CONST0_RTX (<MODE>mode), operands[5]
8408 <round_saeonly_expand_operand6>));
8412 (define_insn "<avx512>_fixupimm<mode><sd_maskz_name><round_saeonly_name>"
8413 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8415 [(match_operand:VF_AVX512VL 1 "register_operand" "0")
8416 (match_operand:VF_AVX512VL 2 "register_operand" "v")
8417 (match_operand:<sseintvecmode> 3 "nonimmediate_operand" "<round_saeonly_constraint>")
8418 (match_operand:SI 4 "const_0_to_255_operand")]
8421 "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}";
8422 [(set_attr "prefix" "evex")
8423 (set_attr "mode" "<MODE>")])
8425 (define_insn "<avx512>_fixupimm<mode>_mask<round_saeonly_name>"
8426 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8427 (vec_merge:VF_AVX512VL
8429 [(match_operand:VF_AVX512VL 1 "register_operand" "0")
8430 (match_operand:VF_AVX512VL 2 "register_operand" "v")
8431 (match_operand:<sseintvecmode> 3 "nonimmediate_operand" "<round_saeonly_constraint>")
8432 (match_operand:SI 4 "const_0_to_255_operand")]
8435 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
8437 "vfixupimm<ssemodesuffix>\t{%4, <round_saeonly_op6>%3, %2, %0%{%5%}|%0%{%5%}, %2, %3<round_saeonly_op6>, %4}";
8438 [(set_attr "prefix" "evex")
8439 (set_attr "mode" "<MODE>")])
8441 (define_expand "avx512f_sfixupimm<mode>_maskz<round_saeonly_expand_name>"
8442 [(match_operand:VF_128 0 "register_operand")
8443 (match_operand:VF_128 1 "register_operand")
8444 (match_operand:VF_128 2 "register_operand")
8445 (match_operand:<sseintvecmode> 3 "<round_saeonly_expand_nimm_predicate>")
8446 (match_operand:SI 4 "const_0_to_255_operand")
8447 (match_operand:<avx512fmaskmode> 5 "register_operand")]
8450 emit_insn (gen_avx512f_sfixupimm<mode>_maskz_1<round_saeonly_expand_name> (
8451 operands[0], operands[1], operands[2], operands[3],
8452 operands[4], CONST0_RTX (<MODE>mode), operands[5]
8453 <round_saeonly_expand_operand6>));
8457 (define_insn "avx512f_sfixupimm<mode><sd_maskz_name><round_saeonly_name>"
8458 [(set (match_operand:VF_128 0 "register_operand" "=v")
8461 [(match_operand:VF_128 1 "register_operand" "0")
8462 (match_operand:VF_128 2 "register_operand" "v")
8463 (match_operand:<sseintvecmode> 3 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
8464 (match_operand:SI 4 "const_0_to_255_operand")]
8469 "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}";
8470 [(set_attr "prefix" "evex")
8471 (set_attr "mode" "<ssescalarmode>")])
8473 (define_insn "avx512f_sfixupimm<mode>_mask<round_saeonly_name>"
8474 [(set (match_operand:VF_128 0 "register_operand" "=v")
8478 [(match_operand:VF_128 1 "register_operand" "0")
8479 (match_operand:VF_128 2 "register_operand" "v")
8480 (match_operand:<sseintvecmode> 3 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
8481 (match_operand:SI 4 "const_0_to_255_operand")]
8486 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
8488 "vfixupimm<ssescalarmodesuffix>\t{%4, <round_saeonly_op6>%3, %2, %0%{%5%}|%0%{%5%}, %2, %3<round_saeonly_op6>, %4}";
8489 [(set_attr "prefix" "evex")
8490 (set_attr "mode" "<ssescalarmode>")])
8492 (define_insn "<avx512>_rndscale<mode><mask_name><round_saeonly_name>"
8493 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8495 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "<round_saeonly_constraint>")
8496 (match_operand:SI 2 "const_0_to_255_operand")]
8499 "vrndscale<ssemodesuffix>\t{%2, <round_saeonly_mask_op3>%1, %0<mask_operand3>|%0<mask_operand3>, %1<round_saeonly_mask_op3>, %2}"
8500 [(set_attr "length_immediate" "1")
8501 (set_attr "prefix" "evex")
8502 (set_attr "mode" "<MODE>")])
8504 (define_insn "avx512f_rndscale<mode><round_saeonly_name>"
8505 [(set (match_operand:VF_128 0 "register_operand" "=v")
8508 [(match_operand:VF_128 1 "register_operand" "v")
8509 (match_operand:VF_128 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
8510 (match_operand:SI 3 "const_0_to_255_operand")]
8515 "vrndscale<ssescalarmodesuffix>\t{%3, <round_saeonly_op4>%2, %1, %0|%0, %1, %2<round_saeonly_op4>, %3}"
8516 [(set_attr "length_immediate" "1")
8517 (set_attr "prefix" "evex")
8518 (set_attr "mode" "<MODE>")])
8520 ;; One bit in mask selects 2 elements.
8521 (define_insn "avx512f_shufps512_1<mask_name>"
8522 [(set (match_operand:V16SF 0 "register_operand" "=v")
8525 (match_operand:V16SF 1 "register_operand" "v")
8526 (match_operand:V16SF 2 "nonimmediate_operand" "vm"))
8527 (parallel [(match_operand 3 "const_0_to_3_operand")
8528 (match_operand 4 "const_0_to_3_operand")
8529 (match_operand 5 "const_16_to_19_operand")
8530 (match_operand 6 "const_16_to_19_operand")
8531 (match_operand 7 "const_4_to_7_operand")
8532 (match_operand 8 "const_4_to_7_operand")
8533 (match_operand 9 "const_20_to_23_operand")
8534 (match_operand 10 "const_20_to_23_operand")
8535 (match_operand 11 "const_8_to_11_operand")
8536 (match_operand 12 "const_8_to_11_operand")
8537 (match_operand 13 "const_24_to_27_operand")
8538 (match_operand 14 "const_24_to_27_operand")
8539 (match_operand 15 "const_12_to_15_operand")
8540 (match_operand 16 "const_12_to_15_operand")
8541 (match_operand 17 "const_28_to_31_operand")
8542 (match_operand 18 "const_28_to_31_operand")])))]
8544 && (INTVAL (operands[3]) == (INTVAL (operands[7]) - 4)
8545 && INTVAL (operands[4]) == (INTVAL (operands[8]) - 4)
8546 && INTVAL (operands[5]) == (INTVAL (operands[9]) - 4)
8547 && INTVAL (operands[6]) == (INTVAL (operands[10]) - 4)
8548 && INTVAL (operands[3]) == (INTVAL (operands[11]) - 8)
8549 && INTVAL (operands[4]) == (INTVAL (operands[12]) - 8)
8550 && INTVAL (operands[5]) == (INTVAL (operands[13]) - 8)
8551 && INTVAL (operands[6]) == (INTVAL (operands[14]) - 8)
8552 && INTVAL (operands[3]) == (INTVAL (operands[15]) - 12)
8553 && INTVAL (operands[4]) == (INTVAL (operands[16]) - 12)
8554 && INTVAL (operands[5]) == (INTVAL (operands[17]) - 12)
8555 && INTVAL (operands[6]) == (INTVAL (operands[18]) - 12))"
8558 mask = INTVAL (operands[3]);
8559 mask |= INTVAL (operands[4]) << 2;
8560 mask |= (INTVAL (operands[5]) - 16) << 4;
8561 mask |= (INTVAL (operands[6]) - 16) << 6;
8562 operands[3] = GEN_INT (mask);
8564 return "vshufps\t{%3, %2, %1, %0<mask_operand19>|%0<mask_operand19>, %1, %2, %3}";
8566 [(set_attr "type" "sselog")
8567 (set_attr "length_immediate" "1")
8568 (set_attr "prefix" "evex")
8569 (set_attr "mode" "V16SF")])
8571 (define_expand "avx512f_shufpd512_mask"
8572 [(match_operand:V8DF 0 "register_operand")
8573 (match_operand:V8DF 1 "register_operand")
8574 (match_operand:V8DF 2 "nonimmediate_operand")
8575 (match_operand:SI 3 "const_0_to_255_operand")
8576 (match_operand:V8DF 4 "register_operand")
8577 (match_operand:QI 5 "register_operand")]
8580 int mask = INTVAL (operands[3]);
8581 emit_insn (gen_avx512f_shufpd512_1_mask (operands[0], operands[1], operands[2],
8583 GEN_INT (mask & 2 ? 9 : 8),
8584 GEN_INT (mask & 4 ? 3 : 2),
8585 GEN_INT (mask & 8 ? 11 : 10),
8586 GEN_INT (mask & 16 ? 5 : 4),
8587 GEN_INT (mask & 32 ? 13 : 12),
8588 GEN_INT (mask & 64 ? 7 : 6),
8589 GEN_INT (mask & 128 ? 15 : 14),
8590 operands[4], operands[5]));
8594 (define_insn "avx512f_shufpd512_1<mask_name>"
8595 [(set (match_operand:V8DF 0 "register_operand" "=v")
8598 (match_operand:V8DF 1 "register_operand" "v")
8599 (match_operand:V8DF 2 "nonimmediate_operand" "vm"))
8600 (parallel [(match_operand 3 "const_0_to_1_operand")
8601 (match_operand 4 "const_8_to_9_operand")
8602 (match_operand 5 "const_2_to_3_operand")
8603 (match_operand 6 "const_10_to_11_operand")
8604 (match_operand 7 "const_4_to_5_operand")
8605 (match_operand 8 "const_12_to_13_operand")
8606 (match_operand 9 "const_6_to_7_operand")
8607 (match_operand 10 "const_14_to_15_operand")])))]
8611 mask = INTVAL (operands[3]);
8612 mask |= (INTVAL (operands[4]) - 8) << 1;
8613 mask |= (INTVAL (operands[5]) - 2) << 2;
8614 mask |= (INTVAL (operands[6]) - 10) << 3;
8615 mask |= (INTVAL (operands[7]) - 4) << 4;
8616 mask |= (INTVAL (operands[8]) - 12) << 5;
8617 mask |= (INTVAL (operands[9]) - 6) << 6;
8618 mask |= (INTVAL (operands[10]) - 14) << 7;
8619 operands[3] = GEN_INT (mask);
8621 return "vshufpd\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
8623 [(set_attr "type" "sselog")
8624 (set_attr "length_immediate" "1")
8625 (set_attr "prefix" "evex")
8626 (set_attr "mode" "V8DF")])
8628 (define_expand "avx_shufpd256<mask_expand4_name>"
8629 [(match_operand:V4DF 0 "register_operand")
8630 (match_operand:V4DF 1 "register_operand")
8631 (match_operand:V4DF 2 "nonimmediate_operand")
8632 (match_operand:SI 3 "const_int_operand")]
8635 int mask = INTVAL (operands[3]);
8636 emit_insn (gen_avx_shufpd256_1<mask_expand4_name> (operands[0],
8640 GEN_INT (mask & 2 ? 5 : 4),
8641 GEN_INT (mask & 4 ? 3 : 2),
8642 GEN_INT (mask & 8 ? 7 : 6)
8643 <mask_expand4_args>));
8647 (define_insn "avx_shufpd256_1<mask_name>"
8648 [(set (match_operand:V4DF 0 "register_operand" "=v")
8651 (match_operand:V4DF 1 "register_operand" "v")
8652 (match_operand:V4DF 2 "nonimmediate_operand" "vm"))
8653 (parallel [(match_operand 3 "const_0_to_1_operand")
8654 (match_operand 4 "const_4_to_5_operand")
8655 (match_operand 5 "const_2_to_3_operand")
8656 (match_operand 6 "const_6_to_7_operand")])))]
8657 "TARGET_AVX && <mask_avx512vl_condition>"
8660 mask = INTVAL (operands[3]);
8661 mask |= (INTVAL (operands[4]) - 4) << 1;
8662 mask |= (INTVAL (operands[5]) - 2) << 2;
8663 mask |= (INTVAL (operands[6]) - 6) << 3;
8664 operands[3] = GEN_INT (mask);
8666 return "vshufpd\t{%3, %2, %1, %0<mask_operand7>|%0<mask_operand7>, %1, %2, %3}";
8668 [(set_attr "type" "sseshuf")
8669 (set_attr "length_immediate" "1")
8670 (set_attr "prefix" "vex")
8671 (set_attr "mode" "V4DF")])
8673 (define_expand "sse2_shufpd<mask_expand4_name>"
8674 [(match_operand:V2DF 0 "register_operand")
8675 (match_operand:V2DF 1 "register_operand")
8676 (match_operand:V2DF 2 "vector_operand")
8677 (match_operand:SI 3 "const_int_operand")]
8680 int mask = INTVAL (operands[3]);
8681 emit_insn (gen_sse2_shufpd_v2df<mask_expand4_name> (operands[0], operands[1],
8682 operands[2], GEN_INT (mask & 1),
8683 GEN_INT (mask & 2 ? 3 : 2)
8684 <mask_expand4_args>));
8688 (define_insn "sse2_shufpd_v2df_mask"
8689 [(set (match_operand:V2DF 0 "register_operand" "=v")
8693 (match_operand:V2DF 1 "register_operand" "v")
8694 (match_operand:V2DF 2 "nonimmediate_operand" "vm"))
8695 (parallel [(match_operand 3 "const_0_to_1_operand")
8696 (match_operand 4 "const_2_to_3_operand")]))
8697 (match_operand:V2DF 5 "vector_move_operand" "0C")
8698 (match_operand:QI 6 "register_operand" "Yk")))]
8702 mask = INTVAL (operands[3]);
8703 mask |= (INTVAL (operands[4]) - 2) << 1;
8704 operands[3] = GEN_INT (mask);
8706 return "vshufpd\t{%3, %2, %1, %0%{%6%}%N5|%0%{6%}%N5, %1, %2, %3}";
8708 [(set_attr "type" "sseshuf")
8709 (set_attr "length_immediate" "1")
8710 (set_attr "prefix" "evex")
8711 (set_attr "mode" "V2DF")])
8713 ;; punpcklqdq and punpckhqdq are shorter than shufpd.
8714 (define_insn "avx2_interleave_highv4di<mask_name>"
8715 [(set (match_operand:V4DI 0 "register_operand" "=v")
8718 (match_operand:V4DI 1 "register_operand" "v")
8719 (match_operand:V4DI 2 "nonimmediate_operand" "vm"))
8720 (parallel [(const_int 1)
8724 "TARGET_AVX2 && <mask_avx512vl_condition>"
8725 "vpunpckhqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8726 [(set_attr "type" "sselog")
8727 (set_attr "prefix" "vex")
8728 (set_attr "mode" "OI")])
8730 (define_insn "<mask_codefor>avx512f_interleave_highv8di<mask_name>"
8731 [(set (match_operand:V8DI 0 "register_operand" "=v")
8734 (match_operand:V8DI 1 "register_operand" "v")
8735 (match_operand:V8DI 2 "nonimmediate_operand" "vm"))
8736 (parallel [(const_int 1) (const_int 9)
8737 (const_int 3) (const_int 11)
8738 (const_int 5) (const_int 13)
8739 (const_int 7) (const_int 15)])))]
8741 "vpunpckhqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8742 [(set_attr "type" "sselog")
8743 (set_attr "prefix" "evex")
8744 (set_attr "mode" "XI")])
8746 (define_insn "vec_interleave_highv2di<mask_name>"
8747 [(set (match_operand:V2DI 0 "register_operand" "=x,v")
8750 (match_operand:V2DI 1 "register_operand" "0,v")
8751 (match_operand:V2DI 2 "vector_operand" "xBm,vm"))
8752 (parallel [(const_int 1)
8754 "TARGET_SSE2 && <mask_avx512vl_condition>"
8756 punpckhqdq\t{%2, %0|%0, %2}
8757 vpunpckhqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8758 [(set_attr "isa" "noavx,avx")
8759 (set_attr "type" "sselog")
8760 (set_attr "prefix_data16" "1,*")
8761 (set_attr "prefix" "orig,<mask_prefix>")
8762 (set_attr "mode" "TI")])
8764 (define_insn "avx2_interleave_lowv4di<mask_name>"
8765 [(set (match_operand:V4DI 0 "register_operand" "=v")
8768 (match_operand:V4DI 1 "register_operand" "v")
8769 (match_operand:V4DI 2 "nonimmediate_operand" "vm"))
8770 (parallel [(const_int 0)
8774 "TARGET_AVX2 && <mask_avx512vl_condition>"
8775 "vpunpcklqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8776 [(set_attr "type" "sselog")
8777 (set_attr "prefix" "vex")
8778 (set_attr "mode" "OI")])
8780 (define_insn "<mask_codefor>avx512f_interleave_lowv8di<mask_name>"
8781 [(set (match_operand:V8DI 0 "register_operand" "=v")
8784 (match_operand:V8DI 1 "register_operand" "v")
8785 (match_operand:V8DI 2 "nonimmediate_operand" "vm"))
8786 (parallel [(const_int 0) (const_int 8)
8787 (const_int 2) (const_int 10)
8788 (const_int 4) (const_int 12)
8789 (const_int 6) (const_int 14)])))]
8791 "vpunpcklqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8792 [(set_attr "type" "sselog")
8793 (set_attr "prefix" "evex")
8794 (set_attr "mode" "XI")])
8796 (define_insn "vec_interleave_lowv2di<mask_name>"
8797 [(set (match_operand:V2DI 0 "register_operand" "=x,v")
8800 (match_operand:V2DI 1 "register_operand" "0,v")
8801 (match_operand:V2DI 2 "vector_operand" "xBm,vm"))
8802 (parallel [(const_int 0)
8804 "TARGET_SSE2 && <mask_avx512vl_condition>"
8806 punpcklqdq\t{%2, %0|%0, %2}
8807 vpunpcklqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8808 [(set_attr "isa" "noavx,avx")
8809 (set_attr "type" "sselog")
8810 (set_attr "prefix_data16" "1,*")
8811 (set_attr "prefix" "orig,vex")
8812 (set_attr "mode" "TI")])
8814 (define_insn "sse2_shufpd_<mode>"
8815 [(set (match_operand:VI8F_128 0 "register_operand" "=x,v")
8816 (vec_select:VI8F_128
8817 (vec_concat:<ssedoublevecmode>
8818 (match_operand:VI8F_128 1 "register_operand" "0,v")
8819 (match_operand:VI8F_128 2 "vector_operand" "xBm,vm"))
8820 (parallel [(match_operand 3 "const_0_to_1_operand")
8821 (match_operand 4 "const_2_to_3_operand")])))]
8825 mask = INTVAL (operands[3]);
8826 mask |= (INTVAL (operands[4]) - 2) << 1;
8827 operands[3] = GEN_INT (mask);
8829 switch (which_alternative)
8832 return "shufpd\t{%3, %2, %0|%0, %2, %3}";
8834 return "vshufpd\t{%3, %2, %1, %0|%0, %1, %2, %3}";
8839 [(set_attr "isa" "noavx,avx")
8840 (set_attr "type" "sseshuf")
8841 (set_attr "length_immediate" "1")
8842 (set_attr "prefix" "orig,maybe_evex")
8843 (set_attr "mode" "V2DF")])
8845 ;; Avoid combining registers from different units in a single alternative,
8846 ;; see comment above inline_secondary_memory_needed function in i386.c
8847 (define_insn "sse2_storehpd"
8848 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,Yv,x,*f,r")
8850 (match_operand:V2DF 1 "nonimmediate_operand" " v,0, v,o,o,o")
8851 (parallel [(const_int 1)])))]
8852 "TARGET_SSE2 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
8854 %vmovhpd\t{%1, %0|%0, %1}
8856 vunpckhpd\t{%d1, %0|%0, %d1}
8860 [(set_attr "isa" "*,noavx,avx,*,*,*")
8861 (set_attr "type" "ssemov,sselog1,sselog1,ssemov,fmov,imov")
8862 (set (attr "prefix_data16")
8864 (and (eq_attr "alternative" "0")
8865 (not (match_test "TARGET_AVX")))
8867 (const_string "*")))
8868 (set_attr "prefix" "maybe_vex,orig,maybe_evex,*,*,*")
8869 (set_attr "mode" "V1DF,V1DF,V2DF,DF,DF,DF")])
8872 [(set (match_operand:DF 0 "register_operand")
8874 (match_operand:V2DF 1 "memory_operand")
8875 (parallel [(const_int 1)])))]
8876 "TARGET_SSE2 && reload_completed"
8877 [(set (match_dup 0) (match_dup 1))]
8878 "operands[1] = adjust_address (operands[1], DFmode, 8);")
8880 (define_insn "*vec_extractv2df_1_sse"
8881 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,x")
8883 (match_operand:V2DF 1 "nonimmediate_operand" "x,x,o")
8884 (parallel [(const_int 1)])))]
8885 "!TARGET_SSE2 && TARGET_SSE
8886 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
8888 movhps\t{%1, %0|%q0, %1}
8889 movhlps\t{%1, %0|%0, %1}
8890 movlps\t{%H1, %0|%0, %H1}"
8891 [(set_attr "type" "ssemov")
8892 (set_attr "mode" "V2SF,V4SF,V2SF")])
8894 ;; Avoid combining registers from different units in a single alternative,
8895 ;; see comment above inline_secondary_memory_needed function in i386.c
8896 (define_insn "sse2_storelpd"
8897 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,x,*f,r")
8899 (match_operand:V2DF 1 "nonimmediate_operand" " v,x,m,m,m")
8900 (parallel [(const_int 0)])))]
8901 "TARGET_SSE2 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
8903 %vmovlpd\t{%1, %0|%0, %1}
8908 [(set_attr "type" "ssemov,ssemov,ssemov,fmov,imov")
8909 (set (attr "prefix_data16")
8910 (if_then_else (eq_attr "alternative" "0")
8912 (const_string "*")))
8913 (set_attr "prefix" "maybe_vex")
8914 (set_attr "mode" "V1DF,DF,DF,DF,DF")])
8917 [(set (match_operand:DF 0 "register_operand")
8919 (match_operand:V2DF 1 "nonimmediate_operand")
8920 (parallel [(const_int 0)])))]
8921 "TARGET_SSE2 && reload_completed"
8922 [(set (match_dup 0) (match_dup 1))]
8923 "operands[1] = gen_lowpart (DFmode, operands[1]);")
8925 (define_insn "*vec_extractv2df_0_sse"
8926 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,x")
8928 (match_operand:V2DF 1 "nonimmediate_operand" "x,x,m")
8929 (parallel [(const_int 0)])))]
8930 "!TARGET_SSE2 && TARGET_SSE
8931 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
8933 movlps\t{%1, %0|%0, %1}
8934 movaps\t{%1, %0|%0, %1}
8935 movlps\t{%1, %0|%0, %q1}"
8936 [(set_attr "type" "ssemov")
8937 (set_attr "mode" "V2SF,V4SF,V2SF")])
8939 (define_expand "sse2_loadhpd_exp"
8940 [(set (match_operand:V2DF 0 "nonimmediate_operand")
8943 (match_operand:V2DF 1 "nonimmediate_operand")
8944 (parallel [(const_int 0)]))
8945 (match_operand:DF 2 "nonimmediate_operand")))]
8948 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V2DFmode, operands);
8950 emit_insn (gen_sse2_loadhpd (dst, operands[1], operands[2]));
8952 /* Fix up the destination if needed. */
8953 if (dst != operands[0])
8954 emit_move_insn (operands[0], dst);
8959 ;; Avoid combining registers from different units in a single alternative,
8960 ;; see comment above inline_secondary_memory_needed function in i386.c
8961 (define_insn "sse2_loadhpd"
8962 [(set (match_operand:V2DF 0 "nonimmediate_operand"
8966 (match_operand:V2DF 1 "nonimmediate_operand"
8968 (parallel [(const_int 0)]))
8969 (match_operand:DF 2 "nonimmediate_operand"
8970 " m,m,x,v,x,*f,r")))]
8971 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
8973 movhpd\t{%2, %0|%0, %2}
8974 vmovhpd\t{%2, %1, %0|%0, %1, %2}
8975 unpcklpd\t{%2, %0|%0, %2}
8976 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
8980 [(set_attr "isa" "noavx,avx,noavx,avx,*,*,*")
8981 (set_attr "type" "ssemov,ssemov,sselog,sselog,ssemov,fmov,imov")
8982 (set (attr "prefix_data16")
8983 (if_then_else (eq_attr "alternative" "0")
8985 (const_string "*")))
8986 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,*,*,*")
8987 (set_attr "mode" "V1DF,V1DF,V2DF,V2DF,DF,DF,DF")])
8990 [(set (match_operand:V2DF 0 "memory_operand")
8992 (vec_select:DF (match_dup 0) (parallel [(const_int 0)]))
8993 (match_operand:DF 1 "register_operand")))]
8994 "TARGET_SSE2 && reload_completed"
8995 [(set (match_dup 0) (match_dup 1))]
8996 "operands[0] = adjust_address (operands[0], DFmode, 8);")
8998 (define_expand "sse2_loadlpd_exp"
8999 [(set (match_operand:V2DF 0 "nonimmediate_operand")
9001 (match_operand:DF 2 "nonimmediate_operand")
9003 (match_operand:V2DF 1 "nonimmediate_operand")
9004 (parallel [(const_int 1)]))))]
9007 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V2DFmode, operands);
9009 emit_insn (gen_sse2_loadlpd (dst, operands[1], operands[2]));
9011 /* Fix up the destination if needed. */
9012 if (dst != operands[0])
9013 emit_move_insn (operands[0], dst);
9018 ;; Avoid combining registers from different units in a single alternative,
9019 ;; see comment above inline_secondary_memory_needed function in i386.c
9020 (define_insn "sse2_loadlpd"
9021 [(set (match_operand:V2DF 0 "nonimmediate_operand"
9022 "=v,x,v,x,v,x,x,v,m,m ,m")
9024 (match_operand:DF 2 "nonimmediate_operand"
9025 "vm,m,m,x,v,0,0,v,x,*f,r")
9027 (match_operand:V2DF 1 "vector_move_operand"
9028 " C,0,v,0,v,x,o,o,0,0 ,0")
9029 (parallel [(const_int 1)]))))]
9030 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
9032 %vmovq\t{%2, %0|%0, %2}
9033 movlpd\t{%2, %0|%0, %2}
9034 vmovlpd\t{%2, %1, %0|%0, %1, %2}
9035 movsd\t{%2, %0|%0, %2}
9036 vmovsd\t{%2, %1, %0|%0, %1, %2}
9037 shufpd\t{$2, %1, %0|%0, %1, 2}
9038 movhpd\t{%H1, %0|%0, %H1}
9039 vmovhpd\t{%H1, %2, %0|%0, %2, %H1}
9043 [(set_attr "isa" "*,noavx,avx,noavx,avx,noavx,noavx,avx,*,*,*")
9045 (cond [(eq_attr "alternative" "5")
9046 (const_string "sselog")
9047 (eq_attr "alternative" "9")
9048 (const_string "fmov")
9049 (eq_attr "alternative" "10")
9050 (const_string "imov")
9052 (const_string "ssemov")))
9053 (set (attr "prefix_data16")
9054 (if_then_else (eq_attr "alternative" "1,6")
9056 (const_string "*")))
9057 (set (attr "length_immediate")
9058 (if_then_else (eq_attr "alternative" "5")
9060 (const_string "*")))
9061 (set (attr "prefix")
9062 (cond [(eq_attr "alternative" "0")
9063 (const_string "maybe_vex")
9064 (eq_attr "alternative" "1,3,5,6")
9065 (const_string "orig")
9066 (eq_attr "alternative" "2,4,7")
9067 (const_string "maybe_evex")
9069 (const_string "*")))
9070 (set_attr "mode" "DF,V1DF,V1DF,V1DF,V1DF,V2DF,V1DF,V1DF,DF,DF,DF")])
9073 [(set (match_operand:V2DF 0 "memory_operand")
9075 (match_operand:DF 1 "register_operand")
9076 (vec_select:DF (match_dup 0) (parallel [(const_int 1)]))))]
9077 "TARGET_SSE2 && reload_completed"
9078 [(set (match_dup 0) (match_dup 1))]
9079 "operands[0] = adjust_address (operands[0], DFmode, 0);")
9081 (define_insn "sse2_movsd"
9082 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,v,x,v,m,x,x,v,o")
9084 (match_operand:V2DF 2 "nonimmediate_operand" " x,v,m,m,v,0,0,v,0")
9085 (match_operand:V2DF 1 "nonimmediate_operand" " 0,v,0,v,0,x,o,o,v")
9089 movsd\t{%2, %0|%0, %2}
9090 vmovsd\t{%2, %1, %0|%0, %1, %2}
9091 movlpd\t{%2, %0|%0, %q2}
9092 vmovlpd\t{%2, %1, %0|%0, %1, %q2}
9093 %vmovlpd\t{%2, %0|%q0, %2}
9094 shufpd\t{$2, %1, %0|%0, %1, 2}
9095 movhps\t{%H1, %0|%0, %H1}
9096 vmovhps\t{%H1, %2, %0|%0, %2, %H1}
9097 %vmovhps\t{%1, %H0|%H0, %1}"
9098 [(set_attr "isa" "noavx,avx,noavx,avx,*,noavx,noavx,avx,*")
9101 (eq_attr "alternative" "5")
9102 (const_string "sselog")
9103 (const_string "ssemov")))
9104 (set (attr "prefix_data16")
9106 (and (eq_attr "alternative" "2,4")
9107 (not (match_test "TARGET_AVX")))
9109 (const_string "*")))
9110 (set (attr "length_immediate")
9111 (if_then_else (eq_attr "alternative" "5")
9113 (const_string "*")))
9114 (set (attr "prefix")
9115 (cond [(eq_attr "alternative" "1,3,7")
9116 (const_string "maybe_evex")
9117 (eq_attr "alternative" "4,8")
9118 (const_string "maybe_vex")
9120 (const_string "orig")))
9121 (set_attr "mode" "DF,DF,V1DF,V1DF,V1DF,V2DF,V1DF,V1DF,V1DF")])
9123 (define_insn "vec_dupv2df<mask_name>"
9124 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
9126 (match_operand:DF 1 "nonimmediate_operand" " 0,xm,vm")))]
9127 "TARGET_SSE2 && <mask_avx512vl_condition>"
9130 %vmovddup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}
9131 vmovddup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
9132 [(set_attr "isa" "noavx,sse3,avx512vl")
9133 (set_attr "type" "sselog1")
9134 (set_attr "prefix" "orig,maybe_vex,evex")
9135 (set_attr "mode" "V2DF,DF,DF")])
9137 (define_insn "vec_concatv2df"
9138 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v,x,v,x,x, v,x,x")
9140 (match_operand:DF 1 "nonimmediate_operand" " 0,x,v,m,m,0,x,xm,0,0")
9141 (match_operand:DF 2 "vector_move_operand" " x,x,v,1,1,m,m, C,x,m")))]
9143 && (!(MEM_P (operands[1]) && MEM_P (operands[2]))
9144 || (TARGET_SSE3 && rtx_equal_p (operands[1], operands[2])))"
9146 unpcklpd\t{%2, %0|%0, %2}
9147 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
9148 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
9149 %vmovddup\t{%1, %0|%0, %1}
9150 vmovddup\t{%1, %0|%0, %1}
9151 movhpd\t{%2, %0|%0, %2}
9152 vmovhpd\t{%2, %1, %0|%0, %1, %2}
9153 %vmovq\t{%1, %0|%0, %1}
9154 movlhps\t{%2, %0|%0, %2}
9155 movhps\t{%2, %0|%0, %2}"
9157 (cond [(eq_attr "alternative" "0,5")
9158 (const_string "sse2_noavx")
9159 (eq_attr "alternative" "1,6")
9160 (const_string "avx")
9161 (eq_attr "alternative" "2,4")
9162 (const_string "avx512vl")
9163 (eq_attr "alternative" "3")
9164 (const_string "sse3")
9165 (eq_attr "alternative" "7")
9166 (const_string "sse2")
9168 (const_string "noavx")))
9171 (eq_attr "alternative" "0,1,2,3,4")
9172 (const_string "sselog")
9173 (const_string "ssemov")))
9174 (set (attr "prefix_data16")
9175 (if_then_else (eq_attr "alternative" "5")
9177 (const_string "*")))
9178 (set (attr "prefix")
9179 (cond [(eq_attr "alternative" "1,6")
9180 (const_string "vex")
9181 (eq_attr "alternative" "2,4")
9182 (const_string "evex")
9183 (eq_attr "alternative" "3,7")
9184 (const_string "maybe_vex")
9186 (const_string "orig")))
9187 (set_attr "mode" "V2DF,V2DF,V2DF, DF, DF, V1DF,V1DF,DF,V4SF,V2SF")])
9189 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9191 ;; Parallel integer down-conversion operations
9193 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9195 (define_mode_iterator PMOV_DST_MODE_1 [V16QI V16HI V8SI V8HI])
9196 (define_mode_attr pmov_src_mode
9197 [(V16QI "V16SI") (V16HI "V16SI") (V8SI "V8DI") (V8HI "V8DI")])
9198 (define_mode_attr pmov_src_lower
9199 [(V16QI "v16si") (V16HI "v16si") (V8SI "v8di") (V8HI "v8di")])
9200 (define_mode_attr pmov_suff_1
9201 [(V16QI "db") (V16HI "dw") (V8SI "qd") (V8HI "qw")])
9203 (define_insn "*avx512f_<code><pmov_src_lower><mode>2"
9204 [(set (match_operand:PMOV_DST_MODE_1 0 "nonimmediate_operand" "=v,m")
9205 (any_truncate:PMOV_DST_MODE_1
9206 (match_operand:<pmov_src_mode> 1 "register_operand" "v,v")))]
9208 "vpmov<trunsuffix><pmov_suff_1>\t{%1, %0|%0, %1}"
9209 [(set_attr "type" "ssemov")
9210 (set_attr "memory" "none,store")
9211 (set_attr "prefix" "evex")
9212 (set_attr "mode" "<sseinsnmode>")])
9214 (define_insn "avx512f_<code><pmov_src_lower><mode>2_mask"
9215 [(set (match_operand:PMOV_DST_MODE_1 0 "nonimmediate_operand" "=v,m")
9216 (vec_merge:PMOV_DST_MODE_1
9217 (any_truncate:PMOV_DST_MODE_1
9218 (match_operand:<pmov_src_mode> 1 "register_operand" "v,v"))
9219 (match_operand:PMOV_DST_MODE_1 2 "vector_move_operand" "0C,0")
9220 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
9222 "vpmov<trunsuffix><pmov_suff_1>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9223 [(set_attr "type" "ssemov")
9224 (set_attr "memory" "none,store")
9225 (set_attr "prefix" "evex")
9226 (set_attr "mode" "<sseinsnmode>")])
9228 (define_expand "avx512f_<code><pmov_src_lower><mode>2_mask_store"
9229 [(set (match_operand:PMOV_DST_MODE_1 0 "memory_operand")
9230 (vec_merge:PMOV_DST_MODE_1
9231 (any_truncate:PMOV_DST_MODE_1
9232 (match_operand:<pmov_src_mode> 1 "register_operand"))
9234 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
9237 (define_insn "avx512bw_<code>v32hiv32qi2"
9238 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=v,m")
9240 (match_operand:V32HI 1 "register_operand" "v,v")))]
9242 "vpmov<trunsuffix>wb\t{%1, %0|%0, %1}"
9243 [(set_attr "type" "ssemov")
9244 (set_attr "memory" "none,store")
9245 (set_attr "prefix" "evex")
9246 (set_attr "mode" "XI")])
9248 (define_insn "avx512bw_<code>v32hiv32qi2_mask"
9249 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=v,m")
9252 (match_operand:V32HI 1 "register_operand" "v,v"))
9253 (match_operand:V32QI 2 "vector_move_operand" "0C,0")
9254 (match_operand:SI 3 "register_operand" "Yk,Yk")))]
9256 "vpmov<trunsuffix>wb\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9257 [(set_attr "type" "ssemov")
9258 (set_attr "memory" "none,store")
9259 (set_attr "prefix" "evex")
9260 (set_attr "mode" "XI")])
9262 (define_expand "avx512bw_<code>v32hiv32qi2_mask_store"
9263 [(set (match_operand:V32QI 0 "nonimmediate_operand")
9266 (match_operand:V32HI 1 "register_operand"))
9268 (match_operand:SI 2 "register_operand")))]
9271 (define_mode_iterator PMOV_DST_MODE_2
9272 [V4SI V8HI (V16QI "TARGET_AVX512BW")])
9273 (define_mode_attr pmov_suff_2
9274 [(V16QI "wb") (V8HI "dw") (V4SI "qd")])
9276 (define_insn "*avx512vl_<code><ssedoublemodelower><mode>2"
9277 [(set (match_operand:PMOV_DST_MODE_2 0 "nonimmediate_operand" "=v,m")
9278 (any_truncate:PMOV_DST_MODE_2
9279 (match_operand:<ssedoublemode> 1 "register_operand" "v,v")))]
9281 "vpmov<trunsuffix><pmov_suff_2>\t{%1, %0|%0, %1}"
9282 [(set_attr "type" "ssemov")
9283 (set_attr "memory" "none,store")
9284 (set_attr "prefix" "evex")
9285 (set_attr "mode" "<sseinsnmode>")])
9287 (define_insn "<avx512>_<code><ssedoublemodelower><mode>2_mask"
9288 [(set (match_operand:PMOV_DST_MODE_2 0 "nonimmediate_operand" "=v,m")
9289 (vec_merge:PMOV_DST_MODE_2
9290 (any_truncate:PMOV_DST_MODE_2
9291 (match_operand:<ssedoublemode> 1 "register_operand" "v,v"))
9292 (match_operand:PMOV_DST_MODE_2 2 "vector_move_operand" "0C,0")
9293 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
9295 "vpmov<trunsuffix><pmov_suff_2>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9296 [(set_attr "type" "ssemov")
9297 (set_attr "memory" "none,store")
9298 (set_attr "prefix" "evex")
9299 (set_attr "mode" "<sseinsnmode>")])
9301 (define_expand "<avx512>_<code><ssedoublemodelower><mode>2_mask_store"
9302 [(set (match_operand:PMOV_DST_MODE_2 0 "nonimmediate_operand")
9303 (vec_merge:PMOV_DST_MODE_2
9304 (any_truncate:PMOV_DST_MODE_2
9305 (match_operand:<ssedoublemode> 1 "register_operand"))
9307 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
9310 (define_mode_iterator PMOV_SRC_MODE_3 [V4DI V2DI V8SI V4SI (V8HI "TARGET_AVX512BW")])
9311 (define_mode_attr pmov_dst_3
9312 [(V4DI "V4QI") (V2DI "V2QI") (V8SI "V8QI") (V4SI "V4QI") (V8HI "V8QI")])
9313 (define_mode_attr pmov_dst_zeroed_3
9314 [(V4DI "V12QI") (V2DI "V14QI") (V8SI "V8QI") (V4SI "V12QI") (V8HI "V8QI")])
9315 (define_mode_attr pmov_suff_3
9316 [(V4DI "qb") (V2DI "qb") (V8SI "db") (V4SI "db") (V8HI "wb")])
9318 (define_insn "*avx512vl_<code><mode>v<ssescalarnum>qi2"
9319 [(set (match_operand:V16QI 0 "register_operand" "=v")
9321 (any_truncate:<pmov_dst_3>
9322 (match_operand:PMOV_SRC_MODE_3 1 "register_operand" "v"))
9323 (match_operand:<pmov_dst_zeroed_3> 2 "const0_operand")))]
9325 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0|%0, %1}"
9326 [(set_attr "type" "ssemov")
9327 (set_attr "prefix" "evex")
9328 (set_attr "mode" "TI")])
9330 (define_insn "*avx512vl_<code>v2div2qi2_store"
9331 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9334 (match_operand:V2DI 1 "register_operand" "v"))
9337 (parallel [(const_int 2) (const_int 3)
9338 (const_int 4) (const_int 5)
9339 (const_int 6) (const_int 7)
9340 (const_int 8) (const_int 9)
9341 (const_int 10) (const_int 11)
9342 (const_int 12) (const_int 13)
9343 (const_int 14) (const_int 15)]))))]
9345 "vpmov<trunsuffix>qb\t{%1, %0|%0, %1}"
9346 [(set_attr "type" "ssemov")
9347 (set_attr "memory" "store")
9348 (set_attr "prefix" "evex")
9349 (set_attr "mode" "TI")])
9351 (define_insn "avx512vl_<code>v2div2qi2_mask"
9352 [(set (match_operand:V16QI 0 "register_operand" "=v")
9356 (match_operand:V2DI 1 "register_operand" "v"))
9358 (match_operand:V16QI 2 "vector_move_operand" "0C")
9359 (parallel [(const_int 0) (const_int 1)]))
9360 (match_operand:QI 3 "register_operand" "Yk"))
9361 (const_vector:V14QI [(const_int 0) (const_int 0)
9362 (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)])))]
9369 "vpmov<trunsuffix>qb\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9370 [(set_attr "type" "ssemov")
9371 (set_attr "prefix" "evex")
9372 (set_attr "mode" "TI")])
9374 (define_insn "*avx512vl_<code>v2div2qi2_mask_1"
9375 [(set (match_operand:V16QI 0 "register_operand" "=v")
9379 (match_operand:V2DI 1 "register_operand" "v"))
9380 (const_vector:V2QI [(const_int 0) (const_int 0)])
9381 (match_operand:QI 2 "register_operand" "Yk"))
9382 (const_vector:V14QI [(const_int 0) (const_int 0)
9383 (const_int 0) (const_int 0)
9384 (const_int 0) (const_int 0)
9385 (const_int 0) (const_int 0)
9386 (const_int 0) (const_int 0)
9387 (const_int 0) (const_int 0)
9388 (const_int 0) (const_int 0)])))]
9390 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9391 [(set_attr "type" "ssemov")
9392 (set_attr "prefix" "evex")
9393 (set_attr "mode" "TI")])
9395 (define_insn "avx512vl_<code>v2div2qi2_mask_store"
9396 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9400 (match_operand:V2DI 1 "register_operand" "v"))
9403 (parallel [(const_int 0) (const_int 1)]))
9404 (match_operand:QI 2 "register_operand" "Yk"))
9407 (parallel [(const_int 2) (const_int 3)
9408 (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>qb\t{%1, %0%{%2%}|%w0%{%2%}, %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_store"
9422 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9425 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9428 (parallel [(const_int 4) (const_int 5)
9429 (const_int 6) (const_int 7)
9430 (const_int 8) (const_int 9)
9431 (const_int 10) (const_int 11)
9432 (const_int 12) (const_int 13)
9433 (const_int 14) (const_int 15)]))))]
9435 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0|%0, %1}"
9436 [(set_attr "type" "ssemov")
9437 (set_attr "memory" "store")
9438 (set_attr "prefix" "evex")
9439 (set_attr "mode" "TI")])
9441 (define_insn "avx512vl_<code><mode>v4qi2_mask"
9442 [(set (match_operand:V16QI 0 "register_operand" "=v")
9446 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9448 (match_operand:V16QI 2 "vector_move_operand" "0C")
9449 (parallel [(const_int 0) (const_int 1)
9450 (const_int 2) (const_int 3)]))
9451 (match_operand:QI 3 "register_operand" "Yk"))
9452 (const_vector:V12QI [(const_int 0) (const_int 0)
9453 (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)])))]
9459 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9460 [(set_attr "type" "ssemov")
9461 (set_attr "prefix" "evex")
9462 (set_attr "mode" "TI")])
9464 (define_insn "*avx512vl_<code><mode>v4qi2_mask_1"
9465 [(set (match_operand:V16QI 0 "register_operand" "=v")
9469 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9470 (const_vector:V4QI [(const_int 0) (const_int 0)
9471 (const_int 0) (const_int 0)])
9472 (match_operand:QI 2 "register_operand" "Yk"))
9473 (const_vector:V12QI [(const_int 0) (const_int 0)
9474 (const_int 0) (const_int 0)
9475 (const_int 0) (const_int 0)
9476 (const_int 0) (const_int 0)
9477 (const_int 0) (const_int 0)
9478 (const_int 0) (const_int 0)])))]
9480 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9481 [(set_attr "type" "ssemov")
9482 (set_attr "prefix" "evex")
9483 (set_attr "mode" "TI")])
9485 (define_insn "avx512vl_<code><mode>v4qi2_mask_store"
9486 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9490 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9493 (parallel [(const_int 0) (const_int 1)
9494 (const_int 2) (const_int 3)]))
9495 (match_operand:QI 2 "register_operand" "Yk"))
9498 (parallel [(const_int 4) (const_int 5)
9499 (const_int 6) (const_int 7)
9500 (const_int 8) (const_int 9)
9501 (const_int 10) (const_int 11)
9502 (const_int 12) (const_int 13)
9503 (const_int 14) (const_int 15)]))))]
9506 if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 8)
9507 return "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}|%k0%{%2%}, %1}";
9508 return "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}|%0%{%2%}, %g1}";
9510 [(set_attr "type" "ssemov")
9511 (set_attr "memory" "store")
9512 (set_attr "prefix" "evex")
9513 (set_attr "mode" "TI")])
9515 (define_mode_iterator VI2_128_BW_4_256
9516 [(V8HI "TARGET_AVX512BW") V8SI])
9518 (define_insn "*avx512vl_<code><mode>v8qi2_store"
9519 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9522 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9525 (parallel [(const_int 8) (const_int 9)
9526 (const_int 10) (const_int 11)
9527 (const_int 12) (const_int 13)
9528 (const_int 14) (const_int 15)]))))]
9530 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0|%0, %1}"
9531 [(set_attr "type" "ssemov")
9532 (set_attr "memory" "store")
9533 (set_attr "prefix" "evex")
9534 (set_attr "mode" "TI")])
9536 (define_insn "avx512vl_<code><mode>v8qi2_mask"
9537 [(set (match_operand:V16QI 0 "register_operand" "=v")
9541 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9543 (match_operand:V16QI 2 "vector_move_operand" "0C")
9544 (parallel [(const_int 0) (const_int 1)
9545 (const_int 2) (const_int 3)
9546 (const_int 4) (const_int 5)
9547 (const_int 6) (const_int 7)]))
9548 (match_operand:QI 3 "register_operand" "Yk"))
9549 (const_vector:V8QI [(const_int 0) (const_int 0)
9550 (const_int 0) (const_int 0)
9551 (const_int 0) (const_int 0)
9552 (const_int 0) (const_int 0)])))]
9554 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9555 [(set_attr "type" "ssemov")
9556 (set_attr "prefix" "evex")
9557 (set_attr "mode" "TI")])
9559 (define_insn "*avx512vl_<code><mode>v8qi2_mask_1"
9560 [(set (match_operand:V16QI 0 "register_operand" "=v")
9564 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9565 (const_vector:V8QI [(const_int 0) (const_int 0)
9566 (const_int 0) (const_int 0)
9567 (const_int 0) (const_int 0)
9568 (const_int 0) (const_int 0)])
9569 (match_operand:QI 2 "register_operand" "Yk"))
9570 (const_vector:V8QI [(const_int 0) (const_int 0)
9571 (const_int 0) (const_int 0)
9572 (const_int 0) (const_int 0)
9573 (const_int 0) (const_int 0)])))]
9575 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9576 [(set_attr "type" "ssemov")
9577 (set_attr "prefix" "evex")
9578 (set_attr "mode" "TI")])
9580 (define_insn "avx512vl_<code><mode>v8qi2_mask_store"
9581 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9585 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9588 (parallel [(const_int 0) (const_int 1)
9589 (const_int 2) (const_int 3)
9590 (const_int 4) (const_int 5)
9591 (const_int 6) (const_int 7)]))
9592 (match_operand:QI 2 "register_operand" "Yk"))
9595 (parallel [(const_int 8) (const_int 9)
9596 (const_int 10) (const_int 11)
9597 (const_int 12) (const_int 13)
9598 (const_int 14) (const_int 15)]))))]
9601 if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 4)
9602 return "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}|%0%{%2%}, %g1}";
9603 return "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
9605 [(set_attr "type" "ssemov")
9606 (set_attr "memory" "store")
9607 (set_attr "prefix" "evex")
9608 (set_attr "mode" "TI")])
9610 (define_mode_iterator PMOV_SRC_MODE_4 [V4DI V2DI V4SI])
9611 (define_mode_attr pmov_dst_4
9612 [(V4DI "V4HI") (V2DI "V2HI") (V4SI "V4HI")])
9613 (define_mode_attr pmov_dst_zeroed_4
9614 [(V4DI "V4HI") (V2DI "V6HI") (V4SI "V4HI")])
9615 (define_mode_attr pmov_suff_4
9616 [(V4DI "qw") (V2DI "qw") (V4SI "dw")])
9618 (define_insn "*avx512vl_<code><mode>v<ssescalarnum>hi2"
9619 [(set (match_operand:V8HI 0 "register_operand" "=v")
9621 (any_truncate:<pmov_dst_4>
9622 (match_operand:PMOV_SRC_MODE_4 1 "register_operand" "v"))
9623 (match_operand:<pmov_dst_zeroed_4> 2 "const0_operand")))]
9625 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0|%0, %1}"
9626 [(set_attr "type" "ssemov")
9627 (set_attr "prefix" "evex")
9628 (set_attr "mode" "TI")])
9630 (define_insn "*avx512vl_<code><mode>v4hi2_store"
9631 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9634 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9637 (parallel [(const_int 4) (const_int 5)
9638 (const_int 6) (const_int 7)]))))]
9640 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0|%0, %1}"
9641 [(set_attr "type" "ssemov")
9642 (set_attr "memory" "store")
9643 (set_attr "prefix" "evex")
9644 (set_attr "mode" "TI")])
9646 (define_insn "avx512vl_<code><mode>v4hi2_mask"
9647 [(set (match_operand:V8HI 0 "register_operand" "=v")
9651 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9653 (match_operand:V8HI 2 "vector_move_operand" "0C")
9654 (parallel [(const_int 0) (const_int 1)
9655 (const_int 2) (const_int 3)]))
9656 (match_operand:QI 3 "register_operand" "Yk"))
9657 (const_vector:V4HI [(const_int 0) (const_int 0)
9658 (const_int 0) (const_int 0)])))]
9660 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9661 [(set_attr "type" "ssemov")
9662 (set_attr "prefix" "evex")
9663 (set_attr "mode" "TI")])
9665 (define_insn "*avx512vl_<code><mode>v4hi2_mask_1"
9666 [(set (match_operand:V8HI 0 "register_operand" "=v")
9670 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9671 (const_vector:V4HI [(const_int 0) (const_int 0)
9672 (const_int 0) (const_int 0)])
9673 (match_operand:QI 2 "register_operand" "Yk"))
9674 (const_vector:V4HI [(const_int 0) (const_int 0)
9675 (const_int 0) (const_int 0)])))]
9677 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9678 [(set_attr "type" "ssemov")
9679 (set_attr "prefix" "evex")
9680 (set_attr "mode" "TI")])
9682 (define_insn "avx512vl_<code><mode>v4hi2_mask_store"
9683 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9687 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9690 (parallel [(const_int 0) (const_int 1)
9691 (const_int 2) (const_int 3)]))
9692 (match_operand:QI 2 "register_operand" "Yk"))
9695 (parallel [(const_int 4) (const_int 5)
9696 (const_int 6) (const_int 7)]))))]
9699 if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 4)
9700 return "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%2%}|%0%{%2%}, %t1}";
9701 return "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%2%}|%0%{%2%}, %g1}";
9703 [(set_attr "type" "ssemov")
9704 (set_attr "memory" "store")
9705 (set_attr "prefix" "evex")
9706 (set_attr "mode" "TI")])
9708 (define_insn "*avx512vl_<code>v2div2hi2_store"
9709 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9712 (match_operand:V2DI 1 "register_operand" "v"))
9715 (parallel [(const_int 2) (const_int 3)
9716 (const_int 4) (const_int 5)
9717 (const_int 6) (const_int 7)]))))]
9719 "vpmov<trunsuffix>qw\t{%1, %0|%0, %1}"
9720 [(set_attr "type" "ssemov")
9721 (set_attr "memory" "store")
9722 (set_attr "prefix" "evex")
9723 (set_attr "mode" "TI")])
9725 (define_insn "avx512vl_<code>v2div2hi2_mask"
9726 [(set (match_operand:V8HI 0 "register_operand" "=v")
9730 (match_operand:V2DI 1 "register_operand" "v"))
9732 (match_operand:V8HI 2 "vector_move_operand" "0C")
9733 (parallel [(const_int 0) (const_int 1)]))
9734 (match_operand:QI 3 "register_operand" "Yk"))
9735 (const_vector:V6HI [(const_int 0) (const_int 0)
9736 (const_int 0) (const_int 0)
9737 (const_int 0) (const_int 0)])))]
9739 "vpmov<trunsuffix>qw\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9740 [(set_attr "type" "ssemov")
9741 (set_attr "prefix" "evex")
9742 (set_attr "mode" "TI")])
9744 (define_insn "*avx512vl_<code>v2div2hi2_mask_1"
9745 [(set (match_operand:V8HI 0 "register_operand" "=v")
9749 (match_operand:V2DI 1 "register_operand" "v"))
9750 (const_vector:V2HI [(const_int 0) (const_int 0)])
9751 (match_operand:QI 2 "register_operand" "Yk"))
9752 (const_vector:V6HI [(const_int 0) (const_int 0)
9753 (const_int 0) (const_int 0)
9754 (const_int 0) (const_int 0)])))]
9756 "vpmov<trunsuffix>qw\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9757 [(set_attr "type" "ssemov")
9758 (set_attr "prefix" "evex")
9759 (set_attr "mode" "TI")])
9761 (define_insn "avx512vl_<code>v2div2hi2_mask_store"
9762 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9766 (match_operand:V2DI 1 "register_operand" "v"))
9769 (parallel [(const_int 0) (const_int 1)]))
9770 (match_operand:QI 2 "register_operand" "Yk"))
9773 (parallel [(const_int 2) (const_int 3)
9774 (const_int 4) (const_int 5)
9775 (const_int 6) (const_int 7)]))))]
9777 "vpmov<trunsuffix>qw\t{%1, %0%{%2%}|%0%{%2%}, %g1}"
9778 [(set_attr "type" "ssemov")
9779 (set_attr "memory" "store")
9780 (set_attr "prefix" "evex")
9781 (set_attr "mode" "TI")])
9783 (define_insn "*avx512vl_<code>v2div2si2"
9784 [(set (match_operand:V4SI 0 "register_operand" "=v")
9787 (match_operand:V2DI 1 "register_operand" "v"))
9788 (match_operand:V2SI 2 "const0_operand")))]
9790 "vpmov<trunsuffix>qd\t{%1, %0|%0, %1}"
9791 [(set_attr "type" "ssemov")
9792 (set_attr "prefix" "evex")
9793 (set_attr "mode" "TI")])
9795 (define_insn "*avx512vl_<code>v2div2si2_store"
9796 [(set (match_operand:V4SI 0 "memory_operand" "=m")
9799 (match_operand:V2DI 1 "register_operand" "v"))
9802 (parallel [(const_int 2) (const_int 3)]))))]
9804 "vpmov<trunsuffix>qd\t{%1, %0|%0, %1}"
9805 [(set_attr "type" "ssemov")
9806 (set_attr "memory" "store")
9807 (set_attr "prefix" "evex")
9808 (set_attr "mode" "TI")])
9810 (define_insn "avx512vl_<code>v2div2si2_mask"
9811 [(set (match_operand:V4SI 0 "register_operand" "=v")
9815 (match_operand:V2DI 1 "register_operand" "v"))
9817 (match_operand:V4SI 2 "vector_move_operand" "0C")
9818 (parallel [(const_int 0) (const_int 1)]))
9819 (match_operand:QI 3 "register_operand" "Yk"))
9820 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
9822 "vpmov<trunsuffix>qd\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9823 [(set_attr "type" "ssemov")
9824 (set_attr "prefix" "evex")
9825 (set_attr "mode" "TI")])
9827 (define_insn "*avx512vl_<code>v2div2si2_mask_1"
9828 [(set (match_operand:V4SI 0 "register_operand" "=v")
9832 (match_operand:V2DI 1 "register_operand" "v"))
9833 (const_vector:V2SI [(const_int 0) (const_int 0)])
9834 (match_operand:QI 2 "register_operand" "Yk"))
9835 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
9837 "vpmov<trunsuffix>qd\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9838 [(set_attr "type" "ssemov")
9839 (set_attr "prefix" "evex")
9840 (set_attr "mode" "TI")])
9842 (define_insn "avx512vl_<code>v2div2si2_mask_store"
9843 [(set (match_operand:V4SI 0 "memory_operand" "=m")
9847 (match_operand:V2DI 1 "register_operand" "v"))
9850 (parallel [(const_int 0) (const_int 1)]))
9851 (match_operand:QI 2 "register_operand" "Yk"))
9854 (parallel [(const_int 2) (const_int 3)]))))]
9856 "vpmov<trunsuffix>qd\t{%1, %0%{%2%}|%0%{%2%}, %t1}"
9857 [(set_attr "type" "ssemov")
9858 (set_attr "memory" "store")
9859 (set_attr "prefix" "evex")
9860 (set_attr "mode" "TI")])
9862 (define_insn "*avx512f_<code>v8div16qi2"
9863 [(set (match_operand:V16QI 0 "register_operand" "=v")
9866 (match_operand:V8DI 1 "register_operand" "v"))
9867 (const_vector:V8QI [(const_int 0) (const_int 0)
9868 (const_int 0) (const_int 0)
9869 (const_int 0) (const_int 0)
9870 (const_int 0) (const_int 0)])))]
9872 "vpmov<trunsuffix>qb\t{%1, %0|%0, %1}"
9873 [(set_attr "type" "ssemov")
9874 (set_attr "prefix" "evex")
9875 (set_attr "mode" "TI")])
9877 (define_insn "*avx512f_<code>v8div16qi2_store"
9878 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9881 (match_operand:V8DI 1 "register_operand" "v"))
9884 (parallel [(const_int 8) (const_int 9)
9885 (const_int 10) (const_int 11)
9886 (const_int 12) (const_int 13)
9887 (const_int 14) (const_int 15)]))))]
9889 "vpmov<trunsuffix>qb\t{%1, %0|%0, %1}"
9890 [(set_attr "type" "ssemov")
9891 (set_attr "memory" "store")
9892 (set_attr "prefix" "evex")
9893 (set_attr "mode" "TI")])
9895 (define_insn "avx512f_<code>v8div16qi2_mask"
9896 [(set (match_operand:V16QI 0 "register_operand" "=v")
9900 (match_operand:V8DI 1 "register_operand" "v"))
9902 (match_operand:V16QI 2 "vector_move_operand" "0C")
9903 (parallel [(const_int 0) (const_int 1)
9904 (const_int 2) (const_int 3)
9905 (const_int 4) (const_int 5)
9906 (const_int 6) (const_int 7)]))
9907 (match_operand:QI 3 "register_operand" "Yk"))
9908 (const_vector:V8QI [(const_int 0) (const_int 0)
9909 (const_int 0) (const_int 0)
9910 (const_int 0) (const_int 0)
9911 (const_int 0) (const_int 0)])))]
9913 "vpmov<trunsuffix>qb\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9914 [(set_attr "type" "ssemov")
9915 (set_attr "prefix" "evex")
9916 (set_attr "mode" "TI")])
9918 (define_insn "*avx512f_<code>v8div16qi2_mask_1"
9919 [(set (match_operand:V16QI 0 "register_operand" "=v")
9923 (match_operand:V8DI 1 "register_operand" "v"))
9924 (const_vector:V8QI [(const_int 0) (const_int 0)
9925 (const_int 0) (const_int 0)
9926 (const_int 0) (const_int 0)
9927 (const_int 0) (const_int 0)])
9928 (match_operand:QI 2 "register_operand" "Yk"))
9929 (const_vector:V8QI [(const_int 0) (const_int 0)
9930 (const_int 0) (const_int 0)
9931 (const_int 0) (const_int 0)
9932 (const_int 0) (const_int 0)])))]
9934 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9935 [(set_attr "type" "ssemov")
9936 (set_attr "prefix" "evex")
9937 (set_attr "mode" "TI")])
9939 (define_insn "avx512f_<code>v8div16qi2_mask_store"
9940 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9944 (match_operand:V8DI 1 "register_operand" "v"))
9947 (parallel [(const_int 0) (const_int 1)
9948 (const_int 2) (const_int 3)
9949 (const_int 4) (const_int 5)
9950 (const_int 6) (const_int 7)]))
9951 (match_operand:QI 2 "register_operand" "Yk"))
9954 (parallel [(const_int 8) (const_int 9)
9955 (const_int 10) (const_int 11)
9956 (const_int 12) (const_int 13)
9957 (const_int 14) (const_int 15)]))))]
9959 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}|%q0%{%2%}, %1}"
9960 [(set_attr "type" "ssemov")
9961 (set_attr "memory" "store")
9962 (set_attr "prefix" "evex")
9963 (set_attr "mode" "TI")])
9965 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9967 ;; Parallel integral arithmetic
9969 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9971 (define_expand "neg<mode>2"
9972 [(set (match_operand:VI_AVX2 0 "register_operand")
9975 (match_operand:VI_AVX2 1 "vector_operand")))]
9977 "operands[2] = force_reg (<MODE>mode, CONST0_RTX (<MODE>mode));")
9979 (define_expand "<plusminus_insn><mode>3"
9980 [(set (match_operand:VI_AVX2 0 "register_operand")
9982 (match_operand:VI_AVX2 1 "vector_operand")
9983 (match_operand:VI_AVX2 2 "vector_operand")))]
9985 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
9987 (define_expand "<plusminus_insn><mode>3_mask"
9988 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
9989 (vec_merge:VI48_AVX512VL
9990 (plusminus:VI48_AVX512VL
9991 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand")
9992 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand"))
9993 (match_operand:VI48_AVX512VL 3 "vector_move_operand")
9994 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
9996 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
9998 (define_expand "<plusminus_insn><mode>3_mask"
9999 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
10000 (vec_merge:VI12_AVX512VL
10001 (plusminus:VI12_AVX512VL
10002 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand")
10003 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand"))
10004 (match_operand:VI12_AVX512VL 3 "vector_move_operand")
10005 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
10007 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
10009 (define_insn "*<plusminus_insn><mode>3"
10010 [(set (match_operand:VI_AVX2 0 "register_operand" "=x,v")
10012 (match_operand:VI_AVX2 1 "vector_operand" "<comm>0,v")
10013 (match_operand:VI_AVX2 2 "vector_operand" "xBm,vm")))]
10014 "TARGET_SSE2 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
10016 p<plusminus_mnemonic><ssemodesuffix>\t{%2, %0|%0, %2}
10017 vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10018 [(set_attr "isa" "noavx,avx")
10019 (set_attr "type" "sseiadd")
10020 (set_attr "prefix_data16" "1,*")
10021 (set_attr "prefix" "<mask_prefix3>")
10022 (set_attr "mode" "<sseinsnmode>")])
10024 (define_insn "*<plusminus_insn><mode>3_mask"
10025 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
10026 (vec_merge:VI48_AVX512VL
10027 (plusminus:VI48_AVX512VL
10028 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "<comm>v")
10029 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm"))
10030 (match_operand:VI48_AVX512VL 3 "vector_move_operand" "0C")
10031 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
10032 "TARGET_AVX512F && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
10033 "vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
10034 [(set_attr "type" "sseiadd")
10035 (set_attr "prefix" "evex")
10036 (set_attr "mode" "<sseinsnmode>")])
10038 (define_insn "*<plusminus_insn><mode>3_mask"
10039 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
10040 (vec_merge:VI12_AVX512VL
10041 (plusminus:VI12_AVX512VL
10042 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "<comm>v")
10043 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm"))
10044 (match_operand:VI12_AVX512VL 3 "vector_move_operand" "0C")
10045 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
10046 "TARGET_AVX512BW && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
10047 "vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
10048 [(set_attr "type" "sseiadd")
10049 (set_attr "prefix" "evex")
10050 (set_attr "mode" "<sseinsnmode>")])
10052 (define_expand "<sse2_avx2>_<plusminus_insn><mode>3<mask_name>"
10053 [(set (match_operand:VI12_AVX2 0 "register_operand")
10054 (sat_plusminus:VI12_AVX2
10055 (match_operand:VI12_AVX2 1 "vector_operand")
10056 (match_operand:VI12_AVX2 2 "vector_operand")))]
10057 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10058 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
10060 (define_insn "*<sse2_avx2>_<plusminus_insn><mode>3<mask_name>"
10061 [(set (match_operand:VI12_AVX2 0 "register_operand" "=x,v")
10062 (sat_plusminus:VI12_AVX2
10063 (match_operand:VI12_AVX2 1 "vector_operand" "<comm>0,v")
10064 (match_operand:VI12_AVX2 2 "vector_operand" "xBm,vm")))]
10065 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>
10066 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
10068 p<plusminus_mnemonic><ssemodesuffix>\t{%2, %0|%0, %2}
10069 vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10070 [(set_attr "isa" "noavx,avx")
10071 (set_attr "type" "sseiadd")
10072 (set_attr "prefix_data16" "1,*")
10073 (set_attr "prefix" "orig,maybe_evex")
10074 (set_attr "mode" "TI")])
10076 (define_expand "mul<mode>3<mask_name>"
10077 [(set (match_operand:VI1_AVX512 0 "register_operand")
10078 (mult:VI1_AVX512 (match_operand:VI1_AVX512 1 "register_operand")
10079 (match_operand:VI1_AVX512 2 "register_operand")))]
10080 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10082 ix86_expand_vecop_qihi (MULT, operands[0], operands[1], operands[2]);
10086 (define_expand "mul<mode>3<mask_name>"
10087 [(set (match_operand:VI2_AVX2 0 "register_operand")
10088 (mult:VI2_AVX2 (match_operand:VI2_AVX2 1 "vector_operand")
10089 (match_operand:VI2_AVX2 2 "vector_operand")))]
10090 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10091 "ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);")
10093 (define_insn "*mul<mode>3<mask_name>"
10094 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,v")
10095 (mult:VI2_AVX2 (match_operand:VI2_AVX2 1 "vector_operand" "%0,v")
10096 (match_operand:VI2_AVX2 2 "vector_operand" "xBm,vm")))]
10097 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
10098 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10100 pmullw\t{%2, %0|%0, %2}
10101 vpmullw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10102 [(set_attr "isa" "noavx,avx")
10103 (set_attr "type" "sseimul")
10104 (set_attr "prefix_data16" "1,*")
10105 (set_attr "prefix" "orig,vex")
10106 (set_attr "mode" "<sseinsnmode>")])
10108 (define_expand "<s>mul<mode>3_highpart<mask_name>"
10109 [(set (match_operand:VI2_AVX2 0 "register_operand")
10111 (lshiftrt:<ssedoublemode>
10112 (mult:<ssedoublemode>
10113 (any_extend:<ssedoublemode>
10114 (match_operand:VI2_AVX2 1 "vector_operand"))
10115 (any_extend:<ssedoublemode>
10116 (match_operand:VI2_AVX2 2 "vector_operand")))
10119 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10120 "ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);")
10122 (define_insn "*<s>mul<mode>3_highpart<mask_name>"
10123 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,v")
10125 (lshiftrt:<ssedoublemode>
10126 (mult:<ssedoublemode>
10127 (any_extend:<ssedoublemode>
10128 (match_operand:VI2_AVX2 1 "vector_operand" "%0,v"))
10129 (any_extend:<ssedoublemode>
10130 (match_operand:VI2_AVX2 2 "vector_operand" "xBm,vm")))
10132 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
10133 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10135 pmulh<u>w\t{%2, %0|%0, %2}
10136 vpmulh<u>w\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10137 [(set_attr "isa" "noavx,avx")
10138 (set_attr "type" "sseimul")
10139 (set_attr "prefix_data16" "1,*")
10140 (set_attr "prefix" "orig,vex")
10141 (set_attr "mode" "<sseinsnmode>")])
10143 (define_expand "vec_widen_umult_even_v16si<mask_name>"
10144 [(set (match_operand:V8DI 0 "register_operand")
10148 (match_operand:V16SI 1 "nonimmediate_operand")
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")
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)])))))]
10161 "ix86_fixup_binary_operands_no_copy (MULT, V16SImode, operands);")
10163 (define_insn "*vec_widen_umult_even_v16si<mask_name>"
10164 [(set (match_operand:V8DI 0 "register_operand" "=v")
10168 (match_operand:V16SI 1 "nonimmediate_operand" "%v")
10169 (parallel [(const_int 0) (const_int 2)
10170 (const_int 4) (const_int 6)
10171 (const_int 8) (const_int 10)
10172 (const_int 12) (const_int 14)])))
10175 (match_operand:V16SI 2 "nonimmediate_operand" "vm")
10176 (parallel [(const_int 0) (const_int 2)
10177 (const_int 4) (const_int 6)
10178 (const_int 8) (const_int 10)
10179 (const_int 12) (const_int 14)])))))]
10180 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10181 "vpmuludq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10182 [(set_attr "type" "sseimul")
10183 (set_attr "prefix_extra" "1")
10184 (set_attr "prefix" "evex")
10185 (set_attr "mode" "XI")])
10187 (define_expand "vec_widen_umult_even_v8si<mask_name>"
10188 [(set (match_operand:V4DI 0 "register_operand")
10192 (match_operand:V8SI 1 "nonimmediate_operand")
10193 (parallel [(const_int 0) (const_int 2)
10194 (const_int 4) (const_int 6)])))
10197 (match_operand:V8SI 2 "nonimmediate_operand")
10198 (parallel [(const_int 0) (const_int 2)
10199 (const_int 4) (const_int 6)])))))]
10200 "TARGET_AVX2 && <mask_avx512vl_condition>"
10201 "ix86_fixup_binary_operands_no_copy (MULT, V8SImode, operands);")
10203 (define_insn "*vec_widen_umult_even_v8si<mask_name>"
10204 [(set (match_operand:V4DI 0 "register_operand" "=v")
10208 (match_operand:V8SI 1 "nonimmediate_operand" "%v")
10209 (parallel [(const_int 0) (const_int 2)
10210 (const_int 4) (const_int 6)])))
10213 (match_operand:V8SI 2 "nonimmediate_operand" "vm")
10214 (parallel [(const_int 0) (const_int 2)
10215 (const_int 4) (const_int 6)])))))]
10216 "TARGET_AVX2 && <mask_avx512vl_condition>
10217 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10218 "vpmuludq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10219 [(set_attr "type" "sseimul")
10220 (set_attr "prefix" "maybe_evex")
10221 (set_attr "mode" "OI")])
10223 (define_expand "vec_widen_umult_even_v4si<mask_name>"
10224 [(set (match_operand:V2DI 0 "register_operand")
10228 (match_operand:V4SI 1 "vector_operand")
10229 (parallel [(const_int 0) (const_int 2)])))
10232 (match_operand:V4SI 2 "vector_operand")
10233 (parallel [(const_int 0) (const_int 2)])))))]
10234 "TARGET_SSE2 && <mask_avx512vl_condition>"
10235 "ix86_fixup_binary_operands_no_copy (MULT, V4SImode, operands);")
10237 (define_insn "*vec_widen_umult_even_v4si<mask_name>"
10238 [(set (match_operand:V2DI 0 "register_operand" "=x,v")
10242 (match_operand:V4SI 1 "vector_operand" "%0,v")
10243 (parallel [(const_int 0) (const_int 2)])))
10246 (match_operand:V4SI 2 "vector_operand" "xBm,vm")
10247 (parallel [(const_int 0) (const_int 2)])))))]
10248 "TARGET_SSE2 && <mask_avx512vl_condition>
10249 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10251 pmuludq\t{%2, %0|%0, %2}
10252 vpmuludq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10253 [(set_attr "isa" "noavx,avx")
10254 (set_attr "type" "sseimul")
10255 (set_attr "prefix_data16" "1,*")
10256 (set_attr "prefix" "orig,maybe_evex")
10257 (set_attr "mode" "TI")])
10259 (define_expand "vec_widen_smult_even_v16si<mask_name>"
10260 [(set (match_operand:V8DI 0 "register_operand")
10264 (match_operand:V16SI 1 "nonimmediate_operand")
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")
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)])))))]
10277 "ix86_fixup_binary_operands_no_copy (MULT, V16SImode, operands);")
10279 (define_insn "*vec_widen_smult_even_v16si<mask_name>"
10280 [(set (match_operand:V8DI 0 "register_operand" "=v")
10284 (match_operand:V16SI 1 "nonimmediate_operand" "%v")
10285 (parallel [(const_int 0) (const_int 2)
10286 (const_int 4) (const_int 6)
10287 (const_int 8) (const_int 10)
10288 (const_int 12) (const_int 14)])))
10291 (match_operand:V16SI 2 "nonimmediate_operand" "vm")
10292 (parallel [(const_int 0) (const_int 2)
10293 (const_int 4) (const_int 6)
10294 (const_int 8) (const_int 10)
10295 (const_int 12) (const_int 14)])))))]
10296 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10297 "vpmuldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10298 [(set_attr "type" "sseimul")
10299 (set_attr "prefix_extra" "1")
10300 (set_attr "prefix" "evex")
10301 (set_attr "mode" "XI")])
10303 (define_expand "vec_widen_smult_even_v8si<mask_name>"
10304 [(set (match_operand:V4DI 0 "register_operand")
10308 (match_operand:V8SI 1 "nonimmediate_operand")
10309 (parallel [(const_int 0) (const_int 2)
10310 (const_int 4) (const_int 6)])))
10313 (match_operand:V8SI 2 "nonimmediate_operand")
10314 (parallel [(const_int 0) (const_int 2)
10315 (const_int 4) (const_int 6)])))))]
10316 "TARGET_AVX2 && <mask_avx512vl_condition>"
10317 "ix86_fixup_binary_operands_no_copy (MULT, V8SImode, operands);")
10319 (define_insn "*vec_widen_smult_even_v8si<mask_name>"
10320 [(set (match_operand:V4DI 0 "register_operand" "=v")
10324 (match_operand:V8SI 1 "nonimmediate_operand" "%v")
10325 (parallel [(const_int 0) (const_int 2)
10326 (const_int 4) (const_int 6)])))
10329 (match_operand:V8SI 2 "nonimmediate_operand" "vm")
10330 (parallel [(const_int 0) (const_int 2)
10331 (const_int 4) (const_int 6)])))))]
10332 "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10333 "vpmuldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10334 [(set_attr "type" "sseimul")
10335 (set_attr "prefix_extra" "1")
10336 (set_attr "prefix" "vex")
10337 (set_attr "mode" "OI")])
10339 (define_expand "sse4_1_mulv2siv2di3<mask_name>"
10340 [(set (match_operand:V2DI 0 "register_operand")
10344 (match_operand:V4SI 1 "vector_operand")
10345 (parallel [(const_int 0) (const_int 2)])))
10348 (match_operand:V4SI 2 "vector_operand")
10349 (parallel [(const_int 0) (const_int 2)])))))]
10350 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
10351 "ix86_fixup_binary_operands_no_copy (MULT, V4SImode, operands);")
10353 (define_insn "*sse4_1_mulv2siv2di3<mask_name>"
10354 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
10358 (match_operand:V4SI 1 "vector_operand" "%0,0,v")
10359 (parallel [(const_int 0) (const_int 2)])))
10362 (match_operand:V4SI 2 "vector_operand" "YrBm,*xBm,vm")
10363 (parallel [(const_int 0) (const_int 2)])))))]
10364 "TARGET_SSE4_1 && <mask_avx512vl_condition>
10365 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10367 pmuldq\t{%2, %0|%0, %2}
10368 pmuldq\t{%2, %0|%0, %2}
10369 vpmuldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10370 [(set_attr "isa" "noavx,noavx,avx")
10371 (set_attr "type" "sseimul")
10372 (set_attr "prefix_data16" "1,1,*")
10373 (set_attr "prefix_extra" "1")
10374 (set_attr "prefix" "orig,orig,vex")
10375 (set_attr "mode" "TI")])
10377 (define_insn "avx512bw_pmaddwd512<mode><mask_name>"
10378 [(set (match_operand:<sseunpackmode> 0 "register_operand" "=v")
10379 (unspec:<sseunpackmode>
10380 [(match_operand:VI2_AVX2 1 "register_operand" "v")
10381 (match_operand:VI2_AVX2 2 "nonimmediate_operand" "vm")]
10382 UNSPEC_PMADDWD512))]
10383 "TARGET_AVX512BW && <mask_mode512bit_condition>"
10384 "vpmaddwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}";
10385 [(set_attr "type" "sseiadd")
10386 (set_attr "prefix" "evex")
10387 (set_attr "mode" "XI")])
10389 (define_expand "avx2_pmaddwd"
10390 [(set (match_operand:V8SI 0 "register_operand")
10395 (match_operand:V16HI 1 "nonimmediate_operand")
10396 (parallel [(const_int 0) (const_int 2)
10397 (const_int 4) (const_int 6)
10398 (const_int 8) (const_int 10)
10399 (const_int 12) (const_int 14)])))
10402 (match_operand:V16HI 2 "nonimmediate_operand")
10403 (parallel [(const_int 0) (const_int 2)
10404 (const_int 4) (const_int 6)
10405 (const_int 8) (const_int 10)
10406 (const_int 12) (const_int 14)]))))
10409 (vec_select:V8HI (match_dup 1)
10410 (parallel [(const_int 1) (const_int 3)
10411 (const_int 5) (const_int 7)
10412 (const_int 9) (const_int 11)
10413 (const_int 13) (const_int 15)])))
10415 (vec_select:V8HI (match_dup 2)
10416 (parallel [(const_int 1) (const_int 3)
10417 (const_int 5) (const_int 7)
10418 (const_int 9) (const_int 11)
10419 (const_int 13) (const_int 15)]))))))]
10421 "ix86_fixup_binary_operands_no_copy (MULT, V16HImode, operands);")
10423 (define_insn "*avx2_pmaddwd"
10424 [(set (match_operand:V8SI 0 "register_operand" "=x,v")
10429 (match_operand:V16HI 1 "nonimmediate_operand" "%x,v")
10430 (parallel [(const_int 0) (const_int 2)
10431 (const_int 4) (const_int 6)
10432 (const_int 8) (const_int 10)
10433 (const_int 12) (const_int 14)])))
10436 (match_operand:V16HI 2 "nonimmediate_operand" "xm,vm")
10437 (parallel [(const_int 0) (const_int 2)
10438 (const_int 4) (const_int 6)
10439 (const_int 8) (const_int 10)
10440 (const_int 12) (const_int 14)]))))
10443 (vec_select:V8HI (match_dup 1)
10444 (parallel [(const_int 1) (const_int 3)
10445 (const_int 5) (const_int 7)
10446 (const_int 9) (const_int 11)
10447 (const_int 13) (const_int 15)])))
10449 (vec_select:V8HI (match_dup 2)
10450 (parallel [(const_int 1) (const_int 3)
10451 (const_int 5) (const_int 7)
10452 (const_int 9) (const_int 11)
10453 (const_int 13) (const_int 15)]))))))]
10454 "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10455 "vpmaddwd\t{%2, %1, %0|%0, %1, %2}"
10456 [(set_attr "type" "sseiadd")
10457 (set_attr "isa" "*,avx512bw")
10458 (set_attr "prefix" "vex,evex")
10459 (set_attr "mode" "OI")])
10461 (define_expand "sse2_pmaddwd"
10462 [(set (match_operand:V4SI 0 "register_operand")
10467 (match_operand:V8HI 1 "vector_operand")
10468 (parallel [(const_int 0) (const_int 2)
10469 (const_int 4) (const_int 6)])))
10472 (match_operand:V8HI 2 "vector_operand")
10473 (parallel [(const_int 0) (const_int 2)
10474 (const_int 4) (const_int 6)]))))
10477 (vec_select:V4HI (match_dup 1)
10478 (parallel [(const_int 1) (const_int 3)
10479 (const_int 5) (const_int 7)])))
10481 (vec_select:V4HI (match_dup 2)
10482 (parallel [(const_int 1) (const_int 3)
10483 (const_int 5) (const_int 7)]))))))]
10485 "ix86_fixup_binary_operands_no_copy (MULT, V8HImode, operands);")
10487 (define_insn "*sse2_pmaddwd"
10488 [(set (match_operand:V4SI 0 "register_operand" "=x,x,v")
10493 (match_operand:V8HI 1 "vector_operand" "%0,x,v")
10494 (parallel [(const_int 0) (const_int 2)
10495 (const_int 4) (const_int 6)])))
10498 (match_operand:V8HI 2 "vector_operand" "xBm,xm,vm")
10499 (parallel [(const_int 0) (const_int 2)
10500 (const_int 4) (const_int 6)]))))
10503 (vec_select:V4HI (match_dup 1)
10504 (parallel [(const_int 1) (const_int 3)
10505 (const_int 5) (const_int 7)])))
10507 (vec_select:V4HI (match_dup 2)
10508 (parallel [(const_int 1) (const_int 3)
10509 (const_int 5) (const_int 7)]))))))]
10510 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10512 pmaddwd\t{%2, %0|%0, %2}
10513 vpmaddwd\t{%2, %1, %0|%0, %1, %2}
10514 vpmaddwd\t{%2, %1, %0|%0, %1, %2}"
10515 [(set_attr "isa" "noavx,avx,avx512bw")
10516 (set_attr "type" "sseiadd")
10517 (set_attr "atom_unit" "simul")
10518 (set_attr "prefix_data16" "1,*,*")
10519 (set_attr "prefix" "orig,vex,evex")
10520 (set_attr "mode" "TI")])
10522 (define_insn "avx512dq_mul<mode>3<mask_name>"
10523 [(set (match_operand:VI8 0 "register_operand" "=v")
10525 (match_operand:VI8 1 "register_operand" "v")
10526 (match_operand:VI8 2 "nonimmediate_operand" "vm")))]
10527 "TARGET_AVX512DQ && <mask_mode512bit_condition>"
10528 "vpmullq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10529 [(set_attr "type" "sseimul")
10530 (set_attr "prefix" "evex")
10531 (set_attr "mode" "<sseinsnmode>")])
10533 (define_expand "mul<mode>3<mask_name>"
10534 [(set (match_operand:VI4_AVX512F 0 "register_operand")
10536 (match_operand:VI4_AVX512F 1 "general_vector_operand")
10537 (match_operand:VI4_AVX512F 2 "general_vector_operand")))]
10538 "TARGET_SSE2 && <mask_mode512bit_condition>"
10542 if (!vector_operand (operands[1], <MODE>mode))
10543 operands[1] = force_reg (<MODE>mode, operands[1]);
10544 if (!vector_operand (operands[2], <MODE>mode))
10545 operands[2] = force_reg (<MODE>mode, operands[2]);
10546 ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);
10550 ix86_expand_sse2_mulv4si3 (operands[0], operands[1], operands[2]);
10555 (define_insn "*<sse4_1_avx2>_mul<mode>3<mask_name>"
10556 [(set (match_operand:VI4_AVX512F 0 "register_operand" "=Yr,*x,v")
10558 (match_operand:VI4_AVX512F 1 "vector_operand" "%0,0,v")
10559 (match_operand:VI4_AVX512F 2 "vector_operand" "YrBm,*xBm,vm")))]
10560 "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))
10561 && <mask_mode512bit_condition>"
10563 pmulld\t{%2, %0|%0, %2}
10564 pmulld\t{%2, %0|%0, %2}
10565 vpmulld\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10566 [(set_attr "isa" "noavx,noavx,avx")
10567 (set_attr "type" "sseimul")
10568 (set_attr "prefix_extra" "1")
10569 (set_attr "prefix" "<mask_prefix4>")
10570 (set_attr "btver2_decode" "vector,vector,vector")
10571 (set_attr "mode" "<sseinsnmode>")])
10573 (define_expand "mul<mode>3"
10574 [(set (match_operand:VI8_AVX2_AVX512F 0 "register_operand")
10575 (mult:VI8_AVX2_AVX512F
10576 (match_operand:VI8_AVX2_AVX512F 1 "register_operand")
10577 (match_operand:VI8_AVX2_AVX512F 2 "register_operand")))]
10580 ix86_expand_sse2_mulvxdi3 (operands[0], operands[1], operands[2]);
10584 (define_expand "vec_widen_<s>mult_hi_<mode>"
10585 [(match_operand:<sseunpackmode> 0 "register_operand")
10586 (any_extend:<sseunpackmode>
10587 (match_operand:VI124_AVX2 1 "register_operand"))
10588 (match_operand:VI124_AVX2 2 "register_operand")]
10591 ix86_expand_mul_widen_hilo (operands[0], operands[1], operands[2],
10596 (define_expand "vec_widen_<s>mult_lo_<mode>"
10597 [(match_operand:<sseunpackmode> 0 "register_operand")
10598 (any_extend:<sseunpackmode>
10599 (match_operand:VI124_AVX2 1 "register_operand"))
10600 (match_operand:VI124_AVX2 2 "register_operand")]
10603 ix86_expand_mul_widen_hilo (operands[0], operands[1], operands[2],
10608 ;; Most widen_<s>mult_even_<mode> can be handled directly from other
10609 ;; named patterns, but signed V4SI needs special help for plain SSE2.
10610 (define_expand "vec_widen_smult_even_v4si"
10611 [(match_operand:V2DI 0 "register_operand")
10612 (match_operand:V4SI 1 "vector_operand")
10613 (match_operand:V4SI 2 "vector_operand")]
10616 ix86_expand_mul_widen_evenodd (operands[0], operands[1], operands[2],
10621 (define_expand "vec_widen_<s>mult_odd_<mode>"
10622 [(match_operand:<sseunpackmode> 0 "register_operand")
10623 (any_extend:<sseunpackmode>
10624 (match_operand:VI4_AVX512F 1 "general_vector_operand"))
10625 (match_operand:VI4_AVX512F 2 "general_vector_operand")]
10628 ix86_expand_mul_widen_evenodd (operands[0], operands[1], operands[2],
10633 (define_mode_attr SDOT_PMADD_SUF
10634 [(V32HI "512v32hi") (V16HI "") (V8HI "")])
10636 (define_expand "sdot_prod<mode>"
10637 [(match_operand:<sseunpackmode> 0 "register_operand")
10638 (match_operand:VI2_AVX2 1 "register_operand")
10639 (match_operand:VI2_AVX2 2 "register_operand")
10640 (match_operand:<sseunpackmode> 3 "register_operand")]
10643 rtx t = gen_reg_rtx (<sseunpackmode>mode);
10644 emit_insn (gen_<sse2_avx2>_pmaddwd<SDOT_PMADD_SUF> (t, operands[1], operands[2]));
10645 emit_insn (gen_rtx_SET (operands[0],
10646 gen_rtx_PLUS (<sseunpackmode>mode,
10651 ;; Normally we use widen_mul_even/odd, but combine can't quite get it all
10652 ;; back together when madd is available.
10653 (define_expand "sdot_prodv4si"
10654 [(match_operand:V2DI 0 "register_operand")
10655 (match_operand:V4SI 1 "register_operand")
10656 (match_operand:V4SI 2 "register_operand")
10657 (match_operand:V2DI 3 "register_operand")]
10660 rtx t = gen_reg_rtx (V2DImode);
10661 emit_insn (gen_xop_pmacsdqh (t, operands[1], operands[2], operands[3]));
10662 emit_insn (gen_xop_pmacsdql (operands[0], operands[1], operands[2], t));
10666 (define_expand "usadv16qi"
10667 [(match_operand:V4SI 0 "register_operand")
10668 (match_operand:V16QI 1 "register_operand")
10669 (match_operand:V16QI 2 "vector_operand")
10670 (match_operand:V4SI 3 "vector_operand")]
10673 rtx t1 = gen_reg_rtx (V2DImode);
10674 rtx t2 = gen_reg_rtx (V4SImode);
10675 emit_insn (gen_sse2_psadbw (t1, operands[1], operands[2]));
10676 convert_move (t2, t1, 0);
10677 emit_insn (gen_addv4si3 (operands[0], t2, operands[3]));
10681 (define_expand "usadv32qi"
10682 [(match_operand:V8SI 0 "register_operand")
10683 (match_operand:V32QI 1 "register_operand")
10684 (match_operand:V32QI 2 "nonimmediate_operand")
10685 (match_operand:V8SI 3 "nonimmediate_operand")]
10688 rtx t1 = gen_reg_rtx (V4DImode);
10689 rtx t2 = gen_reg_rtx (V8SImode);
10690 emit_insn (gen_avx2_psadbw (t1, operands[1], operands[2]));
10691 convert_move (t2, t1, 0);
10692 emit_insn (gen_addv8si3 (operands[0], t2, operands[3]));
10696 (define_insn "<mask_codefor>ashr<mode>3<mask_name>"
10697 [(set (match_operand:VI248_AVX512BW_1 0 "register_operand" "=v,v")
10698 (ashiftrt:VI248_AVX512BW_1
10699 (match_operand:VI248_AVX512BW_1 1 "nonimmediate_operand" "v,vm")
10700 (match_operand:DI 2 "nonmemory_operand" "v,N")))]
10702 "vpsra<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10703 [(set_attr "type" "sseishft")
10704 (set (attr "length_immediate")
10705 (if_then_else (match_operand 2 "const_int_operand")
10707 (const_string "0")))
10708 (set_attr "mode" "<sseinsnmode>")])
10710 (define_insn "ashr<mode>3"
10711 [(set (match_operand:VI24_AVX2 0 "register_operand" "=x,x")
10712 (ashiftrt:VI24_AVX2
10713 (match_operand:VI24_AVX2 1 "register_operand" "0,x")
10714 (match_operand:DI 2 "nonmemory_operand" "xN,xN")))]
10717 psra<ssemodesuffix>\t{%2, %0|%0, %2}
10718 vpsra<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
10719 [(set_attr "isa" "noavx,avx")
10720 (set_attr "type" "sseishft")
10721 (set (attr "length_immediate")
10722 (if_then_else (match_operand 2 "const_int_operand")
10724 (const_string "0")))
10725 (set_attr "prefix_data16" "1,*")
10726 (set_attr "prefix" "orig,vex")
10727 (set_attr "mode" "<sseinsnmode>")])
10729 (define_insn "ashr<mode>3<mask_name>"
10730 [(set (match_operand:VI248_AVX512BW_AVX512VL 0 "register_operand" "=v,v")
10731 (ashiftrt:VI248_AVX512BW_AVX512VL
10732 (match_operand:VI248_AVX512BW_AVX512VL 1 "nonimmediate_operand" "v,vm")
10733 (match_operand:DI 2 "nonmemory_operand" "v,N")))]
10735 "vpsra<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10736 [(set_attr "type" "sseishft")
10737 (set (attr "length_immediate")
10738 (if_then_else (match_operand 2 "const_int_operand")
10740 (const_string "0")))
10741 (set_attr "mode" "<sseinsnmode>")])
10743 (define_insn "<mask_codefor><shift_insn><mode>3<mask_name>"
10744 [(set (match_operand:VI248_AVX512BW_2 0 "register_operand" "=v,v")
10745 (any_lshift:VI248_AVX512BW_2
10746 (match_operand:VI248_AVX512BW_2 1 "nonimmediate_operand" "v,vm")
10747 (match_operand:DI 2 "nonmemory_operand" "v,N")))]
10749 "vp<vshift><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10750 [(set_attr "type" "sseishft")
10751 (set (attr "length_immediate")
10752 (if_then_else (match_operand 2 "const_int_operand")
10754 (const_string "0")))
10755 (set_attr "mode" "<sseinsnmode>")])
10757 (define_insn "<shift_insn><mode>3"
10758 [(set (match_operand:VI248_AVX2 0 "register_operand" "=x,x")
10759 (any_lshift:VI248_AVX2
10760 (match_operand:VI248_AVX2 1 "register_operand" "0,x")
10761 (match_operand:DI 2 "nonmemory_operand" "xN,xN")))]
10764 p<vshift><ssemodesuffix>\t{%2, %0|%0, %2}
10765 vp<vshift><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
10766 [(set_attr "isa" "noavx,avx")
10767 (set_attr "type" "sseishft")
10768 (set (attr "length_immediate")
10769 (if_then_else (match_operand 2 "const_int_operand")
10771 (const_string "0")))
10772 (set_attr "prefix_data16" "1,*")
10773 (set_attr "prefix" "orig,vex")
10774 (set_attr "mode" "<sseinsnmode>")])
10776 (define_insn "<shift_insn><mode>3<mask_name>"
10777 [(set (match_operand:VI248_AVX512BW 0 "register_operand" "=v,v")
10778 (any_lshift:VI248_AVX512BW
10779 (match_operand:VI248_AVX512BW 1 "nonimmediate_operand" "v,m")
10780 (match_operand:DI 2 "nonmemory_operand" "vN,N")))]
10782 "vp<vshift><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10783 [(set_attr "type" "sseishft")
10784 (set (attr "length_immediate")
10785 (if_then_else (match_operand 2 "const_int_operand")
10787 (const_string "0")))
10788 (set_attr "mode" "<sseinsnmode>")])
10791 (define_expand "vec_shr_<mode>"
10792 [(set (match_dup 3)
10794 (match_operand:VI_128 1 "register_operand")
10795 (match_operand:SI 2 "const_0_to_255_mul_8_operand")))
10796 (set (match_operand:VI_128 0 "register_operand") (match_dup 4))]
10799 operands[1] = gen_lowpart (V1TImode, operands[1]);
10800 operands[3] = gen_reg_rtx (V1TImode);
10801 operands[4] = gen_lowpart (<MODE>mode, operands[3]);
10804 (define_insn "avx512bw_<shift_insn><mode>3"
10805 [(set (match_operand:VIMAX_AVX512VL 0 "register_operand" "=v")
10806 (any_lshift:VIMAX_AVX512VL
10807 (match_operand:VIMAX_AVX512VL 1 "nonimmediate_operand" "vm")
10808 (match_operand:SI 2 "const_0_to_255_mul_8_operand" "n")))]
10811 operands[2] = GEN_INT (INTVAL (operands[2]) / 8);
10812 return "vp<vshift>dq\t{%2, %1, %0|%0, %1, %2}";
10814 [(set_attr "type" "sseishft")
10815 (set_attr "length_immediate" "1")
10816 (set_attr "prefix" "maybe_evex")
10817 (set_attr "mode" "<sseinsnmode>")])
10819 (define_insn "<sse2_avx2>_<shift_insn><mode>3"
10820 [(set (match_operand:VIMAX_AVX2 0 "register_operand" "=x,v")
10821 (any_lshift:VIMAX_AVX2
10822 (match_operand:VIMAX_AVX2 1 "register_operand" "0,v")
10823 (match_operand:SI 2 "const_0_to_255_mul_8_operand" "n,n")))]
10826 operands[2] = GEN_INT (INTVAL (operands[2]) / 8);
10828 switch (which_alternative)
10831 return "p<vshift>dq\t{%2, %0|%0, %2}";
10833 return "vp<vshift>dq\t{%2, %1, %0|%0, %1, %2}";
10835 gcc_unreachable ();
10838 [(set_attr "isa" "noavx,avx")
10839 (set_attr "type" "sseishft")
10840 (set_attr "length_immediate" "1")
10841 (set_attr "atom_unit" "sishuf")
10842 (set_attr "prefix_data16" "1,*")
10843 (set_attr "prefix" "orig,vex")
10844 (set_attr "mode" "<sseinsnmode>")])
10846 (define_insn "<avx512>_<rotate>v<mode><mask_name>"
10847 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
10848 (any_rotate:VI48_AVX512VL
10849 (match_operand:VI48_AVX512VL 1 "register_operand" "v")
10850 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")))]
10852 "vp<rotate>v<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10853 [(set_attr "prefix" "evex")
10854 (set_attr "mode" "<sseinsnmode>")])
10856 (define_insn "<avx512>_<rotate><mode><mask_name>"
10857 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
10858 (any_rotate:VI48_AVX512VL
10859 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm")
10860 (match_operand:SI 2 "const_0_to_255_operand")))]
10862 "vp<rotate><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10863 [(set_attr "prefix" "evex")
10864 (set_attr "mode" "<sseinsnmode>")])
10866 (define_expand "<code><mode>3"
10867 [(set (match_operand:VI124_256_AVX512F_AVX512BW 0 "register_operand")
10868 (maxmin:VI124_256_AVX512F_AVX512BW
10869 (match_operand:VI124_256_AVX512F_AVX512BW 1 "nonimmediate_operand")
10870 (match_operand:VI124_256_AVX512F_AVX512BW 2 "nonimmediate_operand")))]
10872 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
10874 (define_insn "*avx2_<code><mode>3"
10875 [(set (match_operand:VI124_256 0 "register_operand" "=v")
10877 (match_operand:VI124_256 1 "nonimmediate_operand" "%v")
10878 (match_operand:VI124_256 2 "nonimmediate_operand" "vm")))]
10879 "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10880 "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
10881 [(set_attr "type" "sseiadd")
10882 (set_attr "prefix_extra" "1")
10883 (set_attr "prefix" "vex")
10884 (set_attr "mode" "OI")])
10886 (define_expand "<code><mode>3_mask"
10887 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
10888 (vec_merge:VI48_AVX512VL
10889 (maxmin:VI48_AVX512VL
10890 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand")
10891 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand"))
10892 (match_operand:VI48_AVX512VL 3 "vector_move_operand")
10893 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
10895 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
10897 (define_insn "*avx512f_<code><mode>3<mask_name>"
10898 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
10899 (maxmin:VI48_AVX512VL
10900 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "%v")
10901 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")))]
10902 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
10903 "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10904 [(set_attr "type" "sseiadd")
10905 (set_attr "prefix_extra" "1")
10906 (set_attr "prefix" "maybe_evex")
10907 (set_attr "mode" "<sseinsnmode>")])
10909 (define_insn "<mask_codefor><code><mode>3<mask_name>"
10910 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
10911 (maxmin:VI12_AVX512VL
10912 (match_operand:VI12_AVX512VL 1 "register_operand" "v")
10913 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")))]
10915 "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10916 [(set_attr "type" "sseiadd")
10917 (set_attr "prefix" "evex")
10918 (set_attr "mode" "<sseinsnmode>")])
10920 (define_expand "<code><mode>3"
10921 [(set (match_operand:VI8_AVX2_AVX512F 0 "register_operand")
10922 (maxmin:VI8_AVX2_AVX512F
10923 (match_operand:VI8_AVX2_AVX512F 1 "register_operand")
10924 (match_operand:VI8_AVX2_AVX512F 2 "register_operand")))]
10928 && (<MODE>mode == V8DImode || TARGET_AVX512VL))
10929 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
10932 enum rtx_code code;
10937 xops[0] = operands[0];
10939 if (<CODE> == SMAX || <CODE> == UMAX)
10941 xops[1] = operands[1];
10942 xops[2] = operands[2];
10946 xops[1] = operands[2];
10947 xops[2] = operands[1];
10950 code = (<CODE> == UMAX || <CODE> == UMIN) ? GTU : GT;
10952 xops[3] = gen_rtx_fmt_ee (code, VOIDmode, operands[1], operands[2]);
10953 xops[4] = operands[1];
10954 xops[5] = operands[2];
10956 ok = ix86_expand_int_vcond (xops);
10962 (define_expand "<code><mode>3"
10963 [(set (match_operand:VI124_128 0 "register_operand")
10965 (match_operand:VI124_128 1 "vector_operand")
10966 (match_operand:VI124_128 2 "vector_operand")))]
10969 if (TARGET_SSE4_1 || <MODE>mode == V8HImode)
10970 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
10976 xops[0] = operands[0];
10977 operands[1] = force_reg (<MODE>mode, operands[1]);
10978 operands[2] = force_reg (<MODE>mode, operands[2]);
10980 if (<CODE> == SMAX)
10982 xops[1] = operands[1];
10983 xops[2] = operands[2];
10987 xops[1] = operands[2];
10988 xops[2] = operands[1];
10991 xops[3] = gen_rtx_GT (VOIDmode, operands[1], operands[2]);
10992 xops[4] = operands[1];
10993 xops[5] = operands[2];
10995 ok = ix86_expand_int_vcond (xops);
11001 (define_insn "*sse4_1_<code><mode>3<mask_name>"
11002 [(set (match_operand:VI14_128 0 "register_operand" "=Yr,*x,v")
11004 (match_operand:VI14_128 1 "vector_operand" "%0,0,v")
11005 (match_operand:VI14_128 2 "vector_operand" "YrBm,*xBm,vm")))]
11007 && <mask_mode512bit_condition>
11008 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11010 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
11011 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
11012 vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11013 [(set_attr "isa" "noavx,noavx,avx")
11014 (set_attr "type" "sseiadd")
11015 (set_attr "prefix_extra" "1,1,*")
11016 (set_attr "prefix" "orig,orig,vex")
11017 (set_attr "mode" "TI")])
11019 (define_insn "*<code>v8hi3"
11020 [(set (match_operand:V8HI 0 "register_operand" "=x,x,v")
11022 (match_operand:V8HI 1 "vector_operand" "%0,x,v")
11023 (match_operand:V8HI 2 "vector_operand" "xBm,xm,vm")))]
11024 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11026 p<maxmin_int>w\t{%2, %0|%0, %2}
11027 vp<maxmin_int>w\t{%2, %1, %0|%0, %1, %2}
11028 vp<maxmin_int>w\t{%2, %1, %0|%0, %1, %2}"
11029 [(set_attr "isa" "noavx,avx,avx512bw")
11030 (set_attr "type" "sseiadd")
11031 (set_attr "prefix_data16" "1,*,*")
11032 (set_attr "prefix_extra" "*,1,1")
11033 (set_attr "prefix" "orig,vex,evex")
11034 (set_attr "mode" "TI")])
11036 (define_expand "<code><mode>3"
11037 [(set (match_operand:VI124_128 0 "register_operand")
11039 (match_operand:VI124_128 1 "vector_operand")
11040 (match_operand:VI124_128 2 "vector_operand")))]
11043 if (TARGET_SSE4_1 || <MODE>mode == V16QImode)
11044 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
11045 else if (<CODE> == UMAX && <MODE>mode == V8HImode)
11047 rtx op0 = operands[0], op2 = operands[2], op3 = op0;
11048 operands[1] = force_reg (<MODE>mode, operands[1]);
11049 if (rtx_equal_p (op3, op2))
11050 op3 = gen_reg_rtx (V8HImode);
11051 emit_insn (gen_sse2_ussubv8hi3 (op3, operands[1], op2));
11052 emit_insn (gen_addv8hi3 (op0, op3, op2));
11060 operands[1] = force_reg (<MODE>mode, operands[1]);
11061 operands[2] = force_reg (<MODE>mode, operands[2]);
11063 xops[0] = operands[0];
11065 if (<CODE> == UMAX)
11067 xops[1] = operands[1];
11068 xops[2] = operands[2];
11072 xops[1] = operands[2];
11073 xops[2] = operands[1];
11076 xops[3] = gen_rtx_GTU (VOIDmode, operands[1], operands[2]);
11077 xops[4] = operands[1];
11078 xops[5] = operands[2];
11080 ok = ix86_expand_int_vcond (xops);
11086 (define_insn "*sse4_1_<code><mode>3<mask_name>"
11087 [(set (match_operand:VI24_128 0 "register_operand" "=Yr,*x,v")
11089 (match_operand:VI24_128 1 "vector_operand" "%0,0,v")
11090 (match_operand:VI24_128 2 "vector_operand" "YrBm,*xBm,vm")))]
11092 && <mask_mode512bit_condition>
11093 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11095 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
11096 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
11097 vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11098 [(set_attr "isa" "noavx,noavx,avx")
11099 (set_attr "type" "sseiadd")
11100 (set_attr "prefix_extra" "1,1,*")
11101 (set_attr "prefix" "orig,orig,vex")
11102 (set_attr "mode" "TI")])
11104 (define_insn "*<code>v16qi3"
11105 [(set (match_operand:V16QI 0 "register_operand" "=x,x,v")
11107 (match_operand:V16QI 1 "vector_operand" "%0,x,v")
11108 (match_operand:V16QI 2 "vector_operand" "xBm,xm,vm")))]
11109 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11111 p<maxmin_int>b\t{%2, %0|%0, %2}
11112 vp<maxmin_int>b\t{%2, %1, %0|%0, %1, %2}
11113 vp<maxmin_int>b\t{%2, %1, %0|%0, %1, %2}"
11114 [(set_attr "isa" "noavx,avx,avx512bw")
11115 (set_attr "type" "sseiadd")
11116 (set_attr "prefix_data16" "1,*,*")
11117 (set_attr "prefix_extra" "*,1,1")
11118 (set_attr "prefix" "orig,vex,evex")
11119 (set_attr "mode" "TI")])
11121 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11123 ;; Parallel integral comparisons
11125 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11127 (define_expand "avx2_eq<mode>3"
11128 [(set (match_operand:VI_256 0 "register_operand")
11130 (match_operand:VI_256 1 "nonimmediate_operand")
11131 (match_operand:VI_256 2 "nonimmediate_operand")))]
11133 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
11135 (define_insn "*avx2_eq<mode>3"
11136 [(set (match_operand:VI_256 0 "register_operand" "=x")
11138 (match_operand:VI_256 1 "nonimmediate_operand" "%x")
11139 (match_operand:VI_256 2 "nonimmediate_operand" "xm")))]
11140 "TARGET_AVX2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11141 "vpcmpeq<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11142 [(set_attr "type" "ssecmp")
11143 (set_attr "prefix_extra" "1")
11144 (set_attr "prefix" "vex")
11145 (set_attr "mode" "OI")])
11147 (define_expand "<avx512>_eq<mode>3<mask_scalar_merge_name>"
11148 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
11149 (unspec:<avx512fmaskmode>
11150 [(match_operand:VI12_AVX512VL 1 "nonimmediate_operand")
11151 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand")]
11152 UNSPEC_MASKED_EQ))]
11154 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
11156 (define_expand "<avx512>_eq<mode>3<mask_scalar_merge_name>"
11157 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
11158 (unspec:<avx512fmaskmode>
11159 [(match_operand:VI48_AVX512VL 1 "nonimmediate_operand")
11160 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand")]
11161 UNSPEC_MASKED_EQ))]
11163 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
11165 (define_insn "<avx512>_eq<mode>3<mask_scalar_merge_name>_1"
11166 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11167 (unspec:<avx512fmaskmode>
11168 [(match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "%v")
11169 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")]
11170 UNSPEC_MASKED_EQ))]
11171 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11172 "vpcmpeq<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11173 [(set_attr "type" "ssecmp")
11174 (set_attr "prefix_extra" "1")
11175 (set_attr "prefix" "evex")
11176 (set_attr "mode" "<sseinsnmode>")])
11178 (define_insn "<avx512>_eq<mode>3<mask_scalar_merge_name>_1"
11179 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11180 (unspec:<avx512fmaskmode>
11181 [(match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "%v")
11182 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")]
11183 UNSPEC_MASKED_EQ))]
11184 "TARGET_AVX512F && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11185 "vpcmpeq<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11186 [(set_attr "type" "ssecmp")
11187 (set_attr "prefix_extra" "1")
11188 (set_attr "prefix" "evex")
11189 (set_attr "mode" "<sseinsnmode>")])
11191 (define_insn "*sse4_1_eqv2di3"
11192 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,x")
11194 (match_operand:V2DI 1 "vector_operand" "%0,0,x")
11195 (match_operand:V2DI 2 "vector_operand" "YrBm,*xBm,xm")))]
11196 "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11198 pcmpeqq\t{%2, %0|%0, %2}
11199 pcmpeqq\t{%2, %0|%0, %2}
11200 vpcmpeqq\t{%2, %1, %0|%0, %1, %2}"
11201 [(set_attr "isa" "noavx,noavx,avx")
11202 (set_attr "type" "ssecmp")
11203 (set_attr "prefix_extra" "1")
11204 (set_attr "prefix" "orig,orig,vex")
11205 (set_attr "mode" "TI")])
11207 (define_insn "*sse2_eq<mode>3"
11208 [(set (match_operand:VI124_128 0 "register_operand" "=x,x")
11210 (match_operand:VI124_128 1 "vector_operand" "%0,x")
11211 (match_operand:VI124_128 2 "vector_operand" "xBm,xm")))]
11212 "TARGET_SSE2 && !TARGET_XOP
11213 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11215 pcmpeq<ssemodesuffix>\t{%2, %0|%0, %2}
11216 vpcmpeq<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11217 [(set_attr "isa" "noavx,avx")
11218 (set_attr "type" "ssecmp")
11219 (set_attr "prefix_data16" "1,*")
11220 (set_attr "prefix" "orig,vex")
11221 (set_attr "mode" "TI")])
11223 (define_expand "sse2_eq<mode>3"
11224 [(set (match_operand:VI124_128 0 "register_operand")
11226 (match_operand:VI124_128 1 "vector_operand")
11227 (match_operand:VI124_128 2 "vector_operand")))]
11228 "TARGET_SSE2 && !TARGET_XOP "
11229 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
11231 (define_expand "sse4_1_eqv2di3"
11232 [(set (match_operand:V2DI 0 "register_operand")
11234 (match_operand:V2DI 1 "vector_operand")
11235 (match_operand:V2DI 2 "vector_operand")))]
11237 "ix86_fixup_binary_operands_no_copy (EQ, V2DImode, operands);")
11239 (define_insn "sse4_2_gtv2di3"
11240 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,x")
11242 (match_operand:V2DI 1 "register_operand" "0,0,x")
11243 (match_operand:V2DI 2 "vector_operand" "YrBm,*xBm,xm")))]
11246 pcmpgtq\t{%2, %0|%0, %2}
11247 pcmpgtq\t{%2, %0|%0, %2}
11248 vpcmpgtq\t{%2, %1, %0|%0, %1, %2}"
11249 [(set_attr "isa" "noavx,noavx,avx")
11250 (set_attr "type" "ssecmp")
11251 (set_attr "prefix_extra" "1")
11252 (set_attr "prefix" "orig,orig,vex")
11253 (set_attr "mode" "TI")])
11255 (define_insn "avx2_gt<mode>3"
11256 [(set (match_operand:VI_256 0 "register_operand" "=x")
11258 (match_operand:VI_256 1 "register_operand" "x")
11259 (match_operand:VI_256 2 "nonimmediate_operand" "xm")))]
11261 "vpcmpgt<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11262 [(set_attr "type" "ssecmp")
11263 (set_attr "prefix_extra" "1")
11264 (set_attr "prefix" "vex")
11265 (set_attr "mode" "OI")])
11267 (define_insn "<avx512>_gt<mode>3<mask_scalar_merge_name>"
11268 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11269 (unspec:<avx512fmaskmode>
11270 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
11271 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")] UNSPEC_MASKED_GT))]
11273 "vpcmpgt<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11274 [(set_attr "type" "ssecmp")
11275 (set_attr "prefix_extra" "1")
11276 (set_attr "prefix" "evex")
11277 (set_attr "mode" "<sseinsnmode>")])
11279 (define_insn "<avx512>_gt<mode>3<mask_scalar_merge_name>"
11280 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11281 (unspec:<avx512fmaskmode>
11282 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
11283 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")] UNSPEC_MASKED_GT))]
11285 "vpcmpgt<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11286 [(set_attr "type" "ssecmp")
11287 (set_attr "prefix_extra" "1")
11288 (set_attr "prefix" "evex")
11289 (set_attr "mode" "<sseinsnmode>")])
11291 (define_insn "sse2_gt<mode>3"
11292 [(set (match_operand:VI124_128 0 "register_operand" "=x,x")
11294 (match_operand:VI124_128 1 "register_operand" "0,x")
11295 (match_operand:VI124_128 2 "vector_operand" "xBm,xm")))]
11296 "TARGET_SSE2 && !TARGET_XOP"
11298 pcmpgt<ssemodesuffix>\t{%2, %0|%0, %2}
11299 vpcmpgt<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
11300 [(set_attr "isa" "noavx,avx")
11301 (set_attr "type" "ssecmp")
11302 (set_attr "prefix_data16" "1,*")
11303 (set_attr "prefix" "orig,vex")
11304 (set_attr "mode" "TI")])
11306 (define_expand "vcond<V_512:mode><VI_AVX512BW:mode>"
11307 [(set (match_operand:V_512 0 "register_operand")
11308 (if_then_else:V_512
11309 (match_operator 3 ""
11310 [(match_operand:VI_AVX512BW 4 "nonimmediate_operand")
11311 (match_operand:VI_AVX512BW 5 "general_operand")])
11312 (match_operand:V_512 1)
11313 (match_operand:V_512 2)))]
11315 && (GET_MODE_NUNITS (<V_512:MODE>mode)
11316 == GET_MODE_NUNITS (<VI_AVX512BW:MODE>mode))"
11318 bool ok = ix86_expand_int_vcond (operands);
11323 (define_expand "vcond<V_256:mode><VI_256:mode>"
11324 [(set (match_operand:V_256 0 "register_operand")
11325 (if_then_else:V_256
11326 (match_operator 3 ""
11327 [(match_operand:VI_256 4 "nonimmediate_operand")
11328 (match_operand:VI_256 5 "general_operand")])
11329 (match_operand:V_256 1)
11330 (match_operand:V_256 2)))]
11332 && (GET_MODE_NUNITS (<V_256:MODE>mode)
11333 == GET_MODE_NUNITS (<VI_256:MODE>mode))"
11335 bool ok = ix86_expand_int_vcond (operands);
11340 (define_expand "vcond<V_128:mode><VI124_128:mode>"
11341 [(set (match_operand:V_128 0 "register_operand")
11342 (if_then_else:V_128
11343 (match_operator 3 ""
11344 [(match_operand:VI124_128 4 "vector_operand")
11345 (match_operand:VI124_128 5 "general_operand")])
11346 (match_operand:V_128 1)
11347 (match_operand:V_128 2)))]
11349 && (GET_MODE_NUNITS (<V_128:MODE>mode)
11350 == GET_MODE_NUNITS (<VI124_128:MODE>mode))"
11352 bool ok = ix86_expand_int_vcond (operands);
11357 (define_expand "vcond<VI8F_128:mode>v2di"
11358 [(set (match_operand:VI8F_128 0 "register_operand")
11359 (if_then_else:VI8F_128
11360 (match_operator 3 ""
11361 [(match_operand:V2DI 4 "vector_operand")
11362 (match_operand:V2DI 5 "general_operand")])
11363 (match_operand:VI8F_128 1)
11364 (match_operand:VI8F_128 2)))]
11367 bool ok = ix86_expand_int_vcond (operands);
11372 (define_expand "vcondu<V_512:mode><VI_AVX512BW:mode>"
11373 [(set (match_operand:V_512 0 "register_operand")
11374 (if_then_else:V_512
11375 (match_operator 3 ""
11376 [(match_operand:VI_AVX512BW 4 "nonimmediate_operand")
11377 (match_operand:VI_AVX512BW 5 "nonimmediate_operand")])
11378 (match_operand:V_512 1 "general_operand")
11379 (match_operand:V_512 2 "general_operand")))]
11381 && (GET_MODE_NUNITS (<V_512:MODE>mode)
11382 == GET_MODE_NUNITS (<VI_AVX512BW:MODE>mode))"
11384 bool ok = ix86_expand_int_vcond (operands);
11389 (define_expand "vcondu<V_256:mode><VI_256:mode>"
11390 [(set (match_operand:V_256 0 "register_operand")
11391 (if_then_else:V_256
11392 (match_operator 3 ""
11393 [(match_operand:VI_256 4 "nonimmediate_operand")
11394 (match_operand:VI_256 5 "nonimmediate_operand")])
11395 (match_operand:V_256 1 "general_operand")
11396 (match_operand:V_256 2 "general_operand")))]
11398 && (GET_MODE_NUNITS (<V_256:MODE>mode)
11399 == GET_MODE_NUNITS (<VI_256:MODE>mode))"
11401 bool ok = ix86_expand_int_vcond (operands);
11406 (define_expand "vcondu<V_128:mode><VI124_128:mode>"
11407 [(set (match_operand:V_128 0 "register_operand")
11408 (if_then_else:V_128
11409 (match_operator 3 ""
11410 [(match_operand:VI124_128 4 "vector_operand")
11411 (match_operand:VI124_128 5 "vector_operand")])
11412 (match_operand:V_128 1 "general_operand")
11413 (match_operand:V_128 2 "general_operand")))]
11415 && (GET_MODE_NUNITS (<V_128:MODE>mode)
11416 == GET_MODE_NUNITS (<VI124_128:MODE>mode))"
11418 bool ok = ix86_expand_int_vcond (operands);
11423 (define_expand "vcondu<VI8F_128:mode>v2di"
11424 [(set (match_operand:VI8F_128 0 "register_operand")
11425 (if_then_else:VI8F_128
11426 (match_operator 3 ""
11427 [(match_operand:V2DI 4 "vector_operand")
11428 (match_operand:V2DI 5 "vector_operand")])
11429 (match_operand:VI8F_128 1 "general_operand")
11430 (match_operand:VI8F_128 2 "general_operand")))]
11433 bool ok = ix86_expand_int_vcond (operands);
11438 (define_expand "vcondeq<VI8F_128:mode>v2di"
11439 [(set (match_operand:VI8F_128 0 "register_operand")
11440 (if_then_else:VI8F_128
11441 (match_operator 3 ""
11442 [(match_operand:V2DI 4 "vector_operand")
11443 (match_operand:V2DI 5 "general_operand")])
11444 (match_operand:VI8F_128 1)
11445 (match_operand:VI8F_128 2)))]
11448 bool ok = ix86_expand_int_vcond (operands);
11453 (define_mode_iterator VEC_PERM_AVX2
11454 [V16QI V8HI V4SI V2DI V4SF V2DF
11455 (V32QI "TARGET_AVX2") (V16HI "TARGET_AVX2")
11456 (V8SI "TARGET_AVX2") (V4DI "TARGET_AVX2")
11457 (V8SF "TARGET_AVX2") (V4DF "TARGET_AVX2")
11458 (V16SF "TARGET_AVX512F") (V8DF "TARGET_AVX512F")
11459 (V16SI "TARGET_AVX512F") (V8DI "TARGET_AVX512F")
11460 (V32HI "TARGET_AVX512BW") (V64QI "TARGET_AVX512VBMI")])
11462 (define_expand "vec_perm<mode>"
11463 [(match_operand:VEC_PERM_AVX2 0 "register_operand")
11464 (match_operand:VEC_PERM_AVX2 1 "register_operand")
11465 (match_operand:VEC_PERM_AVX2 2 "register_operand")
11466 (match_operand:<sseintvecmode> 3 "register_operand")]
11467 "TARGET_SSSE3 || TARGET_AVX || TARGET_XOP"
11469 ix86_expand_vec_perm (operands);
11473 (define_mode_iterator VEC_PERM_CONST
11474 [(V4SF "TARGET_SSE") (V4SI "TARGET_SSE")
11475 (V2DF "TARGET_SSE") (V2DI "TARGET_SSE")
11476 (V16QI "TARGET_SSE2") (V8HI "TARGET_SSE2")
11477 (V8SF "TARGET_AVX") (V4DF "TARGET_AVX")
11478 (V8SI "TARGET_AVX") (V4DI "TARGET_AVX")
11479 (V32QI "TARGET_AVX2") (V16HI "TARGET_AVX2")
11480 (V16SI "TARGET_AVX512F") (V8DI "TARGET_AVX512F")
11481 (V16SF "TARGET_AVX512F") (V8DF "TARGET_AVX512F")
11482 (V32HI "TARGET_AVX512BW") (V64QI "TARGET_AVX512BW")])
11484 (define_expand "vec_perm_const<mode>"
11485 [(match_operand:VEC_PERM_CONST 0 "register_operand")
11486 (match_operand:VEC_PERM_CONST 1 "register_operand")
11487 (match_operand:VEC_PERM_CONST 2 "register_operand")
11488 (match_operand:<sseintvecmode> 3)]
11491 if (ix86_expand_vec_perm_const (operands))
11497 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11499 ;; Parallel bitwise logical operations
11501 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11503 (define_expand "one_cmpl<mode>2"
11504 [(set (match_operand:VI 0 "register_operand")
11505 (xor:VI (match_operand:VI 1 "vector_operand")
11509 operands[2] = force_reg (<MODE>mode, CONSTM1_RTX (<MODE>mode));
11512 (define_expand "<sse2_avx2>_andnot<mode>3"
11513 [(set (match_operand:VI_AVX2 0 "register_operand")
11515 (not:VI_AVX2 (match_operand:VI_AVX2 1 "register_operand"))
11516 (match_operand:VI_AVX2 2 "vector_operand")))]
11519 (define_expand "<sse2_avx2>_andnot<mode>3_mask"
11520 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
11521 (vec_merge:VI48_AVX512VL
11524 (match_operand:VI48_AVX512VL 1 "register_operand"))
11525 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand"))
11526 (match_operand:VI48_AVX512VL 3 "vector_move_operand")
11527 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
11530 (define_expand "<sse2_avx2>_andnot<mode>3_mask"
11531 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
11532 (vec_merge:VI12_AVX512VL
11535 (match_operand:VI12_AVX512VL 1 "register_operand"))
11536 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand"))
11537 (match_operand:VI12_AVX512VL 3 "vector_move_operand")
11538 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
11541 (define_insn "*andnot<mode>3"
11542 [(set (match_operand:VI 0 "register_operand" "=x,x,v")
11544 (not:VI (match_operand:VI 1 "register_operand" "0,x,v"))
11545 (match_operand:VI 2 "vector_operand" "xBm,xm,vm")))]
11548 static char buf[64];
11551 const char *ssesuffix;
11553 switch (get_attr_mode (insn))
11556 gcc_assert (TARGET_AVX512F);
11559 gcc_assert (TARGET_AVX2);
11562 gcc_assert (TARGET_SSE2);
11564 switch (<MODE>mode)
11568 /* There is no vpandnb or vpandnw instruction, nor vpandn for
11569 512-bit vectors. Use vpandnq instead. */
11574 ssesuffix = "<ssemodesuffix>";
11580 ssesuffix = (TARGET_AVX512VL && which_alternative == 2
11581 ? "<ssemodesuffix>" : "");
11584 ssesuffix = TARGET_AVX512VL && which_alternative == 2 ? "q" : "";
11589 gcc_assert (TARGET_AVX512F);
11592 gcc_assert (TARGET_AVX);
11595 gcc_assert (TARGET_SSE);
11601 gcc_unreachable ();
11604 switch (which_alternative)
11607 ops = "%s%s\t{%%2, %%0|%%0, %%2}";
11611 ops = "v%s%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
11614 gcc_unreachable ();
11617 snprintf (buf, sizeof (buf), ops, tmp, ssesuffix);
11620 [(set_attr "isa" "noavx,avx,avx")
11621 (set_attr "type" "sselog")
11622 (set (attr "prefix_data16")
11624 (and (eq_attr "alternative" "0")
11625 (eq_attr "mode" "TI"))
11627 (const_string "*")))
11628 (set_attr "prefix" "orig,vex,evex")
11630 (cond [(and (match_test "<MODE_SIZE> == 16")
11631 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
11632 (const_string "<ssePSmode>")
11633 (match_test "TARGET_AVX2")
11634 (const_string "<sseinsnmode>")
11635 (match_test "TARGET_AVX")
11637 (match_test "<MODE_SIZE> > 16")
11638 (const_string "V8SF")
11639 (const_string "<sseinsnmode>"))
11640 (ior (not (match_test "TARGET_SSE2"))
11641 (match_test "optimize_function_for_size_p (cfun)"))
11642 (const_string "V4SF")
11644 (const_string "<sseinsnmode>")))])
11646 (define_insn "*andnot<mode>3_mask"
11647 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
11648 (vec_merge:VI48_AVX512VL
11651 (match_operand:VI48_AVX512VL 1 "register_operand" "v"))
11652 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm"))
11653 (match_operand:VI48_AVX512VL 3 "vector_move_operand" "0C")
11654 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
11656 "vpandn<ssemodesuffix>\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}";
11657 [(set_attr "type" "sselog")
11658 (set_attr "prefix" "evex")
11659 (set_attr "mode" "<sseinsnmode>")])
11661 (define_expand "<code><mode>3"
11662 [(set (match_operand:VI 0 "register_operand")
11664 (match_operand:VI 1 "nonimmediate_or_const_vector_operand")
11665 (match_operand:VI 2 "nonimmediate_or_const_vector_operand")))]
11668 ix86_expand_vector_logical_operator (<CODE>, <MODE>mode, operands);
11672 (define_insn "<mask_codefor><code><mode>3<mask_name>"
11673 [(set (match_operand:VI48_AVX_AVX512F 0 "register_operand" "=x,x,v")
11674 (any_logic:VI48_AVX_AVX512F
11675 (match_operand:VI48_AVX_AVX512F 1 "vector_operand" "%0,x,v")
11676 (match_operand:VI48_AVX_AVX512F 2 "vector_operand" "xBm,xm,vm")))]
11677 "TARGET_SSE && <mask_mode512bit_condition>
11678 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11680 static char buf[64];
11683 const char *ssesuffix;
11685 switch (get_attr_mode (insn))
11688 gcc_assert (TARGET_AVX512F);
11691 gcc_assert (TARGET_AVX2);
11694 gcc_assert (TARGET_SSE2);
11696 switch (<MODE>mode)
11700 ssesuffix = "<ssemodesuffix>";
11706 ssesuffix = (TARGET_AVX512VL
11707 && (<mask_applied> || which_alternative == 2)
11708 ? "<ssemodesuffix>" : "");
11711 gcc_unreachable ();
11716 gcc_assert (TARGET_AVX);
11719 gcc_assert (TARGET_SSE);
11725 gcc_unreachable ();
11728 switch (which_alternative)
11731 if (<mask_applied>)
11732 ops = "v%s%s\t{%%2, %%0, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%0, %%2}";
11734 ops = "%s%s\t{%%2, %%0|%%0, %%2}";
11738 ops = "v%s%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
11741 gcc_unreachable ();
11744 snprintf (buf, sizeof (buf), ops, tmp, ssesuffix);
11747 [(set_attr "isa" "noavx,avx,avx")
11748 (set_attr "type" "sselog")
11749 (set (attr "prefix_data16")
11751 (and (eq_attr "alternative" "0")
11752 (eq_attr "mode" "TI"))
11754 (const_string "*")))
11755 (set_attr "prefix" "<mask_prefix3>,evex")
11757 (cond [(and (match_test "<MODE_SIZE> == 16")
11758 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
11759 (const_string "<ssePSmode>")
11760 (match_test "TARGET_AVX2")
11761 (const_string "<sseinsnmode>")
11762 (match_test "TARGET_AVX")
11764 (match_test "<MODE_SIZE> > 16")
11765 (const_string "V8SF")
11766 (const_string "<sseinsnmode>"))
11767 (ior (not (match_test "TARGET_SSE2"))
11768 (match_test "optimize_function_for_size_p (cfun)"))
11769 (const_string "V4SF")
11771 (const_string "<sseinsnmode>")))])
11773 (define_insn "*<code><mode>3"
11774 [(set (match_operand:VI12_AVX_AVX512F 0 "register_operand" "=x,x,v")
11775 (any_logic:VI12_AVX_AVX512F
11776 (match_operand:VI12_AVX_AVX512F 1 "vector_operand" "%0,x,v")
11777 (match_operand:VI12_AVX_AVX512F 2 "vector_operand" "xBm,xm,vm")))]
11778 "TARGET_SSE && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
11780 static char buf[64];
11783 const char *ssesuffix;
11785 switch (get_attr_mode (insn))
11788 gcc_assert (TARGET_AVX512F);
11791 gcc_assert (TARGET_AVX2);
11794 gcc_assert (TARGET_SSE2);
11796 switch (<MODE>mode)
11806 ssesuffix = TARGET_AVX512VL && which_alternative == 2 ? "q" : "";
11809 gcc_unreachable ();
11814 gcc_assert (TARGET_AVX);
11817 gcc_assert (TARGET_SSE);
11823 gcc_unreachable ();
11826 switch (which_alternative)
11829 ops = "%s%s\t{%%2, %%0|%%0, %%2}";
11833 ops = "v%s%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
11836 gcc_unreachable ();
11839 snprintf (buf, sizeof (buf), ops, tmp, ssesuffix);
11842 [(set_attr "isa" "noavx,avx,avx")
11843 (set_attr "type" "sselog")
11844 (set (attr "prefix_data16")
11846 (and (eq_attr "alternative" "0")
11847 (eq_attr "mode" "TI"))
11849 (const_string "*")))
11850 (set_attr "prefix" "<mask_prefix3>,evex")
11852 (cond [(and (match_test "<MODE_SIZE> == 16")
11853 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
11854 (const_string "<ssePSmode>")
11855 (match_test "TARGET_AVX2")
11856 (const_string "<sseinsnmode>")
11857 (match_test "TARGET_AVX")
11859 (match_test "<MODE_SIZE> > 16")
11860 (const_string "V8SF")
11861 (const_string "<sseinsnmode>"))
11862 (ior (not (match_test "TARGET_SSE2"))
11863 (match_test "optimize_function_for_size_p (cfun)"))
11864 (const_string "V4SF")
11866 (const_string "<sseinsnmode>")))])
11868 (define_insn "<avx512>_testm<mode>3<mask_scalar_merge_name>"
11869 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11870 (unspec:<avx512fmaskmode>
11871 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
11872 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")]
11875 "vptestm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11876 [(set_attr "prefix" "evex")
11877 (set_attr "mode" "<sseinsnmode>")])
11879 (define_insn "<avx512>_testm<mode>3<mask_scalar_merge_name>"
11880 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11881 (unspec:<avx512fmaskmode>
11882 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
11883 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")]
11886 "vptestm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11887 [(set_attr "prefix" "evex")
11888 (set_attr "mode" "<sseinsnmode>")])
11890 (define_insn "<avx512>_testnm<mode>3<mask_scalar_merge_name>"
11891 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11892 (unspec:<avx512fmaskmode>
11893 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
11894 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")]
11897 "vptestnm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11898 [(set_attr "prefix" "evex")
11899 (set_attr "mode" "<sseinsnmode>")])
11901 (define_insn "<avx512>_testnm<mode>3<mask_scalar_merge_name>"
11902 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11903 (unspec:<avx512fmaskmode>
11904 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
11905 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")]
11908 "vptestnm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11909 [(set_attr "prefix" "evex")
11910 (set_attr "mode" "<sseinsnmode>")])
11912 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11914 ;; Parallel integral element swizzling
11916 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11918 (define_expand "vec_pack_trunc_<mode>"
11919 [(match_operand:<ssepackmode> 0 "register_operand")
11920 (match_operand:VI248_AVX2_8_AVX512F_24_AVX512BW 1 "register_operand")
11921 (match_operand:VI248_AVX2_8_AVX512F_24_AVX512BW 2 "register_operand")]
11924 rtx op1 = gen_lowpart (<ssepackmode>mode, operands[1]);
11925 rtx op2 = gen_lowpart (<ssepackmode>mode, operands[2]);
11926 ix86_expand_vec_extract_even_odd (operands[0], op1, op2, 0);
11930 (define_expand "vec_pack_trunc_qi"
11931 [(set (match_operand:HI 0 ("register_operand"))
11932 (ior:HI (ashift:HI (zero_extend:HI (match_operand:QI 2 ("register_operand")))
11934 (zero_extend:HI (match_operand:QI 1 ("register_operand")))))]
11937 (define_expand "vec_pack_trunc_<mode>"
11938 [(set (match_operand:<DOUBLEMASKMODE> 0 ("register_operand"))
11939 (ior:<DOUBLEMASKMODE> (ashift:<DOUBLEMASKMODE> (zero_extend:<DOUBLEMASKMODE> (match_operand:SWI24 2 ("register_operand")))
11941 (zero_extend:<DOUBLEMASKMODE> (match_operand:SWI24 1 ("register_operand")))))]
11944 operands[3] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
11947 (define_insn "<sse2_avx2>_packsswb<mask_name>"
11948 [(set (match_operand:VI1_AVX512 0 "register_operand" "=x,x,v")
11949 (vec_concat:VI1_AVX512
11950 (ss_truncate:<ssehalfvecmode>
11951 (match_operand:<sseunpackmode> 1 "register_operand" "0,x,v"))
11952 (ss_truncate:<ssehalfvecmode>
11953 (match_operand:<sseunpackmode> 2 "vector_operand" "xBm,xm,vm"))))]
11954 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
11956 packsswb\t{%2, %0|%0, %2}
11957 vpacksswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
11958 vpacksswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11959 [(set_attr "isa" "noavx,avx,avx512bw")
11960 (set_attr "type" "sselog")
11961 (set_attr "prefix_data16" "1,*,*")
11962 (set_attr "prefix" "orig,<mask_prefix>,evex")
11963 (set_attr "mode" "<sseinsnmode>")])
11965 (define_insn "<sse2_avx2>_packssdw<mask_name>"
11966 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,x,v")
11967 (vec_concat:VI2_AVX2
11968 (ss_truncate:<ssehalfvecmode>
11969 (match_operand:<sseunpackmode> 1 "register_operand" "0,x,v"))
11970 (ss_truncate:<ssehalfvecmode>
11971 (match_operand:<sseunpackmode> 2 "vector_operand" "xBm,xm,vm"))))]
11972 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
11974 packssdw\t{%2, %0|%0, %2}
11975 vpackssdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
11976 vpackssdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11977 [(set_attr "isa" "noavx,avx,avx512bw")
11978 (set_attr "type" "sselog")
11979 (set_attr "prefix_data16" "1,*,*")
11980 (set_attr "prefix" "orig,<mask_prefix>,evex")
11981 (set_attr "mode" "<sseinsnmode>")])
11983 (define_insn "<sse2_avx2>_packuswb<mask_name>"
11984 [(set (match_operand:VI1_AVX512 0 "register_operand" "=x,x,v")
11985 (vec_concat:VI1_AVX512
11986 (us_truncate:<ssehalfvecmode>
11987 (match_operand:<sseunpackmode> 1 "register_operand" "0,x,v"))
11988 (us_truncate:<ssehalfvecmode>
11989 (match_operand:<sseunpackmode> 2 "vector_operand" "xBm,xm,vm"))))]
11990 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
11992 packuswb\t{%2, %0|%0, %2}
11993 vpackuswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
11994 vpackuswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11995 [(set_attr "isa" "noavx,avx,avx512bw")
11996 (set_attr "type" "sselog")
11997 (set_attr "prefix_data16" "1,*,*")
11998 (set_attr "prefix" "orig,<mask_prefix>,evex")
11999 (set_attr "mode" "<sseinsnmode>")])
12001 (define_insn "avx512bw_interleave_highv64qi<mask_name>"
12002 [(set (match_operand:V64QI 0 "register_operand" "=v")
12005 (match_operand:V64QI 1 "register_operand" "v")
12006 (match_operand:V64QI 2 "nonimmediate_operand" "vm"))
12007 (parallel [(const_int 8) (const_int 72)
12008 (const_int 9) (const_int 73)
12009 (const_int 10) (const_int 74)
12010 (const_int 11) (const_int 75)
12011 (const_int 12) (const_int 76)
12012 (const_int 13) (const_int 77)
12013 (const_int 14) (const_int 78)
12014 (const_int 15) (const_int 79)
12015 (const_int 24) (const_int 88)
12016 (const_int 25) (const_int 89)
12017 (const_int 26) (const_int 90)
12018 (const_int 27) (const_int 91)
12019 (const_int 28) (const_int 92)
12020 (const_int 29) (const_int 93)
12021 (const_int 30) (const_int 94)
12022 (const_int 31) (const_int 95)
12023 (const_int 40) (const_int 104)
12024 (const_int 41) (const_int 105)
12025 (const_int 42) (const_int 106)
12026 (const_int 43) (const_int 107)
12027 (const_int 44) (const_int 108)
12028 (const_int 45) (const_int 109)
12029 (const_int 46) (const_int 110)
12030 (const_int 47) (const_int 111)
12031 (const_int 56) (const_int 120)
12032 (const_int 57) (const_int 121)
12033 (const_int 58) (const_int 122)
12034 (const_int 59) (const_int 123)
12035 (const_int 60) (const_int 124)
12036 (const_int 61) (const_int 125)
12037 (const_int 62) (const_int 126)
12038 (const_int 63) (const_int 127)])))]
12040 "vpunpckhbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12041 [(set_attr "type" "sselog")
12042 (set_attr "prefix" "evex")
12043 (set_attr "mode" "XI")])
12045 (define_insn "avx2_interleave_highv32qi<mask_name>"
12046 [(set (match_operand:V32QI 0 "register_operand" "=v")
12049 (match_operand:V32QI 1 "register_operand" "v")
12050 (match_operand:V32QI 2 "nonimmediate_operand" "vm"))
12051 (parallel [(const_int 8) (const_int 40)
12052 (const_int 9) (const_int 41)
12053 (const_int 10) (const_int 42)
12054 (const_int 11) (const_int 43)
12055 (const_int 12) (const_int 44)
12056 (const_int 13) (const_int 45)
12057 (const_int 14) (const_int 46)
12058 (const_int 15) (const_int 47)
12059 (const_int 24) (const_int 56)
12060 (const_int 25) (const_int 57)
12061 (const_int 26) (const_int 58)
12062 (const_int 27) (const_int 59)
12063 (const_int 28) (const_int 60)
12064 (const_int 29) (const_int 61)
12065 (const_int 30) (const_int 62)
12066 (const_int 31) (const_int 63)])))]
12067 "TARGET_AVX2 && <mask_avx512vl_condition>"
12068 "vpunpckhbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12069 [(set_attr "type" "sselog")
12070 (set_attr "prefix" "<mask_prefix>")
12071 (set_attr "mode" "OI")])
12073 (define_insn "vec_interleave_highv16qi<mask_name>"
12074 [(set (match_operand:V16QI 0 "register_operand" "=x,v")
12077 (match_operand:V16QI 1 "register_operand" "0,v")
12078 (match_operand:V16QI 2 "vector_operand" "xBm,vm"))
12079 (parallel [(const_int 8) (const_int 24)
12080 (const_int 9) (const_int 25)
12081 (const_int 10) (const_int 26)
12082 (const_int 11) (const_int 27)
12083 (const_int 12) (const_int 28)
12084 (const_int 13) (const_int 29)
12085 (const_int 14) (const_int 30)
12086 (const_int 15) (const_int 31)])))]
12087 "TARGET_SSE2 && <mask_avx512vl_condition>"
12089 punpckhbw\t{%2, %0|%0, %2}
12090 vpunpckhbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12091 [(set_attr "isa" "noavx,avx")
12092 (set_attr "type" "sselog")
12093 (set_attr "prefix_data16" "1,*")
12094 (set_attr "prefix" "orig,<mask_prefix>")
12095 (set_attr "mode" "TI")])
12097 (define_insn "avx512bw_interleave_lowv64qi<mask_name>"
12098 [(set (match_operand:V64QI 0 "register_operand" "=v")
12101 (match_operand:V64QI 1 "register_operand" "v")
12102 (match_operand:V64QI 2 "nonimmediate_operand" "vm"))
12103 (parallel [(const_int 0) (const_int 64)
12104 (const_int 1) (const_int 65)
12105 (const_int 2) (const_int 66)
12106 (const_int 3) (const_int 67)
12107 (const_int 4) (const_int 68)
12108 (const_int 5) (const_int 69)
12109 (const_int 6) (const_int 70)
12110 (const_int 7) (const_int 71)
12111 (const_int 16) (const_int 80)
12112 (const_int 17) (const_int 81)
12113 (const_int 18) (const_int 82)
12114 (const_int 19) (const_int 83)
12115 (const_int 20) (const_int 84)
12116 (const_int 21) (const_int 85)
12117 (const_int 22) (const_int 86)
12118 (const_int 23) (const_int 87)
12119 (const_int 32) (const_int 96)
12120 (const_int 33) (const_int 97)
12121 (const_int 34) (const_int 98)
12122 (const_int 35) (const_int 99)
12123 (const_int 36) (const_int 100)
12124 (const_int 37) (const_int 101)
12125 (const_int 38) (const_int 102)
12126 (const_int 39) (const_int 103)
12127 (const_int 48) (const_int 112)
12128 (const_int 49) (const_int 113)
12129 (const_int 50) (const_int 114)
12130 (const_int 51) (const_int 115)
12131 (const_int 52) (const_int 116)
12132 (const_int 53) (const_int 117)
12133 (const_int 54) (const_int 118)
12134 (const_int 55) (const_int 119)])))]
12136 "vpunpcklbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12137 [(set_attr "type" "sselog")
12138 (set_attr "prefix" "evex")
12139 (set_attr "mode" "XI")])
12141 (define_insn "avx2_interleave_lowv32qi<mask_name>"
12142 [(set (match_operand:V32QI 0 "register_operand" "=v")
12145 (match_operand:V32QI 1 "register_operand" "v")
12146 (match_operand:V32QI 2 "nonimmediate_operand" "vm"))
12147 (parallel [(const_int 0) (const_int 32)
12148 (const_int 1) (const_int 33)
12149 (const_int 2) (const_int 34)
12150 (const_int 3) (const_int 35)
12151 (const_int 4) (const_int 36)
12152 (const_int 5) (const_int 37)
12153 (const_int 6) (const_int 38)
12154 (const_int 7) (const_int 39)
12155 (const_int 16) (const_int 48)
12156 (const_int 17) (const_int 49)
12157 (const_int 18) (const_int 50)
12158 (const_int 19) (const_int 51)
12159 (const_int 20) (const_int 52)
12160 (const_int 21) (const_int 53)
12161 (const_int 22) (const_int 54)
12162 (const_int 23) (const_int 55)])))]
12163 "TARGET_AVX2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12164 "vpunpcklbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12165 [(set_attr "type" "sselog")
12166 (set_attr "prefix" "maybe_vex")
12167 (set_attr "mode" "OI")])
12169 (define_insn "vec_interleave_lowv16qi<mask_name>"
12170 [(set (match_operand:V16QI 0 "register_operand" "=x,v")
12173 (match_operand:V16QI 1 "register_operand" "0,v")
12174 (match_operand:V16QI 2 "vector_operand" "xBm,vm"))
12175 (parallel [(const_int 0) (const_int 16)
12176 (const_int 1) (const_int 17)
12177 (const_int 2) (const_int 18)
12178 (const_int 3) (const_int 19)
12179 (const_int 4) (const_int 20)
12180 (const_int 5) (const_int 21)
12181 (const_int 6) (const_int 22)
12182 (const_int 7) (const_int 23)])))]
12183 "TARGET_SSE2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12185 punpcklbw\t{%2, %0|%0, %2}
12186 vpunpcklbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12187 [(set_attr "isa" "noavx,avx")
12188 (set_attr "type" "sselog")
12189 (set_attr "prefix_data16" "1,*")
12190 (set_attr "prefix" "orig,vex")
12191 (set_attr "mode" "TI")])
12193 (define_insn "avx512bw_interleave_highv32hi<mask_name>"
12194 [(set (match_operand:V32HI 0 "register_operand" "=v")
12197 (match_operand:V32HI 1 "register_operand" "v")
12198 (match_operand:V32HI 2 "nonimmediate_operand" "vm"))
12199 (parallel [(const_int 4) (const_int 36)
12200 (const_int 5) (const_int 37)
12201 (const_int 6) (const_int 38)
12202 (const_int 7) (const_int 39)
12203 (const_int 12) (const_int 44)
12204 (const_int 13) (const_int 45)
12205 (const_int 14) (const_int 46)
12206 (const_int 15) (const_int 47)
12207 (const_int 20) (const_int 52)
12208 (const_int 21) (const_int 53)
12209 (const_int 22) (const_int 54)
12210 (const_int 23) (const_int 55)
12211 (const_int 28) (const_int 60)
12212 (const_int 29) (const_int 61)
12213 (const_int 30) (const_int 62)
12214 (const_int 31) (const_int 63)])))]
12216 "vpunpckhwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12217 [(set_attr "type" "sselog")
12218 (set_attr "prefix" "evex")
12219 (set_attr "mode" "XI")])
12221 (define_insn "avx2_interleave_highv16hi<mask_name>"
12222 [(set (match_operand:V16HI 0 "register_operand" "=v")
12225 (match_operand:V16HI 1 "register_operand" "v")
12226 (match_operand:V16HI 2 "nonimmediate_operand" "vm"))
12227 (parallel [(const_int 4) (const_int 20)
12228 (const_int 5) (const_int 21)
12229 (const_int 6) (const_int 22)
12230 (const_int 7) (const_int 23)
12231 (const_int 12) (const_int 28)
12232 (const_int 13) (const_int 29)
12233 (const_int 14) (const_int 30)
12234 (const_int 15) (const_int 31)])))]
12235 "TARGET_AVX2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12236 "vpunpckhwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12237 [(set_attr "type" "sselog")
12238 (set_attr "prefix" "maybe_evex")
12239 (set_attr "mode" "OI")])
12241 (define_insn "vec_interleave_highv8hi<mask_name>"
12242 [(set (match_operand:V8HI 0 "register_operand" "=x,v")
12245 (match_operand:V8HI 1 "register_operand" "0,v")
12246 (match_operand:V8HI 2 "vector_operand" "xBm,vm"))
12247 (parallel [(const_int 4) (const_int 12)
12248 (const_int 5) (const_int 13)
12249 (const_int 6) (const_int 14)
12250 (const_int 7) (const_int 15)])))]
12251 "TARGET_SSE2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12253 punpckhwd\t{%2, %0|%0, %2}
12254 vpunpckhwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12255 [(set_attr "isa" "noavx,avx")
12256 (set_attr "type" "sselog")
12257 (set_attr "prefix_data16" "1,*")
12258 (set_attr "prefix" "orig,maybe_vex")
12259 (set_attr "mode" "TI")])
12261 (define_insn "<mask_codefor>avx512bw_interleave_lowv32hi<mask_name>"
12262 [(set (match_operand:V32HI 0 "register_operand" "=v")
12265 (match_operand:V32HI 1 "register_operand" "v")
12266 (match_operand:V32HI 2 "nonimmediate_operand" "vm"))
12267 (parallel [(const_int 0) (const_int 32)
12268 (const_int 1) (const_int 33)
12269 (const_int 2) (const_int 34)
12270 (const_int 3) (const_int 35)
12271 (const_int 8) (const_int 40)
12272 (const_int 9) (const_int 41)
12273 (const_int 10) (const_int 42)
12274 (const_int 11) (const_int 43)
12275 (const_int 16) (const_int 48)
12276 (const_int 17) (const_int 49)
12277 (const_int 18) (const_int 50)
12278 (const_int 19) (const_int 51)
12279 (const_int 24) (const_int 56)
12280 (const_int 25) (const_int 57)
12281 (const_int 26) (const_int 58)
12282 (const_int 27) (const_int 59)])))]
12284 "vpunpcklwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12285 [(set_attr "type" "sselog")
12286 (set_attr "prefix" "evex")
12287 (set_attr "mode" "XI")])
12289 (define_insn "avx2_interleave_lowv16hi<mask_name>"
12290 [(set (match_operand:V16HI 0 "register_operand" "=v")
12293 (match_operand:V16HI 1 "register_operand" "v")
12294 (match_operand:V16HI 2 "nonimmediate_operand" "vm"))
12295 (parallel [(const_int 0) (const_int 16)
12296 (const_int 1) (const_int 17)
12297 (const_int 2) (const_int 18)
12298 (const_int 3) (const_int 19)
12299 (const_int 8) (const_int 24)
12300 (const_int 9) (const_int 25)
12301 (const_int 10) (const_int 26)
12302 (const_int 11) (const_int 27)])))]
12303 "TARGET_AVX2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12304 "vpunpcklwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12305 [(set_attr "type" "sselog")
12306 (set_attr "prefix" "maybe_evex")
12307 (set_attr "mode" "OI")])
12309 (define_insn "vec_interleave_lowv8hi<mask_name>"
12310 [(set (match_operand:V8HI 0 "register_operand" "=x,v")
12313 (match_operand:V8HI 1 "register_operand" "0,v")
12314 (match_operand:V8HI 2 "vector_operand" "xBm,vm"))
12315 (parallel [(const_int 0) (const_int 8)
12316 (const_int 1) (const_int 9)
12317 (const_int 2) (const_int 10)
12318 (const_int 3) (const_int 11)])))]
12319 "TARGET_SSE2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
12321 punpcklwd\t{%2, %0|%0, %2}
12322 vpunpcklwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12323 [(set_attr "isa" "noavx,avx")
12324 (set_attr "type" "sselog")
12325 (set_attr "prefix_data16" "1,*")
12326 (set_attr "prefix" "orig,maybe_evex")
12327 (set_attr "mode" "TI")])
12329 (define_insn "avx2_interleave_highv8si<mask_name>"
12330 [(set (match_operand:V8SI 0 "register_operand" "=v")
12333 (match_operand:V8SI 1 "register_operand" "v")
12334 (match_operand:V8SI 2 "nonimmediate_operand" "vm"))
12335 (parallel [(const_int 2) (const_int 10)
12336 (const_int 3) (const_int 11)
12337 (const_int 6) (const_int 14)
12338 (const_int 7) (const_int 15)])))]
12339 "TARGET_AVX2 && <mask_avx512vl_condition>"
12340 "vpunpckhdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12341 [(set_attr "type" "sselog")
12342 (set_attr "prefix" "maybe_evex")
12343 (set_attr "mode" "OI")])
12345 (define_insn "<mask_codefor>avx512f_interleave_highv16si<mask_name>"
12346 [(set (match_operand:V16SI 0 "register_operand" "=v")
12349 (match_operand:V16SI 1 "register_operand" "v")
12350 (match_operand:V16SI 2 "nonimmediate_operand" "vm"))
12351 (parallel [(const_int 2) (const_int 18)
12352 (const_int 3) (const_int 19)
12353 (const_int 6) (const_int 22)
12354 (const_int 7) (const_int 23)
12355 (const_int 10) (const_int 26)
12356 (const_int 11) (const_int 27)
12357 (const_int 14) (const_int 30)
12358 (const_int 15) (const_int 31)])))]
12360 "vpunpckhdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12361 [(set_attr "type" "sselog")
12362 (set_attr "prefix" "evex")
12363 (set_attr "mode" "XI")])
12366 (define_insn "vec_interleave_highv4si<mask_name>"
12367 [(set (match_operand:V4SI 0 "register_operand" "=x,v")
12370 (match_operand:V4SI 1 "register_operand" "0,v")
12371 (match_operand:V4SI 2 "vector_operand" "xBm,vm"))
12372 (parallel [(const_int 2) (const_int 6)
12373 (const_int 3) (const_int 7)])))]
12374 "TARGET_SSE2 && <mask_avx512vl_condition>"
12376 punpckhdq\t{%2, %0|%0, %2}
12377 vpunpckhdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12378 [(set_attr "isa" "noavx,avx")
12379 (set_attr "type" "sselog")
12380 (set_attr "prefix_data16" "1,*")
12381 (set_attr "prefix" "orig,maybe_vex")
12382 (set_attr "mode" "TI")])
12384 (define_insn "avx2_interleave_lowv8si<mask_name>"
12385 [(set (match_operand:V8SI 0 "register_operand" "=v")
12388 (match_operand:V8SI 1 "register_operand" "v")
12389 (match_operand:V8SI 2 "nonimmediate_operand" "vm"))
12390 (parallel [(const_int 0) (const_int 8)
12391 (const_int 1) (const_int 9)
12392 (const_int 4) (const_int 12)
12393 (const_int 5) (const_int 13)])))]
12394 "TARGET_AVX2 && <mask_avx512vl_condition>"
12395 "vpunpckldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12396 [(set_attr "type" "sselog")
12397 (set_attr "prefix" "maybe_evex")
12398 (set_attr "mode" "OI")])
12400 (define_insn "<mask_codefor>avx512f_interleave_lowv16si<mask_name>"
12401 [(set (match_operand:V16SI 0 "register_operand" "=v")
12404 (match_operand:V16SI 1 "register_operand" "v")
12405 (match_operand:V16SI 2 "nonimmediate_operand" "vm"))
12406 (parallel [(const_int 0) (const_int 16)
12407 (const_int 1) (const_int 17)
12408 (const_int 4) (const_int 20)
12409 (const_int 5) (const_int 21)
12410 (const_int 8) (const_int 24)
12411 (const_int 9) (const_int 25)
12412 (const_int 12) (const_int 28)
12413 (const_int 13) (const_int 29)])))]
12415 "vpunpckldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12416 [(set_attr "type" "sselog")
12417 (set_attr "prefix" "evex")
12418 (set_attr "mode" "XI")])
12420 (define_insn "vec_interleave_lowv4si<mask_name>"
12421 [(set (match_operand:V4SI 0 "register_operand" "=x,v")
12424 (match_operand:V4SI 1 "register_operand" "0,v")
12425 (match_operand:V4SI 2 "vector_operand" "xBm,vm"))
12426 (parallel [(const_int 0) (const_int 4)
12427 (const_int 1) (const_int 5)])))]
12428 "TARGET_SSE2 && <mask_avx512vl_condition>"
12430 punpckldq\t{%2, %0|%0, %2}
12431 vpunpckldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12432 [(set_attr "isa" "noavx,avx")
12433 (set_attr "type" "sselog")
12434 (set_attr "prefix_data16" "1,*")
12435 (set_attr "prefix" "orig,vex")
12436 (set_attr "mode" "TI")])
12438 (define_expand "vec_interleave_high<mode>"
12439 [(match_operand:VI_256 0 "register_operand")
12440 (match_operand:VI_256 1 "register_operand")
12441 (match_operand:VI_256 2 "nonimmediate_operand")]
12444 rtx t1 = gen_reg_rtx (<MODE>mode);
12445 rtx t2 = gen_reg_rtx (<MODE>mode);
12446 rtx t3 = gen_reg_rtx (V4DImode);
12447 emit_insn (gen_avx2_interleave_low<mode> (t1, operands[1], operands[2]));
12448 emit_insn (gen_avx2_interleave_high<mode> (t2, operands[1], operands[2]));
12449 emit_insn (gen_avx2_permv2ti (t3, gen_lowpart (V4DImode, t1),
12450 gen_lowpart (V4DImode, t2),
12451 GEN_INT (1 + (3 << 4))));
12452 emit_move_insn (operands[0], gen_lowpart (<MODE>mode, t3));
12456 (define_expand "vec_interleave_low<mode>"
12457 [(match_operand:VI_256 0 "register_operand")
12458 (match_operand:VI_256 1 "register_operand")
12459 (match_operand:VI_256 2 "nonimmediate_operand")]
12462 rtx t1 = gen_reg_rtx (<MODE>mode);
12463 rtx t2 = gen_reg_rtx (<MODE>mode);
12464 rtx t3 = gen_reg_rtx (V4DImode);
12465 emit_insn (gen_avx2_interleave_low<mode> (t1, operands[1], operands[2]));
12466 emit_insn (gen_avx2_interleave_high<mode> (t2, operands[1], operands[2]));
12467 emit_insn (gen_avx2_permv2ti (t3, gen_lowpart (V4DImode, t1),
12468 gen_lowpart (V4DImode, t2),
12469 GEN_INT (0 + (2 << 4))));
12470 emit_move_insn (operands[0], gen_lowpart (<MODE>mode, t3));
12474 ;; Modes handled by pinsr patterns.
12475 (define_mode_iterator PINSR_MODE
12476 [(V16QI "TARGET_SSE4_1") V8HI
12477 (V4SI "TARGET_SSE4_1")
12478 (V2DI "TARGET_SSE4_1 && TARGET_64BIT")])
12480 (define_mode_attr sse2p4_1
12481 [(V16QI "sse4_1") (V8HI "sse2")
12482 (V4SI "sse4_1") (V2DI "sse4_1")])
12484 (define_mode_attr pinsr_evex_isa
12485 [(V16QI "avx512bw") (V8HI "avx512bw")
12486 (V4SI "avx512dq") (V2DI "avx512dq")])
12488 ;; sse4_1_pinsrd must come before sse2_loadld since it is preferred.
12489 (define_insn "<sse2p4_1>_pinsr<ssemodesuffix>"
12490 [(set (match_operand:PINSR_MODE 0 "register_operand" "=x,x,x,x,v,v")
12491 (vec_merge:PINSR_MODE
12492 (vec_duplicate:PINSR_MODE
12493 (match_operand:<ssescalarmode> 2 "nonimmediate_operand" "r,m,r,m,r,m"))
12494 (match_operand:PINSR_MODE 1 "register_operand" "0,0,x,x,v,v")
12495 (match_operand:SI 3 "const_int_operand")))]
12497 && ((unsigned) exact_log2 (INTVAL (operands[3]))
12498 < GET_MODE_NUNITS (<MODE>mode))"
12500 operands[3] = GEN_INT (exact_log2 (INTVAL (operands[3])));
12502 switch (which_alternative)
12505 if (GET_MODE_SIZE (<ssescalarmode>mode) < GET_MODE_SIZE (SImode))
12506 return "pinsr<ssemodesuffix>\t{%3, %k2, %0|%0, %k2, %3}";
12509 return "pinsr<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}";
12512 if (GET_MODE_SIZE (<ssescalarmode>mode) < GET_MODE_SIZE (SImode))
12513 return "vpinsr<ssemodesuffix>\t{%3, %k2, %1, %0|%0, %1, %k2, %3}";
12517 return "vpinsr<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}";
12519 gcc_unreachable ();
12522 [(set_attr "isa" "noavx,noavx,avx,avx,<pinsr_evex_isa>,<pinsr_evex_isa>")
12523 (set_attr "type" "sselog")
12524 (set (attr "prefix_rex")
12526 (and (not (match_test "TARGET_AVX"))
12527 (eq (const_string "<MODE>mode") (const_string "V2DImode")))
12529 (const_string "*")))
12530 (set (attr "prefix_data16")
12532 (and (not (match_test "TARGET_AVX"))
12533 (eq (const_string "<MODE>mode") (const_string "V8HImode")))
12535 (const_string "*")))
12536 (set (attr "prefix_extra")
12538 (and (not (match_test "TARGET_AVX"))
12539 (eq (const_string "<MODE>mode") (const_string "V8HImode")))
12541 (const_string "1")))
12542 (set_attr "length_immediate" "1")
12543 (set_attr "prefix" "orig,orig,vex,vex,evex,evex")
12544 (set_attr "mode" "TI")])
12546 (define_expand "<extract_type>_vinsert<shuffletype><extract_suf>_mask"
12547 [(match_operand:AVX512_VEC 0 "register_operand")
12548 (match_operand:AVX512_VEC 1 "register_operand")
12549 (match_operand:<ssequartermode> 2 "nonimmediate_operand")
12550 (match_operand:SI 3 "const_0_to_3_operand")
12551 (match_operand:AVX512_VEC 4 "register_operand")
12552 (match_operand:<avx512fmaskmode> 5 "register_operand")]
12556 mask = INTVAL (operands[3]);
12557 selector = GET_MODE_UNIT_SIZE (<MODE>mode) == 4 ?
12558 0xFFFF ^ (0xF000 >> mask * 4)
12559 : 0xFF ^ (0xC0 >> mask * 2);
12560 emit_insn (gen_<extract_type>_vinsert<shuffletype><extract_suf>_1_mask
12561 (operands[0], operands[1], operands[2], GEN_INT (selector),
12562 operands[4], operands[5]));
12566 (define_insn "<mask_codefor><extract_type>_vinsert<shuffletype><extract_suf>_1<mask_name>"
12567 [(set (match_operand:AVX512_VEC 0 "register_operand" "=v")
12568 (vec_merge:AVX512_VEC
12569 (match_operand:AVX512_VEC 1 "register_operand" "v")
12570 (vec_duplicate:AVX512_VEC
12571 (match_operand:<ssequartermode> 2 "nonimmediate_operand" "vm"))
12572 (match_operand:SI 3 "const_int_operand" "n")))]
12576 int selector = INTVAL (operands[3]);
12578 if (selector == 0xFFF || selector == 0x3F)
12580 else if ( selector == 0xF0FF || selector == 0xCF)
12582 else if ( selector == 0xFF0F || selector == 0xF3)
12584 else if ( selector == 0xFFF0 || selector == 0xFC)
12587 gcc_unreachable ();
12589 operands[3] = GEN_INT (mask);
12591 return "vinsert<shuffletype><extract_suf>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3}";
12593 [(set_attr "type" "sselog")
12594 (set_attr "length_immediate" "1")
12595 (set_attr "prefix" "evex")
12596 (set_attr "mode" "<sseinsnmode>")])
12598 (define_expand "<extract_type_2>_vinsert<shuffletype><extract_suf_2>_mask"
12599 [(match_operand:AVX512_VEC_2 0 "register_operand")
12600 (match_operand:AVX512_VEC_2 1 "register_operand")
12601 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand")
12602 (match_operand:SI 3 "const_0_to_1_operand")
12603 (match_operand:AVX512_VEC_2 4 "register_operand")
12604 (match_operand:<avx512fmaskmode> 5 "register_operand")]
12607 int mask = INTVAL (operands[3]);
12609 emit_insn (gen_vec_set_lo_<mode>_mask (operands[0], operands[1],
12610 operands[2], operands[4],
12613 emit_insn (gen_vec_set_hi_<mode>_mask (operands[0], operands[1],
12614 operands[2], operands[4],
12619 (define_insn "vec_set_lo_<mode><mask_name>"
12620 [(set (match_operand:V16FI 0 "register_operand" "=v")
12622 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
12623 (vec_select:<ssehalfvecmode>
12624 (match_operand:V16FI 1 "register_operand" "v")
12625 (parallel [(const_int 8) (const_int 9)
12626 (const_int 10) (const_int 11)
12627 (const_int 12) (const_int 13)
12628 (const_int 14) (const_int 15)]))))]
12630 "vinsert<shuffletype>32x8\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}"
12631 [(set_attr "type" "sselog")
12632 (set_attr "length_immediate" "1")
12633 (set_attr "prefix" "evex")
12634 (set_attr "mode" "<sseinsnmode>")])
12636 (define_insn "vec_set_hi_<mode><mask_name>"
12637 [(set (match_operand:V16FI 0 "register_operand" "=v")
12639 (vec_select:<ssehalfvecmode>
12640 (match_operand:V16FI 1 "register_operand" "v")
12641 (parallel [(const_int 0) (const_int 1)
12642 (const_int 2) (const_int 3)
12643 (const_int 4) (const_int 5)
12644 (const_int 6) (const_int 7)]))
12645 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
12647 "vinsert<shuffletype>32x8\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}"
12648 [(set_attr "type" "sselog")
12649 (set_attr "length_immediate" "1")
12650 (set_attr "prefix" "evex")
12651 (set_attr "mode" "<sseinsnmode>")])
12653 (define_insn "vec_set_lo_<mode><mask_name>"
12654 [(set (match_operand:V8FI 0 "register_operand" "=v")
12656 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
12657 (vec_select:<ssehalfvecmode>
12658 (match_operand:V8FI 1 "register_operand" "v")
12659 (parallel [(const_int 4) (const_int 5)
12660 (const_int 6) (const_int 7)]))))]
12662 "vinsert<shuffletype>64x4\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}"
12663 [(set_attr "type" "sselog")
12664 (set_attr "length_immediate" "1")
12665 (set_attr "prefix" "evex")
12666 (set_attr "mode" "XI")])
12668 (define_insn "vec_set_hi_<mode><mask_name>"
12669 [(set (match_operand:V8FI 0 "register_operand" "=v")
12671 (vec_select:<ssehalfvecmode>
12672 (match_operand:V8FI 1 "register_operand" "v")
12673 (parallel [(const_int 0) (const_int 1)
12674 (const_int 2) (const_int 3)]))
12675 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
12677 "vinsert<shuffletype>64x4\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}"
12678 [(set_attr "type" "sselog")
12679 (set_attr "length_immediate" "1")
12680 (set_attr "prefix" "evex")
12681 (set_attr "mode" "XI")])
12683 (define_expand "avx512dq_shuf_<shuffletype>64x2_mask"
12684 [(match_operand:VI8F_256 0 "register_operand")
12685 (match_operand:VI8F_256 1 "register_operand")
12686 (match_operand:VI8F_256 2 "nonimmediate_operand")
12687 (match_operand:SI 3 "const_0_to_3_operand")
12688 (match_operand:VI8F_256 4 "register_operand")
12689 (match_operand:QI 5 "register_operand")]
12692 int mask = INTVAL (operands[3]);
12693 emit_insn (gen_avx512dq_shuf_<shuffletype>64x2_1_mask
12694 (operands[0], operands[1], operands[2],
12695 GEN_INT (((mask >> 0) & 1) * 2 + 0),
12696 GEN_INT (((mask >> 0) & 1) * 2 + 1),
12697 GEN_INT (((mask >> 1) & 1) * 2 + 4),
12698 GEN_INT (((mask >> 1) & 1) * 2 + 5),
12699 operands[4], operands[5]));
12703 (define_insn "<mask_codefor>avx512dq_shuf_<shuffletype>64x2_1<mask_name>"
12704 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
12705 (vec_select:VI8F_256
12706 (vec_concat:<ssedoublemode>
12707 (match_operand:VI8F_256 1 "register_operand" "v")
12708 (match_operand:VI8F_256 2 "nonimmediate_operand" "vm"))
12709 (parallel [(match_operand 3 "const_0_to_3_operand")
12710 (match_operand 4 "const_0_to_3_operand")
12711 (match_operand 5 "const_4_to_7_operand")
12712 (match_operand 6 "const_4_to_7_operand")])))]
12714 && (INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
12715 && INTVAL (operands[5]) == (INTVAL (operands[6]) - 1))"
12718 mask = INTVAL (operands[3]) / 2;
12719 mask |= (INTVAL (operands[5]) - 4) / 2 << 1;
12720 operands[3] = GEN_INT (mask);
12721 return "vshuf<shuffletype>64x2\t{%3, %2, %1, %0<mask_operand7>|%0<mask_operand7>, %1, %2, %3}";
12723 [(set_attr "type" "sselog")
12724 (set_attr "length_immediate" "1")
12725 (set_attr "prefix" "evex")
12726 (set_attr "mode" "XI")])
12728 (define_expand "avx512f_shuf_<shuffletype>64x2_mask"
12729 [(match_operand:V8FI 0 "register_operand")
12730 (match_operand:V8FI 1 "register_operand")
12731 (match_operand:V8FI 2 "nonimmediate_operand")
12732 (match_operand:SI 3 "const_0_to_255_operand")
12733 (match_operand:V8FI 4 "register_operand")
12734 (match_operand:QI 5 "register_operand")]
12737 int mask = INTVAL (operands[3]);
12738 emit_insn (gen_avx512f_shuf_<shuffletype>64x2_1_mask
12739 (operands[0], operands[1], operands[2],
12740 GEN_INT (((mask >> 0) & 3) * 2),
12741 GEN_INT (((mask >> 0) & 3) * 2 + 1),
12742 GEN_INT (((mask >> 2) & 3) * 2),
12743 GEN_INT (((mask >> 2) & 3) * 2 + 1),
12744 GEN_INT (((mask >> 4) & 3) * 2 + 8),
12745 GEN_INT (((mask >> 4) & 3) * 2 + 9),
12746 GEN_INT (((mask >> 6) & 3) * 2 + 8),
12747 GEN_INT (((mask >> 6) & 3) * 2 + 9),
12748 operands[4], operands[5]));
12752 (define_insn "avx512f_shuf_<shuffletype>64x2_1<mask_name>"
12753 [(set (match_operand:V8FI 0 "register_operand" "=v")
12755 (vec_concat:<ssedoublemode>
12756 (match_operand:V8FI 1 "register_operand" "v")
12757 (match_operand:V8FI 2 "nonimmediate_operand" "vm"))
12758 (parallel [(match_operand 3 "const_0_to_7_operand")
12759 (match_operand 4 "const_0_to_7_operand")
12760 (match_operand 5 "const_0_to_7_operand")
12761 (match_operand 6 "const_0_to_7_operand")
12762 (match_operand 7 "const_8_to_15_operand")
12763 (match_operand 8 "const_8_to_15_operand")
12764 (match_operand 9 "const_8_to_15_operand")
12765 (match_operand 10 "const_8_to_15_operand")])))]
12767 && (INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
12768 && INTVAL (operands[5]) == (INTVAL (operands[6]) - 1)
12769 && INTVAL (operands[7]) == (INTVAL (operands[8]) - 1)
12770 && INTVAL (operands[9]) == (INTVAL (operands[10]) - 1))"
12773 mask = INTVAL (operands[3]) / 2;
12774 mask |= INTVAL (operands[5]) / 2 << 2;
12775 mask |= (INTVAL (operands[7]) - 8) / 2 << 4;
12776 mask |= (INTVAL (operands[9]) - 8) / 2 << 6;
12777 operands[3] = GEN_INT (mask);
12779 return "vshuf<shuffletype>64x2\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
12781 [(set_attr "type" "sselog")
12782 (set_attr "length_immediate" "1")
12783 (set_attr "prefix" "evex")
12784 (set_attr "mode" "<sseinsnmode>")])
12786 (define_expand "avx512vl_shuf_<shuffletype>32x4_mask"
12787 [(match_operand:VI4F_256 0 "register_operand")
12788 (match_operand:VI4F_256 1 "register_operand")
12789 (match_operand:VI4F_256 2 "nonimmediate_operand")
12790 (match_operand:SI 3 "const_0_to_3_operand")
12791 (match_operand:VI4F_256 4 "register_operand")
12792 (match_operand:QI 5 "register_operand")]
12795 int mask = INTVAL (operands[3]);
12796 emit_insn (gen_avx512vl_shuf_<shuffletype>32x4_1_mask
12797 (operands[0], operands[1], operands[2],
12798 GEN_INT (((mask >> 0) & 1) * 4 + 0),
12799 GEN_INT (((mask >> 0) & 1) * 4 + 1),
12800 GEN_INT (((mask >> 0) & 1) * 4 + 2),
12801 GEN_INT (((mask >> 0) & 1) * 4 + 3),
12802 GEN_INT (((mask >> 1) & 1) * 4 + 8),
12803 GEN_INT (((mask >> 1) & 1) * 4 + 9),
12804 GEN_INT (((mask >> 1) & 1) * 4 + 10),
12805 GEN_INT (((mask >> 1) & 1) * 4 + 11),
12806 operands[4], operands[5]));
12810 (define_insn "avx512vl_shuf_<shuffletype>32x4_1<mask_name>"
12811 [(set (match_operand:VI4F_256 0 "register_operand" "=v")
12812 (vec_select:VI4F_256
12813 (vec_concat:<ssedoublemode>
12814 (match_operand:VI4F_256 1 "register_operand" "v")
12815 (match_operand:VI4F_256 2 "nonimmediate_operand" "vm"))
12816 (parallel [(match_operand 3 "const_0_to_7_operand")
12817 (match_operand 4 "const_0_to_7_operand")
12818 (match_operand 5 "const_0_to_7_operand")
12819 (match_operand 6 "const_0_to_7_operand")
12820 (match_operand 7 "const_8_to_15_operand")
12821 (match_operand 8 "const_8_to_15_operand")
12822 (match_operand 9 "const_8_to_15_operand")
12823 (match_operand 10 "const_8_to_15_operand")])))]
12825 && (INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
12826 && INTVAL (operands[3]) == (INTVAL (operands[5]) - 2)
12827 && INTVAL (operands[3]) == (INTVAL (operands[6]) - 3)
12828 && INTVAL (operands[7]) == (INTVAL (operands[8]) - 1)
12829 && INTVAL (operands[7]) == (INTVAL (operands[9]) - 2)
12830 && INTVAL (operands[7]) == (INTVAL (operands[10]) - 3))"
12833 mask = INTVAL (operands[3]) / 4;
12834 mask |= (INTVAL (operands[7]) - 8) / 4 << 1;
12835 operands[3] = GEN_INT (mask);
12837 return "vshuf<shuffletype>32x4\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
12839 [(set_attr "type" "sselog")
12840 (set_attr "length_immediate" "1")
12841 (set_attr "prefix" "evex")
12842 (set_attr "mode" "<sseinsnmode>")])
12844 (define_expand "avx512f_shuf_<shuffletype>32x4_mask"
12845 [(match_operand:V16FI 0 "register_operand")
12846 (match_operand:V16FI 1 "register_operand")
12847 (match_operand:V16FI 2 "nonimmediate_operand")
12848 (match_operand:SI 3 "const_0_to_255_operand")
12849 (match_operand:V16FI 4 "register_operand")
12850 (match_operand:HI 5 "register_operand")]
12853 int mask = INTVAL (operands[3]);
12854 emit_insn (gen_avx512f_shuf_<shuffletype>32x4_1_mask
12855 (operands[0], operands[1], operands[2],
12856 GEN_INT (((mask >> 0) & 3) * 4),
12857 GEN_INT (((mask >> 0) & 3) * 4 + 1),
12858 GEN_INT (((mask >> 0) & 3) * 4 + 2),
12859 GEN_INT (((mask >> 0) & 3) * 4 + 3),
12860 GEN_INT (((mask >> 2) & 3) * 4),
12861 GEN_INT (((mask >> 2) & 3) * 4 + 1),
12862 GEN_INT (((mask >> 2) & 3) * 4 + 2),
12863 GEN_INT (((mask >> 2) & 3) * 4 + 3),
12864 GEN_INT (((mask >> 4) & 3) * 4 + 16),
12865 GEN_INT (((mask >> 4) & 3) * 4 + 17),
12866 GEN_INT (((mask >> 4) & 3) * 4 + 18),
12867 GEN_INT (((mask >> 4) & 3) * 4 + 19),
12868 GEN_INT (((mask >> 6) & 3) * 4 + 16),
12869 GEN_INT (((mask >> 6) & 3) * 4 + 17),
12870 GEN_INT (((mask >> 6) & 3) * 4 + 18),
12871 GEN_INT (((mask >> 6) & 3) * 4 + 19),
12872 operands[4], operands[5]));
12876 (define_insn "avx512f_shuf_<shuffletype>32x4_1<mask_name>"
12877 [(set (match_operand:V16FI 0 "register_operand" "=v")
12879 (vec_concat:<ssedoublemode>
12880 (match_operand:V16FI 1 "register_operand" "v")
12881 (match_operand:V16FI 2 "nonimmediate_operand" "vm"))
12882 (parallel [(match_operand 3 "const_0_to_15_operand")
12883 (match_operand 4 "const_0_to_15_operand")
12884 (match_operand 5 "const_0_to_15_operand")
12885 (match_operand 6 "const_0_to_15_operand")
12886 (match_operand 7 "const_0_to_15_operand")
12887 (match_operand 8 "const_0_to_15_operand")
12888 (match_operand 9 "const_0_to_15_operand")
12889 (match_operand 10 "const_0_to_15_operand")
12890 (match_operand 11 "const_16_to_31_operand")
12891 (match_operand 12 "const_16_to_31_operand")
12892 (match_operand 13 "const_16_to_31_operand")
12893 (match_operand 14 "const_16_to_31_operand")
12894 (match_operand 15 "const_16_to_31_operand")
12895 (match_operand 16 "const_16_to_31_operand")
12896 (match_operand 17 "const_16_to_31_operand")
12897 (match_operand 18 "const_16_to_31_operand")])))]
12899 && (INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
12900 && INTVAL (operands[3]) == (INTVAL (operands[5]) - 2)
12901 && INTVAL (operands[3]) == (INTVAL (operands[6]) - 3)
12902 && INTVAL (operands[7]) == (INTVAL (operands[8]) - 1)
12903 && INTVAL (operands[7]) == (INTVAL (operands[9]) - 2)
12904 && INTVAL (operands[7]) == (INTVAL (operands[10]) - 3)
12905 && INTVAL (operands[11]) == (INTVAL (operands[12]) - 1)
12906 && INTVAL (operands[11]) == (INTVAL (operands[13]) - 2)
12907 && INTVAL (operands[11]) == (INTVAL (operands[14]) - 3)
12908 && INTVAL (operands[15]) == (INTVAL (operands[16]) - 1)
12909 && INTVAL (operands[15]) == (INTVAL (operands[17]) - 2)
12910 && INTVAL (operands[15]) == (INTVAL (operands[18]) - 3))"
12913 mask = INTVAL (operands[3]) / 4;
12914 mask |= INTVAL (operands[7]) / 4 << 2;
12915 mask |= (INTVAL (operands[11]) - 16) / 4 << 4;
12916 mask |= (INTVAL (operands[15]) - 16) / 4 << 6;
12917 operands[3] = GEN_INT (mask);
12919 return "vshuf<shuffletype>32x4\t{%3, %2, %1, %0<mask_operand19>|%0<mask_operand19>, %1, %2, %3}";
12921 [(set_attr "type" "sselog")
12922 (set_attr "length_immediate" "1")
12923 (set_attr "prefix" "evex")
12924 (set_attr "mode" "<sseinsnmode>")])
12926 (define_expand "avx512f_pshufdv3_mask"
12927 [(match_operand:V16SI 0 "register_operand")
12928 (match_operand:V16SI 1 "nonimmediate_operand")
12929 (match_operand:SI 2 "const_0_to_255_operand")
12930 (match_operand:V16SI 3 "register_operand")
12931 (match_operand:HI 4 "register_operand")]
12934 int mask = INTVAL (operands[2]);
12935 emit_insn (gen_avx512f_pshufd_1_mask (operands[0], operands[1],
12936 GEN_INT ((mask >> 0) & 3),
12937 GEN_INT ((mask >> 2) & 3),
12938 GEN_INT ((mask >> 4) & 3),
12939 GEN_INT ((mask >> 6) & 3),
12940 GEN_INT (((mask >> 0) & 3) + 4),
12941 GEN_INT (((mask >> 2) & 3) + 4),
12942 GEN_INT (((mask >> 4) & 3) + 4),
12943 GEN_INT (((mask >> 6) & 3) + 4),
12944 GEN_INT (((mask >> 0) & 3) + 8),
12945 GEN_INT (((mask >> 2) & 3) + 8),
12946 GEN_INT (((mask >> 4) & 3) + 8),
12947 GEN_INT (((mask >> 6) & 3) + 8),
12948 GEN_INT (((mask >> 0) & 3) + 12),
12949 GEN_INT (((mask >> 2) & 3) + 12),
12950 GEN_INT (((mask >> 4) & 3) + 12),
12951 GEN_INT (((mask >> 6) & 3) + 12),
12952 operands[3], operands[4]));
12956 (define_insn "avx512f_pshufd_1<mask_name>"
12957 [(set (match_operand:V16SI 0 "register_operand" "=v")
12959 (match_operand:V16SI 1 "nonimmediate_operand" "vm")
12960 (parallel [(match_operand 2 "const_0_to_3_operand")
12961 (match_operand 3 "const_0_to_3_operand")
12962 (match_operand 4 "const_0_to_3_operand")
12963 (match_operand 5 "const_0_to_3_operand")
12964 (match_operand 6 "const_4_to_7_operand")
12965 (match_operand 7 "const_4_to_7_operand")
12966 (match_operand 8 "const_4_to_7_operand")
12967 (match_operand 9 "const_4_to_7_operand")
12968 (match_operand 10 "const_8_to_11_operand")
12969 (match_operand 11 "const_8_to_11_operand")
12970 (match_operand 12 "const_8_to_11_operand")
12971 (match_operand 13 "const_8_to_11_operand")
12972 (match_operand 14 "const_12_to_15_operand")
12973 (match_operand 15 "const_12_to_15_operand")
12974 (match_operand 16 "const_12_to_15_operand")
12975 (match_operand 17 "const_12_to_15_operand")])))]
12977 && INTVAL (operands[2]) + 4 == INTVAL (operands[6])
12978 && INTVAL (operands[3]) + 4 == INTVAL (operands[7])
12979 && INTVAL (operands[4]) + 4 == INTVAL (operands[8])
12980 && INTVAL (operands[5]) + 4 == INTVAL (operands[9])
12981 && INTVAL (operands[2]) + 8 == INTVAL (operands[10])
12982 && INTVAL (operands[3]) + 8 == INTVAL (operands[11])
12983 && INTVAL (operands[4]) + 8 == INTVAL (operands[12])
12984 && INTVAL (operands[5]) + 8 == INTVAL (operands[13])
12985 && INTVAL (operands[2]) + 12 == INTVAL (operands[14])
12986 && INTVAL (operands[3]) + 12 == INTVAL (operands[15])
12987 && INTVAL (operands[4]) + 12 == INTVAL (operands[16])
12988 && INTVAL (operands[5]) + 12 == INTVAL (operands[17])"
12991 mask |= INTVAL (operands[2]) << 0;
12992 mask |= INTVAL (operands[3]) << 2;
12993 mask |= INTVAL (operands[4]) << 4;
12994 mask |= INTVAL (operands[5]) << 6;
12995 operands[2] = GEN_INT (mask);
12997 return "vpshufd\t{%2, %1, %0<mask_operand18>|%0<mask_operand18>, %1, %2}";
12999 [(set_attr "type" "sselog1")
13000 (set_attr "prefix" "evex")
13001 (set_attr "length_immediate" "1")
13002 (set_attr "mode" "XI")])
13004 (define_expand "avx512vl_pshufdv3_mask"
13005 [(match_operand:V8SI 0 "register_operand")
13006 (match_operand:V8SI 1 "nonimmediate_operand")
13007 (match_operand:SI 2 "const_0_to_255_operand")
13008 (match_operand:V8SI 3 "register_operand")
13009 (match_operand:QI 4 "register_operand")]
13012 int mask = INTVAL (operands[2]);
13013 emit_insn (gen_avx2_pshufd_1_mask (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),
13022 operands[3], operands[4]));
13026 (define_expand "avx2_pshufdv3"
13027 [(match_operand:V8SI 0 "register_operand")
13028 (match_operand:V8SI 1 "nonimmediate_operand")
13029 (match_operand:SI 2 "const_0_to_255_operand")]
13032 int mask = INTVAL (operands[2]);
13033 emit_insn (gen_avx2_pshufd_1 (operands[0], operands[1],
13034 GEN_INT ((mask >> 0) & 3),
13035 GEN_INT ((mask >> 2) & 3),
13036 GEN_INT ((mask >> 4) & 3),
13037 GEN_INT ((mask >> 6) & 3),
13038 GEN_INT (((mask >> 0) & 3) + 4),
13039 GEN_INT (((mask >> 2) & 3) + 4),
13040 GEN_INT (((mask >> 4) & 3) + 4),
13041 GEN_INT (((mask >> 6) & 3) + 4)));
13045 (define_insn "avx2_pshufd_1<mask_name>"
13046 [(set (match_operand:V8SI 0 "register_operand" "=v")
13048 (match_operand:V8SI 1 "nonimmediate_operand" "vm")
13049 (parallel [(match_operand 2 "const_0_to_3_operand")
13050 (match_operand 3 "const_0_to_3_operand")
13051 (match_operand 4 "const_0_to_3_operand")
13052 (match_operand 5 "const_0_to_3_operand")
13053 (match_operand 6 "const_4_to_7_operand")
13054 (match_operand 7 "const_4_to_7_operand")
13055 (match_operand 8 "const_4_to_7_operand")
13056 (match_operand 9 "const_4_to_7_operand")])))]
13058 && <mask_avx512vl_condition>
13059 && INTVAL (operands[2]) + 4 == INTVAL (operands[6])
13060 && INTVAL (operands[3]) + 4 == INTVAL (operands[7])
13061 && INTVAL (operands[4]) + 4 == INTVAL (operands[8])
13062 && INTVAL (operands[5]) + 4 == INTVAL (operands[9])"
13065 mask |= INTVAL (operands[2]) << 0;
13066 mask |= INTVAL (operands[3]) << 2;
13067 mask |= INTVAL (operands[4]) << 4;
13068 mask |= INTVAL (operands[5]) << 6;
13069 operands[2] = GEN_INT (mask);
13071 return "vpshufd\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
13073 [(set_attr "type" "sselog1")
13074 (set_attr "prefix" "maybe_evex")
13075 (set_attr "length_immediate" "1")
13076 (set_attr "mode" "OI")])
13078 (define_expand "avx512vl_pshufd_mask"
13079 [(match_operand:V4SI 0 "register_operand")
13080 (match_operand:V4SI 1 "nonimmediate_operand")
13081 (match_operand:SI 2 "const_0_to_255_operand")
13082 (match_operand:V4SI 3 "register_operand")
13083 (match_operand:QI 4 "register_operand")]
13086 int mask = INTVAL (operands[2]);
13087 emit_insn (gen_sse2_pshufd_1_mask (operands[0], operands[1],
13088 GEN_INT ((mask >> 0) & 3),
13089 GEN_INT ((mask >> 2) & 3),
13090 GEN_INT ((mask >> 4) & 3),
13091 GEN_INT ((mask >> 6) & 3),
13092 operands[3], operands[4]));
13096 (define_expand "sse2_pshufd"
13097 [(match_operand:V4SI 0 "register_operand")
13098 (match_operand:V4SI 1 "vector_operand")
13099 (match_operand:SI 2 "const_int_operand")]
13102 int mask = INTVAL (operands[2]);
13103 emit_insn (gen_sse2_pshufd_1 (operands[0], operands[1],
13104 GEN_INT ((mask >> 0) & 3),
13105 GEN_INT ((mask >> 2) & 3),
13106 GEN_INT ((mask >> 4) & 3),
13107 GEN_INT ((mask >> 6) & 3)));
13111 (define_insn "sse2_pshufd_1<mask_name>"
13112 [(set (match_operand:V4SI 0 "register_operand" "=v")
13114 (match_operand:V4SI 1 "vector_operand" "vBm")
13115 (parallel [(match_operand 2 "const_0_to_3_operand")
13116 (match_operand 3 "const_0_to_3_operand")
13117 (match_operand 4 "const_0_to_3_operand")
13118 (match_operand 5 "const_0_to_3_operand")])))]
13119 "TARGET_SSE2 && <mask_avx512vl_condition>"
13122 mask |= INTVAL (operands[2]) << 0;
13123 mask |= INTVAL (operands[3]) << 2;
13124 mask |= INTVAL (operands[4]) << 4;
13125 mask |= INTVAL (operands[5]) << 6;
13126 operands[2] = GEN_INT (mask);
13128 return "%vpshufd\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
13130 [(set_attr "type" "sselog1")
13131 (set_attr "prefix_data16" "1")
13132 (set_attr "prefix" "<mask_prefix2>")
13133 (set_attr "length_immediate" "1")
13134 (set_attr "mode" "TI")])
13136 (define_insn "<mask_codefor>avx512bw_pshuflwv32hi<mask_name>"
13137 [(set (match_operand:V32HI 0 "register_operand" "=v")
13139 [(match_operand:V32HI 1 "nonimmediate_operand" "vm")
13140 (match_operand:SI 2 "const_0_to_255_operand" "n")]
13143 "vpshuflw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13144 [(set_attr "type" "sselog")
13145 (set_attr "prefix" "evex")
13146 (set_attr "mode" "XI")])
13148 (define_expand "avx512vl_pshuflwv3_mask"
13149 [(match_operand:V16HI 0 "register_operand")
13150 (match_operand:V16HI 1 "nonimmediate_operand")
13151 (match_operand:SI 2 "const_0_to_255_operand")
13152 (match_operand:V16HI 3 "register_operand")
13153 (match_operand:HI 4 "register_operand")]
13154 "TARGET_AVX512VL && TARGET_AVX512BW"
13156 int mask = INTVAL (operands[2]);
13157 emit_insn (gen_avx2_pshuflw_1_mask (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),
13166 operands[3], operands[4]));
13170 (define_expand "avx2_pshuflwv3"
13171 [(match_operand:V16HI 0 "register_operand")
13172 (match_operand:V16HI 1 "nonimmediate_operand")
13173 (match_operand:SI 2 "const_0_to_255_operand")]
13176 int mask = INTVAL (operands[2]);
13177 emit_insn (gen_avx2_pshuflw_1 (operands[0], operands[1],
13178 GEN_INT ((mask >> 0) & 3),
13179 GEN_INT ((mask >> 2) & 3),
13180 GEN_INT ((mask >> 4) & 3),
13181 GEN_INT ((mask >> 6) & 3),
13182 GEN_INT (((mask >> 0) & 3) + 8),
13183 GEN_INT (((mask >> 2) & 3) + 8),
13184 GEN_INT (((mask >> 4) & 3) + 8),
13185 GEN_INT (((mask >> 6) & 3) + 8)));
13189 (define_insn "avx2_pshuflw_1<mask_name>"
13190 [(set (match_operand:V16HI 0 "register_operand" "=v")
13192 (match_operand:V16HI 1 "nonimmediate_operand" "vm")
13193 (parallel [(match_operand 2 "const_0_to_3_operand")
13194 (match_operand 3 "const_0_to_3_operand")
13195 (match_operand 4 "const_0_to_3_operand")
13196 (match_operand 5 "const_0_to_3_operand")
13201 (match_operand 6 "const_8_to_11_operand")
13202 (match_operand 7 "const_8_to_11_operand")
13203 (match_operand 8 "const_8_to_11_operand")
13204 (match_operand 9 "const_8_to_11_operand")
13208 (const_int 15)])))]
13210 && <mask_avx512bw_condition> && <mask_avx512vl_condition>
13211 && INTVAL (operands[2]) + 8 == INTVAL (operands[6])
13212 && INTVAL (operands[3]) + 8 == INTVAL (operands[7])
13213 && INTVAL (operands[4]) + 8 == INTVAL (operands[8])
13214 && INTVAL (operands[5]) + 8 == INTVAL (operands[9])"
13217 mask |= INTVAL (operands[2]) << 0;
13218 mask |= INTVAL (operands[3]) << 2;
13219 mask |= INTVAL (operands[4]) << 4;
13220 mask |= INTVAL (operands[5]) << 6;
13221 operands[2] = GEN_INT (mask);
13223 return "vpshuflw\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
13225 [(set_attr "type" "sselog")
13226 (set_attr "prefix" "maybe_evex")
13227 (set_attr "length_immediate" "1")
13228 (set_attr "mode" "OI")])
13230 (define_expand "avx512vl_pshuflw_mask"
13231 [(match_operand:V8HI 0 "register_operand")
13232 (match_operand:V8HI 1 "nonimmediate_operand")
13233 (match_operand:SI 2 "const_0_to_255_operand")
13234 (match_operand:V8HI 3 "register_operand")
13235 (match_operand:QI 4 "register_operand")]
13236 "TARGET_AVX512VL && TARGET_AVX512BW"
13238 int mask = INTVAL (operands[2]);
13239 emit_insn (gen_sse2_pshuflw_1_mask (operands[0], operands[1],
13240 GEN_INT ((mask >> 0) & 3),
13241 GEN_INT ((mask >> 2) & 3),
13242 GEN_INT ((mask >> 4) & 3),
13243 GEN_INT ((mask >> 6) & 3),
13244 operands[3], operands[4]));
13248 (define_expand "sse2_pshuflw"
13249 [(match_operand:V8HI 0 "register_operand")
13250 (match_operand:V8HI 1 "vector_operand")
13251 (match_operand:SI 2 "const_int_operand")]
13254 int mask = INTVAL (operands[2]);
13255 emit_insn (gen_sse2_pshuflw_1 (operands[0], operands[1],
13256 GEN_INT ((mask >> 0) & 3),
13257 GEN_INT ((mask >> 2) & 3),
13258 GEN_INT ((mask >> 4) & 3),
13259 GEN_INT ((mask >> 6) & 3)));
13263 (define_insn "sse2_pshuflw_1<mask_name>"
13264 [(set (match_operand:V8HI 0 "register_operand" "=v")
13266 (match_operand:V8HI 1 "vector_operand" "vBm")
13267 (parallel [(match_operand 2 "const_0_to_3_operand")
13268 (match_operand 3 "const_0_to_3_operand")
13269 (match_operand 4 "const_0_to_3_operand")
13270 (match_operand 5 "const_0_to_3_operand")
13275 "TARGET_SSE2 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
13278 mask |= INTVAL (operands[2]) << 0;
13279 mask |= INTVAL (operands[3]) << 2;
13280 mask |= INTVAL (operands[4]) << 4;
13281 mask |= INTVAL (operands[5]) << 6;
13282 operands[2] = GEN_INT (mask);
13284 return "%vpshuflw\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
13286 [(set_attr "type" "sselog")
13287 (set_attr "prefix_data16" "0")
13288 (set_attr "prefix_rep" "1")
13289 (set_attr "prefix" "maybe_vex")
13290 (set_attr "length_immediate" "1")
13291 (set_attr "mode" "TI")])
13293 (define_expand "avx2_pshufhwv3"
13294 [(match_operand:V16HI 0 "register_operand")
13295 (match_operand:V16HI 1 "nonimmediate_operand")
13296 (match_operand:SI 2 "const_0_to_255_operand")]
13299 int mask = INTVAL (operands[2]);
13300 emit_insn (gen_avx2_pshufhw_1 (operands[0], operands[1],
13301 GEN_INT (((mask >> 0) & 3) + 4),
13302 GEN_INT (((mask >> 2) & 3) + 4),
13303 GEN_INT (((mask >> 4) & 3) + 4),
13304 GEN_INT (((mask >> 6) & 3) + 4),
13305 GEN_INT (((mask >> 0) & 3) + 12),
13306 GEN_INT (((mask >> 2) & 3) + 12),
13307 GEN_INT (((mask >> 4) & 3) + 12),
13308 GEN_INT (((mask >> 6) & 3) + 12)));
13312 (define_insn "<mask_codefor>avx512bw_pshufhwv32hi<mask_name>"
13313 [(set (match_operand:V32HI 0 "register_operand" "=v")
13315 [(match_operand:V32HI 1 "nonimmediate_operand" "vm")
13316 (match_operand:SI 2 "const_0_to_255_operand" "n")]
13319 "vpshufhw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13320 [(set_attr "type" "sselog")
13321 (set_attr "prefix" "evex")
13322 (set_attr "mode" "XI")])
13324 (define_expand "avx512vl_pshufhwv3_mask"
13325 [(match_operand:V16HI 0 "register_operand")
13326 (match_operand:V16HI 1 "nonimmediate_operand")
13327 (match_operand:SI 2 "const_0_to_255_operand")
13328 (match_operand:V16HI 3 "register_operand")
13329 (match_operand:HI 4 "register_operand")]
13330 "TARGET_AVX512VL && TARGET_AVX512BW"
13332 int mask = INTVAL (operands[2]);
13333 emit_insn (gen_avx2_pshufhw_1_mask (operands[0], operands[1],
13334 GEN_INT (((mask >> 0) & 3) + 4),
13335 GEN_INT (((mask >> 2) & 3) + 4),
13336 GEN_INT (((mask >> 4) & 3) + 4),
13337 GEN_INT (((mask >> 6) & 3) + 4),
13338 GEN_INT (((mask >> 0) & 3) + 12),
13339 GEN_INT (((mask >> 2) & 3) + 12),
13340 GEN_INT (((mask >> 4) & 3) + 12),
13341 GEN_INT (((mask >> 6) & 3) + 12),
13342 operands[3], operands[4]));
13346 (define_insn "avx2_pshufhw_1<mask_name>"
13347 [(set (match_operand:V16HI 0 "register_operand" "=v")
13349 (match_operand:V16HI 1 "nonimmediate_operand" "vm")
13350 (parallel [(const_int 0)
13354 (match_operand 2 "const_4_to_7_operand")
13355 (match_operand 3 "const_4_to_7_operand")
13356 (match_operand 4 "const_4_to_7_operand")
13357 (match_operand 5 "const_4_to_7_operand")
13362 (match_operand 6 "const_12_to_15_operand")
13363 (match_operand 7 "const_12_to_15_operand")
13364 (match_operand 8 "const_12_to_15_operand")
13365 (match_operand 9 "const_12_to_15_operand")])))]
13367 && <mask_avx512bw_condition> && <mask_avx512vl_condition>
13368 && INTVAL (operands[2]) + 8 == INTVAL (operands[6])
13369 && INTVAL (operands[3]) + 8 == INTVAL (operands[7])
13370 && INTVAL (operands[4]) + 8 == INTVAL (operands[8])
13371 && INTVAL (operands[5]) + 8 == INTVAL (operands[9])"
13374 mask |= (INTVAL (operands[2]) - 4) << 0;
13375 mask |= (INTVAL (operands[3]) - 4) << 2;
13376 mask |= (INTVAL (operands[4]) - 4) << 4;
13377 mask |= (INTVAL (operands[5]) - 4) << 6;
13378 operands[2] = GEN_INT (mask);
13380 return "vpshufhw\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
13382 [(set_attr "type" "sselog")
13383 (set_attr "prefix" "maybe_evex")
13384 (set_attr "length_immediate" "1")
13385 (set_attr "mode" "OI")])
13387 (define_expand "avx512vl_pshufhw_mask"
13388 [(match_operand:V8HI 0 "register_operand")
13389 (match_operand:V8HI 1 "nonimmediate_operand")
13390 (match_operand:SI 2 "const_0_to_255_operand")
13391 (match_operand:V8HI 3 "register_operand")
13392 (match_operand:QI 4 "register_operand")]
13393 "TARGET_AVX512VL && TARGET_AVX512BW"
13395 int mask = INTVAL (operands[2]);
13396 emit_insn (gen_sse2_pshufhw_1_mask (operands[0], operands[1],
13397 GEN_INT (((mask >> 0) & 3) + 4),
13398 GEN_INT (((mask >> 2) & 3) + 4),
13399 GEN_INT (((mask >> 4) & 3) + 4),
13400 GEN_INT (((mask >> 6) & 3) + 4),
13401 operands[3], operands[4]));
13405 (define_expand "sse2_pshufhw"
13406 [(match_operand:V8HI 0 "register_operand")
13407 (match_operand:V8HI 1 "vector_operand")
13408 (match_operand:SI 2 "const_int_operand")]
13411 int mask = INTVAL (operands[2]);
13412 emit_insn (gen_sse2_pshufhw_1 (operands[0], operands[1],
13413 GEN_INT (((mask >> 0) & 3) + 4),
13414 GEN_INT (((mask >> 2) & 3) + 4),
13415 GEN_INT (((mask >> 4) & 3) + 4),
13416 GEN_INT (((mask >> 6) & 3) + 4)));
13420 (define_insn "sse2_pshufhw_1<mask_name>"
13421 [(set (match_operand:V8HI 0 "register_operand" "=v")
13423 (match_operand:V8HI 1 "vector_operand" "vBm")
13424 (parallel [(const_int 0)
13428 (match_operand 2 "const_4_to_7_operand")
13429 (match_operand 3 "const_4_to_7_operand")
13430 (match_operand 4 "const_4_to_7_operand")
13431 (match_operand 5 "const_4_to_7_operand")])))]
13432 "TARGET_SSE2 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
13435 mask |= (INTVAL (operands[2]) - 4) << 0;
13436 mask |= (INTVAL (operands[3]) - 4) << 2;
13437 mask |= (INTVAL (operands[4]) - 4) << 4;
13438 mask |= (INTVAL (operands[5]) - 4) << 6;
13439 operands[2] = GEN_INT (mask);
13441 return "%vpshufhw\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
13443 [(set_attr "type" "sselog")
13444 (set_attr "prefix_rep" "1")
13445 (set_attr "prefix_data16" "0")
13446 (set_attr "prefix" "maybe_vex")
13447 (set_attr "length_immediate" "1")
13448 (set_attr "mode" "TI")])
13450 (define_expand "sse2_loadd"
13451 [(set (match_operand:V4SI 0 "register_operand")
13453 (vec_duplicate:V4SI
13454 (match_operand:SI 1 "nonimmediate_operand"))
13458 "operands[2] = CONST0_RTX (V4SImode);")
13460 (define_insn "sse2_loadld"
13461 [(set (match_operand:V4SI 0 "register_operand" "=v,Yi,x,x,v")
13463 (vec_duplicate:V4SI
13464 (match_operand:SI 2 "nonimmediate_operand" "m ,r ,m,x,v"))
13465 (match_operand:V4SI 1 "reg_or_0_operand" "C ,C ,C,0,v")
13469 %vmovd\t{%2, %0|%0, %2}
13470 %vmovd\t{%2, %0|%0, %2}
13471 movss\t{%2, %0|%0, %2}
13472 movss\t{%2, %0|%0, %2}
13473 vmovss\t{%2, %1, %0|%0, %1, %2}"
13474 [(set_attr "isa" "sse2,sse2,noavx,noavx,avx")
13475 (set_attr "type" "ssemov")
13476 (set_attr "prefix" "maybe_vex,maybe_vex,orig,orig,maybe_evex")
13477 (set_attr "mode" "TI,TI,V4SF,SF,SF")])
13479 ;; QI and HI modes handled by pextr patterns.
13480 (define_mode_iterator PEXTR_MODE12
13481 [(V16QI "TARGET_SSE4_1") V8HI])
13483 (define_insn "*vec_extract<mode>"
13484 [(set (match_operand:<ssescalarmode> 0 "register_sse4nonimm_operand" "=r,m,r,m")
13485 (vec_select:<ssescalarmode>
13486 (match_operand:PEXTR_MODE12 1 "register_operand" "x,x,v,v")
13488 [(match_operand:SI 2 "const_0_to_<ssescalarnummask>_operand")])))]
13491 %vpextr<ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}
13492 %vpextr<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
13493 vpextr<ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}
13494 vpextr<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
13495 [(set_attr "isa" "*,sse4,avx512bw,avx512bw")
13496 (set_attr "type" "sselog1")
13497 (set_attr "prefix_data16" "1")
13498 (set (attr "prefix_extra")
13500 (and (eq_attr "alternative" "0,2")
13501 (eq (const_string "<MODE>mode") (const_string "V8HImode")))
13503 (const_string "1")))
13504 (set_attr "length_immediate" "1")
13505 (set_attr "prefix" "maybe_vex,maybe_vex,evex,evex")
13506 (set_attr "mode" "TI")])
13508 (define_insn "*vec_extract<PEXTR_MODE12:mode>_zext"
13509 [(set (match_operand:SWI48 0 "register_operand" "=r,r")
13511 (vec_select:<PEXTR_MODE12:ssescalarmode>
13512 (match_operand:PEXTR_MODE12 1 "register_operand" "x,v")
13514 [(match_operand:SI 2
13515 "const_0_to_<PEXTR_MODE12:ssescalarnummask>_operand")]))))]
13518 %vpextr<PEXTR_MODE12:ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}
13519 vpextr<PEXTR_MODE12:ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}"
13520 [(set_attr "isa" "*,avx512bw")
13521 (set_attr "type" "sselog1")
13522 (set_attr "prefix_data16" "1")
13523 (set (attr "prefix_extra")
13525 (eq (const_string "<PEXTR_MODE12:MODE>mode") (const_string "V8HImode"))
13527 (const_string "1")))
13528 (set_attr "length_immediate" "1")
13529 (set_attr "prefix" "maybe_vex")
13530 (set_attr "mode" "TI")])
13532 (define_insn "*vec_extract<mode>_mem"
13533 [(set (match_operand:<ssescalarmode> 0 "register_operand" "=r")
13534 (vec_select:<ssescalarmode>
13535 (match_operand:VI12_128 1 "memory_operand" "o")
13537 [(match_operand 2 "const_0_to_<ssescalarnummask>_operand")])))]
13541 (define_insn "*vec_extract<ssevecmodelower>_0"
13542 [(set (match_operand:SWI48 0 "nonimmediate_operand" "=r ,v ,m")
13544 (match_operand:<ssevecmode> 1 "nonimmediate_operand" "mYj,vm,v")
13545 (parallel [(const_int 0)])))]
13546 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
13549 (define_insn "*vec_extractv2di_0_sse"
13550 [(set (match_operand:DI 0 "nonimmediate_operand" "=v,m")
13552 (match_operand:V2DI 1 "nonimmediate_operand" "vm,v")
13553 (parallel [(const_int 0)])))]
13554 "TARGET_SSE && !TARGET_64BIT
13555 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
13559 [(set (match_operand:SWI48x 0 "nonimmediate_operand")
13561 (match_operand:<ssevecmode> 1 "register_operand")
13562 (parallel [(const_int 0)])))]
13563 "TARGET_SSE && reload_completed"
13564 [(set (match_dup 0) (match_dup 1))]
13565 "operands[1] = gen_lowpart (<MODE>mode, operands[1]);")
13567 (define_insn "*vec_extractv4si_0_zext_sse4"
13568 [(set (match_operand:DI 0 "register_operand" "=r,x,v")
13571 (match_operand:V4SI 1 "register_operand" "Yj,x,v")
13572 (parallel [(const_int 0)]))))]
13575 [(set_attr "isa" "x64,*,avx512f")])
13577 (define_insn "*vec_extractv4si_0_zext"
13578 [(set (match_operand:DI 0 "register_operand" "=r")
13581 (match_operand:V4SI 1 "register_operand" "x")
13582 (parallel [(const_int 0)]))))]
13583 "TARGET_64BIT && TARGET_SSE2 && TARGET_INTER_UNIT_MOVES_FROM_VEC"
13587 [(set (match_operand:DI 0 "register_operand")
13590 (match_operand:V4SI 1 "register_operand")
13591 (parallel [(const_int 0)]))))]
13592 "TARGET_SSE2 && reload_completed"
13593 [(set (match_dup 0) (zero_extend:DI (match_dup 1)))]
13594 "operands[1] = gen_lowpart (SImode, operands[1]);")
13596 (define_insn "*vec_extractv4si"
13597 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,rm,Yr,*x,x,Yv")
13599 (match_operand:V4SI 1 "register_operand" "x,v,0,0,x,v")
13600 (parallel [(match_operand:SI 2 "const_0_to_3_operand")])))]
13603 switch (which_alternative)
13607 return "%vpextrd\t{%2, %1, %0|%0, %1, %2}";
13611 operands[2] = GEN_INT (INTVAL (operands[2]) * 4);
13612 return "psrldq\t{%2, %0|%0, %2}";
13616 operands[2] = GEN_INT (INTVAL (operands[2]) * 4);
13617 return "vpsrldq\t{%2, %1, %0|%0, %1, %2}";
13620 gcc_unreachable ();
13623 [(set_attr "isa" "*,avx512dq,noavx,noavx,avx,avx512bw")
13624 (set_attr "type" "sselog1,sselog1,sseishft1,sseishft1,sseishft1,sseishft1")
13625 (set (attr "prefix_extra")
13626 (if_then_else (eq_attr "alternative" "0,1")
13628 (const_string "*")))
13629 (set_attr "length_immediate" "1")
13630 (set_attr "prefix" "maybe_vex,evex,orig,orig,vex,evex")
13631 (set_attr "mode" "TI")])
13633 (define_insn "*vec_extractv4si_zext"
13634 [(set (match_operand:DI 0 "register_operand" "=r,r")
13637 (match_operand:V4SI 1 "register_operand" "x,v")
13638 (parallel [(match_operand:SI 2 "const_0_to_3_operand")]))))]
13639 "TARGET_64BIT && TARGET_SSE4_1"
13640 "%vpextrd\t{%2, %1, %k0|%k0, %1, %2}"
13641 [(set_attr "isa" "*,avx512dq")
13642 (set_attr "type" "sselog1")
13643 (set_attr "prefix_extra" "1")
13644 (set_attr "length_immediate" "1")
13645 (set_attr "prefix" "maybe_vex")
13646 (set_attr "mode" "TI")])
13648 (define_insn "*vec_extractv4si_mem"
13649 [(set (match_operand:SI 0 "register_operand" "=x,r")
13651 (match_operand:V4SI 1 "memory_operand" "o,o")
13652 (parallel [(match_operand 2 "const_0_to_3_operand")])))]
13656 (define_insn_and_split "*vec_extractv4si_zext_mem"
13657 [(set (match_operand:DI 0 "register_operand" "=x,r")
13660 (match_operand:V4SI 1 "memory_operand" "o,o")
13661 (parallel [(match_operand:SI 2 "const_0_to_3_operand")]))))]
13662 "TARGET_64BIT && TARGET_SSE"
13664 "&& reload_completed"
13665 [(set (match_dup 0) (zero_extend:DI (match_dup 1)))]
13667 operands[1] = adjust_address (operands[1], SImode, INTVAL (operands[2]) * 4);
13670 (define_insn "*vec_extractv2di_1"
13671 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,rm,m,x,x,Yv,x,v,r")
13673 (match_operand:V2DI 1 "nonimmediate_operand" "x ,v ,v,0,x, v,x,o,o")
13674 (parallel [(const_int 1)])))]
13675 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
13677 %vpextrq\t{$1, %1, %0|%0, %1, 1}
13678 vpextrq\t{$1, %1, %0|%0, %1, 1}
13679 %vmovhps\t{%1, %0|%0, %1}
13680 psrldq\t{$8, %0|%0, 8}
13681 vpsrldq\t{$8, %1, %0|%0, %1, 8}
13682 vpsrldq\t{$8, %1, %0|%0, %1, 8}
13683 movhlps\t{%1, %0|%0, %1}
13687 (cond [(eq_attr "alternative" "0")
13688 (const_string "x64_sse4")
13689 (eq_attr "alternative" "1")
13690 (const_string "x64_avx512dq")
13691 (eq_attr "alternative" "3")
13692 (const_string "sse2_noavx")
13693 (eq_attr "alternative" "4")
13694 (const_string "avx")
13695 (eq_attr "alternative" "5")
13696 (const_string "avx512bw")
13697 (eq_attr "alternative" "6")
13698 (const_string "noavx")
13699 (eq_attr "alternative" "8")
13700 (const_string "x64")
13702 (const_string "*")))
13704 (cond [(eq_attr "alternative" "2,6,7")
13705 (const_string "ssemov")
13706 (eq_attr "alternative" "3,4,5")
13707 (const_string "sseishft1")
13708 (eq_attr "alternative" "8")
13709 (const_string "imov")
13711 (const_string "sselog1")))
13712 (set (attr "length_immediate")
13713 (if_then_else (eq_attr "alternative" "0,1,3,4,5")
13715 (const_string "*")))
13716 (set (attr "prefix_rex")
13717 (if_then_else (eq_attr "alternative" "0,1")
13719 (const_string "*")))
13720 (set (attr "prefix_extra")
13721 (if_then_else (eq_attr "alternative" "0,1")
13723 (const_string "*")))
13724 (set_attr "prefix" "maybe_vex,evex,maybe_vex,orig,vex,evex,orig,*,*")
13725 (set_attr "mode" "TI,TI,V2SF,TI,TI,TI,V4SF,DI,DI")])
13728 [(set (match_operand:<ssescalarmode> 0 "register_operand")
13729 (vec_select:<ssescalarmode>
13730 (match_operand:VI_128 1 "memory_operand")
13732 [(match_operand 2 "const_0_to_<ssescalarnummask>_operand")])))]
13733 "TARGET_SSE && reload_completed"
13734 [(set (match_dup 0) (match_dup 1))]
13736 int offs = INTVAL (operands[2]) * GET_MODE_SIZE (<ssescalarmode>mode);
13738 operands[1] = adjust_address (operands[1], <ssescalarmode>mode, offs);
13741 (define_insn "*vec_extractv2ti"
13742 [(set (match_operand:TI 0 "nonimmediate_operand" "=xm,vm")
13744 (match_operand:V2TI 1 "register_operand" "x,v")
13746 [(match_operand:SI 2 "const_0_to_1_operand")])))]
13749 vextract%~128\t{%2, %1, %0|%0, %1, %2}
13750 vextracti32x4\t{%2, %g1, %0|%0, %g1, %2}"
13751 [(set_attr "type" "sselog")
13752 (set_attr "prefix_extra" "1")
13753 (set_attr "length_immediate" "1")
13754 (set_attr "prefix" "vex,evex")
13755 (set_attr "mode" "OI")])
13757 (define_insn "*vec_extractv4ti"
13758 [(set (match_operand:TI 0 "nonimmediate_operand" "=vm")
13760 (match_operand:V4TI 1 "register_operand" "v")
13762 [(match_operand:SI 2 "const_0_to_3_operand")])))]
13764 "vextracti32x4\t{%2, %1, %0|%0, %1, %2}"
13765 [(set_attr "type" "sselog")
13766 (set_attr "prefix_extra" "1")
13767 (set_attr "length_immediate" "1")
13768 (set_attr "prefix" "evex")
13769 (set_attr "mode" "XI")])
13771 (define_mode_iterator VEXTRACTI128_MODE
13772 [(V4TI "TARGET_AVX512F") V2TI])
13775 [(set (match_operand:TI 0 "nonimmediate_operand")
13777 (match_operand:VEXTRACTI128_MODE 1 "register_operand")
13778 (parallel [(const_int 0)])))]
13780 && reload_completed
13781 && (TARGET_AVX512VL || !EXT_REX_SSE_REG_P (operands[1]))"
13782 [(set (match_dup 0) (match_dup 1))]
13783 "operands[1] = gen_lowpart (TImode, operands[1]);")
13785 ;; Turn SImode or DImode extraction from arbitrary SSE/AVX/AVX512F
13786 ;; vector modes into vec_extract*.
13788 [(set (match_operand:SWI48x 0 "nonimmediate_operand")
13789 (subreg:SWI48x (match_operand 1 "register_operand") 0))]
13790 "can_create_pseudo_p ()
13791 && REG_P (operands[1])
13792 && VECTOR_MODE_P (GET_MODE (operands[1]))
13793 && ((TARGET_SSE && GET_MODE_SIZE (GET_MODE (operands[1])) == 16)
13794 || (TARGET_AVX && GET_MODE_SIZE (GET_MODE (operands[1])) == 32)
13795 || (TARGET_AVX512F && GET_MODE_SIZE (GET_MODE (operands[1])) == 64))
13796 && (<MODE>mode == SImode || TARGET_64BIT || MEM_P (operands[0]))"
13797 [(set (match_dup 0) (vec_select:SWI48x (match_dup 1)
13798 (parallel [(const_int 0)])))]
13802 switch (GET_MODE_SIZE (GET_MODE (operands[1])))
13805 if (<MODE>mode == SImode)
13807 tmp = gen_reg_rtx (V8SImode);
13808 emit_insn (gen_vec_extract_lo_v16si (tmp,
13809 gen_lowpart (V16SImode,
13814 tmp = gen_reg_rtx (V4DImode);
13815 emit_insn (gen_vec_extract_lo_v8di (tmp,
13816 gen_lowpart (V8DImode,
13822 tmp = gen_reg_rtx (<ssevecmode>mode);
13823 if (<MODE>mode == SImode)
13824 emit_insn (gen_vec_extract_lo_v8si (tmp, gen_lowpart (V8SImode,
13827 emit_insn (gen_vec_extract_lo_v4di (tmp, gen_lowpart (V4DImode,
13832 operands[1] = gen_lowpart (<ssevecmode>mode, operands[1]);
13837 (define_insn "*vec_concatv2si_sse4_1"
13838 [(set (match_operand:V2SI 0 "register_operand"
13839 "=Yr,*x, x, v,Yr,*x, v, v, *y,*y")
13841 (match_operand:SI 1 "nonimmediate_operand"
13842 " 0, 0, x,Yv, 0, 0,Yv,rm, 0,rm")
13843 (match_operand:SI 2 "vector_move_operand"
13844 " rm,rm,rm,rm,Yr,*x,Yv, C,*ym, C")))]
13845 "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
13847 pinsrd\t{$1, %2, %0|%0, %2, 1}
13848 pinsrd\t{$1, %2, %0|%0, %2, 1}
13849 vpinsrd\t{$1, %2, %1, %0|%0, %1, %2, 1}
13850 vpinsrd\t{$1, %2, %1, %0|%0, %1, %2, 1}
13851 punpckldq\t{%2, %0|%0, %2}
13852 punpckldq\t{%2, %0|%0, %2}
13853 vpunpckldq\t{%2, %1, %0|%0, %1, %2}
13854 %vmovd\t{%1, %0|%0, %1}
13855 punpckldq\t{%2, %0|%0, %2}
13856 movd\t{%1, %0|%0, %1}"
13857 [(set_attr "isa" "noavx,noavx,avx,avx512dq,noavx,noavx,avx,*,*,*")
13859 (cond [(eq_attr "alternative" "7")
13860 (const_string "ssemov")
13861 (eq_attr "alternative" "8")
13862 (const_string "mmxcvt")
13863 (eq_attr "alternative" "9")
13864 (const_string "mmxmov")
13866 (const_string "sselog")))
13867 (set (attr "prefix_extra")
13868 (if_then_else (eq_attr "alternative" "0,1,2,3")
13870 (const_string "*")))
13871 (set (attr "length_immediate")
13872 (if_then_else (eq_attr "alternative" "0,1,2,3")
13874 (const_string "*")))
13875 (set_attr "prefix" "orig,orig,vex,evex,orig,orig,maybe_evex,maybe_vex,orig,orig")
13876 (set_attr "mode" "TI,TI,TI,TI,TI,TI,TI,TI,DI,DI")])
13878 ;; ??? In theory we can match memory for the MMX alternative, but allowing
13879 ;; nonimmediate_operand for operand 2 and *not* allowing memory for the SSE
13880 ;; alternatives pretty much forces the MMX alternative to be chosen.
13881 (define_insn "*vec_concatv2si"
13882 [(set (match_operand:V2SI 0 "register_operand" "=x,x ,*y,x,x,*y,*y")
13884 (match_operand:SI 1 "nonimmediate_operand" " 0,rm,rm,0,m, 0,*rm")
13885 (match_operand:SI 2 "reg_or_0_operand" " x,C ,C, x,C,*y,C")))]
13886 "TARGET_SSE && !TARGET_SSE4_1"
13888 punpckldq\t{%2, %0|%0, %2}
13889 movd\t{%1, %0|%0, %1}
13890 movd\t{%1, %0|%0, %1}
13891 unpcklps\t{%2, %0|%0, %2}
13892 movss\t{%1, %0|%0, %1}
13893 punpckldq\t{%2, %0|%0, %2}
13894 movd\t{%1, %0|%0, %1}"
13895 [(set_attr "isa" "sse2,sse2,sse2,*,*,*,*")
13896 (set_attr "type" "sselog,ssemov,mmxmov,sselog,ssemov,mmxcvt,mmxmov")
13897 (set_attr "mode" "TI,TI,DI,V4SF,SF,DI,DI")])
13899 (define_insn "*vec_concatv4si"
13900 [(set (match_operand:V4SI 0 "register_operand" "=x,v,x,x,v")
13902 (match_operand:V2SI 1 "register_operand" " 0,v,0,0,v")
13903 (match_operand:V2SI 2 "nonimmediate_operand" " x,v,x,m,m")))]
13906 punpcklqdq\t{%2, %0|%0, %2}
13907 vpunpcklqdq\t{%2, %1, %0|%0, %1, %2}
13908 movlhps\t{%2, %0|%0, %2}
13909 movhps\t{%2, %0|%0, %q2}
13910 vmovhps\t{%2, %1, %0|%0, %1, %q2}"
13911 [(set_attr "isa" "sse2_noavx,avx,noavx,noavx,avx")
13912 (set_attr "type" "sselog,sselog,ssemov,ssemov,ssemov")
13913 (set_attr "prefix" "orig,maybe_evex,orig,orig,maybe_evex")
13914 (set_attr "mode" "TI,TI,V4SF,V2SF,V2SF")])
13916 ;; movd instead of movq is required to handle broken assemblers.
13917 (define_insn "vec_concatv2di"
13918 [(set (match_operand:V2DI 0 "register_operand"
13919 "=Yr,*x,x ,v ,Yi,v ,x ,x,v ,x,x,v")
13921 (match_operand:DI 1 "nonimmediate_operand"
13922 " 0, 0,x ,Yv,r ,vm,?!*Yn,0,Yv,0,0,v")
13923 (match_operand:DI 2 "vector_move_operand"
13924 " rm,rm,rm,rm,C ,C ,C ,x,Yv,x,m,m")))]
13927 pinsrq\t{$1, %2, %0|%0, %2, 1}
13928 pinsrq\t{$1, %2, %0|%0, %2, 1}
13929 vpinsrq\t{$1, %2, %1, %0|%0, %1, %2, 1}
13930 vpinsrq\t{$1, %2, %1, %0|%0, %1, %2, 1}
13931 * return HAVE_AS_IX86_INTERUNIT_MOVQ ? \"%vmovq\t{%1, %0|%0, %1}\" : \"%vmovd\t{%1, %0|%0, %1}\";
13932 %vmovq\t{%1, %0|%0, %1}
13933 movq2dq\t{%1, %0|%0, %1}
13934 punpcklqdq\t{%2, %0|%0, %2}
13935 vpunpcklqdq\t{%2, %1, %0|%0, %1, %2}
13936 movlhps\t{%2, %0|%0, %2}
13937 movhps\t{%2, %0|%0, %2}
13938 vmovhps\t{%2, %1, %0|%0, %1, %2}"
13940 (cond [(eq_attr "alternative" "0,1")
13941 (const_string "x64_sse4_noavx")
13942 (eq_attr "alternative" "2")
13943 (const_string "x64_avx")
13944 (eq_attr "alternative" "3")
13945 (const_string "x64_avx512dq")
13946 (eq_attr "alternative" "4")
13947 (const_string "x64")
13948 (eq_attr "alternative" "5,6")
13949 (const_string "sse2")
13950 (eq_attr "alternative" "7")
13951 (const_string "sse2_noavx")
13952 (eq_attr "alternative" "8,11")
13953 (const_string "avx")
13955 (const_string "noavx")))
13958 (eq_attr "alternative" "0,1,2,3,7,8")
13959 (const_string "sselog")
13960 (const_string "ssemov")))
13961 (set (attr "prefix_rex")
13962 (if_then_else (eq_attr "alternative" "0,1,2,3,4")
13964 (const_string "*")))
13965 (set (attr "prefix_extra")
13966 (if_then_else (eq_attr "alternative" "0,1,2,3")
13968 (const_string "*")))
13969 (set (attr "length_immediate")
13970 (if_then_else (eq_attr "alternative" "0,1,2,3")
13972 (const_string "*")))
13973 (set (attr "prefix")
13974 (cond [(eq_attr "alternative" "2")
13975 (const_string "vex")
13976 (eq_attr "alternative" "3")
13977 (const_string "evex")
13978 (eq_attr "alternative" "4,5")
13979 (const_string "maybe_vex")
13980 (eq_attr "alternative" "8,11")
13981 (const_string "maybe_evex")
13983 (const_string "orig")))
13984 (set_attr "mode" "TI,TI,TI,TI,TI,TI,TI,TI,TI,V4SF,V2SF,V2SF")])
13986 (define_expand "vec_unpacks_lo_<mode>"
13987 [(match_operand:<sseunpackmode> 0 "register_operand")
13988 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
13990 "ix86_expand_sse_unpack (operands[0], operands[1], false, false); DONE;")
13992 (define_expand "vec_unpacks_hi_<mode>"
13993 [(match_operand:<sseunpackmode> 0 "register_operand")
13994 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
13996 "ix86_expand_sse_unpack (operands[0], operands[1], false, true); DONE;")
13998 (define_expand "vec_unpacku_lo_<mode>"
13999 [(match_operand:<sseunpackmode> 0 "register_operand")
14000 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
14002 "ix86_expand_sse_unpack (operands[0], operands[1], true, false); DONE;")
14004 (define_expand "vec_unpacks_lo_hi"
14005 [(set (subreg:HI (match_operand:QI 0 "register_operand") 0)
14006 (match_operand:HI 1 "register_operand"))]
14009 (define_expand "vec_unpacks_lo_si"
14010 [(set (match_operand:HI 0 "register_operand")
14011 (subreg:HI (match_operand:SI 1 "register_operand") 0))]
14014 (define_expand "vec_unpacks_lo_di"
14015 [(set (match_operand:SI 0 "register_operand")
14016 (subreg:SI (match_operand:DI 1 "register_operand") 0))]
14019 (define_expand "vec_unpacku_hi_<mode>"
14020 [(match_operand:<sseunpackmode> 0 "register_operand")
14021 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
14023 "ix86_expand_sse_unpack (operands[0], operands[1], true, true); DONE;")
14025 (define_expand "vec_unpacks_hi_hi"
14027 [(set (subreg:HI (match_operand:QI 0 "register_operand") 0)
14028 (lshiftrt:HI (match_operand:HI 1 "register_operand")
14030 (unspec [(const_int 0)] UNSPEC_MASKOP)])]
14033 (define_expand "vec_unpacks_hi_<mode>"
14035 [(set (subreg:SWI48x
14036 (match_operand:<HALFMASKMODE> 0 "register_operand") 0)
14037 (lshiftrt:SWI48x (match_operand:SWI48x 1 "register_operand")
14039 (unspec [(const_int 0)] UNSPEC_MASKOP)])]
14041 "operands[2] = GEN_INT (GET_MODE_BITSIZE (<HALFMASKMODE>mode));")
14043 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14047 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14049 (define_expand "<sse2_avx2>_uavg<mode>3<mask_name>"
14050 [(set (match_operand:VI12_AVX2 0 "register_operand")
14051 (truncate:VI12_AVX2
14052 (lshiftrt:<ssedoublemode>
14053 (plus:<ssedoublemode>
14054 (plus:<ssedoublemode>
14055 (zero_extend:<ssedoublemode>
14056 (match_operand:VI12_AVX2 1 "vector_operand"))
14057 (zero_extend:<ssedoublemode>
14058 (match_operand:VI12_AVX2 2 "vector_operand")))
14059 (match_dup <mask_expand_op3>))
14061 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
14064 if (<mask_applied>)
14066 operands[3] = CONST1_RTX(<MODE>mode);
14067 ix86_fixup_binary_operands_no_copy (PLUS, <MODE>mode, operands);
14069 if (<mask_applied>)
14071 operands[5] = operands[3];
14076 (define_insn "*<sse2_avx2>_uavg<mode>3<mask_name>"
14077 [(set (match_operand:VI12_AVX2 0 "register_operand" "=x,v")
14078 (truncate:VI12_AVX2
14079 (lshiftrt:<ssedoublemode>
14080 (plus:<ssedoublemode>
14081 (plus:<ssedoublemode>
14082 (zero_extend:<ssedoublemode>
14083 (match_operand:VI12_AVX2 1 "vector_operand" "%0,v"))
14084 (zero_extend:<ssedoublemode>
14085 (match_operand:VI12_AVX2 2 "vector_operand" "xBm,vm")))
14086 (match_operand:VI12_AVX2 <mask_expand_op3> "const1_operand"))
14088 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>
14089 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
14091 pavg<ssemodesuffix>\t{%2, %0|%0, %2}
14092 vpavg<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
14093 [(set_attr "isa" "noavx,avx")
14094 (set_attr "type" "sseiadd")
14095 (set_attr "prefix_data16" "1,*")
14096 (set_attr "prefix" "orig,<mask_prefix>")
14097 (set_attr "mode" "<sseinsnmode>")])
14099 ;; The correct representation for this is absolutely enormous, and
14100 ;; surely not generally useful.
14101 (define_insn "<sse2_avx2>_psadbw"
14102 [(set (match_operand:VI8_AVX2_AVX512BW 0 "register_operand" "=x,v")
14103 (unspec:VI8_AVX2_AVX512BW
14104 [(match_operand:<ssebytemode> 1 "register_operand" "0,v")
14105 (match_operand:<ssebytemode> 2 "vector_operand" "xBm,vm")]
14109 psadbw\t{%2, %0|%0, %2}
14110 vpsadbw\t{%2, %1, %0|%0, %1, %2}"
14111 [(set_attr "isa" "noavx,avx")
14112 (set_attr "type" "sseiadd")
14113 (set_attr "atom_unit" "simul")
14114 (set_attr "prefix_data16" "1,*")
14115 (set_attr "prefix" "orig,maybe_evex")
14116 (set_attr "mode" "<sseinsnmode>")])
14118 (define_insn "<sse>_movmsk<ssemodesuffix><avxsizesuffix>"
14119 [(set (match_operand:SI 0 "register_operand" "=r")
14121 [(match_operand:VF_128_256 1 "register_operand" "x")]
14124 "%vmovmsk<ssemodesuffix>\t{%1, %0|%0, %1}"
14125 [(set_attr "type" "ssemov")
14126 (set_attr "prefix" "maybe_vex")
14127 (set_attr "mode" "<MODE>")])
14129 (define_insn "*<sse>_movmsk<ssemodesuffix><avxsizesuffix>_zext"
14130 [(set (match_operand:DI 0 "register_operand" "=r")
14133 [(match_operand:VF_128_256 1 "register_operand" "x")]
14135 "TARGET_64BIT && TARGET_SSE"
14136 "%vmovmsk<ssemodesuffix>\t{%1, %k0|%k0, %1}"
14137 [(set_attr "type" "ssemov")
14138 (set_attr "prefix" "maybe_vex")
14139 (set_attr "mode" "<MODE>")])
14141 (define_insn "<sse2_avx2>_pmovmskb"
14142 [(set (match_operand:SI 0 "register_operand" "=r")
14144 [(match_operand:VI1_AVX2 1 "register_operand" "x")]
14147 "%vpmovmskb\t{%1, %0|%0, %1}"
14148 [(set_attr "type" "ssemov")
14149 (set (attr "prefix_data16")
14151 (match_test "TARGET_AVX")
14153 (const_string "1")))
14154 (set_attr "prefix" "maybe_vex")
14155 (set_attr "mode" "SI")])
14157 (define_insn "*<sse2_avx2>_pmovmskb_zext"
14158 [(set (match_operand:DI 0 "register_operand" "=r")
14161 [(match_operand:VI1_AVX2 1 "register_operand" "x")]
14163 "TARGET_64BIT && TARGET_SSE2"
14164 "%vpmovmskb\t{%1, %k0|%k0, %1}"
14165 [(set_attr "type" "ssemov")
14166 (set (attr "prefix_data16")
14168 (match_test "TARGET_AVX")
14170 (const_string "1")))
14171 (set_attr "prefix" "maybe_vex")
14172 (set_attr "mode" "SI")])
14174 (define_expand "sse2_maskmovdqu"
14175 [(set (match_operand:V16QI 0 "memory_operand")
14176 (unspec:V16QI [(match_operand:V16QI 1 "register_operand")
14177 (match_operand:V16QI 2 "register_operand")
14182 (define_insn "*sse2_maskmovdqu"
14183 [(set (mem:V16QI (match_operand:P 0 "register_operand" "D"))
14184 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "x")
14185 (match_operand:V16QI 2 "register_operand" "x")
14186 (mem:V16QI (match_dup 0))]
14190 /* We can't use %^ here due to ASM_OUTPUT_OPCODE processing
14191 that requires %v to be at the beginning of the opcode name. */
14192 if (Pmode != word_mode)
14193 fputs ("\taddr32", asm_out_file);
14194 return "%vmaskmovdqu\t{%2, %1|%1, %2}";
14196 [(set_attr "type" "ssemov")
14197 (set_attr "prefix_data16" "1")
14198 (set (attr "length_address")
14199 (symbol_ref ("Pmode != word_mode")))
14200 ;; The implicit %rdi operand confuses default length_vex computation.
14201 (set (attr "length_vex")
14202 (symbol_ref ("3 + REX_SSE_REGNO_P (REGNO (operands[2]))")))
14203 (set_attr "prefix" "maybe_vex")
14204 (set_attr "znver1_decode" "vector")
14205 (set_attr "mode" "TI")])
14207 (define_insn "sse_ldmxcsr"
14208 [(unspec_volatile [(match_operand:SI 0 "memory_operand" "m")]
14212 [(set_attr "type" "sse")
14213 (set_attr "atom_sse_attr" "mxcsr")
14214 (set_attr "prefix" "maybe_vex")
14215 (set_attr "memory" "load")])
14217 (define_insn "sse_stmxcsr"
14218 [(set (match_operand:SI 0 "memory_operand" "=m")
14219 (unspec_volatile:SI [(const_int 0)] UNSPECV_STMXCSR))]
14222 [(set_attr "type" "sse")
14223 (set_attr "atom_sse_attr" "mxcsr")
14224 (set_attr "prefix" "maybe_vex")
14225 (set_attr "memory" "store")])
14227 (define_insn "sse2_clflush"
14228 [(unspec_volatile [(match_operand 0 "address_operand" "p")]
14232 [(set_attr "type" "sse")
14233 (set_attr "atom_sse_attr" "fence")
14234 (set_attr "memory" "unknown")])
14236 ;; As per AMD and Intel ISA manuals, the first operand is extensions
14237 ;; and it goes to %ecx. The second operand received is hints and it goes
14239 (define_insn "sse3_mwait"
14240 [(unspec_volatile [(match_operand:SI 0 "register_operand" "c")
14241 (match_operand:SI 1 "register_operand" "a")]
14244 ;; 64bit version is "mwait %rax,%rcx". But only lower 32bits are used.
14245 ;; Since 32bit register operands are implicitly zero extended to 64bit,
14246 ;; we only need to set up 32bit registers.
14248 [(set_attr "length" "3")])
14250 (define_insn "sse3_monitor_<mode>"
14251 [(unspec_volatile [(match_operand:P 0 "register_operand" "a")
14252 (match_operand:SI 1 "register_operand" "c")
14253 (match_operand:SI 2 "register_operand" "d")]
14256 ;; 64bit version is "monitor %rax,%rcx,%rdx". But only lower 32bits in
14257 ;; RCX and RDX are used. Since 32bit register operands are implicitly
14258 ;; zero extended to 64bit, we only need to set up 32bit registers.
14260 [(set (attr "length")
14261 (symbol_ref ("(Pmode != word_mode) + 3")))])
14263 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14265 ;; SSSE3 instructions
14267 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14269 (define_code_iterator ssse3_plusminus [plus ss_plus minus ss_minus])
14271 (define_insn "avx2_ph<plusminus_mnemonic>wv16hi3"
14272 [(set (match_operand:V16HI 0 "register_operand" "=x")
14277 (ssse3_plusminus:HI
14279 (match_operand:V16HI 1 "register_operand" "x")
14280 (parallel [(const_int 0)]))
14281 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
14282 (ssse3_plusminus:HI
14283 (vec_select:HI (match_dup 1) (parallel [(const_int 2)]))
14284 (vec_select:HI (match_dup 1) (parallel [(const_int 3)]))))
14286 (ssse3_plusminus:HI
14287 (vec_select:HI (match_dup 1) (parallel [(const_int 4)]))
14288 (vec_select:HI (match_dup 1) (parallel [(const_int 5)])))
14289 (ssse3_plusminus:HI
14290 (vec_select:HI (match_dup 1) (parallel [(const_int 6)]))
14291 (vec_select:HI (match_dup 1) (parallel [(const_int 7)])))))
14294 (ssse3_plusminus:HI
14295 (vec_select:HI (match_dup 1) (parallel [(const_int 8)]))
14296 (vec_select:HI (match_dup 1) (parallel [(const_int 9)])))
14297 (ssse3_plusminus:HI
14298 (vec_select:HI (match_dup 1) (parallel [(const_int 10)]))
14299 (vec_select:HI (match_dup 1) (parallel [(const_int 11)]))))
14301 (ssse3_plusminus:HI
14302 (vec_select:HI (match_dup 1) (parallel [(const_int 12)]))
14303 (vec_select:HI (match_dup 1) (parallel [(const_int 13)])))
14304 (ssse3_plusminus:HI
14305 (vec_select:HI (match_dup 1) (parallel [(const_int 14)]))
14306 (vec_select:HI (match_dup 1) (parallel [(const_int 15)]))))))
14310 (ssse3_plusminus:HI
14312 (match_operand:V16HI 2 "nonimmediate_operand" "xm")
14313 (parallel [(const_int 0)]))
14314 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))
14315 (ssse3_plusminus:HI
14316 (vec_select:HI (match_dup 2) (parallel [(const_int 2)]))
14317 (vec_select:HI (match_dup 2) (parallel [(const_int 3)]))))
14319 (ssse3_plusminus:HI
14320 (vec_select:HI (match_dup 2) (parallel [(const_int 4)]))
14321 (vec_select:HI (match_dup 2) (parallel [(const_int 5)])))
14322 (ssse3_plusminus:HI
14323 (vec_select:HI (match_dup 2) (parallel [(const_int 6)]))
14324 (vec_select:HI (match_dup 2) (parallel [(const_int 7)])))))
14327 (ssse3_plusminus:HI
14328 (vec_select:HI (match_dup 2) (parallel [(const_int 8)]))
14329 (vec_select:HI (match_dup 2) (parallel [(const_int 9)])))
14330 (ssse3_plusminus:HI
14331 (vec_select:HI (match_dup 2) (parallel [(const_int 10)]))
14332 (vec_select:HI (match_dup 2) (parallel [(const_int 11)]))))
14334 (ssse3_plusminus:HI
14335 (vec_select:HI (match_dup 2) (parallel [(const_int 12)]))
14336 (vec_select:HI (match_dup 2) (parallel [(const_int 13)])))
14337 (ssse3_plusminus:HI
14338 (vec_select:HI (match_dup 2) (parallel [(const_int 14)]))
14339 (vec_select:HI (match_dup 2) (parallel [(const_int 15)]))))))))]
14341 "vph<plusminus_mnemonic>w\t{%2, %1, %0|%0, %1, %2}"
14342 [(set_attr "type" "sseiadd")
14343 (set_attr "prefix_extra" "1")
14344 (set_attr "prefix" "vex")
14345 (set_attr "mode" "OI")])
14347 (define_insn "ssse3_ph<plusminus_mnemonic>wv8hi3"
14348 [(set (match_operand:V8HI 0 "register_operand" "=x,x")
14352 (ssse3_plusminus:HI
14354 (match_operand:V8HI 1 "register_operand" "0,x")
14355 (parallel [(const_int 0)]))
14356 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
14357 (ssse3_plusminus:HI
14358 (vec_select:HI (match_dup 1) (parallel [(const_int 2)]))
14359 (vec_select:HI (match_dup 1) (parallel [(const_int 3)]))))
14361 (ssse3_plusminus:HI
14362 (vec_select:HI (match_dup 1) (parallel [(const_int 4)]))
14363 (vec_select:HI (match_dup 1) (parallel [(const_int 5)])))
14364 (ssse3_plusminus:HI
14365 (vec_select:HI (match_dup 1) (parallel [(const_int 6)]))
14366 (vec_select:HI (match_dup 1) (parallel [(const_int 7)])))))
14369 (ssse3_plusminus:HI
14371 (match_operand:V8HI 2 "vector_operand" "xBm,xm")
14372 (parallel [(const_int 0)]))
14373 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))
14374 (ssse3_plusminus:HI
14375 (vec_select:HI (match_dup 2) (parallel [(const_int 2)]))
14376 (vec_select:HI (match_dup 2) (parallel [(const_int 3)]))))
14378 (ssse3_plusminus:HI
14379 (vec_select:HI (match_dup 2) (parallel [(const_int 4)]))
14380 (vec_select:HI (match_dup 2) (parallel [(const_int 5)])))
14381 (ssse3_plusminus:HI
14382 (vec_select:HI (match_dup 2) (parallel [(const_int 6)]))
14383 (vec_select:HI (match_dup 2) (parallel [(const_int 7)])))))))]
14386 ph<plusminus_mnemonic>w\t{%2, %0|%0, %2}
14387 vph<plusminus_mnemonic>w\t{%2, %1, %0|%0, %1, %2}"
14388 [(set_attr "isa" "noavx,avx")
14389 (set_attr "type" "sseiadd")
14390 (set_attr "atom_unit" "complex")
14391 (set_attr "prefix_data16" "1,*")
14392 (set_attr "prefix_extra" "1")
14393 (set_attr "prefix" "orig,vex")
14394 (set_attr "mode" "TI")])
14396 (define_insn "ssse3_ph<plusminus_mnemonic>wv4hi3"
14397 [(set (match_operand:V4HI 0 "register_operand" "=y")
14400 (ssse3_plusminus:HI
14402 (match_operand:V4HI 1 "register_operand" "0")
14403 (parallel [(const_int 0)]))
14404 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
14405 (ssse3_plusminus:HI
14406 (vec_select:HI (match_dup 1) (parallel [(const_int 2)]))
14407 (vec_select:HI (match_dup 1) (parallel [(const_int 3)]))))
14409 (ssse3_plusminus:HI
14411 (match_operand:V4HI 2 "nonimmediate_operand" "ym")
14412 (parallel [(const_int 0)]))
14413 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))
14414 (ssse3_plusminus:HI
14415 (vec_select:HI (match_dup 2) (parallel [(const_int 2)]))
14416 (vec_select:HI (match_dup 2) (parallel [(const_int 3)]))))))]
14418 "ph<plusminus_mnemonic>w\t{%2, %0|%0, %2}"
14419 [(set_attr "type" "sseiadd")
14420 (set_attr "atom_unit" "complex")
14421 (set_attr "prefix_extra" "1")
14422 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14423 (set_attr "mode" "DI")])
14425 (define_insn "avx2_ph<plusminus_mnemonic>dv8si3"
14426 [(set (match_operand:V8SI 0 "register_operand" "=x")
14432 (match_operand:V8SI 1 "register_operand" "x")
14433 (parallel [(const_int 0)]))
14434 (vec_select:SI (match_dup 1) (parallel [(const_int 1)])))
14436 (vec_select:SI (match_dup 1) (parallel [(const_int 2)]))
14437 (vec_select:SI (match_dup 1) (parallel [(const_int 3)]))))
14440 (vec_select:SI (match_dup 1) (parallel [(const_int 4)]))
14441 (vec_select:SI (match_dup 1) (parallel [(const_int 5)])))
14443 (vec_select:SI (match_dup 1) (parallel [(const_int 6)]))
14444 (vec_select:SI (match_dup 1) (parallel [(const_int 7)])))))
14449 (match_operand:V8SI 2 "nonimmediate_operand" "xm")
14450 (parallel [(const_int 0)]))
14451 (vec_select:SI (match_dup 2) (parallel [(const_int 1)])))
14453 (vec_select:SI (match_dup 2) (parallel [(const_int 2)]))
14454 (vec_select:SI (match_dup 2) (parallel [(const_int 3)]))))
14457 (vec_select:SI (match_dup 2) (parallel [(const_int 4)]))
14458 (vec_select:SI (match_dup 2) (parallel [(const_int 5)])))
14460 (vec_select:SI (match_dup 2) (parallel [(const_int 6)]))
14461 (vec_select:SI (match_dup 2) (parallel [(const_int 7)])))))))]
14463 "vph<plusminus_mnemonic>d\t{%2, %1, %0|%0, %1, %2}"
14464 [(set_attr "type" "sseiadd")
14465 (set_attr "prefix_extra" "1")
14466 (set_attr "prefix" "vex")
14467 (set_attr "mode" "OI")])
14469 (define_insn "ssse3_ph<plusminus_mnemonic>dv4si3"
14470 [(set (match_operand:V4SI 0 "register_operand" "=x,x")
14475 (match_operand:V4SI 1 "register_operand" "0,x")
14476 (parallel [(const_int 0)]))
14477 (vec_select:SI (match_dup 1) (parallel [(const_int 1)])))
14479 (vec_select:SI (match_dup 1) (parallel [(const_int 2)]))
14480 (vec_select:SI (match_dup 1) (parallel [(const_int 3)]))))
14484 (match_operand:V4SI 2 "vector_operand" "xBm,xm")
14485 (parallel [(const_int 0)]))
14486 (vec_select:SI (match_dup 2) (parallel [(const_int 1)])))
14488 (vec_select:SI (match_dup 2) (parallel [(const_int 2)]))
14489 (vec_select:SI (match_dup 2) (parallel [(const_int 3)]))))))]
14492 ph<plusminus_mnemonic>d\t{%2, %0|%0, %2}
14493 vph<plusminus_mnemonic>d\t{%2, %1, %0|%0, %1, %2}"
14494 [(set_attr "isa" "noavx,avx")
14495 (set_attr "type" "sseiadd")
14496 (set_attr "atom_unit" "complex")
14497 (set_attr "prefix_data16" "1,*")
14498 (set_attr "prefix_extra" "1")
14499 (set_attr "prefix" "orig,vex")
14500 (set_attr "mode" "TI")])
14502 (define_insn "ssse3_ph<plusminus_mnemonic>dv2si3"
14503 [(set (match_operand:V2SI 0 "register_operand" "=y")
14507 (match_operand:V2SI 1 "register_operand" "0")
14508 (parallel [(const_int 0)]))
14509 (vec_select:SI (match_dup 1) (parallel [(const_int 1)])))
14512 (match_operand:V2SI 2 "nonimmediate_operand" "ym")
14513 (parallel [(const_int 0)]))
14514 (vec_select:SI (match_dup 2) (parallel [(const_int 1)])))))]
14516 "ph<plusminus_mnemonic>d\t{%2, %0|%0, %2}"
14517 [(set_attr "type" "sseiadd")
14518 (set_attr "atom_unit" "complex")
14519 (set_attr "prefix_extra" "1")
14520 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14521 (set_attr "mode" "DI")])
14523 (define_insn "avx2_pmaddubsw256"
14524 [(set (match_operand:V16HI 0 "register_operand" "=x,v")
14529 (match_operand:V32QI 1 "register_operand" "x,v")
14530 (parallel [(const_int 0) (const_int 2)
14531 (const_int 4) (const_int 6)
14532 (const_int 8) (const_int 10)
14533 (const_int 12) (const_int 14)
14534 (const_int 16) (const_int 18)
14535 (const_int 20) (const_int 22)
14536 (const_int 24) (const_int 26)
14537 (const_int 28) (const_int 30)])))
14540 (match_operand:V32QI 2 "nonimmediate_operand" "xm,vm")
14541 (parallel [(const_int 0) (const_int 2)
14542 (const_int 4) (const_int 6)
14543 (const_int 8) (const_int 10)
14544 (const_int 12) (const_int 14)
14545 (const_int 16) (const_int 18)
14546 (const_int 20) (const_int 22)
14547 (const_int 24) (const_int 26)
14548 (const_int 28) (const_int 30)]))))
14551 (vec_select:V16QI (match_dup 1)
14552 (parallel [(const_int 1) (const_int 3)
14553 (const_int 5) (const_int 7)
14554 (const_int 9) (const_int 11)
14555 (const_int 13) (const_int 15)
14556 (const_int 17) (const_int 19)
14557 (const_int 21) (const_int 23)
14558 (const_int 25) (const_int 27)
14559 (const_int 29) (const_int 31)])))
14561 (vec_select:V16QI (match_dup 2)
14562 (parallel [(const_int 1) (const_int 3)
14563 (const_int 5) (const_int 7)
14564 (const_int 9) (const_int 11)
14565 (const_int 13) (const_int 15)
14566 (const_int 17) (const_int 19)
14567 (const_int 21) (const_int 23)
14568 (const_int 25) (const_int 27)
14569 (const_int 29) (const_int 31)]))))))]
14571 "vpmaddubsw\t{%2, %1, %0|%0, %1, %2}"
14572 [(set_attr "isa" "*,avx512bw")
14573 (set_attr "type" "sseiadd")
14574 (set_attr "prefix_extra" "1")
14575 (set_attr "prefix" "vex,evex")
14576 (set_attr "mode" "OI")])
14578 ;; The correct representation for this is absolutely enormous, and
14579 ;; surely not generally useful.
14580 (define_insn "avx512bw_pmaddubsw512<mode><mask_name>"
14581 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
14582 (unspec:VI2_AVX512VL
14583 [(match_operand:<dbpsadbwmode> 1 "register_operand" "v")
14584 (match_operand:<dbpsadbwmode> 2 "nonimmediate_operand" "vm")]
14585 UNSPEC_PMADDUBSW512))]
14587 "vpmaddubsw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}";
14588 [(set_attr "type" "sseiadd")
14589 (set_attr "prefix" "evex")
14590 (set_attr "mode" "XI")])
14592 (define_insn "avx512bw_umulhrswv32hi3<mask_name>"
14593 [(set (match_operand:V32HI 0 "register_operand" "=v")
14600 (match_operand:V32HI 1 "nonimmediate_operand" "%v"))
14602 (match_operand:V32HI 2 "nonimmediate_operand" "vm")))
14604 (const_vector:V32HI [(const_int 1) (const_int 1)
14605 (const_int 1) (const_int 1)
14606 (const_int 1) (const_int 1)
14607 (const_int 1) (const_int 1)
14608 (const_int 1) (const_int 1)
14609 (const_int 1) (const_int 1)
14610 (const_int 1) (const_int 1)
14611 (const_int 1) (const_int 1)
14612 (const_int 1) (const_int 1)
14613 (const_int 1) (const_int 1)
14614 (const_int 1) (const_int 1)
14615 (const_int 1) (const_int 1)
14616 (const_int 1) (const_int 1)
14617 (const_int 1) (const_int 1)
14618 (const_int 1) (const_int 1)
14619 (const_int 1) (const_int 1)]))
14622 "vpmulhrsw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
14623 [(set_attr "type" "sseimul")
14624 (set_attr "prefix" "evex")
14625 (set_attr "mode" "XI")])
14627 (define_insn "ssse3_pmaddubsw128"
14628 [(set (match_operand:V8HI 0 "register_operand" "=x,x,v")
14633 (match_operand:V16QI 1 "register_operand" "0,x,v")
14634 (parallel [(const_int 0) (const_int 2)
14635 (const_int 4) (const_int 6)
14636 (const_int 8) (const_int 10)
14637 (const_int 12) (const_int 14)])))
14640 (match_operand:V16QI 2 "vector_operand" "xBm,xm,vm")
14641 (parallel [(const_int 0) (const_int 2)
14642 (const_int 4) (const_int 6)
14643 (const_int 8) (const_int 10)
14644 (const_int 12) (const_int 14)]))))
14647 (vec_select:V8QI (match_dup 1)
14648 (parallel [(const_int 1) (const_int 3)
14649 (const_int 5) (const_int 7)
14650 (const_int 9) (const_int 11)
14651 (const_int 13) (const_int 15)])))
14653 (vec_select:V8QI (match_dup 2)
14654 (parallel [(const_int 1) (const_int 3)
14655 (const_int 5) (const_int 7)
14656 (const_int 9) (const_int 11)
14657 (const_int 13) (const_int 15)]))))))]
14660 pmaddubsw\t{%2, %0|%0, %2}
14661 vpmaddubsw\t{%2, %1, %0|%0, %1, %2}
14662 vpmaddubsw\t{%2, %1, %0|%0, %1, %2}"
14663 [(set_attr "isa" "noavx,avx,avx512bw")
14664 (set_attr "type" "sseiadd")
14665 (set_attr "atom_unit" "simul")
14666 (set_attr "prefix_data16" "1,*,*")
14667 (set_attr "prefix_extra" "1")
14668 (set_attr "prefix" "orig,vex,evex")
14669 (set_attr "mode" "TI")])
14671 (define_insn "ssse3_pmaddubsw"
14672 [(set (match_operand:V4HI 0 "register_operand" "=y")
14677 (match_operand:V8QI 1 "register_operand" "0")
14678 (parallel [(const_int 0) (const_int 2)
14679 (const_int 4) (const_int 6)])))
14682 (match_operand:V8QI 2 "nonimmediate_operand" "ym")
14683 (parallel [(const_int 0) (const_int 2)
14684 (const_int 4) (const_int 6)]))))
14687 (vec_select:V4QI (match_dup 1)
14688 (parallel [(const_int 1) (const_int 3)
14689 (const_int 5) (const_int 7)])))
14691 (vec_select:V4QI (match_dup 2)
14692 (parallel [(const_int 1) (const_int 3)
14693 (const_int 5) (const_int 7)]))))))]
14695 "pmaddubsw\t{%2, %0|%0, %2}"
14696 [(set_attr "type" "sseiadd")
14697 (set_attr "atom_unit" "simul")
14698 (set_attr "prefix_extra" "1")
14699 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14700 (set_attr "mode" "DI")])
14702 (define_mode_iterator PMULHRSW
14703 [V4HI V8HI (V16HI "TARGET_AVX2")])
14705 (define_expand "<ssse3_avx2>_pmulhrsw<mode>3_mask"
14706 [(set (match_operand:PMULHRSW 0 "register_operand")
14707 (vec_merge:PMULHRSW
14709 (lshiftrt:<ssedoublemode>
14710 (plus:<ssedoublemode>
14711 (lshiftrt:<ssedoublemode>
14712 (mult:<ssedoublemode>
14713 (sign_extend:<ssedoublemode>
14714 (match_operand:PMULHRSW 1 "nonimmediate_operand"))
14715 (sign_extend:<ssedoublemode>
14716 (match_operand:PMULHRSW 2 "nonimmediate_operand")))
14720 (match_operand:PMULHRSW 3 "register_operand")
14721 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
14722 "TARGET_AVX512BW && TARGET_AVX512VL"
14724 operands[5] = CONST1_RTX(<MODE>mode);
14725 ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);
14728 (define_expand "<ssse3_avx2>_pmulhrsw<mode>3"
14729 [(set (match_operand:PMULHRSW 0 "register_operand")
14731 (lshiftrt:<ssedoublemode>
14732 (plus:<ssedoublemode>
14733 (lshiftrt:<ssedoublemode>
14734 (mult:<ssedoublemode>
14735 (sign_extend:<ssedoublemode>
14736 (match_operand:PMULHRSW 1 "nonimmediate_operand"))
14737 (sign_extend:<ssedoublemode>
14738 (match_operand:PMULHRSW 2 "nonimmediate_operand")))
14744 operands[3] = CONST1_RTX(<MODE>mode);
14745 ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);
14748 (define_insn "*<ssse3_avx2>_pmulhrsw<mode>3<mask_name>"
14749 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,x,v")
14751 (lshiftrt:<ssedoublemode>
14752 (plus:<ssedoublemode>
14753 (lshiftrt:<ssedoublemode>
14754 (mult:<ssedoublemode>
14755 (sign_extend:<ssedoublemode>
14756 (match_operand:VI2_AVX2 1 "vector_operand" "%0,x,v"))
14757 (sign_extend:<ssedoublemode>
14758 (match_operand:VI2_AVX2 2 "vector_operand" "xBm,xm,vm")))
14760 (match_operand:VI2_AVX2 3 "const1_operand"))
14762 "TARGET_SSSE3 && <mask_mode512bit_condition> && <mask_avx512bw_condition>
14763 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
14765 pmulhrsw\t{%2, %0|%0, %2}
14766 vpmulhrsw\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}
14767 vpmulhrsw\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}"
14768 [(set_attr "isa" "noavx,avx,avx512bw")
14769 (set_attr "type" "sseimul")
14770 (set_attr "prefix_data16" "1,*,*")
14771 (set_attr "prefix_extra" "1")
14772 (set_attr "prefix" "orig,maybe_evex,evex")
14773 (set_attr "mode" "<sseinsnmode>")])
14775 (define_insn "*ssse3_pmulhrswv4hi3"
14776 [(set (match_operand:V4HI 0 "register_operand" "=y")
14783 (match_operand:V4HI 1 "nonimmediate_operand" "%0"))
14785 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))
14787 (match_operand:V4HI 3 "const1_operand"))
14789 "TARGET_SSSE3 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
14790 "pmulhrsw\t{%2, %0|%0, %2}"
14791 [(set_attr "type" "sseimul")
14792 (set_attr "prefix_extra" "1")
14793 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14794 (set_attr "mode" "DI")])
14796 (define_insn "<ssse3_avx2>_pshufb<mode>3<mask_name>"
14797 [(set (match_operand:VI1_AVX512 0 "register_operand" "=x,x,v")
14799 [(match_operand:VI1_AVX512 1 "register_operand" "0,x,v")
14800 (match_operand:VI1_AVX512 2 "vector_operand" "xBm,xm,vm")]
14802 "TARGET_SSSE3 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
14804 pshufb\t{%2, %0|%0, %2}
14805 vpshufb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
14806 vpshufb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
14807 [(set_attr "isa" "noavx,avx,avx512bw")
14808 (set_attr "type" "sselog1")
14809 (set_attr "prefix_data16" "1,*,*")
14810 (set_attr "prefix_extra" "1")
14811 (set_attr "prefix" "orig,maybe_evex,evex")
14812 (set_attr "btver2_decode" "vector")
14813 (set_attr "mode" "<sseinsnmode>")])
14815 (define_insn "ssse3_pshufbv8qi3"
14816 [(set (match_operand:V8QI 0 "register_operand" "=y")
14817 (unspec:V8QI [(match_operand:V8QI 1 "register_operand" "0")
14818 (match_operand:V8QI 2 "nonimmediate_operand" "ym")]
14821 "pshufb\t{%2, %0|%0, %2}";
14822 [(set_attr "type" "sselog1")
14823 (set_attr "prefix_extra" "1")
14824 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14825 (set_attr "mode" "DI")])
14827 (define_insn "<ssse3_avx2>_psign<mode>3"
14828 [(set (match_operand:VI124_AVX2 0 "register_operand" "=x,x")
14830 [(match_operand:VI124_AVX2 1 "register_operand" "0,x")
14831 (match_operand:VI124_AVX2 2 "vector_operand" "xBm,xm")]
14835 psign<ssemodesuffix>\t{%2, %0|%0, %2}
14836 vpsign<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
14837 [(set_attr "isa" "noavx,avx")
14838 (set_attr "type" "sselog1")
14839 (set_attr "prefix_data16" "1,*")
14840 (set_attr "prefix_extra" "1")
14841 (set_attr "prefix" "orig,vex")
14842 (set_attr "mode" "<sseinsnmode>")])
14844 (define_insn "ssse3_psign<mode>3"
14845 [(set (match_operand:MMXMODEI 0 "register_operand" "=y")
14847 [(match_operand:MMXMODEI 1 "register_operand" "0")
14848 (match_operand:MMXMODEI 2 "nonimmediate_operand" "ym")]
14851 "psign<mmxvecsize>\t{%2, %0|%0, %2}";
14852 [(set_attr "type" "sselog1")
14853 (set_attr "prefix_extra" "1")
14854 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14855 (set_attr "mode" "DI")])
14857 (define_insn "<ssse3_avx2>_palignr<mode>_mask"
14858 [(set (match_operand:VI1_AVX512 0 "register_operand" "=v")
14859 (vec_merge:VI1_AVX512
14861 [(match_operand:VI1_AVX512 1 "register_operand" "v")
14862 (match_operand:VI1_AVX512 2 "nonimmediate_operand" "vm")
14863 (match_operand:SI 3 "const_0_to_255_mul_8_operand" "n")]
14865 (match_operand:VI1_AVX512 4 "vector_move_operand" "0C")
14866 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
14867 "TARGET_AVX512BW && (<MODE_SIZE> == 64 || TARGET_AVX512VL)"
14869 operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
14870 return "vpalignr\t{%3, %2, %1, %0%{%5%}%N4|%0%{%5%}%N4, %1, %2, %3}";
14872 [(set_attr "type" "sseishft")
14873 (set_attr "atom_unit" "sishuf")
14874 (set_attr "prefix_extra" "1")
14875 (set_attr "length_immediate" "1")
14876 (set_attr "prefix" "evex")
14877 (set_attr "mode" "<sseinsnmode>")])
14879 (define_insn "<ssse3_avx2>_palignr<mode>"
14880 [(set (match_operand:SSESCALARMODE 0 "register_operand" "=x,x,v")
14881 (unspec:SSESCALARMODE
14882 [(match_operand:SSESCALARMODE 1 "register_operand" "0,x,v")
14883 (match_operand:SSESCALARMODE 2 "vector_operand" "xBm,xm,vm")
14884 (match_operand:SI 3 "const_0_to_255_mul_8_operand" "n,n,n")]
14888 operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
14890 switch (which_alternative)
14893 return "palignr\t{%3, %2, %0|%0, %2, %3}";
14896 return "vpalignr\t{%3, %2, %1, %0|%0, %1, %2, %3}";
14898 gcc_unreachable ();
14901 [(set_attr "isa" "noavx,avx,avx512bw")
14902 (set_attr "type" "sseishft")
14903 (set_attr "atom_unit" "sishuf")
14904 (set_attr "prefix_data16" "1,*,*")
14905 (set_attr "prefix_extra" "1")
14906 (set_attr "length_immediate" "1")
14907 (set_attr "prefix" "orig,vex,evex")
14908 (set_attr "mode" "<sseinsnmode>")])
14910 (define_insn "ssse3_palignrdi"
14911 [(set (match_operand:DI 0 "register_operand" "=y")
14912 (unspec:DI [(match_operand:DI 1 "register_operand" "0")
14913 (match_operand:DI 2 "nonimmediate_operand" "ym")
14914 (match_operand:SI 3 "const_0_to_255_mul_8_operand" "n")]
14918 operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
14919 return "palignr\t{%3, %2, %0|%0, %2, %3}";
14921 [(set_attr "type" "sseishft")
14922 (set_attr "atom_unit" "sishuf")
14923 (set_attr "prefix_extra" "1")
14924 (set_attr "length_immediate" "1")
14925 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14926 (set_attr "mode" "DI")])
14928 ;; Mode iterator to handle singularity w/ absence of V2DI and V4DI
14929 ;; modes for abs instruction on pre AVX-512 targets.
14930 (define_mode_iterator VI1248_AVX512VL_AVX512BW
14931 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI
14932 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI
14933 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX2") V4SI
14934 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")])
14936 (define_insn "*abs<mode>2"
14937 [(set (match_operand:VI1248_AVX512VL_AVX512BW 0 "register_operand" "=v")
14938 (abs:VI1248_AVX512VL_AVX512BW
14939 (match_operand:VI1248_AVX512VL_AVX512BW 1 "vector_operand" "vBm")))]
14941 "%vpabs<ssemodesuffix>\t{%1, %0|%0, %1}"
14942 [(set_attr "type" "sselog1")
14943 (set_attr "prefix_data16" "1")
14944 (set_attr "prefix_extra" "1")
14945 (set_attr "prefix" "maybe_vex")
14946 (set_attr "mode" "<sseinsnmode>")])
14948 (define_insn "abs<mode>2_mask"
14949 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
14950 (vec_merge:VI48_AVX512VL
14952 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm"))
14953 (match_operand:VI48_AVX512VL 2 "vector_move_operand" "0C")
14954 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
14956 "vpabs<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
14957 [(set_attr "type" "sselog1")
14958 (set_attr "prefix" "evex")
14959 (set_attr "mode" "<sseinsnmode>")])
14961 (define_insn "abs<mode>2_mask"
14962 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
14963 (vec_merge:VI12_AVX512VL
14965 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "vm"))
14966 (match_operand:VI12_AVX512VL 2 "vector_move_operand" "0C")
14967 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
14969 "vpabs<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
14970 [(set_attr "type" "sselog1")
14971 (set_attr "prefix" "evex")
14972 (set_attr "mode" "<sseinsnmode>")])
14974 (define_expand "abs<mode>2"
14975 [(set (match_operand:VI1248_AVX512VL_AVX512BW 0 "register_operand")
14976 (abs:VI1248_AVX512VL_AVX512BW
14977 (match_operand:VI1248_AVX512VL_AVX512BW 1 "vector_operand")))]
14982 ix86_expand_sse2_abs (operands[0], operands[1]);
14987 (define_insn "abs<mode>2"
14988 [(set (match_operand:MMXMODEI 0 "register_operand" "=y")
14990 (match_operand:MMXMODEI 1 "nonimmediate_operand" "ym")))]
14992 "pabs<mmxvecsize>\t{%1, %0|%0, %1}";
14993 [(set_attr "type" "sselog1")
14994 (set_attr "prefix_rep" "0")
14995 (set_attr "prefix_extra" "1")
14996 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14997 (set_attr "mode" "DI")])
14999 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15001 ;; AMD SSE4A instructions
15003 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15005 (define_insn "sse4a_movnt<mode>"
15006 [(set (match_operand:MODEF 0 "memory_operand" "=m")
15008 [(match_operand:MODEF 1 "register_operand" "x")]
15011 "movnt<ssemodesuffix>\t{%1, %0|%0, %1}"
15012 [(set_attr "type" "ssemov")
15013 (set_attr "mode" "<MODE>")])
15015 (define_insn "sse4a_vmmovnt<mode>"
15016 [(set (match_operand:<ssescalarmode> 0 "memory_operand" "=m")
15017 (unspec:<ssescalarmode>
15018 [(vec_select:<ssescalarmode>
15019 (match_operand:VF_128 1 "register_operand" "x")
15020 (parallel [(const_int 0)]))]
15023 "movnt<ssescalarmodesuffix>\t{%1, %0|%0, %1}"
15024 [(set_attr "type" "ssemov")
15025 (set_attr "mode" "<ssescalarmode>")])
15027 (define_insn "sse4a_extrqi"
15028 [(set (match_operand:V2DI 0 "register_operand" "=x")
15029 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
15030 (match_operand 2 "const_0_to_255_operand")
15031 (match_operand 3 "const_0_to_255_operand")]
15034 "extrq\t{%3, %2, %0|%0, %2, %3}"
15035 [(set_attr "type" "sse")
15036 (set_attr "prefix_data16" "1")
15037 (set_attr "length_immediate" "2")
15038 (set_attr "mode" "TI")])
15040 (define_insn "sse4a_extrq"
15041 [(set (match_operand:V2DI 0 "register_operand" "=x")
15042 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
15043 (match_operand:V16QI 2 "register_operand" "x")]
15046 "extrq\t{%2, %0|%0, %2}"
15047 [(set_attr "type" "sse")
15048 (set_attr "prefix_data16" "1")
15049 (set_attr "mode" "TI")])
15051 (define_insn "sse4a_insertqi"
15052 [(set (match_operand:V2DI 0 "register_operand" "=x")
15053 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
15054 (match_operand:V2DI 2 "register_operand" "x")
15055 (match_operand 3 "const_0_to_255_operand")
15056 (match_operand 4 "const_0_to_255_operand")]
15059 "insertq\t{%4, %3, %2, %0|%0, %2, %3, %4}"
15060 [(set_attr "type" "sseins")
15061 (set_attr "prefix_data16" "0")
15062 (set_attr "prefix_rep" "1")
15063 (set_attr "length_immediate" "2")
15064 (set_attr "mode" "TI")])
15066 (define_insn "sse4a_insertq"
15067 [(set (match_operand:V2DI 0 "register_operand" "=x")
15068 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
15069 (match_operand:V2DI 2 "register_operand" "x")]
15072 "insertq\t{%2, %0|%0, %2}"
15073 [(set_attr "type" "sseins")
15074 (set_attr "prefix_data16" "0")
15075 (set_attr "prefix_rep" "1")
15076 (set_attr "mode" "TI")])
15078 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15080 ;; Intel SSE4.1 instructions
15082 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15084 ;; Mapping of immediate bits for blend instructions
15085 (define_mode_attr blendbits
15086 [(V8SF "255") (V4SF "15") (V4DF "15") (V2DF "3")])
15088 (define_insn "<sse4_1>_blend<ssemodesuffix><avxsizesuffix>"
15089 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
15090 (vec_merge:VF_128_256
15091 (match_operand:VF_128_256 2 "vector_operand" "YrBm,*xBm,xm")
15092 (match_operand:VF_128_256 1 "register_operand" "0,0,x")
15093 (match_operand:SI 3 "const_0_to_<blendbits>_operand")))]
15096 blend<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15097 blend<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15098 vblend<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 "mode" "<MODE>")])
15107 (define_insn "<sse4_1>_blendv<ssemodesuffix><avxsizesuffix>"
15108 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
15110 [(match_operand:VF_128_256 1 "register_operand" "0,0,x")
15111 (match_operand:VF_128_256 2 "vector_operand" "YrBm,*xBm,xm")
15112 (match_operand:VF_128_256 3 "register_operand" "Yz,Yz,x")]
15116 blendv<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15117 blendv<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15118 vblendv<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15119 [(set_attr "isa" "noavx,noavx,avx")
15120 (set_attr "type" "ssemov")
15121 (set_attr "length_immediate" "1")
15122 (set_attr "prefix_data16" "1,1,*")
15123 (set_attr "prefix_extra" "1")
15124 (set_attr "prefix" "orig,orig,vex")
15125 (set_attr "btver2_decode" "vector,vector,vector")
15126 (set_attr "mode" "<MODE>")])
15128 (define_insn "<sse4_1>_dp<ssemodesuffix><avxsizesuffix>"
15129 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
15131 [(match_operand:VF_128_256 1 "vector_operand" "%0,0,x")
15132 (match_operand:VF_128_256 2 "vector_operand" "YrBm,*xBm,xm")
15133 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")]
15137 dp<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15138 dp<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
15139 vdp<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15140 [(set_attr "isa" "noavx,noavx,avx")
15141 (set_attr "type" "ssemul")
15142 (set_attr "length_immediate" "1")
15143 (set_attr "prefix_data16" "1,1,*")
15144 (set_attr "prefix_extra" "1")
15145 (set_attr "prefix" "orig,orig,vex")
15146 (set_attr "btver2_decode" "vector,vector,vector")
15147 (set_attr "znver1_decode" "vector,vector,vector")
15148 (set_attr "mode" "<MODE>")])
15150 ;; Mode attribute used by `vmovntdqa' pattern
15151 (define_mode_attr vi8_sse4_1_avx2_avx512
15152 [(V2DI "sse4_1") (V4DI "avx2") (V8DI "avx512f")])
15154 (define_insn "<vi8_sse4_1_avx2_avx512>_movntdqa"
15155 [(set (match_operand:VI8_AVX2_AVX512F 0 "register_operand" "=Yr,*x,v")
15156 (unspec:VI8_AVX2_AVX512F [(match_operand:VI8_AVX2_AVX512F 1 "memory_operand" "m,m,m")]
15159 "%vmovntdqa\t{%1, %0|%0, %1}"
15160 [(set_attr "isa" "noavx,noavx,avx")
15161 (set_attr "type" "ssemov")
15162 (set_attr "prefix_extra" "1,1,*")
15163 (set_attr "prefix" "orig,orig,maybe_evex")
15164 (set_attr "mode" "<sseinsnmode>")])
15166 (define_insn "<sse4_1_avx2>_mpsadbw"
15167 [(set (match_operand:VI1_AVX2 0 "register_operand" "=Yr,*x,x")
15169 [(match_operand:VI1_AVX2 1 "register_operand" "0,0,x")
15170 (match_operand:VI1_AVX2 2 "vector_operand" "YrBm,*xBm,xm")
15171 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")]
15175 mpsadbw\t{%3, %2, %0|%0, %2, %3}
15176 mpsadbw\t{%3, %2, %0|%0, %2, %3}
15177 vmpsadbw\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15178 [(set_attr "isa" "noavx,noavx,avx")
15179 (set_attr "type" "sselog1")
15180 (set_attr "length_immediate" "1")
15181 (set_attr "prefix_extra" "1")
15182 (set_attr "prefix" "orig,orig,vex")
15183 (set_attr "btver2_decode" "vector,vector,vector")
15184 (set_attr "znver1_decode" "vector,vector,vector")
15185 (set_attr "mode" "<sseinsnmode>")])
15187 (define_insn "<sse4_1_avx2>_packusdw<mask_name>"
15188 [(set (match_operand:VI2_AVX2 0 "register_operand" "=Yr,*x,x,v")
15189 (vec_concat:VI2_AVX2
15190 (us_truncate:<ssehalfvecmode>
15191 (match_operand:<sseunpackmode> 1 "register_operand" "0,0,x,v"))
15192 (us_truncate:<ssehalfvecmode>
15193 (match_operand:<sseunpackmode> 2 "vector_operand" "YrBm,*xBm,xm,vm"))))]
15194 "TARGET_SSE4_1 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
15196 packusdw\t{%2, %0|%0, %2}
15197 packusdw\t{%2, %0|%0, %2}
15198 vpackusdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
15199 vpackusdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
15200 [(set_attr "isa" "noavx,noavx,avx,avx512bw")
15201 (set_attr "type" "sselog")
15202 (set_attr "prefix_extra" "1")
15203 (set_attr "prefix" "orig,orig,<mask_prefix>,evex")
15204 (set_attr "mode" "<sseinsnmode>")])
15206 (define_insn "<sse4_1_avx2>_pblendvb"
15207 [(set (match_operand:VI1_AVX2 0 "register_operand" "=Yr,*x,x")
15209 [(match_operand:VI1_AVX2 1 "register_operand" "0,0,x")
15210 (match_operand:VI1_AVX2 2 "vector_operand" "YrBm,*xBm,xm")
15211 (match_operand:VI1_AVX2 3 "register_operand" "Yz,Yz,x")]
15215 pblendvb\t{%3, %2, %0|%0, %2, %3}
15216 pblendvb\t{%3, %2, %0|%0, %2, %3}
15217 vpblendvb\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15218 [(set_attr "isa" "noavx,noavx,avx")
15219 (set_attr "type" "ssemov")
15220 (set_attr "prefix_extra" "1")
15221 (set_attr "length_immediate" "*,*,1")
15222 (set_attr "prefix" "orig,orig,vex")
15223 (set_attr "btver2_decode" "vector,vector,vector")
15224 (set_attr "mode" "<sseinsnmode>")])
15226 (define_insn "sse4_1_pblendw"
15227 [(set (match_operand:V8HI 0 "register_operand" "=Yr,*x,x")
15229 (match_operand:V8HI 2 "vector_operand" "YrBm,*xBm,xm")
15230 (match_operand:V8HI 1 "register_operand" "0,0,x")
15231 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")))]
15234 pblendw\t{%3, %2, %0|%0, %2, %3}
15235 pblendw\t{%3, %2, %0|%0, %2, %3}
15236 vpblendw\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15237 [(set_attr "isa" "noavx,noavx,avx")
15238 (set_attr "type" "ssemov")
15239 (set_attr "prefix_extra" "1")
15240 (set_attr "length_immediate" "1")
15241 (set_attr "prefix" "orig,orig,vex")
15242 (set_attr "mode" "TI")])
15244 ;; The builtin uses an 8-bit immediate. Expand that.
15245 (define_expand "avx2_pblendw"
15246 [(set (match_operand:V16HI 0 "register_operand")
15248 (match_operand:V16HI 2 "nonimmediate_operand")
15249 (match_operand:V16HI 1 "register_operand")
15250 (match_operand:SI 3 "const_0_to_255_operand")))]
15253 HOST_WIDE_INT val = INTVAL (operands[3]) & 0xff;
15254 operands[3] = GEN_INT (val << 8 | val);
15257 (define_insn "*avx2_pblendw"
15258 [(set (match_operand:V16HI 0 "register_operand" "=x")
15260 (match_operand:V16HI 2 "nonimmediate_operand" "xm")
15261 (match_operand:V16HI 1 "register_operand" "x")
15262 (match_operand:SI 3 "avx2_pblendw_operand" "n")))]
15265 operands[3] = GEN_INT (INTVAL (operands[3]) & 0xff);
15266 return "vpblendw\t{%3, %2, %1, %0|%0, %1, %2, %3}";
15268 [(set_attr "type" "ssemov")
15269 (set_attr "prefix_extra" "1")
15270 (set_attr "length_immediate" "1")
15271 (set_attr "prefix" "vex")
15272 (set_attr "mode" "OI")])
15274 (define_insn "avx2_pblendd<mode>"
15275 [(set (match_operand:VI4_AVX2 0 "register_operand" "=x")
15276 (vec_merge:VI4_AVX2
15277 (match_operand:VI4_AVX2 2 "nonimmediate_operand" "xm")
15278 (match_operand:VI4_AVX2 1 "register_operand" "x")
15279 (match_operand:SI 3 "const_0_to_255_operand" "n")))]
15281 "vpblendd\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15282 [(set_attr "type" "ssemov")
15283 (set_attr "prefix_extra" "1")
15284 (set_attr "length_immediate" "1")
15285 (set_attr "prefix" "vex")
15286 (set_attr "mode" "<sseinsnmode>")])
15288 (define_insn "sse4_1_phminposuw"
15289 [(set (match_operand:V8HI 0 "register_operand" "=Yr,*x,x")
15290 (unspec:V8HI [(match_operand:V8HI 1 "vector_operand" "YrBm,*xBm,xm")]
15291 UNSPEC_PHMINPOSUW))]
15293 "%vphminposuw\t{%1, %0|%0, %1}"
15294 [(set_attr "isa" "noavx,noavx,avx")
15295 (set_attr "type" "sselog1")
15296 (set_attr "prefix_extra" "1")
15297 (set_attr "prefix" "orig,orig,vex")
15298 (set_attr "mode" "TI")])
15300 (define_insn "avx2_<code>v16qiv16hi2<mask_name>"
15301 [(set (match_operand:V16HI 0 "register_operand" "=v")
15303 (match_operand:V16QI 1 "nonimmediate_operand" "vm")))]
15304 "TARGET_AVX2 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
15305 "vpmov<extsuffix>bw\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15306 [(set_attr "type" "ssemov")
15307 (set_attr "prefix_extra" "1")
15308 (set_attr "prefix" "maybe_evex")
15309 (set_attr "mode" "OI")])
15311 (define_insn "avx512bw_<code>v32qiv32hi2<mask_name>"
15312 [(set (match_operand:V32HI 0 "register_operand" "=v")
15314 (match_operand:V32QI 1 "nonimmediate_operand" "vm")))]
15316 "vpmov<extsuffix>bw\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15317 [(set_attr "type" "ssemov")
15318 (set_attr "prefix_extra" "1")
15319 (set_attr "prefix" "evex")
15320 (set_attr "mode" "XI")])
15322 (define_insn "sse4_1_<code>v8qiv8hi2<mask_name>"
15323 [(set (match_operand:V8HI 0 "register_operand" "=Yr,*x,v")
15326 (match_operand:V16QI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15327 (parallel [(const_int 0) (const_int 1)
15328 (const_int 2) (const_int 3)
15329 (const_int 4) (const_int 5)
15330 (const_int 6) (const_int 7)]))))]
15331 "TARGET_SSE4_1 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
15332 "%vpmov<extsuffix>bw\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15333 [(set_attr "isa" "noavx,noavx,avx")
15334 (set_attr "type" "ssemov")
15335 (set_attr "prefix_extra" "1")
15336 (set_attr "prefix" "orig,orig,maybe_evex")
15337 (set_attr "mode" "TI")])
15339 (define_insn "<mask_codefor>avx512f_<code>v16qiv16si2<mask_name>"
15340 [(set (match_operand:V16SI 0 "register_operand" "=v")
15342 (match_operand:V16QI 1 "nonimmediate_operand" "vm")))]
15344 "vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15345 [(set_attr "type" "ssemov")
15346 (set_attr "prefix" "evex")
15347 (set_attr "mode" "XI")])
15349 (define_insn "avx2_<code>v8qiv8si2<mask_name>"
15350 [(set (match_operand:V8SI 0 "register_operand" "=v")
15353 (match_operand:V16QI 1 "nonimmediate_operand" "vm")
15354 (parallel [(const_int 0) (const_int 1)
15355 (const_int 2) (const_int 3)
15356 (const_int 4) (const_int 5)
15357 (const_int 6) (const_int 7)]))))]
15358 "TARGET_AVX2 && <mask_avx512vl_condition>"
15359 "vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15360 [(set_attr "type" "ssemov")
15361 (set_attr "prefix_extra" "1")
15362 (set_attr "prefix" "maybe_evex")
15363 (set_attr "mode" "OI")])
15365 (define_insn "sse4_1_<code>v4qiv4si2<mask_name>"
15366 [(set (match_operand:V4SI 0 "register_operand" "=Yr,*x,v")
15369 (match_operand:V16QI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15370 (parallel [(const_int 0) (const_int 1)
15371 (const_int 2) (const_int 3)]))))]
15372 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15373 "%vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
15374 [(set_attr "isa" "noavx,noavx,avx")
15375 (set_attr "type" "ssemov")
15376 (set_attr "prefix_extra" "1")
15377 (set_attr "prefix" "orig,orig,maybe_evex")
15378 (set_attr "mode" "TI")])
15380 (define_insn "avx512f_<code>v16hiv16si2<mask_name>"
15381 [(set (match_operand:V16SI 0 "register_operand" "=v")
15383 (match_operand:V16HI 1 "nonimmediate_operand" "vm")))]
15385 "vpmov<extsuffix>wd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15386 [(set_attr "type" "ssemov")
15387 (set_attr "prefix" "evex")
15388 (set_attr "mode" "XI")])
15390 (define_insn "avx2_<code>v8hiv8si2<mask_name>"
15391 [(set (match_operand:V8SI 0 "register_operand" "=v")
15393 (match_operand:V8HI 1 "nonimmediate_operand" "vm")))]
15394 "TARGET_AVX2 && <mask_avx512vl_condition>"
15395 "vpmov<extsuffix>wd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15396 [(set_attr "type" "ssemov")
15397 (set_attr "prefix_extra" "1")
15398 (set_attr "prefix" "maybe_evex")
15399 (set_attr "mode" "OI")])
15401 (define_insn "sse4_1_<code>v4hiv4si2<mask_name>"
15402 [(set (match_operand:V4SI 0 "register_operand" "=Yr,*x,v")
15405 (match_operand:V8HI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15406 (parallel [(const_int 0) (const_int 1)
15407 (const_int 2) (const_int 3)]))))]
15408 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15409 "%vpmov<extsuffix>wd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15410 [(set_attr "isa" "noavx,noavx,avx")
15411 (set_attr "type" "ssemov")
15412 (set_attr "prefix_extra" "1")
15413 (set_attr "prefix" "orig,orig,maybe_evex")
15414 (set_attr "mode" "TI")])
15416 (define_insn "avx512f_<code>v8qiv8di2<mask_name>"
15417 [(set (match_operand:V8DI 0 "register_operand" "=v")
15420 (match_operand:V16QI 1 "nonimmediate_operand" "vm")
15421 (parallel [(const_int 0) (const_int 1)
15422 (const_int 2) (const_int 3)
15423 (const_int 4) (const_int 5)
15424 (const_int 6) (const_int 7)]))))]
15426 "vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
15427 [(set_attr "type" "ssemov")
15428 (set_attr "prefix" "evex")
15429 (set_attr "mode" "XI")])
15431 (define_insn "avx2_<code>v4qiv4di2<mask_name>"
15432 [(set (match_operand:V4DI 0 "register_operand" "=v")
15435 (match_operand:V16QI 1 "nonimmediate_operand" "vm")
15436 (parallel [(const_int 0) (const_int 1)
15437 (const_int 2) (const_int 3)]))))]
15438 "TARGET_AVX2 && <mask_avx512vl_condition>"
15439 "vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
15440 [(set_attr "type" "ssemov")
15441 (set_attr "prefix_extra" "1")
15442 (set_attr "prefix" "maybe_evex")
15443 (set_attr "mode" "OI")])
15445 (define_insn "sse4_1_<code>v2qiv2di2<mask_name>"
15446 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
15449 (match_operand:V16QI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15450 (parallel [(const_int 0) (const_int 1)]))))]
15451 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15452 "%vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %w1}"
15453 [(set_attr "isa" "noavx,noavx,avx")
15454 (set_attr "type" "ssemov")
15455 (set_attr "prefix_extra" "1")
15456 (set_attr "prefix" "orig,orig,maybe_evex")
15457 (set_attr "mode" "TI")])
15459 (define_insn "avx512f_<code>v8hiv8di2<mask_name>"
15460 [(set (match_operand:V8DI 0 "register_operand" "=v")
15462 (match_operand:V8HI 1 "nonimmediate_operand" "vm")))]
15464 "vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15465 [(set_attr "type" "ssemov")
15466 (set_attr "prefix" "evex")
15467 (set_attr "mode" "XI")])
15469 (define_insn "avx2_<code>v4hiv4di2<mask_name>"
15470 [(set (match_operand:V4DI 0 "register_operand" "=v")
15473 (match_operand:V8HI 1 "nonimmediate_operand" "vm")
15474 (parallel [(const_int 0) (const_int 1)
15475 (const_int 2) (const_int 3)]))))]
15476 "TARGET_AVX2 && <mask_avx512vl_condition>"
15477 "vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15478 [(set_attr "type" "ssemov")
15479 (set_attr "prefix_extra" "1")
15480 (set_attr "prefix" "maybe_evex")
15481 (set_attr "mode" "OI")])
15483 (define_insn "sse4_1_<code>v2hiv2di2<mask_name>"
15484 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
15487 (match_operand:V8HI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15488 (parallel [(const_int 0) (const_int 1)]))))]
15489 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15490 "%vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
15491 [(set_attr "isa" "noavx,noavx,avx")
15492 (set_attr "type" "ssemov")
15493 (set_attr "prefix_extra" "1")
15494 (set_attr "prefix" "orig,orig,maybe_evex")
15495 (set_attr "mode" "TI")])
15497 (define_insn "avx512f_<code>v8siv8di2<mask_name>"
15498 [(set (match_operand:V8DI 0 "register_operand" "=v")
15500 (match_operand:V8SI 1 "nonimmediate_operand" "vm")))]
15502 "vpmov<extsuffix>dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15503 [(set_attr "type" "ssemov")
15504 (set_attr "prefix" "evex")
15505 (set_attr "mode" "XI")])
15507 (define_insn "avx2_<code>v4siv4di2<mask_name>"
15508 [(set (match_operand:V4DI 0 "register_operand" "=v")
15510 (match_operand:V4SI 1 "nonimmediate_operand" "vm")))]
15511 "TARGET_AVX2 && <mask_avx512vl_condition>"
15512 "vpmov<extsuffix>dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
15513 [(set_attr "type" "ssemov")
15514 (set_attr "prefix" "maybe_evex")
15515 (set_attr "prefix_extra" "1")
15516 (set_attr "mode" "OI")])
15518 (define_insn "sse4_1_<code>v2siv2di2<mask_name>"
15519 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
15522 (match_operand:V4SI 1 "nonimmediate_operand" "Yrm,*xm,vm")
15523 (parallel [(const_int 0) (const_int 1)]))))]
15524 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
15525 "%vpmov<extsuffix>dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
15526 [(set_attr "isa" "noavx,noavx,avx")
15527 (set_attr "type" "ssemov")
15528 (set_attr "prefix_extra" "1")
15529 (set_attr "prefix" "orig,orig,maybe_evex")
15530 (set_attr "mode" "TI")])
15532 ;; ptestps/ptestpd are very similar to comiss and ucomiss when
15533 ;; setting FLAGS_REG. But it is not a really compare instruction.
15534 (define_insn "avx_vtest<ssemodesuffix><avxsizesuffix>"
15535 [(set (reg:CC FLAGS_REG)
15536 (unspec:CC [(match_operand:VF_128_256 0 "register_operand" "x")
15537 (match_operand:VF_128_256 1 "nonimmediate_operand" "xm")]
15540 "vtest<ssemodesuffix>\t{%1, %0|%0, %1}"
15541 [(set_attr "type" "ssecomi")
15542 (set_attr "prefix_extra" "1")
15543 (set_attr "prefix" "vex")
15544 (set_attr "mode" "<MODE>")])
15546 ;; ptest is very similar to comiss and ucomiss when setting FLAGS_REG.
15547 ;; But it is not a really compare instruction.
15548 (define_insn "<sse4_1>_ptest<mode>"
15549 [(set (reg:CC FLAGS_REG)
15550 (unspec:CC [(match_operand:V_AVX 0 "register_operand" "Yr, *x, x")
15551 (match_operand:V_AVX 1 "vector_operand" "YrBm, *xBm, xm")]
15554 "%vptest\t{%1, %0|%0, %1}"
15555 [(set_attr "isa" "noavx,noavx,avx")
15556 (set_attr "type" "ssecomi")
15557 (set_attr "prefix_extra" "1")
15558 (set_attr "prefix" "orig,orig,vex")
15559 (set (attr "btver2_decode")
15561 (match_test "<sseinsnmode>mode==OImode")
15562 (const_string "vector")
15563 (const_string "*")))
15564 (set_attr "mode" "<sseinsnmode>")])
15566 (define_insn "ptesttf2"
15567 [(set (reg:CC FLAGS_REG)
15568 (unspec:CC [(match_operand:TF 0 "register_operand" "Yr, *x, x")
15569 (match_operand:TF 1 "vector_operand" "YrBm, *xBm, xm")]
15572 "%vptest\t{%1, %0|%0, %1}"
15573 [(set_attr "isa" "noavx,noavx,avx")
15574 (set_attr "type" "ssecomi")
15575 (set_attr "prefix_extra" "1")
15576 (set_attr "prefix" "orig,orig,vex")
15577 (set_attr "mode" "TI")])
15579 (define_insn "<sse4_1>_round<ssemodesuffix><avxsizesuffix>"
15580 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
15582 [(match_operand:VF_128_256 1 "vector_operand" "YrBm,*xBm,xm")
15583 (match_operand:SI 2 "const_0_to_15_operand" "n,n,n")]
15586 "%vround<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
15587 [(set_attr "isa" "noavx,noavx,avx")
15588 (set_attr "type" "ssecvt")
15589 (set_attr "prefix_data16" "1,1,*")
15590 (set_attr "prefix_extra" "1")
15591 (set_attr "length_immediate" "1")
15592 (set_attr "prefix" "orig,orig,vex")
15593 (set_attr "mode" "<MODE>")])
15595 (define_expand "<sse4_1>_round<ssemodesuffix>_sfix<avxsizesuffix>"
15596 [(match_operand:<sseintvecmode> 0 "register_operand")
15597 (match_operand:VF1_128_256 1 "vector_operand")
15598 (match_operand:SI 2 "const_0_to_15_operand")]
15601 rtx tmp = gen_reg_rtx (<MODE>mode);
15604 (gen_<sse4_1>_round<ssemodesuffix><avxsizesuffix> (tmp, operands[1],
15607 (gen_fix_trunc<mode><sseintvecmodelower>2 (operands[0], tmp));
15611 (define_expand "avx512f_round<castmode>512"
15612 [(match_operand:VF_512 0 "register_operand")
15613 (match_operand:VF_512 1 "nonimmediate_operand")
15614 (match_operand:SI 2 "const_0_to_15_operand")]
15617 emit_insn (gen_avx512f_rndscale<mode> (operands[0], operands[1], operands[2]));
15621 (define_expand "avx512f_roundps512_sfix"
15622 [(match_operand:V16SI 0 "register_operand")
15623 (match_operand:V16SF 1 "nonimmediate_operand")
15624 (match_operand:SI 2 "const_0_to_15_operand")]
15627 rtx tmp = gen_reg_rtx (V16SFmode);
15628 emit_insn (gen_avx512f_rndscalev16sf (tmp, operands[1], operands[2]));
15629 emit_insn (gen_fix_truncv16sfv16si2 (operands[0], tmp));
15633 (define_expand "<sse4_1>_round<ssemodesuffix>_vec_pack_sfix<avxsizesuffix>"
15634 [(match_operand:<ssepackfltmode> 0 "register_operand")
15635 (match_operand:VF2 1 "vector_operand")
15636 (match_operand:VF2 2 "vector_operand")
15637 (match_operand:SI 3 "const_0_to_15_operand")]
15642 if (<MODE>mode == V2DFmode
15643 && TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
15645 rtx tmp2 = gen_reg_rtx (V4DFmode);
15647 tmp0 = gen_reg_rtx (V4DFmode);
15648 tmp1 = force_reg (V2DFmode, operands[1]);
15650 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
15651 emit_insn (gen_avx_roundpd256 (tmp2, tmp0, operands[3]));
15652 emit_insn (gen_fix_truncv4dfv4si2 (operands[0], tmp2));
15656 tmp0 = gen_reg_rtx (<MODE>mode);
15657 tmp1 = gen_reg_rtx (<MODE>mode);
15660 (gen_<sse4_1>_round<ssemodesuffix><avxsizesuffix> (tmp0, operands[1],
15663 (gen_<sse4_1>_round<ssemodesuffix><avxsizesuffix> (tmp1, operands[2],
15666 (gen_vec_pack_sfix_trunc_<mode> (operands[0], tmp0, tmp1));
15671 (define_insn "sse4_1_round<ssescalarmodesuffix>"
15672 [(set (match_operand:VF_128 0 "register_operand" "=Yr,*x,x,v")
15675 [(match_operand:VF_128 2 "register_operand" "Yr,*x,x,v")
15676 (match_operand:SI 3 "const_0_to_15_operand" "n,n,n,n")]
15678 (match_operand:VF_128 1 "register_operand" "0,0,x,v")
15682 round<ssescalarmodesuffix>\t{%3, %2, %0|%0, %2, %3}
15683 round<ssescalarmodesuffix>\t{%3, %2, %0|%0, %2, %3}
15684 vround<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
15685 vrndscale<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15686 [(set_attr "isa" "noavx,noavx,avx,avx512f")
15687 (set_attr "type" "ssecvt")
15688 (set_attr "length_immediate" "1")
15689 (set_attr "prefix_data16" "1,1,*,*")
15690 (set_attr "prefix_extra" "1")
15691 (set_attr "prefix" "orig,orig,vex,evex")
15692 (set_attr "mode" "<MODE>")])
15694 (define_expand "round<mode>2"
15695 [(set (match_dup 3)
15697 (match_operand:VF 1 "register_operand")
15699 (set (match_operand:VF 0 "register_operand")
15701 [(match_dup 3) (match_dup 4)]
15703 "TARGET_SSE4_1 && !flag_trapping_math"
15705 machine_mode scalar_mode;
15706 const struct real_format *fmt;
15707 REAL_VALUE_TYPE pred_half, half_minus_pred_half;
15708 rtx half, vec_half;
15710 scalar_mode = GET_MODE_INNER (<MODE>mode);
15712 /* load nextafter (0.5, 0.0) */
15713 fmt = REAL_MODE_FORMAT (scalar_mode);
15714 real_2expN (&half_minus_pred_half, -(fmt->p) - 1, scalar_mode);
15715 real_arithmetic (&pred_half, MINUS_EXPR, &dconsthalf, &half_minus_pred_half);
15716 half = const_double_from_real_value (pred_half, scalar_mode);
15718 vec_half = ix86_build_const_vector (<MODE>mode, true, half);
15719 vec_half = force_reg (<MODE>mode, vec_half);
15721 operands[2] = gen_reg_rtx (<MODE>mode);
15722 emit_insn (gen_copysign<mode>3 (operands[2], vec_half, operands[1]));
15724 operands[3] = gen_reg_rtx (<MODE>mode);
15725 operands[4] = GEN_INT (ROUND_TRUNC);
15728 (define_expand "round<mode>2_sfix"
15729 [(match_operand:<sseintvecmode> 0 "register_operand")
15730 (match_operand:VF1 1 "register_operand")]
15731 "TARGET_SSE4_1 && !flag_trapping_math"
15733 rtx tmp = gen_reg_rtx (<MODE>mode);
15735 emit_insn (gen_round<mode>2 (tmp, operands[1]));
15738 (gen_fix_trunc<mode><sseintvecmodelower>2 (operands[0], tmp));
15742 (define_expand "round<mode>2_vec_pack_sfix"
15743 [(match_operand:<ssepackfltmode> 0 "register_operand")
15744 (match_operand:VF2 1 "register_operand")
15745 (match_operand:VF2 2 "register_operand")]
15746 "TARGET_SSE4_1 && !flag_trapping_math"
15750 if (<MODE>mode == V2DFmode
15751 && TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
15753 rtx tmp2 = gen_reg_rtx (V4DFmode);
15755 tmp0 = gen_reg_rtx (V4DFmode);
15756 tmp1 = force_reg (V2DFmode, operands[1]);
15758 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
15759 emit_insn (gen_roundv4df2 (tmp2, tmp0));
15760 emit_insn (gen_fix_truncv4dfv4si2 (operands[0], tmp2));
15764 tmp0 = gen_reg_rtx (<MODE>mode);
15765 tmp1 = gen_reg_rtx (<MODE>mode);
15767 emit_insn (gen_round<mode>2 (tmp0, operands[1]));
15768 emit_insn (gen_round<mode>2 (tmp1, operands[2]));
15771 (gen_vec_pack_sfix_trunc_<mode> (operands[0], tmp0, tmp1));
15776 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15778 ;; Intel SSE4.2 string/text processing instructions
15780 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15782 (define_insn_and_split "sse4_2_pcmpestr"
15783 [(set (match_operand:SI 0 "register_operand" "=c,c")
15785 [(match_operand:V16QI 2 "register_operand" "x,x")
15786 (match_operand:SI 3 "register_operand" "a,a")
15787 (match_operand:V16QI 4 "nonimmediate_operand" "x,m")
15788 (match_operand:SI 5 "register_operand" "d,d")
15789 (match_operand:SI 6 "const_0_to_255_operand" "n,n")]
15791 (set (match_operand:V16QI 1 "register_operand" "=Yz,Yz")
15799 (set (reg:CC FLAGS_REG)
15808 && can_create_pseudo_p ()"
15813 int ecx = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[0]));
15814 int xmm0 = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[1]));
15815 int flags = !find_regno_note (curr_insn, REG_UNUSED, FLAGS_REG);
15818 emit_insn (gen_sse4_2_pcmpestri (operands[0], operands[2],
15819 operands[3], operands[4],
15820 operands[5], operands[6]));
15822 emit_insn (gen_sse4_2_pcmpestrm (operands[1], operands[2],
15823 operands[3], operands[4],
15824 operands[5], operands[6]));
15825 if (flags && !(ecx || xmm0))
15826 emit_insn (gen_sse4_2_pcmpestr_cconly (NULL, NULL,
15827 operands[2], operands[3],
15828 operands[4], operands[5],
15830 if (!(flags || ecx || xmm0))
15831 emit_note (NOTE_INSN_DELETED);
15835 [(set_attr "type" "sselog")
15836 (set_attr "prefix_data16" "1")
15837 (set_attr "prefix_extra" "1")
15838 (set_attr "length_immediate" "1")
15839 (set_attr "memory" "none,load")
15840 (set_attr "mode" "TI")])
15842 (define_insn "sse4_2_pcmpestri"
15843 [(set (match_operand:SI 0 "register_operand" "=c,c")
15845 [(match_operand:V16QI 1 "register_operand" "x,x")
15846 (match_operand:SI 2 "register_operand" "a,a")
15847 (match_operand:V16QI 3 "nonimmediate_operand" "x,m")
15848 (match_operand:SI 4 "register_operand" "d,d")
15849 (match_operand:SI 5 "const_0_to_255_operand" "n,n")]
15851 (set (reg:CC FLAGS_REG)
15860 "%vpcmpestri\t{%5, %3, %1|%1, %3, %5}"
15861 [(set_attr "type" "sselog")
15862 (set_attr "prefix_data16" "1")
15863 (set_attr "prefix_extra" "1")
15864 (set_attr "prefix" "maybe_vex")
15865 (set_attr "length_immediate" "1")
15866 (set_attr "btver2_decode" "vector")
15867 (set_attr "memory" "none,load")
15868 (set_attr "mode" "TI")])
15870 (define_insn "sse4_2_pcmpestrm"
15871 [(set (match_operand:V16QI 0 "register_operand" "=Yz,Yz")
15873 [(match_operand:V16QI 1 "register_operand" "x,x")
15874 (match_operand:SI 2 "register_operand" "a,a")
15875 (match_operand:V16QI 3 "nonimmediate_operand" "x,m")
15876 (match_operand:SI 4 "register_operand" "d,d")
15877 (match_operand:SI 5 "const_0_to_255_operand" "n,n")]
15879 (set (reg:CC FLAGS_REG)
15888 "%vpcmpestrm\t{%5, %3, %1|%1, %3, %5}"
15889 [(set_attr "type" "sselog")
15890 (set_attr "prefix_data16" "1")
15891 (set_attr "prefix_extra" "1")
15892 (set_attr "length_immediate" "1")
15893 (set_attr "prefix" "maybe_vex")
15894 (set_attr "btver2_decode" "vector")
15895 (set_attr "memory" "none,load")
15896 (set_attr "mode" "TI")])
15898 (define_insn "sse4_2_pcmpestr_cconly"
15899 [(set (reg:CC FLAGS_REG)
15901 [(match_operand:V16QI 2 "register_operand" "x,x,x,x")
15902 (match_operand:SI 3 "register_operand" "a,a,a,a")
15903 (match_operand:V16QI 4 "nonimmediate_operand" "x,m,x,m")
15904 (match_operand:SI 5 "register_operand" "d,d,d,d")
15905 (match_operand:SI 6 "const_0_to_255_operand" "n,n,n,n")]
15907 (clobber (match_scratch:V16QI 0 "=Yz,Yz,X,X"))
15908 (clobber (match_scratch:SI 1 "= X, X,c,c"))]
15911 %vpcmpestrm\t{%6, %4, %2|%2, %4, %6}
15912 %vpcmpestrm\t{%6, %4, %2|%2, %4, %6}
15913 %vpcmpestri\t{%6, %4, %2|%2, %4, %6}
15914 %vpcmpestri\t{%6, %4, %2|%2, %4, %6}"
15915 [(set_attr "type" "sselog")
15916 (set_attr "prefix_data16" "1")
15917 (set_attr "prefix_extra" "1")
15918 (set_attr "length_immediate" "1")
15919 (set_attr "memory" "none,load,none,load")
15920 (set_attr "btver2_decode" "vector,vector,vector,vector")
15921 (set_attr "prefix" "maybe_vex")
15922 (set_attr "mode" "TI")])
15924 (define_insn_and_split "sse4_2_pcmpistr"
15925 [(set (match_operand:SI 0 "register_operand" "=c,c")
15927 [(match_operand:V16QI 2 "register_operand" "x,x")
15928 (match_operand:V16QI 3 "nonimmediate_operand" "x,m")
15929 (match_operand:SI 4 "const_0_to_255_operand" "n,n")]
15931 (set (match_operand:V16QI 1 "register_operand" "=Yz,Yz")
15937 (set (reg:CC FLAGS_REG)
15944 && can_create_pseudo_p ()"
15949 int ecx = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[0]));
15950 int xmm0 = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[1]));
15951 int flags = !find_regno_note (curr_insn, REG_UNUSED, FLAGS_REG);
15954 emit_insn (gen_sse4_2_pcmpistri (operands[0], operands[2],
15955 operands[3], operands[4]));
15957 emit_insn (gen_sse4_2_pcmpistrm (operands[1], operands[2],
15958 operands[3], operands[4]));
15959 if (flags && !(ecx || xmm0))
15960 emit_insn (gen_sse4_2_pcmpistr_cconly (NULL, NULL,
15961 operands[2], operands[3],
15963 if (!(flags || ecx || xmm0))
15964 emit_note (NOTE_INSN_DELETED);
15968 [(set_attr "type" "sselog")
15969 (set_attr "prefix_data16" "1")
15970 (set_attr "prefix_extra" "1")
15971 (set_attr "length_immediate" "1")
15972 (set_attr "memory" "none,load")
15973 (set_attr "mode" "TI")])
15975 (define_insn "sse4_2_pcmpistri"
15976 [(set (match_operand:SI 0 "register_operand" "=c,c")
15978 [(match_operand:V16QI 1 "register_operand" "x,x")
15979 (match_operand:V16QI 2 "nonimmediate_operand" "x,m")
15980 (match_operand:SI 3 "const_0_to_255_operand" "n,n")]
15982 (set (reg:CC FLAGS_REG)
15989 "%vpcmpistri\t{%3, %2, %1|%1, %2, %3}"
15990 [(set_attr "type" "sselog")
15991 (set_attr "prefix_data16" "1")
15992 (set_attr "prefix_extra" "1")
15993 (set_attr "length_immediate" "1")
15994 (set_attr "prefix" "maybe_vex")
15995 (set_attr "memory" "none,load")
15996 (set_attr "btver2_decode" "vector")
15997 (set_attr "mode" "TI")])
15999 (define_insn "sse4_2_pcmpistrm"
16000 [(set (match_operand:V16QI 0 "register_operand" "=Yz,Yz")
16002 [(match_operand:V16QI 1 "register_operand" "x,x")
16003 (match_operand:V16QI 2 "nonimmediate_operand" "x,m")
16004 (match_operand:SI 3 "const_0_to_255_operand" "n,n")]
16006 (set (reg:CC FLAGS_REG)
16013 "%vpcmpistrm\t{%3, %2, %1|%1, %2, %3}"
16014 [(set_attr "type" "sselog")
16015 (set_attr "prefix_data16" "1")
16016 (set_attr "prefix_extra" "1")
16017 (set_attr "length_immediate" "1")
16018 (set_attr "prefix" "maybe_vex")
16019 (set_attr "memory" "none,load")
16020 (set_attr "btver2_decode" "vector")
16021 (set_attr "mode" "TI")])
16023 (define_insn "sse4_2_pcmpistr_cconly"
16024 [(set (reg:CC FLAGS_REG)
16026 [(match_operand:V16QI 2 "register_operand" "x,x,x,x")
16027 (match_operand:V16QI 3 "nonimmediate_operand" "x,m,x,m")
16028 (match_operand:SI 4 "const_0_to_255_operand" "n,n,n,n")]
16030 (clobber (match_scratch:V16QI 0 "=Yz,Yz,X,X"))
16031 (clobber (match_scratch:SI 1 "= X, X,c,c"))]
16034 %vpcmpistrm\t{%4, %3, %2|%2, %3, %4}
16035 %vpcmpistrm\t{%4, %3, %2|%2, %3, %4}
16036 %vpcmpistri\t{%4, %3, %2|%2, %3, %4}
16037 %vpcmpistri\t{%4, %3, %2|%2, %3, %4}"
16038 [(set_attr "type" "sselog")
16039 (set_attr "prefix_data16" "1")
16040 (set_attr "prefix_extra" "1")
16041 (set_attr "length_immediate" "1")
16042 (set_attr "memory" "none,load,none,load")
16043 (set_attr "prefix" "maybe_vex")
16044 (set_attr "btver2_decode" "vector,vector,vector,vector")
16045 (set_attr "mode" "TI")])
16047 ;; Packed float variants
16048 (define_mode_attr GATHER_SCATTER_SF_MEM_MODE
16049 [(V8DI "V8SF") (V16SI "V16SF")])
16051 (define_expand "avx512pf_gatherpf<mode>sf"
16053 [(match_operand:<avx512fmaskmode> 0 "register_operand")
16054 (mem:<GATHER_SCATTER_SF_MEM_MODE>
16056 [(match_operand 2 "vsib_address_operand")
16057 (match_operand:VI48_512 1 "register_operand")
16058 (match_operand:SI 3 "const1248_operand")]))
16059 (match_operand:SI 4 "const_2_to_3_operand")]
16060 UNSPEC_GATHER_PREFETCH)]
16064 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
16065 operands[3]), UNSPEC_VSIBADDR);
16068 (define_insn "*avx512pf_gatherpf<mode>sf_mask"
16070 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
16071 (match_operator:<GATHER_SCATTER_SF_MEM_MODE> 5 "vsib_mem_operator"
16073 [(match_operand:P 2 "vsib_address_operand" "Tv")
16074 (match_operand:VI48_512 1 "register_operand" "v")
16075 (match_operand:SI 3 "const1248_operand" "n")]
16077 (match_operand:SI 4 "const_2_to_3_operand" "n")]
16078 UNSPEC_GATHER_PREFETCH)]
16081 switch (INTVAL (operands[4]))
16084 return "vgatherpf0<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
16086 return "vgatherpf1<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
16088 gcc_unreachable ();
16091 [(set_attr "type" "sse")
16092 (set_attr "prefix" "evex")
16093 (set_attr "mode" "XI")])
16095 ;; Packed double variants
16096 (define_expand "avx512pf_gatherpf<mode>df"
16098 [(match_operand:<avx512fmaskmode> 0 "register_operand")
16101 [(match_operand 2 "vsib_address_operand")
16102 (match_operand:VI4_256_8_512 1 "register_operand")
16103 (match_operand:SI 3 "const1248_operand")]))
16104 (match_operand:SI 4 "const_2_to_3_operand")]
16105 UNSPEC_GATHER_PREFETCH)]
16109 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
16110 operands[3]), UNSPEC_VSIBADDR);
16113 (define_insn "*avx512pf_gatherpf<mode>df_mask"
16115 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
16116 (match_operator:V8DF 5 "vsib_mem_operator"
16118 [(match_operand:P 2 "vsib_address_operand" "Tv")
16119 (match_operand:VI4_256_8_512 1 "register_operand" "v")
16120 (match_operand:SI 3 "const1248_operand" "n")]
16122 (match_operand:SI 4 "const_2_to_3_operand" "n")]
16123 UNSPEC_GATHER_PREFETCH)]
16126 switch (INTVAL (operands[4]))
16129 return "vgatherpf0<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
16131 return "vgatherpf1<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
16133 gcc_unreachable ();
16136 [(set_attr "type" "sse")
16137 (set_attr "prefix" "evex")
16138 (set_attr "mode" "XI")])
16140 ;; Packed float variants
16141 (define_expand "avx512pf_scatterpf<mode>sf"
16143 [(match_operand:<avx512fmaskmode> 0 "register_operand")
16144 (mem:<GATHER_SCATTER_SF_MEM_MODE>
16146 [(match_operand 2 "vsib_address_operand")
16147 (match_operand:VI48_512 1 "register_operand")
16148 (match_operand:SI 3 "const1248_operand")]))
16149 (match_operand:SI 4 "const2367_operand")]
16150 UNSPEC_SCATTER_PREFETCH)]
16154 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
16155 operands[3]), UNSPEC_VSIBADDR);
16158 (define_insn "*avx512pf_scatterpf<mode>sf_mask"
16160 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
16161 (match_operator:<GATHER_SCATTER_SF_MEM_MODE> 5 "vsib_mem_operator"
16163 [(match_operand:P 2 "vsib_address_operand" "Tv")
16164 (match_operand:VI48_512 1 "register_operand" "v")
16165 (match_operand:SI 3 "const1248_operand" "n")]
16167 (match_operand:SI 4 "const2367_operand" "n")]
16168 UNSPEC_SCATTER_PREFETCH)]
16171 switch (INTVAL (operands[4]))
16175 return "vscatterpf0<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
16178 return "vscatterpf1<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
16180 gcc_unreachable ();
16183 [(set_attr "type" "sse")
16184 (set_attr "prefix" "evex")
16185 (set_attr "mode" "XI")])
16187 ;; Packed double variants
16188 (define_expand "avx512pf_scatterpf<mode>df"
16190 [(match_operand:<avx512fmaskmode> 0 "register_operand")
16193 [(match_operand 2 "vsib_address_operand")
16194 (match_operand:VI4_256_8_512 1 "register_operand")
16195 (match_operand:SI 3 "const1248_operand")]))
16196 (match_operand:SI 4 "const2367_operand")]
16197 UNSPEC_SCATTER_PREFETCH)]
16201 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
16202 operands[3]), UNSPEC_VSIBADDR);
16205 (define_insn "*avx512pf_scatterpf<mode>df_mask"
16207 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
16208 (match_operator:V8DF 5 "vsib_mem_operator"
16210 [(match_operand:P 2 "vsib_address_operand" "Tv")
16211 (match_operand:VI4_256_8_512 1 "register_operand" "v")
16212 (match_operand:SI 3 "const1248_operand" "n")]
16214 (match_operand:SI 4 "const2367_operand" "n")]
16215 UNSPEC_SCATTER_PREFETCH)]
16218 switch (INTVAL (operands[4]))
16222 return "vscatterpf0<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
16225 return "vscatterpf1<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
16227 gcc_unreachable ();
16230 [(set_attr "type" "sse")
16231 (set_attr "prefix" "evex")
16232 (set_attr "mode" "XI")])
16234 (define_insn "avx512er_exp2<mode><mask_name><round_saeonly_name>"
16235 [(set (match_operand:VF_512 0 "register_operand" "=v")
16237 [(match_operand:VF_512 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16240 "vexp2<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
16241 [(set_attr "prefix" "evex")
16242 (set_attr "type" "sse")
16243 (set_attr "mode" "<MODE>")])
16245 (define_insn "<mask_codefor>avx512er_rcp28<mode><mask_name><round_saeonly_name>"
16246 [(set (match_operand:VF_512 0 "register_operand" "=v")
16248 [(match_operand:VF_512 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16251 "vrcp28<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
16252 [(set_attr "prefix" "evex")
16253 (set_attr "type" "sse")
16254 (set_attr "mode" "<MODE>")])
16256 (define_insn "avx512er_vmrcp28<mode><round_saeonly_name>"
16257 [(set (match_operand:VF_128 0 "register_operand" "=v")
16260 [(match_operand:VF_128 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16262 (match_operand:VF_128 2 "register_operand" "v")
16265 "vrcp28<ssescalarmodesuffix>\t{<round_saeonly_op3>%1, %2, %0|%0, %2, %1<round_saeonly_op3>}"
16266 [(set_attr "length_immediate" "1")
16267 (set_attr "prefix" "evex")
16268 (set_attr "type" "sse")
16269 (set_attr "mode" "<MODE>")])
16271 (define_insn "<mask_codefor>avx512er_rsqrt28<mode><mask_name><round_saeonly_name>"
16272 [(set (match_operand:VF_512 0 "register_operand" "=v")
16274 [(match_operand:VF_512 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16277 "vrsqrt28<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
16278 [(set_attr "prefix" "evex")
16279 (set_attr "type" "sse")
16280 (set_attr "mode" "<MODE>")])
16282 (define_insn "avx512er_vmrsqrt28<mode><round_saeonly_name>"
16283 [(set (match_operand:VF_128 0 "register_operand" "=v")
16286 [(match_operand:VF_128 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
16288 (match_operand:VF_128 2 "register_operand" "v")
16291 "vrsqrt28<ssescalarmodesuffix>\t{<round_saeonly_op3>%1, %2, %0|%0, %2, %1<round_saeonly_op3>}"
16292 [(set_attr "length_immediate" "1")
16293 (set_attr "type" "sse")
16294 (set_attr "prefix" "evex")
16295 (set_attr "mode" "<MODE>")])
16297 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16299 ;; XOP instructions
16301 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16303 (define_code_iterator xop_plus [plus ss_plus])
16305 (define_code_attr macs [(plus "macs") (ss_plus "macss")])
16306 (define_code_attr madcs [(plus "madcs") (ss_plus "madcss")])
16308 ;; XOP parallel integer multiply/add instructions.
16310 (define_insn "xop_p<macs><ssemodesuffix><ssemodesuffix>"
16311 [(set (match_operand:VI24_128 0 "register_operand" "=x")
16314 (match_operand:VI24_128 1 "nonimmediate_operand" "%x")
16315 (match_operand:VI24_128 2 "nonimmediate_operand" "xm"))
16316 (match_operand:VI24_128 3 "register_operand" "x")))]
16318 "vp<macs><ssemodesuffix><ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16319 [(set_attr "type" "ssemuladd")
16320 (set_attr "mode" "TI")])
16322 (define_insn "xop_p<macs>dql"
16323 [(set (match_operand:V2DI 0 "register_operand" "=x")
16328 (match_operand:V4SI 1 "nonimmediate_operand" "%x")
16329 (parallel [(const_int 0) (const_int 2)])))
16332 (match_operand:V4SI 2 "nonimmediate_operand" "xm")
16333 (parallel [(const_int 0) (const_int 2)]))))
16334 (match_operand:V2DI 3 "register_operand" "x")))]
16336 "vp<macs>dql\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16337 [(set_attr "type" "ssemuladd")
16338 (set_attr "mode" "TI")])
16340 (define_insn "xop_p<macs>dqh"
16341 [(set (match_operand:V2DI 0 "register_operand" "=x")
16346 (match_operand:V4SI 1 "nonimmediate_operand" "%x")
16347 (parallel [(const_int 1) (const_int 3)])))
16350 (match_operand:V4SI 2 "nonimmediate_operand" "xm")
16351 (parallel [(const_int 1) (const_int 3)]))))
16352 (match_operand:V2DI 3 "register_operand" "x")))]
16354 "vp<macs>dqh\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16355 [(set_attr "type" "ssemuladd")
16356 (set_attr "mode" "TI")])
16358 ;; XOP parallel integer multiply/add instructions for the intrinisics
16359 (define_insn "xop_p<macs>wd"
16360 [(set (match_operand:V4SI 0 "register_operand" "=x")
16365 (match_operand:V8HI 1 "nonimmediate_operand" "%x")
16366 (parallel [(const_int 1) (const_int 3)
16367 (const_int 5) (const_int 7)])))
16370 (match_operand:V8HI 2 "nonimmediate_operand" "xm")
16371 (parallel [(const_int 1) (const_int 3)
16372 (const_int 5) (const_int 7)]))))
16373 (match_operand:V4SI 3 "register_operand" "x")))]
16375 "vp<macs>wd\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16376 [(set_attr "type" "ssemuladd")
16377 (set_attr "mode" "TI")])
16379 (define_insn "xop_p<madcs>wd"
16380 [(set (match_operand:V4SI 0 "register_operand" "=x")
16386 (match_operand:V8HI 1 "nonimmediate_operand" "%x")
16387 (parallel [(const_int 0) (const_int 2)
16388 (const_int 4) (const_int 6)])))
16391 (match_operand:V8HI 2 "nonimmediate_operand" "xm")
16392 (parallel [(const_int 0) (const_int 2)
16393 (const_int 4) (const_int 6)]))))
16398 (parallel [(const_int 1) (const_int 3)
16399 (const_int 5) (const_int 7)])))
16403 (parallel [(const_int 1) (const_int 3)
16404 (const_int 5) (const_int 7)])))))
16405 (match_operand:V4SI 3 "register_operand" "x")))]
16407 "vp<madcs>wd\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16408 [(set_attr "type" "ssemuladd")
16409 (set_attr "mode" "TI")])
16411 ;; XOP parallel XMM conditional moves
16412 (define_insn "xop_pcmov_<mode><avxsizesuffix>"
16413 [(set (match_operand:V 0 "register_operand" "=x,x")
16415 (match_operand:V 3 "nonimmediate_operand" "x,m")
16416 (match_operand:V 1 "register_operand" "x,x")
16417 (match_operand:V 2 "nonimmediate_operand" "xm,x")))]
16419 "vpcmov\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16420 [(set_attr "type" "sse4arg")])
16422 ;; XOP horizontal add/subtract instructions
16423 (define_insn "xop_phadd<u>bw"
16424 [(set (match_operand:V8HI 0 "register_operand" "=x")
16428 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
16429 (parallel [(const_int 0) (const_int 2)
16430 (const_int 4) (const_int 6)
16431 (const_int 8) (const_int 10)
16432 (const_int 12) (const_int 14)])))
16436 (parallel [(const_int 1) (const_int 3)
16437 (const_int 5) (const_int 7)
16438 (const_int 9) (const_int 11)
16439 (const_int 13) (const_int 15)])))))]
16441 "vphadd<u>bw\t{%1, %0|%0, %1}"
16442 [(set_attr "type" "sseiadd1")])
16444 (define_insn "xop_phadd<u>bd"
16445 [(set (match_operand:V4SI 0 "register_operand" "=x")
16450 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
16451 (parallel [(const_int 0) (const_int 4)
16452 (const_int 8) (const_int 12)])))
16456 (parallel [(const_int 1) (const_int 5)
16457 (const_int 9) (const_int 13)]))))
16462 (parallel [(const_int 2) (const_int 6)
16463 (const_int 10) (const_int 14)])))
16467 (parallel [(const_int 3) (const_int 7)
16468 (const_int 11) (const_int 15)]))))))]
16470 "vphadd<u>bd\t{%1, %0|%0, %1}"
16471 [(set_attr "type" "sseiadd1")])
16473 (define_insn "xop_phadd<u>bq"
16474 [(set (match_operand:V2DI 0 "register_operand" "=x")
16480 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
16481 (parallel [(const_int 0) (const_int 8)])))
16485 (parallel [(const_int 1) (const_int 9)]))))
16490 (parallel [(const_int 2) (const_int 10)])))
16494 (parallel [(const_int 3) (const_int 11)])))))
16500 (parallel [(const_int 4) (const_int 12)])))
16504 (parallel [(const_int 5) (const_int 13)]))))
16509 (parallel [(const_int 6) (const_int 14)])))
16513 (parallel [(const_int 7) (const_int 15)])))))))]
16515 "vphadd<u>bq\t{%1, %0|%0, %1}"
16516 [(set_attr "type" "sseiadd1")])
16518 (define_insn "xop_phadd<u>wd"
16519 [(set (match_operand:V4SI 0 "register_operand" "=x")
16523 (match_operand:V8HI 1 "nonimmediate_operand" "xm")
16524 (parallel [(const_int 0) (const_int 2)
16525 (const_int 4) (const_int 6)])))
16529 (parallel [(const_int 1) (const_int 3)
16530 (const_int 5) (const_int 7)])))))]
16532 "vphadd<u>wd\t{%1, %0|%0, %1}"
16533 [(set_attr "type" "sseiadd1")])
16535 (define_insn "xop_phadd<u>wq"
16536 [(set (match_operand:V2DI 0 "register_operand" "=x")
16541 (match_operand:V8HI 1 "nonimmediate_operand" "xm")
16542 (parallel [(const_int 0) (const_int 4)])))
16546 (parallel [(const_int 1) (const_int 5)]))))
16551 (parallel [(const_int 2) (const_int 6)])))
16555 (parallel [(const_int 3) (const_int 7)]))))))]
16557 "vphadd<u>wq\t{%1, %0|%0, %1}"
16558 [(set_attr "type" "sseiadd1")])
16560 (define_insn "xop_phadd<u>dq"
16561 [(set (match_operand:V2DI 0 "register_operand" "=x")
16565 (match_operand:V4SI 1 "nonimmediate_operand" "xm")
16566 (parallel [(const_int 0) (const_int 2)])))
16570 (parallel [(const_int 1) (const_int 3)])))))]
16572 "vphadd<u>dq\t{%1, %0|%0, %1}"
16573 [(set_attr "type" "sseiadd1")])
16575 (define_insn "xop_phsubbw"
16576 [(set (match_operand:V8HI 0 "register_operand" "=x")
16580 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
16581 (parallel [(const_int 0) (const_int 2)
16582 (const_int 4) (const_int 6)
16583 (const_int 8) (const_int 10)
16584 (const_int 12) (const_int 14)])))
16588 (parallel [(const_int 1) (const_int 3)
16589 (const_int 5) (const_int 7)
16590 (const_int 9) (const_int 11)
16591 (const_int 13) (const_int 15)])))))]
16593 "vphsubbw\t{%1, %0|%0, %1}"
16594 [(set_attr "type" "sseiadd1")])
16596 (define_insn "xop_phsubwd"
16597 [(set (match_operand:V4SI 0 "register_operand" "=x")
16601 (match_operand:V8HI 1 "nonimmediate_operand" "xm")
16602 (parallel [(const_int 0) (const_int 2)
16603 (const_int 4) (const_int 6)])))
16607 (parallel [(const_int 1) (const_int 3)
16608 (const_int 5) (const_int 7)])))))]
16610 "vphsubwd\t{%1, %0|%0, %1}"
16611 [(set_attr "type" "sseiadd1")])
16613 (define_insn "xop_phsubdq"
16614 [(set (match_operand:V2DI 0 "register_operand" "=x")
16618 (match_operand:V4SI 1 "nonimmediate_operand" "xm")
16619 (parallel [(const_int 0) (const_int 2)])))
16623 (parallel [(const_int 1) (const_int 3)])))))]
16625 "vphsubdq\t{%1, %0|%0, %1}"
16626 [(set_attr "type" "sseiadd1")])
16628 ;; XOP permute instructions
16629 (define_insn "xop_pperm"
16630 [(set (match_operand:V16QI 0 "register_operand" "=x,x")
16632 [(match_operand:V16QI 1 "register_operand" "x,x")
16633 (match_operand:V16QI 2 "nonimmediate_operand" "x,m")
16634 (match_operand:V16QI 3 "nonimmediate_operand" "xm,x")]
16635 UNSPEC_XOP_PERMUTE))]
16636 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
16637 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16638 [(set_attr "type" "sse4arg")
16639 (set_attr "mode" "TI")])
16641 ;; XOP pack instructions that combine two vectors into a smaller vector
16642 (define_insn "xop_pperm_pack_v2di_v4si"
16643 [(set (match_operand:V4SI 0 "register_operand" "=x,x")
16646 (match_operand:V2DI 1 "register_operand" "x,x"))
16648 (match_operand:V2DI 2 "nonimmediate_operand" "x,m"))))
16649 (use (match_operand:V16QI 3 "nonimmediate_operand" "xm,x"))]
16650 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
16651 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16652 [(set_attr "type" "sse4arg")
16653 (set_attr "mode" "TI")])
16655 (define_insn "xop_pperm_pack_v4si_v8hi"
16656 [(set (match_operand:V8HI 0 "register_operand" "=x,x")
16659 (match_operand:V4SI 1 "register_operand" "x,x"))
16661 (match_operand:V4SI 2 "nonimmediate_operand" "x,m"))))
16662 (use (match_operand:V16QI 3 "nonimmediate_operand" "xm,x"))]
16663 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
16664 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16665 [(set_attr "type" "sse4arg")
16666 (set_attr "mode" "TI")])
16668 (define_insn "xop_pperm_pack_v8hi_v16qi"
16669 [(set (match_operand:V16QI 0 "register_operand" "=x,x")
16672 (match_operand:V8HI 1 "register_operand" "x,x"))
16674 (match_operand:V8HI 2 "nonimmediate_operand" "x,m"))))
16675 (use (match_operand:V16QI 3 "nonimmediate_operand" "xm,x"))]
16676 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
16677 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16678 [(set_attr "type" "sse4arg")
16679 (set_attr "mode" "TI")])
16681 ;; XOP packed rotate instructions
16682 (define_expand "rotl<mode>3"
16683 [(set (match_operand:VI_128 0 "register_operand")
16685 (match_operand:VI_128 1 "nonimmediate_operand")
16686 (match_operand:SI 2 "general_operand")))]
16689 /* If we were given a scalar, convert it to parallel */
16690 if (! const_0_to_<sserotatemax>_operand (operands[2], SImode))
16692 rtvec vs = rtvec_alloc (<ssescalarnum>);
16693 rtx par = gen_rtx_PARALLEL (<MODE>mode, vs);
16694 rtx reg = gen_reg_rtx (<MODE>mode);
16695 rtx op2 = operands[2];
16698 if (GET_MODE (op2) != <ssescalarmode>mode)
16700 op2 = gen_reg_rtx (<ssescalarmode>mode);
16701 convert_move (op2, operands[2], false);
16704 for (i = 0; i < <ssescalarnum>; i++)
16705 RTVEC_ELT (vs, i) = op2;
16707 emit_insn (gen_vec_init<mode><ssescalarmodelower> (reg, par));
16708 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], reg));
16713 (define_expand "rotr<mode>3"
16714 [(set (match_operand:VI_128 0 "register_operand")
16716 (match_operand:VI_128 1 "nonimmediate_operand")
16717 (match_operand:SI 2 "general_operand")))]
16720 /* If we were given a scalar, convert it to parallel */
16721 if (! const_0_to_<sserotatemax>_operand (operands[2], SImode))
16723 rtvec vs = rtvec_alloc (<ssescalarnum>);
16724 rtx par = gen_rtx_PARALLEL (<MODE>mode, vs);
16725 rtx neg = gen_reg_rtx (<MODE>mode);
16726 rtx reg = gen_reg_rtx (<MODE>mode);
16727 rtx op2 = operands[2];
16730 if (GET_MODE (op2) != <ssescalarmode>mode)
16732 op2 = gen_reg_rtx (<ssescalarmode>mode);
16733 convert_move (op2, operands[2], false);
16736 for (i = 0; i < <ssescalarnum>; i++)
16737 RTVEC_ELT (vs, i) = op2;
16739 emit_insn (gen_vec_init<mode><ssescalarmodelower> (reg, par));
16740 emit_insn (gen_neg<mode>2 (neg, reg));
16741 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], neg));
16746 (define_insn "xop_rotl<mode>3"
16747 [(set (match_operand:VI_128 0 "register_operand" "=x")
16749 (match_operand:VI_128 1 "nonimmediate_operand" "xm")
16750 (match_operand:SI 2 "const_0_to_<sserotatemax>_operand" "n")))]
16752 "vprot<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
16753 [(set_attr "type" "sseishft")
16754 (set_attr "length_immediate" "1")
16755 (set_attr "mode" "TI")])
16757 (define_insn "xop_rotr<mode>3"
16758 [(set (match_operand:VI_128 0 "register_operand" "=x")
16760 (match_operand:VI_128 1 "nonimmediate_operand" "xm")
16761 (match_operand:SI 2 "const_0_to_<sserotatemax>_operand" "n")))]
16765 = GEN_INT (GET_MODE_BITSIZE (<ssescalarmode>mode) - INTVAL (operands[2]));
16766 return \"vprot<ssemodesuffix>\t{%3, %1, %0|%0, %1, %3}\";
16768 [(set_attr "type" "sseishft")
16769 (set_attr "length_immediate" "1")
16770 (set_attr "mode" "TI")])
16772 (define_expand "vrotr<mode>3"
16773 [(match_operand:VI_128 0 "register_operand")
16774 (match_operand:VI_128 1 "register_operand")
16775 (match_operand:VI_128 2 "register_operand")]
16778 rtx reg = gen_reg_rtx (<MODE>mode);
16779 emit_insn (gen_neg<mode>2 (reg, operands[2]));
16780 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], reg));
16784 (define_expand "vrotl<mode>3"
16785 [(match_operand:VI_128 0 "register_operand")
16786 (match_operand:VI_128 1 "register_operand")
16787 (match_operand:VI_128 2 "register_operand")]
16790 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], operands[2]));
16794 (define_insn "xop_vrotl<mode>3"
16795 [(set (match_operand:VI_128 0 "register_operand" "=x,x")
16796 (if_then_else:VI_128
16798 (match_operand:VI_128 2 "nonimmediate_operand" "x,m")
16801 (match_operand:VI_128 1 "nonimmediate_operand" "xm,x")
16805 (neg:VI_128 (match_dup 2)))))]
16806 "TARGET_XOP && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
16807 "vprot<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
16808 [(set_attr "type" "sseishft")
16809 (set_attr "prefix_data16" "0")
16810 (set_attr "prefix_extra" "2")
16811 (set_attr "mode" "TI")])
16813 ;; XOP packed shift instructions.
16814 (define_expand "vlshr<mode>3"
16815 [(set (match_operand:VI12_128 0 "register_operand")
16817 (match_operand:VI12_128 1 "register_operand")
16818 (match_operand:VI12_128 2 "nonimmediate_operand")))]
16821 rtx neg = gen_reg_rtx (<MODE>mode);
16822 emit_insn (gen_neg<mode>2 (neg, operands[2]));
16823 emit_insn (gen_xop_shl<mode>3 (operands[0], operands[1], neg));
16827 (define_expand "vlshr<mode>3"
16828 [(set (match_operand:VI48_128 0 "register_operand")
16830 (match_operand:VI48_128 1 "register_operand")
16831 (match_operand:VI48_128 2 "nonimmediate_operand")))]
16832 "TARGET_AVX2 || TARGET_XOP"
16836 rtx neg = gen_reg_rtx (<MODE>mode);
16837 emit_insn (gen_neg<mode>2 (neg, operands[2]));
16838 emit_insn (gen_xop_shl<mode>3 (operands[0], operands[1], neg));
16843 (define_expand "vlshr<mode>3"
16844 [(set (match_operand:VI48_512 0 "register_operand")
16846 (match_operand:VI48_512 1 "register_operand")
16847 (match_operand:VI48_512 2 "nonimmediate_operand")))]
16850 (define_expand "vlshr<mode>3"
16851 [(set (match_operand:VI48_256 0 "register_operand")
16853 (match_operand:VI48_256 1 "register_operand")
16854 (match_operand:VI48_256 2 "nonimmediate_operand")))]
16857 (define_expand "vashrv8hi3<mask_name>"
16858 [(set (match_operand:V8HI 0 "register_operand")
16860 (match_operand:V8HI 1 "register_operand")
16861 (match_operand:V8HI 2 "nonimmediate_operand")))]
16862 "TARGET_XOP || (TARGET_AVX512BW && TARGET_AVX512VL)"
16866 rtx neg = gen_reg_rtx (V8HImode);
16867 emit_insn (gen_negv8hi2 (neg, operands[2]));
16868 emit_insn (gen_xop_shav8hi3 (operands[0], operands[1], neg));
16873 (define_expand "vashrv16qi3"
16874 [(set (match_operand:V16QI 0 "register_operand")
16876 (match_operand:V16QI 1 "register_operand")
16877 (match_operand:V16QI 2 "nonimmediate_operand")))]
16880 rtx neg = gen_reg_rtx (V16QImode);
16881 emit_insn (gen_negv16qi2 (neg, operands[2]));
16882 emit_insn (gen_xop_shav16qi3 (operands[0], operands[1], neg));
16886 (define_expand "vashrv2di3<mask_name>"
16887 [(set (match_operand:V2DI 0 "register_operand")
16889 (match_operand:V2DI 1 "register_operand")
16890 (match_operand:V2DI 2 "nonimmediate_operand")))]
16891 "TARGET_XOP || TARGET_AVX512VL"
16895 rtx neg = gen_reg_rtx (V2DImode);
16896 emit_insn (gen_negv2di2 (neg, operands[2]));
16897 emit_insn (gen_xop_shav2di3 (operands[0], operands[1], neg));
16902 (define_expand "vashrv4si3"
16903 [(set (match_operand:V4SI 0 "register_operand")
16904 (ashiftrt:V4SI (match_operand:V4SI 1 "register_operand")
16905 (match_operand:V4SI 2 "nonimmediate_operand")))]
16906 "TARGET_AVX2 || TARGET_XOP"
16910 rtx neg = gen_reg_rtx (V4SImode);
16911 emit_insn (gen_negv4si2 (neg, operands[2]));
16912 emit_insn (gen_xop_shav4si3 (operands[0], operands[1], neg));
16917 (define_expand "vashrv16si3"
16918 [(set (match_operand:V16SI 0 "register_operand")
16919 (ashiftrt:V16SI (match_operand:V16SI 1 "register_operand")
16920 (match_operand:V16SI 2 "nonimmediate_operand")))]
16923 (define_expand "vashrv8si3"
16924 [(set (match_operand:V8SI 0 "register_operand")
16925 (ashiftrt:V8SI (match_operand:V8SI 1 "register_operand")
16926 (match_operand:V8SI 2 "nonimmediate_operand")))]
16929 (define_expand "vashl<mode>3"
16930 [(set (match_operand:VI12_128 0 "register_operand")
16932 (match_operand:VI12_128 1 "register_operand")
16933 (match_operand:VI12_128 2 "nonimmediate_operand")))]
16936 emit_insn (gen_xop_sha<mode>3 (operands[0], operands[1], operands[2]));
16940 (define_expand "vashl<mode>3"
16941 [(set (match_operand:VI48_128 0 "register_operand")
16943 (match_operand:VI48_128 1 "register_operand")
16944 (match_operand:VI48_128 2 "nonimmediate_operand")))]
16945 "TARGET_AVX2 || TARGET_XOP"
16949 operands[2] = force_reg (<MODE>mode, operands[2]);
16950 emit_insn (gen_xop_sha<mode>3 (operands[0], operands[1], operands[2]));
16955 (define_expand "vashl<mode>3"
16956 [(set (match_operand:VI48_512 0 "register_operand")
16958 (match_operand:VI48_512 1 "register_operand")
16959 (match_operand:VI48_512 2 "nonimmediate_operand")))]
16962 (define_expand "vashl<mode>3"
16963 [(set (match_operand:VI48_256 0 "register_operand")
16965 (match_operand:VI48_256 1 "register_operand")
16966 (match_operand:VI48_256 2 "nonimmediate_operand")))]
16969 (define_insn "xop_sha<mode>3"
16970 [(set (match_operand:VI_128 0 "register_operand" "=x,x")
16971 (if_then_else:VI_128
16973 (match_operand:VI_128 2 "nonimmediate_operand" "x,m")
16976 (match_operand:VI_128 1 "nonimmediate_operand" "xm,x")
16980 (neg:VI_128 (match_dup 2)))))]
16981 "TARGET_XOP && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
16982 "vpsha<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
16983 [(set_attr "type" "sseishft")
16984 (set_attr "prefix_data16" "0")
16985 (set_attr "prefix_extra" "2")
16986 (set_attr "mode" "TI")])
16988 (define_insn "xop_shl<mode>3"
16989 [(set (match_operand:VI_128 0 "register_operand" "=x,x")
16990 (if_then_else:VI_128
16992 (match_operand:VI_128 2 "nonimmediate_operand" "x,m")
16995 (match_operand:VI_128 1 "nonimmediate_operand" "xm,x")
16999 (neg:VI_128 (match_dup 2)))))]
17000 "TARGET_XOP && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
17001 "vpshl<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
17002 [(set_attr "type" "sseishft")
17003 (set_attr "prefix_data16" "0")
17004 (set_attr "prefix_extra" "2")
17005 (set_attr "mode" "TI")])
17007 (define_expand "<shift_insn><mode>3"
17008 [(set (match_operand:VI1_AVX512 0 "register_operand")
17009 (any_shift:VI1_AVX512
17010 (match_operand:VI1_AVX512 1 "register_operand")
17011 (match_operand:SI 2 "nonmemory_operand")))]
17014 if (TARGET_XOP && <MODE>mode == V16QImode)
17016 bool negate = false;
17017 rtx (*gen) (rtx, rtx, rtx);
17021 if (<CODE> != ASHIFT)
17023 if (CONST_INT_P (operands[2]))
17024 operands[2] = GEN_INT (-INTVAL (operands[2]));
17028 par = gen_rtx_PARALLEL (V16QImode, rtvec_alloc (16));
17029 for (i = 0; i < 16; i++)
17030 XVECEXP (par, 0, i) = operands[2];
17032 tmp = gen_reg_rtx (V16QImode);
17033 emit_insn (gen_vec_initv16qiqi (tmp, par));
17036 emit_insn (gen_negv16qi2 (tmp, tmp));
17038 gen = (<CODE> == LSHIFTRT ? gen_xop_shlv16qi3 : gen_xop_shav16qi3);
17039 emit_insn (gen (operands[0], operands[1], tmp));
17042 ix86_expand_vecop_qihi (<CODE>, operands[0], operands[1], operands[2]);
17046 (define_expand "ashrv2di3"
17047 [(set (match_operand:V2DI 0 "register_operand")
17049 (match_operand:V2DI 1 "register_operand")
17050 (match_operand:DI 2 "nonmemory_operand")))]
17051 "TARGET_XOP || TARGET_AVX512VL"
17053 if (!TARGET_AVX512VL)
17055 rtx reg = gen_reg_rtx (V2DImode);
17057 bool negate = false;
17060 if (CONST_INT_P (operands[2]))
17061 operands[2] = GEN_INT (-INTVAL (operands[2]));
17065 par = gen_rtx_PARALLEL (V2DImode, rtvec_alloc (2));
17066 for (i = 0; i < 2; i++)
17067 XVECEXP (par, 0, i) = operands[2];
17069 emit_insn (gen_vec_initv2didi (reg, par));
17072 emit_insn (gen_negv2di2 (reg, reg));
17074 emit_insn (gen_xop_shav2di3 (operands[0], operands[1], reg));
17079 ;; XOP FRCZ support
17080 (define_insn "xop_frcz<mode>2"
17081 [(set (match_operand:FMAMODE 0 "register_operand" "=x")
17083 [(match_operand:FMAMODE 1 "nonimmediate_operand" "xm")]
17086 "vfrcz<ssemodesuffix>\t{%1, %0|%0, %1}"
17087 [(set_attr "type" "ssecvt1")
17088 (set_attr "mode" "<MODE>")])
17090 (define_expand "xop_vmfrcz<mode>2"
17091 [(set (match_operand:VF_128 0 "register_operand")
17094 [(match_operand:VF_128 1 "nonimmediate_operand")]
17099 "operands[2] = CONST0_RTX (<MODE>mode);")
17101 (define_insn "*xop_vmfrcz<mode>2"
17102 [(set (match_operand:VF_128 0 "register_operand" "=x")
17105 [(match_operand:VF_128 1 "nonimmediate_operand" "xm")]
17107 (match_operand:VF_128 2 "const0_operand")
17110 "vfrcz<ssescalarmodesuffix>\t{%1, %0|%0, %<iptr>1}"
17111 [(set_attr "type" "ssecvt1")
17112 (set_attr "mode" "<MODE>")])
17114 (define_insn "xop_maskcmp<mode>3"
17115 [(set (match_operand:VI_128 0 "register_operand" "=x")
17116 (match_operator:VI_128 1 "ix86_comparison_int_operator"
17117 [(match_operand:VI_128 2 "register_operand" "x")
17118 (match_operand:VI_128 3 "nonimmediate_operand" "xm")]))]
17120 "vpcom%Y1<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}"
17121 [(set_attr "type" "sse4arg")
17122 (set_attr "prefix_data16" "0")
17123 (set_attr "prefix_rep" "0")
17124 (set_attr "prefix_extra" "2")
17125 (set_attr "length_immediate" "1")
17126 (set_attr "mode" "TI")])
17128 (define_insn "xop_maskcmp_uns<mode>3"
17129 [(set (match_operand:VI_128 0 "register_operand" "=x")
17130 (match_operator:VI_128 1 "ix86_comparison_uns_operator"
17131 [(match_operand:VI_128 2 "register_operand" "x")
17132 (match_operand:VI_128 3 "nonimmediate_operand" "xm")]))]
17134 "vpcom%Y1u<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}"
17135 [(set_attr "type" "ssecmp")
17136 (set_attr "prefix_data16" "0")
17137 (set_attr "prefix_rep" "0")
17138 (set_attr "prefix_extra" "2")
17139 (set_attr "length_immediate" "1")
17140 (set_attr "mode" "TI")])
17142 ;; Version of pcom*u* that is called from the intrinsics that allows pcomequ*
17143 ;; and pcomneu* not to be converted to the signed ones in case somebody needs
17144 ;; the exact instruction generated for the intrinsic.
17145 (define_insn "xop_maskcmp_uns2<mode>3"
17146 [(set (match_operand:VI_128 0 "register_operand" "=x")
17148 [(match_operator:VI_128 1 "ix86_comparison_uns_operator"
17149 [(match_operand:VI_128 2 "register_operand" "x")
17150 (match_operand:VI_128 3 "nonimmediate_operand" "xm")])]
17151 UNSPEC_XOP_UNSIGNED_CMP))]
17153 "vpcom%Y1u<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}"
17154 [(set_attr "type" "ssecmp")
17155 (set_attr "prefix_data16" "0")
17156 (set_attr "prefix_extra" "2")
17157 (set_attr "length_immediate" "1")
17158 (set_attr "mode" "TI")])
17160 ;; Pcomtrue and pcomfalse support. These are useless instructions, but are
17161 ;; being added here to be complete.
17162 (define_insn "xop_pcom_tf<mode>3"
17163 [(set (match_operand:VI_128 0 "register_operand" "=x")
17165 [(match_operand:VI_128 1 "register_operand" "x")
17166 (match_operand:VI_128 2 "nonimmediate_operand" "xm")
17167 (match_operand:SI 3 "const_int_operand" "n")]
17168 UNSPEC_XOP_TRUEFALSE))]
17171 return ((INTVAL (operands[3]) != 0)
17172 ? "vpcomtrue<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
17173 : "vpcomfalse<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}");
17175 [(set_attr "type" "ssecmp")
17176 (set_attr "prefix_data16" "0")
17177 (set_attr "prefix_extra" "2")
17178 (set_attr "length_immediate" "1")
17179 (set_attr "mode" "TI")])
17181 (define_insn "xop_vpermil2<mode>3"
17182 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x")
17184 [(match_operand:VF_128_256 1 "register_operand" "x,x")
17185 (match_operand:VF_128_256 2 "nonimmediate_operand" "x,m")
17186 (match_operand:<sseintvecmode> 3 "nonimmediate_operand" "xm,x")
17187 (match_operand:SI 4 "const_0_to_3_operand" "n,n")]
17190 "vpermil2<ssemodesuffix>\t{%4, %3, %2, %1, %0|%0, %1, %2, %3, %4}"
17191 [(set_attr "type" "sse4arg")
17192 (set_attr "length_immediate" "1")
17193 (set_attr "mode" "<MODE>")])
17195 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
17197 (define_insn "aesenc"
17198 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17199 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17200 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
17204 aesenc\t{%2, %0|%0, %2}
17205 vaesenc\t{%2, %1, %0|%0, %1, %2}"
17206 [(set_attr "isa" "noavx,avx")
17207 (set_attr "type" "sselog1")
17208 (set_attr "prefix_extra" "1")
17209 (set_attr "prefix" "orig,vex")
17210 (set_attr "btver2_decode" "double,double")
17211 (set_attr "mode" "TI")])
17213 (define_insn "aesenclast"
17214 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17215 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17216 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
17217 UNSPEC_AESENCLAST))]
17220 aesenclast\t{%2, %0|%0, %2}
17221 vaesenclast\t{%2, %1, %0|%0, %1, %2}"
17222 [(set_attr "isa" "noavx,avx")
17223 (set_attr "type" "sselog1")
17224 (set_attr "prefix_extra" "1")
17225 (set_attr "prefix" "orig,vex")
17226 (set_attr "btver2_decode" "double,double")
17227 (set_attr "mode" "TI")])
17229 (define_insn "aesdec"
17230 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17231 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17232 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
17236 aesdec\t{%2, %0|%0, %2}
17237 vaesdec\t{%2, %1, %0|%0, %1, %2}"
17238 [(set_attr "isa" "noavx,avx")
17239 (set_attr "type" "sselog1")
17240 (set_attr "prefix_extra" "1")
17241 (set_attr "prefix" "orig,vex")
17242 (set_attr "btver2_decode" "double,double")
17243 (set_attr "mode" "TI")])
17245 (define_insn "aesdeclast"
17246 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17247 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17248 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
17249 UNSPEC_AESDECLAST))]
17252 aesdeclast\t{%2, %0|%0, %2}
17253 vaesdeclast\t{%2, %1, %0|%0, %1, %2}"
17254 [(set_attr "isa" "noavx,avx")
17255 (set_attr "type" "sselog1")
17256 (set_attr "prefix_extra" "1")
17257 (set_attr "prefix" "orig,vex")
17258 (set_attr "btver2_decode" "double,double")
17259 (set_attr "mode" "TI")])
17261 (define_insn "aesimc"
17262 [(set (match_operand:V2DI 0 "register_operand" "=x")
17263 (unspec:V2DI [(match_operand:V2DI 1 "vector_operand" "xBm")]
17266 "%vaesimc\t{%1, %0|%0, %1}"
17267 [(set_attr "type" "sselog1")
17268 (set_attr "prefix_extra" "1")
17269 (set_attr "prefix" "maybe_vex")
17270 (set_attr "mode" "TI")])
17272 (define_insn "aeskeygenassist"
17273 [(set (match_operand:V2DI 0 "register_operand" "=x")
17274 (unspec:V2DI [(match_operand:V2DI 1 "vector_operand" "xBm")
17275 (match_operand:SI 2 "const_0_to_255_operand" "n")]
17276 UNSPEC_AESKEYGENASSIST))]
17278 "%vaeskeygenassist\t{%2, %1, %0|%0, %1, %2}"
17279 [(set_attr "type" "sselog1")
17280 (set_attr "prefix_extra" "1")
17281 (set_attr "length_immediate" "1")
17282 (set_attr "prefix" "maybe_vex")
17283 (set_attr "mode" "TI")])
17285 (define_insn "pclmulqdq"
17286 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
17287 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
17288 (match_operand:V2DI 2 "vector_operand" "xBm,xm")
17289 (match_operand:SI 3 "const_0_to_255_operand" "n,n")]
17293 pclmulqdq\t{%3, %2, %0|%0, %2, %3}
17294 vpclmulqdq\t{%3, %2, %1, %0|%0, %1, %2, %3}"
17295 [(set_attr "isa" "noavx,avx")
17296 (set_attr "type" "sselog1")
17297 (set_attr "prefix_extra" "1")
17298 (set_attr "length_immediate" "1")
17299 (set_attr "prefix" "orig,vex")
17300 (set_attr "mode" "TI")])
17302 (define_expand "avx_vzeroall"
17303 [(match_par_dup 0 [(const_int 0)])]
17306 int nregs = TARGET_64BIT ? 16 : 8;
17309 operands[0] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (nregs + 1));
17311 XVECEXP (operands[0], 0, 0)
17312 = gen_rtx_UNSPEC_VOLATILE (VOIDmode, gen_rtvec (1, const0_rtx),
17315 for (regno = 0; regno < nregs; regno++)
17316 XVECEXP (operands[0], 0, regno + 1)
17317 = gen_rtx_SET (gen_rtx_REG (V8SImode, SSE_REGNO (regno)),
17318 CONST0_RTX (V8SImode));
17321 (define_insn "*avx_vzeroall"
17322 [(match_parallel 0 "vzeroall_operation"
17323 [(unspec_volatile [(const_int 0)] UNSPECV_VZEROALL)])]
17326 [(set_attr "type" "sse")
17327 (set_attr "modrm" "0")
17328 (set_attr "memory" "none")
17329 (set_attr "prefix" "vex")
17330 (set_attr "btver2_decode" "vector")
17331 (set_attr "mode" "OI")])
17333 ;; Clear the upper 128bits of AVX registers, equivalent to a NOP
17334 ;; if the upper 128bits are unused.
17335 (define_insn "avx_vzeroupper"
17336 [(unspec_volatile [(const_int 0)] UNSPECV_VZEROUPPER)]
17339 [(set_attr "type" "sse")
17340 (set_attr "modrm" "0")
17341 (set_attr "memory" "none")
17342 (set_attr "prefix" "vex")
17343 (set_attr "btver2_decode" "vector")
17344 (set_attr "mode" "OI")])
17346 (define_mode_attr pbroadcast_evex_isa
17347 [(V64QI "avx512bw") (V32QI "avx512bw") (V16QI "avx512bw")
17348 (V32HI "avx512bw") (V16HI "avx512bw") (V8HI "avx512bw")
17349 (V16SI "avx512f") (V8SI "avx512f") (V4SI "avx512f")
17350 (V8DI "avx512f") (V4DI "avx512f") (V2DI "avx512f")])
17352 (define_insn "avx2_pbroadcast<mode>"
17353 [(set (match_operand:VI 0 "register_operand" "=x,v")
17355 (vec_select:<ssescalarmode>
17356 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "xm,vm")
17357 (parallel [(const_int 0)]))))]
17359 "vpbroadcast<ssemodesuffix>\t{%1, %0|%0, %<iptr>1}"
17360 [(set_attr "isa" "*,<pbroadcast_evex_isa>")
17361 (set_attr "type" "ssemov")
17362 (set_attr "prefix_extra" "1")
17363 (set_attr "prefix" "vex,evex")
17364 (set_attr "mode" "<sseinsnmode>")])
17366 (define_insn "avx2_pbroadcast<mode>_1"
17367 [(set (match_operand:VI_256 0 "register_operand" "=x,x,v,v")
17368 (vec_duplicate:VI_256
17369 (vec_select:<ssescalarmode>
17370 (match_operand:VI_256 1 "nonimmediate_operand" "m,x,m,v")
17371 (parallel [(const_int 0)]))))]
17374 vpbroadcast<ssemodesuffix>\t{%1, %0|%0, %<iptr>1}
17375 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %x1}
17376 vpbroadcast<ssemodesuffix>\t{%1, %0|%0, %<iptr>1}
17377 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %x1}"
17378 [(set_attr "isa" "*,*,<pbroadcast_evex_isa>,<pbroadcast_evex_isa>")
17379 (set_attr "type" "ssemov")
17380 (set_attr "prefix_extra" "1")
17381 (set_attr "prefix" "vex")
17382 (set_attr "mode" "<sseinsnmode>")])
17384 (define_insn "<avx2_avx512>_permvar<mode><mask_name>"
17385 [(set (match_operand:VI48F_256_512 0 "register_operand" "=v")
17386 (unspec:VI48F_256_512
17387 [(match_operand:VI48F_256_512 1 "nonimmediate_operand" "vm")
17388 (match_operand:<sseintvecmode> 2 "register_operand" "v")]
17390 "TARGET_AVX2 && <mask_mode512bit_condition>"
17391 "vperm<ssemodesuffix>\t{%1, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1}"
17392 [(set_attr "type" "sselog")
17393 (set_attr "prefix" "<mask_prefix2>")
17394 (set_attr "mode" "<sseinsnmode>")])
17396 (define_insn "<avx512>_permvar<mode><mask_name>"
17397 [(set (match_operand:VI1_AVX512VL 0 "register_operand" "=v")
17398 (unspec:VI1_AVX512VL
17399 [(match_operand:VI1_AVX512VL 1 "nonimmediate_operand" "vm")
17400 (match_operand:<sseintvecmode> 2 "register_operand" "v")]
17402 "TARGET_AVX512VBMI && <mask_mode512bit_condition>"
17403 "vperm<ssemodesuffix>\t{%1, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1}"
17404 [(set_attr "type" "sselog")
17405 (set_attr "prefix" "<mask_prefix2>")
17406 (set_attr "mode" "<sseinsnmode>")])
17408 (define_insn "<avx512>_permvar<mode><mask_name>"
17409 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
17410 (unspec:VI2_AVX512VL
17411 [(match_operand:VI2_AVX512VL 1 "nonimmediate_operand" "vm")
17412 (match_operand:<sseintvecmode> 2 "register_operand" "v")]
17414 "TARGET_AVX512BW && <mask_mode512bit_condition>"
17415 "vperm<ssemodesuffix>\t{%1, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1}"
17416 [(set_attr "type" "sselog")
17417 (set_attr "prefix" "<mask_prefix2>")
17418 (set_attr "mode" "<sseinsnmode>")])
17420 (define_expand "avx2_perm<mode>"
17421 [(match_operand:VI8F_256 0 "register_operand")
17422 (match_operand:VI8F_256 1 "nonimmediate_operand")
17423 (match_operand:SI 2 "const_0_to_255_operand")]
17426 int mask = INTVAL (operands[2]);
17427 emit_insn (gen_avx2_perm<mode>_1 (operands[0], operands[1],
17428 GEN_INT ((mask >> 0) & 3),
17429 GEN_INT ((mask >> 2) & 3),
17430 GEN_INT ((mask >> 4) & 3),
17431 GEN_INT ((mask >> 6) & 3)));
17435 (define_expand "avx512vl_perm<mode>_mask"
17436 [(match_operand:VI8F_256 0 "register_operand")
17437 (match_operand:VI8F_256 1 "nonimmediate_operand")
17438 (match_operand:SI 2 "const_0_to_255_operand")
17439 (match_operand:VI8F_256 3 "vector_move_operand")
17440 (match_operand:<avx512fmaskmode> 4 "register_operand")]
17443 int mask = INTVAL (operands[2]);
17444 emit_insn (gen_<avx2_avx512>_perm<mode>_1_mask (operands[0], operands[1],
17445 GEN_INT ((mask >> 0) & 3),
17446 GEN_INT ((mask >> 2) & 3),
17447 GEN_INT ((mask >> 4) & 3),
17448 GEN_INT ((mask >> 6) & 3),
17449 operands[3], operands[4]));
17453 (define_insn "avx2_perm<mode>_1<mask_name>"
17454 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
17455 (vec_select:VI8F_256
17456 (match_operand:VI8F_256 1 "nonimmediate_operand" "vm")
17457 (parallel [(match_operand 2 "const_0_to_3_operand")
17458 (match_operand 3 "const_0_to_3_operand")
17459 (match_operand 4 "const_0_to_3_operand")
17460 (match_operand 5 "const_0_to_3_operand")])))]
17461 "TARGET_AVX2 && <mask_mode512bit_condition>"
17464 mask |= INTVAL (operands[2]) << 0;
17465 mask |= INTVAL (operands[3]) << 2;
17466 mask |= INTVAL (operands[4]) << 4;
17467 mask |= INTVAL (operands[5]) << 6;
17468 operands[2] = GEN_INT (mask);
17469 return "vperm<ssemodesuffix>\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
17471 [(set_attr "type" "sselog")
17472 (set_attr "prefix" "<mask_prefix2>")
17473 (set_attr "mode" "<sseinsnmode>")])
17475 (define_expand "avx512f_perm<mode>"
17476 [(match_operand:V8FI 0 "register_operand")
17477 (match_operand:V8FI 1 "nonimmediate_operand")
17478 (match_operand:SI 2 "const_0_to_255_operand")]
17481 int mask = INTVAL (operands[2]);
17482 emit_insn (gen_avx512f_perm<mode>_1 (operands[0], operands[1],
17483 GEN_INT ((mask >> 0) & 3),
17484 GEN_INT ((mask >> 2) & 3),
17485 GEN_INT ((mask >> 4) & 3),
17486 GEN_INT ((mask >> 6) & 3),
17487 GEN_INT (((mask >> 0) & 3) + 4),
17488 GEN_INT (((mask >> 2) & 3) + 4),
17489 GEN_INT (((mask >> 4) & 3) + 4),
17490 GEN_INT (((mask >> 6) & 3) + 4)));
17494 (define_expand "avx512f_perm<mode>_mask"
17495 [(match_operand:V8FI 0 "register_operand")
17496 (match_operand:V8FI 1 "nonimmediate_operand")
17497 (match_operand:SI 2 "const_0_to_255_operand")
17498 (match_operand:V8FI 3 "vector_move_operand")
17499 (match_operand:<avx512fmaskmode> 4 "register_operand")]
17502 int mask = INTVAL (operands[2]);
17503 emit_insn (gen_avx512f_perm<mode>_1_mask (operands[0], operands[1],
17504 GEN_INT ((mask >> 0) & 3),
17505 GEN_INT ((mask >> 2) & 3),
17506 GEN_INT ((mask >> 4) & 3),
17507 GEN_INT ((mask >> 6) & 3),
17508 GEN_INT (((mask >> 0) & 3) + 4),
17509 GEN_INT (((mask >> 2) & 3) + 4),
17510 GEN_INT (((mask >> 4) & 3) + 4),
17511 GEN_INT (((mask >> 6) & 3) + 4),
17512 operands[3], operands[4]));
17516 (define_insn "avx512f_perm<mode>_1<mask_name>"
17517 [(set (match_operand:V8FI 0 "register_operand" "=v")
17519 (match_operand:V8FI 1 "nonimmediate_operand" "vm")
17520 (parallel [(match_operand 2 "const_0_to_3_operand")
17521 (match_operand 3 "const_0_to_3_operand")
17522 (match_operand 4 "const_0_to_3_operand")
17523 (match_operand 5 "const_0_to_3_operand")
17524 (match_operand 6 "const_4_to_7_operand")
17525 (match_operand 7 "const_4_to_7_operand")
17526 (match_operand 8 "const_4_to_7_operand")
17527 (match_operand 9 "const_4_to_7_operand")])))]
17528 "TARGET_AVX512F && <mask_mode512bit_condition>
17529 && (INTVAL (operands[2]) == (INTVAL (operands[6]) - 4)
17530 && INTVAL (operands[3]) == (INTVAL (operands[7]) - 4)
17531 && INTVAL (operands[4]) == (INTVAL (operands[8]) - 4)
17532 && INTVAL (operands[5]) == (INTVAL (operands[9]) - 4))"
17535 mask |= INTVAL (operands[2]) << 0;
17536 mask |= INTVAL (operands[3]) << 2;
17537 mask |= INTVAL (operands[4]) << 4;
17538 mask |= INTVAL (operands[5]) << 6;
17539 operands[2] = GEN_INT (mask);
17540 return "vperm<ssemodesuffix>\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
17542 [(set_attr "type" "sselog")
17543 (set_attr "prefix" "<mask_prefix2>")
17544 (set_attr "mode" "<sseinsnmode>")])
17546 (define_insn "avx2_permv2ti"
17547 [(set (match_operand:V4DI 0 "register_operand" "=x")
17549 [(match_operand:V4DI 1 "register_operand" "x")
17550 (match_operand:V4DI 2 "nonimmediate_operand" "xm")
17551 (match_operand:SI 3 "const_0_to_255_operand" "n")]
17554 "vperm2i128\t{%3, %2, %1, %0|%0, %1, %2, %3}"
17555 [(set_attr "type" "sselog")
17556 (set_attr "prefix" "vex")
17557 (set_attr "mode" "OI")])
17559 (define_insn "avx2_vec_dupv4df"
17560 [(set (match_operand:V4DF 0 "register_operand" "=v")
17561 (vec_duplicate:V4DF
17563 (match_operand:V2DF 1 "register_operand" "v")
17564 (parallel [(const_int 0)]))))]
17566 "vbroadcastsd\t{%1, %0|%0, %1}"
17567 [(set_attr "type" "sselog1")
17568 (set_attr "prefix" "maybe_evex")
17569 (set_attr "mode" "V4DF")])
17571 (define_insn "<avx512>_vec_dup<mode>_1"
17572 [(set (match_operand:VI_AVX512BW 0 "register_operand" "=v,v")
17573 (vec_duplicate:VI_AVX512BW
17574 (vec_select:<ssescalarmode>
17575 (match_operand:VI_AVX512BW 1 "nonimmediate_operand" "v,m")
17576 (parallel [(const_int 0)]))))]
17579 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %x1}
17580 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %<iptr>1}"
17581 [(set_attr "type" "ssemov")
17582 (set_attr "prefix" "evex")
17583 (set_attr "mode" "<sseinsnmode>")])
17585 (define_insn "<avx512>_vec_dup<mode><mask_name>"
17586 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v")
17587 (vec_duplicate:V48_AVX512VL
17588 (vec_select:<ssescalarmode>
17589 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "vm")
17590 (parallel [(const_int 0)]))))]
17593 /* There is no DF broadcast (in AVX-512*) to 128b register.
17594 Mimic it with integer variant. */
17595 if (<MODE>mode == V2DFmode)
17596 return "vpbroadcastq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}";
17598 if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 4)
17599 return "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}";
17601 return "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}";
17603 [(set_attr "type" "ssemov")
17604 (set_attr "prefix" "evex")
17605 (set_attr "mode" "<sseinsnmode>")])
17607 (define_insn "<avx512>_vec_dup<mode><mask_name>"
17608 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
17609 (vec_duplicate:VI12_AVX512VL
17610 (vec_select:<ssescalarmode>
17611 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "vm")
17612 (parallel [(const_int 0)]))))]
17614 "vpbroadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17615 [(set_attr "type" "ssemov")
17616 (set_attr "prefix" "evex")
17617 (set_attr "mode" "<sseinsnmode>")])
17619 (define_insn "<mask_codefor>avx512f_broadcast<mode><mask_name>"
17620 [(set (match_operand:V16FI 0 "register_operand" "=v,v")
17621 (vec_duplicate:V16FI
17622 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "v,m")))]
17625 vshuf<shuffletype>32x4\t{$0x0, %g1, %g1, %0<mask_operand2>|%0<mask_operand2>, %g1, %g1, 0x0}
17626 vbroadcast<shuffletype>32x4\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17627 [(set_attr "type" "ssemov")
17628 (set_attr "prefix" "evex")
17629 (set_attr "mode" "<sseinsnmode>")])
17631 (define_insn "<mask_codefor>avx512f_broadcast<mode><mask_name>"
17632 [(set (match_operand:V8FI 0 "register_operand" "=v,v")
17633 (vec_duplicate:V8FI
17634 (match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "v,m")))]
17637 vshuf<shuffletype>64x2\t{$0x44, %g1, %g1, %0<mask_operand2>|%0<mask_operand2>, %g1, %g1, 0x44}
17638 vbroadcast<shuffletype>64x4\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17639 [(set_attr "type" "ssemov")
17640 (set_attr "prefix" "evex")
17641 (set_attr "mode" "<sseinsnmode>")])
17643 (define_insn "<mask_codefor><avx512>_vec_dup_gpr<mode><mask_name>"
17644 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v,v")
17645 (vec_duplicate:VI12_AVX512VL
17646 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "vm,r")))]
17649 vpbroadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}
17650 vpbroadcast<bcstscalarsuff>\t{%k1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
17651 [(set_attr "type" "ssemov")
17652 (set_attr "prefix" "evex")
17653 (set_attr "mode" "<sseinsnmode>")])
17655 (define_insn "<mask_codefor><avx512>_vec_dup_gpr<mode><mask_name>"
17656 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v,v")
17657 (vec_duplicate:V48_AVX512VL
17658 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "vm,r")))]
17660 "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17661 [(set_attr "type" "ssemov")
17662 (set_attr "prefix" "evex")
17663 (set_attr "mode" "<sseinsnmode>")
17664 (set (attr "enabled")
17665 (if_then_else (eq_attr "alternative" "1")
17666 (symbol_ref "GET_MODE_CLASS (<ssescalarmode>mode) == MODE_INT
17667 && (<ssescalarmode>mode != DImode || TARGET_64BIT)")
17670 (define_insn "vec_dupv4sf"
17671 [(set (match_operand:V4SF 0 "register_operand" "=v,v,x")
17672 (vec_duplicate:V4SF
17673 (match_operand:SF 1 "nonimmediate_operand" "Yv,m,0")))]
17676 vshufps\t{$0, %1, %1, %0|%0, %1, %1, 0}
17677 vbroadcastss\t{%1, %0|%0, %1}
17678 shufps\t{$0, %0, %0|%0, %0, 0}"
17679 [(set_attr "isa" "avx,avx,noavx")
17680 (set_attr "type" "sseshuf1,ssemov,sseshuf1")
17681 (set_attr "length_immediate" "1,0,1")
17682 (set_attr "prefix_extra" "0,1,*")
17683 (set_attr "prefix" "maybe_evex,maybe_evex,orig")
17684 (set_attr "mode" "V4SF")])
17686 (define_insn "*vec_dupv4si"
17687 [(set (match_operand:V4SI 0 "register_operand" "=v,v,x")
17688 (vec_duplicate:V4SI
17689 (match_operand:SI 1 "nonimmediate_operand" "Yv,m,0")))]
17692 %vpshufd\t{$0, %1, %0|%0, %1, 0}
17693 vbroadcastss\t{%1, %0|%0, %1}
17694 shufps\t{$0, %0, %0|%0, %0, 0}"
17695 [(set_attr "isa" "sse2,avx,noavx")
17696 (set_attr "type" "sselog1,ssemov,sselog1")
17697 (set_attr "length_immediate" "1,0,1")
17698 (set_attr "prefix_extra" "0,1,*")
17699 (set_attr "prefix" "maybe_vex,maybe_evex,orig")
17700 (set_attr "mode" "TI,V4SF,V4SF")])
17702 (define_insn "*vec_dupv2di"
17703 [(set (match_operand:V2DI 0 "register_operand" "=x,v,v,x")
17704 (vec_duplicate:V2DI
17705 (match_operand:DI 1 "nonimmediate_operand" " 0,Yv,m,0")))]
17709 vpunpcklqdq\t{%d1, %0|%0, %d1}
17710 %vmovddup\t{%1, %0|%0, %1}
17712 [(set_attr "isa" "sse2_noavx,avx,sse3,noavx")
17713 (set_attr "type" "sselog1,sselog1,sselog1,ssemov")
17714 (set_attr "prefix" "orig,maybe_evex,maybe_vex,orig")
17715 (set_attr "mode" "TI,TI,DF,V4SF")])
17717 (define_insn "avx2_vbroadcasti128_<mode>"
17718 [(set (match_operand:VI_256 0 "register_operand" "=x,v,v")
17720 (match_operand:<ssehalfvecmode> 1 "memory_operand" "m,m,m")
17724 vbroadcasti128\t{%1, %0|%0, %1}
17725 vbroadcast<i128vldq>\t{%1, %0|%0, %1}
17726 vbroadcast<shuffletype>32x4\t{%1, %0|%0, %1}"
17727 [(set_attr "isa" "*,avx512dq,avx512vl")
17728 (set_attr "type" "ssemov")
17729 (set_attr "prefix_extra" "1")
17730 (set_attr "prefix" "vex,evex,evex")
17731 (set_attr "mode" "OI")])
17733 ;; Modes handled by AVX vec_dup patterns.
17734 (define_mode_iterator AVX_VEC_DUP_MODE
17735 [V8SI V8SF V4DI V4DF])
17736 ;; Modes handled by AVX2 vec_dup patterns.
17737 (define_mode_iterator AVX2_VEC_DUP_MODE
17738 [V32QI V16QI V16HI V8HI V8SI V4SI])
17740 (define_insn "*vec_dup<mode>"
17741 [(set (match_operand:AVX2_VEC_DUP_MODE 0 "register_operand" "=x,x,Yi")
17742 (vec_duplicate:AVX2_VEC_DUP_MODE
17743 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "m,x,$r")))]
17746 v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0|%0, %1}
17747 v<sseintprefix>broadcast<bcstscalarsuff>\t{%x1, %0|%0, %x1}
17749 [(set_attr "isa" "*,*,noavx512vl")
17750 (set_attr "type" "ssemov")
17751 (set_attr "prefix_extra" "1")
17752 (set_attr "prefix" "maybe_evex")
17753 (set_attr "mode" "<sseinsnmode>")])
17755 (define_insn "vec_dup<mode>"
17756 [(set (match_operand:AVX_VEC_DUP_MODE 0 "register_operand" "=x,x,x,v,x")
17757 (vec_duplicate:AVX_VEC_DUP_MODE
17758 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "m,m,x,v,?x")))]
17761 v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0|%0, %1}
17762 vbroadcast<ssescalarmodesuffix>\t{%1, %0|%0, %1}
17763 v<sseintprefix>broadcast<bcstscalarsuff>\t{%x1, %0|%0, %x1}
17764 v<sseintprefix>broadcast<bcstscalarsuff>\t{%x1, %g0|%g0, %x1}
17766 [(set_attr "type" "ssemov")
17767 (set_attr "prefix_extra" "1")
17768 (set_attr "prefix" "maybe_evex")
17769 (set_attr "isa" "avx2,noavx2,avx2,avx512f,noavx2")
17770 (set_attr "mode" "<sseinsnmode>,V8SF,<sseinsnmode>,<sseinsnmode>,V8SF")])
17773 [(set (match_operand:AVX2_VEC_DUP_MODE 0 "register_operand")
17774 (vec_duplicate:AVX2_VEC_DUP_MODE
17775 (match_operand:<ssescalarmode> 1 "register_operand")))]
17777 /* Disable this splitter if avx512vl_vec_dup_gprv*[qhs]i insn is
17778 available, because then we can broadcast from GPRs directly.
17779 For V*[QH]I modes it requires both -mavx512vl and -mavx512bw,
17780 for V*SI mode it requires just -mavx512vl. */
17781 && !(TARGET_AVX512VL
17782 && (TARGET_AVX512BW || <ssescalarmode>mode == SImode))
17783 && reload_completed && GENERAL_REG_P (operands[1])"
17786 emit_insn (gen_vec_setv4si_0 (gen_lowpart (V4SImode, operands[0]),
17787 CONST0_RTX (V4SImode),
17788 gen_lowpart (SImode, operands[1])));
17789 emit_insn (gen_avx2_pbroadcast<mode> (operands[0],
17790 gen_lowpart (<ssexmmmode>mode,
17796 [(set (match_operand:AVX_VEC_DUP_MODE 0 "register_operand")
17797 (vec_duplicate:AVX_VEC_DUP_MODE
17798 (match_operand:<ssescalarmode> 1 "register_operand")))]
17799 "TARGET_AVX && !TARGET_AVX2 && reload_completed"
17800 [(set (match_dup 2)
17801 (vec_duplicate:<ssehalfvecmode> (match_dup 1)))
17803 (vec_concat:AVX_VEC_DUP_MODE (match_dup 2) (match_dup 2)))]
17804 "operands[2] = gen_lowpart (<ssehalfvecmode>mode, operands[0]);")
17806 (define_insn "avx_vbroadcastf128_<mode>"
17807 [(set (match_operand:V_256 0 "register_operand" "=x,x,x,v,v,v,v")
17809 (match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "m,0,?x,m,0,m,0")
17813 vbroadcast<i128>\t{%1, %0|%0, %1}
17814 vinsert<i128>\t{$1, %1, %0, %0|%0, %0, %1, 1}
17815 vperm2<i128>\t{$0, %t1, %t1, %0|%0, %t1, %t1, 0}
17816 vbroadcast<i128vldq>\t{%1, %0|%0, %1}
17817 vinsert<i128vldq>\t{$1, %1, %0, %0|%0, %0, %1, 1}
17818 vbroadcast<shuffletype>32x4\t{%1, %0|%0, %1}
17819 vinsert<shuffletype>32x4\t{$1, %1, %0, %0|%0, %0, %1, 1}"
17820 [(set_attr "isa" "*,*,*,avx512dq,avx512dq,avx512vl,avx512vl")
17821 (set_attr "type" "ssemov,sselog1,sselog1,ssemov,sselog1,ssemov,sselog1")
17822 (set_attr "prefix_extra" "1")
17823 (set_attr "length_immediate" "0,1,1,0,1,0,1")
17824 (set_attr "prefix" "vex,vex,vex,evex,evex,evex,evex")
17825 (set_attr "mode" "<sseinsnmode>")])
17827 ;; For broadcast[i|f]32x2. Yes there is no v4sf version, only v4si.
17828 (define_mode_iterator VI4F_BRCST32x2
17829 [V16SI (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")
17830 V16SF (V8SF "TARGET_AVX512VL")])
17832 (define_mode_attr 64x2mode
17833 [(V8DF "V2DF") (V8DI "V2DI") (V4DI "V2DI") (V4DF "V2DF")])
17835 (define_mode_attr 32x2mode
17836 [(V16SF "V2SF") (V16SI "V2SI") (V8SI "V2SI")
17837 (V8SF "V2SF") (V4SI "V2SI")])
17839 (define_insn "<mask_codefor>avx512dq_broadcast<mode><mask_name>"
17840 [(set (match_operand:VI4F_BRCST32x2 0 "register_operand" "=v")
17841 (vec_duplicate:VI4F_BRCST32x2
17842 (vec_select:<32x2mode>
17843 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "vm")
17844 (parallel [(const_int 0) (const_int 1)]))))]
17846 "vbroadcast<shuffletype>32x2\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
17847 [(set_attr "type" "ssemov")
17848 (set_attr "prefix_extra" "1")
17849 (set_attr "prefix" "evex")
17850 (set_attr "mode" "<sseinsnmode>")])
17852 (define_insn "<mask_codefor>avx512vl_broadcast<mode><mask_name>_1"
17853 [(set (match_operand:VI4F_256 0 "register_operand" "=v,v")
17854 (vec_duplicate:VI4F_256
17855 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "v,m")))]
17858 vshuf<shuffletype>32x4\t{$0x0, %t1, %t1, %0<mask_operand2>|%0<mask_operand2>, %t1, %t1, 0x0}
17859 vbroadcast<shuffletype>32x4\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17860 [(set_attr "type" "ssemov")
17861 (set_attr "prefix_extra" "1")
17862 (set_attr "prefix" "evex")
17863 (set_attr "mode" "<sseinsnmode>")])
17865 (define_insn "<mask_codefor>avx512dq_broadcast<mode><mask_name>_1"
17866 [(set (match_operand:V16FI 0 "register_operand" "=v,v")
17867 (vec_duplicate:V16FI
17868 (match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "v,m")))]
17871 vshuf<shuffletype>32x4\t{$0x44, %g1, %g1, %0<mask_operand2>|%0<mask_operand2>, %g1, %g1, 0x44}
17872 vbroadcast<shuffletype>32x8\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17873 [(set_attr "type" "ssemov")
17874 (set_attr "prefix_extra" "1")
17875 (set_attr "prefix" "evex")
17876 (set_attr "mode" "<sseinsnmode>")])
17878 ;; For broadcast[i|f]64x2
17879 (define_mode_iterator VI8F_BRCST64x2
17880 [V8DI V8DF (V4DI "TARGET_AVX512VL") (V4DF "TARGET_AVX512VL")])
17882 (define_insn "<mask_codefor>avx512dq_broadcast<mode><mask_name>_1"
17883 [(set (match_operand:VI8F_BRCST64x2 0 "register_operand" "=v,v")
17884 (vec_duplicate:VI8F_BRCST64x2
17885 (match_operand:<64x2mode> 1 "nonimmediate_operand" "v,m")))]
17888 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}
17889 vbroadcast<shuffletype>64x2\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17890 [(set_attr "type" "ssemov")
17891 (set_attr "prefix_extra" "1")
17892 (set_attr "prefix" "evex")
17893 (set_attr "mode" "<sseinsnmode>")])
17895 (define_insn "avx512cd_maskb_vec_dup<mode>"
17896 [(set (match_operand:VI8_AVX512VL 0 "register_operand" "=v")
17897 (vec_duplicate:VI8_AVX512VL
17899 (match_operand:QI 1 "register_operand" "Yk"))))]
17901 "vpbroadcastmb2q\t{%1, %0|%0, %1}"
17902 [(set_attr "type" "mskmov")
17903 (set_attr "prefix" "evex")
17904 (set_attr "mode" "XI")])
17906 (define_insn "avx512cd_maskw_vec_dup<mode>"
17907 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
17908 (vec_duplicate:VI4_AVX512VL
17910 (match_operand:HI 1 "register_operand" "Yk"))))]
17912 "vpbroadcastmw2d\t{%1, %0|%0, %1}"
17913 [(set_attr "type" "mskmov")
17914 (set_attr "prefix" "evex")
17915 (set_attr "mode" "XI")])
17917 ;; Recognize broadcast as a vec_select as produced by builtin_vec_perm.
17918 ;; If it so happens that the input is in memory, use vbroadcast.
17919 ;; Otherwise use vpermilp (and in the case of 256-bit modes, vperm2f128).
17920 (define_insn "*avx_vperm_broadcast_v4sf"
17921 [(set (match_operand:V4SF 0 "register_operand" "=v,v,v")
17923 (match_operand:V4SF 1 "nonimmediate_operand" "m,o,v")
17924 (match_parallel 2 "avx_vbroadcast_operand"
17925 [(match_operand 3 "const_int_operand" "C,n,n")])))]
17928 int elt = INTVAL (operands[3]);
17929 switch (which_alternative)
17933 operands[1] = adjust_address_nv (operands[1], SFmode, elt * 4);
17934 return "vbroadcastss\t{%1, %0|%0, %k1}";
17936 operands[2] = GEN_INT (elt * 0x55);
17937 return "vpermilps\t{%2, %1, %0|%0, %1, %2}";
17939 gcc_unreachable ();
17942 [(set_attr "type" "ssemov,ssemov,sselog1")
17943 (set_attr "prefix_extra" "1")
17944 (set_attr "length_immediate" "0,0,1")
17945 (set_attr "prefix" "maybe_evex")
17946 (set_attr "mode" "SF,SF,V4SF")])
17948 (define_insn_and_split "*avx_vperm_broadcast_<mode>"
17949 [(set (match_operand:VF_256 0 "register_operand" "=v,v,v")
17951 (match_operand:VF_256 1 "nonimmediate_operand" "m,o,?v")
17952 (match_parallel 2 "avx_vbroadcast_operand"
17953 [(match_operand 3 "const_int_operand" "C,n,n")])))]
17956 "&& reload_completed && (<MODE>mode != V4DFmode || !TARGET_AVX2)"
17957 [(set (match_dup 0) (vec_duplicate:VF_256 (match_dup 1)))]
17959 rtx op0 = operands[0], op1 = operands[1];
17960 int elt = INTVAL (operands[3]);
17966 if (TARGET_AVX2 && elt == 0)
17968 emit_insn (gen_vec_dup<mode> (op0, gen_lowpart (<ssescalarmode>mode,
17973 /* Shuffle element we care about into all elements of the 128-bit lane.
17974 The other lane gets shuffled too, but we don't care. */
17975 if (<MODE>mode == V4DFmode)
17976 mask = (elt & 1 ? 15 : 0);
17978 mask = (elt & 3) * 0x55;
17979 emit_insn (gen_avx_vpermil<mode> (op0, op1, GEN_INT (mask)));
17981 /* Shuffle the lane we care about into both lanes of the dest. */
17982 mask = (elt / (<ssescalarnum> / 2)) * 0x11;
17983 if (EXT_REX_SSE_REG_P (op0))
17985 /* There is no EVEX VPERM2F128, but we can use either VBROADCASTSS
17987 gcc_assert (<MODE>mode == V8SFmode);
17988 if ((mask & 1) == 0)
17989 emit_insn (gen_avx2_vec_dupv8sf (op0,
17990 gen_lowpart (V4SFmode, op0)));
17992 emit_insn (gen_avx512vl_shuf_f32x4_1 (op0, op0, op0,
17993 GEN_INT (4), GEN_INT (5),
17994 GEN_INT (6), GEN_INT (7),
17995 GEN_INT (12), GEN_INT (13),
17996 GEN_INT (14), GEN_INT (15)));
18000 emit_insn (gen_avx_vperm2f128<mode>3 (op0, op0, op0, GEN_INT (mask)));
18004 operands[1] = adjust_address (op1, <ssescalarmode>mode,
18005 elt * GET_MODE_SIZE (<ssescalarmode>mode));
18008 (define_expand "<sse2_avx_avx512f>_vpermil<mode><mask_name>"
18009 [(set (match_operand:VF2 0 "register_operand")
18011 (match_operand:VF2 1 "nonimmediate_operand")
18012 (match_operand:SI 2 "const_0_to_255_operand")))]
18013 "TARGET_AVX && <mask_mode512bit_condition>"
18015 int mask = INTVAL (operands[2]);
18016 rtx perm[<ssescalarnum>];
18019 for (i = 0; i < <ssescalarnum>; i = i + 2)
18021 perm[i] = GEN_INT (((mask >> i) & 1) + i);
18022 perm[i + 1] = GEN_INT (((mask >> (i + 1)) & 1) + i);
18026 = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (<ssescalarnum>, perm));
18029 (define_expand "<sse2_avx_avx512f>_vpermil<mode><mask_name>"
18030 [(set (match_operand:VF1 0 "register_operand")
18032 (match_operand:VF1 1 "nonimmediate_operand")
18033 (match_operand:SI 2 "const_0_to_255_operand")))]
18034 "TARGET_AVX && <mask_mode512bit_condition>"
18036 int mask = INTVAL (operands[2]);
18037 rtx perm[<ssescalarnum>];
18040 for (i = 0; i < <ssescalarnum>; i = i + 4)
18042 perm[i] = GEN_INT (((mask >> 0) & 3) + i);
18043 perm[i + 1] = GEN_INT (((mask >> 2) & 3) + i);
18044 perm[i + 2] = GEN_INT (((mask >> 4) & 3) + i);
18045 perm[i + 3] = GEN_INT (((mask >> 6) & 3) + i);
18049 = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (<ssescalarnum>, perm));
18052 (define_insn "*<sse2_avx_avx512f>_vpermilp<mode><mask_name>"
18053 [(set (match_operand:VF 0 "register_operand" "=v")
18055 (match_operand:VF 1 "nonimmediate_operand" "vm")
18056 (match_parallel 2 ""
18057 [(match_operand 3 "const_int_operand")])))]
18058 "TARGET_AVX && <mask_mode512bit_condition>
18059 && avx_vpermilp_parallel (operands[2], <MODE>mode)"
18061 int mask = avx_vpermilp_parallel (operands[2], <MODE>mode) - 1;
18062 operands[2] = GEN_INT (mask);
18063 return "vpermil<ssemodesuffix>\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}";
18065 [(set_attr "type" "sselog")
18066 (set_attr "prefix_extra" "1")
18067 (set_attr "length_immediate" "1")
18068 (set_attr "prefix" "<mask_prefix>")
18069 (set_attr "mode" "<sseinsnmode>")])
18071 (define_insn "<sse2_avx_avx512f>_vpermilvar<mode>3<mask_name>"
18072 [(set (match_operand:VF 0 "register_operand" "=v")
18074 [(match_operand:VF 1 "register_operand" "v")
18075 (match_operand:<sseintvecmode> 2 "nonimmediate_operand" "vm")]
18077 "TARGET_AVX && <mask_mode512bit_condition>"
18078 "vpermil<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18079 [(set_attr "type" "sselog")
18080 (set_attr "prefix_extra" "1")
18081 (set_attr "btver2_decode" "vector")
18082 (set_attr "prefix" "<mask_prefix>")
18083 (set_attr "mode" "<sseinsnmode>")])
18085 (define_mode_iterator VPERMI2
18086 [V16SI V16SF V8DI V8DF
18087 (V8SI "TARGET_AVX512VL") (V8SF "TARGET_AVX512VL")
18088 (V4DI "TARGET_AVX512VL") (V4DF "TARGET_AVX512VL")
18089 (V4SI "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
18090 (V2DI "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")
18091 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX512BW && TARGET_AVX512VL")
18092 (V8HI "TARGET_AVX512BW && TARGET_AVX512VL")
18093 (V64QI "TARGET_AVX512VBMI") (V32QI "TARGET_AVX512VBMI && TARGET_AVX512VL")
18094 (V16QI "TARGET_AVX512VBMI && TARGET_AVX512VL")])
18096 (define_mode_iterator VPERMI2I
18098 (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")
18099 (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")
18100 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX512BW && TARGET_AVX512VL")
18101 (V8HI "TARGET_AVX512BW && TARGET_AVX512VL")
18102 (V64QI "TARGET_AVX512VBMI") (V32QI "TARGET_AVX512VBMI && TARGET_AVX512VL")
18103 (V16QI "TARGET_AVX512VBMI && TARGET_AVX512VL")])
18105 (define_expand "<avx512>_vpermi2var<mode>3_mask"
18106 [(set (match_operand:VPERMI2 0 "register_operand")
18109 [(match_operand:<sseintvecmode> 2 "register_operand")
18110 (match_operand:VPERMI2 1 "register_operand")
18111 (match_operand:VPERMI2 3 "nonimmediate_operand")]
18114 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
18116 "operands[5] = gen_lowpart (<MODE>mode, operands[2]);")
18118 (define_insn "*<avx512>_vpermi2var<mode>3_mask"
18119 [(set (match_operand:VPERMI2I 0 "register_operand" "=v")
18120 (vec_merge:VPERMI2I
18122 [(match_operand:<sseintvecmode> 2 "register_operand" "0")
18123 (match_operand:VPERMI2I 1 "register_operand" "v")
18124 (match_operand:VPERMI2I 3 "nonimmediate_operand" "vm")]
18127 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
18129 "vpermi2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
18130 [(set_attr "type" "sselog")
18131 (set_attr "prefix" "evex")
18132 (set_attr "mode" "<sseinsnmode>")])
18134 (define_insn "*<avx512>_vpermi2var<mode>3_mask"
18135 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
18136 (vec_merge:VF_AVX512VL
18137 (unspec:VF_AVX512VL
18138 [(match_operand:<sseintvecmode> 2 "register_operand" "0")
18139 (match_operand:VF_AVX512VL 1 "register_operand" "v")
18140 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "vm")]
18142 (subreg:VF_AVX512VL (match_dup 2) 0)
18143 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
18145 "vpermi2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
18146 [(set_attr "type" "sselog")
18147 (set_attr "prefix" "evex")
18148 (set_attr "mode" "<sseinsnmode>")])
18150 (define_expand "<avx512>_vpermt2var<mode>3_maskz"
18151 [(match_operand:VPERMI2 0 "register_operand")
18152 (match_operand:<sseintvecmode> 1 "register_operand")
18153 (match_operand:VPERMI2 2 "register_operand")
18154 (match_operand:VPERMI2 3 "nonimmediate_operand")
18155 (match_operand:<avx512fmaskmode> 4 "register_operand")]
18158 emit_insn (gen_<avx512>_vpermt2var<mode>3_maskz_1 (
18159 operands[0], operands[1], operands[2], operands[3],
18160 CONST0_RTX (<MODE>mode), operands[4]));
18164 (define_insn "<avx512>_vpermt2var<mode>3<sd_maskz_name>"
18165 [(set (match_operand:VPERMI2 0 "register_operand" "=v,v")
18167 [(match_operand:<sseintvecmode> 1 "register_operand" "v,0")
18168 (match_operand:VPERMI2 2 "register_operand" "0,v")
18169 (match_operand:VPERMI2 3 "nonimmediate_operand" "vm,vm")]
18173 vpermt2<ssemodesuffix>\t{%3, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %3}
18174 vpermi2<ssemodesuffix>\t{%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3}"
18175 [(set_attr "type" "sselog")
18176 (set_attr "prefix" "evex")
18177 (set_attr "mode" "<sseinsnmode>")])
18179 (define_insn "<avx512>_vpermt2var<mode>3_mask"
18180 [(set (match_operand:VPERMI2 0 "register_operand" "=v")
18183 [(match_operand:<sseintvecmode> 1 "register_operand" "v")
18184 (match_operand:VPERMI2 2 "register_operand" "0")
18185 (match_operand:VPERMI2 3 "nonimmediate_operand" "vm")]
18188 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
18190 "vpermt2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
18191 [(set_attr "type" "sselog")
18192 (set_attr "prefix" "evex")
18193 (set_attr "mode" "<sseinsnmode>")])
18195 (define_expand "avx_vperm2f128<mode>3"
18196 [(set (match_operand:AVX256MODE2P 0 "register_operand")
18197 (unspec:AVX256MODE2P
18198 [(match_operand:AVX256MODE2P 1 "register_operand")
18199 (match_operand:AVX256MODE2P 2 "nonimmediate_operand")
18200 (match_operand:SI 3 "const_0_to_255_operand")]
18201 UNSPEC_VPERMIL2F128))]
18204 int mask = INTVAL (operands[3]);
18205 if ((mask & 0x88) == 0)
18207 rtx perm[<ssescalarnum>], t1, t2;
18208 int i, base, nelt = <ssescalarnum>, nelt2 = nelt / 2;
18210 base = (mask & 3) * nelt2;
18211 for (i = 0; i < nelt2; ++i)
18212 perm[i] = GEN_INT (base + i);
18214 base = ((mask >> 4) & 3) * nelt2;
18215 for (i = 0; i < nelt2; ++i)
18216 perm[i + nelt2] = GEN_INT (base + i);
18218 t2 = gen_rtx_VEC_CONCAT (<ssedoublevecmode>mode,
18219 operands[1], operands[2]);
18220 t1 = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (nelt, perm));
18221 t2 = gen_rtx_VEC_SELECT (<MODE>mode, t2, t1);
18222 t2 = gen_rtx_SET (operands[0], t2);
18228 ;; Note that bits 7 and 3 of the imm8 allow lanes to be zeroed, which
18229 ;; means that in order to represent this properly in rtl we'd have to
18230 ;; nest *another* vec_concat with a zero operand and do the select from
18231 ;; a 4x wide vector. That doesn't seem very nice.
18232 (define_insn "*avx_vperm2f128<mode>_full"
18233 [(set (match_operand:AVX256MODE2P 0 "register_operand" "=x")
18234 (unspec:AVX256MODE2P
18235 [(match_operand:AVX256MODE2P 1 "register_operand" "x")
18236 (match_operand:AVX256MODE2P 2 "nonimmediate_operand" "xm")
18237 (match_operand:SI 3 "const_0_to_255_operand" "n")]
18238 UNSPEC_VPERMIL2F128))]
18240 "vperm2<i128>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
18241 [(set_attr "type" "sselog")
18242 (set_attr "prefix_extra" "1")
18243 (set_attr "length_immediate" "1")
18244 (set_attr "prefix" "vex")
18245 (set_attr "mode" "<sseinsnmode>")])
18247 (define_insn "*avx_vperm2f128<mode>_nozero"
18248 [(set (match_operand:AVX256MODE2P 0 "register_operand" "=x")
18249 (vec_select:AVX256MODE2P
18250 (vec_concat:<ssedoublevecmode>
18251 (match_operand:AVX256MODE2P 1 "register_operand" "x")
18252 (match_operand:AVX256MODE2P 2 "nonimmediate_operand" "xm"))
18253 (match_parallel 3 ""
18254 [(match_operand 4 "const_int_operand")])))]
18256 && avx_vperm2f128_parallel (operands[3], <MODE>mode)"
18258 int mask = avx_vperm2f128_parallel (operands[3], <MODE>mode) - 1;
18260 return "vinsert<i128>\t{$0, %x2, %1, %0|%0, %1, %x2, 0}";
18262 return "vinsert<i128>\t{$1, %x2, %1, %0|%0, %1, %x2, 1}";
18263 operands[3] = GEN_INT (mask);
18264 return "vperm2<i128>\t{%3, %2, %1, %0|%0, %1, %2, %3}";
18266 [(set_attr "type" "sselog")
18267 (set_attr "prefix_extra" "1")
18268 (set_attr "length_immediate" "1")
18269 (set_attr "prefix" "vex")
18270 (set_attr "mode" "<sseinsnmode>")])
18272 (define_insn "*ssse3_palignr<mode>_perm"
18273 [(set (match_operand:V_128 0 "register_operand" "=x,x,v")
18275 (match_operand:V_128 1 "register_operand" "0,x,v")
18276 (match_parallel 2 "palignr_operand"
18277 [(match_operand 3 "const_int_operand" "n,n,n")])))]
18280 operands[2] = (GEN_INT (INTVAL (operands[3])
18281 * GET_MODE_UNIT_SIZE (GET_MODE (operands[0]))));
18283 switch (which_alternative)
18286 return "palignr\t{%2, %1, %0|%0, %1, %2}";
18289 return "vpalignr\t{%2, %1, %1, %0|%0, %1, %1, %2}";
18291 gcc_unreachable ();
18294 [(set_attr "isa" "noavx,avx,avx512bw")
18295 (set_attr "type" "sseishft")
18296 (set_attr "atom_unit" "sishuf")
18297 (set_attr "prefix_data16" "1,*,*")
18298 (set_attr "prefix_extra" "1")
18299 (set_attr "length_immediate" "1")
18300 (set_attr "prefix" "orig,vex,evex")])
18302 (define_expand "avx512vl_vinsert<mode>"
18303 [(match_operand:VI48F_256 0 "register_operand")
18304 (match_operand:VI48F_256 1 "register_operand")
18305 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand")
18306 (match_operand:SI 3 "const_0_to_1_operand")
18307 (match_operand:VI48F_256 4 "register_operand")
18308 (match_operand:<avx512fmaskmode> 5 "register_operand")]
18311 rtx (*insn)(rtx, rtx, rtx, rtx, rtx);
18313 switch (INTVAL (operands[3]))
18316 insn = gen_vec_set_lo_<mode>_mask;
18319 insn = gen_vec_set_hi_<mode>_mask;
18322 gcc_unreachable ();
18325 emit_insn (insn (operands[0], operands[1], operands[2], operands[4],
18330 (define_expand "avx_vinsertf128<mode>"
18331 [(match_operand:V_256 0 "register_operand")
18332 (match_operand:V_256 1 "register_operand")
18333 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand")
18334 (match_operand:SI 3 "const_0_to_1_operand")]
18337 rtx (*insn)(rtx, rtx, rtx);
18339 switch (INTVAL (operands[3]))
18342 insn = gen_vec_set_lo_<mode>;
18345 insn = gen_vec_set_hi_<mode>;
18348 gcc_unreachable ();
18351 emit_insn (insn (operands[0], operands[1], operands[2]));
18355 (define_insn "vec_set_lo_<mode><mask_name>"
18356 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
18357 (vec_concat:VI8F_256
18358 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
18359 (vec_select:<ssehalfvecmode>
18360 (match_operand:VI8F_256 1 "register_operand" "v")
18361 (parallel [(const_int 2) (const_int 3)]))))]
18362 "TARGET_AVX && <mask_avx512dq_condition>"
18364 if (TARGET_AVX512DQ)
18365 return "vinsert<shuffletype>64x2\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}";
18366 else if (TARGET_AVX512VL)
18367 return "vinsert<shuffletype>32x4\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}";
18369 return "vinsert<i128>\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}";
18371 [(set_attr "type" "sselog")
18372 (set_attr "prefix_extra" "1")
18373 (set_attr "length_immediate" "1")
18374 (set_attr "prefix" "vex")
18375 (set_attr "mode" "<sseinsnmode>")])
18377 (define_insn "vec_set_hi_<mode><mask_name>"
18378 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
18379 (vec_concat:VI8F_256
18380 (vec_select:<ssehalfvecmode>
18381 (match_operand:VI8F_256 1 "register_operand" "v")
18382 (parallel [(const_int 0) (const_int 1)]))
18383 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
18384 "TARGET_AVX && <mask_avx512dq_condition>"
18386 if (TARGET_AVX512DQ)
18387 return "vinsert<shuffletype>64x2\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}";
18388 else if (TARGET_AVX512VL)
18389 return "vinsert<shuffletype>32x4\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}";
18391 return "vinsert<i128>\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}";
18393 [(set_attr "type" "sselog")
18394 (set_attr "prefix_extra" "1")
18395 (set_attr "length_immediate" "1")
18396 (set_attr "prefix" "vex")
18397 (set_attr "mode" "<sseinsnmode>")])
18399 (define_insn "vec_set_lo_<mode><mask_name>"
18400 [(set (match_operand:VI4F_256 0 "register_operand" "=v")
18401 (vec_concat:VI4F_256
18402 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
18403 (vec_select:<ssehalfvecmode>
18404 (match_operand:VI4F_256 1 "register_operand" "v")
18405 (parallel [(const_int 4) (const_int 5)
18406 (const_int 6) (const_int 7)]))))]
18409 if (TARGET_AVX512VL)
18410 return "vinsert<shuffletype>32x4\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}";
18412 return "vinsert<i128>\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}";
18414 [(set_attr "type" "sselog")
18415 (set_attr "prefix_extra" "1")
18416 (set_attr "length_immediate" "1")
18417 (set_attr "prefix" "vex")
18418 (set_attr "mode" "<sseinsnmode>")])
18420 (define_insn "vec_set_hi_<mode><mask_name>"
18421 [(set (match_operand:VI4F_256 0 "register_operand" "=v")
18422 (vec_concat:VI4F_256
18423 (vec_select:<ssehalfvecmode>
18424 (match_operand:VI4F_256 1 "register_operand" "v")
18425 (parallel [(const_int 0) (const_int 1)
18426 (const_int 2) (const_int 3)]))
18427 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
18430 if (TARGET_AVX512VL)
18431 return "vinsert<shuffletype>32x4\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}";
18433 return "vinsert<i128>\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}";
18435 [(set_attr "type" "sselog")
18436 (set_attr "prefix_extra" "1")
18437 (set_attr "length_immediate" "1")
18438 (set_attr "prefix" "vex")
18439 (set_attr "mode" "<sseinsnmode>")])
18441 (define_insn "vec_set_lo_v16hi"
18442 [(set (match_operand:V16HI 0 "register_operand" "=x,v")
18444 (match_operand:V8HI 2 "nonimmediate_operand" "xm,vm")
18446 (match_operand:V16HI 1 "register_operand" "x,v")
18447 (parallel [(const_int 8) (const_int 9)
18448 (const_int 10) (const_int 11)
18449 (const_int 12) (const_int 13)
18450 (const_int 14) (const_int 15)]))))]
18453 vinsert%~128\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}
18454 vinserti32x4\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}"
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_hi_v16hi"
18462 [(set (match_operand:V16HI 0 "register_operand" "=x,v")
18465 (match_operand:V16HI 1 "register_operand" "x,v")
18466 (parallel [(const_int 0) (const_int 1)
18467 (const_int 2) (const_int 3)
18468 (const_int 4) (const_int 5)
18469 (const_int 6) (const_int 7)]))
18470 (match_operand:V8HI 2 "nonimmediate_operand" "xm,vm")))]
18473 vinsert%~128\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}
18474 vinserti32x4\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}"
18475 [(set_attr "type" "sselog")
18476 (set_attr "prefix_extra" "1")
18477 (set_attr "length_immediate" "1")
18478 (set_attr "prefix" "vex,evex")
18479 (set_attr "mode" "OI")])
18481 (define_insn "vec_set_lo_v32qi"
18482 [(set (match_operand:V32QI 0 "register_operand" "=x,v")
18484 (match_operand:V16QI 2 "nonimmediate_operand" "xm,v")
18486 (match_operand:V32QI 1 "register_operand" "x,v")
18487 (parallel [(const_int 16) (const_int 17)
18488 (const_int 18) (const_int 19)
18489 (const_int 20) (const_int 21)
18490 (const_int 22) (const_int 23)
18491 (const_int 24) (const_int 25)
18492 (const_int 26) (const_int 27)
18493 (const_int 28) (const_int 29)
18494 (const_int 30) (const_int 31)]))))]
18497 vinsert%~128\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}
18498 vinserti32x4\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}"
18499 [(set_attr "type" "sselog")
18500 (set_attr "prefix_extra" "1")
18501 (set_attr "length_immediate" "1")
18502 (set_attr "prefix" "vex,evex")
18503 (set_attr "mode" "OI")])
18505 (define_insn "vec_set_hi_v32qi"
18506 [(set (match_operand:V32QI 0 "register_operand" "=x,v")
18509 (match_operand:V32QI 1 "register_operand" "x,v")
18510 (parallel [(const_int 0) (const_int 1)
18511 (const_int 2) (const_int 3)
18512 (const_int 4) (const_int 5)
18513 (const_int 6) (const_int 7)
18514 (const_int 8) (const_int 9)
18515 (const_int 10) (const_int 11)
18516 (const_int 12) (const_int 13)
18517 (const_int 14) (const_int 15)]))
18518 (match_operand:V16QI 2 "nonimmediate_operand" "xm,vm")))]
18521 vinsert%~128\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}
18522 vinserti32x4\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}"
18523 [(set_attr "type" "sselog")
18524 (set_attr "prefix_extra" "1")
18525 (set_attr "length_immediate" "1")
18526 (set_attr "prefix" "vex,evex")
18527 (set_attr "mode" "OI")])
18529 (define_insn "<avx_avx2>_maskload<ssemodesuffix><avxsizesuffix>"
18530 [(set (match_operand:V48_AVX2 0 "register_operand" "=x")
18532 [(match_operand:<sseintvecmode> 2 "register_operand" "x")
18533 (match_operand:V48_AVX2 1 "memory_operand" "m")]
18536 "v<sseintprefix>maskmov<ssemodesuffix>\t{%1, %2, %0|%0, %2, %1}"
18537 [(set_attr "type" "sselog1")
18538 (set_attr "prefix_extra" "1")
18539 (set_attr "prefix" "vex")
18540 (set_attr "btver2_decode" "vector")
18541 (set_attr "mode" "<sseinsnmode>")])
18543 (define_insn "<avx_avx2>_maskstore<ssemodesuffix><avxsizesuffix>"
18544 [(set (match_operand:V48_AVX2 0 "memory_operand" "+m")
18546 [(match_operand:<sseintvecmode> 1 "register_operand" "x")
18547 (match_operand:V48_AVX2 2 "register_operand" "x")
18551 "v<sseintprefix>maskmov<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
18552 [(set_attr "type" "sselog1")
18553 (set_attr "prefix_extra" "1")
18554 (set_attr "prefix" "vex")
18555 (set_attr "btver2_decode" "vector")
18556 (set_attr "mode" "<sseinsnmode>")])
18558 (define_expand "maskload<mode><sseintvecmodelower>"
18559 [(set (match_operand:V48_AVX2 0 "register_operand")
18561 [(match_operand:<sseintvecmode> 2 "register_operand")
18562 (match_operand:V48_AVX2 1 "memory_operand")]
18566 (define_expand "maskload<mode><avx512fmaskmodelower>"
18567 [(set (match_operand:V48_AVX512VL 0 "register_operand")
18568 (vec_merge:V48_AVX512VL
18569 (match_operand:V48_AVX512VL 1 "memory_operand")
18571 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18574 (define_expand "maskload<mode><avx512fmaskmodelower>"
18575 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
18576 (vec_merge:VI12_AVX512VL
18577 (match_operand:VI12_AVX512VL 1 "memory_operand")
18579 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18582 (define_expand "maskstore<mode><sseintvecmodelower>"
18583 [(set (match_operand:V48_AVX2 0 "memory_operand")
18585 [(match_operand:<sseintvecmode> 2 "register_operand")
18586 (match_operand:V48_AVX2 1 "register_operand")
18591 (define_expand "maskstore<mode><avx512fmaskmodelower>"
18592 [(set (match_operand:V48_AVX512VL 0 "memory_operand")
18593 (vec_merge:V48_AVX512VL
18594 (match_operand:V48_AVX512VL 1 "register_operand")
18596 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18599 (define_expand "maskstore<mode><avx512fmaskmodelower>"
18600 [(set (match_operand:VI12_AVX512VL 0 "memory_operand")
18601 (vec_merge:VI12_AVX512VL
18602 (match_operand:VI12_AVX512VL 1 "register_operand")
18604 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18607 (define_expand "cbranch<mode>4"
18608 [(set (reg:CC FLAGS_REG)
18609 (compare:CC (match_operand:VI48_AVX 1 "register_operand")
18610 (match_operand:VI48_AVX 2 "nonimmediate_operand")))
18611 (set (pc) (if_then_else
18612 (match_operator 0 "bt_comparison_operator"
18613 [(reg:CC FLAGS_REG) (const_int 0)])
18614 (label_ref (match_operand 3))
18618 ix86_expand_branch (GET_CODE (operands[0]),
18619 operands[1], operands[2], operands[3]);
18624 (define_insn_and_split "avx_<castmode><avxsizesuffix>_<castmode>"
18625 [(set (match_operand:AVX256MODE2P 0 "nonimmediate_operand" "=x,m")
18626 (unspec:AVX256MODE2P
18627 [(match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "xm,x")]
18629 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
18631 "&& reload_completed"
18632 [(set (match_dup 0) (match_dup 1))]
18634 if (REG_P (operands[0]))
18635 operands[0] = gen_lowpart (<ssehalfvecmode>mode, operands[0]);
18637 operands[1] = lowpart_subreg (<MODE>mode, operands[1],
18638 <ssehalfvecmode>mode);
18641 ;; Modes handled by vec_init expanders.
18642 (define_mode_iterator VEC_INIT_MODE
18643 [(V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI
18644 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX") V8HI
18645 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
18646 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI
18647 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
18648 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")
18649 (V4TI "TARGET_AVX512F") (V2TI "TARGET_AVX")])
18651 ;; Likewise, but for initialization from half sized vectors.
18652 ;; Thus, these are all VEC_INIT_MODE modes except V2??.
18653 (define_mode_iterator VEC_INIT_HALF_MODE
18654 [(V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI
18655 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX") V8HI
18656 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
18657 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX")
18658 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
18659 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX")
18660 (V4TI "TARGET_AVX512F")])
18662 (define_expand "vec_init<mode><ssescalarmodelower>"
18663 [(match_operand:VEC_INIT_MODE 0 "register_operand")
18667 ix86_expand_vector_init (false, operands[0], operands[1]);
18671 (define_expand "vec_init<mode><ssehalfvecmodelower>"
18672 [(match_operand:VEC_INIT_HALF_MODE 0 "register_operand")
18676 ix86_expand_vector_init (false, operands[0], operands[1]);
18680 (define_insn "<avx2_avx512>_ashrv<mode><mask_name>"
18681 [(set (match_operand:VI48_AVX512F_AVX512VL 0 "register_operand" "=v")
18682 (ashiftrt:VI48_AVX512F_AVX512VL
18683 (match_operand:VI48_AVX512F_AVX512VL 1 "register_operand" "v")
18684 (match_operand:VI48_AVX512F_AVX512VL 2 "nonimmediate_operand" "vm")))]
18685 "TARGET_AVX2 && <mask_mode512bit_condition>"
18686 "vpsrav<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18687 [(set_attr "type" "sseishft")
18688 (set_attr "prefix" "maybe_evex")
18689 (set_attr "mode" "<sseinsnmode>")])
18691 (define_insn "<avx2_avx512>_ashrv<mode><mask_name>"
18692 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
18693 (ashiftrt:VI2_AVX512VL
18694 (match_operand:VI2_AVX512VL 1 "register_operand" "v")
18695 (match_operand:VI2_AVX512VL 2 "nonimmediate_operand" "vm")))]
18697 "vpsravw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18698 [(set_attr "type" "sseishft")
18699 (set_attr "prefix" "maybe_evex")
18700 (set_attr "mode" "<sseinsnmode>")])
18702 (define_insn "<avx2_avx512>_<shift_insn>v<mode><mask_name>"
18703 [(set (match_operand:VI48_AVX512F 0 "register_operand" "=v")
18704 (any_lshift:VI48_AVX512F
18705 (match_operand:VI48_AVX512F 1 "register_operand" "v")
18706 (match_operand:VI48_AVX512F 2 "nonimmediate_operand" "vm")))]
18707 "TARGET_AVX2 && <mask_mode512bit_condition>"
18708 "vp<vshift>v<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18709 [(set_attr "type" "sseishft")
18710 (set_attr "prefix" "maybe_evex")
18711 (set_attr "mode" "<sseinsnmode>")])
18713 (define_insn "<avx2_avx512>_<shift_insn>v<mode><mask_name>"
18714 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
18715 (any_lshift:VI2_AVX512VL
18716 (match_operand:VI2_AVX512VL 1 "register_operand" "v")
18717 (match_operand:VI2_AVX512VL 2 "nonimmediate_operand" "vm")))]
18719 "vp<vshift>v<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18720 [(set_attr "type" "sseishft")
18721 (set_attr "prefix" "maybe_evex")
18722 (set_attr "mode" "<sseinsnmode>")])
18724 (define_insn "avx_vec_concat<mode>"
18725 [(set (match_operand:V_256_512 0 "register_operand" "=x,v,x,Yv")
18726 (vec_concat:V_256_512
18727 (match_operand:<ssehalfvecmode> 1 "register_operand" "x,v,x,v")
18728 (match_operand:<ssehalfvecmode> 2 "vector_move_operand" "xm,vm,C,C")))]
18731 switch (which_alternative)
18734 return "vinsert<i128>\t{$0x1, %2, %<concat_tg_mode>1, %0|%0, %<concat_tg_mode>1, %2, 0x1}";
18736 if (<MODE_SIZE> == 64)
18738 if (TARGET_AVX512DQ && GET_MODE_SIZE (<ssescalarmode>mode) == 4)
18739 return "vinsert<shuffletype>32x8\t{$0x1, %2, %<concat_tg_mode>1, %0|%0, %<concat_tg_mode>1, %2, 0x1}";
18741 return "vinsert<shuffletype>64x4\t{$0x1, %2, %<concat_tg_mode>1, %0|%0, %<concat_tg_mode>1, %2, 0x1}";
18745 if (TARGET_AVX512DQ && GET_MODE_SIZE (<ssescalarmode>mode) == 8)
18746 return "vinsert<shuffletype>64x2\t{$0x1, %2, %<concat_tg_mode>1, %0|%0, %<concat_tg_mode>1, %2, 0x1}";
18748 return "vinsert<shuffletype>32x4\t{$0x1, %2, %<concat_tg_mode>1, %0|%0, %<concat_tg_mode>1, %2, 0x1}";
18752 switch (get_attr_mode (insn))
18755 return "vmovaps\t{%1, %t0|%t0, %1}";
18757 return "vmovapd\t{%1, %t0|%t0, %1}";
18759 return "vmovaps\t{%1, %x0|%x0, %1}";
18761 return "vmovapd\t{%1, %x0|%x0, %1}";
18763 if (which_alternative == 2)
18764 return "vmovdqa\t{%1, %t0|%t0, %1}";
18765 else if (GET_MODE_SIZE (<ssescalarmode>mode) == 8)
18766 return "vmovdqa64\t{%1, %t0|%t0, %1}";
18768 return "vmovdqa32\t{%1, %t0|%t0, %1}";
18770 if (which_alternative == 2)
18771 return "vmovdqa\t{%1, %x0|%x0, %1}";
18772 else if (GET_MODE_SIZE (<ssescalarmode>mode) == 8)
18773 return "vmovdqa64\t{%1, %x0|%x0, %1}";
18775 return "vmovdqa32\t{%1, %x0|%x0, %1}";
18777 gcc_unreachable ();
18780 gcc_unreachable ();
18783 [(set_attr "type" "sselog,sselog,ssemov,ssemov")
18784 (set_attr "prefix_extra" "1,1,*,*")
18785 (set_attr "length_immediate" "1,1,*,*")
18786 (set_attr "prefix" "maybe_evex")
18787 (set_attr "mode" "<sseinsnmode>")])
18789 (define_insn "vcvtph2ps<mask_name>"
18790 [(set (match_operand:V4SF 0 "register_operand" "=v")
18792 (unspec:V8SF [(match_operand:V8HI 1 "register_operand" "v")]
18794 (parallel [(const_int 0) (const_int 1)
18795 (const_int 2) (const_int 3)])))]
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" "maybe_evex")
18800 (set_attr "mode" "V4SF")])
18802 (define_insn "*vcvtph2ps_load<mask_name>"
18803 [(set (match_operand:V4SF 0 "register_operand" "=v")
18804 (unspec:V4SF [(match_operand:V4HI 1 "memory_operand" "m")]
18805 UNSPEC_VCVTPH2PS))]
18806 "TARGET_F16C || TARGET_AVX512VL"
18807 "vcvtph2ps\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
18808 [(set_attr "type" "ssecvt")
18809 (set_attr "prefix" "vex")
18810 (set_attr "mode" "V8SF")])
18812 (define_insn "vcvtph2ps256<mask_name>"
18813 [(set (match_operand:V8SF 0 "register_operand" "=v")
18814 (unspec:V8SF [(match_operand:V8HI 1 "nonimmediate_operand" "vm")]
18815 UNSPEC_VCVTPH2PS))]
18816 "TARGET_F16C || TARGET_AVX512VL"
18817 "vcvtph2ps\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
18818 [(set_attr "type" "ssecvt")
18819 (set_attr "prefix" "vex")
18820 (set_attr "btver2_decode" "double")
18821 (set_attr "mode" "V8SF")])
18823 (define_insn "<mask_codefor>avx512f_vcvtph2ps512<mask_name><round_saeonly_name>"
18824 [(set (match_operand:V16SF 0 "register_operand" "=v")
18826 [(match_operand:V16HI 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
18827 UNSPEC_VCVTPH2PS))]
18829 "vcvtph2ps\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
18830 [(set_attr "type" "ssecvt")
18831 (set_attr "prefix" "evex")
18832 (set_attr "mode" "V16SF")])
18834 (define_expand "vcvtps2ph_mask"
18835 [(set (match_operand:V8HI 0 "register_operand")
18838 (unspec:V4HI [(match_operand:V4SF 1 "register_operand")
18839 (match_operand:SI 2 "const_0_to_255_operand")]
18842 (match_operand:V8HI 3 "vector_move_operand")
18843 (match_operand:QI 4 "register_operand")))]
18845 "operands[5] = CONST0_RTX (V4HImode);")
18847 (define_expand "vcvtps2ph"
18848 [(set (match_operand:V8HI 0 "register_operand")
18850 (unspec:V4HI [(match_operand:V4SF 1 "register_operand")
18851 (match_operand:SI 2 "const_0_to_255_operand")]
18855 "operands[3] = CONST0_RTX (V4HImode);")
18857 (define_insn "*vcvtps2ph<mask_name>"
18858 [(set (match_operand:V8HI 0 "register_operand" "=v")
18860 (unspec:V4HI [(match_operand:V4SF 1 "register_operand" "v")
18861 (match_operand:SI 2 "const_0_to_255_operand" "N")]
18863 (match_operand:V4HI 3 "const0_operand")))]
18864 "(TARGET_F16C || TARGET_AVX512VL) && <mask_avx512vl_condition>"
18865 "vcvtps2ph\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}"
18866 [(set_attr "type" "ssecvt")
18867 (set_attr "prefix" "maybe_evex")
18868 (set_attr "mode" "V4SF")])
18870 (define_insn "*vcvtps2ph_store<mask_name>"
18871 [(set (match_operand:V4HI 0 "memory_operand" "=m")
18872 (unspec:V4HI [(match_operand:V4SF 1 "register_operand" "v")
18873 (match_operand:SI 2 "const_0_to_255_operand" "N")]
18874 UNSPEC_VCVTPS2PH))]
18875 "TARGET_F16C || TARGET_AVX512VL"
18876 "vcvtps2ph\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18877 [(set_attr "type" "ssecvt")
18878 (set_attr "prefix" "maybe_evex")
18879 (set_attr "mode" "V4SF")])
18881 (define_insn "vcvtps2ph256<mask_name>"
18882 [(set (match_operand:V8HI 0 "nonimmediate_operand" "=vm")
18883 (unspec:V8HI [(match_operand:V8SF 1 "register_operand" "v")
18884 (match_operand:SI 2 "const_0_to_255_operand" "N")]
18885 UNSPEC_VCVTPS2PH))]
18886 "TARGET_F16C || TARGET_AVX512VL"
18887 "vcvtps2ph\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18888 [(set_attr "type" "ssecvt")
18889 (set_attr "prefix" "maybe_evex")
18890 (set_attr "btver2_decode" "vector")
18891 (set_attr "mode" "V8SF")])
18893 (define_insn "<mask_codefor>avx512f_vcvtps2ph512<mask_name>"
18894 [(set (match_operand:V16HI 0 "nonimmediate_operand" "=vm")
18896 [(match_operand:V16SF 1 "register_operand" "v")
18897 (match_operand:SI 2 "const_0_to_255_operand" "N")]
18898 UNSPEC_VCVTPS2PH))]
18900 "vcvtps2ph\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18901 [(set_attr "type" "ssecvt")
18902 (set_attr "prefix" "evex")
18903 (set_attr "mode" "V16SF")])
18905 ;; For gather* insn patterns
18906 (define_mode_iterator VEC_GATHER_MODE
18907 [V2DI V2DF V4DI V4DF V4SI V4SF V8SI V8SF])
18908 (define_mode_attr VEC_GATHER_IDXSI
18909 [(V2DI "V4SI") (V4DI "V4SI") (V8DI "V8SI")
18910 (V2DF "V4SI") (V4DF "V4SI") (V8DF "V8SI")
18911 (V4SI "V4SI") (V8SI "V8SI") (V16SI "V16SI")
18912 (V4SF "V4SI") (V8SF "V8SI") (V16SF "V16SI")])
18914 (define_mode_attr VEC_GATHER_IDXDI
18915 [(V2DI "V2DI") (V4DI "V4DI") (V8DI "V8DI")
18916 (V2DF "V2DI") (V4DF "V4DI") (V8DF "V8DI")
18917 (V4SI "V2DI") (V8SI "V4DI") (V16SI "V8DI")
18918 (V4SF "V2DI") (V8SF "V4DI") (V16SF "V8DI")])
18920 (define_mode_attr VEC_GATHER_SRCDI
18921 [(V2DI "V2DI") (V4DI "V4DI") (V8DI "V8DI")
18922 (V2DF "V2DF") (V4DF "V4DF") (V8DF "V8DF")
18923 (V4SI "V4SI") (V8SI "V4SI") (V16SI "V8SI")
18924 (V4SF "V4SF") (V8SF "V4SF") (V16SF "V8SF")])
18926 (define_expand "avx2_gathersi<mode>"
18927 [(parallel [(set (match_operand:VEC_GATHER_MODE 0 "register_operand")
18928 (unspec:VEC_GATHER_MODE
18929 [(match_operand:VEC_GATHER_MODE 1 "register_operand")
18930 (mem:<ssescalarmode>
18932 [(match_operand 2 "vsib_address_operand")
18933 (match_operand:<VEC_GATHER_IDXSI>
18934 3 "register_operand")
18935 (match_operand:SI 5 "const1248_operand ")]))
18936 (mem:BLK (scratch))
18937 (match_operand:VEC_GATHER_MODE 4 "register_operand")]
18939 (clobber (match_scratch:VEC_GATHER_MODE 7))])]
18943 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
18944 operands[5]), UNSPEC_VSIBADDR);
18947 (define_insn "*avx2_gathersi<mode>"
18948 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
18949 (unspec:VEC_GATHER_MODE
18950 [(match_operand:VEC_GATHER_MODE 2 "register_operand" "0")
18951 (match_operator:<ssescalarmode> 7 "vsib_mem_operator"
18953 [(match_operand:P 3 "vsib_address_operand" "Tv")
18954 (match_operand:<VEC_GATHER_IDXSI> 4 "register_operand" "x")
18955 (match_operand:SI 6 "const1248_operand" "n")]
18957 (mem:BLK (scratch))
18958 (match_operand:VEC_GATHER_MODE 5 "register_operand" "1")]
18960 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
18962 "v<sseintprefix>gatherd<ssemodesuffix>\t{%1, %7, %0|%0, %7, %1}"
18963 [(set_attr "type" "ssemov")
18964 (set_attr "prefix" "vex")
18965 (set_attr "mode" "<sseinsnmode>")])
18967 (define_insn "*avx2_gathersi<mode>_2"
18968 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
18969 (unspec:VEC_GATHER_MODE
18971 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
18973 [(match_operand:P 2 "vsib_address_operand" "Tv")
18974 (match_operand:<VEC_GATHER_IDXSI> 3 "register_operand" "x")
18975 (match_operand:SI 5 "const1248_operand" "n")]
18977 (mem:BLK (scratch))
18978 (match_operand:VEC_GATHER_MODE 4 "register_operand" "1")]
18980 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
18982 "v<sseintprefix>gatherd<ssemodesuffix>\t{%1, %6, %0|%0, %6, %1}"
18983 [(set_attr "type" "ssemov")
18984 (set_attr "prefix" "vex")
18985 (set_attr "mode" "<sseinsnmode>")])
18987 (define_expand "avx2_gatherdi<mode>"
18988 [(parallel [(set (match_operand:VEC_GATHER_MODE 0 "register_operand")
18989 (unspec:VEC_GATHER_MODE
18990 [(match_operand:<VEC_GATHER_SRCDI> 1 "register_operand")
18991 (mem:<ssescalarmode>
18993 [(match_operand 2 "vsib_address_operand")
18994 (match_operand:<VEC_GATHER_IDXDI>
18995 3 "register_operand")
18996 (match_operand:SI 5 "const1248_operand ")]))
18997 (mem:BLK (scratch))
18998 (match_operand:<VEC_GATHER_SRCDI> 4 "register_operand")]
19000 (clobber (match_scratch:VEC_GATHER_MODE 7))])]
19004 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
19005 operands[5]), UNSPEC_VSIBADDR);
19008 (define_insn "*avx2_gatherdi<mode>"
19009 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
19010 (unspec:VEC_GATHER_MODE
19011 [(match_operand:<VEC_GATHER_SRCDI> 2 "register_operand" "0")
19012 (match_operator:<ssescalarmode> 7 "vsib_mem_operator"
19014 [(match_operand:P 3 "vsib_address_operand" "Tv")
19015 (match_operand:<VEC_GATHER_IDXDI> 4 "register_operand" "x")
19016 (match_operand:SI 6 "const1248_operand" "n")]
19018 (mem:BLK (scratch))
19019 (match_operand:<VEC_GATHER_SRCDI> 5 "register_operand" "1")]
19021 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
19023 "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %7, %2|%2, %7, %5}"
19024 [(set_attr "type" "ssemov")
19025 (set_attr "prefix" "vex")
19026 (set_attr "mode" "<sseinsnmode>")])
19028 (define_insn "*avx2_gatherdi<mode>_2"
19029 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
19030 (unspec:VEC_GATHER_MODE
19032 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
19034 [(match_operand:P 2 "vsib_address_operand" "Tv")
19035 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand" "x")
19036 (match_operand:SI 5 "const1248_operand" "n")]
19038 (mem:BLK (scratch))
19039 (match_operand:<VEC_GATHER_SRCDI> 4 "register_operand" "1")]
19041 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
19044 if (<MODE>mode != <VEC_GATHER_SRCDI>mode)
19045 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%4, %6, %x0|%x0, %6, %4}";
19046 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%4, %6, %0|%0, %6, %4}";
19048 [(set_attr "type" "ssemov")
19049 (set_attr "prefix" "vex")
19050 (set_attr "mode" "<sseinsnmode>")])
19052 (define_insn "*avx2_gatherdi<mode>_3"
19053 [(set (match_operand:<VEC_GATHER_SRCDI> 0 "register_operand" "=&x")
19054 (vec_select:<VEC_GATHER_SRCDI>
19056 [(match_operand:<VEC_GATHER_SRCDI> 2 "register_operand" "0")
19057 (match_operator:<ssescalarmode> 7 "vsib_mem_operator"
19059 [(match_operand:P 3 "vsib_address_operand" "Tv")
19060 (match_operand:<VEC_GATHER_IDXDI> 4 "register_operand" "x")
19061 (match_operand:SI 6 "const1248_operand" "n")]
19063 (mem:BLK (scratch))
19064 (match_operand:<VEC_GATHER_SRCDI> 5 "register_operand" "1")]
19066 (parallel [(const_int 0) (const_int 1)
19067 (const_int 2) (const_int 3)])))
19068 (clobber (match_scratch:VI4F_256 1 "=&x"))]
19070 "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %7, %0|%0, %7, %5}"
19071 [(set_attr "type" "ssemov")
19072 (set_attr "prefix" "vex")
19073 (set_attr "mode" "<sseinsnmode>")])
19075 (define_insn "*avx2_gatherdi<mode>_4"
19076 [(set (match_operand:<VEC_GATHER_SRCDI> 0 "register_operand" "=&x")
19077 (vec_select:<VEC_GATHER_SRCDI>
19080 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
19082 [(match_operand:P 2 "vsib_address_operand" "Tv")
19083 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand" "x")
19084 (match_operand:SI 5 "const1248_operand" "n")]
19086 (mem:BLK (scratch))
19087 (match_operand:<VEC_GATHER_SRCDI> 4 "register_operand" "1")]
19089 (parallel [(const_int 0) (const_int 1)
19090 (const_int 2) (const_int 3)])))
19091 (clobber (match_scratch:VI4F_256 1 "=&x"))]
19093 "v<sseintprefix>gatherq<ssemodesuffix>\t{%4, %6, %0|%0, %6, %4}"
19094 [(set_attr "type" "ssemov")
19095 (set_attr "prefix" "vex")
19096 (set_attr "mode" "<sseinsnmode>")])
19098 ;; Memory operand override for -masm=intel of the v*gatherq* patterns.
19099 (define_mode_attr gatherq_mode
19100 [(V4SI "q") (V2DI "x") (V4SF "q") (V2DF "x")
19101 (V8SI "x") (V4DI "t") (V8SF "x") (V4DF "t")
19102 (V16SI "t") (V8DI "g") (V16SF "t") (V8DF "g")])
19104 (define_expand "<avx512>_gathersi<mode>"
19105 [(parallel [(set (match_operand:VI48F 0 "register_operand")
19107 [(match_operand:VI48F 1 "register_operand")
19108 (match_operand:<avx512fmaskmode> 4 "register_operand")
19109 (mem:<ssescalarmode>
19111 [(match_operand 2 "vsib_address_operand")
19112 (match_operand:<VEC_GATHER_IDXSI> 3 "register_operand")
19113 (match_operand:SI 5 "const1248_operand")]))]
19115 (clobber (match_scratch:<avx512fmaskmode> 7))])]
19119 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
19120 operands[5]), UNSPEC_VSIBADDR);
19123 (define_insn "*avx512f_gathersi<mode>"
19124 [(set (match_operand:VI48F 0 "register_operand" "=&v")
19126 [(match_operand:VI48F 1 "register_operand" "0")
19127 (match_operand:<avx512fmaskmode> 7 "register_operand" "2")
19128 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
19130 [(match_operand:P 4 "vsib_address_operand" "Tv")
19131 (match_operand:<VEC_GATHER_IDXSI> 3 "register_operand" "v")
19132 (match_operand:SI 5 "const1248_operand" "n")]
19133 UNSPEC_VSIBADDR)])]
19135 (clobber (match_scratch:<avx512fmaskmode> 2 "=&Yk"))]
19137 "v<sseintprefix>gatherd<ssemodesuffix>\t{%6, %0%{%2%}|%0%{%2%}, %<xtg_mode>6}"
19138 [(set_attr "type" "ssemov")
19139 (set_attr "prefix" "evex")
19140 (set_attr "mode" "<sseinsnmode>")])
19142 (define_insn "*avx512f_gathersi<mode>_2"
19143 [(set (match_operand:VI48F 0 "register_operand" "=&v")
19146 (match_operand:<avx512fmaskmode> 6 "register_operand" "1")
19147 (match_operator:<ssescalarmode> 5 "vsib_mem_operator"
19149 [(match_operand:P 3 "vsib_address_operand" "Tv")
19150 (match_operand:<VEC_GATHER_IDXSI> 2 "register_operand" "v")
19151 (match_operand:SI 4 "const1248_operand" "n")]
19152 UNSPEC_VSIBADDR)])]
19154 (clobber (match_scratch:<avx512fmaskmode> 1 "=&Yk"))]
19156 "v<sseintprefix>gatherd<ssemodesuffix>\t{%5, %0%{%1%}|%0%{%1%}, %<xtg_mode>5}"
19157 [(set_attr "type" "ssemov")
19158 (set_attr "prefix" "evex")
19159 (set_attr "mode" "<sseinsnmode>")])
19162 (define_expand "<avx512>_gatherdi<mode>"
19163 [(parallel [(set (match_operand:VI48F 0 "register_operand")
19165 [(match_operand:<VEC_GATHER_SRCDI> 1 "register_operand")
19166 (match_operand:QI 4 "register_operand")
19167 (mem:<ssescalarmode>
19169 [(match_operand 2 "vsib_address_operand")
19170 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand")
19171 (match_operand:SI 5 "const1248_operand")]))]
19173 (clobber (match_scratch:QI 7))])]
19177 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
19178 operands[5]), UNSPEC_VSIBADDR);
19181 (define_insn "*avx512f_gatherdi<mode>"
19182 [(set (match_operand:VI48F 0 "register_operand" "=&v")
19184 [(match_operand:<VEC_GATHER_SRCDI> 1 "register_operand" "0")
19185 (match_operand:QI 7 "register_operand" "2")
19186 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
19188 [(match_operand:P 4 "vsib_address_operand" "Tv")
19189 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand" "v")
19190 (match_operand:SI 5 "const1248_operand" "n")]
19191 UNSPEC_VSIBADDR)])]
19193 (clobber (match_scratch:QI 2 "=&Yk"))]
19196 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%6, %1%{%2%}|%1%{%2%}, %<gatherq_mode>6}";
19198 [(set_attr "type" "ssemov")
19199 (set_attr "prefix" "evex")
19200 (set_attr "mode" "<sseinsnmode>")])
19202 (define_insn "*avx512f_gatherdi<mode>_2"
19203 [(set (match_operand:VI48F 0 "register_operand" "=&v")
19206 (match_operand:QI 6 "register_operand" "1")
19207 (match_operator:<ssescalarmode> 5 "vsib_mem_operator"
19209 [(match_operand:P 3 "vsib_address_operand" "Tv")
19210 (match_operand:<VEC_GATHER_IDXDI> 2 "register_operand" "v")
19211 (match_operand:SI 4 "const1248_operand" "n")]
19212 UNSPEC_VSIBADDR)])]
19214 (clobber (match_scratch:QI 1 "=&Yk"))]
19217 if (<MODE>mode != <VEC_GATHER_SRCDI>mode)
19219 if (<MODE_SIZE> != 64)
19220 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %x0%{%1%}|%x0%{%1%}, %<gatherq_mode>5}";
19222 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %t0%{%1%}|%t0%{%1%}, %t5}";
19224 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %0%{%1%}|%0%{%1%}, %<gatherq_mode>5}";
19226 [(set_attr "type" "ssemov")
19227 (set_attr "prefix" "evex")
19228 (set_attr "mode" "<sseinsnmode>")])
19230 (define_expand "<avx512>_scattersi<mode>"
19231 [(parallel [(set (mem:VI48F
19233 [(match_operand 0 "vsib_address_operand")
19234 (match_operand:<VEC_GATHER_IDXSI> 2 "register_operand")
19235 (match_operand:SI 4 "const1248_operand")]))
19237 [(match_operand:<avx512fmaskmode> 1 "register_operand")
19238 (match_operand:VI48F 3 "register_operand")]
19240 (clobber (match_scratch:<avx512fmaskmode> 6))])]
19244 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[0], operands[2],
19245 operands[4]), UNSPEC_VSIBADDR);
19248 (define_insn "*avx512f_scattersi<mode>"
19249 [(set (match_operator:VI48F 5 "vsib_mem_operator"
19251 [(match_operand:P 0 "vsib_address_operand" "Tv")
19252 (match_operand:<VEC_GATHER_IDXSI> 2 "register_operand" "v")
19253 (match_operand:SI 4 "const1248_operand" "n")]
19256 [(match_operand:<avx512fmaskmode> 6 "register_operand" "1")
19257 (match_operand:VI48F 3 "register_operand" "v")]
19259 (clobber (match_scratch:<avx512fmaskmode> 1 "=&Yk"))]
19261 "v<sseintprefix>scatterd<ssemodesuffix>\t{%3, %5%{%1%}|%5%{%1%}, %3}"
19262 [(set_attr "type" "ssemov")
19263 (set_attr "prefix" "evex")
19264 (set_attr "mode" "<sseinsnmode>")])
19266 (define_expand "<avx512>_scatterdi<mode>"
19267 [(parallel [(set (mem:VI48F
19269 [(match_operand 0 "vsib_address_operand")
19270 (match_operand:<VEC_GATHER_IDXDI> 2 "register_operand")
19271 (match_operand:SI 4 "const1248_operand")]))
19273 [(match_operand:QI 1 "register_operand")
19274 (match_operand:<VEC_GATHER_SRCDI> 3 "register_operand")]
19276 (clobber (match_scratch:QI 6))])]
19280 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[0], operands[2],
19281 operands[4]), UNSPEC_VSIBADDR);
19284 (define_insn "*avx512f_scatterdi<mode>"
19285 [(set (match_operator:VI48F 5 "vsib_mem_operator"
19287 [(match_operand:P 0 "vsib_address_operand" "Tv")
19288 (match_operand:<VEC_GATHER_IDXDI> 2 "register_operand" "v")
19289 (match_operand:SI 4 "const1248_operand" "n")]
19292 [(match_operand:QI 6 "register_operand" "1")
19293 (match_operand:<VEC_GATHER_SRCDI> 3 "register_operand" "v")]
19295 (clobber (match_scratch:QI 1 "=&Yk"))]
19298 if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 8)
19299 return "v<sseintprefix>scatterq<ssemodesuffix>\t{%3, %5%{%1%}|%5%{%1%}, %3}";
19300 return "v<sseintprefix>scatterq<ssemodesuffix>\t{%3, %5%{%1%}|%t5%{%1%}, %3}";
19302 [(set_attr "type" "ssemov")
19303 (set_attr "prefix" "evex")
19304 (set_attr "mode" "<sseinsnmode>")])
19306 (define_insn "<avx512>_compress<mode>_mask"
19307 [(set (match_operand:VI48F 0 "register_operand" "=v")
19309 [(match_operand:VI48F 1 "register_operand" "v")
19310 (match_operand:VI48F 2 "vector_move_operand" "0C")
19311 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")]
19314 "v<sseintprefix>compress<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
19315 [(set_attr "type" "ssemov")
19316 (set_attr "prefix" "evex")
19317 (set_attr "mode" "<sseinsnmode>")])
19319 (define_insn "compress<mode>_mask"
19320 [(set (match_operand:VI12_AVX512VLBW 0 "register_operand" "=v")
19321 (unspec:VI12_AVX512VLBW
19322 [(match_operand:VI12_AVX512VLBW 1 "register_operand" "v")
19323 (match_operand:VI12_AVX512VLBW 2 "vector_move_operand" "0C")
19324 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")]
19326 "TARGET_AVX512VBMI2"
19327 "vpcompress<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
19328 [(set_attr "type" "ssemov")
19329 (set_attr "prefix" "evex")
19330 (set_attr "mode" "<sseinsnmode>")])
19332 (define_insn "<avx512>_compressstore<mode>_mask"
19333 [(set (match_operand:VI48F 0 "memory_operand" "=m")
19335 [(match_operand:VI48F 1 "register_operand" "x")
19337 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")]
19338 UNSPEC_COMPRESS_STORE))]
19340 "v<sseintprefix>compress<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}"
19341 [(set_attr "type" "ssemov")
19342 (set_attr "prefix" "evex")
19343 (set_attr "memory" "store")
19344 (set_attr "mode" "<sseinsnmode>")])
19346 (define_insn "compressstore<mode>_mask"
19347 [(set (match_operand:VI12_AVX512VLBW 0 "memory_operand" "=m")
19348 (unspec:VI12_AVX512VLBW
19349 [(match_operand:VI12_AVX512VLBW 1 "register_operand" "x")
19351 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")]
19352 UNSPEC_COMPRESS_STORE))]
19353 "TARGET_AVX512VBMI2"
19354 "vpcompress<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}"
19355 [(set_attr "type" "ssemov")
19356 (set_attr "prefix" "evex")
19357 (set_attr "memory" "store")
19358 (set_attr "mode" "<sseinsnmode>")])
19360 (define_expand "<avx512>_expand<mode>_maskz"
19361 [(set (match_operand:VI48F 0 "register_operand")
19363 [(match_operand:VI48F 1 "nonimmediate_operand")
19364 (match_operand:VI48F 2 "vector_move_operand")
19365 (match_operand:<avx512fmaskmode> 3 "register_operand")]
19368 "operands[2] = CONST0_RTX (<MODE>mode);")
19370 (define_insn "<avx512>_expand<mode>_mask"
19371 [(set (match_operand:VI48F 0 "register_operand" "=v,v")
19373 [(match_operand:VI48F 1 "nonimmediate_operand" "v,m")
19374 (match_operand:VI48F 2 "vector_move_operand" "0C,0C")
19375 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")]
19378 "v<sseintprefix>expand<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
19379 [(set_attr "type" "ssemov")
19380 (set_attr "prefix" "evex")
19381 (set_attr "memory" "none,load")
19382 (set_attr "mode" "<sseinsnmode>")])
19384 (define_insn "expand<mode>_mask"
19385 [(set (match_operand:VI12_AVX512VLBW 0 "register_operand" "=v,v")
19386 (unspec:VI12_AVX512VLBW
19387 [(match_operand:VI12_AVX512VLBW 1 "nonimmediate_operand" "v,m")
19388 (match_operand:VI12_AVX512VLBW 2 "vector_move_operand" "0C,0C")
19389 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")]
19391 "TARGET_AVX512VBMI2"
19392 "v<sseintprefix>expand<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
19393 [(set_attr "type" "ssemov")
19394 (set_attr "prefix" "evex")
19395 (set_attr "memory" "none,load")
19396 (set_attr "mode" "<sseinsnmode>")])
19398 (define_expand "expand<mode>_maskz"
19399 [(set (match_operand:VI12_AVX512VLBW 0 "register_operand")
19400 (unspec:VI12_AVX512VLBW
19401 [(match_operand:VI12_AVX512VLBW 1 "nonimmediate_operand")
19402 (match_operand:VI12_AVX512VLBW 2 "vector_move_operand")
19403 (match_operand:<avx512fmaskmode> 3 "register_operand")]
19405 "TARGET_AVX512VBMI2"
19406 "operands[2] = CONST0_RTX (<MODE>mode);")
19408 (define_insn "avx512dq_rangep<mode><mask_name><round_saeonly_name>"
19409 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
19410 (unspec:VF_AVX512VL
19411 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
19412 (match_operand:VF_AVX512VL 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
19413 (match_operand:SI 3 "const_0_to_15_operand")]
19415 "TARGET_AVX512DQ && <round_saeonly_mode512bit_condition>"
19416 "vrange<ssemodesuffix>\t{%3, <round_saeonly_mask_op4>%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2<round_saeonly_mask_op4>, %3}"
19417 [(set_attr "type" "sse")
19418 (set_attr "prefix" "evex")
19419 (set_attr "mode" "<MODE>")])
19421 (define_insn "avx512dq_ranges<mode><round_saeonly_name>"
19422 [(set (match_operand:VF_128 0 "register_operand" "=v")
19425 [(match_operand:VF_128 1 "register_operand" "v")
19426 (match_operand:VF_128 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
19427 (match_operand:SI 3 "const_0_to_15_operand")]
19432 "vrange<ssescalarmodesuffix>\t{%3, <round_saeonly_op4>%2, %1, %0|%0, %1, %2<round_saeonly_op4>, %3}"
19433 [(set_attr "type" "sse")
19434 (set_attr "prefix" "evex")
19435 (set_attr "mode" "<MODE>")])
19437 (define_insn "avx512dq_fpclass<mode><mask_scalar_merge_name>"
19438 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
19439 (unspec:<avx512fmaskmode>
19440 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
19441 (match_operand:QI 2 "const_0_to_255_operand" "n")]
19444 "vfpclass<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}";
19445 [(set_attr "type" "sse")
19446 (set_attr "length_immediate" "1")
19447 (set_attr "prefix" "evex")
19448 (set_attr "mode" "<MODE>")])
19450 (define_insn "avx512dq_vmfpclass<mode>"
19451 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
19452 (and:<avx512fmaskmode>
19453 (unspec:<avx512fmaskmode>
19454 [(match_operand:VF_128 1 "register_operand" "v")
19455 (match_operand:QI 2 "const_0_to_255_operand" "n")]
19459 "vfpclass<ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %2}";
19460 [(set_attr "type" "sse")
19461 (set_attr "length_immediate" "1")
19462 (set_attr "prefix" "evex")
19463 (set_attr "mode" "<MODE>")])
19465 (define_insn "<avx512>_getmant<mode><mask_name><round_saeonly_name>"
19466 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
19467 (unspec:VF_AVX512VL
19468 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "<round_saeonly_constraint>")
19469 (match_operand:SI 2 "const_0_to_15_operand")]
19472 "vgetmant<ssemodesuffix>\t{%2, <round_saeonly_mask_op3>%1, %0<mask_operand3>|%0<mask_operand3>, %1<round_saeonly_mask_op3>, %2}";
19473 [(set_attr "prefix" "evex")
19474 (set_attr "mode" "<MODE>")])
19476 (define_insn "avx512f_vgetmant<mode><mask_scalar_name><round_saeonly_scalar_name>"
19477 [(set (match_operand:VF_128 0 "register_operand" "=v")
19480 [(match_operand:VF_128 1 "register_operand" "v")
19481 (match_operand:VF_128 2 "<round_saeonly_scalar_nimm_predicate>" "<round_saeonly_scalar_constraint>")
19482 (match_operand:SI 3 "const_0_to_15_operand")]
19487 "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}";
19488 [(set_attr "prefix" "evex")
19489 (set_attr "mode" "<ssescalarmode>")])
19491 ;; The correct representation for this is absolutely enormous, and
19492 ;; surely not generally useful.
19493 (define_insn "<mask_codefor>avx512bw_dbpsadbw<mode><mask_name>"
19494 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
19495 (unspec:VI2_AVX512VL
19496 [(match_operand:<dbpsadbwmode> 1 "register_operand" "v")
19497 (match_operand:<dbpsadbwmode> 2 "nonimmediate_operand" "vm")
19498 (match_operand:SI 3 "const_0_to_255_operand")]
19501 "vdbpsadbw\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3}"
19502 [(set_attr "type" "sselog1")
19503 (set_attr "length_immediate" "1")
19504 (set_attr "prefix" "evex")
19505 (set_attr "mode" "<sseinsnmode>")])
19507 (define_insn "clz<mode>2<mask_name>"
19508 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
19510 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm")))]
19512 "vplzcnt<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
19513 [(set_attr "type" "sse")
19514 (set_attr "prefix" "evex")
19515 (set_attr "mode" "<sseinsnmode>")])
19517 (define_insn "<mask_codefor>conflict<mode><mask_name>"
19518 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
19519 (unspec:VI48_AVX512VL
19520 [(match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm")]
19523 "vpconflict<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
19524 [(set_attr "type" "sse")
19525 (set_attr "prefix" "evex")
19526 (set_attr "mode" "<sseinsnmode>")])
19528 (define_insn "sha1msg1"
19529 [(set (match_operand:V4SI 0 "register_operand" "=x")
19531 [(match_operand:V4SI 1 "register_operand" "0")
19532 (match_operand:V4SI 2 "vector_operand" "xBm")]
19535 "sha1msg1\t{%2, %0|%0, %2}"
19536 [(set_attr "type" "sselog1")
19537 (set_attr "mode" "TI")])
19539 (define_insn "sha1msg2"
19540 [(set (match_operand:V4SI 0 "register_operand" "=x")
19542 [(match_operand:V4SI 1 "register_operand" "0")
19543 (match_operand:V4SI 2 "vector_operand" "xBm")]
19546 "sha1msg2\t{%2, %0|%0, %2}"
19547 [(set_attr "type" "sselog1")
19548 (set_attr "mode" "TI")])
19550 (define_insn "sha1nexte"
19551 [(set (match_operand:V4SI 0 "register_operand" "=x")
19553 [(match_operand:V4SI 1 "register_operand" "0")
19554 (match_operand:V4SI 2 "vector_operand" "xBm")]
19555 UNSPEC_SHA1NEXTE))]
19557 "sha1nexte\t{%2, %0|%0, %2}"
19558 [(set_attr "type" "sselog1")
19559 (set_attr "mode" "TI")])
19561 (define_insn "sha1rnds4"
19562 [(set (match_operand:V4SI 0 "register_operand" "=x")
19564 [(match_operand:V4SI 1 "register_operand" "0")
19565 (match_operand:V4SI 2 "vector_operand" "xBm")
19566 (match_operand:SI 3 "const_0_to_3_operand" "n")]
19567 UNSPEC_SHA1RNDS4))]
19569 "sha1rnds4\t{%3, %2, %0|%0, %2, %3}"
19570 [(set_attr "type" "sselog1")
19571 (set_attr "length_immediate" "1")
19572 (set_attr "mode" "TI")])
19574 (define_insn "sha256msg1"
19575 [(set (match_operand:V4SI 0 "register_operand" "=x")
19577 [(match_operand:V4SI 1 "register_operand" "0")
19578 (match_operand:V4SI 2 "vector_operand" "xBm")]
19579 UNSPEC_SHA256MSG1))]
19581 "sha256msg1\t{%2, %0|%0, %2}"
19582 [(set_attr "type" "sselog1")
19583 (set_attr "mode" "TI")])
19585 (define_insn "sha256msg2"
19586 [(set (match_operand:V4SI 0 "register_operand" "=x")
19588 [(match_operand:V4SI 1 "register_operand" "0")
19589 (match_operand:V4SI 2 "vector_operand" "xBm")]
19590 UNSPEC_SHA256MSG2))]
19592 "sha256msg2\t{%2, %0|%0, %2}"
19593 [(set_attr "type" "sselog1")
19594 (set_attr "mode" "TI")])
19596 (define_insn "sha256rnds2"
19597 [(set (match_operand:V4SI 0 "register_operand" "=x")
19599 [(match_operand:V4SI 1 "register_operand" "0")
19600 (match_operand:V4SI 2 "vector_operand" "xBm")
19601 (match_operand:V4SI 3 "register_operand" "Yz")]
19602 UNSPEC_SHA256RNDS2))]
19604 "sha256rnds2\t{%3, %2, %0|%0, %2, %3}"
19605 [(set_attr "type" "sselog1")
19606 (set_attr "length_immediate" "1")
19607 (set_attr "mode" "TI")])
19609 (define_insn_and_split "avx512f_<castmode><avxsizesuffix>_<castmode>"
19610 [(set (match_operand:AVX512MODE2P 0 "nonimmediate_operand" "=x,m")
19611 (unspec:AVX512MODE2P
19612 [(match_operand:<ssequartermode> 1 "nonimmediate_operand" "xm,x")]
19614 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
19616 "&& reload_completed"
19617 [(set (match_dup 0) (match_dup 1))]
19619 if (REG_P (operands[0]))
19620 operands[0] = gen_lowpart (<ssequartermode>mode, operands[0]);
19622 operands[1] = lowpart_subreg (<MODE>mode, operands[1],
19623 <ssequartermode>mode);
19626 (define_insn_and_split "avx512f_<castmode><avxsizesuffix>_256<castmode>"
19627 [(set (match_operand:AVX512MODE2P 0 "nonimmediate_operand" "=x,m")
19628 (unspec:AVX512MODE2P
19629 [(match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "xm,x")]
19631 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
19633 "&& reload_completed"
19634 [(set (match_dup 0) (match_dup 1))]
19636 if (REG_P (operands[0]))
19637 operands[0] = gen_lowpart (<ssehalfvecmode>mode, operands[0]);
19639 operands[1] = lowpart_subreg (<MODE>mode, operands[1],
19640 <ssehalfvecmode>mode);
19643 (define_int_iterator VPMADD52
19644 [UNSPEC_VPMADD52LUQ
19645 UNSPEC_VPMADD52HUQ])
19647 (define_int_attr vpmadd52type
19648 [(UNSPEC_VPMADD52LUQ "luq") (UNSPEC_VPMADD52HUQ "huq")])
19650 (define_expand "vpamdd52huq<mode>_maskz"
19651 [(match_operand:VI8_AVX512VL 0 "register_operand")
19652 (match_operand:VI8_AVX512VL 1 "register_operand")
19653 (match_operand:VI8_AVX512VL 2 "register_operand")
19654 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand")
19655 (match_operand:<avx512fmaskmode> 4 "register_operand")]
19656 "TARGET_AVX512IFMA"
19658 emit_insn (gen_vpamdd52huq<mode>_maskz_1 (
19659 operands[0], operands[1], operands[2], operands[3],
19660 CONST0_RTX (<MODE>mode), operands[4]));
19664 (define_expand "vpamdd52luq<mode>_maskz"
19665 [(match_operand:VI8_AVX512VL 0 "register_operand")
19666 (match_operand:VI8_AVX512VL 1 "register_operand")
19667 (match_operand:VI8_AVX512VL 2 "register_operand")
19668 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand")
19669 (match_operand:<avx512fmaskmode> 4 "register_operand")]
19670 "TARGET_AVX512IFMA"
19672 emit_insn (gen_vpamdd52luq<mode>_maskz_1 (
19673 operands[0], operands[1], operands[2], operands[3],
19674 CONST0_RTX (<MODE>mode), operands[4]));
19678 (define_insn "vpamdd52<vpmadd52type><mode><sd_maskz_name>"
19679 [(set (match_operand:VI8_AVX512VL 0 "register_operand" "=v")
19680 (unspec:VI8_AVX512VL
19681 [(match_operand:VI8_AVX512VL 1 "register_operand" "0")
19682 (match_operand:VI8_AVX512VL 2 "register_operand" "v")
19683 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand" "vm")]
19685 "TARGET_AVX512IFMA"
19686 "vpmadd52<vpmadd52type>\t{%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3}"
19687 [(set_attr "type" "ssemuladd")
19688 (set_attr "prefix" "evex")
19689 (set_attr "mode" "<sseinsnmode>")])
19691 (define_insn "vpamdd52<vpmadd52type><mode>_mask"
19692 [(set (match_operand:VI8_AVX512VL 0 "register_operand" "=v")
19693 (vec_merge:VI8_AVX512VL
19694 (unspec:VI8_AVX512VL
19695 [(match_operand:VI8_AVX512VL 1 "register_operand" "0")
19696 (match_operand:VI8_AVX512VL 2 "register_operand" "v")
19697 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand" "vm")]
19700 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
19701 "TARGET_AVX512IFMA"
19702 "vpmadd52<vpmadd52type>\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3}"
19703 [(set_attr "type" "ssemuladd")
19704 (set_attr "prefix" "evex")
19705 (set_attr "mode" "<sseinsnmode>")])
19707 (define_insn "vpmultishiftqb<mode><mask_name>"
19708 [(set (match_operand:VI1_AVX512VL 0 "register_operand" "=v")
19709 (unspec:VI1_AVX512VL
19710 [(match_operand:VI1_AVX512VL 1 "register_operand" "v")
19711 (match_operand:VI1_AVX512VL 2 "nonimmediate_operand" "vm")]
19712 UNSPEC_VPMULTISHIFT))]
19713 "TARGET_AVX512VBMI"
19714 "vpmultishiftqb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
19715 [(set_attr "type" "sselog")
19716 (set_attr "prefix" "evex")
19717 (set_attr "mode" "<sseinsnmode>")])
19719 (define_mode_iterator IMOD4
19720 [(V64SF "TARGET_AVX5124FMAPS") (V64SI "TARGET_AVX5124VNNIW")])
19722 (define_mode_attr imod4_narrow
19723 [(V64SF "V16SF") (V64SI "V16SI")])
19725 (define_expand "mov<mode>"
19726 [(set (match_operand:IMOD4 0 "nonimmediate_operand")
19727 (match_operand:IMOD4 1 "vector_move_operand"))]
19730 ix86_expand_vector_move (<MODE>mode, operands);
19734 (define_insn_and_split "*mov<mode>_internal"
19735 [(set (match_operand:IMOD4 0 "nonimmediate_operand" "=v,v ,m")
19736 (match_operand:IMOD4 1 "vector_move_operand" " C,vm,v"))]
19738 && (register_operand (operands[0], <MODE>mode)
19739 || register_operand (operands[1], <MODE>mode))"
19741 "&& reload_completed"
19747 for (i = 0; i < 4; i++)
19749 op0 = simplify_subreg
19750 (<imod4_narrow>mode, operands[0], <MODE>mode, i * 64);
19751 op1 = simplify_subreg
19752 (<imod4_narrow>mode, operands[1], <MODE>mode, i * 64);
19753 emit_move_insn (op0, op1);
19758 (define_insn "avx5124fmaddps_4fmaddps"
19759 [(set (match_operand:V16SF 0 "register_operand" "=v")
19761 [(match_operand:V16SF 1 "register_operand" "0")
19762 (match_operand:V64SF 2 "register_operand" "Yh")
19763 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FMADD))]
19764 "TARGET_AVX5124FMAPS"
19765 "v4fmaddps\t{%3, %g2, %0|%0, %g2, %3}"
19766 [(set_attr ("type") ("ssemuladd"))
19767 (set_attr ("prefix") ("evex"))
19768 (set_attr ("mode") ("V16SF"))])
19770 (define_insn "avx5124fmaddps_4fmaddps_mask"
19771 [(set (match_operand:V16SF 0 "register_operand" "=v")
19774 [(match_operand:V64SF 1 "register_operand" "Yh")
19775 (match_operand:V4SF 2 "memory_operand" "m")] UNSPEC_VP4FMADD)
19776 (match_operand:V16SF 3 "register_operand" "0")
19777 (match_operand:HI 4 "register_operand" "Yk")))]
19778 "TARGET_AVX5124FMAPS"
19779 "v4fmaddps\t{%2, %g1, %0%{%4%}|%{%4%}%0, %g1, %2}"
19780 [(set_attr ("type") ("ssemuladd"))
19781 (set_attr ("prefix") ("evex"))
19782 (set_attr ("mode") ("V16SF"))])
19784 (define_insn "avx5124fmaddps_4fmaddps_maskz"
19785 [(set (match_operand:V16SF 0 "register_operand" "=v")
19788 [(match_operand:V16SF 1 "register_operand" "0")
19789 (match_operand:V64SF 2 "register_operand" "Yh")
19790 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FMADD)
19791 (match_operand:V16SF 4 "const0_operand" "C")
19792 (match_operand:HI 5 "register_operand" "Yk")))]
19793 "TARGET_AVX5124FMAPS"
19794 "v4fmaddps\t{%3, %g2, %0%{%5%}%{z%}|%{%5%}%{z%}%0, %g2, %3}"
19795 [(set_attr ("type") ("ssemuladd"))
19796 (set_attr ("prefix") ("evex"))
19797 (set_attr ("mode") ("V16SF"))])
19799 (define_insn "avx5124fmaddps_4fmaddss"
19800 [(set (match_operand:V4SF 0 "register_operand" "=v")
19802 [(match_operand:V4SF 1 "register_operand" "0")
19803 (match_operand:V64SF 2 "register_operand" "Yh")
19804 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FMADD))]
19805 "TARGET_AVX5124FMAPS"
19806 "v4fmaddss\t{%3, %x2, %0|%0, %x2, %3}"
19807 [(set_attr ("type") ("ssemuladd"))
19808 (set_attr ("prefix") ("evex"))
19809 (set_attr ("mode") ("SF"))])
19811 (define_insn "avx5124fmaddps_4fmaddss_mask"
19812 [(set (match_operand:V4SF 0 "register_operand" "=v")
19815 [(match_operand:V64SF 1 "register_operand" "Yh")
19816 (match_operand:V4SF 2 "memory_operand" "m")] UNSPEC_VP4FMADD)
19817 (match_operand:V4SF 3 "register_operand" "0")
19818 (match_operand:QI 4 "register_operand" "Yk")))]
19819 "TARGET_AVX5124FMAPS"
19820 "v4fmaddss\t{%2, %x1, %0%{%4%}|%{%4%}%0, %x1, %2}"
19821 [(set_attr ("type") ("ssemuladd"))
19822 (set_attr ("prefix") ("evex"))
19823 (set_attr ("mode") ("SF"))])
19825 (define_insn "avx5124fmaddps_4fmaddss_maskz"
19826 [(set (match_operand:V4SF 0 "register_operand" "=v")
19829 [(match_operand:V4SF 1 "register_operand" "0")
19830 (match_operand:V64SF 2 "register_operand" "Yh")
19831 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FMADD)
19832 (match_operand:V4SF 4 "const0_operand" "C")
19833 (match_operand:QI 5 "register_operand" "Yk")))]
19834 "TARGET_AVX5124FMAPS"
19835 "v4fmaddss\t{%3, %x2, %0%{%5%}%{z%}|%{%5%}%{z%}%0, %x2, %3}"
19836 [(set_attr ("type") ("ssemuladd"))
19837 (set_attr ("prefix") ("evex"))
19838 (set_attr ("mode") ("SF"))])
19840 (define_insn "avx5124fmaddps_4fnmaddps"
19841 [(set (match_operand:V16SF 0 "register_operand" "=v")
19843 [(match_operand:V16SF 1 "register_operand" "0")
19844 (match_operand:V64SF 2 "register_operand" "Yh")
19845 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FNMADD))]
19846 "TARGET_AVX5124FMAPS"
19847 "v4fnmaddps\t{%3, %g2, %0|%0, %g2, %3}"
19848 [(set_attr ("type") ("ssemuladd"))
19849 (set_attr ("prefix") ("evex"))
19850 (set_attr ("mode") ("V16SF"))])
19852 (define_insn "avx5124fmaddps_4fnmaddps_mask"
19853 [(set (match_operand:V16SF 0 "register_operand" "=v")
19856 [(match_operand:V64SF 1 "register_operand" "Yh")
19857 (match_operand:V4SF 2 "memory_operand" "m")] UNSPEC_VP4FNMADD)
19858 (match_operand:V16SF 3 "register_operand" "0")
19859 (match_operand:HI 4 "register_operand" "Yk")))]
19860 "TARGET_AVX5124FMAPS"
19861 "v4fnmaddps\t{%2, %g1, %0%{%4%}|%{%4%}%0, %g1, %2}"
19862 [(set_attr ("type") ("ssemuladd"))
19863 (set_attr ("prefix") ("evex"))
19864 (set_attr ("mode") ("V16SF"))])
19866 (define_insn "avx5124fmaddps_4fnmaddps_maskz"
19867 [(set (match_operand:V16SF 0 "register_operand" "=v")
19870 [(match_operand:V16SF 1 "register_operand" "0")
19871 (match_operand:V64SF 2 "register_operand" "Yh")
19872 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FNMADD)
19873 (match_operand:V16SF 4 "const0_operand" "C")
19874 (match_operand:HI 5 "register_operand" "Yk")))]
19875 "TARGET_AVX5124FMAPS"
19876 "v4fnmaddps\t{%3, %g2, %0%{%5%}%{z%}|%{%5%}%{z%}%0, %g2, %3}"
19877 [(set_attr ("type") ("ssemuladd"))
19878 (set_attr ("prefix") ("evex"))
19879 (set_attr ("mode") ("V16SF"))])
19881 (define_insn "avx5124fmaddps_4fnmaddss"
19882 [(set (match_operand:V4SF 0 "register_operand" "=v")
19884 [(match_operand:V4SF 1 "register_operand" "0")
19885 (match_operand:V64SF 2 "register_operand" "Yh")
19886 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FNMADD))]
19887 "TARGET_AVX5124FMAPS"
19888 "v4fnmaddss\t{%3, %x2, %0|%0, %x2, %3}"
19889 [(set_attr ("type") ("ssemuladd"))
19890 (set_attr ("prefix") ("evex"))
19891 (set_attr ("mode") ("SF"))])
19893 (define_insn "avx5124fmaddps_4fnmaddss_mask"
19894 [(set (match_operand:V4SF 0 "register_operand" "=v")
19897 [(match_operand:V64SF 1 "register_operand" "Yh")
19898 (match_operand:V4SF 2 "memory_operand" "m")] UNSPEC_VP4FNMADD)
19899 (match_operand:V4SF 3 "register_operand" "0")
19900 (match_operand:QI 4 "register_operand" "Yk")))]
19901 "TARGET_AVX5124FMAPS"
19902 "v4fnmaddss\t{%2, %x1, %0%{%4%}|%{%4%}%0, %x1, %2}"
19903 [(set_attr ("type") ("ssemuladd"))
19904 (set_attr ("prefix") ("evex"))
19905 (set_attr ("mode") ("SF"))])
19907 (define_insn "avx5124fmaddps_4fnmaddss_maskz"
19908 [(set (match_operand:V4SF 0 "register_operand" "=v")
19911 [(match_operand:V4SF 1 "register_operand" "0")
19912 (match_operand:V64SF 2 "register_operand" "Yh")
19913 (match_operand:V4SF 3 "memory_operand" "m")] UNSPEC_VP4FNMADD)
19914 (match_operand:V4SF 4 "const0_operand" "C")
19915 (match_operand:QI 5 "register_operand" "Yk")))]
19916 "TARGET_AVX5124FMAPS"
19917 "v4fnmaddss\t{%3, %x2, %0%{%5%}%{z%}|%{%5%}%{z%}%0, %x2, %3}"
19918 [(set_attr ("type") ("ssemuladd"))
19919 (set_attr ("prefix") ("evex"))
19920 (set_attr ("mode") ("SF"))])
19922 (define_insn "avx5124vnniw_vp4dpwssd"
19923 [(set (match_operand:V16SI 0 "register_operand" "=v")
19925 [(match_operand:V16SI 1 "register_operand" "0")
19926 (match_operand:V64SI 2 "register_operand" "Yh")
19927 (match_operand:V4SI 3 "memory_operand" "m")] UNSPEC_VP4DPWSSD))]
19928 "TARGET_AVX5124VNNIW"
19929 "vp4dpwssd\t{%3, %g2, %0|%0, %g2, %3}"
19930 [(set_attr ("type") ("ssemuladd"))
19931 (set_attr ("prefix") ("evex"))
19932 (set_attr ("mode") ("TI"))])
19934 (define_insn "avx5124vnniw_vp4dpwssd_mask"
19935 [(set (match_operand:V16SI 0 "register_operand" "=v")
19938 [(match_operand:V64SI 1 "register_operand" "Yh")
19939 (match_operand:V4SI 2 "memory_operand" "m")] UNSPEC_VP4DPWSSD)
19940 (match_operand:V16SI 3 "register_operand" "0")
19941 (match_operand:HI 4 "register_operand" "Yk")))]
19942 "TARGET_AVX5124VNNIW"
19943 "vp4dpwssd\t{%2, %g1, %0%{%4%}|%{%4%}%0, %g1, %2}"
19944 [(set_attr ("type") ("ssemuladd"))
19945 (set_attr ("prefix") ("evex"))
19946 (set_attr ("mode") ("TI"))])
19948 (define_insn "avx5124vnniw_vp4dpwssd_maskz"
19949 [(set (match_operand:V16SI 0 "register_operand" "=v")
19952 [(match_operand:V16SI 1 "register_operand" "0")
19953 (match_operand:V64SI 2 "register_operand" "Yh")
19954 (match_operand:V4SI 3 "memory_operand" "m")] UNSPEC_VP4DPWSSD)
19955 (match_operand:V16SI 4 "const0_operand" "C")
19956 (match_operand:HI 5 "register_operand" "Yk")))]
19957 "TARGET_AVX5124VNNIW"
19958 "vp4dpwssd\t{%3, %g2, %0%{%5%}%{z%}|%{%5%}%{z%}%0, %g2, %3}"
19959 [(set_attr ("type") ("ssemuladd"))
19960 (set_attr ("prefix") ("evex"))
19961 (set_attr ("mode") ("TI"))])
19963 (define_insn "avx5124vnniw_vp4dpwssds"
19964 [(set (match_operand:V16SI 0 "register_operand" "=v")
19966 [(match_operand:V16SI 1 "register_operand" "0")
19967 (match_operand:V64SI 2 "register_operand" "Yh")
19968 (match_operand:V4SI 3 "memory_operand" "m")] UNSPEC_VP4DPWSSDS))]
19969 "TARGET_AVX5124VNNIW"
19970 "vp4dpwssds\t{%3, %g2, %0|%0, %g2, %3}"
19971 [(set_attr ("type") ("ssemuladd"))
19972 (set_attr ("prefix") ("evex"))
19973 (set_attr ("mode") ("TI"))])
19975 (define_insn "avx5124vnniw_vp4dpwssds_mask"
19976 [(set (match_operand:V16SI 0 "register_operand" "=v")
19979 [(match_operand:V64SI 1 "register_operand" "Yh")
19980 (match_operand:V4SI 2 "memory_operand" "m")] UNSPEC_VP4DPWSSDS)
19981 (match_operand:V16SI 3 "register_operand" "0")
19982 (match_operand:HI 4 "register_operand" "Yk")))]
19983 "TARGET_AVX5124VNNIW"
19984 "vp4dpwssds\t{%2, %g1, %0%{%4%}|%{%4%}%0, %g1, %2}"
19985 [(set_attr ("type") ("ssemuladd"))
19986 (set_attr ("prefix") ("evex"))
19987 (set_attr ("mode") ("TI"))])
19989 (define_insn "avx5124vnniw_vp4dpwssds_maskz"
19990 [(set (match_operand:V16SI 0 "register_operand" "=v")
19993 [(match_operand:V16SI 1 "register_operand" "0")
19994 (match_operand:V64SI 2 "register_operand" "Yh")
19995 (match_operand:V4SI 3 "memory_operand" "m")] UNSPEC_VP4DPWSSDS)
19996 (match_operand:V16SI 4 "const0_operand" "C")
19997 (match_operand:HI 5 "register_operand" "Yk")))]
19998 "TARGET_AVX5124VNNIW"
19999 "vp4dpwssds\t{%3, %g2, %0%{%5%}%{z%}|%{%5%}%{z%}%0, %g2, %3}"
20000 [(set_attr ("type") ("ssemuladd"))
20001 (set_attr ("prefix") ("evex"))
20002 (set_attr ("mode") ("TI"))])
20004 (define_insn "vpopcount<mode><mask_name>"
20005 [(set (match_operand:VI48_512 0 "register_operand" "=v")
20007 (match_operand:VI48_512 1 "nonimmediate_operand" "vm")))]
20008 "TARGET_AVX512VPOPCNTDQ"
20009 "vpopcnt<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}")
20011 ;; Save multiple registers out-of-line.
20012 (define_insn "save_multiple<mode>"
20013 [(match_parallel 0 "save_multiple"
20014 [(use (match_operand:P 1 "symbol_operand"))])]
20015 "TARGET_SSE && TARGET_64BIT"
20018 ;; Restore multiple registers out-of-line.
20019 (define_insn "restore_multiple<mode>"
20020 [(match_parallel 0 "restore_multiple"
20021 [(use (match_operand:P 1 "symbol_operand"))])]
20022 "TARGET_SSE && TARGET_64BIT"
20025 ;; Restore multiple registers out-of-line and return.
20026 (define_insn "restore_multiple_and_return<mode>"
20027 [(match_parallel 0 "restore_multiple"
20029 (use (match_operand:P 1 "symbol_operand"))
20030 (set (reg:DI SP_REG) (reg:DI R10_REG))
20032 "TARGET_SSE && TARGET_64BIT"
20035 ;; Restore multiple registers out-of-line when hard frame pointer is used,
20036 ;; perform the leave operation prior to returning (from the function).
20037 (define_insn "restore_multiple_leave_return<mode>"
20038 [(match_parallel 0 "restore_multiple"
20040 (use (match_operand:P 1 "symbol_operand"))
20041 (set (reg:DI SP_REG) (plus:DI (reg:DI BP_REG) (const_int 8)))
20042 (set (reg:DI BP_REG) (mem:DI (reg:DI BP_REG)))
20043 (clobber (mem:BLK (scratch)))
20045 "TARGET_SSE && TARGET_64BIT"
20048 (define_insn "vgf2p8affineinvqb_<mode><mask_name>"
20049 [(set (match_operand:VI1_AVX512F 0 "register_operand" "=x,x,v")
20050 (unspec:VI1_AVX512F [(match_operand:VI1_AVX512F 1 "register_operand" "%0,x,v")
20051 (match_operand:VI1_AVX512F 2 "nonimmediate_operand" "xBm,xm,vm")
20052 (match_operand:QI 3 "const_0_to_255_operand" "n,n,n")]
20053 UNSPEC_GF2P8AFFINEINV))]
20056 gf2p8affineinvqb\t{%3, %2, %0| %0, %2, %3}
20057 vgf2p8affineinvqb\t{%3, %2, %1, %0<mask_operand4>| %0<mask_operand4>, %1, %2, %3}
20058 vgf2p8affineinvqb\t{%3, %2, %1, %0<mask_operand4>| %0<mask_operand4>, %1, %2, %3}"
20059 [(set_attr "isa" "noavx,avx,avx512bw")
20060 (set_attr "prefix_data16" "1,*,*")
20061 (set_attr "prefix_extra" "1")
20062 (set_attr "prefix" "orig,maybe_evex,evex")
20063 (set_attr "mode" "<sseinsnmode>")])
20065 (define_insn "vgf2p8affineqb_<mode><mask_name>"
20066 [(set (match_operand:VI1_AVX512F 0 "register_operand" "=x,x,v")
20067 (unspec:VI1_AVX512F [(match_operand:VI1_AVX512F 1 "register_operand" "%0,x,v")
20068 (match_operand:VI1_AVX512F 2 "nonimmediate_operand" "xBm,xm,vm")
20069 (match_operand:QI 3 "const_0_to_255_operand" "n,n,n")]
20070 UNSPEC_GF2P8AFFINE))]
20073 gf2p8affineqb\t{%3, %2, %0| %0, %2, %3}
20074 vgf2p8affineqb\t{%3, %2, %1, %0<mask_operand4>| %0<mask_operand4>, %1, %2, %3}
20075 vgf2p8affineqb\t{%3, %2, %1, %0<mask_operand4>| %0<mask_operand4>, %1, %2, %3}"
20076 [(set_attr "isa" "noavx,avx,avx512bw")
20077 (set_attr "prefix_data16" "1,*,*")
20078 (set_attr "prefix_extra" "1")
20079 (set_attr "prefix" "orig,maybe_evex,evex")
20080 (set_attr "mode" "<sseinsnmode>")])
20082 (define_insn "vgf2p8mulb_<mode><mask_name>"
20083 [(set (match_operand:VI1_AVX512F 0 "register_operand" "=x,x,v")
20084 (unspec:VI1_AVX512F [(match_operand:VI1_AVX512F 1 "register_operand" "%0,x,v")
20085 (match_operand:VI1_AVX512F 2 "nonimmediate_operand" "xBm,xm,vm")]
20089 gf2p8mulb\t{%2, %0| %0, %2}
20090 vgf2p8mulb\t{%2, %1, %0<mask_operand3>| %0<mask_operand3>, %1, %2}
20091 vgf2p8mulb\t{%2, %1, %0<mask_operand3>| %0<mask_operand3>, %1, %2}"
20092 [(set_attr "isa" "noavx,avx,avx512bw")
20093 (set_attr "prefix_data16" "1,*,*")
20094 (set_attr "prefix_extra" "1")
20095 (set_attr "prefix" "orig,maybe_evex,evex")
20096 (set_attr "mode" "<sseinsnmode>")])
20098 (define_insn "vpshrd_<mode><mask_name>"
20099 [(set (match_operand:VI248_VLBW 0 "register_operand" "=v")
20101 [(match_operand:VI248_VLBW 1 "register_operand" "v")
20102 (match_operand:VI248_VLBW 2 "nonimmediate_operand" "vm")
20103 (match_operand:SI 3 "const_0_to_255_operand" "n")
20105 "TARGET_AVX512VBMI2"
20106 "vpshrd<ssemodesuffix>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3 }"
20107 [(set_attr ("prefix") ("evex"))])
20109 (define_insn "vpshld_<mode><mask_name>"
20110 [(set (match_operand:VI248_VLBW 0 "register_operand" "=v")
20112 [(match_operand:VI248_VLBW 1 "register_operand" "v")
20113 (match_operand:VI248_VLBW 2 "nonimmediate_operand" "vm")
20114 (match_operand:SI 3 "const_0_to_255_operand" "n")
20116 "TARGET_AVX512VBMI2"
20117 "vpshld<ssemodesuffix>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3 }"
20118 [(set_attr ("prefix") ("evex"))])
20120 (define_insn "vpshrdv_<mode>"
20121 [(set (match_operand:VI248_VLBW 0 "register_operand" "=v")
20123 [(match_operand:VI248_VLBW 1 "register_operand" "0")
20124 (match_operand:VI248_VLBW 2 "register_operand" "v")
20125 (match_operand:VI248_VLBW 3 "nonimmediate_operand" "vm")
20126 ] UNSPEC_VPSHRDV))]
20127 "TARGET_AVX512VBMI2"
20128 "vpshrdv<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3 }"
20129 [(set_attr ("prefix") ("evex"))
20130 (set_attr "mode" "<sseinsnmode>")])
20132 (define_insn "vpshrdv_<mode>_mask"
20133 [(set (match_operand:VI248_VLBW 0 "register_operand" "=v")
20134 (vec_merge:VI248_VLBW (unspec:VI248_VLBW
20135 [(match_operand:VI248_VLBW 1 "register_operand" "0")
20136 (match_operand:VI248_VLBW 2 "register_operand" "v")
20137 (match_operand:VI248_VLBW 3 "nonimmediate_operand" "vm")
20140 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk"))
20142 "TARGET_AVX512VBMI2"
20143 "vpshrdv<ssemodesuffix>\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
20144 [(set_attr ("prefix") ("evex"))
20145 (set_attr "mode" "<sseinsnmode>")])
20147 (define_expand "vpshrdv_<mode>_maskz"
20148 [(match_operand:VI248_VLBW 0 "register_operand")
20149 (match_operand:VI248_VLBW 1 "register_operand")
20150 (match_operand:VI248_VLBW 2 "register_operand")
20151 (match_operand:VI248_VLBW 3 "nonimmediate_operand")
20152 (match_operand:<avx512fmaskmode> 4 "register_operand")]
20153 "TARGET_AVX512VBMI2"
20155 emit_insn (gen_vpshrdv_<mode>_maskz_1 (
20156 operands[0], operands[1], operands[2], operands[3],
20157 CONST0_RTX (<MODE>mode), operands[4]));
20161 (define_insn "vpshrdv_<mode>_maskz_1"
20162 [(set (match_operand:VI248_VLBW 0 "register_operand" "=v")
20163 (vec_merge:VI248_VLBW (unspec:VI248_VLBW
20164 [(match_operand:VI248_VLBW 1 "register_operand" "0")
20165 (match_operand:VI248_VLBW 2 "register_operand" "v")
20166 (match_operand:VI248_VLBW 3 "nonimmediate_operand" "vm")
20168 (match_operand:VI248_VLBW 4 "const0_operand" "C")
20169 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk"))
20171 "TARGET_AVX512VBMI2"
20172 "vpshrdv<ssemodesuffix>\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
20173 [(set_attr ("prefix") ("evex"))
20174 (set_attr "mode" "<sseinsnmode>")])
20176 (define_insn "vpshldv_<mode>"
20177 [(set (match_operand:VI248_VLBW 0 "register_operand" "=v")
20179 [(match_operand:VI248_VLBW 1 "register_operand" "0")
20180 (match_operand:VI248_VLBW 2 "register_operand" "v")
20181 (match_operand:VI248_VLBW 3 "nonimmediate_operand" "vm")
20182 ] UNSPEC_VPSHLDV))]
20183 "TARGET_AVX512VBMI2"
20184 "vpshldv<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3 }"
20185 [(set_attr ("prefix") ("evex"))
20186 (set_attr "mode" "<sseinsnmode>")])
20188 (define_insn "vpshldv_<mode>_mask"
20189 [(set (match_operand:VI248_VLBW 0 "register_operand" "=v")
20190 (vec_merge:VI248_VLBW (unspec:VI248_VLBW
20191 [(match_operand:VI248_VLBW 1 "register_operand" "0")
20192 (match_operand:VI248_VLBW 2 "register_operand" "v")
20193 (match_operand:VI248_VLBW 3 "nonimmediate_operand" "vm")
20196 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk"))
20198 "TARGET_AVX512VBMI2"
20199 "vpshldv<ssemodesuffix>\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3 }"
20200 [(set_attr ("prefix") ("evex"))
20201 (set_attr "mode" "<sseinsnmode>")])
20203 (define_expand "vpshldv_<mode>_maskz"
20204 [(match_operand:VI248_VLBW 0 "register_operand")
20205 (match_operand:VI248_VLBW 1 "register_operand")
20206 (match_operand:VI248_VLBW 2 "register_operand")
20207 (match_operand:VI248_VLBW 3 "nonimmediate_operand")
20208 (match_operand:<avx512fmaskmode> 4 "register_operand")]
20209 "TARGET_AVX512VBMI2"
20211 emit_insn (gen_vpshldv_<mode>_maskz_1 (
20212 operands[0], operands[1], operands[2], operands[3],
20213 CONST0_RTX (<MODE>mode), operands[4]));
20217 (define_insn "vpshldv_<mode>_maskz_1"
20218 [(set (match_operand:VI248_VLBW 0 "register_operand" "=v")
20219 (vec_merge:VI248_VLBW (unspec:VI248_VLBW
20220 [(match_operand:VI248_VLBW 1 "register_operand" "0")
20221 (match_operand:VI248_VLBW 2 "register_operand" "v")
20222 (match_operand:VI248_VLBW 3 "nonimmediate_operand" "vm")
20224 (match_operand:VI248_VLBW 4 "const0_operand" "C")
20225 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk"))
20227 "TARGET_AVX512VBMI2"
20228 "vpshldv<ssemodesuffix>\t{%3, %2, %0%{%5%}%{z%}|%0%{%5%}%{z%}, %2, %3 }"
20229 [(set_attr ("prefix") ("evex"))
20230 (set_attr "mode" "<sseinsnmode>")])