This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: MIPS: don't generate branch-likely on the sb1
- From: cgd at broadcom dot com
- To: drow at mvista dot com
- Cc: gcc-patches at gcc dot gnu dot org,echristo at redhat dot com,rsandifo at redhat dot com
- Date: 09 Jun 2003 10:51:52 -0700
- Subject: Re: MIPS: don't generate branch-likely on the sb1
- References: <20030609161706.GA571@nevyn.them.org><mailpost.1055175447.24207@news-sj1-1>
At Mon, 9 Jun 2003 16:17:28 +0000 (UTC), "Daniel Jacobowitz" wrote:
> If I'm remembering correctly, this is based on a really old patch or message
> I got from you. Branch likely is extremely penalized on the SB1 and we
> shouldn't generate them. Right?
I wouldn't say "extremely penalized."
It's always predicted taken (as one might expect from the name 8-), so
if that prediction is incorrect when the SB-1's (fairly good) branch
predictors would be correct, it loses relative to normal prediction.
"Historically" (i.e., in the ancient versions of GCC we benchmarked
that test on, way back when) branch-likely instructions seemed to be
overused, causing a performance penalty.
And the MIPS32 + MIPS64 arch specs say not to use branch-likely. 8-)
> #define GENERATE_BRANCHLIKELY (TARGET_BRANCHLIKELY \
> && !TARGET_SR71K \
> + && !TARGET_SB1 \
> && !TARGET_MIPS16)
No.
See also the code in mips.c (search for MASK_BRANCHLIKELY).
If people say -mbranch-likely, they should get branch-likely
instructions if they work on the CPU.
(I dunno if the SR71K check there is appropriate, based on my believe
of The Way Things Should Work above. I cc'd Eric and Richard S. in
case one of them has clue about that.)
The GENERATE_BRANCHLIKELY check should really be only:
(TARGET_BRANCHLIKELY
&& !TARGET_MIPS16)
If SR71K doesn't supoprt branch-likely instructions, then it should be
mentioned in ISA_HAS_BRANCHLIKELY rather than in
GENERATE_BRANCHLIKELY, so the -mbranch-likely warning will happen correctly.
cgd