[llvm-commits] [llvm] r53165 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAGNodes.h lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp lib/CodeGen/SelectionDAG/LegalizeTypes.h
Duncan Sands
baldrick at free.fr
Sun Jul 6 17:08:13 PDT 2008
Author: baldrick
Date: Sun Jul 6 19:08:12 2008
New Revision: 53165
URL: http://llvm.org/viewvc/llvm-project?rev=53165&view=rev
Log:
LegalizeTypes soft-float support for stores of a
float value.
Modified:
llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h
Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=53165&r1=53164&r2=53165&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original)
+++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Sun Jul 6 19:08:12 2008
@@ -2150,8 +2150,10 @@
///
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;
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp?rev=53165&r1=53164&r2=53165&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp Sun Jul 6 19:08:12 2008
@@ -331,6 +331,7 @@
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 @@
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
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h?rev=53165&r1=53164&r2=53165&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Sun Jul 6 19:08:12 2008
@@ -344,6 +344,7 @@
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);
More information about the llvm-commits
mailing list