This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
GCC PowerPC usage of LR and CTR
- To: gcc at gcc dot gnu dot org
- Subject: GCC PowerPC usage of LR and CTR
- From: laire at t-online dot de (Ralph Schmidt)
- Date: Fri, 2 Mar 2001 12:28:50 +0100
On comp.arch is some gcc relevant discussion about the new G4e/7450
going on. As the chip has now a return stack it makes a real difference
if compilers follow the ppc standards about the usage of ctr and lr.
As i still only use 2.95.3 i can't know if the issue was already
fixed inside gcc's powerpc module but if not...now would be the
time to do it.
Regards
Here the snap of Jeff Rupley's article.
--------------------------------------------------------
I disagree. I think the architecture books have been fairly
clear that using the "bclr" opcode is for return from subroutines, and
"bcctr" opcode for indirect/computed jumps. See "PowerPC Microprocessor
Family : The Programming Environments for
32-Bit Microprocessors" available at the Moto website, sections
2.1.6 and 4.2.4.2. Note that section 2.1.6 explicitly mentions
that a LR stack may someday be available, and here it is.
That said, I have seen a good amount of code that doesn't
follow the above guidelines. Code that doesn't follow the guidelines won't
run as fast as code that does, but it will still run correctly.