This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Split mantissa calculation loop and add branchprediction to mp multiplication
- From: Siddhesh Poyarekar <siddhesh at redhat dot com>
- To: munroesj at us dot ibm dot com
- Cc: libc-alpha at sourceware dot org
- Date: Thu, 3 Jan 2013 09:08:14 +0530
- Subject: Re: [PATCH] Split mantissa calculation loop and add branchprediction to mp multiplication
- References: <20121231092850.GA21621@spoyarek.pnq.redhat.com><1357158013.19573.64.camel@spokane1.rchland.ibm.com>
On Wed, Jan 02, 2013 at 02:20:13PM -0600, Steven Munroe wrote:
> I do not understand what you are doing here. If the intent is to replace
> the X[], Y[], Z[] doubles with int's you will get overflows in Z[] if
> you are changing X[], y[]. Z[] with uint64_t then you avoid the
> overflows but (Z[k] + CUTTER)-CUTTER has no effect and you have not
> saved any space. Also u is still a double, so you are adding some
> expensive int->float->int converts to the inter loop.
I don't convert mantissa to int and leave everything as is. I had
posted the patch to do that earlier, which has not been commented upon
yet and that's the one you should be looking at; this patch has a
different purpose:
http://sourceware.org/ml/libc-alpha/2012-12/msg00354.html
None of the problems you're claiming will exist because:
(1) The product is computed and stored in 64-bit
(2) u does not exist since it is replaced by a much simpler operation,
which results in that snippet looking like this:
int64_t tmp = Z[k];
for (i=i1,j=i2-1; i<i2; i++,j--)
tmp += (int64_t) X[i]*Y[j];
Z[k] = (int) (tmp % (1 << 24));
Z[--k] = (int) (tmp / (1 << 24));
Siddhesh