1 dnl AMD64 mpn_mul_1 for CPUs with mulx.
3 dnl Copyright
2012, 2013 Free Software Foundation
, Inc.
5 dnl
This file is part of the GNU MP Library.
7 dnl The GNU MP Library is free software
; you can redistribute it and/or modify
8 dnl it under the terms of
either:
10 dnl
* the GNU Lesser General
Public License as published by the Free
11 dnl Software Foundation
; either version 3 of the License, or (at your
12 dnl option
) any later version.
16 dnl
* the GNU General
Public License as published by the Free Software
17 dnl Foundation
; either version 2 of the License, or (at your option) any
20 dnl
or both
in parallel
, as here.
22 dnl The GNU MP Library is distributed
in the hope that it will be useful
, but
23 dnl WITHOUT ANY WARRANTY
; without even the implied warranty of MERCHANTABILITY
24 dnl
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License
27 dnl You should have received copies of the GNU General
Public License
and the
28 dnl GNU Lesser General
Public License along with the GNU MP Library. If
not,
29 dnl see
https://www.gnu.
org/licenses
/.
31 include(`..
/config.m4
')
49 define(`rp', `
%rdi
') C rcx
50 define(`up', `
%rsi
') C rdx
51 define(`n_param', `
%rdx
') C r8
52 define(`v0_param',`
%rcx
') C r9
57 IFDOS(` define(`up', ``
%rsi
'') ') dnl
58 IFDOS(` define(`rp', ``
%rcx
'') ') dnl
59 IFDOS(` define(`v0', ``
%r9
'') ') dnl
60 IFDOS(` define(`r9', ``rdi
'') ') dnl
61 IFDOS(` define(`n', ``
%r8
'') ') dnl
62 IFDOS(` define(`r8', ``r11
'') ') dnl
71 xor R32(%r8), R32(%r8) C carry-in limb
78 lea (up,n_param,8), up
79 lea -32(rp,n_param,8), rp
80 mov R32(n_param), R32(%rax)
81 xchg v0_param, v0 C FIXME: is this insn fast?
95 mulx (up,n,8), %r9, %r8
96 mulx 8(up,n,8), %r11, %r10
100 L(b3): mulx %r9, %r11, %r10
101 mulx 8(up,n,8), %r13, %r12
102 mulx 16(up,n,8), %rbx, %rax
108 L(b2): mov %r8, %r10 C carry-in limb
110 mulx 8(up,n,8), %rbx, %rax
113 mulx (up,n,8), %r9, %r8
117 L(b0): mov %r8, %rax C carry-in limb
119 mulx 8(up,n,8), %r11, %r10
120 mulx 16(up,n,8), %r13, %r12
127 L(lo3): mulx (up,n,8), %r9, %r8
130 L(lo2): mulx 8(up,n,8), %r11, %r10
133 L(lo1): mulx 16(up,n,8), %r13, %r12
136 L(lo0): mulx 24(up,n,8), %rbx, %rax
140 L(end): mov %r9, (rp)
141 L(wd3): adc %r8, %r11
143 L(wd2): adc %r10, %r13
145 L(wd1): adc %r12, %rbx