From: MaartenBrock Date: Fri, 29 Dec 2006 09:02:08 +0000 (+0000) Subject: * src/z80/gen.c (assignResultValue): fixed bug when registers overlap, X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=fa8a72c853839f425c4563cd712d8c9e7522cda2;p=fw%2Fsdcc * src/z80/gen.c (assignResultValue): fixed bug when registers overlap, with this z80 passes printf float test when enabled * support/regression/tests/bug1057979.c: typo disabled ds390 float test git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4535 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index 19b104f6..06218932 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-12-21 Maarten Brock + + * src/z80/gen.c (assignResultValue): fixed bug when registers overlap, + with this z80 passes printf float test when enabled + * support/regression/tests/bug1057979.c: typo disabled ds390 float test + 2006-12-28 Borut Razem * support/cpp2/config.in, support/cpp2/configure.in, diff --git a/src/z80/gen.c b/src/z80/gen.c index 98d02c80..dfa20d92 100644 --- a/src/z80/gen.c +++ b/src/z80/gen.c @@ -128,9 +128,9 @@ enum }; static char *_z80_return[] = -{"l", "h", "e", "d"}; + {"l", "h", "e", "d"}; static char *_gbz80_return[] = -{"e", "d", "l", "h"}; + {"e", "d", "l", "h"}; static char *_fReceive[] = { "c", "b", "e", "d" }; @@ -2515,6 +2515,16 @@ assignResultValue (operand * oper) } else { + if ((AOP_TYPE (oper) == AOP_REG) && (AOP_SIZE (oper) == 4) && + !strcmp (AOP (oper)->aopu.aop_reg[size-1]->name, _fReturn[size-2])) + { + size--; + _emitMove ("a", _fReturn[size-1]); + _emitMove (_fReturn[size-1], _fReturn[size]); + _emitMove (_fReturn[size], "a"); + aopPut (AOP (oper), _fReturn[size], size-1); + size--; + } while (size--) { aopPut (AOP (oper), _fReturn[size], size); @@ -8136,7 +8146,7 @@ genZ80Code (iCode * lic) spilt live range, if there is an ifx statement following this pop then the if statement might be using some of the registers being popped which - would destory the contents of the register so + would destroy the contents of the register so we need to check for this condition and handle it */ if (ic->next && ic->next->op == IFX && diff --git a/support/regression/tests/bug1057979.c b/support/regression/tests/bug1057979.c index 392b0ccd..982416bb 100644 --- a/support/regression/tests/bug1057979.c +++ b/support/regression/tests/bug1057979.c @@ -53,7 +53,7 @@ test_sprintf(void) ASSERT( 0 == strcmp( s, "ab " ) ); #endif -#if defined(SDCC__ds390) || defined(PORT_HOST) +#if defined(SDCC_ds390) || defined(PORT_HOST) //and from bug 1358192 sprintf( s, "%f", 10.1 ); LOG((s));