Re: Simplify gcc.target/mips/fuse-caller-save*.c
On 09-07-14 23:06, Tom de Vries wrote: On 09-07-14 20:32, Richard Sandiford wrote: Tom de Vries tom_devr...@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
Re: Simplify gcc.target/mips/fuse-caller-save*.c
Tom de Vries tom_devr...@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
Simplify gcc.target/mips/fuse-caller-save*.c
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. The remaining checks check for absence of $16. To address the risk that $16 is absent for another reason than -fuse-caller-save, I've added 3 corresponding test-cases that check for presence of $16 with -fno-use-caller-save. The fuse-caller-save tests now pass for all combinations I've tried. OK for trunk? Thanks, - Tom 2014-07-09 Tom de Vries t...@codesourcery.com * gcc.target/mips/fuse-caller-save.c: Remove test on number of stores. * gcc.target/mips/fuse-caller-save-mips16.c: Same. * gcc.target/mips/fuse-caller-save-micromips.c: Same. * gcc.target/mips/fuse-caller-save-neg.c: New test. * gcc.target/mips/fuse-caller-save-mips16-neg.c: Same. * gcc.target/mips/fuse-caller-save-micromips-neg.c: Same. diff --git a/gcc/testsuite/gcc.target/mips/fuse-caller-save-micromips-neg.c b/gcc/testsuite/gcc.target/mips/fuse-caller-save-micromips-neg.c new file mode 100644 index 000..9d43be9 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/fuse-caller-save-micromips-neg.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options -fno-use-caller-save (-mmicromips) } */ +/* At -O0 and -O1, the register allocator behaves more conservatively, and + the fuse-caller-save optimization doesnt' trigger. */ +/* { dg-skip-if { *-*-* } { -O0 -O1 } } */ +/* Testing -fuse-caller-save optimization option. */ + +#define ATTRIBUTE MICROMIPS +#include fuse-caller-save.h + +/* Check that the first caller-save register is used. This is to make sure that + test fuse-caller-save-mips16 tests something meaningful. */ +/* { dg-final { scan-assembler \\\$16 } } */ 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..bb70890 100644 --- a/gcc/testsuite/gcc.target/mips/fuse-caller-save-micromips.c +++ b/gcc/testsuite/gcc.target/mips/fuse-caller-save-micromips.c @@ -8,10 +8,5 @@ #define ATTRIBUTE MICROMIPS #include fuse-caller-save.h -/* Check that there are only 2 stack-saves: r31 in main and foo. */ - -/* Check that there only 2 sw/sd. */ -/* { dg-final { scan-assembler-times (?n)s\[wd\]\t\\\$.*,.*\\(\\\$sp\\) 2 } } */ - /* Check that the first caller-save register is unused. */ /* { dg-final { scan-assembler-not \\\$16 } } */ diff --git a/gcc/testsuite/gcc.target/mips/fuse-caller-save-mips16-neg.c b/gcc/testsuite/gcc.target/mips/fuse-caller-save-mips16-neg.c new file mode 100644 index 000..cb6360b --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/fuse-caller-save-mips16-neg.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options -fno-use-caller-save (-mips16) } */ +/* At -O0 and -O1, the register allocator behaves more conservatively, and + the fuse-caller-save optimization doesnt' trigger. */ +/* { dg-skip-if { *-*-* } { -O0 -O1 } } */ +/* Testing -fuse-caller-save optimization option. */ + +#define ATTRIBUTE MIPS16 +#include fuse-caller-save.h + +/* Check that the first caller-save register is used. This is to make sure that + test fuse-caller-save-mips16 tests something meaningful. */ +/* { dg-final { scan-assembler \\\$16 } } */ 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..62b33a7 100644 --- a/gcc/testsuite/gcc.target/mips/fuse-caller-save-mips16.c +++ b/gcc/testsuite/gcc.target/mips/fuse-caller-save-mips16.c @@ -8,10 +8,5 @@ #define ATTRIBUTE MIPS16 #include fuse-caller-save.h -/* Check that there are only 2 stack-saves: r31 in main and foo. */ - -/* Check that there only 2 sw/sd. */ -/* { dg-final { scan-assembler-times (?n)s\[wd\]\t\\\$.*,.*\\(\\\$sp\\) 2 } } */ - /* Check that the first caller-save register is unused. */ /* { dg-final { scan-assembler-not \\\$16 } } */ diff --git a/gcc/testsuite/gcc.target/mips/fuse-caller-save-neg.c b/gcc/testsuite/gcc.target/mips/fuse-caller-save-neg.c new file mode 100644 index 000..3de0168 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/fuse-caller-save-neg.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options -fno-use-caller-save } */ +/* At -O0 and -O1, the register allocator behaves more conservatively, and + the fuse-caller-save optimization doesnt' trigger. */ +/* { dg-skip-if { *-*-* } { -O0 -O1 } } */ +/* Testing -fuse-caller-save optimization option. */ + +#define ATTRIBUTE NOCOMPRESSION +#include fuse-caller-save.h + +/* Check that the first caller-save register is used. This is to make sure that + test fuse-caller-save-mips16 tests something meaningful. */ +/* { dg-final { scan-assembler \\\$16 } } */ diff --git a/gcc/testsuite/gcc.target/mips/fuse-caller-save.c b/gcc/testsuite/gcc.target/mips/fuse-caller-save.c index 72c08fe..a0267f0 100644 ---
Re: Simplify gcc.target/mips/fuse-caller-save*.c
Tom de Vries tom_devr...@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, or why -mabi would make a difference for -mno-abicalls. -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. Thanks, Richard
Re: Simplify gcc.target/mips/fuse-caller-save*.c
On 09-07-14 20:32, Richard Sandiford wrote: Tom de Vries tom_devr...@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 2014-07-09 Tom de Vries t...@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