This is the mail archive of the libc-alpha@sourceware.org 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] Another tweak to the multiplication algorithm


On Fri, Feb 15, 2013 at 12:49:09AM +0000, Joseph S. Myers wrote:
> On Fri, 15 Feb 2013, Siddhesh Poyarekar wrote:
> 
> > 1) Loop terminating condition check
> > 2) Increment i
> > 3) Decrement j
> 
> With a properly unrolled and scheduled loop, I'd hope there would be no 
> significant per-iteration cost for any of these steps, which I think makes 
> the number of operations the same in both cases.

Right, but the loop is not unrolled; I also checked the binary
generated from the 2.17 code to verify, in case my changes till date
may have changed that.  It's obvious though, since the loop
termination is not a trivial constant, and the only constant (P) comes
from across a compilation unit.  We don't build glibc with LTO, so
there's no chance of that constant propagating in here.

There is a real case for getting the constant to propagate somehow.  I
had tried inlining some of the mpa functions in the past and they had
given good results (~10% for pow).  Maybe I'll try to do that again
some time, if not with __mul then at least with __sqr, which has more
compact code.

Siddhesh


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