2009-07-28 11:00:00 -04:00
|
|
|
|
|
|
|
; Copyright 2009 Jason Moxham
|
2009-09-02 07:41:43 -04:00
|
|
|
;
|
|
|
|
; Windows Conversion Copyright 2008 Brian Gladman
|
|
|
|
;
|
2009-07-28 11:00:00 -04:00
|
|
|
; This file is part of the MPIR Library.
|
2009-09-02 07:41:43 -04:00
|
|
|
;
|
2009-07-28 11:00:00 -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 07:41:43 -04:00
|
|
|
; mp_limb_t mpn_rshift2(mp_ptr, mp_ptr, mp_size_t)
|
|
|
|
; rax rdi rsi rdx
|
2010-07-02 07:52:24 -04:00
|
|
|
; rax rcx rdx r8
|
2009-07-28 11:00:00 -04:00
|
|
|
|
|
|
|
%include "..\yasm_mac.inc"
|
|
|
|
|
|
|
|
%define reg_save_list rsi, rdi
|
|
|
|
|
|
|
|
CPU Athlon64
|
|
|
|
BITS 64
|
|
|
|
|
|
|
|
FRAME_PROC mpn_rshift2, 0, reg_save_list
|
|
|
|
lea rsi, [rdx+24]
|
|
|
|
lea rdi, [rcx+24]
|
2010-07-02 07:52:24 -04:00
|
|
|
mov rcx, r8
|
2009-07-28 11:00:00 -04:00
|
|
|
xor eax, eax
|
|
|
|
xor edx, edx
|
|
|
|
sub rcx, 4
|
2009-12-02 11:24:00 -05:00
|
|
|
jc .2
|
|
|
|
|
2009-07-28 11:00:00 -04:00
|
|
|
xalign 16
|
2010-07-22 07:33:16 -04:00
|
|
|
.1: mov r8, [rsi+rcx*8]
|
2009-07-28 11:00:00 -04:00
|
|
|
mov r9, [rsi+rcx*8-8]
|
|
|
|
mov r10, [rsi+rcx*8-16]
|
|
|
|
mov r11, [rsi+rcx*8-24]
|
|
|
|
add rax, rax
|
|
|
|
rcr r8, 1
|
|
|
|
rcr r9, 1
|
|
|
|
rcr r10, 1
|
|
|
|
rcr r11, 1
|
|
|
|
sbb rax, rax
|
|
|
|
add rdx, rdx
|
|
|
|
rcr r8, 1
|
|
|
|
rcr r9, 1
|
|
|
|
rcr r10, 1
|
|
|
|
rcr r11, 1
|
|
|
|
mov [rdi+rcx*8-24], r11
|
|
|
|
sbb rdx, rdx
|
|
|
|
mov [rdi+rcx*8], r8
|
|
|
|
sub rcx, 4
|
|
|
|
mov [rdi+rcx*8+24], r9
|
|
|
|
mov [rdi+rcx*8+16], r10
|
2009-12-02 11:24:00 -05:00
|
|
|
jnc .1
|
2010-07-22 07:33:16 -04:00
|
|
|
.2: cmp rcx, -2
|
2009-12-02 11:24:00 -05:00
|
|
|
ja .4
|
|
|
|
je .5
|
|
|
|
jp .6
|
2010-07-22 07:33:16 -04:00
|
|
|
.3: lea rax, [rax+rdx*2]
|
2009-07-28 11:00:00 -04:00
|
|
|
neg rax
|
|
|
|
shl rax, 62
|
2010-07-22 07:33:16 -04:00
|
|
|
EXIT_PROC reg_save_list
|
2009-07-28 11:00:00 -04:00
|
|
|
|
|
|
|
xalign 16
|
2010-07-22 07:33:16 -04:00
|
|
|
.4: mov r8, [rsi+rcx*8]
|
2009-07-28 11:00:00 -04:00
|
|
|
mov r9, [rsi+rcx*8-8]
|
|
|
|
mov r10, [rsi+rcx*8-16]
|
|
|
|
add rax, rax
|
|
|
|
rcr r8, 1
|
|
|
|
rcr r9, 1
|
|
|
|
rcr r10, 1
|
|
|
|
sbb rax, rax
|
|
|
|
add rdx, rdx
|
|
|
|
rcr r8, 1
|
|
|
|
rcr r9, 1
|
|
|
|
rcr r10, 1
|
|
|
|
sbb rdx, rdx
|
|
|
|
mov [rdi+rcx*8], r8
|
|
|
|
mov [rdi+rcx*8-8], r9
|
|
|
|
mov [rdi+rcx*8-16], r10
|
|
|
|
lea rax, [rax+rdx*2]
|
|
|
|
neg rax
|
|
|
|
shl rax, 62
|
2010-07-22 07:33:16 -04:00
|
|
|
EXIT_PROC reg_save_list
|
2009-07-28 11:00:00 -04:00
|
|
|
|
|
|
|
xalign 16
|
2010-07-22 07:33:16 -04:00
|
|
|
.5: mov r8, [rsi+rcx*8]
|
2009-07-28 11:00:00 -04:00
|
|
|
mov r9, [rsi+rcx*8-8]
|
|
|
|
add rax, rax
|
|
|
|
rcr r8, 1
|
|
|
|
rcr r9, 1
|
|
|
|
sbb rax, rax
|
|
|
|
add rdx, rdx
|
|
|
|
rcr r8, 1
|
|
|
|
rcr r9, 1
|
|
|
|
sbb rdx, rdx
|
|
|
|
mov [rdi+rcx*8], r8
|
|
|
|
mov [rdi+rcx*8-8], r9
|
|
|
|
lea rax, [rax+rdx*2]
|
|
|
|
neg rax
|
|
|
|
shl rax, 62
|
2010-07-22 07:33:16 -04:00
|
|
|
EXIT_PROC reg_save_list
|
2009-07-28 11:00:00 -04:00
|
|
|
|
|
|
|
xalign 16
|
2010-07-22 07:33:16 -04:00
|
|
|
.6: mov r8, [rsi+rcx*8]
|
2009-07-28 11:00:00 -04:00
|
|
|
add rax, rax
|
|
|
|
rcr r8, 1
|
|
|
|
sbb rax, rax
|
|
|
|
add rdx, rdx
|
|
|
|
rcr r8, 1
|
|
|
|
sbb rdx, rdx
|
|
|
|
mov [rdi+rcx*8], r8
|
|
|
|
lea rax, [rax+rdx*2]
|
|
|
|
neg rax
|
|
|
|
shl rax, 62
|
2010-07-22 07:33:16 -04:00
|
|
|
.7: END_PROC reg_save_list
|
2009-07-28 11:00:00 -04:00
|
|
|
|
2009-12-02 11:24:00 -05:00
|
|
|
end
|