mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-02 18:37:18 +01:00
* patch by J. Gareth Moreton: take care of -Os for SubMov2*, part of #38579
git-svn-id: trunk@48878 -
This commit is contained in:
parent
81f0442e5d
commit
913bd009e9
@ -7131,13 +7131,20 @@ unit aoptx86;
|
||||
a CMP instruction if one follows.
|
||||
}
|
||||
Result := False;
|
||||
if not (cs_opt_size in current_settings.optimizerswitches) and
|
||||
(taicpu(p).opsize in [S_L{$ifdef x86_64}, S_Q{$endif x86_64}]) and
|
||||
if (taicpu(p).opsize in [S_L{$ifdef x86_64}, S_Q{$endif x86_64}]) and
|
||||
MatchOpType(taicpu(p),top_const,top_reg) and
|
||||
GetNextInstruction(p, hp1) and
|
||||
MatchInstruction(hp1, A_MOV, [taicpu(p).opsize]) and
|
||||
(taicpu(hp1).oper[1]^.typ = top_reg) and
|
||||
MatchOperand(taicpu(hp1).oper[0]^, taicpu(p).oper[1]^.reg) then
|
||||
MatchOperand(taicpu(hp1).oper[0]^, taicpu(p).oper[1]^.reg) and
|
||||
(
|
||||
{ Don't do SubMov2LeaSub under -Os, but do allow SubMov2Lea }
|
||||
not (cs_opt_size in current_settings.optimizerswitches) or
|
||||
(
|
||||
not RegUsedAfterInstruction(taicpu(p).oper[1]^.reg, hp1, TmpUsedRegs) and
|
||||
RegUsedAfterInstruction(NR_DEFAULTFLAGS, hp1, TmpUsedRegs)
|
||||
)
|
||||
) then
|
||||
begin
|
||||
{ Change the MOV instruction to a LEA instruction, and update the
|
||||
first operand }
|
||||
|
||||
Loading…
Reference in New Issue
Block a user