Skip to content

Commit c1fddc9

Browse files
riscv
1 parent 34b6bec commit c1fddc9

File tree

4 files changed

+27
-7
lines changed

4 files changed

+27
-7
lines changed

include/xsimd/arch/xsimd_neon.hpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,7 +1333,13 @@ namespace xsimd
13331333
using register_type = typename batch<T, A>::register_type;
13341334
const detail::excluding_int64_dispatcher::binary dispatcher = {
13351335
std::make_tuple(wrap::vminq_u8, wrap::vminq_s8, wrap::vminq_u16, wrap::vminq_s16,
1336-
wrap::vminq_u32, wrap::vminq_s32, wrap::vminq_f32)
1336+
wrap::vminq_u32, wrap::vminq_s32,
1337+
#ifdef __FAST_MATH__
1338+
wrap::vminq_f32
1339+
#else
1340+
wrap::vminnmq_f32
1341+
#endif
1342+
)
13371343
};
13381344
return dispatcher.apply(register_type(lhs), register_type(rhs));
13391345
}
@@ -1357,9 +1363,15 @@ namespace xsimd
13571363
using register_type = typename batch<T, A>::register_type;
13581364
const detail::excluding_int64_dispatcher::binary dispatcher = {
13591365
std::make_tuple(wrap::vmaxq_u8, wrap::vmaxq_s8, wrap::vmaxq_u16, wrap::vmaxq_s16,
1360-
wrap::vmaxq_u32, wrap::vmaxq_s32, wrap::vmaxq_f32)
1366+
wrap::vmaxq_u32, wrap::vmaxq_s32,
1367+
#ifdef __FAST_MATH__
1368+
wrap::vmaxq_f32
1369+
#else
1370+
wrap::vmaxnmq_f32
1371+
#endif
1372+
)
13611373
};
1362-
return dispatcher.apply(register_type(rhs), register_type(lhs));
1374+
return dispatcher.apply(register_type(lhs), register_type(rhs));
13631375
}
13641376

13651377
template <class A, class T, detail::enable_sized_integral_t<T, 8> = 0>

include/xsimd/arch/xsimd_neon64.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,11 @@ namespace xsimd
584584
template <class A>
585585
XSIMD_INLINE batch<double, A> min(batch<double, A> const& lhs, batch<double, A> const& rhs, requires_arch<neon64>) noexcept
586586
{
587+
#ifdef __FAST_MATH__
587588
return vminq_f64(lhs, rhs);
589+
#else
590+
return vminnmq_f64(lhs, rhs);
591+
#endif
588592
}
589593

590594
/*******
@@ -594,7 +598,11 @@ namespace xsimd
594598
template <class A>
595599
XSIMD_INLINE batch<double, A> max(batch<double, A> const& lhs, batch<double, A> const& rhs, requires_arch<neon64>) noexcept
596600
{
601+
#ifdef __FAST_MATH__
597602
return vmaxq_f64(lhs, rhs);
603+
#else
604+
return vmaxnmq_f64(lhs, rhs);
605+
#endif
598606
}
599607

600608
/*******

include/xsimd/arch/xsimd_rvv.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -742,14 +742,14 @@ namespace xsimd
742742
template <class A, class T, detail::rvv_enable_all_t<T> = 0>
743743
XSIMD_INLINE batch<T, A> max(batch<T, A> const& lhs, batch<T, A> const& rhs, requires_arch<rvv>) noexcept
744744
{
745-
return detail::rvvmax(lhs, rhs);
745+
return detail::rvvmax(rhs, lhs);
746746
}
747747

748748
// min
749749
template <class A, class T, detail::rvv_enable_all_t<T> = 0>
750750
XSIMD_INLINE batch<T, A> min(batch<T, A> const& lhs, batch<T, A> const& rhs, requires_arch<rvv>) noexcept
751751
{
752-
return detail::rvvmin(lhs, rhs);
752+
return detail::rvvmin(rhs, lhs);
753753
}
754754

755755
// neg

include/xsimd/arch/xsimd_vsx.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,14 +470,14 @@ namespace xsimd
470470
template <class A, class T, class = typename std::enable_if<std::is_scalar<T>::value, void>::type>
471471
XSIMD_INLINE batch<T, A> max(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
472472
{
473-
return vec_max(self.data, other.data);
473+
return vec_max(other.data, self.data);
474474
}
475475

476476
// min
477477
template <class A, class T, class = typename std::enable_if<std::is_scalar<T>::value, void>::type>
478478
XSIMD_INLINE batch<T, A> min(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
479479
{
480-
return vec_min(self.data, other.data);
480+
return vec_min(other.data, self.data);
481481
}
482482

483483
// mul

0 commit comments

Comments
 (0)