1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 .file "round_Xsig.S"
21
22 #include "fpu_emu.h"
23
24
25 .text
26 ENTRY(round_Xsig)
27 pushl %ebp
28 movl %esp,%ebp
29 pushl %ebx
30 pushl %ebx
31 pushl %esi
32
33 movl PARAM1,%esi
34
35 movl 8(%esi),%edx
36 movl 4(%esi),%ebx
37 movl (%esi),%eax
38
39 movl $0,-4(%ebp)
40
41 orl %edx,%edx
42 js L_round
43 jnz L_shift_1
44
45 movl %ebx,%edx
46 movl %eax,%ebx
47 xorl %eax,%eax
48 movl $-32,-4(%ebp)
49
50
51 L_shift_1:
52 bsrl %edx,%ecx
53 subl $31,%ecx
54 negl %ecx
55 subl %ecx,-4(%ebp)
56 shld %cl,%ebx,%edx
57 shld %cl,%eax,%ebx
58 shl %cl,%eax
59
60 L_round:
61 testl $0x80000000,%eax
62 jz L_exit
63
64 addl $1,%ebx
65 adcl $0,%edx
66 jnz L_exit
67
68 movl $0x80000000,%edx
69 incl -4(%ebp)
70
71 L_exit:
72 movl %edx,8(%esi)
73 movl %ebx,4(%esi)
74 movl %eax,(%esi)
75
76 movl -4(%ebp),%eax
77
78 popl %esi
79 popl %ebx
80 leave
81 ret
82 ENDPROC(round_Xsig)
83
84
85
86 ENTRY(norm_Xsig)
87 pushl %ebp
88 movl %esp,%ebp
89 pushl %ebx
90 pushl %ebx
91 pushl %esi
92
93 movl PARAM1,%esi
94
95 movl 8(%esi),%edx
96 movl 4(%esi),%ebx
97 movl (%esi),%eax
98
99 movl $0,-4(%ebp)
100
101 orl %edx,%edx
102 js L_n_exit
103 jnz L_n_shift_1
104
105 movl %ebx,%edx
106 movl %eax,%ebx
107 xorl %eax,%eax
108 movl $-32,-4(%ebp)
109
110 orl %edx,%edx
111 js L_n_exit
112 jnz L_n_shift_1
113
114 movl %ebx,%edx
115 movl %eax,%ebx
116 xorl %eax,%eax
117 addl $-32,-4(%ebp)
118 jmp L_n_exit
119
120
121
122 L_n_shift_1:
123 bsrl %edx,%ecx
124 subl $31,%ecx
125 negl %ecx
126 subl %ecx,-4(%ebp)
127 shld %cl,%ebx,%edx
128 shld %cl,%eax,%ebx
129 shl %cl,%eax
130
131 L_n_exit:
132 movl %edx,8(%esi)
133 movl %ebx,4(%esi)
134 movl %eax,(%esi)
135
136 movl -4(%ebp),%eax
137
138 popl %esi
139 popl %ebx
140 leave
141 ret
142 ENDPROC(norm_Xsig)