diff options
81 files changed, 533 insertions, 197 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0055802806f..68e7be66686 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,23 @@ +2008-08-19 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/35972 + PR tree-optimization/23094 + * tree-ssa-sccvn.h (vn_reference_lookup_pieces): Add maywalk + parameter. + * tree-ssa-sccvn.c (copy_reference_ops_from_ref): Properly + handle MISALIGNED_INDIRECT_REF. + (get_ref_from_reference_ops): New helper. + (vn_reference_lookup_pieces): Walk the use-def chain using the + alias-oracle if requested. + * tree-ssa-pre.c (phi_translate_1): Do reference lookup with + walking the use-def chain. + (compute_avail): But not here. + (create_component_ref_by_pieces_1): Properly handle + MISALIGNED_INDIRECT_REF. + (do_regular_insertion): Handle fully redundant + expressions after PHI-translation also for SSA_NAME values, not + only constants. Correctly use edoubleprime for that. + 2008-08-19 Ira Rosen <irar@il.ibm.com> * tree-vectorizer.c (supportable_widening_operation): Support diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ef27c4b069e..e51e9a6012f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,85 @@ +2008-08-19 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/35972 + PR tree-optimization/23094 + * gcc.dg/tree-ssa/ssa-pre-19.c: New testcase. + * gcc.dg/autopar/reduc-1.c: Move constant initialized arrays to + global memory. + * gcc.dg/autopar/reduc-1char.c: Likewise. + * gcc.dg/autopar/reduc-1short.c: Likewise. + * gcc.dg/autopar/reduc-2.c: Likewise. + * gcc.dg/autopar/reduc-2char.c: Likewise. + * gcc.dg/autopar/reduc-2short.c: Likewise. + * gcc.dg/autopar/reduc-3.c: Likewise. + * gcc.dg/tree-ssa/ifc-20040816-1.c: Likewise. + * gcc.dg/vect/costmodel/i386/costmodel-vect-reduc-1char.c: Likewise. + * gcc.dg/vect/costmodel/x86_64/costmodel-vect-reduc-1char.c: Likewise. + * gcc.dg/vect/fast-math-vect-reduc-5.c: Likewise. + * gcc.dg/vect/fast-math-vect-reduc-7.c: Likewise. + * gcc.dg/vect/no-trapping-math-2.c: Likewise. + * gcc.dg/vect/no-trapping-math-vect-111.c: Likewise. + * gcc.dg/vect/no-trapping-math-vect-ifcvt-11.c: Likewise. + * gcc.dg/vect/no-trapping-math-vect-ifcvt-12.c: Likewise. + * gcc.dg/vect/no-trapping-math-vect-ifcvt-13.c: Likewise. + * gcc.dg/vect/no-trapping-math-vect-ifcvt-14.c: Likewise. + * gcc.dg/vect/no-trapping-math-vect-ifcvt-15.c: Likewise. + * gcc.dg/vect/no-vfa-vect-37.c: Likewise. + * gcc.dg/vect/no-vfa-vect-depend-1.c: Likewise. + * gcc.dg/vect/pr18400.c: Likewise. + * gcc.dg/vect/slp-12b.c: Likewise. + * gcc.dg/vect/slp-14.c: Likewise. + * gcc.dg/vect/slp-7.c: Likewise. + * gcc.dg/vect/slp-15.c: Likewise. + * gcc.dg/vect/slp-16.c: Likewise. + * gcc.dg/vect/slp-17.c: Likewise. + * gcc.dg/vect/slp-24.c: Likewise. + * gcc.dg/vect/slp-28.c: Likewise. + * gcc.dg/vect/slp-3.c: Likewise. + * gcc.dg/vect/slp-34.c: Likewise. + * gcc.dg/vect/slp-6.c: Likewise. + * gcc.dg/vect/slp-8.c: Likewise. + * gcc.dg/vect/vect-107.c: Likewise. + * gcc.dg/vect/vect-108.c: Likewise. + * gcc.dg/vect/vect-11.c: Likewise. + * gcc.dg/vect/vect-112.c: Likewise. + * gcc.dg/vect/vect-115.c: Likewise. + * gcc.dg/vect/vect-11a.c: Likewise. + * gcc.dg/vect/vect-34.c: Likewise. + * gcc.dg/vect/vect-9.c: Likewise. + * gcc.dg/vect/vect-97.c: Likewise. + * gcc.dg/vect/vect-align-1.c: Likewise. + * gcc.dg/vect/vect-float-extend-1.c: Likewise. + * gcc.dg/vect/vect-floatint-conversion-1.c: Likewise. + * gcc.dg/vect/vect-ifcvt-16.c: Likewise. + * gcc.dg/vect/vect-ifcvt-17.c: Likewise. + * gcc.dg/vect/vect-ifcvt-2.c: Likewise. + * gcc.dg/vect/vect-ifcvt-3.c: Likewise. + * gcc.dg/vect/vect-ifcvt-4.c: Likewise. + * gcc.dg/vect/vect-ifcvt-5.c: Likewise. + * gcc.dg/vect/vect-ifcvt-6.c: Likewise. + * gcc.dg/vect/vect-ifcvt-7.c: Likewise. + * gcc.dg/vect/vect-intfloat-conversion-1.c: Likewise. + * gcc.dg/vect/vect-intfloat-conversion-2.c: Likewise. + * gcc.dg/vect/vect-intfloat-conversion-3.c: Likewise. + * gcc.dg/vect/vect-intfloat-conversion-4a.c: Likewise. + * gcc.dg/vect/vect-intfloat-conversion-4b.c: Likewise. + * gcc.dg/vect/vect-multitypes-2.c: Likewise. + * gcc.dg/vect/vect-multitypes-5.c: Likewise. + * gcc.dg/vect/vect-reduc-1.c: Likewise. + * gcc.dg/vect/vect-reduc-1char.c: Likewise. + * gcc.dg/vect/vect-reduc-1short.c: Likewise. + * gcc.dg/vect/vect-reduc-2.c: Likewise. + * gcc.dg/vect/vect-reduc-3.c: Likewise. + * gcc.dg/vect/vect-shift-1.c: Likewise. + * gcc.dg/vect/vect-strided-float.c: Likewise. + * gcc.dg/vect/vect-strided-store-u32-i2.c: Likewise. + * gcc.dg/vect/wrapv-vect-reduc-2char.c: Likewise. + * gcc.dg/vect/wrapv-vect-reduc-2short.c: Likewise. + * gcc.dg/tree-ssa/gen-vect-11.c: Likewise. + * gcc.dg/tree-ssa/gen-vect-11a.c: Likewise. + * gcc.dg/tree-ssa/gen-vect-2.c: Likewise. + * gcc.dg/vect/costmodel/ppc/costmodel-vect-76c.c: Likewise. + 2008-08-19 Ira Rosen <irar@il.ibm.com> * gcc.dg/vect/slp-multitypes-1.c: New testcase. diff --git a/gcc/testsuite/gcc.dg/autopar/reduc-1.c b/gcc/testsuite/gcc.dg/autopar/reduc-1.c index c7f53e1e50d..ac08d3d2e47 100644 --- a/gcc/testsuite/gcc.dg/autopar/reduc-1.c +++ b/gcc/testsuite/gcc.dg/autopar/reduc-1.c @@ -7,13 +7,14 @@ #define N 16 #define DIFF 242 +unsigned int ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +unsigned int uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + /* Reduction of unsigned-int. */ void main1 (unsigned int x, unsigned int max_result, unsigned int min_result) { int i; - unsigned int ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; - unsigned int uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; unsigned int udiff = 2; unsigned int umax = x; unsigned int umin = x; diff --git a/gcc/testsuite/gcc.dg/autopar/reduc-1char.c b/gcc/testsuite/gcc.dg/autopar/reduc-1char.c index 87f758a4e46..228e97995a7 100644 --- a/gcc/testsuite/gcc.dg/autopar/reduc-1char.c +++ b/gcc/testsuite/gcc.dg/autopar/reduc-1char.c @@ -7,12 +7,13 @@ #define N 16 #define DIFF 242 +unsigned char ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +unsigned char uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + __attribute__ ((noinline)) void main1 (unsigned char x, unsigned char max_result, unsigned char min_result) { int i; - unsigned char ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; - unsigned char uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; unsigned char udiff = 2; unsigned char umax = x; unsigned char umin = x; diff --git a/gcc/testsuite/gcc.dg/autopar/reduc-1short.c b/gcc/testsuite/gcc.dg/autopar/reduc-1short.c index 75d09544f8c..45d96fdc926 100644 --- a/gcc/testsuite/gcc.dg/autopar/reduc-1short.c +++ b/gcc/testsuite/gcc.dg/autopar/reduc-1short.c @@ -7,13 +7,14 @@ #define N 16 #define DIFF 242 +unsigned short ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +unsigned short uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + __attribute__ ((noinline)) void main1 (unsigned short x, unsigned short max_result, unsigned short min_result) { int i; - unsigned short ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; - unsigned short uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; - unsigned short udiff = 2; + unsigned short udiff = 2; unsigned short umax = x; unsigned short umin = x; diff --git a/gcc/testsuite/gcc.dg/autopar/reduc-2.c b/gcc/testsuite/gcc.dg/autopar/reduc-2.c index d462f894f2e..684094d6319 100644 --- a/gcc/testsuite/gcc.dg/autopar/reduc-2.c +++ b/gcc/testsuite/gcc.dg/autopar/reduc-2.c @@ -7,14 +7,15 @@ #define N 16 #define DIFF 240 +int b[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +int c[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + /* Reduction of signed-int. */ __attribute__ ((noinline)) void main1 (int x, int max_result, int min_result) { int i; - int b[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; - int c[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; int diff = 0; int max = x; int min = x; diff --git a/gcc/testsuite/gcc.dg/autopar/reduc-2char.c b/gcc/testsuite/gcc.dg/autopar/reduc-2char.c index 15acb3bcc9a..78e5b13aca2 100644 --- a/gcc/testsuite/gcc.dg/autopar/reduc-2char.c +++ b/gcc/testsuite/gcc.dg/autopar/reduc-2char.c @@ -7,12 +7,13 @@ #define N 16 #define DIFF 121 +signed char b[N] = {1,2,3,6,8,10,12,14,16,18,20,22,24,26,28,30}; +signed char c[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + __attribute__ ((noinline)) void main1 (signed char x, signed char max_result, signed char min_result) { int i; - signed char b[N] = {1,2,3,6,8,10,12,14,16,18,20,22,24,26,28,30}; - signed char c[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; signed char diff = 2; signed char max = x; signed char min = x; diff --git a/gcc/testsuite/gcc.dg/autopar/reduc-2short.c b/gcc/testsuite/gcc.dg/autopar/reduc-2short.c index f98402ee251..cef179b7f53 100644 --- a/gcc/testsuite/gcc.dg/autopar/reduc-2short.c +++ b/gcc/testsuite/gcc.dg/autopar/reduc-2short.c @@ -7,12 +7,13 @@ #define N 16 #define DIFF 242 +short b[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +short c[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + __attribute__ ((noinline)) void main1 (short x, short max_result, short min_result) { int i; - short b[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; - short c[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; short diff = 2; short max = x; short min = x; diff --git a/gcc/testsuite/gcc.dg/autopar/reduc-3.c b/gcc/testsuite/gcc.dg/autopar/reduc-3.c index 31ed2bc11c2..97501c61584 100644 --- a/gcc/testsuite/gcc.dg/autopar/reduc-3.c +++ b/gcc/testsuite/gcc.dg/autopar/reduc-3.c @@ -6,14 +6,15 @@ #define N 16 +unsigned int ub[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +unsigned int uc[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + /* Reduction of unsigned-int. */ __attribute__ ((noinline)) int main1 (int n, int res) { int i; - unsigned int ub[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; - unsigned int uc[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; unsigned int udiff; udiff = 0; diff --git a/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-11.c b/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-11.c index c0d6b20f0c8..7fdcf750675 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-11.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-11.c @@ -6,12 +6,13 @@ #define N 16 +char ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +char ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; + int main () { int i; char ia[N]; - char ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; - char ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; for (i = 0; i < N; i++) { diff --git a/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-11a.c b/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-11a.c index b0394c6519a..d147b81158b 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-11a.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-11a.c @@ -14,12 +14,13 @@ typedef short half_word; typedef int half_word; #endif +half_word ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +half_word ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; + int main () { int i; half_word ia[N]; - half_word ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; - half_word ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; for (i = 0; i < N; i++) { diff --git a/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-2.c b/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-2.c index 5c4e9735bbd..84248ee87fd 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-2.c @@ -14,9 +14,10 @@ typedef short half_word; typedef int half_word; #endif +half_word cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; + int main () { - half_word cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; half_word ca[N]; int i; diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ifc-20040816-1.c b/gcc/testsuite/gcc.dg/tree-ssa/ifc-20040816-1.c index 691026d7905..e7b13b54096 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ifc-20040816-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ifc-20040816-1.c @@ -6,12 +6,12 @@ #define N 16 #define MAX 42 +int A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11}; + extern void abort(void); int main1 () { - int A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11}; - int i, j; for (i = 0; i < N; i++) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-19.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-19.c new file mode 100644 index 00000000000..0fd0dc5425c --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-19.c @@ -0,0 +1,39 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre-stats" } */ + +struct Loc { + int x[3]; +}; + +void bar (struct Loc *); + +int foo (int i, int j, int k, int b) +{ + struct Loc IND; + int res; + + if (b) + { + IND.x[0] = i; + IND.x[1] = j; + IND.x[2] = k-1; + } + else + { + IND.x[0] = i; + IND.x[1] = j; + IND.x[2] = k; + } + + /* This should be optimized to i + j + {k, k + 1}. */ + res = IND.x[0] + IND.x[1] + IND.x[2]; + + /* This is just to prevent SRA. */ + bar (&IND); + + return res; +} + +/* All three loads should be eliminated. */ +/* { dg-final { scan-tree-dump "Eliminated: 3" "pre" } } */ +/* { dg-final { cleanup-tree-dump "pre" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/i386/costmodel-vect-reduc-1char.c b/gcc/testsuite/gcc.dg/vect/costmodel/i386/costmodel-vect-reduc-1char.c index 55334fdd20d..a7b86cebd9c 100644 --- a/gcc/testsuite/gcc.dg/vect/costmodel/i386/costmodel-vect-reduc-1char.c +++ b/gcc/testsuite/gcc.dg/vect/costmodel/i386/costmodel-vect-reduc-1char.c @@ -6,12 +6,13 @@ #define N 16 #define DIFF 242 +unsigned char ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +unsigned char uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + void main1 (unsigned char x, unsigned char max_result, unsigned char min_result) { int i; - unsigned char ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; - unsigned char uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; unsigned char udiff = 2; unsigned char umax = x; unsigned char umin = x; diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-vect-76c.c b/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-vect-76c.c index d18f416a07c..1142e7a2717 100644 --- a/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-vect-76c.c +++ b/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-vect-76c.c @@ -11,12 +11,12 @@ more involved than just an ssa_name. */ int ib[N+OFF] __attribute__ ((__aligned__(16))) = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10}; +int ic[N+OFF] = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10}; int main1 (int *pib) { int i; int ia[N+OFF]; - int ic[N+OFF] = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10}; for (i = OFF; i < N; i++) { diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/x86_64/costmodel-vect-reduc-1char.c b/gcc/testsuite/gcc.dg/vect/costmodel/x86_64/costmodel-vect-reduc-1char.c index 55334fdd20d..a7b86cebd9c 100644 --- a/gcc/testsuite/gcc.dg/vect/costmodel/x86_64/costmodel-vect-reduc-1char.c +++ b/gcc/testsuite/gcc.dg/vect/costmodel/x86_64/costmodel-vect-reduc-1char.c @@ -6,12 +6,13 @@ #define N 16 #define DIFF 242 +unsigned char ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +unsigned char uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + void main1 (unsigned char x, unsigned char max_result, unsigned char min_result) { int i; - unsigned char ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; - unsigned char uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; unsigned char udiff = 2; unsigned char umax = x; unsigned char umin = x; diff --git a/gcc/testsuite/gcc.dg/vect/fast-math-vect-reduc-5.c b/gcc/testsuite/gcc.dg/vect/fast-math-vect-reduc-5.c index 74bdd262319..377d74b7779 100644 --- a/gcc/testsuite/gcc.dg/vect/fast-math-vect-reduc-5.c +++ b/gcc/testsuite/gcc.dg/vect/fast-math-vect-reduc-5.c @@ -9,11 +9,12 @@ #define N 16 #define DIFF 242 +float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + int main1 (float x, float max_result) { int i; - float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; - float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; float diff = 2; float max = x; float min = 10; diff --git a/gcc/testsuite/gcc.dg/vect/fast-math-vect-reduc-7.c b/gcc/testsuite/gcc.dg/vect/fast-math-vect-reduc-7.c index b25e1145b1e..9f36db2e701 100644 --- a/gcc/testsuite/gcc.dg/vect/fast-math-vect-reduc-7.c +++ b/gcc/testsuite/gcc.dg/vect/fast-math-vect-reduc-7.c @@ -9,11 +9,12 @@ #define N 16 #define DIFF 242 +double b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +double c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + int main1 (double x, double max_result) { int i; - double b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; - double c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; double diff = 2; double max = x; double min = 10; diff --git a/gcc/testsuite/gcc.dg/vect/no-trapping-math-2.c b/gcc/testsuite/gcc.dg/vect/no-trapping-math-2.c index cc3142efd68..3971c920afa 100644 --- a/gcc/testsuite/gcc.dg/vect/no-trapping-math-2.c +++ b/gcc/testsuite/gcc.dg/vect/no-trapping-math-2.c @@ -6,12 +6,13 @@ #define N 16 +float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; + __attribute__ ((noinline)) int main1 (void) { int i; float a[N]; - float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; /* Condition in loop. */ /* This loop is vectorized on platforms that support vect_condition. */ diff --git a/gcc/testsuite/gcc.dg/vect/no-trapping-math-vect-111.c b/gcc/testsuite/gcc.dg/vect/no-trapping-math-vect-111.c index 413c7ef4226..673346a675c 100644 --- a/gcc/testsuite/gcc.dg/vect/no-trapping-math-vect-111.c +++ b/gcc/testsuite/gcc.dg/vect/no-trapping-math-vect-111.c @@ -5,12 +5,13 @@ #define N 16 +float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; + __attribute__ ((noinline)) int main1 (void) { int i; float a[N]; - float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; /* Condition in loop. */ /* This loop is vectorized on platforms that support vect_condition. */ diff --git a/gcc/testsuite/gcc.dg/vect/no-trapping-math-vect-ifcvt-11.c b/gcc/testsuite/gcc.dg/vect/no-trapping-math-vect-ifcvt-11.c index 560b5bc73df..a35b7ade8e6 100644 --- a/gcc/testsuite/gcc.dg/vect/no-trapping-math-vect-ifcvt-11.c +++ b/gcc/testsuite/gcc.dg/vect/no-trapping-math-vect-ifcvt-11.c @@ -8,12 +8,13 @@ #define N 16 #define MAX 42 +float A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11}; +float B[N] = {0,0,42,42,42,0,0,0,0,0,42,42,42,42,42,0}; + extern void abort(void); int main () { - float A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11}; - float B[N] = {0,0,42,42,42,0,0,0,0,0,42,42,42,42,42,0}; int i, j; check_vect (); diff --git a/gcc/testsuite/gcc.dg/vect/no-trapping-math-vect-ifcvt-12.c b/gcc/testsuite/gcc.dg/vect/no-trapping-math-vect-ifcvt-12.c index 5f132b8ba81..485e88cf383 100644 --- a/gcc/testsuite/gcc.dg/vect/no-trapping-math-vect-ifcvt-12.c +++ b/gcc/testsuite/gcc.dg/vect/no-trapping-math-vect-ifcvt-12.c @@ -8,12 +8,13 @@ #define N 16 #define MAX 42 +float A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11}; +float B[N] = {0,0,0,42,42,0,0,0,0,0,42,42,42,42,42,0}; + extern void abort(void); int main () { - float A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11}; - float B[N] = {0,0,0,42,42,0,0,0,0,0,42,42,42,42,42,0}; int i, j; check_vect (); diff --git a/gcc/testsuite/gcc.dg/vect/no-trapping-math-vect-ifcvt-13.c b/gcc/testsuite/gcc.dg/vect/no-trapping-math-vect-ifcvt-13.c index a5a59366bdc..58e6dc0a9ca 100644 --- a/gcc/testsuite/gcc.dg/vect/no-trapping-math-vect-ifcvt-13.c +++ b/gcc/testsuite/gcc.dg/vect/no-trapping-math-vect-ifcvt-13.c @@ -8,12 +8,13 @@ #define N 16 #define MAX 42 +float A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11}; +float B[N] = {42,42,42,0,0,42,42,42,42,42,0,0,0,0,0,42}; + extern void abort(void); int main () { - float A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11}; - float B[N] = {42,42,42,0,0,42,42,42,42,42,0,0,0,0,0,42}; int i, j; check_vect (); diff --git a/gcc/testsuite/gcc.dg/vect/no-trapping-math-vect-ifcvt-14.c b/gcc/testsuite/gcc.dg/vect/no-trapping-math-vect-ifcvt-14.c index a5a59366bdc..58e6dc0a9ca 100644 --- a/gcc/testsuite/gcc.dg/vect/no-trapping-math-vect-ifcvt-14.c +++ b/gcc/testsuite/gcc.dg/vect/no-trapping-math-vect-ifcvt-14.c @@ -8,12 +8,13 @@ #define N 16 #define MAX 42 +float A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11}; +float B[N] = {42,42,42,0,0,42,42,42,42,42,0,0,0,0,0,42}; + extern void abort(void); int main () { - float A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11}; - float B[N] = {42,42,42,0,0,42,42,42,42,42,0,0,0,0,0,42}; int i, j; check_vect (); diff --git a/gcc/testsuite/gcc.dg/vect/no-trapping-math-vect-ifcvt-15.c b/gcc/testsuite/gcc.dg/vect/no-trapping-math-vect-ifcvt-15.c index 67d7ebe60c6..a15a0b1278c 100644 --- a/gcc/testsuite/gcc.dg/vect/no-trapping-math-vect-ifcvt-15.c +++ b/gcc/testsuite/gcc.dg/vect/no-trapping-math-vect-ifcvt-15.c @@ -8,12 +8,13 @@ #define N 16 #define MAX 42 +float A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11}; +float B[N] = {42,42,0,0,0,42,42,42,42,42,0,0,0,0,0,42}; + extern void abort(void); int main () { - float A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11}; - float B[N] = {42,42,0,0,0,42,42,42,42,42,0,0,0,0,0,42}; int i, j; check_vect (); diff --git a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-37.c b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-37.c index 09df31f7c3b..bfa0802c0ce 100644 --- a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-37.c +++ b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-37.c @@ -5,6 +5,7 @@ #define N 16 char x[N] __attribute__ ((__aligned__(16))); +char cb[N] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; __attribute__ ((noinline)) int main1 (char *y) @@ -13,7 +14,6 @@ int main1 (char *y) char *p; char *q; } s; - char cb[N] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; int i; /* Not vectorized - can't antialias the pointer s.p from the array cb. */ diff --git a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-depend-1.c b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-depend-1.c index 2c3ac296ff8..329478d39fe 100644 --- a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-depend-1.c +++ b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-depend-1.c @@ -5,13 +5,14 @@ #define N 17 +int ia[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48}; +int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48}; +int res[N] = {12,24,36,48,60,72,84,96,108,120,132,144,156,168,180,192,48}; + __attribute__ ((noinline)) int main1 () { int i; - int ia[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48}; - int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48}; - int res[N] = {12,24,36,48,60,72,84,96,108,120,132,144,156,168,180,192,48}; /* Not vectorizable due to data dependence: dependence distance 1. */ for (i = 0; i < N - 1; i++) diff --git a/gcc/testsuite/gcc.dg/vect/pr18400.c b/gcc/testsuite/gcc.dg/vect/pr18400.c index e2ad18cec7d..6bc3b5c831b 100644 --- a/gcc/testsuite/gcc.dg/vect/pr18400.c +++ b/gcc/testsuite/gcc.dg/vect/pr18400.c @@ -4,11 +4,12 @@ #include "tree-vect.h" #define N 8 + +int b[N] = {0,3,6,9,12,15,18,21}; +int a[N]; int main1 () { - int b[N] = {0,3,6,9,12,15,18,21}; - int a[N]; int i; for (i = 0; i < N; i++) diff --git a/gcc/testsuite/gcc.dg/vect/slp-12b.c b/gcc/testsuite/gcc.dg/vect/slp-12b.c index 7b65dfcfe35..9f7c7606b46 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-12b.c +++ b/gcc/testsuite/gcc.dg/vect/slp-12b.c @@ -6,11 +6,12 @@ #define N 64 +unsigned int in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; + int main1 () { int i; - unsigned int in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; float out2[N*8], fa[N*4]; for (i = 0; i < N; i++) diff --git a/gcc/testsuite/gcc.dg/vect/slp-14.c b/gcc/testsuite/gcc.dg/vect/slp-14.c index 2051e285f64..98a203cf5ca 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-14.c +++ b/gcc/testsuite/gcc.dg/vect/slp-14.c @@ -6,13 +6,14 @@ #define N 8 +unsigned int in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; +unsigned short in2[N*16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; + int main1 (int n) { int i; unsigned int out[N*8], a0, a1, a2, a3, a4, a5, a6, a7, b1, b0, b2, b3, b4, b5, b6, b7; - unsigned int in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; - unsigned short in2[N*16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; unsigned short out2[N*16]; /* Multiple types are now SLPable. */ diff --git a/gcc/testsuite/gcc.dg/vect/slp-15.c b/gcc/testsuite/gcc.dg/vect/slp-15.c index 08b6f84b209..dde0b746fae 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-15.c +++ b/gcc/testsuite/gcc.dg/vect/slp-15.c @@ -6,14 +6,16 @@ #define N 8 +unsigned int out[N*8], a0, a1, a2, a3, a4, a5, a6, a7, b1, b0, b2, b3, b4, b5, b6, b7; +unsigned int in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; +unsigned int in2[N*16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; +unsigned int out2[N*16]; + int main1 (int n) { int i; - unsigned int out[N*8], a0, a1, a2, a3, a4, a5, a6, a7, b1, b0, b2, b3, b4, b5, b6, b7; - unsigned int in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; - unsigned int in2[N*16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; - unsigned int out2[N*16]; + unsigned int a0, a1, a2, a3, a4, a5, a6, a7, b1, b0, b2, b3, b4, b5, b6, b7; for (i = 0; i < n; i++) { diff --git a/gcc/testsuite/gcc.dg/vect/slp-16.c b/gcc/testsuite/gcc.dg/vect/slp-16.c index cbc47cd1f2b..5ca698f7d36 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-16.c +++ b/gcc/testsuite/gcc.dg/vect/slp-16.c @@ -6,14 +6,16 @@ #define N 8 +unsigned int out[N*8]; +unsigned int in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; +unsigned int in2[N*16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; +unsigned int out2[N*16]; + int main1 () { int i; - unsigned int out[N*8], a0, a1, a2, a3, a4, a5, a6, a7, b1, b0, b2, b3, b4, b5, b6, b7; - unsigned int in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; - unsigned int in2[N*16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; - unsigned int out2[N*16]; + unsigned int a0, a1, a2, a3, a4, a5, a6, a7, b1, b0, b2, b3, b4, b5, b6, b7; /* SLP group of size that is not a multiple of vector size. Unrolling by 2. */ diff --git a/gcc/testsuite/gcc.dg/vect/slp-17.c b/gcc/testsuite/gcc.dg/vect/slp-17.c index 0a760bf2c68..0939f74d4db 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-17.c +++ b/gcc/testsuite/gcc.dg/vect/slp-17.c @@ -6,14 +6,15 @@ #define N 8 +unsigned short out[N*8]; +unsigned short in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; +unsigned short in2[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; +unsigned short out2[N*8]; + int main1 () { int i; - unsigned short out[N*8]; - unsigned short in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; - unsigned short in2[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; - unsigned short out2[N*8]; for (i = 0; i < N*2; i++) { diff --git a/gcc/testsuite/gcc.dg/vect/slp-24.c b/gcc/testsuite/gcc.dg/vect/slp-24.c index b3bf0735b02..bd9c7515e44 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-24.c +++ b/gcc/testsuite/gcc.dg/vect/slp-24.c @@ -14,12 +14,13 @@ typedef struct { unsigned char d; } s; +unsigned char ub[N*2] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +unsigned char uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + void main1 (unsigned char x, unsigned char max_result, unsigned char min_result, s *arr) { int i; - unsigned char ub[N*2] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; - unsigned char uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; unsigned char udiff = 2; unsigned char umax = x; unsigned char umin = x; diff --git a/gcc/testsuite/gcc.dg/vect/slp-28.c b/gcc/testsuite/gcc.dg/vect/slp-28.c index 069116ac58e..780a4472b81 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-28.c +++ b/gcc/testsuite/gcc.dg/vect/slp-28.c @@ -6,15 +6,16 @@ #define N 32 +unsigned short in[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31}; +unsigned short in2[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31}; +unsigned short in3[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31}; +unsigned short check[N] = {0,1,2,3,5,6,7,8,10,11,12,13,15,16,17,18,20,21,22,23,25,26,27,28,30,31,32,33,35,36,37,38}; +unsigned short check3[N] = {0,1,2,3,4,5,6,7,8,9,10,11,5,6,7,8,9,10,11,12,13,14,15,16,10,11,12,13,14,15,16,17}; + int main1 () { int i; - unsigned short in[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31}; - unsigned short in2[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31}; - unsigned short in3[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31}; - unsigned short check[N] = {0,1,2,3,5,6,7,8,10,11,12,13,15,16,17,18,20,21,22,23,25,26,27,28,30,31,32,33,35,36,37,38}; - unsigned short check3[N] = {0,1,2,3,4,5,6,7,8,9,10,11,5,6,7,8,9,10,11,12,13,14,15,16,10,11,12,13,14,15,16,17}; for (i = 0; i < N/4; i++) { diff --git a/gcc/testsuite/gcc.dg/vect/slp-3.c b/gcc/testsuite/gcc.dg/vect/slp-3.c index cf39bf17a31..070715371bb 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-3.c +++ b/gcc/testsuite/gcc.dg/vect/slp-3.c @@ -6,12 +6,13 @@ #define N 8 +unsigned short in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; + int main1 () { int i; unsigned short out[N*8]; - unsigned short in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; for (i = 0; i < N; i++) { diff --git a/gcc/testsuite/gcc.dg/vect/slp-34.c b/gcc/testsuite/gcc.dg/vect/slp-34.c index d25eef02101..3ed56eae4ec 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-34.c +++ b/gcc/testsuite/gcc.dg/vect/slp-34.c @@ -6,13 +6,14 @@ #define N 8 +unsigned short in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; +unsigned short in2[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; + int main1 () { int i; unsigned short out[N*8]; - unsigned short in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; - unsigned short in2[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; unsigned short out2[N*8]; /* SLP with unrolling by 8. */ diff --git a/gcc/testsuite/gcc.dg/vect/slp-6.c b/gcc/testsuite/gcc.dg/vect/slp-6.c index 5e86410588a..672b1d6e28a 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-6.c +++ b/gcc/testsuite/gcc.dg/vect/slp-6.c @@ -6,13 +6,14 @@ #define N 8 +unsigned short in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; +unsigned int in2[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; + int main1 () { int i; unsigned short out[N*8]; - unsigned short in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; - unsigned int in2[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; unsigned int out2[N*8]; for (i = 0; i < N; i++) diff --git a/gcc/testsuite/gcc.dg/vect/slp-7.c b/gcc/testsuite/gcc.dg/vect/slp-7.c index f000fc9059f..72ec0cd1ea2 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-7.c +++ b/gcc/testsuite/gcc.dg/vect/slp-7.c @@ -6,13 +6,14 @@ #define N 8 +unsigned int in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; +unsigned short in2[N*16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; + int main1 () { int i; unsigned int out[N*8], ia[N*2]; - unsigned int in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; - unsigned short in2[N*16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63}; unsigned short sa[N], out2[N*16]; for (i = 0; i < N; i++) diff --git a/gcc/testsuite/gcc.dg/vect/slp-8.c b/gcc/testsuite/gcc.dg/vect/slp-8.c index 1260ddce504..76db4e1c28a 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-8.c +++ b/gcc/testsuite/gcc.dg/vect/slp-8.c @@ -5,10 +5,11 @@ #define N 32 +int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; + int main1 () { int i; - int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; float fa[N]; /* int -> float */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-107.c b/gcc/testsuite/gcc.dg/vect/vect-107.c index 514fc362068..201d4ab4e34 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-107.c +++ b/gcc/testsuite/gcc.dg/vect/vect-107.c @@ -5,14 +5,15 @@ #define N 16 +float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; +float d[N] = {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30}; + __attribute__ ((noinline)) int main1 (void) { int i; float a[N]; - float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; - float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; - float d[N] = {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30}; /* Strided access. Vectorizable on platforms that support load of strided accesses (extract of even/odd vector elements). */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-108.c b/gcc/testsuite/gcc.dg/vect/vect-108.c index 56700aa18b6..28e85b2e9c0 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-108.c +++ b/gcc/testsuite/gcc.dg/vect/vect-108.c @@ -5,13 +5,14 @@ #define N 16 +int ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +int ia[N]; + __attribute__ ((noinline)) int main1 (void) { int i; - int ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; - int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; - int ia[N]; /* This loop is vectorized on platforms that support vect_int_mult. */ for (i = 0; i < N; i++) diff --git a/gcc/testsuite/gcc.dg/vect/vect-11.c b/gcc/testsuite/gcc.dg/vect/vect-11.c index 46cc19ad337..3df8f47b5f5 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-11.c +++ b/gcc/testsuite/gcc.dg/vect/vect-11.c @@ -6,13 +6,14 @@ #define N 16 +int ia[N]; +int ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; + __attribute__ ((noinline)) int main1 () { int i; - int ia[N]; - int ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; - int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; /* Not vectorizable yet (integer mult). */ for (i = 0; i < N; i++) diff --git a/gcc/testsuite/gcc.dg/vect/vect-112.c b/gcc/testsuite/gcc.dg/vect/vect-112.c index 0bc185b361e..4d954d10829 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-112.c +++ b/gcc/testsuite/gcc.dg/vect/vect-112.c @@ -5,13 +5,14 @@ #define N 16 +char cb[N] = {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17}; +char cc[N] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}; + __attribute__ ((noinline)) int main1 (void) { int i; int diff = 0; - char cb[N] = {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17}; - char cc[N] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}; /* Cross-iteration cycle. */ diff = 0; diff --git a/gcc/testsuite/gcc.dg/vect/vect-115.c b/gcc/testsuite/gcc.dg/vect/vect-115.c index ed1d6794fb1..ce6eaf45488 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-115.c +++ b/gcc/testsuite/gcc.dg/vect/vect-115.c @@ -23,12 +23,13 @@ struct test1{ int l; }; +int a[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + __attribute__ ((noinline)) int main1 () { int i; struct test1 tmp1; - int a[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; struct t tmp2; tmp1.ptr_t = &tmp2; diff --git a/gcc/testsuite/gcc.dg/vect/vect-11a.c b/gcc/testsuite/gcc.dg/vect/vect-11a.c index 75b1035df4d..2da903b1bc4 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-11a.c +++ b/gcc/testsuite/gcc.dg/vect/vect-11a.c @@ -6,16 +6,17 @@ extern void abort (void); +unsigned int A[8] = {0x08000000,0xffffffff,0xff0000ff,0xf0000001, + 0x08000000,0xffffffff,0xff0000ff,0xf0000001}; +unsigned int B[8] = {0x08000000,0x08000001,0xff0000ff,0xf0000001, + 0x08000000,0x08000001,0xff0000ff,0xf0000001}; +unsigned int Answer[8] = {0,0xf7ffffff,0x0200fe01,0xe0000001, + 0,0xf7ffffff,0x0200fe01,0xe0000001}; +unsigned int C[8]; + __attribute__ ((noinline)) void u () { - unsigned int A[8] = {0x08000000,0xffffffff,0xff0000ff,0xf0000001, - 0x08000000,0xffffffff,0xff0000ff,0xf0000001}; - unsigned int B[8] = {0x08000000,0x08000001,0xff0000ff,0xf0000001, - 0x08000000,0x08000001,0xff0000ff,0xf0000001}; - unsigned int Answer[8] = {0,0xf7ffffff,0x0200fe01,0xe0000001, - 0,0xf7ffffff,0x0200fe01,0xe0000001}; - unsigned int C[8]; int i, j; for (i=0; i<8; i++) @@ -25,22 +26,23 @@ void u () abort (); } +signed int D[8] = {0x08000000,0xffffffff,0xff0000ff,0xf0000001, + 0x08000000,0xffffffff,0xff0000ff,0xf0000001}; +signed int E[8] = {0x08000000,0x08000001,0xff0000ff,0xf0000001, + 0x08000000,0x08000001,0xff0000ff,0xf0000001}; +signed int Dnswer[8] = {0,0xf7ffffff,0x0200fe01, 0xe0000001, + 0,0xf7ffffff,0x0200fe01, 0xe0000001}; +signed int F[8]; + __attribute__ ((noinline)) void s() { - signed int A[8] = {0x08000000,0xffffffff,0xff0000ff,0xf0000001, - 0x08000000,0xffffffff,0xff0000ff,0xf0000001}; - signed int B[8] = {0x08000000,0x08000001,0xff0000ff,0xf0000001, - 0x08000000,0x08000001,0xff0000ff,0xf0000001}; - signed int Answer[8] = {0,0xf7ffffff,0x0200fe01, 0xe0000001, - 0,0xf7ffffff,0x0200fe01, 0xe0000001}; - signed int C[8]; int i, j; for (i=0; i<8; i++) - C[i] = A[i] * B[i]; + F[i] = D[i] * E[i]; for (i=0; i<8; i++) - if (C[i] != Answer[i]) + if (F[i] != Dnswer[i]) abort (); } diff --git a/gcc/testsuite/gcc.dg/vect/vect-34.c b/gcc/testsuite/gcc.dg/vect/vect-34.c index 4e80bd4cbf2..df18f774e5d 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-34.c +++ b/gcc/testsuite/gcc.dg/vect/vect-34.c @@ -4,15 +4,16 @@ #include "tree-vect.h" #define N 16 + +struct { + char ca[N]; +} s; +char cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; __attribute__ ((noinline)) int main1 () { int i; - struct { - char ca[N]; - } s; - char cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; for (i = 0; i < N; i++) { diff --git a/gcc/testsuite/gcc.dg/vect/vect-9.c b/gcc/testsuite/gcc.dg/vect/vect-9.c index 3a4036765fa..c11784a4b2b 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-9.c +++ b/gcc/testsuite/gcc.dg/vect/vect-9.c @@ -5,12 +5,13 @@ #define N 16 +short sb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +int ia[N]; + __attribute__ ((noinline)) int main1 () { int i; - short sb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; - int ia[N]; /* Requires type promotion (vector unpacking) support. */ for (i = 0; i < N; i++) diff --git a/gcc/testsuite/gcc.dg/vect/vect-97.c b/gcc/testsuite/gcc.dg/vect/vect-97.c index 527aeef14aa..c95c503c941 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-97.c +++ b/gcc/testsuite/gcc.dg/vect/vect-97.c @@ -5,6 +5,9 @@ #define N 16 +char x[N] __attribute__ ((__aligned__(16))); +char cb[N] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; + __attribute__ ((noinline)) int main1 () { @@ -13,8 +16,6 @@ int main1 () char *q; } s; int i; - char x[N] __attribute__ ((__aligned__(16))); - char cb[N] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; /* Check that datarefs analysis can determine that the access via pointer s.p is based off array x, which enables us to antialias this access from diff --git a/gcc/testsuite/gcc.dg/vect/vect-align-1.c b/gcc/testsuite/gcc.dg/vect/vect-align-1.c index a0f078c31f0..f6bf22da93e 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-align-1.c +++ b/gcc/testsuite/gcc.dg/vect/vect-align-1.c @@ -14,11 +14,12 @@ struct foo { int y[N]; } __attribute__((packed)); +int x[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + __attribute__ ((noinline)) int main1 (struct foo * __restrict__ p) { int i; - int x[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; for (i = 0; i < N; i++) { diff --git a/gcc/testsuite/gcc.dg/vect/vect-float-extend-1.c b/gcc/testsuite/gcc.dg/vect/vect-float-extend-1.c index 1647193bd63..3035ee392b3 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-float-extend-1.c +++ b/gcc/testsuite/gcc.dg/vect/vect-float-extend-1.c @@ -5,12 +5,13 @@ #define N 32 +float fb[N] = {0.4,3.5,6.6,9.4,12.5,15.6,18.4,21.5,24.6,27.4,30.5,33.6,36.4,39.5,42.6,45.4,0.5,3.6,6.4,9.5,12.6,15.4,18.5,21.6,24.4,27.5,30.6,33.4,36.5,39.6,42.4,45.5}; +double da[N]; + __attribute__ ((noinline)) int main1 () { int i; - float fb[N] = {0.4,3.5,6.6,9.4,12.5,15.6,18.4,21.5,24.6,27.4,30.5,33.6,36.4,39.5,42.6,45.4,0.5,3.6,6.4,9.5,12.6,15.4,18.5,21.6,24.4,27.5,30.6,33.4,36.5,39.6,42.4,45.5}; - double da[N]; /* float -> double */ for (i = 0; i < N; i++) diff --git a/gcc/testsuite/gcc.dg/vect/vect-floatint-conversion-1.c b/gcc/testsuite/gcc.dg/vect/vect-floatint-conversion-1.c index d9b22288145..e5b72f1acab 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-floatint-conversion-1.c +++ b/gcc/testsuite/gcc.dg/vect/vect-floatint-conversion-1.c @@ -5,12 +5,13 @@ #define N 32 +float fb[N] = {0.4,3.5,6.6,9.4,12.5,15.6,18.4,21.5,24.6,27.4,30.5,33.6,36.4,39.5,42.6,45.4,0.5,3.6,6.4,9.5,12.6,15.4,18.5,21.6,24.4,27.5,30.6,33.4,36.5,39.6,42.4,45.5}; +int ia[N]; + __attribute__ ((noinline)) int main1 () { int i; - float fb[N] = {0.4,3.5,6.6,9.4,12.5,15.6,18.4,21.5,24.6,27.4,30.5,33.6,36.4,39.5,42.6,45.4,0.5,3.6,6.4,9.5,12.6,15.4,18.5,21.6,24.4,27.5,30.6,33.4,36.5,39.6,42.4,45.5}; - int ia[N]; /* float -> int */ for (i = 0; i < N; i++) diff --git a/gcc/testsuite/gcc.dg/vect/vect-ifcvt-16.c b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-16.c index de7da97efa3..8071c87d09c 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-ifcvt-16.c +++ b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-16.c @@ -10,10 +10,11 @@ extern void abort(void); +float A[N] = {36,39,42,45,43,32,21,42,23,34,45,56,67,42,89,11}; +float B[N] = {42,42,0,42,42,42,42,0,42,42,42,42,42,0,42,42}; + int main () { - float A[N] = {36,39,42,45,43,32,21,42,23,34,45,56,67,42,89,11}; - float B[N] = {42,42,0,42,42,42,42,0,42,42,42,42,42,0,42,42}; int i, j; check_vect (); diff --git a/gcc/testsuite/gcc.dg/vect/vect-ifcvt-17.c b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-17.c index 0a497b524bd..a02c8984e58 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-ifcvt-17.c +++ b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-17.c @@ -8,12 +8,13 @@ #define N 16 #define MAX 42 +float A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,42,78,89,11}; +float B[N] = {42,42,0,42,42,42,42,42,42,42,42,42,0,42,42,42}; + extern void abort(void); int main () { - float A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,42,78,89,11}; - float B[N] = {42,42,0,42,42,42,42,42,42,42,42,42,0,42,42,42}; int i, j; check_vect (); diff --git a/gcc/testsuite/gcc.dg/vect/vect-ifcvt-2.c b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-2.c index a89bd8f88f7..e899f126d8c 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-ifcvt-2.c +++ b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-2.c @@ -8,12 +8,13 @@ #define N 16 #define MAX 42 +int A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11}; +int B[N] = {0,0,42,42,42,0,0,0,0,0,42,42,42,42,42,0}; + extern void abort(void); int main () { - int A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11}; - int B[N] = {0,0,42,42,42,0,0,0,0,0,42,42,42,42,42,0}; int i, j; check_vect (); diff --git a/gcc/testsuite/gcc.dg/vect/vect-ifcvt-3.c b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-3.c index 902b1549fa0..1d8e9f52b23 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-ifcvt-3.c +++ b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-3.c @@ -8,12 +8,13 @@ #define N 16 #define MAX 42 +int A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11}; +int B[N] = {0,0,0,42,42,0,0,0,0,0,42,42,42,42,42,0}; + extern void abort(void); int main () { - int A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11}; - int B[N] = {0,0,0,42,42,0,0,0,0,0,42,42,42,42,42,0}; int i, j; check_vect (); diff --git a/gcc/testsuite/gcc.dg/vect/vect-ifcvt-4.c b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-4.c index a057ccbd0c0..1680cba8a88 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-ifcvt-4.c +++ b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-4.c @@ -8,12 +8,13 @@ #define N 16 #define MAX 42 +int A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11}; +int B[N] = {42,42,42,0,0,42,42,42,42,42,0,0,0,0,0,42}; + extern void abort(void); int main () { - int A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11}; - int B[N] = {42,42,42,0,0,42,42,42,42,42,0,0,0,0,0,42}; int i, j; check_vect (); diff --git a/gcc/testsuite/gcc.dg/vect/vect-ifcvt-5.c b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-5.c index 879741062aa..5fc9674b317 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-ifcvt-5.c +++ b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-5.c @@ -8,12 +8,13 @@ #define N 16 #define MAX 42 +int A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11}; +int B[N] = {42,42,0,0,0,42,42,42,42,42,0,0,0,0,0,42}; + extern void abort(void); int main () { - int A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,67,78,89,11}; - int B[N] = {42,42,0,0,0,42,42,42,42,42,0,0,0,0,0,42}; int i, j; check_vect (); diff --git a/gcc/testsuite/gcc.dg/vect/vect-ifcvt-6.c b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-6.c index f2330bd6aa9..24e8c969e1c 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-ifcvt-6.c +++ b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-6.c @@ -8,12 +8,13 @@ #define N 16 #define MAX 42 +int A[N] = {36,39,42,45,43,32,21,42,23,34,45,56,67,42,89,11}; +int B[N] = {42,42,0,42,42,42,42,0,42,42,42,42,42,0,42,42}; + extern void abort(void); int main () { - int A[N] = {36,39,42,45,43,32,21,42,23,34,45,56,67,42,89,11}; - int B[N] = {42,42,0,42,42,42,42,0,42,42,42,42,42,0,42,42}; int i, j; check_vect (); diff --git a/gcc/testsuite/gcc.dg/vect/vect-ifcvt-7.c b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-7.c index fa89d832890..fa4cf3a58fa 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-ifcvt-7.c +++ b/gcc/testsuite/gcc.dg/vect/vect-ifcvt-7.c @@ -8,12 +8,13 @@ #define N 16 #define MAX 42 +int A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,42,78,89,11}; +int B[N] = {42,42,0,42,42,42,42,42,42,42,42,42,0,42,42,42}; + extern void abort(void); int main () { - int A[N] = {36,39,42,45,43,32,21,12,23,34,45,56,42,78,89,11}; - int B[N] = {42,42,0,42,42,42,42,42,42,42,42,42,0,42,42,42}; int i, j; check_vect (); diff --git a/gcc/testsuite/gcc.dg/vect/vect-intfloat-conversion-1.c b/gcc/testsuite/gcc.dg/vect/vect-intfloat-conversion-1.c index d3d049186b0..90f33a508a6 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-intfloat-conversion-1.c +++ b/gcc/testsuite/gcc.dg/vect/vect-intfloat-conversion-1.c @@ -5,11 +5,12 @@ #define N 32 +int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +float fa[N]; + __attribute__ ((noinline)) int main1 () { int i; - int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; - float fa[N]; /* int -> float */ for (i = 0; i < N; i++) diff --git a/gcc/testsuite/gcc.dg/vect/vect-intfloat-conversion-2.c b/gcc/testsuite/gcc.dg/vect/vect-intfloat-conversion-2.c index 10c49d6279e..87f200119d6 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-intfloat-conversion-2.c +++ b/gcc/testsuite/gcc.dg/vect/vect-intfloat-conversion-2.c @@ -5,12 +5,13 @@ #define N 32 +int int_arr[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +float float_arr[N]; +char char_arr[N]; + __attribute__ ((noinline)) int main1 () { int i; - int int_arr[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; - float float_arr[N]; - char char_arr[N]; for (i = 0; i < N; i++){ float_arr[i] = (float) int_arr[i]; diff --git a/gcc/testsuite/gcc.dg/vect/vect-intfloat-conversion-3.c b/gcc/testsuite/gcc.dg/vect/vect-intfloat-conversion-3.c index 0da79774967..d5f25df7190 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-intfloat-conversion-3.c +++ b/gcc/testsuite/gcc.dg/vect/vect-intfloat-conversion-3.c @@ -5,11 +5,12 @@ #define N 32 +int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +double da[N]; + __attribute__ ((noinline)) int main1 () { int i; - int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; - double da[N]; /* int -> double */ for (i = 0; i < N; i++) diff --git a/gcc/testsuite/gcc.dg/vect/vect-intfloat-conversion-4a.c b/gcc/testsuite/gcc.dg/vect/vect-intfloat-conversion-4a.c index 4223c378d42..af8344ba600 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-intfloat-conversion-4a.c +++ b/gcc/testsuite/gcc.dg/vect/vect-intfloat-conversion-4a.c @@ -5,11 +5,12 @@ #define N 32 +short sb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,-3,-6,-9,-12,-15,-18,-21,-24,-27,-30,-33,-36,-39,-42,-45}; +float fa[N]; + __attribute__ ((noinline)) int main1 () { int i; - short sb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,-3,-6,-9,-12,-15,-18,-21,-24,-27,-30,-33,-36,-39,-42,-45}; - float fa[N]; /* short -> float */ for (i = 0; i < N; i++) diff --git a/gcc/testsuite/gcc.dg/vect/vect-intfloat-conversion-4b.c b/gcc/testsuite/gcc.dg/vect/vect-intfloat-conversion-4b.c index 29af8e5f53a..51ea056fa1d 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-intfloat-conversion-4b.c +++ b/gcc/testsuite/gcc.dg/vect/vect-intfloat-conversion-4b.c @@ -5,11 +5,12 @@ #define N 32 +unsigned short usb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,65533,65530,65527,65524,65521,65518,65515,65512,65509,65506,65503,65500,65497,65494,65491}; +float fa[N]; + __attribute__ ((noinline)) int main1 () { int i; - unsigned short usb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,65533,65530,65527,65524,65521,65518,65515,65512,65509,65506,65503,65500,65497,65494,65491}; - float fa[N]; /* unsigned short -> float */ for (i = 0; i < N; i++) diff --git a/gcc/testsuite/gcc.dg/vect/vect-multitypes-2.c b/gcc/testsuite/gcc.dg/vect/vect-multitypes-2.c index 6abe9f5fb06..4ae47f2c58e 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-multitypes-2.c +++ b/gcc/testsuite/gcc.dg/vect/vect-multitypes-2.c @@ -5,15 +5,16 @@ #define N 32 +int ia[N]; +int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +short sa[N]; +short sb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +char ca[N]; +char cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; + __attribute__ ((noinline)) int main1 () { int i; - int ia[N]; - int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; - short sa[N]; - short sb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; - char ca[N]; - char cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; /* Multiple types with different sizes, used in independent cmputations. Vectorizable. All accesses aligned. */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-multitypes-5.c b/gcc/testsuite/gcc.dg/vect/vect-multitypes-5.c index 33da531bb54..bfa95524b54 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-multitypes-5.c +++ b/gcc/testsuite/gcc.dg/vect/vect-multitypes-5.c @@ -5,19 +5,20 @@ #define N 32 +unsigned int ia[N]; +unsigned int ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +unsigned int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +unsigned short sa[N]; +unsigned short sc[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +unsigned short sb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +unsigned char ca[N]; +unsigned char cc[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +unsigned char cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; + __attribute__ ((noinline)) int main1 () { int i; - unsigned int ia[N]; - unsigned int ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; - unsigned int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; - unsigned short sa[N]; - unsigned short sc[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; - unsigned short sb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; - unsigned char ca[N]; - unsigned char cc[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; - unsigned char cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; /* Multiple types with different sizes, used in independent computations. Vectorizable. All accesses aligned. */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-1.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-1.c index 63cd3c03baf..dbb154d1233 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-reduc-1.c +++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-1.c @@ -6,14 +6,15 @@ #define N 16 #define DIFF 242 +unsigned int ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +unsigned int uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + /* Test vectorization of reduction of unsigned-int. */ __attribute__ ((noinline)) void main1 (unsigned int x, unsigned int max_result, unsigned int min_result) { int i; - unsigned int ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; - unsigned int uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; unsigned int udiff = 2; unsigned int umax = x; unsigned int umin = x; diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-1char.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-1char.c index bf053dc0b27..5a1c03d113f 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-reduc-1char.c +++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-1char.c @@ -6,12 +6,13 @@ #define N 16 #define DIFF 242 +unsigned char ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +unsigned char uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + __attribute__ ((noinline)) void main1 (unsigned char x, unsigned char max_result, unsigned char min_result) { int i; - unsigned char ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; - unsigned char uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; unsigned char udiff = 2; unsigned char umax = x; unsigned char umin = x; diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-1short.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-1short.c index 0947ca3c70e..145722a1946 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-reduc-1short.c +++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-1short.c @@ -6,12 +6,13 @@ #define N 16 #define DIFF 242 +unsigned short ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +unsigned short uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + __attribute__ ((noinline)) void main1 (unsigned short x, unsigned short max_result, unsigned short min_result) { int i; - unsigned short ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; - unsigned short uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; unsigned short udiff = 2; unsigned short umax = x; unsigned short umin = x; diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-2.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-2.c index b23dfbaf7ea..912e69c93c2 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-reduc-2.c +++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-2.c @@ -6,14 +6,15 @@ #define N 16 #define DIFF 240 +int b[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +int c[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + /* Test vectorization of reduction of signed-int. */ __attribute__ ((noinline)) void main1 (int x, int max_result, int min_result) { int i; - int b[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; - int c[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; int diff = 0; int max = x; int min = x; diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-3.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-3.c index 49214201fb3..3e6f17c485a 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-reduc-3.c +++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-3.c @@ -5,6 +5,9 @@ #define N 16 +unsigned int ub[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +unsigned int uc[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + /* Test vectorization of reduction of unsigned-int in the presence of unknown-loop-bound. */ @@ -12,8 +15,6 @@ __attribute__ ((noinline)) int main1 (int n, int res) { int i; - unsigned int ub[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; - unsigned int uc[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; unsigned int udiff; udiff = 0; diff --git a/gcc/testsuite/gcc.dg/vect/vect-shift-1.c b/gcc/testsuite/gcc.dg/vect/vect-shift-1.c index 346fffee102..79699047eda 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-shift-1.c +++ b/gcc/testsuite/gcc.dg/vect/vect-shift-1.c @@ -6,12 +6,13 @@ #define N 8 +unsigned int A[N] = { 0x08000000, 0x08000001, 0x0ff0000ff, 0xf0000001, + 0x08000000, 0x08000001, 0x0ff0000ff, 0xf0000001 }; +unsigned int B[N] = { 0x01000000, 0x01000000, 0x01fe0001f, 0x1e000000, + 0x01000000, 0x01000000, 0x01fe0001f, 0x1e000000 }; + int main () { - unsigned int A[N] = { 0x08000000, 0x08000001, 0x0ff0000ff, 0xf0000001, - 0x08000000, 0x08000001, 0x0ff0000ff, 0xf0000001 }; - unsigned int B[N] = { 0x01000000, 0x01000000, 0x01fe0001f, 0x1e000000, - 0x01000000, 0x01000000, 0x01fe0001f, 0x1e000000 }; int i; check_vect (); diff --git a/gcc/testsuite/gcc.dg/vect/vect-strided-float.c b/gcc/testsuite/gcc.dg/vect/vect-strided-float.c index 2417f2acd39..38c50b9cd43 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-strided-float.c +++ b/gcc/testsuite/gcc.dg/vect/vect-strided-float.c @@ -5,13 +5,14 @@ #define N 16 +float b[N*2] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75,78,81,84,87,90,93}; +float c[N*2] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31}; + __attribute__ ((noinline)) int main1 (void) { int i; float a[N*2]; - float b[N*2] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75,78,81,84,87,90,93}; - float c[N*2] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31}; /* Strided access pattern. */ for (i = 0; i < N/2; i++) diff --git a/gcc/testsuite/gcc.dg/vect/vect-strided-store-u32-i2.c b/gcc/testsuite/gcc.dg/vect/vect-strided-store-u32-i2.c index ecc567c1944..1eaad435416 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-strided-store-u32-i2.c +++ b/gcc/testsuite/gcc.dg/vect/vect-strided-store-u32-i2.c @@ -6,13 +6,14 @@ #define N 16 +int a[N*2]; +int b[N] = {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30}; +int c[N] = {1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31}; + __attribute__ ((noinline)) int main1 (void) { int i; - int a[N*2]; - int b[N] = {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30}; - int c[N] = {1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31}; /* Strided access pattern. */ for (i = 0; i < N/2; i++) diff --git a/gcc/testsuite/gcc.dg/vect/wrapv-vect-reduc-2char.c b/gcc/testsuite/gcc.dg/vect/wrapv-vect-reduc-2char.c index 560229f1ebb..4b04a9d41c3 100644 --- a/gcc/testsuite/gcc.dg/vect/wrapv-vect-reduc-2char.c +++ b/gcc/testsuite/gcc.dg/vect/wrapv-vect-reduc-2char.c @@ -6,12 +6,13 @@ #define N 16 #define DIFF 121 +signed char b[N] = {1,2,3,6,8,10,12,14,16,18,20,22,24,26,28,30}; +signed char c[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + __attribute__ ((noinline)) void main1 (signed char x, signed char max_result, signed char min_result) { int i; - signed char b[N] = {1,2,3,6,8,10,12,14,16,18,20,22,24,26,28,30}; - signed char c[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; signed char diff = 2; signed char max = x; signed char min = x; diff --git a/gcc/testsuite/gcc.dg/vect/wrapv-vect-reduc-2short.c b/gcc/testsuite/gcc.dg/vect/wrapv-vect-reduc-2short.c index e6e8c6ffe95..0468b1966b9 100644 --- a/gcc/testsuite/gcc.dg/vect/wrapv-vect-reduc-2short.c +++ b/gcc/testsuite/gcc.dg/vect/wrapv-vect-reduc-2short.c @@ -6,12 +6,13 @@ #define N 16 #define DIFF 242 +short b[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +short c[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + __attribute__ ((noinline)) void main1 (short x, short max_result, short min_result) { int i; - short b[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; - short c[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; short diff = 2; short max = x; short min = x; diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index 9e8ff56495e..cc5678258a1 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -1566,7 +1566,7 @@ phi_translate_1 (pre_expr expr, bitmap_set_t set1, bitmap_set_t set2, { tree result = vn_reference_lookup_pieces (newvuses, newoperands, - &newref); + &newref, true); unsigned int new_val_id; if (newref) @@ -2499,8 +2499,12 @@ create_component_ref_by_pieces_1 (basic_block block, vn_reference_t ref, genop1 = fold_convert (build_pointer_type (currop->type), genop1); - folded = fold_build1 (currop->opcode, currop->type, - genop1); + if (currop->opcode == MISALIGNED_INDIRECT_REF) + folded = fold_build2 (currop->opcode, currop->type, + genop1, currop->op1); + else + folded = fold_build1 (currop->opcode, currop->type, + genop1); return folded; } break; @@ -3139,6 +3143,7 @@ do_regular_insertion (basic_block block, basic_block dom) basic_block bprime; pre_expr eprime = NULL; edge_iterator ei; + pre_expr edoubleprime; val = get_expr_value_id (expr); if (bitmap_set_contains_value (PHI_GEN (block), val)) @@ -3154,7 +3159,6 @@ do_regular_insertion (basic_block block, basic_block dom) FOR_EACH_EDGE (pred, ei, block->preds) { unsigned int vprime; - pre_expr edoubleprime; /* This can happen in the very weird case that our fake infinite loop edges have caused a @@ -3216,7 +3220,8 @@ do_regular_insertion (basic_block block, basic_block dom) an invariant, then the PHI has the same value on all edges. Note this. */ else if (!cant_insert && all_same && eprime - && eprime->kind == CONSTANT + && (edoubleprime->kind == CONSTANT + || edoubleprime->kind == NAME) && !value_id_constant_p (val)) { unsigned int j; @@ -3224,7 +3229,7 @@ do_regular_insertion (basic_block block, basic_block dom) bitmap_set_t exprset = VEC_index (bitmap_set_t, value_expressions, val); - unsigned int new_val = get_expr_value_id (eprime); + unsigned int new_val = get_expr_value_id (edoubleprime); FOR_EACH_EXPR_ID_IN_SET (exprset, j, bi) { pre_expr expr = expression_for_id (j); @@ -3234,9 +3239,14 @@ do_regular_insertion (basic_block block, basic_block dom) vn_ssa_aux_t info = VN_INFO (PRE_EXPR_NAME (expr)); /* Just reset the value id and valnum so it is the same as the constant we have discovered. */ - info->valnum = PRE_EXPR_CONSTANT (eprime); + if (edoubleprime->kind == CONSTANT) + { + info->valnum = PRE_EXPR_CONSTANT (edoubleprime); + pre_stats.constified++; + } + else + info->valnum = PRE_EXPR_NAME (edoubleprime); info->value_id = new_val; - pre_stats.constified++; } } } @@ -3594,7 +3604,7 @@ compute_avail (void) copy_reference_ops_from_call (stmt, &ops); vn_reference_lookup_pieces (shared_vuses_from_stmt (stmt), - ops, &ref); + ops, &ref, false); VEC_free (vn_reference_op_s, heap, ops); if (!ref) continue; diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index f502440b46f..26a65f126e1 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -595,11 +595,13 @@ copy_reference_ops_from_ref (tree ref, VEC(vn_reference_op_s, heap) **result) switch (temp.opcode) { case ALIGN_INDIRECT_REF: - case MISALIGNED_INDIRECT_REF: case INDIRECT_REF: /* The only operand is the address, which gets its own vn_reference_op_s structure. */ break; + case MISALIGNED_INDIRECT_REF: + temp.op0 = TREE_OPERAND (ref, 1); + break; case BIT_FIELD_REF: /* Record bits and position. */ temp.op0 = TREE_OPERAND (ref, 1); @@ -676,6 +678,92 @@ copy_reference_ops_from_ref (tree ref, VEC(vn_reference_op_s, heap) **result) } } +/* Re-create a reference tree from the reference ops OPS. + Returns NULL_TREE if the ops were not handled. + This routine needs to be kept in sync with copy_reference_ops_from_ref. */ + +static tree +get_ref_from_reference_ops (VEC(vn_reference_op_s, heap) *ops) +{ + vn_reference_op_t op; + unsigned i; + tree ref, *op0_p = &ref; + + for (i = 0; VEC_iterate (vn_reference_op_s, ops, i, op); ++i) + { + switch (op->opcode) + { + case CALL_EXPR: + return NULL_TREE; + + case ALIGN_INDIRECT_REF: + case INDIRECT_REF: + *op0_p = build1 (op->opcode, op->type, NULL_TREE); + op0_p = &TREE_OPERAND (*op0_p, 0); + break; + + case MISALIGNED_INDIRECT_REF: + *op0_p = build2 (MISALIGNED_INDIRECT_REF, op->type, + NULL_TREE, op->op0); + op0_p = &TREE_OPERAND (*op0_p, 0); + break; + + case BIT_FIELD_REF: + *op0_p = build3 (BIT_FIELD_REF, op->type, NULL_TREE, + op->op0, op->op1); + op0_p = &TREE_OPERAND (*op0_p, 0); + break; + + case COMPONENT_REF: + *op0_p = build3 (COMPONENT_REF, TREE_TYPE (op->op0), NULL_TREE, + op->op0, op->op1); + op0_p = &TREE_OPERAND (*op0_p, 0); + break; + + case ARRAY_RANGE_REF: + case ARRAY_REF: + *op0_p = build4 (op->opcode, op->type, NULL_TREE, + op->op0, op->op1, op->op2); + op0_p = &TREE_OPERAND (*op0_p, 0); + break; + + case STRING_CST: + case INTEGER_CST: + case COMPLEX_CST: + case VECTOR_CST: + case REAL_CST: + case CONSTRUCTOR: + case VAR_DECL: + case PARM_DECL: + case CONST_DECL: + case RESULT_DECL: + case SSA_NAME: + *op0_p = op->op0; + break; + + case ADDR_EXPR: + if (op->op0 != NULL_TREE) + { + gcc_assert (is_gimple_min_invariant (op->op0)); + *op0_p = op->op0; + break; + } + /* Fallthrough. */ + case IMAGPART_EXPR: + case REALPART_EXPR: + case VIEW_CONVERT_EXPR: + *op0_p = build1 (op->opcode, op->type, NULL_TREE); + op0_p = &TREE_OPERAND (*op0_p, 0); + break; + + default: + return NULL_TREE; + } + } + + return ref; +} + /* Copy the operations present in load/store/call REF into RESULT, a vector of vn_reference_op_s's. */ @@ -895,7 +983,7 @@ vn_reference_lookup_1 (vn_reference_t vr, vn_reference_t *vnresult) tree vn_reference_lookup_pieces (VEC (tree, gc) *vuses, VEC (vn_reference_op_s, heap) *operands, - vn_reference_t *vnresult) + vn_reference_t *vnresult, bool maywalk) { struct vn_reference_s vr1; tree result; @@ -907,6 +995,28 @@ vn_reference_lookup_pieces (VEC (tree, gc) *vuses, vr1.hashcode = vn_reference_compute_hash (&vr1); result = vn_reference_lookup_1 (&vr1, vnresult); + /* If there is a single defining statement for all virtual uses, we can + use that, following virtual use-def chains. */ + if (!result + && maywalk + && vr1.vuses + && VEC_length (tree, vr1.vuses) >= 1) + { + tree ref = get_ref_from_reference_ops (operands); + gimple def_stmt; + if (ref + && (def_stmt = get_def_ref_stmt_vuses (ref, vr1.vuses)) + && is_gimple_assign (def_stmt)) + { + /* We are now at an aliasing definition for the vuses we want to + look up. Re-do the lookup with the vdefs for this stmt. */ + vdefs_to_vec (def_stmt, &vuses); + vr1.vuses = valueize_vuses (vuses); + vr1.hashcode = vn_reference_compute_hash (&vr1); + result = vn_reference_lookup_1 (&vr1, vnresult); + } + } + return result; } diff --git a/gcc/tree-ssa-sccvn.h b/gcc/tree-ssa-sccvn.h index d648cd9bb94..49baa761831 100644 --- a/gcc/tree-ssa-sccvn.h +++ b/gcc/tree-ssa-sccvn.h @@ -178,7 +178,7 @@ void copy_reference_ops_from_ref (tree, VEC(vn_reference_op_s, heap) **); void copy_reference_ops_from_call (gimple, VEC(vn_reference_op_s, heap) **); tree vn_reference_lookup_pieces (VEC (tree, gc) *, VEC (vn_reference_op_s, heap) *, - vn_reference_t *); + vn_reference_t *, bool); tree vn_reference_lookup (tree, VEC (tree, gc) *, bool, vn_reference_t *); vn_reference_t vn_reference_insert (tree, tree, VEC (tree, gc) *); vn_reference_t vn_reference_insert_pieces (VEC (tree, gc) *, |