public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/114605] New: [14 Regression] wrong code with -march=z13 -O0 since r14-5831
@ 2024-04-05 13:23 jakub at gcc dot gnu.org
  2024-04-05 13:23 ` [Bug target/114605] " jakub at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-04-05 13:23 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114605
           Summary: [14 Regression] wrong code with -march=z13 -O0 since
                    r14-5831
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

Since r14-5831-gaae723d360ca26cd9fd0b039fb0a616bd0eae363 we miscompile the
following testcase on s390x-linux with -O0 -march=z13:
typedef struct { const float *a; int b, c; float *d; } S;

__attribute__((noipa)) void
bar (void)
{
}

__attribute__((noinline, optimize (2))) static void
foo (S *e)
{
  const float *f;
  float *g;
  float h[4] = { 0.0, 0.0, 1.0, 1.0 };
  if (!e->b)
    f = h;
  else
    f = e->a;
  g = &e->d[0];
  __builtin_memcpy (g, f, sizeof (float) * 4);
  bar ();
  if (!e->b)
    if (g[0] != 0.0 || g[1] != 0.0 || g[2] != 1.0 || g[3] != 1.0)
      __builtin_abort ();
}

int
main ()
{
  float d[4];
  S e = { .d = d };
  foo (&e);
  return 0;
}

The optimized dump difference from the previous commit is
@@ -23,7 +23,6 @@ Removing basic block 17
 __attribute__((optimize (2), noinline))
 void foo (struct S * e)
 {
-  float h[4];
   float * g;
   const float * f;
   int _1;
@@ -32,10 +31,10 @@ void foo (struct S * e)
   float _4;
   float _5;
   float _6;
-  uint128_t _13;
+  uint128_t pretmp_18;
+  uint128_t prephitmp_19;

   <bb 2> [local count: 1073741824]:
-  h = *.LC0;
   _1 = e_10(D)->b;
   if (_1 == 0)
     goto <bb 4>; [50.00%]
@@ -44,12 +43,12 @@ void foo (struct S * e)

   <bb 3> [local count: 536870912]:
   f_11 = e_10(D)->a;
+  pretmp_18 = MEM <uint128_t> [(char * {ref-all})f_11];

   <bb 4> [local count: 1073741824]:
-  # f_7 = PHI <&h(2), f_11(3)>
+  # prephitmp_19 = PHI <4575657222473777152(2), pretmp_18(3)>
   g_12 = e_10(D)->d;
-  _13 = MEM <uint128_t> [(char * {ref-all})f_7];
-  MEM <uint128_t> [(char * {ref-all})g_12] = _13;
+  MEM <uint128_t> [(char * {ref-all})g_12] = prephitmp_19;
   bar ();
   _2 = e_10(D)->b;
   if (_2 == 0)
@@ -89,7 +88,6 @@ void foo (struct S * e)
   __builtin_abort ();

   <bb 10> [local count: 1073741824]:
-  h ={v} {CLOBBER(eol)};
   return;

 }
4575657222473777152 is 0x3f8000003f800000 so on big endian that looks
reasonable.

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

end of thread, other threads:[~2024-04-08 14:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-05 13:23 [Bug target/114605] New: [14 Regression] wrong code with -march=z13 -O0 since r14-5831 jakub at gcc dot gnu.org
2024-04-05 13:23 ` [Bug target/114605] " jakub at gcc dot gnu.org
2024-04-05 13:46 ` jakub at gcc dot gnu.org
2024-04-05 14:29 ` jakub at gcc dot gnu.org
2024-04-08 14:22 ` cvs-commit at gcc dot gnu.org
2024-04-08 14:23 ` jakub 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).