mpir/tune/benchmpn

54 lines
2.6 KiB
Plaintext
Raw Normal View History

2009-08-09 00:08:41 -04:00
#!/bin/bash
2009-09-18 16:51:52 -04:00
echo -ne "cpu \t"
2009-08-09 00:08:41 -04:00
../config.guess | cut -d - -f 1
TMPFILE=$(mktemp mpir.XXXXXX)
2009-08-09 00:08:41 -04:00
for fn in mpn_add_n mpn_sub_n mpn_mul_1.333 mpn_addmul_1.333 mpn_submul_1.333 mpn_mul_2 mpn_addmul_2 mpn_submul_2 \
mpn_addadd_n mpn_addsub_n mpn_subadd_n mpn_lshift.3 mpn_rshift.3 mpn_lshift2 mpn_rshift2 mpn_lshift1 mpn_rshift1 mpn_double mpn_half \
mpn_addlsh1_n mpn_sublsh1_n mpn_addlsh_n.3 mpn_sublsh_n.3 mpn_inclsh_n.3 mpn_declsh_n.3 \
2010-03-15 06:54:53 -04:00
mpn_rsh1add_n mpn_rsh1sub_n mpn_sumdiff_n mpn_store mpn_copyi mpn_copyd \
2011-07-21 11:31:06 -04:00
mpn_rsblsh1_n mpn_addlsh2_n mpn_rsblsh2_n mpn_karaadd mpn_karasub \
2010-07-22 15:41:30 -04:00
mpn_popcount mpn_hamdist mpn_com mpn_not mpn_and_n mpn_xor_n mpn_ior_n mpn_nand_n mpn_nior_n mpn_xnor_n mpn_andn_n \
mpn_iorn_n mpn_lshiftc.3 mpn_divexact_byff mpn_divexact_byfobm1.3 mpn_divexact_by3 mpn_divexact_1.3333 mpn_modexact_1c_odd.334333 \
2009-09-18 16:51:52 -04:00
mpn_add_err1_n mpn_sub_err1_n \
2009-09-18 18:56:19 -04:00
mpn_divrem_euclidean_qr_1.77777 mpn_divrem_euclidean_qr_2 mpn_divrem_euclidean_r_1.77777 mpn_divrem_1.77777 mpn_divrem_2 \
mpn_divrem_hensel_qr_1.3333 mpn_divrem_hensel_qr_1_1.3333 mpn_divrem_hensel_qr_1_2.3333 \
mpn_divrem_hensel_r_1.3333 mpn_divrem_hensel_rsh_qr_1.3333 mpn_rsh_divrem_hensel_qr_1.3333 \
mpn_rsh_divrem_hensel_qr_1_1.3333 mpn_rsh_divrem_hensel_qr_1_2.3333 \
2010-03-15 07:14:17 -04:00
mpn_mod_1_1 mpn_mod_1_2 mpn_mod_1_3 mpn_mod_1_4 mpn_mod_34lsub1
2009-08-09 00:08:41 -04:00
do
fnc=$(echo $fn | cut -d _ -f 2- | cut -d . -f 1)
while [ $(echo "$fnc" | wc -c) -le 24 ]
2009-08-09 00:08:41 -04:00
do
fnc=$(echo " $fnc")
done
echo -ne "$fnc\t"
./speed -c -s 1000 $fn > $TMPFILE 2>&1
if [ $? -eq 0 ] ; then
cat $TMPFILE | tail -n 1 | tr -s " " | cut -f 2 -d " " | cut -d . -f 1
else
2010-03-15 06:54:53 -04:00
#try alternate name
if [ $fn == mpn_com ] ; then fn=mpn_com_n ; fi
if [ $fn == mpn_lshift2 ] ; then fn=mpn_lshift.2 ; fi
if [ $fn == mpn_rshift2 ] ; then fn=mpn_rshift.2 ; fi
if [ $fn == mpn_rshift1 ] ; then fn=mpn_rshift.1 ; fi
if [ $fn == mpn_lshift1 ] ; then fn=mpn_lshift.1 ; fi
if [ $fn == mpn_half ] ; then fn=mpn_rshift.1 ; fi
if [ $fn == mpn_double ] ; then fn=mpn_lshift.1 ; fi
2010-03-15 06:54:53 -04:00
if [ $fn == mpn_store ] ; then fn=MPN_ZERO ; fi
if [ $fn == mpn_copyi ] ; then fn=MPN_COPY_INCR ; fi
if [ $fn == mpn_copyd ] ; then fn=MPN_COPY_DECR ; fi
if [ $fn == mpn_divexact_byfobm1.3 ] ; then fn=mpn_bdiv_dbm1c ; fi
2010-03-15 07:14:17 -04:00
if [ $fn == mpn_mod_1_2 ] ; then fn=mpn_mod_1s_2 ; fi
if [ $fn == mpn_mod_1_3 ] ; then fn=mpn_mod_1s_3 ; fi
if [ $fn == mpn_mod_1_4 ] ; then fn=mpn_mod_1s_4 ; fi
2010-07-22 15:41:30 -04:00
if [ $fn == mpn_not ] ; then fn=mpn_com ; fi
2010-03-15 06:54:53 -04:00
./speed -c -s 1000 $fn > $TMPFILE 2>&1
if [ $? -eq 0 ] ; then
cat $TMPFILE | tail -n 1 | tr -s " " | cut -f 2 -d " " | cut -d . -f 1
else
echo
fi
2009-08-09 00:08:41 -04:00
fi
done
rm -f $TMPFILE