diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/vect')
96 files changed, 1788 insertions, 180 deletions
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-pr35982.c b/gcc/testsuite/gcc.dg/vect/fast-math-pr35982.c index 2c788606771..6a01782bb3d 100644 --- a/gcc/testsuite/gcc.dg/vect/fast-math-pr35982.c +++ b/gcc/testsuite/gcc.dg/vect/fast-math-pr35982.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-require-effective-target vect_float } */ /* { dg-require-effective-target vect_int } */ +/* { dg-require-effective-target vect_intfloat_cvt } */ struct mem { 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-pr29145.c b/gcc/testsuite/gcc.dg/vect/no-vfa-pr29145.c index 283e74f7cab..954fe25df04 100644 --- a/gcc/testsuite/gcc.dg/vect/no-vfa-pr29145.c +++ b/gcc/testsuite/gcc.dg/vect/no-vfa-pr29145.c @@ -47,6 +47,6 @@ int main(void) return 0; } -/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 2 "vect" } } */ -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 2 "vect" { xfail vect_no_align } } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail vect_no_align } } } */ /* { dg-final { cleanup-tree-dump "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-11.c b/gcc/testsuite/gcc.dg/vect/slp-11.c index d606438fd20..1e87eef4344 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-11.c +++ b/gcc/testsuite/gcc.dg/vect/slp-11.c @@ -106,7 +106,8 @@ int main (void) return 0; } -/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { target { vect_strided_wide && vect_int_mult } } } } */ +/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { target { { vect_intfloat_cvt && vect_strided_wide } && vect_int_mult } } } } */ +/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target { { { ! vect_intfloat_cvt } && vect_strided_wide } && vect_int_mult } } } } */ /* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" {target { ! { vect_int_mult && vect_strided_wide } } } } } */ /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ 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 62610dc0233..98a203cf5ca 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-14.c +++ b/gcc/testsuite/gcc.dg/vect/slp-14.c @@ -6,16 +6,17 @@ #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 not SLPable yet. */ + /* Multiple types are now SLPable. */ for (i = 0; i < n; i++) { a0 = in[i*8] + 5; @@ -110,9 +111,7 @@ int main (void) return 0; } -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_strided && vect_int_mult } } } } */ -/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" {target { ! { vect_strided && vect_int_mult } } } } } */ -/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { xfail *-*-* } } } */ -/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_int_mult } } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target vect_int_mult } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ 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-18.c b/gcc/testsuite/gcc.dg/vect/slp-18.c index b8e122c6cfa..91e1e114c1b 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-18.c +++ b/gcc/testsuite/gcc.dg/vect/slp-18.c @@ -1,4 +1,5 @@ /* { dg-require-effective-target vect_int } */ +/* { dg-require-effective-target vect_intfloat_cvt } */ #include <stdarg.h> #include <stdio.h> 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-5.c b/gcc/testsuite/gcc.dg/vect/slp-5.c index 57e9e5df55f..033de778d27 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-5.c +++ b/gcc/testsuite/gcc.dg/vect/slp-5.c @@ -15,7 +15,7 @@ main1 () unsigned short ia[N]; unsigned int ib[N*2]; - /* Not SLPable for now: multiple types with SLP of the smaller type. */ + /* Multiple types with SLP of the smaller type. */ for (i = 0; i < N; i++) { out[i*8] = in[i*8]; @@ -121,8 +121,7 @@ int main (void) return 0; } -/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { target { vect_strided_wide } } } } */ -/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target { ! { vect_strided_wide } } } } } */ -/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" } } */ +/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "vect" } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ 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/slp-9.c b/gcc/testsuite/gcc.dg/vect/slp-9.c index cfb30bd718b..461f32e8241 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-9.c +++ b/gcc/testsuite/gcc.dg/vect/slp-9.c @@ -41,7 +41,7 @@ int main (void) return 0; } -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_strided && vect_widen_mult_hi_to_si } } } }*/ -/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_widen_mult_hi_to_si } } }*/ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target vect_widen_mult_hi_to_si } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/slp-multitypes-1.c b/gcc/testsuite/gcc.dg/vect/slp-multitypes-1.c new file mode 100644 index 00000000000..a3b93b5f015 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/slp-multitypes-1.c @@ -0,0 +1,58 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define N 128 + +__attribute__ ((noinline)) int +main1 () +{ + int i; + unsigned short sout[N*8]; + unsigned int iout[N*8]; + + for (i = 0; i < N; i++) + { + sout[i*4] = 8; + sout[i*4 + 1] = 18; + sout[i*4 + 2] = 28; + sout[i*4 + 3] = 38; + + iout[i*4] = 8; + iout[i*4 + 1] = 18; + iout[i*4 + 2] = 28; + iout[i*4 + 3] = 38; + } + + /* check results: */ + for (i = 0; i < N; i++) + { + if (sout[i*4] != 8 + || sout[i*4 + 1] != 18 + || sout[i*4 + 2] != 28 + || sout[i*4 + 3] != 38 + || iout[i*4] != 8 + || iout[i*4 + 1] != 18 + || iout[i*4 + 2] != 28 + || iout[i*4 + 3] != 38) + abort (); + } + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/slp-multitypes-10.c b/gcc/testsuite/gcc.dg/vect/slp-multitypes-10.c new file mode 100644 index 00000000000..28274017d6f --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/slp-multitypes-10.c @@ -0,0 +1,52 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#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}; + +struct s +{ + unsigned char a; + unsigned char b; +}; + +__attribute__ ((noinline)) int +main1 () +{ + int i; + struct s out[N*4]; + + for (i = 0; i < N*4; i++) + { + out[i].a = (unsigned char) in[i*2] + 1; + out[i].b = (unsigned char) in[i*2 + 1] + 2; + } + + /* check results: */ + for (i = 0; i < N*4; i++) + { + if (out[i].a != (unsigned char) in[i*2] + 1 + || out[i].b != (unsigned char) in[i*2 + 1] + 2) + abort (); + } + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_pack_trunc } } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target vect_pack_trunc } } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/slp-multitypes-11.c b/gcc/testsuite/gcc.dg/vect/slp-multitypes-11.c new file mode 100644 index 00000000000..2a04ce0c6d2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/slp-multitypes-11.c @@ -0,0 +1,55 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define N 18 + +struct s +{ + int a; + int b; + int c; +}; + +char in[N*3] = {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}; + +__attribute__ ((noinline)) int +main1 () +{ + int i; + struct s out[N]; + + for (i = 0; i < N; i++) + { + out[i].a = (int) in[i*3] + 1; + out[i].b = (int) in[i*3 + 1] + 2; + out[i].c = (int) in[i*3 + 2] + 3; + } + + /* check results: */ + for (i = 0; i < N; i++) + { + if (out[i].a != (int) in[i*3] + 1 + || out[i].b != (int) in[i*3 + 1] + 2 + || out[i].c != (int) in[i*3 + 2] + 3) + abort (); + } + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_unpack } } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target vect_unpack } } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/slp-multitypes-12.c b/gcc/testsuite/gcc.dg/vect/slp-multitypes-12.c new file mode 100644 index 00000000000..5d2140fda96 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/slp-multitypes-12.c @@ -0,0 +1,68 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define N 128 + +__attribute__ ((noinline)) int +main1 () +{ + int i; + unsigned short sout[N*8]; + unsigned int iout[N*8]; + unsigned char cout[N*8]; + + for (i = 0; i < N; i++) + { + sout[i*4] = 8; + sout[i*4 + 1] = 18; + sout[i*4 + 2] = 28; + sout[i*4 + 3] = 38; + + iout[i*4] = 8; + iout[i*4 + 1] = 18; + iout[i*4 + 2] = 28; + iout[i*4 + 3] = 38; + + cout[i*4] = 1; + cout[i*4 + 1] = 2; + cout[i*4 + 2] = 3; + cout[i*4 + 3] = 4; + } + + /* check results: */ + for (i = 0; i < N; i++) + { + if (sout[i*4] != 8 + || sout[i*4 + 1] != 18 + || sout[i*4 + 2] != 28 + || sout[i*4 + 3] != 38 + || iout[i*4] != 8 + || iout[i*4 + 1] != 18 + || iout[i*4 + 2] != 28 + || iout[i*4 + 3] != 38 + || cout[i*4] != 1 + || cout[i*4 + 1] != 2 + || cout[i*4 + 2] != 3 + || cout[i*4 + 3] != 4) + abort (); + } + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/slp-multitypes-2.c b/gcc/testsuite/gcc.dg/vect/slp-multitypes-2.c new file mode 100644 index 00000000000..02faec741df --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/slp-multitypes-2.c @@ -0,0 +1,83 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define N 128 + +__attribute__ ((noinline)) int +main1 (unsigned short a0, unsigned short a1, unsigned short a2, + unsigned short a3, unsigned short a4, unsigned short a5, + unsigned short a6, unsigned short a7, unsigned short a8, + unsigned short a9, unsigned short a10, unsigned short a11, + unsigned short a12, unsigned short a13, unsigned short a14, + unsigned short a15, unsigned char b0, unsigned char b1) +{ + int i; + unsigned short out[N*16]; + unsigned char out2[N*16]; + + for (i = 0; i < N; i++) + { + out[i*16] = a8; + out[i*16 + 1] = a7; + out[i*16 + 2] = a1; + out[i*16 + 3] = a2; + out[i*16 + 4] = a8; + out[i*16 + 5] = a5; + out[i*16 + 6] = a5; + out[i*16 + 7] = a4; + out[i*16 + 8] = a12; + out[i*16 + 9] = a13; + out[i*16 + 10] = a14; + out[i*16 + 11] = a15; + out[i*16 + 12] = a6; + out[i*16 + 13] = a9; + out[i*16 + 14] = a0; + out[i*16 + 15] = a7; + + out2[i*2] = b1; + out2[i*2+1] = b0; + } + + /* check results: */ + for (i = 0; i < N; i++) + { + if (out[i*16] != a8 + || out[i*16 + 1] != a7 + || out[i*16 + 2] != a1 + || out[i*16 + 3] != a2 + || out[i*16 + 4] != a8 + || out[i*16 + 5] != a5 + || out[i*16 + 6] != a5 + || out[i*16 + 7] != a4 + || out[i*16 + 8] != a12 + || out[i*16 + 9] != a13 + || out[i*16 + 10] != a14 + || out[i*16 + 11] != a15 + || out[i*16 + 12] != a6 + || out[i*16 + 13] != a9 + || out[i*16 + 14] != a0 + || out[i*16 + 15] != a7 + || out2[i*2] != b1 + || out2[i*2 + 1] != b0) + abort (); + } + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,20,21); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/slp-multitypes-3.c b/gcc/testsuite/gcc.dg/vect/slp-multitypes-3.c new file mode 100644 index 00000000000..0764441c140 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/slp-multitypes-3.c @@ -0,0 +1,94 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#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 char 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}; + +__attribute__ ((noinline)) int +main1 () +{ + int i; + unsigned int out[N*8]; + unsigned char out2[N*8]; + + for (i = 0; i < N/2; i++) + { + out[i*8] = in[i*8] + 5; + out[i*8 + 1] = in[i*8 + 1] + 6; + out[i*8 + 2] = in[i*8 + 2] + 7; + out[i*8 + 3] = in[i*8 + 3] + 8; + out[i*8 + 4] = in[i*8 + 4] + 9; + out[i*8 + 5] = in[i*8 + 5] + 10; + out[i*8 + 6] = in[i*8 + 6] + 11; + out[i*8 + 7] = in[i*8 + 7] + 12; + + out2[i*16] = in2[i*16] + 2; + out2[i*16 + 1] = in2[i*16 + 1] + 3; + out2[i*16 + 2] = in2[i*16 + 2] + 4; + out2[i*16 + 3] = in2[i*16 + 3] + 3; + out2[i*16 + 4] = in2[i*16 + 4] + 2; + out2[i*16 + 5] = in2[i*16 + 5] + 3; + out2[i*16 + 6] = in2[i*16 + 6] + 2; + out2[i*16 + 7] = in2[i*16 + 7] + 4; + out2[i*16 + 8] = in2[i*16 + 8] + 2; + out2[i*16 + 9] = in2[i*16 + 9] + 5; + out2[i*16 + 10] = in2[i*16 + 10] + 2; + out2[i*16 + 11] = in2[i*16 + 11] + 3; + out2[i*16 + 12] = in2[i*16 + 12] + 4; + out2[i*16 + 13] = in2[i*16 + 13] + 4; + out2[i*16 + 14] = in2[i*16 + 14] + 3; + out2[i*16 + 15] = in2[i*16 + 15] + 2; + + } + + /* check results: */ + for (i = 0; i < N/2; i++) + { + if (out[i*8] != in[i*8] + 5 + || out[i*8 + 1] != in[i*8 + 1] + 6 + || out[i*8 + 2] != in[i*8 + 2] + 7 + || out[i*8 + 3] != in[i*8 + 3] + 8 + || out[i*8 + 4] != in[i*8 + 4] + 9 + || out[i*8 + 5] != in[i*8 + 5] + 10 + || out[i*8 + 6] != in[i*8 + 6] + 11 + || out[i*8 + 7] != in[i*8 + 7] + 12 + || out2[i*16] != in2[i*16] + 2 + || out2[i*16 + 1] != in2[i*16 + 1] + 3 + || out2[i*16 + 2] != in2[i*16 + 2] + 4 + || out2[i*16 + 3] != in2[i*16 + 3] + 3 + || out2[i*16 + 4] != in2[i*16 + 4] + 2 + || out2[i*16 + 5] != in2[i*16 + 5] + 3 + || out2[i*16 + 6] != in2[i*16 + 6] + 2 + || out2[i*16 + 7] != in2[i*16 + 7] + 4 + || out2[i*16 + 8] != in2[i*16 + 8] + 2 + || out2[i*16 + 9] != in2[i*16 + 9] + 5 + || out2[i*16 + 10] != in2[i*16 + 10] + 2 + || out2[i*16 + 11] != in2[i*16 + 11] + 3 + || out2[i*16 + 12] != in2[i*16 + 12] + 4 + || out2[i*16 + 13] != in2[i*16 + 13] + 4 + || out2[i*16 + 14] != in2[i*16 + 14] + 3 + || out2[i*16 + 15] != in2[i*16 + 15] + 2) + + abort (); + } + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/slp-multitypes-4.c b/gcc/testsuite/gcc.dg/vect/slp-multitypes-4.c new file mode 100644 index 00000000000..770ccfcea50 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/slp-multitypes-4.c @@ -0,0 +1,58 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define N 8 + +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}; + +__attribute__ ((noinline)) int +main1 () +{ + int i; + int out[N*8]; + + for (i = 0; i < N; i++) + { + out[i*8] = (int) in[i*8] + 1; + out[i*8 + 1] = (int) in[i*8 + 1] + 2; + out[i*8 + 2] = (int) in[i*8 + 2] + 3; + out[i*8 + 3] = (int) in[i*8 + 3] + 4; + out[i*8 + 4] = (int) in[i*8 + 4] + 5; + out[i*8 + 5] = (int) in[i*8 + 5] + 6; + out[i*8 + 6] = (int) in[i*8 + 6] + 7; + out[i*8 + 7] = (int) in[i*8 + 7] + 8; + } + + /* check results: */ + for (i = 0; i < N; i++) + { + if (out[i*8] != (int) in[i*8] + 1 + || out[i*8 + 1] != (int) in[i*8 + 1] + 2 + || out[i*8 + 2] != (int) in[i*8 + 2] + 3 + || out[i*8 + 3] != (int) in[i*8 + 3] + 4 + || out[i*8 + 4] != (int) in[i*8 + 4] + 5 + || out[i*8 + 5] != (int) in[i*8 + 5] + 6 + || out[i*8 + 6] != (int) in[i*8 + 6] + 7 + || out[i*8 + 7] != (int) in[i*8 + 7] + 8) + abort (); + } + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_unpack } } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target vect_unpack } } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/slp-multitypes-5.c b/gcc/testsuite/gcc.dg/vect/slp-multitypes-5.c new file mode 100644 index 00000000000..869d87dbcf2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/slp-multitypes-5.c @@ -0,0 +1,58 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define N 8 + +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}; + +__attribute__ ((noinline)) int +main1 () +{ + int i; + int out[N*8]; + + for (i = 0; i < N; i++) + { + out[i*8] = (short) in[i*8] + 1; + out[i*8 + 1] = (short) in[i*8 + 1] + 2; + out[i*8 + 2] = (short) in[i*8 + 2] + 3; + out[i*8 + 3] = (short) in[i*8 + 3] + 4; + out[i*8 + 4] = (short) in[i*8 + 4] + 5; + out[i*8 + 5] = (short) in[i*8 + 5] + 6; + out[i*8 + 6] = (short) in[i*8 + 6] + 7; + out[i*8 + 7] = (short) in[i*8 + 7] + 8; + } + + /* check results: */ + for (i = 0; i < N; i++) + { + if (out[i*8] != (short) in[i*8] + 1 + || out[i*8 + 1] != (short) in[i*8 + 1] + 2 + || out[i*8 + 2] != (short) in[i*8 + 2] + 3 + || out[i*8 + 3] != (short) in[i*8 + 3] + 4 + || out[i*8 + 4] != (short) in[i*8 + 4] + 5 + || out[i*8 + 5] != (short) in[i*8 + 5] + 6 + || out[i*8 + 6] != (short) in[i*8 + 6] + 7 + || out[i*8 + 7] != (short) in[i*8 + 7] + 8) + abort (); + } + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_pack_trunc } } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target vect_pack_trunc } } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/slp-multitypes-6.c b/gcc/testsuite/gcc.dg/vect/slp-multitypes-6.c new file mode 100644 index 00000000000..34f4f0b845a --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/slp-multitypes-6.c @@ -0,0 +1,58 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#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}; + +__attribute__ ((noinline)) int +main1 () +{ + int i; + unsigned char out[N*8]; + + for (i = 0; i < N; i++) + { + out[i*8] = (unsigned char) in[i*8] + 1; + out[i*8 + 1] = (unsigned char) in[i*8 + 1] + 2; + out[i*8 + 2] = (unsigned char) in[i*8 + 2] + 3; + out[i*8 + 3] = (unsigned char) in[i*8 + 3] + 4; + out[i*8 + 4] = (unsigned char) in[i*8 + 4] + 5; + out[i*8 + 5] = (unsigned char) in[i*8 + 5] + 6; + out[i*8 + 6] = (unsigned char) in[i*8 + 6] + 7; + out[i*8 + 7] = (unsigned char) in[i*8 + 7] + 8; + } + + /* check results: */ + for (i = 0; i < N; i++) + { + if (out[i*8] != (unsigned char) in[i*8] + 1 + || out[i*8 + 1] != (unsigned char) in[i*8 + 1] + 2 + || out[i*8 + 2] != (unsigned char) in[i*8 + 2] + 3 + || out[i*8 + 3] != (unsigned char) in[i*8 + 3] + 4 + || out[i*8 + 4] != (unsigned char) in[i*8 + 4] + 5 + || out[i*8 + 5] != (unsigned char) in[i*8 + 5] + 6 + || out[i*8 + 6] != (unsigned char) in[i*8 + 6] + 7 + || out[i*8 + 7] != (unsigned char) in[i*8 + 7] + 8) + abort (); + } + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_pack_trunc } } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target vect_pack_trunc } } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/slp-multitypes-7.c b/gcc/testsuite/gcc.dg/vect/slp-multitypes-7.c new file mode 100644 index 00000000000..8021c494650 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/slp-multitypes-7.c @@ -0,0 +1,58 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define N 8 + +char 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}; + +__attribute__ ((noinline)) int +main1 () +{ + int i; + int out[N*8]; + + for (i = 0; i < N; i++) + { + out[i*8] = (int) in[i*8] + 1; + out[i*8 + 1] = (int) in[i*8 + 1] + 2; + out[i*8 + 2] = (int) in[i*8 + 2] + 3; + out[i*8 + 3] = (int) in[i*8 + 3] + 4; + out[i*8 + 4] = (int) in[i*8 + 4] + 5; + out[i*8 + 5] = (int) in[i*8 + 5] + 6; + out[i*8 + 6] = (int) in[i*8 + 6] + 7; + out[i*8 + 7] = (int) in[i*8 + 7] + 8; + } + + /* check results: */ + for (i = 0; i < N; i++) + { + if (out[i*8] != (int) in[i*8] + 1 + || out[i*8 + 1] != (int) in[i*8 + 1] + 2 + || out[i*8 + 2] != (int) in[i*8 + 2] + 3 + || out[i*8 + 3] != (int) in[i*8 + 3] + 4 + || out[i*8 + 4] != (int) in[i*8 + 4] + 5 + || out[i*8 + 5] != (int) in[i*8 + 5] + 6 + || out[i*8 + 6] != (int) in[i*8 + 6] + 7 + || out[i*8 + 7] != (int) in[i*8 + 7] + 8) + abort (); + } + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_unpack } } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target vect_unpack } } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/slp-multitypes-8.c b/gcc/testsuite/gcc.dg/vect/slp-multitypes-8.c new file mode 100644 index 00000000000..3d3340ae83b --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/slp-multitypes-8.c @@ -0,0 +1,46 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define N 8 + +char 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}; + +__attribute__ ((noinline)) int +main1 () +{ + int i; + int out[N*8]; + + for (i = 0; i < N*4; i++) + { + out[i*2] = (int) in[i*2] + 1; + out[i*2 + 1] = (int) in[i*2 + 1] + 2; + } + + /* check results: */ + for (i = 0; i < N*4; i++) + { + if (out[i*2] != (int) in[i*2] + 1 + || out[i*2 + 1] != (int) in[i*2 + 1] + 2) + abort (); + } + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_unpack } } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target vect_unpack } } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/slp-multitypes-9.c b/gcc/testsuite/gcc.dg/vect/slp-multitypes-9.c new file mode 100644 index 00000000000..7d317e2e65f --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/slp-multitypes-9.c @@ -0,0 +1,46 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#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}; + +__attribute__ ((noinline)) int +main1 () +{ + int i; + unsigned char out[N*8]; + + for (i = 0; i < N*4; i++) + { + out[i*2] = (unsigned char) in[i*2] + 1; + out[i*2 + 1] = (unsigned char) in[i*2 + 1] + 2; + } + + /* check results: */ + for (i = 0; i < N*4; i++) + { + if (out[i*2] != (unsigned char) in[i*2] + 1 + || out[i*2 + 1] != (unsigned char) in[i*2 + 1] + 2) + abort (); + } + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_pack_trunc } } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target vect_pack_trunc } } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/slp-perm-1.c b/gcc/testsuite/gcc.dg/vect/slp-perm-1.c new file mode 100644 index 00000000000..410758ce293 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/slp-perm-1.c @@ -0,0 +1,60 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define M00 100 +#define M10 216 +#define M20 23 +#define M01 1322 +#define M11 13 +#define M21 27271 +#define M02 74 +#define M12 191 +#define M22 500 + +#define N 16 + +void foo (unsigned int *__restrict__ pInput, unsigned int *__restrict__ pOutput) +{ + unsigned int i, a, b, c; + + for (i = 0; i < N / 3; i++) + { + a = *pInput++; + b = *pInput++; + c = *pInput++; + + *pOutput++ = M00 * a + M01 * b + M02 * c; + *pOutput++ = M10 * a + M11 * b + M12 * c; + *pOutput++ = M20 * a + M21 * b + M22 * c; + } +} + +int main (int argc, const char* argv[]) +{ + unsigned int input[N], output[N], i; + unsigned int check_results[N] = {1470, 395, 28271, 5958, 1655, 111653, 10446, 2915, 195035, 14934, 4175, 278417, 19422, 5435, 361799, 0}; + + for (i = 0; i < N; i++) + { + input[i] = i%256; + if (input[i] > 200) + abort(); + output[i] = 0; + } + + foo (input, output); + + for (i = 0; i < N; i++) + if (output[i] != check_results[i]) + abort (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_perm } } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target vect_perm } } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/slp-perm-2.c b/gcc/testsuite/gcc.dg/vect/slp-perm-2.c new file mode 100644 index 00000000000..da38a8dd5d6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/slp-perm-2.c @@ -0,0 +1,55 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define M00 100 +#define M10 216 +#define M01 1322 +#define M11 13 +#define M02 74 +#define M12 191 + +#define N 16 + +void foo (unsigned int *__restrict__ pInput, unsigned int *__restrict__ pOutput) +{ + unsigned int i, a, b; + + for (i = 0; i < N / 2; i++) + { + a = *pInput++; + b = *pInput++; + + *pOutput++ = M00 * a + M01 * b; + *pOutput++ = M10 * a + M11 * b; + } +} + +int main (int argc, const char* argv[]) +{ + unsigned int input[N], output[N], i; + unsigned int check_results[N] = {1322, 13, 4166, 471, 7010, 929, 9854, 1387, 12698, 1845, 15542, 2303, 18386, 2761, 21230, 3219}; + + for (i = 0; i < N; i++) + { + input[i] = i%256; + if (input[i] > 200) + abort(); + output[i] = 0; + } + + foo (input, output); + + for (i = 0; i < N; i++) + if (output[i] != check_results[i]) + abort (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_perm } } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target vect_perm } } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/slp-perm-3.c b/gcc/testsuite/gcc.dg/vect/slp-perm-3.c new file mode 100644 index 00000000000..312db31e30c --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/slp-perm-3.c @@ -0,0 +1,70 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define M00 100 +#define M10 216 +#define M20 23 +#define M30 237 +#define M01 1322 +#define M11 13 +#define M21 27271 +#define M31 2280 +#define M02 74 +#define M12 191 +#define M22 500 +#define M32 111 +#define M03 134 +#define M13 117 +#define M23 11 +#define M33 771 + +#define N 16 + +void foo (unsigned int *__restrict__ pInput, unsigned int *__restrict__ pOutput) +{ + unsigned int i, a, b, c, d; + + for (i = 0; i < N / 4; i++) + { + a = *pInput++; + b = *pInput++; + c = *pInput++; + d = *pInput++; + + *pOutput++ = M00 * a + M01 * b + M02 * c + M03 * d; + *pOutput++ = M10 * a + M11 * b + M12 * c + M13 * d; + *pOutput++ = M20 * a + M21 * b + M22 * c + M23 * d; + *pOutput++ = M30 * a + M31 * b + M32 * c + M33 * d; + } +} + +int main (int argc, const char* argv[]) +{ + unsigned int input[N], output[N], i; + unsigned int check_results[N] = {1872, 746, 28304, 4815, 8392, 2894, 139524, 18411, 14912, 5042, 250744, 32007, 21432, 7190, 361964, 45603}; + + for (i = 0; i < N; i++) + { + input[i] = i%256; + if (input[i] > 200) + abort(); + output[i] = 0; + } + + foo (input, output); + + for (i = 0; i < N - N; i++) + if (output[i] != check_results[i]) + abort (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_perm } } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target vect_perm } } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + + diff --git a/gcc/testsuite/gcc.dg/vect/slp-perm-4.c b/gcc/testsuite/gcc.dg/vect/slp-perm-4.c new file mode 100644 index 00000000000..f4db75d000e --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/slp-perm-4.c @@ -0,0 +1,85 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define M00 100 +#define M10 216 +#define M20 23 +#define M30 237 +#define M40 437 + +#define M01 1322 +#define M11 13 +#define M21 27271 +#define M31 2280 +#define M41 284 + +#define M02 74 +#define M12 191 +#define M22 500 +#define M32 111 +#define M42 1114 + +#define M03 134 +#define M13 117 +#define M23 11 +#define M33 771 +#define M43 71 + +#define M04 334 +#define M14 147 +#define M24 115 +#define M34 7716 +#define M44 16 + +#define N 16 + +void foo (unsigned int *__restrict__ pInput, unsigned int *__restrict__ pOutput) +{ + unsigned int i, a, b, c, d, e; + + for (i = 0; i < N / 5; i++) + { + a = *pInput++; + b = *pInput++; + c = *pInput++; + d = *pInput++; + e = *pInput++; + + *pOutput++ = M00 * a + M01 * b + M02 * c + M03 * d + M04 * e; + *pOutput++ = M10 * a + M11 * b + M12 * c + M13 * d + M14 * e; + *pOutput++ = M20 * a + M21 * b + M22 * c + M23 * d + M24 * e; + *pOutput++ = M30 * a + M31 * b + M32 * c + M33 * d + M34 * e; + *pOutput++ = M40 * a + M41 * b + M42 * c + M43 * d + M44 * e; + } +} + +int main (int argc, const char* argv[]) +{ + unsigned int input[N], output[N], i; + unsigned int check_results[N] = {3208, 1334, 28764, 35679, 2789, 13028, 4754, 168364, 91254, 12399, 22848, 8174, 307964, 146829, 22009, 0}; + + for (i = 0; i < N; i++) + { + input[i] = i%256; + if (input[i] > 200) + abort(); + output[i] = 0; + } + + foo (input, output); + + for (i = 0; i < N - N; i++) + if (output[i] != check_results[i]) + abort (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" } } */ +/* { dg-final { scan-tree-dump-times "permutation requires at least three vectors" 1 "vect" { target vect_perm } } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/slp-perm-5.c b/gcc/testsuite/gcc.dg/vect/slp-perm-5.c new file mode 100644 index 00000000000..ca59a5e014b --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/slp-perm-5.c @@ -0,0 +1,77 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define M00 100 +#define M10 216 +#define M20 23 +#define M01 1322 +#define M11 13 +#define M21 27271 +#define M02 74 +#define M12 191 +#define M22 500 + +#define K00 405 +#define K10 112 +#define K01 4322 +#define K11 135 + +#define N 16 + +void foo (int *__restrict__ pInput, int *__restrict__ pOutput, + int *__restrict__ pInput2, int *__restrict__ pOutput2) +{ + int i, a, b, c, d, e; + + for (i = 0; i < N / 3; i++) + { + a = *pInput++; + b = *pInput++; + c = *pInput++; + + d = *pInput2++; + e = *pInput2++; + + *pOutput++ = M00 * a + M01 * b + M02 * c; + *pOutput++ = M10 * a + M11 * b + M12 * c; + *pOutput++ = M20 * a + M21 * b + M22 * c; + + *pOutput2++ = K00 * d + K01 * e; + *pOutput2++ = K10 * d + K11 * e; + } +} + +int main (int argc, const char* argv[]) +{ + int input[N], output[N], i; + int check_results[N] = {1470, 395, 28271, 5958, 1655, 111653, 10446, 2915, 195035, 14934, 4175, 278417, 19422, 5435, 361799, 0}; + int input2[N], output2[N]; + int check_results2[N] = {4322, 135, 13776, 629, 23230, 1123, 32684, 1617, 42138, 2111, 0, 0, 0, 0, 0, 0}; + + for (i = 0; i < N; i++) + { + input[i] = i%256; + input2[i] = i%256; + output[i] = 0; + output2[i] = 0; + if (input[i] > 256) + abort (); + } + + foo (input, output, input2, output2); + + for (i = 0; i < N; i++) + if (output[i] != check_results[i] || output2[i] != check_results2[i]) + abort (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_perm } } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target vect_perm } } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + + diff --git a/gcc/testsuite/gcc.dg/vect/slp-perm-6.c b/gcc/testsuite/gcc.dg/vect/slp-perm-6.c new file mode 100644 index 00000000000..ff9be8aa8e2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/slp-perm-6.c @@ -0,0 +1,77 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define M00 100 +#define M10 216 +#define M20 23 +#define M01 1322 +#define M11 13 +#define M21 27271 +#define M02 74 +#define M12 191 +#define M22 500 + +#define K00 405 +#define K10 112 +#define K01 4322 +#define K11 135 + +#define N 16 + +void foo (int *__restrict__ pInput, int *__restrict__ pOutput, + int *__restrict__ pInput2, int *__restrict__ pOutput2) +{ + int i, a, b, c, d, e; + + for (i = 0; i < N / 3; i++) + { + a = *pInput++; + b = *pInput++; + c = *pInput++; + + d = *pInput2++; + e = *pInput2++; + + *pOutput++ = M00 * a + M01 * b + M02 * c; + *pOutput++ = M10 * a + M11 * b + M12 * c; + *pOutput++ = M20 * a + M21 * b + M22 * c; + + /* Regular SLP - no permutation required. */ + *pOutput2++ = K00 * d; + *pOutput2++ = K10 * e; + } +} + +int main (int argc, const char* argv[]) +{ + int input[N], output[N], i; + int check_results[N] = {1470, 395, 28271, 5958, 1655, 111653, 10446, 2915, 195035, 14934, 4175, 278417, 19422, 5435, 361799, 0}; + int input2[N], output2[N]; + int check_results2[N] = {0, 112, 810, 336, 1620, 560, 2430, 784, 3240, 1008, 0, 0, 0, 0, 0, 0}; + + for (i = 0; i < N; i++) + { + input[i] = i%256; + input2[i] = i%256; + output[i] = 0; + output2[i] = 0; + if (input[i] > 256) + abort (); + } + + foo (input, output, input2, output2); + + for (i = 0; i < N; i++) + if (output[i] != check_results[i] || output2[i] != check_results2[i]) + abort (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_perm } } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target vect_perm } } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/slp-perm-7.c b/gcc/testsuite/gcc.dg/vect/slp-perm-7.c new file mode 100644 index 00000000000..0065407e238 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/slp-perm-7.c @@ -0,0 +1,76 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define M00 100 +#define M10 216 +#define M20 23 +#define M01 1322 +#define M11 13 +#define M21 27271 +#define M02 74 +#define M12 191 +#define M22 500 + +#define K00 405 +#define K10 112 +#define K01 4322 +#define K11 135 + +#define N 16 + +/* SLP with load permutation and loop-based vectorization. */ +void foo (int *__restrict__ pInput, int *__restrict__ pOutput, + int *__restrict__ pInput2, int *__restrict__ pOutput2) +{ + int i, a, b, c, d; + + for (i = 0; i < N / 3; i++) + { + a = *pInput++; + b = *pInput++; + c = *pInput++; + d = *pInput2++; + + *pOutput++ = M00 * a + M01 * b + M02 * c; + *pOutput++ = M10 * a + M11 * b + M12 * c; + *pOutput++ = M20 * a + M21 * b + M22 * c; + + /* Loop-based vectorization. */ + *pOutput2++ = K00 * d; + } +} + +int main (int argc, const char* argv[]) +{ + int input[N], output[N], i; + int check_results[N] = {1470, 395, 28271, 5958, 1655, 111653, 10446, 2915, 195035, 14934, 4175, 278417, 19422, 5435, 361799, 0}; + int input2[N], output2[N]; + int check_results2[N] = {0, 405, 810, 1215, 1620, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + + for (i = 0; i < N; i++) + { + input[i] = i%256; + input2[i] = i%256; + output[i] = 0; + output2[i] = 0; + if (input[i] > 200) + abort (); + } + + foo (input, output, input2, output2); + + for (i = 0; i < N; i++) + if (output[i] != check_results[i] || output2[i] != check_results2[i]) + abort (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_perm } } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target vect_perm } } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + + diff --git a/gcc/testsuite/gcc.dg/vect/slp-perm-8.c b/gcc/testsuite/gcc.dg/vect/slp-perm-8.c new file mode 100644 index 00000000000..8c60d44ed0c --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/slp-perm-8.c @@ -0,0 +1,57 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define N 200 + +void foo (unsigned char *__restrict__ pInput, unsigned char *__restrict__ pOutput) +{ + unsigned char i, a, b, c; + + for (i = 0; i < N / 3; i++) + { + a = *pInput++; + b = *pInput++; + c = *pInput++; + + *pOutput++ = a + b + c + 3; + *pOutput++ = a + b + c + 12; + *pOutput++ = a + b + c + 1; + } +} + +int main (int argc, const char* argv[]) +{ + unsigned char input[N], output[N], i; + unsigned char check_results[N]; + + for (i = 0; i < N; i++) + { + input[i] = i; + output[i] = 0; + if (input[i] > 256) + abort (); + } + + for (i = 0; i < N / 3; i++) + { + check_results[3*i] = 9 * i + 6; + check_results[3*i+1] = 9 * i + 15; + check_results[3*i+2] = 9 * i + 4; + } + + foo (input, output); + + for (i = 0; i < N - (N % 3); i++) + if (output[i] != check_results[i]) + abort (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target vect_perm } } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target vect_perm } } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/slp-perm-9.c b/gcc/testsuite/gcc.dg/vect/slp-perm-9.c new file mode 100644 index 00000000000..964e691cc68 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/slp-perm-9.c @@ -0,0 +1,58 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define N 200 + +void foo (unsigned short *__restrict__ pInput, unsigned short *__restrict__ pOutput) +{ + unsigned short i, a, b, c; + + for (i = 0; i < N / 3; i++) + { + a = *pInput++; + b = *pInput++; + c = *pInput++; + + *pOutput++ = a + b + c + 3; + *pOutput++ = a + b + c + 12; + *pOutput++ = a + b + c + 1; + } +} + +int main (int argc, const char* argv[]) +{ + unsigned short input[N], output[N], i; + unsigned short check_results[N]; + + for (i = 0; i < N; i++) + { + input[i] = i; + output[i] = 0; + if (input[i] > 256) + abort (); + } + + for (i = 0; i < N / 3; i++) + { + check_results[3*i] = 9 * i + 6; + check_results[3*i+1] = 9 * i + 15; + check_results[3*i+2] = 9 * i + 4; + } + + foo (input, output); + + for (i = 0; i < N - (N % 3); i++) + if (output[i] != check_results[i]) + abort (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "permutation requires at least three vectors" 1 "vect" { target vect_perm } } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/slp-widen-mult-s16.c b/gcc/testsuite/gcc.dg/vect/slp-widen-mult-s16.c new file mode 100644 index 00000000000..ebc4b5069b5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/slp-widen-mult-s16.c @@ -0,0 +1,47 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include "tree-vect.h" + +#define N 64 + +short X[N] __attribute__ ((__aligned__(16))); +short Y[N] __attribute__ ((__aligned__(16))); +int result[N]; + +/* short->int widening-mult */ +__attribute__ ((noinline)) int +foo1(int len) { + int i; + + for (i=0; i<len/2; i++) { + result[2*i] = X[2*i] * Y[2*i]; + result[2*i+1] = X[2*i+1] * Y[2*i+1]; + } +} + +int main (void) +{ + int i; + + check_vect (); + + for (i=0; i<N; i++) { + X[i] = i; + Y[i] = 64-i; + } + + foo1 (N); + + for (i=0; i<N; i++) { + if (result[i] != X[i] * Y[i]) + abort (); + } + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_widen_mult_hi_to_si || vect_inpack } } } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { vect_widen_mult_hi_to_si || vect_inpack } } } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/slp-widen-mult-u8.c b/gcc/testsuite/gcc.dg/vect/slp-widen-mult-u8.c new file mode 100644 index 00000000000..16bf5781684 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/slp-widen-mult-u8.c @@ -0,0 +1,49 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include "tree-vect.h" + +#define N 64 + +unsigned char X[N] __attribute__ ((__aligned__(16))); +unsigned char Y[N] __attribute__ ((__aligned__(16))); +unsigned short result[N]; + +/* char->short widening-mult */ +__attribute__ ((noinline)) int +foo1(int len) { + int i; + + for (i=0; i<len/2; i++) { + result[2*i] = X[2*i] * Y[2*i]; + result[2*i+1] = X[2*i+1] * Y[2*i+1]; + } +} + +int main (void) +{ + int i; + + check_vect (); + + for (i=0; i<N; i++) { + X[i] = i; + Y[i] = 64-i; + if (i % 5) + X[i] = i; + } + + foo1 (N); + + for (i=0; i<N; i++) { + if (result[i] != X[i] * Y[i]) + abort (); + } + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_widen_mult_qi_to_hi || vect_unpack } } } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { vect_widen_mult_hi_to_si || vect_unpack } } } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + 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-fold-1.c b/gcc/testsuite/gcc.dg/vect/vect-fold-1.c index 88b68b7cf4a..8aca1e42063 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-fold-1.c +++ b/gcc/testsuite/gcc.dg/vect/vect-fold-1.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-dom1" } */ +/* { dg-options "-O2 -fdump-tree-ccp1" } */ typedef unsigned char v4qi __attribute__ ((vector_size (4))); @@ -12,5 +12,5 @@ void foo() c = a + b; } -/* { dg-final { scan-tree-dump-times "c = { 6, 8, 10, 12 }" 1 "dom1" } } */ -/* { dg-final { cleanup-tree-dump "dom1" } } */ +/* { dg-final { scan-tree-dump-times "c =.* { 6, 8, 10, 12 }" 1 "ccp1" } } */ +/* { dg-final { cleanup-tree-dump "ccp1" } } */ 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-16.c b/gcc/testsuite/gcc.dg/vect/vect-multitypes-16.c new file mode 100644 index 00000000000..b5347ebecc3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-multitypes-16.c @@ -0,0 +1,46 @@ +/* { dg-require-effective-target vect_long_long } */ + +#include <stdarg.h> +#include "tree-vect.h" + +#define N 64 + +char x[N] __attribute__ ((__aligned__(16))); + +__attribute__ ((noinline)) int +foo (int len, long long *z) { + int i; + + for (i=0; i<len; i++) { + z[i] = x[i]; + } +} + + +int main (void) +{ + char i; + long long z[N+4]; + + check_vect (); + + for (i=0; i<N; i++) { + x[i] = i; + if (i % 5) + x[i] = i; + } + + foo (N,z+2); + + for (i=0; i<N; i++) { + if (z[i+2] != x[i]) + abort (); + } + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_unpack } } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" { target { ! vect_unpack } } } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/vect-multitypes-17.c b/gcc/testsuite/gcc.dg/vect/vect-multitypes-17.c new file mode 100644 index 00000000000..61670e6995e --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-multitypes-17.c @@ -0,0 +1,52 @@ +/* { dg-require-effective-target vect_long_long } */ + +#include <stdarg.h> +#include "tree-vect.h" + +#define N 64 + +unsigned char uX[N] __attribute__ ((__aligned__(16))); +unsigned char uresultX[N]; +unsigned long long uY[N] __attribute__ ((__aligned__(16))); +unsigned char uresultY[N]; + +/* Unsigned type demotion (si->qi) */ + +__attribute__ ((noinline)) int +foo1(int len) { + int i; + + for (i=0; i<len; i++) { + uresultX[i] = uX[i]; + uresultY[i] = (unsigned char)uY[i]; + } +} + +int main (void) +{ + int i; + + check_vect (); + + for (i=0; i<N; i++) { + uX[i] = 16-i; + uY[i] = 16-i; + if (i%5 == 0) + uX[i] = 16-i; + } + + foo1 (N); + + for (i=0; i<N; i++) { + if (uresultX[i] != uX[i]) + abort (); + if (uresultY[i] != (unsigned char)uY[i]) + abort (); + } + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_pack_trunc } } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + 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; |