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

Reply via email to