mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-05 06:21:26 +12:00
Implement u64_x_u64_=_u128 optimization
This commit is contained in:
parent
60ae4c1121
commit
8d9911e383
1 changed files with 20 additions and 0 deletions
|
@ -250,6 +250,8 @@ using __m128 = float __attribute__((vector_size(16)));
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
using u128 = __uint128_t;
|
using u128 = __uint128_t;
|
||||||
using s128 = __int128_t;
|
using s128 = __int128_t;
|
||||||
|
|
||||||
|
static constexpr bool is_u128_emulated = false;
|
||||||
#else
|
#else
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
|
@ -564,8 +566,26 @@ struct s128 : u128
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static constexpr bool is_u128_emulated = true;
|
||||||
#endif
|
#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 <>
|
template <>
|
||||||
struct get_int_impl<16>
|
struct get_int_impl<16>
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue