PPU LLVM: Use VPERM2B to emulate VPERM (#8704)

- The VPERM2B instructions are a match of VPERM's behavior, besides operating in reverse byte order
This commit is contained in:
Whatcookie 2020-08-08 20:50:26 -04:00 committed by GitHub
parent 0c85d4c0d0
commit 4ce2ad54a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 47 additions and 0 deletions

View file

@ -1295,6 +1295,14 @@ void PPUTranslator::VPERM(ppu_opcode_t op)
const auto a = get_vr<u8[16]>(op.va);
const auto b = get_vr<u8[16]>(op.vb);
const auto c = get_vr<u8[16]>(op.vc);
if (m_use_avx512_icl && op.ra != op.rb)
{
const auto i = eval(~c);
set_vr(op.vd, vperm2b(b, a, i));
return;
}
const auto i = eval(~c & 0x1f);
set_vr(op.vd, select(noncast<s8[16]>(c << 3) >= 0, pshufb(a, i), pshufb(b, i)));
}