summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2018-12-21 06:22:18 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2019-01-15 21:54:51 +0100
commitccb71bece9e6e6c9ceabc0826624f645c5140c53 (patch)
tree3f434672f3675383bf0eb6d2a405099843652224
parentshader_decode: Implement ISETP (diff)
downloadyuzu-ccb71bece9e6e6c9ceabc0826624f645c5140c53.tar
yuzu-ccb71bece9e6e6c9ceabc0826624f645c5140c53.tar.gz
yuzu-ccb71bece9e6e6c9ceabc0826624f645c5140c53.tar.bz2
yuzu-ccb71bece9e6e6c9ceabc0826624f645c5140c53.tar.lz
yuzu-ccb71bece9e6e6c9ceabc0826624f645c5140c53.tar.xz
yuzu-ccb71bece9e6e6c9ceabc0826624f645c5140c53.tar.zst
yuzu-ccb71bece9e6e6c9ceabc0826624f645c5140c53.zip
-rw-r--r--src/video_core/shader/decode/arithmetic_integer.cpp29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/video_core/shader/decode/arithmetic_integer.cpp b/src/video_core/shader/decode/arithmetic_integer.cpp
index 12c64e97a..47b27ac5b 100644
--- a/src/video_core/shader/decode/arithmetic_integer.cpp
+++ b/src/video_core/shader/decode/arithmetic_integer.cpp
@@ -16,7 +16,34 @@ u32 ShaderIR::DecodeArithmeticInteger(BasicBlock& bb, u32 pc) {
const Instruction instr = {program_code[pc]};
const auto opcode = OpCode::Decode(instr);
- UNIMPLEMENTED();
+ Node op_a = GetRegister(instr.gpr8);
+ Node op_b = [&]() {
+ if (instr.is_b_imm) {
+ return Immediate(instr.alu.GetSignedImm20_20());
+ } else if (instr.is_b_gpr) {
+ return GetRegister(instr.gpr20);
+ } else {
+ return GetConstBuffer(instr.cbuf34.index, instr.cbuf34.offset);
+ }
+ }();
+
+ switch (opcode->get().GetId()) {
+ case OpCode::Id::IADD_C:
+ case OpCode::Id::IADD_R:
+ case OpCode::Id::IADD_IMM: {
+ UNIMPLEMENTED_IF_MSG(instr.generates_cc,
+ "Condition codes generation in IADD is not implemented");
+ UNIMPLEMENTED_IF_MSG(instr.alu.saturate_d, "IADD saturation not implemented");
+
+ op_a = GetOperandAbsNegInteger(op_a, false, instr.alu_integer.negate_a, true);
+ op_b = GetOperandAbsNegInteger(op_b, false, instr.alu_integer.negate_b, true);
+
+ SetRegister(bb, instr.gpr0, Operation(OperationCode::IAdd, PRECISE, op_a, op_b));
+ break;
+ }
+ default:
+ UNIMPLEMENTED_MSG("Unhandled ArithmeticInteger instruction: {}", opcode->get().GetName());
+ }
return pc;
}