Steve Ellcey <sell...@mips.com> writes: > Richard, > > Something in these constraint patches broke my mips16 build (I cannot > build glibc in mips16 mode). I have cut down a test case and verified > that the problem started with this checkin: > > 2014-06-11 Richard Sandiford <rdsandif...@googlemail.com> > > * common.md: New file. > * doc/md.texi: Update description of generic, machine-independent > constraints. > * config/s390/constraints.md (e): Delete. > * Makefile.in (md_file): Include common.md. > * config/m32c/t-m32c (md_file): Likewise. > * genpreds.c (general_mem): New array. > (etc) > > Attached is a small test case (its ugly but it comes from vfscanf in glibc) > that > fails to compile for me with these options: > > -mips32r2 -mips16 -mabi=32 -std=gnu99 -fgnu89-inline -O2 -c x.c > > Error message: > > /tmp/ccAltddb.s: Assembler messages: > /tmp/ccAltddb.s:23: Error: invalid operands `sb $3,24($sp)'
The problem here is that mips_regno_mode_ok_for_base_p allows invalid hard registers as bases if !strict_p. It was always a bit of a hack and the reason it was added no longer applies. Robert's LRA patch already included a fix, so maybe we should just apply that part now. The patch below fixes the testcase. Please could you give it a spin and see whether there's any other fallout? I assume this would have shown up in a testsuite run if you'd been able to get that far. Thanks, Richard 2014-03-26 Robert Suchanek <robert.sucha...@imgtec.com> * config/mips/mips.c (mips_regno_mode_ok_for_base_p): Remove use !strict_p for MIPS16. diff --git gcc/config/mips/mips.c gcc/config/mips/mips.c index 45256e9..81b6c26 100644 --- gcc/config/mips/mips.c +++ gcc/config/mips/mips.c @@ -2241,22 +2241,9 @@ mips_regno_mode_ok_for_base_p (int regno, enum machine_mode mode, return true; /* In MIPS16 mode, the stack pointer can only address word and doubleword - values, nothing smaller. There are two problems here: - - (a) Instantiating virtual registers can introduce new uses of the - stack pointer. If these virtual registers are valid addresses, - the stack pointer should be too. - - (b) Most uses of the stack pointer are not made explicit until - FRAME_POINTER_REGNUM and ARG_POINTER_REGNUM have been eliminated. - We don't know until that stage whether we'll be eliminating to the - stack pointer (which needs the restriction) or the hard frame - pointer (which doesn't). - - All in all, it seems more consistent to only enforce this restriction - during and after reload. */ + values, nothing smaller. */ if (TARGET_MIPS16 && regno == STACK_POINTER_REGNUM) - return !strict_p || GET_MODE_SIZE (mode) == 4 || GET_MODE_SIZE (mode) == 8; + return GET_MODE_SIZE (mode) == 4 || GET_MODE_SIZE (mode) == 8; return TARGET_MIPS16 ? M16_REG_P (regno) : GP_REG_P (regno); } l