From: Tom de Vries <Tom_deVries@mentor.com>
To: Tom de Vries <tom@codesourcery.com>,
gcc-patches <gcc-patches@gcc.gnu.org>,
<rdsandiford@googlemail.com>
Subject: Re: [PATCH][10/10] -fuse-caller-save - Add test-case
Date: Fri, 06 Dec 2013 00:34:00 -0000 [thread overview]
Message-ID: <52A11B94.8000000@mentor.com> (raw)
In-Reply-To: <87r4hwgun0.fsf@talisman.default>
[-- Attachment #1: Type: text/plain, Size: 2458 bytes --]
On 27-04-13 12:01, Richard Sandiford wrote:
> Tom de Vries <tom@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 stage1?
Thanks,
- Tom
> Thanks,
> Richard
>
[-- Attachment #2: fuse-caller-save-test.patch --]
[-- Type: text/x-patch, Size: 2182 bytes --]
2013-12-04 Radovan Obradovic <robradovic@mips.com>
Tom de Vries <tom@codesourcery.com>
* gcc.target/mips/mips.exp: Add use-caller-save to -ffoo/-fno-foo
options.
* gcc.dg/fuse-caller-save.c: New test.
* gcc.target/mips/fuse-caller-save.c: Same.
diff --git a/gcc/testsuite/gcc.dg/fuse-caller-save.c b/gcc/testsuite/gcc.dg/fuse-caller-save.c
new file mode 100644
index 0000000..561a66d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/fuse-caller-save.c
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+/* { dg-options "-fuse-caller-save" } */
+/* 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);
+}
diff --git a/gcc/testsuite/gcc.target/mips/fuse-caller-save.c b/gcc/testsuite/gcc.target/mips/fuse-caller-save.c
new file mode 100644
index 0000000..212ca45
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/fuse-caller-save.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-fuse-caller-save" } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-Os" } } */
+/* Testing -fuse-caller-save optimization option. */
+
+static int __attribute__((noinline)) NOCOMPRESSION
+bar (int x)
+{
+ return x + 3;
+}
+
+int __attribute__((noinline)) NOCOMPRESSION
+foo (int y)
+{
+ return y + bar (y);
+}
+
+int NOCOMPRESSION
+main (void)
+{
+ return !(foo (5) == 13);
+}
+
+/* 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/mips.exp b/gcc/testsuite/gcc.target/mips/mips.exp
index 1f0d0d6..5bfadec 100644
--- a/gcc/testsuite/gcc.target/mips/mips.exp
+++ b/gcc/testsuite/gcc.target/mips/mips.exp
@@ -305,6 +305,7 @@ foreach option {
tree-vectorize
unroll-all-loops
unroll-loops
+ use-caller-save
} {
lappend mips_option_groups $option "-f(no-|)$option"
}
next prev parent reply other threads:[~2013-12-06 0:34 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-25 13:05 [PATCH][IRA] Analysis of register usage of functions for usage by IRA Tom de Vries
2013-01-25 15:46 ` Vladimir Makarov
2013-02-07 19:12 ` Tom de Vries
2013-02-13 22:35 ` Vladimir Makarov
2013-03-14 9:35 ` Tom de Vries
2013-03-14 15:22 ` Vladimir Makarov
2013-03-29 12:54 ` Tom de Vries
2013-03-29 13:06 ` [PATCH][02/10] -fuse-caller-save - Add new reg-note REG_CALL_DECL Tom de Vries
2013-03-29 13:06 ` [PATCH][06/10] -fuse-caller-save - Collect register usage information Tom de Vries
2013-03-29 13:06 ` [PATCH][09/10] -fuse-caller-save - Add documentation Tom de Vries
2013-03-29 13:06 ` [PATCH][10/10] -fuse-caller-save - Add test-case Tom de Vries
2013-03-29 13:06 ` [PATCH][03/10] -fuse-caller-save - Add implicit parameter to find_all_hard_reg_sets Tom de Vries
2013-03-29 13:06 ` [PATCH][08/10] -fuse-caller-save - Enable by default at O2 and higher Tom de Vries
2013-03-29 13:06 ` [PATCH][07/10] -fuse-caller-save - Use collected register usage information Tom de Vries
2013-03-29 13:06 ` [PATCH][05/10] -fuse-caller-save - Implement TARGET_FN_OTHER_HARD_REG_USAGE hook for ARM Tom de Vries
2013-03-29 13:06 ` [PATCH][04/10] -fuse-caller-save - Add TARGET_FN_OTHER_HARD_REG_USAGE hook Tom de Vries
2013-03-29 13:06 ` [PATCH][01/10] -fuse-caller-save - Add command line option Tom de Vries
2013-03-30 16:10 ` [PATCH][IRA] Analysis of register usage of functions for usage by IRA Tom de Vries
2014-01-09 14:42 ` Richard Earnshaw
2014-01-09 20:56 ` Tom de Vries
2014-01-09 21:10 ` Andi Kleen
2014-01-10 0:22 ` Tom de Vries
2014-01-10 11:39 ` Richard Earnshaw
2014-01-10 16:44 ` Tom de Vries
2014-01-13 16:16 ` Tom de Vries
2014-01-14 10:00 ` Richard Earnshaw
2013-03-30 17:11 ` [PATCH][06/10] -fuse-caller-save - Collect register usage information Tom de Vries
2013-03-30 17:11 ` [PATCH][02/10] -fuse-caller-save - Add new reg-note REG_CALL_DECL Tom de Vries
2013-03-30 17:11 ` [PATCH][05/10] -fuse-caller-save - Implement TARGET_FN_OTHER_HARD_REG_USAGE hook for ARM Tom de Vries
2013-12-06 0:54 ` Tom de Vries
2013-12-09 10:03 ` Richard Earnshaw
2013-03-30 17:11 ` [PATCH][01/10] -fuse-caller-save - Add command line option Tom de Vries
2013-03-30 17:11 ` [PATCH][03/10] -fuse-caller-save - Add implicit parameter to find_all_hard_reg_sets Tom de Vries
2013-03-30 17:11 ` [PATCH][04/10] -fuse-caller-save - Add TARGET_FN_OTHER_HARD_REG_USAGE hook Tom de Vries
2013-12-07 15:07 ` [PATCH] -fuse-caller-save - Implement TARGET_FN_OTHER_HARD_REG_USAGE hook for MIPS Tom de Vries
2013-12-25 13:02 ` Tom de Vries
2014-01-09 13:51 ` [PING^2][PATCH] " Tom de Vries
2014-01-09 15:31 ` Richard Sandiford
2014-01-09 23:43 ` Tom de Vries
2014-01-10 8:47 ` Richard Sandiford
2014-01-13 15:04 ` Tom de Vries
2013-03-30 17:12 ` [PATCH][07/10] -fuse-caller-save - Use collected register usage information Tom de Vries
2013-12-06 0:56 ` Tom de Vries
2013-12-06 9:11 ` Paolo Bonzini
2013-03-30 17:12 ` [PATCH][10/10] -fuse-caller-save - Add test-case Tom de Vries
2013-04-28 10:57 ` Richard Sandiford
2013-12-06 0:34 ` Tom de Vries [this message]
2013-12-06 8:51 ` Richard Sandiford
2013-03-30 17:12 ` [PATCH][08/10] -fuse-caller-save - Enable by default at O2 and higher Tom de Vries
2013-03-30 17:12 ` [PATCH][09/10] -fuse-caller-save - Add documentation Tom de Vries
2013-12-06 0:47 ` [PATCH][IRA] Analysis of register usage of functions for usage by IRA Tom de Vries
2014-01-14 19:36 ` Vladimir Makarov
2014-05-30 9:20 ` Tom de Vries
2014-09-01 16:41 ` Ulrich Weigand
2014-09-03 16:58 ` Tom de Vries
2014-09-03 18:12 ` Ulrich Weigand
2014-09-03 22:24 ` Tom de Vries
2014-09-04 7:37 ` Tom de Vries
2014-09-04 14:55 ` Vladimir Makarov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52A11B94.8000000@mentor.com \
--to=tom_devries@mentor.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=rdsandiford@googlemail.com \
--cc=tom@codesourcery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).