public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Power/AltiVec question (Re: [RFA 0/5] improve printing of 128 bit ints)
Date: Thu, 08 Jun 2017 16:12:00 -0000	[thread overview]
Message-ID: <0760241c-7347-26a7-950f-2341c4807f10@redhat.com> (raw)
In-Reply-To: <87y3t24kja.fsf@pokyo>

On 06/08/2017 03:32 PM, Tom Tromey wrote:
> Tom> I wanted to improve 128-bit integer support, primarily for Rust,
> Tom> though I see in Bugzilla that I reported this bug at least twice for C
> Tom> as well.
> [...]
> Tom> Regtested on the buildbot.
> 
> I misread the results :(.  The powerpc64le builds come much later than
> the other results, and this confused me because I was running several
> buildbot tests at the same time.
> 
> Consider this excerpt from altivec-regs.exp:
> 
> set vector_register ".uint128 = 0x00000001000000010000000100000001, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0., v16_int8 = .0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0.."
> 
> This is an expected result from an "info regs".
> 
> This looks to me like there's a specific 128-bit value with a 1 in the
> low byte of each 4-byte word, but the test is expecting that the
> v4_float part will print as 0x0.  However, with my patches, the v4_float
> parts print as 0x1.
> 
> I tend to think the test here is incorrect.  But, I thought I would
> check in first.  What should this actually print, and why?

I'd expect that it prints 0x0 because "0x00000001", when reinterpreted (note,
not cast/converted) as the storage for a 32-bit float of whatever
format AltiVec uses, gives you a real number between 0 and 1.  And
then, considering <https://sourceware.org/bugzilla/show_bug.cgi?id=15318>,
when that number is converted to integer for printing as hex, it
it is converted to zero [as in, (int)0.1 => 0].

The test just below that one expects the same value to match "1.*e-45":

     set decimal_vector ".uint128 = 0x00000001000000010000000100000001, v4_float = .1.*e-45, 1.*e-45, 1.*e-45, 1.*e-45., v4_int32 = .1, 1, 1, 1., v8_int16 = .0, 1, 0, 1, 0, 1, 0, 1., v16_int8 = .0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1.."

Which seems to confirm it.

I'm not really sure whether PR 15318 applies in this case, the Power
backend may be doing something else, but that's my guess.

I've changed to subject to see if it draws the attention of someone
who might know for sure.

Thanks,
Pedro Alves

  reply	other threads:[~2017-06-08 16:12 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-02 19:36 [RFA 0/5] improve printing of 128 bit ints Tom Tromey
2017-06-02 19:37 ` [RFA 4/5] Remove val_print_type_code_int Tom Tromey
2017-06-02 19:37 ` [RFA 3/5] Simplify print_scalar_formatted Tom Tromey
2017-06-05 17:27   ` Pedro Alves
2017-06-02 19:37 ` [RFA 1/5] Don't always zero pad in print_*_chars Tom Tromey
2017-06-05 17:27   ` Pedro Alves
2017-06-02 19:37 ` [RFA 5/5] Add some 128-bit integer tests Tom Tromey
2017-06-05 17:33   ` Pedro Alves
2017-06-02 19:37 ` [RFA 2/5] Let print_decimal_chars handle signed values Tom Tromey
2017-06-05 17:22   ` Pedro Alves
2017-06-05 19:38     ` Tom Tromey
2017-06-05 17:35 ` [RFA 0/5] improve printing of 128 bit ints Pedro Alves
2017-06-08 14:32 ` Tom Tromey
2017-06-08 16:12   ` Pedro Alves [this message]
2017-06-12 14:34     ` Power/AltiVec question (Re: [RFA 0/5] improve printing of 128 bit ints) Tom Tromey
2017-06-12 18:26       ` Pedro Alves

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=0760241c-7347-26a7-950f-2341c4807f10@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /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).