===================================================================
@@ -17,55 +17,9 @@ int main (int argc, char *argv[]) {
/*vector (8, short) v0 = {argc, 1,2,3,4,5,6,7};
vector (8, short) v1 = {argc, 1,argc,3,4,5,argc,7};
vector (8, short) v2;
-
- vector (8, short) smask = {0,0,1,2,3,4,5,6};
-
- v2 = __builtin_shuffle (v0, smask);
- shufcompare (short, 8, v2, v0, smask);
- v2 = __builtin_shuffle (v0, v1);
- shufcompare (short, 8, v2, v0, v1);
- v2 = __builtin_shuffle (smask, v0);
- shufcompare (short, 8, v2, smask, v0);*/
-
- vector (4, int) i0 = {argc, 1,2,3};
- vector (4, int) i1 = {argc, 1, argc, 3};
- vector (4, int) i2;
-
- vector (4, int) imask = {0,3,2,1};
-
- /*i2 = __builtin_shuffle (i0, imask);
- shufcompare (int, 4, i2, i0, imask);*/
- i2 = __builtin_shuffle (i0, i1);
- shufcompare (int, 4, i2, i0, i1);
-
- i2 = __builtin_shuffle (imask, i0);
- shufcompare (int, 4, i2, imask, i0);
-
- return 0;
-}
-
-#define vector(elcount, type) \
-__attribute__((vector_size((elcount)*sizeof(type)))) type
-
-#define vidx(type, vec, idx) (*(((type *) &(vec)) + idx))
-#define shufcompare(type, count, vres, v0, mask) \
-do { \
- int __i; \
- for (__i = 0; __i < count; __i++) { \
- if (vidx(type, vres, __i) != vidx(type, v0, vidx(type, mask, __i))) \
- __builtin_abort (); \
- } \
-} while (0)
-
-
-int main (int argc, char *argv[]) {
- /*vector (8, short) v0 = {argc, 1,2,3,4,5,6,7};
- vector (8, short) v1 = {argc, 1,argc,3,4,5,argc,7};
- vector (8, short) v2;
-
vector (8, short) smask = {0,0,1,2,3,4,5,6};
-
+
v2 = __builtin_shuffle (v0, smask);
shufcompare (short, 8, v2, v0, smask);
v2 = __builtin_shuffle (v0, v1);
@@ -83,10 +37,10 @@ int main (int argc, char *argv[]) {
shufcompare (int, 4, i2, i0, imask);*/
i2 = __builtin_shuffle (i0, i1);
shufcompare (int, 4, i2, i0, i1);
-
+
i2 = __builtin_shuffle (imask, i0);
shufcompare (int, 4, i2, imask, i0);
-
+
return 0;
}
===================================================================
@@ -42,47 +42,3 @@ int main (int argc, char *argv[]) {
return 0;
}
-#define vector(elcount, type) \
-__attribute__((vector_size((elcount)*sizeof(type)))) type
-
-#define vidx(type, vec, idx) (*(((type *) &(vec)) + idx))
-
-#define shuf2compare(type, count, vres, v0, v1, mask) \
-do { \
- int __i; \
- for (__i = 0; __i < count; __i++) { \
- if (vidx(type, vres, __i) != ((vidx(type, mask, __i) < count) ? \
- vidx(type, v0, vidx(type, mask, __i)) : \
- vidx(type, v1, (vidx(type, mask, __i) - count)))) \
- __builtin_abort (); \
- } \
-} while (0)
-
-
-int main (int argc, char *argv[]) {
- vector (8, short) v0 = {5, 5,5,5,5,5,argc,7};
- vector (8, short) v1 = {argc, 1,8,8,4,9,argc,4};
- vector (8, short) v2;
-
- //vector (8, short) mask = {1,2,5,4,3,6,7};
-
- vector (8, short) mask0 = {0,2,3,1,4,5,6,7};
- vector (8, short) mask1 = {0,12,3,4,3,0,10,9};
-
- vector (8, short) mask2 = {0,8,1,9,2,10,3,11};
-
- v2 = __builtin_shuffle (v0, v1, mask0);
- shuf2compare (short, 8, v2, v0, v1, mask0);
-
- v2 = __builtin_shuffle (v0, v1, mask1);
- shuf2compare (short, 8, v2, v0, v1, mask1);
-
- v2 = __builtin_shuffle (v0, v1, mask2);
- shuf2compare (short, 8, v2, v0, v1, mask2);
-
- v2 = __builtin_shuffle (mask0, mask0, v0);
- shuf2compare (short, 8, v2, mask0, mask0, v0);
-
- return 0;
-}
-
===================================================================
@@ -24,43 +24,7 @@ int main (int argc, char *argv[]) {
vector (8, short) v2;
vector (8, short) mask = {0,0,1,2,3,4,5,6};
-
- v2 = f (v0, mask);
- shufcompare (short, 8, v2, v0, mask);
-
- v2 = f (v0, v1);
- shufcompare (short, 8, v2, v0, v1);
-
- return 0;
-}
-
-#define vector(elcount, type) \
-__attribute__((vector_size((elcount)*sizeof(type)))) type
-
-#define vidx(type, vec, idx) (*(((type *) &(vec)) + idx))
-#define shufcompare(type, count, vres, v0, mask) \
-do { \
- int __i; \
- for (__i = 0; __i < count; __i++) { \
- if (vidx(type, vres, __i) != vidx(type, v0, vidx(type, mask, __i))) \
- __builtin_abort (); \
- } \
-} while (0)
-
-vector (8, short) __attribute__ ((noinline))
-f (vector (8, short) x, vector (8, short) mask) {
- return __builtin_shuffle (x, mask);
-}
-
-
-int main (int argc, char *argv[]) {
- vector (8, short) v0 = {argc, 1,2,3,4,5,6,7};
- vector (8, short) v1 = {argc, 1,argc,3,4,5,argc,7};
- vector (8, short) v2;
-
- vector (8, short) mask = {0,0,1,2,3,4,5,6};
-
v2 = f (v0, mask);
shufcompare (short, 8, v2, v0, mask);
===================================================================
@@ -28,64 +28,14 @@ int main (int argc, char *argv[]) {
vector (8, short) v2;
//vector (8, short) mask = {1,2,5,4,3,6,7};
-
- vector (8, short) mask0 = {0,2,3,1,4,5,6,7};
- vector (8, short) mask1 = {0,12,3,4,3,0,10,9};
- vector (8, short) mask2 = {0,8,1,9,2,10,3,11};
-
- v2 = f (v0, v1, mask0);
- shuf2compare (short, 8, v2, v0, v1, mask0);
-
- v2 = f (v0, v1, mask1);
- shuf2compare (short, 8, v2, v0, v1, mask1);
-
- v2 = f (v0, v1, mask2);
- shuf2compare (short, 8, v2, v0, v1, mask2);
-
- v2 = f (mask0, mask0, v0);
- shuf2compare (short, 8, v2, mask0, mask0, v0);
-
- return 0;
-}
-
-#define vector(elcount, type) \
-__attribute__((vector_size((elcount)*sizeof(type)))) type
-
-#define vidx(type, vec, idx) (*(((type *) &(vec)) + idx))
-
-#define shuf2compare(type, count, vres, v0, v1, mask) \
-do { \
- int __i; \
- for (__i = 0; __i < count; __i++) { \
- if (vidx(type, vres, __i) != ((vidx(type, mask, __i) < count) ? \
- vidx(type, v0, vidx(type, mask, __i)) : \
- vidx(type, v1, (vidx(type, mask, __i) - count)))) \
- __builtin_abort (); \
- } \
-} while (0)
-
-
-vector (8, short) __attribute__ ((noinline))
-f (vector (8, short) x, vector (8, short) y, vector (8, short) mask) {
- return __builtin_shuffle (x, y, mask);
-}
-
-
-int main (int argc, char *argv[]) {
- vector (8, short) v0 = {argc, 1,2,3,4,5,6,7};
- vector (8, short) v1 = {argc, 1,argc,3,4,5,argc,7};
- vector (8, short) v2;
-
- //vector (8, short) mask = {1,2,5,4,3,6,7};
-
vector (8, short) mask0 = {0,2,3,1,4,5,6,7};
vector (8, short) mask1 = {0,12,3,4,3,0,10,9};
vector (8, short) mask2 = {0,8,1,9,2,10,3,11};
v2 = f (v0, v1, mask0);
shuf2compare (short, 8, v2, v0, v1, mask0);
-
+
v2 = f (v0, v1, mask1);
shuf2compare (short, 8, v2, v0, v1, mask1);
@@ -95,6 +45,6 @@ int main (int argc, char *argv[]) {
v2 = f (mask0, mask0, v0);
shuf2compare (short, 8, v2, mask0, mask0, v0);
- return 0;
+ return 0;
}
===================================================================
@@ -30,7 +30,7 @@ do { \
test_compat_mask (res, c ## vec, mask); \
test_compat_mask (res, r ## vec, mask); \
test_compat_mask (res, d ## vec, mask); \
- test_compat_mask (res, dc ## vec, mask);
+ test_compat_mask (res, dc ## vec, mask);
#define test_compat(res, vec, mask) \
test_compat_vec (res, vec, mask); \
@@ -46,72 +46,8 @@ int main (int argc, char *argv[]) {
register vector (4, int) rvec = {argc, 1,2,3};
v4si dvec = {argc, 1,2,3};
v4sicst dcvec = {argc, 1,2,3};
-
- vector (4, int) res;
- v4si dres;
- register vector (4, int) rres;
-
- vector (4, int) mask = {0,3,2,1};
- const vector (4, int) cmask = {0,3,2,1};
- register vector (4, int) rmask = {0,3,2,1};
- v4si dmask = {0,3,2,1};
- v4sicst dcmask = {0,3,2,1};
-
- test_compat (res, vec, mask);
-
- return 0;
-}
-
-/* Test that different type variants are compatible within
- vector shuffling. */
-#define vector(elcount, type) \
-__attribute__((vector_size((elcount)*sizeof(type)))) type
-
-#define shufcompare(count, vres, v0, mask) \
-do { \
- int __i; \
- for (__i = 0; __i < count; __i++) { \
- if (vres[__i] != v0[mask[__i]]) \
- __builtin_abort (); \
- } \
-} while (0)
-
-#define test_compat_mask(res, vec, mask) \
- res = __builtin_shuffle (vec, mask); \
- shufcompare(4, res, vec, mask); \
- res = __builtin_shuffle (vec, c ## mask); \
- shufcompare(4, res, vec, c ## mask); \
- res = __builtin_shuffle (vec, r ## mask); \
- shufcompare(4, res, vec, r ## mask); \
- res = __builtin_shuffle (vec, d ## mask); \
- shufcompare(4, res, vec, d ## mask); \
- res = __builtin_shuffle (vec, dc ## mask); \
- shufcompare(4, res, vec, dc ## mask); \
-
-#define test_compat_vec(res, vec, mask) \
- test_compat_mask (res, vec, mask); \
- test_compat_mask (res, c ## vec, mask); \
- test_compat_mask (res, r ## vec, mask); \
- test_compat_mask (res, d ## vec, mask); \
- test_compat_mask (res, dc ## vec, mask);
-
-#define test_compat(res, vec, mask) \
- test_compat_vec (res, vec, mask); \
- test_compat_vec (d ## res, vec, mask); \
- test_compat_vec (r ## res, vec, mask);
-
-typedef vector (4, int) v4si;
-typedef const vector (4, int) v4sicst;
-
-int main (int argc, char *argv[]) {
- vector (4, int) vec = {argc, 1,2,3};
- const vector (4, int) cvec = {argc, 1,2,3};
- register vector (4, int) rvec = {argc, 1,2,3};
- v4si dvec = {argc, 1,2,3};
- v4sicst dcvec = {argc, 1,2,3};
-
- vector (4, int) res;
+ vector (4, int) res;
v4si dres;
register vector (4, int) rres;
@@ -126,3 +62,4 @@ int main (int argc, char *argv[]) {
return 0;
}
+