diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/g++.dg/vect | |
download | cbb-gcc-4.6.4-upstream.tar.bz2 cbb-gcc-4.6.4-upstream.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/g++.dg/vect')
21 files changed, 771 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/vect/param-max-aliased-pr26197.cc b/gcc/testsuite/g++.dg/vect/param-max-aliased-pr26197.cc new file mode 100644 index 000000000..198cd6b53 --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/param-max-aliased-pr26197.cc @@ -0,0 +1,24 @@ +/* { dg-do compile } */ + +void g(const void*); +struct B +{ + int* x[2]; + int *p; + B() + { + for (int** p=x; p<x+4; ++p) + *p = 0; + } + ~B() + { + g(p); + } +}; +void bar() +{ + const B &b = B(); + g(&b); +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/g++.dg/vect/pr19951.cc b/gcc/testsuite/g++.dg/vect/pr19951.cc new file mode 100644 index 000000000..a6acf99ff --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/pr19951.cc @@ -0,0 +1,19 @@ +/* { dg-do compile } */ + +struct A +{ + ~A(); +}; + +void foo(); + +void bar() +{ + A a; + + foo(); + for (;;) + foo(); +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/g++.dg/vect/pr21218.cc b/gcc/testsuite/g++.dg/vect/pr21218.cc new file mode 100644 index 000000000..73331d227 --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/pr21218.cc @@ -0,0 +1,18 @@ +/* { dg-do compile } */ + +struct A +{ + double d[2]; + double foo(int i) { return d[i]; } +}; + +struct B : public A {}; + +void bar(B& b) +{ + for (int i=0; i<2; ++i) + b.d[i] = b.foo(i); +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/testsuite/g++.dg/vect/pr21734_1.cc b/gcc/testsuite/g++.dg/vect/pr21734_1.cc new file mode 100644 index 000000000..c65d9fcaa --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/pr21734_1.cc @@ -0,0 +1,20 @@ +/* { dg-do compile } */ + +struct A +{ + int a[4]; + int& operator[](int i) { return a[i]; } +}; + +struct B : public A +{ + int& operator[](int i) { return A::operator[](i); } +}; + +void foo(B &b) +{ + for (int i=0; i<4; ++i) + b[i] = 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/g++.dg/vect/pr21734_2.cc b/gcc/testsuite/g++.dg/vect/pr21734_2.cc new file mode 100644 index 000000000..58efedf18 --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/pr21734_2.cc @@ -0,0 +1,16 @@ +/* { dg-do compile } */ + +struct A +{ + int a[4]; + int* operator[](int i) { return &a[i]; } +}; + +void foo(A a1, A &a2) +{ + a1[1][1]=0; + for (int i=0; i<4; ++i) + a2.a[i]=0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/g++.dg/vect/pr22543.cc b/gcc/testsuite/g++.dg/vect/pr22543.cc new file mode 100644 index 000000000..f5e55f195 --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/pr22543.cc @@ -0,0 +1,38 @@ +/* { dg-do compile } */ + +struct A +{ + int i, j; + + A() : i(), j() {} + ~A() {} + + operator int() { return 0; } +}; + +struct B +{ + A foo() const { return A(); } +}; + +struct X { ~X(); }; + +struct C +{ + C(); + + int z[4]; +}; + +C::C() +{ + for (int i=0; i<4; ++i) + z[i]=0; + + X x; + + for (int i=0; i<4; ++i) + int j = B().foo(); +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/g++.dg/vect/pr33834_1.cc b/gcc/testsuite/g++.dg/vect/pr33834_1.cc new file mode 100644 index 000000000..715ff0dda --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/pr33834_1.cc @@ -0,0 +1,50 @@ +/* { dg-do compile } */ + +/* Testcase by Martin Michlmayr <tbm@cyrius.com> */ + +extern double cos (double x); +extern double sin (double x); + +class bend_class +{ + double *s_A; +public: + void set_s_A (double s_A0) + { + s_A[0] = s_A0; + } +}; +class bend_set +{ + bend_class *bend_array; +public: + void set_s_A (int index, double s_A0) + { + bend_array[index].set_s_A (s_A0); + } + void compute_s (void) + { + int i, j; + double val; + double tmp[3]; + for (i = 0; i < 5; ++i) + { + val = i; + for (j = 0; j < 2; ++j) + tmp[j] = cos (val); + set_s_A (i, tmp[0]); + tmp[j] = cos (val) / sin (val); + } + } +}; +class internals +{ + bend_set bend; + void compute_s (void); +}; +void +internals::compute_s (void) +{ + bend.compute_s (); +} +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/g++.dg/vect/pr33834_2.cc b/gcc/testsuite/g++.dg/vect/pr33834_2.cc new file mode 100644 index 000000000..1230ca314 --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/pr33834_2.cc @@ -0,0 +1,32 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -ftree-vectorize" } */ + +/* Testcase by Martin Michlmayr <tbm@cyrius.com> */ + +extern int sscanf (__const char *__restrict __s, + __const char *__restrict __format, ...); +unsigned char got_elevation_pattern; +struct site +{ + float antenna_pattern[361][1001]; +} +LR; +void +LoadPAT (char *filename) +{ + int x, y; + char string[255]; + float elevation, amplitude, elevation_pattern[361][1001]; + for (x = 0; filename[x] != '.' ; x++) + sscanf (string, "%f %f", &elevation, &litude); + for (y = 0; y <= 1000; y++) + { + if (got_elevation_pattern) + elevation = elevation_pattern[x][y]; + else + elevation = 1.0; + LR.antenna_pattern[x][y] = elevation; + } +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/g++.dg/vect/pr33835.cc b/gcc/testsuite/g++.dg/vect/pr33835.cc new file mode 100644 index 000000000..1ab4c7e8d --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/pr33835.cc @@ -0,0 +1,50 @@ +/* { dg-do compile } */ + +/* Testcase by Martin Michlmayr <tbm@cyrius.com> */ + +extern double cos (double x); + +class bend_class +{ + double *s_A; +public: + void set_s_A (double s_A0) + { + s_A[0] = s_A0; + } +}; +class bend_set +{ + bend_class *bend_array; +public: + void set_s_A (int index, double s_A0) + { + bend_array[index].set_s_A (s_A0); + } + void compute_s (void) + { + int i, j; + double val; + double tmp[3]; + for (i = 0; i < 5; ++i) + { + val = i; + for (j = 0; j < 2; ++j) + tmp[j] = cos (val); + set_s_A (i, tmp[0]); + tmp[j] = cos (val); + } + } +}; +class internals +{ + bend_set bend; + void compute_s (void); +}; +void +internals::compute_s (void) +{ + bend.compute_s (); +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/g++.dg/vect/pr33860.cc b/gcc/testsuite/g++.dg/vect/pr33860.cc new file mode 100644 index 000000000..e70ec674e --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/pr33860.cc @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* Testcase by Martin Michlmayr <tbm@cyrius.com> */ + +class Matrix +{ + public: + double data[4][4]; + Matrix operator* (const Matrix matrix) const; + void makeRotationAboutVector (void); +}; +void Matrix::makeRotationAboutVector (void) +{ + Matrix irx; + *this = irx * (*this); +} +Matrix Matrix::operator* (const Matrix matrix) const +{ + Matrix ret; + for (int i = 0; i < 4; i++) + for (int j = 0; j < 4; j++) + ret.data[j][i] = matrix.data[j][2] + matrix.data[j][3]; + return ret; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/g++.dg/vect/pr33860a.cc b/gcc/testsuite/g++.dg/vect/pr33860a.cc new file mode 100644 index 000000000..77e28226a --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/pr33860a.cc @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-options "-Wno-psabi" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ + +/* Testcase by Martin Michlmayr <tbm@cyrius.com> */ + +class Matrix +{ + public: + float data[4][4] __attribute__ ((__aligned__(16))); + Matrix operator* (const Matrix matrix) const; + void makeRotationAboutVector (void); +}; +void Matrix::makeRotationAboutVector (void) +{ + Matrix irx; + *this = irx * (*this); +} +Matrix Matrix::operator* (const Matrix matrix) const +{ + Matrix ret; + for (int i = 0; i < 4; i++) + for (int j = 0; j < 4; j++) + ret.data[j][i] = matrix.data[j][2] + matrix.data[j][3]; + return ret; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/g++.dg/vect/pr36648.cc b/gcc/testsuite/g++.dg/vect/pr36648.cc new file mode 100644 index 000000000..6306b4d65 --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/pr36648.cc @@ -0,0 +1,24 @@ +/* { dg-require-effective-target vect_float } */ + +struct vector +{ + vector() : x(0), y(0), z(0) { } + float x,y,z; +}; + +struct Foo +{ + int dummy; + /* Misaligned access. */ + vector array_of_vectors[4]; +}; + +Foo foo; + +int main() { } + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { ! vect_no_align } } } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { ! vect_no_align } } } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + + diff --git a/gcc/testsuite/g++.dg/vect/pr37143.C b/gcc/testsuite/g++.dg/vect/pr37143.C new file mode 100644 index 000000000..70cdfd29b --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/pr37143.C @@ -0,0 +1,21 @@ +/* { dg-do compile } */ + +void +f(int NumberOfSideSets, int *ssNumDFperSide, float *ssDF) +{ + int i; + float *newssDF = __null; + int *newssNumDF = new int [NumberOfSideSets]; + int ndf, nextDF, numNewDF = 0; + int ii=0; + for (i=0; i<NumberOfSideSets; i++) + numNewDF += newssNumDF[i]; + if (numNewDF > 0) + newssDF = new float [numNewDF]; + nextDF = 0; + ndf = ssNumDFperSide[ii]; + for (i=0; i<ndf; i++) + newssDF[nextDF++] = ssDF[i]; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/g++.dg/vect/pr37174.cc b/gcc/testsuite/g++.dg/vect/pr37174.cc new file mode 100644 index 000000000..d720e4bfe --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/pr37174.cc @@ -0,0 +1,23 @@ +/* { dg-do compile } */ + +int* getFoo(); +struct Bar { + Bar(); + int* foo1; + int* foo2; + int* table[4][4][4]; +}; +Bar::Bar() { + foo1 = getFoo(); + foo2 = getFoo(); + for (int a = 0; a < 4; ++a) { + for (int b = 0; b < 4; ++b) { + for (int c = 0; c < 4; ++c) { + table[a][b][c] = foo1; + } + } + } +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/testsuite/g++.dg/vect/pr43771.cc b/gcc/testsuite/g++.dg/vect/pr43771.cc new file mode 100644 index 000000000..1a2d09aae --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/pr43771.cc @@ -0,0 +1,14 @@ +/* { dg-do compile } */ + +void KWayNodeRefine__(int nparts, int *gpwgts, int *badminpwgt, int +*badmaxpwgt) +{ + int i; + + for (i=0; i<nparts; i+=2) { + badminpwgt[i] = badminpwgt[i+1] = gpwgts[i]+gpwgts[i+1]; + badmaxpwgt[i] = badmaxpwgt[i+1] = gpwgts[i]+gpwgts[i+1]; + } +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/g++.dg/vect/pr44861.cc b/gcc/testsuite/g++.dg/vect/pr44861.cc new file mode 100644 index 000000000..07c59a138 --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/pr44861.cc @@ -0,0 +1,34 @@ +// { dg-do compile } + +bool f(); + +struct counted_base { + virtual void destroy() { } + void release() { if (f()) destroy(); } +}; + +struct shared_count { + shared_count() { } + ~shared_count() { if (pi) pi->release(); } + shared_count(shared_count& r) : pi(r.pi) { if (pi) pi->release(); } + counted_base* pi; +}; + +struct Foo; + +struct shared_ptr { + Foo& operator*() { return *ptr; } + Foo* ptr; + shared_count refcount; +}; + +struct Bar { + Bar(Foo&, shared_ptr); +}; + +void g() { + shared_ptr foo; + new Bar(*foo, foo); +} + +// { dg-final { cleanup-tree-dump "vect" } } diff --git a/gcc/testsuite/g++.dg/vect/pr45470-a.cc b/gcc/testsuite/g++.dg/vect/pr45470-a.cc new file mode 100644 index 000000000..474f3d647 --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/pr45470-a.cc @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -ftree-vectorize -fnon-call-exceptions" } */ + +struct A +{ + A (): a (0), b (0), c (0) + { + }; + ~A (); + int a, b, c; +}; + +struct B +{ + B (); + A a1; + A a2; +}; + +B::B () +{ +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/g++.dg/vect/pr45470-b.cc b/gcc/testsuite/g++.dg/vect/pr45470-b.cc new file mode 100644 index 000000000..279a1899c --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/pr45470-b.cc @@ -0,0 +1,52 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -ftree-vectorize -fno-vect-cost-model -fnon-call-exceptions" } */ + +template < typename _Tp > struct new_allocator +{ + typedef _Tp * pointer; + template < typename > struct rebind + { + typedef new_allocator other; + }; + +}; + +template < typename _Tp > struct allocator:public new_allocator < _Tp > +{}; + +template < typename _Tp, typename _Alloc > struct _Vector_base +{ + typedef typename _Alloc::template rebind < _Tp >::other _Tp_alloc_type; + struct + { + typename _Tp_alloc_type::pointer _M_start; + typename _Tp_alloc_type::pointer _M_finish; + typename _Tp_alloc_type::pointer _M_end_of_storage; + }; + +}; + +template + < + typename + _Tp, + typename + _Alloc = allocator < _Tp > >struct vector:_Vector_base < _Tp, _Alloc > +{ + typedef _Vector_base < _Tp, _Alloc > _Base; + vector ():_Base () + {} + ~vector (); +} +; +struct LoadGraph +{ + LoadGraph (int); + vector < struct _GdkColor >colors; + vector < float >data_block; +}; + +LoadGraph::LoadGraph (int) +{} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/g++.dg/vect/pr51485.cc b/gcc/testsuite/g++.dg/vect/pr51485.cc new file mode 100644 index 000000000..d57d7596d --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/pr51485.cc @@ -0,0 +1,14 @@ +/* { dg-do compile } */ + +struct A { A (); unsigned int a; }; +double bar (A a) throw () __attribute__((pure)); + +void +foo (unsigned int x, double *y, A *z) +{ + unsigned int i; + for (i = 0; i < x; i++) + y[i] = bar (z[i]); +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/g++.dg/vect/slp-pr50413.cc b/gcc/testsuite/g++.dg/vect/slp-pr50413.cc new file mode 100644 index 000000000..e7bdf1f1c --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/slp-pr50413.cc @@ -0,0 +1,165 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target vect_int } */ + +typedef unsigned long long UInt64; + +typedef struct struct128 +{ + UInt64 uint64_lower; + UInt64 uint64_upper; +} +STRUCT_128; + +typedef union uint128_bitmap +{ + STRUCT_128 uint128; + + struct + { + UInt64 b00 : 1; + UInt64 b01 : 1; + UInt64 b02 : 1; + UInt64 b03 : 1; + UInt64 b04 : 1; + UInt64 b05 : 1; + UInt64 b06 : 1; + UInt64 b07 : 1; + UInt64 b08 : 1; + UInt64 b09 : 1; + UInt64 b10 : 1; + UInt64 b11 : 1; + UInt64 b12 : 1; + UInt64 b13 : 1; + UInt64 b14 : 1; + UInt64 b15 : 1; + UInt64 b16 : 1; + UInt64 b17 : 1; + UInt64 b18 : 1; + UInt64 b19 : 1; + UInt64 b20 : 1; + UInt64 b21 : 1; + UInt64 b22 : 1; + UInt64 b23 : 1; + UInt64 b24 : 1; + UInt64 b25 : 1; + UInt64 b26 : 1; + UInt64 b27 : 1; + UInt64 b28 : 1; + UInt64 b29 : 1; + UInt64 b30 : 1; + UInt64 b31 : 1; + UInt64 b32 : 1; + UInt64 b33 : 1; + UInt64 b34 : 1; + UInt64 b35 : 1; + UInt64 b36 : 1; + UInt64 b37 : 1; + UInt64 b38 : 1; + UInt64 b39 : 1; + UInt64 b40 : 1; + UInt64 b41 : 1; + UInt64 b42 : 1; + UInt64 b43 : 1; + UInt64 b44 : 1; + UInt64 b45 : 1; + UInt64 b46 : 1; + UInt64 b47 : 1; + UInt64 b48 : 1; + UInt64 b49 : 1; + UInt64 b50 : 1; + UInt64 b51 : 1; + UInt64 b52 : 1; + UInt64 b53 : 1; + UInt64 b54 : 1; + UInt64 b55 : 1; + UInt64 b56 : 1; + UInt64 b57 : 1; + UInt64 b58 : 1; + UInt64 b59 : 1; + UInt64 b60 : 1; + UInt64 b61 : 1; + UInt64 b62 : 1; + UInt64 b63 : 1; + UInt64 b64 : 1; + UInt64 b65 : 1; + UInt64 b66 : 1; + UInt64 b67 : 1; + UInt64 b68 : 1; + UInt64 b69 : 1; + UInt64 b70 : 1; + UInt64 b71 : 1; + UInt64 b72 : 1; + UInt64 b73 : 1; + UInt64 b74 : 1; + UInt64 b75 : 1; + UInt64 b76 : 1; + UInt64 b77 : 1; + UInt64 b78 : 1; + UInt64 b79 : 1; + UInt64 b80 : 1; + UInt64 b81 : 1; + UInt64 b82 : 1; + UInt64 b83 : 1; + UInt64 b84 : 1; + UInt64 b85 : 1; + UInt64 b86 : 1; + UInt64 b87 : 1; + UInt64 b88 : 1; + UInt64 b89 : 1; + UInt64 b90 : 1; + UInt64 b91 : 1; + UInt64 b92 : 1; + UInt64 b93 : 1; + UInt64 b94 : 1; + UInt64 b95 : 1; + UInt64 b96 : 1; + UInt64 b97 : 1; + UInt64 b98 : 1; + UInt64 b99 : 1; + UInt64 b100 : 1; + UInt64 b101 : 1; + UInt64 b102 : 1; + UInt64 b103 : 1; + UInt64 b104 : 1; + UInt64 b105 : 1; + UInt64 b106 : 1; + UInt64 b107 : 1; + UInt64 b108 : 1; + UInt64 b109 : 1; + UInt64 b110 : 1; + UInt64 b111 : 1; + UInt64 b112 : 1; + UInt64 b113 : 1; + UInt64 b114 : 1; + UInt64 b115 : 1; + UInt64 b116 : 1; + UInt64 b117 : 1; + UInt64 b118 : 1; + UInt64 b119 : 1; + UInt64 b120 : 1; + UInt64 b121 : 1; + UInt64 b122 : 1; + UInt64 b123 : 1; + UInt64 b124 : 1; + UInt64 b125 : 1; + UInt64 b126 : 1; + UInt64 b127 : 1; + } + bitmap; +} +UInt128_BITMAP; + +UInt128_BITMAP V; + +void shift(unsigned char t) +{ + V.uint128.uint64_lower = (V.uint128.uint64_lower >> 1); + V.bitmap.b63 = V.bitmap.b64; + V.uint128.uint64_upper = (V.uint128.uint64_upper >> 1); + + V.bitmap.b96 = t; +} + +/* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 0 "slp" } } */ +/* { dg-final { cleanup-tree-dump "slp" } } */ + diff --git a/gcc/testsuite/g++.dg/vect/vect.exp b/gcc/testsuite/g++.dg/vect/vect.exp new file mode 100644 index 000000000..ac22f4b01 --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/vect.exp @@ -0,0 +1,81 @@ +# Copyright (C) 2004, 2007, 2008, 2010 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# GCC testsuite that uses the 'dg.exp' driver. + +# There's a bunch of headers we need. +if [is_remote host] { + foreach header [glob -nocomplain $srcdir/$subdir/*.{h,def} ] { + remote_download host $header + } +} + +# Load support procs. +load_lib g++-dg.exp +load_lib target-supports.exp + +# If the target system supports vector instructions, the default action +# for a test is 'run', otherwise it's 'compile'. Save current default. +# Executing vector instructions on a system without hardware vector support +# is also disabled by a call to check_vect, but disabling execution here is +# more efficient. +global dg-do-what-default +set save-dg-do-what-default ${dg-do-what-default} + +# Set up flags used for tests that don't specify options. +global DEFAULT_VECTCFLAGS +set DEFAULT_VECTCFLAGS "" + +# These flags are used for all targets. +lappend DEFAULT_VECTCFLAGS "-O2" "-ftree-vectorize" "-fno-vect-cost-model" + +set VECT_SLP_CFLAGS $DEFAULT_VECTCFLAGS + +lappend DEFAULT_VECTCFLAGS "-fdump-tree-vect-details" +lappend VECT_SLP_CFLAGS "-fdump-tree-slp-details" + + +# Skip these tests for targets that do not support generating vector +# code. Set additional target-dependent vector flags, which can be +# overridden by using dg-options in individual tests. +if ![check_vect_support_and_set_flags] { + return +} + +# Initialize `dg'. +dg-init + +# Main loop. +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/pr*.{c,cc,S} ]] \ + "" $DEFAULT_VECTCFLAGS +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/slp-pr*.{c,cc,S} ]] \ + "" $VECT_SLP_CFLAGS + +#### Tests with special options +global SAVED_DEFAULT_VECTCFLAGS +set SAVED_DEFAULT_VECTCFLAGS $DEFAULT_VECTCFLAGS + +# --param max-aliased-vops=0 +set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS +lappend DEFAULT_VECTCFLAGS "--param max-aliased-vops=0" +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/param-max-aliased*.\[cS\]]] \ + "" $DEFAULT_VECTCFLAGS + +# Clean up. +set dg-do-what-default ${save-dg-do-what-default} + +# All done. +dg-finish |