27 typedef typename Vec::IndexType It;
28 typedef typename Vec::EntryType
T;
37 const Vec
a(mem, indexes,
m);
39 COMPARE(a[i],
m[i] ? mem[i] : 0) <<
" i = " << i <<
", m = " <<
m;
44 b.gather(mem, indexes,
m);
46 COMPARE(b[i],
m[i] ? mem[i] : x) <<
" i = " << i <<
", m = " <<
m;
53 typedef typename Vec::IndexType It;
54 typedef typename Vec::EntryType
T;
55 typedef typename It::Mask M;
57 const int count = 39999;
59 for (
int i = 0; i < count; ++i) {
65 const typename Vec::Mask castedMask =
static_cast<typename Vec::Mask
>(mask);
66 if (castedMask.isFull()) {
68 COMPARE(a, ii) <<
"\n i: " << i;
75 b.gather(array, i, castedMask);
76 COMPARE(castedMask, (b == ii)) <<
", b = " << b <<
", ii = " << ii <<
", i = " << i;
77 if (!castedMask.isFull()) {
82 const typename Vec::Mask k(
Zero);
88 template<
typename T>
struct Struct
100 typedef typename Vec::IndexType It;
101 typedef typename Vec::EntryType
T;
103 const int count = 3999;
105 for (
int i = 0; i < count; ++i) {
110 typename It::Mask mask;
117 const typename Vec::Mask castedMask(mask);
119 if (castedMask.isFull()) {
120 Vec
a(array, &
S::a, i);
121 COMPARE(a, i0) <<
"\ni: " << i;
122 a.gather(array, &S::b, i);
124 a.gather(array, &
S::c, i);
129 b.gather(array, &
S::a, i, castedMask);
130 COMPARE(castedMask, (b == i0));
131 if (!castedMask.isFull()) {
134 b.gather(array, &S::b, i, castedMask);
135 COMPARE(castedMask, (b == i1));
136 if (!castedMask.isFull()) {
139 b.gather(array, &
S::c, i, castedMask);
140 COMPARE(castedMask, (b == i2));
141 if (!castedMask.isFull()) {
147 template<
typename T>
struct Row
154 typedef typename Vec::IndexType It;
155 typedef typename Vec::EntryType
T;
156 const int count = 399;
159 for (
int i = 0; i < count; ++i) {
160 array[i].data =
new T[count];
161 for (
int j = 0; j < count; ++j) {
162 array[i].data[j] = 2 * i + j + 1;
166 typename It::Mask mask;
169 const Vec i0(i * 2 + j + 1);
170 const typename Vec::Mask castedMask(mask);
172 Vec
a(array, &S::data, i, j, castedMask);
173 COMPARE(castedMask, castedMask && (a == i0)) <<
", a = " << a <<
", i0 = " << i0 <<
", i = " << i <<
", j = " << j;
176 b.gather(array, &S::data, i, j, castedMask);
177 COMPARE(castedMask, (b == i0));
178 if (!castedMask.isFull()) {
181 Vec
c(array, &S::data, i, j);
182 VERIFY((c == i0).isFull());
185 d.gather(array, &S::data, i, j);
186 VERIFY((d == i0).isFull());
190 for (
int i = 0; i < count; ++i) {
191 delete[] array[i].data;
195 int main(
int argc,
char **argv)
201 #if defined(VC_CLANG) && VC_CLANG <= 0x030000
205 #warning "Skipping compilation of tests gatherStruct and gather2dim because of clang bug"
void initTest(int argc, char **argv)
int main(int argc, char **argv)
#define testAllTypes(name)
#define for_all_masks(VecType, _mask_)