git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@5041
4a8a32a2-be11-0410-ad9d-
d568d2c75423
+2008-02-22 Philipp Klaus Krause <pkk AT spth.de>
+
+ * src/z80/gen.c (genMult): Rewrote 8-bit multiplication by constant,
+ implements #1898231
+
2008-02-22 Philipp Klaus Krause <pkk AT spth.de>
* device/lib/z80/mul.s: Rewrote __muluchar_rrx_s, to improve 8-bit mult.,
2008-02-22 Philipp Klaus Krause <pkk AT spth.de>
* device/lib/z80/mul.s: Rewrote __muluchar_rrx_s, to improve 8-bit mult.,
2008-02-22 Maarten Brock <sourceforge.brock AT dse.nl>
2008-02-22 Maarten Brock <sourceforge.brock AT dse.nl>
_G.stack.pushedDE = TRUE;
}
_G.stack.pushedDE = TRUE;
}
- if ( AOP_SIZE (IC_LEFT (ic)) == 1 && !SPEC_USIGN (getSpec (operandType ( IC_LEFT (ic)))))
+ if (byteResult)
+ emit2 ("ld a,%s", aopGet (AOP (IC_LEFT (ic)), LSB, FALSE));
+ else if ( AOP_SIZE (IC_LEFT (ic)) == 1 && !SPEC_USIGN (getSpec (operandType ( IC_LEFT (ic)))))
{
emit2 ("ld e,%s", aopGet (AOP (IC_LEFT (ic)), LSB, FALSE));
if (!byteResult)
{
emit2 ("ld e,%s", aopGet (AOP (IC_LEFT (ic)), LSB, FALSE));
if (!byteResult)
- /* Fully unroled version of mul.s. Not the most efficient.
- */
for (count = 0; count < 16; count++)
{
if (count != 0 && active)
{
for (count = 0; count < 16; count++)
{
if (count != 0 && active)
{
+ if (byteResult)
+ emit2 ("add a,a");
+ else
+ emit2 ("add hl,hl");
}
if (i & 0x8000U)
{
if (active == FALSE)
{
}
if (i & 0x8000U)
{
if (active == FALSE)
{
- emit2 ("ld l,e");
- if (!byteResult)
- emit2 ("ld h,d");
+ if (byteResult)
+ emit2("ld e,a");
+ else
+ {
+ emit2 ("ld l,e");
+ emit2 ("ld h,d");
+ }
+ if (byteResult)
+ emit2 ("add a,e");
+ else
+ emit2 ("add hl,de");
- aopPut (AOP (IC_RESULT (ic)), _pairs[PAIR_HL].l, 0);
+ aopPut (AOP (IC_RESULT (ic)), "a", 0);
else
commitPair ( AOP (IC_RESULT (ic)), PAIR_HL);
else
commitPair ( AOP (IC_RESULT (ic)), PAIR_HL);