yuzu-emu
/
yuzu
Archived
1
0
Fork 0

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("0101000010001---", Id::PSET, Type::PredicateSetRegister, "PSET"),
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("0100111---------", Id::XMAD_CR, Type::Xmad, "XMAD_CR"),
INST("010100010-------", Id::XMAD_RC, Type::Xmad, "XMAD_RC"),

View File

@ -351,12 +351,12 @@ public:
shader.AddLine(dest + " = " + src + ';');
}
std::string GetControlCode(const Tegra::Shader::ControlCode cc) {
u32 code = static_cast<u32>(cc);
return "controlCode_" + std::to_string(code);
std::string GetControlCode(const Tegra::Shader::ControlCode cc) const {
const u32 code = static_cast<u32>(cc);
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 + ';');
}
@ -424,7 +424,7 @@ public:
declarations.AddNewLine();
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.AddNewLine();
@ -1656,6 +1656,10 @@ private:
regs.SetRegisterToInteger(instr.gpr0, instr.conversion.is_output_signed, 0, op_a, 1,
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;
}
case OpCode::Id::I2F_R:
@ -2277,13 +2281,13 @@ private:
// We can't use the constant predicate as destination.
ASSERT(instr.psetp.pred3 != static_cast<u64>(Pred::UnusedIndex));
const std::string second_pred =
GetPredicateCondition(instr.psetp.pred39, instr.psetp.neg_pred39 != 0);
const std::string second_pred =
GetPredicateCondition(instr.psetp.pred39, instr.psetp.neg_pred39 != 0);
const std::string combiner = GetPredicateCombiner(instr.psetp.op);
const std::string combiner = GetPredicateCombiner(instr.psetp.op);
const std::string predicate =
'(' + op_a + ") " + GetPredicateCombiner(instr.psetp.cond) + " (" + op_b + ')';
const std::string predicate =
'(' + op_a + ") " + GetPredicateCombiner(instr.psetp.cond) + " (" + op_b + ')';
// Set the primary predicate to the result of Predicate OP SecondPredicate
SetPredicate(instr.psetp.pred3,
@ -2298,10 +2302,10 @@ private:
break;
}
case OpCode::Id::CSETP: {
std::string pred =
const std::string pred =
GetPredicateCondition(instr.csetp.pred39, instr.csetp.neg_pred39 != 0);
std::string combiner = GetPredicateCombiner(instr.csetp.op);
std::string controlCode = regs.GetControlCode(instr.csetp.cc);
const std::string combiner = GetPredicateCombiner(instr.csetp.op);
const std::string controlCode = regs.GetControlCode(instr.csetp.cc);
if (instr.csetp.pred3 != static_cast<u64>(Pred::UnusedIndex)) {
SetPredicate(instr.csetp.pred3,
'(' + controlCode + ") " + combiner + " (" + pred + ')');