if condition == CARRY)
* (genCmp): adapted to new genSkipc semantics
* src/pic16/genutils.c (pic6_genCmp_special): removed side effect
on rIfx (genCmp was broken)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3708
4a8a32a2-be11-0410-ad9d-
d568d2c75423
+2005-03-26 Raphael Neider <rneider AT web.de>
+
+ * src/pic16/gen.c (genSkipc): fixed semantics (execute branch
+ if condition == CARRY)
+ * (genCmp): adapted to new genSkipc semantics
+ * src/pic16/genutils.c (pic6_genCmp_special): removed side effect
+ on rIfx (genCmp was broken)
+
2005-03-26 Erik Petrich <epetrich AT ivorytower.norman.ok.us>
* src/SDCCmain.c (setDefaultOptions, optionsTable[], parseCmdLine),
return;
if(rifx->condition)
- emitSKPC;
- else
emitSKPNC;
+ else
+ emitSKPC;
pic16_emitpcode(POC_GOTO, pic16_popGetLabel(rifx->lbl->key));
rifx->generated = 1;
} // if
// This fails for lit = 0xFF (unsigned) AND lit = 0x7F (signed),
- // that's we handled it above.
+ // that's why we handled it above.
lit++;
dummy = left;
* now CARRY contains the result of the comparison: *
* SUBWF sets CARRY iff *
* F-W >= 0 <==> F >= W <==> !(F < W) *
- * (F=left, W=right)
+ * (F=left, W=right) *
****************************************************/
if (performedLt) {
} // if (result)
// perform conditional jump
- // genSkipc branches to rifx->label if (rifx->condition != CARRY)
if (ifx) {
//DEBUGpc ("generate control flow");
- rIfx.condition ^= 1;
genSkipc (&rIfx);
ifx->generated = 1;
} // if
int offs=0;
symbol *tmplbl;
unsigned long lit;
- int op, cmp_op=0;
+ int op, cmp_op=0, cond_pre;
FENTRY;
if(!(pic16_options.opt_flags & OF_OPTIMIZE_CMP))return 0;
size = max(AOP_SIZE(left), AOP_SIZE(right));
+
+ cond_pre = rIfx->condition; // must restore old value on return with 0!!!
if(!isAOP_REGlike(left)) {
operand *dummy;
} /* */
+ rIfx->condition = cond_pre;
return 0;
}