Mercurial > vec
annotate test/test_arith.h @ 27:d00b95f95dd1 default tip
impl/arm/neon: it compiles again, but is untested
author | Paper <paper@tflc.us> |
---|---|
date | Mon, 25 Nov 2024 00:33:02 -0500 |
parents | 92156fe32755 |
children |
rev | line source |
---|---|
25
92156fe32755
impl/ppc/altivec: update to new implementation
Paper <paper@tflc.us>
parents:
23
diff
changeset
|
1 #include <math.h> |
92156fe32755
impl/ppc/altivec: update to new implementation
Paper <paper@tflc.us>
parents:
23
diff
changeset
|
2 |
4
75ab77f874e2
*: aligned generics, fixed altivec, aligned tests...
Paper <paper@tflc.us>
parents:
3
diff
changeset
|
3 #define CREATE_TEST(sign, psign, csign, bits, size, op, equiv) \ |
2
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
4 static int test_arith_v##sign##int##bits##x##size##_##op(v##sign##int##bits##x##size a, v##sign##int##bits##x##size b) \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
5 { \ |
4
75ab77f874e2
*: aligned generics, fixed altivec, aligned tests...
Paper <paper@tflc.us>
parents:
3
diff
changeset
|
6 V##csign##INT##bits##x##size##_ALIGNED_ARRAY(orig_a); \ |
75ab77f874e2
*: aligned generics, fixed altivec, aligned tests...
Paper <paper@tflc.us>
parents:
3
diff
changeset
|
7 V##csign##INT##bits##x##size##_ALIGNED_ARRAY(orig_b); \ |
75ab77f874e2
*: aligned generics, fixed altivec, aligned tests...
Paper <paper@tflc.us>
parents:
3
diff
changeset
|
8 V##csign##INT##bits##x##size##_ALIGNED_ARRAY(orig_c); \ |
2
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
9 \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
10 v##sign##int##bits##x##size c = v##sign##int##bits##x##size##_##op(a, b); \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
11 \ |
4
75ab77f874e2
*: aligned generics, fixed altivec, aligned tests...
Paper <paper@tflc.us>
parents:
3
diff
changeset
|
12 v##sign##int##bits##x##size##_store_aligned(a, orig_a); \ |
75ab77f874e2
*: aligned generics, fixed altivec, aligned tests...
Paper <paper@tflc.us>
parents:
3
diff
changeset
|
13 v##sign##int##bits##x##size##_store_aligned(b, orig_b); \ |
75ab77f874e2
*: aligned generics, fixed altivec, aligned tests...
Paper <paper@tflc.us>
parents:
3
diff
changeset
|
14 v##sign##int##bits##x##size##_store_aligned(c, orig_c); \ |
2
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
15 \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
16 for (int i = 0; i < size; i++) { \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
17 if ((sign##int##bits##_t)(equiv) != orig_c[i]) { \ |
25
92156fe32755
impl/ppc/altivec: update to new implementation
Paper <paper@tflc.us>
parents:
23
diff
changeset
|
18 fprintf(stderr, "v" #sign "int" #bits "x" #size "_" #op " test FAILED at index %d: (" #equiv ") [%" PRI ## psign ## bits "] does not equal result [%" PRI ## psign ## bits "]!\n", i, (sign##int##bits##_t)(equiv), orig_c[i]); \ |
2
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
19 print_v##sign##int##bits##x##size(stderr,a); \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
20 print_v##sign##int##bits##x##size(stderr,b); \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
21 print_v##sign##int##bits##x##size(stderr,c); \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
22 fprintf(stderr, "\n"); \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
23 return 1; \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
24 } \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
25 } \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
26 \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
27 return 0; \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
28 } |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
29 |
4
75ab77f874e2
*: aligned generics, fixed altivec, aligned tests...
Paper <paper@tflc.us>
parents:
3
diff
changeset
|
30 #define CREATE_TEST_SHIFT(sign, psign, csign, bits, size, op, equiv) \ |
2
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
31 static int test_arith_v##sign##int##bits##x##size##_##op(v##sign##int##bits##x##size a, vuint##bits##x##size b) \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
32 { \ |
4
75ab77f874e2
*: aligned generics, fixed altivec, aligned tests...
Paper <paper@tflc.us>
parents:
3
diff
changeset
|
33 V##csign##INT##bits##x##size##_ALIGNED_ARRAY(orig_a); \ |
75ab77f874e2
*: aligned generics, fixed altivec, aligned tests...
Paper <paper@tflc.us>
parents:
3
diff
changeset
|
34 VUINT##bits##x##size##_ALIGNED_ARRAY(orig_b); \ |
75ab77f874e2
*: aligned generics, fixed altivec, aligned tests...
Paper <paper@tflc.us>
parents:
3
diff
changeset
|
35 V##csign##INT##bits##x##size##_ALIGNED_ARRAY(orig_c); \ |
2
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
36 \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
37 v##sign##int##bits##x##size c = v##sign##int##bits##x##size##_##op(a, b); \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
38 \ |
4
75ab77f874e2
*: aligned generics, fixed altivec, aligned tests...
Paper <paper@tflc.us>
parents:
3
diff
changeset
|
39 v##sign##int##bits##x##size##_store_aligned(a, orig_a); \ |
75ab77f874e2
*: aligned generics, fixed altivec, aligned tests...
Paper <paper@tflc.us>
parents:
3
diff
changeset
|
40 vuint##bits##x##size##_store_aligned(b, orig_b); \ |
75ab77f874e2
*: aligned generics, fixed altivec, aligned tests...
Paper <paper@tflc.us>
parents:
3
diff
changeset
|
41 v##sign##int##bits##x##size##_store_aligned(c, orig_c); \ |
2
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
42 \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
43 for (int i = 0; i < size; i++) { \ |
23
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
44 if ((vec_##sign##int##bits)(equiv) != orig_c[i]) { \ |
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
45 fprintf(stderr, "v" #sign "int" #bits "x" #size "_" #op " test FAILED at index %d: (" #equiv ") [%" PRI ## psign ## bits "] does not equal result [%" PRI ## psign ## bits "]!\n", i, (vec_##sign##int##bits)(equiv), orig_c[i]); \ |
2
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
46 print_v##sign##int##bits##x##size(stderr,a); \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
47 print_vuint##bits##x##size(stderr,b); \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
48 print_v##sign##int##bits##x##size(stderr,c); \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
49 fprintf(stderr, "\n"); \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
50 return 1; \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
51 } \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
52 } \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
53 \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
54 return 0; \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
55 } |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
56 |
9
6ff0b7a44bb6
generic: add initial support for 256-bit and 512-bit types
Paper <paper@tflc.us>
parents:
4
diff
changeset
|
57 #define CREATE_TESTS_SIGN(sign, psign, csign, bits, size) \ |
4
75ab77f874e2
*: aligned generics, fixed altivec, aligned tests...
Paper <paper@tflc.us>
parents:
3
diff
changeset
|
58 CREATE_TEST(sign, psign, csign, bits, size, add, orig_a[i] + orig_b[i]) \ |
75ab77f874e2
*: aligned generics, fixed altivec, aligned tests...
Paper <paper@tflc.us>
parents:
3
diff
changeset
|
59 CREATE_TEST(sign, psign, csign, bits, size, sub, orig_a[i] - orig_b[i]) \ |
75ab77f874e2
*: aligned generics, fixed altivec, aligned tests...
Paper <paper@tflc.us>
parents:
3
diff
changeset
|
60 CREATE_TEST(sign, psign, csign, bits, size, mul, orig_a[i] * orig_b[i]) \ |
75ab77f874e2
*: aligned generics, fixed altivec, aligned tests...
Paper <paper@tflc.us>
parents:
3
diff
changeset
|
61 CREATE_TEST(sign, psign, csign, bits, size, div, (orig_b[i]) ? (orig_a[i] / orig_b[i]) : 0) \ |
75ab77f874e2
*: aligned generics, fixed altivec, aligned tests...
Paper <paper@tflc.us>
parents:
3
diff
changeset
|
62 CREATE_TEST(sign, psign, csign, bits, size, and, orig_a[i] & orig_b[i]) \ |
75ab77f874e2
*: aligned generics, fixed altivec, aligned tests...
Paper <paper@tflc.us>
parents:
3
diff
changeset
|
63 CREATE_TEST(sign, psign, csign, bits, size, or, orig_a[i] | orig_b[i]) \ |
75ab77f874e2
*: aligned generics, fixed altivec, aligned tests...
Paper <paper@tflc.us>
parents:
3
diff
changeset
|
64 CREATE_TEST(sign, psign, csign, bits, size, xor, orig_a[i] ^ orig_b[i]) \ |
25
92156fe32755
impl/ppc/altivec: update to new implementation
Paper <paper@tflc.us>
parents:
23
diff
changeset
|
65 CREATE_TEST(sign, psign, csign, bits, size, avg, vec_##sign##avg(orig_a[i], orig_b[i])) \ |
4
75ab77f874e2
*: aligned generics, fixed altivec, aligned tests...
Paper <paper@tflc.us>
parents:
3
diff
changeset
|
66 CREATE_TEST_SHIFT(sign, psign, csign, bits, size, rshift, vec_##sign##rshift(orig_a[i], orig_b[i])) \ |
75ab77f874e2
*: aligned generics, fixed altivec, aligned tests...
Paper <paper@tflc.us>
parents:
3
diff
changeset
|
67 CREATE_TEST_SHIFT(sign, psign, csign, bits, size, lshift, vec_##sign##lshift(orig_a[i], orig_b[i])) \ |
23
e26874655738
*: huge refactor, new major release (hahaha)
Paper <paper@tflc.us>
parents:
17
diff
changeset
|
68 CREATE_TEST_SHIFT(sign, psign, csign, bits, size, lrshift, vec_lrshift((vec_uint##bits)orig_a[i], orig_b[i])) |
2
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
69 |
9
6ff0b7a44bb6
generic: add initial support for 256-bit and 512-bit types
Paper <paper@tflc.us>
parents:
4
diff
changeset
|
70 #define CREATE_TESTS(bits, size) \ |
6ff0b7a44bb6
generic: add initial support for 256-bit and 512-bit types
Paper <paper@tflc.us>
parents:
4
diff
changeset
|
71 CREATE_TESTS_SIGN(, d, , bits, size) \ |
6ff0b7a44bb6
generic: add initial support for 256-bit and 512-bit types
Paper <paper@tflc.us>
parents:
4
diff
changeset
|
72 CREATE_TESTS_SIGN(u, u, U, bits, size) |
6ff0b7a44bb6
generic: add initial support for 256-bit and 512-bit types
Paper <paper@tflc.us>
parents:
4
diff
changeset
|
73 |
17
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
74 CREATE_TESTS(8, 2) |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
75 |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
76 CREATE_TESTS(8, 4) |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
77 CREATE_TESTS(16, 2) |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
78 |
15
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
13
diff
changeset
|
79 CREATE_TESTS(8, 8) |
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
13
diff
changeset
|
80 CREATE_TESTS(16, 4) |
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
13
diff
changeset
|
81 CREATE_TESTS(32, 2) |
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
13
diff
changeset
|
82 |
9
6ff0b7a44bb6
generic: add initial support for 256-bit and 512-bit types
Paper <paper@tflc.us>
parents:
4
diff
changeset
|
83 CREATE_TESTS(8, 16) |
15
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
13
diff
changeset
|
84 CREATE_TESTS(16, 8) |
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
13
diff
changeset
|
85 CREATE_TESTS(32, 4) |
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
13
diff
changeset
|
86 CREATE_TESTS(64, 2) |
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
13
diff
changeset
|
87 |
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
13
diff
changeset
|
88 CREATE_TESTS(8, 32) |
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
13
diff
changeset
|
89 CREATE_TESTS(16, 16) |
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
13
diff
changeset
|
90 CREATE_TESTS(32, 8) |
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
13
diff
changeset
|
91 CREATE_TESTS(64, 4) |
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
13
diff
changeset
|
92 |
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
13
diff
changeset
|
93 CREATE_TESTS(8, 64) |
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
13
diff
changeset
|
94 CREATE_TESTS(16, 32) |
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
13
diff
changeset
|
95 CREATE_TESTS(32, 16) |
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
13
diff
changeset
|
96 CREATE_TESTS(64, 8) |
9
6ff0b7a44bb6
generic: add initial support for 256-bit and 512-bit types
Paper <paper@tflc.us>
parents:
4
diff
changeset
|
97 |
6ff0b7a44bb6
generic: add initial support for 256-bit and 512-bit types
Paper <paper@tflc.us>
parents:
4
diff
changeset
|
98 #undef CREATE_TESTS_SIGN |
2
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
99 #undef CREATE_TESTS |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
100 #undef CREATE_TEST |
17
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
101 #undef CREATE_TEST_SHIFT |
2
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
102 |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
103 static int test_arith(void) |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
104 { |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
105 int ret = 0; |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
106 |
9
6ff0b7a44bb6
generic: add initial support for 256-bit and 512-bit types
Paper <paper@tflc.us>
parents:
4
diff
changeset
|
107 #define RUN_TESTS_SIGN(sign, bits, size) \ |
2
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
108 for (size_t i = 0U; i < ARRAY_SIZE(testval##sign##bits); i++) { \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
109 const v##sign##int##bits##x##size a = vtest##sign##bits##x##size(i); \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
110 for (size_t j = 0U; j < ARRAY_SIZE(testval##sign##bits); j++) { \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
111 const v##sign##int##bits##x##size b = vtest##sign##bits##x##size(j); \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
112 ret |= test_arith_v##sign##int##bits##x##size##_add(a, b); \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
113 ret |= test_arith_v##sign##int##bits##x##size##_sub(a, b); \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
114 ret |= test_arith_v##sign##int##bits##x##size##_mul(a, b); \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
115 ret |= test_arith_v##sign##int##bits##x##size##_div(a, b); \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
116 ret |= test_arith_v##sign##int##bits##x##size##_and(a, b); \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
117 ret |= test_arith_v##sign##int##bits##x##size##_or(a, b); \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
118 ret |= test_arith_v##sign##int##bits##x##size##_xor(a, b); \ |
7
945d410803f8
*: fix clang & gcc warnings, add avg test, etc
Paper <paper@tflc.us>
parents:
4
diff
changeset
|
119 ret |= test_arith_v##sign##int##bits##x##size##_avg(a, b); \ |
2
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
120 } \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
121 } \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
122 \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
123 for (size_t i = 0U; i < ARRAY_SIZE(testval##sign##bits); i++) { \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
124 const v##sign##int##bits##x##size a = vtest##sign##bits##x##size(i); \ |
4
75ab77f874e2
*: aligned generics, fixed altivec, aligned tests...
Paper <paper@tflc.us>
parents:
3
diff
changeset
|
125 for (uint32_t j = 0U; j < bits; j++) { \ |
75ab77f874e2
*: aligned generics, fixed altivec, aligned tests...
Paper <paper@tflc.us>
parents:
3
diff
changeset
|
126 const vuint##bits##x##size b = vuint##bits##x##size##_splat(j); \ |
2
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
127 ret |= test_arith_v##sign##int##bits##x##size##_rshift(a, b); \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
128 ret |= test_arith_v##sign##int##bits##x##size##_lshift(a, b); \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
129 ret |= test_arith_v##sign##int##bits##x##size##_lrshift(a, b); \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
130 } \ |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
131 } |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
132 |
9
6ff0b7a44bb6
generic: add initial support for 256-bit and 512-bit types
Paper <paper@tflc.us>
parents:
4
diff
changeset
|
133 #define RUN_TESTS(bits, size) \ |
6ff0b7a44bb6
generic: add initial support for 256-bit and 512-bit types
Paper <paper@tflc.us>
parents:
4
diff
changeset
|
134 RUN_TESTS_SIGN( , bits, size) \ |
6ff0b7a44bb6
generic: add initial support for 256-bit and 512-bit types
Paper <paper@tflc.us>
parents:
4
diff
changeset
|
135 RUN_TESTS_SIGN(u, bits, size) |
6ff0b7a44bb6
generic: add initial support for 256-bit and 512-bit types
Paper <paper@tflc.us>
parents:
4
diff
changeset
|
136 |
17
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
137 RUN_TESTS(8, 2) |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
138 |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
139 RUN_TESTS(8, 4) |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
140 RUN_TESTS(16, 2) |
41dd962abdd1
*: allow compiling vec in a C++ translation unit
Paper <paper@tflc.us>
parents:
15
diff
changeset
|
141 |
15
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
13
diff
changeset
|
142 RUN_TESTS(8, 8) |
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
13
diff
changeset
|
143 RUN_TESTS(16, 4) |
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
13
diff
changeset
|
144 RUN_TESTS(32, 2) |
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
13
diff
changeset
|
145 |
9
6ff0b7a44bb6
generic: add initial support for 256-bit and 512-bit types
Paper <paper@tflc.us>
parents:
4
diff
changeset
|
146 RUN_TESTS(8, 16) |
15
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
13
diff
changeset
|
147 RUN_TESTS(16, 8) |
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
13
diff
changeset
|
148 RUN_TESTS(32, 4) |
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
13
diff
changeset
|
149 RUN_TESTS(64, 2) |
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
13
diff
changeset
|
150 |
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
13
diff
changeset
|
151 RUN_TESTS(8, 32) |
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
13
diff
changeset
|
152 RUN_TESTS(16, 16) |
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
13
diff
changeset
|
153 RUN_TESTS(32, 8) |
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
13
diff
changeset
|
154 RUN_TESTS(64, 4) |
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
13
diff
changeset
|
155 |
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
13
diff
changeset
|
156 RUN_TESTS(8, 64) |
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
13
diff
changeset
|
157 RUN_TESTS(16, 32) |
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
13
diff
changeset
|
158 RUN_TESTS(32, 16) |
e05c257c6a23
*: huge refactor, add many new x86 intrinsics and the like
Paper <paper@tflc.us>
parents:
13
diff
changeset
|
159 RUN_TESTS(64, 8) |
9
6ff0b7a44bb6
generic: add initial support for 256-bit and 512-bit types
Paper <paper@tflc.us>
parents:
4
diff
changeset
|
160 |
6ff0b7a44bb6
generic: add initial support for 256-bit and 512-bit types
Paper <paper@tflc.us>
parents:
4
diff
changeset
|
161 #undef RUN_TESTS_SIGN |
2
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
162 #undef RUN_TESTS |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
163 |
f12b5dd4e18c
*: many new operations and a real test suite
Paper <paper@tflc.us>
parents:
diff
changeset
|
164 return ret; |
3
3c5545b1568f
*: much better alignment support & tests
Paper <paper@tflc.us>
parents:
2
diff
changeset
|
165 } |