2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: Utility 32 bit multiplication routines. m68k version.
11 /* SMult32()/UMult32():
12 These are the signed/unsigned 32 bit multiplication routines.
13 I have two different possibilities here since I could be running
14 on a system without the corresponding muls.l/mulu.l calls.
16 After some soul searching I am happy that these routines don't
17 have to be separated between signed/unsigned since the sign is
18 correct, or the number overflows.
20 The native versions do make the difference however.
22 What I do is SetFunction() the correct function in later.
27 .globl AROS_SLIB_ENTRY(SMult32,Utility)
28 .globl AROS_SLIB_ENTRY(UMult32,Utility)
29 .globl AROS_SLIB_ENTRY(UMult32_020,Utility)
31 .type AROS_SLIB_ENTRY(SMult32,Utility),@function
32 .type AROS_SLIB_ENTRY(UMult32,Utility),@function
33 .type AROS_SLIB_ENTRY(UMult32_020,Utility),@function
35 AROS_SLIB_ENTRY
(UMult32_020
,Utility
):
39 AROS_SLIB_ENTRY
(SMult32
,Utility
):
40 AROS_SLIB_ENTRY
(UMult32
,Utility
):
43 d0 = (a^16 + b), d1 = (c^16 = d)
44 res = ac^32 + (ad + bc)^16 + bd
46 Now, ac^32 can be thrown away, as can the high 16 bits of ad + bd
48 movem.
l %d2
/%d3
,-(%sp
)
68 /* bd + (ad + bc)^16 */
72 movem.
l (%sp
)+,%d2
/%d3