mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-10 02:25:47 +00:00
Adjust offset to compensate for big endian machines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35293 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -2292,7 +2292,6 @@ SDOperand DAGCombiner::ReduceLoadWidth(SDNode *N) {
|
|||||||
N0 = N0.getOperand(0);
|
N0 = N0.getOperand(0);
|
||||||
if (MVT::getSizeInBits(N0.getValueType()) <= EVTBits)
|
if (MVT::getSizeInBits(N0.getValueType()) <= EVTBits)
|
||||||
return SDOperand();
|
return SDOperand();
|
||||||
ShAmt /= 8;
|
|
||||||
CombineSRL = true;
|
CombineSRL = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2308,12 +2307,11 @@ SDOperand DAGCombiner::ReduceLoadWidth(SDNode *N) {
|
|||||||
"Cannot truncate to larger type!");
|
"Cannot truncate to larger type!");
|
||||||
LoadSDNode *LN0 = cast<LoadSDNode>(N0);
|
LoadSDNode *LN0 = cast<LoadSDNode>(N0);
|
||||||
MVT::ValueType PtrType = N0.getOperand(1).getValueType();
|
MVT::ValueType PtrType = N0.getOperand(1).getValueType();
|
||||||
// For big endian targets, we need to add an offset to the pointer to load
|
// For big endian targets, we need to adjust the offset to the pointer to
|
||||||
// the correct bytes. For little endian systems, we merely need to read
|
// load the correct bytes.
|
||||||
// fewer bytes from the same pointer.
|
if (!TLI.isLittleEndian())
|
||||||
uint64_t PtrOff = ShAmt
|
ShAmt = MVT::getSizeInBits(N0.getValueType()) - ShAmt - EVTBits;
|
||||||
? ShAmt : (TLI.isLittleEndian() ? 0
|
uint64_t PtrOff = ShAmt / 8;
|
||||||
: (MVT::getSizeInBits(N0.getValueType()) - EVTBits) / 8);
|
|
||||||
SDOperand NewPtr = DAG.getNode(ISD::ADD, PtrType, LN0->getBasePtr(),
|
SDOperand NewPtr = DAG.getNode(ISD::ADD, PtrType, LN0->getBasePtr(),
|
||||||
DAG.getConstant(PtrOff, PtrType));
|
DAG.getConstant(PtrOff, PtrType));
|
||||||
AddToWorkList(NewPtr.Val);
|
AddToWorkList(NewPtr.Val);
|
||||||
|
Reference in New Issue
Block a user