浏览代码

m68k: instead of trying to mess with LOC_FLAGS, use LOC_REGISTER to return a boolean result of the compare. idea by Florian. fixes several issues with optimizer enabled and also results in better code in some cases.

git-svn-id: trunk@29709 -
Károly Balogh 10 年之前
父节点
当前提交
fdb09365ba
共有 1 个文件被更改,包括 4 次插入7 次删除
  1. 4 7
      compiler/m68k/n68kadd.pas

+ 4 - 7
compiler/m68k/n68kadd.pas

@@ -172,8 +172,6 @@ implementation
         case current_settings.fputype of
           fpu_68881:
             begin
-              location_reset(location,LOC_FLAGS,OS_NO);
-
               { force fpureg as location, left right doesn't matter
                 as both will be in a fpureg }
               hlcg.location_force_fpureg(current_asmdata.CurrAsmList,left.location,left.resultdef,true);
@@ -182,18 +180,17 @@ implementation
               // emit compare
               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));
+              ai.SetCondition(flags_to_cond(getresflags(false)));
               current_asmdata.CurrAsmList.concat(ai);
-              current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_TST,S_B,tmpreg));
-              location.resflags:=F_E;
+              current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_NEG,S_B,tmpreg));
 
+              location_reset(location,LOC_REGISTER,OS_8);
+              location.register:=tmpreg;
             end;
           else
             // softfpu should be handled in pass1, others are not yet supported...