From dbe29bd5ca5d3bc62ce500cbfd8274f22dddb293 Mon Sep 17 00:00:00 2001 From: Tobias Jakobi Date: Tue, 26 Dec 2023 12:52:38 +0100 Subject: [PATCH] CPU/Recompiler: Fix build error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Build currently fails on a GCC 13.2.x with: /var/tmp/portage/games-emulation/duckstation-9999/work/duckstation/src/core/cpu_recompiler_code_generator.cpp: In member function ‘bool CPU::Recompiler::CodeGenerator::Compile_Bitwise(CPU::Instruction, const CPU::CodeCache::InstructionInfo&)’: /var/tmp/portage/games-emulation/duckstation-9999/work/duckstation/src/core/cpu_recompiler_code_generator.cpp:1330:81: error: operands to ‘?:’ have different types ‘BitField’ and ‘BitField’ 1330 | PGXP::PackMoveArgs(dest, lhs.HasConstantValue(0) ? instruction.r.rt : instruction.r.rs)), | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /var/tmp/portage/games-emulation/duckstation-9999/work/duckstation/src/core/cpu_recompiler_code_generator.cpp:1362:81: error: operands to ‘?:’ have different types ‘BitField’ and ‘BitField’ 1362 | PGXP::PackMoveArgs(dest, lhs.HasConstantValue(0) ? instruction.r.rt : instruction.r.rs)), | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- src/core/cpu_recompiler_code_generator.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/cpu_recompiler_code_generator.cpp b/src/core/cpu_recompiler_code_generator.cpp index ee117eaa0..40b5cd0e9 100644 --- a/src/core/cpu_recompiler_code_generator.cpp +++ b/src/core/cpu_recompiler_code_generator.cpp @@ -1325,9 +1325,11 @@ bool CodeGenerator::Compile_Bitwise(Instruction instruction, const CodeCache::In ((lhs.HasConstantValue(0) && instruction.r.rt != Reg::zero && dest != instruction.r.rs) || (rhs.HasConstantValue(0) && instruction.r.rs != Reg::zero && dest != instruction.r.rt))) { + const auto rs = lhs.HasConstantValue(0) ? static_cast(instruction.r.rt) : static_cast(instruction.r.rs); + EmitFunctionCall(nullptr, &PGXP::CPU_MOVE_Packed, Value::FromConstantU32( - PGXP::PackMoveArgs(dest, lhs.HasConstantValue(0) ? instruction.r.rt : instruction.r.rs)), + PGXP::PackMoveArgs(dest, rs)), lhs.HasConstantValue(0) ? rhs : lhs); } } @@ -1357,9 +1359,11 @@ bool CodeGenerator::Compile_Bitwise(Instruction instruction, const CodeCache::In ((lhs.HasConstantValue(0) && instruction.r.rt != Reg::zero && dest != instruction.r.rs) || (rhs.HasConstantValue(0) && instruction.r.rs != Reg::zero && dest != instruction.r.rt))) { + const auto rs = lhs.HasConstantValue(0) ? static_cast(instruction.r.rt) : static_cast(instruction.r.rs); + EmitFunctionCall(nullptr, &PGXP::CPU_MOVE_Packed, Value::FromConstantU32( - PGXP::PackMoveArgs(dest, lhs.HasConstantValue(0) ? instruction.r.rt : instruction.r.rs)), + PGXP::PackMoveArgs(dest, rs)), lhs.HasConstantValue(0) ? rhs : lhs); } }