This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, mips] Fix compiler abort with -mips32r2 -mips16 -msynci
On Wed, 2012-07-18 at 18:30 +0100, Richard Sandiford wrote:
> The abort sounds like the bug here. It's deliberate that things like
> -msynci, -mbranch-likely, etc., are OK with -mips16. On the one hand,
> you could compile with -mips16 but have an __attribute__((nomips16))
> function that could benefit from using SYNCI. On the other, you could
> compile without -mips16 but have an __attribute__((mips16)) function
> that needs to avoid SYNCI.
>
> -mips16 really just sets the default ISA mode for functions that don't
> specify one. That's why override_options hides mips16ness so early on,
> like you say.
>
> Richard
Here is a new patch. It clears the MASK_SYNCI bit when setting the
MASK_MIPS16 bit in mips_set_mips16_mode. I did not add any warnings
because I didn't think we wanted a warning every time we compiled a
function in MIPS16 mode when using -msynci.
How does this patch look?
Steve Ellcey
sellcey@mips.com
2012-07-19 Steve Ellcey <sellcey@mips.com>
* config/mips/mips.c (mips_set_mips16_mode): Clear SYNCI_MASK in
MIPS16 mode.
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 7356ce5..00360f7 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -15652,6 +15652,9 @@ mips_set_mips16_mode (int mips16_p)
/* Switch to MIPS16 mode. */
target_flags |= MASK_MIPS16;
+ /* Turn off SYNCI if it was on, MIPS16 doesn't support it. */
+ target_flags &= ~MASK_SYNCI;
+
/* Don't run the scheduler before reload, since it tends to
increase register pressure. */
flag_schedule_insns = 0;