Index: src/PNaClTranslator.cpp |
diff --git a/src/PNaClTranslator.cpp b/src/PNaClTranslator.cpp |
index 8f157a64984efcb52154366f0fb93e59b04dc901..92bb36e6315f18ebc9eef94e3aa2609243ce180a 100644 |
--- a/src/PNaClTranslator.cpp |
+++ b/src/PNaClTranslator.cpp |
@@ -1192,6 +1192,32 @@ void FunctionParser::ProcessRecord() { |
Inst = Ice::InstCast::create(Func, CastKind, Dest, Src); |
break; |
} |
+ case naclbitc::FUNC_CODE_INST_VSELECT: { |
+ // VSELECT: [opval, opval, pred] |
+ Ice::Operand *ThenVal = getOperand(convertRelativeToAbsIndex(Values[0])); |
+ Ice::Type ThenType = ThenVal->getType(); |
+ Ice::Operand *ElseVal = getOperand(convertRelativeToAbsIndex(Values[1])); |
+ Ice::Type ElseType = ElseVal->getType(); |
+ if (ThenType != ElseType) { |
+ std::string Buffer; |
+ raw_string_ostream StrBuf(Buffer); |
+ StrBuf << "Select operands not same type. Found " << ThenType << " and " |
+ << ElseType; |
+ Error(StrBuf.str()); |
+ return; |
+ } |
+ Ice::Operand *CondVal = getOperand(convertRelativeToAbsIndex(Values[2])); |
+ if (CondVal->getType() != Ice::IceType_i1) { |
Jim Stichnoth
2014/09/02 19:38:49
The predicate can also be a vector of i1 (and the
Karl
2014/09/02 22:20:25
Done.
|
+ std::string Buffer; |
+ raw_string_ostream StrBuf(Buffer); |
+ StrBuf << "Select condition not type i1. Found: " << CondVal->getType(); |
+ Error(StrBuf.str()); |
+ return; |
+ } |
+ Ice::Variable *DestVal = NextInstVar(ThenType); |
+ Inst = Ice::InstSelect::create(Func, DestVal, CondVal, ThenVal, ElseVal); |
+ break; |
+ } |
case naclbitc::FUNC_CODE_INST_RET: { |
// RET: [opval?] |
InstIsTerminating = true; |