Mercurial > vec
comparison test/main.c @ 9:6ff0b7a44bb6
generic: add initial support for 256-bit and 512-bit types
eventually this could be expanded to add floating point stuff
as well
author | Paper <paper@tflc.us> |
---|---|
date | Mon, 18 Nov 2024 13:52:09 -0500 |
parents | 75ab77f874e2 |
children | d1d5d767004c |
comparison
equal
deleted
inserted
replaced
6:978c167dcceb | 9:6ff0b7a44bb6 |
---|---|
54 for (size_t i = 0; i < size; i++) \ | 54 for (size_t i = 0; i < size; i++) \ |
55 x[i] = testval##sign##bits[(start + i) % ARRAY_SIZE(testval##sign##bits)]; \ | 55 x[i] = testval##sign##bits[(start + i) % ARRAY_SIZE(testval##sign##bits)]; \ |
56 return v##sign##int##bits##x##size##_load_aligned(x); \ | 56 return v##sign##int##bits##x##size##_load_aligned(x); \ |
57 } | 57 } |
58 | 58 |
59 #define VTEST_SIGN(bits, size) VTEST(, , bits, size) VTEST(u, U, bits, size) | 59 #define VPRINT(sign, csign, psign, bits, size) \ |
60 | |
61 VTEST_SIGN(8, 16) | |
62 VTEST_SIGN(16, 8) | |
63 VTEST_SIGN(32, 4) | |
64 VTEST_SIGN(64, 2) | |
65 | |
66 #define DEFINE_PRINT_VECTOR(sign, csign, psign, bits, size) \ | |
67 static inline void print_v##sign##int##bits##x##size(FILE *file, v##sign##int##bits##x##size vec) \ | 60 static inline void print_v##sign##int##bits##x##size(FILE *file, v##sign##int##bits##x##size vec) \ |
68 { \ | 61 { \ |
69 fputs("vector: ", file); \ | 62 fputs("vector: ", file); \ |
70 \ | 63 \ |
71 V##csign##INT##bits##x##size##_ALIGNED_ARRAY(v); \ | 64 V##csign##INT##bits##x##size##_ALIGNED_ARRAY(v); \ |
79 \ | 72 \ |
80 fputs("\n", file); \ | 73 fputs("\n", file); \ |
81 \ | 74 \ |
82 } | 75 } |
83 | 76 |
84 #define DEFINE_PRINT_VECTOR_2(bits, size) DEFINE_PRINT_VECTOR(, , d, bits, size) DEFINE_PRINT_VECTOR(u, U, u, bits, size) | 77 #define DEF_VEC_TEST_FUNCS(bits, size) \ |
78 VTEST(, , bits, size) VTEST(u, U, bits, size) \ | |
79 VPRINT(, , d, bits, size) VPRINT(u, U, u, bits, size) | |
85 | 80 |
86 DEFINE_PRINT_VECTOR_2(8, 16) | 81 DEF_VEC_TEST_FUNCS(8, 16) |
87 DEFINE_PRINT_VECTOR_2(16, 8) | 82 DEF_VEC_TEST_FUNCS(16, 8) |
88 DEFINE_PRINT_VECTOR_2(32, 4) | 83 DEF_VEC_TEST_FUNCS(32, 4) |
89 DEFINE_PRINT_VECTOR_2(64, 2) | 84 DEF_VEC_TEST_FUNCS(64, 2) |
85 | |
86 DEF_VEC_TEST_FUNCS(8, 32) | |
87 DEF_VEC_TEST_FUNCS(16, 16) | |
88 DEF_VEC_TEST_FUNCS(32, 8) | |
89 DEF_VEC_TEST_FUNCS(64, 4) | |
90 | |
91 DEF_VEC_TEST_FUNCS(8, 64) | |
92 DEF_VEC_TEST_FUNCS(16, 32) | |
93 DEF_VEC_TEST_FUNCS(32, 16) | |
94 DEF_VEC_TEST_FUNCS(64, 8) | |
95 | |
96 #undef DEF_VEC_TEST_FUNCS | |
97 #undef VPRINT | |
98 #undef VTEST | |
99 | |
100 // ------------------------------------------------------------ | |
90 | 101 |
91 #include "test_align.h" | 102 #include "test_align.h" |
92 #include "test_arith.h" | 103 #include "test_arith.h" |
93 #include "test_compare.h" | 104 #include "test_compare.h" |
105 | |
106 // ------------------------------------------------------------ | |
94 | 107 |
95 int main(void) | 108 int main(void) |
96 { | 109 { |
97 int ret = 0; | 110 int ret = 0; |
98 | 111 |