Browse Source

* m68k/n68kadd.pas, t68kaddnode.second_cmpordinal:
for "CMP" it is important to note that the first operand (which can be basically a register, a constant or a reference) is substracted from the second operand (which needs to be a data register) and not the other way round

git-svn-id: trunk@22798 -

svenbarth 12 years ago
parent
commit
f0aad6dbc4
1 changed files with 6 additions and 6 deletions
  1. 6 6
      compiler/m68k/n68kadd.pas

+ 6 - 6
compiler/m68k/n68kadd.pas

@@ -307,7 +307,6 @@ implementation
       tmpreg : tregister;
       op : tasmop;
      begin
-//       writeln('second_cmpordinal');
        pass_left_right;
        { set result location }
        location_reset(location,LOC_JUMP,OS_NO);
@@ -359,19 +358,20 @@ implementation
         location.loc := LOC_FLAGS;
         location.resflags := getresflags(unsigned);
         op := A_CMP;
+        { Attention: The RIGHT(!) operand is substracted from and must be a
+                     register! }
         if (right.location.loc = LOC_CONSTANT) then
           if useconst then
-            current_asmdata.CurrAsmList.concat(taicpu.op_reg_const(op,S_L,
-              left.location.register,longint(right.location.value)))
+            current_asmdata.CurrAsmList.concat(taicpu.op_const_reg(op,S_L,
+              longint(right.location.value),left.location.register))
           else
             begin
               current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(op,S_L,
-                left.location.register,tmpreg));
-//              cg.ungetcpuregister(current_asmdata.CurrAsmList,tmpreg);
+                tmpreg,left.location.register));
             end
         else
           current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(op,S_L,
-            left.location.register,right.location.register));
+            right.location.register,left.location.register));
      end;
 
 {*****************************************************************************