partial fix for bug #444507
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 26 Jul 2001 14:33:02 +0000 (14:33 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Thu, 26 Jul 2001 14:33:02 +0000 (14:33 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1105 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/ds390/gen.c
src/mcs51/gen.c

index c4bee0dd9d878b2c2bc08286330950555e181a1c..718eb81882cff2536b3b47bf6eead7823f929fb0 100644 (file)
@@ -5349,9 +5349,14 @@ genAnd (iCode * ic, iCode * ifx)
            emitcode ("setb", "c");
          while (sizer--)
            {
-             MOVA (aopGet (AOP (right), offset, FALSE, FALSE, TRUE));
-             emitcode ("anl", "a,%s",
-                       aopGet (AOP (left), offset, FALSE, FALSE, FALSE));
+             if (AOP_TYPE(right)==AOP_REG && AOP_TYPE(left)==AOP_ACC) {
+               emitcode ("anl", "a,%s",
+                         aopGet (AOP (right), offset, FALSE, FALSE, FALSE));
+             } else {
+               MOVA (aopGet (AOP (right), offset, FALSE, FALSE, TRUE));
+               emitcode ("anl", "a,%s",
+                         aopGet (AOP (left), offset, FALSE, FALSE, FALSE));
+             }
              emitcode ("jnz", "%05d$", tlbl->key + 100);
              offset++;
            }
index 47793dc3431020daf3e51932893fdb7be5961cdb..90cb2c0de7658fcbe9fd4f5ae83b22de9c12a354 100644 (file)
@@ -4592,9 +4592,14 @@ genAnd (iCode * ic, iCode * ifx)
            emitcode ("setb", "c");
          while (sizer--)
            {
-             MOVA (aopGet (AOP (right), offset, FALSE, FALSE));
-             emitcode ("anl", "a,%s",
-                       aopGet (AOP (left), offset, FALSE, FALSE));
+             if (AOP_TYPE(right)==AOP_REG && AOP_TYPE(left)==AOP_ACC) {
+               emitcode ("anl", "a,%s",
+                         aopGet (AOP (right), offset, FALSE, FALSE));
+             } else {
+               MOVA (aopGet (AOP (right), offset, FALSE, FALSE));
+               emitcode ("anl", "a,%s",
+                         aopGet (AOP (left), offset, FALSE, FALSE));
+             }
              emitcode ("jnz", "%05d$", tlbl->key + 100);
              offset++;
            }
@@ -4861,9 +4866,14 @@ genOr (iCode * ic, iCode * ifx)
            emitcode ("setb", "c");
          while (sizer--)
            {
-             MOVA (aopGet (AOP (right), offset, FALSE, FALSE));
-             emitcode ("orl", "a,%s",
-                       aopGet (AOP (left), offset, FALSE, FALSE));
+             if (AOP_TYPE(right)==AOP_REG && AOP_TYPE(left)==AOP_ACC) {
+               emitcode ("orl", "a,%s",
+                         aopGet (AOP (right), offset, FALSE, FALSE));
+             } else {
+               MOVA (aopGet (AOP (right), offset, FALSE, FALSE));
+               emitcode ("orl", "a,%s",
+                         aopGet (AOP (left), offset, FALSE, FALSE));
+             }
              emitcode ("jnz", "%05d$", tlbl->key + 100);
              offset++;
            }
@@ -5113,9 +5123,14 @@ genXor (iCode * ic, iCode * ifx)
                }
              else
                {
-                 MOVA (aopGet (AOP (right), offset, FALSE, FALSE));
-                 emitcode ("xrl", "a,%s",
-                           aopGet (AOP (left), offset, FALSE, FALSE));
+                 if (AOP_TYPE(right)==AOP_REG && AOP_TYPE(left)==AOP_ACC) {
+                   emitcode ("xrl", "a,%s",
+                             aopGet (AOP (right), offset, FALSE, FALSE));
+                 } else {
+                   MOVA (aopGet (AOP (right), offset, FALSE, FALSE));
+                   emitcode ("xrl", "a,%s",
+                             aopGet (AOP (left), offset, FALSE, FALSE));
+                 }
                }
              emitcode ("jnz", "%05d$", tlbl->key + 100);
              offset++;