Skip to content

Commit 0402b7d

Browse files
pkwasnie-inteligcbot
authored andcommitted
subroutine int64 div/rem emulation
By default, emulation builtins are inlined. PreCompiledFuncImport takes into account inlined emulation threshold and switches inlines to subroutines, but only for floating point emulation. Add int64 div/rem emulation to possible subroutined builtins.
1 parent b375370 commit 0402b7d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

IGC/Compiler/Optimizer/PreCompiledFuncImport.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2523,6 +2523,7 @@ void PreCompiledFuncImport::checkAndSetEnableSubroutine()
25232523
bool SPDiv = isSPDiv();
25242524
bool DPEmu = isDPEmu();
25252525
bool DPDivSqrtEmu = isDPDivSqrtEmu();
2526+
bool I64DivRem = isI64DivRem();
25262527

25272528
Module* M = m_pCtx->getModule();
25282529
for (auto FI = M->begin(), FE = M->end(); FI != FE; ++FI)
@@ -2565,6 +2566,15 @@ void PreCompiledFuncImport::checkAndSetEnableSubroutine()
25652566
m_enableSubroutineCallForEmulation = true;
25662567
}
25672568
break;
2569+
case Instruction::UDiv:
2570+
case Instruction::URem:
2571+
case Instruction::SDiv:
2572+
case Instruction::SRem:
2573+
if (I64DivRem && I->getOperand(0)->getType()->isIntegerTy(64))
2574+
{
2575+
m_enableSubroutineCallForEmulation = true;
2576+
}
2577+
break;
25682578
}
25692579

25702580
GenIntrinsicInst* GII = dyn_cast<GenIntrinsicInst>(I);

0 commit comments

Comments
 (0)