mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-26 13:09:09 +02:00
* at -O3 optimization level, convert "i:=not i" and "i:=-i" to the new
in_not_assign_x and in_neg_assign_x inline nodes, which may generate better code on certain cpus (such as x86) git-svn-id: trunk@35758 -
This commit is contained in:
parent
9187825e3a
commit
3616627d0b
@ -668,6 +668,31 @@ implementation
|
|||||||
taddnode(right).left:=nil;
|
taddnode(right).left:=nil;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
{ replace i:=not i by in_not_assign_x(i)
|
||||||
|
i:=-i by in_neg_assign_x(i)
|
||||||
|
todo: for some integer types, there are extra implicit
|
||||||
|
typecasts inserted by the compiler; this code should be
|
||||||
|
updated to handle them as well }
|
||||||
|
if (right.nodetype in [notn,unaryminusn]) and
|
||||||
|
(tunarynode(right).left.isequal(left)) and
|
||||||
|
|
||||||
|
is_integer(tunarynode(right).left.resultdef) and
|
||||||
|
|
||||||
|
((localswitches*[cs_check_overflow,cs_check_range])=[]) and
|
||||||
|
((right.localswitches*[cs_check_overflow,cs_check_range])=[]) and
|
||||||
|
valid_for_var(tunarynode(right).left,false) and
|
||||||
|
not(might_have_sideeffects(tunarynode(right).left)) then
|
||||||
|
begin
|
||||||
|
if right.nodetype=notn then
|
||||||
|
newinlinenodetype:=in_not_assign_x
|
||||||
|
else
|
||||||
|
newinlinenodetype:=in_neg_assign_x;
|
||||||
|
result:=cinlinenode.createintern(
|
||||||
|
newinlinenodetype,false,tunarynode(right).left);
|
||||||
|
left:=nil;
|
||||||
|
tunarynode(right).left:=nil;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user