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/graphite | |
download | cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2 cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.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/graphite')
-rw-r--r-- | gcc/testsuite/g++.dg/graphite/graphite.exp | 71 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/graphite/id-1.C | 39 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/graphite/pr39447.C | 34 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/graphite/pr41305.C | 332 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/graphite/pr41562.C | 18 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/graphite/pr42130.C | 19 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/graphite/pr42681.C | 17 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/graphite/pr42930.C | 55 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/graphite/pr43026.C | 51 |
9 files changed, 636 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/graphite/graphite.exp b/gcc/testsuite/g++.dg/graphite/graphite.exp new file mode 100644 index 000000000..4b359c9b3 --- /dev/null +++ b/gcc/testsuite/g++.dg/graphite/graphite.exp @@ -0,0 +1,71 @@ +# Copyright (C) 2009, 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. + +# Load support procs. +load_lib g++-dg.exp + +if ![check_effective_target_fgraphite] { + return +} + +# Remove VALUE from LIST_VARIABLE. +proc lremove {list_variable value} { + upvar 1 $list_variable var + set idx [lsearch -exact $var $value] + set var [lreplace $var $idx $idx] +} + +# The default action for a test is 'compile'. Save current default. +global dg-do-what-default +set save-dg-do-what-default ${dg-do-what-default} + +# Initialize `dg'. +dg-init + +set wait_to_run_files [lsort [glob -nocomplain $srcdir/$subdir/*.C ] ] +set scop_files [lsort [glob -nocomplain $srcdir/$subdir/scop-*.C ] ] +set id_files [lsort [glob -nocomplain $srcdir/$subdir/id-*.C ] ] +set run_id_files [lsort [glob -nocomplain $srcdir/$subdir/run-id-*.C ] ] +set interchange_files [lsort [glob -nocomplain $srcdir/$subdir/interchange-*.C ] ] +set block_files [lsort [glob -nocomplain $srcdir/$subdir/block-*.C ] ] + +# Tests to be compiled. +set dg-do-what-default compile +dg-runtest $scop_files "" "-O2 -fgraphite -fdump-tree-graphite-all" +dg-runtest $id_files "" "-O2 -fgraphite-identity -ffast-math" + +# Tests to be run. +set dg-do-what-default run +dg-runtest $run_id_files "" "-O2 -fgraphite-identity" +dg-runtest $interchange_files "" "-O2 -floop-interchange -fno-loop-block -fno-loop-strip-mine -ffast-math -fdump-tree-graphite-all" +dg-runtest $block_files "" "-O2 -floop-block -fno-loop-strip-mine -fno-loop-interchange -ffast-math -fdump-tree-graphite-all" + +# The default action for the rest of the files is 'compile'. +set dg-do-what-default compile +foreach f $scop_files {lremove wait_to_run_files $f} +foreach f $id_files {lremove wait_to_run_files $f} +foreach f $run_id_files {lremove wait_to_run_files $f} +foreach f $interchange_files {lremove wait_to_run_files $f} +foreach f $block_files {lremove wait_to_run_files $f} +dg-runtest $wait_to_run_files "" "-ansi -pedantic-errors" + +# Clean up. +set dg-do-what-default ${save-dg-do-what-default} + +# All done. +dg-finish diff --git a/gcc/testsuite/g++.dg/graphite/id-1.C b/gcc/testsuite/g++.dg/graphite/id-1.C new file mode 100644 index 000000000..5770e905d --- /dev/null +++ b/gcc/testsuite/g++.dg/graphite/id-1.C @@ -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>; diff --git a/gcc/testsuite/g++.dg/graphite/pr39447.C b/gcc/testsuite/g++.dg/graphite/pr39447.C new file mode 100644 index 000000000..a0d09ec2b --- /dev/null +++ b/gcc/testsuite/g++.dg/graphite/pr39447.C @@ -0,0 +1,34 @@ +/* { dg-options "-O2 -fgraphite-identity" } */ + +struct Point +{ + int line, col; + + Point( int l = -1, int c = 0 ) throw() : line( l ), col( c ) {} + bool operator==( const Point & p ) const throw() + { return ( line == p.line && col == p.col ); } + bool operator<( const Point & p ) const throw() + { return ( line < p.line || ( line == p.line && col < p.col ) ); } +}; + +class Buffer +{ +public: + int characters( const int line ) const throw(); + int pgetc( Point & p ) const throw(); + Point eof() const throw() { return Point( 0, 0 ); } + bool pisvalid( const Point & p ) const throw() + { return ( ( p.col >= 0 && p.col < characters( p.line ) ) || p == eof() ); + } + bool save( Point p1 = Point(), Point p2 = Point() ) const; +}; + +bool Buffer::save( Point p1, Point p2 ) const +{ + if( !this->pisvalid( p1 ) ) p1 = eof(); + if( !this->pisvalid( p2 ) ) p2 = eof(); + for( Point p = p1; p < p2; ) { pgetc( p ); } + return true; +} + + diff --git a/gcc/testsuite/g++.dg/graphite/pr41305.C b/gcc/testsuite/g++.dg/graphite/pr41305.C new file mode 100644 index 000000000..6a30b0e9e --- /dev/null +++ b/gcc/testsuite/g++.dg/graphite/pr41305.C @@ -0,0 +1,332 @@ +// { dg-do compile } +// { dg-options "-O3 -floop-interchange -Wno-conversion-null" } + +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 <> ()); +} diff --git a/gcc/testsuite/g++.dg/graphite/pr41562.C b/gcc/testsuite/g++.dg/graphite/pr41562.C new file mode 100644 index 000000000..36b8c275f --- /dev/null +++ b/gcc/testsuite/g++.dg/graphite/pr41562.C @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O -ftree-loop-distribution -floop-block" } */ + +typedef struct stSirenEncoder { } *SirenEncoder; + +int Siren7_EncodeFrame(SirenEncoder encoder, unsigned char *DataIn, unsigned char *DataOut) { + int number_of_regions; + static int absolute_region_power_index[28] = {0}; + static int region_mlt_bit_counts[28] = {0}; + int dwRes = 0; + int region; + if (dwRes != 0) return dwRes; + for(region = 0; region < number_of_regions; region++) + { + absolute_region_power_index[region] += 24; + region_mlt_bit_counts[region] = 0; + } +} diff --git a/gcc/testsuite/g++.dg/graphite/pr42130.C b/gcc/testsuite/g++.dg/graphite/pr42130.C new file mode 100644 index 000000000..ee31abad0 --- /dev/null +++ b/gcc/testsuite/g++.dg/graphite/pr42130.C @@ -0,0 +1,19 @@ +/* { dg-options "-O2 -fgraphite-identity -fno-tree-ch" } */ +#include <vector> + +using std::vector; + +vector<unsigned> & __attribute__((noinline, noclone)) foo(unsigned n) +{ + vector<unsigned> *vv = new vector<unsigned>(n, 0u); + return *vv; +} + +int main() +{ + foo(0); + return 0; +} + +/* { dg-do run } */ + diff --git a/gcc/testsuite/g++.dg/graphite/pr42681.C b/gcc/testsuite/g++.dg/graphite/pr42681.C new file mode 100644 index 000000000..4c137ec06 --- /dev/null +++ b/gcc/testsuite/g++.dg/graphite/pr42681.C @@ -0,0 +1,17 @@ +/* { dg-options "-O1 -fgraphite-identity -fno-loop-block -fno-loop-interchange -fno-loop-strip-mine" } */ + +typedef __SIZE_TYPE__ size_t; +inline void* operator new(size_t, void* __p) throw() { return __p; } + +struct A { + int i, j; + A() : i(0) {} +}; + +void Init(A *a) +{ + for (int i = 0; i < 20; i++) { + new (&a[i]) A; + a[i].j = 0; + } +} diff --git a/gcc/testsuite/g++.dg/graphite/pr42930.C b/gcc/testsuite/g++.dg/graphite/pr42930.C new file mode 100644 index 000000000..c1150ce93 --- /dev/null +++ b/gcc/testsuite/g++.dg/graphite/pr42930.C @@ -0,0 +1,55 @@ +/* { dg-options "-O1 -floop-block" } */ + +typedef unsigned char byte; +typedef unsigned int uint; +typedef unsigned char uint8; +namespace Common { +class NonCopyable { +}; +template<class In, class Out> +Out copy(In first, In last, Out dst) { + while (first != last) + *dst++ = *first++; +} +template<class T> +class Array { + uint _size; + T *_storage; +public: + Array<T>& operator=(const Array<T> &array) { + copy(array._storage, array._storage + _size, _storage); + } +}; +} +namespace Graphics { +struct PixelFormat { + inline PixelFormat() { + } + inline PixelFormat(byte BytesPerPixel, + byte RBits, byte GBits, byte BBits, byte ABits, + byte RShift, byte GShift, byte BShift, byte AShift) { + } +}; +}; +namespace Cine { +static const Graphics::PixelFormat kLowPalFormat(2, 3, 3, 3, 0, 8, 4, 0, 0); +class Palette { +public: + struct Color { + uint8 r, g, b; + }; + Palette(const Graphics::PixelFormat format = Graphics::PixelFormat(), const uint numColors = 0); + bool empty() const; + bool isValid() const; + Common::Array<Color> _colors; +}; +class FWRenderer : public Common::NonCopyable { + Cine::Palette _activePal; + void drawCommand(); +}; +void FWRenderer::drawCommand() { + if (!_activePal.isValid() || _activePal.empty()) { + _activePal = Cine::Palette(kLowPalFormat, 16); + } +} +} diff --git a/gcc/testsuite/g++.dg/graphite/pr43026.C b/gcc/testsuite/g++.dg/graphite/pr43026.C new file mode 100644 index 000000000..c88019703 --- /dev/null +++ b/gcc/testsuite/g++.dg/graphite/pr43026.C @@ -0,0 +1,51 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fgraphite-identity" } */ + +template<typename Tp > class vector { }; + +template <int rank, int dim> class Tensor; + +template <int dim> class Tensor<1,dim> { +public: + Tensor (const Tensor<1,dim> &); +private: + double values[(dim != 0) ? (dim) : 1]; +}; + +template <int dim> +#ifdef NOINLINE +// declaring this noinline prevents the ICE +__attribute__ ((noinline)) +#endif +Tensor<1,dim>::Tensor (const Tensor<1,dim> &p) +{ + for (unsigned int i = 0; i < dim; ++i) + values[i] = p.values[i]; +} + +template <int rank, int dim> +class Tensor { + Tensor<rank-1,dim> subtensor[dim]; +}; + +template <int dim> class Base { +public: + const unsigned int npoints; + const unsigned int dofs; + const Tensor<2,dim> &s2d (const unsigned int fno, + const unsigned int pno) const; + void getf2d (vector<Tensor<2,dim> >& d2) const; +}; + +template <int dim> +void Base<dim>:: getf2d + (vector<Tensor<2,dim> > &d2) const +{ + unsigned int point, sf; + + for (point = 0; point < npoints; ++point) + for (sf = 0; sf < dofs; ++sf) + Tensor<2,dim> tmp = s2d (sf, point); +} + +template void Base<3>::getf2d (vector<Tensor<2,3> > &) const; |