mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-03-07 03:47:20 +00:00
Simplify math a little bit.
llvm-svn: 187781
This commit is contained in:
parent
0eb9242c56
commit
70290dd386
@ -17792,23 +17792,24 @@ static bool isHorizontalBinOp(SDValue &LHS, SDValue &RHS, bool IsCommutative) {
|
|||||||
// LHS = VECTOR_SHUFFLE A, B, LMask
|
// LHS = VECTOR_SHUFFLE A, B, LMask
|
||||||
// RHS = VECTOR_SHUFFLE A, B, RMask
|
// RHS = VECTOR_SHUFFLE A, B, RMask
|
||||||
// Check that the masks correspond to performing a horizontal operation.
|
// Check that the masks correspond to performing a horizontal operation.
|
||||||
for (unsigned i = 0; i != NumElts; ++i) {
|
for (unsigned l = 0; l != NumElts; l += NumLaneElts) {
|
||||||
int LIdx = LMask[i], RIdx = RMask[i];
|
for (unsigned i = 0; i != NumLaneElts; ++i) {
|
||||||
|
int LIdx = LMask[i+l], RIdx = RMask[i+l];
|
||||||
|
|
||||||
// Ignore any UNDEF components.
|
// Ignore any UNDEF components.
|
||||||
if (LIdx < 0 || RIdx < 0 ||
|
if (LIdx < 0 || RIdx < 0 ||
|
||||||
(!A.getNode() && (LIdx < (int)NumElts || RIdx < (int)NumElts)) ||
|
(!A.getNode() && (LIdx < (int)NumElts || RIdx < (int)NumElts)) ||
|
||||||
(!B.getNode() && (LIdx >= (int)NumElts || RIdx >= (int)NumElts)))
|
(!B.getNode() && (LIdx >= (int)NumElts || RIdx >= (int)NumElts)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Check that successive elements are being operated on. If not, this is
|
// Check that successive elements are being operated on. If not, this is
|
||||||
// not a horizontal operation.
|
// not a horizontal operation.
|
||||||
unsigned Src = (i/HalfLaneElts) % 2; // each lane is split between srcs
|
unsigned Src = (i/HalfLaneElts); // each lane is split between srcs
|
||||||
unsigned LaneStart = (i/NumLaneElts) * NumLaneElts;
|
int Index = 2*(i%HalfLaneElts) + NumElts*Src + l;
|
||||||
int Index = 2*(i%HalfLaneElts) + NumElts*Src + LaneStart;
|
if (!(LIdx == Index && RIdx == Index + 1) &&
|
||||||
if (!(LIdx == Index && RIdx == Index + 1) &&
|
!(IsCommutative && LIdx == Index + 1 && RIdx == Index))
|
||||||
!(IsCommutative && LIdx == Index + 1 && RIdx == Index))
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LHS = A.getNode() ? A : B; // If A is 'UNDEF', use B for it.
|
LHS = A.getNode() ? A : B; // If A is 'UNDEF', use B for it.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user