瀏覽代碼

+ use the or instruction to compare 32 bit values with 0

git-svn-id: trunk@31862 -
florian 9 年之前
父節點
當前提交
79619df936
共有 1 個文件被更改,包括 12 次插入4 次删除
  1. 12 4
      compiler/i8086/n8086add.pas

+ 12 - 4
compiler/i8086/n8086add.pas

@@ -886,10 +886,18 @@ interface
                end;
                end;
              LOC_CONSTANT :
              LOC_CONSTANT :
                begin
                begin
-                 current_asmdata.CurrAsmList.concat(taicpu.op_const_reg(A_CMP,S_W,aint((right.location.value shr 16) and $FFFF),GetNextReg(left.location.register)));
-                 firstjmp32bitcmp;
-                 current_asmdata.CurrAsmList.concat(taicpu.op_const_reg(A_CMP,S_W,aint(right.location.value and $FFFF),left.location.register));
-                 secondjmp32bitcmp;
+                 if (right.location.value=0) and (nodetype in [equaln,unequaln]) and (left.location.loc=LOC_REGISTER) then
+                   begin
+                     current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_OR,S_W,GetNextReg(left.location.register),left.location.register));
+                     secondjmp32bitcmp;
+                   end
+                 else
+                   begin
+                     current_asmdata.CurrAsmList.concat(taicpu.op_const_reg(A_CMP,S_W,aint((right.location.value shr 16) and $FFFF),GetNextReg(left.location.register)));
+                     firstjmp32bitcmp;
+                     current_asmdata.CurrAsmList.concat(taicpu.op_const_reg(A_CMP,S_W,aint(right.location.value and $FFFF),left.location.register));
+                     secondjmp32bitcmp;
+                   end;
                end;
                end;
              else
              else
                internalerror(200203282);
                internalerror(200203282);