[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ilmbase



Hi,

On Fri, 25 Apr 2008, Michael Schmitz wrote:

> objdump on testBitPatterns.o gives:
> 
> 
> 0000005c
> <_ZN63_GLOBAL__N_.._.._HalfTest_testBitPatterns.cpp_00000000_2E91A93413floatPosQNan1Ev>:
>   5c:   4e56 0000       linkw %fp,#0
>   60:   f23c 4400 7fff  fmoves #nan,%fp0
>   66:   ffff
>   68:   4e5e            unlk %fp
>   6a:   4e75            rts
> 
> 0000006c
> <_ZN63_GLOBAL__N_.._.._HalfTest_testBitPatterns.cpp_00000000_2E91A93413floatNegQNan1Ev>:
>   6c:   4e56 0000       linkw %fp,#0
>   70:   f23c 4400 7fff  fmoves #nan,%fp0
>   76:   ffff
>   78:   4e5e            unlk %fp
>   7a:   4e75            rts
> 
> 0000007c
> <_ZN63_GLOBAL__N_.._.._HalfTest_testBitPatterns.cpp_00000000_2E91A93413floatPosQNan2Ev>:
>   7c:   4e56 0000       linkw %fp,#0
>   80:   f23c 4400 7fff  fmoves #nan,%fp0
>   86:   ffff
>   88:   4e5e            unlk %fp
>   8a:   4e75            rts
> 
> 0000008c
> <_ZN63_GLOBAL__N_.._.._HalfTest_testBitPatterns.cpp_00000000_2E91A93413floatNegQNan2Ev>:
>   8c:   4e56 0000       linkw %fp,#0
>   90:   f23c 4400 7fff  fmoves #nan,%fp0
>   96:   ffff
>   98:   4e5e            unlk %fp
>   9a:   4e75            rts
> 
> IOW, either binutils or cpp ignore the bit pattern bunged in the respective
> union, and replace it with a positive NaN straight away.

Hmm, the bit pattern is lost by gcc and the sign by as. It probably works 
with gcc-4.3 as it inlines these functions so it becomes an integer move 
on the stack.
It could be fixed in gcc, but it's also a little pedantic to test for 
this. Since there are also subtle differences in NaN handling between e.g. 
i386 and m68k, it would also be rather dangerous to rely on such specific 
details.

bye, Roman


Reply to: