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

--- Comment #8 from Bernie Innocenti <bernie at codewiz dot org> ---
Actually, fixing this produces worse sequences in cases that were correct
before, because the patterns now require an explicit "shift & 7" that
combine never produces:

  SOURCE               BEFORE          AFTER
  *p |= 1 << n         bset d0,(a0)    moveq #1; lsl.l d1,d0; or.b d0,(a0)
  *p |= 1 << (n & 7)   lsl.l; or.b     same
  *p &= ~(1 << n)      bclr d0,(a0)    moveq #-2; rol.l d1,d0; and.b d0,(a0)
  *p |= 1 << 3         or.b #8,(a0)    same

The unmasked cases have to change, but the masked ones are where bset/bclr
would be valid,
and yet the fixed patterns aren't selected.

These are common in graphics algorithms, so we would like to keep emitting
bset/bclr at least for the masked cases.

Reply via email to