if (sym->remat)
{
sym->aop = op->aop = aop = aopForRemat (sym);
- aop->size = getSize (sym->type);
+ aop->size = operandSize (op);
return;
}
/* gencjne - compare and jump if not equal */
/*-----------------------------------------------------------------*/
static void
-gencjne (operand * left, operand * right, symbol * lbl)
+gencjne (operand * left, operand * right, symbol * lbl, bool useCarry)
{
symbol *tlbl = newiTempLabel (NULL);
gencjneshort (left, right, lbl);
- emitcode ("mov", "a,%s", one);
+ if (useCarry)
+ SETC;
+ else
+ MOVA (one);
emitcode ("sjmp", "%05d$", tlbl->key + 100);
emitLabel (lbl);
- emitcode ("clr", "a");
+ if (useCarry)
+ CLRC;
+ else
+ MOVA (zero);
emitLabel (tlbl);
}
}
else
{
- gencjne (left, right, newiTempLabel (NULL));
if (AOP_TYPE (result) == AOP_CRY && AOP_SIZE (result))
{
- aopPut (result, "a", 0);
+ gencjne (left, right, newiTempLabel (NULL), TRUE);
+ aopPut (result, "c", 0);
goto release;
}
+ gencjne (left, right, newiTempLabel (NULL), FALSE);
if (ifx)
{
genIfxJump (ifx, "a", left, right, result);
if (AOP_TYPE (right) == AOP_CRY)
{
// c = bit ^ bit;
- emitcode ("mov", "c,%s", AOP (right)->aopu.aop_dir);
+ if (IS_SYMOP (left) && OP_SYMBOL (left) && OP_SYMBOL (left)->accuse)
+ {// left already is in the carry
+ operand *tmp = right;
+ right = left;
+ left = tmp;
+ }
+ else
+ {
+ emitcode ("mov", "c,%s", AOP (right)->aopu.aop_dir);
+ }
}
else
{
l = aopGet (result, 0, FALSE, TRUE);
l++; //remove #
- size = AOP_SIZE (right);
+ size = AOP_SIZE (result);
while (size--)
{
if (offset)
aopGet (right, offset++, FALSE, FALSE));
}
- freeAsmop (result, NULL, ic, TRUE);
freeAsmop (right, NULL, ic, TRUE);
+ freeAsmop (result, NULL, ic, TRUE);
}
/*-----------------------------------------------------------------*/
}
/* done */
- if (pi) pi->generated = 1;
- freeAsmop (result, NULL, ic, TRUE);
+ if (pi)
+ pi->generated = 1;
freeAsmop (right, NULL, ic, TRUE);
+ freeAsmop (result, NULL, ic, TRUE);
}
/*-----------------------------------------------------------------*/