27#include <simde/x86/sse2.h>
72 bool operator==(
const Vec128S& b)
const {
return low == b.low && high == b.high; }
74 bool operator!=(
const Vec128S& b)
const {
return low != b.low || high != b.high; }
76 Vec128S operator^(
const Vec128S& b)
const {
128using Vec128 = Vec128S;
131static inline Vec128 vec128i(u32 src) {
133 for (
auto i = 0; i < 4; ++i) {
147static inline Vec128 vec128i(u32 x, u32 y, u32 z, u32 w) {
157static inline Vec128 vec128q(u64 src) {
159 for (
auto i = 0; i < 2; ++i) {
171static inline Vec128 vec128q(u64 x, u64 y) {
179static inline Vec128 vec128d(f64 src) {
181 for (
auto i = 0; i < 2; ++i) {
193static inline Vec128 vec128d(f64 x, f64 y) {
201static inline Vec128 vec128f(f32 src) {
203 for (
auto i = 0; i < 4; ++i) {
217static inline Vec128 vec128f(f32 x, f32 y, f32 z, f32 w) {
227static inline Vec128 vec128s(u16 src) {
229 for (
auto i = 0; i < 8; ++i) {
248static inline Vec128 vec128s(u16 x0, u16 x1, u16 y0, u16 y1, u16 z0, u16 z1, u16 w0, u16 w1) {
262static inline Vec128 vec128b(u8 src) {
264 for (
auto i = 0; i < 16; ++i) {
291static inline Vec128 vec128b(u8 x0, u8 x1, u8 x2, u8 x3, u8 y0, u8 y1, u8 y2, u8 y3, u8 z0, u8 z1,
292 u8 z2, u8 z3, u8 w0, u8 w1, u8 w2, u8 w3) {
317std::ostream&
operator<<(std::ostream& os,
const Vec128& value);
325 return std::format(
"[{:08X} {:08X} {:08X} {:08X}]", value.u32[0], value.u32[1], value.u32[2],
331namespace rex::string {
342 return ppc::Vec128();
345 auto p = value.data();
346 auto end = value.data() + value.size();
347 bool is_hex = force_hex;
348 if (p != end && *p ==
'[') {
351 }
else if (p != end && *p ==
'(') {
359 return ppc::Vec128();
362 for (
size_t i = 0; i < 4; i++) {
363 while (p != end && (*p ==
' ' || *p ==
',')) {
368 return ppc::Vec128();
370 auto result = std::from_chars(p, end, v.u32[i], 16);
371 if (result.ec != std::errc()) {
373 return ppc::Vec128();
378 for (
size_t i = 0; i < 4; i++) {
379 while (p != end && (*p ==
' ' || *p ==
',')) {
384 return ppc::Vec128();
387 auto result = detail::portable_float_from_chars(p, end, v.f32[i]);
389 auto result = std::from_chars(p, end, v.f32[i], std::chars_format::general);
391 if (result.ec != std::errc()) {
393 return ppc::Vec128();
413 simde_mm_store_ss(&ret, simde_mm_shuffle_ps(v, v, SIMDE_MM_SHUFFLE(N, N, N, N)));
425 simde_mm_store_ss(&f, simde_mm_shuffle_ps(v, v, SIMDE_MM_SHUFFLE(N, N, N, N)));
426 return std::bit_cast<i32>(f);
437 simde_mm_store_sd(&ret, simde_mm_shuffle_pd(v, v, SIMDE_MM_SHUFFLE2(N, N)));
460 simde_mm_store_sd(&f, simde_mm_shuffle_pd(v, v, SIMDE_MM_SHUFFLE2(N, N)));
461 return std::bit_cast<i64>(f);
#define REX_ASSERT_ALWAYS(...)
Definition assert.h:102
Definition title_runtime.h:33
f32 m128_f32(const simde__m128 &v)
Definition vec128.h:411
f64 m128_f64(const simde__m128d &v)
Definition vec128.h:435
i64 m128_i64(const simde__m128d &v)
Definition vec128.h:458
i32 m128_i32(const simde__m128 &v)
Definition vec128.h:423
std::string to_string(const Vec128 &value)
std::ostream & operator<<(std::ostream &os, const Vec128 &value)
std::string to_hex_string(const Vec128 &value)
Definition vec128.h:324
T from_string(const std::string_view value, bool force_hex=false)
Definition numeric.h:83
Vec128S & operator&=(const Vec128S &b)
Definition vec128.h:105
Vec128S & operator|=(const Vec128S &b)
Definition vec128.h:122
Vec128S & operator^=(const Vec128S &b)
Definition vec128.h:88
Integer types, byte order wrappers and size literals.