* src/z80/gen.c (assignResultValue): fixed bug when registers overlap,
authorMaartenBrock <MaartenBrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 29 Dec 2006 09:02:08 +0000 (09:02 +0000)
committerMaartenBrock <MaartenBrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 29 Dec 2006 09:02:08 +0000 (09:02 +0000)
  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

ChangeLog
src/z80/gen.c
support/regression/tests/bug1057979.c

index 19b104f6668c1b5f6d4c210608485e78d3198a3f..06218932215e41fa24f9e6c49c9a14d36f939943 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-12-21 Maarten Brock <sourceforge.brock AT dse.nl>
+
+       * 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 <borut.razem AT siol.net>
 
        * support/cpp2/config.in, support/cpp2/configure.in,
index 98d02c801e98b6ab36a4c256bfea41597671d781..dfa20d922bd2dd951da436fc44a947299a225a13 100644 (file)
@@ -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 &&
index 392b0ccd681b0e18a7419b3df16671a42757e925..982416bbcb05d99841ac20e2da76a817e008a509 100644 (file)
@@ -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));