Debian Codegraph @

gcc/testsuite/gcc.target/loongarch/vector/simd_correctness_check.h

raw
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4
5 #define ASSERTEQ_64(line, ref, res) \
6 do \
7 { \
8 int fail = 0; \
9 for (size_t i = 0; i < sizeof (res) / sizeof (res[0]); ++i) \
10 { \
11 long long *temp_ref = (long long *)&ref[i], \
12 *temp_res = (long long *)&res[i]; \
13 if (llabs (*temp_ref - *temp_res) > 0) \
14 { \
15 printf (" error: %s at line %ld , expected " #ref \
16 "[%ld]:0x%016lx, got: 0x%016lx\n", \
17 __FILE__, line, i, *temp_ref, *temp_res); \
18 fail = 1; \
19 } \
20 } \
21 if (fail == 1) \
22 abort (); \
23 } \
24 while (0)
25
26 #define ASSERTEQ_32(line, ref, res) \
27 do \
28 { \
29 int fail = 0; \
30 for (size_t i = 0; i < sizeof (res) / sizeof (res[0]); ++i) \
31 { \
32 int *temp_ref = (int *)&ref[i], *temp_res = (int *)&res[i]; \
33 if (abs (*temp_ref - *temp_res) > 0) \
34 { \
35 printf (" error: %s at line %ld , expected " #ref \
36 "[%ld]:0x%08x, got: 0x%08x\n", \
37 __FILE__, line, i, *temp_ref, *temp_res); \
38 fail = 1; \
39 } \
40 } \
41 if (fail == 1) \
42 abort (); \
43 } \
44 while (0)
45
46 #define ASSERTEQ_int(line, ref, res) \
47 do \
48 { \
49 if (ref != res) \
50 { \
51 printf (" error: %s at line %ld , expected 0x:%016x", \
52 "got 0x:%016x\n", __FILE__, line, ref, res); \
53 } \
54 } \
55 while (0)