SuperDex Physics C++ API
Loading...
Searching...
No Matches
simd_arch_emulator_inl.h File Reference
#include "../simd.h"
#include <mochi_core/utils/array.h>
#include <mochi_core/utils/basic_utils.h>
#include <array>
#include <bit>
#include <cmath>
#include <cstring>
#include <type_traits>
#include <utility>

Go to the source code of this file.

Classes

class  superdex::Simd< T, N >

Namespaces

namespace  superdex

Concepts

concept  superdex::IsInvokableWithRaw

Macros

#define MOCHI_SIMD_EMULATOR_HREDUCE_BOOL(Name, Op)
#define MOCHI_SIMD_EMULATOR_OP_1(Op, Expr)
#define MOCHI_SIMD_EMULATOR_OP_2(Op)

Functions

template<class To, class FromT, int FromN>
requires (IsSimd<To> && Simd<FromT, FromN>::kIsSupported)
To superdex::StaticCast (Simd< FromT, FromN > const &in)

Macro Definition Documentation

◆ MOCHI_SIMD_EMULATOR_HREDUCE_BOOL

#define MOCHI_SIMD_EMULATOR_HREDUCE_BOOL ( Name,
Op )
Value:
template <int M = kSize> \
[[nodiscard]] MOCHI_ANY MOCHI_FORCE_INLINE static constexpr bool Name(Simd a) { \
static_assert(M >= 1 && M <= kSize, "Unsupported M"); \
auto eval = []<size_t... I>(Simd const& a, std::index_sequence<I...>) { \
return ((std::bit_cast<UIntT>(a.raw[I]) != UIntT{0}) Op...); \
}; \
return eval(a, std::make_index_sequence<M>{}); \
}
#define MOCHI_FORCE_INLINE
#define MOCHI_ANY

Definition at line 72 of file simd_arch_emulator_inl.h.

◆ MOCHI_SIMD_EMULATOR_OP_1

#define MOCHI_SIMD_EMULATOR_OP_1 ( Op,
Expr )
Value:
[[nodiscard]] MOCHI_ANY MOCHI_FORCE_INLINE constexpr Simd operator Op(Simd rhs) const { \
auto eval = []<size_t... I>(Simd const& lhs, Simd const& rhs, std::index_sequence<I...>) { \
return Simd{(Expr)...}; \
}; \
return eval(*this, rhs, std::make_index_sequence<N>{}); \
}

Definition at line 54 of file simd_arch_emulator_inl.h.

◆ MOCHI_SIMD_EMULATOR_OP_2

#define MOCHI_SIMD_EMULATOR_OP_2 ( Op)
Value:
[[nodiscard]] MOCHI_ANY MOCHI_FORCE_INLINE constexpr Simd operator Op(Simd rhs) const { \
auto eval = []<size_t... I>(Simd const& lhs, Simd const& rhs, std::index_sequence<I...>) { \
return Simd( \
std::bit_cast<Scalar>(std::bit_cast<UIntT>(lhs.raw[I]) \
Op std::bit_cast<UIntT>(rhs.raw[I]))...); \
}; \
return eval(*this, rhs, std::make_index_sequence<N>{}); \
}

Definition at line 62 of file simd_arch_emulator_inl.h.