mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-30 12:32:43 +00:00
Implement u64_x_u64_=_u128 optimization
This commit is contained in:
parent
60ae4c1121
commit
8d9911e383
@ -250,6 +250,8 @@ using __m128 = float __attribute__((vector_size(16)));
|
||||
#ifndef _MSC_VER
|
||||
using u128 = __uint128_t;
|
||||
using s128 = __int128_t;
|
||||
|
||||
static constexpr bool is_u128_emulated = false;
|
||||
#else
|
||||
|
||||
extern "C"
|
||||
@ -564,8 +566,26 @@ struct s128 : u128
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
static constexpr bool is_u128_emulated = true;
|
||||
#endif
|
||||
|
||||
// Optimization for u64*u64=u128
|
||||
constexpr u128 u128_from_mul(u64 a, u64 b)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
if (!std::is_constant_evaluated())
|
||||
{
|
||||
u64 hi;
|
||||
u128 result = _umul128(a, b, &hi);
|
||||
result.hi = hi;
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
return u128{a} * b;
|
||||
}
|
||||
|
||||
template <>
|
||||
struct get_int_impl<16>
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user