+ clr c
+ mov a,#%1
+ subb a,%2
+ jc %3
+%4:
+ mov a,%2
+ add a,%2
+ add a,%2
+ mov dptr,%5
+ jmp @a+dptr
+} by {
+ ; Peephole 255 optimized jump table index calculation
+ mov a,%2
+ cjne a,#(%1+0x01),.+1
+ jnc %3
+%4:
+ add a,%2
+ add a,%2
+ mov dptr,%5
+ jmp @a+dptr
+}
+
+// applies to f.e. jump tables and scott-bool1.c.
+// similar peepholes can be constructed for other instructions
+// after which a flag or a register is known (like: djnz, cjne, jnc)
+replace {
+ jc %1
+%2:
+ clr c
+} by {
+ ; Peephole 256.a removed redundant clr c
+ jc %1
+%2:
+} if labelRefCount %2 0
+
+// applies to f.e. logf.c
+replace {
+ jnz %1
+%2:
+ clr a
+} by {
+ ; Peephole 256.b removed redundant clr a
+ jnz %1
+%2:
+} if labelRefCount %2 0
+
+
+// unsigned char i=8; do{ } while(--i != 0);
+// this currently only applies if i is kept in a register
+replace {
+ dec %1
+ cjne %1,#0x00,%2
+} by {
+ ; Peephole 257 optimized decrement with compare
+ djnz %1,%2
+} if notVolatile %1
+
+
+// in_byte<<=1; if(in_bit) in_byte|=1;
+// helps f.e. reading data on a 3-wire (SPI) bus
+replace {
+ mov a,%1
+ add a,%1
+ mov %1,a
+ jnb %2,%3
+%4:
+ orl %1,#0x01
+%3:
+} by {
+ ; Peephole 258.a optimized bitbanging
+ mov a,%1
+ mov c,%2
+ addc a,%1
+ mov %1,a
+%4:
+%3:
+} if notVolatile %1
+
+// in_byte<<=1; if(in_bit) in_byte|=1;
+replace {
+ mov a,r%1
+ add a,r%1
+ mov r%1,a
+ jnb %2,%3