blob: 5a062fd298d128b0d7f505655e908448b6557388 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001; SPDX-License-Identifier: GPL-2.0
Yoshinori Satoa71a29d2015-01-28 02:48:15 +09002;
3; mulsi3 for H8/300H - based on Renesas SH implementation
4;
5; by Toshiyasu Morita
6;
7; Old code:
8;
9; 16b * 16b = 372 states (worst case)
10; 32b * 32b = 724 states (worst case)
11;
12; New code:
13;
14; 16b * 16b = 48 states
15; 16b * 32b = 72 states
16; 32b * 32b = 92 states
17;
18
19 .global __mulsi3
20__mulsi3:
21 mov.w r1,r2 ; ( 2 states) b * d
22 mulxu r0,er2 ; (22 states)
23
24 mov.w e0,r3 ; ( 2 states) a * d
25 beq L_skip1 ; ( 4 states)
26 mulxu r1,er3 ; (22 states)
27 add.w r3,e2 ; ( 2 states)
28
29L_skip1:
30 mov.w e1,r3 ; ( 2 states) c * b
31 beq L_skip2 ; ( 4 states)
32 mulxu r0,er3 ; (22 states)
33 add.w r3,e2 ; ( 2 states)
34
35L_skip2:
36 mov.l er2,er0 ; ( 2 states)
37 rts ; (10 states)
38
39 .end