+ use TX86AsmOptimizer.OptPass1SHLSAL on x86-64

git-svn-id: trunk@38499 -
This commit is contained in:
florian 2018-03-11 14:35:22 +00:00
parent 47927f053a
commit 5fbecc5501
2 changed files with 14 additions and 5 deletions

View File

@ -2082,7 +2082,7 @@ unit aoptx86;
begin begin
Result:=false; Result:=false;
if MatchOpType(taicpu(p),top_const,top_reg) and 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 (taicpu(p).oper[0]^.val <= 3) then
{ Changes "shl const, %reg32; add const/reg, %reg32" to one lea statement } { Changes "shl const, %reg32; add const/reg, %reg32" to one lea statement }
begin begin
@ -2143,10 +2143,14 @@ unit aoptx86;
hp1.free; hp1.free;
end; end;
end; end;
if TmpBool2 or if TmpBool2
{$ifndef x86_64}
or
((current_settings.optimizecputype < cpu_Pentium2) and ((current_settings.optimizecputype < cpu_Pentium2) and
(taicpu(p).oper[0]^.val <= 3) 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 begin
if not(TmpBool2) and if not(TmpBool2) and
(taicpu(p).oper[0]^.val = 1) then (taicpu(p).oper[0]^.val = 1) then
@ -2155,13 +2159,14 @@ unit aoptx86;
taicpu(p).oper[1]^.reg, taicpu(p).oper[1]^.reg) taicpu(p).oper[1]^.reg, taicpu(p).oper[1]^.reg)
end end
else 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); taicpu(p).oper[1]^.reg);
InsertLLItem(p.previous, p.next, hp1); InsertLLItem(p.previous, p.next, hp1);
p.free; p.free;
p := hp1; p := hp1;
end; end;
end end
{$ifndef x86_64}
else if (current_settings.optimizecputype < cpu_Pentium2) and else if (current_settings.optimizecputype < cpu_Pentium2) and
MatchOpType(taicpu(p),top_const,top_reg) then MatchOpType(taicpu(p),top_const,top_reg) then
begin begin
@ -2189,7 +2194,9 @@ unit aoptx86;
p.free; p.free;
p := hp1; p := hp1;
end; end;
end; end
{$endif x86_64}
;
end; end;

View File

@ -112,6 +112,8 @@ uses
result:=OptPass1LEA(p); result:=OptPass1LEA(p);
A_SUB: A_SUB:
result:=OptPass1Sub(p); result:=OptPass1Sub(p);
A_SHL,A_SAL:
result:=OptPass1SHLSAL(p);
end; end;
end; end;
end; end;