Add missing testcases.

2009-12-23  Sebastian Pop  <sebpop@gmail.com>

	* g++.dg/graphite/id-1.C: New.
	* g++.dg/graphite/pr41305.C: New.
	* gcc.dg/graphite/id-16.c: New.
	* gcc.dg/graphite/interchange-10.c: New.
	* gcc.dg/graphite/interchange-11.c: New.
	* gcc.dg/graphite/interchange-mvt.c: New.
	* gcc.dg/graphite/pr40281.c: New.
	* gcc.dg/graphite/run-id-2.c: New.
	* gcc.dg/graphite/scop-dsyr2k.c: New.
	* gcc.dg/graphite/scop-dsyrk.c: New.
	* gcc.dg/graphite/scop-mvt.c: New.
	* gcc.dg/graphite/scop-sor.c: New.
	* gfortran.dg/graphite/id-18.f90: New.
	* gfortran.dg/graphite/interchange-3.f90: New.
	* gfortran.dg/graphite/pr42050.f90: New.

	* testsuite/libgomp.graphite/pr4118.c: New.

From-SVN: r155424
This commit is contained in:
Sebastian Pop 2009-12-23 07:51:19 +00:00 committed by Sebastian Pop
parent a84a556d97
commit 1b3abda87d
18 changed files with 720 additions and 0 deletions

View File

@ -1,3 +1,21 @@
2009-12-23 Sebastian Pop <sebpop@gmail.com>
* g++.dg/graphite/id-1.C: New.
* g++.dg/graphite/pr41305.C: New.
* gcc.dg/graphite/id-16.c: New.
* gcc.dg/graphite/interchange-10.c: New.
* gcc.dg/graphite/interchange-11.c: New.
* gcc.dg/graphite/interchange-mvt.c: New.
* gcc.dg/graphite/pr40281.c: New.
* gcc.dg/graphite/run-id-2.c: New.
* gcc.dg/graphite/scop-dsyr2k.c: New.
* gcc.dg/graphite/scop-dsyrk.c: New.
* gcc.dg/graphite/scop-mvt.c: New.
* gcc.dg/graphite/scop-sor.c: New.
* gfortran.dg/graphite/id-18.f90: New.
* gfortran.dg/graphite/interchange-3.f90: New.
* gfortran.dg/graphite/pr42050.f90: New.
2009-12-23 Dodji Seketeli <dodji@redhat.com>
PR c++/42260

View File

@ -0,0 +1,39 @@
#include <vector>
template <int rank, int dim> class Tensor;
template <int dim>
class Tensor<1,dim>
{
public:
explicit Tensor (const bool initialize = true);
Tensor (const Tensor<1,dim> &);
double values[(dim!=0) ? (dim) : 1];
};
template <int dim>
Tensor<1,dim>::Tensor (const Tensor<1,dim> &p)
{
for (unsigned int i=0; i<dim; ++i)
values[i] = p.values[i];
}
template <int dim>
class KellyErrorEstimator
{
struct PerThreadData
{
std::vector<std::vector<std::vector<Tensor<1,dim> > > > psi;
PerThreadData (const unsigned int n_solution_vectors,
const unsigned int n_components,
const unsigned int n_q_points);
};
};
template <int dim>
KellyErrorEstimator<dim>::PerThreadData::
PerThreadData (const unsigned int n_solution_vectors,
const unsigned int n_components,
const unsigned int n_q_points)
{
for (unsigned int i=0; i<n_solution_vectors; ++i)
for (unsigned int qp=0;qp<n_q_points;++qp)
psi[i][qp].resize(n_components);
}
template class KellyErrorEstimator<3>;

View File

