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]

Re: optimisation question


On Feb 3, 2005, at 9:18 AM, Robert Dewar wrote:
]Remy X.O. Martin wrote:

I'm CC'ing this back to this list, as there were clearly others who are interested.
I came across the Shark message that had a large hand in my assuming that a=b=c type expressions could cause performance issues (on a G5):
"There are a large number of issue stalls caused by data dependencies within this loop. Issue stalls occur when the result of an instruction is used by a subsequent instruction before the result has been calculated. You should re-order the instructions to achieve better code scheduling or unroll this loop to increase overall instruction throughput."
To my untrained eye, that second sentence appears to be very applicable to a=b=c type statements, hence my initial question about this.
R.

The statement about reordering is for compilers. It is completely irrelevant for a C programmer, and you should not contort your code in any way for this or any other similar low level reason.

That's good general advice, but out here in the Real World there are times when
performance is more important than how pretty the code looks. Certainly if you're
looking at lines that are taking less than 1% of the execution time, Robert's
advice is good.


Shark is aimed at people who have a good general understanding of how things
work at the assembly-language level, the PowerPC architecture, and the individual
processor that you're targeting (G5 or whatever). This includes compiler back-end
people, but others as well. If you don't already understand this stuff fairly well, and
it seems that Remy might not, Shark is not going to help you. It's not intended as
a PowerPC tutorial.



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