30 typedef typename Vec::EntryType
T;
31 typedef typename Vec::Mask Mask;
33 for (
int borderI = 0; borderI <
Vec::Size; ++borderI) {
34 const T border =
static_cast<T
>(borderI);
36 data[i] =
static_cast<T
>(i);
37 data[i +
Vec::Size] = data[i] +
static_cast<T
>(data[i] < border ? 1 : 0);
40 Vec b(&data[Vec::Size]);
43 COMPARE(aa(m)++, a) <<
", border: " << border <<
", m: " <<
m;
44 COMPARE(aa, b) <<
", border: " << border <<
", m: " <<
m;
45 COMPARE(++
a(m), b) <<
", border: " << border <<
", m: " <<
m;
46 COMPARE(a, b) <<
", border: " << border <<
", m: " <<
m;
53 typedef typename Vec::EntryType
T;
54 typedef typename Vec::Mask Mask;
56 for (
int borderI = 0; borderI <
Vec::Size; ++borderI) {
57 const T border =
static_cast<T
>(borderI);
59 data[i] =
static_cast<T
>(i + 1);
60 data[i +
Vec::Size] = data[i] -
static_cast<T
>(data[i] < border ? 1 : 0);
63 Vec b(&data[Vec::Size]);
76 typedef typename Vec::EntryType
T;
77 typedef typename Vec::Mask Mask;
79 for (
int borderI = 0; borderI <
Vec::Size; ++borderI) {
80 const T border =
static_cast<T
>(borderI);
82 data[i] =
static_cast<T
>(i + 1);
83 data[i +
Vec::Size] = data[i] +
static_cast<T
>(data[i] < border ? 2 : 0);
86 Vec b(&data[Vec::Size]);
88 COMPARE(
a(m) += static_cast<T>(2), b);
96 typedef typename Vec::EntryType
T;
97 typedef typename Vec::Mask Mask;
99 for (
int borderI = 0; borderI <
Vec::Size; ++borderI) {
100 const T border =
static_cast<T
>(borderI);
102 data[i] =
static_cast<T
>(i + 2);
103 data[i +
Vec::Size] = data[i] -
static_cast<T
>(data[i] < border ? 2 : 0);
106 Vec b(&data[Vec::Size]);
108 COMPARE(
a(m) -= static_cast<T>(2), b);
116 typedef typename Vec::EntryType
T;
117 typedef typename Vec::Mask Mask;
119 for (
int borderI = 0; borderI <
Vec::Size; ++borderI) {
120 const T border =
static_cast<T
>(borderI);
122 data[i] =
static_cast<T
>(i);
123 data[i +
Vec::Size] = data[i] *
static_cast<T
>(data[i] < border ? 2 : 1);
126 Vec b(&data[Vec::Size]);
128 COMPARE(
a(m) *= static_cast<T>(2), b);
136 typedef typename Vec::EntryType
T;
137 typedef typename Vec::Mask Mask;
139 for (
int borderI = 0; borderI <
Vec::Size; ++borderI) {
140 const T border =
static_cast<T
>(borderI);
142 data[i] =
static_cast<T
>(5 * i);
143 data[i +
Vec::Size] = data[i] /
static_cast<T
>(data[i] < border ? 3 : 1);
146 Vec b(&data[Vec::Size]);
148 COMPARE(
a(m) /= static_cast<T>(3), b);
156 typedef typename Vec::EntryType
T;
157 typedef typename Vec::Mask Mask;
159 for (
int borderI = 0; borderI <
Vec::Size; ++borderI) {
160 const T border =
static_cast<T
>(borderI);
162 data[i] =
static_cast<T
>(i);
163 data[i +
Vec::Size] = data[i] +
static_cast<T
>(data[i] < border ? 2 : 0);
166 Vec b(&data[Vec::Size]);
175 typedef typename Vec::EntryType
T;
176 typedef typename Vec::Mask Mask;
177 typedef typename Vec::IndexType
I;
179 for (
int cut = 0; cut <
Vec::Size; ++cut) {
203 COMPARE(
m.count(), count) <<
", m = " <<
m;
209 typedef typename Vec::IndexType
I;
210 typedef typename Vec::Mask M;
220 VERIFY((M1(
true) && M2(
true)).isFull());
221 VERIFY((M1(
true) && M2(
false)).isEmpty());
222 VERIFY((M1(
true) || M2(
true)).isFull());
223 VERIFY((M1(
true) || M2(
false)).isFull());
224 VERIFY((M1(
false) || M2(
false)).isEmpty());
229 testLogicalOperatorsImpl<M1, M2>();
231 VERIFY((M1(
true) & M2(
true)).isFull());
232 VERIFY((M1(
true) & M2(
false)).isEmpty());
233 VERIFY((M1(
true) | M2(
true)).isFull());
234 VERIFY((M1(
true) | M2(
false)).isFull());
235 VERIFY((M1(
false) | M2(
false)).isEmpty());
236 VERIFY((M1(
true) ^ M2(
true)).isEmpty());
237 VERIFY((M1(
true) ^ M2(
false)).isFull());
242 testLogicalOperatorsImpl< short_m, sfloat_m>();
243 testLogicalOperatorsImpl<ushort_m, sfloat_m>();
244 testLogicalOperatorsImpl<sfloat_m, short_m>();
245 testLogicalOperatorsImpl<sfloat_m, ushort_m>();
247 testBinaryOperatorsImpl< short_m, short_m>();
248 testBinaryOperatorsImpl< short_m, ushort_m>();
249 testBinaryOperatorsImpl<ushort_m, short_m>();
250 testBinaryOperatorsImpl<ushort_m, ushort_m>();
251 testBinaryOperatorsImpl<sfloat_m, sfloat_m>();
253 testBinaryOperatorsImpl< int_m, int_m>();
254 testBinaryOperatorsImpl< int_m, uint_m>();
255 testBinaryOperatorsImpl< int_m, float_m>();
256 testBinaryOperatorsImpl< uint_m, int_m>();
257 testBinaryOperatorsImpl< uint_m, uint_m>();
258 testBinaryOperatorsImpl< uint_m, float_m>();
259 testBinaryOperatorsImpl< float_m, int_m>();
260 testBinaryOperatorsImpl< float_m, uint_m>();
261 testBinaryOperatorsImpl< float_m, float_m>();
263 testBinaryOperatorsImpl<double_m, double_m>();
267 void testFloat8GatherMask()
270 short_v::Memory andMemory;
272 andMemory[i] = 1 << i;
274 const short_v andMask(andMemory);
276 for (
unsigned int i = 0; i < data.
vectorsCount(); ++i) {
277 data.
vector(i) = andMask & i;
280 for (
unsigned int i = 0; i < data.
vectorsCount(); ++i) {
285 gatherMaskB(static_cast<sfloat_m>(mask));
286 COMPARE(gatherMaskA.toInt(), gatherMaskB.toInt());
291 int main(
int argc,
char **argv)
void initTest(int argc, char **argv)
void testBinaryOperators()
_VC_CONSTEXPR size_t vectorsCount() const
void testLogicalOperatorsImpl()
int main(int argc, char **argv)
VECTOR_NAMESPACE::short_v short_v
void testBinaryOperatorsImpl()
#define testAllTypes(name)
Vc_ALWAYS_INLINE Vc_PURE VectorPointerHelper< V, AlignedFlag > vector(size_t i)
#define for_all_masks(VecType, _mask_)
A helper class for fixed-size two-dimensional arrays.