+2006-04-06 Maarten Brock <sourceforge.brock AT dse.nl>
+
+ * src/SDCCpeeph.c (labelIsReturnOnly): fixed bug 1464657
+ * src/mcs51/gen.c (genJumpTab): fixed bug in medium model
+ * support/regression/bug1464657.c: added, new test
+
2006-04-05 Maarten Brock <sourceforge.brock AT dse.nl>
* src/SDCCmain.c (preProcess): implemented RFE 1449908, define SDCC as the
/* this algorithm needs 9 cycles and 7 + 3*n bytes
if the switch argument is in a register.
(8 cycles and 6+2*n bytes if peepholes can change ljmp to sjmp) */
- /* (MB) What if peephole converts ljmp to sjmp or ret ???
- How will multiply by three be updated ???*/
+ /* Peephole may not convert ljmp to sjmp or ret
+ labelIsReturnOnly & labelInRange must check
+ currPl->ic->op != JUMPTABLE */
aopOp (IC_JTCOND (ic), ic, FALSE);
/* get the condition into accumulator */
l = aopGet (IC_JTCOND (ic), 0, FALSE, FALSE);
MOVA (l);
/* multiply by three */
- emitcode ("add", "a,acc");
- emitcode ("add", "a,%s", aopGet (IC_JTCOND (ic), 0, FALSE, FALSE));
+ if (aopGetUsesAcc (IC_JTCOND (ic), 0))
+ {
+ emitcode ("mov", "b,#3");
+ emitcode ("mul", "ab");
+ }
+ else
+ {
+ emitcode ("add", "a,acc");
+ emitcode ("add", "a,%s", aopGet (IC_JTCOND (ic), 0, FALSE, FALSE));
+ }
freeAsmop (IC_JTCOND (ic), NULL, ic, TRUE);
jtab = newiTempLabel (NULL);