Tom de Vries <tom_devr...@mentor.com> writes:
> On 27-04-13 12:01, Richard Sandiford wrote:
>> Tom de Vries <t...@codesourcery.com> writes:
>>> +/* { dg-do run } */
>>> +/* { dg-options "-fuse-caller-save -save-temps" } */
>>> +/* { dg-skip-if "" { *-*-* }  { "*" } { "-Os" } } */
>>> +/* Testing -fuse-caller-save optimization option.  */
>>> +
>>> +static int __attribute__((noinline))
>>> +bar (int x)
>>> +{
>>> +  return x + 3;
>>> +}
>>> +
>>> +int __attribute__((noinline))
>>> +foo (int y)
>>> +{
>>> +  return y + bar (y);
>>> +}
>>> +
>>> +int
>>> +main (void)
>>> +{
>>> +  return !(foo (5) == 13);
>>> +}
>>> +
>>> +/* Check that there are only 2 stack-saves: r31 in main and foo.  */
>>> +
>>> +/* Variant not mips16.  Check that there only 2 sw/sd.  */
>>> +/* { dg-final { scan-assembler-times
>>> "(?n)s\[wd\]\t\\\$.*,.*\\(\\\$sp\\)" 2 { target { ! mips16 } } } } */
>>> +
>>> +/* Variant not mips16, Subvariant micromips.  Additionally check there's no
>>> +   swm.  */
>>> +/* { dg-final { scan-assembler-times
>>> "(?n)swm\t\\\$.*,.*\\(\\\$sp\\)" 0 {target micromips } } } */
>>> +
>>> +/* Variant mips16.  The save can save 1 or more registers, check
>>> that only 1 is
>>> +   saved, twice in total.  */
>>> +/* { dg-final { scan-assembler-times
>>> "(?n)save\t\[0-9\]*,\\\$\[^,\]*\$" 2 { target mips16 } } } */
>>> +
>>> +/* Check that the first caller-save register is unused.  */
>>> +/* { dg-final { scan-assembler-not "(\\\$16)" } } */
>>
>> Sorry to ask, but I think it would be better to split this up into
>> a compile test and a run test.  The run test shouldn't be skipped at -Os.
>> It should probably also go somewhere more general than gcc.target/mips.
>>
>
> Richard,
>
> Done. There's now run test gcc.dg/fuse-caller-save.c and compile test 
> gcc.target/mips/fuse-caller-save.c.
>
>> I've tried to avoid conditional scan-assemblers in gcc.target/mips
>> whereever possible.  The directory has been set up so that you can force
>> any subtarget you like, so that (for example) -mips16 output is tested
>> by every run, not just things like mips-sim/-mips16.
>>
>> In this case I think that means using NOCOMPRESSION to force the
>> functions to use the standard ISA encoding and making the scan-assemblers
>> test only for that.
>
> Done.
>
>> Since you've already done the work :-), bonus points
>> for creating two copies, one for micromips (dg-options "-micromips ...")
>> and one for mips16 (dg-options "-mips16 ...").  That's certainly not a
>> requirement though.
>>
>
> I've left that out for now.

OK for the MIPS part, except:

> +/* Check that the first caller-save register is unused.  */
> +/* { dg-final { scan-assembler-not "(\\\$16)" } } */

the (...) regexp grouping seems redundant here.

Thanks,
Richard

Reply via email to