On Sat, 20 Mar 2021, Jeff Law wrote: > > > 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 > compact-branches? Maciej, is that less problematical from your standpoint? > Or is this just ultimately a bad idea from start to finish?
I don't expect anything to break if we allow `-mcompact-branches=always' below R6, whether defaulted or used explicitly. Given that currently it's a hard error, it's not a scenario that anyone could rely on. I don't know offhand if bad code that does not assemble is going to be produced in that case, but I doubt it as individual instruction patterns are routinely guarded by an ISA level check. Also we have some compact branches or jumps to choose from below R6, such as with the MIPS16e ISA or the microMIPSr3 ISA, so the option does make some sense semantically if not functionally (observe the reservation saying: "a compact branch instruction will be generated if available", so even now we reserve the right to produce a delay slot form despite the option being active, although the wording does imply best efforts). Regardless I would not require the option to fully support those ISA variations as a prerequisite for YunQiang's change. I think it would be enough if we documented that it is effective for R6+ only (by modifying the current note in the manual). If a need or desire arises, then a further update can be made in the future. I think this is GCC 12 material however, we're well into a feature freeze now and it is not a bug fix. It will give people plenty of time too to run regression testing with `-mcompact-branches=always' combined with a representative set of ISA levels. Maciej