Please update addaddmul_1msb0.asm to support ABI in mingw64

Marco Bodrato bodrato at
Wed Oct 6 07:15:27 UTC 2021

Ciao Niels,

Il 2021-10-05 20:56 nisse at ha scritto:
> Marco Bodrato <bodrato at> writes:
>> 	mov	%r11, -16(rp)
>> 	mov	%r10, %r11
>> 	jmp	L(one)

> I had hoped this jump and preceding instructions could be eliminated, 
> to
> get a structure like
>  	ja	L(two)
> 	jz	L(one)
> L(nul): (no jumps to this label left)
>         ...

> But might need other move instructions, to get the right data into the
> right registers?

Maybe with a couple of move with computed address, and with the same 
value in r10 and r11 we can get rid of the jump.
The difference, wrt the last code I sent, follows.

*** 122,135 ****
   	cmp	$1, R32(n)
   	ja	L(two)
! 	jnz	L(nul)
! 	mov	-8(ap), %rax
! 	mov	%r11, -16(rp)
   	mov	%r10, %r11
! 	jmp	L(one)

! L(nul):	mov	-16(ap), %rax
! 	mov	%r11, -24(rp)
! 	mul	%r8
   	add	%rax, %r10
   	mov	-16(bp), %rax
--- 122,131 ----
   	cmp	$1, R32(n)
   	ja	L(two)
! 	mov	-16(ap,n,8), %rax
! 	mov	%r11, -24(rp,n,8)
   	mov	%r10, %r11
! 	jz	L(one)

! L(nul):	mul	%r8
   	add	%rax, %r10
   	mov	-16(bp), %rax

> So I think your version is an improvement as is, and perhaps not worth
> the effort to try to eliminate a few more instructions if this rather
> obscure function.

I agree. Let's choose between the two last versions, and I'll push it.


More information about the gmp-devel mailing list