116 struct svec<
LANES,bool>;
118 struct svec<
LANES,int8_t>;
120 struct svec<
LANES,uint8_t>;
122 struct svec<
LANES,int16_t>;
124 struct svec<
LANES,uint16_t>;
126 struct svec<
LANES,int32_t>;
128 struct svec<
LANES,uint32_t>;
130 struct svec<
LANES,int64_t>;
132 struct svec<
LANES,uint64_t>;
134 struct svec<
LANES,float>;
136 struct svec<
LANES,double>;
138 struct svec<
LANES,void*>;
165 v = ((a ? 1 : 0) |(b ? 2 : 0)|(c ? 4 : 0)|(d ? 8 : 0));
200 v[0] = a; v[1] = b; v[2] = c; v[3] = d;
207 v[0] = v[1] = v[2] = v[3] = a;
237 v[0] = a; v[1] = b; v[2] = c; v[3] = d;
245 v[0] = v[1] = v[2] = v[3] = a;
274 v[0] = a; v[1] = b; v[2] = c; v[3] = d;
282 v[0] = v[1] = v[2] = v[3] = a;
312 v[0] = a; v[1] = b; v[2] = c; v[3] = d;
320 v[0] = v[1] = v[2] = v[3] = a;
350 v[0] = a; v[1] = b; v[2] = c; v[3] = d;
358 v[0] = v[1] = v[2] = v[3] = a;
388 v[0] = a; v[1] = b; v[2] = c; v[3] = d;
396 v[0] = v[1] = v[2] = v[3] = a;
425 v[0] = a; v[1] = b; v[2] = c; v[3] = d;
433 v[0] = v[1] = v[2] = v[3] = a;
462 v[0] = a; v[1] = b; v[2] = c; v[3] = d;
470 v[0] = v[1] = v[2] = v[3] = a;
499 v[0] = a; v[1] = b; v[2] = c; v[3] = d;
507 v[0] = v[1] = v[2] = v[3] = a;
536 v[0] = a; v[1] = b; v[2] = c; v[3] = d;
544 v[0] = v[1] = v[2] = v[3] = a;
569 return (v.v & (1 << index)) ? -1 : 0;
571 static FORCEINLINE void svec_insert(svec<LANES,bool> *v,
int index, uint32_t val) {
573 v->v &= ~(1 << index);
575 v->v |= (1 << index);
603 static FORCEINLINE svec<LANES,bool>
svec_select(svec<LANES,bool> mask, svec<LANES,bool> a, svec<LANES,bool> b) {
604 svec<LANES,bool> ret;
605 ret.
v = (a.v & mask.v) | (b.v & ~mask.v);
691 #if defined(__x86_64__) || defined(__PPC64__)
699 svec<
LANES,uint64_t>((uint64_t)(p0),(uint64_t)(p1),(uint64_t)(p2),(uint64_t)(p3)){}
709 svec<
LANES,uint32_t>((uint32_t)(p0),(uint32_t)(p1),(uint32_t)(p2),(uint32_t)(p3)){}
713 #ifndef DOXYGEN_SHOULD_SKIP_THIS //not want generate svec_gather*/svec_scatter methods
715 template <
class RetVecType>
static RetVecType svec_gather(svec<LANES, uint32_t> ptrs, svec<LANES,bool> mask);
716 template <
class RetVecType>
static RetVecType svec_gather(svec<LANES, uint64_t> ptrs, svec<LANES,bool> mask);
845 #endif //DOXYGEN_SHOULD_SKIP_THIS
876 static FORCEINLINE bool svec_any_true(
const svec<LANES,bool>& mask) {
877 return (mask.v != 0);
885 static FORCEINLINE bool svec_all_true(
const svec<LANES,bool>& mask) {
886 return (mask.v & 0xF) == 0xF;
895 static FORCEINLINE bool svec_none_true(
const svec<LANES,bool>& mask) {
896 return (mask.v == 0);
904 static FORCEINLINE svec<LANES,bool> svec_and(svec<LANES,bool> a, svec<LANES,bool> b) {
905 svec<LANES,bool> ret;
914 static FORCEINLINE svec<LANES,bool> svec_or(svec<LANES,bool> a, svec<LANES,bool> b) {
915 svec<LANES,bool> ret;
923 static FORCEINLINE svec<LANES,bool> svec_xor(svec<LANES,bool> a, svec<LANES,bool> b) {
924 svec<LANES,bool> ret;
932 static FORCEINLINE svec<LANES,bool> svec_not(svec<LANES,bool> a) {
933 svec<LANES,bool> ret;
944 static FORCEINLINE uint64_t svec_movmsk(svec<LANES,bool> mask) {
945 return (uint64_t)(mask.v);
970 UNARY_OP(
float, svec_round, roundf);
971 UNARY_OP(
double, svec_round, round);
973 UNARY_OP(
float, svec_floor, floorf);
974 UNARY_OP(
double, svec_floor, floor);
982 UNARY_OP(
float, svec_rsqrt, 1.0/sqrtf);
983 UNARY_OP(
double, svec_rsqrt, 1.0/sqrt);
994 UNARY_OP(int8_t, svec_abs, abs<int8_t>);
995 static FORCEINLINE svec<LANES,uint8_t> svec_abs(svec<LANES,uint8_t> v) {
return v;}
996 UNARY_OP(int16_t, svec_abs, abs<int16_t>);
997 static FORCEINLINE svec<LANES,uint16_t> svec_abs(svec<LANES,uint16_t> v) {
return v;}
998 UNARY_OP(int32_t, svec_abs, abs<int32_t>);
999 static FORCEINLINE svec<LANES,uint32_t> svec_abs(svec<LANES,uint32_t> v) {
return v;}
1000 UNARY_OP(int64_t, svec_abs, abs<int64_t>);
1001 static FORCEINLINE svec<LANES,uint64_t> svec_abs(svec<LANES,uint64_t> v) {
return v;}
1008 #define BINARY_OP_METHODS(STYPE) \
1009 BINARY_OP(STYPE, svec_add, +); \
1010 BINARY_OP(STYPE, svec_sub, -); \
1011 BINARY_OP(STYPE, svec_mul, *); \
1012 BINARY_OP(STYPE, svec_div, /); \
1013 BINARY_OP_SCALAR(STYPE, svec_add_scalar, +); \
1014 BINARY_SCALAR_OP(STYPE, svec_scalar_add, +); \
1015 BINARY_OP_SCALAR(STYPE, svec_sub_scalar, -); \
1016 BINARY_SCALAR_OP(STYPE, svec_scalar_sub, -); \
1017 BINARY_OP_SCALAR(STYPE, svec_mul_scalar, *); \
1018 BINARY_SCALAR_OP(STYPE, svec_scalar_mul, *); \
1019 BINARY_OP_SCALAR(STYPE, svec_div_scalar, /); \
1020 BINARY_SCALAR_OP(STYPE, svec_scalar_div, /); \
1022 #define INT_BINARY_OP_METHODS(STYPE) \
1023 BINARY_OP(STYPE, svec_or, |); \
1024 BINARY_OP(STYPE, svec_and, &); \
1025 BINARY_OP(STYPE, svec_xor, ^); \
1026 BINARY_SHT_SCALAR(STYPE, int32_t, svec_shl, <<); \
1027 BINARY_SHT_SCALAR(STYPE, int32_t, svec_shr, >>); \
1028 BINARY_OP(STYPE, svec_rem, %); \
1029 BINARY_OP_SCALAR(STYPE, svec_rem, %);
1060 BINARY_OP2(uint16_t, uint16_t, svec_shl, <<);
1062 BINARY_OP2(uint32_t, uint32_t, svec_shl, <<);
1064 BINARY_OP2(uint64_t, uint64_t, svec_shl, <<);
1070 BINARY_OP2(uint16_t, uint16_t, svec_shr, >>);
1072 BINARY_OP2(uint32_t, uint32_t, svec_shr, >>);
1074 BINARY_OP2(uint64_t, uint64_t, svec_shr, >>);
1088 #define MAX_MIN_REDUCE_METHODS(STYPE) \
1089 BINARY_OP_FUNC(STYPE, svec_max, max<STYPE>); \
1090 BINARY_OP_FUNC(STYPE, svec_min, min<STYPE>); \
1091 BINARY_OP_REDUCE_FUNC(STYPE, svec_reduce_add, add<STYPE>); \
1092 BINARY_OP_REDUCE_FUNC(STYPE, svec_reduce_max, max<STYPE>); \
1093 BINARY_OP_REDUCE_FUNC(STYPE, svec_reduce_min, min<STYPE>); \
1108 svec_reduce_add(v0),
1109 svec_reduce_add(v1),
1110 svec_reduce_add(v2),
1117 svec_reduce_add(v0),
1118 svec_reduce_add(v1),
1119 svec_reduce_add(v2),
1144 CMP_OP(
bool, not_equal, !=);
1321 svec_insert(m_self, m_index, value);
1323 FORCEINLINE void svec<LANES,bool>::Helper::operator=(svec<LANES,bool>::Helper helper) {
1324 svec_insert(m_self, m_index, helper.operator uint32_t());
1326 FORCEINLINE svec<LANES,bool>::Helper::operator uint32_t()
const {
1327 return svec_extract(*m_self, m_index);
1329 const FORCEINLINE uint32_t svec<LANES,bool>::operator[](
int index)
const {
1330 return svec_extract(*
this, index);
1362 FORCEINLINE bool svec<LANES,bool>::none_true() {
return svec_none_true(*
this); }
1368 FORCEINLINE svec<LANES,bool> svec<LANES,bool>::operator~() {
return svec_not(*
this); }
1375 FORCEINLINE svec<LANES,bool> svec<LANES,bool>::operator|(svec<LANES,bool> a) {
return svec_or(*
this, a); }
1381 FORCEINLINE svec<LANES,bool> svec<LANES,bool>::operator&(svec<LANES,bool> a) {
return svec_and(*
this, a); }
1387 FORCEINLINE svec<LANES,bool> svec<LANES,bool>::operator^(svec<LANES,bool> a) {
return svec_xor(*
this, a); }
1392 FORCEINLINE svec<LANES,bool> svec<LANES,bool>::operator!() {
return svec_not(*
this); }
1399 FORCEINLINE svec<LANES,bool> svec<LANES,bool>::operator&&(svec<LANES,bool> a) {
return svec_and(*
this, a); }
1405 FORCEINLINE svec<LANES,bool> svec<LANES,bool>::operator||(svec<LANES,bool> a) {
return svec_or(*
this, a); }
1411 FORCEINLINE svec<LANES,bool> svec<LANES,bool>::operator ==(svec<LANES,bool> a) {
1412 return svec_equal(*
this, a);
1420 FORCEINLINE svec<LANES,bool> svec<LANES,bool>::operator !=(svec<LANES,bool> a) {
1421 return svec_not_equal(*
this, a);
#define COUT_FUNC_BOOL_DECL()
Definition: gsimd_utility.h:266
svec(double a)
Constructor.
Definition: generic4.h:543
svec(int8_t a)
Constructor.
Definition: generic4.h:206
#define MAX_MIN_REDUCE_METHODS(STYPE)
Definition: generic4.h:1088
#define VEC_INT_CLASS_METHOD_DECL(STYPE, USTYPE)
macros method definition for integer vector only Note: shift's operator can only be unsigned vector ...
Definition: gsimd_utility.h:379
svec(uint8_t a, uint8_t b, uint8_t c, uint8_t d)
Constructor.
Definition: generic4.h:236
svec(void *p0, void *p1, void *p2, void *p3)
Constructor.
Definition: generic4.h:708
svec(uint32_t a, uint32_t b, uint32_t c, uint32_t d)
Constructor.
Definition: generic4.h:164
#define SCATTER_BASE_OFFSETS(STYPE, OSTYPE)
Definition: gsimd_utility.h:765
svec(int64_t a, int64_t b, int64_t c, int64_t d)
Constructor.
Definition: generic4.h:424
#define CAST(SFROM, STO)
Definition: gsimd_utility.h:1112
svec(int32_t a)
Constructor.
Definition: generic4.h:357
svec(uint8_t a)
Constructor.
Definition: generic4.h:244
svec(int64_t a)
Constructor.
Definition: generic4.h:432
#define LOAD_CONST(STYPE)
Definition: gsimd_utility.h:562
#define VEC_FLOAT_CLASS_METHOD_DECL(STYPE)
Definition: gsimd_utility.h:393
#define VEC_CLASS_METHOD_DECL(STYPE)
macros for non-mask i8 - double types's method
Definition: gsimd_utility.h:350
#define INT_BINARY_OP_METHODS(STYPE)
Definition: generic4.h:1022
svec(float a)
Constructor.
Definition: generic4.h:506
#define BINARY_OP_FUNC(STYPE, NAME, FUNC)
Definition: gsimd_utility.h:869
svec()
Default constructor.
Definition: generic4.h:231
svec< 4, bool > svec_select(svec< 4, bool > mask, svec< 4, bool > a, svec< 4, bool > b)
construct c by selecting elements from two input vectors according to the mask
Definition: power_vsx4.h:1126
#define ROTATE(STYPE)
macro for rotate method implementation
Definition: gsimd_utility.h:496
#define TERNERY(STYPE)
Definition: gsimd_utility.h:958
svec()
Default constructor.
Definition: generic4.h:382
#define SVEC_BOOL_CLASS_METHOD_DECL()
macros for svec<N,bool> class's class method
Definition: gsimd_utility.h:330
svec()
Default constructor.
Definition: generic4.h:268
svec(double a, double b, double c, double d)
Constructor.
Definition: generic4.h:535
svec(uint32_t a)
Constructor.
Definition: generic4.h:395
#define BROADCAST(STYPE)
macro for broadcast method implementation All broadcast are slow implementation
Definition: gsimd_utility.h:472
#define COUT_FUNC_DECL(STYPE)
Definition: gsimd_utility.h:283
#define BINARY_OP_METHODS(STYPE)
Definition: generic4.h:1008
svec(float a, float b, float c, float d)
Constructor.
Definition: generic4.h:498
svec()
Default constructor,.
Definition: generic4.h:419
svec(uint64_t a, uint64_t b, uint64_t c, uint64_t d)
Constructor.
Definition: generic4.h:461
#define SUBSCRIPT_FUNC_IMPL(STYPE)
Definition: gsimd_utility.h:1160
#define VEC_CMP_IMPL(STYPE)
Definition: gsimd_utility.h:1175
#define GATHER_GENERAL(STYPE, PSTYPE)
slow implementation of gather general Must use template to specify the return type ...
Definition: gsimd_utility.h:602
svec(uint16_t a)
Constructor.
Definition: generic4.h:319
#define SUBSCRIPT_FUNC_DECL(STYPE)
macros to define a intrinsic based subscript opertor
Definition: gsimd_utility.h:247
svec< 4,float > svec_preduce_add(svec< 4, float > v0, svec< 4, float > v1, svec< 4, float > v2, svec< 4, float > v3)
Definition: generic4.h:1106
#define MVEC_CLASS_METHOD_IMPL(STYPE)
mask class's class method impl
Definition: gsimd_utility.h:1285
#define SUBSCRIPT_FUNC_BOOL_DECL(STYPE)
Definition: gsimd_utility.h:251
#define VEC_CLASS_METHOD_IMPL(STYPE)
Definition: gsimd_utility.h:1301
#define MASKED_LOAD_STORE_L4(STYPE)
Definition: gsimd_utility.h:797
#define VEC_FLOAT_CLASS_METHOD_IMPL(STYPE)
Definition: gsimd_utility.h:1433
#define LANES
Definition: generic4.h:108
svec(int a, int b, int c, int d)
Constructor.
Definition: generic4.h:349
#define INSERT_EXTRACT(STYPE)
macros for svec's insert extract method implementation The implementation is based on vector type's s...
Definition: gsimd_utility.h:409
svec()
Default constructor.
Definition: generic4.h:456
#define LOAD_STORE(STYPE)
Definition: gsimd_utility.h:419
svec()
Default constructor.
Definition: generic4.h:530
#define CAST_BITS(SFROM, FROM_F, STO, TO_F)
Definition: gsimd_utility.h:1143
#define GATHER_STRIDE(STYPE, OSTYPE)
macros for general impl of gather base step
Definition: gsimd_utility.h:666
svec()
Default constructor.
Definition: generic4.h:306
svec(int8_t a, int8_t b, int8_t c, int8_t d)
Constructor.
Definition: generic4.h:199
#define SCATTER_STRIDE(STYPE, OSTYPE)
Definition: gsimd_utility.h:705
#define SCATTER_GENERAL(STYPE, PSTYPE)
Definition: gsimd_utility.h:736
#define GATHER_BASE_OFFSETS(STYPE, OSTYPE)
Definition: gsimd_utility.h:647
svec(uint32_t a, uint32_t b, uint32_t c, uint32_t d)
Constructor.
Definition: generic4.h:387
#define UNARY_OP(STYPE, NAME, OP)
Definition: gsimd_utility.h:833
#define SELECT(STYPE)
macros for svec's select by mask vector method generic implementation
Definition: gsimd_utility.h:448
#define CMP_ALL_OP(STYPE)
Definition: gsimd_utility.h:1107
#define BINARY_OP2(STYPE, STYPE2, NAME, OP)
Definition: gsimd_utility.h:861
svec(int16_t a)
Constructor.
Definition: generic4.h:281
#define COUT_FUNC_CHAR_DECL(STYPE)
Definition: gsimd_utility.h:275
#define CMP_OP(STYPE, NAME, OP)
macros for binary: vector op scalar
Definition: gsimd_utility.h:1049
svec(uint64_t a)
Constructor.
Definition: generic4.h:469
svec()
Default constructor.
Definition: generic4.h:344
#define SHUFFLES(STYPE)
macro for shuffle/shuffle2 methods implementation
Definition: gsimd_utility.h:521
svec()
Default constructor.
Definition: generic4.h:157
#define SELECT_BOOLCOND(STYPE)
macros for svec's select by bool scalar method implementation
Definition: gsimd_utility.h:459
#define VEC_INT_CLASS_METHOD_IMPL(STYPE, STYPE2)
Definition: gsimd_utility.h:1394
#define FORCEINLINE
Definition: gsimd_utility.h:175
uint32_t v
Definition: generic4.h:151
svec(int16_t a, int16_t b, int16_t c, int16_t d)
Constructor.
Definition: generic4.h:273
svec()
Default constructor.
Definition: generic4.h:194
svec()
Default constructor.
Definition: generic4.h:493
svec(uint32_t a)
Constructor.
Definition: generic4.h:173
svec(uint16_t a, uint16_t b, uint16_t c, uint16_t d)
Constructor.
Definition: generic4.h:311