1 ;; GCC machine description for SSE instructions
2 ;; Copyright (C) 2005-2016 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
89 UNSPEC_UNSIGNED_FIX_NOTRUNC
104 UNSPEC_COMPRESS_STORE
109 ;; For embed. rounding feature
110 UNSPEC_EMBEDDED_ROUNDING
112 ;; For AVX512PF support
113 UNSPEC_GATHER_PREFETCH
114 UNSPEC_SCATTER_PREFETCH
116 ;; For AVX512ER support
130 ;; For AVX512BW support
138 ;; For AVX512DQ support
143 ;; For AVX512IFMA support
147 ;; For AVX512VBMI support
151 (define_c_enum "unspecv" [
161 ;; All vector modes including V?TImode, used in move patterns.
162 (define_mode_iterator VMOVE
163 [(V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI
164 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX") V8HI
165 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
166 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI
167 (V4TI "TARGET_AVX512BW") (V2TI "TARGET_AVX") V1TI
168 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
169 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") V2DF])
171 ;; All AVX-512{F,VL} vector modes. Supposed TARGET_AVX512F baseline.
172 (define_mode_iterator V48_AVX512VL
173 [V16SI (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")
174 V8DI (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")
175 V16SF (V8SF "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
176 V8DF (V4DF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
178 ;; 1,2 byte AVX-512{BW,VL} vector modes. Supposed TARGET_AVX512BW baseline.
179 (define_mode_iterator VI12_AVX512VL
180 [V64QI (V16QI "TARGET_AVX512VL") (V32QI "TARGET_AVX512VL")
181 V32HI (V16HI "TARGET_AVX512VL") (V8HI "TARGET_AVX512VL")])
183 (define_mode_iterator VI1_AVX512VL
184 [V64QI (V16QI "TARGET_AVX512VL") (V32QI "TARGET_AVX512VL")])
187 (define_mode_iterator V
188 [(V32QI "TARGET_AVX") V16QI
189 (V16HI "TARGET_AVX") V8HI
190 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
191 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI
192 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
193 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
195 ;; All 128bit vector modes
196 (define_mode_iterator V_128
197 [V16QI V8HI V4SI V2DI V4SF (V2DF "TARGET_SSE2")])
199 ;; All 256bit vector modes
200 (define_mode_iterator V_256
201 [V32QI V16HI V8SI V4DI V8SF V4DF])
203 ;; All 512bit vector modes
204 (define_mode_iterator V_512 [V64QI V32HI V16SI V8DI V16SF V8DF])
206 ;; All 256bit and 512bit vector modes
207 (define_mode_iterator V_256_512
208 [V32QI V16HI V8SI V4DI V8SF V4DF
209 (V64QI "TARGET_AVX512F") (V32HI "TARGET_AVX512F") (V16SI "TARGET_AVX512F")
210 (V8DI "TARGET_AVX512F") (V16SF "TARGET_AVX512F") (V8DF "TARGET_AVX512F")])
212 ;; All vector float modes
213 (define_mode_iterator VF
214 [(V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
215 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
217 ;; 128- and 256-bit float vector modes
218 (define_mode_iterator VF_128_256
219 [(V8SF "TARGET_AVX") V4SF
220 (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
222 ;; All SFmode vector float modes
223 (define_mode_iterator VF1
224 [(V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF])
226 ;; 128- and 256-bit SF vector modes
227 (define_mode_iterator VF1_128_256
228 [(V8SF "TARGET_AVX") V4SF])
230 (define_mode_iterator VF1_128_256VL
231 [V8SF (V4SF "TARGET_AVX512VL")])
233 ;; All DFmode vector float modes
234 (define_mode_iterator VF2
235 [(V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") V2DF])
237 ;; 128- and 256-bit DF vector modes
238 (define_mode_iterator VF2_128_256
239 [(V4DF "TARGET_AVX") V2DF])
241 (define_mode_iterator VF2_512_256
242 [(V8DF "TARGET_AVX512F") V4DF])
244 (define_mode_iterator VF2_512_256VL
245 [V8DF (V4DF "TARGET_AVX512VL")])
247 ;; All 128bit vector float modes
248 (define_mode_iterator VF_128
249 [V4SF (V2DF "TARGET_SSE2")])
251 ;; All 256bit vector float modes
252 (define_mode_iterator VF_256
255 ;; All 512bit vector float modes
256 (define_mode_iterator VF_512
259 (define_mode_iterator VI48_AVX512VL
260 [V16SI (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")
261 V8DI (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")])
263 (define_mode_iterator VF_AVX512VL
264 [V16SF (V8SF "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
265 V8DF (V4DF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
267 (define_mode_iterator VF2_AVX512VL
268 [V8DF (V4DF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
270 (define_mode_iterator VF1_AVX512VL
271 [V16SF (V8SF "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")])
273 ;; All vector integer modes
274 (define_mode_iterator VI
275 [(V16SI "TARGET_AVX512F") (V8DI "TARGET_AVX512F")
276 (V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX") V16QI
277 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX") V8HI
278 (V8SI "TARGET_AVX") V4SI
279 (V4DI "TARGET_AVX") V2DI])
281 (define_mode_iterator VI_AVX2
282 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI
283 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI
284 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX2") V4SI
285 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX2") V2DI])
287 ;; All QImode vector integer modes
288 (define_mode_iterator VI1
289 [(V32QI "TARGET_AVX") V16QI])
291 ;; All DImode vector integer modes
292 (define_mode_iterator V_AVX
293 [V16QI V8HI V4SI V2DI V4SF V2DF
294 (V32QI "TARGET_AVX") (V16HI "TARGET_AVX")
295 (V8SI "TARGET_AVX") (V4DI "TARGET_AVX")
296 (V8SF "TARGET_AVX") (V4DF"TARGET_AVX")])
298 (define_mode_iterator VI48_AVX
300 (V8SI "TARGET_AVX") (V4DI "TARGET_AVX")])
302 (define_mode_iterator VI8
303 [(V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI])
305 (define_mode_iterator VI8_AVX512VL
306 [V8DI (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")])
308 (define_mode_iterator VI8_256_512
309 [V8DI (V4DI "TARGET_AVX512VL")])
311 (define_mode_iterator VI1_AVX2
312 [(V32QI "TARGET_AVX2") V16QI])
314 (define_mode_iterator VI1_AVX512
315 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI])
317 (define_mode_iterator VI2_AVX2
318 [(V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI])
320 (define_mode_iterator VI2_AVX512F
321 [(V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX2") V8HI])
323 (define_mode_iterator VI4_AVX
324 [(V8SI "TARGET_AVX") V4SI])
326 (define_mode_iterator VI4_AVX2
327 [(V8SI "TARGET_AVX2") V4SI])
329 (define_mode_iterator VI4_AVX512F
330 [(V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX2") V4SI])
332 (define_mode_iterator VI4_AVX512VL
333 [V16SI (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")])
335 (define_mode_iterator VI48_AVX512F_AVX512VL
336 [V4SI V8SI (V16SI "TARGET_AVX512F")
337 (V2DI "TARGET_AVX512VL") (V4DI "TARGET_AVX512VL") (V8DI "TARGET_AVX512F")])
339 (define_mode_iterator VI2_AVX512VL
340 [(V8HI "TARGET_AVX512VL") (V16HI "TARGET_AVX512VL") V32HI])
342 (define_mode_iterator VI8_AVX2_AVX512BW
343 [(V8DI "TARGET_AVX512BW") (V4DI "TARGET_AVX2") V2DI])
345 (define_mode_iterator VI8_AVX2
346 [(V4DI "TARGET_AVX2") V2DI])
348 (define_mode_iterator VI8_AVX2_AVX512F
349 [(V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX2") V2DI])
351 (define_mode_iterator VI4_128_8_256
355 (define_mode_iterator V8FI
359 (define_mode_iterator V16FI
362 ;; ??? We should probably use TImode instead.
363 (define_mode_iterator VIMAX_AVX2
364 [(V4TI "TARGET_AVX512BW") (V2TI "TARGET_AVX2") V1TI])
366 ;; ??? This should probably be dropped in favor of VIMAX_AVX2.
367 (define_mode_iterator SSESCALARMODE
368 [(V4TI "TARGET_AVX512BW") (V2TI "TARGET_AVX2") TI])
370 (define_mode_iterator VI12_AVX2
371 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI
372 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI])
374 (define_mode_iterator VI24_AVX2
375 [(V16HI "TARGET_AVX2") V8HI
376 (V8SI "TARGET_AVX2") V4SI])
378 (define_mode_iterator VI124_AVX2_24_AVX512F_1_AVX512BW
379 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI
380 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX2") V8HI
381 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX2") V4SI])
383 (define_mode_iterator VI124_AVX2
384 [(V32QI "TARGET_AVX2") V16QI
385 (V16HI "TARGET_AVX2") V8HI
386 (V8SI "TARGET_AVX2") V4SI])
388 (define_mode_iterator VI2_AVX2_AVX512BW
389 [(V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI])
391 (define_mode_iterator VI48_AVX2
392 [(V8SI "TARGET_AVX2") V4SI
393 (V4DI "TARGET_AVX2") V2DI])
395 (define_mode_iterator VI248_AVX2_8_AVX512F_24_AVX512BW
396 [(V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI
397 (V16SI "TARGET_AVX512BW") (V8SI "TARGET_AVX2") V4SI
398 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX2") V2DI])
400 (define_mode_iterator VI248_AVX512BW_AVX512VL
401 [(V32HI "TARGET_AVX512BW")
402 (V4DI "TARGET_AVX512VL") V16SI V8DI])
404 ;; Suppose TARGET_AVX512VL as baseline
405 (define_mode_iterator VI24_AVX512BW_1
406 [(V16HI "TARGET_AVX512BW") (V8HI "TARGET_AVX512BW")
409 (define_mode_iterator VI48_AVX512F
410 [(V16SI "TARGET_AVX512F") V8SI V4SI
411 (V8DI "TARGET_AVX512F") V4DI V2DI])
413 (define_mode_iterator VI48_AVX_AVX512F
414 [(V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
415 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI])
417 (define_mode_iterator VI12_AVX_AVX512F
418 [ (V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI
419 (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX") V8HI])
421 (define_mode_iterator V48_AVX2
424 (V4SI "TARGET_AVX2") (V2DI "TARGET_AVX2")
425 (V8SI "TARGET_AVX2") (V4DI "TARGET_AVX2")])
427 (define_mode_attr avx512
428 [(V16QI "avx512vl") (V32QI "avx512vl") (V64QI "avx512bw")
429 (V8HI "avx512vl") (V16HI "avx512vl") (V32HI "avx512bw")
430 (V4SI "avx512vl") (V8SI "avx512vl") (V16SI "avx512f")
431 (V2DI "avx512vl") (V4DI "avx512vl") (V8DI "avx512f")
432 (V4SF "avx512vl") (V8SF "avx512vl") (V16SF "avx512f")
433 (V2DF "avx512vl") (V4DF "avx512vl") (V8DF "avx512f")])
435 (define_mode_attr sse2_avx_avx512f
436 [(V16QI "sse2") (V32QI "avx") (V64QI "avx512f")
437 (V8HI "avx512vl") (V16HI "avx512vl") (V32HI "avx512bw")
438 (V4SI "sse2") (V8SI "avx") (V16SI "avx512f")
439 (V2DI "avx512vl") (V4DI "avx512vl") (V8DI "avx512f")
440 (V16SF "avx512f") (V8SF "avx") (V4SF "avx")
441 (V8DF "avx512f") (V4DF "avx") (V2DF "avx")])
443 (define_mode_attr sse2_avx2
444 [(V16QI "sse2") (V32QI "avx2") (V64QI "avx512bw")
445 (V8HI "sse2") (V16HI "avx2") (V32HI "avx512bw")
446 (V4SI "sse2") (V8SI "avx2") (V16SI "avx512f")
447 (V2DI "sse2") (V4DI "avx2") (V8DI "avx512f")
448 (V1TI "sse2") (V2TI "avx2") (V4TI "avx512bw")])
450 (define_mode_attr ssse3_avx2
451 [(V16QI "ssse3") (V32QI "avx2") (V64QI "avx512bw")
452 (V4HI "ssse3") (V8HI "ssse3") (V16HI "avx2") (V32HI "avx512bw")
453 (V4SI "ssse3") (V8SI "avx2")
454 (V2DI "ssse3") (V4DI "avx2")
455 (TI "ssse3") (V2TI "avx2") (V4TI "avx512bw")])
457 (define_mode_attr sse4_1_avx2
458 [(V16QI "sse4_1") (V32QI "avx2") (V64QI "avx512bw")
459 (V8HI "sse4_1") (V16HI "avx2") (V32HI "avx512bw")
460 (V4SI "sse4_1") (V8SI "avx2") (V16SI "avx512f")
461 (V2DI "sse4_1") (V4DI "avx2") (V8DI "avx512dq")])
463 (define_mode_attr avx_avx2
464 [(V4SF "avx") (V2DF "avx")
465 (V8SF "avx") (V4DF "avx")
466 (V4SI "avx2") (V2DI "avx2")
467 (V8SI "avx2") (V4DI "avx2")])
469 (define_mode_attr vec_avx2
470 [(V16QI "vec") (V32QI "avx2")
471 (V8HI "vec") (V16HI "avx2")
472 (V4SI "vec") (V8SI "avx2")
473 (V2DI "vec") (V4DI "avx2")])
475 (define_mode_attr avx2_avx512
476 [(V4SI "avx2") (V8SI "avx2") (V16SI "avx512f")
477 (V2DI "avx2") (V4DI "avx2") (V8DI "avx512f")
478 (V4SF "avx2") (V8SF "avx2") (V16SF "avx512f")
479 (V2DF "avx2") (V4DF "avx2") (V8DF "avx512f")
480 (V8HI "avx512vl") (V16HI "avx512vl") (V32HI "avx512bw")])
482 (define_mode_attr shuffletype
483 [(V16SF "f") (V16SI "i") (V8DF "f") (V8DI "i")
484 (V8SF "f") (V8SI "i") (V4DF "f") (V4DI "i")
485 (V4SF "f") (V4SI "i") (V2DF "f") (V2DI "i")
486 (V32HI "i") (V16HI "i") (V8HI "i")
487 (V64QI "i") (V32QI "i") (V16QI "i")
488 (V4TI "i") (V2TI "i") (V1TI "i")])
490 (define_mode_attr ssequartermode
491 [(V16SF "V4SF") (V8DF "V2DF") (V16SI "V4SI") (V8DI "V2DI")])
493 (define_mode_attr ssedoublemodelower
494 [(V16QI "v16hi") (V32QI "v32hi") (V64QI "v64hi")
495 (V8HI "v8si") (V16HI "v16si") (V32HI "v32si")
496 (V4SI "v4di") (V8SI "v8di") (V16SI "v16di")])
498 (define_mode_attr ssedoublemode
499 [(V4SF "V8SF") (V8SF "V16SF") (V16SF "V32SF")
500 (V2DF "V4DF") (V4DF "V8DF") (V8DF "V16DF")
501 (V16QI "V16HI") (V32QI "V32HI") (V64QI "V64HI")
502 (V4HI "V4SI") (V8HI "V8SI") (V16HI "V16SI") (V32HI "V32SI")
503 (V4SI "V4DI") (V8SI "V16SI") (V16SI "V32SI")
504 (V4DI "V8DI") (V8DI "V16DI")])
506 (define_mode_attr ssebytemode
507 [(V8DI "V64QI") (V4DI "V32QI") (V2DI "V16QI")])
509 ;; All 128bit vector integer modes
510 (define_mode_iterator VI_128 [V16QI V8HI V4SI V2DI])
512 ;; All 256bit vector integer modes
513 (define_mode_iterator VI_256 [V32QI V16HI V8SI V4DI])
515 ;; All 512bit vector integer modes
516 (define_mode_iterator VI_512
517 [(V64QI "TARGET_AVX512BW")
518 (V32HI "TARGET_AVX512BW")
521 ;; Various 128bit vector integer mode combinations
522 (define_mode_iterator VI12_128 [V16QI V8HI])
523 (define_mode_iterator VI14_128 [V16QI V4SI])
524 (define_mode_iterator VI124_128 [V16QI V8HI V4SI])
525 (define_mode_iterator VI24_128 [V8HI V4SI])
526 (define_mode_iterator VI248_128 [V8HI V4SI V2DI])
527 (define_mode_iterator VI48_128 [V4SI V2DI])
529 ;; Various 256bit and 512 vector integer mode combinations
530 (define_mode_iterator VI124_256 [V32QI V16HI V8SI])
531 (define_mode_iterator VI124_256_AVX512F_AVX512BW
533 (V64QI "TARGET_AVX512BW")
534 (V32HI "TARGET_AVX512BW")
535 (V16SI "TARGET_AVX512F")])
536 (define_mode_iterator VI48_256 [V8SI V4DI])
537 (define_mode_iterator VI48_512 [V16SI V8DI])
538 (define_mode_iterator VI4_256_8_512 [V8SI V8DI])
539 (define_mode_iterator VI_AVX512BW
540 [V16SI V8DI (V32HI "TARGET_AVX512BW") (V64QI "TARGET_AVX512BW")])
542 ;; Int-float size matches
543 (define_mode_iterator VI4F_128 [V4SI V4SF])
544 (define_mode_iterator VI8F_128 [V2DI V2DF])
545 (define_mode_iterator VI4F_256 [V8SI V8SF])
546 (define_mode_iterator VI8F_256 [V4DI V4DF])
547 (define_mode_iterator VI8F_256_512
548 [V4DI V4DF (V8DI "TARGET_AVX512F") (V8DF "TARGET_AVX512F")])
549 (define_mode_iterator VI48F_256_512
551 (V16SI "TARGET_AVX512F") (V16SF "TARGET_AVX512F")
552 (V8DI "TARGET_AVX512F") (V8DF "TARGET_AVX512F")
553 (V4DI "TARGET_AVX512VL") (V4DF "TARGET_AVX512VL")])
554 (define_mode_iterator VF48_I1248
555 [V16SI V16SF V8DI V8DF V32HI V64QI])
556 (define_mode_iterator VI48F
557 [V16SI V16SF V8DI V8DF
558 (V8SI "TARGET_AVX512VL") (V8SF "TARGET_AVX512VL")
559 (V4DI "TARGET_AVX512VL") (V4DF "TARGET_AVX512VL")
560 (V4SI "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
561 (V2DI "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
562 (define_mode_iterator VI48F_256 [V8SI V8SF V4DI V4DF])
564 ;; Mapping from float mode to required SSE level
565 (define_mode_attr sse
566 [(SF "sse") (DF "sse2")
567 (V4SF "sse") (V2DF "sse2")
568 (V16SF "avx512f") (V8SF "avx")
569 (V8DF "avx512f") (V4DF "avx")])
571 (define_mode_attr sse2
572 [(V16QI "sse2") (V32QI "avx") (V64QI "avx512f")
573 (V2DI "sse2") (V4DI "avx") (V8DI "avx512f")])
575 (define_mode_attr sse3
576 [(V16QI "sse3") (V32QI "avx")])
578 (define_mode_attr sse4_1
579 [(V4SF "sse4_1") (V2DF "sse4_1")
580 (V8SF "avx") (V4DF "avx")
582 (V4DI "avx") (V2DI "sse4_1")
583 (V8SI "avx") (V4SI "sse4_1")
584 (V16QI "sse4_1") (V32QI "avx")
585 (V8HI "sse4_1") (V16HI "avx")])
587 (define_mode_attr avxsizesuffix
588 [(V64QI "512") (V32HI "512") (V16SI "512") (V8DI "512")
589 (V32QI "256") (V16HI "256") (V8SI "256") (V4DI "256")
590 (V16QI "") (V8HI "") (V4SI "") (V2DI "")
591 (V16SF "512") (V8DF "512")
592 (V8SF "256") (V4DF "256")
593 (V4SF "") (V2DF "")])
595 ;; SSE instruction mode
596 (define_mode_attr sseinsnmode
597 [(V64QI "XI") (V32HI "XI") (V16SI "XI") (V8DI "XI") (V4TI "XI")
598 (V32QI "OI") (V16HI "OI") (V8SI "OI") (V4DI "OI") (V2TI "OI")
599 (V16QI "TI") (V8HI "TI") (V4SI "TI") (V2DI "TI") (V1TI "TI")
600 (V16SF "V16SF") (V8DF "V8DF")
601 (V8SF "V8SF") (V4DF "V4DF")
602 (V4SF "V4SF") (V2DF "V2DF")
605 ;; Mapping of vector modes to corresponding mask size
606 (define_mode_attr avx512fmaskmode
607 [(V64QI "DI") (V32QI "SI") (V16QI "HI")
608 (V32HI "SI") (V16HI "HI") (V8HI "QI") (V4HI "QI")
609 (V16SI "HI") (V8SI "QI") (V4SI "QI")
610 (V8DI "QI") (V4DI "QI") (V2DI "QI")
611 (V16SF "HI") (V8SF "QI") (V4SF "QI")
612 (V8DF "QI") (V4DF "QI") (V2DF "QI")])
614 ;; Mapping of vector modes to corresponding mask size
615 (define_mode_attr avx512fmaskmodelower
616 [(V64QI "di") (V32QI "si") (V16QI "hi")
617 (V32HI "si") (V16HI "hi") (V8HI "qi") (V4HI "qi")
618 (V16SI "hi") (V8SI "qi") (V4SI "qi")
619 (V8DI "qi") (V4DI "qi") (V2DI "qi")
620 (V16SF "hi") (V8SF "qi") (V4SF "qi")
621 (V8DF "qi") (V4DF "qi") (V2DF "qi")])
623 ;; Mapping of vector float modes to an integer mode of the same size
624 (define_mode_attr sseintvecmode
625 [(V16SF "V16SI") (V8DF "V8DI")
626 (V8SF "V8SI") (V4DF "V4DI")
627 (V4SF "V4SI") (V2DF "V2DI")
628 (V16SI "V16SI") (V8DI "V8DI")
629 (V8SI "V8SI") (V4DI "V4DI")
630 (V4SI "V4SI") (V2DI "V2DI")
631 (V16HI "V16HI") (V8HI "V8HI")
632 (V32HI "V32HI") (V64QI "V64QI")
633 (V32QI "V32QI") (V16QI "V16QI")])
635 (define_mode_attr sseintvecmode2
636 [(V8DF "XI") (V4DF "OI") (V2DF "TI")
637 (V8SF "OI") (V4SF "TI")])
639 (define_mode_attr sseintvecmodelower
640 [(V16SF "v16si") (V8DF "v8di")
641 (V8SF "v8si") (V4DF "v4di")
642 (V4SF "v4si") (V2DF "v2di")
643 (V8SI "v8si") (V4DI "v4di")
644 (V4SI "v4si") (V2DI "v2di")
645 (V16HI "v16hi") (V8HI "v8hi")
646 (V32QI "v32qi") (V16QI "v16qi")])
648 ;; Mapping of vector modes to a vector mode of double size
649 (define_mode_attr ssedoublevecmode
650 [(V32QI "V64QI") (V16HI "V32HI") (V8SI "V16SI") (V4DI "V8DI")
651 (V16QI "V32QI") (V8HI "V16HI") (V4SI "V8SI") (V2DI "V4DI")
652 (V8SF "V16SF") (V4DF "V8DF")
653 (V4SF "V8SF") (V2DF "V4DF")])
655 ;; Mapping of vector modes to a vector mode of half size
656 (define_mode_attr ssehalfvecmode
657 [(V64QI "V32QI") (V32HI "V16HI") (V16SI "V8SI") (V8DI "V4DI")
658 (V32QI "V16QI") (V16HI "V8HI") (V8SI "V4SI") (V4DI "V2DI")
659 (V16QI "V8QI") (V8HI "V4HI") (V4SI "V2SI")
660 (V16SF "V8SF") (V8DF "V4DF")
661 (V8SF "V4SF") (V4DF "V2DF")
664 ;; Mapping of vector modes ti packed single mode of the same size
665 (define_mode_attr ssePSmode
666 [(V16SI "V16SF") (V8DF "V16SF")
667 (V16SF "V16SF") (V8DI "V16SF")
668 (V64QI "V16SF") (V32QI "V8SF") (V16QI "V4SF")
669 (V32HI "V16SF") (V16HI "V8SF") (V8HI "V4SF")
670 (V8SI "V8SF") (V4SI "V4SF")
671 (V4DI "V8SF") (V2DI "V4SF")
672 (V4TI "V16SF") (V2TI "V8SF") (V1TI "V4SF")
673 (V8SF "V8SF") (V4SF "V4SF")
674 (V4DF "V8SF") (V2DF "V4SF")])
676 (define_mode_attr ssePSmode2
677 [(V8DI "V8SF") (V4DI "V4SF")])
679 ;; Mapping of vector modes back to the scalar modes
680 (define_mode_attr ssescalarmode
681 [(V64QI "QI") (V32QI "QI") (V16QI "QI")
682 (V32HI "HI") (V16HI "HI") (V8HI "HI")
683 (V16SI "SI") (V8SI "SI") (V4SI "SI")
684 (V8DI "DI") (V4DI "DI") (V2DI "DI")
685 (V16SF "SF") (V8SF "SF") (V4SF "SF")
686 (V8DF "DF") (V4DF "DF") (V2DF "DF")])
688 ;; Mapping of vector modes to the 128bit modes
689 (define_mode_attr ssexmmmode
690 [(V64QI "V16QI") (V32QI "V16QI") (V16QI "V16QI")
691 (V32HI "V8HI") (V16HI "V8HI") (V8HI "V8HI")
692 (V16SI "V4SI") (V8SI "V4SI") (V4SI "V4SI")
693 (V8DI "V2DI") (V4DI "V2DI") (V2DI "V2DI")
694 (V16SF "V4SF") (V8SF "V4SF") (V4SF "V4SF")
695 (V8DF "V2DF") (V4DF "V2DF") (V2DF "V2DF")])
697 ;; Pointer size override for scalar modes (Intel asm dialect)
698 (define_mode_attr iptr
699 [(V64QI "b") (V32HI "w") (V16SI "k") (V8DI "q")
700 (V32QI "b") (V16HI "w") (V8SI "k") (V4DI "q")
701 (V16QI "b") (V8HI "w") (V4SI "k") (V2DI "q")
702 (V8SF "k") (V4DF "q")
703 (V4SF "k") (V2DF "q")
706 ;; Number of scalar elements in each vector type
707 (define_mode_attr ssescalarnum
708 [(V64QI "64") (V16SI "16") (V8DI "8")
709 (V32QI "32") (V16HI "16") (V8SI "8") (V4DI "4")
710 (V16QI "16") (V8HI "8") (V4SI "4") (V2DI "2")
711 (V16SF "16") (V8DF "8")
712 (V8SF "8") (V4DF "4")
713 (V4SF "4") (V2DF "2")])
715 ;; Mask of scalar elements in each vector type
716 (define_mode_attr ssescalarnummask
717 [(V32QI "31") (V16HI "15") (V8SI "7") (V4DI "3")
718 (V16QI "15") (V8HI "7") (V4SI "3") (V2DI "1")
719 (V8SF "7") (V4DF "3")
720 (V4SF "3") (V2DF "1")])
722 (define_mode_attr ssescalarsize
723 [(V4TI "64") (V2TI "64") (V1TI "64")
724 (V8DI "64") (V4DI "64") (V2DI "64")
725 (V64QI "8") (V32QI "8") (V16QI "8")
726 (V32HI "16") (V16HI "16") (V8HI "16")
727 (V16SI "32") (V8SI "32") (V4SI "32")
728 (V16SF "32") (V8SF "32") (V4SF "32")
729 (V8DF "64") (V4DF "64") (V2DF "64")])
731 ;; SSE prefix for integer vector modes
732 (define_mode_attr sseintprefix
733 [(V2DI "p") (V2DF "")
738 (V16SI "p") (V16SF "")
739 (V16QI "p") (V8HI "p")
740 (V32QI "p") (V16HI "p")
741 (V64QI "p") (V32HI "p")])
743 ;; SSE scalar suffix for vector modes
744 (define_mode_attr ssescalarmodesuffix
746 (V8SF "ss") (V4DF "sd")
747 (V4SF "ss") (V2DF "sd")
748 (V8SI "ss") (V4DI "sd")
751 ;; Pack/unpack vector modes
752 (define_mode_attr sseunpackmode
753 [(V16QI "V8HI") (V8HI "V4SI") (V4SI "V2DI")
754 (V32QI "V16HI") (V16HI "V8SI") (V8SI "V4DI")
755 (V32HI "V16SI") (V64QI "V32HI") (V16SI "V8DI")])
757 (define_mode_attr ssepackmode
758 [(V8HI "V16QI") (V4SI "V8HI") (V2DI "V4SI")
759 (V16HI "V32QI") (V8SI "V16HI") (V4DI "V8SI")
760 (V32HI "V64QI") (V16SI "V32HI") (V8DI "V16SI")])
762 ;; Mapping of the max integer size for xop rotate immediate constraint
763 (define_mode_attr sserotatemax
764 [(V16QI "7") (V8HI "15") (V4SI "31") (V2DI "63")])
766 ;; Mapping of mode to cast intrinsic name
767 (define_mode_attr castmode
768 [(V8SI "si") (V8SF "ps") (V4DF "pd")
769 (V16SI "si") (V16SF "ps") (V8DF "pd")])
771 ;; Instruction suffix for sign and zero extensions.
772 (define_code_attr extsuffix [(sign_extend "sx") (zero_extend "zx")])
774 ;; i128 for integer vectors and TARGET_AVX2, f128 otherwise.
775 ;; i64x4 or f64x4 for 512bit modes.
776 (define_mode_attr i128
777 [(V16SF "f64x4") (V8SF "f128") (V8DF "f64x4") (V4DF "f128")
778 (V64QI "i64x4") (V32QI "%~128") (V32HI "i64x4") (V16HI "%~128")
779 (V16SI "i64x4") (V8SI "%~128") (V8DI "i64x4") (V4DI "%~128")])
781 ;; For 256-bit modes for TARGET_AVX512VL && TARGET_AVX512DQ
782 ;; i32x4, f32x4, i64x2 or f64x2 suffixes.
783 (define_mode_attr i128vldq
784 [(V8SF "f32x4") (V4DF "f64x2")
785 (V32QI "i32x4") (V16HI "i32x4") (V8SI "i32x4") (V4DI "i64x2")])
788 (define_mode_iterator AVX256MODE2P [V8SI V8SF V4DF])
789 (define_mode_iterator AVX512MODE2P [V16SI V16SF V8DF])
791 ;; Mapping for dbpsabbw modes
792 (define_mode_attr dbpsadbwmode
793 [(V32HI "V64QI") (V16HI "V32QI") (V8HI "V16QI")])
795 ;; Mapping suffixes for broadcast
796 (define_mode_attr bcstscalarsuff
797 [(V64QI "b") (V32QI "b") (V16QI "b")
798 (V32HI "w") (V16HI "w") (V8HI "w")
799 (V16SI "d") (V8SI "d") (V4SI "d")
800 (V8DI "q") (V4DI "q") (V2DI "q")
801 (V16SF "ss") (V8SF "ss") (V4SF "ss")
802 (V8DF "sd") (V4DF "sd") (V2DF "sd")])
804 ;; Tie mode of assembler operand to mode iterator
805 (define_mode_attr concat_tg_mode
806 [(V32QI "t") (V16HI "t") (V8SI "t") (V4DI "t") (V8SF "t") (V4DF "t")
807 (V64QI "g") (V32HI "g") (V16SI "g") (V8DI "g") (V16SF "g") (V8DF "g")])
809 ;; Half mask mode for unpacks
810 (define_mode_attr HALFMASKMODE
811 [(DI "SI") (SI "HI")])
813 ;; Double mask mode for packs
814 (define_mode_attr DOUBLEMASKMODE
815 [(HI "SI") (SI "DI")])
818 ;; Include define_subst patterns for instructions with mask
821 ;; Patterns whose name begins with "sse{,2,3}_" are invoked by intrinsics.
823 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
827 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
829 ;; All of these patterns are enabled for SSE1 as well as SSE2.
830 ;; This is essential for maintaining stable calling conventions.
832 (define_expand "mov<mode>"
833 [(set (match_operand:VMOVE 0 "nonimmediate_operand")
834 (match_operand:VMOVE 1 "nonimmediate_operand"))]
837 ix86_expand_vector_move (<MODE>mode, operands);
841 (define_insn "mov<mode>_internal"
842 [(set (match_operand:VMOVE 0 "nonimmediate_operand"
844 (match_operand:VMOVE 1 "nonimmediate_or_sse_const_operand"
847 && (register_operand (operands[0], <MODE>mode)
848 || register_operand (operands[1], <MODE>mode))"
850 switch (get_attr_type (insn))
853 return standard_sse_constant_opcode (insn, operands[1]);
856 /* There is no evex-encoded vmov* for sizes smaller than 64-bytes
857 in avx512f, so we need to use workarounds, to access sse registers
858 16-31, which are evex-only. In avx512vl we don't need workarounds. */
859 if (TARGET_AVX512F && <MODE_SIZE> < 64 && !TARGET_AVX512VL
860 && (EXT_REX_SSE_REG_P (operands[0])
861 || EXT_REX_SSE_REG_P (operands[1])))
863 if (memory_operand (operands[0], <MODE>mode))
865 if (<MODE_SIZE> == 32)
866 return "vextract<shuffletype>64x4\t{$0x0, %g1, %0|%0, %g1, 0x0}";
867 else if (<MODE_SIZE> == 16)
868 return "vextract<shuffletype>32x4\t{$0x0, %g1, %0|%0, %g1, 0x0}";
872 else if (memory_operand (operands[1], <MODE>mode))
874 if (<MODE_SIZE> == 32)
875 return "vbroadcast<shuffletype>64x4\t{%1, %g0|%g0, %1}";
876 else if (<MODE_SIZE> == 16)
877 return "vbroadcast<shuffletype>32x4\t{%1, %g0|%g0, %1}";
882 /* Reg -> reg move is always aligned. Just use wider move. */
883 switch (get_attr_mode (insn))
887 return "vmovaps\t{%g1, %g0|%g0, %g1}";
890 return "vmovapd\t{%g1, %g0|%g0, %g1}";
893 return "vmovdqa64\t{%g1, %g0|%g0, %g1}";
899 switch (get_attr_mode (insn))
904 if (misaligned_operand (operands[0], <MODE>mode)
905 || misaligned_operand (operands[1], <MODE>mode))
906 return "%vmovups\t{%1, %0|%0, %1}";
908 return "%vmovaps\t{%1, %0|%0, %1}";
913 if (misaligned_operand (operands[0], <MODE>mode)
914 || misaligned_operand (operands[1], <MODE>mode))
915 return "%vmovupd\t{%1, %0|%0, %1}";
917 return "%vmovapd\t{%1, %0|%0, %1}";
921 if (misaligned_operand (operands[0], <MODE>mode)
922 || misaligned_operand (operands[1], <MODE>mode))
923 return TARGET_AVX512VL ? "vmovdqu<ssescalarsize>\t{%1, %0|%0, %1}"
924 : "%vmovdqu\t{%1, %0|%0, %1}";
926 return TARGET_AVX512VL ? "vmovdqa64\t{%1, %0|%0, %1}"
927 : "%vmovdqa\t{%1, %0|%0, %1}";
929 if (misaligned_operand (operands[0], <MODE>mode)
930 || misaligned_operand (operands[1], <MODE>mode))
931 return (<MODE>mode == V16SImode
932 || <MODE>mode == V8DImode
934 ? "vmovdqu<ssescalarsize>\t{%1, %0|%0, %1}"
935 : "vmovdqu64\t{%1, %0|%0, %1}";
937 return "vmovdqa64\t{%1, %0|%0, %1}";
947 [(set_attr "type" "sselog1,sselog1,ssemov,ssemov")
948 (set_attr "prefix" "maybe_vex")
950 (cond [(and (eq_attr "alternative" "1")
951 (match_test "TARGET_AVX512VL"))
953 (and (match_test "<MODE_SIZE> == 16")
954 (ior (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
955 (and (eq_attr "alternative" "3")
956 (match_test "TARGET_SSE_TYPELESS_STORES"))))
957 (const_string "<ssePSmode>")
958 (match_test "TARGET_AVX")
959 (const_string "<sseinsnmode>")
960 (ior (not (match_test "TARGET_SSE2"))
961 (match_test "optimize_function_for_size_p (cfun)"))
962 (const_string "V4SF")
963 (and (eq_attr "alternative" "0")
964 (match_test "TARGET_SSE_LOAD0_BY_PXOR"))
967 (const_string "<sseinsnmode>")))
968 (set (attr "enabled")
969 (cond [(and (match_test "<MODE_SIZE> == 16")
970 (eq_attr "alternative" "1"))
971 (symbol_ref "TARGET_SSE2")
972 (and (match_test "<MODE_SIZE> == 32")
973 (eq_attr "alternative" "1"))
974 (symbol_ref "TARGET_AVX2")
976 (symbol_ref "true")))])
978 (define_insn "<avx512>_load<mode>_mask"
979 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v,v")
980 (vec_merge:V48_AVX512VL
981 (match_operand:V48_AVX512VL 1 "nonimmediate_operand" "v,m")
982 (match_operand:V48_AVX512VL 2 "vector_move_operand" "0C,0C")
983 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
986 if (FLOAT_MODE_P (GET_MODE_INNER (<MODE>mode)))
988 if (misaligned_operand (operands[1], <MODE>mode))
989 return "vmovu<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
991 return "vmova<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
995 if (misaligned_operand (operands[1], <MODE>mode))
996 return "vmovdqu<ssescalarsize>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
998 return "vmovdqa<ssescalarsize>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}";
1001 [(set_attr "type" "ssemov")
1002 (set_attr "prefix" "evex")
1003 (set_attr "memory" "none,load")
1004 (set_attr "mode" "<sseinsnmode>")])
1006 (define_insn "<avx512>_load<mode>_mask"
1007 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v,v")
1008 (vec_merge:VI12_AVX512VL
1009 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "v,m")
1010 (match_operand:VI12_AVX512VL 2 "vector_move_operand" "0C,0C")
1011 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
1013 "vmovdqu<ssescalarsize>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
1014 [(set_attr "type" "ssemov")
1015 (set_attr "prefix" "evex")
1016 (set_attr "memory" "none,load")
1017 (set_attr "mode" "<sseinsnmode>")])
1019 (define_insn "<avx512>_blendm<mode>"
1020 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v")
1021 (vec_merge:V48_AVX512VL
1022 (match_operand:V48_AVX512VL 2 "nonimmediate_operand" "vm")
1023 (match_operand:V48_AVX512VL 1 "register_operand" "v")
1024 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
1026 "vblendm<ssemodesuffix>\t{%2, %1, %0%{%3%}|%0%{%3%}, %1, %2}"
1027 [(set_attr "type" "ssemov")
1028 (set_attr "prefix" "evex")
1029 (set_attr "mode" "<sseinsnmode>")])
1031 (define_insn "<avx512>_blendm<mode>"
1032 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
1033 (vec_merge:VI12_AVX512VL
1034 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")
1035 (match_operand:VI12_AVX512VL 1 "register_operand" "v")
1036 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
1038 "vpblendm<ssemodesuffix>\t{%2, %1, %0%{%3%}|%0%{%3%}, %1, %2}"
1039 [(set_attr "type" "ssemov")
1040 (set_attr "prefix" "evex")
1041 (set_attr "mode" "<sseinsnmode>")])
1043 (define_insn "<avx512>_store<mode>_mask"
1044 [(set (match_operand:V48_AVX512VL 0 "memory_operand" "=m")
1045 (vec_merge:V48_AVX512VL
1046 (match_operand:V48_AVX512VL 1 "register_operand" "v")
1048 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")))]
1051 if (FLOAT_MODE_P (GET_MODE_INNER (<MODE>mode)))
1053 if (misaligned_operand (operands[0], <MODE>mode))
1054 return "vmovu<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1056 return "vmova<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1060 if (misaligned_operand (operands[0], <MODE>mode))
1061 return "vmovdqu<ssescalarsize>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1063 return "vmovdqa<ssescalarsize>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
1066 [(set_attr "type" "ssemov")
1067 (set_attr "prefix" "evex")
1068 (set_attr "memory" "store")
1069 (set_attr "mode" "<sseinsnmode>")])
1071 (define_insn "<avx512>_store<mode>_mask"
1072 [(set (match_operand:VI12_AVX512VL 0 "memory_operand" "=m")
1073 (vec_merge:VI12_AVX512VL
1074 (match_operand:VI12_AVX512VL 1 "register_operand" "v")
1076 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")))]
1078 "vmovdqu<ssescalarsize>\t{%1, %0%{%2%}|%0%{%2%}, %1}"
1079 [(set_attr "type" "ssemov")
1080 (set_attr "prefix" "evex")
1081 (set_attr "memory" "store")
1082 (set_attr "mode" "<sseinsnmode>")])
1084 (define_insn "sse2_movq128"
1085 [(set (match_operand:V2DI 0 "register_operand" "=v")
1088 (match_operand:V2DI 1 "nonimmediate_operand" "vm")
1089 (parallel [(const_int 0)]))
1092 "%vmovq\t{%1, %0|%0, %q1}"
1093 [(set_attr "type" "ssemov")
1094 (set_attr "prefix" "maybe_vex")
1095 (set_attr "mode" "TI")])
1097 ;; Move a DI from a 32-bit register pair (e.g. %edx:%eax) to an xmm.
1098 ;; We'd rather avoid this entirely; if the 32-bit reg pair was loaded
1099 ;; from memory, we'd prefer to load the memory directly into the %xmm
1100 ;; register. To facilitate this happy circumstance, this pattern won't
1101 ;; split until after register allocation. If the 64-bit value didn't
1102 ;; come from memory, this is the best we can do. This is much better
1103 ;; than storing %edx:%eax into a stack temporary and loading an %xmm
1106 (define_insn_and_split "movdi_to_sse"
1108 [(set (match_operand:V4SI 0 "register_operand" "=?x,x")
1109 (subreg:V4SI (match_operand:DI 1 "nonimmediate_operand" "r,m") 0))
1110 (clobber (match_scratch:V4SI 2 "=&x,X"))])]
1111 "!TARGET_64BIT && TARGET_SSE2 && TARGET_INTER_UNIT_MOVES_TO_VEC"
1113 "&& reload_completed"
1116 if (register_operand (operands[1], DImode))
1118 /* The DImode arrived in a pair of integral registers (e.g. %edx:%eax).
1119 Assemble the 64-bit DImode value in an xmm register. */
1120 emit_insn (gen_sse2_loadld (operands[0], CONST0_RTX (V4SImode),
1121 gen_lowpart (SImode, operands[1])));
1122 emit_insn (gen_sse2_loadld (operands[2], CONST0_RTX (V4SImode),
1123 gen_highpart (SImode, operands[1])));
1124 emit_insn (gen_vec_interleave_lowv4si (operands[0], operands[0],
1127 else if (memory_operand (operands[1], DImode))
1129 rtx tmp = gen_reg_rtx (V2DImode);
1130 emit_insn (gen_vec_concatv2di (tmp, operands[1], const0_rtx));
1131 emit_move_insn (operands[0], gen_lowpart (V4SImode, tmp));
1138 [(set (match_operand:V4SF 0 "register_operand")
1139 (match_operand:V4SF 1 "zero_extended_scalar_load_operand"))]
1140 "TARGET_SSE && reload_completed"
1143 (vec_duplicate:V4SF (match_dup 1))
1147 operands[1] = gen_lowpart (SFmode, operands[1]);
1148 operands[2] = CONST0_RTX (V4SFmode);
1152 [(set (match_operand:V2DF 0 "register_operand")
1153 (match_operand:V2DF 1 "zero_extended_scalar_load_operand"))]
1154 "TARGET_SSE2 && reload_completed"
1155 [(set (match_dup 0) (vec_concat:V2DF (match_dup 1) (match_dup 2)))]
1157 operands[1] = gen_lowpart (DFmode, operands[1]);
1158 operands[2] = CONST0_RTX (DFmode);
1161 (define_expand "movmisalign<mode>"
1162 [(set (match_operand:VMOVE 0 "nonimmediate_operand")
1163 (match_operand:VMOVE 1 "nonimmediate_operand"))]
1166 ix86_expand_vector_move_misalign (<MODE>mode, operands);
1170 ;; Merge movsd/movhpd to movupd for TARGET_SSE_UNALIGNED_LOAD_OPTIMAL targets.
1172 [(set (match_operand:V2DF 0 "register_operand")
1173 (vec_concat:V2DF (match_operand:DF 1 "memory_operand")
1174 (match_operand:DF 4 "const0_operand")))
1175 (set (match_operand:V2DF 2 "register_operand")
1176 (vec_concat:V2DF (vec_select:DF (match_dup 2)
1177 (parallel [(const_int 0)]))
1178 (match_operand:DF 3 "memory_operand")))]
1179 "TARGET_SSE2 && TARGET_SSE_UNALIGNED_LOAD_OPTIMAL
1180 && ix86_operands_ok_for_move_multiple (operands, true, DFmode)"
1181 [(set (match_dup 2) (match_dup 4))]
1182 "operands[4] = adjust_address (operands[1], V2DFmode, 0);")
1184 ;; Merge movlpd/movhpd to movupd for TARGET_SSE_UNALIGNED_STORE_OPTIMAL targets.
1186 [(set (match_operand:DF 0 "memory_operand")
1187 (vec_select:DF (match_operand:V2DF 1 "register_operand")
1188 (parallel [(const_int 0)])))
1189 (set (match_operand:DF 2 "memory_operand")
1190 (vec_select:DF (match_operand:V2DF 3 "register_operand")
1191 (parallel [(const_int 1)])))]
1192 "TARGET_SSE2 && TARGET_SSE_UNALIGNED_STORE_OPTIMAL
1193 && ix86_operands_ok_for_move_multiple (operands, false, DFmode)"
1194 [(set (match_dup 4) (match_dup 1))]
1195 "operands[4] = adjust_address (operands[0], V2DFmode, 0);")
1197 (define_insn "<sse3>_lddqu<avxsizesuffix>"
1198 [(set (match_operand:VI1 0 "register_operand" "=x")
1199 (unspec:VI1 [(match_operand:VI1 1 "memory_operand" "m")]
1202 "%vlddqu\t{%1, %0|%0, %1}"
1203 [(set_attr "type" "ssemov")
1204 (set_attr "movu" "1")
1205 (set (attr "prefix_data16")
1207 (match_test "TARGET_AVX")
1209 (const_string "0")))
1210 (set (attr "prefix_rep")
1212 (match_test "TARGET_AVX")
1214 (const_string "1")))
1215 (set_attr "prefix" "maybe_vex")
1216 (set_attr "mode" "<sseinsnmode>")])
1218 (define_insn "sse2_movnti<mode>"
1219 [(set (match_operand:SWI48 0 "memory_operand" "=m")
1220 (unspec:SWI48 [(match_operand:SWI48 1 "register_operand" "r")]
1223 "movnti\t{%1, %0|%0, %1}"
1224 [(set_attr "type" "ssemov")
1225 (set_attr "prefix_data16" "0")
1226 (set_attr "mode" "<MODE>")])
1228 (define_insn "<sse>_movnt<mode>"
1229 [(set (match_operand:VF 0 "memory_operand" "=m")
1231 [(match_operand:VF 1 "register_operand" "v")]
1234 "%vmovnt<ssemodesuffix>\t{%1, %0|%0, %1}"
1235 [(set_attr "type" "ssemov")
1236 (set_attr "prefix" "maybe_vex")
1237 (set_attr "mode" "<MODE>")])
1239 (define_insn "<sse2>_movnt<mode>"
1240 [(set (match_operand:VI8 0 "memory_operand" "=m")
1241 (unspec:VI8 [(match_operand:VI8 1 "register_operand" "v")]
1244 "%vmovntdq\t{%1, %0|%0, %1}"
1245 [(set_attr "type" "ssecvt")
1246 (set (attr "prefix_data16")
1248 (match_test "TARGET_AVX")
1250 (const_string "1")))
1251 (set_attr "prefix" "maybe_vex")
1252 (set_attr "mode" "<sseinsnmode>")])
1254 ; Expand patterns for non-temporal stores. At the moment, only those
1255 ; that directly map to insns are defined; it would be possible to
1256 ; define patterns for other modes that would expand to several insns.
1258 ;; Modes handled by storent patterns.
1259 (define_mode_iterator STORENT_MODE
1260 [(DI "TARGET_SSE2 && TARGET_64BIT") (SI "TARGET_SSE2")
1261 (SF "TARGET_SSE4A") (DF "TARGET_SSE4A")
1262 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") (V2DI "TARGET_SSE2")
1263 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
1264 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
1266 (define_expand "storent<mode>"
1267 [(set (match_operand:STORENT_MODE 0 "memory_operand")
1268 (unspec:STORENT_MODE
1269 [(match_operand:STORENT_MODE 1 "register_operand")]
1273 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1275 ;; Parallel floating point arithmetic
1277 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1279 (define_expand "<code><mode>2"
1280 [(set (match_operand:VF 0 "register_operand")
1282 (match_operand:VF 1 "register_operand")))]
1284 "ix86_expand_fp_absneg_operator (<CODE>, <MODE>mode, operands); DONE;")
1286 (define_insn_and_split "*absneg<mode>2"
1287 [(set (match_operand:VF 0 "register_operand" "=x,x,v,v")
1288 (match_operator:VF 3 "absneg_operator"
1289 [(match_operand:VF 1 "vector_operand" "0, xBm,v, m")]))
1290 (use (match_operand:VF 2 "vector_operand" "xBm,0, vm,v"))]
1293 "&& reload_completed"
1296 enum rtx_code absneg_op;
1302 if (MEM_P (operands[1]))
1303 op1 = operands[2], op2 = operands[1];
1305 op1 = operands[1], op2 = operands[2];
1310 if (rtx_equal_p (operands[0], operands[1]))
1316 absneg_op = GET_CODE (operands[3]) == NEG ? XOR : AND;
1317 t = gen_rtx_fmt_ee (absneg_op, <MODE>mode, op1, op2);
1318 t = gen_rtx_SET (operands[0], t);
1322 [(set_attr "isa" "noavx,noavx,avx,avx")])
1324 (define_expand "<plusminus_insn><mode>3<mask_name><round_name>"
1325 [(set (match_operand:VF 0 "register_operand")
1327 (match_operand:VF 1 "<round_nimm_predicate>")
1328 (match_operand:VF 2 "<round_nimm_predicate>")))]
1329 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1330 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
1332 (define_insn "*<plusminus_insn><mode>3<mask_name><round_name>"
1333 [(set (match_operand:VF 0 "register_operand" "=x,v")
1335 (match_operand:VF 1 "<round_nimm_predicate>" "<comm>0,v")
1336 (match_operand:VF 2 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
1337 "TARGET_SSE && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands) && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1339 <plusminus_mnemonic><ssemodesuffix>\t{%2, %0|%0, %2}
1340 v<plusminus_mnemonic><ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
1341 [(set_attr "isa" "noavx,avx")
1342 (set_attr "type" "sseadd")
1343 (set_attr "prefix" "<mask_prefix3>")
1344 (set_attr "mode" "<MODE>")])
1346 (define_insn "<sse>_vm<plusminus_insn><mode>3<round_name>"
1347 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
1350 (match_operand:VF_128 1 "register_operand" "0,v")
1351 (match_operand:VF_128 2 "vector_operand" "xBm,<round_constraint>"))
1356 <plusminus_mnemonic><ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
1357 v<plusminus_mnemonic><ssescalarmodesuffix>\t{<round_op3>%2, %1, %0|%0, %1, %<iptr>2<round_op3>}"
1358 [(set_attr "isa" "noavx,avx")
1359 (set_attr "type" "sseadd")
1360 (set_attr "prefix" "<round_prefix>")
1361 (set_attr "mode" "<ssescalarmode>")])
1363 (define_expand "mul<mode>3<mask_name><round_name>"
1364 [(set (match_operand:VF 0 "register_operand")
1366 (match_operand:VF 1 "<round_nimm_predicate>")
1367 (match_operand:VF 2 "<round_nimm_predicate>")))]
1368 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1369 "ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);")
1371 (define_insn "*mul<mode>3<mask_name><round_name>"
1372 [(set (match_operand:VF 0 "register_operand" "=x,v")
1374 (match_operand:VF 1 "<round_nimm_predicate>" "%0,v")
1375 (match_operand:VF 2 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
1376 "TARGET_SSE && ix86_binary_operator_ok (MULT, <MODE>mode, operands) && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1378 mul<ssemodesuffix>\t{%2, %0|%0, %2}
1379 vmul<ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
1380 [(set_attr "isa" "noavx,avx")
1381 (set_attr "type" "ssemul")
1382 (set_attr "prefix" "<mask_prefix3>")
1383 (set_attr "btver2_decode" "direct,double")
1384 (set_attr "mode" "<MODE>")])
1386 (define_insn "<sse>_vm<multdiv_mnemonic><mode>3<round_name>"
1387 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
1390 (match_operand:VF_128 1 "register_operand" "0,v")
1391 (match_operand:VF_128 2 "vector_operand" "xBm,<round_constraint>"))
1396 <multdiv_mnemonic><ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
1397 v<multdiv_mnemonic><ssescalarmodesuffix>\t{<round_op3>%2, %1, %0|%0, %1, %<iptr>2<round_op3>}"
1398 [(set_attr "isa" "noavx,avx")
1399 (set_attr "type" "sse<multdiv_mnemonic>")
1400 (set_attr "prefix" "<round_prefix>")
1401 (set_attr "btver2_decode" "direct,double")
1402 (set_attr "mode" "<ssescalarmode>")])
1404 (define_expand "div<mode>3"
1405 [(set (match_operand:VF2 0 "register_operand")
1406 (div:VF2 (match_operand:VF2 1 "register_operand")
1407 (match_operand:VF2 2 "vector_operand")))]
1409 "ix86_fixup_binary_operands_no_copy (DIV, <MODE>mode, operands);")
1411 (define_expand "div<mode>3"
1412 [(set (match_operand:VF1 0 "register_operand")
1413 (div:VF1 (match_operand:VF1 1 "register_operand")
1414 (match_operand:VF1 2 "vector_operand")))]
1417 ix86_fixup_binary_operands_no_copy (DIV, <MODE>mode, operands);
1420 && TARGET_RECIP_VEC_DIV
1421 && !optimize_insn_for_size_p ()
1422 && flag_finite_math_only && !flag_trapping_math
1423 && flag_unsafe_math_optimizations)
1425 ix86_emit_swdivsf (operands[0], operands[1], operands[2], <MODE>mode);
1430 (define_insn "<sse>_div<mode>3<mask_name><round_name>"
1431 [(set (match_operand:VF 0 "register_operand" "=x,v")
1433 (match_operand:VF 1 "register_operand" "0,v")
1434 (match_operand:VF 2 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
1435 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1437 div<ssemodesuffix>\t{%2, %0|%0, %2}
1438 vdiv<ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
1439 [(set_attr "isa" "noavx,avx")
1440 (set_attr "type" "ssediv")
1441 (set_attr "prefix" "<mask_prefix3>")
1442 (set_attr "mode" "<MODE>")])
1444 (define_insn "<sse>_rcp<mode>2"
1445 [(set (match_operand:VF1_128_256 0 "register_operand" "=x")
1447 [(match_operand:VF1_128_256 1 "vector_operand" "xBm")] UNSPEC_RCP))]
1449 "%vrcpps\t{%1, %0|%0, %1}"
1450 [(set_attr "type" "sse")
1451 (set_attr "atom_sse_attr" "rcp")
1452 (set_attr "btver2_sse_attr" "rcp")
1453 (set_attr "prefix" "maybe_vex")
1454 (set_attr "mode" "<MODE>")])
1456 (define_insn "sse_vmrcpv4sf2"
1457 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
1459 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm,xm")]
1461 (match_operand:V4SF 2 "register_operand" "0,x")
1465 rcpss\t{%1, %0|%0, %k1}
1466 vrcpss\t{%1, %2, %0|%0, %2, %k1}"
1467 [(set_attr "isa" "noavx,avx")
1468 (set_attr "type" "sse")
1469 (set_attr "atom_sse_attr" "rcp")
1470 (set_attr "btver2_sse_attr" "rcp")
1471 (set_attr "prefix" "orig,vex")
1472 (set_attr "mode" "SF")])
1474 (define_insn "<mask_codefor>rcp14<mode><mask_name>"
1475 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
1477 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "vm")]
1480 "vrcp14<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
1481 [(set_attr "type" "sse")
1482 (set_attr "prefix" "evex")
1483 (set_attr "mode" "<MODE>")])
1485 (define_insn "srcp14<mode>"
1486 [(set (match_operand:VF_128 0 "register_operand" "=v")
1489 [(match_operand:VF_128 1 "nonimmediate_operand" "vm")]
1491 (match_operand:VF_128 2 "register_operand" "v")
1494 "vrcp14<ssescalarmodesuffix>\t{%1, %2, %0|%0, %2, %<iptr>1}"
1495 [(set_attr "type" "sse")
1496 (set_attr "prefix" "evex")
1497 (set_attr "mode" "<MODE>")])
1499 (define_expand "sqrt<mode>2"
1500 [(set (match_operand:VF2 0 "register_operand")
1501 (sqrt:VF2 (match_operand:VF2 1 "vector_operand")))]
1504 (define_expand "sqrt<mode>2"
1505 [(set (match_operand:VF1 0 "register_operand")
1506 (sqrt:VF1 (match_operand:VF1 1 "vector_operand")))]
1510 && TARGET_RECIP_VEC_SQRT
1511 && !optimize_insn_for_size_p ()
1512 && flag_finite_math_only && !flag_trapping_math
1513 && flag_unsafe_math_optimizations)
1515 ix86_emit_swsqrtsf (operands[0], operands[1], <MODE>mode, false);
1520 (define_insn "<sse>_sqrt<mode>2<mask_name><round_name>"
1521 [(set (match_operand:VF 0 "register_operand" "=x,v")
1522 (sqrt:VF (match_operand:VF 1 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
1523 "TARGET_SSE && <mask_mode512bit_condition> && <round_mode512bit_condition>"
1525 sqrt<ssemodesuffix>\t{%1, %0|%0, %1}
1526 vsqrt<ssemodesuffix>\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
1527 [(set_attr "isa" "noavx,avx")
1528 (set_attr "type" "sse")
1529 (set_attr "atom_sse_attr" "sqrt")
1530 (set_attr "btver2_sse_attr" "sqrt")
1531 (set_attr "prefix" "maybe_vex")
1532 (set_attr "mode" "<MODE>")])
1534 (define_insn "<sse>_vmsqrt<mode>2<round_name>"
1535 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
1538 (match_operand:VF_128 1 "vector_operand" "xBm,<round_constraint>"))
1539 (match_operand:VF_128 2 "register_operand" "0,v")
1543 sqrt<ssescalarmodesuffix>\t{%1, %0|%0, %<iptr>1}
1544 vsqrt<ssescalarmodesuffix>\t{<round_op3>%1, %2, %0|%0, %2, %<iptr>1<round_op3>}"
1545 [(set_attr "isa" "noavx,avx")
1546 (set_attr "type" "sse")
1547 (set_attr "atom_sse_attr" "sqrt")
1548 (set_attr "prefix" "<round_prefix>")
1549 (set_attr "btver2_sse_attr" "sqrt")
1550 (set_attr "mode" "<ssescalarmode>")])
1552 (define_expand "rsqrt<mode>2"
1553 [(set (match_operand:VF1_128_256 0 "register_operand")
1555 [(match_operand:VF1_128_256 1 "vector_operand")] UNSPEC_RSQRT))]
1558 ix86_emit_swsqrtsf (operands[0], operands[1], <MODE>mode, true);
1562 (define_insn "<sse>_rsqrt<mode>2"
1563 [(set (match_operand:VF1_128_256 0 "register_operand" "=x")
1565 [(match_operand:VF1_128_256 1 "vector_operand" "xBm")] UNSPEC_RSQRT))]
1567 "%vrsqrtps\t{%1, %0|%0, %1}"
1568 [(set_attr "type" "sse")
1569 (set_attr "prefix" "maybe_vex")
1570 (set_attr "mode" "<MODE>")])
1572 (define_insn "<mask_codefor>rsqrt14<mode><mask_name>"
1573 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
1575 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "vm")]
1578 "vrsqrt14<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
1579 [(set_attr "type" "sse")
1580 (set_attr "prefix" "evex")
1581 (set_attr "mode" "<MODE>")])
1583 (define_insn "rsqrt14<mode>"
1584 [(set (match_operand:VF_128 0 "register_operand" "=v")
1587 [(match_operand:VF_128 1 "nonimmediate_operand" "vm")]
1589 (match_operand:VF_128 2 "register_operand" "v")
1592 "vrsqrt14<ssescalarmodesuffix>\t{%1, %2, %0|%0, %2, %<iptr>1}"
1593 [(set_attr "type" "sse")
1594 (set_attr "prefix" "evex")
1595 (set_attr "mode" "<MODE>")])
1597 (define_insn "sse_vmrsqrtv4sf2"
1598 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
1600 (unspec:V4SF [(match_operand:V4SF 1 "nonimmediate_operand" "xm,xm")]
1602 (match_operand:V4SF 2 "register_operand" "0,x")
1606 rsqrtss\t{%1, %0|%0, %k1}
1607 vrsqrtss\t{%1, %2, %0|%0, %2, %k1}"
1608 [(set_attr "isa" "noavx,avx")
1609 (set_attr "type" "sse")
1610 (set_attr "prefix" "orig,vex")
1611 (set_attr "mode" "SF")])
1613 ;; ??? For !flag_finite_math_only, the representation with SMIN/SMAX
1614 ;; isn't really correct, as those rtl operators aren't defined when
1615 ;; applied to NaNs. Hopefully the optimizers won't get too smart on us.
1617 (define_expand "<code><mode>3<mask_name><round_saeonly_name>"
1618 [(set (match_operand:VF 0 "register_operand")
1620 (match_operand:VF 1 "<round_saeonly_nimm_predicate>")
1621 (match_operand:VF 2 "<round_saeonly_nimm_predicate>")))]
1622 "TARGET_SSE && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
1624 if (!flag_finite_math_only)
1625 operands[1] = force_reg (<MODE>mode, operands[1]);
1626 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
1629 (define_insn "*<code><mode>3_finite<mask_name><round_saeonly_name>"
1630 [(set (match_operand:VF 0 "register_operand" "=x,v")
1632 (match_operand:VF 1 "<round_saeonly_nimm_predicate>" "%0,v")
1633 (match_operand:VF 2 "<round_saeonly_nimm_predicate>" "xBm,<round_saeonly_constraint>")))]
1634 "TARGET_SSE && flag_finite_math_only
1635 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)
1636 && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
1638 <maxmin_float><ssemodesuffix>\t{%2, %0|%0, %2}
1639 v<maxmin_float><ssemodesuffix>\t{<round_saeonly_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_saeonly_mask_op3>}"
1640 [(set_attr "isa" "noavx,avx")
1641 (set_attr "type" "sseadd")
1642 (set_attr "btver2_sse_attr" "maxmin")
1643 (set_attr "prefix" "<mask_prefix3>")
1644 (set_attr "mode" "<MODE>")])
1646 (define_insn "*<code><mode>3<mask_name><round_saeonly_name>"
1647 [(set (match_operand:VF 0 "register_operand" "=x,v")
1649 (match_operand:VF 1 "register_operand" "0,v")
1650 (match_operand:VF 2 "<round_saeonly_nimm_predicate>" "xBm,<round_saeonly_constraint>")))]
1651 "TARGET_SSE && !flag_finite_math_only
1652 && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
1654 <maxmin_float><ssemodesuffix>\t{%2, %0|%0, %2}
1655 v<maxmin_float><ssemodesuffix>\t{<round_saeonly_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_saeonly_mask_op3>}"
1656 [(set_attr "isa" "noavx,avx")
1657 (set_attr "type" "sseadd")
1658 (set_attr "btver2_sse_attr" "maxmin")
1659 (set_attr "prefix" "<mask_prefix3>")
1660 (set_attr "mode" "<MODE>")])
1662 (define_insn "<sse>_vm<code><mode>3<round_saeonly_name>"
1663 [(set (match_operand:VF_128 0 "register_operand" "=x,v")
1666 (match_operand:VF_128 1 "register_operand" "0,v")
1667 (match_operand:VF_128 2 "vector_operand" "xBm,<round_saeonly_constraint>"))
1672 <maxmin_float><ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
1673 v<maxmin_float><ssescalarmodesuffix>\t{<round_saeonly_op3>%2, %1, %0|%0, %1, %<iptr>2<round_saeonly_op3>}"
1674 [(set_attr "isa" "noavx,avx")
1675 (set_attr "type" "sse")
1676 (set_attr "btver2_sse_attr" "maxmin")
1677 (set_attr "prefix" "<round_saeonly_prefix>")
1678 (set_attr "mode" "<ssescalarmode>")])
1680 ;; These versions of the min/max patterns implement exactly the operations
1681 ;; min = (op1 < op2 ? op1 : op2)
1682 ;; max = (!(op1 < op2) ? op1 : op2)
1683 ;; Their operands are not commutative, and thus they may be used in the
1684 ;; presence of -0.0 and NaN.
1686 (define_insn "*ieee_smin<mode>3"
1687 [(set (match_operand:VF 0 "register_operand" "=x,v")
1689 [(match_operand:VF 1 "register_operand" "0,v")
1690 (match_operand:VF 2 "vector_operand" "xBm,vm")]
1694 min<ssemodesuffix>\t{%2, %0|%0, %2}
1695 vmin<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
1696 [(set_attr "isa" "noavx,avx")
1697 (set_attr "type" "sseadd")
1698 (set_attr "prefix" "orig,vex")
1699 (set_attr "mode" "<MODE>")])
1701 (define_insn "*ieee_smax<mode>3"
1702 [(set (match_operand:VF 0 "register_operand" "=x,v")
1704 [(match_operand:VF 1 "register_operand" "0,v")
1705 (match_operand:VF 2 "vector_operand" "xBm,vm")]
1709 max<ssemodesuffix>\t{%2, %0|%0, %2}
1710 vmax<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
1711 [(set_attr "isa" "noavx,avx")
1712 (set_attr "type" "sseadd")
1713 (set_attr "prefix" "orig,vex")
1714 (set_attr "mode" "<MODE>")])
1716 (define_insn "avx_addsubv4df3"
1717 [(set (match_operand:V4DF 0 "register_operand" "=x")
1720 (match_operand:V4DF 1 "register_operand" "x")
1721 (match_operand:V4DF 2 "nonimmediate_operand" "xm"))
1722 (plus:V4DF (match_dup 1) (match_dup 2))
1725 "vaddsubpd\t{%2, %1, %0|%0, %1, %2}"
1726 [(set_attr "type" "sseadd")
1727 (set_attr "prefix" "vex")
1728 (set_attr "mode" "V4DF")])
1730 (define_insn "sse3_addsubv2df3"
1731 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
1734 (match_operand:V2DF 1 "register_operand" "0,x")
1735 (match_operand:V2DF 2 "vector_operand" "xBm,xm"))
1736 (plus:V2DF (match_dup 1) (match_dup 2))
1740 addsubpd\t{%2, %0|%0, %2}
1741 vaddsubpd\t{%2, %1, %0|%0, %1, %2}"
1742 [(set_attr "isa" "noavx,avx")
1743 (set_attr "type" "sseadd")
1744 (set_attr "atom_unit" "complex")
1745 (set_attr "prefix" "orig,vex")
1746 (set_attr "mode" "V2DF")])
1748 (define_insn "avx_addsubv8sf3"
1749 [(set (match_operand:V8SF 0 "register_operand" "=x")
1752 (match_operand:V8SF 1 "register_operand" "x")
1753 (match_operand:V8SF 2 "nonimmediate_operand" "xm"))
1754 (plus:V8SF (match_dup 1) (match_dup 2))
1757 "vaddsubps\t{%2, %1, %0|%0, %1, %2}"
1758 [(set_attr "type" "sseadd")
1759 (set_attr "prefix" "vex")
1760 (set_attr "mode" "V8SF")])
1762 (define_insn "sse3_addsubv4sf3"
1763 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
1766 (match_operand:V4SF 1 "register_operand" "0,x")
1767 (match_operand:V4SF 2 "vector_operand" "xBm,xm"))
1768 (plus:V4SF (match_dup 1) (match_dup 2))
1772 addsubps\t{%2, %0|%0, %2}
1773 vaddsubps\t{%2, %1, %0|%0, %1, %2}"
1774 [(set_attr "isa" "noavx,avx")
1775 (set_attr "type" "sseadd")
1776 (set_attr "prefix" "orig,vex")
1777 (set_attr "prefix_rep" "1,*")
1778 (set_attr "mode" "V4SF")])
1781 [(set (match_operand:VF_128_256 0 "register_operand")
1782 (match_operator:VF_128_256 6 "addsub_vm_operator"
1784 (match_operand:VF_128_256 1 "register_operand")
1785 (match_operand:VF_128_256 2 "vector_operand"))
1787 (match_operand:VF_128_256 3 "vector_operand")
1788 (match_operand:VF_128_256 4 "vector_operand"))
1789 (match_operand 5 "const_int_operand")]))]
1791 && can_create_pseudo_p ()
1792 && ((rtx_equal_p (operands[1], operands[3])
1793 && rtx_equal_p (operands[2], operands[4]))
1794 || (rtx_equal_p (operands[1], operands[4])
1795 && rtx_equal_p (operands[2], operands[3])))"
1797 (vec_merge:VF_128_256
1798 (minus:VF_128_256 (match_dup 1) (match_dup 2))
1799 (plus:VF_128_256 (match_dup 1) (match_dup 2))
1803 [(set (match_operand:VF_128_256 0 "register_operand")
1804 (match_operator:VF_128_256 6 "addsub_vm_operator"
1806 (match_operand:VF_128_256 1 "vector_operand")
1807 (match_operand:VF_128_256 2 "vector_operand"))
1809 (match_operand:VF_128_256 3 "register_operand")
1810 (match_operand:VF_128_256 4 "vector_operand"))
1811 (match_operand 5 "const_int_operand")]))]
1813 && can_create_pseudo_p ()
1814 && ((rtx_equal_p (operands[1], operands[3])
1815 && rtx_equal_p (operands[2], operands[4]))
1816 || (rtx_equal_p (operands[1], operands[4])
1817 && rtx_equal_p (operands[2], operands[3])))"
1819 (vec_merge:VF_128_256
1820 (minus:VF_128_256 (match_dup 3) (match_dup 4))
1821 (plus:VF_128_256 (match_dup 3) (match_dup 4))
1824 /* Negate mask bits to compensate for swapped PLUS and MINUS RTXes. */
1826 = GEN_INT (~INTVAL (operands[5])
1827 & ((HOST_WIDE_INT_1U << GET_MODE_NUNITS (<MODE>mode)) - 1));
1831 [(set (match_operand:VF_128_256 0 "register_operand")
1832 (match_operator:VF_128_256 7 "addsub_vs_operator"
1833 [(vec_concat:<ssedoublemode>
1835 (match_operand:VF_128_256 1 "register_operand")
1836 (match_operand:VF_128_256 2 "vector_operand"))
1838 (match_operand:VF_128_256 3 "vector_operand")
1839 (match_operand:VF_128_256 4 "vector_operand")))
1840 (match_parallel 5 "addsub_vs_parallel"
1841 [(match_operand 6 "const_int_operand")])]))]
1843 && can_create_pseudo_p ()
1844 && ((rtx_equal_p (operands[1], operands[3])
1845 && rtx_equal_p (operands[2], operands[4]))
1846 || (rtx_equal_p (operands[1], operands[4])
1847 && rtx_equal_p (operands[2], operands[3])))"
1849 (vec_merge:VF_128_256
1850 (minus:VF_128_256 (match_dup 1) (match_dup 2))
1851 (plus:VF_128_256 (match_dup 1) (match_dup 2))
1854 int i, nelt = XVECLEN (operands[5], 0);
1855 HOST_WIDE_INT ival = 0;
1857 for (i = 0; i < nelt; i++)
1858 if (INTVAL (XVECEXP (operands[5], 0, i)) < GET_MODE_NUNITS (<MODE>mode))
1859 ival |= HOST_WIDE_INT_1 << i;
1861 operands[5] = GEN_INT (ival);
1865 [(set (match_operand:VF_128_256 0 "register_operand")
1866 (match_operator:VF_128_256 7 "addsub_vs_operator"
1867 [(vec_concat:<ssedoublemode>
1869 (match_operand:VF_128_256 1 "vector_operand")
1870 (match_operand:VF_128_256 2 "vector_operand"))
1872 (match_operand:VF_128_256 3 "register_operand")
1873 (match_operand:VF_128_256 4 "vector_operand")))
1874 (match_parallel 5 "addsub_vs_parallel"
1875 [(match_operand 6 "const_int_operand")])]))]
1877 && can_create_pseudo_p ()
1878 && ((rtx_equal_p (operands[1], operands[3])
1879 && rtx_equal_p (operands[2], operands[4]))
1880 || (rtx_equal_p (operands[1], operands[4])
1881 && rtx_equal_p (operands[2], operands[3])))"
1883 (vec_merge:VF_128_256
1884 (minus:VF_128_256 (match_dup 3) (match_dup 4))
1885 (plus:VF_128_256 (match_dup 3) (match_dup 4))
1888 int i, nelt = XVECLEN (operands[5], 0);
1889 HOST_WIDE_INT ival = 0;
1891 for (i = 0; i < nelt; i++)
1892 if (INTVAL (XVECEXP (operands[5], 0, i)) >= GET_MODE_NUNITS (<MODE>mode))
1893 ival |= HOST_WIDE_INT_1 << i;
1895 operands[5] = GEN_INT (ival);
1898 (define_insn "avx_h<plusminus_insn>v4df3"
1899 [(set (match_operand:V4DF 0 "register_operand" "=x")
1904 (match_operand:V4DF 1 "register_operand" "x")
1905 (parallel [(const_int 0)]))
1906 (vec_select:DF (match_dup 1) (parallel [(const_int 1)])))
1909 (match_operand:V4DF 2 "nonimmediate_operand" "xm")
1910 (parallel [(const_int 0)]))
1911 (vec_select:DF (match_dup 2) (parallel [(const_int 1)]))))
1914 (vec_select:DF (match_dup 1) (parallel [(const_int 2)]))
1915 (vec_select:DF (match_dup 1) (parallel [(const_int 3)])))
1917 (vec_select:DF (match_dup 2) (parallel [(const_int 2)]))
1918 (vec_select:DF (match_dup 2) (parallel [(const_int 3)]))))))]
1920 "vh<plusminus_mnemonic>pd\t{%2, %1, %0|%0, %1, %2}"
1921 [(set_attr "type" "sseadd")
1922 (set_attr "prefix" "vex")
1923 (set_attr "mode" "V4DF")])
1925 (define_expand "sse3_haddv2df3"
1926 [(set (match_operand:V2DF 0 "register_operand")
1930 (match_operand:V2DF 1 "register_operand")
1931 (parallel [(const_int 0)]))
1932 (vec_select:DF (match_dup 1) (parallel [(const_int 1)])))
1935 (match_operand:V2DF 2 "vector_operand")
1936 (parallel [(const_int 0)]))
1937 (vec_select:DF (match_dup 2) (parallel [(const_int 1)])))))]
1940 (define_insn "*sse3_haddv2df3"
1941 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
1945 (match_operand:V2DF 1 "register_operand" "0,x")
1946 (parallel [(match_operand:SI 3 "const_0_to_1_operand")]))
1949 (parallel [(match_operand:SI 4 "const_0_to_1_operand")])))
1952 (match_operand:V2DF 2 "vector_operand" "xBm,xm")
1953 (parallel [(match_operand:SI 5 "const_0_to_1_operand")]))
1956 (parallel [(match_operand:SI 6 "const_0_to_1_operand")])))))]
1958 && INTVAL (operands[3]) != INTVAL (operands[4])
1959 && INTVAL (operands[5]) != INTVAL (operands[6])"
1961 haddpd\t{%2, %0|%0, %2}
1962 vhaddpd\t{%2, %1, %0|%0, %1, %2}"
1963 [(set_attr "isa" "noavx,avx")
1964 (set_attr "type" "sseadd")
1965 (set_attr "prefix" "orig,vex")
1966 (set_attr "mode" "V2DF")])
1968 (define_insn "sse3_hsubv2df3"
1969 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
1973 (match_operand:V2DF 1 "register_operand" "0,x")
1974 (parallel [(const_int 0)]))
1975 (vec_select:DF (match_dup 1) (parallel [(const_int 1)])))
1978 (match_operand:V2DF 2 "vector_operand" "xBm,xm")
1979 (parallel [(const_int 0)]))
1980 (vec_select:DF (match_dup 2) (parallel [(const_int 1)])))))]
1983 hsubpd\t{%2, %0|%0, %2}
1984 vhsubpd\t{%2, %1, %0|%0, %1, %2}"
1985 [(set_attr "isa" "noavx,avx")
1986 (set_attr "type" "sseadd")
1987 (set_attr "prefix" "orig,vex")
1988 (set_attr "mode" "V2DF")])
1990 (define_insn "*sse3_haddv2df3_low"
1991 [(set (match_operand:DF 0 "register_operand" "=x,x")
1994 (match_operand:V2DF 1 "register_operand" "0,x")
1995 (parallel [(match_operand:SI 2 "const_0_to_1_operand")]))
1998 (parallel [(match_operand:SI 3 "const_0_to_1_operand")]))))]
2000 && INTVAL (operands[2]) != INTVAL (operands[3])"
2002 haddpd\t{%0, %0|%0, %0}
2003 vhaddpd\t{%1, %1, %0|%0, %1, %1}"
2004 [(set_attr "isa" "noavx,avx")
2005 (set_attr "type" "sseadd1")
2006 (set_attr "prefix" "orig,vex")
2007 (set_attr "mode" "V2DF")])
2009 (define_insn "*sse3_hsubv2df3_low"
2010 [(set (match_operand:DF 0 "register_operand" "=x,x")
2013 (match_operand:V2DF 1 "register_operand" "0,x")
2014 (parallel [(const_int 0)]))
2017 (parallel [(const_int 1)]))))]
2020 hsubpd\t{%0, %0|%0, %0}
2021 vhsubpd\t{%1, %1, %0|%0, %1, %1}"
2022 [(set_attr "isa" "noavx,avx")
2023 (set_attr "type" "sseadd1")
2024 (set_attr "prefix" "orig,vex")
2025 (set_attr "mode" "V2DF")])
2027 (define_insn "avx_h<plusminus_insn>v8sf3"
2028 [(set (match_operand:V8SF 0 "register_operand" "=x")
2034 (match_operand:V8SF 1 "register_operand" "x")
2035 (parallel [(const_int 0)]))
2036 (vec_select:SF (match_dup 1) (parallel [(const_int 1)])))
2038 (vec_select:SF (match_dup 1) (parallel [(const_int 2)]))
2039 (vec_select:SF (match_dup 1) (parallel [(const_int 3)]))))
2043 (match_operand:V8SF 2 "nonimmediate_operand" "xm")
2044 (parallel [(const_int 0)]))
2045 (vec_select:SF (match_dup 2) (parallel [(const_int 1)])))
2047 (vec_select:SF (match_dup 2) (parallel [(const_int 2)]))
2048 (vec_select:SF (match_dup 2) (parallel [(const_int 3)])))))
2052 (vec_select:SF (match_dup 1) (parallel [(const_int 4)]))
2053 (vec_select:SF (match_dup 1) (parallel [(const_int 5)])))
2055 (vec_select:SF (match_dup 1) (parallel [(const_int 6)]))
2056 (vec_select:SF (match_dup 1) (parallel [(const_int 7)]))))
2059 (vec_select:SF (match_dup 2) (parallel [(const_int 4)]))
2060 (vec_select:SF (match_dup 2) (parallel [(const_int 5)])))
2062 (vec_select:SF (match_dup 2) (parallel [(const_int 6)]))
2063 (vec_select:SF (match_dup 2) (parallel [(const_int 7)])))))))]
2065 "vh<plusminus_mnemonic>ps\t{%2, %1, %0|%0, %1, %2}"
2066 [(set_attr "type" "sseadd")
2067 (set_attr "prefix" "vex")
2068 (set_attr "mode" "V8SF")])
2070 (define_insn "sse3_h<plusminus_insn>v4sf3"
2071 [(set (match_operand:V4SF 0 "register_operand" "=x,x")
2076 (match_operand:V4SF 1 "register_operand" "0,x")
2077 (parallel [(const_int 0)]))
2078 (vec_select:SF (match_dup 1) (parallel [(const_int 1)])))
2080 (vec_select:SF (match_dup 1) (parallel [(const_int 2)]))
2081 (vec_select:SF (match_dup 1) (parallel [(const_int 3)]))))
2085 (match_operand:V4SF 2 "vector_operand" "xBm,xm")
2086 (parallel [(const_int 0)]))
2087 (vec_select:SF (match_dup 2) (parallel [(const_int 1)])))
2089 (vec_select:SF (match_dup 2) (parallel [(const_int 2)]))
2090 (vec_select:SF (match_dup 2) (parallel [(const_int 3)]))))))]
2093 h<plusminus_mnemonic>ps\t{%2, %0|%0, %2}
2094 vh<plusminus_mnemonic>ps\t{%2, %1, %0|%0, %1, %2}"
2095 [(set_attr "isa" "noavx,avx")
2096 (set_attr "type" "sseadd")
2097 (set_attr "atom_unit" "complex")
2098 (set_attr "prefix" "orig,vex")
2099 (set_attr "prefix_rep" "1,*")
2100 (set_attr "mode" "V4SF")])
2102 (define_expand "reduc_plus_scal_v8df"
2103 [(match_operand:DF 0 "register_operand")
2104 (match_operand:V8DF 1 "register_operand")]
2107 rtx tmp = gen_reg_rtx (V8DFmode);
2108 ix86_expand_reduc (gen_addv8df3, tmp, operands[1]);
2109 emit_insn (gen_vec_extractv8df (operands[0], tmp, const0_rtx));
2113 (define_expand "reduc_plus_scal_v4df"
2114 [(match_operand:DF 0 "register_operand")
2115 (match_operand:V4DF 1 "register_operand")]
2118 rtx tmp = gen_reg_rtx (V4DFmode);
2119 rtx tmp2 = gen_reg_rtx (V4DFmode);
2120 rtx vec_res = gen_reg_rtx (V4DFmode);
2121 emit_insn (gen_avx_haddv4df3 (tmp, operands[1], operands[1]));
2122 emit_insn (gen_avx_vperm2f128v4df3 (tmp2, tmp, tmp, GEN_INT (1)));
2123 emit_insn (gen_addv4df3 (vec_res, tmp, tmp2));
2124 emit_insn (gen_vec_extractv4df (operands[0], vec_res, const0_rtx));
2128 (define_expand "reduc_plus_scal_v2df"
2129 [(match_operand:DF 0 "register_operand")
2130 (match_operand:V2DF 1 "register_operand")]
2133 rtx tmp = gen_reg_rtx (V2DFmode);
2134 emit_insn (gen_sse3_haddv2df3 (tmp, operands[1], operands[1]));
2135 emit_insn (gen_vec_extractv2df (operands[0], tmp, const0_rtx));
2139 (define_expand "reduc_plus_scal_v16sf"
2140 [(match_operand:SF 0 "register_operand")
2141 (match_operand:V16SF 1 "register_operand")]
2144 rtx tmp = gen_reg_rtx (V16SFmode);
2145 ix86_expand_reduc (gen_addv16sf3, tmp, operands[1]);
2146 emit_insn (gen_vec_extractv16sf (operands[0], tmp, const0_rtx));
2150 (define_expand "reduc_plus_scal_v8sf"
2151 [(match_operand:SF 0 "register_operand")
2152 (match_operand:V8SF 1 "register_operand")]
2155 rtx tmp = gen_reg_rtx (V8SFmode);
2156 rtx tmp2 = gen_reg_rtx (V8SFmode);
2157 rtx vec_res = gen_reg_rtx (V8SFmode);
2158 emit_insn (gen_avx_haddv8sf3 (tmp, operands[1], operands[1]));
2159 emit_insn (gen_avx_haddv8sf3 (tmp2, tmp, tmp));
2160 emit_insn (gen_avx_vperm2f128v8sf3 (tmp, tmp2, tmp2, GEN_INT (1)));
2161 emit_insn (gen_addv8sf3 (vec_res, tmp, tmp2));
2162 emit_insn (gen_vec_extractv8sf (operands[0], vec_res, const0_rtx));
2166 (define_expand "reduc_plus_scal_v4sf"
2167 [(match_operand:SF 0 "register_operand")
2168 (match_operand:V4SF 1 "register_operand")]
2171 rtx vec_res = gen_reg_rtx (V4SFmode);
2174 rtx tmp = gen_reg_rtx (V4SFmode);
2175 emit_insn (gen_sse3_haddv4sf3 (tmp, operands[1], operands[1]));
2176 emit_insn (gen_sse3_haddv4sf3 (vec_res, tmp, tmp));
2179 ix86_expand_reduc (gen_addv4sf3, vec_res, operands[1]);
2180 emit_insn (gen_vec_extractv4sf (operands[0], vec_res, const0_rtx));
2184 ;; Modes handled by reduc_sm{in,ax}* patterns.
2185 (define_mode_iterator REDUC_SMINMAX_MODE
2186 [(V32QI "TARGET_AVX2") (V16HI "TARGET_AVX2")
2187 (V8SI "TARGET_AVX2") (V4DI "TARGET_AVX2")
2188 (V8SF "TARGET_AVX") (V4DF "TARGET_AVX")
2189 (V4SF "TARGET_SSE") (V64QI "TARGET_AVX512BW")
2190 (V32HI "TARGET_AVX512BW") (V16SI "TARGET_AVX512F")
2191 (V8DI "TARGET_AVX512F") (V16SF "TARGET_AVX512F")
2192 (V8DF "TARGET_AVX512F")])
2194 (define_expand "reduc_<code>_scal_<mode>"
2195 [(smaxmin:REDUC_SMINMAX_MODE
2196 (match_operand:<ssescalarmode> 0 "register_operand")
2197 (match_operand:REDUC_SMINMAX_MODE 1 "register_operand"))]
2200 rtx tmp = gen_reg_rtx (<MODE>mode);
2201 ix86_expand_reduc (gen_<code><mode>3, tmp, operands[1]);
2202 emit_insn (gen_vec_extract<mode> (operands[0], tmp, const0_rtx));
2206 (define_expand "reduc_<code>_scal_<mode>"
2207 [(umaxmin:VI_AVX512BW
2208 (match_operand:<ssescalarmode> 0 "register_operand")
2209 (match_operand:VI_AVX512BW 1 "register_operand"))]
2212 rtx tmp = gen_reg_rtx (<MODE>mode);
2213 ix86_expand_reduc (gen_<code><mode>3, tmp, operands[1]);
2214 emit_insn (gen_vec_extract<mode> (operands[0], tmp, const0_rtx));
2218 (define_expand "reduc_<code>_scal_<mode>"
2220 (match_operand:<ssescalarmode> 0 "register_operand")
2221 (match_operand:VI_256 1 "register_operand"))]
2224 rtx tmp = gen_reg_rtx (<MODE>mode);
2225 ix86_expand_reduc (gen_<code><mode>3, tmp, operands[1]);
2226 emit_insn (gen_vec_extract<mode> (operands[0], tmp, const0_rtx));
2230 (define_expand "reduc_umin_scal_v8hi"
2232 (match_operand:HI 0 "register_operand")
2233 (match_operand:V8HI 1 "register_operand"))]
2236 rtx tmp = gen_reg_rtx (V8HImode);
2237 ix86_expand_reduc (gen_uminv8hi3, tmp, operands[1]);
2238 emit_insn (gen_vec_extractv8hi (operands[0], tmp, const0_rtx));
2242 (define_insn "<mask_codefor>reducep<mode><mask_name>"
2243 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
2245 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "vm")
2246 (match_operand:SI 2 "const_0_to_255_operand")]
2249 "vreduce<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
2250 [(set_attr "type" "sse")
2251 (set_attr "prefix" "evex")
2252 (set_attr "mode" "<MODE>")])
2254 (define_insn "reduces<mode>"
2255 [(set (match_operand:VF_128 0 "register_operand" "=v")
2258 [(match_operand:VF_128 1 "register_operand" "v")
2259 (match_operand:VF_128 2 "nonimmediate_operand" "vm")
2260 (match_operand:SI 3 "const_0_to_255_operand")]
2265 "vreduce<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
2266 [(set_attr "type" "sse")
2267 (set_attr "prefix" "evex")
2268 (set_attr "mode" "<MODE>")])
2270 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2272 ;; Parallel floating point comparisons
2274 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2276 (define_insn "avx_cmp<mode>3"
2277 [(set (match_operand:VF_128_256 0 "register_operand" "=x")
2279 [(match_operand:VF_128_256 1 "register_operand" "x")
2280 (match_operand:VF_128_256 2 "nonimmediate_operand" "xm")
2281 (match_operand:SI 3 "const_0_to_31_operand" "n")]
2284 "vcmp<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
2285 [(set_attr "type" "ssecmp")
2286 (set_attr "length_immediate" "1")
2287 (set_attr "prefix" "vex")
2288 (set_attr "mode" "<MODE>")])
2290 (define_insn "avx_vmcmp<mode>3"
2291 [(set (match_operand:VF_128 0 "register_operand" "=x")
2294 [(match_operand:VF_128 1 "register_operand" "x")
2295 (match_operand:VF_128 2 "nonimmediate_operand" "xm")
2296 (match_operand:SI 3 "const_0_to_31_operand" "n")]
2301 "vcmp<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %3}"
2302 [(set_attr "type" "ssecmp")
2303 (set_attr "length_immediate" "1")
2304 (set_attr "prefix" "vex")
2305 (set_attr "mode" "<ssescalarmode>")])
2307 (define_insn "*<sse>_maskcmp<mode>3_comm"
2308 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x")
2309 (match_operator:VF_128_256 3 "sse_comparison_operator"
2310 [(match_operand:VF_128_256 1 "register_operand" "%0,x")
2311 (match_operand:VF_128_256 2 "vector_operand" "xBm,xm")]))]
2313 && GET_RTX_CLASS (GET_CODE (operands[3])) == RTX_COMM_COMPARE"
2315 cmp%D3<ssemodesuffix>\t{%2, %0|%0, %2}
2316 vcmp%D3<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
2317 [(set_attr "isa" "noavx,avx")
2318 (set_attr "type" "ssecmp")
2319 (set_attr "length_immediate" "1")
2320 (set_attr "prefix" "orig,vex")
2321 (set_attr "mode" "<MODE>")])
2323 (define_insn "<sse>_maskcmp<mode>3"
2324 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x")
2325 (match_operator:VF_128_256 3 "sse_comparison_operator"
2326 [(match_operand:VF_128_256 1 "register_operand" "0,x")
2327 (match_operand:VF_128_256 2 "vector_operand" "xBm,xm")]))]
2330 cmp%D3<ssemodesuffix>\t{%2, %0|%0, %2}
2331 vcmp%D3<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
2332 [(set_attr "isa" "noavx,avx")
2333 (set_attr "type" "ssecmp")
2334 (set_attr "length_immediate" "1")
2335 (set_attr "prefix" "orig,vex")
2336 (set_attr "mode" "<MODE>")])
2338 (define_insn "<sse>_vmmaskcmp<mode>3"
2339 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
2341 (match_operator:VF_128 3 "sse_comparison_operator"
2342 [(match_operand:VF_128 1 "register_operand" "0,x")
2343 (match_operand:VF_128 2 "vector_operand" "xBm,xm")])
2348 cmp%D3<ssescalarmodesuffix>\t{%2, %0|%0, %<iptr>2}
2349 vcmp%D3<ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %<iptr>2}"
2350 [(set_attr "isa" "noavx,avx")
2351 (set_attr "type" "ssecmp")
2352 (set_attr "length_immediate" "1,*")
2353 (set_attr "prefix" "orig,vex")
2354 (set_attr "mode" "<ssescalarmode>")])
2356 (define_mode_attr cmp_imm_predicate
2357 [(V16SF "const_0_to_31_operand") (V8DF "const_0_to_31_operand")
2358 (V16SI "const_0_to_7_operand") (V8DI "const_0_to_7_operand")
2359 (V8SF "const_0_to_31_operand") (V4DF "const_0_to_31_operand")
2360 (V8SI "const_0_to_7_operand") (V4DI "const_0_to_7_operand")
2361 (V4SF "const_0_to_31_operand") (V2DF "const_0_to_31_operand")
2362 (V4SI "const_0_to_7_operand") (V2DI "const_0_to_7_operand")
2363 (V32HI "const_0_to_7_operand") (V64QI "const_0_to_7_operand")
2364 (V16HI "const_0_to_7_operand") (V32QI "const_0_to_7_operand")
2365 (V8HI "const_0_to_7_operand") (V16QI "const_0_to_7_operand")])
2367 (define_insn "<avx512>_cmp<mode>3<mask_scalar_merge_name><round_saeonly_name>"
2368 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2369 (unspec:<avx512fmaskmode>
2370 [(match_operand:V48_AVX512VL 1 "register_operand" "v")
2371 (match_operand:V48_AVX512VL 2 "nonimmediate_operand" "<round_saeonly_constraint>")
2372 (match_operand:SI 3 "<cmp_imm_predicate>" "n")]
2374 "TARGET_AVX512F && <round_saeonly_mode512bit_condition>"
2375 "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}"
2376 [(set_attr "type" "ssecmp")
2377 (set_attr "length_immediate" "1")
2378 (set_attr "prefix" "evex")
2379 (set_attr "mode" "<sseinsnmode>")])
2381 (define_insn "<avx512>_cmp<mode>3<mask_scalar_merge_name>"
2382 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2383 (unspec:<avx512fmaskmode>
2384 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
2385 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")
2386 (match_operand:SI 3 "<cmp_imm_predicate>" "n")]
2389 "vpcmp<ssemodesuffix>\t{%3, %2, %1, %0<mask_scalar_merge_operand4>|%0<mask_scalar_merge_operand4>, %1, %2, %3}"
2390 [(set_attr "type" "ssecmp")
2391 (set_attr "length_immediate" "1")
2392 (set_attr "prefix" "evex")
2393 (set_attr "mode" "<sseinsnmode>")])
2395 (define_insn "<avx512>_ucmp<mode>3<mask_scalar_merge_name>"
2396 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2397 (unspec:<avx512fmaskmode>
2398 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
2399 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")
2400 (match_operand:SI 3 "const_0_to_7_operand" "n")]
2401 UNSPEC_UNSIGNED_PCMP))]
2403 "vpcmpu<ssemodesuffix>\t{%3, %2, %1, %0<mask_scalar_merge_operand4>|%0<mask_scalar_merge_operand4>, %1, %2, %3}"
2404 [(set_attr "type" "ssecmp")
2405 (set_attr "length_immediate" "1")
2406 (set_attr "prefix" "evex")
2407 (set_attr "mode" "<sseinsnmode>")])
2409 (define_insn "<avx512>_ucmp<mode>3<mask_scalar_merge_name>"
2410 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2411 (unspec:<avx512fmaskmode>
2412 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
2413 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")
2414 (match_operand:SI 3 "const_0_to_7_operand" "n")]
2415 UNSPEC_UNSIGNED_PCMP))]
2417 "vpcmpu<ssemodesuffix>\t{%3, %2, %1, %0<mask_scalar_merge_operand4>|%0<mask_scalar_merge_operand4>, %1, %2, %3}"
2418 [(set_attr "type" "ssecmp")
2419 (set_attr "length_immediate" "1")
2420 (set_attr "prefix" "evex")
2421 (set_attr "mode" "<sseinsnmode>")])
2423 (define_insn "avx512f_vmcmp<mode>3<round_saeonly_name>"
2424 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2425 (and:<avx512fmaskmode>
2426 (unspec:<avx512fmaskmode>
2427 [(match_operand:VF_128 1 "register_operand" "v")
2428 (match_operand:VF_128 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
2429 (match_operand:SI 3 "const_0_to_31_operand" "n")]
2433 "vcmp<ssescalarmodesuffix>\t{%3, <round_saeonly_op4>%2, %1, %0|%0, %1, %2<round_saeonly_op4>, %3}"
2434 [(set_attr "type" "ssecmp")
2435 (set_attr "length_immediate" "1")
2436 (set_attr "prefix" "evex")
2437 (set_attr "mode" "<ssescalarmode>")])
2439 (define_insn "avx512f_vmcmp<mode>3_mask<round_saeonly_name>"
2440 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2441 (and:<avx512fmaskmode>
2442 (unspec:<avx512fmaskmode>
2443 [(match_operand:VF_128 1 "register_operand" "v")
2444 (match_operand:VF_128 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
2445 (match_operand:SI 3 "const_0_to_31_operand" "n")]
2447 (and:<avx512fmaskmode>
2448 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")
2451 "vcmp<ssescalarmodesuffix>\t{%3, <round_saeonly_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_saeonly_op5>, %3}"
2452 [(set_attr "type" "ssecmp")
2453 (set_attr "length_immediate" "1")
2454 (set_attr "prefix" "evex")
2455 (set_attr "mode" "<ssescalarmode>")])
2457 (define_insn "avx512f_maskcmp<mode>3"
2458 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
2459 (match_operator:<avx512fmaskmode> 3 "sse_comparison_operator"
2460 [(match_operand:VF 1 "register_operand" "v")
2461 (match_operand:VF 2 "nonimmediate_operand" "vm")]))]
2463 "vcmp%D3<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
2464 [(set_attr "type" "ssecmp")
2465 (set_attr "length_immediate" "1")
2466 (set_attr "prefix" "evex")
2467 (set_attr "mode" "<sseinsnmode>")])
2469 (define_insn "<sse>_comi<round_saeonly_name>"
2470 [(set (reg:CCFP FLAGS_REG)
2473 (match_operand:<ssevecmode> 0 "register_operand" "v")
2474 (parallel [(const_int 0)]))
2476 (match_operand:<ssevecmode> 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
2477 (parallel [(const_int 0)]))))]
2478 "SSE_FLOAT_MODE_P (<MODE>mode)"
2479 "%vcomi<ssemodesuffix>\t{<round_saeonly_op2>%1, %0|%0, %<iptr>1<round_saeonly_op2>}"
2480 [(set_attr "type" "ssecomi")
2481 (set_attr "prefix" "maybe_vex")
2482 (set_attr "prefix_rep" "0")
2483 (set (attr "prefix_data16")
2484 (if_then_else (eq_attr "mode" "DF")
2486 (const_string "0")))
2487 (set_attr "mode" "<MODE>")])
2489 (define_insn "<sse>_ucomi<round_saeonly_name>"
2490 [(set (reg:CCFPU FLAGS_REG)
2493 (match_operand:<ssevecmode> 0 "register_operand" "v")
2494 (parallel [(const_int 0)]))
2496 (match_operand:<ssevecmode> 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
2497 (parallel [(const_int 0)]))))]
2498 "SSE_FLOAT_MODE_P (<MODE>mode)"
2499 "%vucomi<ssemodesuffix>\t{<round_saeonly_op2>%1, %0|%0, %<iptr>1<round_saeonly_op2>}"
2500 [(set_attr "type" "ssecomi")
2501 (set_attr "prefix" "maybe_vex")
2502 (set_attr "prefix_rep" "0")
2503 (set (attr "prefix_data16")
2504 (if_then_else (eq_attr "mode" "DF")
2506 (const_string "0")))
2507 (set_attr "mode" "<MODE>")])
2509 (define_expand "vec_cmp<mode><avx512fmaskmodelower>"
2510 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
2511 (match_operator:<avx512fmaskmode> 1 ""
2512 [(match_operand:V48_AVX512VL 2 "register_operand")
2513 (match_operand:V48_AVX512VL 3 "nonimmediate_operand")]))]
2516 bool ok = ix86_expand_mask_vec_cmp (operands);
2521 (define_expand "vec_cmp<mode><avx512fmaskmodelower>"
2522 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
2523 (match_operator:<avx512fmaskmode> 1 ""
2524 [(match_operand:VI12_AVX512VL 2 "register_operand")
2525 (match_operand:VI12_AVX512VL 3 "nonimmediate_operand")]))]
2528 bool ok = ix86_expand_mask_vec_cmp (operands);
2533 (define_expand "vec_cmp<mode><sseintvecmodelower>"
2534 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2535 (match_operator:<sseintvecmode> 1 ""
2536 [(match_operand:VI_256 2 "register_operand")
2537 (match_operand:VI_256 3 "nonimmediate_operand")]))]
2540 bool ok = ix86_expand_int_vec_cmp (operands);
2545 (define_expand "vec_cmp<mode><sseintvecmodelower>"
2546 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2547 (match_operator:<sseintvecmode> 1 ""
2548 [(match_operand:VI124_128 2 "register_operand")
2549 (match_operand:VI124_128 3 "vector_operand")]))]
2552 bool ok = ix86_expand_int_vec_cmp (operands);
2557 (define_expand "vec_cmpv2div2di"
2558 [(set (match_operand:V2DI 0 "register_operand")
2559 (match_operator:V2DI 1 ""
2560 [(match_operand:V2DI 2 "register_operand")
2561 (match_operand:V2DI 3 "vector_operand")]))]
2564 bool ok = ix86_expand_int_vec_cmp (operands);
2569 (define_expand "vec_cmp<mode><sseintvecmodelower>"
2570 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2571 (match_operator:<sseintvecmode> 1 ""
2572 [(match_operand:VF_256 2 "register_operand")
2573 (match_operand:VF_256 3 "nonimmediate_operand")]))]
2576 bool ok = ix86_expand_fp_vec_cmp (operands);
2581 (define_expand "vec_cmp<mode><sseintvecmodelower>"
2582 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2583 (match_operator:<sseintvecmode> 1 ""
2584 [(match_operand:VF_128 2 "register_operand")
2585 (match_operand:VF_128 3 "vector_operand")]))]
2588 bool ok = ix86_expand_fp_vec_cmp (operands);
2593 (define_expand "vec_cmpu<mode><avx512fmaskmodelower>"
2594 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
2595 (match_operator:<avx512fmaskmode> 1 ""
2596 [(match_operand:VI48_AVX512VL 2 "register_operand")
2597 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand")]))]
2600 bool ok = ix86_expand_mask_vec_cmp (operands);
2605 (define_expand "vec_cmpu<mode><avx512fmaskmodelower>"
2606 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
2607 (match_operator:<avx512fmaskmode> 1 ""
2608 [(match_operand:VI12_AVX512VL 2 "register_operand")
2609 (match_operand:VI12_AVX512VL 3 "nonimmediate_operand")]))]
2612 bool ok = ix86_expand_mask_vec_cmp (operands);
2617 (define_expand "vec_cmpu<mode><sseintvecmodelower>"
2618 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2619 (match_operator:<sseintvecmode> 1 ""
2620 [(match_operand:VI_256 2 "register_operand")
2621 (match_operand:VI_256 3 "nonimmediate_operand")]))]
2624 bool ok = ix86_expand_int_vec_cmp (operands);
2629 (define_expand "vec_cmpu<mode><sseintvecmodelower>"
2630 [(set (match_operand:<sseintvecmode> 0 "register_operand")
2631 (match_operator:<sseintvecmode> 1 ""
2632 [(match_operand:VI124_128 2 "register_operand")
2633 (match_operand:VI124_128 3 "vector_operand")]))]
2636 bool ok = ix86_expand_int_vec_cmp (operands);
2641 (define_expand "vec_cmpuv2div2di"
2642 [(set (match_operand:V2DI 0 "register_operand")
2643 (match_operator:V2DI 1 ""
2644 [(match_operand:V2DI 2 "register_operand")
2645 (match_operand:V2DI 3 "vector_operand")]))]
2648 bool ok = ix86_expand_int_vec_cmp (operands);
2653 (define_expand "vcond<V_512:mode><VF_512:mode>"
2654 [(set (match_operand:V_512 0 "register_operand")
2656 (match_operator 3 ""
2657 [(match_operand:VF_512 4 "nonimmediate_operand")
2658 (match_operand:VF_512 5 "nonimmediate_operand")])
2659 (match_operand:V_512 1 "general_operand")
2660 (match_operand:V_512 2 "general_operand")))]
2662 && (GET_MODE_NUNITS (<V_512:MODE>mode)
2663 == GET_MODE_NUNITS (<VF_512:MODE>mode))"
2665 bool ok = ix86_expand_fp_vcond (operands);
2670 (define_expand "vcond<V_256:mode><VF_256:mode>"
2671 [(set (match_operand:V_256 0 "register_operand")
2673 (match_operator 3 ""
2674 [(match_operand:VF_256 4 "nonimmediate_operand")
2675 (match_operand:VF_256 5 "nonimmediate_operand")])
2676 (match_operand:V_256 1 "general_operand")
2677 (match_operand:V_256 2 "general_operand")))]
2679 && (GET_MODE_NUNITS (<V_256:MODE>mode)
2680 == GET_MODE_NUNITS (<VF_256:MODE>mode))"
2682 bool ok = ix86_expand_fp_vcond (operands);
2687 (define_expand "vcond<V_128:mode><VF_128:mode>"
2688 [(set (match_operand:V_128 0 "register_operand")
2690 (match_operator 3 ""
2691 [(match_operand:VF_128 4 "vector_operand")
2692 (match_operand:VF_128 5 "vector_operand")])
2693 (match_operand:V_128 1 "general_operand")
2694 (match_operand:V_128 2 "general_operand")))]
2696 && (GET_MODE_NUNITS (<V_128:MODE>mode)
2697 == GET_MODE_NUNITS (<VF_128:MODE>mode))"
2699 bool ok = ix86_expand_fp_vcond (operands);
2704 (define_expand "vcond_mask_<mode><avx512fmaskmodelower>"
2705 [(set (match_operand:V48_AVX512VL 0 "register_operand")
2706 (vec_merge:V48_AVX512VL
2707 (match_operand:V48_AVX512VL 1 "nonimmediate_operand")
2708 (match_operand:V48_AVX512VL 2 "vector_move_operand")
2709 (match_operand:<avx512fmaskmode> 3 "register_operand")))]
2712 (define_expand "vcond_mask_<mode><avx512fmaskmodelower>"
2713 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
2714 (vec_merge:VI12_AVX512VL
2715 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand")
2716 (match_operand:VI12_AVX512VL 2 "vector_move_operand")
2717 (match_operand:<avx512fmaskmode> 3 "register_operand")))]
2720 (define_expand "vcond_mask_<mode><sseintvecmodelower>"
2721 [(set (match_operand:VI_256 0 "register_operand")
2723 (match_operand:VI_256 1 "nonimmediate_operand")
2724 (match_operand:VI_256 2 "vector_move_operand")
2725 (match_operand:<sseintvecmode> 3 "register_operand")))]
2728 ix86_expand_sse_movcc (operands[0], operands[3],
2729 operands[1], operands[2]);
2733 (define_expand "vcond_mask_<mode><sseintvecmodelower>"
2734 [(set (match_operand:VI124_128 0 "register_operand")
2735 (vec_merge:VI124_128
2736 (match_operand:VI124_128 1 "vector_operand")
2737 (match_operand:VI124_128 2 "vector_move_operand")
2738 (match_operand:<sseintvecmode> 3 "register_operand")))]
2741 ix86_expand_sse_movcc (operands[0], operands[3],
2742 operands[1], operands[2]);
2746 (define_expand "vcond_mask_v2div2di"
2747 [(set (match_operand:V2DI 0 "register_operand")
2749 (match_operand:V2DI 1 "vector_operand")
2750 (match_operand:V2DI 2 "vector_move_operand")
2751 (match_operand:V2DI 3 "register_operand")))]
2754 ix86_expand_sse_movcc (operands[0], operands[3],
2755 operands[1], operands[2]);
2759 (define_expand "vcond_mask_<mode><sseintvecmodelower>"
2760 [(set (match_operand:VF_256 0 "register_operand")
2762 (match_operand:VF_256 1 "nonimmediate_operand")
2763 (match_operand:VF_256 2 "vector_move_operand")
2764 (match_operand:<sseintvecmode> 3 "register_operand")))]
2767 ix86_expand_sse_movcc (operands[0], operands[3],
2768 operands[1], operands[2]);
2772 (define_expand "vcond_mask_<mode><sseintvecmodelower>"
2773 [(set (match_operand:VF_128 0 "register_operand")
2775 (match_operand:VF_128 1 "vector_operand")
2776 (match_operand:VF_128 2 "vector_move_operand")
2777 (match_operand:<sseintvecmode> 3 "register_operand")))]
2780 ix86_expand_sse_movcc (operands[0], operands[3],
2781 operands[1], operands[2]);
2785 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2787 ;; Parallel floating point logical operations
2789 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2791 (define_insn "<sse>_andnot<mode>3<mask_name>"
2792 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x,v,v")
2795 (match_operand:VF_128_256 1 "register_operand" "0,x,v,v"))
2796 (match_operand:VF_128_256 2 "vector_operand" "xBm,xm,vm,vm")))]
2797 "TARGET_SSE && <mask_avx512vl_condition>"
2799 static char buf[128];
2803 switch (which_alternative)
2806 ops = "andn%s\t{%%2, %%0|%%0, %%2}";
2811 ops = "vandn%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
2817 switch (get_attr_mode (insn))
2825 /* There is no vandnp[sd] in avx512f. Use vpandn[qd]. */
2826 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
2827 ops = "vpandn%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
2830 suffix = "<ssemodesuffix>";
2833 snprintf (buf, sizeof (buf), ops, suffix);
2836 [(set_attr "isa" "noavx,avx,avx512dq,avx512f")
2837 (set_attr "type" "sselog")
2838 (set_attr "prefix" "orig,maybe_vex,evex,evex")
2840 (cond [(and (match_test "<mask_applied>")
2841 (and (eq_attr "alternative" "1")
2842 (match_test "!TARGET_AVX512DQ")))
2843 (const_string "<sseintvecmode2>")
2844 (eq_attr "alternative" "3")
2845 (const_string "<sseintvecmode2>")
2846 (and (match_test "<MODE_SIZE> == 16")
2847 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
2848 (const_string "<ssePSmode>")
2849 (match_test "TARGET_AVX")
2850 (const_string "<MODE>")
2851 (match_test "optimize_function_for_size_p (cfun)")
2852 (const_string "V4SF")
2854 (const_string "<MODE>")))])
2857 (define_insn "<sse>_andnot<mode>3<mask_name>"
2858 [(set (match_operand:VF_512 0 "register_operand" "=v")
2861 (match_operand:VF_512 1 "register_operand" "v"))
2862 (match_operand:VF_512 2 "nonimmediate_operand" "vm")))]
2865 static char buf[128];
2869 suffix = "<ssemodesuffix>";
2872 /* There is no vandnp[sd] in avx512f. Use vpandn[qd]. */
2873 if (!TARGET_AVX512DQ)
2875 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
2879 snprintf (buf, sizeof (buf),
2880 "v%sandn%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}",
2884 [(set_attr "type" "sselog")
2885 (set_attr "prefix" "evex")
2887 (if_then_else (match_test "TARGET_AVX512DQ")
2888 (const_string "<sseinsnmode>")
2889 (const_string "XI")))])
2891 (define_expand "<code><mode>3<mask_name>"
2892 [(set (match_operand:VF_128_256 0 "register_operand")
2893 (any_logic:VF_128_256
2894 (match_operand:VF_128_256 1 "vector_operand")
2895 (match_operand:VF_128_256 2 "vector_operand")))]
2896 "TARGET_SSE && <mask_avx512vl_condition>"
2897 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
2899 (define_expand "<code><mode>3<mask_name>"
2900 [(set (match_operand:VF_512 0 "register_operand")
2902 (match_operand:VF_512 1 "nonimmediate_operand")
2903 (match_operand:VF_512 2 "nonimmediate_operand")))]
2905 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
2907 (define_insn "*<code><mode>3<mask_name>"
2908 [(set (match_operand:VF_128_256 0 "register_operand" "=x,x,v,v")
2909 (any_logic:VF_128_256
2910 (match_operand:VF_128_256 1 "vector_operand" "%0,x,v,v")
2911 (match_operand:VF_128_256 2 "vector_operand" "xBm,xm,vm,vm")))]
2912 "TARGET_SSE && <mask_avx512vl_condition>
2913 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
2915 static char buf[128];
2919 switch (which_alternative)
2922 ops = "<logic>%s\t{%%2, %%0|%%0, %%2}";
2927 ops = "v<logic>%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
2933 switch (get_attr_mode (insn))
2941 /* There is no v<logic>p[sd] in avx512f. Use vp<logic>[qd]. */
2942 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
2943 ops = "vp<logic>%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
2946 suffix = "<ssemodesuffix>";
2949 snprintf (buf, sizeof (buf), ops, suffix);
2952 [(set_attr "isa" "noavx,avx,avx512dq,avx512f")
2953 (set_attr "type" "sselog")
2954 (set_attr "prefix" "orig,maybe_evex,evex,evex")
2956 (cond [(and (match_test "<mask_applied>")
2957 (and (eq_attr "alternative" "1")
2958 (match_test "!TARGET_AVX512DQ")))
2959 (const_string "<sseintvecmode2>")
2960 (eq_attr "alternative" "3")
2961 (const_string "<sseintvecmode2>")
2962 (and (match_test "<MODE_SIZE> == 16")
2963 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
2964 (const_string "<ssePSmode>")
2965 (match_test "TARGET_AVX")
2966 (const_string "<MODE>")
2967 (match_test "optimize_function_for_size_p (cfun)")
2968 (const_string "V4SF")
2970 (const_string "<MODE>")))])
2972 (define_insn "*<code><mode>3<mask_name>"
2973 [(set (match_operand:VF_512 0 "register_operand" "=v")
2975 (match_operand:VF_512 1 "nonimmediate_operand" "%v")
2976 (match_operand:VF_512 2 "nonimmediate_operand" "vm")))]
2977 "TARGET_AVX512F && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
2979 static char buf[128];
2983 suffix = "<ssemodesuffix>";
2986 /* There is no v<logic>p[sd] in avx512f. Use vp<logic>[dq]. */
2987 if (!TARGET_AVX512DQ)
2989 suffix = GET_MODE_INNER (<MODE>mode) == DFmode ? "q" : "d";
2993 snprintf (buf, sizeof (buf),
2994 "v%s<logic>%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}",
2998 [(set_attr "type" "sselog")
2999 (set_attr "prefix" "evex")
3001 (if_then_else (match_test "TARGET_AVX512DQ")
3002 (const_string "<sseinsnmode>")
3003 (const_string "XI")))])
3005 (define_expand "copysign<mode>3"
3008 (not:VF (match_dup 3))
3009 (match_operand:VF 1 "vector_operand")))
3011 (and:VF (match_dup 3)
3012 (match_operand:VF 2 "vector_operand")))
3013 (set (match_operand:VF 0 "register_operand")
3014 (ior:VF (match_dup 4) (match_dup 5)))]
3017 operands[3] = ix86_build_signbit_mask (<MODE>mode, 1, 0);
3019 operands[4] = gen_reg_rtx (<MODE>mode);
3020 operands[5] = gen_reg_rtx (<MODE>mode);
3023 ;; Also define scalar versions. These are used for abs, neg, and
3024 ;; conditional move. Using subregs into vector modes causes register
3025 ;; allocation lossage. These patterns do not allow memory operands
3026 ;; because the native instructions read the full 128-bits.
3028 (define_insn "*andnot<mode>3"
3029 [(set (match_operand:MODEF 0 "register_operand" "=x,x,v,v")
3032 (match_operand:MODEF 1 "register_operand" "0,x,v,v"))
3033 (match_operand:MODEF 2 "register_operand" "x,x,v,v")))]
3034 "SSE_FLOAT_MODE_P (<MODE>mode)"
3036 static char buf[128];
3039 = (get_attr_mode (insn) == MODE_V4SF) ? "ps" : "<ssevecmodesuffix>";
3041 switch (which_alternative)
3044 ops = "andn%s\t{%%2, %%0|%%0, %%2}";
3047 ops = "vandn%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3050 if (TARGET_AVX512DQ)
3051 ops = "vandn%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3054 suffix = <MODE>mode == DFmode ? "q" : "d";
3055 ops = "vpandn%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3059 if (TARGET_AVX512DQ)
3060 ops = "vandn%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3063 suffix = <MODE>mode == DFmode ? "q" : "d";
3064 ops = "vpandn%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3071 snprintf (buf, sizeof (buf), ops, suffix);
3074 [(set_attr "isa" "noavx,avx,avx512vl,avx512f")
3075 (set_attr "type" "sselog")
3076 (set_attr "prefix" "orig,vex,evex,evex")
3078 (cond [(eq_attr "alternative" "2")
3079 (if_then_else (match_test "TARGET_AVX512DQ")
3080 (const_string "<ssevecmode>")
3081 (const_string "TI"))
3082 (eq_attr "alternative" "3")
3083 (if_then_else (match_test "TARGET_AVX512DQ")
3084 (const_string "<avx512fvecmode>")
3085 (const_string "XI"))
3086 (and (match_test "<MODE_SIZE> == 16")
3087 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
3088 (const_string "V4SF")
3089 (match_test "TARGET_AVX")
3090 (const_string "<ssevecmode>")
3091 (match_test "optimize_function_for_size_p (cfun)")
3092 (const_string "V4SF")
3094 (const_string "<ssevecmode>")))])
3096 (define_insn "*andnottf3"
3097 [(set (match_operand:TF 0 "register_operand" "=x,x,v,v")
3099 (not:TF (match_operand:TF 1 "register_operand" "0,x,v,v"))
3100 (match_operand:TF 2 "vector_operand" "xBm,xm,vm,v")))]
3103 static char buf[128];
3106 = (which_alternative >= 2 ? "pandnq"
3107 : get_attr_mode (insn) == MODE_V4SF ? "andnps" : "pandn");
3109 switch (which_alternative)
3112 ops = "%s\t{%%2, %%0|%%0, %%2}";
3116 ops = "v%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3119 ops = "v%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3125 snprintf (buf, sizeof (buf), ops, tmp);
3128 [(set_attr "isa" "noavx,avx,avx512vl,avx512f")
3129 (set_attr "type" "sselog")
3130 (set (attr "prefix_data16")
3132 (and (eq_attr "alternative" "0")
3133 (eq_attr "mode" "TI"))
3135 (const_string "*")))
3136 (set_attr "prefix" "orig,vex,evex,evex")
3138 (cond [(eq_attr "alternative" "2")
3140 (eq_attr "alternative" "3")
3142 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
3143 (const_string "V4SF")
3144 (match_test "TARGET_AVX")
3146 (ior (not (match_test "TARGET_SSE2"))
3147 (match_test "optimize_function_for_size_p (cfun)"))
3148 (const_string "V4SF")
3150 (const_string "TI")))])
3152 (define_insn "*<code><mode>3"
3153 [(set (match_operand:MODEF 0 "register_operand" "=x,x,v,v")
3155 (match_operand:MODEF 1 "register_operand" "%0,x,v,v")
3156 (match_operand:MODEF 2 "register_operand" "x,x,v,v")))]
3157 "SSE_FLOAT_MODE_P (<MODE>mode)"
3159 static char buf[128];
3162 = (get_attr_mode (insn) == MODE_V4SF) ? "ps" : "<ssevecmodesuffix>";
3164 switch (which_alternative)
3167 ops = "<logic>%s\t{%%2, %%0|%%0, %%2}";
3170 if (!TARGET_AVX512DQ)
3172 suffix = <MODE>mode == DFmode ? "q" : "d";
3173 ops = "vp<logic>%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3178 ops = "v<logic>%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3181 if (TARGET_AVX512DQ)
3182 ops = "v<logic>%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3185 suffix = <MODE>mode == DFmode ? "q" : "d";
3186 ops = "vp<logic>%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3193 snprintf (buf, sizeof (buf), ops, suffix);
3196 [(set_attr "isa" "noavx,avx,avx512vl,avx512f")
3197 (set_attr "type" "sselog")
3198 (set_attr "prefix" "orig,vex,evex,evex")
3200 (cond [(eq_attr "alternative" "2")
3201 (if_then_else (match_test "TARGET_AVX512DQ")
3202 (const_string "<ssevecmode>")
3203 (const_string "TI"))
3204 (eq_attr "alternative" "3")
3205 (if_then_else (match_test "TARGET_AVX512DQ")
3206 (const_string "<avx512fvecmode>")
3207 (const_string "XI"))
3208 (and (match_test "<MODE_SIZE> == 16")
3209 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
3210 (const_string "V4SF")
3211 (match_test "TARGET_AVX")
3212 (const_string "<ssevecmode>")
3213 (match_test "optimize_function_for_size_p (cfun)")
3214 (const_string "V4SF")
3216 (const_string "<ssevecmode>")))])
3218 (define_expand "<code>tf3"
3219 [(set (match_operand:TF 0 "register_operand")
3221 (match_operand:TF 1 "vector_operand")
3222 (match_operand:TF 2 "vector_operand")))]
3224 "ix86_fixup_binary_operands_no_copy (<CODE>, TFmode, operands);")
3226 (define_insn "*<code>tf3"
3227 [(set (match_operand:TF 0 "register_operand" "=x,x,v,v")
3229 (match_operand:TF 1 "vector_operand" "%0,x,v,v")
3230 (match_operand:TF 2 "vector_operand" "xBm,xm,vm,v")))]
3232 && ix86_binary_operator_ok (<CODE>, TFmode, operands)"
3234 static char buf[128];
3237 = (which_alternative >= 2 ? "p<logic>q"
3238 : get_attr_mode (insn) == MODE_V4SF ? "<logic>ps" : "p<logic>");
3240 switch (which_alternative)
3243 ops = "%s\t{%%2, %%0|%%0, %%2}";
3247 ops = "v%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
3250 ops = "v%s\t{%%g2, %%g1, %%g0|%%g0, %%g1, %%g2}";
3256 snprintf (buf, sizeof (buf), ops, tmp);
3259 [(set_attr "isa" "noavx,avx,avx512vl,avx512f")
3260 (set_attr "type" "sselog")
3261 (set (attr "prefix_data16")
3263 (and (eq_attr "alternative" "0")
3264 (eq_attr "mode" "TI"))
3266 (const_string "*")))
3267 (set_attr "prefix" "orig,vex,evex,evex")
3269 (cond [(eq_attr "alternative" "2")
3271 (eq_attr "alternative" "3")
3273 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
3274 (const_string "V4SF")
3275 (match_test "TARGET_AVX")
3277 (ior (not (match_test "TARGET_SSE2"))
3278 (match_test "optimize_function_for_size_p (cfun)"))
3279 (const_string "V4SF")
3281 (const_string "TI")))])
3283 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3285 ;; FMA floating point multiply/accumulate instructions. These include
3286 ;; scalar versions of the instructions as well as vector versions.
3288 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3290 ;; The standard names for scalar FMA are only available with SSE math enabled.
3291 ;; CPUID bit AVX512F enables evex encoded scalar and 512-bit fma. It doesn't
3292 ;; care about FMA bit, so we enable fma for TARGET_AVX512F even when TARGET_FMA
3293 ;; and TARGET_FMA4 are both false.
3294 ;; TODO: In theory AVX512F does not automatically imply FMA, and without FMA
3295 ;; one must force the EVEX encoding of the fma insns. Ideally we'd improve
3296 ;; GAS to allow proper prefix selection. However, for the moment all hardware
3297 ;; that supports AVX512F also supports FMA so we can ignore this for now.
3298 (define_mode_iterator FMAMODEM
3299 [(SF "TARGET_SSE_MATH && (TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F)")
3300 (DF "TARGET_SSE_MATH && (TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F)")
3301 (V4SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3302 (V2DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3303 (V8SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3304 (V4DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3305 (V16SF "TARGET_AVX512F")
3306 (V8DF "TARGET_AVX512F")])
3308 (define_expand "fma<mode>4"
3309 [(set (match_operand:FMAMODEM 0 "register_operand")
3311 (match_operand:FMAMODEM 1 "nonimmediate_operand")
3312 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3313 (match_operand:FMAMODEM 3 "nonimmediate_operand")))])
3315 (define_expand "fms<mode>4"
3316 [(set (match_operand:FMAMODEM 0 "register_operand")
3318 (match_operand:FMAMODEM 1 "nonimmediate_operand")
3319 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3320 (neg:FMAMODEM (match_operand:FMAMODEM 3 "nonimmediate_operand"))))])
3322 (define_expand "fnma<mode>4"
3323 [(set (match_operand:FMAMODEM 0 "register_operand")
3325 (neg:FMAMODEM (match_operand:FMAMODEM 1 "nonimmediate_operand"))
3326 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3327 (match_operand:FMAMODEM 3 "nonimmediate_operand")))])
3329 (define_expand "fnms<mode>4"
3330 [(set (match_operand:FMAMODEM 0 "register_operand")
3332 (neg:FMAMODEM (match_operand:FMAMODEM 1 "nonimmediate_operand"))
3333 (match_operand:FMAMODEM 2 "nonimmediate_operand")
3334 (neg:FMAMODEM (match_operand:FMAMODEM 3 "nonimmediate_operand"))))])
3336 ;; The builtins for intrinsics are not constrained by SSE math enabled.
3337 (define_mode_iterator FMAMODE_AVX512
3338 [(SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F")
3339 (DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F")
3340 (V4SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3341 (V2DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3342 (V8SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3343 (V4DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL")
3344 (V16SF "TARGET_AVX512F")
3345 (V8DF "TARGET_AVX512F")])
3347 (define_mode_iterator FMAMODE
3348 [SF DF V4SF V2DF V8SF V4DF])
3350 (define_expand "fma4i_fmadd_<mode>"
3351 [(set (match_operand:FMAMODE_AVX512 0 "register_operand")
3353 (match_operand:FMAMODE_AVX512 1 "nonimmediate_operand")
3354 (match_operand:FMAMODE_AVX512 2 "nonimmediate_operand")
3355 (match_operand:FMAMODE_AVX512 3 "nonimmediate_operand")))])
3357 (define_expand "<avx512>_fmadd_<mode>_maskz<round_expand_name>"
3358 [(match_operand:VF_AVX512VL 0 "register_operand")
3359 (match_operand:VF_AVX512VL 1 "<round_expand_nimm_predicate>")
3360 (match_operand:VF_AVX512VL 2 "<round_expand_nimm_predicate>")
3361 (match_operand:VF_AVX512VL 3 "<round_expand_nimm_predicate>")
3362 (match_operand:<avx512fmaskmode> 4 "register_operand")]
3363 "TARGET_AVX512F && <round_mode512bit_condition>"
3365 emit_insn (gen_fma_fmadd_<mode>_maskz_1<round_expand_name> (
3366 operands[0], operands[1], operands[2], operands[3],
3367 CONST0_RTX (<MODE>mode), operands[4]<round_expand_operand>));
3371 (define_insn "*fma_fmadd_<mode>"
3372 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
3374 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x")
3375 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
3376 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x")))]
3377 "TARGET_FMA || TARGET_FMA4"
3379 vfmadd132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
3380 vfmadd213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
3381 vfmadd231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
3382 vfmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3383 vfmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3384 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3385 (set_attr "type" "ssemuladd")
3386 (set_attr "mode" "<MODE>")])
3388 ;; Suppose AVX-512F as baseline
3389 (define_mode_iterator VF_SF_AVX512VL
3390 [SF V16SF (V8SF "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL")
3391 DF V8DF (V4DF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")])
3393 (define_insn "<sd_mask_codefor>fma_fmadd_<mode><sd_maskz_name><round_name>"
3394 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3396 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
3397 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3398 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0")))]
3399 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3401 vfmadd132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3402 vfmadd213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3403 vfmadd231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
3404 [(set_attr "type" "ssemuladd")
3405 (set_attr "mode" "<MODE>")])
3407 (define_insn "<avx512>_fmadd_<mode>_mask<round_name>"
3408 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
3409 (vec_merge:VF_AVX512VL
3411 (match_operand:VF_AVX512VL 1 "register_operand" "0,0")
3412 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
3413 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>"))
3415 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
3416 "TARGET_AVX512F && <round_mode512bit_condition>"
3418 vfmadd132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
3419 vfmadd213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
3420 [(set_attr "isa" "fma_avx512f,fma_avx512f")
3421 (set_attr "type" "ssemuladd")
3422 (set_attr "mode" "<MODE>")])
3424 (define_insn "<avx512>_fmadd_<mode>_mask3<round_name>"
3425 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
3426 (vec_merge:VF_AVX512VL
3428 (match_operand:VF_AVX512VL 1 "register_operand" "v")
3429 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
3430 (match_operand:VF_AVX512VL 3 "register_operand" "0"))
3432 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
3434 "vfmadd231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
3435 [(set_attr "isa" "fma_avx512f")
3436 (set_attr "type" "ssemuladd")
3437 (set_attr "mode" "<MODE>")])
3439 (define_insn "*fma_fmsub_<mode>"
3440 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
3442 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x")
3443 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
3445 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x"))))]
3446 "TARGET_FMA || TARGET_FMA4"
3448 vfmsub132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
3449 vfmsub213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
3450 vfmsub231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
3451 vfmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3452 vfmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3453 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3454 (set_attr "type" "ssemuladd")
3455 (set_attr "mode" "<MODE>")])
3457 (define_insn "<sd_mask_codefor>fma_fmsub_<mode><sd_maskz_name><round_name>"
3458 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3460 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
3461 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3463 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0"))))]
3464 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3466 vfmsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3467 vfmsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3468 vfmsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
3469 [(set_attr "type" "ssemuladd")
3470 (set_attr "mode" "<MODE>")])
3472 (define_insn "<avx512>_fmsub_<mode>_mask<round_name>"
3473 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
3474 (vec_merge:VF_AVX512VL
3476 (match_operand:VF_AVX512VL 1 "register_operand" "0,0")
3477 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
3479 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>")))
3481 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
3484 vfmsub132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
3485 vfmsub213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
3486 [(set_attr "isa" "fma_avx512f,fma_avx512f")
3487 (set_attr "type" "ssemuladd")
3488 (set_attr "mode" "<MODE>")])
3490 (define_insn "<avx512>_fmsub_<mode>_mask3<round_name>"
3491 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
3492 (vec_merge:VF_AVX512VL
3494 (match_operand:VF_AVX512VL 1 "register_operand" "v")
3495 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
3497 (match_operand:VF_AVX512VL 3 "register_operand" "0")))
3499 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
3500 "TARGET_AVX512F && <round_mode512bit_condition>"
3501 "vfmsub231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
3502 [(set_attr "isa" "fma_avx512f")
3503 (set_attr "type" "ssemuladd")
3504 (set_attr "mode" "<MODE>")])
3506 (define_insn "*fma_fnmadd_<mode>"
3507 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
3510 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x"))
3511 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
3512 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x")))]
3513 "TARGET_FMA || TARGET_FMA4"
3515 vfnmadd132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
3516 vfnmadd213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
3517 vfnmadd231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
3518 vfnmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3519 vfnmadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3520 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3521 (set_attr "type" "ssemuladd")
3522 (set_attr "mode" "<MODE>")])
3524 (define_insn "<sd_mask_codefor>fma_fnmadd_<mode><sd_maskz_name><round_name>"
3525 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3528 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v"))
3529 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3530 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0")))]
3531 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3533 vfnmadd132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3534 vfnmadd213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3535 vfnmadd231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
3536 [(set_attr "type" "ssemuladd")
3537 (set_attr "mode" "<MODE>")])
3539 (define_insn "<avx512>_fnmadd_<mode>_mask<round_name>"
3540 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
3541 (vec_merge:VF_AVX512VL
3544 (match_operand:VF_AVX512VL 1 "register_operand" "0,0"))
3545 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
3546 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>"))
3548 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
3549 "TARGET_AVX512F && <round_mode512bit_condition>"
3551 vfnmadd132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
3552 vfnmadd213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
3553 [(set_attr "isa" "fma_avx512f,fma_avx512f")
3554 (set_attr "type" "ssemuladd")
3555 (set_attr "mode" "<MODE>")])
3557 (define_insn "<avx512>_fnmadd_<mode>_mask3<round_name>"
3558 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
3559 (vec_merge:VF_AVX512VL
3562 (match_operand:VF_AVX512VL 1 "register_operand" "v"))
3563 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
3564 (match_operand:VF_AVX512VL 3 "register_operand" "0"))
3566 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
3567 "TARGET_AVX512F && <round_mode512bit_condition>"
3568 "vfnmadd231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
3569 [(set_attr "isa" "fma_avx512f")
3570 (set_attr "type" "ssemuladd")
3571 (set_attr "mode" "<MODE>")])
3573 (define_insn "*fma_fnmsub_<mode>"
3574 [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x")
3577 (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x"))
3578 (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m")
3580 (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x"))))]
3581 "TARGET_FMA || TARGET_FMA4"
3583 vfnmsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3584 vfnmsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3585 vfnmsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}
3586 vfnmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3587 vfnmsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3588 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3589 (set_attr "type" "ssemuladd")
3590 (set_attr "mode" "<MODE>")])
3592 (define_insn "<sd_mask_codefor>fma_fnmsub_<mode><sd_maskz_name><round_name>"
3593 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3596 (match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v"))
3597 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3599 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0"))))]
3600 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3602 vfnmsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3603 vfnmsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3604 vfnmsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
3605 [(set_attr "type" "ssemuladd")
3606 (set_attr "mode" "<MODE>")])
3608 (define_insn "<avx512>_fnmsub_<mode>_mask<round_name>"
3609 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
3610 (vec_merge:VF_AVX512VL
3613 (match_operand:VF_AVX512VL 1 "register_operand" "0,0"))
3614 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
3616 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>")))
3618 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
3619 "TARGET_AVX512F && <round_mode512bit_condition>"
3621 vfnmsub132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
3622 vfnmsub213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
3623 [(set_attr "isa" "fma_avx512f,fma_avx512f")
3624 (set_attr "type" "ssemuladd")
3625 (set_attr "mode" "<MODE>")])
3627 (define_insn "<avx512>_fnmsub_<mode>_mask3<round_name>"
3628 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
3629 (vec_merge:VF_AVX512VL
3632 (match_operand:VF_AVX512VL 1 "register_operand" "v"))
3633 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
3635 (match_operand:VF_AVX512VL 3 "register_operand" "0")))
3637 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
3639 "vfnmsub231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
3640 [(set_attr "isa" "fma_avx512f")
3641 (set_attr "type" "ssemuladd")
3642 (set_attr "mode" "<MODE>")])
3644 ;; FMA parallel floating point multiply addsub and subadd operations.
3646 ;; It would be possible to represent these without the UNSPEC as
3649 ;; (fma op1 op2 op3)
3650 ;; (fma op1 op2 (neg op3))
3653 ;; But this doesn't seem useful in practice.
3655 (define_expand "fmaddsub_<mode>"
3656 [(set (match_operand:VF 0 "register_operand")
3658 [(match_operand:VF 1 "nonimmediate_operand")
3659 (match_operand:VF 2 "nonimmediate_operand")
3660 (match_operand:VF 3 "nonimmediate_operand")]
3662 "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F")
3664 (define_expand "<avx512>_fmaddsub_<mode>_maskz<round_expand_name>"
3665 [(match_operand:VF_AVX512VL 0 "register_operand")
3666 (match_operand:VF_AVX512VL 1 "<round_expand_nimm_predicate>")
3667 (match_operand:VF_AVX512VL 2 "<round_expand_nimm_predicate>")
3668 (match_operand:VF_AVX512VL 3 "<round_expand_nimm_predicate>")
3669 (match_operand:<avx512fmaskmode> 4 "register_operand")]
3672 emit_insn (gen_fma_fmaddsub_<mode>_maskz_1<round_expand_name> (
3673 operands[0], operands[1], operands[2], operands[3],
3674 CONST0_RTX (<MODE>mode), operands[4]<round_expand_operand>));
3678 (define_insn "*fma_fmaddsub_<mode>"
3679 [(set (match_operand:VF_128_256 0 "register_operand" "=v,v,v,x,x")
3681 [(match_operand:VF_128_256 1 "nonimmediate_operand" "%0,0,v,x,x")
3682 (match_operand:VF_128_256 2 "nonimmediate_operand" "vm,v,vm,x,m")
3683 (match_operand:VF_128_256 3 "nonimmediate_operand" "v,vm,0,xm,x")]
3685 "TARGET_FMA || TARGET_FMA4"
3687 vfmaddsub132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
3688 vfmaddsub213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
3689 vfmaddsub231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
3690 vfmaddsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3691 vfmaddsub<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3692 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3693 (set_attr "type" "ssemuladd")
3694 (set_attr "mode" "<MODE>")])
3696 (define_insn "<sd_mask_codefor>fma_fmaddsub_<mode><sd_maskz_name><round_name>"
3697 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3698 (unspec:VF_SF_AVX512VL
3699 [(match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
3700 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3701 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0")]
3703 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3705 vfmaddsub132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3706 vfmaddsub213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3707 vfmaddsub231<ssemodesuffix>\t{<round_sd_mask_op4>%2, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %2<round_sd_mask_op4>}"
3708 [(set_attr "type" "ssemuladd")
3709 (set_attr "mode" "<MODE>")])
3711 (define_insn "<avx512>_fmaddsub_<mode>_mask<round_name>"
3712 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v")
3713 (vec_merge:VF_AVX512VL
3715 [(match_operand:VF_AVX512VL 1 "register_operand" "0,0")
3716 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>,v")
3717 (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,<round_constraint>")]
3720 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
3723 vfmaddsub132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
3724 vfmaddsub213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
3725 [(set_attr "isa" "fma_avx512f,fma_avx512f")
3726 (set_attr "type" "ssemuladd")
3727 (set_attr "mode" "<MODE>")])
3729 (define_insn "<avx512>_fmaddsub_<mode>_mask3<round_name>"
3730 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
3731 (vec_merge:VF_AVX512VL
3733 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
3734 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
3735 (match_operand:VF_AVX512VL 3 "register_operand" "0")]
3738 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
3740 "vfmaddsub231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
3741 [(set_attr "isa" "fma_avx512f")
3742 (set_attr "type" "ssemuladd")
3743 (set_attr "mode" "<MODE>")])
3745 (define_insn "*fma_fmsubadd_<mode>"
3746 [(set (match_operand:VF_128_256 0 "register_operand" "=v,v,v,x,x")
3748 [(match_operand:VF_128_256 1 "nonimmediate_operand" "%0,0,v,x,x")
3749 (match_operand:VF_128_256 2 "nonimmediate_operand" "vm,v,vm,x,m")
3751 (match_operand:VF_128_256 3 "nonimmediate_operand" "v,vm,0,xm,x"))]
3753 "TARGET_FMA || TARGET_FMA4"
3755 vfmsubadd132<ssemodesuffix>\t{%2, %3, %0|%0, %3, %2}
3756 vfmsubadd213<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
3757 vfmsubadd231<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
3758 vfmsubadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
3759 vfmsubadd<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
3760 [(set_attr "isa" "fma,fma,fma,fma4,fma4")
3761 (set_attr "type" "ssemuladd")
3762 (set_attr "mode" "<MODE>")])
3764 (define_insn "<sd_mask_codefor>fma_fmsubadd_<mode><sd_maskz_name><round_name>"
3765 [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v")
3766 (unspec:VF_SF_AVX512VL
3767 [(match_operand:VF_SF_AVX512VL 1 "<round_nimm_predicate>" "%0,0,v")
3768 (match_operand:VF_SF_AVX512VL 2 "<round_nimm_predicate>" "<round_constraint>,v,<round_constraint>")
3770 (match_operand:VF_SF_AVX512VL 3 "<round_nimm_predicate>" "v,<round_constraint>,0"))]
3772 "TARGET_AVX512F && <sd_mask_mode512bit_condition> && <round_mode512bit_condition>"
3774 vfmsubadd132<ssemodesuffix>\t{<round_sd_mask_op4>%2, %3, %0<sd_mask_op4>|%0<sd_mask_op4>, %3, %2<round_sd_mask_op4>}
3775 vfmsubadd213<ssemodesuffix>\t{<round_sd_mask_op4>%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3<round_sd_mask_op4>}
3776 vfmsubadd231<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>_fmsubadd_<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>"))]
3790 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk,Yk")))]
3793 vfmsubadd132<ssemodesuffix>\t{<round_op5>%2, %3, %0%{%4%}|%0%{%4%}, %3, %2<round_op5>}
3794 vfmsubadd213<ssemodesuffix>\t{<round_op5>%3, %2, %0%{%4%}|%0%{%4%}, %2, %3<round_op5>}"
3795 [(set_attr "isa" "fma_avx512f,fma_avx512f")
3796 (set_attr "type" "ssemuladd")
3797 (set_attr "mode" "<MODE>")])
3799 (define_insn "<avx512>_fmsubadd_<mode>_mask3<round_name>"
3800 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
3801 (vec_merge:VF_AVX512VL
3803 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
3804 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")
3806 (match_operand:VF_AVX512VL 3 "register_operand" "0"))]
3809 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
3811 "vfmsubadd231<ssemodesuffix>\t{<round_op5>%2, %1, %0%{%4%}|%0%{%4%}, %1, %2<round_op5>}"
3812 [(set_attr "isa" "fma_avx512f")
3813 (set_attr "type" "ssemuladd")
3814 (set_attr "mode" "<MODE>")])
3816 ;; FMA3 floating point scalar intrinsics. These merge result with
3817 ;; high-order elements from the destination register.
3819 (define_expand "fmai_vmfmadd_<mode><round_name>"
3820 [(set (match_operand:VF_128 0 "register_operand")
3823 (match_operand:VF_128 1 "<round_nimm_predicate>")
3824 (match_operand:VF_128 2 "<round_nimm_predicate>")
3825 (match_operand:VF_128 3 "<round_nimm_predicate>"))
3830 (define_insn "*fmai_fmadd_<mode>"
3831 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
3834 (match_operand:VF_128 1 "<round_nimm_predicate>" " 0, 0")
3835 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>, v")
3836 (match_operand:VF_128 3 "<round_nimm_predicate>" " v,<round_constraint>"))
3839 "TARGET_FMA || TARGET_AVX512F"
3841 vfmadd132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
3842 vfmadd213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
3843 [(set_attr "type" "ssemuladd")
3844 (set_attr "mode" "<MODE>")])
3846 (define_insn "*fmai_fmsub_<mode>"
3847 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
3850 (match_operand:VF_128 1 "<round_nimm_predicate>" "0,0")
3851 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>,v")
3853 (match_operand:VF_128 3 "<round_nimm_predicate>" " v,<round_constraint>")))
3856 "TARGET_FMA || TARGET_AVX512F"
3858 vfmsub132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
3859 vfmsub213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
3860 [(set_attr "type" "ssemuladd")
3861 (set_attr "mode" "<MODE>")])
3863 (define_insn "*fmai_fnmadd_<mode><round_name>"
3864 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
3868 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>,v"))
3869 (match_operand:VF_128 1 "<round_nimm_predicate>" "0,0")
3870 (match_operand:VF_128 3 "<round_nimm_predicate>" "v,<round_constraint>"))
3873 "TARGET_FMA || TARGET_AVX512F"
3875 vfnmadd132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
3876 vfnmadd213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
3877 [(set_attr "type" "ssemuladd")
3878 (set_attr "mode" "<MODE>")])
3880 (define_insn "*fmai_fnmsub_<mode><round_name>"
3881 [(set (match_operand:VF_128 0 "register_operand" "=v,v")
3885 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>, v"))
3886 (match_operand:VF_128 1 "<round_nimm_predicate>" " 0, 0")
3888 (match_operand:VF_128 3 "<round_nimm_predicate>" " v,<round_constraint>")))
3891 "TARGET_FMA || TARGET_AVX512F"
3893 vfnmsub132<ssescalarmodesuffix>\t{<round_op4>%2, %3, %0|%0, %<iptr>3, %<iptr>2<round_op4>}
3894 vfnmsub213<ssescalarmodesuffix>\t{<round_op4>%3, %2, %0|%0, %<iptr>2, %<iptr>3<round_op4>}"
3895 [(set_attr "type" "ssemuladd")
3896 (set_attr "mode" "<MODE>")])
3898 ;; FMA4 floating point scalar intrinsics. These write the
3899 ;; entire destination register, with the high-order elements zeroed.
3901 (define_expand "fma4i_vmfmadd_<mode>"
3902 [(set (match_operand:VF_128 0 "register_operand")
3905 (match_operand:VF_128 1 "nonimmediate_operand")
3906 (match_operand:VF_128 2 "nonimmediate_operand")
3907 (match_operand:VF_128 3 "nonimmediate_operand"))
3911 "operands[4] = CONST0_RTX (<MODE>mode);")
3913 (define_insn "*fma4i_vmfmadd_<mode>"
3914 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
3917 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x")
3918 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
3919 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x"))
3920 (match_operand:VF_128 4 "const0_operand")
3923 "vfmadd<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
3924 [(set_attr "type" "ssemuladd")
3925 (set_attr "mode" "<MODE>")])
3927 (define_insn "*fma4i_vmfmsub_<mode>"
3928 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
3931 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x")
3932 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
3934 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x")))
3935 (match_operand:VF_128 4 "const0_operand")
3938 "vfmsub<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
3939 [(set_attr "type" "ssemuladd")
3940 (set_attr "mode" "<MODE>")])
3942 (define_insn "*fma4i_vmfnmadd_<mode>"
3943 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
3947 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x"))
3948 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
3949 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x"))
3950 (match_operand:VF_128 4 "const0_operand")
3953 "vfnmadd<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
3954 [(set_attr "type" "ssemuladd")
3955 (set_attr "mode" "<MODE>")])
3957 (define_insn "*fma4i_vmfnmsub_<mode>"
3958 [(set (match_operand:VF_128 0 "register_operand" "=x,x")
3962 (match_operand:VF_128 1 "nonimmediate_operand" "%x,x"))
3963 (match_operand:VF_128 2 "nonimmediate_operand" " x,m")
3965 (match_operand:VF_128 3 "nonimmediate_operand" "xm,x")))
3966 (match_operand:VF_128 4 "const0_operand")
3969 "vfnmsub<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %<iptr>2, %<iptr>3}"
3970 [(set_attr "type" "ssemuladd")
3971 (set_attr "mode" "<MODE>")])
3973 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3975 ;; Parallel single-precision floating point conversion operations
3977 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3979 (define_insn "sse_cvtpi2ps"
3980 [(set (match_operand:V4SF 0 "register_operand" "=x")
3983 (float:V2SF (match_operand:V2SI 2 "nonimmediate_operand" "ym")))
3984 (match_operand:V4SF 1 "register_operand" "0")
3987 "cvtpi2ps\t{%2, %0|%0, %2}"
3988 [(set_attr "type" "ssecvt")
3989 (set_attr "mode" "V4SF")])
3991 (define_insn "sse_cvtps2pi"
3992 [(set (match_operand:V2SI 0 "register_operand" "=y")
3994 (unspec:V4SI [(match_operand:V4SF 1 "nonimmediate_operand" "xm")]
3996 (parallel [(const_int 0) (const_int 1)])))]
3998 "cvtps2pi\t{%1, %0|%0, %q1}"
3999 [(set_attr "type" "ssecvt")
4000 (set_attr "unit" "mmx")
4001 (set_attr "mode" "DI")])
4003 (define_insn "sse_cvttps2pi"
4004 [(set (match_operand:V2SI 0 "register_operand" "=y")
4006 (fix:V4SI (match_operand:V4SF 1 "nonimmediate_operand" "xm"))
4007 (parallel [(const_int 0) (const_int 1)])))]
4009 "cvttps2pi\t{%1, %0|%0, %q1}"
4010 [(set_attr "type" "ssecvt")
4011 (set_attr "unit" "mmx")
4012 (set_attr "prefix_rep" "0")
4013 (set_attr "mode" "SF")])
4015 (define_insn "sse_cvtsi2ss<round_name>"
4016 [(set (match_operand:V4SF 0 "register_operand" "=x,x,v")
4019 (float:SF (match_operand:SI 2 "<round_nimm_scalar_predicate>" "r,m,<round_constraint3>")))
4020 (match_operand:V4SF 1 "register_operand" "0,0,v")
4024 cvtsi2ss\t{%2, %0|%0, %2}
4025 cvtsi2ss\t{%2, %0|%0, %2}
4026 vcvtsi2ss\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4027 [(set_attr "isa" "noavx,noavx,avx")
4028 (set_attr "type" "sseicvt")
4029 (set_attr "athlon_decode" "vector,double,*")
4030 (set_attr "amdfam10_decode" "vector,double,*")
4031 (set_attr "bdver1_decode" "double,direct,*")
4032 (set_attr "btver2_decode" "double,double,double")
4033 (set_attr "znver1_decode" "double,double,double")
4034 (set_attr "prefix" "orig,orig,maybe_evex")
4035 (set_attr "mode" "SF")])
4037 (define_insn "sse_cvtsi2ssq<round_name>"
4038 [(set (match_operand:V4SF 0 "register_operand" "=x,x,v")
4041 (float:SF (match_operand:DI 2 "<round_nimm_scalar_predicate>" "r,m,<round_constraint3>")))
4042 (match_operand:V4SF 1 "register_operand" "0,0,v")
4044 "TARGET_SSE && TARGET_64BIT"
4046 cvtsi2ssq\t{%2, %0|%0, %2}
4047 cvtsi2ssq\t{%2, %0|%0, %2}
4048 vcvtsi2ssq\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4049 [(set_attr "isa" "noavx,noavx,avx")
4050 (set_attr "type" "sseicvt")
4051 (set_attr "athlon_decode" "vector,double,*")
4052 (set_attr "amdfam10_decode" "vector,double,*")
4053 (set_attr "bdver1_decode" "double,direct,*")
4054 (set_attr "btver2_decode" "double,double,double")
4055 (set_attr "length_vex" "*,*,4")
4056 (set_attr "prefix_rex" "1,1,*")
4057 (set_attr "prefix" "orig,orig,maybe_evex")
4058 (set_attr "mode" "SF")])
4060 (define_insn "sse_cvtss2si<round_name>"
4061 [(set (match_operand:SI 0 "register_operand" "=r,r")
4064 (match_operand:V4SF 1 "<round_nimm_scalar_predicate>" "v,<round_constraint2>")
4065 (parallel [(const_int 0)]))]
4066 UNSPEC_FIX_NOTRUNC))]
4068 "%vcvtss2si\t{<round_op2>%1, %0|%0, %k1<round_op2>}"
4069 [(set_attr "type" "sseicvt")
4070 (set_attr "athlon_decode" "double,vector")
4071 (set_attr "bdver1_decode" "double,double")
4072 (set_attr "prefix_rep" "1")
4073 (set_attr "prefix" "maybe_vex")
4074 (set_attr "mode" "SI")])
4076 (define_insn "sse_cvtss2si_2"
4077 [(set (match_operand:SI 0 "register_operand" "=r,r")
4078 (unspec:SI [(match_operand:SF 1 "nonimmediate_operand" "v,m")]
4079 UNSPEC_FIX_NOTRUNC))]
4081 "%vcvtss2si\t{%1, %0|%0, %k1}"
4082 [(set_attr "type" "sseicvt")
4083 (set_attr "athlon_decode" "double,vector")
4084 (set_attr "amdfam10_decode" "double,double")
4085 (set_attr "bdver1_decode" "double,double")
4086 (set_attr "prefix_rep" "1")
4087 (set_attr "prefix" "maybe_vex")
4088 (set_attr "mode" "SI")])
4090 (define_insn "sse_cvtss2siq<round_name>"
4091 [(set (match_operand:DI 0 "register_operand" "=r,r")
4094 (match_operand:V4SF 1 "<round_nimm_scalar_predicate>" "v,<round_constraint2>")
4095 (parallel [(const_int 0)]))]
4096 UNSPEC_FIX_NOTRUNC))]
4097 "TARGET_SSE && TARGET_64BIT"
4098 "%vcvtss2si{q}\t{<round_op2>%1, %0|%0, %k1<round_op2>}"
4099 [(set_attr "type" "sseicvt")
4100 (set_attr "athlon_decode" "double,vector")
4101 (set_attr "bdver1_decode" "double,double")
4102 (set_attr "prefix_rep" "1")
4103 (set_attr "prefix" "maybe_vex")
4104 (set_attr "mode" "DI")])
4106 (define_insn "sse_cvtss2siq_2"
4107 [(set (match_operand:DI 0 "register_operand" "=r,r")
4108 (unspec:DI [(match_operand:SF 1 "nonimmediate_operand" "v,m")]
4109 UNSPEC_FIX_NOTRUNC))]
4110 "TARGET_SSE && TARGET_64BIT"
4111 "%vcvtss2si{q}\t{%1, %0|%0, %k1}"
4112 [(set_attr "type" "sseicvt")
4113 (set_attr "athlon_decode" "double,vector")
4114 (set_attr "amdfam10_decode" "double,double")
4115 (set_attr "bdver1_decode" "double,double")
4116 (set_attr "prefix_rep" "1")
4117 (set_attr "prefix" "maybe_vex")
4118 (set_attr "mode" "DI")])
4120 (define_insn "sse_cvttss2si<round_saeonly_name>"
4121 [(set (match_operand:SI 0 "register_operand" "=r,r")
4124 (match_operand:V4SF 1 "<round_saeonly_nimm_scalar_predicate>" "v,<round_saeonly_constraint2>")
4125 (parallel [(const_int 0)]))))]
4127 "%vcvttss2si\t{<round_saeonly_op2>%1, %0|%0, %k1<round_saeonly_op2>}"
4128 [(set_attr "type" "sseicvt")
4129 (set_attr "athlon_decode" "double,vector")
4130 (set_attr "amdfam10_decode" "double,double")
4131 (set_attr "bdver1_decode" "double,double")
4132 (set_attr "prefix_rep" "1")
4133 (set_attr "prefix" "maybe_vex")
4134 (set_attr "mode" "SI")])
4136 (define_insn "sse_cvttss2siq<round_saeonly_name>"
4137 [(set (match_operand:DI 0 "register_operand" "=r,r")
4140 (match_operand:V4SF 1 "<round_saeonly_nimm_scalar_predicate>" "v,<round_saeonly_constraint>")
4141 (parallel [(const_int 0)]))))]
4142 "TARGET_SSE && TARGET_64BIT"
4143 "%vcvttss2si{q}\t{<round_saeonly_op2>%1, %0|%0, %k1<round_saeonly_op2>}"
4144 [(set_attr "type" "sseicvt")
4145 (set_attr "athlon_decode" "double,vector")
4146 (set_attr "amdfam10_decode" "double,double")
4147 (set_attr "bdver1_decode" "double,double")
4148 (set_attr "prefix_rep" "1")
4149 (set_attr "prefix" "maybe_vex")
4150 (set_attr "mode" "DI")])
4152 (define_insn "cvtusi2<ssescalarmodesuffix>32<round_name>"
4153 [(set (match_operand:VF_128 0 "register_operand" "=v")
4155 (vec_duplicate:VF_128
4156 (unsigned_float:<ssescalarmode>
4157 (match_operand:SI 2 "<round_nimm_predicate>" "<round_constraint3>")))
4158 (match_operand:VF_128 1 "register_operand" "v")
4160 "TARGET_AVX512F && <round_modev4sf_condition>"
4161 "vcvtusi2<ssescalarmodesuffix>\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4162 [(set_attr "type" "sseicvt")
4163 (set_attr "prefix" "evex")
4164 (set_attr "mode" "<ssescalarmode>")])
4166 (define_insn "cvtusi2<ssescalarmodesuffix>64<round_name>"
4167 [(set (match_operand:VF_128 0 "register_operand" "=v")
4169 (vec_duplicate:VF_128
4170 (unsigned_float:<ssescalarmode>
4171 (match_operand:DI 2 "<round_nimm_predicate>" "<round_constraint3>")))
4172 (match_operand:VF_128 1 "register_operand" "v")
4174 "TARGET_AVX512F && TARGET_64BIT"
4175 "vcvtusi2<ssescalarmodesuffix>\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4176 [(set_attr "type" "sseicvt")
4177 (set_attr "prefix" "evex")
4178 (set_attr "mode" "<ssescalarmode>")])
4180 (define_insn "float<sseintvecmodelower><mode>2<mask_name><round_name>"
4181 [(set (match_operand:VF1 0 "register_operand" "=x,v")
4183 (match_operand:<sseintvecmode> 1 "<round_nimm_predicate>" "xBm,<round_constraint>")))]
4184 "TARGET_SSE2 && <mask_mode512bit_condition> && <round_mode512bit_condition>"
4186 cvtdq2ps\t{%1, %0|%0, %1}
4187 vcvtdq2ps\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4188 [(set_attr "isa" "noavx,avx")
4189 (set_attr "type" "ssecvt")
4190 (set_attr "prefix" "maybe_vex")
4191 (set_attr "mode" "<sseinsnmode>")])
4193 (define_insn "ufloat<sseintvecmodelower><mode>2<mask_name><round_name>"
4194 [(set (match_operand:VF1_AVX512VL 0 "register_operand" "=v")
4195 (unsigned_float:VF1_AVX512VL
4196 (match_operand:<sseintvecmode> 1 "nonimmediate_operand" "<round_constraint>")))]
4198 "vcvtudq2ps\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4199 [(set_attr "type" "ssecvt")
4200 (set_attr "prefix" "evex")
4201 (set_attr "mode" "<MODE>")])
4203 (define_expand "floatuns<sseintvecmodelower><mode>2"
4204 [(match_operand:VF1 0 "register_operand")
4205 (match_operand:<sseintvecmode> 1 "register_operand")]
4206 "TARGET_SSE2 && (<MODE>mode == V4SFmode || TARGET_AVX2)"
4208 if (<MODE>mode == V16SFmode)
4209 emit_insn (gen_ufloatv16siv16sf2 (operands[0], operands[1]));
4211 if (TARGET_AVX512VL)
4213 if (<MODE>mode == V4SFmode)
4214 emit_insn (gen_ufloatv4siv4sf2 (operands[0], operands[1]));
4216 emit_insn (gen_ufloatv8siv8sf2 (operands[0], operands[1]));
4219 ix86_expand_vector_convert_uns_vsivsf (operands[0], operands[1]);
4225 ;; For <sse2_avx_avx512f>_fix_notrunc<sf2simodelower><mode> insn pattern
4226 (define_mode_attr sf2simodelower
4227 [(V16SI "v16sf") (V8SI "v8sf") (V4SI "v4sf")])
4229 (define_insn "<sse2_avx_avx512f>_fix_notrunc<sf2simodelower><mode><mask_name>"
4230 [(set (match_operand:VI4_AVX 0 "register_operand" "=v")
4232 [(match_operand:<ssePSmode> 1 "vector_operand" "vBm")]
4233 UNSPEC_FIX_NOTRUNC))]
4234 "TARGET_SSE2 && <mask_mode512bit_condition>"
4235 "%vcvtps2dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4236 [(set_attr "type" "ssecvt")
4237 (set (attr "prefix_data16")
4239 (match_test "TARGET_AVX")
4241 (const_string "1")))
4242 (set_attr "prefix" "maybe_vex")
4243 (set_attr "mode" "<sseinsnmode>")])
4245 (define_insn "<mask_codefor>avx512f_fix_notruncv16sfv16si<mask_name><round_name>"
4246 [(set (match_operand:V16SI 0 "register_operand" "=v")
4248 [(match_operand:V16SF 1 "<round_nimm_predicate>" "<round_constraint>")]
4249 UNSPEC_FIX_NOTRUNC))]
4251 "vcvtps2dq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4252 [(set_attr "type" "ssecvt")
4253 (set_attr "prefix" "evex")
4254 (set_attr "mode" "XI")])
4256 (define_insn "<mask_codefor><avx512>_ufix_notrunc<sf2simodelower><mode><mask_name><round_name>"
4257 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
4258 (unspec:VI4_AVX512VL
4259 [(match_operand:<ssePSmode> 1 "nonimmediate_operand" "<round_constraint>")]
4260 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4262 "vcvtps2udq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4263 [(set_attr "type" "ssecvt")
4264 (set_attr "prefix" "evex")
4265 (set_attr "mode" "<sseinsnmode>")])
4267 (define_insn "<mask_codefor>avx512dq_cvtps2qq<mode><mask_name><round_name>"
4268 [(set (match_operand:VI8_256_512 0 "register_operand" "=v")
4269 (unspec:VI8_256_512 [(match_operand:<ssePSmode2> 1 "nonimmediate_operand" "<round_constraint>")]
4270 UNSPEC_FIX_NOTRUNC))]
4271 "TARGET_AVX512DQ && <round_mode512bit_condition>"
4272 "vcvtps2qq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4273 [(set_attr "type" "ssecvt")
4274 (set_attr "prefix" "evex")
4275 (set_attr "mode" "<sseinsnmode>")])
4277 (define_insn "<mask_codefor>avx512dq_cvtps2qqv2di<mask_name>"
4278 [(set (match_operand:V2DI 0 "register_operand" "=v")
4281 (match_operand:V4SF 1 "nonimmediate_operand" "vm")
4282 (parallel [(const_int 0) (const_int 1)]))]
4283 UNSPEC_FIX_NOTRUNC))]
4284 "TARGET_AVX512DQ && TARGET_AVX512VL"
4285 "vcvtps2qq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
4286 [(set_attr "type" "ssecvt")
4287 (set_attr "prefix" "evex")
4288 (set_attr "mode" "TI")])
4290 (define_insn "<mask_codefor>avx512dq_cvtps2uqq<mode><mask_name><round_name>"
4291 [(set (match_operand:VI8_256_512 0 "register_operand" "=v")
4292 (unspec:VI8_256_512 [(match_operand:<ssePSmode2> 1 "nonimmediate_operand" "<round_constraint>")]
4293 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4294 "TARGET_AVX512DQ && <round_mode512bit_condition>"
4295 "vcvtps2uqq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4296 [(set_attr "type" "ssecvt")
4297 (set_attr "prefix" "evex")
4298 (set_attr "mode" "<sseinsnmode>")])
4300 (define_insn "<mask_codefor>avx512dq_cvtps2uqqv2di<mask_name>"
4301 [(set (match_operand:V2DI 0 "register_operand" "=v")
4304 (match_operand:V4SF 1 "nonimmediate_operand" "vm")
4305 (parallel [(const_int 0) (const_int 1)]))]
4306 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4307 "TARGET_AVX512DQ && TARGET_AVX512VL"
4308 "vcvtps2uqq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
4309 [(set_attr "type" "ssecvt")
4310 (set_attr "prefix" "evex")
4311 (set_attr "mode" "TI")])
4313 (define_insn "<fixsuffix>fix_truncv16sfv16si2<mask_name><round_saeonly_name>"
4314 [(set (match_operand:V16SI 0 "register_operand" "=v")
4316 (match_operand:V16SF 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
4318 "vcvttps2<fixsuffix>dq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
4319 [(set_attr "type" "ssecvt")
4320 (set_attr "prefix" "evex")
4321 (set_attr "mode" "XI")])
4323 (define_insn "fix_truncv8sfv8si2<mask_name>"
4324 [(set (match_operand:V8SI 0 "register_operand" "=v")
4325 (fix:V8SI (match_operand:V8SF 1 "nonimmediate_operand" "vm")))]
4326 "TARGET_AVX && <mask_avx512vl_condition>"
4327 "vcvttps2dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4328 [(set_attr "type" "ssecvt")
4329 (set_attr "prefix" "<mask_prefix>")
4330 (set_attr "mode" "OI")])
4332 (define_insn "fix_truncv4sfv4si2<mask_name>"
4333 [(set (match_operand:V4SI 0 "register_operand" "=v")
4334 (fix:V4SI (match_operand:V4SF 1 "vector_operand" "vBm")))]
4335 "TARGET_SSE2 && <mask_avx512vl_condition>"
4336 "%vcvttps2dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4337 [(set_attr "type" "ssecvt")
4338 (set (attr "prefix_rep")
4340 (match_test "TARGET_AVX")
4342 (const_string "1")))
4343 (set (attr "prefix_data16")
4345 (match_test "TARGET_AVX")
4347 (const_string "0")))
4348 (set_attr "prefix_data16" "0")
4349 (set_attr "prefix" "<mask_prefix2>")
4350 (set_attr "mode" "TI")])
4352 (define_expand "fixuns_trunc<mode><sseintvecmodelower>2"
4353 [(match_operand:<sseintvecmode> 0 "register_operand")
4354 (match_operand:VF1 1 "register_operand")]
4357 if (<MODE>mode == V16SFmode)
4358 emit_insn (gen_ufix_truncv16sfv16si2 (operands[0],
4363 tmp[0] = ix86_expand_adjust_ufix_to_sfix_si (operands[1], &tmp[2]);
4364 tmp[1] = gen_reg_rtx (<sseintvecmode>mode);
4365 emit_insn (gen_fix_trunc<mode><sseintvecmodelower>2 (tmp[1], tmp[0]));
4366 emit_insn (gen_xor<sseintvecmodelower>3 (operands[0], tmp[1], tmp[2]));
4371 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4373 ;; Parallel double-precision floating point conversion operations
4375 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4377 (define_insn "sse2_cvtpi2pd"
4378 [(set (match_operand:V2DF 0 "register_operand" "=x,x")
4379 (float:V2DF (match_operand:V2SI 1 "nonimmediate_operand" "y,m")))]
4381 "cvtpi2pd\t{%1, %0|%0, %1}"
4382 [(set_attr "type" "ssecvt")
4383 (set_attr "unit" "mmx,*")
4384 (set_attr "prefix_data16" "1,*")
4385 (set_attr "mode" "V2DF")])
4387 (define_insn "sse2_cvtpd2pi"
4388 [(set (match_operand:V2SI 0 "register_operand" "=y")
4389 (unspec:V2SI [(match_operand:V2DF 1 "nonimmediate_operand" "xm")]
4390 UNSPEC_FIX_NOTRUNC))]
4392 "cvtpd2pi\t{%1, %0|%0, %1}"
4393 [(set_attr "type" "ssecvt")
4394 (set_attr "unit" "mmx")
4395 (set_attr "bdver1_decode" "double")
4396 (set_attr "btver2_decode" "direct")
4397 (set_attr "prefix_data16" "1")
4398 (set_attr "mode" "DI")])
4400 (define_insn "sse2_cvttpd2pi"
4401 [(set (match_operand:V2SI 0 "register_operand" "=y")
4402 (fix:V2SI (match_operand:V2DF 1 "nonimmediate_operand" "xm")))]
4404 "cvttpd2pi\t{%1, %0|%0, %1}"
4405 [(set_attr "type" "ssecvt")
4406 (set_attr "unit" "mmx")
4407 (set_attr "bdver1_decode" "double")
4408 (set_attr "prefix_data16" "1")
4409 (set_attr "mode" "TI")])
4411 (define_insn "sse2_cvtsi2sd"
4412 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
4415 (float:DF (match_operand:SI 2 "nonimmediate_operand" "r,m,rm")))
4416 (match_operand:V2DF 1 "register_operand" "0,0,v")
4420 cvtsi2sd\t{%2, %0|%0, %2}
4421 cvtsi2sd\t{%2, %0|%0, %2}
4422 vcvtsi2sd\t{%2, %1, %0|%0, %1, %2}"
4423 [(set_attr "isa" "noavx,noavx,avx")
4424 (set_attr "type" "sseicvt")
4425 (set_attr "athlon_decode" "double,direct,*")
4426 (set_attr "amdfam10_decode" "vector,double,*")
4427 (set_attr "bdver1_decode" "double,direct,*")
4428 (set_attr "btver2_decode" "double,double,double")
4429 (set_attr "znver1_decode" "double,double,double")
4430 (set_attr "prefix" "orig,orig,maybe_evex")
4431 (set_attr "mode" "DF")])
4433 (define_insn "sse2_cvtsi2sdq<round_name>"
4434 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
4437 (float:DF (match_operand:DI 2 "<round_nimm_scalar_predicate>" "r,m,<round_constraint3>")))
4438 (match_operand:V2DF 1 "register_operand" "0,0,v")
4440 "TARGET_SSE2 && TARGET_64BIT"
4442 cvtsi2sdq\t{%2, %0|%0, %2}
4443 cvtsi2sdq\t{%2, %0|%0, %2}
4444 vcvtsi2sdq\t{%2, <round_op3>%1, %0|%0, %1<round_op3>, %2}"
4445 [(set_attr "isa" "noavx,noavx,avx")
4446 (set_attr "type" "sseicvt")
4447 (set_attr "athlon_decode" "double,direct,*")
4448 (set_attr "amdfam10_decode" "vector,double,*")
4449 (set_attr "bdver1_decode" "double,direct,*")
4450 (set_attr "length_vex" "*,*,4")
4451 (set_attr "prefix_rex" "1,1,*")
4452 (set_attr "prefix" "orig,orig,maybe_evex")
4453 (set_attr "mode" "DF")])
4455 (define_insn "avx512f_vcvtss2usi<round_name>"
4456 [(set (match_operand:SI 0 "register_operand" "=r")
4459 (match_operand:V4SF 1 "<round_nimm_predicate>" "<round_constraint>")
4460 (parallel [(const_int 0)]))]
4461 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4463 "vcvtss2usi\t{<round_op2>%1, %0|%0, %1<round_op2>}"
4464 [(set_attr "type" "sseicvt")
4465 (set_attr "prefix" "evex")
4466 (set_attr "mode" "SI")])
4468 (define_insn "avx512f_vcvtss2usiq<round_name>"
4469 [(set (match_operand:DI 0 "register_operand" "=r")
4472 (match_operand:V4SF 1 "<round_nimm_predicate>" "<round_constraint>")
4473 (parallel [(const_int 0)]))]
4474 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4475 "TARGET_AVX512F && TARGET_64BIT"
4476 "vcvtss2usi\t{<round_op2>%1, %0|%0, %1<round_op2>}"
4477 [(set_attr "type" "sseicvt")
4478 (set_attr "prefix" "evex")
4479 (set_attr "mode" "DI")])
4481 (define_insn "avx512f_vcvttss2usi<round_saeonly_name>"
4482 [(set (match_operand:SI 0 "register_operand" "=r")
4485 (match_operand:V4SF 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
4486 (parallel [(const_int 0)]))))]
4488 "vcvttss2usi\t{<round_saeonly_op2>%1, %0|%0, %1<round_saeonly_op2>}"
4489 [(set_attr "type" "sseicvt")
4490 (set_attr "prefix" "evex")
4491 (set_attr "mode" "SI")])
4493 (define_insn "avx512f_vcvttss2usiq<round_saeonly_name>"
4494 [(set (match_operand:DI 0 "register_operand" "=r")
4497 (match_operand:V4SF 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
4498 (parallel [(const_int 0)]))))]
4499 "TARGET_AVX512F && TARGET_64BIT"
4500 "vcvttss2usi\t{<round_saeonly_op2>%1, %0|%0, %1<round_saeonly_op2>}"
4501 [(set_attr "type" "sseicvt")
4502 (set_attr "prefix" "evex")
4503 (set_attr "mode" "DI")])
4505 (define_insn "avx512f_vcvtsd2usi<round_name>"
4506 [(set (match_operand:SI 0 "register_operand" "=r")
4509 (match_operand:V2DF 1 "<round_nimm_predicate>" "<round_constraint>")
4510 (parallel [(const_int 0)]))]
4511 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4513 "vcvtsd2usi\t{<round_op2>%1, %0|%0, %1<round_op2>}"
4514 [(set_attr "type" "sseicvt")
4515 (set_attr "prefix" "evex")
4516 (set_attr "mode" "SI")])
4518 (define_insn "avx512f_vcvtsd2usiq<round_name>"
4519 [(set (match_operand:DI 0 "register_operand" "=r")
4522 (match_operand:V2DF 1 "<round_nimm_predicate>" "<round_constraint>")
4523 (parallel [(const_int 0)]))]
4524 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4525 "TARGET_AVX512F && TARGET_64BIT"
4526 "vcvtsd2usi\t{<round_op2>%1, %0|%0, %1<round_op2>}"
4527 [(set_attr "type" "sseicvt")
4528 (set_attr "prefix" "evex")
4529 (set_attr "mode" "DI")])
4531 (define_insn "avx512f_vcvttsd2usi<round_saeonly_name>"
4532 [(set (match_operand:SI 0 "register_operand" "=r")
4535 (match_operand:V2DF 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
4536 (parallel [(const_int 0)]))))]
4538 "vcvttsd2usi\t{<round_saeonly_op2>%1, %0|%0, %1<round_saeonly_op2>}"
4539 [(set_attr "type" "sseicvt")
4540 (set_attr "prefix" "evex")
4541 (set_attr "mode" "SI")])
4543 (define_insn "avx512f_vcvttsd2usiq<round_saeonly_name>"
4544 [(set (match_operand:DI 0 "register_operand" "=r")
4547 (match_operand:V2DF 1 "<round_saeonly_nimm_scalar_predicate>" "<round_saeonly_constraint>")
4548 (parallel [(const_int 0)]))))]
4549 "TARGET_AVX512F && TARGET_64BIT"
4550 "vcvttsd2usi\t{<round_saeonly_op2>%1, %0|%0, %1<round_saeonly_op2>}"
4551 [(set_attr "type" "sseicvt")
4552 (set_attr "prefix" "evex")
4553 (set_attr "mode" "DI")])
4555 (define_insn "sse2_cvtsd2si<round_name>"
4556 [(set (match_operand:SI 0 "register_operand" "=r,r")
4559 (match_operand:V2DF 1 "<round_nimm_scalar_predicate>" "v,<round_constraint2>")
4560 (parallel [(const_int 0)]))]
4561 UNSPEC_FIX_NOTRUNC))]
4563 "%vcvtsd2si\t{<round_op2>%1, %0|%0, %q1<round_op2>}"
4564 [(set_attr "type" "sseicvt")
4565 (set_attr "athlon_decode" "double,vector")
4566 (set_attr "bdver1_decode" "double,double")
4567 (set_attr "btver2_decode" "double,double")
4568 (set_attr "prefix_rep" "1")
4569 (set_attr "prefix" "maybe_vex")
4570 (set_attr "mode" "SI")])
4572 (define_insn "sse2_cvtsd2si_2"
4573 [(set (match_operand:SI 0 "register_operand" "=r,r")
4574 (unspec:SI [(match_operand:DF 1 "nonimmediate_operand" "v,m")]
4575 UNSPEC_FIX_NOTRUNC))]
4577 "%vcvtsd2si\t{%1, %0|%0, %q1}"
4578 [(set_attr "type" "sseicvt")
4579 (set_attr "athlon_decode" "double,vector")
4580 (set_attr "amdfam10_decode" "double,double")
4581 (set_attr "bdver1_decode" "double,double")
4582 (set_attr "prefix_rep" "1")
4583 (set_attr "prefix" "maybe_vex")
4584 (set_attr "mode" "SI")])
4586 (define_insn "sse2_cvtsd2siq<round_name>"
4587 [(set (match_operand:DI 0 "register_operand" "=r,r")
4590 (match_operand:V2DF 1 "<round_nimm_scalar_predicate>" "v,<round_constraint2>")
4591 (parallel [(const_int 0)]))]
4592 UNSPEC_FIX_NOTRUNC))]
4593 "TARGET_SSE2 && TARGET_64BIT"
4594 "%vcvtsd2si{q}\t{<round_op2>%1, %0|%0, %q1<round_op2>}"
4595 [(set_attr "type" "sseicvt")
4596 (set_attr "athlon_decode" "double,vector")
4597 (set_attr "bdver1_decode" "double,double")
4598 (set_attr "prefix_rep" "1")
4599 (set_attr "prefix" "maybe_vex")
4600 (set_attr "mode" "DI")])
4602 (define_insn "sse2_cvtsd2siq_2"
4603 [(set (match_operand:DI 0 "register_operand" "=r,r")
4604 (unspec:DI [(match_operand:DF 1 "nonimmediate_operand" "v,m")]
4605 UNSPEC_FIX_NOTRUNC))]
4606 "TARGET_SSE2 && TARGET_64BIT"
4607 "%vcvtsd2si{q}\t{%1, %0|%0, %q1}"
4608 [(set_attr "type" "sseicvt")
4609 (set_attr "athlon_decode" "double,vector")
4610 (set_attr "amdfam10_decode" "double,double")
4611 (set_attr "bdver1_decode" "double,double")
4612 (set_attr "prefix_rep" "1")
4613 (set_attr "prefix" "maybe_vex")
4614 (set_attr "mode" "DI")])
4616 (define_insn "sse2_cvttsd2si<round_saeonly_name>"
4617 [(set (match_operand:SI 0 "register_operand" "=r,r")
4620 (match_operand:V2DF 1 "<round_saeonly_nimm_scalar_predicate>" "v,<round_saeonly_constraint2>")
4621 (parallel [(const_int 0)]))))]
4623 "%vcvttsd2si\t{<round_saeonly_op2>%1, %0|%0, %q1<round_saeonly_op2>}"
4624 [(set_attr "type" "sseicvt")
4625 (set_attr "athlon_decode" "double,vector")
4626 (set_attr "amdfam10_decode" "double,double")
4627 (set_attr "bdver1_decode" "double,double")
4628 (set_attr "btver2_decode" "double,double")
4629 (set_attr "prefix_rep" "1")
4630 (set_attr "prefix" "maybe_vex")
4631 (set_attr "mode" "SI")])
4633 (define_insn "sse2_cvttsd2siq<round_saeonly_name>"
4634 [(set (match_operand:DI 0 "register_operand" "=r,r")
4637 (match_operand:V2DF 1 "<round_saeonly_nimm_scalar_predicate>" "v,<round_saeonly_constraint2>")
4638 (parallel [(const_int 0)]))))]
4639 "TARGET_SSE2 && TARGET_64BIT"
4640 "%vcvttsd2si{q}\t{<round_saeonly_op2>%1, %0|%0, %q1<round_saeonly_op2>}"
4641 [(set_attr "type" "sseicvt")
4642 (set_attr "athlon_decode" "double,vector")
4643 (set_attr "amdfam10_decode" "double,double")
4644 (set_attr "bdver1_decode" "double,double")
4645 (set_attr "prefix_rep" "1")
4646 (set_attr "prefix" "maybe_vex")
4647 (set_attr "mode" "DI")])
4649 ;; For float<si2dfmode><mode>2 insn pattern
4650 (define_mode_attr si2dfmode
4651 [(V8DF "V8SI") (V4DF "V4SI")])
4652 (define_mode_attr si2dfmodelower
4653 [(V8DF "v8si") (V4DF "v4si")])
4655 (define_insn "float<si2dfmodelower><mode>2<mask_name>"
4656 [(set (match_operand:VF2_512_256 0 "register_operand" "=v")
4657 (float:VF2_512_256 (match_operand:<si2dfmode> 1 "nonimmediate_operand" "vm")))]
4658 "TARGET_AVX && <mask_mode512bit_condition>"
4659 "vcvtdq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4660 [(set_attr "type" "ssecvt")
4661 (set_attr "prefix" "maybe_vex")
4662 (set_attr "mode" "<MODE>")])
4664 (define_insn "<floatsuffix>float<sseintvecmodelower><mode>2<mask_name><round_name>"
4665 [(set (match_operand:VF2_AVX512VL 0 "register_operand" "=v")
4666 (any_float:VF2_AVX512VL
4667 (match_operand:<sseintvecmode> 1 "nonimmediate_operand" "vm")))]
4669 "vcvt<floatsuffix>qq2pd\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4670 [(set_attr "type" "ssecvt")
4671 (set_attr "prefix" "evex")
4672 (set_attr "mode" "<MODE>")])
4674 ;; For <floatsuffix>float<sselondveclower><mode> insn patterns
4675 (define_mode_attr qq2pssuff
4676 [(V8SF "") (V4SF "{y}")])
4678 (define_mode_attr sselongvecmode
4679 [(V8SF "V8DI") (V4SF "V4DI")])
4681 (define_mode_attr sselongvecmodelower
4682 [(V8SF "v8di") (V4SF "v4di")])
4684 (define_mode_attr sseintvecmode3
4685 [(V8SF "XI") (V4SF "OI")
4686 (V8DF "OI") (V4DF "TI")])
4688 (define_insn "<floatsuffix>float<sselongvecmodelower><mode>2<mask_name><round_name>"
4689 [(set (match_operand:VF1_128_256VL 0 "register_operand" "=v")
4690 (any_float:VF1_128_256VL
4691 (match_operand:<sselongvecmode> 1 "nonimmediate_operand" "<round_constraint>")))]
4692 "TARGET_AVX512DQ && <round_modev8sf_condition>"
4693 "vcvt<floatsuffix>qq2ps<qq2pssuff>\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4694 [(set_attr "type" "ssecvt")
4695 (set_attr "prefix" "evex")
4696 (set_attr "mode" "<MODE>")])
4698 (define_insn "*<floatsuffix>floatv2div2sf2"
4699 [(set (match_operand:V4SF 0 "register_operand" "=v")
4701 (any_float:V2SF (match_operand:V2DI 1 "nonimmediate_operand" "vm"))
4702 (const_vector:V2SF [(const_int 0) (const_int 0)])))]
4703 "TARGET_AVX512DQ && TARGET_AVX512VL"
4704 "vcvt<floatsuffix>qq2ps{x}\t{%1, %0|%0, %1}"
4705 [(set_attr "type" "ssecvt")
4706 (set_attr "prefix" "evex")
4707 (set_attr "mode" "V4SF")])
4709 (define_insn "<floatsuffix>floatv2div2sf2_mask"
4710 [(set (match_operand:V4SF 0 "register_operand" "=v")
4713 (any_float:V2SF (match_operand:V2DI 1 "nonimmediate_operand" "vm"))
4715 (match_operand:V4SF 2 "vector_move_operand" "0C")
4716 (parallel [(const_int 0) (const_int 1)]))
4717 (match_operand:QI 3 "register_operand" "Yk"))
4718 (const_vector:V2SF [(const_int 0) (const_int 0)])))]
4719 "TARGET_AVX512DQ && TARGET_AVX512VL"
4720 "vcvt<floatsuffix>qq2ps{x}\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
4721 [(set_attr "type" "ssecvt")
4722 (set_attr "prefix" "evex")
4723 (set_attr "mode" "V4SF")])
4725 (define_insn "*<floatsuffix>floatv2div2sf2_mask_1"
4726 [(set (match_operand:V4SF 0 "register_operand" "=v")
4729 (any_float:V2SF (match_operand:V2DI 1
4730 "nonimmediate_operand" "vm"))
4731 (const_vector:V2SF [(const_int 0) (const_int 0)])
4732 (match_operand:QI 2 "register_operand" "Yk"))
4733 (const_vector:V2SF [(const_int 0) (const_int 0)])))]
4734 "TARGET_AVX512DQ && TARGET_AVX512VL"
4735 "vcvt<floatsuffix>qq2ps{x}\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
4736 [(set_attr "type" "ssecvt")
4737 (set_attr "prefix" "evex")
4738 (set_attr "mode" "V4SF")])
4740 (define_insn "ufloat<si2dfmodelower><mode>2<mask_name>"
4741 [(set (match_operand:VF2_512_256VL 0 "register_operand" "=v")
4742 (unsigned_float:VF2_512_256VL
4743 (match_operand:<si2dfmode> 1 "nonimmediate_operand" "vm")))]
4745 "vcvtudq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4746 [(set_attr "type" "ssecvt")
4747 (set_attr "prefix" "evex")
4748 (set_attr "mode" "<MODE>")])
4750 (define_insn "ufloatv2siv2df2<mask_name>"
4751 [(set (match_operand:V2DF 0 "register_operand" "=v")
4752 (unsigned_float:V2DF
4754 (match_operand:V4SI 1 "nonimmediate_operand" "vm")
4755 (parallel [(const_int 0) (const_int 1)]))))]
4757 "vcvtudq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4758 [(set_attr "type" "ssecvt")
4759 (set_attr "prefix" "evex")
4760 (set_attr "mode" "V2DF")])
4762 (define_insn "avx512f_cvtdq2pd512_2"
4763 [(set (match_operand:V8DF 0 "register_operand" "=v")
4766 (match_operand:V16SI 1 "nonimmediate_operand" "vm")
4767 (parallel [(const_int 0) (const_int 1)
4768 (const_int 2) (const_int 3)
4769 (const_int 4) (const_int 5)
4770 (const_int 6) (const_int 7)]))))]
4772 "vcvtdq2pd\t{%t1, %0|%0, %t1}"
4773 [(set_attr "type" "ssecvt")
4774 (set_attr "prefix" "evex")
4775 (set_attr "mode" "V8DF")])
4777 (define_insn "avx_cvtdq2pd256_2"
4778 [(set (match_operand:V4DF 0 "register_operand" "=v")
4781 (match_operand:V8SI 1 "nonimmediate_operand" "vm")
4782 (parallel [(const_int 0) (const_int 1)
4783 (const_int 2) (const_int 3)]))))]
4785 "vcvtdq2pd\t{%x1, %0|%0, %x1}"
4786 [(set_attr "type" "ssecvt")
4787 (set_attr "prefix" "maybe_evex")
4788 (set_attr "mode" "V4DF")])
4790 (define_insn "sse2_cvtdq2pd<mask_name>"
4791 [(set (match_operand:V2DF 0 "register_operand" "=v")
4794 (match_operand:V4SI 1 "nonimmediate_operand" "vm")
4795 (parallel [(const_int 0) (const_int 1)]))))]
4796 "TARGET_SSE2 && <mask_avx512vl_condition>"
4797 "%vcvtdq2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
4798 [(set_attr "type" "ssecvt")
4799 (set_attr "prefix" "maybe_vex")
4800 (set_attr "mode" "V2DF")])
4802 (define_insn "<mask_codefor>avx512f_cvtpd2dq512<mask_name><round_name>"
4803 [(set (match_operand:V8SI 0 "register_operand" "=v")
4805 [(match_operand:V8DF 1 "<round_nimm_predicate>" "<round_constraint>")]
4806 UNSPEC_FIX_NOTRUNC))]
4808 "vcvtpd2dq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4809 [(set_attr "type" "ssecvt")
4810 (set_attr "prefix" "evex")
4811 (set_attr "mode" "OI")])
4813 (define_insn "avx_cvtpd2dq256<mask_name>"
4814 [(set (match_operand:V4SI 0 "register_operand" "=v")
4815 (unspec:V4SI [(match_operand:V4DF 1 "nonimmediate_operand" "vm")]
4816 UNSPEC_FIX_NOTRUNC))]
4817 "TARGET_AVX && <mask_avx512vl_condition>"
4818 "vcvtpd2dq{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4819 [(set_attr "type" "ssecvt")
4820 (set_attr "prefix" "<mask_prefix>")
4821 (set_attr "mode" "OI")])
4823 (define_expand "avx_cvtpd2dq256_2"
4824 [(set (match_operand:V8SI 0 "register_operand")
4826 (unspec:V4SI [(match_operand:V4DF 1 "nonimmediate_operand")]
4830 "operands[2] = CONST0_RTX (V4SImode);")
4832 (define_insn "*avx_cvtpd2dq256_2"
4833 [(set (match_operand:V8SI 0 "register_operand" "=v")
4835 (unspec:V4SI [(match_operand:V4DF 1 "nonimmediate_operand" "vm")]
4837 (match_operand:V4SI 2 "const0_operand")))]
4839 "vcvtpd2dq{y}\t{%1, %x0|%x0, %1}"
4840 [(set_attr "type" "ssecvt")
4841 (set_attr "prefix" "vex")
4842 (set_attr "btver2_decode" "vector")
4843 (set_attr "mode" "OI")])
4845 (define_insn "sse2_cvtpd2dq<mask_name>"
4846 [(set (match_operand:V4SI 0 "register_operand" "=v")
4848 (unspec:V2SI [(match_operand:V2DF 1 "vector_operand" "vBm")]
4850 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
4851 "TARGET_SSE2 && <mask_avx512vl_condition>"
4854 return "vcvtpd2dq{x}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}";
4856 return "cvtpd2dq\t{%1, %0|%0, %1}";
4858 [(set_attr "type" "ssecvt")
4859 (set_attr "prefix_rep" "1")
4860 (set_attr "prefix_data16" "0")
4861 (set_attr "prefix" "maybe_vex")
4862 (set_attr "mode" "TI")
4863 (set_attr "amdfam10_decode" "double")
4864 (set_attr "athlon_decode" "vector")
4865 (set_attr "bdver1_decode" "double")])
4867 ;; For ufix_notrunc* insn patterns
4868 (define_mode_attr pd2udqsuff
4869 [(V8DF "") (V4DF "{y}")])
4871 (define_insn "ufix_notrunc<mode><si2dfmodelower>2<mask_name><round_name>"
4872 [(set (match_operand:<si2dfmode> 0 "register_operand" "=v")
4874 [(match_operand:VF2_512_256VL 1 "nonimmediate_operand" "<round_constraint>")]
4875 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4877 "vcvtpd2udq<pd2udqsuff>\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4878 [(set_attr "type" "ssecvt")
4879 (set_attr "prefix" "evex")
4880 (set_attr "mode" "<sseinsnmode>")])
4882 (define_insn "ufix_notruncv2dfv2si2<mask_name>"
4883 [(set (match_operand:V4SI 0 "register_operand" "=v")
4886 [(match_operand:V2DF 1 "nonimmediate_operand" "vm")]
4887 UNSPEC_UNSIGNED_FIX_NOTRUNC)
4888 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
4890 "vcvtpd2udq{x}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4891 [(set_attr "type" "ssecvt")
4892 (set_attr "prefix" "evex")
4893 (set_attr "mode" "TI")])
4895 (define_insn "<fixsuffix>fix_truncv8dfv8si2<mask_name><round_saeonly_name>"
4896 [(set (match_operand:V8SI 0 "register_operand" "=v")
4898 (match_operand:V8DF 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
4900 "vcvttpd2<fixsuffix>dq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
4901 [(set_attr "type" "ssecvt")
4902 (set_attr "prefix" "evex")
4903 (set_attr "mode" "OI")])
4905 (define_insn "ufix_truncv2dfv2si2<mask_name>"
4906 [(set (match_operand:V4SI 0 "register_operand" "=v")
4908 (unsigned_fix:V2SI (match_operand:V2DF 1 "nonimmediate_operand" "vm"))
4909 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
4911 "vcvttpd2udq{x}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4912 [(set_attr "type" "ssecvt")
4913 (set_attr "prefix" "evex")
4914 (set_attr "mode" "TI")])
4916 (define_insn "fix_truncv4dfv4si2<mask_name>"
4917 [(set (match_operand:V4SI 0 "register_operand" "=v")
4918 (fix:V4SI (match_operand:V4DF 1 "nonimmediate_operand" "vm")))]
4919 "TARGET_AVX || (TARGET_AVX512VL && TARGET_AVX512F)"
4920 "vcvttpd2dq{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4921 [(set_attr "type" "ssecvt")
4922 (set_attr "prefix" "maybe_evex")
4923 (set_attr "mode" "OI")])
4925 (define_insn "ufix_truncv4dfv4si2<mask_name>"
4926 [(set (match_operand:V4SI 0 "register_operand" "=v")
4927 (unsigned_fix:V4SI (match_operand:V4DF 1 "nonimmediate_operand" "vm")))]
4928 "TARGET_AVX512VL && TARGET_AVX512F"
4929 "vcvttpd2udq{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4930 [(set_attr "type" "ssecvt")
4931 (set_attr "prefix" "maybe_evex")
4932 (set_attr "mode" "OI")])
4934 (define_insn "<fixsuffix>fix_trunc<mode><sseintvecmodelower>2<mask_name><round_saeonly_name>"
4935 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
4936 (any_fix:<sseintvecmode>
4937 (match_operand:VF2_AVX512VL 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
4938 "TARGET_AVX512DQ && <round_saeonly_mode512bit_condition>"
4939 "vcvttpd2<fixsuffix>qq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
4940 [(set_attr "type" "ssecvt")
4941 (set_attr "prefix" "evex")
4942 (set_attr "mode" "<sseintvecmode2>")])
4944 (define_insn "fix_notrunc<mode><sseintvecmodelower>2<mask_name><round_name>"
4945 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
4946 (unspec:<sseintvecmode>
4947 [(match_operand:VF2_AVX512VL 1 "<round_nimm_predicate>" "<round_constraint>")]
4948 UNSPEC_FIX_NOTRUNC))]
4949 "TARGET_AVX512DQ && <round_mode512bit_condition>"
4950 "vcvtpd2qq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4951 [(set_attr "type" "ssecvt")
4952 (set_attr "prefix" "evex")
4953 (set_attr "mode" "<sseintvecmode2>")])
4955 (define_insn "ufix_notrunc<mode><sseintvecmodelower>2<mask_name><round_name>"
4956 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
4957 (unspec:<sseintvecmode>
4958 [(match_operand:VF2_AVX512VL 1 "nonimmediate_operand" "<round_constraint>")]
4959 UNSPEC_UNSIGNED_FIX_NOTRUNC))]
4960 "TARGET_AVX512DQ && <round_mode512bit_condition>"
4961 "vcvtpd2uqq\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
4962 [(set_attr "type" "ssecvt")
4963 (set_attr "prefix" "evex")
4964 (set_attr "mode" "<sseintvecmode2>")])
4966 (define_insn "<fixsuffix>fix_trunc<mode><sselongvecmodelower>2<mask_name><round_saeonly_name>"
4967 [(set (match_operand:<sselongvecmode> 0 "register_operand" "=v")
4968 (any_fix:<sselongvecmode>
4969 (match_operand:VF1_128_256VL 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
4970 "TARGET_AVX512DQ && <round_saeonly_modev8sf_condition>"
4971 "vcvttps2<fixsuffix>qq\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
4972 [(set_attr "type" "ssecvt")
4973 (set_attr "prefix" "evex")
4974 (set_attr "mode" "<sseintvecmode3>")])
4976 (define_insn "<fixsuffix>fix_truncv2sfv2di2<mask_name>"
4977 [(set (match_operand:V2DI 0 "register_operand" "=v")
4980 (match_operand:V4SF 1 "nonimmediate_operand" "vm")
4981 (parallel [(const_int 0) (const_int 1)]))))]
4982 "TARGET_AVX512DQ && TARGET_AVX512VL"
4983 "vcvttps2<fixsuffix>qq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
4984 [(set_attr "type" "ssecvt")
4985 (set_attr "prefix" "evex")
4986 (set_attr "mode" "TI")])
4988 (define_insn "ufix_trunc<mode><sseintvecmodelower>2<mask_name>"
4989 [(set (match_operand:<sseintvecmode> 0 "register_operand" "=v")
4990 (unsigned_fix:<sseintvecmode>
4991 (match_operand:VF1_128_256VL 1 "nonimmediate_operand" "vm")))]
4993 "vcvttps2udq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
4994 [(set_attr "type" "ssecvt")
4995 (set_attr "prefix" "evex")
4996 (set_attr "mode" "<sseintvecmode2>")])
4998 (define_expand "avx_cvttpd2dq256_2"
4999 [(set (match_operand:V8SI 0 "register_operand")
5001 (fix:V4SI (match_operand:V4DF 1 "nonimmediate_operand"))
5004 "operands[2] = CONST0_RTX (V4SImode);")
5006 (define_insn "sse2_cvttpd2dq<mask_name>"
5007 [(set (match_operand:V4SI 0 "register_operand" "=v")
5009 (fix:V2SI (match_operand:V2DF 1 "vector_operand" "vBm"))
5010 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
5011 "TARGET_SSE2 && <mask_avx512vl_condition>"
5014 return "vcvttpd2dq{x}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}";
5016 return "cvttpd2dq\t{%1, %0|%0, %1}";
5018 [(set_attr "type" "ssecvt")
5019 (set_attr "amdfam10_decode" "double")
5020 (set_attr "athlon_decode" "vector")
5021 (set_attr "bdver1_decode" "double")
5022 (set_attr "prefix" "maybe_vex")
5023 (set_attr "mode" "TI")])
5025 (define_insn "sse2_cvtsd2ss<round_name>"
5026 [(set (match_operand:V4SF 0 "register_operand" "=x,x,v")
5029 (float_truncate:V2SF
5030 (match_operand:V2DF 2 "nonimmediate_operand" "x,m,<round_constraint>")))
5031 (match_operand:V4SF 1 "register_operand" "0,0,v")
5035 cvtsd2ss\t{%2, %0|%0, %2}
5036 cvtsd2ss\t{%2, %0|%0, %q2}
5037 vcvtsd2ss\t{<round_op3>%2, %1, %0|%0, %1, %q2<round_op3>}"
5038 [(set_attr "isa" "noavx,noavx,avx")
5039 (set_attr "type" "ssecvt")
5040 (set_attr "athlon_decode" "vector,double,*")
5041 (set_attr "amdfam10_decode" "vector,double,*")
5042 (set_attr "bdver1_decode" "direct,direct,*")
5043 (set_attr "btver2_decode" "double,double,double")
5044 (set_attr "prefix" "orig,orig,<round_prefix>")
5045 (set_attr "mode" "SF")])
5047 (define_insn "*sse2_vd_cvtsd2ss"
5048 [(set (match_operand:V4SF 0 "register_operand" "=x,x,v")
5051 (float_truncate:SF (match_operand:DF 2 "nonimmediate_operand" "x,m,vm")))
5052 (match_operand:V4SF 1 "register_operand" "0,0,v")
5056 cvtsd2ss\t{%2, %0|%0, %2}
5057 cvtsd2ss\t{%2, %0|%0, %2}
5058 vcvtsd2ss\t{%2, %1, %0|%0, %1, %2}"
5059 [(set_attr "isa" "noavx,noavx,avx")
5060 (set_attr "type" "ssecvt")
5061 (set_attr "athlon_decode" "vector,double,*")
5062 (set_attr "amdfam10_decode" "vector,double,*")
5063 (set_attr "bdver1_decode" "direct,direct,*")
5064 (set_attr "btver2_decode" "double,double,double")
5065 (set_attr "prefix" "orig,orig,vex")
5066 (set_attr "mode" "SF")])
5068 (define_insn "sse2_cvtss2sd<round_saeonly_name>"
5069 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
5073 (match_operand:V4SF 2 "<round_saeonly_nimm_scalar_predicate>" "x,m,<round_saeonly_constraint>")
5074 (parallel [(const_int 0) (const_int 1)])))
5075 (match_operand:V2DF 1 "register_operand" "0,0,v")
5079 cvtss2sd\t{%2, %0|%0, %2}
5080 cvtss2sd\t{%2, %0|%0, %k2}
5081 vcvtss2sd\t{<round_saeonly_op3>%2, %1, %0|%0, %1, %k2<round_saeonly_op3>}"
5082 [(set_attr "isa" "noavx,noavx,avx")
5083 (set_attr "type" "ssecvt")
5084 (set_attr "amdfam10_decode" "vector,double,*")
5085 (set_attr "athlon_decode" "direct,direct,*")
5086 (set_attr "bdver1_decode" "direct,direct,*")
5087 (set_attr "btver2_decode" "double,double,double")
5088 (set_attr "prefix" "orig,orig,<round_saeonly_prefix>")
5089 (set_attr "mode" "DF")])
5091 (define_insn "*sse2_vd_cvtss2sd"
5092 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
5095 (float_extend:DF (match_operand:SF 2 "nonimmediate_operand" "x,m,vm")))
5096 (match_operand:V2DF 1 "register_operand" "0,0,v")
5100 cvtss2sd\t{%2, %0|%0, %2}
5101 cvtss2sd\t{%2, %0|%0, %2}
5102 vcvtss2sd\t{%2, %1, %0|%0, %1, %2}"
5103 [(set_attr "isa" "noavx,noavx,avx")
5104 (set_attr "type" "ssecvt")
5105 (set_attr "amdfam10_decode" "vector,double,*")
5106 (set_attr "athlon_decode" "direct,direct,*")
5107 (set_attr "bdver1_decode" "direct,direct,*")
5108 (set_attr "btver2_decode" "double,double,double")
5109 (set_attr "prefix" "orig,orig,vex")
5110 (set_attr "mode" "DF")])
5112 (define_insn "<mask_codefor>avx512f_cvtpd2ps512<mask_name><round_name>"
5113 [(set (match_operand:V8SF 0 "register_operand" "=v")
5114 (float_truncate:V8SF
5115 (match_operand:V8DF 1 "<round_nimm_predicate>" "<round_constraint>")))]
5117 "vcvtpd2ps\t{<round_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_mask_op2>}"
5118 [(set_attr "type" "ssecvt")
5119 (set_attr "prefix" "evex")
5120 (set_attr "mode" "V8SF")])
5122 (define_insn "avx_cvtpd2ps256<mask_name>"
5123 [(set (match_operand:V4SF 0 "register_operand" "=v")
5124 (float_truncate:V4SF
5125 (match_operand:V4DF 1 "nonimmediate_operand" "vm")))]
5126 "TARGET_AVX && <mask_avx512vl_condition>"
5127 "vcvtpd2ps{y}\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
5128 [(set_attr "type" "ssecvt")
5129 (set_attr "prefix" "maybe_evex")
5130 (set_attr "btver2_decode" "vector")
5131 (set_attr "mode" "V4SF")])
5133 (define_expand "sse2_cvtpd2ps"
5134 [(set (match_operand:V4SF 0 "register_operand")
5136 (float_truncate:V2SF
5137 (match_operand:V2DF 1 "vector_operand"))
5140 "operands[2] = CONST0_RTX (V2SFmode);")
5142 (define_expand "sse2_cvtpd2ps_mask"
5143 [(set (match_operand:V4SF 0 "register_operand")
5146 (float_truncate:V2SF
5147 (match_operand:V2DF 1 "vector_operand"))
5149 (match_operand:V4SF 2 "register_operand")
5150 (match_operand:QI 3 "register_operand")))]
5152 "operands[4] = CONST0_RTX (V2SFmode);")
5154 (define_insn "*sse2_cvtpd2ps<mask_name>"
5155 [(set (match_operand:V4SF 0 "register_operand" "=v")
5157 (float_truncate:V2SF
5158 (match_operand:V2DF 1 "vector_operand" "vBm"))
5159 (match_operand:V2SF 2 "const0_operand")))]
5160 "TARGET_SSE2 && <mask_avx512vl_condition>"
5163 return "vcvtpd2ps{x}\t{%1, %0<mask_operand3>|%0<mask_operand3>, %1}";
5165 return "cvtpd2ps\t{%1, %0|%0, %1}";
5167 [(set_attr "type" "ssecvt")
5168 (set_attr "amdfam10_decode" "double")
5169 (set_attr "athlon_decode" "vector")
5170 (set_attr "bdver1_decode" "double")
5171 (set_attr "prefix_data16" "1")
5172 (set_attr "prefix" "maybe_vex")
5173 (set_attr "mode" "V4SF")])
5175 ;; For <sse2_avx_avx512f>_cvtps2pd<avxsizesuffix> insn pattern
5176 (define_mode_attr sf2dfmode
5177 [(V8DF "V8SF") (V4DF "V4SF")])
5179 (define_insn "<sse2_avx_avx512f>_cvtps2pd<avxsizesuffix><mask_name><round_saeonly_name>"
5180 [(set (match_operand:VF2_512_256 0 "register_operand" "=v")
5181 (float_extend:VF2_512_256
5182 (match_operand:<sf2dfmode> 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")))]
5183 "TARGET_AVX && <mask_mode512bit_condition> && <round_saeonly_mode512bit_condition>"
5184 "vcvtps2pd\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
5185 [(set_attr "type" "ssecvt")
5186 (set_attr "prefix" "maybe_vex")
5187 (set_attr "mode" "<MODE>")])
5189 (define_insn "*avx_cvtps2pd256_2"
5190 [(set (match_operand:V4DF 0 "register_operand" "=v")
5193 (match_operand:V8SF 1 "nonimmediate_operand" "vm")
5194 (parallel [(const_int 0) (const_int 1)
5195 (const_int 2) (const_int 3)]))))]
5197 "vcvtps2pd\t{%x1, %0|%0, %x1}"
5198 [(set_attr "type" "ssecvt")
5199 (set_attr "prefix" "vex")
5200 (set_attr "mode" "V4DF")])
5202 (define_insn "vec_unpacks_lo_v16sf"
5203 [(set (match_operand:V8DF 0 "register_operand" "=v")
5206 (match_operand:V16SF 1 "nonimmediate_operand" "vm")
5207 (parallel [(const_int 0) (const_int 1)
5208 (const_int 2) (const_int 3)
5209 (const_int 4) (const_int 5)
5210 (const_int 6) (const_int 7)]))))]
5212 "vcvtps2pd\t{%t1, %0|%0, %t1}"
5213 [(set_attr "type" "ssecvt")
5214 (set_attr "prefix" "evex")
5215 (set_attr "mode" "V8DF")])
5217 (define_insn "<avx512>_cvt<ssemodesuffix>2mask<mode>"
5218 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
5219 (unspec:<avx512fmaskmode>
5220 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")]
5221 UNSPEC_CVTINT2MASK))]
5223 "vpmov<ssemodesuffix>2m\t{%1, %0|%0, %1}"
5224 [(set_attr "prefix" "evex")
5225 (set_attr "mode" "<sseinsnmode>")])
5227 (define_insn "<avx512>_cvt<ssemodesuffix>2mask<mode>"
5228 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
5229 (unspec:<avx512fmaskmode>
5230 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")]
5231 UNSPEC_CVTINT2MASK))]
5233 "vpmov<ssemodesuffix>2m\t{%1, %0|%0, %1}"
5234 [(set_attr "prefix" "evex")
5235 (set_attr "mode" "<sseinsnmode>")])
5237 (define_expand "<avx512>_cvtmask2<ssemodesuffix><mode>"
5238 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
5239 (vec_merge:VI12_AVX512VL
5242 (match_operand:<avx512fmaskmode> 1 "register_operand")))]
5245 operands[2] = CONSTM1_RTX (<MODE>mode);
5246 operands[3] = CONST0_RTX (<MODE>mode);
5249 (define_insn "*<avx512>_cvtmask2<ssemodesuffix><mode>"
5250 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
5251 (vec_merge:VI12_AVX512VL
5252 (match_operand:VI12_AVX512VL 2 "vector_all_ones_operand")
5253 (match_operand:VI12_AVX512VL 3 "const0_operand")
5254 (match_operand:<avx512fmaskmode> 1 "register_operand" "Yk")))]
5256 "vpmovm2<ssemodesuffix>\t{%1, %0|%0, %1}"
5257 [(set_attr "prefix" "evex")
5258 (set_attr "mode" "<sseinsnmode>")])
5260 (define_expand "<avx512>_cvtmask2<ssemodesuffix><mode>"
5261 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
5262 (vec_merge:VI48_AVX512VL
5265 (match_operand:<avx512fmaskmode> 1 "register_operand")))]
5268 operands[2] = CONSTM1_RTX (<MODE>mode);
5269 operands[3] = CONST0_RTX (<MODE>mode);
5272 (define_insn "*<avx512>_cvtmask2<ssemodesuffix><mode>"
5273 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
5274 (vec_merge:VI48_AVX512VL
5275 (match_operand:VI48_AVX512VL 2 "vector_all_ones_operand")
5276 (match_operand:VI48_AVX512VL 3 "const0_operand")
5277 (match_operand:<avx512fmaskmode> 1 "register_operand" "Yk")))]
5279 "vpmovm2<ssemodesuffix>\t{%1, %0|%0, %1}"
5280 [(set_attr "prefix" "evex")
5281 (set_attr "mode" "<sseinsnmode>")])
5283 (define_insn "sse2_cvtps2pd<mask_name>"
5284 [(set (match_operand:V2DF 0 "register_operand" "=v")
5287 (match_operand:V4SF 1 "vector_operand" "vm")
5288 (parallel [(const_int 0) (const_int 1)]))))]
5289 "TARGET_SSE2 && <mask_avx512vl_condition>"
5290 "%vcvtps2pd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
5291 [(set_attr "type" "ssecvt")
5292 (set_attr "amdfam10_decode" "direct")
5293 (set_attr "athlon_decode" "double")
5294 (set_attr "bdver1_decode" "double")
5295 (set_attr "prefix_data16" "0")
5296 (set_attr "prefix" "maybe_vex")
5297 (set_attr "mode" "V2DF")])
5299 (define_expand "vec_unpacks_hi_v4sf"
5304 (match_operand:V4SF 1 "vector_operand"))
5305 (parallel [(const_int 6) (const_int 7)
5306 (const_int 2) (const_int 3)])))
5307 (set (match_operand:V2DF 0 "register_operand")
5311 (parallel [(const_int 0) (const_int 1)]))))]
5313 "operands[2] = gen_reg_rtx (V4SFmode);")
5315 (define_expand "vec_unpacks_hi_v8sf"
5318 (match_operand:V8SF 1 "register_operand")
5319 (parallel [(const_int 4) (const_int 5)
5320 (const_int 6) (const_int 7)])))
5321 (set (match_operand:V4DF 0 "register_operand")
5325 "operands[2] = gen_reg_rtx (V4SFmode);")
5327 (define_expand "vec_unpacks_hi_v16sf"
5330 (match_operand:V16SF 1 "register_operand")
5331 (parallel [(const_int 8) (const_int 9)
5332 (const_int 10) (const_int 11)
5333 (const_int 12) (const_int 13)
5334 (const_int 14) (const_int 15)])))
5335 (set (match_operand:V8DF 0 "register_operand")
5339 "operands[2] = gen_reg_rtx (V8SFmode);")
5341 (define_expand "vec_unpacks_lo_v4sf"
5342 [(set (match_operand:V2DF 0 "register_operand")
5345 (match_operand:V4SF 1 "vector_operand")
5346 (parallel [(const_int 0) (const_int 1)]))))]
5349 (define_expand "vec_unpacks_lo_v8sf"
5350 [(set (match_operand:V4DF 0 "register_operand")
5353 (match_operand:V8SF 1 "nonimmediate_operand")
5354 (parallel [(const_int 0) (const_int 1)
5355 (const_int 2) (const_int 3)]))))]
5358 (define_mode_attr sseunpackfltmode
5359 [(V8HI "V4SF") (V4SI "V2DF") (V16HI "V8SF")
5360 (V8SI "V4DF") (V32HI "V16SF") (V16SI "V8DF")])
5362 (define_expand "vec_unpacks_float_hi_<mode>"
5363 [(match_operand:<sseunpackfltmode> 0 "register_operand")
5364 (match_operand:VI2_AVX512F 1 "register_operand")]
5367 rtx tmp = gen_reg_rtx (<sseunpackmode>mode);
5369 emit_insn (gen_vec_unpacks_hi_<mode> (tmp, operands[1]));
5370 emit_insn (gen_rtx_SET (operands[0],
5371 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
5375 (define_expand "vec_unpacks_float_lo_<mode>"
5376 [(match_operand:<sseunpackfltmode> 0 "register_operand")
5377 (match_operand:VI2_AVX512F 1 "register_operand")]
5380 rtx tmp = gen_reg_rtx (<sseunpackmode>mode);
5382 emit_insn (gen_vec_unpacks_lo_<mode> (tmp, operands[1]));
5383 emit_insn (gen_rtx_SET (operands[0],
5384 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
5388 (define_expand "vec_unpacku_float_hi_<mode>"
5389 [(match_operand:<sseunpackfltmode> 0 "register_operand")
5390 (match_operand:VI2_AVX512F 1 "register_operand")]
5393 rtx tmp = gen_reg_rtx (<sseunpackmode>mode);
5395 emit_insn (gen_vec_unpacku_hi_<mode> (tmp, operands[1]));
5396 emit_insn (gen_rtx_SET (operands[0],
5397 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
5401 (define_expand "vec_unpacku_float_lo_<mode>"
5402 [(match_operand:<sseunpackfltmode> 0 "register_operand")
5403 (match_operand:VI2_AVX512F 1 "register_operand")]
5406 rtx tmp = gen_reg_rtx (<sseunpackmode>mode);
5408 emit_insn (gen_vec_unpacku_lo_<mode> (tmp, operands[1]));
5409 emit_insn (gen_rtx_SET (operands[0],
5410 gen_rtx_FLOAT (<sseunpackfltmode>mode, tmp)));
5414 (define_expand "vec_unpacks_float_hi_v4si"
5417 (match_operand:V4SI 1 "vector_operand")
5418 (parallel [(const_int 2) (const_int 3)
5419 (const_int 2) (const_int 3)])))
5420 (set (match_operand:V2DF 0 "register_operand")
5424 (parallel [(const_int 0) (const_int 1)]))))]
5426 "operands[2] = gen_reg_rtx (V4SImode);")
5428 (define_expand "vec_unpacks_float_lo_v4si"
5429 [(set (match_operand:V2DF 0 "register_operand")
5432 (match_operand:V4SI 1 "vector_operand")
5433 (parallel [(const_int 0) (const_int 1)]))))]
5436 (define_expand "vec_unpacks_float_hi_v8si"
5439 (match_operand:V8SI 1 "vector_operand")
5440 (parallel [(const_int 4) (const_int 5)
5441 (const_int 6) (const_int 7)])))
5442 (set (match_operand:V4DF 0 "register_operand")
5446 "operands[2] = gen_reg_rtx (V4SImode);")
5448 (define_expand "vec_unpacks_float_lo_v8si"
5449 [(set (match_operand:V4DF 0 "register_operand")
5452 (match_operand:V8SI 1 "nonimmediate_operand")
5453 (parallel [(const_int 0) (const_int 1)
5454 (const_int 2) (const_int 3)]))))]
5457 (define_expand "vec_unpacks_float_hi_v16si"
5460 (match_operand:V16SI 1 "nonimmediate_operand")
5461 (parallel [(const_int 8) (const_int 9)
5462 (const_int 10) (const_int 11)
5463 (const_int 12) (const_int 13)
5464 (const_int 14) (const_int 15)])))
5465 (set (match_operand:V8DF 0 "register_operand")
5469 "operands[2] = gen_reg_rtx (V8SImode);")
5471 (define_expand "vec_unpacks_float_lo_v16si"
5472 [(set (match_operand:V8DF 0 "register_operand")
5475 (match_operand:V16SI 1 "nonimmediate_operand")
5476 (parallel [(const_int 0) (const_int 1)
5477 (const_int 2) (const_int 3)
5478 (const_int 4) (const_int 5)
5479 (const_int 6) (const_int 7)]))))]
5482 (define_expand "vec_unpacku_float_hi_v4si"
5485 (match_operand:V4SI 1 "vector_operand")
5486 (parallel [(const_int 2) (const_int 3)
5487 (const_int 2) (const_int 3)])))
5492 (parallel [(const_int 0) (const_int 1)]))))
5494 (lt:V2DF (match_dup 6) (match_dup 3)))
5496 (and:V2DF (match_dup 7) (match_dup 4)))
5497 (set (match_operand:V2DF 0 "register_operand")
5498 (plus:V2DF (match_dup 6) (match_dup 8)))]
5501 REAL_VALUE_TYPE TWO32r;
5505 real_ldexp (&TWO32r, &dconst1, 32);
5506 x = const_double_from_real_value (TWO32r, DFmode);
5508 operands[3] = force_reg (V2DFmode, CONST0_RTX (V2DFmode));
5509 operands[4] = force_reg (V2DFmode,
5510 ix86_build_const_vector (V2DFmode, 1, x));
5512 operands[5] = gen_reg_rtx (V4SImode);
5514 for (i = 6; i < 9; i++)
5515 operands[i] = gen_reg_rtx (V2DFmode);
5518 (define_expand "vec_unpacku_float_lo_v4si"
5522 (match_operand:V4SI 1 "vector_operand")
5523 (parallel [(const_int 0) (const_int 1)]))))
5525 (lt:V2DF (match_dup 5) (match_dup 3)))
5527 (and:V2DF (match_dup 6) (match_dup 4)))
5528 (set (match_operand:V2DF 0 "register_operand")
5529 (plus:V2DF (match_dup 5) (match_dup 7)))]
5532 REAL_VALUE_TYPE TWO32r;
5536 real_ldexp (&TWO32r, &dconst1, 32);
5537 x = const_double_from_real_value (TWO32r, DFmode);
5539 operands[3] = force_reg (V2DFmode, CONST0_RTX (V2DFmode));
5540 operands[4] = force_reg (V2DFmode,
5541 ix86_build_const_vector (V2DFmode, 1, x));
5543 for (i = 5; i < 8; i++)
5544 operands[i] = gen_reg_rtx (V2DFmode);
5547 (define_expand "vec_unpacku_float_hi_v8si"
5548 [(match_operand:V4DF 0 "register_operand")
5549 (match_operand:V8SI 1 "register_operand")]
5552 REAL_VALUE_TYPE TWO32r;
5556 real_ldexp (&TWO32r, &dconst1, 32);
5557 x = const_double_from_real_value (TWO32r, DFmode);
5559 tmp[0] = force_reg (V4DFmode, CONST0_RTX (V4DFmode));
5560 tmp[1] = force_reg (V4DFmode, ix86_build_const_vector (V4DFmode, 1, x));
5561 tmp[5] = gen_reg_rtx (V4SImode);
5563 for (i = 2; i < 5; i++)
5564 tmp[i] = gen_reg_rtx (V4DFmode);
5565 emit_insn (gen_vec_extract_hi_v8si (tmp[5], operands[1]));
5566 emit_insn (gen_floatv4siv4df2 (tmp[2], tmp[5]));
5567 emit_insn (gen_rtx_SET (tmp[3], gen_rtx_LT (V4DFmode, tmp[2], tmp[0])));
5568 emit_insn (gen_andv4df3 (tmp[4], tmp[3], tmp[1]));
5569 emit_insn (gen_addv4df3 (operands[0], tmp[2], tmp[4]));
5573 (define_expand "vec_unpacku_float_hi_v16si"
5574 [(match_operand:V8DF 0 "register_operand")
5575 (match_operand:V16SI 1 "register_operand")]
5578 REAL_VALUE_TYPE TWO32r;
5581 real_ldexp (&TWO32r, &dconst1, 32);
5582 x = const_double_from_real_value (TWO32r, DFmode);
5584 tmp[0] = force_reg (V8DFmode, CONST0_RTX (V8DFmode));
5585 tmp[1] = force_reg (V8DFmode, ix86_build_const_vector (V8DFmode, 1, x));
5586 tmp[2] = gen_reg_rtx (V8DFmode);
5587 tmp[3] = gen_reg_rtx (V8SImode);
5588 k = gen_reg_rtx (QImode);
5590 emit_insn (gen_vec_extract_hi_v16si (tmp[3], operands[1]));
5591 emit_insn (gen_floatv8siv8df2 (tmp[2], tmp[3]));
5592 emit_insn (gen_rtx_SET (k, gen_rtx_LT (QImode, tmp[2], tmp[0])));
5593 emit_insn (gen_addv8df3_mask (tmp[2], tmp[2], tmp[1], tmp[2], k));
5594 emit_move_insn (operands[0], tmp[2]);
5598 (define_expand "vec_unpacku_float_lo_v8si"
5599 [(match_operand:V4DF 0 "register_operand")
5600 (match_operand:V8SI 1 "nonimmediate_operand")]
5603 REAL_VALUE_TYPE TWO32r;
5607 real_ldexp (&TWO32r, &dconst1, 32);
5608 x = const_double_from_real_value (TWO32r, DFmode);
5610 tmp[0] = force_reg (V4DFmode, CONST0_RTX (V4DFmode));
5611 tmp[1] = force_reg (V4DFmode, ix86_build_const_vector (V4DFmode, 1, x));
5613 for (i = 2; i < 5; i++)
5614 tmp[i] = gen_reg_rtx (V4DFmode);
5615 emit_insn (gen_avx_cvtdq2pd256_2 (tmp[2], operands[1]));
5616 emit_insn (gen_rtx_SET (tmp[3], gen_rtx_LT (V4DFmode, tmp[2], tmp[0])));
5617 emit_insn (gen_andv4df3 (tmp[4], tmp[3], tmp[1]));
5618 emit_insn (gen_addv4df3 (operands[0], tmp[2], tmp[4]));
5622 (define_expand "vec_unpacku_float_lo_v16si"
5623 [(match_operand:V8DF 0 "register_operand")
5624 (match_operand:V16SI 1 "nonimmediate_operand")]
5627 REAL_VALUE_TYPE TWO32r;
5630 real_ldexp (&TWO32r, &dconst1, 32);
5631 x = const_double_from_real_value (TWO32r, DFmode);
5633 tmp[0] = force_reg (V8DFmode, CONST0_RTX (V8DFmode));
5634 tmp[1] = force_reg (V8DFmode, ix86_build_const_vector (V8DFmode, 1, x));
5635 tmp[2] = gen_reg_rtx (V8DFmode);
5636 k = gen_reg_rtx (QImode);
5638 emit_insn (gen_avx512f_cvtdq2pd512_2 (tmp[2], operands[1]));
5639 emit_insn (gen_rtx_SET (k, gen_rtx_LT (QImode, tmp[2], tmp[0])));
5640 emit_insn (gen_addv8df3_mask (tmp[2], tmp[2], tmp[1], tmp[2], k));
5641 emit_move_insn (operands[0], tmp[2]);
5645 (define_expand "vec_pack_trunc_<mode>"
5647 (float_truncate:<sf2dfmode>
5648 (match_operand:VF2_512_256 1 "nonimmediate_operand")))
5650 (float_truncate:<sf2dfmode>
5651 (match_operand:VF2_512_256 2 "nonimmediate_operand")))
5652 (set (match_operand:<ssePSmode> 0 "register_operand")
5653 (vec_concat:<ssePSmode>
5658 operands[3] = gen_reg_rtx (<sf2dfmode>mode);
5659 operands[4] = gen_reg_rtx (<sf2dfmode>mode);
5662 (define_expand "vec_pack_trunc_v2df"
5663 [(match_operand:V4SF 0 "register_operand")
5664 (match_operand:V2DF 1 "vector_operand")
5665 (match_operand:V2DF 2 "vector_operand")]
5670 if (TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
5672 tmp0 = gen_reg_rtx (V4DFmode);
5673 tmp1 = force_reg (V2DFmode, operands[1]);
5675 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
5676 emit_insn (gen_avx_cvtpd2ps256 (operands[0], tmp0));
5680 tmp0 = gen_reg_rtx (V4SFmode);
5681 tmp1 = gen_reg_rtx (V4SFmode);
5683 emit_insn (gen_sse2_cvtpd2ps (tmp0, operands[1]));
5684 emit_insn (gen_sse2_cvtpd2ps (tmp1, operands[2]));
5685 emit_insn (gen_sse_movlhps (operands[0], tmp0, tmp1));
5690 (define_expand "vec_pack_sfix_trunc_v8df"
5691 [(match_operand:V16SI 0 "register_operand")
5692 (match_operand:V8DF 1 "nonimmediate_operand")
5693 (match_operand:V8DF 2 "nonimmediate_operand")]
5698 r1 = gen_reg_rtx (V8SImode);
5699 r2 = gen_reg_rtx (V8SImode);
5701 emit_insn (gen_fix_truncv8dfv8si2 (r1, operands[1]));
5702 emit_insn (gen_fix_truncv8dfv8si2 (r2, operands[2]));
5703 emit_insn (gen_avx_vec_concatv16si (operands[0], r1, r2));
5707 (define_expand "vec_pack_sfix_trunc_v4df"
5708 [(match_operand:V8SI 0 "register_operand")
5709 (match_operand:V4DF 1 "nonimmediate_operand")
5710 (match_operand:V4DF 2 "nonimmediate_operand")]
5715 r1 = gen_reg_rtx (V4SImode);
5716 r2 = gen_reg_rtx (V4SImode);
5718 emit_insn (gen_fix_truncv4dfv4si2 (r1, operands[1]));
5719 emit_insn (gen_fix_truncv4dfv4si2 (r2, operands[2]));
5720 emit_insn (gen_avx_vec_concatv8si (operands[0], r1, r2));
5724 (define_expand "vec_pack_sfix_trunc_v2df"
5725 [(match_operand:V4SI 0 "register_operand")
5726 (match_operand:V2DF 1 "vector_operand")
5727 (match_operand:V2DF 2 "vector_operand")]
5730 rtx tmp0, tmp1, tmp2;
5732 if (TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
5734 tmp0 = gen_reg_rtx (V4DFmode);
5735 tmp1 = force_reg (V2DFmode, operands[1]);
5737 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
5738 emit_insn (gen_fix_truncv4dfv4si2 (operands[0], tmp0));
5742 tmp0 = gen_reg_rtx (V4SImode);
5743 tmp1 = gen_reg_rtx (V4SImode);
5744 tmp2 = gen_reg_rtx (V2DImode);
5746 emit_insn (gen_sse2_cvttpd2dq (tmp0, operands[1]));
5747 emit_insn (gen_sse2_cvttpd2dq (tmp1, operands[2]));
5748 emit_insn (gen_vec_interleave_lowv2di (tmp2,
5749 gen_lowpart (V2DImode, tmp0),
5750 gen_lowpart (V2DImode, tmp1)));
5751 emit_move_insn (operands[0], gen_lowpart (V4SImode, tmp2));
5756 (define_mode_attr ssepackfltmode
5757 [(V8DF "V16SI") (V4DF "V8SI") (V2DF "V4SI")])
5759 (define_expand "vec_pack_ufix_trunc_<mode>"
5760 [(match_operand:<ssepackfltmode> 0 "register_operand")
5761 (match_operand:VF2 1 "register_operand")
5762 (match_operand:VF2 2 "register_operand")]
5765 if (<MODE>mode == V8DFmode)
5769 r1 = gen_reg_rtx (V8SImode);
5770 r2 = gen_reg_rtx (V8SImode);
5772 emit_insn (gen_ufix_truncv8dfv8si2 (r1, operands[1]));
5773 emit_insn (gen_ufix_truncv8dfv8si2 (r2, operands[2]));
5774 emit_insn (gen_avx_vec_concatv16si (operands[0], r1, r2));
5779 tmp[0] = ix86_expand_adjust_ufix_to_sfix_si (operands[1], &tmp[2]);
5780 tmp[1] = ix86_expand_adjust_ufix_to_sfix_si (operands[2], &tmp[3]);
5781 tmp[4] = gen_reg_rtx (<ssepackfltmode>mode);
5782 emit_insn (gen_vec_pack_sfix_trunc_<mode> (tmp[4], tmp[0], tmp[1]));
5783 if (<ssepackfltmode>mode == V4SImode || TARGET_AVX2)
5785 tmp[5] = gen_reg_rtx (<ssepackfltmode>mode);
5786 ix86_expand_vec_extract_even_odd (tmp[5], tmp[2], tmp[3], 0);
5790 tmp[5] = gen_reg_rtx (V8SFmode);
5791 ix86_expand_vec_extract_even_odd (tmp[5],
5792 gen_lowpart (V8SFmode, tmp[2]),
5793 gen_lowpart (V8SFmode, tmp[3]), 0);
5794 tmp[5] = gen_lowpart (V8SImode, tmp[5]);
5796 tmp[6] = expand_simple_binop (<ssepackfltmode>mode, XOR, tmp[4], tmp[5],
5797 operands[0], 0, OPTAB_DIRECT);
5798 if (tmp[6] != operands[0])
5799 emit_move_insn (operands[0], tmp[6]);
5805 (define_expand "vec_pack_sfix_v4df"
5806 [(match_operand:V8SI 0 "register_operand")
5807 (match_operand:V4DF 1 "nonimmediate_operand")
5808 (match_operand:V4DF 2 "nonimmediate_operand")]
5813 r1 = gen_reg_rtx (V4SImode);
5814 r2 = gen_reg_rtx (V4SImode);
5816 emit_insn (gen_avx_cvtpd2dq256 (r1, operands[1]));
5817 emit_insn (gen_avx_cvtpd2dq256 (r2, operands[2]));
5818 emit_insn (gen_avx_vec_concatv8si (operands[0], r1, r2));
5822 (define_expand "vec_pack_sfix_v2df"
5823 [(match_operand:V4SI 0 "register_operand")
5824 (match_operand:V2DF 1 "vector_operand")
5825 (match_operand:V2DF 2 "vector_operand")]
5828 rtx tmp0, tmp1, tmp2;
5830 if (TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
5832 tmp0 = gen_reg_rtx (V4DFmode);
5833 tmp1 = force_reg (V2DFmode, operands[1]);
5835 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
5836 emit_insn (gen_avx_cvtpd2dq256 (operands[0], tmp0));
5840 tmp0 = gen_reg_rtx (V4SImode);
5841 tmp1 = gen_reg_rtx (V4SImode);
5842 tmp2 = gen_reg_rtx (V2DImode);
5844 emit_insn (gen_sse2_cvtpd2dq (tmp0, operands[1]));
5845 emit_insn (gen_sse2_cvtpd2dq (tmp1, operands[2]));
5846 emit_insn (gen_vec_interleave_lowv2di (tmp2,
5847 gen_lowpart (V2DImode, tmp0),
5848 gen_lowpart (V2DImode, tmp1)));
5849 emit_move_insn (operands[0], gen_lowpart (V4SImode, tmp2));
5854 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5856 ;; Parallel single-precision floating point element swizzling
5858 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5860 (define_expand "sse_movhlps_exp"
5861 [(set (match_operand:V4SF 0 "nonimmediate_operand")
5864 (match_operand:V4SF 1 "nonimmediate_operand")
5865 (match_operand:V4SF 2 "nonimmediate_operand"))
5866 (parallel [(const_int 6)
5872 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
5874 emit_insn (gen_sse_movhlps (dst, operands[1], operands[2]));
5876 /* Fix up the destination if needed. */
5877 if (dst != operands[0])
5878 emit_move_insn (operands[0], dst);
5883 (define_insn "sse_movhlps"
5884 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,v,x,v,m")
5887 (match_operand:V4SF 1 "nonimmediate_operand" " 0,v,0,v,0")
5888 (match_operand:V4SF 2 "nonimmediate_operand" " x,v,o,o,v"))
5889 (parallel [(const_int 6)
5893 "TARGET_SSE && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
5895 movhlps\t{%2, %0|%0, %2}
5896 vmovhlps\t{%2, %1, %0|%0, %1, %2}
5897 movlps\t{%H2, %0|%0, %H2}
5898 vmovlps\t{%H2, %1, %0|%0, %1, %H2}
5899 %vmovhps\t{%2, %0|%q0, %2}"
5900 [(set_attr "isa" "noavx,avx,noavx,avx,*")
5901 (set_attr "type" "ssemov")
5902 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,maybe_vex")
5903 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF,V2SF")])
5905 (define_expand "sse_movlhps_exp"
5906 [(set (match_operand:V4SF 0 "nonimmediate_operand")
5909 (match_operand:V4SF 1 "nonimmediate_operand")
5910 (match_operand:V4SF 2 "nonimmediate_operand"))
5911 (parallel [(const_int 0)
5917 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
5919 emit_insn (gen_sse_movlhps (dst, operands[1], operands[2]));
5921 /* Fix up the destination if needed. */
5922 if (dst != operands[0])
5923 emit_move_insn (operands[0], dst);
5928 (define_insn "sse_movlhps"
5929 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,v,x,v,o")
5932 (match_operand:V4SF 1 "nonimmediate_operand" " 0,v,0,v,0")
5933 (match_operand:V4SF 2 "nonimmediate_operand" " x,v,m,v,v"))
5934 (parallel [(const_int 0)
5938 "TARGET_SSE && ix86_binary_operator_ok (UNKNOWN, V4SFmode, operands)"
5940 movlhps\t{%2, %0|%0, %2}
5941 vmovlhps\t{%2, %1, %0|%0, %1, %2}
5942 movhps\t{%2, %0|%0, %q2}
5943 vmovhps\t{%2, %1, %0|%0, %1, %q2}
5944 %vmovlps\t{%2, %H0|%H0, %2}"
5945 [(set_attr "isa" "noavx,avx,noavx,avx,*")
5946 (set_attr "type" "ssemov")
5947 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,maybe_vex")
5948 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF,V2SF")])
5950 (define_insn "<mask_codefor>avx512f_unpckhps512<mask_name>"
5951 [(set (match_operand:V16SF 0 "register_operand" "=v")
5954 (match_operand:V16SF 1 "register_operand" "v")
5955 (match_operand:V16SF 2 "nonimmediate_operand" "vm"))
5956 (parallel [(const_int 2) (const_int 18)
5957 (const_int 3) (const_int 19)
5958 (const_int 6) (const_int 22)
5959 (const_int 7) (const_int 23)
5960 (const_int 10) (const_int 26)
5961 (const_int 11) (const_int 27)
5962 (const_int 14) (const_int 30)
5963 (const_int 15) (const_int 31)])))]
5965 "vunpckhps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
5966 [(set_attr "type" "sselog")
5967 (set_attr "prefix" "evex")
5968 (set_attr "mode" "V16SF")])
5970 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
5971 (define_insn "avx_unpckhps256<mask_name>"
5972 [(set (match_operand:V8SF 0 "register_operand" "=v")
5975 (match_operand:V8SF 1 "register_operand" "v")
5976 (match_operand:V8SF 2 "nonimmediate_operand" "vm"))
5977 (parallel [(const_int 2) (const_int 10)
5978 (const_int 3) (const_int 11)
5979 (const_int 6) (const_int 14)
5980 (const_int 7) (const_int 15)])))]
5981 "TARGET_AVX && <mask_avx512vl_condition>"
5982 "vunpckhps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
5983 [(set_attr "type" "sselog")
5984 (set_attr "prefix" "vex")
5985 (set_attr "mode" "V8SF")])
5987 (define_expand "vec_interleave_highv8sf"
5991 (match_operand:V8SF 1 "register_operand")
5992 (match_operand:V8SF 2 "nonimmediate_operand"))
5993 (parallel [(const_int 0) (const_int 8)
5994 (const_int 1) (const_int 9)
5995 (const_int 4) (const_int 12)
5996 (const_int 5) (const_int 13)])))
6002 (parallel [(const_int 2) (const_int 10)
6003 (const_int 3) (const_int 11)
6004 (const_int 6) (const_int 14)
6005 (const_int 7) (const_int 15)])))
6006 (set (match_operand:V8SF 0 "register_operand")
6011 (parallel [(const_int 4) (const_int 5)
6012 (const_int 6) (const_int 7)
6013 (const_int 12) (const_int 13)
6014 (const_int 14) (const_int 15)])))]
6017 operands[3] = gen_reg_rtx (V8SFmode);
6018 operands[4] = gen_reg_rtx (V8SFmode);
6021 (define_insn "vec_interleave_highv4sf<mask_name>"
6022 [(set (match_operand:V4SF 0 "register_operand" "=x,v")
6025 (match_operand:V4SF 1 "register_operand" "0,v")
6026 (match_operand:V4SF 2 "vector_operand" "xBm,vm"))
6027 (parallel [(const_int 2) (const_int 6)
6028 (const_int 3) (const_int 7)])))]
6029 "TARGET_SSE && <mask_avx512vl_condition>"
6031 unpckhps\t{%2, %0|%0, %2}
6032 vunpckhps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6033 [(set_attr "isa" "noavx,avx")
6034 (set_attr "type" "sselog")
6035 (set_attr "prefix" "orig,vex")
6036 (set_attr "mode" "V4SF")])
6038 (define_insn "<mask_codefor>avx512f_unpcklps512<mask_name>"
6039 [(set (match_operand:V16SF 0 "register_operand" "=v")
6042 (match_operand:V16SF 1 "register_operand" "v")
6043 (match_operand:V16SF 2 "nonimmediate_operand" "vm"))
6044 (parallel [(const_int 0) (const_int 16)
6045 (const_int 1) (const_int 17)
6046 (const_int 4) (const_int 20)
6047 (const_int 5) (const_int 21)
6048 (const_int 8) (const_int 24)
6049 (const_int 9) (const_int 25)
6050 (const_int 12) (const_int 28)
6051 (const_int 13) (const_int 29)])))]
6053 "vunpcklps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6054 [(set_attr "type" "sselog")
6055 (set_attr "prefix" "evex")
6056 (set_attr "mode" "V16SF")])
6058 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
6059 (define_insn "avx_unpcklps256<mask_name>"
6060 [(set (match_operand:V8SF 0 "register_operand" "=v")
6063 (match_operand:V8SF 1 "register_operand" "v")
6064 (match_operand:V8SF 2 "nonimmediate_operand" "vm"))
6065 (parallel [(const_int 0) (const_int 8)
6066 (const_int 1) (const_int 9)
6067 (const_int 4) (const_int 12)
6068 (const_int 5) (const_int 13)])))]
6069 "TARGET_AVX && <mask_avx512vl_condition>"
6070 "vunpcklps\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
6071 [(set_attr "type" "sselog")
6072 (set_attr "prefix" "vex")
6073 (set_attr "mode" "V8SF")])
6075 (define_insn "unpcklps128_mask"
6076 [(set (match_operand:V4SF 0 "register_operand" "=v")
6080 (match_operand:V4SF 1 "register_operand" "v")
6081 (match_operand:V4SF 2 "nonimmediate_operand" "vm"))
6082 (parallel [(const_int 0) (const_int 4)
6083 (const_int 1) (const_int 5)]))
6084 (match_operand:V4SF 3 "vector_move_operand" "0C")
6085 (match_operand:QI 4 "register_operand" "Yk")))]
6087 "vunpcklps\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
6088 [(set_attr "type" "sselog")
6089 (set_attr "prefix" "evex")
6090 (set_attr "mode" "V4SF")])
6092 (define_expand "vec_interleave_lowv8sf"
6096 (match_operand:V8SF 1 "register_operand")
6097 (match_operand:V8SF 2 "nonimmediate_operand"))
6098 (parallel [(const_int 0) (const_int 8)
6099 (const_int 1) (const_int 9)
6100 (const_int 4) (const_int 12)
6101 (const_int 5) (const_int 13)])))
6107 (parallel [(const_int 2) (const_int 10)
6108 (const_int 3) (const_int 11)
6109 (const_int 6) (const_int 14)
6110 (const_int 7) (const_int 15)])))
6111 (set (match_operand:V8SF 0 "register_operand")
6116 (parallel [(const_int 0) (const_int 1)
6117 (const_int 2) (const_int 3)
6118 (const_int 8) (const_int 9)
6119 (const_int 10) (const_int 11)])))]
6122 operands[3] = gen_reg_rtx (V8SFmode);
6123 operands[4] = gen_reg_rtx (V8SFmode);
6126 (define_insn "vec_interleave_lowv4sf"
6127 [(set (match_operand:V4SF 0 "register_operand" "=x,v")
6130 (match_operand:V4SF 1 "register_operand" "0,v")
6131 (match_operand:V4SF 2 "vector_operand" "xBm,vm"))
6132 (parallel [(const_int 0) (const_int 4)
6133 (const_int 1) (const_int 5)])))]
6136 unpcklps\t{%2, %0|%0, %2}
6137 vunpcklps\t{%2, %1, %0|%0, %1, %2}"
6138 [(set_attr "isa" "noavx,avx")
6139 (set_attr "type" "sselog")
6140 (set_attr "prefix" "orig,maybe_evex")
6141 (set_attr "mode" "V4SF")])
6143 ;; These are modeled with the same vec_concat as the others so that we
6144 ;; capture users of shufps that can use the new instructions
6145 (define_insn "avx_movshdup256<mask_name>"
6146 [(set (match_operand:V8SF 0 "register_operand" "=v")
6149 (match_operand:V8SF 1 "nonimmediate_operand" "vm")
6151 (parallel [(const_int 1) (const_int 1)
6152 (const_int 3) (const_int 3)
6153 (const_int 5) (const_int 5)
6154 (const_int 7) (const_int 7)])))]
6155 "TARGET_AVX && <mask_avx512vl_condition>"
6156 "vmovshdup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6157 [(set_attr "type" "sse")
6158 (set_attr "prefix" "vex")
6159 (set_attr "mode" "V8SF")])
6161 (define_insn "sse3_movshdup<mask_name>"
6162 [(set (match_operand:V4SF 0 "register_operand" "=v")
6165 (match_operand:V4SF 1 "vector_operand" "vBm")
6167 (parallel [(const_int 1)
6171 "TARGET_SSE3 && <mask_avx512vl_condition>"
6172 "%vmovshdup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6173 [(set_attr "type" "sse")
6174 (set_attr "prefix_rep" "1")
6175 (set_attr "prefix" "maybe_vex")
6176 (set_attr "mode" "V4SF")])
6178 (define_insn "<mask_codefor>avx512f_movshdup512<mask_name>"
6179 [(set (match_operand:V16SF 0 "register_operand" "=v")
6182 (match_operand:V16SF 1 "nonimmediate_operand" "vm")
6184 (parallel [(const_int 1) (const_int 1)
6185 (const_int 3) (const_int 3)
6186 (const_int 5) (const_int 5)
6187 (const_int 7) (const_int 7)
6188 (const_int 9) (const_int 9)
6189 (const_int 11) (const_int 11)
6190 (const_int 13) (const_int 13)
6191 (const_int 15) (const_int 15)])))]
6193 "vmovshdup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6194 [(set_attr "type" "sse")
6195 (set_attr "prefix" "evex")
6196 (set_attr "mode" "V16SF")])
6198 (define_insn "avx_movsldup256<mask_name>"
6199 [(set (match_operand:V8SF 0 "register_operand" "=v")
6202 (match_operand:V8SF 1 "nonimmediate_operand" "vm")
6204 (parallel [(const_int 0) (const_int 0)
6205 (const_int 2) (const_int 2)
6206 (const_int 4) (const_int 4)
6207 (const_int 6) (const_int 6)])))]
6208 "TARGET_AVX && <mask_avx512vl_condition>"
6209 "vmovsldup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6210 [(set_attr "type" "sse")
6211 (set_attr "prefix" "vex")
6212 (set_attr "mode" "V8SF")])
6214 (define_insn "sse3_movsldup<mask_name>"
6215 [(set (match_operand:V4SF 0 "register_operand" "=v")
6218 (match_operand:V4SF 1 "vector_operand" "vBm")
6220 (parallel [(const_int 0)
6224 "TARGET_SSE3 && <mask_avx512vl_condition>"
6225 "%vmovsldup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6226 [(set_attr "type" "sse")
6227 (set_attr "prefix_rep" "1")
6228 (set_attr "prefix" "maybe_vex")
6229 (set_attr "mode" "V4SF")])
6231 (define_insn "<mask_codefor>avx512f_movsldup512<mask_name>"
6232 [(set (match_operand:V16SF 0 "register_operand" "=v")
6235 (match_operand:V16SF 1 "nonimmediate_operand" "vm")
6237 (parallel [(const_int 0) (const_int 0)
6238 (const_int 2) (const_int 2)
6239 (const_int 4) (const_int 4)
6240 (const_int 6) (const_int 6)
6241 (const_int 8) (const_int 8)
6242 (const_int 10) (const_int 10)
6243 (const_int 12) (const_int 12)
6244 (const_int 14) (const_int 14)])))]
6246 "vmovsldup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
6247 [(set_attr "type" "sse")
6248 (set_attr "prefix" "evex")
6249 (set_attr "mode" "V16SF")])
6251 (define_expand "avx_shufps256<mask_expand4_name>"
6252 [(match_operand:V8SF 0 "register_operand")
6253 (match_operand:V8SF 1 "register_operand")
6254 (match_operand:V8SF 2 "nonimmediate_operand")
6255 (match_operand:SI 3 "const_int_operand")]
6258 int mask = INTVAL (operands[3]);
6259 emit_insn (gen_avx_shufps256_1<mask_expand4_name> (operands[0],
6262 GEN_INT ((mask >> 0) & 3),
6263 GEN_INT ((mask >> 2) & 3),
6264 GEN_INT (((mask >> 4) & 3) + 8),
6265 GEN_INT (((mask >> 6) & 3) + 8),
6266 GEN_INT (((mask >> 0) & 3) + 4),
6267 GEN_INT (((mask >> 2) & 3) + 4),
6268 GEN_INT (((mask >> 4) & 3) + 12),
6269 GEN_INT (((mask >> 6) & 3) + 12)
6270 <mask_expand4_args>));
6274 ;; One bit in mask selects 2 elements.
6275 (define_insn "avx_shufps256_1<mask_name>"
6276 [(set (match_operand:V8SF 0 "register_operand" "=v")
6279 (match_operand:V8SF 1 "register_operand" "v")
6280 (match_operand:V8SF 2 "nonimmediate_operand" "vm"))
6281 (parallel [(match_operand 3 "const_0_to_3_operand" )
6282 (match_operand 4 "const_0_to_3_operand" )
6283 (match_operand 5 "const_8_to_11_operand" )
6284 (match_operand 6 "const_8_to_11_operand" )
6285 (match_operand 7 "const_4_to_7_operand" )
6286 (match_operand 8 "const_4_to_7_operand" )
6287 (match_operand 9 "const_12_to_15_operand")
6288 (match_operand 10 "const_12_to_15_operand")])))]
6290 && <mask_avx512vl_condition>
6291 && (INTVAL (operands[3]) == (INTVAL (operands[7]) - 4)
6292 && INTVAL (operands[4]) == (INTVAL (operands[8]) - 4)
6293 && INTVAL (operands[5]) == (INTVAL (operands[9]) - 4)
6294 && INTVAL (operands[6]) == (INTVAL (operands[10]) - 4))"
6297 mask = INTVAL (operands[3]);
6298 mask |= INTVAL (operands[4]) << 2;
6299 mask |= (INTVAL (operands[5]) - 8) << 4;
6300 mask |= (INTVAL (operands[6]) - 8) << 6;
6301 operands[3] = GEN_INT (mask);
6303 return "vshufps\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
6305 [(set_attr "type" "sseshuf")
6306 (set_attr "length_immediate" "1")
6307 (set_attr "prefix" "<mask_prefix>")
6308 (set_attr "mode" "V8SF")])
6310 (define_expand "sse_shufps<mask_expand4_name>"
6311 [(match_operand:V4SF 0 "register_operand")
6312 (match_operand:V4SF 1 "register_operand")
6313 (match_operand:V4SF 2 "vector_operand")
6314 (match_operand:SI 3 "const_int_operand")]
6317 int mask = INTVAL (operands[3]);
6318 emit_insn (gen_sse_shufps_v4sf<mask_expand4_name> (operands[0],
6321 GEN_INT ((mask >> 0) & 3),
6322 GEN_INT ((mask >> 2) & 3),
6323 GEN_INT (((mask >> 4) & 3) + 4),
6324 GEN_INT (((mask >> 6) & 3) + 4)
6325 <mask_expand4_args>));
6329 (define_insn "sse_shufps_v4sf_mask"
6330 [(set (match_operand:V4SF 0 "register_operand" "=v")
6334 (match_operand:V4SF 1 "register_operand" "v")
6335 (match_operand:V4SF 2 "nonimmediate_operand" "vm"))
6336 (parallel [(match_operand 3 "const_0_to_3_operand")
6337 (match_operand 4 "const_0_to_3_operand")
6338 (match_operand 5 "const_4_to_7_operand")
6339 (match_operand 6 "const_4_to_7_operand")]))
6340 (match_operand:V4SF 7 "vector_move_operand" "0C")
6341 (match_operand:QI 8 "register_operand" "Yk")))]
6345 mask |= INTVAL (operands[3]) << 0;
6346 mask |= INTVAL (operands[4]) << 2;
6347 mask |= (INTVAL (operands[5]) - 4) << 4;
6348 mask |= (INTVAL (operands[6]) - 4) << 6;
6349 operands[3] = GEN_INT (mask);
6351 return "vshufps\t{%3, %2, %1, %0%{%8%}%N7|%0%{%8%}%N7, %1, %2, %3}";
6353 [(set_attr "type" "sseshuf")
6354 (set_attr "length_immediate" "1")
6355 (set_attr "prefix" "evex")
6356 (set_attr "mode" "V4SF")])
6358 (define_insn "sse_shufps_<mode>"
6359 [(set (match_operand:VI4F_128 0 "register_operand" "=x,v")
6360 (vec_select:VI4F_128
6361 (vec_concat:<ssedoublevecmode>
6362 (match_operand:VI4F_128 1 "register_operand" "0,v")
6363 (match_operand:VI4F_128 2 "vector_operand" "xBm,vm"))
6364 (parallel [(match_operand 3 "const_0_to_3_operand")
6365 (match_operand 4 "const_0_to_3_operand")
6366 (match_operand 5 "const_4_to_7_operand")
6367 (match_operand 6 "const_4_to_7_operand")])))]
6371 mask |= INTVAL (operands[3]) << 0;
6372 mask |= INTVAL (operands[4]) << 2;
6373 mask |= (INTVAL (operands[5]) - 4) << 4;
6374 mask |= (INTVAL (operands[6]) - 4) << 6;
6375 operands[3] = GEN_INT (mask);
6377 switch (which_alternative)
6380 return "shufps\t{%3, %2, %0|%0, %2, %3}";
6382 return "vshufps\t{%3, %2, %1, %0|%0, %1, %2, %3}";
6387 [(set_attr "isa" "noavx,avx")
6388 (set_attr "type" "sseshuf")
6389 (set_attr "length_immediate" "1")
6390 (set_attr "prefix" "orig,maybe_evex")
6391 (set_attr "mode" "V4SF")])
6393 (define_insn "sse_storehps"
6394 [(set (match_operand:V2SF 0 "nonimmediate_operand" "=m,v,v")
6396 (match_operand:V4SF 1 "nonimmediate_operand" "v,v,o")
6397 (parallel [(const_int 2) (const_int 3)])))]
6400 %vmovhps\t{%1, %0|%q0, %1}
6401 %vmovhlps\t{%1, %d0|%d0, %1}
6402 %vmovlps\t{%H1, %d0|%d0, %H1}"
6403 [(set_attr "type" "ssemov")
6404 (set_attr "prefix" "maybe_vex")
6405 (set_attr "mode" "V2SF,V4SF,V2SF")])
6407 (define_expand "sse_loadhps_exp"
6408 [(set (match_operand:V4SF 0 "nonimmediate_operand")
6411 (match_operand:V4SF 1 "nonimmediate_operand")
6412 (parallel [(const_int 0) (const_int 1)]))
6413 (match_operand:V2SF 2 "nonimmediate_operand")))]
6416 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
6418 emit_insn (gen_sse_loadhps (dst, operands[1], operands[2]));
6420 /* Fix up the destination if needed. */
6421 if (dst != operands[0])
6422 emit_move_insn (operands[0], dst);
6427 (define_insn "sse_loadhps"
6428 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,v,x,v,o")
6431 (match_operand:V4SF 1 "nonimmediate_operand" " 0,v,0,v,0")
6432 (parallel [(const_int 0) (const_int 1)]))
6433 (match_operand:V2SF 2 "nonimmediate_operand" " m,m,x,v,v")))]
6436 movhps\t{%2, %0|%0, %q2}
6437 vmovhps\t{%2, %1, %0|%0, %1, %q2}
6438 movlhps\t{%2, %0|%0, %2}
6439 vmovlhps\t{%2, %1, %0|%0, %1, %2}
6440 %vmovlps\t{%2, %H0|%H0, %2}"
6441 [(set_attr "isa" "noavx,avx,noavx,avx,*")
6442 (set_attr "type" "ssemov")
6443 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,maybe_vex")
6444 (set_attr "mode" "V2SF,V2SF,V4SF,V4SF,V2SF")])
6446 (define_insn "sse_storelps"
6447 [(set (match_operand:V2SF 0 "nonimmediate_operand" "=m,v,v")
6449 (match_operand:V4SF 1 "nonimmediate_operand" " v,v,m")
6450 (parallel [(const_int 0) (const_int 1)])))]
6453 %vmovlps\t{%1, %0|%q0, %1}
6454 %vmovaps\t{%1, %0|%0, %1}
6455 %vmovlps\t{%1, %d0|%d0, %q1}"
6456 [(set_attr "type" "ssemov")
6457 (set_attr "prefix" "maybe_vex")
6458 (set_attr "mode" "V2SF,V4SF,V2SF")])
6460 (define_expand "sse_loadlps_exp"
6461 [(set (match_operand:V4SF 0 "nonimmediate_operand")
6463 (match_operand:V2SF 2 "nonimmediate_operand")
6465 (match_operand:V4SF 1 "nonimmediate_operand")
6466 (parallel [(const_int 2) (const_int 3)]))))]
6469 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V4SFmode, operands);
6471 emit_insn (gen_sse_loadlps (dst, operands[1], operands[2]));
6473 /* Fix up the destination if needed. */
6474 if (dst != operands[0])
6475 emit_move_insn (operands[0], dst);
6480 (define_insn "sse_loadlps"
6481 [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,v,x,v,m")
6483 (match_operand:V2SF 2 "nonimmediate_operand" " 0,v,m,m,v")
6485 (match_operand:V4SF 1 "nonimmediate_operand" " x,v,0,v,0")
6486 (parallel [(const_int 2) (const_int 3)]))))]
6489 shufps\t{$0xe4, %1, %0|%0, %1, 0xe4}
6490 vshufps\t{$0xe4, %1, %2, %0|%0, %2, %1, 0xe4}
6491 movlps\t{%2, %0|%0, %q2}
6492 vmovlps\t{%2, %1, %0|%0, %1, %q2}
6493 %vmovlps\t{%2, %0|%q0, %2}"
6494 [(set_attr "isa" "noavx,avx,noavx,avx,*")
6495 (set_attr "type" "sseshuf,sseshuf,ssemov,ssemov,ssemov")
6496 (set_attr "length_immediate" "1,1,*,*,*")
6497 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,maybe_vex")
6498 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF,V2SF")])
6500 (define_insn "sse_movss"
6501 [(set (match_operand:V4SF 0 "register_operand" "=x,v")
6503 (match_operand:V4SF 2 "register_operand" " x,v")
6504 (match_operand:V4SF 1 "register_operand" " 0,v")
6508 movss\t{%2, %0|%0, %2}
6509 vmovss\t{%2, %1, %0|%0, %1, %2}"
6510 [(set_attr "isa" "noavx,avx")
6511 (set_attr "type" "ssemov")
6512 (set_attr "prefix" "orig,maybe_evex")
6513 (set_attr "mode" "SF")])
6515 (define_insn "avx2_vec_dup<mode>"
6516 [(set (match_operand:VF1_128_256 0 "register_operand" "=v")
6517 (vec_duplicate:VF1_128_256
6519 (match_operand:V4SF 1 "register_operand" "v")
6520 (parallel [(const_int 0)]))))]
6522 "vbroadcastss\t{%1, %0|%0, %1}"
6523 [(set_attr "type" "sselog1")
6524 (set_attr "prefix" "maybe_evex")
6525 (set_attr "mode" "<MODE>")])
6527 (define_insn "avx2_vec_dupv8sf_1"
6528 [(set (match_operand:V8SF 0 "register_operand" "=v")
6531 (match_operand:V8SF 1 "register_operand" "v")
6532 (parallel [(const_int 0)]))))]
6534 "vbroadcastss\t{%x1, %0|%0, %x1}"
6535 [(set_attr "type" "sselog1")
6536 (set_attr "prefix" "maybe_evex")
6537 (set_attr "mode" "V8SF")])
6539 (define_insn "avx512f_vec_dup<mode>_1"
6540 [(set (match_operand:VF_512 0 "register_operand" "=v")
6541 (vec_duplicate:VF_512
6542 (vec_select:<ssescalarmode>
6543 (match_operand:VF_512 1 "register_operand" "v")
6544 (parallel [(const_int 0)]))))]
6546 "vbroadcast<bcstscalarsuff>\t{%x1, %0|%0, %x1}"
6547 [(set_attr "type" "sselog1")
6548 (set_attr "prefix" "evex")
6549 (set_attr "mode" "<MODE>")])
6551 ;; Although insertps takes register source, we prefer
6552 ;; unpcklps with register source since it is shorter.
6553 (define_insn "*vec_concatv2sf_sse4_1"
6554 [(set (match_operand:V2SF 0 "register_operand"
6555 "=Yr,*x, v,Yr,*x,v,v,*y ,*y")
6557 (match_operand:SF 1 "nonimmediate_operand"
6558 " 0, 0,Yv, 0,0, v,m, 0 , m")
6559 (match_operand:SF 2 "vector_move_operand"
6560 " Yr,*x,Yv, m,m, m,C,*ym, C")))]
6561 "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
6563 unpcklps\t{%2, %0|%0, %2}
6564 unpcklps\t{%2, %0|%0, %2}
6565 vunpcklps\t{%2, %1, %0|%0, %1, %2}
6566 insertps\t{$0x10, %2, %0|%0, %2, 0x10}
6567 insertps\t{$0x10, %2, %0|%0, %2, 0x10}
6568 vinsertps\t{$0x10, %2, %1, %0|%0, %1, %2, 0x10}
6569 %vmovss\t{%1, %0|%0, %1}
6570 punpckldq\t{%2, %0|%0, %2}
6571 movd\t{%1, %0|%0, %1}"
6572 [(set_attr "isa" "noavx,noavx,avx,noavx,noavx,avx,*,*,*")
6573 (set_attr "type" "sselog,sselog,sselog,sselog,sselog,sselog,ssemov,mmxcvt,mmxmov")
6574 (set_attr "prefix_data16" "*,*,*,1,1,*,*,*,*")
6575 (set_attr "prefix_extra" "*,*,*,1,1,1,*,*,*")
6576 (set_attr "length_immediate" "*,*,*,1,1,1,*,*,*")
6577 (set_attr "prefix" "orig,orig,maybe_evex,orig,orig,maybe_evex,maybe_vex,orig,orig")
6578 (set_attr "mode" "V4SF,V4SF,V4SF,V4SF,V4SF,V4SF,SF,DI,DI")])
6580 ;; ??? In theory we can match memory for the MMX alternative, but allowing
6581 ;; vector_operand for operand 2 and *not* allowing memory for the SSE
6582 ;; alternatives pretty much forces the MMX alternative to be chosen.
6583 (define_insn "*vec_concatv2sf_sse"
6584 [(set (match_operand:V2SF 0 "register_operand" "=x,x,*y,*y")
6586 (match_operand:SF 1 "nonimmediate_operand" " 0,m, 0, m")
6587 (match_operand:SF 2 "reg_or_0_operand" " x,C,*y, C")))]
6590 unpcklps\t{%2, %0|%0, %2}
6591 movss\t{%1, %0|%0, %1}
6592 punpckldq\t{%2, %0|%0, %2}
6593 movd\t{%1, %0|%0, %1}"
6594 [(set_attr "type" "sselog,ssemov,mmxcvt,mmxmov")
6595 (set_attr "mode" "V4SF,SF,DI,DI")])
6597 (define_insn "*vec_concatv4sf"
6598 [(set (match_operand:V4SF 0 "register_operand" "=x,v,x,v")
6600 (match_operand:V2SF 1 "register_operand" " 0,v,0,v")
6601 (match_operand:V2SF 2 "nonimmediate_operand" " x,v,m,m")))]
6604 movlhps\t{%2, %0|%0, %2}
6605 vmovlhps\t{%2, %1, %0|%0, %1, %2}
6606 movhps\t{%2, %0|%0, %q2}
6607 vmovhps\t{%2, %1, %0|%0, %1, %q2}"
6608 [(set_attr "isa" "noavx,avx,noavx,avx")
6609 (set_attr "type" "ssemov")
6610 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex")
6611 (set_attr "mode" "V4SF,V4SF,V2SF,V2SF")])
6613 (define_expand "vec_init<mode>"
6614 [(match_operand:V_128 0 "register_operand")
6618 ix86_expand_vector_init (false, operands[0], operands[1]);
6622 ;; Avoid combining registers from different units in a single alternative,
6623 ;; see comment above inline_secondary_memory_needed function in i386.c
6624 (define_insn "vec_set<mode>_0"
6625 [(set (match_operand:VI4F_128 0 "nonimmediate_operand"
6626 "=Yr,*x,v,v,Yi,x,x,v,Yr ,*x ,x ,m ,m ,m")
6628 (vec_duplicate:VI4F_128
6629 (match_operand:<ssescalarmode> 2 "general_operand"
6630 " Yr,*x,v,m,r ,m,x,v,*rm,*rm,*rm,!x,!*re,!*fF"))
6631 (match_operand:VI4F_128 1 "vector_move_operand"
6632 " C , C,C,C,C ,C,0,v,0 ,0 ,x ,0 ,0 ,0")
6636 insertps\t{$0xe, %2, %0|%0, %2, 0xe}
6637 insertps\t{$0xe, %2, %0|%0, %2, 0xe}
6638 vinsertps\t{$0xe, %2, %2, %0|%0, %2, %2, 0xe}
6639 %vmov<ssescalarmodesuffix>\t{%2, %0|%0, %2}
6640 %vmovd\t{%2, %0|%0, %2}
6641 movss\t{%2, %0|%0, %2}
6642 movss\t{%2, %0|%0, %2}
6643 vmovss\t{%2, %1, %0|%0, %1, %2}
6644 pinsrd\t{$0, %2, %0|%0, %2, 0}
6645 pinsrd\t{$0, %2, %0|%0, %2, 0}
6646 vpinsrd\t{$0, %2, %1, %0|%0, %1, %2, 0}
6650 [(set_attr "isa" "sse4_noavx,sse4_noavx,avx,sse2,sse2,noavx,noavx,avx,sse4_noavx,sse4_noavx,avx,*,*,*")
6652 (cond [(eq_attr "alternative" "0,1,2,8,9,10")
6653 (const_string "sselog")
6654 (eq_attr "alternative" "12")
6655 (const_string "imov")
6656 (eq_attr "alternative" "13")
6657 (const_string "fmov")
6659 (const_string "ssemov")))
6660 (set_attr "prefix_extra" "*,*,*,*,*,*,*,*,1,1,1,*,*,*")
6661 (set_attr "length_immediate" "*,*,*,*,*,*,*,*,1,1,1,*,*,*")
6662 (set_attr "prefix" "orig,orig,maybe_evex,maybe_vex,maybe_vex,orig,orig,vex,orig,orig,vex,*,*,*")
6663 (set_attr "mode" "SF,SF,SF,<ssescalarmode>,SI,SF,SF,SF,TI,TI,TI,*,*,*")])
6665 ;; A subset is vec_setv4sf.
6666 (define_insn "*vec_setv4sf_sse4_1"
6667 [(set (match_operand:V4SF 0 "register_operand" "=Yr,*x,v")
6670 (match_operand:SF 2 "nonimmediate_operand" "Yrm,*xm,vm"))
6671 (match_operand:V4SF 1 "register_operand" "0,0,v")
6672 (match_operand:SI 3 "const_int_operand")))]
6674 && ((unsigned) exact_log2 (INTVAL (operands[3]))
6675 < GET_MODE_NUNITS (V4SFmode))"
6677 operands[3] = GEN_INT (exact_log2 (INTVAL (operands[3])) << 4);
6678 switch (which_alternative)
6682 return "insertps\t{%3, %2, %0|%0, %2, %3}";
6684 return "vinsertps\t{%3, %2, %1, %0|%0, %1, %2, %3}";
6689 [(set_attr "isa" "noavx,noavx,avx")
6690 (set_attr "type" "sselog")
6691 (set_attr "prefix_data16" "1,1,*")
6692 (set_attr "prefix_extra" "1")
6693 (set_attr "length_immediate" "1")
6694 (set_attr "prefix" "orig,orig,maybe_evex")
6695 (set_attr "mode" "V4SF")])
6697 (define_insn "sse4_1_insertps"
6698 [(set (match_operand:V4SF 0 "register_operand" "=Yr,*x,v")
6699 (unspec:V4SF [(match_operand:V4SF 2 "nonimmediate_operand" "Yrm,*xm,vm")
6700 (match_operand:V4SF 1 "register_operand" "0,0,v")
6701 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")]
6705 if (MEM_P (operands[2]))
6707 unsigned count_s = INTVAL (operands[3]) >> 6;
6709 operands[3] = GEN_INT (INTVAL (operands[3]) & 0x3f);
6710 operands[2] = adjust_address_nv (operands[2], SFmode, count_s * 4);
6712 switch (which_alternative)
6716 return "insertps\t{%3, %2, %0|%0, %2, %3}";
6718 return "vinsertps\t{%3, %2, %1, %0|%0, %1, %2, %3}";
6723 [(set_attr "isa" "noavx,noavx,avx")
6724 (set_attr "type" "sselog")
6725 (set_attr "prefix_data16" "1,1,*")
6726 (set_attr "prefix_extra" "1")
6727 (set_attr "length_immediate" "1")
6728 (set_attr "prefix" "orig,orig,maybe_evex")
6729 (set_attr "mode" "V4SF")])
6732 [(set (match_operand:VI4F_128 0 "memory_operand")
6734 (vec_duplicate:VI4F_128
6735 (match_operand:<ssescalarmode> 1 "nonmemory_operand"))
6738 "TARGET_SSE && reload_completed"
6739 [(set (match_dup 0) (match_dup 1))]
6740 "operands[0] = adjust_address (operands[0], <ssescalarmode>mode, 0);")
6742 (define_expand "vec_set<mode>"
6743 [(match_operand:V 0 "register_operand")
6744 (match_operand:<ssescalarmode> 1 "register_operand")
6745 (match_operand 2 "const_int_operand")]
6748 ix86_expand_vector_set (false, operands[0], operands[1],
6749 INTVAL (operands[2]));
6753 (define_insn_and_split "*vec_extractv4sf_0"
6754 [(set (match_operand:SF 0 "nonimmediate_operand" "=v,m,f,r")
6756 (match_operand:V4SF 1 "nonimmediate_operand" "vm,v,m,m")
6757 (parallel [(const_int 0)])))]
6758 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
6760 "&& reload_completed"
6761 [(set (match_dup 0) (match_dup 1))]
6762 "operands[1] = gen_lowpart (SFmode, operands[1]);")
6764 (define_insn_and_split "*sse4_1_extractps"
6765 [(set (match_operand:SF 0 "nonimmediate_operand" "=rm,rm,rm,v,v")
6767 (match_operand:V4SF 1 "register_operand" "Yr,*x,v,0,v")
6768 (parallel [(match_operand:SI 2 "const_0_to_3_operand" "n,n,n,n,n")])))]
6771 extractps\t{%2, %1, %0|%0, %1, %2}
6772 extractps\t{%2, %1, %0|%0, %1, %2}
6773 vextractps\t{%2, %1, %0|%0, %1, %2}
6776 "&& reload_completed && SSE_REG_P (operands[0])"
6779 rtx dest = lowpart_subreg (V4SFmode, operands[0], SFmode);
6780 switch (INTVAL (operands[2]))
6784 emit_insn (gen_sse_shufps_v4sf (dest, operands[1], operands[1],
6785 operands[2], operands[2],
6786 GEN_INT (INTVAL (operands[2]) + 4),
6787 GEN_INT (INTVAL (operands[2]) + 4)));
6790 emit_insn (gen_vec_interleave_highv4sf (dest, operands[1], operands[1]));
6793 /* 0 should be handled by the *vec_extractv4sf_0 pattern above. */
6798 [(set_attr "isa" "noavx,noavx,avx,noavx,avx")
6799 (set_attr "type" "sselog,sselog,sselog,*,*")
6800 (set_attr "prefix_data16" "1,1,1,*,*")
6801 (set_attr "prefix_extra" "1,1,1,*,*")
6802 (set_attr "length_immediate" "1,1,1,*,*")
6803 (set_attr "prefix" "orig,orig,maybe_evex,*,*")
6804 (set_attr "mode" "V4SF,V4SF,V4SF,*,*")])
6806 (define_insn_and_split "*vec_extractv4sf_mem"
6807 [(set (match_operand:SF 0 "register_operand" "=v,*r,f")
6809 (match_operand:V4SF 1 "memory_operand" "o,o,o")
6810 (parallel [(match_operand 2 "const_0_to_3_operand" "n,n,n")])))]
6813 "&& reload_completed"
6814 [(set (match_dup 0) (match_dup 1))]
6816 operands[1] = adjust_address (operands[1], SFmode, INTVAL (operands[2]) * 4);
6819 (define_mode_attr extract_type
6820 [(V16SF "avx512f") (V16SI "avx512f") (V8DF "avx512dq") (V8DI "avx512dq")])
6822 (define_mode_attr extract_suf
6823 [(V16SF "32x4") (V16SI "32x4") (V8DF "64x2") (V8DI "64x2")])
6825 (define_mode_iterator AVX512_VEC
6826 [(V8DF "TARGET_AVX512DQ") (V8DI "TARGET_AVX512DQ") V16SF V16SI])
6828 (define_expand "<extract_type>_vextract<shuffletype><extract_suf>_mask"
6829 [(match_operand:<ssequartermode> 0 "nonimmediate_operand")
6830 (match_operand:AVX512_VEC 1 "register_operand")
6831 (match_operand:SI 2 "const_0_to_3_operand")
6832 (match_operand:<ssequartermode> 3 "nonimmediate_operand")
6833 (match_operand:QI 4 "register_operand")]
6837 mask = INTVAL (operands[2]);
6839 if (MEM_P (operands[0]) && GET_CODE (operands[3]) == CONST_VECTOR)
6840 operands[0] = force_reg (<ssequartermode>mode, operands[0]);
6842 if (<MODE>mode == V16SImode || <MODE>mode == V16SFmode)
6843 emit_insn (gen_avx512f_vextract<shuffletype>32x4_1_mask (operands[0],
6844 operands[1], GEN_INT (mask * 4), GEN_INT (mask * 4 + 1),
6845 GEN_INT (mask * 4 + 2), GEN_INT (mask * 4 + 3), operands[3],
6848 emit_insn (gen_avx512dq_vextract<shuffletype>64x2_1_mask (operands[0],
6849 operands[1], GEN_INT (mask * 2), GEN_INT (mask * 2 + 1), operands[3],
6854 (define_insn "avx512dq_vextract<shuffletype>64x2_1_maskm"
6855 [(set (match_operand:<ssequartermode> 0 "memory_operand" "=m")
6856 (vec_merge:<ssequartermode>
6857 (vec_select:<ssequartermode>
6858 (match_operand:V8FI 1 "register_operand" "v")
6859 (parallel [(match_operand 2 "const_0_to_7_operand")
6860 (match_operand 3 "const_0_to_7_operand")]))
6861 (match_operand:<ssequartermode> 4 "memory_operand" "0")
6862 (match_operand:QI 5 "register_operand" "k")))]
6864 && (INTVAL (operands[2]) % 2 == 0)
6865 && (INTVAL (operands[2]) == INTVAL (operands[3]) - 1)
6866 && rtx_equal_p (operands[4], operands[0])"
6868 operands[2] = GEN_INT ((INTVAL (operands[2])) >> 1);
6869 return "vextract<shuffletype>64x2\t{%2, %1, %0%{%5%}|%0%{%5%}, %1, %2}";
6871 [(set_attr "type" "sselog")
6872 (set_attr "prefix_extra" "1")
6873 (set_attr "length_immediate" "1")
6874 (set_attr "memory" "store")
6875 (set_attr "prefix" "evex")
6876 (set_attr "mode" "<sseinsnmode>")])
6878 (define_insn "avx512f_vextract<shuffletype>32x4_1_maskm"
6879 [(set (match_operand:<ssequartermode> 0 "memory_operand" "=m")
6880 (vec_merge:<ssequartermode>
6881 (vec_select:<ssequartermode>
6882 (match_operand:V16FI 1 "register_operand" "v")
6883 (parallel [(match_operand 2 "const_0_to_15_operand")
6884 (match_operand 3 "const_0_to_15_operand")
6885 (match_operand 4 "const_0_to_15_operand")
6886 (match_operand 5 "const_0_to_15_operand")]))
6887 (match_operand:<ssequartermode> 6 "memory_operand" "0")
6888 (match_operand:QI 7 "register_operand" "Yk")))]
6890 && ((INTVAL (operands[2]) % 4 == 0)
6891 && INTVAL (operands[2]) == (INTVAL (operands[3]) - 1)
6892 && INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
6893 && INTVAL (operands[4]) == (INTVAL (operands[5]) - 1))
6894 && rtx_equal_p (operands[6], operands[0])"
6896 operands[2] = GEN_INT ((INTVAL (operands[2])) >> 2);
6897 return "vextract<shuffletype>32x4\t{%2, %1, %0%{%7%}|%0%{%7%}, %1, %2}";
6899 [(set_attr "type" "sselog")
6900 (set_attr "prefix_extra" "1")
6901 (set_attr "length_immediate" "1")
6902 (set_attr "memory" "store")
6903 (set_attr "prefix" "evex")
6904 (set_attr "mode" "<sseinsnmode>")])
6906 (define_insn "<mask_codefor>avx512dq_vextract<shuffletype>64x2_1<mask_name>"
6907 [(set (match_operand:<ssequartermode> 0 "<store_mask_predicate>" "=<store_mask_constraint>")
6908 (vec_select:<ssequartermode>
6909 (match_operand:V8FI 1 "register_operand" "v")
6910 (parallel [(match_operand 2 "const_0_to_7_operand")
6911 (match_operand 3 "const_0_to_7_operand")])))]
6912 "TARGET_AVX512DQ && (INTVAL (operands[2]) == INTVAL (operands[3]) - 1)"
6914 operands[2] = GEN_INT ((INTVAL (operands[2])) >> 1);
6915 return "vextract<shuffletype>64x2\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}";
6917 [(set_attr "type" "sselog1")
6918 (set_attr "prefix_extra" "1")
6919 (set_attr "length_immediate" "1")
6920 (set_attr "prefix" "evex")
6921 (set_attr "mode" "<sseinsnmode>")])
6923 (define_insn "<mask_codefor>avx512f_vextract<shuffletype>32x4_1<mask_name>"
6924 [(set (match_operand:<ssequartermode> 0 "<store_mask_predicate>" "=<store_mask_constraint>")
6925 (vec_select:<ssequartermode>
6926 (match_operand:V16FI 1 "register_operand" "v")
6927 (parallel [(match_operand 2 "const_0_to_15_operand")
6928 (match_operand 3 "const_0_to_15_operand")
6929 (match_operand 4 "const_0_to_15_operand")
6930 (match_operand 5 "const_0_to_15_operand")])))]
6932 && (INTVAL (operands[2]) == (INTVAL (operands[3]) - 1)
6933 && INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
6934 && INTVAL (operands[4]) == (INTVAL (operands[5]) - 1))"
6936 operands[2] = GEN_INT ((INTVAL (operands[2])) >> 2);
6937 return "vextract<shuffletype>32x4\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
6939 [(set_attr "type" "sselog1")
6940 (set_attr "prefix_extra" "1")
6941 (set_attr "length_immediate" "1")
6942 (set_attr "prefix" "evex")
6943 (set_attr "mode" "<sseinsnmode>")])
6945 (define_mode_attr extract_type_2
6946 [(V16SF "avx512dq") (V16SI "avx512dq") (V8DF "avx512f") (V8DI "avx512f")])
6948 (define_mode_attr extract_suf_2
6949 [(V16SF "32x8") (V16SI "32x8") (V8DF "64x4") (V8DI "64x4")])
6951 (define_mode_iterator AVX512_VEC_2
6952 [(V16SF "TARGET_AVX512DQ") (V16SI "TARGET_AVX512DQ") V8DF V8DI])
6954 (define_expand "<extract_type_2>_vextract<shuffletype><extract_suf_2>_mask"
6955 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
6956 (match_operand:AVX512_VEC_2 1 "register_operand")
6957 (match_operand:SI 2 "const_0_to_1_operand")
6958 (match_operand:<ssehalfvecmode> 3 "nonimmediate_operand")
6959 (match_operand:QI 4 "register_operand")]
6962 rtx (*insn)(rtx, rtx, rtx, rtx);
6964 if (MEM_P (operands[0]) && GET_CODE (operands[3]) == CONST_VECTOR)
6965 operands[0] = force_reg (<ssequartermode>mode, operands[0]);
6967 switch (INTVAL (operands[2]))
6970 insn = gen_vec_extract_lo_<mode>_mask;
6973 insn = gen_vec_extract_hi_<mode>_mask;
6979 emit_insn (insn (operands[0], operands[1], operands[3], operands[4]));
6984 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
6985 (vec_select:<ssehalfvecmode>
6986 (match_operand:V8FI 1 "nonimmediate_operand")
6987 (parallel [(const_int 0) (const_int 1)
6988 (const_int 2) (const_int 3)])))]
6989 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))
6992 || (REG_P (operands[0]) && !EXT_REX_SSE_REG_P (operands[1])))"
6993 [(set (match_dup 0) (match_dup 1))]
6994 "operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);")
6996 (define_insn "vec_extract_lo_<mode>_maskm"
6997 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
6998 (vec_merge:<ssehalfvecmode>
6999 (vec_select:<ssehalfvecmode>
7000 (match_operand:V8FI 1 "register_operand" "v")
7001 (parallel [(const_int 0) (const_int 1)
7002 (const_int 2) (const_int 3)]))
7003 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7004 (match_operand:QI 3 "register_operand" "Yk")))]
7006 && rtx_equal_p (operands[2], operands[0])"
7007 "vextract<shuffletype>64x4\t{$0x0, %1, %0%{%3%}|%0%{%3%}, %1, 0x0}"
7008 [(set_attr "type" "sselog1")
7009 (set_attr "prefix_extra" "1")
7010 (set_attr "length_immediate" "1")
7011 (set_attr "prefix" "evex")
7012 (set_attr "mode" "<sseinsnmode>")])
7014 (define_insn "vec_extract_lo_<mode><mask_name>"
7015 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=<store_mask_constraint>,v")
7016 (vec_select:<ssehalfvecmode>
7017 (match_operand:V8FI 1 "nonimmediate_operand" "v,m")
7018 (parallel [(const_int 0) (const_int 1)
7019 (const_int 2) (const_int 3)])))]
7020 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7022 if (<mask_applied> || !TARGET_AVX512VL)
7023 return "vextract<shuffletype>64x4\t{$0x0, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x0}";
7027 [(set_attr "type" "sselog1")
7028 (set_attr "prefix_extra" "1")
7029 (set_attr "length_immediate" "1")
7030 (set_attr "prefix" "evex")
7031 (set_attr "mode" "<sseinsnmode>")])
7033 (define_insn "vec_extract_hi_<mode>_maskm"
7034 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7035 (vec_merge:<ssehalfvecmode>
7036 (vec_select:<ssehalfvecmode>
7037 (match_operand:V8FI 1 "register_operand" "v")
7038 (parallel [(const_int 4) (const_int 5)
7039 (const_int 6) (const_int 7)]))
7040 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7041 (match_operand:QI 3 "register_operand" "Yk")))]
7043 && rtx_equal_p (operands[2], operands[0])"
7044 "vextract<shuffletype>64x4\t{$0x1, %1, %0%{%3%}|%0%{%3%}, %1, 0x1}"
7045 [(set_attr "type" "sselog")
7046 (set_attr "prefix_extra" "1")
7047 (set_attr "length_immediate" "1")
7048 (set_attr "memory" "store")
7049 (set_attr "prefix" "evex")
7050 (set_attr "mode" "<sseinsnmode>")])
7052 (define_insn "vec_extract_hi_<mode><mask_name>"
7053 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=<store_mask_constraint>")
7054 (vec_select:<ssehalfvecmode>
7055 (match_operand:V8FI 1 "register_operand" "v")
7056 (parallel [(const_int 4) (const_int 5)
7057 (const_int 6) (const_int 7)])))]
7059 "vextract<shuffletype>64x4\t{$0x1, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x1}"
7060 [(set_attr "type" "sselog1")
7061 (set_attr "prefix_extra" "1")
7062 (set_attr "length_immediate" "1")
7063 (set_attr "prefix" "evex")
7064 (set_attr "mode" "<sseinsnmode>")])
7066 (define_insn "vec_extract_hi_<mode>_maskm"
7067 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7068 (vec_merge:<ssehalfvecmode>
7069 (vec_select:<ssehalfvecmode>
7070 (match_operand:V16FI 1 "register_operand" "v")
7071 (parallel [(const_int 8) (const_int 9)
7072 (const_int 10) (const_int 11)
7073 (const_int 12) (const_int 13)
7074 (const_int 14) (const_int 15)]))
7075 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7076 (match_operand:QI 3 "register_operand" "k")))]
7078 && rtx_equal_p (operands[2], operands[0])"
7079 "vextract<shuffletype>32x8\t{$0x1, %1, %0%{%3%}|%0%{%3%}, %1, 0x1}"
7080 [(set_attr "type" "sselog1")
7081 (set_attr "prefix_extra" "1")
7082 (set_attr "length_immediate" "1")
7083 (set_attr "prefix" "evex")
7084 (set_attr "mode" "<sseinsnmode>")])
7086 (define_insn "vec_extract_hi_<mode><mask_name>"
7087 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=<store_mask_constraint>,vm")
7088 (vec_select:<ssehalfvecmode>
7089 (match_operand:V16FI 1 "register_operand" "v,v")
7090 (parallel [(const_int 8) (const_int 9)
7091 (const_int 10) (const_int 11)
7092 (const_int 12) (const_int 13)
7093 (const_int 14) (const_int 15)])))]
7094 "TARGET_AVX512F && <mask_avx512dq_condition>"
7096 vextract<shuffletype>32x8\t{$0x1, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x1}
7097 vextracti64x4\t{$0x1, %1, %0|%0, %1, 0x1}"
7098 [(set_attr "type" "sselog1")
7099 (set_attr "prefix_extra" "1")
7100 (set_attr "isa" "avx512dq,noavx512dq")
7101 (set_attr "length_immediate" "1")
7102 (set_attr "prefix" "evex")
7103 (set_attr "mode" "<sseinsnmode>")])
7105 (define_expand "avx512vl_vextractf128<mode>"
7106 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7107 (match_operand:VI48F_256 1 "register_operand")
7108 (match_operand:SI 2 "const_0_to_1_operand")
7109 (match_operand:<ssehalfvecmode> 3 "vector_move_operand")
7110 (match_operand:QI 4 "register_operand")]
7111 "TARGET_AVX512DQ && TARGET_AVX512VL"
7113 rtx (*insn)(rtx, rtx, rtx, rtx);
7115 if (MEM_P (operands[0]) && GET_CODE (operands[3]) == CONST_VECTOR)
7116 operands[0] = force_reg (<ssehalfvecmode>mode, operands[0]);
7118 switch (INTVAL (operands[2]))
7121 insn = gen_vec_extract_lo_<mode>_mask;
7124 insn = gen_vec_extract_hi_<mode>_mask;
7130 emit_insn (insn (operands[0], operands[1], operands[3], operands[4]));
7134 (define_expand "avx_vextractf128<mode>"
7135 [(match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7136 (match_operand:V_256 1 "register_operand")
7137 (match_operand:SI 2 "const_0_to_1_operand")]
7140 rtx (*insn)(rtx, rtx);
7142 switch (INTVAL (operands[2]))
7145 insn = gen_vec_extract_lo_<mode>;
7148 insn = gen_vec_extract_hi_<mode>;
7154 emit_insn (insn (operands[0], operands[1]));
7158 (define_insn "vec_extract_lo_<mode><mask_name>"
7159 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand" "=v,m")
7160 (vec_select:<ssehalfvecmode>
7161 (match_operand:V16FI 1 "nonimmediate_operand" "vm,v")
7162 (parallel [(const_int 0) (const_int 1)
7163 (const_int 2) (const_int 3)
7164 (const_int 4) (const_int 5)
7165 (const_int 6) (const_int 7)])))]
7167 && <mask_mode512bit_condition>
7168 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7171 return "vextract<shuffletype>32x8\t{$0x0, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x0}";
7177 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7178 (vec_select:<ssehalfvecmode>
7179 (match_operand:V16FI 1 "nonimmediate_operand")
7180 (parallel [(const_int 0) (const_int 1)
7181 (const_int 2) (const_int 3)
7182 (const_int 4) (const_int 5)
7183 (const_int 6) (const_int 7)])))]
7184 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))
7185 && reload_completed"
7186 [(set (match_dup 0) (match_dup 1))]
7187 "operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);")
7189 (define_insn "vec_extract_lo_<mode><mask_name>"
7190 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=v,m")
7191 (vec_select:<ssehalfvecmode>
7192 (match_operand:VI8F_256 1 "nonimmediate_operand" "vm,v")
7193 (parallel [(const_int 0) (const_int 1)])))]
7195 && <mask_avx512vl_condition> && <mask_avx512dq_condition>
7196 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7199 return "vextract<shuffletype>64x2\t{$0x0, %1, %0%{%3%}|%0%{%3%}, %1, 0x0}";
7203 [(set_attr "type" "sselog")
7204 (set_attr "prefix_extra" "1")
7205 (set_attr "length_immediate" "1")
7206 (set_attr "memory" "none,store")
7207 (set_attr "prefix" "evex")
7208 (set_attr "mode" "XI")])
7211 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7212 (vec_select:<ssehalfvecmode>
7213 (match_operand:VI8F_256 1 "nonimmediate_operand")
7214 (parallel [(const_int 0) (const_int 1)])))]
7215 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))
7216 && reload_completed"
7217 [(set (match_dup 0) (match_dup 1))]
7218 "operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);")
7220 (define_insn "vec_extract_hi_<mode><mask_name>"
7221 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=v,<store_mask_constraint>")
7222 (vec_select:<ssehalfvecmode>
7223 (match_operand:VI8F_256 1 "register_operand" "v,v")
7224 (parallel [(const_int 2) (const_int 3)])))]
7225 "TARGET_AVX && <mask_avx512vl_condition> && <mask_avx512dq_condition>"
7227 if (TARGET_AVX512VL)
7229 if (TARGET_AVX512DQ)
7230 return "vextract<shuffletype>64x2\t{$0x1, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x1}";
7232 return "vextract<shuffletype>32x4\t{$0x1, %1, %0|%0, %1, 0x1}";
7235 return "vextract<i128>\t{$0x1, %1, %0|%0, %1, 0x1}";
7237 [(set_attr "type" "sselog")
7238 (set_attr "prefix_extra" "1")
7239 (set_attr "length_immediate" "1")
7240 (set_attr "memory" "none,store")
7241 (set_attr "prefix" "vex")
7242 (set_attr "mode" "<sseinsnmode>")])
7245 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand")
7246 (vec_select:<ssehalfvecmode>
7247 (match_operand:VI4F_256 1 "nonimmediate_operand")
7248 (parallel [(const_int 0) (const_int 1)
7249 (const_int 2) (const_int 3)])))]
7250 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))
7251 && reload_completed"
7252 [(set (match_dup 0) (match_dup 1))]
7253 "operands[1] = gen_lowpart (<ssehalfvecmode>mode, operands[1]);")
7255 (define_insn "vec_extract_lo_<mode><mask_name>"
7256 [(set (match_operand:<ssehalfvecmode> 0 "<store_mask_predicate>" "=<store_mask_constraint>")
7257 (vec_select:<ssehalfvecmode>
7258 (match_operand:VI4F_256 1 "register_operand" "v")
7259 (parallel [(const_int 0) (const_int 1)
7260 (const_int 2) (const_int 3)])))]
7261 "TARGET_AVX && <mask_avx512vl_condition> && <mask_avx512dq_condition>"
7264 return "vextract<shuffletype>32x4\t{$0x0, %1, %0<mask_operand2>|%0<mask_operand2>, %1, 0x0}";
7268 [(set_attr "type" "sselog1")
7269 (set_attr "prefix_extra" "1")
7270 (set_attr "length_immediate" "1")
7271 (set_attr "prefix" "evex")
7272 (set_attr "mode" "<sseinsnmode>")])
7274 (define_insn "vec_extract_lo_<mode>_maskm"
7275 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7276 (vec_merge:<ssehalfvecmode>
7277 (vec_select:<ssehalfvecmode>
7278 (match_operand:VI4F_256 1 "register_operand" "v")
7279 (parallel [(const_int 0) (const_int 1)
7280 (const_int 2) (const_int 3)]))
7281 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7282 (match_operand:QI 3 "register_operand" "k")))]
7283 "TARGET_AVX512VL && TARGET_AVX512F
7284 && rtx_equal_p (operands[2], operands[0])"
7285 "vextract<shuffletype>32x4\t{$0x0, %1, %0%{%3%}|%0%{%3%}, %1, 0x0}"
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 "vec_extract_hi_<mode>_maskm"
7293 [(set (match_operand:<ssehalfvecmode> 0 "memory_operand" "=m")
7294 (vec_merge:<ssehalfvecmode>
7295 (vec_select:<ssehalfvecmode>
7296 (match_operand:VI4F_256 1 "register_operand" "v")
7297 (parallel [(const_int 4) (const_int 5)
7298 (const_int 6) (const_int 7)]))
7299 (match_operand:<ssehalfvecmode> 2 "memory_operand" "0")
7300 (match_operand:<ssehalfvecmode> 3 "register_operand" "k")))]
7301 "TARGET_AVX512F && TARGET_AVX512VL
7302 && rtx_equal_p (operands[2], operands[0])"
7303 "vextract<shuffletype>32x4\t{$0x1, %1, %0%{%3%}|%0%{%3%}, %1, 0x1}"
7304 [(set_attr "type" "sselog1")
7305 (set_attr "length_immediate" "1")
7306 (set_attr "prefix" "evex")
7307 (set_attr "mode" "<sseinsnmode>")])
7309 (define_insn "vec_extract_hi_<mode>_mask"
7310 [(set (match_operand:<ssehalfvecmode> 0 "register_operand" "=v")
7311 (vec_merge:<ssehalfvecmode>
7312 (vec_select:<ssehalfvecmode>
7313 (match_operand:VI4F_256 1 "register_operand" "v")
7314 (parallel [(const_int 4) (const_int 5)
7315 (const_int 6) (const_int 7)]))
7316 (match_operand:<ssehalfvecmode> 2 "vector_move_operand" "0C")
7317 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
7319 "vextract<shuffletype>32x4\t{$0x1, %1, %0%{%3%}%N2|%0%{%3%}%N2, %1, 0x1}"
7320 [(set_attr "type" "sselog1")
7321 (set_attr "length_immediate" "1")
7322 (set_attr "prefix" "evex")
7323 (set_attr "mode" "<sseinsnmode>")])
7325 (define_insn "vec_extract_hi_<mode>"
7326 [(set (match_operand:<ssehalfvecmode> 0 "nonimmediate_operand" "=xm, vm")
7327 (vec_select:<ssehalfvecmode>
7328 (match_operand:VI4F_256 1 "register_operand" "x, v")
7329 (parallel [(const_int 4) (const_int 5)
7330 (const_int 6) (const_int 7)])))]
7333 vextract<i128>\t{$0x1, %1, %0|%0, %1, 0x1}
7334 vextract<shuffletype>32x4\t{$0x1, %1, %0|%0, %1, 0x1}"
7335 [(set_attr "isa" "*, avx512vl")
7336 (set_attr "prefix" "vex, evex")
7337 (set_attr "type" "sselog1")
7338 (set_attr "length_immediate" "1")
7339 (set_attr "mode" "<sseinsnmode>")])
7341 (define_insn_and_split "vec_extract_lo_v32hi"
7342 [(set (match_operand:V16HI 0 "nonimmediate_operand" "=v,m")
7344 (match_operand:V32HI 1 "nonimmediate_operand" "vm,v")
7345 (parallel [(const_int 0) (const_int 1)
7346 (const_int 2) (const_int 3)
7347 (const_int 4) (const_int 5)
7348 (const_int 6) (const_int 7)
7349 (const_int 8) (const_int 9)
7350 (const_int 10) (const_int 11)
7351 (const_int 12) (const_int 13)
7352 (const_int 14) (const_int 15)])))]
7353 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7355 "&& reload_completed"
7356 [(set (match_dup 0) (match_dup 1))]
7357 "operands[1] = gen_lowpart (V16HImode, operands[1]);")
7359 (define_insn "vec_extract_hi_v32hi"
7360 [(set (match_operand:V16HI 0 "nonimmediate_operand" "=v,m")
7362 (match_operand:V32HI 1 "register_operand" "v,v")
7363 (parallel [(const_int 16) (const_int 17)
7364 (const_int 18) (const_int 19)
7365 (const_int 20) (const_int 21)
7366 (const_int 22) (const_int 23)
7367 (const_int 24) (const_int 25)
7368 (const_int 26) (const_int 27)
7369 (const_int 28) (const_int 29)
7370 (const_int 30) (const_int 31)])))]
7372 "vextracti64x4\t{$0x1, %1, %0|%0, %1, 0x1}"
7373 [(set_attr "type" "sselog")
7374 (set_attr "prefix_extra" "1")
7375 (set_attr "length_immediate" "1")
7376 (set_attr "memory" "none,store")
7377 (set_attr "prefix" "evex")
7378 (set_attr "mode" "XI")])
7380 (define_insn_and_split "vec_extract_lo_v16hi"
7381 [(set (match_operand:V8HI 0 "nonimmediate_operand" "=v,m")
7383 (match_operand:V16HI 1 "nonimmediate_operand" "vm,v")
7384 (parallel [(const_int 0) (const_int 1)
7385 (const_int 2) (const_int 3)
7386 (const_int 4) (const_int 5)
7387 (const_int 6) (const_int 7)])))]
7388 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7390 "&& reload_completed"
7391 [(set (match_dup 0) (match_dup 1))]
7392 "operands[1] = gen_lowpart (V8HImode, operands[1]);")
7394 (define_insn "vec_extract_hi_v16hi"
7395 [(set (match_operand:V8HI 0 "nonimmediate_operand" "=x,m,v,m,v,m")
7397 (match_operand:V16HI 1 "register_operand" "x,x,v,v,v,v")
7398 (parallel [(const_int 8) (const_int 9)
7399 (const_int 10) (const_int 11)
7400 (const_int 12) (const_int 13)
7401 (const_int 14) (const_int 15)])))]
7404 vextract%~128\t{$0x1, %1, %0|%0, %1, 0x1}
7405 vextract%~128\t{$0x1, %1, %0|%0, %1, 0x1}
7406 vextracti32x4\t{$0x1, %1, %0|%0, %1, 0x1}
7407 vextracti32x4\t{$0x1, %1, %0|%0, %1, 0x1}
7408 vextracti32x4\t{$0x1, %g1, %0|%0, %g1, 0x1}
7409 vextracti32x4\t{$0x1, %g1, %0|%0, %g1, 0x1}"
7410 [(set_attr "type" "sselog")
7411 (set_attr "prefix_extra" "1")
7412 (set_attr "length_immediate" "1")
7413 (set_attr "isa" "*,*,avx512dq,avx512dq,avx512f,avx512f")
7414 (set_attr "memory" "none,store,none,store,none,store")
7415 (set_attr "prefix" "vex,vex,evex,evex,evex,evex")
7416 (set_attr "mode" "OI")])
7418 (define_insn_and_split "vec_extract_lo_v64qi"
7419 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=v,m")
7421 (match_operand:V64QI 1 "nonimmediate_operand" "vm,v")
7422 (parallel [(const_int 0) (const_int 1)
7423 (const_int 2) (const_int 3)
7424 (const_int 4) (const_int 5)
7425 (const_int 6) (const_int 7)
7426 (const_int 8) (const_int 9)
7427 (const_int 10) (const_int 11)
7428 (const_int 12) (const_int 13)
7429 (const_int 14) (const_int 15)
7430 (const_int 16) (const_int 17)
7431 (const_int 18) (const_int 19)
7432 (const_int 20) (const_int 21)
7433 (const_int 22) (const_int 23)
7434 (const_int 24) (const_int 25)
7435 (const_int 26) (const_int 27)
7436 (const_int 28) (const_int 29)
7437 (const_int 30) (const_int 31)])))]
7438 "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7440 "&& reload_completed"
7441 [(set (match_dup 0) (match_dup 1))]
7442 "operands[1] = gen_lowpart (V32QImode, operands[1]);")
7444 (define_insn "vec_extract_hi_v64qi"
7445 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=v,m")
7447 (match_operand:V64QI 1 "register_operand" "v,v")
7448 (parallel [(const_int 32) (const_int 33)
7449 (const_int 34) (const_int 35)
7450 (const_int 36) (const_int 37)
7451 (const_int 38) (const_int 39)
7452 (const_int 40) (const_int 41)
7453 (const_int 42) (const_int 43)
7454 (const_int 44) (const_int 45)
7455 (const_int 46) (const_int 47)
7456 (const_int 48) (const_int 49)
7457 (const_int 50) (const_int 51)
7458 (const_int 52) (const_int 53)
7459 (const_int 54) (const_int 55)
7460 (const_int 56) (const_int 57)
7461 (const_int 58) (const_int 59)
7462 (const_int 60) (const_int 61)
7463 (const_int 62) (const_int 63)])))]
7465 "vextracti64x4\t{$0x1, %1, %0|%0, %1, 0x1}"
7466 [(set_attr "type" "sselog")
7467 (set_attr "prefix_extra" "1")
7468 (set_attr "length_immediate" "1")
7469 (set_attr "memory" "none,store")
7470 (set_attr "prefix" "evex")
7471 (set_attr "mode" "XI")])
7473 (define_insn_and_split "vec_extract_lo_v32qi"
7474 [(set (match_operand:V16QI 0 "nonimmediate_operand" "=v,m")
7476 (match_operand:V32QI 1 "nonimmediate_operand" "vm,v")
7477 (parallel [(const_int 0) (const_int 1)
7478 (const_int 2) (const_int 3)
7479 (const_int 4) (const_int 5)
7480 (const_int 6) (const_int 7)
7481 (const_int 8) (const_int 9)
7482 (const_int 10) (const_int 11)
7483 (const_int 12) (const_int 13)
7484 (const_int 14) (const_int 15)])))]
7485 "TARGET_AVX && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
7487 "&& reload_completed"
7488 [(set (match_dup 0) (match_dup 1))]
7489 "operands[1] = gen_lowpart (V16QImode, operands[1]);")
7491 (define_insn "vec_extract_hi_v32qi"
7492 [(set (match_operand:V16QI 0 "nonimmediate_operand" "=x,m,v,m,v,m")
7494 (match_operand:V32QI 1 "register_operand" "x,x,v,v,v,v")
7495 (parallel [(const_int 16) (const_int 17)
7496 (const_int 18) (const_int 19)
7497 (const_int 20) (const_int 21)
7498 (const_int 22) (const_int 23)
7499 (const_int 24) (const_int 25)
7500 (const_int 26) (const_int 27)
7501 (const_int 28) (const_int 29)
7502 (const_int 30) (const_int 31)])))]
7505 vextract%~128\t{$0x1, %1, %0|%0, %1, 0x1}
7506 vextract%~128\t{$0x1, %1, %0|%0, %1, 0x1}
7507 vextracti32x4\t{$0x1, %1, %0|%0, %1, 0x1}
7508 vextracti32x4\t{$0x1, %1, %0|%0, %1, 0x1}
7509 vextracti32x4\t{$0x1, %g1, %0|%0, %g1, 0x1}
7510 vextracti32x4\t{$0x1, %g1, %0|%0, %g1, 0x1}"
7511 [(set_attr "type" "sselog")
7512 (set_attr "prefix_extra" "1")
7513 (set_attr "length_immediate" "1")
7514 (set_attr "isa" "*,*,avx512dq,avx512dq,avx512f,avx512f")
7515 (set_attr "memory" "none,store,none,store,none,store")
7516 (set_attr "prefix" "vex,vex,evex,evex,evex,evex")
7517 (set_attr "mode" "OI")])
7519 ;; Modes handled by vec_extract patterns.
7520 (define_mode_iterator VEC_EXTRACT_MODE
7521 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX") V16QI
7522 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX") V8HI
7523 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
7524 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI
7525 (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
7526 (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") V2DF])
7528 (define_expand "vec_extract<mode>"
7529 [(match_operand:<ssescalarmode> 0 "register_operand")
7530 (match_operand:VEC_EXTRACT_MODE 1 "register_operand")
7531 (match_operand 2 "const_int_operand")]
7534 ix86_expand_vector_extract (false, operands[0], operands[1],
7535 INTVAL (operands[2]));
7539 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7541 ;; Parallel double-precision floating point element swizzling
7543 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7545 (define_insn "<mask_codefor>avx512f_unpckhpd512<mask_name>"
7546 [(set (match_operand:V8DF 0 "register_operand" "=v")
7549 (match_operand:V8DF 1 "register_operand" "v")
7550 (match_operand:V8DF 2 "nonimmediate_operand" "vm"))
7551 (parallel [(const_int 1) (const_int 9)
7552 (const_int 3) (const_int 11)
7553 (const_int 5) (const_int 13)
7554 (const_int 7) (const_int 15)])))]
7556 "vunpckhpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
7557 [(set_attr "type" "sselog")
7558 (set_attr "prefix" "evex")
7559 (set_attr "mode" "V8DF")])
7561 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
7562 (define_insn "avx_unpckhpd256<mask_name>"
7563 [(set (match_operand:V4DF 0 "register_operand" "=v")
7566 (match_operand:V4DF 1 "register_operand" "v")
7567 (match_operand:V4DF 2 "nonimmediate_operand" "vm"))
7568 (parallel [(const_int 1) (const_int 5)
7569 (const_int 3) (const_int 7)])))]
7570 "TARGET_AVX && <mask_avx512vl_condition>"
7571 "vunpckhpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
7572 [(set_attr "type" "sselog")
7573 (set_attr "prefix" "vex")
7574 (set_attr "mode" "V4DF")])
7576 (define_expand "vec_interleave_highv4df"
7580 (match_operand:V4DF 1 "register_operand")
7581 (match_operand:V4DF 2 "nonimmediate_operand"))
7582 (parallel [(const_int 0) (const_int 4)
7583 (const_int 2) (const_int 6)])))
7589 (parallel [(const_int 1) (const_int 5)
7590 (const_int 3) (const_int 7)])))
7591 (set (match_operand:V4DF 0 "register_operand")
7596 (parallel [(const_int 2) (const_int 3)
7597 (const_int 6) (const_int 7)])))]
7600 operands[3] = gen_reg_rtx (V4DFmode);
7601 operands[4] = gen_reg_rtx (V4DFmode);
7605 (define_insn "avx512vl_unpckhpd128_mask"
7606 [(set (match_operand:V2DF 0 "register_operand" "=v")
7610 (match_operand:V2DF 1 "register_operand" "v")
7611 (match_operand:V2DF 2 "nonimmediate_operand" "vm"))
7612 (parallel [(const_int 1) (const_int 3)]))
7613 (match_operand:V2DF 3 "vector_move_operand" "0C")
7614 (match_operand:QI 4 "register_operand" "Yk")))]
7616 "vunpckhpd\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
7617 [(set_attr "type" "sselog")
7618 (set_attr "prefix" "evex")
7619 (set_attr "mode" "V2DF")])
7621 (define_expand "vec_interleave_highv2df"
7622 [(set (match_operand:V2DF 0 "register_operand")
7625 (match_operand:V2DF 1 "nonimmediate_operand")
7626 (match_operand:V2DF 2 "nonimmediate_operand"))
7627 (parallel [(const_int 1)
7631 if (!ix86_vec_interleave_v2df_operator_ok (operands, 1))
7632 operands[2] = force_reg (V2DFmode, operands[2]);
7635 (define_insn "*vec_interleave_highv2df"
7636 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,v,v,x,v,m")
7639 (match_operand:V2DF 1 "nonimmediate_operand" " 0,v,o,o,o,v")
7640 (match_operand:V2DF 2 "nonimmediate_operand" " x,v,1,0,v,0"))
7641 (parallel [(const_int 1)
7643 "TARGET_SSE2 && ix86_vec_interleave_v2df_operator_ok (operands, 1)"
7645 unpckhpd\t{%2, %0|%0, %2}
7646 vunpckhpd\t{%2, %1, %0|%0, %1, %2}
7647 %vmovddup\t{%H1, %0|%0, %H1}
7648 movlpd\t{%H1, %0|%0, %H1}
7649 vmovlpd\t{%H1, %2, %0|%0, %2, %H1}
7650 %vmovhpd\t{%1, %0|%q0, %1}"
7651 [(set_attr "isa" "noavx,avx,sse3,noavx,avx,*")
7652 (set_attr "type" "sselog,sselog,sselog,ssemov,ssemov,ssemov")
7653 (set_attr "prefix_data16" "*,*,*,1,*,1")
7654 (set_attr "prefix" "orig,maybe_evex,maybe_vex,orig,maybe_evex,maybe_vex")
7655 (set_attr "mode" "V2DF,V2DF,DF,V1DF,V1DF,V1DF")])
7657 (define_expand "avx512f_movddup512<mask_name>"
7658 [(set (match_operand:V8DF 0 "register_operand")
7661 (match_operand:V8DF 1 "nonimmediate_operand")
7663 (parallel [(const_int 0) (const_int 8)
7664 (const_int 2) (const_int 10)
7665 (const_int 4) (const_int 12)
7666 (const_int 6) (const_int 14)])))]
7669 (define_expand "avx512f_unpcklpd512<mask_name>"
7670 [(set (match_operand:V8DF 0 "register_operand")
7673 (match_operand:V8DF 1 "register_operand")
7674 (match_operand:V8DF 2 "nonimmediate_operand"))
7675 (parallel [(const_int 0) (const_int 8)
7676 (const_int 2) (const_int 10)
7677 (const_int 4) (const_int 12)
7678 (const_int 6) (const_int 14)])))]
7681 (define_insn "*avx512f_unpcklpd512<mask_name>"
7682 [(set (match_operand:V8DF 0 "register_operand" "=v,v")
7685 (match_operand:V8DF 1 "nonimmediate_operand" "vm, v")
7686 (match_operand:V8DF 2 "nonimmediate_operand" "1 ,vm"))
7687 (parallel [(const_int 0) (const_int 8)
7688 (const_int 2) (const_int 10)
7689 (const_int 4) (const_int 12)
7690 (const_int 6) (const_int 14)])))]
7693 vmovddup\t{%1, %0<mask_operand3>|%0<mask_operand3>, %1}
7694 vunpcklpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
7695 [(set_attr "type" "sselog")
7696 (set_attr "prefix" "evex")
7697 (set_attr "mode" "V8DF")])
7699 ;; Recall that the 256-bit unpck insns only shuffle within their lanes.
7700 (define_expand "avx_movddup256<mask_name>"
7701 [(set (match_operand:V4DF 0 "register_operand")
7704 (match_operand:V4DF 1 "nonimmediate_operand")
7706 (parallel [(const_int 0) (const_int 4)
7707 (const_int 2) (const_int 6)])))]
7708 "TARGET_AVX && <mask_avx512vl_condition>")
7710 (define_expand "avx_unpcklpd256<mask_name>"
7711 [(set (match_operand:V4DF 0 "register_operand")
7714 (match_operand:V4DF 1 "register_operand")
7715 (match_operand:V4DF 2 "nonimmediate_operand"))
7716 (parallel [(const_int 0) (const_int 4)
7717 (const_int 2) (const_int 6)])))]
7718 "TARGET_AVX && <mask_avx512vl_condition>")
7720 (define_insn "*avx_unpcklpd256<mask_name>"
7721 [(set (match_operand:V4DF 0 "register_operand" "=v,v")
7724 (match_operand:V4DF 1 "nonimmediate_operand" " v,m")
7725 (match_operand:V4DF 2 "nonimmediate_operand" "vm,1"))
7726 (parallel [(const_int 0) (const_int 4)
7727 (const_int 2) (const_int 6)])))]
7728 "TARGET_AVX && <mask_avx512vl_condition>"
7730 vunpcklpd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
7731 vmovddup\t{%1, %0<mask_operand3>|%0<mask_operand3>, %1}"
7732 [(set_attr "type" "sselog")
7733 (set_attr "prefix" "vex")
7734 (set_attr "mode" "V4DF")])
7736 (define_expand "vec_interleave_lowv4df"
7740 (match_operand:V4DF 1 "register_operand")
7741 (match_operand:V4DF 2 "nonimmediate_operand"))
7742 (parallel [(const_int 0) (const_int 4)
7743 (const_int 2) (const_int 6)])))
7749 (parallel [(const_int 1) (const_int 5)
7750 (const_int 3) (const_int 7)])))
7751 (set (match_operand:V4DF 0 "register_operand")
7756 (parallel [(const_int 0) (const_int 1)
7757 (const_int 4) (const_int 5)])))]
7760 operands[3] = gen_reg_rtx (V4DFmode);
7761 operands[4] = gen_reg_rtx (V4DFmode);
7764 (define_insn "avx512vl_unpcklpd128_mask"
7765 [(set (match_operand:V2DF 0 "register_operand" "=v")
7769 (match_operand:V2DF 1 "register_operand" "v")
7770 (match_operand:V2DF 2 "nonimmediate_operand" "vm"))
7771 (parallel [(const_int 0) (const_int 2)]))
7772 (match_operand:V2DF 3 "vector_move_operand" "0C")
7773 (match_operand:QI 4 "register_operand" "Yk")))]
7775 "vunpcklpd\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
7776 [(set_attr "type" "sselog")
7777 (set_attr "prefix" "evex")
7778 (set_attr "mode" "V2DF")])
7780 (define_expand "vec_interleave_lowv2df"
7781 [(set (match_operand:V2DF 0 "register_operand")
7784 (match_operand:V2DF 1 "nonimmediate_operand")
7785 (match_operand:V2DF 2 "nonimmediate_operand"))
7786 (parallel [(const_int 0)
7790 if (!ix86_vec_interleave_v2df_operator_ok (operands, 0))
7791 operands[1] = force_reg (V2DFmode, operands[1]);
7794 (define_insn "*vec_interleave_lowv2df"
7795 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,v,v,x,v,o")
7798 (match_operand:V2DF 1 "nonimmediate_operand" " 0,v,m,0,v,0")
7799 (match_operand:V2DF 2 "nonimmediate_operand" " x,v,1,m,m,v"))
7800 (parallel [(const_int 0)
7802 "TARGET_SSE2 && ix86_vec_interleave_v2df_operator_ok (operands, 0)"
7804 unpcklpd\t{%2, %0|%0, %2}
7805 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
7806 %vmovddup\t{%1, %0|%0, %q1}
7807 movhpd\t{%2, %0|%0, %q2}
7808 vmovhpd\t{%2, %1, %0|%0, %1, %q2}
7809 %vmovlpd\t{%2, %H0|%H0, %2}"
7810 [(set_attr "isa" "noavx,avx,sse3,noavx,avx,*")
7811 (set_attr "type" "sselog,sselog,sselog,ssemov,ssemov,ssemov")
7812 (set_attr "prefix_data16" "*,*,*,1,*,1")
7813 (set_attr "prefix" "orig,maybe_evex,maybe_vex,orig,maybe_evex,maybe_vex")
7814 (set_attr "mode" "V2DF,V2DF,DF,V1DF,V1DF,V1DF")])
7817 [(set (match_operand:V2DF 0 "memory_operand")
7820 (match_operand:V2DF 1 "register_operand")
7822 (parallel [(const_int 0)
7824 "TARGET_SSE3 && reload_completed"
7827 rtx low = gen_lowpart (DFmode, operands[1]);
7829 emit_move_insn (adjust_address (operands[0], DFmode, 0), low);
7830 emit_move_insn (adjust_address (operands[0], DFmode, 8), low);
7835 [(set (match_operand:V2DF 0 "register_operand")
7838 (match_operand:V2DF 1 "memory_operand")
7840 (parallel [(match_operand:SI 2 "const_0_to_1_operand")
7841 (match_operand:SI 3 "const_int_operand")])))]
7842 "TARGET_SSE3 && INTVAL (operands[2]) + 2 == INTVAL (operands[3])"
7843 [(set (match_dup 0) (vec_duplicate:V2DF (match_dup 1)))]
7845 operands[1] = adjust_address (operands[1], DFmode, INTVAL (operands[2]) * 8);
7848 (define_insn "avx512f_vmscalef<mode><round_name>"
7849 [(set (match_operand:VF_128 0 "register_operand" "=v")
7852 [(match_operand:VF_128 1 "register_operand" "v")
7853 (match_operand:VF_128 2 "<round_nimm_predicate>" "<round_constraint>")]
7858 "vscalef<ssescalarmodesuffix>\t{<round_op3>%2, %1, %0|%0, %1, %2<round_op3>}"
7859 [(set_attr "prefix" "evex")
7860 (set_attr "mode" "<ssescalarmode>")])
7862 (define_insn "<avx512>_scalef<mode><mask_name><round_name>"
7863 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
7865 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
7866 (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "<round_constraint>")]
7869 "vscalef<ssemodesuffix>\t{<round_mask_op3>%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2<round_mask_op3>}"
7870 [(set_attr "prefix" "evex")
7871 (set_attr "mode" "<MODE>")])
7873 (define_expand "<avx512>_vternlog<mode>_maskz"
7874 [(match_operand:VI48_AVX512VL 0 "register_operand")
7875 (match_operand:VI48_AVX512VL 1 "register_operand")
7876 (match_operand:VI48_AVX512VL 2 "register_operand")
7877 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand")
7878 (match_operand:SI 4 "const_0_to_255_operand")
7879 (match_operand:<avx512fmaskmode> 5 "register_operand")]
7882 emit_insn (gen_<avx512>_vternlog<mode>_maskz_1 (
7883 operands[0], operands[1], operands[2], operands[3],
7884 operands[4], CONST0_RTX (<MODE>mode), operands[5]));
7888 (define_insn "<avx512>_vternlog<mode><sd_maskz_name>"
7889 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
7890 (unspec:VI48_AVX512VL
7891 [(match_operand:VI48_AVX512VL 1 "register_operand" "0")
7892 (match_operand:VI48_AVX512VL 2 "register_operand" "v")
7893 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand" "vm")
7894 (match_operand:SI 4 "const_0_to_255_operand")]
7897 "vpternlog<ssemodesuffix>\t{%4, %3, %2, %0<sd_mask_op5>|%0<sd_mask_op5>, %2, %3, %4}"
7898 [(set_attr "type" "sselog")
7899 (set_attr "prefix" "evex")
7900 (set_attr "mode" "<sseinsnmode>")])
7902 (define_insn "<avx512>_vternlog<mode>_mask"
7903 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
7904 (vec_merge:VI48_AVX512VL
7905 (unspec:VI48_AVX512VL
7906 [(match_operand:VI48_AVX512VL 1 "register_operand" "0")
7907 (match_operand:VI48_AVX512VL 2 "register_operand" "v")
7908 (match_operand:VI48_AVX512VL 3 "nonimmediate_operand" "vm")
7909 (match_operand:SI 4 "const_0_to_255_operand")]
7912 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
7914 "vpternlog<ssemodesuffix>\t{%4, %3, %2, %0%{%5%}|%0%{%5%}, %2, %3, %4}"
7915 [(set_attr "type" "sselog")
7916 (set_attr "prefix" "evex")
7917 (set_attr "mode" "<sseinsnmode>")])
7919 (define_insn "<avx512>_getexp<mode><mask_name><round_saeonly_name>"
7920 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
7921 (unspec:VF_AVX512VL [(match_operand:VF_AVX512VL 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
7924 "vgetexp<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}";
7925 [(set_attr "prefix" "evex")
7926 (set_attr "mode" "<MODE>")])
7928 (define_insn "avx512f_sgetexp<mode><round_saeonly_name>"
7929 [(set (match_operand:VF_128 0 "register_operand" "=v")
7932 [(match_operand:VF_128 1 "register_operand" "v")
7933 (match_operand:VF_128 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
7938 "vgetexp<ssescalarmodesuffix>\t{<round_saeonly_op3>%2, %1, %0|%0, %1, %2<round_saeonly_op3>}";
7939 [(set_attr "prefix" "evex")
7940 (set_attr "mode" "<ssescalarmode>")])
7942 (define_insn "<mask_codefor><avx512>_align<mode><mask_name>"
7943 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
7944 (unspec:VI48_AVX512VL [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
7945 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")
7946 (match_operand:SI 3 "const_0_to_255_operand")]
7949 "valign<ssemodesuffix>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3}";
7950 [(set_attr "prefix" "evex")
7951 (set_attr "mode" "<sseinsnmode>")])
7953 (define_expand "avx512f_shufps512_mask"
7954 [(match_operand:V16SF 0 "register_operand")
7955 (match_operand:V16SF 1 "register_operand")
7956 (match_operand:V16SF 2 "nonimmediate_operand")
7957 (match_operand:SI 3 "const_0_to_255_operand")
7958 (match_operand:V16SF 4 "register_operand")
7959 (match_operand:HI 5 "register_operand")]
7962 int mask = INTVAL (operands[3]);
7963 emit_insn (gen_avx512f_shufps512_1_mask (operands[0], operands[1], operands[2],
7964 GEN_INT ((mask >> 0) & 3),
7965 GEN_INT ((mask >> 2) & 3),
7966 GEN_INT (((mask >> 4) & 3) + 16),
7967 GEN_INT (((mask >> 6) & 3) + 16),
7968 GEN_INT (((mask >> 0) & 3) + 4),
7969 GEN_INT (((mask >> 2) & 3) + 4),
7970 GEN_INT (((mask >> 4) & 3) + 20),
7971 GEN_INT (((mask >> 6) & 3) + 20),
7972 GEN_INT (((mask >> 0) & 3) + 8),
7973 GEN_INT (((mask >> 2) & 3) + 8),
7974 GEN_INT (((mask >> 4) & 3) + 24),
7975 GEN_INT (((mask >> 6) & 3) + 24),
7976 GEN_INT (((mask >> 0) & 3) + 12),
7977 GEN_INT (((mask >> 2) & 3) + 12),
7978 GEN_INT (((mask >> 4) & 3) + 28),
7979 GEN_INT (((mask >> 6) & 3) + 28),
7980 operands[4], operands[5]));
7985 (define_expand "<avx512>_fixupimm<mode>_maskz<round_saeonly_expand_name>"
7986 [(match_operand:VF_AVX512VL 0 "register_operand")
7987 (match_operand:VF_AVX512VL 1 "register_operand")
7988 (match_operand:VF_AVX512VL 2 "register_operand")
7989 (match_operand:<sseintvecmode> 3 "<round_saeonly_expand_nimm_predicate>")
7990 (match_operand:SI 4 "const_0_to_255_operand")
7991 (match_operand:<avx512fmaskmode> 5 "register_operand")]
7994 emit_insn (gen_<avx512>_fixupimm<mode>_maskz_1<round_saeonly_expand_name> (
7995 operands[0], operands[1], operands[2], operands[3],
7996 operands[4], CONST0_RTX (<MODE>mode), operands[5]
7997 <round_saeonly_expand_operand6>));
8001 (define_insn "<avx512>_fixupimm<mode><sd_maskz_name><round_saeonly_name>"
8002 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8004 [(match_operand:VF_AVX512VL 1 "register_operand" "0")
8005 (match_operand:VF_AVX512VL 2 "register_operand" "v")
8006 (match_operand:<sseintvecmode> 3 "nonimmediate_operand" "<round_saeonly_constraint>")
8007 (match_operand:SI 4 "const_0_to_255_operand")]
8010 "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}";
8011 [(set_attr "prefix" "evex")
8012 (set_attr "mode" "<MODE>")])
8014 (define_insn "<avx512>_fixupimm<mode>_mask<round_saeonly_name>"
8015 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8016 (vec_merge:VF_AVX512VL
8018 [(match_operand:VF_AVX512VL 1 "register_operand" "0")
8019 (match_operand:VF_AVX512VL 2 "register_operand" "v")
8020 (match_operand:<sseintvecmode> 3 "nonimmediate_operand" "<round_saeonly_constraint>")
8021 (match_operand:SI 4 "const_0_to_255_operand")]
8024 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
8026 "vfixupimm<ssemodesuffix>\t{%4, <round_saeonly_op6>%3, %2, %0%{%5%}|%0%{%5%}, %2, %3<round_saeonly_op6>, %4}";
8027 [(set_attr "prefix" "evex")
8028 (set_attr "mode" "<MODE>")])
8030 (define_expand "avx512f_sfixupimm<mode>_maskz<round_saeonly_expand_name>"
8031 [(match_operand:VF_128 0 "register_operand")
8032 (match_operand:VF_128 1 "register_operand")
8033 (match_operand:VF_128 2 "register_operand")
8034 (match_operand:<sseintvecmode> 3 "<round_saeonly_expand_nimm_predicate>")
8035 (match_operand:SI 4 "const_0_to_255_operand")
8036 (match_operand:<avx512fmaskmode> 5 "register_operand")]
8039 emit_insn (gen_avx512f_sfixupimm<mode>_maskz_1<round_saeonly_expand_name> (
8040 operands[0], operands[1], operands[2], operands[3],
8041 operands[4], CONST0_RTX (<MODE>mode), operands[5]
8042 <round_saeonly_expand_operand6>));
8046 (define_insn "avx512f_sfixupimm<mode><sd_maskz_name><round_saeonly_name>"
8047 [(set (match_operand:VF_128 0 "register_operand" "=v")
8050 [(match_operand:VF_128 1 "register_operand" "0")
8051 (match_operand:VF_128 2 "register_operand" "v")
8052 (match_operand:<sseintvecmode> 3 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
8053 (match_operand:SI 4 "const_0_to_255_operand")]
8058 "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}";
8059 [(set_attr "prefix" "evex")
8060 (set_attr "mode" "<ssescalarmode>")])
8062 (define_insn "avx512f_sfixupimm<mode>_mask<round_saeonly_name>"
8063 [(set (match_operand:VF_128 0 "register_operand" "=v")
8067 [(match_operand:VF_128 1 "register_operand" "0")
8068 (match_operand:VF_128 2 "register_operand" "v")
8069 (match_operand:<sseintvecmode> 3 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
8070 (match_operand:SI 4 "const_0_to_255_operand")]
8075 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
8077 "vfixupimm<ssescalarmodesuffix>\t{%4, <round_saeonly_op6>%3, %2, %0%{%5%}|%0%{%5%}, %2, %3<round_saeonly_op6>, %4}";
8078 [(set_attr "prefix" "evex")
8079 (set_attr "mode" "<ssescalarmode>")])
8081 (define_insn "<avx512>_rndscale<mode><mask_name><round_saeonly_name>"
8082 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
8084 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "<round_saeonly_constraint>")
8085 (match_operand:SI 2 "const_0_to_255_operand")]
8088 "vrndscale<ssemodesuffix>\t{%2, <round_saeonly_mask_op3>%1, %0<mask_operand3>|%0<mask_operand3>, %1<round_saeonly_mask_op3>, %2}"
8089 [(set_attr "length_immediate" "1")
8090 (set_attr "prefix" "evex")
8091 (set_attr "mode" "<MODE>")])
8093 (define_insn "avx512f_rndscale<mode><round_saeonly_name>"
8094 [(set (match_operand:VF_128 0 "register_operand" "=v")
8097 [(match_operand:VF_128 1 "register_operand" "v")
8098 (match_operand:VF_128 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
8099 (match_operand:SI 3 "const_0_to_255_operand")]
8104 "vrndscale<ssescalarmodesuffix>\t{%3, <round_saeonly_op4>%2, %1, %0|%0, %1, %2<round_saeonly_op4>, %3}"
8105 [(set_attr "length_immediate" "1")
8106 (set_attr "prefix" "evex")
8107 (set_attr "mode" "<MODE>")])
8109 ;; One bit in mask selects 2 elements.
8110 (define_insn "avx512f_shufps512_1<mask_name>"
8111 [(set (match_operand:V16SF 0 "register_operand" "=v")
8114 (match_operand:V16SF 1 "register_operand" "v")
8115 (match_operand:V16SF 2 "nonimmediate_operand" "vm"))
8116 (parallel [(match_operand 3 "const_0_to_3_operand")
8117 (match_operand 4 "const_0_to_3_operand")
8118 (match_operand 5 "const_16_to_19_operand")
8119 (match_operand 6 "const_16_to_19_operand")
8120 (match_operand 7 "const_4_to_7_operand")
8121 (match_operand 8 "const_4_to_7_operand")
8122 (match_operand 9 "const_20_to_23_operand")
8123 (match_operand 10 "const_20_to_23_operand")
8124 (match_operand 11 "const_8_to_11_operand")
8125 (match_operand 12 "const_8_to_11_operand")
8126 (match_operand 13 "const_24_to_27_operand")
8127 (match_operand 14 "const_24_to_27_operand")
8128 (match_operand 15 "const_12_to_15_operand")
8129 (match_operand 16 "const_12_to_15_operand")
8130 (match_operand 17 "const_28_to_31_operand")
8131 (match_operand 18 "const_28_to_31_operand")])))]
8133 && (INTVAL (operands[3]) == (INTVAL (operands[7]) - 4)
8134 && INTVAL (operands[4]) == (INTVAL (operands[8]) - 4)
8135 && INTVAL (operands[5]) == (INTVAL (operands[9]) - 4)
8136 && INTVAL (operands[6]) == (INTVAL (operands[10]) - 4)
8137 && INTVAL (operands[3]) == (INTVAL (operands[11]) - 8)
8138 && INTVAL (operands[4]) == (INTVAL (operands[12]) - 8)
8139 && INTVAL (operands[5]) == (INTVAL (operands[13]) - 8)
8140 && INTVAL (operands[6]) == (INTVAL (operands[14]) - 8)
8141 && INTVAL (operands[3]) == (INTVAL (operands[15]) - 12)
8142 && INTVAL (operands[4]) == (INTVAL (operands[16]) - 12)
8143 && INTVAL (operands[5]) == (INTVAL (operands[17]) - 12)
8144 && INTVAL (operands[6]) == (INTVAL (operands[18]) - 12))"
8147 mask = INTVAL (operands[3]);
8148 mask |= INTVAL (operands[4]) << 2;
8149 mask |= (INTVAL (operands[5]) - 16) << 4;
8150 mask |= (INTVAL (operands[6]) - 16) << 6;
8151 operands[3] = GEN_INT (mask);
8153 return "vshufps\t{%3, %2, %1, %0<mask_operand19>|%0<mask_operand19>, %1, %2, %3}";
8155 [(set_attr "type" "sselog")
8156 (set_attr "length_immediate" "1")
8157 (set_attr "prefix" "evex")
8158 (set_attr "mode" "V16SF")])
8160 (define_expand "avx512f_shufpd512_mask"
8161 [(match_operand:V8DF 0 "register_operand")
8162 (match_operand:V8DF 1 "register_operand")
8163 (match_operand:V8DF 2 "nonimmediate_operand")
8164 (match_operand:SI 3 "const_0_to_255_operand")
8165 (match_operand:V8DF 4 "register_operand")
8166 (match_operand:QI 5 "register_operand")]
8169 int mask = INTVAL (operands[3]);
8170 emit_insn (gen_avx512f_shufpd512_1_mask (operands[0], operands[1], operands[2],
8172 GEN_INT (mask & 2 ? 9 : 8),
8173 GEN_INT (mask & 4 ? 3 : 2),
8174 GEN_INT (mask & 8 ? 11 : 10),
8175 GEN_INT (mask & 16 ? 5 : 4),
8176 GEN_INT (mask & 32 ? 13 : 12),
8177 GEN_INT (mask & 64 ? 7 : 6),
8178 GEN_INT (mask & 128 ? 15 : 14),
8179 operands[4], operands[5]));
8183 (define_insn "avx512f_shufpd512_1<mask_name>"
8184 [(set (match_operand:V8DF 0 "register_operand" "=v")
8187 (match_operand:V8DF 1 "register_operand" "v")
8188 (match_operand:V8DF 2 "nonimmediate_operand" "vm"))
8189 (parallel [(match_operand 3 "const_0_to_1_operand")
8190 (match_operand 4 "const_8_to_9_operand")
8191 (match_operand 5 "const_2_to_3_operand")
8192 (match_operand 6 "const_10_to_11_operand")
8193 (match_operand 7 "const_4_to_5_operand")
8194 (match_operand 8 "const_12_to_13_operand")
8195 (match_operand 9 "const_6_to_7_operand")
8196 (match_operand 10 "const_14_to_15_operand")])))]
8200 mask = INTVAL (operands[3]);
8201 mask |= (INTVAL (operands[4]) - 8) << 1;
8202 mask |= (INTVAL (operands[5]) - 2) << 2;
8203 mask |= (INTVAL (operands[6]) - 10) << 3;
8204 mask |= (INTVAL (operands[7]) - 4) << 4;
8205 mask |= (INTVAL (operands[8]) - 12) << 5;
8206 mask |= (INTVAL (operands[9]) - 6) << 6;
8207 mask |= (INTVAL (operands[10]) - 14) << 7;
8208 operands[3] = GEN_INT (mask);
8210 return "vshufpd\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
8212 [(set_attr "type" "sselog")
8213 (set_attr "length_immediate" "1")
8214 (set_attr "prefix" "evex")
8215 (set_attr "mode" "V8DF")])
8217 (define_expand "avx_shufpd256<mask_expand4_name>"
8218 [(match_operand:V4DF 0 "register_operand")
8219 (match_operand:V4DF 1 "register_operand")
8220 (match_operand:V4DF 2 "nonimmediate_operand")
8221 (match_operand:SI 3 "const_int_operand")]
8224 int mask = INTVAL (operands[3]);
8225 emit_insn (gen_avx_shufpd256_1<mask_expand4_name> (operands[0],
8229 GEN_INT (mask & 2 ? 5 : 4),
8230 GEN_INT (mask & 4 ? 3 : 2),
8231 GEN_INT (mask & 8 ? 7 : 6)
8232 <mask_expand4_args>));
8236 (define_insn "avx_shufpd256_1<mask_name>"
8237 [(set (match_operand:V4DF 0 "register_operand" "=v")
8240 (match_operand:V4DF 1 "register_operand" "v")
8241 (match_operand:V4DF 2 "nonimmediate_operand" "vm"))
8242 (parallel [(match_operand 3 "const_0_to_1_operand")
8243 (match_operand 4 "const_4_to_5_operand")
8244 (match_operand 5 "const_2_to_3_operand")
8245 (match_operand 6 "const_6_to_7_operand")])))]
8246 "TARGET_AVX && <mask_avx512vl_condition>"
8249 mask = INTVAL (operands[3]);
8250 mask |= (INTVAL (operands[4]) - 4) << 1;
8251 mask |= (INTVAL (operands[5]) - 2) << 2;
8252 mask |= (INTVAL (operands[6]) - 6) << 3;
8253 operands[3] = GEN_INT (mask);
8255 return "vshufpd\t{%3, %2, %1, %0<mask_operand7>|%0<mask_operand7>, %1, %2, %3}";
8257 [(set_attr "type" "sseshuf")
8258 (set_attr "length_immediate" "1")
8259 (set_attr "prefix" "vex")
8260 (set_attr "mode" "V4DF")])
8262 (define_expand "sse2_shufpd<mask_expand4_name>"
8263 [(match_operand:V2DF 0 "register_operand")
8264 (match_operand:V2DF 1 "register_operand")
8265 (match_operand:V2DF 2 "vector_operand")
8266 (match_operand:SI 3 "const_int_operand")]
8269 int mask = INTVAL (operands[3]);
8270 emit_insn (gen_sse2_shufpd_v2df<mask_expand4_name> (operands[0], operands[1],
8271 operands[2], GEN_INT (mask & 1),
8272 GEN_INT (mask & 2 ? 3 : 2)
8273 <mask_expand4_args>));
8277 (define_insn "sse2_shufpd_v2df_mask"
8278 [(set (match_operand:V2DF 0 "register_operand" "=v")
8282 (match_operand:V2DF 1 "register_operand" "v")
8283 (match_operand:V2DF 2 "nonimmediate_operand" "vm"))
8284 (parallel [(match_operand 3 "const_0_to_1_operand")
8285 (match_operand 4 "const_2_to_3_operand")]))
8286 (match_operand:V2DF 5 "vector_move_operand" "0C")
8287 (match_operand:QI 6 "register_operand" "Yk")))]
8291 mask = INTVAL (operands[3]);
8292 mask |= (INTVAL (operands[4]) - 2) << 1;
8293 operands[3] = GEN_INT (mask);
8295 return "vshufpd\t{%3, %2, %1, %0%{%6%}%N5|%0%{6%}%N5, %1, %2, %3}";
8297 [(set_attr "type" "sseshuf")
8298 (set_attr "length_immediate" "1")
8299 (set_attr "prefix" "evex")
8300 (set_attr "mode" "V2DF")])
8302 ;; punpcklqdq and punpckhqdq are shorter than shufpd.
8303 (define_insn "avx2_interleave_highv4di<mask_name>"
8304 [(set (match_operand:V4DI 0 "register_operand" "=v")
8307 (match_operand:V4DI 1 "register_operand" "v")
8308 (match_operand:V4DI 2 "nonimmediate_operand" "vm"))
8309 (parallel [(const_int 1)
8313 "TARGET_AVX2 && <mask_avx512vl_condition>"
8314 "vpunpckhqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8315 [(set_attr "type" "sselog")
8316 (set_attr "prefix" "vex")
8317 (set_attr "mode" "OI")])
8319 (define_insn "<mask_codefor>avx512f_interleave_highv8di<mask_name>"
8320 [(set (match_operand:V8DI 0 "register_operand" "=v")
8323 (match_operand:V8DI 1 "register_operand" "v")
8324 (match_operand:V8DI 2 "nonimmediate_operand" "vm"))
8325 (parallel [(const_int 1) (const_int 9)
8326 (const_int 3) (const_int 11)
8327 (const_int 5) (const_int 13)
8328 (const_int 7) (const_int 15)])))]
8330 "vpunpckhqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8331 [(set_attr "type" "sselog")
8332 (set_attr "prefix" "evex")
8333 (set_attr "mode" "XI")])
8335 (define_insn "vec_interleave_highv2di<mask_name>"
8336 [(set (match_operand:V2DI 0 "register_operand" "=x,v")
8339 (match_operand:V2DI 1 "register_operand" "0,v")
8340 (match_operand:V2DI 2 "vector_operand" "xBm,vm"))
8341 (parallel [(const_int 1)
8343 "TARGET_SSE2 && <mask_avx512vl_condition>"
8345 punpckhqdq\t{%2, %0|%0, %2}
8346 vpunpckhqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8347 [(set_attr "isa" "noavx,avx")
8348 (set_attr "type" "sselog")
8349 (set_attr "prefix_data16" "1,*")
8350 (set_attr "prefix" "orig,<mask_prefix>")
8351 (set_attr "mode" "TI")])
8353 (define_insn "avx2_interleave_lowv4di<mask_name>"
8354 [(set (match_operand:V4DI 0 "register_operand" "=v")
8357 (match_operand:V4DI 1 "register_operand" "v")
8358 (match_operand:V4DI 2 "nonimmediate_operand" "vm"))
8359 (parallel [(const_int 0)
8363 "TARGET_AVX2 && <mask_avx512vl_condition>"
8364 "vpunpcklqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8365 [(set_attr "type" "sselog")
8366 (set_attr "prefix" "vex")
8367 (set_attr "mode" "OI")])
8369 (define_insn "<mask_codefor>avx512f_interleave_lowv8di<mask_name>"
8370 [(set (match_operand:V8DI 0 "register_operand" "=v")
8373 (match_operand:V8DI 1 "register_operand" "v")
8374 (match_operand:V8DI 2 "nonimmediate_operand" "vm"))
8375 (parallel [(const_int 0) (const_int 8)
8376 (const_int 2) (const_int 10)
8377 (const_int 4) (const_int 12)
8378 (const_int 6) (const_int 14)])))]
8380 "vpunpcklqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8381 [(set_attr "type" "sselog")
8382 (set_attr "prefix" "evex")
8383 (set_attr "mode" "XI")])
8385 (define_insn "vec_interleave_lowv2di<mask_name>"
8386 [(set (match_operand:V2DI 0 "register_operand" "=x,v")
8389 (match_operand:V2DI 1 "register_operand" "0,v")
8390 (match_operand:V2DI 2 "vector_operand" "xBm,vm"))
8391 (parallel [(const_int 0)
8393 "TARGET_SSE2 && <mask_avx512vl_condition>"
8395 punpcklqdq\t{%2, %0|%0, %2}
8396 vpunpcklqdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
8397 [(set_attr "isa" "noavx,avx")
8398 (set_attr "type" "sselog")
8399 (set_attr "prefix_data16" "1,*")
8400 (set_attr "prefix" "orig,vex")
8401 (set_attr "mode" "TI")])
8403 (define_insn "sse2_shufpd_<mode>"
8404 [(set (match_operand:VI8F_128 0 "register_operand" "=x,v")
8405 (vec_select:VI8F_128
8406 (vec_concat:<ssedoublevecmode>
8407 (match_operand:VI8F_128 1 "register_operand" "0,v")
8408 (match_operand:VI8F_128 2 "vector_operand" "xBm,vm"))
8409 (parallel [(match_operand 3 "const_0_to_1_operand")
8410 (match_operand 4 "const_2_to_3_operand")])))]
8414 mask = INTVAL (operands[3]);
8415 mask |= (INTVAL (operands[4]) - 2) << 1;
8416 operands[3] = GEN_INT (mask);
8418 switch (which_alternative)
8421 return "shufpd\t{%3, %2, %0|%0, %2, %3}";
8423 return "vshufpd\t{%3, %2, %1, %0|%0, %1, %2, %3}";
8428 [(set_attr "isa" "noavx,avx")
8429 (set_attr "type" "sseshuf")
8430 (set_attr "length_immediate" "1")
8431 (set_attr "prefix" "orig,maybe_evex")
8432 (set_attr "mode" "V2DF")])
8434 ;; Avoid combining registers from different units in a single alternative,
8435 ;; see comment above inline_secondary_memory_needed function in i386.c
8436 (define_insn "sse2_storehpd"
8437 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,Yv,x,*f,r")
8439 (match_operand:V2DF 1 "nonimmediate_operand" " v,0, v,o,o,o")
8440 (parallel [(const_int 1)])))]
8441 "TARGET_SSE2 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
8443 %vmovhpd\t{%1, %0|%0, %1}
8445 vunpckhpd\t{%d1, %0|%0, %d1}
8449 [(set_attr "isa" "*,noavx,avx,*,*,*")
8450 (set_attr "type" "ssemov,sselog1,sselog1,ssemov,fmov,imov")
8451 (set (attr "prefix_data16")
8453 (and (eq_attr "alternative" "0")
8454 (not (match_test "TARGET_AVX")))
8456 (const_string "*")))
8457 (set_attr "prefix" "maybe_vex,orig,maybe_evex,*,*,*")
8458 (set_attr "mode" "V1DF,V1DF,V2DF,DF,DF,DF")])
8461 [(set (match_operand:DF 0 "register_operand")
8463 (match_operand:V2DF 1 "memory_operand")
8464 (parallel [(const_int 1)])))]
8465 "TARGET_SSE2 && reload_completed"
8466 [(set (match_dup 0) (match_dup 1))]
8467 "operands[1] = adjust_address (operands[1], DFmode, 8);")
8469 (define_insn "*vec_extractv2df_1_sse"
8470 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,x")
8472 (match_operand:V2DF 1 "nonimmediate_operand" "x,x,o")
8473 (parallel [(const_int 1)])))]
8474 "!TARGET_SSE2 && TARGET_SSE
8475 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
8477 movhps\t{%1, %0|%q0, %1}
8478 movhlps\t{%1, %0|%0, %1}
8479 movlps\t{%H1, %0|%0, %H1}"
8480 [(set_attr "type" "ssemov")
8481 (set_attr "mode" "V2SF,V4SF,V2SF")])
8483 ;; Avoid combining registers from different units in a single alternative,
8484 ;; see comment above inline_secondary_memory_needed function in i386.c
8485 (define_insn "sse2_storelpd"
8486 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,x,*f,r")
8488 (match_operand:V2DF 1 "nonimmediate_operand" " v,x,m,m,m")
8489 (parallel [(const_int 0)])))]
8490 "TARGET_SSE2 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
8492 %vmovlpd\t{%1, %0|%0, %1}
8497 [(set_attr "type" "ssemov,ssemov,ssemov,fmov,imov")
8498 (set_attr "prefix_data16" "1,*,*,*,*")
8499 (set_attr "prefix" "maybe_vex")
8500 (set_attr "mode" "V1DF,DF,DF,DF,DF")])
8503 [(set (match_operand:DF 0 "register_operand")
8505 (match_operand:V2DF 1 "nonimmediate_operand")
8506 (parallel [(const_int 0)])))]
8507 "TARGET_SSE2 && reload_completed"
8508 [(set (match_dup 0) (match_dup 1))]
8509 "operands[1] = gen_lowpart (DFmode, operands[1]);")
8511 (define_insn "*vec_extractv2df_0_sse"
8512 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,x")
8514 (match_operand:V2DF 1 "nonimmediate_operand" "x,x,m")
8515 (parallel [(const_int 0)])))]
8516 "!TARGET_SSE2 && TARGET_SSE
8517 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
8519 movlps\t{%1, %0|%0, %1}
8520 movaps\t{%1, %0|%0, %1}
8521 movlps\t{%1, %0|%0, %q1}"
8522 [(set_attr "type" "ssemov")
8523 (set_attr "mode" "V2SF,V4SF,V2SF")])
8525 (define_expand "sse2_loadhpd_exp"
8526 [(set (match_operand:V2DF 0 "nonimmediate_operand")
8529 (match_operand:V2DF 1 "nonimmediate_operand")
8530 (parallel [(const_int 0)]))
8531 (match_operand:DF 2 "nonimmediate_operand")))]
8534 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V2DFmode, operands);
8536 emit_insn (gen_sse2_loadhpd (dst, operands[1], operands[2]));
8538 /* Fix up the destination if needed. */
8539 if (dst != operands[0])
8540 emit_move_insn (operands[0], dst);
8545 ;; Avoid combining registers from different units in a single alternative,
8546 ;; see comment above inline_secondary_memory_needed function in i386.c
8547 (define_insn "sse2_loadhpd"
8548 [(set (match_operand:V2DF 0 "nonimmediate_operand"
8552 (match_operand:V2DF 1 "nonimmediate_operand"
8554 (parallel [(const_int 0)]))
8555 (match_operand:DF 2 "nonimmediate_operand"
8556 " m,m,x,v,x,*f,r")))]
8557 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
8559 movhpd\t{%2, %0|%0, %2}
8560 vmovhpd\t{%2, %1, %0|%0, %1, %2}
8561 unpcklpd\t{%2, %0|%0, %2}
8562 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
8566 [(set_attr "isa" "noavx,avx,noavx,avx,*,*,*")
8567 (set_attr "type" "ssemov,ssemov,sselog,sselog,ssemov,fmov,imov")
8568 (set_attr "prefix_data16" "1,*,*,*,*,*,*")
8569 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,*,*,*")
8570 (set_attr "mode" "V1DF,V1DF,V2DF,V2DF,DF,DF,DF")])
8573 [(set (match_operand:V2DF 0 "memory_operand")
8575 (vec_select:DF (match_dup 0) (parallel [(const_int 0)]))
8576 (match_operand:DF 1 "register_operand")))]
8577 "TARGET_SSE2 && reload_completed"
8578 [(set (match_dup 0) (match_dup 1))]
8579 "operands[0] = adjust_address (operands[0], DFmode, 8);")
8581 (define_expand "sse2_loadlpd_exp"
8582 [(set (match_operand:V2DF 0 "nonimmediate_operand")
8584 (match_operand:DF 2 "nonimmediate_operand")
8586 (match_operand:V2DF 1 "nonimmediate_operand")
8587 (parallel [(const_int 1)]))))]
8590 rtx dst = ix86_fixup_binary_operands (UNKNOWN, V2DFmode, operands);
8592 emit_insn (gen_sse2_loadlpd (dst, operands[1], operands[2]));
8594 /* Fix up the destination if needed. */
8595 if (dst != operands[0])
8596 emit_move_insn (operands[0], dst);
8601 ;; Avoid combining registers from different units in a single alternative,
8602 ;; see comment above inline_secondary_memory_needed function in i386.c
8603 (define_insn "sse2_loadlpd"
8604 [(set (match_operand:V2DF 0 "nonimmediate_operand"
8605 "=v,x,v,x,v,x,x,v,m,m ,m")
8607 (match_operand:DF 2 "nonimmediate_operand"
8608 "vm,m,m,x,v,0,0,v,x,*f,r")
8610 (match_operand:V2DF 1 "vector_move_operand"
8611 " C,0,v,0,v,x,o,o,0,0 ,0")
8612 (parallel [(const_int 1)]))))]
8613 "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
8615 %vmovq\t{%2, %0|%0, %2}
8616 movlpd\t{%2, %0|%0, %2}
8617 vmovlpd\t{%2, %1, %0|%0, %1, %2}
8618 movsd\t{%2, %0|%0, %2}
8619 vmovsd\t{%2, %1, %0|%0, %1, %2}
8620 shufpd\t{$2, %1, %0|%0, %1, 2}
8621 movhpd\t{%H1, %0|%0, %H1}
8622 vmovhpd\t{%H1, %2, %0|%0, %2, %H1}
8626 [(set_attr "isa" "*,noavx,avx,noavx,avx,noavx,noavx,avx,*,*,*")
8628 (cond [(eq_attr "alternative" "5")
8629 (const_string "sselog")
8630 (eq_attr "alternative" "9")
8631 (const_string "fmov")
8632 (eq_attr "alternative" "10")
8633 (const_string "imov")
8635 (const_string "ssemov")))
8636 (set_attr "prefix_data16" "*,1,*,*,*,*,1,*,*,*,*")
8637 (set_attr "length_immediate" "*,*,*,*,*,1,*,*,*,*,*")
8638 (set_attr "prefix" "maybe_vex,orig,maybe_evex,orig,maybe_evex,orig,orig,maybe_evex,*,*,*")
8639 (set_attr "mode" "DF,V1DF,V1DF,V1DF,V1DF,V2DF,V1DF,V1DF,DF,DF,DF")])
8642 [(set (match_operand:V2DF 0 "memory_operand")
8644 (match_operand:DF 1 "register_operand")
8645 (vec_select:DF (match_dup 0) (parallel [(const_int 1)]))))]
8646 "TARGET_SSE2 && reload_completed"
8647 [(set (match_dup 0) (match_dup 1))]
8648 "operands[0] = adjust_address (operands[0], DFmode, 0);")
8650 (define_insn "sse2_movsd"
8651 [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,v,x,v,m,x,x,v,o")
8653 (match_operand:V2DF 2 "nonimmediate_operand" " x,v,m,m,v,0,0,v,0")
8654 (match_operand:V2DF 1 "nonimmediate_operand" " 0,v,0,v,0,x,o,o,v")
8658 movsd\t{%2, %0|%0, %2}
8659 vmovsd\t{%2, %1, %0|%0, %1, %2}
8660 movlpd\t{%2, %0|%0, %q2}
8661 vmovlpd\t{%2, %1, %0|%0, %1, %q2}
8662 %vmovlpd\t{%2, %0|%q0, %2}
8663 shufpd\t{$2, %1, %0|%0, %1, 2}
8664 movhps\t{%H1, %0|%0, %H1}
8665 vmovhps\t{%H1, %2, %0|%0, %2, %H1}
8666 %vmovhps\t{%1, %H0|%H0, %1}"
8667 [(set_attr "isa" "noavx,avx,noavx,avx,*,noavx,noavx,avx,*")
8670 (eq_attr "alternative" "5")
8671 (const_string "sselog")
8672 (const_string "ssemov")))
8673 (set (attr "prefix_data16")
8675 (and (eq_attr "alternative" "2,4")
8676 (not (match_test "TARGET_AVX")))
8678 (const_string "*")))
8679 (set_attr "length_immediate" "*,*,*,*,*,1,*,*,*")
8680 (set_attr "prefix" "orig,maybe_evex,orig,maybe_evex,maybe_vex,orig,orig,maybe_evex,maybe_vex")
8681 (set_attr "mode" "DF,DF,V1DF,V1DF,V1DF,V2DF,V1DF,V1DF,V1DF")])
8683 (define_insn "vec_dupv2df<mask_name>"
8684 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v")
8686 (match_operand:DF 1 "nonimmediate_operand" " 0,xm,vm")))]
8687 "TARGET_SSE2 && <mask_avx512vl_condition>"
8690 %vmovddup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}
8691 vmovddup\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
8692 [(set_attr "isa" "noavx,sse3,avx512vl")
8693 (set_attr "type" "sselog1")
8694 (set_attr "prefix" "orig,maybe_vex,evex")
8695 (set_attr "mode" "V2DF,DF,DF")])
8697 (define_insn "vec_concatv2df"
8698 [(set (match_operand:V2DF 0 "register_operand" "=x,x,v,x,v,x,x, v,x,x")
8700 (match_operand:DF 1 "nonimmediate_operand" " 0,x,v,m,m,0,x,xm,0,0")
8701 (match_operand:DF 2 "vector_move_operand" " x,x,v,1,1,m,m, C,x,m")))]
8703 && (!(MEM_P (operands[1]) && MEM_P (operands[2]))
8704 || (TARGET_SSE3 && rtx_equal_p (operands[1], operands[2])))"
8706 unpcklpd\t{%2, %0|%0, %2}
8707 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
8708 vunpcklpd\t{%2, %1, %0|%0, %1, %2}
8709 %vmovddup\t{%1, %0|%0, %1}
8710 vmovddup\t{%1, %0|%0, %1}
8711 movhpd\t{%2, %0|%0, %2}
8712 vmovhpd\t{%2, %1, %0|%0, %1, %2}
8713 %vmovq\t{%1, %0|%0, %1}
8714 movlhps\t{%2, %0|%0, %2}
8715 movhps\t{%2, %0|%0, %2}"
8716 [(set_attr "isa" "sse2_noavx,avx,avx512vl,sse3,avx512vl,sse2_noavx,avx,sse2,noavx,noavx")
8719 (eq_attr "alternative" "0,1,2,3,4")
8720 (const_string "sselog")
8721 (const_string "ssemov")))
8722 (set (attr "prefix_data16")
8723 (if_then_else (eq_attr "alternative" "5")
8725 (const_string "*")))
8726 (set_attr "prefix" "orig,vex,evex,maybe_vex,evex,orig,vex,maybe_vex,orig,orig")
8727 (set_attr "mode" "V2DF,V2DF,V2DF, DF, DF, V1DF,V1DF,DF,V4SF,V2SF")])
8729 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8731 ;; Parallel integer down-conversion operations
8733 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8735 (define_mode_iterator PMOV_DST_MODE_1 [V16QI V16HI V8SI V8HI])
8736 (define_mode_attr pmov_src_mode
8737 [(V16QI "V16SI") (V16HI "V16SI") (V8SI "V8DI") (V8HI "V8DI")])
8738 (define_mode_attr pmov_src_lower
8739 [(V16QI "v16si") (V16HI "v16si") (V8SI "v8di") (V8HI "v8di")])
8740 (define_mode_attr pmov_suff_1
8741 [(V16QI "db") (V16HI "dw") (V8SI "qd") (V8HI "qw")])
8743 (define_insn "*avx512f_<code><pmov_src_lower><mode>2"
8744 [(set (match_operand:PMOV_DST_MODE_1 0 "nonimmediate_operand" "=v,m")
8745 (any_truncate:PMOV_DST_MODE_1
8746 (match_operand:<pmov_src_mode> 1 "register_operand" "v,v")))]
8748 "vpmov<trunsuffix><pmov_suff_1>\t{%1, %0|%0, %1}"
8749 [(set_attr "type" "ssemov")
8750 (set_attr "memory" "none,store")
8751 (set_attr "prefix" "evex")
8752 (set_attr "mode" "<sseinsnmode>")])
8754 (define_insn "avx512f_<code><pmov_src_lower><mode>2_mask"
8755 [(set (match_operand:PMOV_DST_MODE_1 0 "nonimmediate_operand" "=v,m")
8756 (vec_merge:PMOV_DST_MODE_1
8757 (any_truncate:PMOV_DST_MODE_1
8758 (match_operand:<pmov_src_mode> 1 "register_operand" "v,v"))
8759 (match_operand:PMOV_DST_MODE_1 2 "vector_move_operand" "0C,0")
8760 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
8762 "vpmov<trunsuffix><pmov_suff_1>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
8763 [(set_attr "type" "ssemov")
8764 (set_attr "memory" "none,store")
8765 (set_attr "prefix" "evex")
8766 (set_attr "mode" "<sseinsnmode>")])
8768 (define_expand "avx512f_<code><pmov_src_lower><mode>2_mask_store"
8769 [(set (match_operand:PMOV_DST_MODE_1 0 "memory_operand")
8770 (vec_merge:PMOV_DST_MODE_1
8771 (any_truncate:PMOV_DST_MODE_1
8772 (match_operand:<pmov_src_mode> 1 "register_operand"))
8774 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
8777 (define_insn "avx512bw_<code>v32hiv32qi2"
8778 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=v,m")
8780 (match_operand:V32HI 1 "register_operand" "v,v")))]
8782 "vpmov<trunsuffix>wb\t{%1, %0|%0, %1}"
8783 [(set_attr "type" "ssemov")
8784 (set_attr "memory" "none,store")
8785 (set_attr "prefix" "evex")
8786 (set_attr "mode" "XI")])
8788 (define_insn "avx512bw_<code>v32hiv32qi2_mask"
8789 [(set (match_operand:V32QI 0 "nonimmediate_operand" "=v,m")
8792 (match_operand:V32HI 1 "register_operand" "v,v"))
8793 (match_operand:V32QI 2 "vector_move_operand" "0C,0")
8794 (match_operand:SI 3 "register_operand" "Yk,Yk")))]
8796 "vpmov<trunsuffix>wb\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
8797 [(set_attr "type" "ssemov")
8798 (set_attr "memory" "none,store")
8799 (set_attr "prefix" "evex")
8800 (set_attr "mode" "XI")])
8802 (define_expand "avx512bw_<code>v32hiv32qi2_mask_store"
8803 [(set (match_operand:V32QI 0 "nonimmediate_operand")
8806 (match_operand:V32HI 1 "register_operand"))
8808 (match_operand:SI 2 "register_operand")))]
8811 (define_mode_iterator PMOV_DST_MODE_2
8812 [V4SI V8HI (V16QI "TARGET_AVX512BW")])
8813 (define_mode_attr pmov_suff_2
8814 [(V16QI "wb") (V8HI "dw") (V4SI "qd")])
8816 (define_insn "*avx512vl_<code><ssedoublemodelower><mode>2"
8817 [(set (match_operand:PMOV_DST_MODE_2 0 "nonimmediate_operand" "=v,m")
8818 (any_truncate:PMOV_DST_MODE_2
8819 (match_operand:<ssedoublemode> 1 "register_operand" "v,v")))]
8821 "vpmov<trunsuffix><pmov_suff_2>\t{%1, %0|%0, %1}"
8822 [(set_attr "type" "ssemov")
8823 (set_attr "memory" "none,store")
8824 (set_attr "prefix" "evex")
8825 (set_attr "mode" "<sseinsnmode>")])
8827 (define_insn "<avx512>_<code><ssedoublemodelower><mode>2_mask"
8828 [(set (match_operand:PMOV_DST_MODE_2 0 "nonimmediate_operand" "=v,m")
8829 (vec_merge:PMOV_DST_MODE_2
8830 (any_truncate:PMOV_DST_MODE_2
8831 (match_operand:<ssedoublemode> 1 "register_operand" "v,v"))
8832 (match_operand:PMOV_DST_MODE_2 2 "vector_move_operand" "0C,0")
8833 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")))]
8835 "vpmov<trunsuffix><pmov_suff_2>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
8836 [(set_attr "type" "ssemov")
8837 (set_attr "memory" "none,store")
8838 (set_attr "prefix" "evex")
8839 (set_attr "mode" "<sseinsnmode>")])
8841 (define_expand "<avx512>_<code><ssedoublemodelower><mode>2_mask_store"
8842 [(set (match_operand:PMOV_DST_MODE_2 0 "nonimmediate_operand")
8843 (vec_merge:PMOV_DST_MODE_2
8844 (any_truncate:PMOV_DST_MODE_2
8845 (match_operand:<ssedoublemode> 1 "register_operand"))
8847 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
8850 (define_mode_iterator PMOV_SRC_MODE_3 [V4DI V2DI V8SI V4SI (V8HI "TARGET_AVX512BW")])
8851 (define_mode_attr pmov_dst_3
8852 [(V4DI "V4QI") (V2DI "V2QI") (V8SI "V8QI") (V4SI "V4QI") (V8HI "V8QI")])
8853 (define_mode_attr pmov_dst_zeroed_3
8854 [(V4DI "V12QI") (V2DI "V14QI") (V8SI "V8QI") (V4SI "V12QI") (V8HI "V8QI")])
8855 (define_mode_attr pmov_suff_3
8856 [(V4DI "qb") (V2DI "qb") (V8SI "db") (V4SI "db") (V8HI "wb")])
8858 (define_insn "*avx512vl_<code><mode>v<ssescalarnum>qi2"
8859 [(set (match_operand:V16QI 0 "register_operand" "=v")
8861 (any_truncate:<pmov_dst_3>
8862 (match_operand:PMOV_SRC_MODE_3 1 "register_operand" "v"))
8863 (match_operand:<pmov_dst_zeroed_3> 2 "const0_operand")))]
8865 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0|%0, %1}"
8866 [(set_attr "type" "ssemov")
8867 (set_attr "prefix" "evex")
8868 (set_attr "mode" "TI")])
8870 (define_insn "*avx512vl_<code>v2div2qi2_store"
8871 [(set (match_operand:V16QI 0 "memory_operand" "=m")
8874 (match_operand:V2DI 1 "register_operand" "v"))
8877 (parallel [(const_int 2) (const_int 3)
8878 (const_int 4) (const_int 5)
8879 (const_int 6) (const_int 7)
8880 (const_int 8) (const_int 9)
8881 (const_int 10) (const_int 11)
8882 (const_int 12) (const_int 13)
8883 (const_int 14) (const_int 15)]))))]
8885 "vpmov<trunsuffix>qb\t{%1, %0|%0, %1}"
8886 [(set_attr "type" "ssemov")
8887 (set_attr "memory" "store")
8888 (set_attr "prefix" "evex")
8889 (set_attr "mode" "TI")])
8891 (define_insn "avx512vl_<code>v2div2qi2_mask"
8892 [(set (match_operand:V16QI 0 "register_operand" "=v")
8896 (match_operand:V2DI 1 "register_operand" "v"))
8898 (match_operand:V16QI 2 "vector_move_operand" "0C")
8899 (parallel [(const_int 0) (const_int 1)]))
8900 (match_operand:QI 3 "register_operand" "Yk"))
8901 (const_vector:V14QI [(const_int 0) (const_int 0)
8902 (const_int 0) (const_int 0)
8903 (const_int 0) (const_int 0)
8904 (const_int 0) (const_int 0)
8905 (const_int 0) (const_int 0)
8906 (const_int 0) (const_int 0)
8907 (const_int 0) (const_int 0)])))]
8909 "vpmov<trunsuffix>qb\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
8910 [(set_attr "type" "ssemov")
8911 (set_attr "prefix" "evex")
8912 (set_attr "mode" "TI")])
8914 (define_insn "*avx512vl_<code>v2div2qi2_mask_1"
8915 [(set (match_operand:V16QI 0 "register_operand" "=v")
8919 (match_operand:V2DI 1 "register_operand" "v"))
8920 (const_vector:V2QI [(const_int 0) (const_int 0)])
8921 (match_operand:QI 2 "register_operand" "Yk"))
8922 (const_vector:V14QI [(const_int 0) (const_int 0)
8923 (const_int 0) (const_int 0)
8924 (const_int 0) (const_int 0)
8925 (const_int 0) (const_int 0)
8926 (const_int 0) (const_int 0)
8927 (const_int 0) (const_int 0)
8928 (const_int 0) (const_int 0)])))]
8930 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
8931 [(set_attr "type" "ssemov")
8932 (set_attr "prefix" "evex")
8933 (set_attr "mode" "TI")])
8935 (define_insn "avx512vl_<code>v2div2qi2_mask_store"
8936 [(set (match_operand:V16QI 0 "memory_operand" "=m")
8940 (match_operand:V2DI 1 "register_operand" "v"))
8943 (parallel [(const_int 0) (const_int 1)]))
8944 (match_operand:QI 2 "register_operand" "Yk"))
8947 (parallel [(const_int 2) (const_int 3)
8948 (const_int 4) (const_int 5)
8949 (const_int 6) (const_int 7)
8950 (const_int 8) (const_int 9)
8951 (const_int 10) (const_int 11)
8952 (const_int 12) (const_int 13)
8953 (const_int 14) (const_int 15)]))))]
8955 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}|%w0%{%2%}, %1}"
8956 [(set_attr "type" "ssemov")
8957 (set_attr "memory" "store")
8958 (set_attr "prefix" "evex")
8959 (set_attr "mode" "TI")])
8961 (define_insn "*avx512vl_<code><mode>v4qi2_store"
8962 [(set (match_operand:V16QI 0 "memory_operand" "=m")
8965 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
8968 (parallel [(const_int 4) (const_int 5)
8969 (const_int 6) (const_int 7)
8970 (const_int 8) (const_int 9)
8971 (const_int 10) (const_int 11)
8972 (const_int 12) (const_int 13)
8973 (const_int 14) (const_int 15)]))))]
8975 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0|%0, %1}"
8976 [(set_attr "type" "ssemov")
8977 (set_attr "memory" "store")
8978 (set_attr "prefix" "evex")
8979 (set_attr "mode" "TI")])
8981 (define_insn "avx512vl_<code><mode>v4qi2_mask"
8982 [(set (match_operand:V16QI 0 "register_operand" "=v")
8986 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
8988 (match_operand:V16QI 2 "vector_move_operand" "0C")
8989 (parallel [(const_int 0) (const_int 1)
8990 (const_int 2) (const_int 3)]))
8991 (match_operand:QI 3 "register_operand" "Yk"))
8992 (const_vector:V12QI [(const_int 0) (const_int 0)
8993 (const_int 0) (const_int 0)
8994 (const_int 0) (const_int 0)
8995 (const_int 0) (const_int 0)
8996 (const_int 0) (const_int 0)
8997 (const_int 0) (const_int 0)])))]
8999 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9000 [(set_attr "type" "ssemov")
9001 (set_attr "prefix" "evex")
9002 (set_attr "mode" "TI")])
9004 (define_insn "*avx512vl_<code><mode>v4qi2_mask_1"
9005 [(set (match_operand:V16QI 0 "register_operand" "=v")
9009 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9010 (const_vector:V4QI [(const_int 0) (const_int 0)
9011 (const_int 0) (const_int 0)])
9012 (match_operand:QI 2 "register_operand" "Yk"))
9013 (const_vector:V12QI [(const_int 0) (const_int 0)
9014 (const_int 0) (const_int 0)
9015 (const_int 0) (const_int 0)
9016 (const_int 0) (const_int 0)
9017 (const_int 0) (const_int 0)
9018 (const_int 0) (const_int 0)])))]
9020 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9021 [(set_attr "type" "ssemov")
9022 (set_attr "prefix" "evex")
9023 (set_attr "mode" "TI")])
9025 (define_insn "avx512vl_<code><mode>v4qi2_mask_store"
9026 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9030 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9033 (parallel [(const_int 0) (const_int 1)
9034 (const_int 2) (const_int 3)]))
9035 (match_operand:QI 2 "register_operand" "Yk"))
9038 (parallel [(const_int 4) (const_int 5)
9039 (const_int 6) (const_int 7)
9040 (const_int 8) (const_int 9)
9041 (const_int 10) (const_int 11)
9042 (const_int 12) (const_int 13)
9043 (const_int 14) (const_int 15)]))))]
9046 if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 8)
9047 return "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}|%k0%{%2%}, %1}";
9048 return "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}|%0%{%2%}, %g1}";
9050 [(set_attr "type" "ssemov")
9051 (set_attr "memory" "store")
9052 (set_attr "prefix" "evex")
9053 (set_attr "mode" "TI")])
9055 (define_mode_iterator VI2_128_BW_4_256
9056 [(V8HI "TARGET_AVX512BW") V8SI])
9058 (define_insn "*avx512vl_<code><mode>v8qi2_store"
9059 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9062 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9065 (parallel [(const_int 8) (const_int 9)
9066 (const_int 10) (const_int 11)
9067 (const_int 12) (const_int 13)
9068 (const_int 14) (const_int 15)]))))]
9070 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0|%0, %1}"
9071 [(set_attr "type" "ssemov")
9072 (set_attr "memory" "store")
9073 (set_attr "prefix" "evex")
9074 (set_attr "mode" "TI")])
9076 (define_insn "avx512vl_<code><mode>v8qi2_mask"
9077 [(set (match_operand:V16QI 0 "register_operand" "=v")
9081 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9083 (match_operand:V16QI 2 "vector_move_operand" "0C")
9084 (parallel [(const_int 0) (const_int 1)
9085 (const_int 2) (const_int 3)
9086 (const_int 4) (const_int 5)
9087 (const_int 6) (const_int 7)]))
9088 (match_operand:QI 3 "register_operand" "Yk"))
9089 (const_vector:V8QI [(const_int 0) (const_int 0)
9090 (const_int 0) (const_int 0)
9091 (const_int 0) (const_int 0)
9092 (const_int 0) (const_int 0)])))]
9094 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9095 [(set_attr "type" "ssemov")
9096 (set_attr "prefix" "evex")
9097 (set_attr "mode" "TI")])
9099 (define_insn "*avx512vl_<code><mode>v8qi2_mask_1"
9100 [(set (match_operand:V16QI 0 "register_operand" "=v")
9104 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9105 (const_vector:V8QI [(const_int 0) (const_int 0)
9106 (const_int 0) (const_int 0)
9107 (const_int 0) (const_int 0)
9108 (const_int 0) (const_int 0)])
9109 (match_operand:QI 2 "register_operand" "Yk"))
9110 (const_vector:V8QI [(const_int 0) (const_int 0)
9111 (const_int 0) (const_int 0)
9112 (const_int 0) (const_int 0)
9113 (const_int 0) (const_int 0)])))]
9115 "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9116 [(set_attr "type" "ssemov")
9117 (set_attr "prefix" "evex")
9118 (set_attr "mode" "TI")])
9120 (define_insn "avx512vl_<code><mode>v8qi2_mask_store"
9121 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9125 (match_operand:VI2_128_BW_4_256 1 "register_operand" "v"))
9128 (parallel [(const_int 0) (const_int 1)
9129 (const_int 2) (const_int 3)
9130 (const_int 4) (const_int 5)
9131 (const_int 6) (const_int 7)]))
9132 (match_operand:QI 2 "register_operand" "Yk"))
9135 (parallel [(const_int 8) (const_int 9)
9136 (const_int 10) (const_int 11)
9137 (const_int 12) (const_int 13)
9138 (const_int 14) (const_int 15)]))))]
9141 if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 4)
9142 return "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}|%0%{%2%}, %g1}";
9143 return "vpmov<trunsuffix><pmov_suff_3>\t{%1, %0%{%2%}|%0%{%2%}, %1}";
9145 [(set_attr "type" "ssemov")
9146 (set_attr "memory" "store")
9147 (set_attr "prefix" "evex")
9148 (set_attr "mode" "TI")])
9150 (define_mode_iterator PMOV_SRC_MODE_4 [V4DI V2DI V4SI])
9151 (define_mode_attr pmov_dst_4
9152 [(V4DI "V4HI") (V2DI "V2HI") (V4SI "V4HI")])
9153 (define_mode_attr pmov_dst_zeroed_4
9154 [(V4DI "V4HI") (V2DI "V6HI") (V4SI "V4HI")])
9155 (define_mode_attr pmov_suff_4
9156 [(V4DI "qw") (V2DI "qw") (V4SI "dw")])
9158 (define_insn "*avx512vl_<code><mode>v<ssescalarnum>hi2"
9159 [(set (match_operand:V8HI 0 "register_operand" "=v")
9161 (any_truncate:<pmov_dst_4>
9162 (match_operand:PMOV_SRC_MODE_4 1 "register_operand" "v"))
9163 (match_operand:<pmov_dst_zeroed_4> 2 "const0_operand")))]
9165 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0|%0, %1}"
9166 [(set_attr "type" "ssemov")
9167 (set_attr "prefix" "evex")
9168 (set_attr "mode" "TI")])
9170 (define_insn "*avx512vl_<code><mode>v4hi2_store"
9171 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9174 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9177 (parallel [(const_int 4) (const_int 5)
9178 (const_int 6) (const_int 7)]))))]
9180 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0|%0, %1}"
9181 [(set_attr "type" "ssemov")
9182 (set_attr "memory" "store")
9183 (set_attr "prefix" "evex")
9184 (set_attr "mode" "TI")])
9186 (define_insn "avx512vl_<code><mode>v4hi2_mask"
9187 [(set (match_operand:V8HI 0 "register_operand" "=v")
9191 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9193 (match_operand:V8HI 2 "vector_move_operand" "0C")
9194 (parallel [(const_int 0) (const_int 1)
9195 (const_int 2) (const_int 3)]))
9196 (match_operand:QI 3 "register_operand" "Yk"))
9197 (const_vector:V4HI [(const_int 0) (const_int 0)
9198 (const_int 0) (const_int 0)])))]
9200 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9201 [(set_attr "type" "ssemov")
9202 (set_attr "prefix" "evex")
9203 (set_attr "mode" "TI")])
9205 (define_insn "*avx512vl_<code><mode>v4hi2_mask_1"
9206 [(set (match_operand:V8HI 0 "register_operand" "=v")
9210 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9211 (const_vector:V4HI [(const_int 0) (const_int 0)
9212 (const_int 0) (const_int 0)])
9213 (match_operand:QI 2 "register_operand" "Yk"))
9214 (const_vector:V4HI [(const_int 0) (const_int 0)
9215 (const_int 0) (const_int 0)])))]
9217 "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9218 [(set_attr "type" "ssemov")
9219 (set_attr "prefix" "evex")
9220 (set_attr "mode" "TI")])
9222 (define_insn "avx512vl_<code><mode>v4hi2_mask_store"
9223 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9227 (match_operand:VI4_128_8_256 1 "register_operand" "v"))
9230 (parallel [(const_int 0) (const_int 1)
9231 (const_int 2) (const_int 3)]))
9232 (match_operand:QI 2 "register_operand" "Yk"))
9235 (parallel [(const_int 4) (const_int 5)
9236 (const_int 6) (const_int 7)]))))]
9239 if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 4)
9240 return "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%2%}|%0%{%2%}, %t1}";
9241 return "vpmov<trunsuffix><pmov_suff_4>\t{%1, %0%{%2%}|%0%{%2%}, %g1}";
9243 [(set_attr "type" "ssemov")
9244 (set_attr "memory" "store")
9245 (set_attr "prefix" "evex")
9246 (set_attr "mode" "TI")])
9248 (define_insn "*avx512vl_<code>v2div2hi2_store"
9249 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9252 (match_operand:V2DI 1 "register_operand" "v"))
9255 (parallel [(const_int 2) (const_int 3)
9256 (const_int 4) (const_int 5)
9257 (const_int 6) (const_int 7)]))))]
9259 "vpmov<trunsuffix>qw\t{%1, %0|%0, %1}"
9260 [(set_attr "type" "ssemov")
9261 (set_attr "memory" "store")
9262 (set_attr "prefix" "evex")
9263 (set_attr "mode" "TI")])
9265 (define_insn "avx512vl_<code>v2div2hi2_mask"
9266 [(set (match_operand:V8HI 0 "register_operand" "=v")
9270 (match_operand:V2DI 1 "register_operand" "v"))
9272 (match_operand:V8HI 2 "vector_move_operand" "0C")
9273 (parallel [(const_int 0) (const_int 1)]))
9274 (match_operand:QI 3 "register_operand" "Yk"))
9275 (const_vector:V6HI [(const_int 0) (const_int 0)
9276 (const_int 0) (const_int 0)
9277 (const_int 0) (const_int 0)])))]
9279 "vpmov<trunsuffix>qw\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9280 [(set_attr "type" "ssemov")
9281 (set_attr "prefix" "evex")
9282 (set_attr "mode" "TI")])
9284 (define_insn "*avx512vl_<code>v2div2hi2_mask_1"
9285 [(set (match_operand:V8HI 0 "register_operand" "=v")
9289 (match_operand:V2DI 1 "register_operand" "v"))
9290 (const_vector:V2HI [(const_int 0) (const_int 0)])
9291 (match_operand:QI 2 "register_operand" "Yk"))
9292 (const_vector:V6HI [(const_int 0) (const_int 0)
9293 (const_int 0) (const_int 0)
9294 (const_int 0) (const_int 0)])))]
9296 "vpmov<trunsuffix>qw\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9297 [(set_attr "type" "ssemov")
9298 (set_attr "prefix" "evex")
9299 (set_attr "mode" "TI")])
9301 (define_insn "avx512vl_<code>v2div2hi2_mask_store"
9302 [(set (match_operand:V8HI 0 "memory_operand" "=m")
9306 (match_operand:V2DI 1 "register_operand" "v"))
9309 (parallel [(const_int 0) (const_int 1)]))
9310 (match_operand:QI 2 "register_operand" "Yk"))
9313 (parallel [(const_int 2) (const_int 3)
9314 (const_int 4) (const_int 5)
9315 (const_int 6) (const_int 7)]))))]
9317 "vpmov<trunsuffix>qw\t{%1, %0%{%2%}|%0%{%2%}, %g1}"
9318 [(set_attr "type" "ssemov")
9319 (set_attr "memory" "store")
9320 (set_attr "prefix" "evex")
9321 (set_attr "mode" "TI")])
9323 (define_insn "*avx512vl_<code>v2div2si2"
9324 [(set (match_operand:V4SI 0 "register_operand" "=v")
9327 (match_operand:V2DI 1 "register_operand" "v"))
9328 (match_operand:V2SI 2 "const0_operand")))]
9330 "vpmov<trunsuffix>qd\t{%1, %0|%0, %1}"
9331 [(set_attr "type" "ssemov")
9332 (set_attr "prefix" "evex")
9333 (set_attr "mode" "TI")])
9335 (define_insn "*avx512vl_<code>v2div2si2_store"
9336 [(set (match_operand:V4SI 0 "memory_operand" "=m")
9339 (match_operand:V2DI 1 "register_operand" "v"))
9342 (parallel [(const_int 2) (const_int 3)]))))]
9344 "vpmov<trunsuffix>qd\t{%1, %0|%0, %1}"
9345 [(set_attr "type" "ssemov")
9346 (set_attr "memory" "store")
9347 (set_attr "prefix" "evex")
9348 (set_attr "mode" "TI")])
9350 (define_insn "avx512vl_<code>v2div2si2_mask"
9351 [(set (match_operand:V4SI 0 "register_operand" "=v")
9355 (match_operand:V2DI 1 "register_operand" "v"))
9357 (match_operand:V4SI 2 "vector_move_operand" "0C")
9358 (parallel [(const_int 0) (const_int 1)]))
9359 (match_operand:QI 3 "register_operand" "Yk"))
9360 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
9362 "vpmov<trunsuffix>qd\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9363 [(set_attr "type" "ssemov")
9364 (set_attr "prefix" "evex")
9365 (set_attr "mode" "TI")])
9367 (define_insn "*avx512vl_<code>v2div2si2_mask_1"
9368 [(set (match_operand:V4SI 0 "register_operand" "=v")
9372 (match_operand:V2DI 1 "register_operand" "v"))
9373 (const_vector:V2SI [(const_int 0) (const_int 0)])
9374 (match_operand:QI 2 "register_operand" "Yk"))
9375 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
9377 "vpmov<trunsuffix>qd\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9378 [(set_attr "type" "ssemov")
9379 (set_attr "prefix" "evex")
9380 (set_attr "mode" "TI")])
9382 (define_insn "avx512vl_<code>v2div2si2_mask_store"
9383 [(set (match_operand:V4SI 0 "memory_operand" "=m")
9387 (match_operand:V2DI 1 "register_operand" "v"))
9390 (parallel [(const_int 0) (const_int 1)]))
9391 (match_operand:QI 2 "register_operand" "Yk"))
9394 (parallel [(const_int 2) (const_int 3)]))))]
9396 "vpmov<trunsuffix>qd\t{%1, %0%{%2%}|%0%{%2%}, %t1}"
9397 [(set_attr "type" "ssemov")
9398 (set_attr "memory" "store")
9399 (set_attr "prefix" "evex")
9400 (set_attr "mode" "TI")])
9402 (define_insn "*avx512f_<code>v8div16qi2"
9403 [(set (match_operand:V16QI 0 "register_operand" "=v")
9406 (match_operand:V8DI 1 "register_operand" "v"))
9407 (const_vector:V8QI [(const_int 0) (const_int 0)
9408 (const_int 0) (const_int 0)
9409 (const_int 0) (const_int 0)
9410 (const_int 0) (const_int 0)])))]
9412 "vpmov<trunsuffix>qb\t{%1, %0|%0, %1}"
9413 [(set_attr "type" "ssemov")
9414 (set_attr "prefix" "evex")
9415 (set_attr "mode" "TI")])
9417 (define_insn "*avx512f_<code>v8div16qi2_store"
9418 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9421 (match_operand:V8DI 1 "register_operand" "v"))
9424 (parallel [(const_int 8) (const_int 9)
9425 (const_int 10) (const_int 11)
9426 (const_int 12) (const_int 13)
9427 (const_int 14) (const_int 15)]))))]
9429 "vpmov<trunsuffix>qb\t{%1, %0|%0, %1}"
9430 [(set_attr "type" "ssemov")
9431 (set_attr "memory" "store")
9432 (set_attr "prefix" "evex")
9433 (set_attr "mode" "TI")])
9435 (define_insn "avx512f_<code>v8div16qi2_mask"
9436 [(set (match_operand:V16QI 0 "register_operand" "=v")
9440 (match_operand:V8DI 1 "register_operand" "v"))
9442 (match_operand:V16QI 2 "vector_move_operand" "0C")
9443 (parallel [(const_int 0) (const_int 1)
9444 (const_int 2) (const_int 3)
9445 (const_int 4) (const_int 5)
9446 (const_int 6) (const_int 7)]))
9447 (match_operand:QI 3 "register_operand" "Yk"))
9448 (const_vector:V8QI [(const_int 0) (const_int 0)
9449 (const_int 0) (const_int 0)
9450 (const_int 0) (const_int 0)
9451 (const_int 0) (const_int 0)])))]
9453 "vpmov<trunsuffix>qb\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
9454 [(set_attr "type" "ssemov")
9455 (set_attr "prefix" "evex")
9456 (set_attr "mode" "TI")])
9458 (define_insn "*avx512f_<code>v8div16qi2_mask_1"
9459 [(set (match_operand:V16QI 0 "register_operand" "=v")
9463 (match_operand:V8DI 1 "register_operand" "v"))
9464 (const_vector:V8QI [(const_int 0) (const_int 0)
9465 (const_int 0) (const_int 0)
9466 (const_int 0) (const_int 0)
9467 (const_int 0) (const_int 0)])
9468 (match_operand:QI 2 "register_operand" "Yk"))
9469 (const_vector:V8QI [(const_int 0) (const_int 0)
9470 (const_int 0) (const_int 0)
9471 (const_int 0) (const_int 0)
9472 (const_int 0) (const_int 0)])))]
9474 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}%{z%}|%0%{%2%}%{z%}, %1}"
9475 [(set_attr "type" "ssemov")
9476 (set_attr "prefix" "evex")
9477 (set_attr "mode" "TI")])
9479 (define_insn "avx512f_<code>v8div16qi2_mask_store"
9480 [(set (match_operand:V16QI 0 "memory_operand" "=m")
9484 (match_operand:V8DI 1 "register_operand" "v"))
9487 (parallel [(const_int 0) (const_int 1)
9488 (const_int 2) (const_int 3)
9489 (const_int 4) (const_int 5)
9490 (const_int 6) (const_int 7)]))
9491 (match_operand:QI 2 "register_operand" "Yk"))
9494 (parallel [(const_int 8) (const_int 9)
9495 (const_int 10) (const_int 11)
9496 (const_int 12) (const_int 13)
9497 (const_int 14) (const_int 15)]))))]
9499 "vpmov<trunsuffix>qb\t{%1, %0%{%2%}|%q0%{%2%}, %1}"
9500 [(set_attr "type" "ssemov")
9501 (set_attr "memory" "store")
9502 (set_attr "prefix" "evex")
9503 (set_attr "mode" "TI")])
9505 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9507 ;; Parallel integral arithmetic
9509 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9511 (define_expand "neg<mode>2"
9512 [(set (match_operand:VI_AVX2 0 "register_operand")
9515 (match_operand:VI_AVX2 1 "vector_operand")))]
9517 "operands[2] = force_reg (<MODE>mode, CONST0_RTX (<MODE>mode));")
9519 (define_expand "<plusminus_insn><mode>3"
9520 [(set (match_operand:VI_AVX2 0 "register_operand")
9522 (match_operand:VI_AVX2 1 "vector_operand")
9523 (match_operand:VI_AVX2 2 "vector_operand")))]
9525 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
9527 (define_expand "<plusminus_insn><mode>3_mask"
9528 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
9529 (vec_merge:VI48_AVX512VL
9530 (plusminus:VI48_AVX512VL
9531 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand")
9532 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand"))
9533 (match_operand:VI48_AVX512VL 3 "vector_move_operand")
9534 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
9536 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
9538 (define_expand "<plusminus_insn><mode>3_mask"
9539 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
9540 (vec_merge:VI12_AVX512VL
9541 (plusminus:VI12_AVX512VL
9542 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand")
9543 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand"))
9544 (match_operand:VI12_AVX512VL 3 "vector_move_operand")
9545 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
9547 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
9549 (define_insn "*<plusminus_insn><mode>3"
9550 [(set (match_operand:VI_AVX2 0 "register_operand" "=x,v")
9552 (match_operand:VI_AVX2 1 "vector_operand" "<comm>0,v")
9553 (match_operand:VI_AVX2 2 "vector_operand" "xBm,vm")))]
9555 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
9557 p<plusminus_mnemonic><ssemodesuffix>\t{%2, %0|%0, %2}
9558 vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
9559 [(set_attr "isa" "noavx,avx")
9560 (set_attr "type" "sseiadd")
9561 (set_attr "prefix_data16" "1,*")
9562 (set_attr "prefix" "<mask_prefix3>")
9563 (set_attr "mode" "<sseinsnmode>")])
9565 (define_insn "*<plusminus_insn><mode>3_mask"
9566 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
9567 (vec_merge:VI48_AVX512VL
9568 (plusminus:VI48_AVX512VL
9569 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "<comm>v")
9570 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm"))
9571 (match_operand:VI48_AVX512VL 3 "vector_move_operand" "0C")
9572 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
9574 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
9575 "vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
9576 [(set_attr "type" "sseiadd")
9577 (set_attr "prefix" "evex")
9578 (set_attr "mode" "<sseinsnmode>")])
9580 (define_insn "*<plusminus_insn><mode>3_mask"
9581 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
9582 (vec_merge:VI12_AVX512VL
9583 (plusminus:VI12_AVX512VL
9584 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "<comm>v")
9585 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm"))
9586 (match_operand:VI12_AVX512VL 3 "vector_move_operand" "0C")
9587 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
9588 "TARGET_AVX512BW && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
9589 "vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}"
9590 [(set_attr "type" "sseiadd")
9591 (set_attr "prefix" "evex")
9592 (set_attr "mode" "<sseinsnmode>")])
9594 (define_expand "<sse2_avx2>_<plusminus_insn><mode>3<mask_name>"
9595 [(set (match_operand:VI12_AVX2 0 "register_operand")
9596 (sat_plusminus:VI12_AVX2
9597 (match_operand:VI12_AVX2 1 "vector_operand")
9598 (match_operand:VI12_AVX2 2 "vector_operand")))]
9599 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
9600 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
9602 (define_insn "*<sse2_avx2>_<plusminus_insn><mode>3<mask_name>"
9603 [(set (match_operand:VI12_AVX2 0 "register_operand" "=x,v")
9604 (sat_plusminus:VI12_AVX2
9605 (match_operand:VI12_AVX2 1 "vector_operand" "<comm>0,v")
9606 (match_operand:VI12_AVX2 2 "vector_operand" "xBm,vm")))]
9607 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>
9608 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
9610 p<plusminus_mnemonic><ssemodesuffix>\t{%2, %0|%0, %2}
9611 vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
9612 [(set_attr "isa" "noavx,avx")
9613 (set_attr "type" "sseiadd")
9614 (set_attr "prefix_data16" "1,*")
9615 (set_attr "prefix" "orig,maybe_evex")
9616 (set_attr "mode" "TI")])
9618 (define_expand "mul<mode>3<mask_name>"
9619 [(set (match_operand:VI1_AVX512 0 "register_operand")
9620 (mult:VI1_AVX512 (match_operand:VI1_AVX512 1 "register_operand")
9621 (match_operand:VI1_AVX512 2 "register_operand")))]
9622 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
9624 ix86_expand_vecop_qihi (MULT, operands[0], operands[1], operands[2]);
9628 (define_expand "mul<mode>3<mask_name>"
9629 [(set (match_operand:VI2_AVX2 0 "register_operand")
9630 (mult:VI2_AVX2 (match_operand:VI2_AVX2 1 "vector_operand")
9631 (match_operand:VI2_AVX2 2 "vector_operand")))]
9632 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
9633 "ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);")
9635 (define_insn "*mul<mode>3<mask_name>"
9636 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,v")
9637 (mult:VI2_AVX2 (match_operand:VI2_AVX2 1 "vector_operand" "%0,v")
9638 (match_operand:VI2_AVX2 2 "vector_operand" "xBm,vm")))]
9640 && ix86_binary_operator_ok (MULT, <MODE>mode, operands)
9641 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
9643 pmullw\t{%2, %0|%0, %2}
9644 vpmullw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
9645 [(set_attr "isa" "noavx,avx")
9646 (set_attr "type" "sseimul")
9647 (set_attr "prefix_data16" "1,*")
9648 (set_attr "prefix" "orig,vex")
9649 (set_attr "mode" "<sseinsnmode>")])
9651 (define_expand "<s>mul<mode>3_highpart<mask_name>"
9652 [(set (match_operand:VI2_AVX2 0 "register_operand")
9654 (lshiftrt:<ssedoublemode>
9655 (mult:<ssedoublemode>
9656 (any_extend:<ssedoublemode>
9657 (match_operand:VI2_AVX2 1 "vector_operand"))
9658 (any_extend:<ssedoublemode>
9659 (match_operand:VI2_AVX2 2 "vector_operand")))
9662 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
9663 "ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);")
9665 (define_insn "*<s>mul<mode>3_highpart<mask_name>"
9666 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,v")
9668 (lshiftrt:<ssedoublemode>
9669 (mult:<ssedoublemode>
9670 (any_extend:<ssedoublemode>
9671 (match_operand:VI2_AVX2 1 "vector_operand" "%0,v"))
9672 (any_extend:<ssedoublemode>
9673 (match_operand:VI2_AVX2 2 "vector_operand" "xBm,vm")))
9676 && ix86_binary_operator_ok (MULT, <MODE>mode, operands)
9677 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
9679 pmulh<u>w\t{%2, %0|%0, %2}
9680 vpmulh<u>w\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
9681 [(set_attr "isa" "noavx,avx")
9682 (set_attr "type" "sseimul")
9683 (set_attr "prefix_data16" "1,*")
9684 (set_attr "prefix" "orig,vex")
9685 (set_attr "mode" "<sseinsnmode>")])
9687 (define_expand "vec_widen_umult_even_v16si<mask_name>"
9688 [(set (match_operand:V8DI 0 "register_operand")
9692 (match_operand:V16SI 1 "nonimmediate_operand")
9693 (parallel [(const_int 0) (const_int 2)
9694 (const_int 4) (const_int 6)
9695 (const_int 8) (const_int 10)
9696 (const_int 12) (const_int 14)])))
9699 (match_operand:V16SI 2 "nonimmediate_operand")
9700 (parallel [(const_int 0) (const_int 2)
9701 (const_int 4) (const_int 6)
9702 (const_int 8) (const_int 10)
9703 (const_int 12) (const_int 14)])))))]
9705 "ix86_fixup_binary_operands_no_copy (MULT, V16SImode, operands);")
9707 (define_insn "*vec_widen_umult_even_v16si<mask_name>"
9708 [(set (match_operand:V8DI 0 "register_operand" "=v")
9712 (match_operand:V16SI 1 "nonimmediate_operand" "%v")
9713 (parallel [(const_int 0) (const_int 2)
9714 (const_int 4) (const_int 6)
9715 (const_int 8) (const_int 10)
9716 (const_int 12) (const_int 14)])))
9719 (match_operand:V16SI 2 "nonimmediate_operand" "vm")
9720 (parallel [(const_int 0) (const_int 2)
9721 (const_int 4) (const_int 6)
9722 (const_int 8) (const_int 10)
9723 (const_int 12) (const_int 14)])))))]
9724 "TARGET_AVX512F && ix86_binary_operator_ok (MULT, V16SImode, operands)"
9725 "vpmuludq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
9726 [(set_attr "isa" "avx512f")
9727 (set_attr "type" "sseimul")
9728 (set_attr "prefix_extra" "1")
9729 (set_attr "prefix" "evex")
9730 (set_attr "mode" "XI")])
9732 (define_expand "vec_widen_umult_even_v8si<mask_name>"
9733 [(set (match_operand:V4DI 0 "register_operand")
9737 (match_operand:V8SI 1 "nonimmediate_operand")
9738 (parallel [(const_int 0) (const_int 2)
9739 (const_int 4) (const_int 6)])))
9742 (match_operand:V8SI 2 "nonimmediate_operand")
9743 (parallel [(const_int 0) (const_int 2)
9744 (const_int 4) (const_int 6)])))))]
9745 "TARGET_AVX2 && <mask_avx512vl_condition>"
9746 "ix86_fixup_binary_operands_no_copy (MULT, V8SImode, operands);")
9748 (define_insn "*vec_widen_umult_even_v8si<mask_name>"
9749 [(set (match_operand:V4DI 0 "register_operand" "=v")
9753 (match_operand:V8SI 1 "nonimmediate_operand" "%v")
9754 (parallel [(const_int 0) (const_int 2)
9755 (const_int 4) (const_int 6)])))
9758 (match_operand:V8SI 2 "nonimmediate_operand" "vm")
9759 (parallel [(const_int 0) (const_int 2)
9760 (const_int 4) (const_int 6)])))))]
9761 "TARGET_AVX2 && <mask_avx512vl_condition>
9762 && ix86_binary_operator_ok (MULT, V8SImode, operands)"
9763 "vpmuludq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
9764 [(set_attr "type" "sseimul")
9765 (set_attr "prefix" "maybe_evex")
9766 (set_attr "mode" "OI")])
9768 (define_expand "vec_widen_umult_even_v4si<mask_name>"
9769 [(set (match_operand:V2DI 0 "register_operand")
9773 (match_operand:V4SI 1 "vector_operand")
9774 (parallel [(const_int 0) (const_int 2)])))
9777 (match_operand:V4SI 2 "vector_operand")
9778 (parallel [(const_int 0) (const_int 2)])))))]
9779 "TARGET_SSE2 && <mask_avx512vl_condition>"
9780 "ix86_fixup_binary_operands_no_copy (MULT, V4SImode, operands);")
9782 (define_insn "*vec_widen_umult_even_v4si<mask_name>"
9783 [(set (match_operand:V2DI 0 "register_operand" "=x,v")
9787 (match_operand:V4SI 1 "vector_operand" "%0,v")
9788 (parallel [(const_int 0) (const_int 2)])))
9791 (match_operand:V4SI 2 "vector_operand" "xBm,vm")
9792 (parallel [(const_int 0) (const_int 2)])))))]
9793 "TARGET_SSE2 && <mask_avx512vl_condition>
9794 && ix86_binary_operator_ok (MULT, V4SImode, operands)"
9796 pmuludq\t{%2, %0|%0, %2}
9797 vpmuludq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
9798 [(set_attr "isa" "noavx,avx")
9799 (set_attr "type" "sseimul")
9800 (set_attr "prefix_data16" "1,*")
9801 (set_attr "prefix" "orig,maybe_evex")
9802 (set_attr "mode" "TI")])
9804 (define_expand "vec_widen_smult_even_v16si<mask_name>"
9805 [(set (match_operand:V8DI 0 "register_operand")
9809 (match_operand:V16SI 1 "nonimmediate_operand")
9810 (parallel [(const_int 0) (const_int 2)
9811 (const_int 4) (const_int 6)
9812 (const_int 8) (const_int 10)
9813 (const_int 12) (const_int 14)])))
9816 (match_operand:V16SI 2 "nonimmediate_operand")
9817 (parallel [(const_int 0) (const_int 2)
9818 (const_int 4) (const_int 6)
9819 (const_int 8) (const_int 10)
9820 (const_int 12) (const_int 14)])))))]
9822 "ix86_fixup_binary_operands_no_copy (MULT, V16SImode, operands);")
9824 (define_insn "*vec_widen_smult_even_v16si<mask_name>"
9825 [(set (match_operand:V8DI 0 "register_operand" "=v")
9829 (match_operand:V16SI 1 "nonimmediate_operand" "%v")
9830 (parallel [(const_int 0) (const_int 2)
9831 (const_int 4) (const_int 6)
9832 (const_int 8) (const_int 10)
9833 (const_int 12) (const_int 14)])))
9836 (match_operand:V16SI 2 "nonimmediate_operand" "vm")
9837 (parallel [(const_int 0) (const_int 2)
9838 (const_int 4) (const_int 6)
9839 (const_int 8) (const_int 10)
9840 (const_int 12) (const_int 14)])))))]
9841 "TARGET_AVX512F && ix86_binary_operator_ok (MULT, V16SImode, operands)"
9842 "vpmuldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
9843 [(set_attr "isa" "avx512f")
9844 (set_attr "type" "sseimul")
9845 (set_attr "prefix_extra" "1")
9846 (set_attr "prefix" "evex")
9847 (set_attr "mode" "XI")])
9849 (define_expand "vec_widen_smult_even_v8si<mask_name>"
9850 [(set (match_operand:V4DI 0 "register_operand")
9854 (match_operand:V8SI 1 "nonimmediate_operand")
9855 (parallel [(const_int 0) (const_int 2)
9856 (const_int 4) (const_int 6)])))
9859 (match_operand:V8SI 2 "nonimmediate_operand")
9860 (parallel [(const_int 0) (const_int 2)
9861 (const_int 4) (const_int 6)])))))]
9862 "TARGET_AVX2 && <mask_avx512vl_condition>"
9863 "ix86_fixup_binary_operands_no_copy (MULT, V8SImode, operands);")
9865 (define_insn "*vec_widen_smult_even_v8si<mask_name>"
9866 [(set (match_operand:V4DI 0 "register_operand" "=v")
9870 (match_operand:V8SI 1 "nonimmediate_operand" "%v")
9871 (parallel [(const_int 0) (const_int 2)
9872 (const_int 4) (const_int 6)])))
9875 (match_operand:V8SI 2 "nonimmediate_operand" "vm")
9876 (parallel [(const_int 0) (const_int 2)
9877 (const_int 4) (const_int 6)])))))]
9879 && ix86_binary_operator_ok (MULT, V8SImode, operands)"
9880 "vpmuldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
9881 [(set_attr "type" "sseimul")
9882 (set_attr "prefix_extra" "1")
9883 (set_attr "prefix" "vex")
9884 (set_attr "mode" "OI")])
9886 (define_expand "sse4_1_mulv2siv2di3<mask_name>"
9887 [(set (match_operand:V2DI 0 "register_operand")
9891 (match_operand:V4SI 1 "vector_operand")
9892 (parallel [(const_int 0) (const_int 2)])))
9895 (match_operand:V4SI 2 "vector_operand")
9896 (parallel [(const_int 0) (const_int 2)])))))]
9897 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
9898 "ix86_fixup_binary_operands_no_copy (MULT, V4SImode, operands);")
9900 (define_insn "*sse4_1_mulv2siv2di3<mask_name>"
9901 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
9905 (match_operand:V4SI 1 "vector_operand" "%0,0,v")
9906 (parallel [(const_int 0) (const_int 2)])))
9909 (match_operand:V4SI 2 "vector_operand" "YrBm,*xBm,vm")
9910 (parallel [(const_int 0) (const_int 2)])))))]
9911 "TARGET_SSE4_1 && <mask_avx512vl_condition>
9912 && ix86_binary_operator_ok (MULT, V4SImode, operands)"
9914 pmuldq\t{%2, %0|%0, %2}
9915 pmuldq\t{%2, %0|%0, %2}
9916 vpmuldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
9917 [(set_attr "isa" "noavx,noavx,avx")
9918 (set_attr "type" "sseimul")
9919 (set_attr "prefix_data16" "1,1,*")
9920 (set_attr "prefix_extra" "1")
9921 (set_attr "prefix" "orig,orig,vex")
9922 (set_attr "mode" "TI")])
9924 (define_insn "avx512bw_pmaddwd512<mode><mask_name>"
9925 [(set (match_operand:<sseunpackmode> 0 "register_operand" "=v")
9926 (unspec:<sseunpackmode>
9927 [(match_operand:VI2_AVX2 1 "register_operand" "v")
9928 (match_operand:VI2_AVX2 2 "nonimmediate_operand" "vm")]
9929 UNSPEC_PMADDWD512))]
9930 "TARGET_AVX512BW && <mask_mode512bit_condition>"
9931 "vpmaddwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}";
9932 [(set_attr "type" "sseiadd")
9933 (set_attr "prefix" "evex")
9934 (set_attr "mode" "XI")])
9936 (define_expand "avx2_pmaddwd"
9937 [(set (match_operand:V8SI 0 "register_operand")
9942 (match_operand:V16HI 1 "nonimmediate_operand")
9943 (parallel [(const_int 0) (const_int 2)
9944 (const_int 4) (const_int 6)
9945 (const_int 8) (const_int 10)
9946 (const_int 12) (const_int 14)])))
9949 (match_operand:V16HI 2 "nonimmediate_operand")
9950 (parallel [(const_int 0) (const_int 2)
9951 (const_int 4) (const_int 6)
9952 (const_int 8) (const_int 10)
9953 (const_int 12) (const_int 14)]))))
9956 (vec_select:V8HI (match_dup 1)
9957 (parallel [(const_int 1) (const_int 3)
9958 (const_int 5) (const_int 7)
9959 (const_int 9) (const_int 11)
9960 (const_int 13) (const_int 15)])))
9962 (vec_select:V8HI (match_dup 2)
9963 (parallel [(const_int 1) (const_int 3)
9964 (const_int 5) (const_int 7)
9965 (const_int 9) (const_int 11)
9966 (const_int 13) (const_int 15)]))))))]
9968 "ix86_fixup_binary_operands_no_copy (MULT, V16HImode, operands);")
9970 (define_insn "*avx2_pmaddwd"
9971 [(set (match_operand:V8SI 0 "register_operand" "=x,v")
9976 (match_operand:V16HI 1 "nonimmediate_operand" "%x,v")
9977 (parallel [(const_int 0) (const_int 2)
9978 (const_int 4) (const_int 6)
9979 (const_int 8) (const_int 10)
9980 (const_int 12) (const_int 14)])))
9983 (match_operand:V16HI 2 "nonimmediate_operand" "xm,vm")
9984 (parallel [(const_int 0) (const_int 2)
9985 (const_int 4) (const_int 6)
9986 (const_int 8) (const_int 10)
9987 (const_int 12) (const_int 14)]))))
9990 (vec_select:V8HI (match_dup 1)
9991 (parallel [(const_int 1) (const_int 3)
9992 (const_int 5) (const_int 7)
9993 (const_int 9) (const_int 11)
9994 (const_int 13) (const_int 15)])))
9996 (vec_select:V8HI (match_dup 2)
9997 (parallel [(const_int 1) (const_int 3)
9998 (const_int 5) (const_int 7)
9999 (const_int 9) (const_int 11)
10000 (const_int 13) (const_int 15)]))))))]
10001 "TARGET_AVX2 && ix86_binary_operator_ok (MULT, V16HImode, operands)"
10002 "vpmaddwd\t{%2, %1, %0|%0, %1, %2}"
10003 [(set_attr "type" "sseiadd")
10004 (set_attr "isa" "*,avx512bw")
10005 (set_attr "prefix" "vex,evex")
10006 (set_attr "mode" "OI")])
10008 (define_expand "sse2_pmaddwd"
10009 [(set (match_operand:V4SI 0 "register_operand")
10014 (match_operand:V8HI 1 "vector_operand")
10015 (parallel [(const_int 0) (const_int 2)
10016 (const_int 4) (const_int 6)])))
10019 (match_operand:V8HI 2 "vector_operand")
10020 (parallel [(const_int 0) (const_int 2)
10021 (const_int 4) (const_int 6)]))))
10024 (vec_select:V4HI (match_dup 1)
10025 (parallel [(const_int 1) (const_int 3)
10026 (const_int 5) (const_int 7)])))
10028 (vec_select:V4HI (match_dup 2)
10029 (parallel [(const_int 1) (const_int 3)
10030 (const_int 5) (const_int 7)]))))))]
10032 "ix86_fixup_binary_operands_no_copy (MULT, V8HImode, operands);")
10034 (define_insn "*sse2_pmaddwd"
10035 [(set (match_operand:V4SI 0 "register_operand" "=x,x,v")
10040 (match_operand:V8HI 1 "vector_operand" "%0,x,v")
10041 (parallel [(const_int 0) (const_int 2)
10042 (const_int 4) (const_int 6)])))
10045 (match_operand:V8HI 2 "vector_operand" "xBm,xm,vm")
10046 (parallel [(const_int 0) (const_int 2)
10047 (const_int 4) (const_int 6)]))))
10050 (vec_select:V4HI (match_dup 1)
10051 (parallel [(const_int 1) (const_int 3)
10052 (const_int 5) (const_int 7)])))
10054 (vec_select:V4HI (match_dup 2)
10055 (parallel [(const_int 1) (const_int 3)
10056 (const_int 5) (const_int 7)]))))))]
10057 "TARGET_SSE2 && ix86_binary_operator_ok (MULT, V8HImode, operands)"
10059 pmaddwd\t{%2, %0|%0, %2}
10060 vpmaddwd\t{%2, %1, %0|%0, %1, %2}
10061 vpmaddwd\t{%2, %1, %0|%0, %1, %2}"
10062 [(set_attr "isa" "noavx,avx,avx512bw")
10063 (set_attr "type" "sseiadd")
10064 (set_attr "atom_unit" "simul")
10065 (set_attr "prefix_data16" "1,*,*")
10066 (set_attr "prefix" "orig,vex,evex")
10067 (set_attr "mode" "TI")])
10069 (define_insn "avx512dq_mul<mode>3<mask_name>"
10070 [(set (match_operand:VI8 0 "register_operand" "=v")
10072 (match_operand:VI8 1 "register_operand" "v")
10073 (match_operand:VI8 2 "nonimmediate_operand" "vm")))]
10074 "TARGET_AVX512DQ && <mask_mode512bit_condition>"
10075 "vpmullq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10076 [(set_attr "type" "sseimul")
10077 (set_attr "prefix" "evex")
10078 (set_attr "mode" "<sseinsnmode>")])
10080 (define_expand "mul<mode>3<mask_name>"
10081 [(set (match_operand:VI4_AVX512F 0 "register_operand")
10083 (match_operand:VI4_AVX512F 1 "general_vector_operand")
10084 (match_operand:VI4_AVX512F 2 "general_vector_operand")))]
10085 "TARGET_SSE2 && <mask_mode512bit_condition>"
10089 if (!vector_operand (operands[1], <MODE>mode))
10090 operands[1] = force_reg (<MODE>mode, operands[1]);
10091 if (!vector_operand (operands[2], <MODE>mode))
10092 operands[2] = force_reg (<MODE>mode, operands[2]);
10093 ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);
10097 ix86_expand_sse2_mulv4si3 (operands[0], operands[1], operands[2]);
10102 (define_insn "*<sse4_1_avx2>_mul<mode>3<mask_name>"
10103 [(set (match_operand:VI4_AVX512F 0 "register_operand" "=Yr,*x,v")
10105 (match_operand:VI4_AVX512F 1 "vector_operand" "%0,0,v")
10106 (match_operand:VI4_AVX512F 2 "vector_operand" "YrBm,*xBm,vm")))]
10107 "TARGET_SSE4_1 && ix86_binary_operator_ok (MULT, <MODE>mode, operands) && <mask_mode512bit_condition>"
10109 pmulld\t{%2, %0|%0, %2}
10110 pmulld\t{%2, %0|%0, %2}
10111 vpmulld\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10112 [(set_attr "isa" "noavx,noavx,avx")
10113 (set_attr "type" "sseimul")
10114 (set_attr "prefix_extra" "1")
10115 (set_attr "prefix" "<mask_prefix4>")
10116 (set_attr "btver2_decode" "vector,vector,vector")
10117 (set_attr "mode" "<sseinsnmode>")])
10119 (define_expand "mul<mode>3"
10120 [(set (match_operand:VI8_AVX2_AVX512F 0 "register_operand")
10121 (mult:VI8_AVX2_AVX512F
10122 (match_operand:VI8_AVX2_AVX512F 1 "register_operand")
10123 (match_operand:VI8_AVX2_AVX512F 2 "register_operand")))]
10126 ix86_expand_sse2_mulvxdi3 (operands[0], operands[1], operands[2]);
10130 (define_expand "vec_widen_<s>mult_hi_<mode>"
10131 [(match_operand:<sseunpackmode> 0 "register_operand")
10132 (any_extend:<sseunpackmode>
10133 (match_operand:VI124_AVX2 1 "register_operand"))
10134 (match_operand:VI124_AVX2 2 "register_operand")]
10137 ix86_expand_mul_widen_hilo (operands[0], operands[1], operands[2],
10142 (define_expand "vec_widen_<s>mult_lo_<mode>"
10143 [(match_operand:<sseunpackmode> 0 "register_operand")
10144 (any_extend:<sseunpackmode>
10145 (match_operand:VI124_AVX2 1 "register_operand"))
10146 (match_operand:VI124_AVX2 2 "register_operand")]
10149 ix86_expand_mul_widen_hilo (operands[0], operands[1], operands[2],
10154 ;; Most widen_<s>mult_even_<mode> can be handled directly from other
10155 ;; named patterns, but signed V4SI needs special help for plain SSE2.
10156 (define_expand "vec_widen_smult_even_v4si"
10157 [(match_operand:V2DI 0 "register_operand")
10158 (match_operand:V4SI 1 "vector_operand")
10159 (match_operand:V4SI 2 "vector_operand")]
10162 ix86_expand_mul_widen_evenodd (operands[0], operands[1], operands[2],
10167 (define_expand "vec_widen_<s>mult_odd_<mode>"
10168 [(match_operand:<sseunpackmode> 0 "register_operand")
10169 (any_extend:<sseunpackmode>
10170 (match_operand:VI4_AVX512F 1 "general_vector_operand"))
10171 (match_operand:VI4_AVX512F 2 "general_vector_operand")]
10174 ix86_expand_mul_widen_evenodd (operands[0], operands[1], operands[2],
10179 (define_mode_attr SDOT_PMADD_SUF
10180 [(V32HI "512v32hi") (V16HI "") (V8HI "")])
10182 (define_expand "sdot_prod<mode>"
10183 [(match_operand:<sseunpackmode> 0 "register_operand")
10184 (match_operand:VI2_AVX2 1 "register_operand")
10185 (match_operand:VI2_AVX2 2 "register_operand")
10186 (match_operand:<sseunpackmode> 3 "register_operand")]
10189 rtx t = gen_reg_rtx (<sseunpackmode>mode);
10190 emit_insn (gen_<sse2_avx2>_pmaddwd<SDOT_PMADD_SUF> (t, operands[1], operands[2]));
10191 emit_insn (gen_rtx_SET (operands[0],
10192 gen_rtx_PLUS (<sseunpackmode>mode,
10197 ;; Normally we use widen_mul_even/odd, but combine can't quite get it all
10198 ;; back together when madd is available.
10199 (define_expand "sdot_prodv4si"
10200 [(match_operand:V2DI 0 "register_operand")
10201 (match_operand:V4SI 1 "register_operand")
10202 (match_operand:V4SI 2 "register_operand")
10203 (match_operand:V2DI 3 "register_operand")]
10206 rtx t = gen_reg_rtx (V2DImode);
10207 emit_insn (gen_xop_pmacsdqh (t, operands[1], operands[2], operands[3]));
10208 emit_insn (gen_xop_pmacsdql (operands[0], operands[1], operands[2], t));
10212 (define_expand "usadv16qi"
10213 [(match_operand:V4SI 0 "register_operand")
10214 (match_operand:V16QI 1 "register_operand")
10215 (match_operand:V16QI 2 "vector_operand")
10216 (match_operand:V4SI 3 "vector_operand")]
10219 rtx t1 = gen_reg_rtx (V2DImode);
10220 rtx t2 = gen_reg_rtx (V4SImode);
10221 emit_insn (gen_sse2_psadbw (t1, operands[1], operands[2]));
10222 convert_move (t2, t1, 0);
10223 emit_insn (gen_addv4si3 (operands[0], t2, operands[3]));
10227 (define_expand "usadv32qi"
10228 [(match_operand:V8SI 0 "register_operand")
10229 (match_operand:V32QI 1 "register_operand")
10230 (match_operand:V32QI 2 "nonimmediate_operand")
10231 (match_operand:V8SI 3 "nonimmediate_operand")]
10234 rtx t1 = gen_reg_rtx (V4DImode);
10235 rtx t2 = gen_reg_rtx (V8SImode);
10236 emit_insn (gen_avx2_psadbw (t1, operands[1], operands[2]));
10237 convert_move (t2, t1, 0);
10238 emit_insn (gen_addv8si3 (operands[0], t2, operands[3]));
10242 (define_insn "<mask_codefor>ashr<mode>3<mask_name>"
10243 [(set (match_operand:VI24_AVX512BW_1 0 "register_operand" "=v,v")
10244 (ashiftrt:VI24_AVX512BW_1
10245 (match_operand:VI24_AVX512BW_1 1 "nonimmediate_operand" "v,vm")
10246 (match_operand:SI 2 "nonmemory_operand" "v,N")))]
10248 "vpsra<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10249 [(set_attr "type" "sseishft")
10250 (set (attr "length_immediate")
10251 (if_then_else (match_operand 2 "const_int_operand")
10253 (const_string "0")))
10254 (set_attr "mode" "<sseinsnmode>")])
10256 (define_insn "ashr<mode>3"
10257 [(set (match_operand:VI24_AVX2 0 "register_operand" "=x,x")
10258 (ashiftrt:VI24_AVX2
10259 (match_operand:VI24_AVX2 1 "register_operand" "0,x")
10260 (match_operand:SI 2 "nonmemory_operand" "xN,xN")))]
10263 psra<ssemodesuffix>\t{%2, %0|%0, %2}
10264 vpsra<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
10265 [(set_attr "isa" "noavx,avx")
10266 (set_attr "type" "sseishft")
10267 (set (attr "length_immediate")
10268 (if_then_else (match_operand 2 "const_int_operand")
10270 (const_string "0")))
10271 (set_attr "prefix_data16" "1,*")
10272 (set_attr "prefix" "orig,vex")
10273 (set_attr "mode" "<sseinsnmode>")])
10275 (define_insn "<mask_codefor>ashrv2di3<mask_name>"
10276 [(set (match_operand:V2DI 0 "register_operand" "=v,v")
10278 (match_operand:V2DI 1 "nonimmediate_operand" "v,vm")
10279 (match_operand:DI 2 "nonmemory_operand" "v,N")))]
10281 "vpsraq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10282 [(set_attr "type" "sseishft")
10283 (set (attr "length_immediate")
10284 (if_then_else (match_operand 2 "const_int_operand")
10286 (const_string "0")))
10287 (set_attr "mode" "TI")])
10289 (define_insn "ashr<mode>3<mask_name>"
10290 [(set (match_operand:VI248_AVX512BW_AVX512VL 0 "register_operand" "=v,v")
10291 (ashiftrt:VI248_AVX512BW_AVX512VL
10292 (match_operand:VI248_AVX512BW_AVX512VL 1 "nonimmediate_operand" "v,vm")
10293 (match_operand:SI 2 "nonmemory_operand" "v,N")))]
10295 "vpsra<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10296 [(set_attr "type" "sseishft")
10297 (set (attr "length_immediate")
10298 (if_then_else (match_operand 2 "const_int_operand")
10300 (const_string "0")))
10301 (set_attr "mode" "<sseinsnmode>")])
10303 (define_insn "<shift_insn><mode>3<mask_name>"
10304 [(set (match_operand:VI2_AVX2_AVX512BW 0 "register_operand" "=x,v")
10305 (any_lshift:VI2_AVX2_AVX512BW
10306 (match_operand:VI2_AVX2_AVX512BW 1 "register_operand" "0,v")
10307 (match_operand:SI 2 "nonmemory_operand" "xN,vN")))]
10308 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
10310 p<vshift><ssemodesuffix>\t{%2, %0|%0, %2}
10311 vp<vshift><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10312 [(set_attr "isa" "noavx,avx")
10313 (set_attr "type" "sseishft")
10314 (set (attr "length_immediate")
10315 (if_then_else (match_operand 2 "const_int_operand")
10317 (const_string "0")))
10318 (set_attr "prefix_data16" "1,*")
10319 (set_attr "prefix" "orig,vex")
10320 (set_attr "mode" "<sseinsnmode>")])
10322 (define_insn "<shift_insn><mode>3<mask_name>"
10323 [(set (match_operand:VI48_AVX2 0 "register_operand" "=x,x,v")
10324 (any_lshift:VI48_AVX2
10325 (match_operand:VI48_AVX2 1 "register_operand" "0,x,v")
10326 (match_operand:SI 2 "nonmemory_operand" "xN,xN,vN")))]
10327 "TARGET_SSE2 && <mask_mode512bit_condition>"
10329 p<vshift><ssemodesuffix>\t{%2, %0|%0, %2}
10330 vp<vshift><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
10331 vp<vshift><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10332 [(set_attr "isa" "noavx,avx,avx512bw")
10333 (set_attr "type" "sseishft")
10334 (set (attr "length_immediate")
10335 (if_then_else (match_operand 2 "const_int_operand")
10337 (const_string "0")))
10338 (set_attr "prefix_data16" "1,*,*")
10339 (set_attr "prefix" "orig,vex,evex")
10340 (set_attr "mode" "<sseinsnmode>")])
10342 (define_insn "<shift_insn><mode>3<mask_name>"
10343 [(set (match_operand:VI48_512 0 "register_operand" "=v,v")
10344 (any_lshift:VI48_512
10345 (match_operand:VI48_512 1 "nonimmediate_operand" "v,m")
10346 (match_operand:SI 2 "nonmemory_operand" "vN,N")))]
10347 "TARGET_AVX512F && <mask_mode512bit_condition>"
10348 "vp<vshift><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10349 [(set_attr "isa" "avx512f")
10350 (set_attr "type" "sseishft")
10351 (set (attr "length_immediate")
10352 (if_then_else (match_operand 2 "const_int_operand")
10354 (const_string "0")))
10355 (set_attr "prefix" "evex")
10356 (set_attr "mode" "<sseinsnmode>")])
10359 (define_expand "vec_shl_<mode>"
10360 [(set (match_dup 3)
10362 (match_operand:VI_128 1 "register_operand")
10363 (match_operand:SI 2 "const_0_to_255_mul_8_operand")))
10364 (set (match_operand:VI_128 0 "register_operand") (match_dup 4))]
10367 operands[1] = gen_lowpart (V1TImode, operands[1]);
10368 operands[3] = gen_reg_rtx (V1TImode);
10369 operands[4] = gen_lowpart (<MODE>mode, operands[3]);
10372 (define_insn "<sse2_avx2>_ashl<mode>3"
10373 [(set (match_operand:VIMAX_AVX2 0 "register_operand" "=x,v")
10375 (match_operand:VIMAX_AVX2 1 "register_operand" "0,v")
10376 (match_operand:SI 2 "const_0_to_255_mul_8_operand" "n,n")))]
10379 operands[2] = GEN_INT (INTVAL (operands[2]) / 8);
10381 switch (which_alternative)
10384 return "pslldq\t{%2, %0|%0, %2}";
10386 return "vpslldq\t{%2, %1, %0|%0, %1, %2}";
10388 gcc_unreachable ();
10391 [(set_attr "isa" "noavx,avx")
10392 (set_attr "type" "sseishft")
10393 (set_attr "length_immediate" "1")
10394 (set_attr "prefix_data16" "1,*")
10395 (set_attr "prefix" "orig,vex")
10396 (set_attr "mode" "<sseinsnmode>")])
10398 (define_expand "vec_shr_<mode>"
10399 [(set (match_dup 3)
10401 (match_operand:VI_128 1 "register_operand")
10402 (match_operand:SI 2 "const_0_to_255_mul_8_operand")))
10403 (set (match_operand:VI_128 0 "register_operand") (match_dup 4))]
10406 operands[1] = gen_lowpart (V1TImode, operands[1]);
10407 operands[3] = gen_reg_rtx (V1TImode);
10408 operands[4] = gen_lowpart (<MODE>mode, operands[3]);
10411 (define_insn "<sse2_avx2>_lshr<mode>3"
10412 [(set (match_operand:VIMAX_AVX2 0 "register_operand" "=x,v")
10413 (lshiftrt:VIMAX_AVX2
10414 (match_operand:VIMAX_AVX2 1 "register_operand" "0,v")
10415 (match_operand:SI 2 "const_0_to_255_mul_8_operand" "n,n")))]
10418 operands[2] = GEN_INT (INTVAL (operands[2]) / 8);
10420 switch (which_alternative)
10423 return "psrldq\t{%2, %0|%0, %2}";
10425 return "vpsrldq\t{%2, %1, %0|%0, %1, %2}";
10427 gcc_unreachable ();
10430 [(set_attr "isa" "noavx,avx")
10431 (set_attr "type" "sseishft")
10432 (set_attr "length_immediate" "1")
10433 (set_attr "atom_unit" "sishuf")
10434 (set_attr "prefix_data16" "1,*")
10435 (set_attr "prefix" "orig,vex")
10436 (set_attr "mode" "<sseinsnmode>")])
10438 (define_insn "<avx512>_<rotate>v<mode><mask_name>"
10439 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
10440 (any_rotate:VI48_AVX512VL
10441 (match_operand:VI48_AVX512VL 1 "register_operand" "v")
10442 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")))]
10444 "vp<rotate>v<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10445 [(set_attr "prefix" "evex")
10446 (set_attr "mode" "<sseinsnmode>")])
10448 (define_insn "<avx512>_<rotate><mode><mask_name>"
10449 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
10450 (any_rotate:VI48_AVX512VL
10451 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm")
10452 (match_operand:SI 2 "const_0_to_255_operand")))]
10454 "vp<rotate><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10455 [(set_attr "prefix" "evex")
10456 (set_attr "mode" "<sseinsnmode>")])
10458 (define_expand "<code><mode>3"
10459 [(set (match_operand:VI124_256_AVX512F_AVX512BW 0 "register_operand")
10460 (maxmin:VI124_256_AVX512F_AVX512BW
10461 (match_operand:VI124_256_AVX512F_AVX512BW 1 "nonimmediate_operand")
10462 (match_operand:VI124_256_AVX512F_AVX512BW 2 "nonimmediate_operand")))]
10464 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
10466 (define_insn "*avx2_<code><mode>3"
10467 [(set (match_operand:VI124_256 0 "register_operand" "=v")
10469 (match_operand:VI124_256 1 "nonimmediate_operand" "%v")
10470 (match_operand:VI124_256 2 "nonimmediate_operand" "vm")))]
10471 "TARGET_AVX2 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
10472 "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
10473 [(set_attr "type" "sseiadd")
10474 (set_attr "prefix_extra" "1")
10475 (set_attr "prefix" "vex")
10476 (set_attr "mode" "OI")])
10478 (define_expand "<code><mode>3_mask"
10479 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
10480 (vec_merge:VI48_AVX512VL
10481 (maxmin:VI48_AVX512VL
10482 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand")
10483 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand"))
10484 (match_operand:VI48_AVX512VL 3 "vector_move_operand")
10485 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
10487 "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
10489 (define_insn "*avx512bw_<code><mode>3<mask_name>"
10490 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
10491 (maxmin:VI48_AVX512VL
10492 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "%v")
10493 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")))]
10494 "TARGET_AVX512F && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
10495 "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10496 [(set_attr "type" "sseiadd")
10497 (set_attr "prefix_extra" "1")
10498 (set_attr "prefix" "maybe_evex")
10499 (set_attr "mode" "<sseinsnmode>")])
10501 (define_insn "<mask_codefor><code><mode>3<mask_name>"
10502 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
10503 (maxmin:VI12_AVX512VL
10504 (match_operand:VI12_AVX512VL 1 "register_operand" "v")
10505 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")))]
10507 "vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10508 [(set_attr "type" "sseiadd")
10509 (set_attr "prefix" "evex")
10510 (set_attr "mode" "<sseinsnmode>")])
10512 (define_expand "<code><mode>3"
10513 [(set (match_operand:VI8_AVX2_AVX512BW 0 "register_operand")
10514 (maxmin:VI8_AVX2_AVX512BW
10515 (match_operand:VI8_AVX2_AVX512BW 1 "register_operand")
10516 (match_operand:VI8_AVX2_AVX512BW 2 "register_operand")))]
10520 && (<MODE>mode == V8DImode || TARGET_AVX512VL))
10521 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
10524 enum rtx_code code;
10529 xops[0] = operands[0];
10531 if (<CODE> == SMAX || <CODE> == UMAX)
10533 xops[1] = operands[1];
10534 xops[2] = operands[2];
10538 xops[1] = operands[2];
10539 xops[2] = operands[1];
10542 code = (<CODE> == UMAX || <CODE> == UMIN) ? GTU : GT;
10544 xops[3] = gen_rtx_fmt_ee (code, VOIDmode, operands[1], operands[2]);
10545 xops[4] = operands[1];
10546 xops[5] = operands[2];
10548 ok = ix86_expand_int_vcond (xops);
10554 (define_expand "<code><mode>3"
10555 [(set (match_operand:VI124_128 0 "register_operand")
10557 (match_operand:VI124_128 1 "vector_operand")
10558 (match_operand:VI124_128 2 "vector_operand")))]
10561 if (TARGET_SSE4_1 || <MODE>mode == V8HImode)
10562 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
10568 xops[0] = operands[0];
10569 operands[1] = force_reg (<MODE>mode, operands[1]);
10570 operands[2] = force_reg (<MODE>mode, operands[2]);
10572 if (<CODE> == SMAX)
10574 xops[1] = operands[1];
10575 xops[2] = operands[2];
10579 xops[1] = operands[2];
10580 xops[2] = operands[1];
10583 xops[3] = gen_rtx_GT (VOIDmode, operands[1], operands[2]);
10584 xops[4] = operands[1];
10585 xops[5] = operands[2];
10587 ok = ix86_expand_int_vcond (xops);
10593 (define_insn "*sse4_1_<code><mode>3<mask_name>"
10594 [(set (match_operand:VI14_128 0 "register_operand" "=Yr,*x,v")
10596 (match_operand:VI14_128 1 "vector_operand" "%0,0,v")
10597 (match_operand:VI14_128 2 "vector_operand" "YrBm,*xBm,vm")))]
10599 && <mask_mode512bit_condition>
10600 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
10602 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
10603 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
10604 vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10605 [(set_attr "isa" "noavx,noavx,avx")
10606 (set_attr "type" "sseiadd")
10607 (set_attr "prefix_extra" "1,1,*")
10608 (set_attr "prefix" "orig,orig,vex")
10609 (set_attr "mode" "TI")])
10611 (define_insn "*<code>v8hi3"
10612 [(set (match_operand:V8HI 0 "register_operand" "=x,x,v")
10614 (match_operand:V8HI 1 "vector_operand" "%0,x,v")
10615 (match_operand:V8HI 2 "vector_operand" "xBm,xm,vm")))]
10616 "TARGET_SSE2 && ix86_binary_operator_ok (<CODE>, V8HImode, operands)"
10618 p<maxmin_int>w\t{%2, %0|%0, %2}
10619 vp<maxmin_int>w\t{%2, %1, %0|%0, %1, %2}
10620 vp<maxmin_int>w\t{%2, %1, %0|%0, %1, %2}"
10621 [(set_attr "isa" "noavx,avx,avx512bw")
10622 (set_attr "type" "sseiadd")
10623 (set_attr "prefix_data16" "1,*,*")
10624 (set_attr "prefix_extra" "*,1,1")
10625 (set_attr "prefix" "orig,vex,evex")
10626 (set_attr "mode" "TI")])
10628 (define_expand "<code><mode>3"
10629 [(set (match_operand:VI124_128 0 "register_operand")
10631 (match_operand:VI124_128 1 "vector_operand")
10632 (match_operand:VI124_128 2 "vector_operand")))]
10635 if (TARGET_SSE4_1 || <MODE>mode == V16QImode)
10636 ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);
10637 else if (<CODE> == UMAX && <MODE>mode == V8HImode)
10639 rtx op0 = operands[0], op2 = operands[2], op3 = op0;
10640 operands[1] = force_reg (<MODE>mode, operands[1]);
10641 if (rtx_equal_p (op3, op2))
10642 op3 = gen_reg_rtx (V8HImode);
10643 emit_insn (gen_sse2_ussubv8hi3 (op3, operands[1], op2));
10644 emit_insn (gen_addv8hi3 (op0, op3, op2));
10652 operands[1] = force_reg (<MODE>mode, operands[1]);
10653 operands[2] = force_reg (<MODE>mode, operands[2]);
10655 xops[0] = operands[0];
10657 if (<CODE> == UMAX)
10659 xops[1] = operands[1];
10660 xops[2] = operands[2];
10664 xops[1] = operands[2];
10665 xops[2] = operands[1];
10668 xops[3] = gen_rtx_GTU (VOIDmode, operands[1], operands[2]);
10669 xops[4] = operands[1];
10670 xops[5] = operands[2];
10672 ok = ix86_expand_int_vcond (xops);
10678 (define_insn "*sse4_1_<code><mode>3<mask_name>"
10679 [(set (match_operand:VI24_128 0 "register_operand" "=Yr,*x,v")
10681 (match_operand:VI24_128 1 "vector_operand" "%0,0,v")
10682 (match_operand:VI24_128 2 "vector_operand" "YrBm,*xBm,vm")))]
10684 && <mask_mode512bit_condition>
10685 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
10687 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
10688 p<maxmin_int><ssemodesuffix>\t{%2, %0|%0, %2}
10689 vp<maxmin_int><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
10690 [(set_attr "isa" "noavx,noavx,avx")
10691 (set_attr "type" "sseiadd")
10692 (set_attr "prefix_extra" "1,1,*")
10693 (set_attr "prefix" "orig,orig,vex")
10694 (set_attr "mode" "TI")])
10696 (define_insn "*<code>v16qi3"
10697 [(set (match_operand:V16QI 0 "register_operand" "=x,x,v")
10699 (match_operand:V16QI 1 "vector_operand" "%0,x,v")
10700 (match_operand:V16QI 2 "vector_operand" "xBm,xm,vm")))]
10701 "TARGET_SSE2 && ix86_binary_operator_ok (<CODE>, V16QImode, operands)"
10703 p<maxmin_int>b\t{%2, %0|%0, %2}
10704 vp<maxmin_int>b\t{%2, %1, %0|%0, %1, %2}
10705 vp<maxmin_int>b\t{%2, %1, %0|%0, %1, %2}"
10706 [(set_attr "isa" "noavx,avx,avx512bw")
10707 (set_attr "type" "sseiadd")
10708 (set_attr "prefix_data16" "1,*,*")
10709 (set_attr "prefix_extra" "*,1,1")
10710 (set_attr "prefix" "orig,vex,evex")
10711 (set_attr "mode" "TI")])
10713 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
10715 ;; Parallel integral comparisons
10717 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
10719 (define_expand "avx2_eq<mode>3"
10720 [(set (match_operand:VI_256 0 "register_operand")
10722 (match_operand:VI_256 1 "nonimmediate_operand")
10723 (match_operand:VI_256 2 "nonimmediate_operand")))]
10725 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
10727 (define_insn "*avx2_eq<mode>3"
10728 [(set (match_operand:VI_256 0 "register_operand" "=x")
10730 (match_operand:VI_256 1 "nonimmediate_operand" "%x")
10731 (match_operand:VI_256 2 "nonimmediate_operand" "xm")))]
10732 "TARGET_AVX2 && ix86_binary_operator_ok (EQ, <MODE>mode, operands)"
10733 "vpcmpeq<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
10734 [(set_attr "type" "ssecmp")
10735 (set_attr "prefix_extra" "1")
10736 (set_attr "prefix" "vex")
10737 (set_attr "mode" "OI")])
10739 (define_expand "<avx512>_eq<mode>3<mask_scalar_merge_name>"
10740 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
10741 (unspec:<avx512fmaskmode>
10742 [(match_operand:VI12_AVX512VL 1 "register_operand")
10743 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand")]
10744 UNSPEC_MASKED_EQ))]
10746 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
10748 (define_expand "<avx512>_eq<mode>3<mask_scalar_merge_name>"
10749 [(set (match_operand:<avx512fmaskmode> 0 "register_operand")
10750 (unspec:<avx512fmaskmode>
10751 [(match_operand:VI48_AVX512VL 1 "register_operand")
10752 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand")]
10753 UNSPEC_MASKED_EQ))]
10755 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
10757 (define_insn "<avx512>_eq<mode>3<mask_scalar_merge_name>_1"
10758 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
10759 (unspec:<avx512fmaskmode>
10760 [(match_operand:VI12_AVX512VL 1 "register_operand" "%v")
10761 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")]
10762 UNSPEC_MASKED_EQ))]
10763 "TARGET_AVX512F && ix86_binary_operator_ok (EQ, <MODE>mode, operands)"
10764 "vpcmpeq<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
10765 [(set_attr "type" "ssecmp")
10766 (set_attr "prefix_extra" "1")
10767 (set_attr "prefix" "evex")
10768 (set_attr "mode" "<sseinsnmode>")])
10770 (define_insn "<avx512>_eq<mode>3<mask_scalar_merge_name>_1"
10771 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
10772 (unspec:<avx512fmaskmode>
10773 [(match_operand:VI48_AVX512VL 1 "register_operand" "%v")
10774 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")]
10775 UNSPEC_MASKED_EQ))]
10776 "TARGET_AVX512F && ix86_binary_operator_ok (EQ, <MODE>mode, operands)"
10777 "vpcmpeq<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
10778 [(set_attr "type" "ssecmp")
10779 (set_attr "prefix_extra" "1")
10780 (set_attr "prefix" "evex")
10781 (set_attr "mode" "<sseinsnmode>")])
10783 (define_insn "*sse4_1_eqv2di3"
10784 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,x")
10786 (match_operand:V2DI 1 "vector_operand" "%0,0,x")
10787 (match_operand:V2DI 2 "vector_operand" "YrBm,*xBm,xm")))]
10788 "TARGET_SSE4_1 && ix86_binary_operator_ok (EQ, V2DImode, operands)"
10790 pcmpeqq\t{%2, %0|%0, %2}
10791 pcmpeqq\t{%2, %0|%0, %2}
10792 vpcmpeqq\t{%2, %1, %0|%0, %1, %2}"
10793 [(set_attr "isa" "noavx,noavx,avx")
10794 (set_attr "type" "ssecmp")
10795 (set_attr "prefix_extra" "1")
10796 (set_attr "prefix" "orig,orig,vex")
10797 (set_attr "mode" "TI")])
10799 (define_insn "*sse2_eq<mode>3"
10800 [(set (match_operand:VI124_128 0 "register_operand" "=x,x")
10802 (match_operand:VI124_128 1 "vector_operand" "%0,x")
10803 (match_operand:VI124_128 2 "vector_operand" "xBm,xm")))]
10804 "TARGET_SSE2 && !TARGET_XOP
10805 && ix86_binary_operator_ok (EQ, <MODE>mode, operands)"
10807 pcmpeq<ssemodesuffix>\t{%2, %0|%0, %2}
10808 vpcmpeq<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
10809 [(set_attr "isa" "noavx,avx")
10810 (set_attr "type" "ssecmp")
10811 (set_attr "prefix_data16" "1,*")
10812 (set_attr "prefix" "orig,vex")
10813 (set_attr "mode" "TI")])
10815 (define_expand "sse2_eq<mode>3"
10816 [(set (match_operand:VI124_128 0 "register_operand")
10818 (match_operand:VI124_128 1 "vector_operand")
10819 (match_operand:VI124_128 2 "vector_operand")))]
10820 "TARGET_SSE2 && !TARGET_XOP "
10821 "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);")
10823 (define_expand "sse4_1_eqv2di3"
10824 [(set (match_operand:V2DI 0 "register_operand")
10826 (match_operand:V2DI 1 "vector_operand")
10827 (match_operand:V2DI 2 "vector_operand")))]
10829 "ix86_fixup_binary_operands_no_copy (EQ, V2DImode, operands);")
10831 (define_insn "sse4_2_gtv2di3"
10832 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,x")
10834 (match_operand:V2DI 1 "register_operand" "0,0,x")
10835 (match_operand:V2DI 2 "vector_operand" "YrBm,*xBm,xm")))]
10838 pcmpgtq\t{%2, %0|%0, %2}
10839 pcmpgtq\t{%2, %0|%0, %2}
10840 vpcmpgtq\t{%2, %1, %0|%0, %1, %2}"
10841 [(set_attr "isa" "noavx,noavx,avx")
10842 (set_attr "type" "ssecmp")
10843 (set_attr "prefix_extra" "1")
10844 (set_attr "prefix" "orig,orig,vex")
10845 (set_attr "mode" "TI")])
10847 (define_insn "avx2_gt<mode>3"
10848 [(set (match_operand:VI_256 0 "register_operand" "=x")
10850 (match_operand:VI_256 1 "register_operand" "x")
10851 (match_operand:VI_256 2 "nonimmediate_operand" "xm")))]
10853 "vpcmpgt<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
10854 [(set_attr "type" "ssecmp")
10855 (set_attr "prefix_extra" "1")
10856 (set_attr "prefix" "vex")
10857 (set_attr "mode" "OI")])
10859 (define_insn "<avx512>_gt<mode>3<mask_scalar_merge_name>"
10860 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
10861 (unspec:<avx512fmaskmode>
10862 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
10863 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")] UNSPEC_MASKED_GT))]
10865 "vpcmpgt<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
10866 [(set_attr "type" "ssecmp")
10867 (set_attr "prefix_extra" "1")
10868 (set_attr "prefix" "evex")
10869 (set_attr "mode" "<sseinsnmode>")])
10871 (define_insn "<avx512>_gt<mode>3<mask_scalar_merge_name>"
10872 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
10873 (unspec:<avx512fmaskmode>
10874 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
10875 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")] UNSPEC_MASKED_GT))]
10877 "vpcmpgt<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
10878 [(set_attr "type" "ssecmp")
10879 (set_attr "prefix_extra" "1")
10880 (set_attr "prefix" "evex")
10881 (set_attr "mode" "<sseinsnmode>")])
10883 (define_insn "sse2_gt<mode>3"
10884 [(set (match_operand:VI124_128 0 "register_operand" "=x,x")
10886 (match_operand:VI124_128 1 "register_operand" "0,x")
10887 (match_operand:VI124_128 2 "vector_operand" "xBm,xm")))]
10888 "TARGET_SSE2 && !TARGET_XOP"
10890 pcmpgt<ssemodesuffix>\t{%2, %0|%0, %2}
10891 vpcmpgt<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
10892 [(set_attr "isa" "noavx,avx")
10893 (set_attr "type" "ssecmp")
10894 (set_attr "prefix_data16" "1,*")
10895 (set_attr "prefix" "orig,vex")
10896 (set_attr "mode" "TI")])
10898 (define_expand "vcond<V_512:mode><VI_512:mode>"
10899 [(set (match_operand:V_512 0 "register_operand")
10900 (if_then_else:V_512
10901 (match_operator 3 ""
10902 [(match_operand:VI_512 4 "nonimmediate_operand")
10903 (match_operand:VI_512 5 "general_operand")])
10904 (match_operand:V_512 1)
10905 (match_operand:V_512 2)))]
10907 && (GET_MODE_NUNITS (<V_512:MODE>mode)
10908 == GET_MODE_NUNITS (<VI_512:MODE>mode))"
10910 bool ok = ix86_expand_int_vcond (operands);
10915 (define_expand "vcond<V_256:mode><VI_256:mode>"
10916 [(set (match_operand:V_256 0 "register_operand")
10917 (if_then_else:V_256
10918 (match_operator 3 ""
10919 [(match_operand:VI_256 4 "nonimmediate_operand")
10920 (match_operand:VI_256 5 "general_operand")])
10921 (match_operand:V_256 1)
10922 (match_operand:V_256 2)))]
10924 && (GET_MODE_NUNITS (<V_256:MODE>mode)
10925 == GET_MODE_NUNITS (<VI_256:MODE>mode))"
10927 bool ok = ix86_expand_int_vcond (operands);
10932 (define_expand "vcond<V_128:mode><VI124_128:mode>"
10933 [(set (match_operand:V_128 0 "register_operand")
10934 (if_then_else:V_128
10935 (match_operator 3 ""
10936 [(match_operand:VI124_128 4 "vector_operand")
10937 (match_operand:VI124_128 5 "general_operand")])
10938 (match_operand:V_128 1)
10939 (match_operand:V_128 2)))]
10941 && (GET_MODE_NUNITS (<V_128:MODE>mode)
10942 == GET_MODE_NUNITS (<VI124_128:MODE>mode))"
10944 bool ok = ix86_expand_int_vcond (operands);
10949 (define_expand "vcond<VI8F_128:mode>v2di"
10950 [(set (match_operand:VI8F_128 0 "register_operand")
10951 (if_then_else:VI8F_128
10952 (match_operator 3 ""
10953 [(match_operand:V2DI 4 "vector_operand")
10954 (match_operand:V2DI 5 "general_operand")])
10955 (match_operand:VI8F_128 1)
10956 (match_operand:VI8F_128 2)))]
10959 bool ok = ix86_expand_int_vcond (operands);
10964 (define_expand "vcondu<V_512:mode><VI_512:mode>"
10965 [(set (match_operand:V_512 0 "register_operand")
10966 (if_then_else:V_512
10967 (match_operator 3 ""
10968 [(match_operand:VI_512 4 "nonimmediate_operand")
10969 (match_operand:VI_512 5 "nonimmediate_operand")])
10970 (match_operand:V_512 1 "general_operand")
10971 (match_operand:V_512 2 "general_operand")))]
10973 && (GET_MODE_NUNITS (<V_512:MODE>mode)
10974 == GET_MODE_NUNITS (<VI_512:MODE>mode))"
10976 bool ok = ix86_expand_int_vcond (operands);
10981 (define_expand "vcondu<V_256:mode><VI_256:mode>"
10982 [(set (match_operand:V_256 0 "register_operand")
10983 (if_then_else:V_256
10984 (match_operator 3 ""
10985 [(match_operand:VI_256 4 "nonimmediate_operand")
10986 (match_operand:VI_256 5 "nonimmediate_operand")])
10987 (match_operand:V_256 1 "general_operand")
10988 (match_operand:V_256 2 "general_operand")))]
10990 && (GET_MODE_NUNITS (<V_256:MODE>mode)
10991 == GET_MODE_NUNITS (<VI_256:MODE>mode))"
10993 bool ok = ix86_expand_int_vcond (operands);
10998 (define_expand "vcondu<V_128:mode><VI124_128:mode>"
10999 [(set (match_operand:V_128 0 "register_operand")
11000 (if_then_else:V_128
11001 (match_operator 3 ""
11002 [(match_operand:VI124_128 4 "vector_operand")
11003 (match_operand:VI124_128 5 "vector_operand")])
11004 (match_operand:V_128 1 "general_operand")
11005 (match_operand:V_128 2 "general_operand")))]
11007 && (GET_MODE_NUNITS (<V_128:MODE>mode)
11008 == GET_MODE_NUNITS (<VI124_128:MODE>mode))"
11010 bool ok = ix86_expand_int_vcond (operands);
11015 (define_expand "vcondu<VI8F_128:mode>v2di"
11016 [(set (match_operand:VI8F_128 0 "register_operand")
11017 (if_then_else:VI8F_128
11018 (match_operator 3 ""
11019 [(match_operand:V2DI 4 "vector_operand")
11020 (match_operand:V2DI 5 "vector_operand")])
11021 (match_operand:VI8F_128 1 "general_operand")
11022 (match_operand:VI8F_128 2 "general_operand")))]
11025 bool ok = ix86_expand_int_vcond (operands);
11030 (define_mode_iterator VEC_PERM_AVX2
11031 [V16QI V8HI V4SI V2DI V4SF V2DF
11032 (V32QI "TARGET_AVX2") (V16HI "TARGET_AVX2")
11033 (V8SI "TARGET_AVX2") (V4DI "TARGET_AVX2")
11034 (V8SF "TARGET_AVX2") (V4DF "TARGET_AVX2")
11035 (V16SF "TARGET_AVX512F") (V8DF "TARGET_AVX512F")
11036 (V16SI "TARGET_AVX512F") (V8DI "TARGET_AVX512F")
11037 (V32HI "TARGET_AVX512BW") (V64QI "TARGET_AVX512VBMI")])
11039 (define_expand "vec_perm<mode>"
11040 [(match_operand:VEC_PERM_AVX2 0 "register_operand")
11041 (match_operand:VEC_PERM_AVX2 1 "register_operand")
11042 (match_operand:VEC_PERM_AVX2 2 "register_operand")
11043 (match_operand:<sseintvecmode> 3 "register_operand")]
11044 "TARGET_SSSE3 || TARGET_AVX || TARGET_XOP"
11046 ix86_expand_vec_perm (operands);
11050 (define_mode_iterator VEC_PERM_CONST
11051 [(V4SF "TARGET_SSE") (V4SI "TARGET_SSE")
11052 (V2DF "TARGET_SSE") (V2DI "TARGET_SSE")
11053 (V16QI "TARGET_SSE2") (V8HI "TARGET_SSE2")
11054 (V8SF "TARGET_AVX") (V4DF "TARGET_AVX")
11055 (V8SI "TARGET_AVX") (V4DI "TARGET_AVX")
11056 (V32QI "TARGET_AVX2") (V16HI "TARGET_AVX2")
11057 (V16SI "TARGET_AVX512F") (V8DI "TARGET_AVX512F")
11058 (V16SF "TARGET_AVX512F") (V8DF "TARGET_AVX512F")
11059 (V32HI "TARGET_AVX512BW") (V64QI "TARGET_AVX512BW")])
11061 (define_expand "vec_perm_const<mode>"
11062 [(match_operand:VEC_PERM_CONST 0 "register_operand")
11063 (match_operand:VEC_PERM_CONST 1 "register_operand")
11064 (match_operand:VEC_PERM_CONST 2 "register_operand")
11065 (match_operand:<sseintvecmode> 3)]
11068 if (ix86_expand_vec_perm_const (operands))
11074 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11076 ;; Parallel bitwise logical operations
11078 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11080 (define_expand "one_cmpl<mode>2"
11081 [(set (match_operand:VI 0 "register_operand")
11082 (xor:VI (match_operand:VI 1 "vector_operand")
11086 int i, n = GET_MODE_NUNITS (<MODE>mode);
11087 rtvec v = rtvec_alloc (n);
11089 for (i = 0; i < n; ++i)
11090 RTVEC_ELT (v, i) = constm1_rtx;
11092 operands[2] = force_reg (<MODE>mode, gen_rtx_CONST_VECTOR (<MODE>mode, v));
11095 (define_expand "<sse2_avx2>_andnot<mode>3"
11096 [(set (match_operand:VI_AVX2 0 "register_operand")
11098 (not:VI_AVX2 (match_operand:VI_AVX2 1 "register_operand"))
11099 (match_operand:VI_AVX2 2 "vector_operand")))]
11102 (define_expand "<sse2_avx2>_andnot<mode>3_mask"
11103 [(set (match_operand:VI48_AVX512VL 0 "register_operand")
11104 (vec_merge:VI48_AVX512VL
11107 (match_operand:VI48_AVX512VL 1 "register_operand"))
11108 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand"))
11109 (match_operand:VI48_AVX512VL 3 "vector_move_operand")
11110 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
11113 (define_expand "<sse2_avx2>_andnot<mode>3_mask"
11114 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
11115 (vec_merge:VI12_AVX512VL
11118 (match_operand:VI12_AVX512VL 1 "register_operand"))
11119 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand"))
11120 (match_operand:VI12_AVX512VL 3 "vector_move_operand")
11121 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
11124 (define_insn "*andnot<mode>3"
11125 [(set (match_operand:VI 0 "register_operand" "=x,v")
11127 (not:VI (match_operand:VI 1 "register_operand" "0,v"))
11128 (match_operand:VI 2 "vector_operand" "xBm,vm")))]
11131 static char buf[64];
11135 switch (get_attr_mode (insn))
11138 gcc_assert (TARGET_AVX512F);
11140 gcc_assert (TARGET_AVX2);
11142 gcc_assert (TARGET_SSE2);
11143 switch (<MODE>mode)
11147 /* There is no vpandnb or vpandnw instruction, nor vpandn for
11148 512-bit vectors. Use vpandnq instead. */
11153 tmp = "pandn<ssemodesuffix>";
11159 tmp = TARGET_AVX512VL ? "pandn<ssemodesuffix>" : "pandn";
11162 tmp = TARGET_AVX512VL ? "pandnq" : "pandn";
11168 gcc_assert (TARGET_AVX512F);
11170 gcc_assert (TARGET_AVX);
11172 gcc_assert (TARGET_SSE);
11178 gcc_unreachable ();
11181 switch (which_alternative)
11184 ops = "%s\t{%%2, %%0|%%0, %%2}";
11187 ops = "v%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
11190 gcc_unreachable ();
11193 snprintf (buf, sizeof (buf), ops, tmp);
11196 [(set_attr "isa" "noavx,avx")
11197 (set_attr "type" "sselog")
11198 (set (attr "prefix_data16")
11200 (and (eq_attr "alternative" "0")
11201 (eq_attr "mode" "TI"))
11203 (const_string "*")))
11204 (set_attr "prefix" "orig,vex")
11206 (cond [(and (match_test "<MODE_SIZE> == 16")
11207 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
11208 (const_string "<ssePSmode>")
11209 (match_test "TARGET_AVX2")
11210 (const_string "<sseinsnmode>")
11211 (match_test "TARGET_AVX")
11213 (match_test "<MODE_SIZE> > 16")
11214 (const_string "V8SF")
11215 (const_string "<sseinsnmode>"))
11216 (ior (not (match_test "TARGET_SSE2"))
11217 (match_test "optimize_function_for_size_p (cfun)"))
11218 (const_string "V4SF")
11220 (const_string "<sseinsnmode>")))])
11222 (define_insn "*andnot<mode>3_mask"
11223 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
11224 (vec_merge:VI48_AVX512VL
11227 (match_operand:VI48_AVX512VL 1 "register_operand" "v"))
11228 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm"))
11229 (match_operand:VI48_AVX512VL 3 "vector_move_operand" "0C")
11230 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
11232 "vpandn<ssemodesuffix>\t{%2, %1, %0%{%4%}%N3|%0%{%4%}%N3, %1, %2}";
11233 [(set_attr "type" "sselog")
11234 (set_attr "prefix" "evex")
11235 (set_attr "mode" "<sseinsnmode>")])
11237 (define_expand "<code><mode>3"
11238 [(set (match_operand:VI 0 "register_operand")
11240 (match_operand:VI 1 "nonimmediate_or_const_vector_operand")
11241 (match_operand:VI 2 "nonimmediate_or_const_vector_operand")))]
11244 ix86_expand_vector_logical_operator (<CODE>, <MODE>mode, operands);
11248 (define_insn "<mask_codefor><code><mode>3<mask_name>"
11249 [(set (match_operand:VI48_AVX_AVX512F 0 "register_operand" "=x,v")
11250 (any_logic:VI48_AVX_AVX512F
11251 (match_operand:VI48_AVX_AVX512F 1 "vector_operand" "%0,v")
11252 (match_operand:VI48_AVX_AVX512F 2 "vector_operand" "xBm,vm")))]
11253 "TARGET_SSE && <mask_mode512bit_condition>
11254 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
11256 static char buf[64];
11260 switch (get_attr_mode (insn))
11263 gcc_assert (TARGET_AVX512F);
11265 gcc_assert (TARGET_AVX2 || TARGET_AVX512VL);
11267 gcc_assert (TARGET_SSE2 || TARGET_AVX512VL);
11268 switch (<MODE>mode)
11272 if (TARGET_AVX512F)
11274 tmp = "p<logic><ssemodesuffix>";
11281 tmp = TARGET_AVX512VL ? "p<logic><ssemodesuffix>" : "p<logic>";
11284 gcc_unreachable ();
11289 gcc_assert (TARGET_AVX);
11291 gcc_assert (TARGET_SSE);
11292 gcc_assert (!<mask_applied>);
11297 gcc_unreachable ();
11300 switch (which_alternative)
11303 if (<mask_applied>)
11304 ops = "v%s\t{%%2, %%0, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%0, %%2}";
11306 ops = "%s\t{%%2, %%0|%%0, %%2}";
11309 ops = "v%s\t{%%2, %%1, %%0<mask_operand3_1>|%%0<mask_operand3_1>, %%1, %%2}";
11312 gcc_unreachable ();
11315 snprintf (buf, sizeof (buf), ops, tmp);
11318 [(set_attr "isa" "noavx,avx")
11319 (set_attr "type" "sselog")
11320 (set (attr "prefix_data16")
11322 (and (eq_attr "alternative" "0")
11323 (eq_attr "mode" "TI"))
11325 (const_string "*")))
11326 (set_attr "prefix" "<mask_prefix3>")
11328 (cond [(and (match_test "<MODE_SIZE> == 16")
11329 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
11330 (const_string "<ssePSmode>")
11331 (match_test "TARGET_AVX2")
11332 (const_string "<sseinsnmode>")
11333 (match_test "TARGET_AVX")
11335 (match_test "<MODE_SIZE> > 16")
11336 (const_string "V8SF")
11337 (const_string "<sseinsnmode>"))
11338 (ior (not (match_test "TARGET_SSE2"))
11339 (match_test "optimize_function_for_size_p (cfun)"))
11340 (const_string "V4SF")
11342 (const_string "<sseinsnmode>")))])
11344 (define_insn "*<code><mode>3"
11345 [(set (match_operand:VI12_AVX_AVX512F 0 "register_operand" "=x,v")
11346 (any_logic: VI12_AVX_AVX512F
11347 (match_operand:VI12_AVX_AVX512F 1 "vector_operand" "%0,v")
11348 (match_operand:VI12_AVX_AVX512F 2 "vector_operand" "xBm,vm")))]
11349 "TARGET_SSE && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
11351 static char buf[64];
11354 const char *ssesuffix;
11356 switch (get_attr_mode (insn))
11359 gcc_assert (TARGET_AVX512F);
11361 gcc_assert (TARGET_AVX2 || TARGET_AVX512VL);
11363 gcc_assert (TARGET_SSE2 || TARGET_AVX512VL);
11364 switch (<MODE>mode)
11368 if (TARGET_AVX512F)
11378 if (TARGET_AVX512VL || TARGET_AVX2 || TARGET_SSE2)
11381 ssesuffix = TARGET_AVX512VL ? "q" : "";
11385 gcc_unreachable ();
11390 gcc_assert (TARGET_AVX);
11392 gcc_assert (TARGET_SSE);
11398 gcc_unreachable ();
11401 switch (which_alternative)
11404 ops = "%s\t{%%2, %%0|%%0, %%2}";
11405 snprintf (buf, sizeof (buf), ops, tmp);
11408 ops = "v%s%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
11409 snprintf (buf, sizeof (buf), ops, tmp, ssesuffix);
11412 gcc_unreachable ();
11417 [(set_attr "isa" "noavx,avx")
11418 (set_attr "type" "sselog")
11419 (set (attr "prefix_data16")
11421 (and (eq_attr "alternative" "0")
11422 (eq_attr "mode" "TI"))
11424 (const_string "*")))
11425 (set_attr "prefix" "<mask_prefix3>")
11427 (cond [(and (match_test "<MODE_SIZE> == 16")
11428 (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
11429 (const_string "<ssePSmode>")
11430 (match_test "TARGET_AVX2")
11431 (const_string "<sseinsnmode>")
11432 (match_test "TARGET_AVX")
11434 (match_test "<MODE_SIZE> > 16")
11435 (const_string "V8SF")
11436 (const_string "<sseinsnmode>"))
11437 (ior (not (match_test "TARGET_SSE2"))
11438 (match_test "optimize_function_for_size_p (cfun)"))
11439 (const_string "V4SF")
11441 (const_string "<sseinsnmode>")))])
11443 (define_insn "<avx512>_testm<mode>3<mask_scalar_merge_name>"
11444 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11445 (unspec:<avx512fmaskmode>
11446 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
11447 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")]
11450 "vptestm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11451 [(set_attr "prefix" "evex")
11452 (set_attr "mode" "<sseinsnmode>")])
11454 (define_insn "<avx512>_testm<mode>3<mask_scalar_merge_name>"
11455 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11456 (unspec:<avx512fmaskmode>
11457 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
11458 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")]
11461 "vptestm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11462 [(set_attr "prefix" "evex")
11463 (set_attr "mode" "<sseinsnmode>")])
11465 (define_insn "<avx512>_testnm<mode>3<mask_scalar_merge_name>"
11466 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11467 (unspec:<avx512fmaskmode>
11468 [(match_operand:VI12_AVX512VL 1 "register_operand" "v")
11469 (match_operand:VI12_AVX512VL 2 "nonimmediate_operand" "vm")]
11472 "vptestnm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11473 [(set_attr "prefix" "evex")
11474 (set_attr "mode" "<sseinsnmode>")])
11476 (define_insn "<avx512>_testnm<mode>3<mask_scalar_merge_name>"
11477 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
11478 (unspec:<avx512fmaskmode>
11479 [(match_operand:VI48_AVX512VL 1 "register_operand" "v")
11480 (match_operand:VI48_AVX512VL 2 "nonimmediate_operand" "vm")]
11483 "vptestnm<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}"
11484 [(set_attr "prefix" "evex")
11485 (set_attr "mode" "<sseinsnmode>")])
11487 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11489 ;; Parallel integral element swizzling
11491 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11493 (define_expand "vec_pack_trunc_<mode>"
11494 [(match_operand:<ssepackmode> 0 "register_operand")
11495 (match_operand:VI248_AVX2_8_AVX512F_24_AVX512BW 1 "register_operand")
11496 (match_operand:VI248_AVX2_8_AVX512F_24_AVX512BW 2 "register_operand")]
11499 rtx op1 = gen_lowpart (<ssepackmode>mode, operands[1]);
11500 rtx op2 = gen_lowpart (<ssepackmode>mode, operands[2]);
11501 ix86_expand_vec_extract_even_odd (operands[0], op1, op2, 0);
11505 (define_expand "vec_pack_trunc_qi"
11506 [(set (match_operand:HI 0 ("register_operand"))
11507 (ior:HI (ashift:HI (zero_extend:HI (match_operand:QI 2 ("register_operand")))
11509 (zero_extend:HI (match_operand:QI 1 ("register_operand")))))]
11512 (define_expand "vec_pack_trunc_<mode>"
11513 [(set (match_operand:<DOUBLEMASKMODE> 0 ("register_operand"))
11514 (ior:<DOUBLEMASKMODE> (ashift:<DOUBLEMASKMODE> (zero_extend:<DOUBLEMASKMODE> (match_operand:SWI24 2 ("register_operand")))
11516 (zero_extend:<DOUBLEMASKMODE> (match_operand:SWI24 1 ("register_operand")))))]
11519 operands[3] = GEN_INT (GET_MODE_BITSIZE (<MODE>mode));
11522 (define_insn "<sse2_avx2>_packsswb<mask_name>"
11523 [(set (match_operand:VI1_AVX512 0 "register_operand" "=x,x,v")
11524 (vec_concat:VI1_AVX512
11525 (ss_truncate:<ssehalfvecmode>
11526 (match_operand:<sseunpackmode> 1 "register_operand" "0,x,v"))
11527 (ss_truncate:<ssehalfvecmode>
11528 (match_operand:<sseunpackmode> 2 "vector_operand" "xBm,xm,vm"))))]
11529 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
11531 packsswb\t{%2, %0|%0, %2}
11532 vpacksswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
11533 vpacksswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11534 [(set_attr "isa" "noavx,avx,avx512bw")
11535 (set_attr "type" "sselog")
11536 (set_attr "prefix_data16" "1,*,*")
11537 (set_attr "prefix" "orig,<mask_prefix>,evex")
11538 (set_attr "mode" "<sseinsnmode>")])
11540 (define_insn "<sse2_avx2>_packssdw<mask_name>"
11541 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,x,v")
11542 (vec_concat:VI2_AVX2
11543 (ss_truncate:<ssehalfvecmode>
11544 (match_operand:<sseunpackmode> 1 "register_operand" "0,x,v"))
11545 (ss_truncate:<ssehalfvecmode>
11546 (match_operand:<sseunpackmode> 2 "vector_operand" "xBm,xm,vm"))))]
11547 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
11549 packssdw\t{%2, %0|%0, %2}
11550 vpackssdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
11551 vpackssdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11552 [(set_attr "isa" "noavx,avx,avx512bw")
11553 (set_attr "type" "sselog")
11554 (set_attr "prefix_data16" "1,*,*")
11555 (set_attr "prefix" "orig,<mask_prefix>,evex")
11556 (set_attr "mode" "<sseinsnmode>")])
11558 (define_insn "<sse2_avx2>_packuswb<mask_name>"
11559 [(set (match_operand:VI1_AVX512 0 "register_operand" "=x,x,v")
11560 (vec_concat:VI1_AVX512
11561 (us_truncate:<ssehalfvecmode>
11562 (match_operand:<sseunpackmode> 1 "register_operand" "0,x,v"))
11563 (us_truncate:<ssehalfvecmode>
11564 (match_operand:<sseunpackmode> 2 "vector_operand" "xBm,xm,vm"))))]
11565 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
11567 packuswb\t{%2, %0|%0, %2}
11568 vpackuswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
11569 vpackuswb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11570 [(set_attr "isa" "noavx,avx,avx512bw")
11571 (set_attr "type" "sselog")
11572 (set_attr "prefix_data16" "1,*,*")
11573 (set_attr "prefix" "orig,<mask_prefix>,evex")
11574 (set_attr "mode" "<sseinsnmode>")])
11576 (define_insn "avx512bw_interleave_highv64qi<mask_name>"
11577 [(set (match_operand:V64QI 0 "register_operand" "=v")
11580 (match_operand:V64QI 1 "register_operand" "v")
11581 (match_operand:V64QI 2 "nonimmediate_operand" "vm"))
11582 (parallel [(const_int 8) (const_int 72)
11583 (const_int 9) (const_int 73)
11584 (const_int 10) (const_int 74)
11585 (const_int 11) (const_int 75)
11586 (const_int 12) (const_int 76)
11587 (const_int 13) (const_int 77)
11588 (const_int 14) (const_int 78)
11589 (const_int 15) (const_int 79)
11590 (const_int 24) (const_int 88)
11591 (const_int 25) (const_int 89)
11592 (const_int 26) (const_int 90)
11593 (const_int 27) (const_int 91)
11594 (const_int 28) (const_int 92)
11595 (const_int 29) (const_int 93)
11596 (const_int 30) (const_int 94)
11597 (const_int 31) (const_int 95)
11598 (const_int 40) (const_int 104)
11599 (const_int 41) (const_int 105)
11600 (const_int 42) (const_int 106)
11601 (const_int 43) (const_int 107)
11602 (const_int 44) (const_int 108)
11603 (const_int 45) (const_int 109)
11604 (const_int 46) (const_int 110)
11605 (const_int 47) (const_int 111)
11606 (const_int 56) (const_int 120)
11607 (const_int 57) (const_int 121)
11608 (const_int 58) (const_int 122)
11609 (const_int 59) (const_int 123)
11610 (const_int 60) (const_int 124)
11611 (const_int 61) (const_int 125)
11612 (const_int 62) (const_int 126)
11613 (const_int 63) (const_int 127)])))]
11615 "vpunpckhbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11616 [(set_attr "type" "sselog")
11617 (set_attr "prefix" "evex")
11618 (set_attr "mode" "XI")])
11620 (define_insn "avx2_interleave_highv32qi<mask_name>"
11621 [(set (match_operand:V32QI 0 "register_operand" "=v")
11624 (match_operand:V32QI 1 "register_operand" "v")
11625 (match_operand:V32QI 2 "nonimmediate_operand" "vm"))
11626 (parallel [(const_int 8) (const_int 40)
11627 (const_int 9) (const_int 41)
11628 (const_int 10) (const_int 42)
11629 (const_int 11) (const_int 43)
11630 (const_int 12) (const_int 44)
11631 (const_int 13) (const_int 45)
11632 (const_int 14) (const_int 46)
11633 (const_int 15) (const_int 47)
11634 (const_int 24) (const_int 56)
11635 (const_int 25) (const_int 57)
11636 (const_int 26) (const_int 58)
11637 (const_int 27) (const_int 59)
11638 (const_int 28) (const_int 60)
11639 (const_int 29) (const_int 61)
11640 (const_int 30) (const_int 62)
11641 (const_int 31) (const_int 63)])))]
11642 "TARGET_AVX2 && <mask_avx512vl_condition>"
11643 "vpunpckhbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11644 [(set_attr "type" "sselog")
11645 (set_attr "prefix" "<mask_prefix>")
11646 (set_attr "mode" "OI")])
11648 (define_insn "vec_interleave_highv16qi<mask_name>"
11649 [(set (match_operand:V16QI 0 "register_operand" "=x,v")
11652 (match_operand:V16QI 1 "register_operand" "0,v")
11653 (match_operand:V16QI 2 "vector_operand" "xBm,vm"))
11654 (parallel [(const_int 8) (const_int 24)
11655 (const_int 9) (const_int 25)
11656 (const_int 10) (const_int 26)
11657 (const_int 11) (const_int 27)
11658 (const_int 12) (const_int 28)
11659 (const_int 13) (const_int 29)
11660 (const_int 14) (const_int 30)
11661 (const_int 15) (const_int 31)])))]
11662 "TARGET_SSE2 && <mask_avx512vl_condition>"
11664 punpckhbw\t{%2, %0|%0, %2}
11665 vpunpckhbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11666 [(set_attr "isa" "noavx,avx")
11667 (set_attr "type" "sselog")
11668 (set_attr "prefix_data16" "1,*")
11669 (set_attr "prefix" "orig,<mask_prefix>")
11670 (set_attr "mode" "TI")])
11672 (define_insn "avx512bw_interleave_lowv64qi<mask_name>"
11673 [(set (match_operand:V64QI 0 "register_operand" "=v")
11676 (match_operand:V64QI 1 "register_operand" "v")
11677 (match_operand:V64QI 2 "nonimmediate_operand" "vm"))
11678 (parallel [(const_int 0) (const_int 64)
11679 (const_int 1) (const_int 65)
11680 (const_int 2) (const_int 66)
11681 (const_int 3) (const_int 67)
11682 (const_int 4) (const_int 68)
11683 (const_int 5) (const_int 69)
11684 (const_int 6) (const_int 70)
11685 (const_int 7) (const_int 71)
11686 (const_int 16) (const_int 80)
11687 (const_int 17) (const_int 81)
11688 (const_int 18) (const_int 82)
11689 (const_int 19) (const_int 83)
11690 (const_int 20) (const_int 84)
11691 (const_int 21) (const_int 85)
11692 (const_int 22) (const_int 86)
11693 (const_int 23) (const_int 87)
11694 (const_int 32) (const_int 96)
11695 (const_int 33) (const_int 97)
11696 (const_int 34) (const_int 98)
11697 (const_int 35) (const_int 99)
11698 (const_int 36) (const_int 100)
11699 (const_int 37) (const_int 101)
11700 (const_int 38) (const_int 102)
11701 (const_int 39) (const_int 103)
11702 (const_int 48) (const_int 112)
11703 (const_int 49) (const_int 113)
11704 (const_int 50) (const_int 114)
11705 (const_int 51) (const_int 115)
11706 (const_int 52) (const_int 116)
11707 (const_int 53) (const_int 117)
11708 (const_int 54) (const_int 118)
11709 (const_int 55) (const_int 119)])))]
11711 "vpunpcklbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11712 [(set_attr "type" "sselog")
11713 (set_attr "prefix" "evex")
11714 (set_attr "mode" "XI")])
11716 (define_insn "avx2_interleave_lowv32qi<mask_name>"
11717 [(set (match_operand:V32QI 0 "register_operand" "=v")
11720 (match_operand:V32QI 1 "register_operand" "v")
11721 (match_operand:V32QI 2 "nonimmediate_operand" "vm"))
11722 (parallel [(const_int 0) (const_int 32)
11723 (const_int 1) (const_int 33)
11724 (const_int 2) (const_int 34)
11725 (const_int 3) (const_int 35)
11726 (const_int 4) (const_int 36)
11727 (const_int 5) (const_int 37)
11728 (const_int 6) (const_int 38)
11729 (const_int 7) (const_int 39)
11730 (const_int 16) (const_int 48)
11731 (const_int 17) (const_int 49)
11732 (const_int 18) (const_int 50)
11733 (const_int 19) (const_int 51)
11734 (const_int 20) (const_int 52)
11735 (const_int 21) (const_int 53)
11736 (const_int 22) (const_int 54)
11737 (const_int 23) (const_int 55)])))]
11738 "TARGET_AVX2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
11739 "vpunpcklbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11740 [(set_attr "type" "sselog")
11741 (set_attr "prefix" "maybe_vex")
11742 (set_attr "mode" "OI")])
11744 (define_insn "vec_interleave_lowv16qi<mask_name>"
11745 [(set (match_operand:V16QI 0 "register_operand" "=x,v")
11748 (match_operand:V16QI 1 "register_operand" "0,v")
11749 (match_operand:V16QI 2 "vector_operand" "xBm,vm"))
11750 (parallel [(const_int 0) (const_int 16)
11751 (const_int 1) (const_int 17)
11752 (const_int 2) (const_int 18)
11753 (const_int 3) (const_int 19)
11754 (const_int 4) (const_int 20)
11755 (const_int 5) (const_int 21)
11756 (const_int 6) (const_int 22)
11757 (const_int 7) (const_int 23)])))]
11758 "TARGET_SSE2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
11760 punpcklbw\t{%2, %0|%0, %2}
11761 vpunpcklbw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11762 [(set_attr "isa" "noavx,avx")
11763 (set_attr "type" "sselog")
11764 (set_attr "prefix_data16" "1,*")
11765 (set_attr "prefix" "orig,vex")
11766 (set_attr "mode" "TI")])
11768 (define_insn "avx512bw_interleave_highv32hi<mask_name>"
11769 [(set (match_operand:V32HI 0 "register_operand" "=v")
11772 (match_operand:V32HI 1 "register_operand" "v")
11773 (match_operand:V32HI 2 "nonimmediate_operand" "vm"))
11774 (parallel [(const_int 4) (const_int 36)
11775 (const_int 5) (const_int 37)
11776 (const_int 6) (const_int 38)
11777 (const_int 7) (const_int 39)
11778 (const_int 12) (const_int 44)
11779 (const_int 13) (const_int 45)
11780 (const_int 14) (const_int 46)
11781 (const_int 15) (const_int 47)
11782 (const_int 20) (const_int 52)
11783 (const_int 21) (const_int 53)
11784 (const_int 22) (const_int 54)
11785 (const_int 23) (const_int 55)
11786 (const_int 28) (const_int 60)
11787 (const_int 29) (const_int 61)
11788 (const_int 30) (const_int 62)
11789 (const_int 31) (const_int 63)])))]
11791 "vpunpckhwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11792 [(set_attr "type" "sselog")
11793 (set_attr "prefix" "evex")
11794 (set_attr "mode" "XI")])
11796 (define_insn "avx2_interleave_highv16hi<mask_name>"
11797 [(set (match_operand:V16HI 0 "register_operand" "=v")
11800 (match_operand:V16HI 1 "register_operand" "v")
11801 (match_operand:V16HI 2 "nonimmediate_operand" "vm"))
11802 (parallel [(const_int 4) (const_int 20)
11803 (const_int 5) (const_int 21)
11804 (const_int 6) (const_int 22)
11805 (const_int 7) (const_int 23)
11806 (const_int 12) (const_int 28)
11807 (const_int 13) (const_int 29)
11808 (const_int 14) (const_int 30)
11809 (const_int 15) (const_int 31)])))]
11810 "TARGET_AVX2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
11811 "vpunpckhwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11812 [(set_attr "type" "sselog")
11813 (set_attr "prefix" "maybe_evex")
11814 (set_attr "mode" "OI")])
11816 (define_insn "vec_interleave_highv8hi<mask_name>"
11817 [(set (match_operand:V8HI 0 "register_operand" "=x,v")
11820 (match_operand:V8HI 1 "register_operand" "0,v")
11821 (match_operand:V8HI 2 "vector_operand" "xBm,vm"))
11822 (parallel [(const_int 4) (const_int 12)
11823 (const_int 5) (const_int 13)
11824 (const_int 6) (const_int 14)
11825 (const_int 7) (const_int 15)])))]
11826 "TARGET_SSE2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
11828 punpckhwd\t{%2, %0|%0, %2}
11829 vpunpckhwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11830 [(set_attr "isa" "noavx,avx")
11831 (set_attr "type" "sselog")
11832 (set_attr "prefix_data16" "1,*")
11833 (set_attr "prefix" "orig,maybe_vex")
11834 (set_attr "mode" "TI")])
11836 (define_insn "<mask_codefor>avx512bw_interleave_lowv32hi<mask_name>"
11837 [(set (match_operand:V32HI 0 "register_operand" "=v")
11840 (match_operand:V32HI 1 "register_operand" "v")
11841 (match_operand:V32HI 2 "nonimmediate_operand" "vm"))
11842 (parallel [(const_int 0) (const_int 32)
11843 (const_int 1) (const_int 33)
11844 (const_int 2) (const_int 34)
11845 (const_int 3) (const_int 35)
11846 (const_int 8) (const_int 40)
11847 (const_int 9) (const_int 41)
11848 (const_int 10) (const_int 42)
11849 (const_int 11) (const_int 43)
11850 (const_int 16) (const_int 48)
11851 (const_int 17) (const_int 49)
11852 (const_int 18) (const_int 50)
11853 (const_int 19) (const_int 51)
11854 (const_int 24) (const_int 56)
11855 (const_int 25) (const_int 57)
11856 (const_int 26) (const_int 58)
11857 (const_int 27) (const_int 59)])))]
11859 "vpunpcklwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11860 [(set_attr "type" "sselog")
11861 (set_attr "prefix" "evex")
11862 (set_attr "mode" "XI")])
11864 (define_insn "avx2_interleave_lowv16hi<mask_name>"
11865 [(set (match_operand:V16HI 0 "register_operand" "=v")
11868 (match_operand:V16HI 1 "register_operand" "v")
11869 (match_operand:V16HI 2 "nonimmediate_operand" "vm"))
11870 (parallel [(const_int 0) (const_int 16)
11871 (const_int 1) (const_int 17)
11872 (const_int 2) (const_int 18)
11873 (const_int 3) (const_int 19)
11874 (const_int 8) (const_int 24)
11875 (const_int 9) (const_int 25)
11876 (const_int 10) (const_int 26)
11877 (const_int 11) (const_int 27)])))]
11878 "TARGET_AVX2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
11879 "vpunpcklwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11880 [(set_attr "type" "sselog")
11881 (set_attr "prefix" "maybe_evex")
11882 (set_attr "mode" "OI")])
11884 (define_insn "vec_interleave_lowv8hi<mask_name>"
11885 [(set (match_operand:V8HI 0 "register_operand" "=x,v")
11888 (match_operand:V8HI 1 "register_operand" "0,v")
11889 (match_operand:V8HI 2 "vector_operand" "xBm,vm"))
11890 (parallel [(const_int 0) (const_int 8)
11891 (const_int 1) (const_int 9)
11892 (const_int 2) (const_int 10)
11893 (const_int 3) (const_int 11)])))]
11894 "TARGET_SSE2 && <mask_avx512vl_condition> && <mask_avx512bw_condition>"
11896 punpcklwd\t{%2, %0|%0, %2}
11897 vpunpcklwd\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11898 [(set_attr "isa" "noavx,avx")
11899 (set_attr "type" "sselog")
11900 (set_attr "prefix_data16" "1,*")
11901 (set_attr "prefix" "orig,maybe_evex")
11902 (set_attr "mode" "TI")])
11904 (define_insn "avx2_interleave_highv8si<mask_name>"
11905 [(set (match_operand:V8SI 0 "register_operand" "=v")
11908 (match_operand:V8SI 1 "register_operand" "v")
11909 (match_operand:V8SI 2 "nonimmediate_operand" "vm"))
11910 (parallel [(const_int 2) (const_int 10)
11911 (const_int 3) (const_int 11)
11912 (const_int 6) (const_int 14)
11913 (const_int 7) (const_int 15)])))]
11914 "TARGET_AVX2 && <mask_avx512vl_condition>"
11915 "vpunpckhdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11916 [(set_attr "type" "sselog")
11917 (set_attr "prefix" "maybe_evex")
11918 (set_attr "mode" "OI")])
11920 (define_insn "<mask_codefor>avx512f_interleave_highv16si<mask_name>"
11921 [(set (match_operand:V16SI 0 "register_operand" "=v")
11924 (match_operand:V16SI 1 "register_operand" "v")
11925 (match_operand:V16SI 2 "nonimmediate_operand" "vm"))
11926 (parallel [(const_int 2) (const_int 18)
11927 (const_int 3) (const_int 19)
11928 (const_int 6) (const_int 22)
11929 (const_int 7) (const_int 23)
11930 (const_int 10) (const_int 26)
11931 (const_int 11) (const_int 27)
11932 (const_int 14) (const_int 30)
11933 (const_int 15) (const_int 31)])))]
11935 "vpunpckhdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11936 [(set_attr "type" "sselog")
11937 (set_attr "prefix" "evex")
11938 (set_attr "mode" "XI")])
11941 (define_insn "vec_interleave_highv4si<mask_name>"
11942 [(set (match_operand:V4SI 0 "register_operand" "=x,v")
11945 (match_operand:V4SI 1 "register_operand" "0,v")
11946 (match_operand:V4SI 2 "vector_operand" "xBm,vm"))
11947 (parallel [(const_int 2) (const_int 6)
11948 (const_int 3) (const_int 7)])))]
11949 "TARGET_SSE2 && <mask_avx512vl_condition>"
11951 punpckhdq\t{%2, %0|%0, %2}
11952 vpunpckhdq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11953 [(set_attr "isa" "noavx,avx")
11954 (set_attr "type" "sselog")
11955 (set_attr "prefix_data16" "1,*")
11956 (set_attr "prefix" "orig,maybe_vex")
11957 (set_attr "mode" "TI")])
11959 (define_insn "avx2_interleave_lowv8si<mask_name>"
11960 [(set (match_operand:V8SI 0 "register_operand" "=v")
11963 (match_operand:V8SI 1 "register_operand" "v")
11964 (match_operand:V8SI 2 "nonimmediate_operand" "vm"))
11965 (parallel [(const_int 0) (const_int 8)
11966 (const_int 1) (const_int 9)
11967 (const_int 4) (const_int 12)
11968 (const_int 5) (const_int 13)])))]
11969 "TARGET_AVX2 && <mask_avx512vl_condition>"
11970 "vpunpckldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11971 [(set_attr "type" "sselog")
11972 (set_attr "prefix" "maybe_evex")
11973 (set_attr "mode" "OI")])
11975 (define_insn "<mask_codefor>avx512f_interleave_lowv16si<mask_name>"
11976 [(set (match_operand:V16SI 0 "register_operand" "=v")
11979 (match_operand:V16SI 1 "register_operand" "v")
11980 (match_operand:V16SI 2 "nonimmediate_operand" "vm"))
11981 (parallel [(const_int 0) (const_int 16)
11982 (const_int 1) (const_int 17)
11983 (const_int 4) (const_int 20)
11984 (const_int 5) (const_int 21)
11985 (const_int 8) (const_int 24)
11986 (const_int 9) (const_int 25)
11987 (const_int 12) (const_int 28)
11988 (const_int 13) (const_int 29)])))]
11990 "vpunpckldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
11991 [(set_attr "type" "sselog")
11992 (set_attr "prefix" "evex")
11993 (set_attr "mode" "XI")])
11995 (define_insn "vec_interleave_lowv4si<mask_name>"
11996 [(set (match_operand:V4SI 0 "register_operand" "=x,v")
11999 (match_operand:V4SI 1 "register_operand" "0,v")
12000 (match_operand:V4SI 2 "vector_operand" "xBm,vm"))
12001 (parallel [(const_int 0) (const_int 4)
12002 (const_int 1) (const_int 5)])))]
12003 "TARGET_SSE2 && <mask_avx512vl_condition>"
12005 punpckldq\t{%2, %0|%0, %2}
12006 vpunpckldq\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12007 [(set_attr "isa" "noavx,avx")
12008 (set_attr "type" "sselog")
12009 (set_attr "prefix_data16" "1,*")
12010 (set_attr "prefix" "orig,vex")
12011 (set_attr "mode" "TI")])
12013 (define_expand "vec_interleave_high<mode>"
12014 [(match_operand:VI_256 0 "register_operand")
12015 (match_operand:VI_256 1 "register_operand")
12016 (match_operand:VI_256 2 "nonimmediate_operand")]
12019 rtx t1 = gen_reg_rtx (<MODE>mode);
12020 rtx t2 = gen_reg_rtx (<MODE>mode);
12021 rtx t3 = gen_reg_rtx (V4DImode);
12022 emit_insn (gen_avx2_interleave_low<mode> (t1, operands[1], operands[2]));
12023 emit_insn (gen_avx2_interleave_high<mode> (t2, operands[1], operands[2]));
12024 emit_insn (gen_avx2_permv2ti (t3, gen_lowpart (V4DImode, t1),
12025 gen_lowpart (V4DImode, t2),
12026 GEN_INT (1 + (3 << 4))));
12027 emit_move_insn (operands[0], gen_lowpart (<MODE>mode, t3));
12031 (define_expand "vec_interleave_low<mode>"
12032 [(match_operand:VI_256 0 "register_operand")
12033 (match_operand:VI_256 1 "register_operand")
12034 (match_operand:VI_256 2 "nonimmediate_operand")]
12037 rtx t1 = gen_reg_rtx (<MODE>mode);
12038 rtx t2 = gen_reg_rtx (<MODE>mode);
12039 rtx t3 = gen_reg_rtx (V4DImode);
12040 emit_insn (gen_avx2_interleave_low<mode> (t1, operands[1], operands[2]));
12041 emit_insn (gen_avx2_interleave_high<mode> (t2, operands[1], operands[2]));
12042 emit_insn (gen_avx2_permv2ti (t3, gen_lowpart (V4DImode, t1),
12043 gen_lowpart (V4DImode, t2),
12044 GEN_INT (0 + (2 << 4))));
12045 emit_move_insn (operands[0], gen_lowpart (<MODE>mode, t3));
12049 ;; Modes handled by pinsr patterns.
12050 (define_mode_iterator PINSR_MODE
12051 [(V16QI "TARGET_SSE4_1") V8HI
12052 (V4SI "TARGET_SSE4_1")
12053 (V2DI "TARGET_SSE4_1 && TARGET_64BIT")])
12055 (define_mode_attr sse2p4_1
12056 [(V16QI "sse4_1") (V8HI "sse2")
12057 (V4SI "sse4_1") (V2DI "sse4_1")])
12059 (define_mode_attr pinsr_evex_isa
12060 [(V16QI "avx512bw") (V8HI "avx512bw")
12061 (V4SI "avx512dq") (V2DI "avx512dq")])
12063 ;; sse4_1_pinsrd must come before sse2_loadld since it is preferred.
12064 (define_insn "<sse2p4_1>_pinsr<ssemodesuffix>"
12065 [(set (match_operand:PINSR_MODE 0 "register_operand" "=x,x,x,x,v,v")
12066 (vec_merge:PINSR_MODE
12067 (vec_duplicate:PINSR_MODE
12068 (match_operand:<ssescalarmode> 2 "nonimmediate_operand" "r,m,r,m,r,m"))
12069 (match_operand:PINSR_MODE 1 "register_operand" "0,0,x,x,v,v")
12070 (match_operand:SI 3 "const_int_operand")))]
12072 && ((unsigned) exact_log2 (INTVAL (operands[3]))
12073 < GET_MODE_NUNITS (<MODE>mode))"
12075 operands[3] = GEN_INT (exact_log2 (INTVAL (operands[3])));
12077 switch (which_alternative)
12080 if (GET_MODE_SIZE (<ssescalarmode>mode) < GET_MODE_SIZE (SImode))
12081 return "pinsr<ssemodesuffix>\t{%3, %k2, %0|%0, %k2, %3}";
12084 return "pinsr<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}";
12087 if (GET_MODE_SIZE (<ssescalarmode>mode) < GET_MODE_SIZE (SImode))
12088 return "vpinsr<ssemodesuffix>\t{%3, %k2, %1, %0|%0, %1, %k2, %3}";
12092 return "vpinsr<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}";
12094 gcc_unreachable ();
12097 [(set_attr "isa" "noavx,noavx,avx,avx,<pinsr_evex_isa>,<pinsr_evex_isa>")
12098 (set_attr "type" "sselog")
12099 (set (attr "prefix_rex")
12101 (and (not (match_test "TARGET_AVX"))
12102 (eq (const_string "<MODE>mode") (const_string "V2DImode")))
12104 (const_string "*")))
12105 (set (attr "prefix_data16")
12107 (and (not (match_test "TARGET_AVX"))
12108 (eq (const_string "<MODE>mode") (const_string "V8HImode")))
12110 (const_string "*")))
12111 (set (attr "prefix_extra")
12113 (and (not (match_test "TARGET_AVX"))
12114 (eq (const_string "<MODE>mode") (const_string "V8HImode")))
12116 (const_string "1")))
12117 (set_attr "length_immediate" "1")
12118 (set_attr "prefix" "orig,orig,vex,vex,evex,evex")
12119 (set_attr "mode" "TI")])
12121 (define_expand "<extract_type>_vinsert<shuffletype><extract_suf>_mask"
12122 [(match_operand:AVX512_VEC 0 "register_operand")
12123 (match_operand:AVX512_VEC 1 "register_operand")
12124 (match_operand:<ssequartermode> 2 "nonimmediate_operand")
12125 (match_operand:SI 3 "const_0_to_3_operand")
12126 (match_operand:AVX512_VEC 4 "register_operand")
12127 (match_operand:<avx512fmaskmode> 5 "register_operand")]
12131 mask = INTVAL (operands[3]);
12132 selector = GET_MODE_UNIT_SIZE (<MODE>mode) == 4 ?
12133 0xFFFF ^ (0xF000 >> mask * 4)
12134 : 0xFF ^ (0xC0 >> mask * 2);
12135 emit_insn (gen_<extract_type>_vinsert<shuffletype><extract_suf>_1_mask
12136 (operands[0], operands[1], operands[2], GEN_INT (selector),
12137 operands[4], operands[5]));
12141 (define_insn "<mask_codefor><extract_type>_vinsert<shuffletype><extract_suf>_1<mask_name>"
12142 [(set (match_operand:AVX512_VEC 0 "register_operand" "=v")
12143 (vec_merge:AVX512_VEC
12144 (match_operand:AVX512_VEC 1 "register_operand" "v")
12145 (vec_duplicate:AVX512_VEC
12146 (match_operand:<ssequartermode> 2 "nonimmediate_operand" "vm"))
12147 (match_operand:SI 3 "const_int_operand" "n")))]
12151 int selector = INTVAL (operands[3]);
12153 if (selector == 0xFFF || selector == 0x3F)
12155 else if ( selector == 0xF0FF || selector == 0xCF)
12157 else if ( selector == 0xFF0F || selector == 0xF3)
12159 else if ( selector == 0xFFF0 || selector == 0xFC)
12162 gcc_unreachable ();
12164 operands[3] = GEN_INT (mask);
12166 return "vinsert<shuffletype><extract_suf>\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3}";
12168 [(set_attr "type" "sselog")
12169 (set_attr "length_immediate" "1")
12170 (set_attr "prefix" "evex")
12171 (set_attr "mode" "<sseinsnmode>")])
12173 (define_expand "<extract_type_2>_vinsert<shuffletype><extract_suf_2>_mask"
12174 [(match_operand:AVX512_VEC_2 0 "register_operand")
12175 (match_operand:AVX512_VEC_2 1 "register_operand")
12176 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand")
12177 (match_operand:SI 3 "const_0_to_1_operand")
12178 (match_operand:AVX512_VEC_2 4 "register_operand")
12179 (match_operand:<avx512fmaskmode> 5 "register_operand")]
12182 int mask = INTVAL (operands[3]);
12184 emit_insn (gen_vec_set_lo_<mode>_mask (operands[0], operands[1],
12185 operands[2], operands[4],
12188 emit_insn (gen_vec_set_hi_<mode>_mask (operands[0], operands[1],
12189 operands[2], operands[4],
12194 (define_insn "vec_set_lo_<mode><mask_name>"
12195 [(set (match_operand:V16FI 0 "register_operand" "=v")
12197 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
12198 (vec_select:<ssehalfvecmode>
12199 (match_operand:V16FI 1 "register_operand" "v")
12200 (parallel [(const_int 8) (const_int 9)
12201 (const_int 10) (const_int 11)
12202 (const_int 12) (const_int 13)
12203 (const_int 14) (const_int 15)]))))]
12205 "vinsert<shuffletype>32x8\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, $0x0}"
12206 [(set_attr "type" "sselog")
12207 (set_attr "length_immediate" "1")
12208 (set_attr "prefix" "evex")
12209 (set_attr "mode" "<sseinsnmode>")])
12211 (define_insn "vec_set_hi_<mode><mask_name>"
12212 [(set (match_operand:V16FI 0 "register_operand" "=v")
12214 (vec_select:<ssehalfvecmode>
12215 (match_operand:V16FI 1 "register_operand" "v")
12216 (parallel [(const_int 0) (const_int 1)
12217 (const_int 2) (const_int 3)
12218 (const_int 4) (const_int 5)
12219 (const_int 6) (const_int 7)]))
12220 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
12222 "vinsert<shuffletype>32x8\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, $0x1}"
12223 [(set_attr "type" "sselog")
12224 (set_attr "length_immediate" "1")
12225 (set_attr "prefix" "evex")
12226 (set_attr "mode" "<sseinsnmode>")])
12228 (define_insn "vec_set_lo_<mode><mask_name>"
12229 [(set (match_operand:V8FI 0 "register_operand" "=v")
12231 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
12232 (vec_select:<ssehalfvecmode>
12233 (match_operand:V8FI 1 "register_operand" "v")
12234 (parallel [(const_int 4) (const_int 5)
12235 (const_int 6) (const_int 7)]))))]
12237 "vinsert<shuffletype>64x4\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, $0x0}"
12238 [(set_attr "type" "sselog")
12239 (set_attr "length_immediate" "1")
12240 (set_attr "prefix" "evex")
12241 (set_attr "mode" "XI")])
12243 (define_insn "vec_set_hi_<mode><mask_name>"
12244 [(set (match_operand:V8FI 0 "register_operand" "=v")
12246 (vec_select:<ssehalfvecmode>
12247 (match_operand:V8FI 1 "register_operand" "v")
12248 (parallel [(const_int 0) (const_int 1)
12249 (const_int 2) (const_int 3)]))
12250 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
12252 "vinsert<shuffletype>64x4\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}"
12253 [(set_attr "type" "sselog")
12254 (set_attr "length_immediate" "1")
12255 (set_attr "prefix" "evex")
12256 (set_attr "mode" "XI")])
12258 (define_expand "avx512dq_shuf_<shuffletype>64x2_mask"
12259 [(match_operand:VI8F_256 0 "register_operand")
12260 (match_operand:VI8F_256 1 "register_operand")
12261 (match_operand:VI8F_256 2 "nonimmediate_operand")
12262 (match_operand:SI 3 "const_0_to_3_operand")
12263 (match_operand:VI8F_256 4 "register_operand")
12264 (match_operand:QI 5 "register_operand")]
12267 int mask = INTVAL (operands[3]);
12268 emit_insn (gen_avx512dq_shuf_<shuffletype>64x2_1_mask
12269 (operands[0], operands[1], operands[2],
12270 GEN_INT (((mask >> 0) & 1) * 2 + 0),
12271 GEN_INT (((mask >> 0) & 1) * 2 + 1),
12272 GEN_INT (((mask >> 1) & 1) * 2 + 4),
12273 GEN_INT (((mask >> 1) & 1) * 2 + 5),
12274 operands[4], operands[5]));
12278 (define_insn "<mask_codefor>avx512dq_shuf_<shuffletype>64x2_1<mask_name>"
12279 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
12280 (vec_select:VI8F_256
12281 (vec_concat:<ssedoublemode>
12282 (match_operand:VI8F_256 1 "register_operand" "v")
12283 (match_operand:VI8F_256 2 "nonimmediate_operand" "vm"))
12284 (parallel [(match_operand 3 "const_0_to_3_operand")
12285 (match_operand 4 "const_0_to_3_operand")
12286 (match_operand 5 "const_4_to_7_operand")
12287 (match_operand 6 "const_4_to_7_operand")])))]
12289 && (INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
12290 && INTVAL (operands[5]) == (INTVAL (operands[6]) - 1))"
12293 mask = INTVAL (operands[3]) / 2;
12294 mask |= (INTVAL (operands[5]) - 4) / 2 << 1;
12295 operands[3] = GEN_INT (mask);
12296 return "vshuf<shuffletype>64x2\t{%3, %2, %1, %0<mask_operand7>|%0<mask_operand7>, %1, %2, %3}";
12298 [(set_attr "type" "sselog")
12299 (set_attr "length_immediate" "1")
12300 (set_attr "prefix" "evex")
12301 (set_attr "mode" "XI")])
12303 (define_expand "avx512f_shuf_<shuffletype>64x2_mask"
12304 [(match_operand:V8FI 0 "register_operand")
12305 (match_operand:V8FI 1 "register_operand")
12306 (match_operand:V8FI 2 "nonimmediate_operand")
12307 (match_operand:SI 3 "const_0_to_255_operand")
12308 (match_operand:V8FI 4 "register_operand")
12309 (match_operand:QI 5 "register_operand")]
12312 int mask = INTVAL (operands[3]);
12313 emit_insn (gen_avx512f_shuf_<shuffletype>64x2_1_mask
12314 (operands[0], operands[1], operands[2],
12315 GEN_INT (((mask >> 0) & 3) * 2),
12316 GEN_INT (((mask >> 0) & 3) * 2 + 1),
12317 GEN_INT (((mask >> 2) & 3) * 2),
12318 GEN_INT (((mask >> 2) & 3) * 2 + 1),
12319 GEN_INT (((mask >> 4) & 3) * 2 + 8),
12320 GEN_INT (((mask >> 4) & 3) * 2 + 9),
12321 GEN_INT (((mask >> 6) & 3) * 2 + 8),
12322 GEN_INT (((mask >> 6) & 3) * 2 + 9),
12323 operands[4], operands[5]));
12327 (define_insn "avx512f_shuf_<shuffletype>64x2_1<mask_name>"
12328 [(set (match_operand:V8FI 0 "register_operand" "=v")
12330 (vec_concat:<ssedoublemode>
12331 (match_operand:V8FI 1 "register_operand" "v")
12332 (match_operand:V8FI 2 "nonimmediate_operand" "vm"))
12333 (parallel [(match_operand 3 "const_0_to_7_operand")
12334 (match_operand 4 "const_0_to_7_operand")
12335 (match_operand 5 "const_0_to_7_operand")
12336 (match_operand 6 "const_0_to_7_operand")
12337 (match_operand 7 "const_8_to_15_operand")
12338 (match_operand 8 "const_8_to_15_operand")
12339 (match_operand 9 "const_8_to_15_operand")
12340 (match_operand 10 "const_8_to_15_operand")])))]
12342 && (INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
12343 && INTVAL (operands[5]) == (INTVAL (operands[6]) - 1)
12344 && INTVAL (operands[7]) == (INTVAL (operands[8]) - 1)
12345 && INTVAL (operands[9]) == (INTVAL (operands[10]) - 1))"
12348 mask = INTVAL (operands[3]) / 2;
12349 mask |= INTVAL (operands[5]) / 2 << 2;
12350 mask |= (INTVAL (operands[7]) - 8) / 2 << 4;
12351 mask |= (INTVAL (operands[9]) - 8) / 2 << 6;
12352 operands[3] = GEN_INT (mask);
12354 return "vshuf<shuffletype>64x2\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
12356 [(set_attr "type" "sselog")
12357 (set_attr "length_immediate" "1")
12358 (set_attr "prefix" "evex")
12359 (set_attr "mode" "<sseinsnmode>")])
12361 (define_expand "avx512vl_shuf_<shuffletype>32x4_mask"
12362 [(match_operand:VI4F_256 0 "register_operand")
12363 (match_operand:VI4F_256 1 "register_operand")
12364 (match_operand:VI4F_256 2 "nonimmediate_operand")
12365 (match_operand:SI 3 "const_0_to_3_operand")
12366 (match_operand:VI4F_256 4 "register_operand")
12367 (match_operand:QI 5 "register_operand")]
12370 int mask = INTVAL (operands[3]);
12371 emit_insn (gen_avx512vl_shuf_<shuffletype>32x4_1_mask
12372 (operands[0], operands[1], operands[2],
12373 GEN_INT (((mask >> 0) & 1) * 4 + 0),
12374 GEN_INT (((mask >> 0) & 1) * 4 + 1),
12375 GEN_INT (((mask >> 0) & 1) * 4 + 2),
12376 GEN_INT (((mask >> 0) & 1) * 4 + 3),
12377 GEN_INT (((mask >> 1) & 1) * 4 + 8),
12378 GEN_INT (((mask >> 1) & 1) * 4 + 9),
12379 GEN_INT (((mask >> 1) & 1) * 4 + 10),
12380 GEN_INT (((mask >> 1) & 1) * 4 + 11),
12381 operands[4], operands[5]));
12385 (define_insn "<mask_codefor>avx512vl_shuf_<shuffletype>32x4_1<mask_name>"
12386 [(set (match_operand:VI4F_256 0 "register_operand" "=v")
12387 (vec_select:VI4F_256
12388 (vec_concat:<ssedoublemode>
12389 (match_operand:VI4F_256 1 "register_operand" "v")
12390 (match_operand:VI4F_256 2 "nonimmediate_operand" "vm"))
12391 (parallel [(match_operand 3 "const_0_to_7_operand")
12392 (match_operand 4 "const_0_to_7_operand")
12393 (match_operand 5 "const_0_to_7_operand")
12394 (match_operand 6 "const_0_to_7_operand")
12395 (match_operand 7 "const_8_to_15_operand")
12396 (match_operand 8 "const_8_to_15_operand")
12397 (match_operand 9 "const_8_to_15_operand")
12398 (match_operand 10 "const_8_to_15_operand")])))]
12400 && (INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
12401 && INTVAL (operands[3]) == (INTVAL (operands[5]) - 2)
12402 && INTVAL (operands[3]) == (INTVAL (operands[6]) - 3)
12403 && INTVAL (operands[7]) == (INTVAL (operands[8]) - 1)
12404 && INTVAL (operands[7]) == (INTVAL (operands[9]) - 2)
12405 && INTVAL (operands[7]) == (INTVAL (operands[10]) - 3))"
12408 mask = INTVAL (operands[3]) / 4;
12409 mask |= (INTVAL (operands[7]) - 8) / 4 << 1;
12410 operands[3] = GEN_INT (mask);
12412 return "vshuf<shuffletype>32x4\t{%3, %2, %1, %0<mask_operand11>|%0<mask_operand11>, %1, %2, %3}";
12414 [(set_attr "type" "sselog")
12415 (set_attr "length_immediate" "1")
12416 (set_attr "prefix" "evex")
12417 (set_attr "mode" "<sseinsnmode>")])
12419 (define_expand "avx512f_shuf_<shuffletype>32x4_mask"
12420 [(match_operand:V16FI 0 "register_operand")
12421 (match_operand:V16FI 1 "register_operand")
12422 (match_operand:V16FI 2 "nonimmediate_operand")
12423 (match_operand:SI 3 "const_0_to_255_operand")
12424 (match_operand:V16FI 4 "register_operand")
12425 (match_operand:HI 5 "register_operand")]
12428 int mask = INTVAL (operands[3]);
12429 emit_insn (gen_avx512f_shuf_<shuffletype>32x4_1_mask
12430 (operands[0], operands[1], operands[2],
12431 GEN_INT (((mask >> 0) & 3) * 4),
12432 GEN_INT (((mask >> 0) & 3) * 4 + 1),
12433 GEN_INT (((mask >> 0) & 3) * 4 + 2),
12434 GEN_INT (((mask >> 0) & 3) * 4 + 3),
12435 GEN_INT (((mask >> 2) & 3) * 4),
12436 GEN_INT (((mask >> 2) & 3) * 4 + 1),
12437 GEN_INT (((mask >> 2) & 3) * 4 + 2),
12438 GEN_INT (((mask >> 2) & 3) * 4 + 3),
12439 GEN_INT (((mask >> 4) & 3) * 4 + 16),
12440 GEN_INT (((mask >> 4) & 3) * 4 + 17),
12441 GEN_INT (((mask >> 4) & 3) * 4 + 18),
12442 GEN_INT (((mask >> 4) & 3) * 4 + 19),
12443 GEN_INT (((mask >> 6) & 3) * 4 + 16),
12444 GEN_INT (((mask >> 6) & 3) * 4 + 17),
12445 GEN_INT (((mask >> 6) & 3) * 4 + 18),
12446 GEN_INT (((mask >> 6) & 3) * 4 + 19),
12447 operands[4], operands[5]));
12451 (define_insn "avx512f_shuf_<shuffletype>32x4_1<mask_name>"
12452 [(set (match_operand:V16FI 0 "register_operand" "=v")
12454 (vec_concat:<ssedoublemode>
12455 (match_operand:V16FI 1 "register_operand" "v")
12456 (match_operand:V16FI 2 "nonimmediate_operand" "vm"))
12457 (parallel [(match_operand 3 "const_0_to_15_operand")
12458 (match_operand 4 "const_0_to_15_operand")
12459 (match_operand 5 "const_0_to_15_operand")
12460 (match_operand 6 "const_0_to_15_operand")
12461 (match_operand 7 "const_0_to_15_operand")
12462 (match_operand 8 "const_0_to_15_operand")
12463 (match_operand 9 "const_0_to_15_operand")
12464 (match_operand 10 "const_0_to_15_operand")
12465 (match_operand 11 "const_16_to_31_operand")
12466 (match_operand 12 "const_16_to_31_operand")
12467 (match_operand 13 "const_16_to_31_operand")
12468 (match_operand 14 "const_16_to_31_operand")
12469 (match_operand 15 "const_16_to_31_operand")
12470 (match_operand 16 "const_16_to_31_operand")
12471 (match_operand 17 "const_16_to_31_operand")
12472 (match_operand 18 "const_16_to_31_operand")])))]
12474 && (INTVAL (operands[3]) == (INTVAL (operands[4]) - 1)
12475 && INTVAL (operands[3]) == (INTVAL (operands[5]) - 2)
12476 && INTVAL (operands[3]) == (INTVAL (operands[6]) - 3)
12477 && INTVAL (operands[7]) == (INTVAL (operands[8]) - 1)
12478 && INTVAL (operands[7]) == (INTVAL (operands[9]) - 2)
12479 && INTVAL (operands[7]) == (INTVAL (operands[10]) - 3)
12480 && INTVAL (operands[11]) == (INTVAL (operands[12]) - 1)
12481 && INTVAL (operands[11]) == (INTVAL (operands[13]) - 2)
12482 && INTVAL (operands[11]) == (INTVAL (operands[14]) - 3)
12483 && INTVAL (operands[15]) == (INTVAL (operands[16]) - 1)
12484 && INTVAL (operands[15]) == (INTVAL (operands[17]) - 2)
12485 && INTVAL (operands[15]) == (INTVAL (operands[18]) - 3))"
12488 mask = INTVAL (operands[3]) / 4;
12489 mask |= INTVAL (operands[7]) / 4 << 2;
12490 mask |= (INTVAL (operands[11]) - 16) / 4 << 4;
12491 mask |= (INTVAL (operands[15]) - 16) / 4 << 6;
12492 operands[3] = GEN_INT (mask);
12494 return "vshuf<shuffletype>32x4\t{%3, %2, %1, %0<mask_operand19>|%0<mask_operand19>, %1, %2, %3}";
12496 [(set_attr "type" "sselog")
12497 (set_attr "length_immediate" "1")
12498 (set_attr "prefix" "evex")
12499 (set_attr "mode" "<sseinsnmode>")])
12501 (define_expand "avx512f_pshufdv3_mask"
12502 [(match_operand:V16SI 0 "register_operand")
12503 (match_operand:V16SI 1 "nonimmediate_operand")
12504 (match_operand:SI 2 "const_0_to_255_operand")
12505 (match_operand:V16SI 3 "register_operand")
12506 (match_operand:HI 4 "register_operand")]
12509 int mask = INTVAL (operands[2]);
12510 emit_insn (gen_avx512f_pshufd_1_mask (operands[0], operands[1],
12511 GEN_INT ((mask >> 0) & 3),
12512 GEN_INT ((mask >> 2) & 3),
12513 GEN_INT ((mask >> 4) & 3),
12514 GEN_INT ((mask >> 6) & 3),
12515 GEN_INT (((mask >> 0) & 3) + 4),
12516 GEN_INT (((mask >> 2) & 3) + 4),
12517 GEN_INT (((mask >> 4) & 3) + 4),
12518 GEN_INT (((mask >> 6) & 3) + 4),
12519 GEN_INT (((mask >> 0) & 3) + 8),
12520 GEN_INT (((mask >> 2) & 3) + 8),
12521 GEN_INT (((mask >> 4) & 3) + 8),
12522 GEN_INT (((mask >> 6) & 3) + 8),
12523 GEN_INT (((mask >> 0) & 3) + 12),
12524 GEN_INT (((mask >> 2) & 3) + 12),
12525 GEN_INT (((mask >> 4) & 3) + 12),
12526 GEN_INT (((mask >> 6) & 3) + 12),
12527 operands[3], operands[4]));
12531 (define_insn "avx512f_pshufd_1<mask_name>"
12532 [(set (match_operand:V16SI 0 "register_operand" "=v")
12534 (match_operand:V16SI 1 "nonimmediate_operand" "vm")
12535 (parallel [(match_operand 2 "const_0_to_3_operand")
12536 (match_operand 3 "const_0_to_3_operand")
12537 (match_operand 4 "const_0_to_3_operand")
12538 (match_operand 5 "const_0_to_3_operand")
12539 (match_operand 6 "const_4_to_7_operand")
12540 (match_operand 7 "const_4_to_7_operand")
12541 (match_operand 8 "const_4_to_7_operand")
12542 (match_operand 9 "const_4_to_7_operand")
12543 (match_operand 10 "const_8_to_11_operand")
12544 (match_operand 11 "const_8_to_11_operand")
12545 (match_operand 12 "const_8_to_11_operand")
12546 (match_operand 13 "const_8_to_11_operand")
12547 (match_operand 14 "const_12_to_15_operand")
12548 (match_operand 15 "const_12_to_15_operand")
12549 (match_operand 16 "const_12_to_15_operand")
12550 (match_operand 17 "const_12_to_15_operand")])))]
12552 && INTVAL (operands[2]) + 4 == INTVAL (operands[6])
12553 && INTVAL (operands[3]) + 4 == INTVAL (operands[7])
12554 && INTVAL (operands[4]) + 4 == INTVAL (operands[8])
12555 && INTVAL (operands[5]) + 4 == INTVAL (operands[9])
12556 && INTVAL (operands[2]) + 8 == INTVAL (operands[10])
12557 && INTVAL (operands[3]) + 8 == INTVAL (operands[11])
12558 && INTVAL (operands[4]) + 8 == INTVAL (operands[12])
12559 && INTVAL (operands[5]) + 8 == INTVAL (operands[13])
12560 && INTVAL (operands[2]) + 12 == INTVAL (operands[14])
12561 && INTVAL (operands[3]) + 12 == INTVAL (operands[15])
12562 && INTVAL (operands[4]) + 12 == INTVAL (operands[16])
12563 && INTVAL (operands[5]) + 12 == INTVAL (operands[17])"
12566 mask |= INTVAL (operands[2]) << 0;
12567 mask |= INTVAL (operands[3]) << 2;
12568 mask |= INTVAL (operands[4]) << 4;
12569 mask |= INTVAL (operands[5]) << 6;
12570 operands[2] = GEN_INT (mask);
12572 return "vpshufd\t{%2, %1, %0<mask_operand18>|%0<mask_operand18>, %1, %2}";
12574 [(set_attr "type" "sselog1")
12575 (set_attr "prefix" "evex")
12576 (set_attr "length_immediate" "1")
12577 (set_attr "mode" "XI")])
12579 (define_expand "avx512vl_pshufdv3_mask"
12580 [(match_operand:V8SI 0 "register_operand")
12581 (match_operand:V8SI 1 "nonimmediate_operand")
12582 (match_operand:SI 2 "const_0_to_255_operand")
12583 (match_operand:V8SI 3 "register_operand")
12584 (match_operand:QI 4 "register_operand")]
12587 int mask = INTVAL (operands[2]);
12588 emit_insn (gen_avx2_pshufd_1_mask (operands[0], operands[1],
12589 GEN_INT ((mask >> 0) & 3),
12590 GEN_INT ((mask >> 2) & 3),
12591 GEN_INT ((mask >> 4) & 3),
12592 GEN_INT ((mask >> 6) & 3),
12593 GEN_INT (((mask >> 0) & 3) + 4),
12594 GEN_INT (((mask >> 2) & 3) + 4),
12595 GEN_INT (((mask >> 4) & 3) + 4),
12596 GEN_INT (((mask >> 6) & 3) + 4),
12597 operands[3], operands[4]));
12601 (define_expand "avx2_pshufdv3"
12602 [(match_operand:V8SI 0 "register_operand")
12603 (match_operand:V8SI 1 "nonimmediate_operand")
12604 (match_operand:SI 2 "const_0_to_255_operand")]
12607 int mask = INTVAL (operands[2]);
12608 emit_insn (gen_avx2_pshufd_1 (operands[0], operands[1],
12609 GEN_INT ((mask >> 0) & 3),
12610 GEN_INT ((mask >> 2) & 3),
12611 GEN_INT ((mask >> 4) & 3),
12612 GEN_INT ((mask >> 6) & 3),
12613 GEN_INT (((mask >> 0) & 3) + 4),
12614 GEN_INT (((mask >> 2) & 3) + 4),
12615 GEN_INT (((mask >> 4) & 3) + 4),
12616 GEN_INT (((mask >> 6) & 3) + 4)));
12620 (define_insn "avx2_pshufd_1<mask_name>"
12621 [(set (match_operand:V8SI 0 "register_operand" "=v")
12623 (match_operand:V8SI 1 "nonimmediate_operand" "vm")
12624 (parallel [(match_operand 2 "const_0_to_3_operand")
12625 (match_operand 3 "const_0_to_3_operand")
12626 (match_operand 4 "const_0_to_3_operand")
12627 (match_operand 5 "const_0_to_3_operand")
12628 (match_operand 6 "const_4_to_7_operand")
12629 (match_operand 7 "const_4_to_7_operand")
12630 (match_operand 8 "const_4_to_7_operand")
12631 (match_operand 9 "const_4_to_7_operand")])))]
12633 && <mask_avx512vl_condition>
12634 && INTVAL (operands[2]) + 4 == INTVAL (operands[6])
12635 && INTVAL (operands[3]) + 4 == INTVAL (operands[7])
12636 && INTVAL (operands[4]) + 4 == INTVAL (operands[8])
12637 && INTVAL (operands[5]) + 4 == INTVAL (operands[9])"
12640 mask |= INTVAL (operands[2]) << 0;
12641 mask |= INTVAL (operands[3]) << 2;
12642 mask |= INTVAL (operands[4]) << 4;
12643 mask |= INTVAL (operands[5]) << 6;
12644 operands[2] = GEN_INT (mask);
12646 return "vpshufd\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
12648 [(set_attr "type" "sselog1")
12649 (set_attr "prefix" "maybe_evex")
12650 (set_attr "length_immediate" "1")
12651 (set_attr "mode" "OI")])
12653 (define_expand "avx512vl_pshufd_mask"
12654 [(match_operand:V4SI 0 "register_operand")
12655 (match_operand:V4SI 1 "nonimmediate_operand")
12656 (match_operand:SI 2 "const_0_to_255_operand")
12657 (match_operand:V4SI 3 "register_operand")
12658 (match_operand:QI 4 "register_operand")]
12661 int mask = INTVAL (operands[2]);
12662 emit_insn (gen_sse2_pshufd_1_mask (operands[0], operands[1],
12663 GEN_INT ((mask >> 0) & 3),
12664 GEN_INT ((mask >> 2) & 3),
12665 GEN_INT ((mask >> 4) & 3),
12666 GEN_INT ((mask >> 6) & 3),
12667 operands[3], operands[4]));
12671 (define_expand "sse2_pshufd"
12672 [(match_operand:V4SI 0 "register_operand")
12673 (match_operand:V4SI 1 "vector_operand")
12674 (match_operand:SI 2 "const_int_operand")]
12677 int mask = INTVAL (operands[2]);
12678 emit_insn (gen_sse2_pshufd_1 (operands[0], operands[1],
12679 GEN_INT ((mask >> 0) & 3),
12680 GEN_INT ((mask >> 2) & 3),
12681 GEN_INT ((mask >> 4) & 3),
12682 GEN_INT ((mask >> 6) & 3)));
12686 (define_insn "sse2_pshufd_1<mask_name>"
12687 [(set (match_operand:V4SI 0 "register_operand" "=v")
12689 (match_operand:V4SI 1 "vector_operand" "vBm")
12690 (parallel [(match_operand 2 "const_0_to_3_operand")
12691 (match_operand 3 "const_0_to_3_operand")
12692 (match_operand 4 "const_0_to_3_operand")
12693 (match_operand 5 "const_0_to_3_operand")])))]
12694 "TARGET_SSE2 && <mask_avx512vl_condition>"
12697 mask |= INTVAL (operands[2]) << 0;
12698 mask |= INTVAL (operands[3]) << 2;
12699 mask |= INTVAL (operands[4]) << 4;
12700 mask |= INTVAL (operands[5]) << 6;
12701 operands[2] = GEN_INT (mask);
12703 return "%vpshufd\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
12705 [(set_attr "type" "sselog1")
12706 (set_attr "prefix_data16" "1")
12707 (set_attr "prefix" "<mask_prefix2>")
12708 (set_attr "length_immediate" "1")
12709 (set_attr "mode" "TI")])
12711 (define_insn "<mask_codefor>avx512bw_pshuflwv32hi<mask_name>"
12712 [(set (match_operand:V32HI 0 "register_operand" "=v")
12714 [(match_operand:V32HI 1 "nonimmediate_operand" "vm")
12715 (match_operand:SI 2 "const_0_to_255_operand" "n")]
12718 "vpshuflw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12719 [(set_attr "type" "sselog")
12720 (set_attr "prefix" "evex")
12721 (set_attr "mode" "XI")])
12723 (define_expand "avx512vl_pshuflwv3_mask"
12724 [(match_operand:V16HI 0 "register_operand")
12725 (match_operand:V16HI 1 "nonimmediate_operand")
12726 (match_operand:SI 2 "const_0_to_255_operand")
12727 (match_operand:V16HI 3 "register_operand")
12728 (match_operand:HI 4 "register_operand")]
12729 "TARGET_AVX512VL && TARGET_AVX512BW"
12731 int mask = INTVAL (operands[2]);
12732 emit_insn (gen_avx2_pshuflw_1_mask (operands[0], operands[1],
12733 GEN_INT ((mask >> 0) & 3),
12734 GEN_INT ((mask >> 2) & 3),
12735 GEN_INT ((mask >> 4) & 3),
12736 GEN_INT ((mask >> 6) & 3),
12737 GEN_INT (((mask >> 0) & 3) + 8),
12738 GEN_INT (((mask >> 2) & 3) + 8),
12739 GEN_INT (((mask >> 4) & 3) + 8),
12740 GEN_INT (((mask >> 6) & 3) + 8),
12741 operands[3], operands[4]));
12745 (define_expand "avx2_pshuflwv3"
12746 [(match_operand:V16HI 0 "register_operand")
12747 (match_operand:V16HI 1 "nonimmediate_operand")
12748 (match_operand:SI 2 "const_0_to_255_operand")]
12751 int mask = INTVAL (operands[2]);
12752 emit_insn (gen_avx2_pshuflw_1 (operands[0], operands[1],
12753 GEN_INT ((mask >> 0) & 3),
12754 GEN_INT ((mask >> 2) & 3),
12755 GEN_INT ((mask >> 4) & 3),
12756 GEN_INT ((mask >> 6) & 3),
12757 GEN_INT (((mask >> 0) & 3) + 8),
12758 GEN_INT (((mask >> 2) & 3) + 8),
12759 GEN_INT (((mask >> 4) & 3) + 8),
12760 GEN_INT (((mask >> 6) & 3) + 8)));
12764 (define_insn "avx2_pshuflw_1<mask_name>"
12765 [(set (match_operand:V16HI 0 "register_operand" "=v")
12767 (match_operand:V16HI 1 "nonimmediate_operand" "vm")
12768 (parallel [(match_operand 2 "const_0_to_3_operand")
12769 (match_operand 3 "const_0_to_3_operand")
12770 (match_operand 4 "const_0_to_3_operand")
12771 (match_operand 5 "const_0_to_3_operand")
12776 (match_operand 6 "const_8_to_11_operand")
12777 (match_operand 7 "const_8_to_11_operand")
12778 (match_operand 8 "const_8_to_11_operand")
12779 (match_operand 9 "const_8_to_11_operand")
12783 (const_int 15)])))]
12785 && <mask_avx512bw_condition> && <mask_avx512vl_condition>
12786 && INTVAL (operands[2]) + 8 == INTVAL (operands[6])
12787 && INTVAL (operands[3]) + 8 == INTVAL (operands[7])
12788 && INTVAL (operands[4]) + 8 == INTVAL (operands[8])
12789 && INTVAL (operands[5]) + 8 == INTVAL (operands[9])"
12792 mask |= INTVAL (operands[2]) << 0;
12793 mask |= INTVAL (operands[3]) << 2;
12794 mask |= INTVAL (operands[4]) << 4;
12795 mask |= INTVAL (operands[5]) << 6;
12796 operands[2] = GEN_INT (mask);
12798 return "vpshuflw\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
12800 [(set_attr "type" "sselog")
12801 (set_attr "prefix" "maybe_evex")
12802 (set_attr "length_immediate" "1")
12803 (set_attr "mode" "OI")])
12805 (define_expand "avx512vl_pshuflw_mask"
12806 [(match_operand:V8HI 0 "register_operand")
12807 (match_operand:V8HI 1 "nonimmediate_operand")
12808 (match_operand:SI 2 "const_0_to_255_operand")
12809 (match_operand:V8HI 3 "register_operand")
12810 (match_operand:QI 4 "register_operand")]
12811 "TARGET_AVX512VL && TARGET_AVX512BW"
12813 int mask = INTVAL (operands[2]);
12814 emit_insn (gen_sse2_pshuflw_1_mask (operands[0], operands[1],
12815 GEN_INT ((mask >> 0) & 3),
12816 GEN_INT ((mask >> 2) & 3),
12817 GEN_INT ((mask >> 4) & 3),
12818 GEN_INT ((mask >> 6) & 3),
12819 operands[3], operands[4]));
12823 (define_expand "sse2_pshuflw"
12824 [(match_operand:V8HI 0 "register_operand")
12825 (match_operand:V8HI 1 "vector_operand")
12826 (match_operand:SI 2 "const_int_operand")]
12829 int mask = INTVAL (operands[2]);
12830 emit_insn (gen_sse2_pshuflw_1 (operands[0], operands[1],
12831 GEN_INT ((mask >> 0) & 3),
12832 GEN_INT ((mask >> 2) & 3),
12833 GEN_INT ((mask >> 4) & 3),
12834 GEN_INT ((mask >> 6) & 3)));
12838 (define_insn "sse2_pshuflw_1<mask_name>"
12839 [(set (match_operand:V8HI 0 "register_operand" "=v")
12841 (match_operand:V8HI 1 "vector_operand" "vBm")
12842 (parallel [(match_operand 2 "const_0_to_3_operand")
12843 (match_operand 3 "const_0_to_3_operand")
12844 (match_operand 4 "const_0_to_3_operand")
12845 (match_operand 5 "const_0_to_3_operand")
12850 "TARGET_SSE2 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
12853 mask |= INTVAL (operands[2]) << 0;
12854 mask |= INTVAL (operands[3]) << 2;
12855 mask |= INTVAL (operands[4]) << 4;
12856 mask |= INTVAL (operands[5]) << 6;
12857 operands[2] = GEN_INT (mask);
12859 return "%vpshuflw\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
12861 [(set_attr "type" "sselog")
12862 (set_attr "prefix_data16" "0")
12863 (set_attr "prefix_rep" "1")
12864 (set_attr "prefix" "maybe_vex")
12865 (set_attr "length_immediate" "1")
12866 (set_attr "mode" "TI")])
12868 (define_expand "avx2_pshufhwv3"
12869 [(match_operand:V16HI 0 "register_operand")
12870 (match_operand:V16HI 1 "nonimmediate_operand")
12871 (match_operand:SI 2 "const_0_to_255_operand")]
12874 int mask = INTVAL (operands[2]);
12875 emit_insn (gen_avx2_pshufhw_1 (operands[0], operands[1],
12876 GEN_INT (((mask >> 0) & 3) + 4),
12877 GEN_INT (((mask >> 2) & 3) + 4),
12878 GEN_INT (((mask >> 4) & 3) + 4),
12879 GEN_INT (((mask >> 6) & 3) + 4),
12880 GEN_INT (((mask >> 0) & 3) + 12),
12881 GEN_INT (((mask >> 2) & 3) + 12),
12882 GEN_INT (((mask >> 4) & 3) + 12),
12883 GEN_INT (((mask >> 6) & 3) + 12)));
12887 (define_insn "<mask_codefor>avx512bw_pshufhwv32hi<mask_name>"
12888 [(set (match_operand:V32HI 0 "register_operand" "=v")
12890 [(match_operand:V32HI 1 "nonimmediate_operand" "vm")
12891 (match_operand:SI 2 "const_0_to_255_operand" "n")]
12894 "vpshufhw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
12895 [(set_attr "type" "sselog")
12896 (set_attr "prefix" "evex")
12897 (set_attr "mode" "XI")])
12899 (define_expand "avx512vl_pshufhwv3_mask"
12900 [(match_operand:V16HI 0 "register_operand")
12901 (match_operand:V16HI 1 "nonimmediate_operand")
12902 (match_operand:SI 2 "const_0_to_255_operand")
12903 (match_operand:V16HI 3 "register_operand")
12904 (match_operand:HI 4 "register_operand")]
12905 "TARGET_AVX512VL && TARGET_AVX512BW"
12907 int mask = INTVAL (operands[2]);
12908 emit_insn (gen_avx2_pshufhw_1_mask (operands[0], operands[1],
12909 GEN_INT (((mask >> 0) & 3) + 4),
12910 GEN_INT (((mask >> 2) & 3) + 4),
12911 GEN_INT (((mask >> 4) & 3) + 4),
12912 GEN_INT (((mask >> 6) & 3) + 4),
12913 GEN_INT (((mask >> 0) & 3) + 12),
12914 GEN_INT (((mask >> 2) & 3) + 12),
12915 GEN_INT (((mask >> 4) & 3) + 12),
12916 GEN_INT (((mask >> 6) & 3) + 12),
12917 operands[3], operands[4]));
12921 (define_insn "avx2_pshufhw_1<mask_name>"
12922 [(set (match_operand:V16HI 0 "register_operand" "=v")
12924 (match_operand:V16HI 1 "nonimmediate_operand" "vm")
12925 (parallel [(const_int 0)
12929 (match_operand 2 "const_4_to_7_operand")
12930 (match_operand 3 "const_4_to_7_operand")
12931 (match_operand 4 "const_4_to_7_operand")
12932 (match_operand 5 "const_4_to_7_operand")
12937 (match_operand 6 "const_12_to_15_operand")
12938 (match_operand 7 "const_12_to_15_operand")
12939 (match_operand 8 "const_12_to_15_operand")
12940 (match_operand 9 "const_12_to_15_operand")])))]
12942 && <mask_avx512bw_condition> && <mask_avx512vl_condition>
12943 && INTVAL (operands[2]) + 8 == INTVAL (operands[6])
12944 && INTVAL (operands[3]) + 8 == INTVAL (operands[7])
12945 && INTVAL (operands[4]) + 8 == INTVAL (operands[8])
12946 && INTVAL (operands[5]) + 8 == INTVAL (operands[9])"
12949 mask |= (INTVAL (operands[2]) - 4) << 0;
12950 mask |= (INTVAL (operands[3]) - 4) << 2;
12951 mask |= (INTVAL (operands[4]) - 4) << 4;
12952 mask |= (INTVAL (operands[5]) - 4) << 6;
12953 operands[2] = GEN_INT (mask);
12955 return "vpshufhw\t{%2, %1, %0<mask_operand10>|%0<mask_operand10>, %1, %2}";
12957 [(set_attr "type" "sselog")
12958 (set_attr "prefix" "maybe_evex")
12959 (set_attr "length_immediate" "1")
12960 (set_attr "mode" "OI")])
12962 (define_expand "avx512vl_pshufhw_mask"
12963 [(match_operand:V8HI 0 "register_operand")
12964 (match_operand:V8HI 1 "nonimmediate_operand")
12965 (match_operand:SI 2 "const_0_to_255_operand")
12966 (match_operand:V8HI 3 "register_operand")
12967 (match_operand:QI 4 "register_operand")]
12968 "TARGET_AVX512VL && TARGET_AVX512BW"
12970 int mask = INTVAL (operands[2]);
12971 emit_insn (gen_sse2_pshufhw_1_mask (operands[0], operands[1],
12972 GEN_INT (((mask >> 0) & 3) + 4),
12973 GEN_INT (((mask >> 2) & 3) + 4),
12974 GEN_INT (((mask >> 4) & 3) + 4),
12975 GEN_INT (((mask >> 6) & 3) + 4),
12976 operands[3], operands[4]));
12980 (define_expand "sse2_pshufhw"
12981 [(match_operand:V8HI 0 "register_operand")
12982 (match_operand:V8HI 1 "vector_operand")
12983 (match_operand:SI 2 "const_int_operand")]
12986 int mask = INTVAL (operands[2]);
12987 emit_insn (gen_sse2_pshufhw_1 (operands[0], operands[1],
12988 GEN_INT (((mask >> 0) & 3) + 4),
12989 GEN_INT (((mask >> 2) & 3) + 4),
12990 GEN_INT (((mask >> 4) & 3) + 4),
12991 GEN_INT (((mask >> 6) & 3) + 4)));
12995 (define_insn "sse2_pshufhw_1<mask_name>"
12996 [(set (match_operand:V8HI 0 "register_operand" "=v")
12998 (match_operand:V8HI 1 "vector_operand" "vBm")
12999 (parallel [(const_int 0)
13003 (match_operand 2 "const_4_to_7_operand")
13004 (match_operand 3 "const_4_to_7_operand")
13005 (match_operand 4 "const_4_to_7_operand")
13006 (match_operand 5 "const_4_to_7_operand")])))]
13007 "TARGET_SSE2 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
13010 mask |= (INTVAL (operands[2]) - 4) << 0;
13011 mask |= (INTVAL (operands[3]) - 4) << 2;
13012 mask |= (INTVAL (operands[4]) - 4) << 4;
13013 mask |= (INTVAL (operands[5]) - 4) << 6;
13014 operands[2] = GEN_INT (mask);
13016 return "%vpshufhw\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
13018 [(set_attr "type" "sselog")
13019 (set_attr "prefix_rep" "1")
13020 (set_attr "prefix_data16" "0")
13021 (set_attr "prefix" "maybe_vex")
13022 (set_attr "length_immediate" "1")
13023 (set_attr "mode" "TI")])
13025 (define_expand "sse2_loadd"
13026 [(set (match_operand:V4SI 0 "register_operand")
13028 (vec_duplicate:V4SI
13029 (match_operand:SI 1 "nonimmediate_operand"))
13033 "operands[2] = CONST0_RTX (V4SImode);")
13035 (define_insn "sse2_loadld"
13036 [(set (match_operand:V4SI 0 "register_operand" "=v,Yi,x,x,v")
13038 (vec_duplicate:V4SI
13039 (match_operand:SI 2 "nonimmediate_operand" "m ,r ,m,x,v"))
13040 (match_operand:V4SI 1 "reg_or_0_operand" "C ,C ,C,0,v")
13044 %vmovd\t{%2, %0|%0, %2}
13045 %vmovd\t{%2, %0|%0, %2}
13046 movss\t{%2, %0|%0, %2}
13047 movss\t{%2, %0|%0, %2}
13048 vmovss\t{%2, %1, %0|%0, %1, %2}"
13049 [(set_attr "isa" "sse2,sse2,noavx,noavx,avx")
13050 (set_attr "type" "ssemov")
13051 (set_attr "prefix" "maybe_vex,maybe_vex,orig,orig,maybe_evex")
13052 (set_attr "mode" "TI,TI,V4SF,SF,SF")])
13054 ;; QI and HI modes handled by pextr patterns.
13055 (define_mode_iterator PEXTR_MODE12
13056 [(V16QI "TARGET_SSE4_1") V8HI])
13058 (define_insn "*vec_extract<mode>"
13059 [(set (match_operand:<ssescalarmode> 0 "register_sse4nonimm_operand" "=r,m,r,m")
13060 (vec_select:<ssescalarmode>
13061 (match_operand:PEXTR_MODE12 1 "register_operand" "x,x,v,v")
13063 [(match_operand:SI 2 "const_0_to_<ssescalarnummask>_operand")])))]
13066 %vpextr<ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}
13067 %vpextr<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}
13068 vpextr<ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}
13069 vpextr<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
13070 [(set_attr "isa" "*,sse4,avx512bw,avx512bw")
13071 (set_attr "type" "sselog1")
13072 (set_attr "prefix_data16" "1")
13073 (set (attr "prefix_extra")
13075 (and (eq_attr "alternative" "0,2")
13076 (eq (const_string "<MODE>mode") (const_string "V8HImode")))
13078 (const_string "1")))
13079 (set_attr "length_immediate" "1")
13080 (set_attr "prefix" "maybe_vex,maybe_vex,evex,evex")
13081 (set_attr "mode" "TI")])
13083 (define_insn "*vec_extract<PEXTR_MODE12:mode>_zext"
13084 [(set (match_operand:SWI48 0 "register_operand" "=r,r")
13086 (vec_select:<PEXTR_MODE12:ssescalarmode>
13087 (match_operand:PEXTR_MODE12 1 "register_operand" "x,v")
13089 [(match_operand:SI 2
13090 "const_0_to_<PEXTR_MODE12:ssescalarnummask>_operand")]))))]
13093 %vpextr<PEXTR_MODE12:ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}
13094 vpextr<PEXTR_MODE12:ssemodesuffix>\t{%2, %1, %k0|%k0, %1, %2}"
13095 [(set_attr "isa" "*,avx512bw")
13096 (set_attr "type" "sselog1")
13097 (set_attr "prefix_data16" "1")
13098 (set (attr "prefix_extra")
13100 (eq (const_string "<PEXTR_MODE12:MODE>mode") (const_string "V8HImode"))
13102 (const_string "1")))
13103 (set_attr "length_immediate" "1")
13104 (set_attr "prefix" "maybe_vex")
13105 (set_attr "mode" "TI")])
13107 (define_insn "*vec_extract<mode>_mem"
13108 [(set (match_operand:<ssescalarmode> 0 "register_operand" "=r")
13109 (vec_select:<ssescalarmode>
13110 (match_operand:VI12_128 1 "memory_operand" "o")
13112 [(match_operand 2 "const_0_to_<ssescalarnummask>_operand")])))]
13116 (define_insn "*vec_extract<ssevecmodelower>_0"
13117 [(set (match_operand:SWI48 0 "nonimmediate_operand" "=r ,r,v ,m")
13119 (match_operand:<ssevecmode> 1 "nonimmediate_operand" "mYj,v,vm,v")
13120 (parallel [(const_int 0)])))]
13121 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
13123 [(set_attr "isa" "*,sse4,*,*")])
13125 (define_insn_and_split "*vec_extractv4si_0_zext"
13126 [(set (match_operand:DI 0 "register_operand" "=r")
13129 (match_operand:V4SI 1 "register_operand" "v")
13130 (parallel [(const_int 0)]))))]
13131 "TARGET_64BIT && TARGET_SSE2 && TARGET_INTER_UNIT_MOVES_FROM_VEC"
13133 "&& reload_completed"
13134 [(set (match_dup 0) (zero_extend:DI (match_dup 1)))]
13135 "operands[1] = gen_lowpart (SImode, operands[1]);")
13137 (define_insn "*vec_extractv2di_0_sse"
13138 [(set (match_operand:DI 0 "nonimmediate_operand" "=v,m")
13140 (match_operand:V2DI 1 "nonimmediate_operand" "vm,v")
13141 (parallel [(const_int 0)])))]
13142 "TARGET_SSE && !TARGET_64BIT
13143 && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
13147 [(set (match_operand:SWI48x 0 "nonimmediate_operand")
13149 (match_operand:<ssevecmode> 1 "register_operand")
13150 (parallel [(const_int 0)])))]
13151 "TARGET_SSE && reload_completed"
13152 [(set (match_dup 0) (match_dup 1))]
13153 "operands[1] = gen_lowpart (<MODE>mode, operands[1]);")
13155 (define_insn "*vec_extractv4si"
13156 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,rm,Yr,*x,x,Yv")
13158 (match_operand:V4SI 1 "register_operand" "x,v,0,0,x,v")
13159 (parallel [(match_operand:SI 2 "const_0_to_3_operand")])))]
13162 switch (which_alternative)
13166 return "%vpextrd\t{%2, %1, %0|%0, %1, %2}";
13170 operands[2] = GEN_INT (INTVAL (operands[2]) * 4);
13171 return "psrldq\t{%2, %0|%0, %2}";
13175 operands[2] = GEN_INT (INTVAL (operands[2]) * 4);
13176 return "vpsrldq\t{%2, %1, %0|%0, %1, %2}";
13179 gcc_unreachable ();
13182 [(set_attr "isa" "*,avx512dq,noavx,noavx,avx,avx512bw")
13183 (set_attr "type" "sselog1,sselog1,sseishft1,sseishft1,sseishft1,sseishft1")
13184 (set_attr "prefix_extra" "1,1,*,*,*,*")
13185 (set_attr "length_immediate" "1")
13186 (set_attr "prefix" "maybe_vex,evex,orig,orig,vex,evex")
13187 (set_attr "mode" "TI")])
13189 (define_insn "*vec_extractv4si_zext"
13190 [(set (match_operand:DI 0 "register_operand" "=r,r")
13193 (match_operand:V4SI 1 "register_operand" "x,v")
13194 (parallel [(match_operand:SI 2 "const_0_to_3_operand")]))))]
13195 "TARGET_64BIT && TARGET_SSE4_1"
13196 "%vpextrd\t{%2, %1, %k0|%k0, %1, %2}"
13197 [(set_attr "isa" "*,avx512dq")
13198 (set_attr "type" "sselog1")
13199 (set_attr "prefix_extra" "1")
13200 (set_attr "length_immediate" "1")
13201 (set_attr "prefix" "maybe_vex")
13202 (set_attr "mode" "TI")])
13204 (define_insn "*vec_extractv4si_mem"
13205 [(set (match_operand:SI 0 "register_operand" "=x,r")
13207 (match_operand:V4SI 1 "memory_operand" "o,o")
13208 (parallel [(match_operand 2 "const_0_to_3_operand")])))]
13212 (define_insn_and_split "*vec_extractv4si_zext_mem"
13213 [(set (match_operand:DI 0 "register_operand" "=x,r")
13216 (match_operand:V4SI 1 "memory_operand" "o,o")
13217 (parallel [(match_operand:SI 2 "const_0_to_3_operand")]))))]
13218 "TARGET_64BIT && TARGET_SSE"
13220 "&& reload_completed"
13221 [(set (match_dup 0) (zero_extend:DI (match_dup 1)))]
13223 operands[1] = adjust_address (operands[1], SImode, INTVAL (operands[2]) * 4);
13226 (define_insn "*vec_extractv2di_1"
13227 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,rm,m,x,x,Yv,x,v,r")
13229 (match_operand:V2DI 1 "nonimmediate_operand" "x ,v ,v,0,x, v,x,o,o")
13230 (parallel [(const_int 1)])))]
13231 "TARGET_SSE && !(MEM_P (operands[0]) && MEM_P (operands[1]))"
13233 %vpextrq\t{$1, %1, %0|%0, %1, 1}
13234 vpextrq\t{$1, %1, %0|%0, %1, 1}
13235 %vmovhps\t{%1, %0|%0, %1}
13236 psrldq\t{$8, %0|%0, 8}
13237 vpsrldq\t{$8, %1, %0|%0, %1, 8}
13238 vpsrldq\t{$8, %1, %0|%0, %1, 8}
13239 movhlps\t{%1, %0|%0, %1}
13242 [(set_attr "isa" "x64_sse4,x64_avx512dq,*,sse2_noavx,avx,avx512bw,noavx,*,x64")
13243 (set_attr "type" "sselog1,sselog1,ssemov,sseishft1,sseishft1,sseishft1,ssemov,ssemov,imov")
13244 (set_attr "length_immediate" "1,1,*,1,1,1,*,*,*")
13245 (set_attr "prefix_rex" "1,1,*,*,*,*,*,*,*")
13246 (set_attr "prefix_extra" "1,1,*,*,*,*,*,*,*")
13247 (set_attr "prefix" "maybe_vex,evex,maybe_vex,orig,vex,evex,orig,*,*")
13248 (set_attr "mode" "TI,TI,V2SF,TI,TI,TI,V4SF,DI,DI")])
13251 [(set (match_operand:<ssescalarmode> 0 "register_operand")
13252 (vec_select:<ssescalarmode>
13253 (match_operand:VI_128 1 "memory_operand")
13255 [(match_operand 2 "const_0_to_<ssescalarnummask>_operand")])))]
13256 "TARGET_SSE && reload_completed"
13257 [(set (match_dup 0) (match_dup 1))]
13259 int offs = INTVAL (operands[2]) * GET_MODE_SIZE (<ssescalarmode>mode);
13261 operands[1] = adjust_address (operands[1], <ssescalarmode>mode, offs);
13264 ;; Turn SImode or DImode extraction from arbitrary SSE/AVX/AVX512F
13265 ;; vector modes into vec_extract*.
13267 [(set (match_operand:SWI48x 0 "nonimmediate_operand")
13268 (match_operand:SWI48x 1 "register_operand"))]
13269 "can_create_pseudo_p ()
13270 && SUBREG_P (operands[1])
13271 && REG_P (SUBREG_REG (operands[1]))
13272 && (GET_MODE_CLASS (GET_MODE (SUBREG_REG (operands[1]))) == MODE_VECTOR_INT
13273 || (GET_MODE_CLASS (GET_MODE (SUBREG_REG (operands[1])))
13274 == MODE_VECTOR_FLOAT))
13275 && SUBREG_BYTE (operands[1]) == 0
13277 && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[1]))) == 16
13278 || (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[1]))) == 32
13280 || (GET_MODE_SIZE (GET_MODE (SUBREG_REG (operands[1]))) == 64
13281 && TARGET_AVX512F))
13282 && (<MODE>mode == SImode || TARGET_64BIT || MEM_P (operands[0]))"
13283 [(set (match_dup 0) (vec_select:SWI48x (match_dup 1)
13284 (parallel [(const_int 0)])))]
13287 operands[1] = SUBREG_REG (operands[1]);
13288 switch (GET_MODE_SIZE (GET_MODE (operands[1])))
13291 if (<MODE>mode == SImode)
13293 tmp = gen_reg_rtx (V8SImode);
13294 emit_insn (gen_vec_extract_lo_v16si (tmp,
13295 gen_lowpart (V16SImode,
13300 tmp = gen_reg_rtx (V4DImode);
13301 emit_insn (gen_vec_extract_lo_v8di (tmp,
13302 gen_lowpart (V8DImode,
13308 tmp = gen_reg_rtx (<ssevecmode>mode);
13309 if (<MODE>mode == SImode)
13310 emit_insn (gen_vec_extract_lo_v8si (tmp, gen_lowpart (V8SImode,
13313 emit_insn (gen_vec_extract_lo_v4di (tmp, gen_lowpart (V4DImode,
13318 operands[1] = gen_lowpart (<ssevecmode>mode, operands[1]);
13323 (define_insn "*vec_concatv2si_sse4_1"
13324 [(set (match_operand:V2SI 0 "register_operand"
13325 "=Yr,*x,x, Yr,*x,x, x, *y,*y")
13327 (match_operand:SI 1 "nonimmediate_operand"
13328 " 0, 0,x, 0,0, x,rm, 0,rm")
13329 (match_operand:SI 2 "vector_move_operand"
13330 " rm,rm,rm,Yr,*x,x, C,*ym, C")))]
13331 "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
13333 pinsrd\t{$1, %2, %0|%0, %2, 1}
13334 pinsrd\t{$1, %2, %0|%0, %2, 1}
13335 vpinsrd\t{$1, %2, %1, %0|%0, %1, %2, 1}
13336 punpckldq\t{%2, %0|%0, %2}
13337 punpckldq\t{%2, %0|%0, %2}
13338 vpunpckldq\t{%2, %1, %0|%0, %1, %2}
13339 %vmovd\t{%1, %0|%0, %1}
13340 punpckldq\t{%2, %0|%0, %2}
13341 movd\t{%1, %0|%0, %1}"
13342 [(set_attr "isa" "noavx,noavx,avx,noavx,noavx,avx,*,*,*")
13343 (set_attr "type" "sselog,sselog,sselog,sselog,sselog,sselog,ssemov,mmxcvt,mmxmov")
13344 (set_attr "prefix_extra" "1,1,1,*,*,*,*,*,*")
13345 (set_attr "length_immediate" "1,1,1,*,*,*,*,*,*")
13346 (set_attr "prefix" "orig,orig,vex,orig,orig,vex,maybe_vex,orig,orig")
13347 (set_attr "mode" "TI,TI,TI,TI,TI,TI,TI,DI,DI")])
13349 ;; ??? In theory we can match memory for the MMX alternative, but allowing
13350 ;; nonimmediate_operand for operand 2 and *not* allowing memory for the SSE
13351 ;; alternatives pretty much forces the MMX alternative to be chosen.
13352 (define_insn "*vec_concatv2si"
13353 [(set (match_operand:V2SI 0 "register_operand" "=x,x ,*y,x,x,*y,*y")
13355 (match_operand:SI 1 "nonimmediate_operand" " 0,rm,rm,0,m, 0,*rm")
13356 (match_operand:SI 2 "reg_or_0_operand" " x,C ,C, x,C,*y,C")))]
13357 "TARGET_SSE && !TARGET_SSE4_1"
13359 punpckldq\t{%2, %0|%0, %2}
13360 movd\t{%1, %0|%0, %1}
13361 movd\t{%1, %0|%0, %1}
13362 unpcklps\t{%2, %0|%0, %2}
13363 movss\t{%1, %0|%0, %1}
13364 punpckldq\t{%2, %0|%0, %2}
13365 movd\t{%1, %0|%0, %1}"
13366 [(set_attr "isa" "sse2,sse2,sse2,*,*,*,*")
13367 (set_attr "type" "sselog,ssemov,mmxmov,sselog,ssemov,mmxcvt,mmxmov")
13368 (set_attr "mode" "TI,TI,DI,V4SF,SF,DI,DI")])
13370 (define_insn "*vec_concatv4si"
13371 [(set (match_operand:V4SI 0 "register_operand" "=x,x,x,x,x")
13373 (match_operand:V2SI 1 "register_operand" " 0,x,0,0,x")
13374 (match_operand:V2SI 2 "nonimmediate_operand" " x,x,x,m,m")))]
13377 punpcklqdq\t{%2, %0|%0, %2}
13378 vpunpcklqdq\t{%2, %1, %0|%0, %1, %2}
13379 movlhps\t{%2, %0|%0, %2}
13380 movhps\t{%2, %0|%0, %q2}
13381 vmovhps\t{%2, %1, %0|%0, %1, %q2}"
13382 [(set_attr "isa" "sse2_noavx,avx,noavx,noavx,avx")
13383 (set_attr "type" "sselog,sselog,ssemov,ssemov,ssemov")
13384 (set_attr "prefix" "orig,vex,orig,orig,vex")
13385 (set_attr "mode" "TI,TI,V4SF,V2SF,V2SF")])
13387 ;; movd instead of movq is required to handle broken assemblers.
13388 (define_insn "vec_concatv2di"
13389 [(set (match_operand:V2DI 0 "register_operand"
13390 "=Yr,*x,x ,Yi,x ,!x,x,x,x,x,x")
13392 (match_operand:DI 1 "nonimmediate_operand"
13393 " 0, 0,x ,r ,xm,*y,0,x,0,0,x")
13394 (match_operand:DI 2 "vector_move_operand"
13395 "*rm,rm,rm,C ,C ,C ,x,x,x,m,m")))]
13398 pinsrq\t{$1, %2, %0|%0, %2, 1}
13399 pinsrq\t{$1, %2, %0|%0, %2, 1}
13400 vpinsrq\t{$1, %2, %1, %0|%0, %1, %2, 1}
13401 * return HAVE_AS_IX86_INTERUNIT_MOVQ ? \"%vmovq\t{%1, %0|%0, %1}\" : \"%vmovd\t{%1, %0|%0, %1}\";
13402 %vmovq\t{%1, %0|%0, %1}
13403 movq2dq\t{%1, %0|%0, %1}
13404 punpcklqdq\t{%2, %0|%0, %2}
13405 vpunpcklqdq\t{%2, %1, %0|%0, %1, %2}
13406 movlhps\t{%2, %0|%0, %2}
13407 movhps\t{%2, %0|%0, %2}
13408 vmovhps\t{%2, %1, %0|%0, %1, %2}"
13409 [(set_attr "isa" "x64_sse4_noavx,x64_sse4_noavx,x64_avx,x64,sse2,sse2,sse2_noavx,avx,noavx,noavx,avx")
13412 (eq_attr "alternative" "0,1,2,6,7")
13413 (const_string "sselog")
13414 (const_string "ssemov")))
13415 (set_attr "prefix_rex" "1,1,1,1,*,*,*,*,*,*,*")
13416 (set_attr "prefix_extra" "1,1,1,*,*,*,*,*,*,*,*")
13417 (set_attr "length_immediate" "1,1,1,*,*,*,*,*,*,*,*")
13418 (set_attr "prefix" "orig,orig,vex,maybe_vex,maybe_vex,orig,orig,vex,orig,orig,vex")
13419 (set_attr "mode" "TI,TI,TI,TI,TI,TI,TI,TI,V4SF,V2SF,V2SF")])
13421 (define_expand "vec_unpacks_lo_<mode>"
13422 [(match_operand:<sseunpackmode> 0 "register_operand")
13423 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
13425 "ix86_expand_sse_unpack (operands[0], operands[1], false, false); DONE;")
13427 (define_expand "vec_unpacks_hi_<mode>"
13428 [(match_operand:<sseunpackmode> 0 "register_operand")
13429 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
13431 "ix86_expand_sse_unpack (operands[0], operands[1], false, true); DONE;")
13433 (define_expand "vec_unpacku_lo_<mode>"
13434 [(match_operand:<sseunpackmode> 0 "register_operand")
13435 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
13437 "ix86_expand_sse_unpack (operands[0], operands[1], true, false); DONE;")
13439 (define_expand "vec_unpacks_lo_hi"
13440 [(set (subreg:HI (match_operand:QI 0 "register_operand") 0)
13441 (match_operand:HI 1 "register_operand"))]
13444 (define_expand "vec_unpacks_lo_si"
13445 [(set (match_operand:HI 0 "register_operand")
13446 (subreg:HI (match_operand:SI 1 "register_operand") 0))]
13449 (define_expand "vec_unpacks_lo_di"
13450 [(set (match_operand:SI 0 "register_operand")
13451 (subreg:SI (match_operand:DI 1 "register_operand") 0))]
13454 (define_expand "vec_unpacku_hi_<mode>"
13455 [(match_operand:<sseunpackmode> 0 "register_operand")
13456 (match_operand:VI124_AVX2_24_AVX512F_1_AVX512BW 1 "register_operand")]
13458 "ix86_expand_sse_unpack (operands[0], operands[1], true, true); DONE;")
13460 (define_expand "vec_unpacks_hi_hi"
13461 [(set (subreg:HI (match_operand:QI 0 "register_operand") 0)
13462 (lshiftrt:HI (match_operand:HI 1 "register_operand")
13466 (define_expand "vec_unpacks_hi_<mode>"
13467 [(set (subreg:SWI48x (match_operand:<HALFMASKMODE> 0 "register_operand") 0)
13468 (lshiftrt:SWI48x (match_operand:SWI48x 1 "register_operand")
13472 operands[2] = GEN_INT (GET_MODE_BITSIZE (<HALFMASKMODE>mode));
13475 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
13479 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
13481 (define_expand "<sse2_avx2>_uavg<mode>3<mask_name>"
13482 [(set (match_operand:VI12_AVX2 0 "register_operand")
13483 (truncate:VI12_AVX2
13484 (lshiftrt:<ssedoublemode>
13485 (plus:<ssedoublemode>
13486 (plus:<ssedoublemode>
13487 (zero_extend:<ssedoublemode>
13488 (match_operand:VI12_AVX2 1 "vector_operand"))
13489 (zero_extend:<ssedoublemode>
13490 (match_operand:VI12_AVX2 2 "vector_operand")))
13491 (match_dup <mask_expand_op3>))
13493 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
13496 if (<mask_applied>)
13498 operands[3] = CONST1_RTX(<MODE>mode);
13499 ix86_fixup_binary_operands_no_copy (PLUS, <MODE>mode, operands);
13501 if (<mask_applied>)
13503 operands[5] = operands[3];
13508 (define_insn "*<sse2_avx2>_uavg<mode>3<mask_name>"
13509 [(set (match_operand:VI12_AVX2 0 "register_operand" "=x,v")
13510 (truncate:VI12_AVX2
13511 (lshiftrt:<ssedoublemode>
13512 (plus:<ssedoublemode>
13513 (plus:<ssedoublemode>
13514 (zero_extend:<ssedoublemode>
13515 (match_operand:VI12_AVX2 1 "vector_operand" "%0,v"))
13516 (zero_extend:<ssedoublemode>
13517 (match_operand:VI12_AVX2 2 "vector_operand" "xBm,vm")))
13518 (match_operand:VI12_AVX2 <mask_expand_op3> "const1_operand"))
13520 "TARGET_SSE2 && <mask_mode512bit_condition> && <mask_avx512bw_condition>
13521 && ix86_binary_operator_ok (PLUS, <MODE>mode, operands)"
13523 pavg<ssemodesuffix>\t{%2, %0|%0, %2}
13524 vpavg<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
13525 [(set_attr "isa" "noavx,avx")
13526 (set_attr "type" "sseiadd")
13527 (set_attr "prefix_data16" "1,*")
13528 (set_attr "prefix" "orig,<mask_prefix>")
13529 (set_attr "mode" "<sseinsnmode>")])
13531 ;; The correct representation for this is absolutely enormous, and
13532 ;; surely not generally useful.
13533 (define_insn "<sse2_avx2>_psadbw"
13534 [(set (match_operand:VI8_AVX2_AVX512BW 0 "register_operand" "=x,v")
13535 (unspec:VI8_AVX2_AVX512BW
13536 [(match_operand:<ssebytemode> 1 "register_operand" "0,v")
13537 (match_operand:<ssebytemode> 2 "vector_operand" "xBm,vm")]
13541 psadbw\t{%2, %0|%0, %2}
13542 vpsadbw\t{%2, %1, %0|%0, %1, %2}"
13543 [(set_attr "isa" "noavx,avx")
13544 (set_attr "type" "sseiadd")
13545 (set_attr "atom_unit" "simul")
13546 (set_attr "prefix_data16" "1,*")
13547 (set_attr "prefix" "orig,maybe_evex")
13548 (set_attr "mode" "<sseinsnmode>")])
13550 (define_insn "<sse>_movmsk<ssemodesuffix><avxsizesuffix>"
13551 [(set (match_operand:SI 0 "register_operand" "=r")
13553 [(match_operand:VF_128_256 1 "register_operand" "x")]
13556 "%vmovmsk<ssemodesuffix>\t{%1, %0|%0, %1}"
13557 [(set_attr "type" "ssemov")
13558 (set_attr "prefix" "maybe_vex")
13559 (set_attr "mode" "<MODE>")])
13561 (define_insn "*<sse>_movmsk<ssemodesuffix><avxsizesuffix>_zext"
13562 [(set (match_operand:DI 0 "register_operand" "=r")
13565 [(match_operand:VF_128_256 1 "register_operand" "x")]
13567 "TARGET_64BIT && TARGET_SSE"
13568 "%vmovmsk<ssemodesuffix>\t{%1, %k0|%k0, %1}"
13569 [(set_attr "type" "ssemov")
13570 (set_attr "prefix" "maybe_vex")
13571 (set_attr "mode" "<MODE>")])
13573 (define_insn "<sse2_avx2>_pmovmskb"
13574 [(set (match_operand:SI 0 "register_operand" "=r")
13576 [(match_operand:VI1_AVX2 1 "register_operand" "x")]
13579 "%vpmovmskb\t{%1, %0|%0, %1}"
13580 [(set_attr "type" "ssemov")
13581 (set (attr "prefix_data16")
13583 (match_test "TARGET_AVX")
13585 (const_string "1")))
13586 (set_attr "prefix" "maybe_vex")
13587 (set_attr "mode" "SI")])
13589 (define_insn "*<sse2_avx2>_pmovmskb_zext"
13590 [(set (match_operand:DI 0 "register_operand" "=r")
13593 [(match_operand:VI1_AVX2 1 "register_operand" "x")]
13595 "TARGET_64BIT && TARGET_SSE2"
13596 "%vpmovmskb\t{%1, %k0|%k0, %1}"
13597 [(set_attr "type" "ssemov")
13598 (set (attr "prefix_data16")
13600 (match_test "TARGET_AVX")
13602 (const_string "1")))
13603 (set_attr "prefix" "maybe_vex")
13604 (set_attr "mode" "SI")])
13606 (define_expand "sse2_maskmovdqu"
13607 [(set (match_operand:V16QI 0 "memory_operand")
13608 (unspec:V16QI [(match_operand:V16QI 1 "register_operand")
13609 (match_operand:V16QI 2 "register_operand")
13614 (define_insn "*sse2_maskmovdqu"
13615 [(set (mem:V16QI (match_operand:P 0 "register_operand" "D"))
13616 (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "x")
13617 (match_operand:V16QI 2 "register_operand" "x")
13618 (mem:V16QI (match_dup 0))]
13622 /* We can't use %^ here due to ASM_OUTPUT_OPCODE processing
13623 that requires %v to be at the beginning of the opcode name. */
13624 if (Pmode != word_mode)
13625 fputs ("\taddr32", asm_out_file);
13626 return "%vmaskmovdqu\t{%2, %1|%1, %2}";
13628 [(set_attr "type" "ssemov")
13629 (set_attr "prefix_data16" "1")
13630 (set (attr "length_address")
13631 (symbol_ref ("Pmode != word_mode")))
13632 ;; The implicit %rdi operand confuses default length_vex computation.
13633 (set (attr "length_vex")
13634 (symbol_ref ("3 + REX_SSE_REGNO_P (REGNO (operands[2]))")))
13635 (set_attr "prefix" "maybe_vex")
13636 (set_attr "znver1_decode" "vector")
13637 (set_attr "mode" "TI")])
13639 (define_insn "sse_ldmxcsr"
13640 [(unspec_volatile [(match_operand:SI 0 "memory_operand" "m")]
13644 [(set_attr "type" "sse")
13645 (set_attr "atom_sse_attr" "mxcsr")
13646 (set_attr "prefix" "maybe_vex")
13647 (set_attr "memory" "load")])
13649 (define_insn "sse_stmxcsr"
13650 [(set (match_operand:SI 0 "memory_operand" "=m")
13651 (unspec_volatile:SI [(const_int 0)] UNSPECV_STMXCSR))]
13654 [(set_attr "type" "sse")
13655 (set_attr "atom_sse_attr" "mxcsr")
13656 (set_attr "prefix" "maybe_vex")
13657 (set_attr "memory" "store")])
13659 (define_insn "sse2_clflush"
13660 [(unspec_volatile [(match_operand 0 "address_operand" "p")]
13664 [(set_attr "type" "sse")
13665 (set_attr "atom_sse_attr" "fence")
13666 (set_attr "memory" "unknown")])
13668 ;; As per AMD and Intel ISA manuals, the first operand is extensions
13669 ;; and it goes to %ecx. The second operand received is hints and it goes
13671 (define_insn "sse3_mwait"
13672 [(unspec_volatile [(match_operand:SI 0 "register_operand" "c")
13673 (match_operand:SI 1 "register_operand" "a")]
13676 ;; 64bit version is "mwait %rax,%rcx". But only lower 32bits are used.
13677 ;; Since 32bit register operands are implicitly zero extended to 64bit,
13678 ;; we only need to set up 32bit registers.
13680 [(set_attr "length" "3")])
13682 (define_insn "sse3_monitor_<mode>"
13683 [(unspec_volatile [(match_operand:P 0 "register_operand" "a")
13684 (match_operand:SI 1 "register_operand" "c")
13685 (match_operand:SI 2 "register_operand" "d")]
13688 ;; 64bit version is "monitor %rax,%rcx,%rdx". But only lower 32bits in
13689 ;; RCX and RDX are used. Since 32bit register operands are implicitly
13690 ;; zero extended to 64bit, we only need to set up 32bit registers.
13692 [(set (attr "length")
13693 (symbol_ref ("(Pmode != word_mode) + 3")))])
13695 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
13697 ;; SSSE3 instructions
13699 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
13701 (define_code_iterator ssse3_plusminus [plus ss_plus minus ss_minus])
13703 (define_insn "avx2_ph<plusminus_mnemonic>wv16hi3"
13704 [(set (match_operand:V16HI 0 "register_operand" "=x")
13709 (ssse3_plusminus:HI
13711 (match_operand:V16HI 1 "register_operand" "x")
13712 (parallel [(const_int 0)]))
13713 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
13714 (ssse3_plusminus:HI
13715 (vec_select:HI (match_dup 1) (parallel [(const_int 2)]))
13716 (vec_select:HI (match_dup 1) (parallel [(const_int 3)]))))
13718 (ssse3_plusminus:HI
13719 (vec_select:HI (match_dup 1) (parallel [(const_int 4)]))
13720 (vec_select:HI (match_dup 1) (parallel [(const_int 5)])))
13721 (ssse3_plusminus:HI
13722 (vec_select:HI (match_dup 1) (parallel [(const_int 6)]))
13723 (vec_select:HI (match_dup 1) (parallel [(const_int 7)])))))
13726 (ssse3_plusminus:HI
13727 (vec_select:HI (match_dup 1) (parallel [(const_int 8)]))
13728 (vec_select:HI (match_dup 1) (parallel [(const_int 9)])))
13729 (ssse3_plusminus:HI
13730 (vec_select:HI (match_dup 1) (parallel [(const_int 10)]))
13731 (vec_select:HI (match_dup 1) (parallel [(const_int 11)]))))
13733 (ssse3_plusminus:HI
13734 (vec_select:HI (match_dup 1) (parallel [(const_int 12)]))
13735 (vec_select:HI (match_dup 1) (parallel [(const_int 13)])))
13736 (ssse3_plusminus:HI
13737 (vec_select:HI (match_dup 1) (parallel [(const_int 14)]))
13738 (vec_select:HI (match_dup 1) (parallel [(const_int 15)]))))))
13742 (ssse3_plusminus:HI
13744 (match_operand:V16HI 2 "nonimmediate_operand" "xm")
13745 (parallel [(const_int 0)]))
13746 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))
13747 (ssse3_plusminus:HI
13748 (vec_select:HI (match_dup 2) (parallel [(const_int 2)]))
13749 (vec_select:HI (match_dup 2) (parallel [(const_int 3)]))))
13751 (ssse3_plusminus:HI
13752 (vec_select:HI (match_dup 2) (parallel [(const_int 4)]))
13753 (vec_select:HI (match_dup 2) (parallel [(const_int 5)])))
13754 (ssse3_plusminus:HI
13755 (vec_select:HI (match_dup 2) (parallel [(const_int 6)]))
13756 (vec_select:HI (match_dup 2) (parallel [(const_int 7)])))))
13759 (ssse3_plusminus:HI
13760 (vec_select:HI (match_dup 2) (parallel [(const_int 8)]))
13761 (vec_select:HI (match_dup 2) (parallel [(const_int 9)])))
13762 (ssse3_plusminus:HI
13763 (vec_select:HI (match_dup 2) (parallel [(const_int 10)]))
13764 (vec_select:HI (match_dup 2) (parallel [(const_int 11)]))))
13766 (ssse3_plusminus:HI
13767 (vec_select:HI (match_dup 2) (parallel [(const_int 12)]))
13768 (vec_select:HI (match_dup 2) (parallel [(const_int 13)])))
13769 (ssse3_plusminus:HI
13770 (vec_select:HI (match_dup 2) (parallel [(const_int 14)]))
13771 (vec_select:HI (match_dup 2) (parallel [(const_int 15)]))))))))]
13773 "vph<plusminus_mnemonic>w\t{%2, %1, %0|%0, %1, %2}"
13774 [(set_attr "type" "sseiadd")
13775 (set_attr "prefix_extra" "1")
13776 (set_attr "prefix" "vex")
13777 (set_attr "mode" "OI")])
13779 (define_insn "ssse3_ph<plusminus_mnemonic>wv8hi3"
13780 [(set (match_operand:V8HI 0 "register_operand" "=x,x")
13784 (ssse3_plusminus:HI
13786 (match_operand:V8HI 1 "register_operand" "0,x")
13787 (parallel [(const_int 0)]))
13788 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
13789 (ssse3_plusminus:HI
13790 (vec_select:HI (match_dup 1) (parallel [(const_int 2)]))
13791 (vec_select:HI (match_dup 1) (parallel [(const_int 3)]))))
13793 (ssse3_plusminus:HI
13794 (vec_select:HI (match_dup 1) (parallel [(const_int 4)]))
13795 (vec_select:HI (match_dup 1) (parallel [(const_int 5)])))
13796 (ssse3_plusminus:HI
13797 (vec_select:HI (match_dup 1) (parallel [(const_int 6)]))
13798 (vec_select:HI (match_dup 1) (parallel [(const_int 7)])))))
13801 (ssse3_plusminus:HI
13803 (match_operand:V8HI 2 "vector_operand" "xBm,xm")
13804 (parallel [(const_int 0)]))
13805 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))
13806 (ssse3_plusminus:HI
13807 (vec_select:HI (match_dup 2) (parallel [(const_int 2)]))
13808 (vec_select:HI (match_dup 2) (parallel [(const_int 3)]))))
13810 (ssse3_plusminus:HI
13811 (vec_select:HI (match_dup 2) (parallel [(const_int 4)]))
13812 (vec_select:HI (match_dup 2) (parallel [(const_int 5)])))
13813 (ssse3_plusminus:HI
13814 (vec_select:HI (match_dup 2) (parallel [(const_int 6)]))
13815 (vec_select:HI (match_dup 2) (parallel [(const_int 7)])))))))]
13818 ph<plusminus_mnemonic>w\t{%2, %0|%0, %2}
13819 vph<plusminus_mnemonic>w\t{%2, %1, %0|%0, %1, %2}"
13820 [(set_attr "isa" "noavx,avx")
13821 (set_attr "type" "sseiadd")
13822 (set_attr "atom_unit" "complex")
13823 (set_attr "prefix_data16" "1,*")
13824 (set_attr "prefix_extra" "1")
13825 (set_attr "prefix" "orig,vex")
13826 (set_attr "mode" "TI")])
13828 (define_insn "ssse3_ph<plusminus_mnemonic>wv4hi3"
13829 [(set (match_operand:V4HI 0 "register_operand" "=y")
13832 (ssse3_plusminus:HI
13834 (match_operand:V4HI 1 "register_operand" "0")
13835 (parallel [(const_int 0)]))
13836 (vec_select:HI (match_dup 1) (parallel [(const_int 1)])))
13837 (ssse3_plusminus:HI
13838 (vec_select:HI (match_dup 1) (parallel [(const_int 2)]))
13839 (vec_select:HI (match_dup 1) (parallel [(const_int 3)]))))
13841 (ssse3_plusminus:HI
13843 (match_operand:V4HI 2 "nonimmediate_operand" "ym")
13844 (parallel [(const_int 0)]))
13845 (vec_select:HI (match_dup 2) (parallel [(const_int 1)])))
13846 (ssse3_plusminus:HI
13847 (vec_select:HI (match_dup 2) (parallel [(const_int 2)]))
13848 (vec_select:HI (match_dup 2) (parallel [(const_int 3)]))))))]
13850 "ph<plusminus_mnemonic>w\t{%2, %0|%0, %2}"
13851 [(set_attr "type" "sseiadd")
13852 (set_attr "atom_unit" "complex")
13853 (set_attr "prefix_extra" "1")
13854 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
13855 (set_attr "mode" "DI")])
13857 (define_insn "avx2_ph<plusminus_mnemonic>dv8si3"
13858 [(set (match_operand:V8SI 0 "register_operand" "=x")
13864 (match_operand:V8SI 1 "register_operand" "x")
13865 (parallel [(const_int 0)]))
13866 (vec_select:SI (match_dup 1) (parallel [(const_int 1)])))
13868 (vec_select:SI (match_dup 1) (parallel [(const_int 2)]))
13869 (vec_select:SI (match_dup 1) (parallel [(const_int 3)]))))
13872 (vec_select:SI (match_dup 1) (parallel [(const_int 4)]))
13873 (vec_select:SI (match_dup 1) (parallel [(const_int 5)])))
13875 (vec_select:SI (match_dup 1) (parallel [(const_int 6)]))
13876 (vec_select:SI (match_dup 1) (parallel [(const_int 7)])))))
13881 (match_operand:V8SI 2 "nonimmediate_operand" "xm")
13882 (parallel [(const_int 0)]))
13883 (vec_select:SI (match_dup 2) (parallel [(const_int 1)])))
13885 (vec_select:SI (match_dup 2) (parallel [(const_int 2)]))
13886 (vec_select:SI (match_dup 2) (parallel [(const_int 3)]))))
13889 (vec_select:SI (match_dup 2) (parallel [(const_int 4)]))
13890 (vec_select:SI (match_dup 2) (parallel [(const_int 5)])))
13892 (vec_select:SI (match_dup 2) (parallel [(const_int 6)]))
13893 (vec_select:SI (match_dup 2) (parallel [(const_int 7)])))))))]
13895 "vph<plusminus_mnemonic>d\t{%2, %1, %0|%0, %1, %2}"
13896 [(set_attr "type" "sseiadd")
13897 (set_attr "prefix_extra" "1")
13898 (set_attr "prefix" "vex")
13899 (set_attr "mode" "OI")])
13901 (define_insn "ssse3_ph<plusminus_mnemonic>dv4si3"
13902 [(set (match_operand:V4SI 0 "register_operand" "=x,x")
13907 (match_operand:V4SI 1 "register_operand" "0,x")
13908 (parallel [(const_int 0)]))
13909 (vec_select:SI (match_dup 1) (parallel [(const_int 1)])))
13911 (vec_select:SI (match_dup 1) (parallel [(const_int 2)]))
13912 (vec_select:SI (match_dup 1) (parallel [(const_int 3)]))))
13916 (match_operand:V4SI 2 "vector_operand" "xBm,xm")
13917 (parallel [(const_int 0)]))
13918 (vec_select:SI (match_dup 2) (parallel [(const_int 1)])))
13920 (vec_select:SI (match_dup 2) (parallel [(const_int 2)]))
13921 (vec_select:SI (match_dup 2) (parallel [(const_int 3)]))))))]
13924 ph<plusminus_mnemonic>d\t{%2, %0|%0, %2}
13925 vph<plusminus_mnemonic>d\t{%2, %1, %0|%0, %1, %2}"
13926 [(set_attr "isa" "noavx,avx")
13927 (set_attr "type" "sseiadd")
13928 (set_attr "atom_unit" "complex")
13929 (set_attr "prefix_data16" "1,*")
13930 (set_attr "prefix_extra" "1")
13931 (set_attr "prefix" "orig,vex")
13932 (set_attr "mode" "TI")])
13934 (define_insn "ssse3_ph<plusminus_mnemonic>dv2si3"
13935 [(set (match_operand:V2SI 0 "register_operand" "=y")
13939 (match_operand:V2SI 1 "register_operand" "0")
13940 (parallel [(const_int 0)]))
13941 (vec_select:SI (match_dup 1) (parallel [(const_int 1)])))
13944 (match_operand:V2SI 2 "nonimmediate_operand" "ym")
13945 (parallel [(const_int 0)]))
13946 (vec_select:SI (match_dup 2) (parallel [(const_int 1)])))))]
13948 "ph<plusminus_mnemonic>d\t{%2, %0|%0, %2}"
13949 [(set_attr "type" "sseiadd")
13950 (set_attr "atom_unit" "complex")
13951 (set_attr "prefix_extra" "1")
13952 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
13953 (set_attr "mode" "DI")])
13955 (define_insn "avx2_pmaddubsw256"
13956 [(set (match_operand:V16HI 0 "register_operand" "=x,v")
13961 (match_operand:V32QI 1 "register_operand" "x,v")
13962 (parallel [(const_int 0) (const_int 2)
13963 (const_int 4) (const_int 6)
13964 (const_int 8) (const_int 10)
13965 (const_int 12) (const_int 14)
13966 (const_int 16) (const_int 18)
13967 (const_int 20) (const_int 22)
13968 (const_int 24) (const_int 26)
13969 (const_int 28) (const_int 30)])))
13972 (match_operand:V32QI 2 "nonimmediate_operand" "xm,vm")
13973 (parallel [(const_int 0) (const_int 2)
13974 (const_int 4) (const_int 6)
13975 (const_int 8) (const_int 10)
13976 (const_int 12) (const_int 14)
13977 (const_int 16) (const_int 18)
13978 (const_int 20) (const_int 22)
13979 (const_int 24) (const_int 26)
13980 (const_int 28) (const_int 30)]))))
13983 (vec_select:V16QI (match_dup 1)
13984 (parallel [(const_int 1) (const_int 3)
13985 (const_int 5) (const_int 7)
13986 (const_int 9) (const_int 11)
13987 (const_int 13) (const_int 15)
13988 (const_int 17) (const_int 19)
13989 (const_int 21) (const_int 23)
13990 (const_int 25) (const_int 27)
13991 (const_int 29) (const_int 31)])))
13993 (vec_select:V16QI (match_dup 2)
13994 (parallel [(const_int 1) (const_int 3)
13995 (const_int 5) (const_int 7)
13996 (const_int 9) (const_int 11)
13997 (const_int 13) (const_int 15)
13998 (const_int 17) (const_int 19)
13999 (const_int 21) (const_int 23)
14000 (const_int 25) (const_int 27)
14001 (const_int 29) (const_int 31)]))))))]
14003 "vpmaddubsw\t{%2, %1, %0|%0, %1, %2}"
14004 [(set_attr "isa" "*,avx512bw")
14005 (set_attr "type" "sseiadd")
14006 (set_attr "prefix_extra" "1")
14007 (set_attr "prefix" "vex,evex")
14008 (set_attr "mode" "OI")])
14010 ;; The correct representation for this is absolutely enormous, and
14011 ;; surely not generally useful.
14012 (define_insn "avx512bw_pmaddubsw512<mode><mask_name>"
14013 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
14014 (unspec:VI2_AVX512VL
14015 [(match_operand:<dbpsadbwmode> 1 "register_operand" "v")
14016 (match_operand:<dbpsadbwmode> 2 "nonimmediate_operand" "vm")]
14017 UNSPEC_PMADDUBSW512))]
14019 "vpmaddubsw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}";
14020 [(set_attr "type" "sseiadd")
14021 (set_attr "prefix" "evex")
14022 (set_attr "mode" "XI")])
14024 (define_insn "avx512bw_umulhrswv32hi3<mask_name>"
14025 [(set (match_operand:V32HI 0 "register_operand" "=v")
14032 (match_operand:V32HI 1 "nonimmediate_operand" "%v"))
14034 (match_operand:V32HI 2 "nonimmediate_operand" "vm")))
14036 (const_vector:V32HI [(const_int 1) (const_int 1)
14037 (const_int 1) (const_int 1)
14038 (const_int 1) (const_int 1)
14039 (const_int 1) (const_int 1)
14040 (const_int 1) (const_int 1)
14041 (const_int 1) (const_int 1)
14042 (const_int 1) (const_int 1)
14043 (const_int 1) (const_int 1)
14044 (const_int 1) (const_int 1)
14045 (const_int 1) (const_int 1)
14046 (const_int 1) (const_int 1)
14047 (const_int 1) (const_int 1)
14048 (const_int 1) (const_int 1)
14049 (const_int 1) (const_int 1)
14050 (const_int 1) (const_int 1)
14051 (const_int 1) (const_int 1)]))
14054 "vpmulhrsw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
14055 [(set_attr "type" "sseimul")
14056 (set_attr "prefix" "evex")
14057 (set_attr "mode" "XI")])
14059 (define_insn "ssse3_pmaddubsw128"
14060 [(set (match_operand:V8HI 0 "register_operand" "=x,x,v")
14065 (match_operand:V16QI 1 "register_operand" "0,x,v")
14066 (parallel [(const_int 0) (const_int 2)
14067 (const_int 4) (const_int 6)
14068 (const_int 8) (const_int 10)
14069 (const_int 12) (const_int 14)])))
14072 (match_operand:V16QI 2 "vector_operand" "xBm,xm,vm")
14073 (parallel [(const_int 0) (const_int 2)
14074 (const_int 4) (const_int 6)
14075 (const_int 8) (const_int 10)
14076 (const_int 12) (const_int 14)]))))
14079 (vec_select:V8QI (match_dup 1)
14080 (parallel [(const_int 1) (const_int 3)
14081 (const_int 5) (const_int 7)
14082 (const_int 9) (const_int 11)
14083 (const_int 13) (const_int 15)])))
14085 (vec_select:V8QI (match_dup 2)
14086 (parallel [(const_int 1) (const_int 3)
14087 (const_int 5) (const_int 7)
14088 (const_int 9) (const_int 11)
14089 (const_int 13) (const_int 15)]))))))]
14092 pmaddubsw\t{%2, %0|%0, %2}
14093 vpmaddubsw\t{%2, %1, %0|%0, %1, %2}
14094 vpmaddubsw\t{%2, %1, %0|%0, %1, %2}"
14095 [(set_attr "isa" "noavx,avx,avx512bw")
14096 (set_attr "type" "sseiadd")
14097 (set_attr "atom_unit" "simul")
14098 (set_attr "prefix_data16" "1,*,*")
14099 (set_attr "prefix_extra" "1")
14100 (set_attr "prefix" "orig,vex,evex")
14101 (set_attr "mode" "TI")])
14103 (define_insn "ssse3_pmaddubsw"
14104 [(set (match_operand:V4HI 0 "register_operand" "=y")
14109 (match_operand:V8QI 1 "register_operand" "0")
14110 (parallel [(const_int 0) (const_int 2)
14111 (const_int 4) (const_int 6)])))
14114 (match_operand:V8QI 2 "nonimmediate_operand" "ym")
14115 (parallel [(const_int 0) (const_int 2)
14116 (const_int 4) (const_int 6)]))))
14119 (vec_select:V4QI (match_dup 1)
14120 (parallel [(const_int 1) (const_int 3)
14121 (const_int 5) (const_int 7)])))
14123 (vec_select:V4QI (match_dup 2)
14124 (parallel [(const_int 1) (const_int 3)
14125 (const_int 5) (const_int 7)]))))))]
14127 "pmaddubsw\t{%2, %0|%0, %2}"
14128 [(set_attr "type" "sseiadd")
14129 (set_attr "atom_unit" "simul")
14130 (set_attr "prefix_extra" "1")
14131 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14132 (set_attr "mode" "DI")])
14134 (define_mode_iterator PMULHRSW
14135 [V4HI V8HI (V16HI "TARGET_AVX2")])
14137 (define_expand "<ssse3_avx2>_pmulhrsw<mode>3_mask"
14138 [(set (match_operand:PMULHRSW 0 "register_operand")
14139 (vec_merge:PMULHRSW
14141 (lshiftrt:<ssedoublemode>
14142 (plus:<ssedoublemode>
14143 (lshiftrt:<ssedoublemode>
14144 (mult:<ssedoublemode>
14145 (sign_extend:<ssedoublemode>
14146 (match_operand:PMULHRSW 1 "nonimmediate_operand"))
14147 (sign_extend:<ssedoublemode>
14148 (match_operand:PMULHRSW 2 "nonimmediate_operand")))
14152 (match_operand:PMULHRSW 3 "register_operand")
14153 (match_operand:<avx512fmaskmode> 4 "register_operand")))]
14154 "TARGET_AVX512BW && TARGET_AVX512VL"
14156 operands[5] = CONST1_RTX(<MODE>mode);
14157 ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);
14160 (define_expand "<ssse3_avx2>_pmulhrsw<mode>3"
14161 [(set (match_operand:PMULHRSW 0 "register_operand")
14163 (lshiftrt:<ssedoublemode>
14164 (plus:<ssedoublemode>
14165 (lshiftrt:<ssedoublemode>
14166 (mult:<ssedoublemode>
14167 (sign_extend:<ssedoublemode>
14168 (match_operand:PMULHRSW 1 "nonimmediate_operand"))
14169 (sign_extend:<ssedoublemode>
14170 (match_operand:PMULHRSW 2 "nonimmediate_operand")))
14176 operands[3] = CONST1_RTX(<MODE>mode);
14177 ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);
14180 (define_insn "*<ssse3_avx2>_pmulhrsw<mode>3<mask_name>"
14181 [(set (match_operand:VI2_AVX2 0 "register_operand" "=x,x,v")
14183 (lshiftrt:<ssedoublemode>
14184 (plus:<ssedoublemode>
14185 (lshiftrt:<ssedoublemode>
14186 (mult:<ssedoublemode>
14187 (sign_extend:<ssedoublemode>
14188 (match_operand:VI2_AVX2 1 "vector_operand" "%0,x,v"))
14189 (sign_extend:<ssedoublemode>
14190 (match_operand:VI2_AVX2 2 "vector_operand" "xBm,xm,vm")))
14192 (match_operand:VI2_AVX2 3 "const1_operand"))
14194 "TARGET_SSSE3 && <mask_mode512bit_condition> && <mask_avx512bw_condition>
14195 && ix86_binary_operator_ok (MULT, <MODE>mode, operands)"
14197 pmulhrsw\t{%2, %0|%0, %2}
14198 vpmulhrsw\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}
14199 vpmulhrsw\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}"
14200 [(set_attr "isa" "noavx,avx,avx512bw")
14201 (set_attr "type" "sseimul")
14202 (set_attr "prefix_data16" "1,*,*")
14203 (set_attr "prefix_extra" "1")
14204 (set_attr "prefix" "orig,maybe_evex,evex")
14205 (set_attr "mode" "<sseinsnmode>")])
14207 (define_insn "*ssse3_pmulhrswv4hi3"
14208 [(set (match_operand:V4HI 0 "register_operand" "=y")
14215 (match_operand:V4HI 1 "nonimmediate_operand" "%0"))
14217 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))
14219 (match_operand:V4HI 3 "const1_operand"))
14221 "TARGET_SSSE3 && ix86_binary_operator_ok (MULT, V4HImode, operands)"
14222 "pmulhrsw\t{%2, %0|%0, %2}"
14223 [(set_attr "type" "sseimul")
14224 (set_attr "prefix_extra" "1")
14225 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14226 (set_attr "mode" "DI")])
14228 (define_insn "<ssse3_avx2>_pshufb<mode>3<mask_name>"
14229 [(set (match_operand:VI1_AVX512 0 "register_operand" "=x,x,v")
14231 [(match_operand:VI1_AVX512 1 "register_operand" "0,x,v")
14232 (match_operand:VI1_AVX512 2 "vector_operand" "xBm,xm,vm")]
14234 "TARGET_SSSE3 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
14236 pshufb\t{%2, %0|%0, %2}
14237 vpshufb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
14238 vpshufb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
14239 [(set_attr "isa" "noavx,avx,avx512bw")
14240 (set_attr "type" "sselog1")
14241 (set_attr "prefix_data16" "1,*,*")
14242 (set_attr "prefix_extra" "1")
14243 (set_attr "prefix" "orig,maybe_evex,evex")
14244 (set_attr "btver2_decode" "vector")
14245 (set_attr "mode" "<sseinsnmode>")])
14247 (define_insn "ssse3_pshufbv8qi3"
14248 [(set (match_operand:V8QI 0 "register_operand" "=y")
14249 (unspec:V8QI [(match_operand:V8QI 1 "register_operand" "0")
14250 (match_operand:V8QI 2 "nonimmediate_operand" "ym")]
14253 "pshufb\t{%2, %0|%0, %2}";
14254 [(set_attr "type" "sselog1")
14255 (set_attr "prefix_extra" "1")
14256 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14257 (set_attr "mode" "DI")])
14259 (define_insn "<ssse3_avx2>_psign<mode>3"
14260 [(set (match_operand:VI124_AVX2 0 "register_operand" "=x,x")
14262 [(match_operand:VI124_AVX2 1 "register_operand" "0,x")
14263 (match_operand:VI124_AVX2 2 "vector_operand" "xBm,xm")]
14267 psign<ssemodesuffix>\t{%2, %0|%0, %2}
14268 vpsign<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
14269 [(set_attr "isa" "noavx,avx")
14270 (set_attr "type" "sselog1")
14271 (set_attr "prefix_data16" "1,*")
14272 (set_attr "prefix_extra" "1")
14273 (set_attr "prefix" "orig,vex")
14274 (set_attr "mode" "<sseinsnmode>")])
14276 (define_insn "ssse3_psign<mode>3"
14277 [(set (match_operand:MMXMODEI 0 "register_operand" "=y")
14279 [(match_operand:MMXMODEI 1 "register_operand" "0")
14280 (match_operand:MMXMODEI 2 "nonimmediate_operand" "ym")]
14283 "psign<mmxvecsize>\t{%2, %0|%0, %2}";
14284 [(set_attr "type" "sselog1")
14285 (set_attr "prefix_extra" "1")
14286 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14287 (set_attr "mode" "DI")])
14289 (define_insn "<ssse3_avx2>_palignr<mode>_mask"
14290 [(set (match_operand:VI1_AVX512 0 "register_operand" "=v")
14291 (vec_merge:VI1_AVX512
14293 [(match_operand:VI1_AVX512 1 "register_operand" "v")
14294 (match_operand:VI1_AVX512 2 "nonimmediate_operand" "vm")
14295 (match_operand:SI 3 "const_0_to_255_mul_8_operand" "n")]
14297 (match_operand:VI1_AVX512 4 "vector_move_operand" "0C")
14298 (match_operand:<avx512fmaskmode> 5 "register_operand" "Yk")))]
14299 "TARGET_AVX512BW && (<MODE_SIZE> == 64 || TARGET_AVX512VL)"
14301 operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
14302 return "vpalignr\t{%3, %2, %1, %0%{%5%}%N4|%0%{%5%}%N4, %1, %2, %3}";
14304 [(set_attr "type" "sseishft")
14305 (set_attr "atom_unit" "sishuf")
14306 (set_attr "prefix_extra" "1")
14307 (set_attr "length_immediate" "1")
14308 (set_attr "prefix" "evex")
14309 (set_attr "mode" "<sseinsnmode>")])
14311 (define_insn "<ssse3_avx2>_palignr<mode>"
14312 [(set (match_operand:SSESCALARMODE 0 "register_operand" "=x,x,v")
14313 (unspec:SSESCALARMODE
14314 [(match_operand:SSESCALARMODE 1 "register_operand" "0,x,v")
14315 (match_operand:SSESCALARMODE 2 "vector_operand" "xBm,xm,vm")
14316 (match_operand:SI 3 "const_0_to_255_mul_8_operand" "n,n,n")]
14320 operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
14322 switch (which_alternative)
14325 return "palignr\t{%3, %2, %0|%0, %2, %3}";
14328 return "vpalignr\t{%3, %2, %1, %0|%0, %1, %2, %3}";
14330 gcc_unreachable ();
14333 [(set_attr "isa" "noavx,avx,avx512bw")
14334 (set_attr "type" "sseishft")
14335 (set_attr "atom_unit" "sishuf")
14336 (set_attr "prefix_data16" "1,*,*")
14337 (set_attr "prefix_extra" "1")
14338 (set_attr "length_immediate" "1")
14339 (set_attr "prefix" "orig,vex,evex")
14340 (set_attr "mode" "<sseinsnmode>")])
14342 (define_insn "ssse3_palignrdi"
14343 [(set (match_operand:DI 0 "register_operand" "=y")
14344 (unspec:DI [(match_operand:DI 1 "register_operand" "0")
14345 (match_operand:DI 2 "nonimmediate_operand" "ym")
14346 (match_operand:SI 3 "const_0_to_255_mul_8_operand" "n")]
14350 operands[3] = GEN_INT (INTVAL (operands[3]) / 8);
14351 return "palignr\t{%3, %2, %0|%0, %2, %3}";
14353 [(set_attr "type" "sseishft")
14354 (set_attr "atom_unit" "sishuf")
14355 (set_attr "prefix_extra" "1")
14356 (set_attr "length_immediate" "1")
14357 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14358 (set_attr "mode" "DI")])
14360 ;; Mode iterator to handle singularity w/ absence of V2DI and V4DI
14361 ;; modes for abs instruction on pre AVX-512 targets.
14362 (define_mode_iterator VI1248_AVX512VL_AVX512BW
14363 [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX2") V16QI
14364 (V32HI "TARGET_AVX512BW") (V16HI "TARGET_AVX2") V8HI
14365 (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX2") V4SI
14366 (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")])
14368 (define_insn "*abs<mode>2"
14369 [(set (match_operand:VI1248_AVX512VL_AVX512BW 0 "register_operand" "=v")
14370 (abs:VI1248_AVX512VL_AVX512BW
14371 (match_operand:VI1248_AVX512VL_AVX512BW 1 "vector_operand" "vBm")))]
14373 "%vpabs<ssemodesuffix>\t{%1, %0|%0, %1}"
14374 [(set_attr "type" "sselog1")
14375 (set_attr "prefix_data16" "1")
14376 (set_attr "prefix_extra" "1")
14377 (set_attr "prefix" "maybe_vex")
14378 (set_attr "mode" "<sseinsnmode>")])
14380 (define_insn "abs<mode>2_mask"
14381 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
14382 (vec_merge:VI48_AVX512VL
14384 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm"))
14385 (match_operand:VI48_AVX512VL 2 "vector_move_operand" "0C")
14386 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
14388 "vpabs<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
14389 [(set_attr "type" "sselog1")
14390 (set_attr "prefix" "evex")
14391 (set_attr "mode" "<sseinsnmode>")])
14393 (define_insn "abs<mode>2_mask"
14394 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
14395 (vec_merge:VI12_AVX512VL
14397 (match_operand:VI12_AVX512VL 1 "nonimmediate_operand" "vm"))
14398 (match_operand:VI12_AVX512VL 2 "vector_move_operand" "0C")
14399 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")))]
14401 "vpabs<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
14402 [(set_attr "type" "sselog1")
14403 (set_attr "prefix" "evex")
14404 (set_attr "mode" "<sseinsnmode>")])
14406 (define_expand "abs<mode>2"
14407 [(set (match_operand:VI1248_AVX512VL_AVX512BW 0 "register_operand")
14408 (abs:VI1248_AVX512VL_AVX512BW
14409 (match_operand:VI1248_AVX512VL_AVX512BW 1 "vector_operand")))]
14414 ix86_expand_sse2_abs (operands[0], operands[1]);
14419 (define_insn "abs<mode>2"
14420 [(set (match_operand:MMXMODEI 0 "register_operand" "=y")
14422 (match_operand:MMXMODEI 1 "nonimmediate_operand" "ym")))]
14424 "pabs<mmxvecsize>\t{%1, %0|%0, %1}";
14425 [(set_attr "type" "sselog1")
14426 (set_attr "prefix_rep" "0")
14427 (set_attr "prefix_extra" "1")
14428 (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)"))
14429 (set_attr "mode" "DI")])
14431 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14433 ;; AMD SSE4A instructions
14435 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14437 (define_insn "sse4a_movnt<mode>"
14438 [(set (match_operand:MODEF 0 "memory_operand" "=m")
14440 [(match_operand:MODEF 1 "register_operand" "x")]
14443 "movnt<ssemodesuffix>\t{%1, %0|%0, %1}"
14444 [(set_attr "type" "ssemov")
14445 (set_attr "mode" "<MODE>")])
14447 (define_insn "sse4a_vmmovnt<mode>"
14448 [(set (match_operand:<ssescalarmode> 0 "memory_operand" "=m")
14449 (unspec:<ssescalarmode>
14450 [(vec_select:<ssescalarmode>
14451 (match_operand:VF_128 1 "register_operand" "x")
14452 (parallel [(const_int 0)]))]
14455 "movnt<ssescalarmodesuffix>\t{%1, %0|%0, %1}"
14456 [(set_attr "type" "ssemov")
14457 (set_attr "mode" "<ssescalarmode>")])
14459 (define_insn "sse4a_extrqi"
14460 [(set (match_operand:V2DI 0 "register_operand" "=x")
14461 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
14462 (match_operand 2 "const_0_to_255_operand")
14463 (match_operand 3 "const_0_to_255_operand")]
14466 "extrq\t{%3, %2, %0|%0, %2, %3}"
14467 [(set_attr "type" "sse")
14468 (set_attr "prefix_data16" "1")
14469 (set_attr "length_immediate" "2")
14470 (set_attr "mode" "TI")])
14472 (define_insn "sse4a_extrq"
14473 [(set (match_operand:V2DI 0 "register_operand" "=x")
14474 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
14475 (match_operand:V16QI 2 "register_operand" "x")]
14478 "extrq\t{%2, %0|%0, %2}"
14479 [(set_attr "type" "sse")
14480 (set_attr "prefix_data16" "1")
14481 (set_attr "mode" "TI")])
14483 (define_insn "sse4a_insertqi"
14484 [(set (match_operand:V2DI 0 "register_operand" "=x")
14485 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
14486 (match_operand:V2DI 2 "register_operand" "x")
14487 (match_operand 3 "const_0_to_255_operand")
14488 (match_operand 4 "const_0_to_255_operand")]
14491 "insertq\t{%4, %3, %2, %0|%0, %2, %3, %4}"
14492 [(set_attr "type" "sseins")
14493 (set_attr "prefix_data16" "0")
14494 (set_attr "prefix_rep" "1")
14495 (set_attr "length_immediate" "2")
14496 (set_attr "mode" "TI")])
14498 (define_insn "sse4a_insertq"
14499 [(set (match_operand:V2DI 0 "register_operand" "=x")
14500 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0")
14501 (match_operand:V2DI 2 "register_operand" "x")]
14504 "insertq\t{%2, %0|%0, %2}"
14505 [(set_attr "type" "sseins")
14506 (set_attr "prefix_data16" "0")
14507 (set_attr "prefix_rep" "1")
14508 (set_attr "mode" "TI")])
14510 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14512 ;; Intel SSE4.1 instructions
14514 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14516 ;; Mapping of immediate bits for blend instructions
14517 (define_mode_attr blendbits
14518 [(V8SF "255") (V4SF "15") (V4DF "15") (V2DF "3")])
14520 (define_insn "<sse4_1>_blend<ssemodesuffix><avxsizesuffix>"
14521 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
14522 (vec_merge:VF_128_256
14523 (match_operand:VF_128_256 2 "vector_operand" "YrBm,*xBm,xm")
14524 (match_operand:VF_128_256 1 "register_operand" "0,0,x")
14525 (match_operand:SI 3 "const_0_to_<blendbits>_operand")))]
14528 blend<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
14529 blend<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
14530 vblend<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
14531 [(set_attr "isa" "noavx,noavx,avx")
14532 (set_attr "type" "ssemov")
14533 (set_attr "length_immediate" "1")
14534 (set_attr "prefix_data16" "1,1,*")
14535 (set_attr "prefix_extra" "1")
14536 (set_attr "prefix" "orig,orig,vex")
14537 (set_attr "mode" "<MODE>")])
14539 (define_insn "<sse4_1>_blendv<ssemodesuffix><avxsizesuffix>"
14540 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
14542 [(match_operand:VF_128_256 1 "register_operand" "0,0,x")
14543 (match_operand:VF_128_256 2 "vector_operand" "YrBm,*xBm,xm")
14544 (match_operand:VF_128_256 3 "register_operand" "Yz,Yz,x")]
14548 blendv<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
14549 blendv<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
14550 vblendv<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
14551 [(set_attr "isa" "noavx,noavx,avx")
14552 (set_attr "type" "ssemov")
14553 (set_attr "length_immediate" "1")
14554 (set_attr "prefix_data16" "1,1,*")
14555 (set_attr "prefix_extra" "1")
14556 (set_attr "prefix" "orig,orig,vex")
14557 (set_attr "btver2_decode" "vector,vector,vector")
14558 (set_attr "mode" "<MODE>")])
14560 (define_insn "<sse4_1>_dp<ssemodesuffix><avxsizesuffix>"
14561 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
14563 [(match_operand:VF_128_256 1 "vector_operand" "%0,0,x")
14564 (match_operand:VF_128_256 2 "vector_operand" "YrBm,*xBm,xm")
14565 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")]
14569 dp<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
14570 dp<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}
14571 vdp<ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
14572 [(set_attr "isa" "noavx,noavx,avx")
14573 (set_attr "type" "ssemul")
14574 (set_attr "length_immediate" "1")
14575 (set_attr "prefix_data16" "1,1,*")
14576 (set_attr "prefix_extra" "1")
14577 (set_attr "prefix" "orig,orig,vex")
14578 (set_attr "btver2_decode" "vector,vector,vector")
14579 (set_attr "znver1_decode" "vector,vector,vector")
14580 (set_attr "mode" "<MODE>")])
14582 ;; Mode attribute used by `vmovntdqa' pattern
14583 (define_mode_attr vi8_sse4_1_avx2_avx512
14584 [(V2DI "sse4_1") (V4DI "avx2") (V8DI "avx512f")])
14586 (define_insn "<vi8_sse4_1_avx2_avx512>_movntdqa"
14587 [(set (match_operand:VI8_AVX2_AVX512F 0 "register_operand" "=Yr,*x,v")
14588 (unspec:VI8_AVX2_AVX512F [(match_operand:VI8_AVX2_AVX512F 1 "memory_operand" "m,m,m")]
14591 "%vmovntdqa\t{%1, %0|%0, %1}"
14592 [(set_attr "isa" "noavx,noavx,avx")
14593 (set_attr "type" "ssemov")
14594 (set_attr "prefix_extra" "1,1,*")
14595 (set_attr "prefix" "orig,orig,maybe_evex")
14596 (set_attr "mode" "<sseinsnmode>")])
14598 (define_insn "<sse4_1_avx2>_mpsadbw"
14599 [(set (match_operand:VI1_AVX2 0 "register_operand" "=Yr,*x,x")
14601 [(match_operand:VI1_AVX2 1 "register_operand" "0,0,x")
14602 (match_operand:VI1_AVX2 2 "vector_operand" "YrBm,*xBm,xm")
14603 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")]
14607 mpsadbw\t{%3, %2, %0|%0, %2, %3}
14608 mpsadbw\t{%3, %2, %0|%0, %2, %3}
14609 vmpsadbw\t{%3, %2, %1, %0|%0, %1, %2, %3}"
14610 [(set_attr "isa" "noavx,noavx,avx")
14611 (set_attr "type" "sselog1")
14612 (set_attr "length_immediate" "1")
14613 (set_attr "prefix_extra" "1")
14614 (set_attr "prefix" "orig,orig,vex")
14615 (set_attr "btver2_decode" "vector,vector,vector")
14616 (set_attr "znver1_decode" "vector,vector,vector")
14617 (set_attr "mode" "<sseinsnmode>")])
14619 (define_insn "<sse4_1_avx2>_packusdw<mask_name>"
14620 [(set (match_operand:VI2_AVX2 0 "register_operand" "=Yr,*x,x,v")
14621 (vec_concat:VI2_AVX2
14622 (us_truncate:<ssehalfvecmode>
14623 (match_operand:<sseunpackmode> 1 "register_operand" "0,0,x,v"))
14624 (us_truncate:<ssehalfvecmode>
14625 (match_operand:<sseunpackmode> 2 "vector_operand" "YrBm,*xBm,xm,vm"))))]
14626 "TARGET_SSE4_1 && <mask_mode512bit_condition> && <mask_avx512bw_condition>"
14628 packusdw\t{%2, %0|%0, %2}
14629 packusdw\t{%2, %0|%0, %2}
14630 vpackusdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}
14631 vpackusdw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
14632 [(set_attr "isa" "noavx,noavx,avx,avx512bw")
14633 (set_attr "type" "sselog")
14634 (set_attr "prefix_extra" "1")
14635 (set_attr "prefix" "orig,orig,<mask_prefix>,evex")
14636 (set_attr "mode" "<sseinsnmode>")])
14638 (define_insn "<sse4_1_avx2>_pblendvb"
14639 [(set (match_operand:VI1_AVX2 0 "register_operand" "=Yr,*x,x")
14641 [(match_operand:VI1_AVX2 1 "register_operand" "0,0,x")
14642 (match_operand:VI1_AVX2 2 "vector_operand" "YrBm,*xBm,xm")
14643 (match_operand:VI1_AVX2 3 "register_operand" "Yz,Yz,x")]
14647 pblendvb\t{%3, %2, %0|%0, %2, %3}
14648 pblendvb\t{%3, %2, %0|%0, %2, %3}
14649 vpblendvb\t{%3, %2, %1, %0|%0, %1, %2, %3}"
14650 [(set_attr "isa" "noavx,noavx,avx")
14651 (set_attr "type" "ssemov")
14652 (set_attr "prefix_extra" "1")
14653 (set_attr "length_immediate" "*,*,1")
14654 (set_attr "prefix" "orig,orig,vex")
14655 (set_attr "btver2_decode" "vector,vector,vector")
14656 (set_attr "mode" "<sseinsnmode>")])
14658 (define_insn "sse4_1_pblendw"
14659 [(set (match_operand:V8HI 0 "register_operand" "=Yr,*x,x")
14661 (match_operand:V8HI 2 "vector_operand" "YrBm,*xBm,xm")
14662 (match_operand:V8HI 1 "register_operand" "0,0,x")
14663 (match_operand:SI 3 "const_0_to_255_operand" "n,n,n")))]
14666 pblendw\t{%3, %2, %0|%0, %2, %3}
14667 pblendw\t{%3, %2, %0|%0, %2, %3}
14668 vpblendw\t{%3, %2, %1, %0|%0, %1, %2, %3}"
14669 [(set_attr "isa" "noavx,noavx,avx")
14670 (set_attr "type" "ssemov")
14671 (set_attr "prefix_extra" "1")
14672 (set_attr "length_immediate" "1")
14673 (set_attr "prefix" "orig,orig,vex")
14674 (set_attr "mode" "TI")])
14676 ;; The builtin uses an 8-bit immediate. Expand that.
14677 (define_expand "avx2_pblendw"
14678 [(set (match_operand:V16HI 0 "register_operand")
14680 (match_operand:V16HI 2 "nonimmediate_operand")
14681 (match_operand:V16HI 1 "register_operand")
14682 (match_operand:SI 3 "const_0_to_255_operand")))]
14685 HOST_WIDE_INT val = INTVAL (operands[3]) & 0xff;
14686 operands[3] = GEN_INT (val << 8 | val);
14689 (define_insn "*avx2_pblendw"
14690 [(set (match_operand:V16HI 0 "register_operand" "=x")
14692 (match_operand:V16HI 2 "nonimmediate_operand" "xm")
14693 (match_operand:V16HI 1 "register_operand" "x")
14694 (match_operand:SI 3 "avx2_pblendw_operand" "n")))]
14697 operands[3] = GEN_INT (INTVAL (operands[3]) & 0xff);
14698 return "vpblendw\t{%3, %2, %1, %0|%0, %1, %2, %3}";
14700 [(set_attr "type" "ssemov")
14701 (set_attr "prefix_extra" "1")
14702 (set_attr "length_immediate" "1")
14703 (set_attr "prefix" "vex")
14704 (set_attr "mode" "OI")])
14706 (define_insn "avx2_pblendd<mode>"
14707 [(set (match_operand:VI4_AVX2 0 "register_operand" "=x")
14708 (vec_merge:VI4_AVX2
14709 (match_operand:VI4_AVX2 2 "nonimmediate_operand" "xm")
14710 (match_operand:VI4_AVX2 1 "register_operand" "x")
14711 (match_operand:SI 3 "const_0_to_255_operand" "n")))]
14713 "vpblendd\t{%3, %2, %1, %0|%0, %1, %2, %3}"
14714 [(set_attr "type" "ssemov")
14715 (set_attr "prefix_extra" "1")
14716 (set_attr "length_immediate" "1")
14717 (set_attr "prefix" "vex")
14718 (set_attr "mode" "<sseinsnmode>")])
14720 (define_insn "sse4_1_phminposuw"
14721 [(set (match_operand:V8HI 0 "register_operand" "=Yr,*x,x")
14722 (unspec:V8HI [(match_operand:V8HI 1 "vector_operand" "YrBm,*xBm,xm")]
14723 UNSPEC_PHMINPOSUW))]
14725 "%vphminposuw\t{%1, %0|%0, %1}"
14726 [(set_attr "isa" "noavx,noavx,avx")
14727 (set_attr "type" "sselog1")
14728 (set_attr "prefix_extra" "1")
14729 (set_attr "prefix" "orig,orig,vex")
14730 (set_attr "mode" "TI")])
14732 (define_insn "avx2_<code>v16qiv16hi2<mask_name>"
14733 [(set (match_operand:V16HI 0 "register_operand" "=v")
14735 (match_operand:V16QI 1 "nonimmediate_operand" "vm")))]
14736 "TARGET_AVX2 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
14737 "vpmov<extsuffix>bw\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
14738 [(set_attr "type" "ssemov")
14739 (set_attr "prefix_extra" "1")
14740 (set_attr "prefix" "maybe_evex")
14741 (set_attr "mode" "OI")])
14743 (define_insn "avx512bw_<code>v32qiv32hi2<mask_name>"
14744 [(set (match_operand:V32HI 0 "register_operand" "=v")
14746 (match_operand:V32QI 1 "nonimmediate_operand" "vm")))]
14748 "vpmov<extsuffix>bw\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
14749 [(set_attr "type" "ssemov")
14750 (set_attr "prefix_extra" "1")
14751 (set_attr "prefix" "evex")
14752 (set_attr "mode" "XI")])
14754 (define_insn "sse4_1_<code>v8qiv8hi2<mask_name>"
14755 [(set (match_operand:V8HI 0 "register_operand" "=Yr,*x,v")
14758 (match_operand:V16QI 1 "nonimmediate_operand" "Yrm,*xm,vm")
14759 (parallel [(const_int 0) (const_int 1)
14760 (const_int 2) (const_int 3)
14761 (const_int 4) (const_int 5)
14762 (const_int 6) (const_int 7)]))))]
14763 "TARGET_SSE4_1 && <mask_avx512bw_condition> && <mask_avx512vl_condition>"
14764 "%vpmov<extsuffix>bw\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
14765 [(set_attr "isa" "noavx,noavx,avx")
14766 (set_attr "type" "ssemov")
14767 (set_attr "prefix_extra" "1")
14768 (set_attr "prefix" "orig,orig,maybe_evex")
14769 (set_attr "mode" "TI")])
14771 (define_insn "<mask_codefor>avx512f_<code>v16qiv16si2<mask_name>"
14772 [(set (match_operand:V16SI 0 "register_operand" "=v")
14774 (match_operand:V16QI 1 "nonimmediate_operand" "vm")))]
14776 "vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
14777 [(set_attr "type" "ssemov")
14778 (set_attr "prefix" "evex")
14779 (set_attr "mode" "XI")])
14781 (define_insn "avx2_<code>v8qiv8si2<mask_name>"
14782 [(set (match_operand:V8SI 0 "register_operand" "=v")
14785 (match_operand:V16QI 1 "nonimmediate_operand" "vm")
14786 (parallel [(const_int 0) (const_int 1)
14787 (const_int 2) (const_int 3)
14788 (const_int 4) (const_int 5)
14789 (const_int 6) (const_int 7)]))))]
14790 "TARGET_AVX2 && <mask_avx512vl_condition>"
14791 "vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
14792 [(set_attr "type" "ssemov")
14793 (set_attr "prefix_extra" "1")
14794 (set_attr "prefix" "maybe_evex")
14795 (set_attr "mode" "OI")])
14797 (define_insn "sse4_1_<code>v4qiv4si2<mask_name>"
14798 [(set (match_operand:V4SI 0 "register_operand" "=Yr,*x,v")
14801 (match_operand:V16QI 1 "nonimmediate_operand" "Yrm,*xm,vm")
14802 (parallel [(const_int 0) (const_int 1)
14803 (const_int 2) (const_int 3)]))))]
14804 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
14805 "%vpmov<extsuffix>bd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
14806 [(set_attr "isa" "noavx,noavx,avx")
14807 (set_attr "type" "ssemov")
14808 (set_attr "prefix_extra" "1")
14809 (set_attr "prefix" "orig,orig,maybe_evex")
14810 (set_attr "mode" "TI")])
14812 (define_insn "avx512f_<code>v16hiv16si2<mask_name>"
14813 [(set (match_operand:V16SI 0 "register_operand" "=v")
14815 (match_operand:V16HI 1 "nonimmediate_operand" "vm")))]
14817 "vpmov<extsuffix>wd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
14818 [(set_attr "type" "ssemov")
14819 (set_attr "prefix" "evex")
14820 (set_attr "mode" "XI")])
14822 (define_insn "avx2_<code>v8hiv8si2<mask_name>"
14823 [(set (match_operand:V8SI 0 "register_operand" "=v")
14825 (match_operand:V8HI 1 "nonimmediate_operand" "vm")))]
14826 "TARGET_AVX2 && <mask_avx512vl_condition>"
14827 "vpmov<extsuffix>wd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
14828 [(set_attr "type" "ssemov")
14829 (set_attr "prefix_extra" "1")
14830 (set_attr "prefix" "maybe_evex")
14831 (set_attr "mode" "OI")])
14833 (define_insn "sse4_1_<code>v4hiv4si2<mask_name>"
14834 [(set (match_operand:V4SI 0 "register_operand" "=Yr,*x,v")
14837 (match_operand:V8HI 1 "nonimmediate_operand" "Yrm,*xm,vm")
14838 (parallel [(const_int 0) (const_int 1)
14839 (const_int 2) (const_int 3)]))))]
14840 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
14841 "%vpmov<extsuffix>wd\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
14842 [(set_attr "isa" "noavx,noavx,avx")
14843 (set_attr "type" "ssemov")
14844 (set_attr "prefix_extra" "1")
14845 (set_attr "prefix" "orig,orig,maybe_evex")
14846 (set_attr "mode" "TI")])
14848 (define_insn "avx512f_<code>v8qiv8di2<mask_name>"
14849 [(set (match_operand:V8DI 0 "register_operand" "=v")
14852 (match_operand:V16QI 1 "nonimmediate_operand" "vm")
14853 (parallel [(const_int 0) (const_int 1)
14854 (const_int 2) (const_int 3)
14855 (const_int 4) (const_int 5)
14856 (const_int 6) (const_int 7)]))))]
14858 "vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
14859 [(set_attr "type" "ssemov")
14860 (set_attr "prefix" "evex")
14861 (set_attr "mode" "XI")])
14863 (define_insn "avx2_<code>v4qiv4di2<mask_name>"
14864 [(set (match_operand:V4DI 0 "register_operand" "=v")
14867 (match_operand:V16QI 1 "nonimmediate_operand" "vm")
14868 (parallel [(const_int 0) (const_int 1)
14869 (const_int 2) (const_int 3)]))))]
14870 "TARGET_AVX2 && <mask_avx512vl_condition>"
14871 "vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
14872 [(set_attr "type" "ssemov")
14873 (set_attr "prefix_extra" "1")
14874 (set_attr "prefix" "maybe_evex")
14875 (set_attr "mode" "OI")])
14877 (define_insn "sse4_1_<code>v2qiv2di2<mask_name>"
14878 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
14881 (match_operand:V16QI 1 "nonimmediate_operand" "Yrm,*xm,vm")
14882 (parallel [(const_int 0) (const_int 1)]))))]
14883 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
14884 "%vpmov<extsuffix>bq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %w1}"
14885 [(set_attr "isa" "noavx,noavx,avx")
14886 (set_attr "type" "ssemov")
14887 (set_attr "prefix_extra" "1")
14888 (set_attr "prefix" "orig,orig,maybe_evex")
14889 (set_attr "mode" "TI")])
14891 (define_insn "avx512f_<code>v8hiv8di2<mask_name>"
14892 [(set (match_operand:V8DI 0 "register_operand" "=v")
14894 (match_operand:V8HI 1 "nonimmediate_operand" "vm")))]
14896 "vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
14897 [(set_attr "type" "ssemov")
14898 (set_attr "prefix" "evex")
14899 (set_attr "mode" "XI")])
14901 (define_insn "avx2_<code>v4hiv4di2<mask_name>"
14902 [(set (match_operand:V4DI 0 "register_operand" "=v")
14905 (match_operand:V8HI 1 "nonimmediate_operand" "vm")
14906 (parallel [(const_int 0) (const_int 1)
14907 (const_int 2) (const_int 3)]))))]
14908 "TARGET_AVX2 && <mask_avx512vl_condition>"
14909 "vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
14910 [(set_attr "type" "ssemov")
14911 (set_attr "prefix_extra" "1")
14912 (set_attr "prefix" "maybe_evex")
14913 (set_attr "mode" "OI")])
14915 (define_insn "sse4_1_<code>v2hiv2di2<mask_name>"
14916 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
14919 (match_operand:V8HI 1 "nonimmediate_operand" "Yrm,*xm,vm")
14920 (parallel [(const_int 0) (const_int 1)]))))]
14921 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
14922 "%vpmov<extsuffix>wq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
14923 [(set_attr "isa" "noavx,noavx,avx")
14924 (set_attr "type" "ssemov")
14925 (set_attr "prefix_extra" "1")
14926 (set_attr "prefix" "orig,orig,maybe_evex")
14927 (set_attr "mode" "TI")])
14929 (define_insn "avx512f_<code>v8siv8di2<mask_name>"
14930 [(set (match_operand:V8DI 0 "register_operand" "=v")
14932 (match_operand:V8SI 1 "nonimmediate_operand" "vm")))]
14934 "vpmov<extsuffix>dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
14935 [(set_attr "type" "ssemov")
14936 (set_attr "prefix" "evex")
14937 (set_attr "mode" "XI")])
14939 (define_insn "avx2_<code>v4siv4di2<mask_name>"
14940 [(set (match_operand:V4DI 0 "register_operand" "=v")
14942 (match_operand:V4SI 1 "nonimmediate_operand" "vm")))]
14943 "TARGET_AVX2 && <mask_avx512vl_condition>"
14944 "vpmov<extsuffix>dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
14945 [(set_attr "type" "ssemov")
14946 (set_attr "prefix" "maybe_evex")
14947 (set_attr "prefix_extra" "1")
14948 (set_attr "mode" "OI")])
14950 (define_insn "sse4_1_<code>v2siv2di2<mask_name>"
14951 [(set (match_operand:V2DI 0 "register_operand" "=Yr,*x,v")
14954 (match_operand:V4SI 1 "nonimmediate_operand" "Yrm,*xm,vm")
14955 (parallel [(const_int 0) (const_int 1)]))))]
14956 "TARGET_SSE4_1 && <mask_avx512vl_condition>"
14957 "%vpmov<extsuffix>dq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
14958 [(set_attr "isa" "noavx,noavx,avx")
14959 (set_attr "type" "ssemov")
14960 (set_attr "prefix_extra" "1")
14961 (set_attr "prefix" "orig,orig,maybe_evex")
14962 (set_attr "mode" "TI")])
14964 ;; ptestps/ptestpd are very similar to comiss and ucomiss when
14965 ;; setting FLAGS_REG. But it is not a really compare instruction.
14966 (define_insn "avx_vtest<ssemodesuffix><avxsizesuffix>"
14967 [(set (reg:CC FLAGS_REG)
14968 (unspec:CC [(match_operand:VF_128_256 0 "register_operand" "x")
14969 (match_operand:VF_128_256 1 "nonimmediate_operand" "xm")]
14972 "vtest<ssemodesuffix>\t{%1, %0|%0, %1}"
14973 [(set_attr "type" "ssecomi")
14974 (set_attr "prefix_extra" "1")
14975 (set_attr "prefix" "vex")
14976 (set_attr "mode" "<MODE>")])
14978 ;; ptest is very similar to comiss and ucomiss when setting FLAGS_REG.
14979 ;; But it is not a really compare instruction.
14980 (define_insn "<sse4_1>_ptest<mode>"
14981 [(set (reg:CC FLAGS_REG)
14982 (unspec:CC [(match_operand:V_AVX 0 "register_operand" "Yr, *x, x")
14983 (match_operand:V_AVX 1 "vector_operand" "YrBm, *xBm, xm")]
14986 "%vptest\t{%1, %0|%0, %1}"
14987 [(set_attr "isa" "noavx,noavx,avx")
14988 (set_attr "type" "ssecomi")
14989 (set_attr "prefix_extra" "1")
14990 (set_attr "prefix" "orig,orig,vex")
14991 (set (attr "btver2_decode")
14993 (match_test "<sseinsnmode>mode==OImode")
14994 (const_string "vector")
14995 (const_string "*")))
14996 (set_attr "mode" "<sseinsnmode>")])
14998 (define_insn "<sse4_1>_round<ssemodesuffix><avxsizesuffix>"
14999 [(set (match_operand:VF_128_256 0 "register_operand" "=Yr,*x,x")
15001 [(match_operand:VF_128_256 1 "vector_operand" "YrBm,*xBm,xm")
15002 (match_operand:SI 2 "const_0_to_15_operand" "n,n,n")]
15005 "%vround<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
15006 [(set_attr "isa" "noavx,noavx,avx")
15007 (set_attr "type" "ssecvt")
15008 (set_attr "prefix_data16" "1,1,*")
15009 (set_attr "prefix_extra" "1")
15010 (set_attr "length_immediate" "1")
15011 (set_attr "prefix" "orig,orig,vex")
15012 (set_attr "mode" "<MODE>")])
15014 (define_expand "<sse4_1>_round<ssemodesuffix>_sfix<avxsizesuffix>"
15015 [(match_operand:<sseintvecmode> 0 "register_operand")
15016 (match_operand:VF1_128_256 1 "vector_operand")
15017 (match_operand:SI 2 "const_0_to_15_operand")]
15020 rtx tmp = gen_reg_rtx (<MODE>mode);
15023 (gen_<sse4_1>_round<ssemodesuffix><avxsizesuffix> (tmp, operands[1],
15026 (gen_fix_trunc<mode><sseintvecmodelower>2 (operands[0], tmp));
15030 (define_expand "avx512f_roundpd512"
15031 [(match_operand:V8DF 0 "register_operand")
15032 (match_operand:V8DF 1 "nonimmediate_operand")
15033 (match_operand:SI 2 "const_0_to_15_operand")]
15036 emit_insn (gen_avx512f_rndscalev8df (operands[0], operands[1], operands[2]));
15040 (define_expand "<sse4_1>_round<ssemodesuffix>_vec_pack_sfix<avxsizesuffix>"
15041 [(match_operand:<ssepackfltmode> 0 "register_operand")
15042 (match_operand:VF2 1 "vector_operand")
15043 (match_operand:VF2 2 "vector_operand")
15044 (match_operand:SI 3 "const_0_to_15_operand")]
15049 if (<MODE>mode == V2DFmode
15050 && TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
15052 rtx tmp2 = gen_reg_rtx (V4DFmode);
15054 tmp0 = gen_reg_rtx (V4DFmode);
15055 tmp1 = force_reg (V2DFmode, operands[1]);
15057 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
15058 emit_insn (gen_avx_roundpd256 (tmp2, tmp0, operands[3]));
15059 emit_insn (gen_fix_truncv4dfv4si2 (operands[0], tmp2));
15063 tmp0 = gen_reg_rtx (<MODE>mode);
15064 tmp1 = gen_reg_rtx (<MODE>mode);
15067 (gen_<sse4_1>_round<ssemodesuffix><avxsizesuffix> (tmp0, operands[1],
15070 (gen_<sse4_1>_round<ssemodesuffix><avxsizesuffix> (tmp1, operands[2],
15073 (gen_vec_pack_sfix_trunc_<mode> (operands[0], tmp0, tmp1));
15078 (define_insn "sse4_1_round<ssescalarmodesuffix>"
15079 [(set (match_operand:VF_128 0 "register_operand" "=Yr,*x,x,v")
15082 [(match_operand:VF_128 2 "register_operand" "Yr,*x,x,v")
15083 (match_operand:SI 3 "const_0_to_15_operand" "n,n,n,n")]
15085 (match_operand:VF_128 1 "register_operand" "0,0,x,v")
15089 round<ssescalarmodesuffix>\t{%3, %2, %0|%0, %2, %3}
15090 round<ssescalarmodesuffix>\t{%3, %2, %0|%0, %2, %3}
15091 vround<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}
15092 vrndscale<ssescalarmodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15093 [(set_attr "isa" "noavx,noavx,avx,avx512f")
15094 (set_attr "type" "ssecvt")
15095 (set_attr "length_immediate" "1")
15096 (set_attr "prefix_data16" "1,1,*,*")
15097 (set_attr "prefix_extra" "1")
15098 (set_attr "prefix" "orig,orig,vex,evex")
15099 (set_attr "mode" "<MODE>")])
15101 (define_expand "round<mode>2"
15102 [(set (match_dup 4)
15104 (match_operand:VF 1 "register_operand")
15106 (set (match_operand:VF 0 "register_operand")
15108 [(match_dup 4) (match_dup 5)]
15110 "TARGET_ROUND && !flag_trapping_math"
15112 machine_mode scalar_mode;
15113 const struct real_format *fmt;
15114 REAL_VALUE_TYPE pred_half, half_minus_pred_half;
15115 rtx half, vec_half;
15117 scalar_mode = GET_MODE_INNER (<MODE>mode);
15119 /* load nextafter (0.5, 0.0) */
15120 fmt = REAL_MODE_FORMAT (scalar_mode);
15121 real_2expN (&half_minus_pred_half, -(fmt->p) - 1, scalar_mode);
15122 real_arithmetic (&pred_half, MINUS_EXPR, &dconsthalf, &half_minus_pred_half);
15123 half = const_double_from_real_value (pred_half, scalar_mode);
15125 vec_half = ix86_build_const_vector (<MODE>mode, true, half);
15126 vec_half = force_reg (<MODE>mode, vec_half);
15128 operands[3] = gen_reg_rtx (<MODE>mode);
15129 emit_insn (gen_copysign<mode>3 (operands[3], vec_half, operands[1]));
15131 operands[4] = gen_reg_rtx (<MODE>mode);
15132 operands[5] = GEN_INT (ROUND_TRUNC);
15135 (define_expand "round<mode>2_sfix"
15136 [(match_operand:<sseintvecmode> 0 "register_operand")
15137 (match_operand:VF1_128_256 1 "register_operand")]
15138 "TARGET_ROUND && !flag_trapping_math"
15140 rtx tmp = gen_reg_rtx (<MODE>mode);
15142 emit_insn (gen_round<mode>2 (tmp, operands[1]));
15145 (gen_fix_trunc<mode><sseintvecmodelower>2 (operands[0], tmp));
15149 (define_expand "round<mode>2_vec_pack_sfix"
15150 [(match_operand:<ssepackfltmode> 0 "register_operand")
15151 (match_operand:VF2 1 "register_operand")
15152 (match_operand:VF2 2 "register_operand")]
15153 "TARGET_ROUND && !flag_trapping_math"
15157 if (<MODE>mode == V2DFmode
15158 && TARGET_AVX && !TARGET_PREFER_AVX128 && optimize_insn_for_speed_p ())
15160 rtx tmp2 = gen_reg_rtx (V4DFmode);
15162 tmp0 = gen_reg_rtx (V4DFmode);
15163 tmp1 = force_reg (V2DFmode, operands[1]);
15165 emit_insn (gen_avx_vec_concatv4df (tmp0, tmp1, operands[2]));
15166 emit_insn (gen_roundv4df2 (tmp2, tmp0));
15167 emit_insn (gen_fix_truncv4dfv4si2 (operands[0], tmp2));
15171 tmp0 = gen_reg_rtx (<MODE>mode);
15172 tmp1 = gen_reg_rtx (<MODE>mode);
15174 emit_insn (gen_round<mode>2 (tmp0, operands[1]));
15175 emit_insn (gen_round<mode>2 (tmp1, operands[2]));
15178 (gen_vec_pack_sfix_trunc_<mode> (operands[0], tmp0, tmp1));
15183 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15185 ;; Intel SSE4.2 string/text processing instructions
15187 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15189 (define_insn_and_split "sse4_2_pcmpestr"
15190 [(set (match_operand:SI 0 "register_operand" "=c,c")
15192 [(match_operand:V16QI 2 "register_operand" "x,x")
15193 (match_operand:SI 3 "register_operand" "a,a")
15194 (match_operand:V16QI 4 "nonimmediate_operand" "x,m")
15195 (match_operand:SI 5 "register_operand" "d,d")
15196 (match_operand:SI 6 "const_0_to_255_operand" "n,n")]
15198 (set (match_operand:V16QI 1 "register_operand" "=Yz,Yz")
15206 (set (reg:CC FLAGS_REG)
15215 && can_create_pseudo_p ()"
15220 int ecx = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[0]));
15221 int xmm0 = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[1]));
15222 int flags = !find_regno_note (curr_insn, REG_UNUSED, FLAGS_REG);
15225 emit_insn (gen_sse4_2_pcmpestri (operands[0], operands[2],
15226 operands[3], operands[4],
15227 operands[5], operands[6]));
15229 emit_insn (gen_sse4_2_pcmpestrm (operands[1], operands[2],
15230 operands[3], operands[4],
15231 operands[5], operands[6]));
15232 if (flags && !(ecx || xmm0))
15233 emit_insn (gen_sse4_2_pcmpestr_cconly (NULL, NULL,
15234 operands[2], operands[3],
15235 operands[4], operands[5],
15237 if (!(flags || ecx || xmm0))
15238 emit_note (NOTE_INSN_DELETED);
15242 [(set_attr "type" "sselog")
15243 (set_attr "prefix_data16" "1")
15244 (set_attr "prefix_extra" "1")
15245 (set_attr "length_immediate" "1")
15246 (set_attr "memory" "none,load")
15247 (set_attr "mode" "TI")])
15249 (define_insn "sse4_2_pcmpestri"
15250 [(set (match_operand:SI 0 "register_operand" "=c,c")
15252 [(match_operand:V16QI 1 "register_operand" "x,x")
15253 (match_operand:SI 2 "register_operand" "a,a")
15254 (match_operand:V16QI 3 "nonimmediate_operand" "x,m")
15255 (match_operand:SI 4 "register_operand" "d,d")
15256 (match_operand:SI 5 "const_0_to_255_operand" "n,n")]
15258 (set (reg:CC FLAGS_REG)
15267 "%vpcmpestri\t{%5, %3, %1|%1, %3, %5}"
15268 [(set_attr "type" "sselog")
15269 (set_attr "prefix_data16" "1")
15270 (set_attr "prefix_extra" "1")
15271 (set_attr "prefix" "maybe_vex")
15272 (set_attr "length_immediate" "1")
15273 (set_attr "btver2_decode" "vector")
15274 (set_attr "memory" "none,load")
15275 (set_attr "mode" "TI")])
15277 (define_insn "sse4_2_pcmpestrm"
15278 [(set (match_operand:V16QI 0 "register_operand" "=Yz,Yz")
15280 [(match_operand:V16QI 1 "register_operand" "x,x")
15281 (match_operand:SI 2 "register_operand" "a,a")
15282 (match_operand:V16QI 3 "nonimmediate_operand" "x,m")
15283 (match_operand:SI 4 "register_operand" "d,d")
15284 (match_operand:SI 5 "const_0_to_255_operand" "n,n")]
15286 (set (reg:CC FLAGS_REG)
15295 "%vpcmpestrm\t{%5, %3, %1|%1, %3, %5}"
15296 [(set_attr "type" "sselog")
15297 (set_attr "prefix_data16" "1")
15298 (set_attr "prefix_extra" "1")
15299 (set_attr "length_immediate" "1")
15300 (set_attr "prefix" "maybe_vex")
15301 (set_attr "btver2_decode" "vector")
15302 (set_attr "memory" "none,load")
15303 (set_attr "mode" "TI")])
15305 (define_insn "sse4_2_pcmpestr_cconly"
15306 [(set (reg:CC FLAGS_REG)
15308 [(match_operand:V16QI 2 "register_operand" "x,x,x,x")
15309 (match_operand:SI 3 "register_operand" "a,a,a,a")
15310 (match_operand:V16QI 4 "nonimmediate_operand" "x,m,x,m")
15311 (match_operand:SI 5 "register_operand" "d,d,d,d")
15312 (match_operand:SI 6 "const_0_to_255_operand" "n,n,n,n")]
15314 (clobber (match_scratch:V16QI 0 "=Yz,Yz,X,X"))
15315 (clobber (match_scratch:SI 1 "= X, X,c,c"))]
15318 %vpcmpestrm\t{%6, %4, %2|%2, %4, %6}
15319 %vpcmpestrm\t{%6, %4, %2|%2, %4, %6}
15320 %vpcmpestri\t{%6, %4, %2|%2, %4, %6}
15321 %vpcmpestri\t{%6, %4, %2|%2, %4, %6}"
15322 [(set_attr "type" "sselog")
15323 (set_attr "prefix_data16" "1")
15324 (set_attr "prefix_extra" "1")
15325 (set_attr "length_immediate" "1")
15326 (set_attr "memory" "none,load,none,load")
15327 (set_attr "btver2_decode" "vector,vector,vector,vector")
15328 (set_attr "prefix" "maybe_vex")
15329 (set_attr "mode" "TI")])
15331 (define_insn_and_split "sse4_2_pcmpistr"
15332 [(set (match_operand:SI 0 "register_operand" "=c,c")
15334 [(match_operand:V16QI 2 "register_operand" "x,x")
15335 (match_operand:V16QI 3 "nonimmediate_operand" "x,m")
15336 (match_operand:SI 4 "const_0_to_255_operand" "n,n")]
15338 (set (match_operand:V16QI 1 "register_operand" "=Yz,Yz")
15344 (set (reg:CC FLAGS_REG)
15351 && can_create_pseudo_p ()"
15356 int ecx = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[0]));
15357 int xmm0 = !find_regno_note (curr_insn, REG_UNUSED, REGNO (operands[1]));
15358 int flags = !find_regno_note (curr_insn, REG_UNUSED, FLAGS_REG);
15361 emit_insn (gen_sse4_2_pcmpistri (operands[0], operands[2],
15362 operands[3], operands[4]));
15364 emit_insn (gen_sse4_2_pcmpistrm (operands[1], operands[2],
15365 operands[3], operands[4]));
15366 if (flags && !(ecx || xmm0))
15367 emit_insn (gen_sse4_2_pcmpistr_cconly (NULL, NULL,
15368 operands[2], operands[3],
15370 if (!(flags || ecx || xmm0))
15371 emit_note (NOTE_INSN_DELETED);
15375 [(set_attr "type" "sselog")
15376 (set_attr "prefix_data16" "1")
15377 (set_attr "prefix_extra" "1")
15378 (set_attr "length_immediate" "1")
15379 (set_attr "memory" "none,load")
15380 (set_attr "mode" "TI")])
15382 (define_insn "sse4_2_pcmpistri"
15383 [(set (match_operand:SI 0 "register_operand" "=c,c")
15385 [(match_operand:V16QI 1 "register_operand" "x,x")
15386 (match_operand:V16QI 2 "nonimmediate_operand" "x,m")
15387 (match_operand:SI 3 "const_0_to_255_operand" "n,n")]
15389 (set (reg:CC FLAGS_REG)
15396 "%vpcmpistri\t{%3, %2, %1|%1, %2, %3}"
15397 [(set_attr "type" "sselog")
15398 (set_attr "prefix_data16" "1")
15399 (set_attr "prefix_extra" "1")
15400 (set_attr "length_immediate" "1")
15401 (set_attr "prefix" "maybe_vex")
15402 (set_attr "memory" "none,load")
15403 (set_attr "btver2_decode" "vector")
15404 (set_attr "mode" "TI")])
15406 (define_insn "sse4_2_pcmpistrm"
15407 [(set (match_operand:V16QI 0 "register_operand" "=Yz,Yz")
15409 [(match_operand:V16QI 1 "register_operand" "x,x")
15410 (match_operand:V16QI 2 "nonimmediate_operand" "x,m")
15411 (match_operand:SI 3 "const_0_to_255_operand" "n,n")]
15413 (set (reg:CC FLAGS_REG)
15420 "%vpcmpistrm\t{%3, %2, %1|%1, %2, %3}"
15421 [(set_attr "type" "sselog")
15422 (set_attr "prefix_data16" "1")
15423 (set_attr "prefix_extra" "1")
15424 (set_attr "length_immediate" "1")
15425 (set_attr "prefix" "maybe_vex")
15426 (set_attr "memory" "none,load")
15427 (set_attr "btver2_decode" "vector")
15428 (set_attr "mode" "TI")])
15430 (define_insn "sse4_2_pcmpistr_cconly"
15431 [(set (reg:CC FLAGS_REG)
15433 [(match_operand:V16QI 2 "register_operand" "x,x,x,x")
15434 (match_operand:V16QI 3 "nonimmediate_operand" "x,m,x,m")
15435 (match_operand:SI 4 "const_0_to_255_operand" "n,n,n,n")]
15437 (clobber (match_scratch:V16QI 0 "=Yz,Yz,X,X"))
15438 (clobber (match_scratch:SI 1 "= X, X,c,c"))]
15441 %vpcmpistrm\t{%4, %3, %2|%2, %3, %4}
15442 %vpcmpistrm\t{%4, %3, %2|%2, %3, %4}
15443 %vpcmpistri\t{%4, %3, %2|%2, %3, %4}
15444 %vpcmpistri\t{%4, %3, %2|%2, %3, %4}"
15445 [(set_attr "type" "sselog")
15446 (set_attr "prefix_data16" "1")
15447 (set_attr "prefix_extra" "1")
15448 (set_attr "length_immediate" "1")
15449 (set_attr "memory" "none,load,none,load")
15450 (set_attr "prefix" "maybe_vex")
15451 (set_attr "btver2_decode" "vector,vector,vector,vector")
15452 (set_attr "mode" "TI")])
15454 ;; Packed float variants
15455 (define_mode_attr GATHER_SCATTER_SF_MEM_MODE
15456 [(V8DI "V8SF") (V16SI "V16SF")])
15458 (define_expand "avx512pf_gatherpf<mode>sf"
15460 [(match_operand:<avx512fmaskmode> 0 "register_operand")
15461 (mem:<GATHER_SCATTER_SF_MEM_MODE>
15463 [(match_operand 2 "vsib_address_operand")
15464 (match_operand:VI48_512 1 "register_operand")
15465 (match_operand:SI 3 "const1248_operand")]))
15466 (match_operand:SI 4 "const_2_to_3_operand")]
15467 UNSPEC_GATHER_PREFETCH)]
15471 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
15472 operands[3]), UNSPEC_VSIBADDR);
15475 (define_insn "*avx512pf_gatherpf<mode>sf_mask"
15477 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
15478 (match_operator:<GATHER_SCATTER_SF_MEM_MODE> 5 "vsib_mem_operator"
15480 [(match_operand:P 2 "vsib_address_operand" "Tv")
15481 (match_operand:VI48_512 1 "register_operand" "v")
15482 (match_operand:SI 3 "const1248_operand" "n")]
15484 (match_operand:SI 4 "const_2_to_3_operand" "n")]
15485 UNSPEC_GATHER_PREFETCH)]
15488 switch (INTVAL (operands[4]))
15491 return "vgatherpf0<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
15493 return "vgatherpf1<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
15495 gcc_unreachable ();
15498 [(set_attr "type" "sse")
15499 (set_attr "prefix" "evex")
15500 (set_attr "mode" "XI")])
15502 ;; Packed double variants
15503 (define_expand "avx512pf_gatherpf<mode>df"
15505 [(match_operand:<avx512fmaskmode> 0 "register_operand")
15508 [(match_operand 2 "vsib_address_operand")
15509 (match_operand:VI4_256_8_512 1 "register_operand")
15510 (match_operand:SI 3 "const1248_operand")]))
15511 (match_operand:SI 4 "const_2_to_3_operand")]
15512 UNSPEC_GATHER_PREFETCH)]
15516 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
15517 operands[3]), UNSPEC_VSIBADDR);
15520 (define_insn "*avx512pf_gatherpf<mode>df_mask"
15522 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
15523 (match_operator:V8DF 5 "vsib_mem_operator"
15525 [(match_operand:P 2 "vsib_address_operand" "Tv")
15526 (match_operand:VI4_256_8_512 1 "register_operand" "v")
15527 (match_operand:SI 3 "const1248_operand" "n")]
15529 (match_operand:SI 4 "const_2_to_3_operand" "n")]
15530 UNSPEC_GATHER_PREFETCH)]
15533 switch (INTVAL (operands[4]))
15536 return "vgatherpf0<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
15538 return "vgatherpf1<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
15540 gcc_unreachable ();
15543 [(set_attr "type" "sse")
15544 (set_attr "prefix" "evex")
15545 (set_attr "mode" "XI")])
15547 ;; Packed float variants
15548 (define_expand "avx512pf_scatterpf<mode>sf"
15550 [(match_operand:<avx512fmaskmode> 0 "register_operand")
15551 (mem:<GATHER_SCATTER_SF_MEM_MODE>
15553 [(match_operand 2 "vsib_address_operand")
15554 (match_operand:VI48_512 1 "register_operand")
15555 (match_operand:SI 3 "const1248_operand")]))
15556 (match_operand:SI 4 "const2367_operand")]
15557 UNSPEC_SCATTER_PREFETCH)]
15561 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
15562 operands[3]), UNSPEC_VSIBADDR);
15565 (define_insn "*avx512pf_scatterpf<mode>sf_mask"
15567 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
15568 (match_operator:<GATHER_SCATTER_SF_MEM_MODE> 5 "vsib_mem_operator"
15570 [(match_operand:P 2 "vsib_address_operand" "Tv")
15571 (match_operand:VI48_512 1 "register_operand" "v")
15572 (match_operand:SI 3 "const1248_operand" "n")]
15574 (match_operand:SI 4 "const2367_operand" "n")]
15575 UNSPEC_SCATTER_PREFETCH)]
15578 switch (INTVAL (operands[4]))
15582 return "vscatterpf0<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
15585 return "vscatterpf1<ssemodesuffix>ps\t{%5%{%0%}|%5%{%0%}}";
15587 gcc_unreachable ();
15590 [(set_attr "type" "sse")
15591 (set_attr "prefix" "evex")
15592 (set_attr "mode" "XI")])
15594 ;; Packed double variants
15595 (define_expand "avx512pf_scatterpf<mode>df"
15597 [(match_operand:<avx512fmaskmode> 0 "register_operand")
15600 [(match_operand 2 "vsib_address_operand")
15601 (match_operand:VI4_256_8_512 1 "register_operand")
15602 (match_operand:SI 3 "const1248_operand")]))
15603 (match_operand:SI 4 "const2367_operand")]
15604 UNSPEC_SCATTER_PREFETCH)]
15608 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[1],
15609 operands[3]), UNSPEC_VSIBADDR);
15612 (define_insn "*avx512pf_scatterpf<mode>df_mask"
15614 [(match_operand:<avx512fmaskmode> 0 "register_operand" "Yk")
15615 (match_operator:V8DF 5 "vsib_mem_operator"
15617 [(match_operand:P 2 "vsib_address_operand" "Tv")
15618 (match_operand:VI4_256_8_512 1 "register_operand" "v")
15619 (match_operand:SI 3 "const1248_operand" "n")]
15621 (match_operand:SI 4 "const2367_operand" "n")]
15622 UNSPEC_SCATTER_PREFETCH)]
15625 switch (INTVAL (operands[4]))
15629 return "vscatterpf0<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
15632 return "vscatterpf1<ssemodesuffix>pd\t{%5%{%0%}|%5%{%0%}}";
15634 gcc_unreachable ();
15637 [(set_attr "type" "sse")
15638 (set_attr "prefix" "evex")
15639 (set_attr "mode" "XI")])
15641 (define_insn "avx512er_exp2<mode><mask_name><round_saeonly_name>"
15642 [(set (match_operand:VF_512 0 "register_operand" "=v")
15644 [(match_operand:VF_512 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
15647 "vexp2<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
15648 [(set_attr "prefix" "evex")
15649 (set_attr "type" "sse")
15650 (set_attr "mode" "<MODE>")])
15652 (define_insn "<mask_codefor>avx512er_rcp28<mode><mask_name><round_saeonly_name>"
15653 [(set (match_operand:VF_512 0 "register_operand" "=v")
15655 [(match_operand:VF_512 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
15658 "vrcp28<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
15659 [(set_attr "prefix" "evex")
15660 (set_attr "type" "sse")
15661 (set_attr "mode" "<MODE>")])
15663 (define_insn "avx512er_vmrcp28<mode><round_saeonly_name>"
15664 [(set (match_operand:VF_128 0 "register_operand" "=v")
15667 [(match_operand:VF_128 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
15669 (match_operand:VF_128 2 "register_operand" "v")
15672 "vrcp28<ssescalarmodesuffix>\t{<round_saeonly_op3>%1, %2, %0|%0, %2, %1<round_saeonly_op3>}"
15673 [(set_attr "length_immediate" "1")
15674 (set_attr "prefix" "evex")
15675 (set_attr "type" "sse")
15676 (set_attr "mode" "<MODE>")])
15678 (define_insn "<mask_codefor>avx512er_rsqrt28<mode><mask_name><round_saeonly_name>"
15679 [(set (match_operand:VF_512 0 "register_operand" "=v")
15681 [(match_operand:VF_512 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
15684 "vrsqrt28<ssemodesuffix>\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
15685 [(set_attr "prefix" "evex")
15686 (set_attr "type" "sse")
15687 (set_attr "mode" "<MODE>")])
15689 (define_insn "avx512er_vmrsqrt28<mode><round_saeonly_name>"
15690 [(set (match_operand:VF_128 0 "register_operand" "=v")
15693 [(match_operand:VF_128 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
15695 (match_operand:VF_128 2 "register_operand" "v")
15698 "vrsqrt28<ssescalarmodesuffix>\t{<round_saeonly_op3>%1, %2, %0|%0, %2, %1<round_saeonly_op3>}"
15699 [(set_attr "length_immediate" "1")
15700 (set_attr "type" "sse")
15701 (set_attr "prefix" "evex")
15702 (set_attr "mode" "<MODE>")])
15704 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15706 ;; XOP instructions
15708 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15710 (define_code_iterator xop_plus [plus ss_plus])
15712 (define_code_attr macs [(plus "macs") (ss_plus "macss")])
15713 (define_code_attr madcs [(plus "madcs") (ss_plus "madcss")])
15715 ;; XOP parallel integer multiply/add instructions.
15717 (define_insn "xop_p<macs><ssemodesuffix><ssemodesuffix>"
15718 [(set (match_operand:VI24_128 0 "register_operand" "=x")
15721 (match_operand:VI24_128 1 "nonimmediate_operand" "%x")
15722 (match_operand:VI24_128 2 "nonimmediate_operand" "xm"))
15723 (match_operand:VI24_128 3 "register_operand" "x")))]
15725 "vp<macs><ssemodesuffix><ssemodesuffix>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15726 [(set_attr "type" "ssemuladd")
15727 (set_attr "mode" "TI")])
15729 (define_insn "xop_p<macs>dql"
15730 [(set (match_operand:V2DI 0 "register_operand" "=x")
15735 (match_operand:V4SI 1 "nonimmediate_operand" "%x")
15736 (parallel [(const_int 0) (const_int 2)])))
15739 (match_operand:V4SI 2 "nonimmediate_operand" "xm")
15740 (parallel [(const_int 0) (const_int 2)]))))
15741 (match_operand:V2DI 3 "register_operand" "x")))]
15743 "vp<macs>dql\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15744 [(set_attr "type" "ssemuladd")
15745 (set_attr "mode" "TI")])
15747 (define_insn "xop_p<macs>dqh"
15748 [(set (match_operand:V2DI 0 "register_operand" "=x")
15753 (match_operand:V4SI 1 "nonimmediate_operand" "%x")
15754 (parallel [(const_int 1) (const_int 3)])))
15757 (match_operand:V4SI 2 "nonimmediate_operand" "xm")
15758 (parallel [(const_int 1) (const_int 3)]))))
15759 (match_operand:V2DI 3 "register_operand" "x")))]
15761 "vp<macs>dqh\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15762 [(set_attr "type" "ssemuladd")
15763 (set_attr "mode" "TI")])
15765 ;; XOP parallel integer multiply/add instructions for the intrinisics
15766 (define_insn "xop_p<macs>wd"
15767 [(set (match_operand:V4SI 0 "register_operand" "=x")
15772 (match_operand:V8HI 1 "nonimmediate_operand" "%x")
15773 (parallel [(const_int 1) (const_int 3)
15774 (const_int 5) (const_int 7)])))
15777 (match_operand:V8HI 2 "nonimmediate_operand" "xm")
15778 (parallel [(const_int 1) (const_int 3)
15779 (const_int 5) (const_int 7)]))))
15780 (match_operand:V4SI 3 "register_operand" "x")))]
15782 "vp<macs>wd\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15783 [(set_attr "type" "ssemuladd")
15784 (set_attr "mode" "TI")])
15786 (define_insn "xop_p<madcs>wd"
15787 [(set (match_operand:V4SI 0 "register_operand" "=x")
15793 (match_operand:V8HI 1 "nonimmediate_operand" "%x")
15794 (parallel [(const_int 0) (const_int 2)
15795 (const_int 4) (const_int 6)])))
15798 (match_operand:V8HI 2 "nonimmediate_operand" "xm")
15799 (parallel [(const_int 0) (const_int 2)
15800 (const_int 4) (const_int 6)]))))
15805 (parallel [(const_int 1) (const_int 3)
15806 (const_int 5) (const_int 7)])))
15810 (parallel [(const_int 1) (const_int 3)
15811 (const_int 5) (const_int 7)])))))
15812 (match_operand:V4SI 3 "register_operand" "x")))]
15814 "vp<madcs>wd\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15815 [(set_attr "type" "ssemuladd")
15816 (set_attr "mode" "TI")])
15818 ;; XOP parallel XMM conditional moves
15819 (define_insn "xop_pcmov_<mode><avxsizesuffix>"
15820 [(set (match_operand:V 0 "register_operand" "=x,x")
15822 (match_operand:V 3 "nonimmediate_operand" "x,m")
15823 (match_operand:V 1 "register_operand" "x,x")
15824 (match_operand:V 2 "nonimmediate_operand" "xm,x")))]
15826 "vpcmov\t{%3, %2, %1, %0|%0, %1, %2, %3}"
15827 [(set_attr "type" "sse4arg")])
15829 ;; XOP horizontal add/subtract instructions
15830 (define_insn "xop_phadd<u>bw"
15831 [(set (match_operand:V8HI 0 "register_operand" "=x")
15835 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
15836 (parallel [(const_int 0) (const_int 2)
15837 (const_int 4) (const_int 6)
15838 (const_int 8) (const_int 10)
15839 (const_int 12) (const_int 14)])))
15843 (parallel [(const_int 1) (const_int 3)
15844 (const_int 5) (const_int 7)
15845 (const_int 9) (const_int 11)
15846 (const_int 13) (const_int 15)])))))]
15848 "vphadd<u>bw\t{%1, %0|%0, %1}"
15849 [(set_attr "type" "sseiadd1")])
15851 (define_insn "xop_phadd<u>bd"
15852 [(set (match_operand:V4SI 0 "register_operand" "=x")
15857 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
15858 (parallel [(const_int 0) (const_int 4)
15859 (const_int 8) (const_int 12)])))
15863 (parallel [(const_int 1) (const_int 5)
15864 (const_int 9) (const_int 13)]))))
15869 (parallel [(const_int 2) (const_int 6)
15870 (const_int 10) (const_int 14)])))
15874 (parallel [(const_int 3) (const_int 7)
15875 (const_int 11) (const_int 15)]))))))]
15877 "vphadd<u>bd\t{%1, %0|%0, %1}"
15878 [(set_attr "type" "sseiadd1")])
15880 (define_insn "xop_phadd<u>bq"
15881 [(set (match_operand:V2DI 0 "register_operand" "=x")
15887 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
15888 (parallel [(const_int 0) (const_int 8)])))
15892 (parallel [(const_int 1) (const_int 9)]))))
15897 (parallel [(const_int 2) (const_int 10)])))
15901 (parallel [(const_int 3) (const_int 11)])))))
15907 (parallel [(const_int 4) (const_int 12)])))
15911 (parallel [(const_int 5) (const_int 13)]))))
15916 (parallel [(const_int 6) (const_int 14)])))
15920 (parallel [(const_int 7) (const_int 15)])))))))]
15922 "vphadd<u>bq\t{%1, %0|%0, %1}"
15923 [(set_attr "type" "sseiadd1")])
15925 (define_insn "xop_phadd<u>wd"
15926 [(set (match_operand:V4SI 0 "register_operand" "=x")
15930 (match_operand:V8HI 1 "nonimmediate_operand" "xm")
15931 (parallel [(const_int 0) (const_int 2)
15932 (const_int 4) (const_int 6)])))
15936 (parallel [(const_int 1) (const_int 3)
15937 (const_int 5) (const_int 7)])))))]
15939 "vphadd<u>wd\t{%1, %0|%0, %1}"
15940 [(set_attr "type" "sseiadd1")])
15942 (define_insn "xop_phadd<u>wq"
15943 [(set (match_operand:V2DI 0 "register_operand" "=x")
15948 (match_operand:V8HI 1 "nonimmediate_operand" "xm")
15949 (parallel [(const_int 0) (const_int 4)])))
15953 (parallel [(const_int 1) (const_int 5)]))))
15958 (parallel [(const_int 2) (const_int 6)])))
15962 (parallel [(const_int 3) (const_int 7)]))))))]
15964 "vphadd<u>wq\t{%1, %0|%0, %1}"
15965 [(set_attr "type" "sseiadd1")])
15967 (define_insn "xop_phadd<u>dq"
15968 [(set (match_operand:V2DI 0 "register_operand" "=x")
15972 (match_operand:V4SI 1 "nonimmediate_operand" "xm")
15973 (parallel [(const_int 0) (const_int 2)])))
15977 (parallel [(const_int 1) (const_int 3)])))))]
15979 "vphadd<u>dq\t{%1, %0|%0, %1}"
15980 [(set_attr "type" "sseiadd1")])
15982 (define_insn "xop_phsubbw"
15983 [(set (match_operand:V8HI 0 "register_operand" "=x")
15987 (match_operand:V16QI 1 "nonimmediate_operand" "xm")
15988 (parallel [(const_int 0) (const_int 2)
15989 (const_int 4) (const_int 6)
15990 (const_int 8) (const_int 10)
15991 (const_int 12) (const_int 14)])))
15995 (parallel [(const_int 1) (const_int 3)
15996 (const_int 5) (const_int 7)
15997 (const_int 9) (const_int 11)
15998 (const_int 13) (const_int 15)])))))]
16000 "vphsubbw\t{%1, %0|%0, %1}"
16001 [(set_attr "type" "sseiadd1")])
16003 (define_insn "xop_phsubwd"
16004 [(set (match_operand:V4SI 0 "register_operand" "=x")
16008 (match_operand:V8HI 1 "nonimmediate_operand" "xm")
16009 (parallel [(const_int 0) (const_int 2)
16010 (const_int 4) (const_int 6)])))
16014 (parallel [(const_int 1) (const_int 3)
16015 (const_int 5) (const_int 7)])))))]
16017 "vphsubwd\t{%1, %0|%0, %1}"
16018 [(set_attr "type" "sseiadd1")])
16020 (define_insn "xop_phsubdq"
16021 [(set (match_operand:V2DI 0 "register_operand" "=x")
16025 (match_operand:V4SI 1 "nonimmediate_operand" "xm")
16026 (parallel [(const_int 0) (const_int 2)])))
16030 (parallel [(const_int 1) (const_int 3)])))))]
16032 "vphsubdq\t{%1, %0|%0, %1}"
16033 [(set_attr "type" "sseiadd1")])
16035 ;; XOP permute instructions
16036 (define_insn "xop_pperm"
16037 [(set (match_operand:V16QI 0 "register_operand" "=x,x")
16039 [(match_operand:V16QI 1 "register_operand" "x,x")
16040 (match_operand:V16QI 2 "nonimmediate_operand" "x,m")
16041 (match_operand:V16QI 3 "nonimmediate_operand" "xm,x")]
16042 UNSPEC_XOP_PERMUTE))]
16043 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
16044 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16045 [(set_attr "type" "sse4arg")
16046 (set_attr "mode" "TI")])
16048 ;; XOP pack instructions that combine two vectors into a smaller vector
16049 (define_insn "xop_pperm_pack_v2di_v4si"
16050 [(set (match_operand:V4SI 0 "register_operand" "=x,x")
16053 (match_operand:V2DI 1 "register_operand" "x,x"))
16055 (match_operand:V2DI 2 "nonimmediate_operand" "x,m"))))
16056 (use (match_operand:V16QI 3 "nonimmediate_operand" "xm,x"))]
16057 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
16058 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16059 [(set_attr "type" "sse4arg")
16060 (set_attr "mode" "TI")])
16062 (define_insn "xop_pperm_pack_v4si_v8hi"
16063 [(set (match_operand:V8HI 0 "register_operand" "=x,x")
16066 (match_operand:V4SI 1 "register_operand" "x,x"))
16068 (match_operand:V4SI 2 "nonimmediate_operand" "x,m"))))
16069 (use (match_operand:V16QI 3 "nonimmediate_operand" "xm,x"))]
16070 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
16071 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16072 [(set_attr "type" "sse4arg")
16073 (set_attr "mode" "TI")])
16075 (define_insn "xop_pperm_pack_v8hi_v16qi"
16076 [(set (match_operand:V16QI 0 "register_operand" "=x,x")
16079 (match_operand:V8HI 1 "register_operand" "x,x"))
16081 (match_operand:V8HI 2 "nonimmediate_operand" "x,m"))))
16082 (use (match_operand:V16QI 3 "nonimmediate_operand" "xm,x"))]
16083 "TARGET_XOP && !(MEM_P (operands[2]) && MEM_P (operands[3]))"
16084 "vpperm\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16085 [(set_attr "type" "sse4arg")
16086 (set_attr "mode" "TI")])
16088 ;; XOP packed rotate instructions
16089 (define_expand "rotl<mode>3"
16090 [(set (match_operand:VI_128 0 "register_operand")
16092 (match_operand:VI_128 1 "nonimmediate_operand")
16093 (match_operand:SI 2 "general_operand")))]
16096 /* If we were given a scalar, convert it to parallel */
16097 if (! const_0_to_<sserotatemax>_operand (operands[2], SImode))
16099 rtvec vs = rtvec_alloc (<ssescalarnum>);
16100 rtx par = gen_rtx_PARALLEL (<MODE>mode, vs);
16101 rtx reg = gen_reg_rtx (<MODE>mode);
16102 rtx op2 = operands[2];
16105 if (GET_MODE (op2) != <ssescalarmode>mode)
16107 op2 = gen_reg_rtx (<ssescalarmode>mode);
16108 convert_move (op2, operands[2], false);
16111 for (i = 0; i < <ssescalarnum>; i++)
16112 RTVEC_ELT (vs, i) = op2;
16114 emit_insn (gen_vec_init<mode> (reg, par));
16115 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], reg));
16120 (define_expand "rotr<mode>3"
16121 [(set (match_operand:VI_128 0 "register_operand")
16123 (match_operand:VI_128 1 "nonimmediate_operand")
16124 (match_operand:SI 2 "general_operand")))]
16127 /* If we were given a scalar, convert it to parallel */
16128 if (! const_0_to_<sserotatemax>_operand (operands[2], SImode))
16130 rtvec vs = rtvec_alloc (<ssescalarnum>);
16131 rtx par = gen_rtx_PARALLEL (<MODE>mode, vs);
16132 rtx neg = gen_reg_rtx (<MODE>mode);
16133 rtx reg = gen_reg_rtx (<MODE>mode);
16134 rtx op2 = operands[2];
16137 if (GET_MODE (op2) != <ssescalarmode>mode)
16139 op2 = gen_reg_rtx (<ssescalarmode>mode);
16140 convert_move (op2, operands[2], false);
16143 for (i = 0; i < <ssescalarnum>; i++)
16144 RTVEC_ELT (vs, i) = op2;
16146 emit_insn (gen_vec_init<mode> (reg, par));
16147 emit_insn (gen_neg<mode>2 (neg, reg));
16148 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], neg));
16153 (define_insn "xop_rotl<mode>3"
16154 [(set (match_operand:VI_128 0 "register_operand" "=x")
16156 (match_operand:VI_128 1 "nonimmediate_operand" "xm")
16157 (match_operand:SI 2 "const_0_to_<sserotatemax>_operand" "n")))]
16159 "vprot<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
16160 [(set_attr "type" "sseishft")
16161 (set_attr "length_immediate" "1")
16162 (set_attr "mode" "TI")])
16164 (define_insn "xop_rotr<mode>3"
16165 [(set (match_operand:VI_128 0 "register_operand" "=x")
16167 (match_operand:VI_128 1 "nonimmediate_operand" "xm")
16168 (match_operand:SI 2 "const_0_to_<sserotatemax>_operand" "n")))]
16172 = GEN_INT (GET_MODE_BITSIZE (<ssescalarmode>mode) - INTVAL (operands[2]));
16173 return \"vprot<ssemodesuffix>\t{%3, %1, %0|%0, %1, %3}\";
16175 [(set_attr "type" "sseishft")
16176 (set_attr "length_immediate" "1")
16177 (set_attr "mode" "TI")])
16179 (define_expand "vrotr<mode>3"
16180 [(match_operand:VI_128 0 "register_operand")
16181 (match_operand:VI_128 1 "register_operand")
16182 (match_operand:VI_128 2 "register_operand")]
16185 rtx reg = gen_reg_rtx (<MODE>mode);
16186 emit_insn (gen_neg<mode>2 (reg, operands[2]));
16187 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], reg));
16191 (define_expand "vrotl<mode>3"
16192 [(match_operand:VI_128 0 "register_operand")
16193 (match_operand:VI_128 1 "register_operand")
16194 (match_operand:VI_128 2 "register_operand")]
16197 emit_insn (gen_xop_vrotl<mode>3 (operands[0], operands[1], operands[2]));
16201 (define_insn "xop_vrotl<mode>3"
16202 [(set (match_operand:VI_128 0 "register_operand" "=x,x")
16203 (if_then_else:VI_128
16205 (match_operand:VI_128 2 "nonimmediate_operand" "x,m")
16208 (match_operand:VI_128 1 "nonimmediate_operand" "xm,x")
16212 (neg:VI_128 (match_dup 2)))))]
16213 "TARGET_XOP && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
16214 "vprot<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
16215 [(set_attr "type" "sseishft")
16216 (set_attr "prefix_data16" "0")
16217 (set_attr "prefix_extra" "2")
16218 (set_attr "mode" "TI")])
16220 ;; XOP packed shift instructions.
16221 (define_expand "vlshr<mode>3"
16222 [(set (match_operand:VI12_128 0 "register_operand")
16224 (match_operand:VI12_128 1 "register_operand")
16225 (match_operand:VI12_128 2 "nonimmediate_operand")))]
16228 rtx neg = gen_reg_rtx (<MODE>mode);
16229 emit_insn (gen_neg<mode>2 (neg, operands[2]));
16230 emit_insn (gen_xop_shl<mode>3 (operands[0], operands[1], neg));
16234 (define_expand "vlshr<mode>3"
16235 [(set (match_operand:VI48_128 0 "register_operand")
16237 (match_operand:VI48_128 1 "register_operand")
16238 (match_operand:VI48_128 2 "nonimmediate_operand")))]
16239 "TARGET_AVX2 || TARGET_XOP"
16243 rtx neg = gen_reg_rtx (<MODE>mode);
16244 emit_insn (gen_neg<mode>2 (neg, operands[2]));
16245 emit_insn (gen_xop_shl<mode>3 (operands[0], operands[1], neg));
16250 (define_expand "vlshr<mode>3"
16251 [(set (match_operand:VI48_512 0 "register_operand")
16253 (match_operand:VI48_512 1 "register_operand")
16254 (match_operand:VI48_512 2 "nonimmediate_operand")))]
16257 (define_expand "vlshr<mode>3"
16258 [(set (match_operand:VI48_256 0 "register_operand")
16260 (match_operand:VI48_256 1 "register_operand")
16261 (match_operand:VI48_256 2 "nonimmediate_operand")))]
16264 (define_expand "vashrv8hi3<mask_name>"
16265 [(set (match_operand:V8HI 0 "register_operand")
16267 (match_operand:V8HI 1 "register_operand")
16268 (match_operand:V8HI 2 "nonimmediate_operand")))]
16269 "TARGET_XOP || (TARGET_AVX512BW && TARGET_AVX512VL)"
16273 rtx neg = gen_reg_rtx (V8HImode);
16274 emit_insn (gen_negv8hi2 (neg, operands[2]));
16275 emit_insn (gen_xop_shav8hi3 (operands[0], operands[1], neg));
16280 (define_expand "vashrv16qi3"
16281 [(set (match_operand:V16QI 0 "register_operand")
16283 (match_operand:V16QI 1 "register_operand")
16284 (match_operand:V16QI 2 "nonimmediate_operand")))]
16287 rtx neg = gen_reg_rtx (V16QImode);
16288 emit_insn (gen_negv16qi2 (neg, operands[2]));
16289 emit_insn (gen_xop_shav16qi3 (operands[0], operands[1], neg));
16293 (define_expand "vashrv2di3<mask_name>"
16294 [(set (match_operand:V2DI 0 "register_operand")
16296 (match_operand:V2DI 1 "register_operand")
16297 (match_operand:V2DI 2 "nonimmediate_operand")))]
16298 "TARGET_XOP || TARGET_AVX512VL"
16302 rtx neg = gen_reg_rtx (V2DImode);
16303 emit_insn (gen_negv2di2 (neg, operands[2]));
16304 emit_insn (gen_xop_shav2di3 (operands[0], operands[1], neg));
16309 (define_expand "vashrv4si3"
16310 [(set (match_operand:V4SI 0 "register_operand")
16311 (ashiftrt:V4SI (match_operand:V4SI 1 "register_operand")
16312 (match_operand:V4SI 2 "nonimmediate_operand")))]
16313 "TARGET_AVX2 || TARGET_XOP"
16317 rtx neg = gen_reg_rtx (V4SImode);
16318 emit_insn (gen_negv4si2 (neg, operands[2]));
16319 emit_insn (gen_xop_shav4si3 (operands[0], operands[1], neg));
16324 (define_expand "vashrv16si3"
16325 [(set (match_operand:V16SI 0 "register_operand")
16326 (ashiftrt:V16SI (match_operand:V16SI 1 "register_operand")
16327 (match_operand:V16SI 2 "nonimmediate_operand")))]
16330 (define_expand "vashrv8si3"
16331 [(set (match_operand:V8SI 0 "register_operand")
16332 (ashiftrt:V8SI (match_operand:V8SI 1 "register_operand")
16333 (match_operand:V8SI 2 "nonimmediate_operand")))]
16336 (define_expand "vashl<mode>3"
16337 [(set (match_operand:VI12_128 0 "register_operand")
16339 (match_operand:VI12_128 1 "register_operand")
16340 (match_operand:VI12_128 2 "nonimmediate_operand")))]
16343 emit_insn (gen_xop_sha<mode>3 (operands[0], operands[1], operands[2]));
16347 (define_expand "vashl<mode>3"
16348 [(set (match_operand:VI48_128 0 "register_operand")
16350 (match_operand:VI48_128 1 "register_operand")
16351 (match_operand:VI48_128 2 "nonimmediate_operand")))]
16352 "TARGET_AVX2 || TARGET_XOP"
16356 operands[2] = force_reg (<MODE>mode, operands[2]);
16357 emit_insn (gen_xop_sha<mode>3 (operands[0], operands[1], operands[2]));
16362 (define_expand "vashl<mode>3"
16363 [(set (match_operand:VI48_512 0 "register_operand")
16365 (match_operand:VI48_512 1 "register_operand")
16366 (match_operand:VI48_512 2 "nonimmediate_operand")))]
16369 (define_expand "vashl<mode>3"
16370 [(set (match_operand:VI48_256 0 "register_operand")
16372 (match_operand:VI48_256 1 "register_operand")
16373 (match_operand:VI48_256 2 "nonimmediate_operand")))]
16376 (define_insn "xop_sha<mode>3"
16377 [(set (match_operand:VI_128 0 "register_operand" "=x,x")
16378 (if_then_else:VI_128
16380 (match_operand:VI_128 2 "nonimmediate_operand" "x,m")
16383 (match_operand:VI_128 1 "nonimmediate_operand" "xm,x")
16387 (neg:VI_128 (match_dup 2)))))]
16388 "TARGET_XOP && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
16389 "vpsha<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
16390 [(set_attr "type" "sseishft")
16391 (set_attr "prefix_data16" "0")
16392 (set_attr "prefix_extra" "2")
16393 (set_attr "mode" "TI")])
16395 (define_insn "xop_shl<mode>3"
16396 [(set (match_operand:VI_128 0 "register_operand" "=x,x")
16397 (if_then_else:VI_128
16399 (match_operand:VI_128 2 "nonimmediate_operand" "x,m")
16402 (match_operand:VI_128 1 "nonimmediate_operand" "xm,x")
16406 (neg:VI_128 (match_dup 2)))))]
16407 "TARGET_XOP && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
16408 "vpshl<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
16409 [(set_attr "type" "sseishft")
16410 (set_attr "prefix_data16" "0")
16411 (set_attr "prefix_extra" "2")
16412 (set_attr "mode" "TI")])
16414 (define_expand "<shift_insn><mode>3"
16415 [(set (match_operand:VI1_AVX512 0 "register_operand")
16416 (any_shift:VI1_AVX512
16417 (match_operand:VI1_AVX512 1 "register_operand")
16418 (match_operand:SI 2 "nonmemory_operand")))]
16421 if (TARGET_XOP && <MODE>mode == V16QImode)
16423 bool negate = false;
16424 rtx (*gen) (rtx, rtx, rtx);
16428 if (<CODE> != ASHIFT)
16430 if (CONST_INT_P (operands[2]))
16431 operands[2] = GEN_INT (-INTVAL (operands[2]));
16435 par = gen_rtx_PARALLEL (V16QImode, rtvec_alloc (16));
16436 for (i = 0; i < 16; i++)
16437 XVECEXP (par, 0, i) = operands[2];
16439 tmp = gen_reg_rtx (V16QImode);
16440 emit_insn (gen_vec_initv16qi (tmp, par));
16443 emit_insn (gen_negv16qi2 (tmp, tmp));
16445 gen = (<CODE> == LSHIFTRT ? gen_xop_shlv16qi3 : gen_xop_shav16qi3);
16446 emit_insn (gen (operands[0], operands[1], tmp));
16449 ix86_expand_vecop_qihi (<CODE>, operands[0], operands[1], operands[2]);
16453 (define_expand "ashrv2di3"
16454 [(set (match_operand:V2DI 0 "register_operand")
16456 (match_operand:V2DI 1 "register_operand")
16457 (match_operand:DI 2 "nonmemory_operand")))]
16458 "TARGET_XOP || TARGET_AVX512VL"
16460 if (!TARGET_AVX512VL)
16462 rtx reg = gen_reg_rtx (V2DImode);
16464 bool negate = false;
16467 if (CONST_INT_P (operands[2]))
16468 operands[2] = GEN_INT (-INTVAL (operands[2]));
16472 par = gen_rtx_PARALLEL (V2DImode, rtvec_alloc (2));
16473 for (i = 0; i < 2; i++)
16474 XVECEXP (par, 0, i) = operands[2];
16476 emit_insn (gen_vec_initv2di (reg, par));
16479 emit_insn (gen_negv2di2 (reg, reg));
16481 emit_insn (gen_xop_shav2di3 (operands[0], operands[1], reg));
16486 ;; XOP FRCZ support
16487 (define_insn "xop_frcz<mode>2"
16488 [(set (match_operand:FMAMODE 0 "register_operand" "=x")
16490 [(match_operand:FMAMODE 1 "nonimmediate_operand" "xm")]
16493 "vfrcz<ssemodesuffix>\t{%1, %0|%0, %1}"
16494 [(set_attr "type" "ssecvt1")
16495 (set_attr "mode" "<MODE>")])
16497 (define_expand "xop_vmfrcz<mode>2"
16498 [(set (match_operand:VF_128 0 "register_operand")
16501 [(match_operand:VF_128 1 "nonimmediate_operand")]
16506 "operands[2] = CONST0_RTX (<MODE>mode);")
16508 (define_insn "*xop_vmfrcz<mode>2"
16509 [(set (match_operand:VF_128 0 "register_operand" "=x")
16512 [(match_operand:VF_128 1 "nonimmediate_operand" "xm")]
16514 (match_operand:VF_128 2 "const0_operand")
16517 "vfrcz<ssescalarmodesuffix>\t{%1, %0|%0, %<iptr>1}"
16518 [(set_attr "type" "ssecvt1")
16519 (set_attr "mode" "<MODE>")])
16521 (define_insn "xop_maskcmp<mode>3"
16522 [(set (match_operand:VI_128 0 "register_operand" "=x")
16523 (match_operator:VI_128 1 "ix86_comparison_int_operator"
16524 [(match_operand:VI_128 2 "register_operand" "x")
16525 (match_operand:VI_128 3 "nonimmediate_operand" "xm")]))]
16527 "vpcom%Y1<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}"
16528 [(set_attr "type" "sse4arg")
16529 (set_attr "prefix_data16" "0")
16530 (set_attr "prefix_rep" "0")
16531 (set_attr "prefix_extra" "2")
16532 (set_attr "length_immediate" "1")
16533 (set_attr "mode" "TI")])
16535 (define_insn "xop_maskcmp_uns<mode>3"
16536 [(set (match_operand:VI_128 0 "register_operand" "=x")
16537 (match_operator:VI_128 1 "ix86_comparison_uns_operator"
16538 [(match_operand:VI_128 2 "register_operand" "x")
16539 (match_operand:VI_128 3 "nonimmediate_operand" "xm")]))]
16541 "vpcom%Y1u<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}"
16542 [(set_attr "type" "ssecmp")
16543 (set_attr "prefix_data16" "0")
16544 (set_attr "prefix_rep" "0")
16545 (set_attr "prefix_extra" "2")
16546 (set_attr "length_immediate" "1")
16547 (set_attr "mode" "TI")])
16549 ;; Version of pcom*u* that is called from the intrinsics that allows pcomequ*
16550 ;; and pcomneu* not to be converted to the signed ones in case somebody needs
16551 ;; the exact instruction generated for the intrinsic.
16552 (define_insn "xop_maskcmp_uns2<mode>3"
16553 [(set (match_operand:VI_128 0 "register_operand" "=x")
16555 [(match_operator:VI_128 1 "ix86_comparison_uns_operator"
16556 [(match_operand:VI_128 2 "register_operand" "x")
16557 (match_operand:VI_128 3 "nonimmediate_operand" "xm")])]
16558 UNSPEC_XOP_UNSIGNED_CMP))]
16560 "vpcom%Y1u<ssemodesuffix>\t{%3, %2, %0|%0, %2, %3}"
16561 [(set_attr "type" "ssecmp")
16562 (set_attr "prefix_data16" "0")
16563 (set_attr "prefix_extra" "2")
16564 (set_attr "length_immediate" "1")
16565 (set_attr "mode" "TI")])
16567 ;; Pcomtrue and pcomfalse support. These are useless instructions, but are
16568 ;; being added here to be complete.
16569 (define_insn "xop_pcom_tf<mode>3"
16570 [(set (match_operand:VI_128 0 "register_operand" "=x")
16572 [(match_operand:VI_128 1 "register_operand" "x")
16573 (match_operand:VI_128 2 "nonimmediate_operand" "xm")
16574 (match_operand:SI 3 "const_int_operand" "n")]
16575 UNSPEC_XOP_TRUEFALSE))]
16578 return ((INTVAL (operands[3]) != 0)
16579 ? "vpcomtrue<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
16580 : "vpcomfalse<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}");
16582 [(set_attr "type" "ssecmp")
16583 (set_attr "prefix_data16" "0")
16584 (set_attr "prefix_extra" "2")
16585 (set_attr "length_immediate" "1")
16586 (set_attr "mode" "TI")])
16588 (define_insn "xop_vpermil2<mode>3"
16589 [(set (match_operand:VF_128_256 0 "register_operand" "=x")
16591 [(match_operand:VF_128_256 1 "register_operand" "x")
16592 (match_operand:VF_128_256 2 "nonimmediate_operand" "%x")
16593 (match_operand:<sseintvecmode> 3 "nonimmediate_operand" "xm")
16594 (match_operand:SI 4 "const_0_to_3_operand" "n")]
16597 "vpermil2<ssemodesuffix>\t{%4, %3, %2, %1, %0|%0, %1, %2, %3, %4}"
16598 [(set_attr "type" "sse4arg")
16599 (set_attr "length_immediate" "1")
16600 (set_attr "mode" "<MODE>")])
16602 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16604 (define_insn "aesenc"
16605 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
16606 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
16607 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
16611 aesenc\t{%2, %0|%0, %2}
16612 vaesenc\t{%2, %1, %0|%0, %1, %2}"
16613 [(set_attr "isa" "noavx,avx")
16614 (set_attr "type" "sselog1")
16615 (set_attr "prefix_extra" "1")
16616 (set_attr "prefix" "orig,vex")
16617 (set_attr "btver2_decode" "double,double")
16618 (set_attr "mode" "TI")])
16620 (define_insn "aesenclast"
16621 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
16622 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
16623 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
16624 UNSPEC_AESENCLAST))]
16627 aesenclast\t{%2, %0|%0, %2}
16628 vaesenclast\t{%2, %1, %0|%0, %1, %2}"
16629 [(set_attr "isa" "noavx,avx")
16630 (set_attr "type" "sselog1")
16631 (set_attr "prefix_extra" "1")
16632 (set_attr "prefix" "orig,vex")
16633 (set_attr "btver2_decode" "double,double")
16634 (set_attr "mode" "TI")])
16636 (define_insn "aesdec"
16637 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
16638 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
16639 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
16643 aesdec\t{%2, %0|%0, %2}
16644 vaesdec\t{%2, %1, %0|%0, %1, %2}"
16645 [(set_attr "isa" "noavx,avx")
16646 (set_attr "type" "sselog1")
16647 (set_attr "prefix_extra" "1")
16648 (set_attr "prefix" "orig,vex")
16649 (set_attr "btver2_decode" "double,double")
16650 (set_attr "mode" "TI")])
16652 (define_insn "aesdeclast"
16653 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
16654 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
16655 (match_operand:V2DI 2 "vector_operand" "xBm,xm")]
16656 UNSPEC_AESDECLAST))]
16659 aesdeclast\t{%2, %0|%0, %2}
16660 vaesdeclast\t{%2, %1, %0|%0, %1, %2}"
16661 [(set_attr "isa" "noavx,avx")
16662 (set_attr "type" "sselog1")
16663 (set_attr "prefix_extra" "1")
16664 (set_attr "prefix" "orig,vex")
16665 (set_attr "btver2_decode" "double,double")
16666 (set_attr "mode" "TI")])
16668 (define_insn "aesimc"
16669 [(set (match_operand:V2DI 0 "register_operand" "=x")
16670 (unspec:V2DI [(match_operand:V2DI 1 "vector_operand" "xBm")]
16673 "%vaesimc\t{%1, %0|%0, %1}"
16674 [(set_attr "type" "sselog1")
16675 (set_attr "prefix_extra" "1")
16676 (set_attr "prefix" "maybe_vex")
16677 (set_attr "mode" "TI")])
16679 (define_insn "aeskeygenassist"
16680 [(set (match_operand:V2DI 0 "register_operand" "=x")
16681 (unspec:V2DI [(match_operand:V2DI 1 "vector_operand" "xBm")
16682 (match_operand:SI 2 "const_0_to_255_operand" "n")]
16683 UNSPEC_AESKEYGENASSIST))]
16685 "%vaeskeygenassist\t{%2, %1, %0|%0, %1, %2}"
16686 [(set_attr "type" "sselog1")
16687 (set_attr "prefix_extra" "1")
16688 (set_attr "length_immediate" "1")
16689 (set_attr "prefix" "maybe_vex")
16690 (set_attr "mode" "TI")])
16692 (define_insn "pclmulqdq"
16693 [(set (match_operand:V2DI 0 "register_operand" "=x,x")
16694 (unspec:V2DI [(match_operand:V2DI 1 "register_operand" "0,x")
16695 (match_operand:V2DI 2 "vector_operand" "xBm,xm")
16696 (match_operand:SI 3 "const_0_to_255_operand" "n,n")]
16700 pclmulqdq\t{%3, %2, %0|%0, %2, %3}
16701 vpclmulqdq\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16702 [(set_attr "isa" "noavx,avx")
16703 (set_attr "type" "sselog1")
16704 (set_attr "prefix_extra" "1")
16705 (set_attr "length_immediate" "1")
16706 (set_attr "prefix" "orig,vex")
16707 (set_attr "mode" "TI")])
16709 (define_expand "avx_vzeroall"
16710 [(match_par_dup 0 [(const_int 0)])]
16713 int nregs = TARGET_64BIT ? 16 : 8;
16716 operands[0] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (nregs + 1));
16718 XVECEXP (operands[0], 0, 0)
16719 = gen_rtx_UNSPEC_VOLATILE (VOIDmode, gen_rtvec (1, const0_rtx),
16722 for (regno = 0; regno < nregs; regno++)
16723 XVECEXP (operands[0], 0, regno + 1)
16724 = gen_rtx_SET (gen_rtx_REG (V8SImode, SSE_REGNO (regno)),
16725 CONST0_RTX (V8SImode));
16728 (define_insn "*avx_vzeroall"
16729 [(match_parallel 0 "vzeroall_operation"
16730 [(unspec_volatile [(const_int 0)] UNSPECV_VZEROALL)])]
16733 [(set_attr "type" "sse")
16734 (set_attr "modrm" "0")
16735 (set_attr "memory" "none")
16736 (set_attr "prefix" "vex")
16737 (set_attr "btver2_decode" "vector")
16738 (set_attr "mode" "OI")])
16740 ;; Clear the upper 128bits of AVX registers, equivalent to a NOP
16741 ;; if the upper 128bits are unused.
16742 (define_insn "avx_vzeroupper"
16743 [(unspec_volatile [(const_int 0)] UNSPECV_VZEROUPPER)]
16746 [(set_attr "type" "sse")
16747 (set_attr "modrm" "0")
16748 (set_attr "memory" "none")
16749 (set_attr "prefix" "vex")
16750 (set_attr "btver2_decode" "vector")
16751 (set_attr "mode" "OI")])
16753 (define_mode_attr pbroadcast_evex_isa
16754 [(V64QI "avx512bw") (V32QI "avx512bw") (V16QI "avx512bw")
16755 (V32HI "avx512bw") (V16HI "avx512bw") (V8HI "avx512bw")
16756 (V16SI "avx512f") (V8SI "avx512f") (V4SI "avx512f")
16757 (V8DI "avx512f") (V4DI "avx512f") (V2DI "avx512f")])
16759 (define_insn "avx2_pbroadcast<mode>"
16760 [(set (match_operand:VI 0 "register_operand" "=x,v")
16762 (vec_select:<ssescalarmode>
16763 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "xm,vm")
16764 (parallel [(const_int 0)]))))]
16766 "vpbroadcast<ssemodesuffix>\t{%1, %0|%0, %<iptr>1}"
16767 [(set_attr "isa" "*,<pbroadcast_evex_isa>")
16768 (set_attr "type" "ssemov")
16769 (set_attr "prefix_extra" "1")
16770 (set_attr "prefix" "vex,evex")
16771 (set_attr "mode" "<sseinsnmode>")])
16773 (define_insn "avx2_pbroadcast<mode>_1"
16774 [(set (match_operand:VI_256 0 "register_operand" "=x,x,v,v")
16775 (vec_duplicate:VI_256
16776 (vec_select:<ssescalarmode>
16777 (match_operand:VI_256 1 "nonimmediate_operand" "m,x,m,v")
16778 (parallel [(const_int 0)]))))]
16781 vpbroadcast<ssemodesuffix>\t{%1, %0|%0, %<iptr>1}
16782 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %x1}
16783 vpbroadcast<ssemodesuffix>\t{%1, %0|%0, %<iptr>1}
16784 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %x1}"
16785 [(set_attr "isa" "*,*,<pbroadcast_evex_isa>,<pbroadcast_evex_isa>")
16786 (set_attr "type" "ssemov")
16787 (set_attr "prefix_extra" "1")
16788 (set_attr "prefix" "vex")
16789 (set_attr "mode" "<sseinsnmode>")])
16791 (define_insn "<avx2_avx512>_permvar<mode><mask_name>"
16792 [(set (match_operand:VI48F_256_512 0 "register_operand" "=v")
16793 (unspec:VI48F_256_512
16794 [(match_operand:VI48F_256_512 1 "nonimmediate_operand" "vm")
16795 (match_operand:<sseintvecmode> 2 "register_operand" "v")]
16797 "TARGET_AVX2 && <mask_mode512bit_condition>"
16798 "vperm<ssemodesuffix>\t{%1, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1}"
16799 [(set_attr "type" "sselog")
16800 (set_attr "prefix" "<mask_prefix2>")
16801 (set_attr "mode" "<sseinsnmode>")])
16803 (define_insn "<avx512>_permvar<mode><mask_name>"
16804 [(set (match_operand:VI1_AVX512VL 0 "register_operand" "=v")
16805 (unspec:VI1_AVX512VL
16806 [(match_operand:VI1_AVX512VL 1 "nonimmediate_operand" "vm")
16807 (match_operand:<sseintvecmode> 2 "register_operand" "v")]
16809 "TARGET_AVX512VBMI && <mask_mode512bit_condition>"
16810 "vperm<ssemodesuffix>\t{%1, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1}"
16811 [(set_attr "type" "sselog")
16812 (set_attr "prefix" "<mask_prefix2>")
16813 (set_attr "mode" "<sseinsnmode>")])
16815 (define_insn "<avx512>_permvar<mode><mask_name>"
16816 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
16817 (unspec:VI2_AVX512VL
16818 [(match_operand:VI2_AVX512VL 1 "nonimmediate_operand" "vm")
16819 (match_operand:<sseintvecmode> 2 "register_operand" "v")]
16821 "TARGET_AVX512BW && <mask_mode512bit_condition>"
16822 "vperm<ssemodesuffix>\t{%1, %2, %0<mask_operand3>|%0<mask_operand3>, %2, %1}"
16823 [(set_attr "type" "sselog")
16824 (set_attr "prefix" "<mask_prefix2>")
16825 (set_attr "mode" "<sseinsnmode>")])
16827 (define_expand "<avx2_avx512>_perm<mode>"
16828 [(match_operand:VI8F_256_512 0 "register_operand")
16829 (match_operand:VI8F_256_512 1 "nonimmediate_operand")
16830 (match_operand:SI 2 "const_0_to_255_operand")]
16833 int mask = INTVAL (operands[2]);
16834 emit_insn (gen_<avx2_avx512>_perm<mode>_1 (operands[0], operands[1],
16835 GEN_INT ((mask >> 0) & 3),
16836 GEN_INT ((mask >> 2) & 3),
16837 GEN_INT ((mask >> 4) & 3),
16838 GEN_INT ((mask >> 6) & 3)));
16842 (define_expand "<avx512>_perm<mode>_mask"
16843 [(match_operand:VI8F_256_512 0 "register_operand")
16844 (match_operand:VI8F_256_512 1 "nonimmediate_operand")
16845 (match_operand:SI 2 "const_0_to_255_operand")
16846 (match_operand:VI8F_256_512 3 "vector_move_operand")
16847 (match_operand:<avx512fmaskmode> 4 "register_operand")]
16850 int mask = INTVAL (operands[2]);
16851 emit_insn (gen_<avx2_avx512>_perm<mode>_1_mask (operands[0], operands[1],
16852 GEN_INT ((mask >> 0) & 3),
16853 GEN_INT ((mask >> 2) & 3),
16854 GEN_INT ((mask >> 4) & 3),
16855 GEN_INT ((mask >> 6) & 3),
16856 operands[3], operands[4]));
16860 (define_insn "<avx2_avx512>_perm<mode>_1<mask_name>"
16861 [(set (match_operand:VI8F_256_512 0 "register_operand" "=v")
16862 (vec_select:VI8F_256_512
16863 (match_operand:VI8F_256_512 1 "nonimmediate_operand" "vm")
16864 (parallel [(match_operand 2 "const_0_to_3_operand")
16865 (match_operand 3 "const_0_to_3_operand")
16866 (match_operand 4 "const_0_to_3_operand")
16867 (match_operand 5 "const_0_to_3_operand")])))]
16868 "TARGET_AVX2 && <mask_mode512bit_condition>"
16871 mask |= INTVAL (operands[2]) << 0;
16872 mask |= INTVAL (operands[3]) << 2;
16873 mask |= INTVAL (operands[4]) << 4;
16874 mask |= INTVAL (operands[5]) << 6;
16875 operands[2] = GEN_INT (mask);
16876 return "vperm<ssemodesuffix>\t{%2, %1, %0<mask_operand6>|%0<mask_operand6>, %1, %2}";
16878 [(set_attr "type" "sselog")
16879 (set_attr "prefix" "<mask_prefix2>")
16880 (set_attr "mode" "<sseinsnmode>")])
16882 (define_insn "avx2_permv2ti"
16883 [(set (match_operand:V4DI 0 "register_operand" "=x")
16885 [(match_operand:V4DI 1 "register_operand" "x")
16886 (match_operand:V4DI 2 "nonimmediate_operand" "xm")
16887 (match_operand:SI 3 "const_0_to_255_operand" "n")]
16890 "vperm2i128\t{%3, %2, %1, %0|%0, %1, %2, %3}"
16891 [(set_attr "type" "sselog")
16892 (set_attr "prefix" "vex")
16893 (set_attr "mode" "OI")])
16895 (define_insn "avx2_vec_dupv4df"
16896 [(set (match_operand:V4DF 0 "register_operand" "=v")
16897 (vec_duplicate:V4DF
16899 (match_operand:V2DF 1 "register_operand" "v")
16900 (parallel [(const_int 0)]))))]
16902 "vbroadcastsd\t{%1, %0|%0, %1}"
16903 [(set_attr "type" "sselog1")
16904 (set_attr "prefix" "maybe_evex")
16905 (set_attr "mode" "V4DF")])
16907 (define_insn "<avx512>_vec_dup<mode>_1"
16908 [(set (match_operand:VI_AVX512BW 0 "register_operand" "=v,v")
16909 (vec_duplicate:VI_AVX512BW
16910 (vec_select:VI_AVX512BW
16911 (match_operand:VI_AVX512BW 1 "nonimmediate_operand" "v,m")
16912 (parallel [(const_int 0)]))))]
16915 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %x1}
16916 vpbroadcast<ssemodesuffix>\t{%x1, %0|%0, %<iptr>1}"
16917 [(set_attr "type" "ssemov")
16918 (set_attr "prefix" "evex")
16919 (set_attr "mode" "<sseinsnmode>")])
16921 (define_insn "<avx512>_vec_dup<mode><mask_name>"
16922 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v")
16923 (vec_duplicate:V48_AVX512VL
16924 (vec_select:<ssescalarmode>
16925 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "vm")
16926 (parallel [(const_int 0)]))))]
16929 /* There is no DF broadcast (in AVX-512*) to 128b register.
16930 Mimic it with integer variant. */
16931 if (<MODE>mode == V2DFmode)
16932 return "vpbroadcastq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}";
16934 if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 4)
16935 return "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}";
16937 return "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}";
16939 [(set_attr "type" "ssemov")
16940 (set_attr "prefix" "evex")
16941 (set_attr "mode" "<sseinsnmode>")])
16943 (define_insn "<avx512>_vec_dup<mode><mask_name>"
16944 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v")
16945 (vec_duplicate:VI12_AVX512VL
16946 (vec_select:<ssescalarmode>
16947 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "vm")
16948 (parallel [(const_int 0)]))))]
16950 "vpbroadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
16951 [(set_attr "type" "ssemov")
16952 (set_attr "prefix" "evex")
16953 (set_attr "mode" "<sseinsnmode>")])
16955 (define_insn "<mask_codefor>avx512f_broadcast<mode><mask_name>"
16956 [(set (match_operand:V16FI 0 "register_operand" "=v,v")
16957 (vec_duplicate:V16FI
16958 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "v,m")))]
16961 vshuf<shuffletype>32x4\t{$0x0, %g1, %g1, %0<mask_operand2>|%0<mask_operand2>, %g1, %g1, 0x0}
16962 vbroadcast<shuffletype>32x4\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
16963 [(set_attr "type" "ssemov")
16964 (set_attr "prefix" "evex")
16965 (set_attr "mode" "<sseinsnmode>")])
16967 (define_insn "<mask_codefor>avx512f_broadcast<mode><mask_name>"
16968 [(set (match_operand:V8FI 0 "register_operand" "=v,v")
16969 (vec_duplicate:V8FI
16970 (match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "v,m")))]
16973 vshuf<shuffletype>64x2\t{$0x44, %g1, %g1, %0<mask_operand2>|%0<mask_operand2>, %g1, %g1, 0x44}
16974 vbroadcast<shuffletype>64x4\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
16975 [(set_attr "type" "ssemov")
16976 (set_attr "prefix" "evex")
16977 (set_attr "mode" "<sseinsnmode>")])
16979 (define_insn "<mask_codefor><avx512>_vec_dup_gpr<mode><mask_name>"
16980 [(set (match_operand:VI12_AVX512VL 0 "register_operand" "=v,v")
16981 (vec_duplicate:VI12_AVX512VL
16982 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "vm,r")))]
16985 vpbroadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}
16986 vpbroadcast<bcstscalarsuff>\t{%k1, %0<mask_operand2>|%0<mask_operand2>, %k1}"
16987 [(set_attr "type" "ssemov")
16988 (set_attr "prefix" "evex")
16989 (set_attr "mode" "<sseinsnmode>")])
16991 (define_insn "<mask_codefor><avx512>_vec_dup_gpr<mode><mask_name>"
16992 [(set (match_operand:V48_AVX512VL 0 "register_operand" "=v,v")
16993 (vec_duplicate:V48_AVX512VL
16994 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "vm,r")))]
16996 "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
16997 [(set_attr "type" "ssemov")
16998 (set_attr "prefix" "evex")
16999 (set_attr "mode" "<sseinsnmode>")
17000 (set (attr "enabled")
17001 (if_then_else (eq_attr "alternative" "1")
17002 (symbol_ref "GET_MODE_CLASS (<ssescalarmode>mode) == MODE_INT
17003 && (<ssescalarmode>mode != DImode || TARGET_64BIT)")
17006 (define_insn "vec_dupv4sf"
17007 [(set (match_operand:V4SF 0 "register_operand" "=v,v,x")
17008 (vec_duplicate:V4SF
17009 (match_operand:SF 1 "nonimmediate_operand" "Yv,m,0")))]
17012 vshufps\t{$0, %1, %1, %0|%0, %1, %1, 0}
17013 vbroadcastss\t{%1, %0|%0, %1}
17014 shufps\t{$0, %0, %0|%0, %0, 0}"
17015 [(set_attr "isa" "avx,avx,noavx")
17016 (set_attr "type" "sseshuf1,ssemov,sseshuf1")
17017 (set_attr "length_immediate" "1,0,1")
17018 (set_attr "prefix_extra" "0,1,*")
17019 (set_attr "prefix" "maybe_evex,maybe_evex,orig")
17020 (set_attr "mode" "V4SF")])
17022 (define_insn "*vec_dupv4si"
17023 [(set (match_operand:V4SI 0 "register_operand" "=v,v,x")
17024 (vec_duplicate:V4SI
17025 (match_operand:SI 1 "nonimmediate_operand" "Yv,m,0")))]
17028 %vpshufd\t{$0, %1, %0|%0, %1, 0}
17029 vbroadcastss\t{%1, %0|%0, %1}
17030 shufps\t{$0, %0, %0|%0, %0, 0}"
17031 [(set_attr "isa" "sse2,avx,noavx")
17032 (set_attr "type" "sselog1,ssemov,sselog1")
17033 (set_attr "length_immediate" "1,0,1")
17034 (set_attr "prefix_extra" "0,1,*")
17035 (set_attr "prefix" "maybe_vex,maybe_evex,orig")
17036 (set_attr "mode" "TI,V4SF,V4SF")])
17038 (define_insn "*vec_dupv2di"
17039 [(set (match_operand:V2DI 0 "register_operand" "=x,v,v,x")
17040 (vec_duplicate:V2DI
17041 (match_operand:DI 1 "nonimmediate_operand" " 0,Yv,m,0")))]
17045 vpunpcklqdq\t{%d1, %0|%0, %d1}
17046 %vmovddup\t{%1, %0|%0, %1}
17048 [(set_attr "isa" "sse2_noavx,avx,sse3,noavx")
17049 (set_attr "type" "sselog1,sselog1,sselog1,ssemov")
17050 (set_attr "prefix" "orig,maybe_evex,maybe_vex,orig")
17051 (set_attr "mode" "TI,TI,DF,V4SF")])
17053 (define_insn "avx2_vbroadcasti128_<mode>"
17054 [(set (match_operand:VI_256 0 "register_operand" "=x,v,v")
17056 (match_operand:<ssehalfvecmode> 1 "memory_operand" "m,m,m")
17060 vbroadcasti128\t{%1, %0|%0, %1}
17061 vbroadcast<i128vldq>\t{%1, %0|%0, %1}
17062 vbroadcast<shuffletype>32x4\t{%1, %0|%0, %1}"
17063 [(set_attr "isa" "*,avx512dq,avx512vl")
17064 (set_attr "type" "ssemov")
17065 (set_attr "prefix_extra" "1")
17066 (set_attr "prefix" "vex,evex,evex")
17067 (set_attr "mode" "OI")])
17069 ;; Modes handled by AVX vec_dup patterns.
17070 (define_mode_iterator AVX_VEC_DUP_MODE
17071 [V8SI V8SF V4DI V4DF])
17072 ;; Modes handled by AVX2 vec_dup patterns.
17073 (define_mode_iterator AVX2_VEC_DUP_MODE
17074 [V32QI V16QI V16HI V8HI V8SI V4SI])
17076 (define_insn "*vec_dup<mode>"
17077 [(set (match_operand:AVX2_VEC_DUP_MODE 0 "register_operand" "=x,x,Yi")
17078 (vec_duplicate:AVX2_VEC_DUP_MODE
17079 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "m,x,$r")))]
17082 v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0|%0, %1}
17083 v<sseintprefix>broadcast<bcstscalarsuff>\t{%x1, %0|%0, %x1}
17085 [(set_attr "isa" "*,*,noavx512vl")
17086 (set_attr "type" "ssemov")
17087 (set_attr "prefix_extra" "1")
17088 (set_attr "prefix" "maybe_evex")
17089 (set_attr "mode" "<sseinsnmode>")])
17091 (define_insn "vec_dup<mode>"
17092 [(set (match_operand:AVX_VEC_DUP_MODE 0 "register_operand" "=x,x,x,v,x")
17093 (vec_duplicate:AVX_VEC_DUP_MODE
17094 (match_operand:<ssescalarmode> 1 "nonimmediate_operand" "m,m,x,v,?x")))]
17097 v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0|%0, %1}
17098 vbroadcast<ssescalarmodesuffix>\t{%1, %0|%0, %1}
17099 v<sseintprefix>broadcast<bcstscalarsuff>\t{%x1, %0|%0, %x1}
17100 v<sseintprefix>broadcast<bcstscalarsuff>\t{%x1, %g0|%g0, %x1}
17102 [(set_attr "type" "ssemov")
17103 (set_attr "prefix_extra" "1")
17104 (set_attr "prefix" "maybe_evex")
17105 (set_attr "isa" "avx2,noavx2,avx2,avx512f,noavx2")
17106 (set_attr "mode" "<sseinsnmode>,V8SF,<sseinsnmode>,<sseinsnmode>,V8SF")])
17109 [(set (match_operand:AVX2_VEC_DUP_MODE 0 "register_operand")
17110 (vec_duplicate:AVX2_VEC_DUP_MODE
17111 (match_operand:<ssescalarmode> 1 "register_operand")))]
17113 /* Disable this splitter if avx512vl_vec_dup_gprv*[qhs]i insn is
17114 available, because then we can broadcast from GPRs directly.
17115 For V*[QH]I modes it requires both -mavx512vl and -mavx512bw,
17116 for V*SI mode it requires just -mavx512vl. */
17117 && !(TARGET_AVX512VL
17118 && (TARGET_AVX512BW || <ssescalarmode>mode == SImode))
17119 && reload_completed && GENERAL_REG_P (operands[1])"
17122 emit_insn (gen_vec_setv4si_0 (gen_lowpart (V4SImode, operands[0]),
17123 CONST0_RTX (V4SImode),
17124 gen_lowpart (SImode, operands[1])));
17125 emit_insn (gen_avx2_pbroadcast<mode> (operands[0],
17126 gen_lowpart (<ssexmmmode>mode,
17132 [(set (match_operand:AVX_VEC_DUP_MODE 0 "register_operand")
17133 (vec_duplicate:AVX_VEC_DUP_MODE
17134 (match_operand:<ssescalarmode> 1 "register_operand")))]
17135 "TARGET_AVX && !TARGET_AVX2 && reload_completed"
17136 [(set (match_dup 2)
17137 (vec_duplicate:<ssehalfvecmode> (match_dup 1)))
17139 (vec_concat:AVX_VEC_DUP_MODE (match_dup 2) (match_dup 2)))]
17140 "operands[2] = gen_lowpart (<ssehalfvecmode>mode, operands[0]);")
17142 (define_insn "avx_vbroadcastf128_<mode>"
17143 [(set (match_operand:V_256 0 "register_operand" "=x,x,x,v,v,v,v")
17145 (match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "m,0,?x,m,0,m,0")
17149 vbroadcast<i128>\t{%1, %0|%0, %1}
17150 vinsert<i128>\t{$1, %1, %0, %0|%0, %0, %1, 1}
17151 vperm2<i128>\t{$0, %t1, %t1, %0|%0, %t1, %t1, 0}
17152 vbroadcast<i128vldq>\t{%1, %0|%0, %1}
17153 vinsert<i128vldq>\t{$1, %1, %0, %0|%0, %0, %1, 1}
17154 vbroadcast<shuffletype>32x4\t{%1, %0|%0, %1}
17155 vinsert<shuffletype>32x4\t{$1, %1, %0, %0|%0, %0, %1, 1}"
17156 [(set_attr "isa" "*,*,*,avx512dq,avx512dq,avx512vl,avx512vl")
17157 (set_attr "type" "ssemov,sselog1,sselog1,ssemov,sselog1,ssemov,sselog1")
17158 (set_attr "prefix_extra" "1")
17159 (set_attr "length_immediate" "0,1,1,0,1,0,1")
17160 (set_attr "prefix" "vex,vex,vex,evex,evex,evex,evex")
17161 (set_attr "mode" "<sseinsnmode>")])
17163 ;; For broadcast[i|f]32x2. Yes there is no v4sf version, only v4si.
17164 (define_mode_iterator VI4F_BRCST32x2
17165 [V16SI (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL")
17166 V16SF (V8SF "TARGET_AVX512VL")])
17168 (define_mode_attr 64x2mode
17169 [(V8DF "V2DF") (V8DI "V2DI") (V4DI "V2DI") (V4DF "V2DF")])
17171 (define_mode_attr 32x2mode
17172 [(V16SF "V2SF") (V16SI "V2SI") (V8SI "V2SI")
17173 (V8SF "V2SF") (V4SI "V2SI")])
17175 (define_insn "<mask_codefor>avx512dq_broadcast<mode><mask_name>"
17176 [(set (match_operand:VI4F_BRCST32x2 0 "register_operand" "=v")
17177 (vec_duplicate:VI4F_BRCST32x2
17178 (vec_select:<32x2mode>
17179 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "vm")
17180 (parallel [(const_int 0) (const_int 1)]))))]
17182 "vbroadcast<shuffletype>32x2\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"
17183 [(set_attr "type" "ssemov")
17184 (set_attr "prefix_extra" "1")
17185 (set_attr "prefix" "evex")
17186 (set_attr "mode" "<sseinsnmode>")])
17188 (define_insn "<mask_codefor>avx512vl_broadcast<mode><mask_name>_1"
17189 [(set (match_operand:VI4F_256 0 "register_operand" "=v,v")
17190 (vec_duplicate:VI4F_256
17191 (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "v,m")))]
17194 vshuf<shuffletype>32x4\t{$0x0, %t1, %t1, %0<mask_operand2>|%0<mask_operand2>, %t1, %t1, 0x0}
17195 vbroadcast<shuffletype>32x4\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17196 [(set_attr "type" "ssemov")
17197 (set_attr "prefix_extra" "1")
17198 (set_attr "prefix" "evex")
17199 (set_attr "mode" "<sseinsnmode>")])
17201 (define_insn "<mask_codefor>avx512dq_broadcast<mode><mask_name>_1"
17202 [(set (match_operand:V16FI 0 "register_operand" "=v,v")
17203 (vec_duplicate:V16FI
17204 (match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "v,m")))]
17207 vshuf<shuffletype>32x4\t{$0x44, %g1, %g1, %0<mask_operand2>|%0<mask_operand2>, %g1, %g1, 0x44}
17208 vbroadcast<shuffletype>32x8\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17209 [(set_attr "type" "ssemov")
17210 (set_attr "prefix_extra" "1")
17211 (set_attr "prefix" "evex")
17212 (set_attr "mode" "<sseinsnmode>")])
17214 ;; For broadcast[i|f]64x2
17215 (define_mode_iterator VI8F_BRCST64x2
17216 [V8DI V8DF (V4DI "TARGET_AVX512VL") (V4DF "TARGET_AVX512VL")])
17218 (define_insn "<mask_codefor>avx512dq_broadcast<mode><mask_name>_1"
17219 [(set (match_operand:VI8F_BRCST64x2 0 "register_operand" "=v,v")
17220 (vec_duplicate:VI8F_BRCST64x2
17221 (match_operand:<64x2mode> 1 "nonimmediate_operand" "v,m")))]
17224 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}
17225 vbroadcast<shuffletype>64x2\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
17226 [(set_attr "type" "ssemov")
17227 (set_attr "prefix_extra" "1")
17228 (set_attr "prefix" "evex")
17229 (set_attr "mode" "<sseinsnmode>")])
17231 (define_insn "avx512cd_maskb_vec_dup<mode>"
17232 [(set (match_operand:VI8_AVX512VL 0 "register_operand" "=v")
17233 (vec_duplicate:VI8_AVX512VL
17235 (match_operand:QI 1 "register_operand" "Yk"))))]
17237 "vpbroadcastmb2q\t{%1, %0|%0, %1}"
17238 [(set_attr "type" "mskmov")
17239 (set_attr "prefix" "evex")
17240 (set_attr "mode" "XI")])
17242 (define_insn "avx512cd_maskw_vec_dup<mode>"
17243 [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v")
17244 (vec_duplicate:VI4_AVX512VL
17246 (match_operand:HI 1 "register_operand" "Yk"))))]
17248 "vpbroadcastmw2d\t{%1, %0|%0, %1}"
17249 [(set_attr "type" "mskmov")
17250 (set_attr "prefix" "evex")
17251 (set_attr "mode" "XI")])
17253 ;; Recognize broadcast as a vec_select as produced by builtin_vec_perm.
17254 ;; If it so happens that the input is in memory, use vbroadcast.
17255 ;; Otherwise use vpermilp (and in the case of 256-bit modes, vperm2f128).
17256 (define_insn "*avx_vperm_broadcast_v4sf"
17257 [(set (match_operand:V4SF 0 "register_operand" "=x,x,x")
17259 (match_operand:V4SF 1 "nonimmediate_operand" "m,o,x")
17260 (match_parallel 2 "avx_vbroadcast_operand"
17261 [(match_operand 3 "const_int_operand" "C,n,n")])))]
17264 int elt = INTVAL (operands[3]);
17265 switch (which_alternative)
17269 operands[1] = adjust_address_nv (operands[1], SFmode, elt * 4);
17270 return "vbroadcastss\t{%1, %0|%0, %k1}";
17272 operands[2] = GEN_INT (elt * 0x55);
17273 return "vpermilps\t{%2, %1, %0|%0, %1, %2}";
17275 gcc_unreachable ();
17278 [(set_attr "type" "ssemov,ssemov,sselog1")
17279 (set_attr "prefix_extra" "1")
17280 (set_attr "length_immediate" "0,0,1")
17281 (set_attr "prefix" "vex")
17282 (set_attr "mode" "SF,SF,V4SF")])
17284 (define_insn_and_split "*avx_vperm_broadcast_<mode>"
17285 [(set (match_operand:VF_256 0 "register_operand" "=x,x,x")
17287 (match_operand:VF_256 1 "nonimmediate_operand" "m,o,?x")
17288 (match_parallel 2 "avx_vbroadcast_operand"
17289 [(match_operand 3 "const_int_operand" "C,n,n")])))]
17292 "&& reload_completed && (<MODE>mode != V4DFmode || !TARGET_AVX2)"
17293 [(set (match_dup 0) (vec_duplicate:VF_256 (match_dup 1)))]
17295 rtx op0 = operands[0], op1 = operands[1];
17296 int elt = INTVAL (operands[3]);
17302 if (TARGET_AVX2 && elt == 0)
17304 emit_insn (gen_vec_dup<mode> (op0, gen_lowpart (<ssescalarmode>mode,
17309 /* Shuffle element we care about into all elements of the 128-bit lane.
17310 The other lane gets shuffled too, but we don't care. */
17311 if (<MODE>mode == V4DFmode)
17312 mask = (elt & 1 ? 15 : 0);
17314 mask = (elt & 3) * 0x55;
17315 emit_insn (gen_avx_vpermil<mode> (op0, op1, GEN_INT (mask)));
17317 /* Shuffle the lane we care about into both lanes of the dest. */
17318 mask = (elt / (<ssescalarnum> / 2)) * 0x11;
17319 emit_insn (gen_avx_vperm2f128<mode>3 (op0, op0, op0, GEN_INT (mask)));
17323 operands[1] = adjust_address (op1, <ssescalarmode>mode,
17324 elt * GET_MODE_SIZE (<ssescalarmode>mode));
17327 (define_expand "<sse2_avx_avx512f>_vpermil<mode><mask_name>"
17328 [(set (match_operand:VF2 0 "register_operand")
17330 (match_operand:VF2 1 "nonimmediate_operand")
17331 (match_operand:SI 2 "const_0_to_255_operand")))]
17332 "TARGET_AVX && <mask_mode512bit_condition>"
17334 int mask = INTVAL (operands[2]);
17335 rtx perm[<ssescalarnum>];
17338 for (i = 0; i < <ssescalarnum>; i = i + 2)
17340 perm[i] = GEN_INT (((mask >> i) & 1) + i);
17341 perm[i + 1] = GEN_INT (((mask >> (i + 1)) & 1) + i);
17345 = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (<ssescalarnum>, perm));
17348 (define_expand "<sse2_avx_avx512f>_vpermil<mode><mask_name>"
17349 [(set (match_operand:VF1 0 "register_operand")
17351 (match_operand:VF1 1 "nonimmediate_operand")
17352 (match_operand:SI 2 "const_0_to_255_operand")))]
17353 "TARGET_AVX && <mask_mode512bit_condition>"
17355 int mask = INTVAL (operands[2]);
17356 rtx perm[<ssescalarnum>];
17359 for (i = 0; i < <ssescalarnum>; i = i + 4)
17361 perm[i] = GEN_INT (((mask >> 0) & 3) + i);
17362 perm[i + 1] = GEN_INT (((mask >> 2) & 3) + i);
17363 perm[i + 2] = GEN_INT (((mask >> 4) & 3) + i);
17364 perm[i + 3] = GEN_INT (((mask >> 6) & 3) + i);
17368 = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (<ssescalarnum>, perm));
17371 (define_insn "*<sse2_avx_avx512f>_vpermilp<mode><mask_name>"
17372 [(set (match_operand:VF 0 "register_operand" "=v")
17374 (match_operand:VF 1 "nonimmediate_operand" "vm")
17375 (match_parallel 2 ""
17376 [(match_operand 3 "const_int_operand")])))]
17377 "TARGET_AVX && <mask_mode512bit_condition>
17378 && avx_vpermilp_parallel (operands[2], <MODE>mode)"
17380 int mask = avx_vpermilp_parallel (operands[2], <MODE>mode) - 1;
17381 operands[2] = GEN_INT (mask);
17382 return "vpermil<ssemodesuffix>\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}";
17384 [(set_attr "type" "sselog")
17385 (set_attr "prefix_extra" "1")
17386 (set_attr "length_immediate" "1")
17387 (set_attr "prefix" "<mask_prefix>")
17388 (set_attr "mode" "<sseinsnmode>")])
17390 (define_insn "<sse2_avx_avx512f>_vpermilvar<mode>3<mask_name>"
17391 [(set (match_operand:VF 0 "register_operand" "=v")
17393 [(match_operand:VF 1 "register_operand" "v")
17394 (match_operand:<sseintvecmode> 2 "nonimmediate_operand" "vm")]
17396 "TARGET_AVX && <mask_mode512bit_condition>"
17397 "vpermil<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
17398 [(set_attr "type" "sselog")
17399 (set_attr "prefix_extra" "1")
17400 (set_attr "btver2_decode" "vector")
17401 (set_attr "prefix" "<mask_prefix>")
17402 (set_attr "mode" "<sseinsnmode>")])
17404 (define_expand "<avx512>_vpermi2var<mode>3_maskz"
17405 [(match_operand:VI48F 0 "register_operand")
17406 (match_operand:VI48F 1 "register_operand")
17407 (match_operand:<sseintvecmode> 2 "register_operand")
17408 (match_operand:VI48F 3 "nonimmediate_operand")
17409 (match_operand:<avx512fmaskmode> 4 "register_operand")]
17412 emit_insn (gen_<avx512>_vpermi2var<mode>3_maskz_1 (
17413 operands[0], operands[1], operands[2], operands[3],
17414 CONST0_RTX (<MODE>mode), operands[4]));
17418 (define_expand "<avx512>_vpermi2var<mode>3_maskz"
17419 [(match_operand:VI1_AVX512VL 0 "register_operand")
17420 (match_operand:VI1_AVX512VL 1 "register_operand")
17421 (match_operand:<sseintvecmode> 2 "register_operand")
17422 (match_operand:VI1_AVX512VL 3 "nonimmediate_operand")
17423 (match_operand:<avx512fmaskmode> 4 "register_operand")]
17424 "TARGET_AVX512VBMI"
17426 emit_insn (gen_<avx512>_vpermi2var<mode>3_maskz_1 (
17427 operands[0], operands[1], operands[2], operands[3],
17428 CONST0_RTX (<MODE>mode), operands[4]));
17432 (define_expand "<avx512>_vpermi2var<mode>3_maskz"
17433 [(match_operand:VI2_AVX512VL 0 "register_operand")
17434 (match_operand:VI2_AVX512VL 1 "register_operand")
17435 (match_operand:<sseintvecmode> 2 "register_operand")
17436 (match_operand:VI2_AVX512VL 3 "nonimmediate_operand")
17437 (match_operand:<avx512fmaskmode> 4 "register_operand")]
17440 emit_insn (gen_<avx512>_vpermi2var<mode>3_maskz_1 (
17441 operands[0], operands[1], operands[2], operands[3],
17442 CONST0_RTX (<MODE>mode), operands[4]));
17446 (define_insn "<avx512>_vpermi2var<mode>3<sd_maskz_name>"
17447 [(set (match_operand:VI48F 0 "register_operand" "=v")
17449 [(match_operand:VI48F 1 "register_operand" "v")
17450 (match_operand:<sseintvecmode> 2 "register_operand" "0")
17451 (match_operand:VI48F 3 "nonimmediate_operand" "vm")]
17454 "vpermi2<ssemodesuffix>\t{%3, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %3}"
17455 [(set_attr "type" "sselog")
17456 (set_attr "prefix" "evex")
17457 (set_attr "mode" "<sseinsnmode>")])
17459 (define_insn "<avx512>_vpermi2var<mode>3<sd_maskz_name>"
17460 [(set (match_operand:VI1_AVX512VL 0 "register_operand" "=v")
17461 (unspec:VI1_AVX512VL
17462 [(match_operand:VI1_AVX512VL 1 "register_operand" "v")
17463 (match_operand:<sseintvecmode> 2 "register_operand" "0")
17464 (match_operand:VI1_AVX512VL 3 "nonimmediate_operand" "vm")]
17466 "TARGET_AVX512VBMI"
17467 "vpermi2<ssemodesuffix>\t{%3, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %3}"
17468 [(set_attr "type" "sselog")
17469 (set_attr "prefix" "evex")
17470 (set_attr "mode" "<sseinsnmode>")])
17472 (define_insn "<avx512>_vpermi2var<mode>3<sd_maskz_name>"
17473 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
17474 (unspec:VI2_AVX512VL
17475 [(match_operand:VI2_AVX512VL 1 "register_operand" "v")
17476 (match_operand:<sseintvecmode> 2 "register_operand" "0")
17477 (match_operand:VI2_AVX512VL 3 "nonimmediate_operand" "vm")]
17480 "vpermi2<ssemodesuffix>\t{%3, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %3}"
17481 [(set_attr "type" "sselog")
17482 (set_attr "prefix" "evex")
17483 (set_attr "mode" "<sseinsnmode>")])
17485 (define_insn "<avx512>_vpermi2var<mode>3_mask"
17486 [(set (match_operand:VI48F 0 "register_operand" "=v")
17489 [(match_operand:VI48F 1 "register_operand" "v")
17490 (match_operand:<sseintvecmode> 2 "register_operand" "0")
17491 (match_operand:VI48F 3 "nonimmediate_operand" "vm")]
17492 UNSPEC_VPERMI2_MASK)
17494 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
17496 "vpermi2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
17497 [(set_attr "type" "sselog")
17498 (set_attr "prefix" "evex")
17499 (set_attr "mode" "<sseinsnmode>")])
17501 (define_insn "<avx512>_vpermi2var<mode>3_mask"
17502 [(set (match_operand:VI1_AVX512VL 0 "register_operand" "=v")
17503 (vec_merge:VI1_AVX512VL
17504 (unspec:VI1_AVX512VL
17505 [(match_operand:VI1_AVX512VL 1 "register_operand" "v")
17506 (match_operand:<sseintvecmode> 2 "register_operand" "0")
17507 (match_operand:VI1_AVX512VL 3 "nonimmediate_operand" "vm")]
17508 UNSPEC_VPERMI2_MASK)
17510 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
17511 "TARGET_AVX512VBMI"
17512 "vpermi2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
17513 [(set_attr "type" "sselog")
17514 (set_attr "prefix" "evex")
17515 (set_attr "mode" "<sseinsnmode>")])
17517 (define_insn "<avx512>_vpermi2var<mode>3_mask"
17518 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
17519 (vec_merge:VI2_AVX512VL
17520 (unspec:VI2_AVX512VL
17521 [(match_operand:VI2_AVX512VL 1 "register_operand" "v")
17522 (match_operand:<sseintvecmode> 2 "register_operand" "0")
17523 (match_operand:VI2_AVX512VL 3 "nonimmediate_operand" "vm")]
17524 UNSPEC_VPERMI2_MASK)
17526 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
17528 "vpermi2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
17529 [(set_attr "type" "sselog")
17530 (set_attr "prefix" "evex")
17531 (set_attr "mode" "<sseinsnmode>")])
17533 (define_expand "<avx512>_vpermt2var<mode>3_maskz"
17534 [(match_operand:VI48F 0 "register_operand")
17535 (match_operand:<sseintvecmode> 1 "register_operand")
17536 (match_operand:VI48F 2 "register_operand")
17537 (match_operand:VI48F 3 "nonimmediate_operand")
17538 (match_operand:<avx512fmaskmode> 4 "register_operand")]
17541 emit_insn (gen_<avx512>_vpermt2var<mode>3_maskz_1 (
17542 operands[0], operands[1], operands[2], operands[3],
17543 CONST0_RTX (<MODE>mode), operands[4]));
17547 (define_expand "<avx512>_vpermt2var<mode>3_maskz"
17548 [(match_operand:VI1_AVX512VL 0 "register_operand")
17549 (match_operand:<sseintvecmode> 1 "register_operand")
17550 (match_operand:VI1_AVX512VL 2 "register_operand")
17551 (match_operand:VI1_AVX512VL 3 "nonimmediate_operand")
17552 (match_operand:<avx512fmaskmode> 4 "register_operand")]
17553 "TARGET_AVX512VBMI"
17555 emit_insn (gen_<avx512>_vpermt2var<mode>3_maskz_1 (
17556 operands[0], operands[1], operands[2], operands[3],
17557 CONST0_RTX (<MODE>mode), operands[4]));
17561 (define_expand "<avx512>_vpermt2var<mode>3_maskz"
17562 [(match_operand:VI2_AVX512VL 0 "register_operand")
17563 (match_operand:<sseintvecmode> 1 "register_operand")
17564 (match_operand:VI2_AVX512VL 2 "register_operand")
17565 (match_operand:VI2_AVX512VL 3 "nonimmediate_operand")
17566 (match_operand:<avx512fmaskmode> 4 "register_operand")]
17569 emit_insn (gen_<avx512>_vpermt2var<mode>3_maskz_1 (
17570 operands[0], operands[1], operands[2], operands[3],
17571 CONST0_RTX (<MODE>mode), operands[4]));
17575 (define_insn "<avx512>_vpermt2var<mode>3<sd_maskz_name>"
17576 [(set (match_operand:VI48F 0 "register_operand" "=v")
17578 [(match_operand:<sseintvecmode> 1 "register_operand" "v")
17579 (match_operand:VI48F 2 "register_operand" "0")
17580 (match_operand:VI48F 3 "nonimmediate_operand" "vm")]
17583 "vpermt2<ssemodesuffix>\t{%3, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %3}"
17584 [(set_attr "type" "sselog")
17585 (set_attr "prefix" "evex")
17586 (set_attr "mode" "<sseinsnmode>")])
17588 (define_insn "<avx512>_vpermt2var<mode>3<sd_maskz_name>"
17589 [(set (match_operand:VI1_AVX512VL 0 "register_operand" "=v")
17590 (unspec:VI1_AVX512VL
17591 [(match_operand:<sseintvecmode> 1 "register_operand" "v")
17592 (match_operand:VI1_AVX512VL 2 "register_operand" "0")
17593 (match_operand:VI1_AVX512VL 3 "nonimmediate_operand" "vm")]
17595 "TARGET_AVX512VBMI"
17596 "vpermt2<ssemodesuffix>\t{%3, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %3}"
17597 [(set_attr "type" "sselog")
17598 (set_attr "prefix" "evex")
17599 (set_attr "mode" "<sseinsnmode>")])
17601 (define_insn "<avx512>_vpermt2var<mode>3<sd_maskz_name>"
17602 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
17603 (unspec:VI2_AVX512VL
17604 [(match_operand:<sseintvecmode> 1 "register_operand" "v")
17605 (match_operand:VI2_AVX512VL 2 "register_operand" "0")
17606 (match_operand:VI2_AVX512VL 3 "nonimmediate_operand" "vm")]
17609 "vpermt2<ssemodesuffix>\t{%3, %1, %0<sd_mask_op4>|%0<sd_mask_op4>, %1, %3}"
17610 [(set_attr "type" "sselog")
17611 (set_attr "prefix" "evex")
17612 (set_attr "mode" "<sseinsnmode>")])
17614 (define_insn "<avx512>_vpermt2var<mode>3_mask"
17615 [(set (match_operand:VI48F 0 "register_operand" "=v")
17618 [(match_operand:<sseintvecmode> 1 "register_operand" "v")
17619 (match_operand:VI48F 2 "register_operand" "0")
17620 (match_operand:VI48F 3 "nonimmediate_operand" "vm")]
17623 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
17625 "vpermt2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
17626 [(set_attr "type" "sselog")
17627 (set_attr "prefix" "evex")
17628 (set_attr "mode" "<sseinsnmode>")])
17630 (define_insn "<avx512>_vpermt2var<mode>3_mask"
17631 [(set (match_operand:VI1_AVX512VL 0 "register_operand" "=v")
17632 (vec_merge:VI1_AVX512VL
17633 (unspec:VI1_AVX512VL
17634 [(match_operand:<sseintvecmode> 1 "register_operand" "v")
17635 (match_operand:VI1_AVX512VL 2 "register_operand" "0")
17636 (match_operand:VI1_AVX512VL 3 "nonimmediate_operand" "vm")]
17639 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
17640 "TARGET_AVX512VBMI"
17641 "vpermt2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
17642 [(set_attr "type" "sselog")
17643 (set_attr "prefix" "evex")
17644 (set_attr "mode" "<sseinsnmode>")])
17646 (define_insn "<avx512>_vpermt2var<mode>3_mask"
17647 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
17648 (vec_merge:VI2_AVX512VL
17649 (unspec:VI2_AVX512VL
17650 [(match_operand:<sseintvecmode> 1 "register_operand" "v")
17651 (match_operand:VI2_AVX512VL 2 "register_operand" "0")
17652 (match_operand:VI2_AVX512VL 3 "nonimmediate_operand" "vm")]
17655 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
17657 "vpermt2<ssemodesuffix>\t{%3, %1, %0%{%4%}|%0%{%4%}, %1, %3}"
17658 [(set_attr "type" "sselog")
17659 (set_attr "prefix" "evex")
17660 (set_attr "mode" "<sseinsnmode>")])
17662 (define_expand "avx_vperm2f128<mode>3"
17663 [(set (match_operand:AVX256MODE2P 0 "register_operand")
17664 (unspec:AVX256MODE2P
17665 [(match_operand:AVX256MODE2P 1 "register_operand")
17666 (match_operand:AVX256MODE2P 2 "nonimmediate_operand")
17667 (match_operand:SI 3 "const_0_to_255_operand")]
17668 UNSPEC_VPERMIL2F128))]
17671 int mask = INTVAL (operands[3]);
17672 if ((mask & 0x88) == 0)
17674 rtx perm[<ssescalarnum>], t1, t2;
17675 int i, base, nelt = <ssescalarnum>, nelt2 = nelt / 2;
17677 base = (mask & 3) * nelt2;
17678 for (i = 0; i < nelt2; ++i)
17679 perm[i] = GEN_INT (base + i);
17681 base = ((mask >> 4) & 3) * nelt2;
17682 for (i = 0; i < nelt2; ++i)
17683 perm[i + nelt2] = GEN_INT (base + i);
17685 t2 = gen_rtx_VEC_CONCAT (<ssedoublevecmode>mode,
17686 operands[1], operands[2]);
17687 t1 = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (nelt, perm));
17688 t2 = gen_rtx_VEC_SELECT (<MODE>mode, t2, t1);
17689 t2 = gen_rtx_SET (operands[0], t2);
17695 ;; Note that bits 7 and 3 of the imm8 allow lanes to be zeroed, which
17696 ;; means that in order to represent this properly in rtl we'd have to
17697 ;; nest *another* vec_concat with a zero operand and do the select from
17698 ;; a 4x wide vector. That doesn't seem very nice.
17699 (define_insn "*avx_vperm2f128<mode>_full"
17700 [(set (match_operand:AVX256MODE2P 0 "register_operand" "=x")
17701 (unspec:AVX256MODE2P
17702 [(match_operand:AVX256MODE2P 1 "register_operand" "x")
17703 (match_operand:AVX256MODE2P 2 "nonimmediate_operand" "xm")
17704 (match_operand:SI 3 "const_0_to_255_operand" "n")]
17705 UNSPEC_VPERMIL2F128))]
17707 "vperm2<i128>\t{%3, %2, %1, %0|%0, %1, %2, %3}"
17708 [(set_attr "type" "sselog")
17709 (set_attr "prefix_extra" "1")
17710 (set_attr "length_immediate" "1")
17711 (set_attr "prefix" "vex")
17712 (set_attr "mode" "<sseinsnmode>")])
17714 (define_insn "*avx_vperm2f128<mode>_nozero"
17715 [(set (match_operand:AVX256MODE2P 0 "register_operand" "=x")
17716 (vec_select:AVX256MODE2P
17717 (vec_concat:<ssedoublevecmode>
17718 (match_operand:AVX256MODE2P 1 "register_operand" "x")
17719 (match_operand:AVX256MODE2P 2 "nonimmediate_operand" "xm"))
17720 (match_parallel 3 ""
17721 [(match_operand 4 "const_int_operand")])))]
17723 && avx_vperm2f128_parallel (operands[3], <MODE>mode)"
17725 int mask = avx_vperm2f128_parallel (operands[3], <MODE>mode) - 1;
17727 return "vinsert<i128>\t{$0, %x2, %1, %0|%0, %1, %x2, 0}";
17729 return "vinsert<i128>\t{$1, %x2, %1, %0|%0, %1, %x2, 1}";
17730 operands[3] = GEN_INT (mask);
17731 return "vperm2<i128>\t{%3, %2, %1, %0|%0, %1, %2, %3}";
17733 [(set_attr "type" "sselog")
17734 (set_attr "prefix_extra" "1")
17735 (set_attr "length_immediate" "1")
17736 (set_attr "prefix" "vex")
17737 (set_attr "mode" "<sseinsnmode>")])
17739 (define_insn "*ssse3_palignr<mode>_perm"
17740 [(set (match_operand:V_128 0 "register_operand" "=x,x")
17742 (match_operand:V_128 1 "register_operand" "0,x")
17743 (match_parallel 2 "palignr_operand"
17744 [(match_operand 3 "const_int_operand" "n, n")])))]
17748 GEN_INT (INTVAL (operands[3]) * GET_MODE_UNIT_SIZE (GET_MODE (operands[0])));
17750 switch (which_alternative)
17753 return "palignr\t{%2, %1, %0|%0, %1, %2}";
17755 return "vpalignr\t{%2, %1, %1, %0|%0, %1, %1, %2}";
17757 gcc_unreachable ();
17760 [(set_attr "isa" "noavx,avx")
17761 (set_attr "type" "sseishft")
17762 (set_attr "atom_unit" "sishuf")
17763 (set_attr "prefix_data16" "1,*")
17764 (set_attr "prefix_extra" "1")
17765 (set_attr "length_immediate" "1")
17766 (set_attr "prefix" "orig,vex")])
17768 (define_expand "avx512vl_vinsert<mode>"
17769 [(match_operand:VI48F_256 0 "register_operand")
17770 (match_operand:VI48F_256 1 "register_operand")
17771 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand")
17772 (match_operand:SI 3 "const_0_to_1_operand")
17773 (match_operand:VI48F_256 4 "register_operand")
17774 (match_operand:<avx512fmaskmode> 5 "register_operand")]
17777 rtx (*insn)(rtx, rtx, rtx, rtx, rtx);
17779 switch (INTVAL (operands[3]))
17782 insn = gen_vec_set_lo_<mode>_mask;
17785 insn = gen_vec_set_hi_<mode>_mask;
17788 gcc_unreachable ();
17791 emit_insn (insn (operands[0], operands[1], operands[2], operands[4],
17796 (define_expand "avx_vinsertf128<mode>"
17797 [(match_operand:V_256 0 "register_operand")
17798 (match_operand:V_256 1 "register_operand")
17799 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand")
17800 (match_operand:SI 3 "const_0_to_1_operand")]
17803 rtx (*insn)(rtx, rtx, rtx);
17805 switch (INTVAL (operands[3]))
17808 insn = gen_vec_set_lo_<mode>;
17811 insn = gen_vec_set_hi_<mode>;
17814 gcc_unreachable ();
17817 emit_insn (insn (operands[0], operands[1], operands[2]));
17821 (define_insn "vec_set_lo_<mode><mask_name>"
17822 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
17823 (vec_concat:VI8F_256
17824 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
17825 (vec_select:<ssehalfvecmode>
17826 (match_operand:VI8F_256 1 "register_operand" "v")
17827 (parallel [(const_int 2) (const_int 3)]))))]
17828 "TARGET_AVX && <mask_avx512dq_condition>"
17830 if (TARGET_AVX512DQ)
17831 return "vinsert<shuffletype>64x2\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}";
17832 else if (TARGET_AVX512VL)
17833 return "vinsert<shuffletype>32x4\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}";
17835 return "vinsert<i128>\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}";
17837 [(set_attr "type" "sselog")
17838 (set_attr "prefix_extra" "1")
17839 (set_attr "length_immediate" "1")
17840 (set_attr "prefix" "vex")
17841 (set_attr "mode" "<sseinsnmode>")])
17843 (define_insn "vec_set_hi_<mode><mask_name>"
17844 [(set (match_operand:VI8F_256 0 "register_operand" "=v")
17845 (vec_concat:VI8F_256
17846 (vec_select:<ssehalfvecmode>
17847 (match_operand:VI8F_256 1 "register_operand" "v")
17848 (parallel [(const_int 0) (const_int 1)]))
17849 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
17850 "TARGET_AVX && <mask_avx512dq_condition>"
17852 if (TARGET_AVX512DQ)
17853 return "vinsert<shuffletype>64x2\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}";
17854 else if (TARGET_AVX512VL)
17855 return "vinsert<shuffletype>32x4\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}";
17857 return "vinsert<i128>\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}";
17859 [(set_attr "type" "sselog")
17860 (set_attr "prefix_extra" "1")
17861 (set_attr "length_immediate" "1")
17862 (set_attr "prefix" "vex")
17863 (set_attr "mode" "<sseinsnmode>")])
17865 (define_insn "vec_set_lo_<mode><mask_name>"
17866 [(set (match_operand:VI4F_256 0 "register_operand" "=v")
17867 (vec_concat:VI4F_256
17868 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")
17869 (vec_select:<ssehalfvecmode>
17870 (match_operand:VI4F_256 1 "register_operand" "v")
17871 (parallel [(const_int 4) (const_int 5)
17872 (const_int 6) (const_int 7)]))))]
17875 if (TARGET_AVX512VL)
17876 return "vinsert<shuffletype>32x4\t{$0x0, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x0}";
17878 return "vinsert<i128>\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}";
17880 [(set_attr "type" "sselog")
17881 (set_attr "prefix_extra" "1")
17882 (set_attr "length_immediate" "1")
17883 (set_attr "prefix" "vex")
17884 (set_attr "mode" "<sseinsnmode>")])
17886 (define_insn "vec_set_hi_<mode><mask_name>"
17887 [(set (match_operand:VI4F_256 0 "register_operand" "=v")
17888 (vec_concat:VI4F_256
17889 (vec_select:<ssehalfvecmode>
17890 (match_operand:VI4F_256 1 "register_operand" "v")
17891 (parallel [(const_int 0) (const_int 1)
17892 (const_int 2) (const_int 3)]))
17893 (match_operand:<ssehalfvecmode> 2 "nonimmediate_operand" "vm")))]
17896 if (TARGET_AVX512VL)
17897 return "vinsert<shuffletype>32x4\t{$0x1, %2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2, 0x1}";
17899 return "vinsert<i128>\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}";
17901 [(set_attr "type" "sselog")
17902 (set_attr "prefix_extra" "1")
17903 (set_attr "length_immediate" "1")
17904 (set_attr "prefix" "vex")
17905 (set_attr "mode" "<sseinsnmode>")])
17907 (define_insn "vec_set_lo_v16hi"
17908 [(set (match_operand:V16HI 0 "register_operand" "=x,v")
17910 (match_operand:V8HI 2 "nonimmediate_operand" "xm,vm")
17912 (match_operand:V16HI 1 "register_operand" "x,v")
17913 (parallel [(const_int 8) (const_int 9)
17914 (const_int 10) (const_int 11)
17915 (const_int 12) (const_int 13)
17916 (const_int 14) (const_int 15)]))))]
17919 vinsert%~128\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}
17920 vinserti32x4\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}"
17921 [(set_attr "type" "sselog")
17922 (set_attr "prefix_extra" "1")
17923 (set_attr "length_immediate" "1")
17924 (set_attr "prefix" "vex,evex")
17925 (set_attr "mode" "OI")])
17927 (define_insn "vec_set_hi_v16hi"
17928 [(set (match_operand:V16HI 0 "register_operand" "=x,v")
17931 (match_operand:V16HI 1 "register_operand" "x,v")
17932 (parallel [(const_int 0) (const_int 1)
17933 (const_int 2) (const_int 3)
17934 (const_int 4) (const_int 5)
17935 (const_int 6) (const_int 7)]))
17936 (match_operand:V8HI 2 "nonimmediate_operand" "xm,vm")))]
17939 vinsert%~128\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}
17940 vinserti32x4\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}"
17941 [(set_attr "type" "sselog")
17942 (set_attr "prefix_extra" "1")
17943 (set_attr "length_immediate" "1")
17944 (set_attr "prefix" "vex,evex")
17945 (set_attr "mode" "OI")])
17947 (define_insn "vec_set_lo_v32qi"
17948 [(set (match_operand:V32QI 0 "register_operand" "=x,v")
17950 (match_operand:V16QI 2 "nonimmediate_operand" "xm,v")
17952 (match_operand:V32QI 1 "register_operand" "x,v")
17953 (parallel [(const_int 16) (const_int 17)
17954 (const_int 18) (const_int 19)
17955 (const_int 20) (const_int 21)
17956 (const_int 22) (const_int 23)
17957 (const_int 24) (const_int 25)
17958 (const_int 26) (const_int 27)
17959 (const_int 28) (const_int 29)
17960 (const_int 30) (const_int 31)]))))]
17963 vinsert%~128\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}
17964 vinserti32x4\t{$0x0, %2, %1, %0|%0, %1, %2, 0x0}"
17965 [(set_attr "type" "sselog")
17966 (set_attr "prefix_extra" "1")
17967 (set_attr "length_immediate" "1")
17968 (set_attr "prefix" "vex,evex")
17969 (set_attr "mode" "OI")])
17971 (define_insn "vec_set_hi_v32qi"
17972 [(set (match_operand:V32QI 0 "register_operand" "=x,v")
17975 (match_operand:V32QI 1 "register_operand" "x,v")
17976 (parallel [(const_int 0) (const_int 1)
17977 (const_int 2) (const_int 3)
17978 (const_int 4) (const_int 5)
17979 (const_int 6) (const_int 7)
17980 (const_int 8) (const_int 9)
17981 (const_int 10) (const_int 11)
17982 (const_int 12) (const_int 13)
17983 (const_int 14) (const_int 15)]))
17984 (match_operand:V16QI 2 "nonimmediate_operand" "xm,vm")))]
17987 vinsert%~128\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}
17988 vinserti32x4\t{$0x1, %2, %1, %0|%0, %1, %2, 0x1}"
17989 [(set_attr "type" "sselog")
17990 (set_attr "prefix_extra" "1")
17991 (set_attr "length_immediate" "1")
17992 (set_attr "prefix" "vex,evex")
17993 (set_attr "mode" "OI")])
17995 (define_insn "<avx_avx2>_maskload<ssemodesuffix><avxsizesuffix>"
17996 [(set (match_operand:V48_AVX2 0 "register_operand" "=x")
17998 [(match_operand:<sseintvecmode> 2 "register_operand" "x")
17999 (match_operand:V48_AVX2 1 "memory_operand" "m")]
18002 "v<sseintprefix>maskmov<ssemodesuffix>\t{%1, %2, %0|%0, %2, %1}"
18003 [(set_attr "type" "sselog1")
18004 (set_attr "prefix_extra" "1")
18005 (set_attr "prefix" "vex")
18006 (set_attr "btver2_decode" "vector")
18007 (set_attr "mode" "<sseinsnmode>")])
18009 (define_insn "<avx_avx2>_maskstore<ssemodesuffix><avxsizesuffix>"
18010 [(set (match_operand:V48_AVX2 0 "memory_operand" "+m")
18012 [(match_operand:<sseintvecmode> 1 "register_operand" "x")
18013 (match_operand:V48_AVX2 2 "register_operand" "x")
18017 "v<sseintprefix>maskmov<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
18018 [(set_attr "type" "sselog1")
18019 (set_attr "prefix_extra" "1")
18020 (set_attr "prefix" "vex")
18021 (set_attr "btver2_decode" "vector")
18022 (set_attr "mode" "<sseinsnmode>")])
18024 (define_expand "maskload<mode><sseintvecmodelower>"
18025 [(set (match_operand:V48_AVX2 0 "register_operand")
18027 [(match_operand:<sseintvecmode> 2 "register_operand")
18028 (match_operand:V48_AVX2 1 "memory_operand")]
18032 (define_expand "maskload<mode><avx512fmaskmodelower>"
18033 [(set (match_operand:V48_AVX512VL 0 "register_operand")
18034 (vec_merge:V48_AVX512VL
18035 (match_operand:V48_AVX512VL 1 "memory_operand")
18037 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18040 (define_expand "maskload<mode><avx512fmaskmodelower>"
18041 [(set (match_operand:VI12_AVX512VL 0 "register_operand")
18042 (vec_merge:VI12_AVX512VL
18043 (match_operand:VI12_AVX512VL 1 "memory_operand")
18045 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18048 (define_expand "maskstore<mode><sseintvecmodelower>"
18049 [(set (match_operand:V48_AVX2 0 "memory_operand")
18051 [(match_operand:<sseintvecmode> 2 "register_operand")
18052 (match_operand:V48_AVX2 1 "register_operand")
18057 (define_expand "maskstore<mode><avx512fmaskmodelower>"
18058 [(set (match_operand:V48_AVX512VL 0 "memory_operand")
18059 (vec_merge:V48_AVX512VL
18060 (match_operand:V48_AVX512VL 1 "register_operand")
18062 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18065 (define_expand "maskstore<mode><avx512fmaskmodelower>"
18066 [(set (match_operand:VI12_AVX512VL 0 "memory_operand")
18067 (vec_merge:VI12_AVX512VL
18068 (match_operand:VI12_AVX512VL 1 "register_operand")
18070 (match_operand:<avx512fmaskmode> 2 "register_operand")))]
18073 (define_expand "cbranch<mode>4"
18074 [(set (reg:CC FLAGS_REG)
18075 (compare:CC (match_operand:VI48_AVX 1 "register_operand")
18076 (match_operand:VI48_AVX 2 "nonimmediate_operand")))
18077 (set (pc) (if_then_else
18078 (match_operator 0 "bt_comparison_operator"
18079 [(reg:CC FLAGS_REG) (const_int 0)])
18080 (label_ref (match_operand 3))
18084 ix86_expand_branch (GET_CODE (operands[0]),
18085 operands[1], operands[2], operands[3]);
18090 (define_insn_and_split "avx_<castmode><avxsizesuffix>_<castmode>"
18091 [(set (match_operand:AVX256MODE2P 0 "nonimmediate_operand" "=x,m")
18092 (unspec:AVX256MODE2P
18093 [(match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "xm,x")]
18097 "&& reload_completed"
18098 [(set (match_dup 0) (match_dup 1))]
18100 if (REG_P (operands[0]))
18101 operands[0] = gen_lowpart (<ssehalfvecmode>mode, operands[0]);
18103 operands[1] = lowpart_subreg (<MODE>mode, operands[1],
18104 <ssehalfvecmode>mode);
18107 (define_expand "vec_init<mode>"
18108 [(match_operand:V_256 0 "register_operand")
18112 ix86_expand_vector_init (false, operands[0], operands[1]);
18116 (define_expand "vec_init<mode>"
18117 [(match_operand:VF48_I1248 0 "register_operand")
18121 ix86_expand_vector_init (false, operands[0], operands[1]);
18125 (define_insn "<avx2_avx512>_ashrv<mode><mask_name>"
18126 [(set (match_operand:VI48_AVX512F_AVX512VL 0 "register_operand" "=v")
18127 (ashiftrt:VI48_AVX512F_AVX512VL
18128 (match_operand:VI48_AVX512F_AVX512VL 1 "register_operand" "v")
18129 (match_operand:VI48_AVX512F_AVX512VL 2 "nonimmediate_operand" "vm")))]
18130 "TARGET_AVX2 && <mask_mode512bit_condition>"
18131 "vpsrav<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18132 [(set_attr "type" "sseishft")
18133 (set_attr "prefix" "maybe_evex")
18134 (set_attr "mode" "<sseinsnmode>")])
18136 (define_insn "<avx2_avx512>_ashrv<mode><mask_name>"
18137 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
18138 (ashiftrt:VI2_AVX512VL
18139 (match_operand:VI2_AVX512VL 1 "register_operand" "v")
18140 (match_operand:VI2_AVX512VL 2 "nonimmediate_operand" "vm")))]
18142 "vpsravw\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18143 [(set_attr "type" "sseishft")
18144 (set_attr "prefix" "maybe_evex")
18145 (set_attr "mode" "<sseinsnmode>")])
18147 (define_insn "<avx2_avx512>_<shift_insn>v<mode><mask_name>"
18148 [(set (match_operand:VI48_AVX512F 0 "register_operand" "=v")
18149 (any_lshift:VI48_AVX512F
18150 (match_operand:VI48_AVX512F 1 "register_operand" "v")
18151 (match_operand:VI48_AVX512F 2 "nonimmediate_operand" "vm")))]
18152 "TARGET_AVX2 && <mask_mode512bit_condition>"
18153 "vp<vshift>v<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18154 [(set_attr "type" "sseishft")
18155 (set_attr "prefix" "maybe_evex")
18156 (set_attr "mode" "<sseinsnmode>")])
18158 (define_insn "<avx2_avx512>_<shift_insn>v<mode><mask_name>"
18159 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
18160 (any_lshift:VI2_AVX512VL
18161 (match_operand:VI2_AVX512VL 1 "register_operand" "v")
18162 (match_operand:VI2_AVX512VL 2 "nonimmediate_operand" "vm")))]
18164 "vp<vshift>v<ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18165 [(set_attr "type" "sseishft")
18166 (set_attr "prefix" "maybe_evex")
18167 (set_attr "mode" "<sseinsnmode>")])
18169 (define_insn "avx_vec_concat<mode>"
18170 [(set (match_operand:V_256_512 0 "register_operand" "=x,x")
18171 (vec_concat:V_256_512
18172 (match_operand:<ssehalfvecmode> 1 "register_operand" "x,x")
18173 (match_operand:<ssehalfvecmode> 2 "vector_move_operand" "xm,C")))]
18176 switch (which_alternative)
18179 return "vinsert<i128>\t{$0x1, %2, %<concat_tg_mode>1, %0|%0, %<concat_tg_mode>1, %2, 0x1}";
18181 switch (get_attr_mode (insn))
18184 return "vmovaps\t{%1, %t0|%t0, %1}";
18186 return "vmovapd\t{%1, %t0|%t0, %1}";
18188 return "vmovaps\t{%1, %x0|%x0, %1}";
18190 return "vmovapd\t{%1, %x0|%x0, %1}";
18192 return "vmovdqa\t{%1, %t0|%t0, %1}";
18194 return "vmovdqa\t{%1, %x0|%x0, %1}";
18196 gcc_unreachable ();
18199 gcc_unreachable ();
18202 [(set_attr "type" "sselog,ssemov")
18203 (set_attr "prefix_extra" "1,*")
18204 (set_attr "length_immediate" "1,*")
18205 (set_attr "prefix" "maybe_evex")
18206 (set_attr "mode" "<sseinsnmode>")])
18208 (define_insn "vcvtph2ps<mask_name>"
18209 [(set (match_operand:V4SF 0 "register_operand" "=v")
18211 (unspec:V8SF [(match_operand:V8HI 1 "register_operand" "v")]
18213 (parallel [(const_int 0) (const_int 1)
18214 (const_int 2) (const_int 3)])))]
18215 "TARGET_F16C || TARGET_AVX512VL"
18216 "vcvtph2ps\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
18217 [(set_attr "type" "ssecvt")
18218 (set_attr "prefix" "maybe_evex")
18219 (set_attr "mode" "V4SF")])
18221 (define_insn "*vcvtph2ps_load<mask_name>"
18222 [(set (match_operand:V4SF 0 "register_operand" "=v")
18223 (unspec:V4SF [(match_operand:V4HI 1 "memory_operand" "m")]
18224 UNSPEC_VCVTPH2PS))]
18225 "TARGET_F16C || TARGET_AVX512VL"
18226 "vcvtph2ps\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
18227 [(set_attr "type" "ssecvt")
18228 (set_attr "prefix" "vex")
18229 (set_attr "mode" "V8SF")])
18231 (define_insn "vcvtph2ps256<mask_name>"
18232 [(set (match_operand:V8SF 0 "register_operand" "=v")
18233 (unspec:V8SF [(match_operand:V8HI 1 "nonimmediate_operand" "vm")]
18234 UNSPEC_VCVTPH2PS))]
18235 "TARGET_F16C || TARGET_AVX512VL"
18236 "vcvtph2ps\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
18237 [(set_attr "type" "ssecvt")
18238 (set_attr "prefix" "vex")
18239 (set_attr "btver2_decode" "double")
18240 (set_attr "mode" "V8SF")])
18242 (define_insn "<mask_codefor>avx512f_vcvtph2ps512<mask_name><round_saeonly_name>"
18243 [(set (match_operand:V16SF 0 "register_operand" "=v")
18245 [(match_operand:V16HI 1 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")]
18246 UNSPEC_VCVTPH2PS))]
18248 "vcvtph2ps\t{<round_saeonly_mask_op2>%1, %0<mask_operand2>|%0<mask_operand2>, %1<round_saeonly_mask_op2>}"
18249 [(set_attr "type" "ssecvt")
18250 (set_attr "prefix" "evex")
18251 (set_attr "mode" "V16SF")])
18253 (define_expand "vcvtps2ph_mask"
18254 [(set (match_operand:V8HI 0 "register_operand")
18257 (unspec:V4HI [(match_operand:V4SF 1 "register_operand")
18258 (match_operand:SI 2 "const_0_to_255_operand")]
18261 (match_operand:V8HI 3 "vector_move_operand")
18262 (match_operand:QI 4 "register_operand")))]
18264 "operands[5] = CONST0_RTX (V4HImode);")
18266 (define_expand "vcvtps2ph"
18267 [(set (match_operand:V8HI 0 "register_operand")
18269 (unspec:V4HI [(match_operand:V4SF 1 "register_operand")
18270 (match_operand:SI 2 "const_0_to_255_operand")]
18274 "operands[3] = CONST0_RTX (V4HImode);")
18276 (define_insn "*vcvtps2ph<mask_name>"
18277 [(set (match_operand:V8HI 0 "register_operand" "=v")
18279 (unspec:V4HI [(match_operand:V4SF 1 "register_operand" "v")
18280 (match_operand:SI 2 "const_0_to_255_operand" "N")]
18282 (match_operand:V4HI 3 "const0_operand")))]
18283 "(TARGET_F16C || TARGET_AVX512VL) && <mask_avx512vl_condition>"
18284 "vcvtps2ph\t{%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2}"
18285 [(set_attr "type" "ssecvt")
18286 (set_attr "prefix" "maybe_evex")
18287 (set_attr "mode" "V4SF")])
18289 (define_insn "*vcvtps2ph_store<mask_name>"
18290 [(set (match_operand:V4HI 0 "memory_operand" "=m")
18291 (unspec:V4HI [(match_operand:V4SF 1 "register_operand" "x")
18292 (match_operand:SI 2 "const_0_to_255_operand" "N")]
18293 UNSPEC_VCVTPS2PH))]
18294 "TARGET_F16C || TARGET_AVX512VL"
18295 "vcvtps2ph\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18296 [(set_attr "type" "ssecvt")
18297 (set_attr "prefix" "maybe_evex")
18298 (set_attr "mode" "V4SF")])
18300 (define_insn "vcvtps2ph256<mask_name>"
18301 [(set (match_operand:V8HI 0 "nonimmediate_operand" "=xm")
18302 (unspec:V8HI [(match_operand:V8SF 1 "register_operand" "x")
18303 (match_operand:SI 2 "const_0_to_255_operand" "N")]
18304 UNSPEC_VCVTPS2PH))]
18305 "TARGET_F16C || TARGET_AVX512VL"
18306 "vcvtps2ph\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18307 [(set_attr "type" "ssecvt")
18308 (set_attr "prefix" "maybe_evex")
18309 (set_attr "btver2_decode" "vector")
18310 (set_attr "mode" "V8SF")])
18312 (define_insn "<mask_codefor>avx512f_vcvtps2ph512<mask_name>"
18313 [(set (match_operand:V16HI 0 "nonimmediate_operand" "=vm")
18315 [(match_operand:V16SF 1 "register_operand" "v")
18316 (match_operand:SI 2 "const_0_to_255_operand" "N")]
18317 UNSPEC_VCVTPS2PH))]
18319 "vcvtps2ph\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
18320 [(set_attr "type" "ssecvt")
18321 (set_attr "prefix" "evex")
18322 (set_attr "mode" "V16SF")])
18324 ;; For gather* insn patterns
18325 (define_mode_iterator VEC_GATHER_MODE
18326 [V2DI V2DF V4DI V4DF V4SI V4SF V8SI V8SF])
18327 (define_mode_attr VEC_GATHER_IDXSI
18328 [(V2DI "V4SI") (V4DI "V4SI") (V8DI "V8SI")
18329 (V2DF "V4SI") (V4DF "V4SI") (V8DF "V8SI")
18330 (V4SI "V4SI") (V8SI "V8SI") (V16SI "V16SI")
18331 (V4SF "V4SI") (V8SF "V8SI") (V16SF "V16SI")])
18333 (define_mode_attr VEC_GATHER_IDXDI
18334 [(V2DI "V2DI") (V4DI "V4DI") (V8DI "V8DI")
18335 (V2DF "V2DI") (V4DF "V4DI") (V8DF "V8DI")
18336 (V4SI "V2DI") (V8SI "V4DI") (V16SI "V8DI")
18337 (V4SF "V2DI") (V8SF "V4DI") (V16SF "V8DI")])
18339 (define_mode_attr VEC_GATHER_SRCDI
18340 [(V2DI "V2DI") (V4DI "V4DI") (V8DI "V8DI")
18341 (V2DF "V2DF") (V4DF "V4DF") (V8DF "V8DF")
18342 (V4SI "V4SI") (V8SI "V4SI") (V16SI "V8SI")
18343 (V4SF "V4SF") (V8SF "V4SF") (V16SF "V8SF")])
18345 (define_expand "avx2_gathersi<mode>"
18346 [(parallel [(set (match_operand:VEC_GATHER_MODE 0 "register_operand")
18347 (unspec:VEC_GATHER_MODE
18348 [(match_operand:VEC_GATHER_MODE 1 "register_operand")
18349 (mem:<ssescalarmode>
18351 [(match_operand 2 "vsib_address_operand")
18352 (match_operand:<VEC_GATHER_IDXSI>
18353 3 "register_operand")
18354 (match_operand:SI 5 "const1248_operand ")]))
18355 (mem:BLK (scratch))
18356 (match_operand:VEC_GATHER_MODE 4 "register_operand")]
18358 (clobber (match_scratch:VEC_GATHER_MODE 6))])]
18362 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
18363 operands[5]), UNSPEC_VSIBADDR);
18366 (define_insn "*avx2_gathersi<mode>"
18367 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
18368 (unspec:VEC_GATHER_MODE
18369 [(match_operand:VEC_GATHER_MODE 2 "register_operand" "0")
18370 (match_operator:<ssescalarmode> 7 "vsib_mem_operator"
18372 [(match_operand:P 3 "vsib_address_operand" "Tv")
18373 (match_operand:<VEC_GATHER_IDXSI> 4 "register_operand" "x")
18374 (match_operand:SI 6 "const1248_operand" "n")]
18376 (mem:BLK (scratch))
18377 (match_operand:VEC_GATHER_MODE 5 "register_operand" "1")]
18379 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
18381 "v<sseintprefix>gatherd<ssemodesuffix>\t{%1, %7, %0|%0, %7, %1}"
18382 [(set_attr "type" "ssemov")
18383 (set_attr "prefix" "vex")
18384 (set_attr "mode" "<sseinsnmode>")])
18386 (define_insn "*avx2_gathersi<mode>_2"
18387 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
18388 (unspec:VEC_GATHER_MODE
18390 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
18392 [(match_operand:P 2 "vsib_address_operand" "Tv")
18393 (match_operand:<VEC_GATHER_IDXSI> 3 "register_operand" "x")
18394 (match_operand:SI 5 "const1248_operand" "n")]
18396 (mem:BLK (scratch))
18397 (match_operand:VEC_GATHER_MODE 4 "register_operand" "1")]
18399 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
18401 "v<sseintprefix>gatherd<ssemodesuffix>\t{%1, %6, %0|%0, %6, %1}"
18402 [(set_attr "type" "ssemov")
18403 (set_attr "prefix" "vex")
18404 (set_attr "mode" "<sseinsnmode>")])
18406 (define_expand "avx2_gatherdi<mode>"
18407 [(parallel [(set (match_operand:VEC_GATHER_MODE 0 "register_operand")
18408 (unspec:VEC_GATHER_MODE
18409 [(match_operand:<VEC_GATHER_SRCDI> 1 "register_operand")
18410 (mem:<ssescalarmode>
18412 [(match_operand 2 "vsib_address_operand")
18413 (match_operand:<VEC_GATHER_IDXDI>
18414 3 "register_operand")
18415 (match_operand:SI 5 "const1248_operand ")]))
18416 (mem:BLK (scratch))
18417 (match_operand:<VEC_GATHER_SRCDI> 4 "register_operand")]
18419 (clobber (match_scratch:VEC_GATHER_MODE 6))])]
18423 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
18424 operands[5]), UNSPEC_VSIBADDR);
18427 (define_insn "*avx2_gatherdi<mode>"
18428 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
18429 (unspec:VEC_GATHER_MODE
18430 [(match_operand:<VEC_GATHER_SRCDI> 2 "register_operand" "0")
18431 (match_operator:<ssescalarmode> 7 "vsib_mem_operator"
18433 [(match_operand:P 3 "vsib_address_operand" "Tv")
18434 (match_operand:<VEC_GATHER_IDXDI> 4 "register_operand" "x")
18435 (match_operand:SI 6 "const1248_operand" "n")]
18437 (mem:BLK (scratch))
18438 (match_operand:<VEC_GATHER_SRCDI> 5 "register_operand" "1")]
18440 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
18442 "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %7, %2|%2, %7, %5}"
18443 [(set_attr "type" "ssemov")
18444 (set_attr "prefix" "vex")
18445 (set_attr "mode" "<sseinsnmode>")])
18447 (define_insn "*avx2_gatherdi<mode>_2"
18448 [(set (match_operand:VEC_GATHER_MODE 0 "register_operand" "=&x")
18449 (unspec:VEC_GATHER_MODE
18451 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
18453 [(match_operand:P 2 "vsib_address_operand" "Tv")
18454 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand" "x")
18455 (match_operand:SI 5 "const1248_operand" "n")]
18457 (mem:BLK (scratch))
18458 (match_operand:<VEC_GATHER_SRCDI> 4 "register_operand" "1")]
18460 (clobber (match_scratch:VEC_GATHER_MODE 1 "=&x"))]
18463 if (<MODE>mode != <VEC_GATHER_SRCDI>mode)
18464 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%4, %6, %x0|%x0, %6, %4}";
18465 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%4, %6, %0|%0, %6, %4}";
18467 [(set_attr "type" "ssemov")
18468 (set_attr "prefix" "vex")
18469 (set_attr "mode" "<sseinsnmode>")])
18471 (define_insn "*avx2_gatherdi<mode>_3"
18472 [(set (match_operand:<VEC_GATHER_SRCDI> 0 "register_operand" "=&x")
18473 (vec_select:<VEC_GATHER_SRCDI>
18475 [(match_operand:<VEC_GATHER_SRCDI> 2 "register_operand" "0")
18476 (match_operator:<ssescalarmode> 7 "vsib_mem_operator"
18478 [(match_operand:P 3 "vsib_address_operand" "Tv")
18479 (match_operand:<VEC_GATHER_IDXDI> 4 "register_operand" "x")
18480 (match_operand:SI 6 "const1248_operand" "n")]
18482 (mem:BLK (scratch))
18483 (match_operand:<VEC_GATHER_SRCDI> 5 "register_operand" "1")]
18485 (parallel [(const_int 0) (const_int 1)
18486 (const_int 2) (const_int 3)])))
18487 (clobber (match_scratch:VI4F_256 1 "=&x"))]
18489 "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %7, %0|%0, %7, %5}"
18490 [(set_attr "type" "ssemov")
18491 (set_attr "prefix" "vex")
18492 (set_attr "mode" "<sseinsnmode>")])
18494 (define_insn "*avx2_gatherdi<mode>_4"
18495 [(set (match_operand:<VEC_GATHER_SRCDI> 0 "register_operand" "=&x")
18496 (vec_select:<VEC_GATHER_SRCDI>
18499 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
18501 [(match_operand:P 2 "vsib_address_operand" "Tv")
18502 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand" "x")
18503 (match_operand:SI 5 "const1248_operand" "n")]
18505 (mem:BLK (scratch))
18506 (match_operand:<VEC_GATHER_SRCDI> 4 "register_operand" "1")]
18508 (parallel [(const_int 0) (const_int 1)
18509 (const_int 2) (const_int 3)])))
18510 (clobber (match_scratch:VI4F_256 1 "=&x"))]
18512 "v<sseintprefix>gatherq<ssemodesuffix>\t{%4, %6, %0|%0, %6, %4}"
18513 [(set_attr "type" "ssemov")
18514 (set_attr "prefix" "vex")
18515 (set_attr "mode" "<sseinsnmode>")])
18517 (define_expand "<avx512>_gathersi<mode>"
18518 [(parallel [(set (match_operand:VI48F 0 "register_operand")
18520 [(match_operand:VI48F 1 "register_operand")
18521 (match_operand:<avx512fmaskmode> 4 "register_operand")
18522 (mem:<ssescalarmode>
18524 [(match_operand 2 "vsib_address_operand")
18525 (match_operand:<VEC_GATHER_IDXSI> 3 "register_operand")
18526 (match_operand:SI 5 "const1248_operand")]))]
18528 (clobber (match_scratch:<avx512fmaskmode> 7))])]
18532 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
18533 operands[5]), UNSPEC_VSIBADDR);
18536 (define_insn "*avx512f_gathersi<mode>"
18537 [(set (match_operand:VI48F 0 "register_operand" "=&v")
18539 [(match_operand:VI48F 1 "register_operand" "0")
18540 (match_operand:<avx512fmaskmode> 7 "register_operand" "2")
18541 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
18543 [(match_operand:P 4 "vsib_address_operand" "Tv")
18544 (match_operand:<VEC_GATHER_IDXSI> 3 "register_operand" "v")
18545 (match_operand:SI 5 "const1248_operand" "n")]
18546 UNSPEC_VSIBADDR)])]
18548 (clobber (match_scratch:<avx512fmaskmode> 2 "=&Yk"))]
18550 "v<sseintprefix>gatherd<ssemodesuffix>\t{%6, %0%{%2%}|%0%{%2%}, %g6}"
18551 [(set_attr "type" "ssemov")
18552 (set_attr "prefix" "evex")
18553 (set_attr "mode" "<sseinsnmode>")])
18555 (define_insn "*avx512f_gathersi<mode>_2"
18556 [(set (match_operand:VI48F 0 "register_operand" "=&v")
18559 (match_operand:<avx512fmaskmode> 6 "register_operand" "1")
18560 (match_operator:<ssescalarmode> 5 "vsib_mem_operator"
18562 [(match_operand:P 3 "vsib_address_operand" "Tv")
18563 (match_operand:<VEC_GATHER_IDXSI> 2 "register_operand" "v")
18564 (match_operand:SI 4 "const1248_operand" "n")]
18565 UNSPEC_VSIBADDR)])]
18567 (clobber (match_scratch:<avx512fmaskmode> 1 "=&Yk"))]
18569 "v<sseintprefix>gatherd<ssemodesuffix>\t{%5, %0%{%1%}|%0%{%1%}, %g5}"
18570 [(set_attr "type" "ssemov")
18571 (set_attr "prefix" "evex")
18572 (set_attr "mode" "<sseinsnmode>")])
18575 (define_expand "<avx512>_gatherdi<mode>"
18576 [(parallel [(set (match_operand:VI48F 0 "register_operand")
18578 [(match_operand:<VEC_GATHER_SRCDI> 1 "register_operand")
18579 (match_operand:QI 4 "register_operand")
18580 (mem:<ssescalarmode>
18582 [(match_operand 2 "vsib_address_operand")
18583 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand")
18584 (match_operand:SI 5 "const1248_operand")]))]
18586 (clobber (match_scratch:QI 7))])]
18590 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[2], operands[3],
18591 operands[5]), UNSPEC_VSIBADDR);
18594 (define_insn "*avx512f_gatherdi<mode>"
18595 [(set (match_operand:VI48F 0 "register_operand" "=&v")
18597 [(match_operand:<VEC_GATHER_SRCDI> 1 "register_operand" "0")
18598 (match_operand:QI 7 "register_operand" "2")
18599 (match_operator:<ssescalarmode> 6 "vsib_mem_operator"
18601 [(match_operand:P 4 "vsib_address_operand" "Tv")
18602 (match_operand:<VEC_GATHER_IDXDI> 3 "register_operand" "v")
18603 (match_operand:SI 5 "const1248_operand" "n")]
18604 UNSPEC_VSIBADDR)])]
18606 (clobber (match_scratch:QI 2 "=&Yk"))]
18609 if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 4)
18610 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%6, %1%{%2%}|%1%{%2%}, %t6}";
18611 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%6, %1%{%2%}|%1%{%2%}, %g6}";
18613 [(set_attr "type" "ssemov")
18614 (set_attr "prefix" "evex")
18615 (set_attr "mode" "<sseinsnmode>")])
18617 (define_insn "*avx512f_gatherdi<mode>_2"
18618 [(set (match_operand:VI48F 0 "register_operand" "=&v")
18621 (match_operand:QI 6 "register_operand" "1")
18622 (match_operator:<ssescalarmode> 5 "vsib_mem_operator"
18624 [(match_operand:P 3 "vsib_address_operand" "Tv")
18625 (match_operand:<VEC_GATHER_IDXDI> 2 "register_operand" "v")
18626 (match_operand:SI 4 "const1248_operand" "n")]
18627 UNSPEC_VSIBADDR)])]
18629 (clobber (match_scratch:QI 1 "=&Yk"))]
18632 if (<MODE>mode != <VEC_GATHER_SRCDI>mode)
18634 if (<MODE_SIZE> != 64)
18635 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %x0%{%1%}|%t0%{%1%}, %g5}";
18637 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %t0%{%1%}|%t0%{%1%}, %g5}";
18639 return "v<sseintprefix>gatherq<ssemodesuffix>\t{%5, %0%{%1%}|%0%{%1%}, %g5}";
18641 [(set_attr "type" "ssemov")
18642 (set_attr "prefix" "evex")
18643 (set_attr "mode" "<sseinsnmode>")])
18645 (define_expand "<avx512>_scattersi<mode>"
18646 [(parallel [(set (mem:VI48F
18648 [(match_operand 0 "vsib_address_operand")
18649 (match_operand:<VEC_GATHER_IDXSI> 2 "register_operand")
18650 (match_operand:SI 4 "const1248_operand")]))
18652 [(match_operand:<avx512fmaskmode> 1 "register_operand")
18653 (match_operand:VI48F 3 "register_operand")]
18655 (clobber (match_scratch:<avx512fmaskmode> 6))])]
18659 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[0], operands[2],
18660 operands[4]), UNSPEC_VSIBADDR);
18663 (define_insn "*avx512f_scattersi<mode>"
18664 [(set (match_operator:VI48F 5 "vsib_mem_operator"
18666 [(match_operand:P 0 "vsib_address_operand" "Tv")
18667 (match_operand:<VEC_GATHER_IDXSI> 2 "register_operand" "v")
18668 (match_operand:SI 4 "const1248_operand" "n")]
18671 [(match_operand:<avx512fmaskmode> 6 "register_operand" "1")
18672 (match_operand:VI48F 3 "register_operand" "v")]
18674 (clobber (match_scratch:<avx512fmaskmode> 1 "=&Yk"))]
18676 "v<sseintprefix>scatterd<ssemodesuffix>\t{%3, %5%{%1%}|%5%{%1%}, %3}"
18677 [(set_attr "type" "ssemov")
18678 (set_attr "prefix" "evex")
18679 (set_attr "mode" "<sseinsnmode>")])
18681 (define_expand "<avx512>_scatterdi<mode>"
18682 [(parallel [(set (mem:VI48F
18684 [(match_operand 0 "vsib_address_operand")
18685 (match_operand:<VEC_GATHER_IDXDI> 2 "register_operand")
18686 (match_operand:SI 4 "const1248_operand")]))
18688 [(match_operand:QI 1 "register_operand")
18689 (match_operand:<VEC_GATHER_SRCDI> 3 "register_operand")]
18691 (clobber (match_scratch:QI 6))])]
18695 = gen_rtx_UNSPEC (Pmode, gen_rtvec (3, operands[0], operands[2],
18696 operands[4]), UNSPEC_VSIBADDR);
18699 (define_insn "*avx512f_scatterdi<mode>"
18700 [(set (match_operator:VI48F 5 "vsib_mem_operator"
18702 [(match_operand:P 0 "vsib_address_operand" "Tv")
18703 (match_operand:<VEC_GATHER_IDXDI> 2 "register_operand" "v")
18704 (match_operand:SI 4 "const1248_operand" "n")]
18707 [(match_operand:QI 6 "register_operand" "1")
18708 (match_operand:<VEC_GATHER_SRCDI> 3 "register_operand" "v")]
18710 (clobber (match_scratch:QI 1 "=&Yk"))]
18713 if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 8)
18714 return "v<sseintprefix>scatterq<ssemodesuffix>\t{%3, %5%{%1%}|%5%{%1%}, %3}";
18715 return "v<sseintprefix>scatterq<ssemodesuffix>\t{%3, %5%{%1%}|%t5%{%1%}, %3}";
18717 [(set_attr "type" "ssemov")
18718 (set_attr "prefix" "evex")
18719 (set_attr "mode" "<sseinsnmode>")])
18721 (define_insn "<avx512>_compress<mode>_mask"
18722 [(set (match_operand:VI48F 0 "register_operand" "=v")
18724 [(match_operand:VI48F 1 "register_operand" "v")
18725 (match_operand:VI48F 2 "vector_move_operand" "0C")
18726 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk")]
18729 "v<sseintprefix>compress<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
18730 [(set_attr "type" "ssemov")
18731 (set_attr "prefix" "evex")
18732 (set_attr "mode" "<sseinsnmode>")])
18734 (define_insn "<avx512>_compressstore<mode>_mask"
18735 [(set (match_operand:VI48F 0 "memory_operand" "=m")
18737 [(match_operand:VI48F 1 "register_operand" "x")
18739 (match_operand:<avx512fmaskmode> 2 "register_operand" "Yk")]
18740 UNSPEC_COMPRESS_STORE))]
18742 "v<sseintprefix>compress<ssemodesuffix>\t{%1, %0%{%2%}|%0%{%2%}, %1}"
18743 [(set_attr "type" "ssemov")
18744 (set_attr "prefix" "evex")
18745 (set_attr "memory" "store")
18746 (set_attr "mode" "<sseinsnmode>")])
18748 (define_expand "<avx512>_expand<mode>_maskz"
18749 [(set (match_operand:VI48F 0 "register_operand")
18751 [(match_operand:VI48F 1 "nonimmediate_operand")
18752 (match_operand:VI48F 2 "vector_move_operand")
18753 (match_operand:<avx512fmaskmode> 3 "register_operand")]
18756 "operands[2] = CONST0_RTX (<MODE>mode);")
18758 (define_insn "<avx512>_expand<mode>_mask"
18759 [(set (match_operand:VI48F 0 "register_operand" "=v,v")
18761 [(match_operand:VI48F 1 "nonimmediate_operand" "v,m")
18762 (match_operand:VI48F 2 "vector_move_operand" "0C,0C")
18763 (match_operand:<avx512fmaskmode> 3 "register_operand" "Yk,Yk")]
18766 "v<sseintprefix>expand<ssemodesuffix>\t{%1, %0%{%3%}%N2|%0%{%3%}%N2, %1}"
18767 [(set_attr "type" "ssemov")
18768 (set_attr "prefix" "evex")
18769 (set_attr "memory" "none,load")
18770 (set_attr "mode" "<sseinsnmode>")])
18772 (define_insn "avx512dq_rangep<mode><mask_name><round_saeonly_name>"
18773 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
18774 (unspec:VF_AVX512VL
18775 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
18776 (match_operand:VF_AVX512VL 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
18777 (match_operand:SI 3 "const_0_to_15_operand")]
18779 "TARGET_AVX512DQ && <round_saeonly_mode512bit_condition>"
18780 "vrange<ssemodesuffix>\t{%3, <round_saeonly_mask_op4>%2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2<round_saeonly_mask_op4>, %3}"
18781 [(set_attr "type" "sse")
18782 (set_attr "prefix" "evex")
18783 (set_attr "mode" "<MODE>")])
18785 (define_insn "avx512dq_ranges<mode><round_saeonly_name>"
18786 [(set (match_operand:VF_128 0 "register_operand" "=v")
18789 [(match_operand:VF_128 1 "register_operand" "v")
18790 (match_operand:VF_128 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
18791 (match_operand:SI 3 "const_0_to_15_operand")]
18796 "vrange<ssescalarmodesuffix>\t{%3, <round_saeonly_op4>%2, %1, %0|%0, %1, %2<round_saeonly_op4>, %3}"
18797 [(set_attr "type" "sse")
18798 (set_attr "prefix" "evex")
18799 (set_attr "mode" "<MODE>")])
18801 (define_insn "avx512dq_fpclass<mode><mask_scalar_merge_name>"
18802 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
18803 (unspec:<avx512fmaskmode>
18804 [(match_operand:VF_AVX512VL 1 "register_operand" "v")
18805 (match_operand:QI 2 "const_0_to_255_operand" "n")]
18808 "vfpclass<ssemodesuffix>\t{%2, %1, %0<mask_scalar_merge_operand3>|%0<mask_scalar_merge_operand3>, %1, %2}";
18809 [(set_attr "type" "sse")
18810 (set_attr "length_immediate" "1")
18811 (set_attr "prefix" "evex")
18812 (set_attr "mode" "<MODE>")])
18814 (define_insn "avx512dq_vmfpclass<mode>"
18815 [(set (match_operand:<avx512fmaskmode> 0 "register_operand" "=Yk")
18816 (and:<avx512fmaskmode>
18817 (unspec:<avx512fmaskmode>
18818 [(match_operand:VF_128 1 "register_operand" "v")
18819 (match_operand:QI 2 "const_0_to_255_operand" "n")]
18823 "vfpclass<ssescalarmodesuffix>\t{%2, %1, %0|%0, %1, %2}";
18824 [(set_attr "type" "sse")
18825 (set_attr "length_immediate" "1")
18826 (set_attr "prefix" "evex")
18827 (set_attr "mode" "<MODE>")])
18829 (define_insn "<avx512>_getmant<mode><mask_name><round_saeonly_name>"
18830 [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v")
18831 (unspec:VF_AVX512VL
18832 [(match_operand:VF_AVX512VL 1 "nonimmediate_operand" "<round_saeonly_constraint>")
18833 (match_operand:SI 2 "const_0_to_15_operand")]
18836 "vgetmant<ssemodesuffix>\t{%2, <round_saeonly_mask_op3>%1, %0<mask_operand3>|%0<mask_operand3>, %1<round_saeonly_mask_op3>, %2}";
18837 [(set_attr "prefix" "evex")
18838 (set_attr "mode" "<MODE>")])
18840 (define_insn "avx512f_vgetmant<mode><round_saeonly_name>"
18841 [(set (match_operand:VF_128 0 "register_operand" "=v")
18844 [(match_operand:VF_128 1 "register_operand" "v")
18845 (match_operand:VF_128 2 "<round_saeonly_nimm_predicate>" "<round_saeonly_constraint>")
18846 (match_operand:SI 3 "const_0_to_15_operand")]
18851 "vgetmant<ssescalarmodesuffix>\t{%3, <round_saeonly_op4>%2, %1, %0|%0, %1, %2<round_saeonly_op4>, %3}";
18852 [(set_attr "prefix" "evex")
18853 (set_attr "mode" "<ssescalarmode>")])
18855 ;; The correct representation for this is absolutely enormous, and
18856 ;; surely not generally useful.
18857 (define_insn "<mask_codefor>avx512bw_dbpsadbw<mode><mask_name>"
18858 [(set (match_operand:VI2_AVX512VL 0 "register_operand" "=v")
18859 (unspec:VI2_AVX512VL
18860 [(match_operand:<dbpsadbwmode> 1 "register_operand" "v")
18861 (match_operand:<dbpsadbwmode> 2 "nonimmediate_operand" "vm")
18862 (match_operand:SI 3 "const_0_to_255_operand")]
18865 "vdbpsadbw\t{%3, %2, %1, %0<mask_operand4>|%0<mask_operand4>, %1, %2, %3}"
18866 [(set_attr "isa" "avx")
18867 (set_attr "type" "sselog1")
18868 (set_attr "length_immediate" "1")
18869 (set_attr "prefix" "evex")
18870 (set_attr "mode" "<sseinsnmode>")])
18872 (define_insn "clz<mode>2<mask_name>"
18873 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
18875 (match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm")))]
18877 "vplzcnt<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
18878 [(set_attr "type" "sse")
18879 (set_attr "prefix" "evex")
18880 (set_attr "mode" "<sseinsnmode>")])
18882 (define_insn "<mask_codefor>conflict<mode><mask_name>"
18883 [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v")
18884 (unspec:VI48_AVX512VL
18885 [(match_operand:VI48_AVX512VL 1 "nonimmediate_operand" "vm")]
18888 "vpconflict<ssemodesuffix>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}"
18889 [(set_attr "type" "sse")
18890 (set_attr "prefix" "evex")
18891 (set_attr "mode" "<sseinsnmode>")])
18893 (define_insn "sha1msg1"
18894 [(set (match_operand:V4SI 0 "register_operand" "=x")
18896 [(match_operand:V4SI 1 "register_operand" "0")
18897 (match_operand:V4SI 2 "vector_operand" "xBm")]
18900 "sha1msg1\t{%2, %0|%0, %2}"
18901 [(set_attr "type" "sselog1")
18902 (set_attr "mode" "TI")])
18904 (define_insn "sha1msg2"
18905 [(set (match_operand:V4SI 0 "register_operand" "=x")
18907 [(match_operand:V4SI 1 "register_operand" "0")
18908 (match_operand:V4SI 2 "vector_operand" "xBm")]
18911 "sha1msg2\t{%2, %0|%0, %2}"
18912 [(set_attr "type" "sselog1")
18913 (set_attr "mode" "TI")])
18915 (define_insn "sha1nexte"
18916 [(set (match_operand:V4SI 0 "register_operand" "=x")
18918 [(match_operand:V4SI 1 "register_operand" "0")
18919 (match_operand:V4SI 2 "vector_operand" "xBm")]
18920 UNSPEC_SHA1NEXTE))]
18922 "sha1nexte\t{%2, %0|%0, %2}"
18923 [(set_attr "type" "sselog1")
18924 (set_attr "mode" "TI")])
18926 (define_insn "sha1rnds4"
18927 [(set (match_operand:V4SI 0 "register_operand" "=x")
18929 [(match_operand:V4SI 1 "register_operand" "0")
18930 (match_operand:V4SI 2 "vector_operand" "xBm")
18931 (match_operand:SI 3 "const_0_to_3_operand" "n")]
18932 UNSPEC_SHA1RNDS4))]
18934 "sha1rnds4\t{%3, %2, %0|%0, %2, %3}"
18935 [(set_attr "type" "sselog1")
18936 (set_attr "length_immediate" "1")
18937 (set_attr "mode" "TI")])
18939 (define_insn "sha256msg1"
18940 [(set (match_operand:V4SI 0 "register_operand" "=x")
18942 [(match_operand:V4SI 1 "register_operand" "0")
18943 (match_operand:V4SI 2 "vector_operand" "xBm")]
18944 UNSPEC_SHA256MSG1))]
18946 "sha256msg1\t{%2, %0|%0, %2}"
18947 [(set_attr "type" "sselog1")
18948 (set_attr "mode" "TI")])
18950 (define_insn "sha256msg2"
18951 [(set (match_operand:V4SI 0 "register_operand" "=x")
18953 [(match_operand:V4SI 1 "register_operand" "0")
18954 (match_operand:V4SI 2 "vector_operand" "xBm")]
18955 UNSPEC_SHA256MSG2))]
18957 "sha256msg2\t{%2, %0|%0, %2}"
18958 [(set_attr "type" "sselog1")
18959 (set_attr "mode" "TI")])
18961 (define_insn "sha256rnds2"
18962 [(set (match_operand:V4SI 0 "register_operand" "=x")
18964 [(match_operand:V4SI 1 "register_operand" "0")
18965 (match_operand:V4SI 2 "vector_operand" "xBm")
18966 (match_operand:V4SI 3 "register_operand" "Yz")]
18967 UNSPEC_SHA256RNDS2))]
18969 "sha256rnds2\t{%3, %2, %0|%0, %2, %3}"
18970 [(set_attr "type" "sselog1")
18971 (set_attr "length_immediate" "1")
18972 (set_attr "mode" "TI")])
18974 (define_insn_and_split "avx512f_<castmode><avxsizesuffix>_<castmode>"
18975 [(set (match_operand:AVX512MODE2P 0 "nonimmediate_operand" "=x,m")
18976 (unspec:AVX512MODE2P
18977 [(match_operand:<ssequartermode> 1 "nonimmediate_operand" "xm,x")]
18981 "&& reload_completed"
18982 [(set (match_dup 0) (match_dup 1))]
18984 if (REG_P (operands[0]))
18985 operands[0] = gen_lowpart (<ssequartermode>mode, operands[0]);
18987 operands[1] = lowpart_subreg (<MODE>mode, operands[1],
18988 <ssequartermode>mode);
18991 (define_insn_and_split "avx512f_<castmode><avxsizesuffix>_256<castmode>"
18992 [(set (match_operand:AVX512MODE2P 0 "nonimmediate_operand" "=x,m")
18993 (unspec:AVX512MODE2P
18994 [(match_operand:<ssehalfvecmode> 1 "nonimmediate_operand" "xm,x")]
18998 "&& reload_completed"
18999 [(set (match_dup 0) (match_dup 1))]
19001 if (REG_P (operands[0]))
19002 operands[0] = gen_lowpart (<ssehalfvecmode>mode, operands[0]);
19004 operands[1] = lowpart_subreg (<MODE>mode, operands[1],
19005 <ssehalfvecmode>mode);
19008 (define_int_iterator VPMADD52
19009 [UNSPEC_VPMADD52LUQ
19010 UNSPEC_VPMADD52HUQ])
19012 (define_int_attr vpmadd52type
19013 [(UNSPEC_VPMADD52LUQ "luq") (UNSPEC_VPMADD52HUQ "huq")])
19015 (define_expand "vpamdd52huq<mode>_maskz"
19016 [(match_operand:VI8_AVX512VL 0 "register_operand")
19017 (match_operand:VI8_AVX512VL 1 "register_operand")
19018 (match_operand:VI8_AVX512VL 2 "register_operand")
19019 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand")
19020 (match_operand:<avx512fmaskmode> 4 "register_operand")]
19021 "TARGET_AVX512IFMA"
19023 emit_insn (gen_vpamdd52huq<mode>_maskz_1 (
19024 operands[0], operands[1], operands[2], operands[3],
19025 CONST0_RTX (<MODE>mode), operands[4]));
19029 (define_expand "vpamdd52luq<mode>_maskz"
19030 [(match_operand:VI8_AVX512VL 0 "register_operand")
19031 (match_operand:VI8_AVX512VL 1 "register_operand")
19032 (match_operand:VI8_AVX512VL 2 "register_operand")
19033 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand")
19034 (match_operand:<avx512fmaskmode> 4 "register_operand")]
19035 "TARGET_AVX512IFMA"
19037 emit_insn (gen_vpamdd52luq<mode>_maskz_1 (
19038 operands[0], operands[1], operands[2], operands[3],
19039 CONST0_RTX (<MODE>mode), operands[4]));
19043 (define_insn "vpamdd52<vpmadd52type><mode><sd_maskz_name>"
19044 [(set (match_operand:VI8_AVX512VL 0 "register_operand" "=v")
19045 (unspec:VI8_AVX512VL
19046 [(match_operand:VI8_AVX512VL 1 "register_operand" "0")
19047 (match_operand:VI8_AVX512VL 2 "register_operand" "v")
19048 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand" "vm")]
19050 "TARGET_AVX512IFMA"
19051 "vpmadd52<vpmadd52type>\t{%3, %2, %0<sd_mask_op4>|%0<sd_mask_op4>, %2, %3}"
19052 [(set_attr "type" "ssemuladd")
19053 (set_attr "prefix" "evex")
19054 (set_attr "mode" "<sseinsnmode>")])
19056 (define_insn "vpamdd52<vpmadd52type><mode>_mask"
19057 [(set (match_operand:VI8_AVX512VL 0 "register_operand" "=v")
19058 (vec_merge:VI8_AVX512VL
19059 (unspec:VI8_AVX512VL
19060 [(match_operand:VI8_AVX512VL 1 "register_operand" "0")
19061 (match_operand:VI8_AVX512VL 2 "register_operand" "v")
19062 (match_operand:VI8_AVX512VL 3 "nonimmediate_operand" "vm")]
19065 (match_operand:<avx512fmaskmode> 4 "register_operand" "Yk")))]
19066 "TARGET_AVX512IFMA"
19067 "vpmadd52<vpmadd52type>\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3}"
19068 [(set_attr "type" "ssemuladd")
19069 (set_attr "prefix" "evex")
19070 (set_attr "mode" "<sseinsnmode>")])
19072 (define_insn "vpmultishiftqb<mode><mask_name>"
19073 [(set (match_operand:VI1_AVX512VL 0 "register_operand" "=v")
19074 (unspec:VI1_AVX512VL
19075 [(match_operand:VI1_AVX512VL 1 "register_operand" "v")
19076 (match_operand:VI1_AVX512VL 2 "nonimmediate_operand" "vm")]
19077 UNSPEC_VPMULTISHIFT))]
19078 "TARGET_AVX512VBMI"
19079 "vpmultishiftqb\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
19080 [(set_attr "type" "sselog")
19081 (set_attr "prefix" "evex")
19082 (set_attr "mode" "<sseinsnmode>")])