aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff options
context:
space:
mode:
authorNate Begeman <natebegeman@mac.com>2006-12-11 02:23:46 +0000
committerNate Begeman <natebegeman@mac.com>2006-12-11 02:23:46 +0000
commit2cbba8934745fe30662f2d5a59d03545ad5212c5 (patch)
treee4d205b29ca7d2a3a2cf140b3bc47da990e198f3 /lib/CodeGen/SelectionDAG/DAGCombiner.cpp
parentbfaaaa6e0f105cc57933afa9a380763fe87a5ff3 (diff)
Move something that should be in the dag combiner from the legalizer to the
dag combiner. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32431 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/DAGCombiner.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 4b7c494781..750f0bb6f5 100644
--- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -3034,6 +3034,20 @@ SDOperand DAGCombiner::visitSTORE(SDNode *N) {
ST->getSrcValueOffset());
}
+ // Turn 'store float 1.0, Ptr' -> 'store int 0x12345678, Ptr'
+ // FIXME: We shouldn't do this for TargetConstantFP's.
+ if (ConstantFPSDNode *CFP = dyn_cast<ConstantFPSDNode>(Value)) {
+ SDOperand Tmp;
+ if (CFP->getValueType(0) == MVT::f32) {
+ Tmp = DAG.getConstant(FloatToBits(CFP->getValue()), MVT::i32);
+ } else {
+ assert(CFP->getValueType(0) == MVT::f64 && "Unknown FP type!");
+ Tmp = DAG.getConstant(DoubleToBits(CFP->getValue()), MVT::i64);
+ }
+ return DAG.getStore(Chain, Tmp, Ptr, ST->getSrcValue(),
+ ST->getSrcValueOffset());
+ }
+
if (CombinerAA) {
// Walk up chain skipping non-aliasing memory nodes.
SDOperand BetterChain = FindBetterChain(N, Chain);