summaryrefslogtreecommitdiff
path: root/tools/mbench
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2011-01-06 16:53:07 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2011-01-06 16:53:07 +0000
commit3cbba175eaed5a9da621f6f79010be538f2caf02 (patch)
tree474c8aa648331fefb43168221e8aac387aeb6438 /tools/mbench
parent857a543e4eced5eb5abfb5c54a1f17edc96c281c (diff)
downloadmpfr-3cbba175eaed5a9da621f6f79010be538f2caf02.tar.gz
another patch from Patrick Pelissier to test get_ld (with export of data used)
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@7314 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tools/mbench')
-rw-r--r--tools/mbench/mfv5-mpfr.cc11
-rw-r--r--tools/mbench/mfv5.cc10
-rw-r--r--tools/mbench/mfv5.h3
3 files changed, 21 insertions, 3 deletions
diff --git a/tools/mbench/mfv5-mpfr.cc b/tools/mbench/mfv5-mpfr.cc
index 83b5edb56..bca24de0f 100644
--- a/tools/mbench/mfv5-mpfr.cc
+++ b/tools/mbench/mfv5-mpfr.cc
@@ -176,7 +176,14 @@ public:
return mpfr_atanh (a,b,r);
}
};
-
+class mpfr_get_ld_test {
+ long double ld;
+public:
+ int func (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t r) {
+ ld = mpfr_get_ld (c, r);
+ return 0;
+ }
+};
static mpfr_test<mpfr_add_test> test1 ("mpfr_add");
static mpfr_test<mpfr_sub_test> test2 ("mpfr_sub");
@@ -203,6 +210,8 @@ static mpfr_test<mpfr_acosh_test> testDh ("mpfr_acosh");
static mpfr_test<mpfr_asinh_test> testEh ("mpfr_asinh");
static mpfr_test<mpfr_atanh_test> testFh ("mpfr_atanh");
+static mpfr_test<mpfr_get_ld_test> testFj ("mpfr_get_ld");
+
/* Do the test */
template <class T>
bool mpfr_test<T>::test (const vector<string> &base, const option_test &opt) {
diff --git a/tools/mbench/mfv5.cc b/tools/mbench/mfv5.cc
index eaa2a76c1..2b287570a 100644
--- a/tools/mbench/mfv5.cc
+++ b/tools/mbench/mfv5.cc
@@ -28,7 +28,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#define USAGE \
"Bench functions for Pentium (V5++).\n" \
__FILE__" " __DATE__" " __TIME__" GCC "__VERSION__ "\n" \
- "Usage: mfv5 [-pPREC] [-sSEED] [-mSIZE] [-iPRIO] [-lLIST] tests ...\n"
+ "Usage: mfv5 [-pPREC] [-sSEED] [-mSIZE] [-iPRIO] [-lLIST] [-xEXPORT_BASE] tests ...\n"
using namespace std;
@@ -73,6 +73,7 @@ build_base (vector<string> &base, const option_test &opt)
const char *str;
mpfr_exp_t e;
char *buffer;
+ FILE *f = fopen (opt.export_base.c_str(), "w");
mpfr_init2 (x, opt.prec);
gmp_randinit_lc_2exp_size (state, 128);
@@ -88,12 +89,16 @@ build_base (vector<string> &base, const option_test &opt)
if (buffer == 0)
abort ();
sprintf (buffer, "%sE%ld", str, (unsigned long) e-strlen(str)+1);
+ if (f)
+ fprintf (f, "%s\n", buffer);
base.push_back (buffer);
if (opt.verbose)
cout << "[" << i << "] = " << buffer << endl;
free (buffer);
mpfr_free_str ((char*)str);
}
+ if (f)
+ fclose (f);
gmp_randclear(state);
mpfr_clear (x);
@@ -137,6 +142,9 @@ int main (int argc, const char *argv[])
list_test ();
exit (0);
break;
+ case 'x':
+ options.export_base = (argv[i]+2);
+ break;
default:
cerr << "Unkwown option:" << argv[i] << endl;
exit (1);
diff --git a/tools/mbench/mfv5.h b/tools/mbench/mfv5.h
index 253d2e23d..45a5f4b7b 100644
--- a/tools/mbench/mfv5.h
+++ b/tools/mbench/mfv5.h
@@ -40,7 +40,8 @@ struct option_test {
unsigned long seed;
unsigned long stat;
bool verbose;
- option_test () : prec (53), seed (14528596), stat (100), verbose (false) {}
+ std::string export_base;
+ option_test () : prec (53), seed (14528596), stat (100), verbose (false), export_base("") {}
};
class registered_test;