Implemented I2I.CC on the NEU control code, used by SMO

This commit is contained in:
FernandoS27 2018-09-09 00:46:19 -04:00
parent e2ac8fb36d
commit e4bb759c4b
2 changed files with 18 additions and 14 deletions

View File

@ -1141,7 +1141,7 @@ private:
INST("0011011-0101----", Id::ISET_IMM, Type::IntegerSet, "ISET_IMM"), INST("0011011-0101----", Id::ISET_IMM, Type::IntegerSet, "ISET_IMM"),
INST("0101000010001---", Id::PSET, Type::PredicateSetRegister, "PSET"), INST("0101000010001---", Id::PSET, Type::PredicateSetRegister, "PSET"),
INST("0101000010010---", Id::PSETP, Type::PredicateSetPredicate, "PSETP"), INST("0101000010010---", Id::PSETP, Type::PredicateSetPredicate, "PSETP"),
INST("010100001010----", Id::PSETP, Type::PredicateSetPredicate, "CSETP"), INST("010100001010----", Id::CSETP, Type::PredicateSetPredicate, "CSETP"),
INST("0011011-00------", Id::XMAD_IMM, Type::Xmad, "XMAD_IMM"), INST("0011011-00------", Id::XMAD_IMM, Type::Xmad, "XMAD_IMM"),
INST("0100111---------", Id::XMAD_CR, Type::Xmad, "XMAD_CR"), INST("0100111---------", Id::XMAD_CR, Type::Xmad, "XMAD_CR"),
INST("010100010-------", Id::XMAD_RC, Type::Xmad, "XMAD_RC"), INST("010100010-------", Id::XMAD_RC, Type::Xmad, "XMAD_RC"),

View File

@ -351,12 +351,12 @@ public:
shader.AddLine(dest + " = " + src + ';'); shader.AddLine(dest + " = " + src + ';');
} }
std::string GetControlCode(const Tegra::Shader::ControlCode cc) { std::string GetControlCode(const Tegra::Shader::ControlCode cc) const {
u32 code = static_cast<u32>(cc); const u32 code = static_cast<u32>(cc);
return "controlCode_" + std::to_string(code); return "controlCode_" + std::to_string(code) + suffix;
} }
void SetControlCode(const Tegra::Shader::ControlCode cc, const std::string& value) { void SetControlCode(const Tegra::Shader::ControlCode cc, const std::string& value) const {
shader.AddLine(GetControlCode(cc) + " = " + value + ';'); shader.AddLine(GetControlCode(cc) + " = " + value + ';');
} }
@ -424,7 +424,7 @@ public:
declarations.AddNewLine(); declarations.AddNewLine();
for (u32 cc = 0; cc < 32; cc++) { for (u32 cc = 0; cc < 32; cc++) {
Tegra::Shader::ControlCode code = static_cast<Tegra::Shader::ControlCode>(cc); const Tegra::Shader::ControlCode code = static_cast<Tegra::Shader::ControlCode>(cc);
declarations.AddLine("bool " + GetControlCode(code) + " = false;"); declarations.AddLine("bool " + GetControlCode(code) + " = false;");
} }
declarations.AddNewLine(); declarations.AddNewLine();
@ -1656,6 +1656,10 @@ private:
regs.SetRegisterToInteger(instr.gpr0, instr.conversion.is_output_signed, 0, op_a, 1, regs.SetRegisterToInteger(instr.gpr0, instr.conversion.is_output_signed, 0, op_a, 1,
1, instr.alu.saturate_d, 0, instr.conversion.dest_size); 1, instr.alu.saturate_d, 0, instr.conversion.dest_size);
if (instr.generates_cc.Value() != 0) {
const std::string neucondition = "( " + op_a + " != 0 )";
regs.SetControlCode(Tegra::Shader::ControlCode::NEU, neucondition);
}
break; break;
} }
case OpCode::Id::I2F_R: case OpCode::Id::I2F_R:
@ -2298,10 +2302,10 @@ private:
break; break;
} }
case OpCode::Id::CSETP: { case OpCode::Id::CSETP: {
std::string pred = const std::string pred =
GetPredicateCondition(instr.csetp.pred39, instr.csetp.neg_pred39 != 0); GetPredicateCondition(instr.csetp.pred39, instr.csetp.neg_pred39 != 0);
std::string combiner = GetPredicateCombiner(instr.csetp.op); const std::string combiner = GetPredicateCombiner(instr.csetp.op);
std::string controlCode = regs.GetControlCode(instr.csetp.cc); const std::string controlCode = regs.GetControlCode(instr.csetp.cc);
if (instr.csetp.pred3 != static_cast<u64>(Pred::UnusedIndex)) { if (instr.csetp.pred3 != static_cast<u64>(Pred::UnusedIndex)) {
SetPredicate(instr.csetp.pred3, SetPredicate(instr.csetp.pred3,
'(' + controlCode + ") " + combiner + " (" + pred + ')'); '(' + controlCode + ") " + combiner + " (" + pred + ')');