aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyrylo Tkachov <kyrylo.tkachov@arm.com>2016-02-24 14:21:52 +0000
committerKyrylo Tkachov <ktkachov@gcc.gnu.org>2016-02-24 14:21:52 +0000
commitcd7bbcebb1c7cc78337d601f427eeae4473648e9 (patch)
treebc0aa9e6c135c424d9881727a635c9733296c60f
parent86715b09177c4e58c6561fabc34241da5f129a95 (diff)
downloadgcc-cd7bbcebb1c7cc78337d601f427eeae4473648e9.zip
gcc-cd7bbcebb1c7cc78337d601f427eeae4473648e9.tar.gz
gcc-cd7bbcebb1c7cc78337d601f427eeae4473648e9.tar.bz2
[ARM] Tests for arm_restrict_it patterns in thumb2.md
* gcc.target/arm/cond_sub_restrict_it.c: New test. * gcc.target/arm/condarith_restrict_it.c: Likewise. * gcc.target/arm/movcond_restrict_it.c: Likewise. * gcc.target/arm/negscc_restrict_it.c: Likewise. From-SVN: r233667
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/gcc.target/arm/cond_sub_restrict_it.c26
-rw-r--r--gcc/testsuite/gcc.target/arm/condarith_restrict_it.c47
-rw-r--r--gcc/testsuite/gcc.target/arm/movcond_restrict_it.c27
-rw-r--r--gcc/testsuite/gcc.target/arm/negscc_restrict_it.c19
5 files changed, 126 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 5b758dc..bbc005e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2016-02-24 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ * gcc.target/arm/cond_sub_restrict_it.c: New test.
+ * gcc.target/arm/condarith_restrict_it.c: Likewise.
+ * gcc.target/arm/movcond_restrict_it.c: Likewise.
+ * gcc.target/arm/negscc_restrict_it.c: Likewise.
+
2016-02-24 Jakub Jelinek <jakub@redhat.com>
PR middle-end/69915
diff --git a/gcc/testsuite/gcc.target/arm/cond_sub_restrict_it.c b/gcc/testsuite/gcc.target/arm/cond_sub_restrict_it.c
new file mode 100644
index 0000000..8411643
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/cond_sub_restrict_it.c
@@ -0,0 +1,26 @@
+/* { dg-do run } */
+/* { dg-require-effective-target arm_thumb2_ok } */
+/* { dg-options "-mthumb -O -mrestrict-it" } */
+
+int a;
+
+__attribute__((noinline, noclone)) int
+fn1 (int c, int d)
+{
+ a -= c == d;
+ return a;
+}
+
+int
+main (void)
+{
+ a = 10;
+ if (fn1 (4, 4) != 9)
+ __builtin_abort ();
+
+ a = 5;
+ if (fn1 (3, 4) != 5)
+ __builtin_abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/arm/condarith_restrict_it.c b/gcc/testsuite/gcc.target/arm/condarith_restrict_it.c
new file mode 100644
index 0000000..ad0d15b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/condarith_restrict_it.c
@@ -0,0 +1,47 @@
+/* { dg-do run } */
+/* { dg-require-effective-target arm_thumb2_ok } */
+/* { dg-options "-mthumb -O2 -mrestrict-it" } */
+
+__attribute__ ((noinline, noclone)) void
+fn2 ()
+{
+ __builtin_printf ("4");
+}
+
+enum
+{
+ ONE = 1,
+ TWO
+} a;
+
+int b;
+
+__attribute__ ((noinline, noclone)) int
+fn1 ()
+{
+ int c = b == 0;
+ if (a <= ONE)
+ if (b == 0)
+ fn2 ();
+ if (a)
+ if (c)
+ a = 0;
+
+ return a;
+}
+
+int
+main (void)
+{
+ a = ONE;
+ b = 1;
+ if (fn1 () != ONE)
+ __builtin_abort ();
+
+ a = TWO;
+ b = 0;
+ if (fn1 () != 0)
+ __builtin_abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/arm/movcond_restrict_it.c b/gcc/testsuite/gcc.target/arm/movcond_restrict_it.c
new file mode 100644
index 0000000..f1f9cfa
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/movcond_restrict_it.c
@@ -0,0 +1,27 @@
+/* { dg-do run } */
+/* { dg-require-effective-target arm_thumb2_ok } */
+/* { dg-options "-mthumb -O3 -mrestrict-it" } */
+
+int a;
+
+__attribute__ ((noinline, noclone)) int
+fn1 (int c, int d)
+{
+ if (c > d)
+ a = 1;
+ else
+ a = -1;
+ return a;
+}
+
+int
+main (void)
+{
+ if (fn1 (4, 5) != -1)
+ __builtin_abort ();
+
+ if (fn1 (5, 4) != 1)
+ __builtin_abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/arm/negscc_restrict_it.c b/gcc/testsuite/gcc.target/arm/negscc_restrict_it.c
new file mode 100644
index 0000000..b24c6ece
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/negscc_restrict_it.c
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+/* { dg-require-effective-target arm_thumb2_ok } */
+/* { dg-options "-mthumb -O2 -mrestrict-it" } */
+
+__attribute__ ((noinline, noclone)) int
+fn1 (int a, int b)
+{
+ return (a == b ? 0 : -1);
+}
+
+int
+main (void)
+{
+ if (fn1 (3, 3) != 0)
+ __builtin_abort ();
+
+ if (fn1 (6, 7) != -1)
+ __builtin_abort ();
+}