Fuzix-Compiler-Kit
Fuzix-Compiler-Kit copied to clipboard
support6800/__addxconst.s is slow, so use inx/dex instead.
support6800/__addxconst.s is slow, so use inx/dex instead. It is better to be able to change the number of inx/dex depending on the optimization level.
--- ../Fuzix-Compiler-Kit/be-codegen-6800.c 2024-10-07 15:42:20
+++ be-codegen-6800.c 2024-10-11 12:04:09
@@ -747,8 +801,18 @@
} else {
/* FIXME: merge this into _off versions of
helpers that do the jsr as more compact */
- printf("\tjsr __addxconst\n");
- printf("\t.word %u\n", off);
+ if(off>0 && off<=7){
+ while(off--){
+ printf("\tinx\n");
+ }
+ }else if(off<0 && off>=-7){
+ while(off--){
+ printf("\tdex\n");
+ }
+ }else if(off) {
+ printf("\tjsr __addxconst\n");
+ printf("\t.word %u\n", off);
+ }