summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff options
context:
space:
mode:
authorJim Laskey <jlaskey@mac.com>2005-08-17 19:34:49 +0000
committerJim Laskey <jlaskey@mac.com>2005-08-17 19:34:49 +0000
commitb74c66618677ec27bc749c70b61d9b723c2e51c5 (patch)
treeaa4a194f382cf242fd704399685090e7b8aca85c /llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
parentc6aa80668e67972e9c8d4b4a3cdfc285def7c246 (diff)
downloadbcm5719-llvm-b74c66618677ec27bc749c70b61d9b723c2e51c5.tar.gz
bcm5719-llvm-b74c66618677ec27bc749c70b61d9b723c2e51c5.zip
Culling out use of unions for converting FP to bits and vice versa.
llvm-svn: 22838
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index ab070301b08..2c01982df2b 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -975,23 +975,17 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
// 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,
+ DAG.getConstant(FloatToBits(CFP->getValue()),
+ MVT::i32),
+ Tmp2,
Node->getOperand(3));
} 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,
+ DAG.getConstant(DoubleToBits(CFP->getValue()),
+ MVT::i64),
+ Tmp2,
Node->getOperand(3));
}
Node = Result.Val;
OpenPOWER on IntegriCloud