aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/coldfire/files-2.6.31/arch/m68k/coldfire/common/muldi3.S
blob: c4f216e5fc8ccbada916027460a84508be29d738 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
 * Coldfire muldi3 assembly verion
 * Copyright 2008-2009 Freescale Semiconductor, Inc. All Rights Reserved.
 *   Jason Jin Jason.Jin@freescale.com
 *   Shrek Wu B16972@freescale.com
 */
 
#include <linux/linkage.h>
.globl __muldi3

ENTRY(__muldi3)
	linkw 	%fp,#0
	lea 	%sp@(-32),%sp
	moveml 	%d2-%d7/%a2-%a3,%sp@
	moveal 	%fp@(8), %a2
	moveal 	%fp@(12), %a3
	moveal  %fp@(16), %a0
	moveal  %fp@(20),%a1
	movel 	%a3,%d2
	andil   #65535,%d2
	movel   %a3,%d3
	clrw 	%d3
	swap 	%d3
	movel 	%a1,%d0
	andil 	#65535,%d0
	movel 	%a1,%d1
	clrw 	%d1
	swap 	%d1
	movel 	%d2,%d7
	mulsl 	%d0,%d7
	movel 	%d2,%d4
	mulsl 	%d1,%d4
	movel 	%d3,%d2
	mulsl 	%d0,%d2
	mulsl 	%d1,%d3
	movel 	%d7,%d0
	clrw 	%d0
	swap 	%d0
	addl 	%d0,%d4
	addl 	%d2,%d4
	cmpl 	%d4,%d2
	blss 	1f
	addil 	#65536,%d3
1:
	movel 	%d4,%d0
	clrw 	%d0
	swap 	%d0
	movel 	%d3,%d5
	addl 	%d0,%d5
	movew 	%d4,%d6
	swap 	%d6
	movew 	%d7,%d6
	movel 	%d5,%d0
	movel 	%d6,%d1
	movel 	%a3,%d2
	movel 	%a0,%d3
	mulsl 	%d3,%d2
	movel 	%a2,%d3
	movel 	%a1,%d4
	mulsl 	%d4,%d3
	addl 	%d3,%d2
	movel 	%d2,%d0
	addl 	%d5,%d0
	moveml 	%sp@, %d2-%d7/%a2-%a3
	lea 	%sp@(32),%sp
	unlk 	%fp
	rts