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