This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Loop unrolling: black magic or stochastic process?
- From: Tim Prince <TimothyPrince at sbcglobal dot net>
- To: dgorur <dgorur at gmail dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Wed, 08 Jul 2009 14:49:04 -0700
- Subject: Re: Loop unrolling: black magic or stochastic process?
- References: <24398027.post@talk.nabble.com>
- Reply-to: tprince at computer dot org
dgorur wrote:
> Hi,
>
> I've been getting unpredictable results with gcc -funroll-loops.
As the other reply suggested, you can't expect consistent results when
working on uninitialized data, and no amount of code tuning will
compensate for it.
I wonder about your selection of time(); as you're not threading, and
appear to be interested in comparing code execution times, why not clock() ?
An obvious question, which you could answer better for yourself, as you
have chosen such a quirky version of gcc, is whether -funroll-loops is
producing the apparently desired result of unrolling the inner loop fully.
If not, why not use
--param max-unroll-times=6 (3,2)
to set a more suitable amount of unrolling?