summaryrefslogtreecommitdiff
path: root/src/z80/gen.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/z80/gen.c')
-rw-r--r--src/z80/gen.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/z80/gen.c b/src/z80/gen.c
index 188357e2c..36d63ab29 100644
--- a/src/z80/gen.c
+++ b/src/z80/gen.c
@@ -7938,7 +7938,8 @@ setupToPreserveCarry (asmop *result, asmop *left, asmop *right)
}
else if (couldDestroyCarry (result))
{
- shiftIntoPair (PAIR_HL, result);
+ if (!requiresHL (left))
+ shiftIntoPair (PAIR_HL, result);
}
}
}
@@ -8331,7 +8332,7 @@ genPlus (iCode * ic)
if (couldDestroyCarry (IC_RESULT (ic)->aop) &&
(IC_RESULT (ic)->aop == leftop || IC_RESULT (ic)->aop == rightop))
shiftIntoPair (PAIR_HL, IC_RESULT (ic)->aop);
- else if (couldDestroyCarry (rightop))
+ else if (couldDestroyCarry (rightop) && !requiresHL (leftop))
shiftIntoPair (PAIR_HL, rightop);
}