mirror of
https://git.suyu.dev/suyu/dynarmic.git
synced 2026-01-11 17:08:18 +01:00
A64: Implement CRC32C
This commit is contained in:
parent
d7044bc751
commit
7ffbebf290
7 changed files with 204 additions and 1 deletions
44
src/frontend/A64/translate/impl/data_processing_crc32.cpp
Normal file
44
src/frontend/A64/translate/impl/data_processing_crc32.cpp
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/* This file is part of the dynarmic project.
|
||||
* Copyright (c) 2018 MerryMage
|
||||
* This software may be used and distributed according to the terms of the GNU
|
||||
* General Public License version 2 or any later version.
|
||||
*/
|
||||
|
||||
#include "frontend/A64/translate/impl/impl.h"
|
||||
|
||||
namespace Dynarmic::A64 {
|
||||
|
||||
bool TranslatorVisitor::CRC32C(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.CRC32Castagnoli8(accumulator, data);
|
||||
case 0b01:
|
||||
return ir.CRC32Castagnoli16(accumulator, data);
|
||||
case 0b10:
|
||||
return ir.CRC32Castagnoli32(accumulator, data);
|
||||
case 0b11:
|
||||
default:
|
||||
return ir.CRC32Castagnoli64(accumulator, data);
|
||||
}
|
||||
}();
|
||||
|
||||
X(32, Rd, result);
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Dynarmic::A64
|
||||
Loading…
Add table
Add a link
Reference in a new issue