///
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;
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;
}
}
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
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);