Skip to content
Merged
17 changes: 16 additions & 1 deletion include/boost/uuid/detail/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#undef BOOST_UUID_USE_AVX2
#undef BOOST_UUID_USE_AVX512_V1
#undef BOOST_UUID_USE_AVX10_1
#undef BOOST_UUID_USE_RISCV_V

#else

Expand Down Expand Up @@ -91,6 +92,19 @@

#endif

#if defined(__riscv_vector) && defined(__riscv_v_min_vlen) && (__riscv_v_min_vlen >= 128)

// RISC-V Vector Extension (V 1.0+), GCC 12+ / Clang 15+
// The implementation processes 16 characters at a time, so it requires at least 16 8-bit
// vector lanes, i.e. vectors of at least 128 bits. __riscv_v_min_vlen is 128 for the V
// extension and for targets with Zvl128b and above, and lower for the Zve32*/Zve64*
// subsets, on which the implementation would produce incorrect results.
#ifndef BOOST_UUID_USE_RISCV_V
#define BOOST_UUID_USE_RISCV_V
#endif

#endif

// More advanced ISA extensions imply less advanced are also available
#if !defined(BOOST_UUID_USE_AVX512_V1) && defined(BOOST_UUID_USE_AVX10_1)
#define BOOST_UUID_USE_AVX512_V1
Expand Down Expand Up @@ -128,7 +142,8 @@
!defined(BOOST_UUID_USE_SSE41) && \
!defined(BOOST_UUID_USE_SSSE3) && \
!defined(BOOST_UUID_USE_SSE3) && \
!defined(BOOST_UUID_USE_SSE2)
!defined(BOOST_UUID_USE_SSE2) && \
!defined(BOOST_UUID_USE_RISCV_V)
#define BOOST_UUID_NO_SIMD
#endif

Expand Down
5 changes: 4 additions & 1 deletion include/boost/uuid/detail/from_chars.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
#if defined(BOOST_UUID_USE_SSE2)
# include <boost/uuid/detail/from_chars_x86.hpp>

#elif defined(BOOST_UUID_USE_RISCV_V)
# include <boost/uuid/detail/from_chars_riscv.hpp>

#elif defined(BOOST_UUID_REPORT_IMPLEMENTATION)
# include <boost/config/pragma_message.hpp>
BOOST_PRAGMA_MESSAGE( "Using from_chars_generic.hpp" )
Expand All @@ -27,7 +30,7 @@ template<class Ch>
BOOST_UUID_CXX14_CONSTEXPR_RT inline
from_chars_result<Ch> from_chars( Ch const* first, Ch const* last, uuid& u ) noexcept
{
#if defined(BOOST_UUID_USE_SSE2)
#if defined(BOOST_UUID_USE_SSE2) || defined(BOOST_UUID_USE_RISCV_V)
if( detail::is_constant_evaluated_rt() )
{
return detail::from_chars_generic( first, last, u );
Expand Down
Loading