Blaze 3.9
Min.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_SIMD_MIN_H_
36#define _BLAZE_MATH_SIMD_MIN_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
45#include <blaze/system/Inline.h>
48
49
50namespace blaze {
51
52//=================================================================================================
53//
54// 8-BIT INTEGRAL SIMD TYPES
55//
56//=================================================================================================
57
58//*************************************************************************************************
68BLAZE_ALWAYS_INLINE const SIMDint8 min( const SIMDint8& a, const SIMDint8& b ) noexcept
69#if BLAZE_AVX512BW_MODE
70{
71 return _mm512_min_epi8( (*a).value, (*b).value );
72}
73#elif BLAZE_AVX2_MODE
74{
75 return _mm256_min_epi8( (*a).value, (*b).value );
76}
77#elif BLAZE_SSE4_MODE
78{
79 return _mm_min_epi8( (*a).value, (*b).value );
80}
81#else
82= delete;
83#endif
84//*************************************************************************************************
85
86
87//*************************************************************************************************
97BLAZE_ALWAYS_INLINE const SIMDuint8 min( const SIMDuint8& a, const SIMDuint8& b ) noexcept
98#if BLAZE_AVX512BW_MODE
99{
100 return _mm512_min_epu8( (*a).value, (*b).value );
101}
102#elif BLAZE_AVX2_MODE
103{
104 return _mm256_min_epu8( (*a).value, (*b).value );
105}
106#elif BLAZE_SSE2_MODE
107{
108 return _mm_min_epu8( (*a).value, (*b).value );
109}
110#else
111= delete;
112#endif
113//*************************************************************************************************
114
115
116
117
118//=================================================================================================
119//
120// 16-BIT INTEGRAL SIMD TYPES
121//
122//=================================================================================================
123
124//*************************************************************************************************
134BLAZE_ALWAYS_INLINE const SIMDint16 min( const SIMDint16& a, const SIMDint16& b ) noexcept
135#if BLAZE_AVX512BW_MODE
136{
137 return _mm512_min_epi16( (*a).value, (*b).value );
138}
139#elif BLAZE_AVX2_MODE
140{
141 return _mm256_min_epi16( (*a).value, (*b).value );
142}
143#elif BLAZE_SSE2_MODE
144{
145 return _mm_min_epi16( (*a).value, (*b).value );
146}
147#else
148= delete;
149#endif
150//*************************************************************************************************
151
152
153//*************************************************************************************************
163BLAZE_ALWAYS_INLINE const SIMDuint16 min( const SIMDuint16& a, const SIMDuint16& b ) noexcept
164#if BLAZE_AVX512BW_MODE
165{
166 return _mm512_min_epu16( (*a).value, (*b).value );
167}
168#elif BLAZE_AVX2_MODE
169{
170 return _mm256_min_epu16( (*a).value, (*b).value );
171}
172#elif BLAZE_SSE4_MODE
173{
174 return _mm_min_epu16( (*a).value, (*b).value );
175}
176#else
177= delete;
178#endif
179//*************************************************************************************************
180
181
182
183
184//=================================================================================================
185//
186// 32-BIT INTEGRAL SIMD TYPES
187//
188//=================================================================================================
189
190//*************************************************************************************************
200BLAZE_ALWAYS_INLINE const SIMDint32 min( const SIMDint32& a, const SIMDint32& b ) noexcept
201#if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
202{
203 return _mm512_min_epi32( (*a).value, (*b).value );
204}
205#elif BLAZE_AVX2_MODE
206{
207 return _mm256_min_epi32( (*a).value, (*b).value );
208}
209#elif BLAZE_SSE4_MODE
210{
211 return _mm_min_epi32( (*a).value, (*b).value );
212}
213#else
214= delete;
215#endif
216//*************************************************************************************************
217
218
219//*************************************************************************************************
229BLAZE_ALWAYS_INLINE const SIMDuint32 min( const SIMDuint32& a, const SIMDuint32& b ) noexcept
230#if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
231{
232 return _mm512_min_epu32( (*a).value, (*b).value );
233}
234#elif BLAZE_AVX2_MODE
235{
236 return _mm256_min_epu32( (*a).value, (*b).value );
237}
238#elif BLAZE_SSE4_MODE
239{
240 return _mm_min_epu32( (*a).value, (*b).value );
241}
242#else
243= delete;
244#endif
245//*************************************************************************************************
246
247
248
249
250//=================================================================================================
251//
252// 32-BIT FLOATING POINT SIMD TYPES
253//
254//=================================================================================================
255
256//*************************************************************************************************
266template< typename T1 // Type of the left-hand side operand
267 , typename T2 > // Type of the right-hand side operand
269 min( const SIMDf32<T1>& a, const SIMDf32<T2>& b ) noexcept
270#if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
271{
272 return _mm512_min_ps( (*a).eval().value, (*b).eval().value );
273}
274#elif BLAZE_AVX_MODE
275{
276 return _mm256_min_ps( (*a).eval().value, (*b).eval().value );
277}
278#elif BLAZE_SSE_MODE
279{
280 return _mm_min_ps( (*a).eval().value, (*b).eval().value );
281}
282#else
283= delete;
284#endif
285//*************************************************************************************************
286
287
288
289
290//=================================================================================================
291//
292// 64-BIT FLOATING POINT SIMD TYPES
293//
294//=================================================================================================
295
296//*************************************************************************************************
306template< typename T1 // Type of the left-hand side operand
307 , typename T2 > // Type of the right-hand side operand
309 min( const SIMDf64<T1>& a, const SIMDf64<T2>& b ) noexcept
310#if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
311{
312 return _mm512_min_pd( (*a).eval().value, (*b).eval().value );
313}
314#elif BLAZE_AVX_MODE
315{
316 return _mm256_min_pd( (*a).eval().value, (*b).eval().value );
317}
318#elif BLAZE_SSE2_MODE
319{
320 return _mm_min_pd( (*a).eval().value, (*b).eval().value );
321}
322#else
323= delete;
324#endif
325//*************************************************************************************************
326
327} // namespace blaze
328
329#endif
Header file for the basic SIMD types.
Header file for the IntegralConstant class template.
Header file for the IsSIMDPack type trait.
SIMD type for 64-bit double precision floating point data values.
SIMD type for 32-bit single precision floating point data values.
SIMD type for 16-bit signed integral data values.
SIMD type for 32-bit signed integral data values.
SIMD type for 8-bit signed integral data values.
SIMD type for 16-bit unsigned integral data values.
SIMD type for 32-bit unsigned integral data values.
SIMD type for 8-bit unsigned integral data values.
constexpr decltype(auto) min(T1 &&a, T2 &&b, T3 &&c, Ts &&... args)
Minimum function for at least four values/objects.
Definition: Min.h:126
#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.