Commit 134dc576 by Michael Zolotukhin Committed by H.J. Lu

Increase array sizes in vect-tests to enable 256-bit vectorization

2011-12-02  Michael Zolotukhin  <michael.v.zolotukhin@intel.com>

	* gcc.dg/vect/slp-13.c: Increase array size, add initialization.
	* gcc.dg/vect/slp-24.c: Ditto.
	* gcc.dg/vect/slp-3.c: Likewise and fix scans.
	* gcc.dg/vect/slp-34.c: Ditto.
	* gcc.dg/vect/slp-4.c: Ditto.
	* gcc.dg/vect/slp-cond-2.c: Ditto.
	* gcc.dg/vect/slp-multitypes-11.c: Ditto.
	* gcc.dg/vect/vect-1.c: Ditto.
	* gcc.dg/vect/vect-10.c: Ditto.
	* gcc.dg/vect/vect-105.c: Ditto.
	* gcc.dg/vect/vect-112.c: Ditto.
	* gcc.dg/vect/vect-15.c: Ditto.
	* gcc.dg/vect/vect-2.c: Ditto.
	* gcc.dg/vect/vect-31.c: Ditto.
	* gcc.dg/vect/vect-32.c: Ditto.
	* gcc.dg/vect/vect-33.c: Ditto.
	* gcc.dg/vect/vect-34.c: Ditto.
	* gcc.dg/vect/vect-35.c: Ditto.
	* gcc.dg/vect/vect-36.c: Ditto.
	* gcc.dg/vect/vect-6.c: Ditto.
	* gcc.dg/vect/vect-73.c: Ditto.
	* gcc.dg/vect/vect-74.c: Ditto.
	* gcc.dg/vect/vect-75.c: Ditto.
	* gcc.dg/vect/vect-76.c: Ditto.
	* gcc.dg/vect/vect-80.c: Ditto.
	* gcc.dg/vect/vect-85.c: Ditto.
	* gcc.dg/vect/vect-89.c: Ditto.
	* gcc.dg/vect/vect-97.c: Ditto.
	* gcc.dg/vect/vect-98.c: Ditto.
	* gcc.dg/vect/vect-all.c: Ditto.
	* gcc.dg/vect/vect-double-reduc-6.c: Ditto.
	* gcc.dg/vect/vect-iv-8.c: Ditto.
	* gcc.dg/vect/vect-iv-8a.c: Ditto.
	* gcc.dg/vect/vect-outer-1.c: Ditto.
	* gcc.dg/vect/vect-outer-1a.c: Ditto.
	* gcc.dg/vect/vect-outer-1b.c: Ditto.
	* gcc.dg/vect/vect-outer-2.c: Ditto.
	* gcc.dg/vect/vect-outer-2a.c: Ditto.
	* gcc.dg/vect/vect-outer-2c.c: Ditto.
	* gcc.dg/vect/vect-outer-3.c: Ditto.
	* gcc.dg/vect/vect-outer-3a.c: Ditto.
	* gcc.dg/vect/vect-outer-4a.c: Ditto.
	* gcc.dg/vect/vect-outer-4b.c: Ditto.
	* gcc.dg/vect/vect-outer-4c.c: Ditto.
	* gcc.dg/vect/vect-outer-4d.c: Ditto.
	* gcc.dg/vect/vect-outer-4m.c: Ditto.
	* gcc.dg/vect/vect-outer-fir-lb.c: Ditto.
	* gcc.dg/vect/vect-outer-fir.c: Ditto.
	* gcc.dg/vect/vect-over-widen-1.c: Ditto.
	* gcc.dg/vect/vect-over-widen-2.c: Ditto.
	* gcc.dg/vect/vect-over-widen-3.c: Ditto.
	* gcc.dg/vect/vect-over-widen-4.c: Ditto.
	* gcc.dg/vect/vect-reduc-1char.c: Ditto.
	* gcc.dg/vect/vect-reduc-2char.c: Ditto.
	* gcc.dg/vect/vect-reduc-pattern-1b.c: Ditto.
	* gcc.dg/vect/vect-reduc-pattern-1c.c: Ditto.
	* gcc.dg/vect/vect-reduc-pattern-2b.c: Ditto.
	* gcc.dg/vect/vect-shift-2.c: Ditto.
	* gcc.dg/vect/vect-strided-a-u8-i8-gap2.c: Ditto.
	* gcc.dg/vect/vect-strided-a-u8-i8-gap7.c: Ditto.
	* gcc.dg/vect/vect-strided-u8-i8-gap2.c: Ditto.
	* gcc.dg/vect/vect-strided-u8-i8-gap4.c: Ditto.
	* gcc.dg/vect/vect-strided-u8-i8-gap7.c: Ditto.

