Преглед изворни кода

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

florian пре 2 година
родитељ
комит
789031a6e6
1 измењених фајлова са 12 додато и 0 уклоњено
  1. 12 0
      compiler/nadd.pas

+ 12 - 0
compiler/nadd.pas

@@ -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 }