mirror of
https://git.suyu.dev/suyu/dynarmic.git
synced 2026-03-07 19:52:56 +00:00
A64: Implement CRC32C
This commit is contained in:
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
|
||||
Reference in New Issue
Block a user