2008-05-26 18:11:40 -04:00
|
|
|
; AMD64 mpn_mul_1 -- Multiply a limb vector with a limb and store the result
|
|
|
|
; in a second limb vector.
|
|
|
|
;
|
|
|
|
; Copyright 2004 Free Software Foundation, Inc.
|
|
|
|
;
|
2008-07-24 17:14:10 -04:00
|
|
|
; Copyright 2008 William Hart
|
|
|
|
;
|
|
|
|
; 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.
|
2008-05-26 18:11:40 -04:00
|
|
|
;
|
|
|
|
; cycles/limb
|
|
|
|
; Hammer: 3.0
|
|
|
|
;
|
|
|
|
;
|
|
|
|
; INPUT PARAMETERS
|
|
|
|
; rp rdi
|
|
|
|
; up rsi
|
2008-07-23 13:59:51 -04:00
|
|
|
; n rdx
|
2008-05-26 18:11:40 -04:00
|
|
|
; vl rcx
|
|
|
|
|
2008-06-15 18:00:33 -04:00
|
|
|
%include '../yasm_mac.inc'
|
|
|
|
|
2008-07-23 13:59:51 -04:00
|
|
|
BITS 64
|
2008-06-01 02:36:56 -04:00
|
|
|
|
|
|
|
align 16
|
|
|
|
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
|
|
|
|
2008-07-23 13:59:51 -04:00
|
|
|
GLOBAL_FUNC mpn_mul_1
|
2008-05-26 18:11:40 -04:00
|
|
|
mov r11, rdx
|
|
|
|
lea rsi, [rsi+rdx*8]
|
|
|
|
lea rdi, [rdi+rdx*8]
|
|
|
|
neg r11
|
|
|
|
xor r8d, r8d
|
|
|
|
|
2008-07-23 13:59:51 -04:00
|
|
|
label0:
|
2008-07-23 15:31:28 -04:00
|
|
|
mov rax, [rsi+r11*8] ; load next limb from up
|
|
|
|
mul rcx ; multiply by vl
|
|
|
|
add rax, r8 ; add any high limb from previous iteration
|
|
|
|
mov r8d, 0 ; zero r8 again
|
|
|
|
adc r8, rdx ; add any carry
|
|
|
|
mov [rdi+r11*8], rax ; store low limb
|
2008-05-26 18:11:40 -04:00
|
|
|
inc r11
|
2008-07-23 13:59:51 -04:00
|
|
|
jne label0
|
2008-05-26 18:11:40 -04:00
|
|
|
|
2008-07-23 15:31:28 -04:00
|
|
|
mov rax, r8 ; return any high limb
|
2008-04-17 17:03:07 -04:00
|
|
|
ret
|