diff 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
line wrap: on
line diff
--- a/test/test_benchmark_simple.c	Tue Apr 29 16:54:13 2025 -0400
+++ b/test/test_benchmark_simple.c	Wed Apr 30 18:36:38 2025 -0400
@@ -1,18 +1,30 @@
-#include <stdint.h>
+#include "vec/defs.h"
 
-extern void test_benchmark_sample_minmax_simple_impl(int16_t *smpl,
-	uint32_t length, int32_t *pmin, int32_t *pmax)
-{
-	int32_t min = *pmin;
-	int32_t max = *pmax;
-
-	while (length--) {
-		if (*smpl < min) min = *smpl;
-		if (*smpl > max) max = *smpl;
-
-		smpl++;
+#define DEFINE_VARIANT(type, bits) \
+	extern void test_benchmark_sample_minmax_##type##bits##_impl(vec_##type##bits *smpl, \
+		uint32_t length, vec_##type##bits *pmin, vec_##type##bits *pmax) \
+	{ \
+		vec_##type##bits min = *pmin; \
+		vec_##type##bits max = *pmax; \
+	\
+		while (length--) { \
+			if (*smpl < min) min = *smpl; \
+			if (*smpl > max) max = *smpl; \
+	\
+			smpl++; \
+		} \
+	\
+		*pmin = min; \
+		*pmax = max; \
 	}
 
-	*pmin = min;
-	*pmax = max;
-}
+DEFINE_VARIANT(int, 8)
+DEFINE_VARIANT(uint, 8)
+DEFINE_VARIANT(int, 16)
+DEFINE_VARIANT(uint, 16)
+DEFINE_VARIANT(int, 32)
+DEFINE_VARIANT(uint, 32)
+DEFINE_VARIANT(f, 32)
+DEFINE_VARIANT(int, 64)
+DEFINE_VARIANT(uint, 64)
+DEFINE_VARIANT(f, 64)