| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-add-options vect_early_break } */ |
| 3 |
/* { dg-require-effective-target vect_early_break } */ |
| 4 |
/* { dg-require-effective-target vect_int } */ |
| 5 |
|
| 6 |
/* { dg-additional-options "-w -O2" } */ |
| 7 |
|
| 8 |
void fancy_abort(char *, int, const char *) __attribute__((__noreturn__)); |
| 9 |
template <unsigned N, typename> struct poly_int_pod { int coeffs[N]; }; |
| 10 |
template <unsigned N, typename> class poly_int : public poly_int_pod<N, int> { |
| 11 |
public: |
| 12 |
template <typename Ca> poly_int &operator+=(const poly_int_pod<N, Ca> &); |
| 13 |
}; |
| 14 |
template <unsigned N, typename C> |
| 15 |
template <typename Ca> |
| 16 |
poly_int<N, C> &poly_int<N, C>::operator+=(const poly_int_pod<N, Ca> &a) { |
| 17 |
for (int i = 0; i < N; i++) |
| 18 |
this->coeffs[i] += a.coeffs[i]; |
| 19 |
return *this; |
| 20 |
} |
| 21 |
template <unsigned N, typename Ca, typename Cb> |
| 22 |
poly_int<N, long> exact_div(poly_int_pod<N, Ca>, Cb) { |
| 23 |
poly_int<N, long> r; |
| 24 |
return r; |
| 25 |
} |
| 26 |
struct vec_prefix { |
| 27 |
unsigned m_num; |
| 28 |
}; |
| 29 |
struct vl_ptr; |
| 30 |
struct va_heap { |
| 31 |
typedef vl_ptr default_layout; |
| 32 |
}; |
| 33 |
template <typename, typename A, typename = typename A::default_layout> |
| 34 |
struct vec; |
| 35 |
template <typename T, typename A> struct vec<T, A, int> { |
| 36 |
T &operator[](unsigned); |
| 37 |
vec_prefix m_vecpfx; |
| 38 |
T m_vecdata[]; |
| 39 |
}; |
| 40 |
template <typename T, typename A> T &vec<T, A, int>::operator[](unsigned ix) { |
| 41 |
m_vecpfx.m_num ? fancy_abort("", 9, __FUNCTION__), 0 : 0; |
| 42 |
return m_vecdata[ix]; |
| 43 |
} |
| 44 |
template <typename T> struct vec<T, va_heap> { |
| 45 |
T &operator[](unsigned ix) { return m_vec[ix]; } |
| 46 |
vec<T, va_heap, int> m_vec; |
| 47 |
}; |
| 48 |
class auto_vec : public vec<poly_int<2, long>, va_heap> {}; |
| 49 |
template <typename> class vector_builder : public auto_vec {}; |
| 50 |
class int_vector_builder : public vector_builder<int> { |
| 51 |
public: |
| 52 |
int_vector_builder(poly_int<2, long>, int, int); |
| 53 |
}; |
| 54 |
bool vect_grouped_store_supported() { |
| 55 |
int i; |
| 56 |
poly_int<2, long> nelt; |
| 57 |
int_vector_builder sel(nelt, 2, 3); |
| 58 |
for (i = 0; i < 6; i++) |
| 59 |
sel[i] += exact_div(nelt, 2); |
| 60 |
} |
| 61 |
|