summaryrefslogtreecommitdiff
path: root/lib/Target/R600/SIInstrInfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Target/R600/SIInstrInfo.cpp')
-rw-r--r--lib/Target/R600/SIInstrInfo.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/Target/R600/SIInstrInfo.cpp b/lib/Target/R600/SIInstrInfo.cpp
index 39d1be688d1..1e09ca29ae9 100644
--- a/lib/Target/R600/SIInstrInfo.cpp
+++ b/lib/Target/R600/SIInstrInfo.cpp
@@ -1369,7 +1369,16 @@ bool SIInstrInfo::isOperandLegal(const MachineInstr *MI, unsigned OpIdx,
if (MO->isReg()) {
assert(DefinedRC);
const TargetRegisterClass *RC = MRI.getRegClass(MO->getReg());
- return RI.getCommonSubClass(RC, RI.getRegClass(OpInfo.RegClass));
+
+ // In order to be legal, the common sub-class must be equal to the
+ // class of the current operand. For example:
+ //
+ // v_mov_b32 sgpr0 ; Operand defined as vsrc_32
+ // ; RI.getCommonSubClass(sgpr,vsrc_32) = sgpr ; LEGAL
+ //
+ // s_sendmsg 0, sgpr0 ; Operand defined as m0reg
+ // ; RI.getCommonSubClass(sgpr,m0) = M0 ; NOT LEGAL
+ return RI.getCommonSubClass(RC, RI.getRegClass(OpInfo.RegClass)) == RC;
}