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

◆ simd_cast

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*/
}
constexpr auto simd_cast
casting bits between simd values.
Definition simd_cast.hpp:113
typename decltype(detail::as_translated_type(as< T >{}))::type translate_t
Returns the final translated type of T.
Definition translation.hpp:107
EVE Main Namespace.
Definition abi.hpp:19

Parameters

  • x: [simd_value] to cast
  • tgt: Type wrapper instance embedding the type to cast x to.

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()
{
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;
}
Lightweight type-wrapper.
Definition as.hpp:29
Wrapper for SIMD registers.
Definition wide.hpp:94