Skip to content

Commit 547f7e4

Browse files
committed
Fixed fmin, fmax and fabs for integer batches (sse and avx)
1 parent ff936b3 commit 547f7e4

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

include/xsimd/math/xsimd_basic_math.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ namespace xsimd
237237
using batch_type = batch<T, N>;
238238
using batch_bool_type = typename simd_batch_traits<batch_type>::batch_bool_type;
239239

240-
static inline batch_bool_type run(const batch_type& x)
240+
static inline batch_bool_type run(const batch_type&)
241241
{
242242
return batch_bool_type(false);
243243
}

include/xsimd/types/xsimd_avx_int_base.hpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,21 @@ namespace xsimd
541541
#endif
542542
}
543543

544+
static batch_type fmin(const batch_type& lhs, const batch_type& rhs)
545+
{
546+
return min(lhs, rhs);
547+
}
548+
549+
static batch_type fmax(const batch_type& lhs, const batch_type& rhs)
550+
{
551+
return max(lhs, rhs);
552+
}
553+
554+
static batch_type fabs(const batch_type& rhs)
555+
{
556+
return abs(rhs);
557+
}
558+
544559
static batch_type fma(const batch_type& x, const batch_type& y, const batch_type& z)
545560
{
546561
return x * y + z;

include/xsimd/types/xsimd_sse_int_base.hpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,21 @@ namespace xsimd
492492
return _mm_andnot_si128(lhs, rhs);
493493
}
494494

495+
static batch_type fmin(const batch_type& lhs, const batch_type& rhs)
496+
{
497+
return min(lhs, rhs);
498+
}
499+
500+
static batch_type fmax(const batch_type& lhs, const batch_type& rhs)
501+
{
502+
return max(lhs, rhs);
503+
}
504+
505+
static batch_type fabs(const batch_type& rhs)
506+
{
507+
return abs(rhs);
508+
}
509+
495510
static batch_type fma(const batch_type& x, const batch_type& y, const batch_type& z)
496511
{
497512
return x * y + z;

0 commit comments

Comments
 (0)