Hi all, I've been auditing the patterns in the arm backend that were added/modified for -mrestrict-it and I've come up with a few runtime tests that end up generating those patterns. This patch contains 4 tests for 4 patterns that have paths specific to -mrestrict-it.
There were some patterns like thumb2_mov_negscc_strict_it and thumb2_mov_notscc_strict_it that I could not generate at all, because the earlier RTL optimisers always generated some equivalent but different (and at least as good) so these splitters never matched. I think we could safely remove them, but not at this stage. These tests should give us a bit more test coverage into the -mrestrict-it functionality. Ok for trunk? Thanks, Kyrill 2016-02-05 Kyrylo Tkachov <kyrylo.tkac...@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.
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 0000000000000000000000000000000000000000..8411643e95782876b71b3beccc699a2e85022e5c --- /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 0000000000000000000000000000000000000000..ad0d15b0ebdb09988fa7ca11abb1e096edf3bcf1 --- /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 0000000000000000000000000000000000000000..f1f9cfa351bb8c2732c3dced30d8bc17f0aa573d --- /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 0000000000000000000000000000000000000000..b24c6ece7271dc4cfbb718155841282ff8f63bf7 --- /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 (); +}