2009-09-02 07:41:43 -04:00
|
|
|
|
|
|
|
; Copyright 2009 Jason Moxham
|
|
|
|
;
|
|
|
|
; Windows Conversion Copyright 2008 Brian Gladman
|
|
|
|
;
|
2009-09-02 13:20:55 -04:00
|
|
|
; This file is part of the MPIR Library.
|
|
|
|
;
|
2009-09-02 07:41:43 -04:00
|
|
|
; 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.
|
|
|
|
;
|
2009-09-02 13:20:55 -04:00
|
|
|
; mp_limb_t mpn_addlsh_n(mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_uint, mp_limb_t)
|
|
|
|
; mp_limb_t mpn_addlsh_nc(mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_uint)
|
|
|
|
; rax rdi rsi rdx rcx r8 r9
|
|
|
|
; rax rcx rdx r8 r9d [rsp+40] [rsp+48]
|
2009-09-02 07:41:43 -04:00
|
|
|
|
2009-09-02 09:35:23 -04:00
|
|
|
%include "..\yasm_mac.inc"
|
2009-09-02 07:41:43 -04:00
|
|
|
|
|
|
|
CPU Core2
|
|
|
|
BITS 64
|
|
|
|
|
2009-09-02 13:20:55 -04:00
|
|
|
%define reg_save_list rbx, rsi, rdi, r12
|
|
|
|
|
2009-09-02 07:41:43 -04:00
|
|
|
FRAME_PROC mpn_addlsh_n, 0, reg_save_list
|
|
|
|
movsxd rax, r9d
|
|
|
|
lea rdi, [rcx+rax*8-32]
|
|
|
|
lea rsi, [rdx+rax*8-32]
|
|
|
|
lea rdx, [r8+rax*8-32]
|
|
|
|
mov rcx, rax
|
|
|
|
mov r8d, dword [rsp+stack_use+40]
|
|
|
|
|
|
|
|
mov rbx, 4
|
|
|
|
sub rbx, rcx
|
|
|
|
mov rcx, 64
|
|
|
|
sub rcx, r8
|
|
|
|
mov r12, 0
|
|
|
|
mov rax, 0
|
|
|
|
mov r8, [rdx+rbx*8]
|
|
|
|
cmp rbx, 0
|
2009-12-02 11:24:00 -05:00
|
|
|
jge .2
|
2009-09-02 07:41:43 -04:00
|
|
|
|
|
|
|
xalign 16
|
2009-12-02 11:24:00 -05:00
|
|
|
.1:
|
2009-09-02 07:41:43 -04:00
|
|
|
mov r9, [rdx+rbx*8+8]
|
|
|
|
mov r10, [rdx+rbx*8+16]
|
|
|
|
mov r11, [rdx+rbx*8+24]
|
|
|
|
shrd r12, r8, cl
|
|
|
|
shrd r8, r9, cl
|
|
|
|
shrd r9, r10, cl
|
|
|
|
shrd r10, r11, cl
|
|
|
|
sahf
|
|
|
|
adc r12, [rsi+rbx*8]
|
|
|
|
mov [rdi+rbx*8], r12
|
|
|
|
adc r8, [rsi+rbx*8+8]
|
|
|
|
mov r12, r11
|
|
|
|
mov [rdi+rbx*8+8], r8
|
|
|
|
adc r9, [rsi+rbx*8+16]
|
|
|
|
adc r10, [rsi+rbx*8+24]
|
|
|
|
mov [rdi+rbx*8+24], r10
|
|
|
|
mov [rdi+rbx*8+16], r9
|
|
|
|
lahf
|
|
|
|
mov r8, [rdx+rbx*8+32]
|
|
|
|
add rbx, 4
|
2009-12-02 11:24:00 -05:00
|
|
|
jnc .1
|
2009-09-02 13:20:55 -04:00
|
|
|
|
2009-09-02 07:41:43 -04:00
|
|
|
xalign 16
|
2009-12-02 11:24:00 -05:00
|
|
|
.2:
|
2009-09-02 07:41:43 -04:00
|
|
|
cmp rbx, 2
|
2009-12-02 11:24:00 -05:00
|
|
|
ja .6
|
|
|
|
je .5
|
|
|
|
jp .4
|
|
|
|
.3:
|
2009-09-02 07:41:43 -04:00
|
|
|
shrd r12, r8, cl
|
|
|
|
mov r9, [rdx+rbx*8+8]
|
|
|
|
mov r10, [rdx+rbx*8+16]
|
|
|
|
mov r11, [rdx+rbx*8+24]
|
|
|
|
shrd r8, r9, cl
|
|
|
|
shrd r9, r10, cl
|
|
|
|
shrd r10, r11, cl
|
|
|
|
sahf
|
|
|
|
adc r12, [rsi+rbx*8]
|
|
|
|
mov [rdi+rbx*8], r12
|
|
|
|
adc r8, [rsi+rbx*8+8]
|
|
|
|
mov r12, r11
|
|
|
|
mov [rdi+rbx*8+8], r8
|
|
|
|
adc r9, [rsi+rbx*8+16]
|
|
|
|
adc r10, [rsi+rbx*8+24]
|
|
|
|
mov [rdi+rbx*8+24], r10
|
|
|
|
mov [rdi+rbx*8+16], r9
|
|
|
|
lahf
|
|
|
|
shr r12, cl
|
|
|
|
sahf
|
|
|
|
adc r12, 0
|
|
|
|
mov rax, r12
|
2009-12-02 11:24:00 -05:00
|
|
|
jmp .7
|
|
|
|
.4:
|
2009-09-02 07:41:43 -04:00
|
|
|
shrd r12, r8, cl
|
|
|
|
mov r9, [rdx+rbx*8+8]
|
|
|
|
shrd r8, r9, cl
|
|
|
|
mov r10, [rdx+rbx*8+16]
|
|
|
|
shrd r9, r10, cl
|
|
|
|
shr r10, cl
|
|
|
|
sahf
|
|
|
|
adc r12, [rsi+rbx*8]
|
|
|
|
mov [rdi+rbx*8], r12
|
|
|
|
adc r8, [rsi+rbx*8+8]
|
|
|
|
mov rax, 0
|
|
|
|
mov [rdi+rbx*8+8], r8
|
|
|
|
adc r9, [rsi+rbx*8+16]
|
|
|
|
adc rax, r10
|
|
|
|
mov [rdi+rbx*8+16], r9
|
2009-12-02 11:24:00 -05:00
|
|
|
jmp .7
|
|
|
|
.5:
|
2009-09-02 07:41:43 -04:00
|
|
|
shrd r12, r8, cl
|
|
|
|
mov r9, [rdx+rbx*8+8]
|
|
|
|
shrd r8, r9, cl
|
|
|
|
shr r9, cl
|
|
|
|
sahf
|
|
|
|
adc r12, [rsi+rbx*8]
|
|
|
|
mov [rdi+rbx*8], r12
|
|
|
|
adc r8, [rsi+rbx*8+8]
|
|
|
|
mov rax, 0
|
|
|
|
mov [rdi+rbx*8+8], r8
|
|
|
|
adc rax, r9
|
2009-12-02 11:24:00 -05:00
|
|
|
jmp .7
|
|
|
|
.6:
|
2009-09-02 07:41:43 -04:00
|
|
|
shrd r12, r8, cl
|
|
|
|
shr r8, cl
|
|
|
|
sahf
|
|
|
|
adc r12, [rsi+rbx*8]
|
|
|
|
mov [rdi+rbx*8], r12
|
|
|
|
adc r8, 0
|
|
|
|
mov rax, r8
|
2009-12-02 11:24:00 -05:00
|
|
|
.7:
|
2009-09-02 07:41:43 -04:00
|
|
|
END_PROC reg_save_list
|
2009-09-02 13:20:55 -04:00
|
|
|
|
2009-09-02 07:41:43 -04:00
|
|
|
end
|