public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: anix <2362292778@qq.com>
To: gdb <gdb@sourceware.org>
Subject: Fw: Mistake in GNU AS of IA-32 for the result about half-precision floating-point value
Date: Tue, 14 Feb 2023 17:25:19 +0800	[thread overview]
Message-ID: <tencent_48DDA029AA0021AE776EAF1CE64226F92406@qq.com> (raw)

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

Dear:

&nbsp;&nbsp; &nbsp; &nbsp; I found one mistake in GNU AS of IA-32 for the result about half-precision floating-point value.
&nbsp;&nbsp; &nbsp; &nbsp; 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:&nbsp; &nbsp; .float 142,&nbsp; &nbsp; 580,&nbsp; &nbsp; 36832,&nbsp; 65504
half:&nbsp; &nbsp; .short 0x5870, 0x6080, 0x787f, 0x7bff
h1:&nbsp; &nbsp; .short 0, 0 ,0, 0
m1:&nbsp; &nbsp; .float 0, 0, 0, 0
.section .text
.globl _start
_start:
&nbsp; &nbsp; nop
&nbsp; &nbsp; movaps m32fp, %xmm0
&nbsp; &nbsp; vcvtps2ph $0, %xmm0, h1&nbsp; &nbsp; &nbsp; &nbsp; #imm8=$0; h1 {m64}

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



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

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


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

             reply	other threads:[~2023-02-14  9:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-14  9:25 anix [this message]
2023-02-14 22:33 ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tencent_48DDA029AA0021AE776EAF1CE64226F92406@qq.com \
    --to=2362292778@qq.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).