Fw: Mistake in GNU AS of IA-32 for the result about half-precision floating-point value

anix 2362292778@qq.com
Tue Feb 14 09:25:19 GMT 2023


Dear:

       I found one mistake in GNU AS of IA-32 for the result about half-precision floating-point value.
       as the following, including source code and gdb result:




# The source code convert between single-precision floating-point(32-bit) and half-precision floating-point (16-bit).

.section .data
m32fp:    .float 142,    580,    36832,  65504
half:    .short 0x5870, 0x6080, 0x787f, 0x7bff
h1:    .short 0, 0 ,0, 0
m1:    .float 0, 0, 0, 0
.section .text
.globl _start
_start:
    nop
    movaps m32fp, %xmm0
    vcvtps2ph $0, %xmm0, h1        #imm8=$0; h1 {m64}

    vcvtph2ps h1, %xmm1
    movups %xmm1, m1
    
next:    movl $1, %eax
    movl $0, %ebx
    int $0x80
# the source code end here.



# results under GNU Debugger (gdb)
(gdb) x/4fw &m32fp 
0x804a000:    142    580    36832    65504
(gdb) x/4fw &m1 
0x804a020:    142    580    36832    65504
(gdb) x/4fh &half 
0x804a010:    22640    24704    30847    31743
(gdb) x/4fh &h1
0x804a018:    22640    24712    30847    31743
(gdb) x/4xw &m32fp 
0x804a000:    0x430e0000    0x44110000    0x470fe000    0x477fe000
(gdb) x/4xw &m1
0x804a020:    0x430e0000    0x44110000    0x470fe000    0x477fe000
(gdb) x/4xh &half 
0x804a010:    0x5870    0x6080    0x787f    0x7bff
(gdb) x/4xh &h1
0x804a018:    0x5870    0x6088    0x787f    0x7bff
# the results of half-precision data (half, h1) by gdb  are mistakes, or instruct me 

# All above under IA-32 , OS is centos (32-bit), GNU as and gdb are  also 32-bit.


hope your return.
thank you very much!
                                           Niu wensheng
                                               2023.02.12


More information about the Gdb mailing list