+ generic a_cmp_const_reg_label

git-svn-id: branches/avr@17294 -
This commit is contained in:
florian 2011-04-10 18:52:37 +00:00
parent ebe8078263
commit 8cfbb70326
2 changed files with 61 additions and 7 deletions

View File

@ -1071,8 +1071,55 @@ unit cgcpu;
{ comparison operations }
procedure tcgavr.a_cmp_const_reg_label(list : TAsmList;size : tcgsize;
cmp_op : topcmp;a : aint;reg : tregister;l : tasmlabel);
var
swapped : boolean;
tmpreg : tregister;
i : byte;
begin
{ TODO : a_cmp_const_reg_label }
if a=0 then
begin
{ swap parameters? }
case cmp_op of
OC_GT:
begin
swapped:=true;
cmp_op:=OC_LT;
end;
OC_LTE:
begin
swapped:=true;
cmp_op:=OC_GTE;
end;
OC_BE:
begin
swapped:=true;
cmp_op:=OC_AE;
end;
OC_A:
begin
swapped:=true;
cmp_op:=OC_A;
end;
end;
if swapped then
list.concat(taicpu.op_reg_reg(A_CP,reg,NR_R1))
else
list.concat(taicpu.op_reg_reg(A_CP,NR_R1,reg));
for i:=2 to tcgsize2size[size] do
begin
reg:=GetNextReg(reg);
if swapped then
list.concat(taicpu.op_reg_reg(A_CPC,reg,NR_R1))
else
list.concat(taicpu.op_reg_reg(A_CPC,NR_R1,reg));
end;
a_jmp_cond(list,cmp_op,l);
end
else
inherited a_cmp_const_reg_label(list,size,cmp_op,a,reg,l);
end;

View File

@ -346,7 +346,7 @@ unit cgobj;
{ comparison operations }
procedure a_cmp_const_reg_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;a : aint;reg : tregister;
l : tasmlabel);virtual; abstract;
l : tasmlabel); virtual;
procedure a_cmp_const_ref_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;a : aint;const ref : treference;
l : tasmlabel); virtual;
procedure a_cmp_const_loc_label(list: TAsmList; size: tcgsize;cmp_op: topcmp; a: aint; const loc: tlocation;
@ -3053,12 +3053,21 @@ implementation
end;
procedure tcg.a_cmp_const_ref_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;a : aint;const ref : treference;
l : tasmlabel);
procedure tcg.a_cmp_const_reg_label(list: TAsmList; size: tcgsize;
cmp_op: topcmp; a: aint; reg: tregister; l: tasmlabel);
var
tmpreg: tregister;
begin
tmpreg:=getintregister(list,size);
a_load_const_reg(list,size,a,tmpreg);
a_cmp_reg_reg_label(list,size,cmp_op,tmpreg,reg,l);
end;
procedure tcg.a_cmp_const_ref_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;a : aint;const ref : treference;
l : tasmlabel);
var
tmpreg: tregister;
begin
tmpreg:=getintregister(list,size);
a_load_ref_reg(list,size,size,ref,tmpreg);
@ -3068,10 +3077,8 @@ implementation
procedure tcg.a_cmp_const_loc_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;a : aint;const loc : tlocation;
l : tasmlabel);
var
tmpreg : tregister;
begin
case loc.loc of
LOC_REGISTER,LOC_CREGISTER: