mirror of
https://github.com/autc04/Retro68.git
synced 2024-12-01 11:52:47 +00:00
239 lines
5.8 KiB
C
239 lines
5.8 KiB
C
extern "C" void abort ();
|
|
|
|
int as[2];
|
|
int (&a)[2] = as;
|
|
long long int bs[7] = { 9, 11, 1, 1, 1, 13, 15 };
|
|
long long int (&b)[7] = bs;
|
|
int es[3] = { 5, 0, 5 };
|
|
int (&e)[3] = es;
|
|
int fs[5] = { 6, 7, 0, 0, 9 };
|
|
int (&f)[5] = fs;
|
|
int gs[4] = { 1, 0, 0, 2 };
|
|
int (&g)[4] = gs;
|
|
int hs[3] = { 0, 1, 4 };
|
|
int (&h)[3] = hs;
|
|
int ks[4][2] = { { 5, 6 }, { 0, 0 }, { 0, 0 }, { 7, 8 } };
|
|
int (&k)[4][2] = ks;
|
|
long long *ss;
|
|
long long *&s = ss;
|
|
long long (*ts)[2];
|
|
long long (*&t)[2] = ts;
|
|
|
|
template <typename T>
|
|
void
|
|
foo (T &n, T *&c, long long int *&d, T (&m)[3], T *&r, T (&o)[4], T *&p, T (&q)[4][2])
|
|
{
|
|
T i;
|
|
for (i = 0; i < 2; i++)
|
|
#pragma omp task in_reduction (+: a, c[:2]) in_reduction (*: b[2 * n:3 * n], d[0:2]) \
|
|
in_reduction (+: o[n:n*2], m[1], k[1:2][:], p[0], f[2:2]) \
|
|
in_reduction (+: q[1:2][:], g[n:n*2], e[1], h[0], r[2:2]) \
|
|
in_reduction (*: s[1:2], t[2:2][:])
|
|
{
|
|
a[0] += 7;
|
|
a[1] += 17;
|
|
b[2] *= 2;
|
|
b[4] *= 2;
|
|
c[0] += 6;
|
|
d[1] *= 2;
|
|
e[1] += 19;
|
|
f[2] += 21;
|
|
f[3] += 23;
|
|
g[1] += 25;
|
|
g[2] += 27;
|
|
h[0] += 29;
|
|
k[1][0] += 31;
|
|
k[2][1] += 33;
|
|
m[1] += 19;
|
|
r[2] += 21;
|
|
r[3] += 23;
|
|
o[1] += 25;
|
|
o[2] += 27;
|
|
p[0] += 29;
|
|
q[1][0] += 31;
|
|
q[2][1] += 33;
|
|
s[1] *= 2;
|
|
t[2][0] *= 2;
|
|
t[3][1] *= 2;
|
|
}
|
|
}
|
|
|
|
template <typename T>
|
|
void
|
|
test (T &n)
|
|
{
|
|
T cs[2] = { 0, 0 };
|
|
T (&c)[2] = cs;
|
|
T ps[3] = { 0, 1, 4 };
|
|
T (&p)[3] = ps;
|
|
T qs[4][2] = { { 5, 6 }, { 0, 0 }, { 0, 0 }, { 7, 8 } };
|
|
T (&q)[4][2] = qs;
|
|
long long sb[4] = { 5, 1, 1, 6 };
|
|
long long tb[5][2] = { { 9, 10 }, { 11, 12 }, { 1, 1 }, { 1, 1 }, { 13, 14 } };
|
|
T ms[3] = { 5, 0, 5 };
|
|
T os[4] = { 1, 0, 0, 2 };
|
|
s = sb;
|
|
t = tb;
|
|
#pragma omp parallel
|
|
#pragma omp single
|
|
{
|
|
long long int ds[] = { 1, 1 };
|
|
long long int (&d)[2] = ds;
|
|
T (&m)[3] = ms;
|
|
T rs[5] = { 6, 7, 0, 0, 9 };
|
|
T (&r)[5] = rs;
|
|
T (&o)[4] = os;
|
|
#pragma omp taskgroup task_reduction (+: a, c) task_reduction (*: b[2 * n:3 * n], d) \
|
|
task_reduction (+: e[1], f[2:2], g[n:n*2], h[0], k[1:2][0:2]) \
|
|
task_reduction (+: o[n:n*2], m[1], q[1:2][:], p[0], r[2:2]) \
|
|
task_reduction (*: t[2:2][:], s[1:n + 1])
|
|
{
|
|
T i;
|
|
for (i = 0; i < 4; i++)
|
|
#pragma omp task in_reduction (+: a, c) in_reduction (*: b[2 * n:3 * n], d) \
|
|
in_reduction (+: o[n:n*2], q[1:2][:], p[0], m[1], r[2:2]) \
|
|
in_reduction (+: g[n:n * 2], e[1], k[1:2][:], h[0], f[2:2]) \
|
|
in_reduction (*: s[1:2], t[2:2][:])
|
|
{
|
|
T j;
|
|
a[0] += 2;
|
|
a[1] += 3;
|
|
b[2] *= 2;
|
|
f[3] += 8;
|
|
g[1] += 9;
|
|
g[2] += 10;
|
|
h[0] += 11;
|
|
k[1][1] += 13;
|
|
k[2][1] += 15;
|
|
m[1] += 16;
|
|
r[2] += 8;
|
|
s[1] *= 2;
|
|
t[2][1] *= 2;
|
|
t[3][1] *= 2;
|
|
for (j = 0; j < 2; j++)
|
|
#pragma omp task in_reduction (+: a, c[:2]) \
|
|
in_reduction (*: b[2 * n:3 * n], d[n - 1:n + 1]) \
|
|
in_reduction (+: e[1], f[2:2], g[n:n*2], h[0], k[1:2][:2]) \
|
|
in_reduction (+: m[1], r[2:2], o[n:n*2], p[0], q[1:2][:2]) \
|
|
in_reduction (*: s[n:2], t[2:2][:])
|
|
{
|
|
m[1] += 6;
|
|
r[2] += 7;
|
|
q[1][0] += 17;
|
|
q[2][0] += 19;
|
|
a[0] += 4;
|
|
a[1] += 5;
|
|
b[3] *= 2;
|
|
b[4] *= 2;
|
|
f[3] += 18;
|
|
g[1] += 29;
|
|
g[2] += 18;
|
|
h[0] += 19;
|
|
s[2] *= 2;
|
|
t[2][0] *= 2;
|
|
t[3][0] *= 2;
|
|
T *cp = c;
|
|
long long int *dp = d;
|
|
T *rp = r;
|
|
T *pp = p;
|
|
foo (n, cp, dp, m, rp, o, pp, q);
|
|
r[3] += 18;
|
|
o[1] += 29;
|
|
o[2] += 18;
|
|
p[0] += 19;
|
|
c[0] += 4;
|
|
c[1] += 5;
|
|
d[0] *= 2;
|
|
e[1] += 6;
|
|
f[2] += 7;
|
|
k[1][0] += 17;
|
|
k[2][0] += 19;
|
|
}
|
|
r[3] += 8;
|
|
o[1] += 9;
|
|
o[2] += 10;
|
|
p[0] += 11;
|
|
q[1][1] += 13;
|
|
q[2][1] += 15;
|
|
b[3] *= 2;
|
|
c[0] += 4;
|
|
c[1] += 9;
|
|
d[0] *= 2;
|
|
e[1] += 16;
|
|
f[2] += 8;
|
|
}
|
|
}
|
|
if (d[0] != 1LL << (8 + 4)
|
|
|| d[1] != 1LL << 16
|
|
|| m[0] != 5
|
|
|| m[1] != 19 * 16 + 6 * 8 + 16 * 4
|
|
|| m[2] != 5
|
|
|| r[0] != 6
|
|
|| r[1] != 7
|
|
|| r[2] != 21 * 16 + 7 * 8 + 8 * 4
|
|
|| r[3] != 23 * 16 + 18 * 8 + 8 * 4
|
|
|| r[4] != 9
|
|
|| o[0] != 1
|
|
|| o[1] != 25 * 16 + 29 * 8 + 9 * 4
|
|
|| o[2] != 27 * 16 + 18 * 8 + 10 * 4
|
|
|| o[3] != 2)
|
|
abort ();
|
|
}
|
|
if (a[0] != 7 * 16 + 4 * 8 + 2 * 4
|
|
|| a[1] != 17 * 16 + 5 * 8 + 3 * 4
|
|
|| b[0] != 9 || b[1] != 11
|
|
|| b[2] != 1LL << (16 + 4)
|
|
|| b[3] != 1LL << (8 + 4)
|
|
|| b[4] != 1LL << (16 + 8)
|
|
|| b[5] != 13 || b[6] != 15
|
|
|| c[0] != 6 * 16 + 4 * 8 + 4 * 4
|
|
|| c[1] != 5 * 8 + 9 * 4
|
|
|| e[0] != 5
|
|
|| e[1] != 19 * 16 + 6 * 8 + 16 * 4
|
|
|| e[2] != 5
|
|
|| f[0] != 6
|
|
|| f[1] != 7
|
|
|| f[2] != 21 * 16 + 7 * 8 + 8 * 4
|
|
|| f[3] != 23 * 16 + 18 * 8 + 8 * 4
|
|
|| f[4] != 9
|
|
|| g[0] != 1
|
|
|| g[1] != 25 * 16 + 29 * 8 + 9 * 4
|
|
|| g[2] != 27 * 16 + 18 * 8 + 10 * 4
|
|
|| g[3] != 2
|
|
|| h[0] != 29 * 16 + 19 * 8 + 11 * 4
|
|
|| h[1] != 1 || h[2] != 4
|
|
|| k[0][0] != 5 || k[0][1] != 6
|
|
|| k[1][0] != 31 * 16 + 17 * 8
|
|
|| k[1][1] != 13 * 4
|
|
|| k[2][0] != 19 * 8
|
|
|| k[2][1] != 33 * 16 + 15 * 4
|
|
|| k[3][0] != 7 || k[3][1] != 8
|
|
|| p[0] != 29 * 16 + 19 * 8 + 11 * 4
|
|
|| p[1] != 1 || p[2] != 4
|
|
|| q[0][0] != 5 || q[0][1] != 6
|
|
|| q[1][0] != 31 * 16 + 17 * 8
|
|
|| q[1][1] != 13 * 4
|
|
|| q[2][0] != 19 * 8
|
|
|| q[2][1] != 33 * 16 + 15 * 4
|
|
|| q[3][0] != 7 || q[3][1] != 8
|
|
|| sb[0] != 5
|
|
|| sb[1] != 1LL << (16 + 4)
|
|
|| sb[2] != 1LL << 8
|
|
|| sb[3] != 6
|
|
|| tb[0][0] != 9 || tb[0][1] != 10 || tb[1][0] != 11 || tb[1][1] != 12
|
|
|| tb[2][0] != 1LL << (16 + 8)
|
|
|| tb[2][1] != 1LL << 4
|
|
|| tb[3][0] != 1LL << 8
|
|
|| tb[3][1] != 1LL << (16 + 4)
|
|
|| tb[4][0] != 13 || tb[4][1] != 14)
|
|
abort ();
|
|
}
|
|
|
|
int
|
|
main ()
|
|
{
|
|
int n = 1;
|
|
test (n);
|
|
return 0;
|
|
}
|