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++03, c++11, c++14 10 11 // <experimental/simd> 12 // 13 // [simd.abi] 14 15 #include <experimental/simd> 16 #include <cstdint> 17 18 #include "test_macros.h" 19 20 namespace ex = std::experimental::parallelism_v2; 21 22 constexpr inline int reg_width() { 23 #if defined(__AVX__) 24 return 32; 25 #else 26 return 16; 27 #endif 28 } 29 30 #ifndef _LIBCPP_HAS_NO_VECTOR_EXTENSION 31 32 static_assert( 33 sizeof(ex::simd<char, ex::__simd_abi<ex::_StorageKind::_VecExt, 1>>) == 1, 34 ""); 35 static_assert( 36 sizeof(ex::simd<char, ex::__simd_abi<ex::_StorageKind::_VecExt, 2>>) == 2, 37 ""); 38 static_assert( 39 sizeof(ex::simd<char, ex::__simd_abi<ex::_StorageKind::_VecExt, 3>>) == 4, 40 ""); 41 static_assert( 42 sizeof(ex::simd<char, ex::__simd_abi<ex::_StorageKind::_VecExt, 12>>) == 16, 43 ""); 44 static_assert( 45 sizeof(ex::simd<int32_t, ex::__simd_abi<ex::_StorageKind::_VecExt, 3>>) == 46 16, 47 ""); 48 static_assert( 49 sizeof(ex::simd<int32_t, ex::__simd_abi<ex::_StorageKind::_VecExt, 5>>) == 50 32, 51 ""); 52 static_assert( 53 std::is_same<ex::simd_abi::native<int8_t>, 54 ex::__simd_abi<ex::_StorageKind::_VecExt, reg_width()>>::value, 55 ""); 56 #else 57 static_assert( 58 std::is_same<ex::simd_abi::native<int8_t>, 59 ex::__simd_abi<ex::_StorageKind::_Array, reg_width()>>::value, 60 ""); 61 62 #endif 63 64 static_assert(std::is_same<ex::simd_abi::compatible<int8_t>, 65 ex::__simd_abi<ex::_StorageKind::_Array, 16>>::value, 66 ""); 67 68 int main(int, char**) { 69 return 0; 70 } 71