19 uint8_t input[16] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
23 store_u8_16(output, v);
26 result.fail(
"Load/store u8x16 data mismatch");
31 uint32_t input[4] = {0x12345678, 0x9ABCDEF0, 0xFEDCBA98, 0x76543210};
35 store_u32_4(output, v);
37 for (
int i = 0; i < 4; i++) {
38 if (input[i] != output[i]) {
39 result.fail(
"Load/store u32x4 data mismatch");
46 float input[4] = {1.5f, 2.5f, 3.5f, 4.5f};
47 float output[4] = {0.0f};
50 store_f32_4(output, v);
53 result.fail(
"Load/store f32x4 data mismatch");
62 uint8_t a_data[16] = {100, 150, 200, 250, 100, 150, 200, 250, 100, 150, 200, 250, 100, 150, 200, 250};
63 uint8_t b_data[16] = {50, 100, 50, 100, 50, 100, 50, 100, 50, 100, 50, 100, 50, 100, 50, 100};
64 uint8_t expected[16] = {150, 250, 250, 255, 150, 250, 250, 255, 150, 250, 250, 255, 150, 250, 250, 255};
70 store_u8_16(output, c);
73 result.fail(
"Saturating add produced incorrect results");
78 uint8_t a_data[16] = {100, 50, 200, 10, 100, 50, 200, 10, 100, 50, 200, 10, 100, 50, 200, 10};
79 uint8_t b_data[16] = {50, 100, 50, 100, 50, 100, 50, 100, 50, 100, 50, 100, 50, 100, 50, 100};
80 uint8_t expected[16] = {50, 0, 150, 0, 50, 0, 150, 0, 50, 0, 150, 0, 50, 0, 150, 0};
86 store_u8_16(output, c);
89 result.fail(
"Saturating subtract produced incorrect results");
94 uint8_t input[16] = {255, 128, 64, 32, 255, 128, 64, 32, 255, 128, 64, 32, 255, 128, 64, 32};
95 uint8_t expected[16] = {127, 64, 32, 16, 127, 64, 32, 16, 127, 64, 32, 16, 127, 64, 32, 16};
100 store_u8_16(output, scaled);
103 result.fail(
"Scale operation produced incorrect results");
108 uint8_t a_data[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
109 uint8_t b_data[16] = {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255};
110 uint8_t expected[16] = {127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127};
116 store_u8_16(output, c);
119 result.fail(
"Blend operation produced incorrect results");
128 uint8_t a_data[16] = {100, 50, 200, 10, 100, 50, 200, 10, 100, 50, 200, 10, 100, 50, 200, 10};
129 uint8_t b_data[16] = {50, 100, 150, 20, 50, 100, 150, 20, 50, 100, 150, 20, 50, 100, 150, 20};
130 uint8_t expected[16] = {50, 50, 150, 10, 50, 50, 150, 10, 50, 50, 150, 10, 50, 50, 150, 10};
136 store_u8_16(output, c);
139 result.fail(
"Min operation produced incorrect results");
144 uint8_t a_data[16] = {100, 50, 200, 10, 100, 50, 200, 10, 100, 50, 200, 10, 100, 50, 200, 10};
145 uint8_t b_data[16] = {50, 100, 150, 20, 50, 100, 150, 20, 50, 100, 150, 20, 50, 100, 150, 20};
146 uint8_t expected[16] = {100, 100, 200, 20, 100, 100, 200, 20, 100, 100, 200, 20, 100, 100, 200, 20};
152 store_u8_16(output, c);
155 result.fail(
"Max operation produced incorrect results");
160 uint8_t a_data[16] = {100, 50, 200, 10, 100, 50, 200, 10, 100, 50, 200, 10, 100, 50, 200, 10};
161 uint8_t b_data[16] = {50, 100, 150, 20, 50, 100, 150, 20, 50, 100, 150, 20, 50, 100, 150, 20};
162 uint8_t expected[16] = {75, 75, 175, 15, 75, 75, 175, 15, 75, 75, 175, 15, 75, 75, 175, 15};
168 store_u8_16(output, c);
171 result.fail(
"Average operation produced incorrect results");
176 uint8_t a_data[16] = {101, 51, 201, 11, 101, 51, 201, 11, 101, 51, 201, 11, 101, 51, 201, 11};
177 uint8_t b_data[16] = {50, 100, 150, 20, 50, 100, 150, 20, 50, 100, 150, 20, 50, 100, 150, 20};
178 uint8_t expected[16] = {76, 76, 176, 16, 76, 76, 176, 16, 76, 76, 176, 16, 76, 76, 176, 16};
184 store_u8_16(output, c);
187 result.fail(
"Rounding average operation produced incorrect results");
196 uint8_t a_data[16] = {0xFF, 0xF0, 0x0F, 0xAA, 0xFF, 0xF0, 0x0F, 0xAA, 0xFF, 0xF0, 0x0F, 0xAA, 0xFF, 0xF0, 0x0F, 0xAA};
197 uint8_t b_data[16] = {0xF0, 0xFF, 0x0F, 0x55, 0xF0, 0xFF, 0x0F, 0x55, 0xF0, 0xFF, 0x0F, 0x55, 0xF0, 0xFF, 0x0F, 0x55};
198 uint8_t expected[16] = {0xF0, 0xF0, 0x0F, 0x00, 0xF0, 0xF0, 0x0F, 0x00, 0xF0, 0xF0, 0x0F, 0x00, 0xF0, 0xF0, 0x0F, 0x00};
204 store_u8_16(output, c);
207 result.fail(
"AND operation produced incorrect results");
212 uint8_t a_data[16] = {0xF0, 0x0F, 0xAA, 0x55, 0xF0, 0x0F, 0xAA, 0x55, 0xF0, 0x0F, 0xAA, 0x55, 0xF0, 0x0F, 0xAA, 0x55};
213 uint8_t b_data[16] = {0x0F, 0xF0, 0x55, 0xAA, 0x0F, 0xF0, 0x55, 0xAA, 0x0F, 0xF0, 0x55, 0xAA, 0x0F, 0xF0, 0x55, 0xAA};
214 uint8_t expected[16] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
220 store_u8_16(output, c);
223 result.fail(
"OR operation produced incorrect results");
228 uint8_t a_data[16] = {0xFF, 0xF0, 0xAA, 0x55, 0xFF, 0xF0, 0xAA, 0x55, 0xFF, 0xF0, 0xAA, 0x55, 0xFF, 0xF0, 0xAA, 0x55};
229 uint8_t b_data[16] = {0xF0, 0xFF, 0x55, 0xAA, 0xF0, 0xFF, 0x55, 0xAA, 0xF0, 0xFF, 0x55, 0xAA, 0xF0, 0xFF, 0x55, 0xAA};
230 uint8_t expected[16] = {0x0F, 0x0F, 0xFF, 0xFF, 0x0F, 0x0F, 0xFF, 0xFF, 0x0F, 0x0F, 0xFF, 0xFF, 0x0F, 0x0F, 0xFF, 0xFF};
236 store_u8_16(output, c);
239 result.fail(
"XOR operation produced incorrect results");
244 uint8_t a_data[16] = {0xF0, 0x0F, 0xAA, 0x55, 0xF0, 0x0F, 0xAA, 0x55, 0xF0, 0x0F, 0xAA, 0x55, 0xF0, 0x0F, 0xAA, 0x55};
245 uint8_t b_data[16] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
246 uint8_t expected[16] = {0x0F, 0xF0, 0x55, 0xAA, 0x0F, 0xF0, 0x55, 0xAA, 0x0F, 0xF0, 0x55, 0xAA, 0x0F, 0xF0, 0x55, 0xAA};
252 store_u8_16(output, c);
255 result.fail(
"AND-NOT operation produced incorrect results");
269 store_u32_4(output, v);
271 for (
int i = 0; i < 4; i++) {
273 result.fail(
"Set1 u32x4 operation produced incorrect results");
280 float value = 3.14159f;
281 float expected[4] = {3.14159f, 3.14159f, 3.14159f, 3.14159f};
282 float output[4] = {0.0f};
285 store_f32_4(output, v);
288 result.fail(
"Set1 f32x4 operation produced incorrect results");
297 float a_data[4] = {1.0f, 2.0f, 3.0f, 4.0f};
298 float b_data[4] = {0.5f, 1.5f, 2.5f, 3.5f};
299 float expected[4] = {1.5f, 3.5f, 5.5f, 7.5f};
300 float output[4] = {0.0f};
305 store_f32_4(output, c);
308 result.fail(
"Float add operation produced incorrect results");
313 float a_data[4] = {5.0f, 4.0f, 3.0f, 2.0f};
314 float b_data[4] = {1.5f, 1.5f, 1.5f, 1.5f};
315 float expected[4] = {3.5f, 2.5f, 1.5f, 0.5f};
316 float output[4] = {0.0f};
321 store_f32_4(output, c);
324 result.fail(
"Float subtract operation produced incorrect results");
329 float a_data[4] = {2.0f, 3.0f, 4.0f, 5.0f};
330 float b_data[4] = {0.5f, 2.0f, 0.25f, 1.0f};
331 float expected[4] = {1.0f, 6.0f, 1.0f, 5.0f};
332 float output[4] = {0.0f};
337 store_f32_4(output, c);
340 result.fail(
"Float multiply operation produced incorrect results");
345 float a_data[4] = {10.0f, 20.0f, 30.0f, 40.0f};
346 float b_data[4] = {2.0f, 4.0f, 5.0f, 8.0f};
347 float expected[4] = {5.0f, 5.0f, 6.0f, 5.0f};
348 float output[4] = {0.0f};
353 store_f32_4(output, c);
356 result.fail(
"Float divide operation produced incorrect results");
361 float input[4] = {4.0f, 9.0f, 16.0f, 25.0f};
362 float expected[4] = {2.0f, 3.0f, 4.0f, 5.0f};
363 float output[4] = {0.0f};
367 store_f32_4(output, result_v);
370 result.fail(
"Float sqrt operation produced incorrect results");
375 float a_data[4] = {1.0f, 5.0f, 3.0f, 7.0f};
376 float b_data[4] = {2.0f, 4.0f, 6.0f, 1.0f};
377 float expected[4] = {1.0f, 4.0f, 3.0f, 1.0f};
378 float output[4] = {0.0f};
383 store_f32_4(output, c);
386 result.fail(
"Float min operation produced incorrect results");
391 float a_data[4] = {1.0f, 5.0f, 3.0f, 7.0f};
392 float b_data[4] = {2.0f, 4.0f, 6.0f, 1.0f};
393 float expected[4] = {2.0f, 5.0f, 6.0f, 7.0f};
394 float output[4] = {0.0f};
399 store_f32_4(output, c);
402 result.fail(
"Float max operation produced incorrect results");
expected type for operations that can fail (C++23-style)
platforms::simd_u32x4 simd_u32x4
platforms::simd_u8x16 simd_u8x16
platforms::simd_f32x4 simd_f32x4
constexpr int type_rank< T >::value
expected< T, E > result
Alias for expected (Rust-style naming)
void test_load_store_f32_4(TestResult &result)
void test_load_store_u8_16(TestResult &result)
void test_or_u8_16(TestResult &result)
void test_set1_u32_4(TestResult &result)
void test_add_sat_u8_16(TestResult &result)
void test_avg_u8_16(TestResult &result)
void test_load_store_u32_4(TestResult &result)
void test_min_f32_4(TestResult &result)
void test_and_u8_16(TestResult &result)
void test_max_f32_4(TestResult &result)
void test_set1_f32_4(TestResult &result)
void test_min_u8_16(TestResult &result)
void test_mul_f32_4(TestResult &result)
void test_sub_sat_u8_16(TestResult &result)
void test_add_f32_4(TestResult &result)
void test_div_f32_4(TestResult &result)
bool compare_u8_arrays(const uint8_t *a, const uint8_t *b, size_t count)
Compare two uint8_t arrays element-wise.
void test_xor_u8_16(TestResult &result)
void test_sub_f32_4(TestResult &result)
void test_scale_u8_16(TestResult &result)
void test_max_u8_16(TestResult &result)
void test_avg_round_u8_16(TestResult &result)
void test_blend_u8_16(TestResult &result)
bool compare_f32_arrays(const float *a, const float *b, size_t count, float epsilon)
Compare two float arrays element-wise with epsilon tolerance.
void test_andnot_u8_16(TestResult &result)
void test_sqrt_f32_4(TestResult &result)
Umbrella header for SIMD subsystem.
Stores the result of a single SIMD test.