• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.casts]
14 // template <class T, class U, class Abi> see below ex::simd_cast<(const
15 // ex::simd<U, Abi>&);
16 
17 #include <experimental/simd>
18 #include <cstdint>
19 
20 #include "test_macros.h"
21 
22 namespace ex = std::experimental::parallelism_v2;
23 
24 static_assert(
25     std::is_same<decltype(ex::simd_cast<int32_t>(ex::native_simd<int32_t>())),
26                  ex::native_simd<int32_t>>::value,
27     "");
28 
29 static_assert(std::is_same<decltype(ex::simd_cast<int64_t>(
30                                ex::fixed_size_simd<int32_t, 4>())),
31                            ex::fixed_size_simd<int64_t, 4>>::value,
32               "");
33 
34 static_assert(
35     std::is_same<decltype(ex::simd_cast<ex::fixed_size_simd<int64_t, 1>>(
36                      ex::simd<int32_t, ex::simd_abi::scalar>())),
37                  ex::fixed_size_simd<int64_t, 1>>::value,
38     "");
39 
40 static_assert(
41     std::is_same<
42         decltype(ex::simd_cast<ex::simd<int64_t, ex::simd_abi::scalar>>(
43             ex::fixed_size_simd<int32_t, 1>())),
44         ex::simd<int64_t, ex::simd_abi::scalar>>::value,
45     "");
46 
main(int,char **)47 int main(int, char**) {
48   return 0;
49 }
50