libcxx

libcxx mirror with random patches
git clone https://git.neptards.moe/neptards/libcxx.git
Log | Files | Refs

static_simd_cast.pass.cpp (1258B)


      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.casts]
     15 // template <class T, class U, class Abi> see below ex::static_simd_cast<(const
     16 // ex::simd<U, Abi>&);
     17 
     18 #include <experimental/simd>
     19 #include <cstdint>
     20 
     21 namespace ex = std::experimental::parallelism_v2;
     22 
     23 static_assert(
     24     std::is_same<decltype(ex::static_simd_cast<float>(ex::native_simd<int>())),
     25                  ex::native_simd<float>>::value,
     26     "");
     27 
     28 static_assert(
     29     std::is_same<decltype(ex::static_simd_cast<ex::fixed_size_simd<float, 1>>(
     30                      ex::simd<int, ex::simd_abi::scalar>())),
     31                  ex::fixed_size_simd<float, 1>>::value,
     32     "");
     33 
     34 static_assert(
     35     std::is_same<
     36         decltype(ex::static_simd_cast<ex::simd<float, ex::simd_abi::scalar>>(
     37             ex::fixed_size_simd<int, 1>())),
     38         ex::simd<float, ex::simd_abi::scalar>>::value,
     39     "");
     40 
     41 int main() {}