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.