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

            Bug ID: 126969
           Summary: If x is racecar, bitreverse (x) -> x
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kaelfandrew at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/6qPf5584j

With -O2:

int
bitreverse8_racecar (unsigned char x)
{
  if (x != 0 && x != 255)
    __builtin_unreachable ();
  return __builtin_bitreverse8 (x);
}

should optimize to return x.

Reply via email to