* compile float*2 as float+float if possible as proposed by Rika, resolves #40116

This commit is contained in:
florian 2023-01-22 20:07:40 +01:00
parent ec28b7586c
commit 789031a6e6

View File

@ -1100,6 +1100,12 @@ implementation
begin
result:=right.getcopy;
exit;
end
else if (trealconstnode(left).value_real=2) and (nodetype=muln) and not(might_have_sideeffects(right,[mhs_exceptions])) and
(node_complexity(right)<=1) then
begin
result:=caddnode.create_internal(addn,right.getcopy,right.getcopy);
exit;
end;
end
else if rt=realconstn then
@ -1127,6 +1133,12 @@ implementation
begin
result:=left.getcopy;
exit;
end
else if (trealconstnode(right).value_real=2) and (nodetype=muln) and not(might_have_sideeffects(left,[mhs_exceptions])) and
(node_complexity(left)<=1) then
begin
result:=caddnode.create_internal(addn,left.getcopy,left.getcopy);
exit;
end;
end
{ optimize a/a and a-a }