From 795740b591331a0caf342edc4d572ec348415b40 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Fri, 12 Jul 2013 20:18:05 +0000 Subject: [PATCH] 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 --- lib/Target/R600/SIInstrInfo.td | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/Target/R600/SIInstrInfo.td b/lib/Target/R600/SIInstrInfo.td index 067a34bf479..52af79ccc25 100644 --- a/lib/Target/R600/SIInstrInfo.td +++ b/lib/Target/R600/SIInstrInfo.td @@ -22,9 +22,8 @@ def LO32 : SDNodeXForm; def LO32f : SDNodeXFormgetValueAPF().bitcastToAPInt().getZExtValue() & 0xffffffff; - float *fval = reinterpret_cast(&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; def HI32f : SDNodeXFormgetValueAPF().bitcastToAPInt().getZExtValue() >> 32; - float *fval = reinterpret_cast(&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 < -- 2.34.1