From 5fbecc550114774c429a8af6823252a209df9be4 Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 11 Mar 2018 14:35:22 +0000 Subject: [PATCH] + use TX86AsmOptimizer.OptPass1SHLSAL on x86-64 git-svn-id: trunk@38499 - --- compiler/x86/aoptx86.pas | 17 ++++++++++++----- compiler/x86_64/aoptcpu.pas | 2 ++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/compiler/x86/aoptx86.pas b/compiler/x86/aoptx86.pas index b97a661535..2c83dbd4a2 100644 --- a/compiler/x86/aoptx86.pas +++ b/compiler/x86/aoptx86.pas @@ -2082,7 +2082,7 @@ unit aoptx86; begin Result:=false; if MatchOpType(taicpu(p),top_const,top_reg) and - (taicpu(p).opsize = S_L) and + (taicpu(p).opsize in [S_L{$ifdef x86_64},S_Q{$endif x86_64}]) and (taicpu(p).oper[0]^.val <= 3) then { Changes "shl const, %reg32; add const/reg, %reg32" to one lea statement } begin @@ -2143,10 +2143,14 @@ unit aoptx86; hp1.free; end; end; - if TmpBool2 or + if TmpBool2 +{$ifndef x86_64} + or ((current_settings.optimizecputype < cpu_Pentium2) and (taicpu(p).oper[0]^.val <= 3) and - not(cs_opt_size in current_settings.optimizerswitches)) then + not(cs_opt_size in current_settings.optimizerswitches)) +{$endif x86_64} + then begin if not(TmpBool2) and (taicpu(p).oper[0]^.val = 1) then @@ -2155,13 +2159,14 @@ unit aoptx86; taicpu(p).oper[1]^.reg, taicpu(p).oper[1]^.reg) end else - hp1 := taicpu.op_ref_reg(A_LEA, S_L, TmpRef, + hp1 := taicpu.op_ref_reg(A_LEA, taicpu(p).opsize, TmpRef, taicpu(p).oper[1]^.reg); InsertLLItem(p.previous, p.next, hp1); p.free; p := hp1; end; end +{$ifndef x86_64} else if (current_settings.optimizecputype < cpu_Pentium2) and MatchOpType(taicpu(p),top_const,top_reg) then begin @@ -2189,7 +2194,9 @@ unit aoptx86; p.free; p := hp1; end; - end; + end +{$endif x86_64} + ; end; diff --git a/compiler/x86_64/aoptcpu.pas b/compiler/x86_64/aoptcpu.pas index e4fb150d65..757e18dc3c 100644 --- a/compiler/x86_64/aoptcpu.pas +++ b/compiler/x86_64/aoptcpu.pas @@ -112,6 +112,8 @@ uses result:=OptPass1LEA(p); A_SUB: result:=OptPass1Sub(p); + A_SHL,A_SAL: + result:=OptPass1SHLSAL(p); end; end; end;