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 -
This commit is contained in:
Károly Balogh 2015-02-15 13:41:40 +00:00
parent 46bfe5c1dd
commit c062e55aa2
5 changed files with 17 additions and 3 deletions

View File

@ -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;

View File

@ -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) }

View File

@ -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];

View File

@ -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;

View File

@ -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...