mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-11 21:29:42 +02:00
Fix incorrect AVR optimization.
git-svn-id: trunk@32441 -
This commit is contained in:
parent
1d72397c19
commit
baae6ec169
@ -180,7 +180,7 @@ Implementation
|
|||||||
A_LSL,A_LSR,
|
A_LSL,A_LSR,
|
||||||
A_OR,A_ORI,A_ROL,A_ROR])))) or
|
A_OR,A_ORI,A_ROL,A_ROR])))) or
|
||||||
(MatchInstruction(hp1, A_CPI) and
|
(MatchInstruction(hp1, A_CPI) and
|
||||||
(taicpu(p).opcode in [A_ANDI,A_ORI]) and
|
(taicpu(p).opcode = A_ANDI) and
|
||||||
(taicpu(p).oper[1]^.typ=top_const) and
|
(taicpu(p).oper[1]^.typ=top_const) and
|
||||||
(taicpu(hp1).oper[1]^.typ=top_const) and
|
(taicpu(hp1).oper[1]^.typ=top_const) and
|
||||||
(taicpu(p).oper[1]^.val=taicpu(hp1).oper[1]^.val))) and
|
(taicpu(p).oper[1]^.val=taicpu(hp1).oper[1]^.val))) and
|
||||||
@ -208,6 +208,10 @@ Implementation
|
|||||||
end;
|
end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we compare to the same value we are masking then invert the comparison
|
||||||
|
if (taicpu(hp1).opcode=A_CPI) then
|
||||||
|
taicpu(hp2).condition:=inverse_cond(taicpu(hp2).condition);
|
||||||
|
|
||||||
asml.InsertBefore(tai_regalloc.alloc(NR_DEFAULTFLAGS,p), p);
|
asml.InsertBefore(tai_regalloc.alloc(NR_DEFAULTFLAGS,p), p);
|
||||||
asml.InsertAfter(tai_regalloc.dealloc(NR_DEFAULTFLAGS,hp2), hp2);
|
asml.InsertAfter(tai_regalloc.dealloc(NR_DEFAULTFLAGS,hp2), hp2);
|
||||||
IncludeRegInUsedRegs(NR_DEFAULTFLAGS,UsedRegs);
|
IncludeRegInUsedRegs(NR_DEFAULTFLAGS,UsedRegs);
|
||||||
|
Loading…
Reference in New Issue
Block a user