From fcae0e311db59f8c545d7b2f37f94a343c8ac206 Mon Sep 17 00:00:00 2001 From: "J. Gareth \"Curious Kit\" Moreton" Date: Sun, 10 Jul 2022 17:47:51 +0100 Subject: [PATCH] x86: Direct assignment instructions are no longer checked prior to calling CheckJumpMovTransferOpt, instead relying on the callee to do the heavy lifting (also fixed -Os bug) --- compiler/x86/aoptx86.pas | 45 +++++++++------------------------------- 1 file changed, 10 insertions(+), 35 deletions(-) diff --git a/compiler/x86/aoptx86.pas b/compiler/x86/aoptx86.pas index bf4cd8c331..dfa3717bf4 100644 --- a/compiler/x86/aoptx86.pas +++ b/compiler/x86/aoptx86.pas @@ -10303,8 +10303,8 @@ unit aoptx86; hp1 := GetLabelWithSym(OrigLabel); if (taicpu(p).condition=C_None) and assigned(hp1) and SkipLabels(hp1,hp1) and (hp1.typ = ait_instruction) then begin - case taicpu(hp1).opcode of - A_RET: + if taicpu(hp1).opcode = A_RET then + begin { change jmp .L1 @@ -10318,39 +10318,14 @@ unit aoptx86; ConvertJumpToRET(p, hp1); result:=true; end; - { Check any kind of direct assignment instruction } - A_MOV, - A_MOVD, - A_MOVQ, - A_MOVSX, -{$ifdef x86_64} - A_MOVSXD, -{$endif x86_64} - A_MOVZX, - A_MOVAPS, - A_MOVUPS, - A_MOVSD, - A_MOVAPD, - A_MOVUPD, - A_MOVDQA, - A_MOVDQU, - A_VMOVSS, - A_VMOVAPS, - A_VMOVUPS, - A_VMOVSD, - A_VMOVAPD, - A_VMOVUPD, - A_VMOVDQA, - A_VMOVDQU: - if ((current_settings.optimizerswitches * [cs_opt_level3, cs_opt_size]) <> [cs_opt_size]) and - CheckJumpMovTransferOpt(p, hp1, 0, Count) then - begin - Result := True; - Exit; - end; - else - ; - end; + end + else if (cs_opt_level3 in current_settings.optimizerswitches) and + not (cs_opt_size in current_settings.optimizerswitches) and + CheckJumpMovTransferOpt(p, hp1, 0, Count) then + begin + Result := True; + Exit; + end; end; end; end;