projects
/
fw
/
sdcc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* src/z80/gen.c (genCmpGt, genCmpLt): fixed bug 2094505
[fw/sdcc]
/
src
/
z80
/
gen.c
diff --git
a/src/z80/gen.c
b/src/z80/gen.c
index 4d9d0ffbd471438b67ae36a3f074a399e85eb99d..226434d2490e25db7265cadf840668edbe339691 100644
(file)
--- a/
src/z80/gen.c
+++ b/
src/z80/gen.c
@@
-396,15
+396,15
@@
static void
_vemit2 (const char *szFormat, va_list ap)
{
struct dbuf_s dbuf;
_vemit2 (const char *szFormat, va_list ap)
{
struct dbuf_s dbuf;
- c
onst c
har *buffer;
+ char *buffer;
dbuf_init(&dbuf, INITIAL_INLINEASM);
dbuf_tvprintf (&dbuf, szFormat, ap);
dbuf_init(&dbuf, INITIAL_INLINEASM);
dbuf_tvprintf (&dbuf, szFormat, ap);
- buffer = dbuf_c_str(&dbuf);
+ buffer =
(char *)
dbuf_c_str(&dbuf);
- _tidyUp (
(char *)
buffer);
+ _tidyUp (buffer);
_G.lines.current = (_G.lines.current ?
connectLine (_G.lines.current, _newLineNode (buffer)) :
(_G.lines.head = _newLineNode (buffer)));
_G.lines.current = (_G.lines.current ?
connectLine (_G.lines.current, _newLineNode (buffer)) :
(_G.lines.head = _newLineNode (buffer)));
@@
-1819,11
+1819,9
@@
aopGet (asmop * aop, int offset, bool bit16)
case AOP_PAIRPTR:
setupPair (aop->aopu.aop_pairId, aop, offset);
if (aop->aopu.aop_pairId==PAIR_IX)
case AOP_PAIRPTR:
setupPair (aop->aopu.aop_pairId, aop, offset);
if (aop->aopu.aop_pairId==PAIR_IX)
- SNPRINTF (buffer, sizeof(buffer),
- "!*ixx", 0);
+ tsprintf (buffer, sizeof(buffer), "!*ixx", offset);
else if (aop->aopu.aop_pairId==PAIR_IY)
else if (aop->aopu.aop_pairId==PAIR_IY)
- SNPRINTF (buffer, sizeof(buffer),
- "!*iyx", 0);
+ tsprintf (buffer, sizeof(buffer), "!*iyx", offset);
else
SNPRINTF (buffer, sizeof(buffer),
"(%s)", _pairs[aop->aopu.aop_pairId].name);
else
SNPRINTF (buffer, sizeof(buffer),
"(%s)", _pairs[aop->aopu.aop_pairId].name);
@@
-4789,13
+4787,16
@@
genCmpGt (iCode * ic, iCode * ifx)
letype = getSpec (operandType (left));
retype = getSpec (operandType (right));
sign = !(SPEC_USIGN (letype) | SPEC_USIGN (retype));
letype = getSpec (operandType (left));
retype = getSpec (operandType (right));
sign = !(SPEC_USIGN (letype) | SPEC_USIGN (retype));
- /* assign the a
ms
ops */
+ /* assign the a
sm
ops */
aopOp (left, ic, FALSE, FALSE);
aopOp (right, ic, FALSE, FALSE);
aopOp (result, ic, TRUE, FALSE);
aopOp (left, ic, FALSE, FALSE);
aopOp (right, ic, FALSE, FALSE);
aopOp (result, ic, TRUE, FALSE);
+ setupToPreserveCarry (ic);
+
genCmp (right, left, result, ifx, sign);
genCmp (right, left, result, ifx, sign);
+ _G.preserveCarry = FALSE;
freeAsmop (left, NULL, ic);
freeAsmop (right, NULL, ic);
freeAsmop (result, NULL, ic);
freeAsmop (left, NULL, ic);
freeAsmop (right, NULL, ic);
freeAsmop (result, NULL, ic);
@@
-4819,13
+4820,16
@@
genCmpLt (iCode * ic, iCode * ifx)
retype = getSpec (operandType (right));
sign = !(SPEC_USIGN (letype) | SPEC_USIGN (retype));
retype = getSpec (operandType (right));
sign = !(SPEC_USIGN (letype) | SPEC_USIGN (retype));
- /* assign the a
ms
ops */
+ /* assign the a
sm
ops */
aopOp (left, ic, FALSE, FALSE);
aopOp (right, ic, FALSE, FALSE);
aopOp (result, ic, TRUE, FALSE);
aopOp (left, ic, FALSE, FALSE);
aopOp (right, ic, FALSE, FALSE);
aopOp (result, ic, TRUE, FALSE);
+ setupToPreserveCarry (ic);
+
genCmp (left, right, result, ifx, sign);
genCmp (left, right, result, ifx, sign);
+ _G.preserveCarry = FALSE;
freeAsmop (left, NULL, ic);
freeAsmop (right, NULL, ic);
freeAsmop (result, NULL, ic);
freeAsmop (left, NULL, ic);
freeAsmop (right, NULL, ic);
freeAsmop (result, NULL, ic);
@@
-7495,8
+7499,7
@@
genCast (iCode * ic)
else
{
/* we need to extend the sign :{ */
else
{
/* we need to extend the sign :{ */
- const char *l = aopGet (AOP (right), AOP_SIZE (right) - 1,
- FALSE);
+ const char *l = aopGet (AOP (right), AOP_SIZE (right) - 1, FALSE);
_moveA (l);
emit2 ("rla ");
emit2 ("sbc a,a");
_moveA (l);
emit2 ("rla ");
emit2 ("sbc a,a");
@@
-7618,7
+7621,7
@@
genCritical (iCode *ic)
//disable interrupt
emit2 ("!di");
//save P/O flag
//disable interrupt
emit2 ("!di");
//save P/O flag
-
emit2 ("push af"
);
+
_push (PAIR_AF
);
}
}
}
}
@@
-7647,7
+7650,7
@@
genEndCritical (iCode *ic)
else
{
//restore P/O flag
else
{
//restore P/O flag
-
emit2 ("pop af"
);
+
_pop (PAIR_AF
);
//parity odd <==> P/O=0 <==> interrupt enable flag IFF2 was 0 <==>
//don't enable interrupts as they were off before
emit2 ("jp PO,!tlabel", tlbl->key + 100);
//parity odd <==> P/O=0 <==> interrupt enable flag IFF2 was 0 <==>
//don't enable interrupts as they were off before
emit2 ("jp PO,!tlabel", tlbl->key + 100);