@ -0,0 +1,332 @@
// { dg-do compile }
// { dg-options "-O3 -floop-interchange" }
void __throw_bad_alloc ();
template <typename _Tp> void
swap (_Tp & __a, _Tp __b)
{
__a = __b;
}
template <typename _Category> struct iterator
{
typedef _Category iterator_category;
};
template <typename _Tp> struct allocator
{
typedef __SIZE_TYPE__ size_type;
typedef _Tp pointer;
pointer allocate (size_type)
{
__throw_bad_alloc ();
return __null;
}
};
template <class T, class = allocator <T> >class unbounded_array;
template <class T, class = unbounded_array <T> >class vector;
template <class = int> class scalar_vector;
template <class IC> struct random_access_iterator_base : public iterator <IC>
{
};
template <class X, class> struct promote_traits
{
typedef __typeof__ ((X ())) promote_type;
};
template <class T> struct scalar_traits
{
typedef T const_reference;
typedef T reference;
};
template <class T> struct type_traits : scalar_traits <T>
{
};
struct dense_proxy_tag
{
};
template <class> struct iterator_base_traits;
template <> struct iterator_base_traits <dense_proxy_tag>
{
template <class, class> struct iterator_base
{
typedef random_access_iterator_base <dense_proxy_tag> type;
};
};
template <class I1, class> struct iterator_restrict_traits
{
typedef I1 iterator_category;
};
template <class> class storage_array
{
};
template <class T, class ALLOC> struct unbounded_array : public storage_array <unbounded_array <ALLOC> >
{
typedef typename ALLOC::size_type size_type;
typedef T & reference;
typedef T *pointer;
unbounded_array (size_type size, ALLOC = ALLOC ()) : alloc_ (), size_ (size)
{
alloc_.allocate (size_);
}
~unbounded_array ()
{
if (size_)
for (;;);
}
size_type
size () const
{
return size_;
}
reference
operator[] (size_type i)
{
return data_[i];
}
void
swap (unbounded_array & a)
{
::swap (size_, a.size_);
}
ALLOC alloc_;
size_type size_;
pointer data_;
};
template <class T1, class T2> struct scalar_binary_functor
{
typedef typename promote_traits <T1, T2>::promote_type result_type;
};
template <class T1, class T2> struct scalar_plus : public scalar_binary_functor <T1, T2>
{
};
template <class T1, class T2> struct scalar_multiplies : public scalar_binary_functor <T1, T2>
{
};
template <class T1, class T2> struct scalar_binary_assign_functor
{
typedef typename type_traits <T1>::reference argument1_type;
typedef typename type_traits <T2>::const_reference argument2_type;
};
template <class T1, class T2> struct scalar_assign : public scalar_binary_assign_functor <T1, T2>
{
typedef typename scalar_binary_assign_functor <T1, T2>::argument1_type argument1_type;
typedef typename scalar_binary_assign_functor <T1, T2>::argument2_type argument2_type;
static const bool computed = false;
static void
apply (argument1_type t1, argument2_type t2)
{
t1 = t2;
}
};
template <class E> struct vector_expression
{
typedef E expression_type;
const expression_type &
operator () () const
{
return *static_cast <const expression_type *>(this);
}
};
template <class C> class vector_container : public vector_expression <C>
{
};
template <class E> struct vector_reference : public vector_expression <vector_reference <E> >
{
typedef typename E::size_type size_type;
typename E::const_reference const_reference;
typedef E referred_type;
vector_reference (referred_type & e) : e_ (e)
{
}
size_type
size () const
{
return expression ().size ();
}
referred_type &
expression () const
{
return e_;
}
referred_type &e_;
};
template <class E1, class E2, class F> struct vector_binary : public vector_expression <vector_binary <E1, E2, F> >
{
typedef E1 expression1_type;
typedef E2 expression2_type;
typedef typename E1::const_closure_type expression1_closure_type;
typedef typename E2::const_closure_type expression2_closure_type;
typedef typename promote_traits <typename E1::size_type, typename E2::size_type>::promote_type size_type;
typedef typename F::result_type value_type;
vector_binary (const expression1_type & e1, expression2_type e2) : e1_ (e1), e2_ (e2)
{
}
size_type
size () const
{
return e1_.size ();
}
class const_iterator : public iterator_base_traits <typename iterator_restrict_traits <typename E1::const_iterator::iterator_category, const_iterator>::iterator_category>::template iterator_base <const_iterator, value_type>::type
{
};
expression1_closure_type e1_;
expression2_closure_type e2_;
};
template <class E1, class E2, class F> struct vector_binary_traits
{
typedef vector_binary <E1, E2, F> expression_type;
typedef expression_type result_type;
};
template <class E1, class E2> typename vector_binary_traits <E1, E2, scalar_plus <typename E1::value_type, typename E2::value_type> >::result_type
operator + (vector_expression <E1> &e1, const vector_expression <E2> &e2)
{
typedef typename vector_binary_traits <E1, E2, scalar_plus <typename E1::value_type, typename E2::value_type> >::expression_type expression_type;
return expression_type (e1 (), e2 ());
}
template <class E1, class E2, class F> struct vector_binary_scalar2 : public vector_expression <vector_binary_scalar2 <E1, E2, F> >
{
typedef vector_binary_scalar2 <E1, E2, F> self_type;
typedef typename E1::size_type size_type;
typedef typename F::result_type value_type;
typedef self_type const_closure_type;
};
template <class E1, class E2, class F> struct vector_binary_scalar2_traits
{
typedef vector_binary_scalar2 <E1, E2, F> result_type;
};
template <class E1, class T2>
typename vector_binary_scalar2_traits <E1, T2, scalar_multiplies <typename E1::value_type, T2> >::result_type
operator * (vector_expression <E1>, T2)
{
}
template <class SC> struct vector_assign_traits
{
typedef SC storage_category;
};
template <template <class, class> class F, class V, class E> void
indexing_vector_assign (V & v, vector_expression <E>)
{
typedef F <typename V::reference, typename E::value_type> functor_type;
typedef typename V::size_type size_type;
size_type size (v.size ());
for (size_type i; i <size; ++i)
functor_type::apply (v (i), (i));
}
template <template <class, class> class F, class V, class E> void
vector_assign (V & v, const vector_expression <E> &e, dense_proxy_tag)
{
indexing_vector_assign <F> (v, e);
}
template <template <class, class> class F, class V, class E> void
vector_assign (V & v, const vector_expression <E> &e)
{
typedef typename vector_assign_traits <typename V::storage_category>::storage_category storage_category;
vector_assign <F> (v, e, storage_category ());
}
template <class T, class A> struct vector : public vector_container <vector <T> >
{
typedef vector <T> self_type;
typedef typename A::size_type size_type;
typedef T value_type;
typedef typename type_traits <T>::const_reference const_reference;
typedef T &reference;
typedef A array_type;
typedef vector_reference <const self_type> const_closure_type;
typedef dense_proxy_tag storage_category;
vector (size_type size):vector_container <self_type> (), data_ (size)
{
}
vector (size_type size, value_type):vector_container <self_type> (), data_ (size)
{
}
template <class AE> vector (const vector_expression <AE> &ae) : vector_container <self_type> (), data_ (ae ().size ())
{
vector_assign <scalar_assign> (*this, ae);
}
size_type
size () const
{
return data_.size ();
}
array_type &
data ()
{
return data_;
}
reference
operator () (size_type i)
{
return data ()[i];
}
template <class AE> vector operator += (const vector_expression <AE> &ae)
{
self_type temporary (*this + ae);
data_.swap (temporary.data ());
return *this;
}
class const_iterator : public random_access_iterator_base <dense_proxy_tag>
{
};
array_type data_;
};
template <class T> struct scalar_vector : public vector_container <scalar_vector <> >
{
typedef scalar_vector self_type;
typedef __SIZE_TYPE__ size_type;
typedef T value_type;
typedef T const_reference;
typedef vector_reference <self_type> const_closure_type;
};
void
bar (vector <double>)
{
}
void
foo (int n_samp)
{
vector <double> xi (n_samp, 0);
for (int n = 0; n <n_samp; ++n)
{
vector <double> cos_w_n (n_samp);
xi += cos_w_n * 6.0;
}
vector <double> cos_wd (n_samp);
xi += cos_wd;
bar (xi + scalar_vector <> ());
}

