- Removed unused HandleEvent method.
[AROS.git] / arch / m68k-all / libgcc1 / _mulsi3.s
blob8a752eb8fb9d721e38918a4fb1c82794e432f54d
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
12 .text
13 .even
14 .globl __mulsi3
16 __mulsi3:
17 movel %d2,%a0 | save registers
18 movel %d3,%a1
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
23 negxw %d0
24 L_00: tstw %d2 | is v negative ?
25 bpl L_01
26 negw %d3 | yes, force it positive ...
27 negxw %d2
28 notw %sp@ | ... and modify flag word
29 L_01:
30 extl %d0 | u.h <> 0 ?
31 beq L_1
32 mulu %d3,%d0 | r = v.l * u.h
33 L_1: tstw %d2 | v.h <> 0 ?
34 beq L_2
35 mulu %d1,%d2 | r += v.h * u.l
36 addw %d2,%d0
37 L_2: swap %d0
38 clrw %d0
39 mulu %d3,%d1 | r += v.l * u.l
40 addl %d1,%d0
41 movel %a1,%d3
42 movel %a0,%d2
43 tstw %sp@+ | should the result be negated ?
44 bpl L_3 | no, just return
45 negl %d0 | else r = -r
46 L_3: rts