comparison test/test_align.h @ 13:53197dbf4e8e

vec.h: initial refactor for runtime SSE and stuff
author Paper <paper@tflc.us>
date Tue, 19 Nov 2024 15:54:38 -0500
parents 6ff0b7a44bb6
children e05c257c6a23
comparison
equal deleted inserted replaced
11:13575ba795d3 13:53197dbf4e8e
6 do { \ 6 do { \
7 /* allocate the aligned array */ \ 7 /* allocate the aligned array */ \
8 V##csign##INT##bits##x##size##_ALIGNED_ARRAY(vec_arr); \ 8 V##csign##INT##bits##x##size##_ALIGNED_ARRAY(vec_arr); \
9 \ 9 \
10 /* fill the values */ \ 10 /* fill the values */ \
11 for (int i = 0; i < V##csign##INT##bits##x##size##_ALIGNED_ARRAY_LENGTH(vec_arr); i++) \ 11 for (int i = 0; i < size; i++) \
12 vec_arr[i] = i; \ 12 vec_arr[i] = i; \
13 \ 13 \
14 /* try to load it */ \ 14 /* try to load it */ \
15 v##sign##int##bits##x##size vec = v##sign##int##bits##x##size##_load_aligned(vec_arr); \ 15 v##sign##int##bits##x##size vec = v##sign##int##bits##x##size##_load_aligned(vec_arr); \
16 \ 16 \
19 \ 19 \
20 /* try storing it */ \ 20 /* try storing it */ \
21 v##sign##int##bits##x##size##_store_aligned(vec, vec_arr_out); \ 21 v##sign##int##bits##x##size##_store_aligned(vec, vec_arr_out); \
22 \ 22 \
23 /* mark success or failure */ \ 23 /* mark success or failure */ \
24 ret |= !!memcmp(vec_arr, vec_arr_out, V##csign##INT##bits##x##size##_ALIGNED_ARRAY_LENGTH(vec_arr)); \ 24 ret |= !!memcmp(vec_arr, vec_arr_out, size * sizeof(*vec_arr)); \
25 \ 25 \
26 ret |= !V##csign##INT##bits##x##size##_PTR_ALIGNED(vec_arr); \ 26 ret |= !V##csign##INT##bits##x##size##_PTR_ALIGNED(vec_arr); \
27 ret |= !V##csign##INT##bits##x##size##_PTR_ALIGNED(vec_arr_out); \ 27 ret |= !V##csign##INT##bits##x##size##_PTR_ALIGNED(vec_arr_out); \
28 } while (0); 28 } while (0);
29 29
30 #define RUN_TESTS(bits, size) \ 30 #define RUN_TESTS(bits, size) \
31 RUN_TEST( , , bits, size) \ 31 RUN_TEST( , , bits, size) \
32 RUN_TEST(u, U, bits, size) 32 RUN_TEST(u, U, bits, size)
33 33
34 RUN_TESTS(8, 16) 34 RUN_TESTS(8, 16)
35 RUN_TESTS(16, 8)
36 RUN_TESTS(32, 4)
37 RUN_TESTS(64, 2)
38
39 RUN_TESTS(8, 32)
40 RUN_TESTS(16, 16)
41 RUN_TESTS(32, 8)
42 RUN_TESTS(64, 4)
43 35
44 #undef RUN_TESTS 36 #undef RUN_TESTS
45 #undef RUN_TEST 37 #undef RUN_TEST
46 38
47 return ret; 39 return ret;