| 1 |
// { dg-additional-options "-mavx" { target avx_runtime } } |
| 2 |
// { dg-do run } |
| 3 |
// { dg-skip-if "needs gcc/config.d" { ! d_runtime } } |
| 4 |
|
| 5 |
__gshared int testsroa_x; |
| 6 |
|
| 7 |
template SROA(T1, T2) |
| 8 |
{ |
| 9 |
struct FPoint |
| 10 |
{ |
| 11 |
T1 x; |
| 12 |
T2 y; |
| 13 |
} |
| 14 |
|
| 15 |
void sroa(FPoint p1, ref FPoint quad) |
| 16 |
{ |
| 17 |
quad = FPoint(p1.x, p1.y); |
| 18 |
} |
| 19 |
|
| 20 |
void testit() |
| 21 |
{ |
| 22 |
FPoint p1 = FPoint(1, 2); |
| 23 |
|
| 24 |
FPoint quad; |
| 25 |
sroa(p1, quad); |
| 26 |
|
| 27 |
if (quad != p1) |
| 28 |
{ |
| 29 |
assert(0); |
| 30 |
} |
| 31 |
++testsroa_x; |
| 32 |
} |
| 33 |
} |
| 34 |
|
| 35 |
void main() |
| 36 |
{ |
| 37 |
SROA!(int, int ).testit(); |
| 38 |
SROA!(int, float).testit(); |
| 39 |
SROA!(float, float).testit(); |
| 40 |
SROA!(float, int ).testit(); |
| 41 |
|
| 42 |
SROA!(long, long ).testit(); |
| 43 |
SROA!(long, double).testit(); |
| 44 |
SROA!(double, double).testit(); |
| 45 |
SROA!(double, long ).testit(); |
| 46 |
} |