mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-14 07:31:53 +00:00
LegalizeTypes soft-float support for stores of a
float value. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53165 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
80585f1daa
commit
990f032907
@ -2150,8 +2150,10 @@ public:
|
||||
///
|
||||
class StoreSDNode : public LSBaseSDNode {
|
||||
virtual void ANCHOR(); // Out-of-line virtual method to give class a home.
|
||||
|
||||
// IsTruncStore - True if the op does a truncation before store.
|
||||
|
||||
// IsTruncStore - True if the op does a truncation before store. For
|
||||
// integers this is the same as doing a TRUNCATE and storing the result.
|
||||
// For floats, it is the same as doing an FP_ROUND and storing the result.
|
||||
bool IsTruncStore;
|
||||
protected:
|
||||
friend class SelectionDAG;
|
||||
|
@ -331,6 +331,7 @@ bool DAGTypeLegalizer::SoftenFloatOperand(SDNode *N, unsigned OpNo) {
|
||||
case ISD::BR_CC: Res = SoftenFloatOp_BR_CC(N); break;
|
||||
case ISD::SELECT_CC: Res = SoftenFloatOp_SELECT_CC(N); break;
|
||||
case ISD::SETCC: Res = SoftenFloatOp_SETCC(N); break;
|
||||
case ISD::STORE: Res = SoftenFloatOp_STORE(N, OpNo); break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -496,6 +497,24 @@ SDOperand DAGTypeLegalizer::SoftenFloatOp_SETCC(SDNode *N) {
|
||||
DAG.getCondCode(CCCode));
|
||||
}
|
||||
|
||||
SDOperand DAGTypeLegalizer::SoftenFloatOp_STORE(SDNode *N, unsigned OpNo) {
|
||||
assert(ISD::isUNINDEXEDStore(N) && "Indexed store during type legalization!");
|
||||
assert(OpNo == 1 && "Can only soften the stored value!");
|
||||
StoreSDNode *ST = cast<StoreSDNode>(N);
|
||||
SDOperand Val = ST->getValue();
|
||||
|
||||
if (ST->isTruncatingStore())
|
||||
// Do an FP_ROUND followed by a non-truncating store.
|
||||
Val = BitConvertToInteger(DAG.getNode(ISD::FP_ROUND, ST->getMemoryVT(),
|
||||
Val, DAG.getIntPtrConstant(0)));
|
||||
else
|
||||
Val = GetSoftenedFloat(Val);
|
||||
|
||||
return DAG.getStore(ST->getChain(), Val, ST->getBasePtr(),
|
||||
ST->getSrcValue(), ST->getSrcValueOffset(),
|
||||
ST->isVolatile(), ST->getAlignment());
|
||||
}
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Float Result Expansion
|
||||
|
@ -344,6 +344,7 @@ private:
|
||||
SDOperand SoftenFloatOp_BR_CC(SDNode *N);
|
||||
SDOperand SoftenFloatOp_SELECT_CC(SDNode *N);
|
||||
SDOperand SoftenFloatOp_SETCC(SDNode *N);
|
||||
SDOperand SoftenFloatOp_STORE(SDNode *N, unsigned OpNo);
|
||||
|
||||
void SoftenSetCCOperands(SDOperand &NewLHS, SDOperand &NewRHS,
|
||||
ISD::CondCode &CCCode);
|
||||
|
Loading…
Reference in New Issue
Block a user