| 1 |
// { dg-do compile { target i?86-*-* x86_64-*-* } } |
| 2 |
// { dg-options "-std=c++11 -O3 -march=westmere" } |
| 3 |
|
| 4 |
template <typename T> struct A { typedef typename T::next type; }; |
| 5 |
template <typename> struct B; |
| 6 |
template <typename T> struct N : T {}; |
| 7 |
template <int N> struct C { |
| 8 |
static const int value = N; |
| 9 |
typedef C<N + 1> next; |
| 10 |
}; |
| 11 |
template <typename Sequence> |
| 12 |
struct R : N<typename B<typename Sequence::tag>::template P<Sequence>> {}; |
| 13 |
template <typename Base> struct O : Base { |
| 14 |
typedef typename A<typename Base::size>::type size; |
| 15 |
}; |
| 16 |
template <typename = int> struct D { |
| 17 |
typedef int tag; |
| 18 |
typedef C<0> size; |
| 19 |
}; |
| 20 |
template <> struct B<int> { |
| 21 |
template <typename> struct P : O<O<O<D<>>>>::size {}; |
| 22 |
}; |
| 23 |
template <typename> struct F; |
| 24 |
template <typename> struct G; |
| 25 |
template <typename, typename, int> struct H; |
| 26 |
template <typename Element, typename Layout> struct H<Element, Layout, 3> {}; |
| 27 |
template <int, typename E, typename L, int N> unsigned char at_c(H<E, L, N>) |
| 28 |
{ |
| 29 |
return 0; |
| 30 |
} |
| 31 |
template <typename> class I; |
| 32 |
template <typename> class J; |
| 33 |
template <typename> class K; |
| 34 |
template <typename, typename> struct Q; |
| 35 |
struct L { |
| 36 |
typedef Q<unsigned char, F<O<O<O<D<>>>>>> *type; |
| 37 |
}; |
| 38 |
template <typename XIterator> struct M { typedef K<J<I<XIterator>>> view_t; }; |
| 39 |
template <typename, typename> |
| 40 |
struct Q : H<unsigned, F<int>, R<O<O<O<D<>>>>>::value> {}; |
| 41 |
template <typename Iterator> struct G<I<Iterator>> { typedef Iterator type; }; |
| 42 |
template <typename> class J { |
| 43 |
public: |
| 44 |
typedef G<I<Q<unsigned, int> *>>::type x_iterator; |
| 45 |
}; |
| 46 |
template <typename> class K { |
| 47 |
public: |
| 48 |
J<int>::x_iterator row_begin(int); |
| 49 |
}; |
| 50 |
template <typename Op> void measure_time(Op p1) { p1(); } |
| 51 |
template <typename, typename> struct fill_nongil_t; |
| 52 |
template <typename T, typename P> |
| 53 |
struct fill_nongil_t<K<J<I<Q<T, F<O<O<O<D<>>>>>> *>>>, P> { |
| 54 |
typedef K<J<I<Q<T, F<O<O<O<D<>>>>>> *>>> View; |
| 55 |
View _v; |
| 56 |
P _p; |
| 57 |
fill_nongil_t(View, P); |
| 58 |
void operator()() { |
| 59 |
T *first = (T *)_v.row_begin(0); |
| 60 |
T last; |
| 61 |
while (first != &last) { |
| 62 |
first[0] = first[1] = at_c<1>(_p); |
| 63 |
first[2] = at_c<2>(_p); |
| 64 |
first += 3; |
| 65 |
} |
| 66 |
} |
| 67 |
}; |
| 68 |
template <typename, typename> void test_fill(int) { |
| 69 |
M<L::type>::view_t __trans_tmp_1; |
| 70 |
measure_time(fill_nongil_t<K<J<I<Q<unsigned char, F<O<O<O<D<>>>>>> *>>>, |
| 71 |
Q<unsigned char, F<O<O<O<D<>>>>>>>( |
| 72 |
__trans_tmp_1, Q<unsigned char, F<O<O<O<D<>>>>>>())); |
| 73 |
} |
| 74 |
void performance_testtest_method() { test_fill<K<int>, Q<unsigned, int>>(0); } |