[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] MiNTLib for ColdFire



Andreas Schwab wrote:
> Just use addql everywhere, it's absolutely the same.

So here is a patch for replacing all addq.w to address register by addq.l.
There is no performance or size loss for current targets, and it is ColdFire compatible.

Alan, please commit.
I will send an updated ColdFire patch after this one.

--
Vincent Rivière
diff -aurN -x CVS mintlib.orig/ChangeLog mintlib/ChangeLog
--- mintlib.orig/ChangeLog	2009-05-17 18:13:05.750000000 +0200
+++ mintlib/ChangeLog	2009-05-18 18:44:52.328125000 +0200
@@ -1,3 +1,10 @@
+2009-05-18 Monday 18:44  Vincent Riviere <vincent.riviere@freesbee.fr>
+	* mint/mintbind.h, mint/osbind.h, mintlib/setjmp.S, syscall/traps.c
+
+	Replaced "addqw" to address register by "addql".
+	This instruction has the same behaviour, size and speed,
+	and is ColdFire compatible.
+
 2009-05-14 Thursday 23:37  Vincent Riviere <vincent.riviere@freesbee.fr>
 
 	* include/macros.h, include/bits/byteswap.h, include/bits/math-68881.h,
diff -aurN -x CVS mintlib.orig/include/mint/mintbind.h mintlib/include/mint/mintbind.h
--- mintlib.orig/include/mint/mintbind.h	2009-05-17 18:13:06.265625000 +0200
+++ mintlib/include/mint/mintbind.h	2009-05-18 18:33:07.562500000 +0200
@@ -77,7 +77,7 @@
 		"movw	%2,sp@-\n\t"					\
 		"movw	%1,sp@-\n\t"					\
 		"trap	#1\n\t"						\
-		"addqw	#8,sp"						\
+		"addql	#8,sp"						\
 	: "=r"(retvalue)			/* outputs */		\
 	: "g"(n), "r"(_a), "r"(_b), "r"(_c)     /* inputs  */		\
 	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2"    /* clobbered regs */	\
@@ -123,7 +123,7 @@
 		"movw	%2,sp@-\n\t"					\
 		"movw	%1,sp@-\n\t"					\
 		"trap	#1\n\t"						\
