make sure fat dir has every file in fat structure
This commit is contained in:
parent
b5c5bd605f
commit
3f15c30522
@ -1,87 +0,0 @@
|
||||
|
||||
; AMD64 mpn_add_n
|
||||
; Copyright 2008 Jason Moxham
|
||||
; This file is part of the MPIR Library.
|
||||
; The MPIR Library is free software; you can redistribute it and/or modify
|
||||
; it under the terms of the GNU Lesser General Public License as published
|
||||
; by the Free Software Foundation; either version 2.1 of the License, or (at
|
||||
; your option) any later version.
|
||||
; The MPIR Library is distributed in the hope that it will be useful, but
|
||||
; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
; License for more details.
|
||||
; You should have received a copy of the GNU Lesser General Public License
|
||||
; along with the MPIR Library; see the file COPYING.LIB. If not, write
|
||||
; to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
; Boston, MA 02110-1301, USA.
|
||||
|
||||
; (rdi,rcx) = (rsi,rcx)+(rdx,rcx)
|
||||
; rax = carry
|
||||
|
||||
%include 'yasm_mac.inc'
|
||||
|
||||
BITS 64
|
||||
|
||||
GLOBAL_FUNC mpn_add_n
|
||||
mov rax, rcx
|
||||
and rax, 3
|
||||
shr rcx, 2
|
||||
cmp rcx, 0
|
||||
; carry flag is clear here
|
||||
jnz loop1
|
||||
mov r11, [rsi]
|
||||
add r11, [rdx]
|
||||
mov [rdi], r11
|
||||
dec rax
|
||||
jz end1
|
||||
mov r11, [rsi+8]
|
||||
adc r11, [rdx+8]
|
||||
mov [rdi+8], r11
|
||||
dec rax
|
||||
jz end1
|
||||
mov r11, [rsi+16]
|
||||
adc r11, [rdx+16]
|
||||
mov [rdi+16], r11
|
||||
dec rax
|
||||
end1:
|
||||
adc rax, rax
|
||||
ret
|
||||
align 8
|
||||
loop1
|
||||
mov r11, [rsi]
|
||||
mov r8, [rsi+8]
|
||||
lea rsi, [rsi+32]
|
||||
adc r11, [rdx]
|
||||
adc r8, [rdx+8]
|
||||
lea rdx, [rdx+32]
|
||||
mov [rdi], r11
|
||||
mov [rdi+8], r8
|
||||
lea rdi, [rdi+32]
|
||||
mov r9, [rsi-16]
|
||||
mov r10, [rsi-8]
|
||||
adc r9, [rdx-16]
|
||||
adc r10, [rdx-8]
|
||||
mov [rdi-16], r9
|
||||
dec rcx
|
||||
mov [rdi-8], r10
|
||||
jnz loop1
|
||||
inc rax
|
||||
dec rax
|
||||
jz end
|
||||
mov r11, [rsi]
|
||||
adc r11, [rdx]
|
||||
mov [rdi], r11
|
||||
dec rax
|
||||
jz end
|
||||
mov r11, [rsi+8]
|
||||
adc r11, [rdx+8]
|
||||
mov [rdi+8], r11
|
||||
dec rax
|
||||
jz end
|
||||
mov r11, [rsi+16]
|
||||
adc r11, [rdx+16]
|
||||
mov [rdi+16], r11
|
||||
dec rax
|
||||
end:
|
||||
adc rax, rax
|
||||
ret
|
@ -1,145 +0,0 @@
|
||||
dnl mpn_addmul_1
|
||||
|
||||
dnl Copyright 2011 The Code Cavern
|
||||
|
||||
dnl This file is part of the MPIR Library.
|
||||
|
||||
dnl The MPIR Library is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU Lesser General Public License as published
|
||||
dnl by the Free Software Foundation; either version 2.1 of the License, or (at
|
||||
dnl your option) any later version.
|
||||
|
||||
dnl The MPIR Library is distributed in the hope that it will be useful, but
|
||||
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
dnl License for more details.
|
||||
|
||||
dnl You should have received a copy of the GNU Lesser General Public License
|
||||
dnl along with the MPIR Library; see the file COPYING.LIB. If not, write
|
||||
dnl to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
dnl Boston, MA 02110-1301, USA.
|
||||
|
||||
include(`../config.m4')
|
||||
|
||||
ASM_START()
|
||||
PROLOGUE(mpn_addmul_1)
|
||||
mov (%rsi),%rax
|
||||
cmp $1,%rdx
|
||||
je one
|
||||
mov $5,%r11
|
||||
lea -40(%rsi,%rdx,8),%rsi
|
||||
lea -40(%rdi,%rdx,8),%rdi
|
||||
sub %rdx,%r11
|
||||
mul %rcx
|
||||
.byte 0x26
|
||||
mov %rax,%r8
|
||||
.byte 0x26
|
||||
mov 8(%rsi,%r11,8),%rax
|
||||
.byte 0x26
|
||||
mov %rdx,%r9
|
||||
.byte 0x26
|
||||
cmp $0,%r11
|
||||
.byte 0x26
|
||||
mov %r12,-8(%rsp)
|
||||
.byte 0x26
|
||||
jge skiplp
|
||||
lp: xor %r10,%r10
|
||||
mul %rcx
|
||||
add %r8,(%rdi,%r11,8)
|
||||
adc %rax,%r9
|
||||
adc %rdx,%r10
|
||||
mov 16(%rsi,%r11,8),%rax
|
||||
mul %rcx
|
||||
add %r9,8(%rdi,%r11,8)
|
||||
adc %rax,%r10
|
||||
mov $0,%r12d
|
||||
adc %rdx,%r12
|
||||
mov 24(%rsi,%r11,8),%rax
|
||||
xor %r8,%r8
|
||||
xor %r9,%r9
|
||||
mul %rcx
|
||||
add %r10,16(%rdi,%r11,8)
|
||||
adc %rax,%r12
|
||||
adc %rdx,%r8
|
||||
mov 32(%rsi,%r11,8),%rax
|
||||
mul %rcx
|
||||
add %r12,24(%rdi,%r11,8)
|
||||
adc %rax,%r8
|
||||
adc %rdx,%r9
|
||||
add $4,%r11
|
||||
mov 8(%rsi,%r11,8),%rax
|
||||
jnc lp
|
||||
skiplp:
|
||||
xor %r10,%r10
|
||||
mul %rcx
|
||||
add %r8,(%rdi,%r11,8)
|
||||
adc %rax,%r9
|
||||
adc %rdx,%r10
|
||||
cmp $2,%r11
|
||||
ja case0
|
||||
jz case1
|
||||
jp case2
|
||||
case3: mov 16(%rsi),%rax
|
||||
mul %rcx
|
||||
add %r9,8(%rdi)
|
||||
adc %rax,%r10
|
||||
mov $0,%r12d
|
||||
adc %rdx,%r12
|
||||
mov 24(%rsi),%rax
|
||||
xor %r8,%r8
|
||||
xor %r9,%r9
|
||||
mul %rcx
|
||||
add %r10,16(%rdi)
|
||||
adc %rax,%r12
|
||||
adc %rdx,%r8
|
||||
mov 32(%rsi),%rax
|
||||
mul %rcx
|
||||
add %r12,24(%rdi)
|
||||
adc %rax,%r8
|
||||
adc %rdx,%r9
|
||||
add %r8,32(%rdi)
|
||||
adc $0,%r9
|
||||
mov -8(%rsp),%r12
|
||||
mov %r9,%rax
|
||||
ret
|
||||
case2: mov 24(%rsi),%rax
|
||||
mul %rcx
|
||||
add %r9,16(%rdi)
|
||||
adc %rax,%r10
|
||||
mov $0,%r12d
|
||||
adc %rdx,%r12
|
||||
mov 32(%rsi),%rax
|
||||
xor %r8,%r8
|
||||
#xor %r9,%r9
|
||||
mul %rcx
|
||||
add %r10,24(%rdi)
|
||||
adc %rax,%r12
|
||||
adc %rdx,%r8
|
||||
add %r12,32(%rdi)
|
||||
adc $0,%r8
|
||||
mov -8(%rsp),%r12
|
||||
mov %r8,%rax
|
||||
ret
|
||||
ALIGN(16)
|
||||
case1: mov 32(%rsi),%rax
|
||||
mul %rcx
|
||||
add %r9,24(%rdi)
|
||||
adc %rax,%r10
|
||||
mov $0,%r12d
|
||||
adc %rdx,%r12
|
||||
add %r10,32(%rdi)
|
||||
adc $0,%r12
|
||||
mov %r12,%rax
|
||||
mov -8(%rsp),%r12
|
||||
ret
|
||||
one: mul %rcx
|
||||
add %rax,(%rdi)
|
||||
adc $0,%rdx
|
||||
mov %rdx,%rax
|
||||
ret
|
||||
case0: add %r9,32(%rdi)
|
||||
adc $0,%r10
|
||||
mov -8(%rsp),%r12
|
||||
mov %r10,%rax
|
||||
ret
|
||||
EPILOGUE()
|
23
mpn/x86_64/fat/add_n.c
Normal file
23
mpn/x86_64/fat/add_n.c
Normal file
@ -0,0 +1,23 @@
|
||||
/* Fat binary fallback mpn_add_n
|
||||
|
||||
Copyright 2011 Jason Moxham
|
||||
|
||||
This file is part of the MPIR Library.
|
||||
|
||||
The MPIR Library is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The MPIR Library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
|
||||
#include "mpn/generic/add_n.c"
|
23
mpn/x86_64/fat/addmul_1.c
Normal file
23
mpn/x86_64/fat/addmul_1.c
Normal file
@ -0,0 +1,23 @@
|
||||
/* Fat binary fallback mpn_addmul_1
|
||||
|
||||
Copyright 2011 Jason Moxham
|
||||
|
||||
This file is part of the MPIR Library.
|
||||
|
||||
The MPIR Library is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The MPIR Library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
|
||||
#include "mpn/generic/addmul_1.c"
|
@ -22,7 +22,5 @@ MA 02110-1301, USA. */
|
||||
#include "mpir.h"
|
||||
#include "gmp-impl.h"
|
||||
|
||||
//#ifndef mpn_copyd
|
||||
void mpn_copyd(mp_ptr rp,mp_srcptr sp,mp_size_t n)
|
||||
{MPN_COPY_DECR(rp,sp,n);return;}
|
||||
//#endif
|
||||
|
@ -22,7 +22,5 @@ MA 02110-1301, USA. */
|
||||
#include "mpir.h"
|
||||
#include "gmp-impl.h"
|
||||
|
||||
//#ifndef mpn_copyi
|
||||
void mpn_copyi(mp_ptr rp,mp_srcptr sp,mp_size_t n)
|
||||
{MPN_COPY_INCR(rp,sp,n);return;}
|
||||
//#endif
|
||||
|
23
mpn/x86_64/fat/lshift.c
Normal file
23
mpn/x86_64/fat/lshift.c
Normal file
@ -0,0 +1,23 @@
|
||||
/* Fat binary fallback mpn_lshift
|
||||
|
||||
Copyright 2011 Jason Moxham
|
||||
|
||||
This file is part of the MPIR Library.
|
||||
|
||||
The MPIR Library is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The MPIR Library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
|
||||
#include "mpn/generic/lshift.c"
|
23
mpn/x86_64/fat/mul_1.c
Normal file
23
mpn/x86_64/fat/mul_1.c
Normal file
@ -0,0 +1,23 @@
|
||||
/* Fat binary fallback mpn_mul_1
|
||||
|
||||
Copyright 2011 Jason Moxham
|
||||
|
||||
This file is part of the MPIR Library.
|
||||
|
||||
The MPIR Library is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The MPIR Library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
|
||||
#include "mpn/generic/mul_1.c"
|
23
mpn/x86_64/fat/rshift.c
Normal file
23
mpn/x86_64/fat/rshift.c
Normal file
@ -0,0 +1,23 @@
|
||||
/* Fat binary fallback mpn_rshift
|
||||
|
||||
Copyright 2011 Jason Moxham
|
||||
|
||||
This file is part of the MPIR Library.
|
||||
|
||||
The MPIR Library is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The MPIR Library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
|
||||
#include "mpn/generic/rshift.c"
|
23
mpn/x86_64/fat/sub_n.c
Normal file
23
mpn/x86_64/fat/sub_n.c
Normal file
@ -0,0 +1,23 @@
|
||||
/* Fat binary fallback mpn_sub_n
|
||||
|
||||
Copyright 2011 Jason Moxham
|
||||
|
||||
This file is part of the MPIR Library.
|
||||
|
||||
The MPIR Library is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The MPIR Library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
|
||||
#include "mpn/generic/sub_n.c"
|
23
mpn/x86_64/fat/submul_1.c
Normal file
23
mpn/x86_64/fat/submul_1.c
Normal file
@ -0,0 +1,23 @@
|
||||
/* Fat binary fallback mpn_submul_1
|
||||
|
||||
Copyright 2011 Jason Moxham
|
||||
|
||||
This file is part of the MPIR Library.
|
||||
|
||||
The MPIR Library is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The MPIR Library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
|
||||
#include "mpn/generic/submul_1.c"
|
@ -1,96 +0,0 @@
|
||||
|
||||
; AMD64 mpn_lshift
|
||||
; Copyright 2008 Jason Moxham
|
||||
; This file is part of the MPIR Library.
|
||||
; The MPIR Library is free software; you can redistribute it and/or modify
|
||||
; it under the terms of the GNU Lesser General Public License as published
|
||||
; by the Free Software Foundation; either version 2.1 of the License, or (at
|
||||
; your option) any later version.
|
||||
; The MPIR Library is distributed in the hope that it will be useful, but
|
||||
; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
; License for more details.
|
||||
; You should have received a copy of the GNU Lesser General Public License
|
||||
; along with the MPIR Library; see the file COPYING.LIB. If not, write
|
||||
; to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
; Boston, MA 02110-1301, USA.
|
||||
|
||||
; (rdi,rdx) = (rsi,rdx)<<rcx
|
||||
; rax = carry
|
||||
|
||||
%include 'yasm_mac.inc'
|
||||
|
||||
BITS 64
|
||||
|
||||
GLOBAL_FUNC mpn_lshift
|
||||
mov eax, 64
|
||||
sub rax, rcx
|
||||
movq mm0, rcx
|
||||
sub rdx, 4
|
||||
movq mm1, rax
|
||||
movq mm5, [rsi+rdx*8+24]
|
||||
movq mm3, mm5
|
||||
psrlq mm5, mm1
|
||||
movq rax, mm5
|
||||
psllq mm3, mm0
|
||||
jbe skiploop
|
||||
align 16
|
||||
loop1
|
||||
movq mm2, [rsi+rdx*8+16]
|
||||
movq mm4, mm2
|
||||
psrlq mm2, mm1
|
||||
por mm3, mm2
|
||||
movq [rdi+rdx*8+24], mm3
|
||||
psllq mm4, mm0
|
||||
movq mm5, [rsi+rdx*8+8]
|
||||
movq mm3, mm5
|
||||
psrlq mm5, mm1
|
||||
por mm4, mm5
|
||||
movq [rdi+rdx*8+16], mm4
|
||||
psllq mm3, mm0
|
||||
movq mm2, [rsi+rdx*8]
|
||||
movq mm4, mm2
|
||||
psrlq mm2, mm1
|
||||
por mm3, mm2
|
||||
movq [rdi+rdx*8+8], mm3
|
||||
psllq mm4, mm0
|
||||
movq mm5, [rsi+rdx*8-8]
|
||||
movq mm3, mm5
|
||||
psrlq mm5, mm1
|
||||
por mm4, mm5
|
||||
movq [rdi+rdx*8], mm4
|
||||
psllq mm3, mm0
|
||||
sub rdx, 4
|
||||
ja loop1
|
||||
skiploop:
|
||||
cmp rdx, -1
|
||||
jl next
|
||||
movq mm2, [rsi+rdx*8+16]
|
||||
movq mm4, mm2
|
||||
psrlq mm2, mm1
|
||||
por mm3, mm2
|
||||
movq [rdi+rdx*8+24], mm3
|
||||
psllq mm4, mm0
|
||||
movq mm5, [rsi+rdx*8+8]
|
||||
movq mm3, mm5
|
||||
psrlq mm5, mm1
|
||||
por mm4, mm5
|
||||
movq [rdi+rdx*8+16], mm4
|
||||
psllq mm3, mm0
|
||||
sub rdx, 2
|
||||
next:
|
||||
test rdx, 1
|
||||
jnz end
|
||||
movq mm2, [rsi+rdx*8+16]
|
||||
movq mm4, mm2
|
||||
psrlq mm2, mm1
|
||||
por mm3, mm2
|
||||
movq [rdi+rdx*8+24], mm3
|
||||
psllq mm4, mm0
|
||||
movq [rdi+rdx*8+16], mm4
|
||||
emms
|
||||
ret
|
||||
end:
|
||||
movq [rdi+rdx*8+24], mm3
|
||||
emms
|
||||
ret
|
@ -1,145 +0,0 @@
|
||||
dnl mpn_mul_1
|
||||
|
||||
dnl Copyright 2011 The Code Cavern
|
||||
|
||||
dnl This file is part of the MPIR Library.
|
||||
|
||||
dnl The MPIR Library is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU Lesser General Public License as published
|
||||
dnl by the Free Software Foundation; either version 2.1 of the License, or (at
|
||||
dnl your option) any later version.
|
||||
|
||||
dnl The MPIR Library is distributed in the hope that it will be useful, but
|
||||
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
dnl License for more details.
|
||||
|
||||
dnl You should have received a copy of the GNU Lesser General Public License
|
||||
dnl along with the MPIR Library; see the file COPYING.LIB. If not, write
|
||||
dnl to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
dnl Boston, MA 02110-1301, USA.
|
||||
|
||||
include(`../config.m4')
|
||||
|
||||
ASM_START()
|
||||
PROLOGUE(mpn_mul_1)
|
||||
mov (%rsi),%rax
|
||||
cmp $1,%rdx
|
||||
je one
|
||||
mov $5,%r11
|
||||
lea -40(%rsi,%rdx,8),%rsi
|
||||
lea -40(%rdi,%rdx,8),%rdi
|
||||
sub %rdx,%r11
|
||||
mul %rcx
|
||||
.byte 0x26
|
||||
mov %rax,%r8
|
||||
.byte 0x26
|
||||
mov 8(%rsi,%r11,8),%rax
|
||||
.byte 0x26
|
||||
mov %rdx,%r9
|
||||
.byte 0x26
|
||||
cmp $0,%r11
|
||||
.byte 0x26
|
||||
mov %r12,-8(%rsp)
|
||||
.byte 0x26
|
||||
jge skiplp
|
||||
lp: xor %r10,%r10
|
||||
mul %rcx
|
||||
mov %r8,(%rdi,%r11,8)
|
||||
add %rax,%r9
|
||||
adc %rdx,%r10
|
||||
mov 16(%rsi,%r11,8),%rax
|
||||
mul %rcx
|
||||
mov %r9,8(%rdi,%r11,8)
|
||||
add %rax,%r10
|
||||
mov $0,%r12d
|
||||
adc %rdx,%r12
|
||||
mov 24(%rsi,%r11,8),%rax
|
||||
xor %r8,%r8
|
||||
xor %r9,%r9
|
||||
mul %rcx
|
||||
mov %r10,16(%rdi,%r11,8)
|
||||
add %rax,%r12
|
||||
adc %rdx,%r8
|
||||
mov 32(%rsi,%r11,8),%rax
|
||||
mul %rcx
|
||||
mov %r12,24(%rdi,%r11,8)
|
||||
add %rax,%r8
|
||||
adc %rdx,%r9
|
||||
add $4,%r11
|
||||
mov 8(%rsi,%r11,8),%rax
|
||||
jnc lp
|
||||
skiplp:
|
||||
xor %r10,%r10
|
||||
mul %rcx
|
||||
mov %r8,(%rdi,%r11,8)
|
||||
add %rax,%r9
|
||||
adc %rdx,%r10
|
||||
cmp $2,%r11
|
||||
ja case0
|
||||
jz case1
|
||||
jp case2
|
||||
case3: mov 16(%rsi),%rax
|
||||
mul %rcx
|
||||
mov %r9,8(%rdi)
|
||||
add %rax,%r10
|
||||
mov $0,%r12d
|
||||
adc %rdx,%r12
|
||||
mov 24(%rsi),%rax
|
||||
xor %r8,%r8
|
||||
xor %r9,%r9
|
||||
mul %rcx
|
||||
mov %r10,16(%rdi)
|
||||
add %rax,%r12
|
||||
adc %rdx,%r8
|
||||
mov 32(%rsi),%rax
|
||||
mul %rcx
|
||||
mov %r12,24(%rdi)
|
||||
add %rax,%r8
|
||||
adc %rdx,%r9
|
||||
mov %r8,32(%rdi)
|
||||
#add $0,%r9
|
||||
mov -8(%rsp),%r12
|
||||
mov %r9,%rax
|
||||
ret
|
||||
case2: mov 24(%rsi),%rax
|
||||
mul %rcx
|
||||
mov %r9,16(%rdi)
|
||||
add %rax,%r10
|
||||
mov $0,%r12d
|
||||
adc %rdx,%r12
|
||||
mov 32(%rsi),%rax
|
||||
xor %r8,%r8
|
||||
#xor %r9,%r9
|
||||
mul %rcx
|
||||
mov %r10,24(%rdi)
|
||||
add %rax,%r12
|
||||
adc %rdx,%r8
|
||||
mov %r12,32(%rdi)
|
||||
#add $0,%r8
|
||||
mov -8(%rsp),%r12
|
||||
mov %r8,%rax
|
||||
ret
|
||||
ALIGN(16)
|
||||
case1: mov 32(%rsi),%rax
|
||||
mul %rcx
|
||||
mov %r9,24(%rdi)
|
||||
add %rax,%r10
|
||||
mov $0,%r12d
|
||||
adc %rdx,%r12
|
||||
mov %r10,32(%rdi)
|
||||
#add $0,%r12
|
||||
mov %r12,%rax
|
||||
mov -8(%rsp),%r12
|
||||
ret
|
||||
one: mul %rcx
|
||||
mov %rax,(%rdi)
|
||||
#add $0,%rdx
|
||||
mov %rdx,%rax
|
||||
ret
|
||||
case0: mov %r9,32(%rdi)
|
||||
#add $0,%r10
|
||||
mov -8(%rsp),%r12
|
||||
mov %r10,%rax
|
||||
ret
|
||||
EPILOGUE()
|
@ -1,139 +0,0 @@
|
||||
dnl mpn_rshift
|
||||
|
||||
dnl Copyright 2009 Jason Moxham
|
||||
|
||||
dnl This file is part of the MPIR Library.
|
||||
|
||||
dnl The MPIR Library is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU Lesser General Public License as published
|
||||
dnl by the Free Software Foundation; either version 2.1 of the License, or (at
|
||||
dnl your option) any later version.
|
||||
|
||||
dnl The MPIR Library is distributed in the hope that it will be useful, but
|
||||
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
dnl License for more details.
|
||||
|
||||
dnl You should have received a copy of the GNU Lesser General Public License
|
||||
dnl along with the MPIR Library; see the file COPYING.LIB. If not, write
|
||||
dnl to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
dnl Boston, MA 02110-1301, USA.
|
||||
|
||||
include(`../config.m4')
|
||||
|
||||
C ret mpn_rshift(mp_ptr,mp_ptr,mp_size_t,ul)
|
||||
C rax rdi, rsi, rdx
|
||||
|
||||
ASM_START()
|
||||
PROLOGUE(mpn_rshift)
|
||||
C below really a movq
|
||||
movd %rcx,%mm0
|
||||
|
||||
mov $64,%rax
|
||||
sub %rcx,%rax
|
||||
|
||||
C below really a movq
|
||||
movd %rax,%mm1
|
||||
|
||||
mov $4,%rcx
|
||||
lea -32(%rsi,%rdx,8),%rsi
|
||||
lea -32(%rdi,%rdx,8),%rdi
|
||||
sub %rdx,%rcx
|
||||
movq (%rsi,%rcx,8),%mm5
|
||||
movq %mm5,%mm3
|
||||
psllq %mm1,%mm5
|
||||
|
||||
C below really a movq
|
||||
movd %mm5,%rax
|
||||
|
||||
psrlq %mm0,%mm3
|
||||
jge skiplp
|
||||
ALIGN(16)
|
||||
lp:
|
||||
movq 8(%rsi,%rcx,8),%mm2
|
||||
movq %mm2,%mm4
|
||||
psllq %mm1,%mm2
|
||||
por %mm2,%mm3
|
||||
movq %mm3,(%rdi,%rcx,8)
|
||||
psrlq %mm0,%mm4
|
||||
movq 16(%rsi,%rcx,8),%mm5
|
||||
movq %mm5,%mm3
|
||||
psllq %mm1,%mm5
|
||||
por %mm5,%mm4
|
||||
movq %mm4,8(%rdi,%rcx,8)
|
||||
psrlq %mm0,%mm3
|
||||
movq 24(%rsi,%rcx,8),%mm2
|
||||
movq %mm2,%mm4
|
||||
psllq %mm1,%mm2
|
||||
por %mm2,%mm3
|
||||
movq 32(%rsi,%rcx,8),%mm5
|
||||
movq %mm3,16(%rdi,%rcx,8)
|
||||
psrlq %mm0,%mm4
|
||||
movq %mm5,%mm3
|
||||
psllq %mm1,%mm5
|
||||
por %mm5,%mm4
|
||||
movq %mm4,24(%rdi,%rcx,8)
|
||||
psrlq %mm0,%mm3
|
||||
add $4,%rcx
|
||||
jnc lp
|
||||
skiplp:
|
||||
cmp $2,%rcx
|
||||
ja case0
|
||||
jz case1
|
||||
jp case2
|
||||
case3:
|
||||
movq 8(%rsi,%rcx,8),%mm2
|
||||
movq %mm2,%mm4
|
||||
psllq %mm1,%mm2
|
||||
por %mm2,%mm3
|
||||
movq %mm3,(%rdi,%rcx,8)
|
||||
psrlq %mm0,%mm4
|
||||
movq 16(%rsi,%rcx,8),%mm5
|
||||
movq %mm5,%mm3
|
||||
psllq %mm1,%mm5
|
||||
por %mm5,%mm4
|
||||
movq %mm4,8(%rdi,%rcx,8)
|
||||
psrlq %mm0,%mm3
|
||||
movq 24(%rsi,%rcx,8),%mm2
|
||||
movq %mm2,%mm4
|
||||
psllq %mm1,%mm2
|
||||
por %mm2,%mm3
|
||||
movq %mm3,16(%rdi,%rcx,8)
|
||||
psrlq %mm0,%mm4
|
||||
movq %mm4,24(%rdi,%rcx,8)
|
||||
emms
|
||||
ret
|
||||
ALIGN(16)
|
||||
case2:
|
||||
movq 8(%rsi,%rcx,8),%mm2
|
||||
movq %mm2,%mm4
|
||||
psllq %mm1,%mm2
|
||||
por %mm2,%mm3
|
||||
movq %mm3,(%rdi,%rcx,8)
|
||||
psrlq %mm0,%mm4
|
||||
movq 16(%rsi,%rcx,8),%mm5
|
||||
movq %mm5,%mm3
|
||||
psllq %mm1,%mm5
|
||||
por %mm5,%mm4
|
||||
movq %mm4,8(%rdi,%rcx,8)
|
||||
psrlq %mm0,%mm3
|
||||
movq %mm3,16(%rdi,%rcx,8)
|
||||
emms
|
||||
ret
|
||||
ALIGN(16)
|
||||
case1:
|
||||
movq 8(%rsi,%rcx,8),%mm2
|
||||
movq %mm2,%mm4
|
||||
psllq %mm1,%mm2
|
||||
por %mm2,%mm3
|
||||
movq %mm3,(%rdi,%rcx,8)
|
||||
psrlq %mm0,%mm4
|
||||
movq %mm4,8(%rdi,%rcx,8)
|
||||
emms
|
||||
ret
|
||||
ALIGN(16)
|
||||
case0:
|
||||
movq %mm3,(%rdi,%rcx,8)
|
||||
emms
|
||||
ret
|
||||
EPILOGUE()
|
@ -1,87 +0,0 @@
|
||||
|
||||
; AMD64 mpn_sub_n
|
||||
; Copyright 2008 Jason Moxham
|
||||
; This file is part of the MPIR Library.
|
||||
; The MPIR Library is free software; you can redistribute it and/or modify
|
||||
; it under the terms of the GNU Lesser General Public License as published
|
||||
; by the Free Software Foundation; either version 2.1 of the License, or (at
|
||||
; your option) any later version.
|
||||
; The MPIR Library is distributed in the hope that it will be useful, but
|
||||
; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
; License for more details.
|
||||
; You should have received a copy of the GNU Lesser General Public License
|
||||
; along with the MPIR Library; see the file COPYING.LIB. If not, write
|
||||
; to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
; Boston, MA 02110-1301, USA.
|
||||
|
||||
; (rdi,rcx)=(rsi,rcx)-(rdx,rcx)
|
||||
; rax=borrow
|
||||
|
||||
%include 'yasm_mac.inc'
|
||||
|
||||
BITS 64
|
||||
|
||||
GLOBAL_FUNC mpn_sub_n
|
||||
mov rax, rcx
|
||||
and rax, 3
|
||||
shr rcx, 2
|
||||
cmp rcx, 0
|
||||
; carry flag is clear here
|
||||
jnz loop1
|
||||
mov r11, [rsi]
|
||||
sub r11, [rdx]
|
||||
mov [rdi], r11
|
||||
dec rax
|
||||
jz end1
|
||||
mov r11, [rsi+8]
|
||||
sbb r11, [rdx+8]
|
||||
mov [rdi+8], r11
|
||||
dec rax
|
||||
jz end1
|
||||
mov r11, [rsi+16]
|
||||
sbb r11, [rdx+16]
|
||||
mov [rdi+16], r11
|
||||
dec rax
|
||||
end1:
|
||||
adc rax, rax
|
||||
ret
|
||||
align 8
|
||||
loop1:
|
||||
mov r11, [rsi]
|
||||
mov r8, [rsi+8]
|
||||
lea rsi, [rsi+32]
|
||||
sbb r11, [rdx]
|
||||
sbb r8, [rdx+8]
|
||||
lea rdx, [rdx+32]
|
||||
mov [rdi], r11
|
||||
mov [rdi+8], r8
|
||||
lea rdi, [rdi+32]
|
||||
mov r9, [rsi-16]
|
||||
mov r10, [rsi-8]
|
||||
sbb r9, [rdx-16]
|
||||
sbb r10, [rdx-8]
|
||||
mov [rdi-16], r9
|
||||
dec rcx
|
||||
mov [rdi-8], r10
|
||||
jnz loop1
|
||||
inc rax
|
||||
dec rax
|
||||
jz end
|
||||
mov r11, [rsi]
|
||||
sbb r11, [rdx]
|
||||
mov [rdi], r11
|
||||
dec rax
|
||||
jz end
|
||||
mov r11, [rsi+8]
|
||||
sbb r11, [rdx+8]
|
||||
mov [rdi+8], r11
|
||||
dec rax
|
||||
jz end
|
||||
mov r11, [rsi+16]
|
||||
sbb r11, [rdx+16]
|
||||
mov [rdi+16], r11
|
||||
dec rax
|
||||
end:
|
||||
adc rax, rax
|
||||
ret
|
@ -1,145 +0,0 @@
|
||||
dnl mpn_submul_1
|
||||
|
||||
dnl Copyright 2011 The Code Cavern
|
||||
|
||||
dnl This file is part of the MPIR Library.
|
||||
|
||||
dnl The MPIR Library is free software; you can redistribute it and/or modify
|
||||
dnl it under the terms of the GNU Lesser General Public License as published
|
||||
dnl by the Free Software Foundation; either version 2.1 of the License, or (at
|
||||
dnl your option) any later version.
|
||||
|
||||
dnl The MPIR Library is distributed in the hope that it will be useful, but
|
||||
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
dnl License for more details.
|
||||
|
||||
dnl You should have received a copy of the GNU Lesser General Public License
|
||||
dnl along with the MPIR Library; see the file COPYING.LIB. If not, write
|
||||
dnl to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
dnl Boston, MA 02110-1301, USA.
|
||||
|
||||
include(`../config.m4')
|
||||
|
||||
ASM_START()
|
||||
PROLOGUE(mpn_submul_1)
|
||||
mov (%rsi),%rax
|
||||
cmp $1,%rdx
|
||||
je one
|
||||
mov $5,%r11
|
||||
lea -40(%rsi,%rdx,8),%rsi
|
||||
lea -40(%rdi,%rdx,8),%rdi
|
||||
sub %rdx,%r11
|
||||
mul %rcx
|
||||
.byte 0x26
|
||||
mov %rax,%r8
|
||||
.byte 0x26
|
||||
mov 8(%rsi,%r11,8),%rax
|
||||
.byte 0x26
|
||||
mov %rdx,%r9
|
||||
.byte 0x26
|
||||
cmp $0,%r11
|
||||
.byte 0x26
|
||||
mov %r12,-8(%rsp)
|
||||
.byte 0x26
|
||||
jge skiplp
|
||||
lp: xor %r10,%r10
|
||||
mul %rcx
|
||||
sub %r8,(%rdi,%r11,8)
|
||||
adc %rax,%r9
|
||||
adc %rdx,%r10
|
||||
mov 16(%rsi,%r11,8),%rax
|
||||
mul %rcx
|
||||
sub %r9,8(%rdi,%r11,8)
|
||||
adc %rax,%r10
|
||||
mov $0,%r12d
|
||||
adc %rdx,%r12
|
||||
mov 24(%rsi,%r11,8),%rax
|
||||
xor %r8,%r8
|
||||
xor %r9,%r9
|
||||
mul %rcx
|
||||
sub %r10,16(%rdi,%r11,8)
|
||||
adc %rax,%r12
|
||||
adc %rdx,%r8
|
||||
mov 32(%rsi,%r11,8),%rax
|
||||
mul %rcx
|
||||
sub %r12,24(%rdi,%r11,8)
|
||||
adc %rax,%r8
|
||||
adc %rdx,%r9
|
||||
add $4,%r11
|
||||
mov 8(%rsi,%r11,8),%rax
|
||||
jnc lp
|
||||
skiplp:
|
||||
xor %r10,%r10
|
||||
mul %rcx
|
||||
sub %r8,(%rdi,%r11,8)
|
||||
adc %rax,%r9
|
||||
adc %rdx,%r10
|
||||
cmp $2,%r11
|
||||
ja case0
|
||||
jz case1
|
||||
jp case2
|
||||
case3: mov 16(%rsi),%rax
|
||||
mul %rcx
|
||||
sub %r9,8(%rdi)
|
||||
adc %rax,%r10
|
||||
mov $0,%r12d
|
||||
adc %rdx,%r12
|
||||
mov 24(%rsi),%rax
|
||||
xor %r8,%r8
|
||||
xor %r9,%r9
|
||||
mul %rcx
|
||||
sub %r10,16(%rdi)
|
||||
adc %rax,%r12
|
||||
adc %rdx,%r8
|
||||
mov 32(%rsi),%rax
|
||||
mul %rcx
|
||||
sub %r12,24(%rdi)
|
||||
adc %rax,%r8
|
||||
adc %rdx,%r9
|
||||
sub %r8,32(%rdi)
|
||||
adc $0,%r9
|
||||
mov -8(%rsp),%r12
|
||||
mov %r9,%rax
|
||||
ret
|
||||
case2: mov 24(%rsi),%rax
|
||||
mul %rcx
|
||||
sub %r9,16(%rdi)
|
||||
adc %rax,%r10
|
||||
mov $0,%r12d
|
||||
adc %rdx,%r12
|
||||
mov 32(%rsi),%rax
|
||||
xor %r8,%r8
|
||||
#xor %r9,%r9
|
||||
mul %rcx
|
||||
sub %r10,24(%rdi)
|
||||
adc %rax,%r12
|
||||
adc %rdx,%r8
|
||||
sub %r12,32(%rdi)
|
||||
adc $0,%r8
|
||||
mov -8(%rsp),%r12
|
||||
mov %r8,%rax
|
||||
ret
|
||||
ALIGN(16)
|
||||
case1: mov 32(%rsi),%rax
|
||||
mul %rcx
|
||||
sub %r9,24(%rdi)
|
||||
adc %rax,%r10
|
||||
mov $0,%r12d
|
||||
adc %rdx,%r12
|
||||
sub %r10,32(%rdi)
|
||||
adc $0,%r12
|
||||
mov %r12,%rax
|
||||
mov -8(%rsp),%r12
|
||||
ret
|
||||
one: mul %rcx
|
||||
sub %rax,(%rdi)
|
||||
adc $0,%rdx
|
||||
mov %rdx,%rax
|
||||
ret
|
||||
case0: sub %r9,32(%rdi)
|
||||
adc $0,%r10
|
||||
mov -8(%rsp),%r12
|
||||
mov %r10,%rax
|
||||
ret
|
||||
EPILOGUE()
|
Loading…
Reference in New Issue
Block a user