mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-27 11:52:03 +00:00
Avoid saving precious data under stack pointer.
This commit is contained in:
parent
39ce0d5862
commit
bdc14ad478
1 changed files with 18 additions and 25 deletions
|
@ -23,32 +23,27 @@
|
||||||
*/
|
*/
|
||||||
.text
|
.text
|
||||||
|
|
||||||
/* XXX: had to use "-4(%esp)" kludge to get around inability to
|
|
||||||
* push/pop without first adjusting %esp. This may not be
|
|
||||||
* as fast as using push/pop (and accessing pushed element
|
|
||||||
* with "(%esp)".)
|
|
||||||
*/
|
|
||||||
|
|
||||||
.p2align 2,0x90
|
.p2align 2,0x90
|
||||||
.globl mpvecdigmulsub
|
.globl mpvecdigmulsub
|
||||||
.type mpvecdigmulsub, @function
|
.type mpvecdigmulsub, @function
|
||||||
mpvecdigmulsub:
|
mpvecdigmulsub:
|
||||||
/* Prelude */
|
/* Prelude */
|
||||||
pushl %ebp
|
pushl %ebp /* save on stack */
|
||||||
movl %ebx, -8(%esp) /* save on stack */
|
pushl %ebx
|
||||||
movl %esi, -12(%esp)
|
pushl %esi
|
||||||
movl %edi, -16(%esp)
|
pushl %edi
|
||||||
|
|
||||||
movl 8(%esp), %esi /* b */
|
leal 20(%esp), %ebp /* %ebp = FP for now */
|
||||||
movl 12(%esp), %ecx /* n */
|
movl 0(%ebp), %esi /* b */
|
||||||
movl 16(%esp), %ebx /* m */
|
movl 4(%ebp), %ecx /* n */
|
||||||
movl 20(%esp), %edi /* p */
|
movl 8(%ebp), %ebx /* m */
|
||||||
|
movl 12(%ebp), %edi /* p */
|
||||||
xorl %ebp, %ebp
|
xorl %ebp, %ebp
|
||||||
movl %ebp, -4(%esp)
|
pushl %ebp
|
||||||
_mulsubloop:
|
_mulsubloop:
|
||||||
movl (%esi, %ebp, 4),%eax /* lo = b[i] */
|
movl (%esi, %ebp, 4),%eax /* lo = b[i] */
|
||||||
mull %ebx /* hi, lo = b[i] * m */
|
mull %ebx /* hi, lo = b[i] * m */
|
||||||
addl -4(%esp), %eax /* lo += oldhi */
|
addl 0(%esp), %eax /* lo += oldhi */
|
||||||
jae _mulsubnocarry1
|
jae _mulsubnocarry1
|
||||||
incl %edx /* hi += carry */
|
incl %edx /* hi += carry */
|
||||||
_mulsubnocarry1:
|
_mulsubnocarry1:
|
||||||
|
@ -56,23 +51,21 @@ _mulsubnocarry1:
|
||||||
jae _mulsubnocarry2
|
jae _mulsubnocarry2
|
||||||
incl %edx /* hi += carry */
|
incl %edx /* hi += carry */
|
||||||
_mulsubnocarry2:
|
_mulsubnocarry2:
|
||||||
movl %edx, -4(%esp)
|
movl %edx, 0(%esp)
|
||||||
incl %ebp
|
incl %ebp
|
||||||
loop _mulsubloop
|
loop _mulsubloop
|
||||||
movl -4(%esp), %eax
|
popl %eax
|
||||||
subl %eax, (%edi, %ebp, 4)
|
subl %eax, (%edi, %ebp, 4)
|
||||||
jae _mulsubnocarry3
|
jae _mulsubnocarry3
|
||||||
movl $-1, %eax
|
movl $-1, %eax
|
||||||
jmp done
|
jmp done
|
||||||
|
|
||||||
_mulsubnocarry3:
|
_mulsubnocarry3:
|
||||||
movl $1, %eax
|
movl $1, %eax
|
||||||
|
|
||||||
done:
|
done:
|
||||||
/* Postlude */
|
/* Postlude */
|
||||||
movl -8(%esp), %ebx /* restore from stack */
|
popl %edi
|
||||||
movl -12(%esp), %esi
|
popl %esi
|
||||||
movl -16(%esp), %edi
|
popl %ebx
|
||||||
movl %esp, %ebp
|
popl %ebp
|
||||||
leave
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue