Skip to content

Commit 0ee8de5

Browse files
fangliu2020igcbot
authored andcommitted
Fix the issue that flag register should not be propagated to ternary instruction
Flag register is not allowed in any operand of ternary instruction. So, shouldn't propagate flag register to ternary instruction.
1 parent 93015ce commit 0ee8de5

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

visa/G4_IR.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7975,6 +7975,10 @@ bool G4_INST::canSrcBeFlagForPropagation(Gen4_Operand_Number opndNum) const {
79757975
if (!isLogic())
79767976
return false;
79777977

7978+
// flag register is not allowed in ternary instruction
7979+
if (getNumSrc() == 3)
7980+
return false;
7981+
79787982
// For non-commutative opcodes, only src0 can be flag. Otherwise, HWConformity
79797983
// may generate more mov instructions to fix the illegal flag reg operand.
79807984
// For commutative opcodes, it is fine to have flag reg on non-src0 sources as

visa/G4_Verifier.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,12 @@ void G4Verifier::verifyOpnd(G4_Operand *opnd, G4_INST *inst) {
465465
}
466466
}
467467
} else {
468+
// Only valid ARF type are NULL and Accumulator for ternary instructions
469+
if (inst->getNumSrc() == 3) {
470+
if (opnd->isAreg() && !opnd->isNullReg() && !opnd->isAccReg())
471+
vISA_ASSERT(false, "Not allowed ARF in ternary instruction");
472+
}
473+
468474
if (opnd->isSrcRegRegion() && opnd->isRightBoundSet()) {
469475
G4_SrcRegRegion newRgn(*(opnd->asSrcRegRegion()));
470476

0 commit comments

Comments
 (0)