diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2013-07-12 20:18:05 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2013-07-12 20:18:05 +0000 |
commit | 795740b591331a0caf342edc4d572ec348415b40 (patch) | |
tree | 07d3ad338eac63639461565293335fc7f567addd | |
parent | 94803598aafdf652da789d79f68e042233d68b99 (diff) | |
download | external_llvm-795740b591331a0caf342edc4d572ec348415b40.zip external_llvm-795740b591331a0caf342edc4d572ec348415b40.tar.gz external_llvm-795740b591331a0caf342edc4d572ec348415b40.tar.bz2 |
R600: Remove unsafe type punning. No intended functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186196 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/R600/SIInstrInfo.td | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/Target/R600/SIInstrInfo.td b/lib/Target/R600/SIInstrInfo.td index 067a34b..52af79c 100644 --- a/lib/Target/R600/SIInstrInfo.td +++ b/lib/Target/R600/SIInstrInfo.td @@ -22,9 +22,8 @@ def LO32 : SDNodeXForm<imm, [{ }]>; def LO32f : SDNodeXForm<fpimm, [{ - uint64_t val = N->getValueAPF().bitcastToAPInt().getZExtValue() & 0xffffffff; - float *fval = reinterpret_cast<float *>(&val); - return CurDAG->getTargetConstantFP(*fval, MVT::f32); + APInt V = N->getValueAPF().bitcastToAPInt().trunc(32); + return CurDAG->getTargetConstantFP(APFloat(APFloat::IEEEsingle, V), MVT::f32); }]>; // Transformation function, extract the upper 32bit of a 64bit immediate @@ -33,9 +32,8 @@ def HI32 : SDNodeXForm<imm, [{ }]>; def HI32f : SDNodeXForm<fpimm, [{ - uint64_t val = N->getValueAPF().bitcastToAPInt().getZExtValue() >> 32; - float *fval = reinterpret_cast<float *>(&val); - return CurDAG->getTargetConstantFP(*fval, MVT::f32); + APInt V = N->getValueAPF().bitcastToAPInt().lshr(32).trunc(32); + return CurDAG->getTargetConstantFP(APFloat(APFloat::IEEEsingle, V), MVT::f32); }]>; def IMM8bitDWORD : ImmLeaf < |