E.V.E
v2023.02.15
 
Loading...
Searching...
No Matches

◆ simd_cast

auto eve::simd_cast = functor<simd_cast_t>
inlineconstexpr

Defined in Header

#include <eve/module/core.hpp>

This cast reinterprets one eve::simd_value as the other, if such reinterpretation is available. If the output is smaller in size, the extra bits are dropped. If the output is bigger, the value of extra bits is unspecified.

What can be simd_cast?

  • any eve::plain_simd_value to any other eve::plain_simd_value
  • product_simd_value to a product_simd_value iff each fields can be simd_cast to the corresponding field.
  • if is_wide_logical: logical_simd_value behaves same as plain_simd_value
  • if !is_wide_logical: any logical_simd_value can cast to any other logical_simd_value, but semantics changes, based on the representation of the logical.
  • on rvv platform allows for an efficient cast between logical and plain_simd_value.

Callable Signatures

namespace eve
{
template <eve::simd_value T, eve::simd_value Target>
requires /* see documentation*/
Target simd_cast(T x, eve::as<Target> tgt);
}
constexpr auto simd_cast
casting bits between simd values.
Definition simd_cast.hpp:112
EVE Main Namespace.
Definition abi.hpp:18
Lightweight type-wrapper.
Definition as.hpp:29

Parameters

Return value

bits from x reinterpreted as a new type, accoridng to the rules described earlier.

Example

#include <eve/module/core.hpp>
#include <iostream>
int main()
{
eve::wide<int, eve::fixed<4>> in {-1, 1, 2, 3};
auto out = eve::simd_cast(in, eve::as<eve::wide<std::uint8_t, eve::fixed<8>>>{});
// Should print two first integers as bytes
std::cout << out << std::endl;
}
SIMD register cardinal type.
Definition cardinal.hpp:15
Wrapper for SIMD registers.
Definition wide.hpp:70