Mercurial > vec
comparison test/test_benchmark_simple.c @ 45:7955bed1d169 default tip
*: add preliminary floating point support
no x86 intrinsics just yet, but I did add altivec since it's
(arguably) the simplest :)
author | Paper <paper@tflc.us> |
---|---|
date | Wed, 30 Apr 2025 18:36:38 -0400 |
parents | 4b5a557aa64f |
children |
comparison
equal
deleted
inserted
replaced
44:b0a3f0248ecc | 45:7955bed1d169 |
---|---|
1 #include <stdint.h> | 1 #include "vec/defs.h" |
2 | 2 |
3 extern void test_benchmark_sample_minmax_simple_impl(int16_t *smpl, | 3 #define DEFINE_VARIANT(type, bits) \ |
4 uint32_t length, int32_t *pmin, int32_t *pmax) | 4 extern void test_benchmark_sample_minmax_##type##bits##_impl(vec_##type##bits *smpl, \ |
5 { | 5 uint32_t length, vec_##type##bits *pmin, vec_##type##bits *pmax) \ |
6 int32_t min = *pmin; | 6 { \ |
7 int32_t max = *pmax; | 7 vec_##type##bits min = *pmin; \ |
8 | 8 vec_##type##bits max = *pmax; \ |
9 while (length--) { | 9 \ |
10 if (*smpl < min) min = *smpl; | 10 while (length--) { \ |
11 if (*smpl > max) max = *smpl; | 11 if (*smpl < min) min = *smpl; \ |
12 | 12 if (*smpl > max) max = *smpl; \ |
13 smpl++; | 13 \ |
14 smpl++; \ | |
15 } \ | |
16 \ | |
17 *pmin = min; \ | |
18 *pmax = max; \ | |
14 } | 19 } |
15 | 20 |
16 *pmin = min; | 21 DEFINE_VARIANT(int, 8) |
17 *pmax = max; | 22 DEFINE_VARIANT(uint, 8) |
18 } | 23 DEFINE_VARIANT(int, 16) |
24 DEFINE_VARIANT(uint, 16) | |
25 DEFINE_VARIANT(int, 32) | |
26 DEFINE_VARIANT(uint, 32) | |
27 DEFINE_VARIANT(f, 32) | |
28 DEFINE_VARIANT(int, 64) | |
29 DEFINE_VARIANT(uint, 64) | |
30 DEFINE_VARIANT(f, 64) |