This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PowerPC: modf optimization

On 03/27/2013 02:53 PM, Adhemerval Zanella wrote:
On 03/26/2013 09:51 AM, Siddhesh Poyarekar wrote:
On 25 March 2013 23:55, Adhemerval Zanella <> wrote:
I measuring with a simple benchmark that calls the function multiple times and
calculate the average time on different kind of inputs. I'll check the benchmark

Oh yes please!  The instructions in benchtests/Makefile should be
sufficient, but please don't hesitate to reach out to me directly too
if needed.


Ok, here it an updated version using the benchtest framework. Using it I got:

PATCH - m32: modf: ITERS:200000: TOTAL:0.00169022s, MAX:16.982ns, MIN:7.118ns, 1.18328e+08 iter/s
MASTER:      modf: ITERS:200000: TOTAL:0.00307463s, MAX:18.642ns, MIN:13.8ns,  6.50484e+07 iter/s

PATCH - m64: modf: ITERS:200000: TOTAL:0.0011649s,  MAX:8.36ns, MIN:5.458ns,   1.71688e+08 iter/s
MASTER       modf: ITERS:200000: TOTAL:0.00340596s, MAX:21.344ns, MIN:16.85ns, 5.87206e+07 iter/s

Current patch adds the objects s_floor, s_ceil, s_floorf, and s_ceilf on
(since __ceil and __floor needs redirection to its implementation for POWER4). I
thought about an option on adding this optimization solely for POWER5+, avoiding
this inclusion. Any tips, advices, comments?


I'm fine with the benchtests addition (see one comment below).

I'm not sure about the __ceil, __floor issue and would like feedback from others on how to handle this,


2013-03-25  Adhemerval Zanella  <>

	* sysdeps/powerpc/fpu/s_modf.c: New file: modf optimization for POWER.
  	* sysdeps/powerpc/fpu/s_modff.c: New file: modff optimization for POWER.
	* sysdeps/powerpc/fpu/Makefile: Add s_floor[f] and s_ceil[f] for
	powerpc64/POWER4 builds.
	* benchtests/Makefile: Add modf testcase.
	* benchtests/bench-modf.c: New file: Benchmark test for modf.

diff --git a/benchtests/bench-modf.c b/benchtests/bench-modf.c
new file mode 100644
index 0000000..1751bee
--- /dev/null
+++ b/benchtests/bench-modf.c
@@ -0,0 +1,10 @@

Please always add a copyright header.

+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 100000
+#define FUNCNAME "modf"
+#include "bench-skeleton.c"

 Andreas Jaeger aj@{,} Twitter/Identica: jaegerandi
  SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
   GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg)
    GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]