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