| 1 |
// { dg-options "-mdejagnu-cpu=power8 -mvsx -O3 -fstack-protector" } |
| 2 |
// { dg-require-effective-target powerpc_vsx } */ |
| 3 |
|
| 4 |
// PAR target/71294 failed because RELOAD could not figure how create a V2DI |
| 5 |
// vector that auto vectorization created with each element being the same |
| 6 |
// stack address, with stack-protector turned on. |
| 7 |
|
| 8 |
class A; |
| 9 |
template <typename _Tp, int m, int n> class B { |
| 10 |
public: |
| 11 |
_Tp val[m * n]; |
| 12 |
}; |
| 13 |
class C { |
| 14 |
public: |
| 15 |
C(A); |
| 16 |
}; |
| 17 |
struct D { |
| 18 |
D(); |
| 19 |
unsigned long &operator[](int); |
| 20 |
unsigned long *p; |
| 21 |
}; |
| 22 |
class A { |
| 23 |
public: |
| 24 |
template <typename _Tp, int m, int n> A(const B<_Tp, m, n> &, bool); |
| 25 |
int rows, cols; |
| 26 |
unsigned char *data; |
| 27 |
unsigned char *datastart; |
| 28 |
unsigned char *dataend; |
| 29 |
unsigned char *datalimit; |
| 30 |
D step; |
| 31 |
}; |
| 32 |
template <typename _Tp, int m, int n> |
| 33 |
A::A(const B<_Tp, m, n> &p1, bool) |
| 34 |
: rows(m), cols(n) { |
| 35 |
step[0] = cols * sizeof(_Tp); |
| 36 |
datastart = data = (unsigned char *)p1.val; |
| 37 |
datalimit = dataend = datastart + rows * step[0]; |
| 38 |
} |
| 39 |
class F { |
| 40 |
public: |
| 41 |
static void compute(C); |
| 42 |
template <typename _Tp, int m, int n, int nm> |
| 43 |
static void compute(const B<_Tp, m, n> &, B<_Tp, nm, 1> &, B<_Tp, m, nm> &, |
| 44 |
B<_Tp, n, nm> &); |
| 45 |
}; |
| 46 |
D::D() {} |
| 47 |
unsigned long &D::operator[](int p1) { return p[p1]; } |
| 48 |
template <typename _Tp, int m, int n, int nm> |
| 49 |
void F::compute(const B<_Tp, m, n> &, B<_Tp, nm, 1> &, B<_Tp, m, nm> &, |
| 50 |
B<_Tp, n, nm> &p4) { |
| 51 |
A a(p4, false); |
| 52 |
compute(a); |
| 53 |
} |
| 54 |
void fn1() { |
| 55 |
B<double, 4, 4> b, c, e; |
| 56 |
B<double, 4, 1> d; |
| 57 |
F::compute(b, d, c, e); |
| 58 |
} |