-		"addqw	#8,sp"						\
+		"addql	#8,sp"						\
 	: "=r"(retvalue)			/* outputs */		\
 	: "g"(n), "r"(_a), "r"(_b)		/* inputs  */		\
 	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2"    /* clobbered regs */	\
diff -aurN -x CVS mintlib.orig/include/mint/osbind.h mintlib/include/mint/osbind.h
--- mintlib.orig/include/mint/osbind.h	2009-05-17 18:13:06.265625000 +0200
+++ mintlib/include/mint/osbind.h	2009-05-18 18:33:43.468750000 +0200
@@ -140,7 +140,7 @@
 	(								\
 		"movw	%1,sp@-\n\t"					\
 		"trap	#1\n\t"						\
-		"addqw	#2,sp\n\t"					\
+		"addql	#2,sp\n\t"					\
 	: "=r"(retvalue)			/* outputs */		\
 	: "g"(n)				/* inputs  */		\
 	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2"    /* clobbered regs */	\
@@ -160,7 +160,7 @@
 		"movw	%2,sp@-\n\t"					\
 		"movw	%1,sp@-\n\t"					\
 		"trap	#1\n\t"						\
-		"addqw	#4,sp"						\
+		"addql	#4,sp"						\
 	: "=r"(retvalue)			/* outputs */		\
 	: "g"(n), "r"(_a)			/* inputs  */		\
 	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2"    /* clobbered regs */	\
@@ -180,7 +180,7 @@
 		"movl	%2,sp@-\n\t"					\
 		"movw	%1,sp@-\n\t"					\
 		"trap	#1\n\t"						\
-		"addqw	#6,sp"						\
+		"addql	#6,sp"						\
 	: "=r"(retvalue)			/* outputs */		\
 	: "g"(n), "r"(_a)			/* inputs  */		\
 	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2"    /* clobbered regs */	\
@@ -202,7 +202,7 @@
 		"movl	%2,sp@-\n\t"					\
 		"movw	%1,sp@-\n\t"					\
 		"trap	#1\n\t"						\
-		"addqw	#8,sp"						\
+		"addql	#8,sp"						\
 	: "=r"(retvalue)			/* outputs */		\
 	: "g"(n), "r"(_a), "r"(_b)		/* inputs  */		\
 	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2"    /* clobbered regs */	\
@@ -297,7 +297,7 @@
 		"movw	%2,sp@-\n\t"					\
 		"movw	%1,sp@-\n\t"					\
 		"trap	#1\n\t"						\
-		"addqw	#6,sp"						\
+		"addql	#6,sp"						\
 	: "=r"(retvalue)			/* outputs */		\
 	: "g"(n), "r"(_a), "r"(_b)		/* inputs  */		\
 	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2"    /* clobbered regs */	\
@@ -389,7 +389,7 @@
 		"movl	%2,sp@-\n\t"					\
 		"movw	%1,sp@-\n\t"					\
 		"trap	#13\n\t"					\
-		"addqw	#6,sp"						\
+		"addql	#6,sp"						\
 	: "=r"(retvalue)			/* outputs */		\
 	: "g"(n), "r"(_a)			/* inputs  */		\
 	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2"    /* clobbered regs */	\
@@ -407,7 +407,7 @@
 	(								\
 		"movw	%1,sp@-\n\t"					\
 		"trap	#13\n\t"					\
-		"addqw	#2,sp"						\
+		"addql	#2,sp"						\
 	: "=r"(retvalue)			/* outputs */		\
 	: "g"(n)				/* inputs  */		\
 	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2"    /* clobbered regs */	\
@@ -427,7 +427,7 @@
 		"movw	%2,sp@-\n\t"					\
 		"movw	%1,sp@-\n\t"					\
 		"trap	#13\n\t"					\
-		"addqw	#4,sp"						\
+		"addql	#4,sp"						\
 	: "=r"(retvalue)			/* outputs */		\
 	: "g"(n), "r"(_a)			/* inputs  */		\
 	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2"    /* clobbered regs */	\
@@ -449,7 +449,7 @@
 		"movw	%2,sp@-\n\t"					\
 		"movw	%1,sp@-\n\t"					\
 		"trap	#13\n\t"					\
-		"addqw	#6,sp"						\
+		"addql	#6,sp"						\
 	: "=r"(retvalue)			/* outputs */		\
 	: "g"(n), "r"(_a), "r"(_b)		/* inputs  */		\
 	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2"    /* clobbered regs */	\
@@ -499,7 +499,7 @@
 		"movw	%2,sp@-\n\t"					\
 		"movw	%1,sp@-\n\t"					\
 		"trap	#13\n\t"					\
-		"addqw	#8,sp"						\
+		"addql	#8,sp"						\
 	: "=r"(retvalue)			/* outputs */		\
 	: "g"(n), "r"(_a), "r"(_b)		/* inputs  */		\
 	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2"    /* clobbered regs */	\
@@ -521,7 +521,7 @@
 		"movw	%2,sp@-\n\t"					\
 		"movw	%1,sp@-\n\t"					\
 		"trap	#14\n\t"					\
-		"addqw	#8,sp"						\
+		"addql	#8,sp"						\
 	: "=r"(retvalue)			/* outputs */		\
 	: "g"(n), "r"(_a), "r"(_b)              /* inputs  */		\
 	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2"    /* clobbered regs */	\
@@ -565,7 +565,7 @@
 		"movw	%2,sp@-\n\t"					\
 		"movw	%1,sp@-\n\t"					\
 		"trap	#14\n\t"					\
-		"addqw	#4,sp"						\
+		"addql	#4,sp"						\
 	: "=r"(retvalue)			/* outputs */		\
 	: "g"(n), "r"(_a)			/* inputs  */		\
 	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2"    /* clobbered regs */	\
@@ -583,7 +583,7 @@
 	(								\
 		"movw	%1,sp@-\n\t"					\
 		"trap	#14\n\t"					\
-		"addqw	#2,sp"						\
+		"addql	#2,sp"						\
 	: "=r"(retvalue)			/* outputs */		\
 	: "g"(n)				/* inputs  */		\
 	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2"    /* clobbered regs */	\
@@ -627,7 +627,7 @@
 		"movl	%2,sp@-\n\t"					\
 		"movw	%1,sp@-\n\t"					\
 		"trap	#14\n\t"					\
-		"addqw	#6,sp"						\
+		"addql	#6,sp"						\
 	: "=r"(retvalue)			/* outputs */		\
 	: "g"(n), "r"(_a)			/* inputs  */		\
 	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2"    /* clobbered regs */	\
@@ -649,7 +649,7 @@
 		"movw	%2,sp@-\n\t"					\
 		"movw	%1,sp@-\n\t"					\
 		"trap	#14\n\t"					\
-		"addqw	#6,sp"						\
+		"addql	#6,sp"						\
 	: "=r"(retvalue)			/* outputs */		\
 	: "g"(n), "r"(_a), "r"(_b)		/* inputs  */		\
 	: __CLOBBER_RETURN("d0") "d1", "d2", "a0", "a1", "a2"    /* clobbered regs */	\
diff -aurN -x CVS mintlib.orig/mintlib/setjmp.S mintlib/mintlib/setjmp.S
--- mintlib.orig/mintlib/setjmp.S	2000-10-12 12:56:41.000000000 +0200
+++ mintlib/mintlib/setjmp.S	2009-05-18 18:36:54.812500000 +0200
@@ -37,7 +37,7 @@
 	clrl	sp@-			| add no signals to sigmask
 	movew	#0x116, sp@-		| Psigblock() system call
 	trap	#1			|
-	addqw	#6, sp
+	addql	#6, sp
 	
 	movel	sp@+, a0		| restore register a0
 	
@@ -68,7 +68,7 @@
 	jeq	NOMINT			| no -- do not call sigreturn
 	movew	#0x11a, sp@-		| Psigreturn() system call
 	trap	#1			| (ignored if not in a sig handler)
-	addqw	#2, sp
+	addql	#2, sp
 NOMINT:
 	movel	sp@(4),a0		| address of jmp_buf[]
 	movel	a0@(52),d0		| want to restore sigmask?
@@ -87,7 +87,7 @@
 	movel	d0, sp@-		| restore signal mask
 	movew	#0x117, sp@-		| Psigsetmask() system call
 	trap	#1			|
-	addqw	#6, sp
+	addql	#6, sp
 	
 	movel	sp@+, a0		| restore register a0
 	
diff -aurN -x CVS mintlib.orig/syscall/traps.c mintlib/syscall/traps.c
--- mintlib.orig/syscall/traps.c	2009-05-17 18:13:06.875000000 +0200
+++ mintlib/syscall/traps.c	2009-05-18 18:37:42.703125000 +0200
@@ -146,7 +146,7 @@
 	fprintf(out, "\t\t\"movw\t%%1,sp@-\\n\\t\"\n");
 	fprintf(out, "\t\t\"trap\t#1\\n\\t\"\n");
 	if (size <= 8)
-		fprintf(out, "\t\t\"addqw\t#%i,sp\"\n", size);
+		fprintf(out, "\t\t\"addql\t#%i,sp\"\n", size);
 	else
 		fprintf(out, "\t\t\"lea\tsp@(%i),sp\"\n", size);