Browse Source

m68k: after a compare on the FPU, move the condition flags back to the CPU. this should make floating point compare actually working

git-svn-id: trunk@29704 -
Károly Balogh 10 years ago
parent
commit
c062e55aa2

+ 2 - 0
compiler/m68k/aasmcpu.pas

@@ -494,6 +494,8 @@ type
             begin end; { Do nothing, default operand_read is fine here. }
 
           // FPU opcodes
+          A_FSXX, A_FSEQ, A_FSNE, A_FSLT, A_FSLE, A_FSGT, A_FSGE:
+             result:=operand_write;
           A_FMOVE:
              if opnr=1 then
                result:=operand_write;

+ 1 - 1
compiler/m68k/ag68kgas.pas

@@ -239,7 +239,7 @@ interface
          A_SNE,A_SPL,A_ST,A_SVC,A_SVS,A_SF]) then
          s:=gas_op2str[op]
         else
-        if op = A_SXX then
+        if op in [A_SXX, A_FSXX] then
          s:=gas_op2str[op]+cond2str[taicpu(hp).condition]
         else
         { size of DBRA is always WORD, doesn't need opsize (KB) }

+ 1 - 1
compiler/m68k/cpubase.pas

@@ -89,7 +89,7 @@ unit cpubase;
          { (this may include 68040 mmu instructions)          }
          a_frestore,a_fsave,a_pflush,a_pflusha,a_pload,a_pmove,a_ptest,
          { useful for assembly language output }
-         a_label,a_dbxx,a_sxx,a_bxx,a_fbxx);
+         a_label,a_dbxx,a_sxx,a_bxx,a_fsxx,a_fbxx);
 
       {# This should define the array of instructions as string }
       op2strtable=array[tasmop] of string[11];

+ 1 - 1
compiler/m68k/itcpugas.pas

@@ -83,7 +83,7 @@ interface
          { (this may include 68040 mmu instructions)          }
          'frestore','fsave','pflush','pflusha','pload','pmove','ptest',
          { useful for assembly language output }
-         'label','db','s','b','fb');
+         'label','db','s','b','fs','fb');
 
     function gas_regnum_search(const s:string):Tregister;
     function gas_regname(r:Tregister):string;

+ 12 - 0
compiler/m68k/n68kadd.pas

@@ -161,6 +161,9 @@ implementation
 
 
     procedure t68kaddnode.second_cmpfloat;
+      var
+        tmpreg : tregister;
+        ai: taicpu;
       begin
         pass_left_right;
         if (nf_swapped in flags) then
@@ -180,6 +183,15 @@ implementation
               current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FCMP,S_FX,right.location.register,left.location.register));
 
               location.resflags:=getresflags(false);
+
+              // temporary(?) hack, move condition result back to the CPU from the FPU.
+              // 6888x has its own FBcc branch instructions and FScc flags->reg instruction,
+              // which we don't support yet in the rest of the cg. (KB)
+              tmpreg:=cg.getintregister(current_asmdata.CurrAsmList,OS_8);
+              ai:=taicpu.op_reg(A_FSxx,S_B,tmpreg);
+              ai.SetCondition(flags_to_cond(location.resflags));
+              current_asmdata.CurrAsmList.concat(ai);
+              current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_TST,S_B,tmpreg));
             end;
           else
             // softfpu should be handled in pass1, others are not yet supported...