mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 22:24:54 +00:00
[PPC64LE] Fix wrong IR for vec_sld and vec_vsldoi
My original LE implementation of the vsldoi instruction, with its altivec.h interfaces vec_sld and vec_vsldoi, produces incorrect shufflevector operations in the LLVM IR. Correct code is generated because the back end handles the incorrect shufflevector in a consistent manner. This patch and a companion patch for Clang correct this problem by removing the fixup from altivec.h and the corresponding fixup from the PowerPC back end. Several test cases are also modified to reflect the now-correct LLVM IR. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214800 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1009,38 +1009,20 @@ int PPC::isVSLDOIShuffleMask(SDNode *N, bool isUnary, SelectionDAG &DAG) {
|
||||
unsigned ShiftAmt = SVOp->getMaskElt(i);
|
||||
if (ShiftAmt < i) return -1;
|
||||
|
||||
if (DAG.getTarget().getSubtargetImpl()->getDataLayout()->isLittleEndian()) {
|
||||
ShiftAmt -= i;
|
||||
|
||||
ShiftAmt += i;
|
||||
|
||||
if (!isUnary) {
|
||||
// Check the rest of the elements to see if they are consecutive.
|
||||
for (++i; i != 16; ++i)
|
||||
if (!isConstantOrUndef(SVOp->getMaskElt(i), ShiftAmt - i))
|
||||
return -1;
|
||||
} else {
|
||||
// Check the rest of the elements to see if they are consecutive.
|
||||
for (++i; i != 16; ++i)
|
||||
if (!isConstantOrUndef(SVOp->getMaskElt(i), (ShiftAmt - i) & 15))
|
||||
return -1;
|
||||
}
|
||||
|
||||
} else { // Big Endian
|
||||
|
||||
ShiftAmt -= i;
|
||||
|
||||
if (!isUnary) {
|
||||
// Check the rest of the elements to see if they are consecutive.
|
||||
for (++i; i != 16; ++i)
|
||||
if (!isConstantOrUndef(SVOp->getMaskElt(i), ShiftAmt+i))
|
||||
return -1;
|
||||
} else {
|
||||
// Check the rest of the elements to see if they are consecutive.
|
||||
for (++i; i != 16; ++i)
|
||||
if (!isConstantOrUndef(SVOp->getMaskElt(i), (ShiftAmt+i) & 15))
|
||||
return -1;
|
||||
}
|
||||
if (!isUnary) {
|
||||
// Check the rest of the elements to see if they are consecutive.
|
||||
for (++i; i != 16; ++i)
|
||||
if (!isConstantOrUndef(SVOp->getMaskElt(i), ShiftAmt+i))
|
||||
return -1;
|
||||
} else {
|
||||
// Check the rest of the elements to see if they are consecutive.
|
||||
for (++i; i != 16; ++i)
|
||||
if (!isConstantOrUndef(SVOp->getMaskElt(i), (ShiftAmt+i) & 15))
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ShiftAmt;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user