Ver código fonte

m68k/cgcpu.pas, tcg64f68k:
+ a_op64_reg_reg: add support for "NEG" and "NOT" of 64-bit values
+ a_op64_const_reg: make sure that we know whether a NEG or NOT with a constant is performed

git-svn-id: trunk@22930 -

svenbarth 12 anos atrás
pai
commit
a4f390e4d9
1 arquivos alterados com 32 adições e 0 exclusões
  1. 32 0
      compiler/m68k/cgcpu.pas

+ 32 - 0
compiler/m68k/cgcpu.pas

@@ -1992,6 +1992,7 @@ unit cgcpu;
   var
    hreg1, hreg2 : tregister;
    opcode : tasmop;
+   instr : taicpu;
   begin
 //    writeln('a_op64_reg_reg');
     opcode := topcg2tasmop[op];
@@ -2047,6 +2048,34 @@ unit cgcpu;
             list.concat(taicpu.op_reg_reg(A_EOR,S_L,regsrc.reglo,regdst.reglo));
             list.concat(taicpu.op_reg_reg(A_EOR,S_L,regsrc.reghi,regdst.reghi));
         end;
+      OP_NEG:
+        begin
+          if isaddressregister(regdst.reglo) or
+              isaddressregister(regdst.reghi) then
+            internalerror(2012110402);
+          instr:=taicpu.op_reg_reg(A_MOVE,S_L,regsrc.reglo,regdst.reglo);
+          cg.add_move_instruction(instr);
+          list.concat(instr);
+          instr:=taicpu.op_reg_reg(A_MOVE,S_L,regsrc.reghi,regdst.reghi);
+          cg.add_move_instruction(instr);
+          list.concat(instr);
+          list.concat(taicpu.op_reg(A_NEG,S_L,regdst.reglo));
+          list.concat(taicpu.op_reg(A_NEGX,S_L,regdst.reghi));
+        end;
+      OP_NOT:
+        begin
+          if isaddressregister(regdst.reglo) or
+              isaddressregister(regdst.reghi) then
+            internalerror(2012110401);
+          instr:=taicpu.op_reg_reg(A_MOVE,S_L,regsrc.reglo,regdst.reglo);
+          cg.add_move_instruction(instr);
+          list.concat(instr);
+          instr:=taicpu.op_reg_reg(A_MOVE,S_L,regsrc.reghi,regdst.reghi);
+          cg.add_move_instruction(instr);
+          list.concat(instr);
+          list.concat(taicpu.op_reg(A_NOT,S_L,regdst.reglo));
+          list.concat(taicpu.op_reg(A_NOT,S_L,regdst.reghi));
+        end;
     end; { end case }
   end;
 
@@ -2104,6 +2133,9 @@ unit cgcpu;
             list.concat(taicpu.op_const_reg(A_EOR,S_L,lowvalue,regdst.reglo));
             list.concat(taicpu.op_const_reg(A_EOR,S_L,highvalue,regdst.reghi));
         end;
+      { these should have been handled already by earlier passes }
+      OP_NOT, OP_NEG:
+        internalerror(2012110403);
     end; { end case }
   end;