Fix a bug while generating target specific VPERMIL masks: skip

undef mask elements. This fixes PR10529.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136450 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bruno Cardoso Lopes 2011-07-29 01:31:04 +00:00
parent 0b0a09f4bf
commit 377baa5bc9

View File

@ -3488,8 +3488,12 @@ static unsigned getShuffleVPERMILPSImmediate(SDNode *N) {
int NumLanes = VT.getSizeInBits()/128;
unsigned Mask = 0;
for (int i = 0; i < NumElts/NumLanes /* lane size */; ++i)
Mask |= SVOp->getMaskElt(i) << (i*2);
for (int i = 0; i < NumElts/NumLanes /* lane size */; ++i) {
int MaskElt = SVOp->getMaskElt(i);
if (MaskElt < 0)
continue;
Mask |= MaskElt << (i*2);
}
return Mask;
}
@ -3506,8 +3510,12 @@ static unsigned getShuffleVPERMILPDImmediate(SDNode *N) {
unsigned Mask = 0;
int LaneSize = NumElts/NumLanes;
for (int l = 0; l < NumLanes; ++l)
for (int i = l*LaneSize; i < LaneSize*(l+1); ++i)
Mask |= (SVOp->getMaskElt(i)-l*LaneSize) << i;
for (int i = l*LaneSize; i < LaneSize*(l+1); ++i) {
int MaskElt = SVOp->getMaskElt(i);
if (MaskElt < 0)
continue;
Mask |= (MaskElt-l*LaneSize) << i;
}
return Mask;
}