3 Contributed to the GNU project by Torbjörn Granlund.
5 Copyright 2013, 2014 Free Software Foundation, Inc.
7 This file is part of the GNU MP Library.
9 The GNU MP Library is free software; you can redistribute it and/or modify
10 it under the terms of either:
12 * the GNU Lesser General Public License as published by the Free
13 Software Foundation; either version 3 of the License, or (at your
14 option) any later version.
18 * the GNU General Public License as published by the Free Software
19 Foundation; either version 2 of the License, or (at your option) any
22 or both in parallel, as here.
24 The GNU MP Library is distributed in the hope that it will be useful, but
25 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
26 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
29 You should have received copies of the GNU General Public License and the
30 GNU Lesser General Public License along with the GNU MP Library. If not,
31 see https://www.gnu.org/licenses/. */
36 #if ! HAVE_NATIVE_mpn_sqr_basecase
37 /* The limit of the generic code is SQR_TOOM2_THRESHOLD. */
38 #define SQR_BASECASE_LIM SQR_TOOM2_THRESHOLD
41 #if HAVE_NATIVE_mpn_sqr_basecase
42 #ifdef TUNE_SQR_TOOM2_MAX
43 /* We slightly abuse TUNE_SQR_TOOM2_MAX here. If it is set for an assembly
44 mpn_sqr_basecase, it comes from SQR_TOOM2_THRESHOLD_MAX in the assembly
45 file. An assembly mpn_sqr_basecase that does not define it should allow
47 #define SQR_BASECASE_LIM SQR_TOOM2_THRESHOLD
51 #ifdef WANT_FAT_BINARY
52 /* For fat builds, we use SQR_TOOM2_THRESHOLD which will expand to a read from
53 __gmpn_cpuvec. Perhaps any possible sqr_basecase.asm allow any size, and we
54 limit the use unnecessarily. We cannot tell, so play it safe. FIXME. */
55 #define SQR_BASECASE_LIM SQR_TOOM2_THRESHOLD
59 mpn_sec_sqr (mp_ptr rp
,
60 mp_srcptr ap
, mp_size_t an
,
63 #ifndef SQR_BASECASE_LIM
64 /* If SQR_BASECASE_LIM is now not defined, use mpn_sqr_basecase for any operand
66 mpn_sqr_basecase (rp
, ap
, an
);
68 /* Else use mpn_sqr_basecase for its allowed sizes, else mpn_mul_basecase. */
69 mpn_mul_basecase (rp
, ap
, an
, ap
, an
);
74 mpn_sec_sqr_itch (mp_size_t an
)