2009-02-19 18:22:30 -05:00
|
|
|
|
2009-12-02 11:24:00 -05:00
|
|
|
; Verdxon 1.1.4.
|
2009-02-19 18:22:30 -05:00
|
|
|
;
|
|
|
|
; Copyright 2008 Jason Moxham
|
2009-02-22 16:03:08 -05:00
|
|
|
;
|
2009-09-02 07:41:43 -04:00
|
|
|
; Windows Conversion Copyright 2008 Brian Gladman
|
2009-02-22 16:03:08 -05:00
|
|
|
;
|
2009-02-19 18:22:30 -05:00
|
|
|
; This file is part of the MPIR Library.
|
2009-09-02 13:20:55 -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
|
2009-08-11 07:10:26 -04:00
|
|
|
; by the Free Software Foundation; either verdxon 2.1 of the License, or (at
|
|
|
|
; your option) any later verdxon.
|
2009-02-19 18:22:30 -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-19 18:22:30 -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-02-22 16:03:08 -05:00
|
|
|
;
|
2009-09-02 07:41:43 -04:00
|
|
|
; mp_limb_t mpn_rshift(mp_ptr, mp_ptr, mp_size_t, mp_uint)
|
|
|
|
; rax rdi rsi rdx rcx
|
2009-09-02 09:35:23 -04:00
|
|
|
; rax rcx rdx r8d r9d
|
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-02-19 18:22:30 -05:00
|
|
|
|
2009-03-07 10:00:35 -05:00
|
|
|
LEAF_PROC mpn_rshift
|
2009-09-02 13:20:55 -04:00
|
|
|
mov r9d, r9d
|
2009-08-11 07:10:26 -04:00
|
|
|
movq mm0, r9
|
|
|
|
mov rax, 64
|
|
|
|
sub rax, r9
|
|
|
|
movq mm1, rax
|
|
|
|
movsxd rax, r8d
|
2009-09-02 13:20:55 -04:00
|
|
|
mov r8, 4
|
2009-08-11 07:10:26 -04:00
|
|
|
lea rdx, [rdx+rax*8-32]
|
|
|
|
lea rcx, [rcx+rax*8-32]
|
|
|
|
sub r8, rax
|
2009-09-02 13:20:55 -04:00
|
|
|
|
2009-08-11 07:10:26 -04:00
|
|
|
movq mm5, [rdx+r8*8]
|
|
|
|
movq mm3, mm5
|
|
|
|
psllq mm5, mm1
|
|
|
|
movq rax, mm5
|
|
|
|
psrlq mm3, mm0
|
2009-12-02 11:24:00 -05:00
|
|
|
jge .2
|
2009-09-02 13:20:55 -04:00
|
|
|
|
2009-08-11 07:10:26 -04:00
|
|
|
xalign 16
|
2009-12-02 11:24:00 -05:00
|
|
|
.1: movq mm2, [rdx+r8*8+8]
|
2009-08-11 07:10:26 -04:00
|
|
|
movq mm4, mm2
|
|
|
|
psllq mm2, mm1
|
|
|
|
por mm3, mm2
|
|
|
|
movq [rcx+r8*8], mm3
|
|
|
|
psrlq mm4, mm0
|
|
|
|
movq mm5, [rdx+r8*8+16]
|
|
|
|
movq mm3, mm5
|
|
|
|
psllq mm5, mm1
|
|
|
|
por mm4, mm5
|
|
|
|
movq [rcx+r8*8+8], mm4
|
|
|
|
psrlq mm3, mm0
|
|
|
|
movq mm2, [rdx+r8*8+24]
|
|
|
|
movq mm4, mm2
|
|
|
|
psllq mm2, mm1
|
|
|
|
por mm3, mm2
|
|
|
|
movq mm5, [rdx+r8*8+32]
|
|
|
|
movq [rcx+r8*8+16], mm3
|
|
|
|
psrlq mm4, mm0
|
|
|
|
movq mm3, mm5
|
|
|
|
psllq mm5, mm1
|
|
|
|
por mm4, mm5
|
|
|
|
movq [rcx+r8*8+24], mm4
|
|
|
|
psrlq mm3, mm0
|
|
|
|
add r8, 4
|
2009-12-02 11:24:00 -05:00
|
|
|
jnc .1
|
2009-03-13 16:32:09 -04:00
|
|
|
|
2009-12-02 11:24:00 -05:00
|
|
|
.2: cmp r8, 2
|
|
|
|
ja .6
|
|
|
|
jz .5
|
|
|
|
jp .4
|
2009-02-19 18:22:30 -05:00
|
|
|
|
2009-12-02 11:24:00 -05:00
|
|
|
.3: movq mm2, [rdx+r8*8+8]
|
2009-08-11 07:10:26 -04:00
|
|
|
movq mm4, mm2
|
|
|
|
psllq mm2, mm1
|
|
|
|
por mm3, mm2
|
|
|
|
movq [rcx+r8*8], mm3
|
|
|
|
psrlq mm4, mm0
|
|
|
|
movq mm5, [rdx+r8*8+16]
|
|
|
|
movq mm3, mm5
|
|
|
|
psllq mm5, mm1
|
|
|
|
por mm4, mm5
|
|
|
|
movq [rcx+r8*8+8], mm4
|
|
|
|
psrlq mm3, mm0
|
|
|
|
movq mm2, [rdx+r8*8+24]
|
|
|
|
movq mm4, mm2
|
|
|
|
psllq mm2, mm1
|
|
|
|
por mm3, mm2
|
|
|
|
movq [rcx+r8*8+16], mm3
|
|
|
|
psrlq mm4, mm0
|
|
|
|
movq [rcx+r8*8+24], mm4
|
|
|
|
emms
|
|
|
|
ret
|
2009-09-02 13:20:55 -04:00
|
|
|
|
2009-08-11 07:10:26 -04:00
|
|
|
xalign 16
|
2009-12-02 11:24:00 -05:00
|
|
|
.4: movq mm2, [rdx+r8*8+8]
|
2009-08-11 07:10:26 -04:00
|
|
|
movq mm4, mm2
|
|
|
|
psllq mm2, mm1
|
|
|
|
por mm3, mm2
|
|
|
|
movq [rcx+r8*8], mm3
|
|
|
|
psrlq mm4, mm0
|
|
|
|
movq mm5, [rdx+r8*8+16]
|
|
|
|
movq mm3, mm5
|
|
|
|
psllq mm5, mm1
|
|
|
|
por mm4, mm5
|
|
|
|
movq [rcx+r8*8+8], mm4
|
|
|
|
psrlq mm3, mm0
|
|
|
|
movq [rcx+r8*8+16], mm3
|
|
|
|
emms
|
|
|
|
ret
|
2009-09-02 13:20:55 -04:00
|
|
|
|
2009-08-11 07:10:26 -04:00
|
|
|
xalign 16
|
2009-12-02 11:24:00 -05:00
|
|
|
.5: movq mm2, [rdx+r8*8+8]
|
2009-08-11 07:10:26 -04:00
|
|
|
movq mm4, mm2
|
|
|
|
psllq mm2, mm1
|
|
|
|
por mm3, mm2
|
|
|
|
movq [rcx+r8*8], mm3
|
|
|
|
psrlq mm4, mm0
|
|
|
|
movq [rcx+r8*8+8], mm4
|
|
|
|
emms
|
|
|
|
ret
|
2009-09-02 13:20:55 -04:00
|
|
|
|
2009-08-11 07:10:26 -04:00
|
|
|
xalign 16
|
2009-12-02 11:24:00 -05:00
|
|
|
.6: movq [rcx+r8*8], mm3
|
2009-08-11 07:10:26 -04:00
|
|
|
emms
|
|
|
|
ret
|
|
|
|
win64_gcc_end
|