summaryrefslogtreecommitdiff
path: root/src/z80/gen.c
diff options
context:
space:
mode:
authorspth <spth@4a8a32a2-be11-0410-ad9d-d568d2c75423>2025-08-09 17:46:46 +0000
committerspth <spth@4a8a32a2-be11-0410-ad9d-d568d2c75423>2025-08-09 17:46:46 +0000
commit794e2da59aef7afbc0afea4d932a2505a5a93398 (patch)
tree8d9a90126f0ce436c46e131a6bf040e985a76ca8 /src/z80/gen.c
parent77d01a34189c4c40d8f46261b61052bef30263c1 (diff)
Fix another aspect of bug #3852. Fix bug #3278.HEADgit-svn/mastergit-svn/HEADmaster
git-svn-id: http://svn.code.sourceforge.net/p/sdcc/code/trunk/sdcc@15573 4a8a32a2-be11-0410-ad9d-d568d2c75423
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);
}