+// sdcc does not use the H flag. sla resets it, while add sets it.
+// To ensure that the state of the H flag is not changed by this
+// peephole uncomment the add %3, %4 at the end (since it overwrite the H flag).
+replace restart {
+ ld %1, a
+ sla %1
+ sla %1
+ ld a, %2
+ //add %3, %4
+} by {
+ add a, a
+ add a, a
+ ; peephole 42b' shifted in accumulator insted of %1
+ ld %1, a
+ ld a, %2
+ //add %3, %4
+}
+
+replace restart {
+ ld l,%1 (ix)
+ ld h,%2 (ix)
+ ld a,(hl)
+ inc a
+ ld l,%1 (ix)
+ ld h,%2 (ix)
+ ld (hl),a
+} by {
+ ld l,%1 (ix)
+ ld h,%2 (ix)
+ inc (hl)
+ ; peephole 42c incremented in (hl) instead of going through a.
+} if notUsed('a')
+
+replace restart {
+ ld l,%1 (ix)
+ ld h,%2 (ix)
+ ld a,(hl)
+ dec a
+ ld l,%1 (ix)
+ ld h,%2 (ix)
+ ld (hl),a
+} by {
+ ld l,%1 (ix)
+ ld h,%2 (ix)
+ dec (hl)
+ ; peephole 42d decremented in (hl) instead of going through a.
+} if notUsed('a')
+