[Bug tree-optimization/126494] New: ICE with SVE VLS types and vector ?:

"ktkachov at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126494

            Bug ID: 126494
           Summary: ICE with SVE VLS types and vector ?:
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: aarch64-sve
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ktkachov at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64

typedef __SVInt32_t sv4si __attribute__((arm_sve_vector_bits (128)));
typedef int v4si __attribute__((vector_size (16)));

__attribute__((noipa)) sv4si
f (v4si a, v4si b, sv4si c)
{
  sv4si z = (sv4si) { 0, 0, 0, 0 };
  sv4si m1 = (sv4si) { -1, -1, -1, -1 };
  return ((a < b) ? z : m1) ^ c;
}

__attribute__((noipa)) void
ref (int *out, const int *a, const int *b, const int *c)
{
  for (int i = 0; i < 4; i++)
    {
      volatile int ai = a[i];
      volatile int bi = b[i];
      volatile int ci = c[i];
      volatile int m = (ai < bi) ? 0 : -1;
      out[i] = m ^ ci;
    }
}

int
main (void)
{
  volatile int ia[4] = { 1, 5, -3, 7 };
  volatile int ib[4] = { 2, 2, 9, 7 };
  volatile int ic[4] = { 0x5a5a5a5a, -1, 3, 0 };
  int sa[4], sb[4], sc[4], expect[4];
  for (int i = 0; i < 4; i++)
    {
      sa[i] = ia[i];
      sb[i] = ib[i];
      sc[i] = ic[i];
    }

  v4si a = { sa[0], sa[1], sa[2], sa[3] };
  v4si b = { sb[0], sb[1], sb[2], sb[3] };
  sv4si c = (sv4si) { sc[0], sc[1], sc[2], sc[3] };

  sv4si r = f (a, b, c);
  ref (expect, sa, sb, sc);

  for (int i = 0; i < 4; i++)
    if (r[i] != expect[i])
      __builtin_abort ();
  return 0;
}

ICEs on aarch64 g++ with -O2 -march=armv8-a+sve -msve-vector-bits=128

during RTL pass: expand
<source>: In function 'sv4si f(v4si, v4si, sv4si)':
<source>:9:31: internal compiler error: in expand_insn, at optabs.cc:8682
    9 |   return ((a < b) ? z : m1) ^ c;

With GCC 13 this didn't ICE but the program aborted while it passes fine on
Clang
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.