瀏覽代碼

* generate sub instead of add from lea if appropriate

git-svn-id: trunk@25902 -
florian 11 年之前
父節點
當前提交
5eb578a44c
共有 1 個文件被更改,包括 10 次插入2 次删除
  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;