1 dnl SPARC v9 mpn_addlsh_n
and mpn_sublsh_n for T3
/T4
/T5.
3 dnl Contributed to the GNU project by Torbjörn Granlund.
5 dnl Copyright
2013 Free Software Foundation
, Inc.
7 dnl
This file is part of the GNU MP Library.
9 dnl The GNU MP Library is free software
; you can redistribute it and/or modify
10 dnl it under the terms of
either:
12 dnl
* the GNU Lesser General
Public License as published by the Free
13 dnl Software Foundation
; either version 3 of the License, or (at your
14 dnl option
) any later version.
18 dnl
* the GNU General
Public License as published by the Free Software
19 dnl Foundation
; either version 2 of the License, or (at your option) any
22 dnl
or both
in parallel
, as here.
24 dnl The GNU MP Library is distributed
in the hope that it will be useful
, but
25 dnl WITHOUT ANY WARRANTY
; without even the implied warranty of MERCHANTABILITY
26 dnl
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License
29 dnl You should have received copies of the GNU General
Public License
and the
30 dnl GNU Lesser General
Public License along with the GNU MP Library. If
not,
31 dnl see
https://www.gnu.
org/licenses
/.
33 include(`..
/config.m4
')
39 C For sublsh_n we combine the two shifted limbs using xnor, using the identity
40 C (a xor not b) = (not (a xor b)) which equals (not (a or b)) when (a and b) =
41 C 0 as it is in our usage. This gives us the ones complement for free.
42 C Unfortunately, the same trick will not work for rsblsh_n, which will instead
43 C require a separate negation.
45 C FIXME: Add rsblsh_n to this file.
55 ifdef(`OPERATION_addlsh_n',`
56 define
(`INITCY
', `subcc %g0, 0, %g0')
58 define
(`func
', `mpn_addlsh_n')
60 ifdef(`OPERATION_sublsh_n',`
61 define
(`INITCY
', `subcc %g0, 1, %g0')
62 define
(`MERGE
', `xnor')
63 define
(`func
', `mpn_sublsh_n')
73 MULFUNC_PROLOGUE(mpn_addlsh_n mpn_sublsh_n)
75 REGISTER(%g2,#scratch)
76 REGISTER(%g3,#scratch)
96 L(odd): ldx [vp0 + n], %l1
106 L(evn): ldx [vp0 + n], %l0
113 L(top): addxccc(%l6, %l4, %o0)
117 L(lo1): srlx %l1, tnc, %l3
120 addxccc(%l7, %l5, %o1)
124 L(lo0): srlx %l0, tnc, %l2
130 addxccc(%l6, %l4, %o0)
133 L(wd1): srlx %l1, tnc, %l3
135 addxccc(%l7, %l5, %o1)
138 ifdef(`OPERATION_addlsh_n',
139 ` addxc
( %l3
, %g0
, %i0
)')
140 ifdef(`OPERATION_sublsh_n',
141 ` addxc
( %g0
, %g0
, %g1
)