about summary refs log tree commit diff
path: root/benchtests
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@redhat.com>2013-09-19 16:55:27 +0530
committerSiddhesh Poyarekar <siddhesh@redhat.com>2013-09-19 16:55:27 +0530
commit7849ff938cf30d6a381ee864048bc0b3e8c96475 (patch)
tree6d4feb02fb9d3e9d9891fb43b4eb4ab21b2f9dae /benchtests
parentcfa3c8865ff8519f5110c5c261eb8cd7ded144aa (diff)
downloadglibc-7849ff938cf30d6a381ee864048bc0b3e8c96475.tar.gz
glibc-7849ff938cf30d6a381ee864048bc0b3e8c96475.tar.xz
glibc-7849ff938cf30d6a381ee864048bc0b3e8c96475.zip
Add benchmark inputs for sincos
Diffstat (limited to 'benchtests')
-rw-r--r--benchtests/Makefile4
-rw-r--r--benchtests/bench-sincos.c86
2 files changed, 89 insertions, 1 deletions
diff --git a/benchtests/Makefile b/benchtests/Makefile
index 9cb4ff9006..4f4bd5408a 100644
--- a/benchtests/Makefile
+++ b/benchtests/Makefile
@@ -21,7 +21,7 @@
 
 subdir := benchtests
 bench := acos acosh asin asinh atan atanh cos cosh exp log modf pow rint sin \
-	 sinh tan tanh
+	 sincos sinh tan tanh
 
 # String function benchmarks.
 string-bench := bcopy bzero memccpy memchr memcmp memcpy memmem memmove \
@@ -98,6 +98,8 @@ tanh-ARGLIST = double
 tanh-RET = double
 LDLIBS-bench-tanh = -lm
 
+LDLIBS-bench-sincos = -lm
+
 
 
 # Rules to build and execute the benchmarks.  Do not put any benchmark
diff --git a/benchtests/bench-sincos.c b/benchtests/bench-sincos.c
new file mode 100644
index 0000000000..7662dde04a
--- /dev/null
+++ b/benchtests/bench-sincos.c
@@ -0,0 +1,86 @@
+/* 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 void sincos (double, double *, double *);
+
+#define CALL_BENCH_FUNC(v, i, j, k) sincos ( variants[v].in[i].arg0, &j, &k);
+
+struct args
+{
+  volatile double arg0;
+};
+
+struct args in0[12] =
+{
+  { 0.9 },
+  { 2.3 },
+  { 3.7 },
+  { 3.9 },
+  { 4.0 },
+  { 4.7 },
+  { 5.9 },
+
+  { 0x1.000000cf4a2a1p0 },
+  { 0x1.0000010b239a8p0 },
+  { 0x1.00000162a932ap0 },
+  { 0x1.000002d452a11p0 },
+  { 0x1.000005bc7d86cp0 }
+};
+
+struct args in1[12] =
+{
+  { 0.93340582292648832662962377071381 },
+  { 2.3328432680770916363144351635128 },
+  { 3.7439477503636453548097051680088 },
+  { 3.9225160069792437411706487182528 },
+  { 4.0711651639931289992091478779912 },
+  { 4.7858438478542097982426639646292 },
+  { 5.9840767662578002727968851104379 },
+
+  { 0x1.000000cf4a2a2p0 },
+  { 0x1.0000010b239a9p0 },
+  { 0x1.00000162a932bp0 },
+  { 0x1.000002d452a10p0 },
+  { 0x1.000005bc7d86dp0 }
+};
+
+struct _variants
+{
+  const char *name;
+  int count;
+  struct args *in;
+};
+
+struct _variants variants[2] =
+  {
+    {"sincos()", 12, in0},
+    {"sincos(768bits)", 12, in1},
+  };
+
+#define NUM_VARIANTS 2
+#define NUM_SAMPLES(i) (variants[i].count)
+#define VARIANT(i) (variants[i].name)
+
+#define BENCH_FUNC(v, j) \
+({									      \
+  volatile double iptr;							      \
+  volatile double iptr2;						      \
+   CALL_BENCH_FUNC (v, j, iptr, iptr2);					      \
+})
+
+#define FUNCNAME "sincos"
+#include "bench-skeleton.c"