comparison test/test_arith.h @ 23:e26874655738

*: huge refactor, new major release (hahaha) I keep finding things that are broken... The problem NOW was that vec would unintentionally build some functions with extended instruction sets, which is Bad and would mean that for all intents and purposes the CPU detection was completely broken. Now vec is no longer header only either. Boohoo. However this gives a lot more flexibility to vec since we no longer want or need to care about C++ crap. The NEON and Altivec implementations have not been updated which means they won't compile hence why they're commented out in the cmake build file.
author Paper <paper@tflc.us>
date Sun, 24 Nov 2024 02:52:40 -0500
parents 41dd962abdd1
children 92156fe32755
comparison
equal deleted inserted replaced
22:fbcd3fa6f8fc 23:e26874655738
37 v##sign##int##bits##x##size##_store_aligned(a, orig_a); \ 37 v##sign##int##bits##x##size##_store_aligned(a, orig_a); \
38 vuint##bits##x##size##_store_aligned(b, orig_b); \ 38 vuint##bits##x##size##_store_aligned(b, orig_b); \
39 v##sign##int##bits##x##size##_store_aligned(c, orig_c); \ 39 v##sign##int##bits##x##size##_store_aligned(c, orig_c); \
40 \ 40 \
41 for (int i = 0; i < size; i++) { \ 41 for (int i = 0; i < size; i++) { \
42 if ((sign##int##bits##_t)(equiv) != orig_c[i]) { \ 42 if ((vec_##sign##int##bits)(equiv) != orig_c[i]) { \
43 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]); \ 43 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]); \
44 print_v##sign##int##bits##x##size(stderr,a); \ 44 print_v##sign##int##bits##x##size(stderr,a); \
45 print_vuint##bits##x##size(stderr,b); \ 45 print_vuint##bits##x##size(stderr,b); \
46 print_v##sign##int##bits##x##size(stderr,c); \ 46 print_v##sign##int##bits##x##size(stderr,c); \
47 fprintf(stderr, "\n"); \ 47 fprintf(stderr, "\n"); \
48 return 1; \ 48 return 1; \
58 CREATE_TEST(sign, psign, csign, bits, size, mul, orig_a[i] * orig_b[i]) \ 58 CREATE_TEST(sign, psign, csign, bits, size, mul, orig_a[i] * orig_b[i]) \
59 CREATE_TEST(sign, psign, csign, bits, size, div, (orig_b[i]) ? (orig_a[i] / orig_b[i]) : 0) \ 59 CREATE_TEST(sign, psign, csign, bits, size, div, (orig_b[i]) ? (orig_a[i] / orig_b[i]) : 0) \
60 CREATE_TEST(sign, psign, csign, bits, size, and, orig_a[i] & orig_b[i]) \ 60 CREATE_TEST(sign, psign, csign, bits, size, and, orig_a[i] & orig_b[i]) \
61 CREATE_TEST(sign, psign, csign, bits, size, or, orig_a[i] | orig_b[i]) \ 61 CREATE_TEST(sign, psign, csign, bits, size, or, orig_a[i] | orig_b[i]) \
62 CREATE_TEST(sign, psign, csign, bits, size, xor, orig_a[i] ^ orig_b[i]) \ 62 CREATE_TEST(sign, psign, csign, bits, size, xor, orig_a[i] ^ orig_b[i]) \
63 CREATE_TEST(sign, psign, csign, bits, size, avg, (sign##int##bits##_t)(orig_a[i] + orig_b[i]) / 2) \ 63 CREATE_TEST(sign, psign, csign, bits, size, avg, (orig_a[i] + orig_b[i] + 1) / 2) \
64 CREATE_TEST_SHIFT(sign, psign, csign, bits, size, rshift, vec_##sign##rshift(orig_a[i], orig_b[i])) \ 64 CREATE_TEST_SHIFT(sign, psign, csign, bits, size, rshift, vec_##sign##rshift(orig_a[i], orig_b[i])) \
65 CREATE_TEST_SHIFT(sign, psign, csign, bits, size, lshift, vec_##sign##lshift(orig_a[i], orig_b[i])) \ 65 CREATE_TEST_SHIFT(sign, psign, csign, bits, size, lshift, vec_##sign##lshift(orig_a[i], orig_b[i])) \
66 CREATE_TEST_SHIFT(sign, psign, csign, bits, size, lrshift, vec_##sign##lrshift(orig_a[i], orig_b[i])) 66 CREATE_TEST_SHIFT(sign, psign, csign, bits, size, lrshift, vec_lrshift((vec_uint##bits)orig_a[i], orig_b[i]))
67 67
68 #define CREATE_TESTS(bits, size) \ 68 #define CREATE_TESTS(bits, size) \
69 CREATE_TESTS_SIGN(, d, , bits, size) \ 69 CREATE_TESTS_SIGN(, d, , bits, size) \
70 CREATE_TESTS_SIGN(u, u, U, bits, size) 70 CREATE_TESTS_SIGN(u, u, U, bits, size)
71 71