summaryrefslogtreecommitdiffstats
path: root/src/video_core/shader
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2018-12-19 04:43:23 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2019-01-15 21:54:52 +0100
commitc9cf899d1852da73e90ead3d5c0eeee58de6152d (patch)
tree3932950be46bde427c6c538a2a180e7d0a5bac4d /src/video_core/shader
parentshader_decode: Implement IADD3 (diff)
downloadyuzu-c9cf899d1852da73e90ead3d5c0eeee58de6152d.tar
yuzu-c9cf899d1852da73e90ead3d5c0eeee58de6152d.tar.gz
yuzu-c9cf899d1852da73e90ead3d5c0eeee58de6152d.tar.bz2
yuzu-c9cf899d1852da73e90ead3d5c0eeee58de6152d.tar.lz
yuzu-c9cf899d1852da73e90ead3d5c0eeee58de6152d.tar.xz
yuzu-c9cf899d1852da73e90ead3d5c0eeee58de6152d.tar.zst
yuzu-c9cf899d1852da73e90ead3d5c0eeee58de6152d.zip
Diffstat (limited to 'src/video_core/shader')
-rw-r--r--src/video_core/shader/decode/arithmetic_integer.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/video_core/shader/decode/arithmetic_integer.cpp b/src/video_core/shader/decode/arithmetic_integer.cpp
index 3b9b9d6d9..b12dc5ba8 100644
--- a/src/video_core/shader/decode/arithmetic_integer.cpp
+++ b/src/video_core/shader/decode/arithmetic_integer.cpp
@@ -12,6 +12,7 @@ namespace VideoCommon::Shader {
using Tegra::Shader::IAdd3Height;
using Tegra::Shader::Instruction;
using Tegra::Shader::OpCode;
+using Tegra::Shader::Pred;
using Tegra::Shader::Register;
u32 ShaderIR::DecodeArithmeticInteger(BasicBlock& bb, u32 pc) {
@@ -175,6 +176,60 @@ u32 ShaderIR::DecodeArithmeticInteger(BasicBlock& bb, u32 pc) {
SetRegister(bb, instr.gpr0, value);
break;
}
+ case OpCode::Id::LEA_R2:
+ case OpCode::Id::LEA_R1:
+ case OpCode::Id::LEA_IMM:
+ case OpCode::Id::LEA_RZ:
+ case OpCode::Id::LEA_HI: {
+ const auto [op_a, op_b, op_c] = [&]() -> std::tuple<Node, Node, Node> {
+ switch (opcode->get().GetId()) {
+ case OpCode::Id::LEA_R2: {
+ return {GetRegister(instr.gpr20), GetRegister(instr.gpr39),
+ Immediate(static_cast<u32>(instr.lea.r2.entry_a))};
+ }
+
+ case OpCode::Id::LEA_R1: {
+ const bool neg = instr.lea.r1.neg != 0;
+ return {GetOperandAbsNegInteger(GetRegister(instr.gpr8), false, neg, true),
+ GetRegister(instr.gpr20),
+ Immediate(static_cast<u32>(instr.lea.r1.entry_a))};
+ }
+
+ case OpCode::Id::LEA_IMM: {
+ const bool neg = instr.lea.imm.neg != 0;
+ return {Immediate(static_cast<u32>(instr.lea.imm.entry_a)),
+ GetOperandAbsNegInteger(GetRegister(instr.gpr8), false, neg, true),
+ Immediate(static_cast<u32>(instr.lea.imm.entry_b))};
+ }
+
+ case OpCode::Id::LEA_RZ: {
+ const bool neg = instr.lea.rz.neg != 0;
+ return {GetConstBuffer(instr.lea.rz.cb_index, instr.lea.rz.cb_offset),
+ GetOperandAbsNegInteger(GetRegister(instr.gpr8), false, neg, true),
+ Immediate(static_cast<u32>(instr.lea.rz.entry_a))};
+ }
+
+ case OpCode::Id::LEA_HI:
+ default:
+ UNIMPLEMENTED_MSG("Unhandled LEA subinstruction: {}", opcode->get().GetName());
+
+ return {Immediate(static_cast<u32>(instr.lea.imm.entry_a)), GetRegister(instr.gpr8),
+ Immediate(static_cast<u32>(instr.lea.imm.entry_b))};
+ }
+ }();
+
+ UNIMPLEMENTED_IF_MSG(instr.lea.pred48 != static_cast<u64>(Pred::UnusedIndex),
+ "Unhandled LEA Predicate");
+
+ const Node shifted_c =
+ Operation(OperationCode::ILogicalShiftLeft, NO_PRECISE, Immediate(1), op_c);
+ const Node mul_bc = Operation(OperationCode::IMul, NO_PRECISE, op_b, shifted_c);
+ const Node value = Operation(OperationCode::IAdd, NO_PRECISE, op_a, mul_bc);
+
+ SetRegister(bb, instr.gpr0, value);
+
+ break;
+ }
default:
UNIMPLEMENTED_MSG("Unhandled ArithmeticInteger instruction: {}", opcode->get().GetName());
}