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

            Bug ID: 96688
           Summary: Failure to optimize shift-right+not of constant to
                    avoid not
           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: ---

int f(int x)
{
    return ~(123 >> x);
}

This return in this code can be optimized to `return ~123 >> x;`, and the same
optimization is possible where 123 is replaced by essentially any constant.
This transformation is done by LLVM, but not by GCC.

Reply via email to