public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ubizjak at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/100342] [10/11 Regression] wrong code with -O2 -fno-dse -fno-forward-propagate -mno-sse2
Date: Tue, 04 May 2021 12:50:02 +0000	[thread overview]
Message-ID: <bug-100342-4-tQsRHt10uw@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-100342-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100342

--- Comment #3 from Uroš Bizjak <ubizjak at gmail dot com> ---
For some reason the *input* value at BSWAP insn is truncated to 32bits.

  v256u128 v256u128_1 =
    SHLV (SHLSV (__builtin_bswap64 (u128_0), (v256u128) (0 < v256u128_0)) <=
          0, v256u128_0);

u128_0 is an argument to foo0, passes value of 123842323652213865 (decimal).

The binary has only one BSWAP insn, so:

$ objdump -dr a.out | grep bswap
  401ddd:       48 0f ca                bswap  %rdx

(gdb) b *0x401ddd
Breakpoint 1 at 0x401ddd: file pr100342.c, line 72.

Breakpoint 1, 0x0000000000401ddd in foo0 (u8_0=u8_0@entry=0 '\000',
v128u8_0=v128u8_0@entry=..., v512u8_0=..., u16_0=u16_0@entry=10, 
    v128u16_0=v128u16_0@entry=..., u32_0=u32_0@entry=4, u64_0=u64_0@entry=2,
v512u64_0=..., u128_0=<optimized out>, v256u128_0=..., v512u128_0=...)
    at zzz.c:72
72          SHLV (SHLSV (__builtin_bswap64 (u128_0), (v256u128) (0 <
v256u128_0)) <=
(gdb) p $rdx
$2 = 3983735913
(gdb) p/x $rdx
$3 = 0xed72fc69

We can "fix" the clobbered value manually in gdb session:

(gdb) set $rdx = 123842323652213865
(gdb) p/x $rdx
$4 = 0x1b7f9efed72fc69
(gdb) c
Continuing.
[Inferior 1 (process 20630) exited normally]

  parent reply	other threads:[~2021-05-04 12:50 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-29 20:10 [Bug target/100342] New: " zsojka at seznam dot cz
2021-04-30  6:51 ` [Bug rtl-optimization/100342] " rguenth at gcc dot gnu.org
2021-04-30  8:54 ` jakub at gcc dot gnu.org
2021-05-04 12:50 ` ubizjak at gmail dot com [this message]
2021-05-04 13:08 ` ubizjak at gmail dot com
2021-05-04 15:14 ` ubizjak at gmail dot com
2021-05-04 15:29 ` jakub at gcc dot gnu.org
2021-05-04 15:33 ` ubizjak at gmail dot com
2021-05-04 15:34 ` ubizjak at gmail dot com
2021-05-04 16:36 ` jakub at gcc dot gnu.org
2021-05-04 16:57 ` jakub at gcc dot gnu.org
2021-05-05 10:59 ` jakub at gcc dot gnu.org
2021-05-05 15:12 ` jakub at gcc dot gnu.org
2021-05-06  5:22 ` crazylht at gmail dot com
2021-05-15  8:14 ` cvs-commit at gcc dot gnu.org
2021-05-31 14:08 ` cvs-commit at gcc dot gnu.org
2021-05-31 14:56 ` [Bug rtl-optimization/100342] [10 " jakub at gcc dot gnu.org
2022-05-10  8:18 ` cvs-commit at gcc dot gnu.org
2022-05-10 10:45 ` jakub at gcc dot gnu.org

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=bug-100342-4-tQsRHt10uw@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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).