2009-02-19 18:22:30 -05:00
|
|
|
|
|
|
|
; Copyright 2008 Jason Moxham
|
2009-02-22 16:03:08 -05:00
|
|
|
;
|
|
|
|
; Windows Conversion Copyright 2008 Brian Gladman
|
|
|
|
;
|
2009-02-19 18:22:30 -05:00
|
|
|
; This file is part of the MPIR Library.
|
2009-09-02 07:41:43 -04:00
|
|
|
;
|
2009-02-19 18:22:30 -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.
|
|
|
|
; 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-02-22 16:03:08 -05:00
|
|
|
;
|
2009-09-02 07:41:43 -04:00
|
|
|
; mp_limb_t mpn_lshift1(mp_ptr, mp_ptr, mp_size_t)
|
|
|
|
; rax rdi rsi rdx
|
2010-07-02 07:52:24 -04:00
|
|
|
; rax rcx rdx r8
|
2009-02-19 18:22:30 -05:00
|
|
|
|
2009-03-07 10:00:35 -05:00
|
|
|
%include "..\yasm_mac.inc"
|
2009-02-19 18:22:30 -05:00
|
|
|
|
2009-03-24 10:40:39 -04:00
|
|
|
CPU Athlon64
|
2009-03-07 10:00:35 -05:00
|
|
|
BITS 64
|
2009-03-13 16:32:09 -04:00
|
|
|
|
2009-09-02 07:41:43 -04:00
|
|
|
LEAF_PROC mpn_lshift1
|
2010-07-02 07:52:24 -04:00
|
|
|
mov rax, r8
|
2009-09-02 07:41:43 -04:00
|
|
|
and r8, 7
|
|
|
|
inc r8
|
|
|
|
mov [rsp+0x18], r8
|
|
|
|
shr rax, 3
|
|
|
|
cmp rax, 0
|
2009-12-02 11:24:00 -05:00
|
|
|
jz .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 r8, [rdx]
|
|
|
|
mov r9, [rdx+8]
|
|
|
|
mov r10, [rdx+16]
|
|
|
|
mov r11, [rdx+24]
|
|
|
|
adc r8, r8
|
|
|
|
adc r9, r9
|
|
|
|
adc r10, r10
|
|
|
|
adc r11, r11
|
|
|
|
mov [rcx], r8
|
|
|
|
mov [rcx+8], r9
|
|
|
|
mov [rcx+16], r10
|
|
|
|
mov [rcx+24], r11
|
|
|
|
mov r8, [rdx+32]
|
|
|
|
mov r9, [rdx+40]
|
|
|
|
mov r10, [rdx+48]
|
|
|
|
mov r11, [rdx+56]
|
|
|
|
adc r8, r8
|
|
|
|
adc r9, r9
|
|
|
|
adc r10, r10
|
|
|
|
adc r11, r11
|
|
|
|
mov [rcx+32], r8
|
|
|
|
mov [rcx+40], r9
|
|
|
|
mov [rcx+48], r10
|
|
|
|
mov [rcx+56], r11
|
|
|
|
lea rcx, [rcx+64]
|
|
|
|
dec rax
|
|
|
|
lea rdx, [rdx+64]
|
2009-12-02 11:24:00 -05:00
|
|
|
jnz .1
|
|
|
|
.2:
|
2009-09-02 07:41:43 -04:00
|
|
|
mov rax, [rsp+0x18]
|
|
|
|
dec rax
|
2009-12-02 11:24:00 -05:00
|
|
|
jz .3
|
2009-09-02 07:41:43 -04:00
|
|
|
; Could still have cache-bank conflicts in this tail part
|
|
|
|
mov r8, [rdx]
|
|
|
|
adc r8, r8
|
|
|
|
mov [rcx], r8
|
|
|
|
dec rax
|
2009-12-02 11:24:00 -05:00
|
|
|
jz .3
|
2009-09-02 07:41:43 -04:00
|
|
|
mov r8, [rdx+8]
|
|
|
|
adc r8, r8
|
|
|
|
mov [rcx+8], r8
|
|
|
|
dec rax
|
2009-12-02 11:24:00 -05:00
|
|
|
jz .3
|
2009-09-02 07:41:43 -04:00
|
|
|
mov r8, [rdx+16]
|
|
|
|
adc r8, r8
|
|
|
|
mov [rcx+16], r8
|
|
|
|
dec rax
|
2009-12-02 11:24:00 -05:00
|
|
|
jz .3
|
2009-09-02 07:41:43 -04:00
|
|
|
mov r8, [rdx+24]
|
|
|
|
adc r8, r8
|
|
|
|
mov [rcx+24], r8
|
|
|
|
dec rax
|
2009-12-02 11:24:00 -05:00
|
|
|
jz .3
|
2009-09-02 07:41:43 -04:00
|
|
|
mov r8, [rdx+32]
|
|
|
|
adc r8, r8
|
|
|
|
mov [rcx+32], r8
|
|
|
|
dec rax
|
2009-12-02 11:24:00 -05:00
|
|
|
jz .3
|
2009-09-02 07:41:43 -04:00
|
|
|
mov r8, [rdx+40]
|
|
|
|
adc r8, r8
|
|
|
|
mov [rcx+40], r8
|
|
|
|
dec rax
|
2009-12-02 11:24:00 -05:00
|
|
|
jz .3
|
2009-09-02 07:41:43 -04:00
|
|
|
mov r8, [rdx+48]
|
|
|
|
adc r8, r8
|
|
|
|
mov [rcx+48], r8
|
2009-12-02 11:24:00 -05:00
|
|
|
.3:
|
|
|
|
sbb rax, rax
|
2009-09-02 07:41:43 -04:00
|
|
|
neg rax
|
|
|
|
ret
|
2009-12-02 11:24:00 -05:00
|
|
|
|
|
|
|
end
|