fixed optimizations that were wrong with indexed mode

This commit is contained in:
ceriel 1990-06-19 15:15:37 +00:00
parent 101a129256
commit 9de0c3d920

View file

@ -19,6 +19,7 @@ REG {is_register(VAL)};
SREG {is_scratchreg(VAL)}; SREG {is_scratchreg(VAL)};
LAB,LAB2 {VAL[0] == LABEL_STARTER}; LAB,LAB2 {VAL[0] == LABEL_STARTER};
A,B {no_side_effects(VAL) }; A,B {no_side_effects(VAL) };
NO_INDEX {strindex(VAL, '[') == 0};
X,Y,LOG {TRUE}; X,Y,LOG {TRUE};
%%; %%;
@ -105,18 +106,22 @@ addl2 M_ONE,X -> decl X;
subw2 M_ONE,X -> incw X; subw2 M_ONE,X -> incw X;
subl2 M_ONE,X -> incl X; subl2 M_ONE,X -> incl X;
bitw $NUM,A : jneq LAB /* careful! jbs has byte argument, jlbs has long argument, so be very careful
{is_poweroftwo(NUM,LOG)}-> jbs $LOG,A,LAB; with indexed mode
bitl $NUM,A : jneq LAB */
{is_poweroftwo(NUM,LOG)}-> jbs $LOG,A,LAB; bitw $NUM,NO_INDEX : jneq LAB
bitw $NUM,A : jeql LAB {is_poweroftwo(NUM,LOG)}-> jbs $LOG,NO_INDEX,LAB;
{is_poweroftwo(NUM,LOG)}-> jbc $LOG,A,LAB; bitl $NUM,NO_INDEX : jneq LAB
bitl $NUM,A : jeql LAB {is_poweroftwo(NUM,LOG)}-> jbs $LOG,NO_INDEX,LAB;
{is_poweroftwo(NUM,LOG)}-> jbc $LOG,A,LAB; bitw $NUM,NO_INDEX : jeql LAB
bitw ONE,A : jneq LAB -> jlbs A,LAB; {is_poweroftwo(NUM,LOG)}-> jbc $LOG,NO_INDEX,LAB;
bitl $NUM,NO_INDEX : jeql LAB
{is_poweroftwo(NUM,LOG)}-> jbc $LOG,NO_INDEX,LAB;
bitw ONE,NO_INDEX : jneq LAB -> jlbs NO_INDEX,LAB;
bitl ONE,A : jneq LAB -> jlbs A,LAB; bitl ONE,A : jneq LAB -> jlbs A,LAB;
bitw ONE,A : jneq LAB -> jlbc A,LAB; bitw ONE,NO_INDEX : jneq LAB -> jlbc NO_INDEX,LAB;
bitl ONE,A : jneq LAB -> jlbc A,LAB; bitl ONE,A : jneq LAB -> jlbc A,LAB;
ashl $-NUM,A,REG : bicw2 $~NUM1,REG ashl $-NUM,A,REG : bicw2 $~NUM1,REG
{is_p2m1(NUM1,LOG)} -> extzv $NUM,$LOG,A,REG; {is_p2m1(NUM1,LOG)} -> extzv $NUM,$LOG,A,REG;
ashl $-NUM,A,REG : bicl2 $~NUM1,REG ashl $-NUM,A,REG : bicl2 $~NUM1,REG