From 3456dfdd9cd3a27e8b59645bf8f4bfb01515481d Mon Sep 17 00:00:00 2001 From: sdattalo Date: Sat, 27 Jul 2002 14:50:55 +0000 Subject: [PATCH] varA = (varB > CONSTANT); Was not compiling correctly. git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2047 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/pic/gen.c | 26 +++++++++++++++++++++++--- src/pic/pcode.c | 2 +- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/pic/gen.c b/src/pic/gen.c index 78a8fcc0..0df7a930 100644 --- a/src/pic/gen.c +++ b/src/pic/gen.c @@ -3763,6 +3763,8 @@ static void genCmp (operand *left,operand *right, truelbl = newiTempLabel(NULL); size = max(AOP_SIZE(left),AOP_SIZE(right)); + DEBUGpic14_AopType(__LINE__,left,right,result); + #define _swapp /* if literal is on the right then swap with left */ @@ -4040,7 +4042,8 @@ static void genCmp (operand *left,operand *right, } -#endif +#endif // _swapp + if(AOP_TYPE(left) == AOP_LIT) { //symbol *lbl = newiTempLabel(NULL); @@ -4116,12 +4119,18 @@ static void genCmp (operand *left,operand *right, emitpcode(POC_SUBFW, popGet(AOP(right),0)); DEBUGpic14_emitcode ("; ***","%s %d",__FUNCTION__,__LINE__); rFalseIfx.condition ^= 1; - genSkipc(&rFalseIfx); + if (AOP_TYPE(result) == AOP_CRY) + genSkipc(&rFalseIfx); + else { + emitpcode(POC_CLRF, popGet(AOP(result),0)); + emitpcode(POC_RLF, popGet(AOP(result),0)); + } break; } } if(ifx) ifx->generated = 1; + //goto check_carry; return; } else { @@ -4371,15 +4380,26 @@ static void genCmp (operand *left,operand *right, emitpLabel(lbl->key); DEBUGpic14_emitcode ("; ***","%s %d",__FUNCTION__,__LINE__); - genSkipc(&rFalseIfx); + if ((AOP_TYPE(result) == AOP_CRY && AOP_SIZE(result)) || + (AOP_TYPE(result) == AOP_REG)) { + emitpcode(POC_CLRF, popGet(AOP(result),0)); + emitpcode(POC_RLF, popGet(AOP(result),0)); + } else { + genSkipc(&rFalseIfx); + } + //genSkipc(&rFalseIfx); if(ifx) ifx->generated = 1; + return; } + check_carry: if (AOP_TYPE(result) == AOP_CRY && AOP_SIZE(result)) { + DEBUGpic14_emitcode ("; ***","%s %d",__FUNCTION__,__LINE__); pic14_outBitC(result); } else { + DEBUGpic14_emitcode ("; ***","%s %d",__FUNCTION__,__LINE__); /* if the result is used in the next ifx conditional branch then generate code a little differently */ diff --git a/src/pic/pcode.c b/src/pic/pcode.c index 3dcb4748..808aeaaa 100644 --- a/src/pic/pcode.c +++ b/src/pic/pcode.c @@ -75,7 +75,7 @@ static pBlock *pb_dead_pcodes = NULL; /* Hardcoded flags to change the behavior of the PIC port */ static int peepOptimizing = 1; /* run the peephole optimizer if nonzero */ static int functionInlining = 1; /* inline functions if nonzero */ -int debug_verbose = 0; /* Set true to inundate .asm file */ +int debug_verbose = 1; /* Set true to inundate .asm file */ static int GpCodeSequenceNumber = 1; int GpcFlowSeq = 1; -- 2.30.2