I've had a look at your patches. They make sense to me. I've tried them.

  • mcs51_peeph.def.patch is in [r16432].
  • mcs51_peep.c.patch results in regression test failures; I guess it triggers issues (or missing functionality) elsewhere in the mcs51 peephole optimizer or its rules.
 

Related

Commit: [r16432]