1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Fixed '*vreg<RAX>' divisor legalization issue

This commit is contained in:
Brian Fiete 2021-02-26 07:35:38 -08:00
parent dd3485af0c
commit 044d5d5f03

View file

@ -9878,11 +9878,19 @@ bool BeMCContext::DoLegalization()
auto arg0Type = GetType(arg0);
if (arg0Type->IsInt())
{
if (arg1.mKind == BeMCOperandKind_NativeReg)
auto checkArg1 = arg1;
if (checkArg1.mKind == BeMCOperandKind_VRegLoad)
{
// Handle '*vreg<RAX>' case
checkArg1.mKind = BeMCOperandKind_VReg;
checkArg1 = GetFixedOperand(checkArg1);
}
if (checkArg1.mKind == BeMCOperandKind_NativeReg)
{
// We can't allow division by RDX because we need RAX:RDX for the dividend
auto divisorReg = GetFullRegister(arg1.mReg);
if ((arg1.IsNativeReg()) &&
auto divisorReg = GetFullRegister(checkArg1.mReg);
if ((checkArg1.IsNativeReg()) &&
((divisorReg == X64Reg_RDX) || (divisorReg == X64Reg_RAX)))
{
BF_ASSERT(inst->mArg1.IsVRegAny());
@ -15842,7 +15850,7 @@ void BeMCContext::Generate(BeFunction* function)
mDbgPreferredRegs[32] = X64Reg_R8;*/
//mDbgPreferredRegs[8] = X64Reg_RAX;
//mDebugging = (function->mName == "?Zoips@TestProgram@BeefTest@bf@@SAXXZ");
//mDebugging = (function->mName == "??Kint2@bf@@SA?A01@01@0@Z");
// || (function->mName == "?MethodA@TestProgram@BeefTest@bf@@CAXXZ");
// || (function->mName == "?Hey@Blurg@bf@@SAXXZ")
// ;