• 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::static_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::static_simd_cast<float>(ex::native_simd<int>())),
26                  ex::native_simd<float>>::value,
27     "");
28 
29 static_assert(
30     std::is_same<decltype(ex::static_simd_cast<ex::fixed_size_simd<float, 1>>(
31                      ex::simd<int, ex::simd_abi::scalar>())),
32                  ex::fixed_size_simd<float, 1>>::value,
33     "");
34 
35 static_assert(
36     std::is_same<
37         decltype(ex::static_simd_cast<ex::simd<float, ex::simd_abi::scalar>>(
38             ex::fixed_size_simd<int, 1>())),
39         ex::simd<float, ex::simd_abi::scalar>>::value,
40     "");
41 
main(int,char **)42 int main(int, char**) {
43   return 0;
44 }
45