aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMerry <[email protected]>2024-01-29 22:40:49 +0000
committerMerry <[email protected]>2024-01-29 22:42:17 +0000
commit2ee3eacd01ad83eedb2a46ec0f2c6d42499917c2 (patch)
treeb92ac71f0e4f3f031be0591d84f8ff46e4892685
parent314ab7a46265a9f43d203d0ba8a8e263458dac71 (diff)
downloaddynarmic-2ee3eacd01ad83eedb2a46ec0f2c6d42499917c2.tar.gz
dynarmic-2ee3eacd01ad83eedb2a46ec0f2c6d42499917c2.zip
emit_x64_crc32: Correct use of x64 crc32 instruction
CRC32 r32, r/m64 variant does not exist, but CRC r64, r/m64 does what we want.
-rw-r--r--src/dynarmic/backend/x64/emit_x64_crc32.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/dynarmic/backend/x64/emit_x64_crc32.cpp b/src/dynarmic/backend/x64/emit_x64_crc32.cpp
index 6ad4c489..842a8612 100644
--- a/src/dynarmic/backend/x64/emit_x64_crc32.cpp
+++ b/src/dynarmic/backend/x64/emit_x64_crc32.cpp
@@ -22,7 +22,13 @@ static void EmitCRC32Castagnoli(BlockOfCode& code, EmitContext& ctx, IR::Inst* i
if (code.HasHostFeature(HostFeature::SSE42)) {
const Xbyak::Reg32 crc = ctx.reg_alloc.UseScratchGpr(args[0]).cvt32();
const Xbyak::Reg value = ctx.reg_alloc.UseGpr(args[1]).changeBit(data_size);
- code.crc32(crc, value);
+
+ if (data_size != 64) {
+ code.crc32(crc, value);
+ } else {
+ code.crc32(crc.cvt64(), value);
+ }
+
ctx.reg_alloc.DefineValue(inst, crc);
return;
}