| 1 |
/* PR target/99842 */ |
| 2 |
/* { dg-require-effective-target power10_ok } */ |
| 3 |
/* { dg-options "-O3 -mdejagnu-cpu=power10 -Wno-return-type" } */ |
| 4 |
|
| 5 |
/* Verify we do not ICE on the following noisy creduced test case. */ |
| 6 |
|
| 7 |
enum { a, b, c, d }; |
| 8 |
template <typename> struct e; |
| 9 |
template <typename g, typename h, typename k> struct e<g(h, k)> { |
| 10 |
typedef h f; |
| 11 |
}; |
| 12 |
template <typename> struct ac; |
| 13 |
template <typename ab> struct ac<const ab> : ac<ab> {}; |
| 14 |
template <typename> struct l; |
| 15 |
template <typename, int, int m, int = 0, int = a, int = m> class n; |
| 16 |
template <typename> class o; |
| 17 |
template <typename, typename, typename> class ag; |
| 18 |
template <typename, typename, int = c> class af; |
| 19 |
template <typename> struct ad; |
| 20 |
template <typename ab> struct an { |
| 21 |
typedef n<typename ab ::ah, ac<ab>::ai, ac<ab>::aj> f; |
| 22 |
}; |
| 23 |
template <typename al> struct am { typedef o<al> f; }; |
| 24 |
template <typename al, typename = typename ac<al>::ao, |
| 25 |
typename = typename ac<al>::av> |
| 26 |
struct ak; |
| 27 |
template <typename al, typename ao> struct ak<al, ao, int> { |
| 28 |
typedef typename am<al>::f f; |
| 29 |
}; |
| 30 |
template <typename, typename, typename> struct aq; |
| 31 |
template <typename ar, typename as> struct aq<ar, ar, as> { typedef ar at; }; |
| 32 |
template <typename ap> ap bf(const typename ad<ap>::f *); |
| 33 |
template <typename ap, int> ap aw(typename ad<ap>::f *ax) { return bf<ap>(ax); } |
| 34 |
typedef __attribute__((altivec(vector__))) double au; |
| 35 |
template <> struct ad<au> { typedef double f; }; |
| 36 |
template <> au bf(const double *ax) { return __builtin_vec_vsx_ld(0, ax); } |
| 37 |
template <typename> struct az {}; |
| 38 |
template <typename al> class o : public l<al> { |
| 39 |
public: |
| 40 |
typedef typename ac<al>::ah ah; |
| 41 |
template <typename ay> al &operator+=(const o<ay> &); |
| 42 |
}; |
| 43 |
template <typename> struct l {}; |
| 44 |
template <typename ba, typename bb, int bd> struct ac<af<ba, bb, bd>> { |
| 45 |
typedef typename ba::ah ah; |
| 46 |
enum { ai, aj }; |
| 47 |
}; |
| 48 |
template <typename, typename, int bd> |
| 49 |
class af |
| 50 |
: public ak< |
| 51 |
af<ag<int, const n<double, -1, -1, 3>, const n<double, -1, -1, 3>>, |
| 52 |
n<double, -1, 1, 3>, bd>, |
| 53 |
int, int>::f {}; |
| 54 |
template <typename, typename, typename> struct be; |
| 55 |
template <typename bj, typename bg, typename g> void bi(bj, bg bm, g) { |
| 56 |
typename an<bg>::f bk(bm); |
| 57 |
} |
| 58 |
template <typename bj, typename bg, typename g> void bl(bj, bg bm, g bp) { |
| 59 |
be<bj, bg, g>::bn(a, bm, bp); |
| 60 |
} |
| 61 |
template <typename, typename, typename, typename> struct bo; |
| 62 |
class bs { |
| 63 |
public: |
| 64 |
bs(double *, int); |
| 65 |
double &operator()(int, int) { return bq[br]; } |
| 66 |
template <typename bw, int> bw bt(int i, int j) { |
| 67 |
double &bu = operator()(i, j); |
| 68 |
return aw<bw, b>(&bu); |
| 69 |
} |
| 70 |
double *bq; |
| 71 |
int br; |
| 72 |
}; |
| 73 |
class ca : public bs { |
| 74 |
public: |
| 75 |
ca(double *by, int bz) : bs(by, bz) {} |
| 76 |
}; |
| 77 |
template <typename al> class ce : public am<al>::f { |
| 78 |
protected: |
| 79 |
template <typename ay> void cb(l<ay>) { |
| 80 |
af<ag<int, const n<double, -1, -1, 3>, const n<double, -1, -1, 3>>, |
| 81 |
n<double, -1, 1, 3>> |
| 82 |
cc; |
| 83 |
bl(0, cc, az<typename ay::ah>()); |
| 84 |
} |
| 85 |
template <typename> void ch(long); |
| 86 |
template <typename ay> void ch(l<ay> cf) { cb(cf); } |
| 87 |
}; |
| 88 |
template <typename cg, int aa, int m, int cl, int ci, int cj> |
| 89 |
struct ac<n<cg, aa, m, cl, ci, cj>> { |
| 90 |
typedef cg ah; |
| 91 |
typedef int av; |
| 92 |
}; |
| 93 |
template <typename cg, int, int m, int, int, int> |
| 94 |
class n : public ce<n<cg, m, c>> { |
| 95 |
public: |
| 96 |
template <typename ab> n(ab p) { n::template ch<ab>(p); } |
| 97 |
}; |
| 98 |
template <typename bc, typename ba, typename bb> struct ac<ag<bc, ba, bb>> { |
| 99 |
typedef ba ao; |
| 100 |
typedef typename e<bc(typename ba::ah, typename bb::ah)>::f ah; |
| 101 |
typedef typename aq<typename ac<ba>::av, typename ac<bb>::av, bc>::at av; |
| 102 |
}; |
| 103 |
template <typename> class cm; |
| 104 |
template <typename, typename r, typename cs> |
| 105 |
class ag |
| 106 |
: public cm<typename aq<typename ac<r>::av, typename ac<cs>::av, int>::at> { |
| 107 |
}; |
| 108 |
template <typename> |
| 109 |
class cm : public ak<ag<int, n<double, 1, 1>, n<double, 1, 1>>>::f {}; |
| 110 |
template <typename al> |
| 111 |
template <typename ay> |
| 112 |
al &o<al>::operator+=(const o<ay> &) { |
| 113 |
af<ag<int, const n<double, -1, -1, 3>, const n<double, -1, -1, 3>>, |
| 114 |
n<double, -1, 1, 3>> |
| 115 |
co; |
| 116 |
bi(0, co, int()); |
| 117 |
} |
| 118 |
enum { cp }; |
| 119 |
template <int> struct cq; |
| 120 |
template <typename> struct cr { |
| 121 |
enum { q }; |
| 122 |
enum { ae = cq<q>::at }; |
| 123 |
}; |
| 124 |
template <> struct cq<cp> { |
| 125 |
enum { at = d }; |
| 126 |
}; |
| 127 |
struct t { |
| 128 |
template <typename ba, typename bb, typename s> static void bn(ba, bb, s) { |
| 129 |
typedef typename bb::ah x; |
| 130 |
x u; |
| 131 |
bo<long, ca, x, ca>::bn(0, 0, ca(0, 0), ca(&u, 1), 0, 0, 0); |
| 132 |
} |
| 133 |
}; |
| 134 |
template <typename, typename bb, int = cr<bb>::ae> struct cu; |
| 135 |
template <typename cd, typename ba, typename bb, int ct, typename ah> |
| 136 |
struct be<cd, af<ba, bb, ct>, az<ah>> { |
| 137 |
static void bn(cd, af<ba, bb> bm, az<ah>) { |
| 138 |
ag<int, const n<double, -1, -1, 3>, const n<double, -1, -1, 3>> da; |
| 139 |
cu<ba, bb>::cv(c, da, bm); |
| 140 |
} |
| 141 |
}; |
| 142 |
template <typename al> struct cw { |
| 143 |
template <typename bj> |
| 144 |
static void |
| 145 |
cv(bj, ag<int, const n<double, -1, -1, 3>, const n<double, -1, -1, 3>>, |
| 146 |
n<double, -1, 1, 3> bx) { |
| 147 |
double alpha; |
| 148 |
ag<int, const n<double, -1, -1, 3>, const n<double, -1, -1, 3>> bh; |
| 149 |
al::cx(c, bh, bx, alpha); |
| 150 |
} |
| 151 |
}; |
| 152 |
template <typename ba, typename bb> struct cu<ba, bb, d> : cw<cu<ba, bb>> { |
| 153 |
template <typename s> static void cx(s, ba, bb bx, typename af<ba, bb>::ah) { |
| 154 |
ba cz; |
| 155 |
t::bn(cz, bx, c); |
| 156 |
} |
| 157 |
}; |
| 158 |
template <typename dj, typename, bool> |
| 159 |
void db(__vector_quad *, __vector_pair &, dj); |
| 160 |
template <typename, typename, typename, typename, typename, typename, int> |
| 161 |
void dc(ca alhs) { |
| 162 |
typedef au dj; |
| 163 |
typedef au dd; |
| 164 |
ca bh(alhs); |
| 165 |
enum { de }; |
| 166 |
__vector_quad df, dg; |
| 167 |
int j; |
| 168 |
dd v; |
| 169 |
__vector_pair dh; |
| 170 |
__builtin_mma_assemble_pair( |
| 171 |
&dh, (__attribute__((altivec(vector__))) char)bh.bt<dj, de>(0, j), |
| 172 |
(__attribute__((altivec(vector__))) char)bh.bt<dj, de>(0, j)); |
| 173 |
db<dj, dd, true>(&df, dh, v); |
| 174 |
__vector_pair di; |
| 175 |
__builtin_mma_assemble_pair( |
| 176 |
&di, (__attribute__((altivec(vector__))) char)bh.bt<dj, de>(0, j), |
| 177 |
(__attribute__((altivec(vector__))) char)bh.bt<dj, de>(0, j)); |
| 178 |
db<dj, dd, true>(&dg, di, v); |
| 179 |
} |
| 180 |
template <typename bv, typename w, typename cy> struct bo<bv, w, double, cy> { |
| 181 |
static void bn(bv, bv, w bh, cy, double, bv, double) { |
| 182 |
dc<bv, double, w, double, cy, double, d>(bh); |
| 183 |
} |
| 184 |
}; |
| 185 |
void dm() { |
| 186 |
n<double, 1, 1> dk(1), y(0); |
| 187 |
y += dk; |
| 188 |
} |