2009-02-27 09:24:25 -05:00
|
|
|
|
2009-09-02 13:20:55 -04:00
|
|
|
; Version 1.0.3.
|
|
|
|
;
|
|
|
|
; Copyright 2008 Jason Moxham
|
|
|
|
;
|
|
|
|
; Windows Conversion Copyright 2008 Brian Gladman
|
|
|
|
;
|
2009-02-27 09:24:25 -05:00
|
|
|
; This file is part of the MPIR Library.
|
2009-09-02 13:20:55 -04:00
|
|
|
;
|
2009-02-27 09:24:25 -05: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.
|
2009-09-02 13:20:55 -04:00
|
|
|
;
|
2009-02-27 09:24:25 -05:00
|
|
|
; 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.
|
2009-09-02 13:20:55 -04:00
|
|
|
;
|
2009-02-27 09:24:25 -05:00
|
|
|
; 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_lshift(mp_ptr, mp_ptr, mp_size_t, mp_uint)
|
|
|
|
; rax rdi rsi rdx rcx
|
2010-07-02 07:52:24 -04:00
|
|
|
; rax rcx rdx r8 r9d
|
2009-02-27 09:24:25 -05:00
|
|
|
|
2010-08-15 06:08:57 -04:00
|
|
|
%include "yasm_mac.inc"
|
2009-02-27 09:24:25 -05:00
|
|
|
|
2009-07-28 11:00:00 -04:00
|
|
|
%define reg_save_list rbx, rsi, rdi
|
2009-02-27 09:24:25 -05:00
|
|
|
|
2009-07-28 11:00:00 -04:00
|
|
|
CPU Athlon64
|
|
|
|
BITS 64
|
2009-03-13 16:32:09 -04:00
|
|
|
|
2009-07-28 11:00:00 -04:00
|
|
|
FRAME_PROC mpn_lshift, 0, reg_save_list
|
|
|
|
; odd and even n seem to have different runtimes
|
2010-07-02 07:52:24 -04:00
|
|
|
mov rbx, r8
|
2009-07-28 12:29:28 -04:00
|
|
|
lea rsi, [rdx+24]
|
|
|
|
lea rdi, [rcx+24]
|
2010-07-02 07:52:24 -04:00
|
|
|
mov ecx, r9d
|
2009-07-28 12:29:28 -04:00
|
|
|
|
|
|
|
mov rdx, [rsi+rbx*8-32]
|
|
|
|
xor rax, rax
|
|
|
|
shld rax, rdx, cl
|
|
|
|
sub rbx, 5
|
2009-12-02 11:24:00 -05:00
|
|
|
js .2
|
2010-07-22 07:33:16 -04:00
|
|
|
|
2009-07-28 12:29:28 -04:00
|
|
|
xalign 16
|
2010-07-22 07:33:16 -04:00
|
|
|
.1: mov r8, [rsi+rbx*8]
|
2009-07-28 12:29:28 -04:00
|
|
|
mov r11, [rsi+rbx*8-24]
|
|
|
|
mov r9, [rsi+rbx*8-8]
|
|
|
|
shld rdx, r8, cl
|
|
|
|
mov [rdi+rbx*8+8], rdx
|
|
|
|
mov rdx, r11
|
|
|
|
mov r10, [rsi+rbx*8-16]
|
|
|
|
shld r8, r9, cl
|
|
|
|
shld r9, r10, cl
|
|
|
|
mov [rdi+rbx*8], r8
|
|
|
|
mov [rdi+rbx*8-8], r9
|
|
|
|
shld r10, r11, cl
|
|
|
|
sub rbx, 4
|
|
|
|
mov [rdi+rbx*8+16], r10
|
2009-12-02 11:24:00 -05:00
|
|
|
jns .1
|
2010-07-22 07:33:16 -04:00
|
|
|
.2: cmp rbx, -2
|
2009-12-02 11:24:00 -05:00
|
|
|
ja .4
|
|
|
|
je .5
|
|
|
|
jp .6
|
2009-07-28 11:00:00 -04:00
|
|
|
; ALIGN(16)
|
2010-07-22 07:33:16 -04:00
|
|
|
.3: shl rdx, cl
|
2009-07-28 12:29:28 -04:00
|
|
|
mov [rdi+rbx*8+8], rdx
|
2010-07-22 07:33:16 -04:00
|
|
|
EXIT_PROC reg_save_list
|
2009-03-13 16:32:09 -04:00
|
|
|
|
2009-07-28 12:29:28 -04:00
|
|
|
xalign 16
|
2010-07-22 07:33:16 -04:00
|
|
|
.4: mov r8, [rsi+rbx*8]
|
2009-07-28 12:29:28 -04:00
|
|
|
mov r9, [rsi+rbx*8-8]
|
|
|
|
shld rdx, r8, cl
|
|
|
|
mov [rdi+rbx*8+8], rdx
|
|
|
|
mov r10, [rsi+rbx*8-16]
|
|
|
|
shld r8, r9, cl
|
|
|
|
shld r9, r10, cl
|
|
|
|
mov [rdi+rbx*8], r8
|
|
|
|
mov [rdi+rbx*8-8], r9
|
|
|
|
shl r10, cl
|
|
|
|
mov [rdi+rbx*8-16], r10
|
2010-07-22 07:33:16 -04:00
|
|
|
EXIT_PROC reg_save_list
|
2009-03-13 16:32:09 -04:00
|
|
|
|
2009-07-28 12:29:28 -04:00
|
|
|
xalign 16
|
2010-07-22 07:33:16 -04:00
|
|
|
.5: mov r8, [rsi+rbx*8]
|
2009-07-28 12:29:28 -04:00
|
|
|
mov r9, [rsi+rbx*8-8]
|
|
|
|
shld rdx, r8, cl
|
|
|
|
mov [rdi+rbx*8+8], rdx
|
|
|
|
shld r8, r9, cl
|
|
|
|
shl r9, cl
|
|
|
|
mov [rdi+rbx*8], r8
|
|
|
|
mov [rdi+rbx*8-8], r9
|
2010-07-22 07:33:16 -04:00
|
|
|
EXIT_PROC reg_save_list
|
2009-07-28 12:29:28 -04:00
|
|
|
|
|
|
|
xalign 16
|
2010-07-22 07:33:16 -04:00
|
|
|
.6: mov r8, [rsi+rbx*8]
|
2009-07-28 12:29:28 -04:00
|
|
|
shld rdx, r8, cl
|
|
|
|
mov [rdi+rbx*8+8], rdx
|
|
|
|
shl r8, cl
|
|
|
|
mov [rdi+rbx*8], r8
|
2010-07-22 07:33:16 -04:00
|
|
|
.7: END_PROC reg_save_list
|
2009-03-13 16:32:09 -04:00
|
|
|
|
|
|
|
end
|