From f3801d13de23530be68c64aa8e15033c621631ef Mon Sep 17 00:00:00 2001 From: sergei Date: Thu, 17 Apr 2014 14:15:45 +0000 Subject: [PATCH] * SPARC: cleaned up and actualized TAsmCond (stuff copy-pasted from x86 removed, conditions for unordered floating-point comparisons added). Fixes Mantis #9362 on this target. git-svn-id: trunk@27593 - --- compiler/sparc/cgcpu.pas | 2 +- compiler/sparc/cpubase.pas | 44 +++++++++++++++++++++----------------- compiler/sparc/ncpumat.pas | 2 +- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/compiler/sparc/cgcpu.pas b/compiler/sparc/cgcpu.pas index 3fa41146d7..09cc1b4476 100644 --- a/compiler/sparc/cgcpu.pas +++ b/compiler/sparc/cgcpu.pas @@ -970,7 +970,7 @@ implementation pasbool8,pasbool16,pasbool32,pasbool64]))) then begin ai:=TAiCpu.Op_sym(A_Bxx,hl); - ai.SetCondition(C_NO); + ai.SetCondition(C_VC); list.Concat(ai); { Delay slot } list.Concat(TAiCpu.Op_none(A_NOP)); diff --git a/compiler/sparc/cpubase.pas b/compiler/sparc/cpubase.pas index 35ee0be093..f9749baba4 100644 --- a/compiler/sparc/cpubase.pas +++ b/compiler/sparc/cpubase.pas @@ -97,24 +97,28 @@ uses type TAsmCond=(C_None, - C_A,C_AE,C_B,C_BE,C_C,C_E,C_G,C_GE,C_L,C_LE,C_NA,C_NAE, - C_NB,C_NBE,C_NC,C_NE,C_NG,C_NGE,C_NL,C_NLE,C_NO,C_NP, - C_NS,C_NZ,C_O,C_P,C_PE,C_PO,C_S,C_Z, - C_FE,C_FG,C_FL,C_FGE,C_FLE,C_FNE + C_A,C_AE,C_B,C_BE, + C_G,C_GE,C_L,C_LE, + C_E,C_NE, + C_POS,C_NEG,C_VC,C_VS, + C_FE,C_FG,C_FL,C_FGE,C_FLE,C_FNE, + C_FU,C_FUG,C_FUL,C_FUGE,C_FULE,C_FO,C_FUE,C_FLG ); const firstIntCond=C_A; - lastIntCond=C_Z; + lastIntCond=C_VS; firstFloatCond=C_FE; lastFloatCond=C_FNE; - floatAsmConds=[C_FE..C_FNE]; + floatAsmConds=[C_FE..C_FLG]; cond2str:array[TAsmCond] of string[3]=('', - 'gu','cc','cs','leu','cs','e','g','ge','l','le','leu','cs', - 'cc','gu','cc','ne','le','l','ge','g','vc','XX', - 'pos','ne','vs','XX','XX','XX','vs','e', - 'e','g','l','ge','le','ne' + 'gu','cc','cs','leu', + 'g','ge','l','le', + 'e','ne', + 'pos','neg','vc','vs', + 'e','g','l','ge','le','ne', + 'u','ug','ul','uge','ule','o','ue','lg' ); @@ -132,11 +136,9 @@ uses F_GE, {Greater or Equal} F_LE, {Less or Equal} F_A, {Above} - F_AE, {Above or Equal} - F_B, {Below} + F_AE, {Above or Equal, synonym: Carry Clear} + F_B, {Below, synonym: Carry Set} F_BE, {Below or Equal} - F_C, {Carry} - F_NC, {Not Carry} { Floating point results } F_FE, {Equal} F_FNE, {Not Equal} @@ -325,7 +327,7 @@ implementation procedure inverse_flags(var f: TResFlags); const inv_flags: array[TResFlags] of TResFlags = - (F_NE,F_E,F_LE,F_GE,F_L,F_G,F_BE,F_B,F_AE,F_A,F_NC,F_C, + (F_NE,F_E,F_LE,F_GE,F_L,F_G,F_BE,F_B,F_AE,F_A, F_FNE,F_FE,F_FLE,F_FGE,F_FL,F_FG); begin f:=inv_flags[f]; @@ -335,7 +337,7 @@ implementation function flags_to_cond(const f:TResFlags):TAsmCond; const flags_2_cond:array[TResFlags] of TAsmCond= - (C_E,C_NE,C_G,C_L,C_GE,C_LE,C_A,C_AE,C_B,C_BE,C_C,C_NC, + (C_E,C_NE,C_G,C_L,C_GE,C_LE,C_A,C_AE,C_B,C_BE, C_FE,C_FNE,C_FG,C_FL,C_FGE,C_FLE); begin result:=flags_2_cond[f]; @@ -432,10 +434,12 @@ implementation function inverse_cond(const c: TAsmCond): TAsmCond; {$ifdef USEINLINE}inline;{$endif USEINLINE} const inverse: array[TAsmCond] of TAsmCond=(C_None, - C_NA,C_NAE,C_NB,C_NBE,C_NC,C_NE,C_NG,C_NGE,C_NL,C_NLE,C_A,C_AE, - C_B,C_BE,C_C,C_E,C_G,C_GE,C_L,C_LE,C_O,C_P, - C_S,C_Z,C_NO,C_NP,C_NP,C_P,C_NS,C_NZ, - C_FNE,C_FLE,C_FGE,C_FL,C_FG,C_FE + C_BE,C_B,C_AE,C_A, + C_LE,C_L,C_GE,C_G, + C_NE,C_E, + C_NEG,C_POS,C_VS,C_VC, + C_FNE,C_FULE,C_FUGE,C_FUL,C_FUG,C_FE, + C_FO,C_FLE,C_FGE,C_FL,C_FG,C_FU,C_FLG,C_FUE ); begin result := inverse[c]; diff --git a/compiler/sparc/ncpumat.pas b/compiler/sparc/ncpumat.pas index 79a70879b9..6b84a67c53 100644 --- a/compiler/sparc/ncpumat.pas +++ b/compiler/sparc/ncpumat.pas @@ -148,7 +148,7 @@ implementation if (nodetype = modn) then begin current_asmdata.getjumplabel(overflowlabel); - ai:=taicpu.op_cond_sym(A_Bxx,C_O,overflowlabel); + ai:=taicpu.op_cond_sym(A_Bxx,C_VS,overflowlabel); ai.delayslot_annulled:=true; current_asmdata.CurrAsmList.concat(ai); current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_NOT,resultreg));