aboutsummaryrefslogtreecommitdiff
path: root/test/std/experimental/simd/simd.casts/simd_cast.pass.cpp
blob: af6b13fe878db3613685d122b47f14d5611a9371 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++98, c++03

// <experimental/simd>
//
// [simd.casts]
// template <class T, class U, class Abi> see below simd_cast(const simd<U, Abi>&);
#include <experimental/simd>
#include <cstdint>

using namespace std::experimental::parallelism_v2;

static_assert(std::is_same<decltype(simd_cast<int32_t>(native_simd<int32_t>())),
                           native_simd<int32_t>>::value,
              "");

static_assert(
    std::is_same<decltype(simd_cast<int64_t>(fixed_size_simd<int32_t, 4>())),
                 fixed_size_simd<int64_t, 4>>::value,
    "");

static_assert(std::is_same<decltype(simd_cast<fixed_size_simd<int64_t, 1>>(
                               simd<int32_t, simd_abi::scalar>())),
                           fixed_size_simd<int64_t, 1>>::value,
              "");

static_assert(std::is_same<decltype(simd_cast<simd<int64_t, simd_abi::scalar>>(
                               fixed_size_simd<int32_t, 1>())),
                           simd<int64_t, simd_abi::scalar>>::value,
              "");

int main() {}