7#include "array_intrinsic.hpp"
8#include "../macros.hpp"
21hi_export_module(hikogui.SIMD.array_intrinsic_f32x4);
23hi_export
namespace hi {
26#if defined(HI_HAS_AVX)
28struct array_intrinsic<
double, 4> {
35 [[
nodiscard]] hi_force_inline
static register_type L(array_type a)
noexcept
42 [[
nodiscard]] hi_force_inline
static array_type S(register_type a)
noexcept
44 auto r = array_type{};
54 [[
nodiscard]] hi_force_inline
static array_type set(
double a,
double b,
double c,
double d)
noexcept
59 [[
nodiscard]] hi_force_inline
static array_type set(
double a)
noexcept
71#if defined(HI_HAS_AVX2)
80#if defined(HI_HAS_AVX2)
89 [[
nodiscard]] hi_force_inline
static double get(array_type a)
noexcept
93 if constexpr (I == 0) {
95 }
else constexpr (I == 1) {
99 if constexpr (I == 2) {
107 [[
nodiscard]] hi_force_inline
static array_type broadcast(
double a)
noexcept
112 [[
nodiscard]] hi_force_inline
static array_type broadcast(array_type a)
noexcept
127 [[
nodiscard]] hi_force_inline
static array_type neg(array_type a)
noexcept
132 template<std::
size_t Mask>
133 [[
nodiscard]] hi_force_inline
constexpr static array_type neg_mask(array_type a)
noexcept
135 if constexpr (
Mask == 0) {
137 }
else if constexpr (
Mask == 0b1111) {
139#if defined(HI_HAS_SSE3)
140 }
else if constexpr (
Mask == 0b0101) {
149 [[
nodiscard]] hi_force_inline
static array_type inv(array_type a)
noexcept
151 return _xor(set_all_ones(), a);
154 [[
nodiscard]] hi_force_inline
static array_type rcp(array_type a)
noexcept
159 [[
nodiscard]] hi_force_inline
static array_type
sqrt(array_type a)
noexcept
164 [[
nodiscard]] hi_force_inline
static array_type rsqrt(array_type a)
noexcept
169#if defined(HI_HAS_SSE2)
170 [[
nodiscard]] hi_force_inline
static array_type
round(array_type a)
noexcept
172#if defined(HI_HAS_SSE4_1)
175 auto const a_ = L(a);
188#if defined(HI_HAS_SSE4_1)
189 [[
nodiscard]] hi_force_inline
static array_type
floor(array_type a)
noexcept
194 [[
nodiscard]] hi_force_inline
static array_type
ceil(array_type a)
noexcept
200 [[
nodiscard]] hi_force_inline
static array_type add(array_type a, array_type b)
noexcept
205 [[
nodiscard]] hi_force_inline
static array_type sub(array_type a, array_type b)
noexcept
210 template<std::
size_t Mask>
211 [[
nodiscard]] hi_force_inline
constexpr static array_type addsub_mask(array_type a, array_type b)
noexcept
213 if constexpr (
Mask == 0) {
215 }
else if constexpr (
Mask == 0b1111) {
217#if defined(HI_HAS_SSE3)
218 }
else if constexpr (
Mask == 0b1010) {
226 [[
nodiscard]] hi_force_inline
static array_type mul(array_type a, array_type b)
noexcept
231 [[
nodiscard]] hi_force_inline
static array_type
div(array_type a, array_type b)
noexcept
236 [[
nodiscard]] hi_force_inline
static array_type eq(array_type a, array_type b)
noexcept
241 [[
nodiscard]] hi_force_inline
static array_type ne(array_type a, array_type b)
noexcept
246 [[
nodiscard]] hi_force_inline
static array_type lt(array_type a, array_type b)
noexcept
251 [[
nodiscard]] hi_force_inline
static array_type gt(array_type a, array_type b)
noexcept
256 [[
nodiscard]] hi_force_inline
static array_type le(array_type a, array_type b)
noexcept
261 [[
nodiscard]] hi_force_inline
static array_type ge(array_type a, array_type b)
noexcept
266 [[
nodiscard]] hi_force_inline
static bool test(array_type a, array_type b)
noexcept
268#if defined(HI_HAS_SSE4_1)
270#elif defined(HI_HAS_SSE2)
276 return (std::bit_cast<uint32_t>(std::get<0>(
tmp)) | std::bit_cast<uint32_t>(std::get<1>(
tmp)) |
277 std::bit_cast<uint32_t>(std::get<2>(
tmp)) | std::bit_cast<uint32_t>(std::get<3>(
tmp))) == 0;
281 [[
nodiscard]] hi_force_inline
static array_type
max(array_type a, array_type b)
noexcept
286 [[
nodiscard]] hi_force_inline
static array_type
min(array_type a, array_type b)
noexcept
291 [[
nodiscard]] hi_force_inline
static array_type clamp(array_type v, array_type
lo, array_type
hi)
noexcept
296 [[
nodiscard]] hi_force_inline
static array_type _or(array_type a, array_type b)
noexcept
301 [[
nodiscard]] hi_force_inline
static array_type _and(array_type a, array_type b)
noexcept
306 [[
nodiscard]] hi_force_inline
static array_type _xor(array_type a, array_type b)
noexcept
311 [[
nodiscard]] hi_force_inline
static array_type andnot(array_type a, array_type b)
noexcept
316#if defined(HI_HAS_SSE2)
317 [[
nodiscard]] hi_force_inline
static array_type sll(array_type a,
unsigned int b)
noexcept
324#if defined(HI_HAS_SSE2)
325 [[
nodiscard]] hi_force_inline
static array_type srl(array_type a,
unsigned int b)
noexcept
332#if defined(HI_HAS_SSE2)
333 [[
nodiscard]] hi_force_inline
static array_type sra(array_type a,
unsigned int b)
noexcept
340 [[
nodiscard]] hi_force_inline
static array_type hadd(array_type a, array_type b)
noexcept
342#if defined(HI_HAS_SSE3)
345 auto const a_ = L(a);
346 auto const b_ = L(b);
353 [[
nodiscard]] hi_force_inline
static array_type hsub(array_type a, array_type b)
noexcept
355#if defined(HI_HAS_SSE3)
358 auto const a_ = L(a);
359 auto const b_ = L(b);
369 static_assert(
sizeof...(Indices) == 4);
373 for (
size_t i = 0; i != 4; ++i) {
374 auto const index = indices[i] < 0 ? i : indices[i];
375 r |= index << (i * 2);
381 [[
nodiscard]] hi_force_inline
static array_type
shuffle(array_type a)
noexcept
386 template<
size_t Mask>
387 [[
nodiscard]] hi_force_inline
static array_type blend(array_type a, array_type b)
noexcept
389#if defined(HI_HAS_SSE4_1)
395 constexpr auto indices =
396 (
Mask & 0b0001 ? 0b00'00'00'01U : 0b00'00'00'00U) |
397 (
Mask & 0b0010 ? 0b00'00'11'00U : 0b00'00'10'00U) |
398 (
Mask & 0b0100 ? 0b00'01'00'00U : 0b00'00'00'00U) |
399 (
Mask & 0b1000 ? 0b11'00'00'00U : 0b10'00'00'00U);
412 return {S(
a_), S(
b_), S(
c_), S(
d_)};
415 [[
nodiscard]] hi_force_inline
static array_type sum(array_type a)
noexcept
425 template<
size_t Mask>
426 [[
nodiscard]] hi_force_inline
static array_type dot(array_type a, array_type b)
noexcept
428#if defined(HI_HAS_SSE4_1)
@ round
The end cap of the line is round.
DOXYGEN BUG.
Definition algorithm_misc.hpp:20
The HikoGUI namespace.
Definition recursive_iterator.hpp:15
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition cast.hpp:378