public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/97442] New: Wrong represenation of AArch64 saba in RTL
@ 2020-10-15 11:18 ktkachov at gcc dot gnu.org
  2021-08-17  1:23 ` [Bug target/97442] " pinskia at gcc dot gnu.org
  2022-12-19 21:45 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: ktkachov at gcc dot gnu.org @ 2020-10-15 11:18 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97442
           Summary: Wrong represenation of AArch64 saba in RTL
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ktkachov at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64

This is similar to the issue fixed in
https://gcc.gnu.org/git/?p=gcc.git&a=commit;h=8544ed6eea68a80999504c8a4b21b77d29cd86e2

The representation of the SABA (and UABA) in RTL is not correct and the below
testcase will abort at -O3 -fwrapv:

#define N 16
signed char a[] = {-100, -100, -100, -100,-100, -100, -100, -100, -100, -100,
-100, -100, -100, -100, -100, -100 };
signed char b[] = { 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
100, 100, 100, 100 };

signed char out[N] = { 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
100, 100, 100, 100, 100 };

__attribute__ ((noinline,noipa))
void
foo (void)
{
  for (int i = 0; i < N; i++)
    {
      signed char diff = b[i] - a[i];
      out[i] += diff > 0 ? diff : -diff;
    }
}

signed char out2[N] = { 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
100, 100, 100, 100, 100 };

__attribute__ ((noinline,noipa))
void
foo_scalar (void)
{
  for (int i = 0; i < N; i++)
    {
      asm volatile ("");
      signed char diff = b[i] - a[i];
      out2[i] += diff > 0 ? diff : -diff;
    }
}

int
main (void)
{
  foo ();
  foo_scalar ();
  for (int i = 0; i < N; i++)
    if (out[i] != out2[i])
      __builtin_abort ();

  return 0;
}

due to function foo generating a saba when it shouldn't

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/97442] Wrong represenation of AArch64 saba in RTL
  2020-10-15 11:18 [Bug target/97442] New: Wrong represenation of AArch64 saba in RTL ktkachov at gcc dot gnu.org
@ 2021-08-17  1:23 ` pinskia at gcc dot gnu.org
  2022-12-19 21:45 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-17  1:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think this was fixed for GCC 11 with r11-6540. The trunk definitely works.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/97442] Wrong represenation of AArch64 saba in RTL
  2020-10-15 11:18 [Bug target/97442] New: Wrong represenation of AArch64 saba in RTL ktkachov at gcc dot gnu.org
  2021-08-17  1:23 ` [Bug target/97442] " pinskia at gcc dot gnu.org
@ 2022-12-19 21:45 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-19 21:45 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.0
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-12-19 21:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-15 11:18 [Bug target/97442] New: Wrong represenation of AArch64 saba in RTL ktkachov at gcc dot gnu.org
2021-08-17  1:23 ` [Bug target/97442] " pinskia at gcc dot gnu.org
2022-12-19 21:45 ` pinskia at gcc dot gnu.org

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).