diff mbox

Simplify gcc.target/mips/fuse-caller-save*.c

Message ID 53BDAEC0.4060908@mentor.com
State New
Headers show

Commit Message

Tom de Vries July 9, 2014, 9:06 p.m. UTC
On 09-07-14 20:32, Richard Sandiford wrote:
> Tom de Vries <Tom_deVries@mentor.com> writes:
>> Richard,
>>
>> during testing the gcc.target/mips/fuse-caller-save*.c test-cases with more
>> combinations of -march, -mabi, -fpic etc, I found that the checks for amount of
>> stores are rather fragile, so I removed them in this patch.
>
> Which combinations specifically?  I don't see offhand why -march would
> make a difference,

--target_board=unix/-march=mips32:
...
FAIL: gcc.target/mips/fuse-caller-save-mips16.c   -O2   scan-assembler-times 
(?n)s[wd]\t\\$.*,.*\\(\\$sp\\) 2
FAIL: gcc.target/mips/fuse-caller-save-mips16.c   -O3 -fomit-frame-pointer 
scan-assembler-times (?n)s[wd]\t\\$.*,.*\\(\\$sp\\) 2
FAIL: gcc.target/mips/fuse-caller-save-mips16.c   -O3 -g   scan-assembler-times 
(?n)s[wd]\t\\$.*,.*\\(\\$sp\\) 2
FAIL: gcc.target/mips/fuse-caller-save-mips16.c   -Os   scan-assembler-times 
(?n)s[wd]\t\\$.*,.*\\(\\$sp\\) 2
FAIL: gcc.target/mips/fuse-caller-save-mips16.c   -O2 -flto -flto-partition=none 
   scan-assembler-times (?n)s[wd]\t\\$.*,.*\\(\\$sp\\) 2
FAIL: gcc.target/mips/fuse-caller-save-mips16.c   -O2 -flto 
scan-assembler-times (?n)s[wd]\t\\$.*,.*\\(\\$sp\\) 2
...

We're using save instead of sw.

> or why -mabi would make a difference

--target_board=unix/-mabi=64:
...
FAIL: gcc.target/mips/fuse-caller-save-micromips.c   -O2   scan-assembler-times 
(?n)s[wd]\t\\$.*,.*\\(\\$sp\\) 2
FAIL: gcc.target/mips/fuse-caller-save-micromips.c   -O3 -fomit-frame-pointer 
scan-assembler-times (?n)s[wd]\t\\$.*,.*\\(\\$sp\\) 2
FAIL: gcc.target/mips/fuse-caller-save-micromips.c   -O3 -g 
scan-assembler-times (?n)s[wd]\t\\$.*,.*\\(\\$sp\\) 2
FAIL: gcc.target/mips/fuse-caller-save-micromips.c   -Os   scan-assembler-times 
(?n)s[wd]\t\\$.*,.*\\(\\$sp\\) 2
FAIL: gcc.target/mips/fuse-caller-save-micromips.c   -O2 -flto 
-flto-partition=none   scan-assembler-times (?n)s[wd]\t\\$.*,.*\\(\\$sp\\) 2
FAIL: gcc.target/mips/fuse-caller-save-micromips.c   -O2 -flto 
scan-assembler-times (?n)s[wd]\t\\$.*,.*\\(\\$sp\\) 2
FAIL: gcc.target/mips/fuse-caller-save.c   -O2   scan-assembler-times 
(?n)s[wd]\t\\$.*,.*\\(\\$sp\\) 2
FAIL: gcc.target/mips/fuse-caller-save.c   -O3 -fomit-frame-pointer 
scan-assembler-times (?n)s[wd]\t\\$.*,.*\\(\\$sp\\) 2
FAIL: gcc.target/mips/fuse-caller-save.c   -O3 -g   scan-assembler-times 
(?n)s[wd]\t\\$.*,.*\\(\\$sp\\) 2
FAIL: gcc.target/mips/fuse-caller-save.c   -Os   scan-assembler-times 
(?n)s[wd]\t\\$.*,.*\\(\\$sp\\) 2
FAIL: gcc.target/mips/fuse-caller-save.c   -O2 -flto -flto-partition=none 
scan-assembler-times (?n)s[wd]\t\\$.*,.*\\(\\$sp\\) 2
FAIL: gcc.target/mips/fuse-caller-save.c   -O2 -flto   scan-assembler-times 
(?n)s[wd]\t\\$.*,.*\\(\\$sp\\) 2
...

 > for -mno-abicalls.

With --target_board=unix/-mabi=64/-mno-abicalls, indeed those tests pass.

> -mabicalls might change the output because of things like the $gp save slot,
> but if that's the only reason it might be better to add addressing=absolute
> to the tests instead.

OK, attached patch implements that, that fixes the -mabi=64 problem.

What do we do about the 'save' instead of 'sw' ?

Thanks,
- Tom

>
> Thanks,
> Richard
>

Comments

