Remove outermost loop parameter.
[official-gcc/graphite-test-results.git] / gcc / testsuite / gcc.target / i386 / m128-check.h
blob4e2deecb172551d56ad34c348c51d05a70a61a60
1 #include <stdio.h>
2 #include <xmmintrin.h>
4 #ifdef __SSE2__
5 #include <emmintrin.h>
7 typedef union
9 __m128i x;
10 char a[16];
11 } union128i_b;
13 typedef union
15 __m128i x;
16 unsigned char a[16];
17 } union128i_ub;
19 typedef union
21 __m128i x;
22 short a[8];
23 } union128i_w;
25 typedef union
27 __m128i x;
28 unsigned short a[8];
29 } union128i_uw;
31 typedef union
33 __m128i x;
34 int a[4];
35 } union128i_d;
37 typedef union
39 __m128i x;
40 long long a[2];
41 } union128i_q;
43 typedef union
45 __m128d x;
46 double a[2];
47 } union128d;
48 #endif
50 typedef union
52 __m128 x;
53 float a[4];
54 } union128;
56 #ifndef ARRAY_SIZE
57 #define ARRAY_SIZE(A) (sizeof (A) / sizeof ((A)[0]))
58 #endif
60 #ifdef DEBUG
61 #define PRINTF printf
62 #else
63 #define PRINTF(...)
64 #endif
66 #define CHECK_EXP(UINON_TYPE, VALUE_TYPE, FMT) \
67 static int \
68 __attribute__((noinline, unused)) \
69 check_##UINON_TYPE (UINON_TYPE u, const VALUE_TYPE *v) \
70 { \
71 int i; \
72 int err = 0; \
74 for (i = 0; i < ARRAY_SIZE (u.a); i++) \
75 if (u.a[i] != v[i]) \
76 { \
77 err++; \
78 PRINTF ("%i: " FMT " != " FMT "\n", \
79 i, v[i], u.a[i]); \
80 } \
81 return err; \
84 #ifdef __SSE2__
85 CHECK_EXP (union128i_b, char, "%d")
86 CHECK_EXP (union128i_ub, unsigned char, "%d")
87 CHECK_EXP (union128i_w, short, "%d")
88 CHECK_EXP (union128i_uw, unsigned short, "%d")
89 CHECK_EXP (union128i_d, int, "0x%x")
90 CHECK_EXP (union128i_q, long long, "0x%llx")
91 CHECK_EXP (union128d, double, "%f")
92 #endif
94 CHECK_EXP (union128, float, "%f")
96 #define ESP_FLOAT 0.000001
97 #define ESP_DOUBLE 0.000001
98 #define CHECK_ARRAY(ARRAY, TYPE, FMT) \
99 static int \
100 __attribute__((noinline, unused)) \
101 checkV##ARRAY (const TYPE *v, const TYPE *e, int n) \
103 int i; \
104 int err = 0; \
106 for (i = 0; i < n; i++) \
107 if (v[i] != e[i]) \
109 err++; \
110 PRINTF ("%i: " FMT " != " FMT "\n", \
111 i, v[i], e[i]); \
113 return err; \
116 CHECK_ARRAY(i, int, "0x%x")
117 CHECK_ARRAY(l, long long, "0x%llx")
119 #define CHECK_FP_ARRAY(ARRAY, TYPE, ESP, FMT) \
120 static int \
121 __attribute__((noinline, unused)) \
122 checkV##ARRAY (const TYPE *v, const TYPE *e, int n) \
124 int i; \
125 int err = 0; \
127 for (i = 0; i < n; i++) \
128 if (v[i] > (e[i] + (ESP)) || v[i] < (e[i] - (ESP))) \
129 if (e[i] != v[i]) \
131 err++; \
132 PRINTF ("%i: " FMT " != " FMT "\n", \
133 i, v[i], e[i]); \
135 return err; \
138 CHECK_FP_ARRAY (d, double, ESP_DOUBLE, "%f")
139 CHECK_FP_ARRAY (f, float, ESP_FLOAT, "%f")
141 #ifdef NEED_IEEE754_FLOAT
142 union ieee754_float
144 float d;
145 struct
147 unsigned long frac : 23;
148 unsigned exp : 8;
149 unsigned sign : 1;
150 } bits __attribute__((packed));
152 #endif
154 #ifdef NEED_IEEE754_DOUBLE
155 union ieee754_double
157 double d;
158 struct
160 unsigned long frac1 : 32;
161 unsigned long frac0 : 20;
162 unsigned exp : 11;
163 unsigned sign : 1;
164 } bits __attribute__((packed));
166 #endif