mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 06:06:17 +02:00
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:
parent
5af873ee5b
commit
8e60465eb4
@ -546,12 +546,16 @@ implementation
|
|||||||
unsigned : boolean;
|
unsigned : boolean;
|
||||||
useconst : boolean;
|
useconst : boolean;
|
||||||
tmpreg : tregister;
|
tmpreg : tregister;
|
||||||
op : tasmop;
|
opsize : topsize;
|
||||||
|
cmpsize : tcgsize;
|
||||||
begin
|
begin
|
||||||
pass_left_right;
|
pass_left_right;
|
||||||
{ set result location }
|
{ set result location }
|
||||||
location_reset(location,LOC_JUMP,OS_NO);
|
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) }
|
{ load values into registers (except constants) }
|
||||||
force_reg_left_right(true, false);
|
force_reg_left_right(true, false);
|
||||||
|
|
||||||
@ -598,20 +602,30 @@ implementation
|
|||||||
useconst := false;
|
useconst := false;
|
||||||
location.loc := LOC_FLAGS;
|
location.loc := LOC_FLAGS;
|
||||||
location.resflags := getresflags(unsigned);
|
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
|
{ Attention: The RIGHT(!) operand is substracted from and must be a
|
||||||
register! }
|
register! }
|
||||||
if (right.location.loc = LOC_CONSTANT) then
|
if (right.location.loc = LOC_CONSTANT) then
|
||||||
if useconst 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))
|
longint(right.location.value),left.location.register))
|
||||||
else
|
else
|
||||||
begin
|
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));
|
tmpreg,left.location.register));
|
||||||
end
|
end
|
||||||
else
|
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));
|
right.location.register,left.location.register));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user