1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 // UNSUPPORTED: c++98, c++03, c++11, c++14 10 11 // <experimental/simd> 12 // 13 // [simd.abi] 14 15 #include <experimental/simd> 16 #include <cstdint> 17 18 namespace ex = std::experimental::parallelism_v2; 19 20 constexpr inline int reg_width() { 21 #if defined(__AVX__) 22 return 32; 23 #else 24 return 16; 25 #endif 26 } 27 28 #ifndef _LIBCPP_HAS_NO_VECTOR_EXTENSION 29 30 static_assert( 31 sizeof(ex::simd<char, ex::__simd_abi<ex::_StorageKind::_VecExt, 1>>) == 1, 32 ""); 33 static_assert( 34 sizeof(ex::simd<char, ex::__simd_abi<ex::_StorageKind::_VecExt, 2>>) == 2, 35 ""); 36 static_assert( 37 sizeof(ex::simd<char, ex::__simd_abi<ex::_StorageKind::_VecExt, 3>>) == 4, 38 ""); 39 static_assert( 40 sizeof(ex::simd<char, ex::__simd_abi<ex::_StorageKind::_VecExt, 12>>) == 16, 41 ""); 42 static_assert( 43 sizeof(ex::simd<int32_t, ex::__simd_abi<ex::_StorageKind::_VecExt, 3>>) == 44 16, 45 ""); 46 static_assert( 47 sizeof(ex::simd<int32_t, ex::__simd_abi<ex::_StorageKind::_VecExt, 5>>) == 48 32, 49 ""); 50 static_assert( 51 std::is_same<ex::simd_abi::native<int8_t>, 52 ex::__simd_abi<ex::_StorageKind::_VecExt, reg_width()>>::value, 53 ""); 54 #else 55 static_assert( 56 std::is_same<ex::simd_abi::native<int8_t>, 57 ex::__simd_abi<ex::_StorageKind::_Array, reg_width()>>::value, 58 ""); 59 60 #endif 61 62 static_assert(std::is_same<ex::simd_abi::compatible<int8_t>, 63 ex::__simd_abi<ex::_StorageKind::_Array, 16>>::value, 64 ""); 65 66 int main(int, char**) { 67 return 0; 68 } 69