https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106243
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Failure to optimize (0 - x) |Failure to optimize (0 - x) |& 1 on vector type |& 1 on gimple level | |(including vector types) Ever confirmed|0 |1 Last reconfirmed| |2022-07-10 Status|UNCONFIRMED |NEW --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Confirmed, even scalar version is not optimized on the gimple level: int f1(int x) { x = -x; return x & 1; } RTL level is done during combine for the scalar version: Trying 6 -> 7: 6: {r86:SI=-r87:SI;clobber flags:CC;} REG_DEAD r87:SI REG_UNUSED flags:CC 7: {r85:SI=r86:SI&0x1;clobber flags:CC;} REG_DEAD r86:SI REG_UNUSED flags:CC Successfully matched this instruction: (parallel [ (set (reg:SI 85) (and:SI (reg:SI 87) (const_int 1 [0x1]))) (clobber (reg:CC 17 flags)) ])