1
0
mirror of https://github.com/cc65/cc65.git synced 2024-07-22 12:29:06 +00:00

Added SBC optimizations suggested by Piotr Fusik

git-svn-id: svn://svn.cc65.org/cc65/trunk@1123 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2001-11-17 11:31:57 +00:00
parent b8facd7f1e
commit 2de4a26251

View File

@ -1749,10 +1749,9 @@ void g_subeqstatic (unsigned flags, unsigned long label, long offs,
AddCodeLine ("sta %s", lbuf);
}
} else {
AddCodeLine ("eor #$FF");
AddCodeLine ("sec");
AddCodeLine ("sta tmp1");
AddCodeLine ("lda %s", lbuf);
AddCodeLine ("sbc tmp1");
AddCodeLine ("adc %s", lbuf);
AddCodeLine ("sta %s", lbuf);
}
if ((flags & CF_UNSIGNED) == 0) {
@ -1785,13 +1784,12 @@ void g_subeqstatic (unsigned flags, unsigned long label, long offs,
AddCodeLine ("lda %s", lbuf);
}
} else {
AddCodeLine ("sta tmp1");
AddCodeLine ("lda %s", lbuf);
AddCodeLine ("sbc tmp1");
AddCodeLine ("eor #$FF");
AddCodeLine ("adc %s", lbuf);
AddCodeLine ("sta %s", lbuf);
AddCodeLine ("stx tmp1");
AddCodeLine ("lda %s+1", lbuf);
AddCodeLine ("sbc tmp1");
AddCodeLine ("txa");
AddCodeLine ("eor #$FF");
AddCodeLine ("adc %s+1", lbuf);
AddCodeLine ("sta %s+1", lbuf);
AddCodeLine ("tax");
AddCodeLine ("lda %s", lbuf);
@ -1845,9 +1843,8 @@ void g_subeqlocal (unsigned flags, int offs, unsigned long val)
AddCodeLine ("lda (sp),y");
AddCodeLine ("sbc #$%02X", (unsigned char)val);
} else {
AddCodeLine ("sta tmp1");
AddCodeLine ("lda (sp),y");
AddCodeLine ("sbc tmp1");
AddCodeLine ("eor #$FF");
AddCodeLine ("adc (sp),y");
}
AddCodeLine ("sta (sp),y");
if ((flags & CF_UNSIGNED) == 0) {