View File

@ -0,0 +1,44 @@
int transformation[(2*19 - 1) * (2*19 - 1)][8];
const int transformation2[8][2][2] = {
{{1, 0}, {0, 1}},
{{0, 1}, {-1, 0}},
{{-1, 0}, {0, -1}},
{{0, -1}, {1, 0}},
{{0, -1}, {-1, 0}},
{{-1, 0}, {0, 1}},
{{0, 1}, {1, 0}},
{{1, 0}, {0, -1}}
};
void
transformation_init (void)
{
int k;
int dx;
int dy;
for (k = 0; k < 8; k++)
{
for (dy = -19 + 1; dy <= 19 - 1; dy++)
{
for (dx = -19 + 1; dx <= 19 - 1; dx++)
{
int tx;
int ty;
do
{
*&tx =
transformation2[k][0][0] * (dx) +
transformation2[k][0][1] * (dy);
*&ty =
transformation2[k][1][0] * (dx) +
transformation2[k][1][1] * (dy);
}
while (0);
transformation[((dy + 19 - 1) * (2 * 19 - 1) +
(dx + 19 - 1))][k] = ((tx) * (19 + 1) + (ty));
}
}
}
}

View File

@ -0,0 +1,19 @@
double u[1782225];
int foo(int N, int *res)
{
int i, j;
double sum = 0.0;
for (i = 0; i < N; i++)
for (j = 0; j < N; j++)
sum = sum + u[i + 1335 * j];
for (i = 0; i < N; i++)
for (j = 0; j < N; j++)
sum = sum + u[i + 1335 * j];
*res = sum + N;
}
/* { dg-final { scan-tree-dump-times "will be interchanged" 2 "graphite" } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */

