mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 18:49:16 +02:00
* x86: Correct fileinfo and some refactoring for imul2leashl optimisation
This commit is contained in:
parent
fecdaeed0d
commit
f19b390c68
@ -1562,7 +1562,7 @@ unit aoptx86;
|
|||||||
function TX86AsmOptimizer.PrePeepholeOptIMUL(var p : tai) : boolean;
|
function TX86AsmOptimizer.PrePeepholeOptIMUL(var p : tai) : boolean;
|
||||||
var
|
var
|
||||||
opsize : topsize;
|
opsize : topsize;
|
||||||
hp1 : tai;
|
hp1, hp2 : tai;
|
||||||
tmpref : treference;
|
tmpref : treference;
|
||||||
ShiftValue : Cardinal;
|
ShiftValue : Cardinal;
|
||||||
BaseValue : TCGInt;
|
BaseValue : TCGInt;
|
||||||
@ -1584,10 +1584,11 @@ unit aoptx86;
|
|||||||
{ change "imul $1, reg1, reg2" to "mov reg1, reg2" }
|
{ change "imul $1, reg1, reg2" to "mov reg1, reg2" }
|
||||||
begin
|
begin
|
||||||
hp1 := taicpu.Op_Reg_Reg(A_MOV, opsize, taicpu(p).oper[1]^.reg,taicpu(p).oper[2]^.reg);
|
hp1 := taicpu.Op_Reg_Reg(A_MOV, opsize, taicpu(p).oper[1]^.reg,taicpu(p).oper[2]^.reg);
|
||||||
InsertLLItem(p.previous, p.next, hp1);
|
taicpu(hp1).fileinfo := taicpu(p).fileinfo;
|
||||||
|
asml.InsertAfter(hp1, p);
|
||||||
DebugMsg(SPeepholeOptimization + 'Imul2Mov done',p);
|
DebugMsg(SPeepholeOptimization + 'Imul2Mov done',p);
|
||||||
p.free;
|
RemoveCurrentP(p, hp1);
|
||||||
p := hp1;
|
Result := True;
|
||||||
end
|
end
|
||||||
else if ((taicpu(p).ops <= 2) or
|
else if ((taicpu(p).ops <= 2) or
|
||||||
(taicpu(p).oper[2]^.typ = Top_Reg)) and
|
(taicpu(p).oper[2]^.typ = Top_Reg)) and
|
||||||
@ -1630,8 +1631,13 @@ unit aoptx86;
|
|||||||
taicpu(hp1).fileinfo:=taicpu(p).fileinfo;
|
taicpu(hp1).fileinfo:=taicpu(p).fileinfo;
|
||||||
RemoveCurrentP(p, hp1);
|
RemoveCurrentP(p, hp1);
|
||||||
if ShiftValue>0 then
|
if ShiftValue>0 then
|
||||||
AsmL.InsertAfter(taicpu.op_const_reg(A_SHL, opsize, ShiftValue, taicpu(hp1).oper[1]^.reg),hp1);
|
begin
|
||||||
end;
|
hp2 := taicpu.op_const_reg(A_SHL, opsize, ShiftValue, taicpu(hp1).oper[1]^.reg);
|
||||||
|
AsmL.InsertAfter(hp2,hp1);
|
||||||
|
taicpu(hp2).fileinfo:=taicpu(hp1).fileinfo;
|
||||||
|
end;
|
||||||
|
Result := True;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user