mirror of
https://git.suyu.dev/suyu/dynarmic.git
synced 2026-01-11 17:08:18 +01:00
A64: Implement CRC32
This commit is contained in:
parent
01b4395bf8
commit
af1384d700
6 changed files with 161 additions and 7 deletions
|
|
@ -8,6 +8,39 @@
|
|||
|
||||
namespace Dynarmic::A64 {
|
||||
|
||||
bool TranslatorVisitor::CRC32(bool sf, Reg Rm, Imm<2> sz, Reg Rn, Reg Rd) {
|
||||
const u32 integral_size = sz.ZeroExtend();
|
||||
|
||||
if (sf && integral_size != 0b11) {
|
||||
return UnallocatedEncoding();
|
||||
}
|
||||
|
||||
if (!sf && integral_size == 0b11) {
|
||||
return UnallocatedEncoding();
|
||||
}
|
||||
|
||||
const IR::U32 result = [&] {
|
||||
const size_t datasize = sf ? 64 : 32;
|
||||
const IR::U32 accumulator = ir.GetW(Rn);
|
||||
const IR::U32U64 data = X(datasize, Rm);
|
||||
|
||||
switch (integral_size) {
|
||||
case 0b00:
|
||||
return ir.CRC32ISO8(accumulator, data);
|
||||
case 0b01:
|
||||
return ir.CRC32ISO16(accumulator, data);
|
||||
case 0b10:
|
||||
return ir.CRC32ISO32(accumulator, data);
|
||||
case 0b11:
|
||||
default:
|
||||
return ir.CRC32ISO64(accumulator, data);
|
||||
}
|
||||
}();
|
||||
|
||||
X(32, Rd, result);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TranslatorVisitor::CRC32C(bool sf, Reg Rm, Imm<2> sz, Reg Rn, Reg Rd) {
|
||||
const u32 integral_size = sz.ZeroExtend();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue