Fix the last failing tcnvint test (plus another one) by using comparisons that are not necessarily 32-bit.

m68k/n68kadd.pas, tn68kadd.second_cmpordinal:
  * use the size of the largest operand to select a fiting operand
  * ToDo: check whether a sign/zero extend of the value is necessary

git-svn-id: trunk@25628 -
This commit is contained in:
svenbarth 2013-10-03 11:59:25 +00:00
parent 5af873ee5b
commit 8e60465eb4

View File

@ -546,12 +546,16 @@ implementation
unsigned : boolean;
useconst : boolean;
tmpreg : tregister;
op : tasmop;
opsize : topsize;
cmpsize : tcgsize;
begin
pass_left_right;
{ set result location }
location_reset(location,LOC_JUMP,OS_NO);
{ ToDo : set "allowconstants" to True, but this seems to upset Coldfire
a bit for the CMP instruction => check manual and implement
exception accordingly below }
{ load values into registers (except constants) }
force_reg_left_right(true, false);
@ -598,20 +602,30 @@ implementation
useconst := false;
location.loc := LOC_FLAGS;
location.resflags := getresflags(unsigned);
op := A_CMP;
if tcgsize2size[right.location.size]=tcgsize2size[left.location.size] then
cmpsize:=left.location.size
else
{ ToDo : zero/sign extend??? }
if tcgsize2size[right.location.size]<tcgsize2size[left.location.size] then
cmpsize:=left.location.size
else
cmpsize:=right.location.size;
opsize:=tcgsize2opsize[cmpsize];
if opsize=S_NO then
internalerror(2013090301);
{ Attention: The RIGHT(!) operand is substracted from and must be a
register! }
if (right.location.loc = LOC_CONSTANT) then
if useconst then
current_asmdata.CurrAsmList.concat(taicpu.op_const_reg(op,S_L,
current_asmdata.CurrAsmList.concat(taicpu.op_const_reg(A_CMP,opsize,
longint(right.location.value),left.location.register))
else
begin
current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(op,S_L,
current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMP,opsize,
tmpreg,left.location.register));
end
else
current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(op,S_L,
current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMP,opsize,
right.location.register,left.location.register));
end;