Skip to content

Commit 247cfb9

Browse files
weiyu-chensys_zuul
authored and
sys_zuul
committed
Check in LVN pass if the use instruction supports source modifiers
Change-Id: I75212fdc961fe696643ee24f224115eefb66c7ce
1 parent 9f2af11 commit 247cfb9

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

visa/Gen4_IR.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7423,6 +7423,11 @@ bool G4_INST::canSupportCondMod() const
74237423
(op == G4_xor));
74247424
}
74257425

7426+
bool G4_INST::canSupportSrcModifier() const
7427+
{
7428+
return !isSend();
7429+
}
7430+
74267431
// convert (execsize, offset) into emask option
74277432
// if no such mask option exists, return InstOpt_NoOpt
74287433
G4_InstOption G4_INST::offsetToMask(int execSize, int offset, bool nibOk)

visa/Gen4_IR.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,6 +1119,7 @@ class G4_INST
11191119
bool canSupportCondMod() const;
11201120
bool canSwapSource() const;
11211121
bool canSupportSaturate() const;
1122+
bool canSupportSrcModifier() const;
11221123

11231124
bool usesFlag() const
11241125
{

visa/LVN.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,11 +290,9 @@ bool LVN::canReplaceUses(INST_LIST_ITER inst_it, UseList& uses, G4_INST* lvnInst
290290

291291
if (negMatch)
292292
{
293-
if (useInst->isSend())
293+
if (!useInst->canSupportSrcModifier())
294294
{
295-
// send src opnd doesnt support negate modifier.
296-
// So if LVN found a pattern that requires the
297-
// modifier then this optimization is invalid.
295+
// LVN is invalid if instruction does not support negatve modifier
298296
canReplace = false;
299297
break;
300298
}

0 commit comments

Comments
 (0)