Please update addaddmul_1msb0.asm to support ABI in mingw64
Marco Bodrato
bodrato at mail.dm.unipi.it
Mon Oct 4 20:56:00 UTC 2021
Ciao Niels,
you are the author of this code.
Il 2020-06-07 21:48 Idigger Lee ha scritto:
> Please update addaddmul_1msb0.asm to support ABI in mingw64.
While looking at this e-mail on gmp-bugs, I added DOS support and also
reordered the branches around the exit code.
Do you agree with those changes?
--------8<-------------
***
/tmp/extdiff.X4CyBq/gmp-err.b03b3cb1ce98/mpn/x86_64/addaddmul_1msb0.asm 2020-11-16
21:41:15.000000000 +0100
--- /home/bodrato/src/gmp-err/mpn/x86_64/addaddmul_1msb0.asm 2020-10-29
04:37:12.369375684 +0100
*************** define(`u0', `%r8')
*** 51,64 ****
--- 51,70 ----
define(`v0', `%r9')
define(`bp', `%rbp')
+ ABI_SUPPORT(DOS64)
+ ABI_SUPPORT(STD64)
+
ASM_START()
TEXT
ALIGN(16)
PROLOGUE(mpn_addaddmul_1msb0)
+ FUNC_ENTRY(4)
+ IFDOS(` mov 56(%rsp), %r8 ')
+ IFDOS(` mov 64(%rsp), %r9 ')
push %r12
push %rbp
lea (ap,n,8), ap
lea (bp_param,n,8), bp
*************** L(top): mul %r9
*** 105,170 ****
mov $0, R32(%r10)
adc %rdx, %r10
add $3, n
js L(top)
! L(end): cmp $1, R32(n)
! ja 2f
! jz 1f
!
! mul %r9
add %rax, %r12
- mov -16(ap), %rax
adc %rdx, %r10
! mov %r12, -24(rp)
mul %r8
add %rax, %r10
! mov -16(bp), %rax
mov $0, R32(%r11)
adc %rdx, %r11
mul %r9
add %rax, %r10
- mov -8(ap), %rax
adc %rdx, %r11
! mov %r10, -16(rp)
mul %r8
! add %rax, %r11
! mov -8(bp), %rax
mov $0, R32(%r12)
adc %rdx, %r12
mul %r9
! add %rax, %r11
! adc %rdx, %r12
! mov %r11, -8(rp)
! mov %r12, %rax
! pop %rbp
! pop %r12
! ret
!
! 1: mul %r9
! add %rax, %r12
mov -8(ap), %rax
! adc %rdx, %r10
! mov %r12, -16(rp)
mul %r8
! add %rax, %r10
mov -8(bp), %rax
! mov $0, R32(%r11)
! adc %rdx, %r11
mul %r9
- add %rax, %r10
- adc %rdx, %r11
- mov %r10, -8(rp)
- mov %r11, %rax
- pop %rbp
- pop %r12
- ret
-
- 2: mul %r9
add %rax, %r12
- mov %r12, -8(rp)
adc %rdx, %r10
mov %r10, %rax
! pop %rbp
pop %r12
ret
EPILOGUE()
--- 111,164 ----
mov $0, R32(%r10)
adc %rdx, %r10
add $3, n
js L(top)
! L(end): mul %r9
add %rax, %r12
adc %rdx, %r10
! cmp $1, R32(n)
! ja L(two)
! jnz L(nul)
!
! L(one): mov -8(ap), %rax
! mov %r12, -16(rp)
mul %r8
add %rax, %r10
! mov -8(bp), %rax
mov $0, R32(%r11)
adc %rdx, %r11
mul %r9
add %rax, %r10
adc %rdx, %r11
! mov %r10, -8(rp)
! mov %r11, %rax
! jmp L(ret)
!
! L(nul): mov -16(ap), %rax
! mov %r12, -24(rp)
mul %r8
! add %rax, %r10
! mov -16(bp), %rax
mov $0, R32(%r12)
adc %rdx, %r12
mul %r9
! add %rax, %r10
mov -8(ap), %rax
! adc %rdx, %r12
! mov %r10, -16(rp)
mul %r8
! add %rax, %r12
mov -8(bp), %rax
! mov $0, R32(%r10)
! adc %rdx, %r10
mul %r9
add %rax, %r12
adc %rdx, %r10
+
+ L(two): mov %r12, -8(rp)
mov %r10, %rax
! L(ret): pop %rbp
pop %r12
+ FUNC_EXIT()
ret
EPILOGUE()
--------8<-------------
Ĝis,
m
More information about the gmp-devel
mailing list