summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorJim Laskey <jlaskey@mac.com>2005-08-17 17:42:52 +0000
committerJim Laskey <jlaskey@mac.com>2005-08-17 17:42:52 +0000
commit686d6a1cb2b22d7e82acdba93d70529ed070da9c (patch)
tree9fc11e8b3684d3218cda4748990134d2140268c0 /llvm/lib/CodeGen
parentadc9c0c559eb1d8ab6929c48bf7d374e5ffbae6a (diff)
downloadbcm5719-llvm-686d6a1cb2b22d7e82acdba93d70529ed070da9c.tar.gz
bcm5719-llvm-686d6a1cb2b22d7e82acdba93d70529ed070da9c.zip
Switched to using BitsToDouble for int_to_float to avoid aliasing problem.
llvm-svn: 22831
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index ccef33eb891..ab070301b08 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -15,6 +15,7 @@
#include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
+#include "llvm/Support/MathExtras.h"
#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetOptions.h"
@@ -204,10 +205,9 @@ SDOperand SelectionDAGLegalize::ExpandLegalINT_TO_FP(bool isSigned,
SDOperand Load = DAG.getLoad(MVT::f64, Store2, StackSlot,
DAG.getSrcValue(NULL));
// FP constant to bias correct the final result
- uint64_t SignedBias = 0x4330000080000000ULL;
- uint64_t UnsignedBias = 0x4330000000000000ULL;
- SDOperand Bias = DAG.getConstantFP(isSigned ? *(double *)&SignedBias
- : *(double *)&UnsignedBias,
+ SDOperand Bias = DAG.getConstantFP(isSigned ?
+ BitsToDouble(0x4330000080000000ULL)
+ : BitsToDouble(0x4330000000000000ULL),
MVT::f64);
// subtract the bias
SDOperand Sub = DAG.getNode(ISD::SUB, MVT::f64, Load, Bias);
OpenPOWER on IntegriCloud