1 //===----------------------------------------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // UNSUPPORTED: c++98, c++03, c++11, c++14
11
12 // <experimental/simd>
13 //
14 // [simd.abi]
15
16 #include <experimental/simd>
17 #include <cstdint>
18
19 namespace ex = std::experimental::parallelism_v2;
20
reg_width()21 constexpr inline int reg_width() {
22 #if defined(__AVX__)
23 return 32;
24 #else
25 return 16;
26 #endif
27 }
28
29 #ifndef _LIBCPP_HAS_NO_VECTOR_EXTENSION
30
31 static_assert(
32 sizeof(ex::simd<char, ex::__simd_abi<ex::_StorageKind::_VecExt, 1>>) == 1,
33 "");
34 static_assert(
35 sizeof(ex::simd<char, ex::__simd_abi<ex::_StorageKind::_VecExt, 2>>) == 2,
36 "");
37 static_assert(
38 sizeof(ex::simd<char, ex::__simd_abi<ex::_StorageKind::_VecExt, 3>>) == 4,
39 "");
40 static_assert(
41 sizeof(ex::simd<char, ex::__simd_abi<ex::_StorageKind::_VecExt, 12>>) == 16,
42 "");
43 static_assert(
44 sizeof(ex::simd<int32_t, ex::__simd_abi<ex::_StorageKind::_VecExt, 3>>) ==
45 16,
46 "");
47 static_assert(
48 sizeof(ex::simd<int32_t, ex::__simd_abi<ex::_StorageKind::_VecExt, 5>>) ==
49 32,
50 "");
51 static_assert(
52 std::is_same<ex::simd_abi::native<int8_t>,
53 ex::__simd_abi<ex::_StorageKind::_VecExt, reg_width()>>::value,
54 "");
55 #else
56 static_assert(
57 std::is_same<ex::simd_abi::native<int8_t>,
58 ex::__simd_abi<ex::_StorageKind::_Array, reg_width()>>::value,
59 "");
60
61 #endif
62
63 static_assert(std::is_same<ex::simd_abi::compatible<int8_t>,
64 ex::__simd_abi<ex::_StorageKind::_Array, 16>>::value,
65 "");
66
main()67 int main() {}
68