mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-04 05:51:27 +12:00
v128: A few optimizations (#8432)
This commit is contained in:
parent
5777a1d426
commit
731d4330fe
2 changed files with 6 additions and 7 deletions
|
@ -1,4 +1,4 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "util/endian.hpp"
|
#include "util/endian.hpp"
|
||||||
|
@ -355,12 +355,12 @@ union alignas(16) v128
|
||||||
|
|
||||||
bool operator==(const v128& right) const
|
bool operator==(const v128& right) const
|
||||||
{
|
{
|
||||||
return _u64[0] == right._u64[0] && _u64[1] == right._u64[1];
|
return _mm_movemask_epi8(v128::eq32(*this, right).vi) == 0xffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const v128& right) const
|
bool operator!=(const v128& right) const
|
||||||
{
|
{
|
||||||
return _u64[0] != right._u64[0] || _u64[1] != right._u64[1];
|
return !operator==(right);
|
||||||
}
|
}
|
||||||
|
|
||||||
// result = (~left) & (right)
|
// result = (~left) & (right)
|
||||||
|
@ -371,8 +371,7 @@ union alignas(16) v128
|
||||||
|
|
||||||
void clear()
|
void clear()
|
||||||
{
|
{
|
||||||
_u64[0] = 0;
|
*this = {};
|
||||||
_u64[1] = 0;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -403,7 +402,7 @@ inline v128 operator^(const v128& left, const v128& right)
|
||||||
|
|
||||||
inline v128 operator~(const v128& other)
|
inline v128 operator~(const v128& other)
|
||||||
{
|
{
|
||||||
return v128::from64(~other._u64[0], ~other._u64[1]);
|
return other ^ v128::from32p(UINT32_MAX); // XOR with ones
|
||||||
}
|
}
|
||||||
|
|
||||||
using stx::se_t;
|
using stx::se_t;
|
||||||
|
|
|
@ -85,7 +85,7 @@ static FORCE_INLINE bool cmp_rdata(const decltype(spu_thread::rdata)& lhs, const
|
||||||
const v128 c = (lhs[4] ^ rhs[4]) | (lhs[5] ^ rhs[5]);
|
const v128 c = (lhs[4] ^ rhs[4]) | (lhs[5] ^ rhs[5]);
|
||||||
const v128 d = (lhs[6] ^ rhs[6]) | (lhs[7] ^ rhs[7]);
|
const v128 d = (lhs[6] ^ rhs[6]) | (lhs[7] ^ rhs[7]);
|
||||||
const v128 r = (a | b) | (c | d);
|
const v128 r = (a | b) | (c | d);
|
||||||
return !(r._u64[0] | r._u64[1]);
|
return r == v128{};
|
||||||
}
|
}
|
||||||
|
|
||||||
static FORCE_INLINE void mov_rdata_avx(__m256i* dst, const __m256i* src)
|
static FORCE_INLINE void mov_rdata_avx(__m256i* dst, const __m256i* src)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue