| 1 |
// { dg-lto-do assemble } |
| 2 |
// { dg-lto-options { { -O -flto } } } |
| 3 |
|
| 4 |
template <typename scalar_t, unsigned length> |
| 5 |
struct builtin_simd |
| 6 |
{ |
| 7 |
using type [[gnu::vector_size(sizeof(scalar_t) * length)]] = scalar_t; |
| 8 |
}; |
| 9 |
|
| 10 |
struct simd_traits |
| 11 |
{ |
| 12 |
using scalar_type = int; |
| 13 |
|
| 14 |
template <typename new_scalar_type> |
| 15 |
using rebind = typename builtin_simd<new_scalar_type, 1>::type; |
| 16 |
}; |
| 17 |
|
| 18 |
template <typename simd_t> |
| 19 |
constexpr simd_t fill(typename simd_traits::scalar_type const scalar) |
| 20 |
{ |
| 21 |
return simd_t{scalar}; |
| 22 |
} |
| 23 |
|
| 24 |
class Test |
| 25 |
{ |
| 26 |
using score_type = typename builtin_simd<int, 1>::type; |
| 27 |
score_type data[1]{fill<score_type>(8)}; |
| 28 |
}; |
| 29 |
|
| 30 |
struct TestFactoryBase |
| 31 |
{ |
| 32 |
virtual Test *CreateTest() = 0; |
| 33 |
}; |
| 34 |
|
| 35 |
template <class TestClass> |
| 36 |
struct TestFactoryImpl : public TestFactoryBase |
| 37 |
{ |
| 38 |
Test *CreateTest() override { return new TestClass; } |
| 39 |
}; |
| 40 |
|
| 41 |
void MakeAndRegisterTestInfo(TestFactoryBase *factory); |
| 42 |
|
| 43 |
int main() { |
| 44 |
MakeAndRegisterTestInfo(new TestFactoryImpl<Test>); |
| 45 |
} |