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

            Bug ID: 98907
           Summary: Failure to optimize abs pattern
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gabravier at gmail dot com
  Target Milestone: ---

int32_t f(int32_t x)
{
    return ((x >> 31) | 1) * x;
}

This can be optimized into `return __builtin_abs(x);` (where sizeof(int) ==
sizeof(int32_t)). This transformation is done by LLVM, but not GCC.

Reply via email to