Debian Codegraph @

gcc/testsuite/gcc.target/arm/lob.h

raw
1 #include <string.h>
2 #include <stdint.h>
3 /* Common code for lob tests. */
4
5 #define NO_LOB asm volatile ("@ clobber lr" : : : "lr" )
6
7 #define N 100
8
9 static void
10 reset_data (int *a, int *b, int *c, int x)
11 {
12 memset (a, -1, x * sizeof (*a));
13 memset (b, -1, x * sizeof (*b));
14 memset (c, 0, x * sizeof (*c));
15 }
16
17 static void
18 reset_data8 (int8_t *a, int8_t *b, int8_t *c, int x)
19 {
20 memset (a, -1, x * sizeof (*a));
21 memset (b, -1, x * sizeof (*b));
22 memset (c, 0, x * sizeof (*c));
23 }
24
25 static void
26 reset_data16 (int16_t *a, int16_t *b, int16_t *c, int x)
27 {
28 memset (a, -1, x * sizeof (*a));
29 memset (b, -1, x * sizeof (*b));
30 memset (c, 0, x * sizeof (*c));
31 }
32
33 static void
34 reset_data32 (int32_t *a, int32_t *b, int32_t *c, int x)
35 {
36 memset (a, -1, x * sizeof (*a));
37 memset (b, -1, x * sizeof (*b));
38 memset (c, 0, x * sizeof (*c));
39 }
40
41 static void
42 reset_data64 (int64_t *a, int64_t *c, int x)
43 {
44 memset (a, -1, x * sizeof (*a));
45 memset (c, 0, x * sizeof (*c));
46 }
47
48 static void
49 check_plus (int *a, int *b, int *c, int x)
50 {
51 for (int i = 0; i < N; i++)
52 {
53 NO_LOB;
54 if (i < x)
55 {
56 if (c[i] != (a[i] + b[i])) abort ();
57 }
58 else
59 {
60 if (c[i] != 0) abort ();
61 }
62 }
63 }
64
65 static void
66 check_plus8 (int8_t *a, int8_t *b, int8_t *c, int x)
67 {
68 for (int i = 0; i < N; i++)
69 {
70 NO_LOB;
71 if (i < x)
72 {
73 if (c[i] != (a[i] + b[i])) abort ();
74 }
75 else
76 {
77 if (c[i] != 0) abort ();
78 }
79 }
80 }
81
82 static void
83 check_plus16 (int16_t *a, int16_t *b, int16_t *c, int x)
84 {
85 for (int i = 0; i < N; i++)
86 {
87 NO_LOB;
88 if (i < x)
89 {
90 if (c[i] != (a[i] + b[i])) abort ();
91 }
92 else
93 {
94 if (c[i] != 0) abort ();
95 }
96 }
97 }
98
99 static void
100 check_plus32 (int32_t *a, int32_t *b, int32_t *c, int x)
101 {
102 for (int i = 0; i < N; i++)
103 {
104 NO_LOB;
105 if (i < x)
106 {
107 if (c[i] != (a[i] + b[i])) abort ();
108 }
109 else
110 {
111 if (c[i] != 0) abort ();
112 }
113 }
114 }
115
116 static void
117 check_memcpy64 (int64_t *a, int64_t *c, int x)
118 {
119 for (int i = 0; i < N; i++)
120 {
121 NO_LOB;
122 if (i < x)
123 {
124 if (c[i] != a[i]) abort ();
125 }
126 else
127 {
128 if (c[i] != 0) abort ();
129 }
130 }
131 }