diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa')
6 files changed, 152 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/copy-prop-aggregate-arg-1.c b/gcc/testsuite/gcc.dg/tree-ssa/copy-prop-aggregate-arg-1.c new file mode 100644 index 0000000..2ce6891 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/copy-prop-aggregate-arg-1.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized -fdump-tree-forwprop1-details" } */ + +struct s1 +{ + int t[1024]; +}; + +void f(struct s1); + +void g(struct s1 a) +{ + struct s1 temp_struct0 = a; + f(temp_struct0); +} + +/* There should be no references to any of "temp_struct*" + temporaries. */ +/* { dg-final { scan-tree-dump-times "temp_struct" 0 "optimized" } } */ +/* Also check that forwprop pass did the copy prop. */ +/* { dg-final { scan-tree-dump-times "after previous" 1 "forwprop1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/copy-prop-aggregate-zero-1.c b/gcc/testsuite/gcc.dg/tree-ssa/copy-prop-aggregate-zero-1.c new file mode 100644 index 0000000..577a5b5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/copy-prop-aggregate-zero-1.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fno-tree-sra -fdump-tree-optimized -fdump-tree-forwprop1-details" } */ + +extern void link_error (void); + +/* Check for copyprop on structs with zeroing. */ +#define vector16 __attribute__((vector_size(64))) + +struct g +{ + vector16 unsigned char t; +}; + +struct g f(void) +{ + struct g temp_struct1 ; + temp_struct1.t = (vector16 unsigned char){}; + struct g temp_struct2 = temp_struct1; + struct g temp_struct3 = temp_struct2; + struct g temp_struct4 = temp_struct3; + return temp_struct4; +} + +/* There should be no references to any of "temp_struct*" + temporaries. */ +/* { dg-final { scan-tree-dump-times "temp_struct" 0 "optimized" } } */ +/* Also check that forwprop pass did the copy prop. */ +/* { dg-final { scan-tree-dump-times "after previous" 4 "forwprop1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/copy-prop-aggregate-zero-2.c b/gcc/testsuite/gcc.dg/tree-ssa/copy-prop-aggregate-zero-2.c new file mode 100644 index 0000000..ce3c612 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/copy-prop-aggregate-zero-2.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fno-tree-sra -fdump-tree-optimized -fdump-tree-forwprop1-details" } */ + +extern void link_error (void); + +struct g +{ + unsigned int t; +}; + +struct g f(void) +{ + struct g temp_struct1 ; + temp_struct1.t = 0; + struct g temp_struct2 = temp_struct1; + struct g temp_struct3 = temp_struct2; + struct g temp_struct4 = temp_struct3; + return temp_struct4; +} + +/* There should be no references to any of "temp_struct*" + temporaries. */ +/* { dg-final { scan-tree-dump-times "temp_struct" 0 "optimized" } } */ +/* Also check that forwprop pass did the copy prop. */ +/* { dg-final { scan-tree-dump-times "after previous" 4 "forwprop1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/copy-prop-aggregate-zero-3.c b/gcc/testsuite/gcc.dg/tree-ssa/copy-prop-aggregate-zero-3.c new file mode 100644 index 0000000..94ce965 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/copy-prop-aggregate-zero-3.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fno-tree-sra -fdump-tree-optimized -fdump-tree-forwprop1-details" } */ + +extern void link_error (void); + +struct g +{ + _Complex unsigned int t; +}; + +struct g f(void) +{ + struct g temp_struct1 ; + temp_struct1.t = 0; + struct g temp_struct2 = temp_struct1; + struct g temp_struct3 = temp_struct2; + struct g temp_struct4 = temp_struct3; + return temp_struct4; +} + +/* There should be no references to any of "temp_struct*" + temporaries. */ +/* { dg-final { scan-tree-dump-times "temp_struct" 0 "optimized" } } */ +/* Also check that forwprop pass did the copy prop. */ +/* { dg-final { scan-tree-dump-times "after previous" 4 "forwprop1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-108.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-108.c new file mode 100644 index 0000000..a13e972 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-108.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-options "-O -Wno-psabi -fdump-tree-fre1" } */ + +#define vector16 __attribute__((vector_size(16))) +#define vector32 __attribute__((vector_size(32))) + +union u1 +{ + struct s1 + { + vector16 int hi; + vector16 int low; + }hilow; + vector32 int v; +}; + +vector16 float f(vector16 int a, vector16 int b) +{ + union u1 c; + c.hilow.hi = a; + c.hilow.low = b; + vector32 int d0 = c.v; + vector32 float d = (vector32 float)d0; + vector16 float e = __builtin_shufflevector (d, d, 0, 1, 2, 3); + vector16 float f = __builtin_shufflevector (d, d, 4, 5, 6, 7); + return e/f; +} + +/* { dg-final { scan-tree-dump-times "_\[0-9\]\+ = VIEW_CONVERT_EXPR" 2 "fre1" } } */ +/* { dg-final { scan-tree-dump-not "BIT_FIELD_REF" "fre1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-109.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-109.c new file mode 100644 index 0000000..f04e033c --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-109.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fno-tree-sra -fdump-tree-fre1" } */ + +struct s1 +{ + int t; +}; + +struct s2 +{ + struct s1 t; +}; + +int f1(int a) +{ + struct s1 t = (struct s1){a}; + struct s2 tt = (struct s2){t}; + struct s2 ttt = tt; + struct s1 *t0 = &ttt.t; + return t0->t; +} + +/* { dg-final { scan-tree-dump "return a" "fre1" } } */ |