[Bug tree-optimization/102738] New: Failure to optimize right shift of 128-bit value after it's already been shifted by 127

gabravier at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Oct 14 00:36:37 GMT 2021


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

            Bug ID: 102738
           Summary: Failure to optimize right shift of 128-bit value after
                    it's already been shifted by 127
           Product: gcc
           Version: 12.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 a(__int128 f, int g)
{
    return (f >> 127) >> g;
}

This can be optimized to `return f >> 127;`. This optimization is done by LLVM,
but not by GCC.


More information about the Gcc-bugs mailing list