@@ -2972,16 +2972,22 @@ namespace IGC
2972
2972
pattern->instruction = &I;
2973
2973
uint nbSources = GetNbSources (I);
2974
2974
2975
- bool supportModifer = SupportsModifier (&I);
2975
+ bool supportModiferSrc0 = SupportsModifier (&I);
2976
2976
bool supportRegioning = SupportsRegioning (&I);
2977
- pattern->sources [0 ] = GetSource (I.getOperand (0 ), supportModifer && SupportSrc0Mod, supportRegioning);
2978
- if (nbSources > 1 )
2979
- {
2980
- pattern->sources [1 ] = GetSource (I.getOperand (1 ), supportModifer, supportRegioning);
2977
+ llvm::Instruction* src0Inst = llvm::dyn_cast<llvm::Instruction>(I.getOperand (0 ));
2978
+ if (I.getOpcode () == llvm::Instruction::UDiv && src0Inst && src0Inst->getOpcode () == llvm::Instruction::Sub) {
2979
+ supportModiferSrc0 = false ;
2981
2980
}
2982
-
2981
+ pattern-> sources [ 0 ] = GetSource (I. getOperand ( 0 ), supportModiferSrc0 && SupportSrc0Mod, supportRegioning);
2983
2982
if (nbSources > 1 )
2984
2983
{
2984
+ bool supportModiferSrc1 = SupportsModifier (&I);
2985
+ llvm::Instruction* src1Inst = llvm::dyn_cast<llvm::Instruction>(I.getOperand (1 ));
2986
+ if (I.getOpcode () == llvm::Instruction::UDiv && src1Inst && src1Inst->getOpcode () == llvm::Instruction::Sub) {
2987
+ supportModiferSrc1 = false ;
2988
+ }
2989
+ pattern->sources [1 ] = GetSource (I.getOperand (1 ), supportModiferSrc1, supportRegioning);
2990
+
2985
2991
// add df imm to constant pool for binary/ternary inst
2986
2992
// we do 64-bit int imm bigger than 32 bits, since smaller may fit in D/W
2987
2993
for (int i = 0 , numSrc = (int )nbSources; i < numSrc; ++i)
0 commit comments