[Bug middle-end/101955] New: (signed<<31)>>31 should become -(signed&1)

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Aug 18 05:47:59 GMT 2021


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

            Bug ID: 101955
           Summary: (signed<<31)>>31 should become -(signed&1)
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
int f(int b)
{
    return (((b)<<31)>>31);
}
int f1(int b)
{
    return -(b&1);
}
These two should produce the same code.


More information about the Gcc-bugs mailing list