All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Multiplication.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_INTRINSICS_MULTIPLICATION_H_
36 #define _BLAZE_MATH_INTRINSICS_MULTIPLICATION_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
45 
46 
47 namespace blaze {
48 
49 //=================================================================================================
50 //
51 // INTRINSIC MULTIPLICATION OPERATORS
52 //
53 //=================================================================================================
54 
55 //*************************************************************************************************
64 #if BLAZE_AVX2_MODE
65 inline sse_int16_t operator*( const sse_int16_t& a, const sse_int16_t& b )
66 {
67  return _mm256_mullo_epi16( a.value, b.value );
68 }
69 #elif BLAZE_SSE2_MODE
70 inline sse_int16_t operator*( const sse_int16_t& a, const sse_int16_t& b )
71 {
72  return _mm_mullo_epi16( a.value, b.value );
73 }
74 #endif
75 //*************************************************************************************************
76 
77 
78 //*************************************************************************************************
87 #if BLAZE_MIC_MODE
88 inline sse_int32_t operator*( const sse_int32_t& a, const sse_int32_t& b )
89 {
90  return _mm512_mullo_epi32( a.value, b.value );
91 }
92 #elif BLAZE_AVX2_MODE
93 inline sse_int32_t operator*( const sse_int32_t& a, const sse_int32_t& b )
94 {
95  return _mm256_mullo_epi32( a.value, b.value );
96 }
97 #elif BLAZE_SSE4_MODE
98 inline sse_int32_t operator*( const sse_int32_t& a, const sse_int32_t& b )
99 {
100  return _mm_mullo_epi32( a.value, b.value );
101 }
102 #endif
103 //*************************************************************************************************
104 
105 
106 //*************************************************************************************************
115 #if BLAZE_MIC_MODE
116 inline sse_float_t operator*( const sse_float_t& a, const sse_float_t& b )
117 {
118  return _mm512_mul_ps( a.value, b.value );
119 }
120 #elif BLAZE_AVX_MODE
121 inline sse_float_t operator*( const sse_float_t& a, const sse_float_t& b )
122 {
123  return _mm256_mul_ps( a.value, b.value );
124 }
125 #elif BLAZE_SSE_MODE
126 inline sse_float_t operator*( const sse_float_t& a, const sse_float_t& b )
127 {
128  return _mm_mul_ps( a.value, b.value );
129 }
130 #endif
131 //*************************************************************************************************
132 
133 
134 //*************************************************************************************************
143 #if BLAZE_MIC_MODE
144 inline sse_double_t operator*( const sse_double_t& a, const sse_double_t& b )
145 {
146  return _mm512_mul_pd( a.value, b.value );
147 }
148 #elif BLAZE_AVX_MODE
149 inline sse_double_t operator*( const sse_double_t& a, const sse_double_t& b )
150 {
151  return _mm256_mul_pd( a.value, b.value );
152 }
153 #elif BLAZE_SSE2_MODE
154 inline sse_double_t operator*( const sse_double_t& a, const sse_double_t& b )
155 {
156  return _mm_mul_pd( a.value, b.value );
157 }
158 #endif
159 //*************************************************************************************************
160 
161 
162 //*************************************************************************************************
171 #if BLAZE_AVX_MODE
172 inline sse_cfloat_t operator*( const sse_cfloat_t& a, const sse_cfloat_t& b )
173 {
174  __m256 x, y, z;
175 
176  x = _mm256_shuffle_ps( a.value, a.value, 0xA0A0 );
177  z = _mm256_mul_ps( x, b.value );
178  x = _mm256_shuffle_ps( a.value, a.value, 0xF5F5 );
179  y = _mm256_shuffle_ps( b.value, b.value, 0xB1B1 );
180  y = _mm256_mul_ps( x, y );
181  return _mm256_addsub_ps( z, y );
182 }
183 #elif BLAZE_SSE3_MODE
184 inline sse_cfloat_t operator*( const sse_cfloat_t& a, const sse_cfloat_t& b )
185 {
186  __m128 x, y, z;
187 
188  x = _mm_shuffle_ps( a.value, a.value, 0xA0 );
189  z = _mm_mul_ps( x, b.value );
190  x = _mm_shuffle_ps( a.value, a.value, 0xF5 );
191  y = _mm_shuffle_ps( b.value, b.value, 0xB1 );
192  y = _mm_mul_ps( x, y );
193  return _mm_addsub_ps( z, y );
194 }
195 #endif
196 //*************************************************************************************************
197 
198 
199 //*************************************************************************************************
208 #if BLAZE_AVX_MODE
209 inline sse_cdouble_t operator*( const sse_cdouble_t& a, const sse_cdouble_t& b )
210 {
211  __m256d x, y, z;
212 
213  x = _mm256_shuffle_pd( a.value, a.value, 0 );
214  z = _mm256_mul_pd( x, b.value );
215  x = _mm256_shuffle_pd( a.value, a.value, 15 );
216  y = _mm256_shuffle_pd( b.value, b.value, 5 );
217  y = _mm256_mul_pd( x, y );
218  return _mm256_addsub_pd( z, y );
219 }
220 #elif BLAZE_SSE3_MODE
221 inline sse_cdouble_t operator*( const sse_cdouble_t& a, const sse_cdouble_t& b )
222 {
223  __m128d x, y, z;
224 
225  x = _mm_shuffle_pd( a.value, a.value, 0 );
226  z = _mm_mul_pd( x, b.value );
227  x = _mm_shuffle_pd( a.value, a.value, 3 );
228  y = _mm_shuffle_pd( b.value, b.value, 1 );
229  y = _mm_mul_pd( x, y );
230  return _mm_addsub_pd( z, y );
231 }
232 #endif
233 //*************************************************************************************************
234 
235 } // namespace blaze
236 
237 #endif
const DMatDMatMultExpr< T1, T2 > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:4329
Header file for the basic intrinsic types.
System settings for the SSE mode.