1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 .file "polynomial_Xsig.S"
25
26 #include "fpu_asm.h"
27
28
29 #define TERM_SIZE $8
30 #define SUM_MS -20(%ebp)
31 #define SUM_MIDDLE -24(%ebp)
32 #define SUM_LS -28(%ebp)
33 #define ACCUM_MS -4(%ebp)
34 #define ACCUM_MIDDLE -8(%ebp)
35 #define ACCUM_LS -12(%ebp)
36 #define OVERFLOWED -16(%ebp)
37
38 .text
39 .align 2,144
40 .globl _polynomial_Xsig
41 _polynomial_Xsig:
42 pushl %ebp
43 movl %esp,%ebp
44 subl $32,%esp
45 pushl %esi
46 pushl %edi
47 pushl %ebx
48
49 movl PARAM2,%esi
50 movl PARAM3,%edi
51
52 movl TERM_SIZE,%eax
53 mull PARAM4
54 addl %eax,%edi
55
56 movl 4(%edi),%edx
57 movl %edx,SUM_MS
58 movl (%edi),%edx
59 movl %edx,SUM_MIDDLE
60 xor %eax,%eax
61 movl %eax,SUM_LS
62 movb %al,OVERFLOWED
63
64 subl TERM_SIZE,%edi
65 decl PARAM4
66 js L_accum_done
67
68 L_accum_loop:
69 xor %eax,%eax
70 movl %eax,ACCUM_MS
71 movl %eax,ACCUM_MIDDLE
72
73 movl SUM_MIDDLE,%eax
74 mull (%esi)
75 movl %edx,ACCUM_LS
76
77 movl SUM_MIDDLE,%eax
78 mull 4(%esi)
79 addl %eax,ACCUM_LS
80 adcl %edx,ACCUM_MIDDLE
81 adcl $0,ACCUM_MS
82
83 movl SUM_MS,%eax
84 mull (%esi)
85 addl %eax,ACCUM_LS
86 adcl %edx,ACCUM_MIDDLE
87 adcl $0,ACCUM_MS
88
89 movl SUM_MS,%eax
90 mull 4(%esi)
91 addl %eax,ACCUM_MIDDLE
92 adcl %edx,ACCUM_MS
93
94 testb $0xff,OVERFLOWED
95 jz L_no_overflow
96
97 movl (%esi),%eax
98 addl %eax,ACCUM_MIDDLE
99 movl 4(%esi),%eax
100 adcl %eax,ACCUM_MS
101
102 L_no_overflow:
103
104
105
106
107
108 movl ACCUM_LS,%eax
109 addl (%edi),%eax
110 movl %eax,SUM_LS
111 movl ACCUM_MIDDLE,%eax
112 adcl (%edi),%eax
113 movl %eax,SUM_MIDDLE
114 movl ACCUM_MS,%eax
115 adcl 4(%edi),%eax
116 movl %eax,SUM_MS
117 sbbb %al,%al
118 movb %al,OVERFLOWED
119
120 subl TERM_SIZE,%edi
121 decl PARAM4
122 jns L_accum_loop
123
124 L_accum_done:
125 movl PARAM1,%edi
126 movl SUM_LS,%eax
127 addl %eax,(%edi)
128 movl SUM_MIDDLE,%eax
129 adcl %eax,4(%edi)
130 movl SUM_MS,%eax
131 adcl %eax,8(%edi)
132
133 popl %ebx
134 popl %edi
135 popl %esi
136 leave
137 ret