Parcourir la source

* generate sub instead of add from lea if appropriate

git-svn-id: trunk@25902 -
florian il y a 12 ans
Parent
commit
5eb578a44c
1 fichiers modifiés avec 10 ajouts et 2 suppressions
  1. 10 2
      compiler/i386/popt386.pas

+ 10 - 2
compiler/i386/popt386.pas

@@ -1055,8 +1055,16 @@ begin
                                   end
                                 else
                                   begin
-                                    taicpu(p).opcode := A_ADD;
-                                    taicpu(p).loadConst(0,l);
+                                    if (l<0) and (l<>$80000000) then
+                                      begin
+                                        taicpu(p).opcode := A_SUB;
+                                        taicpu(p).loadConst(0,-l);
+                                      end
+                                    else
+                                      begin
+                                        taicpu(p).opcode := A_ADD;
+                                        taicpu(p).loadConst(0,l);
+                                      end;
                                   end;
                               end;
                     end;