diff mbox

MIPS: Update stack-1.c testcase to match micromips jraddiusp instruction.

Message ID 0DA23CC379F5F945ACB41CF394B98277210EEC76@LEMAIL01.le.imgtec.org
State New
Headers show

Commit Message

Andrew Bennett July 6, 2015, 2:37 p.m. UTC
Hi,

The stack-1.c testcase fails when being compiled for micromips with the -O0
optimization level.  The reason is the testcase is expecting the following
sequence at the end of the function:

       addiu   $sp,$sp,16
       jrc     $31

But for micromips it generates the following:

       jraddiusp       16


As the failure only happens at one optimization level I have decided to just 
change the expected output rather than creating a separate micromips testcase.  

I have tested this on the mips-mti-elf target using mips32r2/{-mno-micromips/-mmicromips}
test options and there are no new regressions.

The patch and ChangeLog are below.

Ok to commit?



Many thanks,


Andrew


testsuite/
	* gcc.target/mips/stack-1.c: Allow testcase to match jraddiusp instruction.

Comments

Matthew Fortune July 6, 2015, 3 p.m. UTC | #1
Andrew Bennett <Andrew.Bennett@imgtec.com> writes:
> The stack-1.c testcase fails when being compiled for micromips with the
> -O0 optimization level.  The reason is the testcase is expecting the
> following sequence at the end of the function:
> 
>        addiu   $sp,$sp,16
>        jrc     $31
> 
> But for micromips it generates the following:
> 
>        jraddiusp       16
> 
> 
> As the failure only happens at one optimization level I have decided to
> just change the expected output rather than creating a separate
> micromips testcase.

I'm not sure this is the right approach here. If we get a jraddiusp then
the problem that the test is trying to cover can't possibly happen anyway.
(The test is checking if a load and final stack adjustment are ever
re-ordered from what I can see.)

I'd just mark the test as NOCOMPRESSION instead of just NOMIPS16 and
update the comment to say that it is avoiding SAVE, RESTORE and JRADDIUSP.

Thanks,
Matthew
Moore, Catherine July 6, 2015, 3:35 p.m. UTC | #2
> -----Original Message-----
> From: Matthew Fortune [mailto:Matthew.Fortune@imgtec.com]
> Sent: Monday, July 06, 2015 11:00 AM
> To: Andrew Bennett; gcc-patches@gcc.gnu.org
> Cc: Moore, Catherine
> Subject: RE: [PATCH] MIPS: Update stack-1.c testcase to match micromips
> jraddiusp instruction.
> 
> Andrew Bennett <Andrew.Bennett@imgtec.com> writes:
> > The stack-1.c testcase fails when being compiled for micromips with
> > the
> > -O0 optimization level.  The reason is the testcase is expecting the
> > following sequence at the end of the function:
> >
> >        addiu   $sp,$sp,16
> >        jrc     $31
> >
> > But for micromips it generates the following:
> >
> >        jraddiusp       16
> >
> >
> > As the failure only happens at one optimization level I have decided
> > to just change the expected output rather than creating a separate
> > micromips testcase.
> 
> I'm not sure this is the right approach here. If we get a jraddiusp then the
> problem that the test is trying to cover can't possibly happen anyway.
> (The test is checking if a load and final stack adjustment are ever re-ordered
> from what I can see.)
> 
> I'd just mark the test as NOCOMPRESSION instead of just NOMIPS16 and
> update the comment to say that it is avoiding SAVE, RESTORE and
> JRADDIUSP.
> 

Another approach would be to add the micromips testcase variant and skip the test if code-quality (ie. -O0).
Catherine
diff mbox

Patch

diff --git a/gcc/testsuite/gcc.target/mips/stack-1.c b/gcc/testsuite/gcc.target/mips/stack-1.c
index a28e4bf..2249a3b 100644
--- a/gcc/testsuite/gcc.target/mips/stack-1.c
+++ b/gcc/testsuite/gcc.target/mips/stack-1.c
@@ -1,4 +1,4 @@ 
-/* { dg-final { scan-assembler "\td?addiu\t(\\\$sp,)?\\\$sp,\[1-9\]" } } */
+/* { dg-final { scan-assembler "\t((d?addiu\t(\\\$sp,)?\\\$sp,)|jraddiusp\t)\[1-9\]" } } */
 /* { dg-final { scan-assembler "\tlw\t" } } */
 /* { dg-final { scan-assembler-not "\td?addiu\t(\\\$sp,)?\\\$sp,\[1-9\].*\tlw\t" } } */