1 dnl X86
-64 mpn_rsh1add_n
, mpn_rsh1sub_n optimised for Intel Sandy Bridge.
3 dnl Copyright
2003, 2005, 2009-2012 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
')
50 ifdef(`OPERATION_rsh1add_n', `
53 define
(func_n
, mpn_rsh1add_n
)
54 define
(func_nc
, mpn_rsh1add_nc
)')
55 ifdef(`OPERATION_rsh1sub_n', `
58 define
(func_n
, mpn_rsh1sub_n
)
59 define
(func_nc
, mpn_rsh1sub_nc
)')
61 MULFUNC_PROLOGUE(mpn_rsh1add_n mpn_rsh1add_nc mpn_rsh1sub_n mpn_rsh1sub_nc)
72 IFDOS(` mov 56(%rsp), %r8 ')
76 neg %r8 C set C flag from parameter
92 sbb R32
(%rbx
), R32
(%rbx
) C save cy
93 mov R32
(%rbp
), R32
(%rax
)
94 and $1, R32
(%rax
) C return value
100 je L
(do
) C jump if n
= 1 5 9 ...
102 L
(n1
): cmp $2, R32
(%r11
)
103 jne L
(n2
) C jump unless n
= 2 6 10 ...
104 add R32
(%rbx
), R32
(%rbx
) C restore cy
110 sbb R32
(%rbx
), R32
(%rbx
) C save cy
116 L
(n2
): cmp $3, R32
(%r11
)
117 jne L
(n3
) C jump unless n
= 3 7 11 ...
118 add R32
(%rbx
), R32
(%rbx
) C restore cy
126 sbb R32
(%rbx
), R32
(%rbx
) C save cy
132 L
(n3
): dec n C come here for n
= 4 8 12 ...
133 add R32
(%rbx
), R32
(%rbx
) C restore cy
143 sbb R32
(%rbx
), R32
(%rbx
) C save cy
149 L
(cj2
): shrd $1, %r10
, %r9
151 L
(cj1
): mov %r10
, %rbp
157 L
(top
): add R32
(%rbx
), R32
(%rbx
) C restore cy
171 sbb R32
(%rbx
), R32
(%rbx
) C save cy
187 L
(end): shrd $1, %rbx
, %rbp