[llvm] r364667 - [X86] CombineShuffleWithExtract - recurse through EXTRACT_SUBVECTOR chain
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 28 10:57:32 PDT 2019
Author: rksimon
Date: Fri Jun 28 10:57:32 2019
New Revision: 364667
URL: http://llvm.org/viewvc/llvm-project?rev=364667&view=rev
Log:
[X86] CombineShuffleWithExtract - recurse through EXTRACT_SUBVECTOR chain
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/test/CodeGen/X86/shuffle-vs-trunc-512-widen.ll
llvm/trunk/test/CodeGen/X86/shuffle-vs-trunc-512.ll
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=364667&r1=364666&r2=364667&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Jun 28 10:57:32 2019
@@ -32047,15 +32047,15 @@ static SDValue combineX86ShuffleChain(Ar
SDValue Src1 = V1, Src2 = V2;
unsigned Offset1 = 0, Offset2 = 0;
- if (V1.getOpcode() == ISD::EXTRACT_SUBVECTOR &&
- isa<ConstantSDNode>(V1.getOperand(1))) {
- Src1 = V1.getOperand(0);
- Offset1 = V1.getConstantOperandVal(1);
+ while (Src1.getOpcode() == ISD::EXTRACT_SUBVECTOR &&
+ isa<ConstantSDNode>(Src1.getOperand(1))) {
+ Offset1 += Src1.getConstantOperandVal(1);
+ Src1 = Src1.getOperand(0);
}
- if (V2.getOpcode() == ISD::EXTRACT_SUBVECTOR &&
- isa<ConstantSDNode>(V2.getOperand(1))) {
- Src2 = V2.getOperand(0);
- Offset2 = V2.getConstantOperandVal(1);
+ while (Src2.getOpcode() == ISD::EXTRACT_SUBVECTOR &&
+ isa<ConstantSDNode>(Src2.getOperand(1))) {
+ Offset2 += Src2.getConstantOperandVal(1);
+ Src2 = Src2.getOperand(0);
}
if (Offset1 == 0 && Offset2 == 0)
return false;
Modified: llvm/trunk/test/CodeGen/X86/shuffle-vs-trunc-512-widen.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/shuffle-vs-trunc-512-widen.ll?rev=364667&r1=364666&r2=364667&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/shuffle-vs-trunc-512-widen.ll (original)
+++ llvm/trunk/test/CodeGen/X86/shuffle-vs-trunc-512-widen.ll Fri Jun 28 10:57:32 2019
@@ -716,11 +716,8 @@ define <16 x i8> @trunc_shuffle_v64i8_01
;
; AVX512VBMI-LABEL: trunc_shuffle_v64i8_01_05_09_13_17_21_25_29_33_37_41_45_49_53_57_61:
; AVX512VBMI: # %bb.0:
-; AVX512VBMI-NEXT: vextracti128 $1, %ymm0, %xmm1
-; AVX512VBMI-NEXT: vmovdqa {{.*#+}} xmm2 = <1,5,9,13,u,u,u,u,u,u,u,u,u,u,u,u>
-; AVX512VBMI-NEXT: vpshufb %xmm2, %xmm1, %xmm1
-; AVX512VBMI-NEXT: vpshufb %xmm2, %xmm0, %xmm2
-; AVX512VBMI-NEXT: vpunpckldq {{.*#+}} xmm1 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
+; AVX512VBMI-NEXT: vpbroadcastq {{.*#+}} zmm1 = [2096730264494998785,2096730264494998785,2096730264494998785,2096730264494998785,2096730264494998785,2096730264494998785,2096730264494998785,2096730264494998785]
+; AVX512VBMI-NEXT: vpermb %zmm0, %zmm1, %zmm1
; AVX512VBMI-NEXT: vpbroadcastq {{.*#+}} zmm2 = [4411615795313452321,4411615795313452321,4411615795313452321,4411615795313452321,4411615795313452321,4411615795313452321,4411615795313452321,4411615795313452321]
; AVX512VBMI-NEXT: vpermb %zmm0, %zmm2, %zmm0
; AVX512VBMI-NEXT: vpblendd {{.*#+}} xmm0 = xmm1[0,1],xmm0[2,3]
@@ -804,11 +801,8 @@ define <16 x i8> @trunc_shuffle_v64i8_01
;
; AVX512VBMI-LABEL: trunc_shuffle_v64i8_01_05_09_13_17_21_25_29_33_37_41_45_49_53_57_62:
; AVX512VBMI: # %bb.0:
-; AVX512VBMI-NEXT: vextracti128 $1, %ymm0, %xmm1
-; AVX512VBMI-NEXT: vmovdqa {{.*#+}} xmm2 = <1,5,9,13,u,u,u,u,u,u,u,u,u,u,u,u>
-; AVX512VBMI-NEXT: vpshufb %xmm2, %xmm1, %xmm1
-; AVX512VBMI-NEXT: vpshufb %xmm2, %xmm0, %xmm2
-; AVX512VBMI-NEXT: vpunpckldq {{.*#+}} xmm1 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
+; AVX512VBMI-NEXT: vpbroadcastq {{.*#+}} zmm1 = [2096730264494998785,2096730264494998785,2096730264494998785,2096730264494998785,2096730264494998785,2096730264494998785,2096730264494998785,2096730264494998785]
+; AVX512VBMI-NEXT: vpermb %zmm0, %zmm1, %zmm1
; AVX512VBMI-NEXT: vpbroadcastq {{.*#+}} zmm2 = [4483673389351380257,4483673389351380257,4483673389351380257,4483673389351380257,4483673389351380257,4483673389351380257,4483673389351380257,4483673389351380257]
; AVX512VBMI-NEXT: vpermb %zmm0, %zmm2, %zmm0
; AVX512VBMI-NEXT: vpblendd {{.*#+}} xmm0 = xmm1[0,1],xmm0[2,3]
Modified: llvm/trunk/test/CodeGen/X86/shuffle-vs-trunc-512.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/shuffle-vs-trunc-512.ll?rev=364667&r1=364666&r2=364667&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/shuffle-vs-trunc-512.ll (original)
+++ llvm/trunk/test/CodeGen/X86/shuffle-vs-trunc-512.ll Fri Jun 28 10:57:32 2019
@@ -707,11 +707,8 @@ define <16 x i8> @trunc_shuffle_v64i8_01
;
; AVX512VBMI-LABEL: trunc_shuffle_v64i8_01_05_09_13_17_21_25_29_33_37_41_45_49_53_57_61:
; AVX512VBMI: # %bb.0:
-; AVX512VBMI-NEXT: vextracti128 $1, %ymm0, %xmm1
-; AVX512VBMI-NEXT: vmovdqa {{.*#+}} xmm2 = <1,5,9,13,u,u,u,u,u,u,u,u,u,u,u,u>
-; AVX512VBMI-NEXT: vpshufb %xmm2, %xmm1, %xmm1
-; AVX512VBMI-NEXT: vpshufb %xmm2, %xmm0, %xmm2
-; AVX512VBMI-NEXT: vpunpckldq {{.*#+}} xmm1 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
+; AVX512VBMI-NEXT: vpbroadcastq {{.*#+}} zmm1 = [2096730264494998785,2096730264494998785,2096730264494998785,2096730264494998785,2096730264494998785,2096730264494998785,2096730264494998785,2096730264494998785]
+; AVX512VBMI-NEXT: vpermb %zmm0, %zmm1, %zmm1
; AVX512VBMI-NEXT: vpbroadcastq {{.*#+}} zmm2 = [4411615795313452321,4411615795313452321,4411615795313452321,4411615795313452321,4411615795313452321,4411615795313452321,4411615795313452321,4411615795313452321]
; AVX512VBMI-NEXT: vpermb %zmm0, %zmm2, %zmm0
; AVX512VBMI-NEXT: vpblendd {{.*#+}} xmm0 = xmm1[0,1],xmm0[2,3]
@@ -795,11 +792,8 @@ define <16 x i8> @trunc_shuffle_v64i8_01
;
; AVX512VBMI-LABEL: trunc_shuffle_v64i8_01_05_09_13_17_21_25_29_33_37_41_45_49_53_57_62:
; AVX512VBMI: # %bb.0:
-; AVX512VBMI-NEXT: vextracti128 $1, %ymm0, %xmm1
-; AVX512VBMI-NEXT: vmovdqa {{.*#+}} xmm2 = <1,5,9,13,u,u,u,u,u,u,u,u,u,u,u,u>
-; AVX512VBMI-NEXT: vpshufb %xmm2, %xmm1, %xmm1
-; AVX512VBMI-NEXT: vpshufb %xmm2, %xmm0, %xmm2
-; AVX512VBMI-NEXT: vpunpckldq {{.*#+}} xmm1 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
+; AVX512VBMI-NEXT: vpbroadcastq {{.*#+}} zmm1 = [2096730264494998785,2096730264494998785,2096730264494998785,2096730264494998785,2096730264494998785,2096730264494998785,2096730264494998785,2096730264494998785]
+; AVX512VBMI-NEXT: vpermb %zmm0, %zmm1, %zmm1
; AVX512VBMI-NEXT: vpbroadcastq {{.*#+}} zmm2 = [4483673389351380257,4483673389351380257,4483673389351380257,4483673389351380257,4483673389351380257,4483673389351380257,4483673389351380257,4483673389351380257]
; AVX512VBMI-NEXT: vpermb %zmm0, %zmm2, %zmm0
; AVX512VBMI-NEXT: vpblendd {{.*#+}} xmm0 = xmm1[0,1],xmm0[2,3]
More information about the llvm-commits
mailing list