[patch] Optimize mulsi3 in h8300 port.

Kazu Hirata kazu@hxi.com
Sat Apr 20 13:20:00 GMT 2002


Hi,

Attached is a patch to improve mulsi3 in h8300 port.

A libcall in h8300 port is allowed to use 4 registers from er0 through
er3.  Thus we do not have to push er3.  add.l can be replaced with
add.w.

Tested on h8300 port.  Committed.

Kazu Hirata

2002-04-20  Kazu Hirata  <kazu@hxi.com>

	* config/h8300/lib1funcs.asm (___mulsi3): Remove unnecessary
	push and pop.  Replace add.l with add.w.

Index: lib1funcs.asm
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/lib1funcs.asm,v
retrieving revision 1.12
diff -u -r1.12 lib1funcs.asm
--- lib1funcs.asm	20 Apr 2002 18:01:53 -0000	1.12
+++ lib1funcs.asm	20 Apr 2002 20:13:50 -0000
@@ -742,36 +742,29 @@
 ;
 ; New code:
 ;
-; 16b * 16b =  68 states
-; 16b * 32b =  96 states
-; 32b * 32b = 124 states
+; 16b * 16b =  48 states
+; 16b * 32b =  72 states
+; 32b * 32b =  92 states
 ;
 
 	.global	___mulsi3
 ___mulsi3:
-	push.l	er3     ; (10 states)
-  
 	mov.w	r1,r2   ; ( 2 states) b * d
 	mulxu	r0,er2  ; (22 states)
   
 	mov.w	e0,r3   ; ( 2 states) a * d
 	beq	L_skip1 ; ( 4 states)
 	mulxu	r1,er3  ; (22 states)
-	mov.w	r3,e3   ; ( 2 states)
-	mov.w	#0,r3   ; ( 2 states)
-	add.l	er3,er2 ; ( 2 states)
+	add.w	r3,e2   ; ( 2 states)
 
 L_skip1:
 	mov.w	e1,r3   ; ( 2 states) c * b
 	beq	L_skip2 ; ( 4 states)
 	mulxu	r0,er3  ; (22 states)
-	mov.w	r3,e3   ; ( 2 states)
-	mov.w	#0,r3   ; ( 2 states)
-	add.l	er3,er2 ; ( 2 states)
+	add.w	r3,e2   ; ( 2 states)
 
 L_skip2:
 	mov.l	er2,er0	; ( 2 states)
-	pop.l	er3	; (10 states)
 	rts		; (10 states)
 
 #endif



More information about the Gcc-patches mailing list