[PATCH 18/20] Automatic hidden aliases inside existing asm-defs.m4 macros
Richard Henderson
rth at twiddle.net
Mon Mar 4 19:41:48 CET 2013
This means we don't have to edit every single asm file.
---
mpn/asm-defs.m4 | 342 ++++++++++++++++++++++++++++----------------------------
1 file changed, 174 insertions(+), 168 deletions(-)
diff --git a/mpn/asm-defs.m4 b/mpn/asm-defs.m4
index b95cad7..e3cdcb5 100644
--- a/mpn/asm-defs.m4
+++ b/mpn/asm-defs.m4
@@ -1312,172 +1312,172 @@ dnl
dnl Convenience definitions using MPN(), like the #defines in gmp.h. Each
dnl function that might be implemented in assembler is here.
-define(define_mpn,
-m4_assert_numargs(1)
-`deflit(`mpn_$1',`MPN(`$1')')')
-
-define_mpn(add)
-define_mpn(add_1)
-define_mpn(add_err1_n)
-define_mpn(add_err2_n)
-define_mpn(add_err3_n)
-define_mpn(add_n)
-define_mpn(add_nc)
-define_mpn(addcnd_n)
-define_mpn(addlsh1_n)
-define_mpn(addlsh1_nc)
-define_mpn(addlsh2_n)
-define_mpn(addlsh2_nc)
-define_mpn(addlsh_n)
-define_mpn(addlsh_nc)
-define_mpn(addlsh1_n_ip1)
-define_mpn(addlsh1_nc_ip1)
-define_mpn(addlsh2_n_ip1)
-define_mpn(addlsh2_nc_ip1)
-define_mpn(addlsh_n_ip1)
-define_mpn(addlsh_nc_ip1)
-define_mpn(addlsh1_n_ip2)
-define_mpn(addlsh1_nc_ip2)
-define_mpn(addlsh2_n_ip2)
-define_mpn(addlsh2_nc_ip2)
-define_mpn(addlsh_n_ip2)
-define_mpn(addlsh_nc_ip2)
-define_mpn(addmul_1)
-define_mpn(addmul_1c)
-define_mpn(addmul_2)
-define_mpn(addmul_3)
-define_mpn(addmul_4)
-define_mpn(addmul_5)
-define_mpn(addmul_6)
-define_mpn(addmul_7)
-define_mpn(addmul_8)
-define_mpn(addmul_2s)
-define_mpn(add_n_sub_n)
-define_mpn(add_n_sub_nc)
-define_mpn(addaddmul_1msb0)
-define_mpn(and_n)
-define_mpn(andn_n)
-define_mpn(bdiv_q_1)
-define_mpn(pi1_bdiv_q_1)
-define_mpn(bdiv_dbm1c)
-define_mpn(cmp)
-define_mpn(com)
-define_mpn(copyd)
-define_mpn(copyi)
-define_mpn(count_leading_zeros)
-define_mpn(count_trailing_zeros)
-define_mpn(div_qr_2)
-define_mpn(div_qr_2n_pi1)
-define_mpn(div_qr_2u_pi1)
-define_mpn(div_qr_2n_pi2)
-define_mpn(div_qr_2u_pi2)
-define_mpn(divexact_1)
-define_mpn(divexact_by3c)
-define_mpn(divrem)
-define_mpn(divrem_1)
-define_mpn(divrem_1c)
-define_mpn(divrem_2)
-define_mpn(divrem_classic)
-define_mpn(divrem_newton)
-define_mpn(dump)
-define_mpn(gcd)
-define_mpn(gcd_1)
-define_mpn(gcdext)
-define_mpn(get_str)
-define_mpn(hamdist)
-define_mpn(invert_limb)
-define_mpn(invert_limb_table)
-define_mpn(ior_n)
-define_mpn(iorn_n)
-define_mpn(lshift)
-define_mpn(lshiftc)
-define_mpn(mod_1_1p)
-define_mpn(mod_1_1p_cps)
-define_mpn(mod_1s_2p)
-define_mpn(mod_1s_2p_cps)
-define_mpn(mod_1s_3p)
-define_mpn(mod_1s_3p_cps)
-define_mpn(mod_1s_4p)
-define_mpn(mod_1s_4p_cps)
-define_mpn(mod_1)
-define_mpn(mod_1c)
-define_mpn(mod_34lsub1)
-define_mpn(modexact_1_odd)
-define_mpn(modexact_1c_odd)
-define_mpn(mul)
-define_mpn(mul_1)
-define_mpn(mul_1c)
-define_mpn(mul_2)
-define_mpn(mul_3)
-define_mpn(mul_4)
-define_mpn(mul_5)
-define_mpn(mul_6)
-define_mpn(mul_basecase)
-define_mpn(mul_n)
-define_mpn(mullo_basecase)
-define_mpn(mulmid_basecase)
-define_mpn(perfect_square_p)
-define_mpn(popcount)
-define_mpn(preinv_divrem_1)
-define_mpn(preinv_mod_1)
-define_mpn(nand_n)
-define_mpn(neg)
-define_mpn(nior_n)
-define_mpn(powm)
-define_mpn(powlo)
-define_mpn(random)
-define_mpn(random2)
-define_mpn(redc_1)
-define_mpn(redc_2)
-define_mpn(rsblsh1_n)
-define_mpn(rsblsh1_nc)
-define_mpn(rsblsh2_n)
-define_mpn(rsblsh2_nc)
-define_mpn(rsblsh_n)
-define_mpn(rsblsh_nc)
-define_mpn(rsh1add_n)
-define_mpn(rsh1add_nc)
-define_mpn(rsh1sub_n)
-define_mpn(rsh1sub_nc)
-define_mpn(rshift)
-define_mpn(rshiftc)
-define_mpn(scan0)
-define_mpn(scan1)
-define_mpn(set_str)
-define_mpn(sqr_basecase)
-define_mpn(sqr_diagonal)
-define_mpn(sqr_diag_addlsh1)
-define_mpn(sub_n)
-define_mpn(subcnd_n)
-define_mpn(sublsh1_n)
-define_mpn(sublsh1_nc)
-define_mpn(sublsh1_n_ip1)
-define_mpn(sublsh1_nc_ip1)
-define_mpn(sublsh2_n)
-define_mpn(sublsh2_nc)
-define_mpn(sublsh2_n_ip1)
-define_mpn(sublsh2_nc_ip1)
-define_mpn(sublsh_n)
-define_mpn(sublsh_nc)
-define_mpn(sublsh_n_ip1)
-define_mpn(sublsh_nc_ip1)
-define_mpn(sqrtrem)
-define_mpn(sub)
-define_mpn(sub_1)
-define_mpn(sub_err1_n)
-define_mpn(sub_err2_n)
-define_mpn(sub_err3_n)
-define_mpn(sub_n)
-define_mpn(sub_nc)
-define_mpn(submul_1)
-define_mpn(submul_1c)
-define_mpn(tabselect)
-define_mpn(umul_ppmm)
-define_mpn(umul_ppmm_r)
-define_mpn(udiv_qrnnd)
-define_mpn(udiv_qrnnd_r)
-define_mpn(xnor_n)
-define_mpn(xor_n)
+ifelse(ifdef(`HAVE_HIDDEN_ALIAS',`y',`n')`'ifdef(`PIC',`y',`n'), `yy',
+`define(`define_mpn',
+ `deflit(`mpn_$1', `$2_mpn_$1') deflit(`ext_$2_mpn_$1', `MPN($1)')')',
+`define(`define_mpn', `deflit(`mpn_$1',`MPN(`$1')')')')
+
+define_mpn(add, pub)
+define_mpn(add_1, pub)
+define_mpn(add_err1_n, int)
+define_mpn(add_err2_n, int)
+define_mpn(add_err3_n, int)
+define_mpn(add_n, pub)
+define_mpn(add_nc, int)
+define_mpn(addcnd_n, int)
+define_mpn(addlsh1_n, int)
+define_mpn(addlsh1_nc, int)
+define_mpn(addlsh2_n, int)
+define_mpn(addlsh2_nc, int)
+define_mpn(addlsh_n, int)
+define_mpn(addlsh_nc, int)
+define_mpn(addlsh1_n_ip1, int)
+define_mpn(addlsh1_nc_ip1, int)
+define_mpn(addlsh2_n_ip1, int)
+define_mpn(addlsh2_nc_ip1, int)
+define_mpn(addlsh_n_ip1, int)
+define_mpn(addlsh_nc_ip1, int)
+define_mpn(addlsh1_n_ip2, int)
+define_mpn(addlsh1_nc_ip2, int)
+define_mpn(addlsh2_n_ip2, int)
+define_mpn(addlsh2_nc_ip2, int)
+define_mpn(addlsh_n_ip2, int)
+define_mpn(addlsh_nc_ip2, int)
+define_mpn(addmul_1, pub)
+define_mpn(addmul_1c, int)
+define_mpn(addmul_2, int)
+define_mpn(addmul_3, int)
+define_mpn(addmul_4, int)
+define_mpn(addmul_5, int)
+define_mpn(addmul_6, int)
+define_mpn(addmul_7, int)
+define_mpn(addmul_8, int)
+define_mpn(addmul_2s, int)
+define_mpn(add_n_sub_n, int)
+define_mpn(add_n_sub_nc, int)
+define_mpn(addaddmul_1msb0, int)
+define_mpn(and_n, pub)
+define_mpn(andn_n, pub)
+define_mpn(bdiv_q_1, int)
+define_mpn(pi1_bdiv_q_1, int)
+define_mpn(bdiv_dbm1c, int)
+define_mpn(cmp, pub)
+define_mpn(com, pub)
+define_mpn(copyd, pub)
+define_mpn(copyi, pub)
+define_mpn(count_leading_zeros, int)
+define_mpn(count_trailing_zeros, int)
+define_mpn(div_qr_2, int)
+define_mpn(div_qr_2n_pi1, int)
+define_mpn(div_qr_2u_pi1, int)
+define_mpn(div_qr_2n_pi2, int)
+define_mpn(div_qr_2u_pi2, int)
+define_mpn(divexact_1, int)
+define_mpn(divexact_by3c, int)
+define_mpn(divrem, pub)
+define_mpn(divrem_1, pub)
+define_mpn(divrem_1c, int)
+define_mpn(divrem_2, pub)
+define_mpn(divrem_classic, int)
+define_mpn(divrem_newton, int)
+define_mpn(dump, int)
+define_mpn(gcd, pub)
+define_mpn(gcd_1, pub)
+define_mpn(gcdext, pub)
+define_mpn(get_str, pub)
+define_mpn(hamdist, pub)
+define_mpn(invert_limb, int)
+define_mpn(invert_limb_table, int)
+define_mpn(ior_n, pub)
+define_mpn(iorn_n, pub)
+define_mpn(lshift, pub)
+define_mpn(lshiftc, int)
+define_mpn(mod_1_1p, int)
+define_mpn(mod_1_1p_cps, int)
+define_mpn(mod_1s_2p, int)
+define_mpn(mod_1s_2p_cps, int)
+define_mpn(mod_1s_3p, int)
+define_mpn(mod_1s_3p_cps, int)
+define_mpn(mod_1s_4p, int)
+define_mpn(mod_1s_4p_cps, int)
+define_mpn(mod_1, pub)
+define_mpn(mod_1c, int)
+define_mpn(mod_34lsub1, int)
+define_mpn(modexact_1_odd, int)
+define_mpn(modexact_1c_odd, int)
+define_mpn(mul, pub)
+define_mpn(mul_1, pub)
+define_mpn(mul_1c, int)
+define_mpn(mul_2, int)
+define_mpn(mul_3, int)
+define_mpn(mul_4, int)
+define_mpn(mul_5, int)
+define_mpn(mul_6, int)
+define_mpn(mul_basecase, int)
+define_mpn(mul_n, pub)
+define_mpn(mullo_basecase, int)
+define_mpn(mulmid_basecase, int)
+define_mpn(perfect_square_p, pub)
+define_mpn(popcount, pub)
+define_mpn(preinv_divrem_1, int)
+define_mpn(preinv_mod_1, pub)
+define_mpn(nand_n, pub)
+define_mpn(neg, pub)
+define_mpn(nior_n, pub)
+define_mpn(powm, pub)
+define_mpn(powlo, int)
+define_mpn(random, pub)
+define_mpn(random2, pub)
+define_mpn(redc_1, int)
+define_mpn(redc_2, int)
+define_mpn(rsblsh1_n, int)
+define_mpn(rsblsh1_nc, int)
+define_mpn(rsblsh2_n, int)
+define_mpn(rsblsh2_nc, int)
+define_mpn(rsblsh_n, int)
+define_mpn(rsblsh_nc, int)
+define_mpn(rsh1add_n, int)
+define_mpn(rsh1add_nc, int)
+define_mpn(rsh1sub_n, int)
+define_mpn(rsh1sub_nc, int)
+define_mpn(rshift, pub)
+define_mpn(rshiftc, int)
+define_mpn(scan0, pub)
+define_mpn(scan1, pub)
+define_mpn(set_str, pub)
+define_mpn(sqr_basecase, int)
+define_mpn(sqr_diagonal, int)
+define_mpn(sqr_diag_addlsh1, int)
+define_mpn(subcnd_n, int)
+define_mpn(sublsh1_n, int)
+define_mpn(sublsh1_nc, int)
+define_mpn(sublsh1_n_ip1, int)
+define_mpn(sublsh1_nc_ip1, int)
+define_mpn(sublsh2_n, int)
+define_mpn(sublsh2_nc, int)
+define_mpn(sublsh2_n_ip1, int)
+define_mpn(sublsh2_nc_ip1, int)
+define_mpn(sublsh_n, int)
+define_mpn(sublsh_nc, int)
+define_mpn(sublsh_n_ip1, int)
+define_mpn(sublsh_nc_ip1, int)
+define_mpn(sqrtrem, pub)
+define_mpn(sub, pub)
+define_mpn(sub_1, pub)
+define_mpn(sub_err1_n, int)
+define_mpn(sub_err2_n, int)
+define_mpn(sub_err3_n, int)
+define_mpn(sub_n, pub)
+define_mpn(sub_nc, int)
+define_mpn(submul_1, pub)
+define_mpn(submul_1c, int)
+define_mpn(tabselect, int)
+define_mpn(umul_ppmm, int)
+define_mpn(umul_ppmm_r, int)
+define_mpn(udiv_qrnnd, int)
+define_mpn(udiv_qrnnd_r, int)
+define_mpn(xnor_n, pub)
+define_mpn(xor_n, pub)
dnl Defines for C global arrays and variables, with names matching what's
@@ -1564,7 +1564,14 @@ m4_assert_defined(`EPILOGUE_cpu')
`m4_error(`EPILOGUE without PROLOGUE: $1
')')dnl
define(`PROLOGUE_list',m4_list_quote(m4_list_remove($1,PROLOGUE_list)))dnl
-EPILOGUE_cpu(GSYM_PREFIX`$1')')
+EPILOGUE_cpu(GSYM_PREFIX`$1')
+MAYBE_HIDDEN(`$1')')
+
+define(MAYBE_HIDDEN,
+ifelse(ifdef(`HAVE_HIDDEN_ALIAS',`y',`n')`'ifdef(`PIC',`y',`n'), `yy',
+` .hidden $1
+ GLOBL ext_`'$1
+ext_`'$1 = $1'))
dnl Currently open PROLOGUEs, as a comma-separated list.
define(PROLOGUE_list)
@@ -1739,5 +1746,4 @@ m4_assert_numargs(-1)
m4_assert_defined(`GMP_NUMB_BITS')
`m4_hex_lowmask(GMP_NUMB_BITS)')
-
divert`'dnl
--
1.8.1.2
More information about the gmp-devel
mailing list