From 3ac20fd9e48437bf2a051f0992ddd9117c826b3e Mon Sep 17 00:00:00 2001 From: fleroviux Date: Fri, 26 Apr 2024 20:35:17 +0200 Subject: [PATCH] Backend\X64: fix broken SUB #1 optimization --- src/backend/x86_64/compile_alu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/x86_64/compile_alu.cpp b/src/backend/x86_64/compile_alu.cpp index d57bd44..5b42523 100644 --- a/src/backend/x86_64/compile_alu.cpp +++ b/src/backend/x86_64/compile_alu.cpp @@ -188,7 +188,7 @@ void X64Backend::CompileSUB(CompileContext const& context, IRSub* op) { if (result_reg != lhs_reg) { code.mov(result_reg, lhs_reg); } - if(imm == 1u && update_host_flags) { + if(imm == 1u && !update_host_flags) { code.dec(result_reg); } else { code.sub(result_reg, imm);