+2007-10-26 Maarten Brock <sourceforge.brock AT dse.nl>
+
+ * src/mcs51/peeph.def: moved rules 257.x to 253.x and re-enabled 253.b
+ * support/regression/tests/bug1721024.c:new, added
+
2007-10-25 Maarten Brock <sourceforge.brock AT dse.nl>
* support/regression/tests/bug1816470.c: new, added
mov r%3,a
}
+// unsigned char i=8; do{ } while(--i != 0);
+// this applies if i is kept in a register
+replace {
+ dec %1
+ cjne %1,#0x00,%2
+} by {
+ ; Peephole 253.a optimized decrement with compare
+ djnz %1,%2
+} if notVolatile(%1)
+
+// unsigned char i=8; do{ } while(--i != 0);
+// this applies if i is kept in data memory
+// must come before 256, see bug 1721024
+replace {
+ dec %1
+ mov a,%1
+ jnz %2
+} by {
+ ; Peephole 253.b optimized decrement with compare
+ djnz %1,%2
+} if notVolatile(%1), operandsNotRelated(%1 '@r0' '@r1')
+
+
// applies to f.e. funptrs.c
// saves one byte if %1 is a register or @register
replace {
} if labelRefCount(%2 0),operandsNotRelated('a' %4 %6 %8)
-// unsigned char i=8; do{ } while(--i != 0);
-// this applies if i is kept in a register
-replace {
- dec %1
- cjne %1,#0x00,%2
-} by {
- ; Peephole 257.a optimized decrement with compare
- djnz %1,%2
-} if notVolatile(%1)
-
-//// unsigned char i=8; do{ } while(--i != 0);
-//// this applies if i is kept in data memory
-// Disabled because together with 256.c it causes bug #1721024
-//replace {
-// dec %1
-// mov a,%1
-// jnz %2
-//} by {
-// ; Peephole 257.b optimized decrement with compare
-// djnz %1,%2
-//} if notVolatile(%1), operandsNotRelated(%1 '@r0' '@r1')
-
-
// in_byte<<=1; if(in_bit) in_byte|=1;
// helps f.e. reading data on a 3-wire (SPI) bus
replace {
--- /dev/null
+/*
+ bug 1721024
+*/
+
+#include <testfwk.h>
+
+static unsigned char temp1;
+static unsigned char temp2;
+
+void tst(unsigned long acc)
+{
+ UNUSED(acc);
+ temp1--;
+ if (temp1==0)
+ {
+ temp2=0;
+ }
+}
+
+void
+testBug(void)
+{
+ temp1 = 1;
+ temp2 = 2;
+ tst(0xFFFFFFFF); //make sure acc!=0
+ ASSERT(temp2 == 0);
+}