diff options
| author | Chris Lattner <sabre@nondot.org> | 2005-01-08 06:25:56 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2005-01-08 06:25:56 +0000 |
| commit | e69daaf71de608dfb72d9db9eac0a685e87f29e2 (patch) | |
| tree | cc02815acbba3675f643fc8772e8ce0d2d085d8f /llvm/lib/CodeGen/SelectionDAG | |
| parent | 9a97e4d5b6342d48952addc5caf12ada6ef8b3fd (diff) | |
| download | bcm5719-llvm-e69daaf71de608dfb72d9db9eac0a685e87f29e2.tar.gz bcm5719-llvm-e69daaf71de608dfb72d9db9eac0a685e87f29e2.zip | |
Implement the 'store FPIMM, Ptr' -> 'store INTIMM, Ptr' optimization for
all targets.
llvm-svn: 19366
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index 996f116f8dd..4d6d0ebacae 100644 --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -424,6 +424,31 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) { Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain. Tmp2 = LegalizeOp(Node->getOperand(2)); // Legalize the pointer. + // Turn 'store float 1.0, Ptr' -> 'store int 0x12345678, Ptr' + if (ConstantFPSDNode *CFP = + dyn_cast<ConstantFPSDNode>(Node->getOperand(1))) { + if (CFP->getValueType(0) == MVT::f32) { + union { + unsigned I; + float F; + } V; + V.F = CFP->getValue(); + Result = DAG.getNode(ISD::STORE, MVT::Other, Tmp1, + DAG.getConstant(V.I, MVT::i32), Tmp2); + } else { + assert(CFP->getValueType(0) == MVT::f64 && "Unknown FP type!"); + union { + uint64_t I; + double F; + } V; + V.F = CFP->getValue(); + Result = DAG.getNode(ISD::STORE, MVT::Other, Tmp1, + DAG.getConstant(V.I, MVT::i64), Tmp2); + } + Op = Result; + Node = Op.Val; + } + switch (getTypeAction(Node->getOperand(1).getValueType())) { case Legal: { SDOperand Val = LegalizeOp(Node->getOperand(1)); |

