mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 04:32:44 +01:00
[X86] More aggressive shuffle mask widening in combineExtractWithShuffle
Use demanded extract index to set most of the shuffle mask to undef, making it easier to widen and peek through. llvm-svn: 351013
This commit is contained in:
parent
fc97f679c1
commit
a89e77f814
@ -33691,6 +33691,15 @@ static SDValue combineExtractWithShuffle(SDNode *N, SelectionDAG &DAG,
|
|||||||
scaleShuffleMask<int>(Scale, Mask, ScaledMask);
|
scaleShuffleMask<int>(Scale, Mask, ScaledMask);
|
||||||
Mask = std::move(ScaledMask);
|
Mask = std::move(ScaledMask);
|
||||||
} else if ((Mask.size() % NumSrcElts) == 0) {
|
} else if ((Mask.size() % NumSrcElts) == 0) {
|
||||||
|
// Simplify Mask based on demanded element.
|
||||||
|
int ExtractIdx = (int)N->getConstantOperandVal(1);
|
||||||
|
int Scale = Mask.size() / NumSrcElts;
|
||||||
|
int Lo = Scale * ExtractIdx;
|
||||||
|
int Hi = Scale * (ExtractIdx + 1);
|
||||||
|
for (int i = 0, e = (int)Mask.size(); i != e; ++i)
|
||||||
|
if (i < Lo || Hi <= i)
|
||||||
|
Mask[i] = SM_SentinelUndef;
|
||||||
|
|
||||||
SmallVector<int, 16> WidenedMask;
|
SmallVector<int, 16> WidenedMask;
|
||||||
while (Mask.size() > NumSrcElts &&
|
while (Mask.size() > NumSrcElts &&
|
||||||
canWidenShuffleElements(Mask, WidenedMask))
|
canWidenShuffleElements(Mask, WidenedMask))
|
||||||
|
@ -7,8 +7,7 @@ define i8 @foo(<4 x i8>* %V) {
|
|||||||
; CHECK-LABEL: foo:
|
; CHECK-LABEL: foo:
|
||||||
; CHECK: # %bb.0:
|
; CHECK: # %bb.0:
|
||||||
; CHECK-NEXT: movd {{.*#+}} xmm0 = mem[0],zero,zero,zero
|
; CHECK-NEXT: movd {{.*#+}} xmm0 = mem[0],zero,zero,zero
|
||||||
; CHECK-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
|
; CHECK-NEXT: pextrw $1, %xmm0, %eax
|
||||||
; CHECK-NEXT: pextrw $2, %xmm0, %eax
|
|
||||||
; CHECK-NEXT: andb $95, %al
|
; CHECK-NEXT: andb $95, %al
|
||||||
; CHECK-NEXT: # kill: def $al killed $al killed $eax
|
; CHECK-NEXT: # kill: def $al killed $al killed $eax
|
||||||
; CHECK-NEXT: retq
|
; CHECK-NEXT: retq
|
||||||
|
Loading…
Reference in New Issue
Block a user