Last change
on this file since dd1be7c was
e16e8f2,
checked in by Edwin Eefting <edwin@datux.nl>, 3 years ago
|
bootstuff
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | /* |
---|
2 | * arch/i386/libgcc/__muldi3.S |
---|
3 | * |
---|
4 | * 64*64 = 64 bit unsigned multiplication |
---|
5 | */ |
---|
6 | |
---|
7 | .text |
---|
8 | .align 4 |
---|
9 | .globl __muldi3 |
---|
10 | .type __muldi3,@function |
---|
11 | __muldi3: |
---|
12 | #if __SIZEOF_POINTER__ == 4 |
---|
13 | /* i386 */ |
---|
14 | push %esi |
---|
15 | #ifndef REGPARM |
---|
16 | movl 8(%esp),%eax |
---|
17 | movl %eax,%esi |
---|
18 | movl 16(%esp),%ecx |
---|
19 | mull %ecx |
---|
20 | imull 12(%esp),%ecx |
---|
21 | imull 20(%esp),%esi |
---|
22 | addl %ecx,%edx |
---|
23 | addl %esi,%edx |
---|
24 | #else |
---|
25 | movl %eax,%esi |
---|
26 | push %edx |
---|
27 | mull %ecx |
---|
28 | imull 8(%esp),%esi |
---|
29 | addl %esi,%edx |
---|
30 | pop %esi |
---|
31 | imull %esi,%ecx |
---|
32 | addl %ecx,%edx |
---|
33 | #endif |
---|
34 | pop %esi |
---|
35 | ret |
---|
36 | #elif __SIZEOF_POINTER__ == 8 |
---|
37 | /* x86_64 */ |
---|
38 | push %rsi |
---|
39 | #ifndef REGPARM |
---|
40 | /* |
---|
41 | movl 8(%esp),%eax |
---|
42 | movl %eax,%esi |
---|
43 | movl 16(%esp),%ecx |
---|
44 | mull %ecx |
---|
45 | imull 12(%esp),%ecx |
---|
46 | imull 20(%esp),%esi |
---|
47 | addl %ecx,%edx |
---|
48 | addl %esi,%edx |
---|
49 | */ |
---|
50 | movq 8(%rsp),%rax |
---|
51 | movq %rax,%rsi |
---|
52 | movq 16(%rsp),%rcx |
---|
53 | mulq %rcx |
---|
54 | imulq 12(%rsp),%rcx |
---|
55 | imulq 20(%rsp),%rsi |
---|
56 | addq %rcx,%rdx |
---|
57 | addq %rsi,%rdx |
---|
58 | #else |
---|
59 | /* |
---|
60 | movl %eax,%esi |
---|
61 | push %edx |
---|
62 | mull %ecx |
---|
63 | imull 8(%esp),%esi |
---|
64 | addl %esi,%edx |
---|
65 | pop %rsi |
---|
66 | imull %esi,%ecx |
---|
67 | addl %ecx,%edx |
---|
68 | */ |
---|
69 | movq %rax,%rsi |
---|
70 | pushq %rdx |
---|
71 | mulq %rcx |
---|
72 | imulq 8(%rsp),%rsi |
---|
73 | addq %rsi,%rdx |
---|
74 | popq %rsi |
---|
75 | imulq %rsi,%rcx |
---|
76 | addq %rcx,%rdx |
---|
77 | #endif |
---|
78 | pop %rsi |
---|
79 | ret |
---|
80 | #else |
---|
81 | #error "Unsupported architecture for __muldi3.S" |
---|
82 | #endif |
---|
83 | .size __muldi3,.-__muldi3 |
---|
Note: See
TracBrowser
for help on using the repository browser.