llvm.org GIT mirror llvm / a798097
[AVX512] Disable AVX2 VPERMD, VPERMQ, VPERMPS, and VPERMPD patterns when AVX512VL is enabled. Also add shuffle comment printing for AVX512VL VPERMPD/VPERMQ to keep some tests that now use these instructions instead of the AVX2 ones. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270317 91177308-0d34-0410-b5e6-96231b3b80d8 Craig Topper 4 years ago
3 changed file(s) with 42 addition(s) and 34 deletion(s). Raw diff Collapse all Expand all
624624 break;
625625
626626 case X86::VPERMQYri:
627 case X86::VPERMQZ256ri:
627628 case X86::VPERMPDYri:
629 case X86::VPERMPDZ256ri:
628630 Src1Name = getRegName(MI->getOperand(1).getReg());
629631 // FALL THROUGH.
630632 case X86::VPERMQYmi:
633 case X86::VPERMQZ256mi:
631634 case X86::VPERMPDYmi:
635 case X86::VPERMPDZ256mi:
632636 if (MI->getOperand(NumOperands - 1).isImm())
633637 DecodeVPERMMask(MI->getOperand(NumOperands - 1).getImm(),
634638 ShuffleMask);
84628462
84638463 multiclass avx2_perm opc, string OpcodeStr, PatFrag mem_frag,
84648464 ValueType OpVT, X86FoldableSchedWrite Sched> {
8465 def Yrr : AVX28I
8466 (ins VR256:$src1, VR256:$src2),
8467 !strconcat(OpcodeStr,
8468 "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
8469 [(set VR256:$dst,
8470 (OpVT (X86VPermv VR256:$src1, VR256:$src2)))]>,
8471 Sched<[Sched]>, VEX_4V, VEX_L;
8472 def Yrm : AVX28I
8473 (ins VR256:$src1, i256mem:$src2),
8474 !strconcat(OpcodeStr,
8475 "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
8476 [(set VR256:$dst,
8477 (OpVT (X86VPermv VR256:$src1,
8478 (bitconvert (mem_frag addr:$src2)))))]>,
8479 Sched<[Sched.Folded, ReadAfterLd]>, VEX_4V, VEX_L;
8465 let Predicates = [HasAVX2, NoVLX] in {
8466 def Yrr : AVX28I
8467 (ins VR256:$src1, VR256:$src2),
8468 !strconcat(OpcodeStr,
8469 "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
8470 [(set VR256:$dst,
8471 (OpVT (X86VPermv VR256:$src1, VR256:$src2)))]>,
8472 Sched<[Sched]>, VEX_4V, VEX_L;
8473 def Yrm : AVX28I
8474 (ins VR256:$src1, i256mem:$src2),
8475 !strconcat(OpcodeStr,
8476 "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
8477 [(set VR256:$dst,
8478 (OpVT (X86VPermv VR256:$src1,
8479 (bitconvert (mem_frag addr:$src2)))))]>,
8480 Sched<[Sched.Folded, ReadAfterLd]>, VEX_4V, VEX_L;
8481 }
84808482 }
84818483
84828484 defm VPERMD : avx2_perm<0x36, "vpermd", loadv4i64, v8i32, WriteShuffle256>;
84858487
84868488 multiclass avx2_perm_imm opc, string OpcodeStr, PatFrag mem_frag,
84878489 ValueType OpVT, X86FoldableSchedWrite Sched> {
8488 def Yri : AVX2AIi8
8489 (ins VR256:$src1, u8imm:$src2),
8490 !strconcat(OpcodeStr,
8491 "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
8492 [(set VR256:$dst,
8493 (OpVT (X86VPermi VR256:$src1, (i8 imm:$src2))))]>,
8494 Sched<[Sched]>, VEX, VEX_L;
8495 def Ymi : AVX2AIi8
8496 (ins i256mem:$src1, u8imm:$src2),
8497 !strconcat(OpcodeStr,
8498 "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
8499 [(set VR256:$dst,
8500 (OpVT (X86VPermi (mem_frag addr:$src1),
8501 (i8 imm:$src2))))]>,
8502 Sched<[Sched.Folded, ReadAfterLd]>, VEX, VEX_L;
8490 let Predicates = [HasAVX2, NoVLX] in {
8491 def Yri : AVX2AIi8
8492 (ins VR256:$src1, u8imm:$src2),
8493 !strconcat(OpcodeStr,
8494 "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
8495 [(set VR256:$dst,
8496 (OpVT (X86VPermi VR256:$src1, (i8 imm:$src2))))]>,
8497 Sched<[Sched]>, VEX, VEX_L;
8498 def Ymi : AVX2AIi8
8499 (ins i256mem:$src1, u8imm:$src2),
8500 !strconcat(OpcodeStr,
8501 "\t{$src2, $src1, $dst|$dst, $src1, $src2}"),
8502 [(set VR256:$dst,
8503 (OpVT (X86VPermi (mem_frag addr:$src1),
8504 (i8 imm:$src2))))]>,
8505 Sched<[Sched.Folded, ReadAfterLd]>, VEX, VEX_L;
8506 }
85038507 }
85048508
85058509 defm VPERMQ : avx2_perm_imm<0x00, "vpermq", loadv4i64, v4i64,
91699169 ; CHECK-NEXT: kmovw %esi, %k1 ## encoding: [0xc5,0xf8,0x92,0xce]
91709170 ; CHECK-NEXT: vpermpd $3, %ymm0, %ymm1 {%k1} ## encoding: [0x62,0xf3,0xfd,0x29,0x01,0xc8,0x03]
91719171 ; CHECK-NEXT: vpermpd $3, %ymm0, %ymm2 {%k1} {z} ## encoding: [0x62,0xf3,0xfd,0xa9,0x01,0xd0,0x03]
9172 ; CHECK-NEXT: vpermpd $3, %ymm0, %ymm0 ## encoding: [0xc4,0xe3,0xfd,0x01,0xc0,0x03]
9172 ; CHECK-NEXT: vpermpd $3, %ymm0, %ymm0 ## encoding: [0x62,0xf3,0xfd,0x28,0x01,0xc0,0x03]
91739173 ; CHECK-NEXT: ## ymm0 = ymm0[3,0,0,0]
91749174 ; CHECK-NEXT: vaddpd %ymm2, %ymm1, %ymm1 ## encoding: [0x62,0xf1,0xf5,0x28,0x58,0xca]
91759175 ; CHECK-NEXT: vaddpd %ymm0, %ymm1, %ymm0 ## encoding: [0x62,0xf1,0xf5,0x28,0x58,0xc0]
91909190 ; CHECK-NEXT: kmovw %esi, %k1 ## encoding: [0xc5,0xf8,0x92,0xce]
91919191 ; CHECK-NEXT: vpermq $3, %ymm0, %ymm1 {%k1} ## encoding: [0x62,0xf3,0xfd,0x29,0x00,0xc8,0x03]
91929192 ; CHECK-NEXT: vpermq $3, %ymm0, %ymm2 {%k1} {z} ## encoding: [0x62,0xf3,0xfd,0xa9,0x00,0xd0,0x03]
9193 ; CHECK-NEXT: vpermq $3, %ymm0, %ymm0 ## encoding: [0xc4,0xe3,0xfd,0x00,0xc0,0x03]
9193 ; CHECK-NEXT: vpermq $3, %ymm0, %ymm0 ## encoding: [0x62,0xf3,0xfd,0x28,0x00,0xc0,0x03]
91949194 ; CHECK-NEXT: ## ymm0 = ymm0[3,0,0,0]
91959195 ; CHECK-NEXT: vpaddq %ymm2, %ymm1, %ymm1 ## encoding: [0x62,0xf1,0xf5,0x28,0xd4,0xca]
91969196 ; CHECK-NEXT: vpaddq %ymm0, %ymm1, %ymm0 ## encoding: [0x62,0xf1,0xf5,0x28,0xd4,0xc0]
92509250 ; CHECK-NEXT: kmovw %edi, %k1 ## encoding: [0xc5,0xf8,0x92,0xcf]
92519251 ; CHECK-NEXT: vpermps %ymm1, %ymm0, %ymm2 {%k1} ## encoding: [0x62,0xf2,0x7d,0x29,0x16,0xd1]
92529252 ; CHECK-NEXT: vpermps %ymm1, %ymm0, %ymm3 {%k1} {z} ## encoding: [0x62,0xf2,0x7d,0xa9,0x16,0xd9]
9253 ; CHECK-NEXT: vpermps %ymm1, %ymm0, %ymm0 ## encoding: [0xc4,0xe2,0x7d,0x16,0xc1]
9253 ; CHECK-NEXT: vpermps %ymm1, %ymm0, %ymm0 ## encoding: [0x62,0xf2,0x7d,0x28,0x16,0xc1]
92549254 ; CHECK-NEXT: vaddps %ymm3, %ymm2, %ymm1 ## encoding: [0x62,0xf1,0x6c,0x28,0x58,0xcb]
92559255 ; CHECK-NEXT: vaddps %ymm0, %ymm1, %ymm0 ## encoding: [0x62,0xf1,0x74,0x28,0x58,0xc0]
92569256 ; CHECK-NEXT: retq ## encoding: [0xc3]
92709270 ; CHECK-NEXT: kmovw %edi, %k1 ## encoding: [0xc5,0xf8,0x92,0xcf]
92719271 ; CHECK-NEXT: vpermd %ymm1, %ymm0, %ymm2 {%k1} ## encoding: [0x62,0xf2,0x7d,0x29,0x36,0xd1]
92729272 ; CHECK-NEXT: vpermd %ymm1, %ymm0, %ymm3 {%k1} {z} ## encoding: [0x62,0xf2,0x7d,0xa9,0x36,0xd9]
9273 ; CHECK-NEXT: vpermd %ymm1, %ymm0, %ymm0 ## encoding: [0xc4,0xe2,0x7d,0x36,0xc1]
9273 ; CHECK-NEXT: vpermd %ymm1, %ymm0, %ymm0 ## encoding: [0x62,0xf2,0x7d,0x28,0x36,0xc1]
92749274 ; CHECK-NEXT: vpaddd %ymm3, %ymm2, %ymm1 ## encoding: [0x62,0xf1,0x6d,0x28,0xfe,0xcb]
92759275 ; CHECK-NEXT: vpaddd %ymm0, %ymm1, %ymm0 ## encoding: [0x62,0xf1,0x75,0x28,0xfe,0xc0]
92769276 ; CHECK-NEXT: retq ## encoding: [0xc3]