Commit 59184677 by Toshiyasu Morita Committed by Kazu Hirata

lib1funcs.asm (___mulsi3): Use hardware multiply instructions for H8/300H case.

	* config/h8300/lib1funcs.asm (___mulsi3): Use hardware
	multiply instructions for H8/300H case.

From-SVN: r52558
parent b1113e0a
2002-04-20 Toshiyasu Morita <toshiyasu.morita@hsa.hitachi.com> 2002-04-20 Toshiyasu Morita <toshiyasu.morita@hsa.hitachi.com>
* config/h8300/lib1funcs.asm (___mulsi3): Use hardware
multiply instructions for H8/300H case.
2002-04-20 Toshiyasu Morita <toshiyasu.morita@hsa.hitachi.com>
* config/h8300/lib1funcs.asm (___cmpsi2, ___ucmpsi2): * config/h8300/lib1funcs.asm (___cmpsi2, ___ucmpsi2):
Bum three instructions from each routine. Bum three instructions from each routine.
......
...@@ -730,32 +730,49 @@ _done: ...@@ -730,32 +730,49 @@ _done:
#else /* __H8300H__ */ #else /* __H8300H__ */
;
; mulsi3 for H8/300H - based on Hitachi SH implementation
;
; by Toshiyasu Morita
;
; Old code:
;
; 16b * 16b = 372 states (worst case)
; 32b * 32b = 724 states (worst case)
;
; New code:
;
; 16b * 16b = 68 states
; 16b * 32b = 96 states
; 32b * 32b = 124 states
;
.global ___mulsi3 .global ___mulsi3
___mulsi3: ___mulsi3:
sub.l A2P,A2P push.l er3 ; (10 states)
; while (a) mov.w r1,r2 ; ( 2 states) b * d
_top: mov.l A0P,A0P mulxu r0,er2 ; (22 states)
beq _done
mov.w e0,r3 ; ( 2 states) a * d
; if (a & 1) beq L_skip1 ; ( 4 states)
bld #0,A0L mulxu r1,er3 ; (22 states)
bcc _nobit mov.w r3,e3 ; ( 2 states)
mov.w #0,r3 ; ( 2 states)
; r += b add.l er3,er2 ; ( 2 states)
add.l A1P,A2P
L_skip1:
_nobit: mov.w e1,r3 ; ( 2 states) c * b
; a >>= 1 beq L_skip2 ; ( 4 states)
shlr.l A0P mulxu r0,er3 ; (22 states)
mov.w r3,e3 ; ( 2 states)
; b <<= 1 mov.w #0,r3 ; ( 2 states)
shll.l A1P add.l er3,er2 ; ( 2 states)
bra _top
L_skip2:
_done: mov.l er2,er0 ; ( 2 states)
mov.l A2P,A0P pop.l er3 ; (10 states)
rts rts ; (10 states)
#endif #endif
#endif /* L_mulsi3 */ #endif /* L_mulsi3 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment