Re: Optimized program four times slower.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



nightstrike@xxxxxxxxx wrote:
On 7/14/07, Tim Prince <tprince@xxxxxxxxxxxxx> wrote:
Brian Dessent wrote:

you should file a PR.  Note that dec, rather than add -1, has been a
standard way to write code which might be OK on AMD but dead slow on
Intel, since 6 years ago.

Why is add -1 slower than dec?
Did you look up partial flags stalls, if you haven't done so the last 6 years? dec has the same problem as inc. dec is slower than add -1 or sub 1, on many Intel CPUs, beginning with P4. The time required to restore the flags which are to be preserved by dec is outrageous. Often, there may be an additional advantage in moving the add -1 further up the chain, so as to allow more opportunity to prepare the branch. I doubt Intel foresaw the deficit which would be incurred by default options in the gcc 3.x of RedHat/CentOS 4.x using dec by default,even though it has been documented by Intel http://www.intel.com/intelpress/toc-soc.pdf
and others, for years.
If you are using these oldish gcc versions, the Intel options don't generally hurt AMD, but the default AMD options do hurt Intel.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux