2009-05-13 05:54:24 -04:00
|
|
|
; Copyright 2009 Jason Moxham
|
2009-09-02 13:20:55 -04:00
|
|
|
;
|
|
|
|
; 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
|
2009-05-13 05:54:24 -04:00
|
|
|
; by the Free Software Foundation; either verdxon 2.1 of the License, or (at
|
|
|
|
; your option) any later verdxon.
|
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.
|
|
|
|
; 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_divexact_byff(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-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-03-24 10:40:39 -04:00
|
|
|
CPU Core2
|
2009-03-07 10:00:35 -05:00
|
|
|
BITS 64
|
2009-03-13 16:32:09 -04:00
|
|
|
|
2009-03-07 10:00:35 -05:00
|
|
|
LEAF_PROC mpn_divexact_byff
|
2009-02-27 09:24:25 -05:00
|
|
|
|
2009-05-13 05:54:24 -04:00
|
|
|
xor eax, eax
|
|
|
|
mov r9, r8
|
|
|
|
and r9, 3
|
|
|
|
shr r8, 2
|
|
|
|
cmp r8, 0
|
|
|
|
; carry flag is clear here
|
2009-12-02 11:24:00 -05:00
|
|
|
jnz .2
|
2009-05-13 05:54:24 -04:00
|
|
|
sbb rax, [rdx]
|
|
|
|
mov [rcx], rax
|
|
|
|
dec r9
|
2009-12-02 11:24:00 -05:00
|
|
|
jz .1
|
2009-05-13 05:54:24 -04:00
|
|
|
sbb rax, [rdx+8]
|
|
|
|
mov [rcx+8], rax
|
|
|
|
dec r9
|
2009-12-02 11:24:00 -05:00
|
|
|
jz .1
|
2009-05-13 05:54:24 -04:00
|
|
|
sbb rax, [rdx+16]
|
|
|
|
mov [rcx+16], rax
|
|
|
|
dec r9
|
2010-07-22 07:33:16 -04:00
|
|
|
.1: sbb rax, 0
|
2009-05-13 05:54:24 -04:00
|
|
|
ret
|
2010-07-22 07:33:16 -04:00
|
|
|
|
2009-05-13 05:54:24 -04:00
|
|
|
xalign 16
|
2010-07-22 07:33:16 -04:00
|
|
|
.2: sbb rax, [rdx]
|
2009-05-13 05:54:24 -04:00
|
|
|
mov [rcx], rax
|
|
|
|
sbb rax, [rdx+8]
|
|
|
|
mov [rcx+8], rax
|
|
|
|
sbb rax, [rdx+16]
|
|
|
|
mov [rcx+16], rax
|
|
|
|
sbb rax, [rdx+24]
|
|
|
|
mov [rcx+24], rax
|
|
|
|
lea rdx, [rdx+32]
|
|
|
|
dec r8
|
|
|
|
lea rcx, [rcx+32]
|
2009-12-02 11:24:00 -05:00
|
|
|
jnz .2
|
2009-05-13 05:54:24 -04:00
|
|
|
inc r9
|
|
|
|
dec r9
|
2009-12-02 11:24:00 -05:00
|
|
|
jz .3
|
2009-05-13 05:54:24 -04:00
|
|
|
sbb rax, [rdx]
|
|
|
|
mov [rcx], rax
|
|
|
|
dec r9
|
2009-12-02 11:24:00 -05:00
|
|
|
jz .3
|
2009-05-13 05:54:24 -04:00
|
|
|
sbb rax, [rdx+8]
|
|
|
|
mov [rcx+8], rax
|
|
|
|
dec r9
|
2009-12-02 11:24:00 -05:00
|
|
|
jz .3
|
2009-05-13 05:54:24 -04:00
|
|
|
sbb rax, [rdx+16]
|
|
|
|
mov [rcx+16], rax
|
|
|
|
dec r9
|
2010-07-22 07:33:16 -04:00
|
|
|
.3: sbb rax, 0
|
2009-05-13 05:54:24 -04:00
|
|
|
ret
|
2010-07-22 07:33:16 -04:00
|
|
|
|
|
|
|
end
|