aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/X86/X86InstrXOP.td
blob: 0734333837147f0abd6c16b6521a1a6fb036ec1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
//====- X86InstrXOP.td - Describe the X86 Instruction Set --*- tablegen -*-====//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===-----------------------------------------------------------------------===//
//
// This file describes XOP (eXtended OPerations)
//
//===-----------------------------------------------------------------------===//

multiclass xop2op<bits<8> opc, string OpcodeStr, Intrinsic Int, PatFrag memop> {
  def rr : IXOP<opc, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src),
           !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"),
           [(set VR128:$dst, (Int VR128:$src))]>, VEX;
  def rm : IXOP<opc, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src),
           !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"),
           [(set VR128:$dst, (Int (bitconvert (memop addr:$src))))]>, VEX;
}

let isAsmParserOnly = 1 in {
  defm VPHSUBWD  : xop2op<0xE2, "vphsubwd", int_x86_xop_vphsubwd, memopv2i64>;
  defm VPHSUBDQ  : xop2op<0xE3, "vphsubdq", int_x86_xop_vphsubdq, memopv2i64>;
  defm VPHSUBBW  : xop2op<0xE1, "vphsubbw", int_x86_xop_vphsubbw, memopv2i64>;
  defm VPHADDWQ  : xop2op<0xC7, "vphaddwq", int_x86_xop_vphaddwq, memopv2i64>;
  defm VPHADDWD  : xop2op<0xC6, "vphaddwd", int_x86_xop_vphaddwd, memopv2i64>;
  defm VPHADDUWQ : xop2op<0xD7, "vphadduwq", int_x86_xop_vphadduwq, memopv2i64>;
  defm VPHADDUWD : xop2op<0xD6, "vphadduwd", int_x86_xop_vphadduwd, memopv2i64>;
  defm VPHADDUDQ : xop2op<0xDB, "vphaddudq", int_x86_xop_vphaddudq, memopv2i64>;
  defm VPHADDUBW : xop2op<0xD1, "vphaddubw", int_x86_xop_vphaddubw, memopv2i64>;
  defm VPHADDUBQ : xop2op<0xD3, "vphaddubq", int_x86_xop_vphaddubq, memopv2i64>;
  defm VPHADDUBD : xop2op<0xD2, "vphaddubd", int_x86_xop_vphaddubd, memopv2i64>;
  defm VPHADDDQ  : xop2op<0xCB, "vphadddq", int_x86_xop_vphadddq, memopv2i64>;
  defm VPHADDBW  : xop2op<0xC1, "vphaddbw", int_x86_xop_vphaddbw, memopv2i64>;
  defm VPHADDBQ  : xop2op<0xC3, "vphaddbq", int_x86_xop_vphaddbq, memopv2i64>;
  defm VPHADDBD  : xop2op<0xC2, "vphaddbd", int_x86_xop_vphaddbd, memopv2i64>;
  defm VFRCZPS   : xop2op<0x80, "vfrczps", int_x86_xop_vfrcz_ps, memopv4f32>;
  defm VFRCZPD   : xop2op<0x81, "vfrczpd", int_x86_xop_vfrcz_pd, memopv2f64>;
}

// Scalar load 2 addr operand instructions
let Constraints = "$src1 = $dst" in {
multiclass xop2opsld<bits<8> opc, string OpcodeStr, Intrinsic Int,
                     Operand memop, ComplexPattern mem_cpat> {
  def rr : IXOP<opc, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src1,
                                                        VR128:$src2),
           !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"),
           [(set VR128:$dst, (Int VR128:$src1, VR128:$src2))]>, VEX;
  def rm : IXOP<opc, MRMSrcMem, (outs VR128:$dst), (ins VR128:$src1,
                                                        memop:$src2),
           !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"),
           [(set VR128:$dst, (Int VR128:$src1,
                                  (bitconvert mem_cpat:$src2)))]>, VEX;
}

} // Constraints = "$src1 = $dst"

let isAsmParserOnly = 1 in {
  defm VFRCZSS   : xop2opsld<0x82, "vfrczss", int_x86_xop_vfrcz_ss,
                   ssmem, sse_load_f32>;
  defm VFRCZSD   : xop2opsld<0x83, "vfrczsd", int_x86_xop_vfrcz_sd,
                   sdmem, sse_load_f64>;
}


multiclass xop2op256<bits<8> opc, string OpcodeStr, Intrinsic Int,
                     PatFrag memop> {
  def rrY : IXOP<opc, MRMSrcReg, (outs VR256:$dst), (ins VR256:$src),
           !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"),
           [(set VR256:$dst, (Int VR256:$src))]>, VEX, VEX_L;
  def rmY : IXOP<opc, MRMSrcMem, (outs VR256:$dst), (ins f256mem:$src),
           !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"),
           [(set VR256:$dst, (Int (bitconvert (memop addr:$src))))]>, VEX;
}

let isAsmParserOnly = 1 in {
  defm VFRCZPS : xop2op256<0x80, "vfrczps", int_x86_xop_vfrcz_ps_256,
                           memopv8f32>;
  defm VFRCZPD : xop2op256<0x81, "vfrczpd", int_x86_xop_vfrcz_pd_256,
                           memopv4f64>;
}

