simd_cast.pass.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. // UNSUPPORTED: c++98, c++03
  10. // <experimental/simd>
  11. //
  12. // [simd.casts]
  13. // template <class T, class U, class Abi> see below simd_cast(const simd<U, Abi>&);
  14. #include <experimental/simd>
  15. #include <cstdint>
  16. using namespace std::experimental::parallelism_v2;
  17. static_assert(std::is_same<decltype(simd_cast<int32_t>(native_simd<int32_t>())),
  18. native_simd<int32_t>>::value,
  19. "");
  20. static_assert(
  21. std::is_same<decltype(simd_cast<int64_t>(fixed_size_simd<int32_t, 4>())),
  22. fixed_size_simd<int64_t, 4>>::value,
  23. "");
  24. static_assert(std::is_same<decltype(simd_cast<fixed_size_simd<int64_t, 1>>(
  25. simd<int32_t, simd_abi::scalar>())),
  26. fixed_size_simd<int64_t, 1>>::value,
  27. "");
  28. static_assert(std::is_same<decltype(simd_cast<simd<int64_t, simd_abi::scalar>>(
  29. fixed_size_simd<int32_t, 1>())),
  30. simd<int64_t, simd_abi::scalar>>::value,
  31. "");
  32. int main() {}