View File

@ -0,0 +1,18 @@
double u[1782225];
int foo(int N, int *res)
{
int i, j;
double sum = 0.0;
for (i = 0; i < 1335; i++)
{
for (j = 0; j < 1335; j++)
sum = sum + u[i + 1335 * j];
u[1336 * i] *= 2;
}
*res = sum;
}
/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */

View File

@ -0,0 +1,24 @@
#define NMAX 2000
static double x1[NMAX], x2[NMAX], a[NMAX][NMAX], y_1[NMAX], y_2[NMAX];
void mvt(long N) {
int i,j;
for (i=0; i<N; i++) {
for (j=0; j<N; j++) {
x1[i] = x1[i] + a[i][j] * y_1[j];
}
}
for (i=0; i<N; i++) {
for (j=0; j<N; j++) {
x2[i] = x2[i] + a[j][i] * y_2[j];
}
}
}
/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */

View File

@ -0,0 +1,12 @@
/* { dg-do compile } */
/* { dg-options "-O -fprefetch-loop-arrays" } */
void foo(int);
void bar(int n)
{
int a[2], i, j = 0;
for (i = 0; i < 2; i += j+1)
for (j = 0; j < (n ? 1 : 2); ++j)
foo(a[i] + a[j]);
}

View File

@ -0,0 +1,28 @@
int a[1] = {1};
static int __attribute__((noinline)) foo(int n)
{
int i, c = 0;
for (i = 0; i < n; i++)
c += a[i];
return c;
}
int b[2] = {2, 3};
static int __attribute__((noinline)) bar(int n)
{
int i, c = 0;
for (i = 0; i < n; i++)
c += b[i];
return c;
}
int main()
{
return
foo(0) != 0 || foo(1) != 1 || bar(0) != 0 || bar(1) != 2 || bar(2) != 5;
}
/* { dg-do run } */
/* { dg-final { cleanup-tree-dump "graphite" } } */

View File

