mpir/mpn/x86_64w/amd64/xor_n.asm
gladman 60725d8622 1. Update Windows version of getrusage
2. Use YASM's new alignment padding feature in the Windows assembler code
2009-03-24 14:40:39 +00:00

87 lines
2.3 KiB
NASM

; AMD64 mpn_xor_n
; Version 1.0.4
;
; Copyright 2008 Jason Moxham
; Windows Conversion Copyright 2008 Brian Gladman
; This file is part of the MPIR Library.
; 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.
; Calling interface:
;
; mp_limb_t __gmpn_<op>_n( <op> = xor
; mp_ptr dst, rcx
; mp_srcptr src1, rdx
; mp_srcptr src2, r8
; mp_size_t len r9
; )
%include "..\yasm_mac.inc"
CPU Athlon64
BITS 64
%define T3 r10
%define T4 r11
LEAF_PROC mpn_xor_n
movsxd r9, r9d
sub r9, 4
jb .2
xalign 16
.1: mov r10, [r8+r9*8+24]
mov r11, [r8+r9*8+16]
or r10, r10
or r11, r11
xor r10, [rdx+r9*8+24]
xor r11, [rdx+r9*8+16]
mov [rcx+r9*8+24], r10
mov [rcx+r9*8+16], r11
mov T3, [r8+r9*8+8]
mov T4, [r8+r9*8]
or T3, T3
or T4, T4
xor T3, [rdx+r9*8+8]
xor T4, [rdx+r9*8]
mov [rcx+r9*8+8], T3
mov [rcx+r9*8], T4
sub r9, 4
jnc .1
.2: add r9, 4
jz .3
mov r10, [r8+r9*8-8]
or r10, r10
xor r10, [rdx+r9*8-8]
mov [rcx+r9*8-8], r10
dec r9
jz .3
mov r10, [r8+r9*8-8]
or r10, r10
xor r10, [rdx+r9*8-8]
mov [rcx+r9*8-8], r10
dec r9
jz .3
mov r10, [r8+r9*8-8]
or r10, r10
xor r10, [rdx+r9*8-8]
mov [rcx+r9*8-8], r10
.3: ret
end