Sfoglia il codice sorgente

* last commit was wrong

florian 3 anni fa
parent
commit
d9cb4be507
1 ha cambiato i file con 18 aggiunte e 14 eliminazioni
  1. 18 14
      compiler/i8086/cgcpu.pas

+ 18 - 14
compiler/i8086/cgcpu.pas

@@ -1244,36 +1244,40 @@ unit cgcpu;
 
     procedure tcg8086.a_op_ref(list: TAsmList; Op: TOpCG; size: TCGSize; const ref: TReference);
       var
-        tmpref  : treference;
-        op1, op2: TAsmOp;
+        tmpref: treference;
       begin
         tmpref:=ref;
         make_simple_ref(list,tmpref);
-        check_register_size(size,reg);
 
         if size in [OS_64, OS_S64] then
-          internalerror(2013030906);
+          internalerror(2013050805);
 
         if size in [OS_32, OS_S32] then
           begin
             case op of
-              OP_ADD,OP_SUB,OP_XOR,OP_OR,OP_AND:
+              OP_NEG:
                 begin
-                  get_32bit_ops(op, op1, op2);
-                  if op in [OP_ADD,OP_SUB] then
-                    cg.a_reg_alloc(list,NR_DEFAULTFLAGS);
-                  list.concat(taicpu.op_ref_reg(op1, S_W, tmpref, reg));
                   inc(tmpref.offset, 2);
-                  list.concat(taicpu.op_ref_reg(op2, S_W, tmpref, GetNextReg(reg)));
-                  if op in [OP_ADD,OP_SUB] then
-                    cg.a_reg_dealloc(list,NR_DEFAULTFLAGS);
+                  list.concat(taicpu.op_ref(A_NOT, S_W, tmpref));
+                  dec(tmpref.offset, 2);
+                  cg.a_reg_alloc(list,NR_DEFAULTFLAGS);
+                  list.concat(taicpu.op_ref(A_NEG, S_W, tmpref));
+                  inc(tmpref.offset, 2);
+                  list.concat(taicpu.op_const_ref(A_SBB, S_W,-1, tmpref));
+                  cg.a_reg_dealloc(list,NR_DEFAULTFLAGS);
+                end;
+              OP_NOT:
+                begin
+                  list.concat(taicpu.op_ref(A_NOT, S_W, tmpref));
+                  inc(tmpref.offset, 2);
+                  list.concat(taicpu.op_ref(A_NOT, S_W, tmpref));
                 end;
               else
-                internalerror(2013050701);
+                internalerror(2020050709);
             end;
           end
         else
-          inherited a_op_ref_reg(list,Op,size,tmpref,reg);
+          inherited;
       end;