[Top][All Lists]

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

unsigned int to float conversion

From: FÖLDY Lajos
Subject: unsigned int to float conversion
Date: Mon, 20 Jul 2009 19:15:12 +0200

Hi guys,

I have some weird results from my program. The suspect is unsigned int to float conversion. I have created the following simple test:


cvt_u4_f4(unsigned int* u4, float* f4)

Compiling it with g++-4.4 -m64 -O3 -S creates the following listing:

        .file   ""
        .p2align 4,,15
.globl _Z9cvt_u4_f4PjPf
        .type   _Z9cvt_u4_f4PjPf, @function
        .cfi_personality 0x3,__gxx_personality_v0
        mov     (%rdi), %eax
        cvtsi2ssq       %rax, %xmm0
        movss   %xmm0, (%rsi)
        .size   _Z9cvt_u4_f4PjPf, .-_Z9cvt_u4_f4PjPf
        .ident  "GCC: (GNU) 4.4.0"
        .section        .note.GNU-stack,"",@progbits

Now, here %eax is filled with the unsigned int value, then %rax is converted to float. It seems to me that the higher 32 bit of %rax is never set, I miss an xor %rax, %rax before mov. Am I right, or I miss something else?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]