summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2020-03-27 18:36:38 -0300
committerGravatar ReinUsesLisp2020-03-27 18:36:38 -0300
commit796b3319e6171a152e41e9719b42dbddf20e2957 (patch)
tree7d0febb2c1db2f37b218a2753585d9798b1e00e8 /src
parentMerge pull request #3565 from ReinUsesLisp/image-format (diff)
downloadyuzu-796b3319e6171a152e41e9719b42dbddf20e2957.tar.gz
yuzu-796b3319e6171a152e41e9719b42dbddf20e2957.tar.xz
yuzu-796b3319e6171a152e41e9719b42dbddf20e2957.zip
shader/lea: Remove const and use move when possible
Diffstat (limited to 'src')
-rw-r--r--src/video_core/shader/decode/arithmetic_integer.cpp16
1 files changed, 5 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..5d546ddec 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,10 @@ 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 shifted_c = Operation(OperationCode::ILogicalShiftLeft, Immediate(1), std::move(op_c));
279 Operation(OperationCode::ILogicalShiftLeft, NO_PRECISE, Immediate(1), op_c); 275 Node mul_bc = Operation(OperationCode::IMul, std::move(op_b), std::move(shifted_c));
280 const Node mul_bc = Operation(OperationCode::IMul, NO_PRECISE, op_b, shifted_c); 276 Node value = Operation(OperationCode::IAdd, std::move(op_a), std::move(mul_bc));
281 const Node value = Operation(OperationCode::IAdd, NO_PRECISE, op_a, mul_bc); 277 SetRegister(bb, instr.gpr0, std::move(value));
282
283 SetRegister(bb, instr.gpr0, value);
284 278
285 break; 279 break;
286 } 280 }