Mercurial > vec
comparison test/test_arith.h @ 10:d1d5d767004c
chore: merge diverging branches
author | Paper <paper@tflc.us> |
---|---|
date | Mon, 18 Nov 2024 15:44:09 -0500 |
parents | 6ff0b7a44bb6 945d410803f8 |
children | 53197dbf4e8e |
comparison
equal
deleted
inserted
replaced
9:6ff0b7a44bb6 | 10:d1d5d767004c |
---|---|
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 ((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, 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]); \ |
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, (orig_a[i] * orig_b[i]) / 2) \ | 63 CREATE_TEST(sign, psign, csign, bits, size, avg, (sign##int##bits##_t)(orig_a[i] + orig_b[i]) / 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_##sign##lrshift(orig_a[i], orig_b[i])) |
67 | 67 |
68 #define CREATE_TESTS(bits, size) \ | 68 #define CREATE_TESTS(bits, size) \ |
102 ret |= test_arith_v##sign##int##bits##x##size##_mul(a, b); \ | 102 ret |= test_arith_v##sign##int##bits##x##size##_mul(a, b); \ |
103 ret |= test_arith_v##sign##int##bits##x##size##_div(a, b); \ | 103 ret |= test_arith_v##sign##int##bits##x##size##_div(a, b); \ |
104 ret |= test_arith_v##sign##int##bits##x##size##_and(a, b); \ | 104 ret |= test_arith_v##sign##int##bits##x##size##_and(a, b); \ |
105 ret |= test_arith_v##sign##int##bits##x##size##_or(a, b); \ | 105 ret |= test_arith_v##sign##int##bits##x##size##_or(a, b); \ |
106 ret |= test_arith_v##sign##int##bits##x##size##_xor(a, b); \ | 106 ret |= test_arith_v##sign##int##bits##x##size##_xor(a, b); \ |
107 ret |= test_arith_v##sign##int##bits##x##size##_avg(a, b); \ | |
107 } \ | 108 } \ |
108 } \ | 109 } \ |
109 \ | 110 \ |
110 for (size_t i = 0U; i < ARRAY_SIZE(testval##sign##bits); i++) { \ | 111 for (size_t i = 0U; i < ARRAY_SIZE(testval##sign##bits); i++) { \ |
111 const v##sign##int##bits##x##size a = vtest##sign##bits##x##size(i); \ | 112 const v##sign##int##bits##x##size a = vtest##sign##bits##x##size(i); \ |