2012-07-08 10:05:43 -04:00
|
|
|
; PROLOGUE(lshiftc)
|
2009-08-12 05:31:38 -04:00
|
|
|
|
|
|
|
; Copyright 2009 Jason Moxham
|
2009-09-02 07:41:43 -04:00
|
|
|
;
|
|
|
|
; Windows Conversion Copyright 2008 Brian Gladman
|
|
|
|
;
|
2009-08-12 05:31:38 -04:00
|
|
|
; This file is part of the MPIR Library.
|
2009-09-02 07:41:43 -04:00
|
|
|
;
|
2009-08-12 05:31:38 -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 verdxon 2.1 of the License, or (at
|
|
|
|
; your option) any later verdxon.
|
|
|
|
; 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
|
|
|
;
|
|
|
|
; void lshiftc(mp_ptr, mp_ptr, mp_size_t, mp_uint)
|
|
|
|
; rdi rsi rdx rcx
|
2010-07-02 07:52:24 -04:00
|
|
|
; rcx rdx r8 r9d
|
2009-08-12 05:31:38 -04:00
|
|
|
|
2010-08-15 06:08:57 -04:00
|
|
|
%include "yasm_mac.inc"
|
2009-08-12 05:31:38 -04:00
|
|
|
|
|
|
|
CPU Athlon64
|
|
|
|
BITS 64
|
|
|
|
|
|
|
|
LEAF_PROC mpn_lshiftc
|
|
|
|
mov r9d, r9d
|
|
|
|
movq mm0, r9
|
|
|
|
mov rax, 64
|
|
|
|
sub rax, r9
|
|
|
|
pcmpeqb mm6, mm6
|
|
|
|
movq mm1, rax
|
|
|
|
lea rdx, [rdx+8]
|
|
|
|
lea rcx, [rcx+8]
|
|
|
|
sub r8, 5
|
|
|
|
movq mm5, [rdx+r8*8+24]
|
|
|
|
movq mm3, mm5
|
|
|
|
psrlq mm5, mm1
|
|
|
|
movq rax, mm5
|
|
|
|
psllq mm3, mm0
|
2009-12-02 11:24:00 -05:00
|
|
|
jc .2
|
2009-08-12 05:31:38 -04:00
|
|
|
|
|
|
|
xalign 16
|
2009-12-02 11:24:00 -05:00
|
|
|
.1: movq mm2, [rdx+r8*8+16]
|
2009-08-12 05:31:38 -04:00
|
|
|
movq mm4, mm2
|
|
|
|
psrlq mm2, mm1
|
|
|
|
por mm3, mm2
|
|
|
|
movq mm2, [rdx+r8*8]
|
|
|
|
pxor mm3, mm6
|
|
|
|
movq [rcx+r8*8+24], mm3
|
|
|
|
psllq mm4, mm0
|
|
|
|
movq mm5, [rdx+r8*8+8]
|
|
|
|
movq mm3, mm5
|
|
|
|
psrlq mm5, mm1
|
|
|
|
por mm4, mm5
|
|
|
|
pxor mm4, mm6
|
|
|
|
movq [rcx+r8*8+16], mm4
|
|
|
|
psllq mm3, mm0
|
|
|
|
movq mm4, mm2
|
|
|
|
movq mm5, [rdx+r8*8-8]
|
|
|
|
sub r8, 4
|
|
|
|
psrlq mm2, mm1
|
|
|
|
por mm3, mm2
|
|
|
|
pxor mm3, mm6
|
|
|
|
movq [rcx+r8*8+40], mm3
|
|
|
|
psllq mm4, mm0
|
|
|
|
movq mm3, mm5
|
|
|
|
psrlq mm5, mm1
|
|
|
|
por mm4, mm5
|
|
|
|
pxor mm4, mm6
|
|
|
|
movq [rcx+r8*8+32], mm4
|
|
|
|
psllq mm3, mm0
|
2009-12-02 11:24:00 -05:00
|
|
|
jnc .1
|
2010-07-22 07:33:16 -04:00
|
|
|
.2: cmp r8, -2
|
2009-12-02 11:24:00 -05:00
|
|
|
jz .4
|
|
|
|
jp .5
|
|
|
|
js .6
|
2010-07-22 07:33:16 -04:00
|
|
|
.3: movq mm2, [rdx+r8*8+16]
|
2009-08-12 05:31:38 -04:00
|
|
|
movq mm4, mm2
|
|
|
|
psrlq mm2, mm1
|
|
|
|
por mm3, mm2
|
|
|
|
movq mm2, [rdx+r8*8]
|
|
|
|
pxor mm3, mm6
|
|
|
|
movq [rcx+r8*8+24], mm3
|
|
|
|
psllq mm4, mm0
|
|
|
|
movq mm5, [rdx+r8*8+8]
|
|
|
|
movq mm3, mm5
|
|
|
|
psrlq mm5, mm1
|
|
|
|
por mm4, mm5
|
|
|
|
pxor mm4, mm6
|
|
|
|
movq [rcx+r8*8+16], mm4
|
|
|
|
psllq mm3, mm0
|
|
|
|
movq mm4, mm2
|
|
|
|
psrlq mm2, mm1
|
|
|
|
por mm3, mm2
|
|
|
|
pxor mm3, mm6
|
|
|
|
movq [rcx+r8*8+8], mm3
|
|
|
|
psllq mm4, mm0
|
|
|
|
pxor mm4, mm6
|
|
|
|
movq [rcx+r8*8], mm4
|
|
|
|
emms
|
|
|
|
ret
|
|
|
|
|
|
|
|
xalign 16
|
2010-07-22 07:33:16 -04:00
|
|
|
.4: movq mm2, [rdx+r8*8+16]
|
2009-08-12 05:31:38 -04:00
|
|
|
movq mm4, mm2
|
|
|
|
psrlq mm2, mm1
|
|
|
|
por mm3, mm2
|
|
|
|
pxor mm3, mm6
|
|
|
|
movq [rcx+r8*8+24], mm3
|
|
|
|
psllq mm4, mm0
|
|
|
|
movq mm5, [rdx+r8*8+8]
|
|
|
|
movq mm3, mm5
|
|
|
|
psrlq mm5, mm1
|
|
|
|
por mm4, mm5
|
|
|
|
pxor mm4, mm6
|
|
|
|
movq [rcx+r8*8+16], mm4
|
|
|
|
psllq mm3, mm0
|
|
|
|
pxor mm3, mm6
|
|
|
|
movq [rcx+r8*8+8], mm3
|
|
|
|
emms
|
|
|
|
ret
|
|
|
|
|
|
|
|
xalign 16
|
2010-07-22 07:33:16 -04:00
|
|
|
.5: movq mm2, [rdx+r8*8+16]
|
2009-08-12 05:31:38 -04:00
|
|
|
movq mm4, mm2
|
|
|
|
psrlq mm2, mm1
|
|
|
|
por mm3, mm2
|
|
|
|
pxor mm3, mm6
|
|
|
|
movq [rcx+r8*8+24], mm3
|
|
|
|
psllq mm4, mm0
|
|
|
|
pxor mm4, mm6
|
|
|
|
movq [rcx+r8*8+16], mm4
|
|
|
|
emms
|
|
|
|
ret
|
|
|
|
|
|
|
|
xalign 16
|
2010-07-22 07:33:16 -04:00
|
|
|
.6: pxor mm3, mm6
|
2009-08-12 05:31:38 -04:00
|
|
|
movq [rcx+r8*8+24], mm3
|
|
|
|
emms
|
|
|
|
ret
|
|
|
|
|