[Bug tree-optimization/126462] New: [16/17 Regression] Wrong code with xor-rotate idiom

"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=126462

            Bug ID: 126462
           Summary: [16/17 Regression] Wrong code with xor-rotate idiom
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ktkachov at gcc dot gnu.org
  Target Milestone: ---

typedef unsigned __int128 u128;

__attribute__((noipa)) u128
f (u128 x)
{
  return ((x << 64) ^ (u128) 1) | (x >> 64);
}

__attribute__((noipa)) u128
g (u128 x)
{
  return ((x << 96) ^ ((u128) 1 << 32)) | (x >> 32);
}

int
main (void)
{
  u128 x = (u128) 1 << 64;
  if (f (x) != 1)
    __builtin_abort ();
  if (g (x) != ((u128) 1 << 32))
    __builtin_abort ();
  return 0;
}

aborts on aarch64. GCC 15 seems to run fine
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.