From 949f4359deee702c90a68b41704c844df9d57033 Mon Sep 17 00:00:00 2001 From: MaartenBrock Date: Sun, 11 Feb 2007 12:30:15 +0000 Subject: [PATCH] * src/hc08/gen.c (genSwap): fix swap regression test git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4629 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 4 ++++ src/hc08/gen.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 82008415..0f65d7a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-02-11 Maarten Brock + + * src/hc08/gen.c (genSwap): fix swap regression test + 2007-02-10 Borut Razem * src/SDCCsymt.c: fixed bug #1159134: invalid duplicate declarations diff --git a/src/hc08/gen.c b/src/hc08/gen.c index 8c93b380..f7f9be18 100644 --- a/src/hc08/gen.c +++ b/src/hc08/gen.c @@ -1621,6 +1621,7 @@ operandsEqu (operand * op1, operand * op2) if (sym1 == sym2) return TRUE; + /* if they have the same rname */ if (sym1->rname[0] && sym2->rname[0] && strcmp (sym1->rname, sym2->rname) == 0) return TRUE; @@ -5702,7 +5703,7 @@ genSwap (iCode * ic) hc08_freeReg (hc08_reg_a); break; case 2: /* swap bytes in a word */ - if (operandsEqu (left, result)) + if (operandsEqu (left, result) || sameRegs (AOP (left), AOP (result))) { loadRegFromAop (hc08_reg_a, AOP (left), 0); hc08_useReg (hc08_reg_a); -- 2.39.5