Skip to content

Commit e52635f

Browse files
WIP
1 parent 64e2960 commit e52635f

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

include/xsimd/arch/common/xsimd_common_math.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2117,7 +2117,7 @@ namespace xsimd
21172117
template <class Op, class A, class T>
21182118
XSIMD_INLINE T reduce(Op, batch<T, A> const& self, std::integral_constant<unsigned, 1>) noexcept
21192119
{
2120-
return ::xsimd::kernel::first(self, A{});
2120+
return ::xsimd::kernel::first(self, A {});
21212121
}
21222122

21232123
template <class Op, class A, class T, unsigned Lvl>

include/xsimd/arch/xsimd_rvv.hpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,6 +1335,19 @@ namespace xsimd
13351335
return result;
13361336
}
13371337

1338+
// first
1339+
template <class A, class T, detail::rvv_enable_all_t<T> = 0>
1340+
XSIMD_INLINE T first(batch<T, A> const& arg, requires_arch<rvv>) noexcept
1341+
{
1342+
return detail::rvvmv_lane0(arg);
1343+
}
1344+
1345+
template <class A, class T, detail::rvv_enable_all_t<T> = 0>
1346+
XSIMD_INLINE std::complex<T> first(batch<std::complex<T>, A> const& arg, requires_arch<rvv>) noexcept
1347+
{
1348+
return std::complex<T> { detail::rvvmv_lane0(arg.real()), detail::rvvmv_lane0(arg.imag()) };
1349+
}
1350+
13381351
// insert
13391352
template <class A, class T, size_t I, detail::rvv_enable_all_t<T> = 0>
13401353
XSIMD_INLINE batch<T, A> insert(batch<T, A> const& arg, T val, index<I>, requires_arch<rvv>) noexcept

include/xsimd/arch/xsimd_sse2.hpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,6 @@ namespace xsimd
720720
}
721721
}
722722

723-
724723
// from_mask
725724
template <class A>
726725
XSIMD_INLINE batch_bool<float, A> from_mask(batch_bool<float, A> const&, uint64_t mask, requires_arch<sse2>) noexcept
@@ -1317,10 +1316,10 @@ namespace xsimd
13171316
batch<T, A> step2 = _mm_shufflelo_epi16(acc1, mask2);
13181317
batch<T, A> acc2 = max(acc1, step2);
13191318
if (sizeof(T) == 2)
1320-
return first(acc2, A{});
1319+
return first(acc2, A {});
13211320
batch<T, A> step3 = bitwise_cast<T>(bitwise_cast<uint16_t>(acc2) >> 8);
13221321
batch<T, A> acc3 = max(acc2, step3);
1323-
return first(acc3, A{});
1322+
return first(acc3, A {});
13241323
}
13251324

13261325
// reduce_min
@@ -1339,10 +1338,10 @@ namespace xsimd
13391338
batch<T, A> step2 = _mm_shufflelo_epi16(acc1, mask2);
13401339
batch<T, A> acc2 = min(acc1, step2);
13411340
if (sizeof(T) == 2)
1342-
return first(acc2, A{});
1341+
return first(acc2, A {});
13431342
batch<T, A> step3 = bitwise_cast<T>(bitwise_cast<uint16_t>(acc2) >> 8);
13441343
batch<T, A> acc3 = min(acc2, step3);
1345-
return first(acc3, A{});
1344+
return first(acc3, A {});
13461345
}
13471346

13481347
// rsqrt

0 commit comments

Comments
 (0)