diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa')
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/slsr-32.c | 32 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/slsr-33.c | 31 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/slsr-34.c | 43 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/slsr-35.c | 28 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/slsr-36.c | 29 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/slsr-37.c | 33 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/slsr-38.c | 32 |
7 files changed, 228 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/slsr-32.c b/gcc/testsuite/gcc.dg/tree-ssa/slsr-32.c new file mode 100644 index 0000000..73e6797 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/slsr-32.c @@ -0,0 +1,32 @@ +/* Verify straight-line strength reduction for a candidate with a basis + hidden by a phi dependence and having an unknown stride. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -fdump-tree-optimized" } */ + +int +f (int s, int c, int i) +{ + int a1, a2, a3, x1, x2, x3, x; + + a1 = i * s; + x1 = c + a1; + + i = i + 2; + a2 = i * s; + x2 = c + a2; + + if (x2 > 6) + i = i + 2; + + i = i + 2; + a3 = i * s; + x3 = c + a3; + + x = x1 + x2 + x3; + return x; +} + +/* { dg-final { scan-tree-dump-times " \\* s" 1 "optimized" } } */ +/* { dg-final { scan-tree-dump-times " \\* 2" 1 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/slsr-33.c b/gcc/testsuite/gcc.dg/tree-ssa/slsr-33.c new file mode 100644 index 0000000..5cd4276 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/slsr-33.c @@ -0,0 +1,31 @@ +/* Verify straight-line strength reduction for a candidate with a basis + hidden by a phi dependence and having a known stride. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -fdump-tree-optimized" } */ + +int +f (int c, int i) +{ + int a1, a2, a3, x1, x2, x3, x; + + a1 = i * 16; + x1 = c + a1; + + i = i + 2; + a2 = i * 16; + x2 = c + a2; + + if (x2 > 6) + i = i + 2; + + i = i + 2; + a3 = i * 16; + x3 = c + a3; + + x = x1 + x2 + x3; + return x; +} + +/* { dg-final { scan-tree-dump-times " \\* " 1 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/slsr-34.c b/gcc/testsuite/gcc.dg/tree-ssa/slsr-34.c new file mode 100644 index 0000000..3593f86 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/slsr-34.c @@ -0,0 +1,43 @@ +/* Verify straight-line strength reduction for a candidate with a basis + hidden by two phi dependences, and having a known stride. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -fdump-tree-optimized" } */ + +extern void +g (void); + +int +f (int c, int i) +{ + int a1, a2, a3, x1, x2, x3, x; + + a1 = i * 16; + x1 = c + a1; + + i = i + 2; + a2 = i * 16; + x2 = c + a2; + + if (x2 > 6) + { + if (c < 200) + i = i + 2; + else + i = i + 4; + g (); + } + else + i = i + 6; + + i = i + 2; + a3 = i * 16; + x3 = c + a3; + + x = x1 + x2 + x3; + return x; +} + +/* { dg-final { scan-tree-dump-times " \\* " 1 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "PHI" 2 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/slsr-35.c b/gcc/testsuite/gcc.dg/tree-ssa/slsr-35.c new file mode 100644 index 0000000..3f4d136 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/slsr-35.c @@ -0,0 +1,28 @@ +/* Verify straight-line strength reduction for a candidate with a basis + hidden by a phi dependences, having a known stride, and where the + phi has an argument which is a parameter. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -fdump-tree-optimized" } */ + +int +f (int c, int i) +{ + int a1, a3, x1, x3, x; + + a1 = i * 16; + x1 = c + a1; + + if (x1 > 6) + i = i + 2; + + i = i + 2; + a3 = i * 16; + x3 = c + a3; + + x = x1 + x3; + return x; +} + +/* { dg-final { scan-tree-dump-times " \\* " 1 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/slsr-36.c b/gcc/testsuite/gcc.dg/tree-ssa/slsr-36.c new file mode 100644 index 0000000..8cb09e0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/slsr-36.c @@ -0,0 +1,29 @@ +/* Verify straight-line strength reduction for a candidate with a basis + hidden by a phi dependences, having an unknown stride, and where the + phi has an argument which is a parameter. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -fdump-tree-optimized" } */ + +int +f (int s, int c, int i) +{ + int a1, a3, x1, x3, x; + + a1 = i * s; + x1 = c + a1; + + if (x1 > 6) + i = i + 2; + + i = i + 2; + a3 = i * s; + x3 = c + a3; + + x = x1 + x3; + return x; +} + +/* { dg-final { scan-tree-dump-times " \\* s" 1 "optimized" } } */ +/* { dg-final { scan-tree-dump-times " \\* 2" 1 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/slsr-37.c b/gcc/testsuite/gcc.dg/tree-ssa/slsr-37.c new file mode 100644 index 0000000..fb13b20 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/slsr-37.c @@ -0,0 +1,33 @@ +/* Verify straight-line strength reduction for a candidate with a basis + hidden by a phi dependence and having an unknown stride. Variation + using negative increments. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -fdump-tree-optimized" } */ + +int +f (int s, int c, int i) +{ + int a1, a2, a3, x1, x2, x3, x; + + a1 = i * s; + x1 = c + a1; + + i = i - 2; + a2 = i * s; + x2 = c + a2; + + if (x2 > 6) + i = i - 2; + + i = i - 2; + a3 = i * s; + x3 = c + a3; + + x = x1 + x2 + x3; + return x; +} + +/* { dg-final { scan-tree-dump-times " \\* s" 1 "optimized" } } */ +/* { dg-final { scan-tree-dump-times " \\* 2" 1 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/slsr-38.c b/gcc/testsuite/gcc.dg/tree-ssa/slsr-38.c new file mode 100644 index 0000000..1a0ab79 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/slsr-38.c @@ -0,0 +1,32 @@ +/* Verify straight-line strength reduction for a candidate with a basis + hidden by a phi dependence and having a known stride. Variation using + negative increments. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -fdump-tree-optimized" } */ + +int +f (int c, int i) +{ + int a1, a2, a3, x1, x2, x3, x; + + a1 = i * 16; + x1 = c + a1; + + i = i - 2; + a2 = i * 16; + x2 = c + a2; + + if (x2 > 6) + i = i - 2; + + i = i - 2; + a3 = i * 16; + x3 = c + a3; + + x = x1 + x2 + x3; + return x; +} + +/* { dg-final { scan-tree-dump-times " \\* " 1 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ |