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.
This commit is contained in:
Merry 2024-01-29 22:40:49 +00:00
parent 314ab7a462
commit 2ee3eacd01

View file

@ -22,7 +22,13 @@ static void EmitCRC32Castagnoli(BlockOfCode& code, EmitContext& ctx, IR::Inst* i
if (code.HasHostFeature(HostFeature::SSE42)) { if (code.HasHostFeature(HostFeature::SSE42)) {
const Xbyak::Reg32 crc = ctx.reg_alloc.UseScratchGpr(args[0]).cvt32(); const Xbyak::Reg32 crc = ctx.reg_alloc.UseScratchGpr(args[0]).cvt32();
const Xbyak::Reg value = ctx.reg_alloc.UseGpr(args[1]).changeBit(data_size); 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); ctx.reg_alloc.DefineValue(inst, crc);
return; return;
} }