]> gcc.gnu.org Git - gcc.git/commitdiff
lib1funcs.asm (___mulsi3): Use hardware multiply instructions for H8/300H case.
authorToshiyasu Morita <toshiyasu.morita@hsa.hitachi.com>
Sat, 20 Apr 2002 18:01:53 +0000 (18:01 +0000)
committerKazu Hirata <kazu@gcc.gnu.org>
Sat, 20 Apr 2002 18:01:53 +0000 (18:01 +0000)
* config/h8300/lib1funcs.asm (___mulsi3): Use hardware
multiply instructions for H8/300H case.

From-SVN: r52558

gcc/ChangeLog
gcc/config/h8300/lib1funcs.asm

index 5435330cac9c690e4b85d8dc5420d91e15ede461..63fd6350be4c39c505c9b920447106e45953c5e9 100644 (file)
@@ -1,3 +1,8 @@
+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):
index aa68ebcab373532bbed5db140f1eb43d20e6d766..0fbeacd0ed07f3670fe991c19fb8018b33d12b28 100644 (file)
@@ -730,32 +730,49 @@ _done:
 
 #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
 ___mulsi3:
-       sub.l   A2P,A2P
-
-       ; while (a)
-_top:  mov.l   A0P,A0P
-       beq     _done
-
-       ; if (a & 1)
-       bld     #0,A0L
-       bcc     _nobit
-
-       ; r += b
-       add.l   A1P,A2P
-
-_nobit:
-       ; a >>= 1
-       shlr.l  A0P
-
-       ; b <<= 1
-       shll.l  A1P
-       bra     _top
-
-_done:
-       mov.l   A2P,A0P
-       rts
+       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)
+
+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)
+
+L_skip2:
+       mov.l   er2,er0 ; ( 2 states)
+       pop.l   er3     ; (10 states)
+       rts             ; (10 states)
 
 #endif
 #endif /* L_mulsi3 */
This page took 0.07353 seconds and 5 git commands to generate.