mirror of
https://github.com/RPCS3/llvm.git
synced 2025-04-15 12:30:22 +00:00
Update per review comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40965 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9528f11481
commit
ab081c7195
@ -333,8 +333,8 @@ public:
|
|||||||
/// for it.
|
/// for it.
|
||||||
LegalizeAction
|
LegalizeAction
|
||||||
getConvertAction(MVT::ValueType FromVT, MVT::ValueType ToVT) const {
|
getConvertAction(MVT::ValueType FromVT, MVT::ValueType ToVT) const {
|
||||||
if (MVT::isExtendedVT(ToVT) || MVT::isExtendedVT(FromVT))
|
assert(FromVT < MVT::LAST_VALUETYPE && ToVT < 32 &&
|
||||||
return Expand;
|
"Table isn't big enough!");
|
||||||
return (LegalizeAction)((ConvertActions[FromVT] >> (2*ToVT)) & 3);
|
return (LegalizeAction)((ConvertActions[FromVT] >> (2*ToVT)) & 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3194,51 +3194,36 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ISD::FP_EXTEND: {
|
case ISD::FP_EXTEND:
|
||||||
MVT::ValueType newVT = Op.getValueType();
|
|
||||||
MVT::ValueType oldVT = Op.getOperand(0).getValueType();
|
|
||||||
if (TLI.getConvertAction(oldVT, newVT) == TargetLowering::Expand) {
|
|
||||||
// The only way we can lower this is to turn it into a STORE,
|
|
||||||
// EXTLOAD pair, targetting a temporary location (a stack slot).
|
|
||||||
|
|
||||||
// NOTE: there is a choice here between constantly creating new stack
|
|
||||||
// slots and always reusing the same one. We currently always create
|
|
||||||
// new ones, as reuse may inhibit scheduling.
|
|
||||||
const Type *Ty = MVT::getTypeForValueType(oldVT);
|
|
||||||
uint64_t TySize = TLI.getTargetData()->getTypeSize(Ty);
|
|
||||||
unsigned Align = TLI.getTargetData()->getPrefTypeAlignment(Ty);
|
|
||||||
MachineFunction &MF = DAG.getMachineFunction();
|
|
||||||
int SSFI =
|
|
||||||
MF.getFrameInfo()->CreateStackObject(TySize, Align);
|
|
||||||
SDOperand StackSlot = DAG.getFrameIndex(SSFI, TLI.getPointerTy());
|
|
||||||
Result = DAG.getStore(DAG.getEntryNode(), Node->getOperand(0),
|
|
||||||
StackSlot, NULL, 0);
|
|
||||||
Result = DAG.getExtLoad(ISD::EXTLOAD, newVT,
|
|
||||||
Result, StackSlot, NULL, 0, oldVT);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// FALL THROUGH (to ANY_EXTEND case)
|
|
||||||
case ISD::FP_ROUND: {
|
case ISD::FP_ROUND: {
|
||||||
MVT::ValueType newVT = Op.getValueType();
|
MVT::ValueType newVT = Op.getValueType();
|
||||||
MVT::ValueType oldVT = Op.getOperand(0).getValueType();
|
MVT::ValueType oldVT = Op.getOperand(0).getValueType();
|
||||||
if (TLI.getConvertAction(oldVT, newVT) == TargetLowering::Expand) {
|
if (TLI.getConvertAction(oldVT, newVT) == TargetLowering::Expand) {
|
||||||
// The only way we can lower this is to turn it into a TRUNCSTORE,
|
// The only way we can lower this is to turn it into a STORE,
|
||||||
// LOAD pair, targetting a temporary location (a stack slot).
|
// LOAD pair, targetting a temporary location (a stack slot).
|
||||||
|
|
||||||
// NOTE: there is a choice here between constantly creating new stack
|
// NOTE: there is a choice here between constantly creating new stack
|
||||||
// slots and always reusing the same one. We currently always create
|
// slots and always reusing the same one. We currently always create
|
||||||
// new ones, as reuse may inhibit scheduling.
|
// new ones, as reuse may inhibit scheduling.
|
||||||
const Type *Ty = MVT::getTypeForValueType(newVT);
|
MVT::ValueType slotVT =
|
||||||
|
(Node->getOpcode() == ISD::FP_EXTEND) ? oldVT : newVT;
|
||||||
|
const Type *Ty = MVT::getTypeForValueType(slotVT);
|
||||||
uint64_t TySize = TLI.getTargetData()->getTypeSize(Ty);
|
uint64_t TySize = TLI.getTargetData()->getTypeSize(Ty);
|
||||||
unsigned Align = TLI.getTargetData()->getPrefTypeAlignment(Ty);
|
unsigned Align = TLI.getTargetData()->getPrefTypeAlignment(Ty);
|
||||||
MachineFunction &MF = DAG.getMachineFunction();
|
MachineFunction &MF = DAG.getMachineFunction();
|
||||||
int SSFI =
|
int SSFI =
|
||||||
MF.getFrameInfo()->CreateStackObject(TySize, Align);
|
MF.getFrameInfo()->CreateStackObject(TySize, Align);
|
||||||
SDOperand StackSlot = DAG.getFrameIndex(SSFI, TLI.getPointerTy());
|
SDOperand StackSlot = DAG.getFrameIndex(SSFI, TLI.getPointerTy());
|
||||||
Result = DAG.getTruncStore(DAG.getEntryNode(), Node->getOperand(0),
|
if (Node->getOpcode() == ISD::FP_EXTEND) {
|
||||||
StackSlot, NULL, 0, newVT);
|
Result = DAG.getStore(DAG.getEntryNode(), Node->getOperand(0),
|
||||||
Result = DAG.getLoad(newVT, Result, StackSlot, NULL, 0, newVT);
|
StackSlot, NULL, 0);
|
||||||
|
Result = DAG.getExtLoad(ISD::EXTLOAD, newVT,
|
||||||
|
Result, StackSlot, NULL, 0, oldVT);
|
||||||
|
} else {
|
||||||
|
Result = DAG.getTruncStore(DAG.getEntryNode(), Node->getOperand(0),
|
||||||
|
StackSlot, NULL, 0, newVT);
|
||||||
|
Result = DAG.getLoad(newVT, Result, StackSlot, NULL, 0, newVT);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user