From c788f9c0bd9cb0b0cb66f7424a65032cca3731cc Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Sat, 25 Apr 2020 22:41:20 -0300 Subject: shader/arithmetic_integer: Implement IADD.X IADD.X takes the carry flag and adds it to the result. This is generally used to emulate 64-bit operations with 32-bit registers. --- src/video_core/shader/decode/arithmetic_integer.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/video_core/shader/decode') diff --git a/src/video_core/shader/decode/arithmetic_integer.cpp b/src/video_core/shader/decode/arithmetic_integer.cpp index 99b4b6342..2a3311cb8 100644 --- a/src/video_core/shader/decode/arithmetic_integer.cpp +++ b/src/video_core/shader/decode/arithmetic_integer.cpp @@ -42,6 +42,12 @@ u32 ShaderIR::DecodeArithmeticInteger(NodeBlock& bb, u32 pc) { Node value = Operation(OperationCode::IAdd, op_a, op_b); + if (instr.iadd.x) { + Node carry = GetInternalFlag(InternalFlag::Carry); + Node x = Operation(OperationCode::Select, std::move(carry), Immediate(1), Immediate(0)); + value = Operation(OperationCode::IAdd, std::move(value), std::move(x)); + } + if (instr.generates_cc) { const Node i0 = Immediate(0); -- cgit v1.2.3