diff options
Diffstat (limited to 'libc/benchtests')
-rw-r--r-- | libc/benchtests/Makefile | 129 | ||||
-rw-r--r-- | libc/benchtests/atan-inputs | 3 | ||||
-rw-r--r-- | libc/benchtests/bench-modf.c | 39 | ||||
-rw-r--r-- | libc/benchtests/cos-inputs | 5 | ||||
-rw-r--r-- | libc/benchtests/exp-inputs | 2 | ||||
-rw-r--r-- | libc/benchtests/pow-inputs | 2 | ||||
-rw-r--r-- | libc/benchtests/rint-inputs | 4 | ||||
-rw-r--r-- | libc/benchtests/sin-inputs | 7 | ||||
-rw-r--r-- | libc/benchtests/slowatan-inputs | 3 | ||||
-rw-r--r-- | libc/benchtests/slowatan.c | 19 | ||||
-rw-r--r-- | libc/benchtests/slowcos-inputs | 5 | ||||
-rw-r--r-- | libc/benchtests/slowcos.c | 19 | ||||
-rw-r--r-- | libc/benchtests/slowexp-inputs | 1 | ||||
-rw-r--r-- | libc/benchtests/slowexp.c | 19 | ||||
-rw-r--r-- | libc/benchtests/slowpow-inputs | 1 | ||||
-rw-r--r-- | libc/benchtests/slowpow.c | 19 | ||||
-rw-r--r-- | libc/benchtests/slowsin-inputs | 7 | ||||
-rw-r--r-- | libc/benchtests/slowsin.c | 19 | ||||
-rw-r--r-- | libc/benchtests/slowtan-inputs | 1 | ||||
-rw-r--r-- | libc/benchtests/slowtan.c | 19 | ||||
-rw-r--r-- | libc/benchtests/tan-inputs | 1 |
21 files changed, 318 insertions, 6 deletions
diff --git a/libc/benchtests/Makefile b/libc/benchtests/Makefile index 74938b925..387fde441 100644 --- a/libc/benchtests/Makefile +++ b/libc/benchtests/Makefile @@ -25,7 +25,9 @@ # - Define foo-ITER with the number of iterations you want to run. Keep it # high enough that the overhead of clock_gettime is only a small fraction of -# the total run time of the test. +# the total run time of the test. A good idea would be to keep the run time +# of each test at around 10 seconds for x86_64. That is just a guideline, +# since some scenarios may require higher run times. # - Define foo-ARGLIST as a colon separated list of types of the input # arguments. Use `void` if function does not take any inputs. Put in quotes @@ -43,17 +45,136 @@ # See pow-inputs for an example. subdir := benchtests -bench := exp pow +bench := exp pow rint sin cos tan atan modf \ + slowexp slowpow slowsin slowcos slowtan slowatan -exp-ITER = 100000 +# exp function fast path: sysdeps/ieee754/dbl-64/e_exp.c +exp-ITER = 5e8 exp-ARGLIST = double exp-RET = double LDFLAGS-bench-exp = -lm -pow-ITER = 100000 +# pow function fast path: sysdeps/ieee754/dbl-64/e_pow.c +pow-ITER = 2e8 pow-ARGLIST = double:double pow-RET = double LDFLAGS-bench-pow = -lm +rint-ITER = 250000000 +rint-ARGLIST = double +rint-RET = double +LDFLAGS-bench-rint = -lm + +# exp function slowest path: sysdeps/ieee754/dbl-64/mpexp.c +slowexp-ITER = 3e5 +slowexp-ARGLIST = double +slowexp-RET = double +slowexp-INCLUDE = slowexp.c +LDFLAGS-bench-slowexp = -lm + +# sin function fast path: sysdeps/ieee754/dbl-64/s_sin.c +sin-ITER = 3e9 +sin-ARGLIST = double +sin-RET = double +LDFLAGS-bench-sin = -lm + +# cos function fast path: sysdeps/ieee754/dbl-64/s_sin.c +cos-ITER = 3e9 +cos-ARGLIST = double +cos-RET = double +LDFLAGS-bench-cos = -lm + +# tan function fast path: sysdeps/ieee754/dbl-64/s_tan.c +tan-ITER = 3e9 +tan-ARGLIST = double +tan-RET = double +LDFLAGS-bench-tan = -lm + +# atan function fast path: sysdeps/ieee754/dbl-64/s_atan.c +atan-ITER = 6e9 +atan-ARGLIST = double +atan-RET = double +LDFLAGS-bench-atan = -lm + +# pow function slowest path: sysdeps/ieee754/dbl-64/slowpow.c +slowpow-ITER = 1e5 +slowpow-ARGLIST = double:double +slowpow-RET = double +slowpow-INCLUDE = slowpow.c +LDFLAGS-bench-slowpow = -lm + +# sin function slowest path: sysdeps/ieee754/dbl-64/sincos32.c +slowsin-ITER = 3e7 +slowsin-ARGLIST = double +slowsin-RET = double +slowsin-INCLUDE = slowsin.c +LDFLAGS-bench-slowsin = -lm + +# cos function slowest path: sysdeps/ieee754/dbl-64/sincos32.c +slowcos-ITER = 3e7 +slowcos-ARGLIST = double +slowcos-RET = double +slowcos-INCLUDE = slowcos.c +LDFLAGS-bench-slowcos = -lm + +# tan function slowest path: sysdeps/ieee754/dbl-64/mptan.c +slowtan-ITER = 3e7 +slowtan-ARGLIST = double +slowtan-RET = double +slowtan-INCLUDE = slowtan.c +LDFLAGS-bench-slowtan = -lm + +# atan function slowest path: sysdeps/ieee754/dbl-64/mpatan.c +slowatan-ITER = 3e8 +slowatan-ARGLIST = double +slowatan-RET = double +slowatan-INCLUDE = slowatan.c +LDFLAGS-bench-slowatan = -lm + + + +# Rules to build and execute the benchmarks. Do not put any benchmark +# parameters beyond this point. + include ../Makeconfig include ../Rules + +binaries-bench := $(addprefix $(objpfx)bench-,$(bench)) + +# This makes sure CPPFLAGS-nonlib and CFLAGS-nonlib are passed +# for all these modules. +cpp-srcs-left := $(binaries-bench:=.c) +lib := nonlib +include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left)) + +bench-deps := bench-skeleton.c Makefile + +run-bench = $(test-wrapper-env) \ + GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \ + $($*-ENV) $(rtld-prefix) $${run} + +bench-clean: + rm -f $(binaries-bench) $(addsuffix .o,$(binaries-bench)) + +bench: $(binaries-bench) + { for run in $^; do \ + echo "Running $${run}" >&2; \ + $(run-bench); \ + done; } > $(objpfx)bench.out-tmp; \ + if [ -f $(objpfx)bench.out ]; then \ + mv -f $(objpfx)bench.out $(objpfx)bench.out.old; \ + fi; \ + mv -f $(objpfx)bench.out-tmp $(objpfx)bench.out + +$(binaries-bench): %: %.o \ + $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \ + $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit) + $(+link) + +$(objpfx)bench-%.c: %-inputs $(bench-deps) + { if [ -n "$($*-INCLUDE)" ]; then \ + cat $($*-INCLUDE); \ + fi; \ + $(..)scripts/bench.pl $(patsubst %-inputs,%,$<) \ + $($*-ITER) $($*-ARGLIST) $($*-RET); } > $@-tmp + mv -f $@-tmp $@ diff --git a/libc/benchtests/atan-inputs b/libc/benchtests/atan-inputs new file mode 100644 index 000000000..c685db3b9 --- /dev/null +++ b/libc/benchtests/atan-inputs @@ -0,0 +1,3 @@ +0x1.000000c5cba86p0 +0x1.000001883003ap0 +0x1.00000dfb2b674p0 diff --git a/libc/benchtests/bench-modf.c b/libc/benchtests/bench-modf.c new file mode 100644 index 000000000..975a29f19 --- /dev/null +++ b/libc/benchtests/bench-modf.c @@ -0,0 +1,39 @@ +/* Copyright (C) 2013 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +extern double modf (double, double *); + +#define CALL_BENCH_FUNC(j, i) modf ( in[j].arg0, &i); + +struct args +{ + double arg0; +} in[] = +{ + { 42.42 }, + { -42.42 } +}; + +#define NUM_SAMPLES (sizeof (in) / sizeof (struct args)) + +static volatile double ret = 0.0; +#define BENCH_FUNC(j) ({double iptr; ret = CALL_BENCH_FUNC (j, iptr);}) + +#define ITER 250000000 +#define FUNCNAME "modf" + +#include "bench-skeleton.c" diff --git a/libc/benchtests/cos-inputs b/libc/benchtests/cos-inputs new file mode 100644 index 000000000..98f4122aa --- /dev/null +++ b/libc/benchtests/cos-inputs @@ -0,0 +1,5 @@ +0x1.000000cf4a2a1p0 +0x1.0000010b239a8p0 +0x1.00000162a932ap0 +0x1.000002d452a11p0 +0x1.000005bc7d86cp0 diff --git a/libc/benchtests/exp-inputs b/libc/benchtests/exp-inputs index a2086baa8..d81cc0710 100644 --- a/libc/benchtests/exp-inputs +++ b/libc/benchtests/exp-inputs @@ -1 +1 @@ -708.00096423260981737257679924368858 +42 diff --git a/libc/benchtests/pow-inputs b/libc/benchtests/pow-inputs index dbb1270b7..2f7cc03b5 100644 --- a/libc/benchtests/pow-inputs +++ b/libc/benchtests/pow-inputs @@ -1 +1 @@ -1.0000000000000020, 1.5 +42.0, 42.0 diff --git a/libc/benchtests/rint-inputs b/libc/benchtests/rint-inputs new file mode 100644 index 000000000..a5f83dc8f --- /dev/null +++ b/libc/benchtests/rint-inputs @@ -0,0 +1,4 @@ +78.5 +-78.5 +4503599627370497.0 +-4503599627370497.0 diff --git a/libc/benchtests/sin-inputs b/libc/benchtests/sin-inputs new file mode 100644 index 000000000..620cea8d9 --- /dev/null +++ b/libc/benchtests/sin-inputs @@ -0,0 +1,7 @@ +0.9 +2.3 +3.7 +3.9 +4.0 +4.7 +5.9 diff --git a/libc/benchtests/slowatan-inputs b/libc/benchtests/slowatan-inputs new file mode 100644 index 000000000..e557a3cb2 --- /dev/null +++ b/libc/benchtests/slowatan-inputs @@ -0,0 +1,3 @@ +0x1.000000c5cba87p0 +0x1.000001883003bp0 +0x1.00000dfb2b675p0 diff --git a/libc/benchtests/slowatan.c b/libc/benchtests/slowatan.c new file mode 100644 index 000000000..9a11d30bd --- /dev/null +++ b/libc/benchtests/slowatan.c @@ -0,0 +1,19 @@ +/* Define slowatan. + Copyright (C) 2013 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#define slowatan atan diff --git a/libc/benchtests/slowcos-inputs b/libc/benchtests/slowcos-inputs new file mode 100644 index 000000000..b7eb23536 --- /dev/null +++ b/libc/benchtests/slowcos-inputs @@ -0,0 +1,5 @@ +0x1.000000cf4a2a2p0 +0x1.0000010b239a9p0 +0x1.00000162a932bp0 +0x1.000002d452a10p0 +0x1.000005bc7d86dp0 diff --git a/libc/benchtests/slowcos.c b/libc/benchtests/slowcos.c new file mode 100644 index 000000000..9f56234af --- /dev/null +++ b/libc/benchtests/slowcos.c @@ -0,0 +1,19 @@ +/* Define slowcos. + Copyright (C) 2013 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#define slowcos cos diff --git a/libc/benchtests/slowexp-inputs b/libc/benchtests/slowexp-inputs new file mode 100644 index 000000000..a2086baa8 --- /dev/null +++ b/libc/benchtests/slowexp-inputs @@ -0,0 +1 @@ +708.00096423260981737257679924368858 diff --git a/libc/benchtests/slowexp.c b/libc/benchtests/slowexp.c new file mode 100644 index 000000000..92ac5e9b4 --- /dev/null +++ b/libc/benchtests/slowexp.c @@ -0,0 +1,19 @@ +/* Define slowexp. + Copyright (C) 2013 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#define slowexp exp diff --git a/libc/benchtests/slowpow-inputs b/libc/benchtests/slowpow-inputs new file mode 100644 index 000000000..dbb1270b7 --- /dev/null +++ b/libc/benchtests/slowpow-inputs @@ -0,0 +1 @@ +1.0000000000000020, 1.5 diff --git a/libc/benchtests/slowpow.c b/libc/benchtests/slowpow.c new file mode 100644 index 000000000..08f436d2a --- /dev/null +++ b/libc/benchtests/slowpow.c @@ -0,0 +1,19 @@ +/* Define slowpow. + Copyright (C) 2013 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#define slowpow pow diff --git a/libc/benchtests/slowsin-inputs b/libc/benchtests/slowsin-inputs new file mode 100644 index 000000000..39daf80b3 --- /dev/null +++ b/libc/benchtests/slowsin-inputs @@ -0,0 +1,7 @@ +0.93340582292648832662962377071381 +2.3328432680770916363144351635128 +3.7439477503636453548097051680088 +3.9225160069792437411706487182528 +4.0711651639931289992091478779912 +4.7858438478542097982426639646292 +5.9840767662578002727968851104379 diff --git a/libc/benchtests/slowsin.c b/libc/benchtests/slowsin.c new file mode 100644 index 000000000..b6809bdd7 --- /dev/null +++ b/libc/benchtests/slowsin.c @@ -0,0 +1,19 @@ +/* Define slowsin. + Copyright (C) 2013 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#define slowsin sin diff --git a/libc/benchtests/slowtan-inputs b/libc/benchtests/slowtan-inputs new file mode 100644 index 000000000..74a7eab3f --- /dev/null +++ b/libc/benchtests/slowtan-inputs @@ -0,0 +1 @@ +0x1.dffffffffff1fp-22 diff --git a/libc/benchtests/slowtan.c b/libc/benchtests/slowtan.c new file mode 100644 index 000000000..583f16f0d --- /dev/null +++ b/libc/benchtests/slowtan.c @@ -0,0 +1,19 @@ +/* Define slowtan. + Copyright (C) 2013 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#define slowtan tan diff --git a/libc/benchtests/tan-inputs b/libc/benchtests/tan-inputs new file mode 100644 index 000000000..4369d7577 --- /dev/null +++ b/libc/benchtests/tan-inputs @@ -0,0 +1 @@ +0x1.dffffffffff1ep-22 |