00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef __MMX__MATRIX_SIMD__HPP
00014 #define __MMX__MATRIX_SIMD__HPP
00015 #include <algebramix/vector_simd.hpp>
00016 #include <algebramix/matrix_unrolled.hpp>
00017 #include <algebramix/matrix_aligned.hpp>
00018 #include <algebramix/matrix_sse.hpp>
00019
00020 namespace mmx {
00021
00022
00023
00024
00025
00026 template<nat len1, nat len2, typename V=matrix_naive>
00027 struct matrix_simd: public matrix_aligned<
00028 matrix_unrolled<len1, V>,
00029 matrix_unrolled<len2, V> >
00030 {
00031 typedef vector_simd<len1,len2,typename V::Vec> Vec;
00032 typedef matrix_simd<len1,len2,typename V::Naive> Naive;
00033 typedef matrix_simd<len1,len2,typename V::Positive> Positive;
00034 typedef matrix_unrolled<len1,typename V::No_simd> No_simd;
00035 typedef matrix_simd<len1,len2,typename V::No_thread> No_thread;
00036 typedef matrix_simd<len1,len2,typename V::No_scaled> No_scaled;
00037 };
00038
00039 template<typename F, typename V, nat len1, nat len2, typename W>
00040 struct implementation<F,V,matrix_simd<len1,len2,W> >:
00041 public implementation<F,V,matrix_aligned<
00042 matrix_unrolled<len1, W>,
00043 matrix_unrolled<len2, W> > > {};
00044
00045
00046
00047
00048
00049 #define Matrix_simd_variant(C) matrix_simd_variant_helper<C>::MV
00050
00051 template<typename C>
00052 struct matrix_simd_variant_helper {
00053 typedef matrix_simd<4,4> MV; };
00054
00055 STMPL
00056 struct matrix_simd_variant_helper<double> {
00057 typedef matrix_simd<8,4> MV; };
00058
00059 STMPL
00060 struct matrix_simd_variant_helper<char> {
00061 typedef matrix_simd<16,8> MV; };
00062
00063 STMPL
00064 struct matrix_simd_variant_helper<signed char> {
00065 typedef matrix_simd<16,8> MV; };
00066
00067 STMPL
00068 struct matrix_simd_variant_helper<unsigned char> {
00069 typedef matrix_simd<16,4> MV; };
00070
00071 STMPL
00072 struct matrix_simd_variant_helper<short int> {
00073 typedef matrix_simd<16,4 > MV; };
00074
00075 STMPL
00076 struct matrix_simd_variant_helper<short unsigned int> {
00077 typedef matrix_simd<32, 4> MV; };
00078
00079 STMPL
00080 struct matrix_simd_variant_helper<int> {
00081 typedef matrix_simd<16, 4> MV; };
00082
00083 STMPL
00084 struct matrix_simd_variant_helper<unsigned int> {
00085 typedef matrix_simd<16, 4> MV; };
00086
00087 STMPL
00088 struct matrix_simd_variant_helper<long int> {
00089 typedef matrix_simd<16, 4> MV; };
00090
00091 STMPL
00092 struct matrix_simd_variant_helper<long unsigned int> {
00093 typedef matrix_simd<16, 4> MV; };
00094
00095 STMPL
00096 struct matrix_simd_variant_helper<long long int> {
00097 typedef matrix_simd<8,4> MV; };
00098
00099 STMPL
00100 struct matrix_simd_variant_helper<long long unsigned int> {
00101 typedef matrix_simd<8,4> MV;
00102 };
00103
00104 }
00105 #endif // __MMX__MATRIX_SIMD__HPP