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 v2.0] Use saturated arithmetic for overflow detection.


On Fri, Nov 01, 2013 at 06:58:02PM +0100, OndÅej BÃlka wrote:
> On Fri, Nov 01, 2013 at 10:19:25AM -0700, Paul Eggert wrote:
> > If you like tuning this stuff you might want to look at
> > <http://locklessinc.com/articles/sat_arithmetic/>, which
> > shows how to do saturated arithmetic without jumps, both portably
> > and on x86-64; I don't know whether this will save code space, though.
> 
> On sandy bridge my implementation runs
> 
> real	0m0.548s
> user	0m0.548s
> sys	0m0.000s
> 
> when I replace multiplication from one in article it is slower.
> 
> real	0m0.599s
> user	0m0.599s
> sys	0m0.000s
> 
> I got similar slowdown on core2, nehalem and fx10 machines. 
> 
Here are attached benchmarks.

Attachment: assembly.c
Description: Text document

Attachment: branchfree.c
Description: Text document


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