This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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]

GCC and fast eveluaton of polynomials


Dear developers,

I,ve got an inner loop 
inside which I evaluate a polynomial
If I do it naively according to horner's scheme:
(replaciing a log() call, that's even more time-consuming)
	      u2 = u*u;
	      v = (((((B5*u2+B4)*u2+B3)*u2+B2)*u2+B1)*u2+B0)*u;

the coompiled executable is significantly slower than
when the source reads
	      v = B5*u2 + B4;
	      v = v*u2 + B3;
	      v = v*u2 + B2;
	      v = v*u2 + B1;
	      v = v*u2 + B0;
	      v *= u;

this beavior is independent of how much optimizatons I turn on.
by the way,the newly released intel compiler produces even slower code ;-)

... maybe there's room for easy improvement ?

best regards
andreas
-- 
             
            )))))
            (((((
           ( O O )
-------oOOO--(_)--OOOo-----------------------------------------------------
              o        Wolfgang Andreas Svrcek-Seiler  
              o        (godzilla) 
                       svrci@tbi.univie.ac.at
      .oooO            Tel.:01-4277-52733 
      (   )   Oooo.    
-------\ (----(   )--------------------------------------------------------
        \_)    ) /
              (_/



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