multiclass xop3op<bits<8> opc, string OpcodeStr, Intrinsic Int> {
  def rr : IXOP<opc, MRMSrcReg, (outs VR128:$dst),
           (ins VR128:$src1, VR128:$src2),
           !strconcat(OpcodeStr, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
           [(set VR128:$dst, (Int VR128:$src1, VR128:$src2))]>, VEX_4VOp3;
  def rm : IXOP<opc, MRMSrcMem, (outs VR128:$dst),
           (ins VR128:$src1, f128mem:$src2),
           !strconcat(OpcodeStr, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
           [(set VR128:$dst,
              (Int VR128:$src1, (bitconvert (memopv2i64 addr:$src2))))]>,
           VEX_4V, VEX_W;
  def mr : IXOP<opc, MRMSrcMem, (outs VR128:$dst),
           (ins f128mem:$src1, VR128:$src2),
           !strconcat(OpcodeStr, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
           [(set VR128:$dst,
              (Int (bitconvert (memopv2i64 addr:$src1)), VR128:$src2))]>,
             VEX_4VOp3;
}

let isAsmParserOnly = 1 in {
  defm VPSHLW : xop3op<0x95, "vpshlw", int_x86_xop_vpshlw>;
  defm VPSHLQ : xop3op<0x97, "vpshlq", int_x86_xop_vpshlq>;
  defm VPSHLD : xop3op<0x96, "vpshld", int_x86_xop_vpshld>;
  defm VPSHLB : xop3op<0x94, "vpshlb", int_x86_xop_vpshlb>;
  defm VPSHAW : xop3op<0x99, "vpshaw", int_x86_xop_vpshaw>;
  defm VPSHAQ : xop3op<0x9B, "vpshaq", int_x86_xop_vpshaq>;
  defm VPSHAD : xop3op<0x9A, "vpshad", int_x86_xop_vpshad>;
  defm VPSHAB : xop3op<0x98, "vpshab", int_x86_xop_vpshab>;
  defm VPROTW : xop3op<0x91, "vprotw", int_x86_xop_vprotw>;
  defm VPROTQ : xop3op<0x93, "vprotq", int_x86_xop_vprotq>;
  defm VPROTD : xop3op<0x92, "vprotd", int_x86_xop_vprotd>;
  defm VPROTB : xop3op<0x90, "vprotb", int_x86_xop_vprotb>;
}

multiclass xop3opimm<bits<8> opc, string OpcodeStr> {
  def ri : IXOPi8<opc, MRMSrcReg, (outs VR128:$dst),
           (ins VR128:$src1, i8imm:$src2),
           !strconcat(OpcodeStr, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
           []>, VEX;
  def mi : IXOPi8<opc, MRMSrcMem, (outs VR128:$dst),
           (ins f128mem:$src1, i8imm:$src2),
           !strconcat(OpcodeStr, "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
           []>, VEX;
}

let isAsmParserOnly = 1 in {
  defm VPROTW : xop3opimm<0xC1, "vprotw">;
  defm VPROTQ : xop3opimm<0xC3, "vprotq">;
  defm VPROTD : xop3opimm<0xC2, "vprotd">;
  defm VPROTB : xop3opimm<0xC0, "vprotb">;
}

// Instruction where second source can be memory, but third must be register
multiclass xop4opm2<bits<8> opc, string OpcodeStr, Intrinsic Int> {
  def rr : IXOPi8<opc, MRMSrcReg, (outs VR128:$dst),
           (ins VR128:$src1, VR128:$src2, VR128:$src3),
           !strconcat(OpcodeStr,
           "\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"),
           [(set VR128:$dst,
              (Int VR128:$src1, VR128:$src2, VR128:$src3))]>, VEX_4V, VEX_I8IMM;
  def rm : IXOPi8<opc, MRMSrcMem, (outs VR128:$dst),
           (ins VR128:$src1, f128mem:$src2, VR128:$src3),
           !strconcat(OpcodeStr,
           "\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"),
           [(set VR128:$dst,
              (Int VR128:$src1, (bitconvert (memopv2i64 addr:$src2)),
              VR128:$src3))]>, VEX_4V, VEX_I8IMM;
}

let isAsmParserOnly = 1 in {
  defm VPMADCSWD  : xop4opm2<0xB6, "vpmadcswd", int_x86_xop_vpmadcswd>;
  defm VPMADCSSWD : xop4opm2<0xA6, "vpmadcsswd", int_x86_xop_vpmadcsswd>;
  defm VPMACSWW   : xop4opm2<0x95, "vpmacsww", int_x86_xop_vpmacsww>;
  defm VPMACSWD   : xop4opm2<0x96, "vpmacswd", int_x86_xop_vpmacswd>;
  defm VPMACSSWW  : xop4opm2<0x85, "vpmacssww", int_x86_xop_vpmacssww>;
  defm VPMACSSWD  : xop4opm2<0x86, "vpmacsswd", int_x86_xop_vpmacsswd>;
  defm VPMACSSDQL : xop4opm2<0x87, "vpmacssdql", int_x86_xop_vpmacssdql>;
  defm VPMACSSDQH : xop4opm2<0x8F, "vpmacssdqh", int_x86_xop_vpmacssdqh>;
  defm VPMACSSDD  : xop4opm2<0x8E, "vpmacssdd", int_x86_xop_vpmacssdd>;
  defm VPMACSDQL  : xop4opm2<0x97, "vpmacsdql", int_x86_xop_vpmacsdql>;
  defm VPMACSDQH  : xop4opm2<0x9F, "vpmacsdqh", int_x86_xop_vpmacsdqh>;
  defm VPMACSDD   : xop4opm2<0x9E, "vpmacsdd", int_x86_xop_vpmacsdd>;
}

// Instruction where second source can be memory, third must be imm8
multiclass xop4opimm<bits<8> opc, string OpcodeStr> {
  def ri : IXOPi8<opc, MRMSrcReg, (outs VR128:$dst),
           (ins VR128:$src1, VR128:$src2, i8imm:$src3),
           !strconcat(OpcodeStr,
           "\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"),
           []>, VEX_4V;
  def mi : IXOPi8<opc, MRMSrcMem, (outs VR128:$dst),
           (ins VR128:$src1, f128mem:$src2, i8imm:$src3),
           !strconcat(OpcodeStr,
           "\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"),
           []>, VEX_4V;
}

let isAsmParserOnly = 1 in {
  defm VPCOMW  : xop4opimm<0xCD, "vpcomw">;
  defm VPCOMUW : xop4opimm<0xED, "vpcomuw">;
  defm VPCOMUQ : xop4opimm<0xEF, "vpcomuq">;
  defm VPCOMUD : xop4opimm<0xEE, "vpcomud">;
  defm VPCOMUB : xop4opimm<0xEC, "vpcomub">;
  defm VPCOMQ  : xop4opimm<0xCF, "vpcomq">;
  defm VPCOMD  : xop4opimm<0xCE, "vpcomd">;
  defm VPCOMB  : xop4opimm<0xCC, "vpcomb">;
}

// Instruction where either second or third source can be memory
multiclass xop4op<bits<8> opc, string OpcodeStr> {
  def rr : IXOPi8<opc, MRMSrcReg, (outs VR128:$dst),
           (ins VR128:$src1, VR128:$src2, VR128:$src3),
           !strconcat(OpcodeStr,
           "\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"),
           []>, VEX_4V, VEX_I8IMM;
  def rm : IXOPi8<opc, MRMSrcMem, (outs VR128:$dst),
           (ins VR128:$src1, VR128:$src2, f128mem:$src3),
           !strconcat(OpcodeStr,
           "\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"),
           []>, VEX_4V, VEX_I8IMM, VEX_W, MemOp4;
  def mr : IXOPi8<opc, MRMSrcMem, (outs VR128:$dst),
           (ins VR128:$src1, f128mem:$src2, VR128:$src3),
           !strconcat(OpcodeStr,
           "\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"),
           []>, VEX_4V, VEX_I8IMM;
}

let isAsmParserOnly = 1 in {
  defm VPPERM : xop4op<0xA3, "vpperm">;
  defm VPCMOV : xop4op<0xA2, "vpcmov">;
}

multiclass xop4op256<bits<8> opc, string OpcodeStr> {
  def rrY : IXOPi8<opc, MRMSrcReg, (outs VR256:$dst),
           (ins VR256:$src1, VR256:$src2, VR256:$src3),
           !strconcat(OpcodeStr,
           "\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"),
           []>, VEX_4V, VEX_I8IMM;
  def rmY : IXOPi8<opc, MRMSrcMem, (outs VR256:$dst),
           (ins VR256:$src1, VR256:$src2, f256mem:$src3),
           !strconcat(OpcodeStr,
           "\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"),
           []>, VEX_4V, VEX_I8IMM, VEX_W, MemOp4;
  def mrY : IXOPi8<opc, MRMSrcMem, (outs VR256:$dst),
           (ins VR256:$src1, f256mem:$src2, VR256:$src3),
           !strconcat(OpcodeStr,
           "\t{$src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3}"),
           []>, VEX_4V, VEX_I8IMM;
}

let isAsmParserOnly = 1 in {
  defm VPCMOV : xop4op256<0xA2, "vpcmov">;
}

multiclass xop5op<bits<8> opc, string OpcodeStr, Intrinsic Int128,
                  Intrinsic Int256, PatFrag ld_128, PatFrag ld_256> {
  def rr : IXOP5<opc, MRMSrcReg, (outs VR128:$dst),
        (ins VR128:$src1, VR128:$src2, VR128:$src3, i8imm:$src4),
        !strconcat(OpcodeStr,
        "\t{$src4, $src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3, $src4}"),
        [(set VR128:$dst,
           (Int128 VR128:$src1, VR128:$src2, VR128:$src3, imm:$src4))]>;
  def rm : IXOP5<opc, MRMSrcMem, (outs VR128:$dst),
        (ins VR128:$src1, VR128:$src2, f128mem:$src3, i8imm:$src4),
        !strconcat(OpcodeStr,
        "\t{$src4, $src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3, $src4}"),
        [(set VR128:$dst,
           (Int128 VR128:$src1, VR128:$src2, (ld_128 addr:$src3), imm:$src4))]>,
        VEX_W, MemOp4;
  def mr : IXOP5<opc, MRMSrcMem, (outs VR128:$dst),
        (ins VR128:$src1, f128mem:$src2, VR128:$src3, i8imm:$src4),
        !strconcat(OpcodeStr,
        "\t{$src4, $src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3, $src4}"),
        [(set VR128:$dst,
           (Int128 VR128:$src1, (ld_128 addr:$src2), VR128:$src3, imm:$src4))]>;
  def rrY : IXOP5<opc, MRMSrcReg, (outs VR256:$dst),
        (ins VR256:$src1, VR256:$src2, VR256:$src3, i8imm:$src4),
        !strconcat(OpcodeStr,
        "\t{$src4, $src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3, $src4}"),
        [(set VR256:$dst,
          (Int256 VR256:$src1, VR256:$src2, VR256:$src3, imm:$src4))]>;
  def rmY : IXOP5<opc, MRMSrcMem, (outs VR256:$dst),
        (ins VR256:$src1, VR256:$src2, f256mem:$src3, i8imm:$src4),
        !strconcat(OpcodeStr,
        "\t{$src4, $src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3, $src4}"),
        [(set VR256:$dst,
          (Int256 VR256:$src1, VR256:$src2, (ld_256 addr:$src3), imm:$src4))]>,
        VEX_W, MemOp4;
  def mrY : IXOP5<opc, MRMSrcMem, (outs VR256:$dst),
        (ins VR256:$src1, f256mem:$src2, VR256:$src3, i8imm:$src4),
        !strconcat(OpcodeStr,
        "\t{$src4, $src3, $src2, $src1, $dst|$dst, $src1, $src2, $src3, $src4}"),
        [(set VR256:$dst,
           (Int256 VR256:$src1, (ld_256 addr:$src2), VR256:$src3, imm:$src4))]>;
}

defm VPERMIL2PD : xop5op<0x49, "vpermil2pd", int_x86_xop_vpermil2pd,
                         int_x86_xop_vpermil2pd_256, memopv2f64, memopv4f64>;
defm VPERMIL2PS : xop5op<0x48, "vpermil2ps", int_x86_xop_vpermil2ps,
                         int_x86_xop_vpermil2ps_256, memopv4f32, memopv8f32>;

// XOP Intrinsics patterns

// VPCOM EQ
def : Pat<(int_x86_xop_vpcomeqw VR128:$src1, VR128:$src2),
          (VPCOMWri VR128:$src1, VR128:$src2, (i8 4))>;
def : Pat<(int_x86_xop_vpcomeqw VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMWmi VR128:$src1, addr:$src2, (i8 4))>;

def : Pat<(int_x86_xop_vpcomequw VR128:$src1, VR128:$src2),
          (VPCOMUWri VR128:$src1, VR128:$src2, (i8 4))>;
def : Pat<(int_x86_xop_vpcomequw VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMUWmi VR128:$src1, addr:$src2, (i8 4))>;

def : Pat<(int_x86_xop_vpcomequq VR128:$src1, VR128:$src2),
          (VPCOMUQri VR128:$src1, VR128:$src2, (i8 4))>;
def : Pat<(int_x86_xop_vpcomequq VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMUQmi VR128:$src1, addr:$src2, (i8 4))>;

def : Pat<(int_x86_xop_vpcomequd VR128:$src1, VR128:$src2),
          (VPCOMUDri VR128:$src1, VR128:$src2, (i8 4))>;
def : Pat<(int_x86_xop_vpcomequd VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMUDmi VR128:$src1, addr:$src2, (i8 4))>;

def : Pat<(int_x86_xop_vpcomequb VR128:$src1, VR128:$src2),
          (VPCOMUBri VR128:$src1, VR128:$src2, (i8 4))>;
def : Pat<(int_x86_xop_vpcomequb VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMUBmi VR128:$src1, addr:$src2, (i8 4))>;

def : Pat<(int_x86_xop_vpcomeqq VR128:$src1, VR128:$src2),
          (VPCOMQri VR128:$src1, VR128:$src2, (i8 4))>;
def : Pat<(int_x86_xop_vpcomeqq VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMQmi VR128:$src1, addr:$src2, (i8 4))>;

def : Pat<(int_x86_xop_vpcomeqd VR128:$src1, VR128:$src2),
          (VPCOMDri VR128:$src1, VR128:$src2, (i8 4))>;
def : Pat<(int_x86_xop_vpcomeqd VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMDmi VR128:$src1, addr:$src2, (i8 4))>;

def : Pat<(int_x86_xop_vpcomeqb VR128:$src1, VR128:$src2),
          (VPCOMBri VR128:$src1, VR128:$src2, (i8 4))>;
def : Pat<(int_x86_xop_vpcomeqb VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMBmi VR128:$src1, addr:$src2, (i8 4))>;

// VPCOM FALSE
def : Pat<(int_x86_xop_vpcomfalsew VR128:$src1, VR128:$src2),
          (VPCOMWri VR128:$src1, VR128:$src2, (i8 6))>;
def : Pat<(int_x86_xop_vpcomfalsew VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMWmi VR128:$src1, addr:$src2, (i8 6))>;

def : Pat<(int_x86_xop_vpcomfalseuw VR128:$src1, VR128:$src2),
          (VPCOMUWri VR128:$src1, VR128:$src2, (i8 6))>;
def : Pat<(int_x86_xop_vpcomfalseuw VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMUWmi VR128:$src1, addr:$src2, (i8 6))>;

def : Pat<(int_x86_xop_vpcomfalseuq VR128:$src1, VR128:$src2),
          (VPCOMUQri VR128:$src1, VR128:$src2, (i8 6))>;
def : Pat<(int_x86_xop_vpcomfalseuq VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMUQmi VR128:$src1, addr:$src2, (i8 6))>;

def : Pat<(int_x86_xop_vpcomfalseud VR128:$src1, VR128:$src2),
          (VPCOMUDri VR128:$src1, VR128:$src2, (i8 6))>;
def : Pat<(int_x86_xop_vpcomfalseud VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMUDmi VR128:$src1, addr:$src2, (i8 6))>;

def : Pat<(int_x86_xop_vpcomfalseub VR128:$src1, VR128:$src2),
          (VPCOMUBri VR128:$src1, VR128:$src2, (i8 6))>;
def : Pat<(int_x86_xop_vpcomfalseub VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMUBmi VR128:$src1, addr:$src2, (i8 6))>;

def : Pat<(int_x86_xop_vpcomfalseq VR128:$src1, VR128:$src2),
          (VPCOMQri VR128:$src1, VR128:$src2, (i8 6))>;
def : Pat<(int_x86_xop_vpcomfalseq VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMQmi VR128:$src1, addr:$src2, (i8 6))>;

def : Pat<(int_x86_xop_vpcomfalsed VR128:$src1, VR128:$src2),
          (VPCOMDri VR128:$src1, VR128:$src2, (i8 6))>;
def : Pat<(int_x86_xop_vpcomfalsed VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMDmi VR128:$src1, addr:$src2, (i8 6))>;

def : Pat<(int_x86_xop_vpcomfalseb VR128:$src1, VR128:$src2),
          (VPCOMBri VR128:$src1, VR128:$src2, (i8 6))>;
def : Pat<(int_x86_xop_vpcomfalseb VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMBmi VR128:$src1, addr:$src2, (i8 6))>;

// VPCOM GE
def : Pat<(int_x86_xop_vpcomgew VR128:$src1, VR128:$src2),
          (VPCOMWri VR128:$src1, VR128:$src2, (i8 3))>;
def : Pat<(int_x86_xop_vpcomgew VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMWmi VR128:$src1, addr:$src2, (i8 3))>;

def : Pat<(int_x86_xop_vpcomgeuw VR128:$src1, VR128:$src2),
          (VPCOMUWri VR128:$src1, VR128:$src2, (i8 3))>;
def : Pat<(int_x86_xop_vpcomgeuw VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMUWmi VR128:$src1, addr:$src2, (i8 3))>;

def : Pat<(int_x86_xop_vpcomgeuq VR128:$src1, VR128:$src2),
          (VPCOMUQri VR128:$src1, VR128:$src2, (i8 3))>;
def : Pat<(int_x86_xop_vpcomgeuq VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMUQmi VR128:$src1, addr:$src2, (i8 3))>;

def : Pat<(int_x86_xop_vpcomgeud VR128:$src1, VR128:$src2),
          (VPCOMUDri VR128:$src1, VR128:$src2, (i8 3))>;
def : Pat<(int_x86_xop_vpcomgeud VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMUDmi VR128:$src1, addr:$src2, (i8 3))>;

def : Pat<(int_x86_xop_vpcomgeub VR128:$src1, VR128:$src2),
          (VPCOMUBri VR128:$src1, VR128:$src2, (i8 3))>;
def : Pat<(int_x86_xop_vpcomgeub VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMUBmi VR128:$src1, addr:$src2, (i8 3))>;

def : Pat<(int_x86_xop_vpcomgeq VR128:$src1, VR128:$src2),
          (VPCOMQri VR128:$src1, VR128:$src2, (i8 3))>;
def : Pat<(int_x86_xop_vpcomgeq VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMQmi VR128:$src1, addr:$src2, (i8 3))>;

def : Pat<(int_x86_xop_vpcomged VR128:$src1, VR128:$src2),
          (VPCOMDri VR128:$src1, VR128:$src2, (i8 3))>;
def : Pat<(int_x86_xop_vpcomged VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMDmi VR128:$src1, addr:$src2, (i8 3))>;

def : Pat<(int_x86_xop_vpcomgeb VR128:$src1, VR128:$src2),
          (VPCOMBri VR128:$src1, VR128:$src2, (i8 3))>;
def : Pat<(int_x86_xop_vpcomgeb VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMBmi VR128:$src1, addr:$src2, (i8 3))>;

// VPCOM GT
def : Pat<(int_x86_xop_vpcomgtw VR128:$src1, VR128:$src2),
          (VPCOMWri VR128:$src1, VR128:$src2, (i8 2))>;
def : Pat<(int_x86_xop_vpcomgtw VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMWmi VR128:$src1, addr:$src2, (i8 2))>;

def : Pat<(int_x86_xop_vpcomgtuw VR128:$src1, VR128:$src2),
          (VPCOMUWri VR128:$src1, VR128:$src2, (i8 2))>;
def : Pat<(int_x86_xop_vpcomgtuw VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMUWmi VR128:$src1, addr:$src2, (i8 2))>;

def : Pat<(int_x86_xop_vpcomgtuq VR128:$src1, VR128:$src2),
          (VPCOMUQri VR128:$src1, VR128:$src2, (i8 2))>;
def : Pat<(int_x86_xop_vpcomgtuq VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMUQmi VR128:$src1, addr:$src2, (i8 2))>;

def : Pat<(int_x86_xop_vpcomgtud VR128:$src1, VR128:$src2),
          (VPCOMUDri VR128:$src1, VR128:$src2, (i8 2))>;
def : Pat<(int_x86_xop_vpcomgtud VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMUDmi VR128:$src1, addr:$src2, (i8 2))>;

def : Pat<(int_x86_xop_vpcomgtub VR128:$src1, VR128:$src2),
          (VPCOMUBri VR128:$src1, VR128:$src2, (i8 2))>;
def : Pat<(int_x86_xop_vpcomgtub VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMUBmi VR128:$src1, addr:$src2, (i8 2))>;

def : Pat<(int_x86_xop_vpcomgtq VR128:$src1, VR128:$src2),
          (VPCOMQri VR128:$src1, VR128:$src2, (i8 2))>;
def : Pat<(int_x86_xop_vpcomgtq VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMQmi VR128:$src1, addr:$src2, (i8 2))>;

def : Pat<(int_x86_xop_vpcomgtd VR128:$src1, VR128:$src2),
          (VPCOMDri VR128:$src1, VR128:$src2, (i8 2))>;
def : Pat<(int_x86_xop_vpcomgtd VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMDmi VR128:$src1, addr:$src2, (i8 2))>;

def : Pat<(int_x86_xop_vpcomgtb VR128:$src1, VR128:$src2),
          (VPCOMBri VR128:$src1, VR128:$src2, (i8 2))>;
def : Pat<(int_x86_xop_vpcomgtb VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMBmi VR128:$src1, addr:$src2, (i8 2))>;

// VPCOM LE
def : Pat<(int_x86_xop_vpcomlew VR128:$src1, VR128:$src2),
          (VPCOMWri VR128:$src1, VR128:$src2, (i8 1))>;
def : Pat<(int_x86_xop_vpcomlew VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMWmi VR128:$src1, addr:$src2, (i8 1))>;

def : Pat<(int_x86_xop_vpcomleuw VR128:$src1, VR128:$src2),
          (VPCOMUWri VR128:$src1, VR128:$src2, (i8 1))>;
def : Pat<(int_x86_xop_vpcomleuw VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMUWmi VR128:$src1, addr:$src2, (i8 1))>;

def : Pat<(int_x86_xop_vpcomleuq VR128:$src1, VR128:$src2),
          (VPCOMUQri VR128:$src1, VR128:$src2, (i8 1))>;
def : Pat<(int_x86_xop_vpcomleuq VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMUQmi VR128:$src1, addr:$src2, (i8 1))>;

def : Pat<(int_x86_xop_vpcomleud VR128:$src1, VR128:$src2),
          (VPCOMUDri VR128:$src1, VR128:$src2, (i8 1))>;
def : Pat<(int_x86_xop_vpcomleud VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMUDmi VR128:$src1, addr:$src2, (i8 1))>;

def : Pat<(int_x86_xop_vpcomleub VR128:$src1, VR128:$src2),
          (VPCOMUBri VR128:$src1, VR128:$src2, (i8 1))>;
def : Pat<(int_x86_xop_vpcomleub VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMUBmi VR128:$src1, addr:$src2, (i8 1))>;

def : Pat<(int_x86_xop_vpcomleq VR128:$src1, VR128:$src2),
          (VPCOMQri VR128:$src1, VR128:$src2, (i8 1))>;
def : Pat<(int_x86_xop_vpcomleq VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMQmi VR128:$src1, addr:$src2, (i8 1))>;

def : Pat<(int_x86_xop_vpcomled VR128:$src1, VR128:$src2),
          (VPCOMDri VR128:$src1, VR128:$src2, (i8 1))>;
def : Pat<(int_x86_xop_vpcomled VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMDmi VR128:$src1, addr:$src2, (i8 1))>;

def : Pat<(int_x86_xop_vpcomleb VR128:$src1, VR128:$src2),
          (VPCOMBri VR128:$src1, VR128:$src2, (i8 1))>;
def : Pat<(int_x86_xop_vpcomleb VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMBmi VR128:$src1, addr:$src2, (i8 1))>;

// VPCOM LT
def : Pat<(int_x86_xop_vpcomltw VR128:$src1, VR128:$src2),
          (VPCOMWri VR128:$src1, VR128:$src2, (i8 0))>;
def : Pat<(int_x86_xop_vpcomltw VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMWmi VR128:$src1, addr:$src2, (i8 0))>;

def : Pat<(int_x86_xop_vpcomltuw VR128:$src1, VR128:$src2),
          (VPCOMUWri VR128:$src1, VR128:$src2, (i8 0))>;
def : Pat<(int_x86_xop_vpcomltuw VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMUWmi VR128:$src1, addr:$src2, (i8 0))>;

def : Pat<(int_x86_xop_vpcomltuq VR128:$src1, VR128:$src2),
          (VPCOMUQri VR128:$src1, VR128:$src2, (i8 0))>;
def : Pat<(int_x86_xop_vpcomltuq VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMUQmi VR128:$src1, addr:$src2, (i8 0))>;

def : Pat<(int_x86_xop_vpcomltud VR128:$src1, VR128:$src2),
          (VPCOMUDri VR128:$src1, VR128:$src2, (i8 0))>;
def : Pat<(int_x86_xop_vpcomltud VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMUDmi VR128:$src1, addr:$src2, (i8 0))>;

def : Pat<(int_x86_xop_vpcomltub VR128:$src1, VR128:$src2),
          (VPCOMUBri VR128:$src1, VR128:$src2, (i8 0))>;
def : Pat<(int_x86_xop_vpcomltub VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMUBmi VR128:$src1, addr:$src2, (i8 0))>;

def : Pat<(int_x86_xop_vpcomltq VR128:$src1, VR128:$src2),
          (VPCOMQri VR128:$src1, VR128:$src2, (i8 0))>;
def : Pat<(int_x86_xop_vpcomltq VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMQmi VR128:$src1, addr:$src2, (i8 0))>;

def : Pat<(int_x86_xop_vpcomltd VR128:$src1, VR128:$src2),
          (VPCOMDri VR128:$src1, VR128:$src2, (i8 0))>;
def : Pat<(int_x86_xop_vpcomltd VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMDmi VR128:$src1, addr:$src2, (i8 0))>;

def : Pat<(int_x86_xop_vpcomltb VR128:$src1, VR128:$src2),
          (VPCOMBri VR128:$src1, VR128:$src2, (i8 0))>;
def : Pat<(int_x86_xop_vpcomltb VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMBmi VR128:$src1, addr:$src2, (i8 0))>;

// VPCOM NE
def : Pat<(int_x86_xop_vpcomnew VR128:$src1, VR128:$src2),
          (VPCOMWri VR128:$src1, VR128:$src2, (i8 5))>;
def : Pat<(int_x86_xop_vpcomnew VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMWmi VR128:$src1, addr:$src2, (i8 5))>;

def : Pat<(int_x86_xop_vpcomneuw VR128:$src1, VR128:$src2),
          (VPCOMUWri VR128:$src1, VR128:$src2, (i8 5))>;
def : Pat<(int_x86_xop_vpcomneuw VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMUWmi VR128:$src1, addr:$src2, (i8 5))>;

def : Pat<(int_x86_xop_vpcomneuq VR128:$src1, VR128:$src2),
          (VPCOMUQri VR128:$src1, VR128:$src2, (i8 5))>;
def : Pat<(int_x86_xop_vpcomneuq VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMUQmi VR128:$src1, addr:$src2, (i8 5))>;

def : Pat<(int_x86_xop_vpcomneud VR128:$src1, VR128:$src2),
          (VPCOMUDri VR128:$src1, VR128:$src2, (i8 5))>;
def : Pat<(int_x86_xop_vpcomneud VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMUDmi VR128:$src1, addr:$src2, (i8 5))>;

def : Pat<(int_x86_xop_vpcomneub VR128:$src1, VR128:$src2),
          (VPCOMUBri VR128:$src1, VR128:$src2, (i8 5))>;
def : Pat<(int_x86_xop_vpcomneub VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMUBmi VR128:$src1, addr:$src2, (i8 5))>;

def : Pat<(int_x86_xop_vpcomneq VR128:$src1, VR128:$src2),
          (VPCOMQri VR128:$src1, VR128:$src2, (i8 5))>;
def : Pat<(int_x86_xop_vpcomneq VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMQmi VR128:$src1, addr:$src2, (i8 5))>;

def : Pat<(int_x86_xop_vpcomned VR128:$src1, VR128:$src2),
          (VPCOMDri VR128:$src1, VR128:$src2, (i8 5))>;
def : Pat<(int_x86_xop_vpcomned VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMDmi VR128:$src1, addr:$src2, (i8 5))>;

def : Pat<(int_x86_xop_vpcomneb VR128:$src1, VR128:$src2),
          (VPCOMBri VR128:$src1, VR128:$src2, (i8 5))>;
def : Pat<(int_x86_xop_vpcomneb VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMBmi VR128:$src1, addr:$src2, (i8 5))>;

// VPCOM TRUE
def : Pat<(int_x86_xop_vpcomtruew VR128:$src1, VR128:$src2),
          (VPCOMWri VR128:$src1, VR128:$src2, (i8 6))>;
def : Pat<(int_x86_xop_vpcomtruew VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMWmi VR128:$src1, addr:$src2, (i8 6))>;

def : Pat<(int_x86_xop_vpcomtrueuw VR128:$src1, VR128:$src2),
          (VPCOMUWri VR128:$src1, VR128:$src2, (i8 6))>;
def : Pat<(int_x86_xop_vpcomtrueuw VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMUWmi VR128:$src1, addr:$src2, (i8 6))>;

def : Pat<(int_x86_xop_vpcomtrueuq VR128:$src1, VR128:$src2),
          (VPCOMUQri VR128:$src1, VR128:$src2, (i8 6))>;
def : Pat<(int_x86_xop_vpcomtrueuq VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMUQmi VR128:$src1, addr:$src2, (i8 6))>;

def : Pat<(int_x86_xop_vpcomtrueud VR128:$src1, VR128:$src2),
          (VPCOMUDri VR128:$src1, VR128:$src2, (i8 6))>;
def : Pat<(int_x86_xop_vpcomtrueud VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMUDmi VR128:$src1, addr:$src2, (i8 6))>;

def : Pat<(int_x86_xop_vpcomtrueub VR128:$src1, VR128:$src2),
          (VPCOMUBri VR128:$src1, VR128:$src2, (i8 6))>;
def : Pat<(int_x86_xop_vpcomtrueub VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMUBmi VR128:$src1, addr:$src2, (i8 6))>;

def : Pat<(int_x86_xop_vpcomtrueq VR128:$src1, VR128:$src2),
          (VPCOMQri VR128:$src1, VR128:$src2, (i8 6))>;
def : Pat<(int_x86_xop_vpcomtrueq VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMQmi VR128:$src1, addr:$src2, (i8 6))>;

def : Pat<(int_x86_xop_vpcomtrued VR128:$src1, VR128:$src2),
          (VPCOMDri VR128:$src1, VR128:$src2, (i8 6))>;
def : Pat<(int_x86_xop_vpcomtrued VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMDmi VR128:$src1, addr:$src2, (i8 6))>;

def : Pat<(int_x86_xop_vpcomtrueb VR128:$src1, VR128:$src2),
          (VPCOMBri VR128:$src1, VR128:$src2, (i8 6))>;
def : Pat<(int_x86_xop_vpcomtrueb VR128:$src1,
          (bitconvert (memopv2i64 addr:$src2))),
          (VPCOMBmi VR128:$src1, addr:$src2, (i8 6))>;

// VPPERM
def : Pat<(int_x86_xop_vpperm VR128:$src1, VR128:$src2, VR128:$src3),
          (VPPERMrr VR128:$src1, VR128:$src2, VR128:$src3)>;
def : Pat<(int_x86_xop_vpperm VR128:$src1, VR128:$src2,
                                  (bitconvert (memopv2i64 addr:$src3))),
          (VPPERMrm VR128:$src1, VR128:$src2, addr:$src3)>;
def : Pat<(int_x86_xop_vpperm VR128:$src1, (bitconvert (memopv2i64 addr:$src2)),
                                  VR128:$src3),
          (VPPERMmr VR128:$src1, addr:$src2, VR128:$src3)>;

// VPCMOV
def : Pat<(int_x86_xop_vpcmov VR128:$src1, VR128:$src2, VR128:$src3),
          (VPCMOVrr VR128:$src1, VR128:$src2, VR128:$src3)>;
def : Pat<(int_x86_xop_vpcmov VR128:$src1, VR128:$src2,
                                  (bitconvert (memopv2i64 addr:$src3))),
          (VPCMOVrm VR128:$src1, VR128:$src2, addr:$src3)>;
def : Pat<(int_x86_xop_vpcmov VR128:$src1, (bitconvert (memopv2i64 addr:$src2)),
                                  VR128:$src3),
          (VPCMOVmr VR128:$src1, addr:$src2, VR128:$src3)>;
def : Pat<(int_x86_xop_vpcmov_256 VR256:$src1, VR256:$src2, VR256:$src3),
          (VPCMOVrrY VR256:$src1, VR256:$src2, VR256:$src3)>;
def : Pat<(int_x86_xop_vpcmov_256 VR256:$src1, VR256:$src2,
                                  (bitconvert (memopv4i64 addr:$src3))),
          (VPCMOVrmY VR256:$src1, VR256:$src2, addr:$src3)>;
def : Pat<(int_x86_xop_vpcmov_256 VR256:$src1,
                                  (bitconvert (memopv4i64 addr:$src2)),
                                  VR256:$src3),
          (VPCMOVmrY VR256:$src1, addr:$src2, VR256:$src3)>;

// VPCMOV di
def : Pat<(int_x86_xop_vpcmov_v2di VR128:$src1, VR128:$src2, VR128:$src3),
          (VPCMOVrr VR128:$src1, VR128:$src2, VR128:$src3)>;
def : Pat<(int_x86_xop_vpcmov_v2di VR128:$src1, VR128:$src2,
                                  (bitconvert (memopv2i64 addr:$src3))),
          (VPCMOVrm VR128:$src1, VR128:$src2, addr:$src3)>;
def : Pat<(int_x86_xop_vpcmov_v2di VR128:$src1,
                                   (bitconvert (memopv2i64 addr:$src2)),
                                   VR128:$src3),
          (VPCMOVmr VR128:$src1, addr:$src2, VR128:$src3)>;
def : Pat<(int_x86_xop_vpcmov_v4di_256 VR256:$src1, VR256:$src2, VR256:$src3),
          (VPCMOVrrY VR256:$src1, VR256:$src2, VR256:$src3)>;
def : Pat<(int_x86_xop_vpcmov_v4di_256 VR256:$src1, VR256:$src2,
                                  (bitconvert (memopv2i64 addr:$src3))),
          (VPCMOVrmY VR256:$src1, VR256:$src2, addr:$src3)>;
def : Pat<(int_x86_xop_vpcmov_v4di_256 VR256:$src1,
                                      (bitconvert (memopv2i64 addr:$src2)),
                                      VR256:$src3),
          (VPCMOVmrY VR256:$src1, addr:$src2, VR256:$src3)>;

// VPCMOV si
def : Pat<(int_x86_xop_vpcmov_v4si VR128:$src1, VR128:$src2, VR128:$src3),
          (VPCMOVrr VR128:$src1, VR128:$src2, VR128:$src3)>;
def : Pat<(int_x86_xop_vpcmov_v4si VR128:$src1, VR128:$src2,
                                  (bitconvert (memopv2i64 addr:$src3))),
          (VPCMOVrm VR128:$src1, VR128:$src2, addr:$src3)>;
def : Pat<(int_x86_xop_vpcmov_v4si VR128:$src1,
                                   (bitconvert (memopv2i64 addr:$src2)),
                                   VR128:$src3),
          (VPCMOVmr VR128:$src1, addr:$src2, VR128:$src3)>;
def : Pat<(int_x86_xop_vpcmov_v8si_256 VR256:$src1, VR256:$src2, VR256:$src3),
          (VPCMOVrrY VR256:$src1, VR256:$src2, VR256:$src3)>;
def : Pat<(int_x86_xop_vpcmov_v8si_256 VR256:$src1, VR256:$src2,
                                  (bitconvert (memopv2i64 addr:$src3))),
          (VPCMOVrmY VR256:$src1, VR256:$src2, addr:$src3)>;
def : Pat<(int_x86_xop_vpcmov_v8si_256 VR256:$src1,
                                      (bitconvert (memopv2i64 addr:$src2)),
                                      VR256:$src3),
          (VPCMOVmrY VR256:$src1, addr:$src2, VR256:$src3)>;


// VPCMOV hi
def : Pat<(int_x86_xop_vpcmov_v8hi VR128:$src1, VR128:$src2, VR128:$src3),
          (VPCMOVrr VR128:$src1, VR128:$src2, VR128:$src3)>;
def : Pat<(int_x86_xop_vpcmov_v8hi VR128:$src1, VR128:$src2,
                                  (bitconvert (memopv2i64 addr:$src3))),
          (VPCMOVrm VR128:$src1, VR128:$src2, addr:$src3)>;
def : Pat<(int_x86_xop_vpcmov_v8hi VR128:$src1,
                                   (bitconvert (memopv2i64 addr:$src2)),
                                   VR128:$src3),
          (VPCMOVmr VR128:$src1, addr:$src2, VR128:$src3)>;
def : Pat<(int_x86_xop_vpcmov_v16hi_256 VR256:$src1, VR256:$src2, VR256:$src3),
          (VPCMOVrrY VR256:$src1, VR256:$src2, VR256:$src3)>;
def : Pat<(int_x86_xop_vpcmov_v16hi_256 VR256:$src1, VR256:$src2,
                                  (bitconvert (memopv2i64 addr:$src3))),
          (VPCMOVrmY VR256:$src1, VR256:$src2, addr:$src3)>;
def : Pat<(int_x86_xop_vpcmov_v16hi_256 VR256:$src1,
                                      (bitconvert (memopv2i64 addr:$src2)),
                                      VR256:$src3),
          (VPCMOVmrY VR256:$src1, addr:$src2, VR256:$src3)>;

// VPCMOV qi
def : Pat<(int_x86_xop_vpcmov_v16qi VR128:$src1, VR128:$src2, VR128:$src3),
          (VPCMOVrr VR128:$src1, VR128:$src2, VR128:$src3)>;
def : Pat<(int_x86_xop_vpcmov_v16qi VR128:$src1, VR128:$src2,
                                  (bitconvert (memopv2i64 addr:$src3))),
          (VPCMOVrm VR128:$src1, VR128:$src2, addr:$src3)>;
def : Pat<(int_x86_xop_vpcmov_v16qi VR128:$src1,
                                    (bitconvert (memopv2i64 addr:$src2)),
                                    VR128:$src3),
          (VPCMOVmr VR128:$src1, addr:$src2, VR128:$src3)>;
def : Pat<(int_x86_xop_vpcmov_v32qi_256 VR256:$src1, VR256:$src2, VR256:$src3),
          (VPCMOVrrY VR256:$src1, VR256:$src2, VR256:$src3)>;
def : Pat<(int_x86_xop_vpcmov_v32qi_256 VR256:$src1, VR256:$src2,
                                  (bitconvert (memopv2i64 addr:$src3))),
          (VPCMOVrmY VR256:$src1, VR256:$src2, addr:$src3)>;
def : Pat<(int_x86_xop_vpcmov_v32qi_256 VR256:$src1,
                                      (bitconvert (memopv2i64 addr:$src2)),
                                      VR256:$src3),
          (VPCMOVmrY VR256:$src1, addr:$src2, VR256:$src3)>;

// VPCMOV df
def : Pat<(int_x86_xop_vpcmov_v2df VR128:$src1, VR128:$src2, VR128:$src3),
          (VPCMOVrr VR128:$src1, VR128:$src2, VR128:$src3)>;
def : Pat<(int_x86_xop_vpcmov_v2df VR128:$src1, VR128:$src2,
                                  (bitconvert (memopv2i64 addr:$src3))),
          (VPCMOVrm VR128:$src1, VR128:$src2, addr:$src3)>;
def : Pat<(int_x86_xop_vpcmov_v2df VR128:$src1,
                                   (bitconvert (memopv2i64 addr:$src2)),
                                   VR128:$src3),
          (VPCMOVmr VR128:$src1, addr:$src2, VR128:$src3)>;
def : Pat<(int_x86_xop_vpcmov_v4df_256 VR256:$src1, VR256:$src2, VR256:$src3),
          (VPCMOVrrY VR256:$src1, VR256:$src2, VR256:$src3)>;
def : Pat<(int_x86_xop_vpcmov_v4df_256 VR256:$src1, VR256:$src2,
                                  (bitconvert (memopv2i64 addr:$src3))),
          (VPCMOVrmY VR256:$src1, VR256:$src2, addr:$src3)>;
def : Pat<(int_x86_xop_vpcmov_v4df_256 VR256:$src1,
                                      (bitconvert (memopv2i64 addr:$src2)),
                                      VR256:$src3),
          (VPCMOVmrY VR256:$src1, addr:$src2, VR256:$src3)>;

// VPCMOV sf
def : Pat<(int_x86_xop_vpcmov_v4sf VR128:$src1, VR128:$src2, VR128:$src3),
          (VPCMOVrr VR128:$src1, VR128:$src2, VR128:$src3)>;
def : Pat<(int_x86_xop_vpcmov_v4sf VR128:$src1, VR128:$src2,
                                  (bitconvert (memopv2i64 addr:$src3))),
          (VPCMOVrm VR128:$src1, VR128:$src2, addr:$src3)>;
def : Pat<(int_x86_xop_vpcmov_v4sf VR128:$src1,
                                   (bitconvert (memopv2i64 addr:$src2)),
                                   VR128:$src3),
          (VPCMOVmr VR128:$src1, addr:$src2, VR128:$src3)>;
def : Pat<(int_x86_xop_vpcmov_v8sf_256 VR256:$src1, VR256:$src2, VR256:$src3),
          (VPCMOVrrY VR256:$src1, VR256:$src2, VR256:$src3)>;
def : Pat<(int_x86_xop_vpcmov_v8sf_256 VR256:$src1, VR256:$src2,
                                  (bitconvert (memopv2i64 addr:$src3))),
          (VPCMOVrmY VR256:$src1, VR256:$src2, addr:$src3)>;
def : Pat<(int_x86_xop_vpcmov_v8sf_256 VR256:$src1,
                                      (bitconvert (memopv2i64 addr:$src2)),
                                      VR256:$src3),
          (VPCMOVmrY VR256:$src1, addr:$src2, VR256:$src3)>;