1 | long integer multiplication routine
3 | written by Kai-Uwe Bloem
(I5110401@dbstu1.bitnet
).
6 | Revision
1.1, kub
03-90
7 | first version
, replaces the appropriate routine from fixnum.s.
8 | This one is longer
, but normally faster because _umulsi3 is no longer
9 | called for multiplication. Rather
, the code is inlined here. See the
10 | comments in _umulsi3.s
17 movel
%d2
,%a0 | save registers
19 movemw
%sp@
(4),%d0-
%d3 | get the two longs. u
= %d0-
%d1
, v
= %d2-
%d3
20 movew
%d0
,%sp@
- | sign flag
21 bpl L_00 | is u negative ?
22 negw
%d1 | yes
, force it positive
24 L_00
: tstw
%d2 | is v negative ?
26 negw
%d3 | yes
, force it positive
...
28 notw
%sp@ |
... and modify flag word
32 mulu
%d3
,%d0 | r
= v.
l * u.h
33 L_1
: tstw
%d2 | v.h
<> 0 ?
35 mulu
%d1
,%d2 | r
+= v.h
* u.
l
39 mulu
%d3
,%d1 | r
+= v.
l * u.
l
43 tstw
%sp@
+ | should the result
be negated ?
44 bpl L_3 | no
, just return
45 negl
%d0 | else r
= -r