mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 03:25:16 +00:00
ror64 added
This commit is contained in:
parent
74d47943e9
commit
3baf79f929
5 changed files with 21 additions and 12 deletions
|
@ -905,8 +905,9 @@ inline void busy_wait(std::size_t count = 100)
|
|||
while (count--) _mm_pause();
|
||||
}
|
||||
|
||||
// Left rotate helpers
|
||||
// Rotate helpers
|
||||
#if defined(__GNUG__)
|
||||
|
||||
inline u8 rol8(const u8 x, const u8 n)
|
||||
{
|
||||
u8 result = x;
|
||||
|
@ -934,9 +935,18 @@ inline u64 rol64(const u64 x, const u64 n)
|
|||
__asm__("rolq %b[n], %[result]" : [result] "+g" (result) : [n] "c" (n));
|
||||
return result;
|
||||
}
|
||||
|
||||
inline u64 ror64(const u64 x, const u64 n)
|
||||
{
|
||||
u64 result = x;
|
||||
__asm__("rorq %b[n], %[result]" : [result] "+g" (result) : [n] "c" (n));
|
||||
return result;
|
||||
}
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
inline u8 rol8(const u8 x, const u8 n) { return _rotl8(x, n); }
|
||||
inline u16 rol16(const u16 x, const u16 n) { return _rotl16(x, n); }
|
||||
inline u32 rol32(const u32 x, const u32 n) { return _rotl(x, n); }
|
||||
inline u64 rol64(const u64 x, const u64 n) { return _rotl64(x, n); }
|
||||
#endif
|
||||
inline u16 rol16(const u16 x, const u16 n) { return _rotl16(x, (u8)n); }
|
||||
inline u32 rol32(const u32 x, const u32 n) { return _rotl(x, (int)n); }
|
||||
inline u64 rol64(const u64 x, const u64 n) { return _rotl64(x, (int)n); }
|
||||
inline u64 ror64(const u64 x, const u64 n) { return _rotr64(x, (int)n); }
|
||||
#endif
|
||||
|
|
|
@ -1175,7 +1175,7 @@ bool ppu_interpreter::VRLB(ppu_thread& ppu, ppu_opcode_t op)
|
|||
|
||||
for (uint i = 0; i < 16; i++)
|
||||
{
|
||||
d._u8[i] = rol8(a._u8[i], b._u8[i] & 0x7);
|
||||
d._u8[i] = rol8(a._u8[i], b._u8[i]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -62,8 +62,7 @@ union ppu_opcode_t
|
|||
|
||||
inline u64 ppu_rotate_mask(u32 mb, u32 me)
|
||||
{
|
||||
const u64 mask = ~0ull << (63 ^ (me - mb));
|
||||
return mask >> mb | mask << (64 - mb); // Rotate
|
||||
return ror64(~0ull << (63 ^ (me - mb)), mb);
|
||||
}
|
||||
|
||||
inline u32 ppu_decode(u32 inst)
|
||||
|
|
|
@ -478,7 +478,7 @@ void spu_recompiler::ROT(spu_opcode_t op)
|
|||
{
|
||||
for (u32 i = 0; i < 4; i++)
|
||||
{
|
||||
t[i] = (a[i] << b[i]) | (a[i] >> (32 - b[i]));
|
||||
t[i] = rol32(a[i], b[i]);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -588,7 +588,7 @@ void spu_recompiler::ROTH(spu_opcode_t op) //nf
|
|||
{
|
||||
for (u32 i = 0; i < 8; i++)
|
||||
{
|
||||
t[i] = (a[i] << b[i]) | (a[i] >> (16 - b[i]));
|
||||
t[i] = rol16(a[i], b[i]);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ void spu_interpreter::ROT(SPUThread& spu, spu_opcode_t op)
|
|||
|
||||
for (u32 i = 0; i < 4; i++)
|
||||
{
|
||||
spu.gpr[op.rt]._u32[i] = (a._u32[i] << b._s32[i]) | (a._u32[i] >> (32 - b._s32[i]));
|
||||
spu.gpr[op.rt]._u32[i] = rol32(a._u32[i], b._u32[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ void spu_interpreter::ROTH(SPUThread& spu, spu_opcode_t op)
|
|||
|
||||
for (u32 i = 0; i < 8; i++)
|
||||
{
|
||||
spu.gpr[op.rt]._u16[i] = (a._u16[i] << b._s16[i]) | (a._u16[i] >> (16 - b._s16[i]));
|
||||
spu.gpr[op.rt]._u16[i] = rol16(a._u16[i], b._s16[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue