Skip to content

Commit

Permalink
x64/reg_alloc: More zero extension paranoia
Browse files Browse the repository at this point in the history
  • Loading branch information
merryhime committed Mar 6, 2022
1 parent 316b95b commit bcfe377
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/dynarmic/backend/x64/reg_alloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ void RegAlloc::HostCall(IR::Inst* result_def,
for (size_t i = 0; i < args_count; i++) {
if (args[i] && !args[i]->get().IsVoid()) {
UseScratch(*args[i], args_hostloc[i]);
#if defined(__llvm__) && !defined(_WIN32)

// LLVM puts the burden of zero-extension of 8 and 16 bit values on the caller instead of the callee
const Xbyak::Reg64 reg = HostLocToReg64(args_hostloc[i]);
switch (args[i]->get().GetType()) {
Expand All @@ -420,10 +420,12 @@ void RegAlloc::HostCall(IR::Inst* result_def,
case IR::Type::U16:
code.movzx(reg.cvt32(), reg.cvt16());
break;
case IR::Type::U32:
code.mov(reg.cvt32(), reg.cvt32());
break;
default:
break; // Nothing needs to be done
}
#endif
}
}

Expand Down

0 comments on commit bcfe377

Please sign in to comment.