mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-24 04:56:51 +00:00
Add support to Legalize for expanding i64 sextload/zextload into hi and lo
parts. This should fix the crafty and signed long long unit test failure on x86 last night. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23711 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
53c523c00e
commit
144ff660e6
@ -3101,6 +3101,41 @@ void SelectionDAGLegalize::ExpandOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi){
|
||||
Hi = LegalizeOp(Hi);
|
||||
break;
|
||||
}
|
||||
case ISD::SEXTLOAD: {
|
||||
SDOperand Chain = LegalizeOp(Node->getOperand(0));
|
||||
SDOperand Ptr = LegalizeOp(Node->getOperand(1));
|
||||
MVT::ValueType EVT = cast<VTSDNode>(Node->getOperand(3))->getVT();
|
||||
|
||||
if (EVT == NVT)
|
||||
Lo = DAG.getLoad(NVT, Chain, Ptr, Node->getOperand(2));
|
||||
else
|
||||
Lo = DAG.getExtLoad(ISD::SEXTLOAD, NVT, Chain, Ptr, Node->getOperand(2),
|
||||
EVT);
|
||||
// The high part is obtained by SRA'ing all but one of the bits of the lo
|
||||
// part.
|
||||
unsigned LoSize = MVT::getSizeInBits(Lo.getValueType());
|
||||
Hi = DAG.getNode(ISD::SRA, NVT, Lo, DAG.getConstant(LoSize-1,
|
||||
TLI.getShiftAmountTy()));
|
||||
Lo = LegalizeOp(Lo);
|
||||
Hi = LegalizeOp(Hi);
|
||||
break;
|
||||
}
|
||||
case ISD::ZEXTLOAD: {
|
||||
SDOperand Chain = LegalizeOp(Node->getOperand(0));
|
||||
SDOperand Ptr = LegalizeOp(Node->getOperand(1));
|
||||
MVT::ValueType EVT = cast<VTSDNode>(Node->getOperand(3))->getVT();
|
||||
|
||||
if (EVT == NVT)
|
||||
Lo = DAG.getLoad(NVT, Chain, Ptr, Node->getOperand(2));
|
||||
else
|
||||
Lo = DAG.getExtLoad(ISD::ZEXTLOAD, NVT, Chain, Ptr, Node->getOperand(2),
|
||||
EVT);
|
||||
// The high part is just a zero.
|
||||
Hi = DAG.getConstant(0, NVT);
|
||||
Lo = LegalizeOp(Lo);
|
||||
Hi = LegalizeOp(Hi);
|
||||
break;
|
||||
}
|
||||
case ISD::ANY_EXTEND: {
|
||||
SDOperand In;
|
||||
switch (getTypeAction(Node->getOperand(0).getValueType())) {
|
||||
|
Loading…
Reference in New Issue
Block a user