From: frief Date: Fri, 28 Nov 2003 21:54:44 +0000 (+0000) Subject: (genMultOneByte): help peephole 105 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=6d0529403e03fa1224dedc131e642801966fe80b;p=fw%2Fsdcc (genMultOneByte): help peephole 105 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3035 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/src/mcs51/gen.c b/src/mcs51/gen.c index 8cad6c3c..83790a85 100644 --- a/src/mcs51/gen.c +++ b/src/mcs51/gen.c @@ -3642,8 +3642,16 @@ genMultOneByte (operand * left, // just an unsigned 8*8=8/16 multiply //emitcode (";","unsigned"); // TODO: check for accumulator clash between left & right aops? - emitcode ("mov", "b,%s", aopGet (AOP (right), 0, FALSE, FALSE)); - MOVA (aopGet (AOP (left), 0, FALSE, FALSE)); + + if( AOP_TYPE(right)==AOP_LIT ){ + // moving to accumulator first helps peepholes + MOVA (aopGet (AOP (left), 0, FALSE, FALSE)); + emitcode ("mov", "b,%s", aopGet (AOP (right), 0, FALSE, FALSE)); + } else { + emitcode ("mov", "b,%s", aopGet (AOP (right), 0, FALSE, FALSE)); + MOVA (aopGet (AOP (left), 0, FALSE, FALSE)); + } + emitcode ("mul", "ab"); aopPut (AOP (result), "a", 0, isOperandVolatile (result, FALSE)); if (size==2) {