diff test/main.c @ 4:75ab77f874e2

*: aligned generics, fixed altivec, aligned tests...
author Paper <paper@tflc.us>
date Wed, 23 Oct 2024 10:13:25 -0400
parents 3c5545b1568f
children 945d410803f8 6ff0b7a44bb6
line wrap: on
line diff
--- a/test/main.c	Tue Oct 22 23:27:15 2024 -0400
+++ b/test/main.c	Wed Oct 23 10:13:25 2024 -0400
@@ -47,30 +47,30 @@
 	UINT64_C(0xff), UINT64_C(645366),     UINT64_C(0x12345ABCDE), UINT64_C(0xF00000FFF),
 };
 
-#define VTEST(sign, bits, size) \
+#define VTEST(sign, csign, bits, size) \
 	static inline v##sign##int##bits##x##size vtest##sign##bits##x##size(const size_t start) \
 	{ \
-		sign##int##bits##_t x[size]; \
+		V##csign##INT##bits##x##size##_ALIGNED_ARRAY(x); \
 		for (size_t i = 0; i < size; i++) \
 			x[i] = testval##sign##bits[(start + i) % ARRAY_SIZE(testval##sign##bits)]; \
-		return v##sign##int##bits##x##size##_load(x); \
+		return v##sign##int##bits##x##size##_load_aligned(x); \
 	}
 
-#define VTEST_SIGN(bits, size) VTEST(, bits, size) VTEST(u, bits, size)
+#define VTEST_SIGN(bits, size) VTEST(, , bits, size) VTEST(u, U, bits, size)
 
 VTEST_SIGN(8, 16)
 VTEST_SIGN(16, 8)
 VTEST_SIGN(32, 4)
 VTEST_SIGN(64, 2)
 
-#define DEFINE_PRINT_VECTOR(sign, psign, bits, size) \
+#define DEFINE_PRINT_VECTOR(sign, csign, psign, bits, size) \
 	static inline void print_v##sign##int##bits##x##size(FILE *file, v##sign##int##bits##x##size vec) \
 	{ \
 		fputs("vector: ", file); \
 	\
-		int##bits##_t v[size]; \
+		V##csign##INT##bits##x##size##_ALIGNED_ARRAY(v); \
 	\
-		v##sign##int##bits##x##size##_store(vec, v); \
+		v##sign##int##bits##x##size##_store_aligned(vec, v); \
 	\
 		fprintf(file, "%" PRI ## psign ## bits, v[0]); \
 	\
@@ -81,7 +81,7 @@
 	\
 	}
 
-#define DEFINE_PRINT_VECTOR_2(bits, size) DEFINE_PRINT_VECTOR(, d, bits, size) DEFINE_PRINT_VECTOR(u, u, bits, size)
+#define DEFINE_PRINT_VECTOR_2(bits, size) DEFINE_PRINT_VECTOR(, , d, bits, size) DEFINE_PRINT_VECTOR(u, U, u, bits, size)
 
 DEFINE_PRINT_VECTOR_2(8, 16)
 DEFINE_PRINT_VECTOR_2(16, 8)