From: johanknol Date: Tue, 15 Jan 2002 13:40:59 +0000 (+0000) Subject: fixed bug #449107 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=ecb80d43021b166a54e0fe0d014a31115e51da87;p=fw%2Fsdcc fixed bug #449107 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1804 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/src/ds390/gen.c b/src/ds390/gen.c index 9ade1a7f..a400563a 100644 --- a/src/ds390/gen.c +++ b/src/ds390/gen.c @@ -1692,6 +1692,7 @@ genCpl (iCode * ic) { int offset = 0; int size; + symbol *tlbl; D (emitcode (";", "genCpl "); ); @@ -1701,17 +1702,21 @@ genCpl (iCode * ic) aopOp (IC_LEFT (ic), ic, FALSE, FALSE); aopOp (IC_RESULT (ic), ic, TRUE, AOP_TYPE (IC_LEFT (ic)) == AOP_DPTR); - /* if both are in bit space then - a special case */ - if (AOP_TYPE (IC_RESULT (ic)) == AOP_CRY && - AOP_TYPE (IC_LEFT (ic)) == AOP_CRY) - { - + /* special case if in bit space */ + if (AOP_TYPE (IC_RESULT (ic)) == AOP_CRY) { + if (AOP_TYPE (IC_LEFT (ic)) == AOP_CRY) { emitcode ("mov", "c,%s", IC_LEFT (ic)->aop->aopu.aop_dir); emitcode ("cpl", "c"); emitcode ("mov", "%s,c", IC_RESULT (ic)->aop->aopu.aop_dir); goto release; } + tlbl=newiTempLabel(NULL); + emitcode ("cjne", "%s,#0x01,%05d$", + aopGet(AOP(IC_LEFT(ic)), 0, FALSE,FALSE,TRUE), tlbl->key+100); + emitcode ("", "%05d$:", tlbl->key+100); + outBitC (IC_RESULT(ic)); + goto release; + } size = AOP_SIZE (IC_RESULT (ic)); _startLazyDPSEvaluation (); diff --git a/src/mcs51/gen.c b/src/mcs51/gen.c index 4d1f4394..0c002740 100644 --- a/src/mcs51/gen.c +++ b/src/mcs51/gen.c @@ -1328,7 +1328,7 @@ genCpl (iCode * ic) { int offset = 0; int size; - + symbol *tlbl; D(emitcode (";", "genCpl")); @@ -1336,17 +1336,21 @@ genCpl (iCode * ic) aopOp (IC_LEFT (ic), ic, FALSE); aopOp (IC_RESULT (ic), ic, TRUE); - /* if both are in bit space then - a special case */ - if (AOP_TYPE (IC_RESULT (ic)) == AOP_CRY && - AOP_TYPE (IC_LEFT (ic)) == AOP_CRY) - { - + /* special case if in bit space */ + if (AOP_TYPE (IC_RESULT (ic)) == AOP_CRY) { + if (AOP_TYPE (IC_LEFT (ic)) == AOP_CRY) { emitcode ("mov", "c,%s", IC_LEFT (ic)->aop->aopu.aop_dir); emitcode ("cpl", "c"); emitcode ("mov", "%s,c", IC_RESULT (ic)->aop->aopu.aop_dir); goto release; } + tlbl=newiTempLabel(NULL); + emitcode ("cjne", "%s,#0x01,%05d$", + aopGet(AOP(IC_LEFT(ic)), 0, FALSE,FALSE), tlbl->key+100); + emitcode ("", "%05d$:", tlbl->key+100); + outBitC (IC_RESULT(ic)); + goto release; + } size = AOP_SIZE (IC_RESULT (ic)); while (size--) @@ -8469,7 +8473,6 @@ genCast (iCode * ic) aopOp (result, ic, FALSE); /* if the result is a bit */ - // if (AOP_TYPE (result) == AOP_CRY /* works only for true symbols */ if (IS_BITVAR(OP_SYMBOL(result)->type)) { /* if the right size is a literal then