diff options
author | Erik Schnetter <schnetter@gmail.com> | 2013-04-23 12:52:42 -0400 |
---|---|---|
committer | Erik Schnetter <schnetter@gmail.com> | 2013-04-23 12:52:42 -0400 |
commit | 426aaa47ed4724b06b92cb2d1e9097d4dda20b54 (patch) | |
tree | a4c481a26683084e6dfb3e1bafc5f9fd6af56ee0 | |
parent | 3dddb12bf74e3373989aaf6927a90c82633601b5 (diff) | |
download | vecmathlib-426aaa47ed4724b06b92cb2d1e9097d4dda20b54.zip vecmathlib-426aaa47ed4724b06b92cb2d1e9097d4dda20b54.tar.gz |
Introduce field "alignment" describing the necessary alignment for vector types
-rw-r--r-- | vec_double_avx.h | 3 | ||||
-rw-r--r-- | vec_double_sse2.h | 3 | ||||
-rw-r--r-- | vec_double_sse2_scalar.h | 3 | ||||
-rw-r--r-- | vec_float_altivec.h | 3 | ||||
-rw-r--r-- | vec_float_avx.h | 3 | ||||
-rw-r--r-- | vec_float_sse2.h | 3 | ||||
-rw-r--r-- | vec_float_sse2_scalar.h | 3 | ||||
-rw-r--r-- | vec_fp16_avx.h | 3 | ||||
-rw-r--r-- | vec_fp8_avx.h | 3 | ||||
-rw-r--r-- | vec_pseudo.h | 9 | ||||
-rw-r--r-- | vec_test.h | 9 |
11 files changed, 39 insertions, 6 deletions
diff --git a/vec_double_avx.h b/vec_double_avx.h index cb6345a..cfee0fc 100644 --- a/vec_double_avx.h +++ b/vec_double_avx.h @@ -29,6 +29,7 @@ namespace vecmathlib { static int const size = 4; typedef bool scalar_t; typedef __m256d bvector_t; + static int const alignment = sizeof(bvector_t); static_assert(size * sizeof(real_t) == sizeof(bvector_t), "vector size is wrong"); @@ -126,6 +127,7 @@ namespace vecmathlib { static int const size = 4; typedef int_t scalar_t; typedef __m256i ivector_t; + static int const alignment = sizeof(ivector_t); static_assert(size * sizeof(real_t) == sizeof(ivector_t), "vector size is wrong"); @@ -349,6 +351,7 @@ namespace vecmathlib { static int const size = 4; typedef real_t scalar_t; typedef __m256d vector_t; + static int const alignment = sizeof(vector_t); static char const* name() { return "<AVX:4*double>"; } void barrier() { __asm__("": "+x" (v)); } diff --git a/vec_double_sse2.h b/vec_double_sse2.h index 7387bff..97f4e91 100644 --- a/vec_double_sse2.h +++ b/vec_double_sse2.h @@ -41,6 +41,7 @@ namespace vecmathlib { static int const size = 2; typedef bool scalar_t; typedef __m128d bvector_t; + static int const alignment = sizeof(bvector_t); static_assert(size * sizeof(real_t) == sizeof(bvector_t), "vector size is wrong"); @@ -131,6 +132,7 @@ namespace vecmathlib { static int const size = 2; typedef int_t scalar_t; typedef __m128i ivector_t; + static int const alignment = sizeof(ivector_t); static_assert(size * sizeof(real_t) == sizeof(ivector_t), "vector size is wrong"); @@ -305,6 +307,7 @@ namespace vecmathlib { static int const size = 2; typedef real_t scalar_t; typedef __m128d vector_t; + static int const alignment = sizeof(vector_t); static char const* name() { return "<SSE2:2*double>"; } void barrier() { __asm__("": "+x" (v)); } diff --git a/vec_double_sse2_scalar.h b/vec_double_sse2_scalar.h index ee7dd02..d8e7955 100644 --- a/vec_double_sse2_scalar.h +++ b/vec_double_sse2_scalar.h @@ -41,6 +41,7 @@ namespace vecmathlib { static int const size = 1; typedef bool scalar_t; typedef uint_t bvector_t; + static int const alignment = sizeof(bvector_t); static_assert(size * sizeof(real_t) == sizeof(bvector_t), "vector size is wrong"); @@ -112,6 +113,7 @@ namespace vecmathlib { static int const size = 1; typedef int_t scalar_t; typedef int_t ivector_t; + static int const alignment = sizeof(ivector_t); static_assert(size * sizeof(real_t) == sizeof(ivector_t), "vector size is wrong"); @@ -217,6 +219,7 @@ namespace vecmathlib { static int const size = 1; typedef real_t scalar_t; typedef double vector_t; + static int const alignment = sizeof(vector_t); static char const* name() { return "<SSE2:1*double>"; } void barrier() { __asm__("": "+x" (v)); } diff --git a/vec_float_altivec.h b/vec_float_altivec.h index c4f48f7..a1fca6c 100644 --- a/vec_float_altivec.h +++ b/vec_float_altivec.h @@ -32,6 +32,7 @@ namespace vecmathlib { static int const size = 4; typedef bool scalar_t; typedef __vector __bool int bvector_t; + static int const alignment = sizeof(bvector_t); static_assert(size * sizeof(real_t) == sizeof(bvector_t), "vector size is wrong"); @@ -111,6 +112,7 @@ namespace vecmathlib { static int const size = 4; typedef int_t scalar_t; typedef __vector int ivector_t; + static int const alignment = sizeof(ivector_t); static_assert(size * sizeof(real_t) == sizeof(ivector_t), "vector size is wrong"); @@ -218,6 +220,7 @@ namespace vecmathlib { static int const size = 4; typedef real_t scalar_t; typedef __vector float vector_t; + static int const alignment = sizeof(vector_t); static char const* name() { return "<Altivec:4*float>"; } void barrier() { __asm__("": "+v" (v)); } diff --git a/vec_float_avx.h b/vec_float_avx.h index aed972a..8d9cf82 100644 --- a/vec_float_avx.h +++ b/vec_float_avx.h @@ -29,6 +29,7 @@ namespace vecmathlib { static int const size = 8; typedef bool scalar_t; typedef __m256 bvector_t; + static int const alignment = sizeof(bvector_t); static_assert(size * sizeof(real_t) == sizeof(bvector_t), "vector size is wrong"); @@ -136,6 +137,7 @@ namespace vecmathlib { static int const size = 8; typedef int_t scalar_t; typedef __m256i ivector_t; + static int const alignment = sizeof(ivector_t); static_assert(size * sizeof(real_t) == sizeof(ivector_t), "vector size is wrong"); @@ -321,6 +323,7 @@ namespace vecmathlib { static int const size = 8; typedef real_t scalar_t; typedef __m256 vector_t; + static int const alignment = sizeof(vector_t); static char const* name() { return "<AVX:8*float>"; } void barrier() { __asm__("": "+x" (v)); } diff --git a/vec_float_sse2.h b/vec_float_sse2.h index 8902305..f8d7156 100644 --- a/vec_float_sse2.h +++ b/vec_float_sse2.h @@ -41,6 +41,7 @@ namespace vecmathlib { static int const size = 4; typedef bool scalar_t; typedef __m128 bvector_t; + static int const alignment = sizeof(bvector_t); static_assert(size * sizeof(real_t) == sizeof(bvector_t), "vector size is wrong"); @@ -136,6 +137,7 @@ namespace vecmathlib { static int const size = 4; typedef int_t scalar_t; typedef __m128i ivector_t; + static int const alignment = sizeof(ivector_t); static_assert(size * sizeof(real_t) == sizeof(ivector_t), "vector size is wrong"); @@ -275,6 +277,7 @@ namespace vecmathlib { static int const size = 4; typedef real_t scalar_t; typedef __m128 vector_t; + static int const alignment = sizeof(vector_t); static char const* name() { return "<SSE2:4*float>"; } void barrier() { __asm__("": "+x" (v)); } diff --git a/vec_float_sse2_scalar.h b/vec_float_sse2_scalar.h index f8786c6..0aba3b2 100644 --- a/vec_float_sse2_scalar.h +++ b/vec_float_sse2_scalar.h @@ -41,6 +41,7 @@ namespace vecmathlib { static int const size = 1; typedef bool scalar_t; typedef uint_t bvector_t; + static int const alignment = sizeof(bvector_t); static_assert(size * sizeof(real_t) == sizeof(bvector_t), "vector size is wrong"); @@ -112,6 +113,7 @@ namespace vecmathlib { static int const size = 1; typedef int_t scalar_t; typedef int_t ivector_t; + static int const alignment = sizeof(ivector_t); static_assert(size * sizeof(real_t) == sizeof(ivector_t), "vector size is wrong"); @@ -217,6 +219,7 @@ namespace vecmathlib { static int const size = 1; typedef real_t scalar_t; typedef float vector_t; + static int const alignment = sizeof(vector_t); static char const* name() { return "<SSE2:1*float>"; } void barrier() { __asm__("": "+x" (v)); } diff --git a/vec_fp16_avx.h b/vec_fp16_avx.h index bd5e494..d0139bb 100644 --- a/vec_fp16_avx.h +++ b/vec_fp16_avx.h @@ -29,6 +29,7 @@ namespace vecmathlib { static int const size = 16; typedef bool scalar_t; typedef __m256i bvector_t; + static int const alignment = sizeof(bvector_t); static_assert(size * sizeof(real_t) == sizeof(bvector_t), "vector size is wrong"); @@ -143,6 +144,7 @@ namespace vecmathlib { static int const size = 16; typedef int_t scalar_t; typedef __m256i ivector_t; + static int const alignment = sizeof(ivector_t); static_assert(size * sizeof(real_t) == sizeof(ivector_t), "vector size is wrong"); @@ -347,6 +349,7 @@ namespace vecmathlib { static int const size = 16; typedef real_t scalar_t; typedef __m256i vector_t; + static int const alignment = sizeof(vector_t); static char const* name() { return "<AVX:16*fp16>"; } void barrier() { __asm__("": "+x" (v)); } diff --git a/vec_fp8_avx.h b/vec_fp8_avx.h index 1068f64..2660269 100644 --- a/vec_fp8_avx.h +++ b/vec_fp8_avx.h @@ -29,6 +29,7 @@ namespace vecmathlib { static int const size = 32; typedef bool scalar_t; typedef __m256i bvector_t; + static int const alignment = sizeof(bvector_t); static_assert(size * sizeof(real_t) == sizeof(bvector_t), "vector size is wrong"); @@ -159,6 +160,7 @@ namespace vecmathlib { static int const size = 32; typedef int_t scalar_t; typedef __m256i ivector_t; + static int const alignment = sizeof(ivector_t); static_assert(size * sizeof(real_t) == sizeof(ivector_t), "vector size is wrong"); @@ -397,6 +399,7 @@ namespace vecmathlib { static int const size = 32; typedef real_t scalar_t; typedef __m256i vector_t; + static int const alignment = sizeof(vector_t); static char const* name() { return "<AVX:32*fp8>"; } void barrier() { __asm__("": "+x" (v)); } diff --git a/vec_pseudo.h b/vec_pseudo.h index 95894fd..a319502 100644 --- a/vec_pseudo.h +++ b/vec_pseudo.h @@ -32,6 +32,7 @@ namespace vecmathlib { static int const size = N; typedef bool scalar_t; typedef uint_t bvector_t[size]; + static int const alignment = sizeof(bvector_t); typedef boolpseudovec boolvec_t; typedef intpseudovec<real_t, size> intvec_t; @@ -49,7 +50,7 @@ namespace vecmathlib { - bvector_t v __attribute__((__aligned__(sizeof(bvector_t)))); + bvector_t v __attribute__((__aligned__(alignment))); boolpseudovec() {} // Can't have a non-trivial copy constructor; if so, objects won't @@ -133,6 +134,7 @@ namespace vecmathlib { static int const size = N; typedef int_t scalar_t; typedef int_t ivector_t[size]; + static int const alignment = sizeof(ivector_t); typedef boolpseudovec<real_t, size> boolvec_t; typedef intpseudovec intvec_t; @@ -150,7 +152,7 @@ namespace vecmathlib { - ivector_t v __attribute__((__aligned__(sizeof(ivector_t)))); + ivector_t v __attribute__((__aligned__(alignment))); intpseudovec() {} // Can't have a non-trivial copy constructor; if so, objects won't @@ -403,6 +405,7 @@ namespace vecmathlib { static int const size = N; typedef real_t scalar_t; typedef real_t vector_t[size]; + static int const alignment = sizeof(vector_t); static char const* name() { @@ -471,7 +474,7 @@ namespace vecmathlib { - vector_t v __attribute__((__aligned__(sizeof(vector_t)))); + vector_t v __attribute__((__aligned__(alignment))); realpseudovec() {} // Can't have a non-trivial copy constructor; if so, objects won't @@ -29,6 +29,7 @@ namespace vecmathlib { static int const size = N; typedef bool scalar_t; typedef bool bvector_t[size]; + static int const alignment = sizeof(bvector_t); typedef booltestvec boolvec_t; typedef inttestvec<real_t, size> intvec_t; @@ -46,7 +47,7 @@ namespace vecmathlib { - bvector_t v __attribute__((__aligned__(sizeof(bvector_t)))); + bvector_t v __attribute__((__aligned__(alignment))); booltestvec() {} // can't have a non-trivial copy constructor; if so, objects won't @@ -131,6 +132,7 @@ namespace vecmathlib { static int const size = N; typedef int_t scalar_t; typedef int_t ivector_t[size]; + static int const alignment = sizeof(ivector_t); typedef booltestvec<real_t, size> boolvec_t; typedef inttestvec intvec_t; @@ -148,7 +150,7 @@ namespace vecmathlib { - ivector_t v __attribute__((__aligned__(sizeof(ivector_t)))); + ivector_t v __attribute__((__aligned__(alignment))); inttestvec() {} // can't have a non-trivial copy constructor; if so, objects won't @@ -373,6 +375,7 @@ namespace vecmathlib { static int const size = N; typedef real_t scalar_t; typedef real_t vector_t[size]; + static int const alignment = sizeof(vector_t); static char const* name() { @@ -414,7 +417,7 @@ namespace vecmathlib { - vector_t v __attribute__((__aligned__(sizeof(vector_t)))); + vector_t v __attribute__((__aligned__(alignment))); realtestvec() {} // can't have a non-trivial copy constructor; if so, objects won't |