This is the mail archive of the
mailing list for the GCC project.
Re: march question on pentium4
- From: Tim Prince <tprince at computer dot org>
- To: martin dot kahlert at infineon dot com, gcc at gcc dot gnu dot org
- Date: Fri, 30 Aug 2002 06:50:58 -0700
- Subject: Re: march question on pentium4
- References: <20020830080402.B6474@keksy.muc.infineon.com>
- Reply-to: tprince at computer dot org
On Thursday 29 August 2002 23:04, Martin Kahlert wrote:
> I use gcc-3.2 release on a FreeBSD system running on a Pentium 4 machine.
> My (integer based, no floating point at all) code shows a strange
> behaviour: It is faster when compiled with -march=pentium3 than
> with -march=pentium4. Is this a known issue or a problem that should be
> investigated further?
If I am to speculate without an example, the pentium4 costs for shift and
multiply are set so high that the compiler will always use the alternative of
add sequences. Intel's P4 Optimization Guide suggests they be set only high
enough that a shift costs more than 3 adds, for example. You could be
getting excessive code expansion for multiplication by constant.
While the expectation of gcc would be that the costs reflect accurately the
performance of the instructions, high costs which produce long code may not
be best in practice.
Evidently not speaking for anyone.