Fuzix-Compiler-Kit icon indicating copy to clipboard operation
Fuzix-Compiler-Kit copied to clipboard

support6800/__addxconst.s is slow, so use inx/dex instead.

Open zu2 opened this issue 4 months ago • 1 comments

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);
+				}

zu2 avatar Oct 11 '24 02:10 zu2