From: Richard Sandiford <rdsandiford@googlemail.com>
To: "Maciej W. Rozycki" <macro@linux-mips.org>
Cc: Kumba <kumba@gentoo.org>,
gcc-patches@gcc.gnu.org,
Linux MIPS List <linux-mips@linux-mips.org>
Subject: Re: [PATCH]: R10000 Needs LL/SC Workaround in Gcc
Date: Sun, 02 Nov 2008 11:34:37 +0000 [thread overview]
Message-ID: <87ljw2gy42.fsf@firetop.home> (raw)
In-Reply-To: <alpine.LFD.1.10.0811021036330.20461@ftp.linux-mips.org> (Maciej W. Rozycki's message of "Sun\, 2 Nov 2008 10\:49\:45 +0000 \(GMT\)")
"Maciej W. Rozycki" <macro@linux-mips.org> writes:
> On Sat, 1 Nov 2008, Kumba wrote:
>> The branch-likely stuff is only going to work for MIPS-II or higher targets.
>> In the odd (but possible) cases where MIPS-I might be used with -mfix-r10000,
>> I assume we'll still have to emit 28 nops prior to a beq/beqz instruction. Is
>> this already taken care of someplace?
>
> MIPS I does not support LL/SC, so that case is not to be concerned.
> These instructions are emulated on such processors and as such can appear
> in assembly snippets, but GCC is expected not to emit them itself (I hope
> it hasn't changed; if it has, then we are in trouble -- I suppose a
> compiler error is justified for such an odd case).
Not quite true. Use of LL and SC is controlled by a separate option,
-mllsc. As you'd expect, this option is on by default if the architecture
provides LL and SC. It's therefore on by default for generic MIPS II
and above, and for -march=<cpu> if <cpu> provides the instructions.
However, the default for other architectures depends on the configuration.
If the configured target is known to emulate the LL and SC instructions
(as Linux targets are), the default is -mllsc. It is -mno-llsc otherwise.
>> Hmm, okay. Might this work to enable -mbranch-likely if -mfix-r10000? (Kind
>> of guessing by looking at other segments of code).
>>
>> if ((target_flags_explicit & MASK_BRANCHLIKELY) == 0)
>> {
>> if (ISA_HAS_BRANCHLIKELY
>> && (optimize_size
>> || (!(target_flags_explicit & MASK_FIX_R10000) == 0)
>> || (mips_tune_info->tune_flags & PTF_AVOID_BRANCHLIKELY) == 0))
>> target_flags |= MASK_BRANCHLIKELY;
>> else
>> target_flags &= ~MASK_BRANCHLIKELY;
>> }
>>
>>
>>
>> My understanding so far for -mfix-r10000:
>> - Gets enabled if -march=r10000 is passed (done)
>> - Enable -mbranch-likely if not already enabled on >= MIPS-II (working on)
>> - Emits beqzl in the asm templates if enabled and >= MIPS-II (unsure)
>> - Emits 28 nops prior to beq/beqz if enabled and == MIPS-I (unsure)
>> - Ditto for asm templates (unsure)
>> - Documentation (not done)
>
> I think the best option is to leave -mbranch-likely intact and bail out
> if -mfix-r10000 and -mno-branch-likely are passed at the same time.
> Anything else is likely to cause confusion. Then -march=r10000 should
> enable both -mfix-r10000 and -mbranch-likely.
>
> I believe (but have not checked) that all CPUs/ISAs that are within the
> MIPS II - MIPS IV range enable -mbranch-likely by default, so there is no
> problem here unless somebody requests -mno-branch-likely in which case
> they get what they asked for (i.e. a compiler error). I believe all MIPS
> architecture CPUs/ISAs disable -mbranch-likely by default, but such code
> cannot run on the R10k anyway.
>
> I think it covers all cases. Comments?
For avoidance of doubt, this is exactly option #1 in my messages.
As you say, -march=r10000 already implies -mbranch-likely unless
explicitly overridden.
Richard
next prev parent reply other threads:[~2008-11-02 11:34 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-31 5:00 [PATCH]: R10000 Needs LL/SC Workaround in Gcc Kumba
2008-10-31 14:24 ` Maciej W. Rozycki
2008-11-01 7:30 ` Kumba
2008-11-01 17:41 ` Richard Sandiford
2008-11-01 18:49 ` Kumba
2008-11-01 19:42 ` Richard Sandiford
2008-11-02 0:00 ` Kumba
2008-11-02 10:00 ` Richard Sandiford
2008-11-03 9:01 ` Kumba
2008-11-03 20:47 ` Richard Sandiford
2008-11-04 0:04 ` Ralf Baechle
2008-11-04 7:14 ` Kumba
2008-11-04 9:04 ` Ralf Baechle
2008-11-04 14:26 ` Maciej W. Rozycki
2008-11-04 14:31 ` Ralf Baechle
2008-11-04 14:23 ` Maciej W. Rozycki
2008-11-08 9:37 ` Richard Sandiford
2008-11-08 18:20 ` Markus Gothe
2008-11-10 6:09 ` Kumba
2008-11-11 23:13 ` Richard Sandiford
2008-11-11 23:28 ` Richard Sandiford
2008-11-11 23:40 ` Maciej W. Rozycki
2008-11-12 7:42 ` Kumba
2008-11-13 23:10 ` Richard Sandiford
2008-11-14 8:14 ` Kumba
2008-11-15 14:28 ` Richard Sandiford
2008-11-16 7:35 ` Kumba
2008-11-02 10:49 ` Maciej W. Rozycki
2008-11-02 11:34 ` Richard Sandiford [this message]
2008-11-03 16:51 ` Paul_Koning
2008-11-03 16:51 ` Paul_Koning
2008-11-03 16:59 ` Maciej W. Rozycki
2008-11-03 17:35 ` Ralf Baechle
2008-11-01 20:33 ` Maciej W. Rozycki
2008-11-01 23:45 ` Ralf Baechle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ljw2gy42.fsf@firetop.home \
--to=rdsandiford@googlemail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=kumba@gentoo.org \
--cc=linux-mips@linux-mips.org \
--cc=macro@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.