2 #include "m256-check.h"
61 unsigned long long a
[8];
103 unsigned short a
[16];
118 #define CHECK_ROUGH_EXP(UNION_TYPE, VALUE_TYPE, FMT) \
120 __attribute__((noinline, unused)) \
121 check_rough_##UNION_TYPE (UNION_TYPE u, const VALUE_TYPE *v, \
127 for (i = 0; i < ARRAY_SIZE (u.a); i++) \
129 /* We can have have v[i] == 0 == u.a[i] for some i, \
130 when we test zero-masking. */ \
131 if (v[i] == 0.0 && u.a[i] == 0.0) \
133 if (v[i] == 0.0 && u.a[i] != 0.0) \
136 PRINTF ("%i: " FMT " != " FMT "\n", \
139 VALUE_TYPE rel_err = (u.a[i] - v[i]) / v[i]; \
140 if (((rel_err < 0) ? -rel_err : rel_err) > eps) \
143 PRINTF ("%i: " FMT " != " FMT "\n", \
151 #define ESP_FLOAT16 0.27
154 CHECK_ROUGH_EXP (union256
, float, "%f")
155 CHECK_ROUGH_EXP (union256d
, double, "%f")
156 CHECK_ROUGH_EXP (union128
, float, "%f")
157 CHECK_ROUGH_EXP (union128d
, double, "%f")
160 CHECK_EXP (union512i_b
, char, "%d")
161 CHECK_EXP (union512i_w
, short, "%d")
162 CHECK_EXP (union512i_d
, int, "0x%x")
163 CHECK_EXP (union512i_q
, long long, "0x%llx")
164 CHECK_EXP (union512
, float, "%f")
165 CHECK_EXP (union512d
, double, "%f")
166 CHECK_EXP (union512i_ub
, unsigned char, "%d")
167 CHECK_EXP (union512i_uw
, unsigned short, "%d")
168 CHECK_EXP (union512i_ud
, unsigned int, "0x%x")
169 CHECK_EXP (union512i_uq
, unsigned long long, "0x%llx")
171 CHECK_FP_EXP (union512
, float, ESP_FLOAT
, "%f")
172 CHECK_FP_EXP (union512d
, double, ESP_DOUBLE
, "%f")
174 CHECK_ROUGH_EXP (union512
, float, "%f")
175 CHECK_ROUGH_EXP (union512d
, double, "%f")
177 #if defined(AVX512FP16)
178 CHECK_EXP (union512h
, _Float16
, "%f")
179 CHECK_FP_EXP (union512h
, _Float16
, ESP_FLOAT16
, "%f")
180 CHECK_ROUGH_EXP (union512h
, _Float16
, "%f")
184 #if defined(AVX512FP16)
185 CHECK_EXP (union128h
, _Float16
, "%f")
186 CHECK_EXP (union256h
, _Float16
, "%f")
188 CHECK_FP_EXP (union128h
, _Float16
, ESP_FLOAT16
, "%f")
189 CHECK_FP_EXP (union256h
, _Float16
, ESP_FLOAT16
, "%f")
191 CHECK_ROUGH_EXP (union128h
, _Float16
, "%f")
192 CHECK_ROUGH_EXP (union256h
, _Float16
, "%f")
195 #if defined(AVX512BF16)
196 CHECK_EXP (union512bf16_uw
, unsigned short, "%d")
197 CHECK_EXP (union512bf16_bf
, __bf16
, "%f")
200 #if defined(AVX512BF16)
201 CHECK_EXP (union128bf16_uw
, unsigned short, "%d")
202 CHECK_EXP (union256bf16_uw
, unsigned short, "%d")
203 CHECK_EXP (union128bf16_bf
, __bf16
, "%f")
204 CHECK_EXP (union256bf16_bf
, __bf16
, "%f")