Blaze 3.9
Conj.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_SIMD_CONJ_H_
36#define _BLAZE_MATH_SIMD_CONJ_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
44#include <blaze/system/Inline.h>
46
47
48namespace blaze {
49
50//=================================================================================================
51//
52// 8-BIT INTEGRAL SIMD TYPES
53//
54//=================================================================================================
55
56//*************************************************************************************************
63template< typename T > // Type of the operand
64BLAZE_ALWAYS_INLINE const T conj( const SIMDi8<T>& a ) noexcept
65{
66 return a;
67}
68//*************************************************************************************************
69
70
71
72
73//=================================================================================================
74//
75// 16-BIT INTEGRAL SIMD TYPES
76//
77//=================================================================================================
78
79//*************************************************************************************************
86template< typename T > // Type of the operand
87BLAZE_ALWAYS_INLINE const T conj( const SIMDi16<T>& a ) noexcept
88{
89 return a;
90}
91//*************************************************************************************************
92
93
94//*************************************************************************************************
104#if BLAZE_AVX512BW_MODE
105{
106 return _mm512_mask_sub_epi16( a.value, 0XAAAAAAAA, _mm512_setzero_si512(), a.value );
107}
108#elif BLAZE_AVX2_MODE
109{
110 return _mm256_mullo_epi16( a.value, _mm256_set_epi16( -1, 1, -1, 1, -1, 1, -1, 1,
111 -1, 1, -1, 1, -1, 1, -1, 1 ) );
112}
113#elif BLAZE_SSE2_MODE
114{
115 return _mm_mullo_epi16( a.value, _mm_set_epi16( -1, 1, -1, 1, -1, 1, -1, 1 ) );
116}
117#else
118= delete;
119#endif
120//*************************************************************************************************
121
122
123
124
125//=================================================================================================
126//
127// 32-BIT INTEGRAL SIMD TYPES
128//
129//=================================================================================================
130
131//*************************************************************************************************
138template< typename T > // Type of the operand
139BLAZE_ALWAYS_INLINE const T conj( const SIMDi32<T>& a ) noexcept
140{
141 return a;
142}
143//*************************************************************************************************
144
145//*************************************************************************************************
155#if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
156{
157 return _mm512_mullo_epi32( a.value, _mm512_set_epi32( -1, 1, -1, 1, -1, 1, -1, 1,
158 -1, 1, -1, 1, -1, 1, -1, 1 ) );
159}
160#elif BLAZE_AVX2_MODE
161{
162 return _mm256_mullo_epi32( a.value, _mm256_set_epi32( -1, 1, -1, 1, -1, 1, -1, 1 ) );
163}
164#elif BLAZE_SSE4_MODE
165{
166 return _mm_mullo_epi32( a.value, _mm_set_epi32( -1, 1, -1, 1 ) );
167}
168#else
169= delete;
170#endif
171//*************************************************************************************************
172
173
174
175
176//=================================================================================================
177//
178// 64-BIT INTEGRAL SIMD TYPES
179//
180//=================================================================================================
181
182//*************************************************************************************************
189template< typename T > // Type of the operand
190BLAZE_ALWAYS_INLINE const T conj( const SIMDi64<T>& a ) noexcept
191{
192 return a;
193}
194//*************************************************************************************************
195
196
197//*************************************************************************************************
207#if BLAZE_AVX512F_MODE
208{
209 return _mm512_mask_sub_epi64( a.value, 0XAA, _mm512_setzero_si512(), a.value );
210}
211#else
212= delete;
213#endif
214//*************************************************************************************************
215
216
217
218
219//=================================================================================================
220//
221// 32-BIT FLOATING POINT SIMD TYPES
222//
223//=================================================================================================
224
225//*************************************************************************************************
232template< typename T > // Type of the operand
233BLAZE_ALWAYS_INLINE const T conj( const SIMDf32<T>& a ) noexcept
234{
235 return (*a);
236}
237//*************************************************************************************************
238
239
240//*************************************************************************************************
250#if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
251{
252 return _mm512_mask_sub_ps( a.value, 0XAAAA, _mm512_setzero_ps(), a.value );
253}
254#elif BLAZE_AVX_MODE
255{
256 return _mm256_mul_ps( a.value, _mm256_set_ps( -1.0F, 1.0F, -1.0F, 1.0F, -1.0F, 1.0F, -1.0F, 1.0F ) );
257}
258#elif BLAZE_SSE2_MODE
259{
260 return _mm_mul_ps( a.value, _mm_set_ps( -1.0F, 1.0F, -1.0F, 1.0F ) );
261}
262#else
263= delete;
264#endif
265//*************************************************************************************************
266
267
268
269
270//=================================================================================================
271//
272// 64-BIT FLOATING POINT SIMD TYPES
273//
274//=================================================================================================
275
276//*************************************************************************************************
283template< typename T > // Type of the operand
284BLAZE_ALWAYS_INLINE const T conj( const SIMDf64<T>& a ) noexcept
285{
286 return (*a);
287}
288//*************************************************************************************************
289
290
291//*************************************************************************************************
301#if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
302{
303 return _mm512_mask_sub_pd( a.value, 0XAA, _mm512_setzero_pd(), a.value );
304}
305#elif BLAZE_AVX_MODE
306{
307 return _mm256_mul_pd( a.value, _mm256_set_pd( -1.0, 1.0, -1.0, 1.0 ) );
308}
309#elif BLAZE_SSE2_MODE
310{
311 return _mm_mul_pd( a.value, _mm_set_pd( -1.0, 1.0 ) );
312}
313#else
314= delete;
315#endif
316//*************************************************************************************************
317
318} // namespace blaze
319
320#endif
Header file for the basic SIMD types.
SIMD type for 64-bit double precision complex values.
SIMD type for 32-bit single precision complex values.
SIMD type for 16-bit signed integral complex values.
SIMD type for 32-bit signed integral complex values.
SIMD type for 64-bit signed integral complex values.
BLAZE_ALWAYS_INLINE const SIMDcdouble conj(const SIMDcdouble &a) noexcept=delete
Complex conjugate of a vector of double precision complex values.
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
System settings for the inline keywords.
System settings for the SSE mode.