回复: [PATCH v4 1/2] MIPS: Not trigger error for pre-R6 and -mcompact-branches=always

2021-03-03 Thread yunqiang.su
> 
> On 2/23/21 3:14 AM, YunQiang Su wrote:
> > For MIPSr6, we may wish to use compact-branches only.
> > Currently, we have to use `always' option, while it is mark as
> > conflict with pre-R6.
> >   cc1: error: unsupported combination: ‘mips32r2’
> > -mcompact-branches=always Just ignore -mcompact-branches=always for
> pre-R6.
> >
> > This patch also defines
> > __mips_compact_branches_never
> > __mips_compact_branches_always
> > __mips_compact_branches_optimal
> > predefined macros
> >
> > gcc/ChangeLog:
> > * config/mips/mips.c (mips_option_override):
> > * config/mips/mips.h (TARGET_RTP_PIC): not trigger error for
> > compact-branches=always for pre-R6.
> > (TARGET_CB_NEVER): Likewise.
> > (TARGET_CB_ALWAYS): Likewise.
> > (struct mips_cpu_info): define macros for compact branch policy.
> > * doc/invoke.texi: Document "always" with pre-R6.
> >
> > gcc/testsuite/ChangeLog:
> > * gcc.target/mips/compact-branches-1.c: add isa_rev>=6.
> > * gcc.target/mips/mips.exp: don't add -mipsXXr6 option for
> > -mcompact-branches=always. It is usable for pre-R6 now.
> > * gcc.target/mips/compact-branches-8.c: New test.
> > * gcc.target/mips/compact-branches-9.c: New test.
> So I think Maciej's comment was that you simply shouldn't be using
> -mcompact-branches=always at mips32r2 (or anything pre-r6) together.
> 
> I think what you're trying to do here is set up a scenario where you're
> defaulting to mips32r6 and compact-branches, but not error if something
> specifies -mcpu=mips32r2 or something similar, right?
> 

Yes. If we introduce the build time option, and configure gcc with always, then 
gcc will always try to
Pass -mconpact-branches=always to cc1, even we use something like:
mipsisa32r6el-linux-gnu-gcc -mips32r2 -c xx.c
It may break something.

> jeff




回复: 回复: [PATCH v4 1/2] MIPS: Not trigger error for pre-R6 and -mcompact-branches=always

2021-03-21 Thread yunqiang.su



> -邮件原件-
> 发件人: Jeff Law 
> 发送时间: 2021年3月20日 23:42
> 收件人: yunqiang...@cipunited.com; gcc-patches@gcc.gnu.org
> 抄送: ma...@orcam.me.uk; l...@redhat.com; d...@debian.org;
> s...@debian.org; jiaxun.y...@flygoat.com
> 主题: Re: 回复: [PATCH v4 1/2] MIPS: Not trigger error for pre-R6 and
> -mcompact-branches=always
> 
> 
> On 3/3/2021 8:33 PM, yunqiang...@cipunited.com wrote:
> >> On 2/23/21 3:14 AM, YunQiang Su wrote:
> >>> For MIPSr6, we may wish to use compact-branches only.
> >>> Currently, we have to use `always' option, while it is mark as
> >>> conflict with pre-R6.
> >>>cc1: error: unsupported combination: ‘mips32r2’
> >>> -mcompact-branches=always Just ignore -mcompact-branches=always
> for
> >> pre-R6.
> >>> This patch also defines
> >>>  __mips_compact_branches_never
> >>>  __mips_compact_branches_always
> >>>  __mips_compact_branches_optimal predefined macros
> >>>
> >>> gcc/ChangeLog:
> >>>   * config/mips/mips.c (mips_option_override):
> >>>   * config/mips/mips.h (TARGET_RTP_PIC): not trigger error for
> >>>   compact-branches=always for pre-R6.
> >>>   (TARGET_CB_NEVER): Likewise.
> >>>   (TARGET_CB_ALWAYS): Likewise.
> >>>   (struct mips_cpu_info): define macros for compact branch policy.
> >>>   * doc/invoke.texi: Document "always" with pre-R6.
> >>>
> >>> gcc/testsuite/ChangeLog:
> >>>   * gcc.target/mips/compact-branches-1.c: add isa_rev>=6.
> >>>   * gcc.target/mips/mips.exp: don't add -mipsXXr6 option for
> >>>   -mcompact-branches=always. It is usable for pre-R6 now.
> >>>   * gcc.target/mips/compact-branches-8.c: New test.
> >>>   * gcc.target/mips/compact-branches-9.c: New test.
> >> So I think Maciej's comment was that you simply shouldn't be using
> >> -mcompact-branches=always at mips32r2 (or anything pre-r6) together.
> >>
> >> I think what you're trying to do here is set up a scenario where
> >> you're defaulting to mips32r6 and compact-branches, but not error if
> >> something specifies -mcpu=mips32r2 or something similar, right?
> >>
> > Yes. If we introduce the build time option, and configure gcc with
> > always, then gcc will always try to Pass -mconpact-branches=always to cc1,
> even we use something like:
> >  mipsisa32r6el-linux-gnu-gcc -mips32r2 -c xx.c It may break
> > something.
> 
> So would it be possible to make the mips32rX (for X <6) option also turn off

Yes. It is possible, while it may introduce lots of complexity to the code.

> compact-branches?   Maciej, is that less problematical from your
> standpoint?  Or is this just ultimately a bad idea from start to finish?
> 
> 
> Jeff