shader_ir: Add condition code helper

This commit is contained in:
ReinUsesLisp 2018-12-20 23:42:02 -03:00
parent a58abbcfc4
commit fbc67a0563
2 changed files with 13 additions and 0 deletions

View File

@ -321,6 +321,16 @@ OperationCode ShaderIR::GetPredicateCombiner(PredOperation operation) {
return op->second; return op->second;
} }
Node ShaderIR::GetConditionCode(Tegra::Shader::ConditionCode cc) {
switch (cc) {
case Tegra::Shader::ConditionCode::NEU:
return GetInternalFlag(InternalFlag::Zero, true);
default:
UNIMPLEMENTED_MSG("Unimplemented condition code: {}", static_cast<u32>(cc));
return GetPredicate(static_cast<u64>(Pred::NeverExecute));
}
}
void ShaderIR::SetRegister(BasicBlock& bb, Register dest, Node src) { void ShaderIR::SetRegister(BasicBlock& bb, Register dest, Node src) {
bb.push_back(Operation(OperationCode::Assign, GetRegister(dest), src)); bb.push_back(Operation(OperationCode::Assign, GetRegister(dest), src));
} }

View File

@ -672,6 +672,9 @@ private:
/// Returns a predicate combiner operation /// Returns a predicate combiner operation
OperationCode GetPredicateCombiner(Tegra::Shader::PredOperation operation); OperationCode GetPredicateCombiner(Tegra::Shader::PredOperation operation);
/// Returns a condition code evaluated from internal flags
Node GetConditionCode(Tegra::Shader::ConditionCode cc);
template <typename... T> template <typename... T>
inline Node Operation(OperationCode code, const T*... operands) { inline Node Operation(OperationCode code, const T*... operands) {
return StoreNode(OperationNode(code, operands...)); return StoreNode(OperationNode(code, operands...));