diff options
| -rw-r--r-- | src/video_core/shader/decode/arithmetic_integer.cpp | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/video_core/shader/decode/arithmetic_integer.cpp b/src/video_core/shader/decode/arithmetic_integer.cpp index 2fe787d6f..0f4c3103a 100644 --- a/src/video_core/shader/decode/arithmetic_integer.cpp +++ b/src/video_core/shader/decode/arithmetic_integer.cpp | |||
| @@ -235,34 +235,30 @@ u32 ShaderIR::DecodeArithmeticInteger(NodeBlock& bb, u32 pc) { | |||
| 235 | case OpCode::Id::LEA_IMM: | 235 | case OpCode::Id::LEA_IMM: |
| 236 | case OpCode::Id::LEA_RZ: | 236 | case OpCode::Id::LEA_RZ: |
| 237 | case OpCode::Id::LEA_HI: { | 237 | case OpCode::Id::LEA_HI: { |
| 238 | const auto [op_a, op_b, op_c] = [&]() -> std::tuple<Node, Node, Node> { | 238 | auto [op_a, op_b, op_c] = [&]() -> std::tuple<Node, Node, Node> { |
| 239 | switch (opcode->get().GetId()) { | 239 | switch (opcode->get().GetId()) { |
| 240 | case OpCode::Id::LEA_R2: { | 240 | case OpCode::Id::LEA_R2: { |
| 241 | return {GetRegister(instr.gpr20), GetRegister(instr.gpr39), | 241 | return {GetRegister(instr.gpr20), GetRegister(instr.gpr39), |
| 242 | Immediate(static_cast<u32>(instr.lea.r2.entry_a))}; | 242 | Immediate(static_cast<u32>(instr.lea.r2.entry_a))}; |
| 243 | } | 243 | } |
| 244 | |||
| 245 | case OpCode::Id::LEA_R1: { | 244 | case OpCode::Id::LEA_R1: { |
| 246 | const bool neg = instr.lea.r1.neg != 0; | 245 | const bool neg = instr.lea.r1.neg != 0; |
| 247 | return {GetOperandAbsNegInteger(GetRegister(instr.gpr8), false, neg, true), | 246 | return {GetOperandAbsNegInteger(GetRegister(instr.gpr8), false, neg, true), |
| 248 | GetRegister(instr.gpr20), | 247 | GetRegister(instr.gpr20), |
| 249 | Immediate(static_cast<u32>(instr.lea.r1.entry_a))}; | 248 | Immediate(static_cast<u32>(instr.lea.r1.entry_a))}; |
| 250 | } | 249 | } |
| 251 | |||
| 252 | case OpCode::Id::LEA_IMM: { | 250 | case OpCode::Id::LEA_IMM: { |
| 253 | const bool neg = instr.lea.imm.neg != 0; | 251 | const bool neg = instr.lea.imm.neg != 0; |
| 254 | return {Immediate(static_cast<u32>(instr.lea.imm.entry_a)), | 252 | return {Immediate(static_cast<u32>(instr.lea.imm.entry_a)), |
| 255 | GetOperandAbsNegInteger(GetRegister(instr.gpr8), false, neg, true), | 253 | GetOperandAbsNegInteger(GetRegister(instr.gpr8), false, neg, true), |
| 256 | Immediate(static_cast<u32>(instr.lea.imm.entry_b))}; | 254 | Immediate(static_cast<u32>(instr.lea.imm.entry_b))}; |
| 257 | } | 255 | } |
| 258 | |||
| 259 | case OpCode::Id::LEA_RZ: { | 256 | case OpCode::Id::LEA_RZ: { |
| 260 | const bool neg = instr.lea.rz.neg != 0; | 257 | const bool neg = instr.lea.rz.neg != 0; |
| 261 | return {GetConstBuffer(instr.lea.rz.cb_index, instr.lea.rz.cb_offset), | 258 | return {GetConstBuffer(instr.lea.rz.cb_index, instr.lea.rz.cb_offset), |
| 262 | GetOperandAbsNegInteger(GetRegister(instr.gpr8), false, neg, true), | 259 | GetOperandAbsNegInteger(GetRegister(instr.gpr8), false, neg, true), |
| 263 | Immediate(static_cast<u32>(instr.lea.rz.entry_a))}; | 260 | Immediate(static_cast<u32>(instr.lea.rz.entry_a))}; |
| 264 | } | 261 | } |
| 265 | |||
| 266 | case OpCode::Id::LEA_HI: | 262 | case OpCode::Id::LEA_HI: |
| 267 | default: | 263 | default: |
| 268 | UNIMPLEMENTED_MSG("Unhandled LEA subinstruction: {}", opcode->get().GetName()); | 264 | UNIMPLEMENTED_MSG("Unhandled LEA subinstruction: {}", opcode->get().GetName()); |
| @@ -275,12 +271,9 @@ u32 ShaderIR::DecodeArithmeticInteger(NodeBlock& bb, u32 pc) { | |||
| 275 | UNIMPLEMENTED_IF_MSG(instr.lea.pred48 != static_cast<u64>(Pred::UnusedIndex), | 271 | UNIMPLEMENTED_IF_MSG(instr.lea.pred48 != static_cast<u64>(Pred::UnusedIndex), |
| 276 | "Unhandled LEA Predicate"); | 272 | "Unhandled LEA Predicate"); |
| 277 | 273 | ||
| 278 | const Node shifted_c = | 274 | Node value = Operation(OperationCode::ILogicalShiftLeft, std::move(op_a), std::move(op_c)); |
| 279 | Operation(OperationCode::ILogicalShiftLeft, NO_PRECISE, Immediate(1), op_c); | 275 | value = Operation(OperationCode::IAdd, std::move(op_b), std::move(value)); |
| 280 | const Node mul_bc = Operation(OperationCode::IMul, NO_PRECISE, op_b, shifted_c); | 276 | SetRegister(bb, instr.gpr0, std::move(value)); |
| 281 | const Node value = Operation(OperationCode::IAdd, NO_PRECISE, op_a, mul_bc); | ||
| 282 | |||
| 283 | SetRegister(bb, instr.gpr0, value); | ||
| 284 | 277 | ||
| 285 | break; | 278 | break; |
| 286 | } | 279 | } |