X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fz80%2Fgen.c;h=9e88369d51596624c9c8b7069bf31639fa9529f3;hb=faf36532f8fe1cff757958cb6a222c141f1eeaa4;hp=e0a478f9c81cba11116982faa64e0f8974965587;hpb=69b1d117513dcf8f691af325e978c94b052838af;p=fw%2Fsdcc diff --git a/src/z80/gen.c b/src/z80/gen.c index e0a478f9..9e88369d 100644 --- a/src/z80/gen.c +++ b/src/z80/gen.c @@ -4447,7 +4447,7 @@ shiftR2Left2Result (operand * left, int offl, tlbl1 = newiTempLabel (NULL); /* Left is already in result - so now do the shift */ - if (shCount <= 2) + if (shCount <= 4) { while (shCount--) { @@ -4828,8 +4828,6 @@ genrshOne (operand * result, operand * left, int shCount, int is_signed) l = aopGet (AOP (left), 0, FALSE); - emit2 ("or a,a"); - if (AOP (result)->type == AOP_REG) { aopPut (AOP (result), l, 0); @@ -4913,7 +4911,19 @@ genrshTwo (operand * result, operand * left, { movLeft2Result (left, MSB16, result, LSB, sign); } - aopPut (AOP (result), "!zero", 1); + if (sign) + { + /* Sign extend the result */ + _moveA(aopGet (AOP (result), 0, FALSE)); + emit2 ("rlc a"); + emit2 ("sbc a,a"); + + aopPut (AOP (result), ACC_NAME, MSB16); + } + else + { + aopPut (AOP (result), "!zero", 1); + } } /* 1 <= shCount <= 7 */ else @@ -4959,7 +4969,6 @@ genRightShiftLiteral (operand * left, genrshOne (result, left, shCount, sign); break; case 2: - /* PENDING: sign support */ genrshTwo (result, left, shCount, sign); break; case 4: