52 unsigned long long a[2];
70 #define ARRAY_SIZE(A) (sizeof (A) / sizeof ((A)[0]))
79 #define CHECK_EXP(UINON_TYPE, VALUE_TYPE, FMT) \
81 __attribute__((optimize ("no-strict-aliasing"))) \
82 __attribute__((noinline, unused)) \
83 check_##UINON_TYPE (UINON_TYPE u, const VALUE_TYPE *v) \
88 for (i = 0; i < ARRAY_SIZE (u.a); i++) \
92 PRINTF ("%i: " FMT " != " FMT "\n", \
99 CHECK_EXP (union128i_b, char, "%d")
100 CHECK_EXP (union128i_ub, unsigned char, "%d")
101 CHECK_EXP (union128i_w, short, "%d")
102 CHECK_EXP (union128i_uw, unsigned short, "%d")
103 CHECK_EXP (union128i_d, int, "0x%x")
104 CHECK_EXP (union128i_ud, unsigned int, "0x%x")
105 CHECK_EXP (union128i_q, long long, "0x%llx")
106 CHECK_EXP (union128i_uq, unsigned long long, "0x%llx")
107 CHECK_EXP (union128d, double, "%f")
110 CHECK_EXP (union128, float, "%f")
113 #define ESP_FLOAT 0.000001
116 #define ESP_DOUBLE 0.000001
118 #define CHECK_ARRAY(ARRAY, TYPE, FMT) \
120 __attribute__((noinline, unused)) \
121 checkV##ARRAY (const TYPE *v, const TYPE *e, int n) \
126 for (i = 0; i < n; i++) \
130 PRINTF ("%i: " FMT " != " FMT "\n", \
136 CHECK_ARRAY(c, char, "0x%hhx")
137 CHECK_ARRAY(s, short, "0x%hx")
138 CHECK_ARRAY(i, int, "0x%x")
139 CHECK_ARRAY(l, long long, "0x%llx")
140 CHECK_ARRAY(uc, unsigned char, "0x%hhx")
141 CHECK_ARRAY(us, unsigned short, "0x%hx")
142 CHECK_ARRAY(ui, unsigned int, "0x%x")
143 CHECK_ARRAY(ul, unsigned long long, "0x%llx")
147 #define CHECK_FP_ARRAY(ARRAY, TYPE, ESP, FMT) \
149 __attribute__((noinline, unused)) \
150 checkV##ARRAY (const TYPE *v, const TYPE *e, int n) \
155 for (i = 0; i < n; i++) \
156 if (v[i] > (e[i] + (ESP)) || v[i] < (e[i] - (ESP))) \
160 PRINTF ("%i: " FMT " != " FMT "\n", \
166 CHECK_FP_ARRAY (d, double, ESP_DOUBLE, "%f")
167 CHECK_FP_ARRAY (f, float, ESP_FLOAT, "%f")
169 #ifdef NEED_IEEE754_FLOAT
175 unsigned long frac : 23;
178 } bits __attribute__((packed));
182 #ifdef NEED_IEEE754_DOUBLE
188 unsigned long frac1 : 32;
189 unsigned long frac0 : 20;
192 } bits __attribute__((packed));
196 #define CHECK_FP_EXP(UINON_TYPE, VALUE_TYPE, ESP, FMT) \
198 __attribute__((noinline, unused)) \
199 check_fp_##UINON_TYPE (UINON_TYPE u, const VALUE_TYPE *v) \
204 for (i = 0; i < ARRAY_SIZE (u.a); i++) \
205 if (u.a[i] > (v[i] + (ESP)) || u.a[i] < (v[i] - (ESP))) \
208 PRINTF ("%i: " FMT " != " FMT "\n", \
214 CHECK_FP_EXP (union128, float, ESP_FLOAT, "%f")
216 CHECK_FP_EXP (union128d, double, ESP_DOUBLE, "%f")