git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@5424
4a8a32a2-be11-0410-ad9d-
d568d2c75423
+2009-04-03 Philipp Klaus Krause <pkk AT spth.de>
+
+ * src/z80/gen.c:
+ Fixed bugs #2728224, #2728218.
+ src/z80/peeph-z80.def:
+ Workaround for bug #2728445.
+ support/regression/tests/memory.c:
+ Added test for memcmp().
+
2009-04-03 Philipp Klaus Krause <pkk AT spth.de>
* device/lib/z80/mul.s,
2009-04-03 Philipp Klaus Krause <pkk AT spth.de>
* device/lib/z80/mul.s,
- /* Swapping register contents within register pair */
- if(!strcmp(aopGet (aop, offset, FALSE), _pairs[pairId].h))
+ /* Operand resides (partially) in the pair */
+ if(!strcmp(aopGet (aop, offset + 1, FALSE), _pairs[pairId].l))
- emit2 ("ld a,%s",aopGet (aop, offset + 1, FALSE));
+ emit2 ("ld a,%s", aopGet (aop, offset + 1, FALSE));
emit2 ("ld %s,%s", _pairs[pairId].l, aopGet (aop, offset, FALSE));
emit2 ("ld %s,a", _pairs[pairId].h);
}
emit2 ("ld %s,%s", _pairs[pairId].l, aopGet (aop, offset, FALSE));
emit2 ("ld %s,a", _pairs[pairId].h);
}
- emit2 ("sub %s", aopGet (AOP (right), offset, FALSE));
+ emit2 ("sub a,%s", aopGet (AOP (right), offset, FALSE));
emit2 ("jp NZ,!tlabel", lbl->key + 100);
}
offset++;
emit2 ("jp NZ,!tlabel", lbl->key + 100);
}
offset++;
emit2 ("; direct compare");
_emitMove (_pairs[pair].l, aopGet (AOP (left), offset, FALSE));
_moveA (aopGet (AOP (right), offset, FALSE));
emit2 ("; direct compare");
_emitMove (_pairs[pair].l, aopGet (AOP (left), offset, FALSE));
_moveA (aopGet (AOP (right), offset, FALSE));
- emit2 ("sub %s", _pairs[pair].l);
+ emit2 ("sub a,%s", _pairs[pair].l);
emit2 ("!shortjp NZ,!tlabel", lbl->key + 100);
offset++;
}
emit2 ("!shortjp NZ,!tlabel", lbl->key + 100);
offset++;
}
{
/* signed bitfield */
symbol *tlbl = newiTempLabel (NULL);
{
/* signed bitfield */
symbol *tlbl = newiTempLabel (NULL);
-
- emit2 ("bit %d,a", blen - 1);
+ emit2 ("bit %d,a", blen - 1 - 8);
emit2 ("jp Z,!tlabel", tlbl->key + 100);
emit2 ("jp Z,!tlabel", tlbl->key + 100);
- emit2 ("or a,!immedbyte", (unsigned char) (0xff << blen));
+ emit2 ("or a,!immedbyte", (unsigned char) (0xff << (blen - 8)));
emitLabel (tlbl->key + 100);
}
emit2 ("ld h,a");
emitLabel (tlbl->key + 100);
}
emit2 ("ld h,a");
ld b, %2 (%3)
} if notVolatile(%1), notUsed(%1)
ld b, %2 (%3)
} if notVolatile(%1), notUsed(%1)
-replace restart {
- ld %1,a
- ld %2,%3
- ld %4,%1
-} by {
- ; peephole 0t loaded %4 from a instead of going through %1.
- ld %1,a
- ld %2,%3
- ld %4,a
-} if notVolatile(%1), operandsNotRelated(%1 %3), operandsNotRelated(%1 %2)
+// Bug #2728445
+//replace restart {
+// ld %1,a
+// ld %2,%3
+// ld %4,%1
+//} by {
+// ; peephole 0t loaded %4 from a instead of going through %1.
+// ld %1,a
+// ld %2,%3
+// ld %4,a
+//} if notVolatile(%1), operandsNotRelated(%1 %3), operandsNotRelated(%1 %2)
replace restart {
ld %1,a
replace restart {
ld %1,a
ASSERT(destination[2] == source[2]);
ASSERT(destination[3] == 23);
ASSERT(destination[2] == source[2]);
ASSERT(destination[3] == 23);
+ /* Test memcmp() */
+ memcpy(destination, source, 4);
+ ASSERT(memcmp(destination, source, 4) == 0);
+
/* Test memmove() */
memcpy(destination, source, 4);
memmove(destination, destination + 1, 3);
/* Test memmove() */
memcpy(destination, source, 4);
memmove(destination, destination + 1, 3);