comparison src/impl/x86/sse2.c @ 24:e49e70f7012f

impl/x86: add static assertions for alignment and size
author Paper <paper@tflc.us>
date Sun, 24 Nov 2024 03:32:53 -0500
parents e26874655738
children
comparison
equal deleted inserted replaced
23:e26874655738 24:e49e70f7012f
145 #define VEC_SSE2_DEFINE_OPERATIONS_SIGN(sign, bits, size) \ 145 #define VEC_SSE2_DEFINE_OPERATIONS_SIGN(sign, bits, size) \
146 union v##sign##int##bits##x##size##_impl_data { \ 146 union v##sign##int##bits##x##size##_impl_data { \
147 v##sign##int##bits##x##size vec; \ 147 v##sign##int##bits##x##size vec; \
148 __m128i sse; \ 148 __m128i sse; \
149 }; \ 149 }; \
150 \
151 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"); \
152 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"); \
150 \ 153 \
151 v##sign##int##bits##x##size v##sign##int##bits##x##size##_sse2_load_aligned(const vec_##sign##int##bits in[size]) \ 154 v##sign##int##bits##x##size v##sign##int##bits##x##size##_sse2_load_aligned(const vec_##sign##int##bits in[size]) \
152 { \ 155 { \
153 union v##sign##int##bits##x##size##_impl_data vec; \ 156 union v##sign##int##bits##x##size##_impl_data vec; \
154 vec.sse = _mm_load_si128((const __m128i *)in); \ 157 vec.sse = _mm_load_si128((const __m128i *)in); \