[llvm] r186196 - R600: Remove unsafe type punning. No intended functionality change.
Tom Stellard
tom at stellard.net
Fri Jul 12 13:57:56 PDT 2013
On Fri, Jul 12, 2013 at 08:18:06PM -0000, Benjamin Kramer wrote:
> Author: d0k
> Date: Fri Jul 12 15:18:05 2013
> New Revision: 186196
>
> URL: http://llvm.org/viewvc/llvm-project?rev=186196&view=rev
> Log:
> R600: Remove unsafe type punning. No intended functionality change.
>
Thanks!
-Tom
> Modified:
> llvm/trunk/lib/Target/R600/SIInstrInfo.td
>
> Modified: llvm/trunk/lib/Target/R600/SIInstrInfo.td
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/SIInstrInfo.td?rev=186196&r1=186195&r2=186196&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Target/R600/SIInstrInfo.td (original)
> +++ llvm/trunk/lib/Target/R600/SIInstrInfo.td Fri Jul 12 15:18:05 2013
> @@ -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 <
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list