From-SVN: r181939
parent 506cf9aa
2011-12-02 Michael Zolotukhin <michael.v.zolotukhin@intel.com>
* gcc.dg/vect/slp-13.c: Increase array size, add initialization.
* gcc.dg/vect/slp-24.c: Ditto.
* gcc.dg/vect/slp-3.c: Likewise and fix scans.
* gcc.dg/vect/slp-34.c: Ditto.
* gcc.dg/vect/slp-4.c: Ditto.
* gcc.dg/vect/slp-cond-2.c: Ditto.
* gcc.dg/vect/slp-multitypes-11.c: Ditto.
* gcc.dg/vect/vect-1.c: Ditto.
* gcc.dg/vect/vect-10.c: Ditto.
* gcc.dg/vect/vect-105.c: Ditto.
* gcc.dg/vect/vect-112.c: Ditto.
* gcc.dg/vect/vect-15.c: Ditto.
* gcc.dg/vect/vect-2.c: Ditto.
* gcc.dg/vect/vect-31.c: Ditto.
* gcc.dg/vect/vect-32.c: Ditto.
* gcc.dg/vect/vect-33.c: Ditto.
* gcc.dg/vect/vect-34.c: Ditto.
* gcc.dg/vect/vect-35.c: Ditto.
* gcc.dg/vect/vect-36.c: Ditto.
* gcc.dg/vect/vect-6.c: Ditto.
* gcc.dg/vect/vect-73.c: Ditto.
* gcc.dg/vect/vect-74.c: Ditto.
* gcc.dg/vect/vect-75.c: Ditto.
* gcc.dg/vect/vect-76.c: Ditto.
* gcc.dg/vect/vect-80.c: Ditto.
* gcc.dg/vect/vect-85.c: Ditto.
* gcc.dg/vect/vect-89.c: Ditto.
* gcc.dg/vect/vect-97.c: Ditto.
* gcc.dg/vect/vect-98.c: Ditto.
* gcc.dg/vect/vect-all.c: Ditto.
* gcc.dg/vect/vect-double-reduc-6.c: Ditto.
* gcc.dg/vect/vect-iv-8.c: Ditto.
* gcc.dg/vect/vect-iv-8a.c: Ditto.
* gcc.dg/vect/vect-outer-1.c: Ditto.
* gcc.dg/vect/vect-outer-1a.c: Ditto.
* gcc.dg/vect/vect-outer-1b.c: Ditto.
* gcc.dg/vect/vect-outer-2.c: Ditto.
* gcc.dg/vect/vect-outer-2a.c: Ditto.
* gcc.dg/vect/vect-outer-2c.c: Ditto.
* gcc.dg/vect/vect-outer-3.c: Ditto.
* gcc.dg/vect/vect-outer-3a.c: Ditto.
* gcc.dg/vect/vect-outer-4a.c: Ditto.
* gcc.dg/vect/vect-outer-4b.c: Ditto.
* gcc.dg/vect/vect-outer-4c.c: Ditto.
* gcc.dg/vect/vect-outer-4d.c: Ditto.
* gcc.dg/vect/vect-outer-4m.c: Ditto.
* gcc.dg/vect/vect-outer-fir-lb.c: Ditto.
* gcc.dg/vect/vect-outer-fir.c: Ditto.
* gcc.dg/vect/vect-over-widen-1.c: Ditto.
* gcc.dg/vect/vect-over-widen-2.c: Ditto.
* gcc.dg/vect/vect-over-widen-3.c: Ditto.
* gcc.dg/vect/vect-over-widen-4.c: Ditto.
* gcc.dg/vect/vect-reduc-1char.c: Ditto.
* gcc.dg/vect/vect-reduc-2char.c: Ditto.
* gcc.dg/vect/vect-reduc-pattern-1b.c: Ditto.
* gcc.dg/vect/vect-reduc-pattern-1c.c: Ditto.
* gcc.dg/vect/vect-reduc-pattern-2b.c: Ditto.
* gcc.dg/vect/vect-shift-2.c: Ditto.
* gcc.dg/vect/vect-strided-a-u8-i8-gap2.c: Ditto.
* gcc.dg/vect/vect-strided-a-u8-i8-gap7.c: Ditto.
* gcc.dg/vect/vect-strided-u8-i8-gap2.c: Ditto.
* gcc.dg/vect/vect-strided-u8-i8-gap4.c: Ditto.
* gcc.dg/vect/vect-strided-u8-i8-gap7.c: Ditto.
2011-12-02 Georg-Johann Lay <avr@gjlay.de>
* gcc.c-torture/execute/vector-subscript-1.c (main): Fix
......
......@@ -3,17 +3,25 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 8
#define N 64
volatile int y = 0;
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 short in[N*8];
unsigned int in2[N*8];
unsigned int out2[N*8];
for (i = 0; i < N*8; i++)
{
in[i] = in2[i] = i;
if (y) /* Avoid vectorization. */
abort ();
}
/* Induction is not SLPable yet. */
for (i = 0; i < N; i++)
{
......
......@@ -3,8 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
#define DIFF 242
#define N 64
typedef struct {
unsigned char a;
......@@ -13,8 +12,11 @@ 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};
unsigned char ub[N*2];
unsigned char uc[N];
volatile int y = 0;
unsigned char check_diff = 2;
void
main1 (unsigned char x, unsigned char max_result, unsigned char min_result, s *arr)
......@@ -28,7 +30,7 @@ main1 (unsigned char x, unsigned char max_result, unsigned char min_result, s *a
s out[N];
for (i = 0; i < N; i++) {
udiff += (unsigned char)(ub[i] - uc[i]);
udiff += (unsigned char) (ub[i] - uc[i]);
ua1[2*i+1] = ub[2*i+1];
ua1[2*i] = ub[2*i];
......@@ -52,7 +54,7 @@ main1 (unsigned char x, unsigned char max_result, unsigned char min_result, s *a
}
/* check results: */
if (udiff != DIFF)
if (udiff != check_diff)
abort ();
}
......@@ -61,6 +63,21 @@ int main (void)
int i;
s arr[N];
check_diff = 2;
ub[0] = uc[0] = 1;
for (i = 1; i < N; i++) {
ub[i] = (i%5 == 0)?i*3:i;
uc[i] = i;
check_diff += (unsigned char) (ub[i] - uc[i]);
if (y) /* Avoid vectorization. */
abort ();
}
for (; i < 2*N; i++) {
ub[i] = 0;
if (y) /* Avoid vectorization. */
abort ();
}
for (i = 0; i < N; i++)
{
arr[i].a = i + 9;
......
......@@ -3,9 +3,10 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 12
#define N 96
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,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 in[N*8];
volatile int y = 0;
int
main1 ()
......@@ -13,6 +14,13 @@ main1 ()
int i;
unsigned short out[N*8];
for (i = 0; i < N*8; i++)
{
in[i] = i&63;
if (y) /* Avoid vectorization. */
abort ();
}
for (i = 0; i < N; i++)
{
out[i*8] = in[i*8];
......@@ -141,7 +149,7 @@ int main (void)
return 0;
}
/* { 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 { scan-tree-dump-times "vectorized 4 loops" 1 "vect" } } */
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
......@@ -3,10 +3,11 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 8
#define N 64
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 in[N*8];
unsigned short in2[N*8];
volatile int y = 0;
int
main1 ()
......@@ -15,6 +16,13 @@ main1 ()
unsigned short out[N*8];
unsigned short out2[N*8];
for (i = 0; i < N*8; i++)
{
in[i] = in2[i] = i;
if (y) /* Avoid vectorization. */
abort ();
}
/* SLP with unrolling by 8. */
for (i = 0; i < N; i++)
{
......
......@@ -3,16 +3,24 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
#define N 128
volatile int y = 0;
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,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 in[N*8];
unsigned int ia[N*2];
for (i = 0; i < N*8; i++)
{
in[i] = i;
if (y) /* Avoid vectorization. */
abort ();
}
for (i = 0; i < N; i++)
{
out[i*8] = in[i*8];
......
/* { dg-require-effective-target vect_cond_mixed } */
#include "tree-vect.h"
#define N 32
#define N 128
int d[N], e[N], f[N];
unsigned char k[N];
float a[N], b[N];
......
......@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 18
#define N 144
struct s
{
......@@ -12,7 +12,8 @@ struct s
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};
char in[N*3];
volatile int y = 0;
__attribute__ ((noinline)) int
main1 ()
......@@ -22,6 +23,13 @@ main1 ()
for (i = 0; i < N; i++)
{
in[i] = i&127;
if (y) /* Avoid vectorization. */
abort ();
}
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;
......
......@@ -2,7 +2,7 @@
/* { dg-require-effective-target vect_int } */
/* { dg-require-effective-target vect_float } */
#define N 16
#define N 128
void fbar (float *);
void ibar (int *);
......
/* { dg-do compile } */
/* { dg-require-effective-target vect_int } */
#include <stdlib.h>
#define N 16
#define N 128
short a[N];
short d[N];
volatile int y = 0;
int foo ()
{
int i;
short b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
short c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
short b[N];
short c[N];
for (i = 0; i < N/2; i++)
{
b[i] = i*3;
c[i] = i;
/* Avoid vectorization. */
if (y)
abort ();
}
/* Strided access pattern. */
for (i = 0; i < N/2; i++)
......
......@@ -4,7 +4,7 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 4
#define N 16
struct extraction
{
......@@ -12,17 +12,51 @@ struct extraction
int b[N][N];
};
static int a[N][N] = {{1,2,3,11},{4,5,6,12},{7,8,9,13},{34,45,67,83}};
static int b[N][N] = {{17,28,15,23},{0,2,3,24},{4,31,82,25},{29,31,432,256}};
static int c[N][N] = {{1,2,3,11},{4,9,13,34},{45,67,83,13},{34,45,67,83}};
static int a[N][N];
static int b[N][N];
static int c[N][N];
volatile int y;
__attribute__ ((noinline))
int main1 (int x) {
int i,j;
int i,j, off;
struct extraction *p;
p = (struct extraction *) malloc (sizeof (struct extraction));
for (i = 0; i < N; i++)
{
for (j = 0; j < N; j++)
{
a[i][j] = (i*7 + j*17)%53;
b[i][j] = (i*11+ j*13)%41;
if (y)
abort (); /* to avoid vectorization. */
}
}
for (i = 0; i < N; i++)
{
for (j = 0; j < N; j++)
{
c[i][j] = a[i][j];
if (y)
abort (); /* to avoid vectorization. */
}
}
for (i = 1; i < N; i++)
{
for (j = 0; j < N; j++)
{
off = x + i + j + N+1;
if (x + i + j > N*N-1)
break;
if (off > N*N-1)
*(&c[0][0]+x+i+j) = *(&b[0][0] + off - N*N);
else
*(&c[0][0]+x+i+j) = *(&a[0][0] + off);
if (y)
abort (); /* to avoid vectorization. */
}
}
for (i = 0; i < N; i++)
{
......@@ -33,7 +67,7 @@ int main1 (int x) {
/* Because Y is volatile, the compiler cannot move this check out
of the loop. */
if (y)
abort (); /* to avoid vectorization */
abort (); /* to avoid vectorization. */
}
}
......@@ -42,7 +76,7 @@ int main1 (int x) {
{
for (j = 0; j < N; j++)
{
*((int *)p + x + i + j) = *((int *)p + x + i + j + 5);
*((int *)p + x + i + j) = *((int *)p + x + i + j + N+1);
}
}
......@@ -52,7 +86,7 @@ int main1 (int x) {
for (j = 0; j < N; j++)
{
if (p->a[i][j] != c[i][j])
abort();
abort ();
}
}
return 0;
......@@ -66,7 +100,7 @@ int main (void)
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 2 "vect" { target vect_no_align } } } */
/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 2 "vect" { target vect_no_align } } } */
/* { dg-final { scan-tree-dump-times "possible dependence between data-refs" 0 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
......@@ -3,16 +3,27 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
#define N 128
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};
char cb[N];
char cc[N];
volatile int y = 0;
__attribute__ ((noinline)) int
main1 (void)
{
int i;
int diff = 0;
int check_diff = 0;
for (i = 0; i < N; i++) {
cb[i] = i + 2;
cc[i] = i + 1;
check_diff += (cb[i] - cc[i]);
/* Avoid vectorization. */
if (y)
abort ();
}
/* Cross-iteration cycle. */
diff = 0;
......@@ -21,8 +32,8 @@ main1 (void)
}
/* Check results. */
if (diff != 16)
abort();
if (diff != check_diff)
abort ();
return 0;
}
......
......@@ -3,14 +3,23 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
#define N 128
volatile int y = 0;
__attribute__ ((noinline))
int main1 ()
{
int i;
int a[N];
int b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
int b[N];
for (i = 0; i <N; i++)
{
b[i] = i*3;
if (y)
abort ();
}
/* Not vectorizable yet (reverse access and forward access). */
for (i = N; i > 0; i--)
......
......@@ -3,11 +3,13 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
#define N 128
char cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
char cb[N];
char ca[N];
volatile int y = 0;
__attribute__ ((noinline))
int main1 ()
{
......@@ -15,6 +17,14 @@ int main1 ()
for (i = 0; i < N; i++)
{
cb[i] = i*3;
/* To avoid vectorization. */
if (y)
abort ();
}
for (i = 0; i < N; i++)
{
ca[i] = cb[i];
}
......
......@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 32
#define N 256
struct t{
int k[N];
......
......@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
#define N 128
__attribute__ ((noinline))
int main1 ()
......
......@@ -4,7 +4,7 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
#define N 128
struct test {
char ca[N];
};
......
......@@ -3,13 +3,15 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
#define N 128
struct {
char ca[N];
} s;
char cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
char cb[N];
volatile int y = 0;
__attribute__ ((noinline))
int main1 ()
{
......@@ -17,6 +19,13 @@ int main1 ()
for (i = 0; i < N; i++)
{
cb[i] = i*3;
/* To avoid vectorization. */
if (y)
abort ();
}
for (i = 0; i < N; i++)
{
s.ca[i] = cb[i];
}
......
......@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
#define N 128
__attribute__ ((noinline))
int main1 ()
......
......@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
#define N 128
__attribute__ ((noinline))
int main1 ()
......
......@@ -3,20 +3,41 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
#define N 128
float results1[N] = {192.00,240.00,288.00,336.00,384.00,432.00,480.00,528.00,0.00};
float results2[N] = {0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,54.00,120.00,198.00,288.00,390.00,504.00,630.00};
float results1[N];
float results2[N];
float a[N] = {0};
float e[N] = {0};
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 b[N];
float c[N];
volatile int y = 0;
__attribute__ ((noinline))
int main1 ()
{
int i;
for (i=0; i<N; i++)
{
b[i] = i*3;
c[i] = i;
results1[i] = 0;
results2[i] = 0;
/* Avoid vectorization. */
if (y)
abort ();
}
for (i=0; i<N/2; i++)
{
results1[i] = b[i+N/2] * c[i+N/2] - b[i] * c[i];
results2[i+N/2] = b[i] * c[i+N/2] + b[i+N/2] * c[i];
/* Avoid vectorization. */
if (y)
abort ();
}
for (i = 0; i < N/2; i++)
{
a[i] = b[i+N/2] * c[i+N/2] - b[i] * c[i];
......
......@@ -3,13 +3,15 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
#define N 128
int ic[N*2];
int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
int ib[N];
#define ia (ic+N)
volatile int y = 0;
__attribute__ ((noinline))
int main1 ()
{
......@@ -17,6 +19,13 @@ int main1 ()
for (i = 0; i < N; i++)
{
ib[i] = i*3;
if (y)
abort ();
}
for (i = 0; i < N; i++)
{
ia[i] = ib[i];
}
......@@ -24,7 +33,7 @@ int main1 ()
for (i = 0; i < N; i++)
{
if (ia[i] != ib[i])
abort();
abort ();
}
return 0;
......
......@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
#define N 128
/* Check handling of accesses for which the "initial condition" -
the expression that represents the first location accessed - is
......@@ -13,6 +13,8 @@ float a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
float b[N+4] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 7.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0};
float c[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 7.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5};
volatile int y = 0;
__attribute__ ((noinline)) int
main1 (float *__restrict__ pa, float * __restrict__ pb, float * __restrict__ pc)
{
......@@ -21,13 +23,27 @@ main1 (float *__restrict__ pa, float * __restrict__ pb, float * __restrict__ pc
for (i = 0; i < N; i++)
{
b[i] = i;
c[i] = 0.5 + i;
if (y)
abort ();
}
for (; i < N+4; i++)
{
b[i] = i;
if (y)
abort ();
}
for (i = 0; i < N; i++)
{
pa[i] = q[i] * pc[i];
}
for (i = 0; i < N; i++)
{
if (pa[i] != q[i] * pc[i])
abort();
abort ();
}
return 0;
......
......@@ -3,14 +3,16 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 8
#define N 120
#define OFF 8
/* Check handling of accesses for which the "initial condition" -
the expression that represents the first location accessed - is
more involved than just an ssa_name. */
int ib[N+OFF] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10, 14, 22, 26, 34};
int ib[N+OFF] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0, 1, 3, 5, 7, 11, 13, 17};
volatile int y = 0;
__attribute__ ((noinline))
int main1 (int *ib)
......@@ -18,6 +20,12 @@ int main1 (int *ib)
int i;
int ia[N];
for (i = OFF; i < N+OFF; i++)
{
ib[i] = ib[i%OFF]*(i/OFF);
if (y)
abort ();
}
for (i = 0; i < N; i++)
{
ia[i] = ib[i+OFF];
......
......@@ -3,21 +3,30 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 24
#define N 124
#define OFF 4
/* Check handling of accesses for which the "initial condition" -
the expression that represents the first location accessed - is
more involved than just an ssa_name. */
int ib[N+OFF] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {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 ib[N+OFF] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0, 1, 3, 5, 7, 11, 13, 17};
int ic[N+OFF] = {0, 1, 3, 5, 7, 11, 13, 17};
volatile int y = 0;
__attribute__ ((noinline))
int main1 (int *pib)
{
int i;
int ia[N+OFF];
for (i = OFF; i < N+OFF; i++)
{
ib[i] = ib[i%8]*(i/8);
ic[i] = ic[i%8]*(i/8);
if (y)
abort ();
}
for (i = OFF; i < N; i++)
{
......
......@@ -3,21 +3,36 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
#define N 128
float fa[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
float fb[N+4] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 7.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0};
float fc[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 7.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5};
float fb[N+4] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
float fc[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
/* Check handling of accesses for which the "initial condition" -
the expression that represents the first location accessed - is
more involved than just an ssa_name. */
volatile int y = 0;
__attribute__ ((noinline)) int
main1 (float * __restrict__ pa, float * __restrict__ pb, float *__restrict__ pc)
{
int i;
float *q = pb + 4;
for (i = 0; i < N; i++)
{
fb[i] = i;
fc[i] = 0.5+i;
if (y)
abort ();
}
for (; i < N+4; i++)
{
fb[i] = i;
if (y)
abort ();
}
for (i = 0; i < N; i++)
{
......
......@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
#define N 128
__attribute__ ((noinline))
int main1 (int *a)
......
......@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
#define N 128
struct tmp_struct
{
......
......@@ -3,10 +3,12 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
#define N 128
char x[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
char cb[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
char cb[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
volatile int y = 0;
__attribute__ ((noinline))
int main1 ()
......@@ -16,6 +18,12 @@ int main1 ()
char *q;
} s;
int i;
for (i = 0; i < N; i++)
{
cb[i] = i*3;
if (y)
abort ();
}
/* 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
......
......@@ -3,8 +3,13 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 4
#define DOT4( a, b ) ( a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3] )
#define N 16
#define DOT16( a, b) ( a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + \
a[4]*b[4] + a[5]*b[5] + a[6]*b[6] + a[7]*b[7] + \
a[8]*b[8] + a[9]*b[9] + a[10]*b[10] + a[11]*b[11] + \
a[12]*b[12] + a[13]*b[13] + a[14]*b[14] + a[15]*b[15])
volatile int y = 0;
__attribute__ ((noinline))
int main1 (int ia[][N])
......@@ -15,14 +20,14 @@ int main1 (int ia[][N])
for (i = 0; i < N; i++)
{
ic[0][i] = DOT4 (ia[i], ib);
ic[0][i] = DOT16 (ia[i], ib);
}
/* check results: */
for (i = 0; i < N; i++)
{
if (ic[0][i] != DOT4 (ia[i], ib))
abort();
if (ic[0][i] != DOT16 (ia[i], ib))
abort ();
}
return 0;
......@@ -30,7 +35,16 @@ int main1 (int ia[][N])
int main (void)
{
int ia[N][N] = {{1,2,3,4},{2,3,5,7},{2,4,6,8},{22,43,55,77}};
int ia[N][N];
int i,j;
for (i = 0; i < N; i++)
for (j = 0; j < N; j++)
{
ia[i][j] = i + j + 1;
/* Avoid vectorization. */
if (y)
abort ();
}
check_vect ();
......
......@@ -4,13 +4,13 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
#define N 128
int iadd_results[N] = {0,6,12,18,24,30,36,42,48,54,60,66,72,78,84,90};
float fadd_results[N] = {0.0,6.0,12.0,18.0,24.0,30.0,36.0,42.0,48.0,54.0,60.0,66.0,72.0,78.0,84.0,90.0};
float fmul_results[N] = {0.0,3.0,12.0,27.0,48.0,75.0,108.0,147.0,192.0,243.0,300.0,363.0,432.0,507.0,588.0,675.0};
float fresults1[N] = {192.00,240.00,288.00,336.00,384.00,432.00,480.00,528.00,48.00,54.00,60.00,66.00,72.00,78.00,84.00,90.00};
float fresults2[N] = {0.00,6.00,12.00,18.00,24.00,30.00,36.00,42.00,0.00,54.00,120.00,198.00,288.00,390.00,504.00,630.00};
int iadd_results[N];
float fadd_results[N];
float fmul_results[N];
float fresults1[N];
float fresults2[N];
/****************************************************/
__attribute__ ((noinline))
......@@ -77,12 +77,32 @@ char cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
char ca[N];
short sa[N];
/* All of the loops below are currently vectorizable. */
volatile int y = 0;
/* All of the loops below are currently vectorizable, except
initialization ones. */
__attribute__ ((noinline)) int
main1 ()
{
int i,j;
/* Initialization. */
for (i = 0; i < N; i++)
{
b[i] = i*3;
c[i] = i;
d[i] = i*2;
ic[i] = i*3;
ib[i] = i*3;
cb[i] = i*3;
fadd_results[i] = b[i] + c[i] + d[i];
iadd_results[i] = ib[i] + ic[i];
fmul_results[i] = b[i] * c[i];
fresults1[i] = 0;
fresults2[i] = 0;
if (y)
abort ();
}
/* Test 1: copy chars. */
for (i = 0; i < N; i++)
......@@ -116,7 +136,21 @@ main1 ()
fbar_add (a);
fbar_add (e);
/* Initialization. */
for (i = 0; i < N; i++)
{
fresults1[i] = a[i];
fresults2[i] = e[i];
if (y)
abort ();
}
for (i = 0; i < N/2; i++)
{
fresults1[i] = b[i+N/2] * c[i+N/2] - b[i] * c[i];
fresults2[i+N/2] = b[i] * c[i+N/2] + b[i+N/2] * c[i];
if (y)
abort ();
}
/* Test 4: access with offset. */
for (i = 0; i < N/2; i++)
{
......
......@@ -3,13 +3,15 @@
#include <stdarg.h>
#include "tree-vect.h"
#define K 4
#define K 16
int in[2*K][K] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
int out[K];
int check_result[K] = {0,16,256,4096};
int check_result[K];
__attribute__ ((noinline)) void
volatile int y = 0;
__attribute__ ((noinline)) void
foo ()
{
int sum;
......@@ -18,7 +20,21 @@ foo ()
for (k = 0; k < K; k++)
{
sum = 1;
for (j = 0; j < K; j++)
for (j = 0; j < K; j++)
for (i = 0; i < K; i++)
{
sum *= in[i+k][j];
/* Avoid vectorization. */
if (y)
abort ();
}
check_result[k] = sum;
}
for (k = 0; k < K; k++)
{
sum = 1;
for (j = 0; j < K; j++)
for (i = 0; i < K; i++)
sum *= in[i+k][j];
out[k] = sum;
......@@ -43,7 +59,7 @@ int main ()
return 0;
}
/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
......@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 26
#define N 128
__attribute__ ((noinline)) int main1 (short X)
{
......
......@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 26
#define N 128
__attribute__ ((noinline)) int main1 (short X)
{
......
/* { dg-do compile } */
#define N 64
#define N 256
signed short image[N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
signed short block[N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
signed short out[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
......
/* { dg-do compile } */
#define N 64
#define N 256
signed short image[N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
signed short block[N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
......
/* { dg-do compile } */
#define N 40
#define N 160
signed short image[N][N];
signed short block[N][N];
signed short out[N];
......
......@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 40
#define N 160
float image[N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
float out[N];
......
......@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 40
#define N 160
float image[N][N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
__attribute__ ((noinline)) void
......
......@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 40
#define N 160
float image[2*N][2*N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
__attribute__ ((noinline)) void
......
......@@ -2,7 +2,7 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 40
#define N 320
float image[N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
float out[N];
......
......@@ -2,7 +2,7 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 40
#define N 320
float image[N][N+1] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
float out[N];
......
/* { dg-do compile } */
#define N 40
#define M 128
#define N 512
#define M 1024
signed short in[N+M];
signed short coeff[M];
signed short out[N];
......
/* { dg-do compile } */
#define N 40
#define M 128
#define N 320
#define M 1024
signed short in[N+M];
signed short coeff[M];
int out[N];
......
/* { dg-do compile } */
#define N 40
#define M 128
#define N 320
#define M 1024
unsigned short in[N+M];
unsigned short coeff[M];
unsigned int out[N];
......
......@@ -3,8 +3,8 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 40
#define M 128
#define N 320
#define M 1024
float in[N+M];
float out[N];
......
......@@ -2,8 +2,8 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 40
#define M 128
#define N 320
#define M 1024
unsigned short in[N+M];
unsigned int out[N];
......
......@@ -3,8 +3,8 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 40
#define M 64
#define N 80
#define M 128
float in[N+M];
float coeff[M];
float out[N];
......
......@@ -3,8 +3,8 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 40
#define M 128
#define N 80
#define M 256
float in[N+M];
float coeff[M];
float out[N];
......
......@@ -5,7 +5,7 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 64
#define N 512
/* Modified rgb to rgb conversion from FFmpeg. */
__attribute__ ((noinline)) void
......
......@@ -5,7 +5,7 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 64
#define N 512
/* Modified rgb to rgb conversion from FFmpeg. */
__attribute__ ((noinline)) void
......
......@@ -5,7 +5,7 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 64
#define N 128
/* Modified rgb to rgb conversion from FFmpeg. */
__attribute__ ((noinline)) void
......
......@@ -5,7 +5,7 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 64
#define N 512
/* Modified rgb to rgb conversion from FFmpeg. */
__attribute__ ((noinline)) int
......
......@@ -3,11 +3,13 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
#define DIFF 242
#define N 256
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 ub[N];
unsigned char uc[N];
unsigned char diff;
volatile int y = 0;
__attribute__ ((noinline)) void
main1 (unsigned char x, unsigned char max_result, unsigned char min_result)
......@@ -17,8 +19,26 @@ main1 (unsigned char x, unsigned char max_result, unsigned char min_result)
unsigned char umax = x;
unsigned char umin = x;
diff = 2;
for (i = 0; i < N; i++) {
ub[i] = i;
uc[i] = i;
if (i%16 == 0)
{
ub[i] = i+2;
diff += 2;
}
if (uc[i] > max_result)
max_result = uc[i];
if (uc[i] < min_result)
min_result = uc[i];
/* Avoid vectorization. */
if (y)
abort ();
}
for (i = 0; i < N; i++) {
udiff += (unsigned char)(ub[i] - uc[i]);
udiff += (unsigned char) (ub[i] - uc[i]);
}
for (i = 0; i < N; i++) {
......@@ -30,7 +50,7 @@ main1 (unsigned char x, unsigned char max_result, unsigned char min_result)
}
/* check results: */
if (udiff != DIFF)
if (udiff != diff)
abort ();
if (umax != max_result)
abort ();
......@@ -39,9 +59,9 @@ main1 (unsigned char x, unsigned char max_result, unsigned char min_result)
}
int main (void)
{
{
check_vect ();
main1 (100, 100, 1);
main1 (0, 15, 0);
return 0;
......
......@@ -3,21 +3,40 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
#define DIFF 121
#define N 256
volatile int y = 0;
__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 b[N];
signed char c[N];
signed char check_diff = 2;
signed char diff = 2;
signed char max = x;
signed char min = x;
check_diff = 2;
for (i = 0; i < N; i++) {
diff += (signed char)(b[i] - c[i]);
b[i] = i;
c[i] = i;
if (i%16 == 0)
{
c[i] = i + 1;
check_diff += 1;
}
if (c[i] > max_result)
max_result = c[i];
if (c[i] < min_result)
min_result = c[i];
/* Avoid vectorization. */
if (y)
abort ();
}
for (i = 0; i < N; i++) {
diff += (signed char) (c[i] - b[i]);
}
for (i = 0; i < N; i++) {
......@@ -29,7 +48,7 @@ void main1 (signed char x, signed char max_result, signed char min_result)
}
/* check results: */
if (diff != DIFF)
if (diff != check_diff)
abort ();
if (max != max_result)
abort ();
......@@ -38,9 +57,9 @@ void main1 (signed char x, signed char max_result, signed char min_result)
}
int main (void)
{
{
check_vect ();
main1 (100, 100, 1);
main1 (0, 15, 0);
return 0;
......
......@@ -3,10 +3,11 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
unsigned char udata_ch[N] =
{ 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28 };
#define SUM 210
#define N 128
unsigned char udata_ch[N];
#define SUM N*(N-1)
volatile int y = 0;
__attribute__ ((noinline)) int
foo ()
......@@ -14,6 +15,14 @@ foo ()
int i;
unsigned int intsum = 0;
for (i = 0; i < N; i++)
{
udata_ch[i] = i*2;
/* Avoid vectorization. */
if (y)
abort ();
}
/* widenning sum: sum chars into int. */
for (i = 0; i < N; i++)
{
......
......@@ -3,10 +3,11 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
unsigned char udata_ch[N] =
{ 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28 };
#define SUM 210
#define N 128
unsigned char udata_ch[N];
#define SUM N*(N-1)
volatile int y = 0;
__attribute__ ((noinline)) int
foo ()
......@@ -14,6 +15,14 @@ foo ()
int i;
unsigned short shortsum = 0;
for (i = 0; i < N; i++)
{
udata_ch[i] = i*2;
/* Avoid vectorization. */
if (y)
abort ();
}
/* widenning sum: sum chars into short. */
for (i = 0; i < N; i++)
{
......
......@@ -3,16 +3,26 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
signed char data_ch[N] =
{ 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28 };
#define SUM 210
#define N 128
signed char data_ch[N];
volatile int y = 0;
__attribute__ ((noinline)) int
foo ()
{
int i;
signed int intsum = 0;
signed int check_intsum = 0;
for (i = 0; i < N; i++)
{
data_ch[i] = i*2;
check_intsum += data_ch[i];
/* Avoid vectorization. */
if (y)
abort ();
}
/* widenning sum: sum chars into int. */
for (i = 0; i < N; i++)
......@@ -21,7 +31,7 @@ foo ()
}
/* check results: */
if (intsum != SUM)
if (intsum != check_intsum)
abort ();
return 0;
......
......@@ -157,15 +157,15 @@ NAME (PREFIX, tests) (void) \
NAME (PREFIX, check) (); \
}
VECT_TESTS(uc_, unsigned char, 16)
VECT_TESTS(us_, unsigned short, 32)
VECT_TESTS(ui_, unsigned int, 32)
VECT_TESTS(ul_, unsigned long, 32)
VECT_TESTS(sc_, signed char, 16)
VECT_TESTS(ss_, short, 32)
VECT_TESTS(si_, int, 32)
VECT_TESTS(sl_, long, 32)
VECT_TESTS (uc_, unsigned char, 128)
VECT_TESTS (us_, unsigned short, 256)
VECT_TESTS (ui_, unsigned int, 256)
VECT_TESTS (ul_, unsigned long, 256)
VECT_TESTS (sc_, signed char, 128)
VECT_TESTS (ss_, short, 256)
VECT_TESTS (si_, int, 256)
VECT_TESTS (sl_, long, 256)
int main ()
{
......
......@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
#define N 128
typedef struct {
unsigned char a;
......@@ -22,6 +22,7 @@ main1 ()
int i;
s arr[N];
s *ptr = arr;
s check_res[N];
s res[N];
for (i = 0; i < N; i++)
......@@ -34,6 +35,16 @@ main1 ()
arr[i].f = i * 2 + 2;
arr[i].g = i - 3;
arr[i].h = 56;
check_res[i].c = arr[i].a;
check_res[i].a = arr[i].f + arr[i].a;
check_res[i].d = arr[i].f - arr[i].a;
check_res[i].b = arr[i].f;
check_res[i].f = arr[i].a;
check_res[i].e = arr[i].f - arr[i].a;
check_res[i].h = arr[i].f;
check_res[i].g = arr[i].f - arr[i].a;
if (arr[i].a == 178)
abort();
}
......@@ -45,23 +56,23 @@ main1 ()
res[i].d = ptr->f - ptr->a;
res[i].b = ptr->f;
res[i].f = ptr->a;
res[i].e = ptr->f - ptr->a;
res[i].h = ptr->f;
res[i].e = ptr->f - ptr->a;
res[i].h = ptr->f;
res[i].g = ptr->f - ptr->a;
ptr++;
}
ptr++;
}
/* check results: */
for (i = 0; i < N; i++)
{
if (res[i].c != arr[i].a
|| res[i].a != arr[i].f + arr[i].a
|| res[i].d != arr[i].f - arr[i].a
|| res[i].b != arr[i].f
|| res[i].f != arr[i].a
|| res[i].e != arr[i].f - arr[i].a
|| res[i].h != arr[i].f
|| res[i].g != arr[i].f - arr[i].a)
{
if (res[i].a != check_res[i].a
|| res[i].b != check_res[i].b
|| res[i].c != check_res[i].c
|| res[i].d != check_res[i].d
|| res[i].e != check_res[i].e
|| res[i].f != check_res[i].f
|| res[i].g != check_res[i].g
|| res[i].h != check_res[i].h)
abort();
}
}
......@@ -78,4 +89,4 @@ int main (void)
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_strided8 } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
......@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
#define N 128
typedef struct {
unsigned char a;
......@@ -22,6 +22,7 @@ main1 ()
int i;
s arr[N];
s *ptr = arr;
s check_res[N];
s res[N];
unsigned char u, t, s, x, y, z, w;
......@@ -35,6 +36,20 @@ main1 ()
arr[i].f = i * 5;
arr[i].g = i - 3;
arr[i].h = 67;
u = arr[i].b - arr[i].a;
t = arr[i].d - arr[i].c;
check_res[i].c = u + t;
x = arr[i].b + arr[i].d;
check_res[i].a = arr[i].a + x;
check_res[i].d = u + t;
s = arr[i].h - arr[i].a;
check_res[i].b = s + t;
check_res[i].f = arr[i].f + arr[i].h;
check_res[i].e = arr[i].b + arr[i].e;
check_res[i].h = arr[i].d;
check_res[i].g = u + t;
if (arr[i].a == 178)
abort();
}
......@@ -59,14 +74,14 @@ main1 ()
/* check results: */
for (i = 0; i < N; i++)
{
if (res[i].c != arr[i].b - arr[i].a + arr[i].d - arr[i].c
|| res[i].a != arr[i].a + arr[i].b + arr[i].d
|| res[i].d != arr[i].b - arr[i].a + arr[i].d - arr[i].c
|| res[i].b != arr[i].h - arr[i].a + arr[i].d - arr[i].c
|| res[i].f != arr[i].f + arr[i].h
|| res[i].e != arr[i].b + arr[i].e
|| res[i].h != arr[i].d
|| res[i].g != arr[i].b - arr[i].a + arr[i].d - arr[i].c)
if (res[i].a != check_res[i].a
|| res[i].b != check_res[i].b
|| res[i].c != check_res[i].c
|| res[i].d != check_res[i].d
|| res[i].e != check_res[i].e
|| res[i].f != check_res[i].f
|| res[i].g != check_res[i].g
|| res[i].h != check_res[i].h)
abort();
}
}
......
......@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
#define N 128
typedef struct {
unsigned char a;
......@@ -16,6 +16,8 @@ typedef struct {
unsigned char h;
} s;
s check_res[N];
__attribute__ ((noinline)) int
main1 (s *arr)
{
......@@ -30,24 +32,24 @@ main1 (s *arr)
res[i].d = ptr->f - ptr->b;
res[i].b = ptr->f;
res[i].f = ptr->b;
res[i].e = ptr->f - ptr->b;
res[i].h = ptr->f;
res[i].e = ptr->f - ptr->b;
res[i].h = ptr->f;
res[i].g = ptr->f - ptr->b;
ptr++;
}
ptr++;
}
/* check results: */
for (i = 0; i < N; i++)
{
if (res[i].c != arr[i].b
|| res[i].a != arr[i].f + arr[i].b
|| res[i].d != arr[i].f - arr[i].b
|| res[i].b != arr[i].f
|| res[i].f != arr[i].b
|| res[i].e != arr[i].f - arr[i].b
|| res[i].h != arr[i].f
|| res[i].g != arr[i].f - arr[i].b)
abort();
{
if (res[i].a != check_res[i].a
|| res[i].b != check_res[i].b
|| res[i].c != check_res[i].c
|| res[i].d != check_res[i].d
|| res[i].e != check_res[i].e
|| res[i].f != check_res[i].f
|| res[i].g != check_res[i].g
|| res[i].h != check_res[i].h)
abort ();
}
}
......@@ -56,11 +58,11 @@ int main (void)
{
int i;
s arr[N];
check_vect ();
for (i = 0; i < N; i++)
{
{
arr[i].a = i;
arr[i].b = i * 2;
arr[i].c = 17;
......@@ -69,9 +71,18 @@ int main (void)
arr[i].f = i * 2 + 2;
arr[i].g = i - 3;
arr[i].h = 56;
check_res[i].c = arr[i].b;
check_res[i].a = arr[i].f + arr[i].b;
check_res[i].d = arr[i].f - arr[i].b;
check_res[i].b = arr[i].f;
check_res[i].f = arr[i].b;
check_res[i].e = arr[i].f - arr[i].b;
check_res[i].h = arr[i].f;
check_res[i].g = arr[i].f - arr[i].b;
if (arr[i].a == 178)
abort();
}
abort ();
}
main1 (arr);
......@@ -80,4 +91,4 @@ int main (void)
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_strided8 } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
......@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
#define N 128
typedef struct {
unsigned char a;
......@@ -16,6 +16,8 @@ typedef struct {
unsigned char h;
} s;
s check_res[N];
__attribute__ ((noinline)) int
main1 (s *arr)
{
......@@ -32,39 +34,39 @@ main1 (s *arr)
res[i].d = ptr->b + ptr->c;
res[i].b = ptr->c;
res[i].f = ptr->f + ptr->e;
res[i].e = ptr->b + ptr->e;
res[i].h = ptr->c;
res[i].e = ptr->b + ptr->e;
res[i].h = ptr->c;
res[i].g = ptr->b + ptr->c;
ptr++;
}
ptr++;
}
/* check results: */
for (i = 0; i < N; i++)
{
if (res[i].c != arr[i].b + arr[i].c
|| res[i].a != arr[i].c + arr[i].f + arr[i].b
|| res[i].d != arr[i].b + arr[i].c
|| res[i].b != arr[i].c
|| res[i].f != arr[i].f + arr[i].e
|| res[i].e != arr[i].b + arr[i].e
|| res[i].h != arr[i].c
|| res[i].g != arr[i].b + arr[i].c)
{
if (res[i].a != check_res[i].a
|| res[i].b != check_res[i].b
|| res[i].c != check_res[i].c
|| res[i].d != check_res[i].d
|| res[i].e != check_res[i].e
|| res[i].f != check_res[i].f
|| res[i].g != check_res[i].g
|| res[i].h != check_res[i].h)
abort ();
}
ptr = arr;
/* Not vectorizable: gap in store. */
for (i = 0; i < N; i++)
{
{
res[i].a = ptr->b;
res[i].b = ptr->c;
ptr++;
ptr++;
}
/* Check results. */
for (i = 0; i < N; i++)
{
if (res[i].a != arr[i].b
if (res[i].a != arr[i].b
|| res[i].b != arr[i].c)
abort ();
}
......@@ -76,11 +78,12 @@ int main (void)
{
int i;
s arr[N];
unsigned char x;
check_vect ();
for (i = 0; i < N; i++)
{
{
arr[i].a = i;
arr[i].b = i * 2;
arr[i].c = 17;
......@@ -89,10 +92,20 @@ int main (void)
arr[i].f = i * 5;
arr[i].g = i - 3;
arr[i].h = 56;
if (arr[i].a == 178)
abort();
}
check_res[i].c = arr[i].b + arr[i].c;
x = arr[i].c + arr[i].f;
check_res[i].a = x + arr[i].b;
check_res[i].d = arr[i].b + arr[i].c;
check_res[i].b = arr[i].c;
check_res[i].f = arr[i].f + arr[i].e;
check_res[i].e = arr[i].b + arr[i].e;
check_res[i].h = arr[i].c;
check_res[i].g = arr[i].b + arr[i].c;
if (arr[i].a == 178)
abort ();
}
main1 (arr);
return 0;
......@@ -100,4 +113,4 @@ int main (void)
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_strided8 } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
......@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
#define N 128
typedef struct {
unsigned char a;
......@@ -16,6 +16,8 @@ typedef struct {
unsigned char h;
} s;
s check_res[N];
__attribute__ ((noinline)) int
main1 (s *arr)
{
......@@ -44,14 +46,14 @@ main1 (s *arr)
/* check results: */
for (i = 0; i < N; i++)
{
if (res[i].c != arr[i].b - arr[i].a + arr[i].d - arr[i].c
|| res[i].a != arr[i].a + arr[i].b + arr[i].d
|| res[i].d != arr[i].b - arr[i].a + arr[i].d - arr[i].c
|| res[i].b != arr[i].h - arr[i].a + arr[i].d - arr[i].c
|| res[i].f != arr[i].f + arr[i].h
|| res[i].e != arr[i].b + arr[i].e
|| res[i].h != arr[i].d
|| res[i].g != arr[i].b - arr[i].a + arr[i].d - arr[i].c)
if (res[i].a != check_res[i].a
|| res[i].b != check_res[i].b
|| res[i].c != check_res[i].c
|| res[i].d != check_res[i].d
|| res[i].e != check_res[i].e
|| res[i].f != check_res[i].f
|| res[i].g != check_res[i].g
|| res[i].h != check_res[i].h)
abort();
}
}
......@@ -61,6 +63,7 @@ int main (void)
{
int i;
s arr[N];
unsigned char u, t, s, x, y, z, w;
check_vect ();
......@@ -74,6 +77,20 @@ int main (void)
arr[i].f = i * 5;
arr[i].g = i - 3;
arr[i].h = 67;
u = arr[i].b - arr[i].a;
t = arr[i].d - arr[i].c;
check_res[i].c = u + t;
x = arr[i].b + arr[i].d;
check_res[i].a = arr[i].a + x;
check_res[i].d = u + t;
s = arr[i].h - arr[i].a;
check_res[i].b = s + t;
check_res[i].f = arr[i].f + arr[i].h;
check_res[i].e = arr[i].b + arr[i].e;
check_res[i].h = arr[i].d;
check_res[i].g = u + t;
if (arr[i].a == 178)
abort();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment