We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--- ../Fuzix-Compiler-Kit/be-codegen-6800.c 2024-11-13 00:32:04 +++ be-codegen-6800.c 2024-11-16 21:25:36 @@ -1350,15 +1416,17 @@ } return 0; case T_PLUSEQ: - if (s == 1 && memop_const(n, "inc", nr, 2)) + v = r->value; + if (s == 1 && v<2+optsize && memop_const(n, "inc", nr, 2)) return 1; - if (s == 2 && add_to_node(n, 1, 1)) + if (s <= 2 && add_to_node(n, 1, 1)) return 1; return do_xeqop(n, "xpluseq"); case T_MINUSEQ: - if (s == 1 && memop_const(n, "dec", nr, 2)) + v = r->value; + if (s == 1 && v<2+optsize && memop_const(n, "dec", nr, 2)) return 1; - if (s == 2 && add_to_node(n, -1, 1)) + if (s <= 2 && add_to_node(n, -1, 1)) return 1; return do_xeqop(n, "xminuseq"); case T_PLUSPLUS:
test program:
int sub(unsigned char x,unsigned char y) { x += 10; y -= 10; return x+y; } int main(int argc, char **argv) { unsigned char x,y; x = 100; y = 50; if (sub(x,y)!=150) return 1; return 0; }
before
_sub: ;:rewritten: ;T_PLUSEQ v0 t8 f6 NORETURN, UCHAR ; T_ARGUMENT v0 t9 f1 UCHAR x ; T_CONSTANT va t8 f900 BYTETAIL, UCHAR ;make local ptr off 2, rlim 252 noff 2 tsx inc 2,x inc 2,x inc 2,x inc 2,x inc 2,x inc 2,x inc 2,x inc 2,x inc 2,x inc 2,x ; ;:rewritten: ;T_MINUSEQ v0 t8 f6 NORETURN, UCHAR ; T_ARGUMENT v1 t9 f1 UCHAR y ; T_CONSTANT va t8 f900 BYTETAIL, UCHAR ;make local ptr off 3, rlim 252 noff 3 dec 3,x dec 3,x dec 3,x dec 3,x dec 3,x dec 3,x dec 3,x dec 3,x dec 3,x dec 3,x
after
_sub: ;:rewritten: ;T_PLUSEQ v0 t8 f6 NORETURN, UCHAR ; T_ARGUMENT v0 t9 f1 UCHAR x ; T_CONSTANT va t8 f900 BYTETAIL, UCHAR ;make local ptr off 2, rlim 252 noff 2 tsx ldb 2,x addb #10 stb 2,x ; ;:rewritten: ;T_MINUSEQ v0 t8 f6 NORETURN, UCHAR ; T_ARGUMENT v1 t9 f1 UCHAR y ; T_CONSTANT va t8 f900 BYTETAIL, UCHAR ;make local ptr off 3, rlim 252 noff 3 ldb 3,x addb #246 stb 3,x
The text was updated successfully, but these errors were encountered:
No branches or pull requests
test program:
before
after
The text was updated successfully, but these errors were encountered: