libmp: no text jump labels for darwin

This commit is contained in:
Russ Cox 2007-11-05 12:27:49 -05:00
parent 50808670fc
commit 88cf592723
5 changed files with 45 additions and 47 deletions

View file

@ -1,5 +1,5 @@
.text
.p2align 2,0x90
.globl _mpdigdiv
_mpdigdiv:
/* Prelude */
@ -15,19 +15,19 @@ _mpdigdiv:
xorl %ecx, %ecx
cmpl %ebx, %edx /* dividend >= 2^32 * divisor */
jae divovfl
jae 2f
cmpl %ecx, %ebx /* divisor == 1 */
je divovfl
je 2f
divl %ebx /* AX = DX:AX/BX */
movl %eax, (%ebp)
done:
1:
/* Postlude */
popl %ebx
popl %ebp
ret
/* return all 1's */
divovfl:
2:
notl %ecx
movl %ecx, (%ebp)
jmp done
jmp 1b

View file

@ -26,42 +26,42 @@ _mpvecadd:
/* skip addition if b is zero */
testl %ecx,%ecx
je _add1
je 2f
/* sum[0:blen-1],carry = a[0:blen-1] + b[0:blen-1] */
_addloop1:
1:
movl (%esi, %ebp, 4), %eax
adcl (%ebx, %ebp, 4), %eax
movl %eax, (%edi, %ebp, 4)
incl %ebp
loop _addloop1
loop 1b
_add1:
2:
/* jump if alen > blen */
incl %edx
movl %edx, %ecx
loop _addloop2
loop 5f
/* sum[alen] = carry */
_addend:
jb _addcarry
3:
jb 4f
movl $0, (%edi, %ebp, 4)
jmp done
jmp 6f
_addcarry:
4:
movl $1, (%edi, %ebp, 4)
jmp done
jmp 6f
/* sum[blen:alen-1],carry = a[blen:alen-1] + 0 */
_addloop2:
5:
movl (%esi, %ebp, 4),%eax
adcl $0, %eax
movl %eax, (%edi, %ebp, 4)
incl %ebp
loop _addloop2
jmp _addend
loop 5b
jmp 3b
done:
6:
/* Postlude */
popl %edi
popl %esi

View file

@ -22,7 +22,6 @@
*/
.text
.p2align 2,0x90
.globl _mpvecdigmuladd
_mpvecdigmuladd:
/* Prelude */
@ -42,20 +41,20 @@ _mpvecdigmuladd:
addl %ecx, %esi /* SI = b + n */
addl %ecx, %edi /* DI = p + n */
xorl %ecx, %ecx
_muladdloop:
1:
movl (%esi, %ebp, 4), %eax /* lo = b[i] */
mull %ebx /* hi, lo = b[i] * m */
addl %ecx,%eax /* lo += oldhi */
jae _muladdnocarry1
jae 2f
incl %edx /* hi += carry */
_muladdnocarry1:
2:
addl %eax, (%edi, %ebp, 4) /* p[i] += lo */
jae _muladdnocarry2
jae 3f
incl %edx /* hi += carry */
_muladdnocarry2:
3:
movl %edx, %ecx /* oldhi = hi */
incl %ebp /* i++ */
jnz _muladdloop
jnz 1b
xorl %eax, %eax
addl %ecx, (%edi, %ebp, 4) /* p[n] + oldhi */
adcl %eax, %eax /* return carry out of p[n] */

View file

@ -23,7 +23,6 @@
*/
.text
.p2align 2,0x90
.globl _mpvecdigmulsub
_mpvecdigmulsub:
/* Prelude */
@ -39,28 +38,28 @@ _mpvecdigmulsub:
movl 12(%ebp), %edi /* p */
xorl %ebp, %ebp
pushl %ebp
_mulsubloop:
1:
movl (%esi, %ebp, 4),%eax /* lo = b[i] */
mull %ebx /* hi, lo = b[i] * m */
addl 0(%esp), %eax /* lo += oldhi */
jae _mulsubnocarry1
jae 2f
incl %edx /* hi += carry */
_mulsubnocarry1:
2:
subl %eax, (%edi, %ebp, 4)
jae _mulsubnocarry2
jae 3f
incl %edx /* hi += carry */
_mulsubnocarry2:
3:
movl %edx, 0(%esp)
incl %ebp
loop _mulsubloop
loop 1b
popl %eax
subl %eax, (%edi, %ebp, 4)
jae _mulsubnocarry3
jae 4f
movl $-1, %eax
jmp done
_mulsubnocarry3:
jmp 5f
4:
movl $1, %eax
done:
5:
/* Postlude */
popl %edi
popl %esi

View file

@ -26,31 +26,31 @@ _mpvecsub:
/* skip subraction if b is zero */
testl %ecx,%ecx
jz _sub1
jz 2f
/* diff[0:blen-1],borrow = a[0:blen-1] - b[0:blen-1] */
_subloop1:
1:
movl (%esi, %ebp, 4), %eax
sbbl (%ebx, %ebp, 4), %eax
movl %eax, (%edi, %ebp, 4)
incl %ebp
loop _subloop1
loop 1b
_sub1:
2:
incl %edx
movl %edx,%ecx
loop _subloop2
jmp done
loop 3f
jmp 4f
/* diff[blen:alen-1] = a[blen:alen-1] - 0 */
_subloop2:
3:
movl (%esi, %ebp, 4), %eax
sbbl $0, %eax
movl %eax, (%edi, %ebp, 4)
incl %ebp
loop _subloop2
loop 3b
done:
4:
/* Postlude */
popl %edi
popl %esi