diff options
author | Tom de Vries <tom@codesourcery.com> | 2011-06-14 15:05:26 +0000 |
---|---|---|
committer | Tom de Vries <vries@gcc.gnu.org> | 2011-06-14 15:05:26 +0000 |
commit | 5e59d472ed3a8a191d443aa8093c61d1a351c6f3 (patch) | |
tree | 59c4bafa715e8c52d4075e3e091459de947bcd72 /gcc | |
parent | 8a76c4a040d2c601206ee24bd59b176d542c7f35 (diff) | |
download | gcc-5e59d472ed3a8a191d443aa8093c61d1a351c6f3.zip gcc-5e59d472ed3a8a191d443aa8093c61d1a351c6f3.tar.gz gcc-5e59d472ed3a8a191d443aa8093c61d1a351c6f3.tar.bz2 |
re PR middle-end/45098 (Missed induction variable optimization)
2011-06-14 Tom de Vries <tom@codesourcery.com>
PR target/45098
* gcc.target/arm/ivopts-3.c: New test.
* gcc.target/arm/ivopts-4.c: New test.
* gcc.target/arm/ivopts-5.c: New test.
From-SVN: r175025
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/arm/ivopts-3.c | 26 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/arm/ivopts-4.c | 21 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/arm/ivopts-5.c | 26 |
4 files changed, 80 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4b7610d..a61de34 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2011-06-14 Tom de Vries <tom@codesourcery.com> + + PR target/45098 + * gcc.target/arm/ivopts-3.c: New test. + * gcc.target/arm/ivopts-4.c: New test. + * gcc.target/arm/ivopts-5.c: New test. + 2011-06-14 Jakub Jelinek <jakub@redhat.com> PR rtl-optimization/49390 diff --git a/gcc/testsuite/gcc.target/arm/ivopts-3.c b/gcc/testsuite/gcc.target/arm/ivopts-3.c new file mode 100644 index 0000000..daea947 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/ivopts-3.c @@ -0,0 +1,26 @@ +/* { dg-do assemble } */ +/* { dg-options "-Os -mthumb -fdump-tree-ivopts -save-temps" } */ + +extern unsigned int foo2 (short*) __attribute__((pure)); + +unsigned int +tr3 (short array[], unsigned int n) +{ + int sum = 0; + unsigned int x; + x = 0; + while (1) + { + sum += foo2 (&array[x]); + if (!(x < n)) + break; + x++; + } + return sum; +} + +/* { dg-final { scan-tree-dump-times "PHI <ivtmp" 1 "ivopts"} } */ +/* { dg-final { scan-tree-dump-times "PHI <x" 0 "ivopts"} } */ +/* { dg-final { scan-tree-dump-times ", x" 0 "ivopts"} } */ +/* { dg-final { object-size text <= 30 { target arm_thumb2_ok } } } */ +/* { dg-final { cleanup-tree-dump "ivopts" } } */ diff --git a/gcc/testsuite/gcc.target/arm/ivopts-4.c b/gcc/testsuite/gcc.target/arm/ivopts-4.c new file mode 100644 index 0000000..8ae0518 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/ivopts-4.c @@ -0,0 +1,21 @@ +/* { dg-do assemble } */ +/* { dg-options "-mthumb -Os -fdump-tree-ivopts -save-temps" } */ + +extern unsigned int foo (int*) __attribute__((pure)); + +unsigned int +tr2 (int array[], int n) +{ + unsigned int sum = 0; + int x; + if (n > 0) + for (x = 0; x < n; x++) + sum += foo (&array[x]); + return sum; +} + +/* { dg-final { scan-tree-dump-times "PHI <ivtmp" 1 "ivopts"} } */ +/* { dg-final { scan-tree-dump-times "PHI <x" 0 "ivopts"} } */ +/* { dg-final { scan-tree-dump-times ", x" 0 "ivopts"} } */ +/* { dg-final { object-size text <= 36 { target arm_thumb2_ok } } } */ +/* { dg-final { cleanup-tree-dump "ivopts" } } */ diff --git a/gcc/testsuite/gcc.target/arm/ivopts-5.c b/gcc/testsuite/gcc.target/arm/ivopts-5.c new file mode 100644 index 0000000..c8b9f4f --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/ivopts-5.c @@ -0,0 +1,26 @@ +/* { dg-do assemble } */ +/* { dg-options "-Os -mthumb -fdump-tree-ivopts -save-temps" } */ + +extern unsigned int foo (int*) __attribute__((pure)); + +unsigned int +tr1 (int array[], unsigned int n) +{ + int sum = 0; + unsigned int x; + x = 0; + while (1) + { + sum += foo (&array[x]); + if (!(x < n)) + break; + x++; + } + return sum; +} + +/* { dg-final { scan-tree-dump-times "PHI <ivtmp" 1 "ivopts"} } */ +/* { dg-final { scan-tree-dump-times "PHI <x" 0 "ivopts"} } */ +/* { dg-final { scan-tree-dump-times ", x" 0 "ivopts"} } */ +/* { dg-final { object-size text <= 30 { target arm_thumb2_ok } } } */ +/* { dg-final { cleanup-tree-dump "ivopts" } } */ |