[gambit-list] Getting rid of the -fwrapv flag in gcc

Bradley Lucier lucier at math.purdue.edu
Sun Apr 15 20:45:07 EDT 2007


Marc:

On Apr 15, 2007, at 6:39 PM, Bradley Lucier wrote:

> This should allow us to omit the -fwrapv flag for gcc.  I don't  
> have any performance figures for gsc compiled without -fwrapv,

OK, I have these now, and it seems to be a wash using -fwrapv, but it  
is an advantage (about 4%) to use gcc-4.1.2 on a Powerbook instead of  
Apple's current release of 4.0.1.

I timed my soon-to-be-released replacement for fft bignum  
multiplication on a 1.67GHz G4 Powerbook.  Bottom line for (fft-mul a  
b) with (not (eq? a b)) and both = to (expt 3 1000000):

With -fwrapv: 702 ms
With fixed gambit.h and no -fwrapv: 708 ms
With fixed gambit.h and no -fwrapv and -fstrict-aliasing: 658 ms

The latter is valid because there are no aliasing violations in  
fftmul-fast.scm.  The code in _num.scm takes 733 ms, so the new code  
is clearer and provably correct, but it's faster.

The number of cycles that the main loop of the direct (forward) fft  
is scheduled by gcc-4.1.2:

With or without -fwrapv: 111
With fixed gambit.h and no -fwrapv and -fstrict-aliasing: 68(!)

This loop has 40 floating-point instructions.  We're talking a  
speedup of

 > (/ 733 658.)
1.1139817629179332

just by tweaking the macros in gambit.h.

Brad



More information about the Gambit-list mailing list