Menu

#618 Compiler no longer generates DJNZ instructions

closed-fixed
5
2013-05-25
2003-10-24
Josh Stone
No

For this bug, I am using the following test code:

#include <8051.h>
int main() {
unsigned char i;
i = 100;
do {
P1_1 = ~P1_1;
} while (--i);
return 0;
}

Using the latest CVS code for sdcc (Oct 24 2003), the
ASM code for the while condition is generated as:

;test.c:7: } while (--i);
; genMinus
; genMinusDec
mov a,r2
dec a
; genAssign
; genIfx
; Peephole 166 removed redundant mov
mov r3,a
mov ar2,r3
; genIfxJump
; Peephole 109 removed ljmp by inverse jump logic
jnz 00101$

It used to be much better! I happened to have an older
version of sdcc on another computer (Sep 26 2003) and
it produces this code:

;test.c:7: } while (--i);
; genDjnz
; Peephole 132 changed ljmp to sjmp
; Peephole 205 optimized misc jump sequence
djnz r2,00101$

So for some reason, SDCC no longer seems to find this
as an opportunity for "genDjnz".

Discussion

  • Erik Petrich

    Erik Petrich - 2003-10-28

    Logged In: YES
    user_id=635249

    Broken by my fix for bug #818696, but should now be fixed
    for both in src/SDCCicode.c 1.173

     
  • Erik Petrich

    Erik Petrich - 2003-10-28
    • milestone: --> fixed
    • assigned_to: nobody --> epetrich
    • status: open --> closed-fixed
     

Log in to post a comment.