This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] h8300/lib1funcs.asm: Optimize ___udivsi3.


Hi,

Attached is a patch to optimize ___udivsi3 by peeling off the first
iteration of the loop that shifts both dividend and divisor.

At the cost of 4 bytes, the patch cuts down 4 clock cycles on H8/300H.

Tested on h8300 port.  Committed.

Kazu Hirata

2003-11-14  Kazu Hirata  <kazu@cs.umass.edu>

	* config/h8300/lib1funcs.asm (___udivsi3): Peel off the first
	iteration.

Index: lib1funcs.asm
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/lib1funcs.asm,v
retrieving revision 1.28
diff -u -r1.28 lib1funcs.asm
--- lib1funcs.asm	14 Nov 2003 12:49:40 -0000	1.28
+++ lib1funcs.asm	14 Nov 2003 16:18:29 -0000
@@ -633,13 +633,16 @@
 	mov.w	e2,e2
 	bne	divmod_L21
 #else
-	bra	divmod_L22
+	shlr.l	#2,er2		; make divisor < 2^16
+	mov.w	e2,e2
+	beq	divmod_L22A
 divmod_L21:
 	shlr.l	#2,er0
 divmod_L22:
 	shlr.l	#2,er2		; make divisor < 2^16
 	mov.w	e2,e2
 	bne	divmod_L21
+divmod_L22A:
 	rotxl.w	r2
 	bcs	divmod_L23
 	shlr.l	er0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]