mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[TargetLowering] SimplifyDemandedBits - add EXTRACT_SUBVECTOR support.
Call SimplifyDemandedBits on the source vector. llvm-svn: 371923
This commit is contained in:
parent
e8dd40fec6
commit
a24663ee88
@ -907,6 +907,21 @@ bool TargetLowering::SimplifyDemandedBits(
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ISD::EXTRACT_SUBVECTOR: {
|
||||
// If index isn't constant, assume we need all the source vector elements.
|
||||
SDValue Src = Op.getOperand(0);
|
||||
ConstantSDNode *SubIdx = dyn_cast<ConstantSDNode>(Op.getOperand(1));
|
||||
unsigned NumSrcElts = Src.getValueType().getVectorNumElements();
|
||||
APInt SrcElts = APInt::getAllOnesValue(NumSrcElts);
|
||||
if (SubIdx && SubIdx->getAPIntValue().ule(NumSrcElts - NumElts)) {
|
||||
// Offset the demanded elts by the subvector index.
|
||||
uint64_t Idx = SubIdx->getZExtValue();
|
||||
SrcElts = DemandedElts.zextOrSelf(NumSrcElts).shl(Idx);
|
||||
}
|
||||
if (SimplifyDemandedBits(Src, DemandedBits, SrcElts, Known, TLO, Depth + 1))
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
case ISD::CONCAT_VECTORS: {
|
||||
Known.Zero.setAllBits();
|
||||
Known.One.setAllBits();
|
||||
|
@ -1800,17 +1800,13 @@ define i8 @test_v16i8(<16 x i8> %a0) {
|
||||
; AVX2-NEXT: vpunpckhbw {{.*#+}} xmm1 = xmm0[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15]
|
||||
; AVX2-NEXT: vpmovzxbw {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero
|
||||
; AVX2-NEXT: vpmullw %xmm1, %xmm0, %xmm0
|
||||
; AVX2-NEXT: vmovdqa {{.*#+}} xmm1 = [255,255,255,255,255,255,255,255]
|
||||
; AVX2-NEXT: vpand %xmm1, %xmm0, %xmm0
|
||||
; AVX2-NEXT: vpshufd {{.*#+}} xmm2 = xmm0[2,3,2,3]
|
||||
; AVX2-NEXT: vpmullw %xmm2, %xmm0, %xmm0
|
||||
; AVX2-NEXT: vpand %xmm1, %xmm0, %xmm0
|
||||
; AVX2-NEXT: vpsrlq $32, %xmm0, %xmm2
|
||||
; AVX2-NEXT: vpmullw %xmm2, %xmm0, %xmm0
|
||||
; AVX2-NEXT: vpand %xmm1, %xmm0, %xmm0
|
||||
; AVX2-NEXT: vpsrld $16, %xmm0, %xmm2
|
||||
; AVX2-NEXT: vpmullw %xmm2, %xmm0, %xmm0
|
||||
; AVX2-NEXT: vpand %xmm1, %xmm0, %xmm0
|
||||
; AVX2-NEXT: vpshufb {{.*#+}} xmm1 = xmm0[8],zero,xmm0[10],zero,xmm0[12],zero,xmm0[14],zero,xmm0[8],zero,xmm0[10],zero,xmm0[12],zero,xmm0[14],zero
|
||||
; AVX2-NEXT: vpmullw %xmm1, %xmm0, %xmm0
|
||||
; AVX2-NEXT: vpand {{.*}}(%rip), %xmm0, %xmm0
|
||||
; AVX2-NEXT: vpshufd {{.*#+}} xmm1 = xmm0[1,1,2,3]
|
||||
; AVX2-NEXT: vpmullw %xmm1, %xmm0, %xmm0
|
||||
; AVX2-NEXT: vpshufb {{.*#+}} xmm1 = xmm0[2],zero,xmm0[2],zero,xmm0[4],zero,xmm0[6],zero,xmm0[8],zero,xmm0[10],zero,xmm0[12],zero,xmm0[14],zero
|
||||
; AVX2-NEXT: vpmullw %xmm1, %xmm0, %xmm0
|
||||
; AVX2-NEXT: vpextrb $0, %xmm0, %eax
|
||||
; AVX2-NEXT: # kill: def $al killed $al killed $eax
|
||||
; AVX2-NEXT: retq
|
||||
|
Loading…
x
Reference in New Issue
Block a user