public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Mistake in GNU AS of IA-32 for the result about half-precision floating-point value
@ 2023-02-12 13:51 anix
  0 siblings, 0 replies; only message in thread
From: anix @ 2023-02-12 13:51 UTC (permalink / raw)
  To: bug-gdb

[-- Attachment #1: Type: text/plain, Size: 2509 bytes --]

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-02-12 13:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-12 13:51 Mistake in GNU AS of IA-32 for the result about half-precision floating-point value anix

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).