Tom de Vries July 10, 2014, 1:22 p.m. UTC | #1
On 09-07-14 23:06, Tom de Vries wrote:
> On 09-07-14 20:32, Richard Sandiford wrote:
>> Tom de Vries <Tom_deVries@mentor.com> writes:
>>> Richard,
>>>
>>> during testing the gcc.target/mips/fuse-caller-save*.c test-cases with more
>>> combinations of -march, -mabi, -fpic etc, I found that the checks for amount of
>>> stores are rather fragile, so I removed them in this patch.
>>
>> Which combinations specifically?  I don't see offhand why -march would
>> make a difference,
>
> --target_board=unix/-march=mips32:
> ...
> FAIL: gcc.target/mips/fuse-caller-save-mips16.c   -O2   scan-assembler-times
> (?n)s[wd]\t\\$.*,.*\\(\\$sp\\) 2
> FAIL: gcc.target/mips/fuse-caller-save-mips16.c   -O3 -fomit-frame-pointer
> scan-assembler-times (?n)s[wd]\t\\$.*,.*\\(\\$sp\\) 2
> FAIL: gcc.target/mips/fuse-caller-save-mips16.c   -O3 -g   scan-assembler-times
> (?n)s[wd]\t\\$.*,.*\\(\\$sp\\) 2
> FAIL: gcc.target/mips/fuse-caller-save-mips16.c   -Os   scan-assembler-times
> (?n)s[wd]\t\\$.*,.*\\(\\$sp\\) 2
> FAIL: gcc.target/mips/fuse-caller-save-mips16.c   -O2 -flto -flto-partition=none
>    scan-assembler-times (?n)s[wd]\t\\$.*,.*\\(\\$sp\\) 2
> FAIL: gcc.target/mips/fuse-caller-save-mips16.c   -O2 -flto scan-assembler-times
> (?n)s[wd]\t\\$.*,.*\\(\\$sp\\) 2
> ...
>
> We're using save instead of sw.
>
<SNIP>
>
> What do we do about the 'save' instead of 'sw' ?
>

The mips16e save/restore enabling is controlled by this code in mips.h:
...
/* Generate mips16e code. Default 16bit ASE for mips32* and mips64* */
#define GENERATE_MIPS16E        (TARGET_MIPS16 && mips_isa >= 32)
/* Generate mips16e register save/restore sequences.  */
#define GENERATE_MIPS16E_SAVE_RESTORE (GENERATE_MIPS16E && mips_abi == ABI_32)
...

Adding isa_rev=0 in dg-options works. Is that the way to fix it?

Thanks,
- Tom
Richard Sandiford July 10, 2014, 1:37 p.m. UTC | #2
Tom de Vries <Tom_deVries@mentor.com> writes:
> The mips16e save/restore enabling is controlled by this code in mips.h:
> ...
> /* Generate mips16e code. Default 16bit ASE for mips32* and mips64* */
> #define GENERATE_MIPS16E        (TARGET_MIPS16 && mips_isa >= 32)
> /* Generate mips16e register save/restore sequences.  */
> #define GENERATE_MIPS16E_SAVE_RESTORE (GENERATE_MIPS16E && mips_abi == ABI_32)
> ...
>
> Adding isa_rev=0 in dg-options works. Is that the way to fix it?

Yeah, that sounds right.  The addressing=absolute patch is OK with that
change, thanks.

Richard
diff mbox

Patch

2014-07-09  Tom de Vries  <tom@codesourcery.com>

	* gcc.target/mips/fuse-caller-save.c: Add addression=absolute to
	dg-options.
	* gcc.target/mips/fuse-caller-save-mips16.c: Same.
	* gcc.target/mips/fuse-caller-save-micromips.c: Same.

diff --git a/gcc/testsuite/gcc.target/mips/fuse-caller-save-micromips.c b/gcc/testsuite/gcc.target/mips/fuse-caller-save-micromips.c
index 6ad01c7..70349dc 100644
--- a/gcc/testsuite/gcc.target/mips/fuse-caller-save-micromips.c
+++ b/gcc/testsuite/gcc.target/mips/fuse-caller-save-micromips.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-fuse-caller-save (-mmicromips)" } */
+/* { dg-options "-fuse-caller-save (-mmicromips) addressing=absolute" } */
 /* At -O0 and -O1, the register allocator behaves more conservatively, and
    the fuse-caller-save optimization doesnt' trigger.  */
 /* { dg-skip-if "" { *-*-* }  { "-O0" "-O1" } } */
diff --git a/gcc/testsuite/gcc.target/mips/fuse-caller-save-mips16.c b/gcc/testsuite/gcc.target/mips/fuse-caller-save-mips16.c
index a7c6cf4..330d325 100644
--- a/gcc/testsuite/gcc.target/mips/fuse-caller-save-mips16.c
+++ b/gcc/testsuite/gcc.target/mips/fuse-caller-save-mips16.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-fuse-caller-save (-mips16)" } */
+/* { dg-options "-fuse-caller-save (-mips16) addressing=absolute" } */
 /* At -O0 and -O1, the register allocator behaves more conservatively, and
    the fuse-caller-save optimization doesnt' trigger.  */
 /* { dg-skip-if "" { *-*-* }  { "-O0" "-O1" } } */
diff --git a/gcc/testsuite/gcc.target/mips/fuse-caller-save.c b/gcc/testsuite/gcc.target/mips/fuse-caller-save.c
index 72c08fe..370b1ee 100644
--- a/gcc/testsuite/gcc.target/mips/fuse-caller-save.c
+++ b/gcc/testsuite/gcc.target/mips/fuse-caller-save.c
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-fuse-caller-save" } */
+/* { dg-options "-fuse-caller-save addressing=absolute" } */
 /* At -O0 and -O1, the register allocator behaves more conservatively, and
    the fuse-caller-save optimization doesnt' trigger.  */
 /* { dg-skip-if "" { *-*-* }  { "-O0" "-O1" } } */
-- 
1.9.1