1 dnl AMD64 mpn_addlshC_n -- rp[] = up[] + (vp[] << C)
2 dnl AMD64 mpn_rsblshC_n -- rp[] = (vp[] << C) - up[]
4 dnl Copyright 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
6 dnl This file is part of the GNU MP Library.
8 dnl The GNU MP Library is free software; you can redistribute it and/or modify
9 dnl it under the terms of the GNU Lesser General Public License as published
10 dnl by the Free Software Foundation; either version 3 of the License, or (at
11 dnl your option) any later version.
13 dnl The GNU MP Library is distributed in the hope that it will be useful, but
14 dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16 dnl License for more details.
18 dnl You should have received a copy of the GNU Lesser General Public License
19 dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
28 C Intel SBR 2 C (or 1.95 when L(top)'s alignment = 16 (mod 32))
32 C This code probably runs close to optimally on Sandy Bridge (using 4-way
33 C unrolling). It also runs reasonably well on Core 2, but it runs poorly on
34 C all other processors, including Nehalem.
51 IFDOS(` mov 56(%rsp), %r8 ')
54 neg %rax C set msb on carry
55 xor R32(%rbp), R32(%rbp) C limb carry
71 xor R32(%rbp), R32(%rbp) C limb carry
81 L(b11): mov 8(vp), %r9
85 add R32(%rax), R32(%rax) C init carry flag
96 sbb R32(%rax), R32(%rax) C save carry flag
101 L(b01): add R32(%rax), R32(%rax) C init carry flag
108 sbb R32(%rax), R32(%rax) C save carry flag
113 L(b10): mov 8(vp), %r9
115 add R32(%rax), R32(%rax) C init carry flag
124 sbb R32(%rax), R32(%rax) C save carry flag
130 L(top): mov (vp), %r8
132 L(b00): mov 8(vp), %r9
137 shrd $RSH, %r11, %r10
139 add R32(%rax), R32(%rax) C restore carry flag
151 sbb R32(%rax), R32(%rax) C save carry flag
155 L(end): shr $RSH, %rbp
156 add R32(%rax), R32(%rax) C restore carry flag