Browse Source

* generate sub instead of add from lea if appropriate

git-svn-id: trunk@25902 -
florian 11 years ago
parent
commit
5eb578a44c
1 changed files with 10 additions and 2 deletions
  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;