[Bug tree-optimization/94916] New: Failure to optimize pattern into difference or zero selector

gabravier at gmail dot com gcc-bugzilla@gcc.gnu.org
Sat May 2 08:35:57 GMT 2020


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

            Bug ID: 94916
           Summary: Failure to optimize pattern into difference or zero
                    selector
           Product: gcc
           Version: 10.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, int y)
{
    return (x - y) & -(x >= y);
}

This can be optimized to return x >= y ? x - y : 0. LLVM does this
transformation, but GCC does not. (also, GCC fails to optimize the resulting
pattern properly, but this is already reported in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94898)


More information about the Gcc-bugs mailing list