@ -0,0 +1,21 @@
#define NMAX 3000
static double a[NMAX][NMAX], b[NMAX][NMAX], c[NMAX][NMAX];
void dsyr2k(long N) {
int i,j,k;
#pragma scop
for (i=0; i<N; i++) {
for (j=0; j<N; j++) {
for (k=j; k<N; k++) {
c[j][k] += a[i][j] * b[i][k] + b[i][j] * a[i][k];
}
}
}
#pragma endscop
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite"} } */
/* { dg-final { cleanup-tree-dump "graphite" } } */

View File

@ -0,0 +1,22 @@
#define NMAX 3000
#define MEASURE_TIME 1
static double a[NMAX][NMAX], c[NMAX][NMAX];
void dsyrk(long N)
{
int i,j,k;
#pragma scop
for (i=0; i<N; i++) {
for (j=0; j<N; j++) {
for (k=j; k<N; k++) {
c[j][k] += a[i][j] * a[i][k];
}
}
}
#pragma endscop
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite" } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */

View File

@ -0,0 +1,24 @@
#define NMAX 2000
static double x1[NMAX], x2[NMAX], a[NMAX][NMAX], y_1[NMAX], y_2[NMAX];
void mvt(long N) {
int i,j;
for (i=0; i<N; i++) {
for (j=0; j<N; j++) {
x1[i] = x1[i] + a[i][j] * y_1[j];
}
}
for (i=0; i<N; i++) {
for (j=0; j<N; j++) {
x2[i] = x2[i] + a[j][i] * y_2[j];
}
}
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 2" 1 "graphite" } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */

View File

@ -0,0 +1,18 @@
#define SIZE 10000
static double P[SIZE][SIZE];
void sor(int N1, int N2){
int i, j, k;
#pragma scop
for(i=1; i<N1-1; i++) {
for(j=1; j<N2-1; j++) {
P[i][j] = (P[i][j] + P[i][j-1] + P[i][j+1] + P[i-1][j] + P[i+1][j]) / 5;
}
}
#pragma endscop
}
/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite" } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */

View File

@ -0,0 +1,25 @@
MODULE spherical_harmonics
INTEGER, PARAMETER :: dp = SELECTED_REAL_KIND ( 14, 200 )
CONTAINS
FUNCTION dlegendre (x, l, m) RESULT (dplm)
SELECT CASE ( l )
CASE ( 0 )
dplm = 0.0_dp
CASE ( 1 )
dplm = 1.0_dp
CASE DEFAULT
IF ( mm > 0 ) THEN
dpmm = -m
DO im = 1, mm
dpmm = -dpmm
END DO
IF ( l == mm + 1 ) THEN
DO il = mm + 2, l
dpll = dpmm
END DO
dplm = dpll
END IF
END IF
END SELECT
END FUNCTION dlegendre
END MODULE spherical_harmonics

View File

@ -0,0 +1,28 @@
! Formerly known as ltrans-7.f90
Program FOO
IMPLICIT INTEGER (I-N)
IMPLICIT REAL*8 (A-H, O-Z)
PARAMETER (N1=1335, N2=1335)
COMMON U(N1,N2), V(N1,N2), P(N1,N2)
PC = 0.0D0
UC = 0.0D0
VC = 0.0D0
do I = 1, M
do J = 1, M
PC = PC + abs(P(I,J))
UC = UC + abs(U(I,J))
VC = VC + abs(V(I,J))
end do
U(I,I) = U(I,I) * ( mod (I, 100) /100.)
end do
write(6,366) PC, UC, VC
366 format(/, ' PC = ',E12.4,/,' UC = ',E12.4,/,' VC = ',E12.4,/)
end Program FOO
! { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } }
! { dg-final { cleanup-tree-dump "graphite" } }

View File

@ -0,0 +1,25 @@
! { dg-options "-O2 -fgraphite-identity " }
MODULE qs_ks_methods
INTEGER, PARAMETER :: sic_list_all=1
TYPE dft_control_type
INTEGER :: sic_list_id
END TYPE
CONTAINS
SUBROUTINE sic_explicit_orbitals( )
TYPE(dft_control_type), POINTER :: dft_control
INTEGER, ALLOCATABLE, DIMENSION(:, :) :: sic_orbital_list
INTEGER, DIMENSION(:), &
POINTER :: mo_derivs
SELECT CASE(dft_control%sic_list_id)
CASE(sic_list_all)
DO i=1,k_alpha
IF (SIZE(mo_derivs,1)==1) THEN
ELSE
sic_orbital_list(3,iorb)=2
ENDIF
ENDDO
END SELECT
CALL test()
END SUBROUTINE sic_explicit_orbitals
END MODULE qs_ks_methods

View File

@ -1,3 +1,7 @@
2009-12-23 Sebastian Pop <sebpop@gmail.com>
* testsuite/libgomp.graphite/pr4118.c: New.
2009-12-22 Iain Sandoe <iain.sandoe@sandoe-acoustics.co.uk>
* testsuite/libgomp.fortran/crayptr2.f90: Remove forced static linkage

View File

@ -0,0 +1,19 @@
void foo(int *a, int *b)
{
int i;
int *c = b+1;
for (i = 0; i < 100; i++)
a[i] = c[i];
}
int main(void)
{
return 0;
}
/* Check that parallel code generation part make the right answer. */
/* { dg-final { cleanup-tree-dump "graphite" } } */
/* { dg-final { scan-tree-dump-times "loopfn" 0 "optimized" } } */
/* { dg-final { cleanup-tree-dump "parloops" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */