This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
GCC and fast eveluaton of polynomials
- From: Andreas Svrcek-Seiler <svrci at tbi dot univie dot ac dot at>
- To: <gcc at gcc dot gnu dot org>
- Date: Mon, 19 Nov 2001 13:48:09 +0100 (CET)
- Subject: 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.
-------\ (----( )--------------------------------------------------------
\_) ) /
(_/