//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 // See GCC PR63723. // UNSUPPORTED: gcc-4.9 // // // [simd.class] // template simd(U&& value); #include #include namespace ex = std::experimental::parallelism_v2; template auto not_supported_native_simd_ctor(Args&&... args) -> decltype(ex::native_simd(std::forward(args)...), void()) = delete; template void not_supported_native_simd_ctor(...) {} template auto supported_native_simd_ctor(Args&&... args) -> decltype(ex::native_simd(std::forward(args)...), void()) {} template void supported_native_simd_ctor(...) = delete; void compile_narrowing_conversion() { supported_native_simd_ctor(3); supported_native_simd_ctor(3); supported_native_simd_ctor(3); supported_native_simd_ctor(3); supported_native_simd_ctor(3); supported_native_simd_ctor(3); supported_native_simd_ctor(3); supported_native_simd_ctor(3); supported_native_simd_ctor(3.f); supported_native_simd_ctor(3.); supported_native_simd_ctor(3.); not_supported_native_simd_ctor(3.); not_supported_native_simd_ctor(long(3)); not_supported_native_simd_ctor(long(3)); not_supported_native_simd_ctor(3.); } void compile_convertible() { struct ConvertibleToInt { operator int64_t() const; }; supported_native_simd_ctor(ConvertibleToInt()); struct NotConvertibleToInt {}; not_supported_native_simd_ctor(NotConvertibleToInt()); } void compile_unsigned() { not_supported_native_simd_ctor(3u); supported_native_simd_ctor(3u); } template void test_broadcast() { SimdType a(3); for (size_t i = 0; i < a.size(); i++) { assert(a[i] == 3); } } int main() { test_broadcast>(); test_broadcast>(); test_broadcast>(); }