changeset 35:99e4539f922f

Backed out changeset e49e70f7012f
author Paper <paper@tflc.us>
date Fri, 25 Apr 2025 17:40:51 -0400
parents 8b5e0974fd41
children 677c03c382b8
files include/vec/vec.h src/impl/fallback.c src/impl/x86/avx2.c src/impl/x86/avx512f.c src/impl/x86/mmx.c src/impl/x86/sse2.c src/impl/x86/sse41.c
diffstat 7 files changed, 10 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/include/vec/vec.h	Fri Apr 25 17:40:46 2025 -0400
+++ b/include/vec/vec.h	Fri Apr 25 17:40:51 2025 -0400
@@ -152,9 +152,8 @@
 #define VUINT64x8_ALIGNMENT  64
 
 //////////////////////////////////////////////////////////////////////////////
-// portable bit shift
+// bit shift
 
-// these functions aren't very necessary :/
 inline vec_uintmax vec_lrshift(vec_uintmax x, unsigned int y)
 {
 	return x >> y;
@@ -241,16 +240,16 @@
 // array alignment
 
 #if (__cplusplus >= 201103L) || (__STDC_VERSION__ >= 202311L)
-# define VEC_ALIGNOF(type) alignof(type)
+# define VEC_ALIGNOF(type) alignof(x)
 #elif (__STDC_VERSION__ >= 201112L)
-# define VEC_ALIGNOF(type) _Alignof(type)
+# define VEC_ALIGNOF(type) _Alignof(x)
 #elif defined(HAVE_STDDEF_H) // already included
 # define VEC_ALIGNOF(type) \
-	(offsetof(struct { char slot1; type slot2; }, slot2))
+	(offsetof(struct { char slot1; x slot2; }, slot2))
 #else
 // inline offsetof
 # define VEC_ALIGNOF(type) \
-	((vec_uintsize)((char *)&((struct { char slot1; type slot2; } *)0)->slot2 - (char *)0))
+	((vec_uintsize)((char *)&((struct { char slot1; x slot2; } *)0)->slot2 - (char *)0))
 #endif
 
 #if (__cplusplus >= 201103L) || (__STDC_VERSION__ >= 202311L)
@@ -267,7 +266,7 @@
 
 // this wart is here because originally vec didn't require that
 // there be compiler support for alignment. now that we *do*,
-// we should at least keep providing this macro...
+// we need to 
 #ifdef VEC_ALIGNAS
 # define VEC_ALIGNED_ARRAY(type, var, length, align) \
 	VEC_ALIGNAS(align) type var[length]
--- a/src/impl/fallback.c	Fri Apr 25 17:40:46 2025 -0400
+++ b/src/impl/fallback.c	Fri Apr 25 17:40:51 2025 -0400
@@ -7,8 +7,10 @@
 // memory is unknown or yields incorrect results from the generic functions.
 // This is *extremely* unlikely; for x86 the layout is exactly the same in
 // memory as the generic functions (i.e. it is literally stored as an array of
-// integers). This is likely true for AltiVec and NEON as well, but those
-// aren't tested for now.
+// integers).
+//
+// These functions can probably be removed if every current implementation is
+// found to have the same 
 
 #define VEC_FALLBACK_OPERATION(op, sign, csign, bits, size) \
 	do { \
--- a/src/impl/x86/avx2.c	Fri Apr 25 17:40:46 2025 -0400
+++ b/src/impl/x86/avx2.c	Fri Apr 25 17:40:51 2025 -0400
@@ -110,9 +110,6 @@
 		__m256i avx2; \
 	}; \
 	\
-	VEC_STATIC_ASSERT(VEC_ALIGNOF(__m256i) <= VEC_ALIGNOF(v##sign##int##bits##x##size), "vec: v" #sign "int" #bits "x" #size " alignment needs to be expanded to fit intrinsic type size"); \
-	VEC_STATIC_ASSERT(sizeof(__m256i) <= sizeof(v##sign##int##bits##x##size), "vec: v" #sign "int" #bits "x" #size " needs to be expanded to fit intrinsic type size"); \
-	\
 	static v##sign##int##bits##x##size v##sign##int##bits##x##size##_avx2_load_aligned(const vec_##sign##int##bits in[size]) \
 	{ \
 		union v##sign##int##bits##x##size##_impl_data vec; \
--- a/src/impl/x86/avx512f.c	Fri Apr 25 17:40:46 2025 -0400
+++ b/src/impl/x86/avx512f.c	Fri Apr 25 17:40:51 2025 -0400
@@ -226,9 +226,6 @@
 		__m512i avx512f; \
 	}; \
 	\
-	VEC_STATIC_ASSERT(VEC_ALIGNOF(__m512i) <= VEC_ALIGNOF(v##sign##int##bits##x##size), "vec: v" #sign "int" #bits "x" #size " alignment needs to be expanded to fit intrinsic type size"); \
-	VEC_STATIC_ASSERT(sizeof(__m512i) <= sizeof(v##sign##int##bits##x##size), "vec: v" #sign "int" #bits "x" #size " needs to be expanded to fit intrinsic type size"); \
-	\
 	static v##sign##int##bits##x##size v##sign##int##bits##x##size##_avx512f_load_aligned(const vec_##sign##int##bits in[size]) \
 	{ \
 		union v##sign##int##bits##x##size##_impl_data vec; \
--- a/src/impl/x86/mmx.c	Fri Apr 25 17:40:46 2025 -0400
+++ b/src/impl/x86/mmx.c	Fri Apr 25 17:40:51 2025 -0400
@@ -71,9 +71,6 @@
 		__m64 mmx; \
 	}; \
 	\
-	VEC_STATIC_ASSERT(VEC_ALIGNOF(__m64) <= VEC_ALIGNOF(v##sign##int##bits##x##size), "vec: v" #sign "int" #bits "x" #size " alignment needs to be expanded to fit intrinsic type size"); \
-	VEC_STATIC_ASSERT(sizeof(__m64) <= sizeof(v##sign##int##bits##x##size), "vec: v" #sign "int" #bits "x" #size " needs to be expanded to fit intrinsic type size"); \
-	\
 	static v##sign##int##bits##x##size v##sign##int##bits##x##size##_mmx_load_aligned(const vec_##sign##int##bits in[size]) \
 	{ \
 		v##sign##int##bits##x##size vec; \
--- a/src/impl/x86/sse2.c	Fri Apr 25 17:40:46 2025 -0400
+++ b/src/impl/x86/sse2.c	Fri Apr 25 17:40:51 2025 -0400
@@ -148,9 +148,6 @@
 		__m128i sse; \
 	}; \
 	\
-	VEC_STATIC_ASSERT(VEC_ALIGNOF(__m128i) <= VEC_ALIGNOF(v##sign##int##bits##x##size), "vec: v" #sign "int" #bits "x" #size " alignment needs to be expanded to fit intrinsic type size"); \
-	VEC_STATIC_ASSERT(sizeof(__m128i) <= sizeof(v##sign##int##bits##x##size), "vec: v" #sign "int" #bits "x" #size " needs to be expanded to fit intrinsic type size"); \
-	\
 	v##sign##int##bits##x##size v##sign##int##bits##x##size##_sse2_load_aligned(const vec_##sign##int##bits in[size]) \
 	{ \
 		union v##sign##int##bits##x##size##_impl_data vec; \
--- a/src/impl/x86/sse41.c	Fri Apr 25 17:40:46 2025 -0400
+++ b/src/impl/x86/sse41.c	Fri Apr 25 17:40:51 2025 -0400
@@ -35,9 +35,6 @@
 		__m128i sse; \
 	}; \
 	\
-	VEC_STATIC_ASSERT(VEC_ALIGNOF(__m128i) <= VEC_ALIGNOF(v##sign##int32x4), "vec: v" #sign "int32x4 alignment needs to be expanded to fit intrinsic type size"); \
-	VEC_STATIC_ASSERT(sizeof(__m128i) <= sizeof(v##sign##int32x4), "vec: v" #sign "int32x4 needs to be expanded to fit intrinsic type size"); \
-	\
 	static v##sign##int32x4 v##sign##int32x4_sse41_mul(v##sign##int32x4 vec1, v##sign##int32x4 vec2) \
 	{ \
 		union v##sign##int32x4_impl_data *vec1d = (union v##sign##int32x4_impl_data *)&vec1; \