diff --git a/compiler/arm/cgcpu.pas b/compiler/arm/cgcpu.pas index 53e6753b57..2d7f65d902 100644 --- a/compiler/arm/cgcpu.pas +++ b/compiler/arm/cgcpu.pas @@ -1033,7 +1033,7 @@ unit cgcpu; instr: taicpu; begin conv_done:=false; - if tcgsize2size[tosize]<>tcgsize2size[fromsize] then + if tosize<>fromsize then begin shifterop_reset(so); if not do_conv(tosize) then diff --git a/compiler/arm/narmcnv.pas b/compiler/arm/narmcnv.pas index 0e0d0b23ff..fa17de0fc6 100644 --- a/compiler/arm/narmcnv.pas +++ b/compiler/arm/narmcnv.pas @@ -181,6 +181,7 @@ implementation href : treference; resflags : tresflags; hlabel,oldTrueLabel,oldFalseLabel : tasmlabel; + newsize : tcgsize; begin oldTrueLabel:=current_procinfo.CurrTrueLabel; oldFalseLabel:=current_procinfo.CurrFalseLabel; @@ -197,12 +198,14 @@ implementation not(left.location.loc in [LOC_FLAGS,LOC_JUMP]) then begin location_copy(location,left.location); - location.size:=def_cgsize(resultdef); + newsize:=def_cgsize(resultdef); { change of sign? Then we have to sign/zero-extend in } { case of a loc_(c)register } - if (location.size<>left.location.size) and + if (newsize<>left.location.size) and (location.loc in [LOC_REGISTER,LOC_CREGISTER]) then - location_force_reg(current_asmdata.CurrAsmList,location,location.size,true); + location_force_reg(current_asmdata.CurrAsmList,location,newsize,true) + else + location.size:=newsize; current_procinfo.CurrTrueLabel:=oldTrueLabel; current_procinfo.CurrFalseLabel:=oldFalseLabel; exit; diff --git a/compiler/m68k/n68kcnv.pas b/compiler/m68k/n68kcnv.pas index a1eb6bb08c..72856f3ad6 100644 --- a/compiler/m68k/n68kcnv.pas +++ b/compiler/m68k/n68kcnv.pas @@ -159,6 +159,7 @@ implementation hreg2 : tregister; resflags : tresflags; opsize : tcgsize; + newsize : tcgsize; begin secondpass(left); @@ -171,13 +172,15 @@ implementation not(left.location.loc in [LOC_FLAGS,LOC_JUMP]) then begin location_copy(location,left.location); - location.size:=def_cgsize(resultdef); + newsize:=def_cgsize(resultdef); { change of sign? Then we have to sign/zero-extend in } { case of a loc_(c)register } - if (location.size<>left.location.size) and + if (newsize<>left.location.size) and (location.loc in [LOC_REGISTER,LOC_CREGISTER]) then - location_force_reg(current_asmdata.CurrAsmList,location,location.size,true); -{ ACTIVATE when loc_jump support is added + location_force_reg(current_asmdata.CurrAsmList,location,newsize,true) + else + location.size:=newsize; +{ ACTIVATE when loc_jump support is added current_procinfo.CurrTrueLabel:=oldTrueLabel; current_procinfo.CurrFalseLabel:=oldFalseLabel; } diff --git a/compiler/ppcgen/ngppccnv.pas b/compiler/ppcgen/ngppccnv.pas index dba79230f6..d8c0af1fb9 100644 --- a/compiler/ppcgen/ngppccnv.pas +++ b/compiler/ppcgen/ngppccnv.pas @@ -76,6 +76,7 @@ implementation resflags : tresflags; opsize : tcgsize; hlabel, oldTrueLabel, oldFalseLabel : tasmlabel; + newsize : tcgsize; begin oldTrueLabel:=current_procinfo.CurrTrueLabel; oldFalseLabel:=current_procinfo.CurrFalseLabel; @@ -92,12 +93,14 @@ implementation not(left.location.loc in [LOC_FLAGS,LOC_JUMP]) then begin location_copy(location,left.location); - location.size:=def_cgsize(resultdef); + newsize:=def_cgsize(resultdef); { change of sign? Then we have to sign/zero-extend in } { case of a loc_(c)register } - if (location.size<>left.location.size) and + if (newsize<>left.location.size) and (location.loc in [LOC_REGISTER,LOC_CREGISTER]) then - location_force_reg(current_asmdata.CurrAsmList,location,location.size,true); + location_force_reg(current_asmdata.CurrAsmList,location,newsize,true) + else + location.size:=newsize; current_procinfo.CurrTrueLabel:=oldTrueLabel; current_procinfo.CurrFalseLabel:=oldFalseLabel; exit; diff --git a/compiler/sparc/ncpucnv.pas b/compiler/sparc/ncpucnv.pas index 4542e38f8e..501f5f90b4 100644 --- a/compiler/sparc/ncpucnv.pas +++ b/compiler/sparc/ncpucnv.pas @@ -224,6 +224,7 @@ implementation resflags : tresflags; opsize : tcgsize; hlabel,oldTrueLabel,oldFalseLabel : tasmlabel; + newsize : tcgsize; begin oldTrueLabel:=current_procinfo.CurrTrueLabel; oldFalseLabel:=current_procinfo.CurrFalseLabel; @@ -240,12 +241,14 @@ implementation not(left.location.loc in [LOC_FLAGS,LOC_JUMP]) then begin location_copy(location,left.location); - location.size:=def_cgsize(resultdef); + newsize:=def_cgsize(resultdef); { change of sign? Then we have to sign/zero-extend in } { case of a loc_(c)register } - if (location.size<>left.location.size) and + if (newsize<>left.location.size) and (location.loc in [LOC_REGISTER,LOC_CREGISTER]) then - location_force_reg(current_asmdata.CurrAsmList,location,location.size,true); + location_force_reg(current_asmdata.CurrAsmList,location,newsize,true) + else + location.size:=newsize; current_procinfo.CurrTrueLabel:=oldTrueLabel; current_procinfo.CurrFalseLabel:=oldFalseLabel; exit; diff --git a/compiler/x86/nx86cnv.pas b/compiler/x86/nx86cnv.pas index 0680f921eb..cb5b04a9b5 100644 --- a/compiler/x86/nx86cnv.pas +++ b/compiler/x86/nx86cnv.pas @@ -94,6 +94,7 @@ implementation {$endif not cpu64bitalu} resflags : tresflags; hlabel,oldTrueLabel,oldFalseLabel : tasmlabel; + newsize : tcgsize; begin oldTrueLabel:=current_procinfo.CurrTrueLabel; oldFalseLabel:=current_procinfo.CurrFalseLabel; @@ -109,12 +110,14 @@ implementation not(left.location.loc in [LOC_FLAGS,LOC_JUMP]) then begin location_copy(location,left.location); - location.size:=def_cgsize(resultdef); + newsize:=def_cgsize(resultdef); { change of sign? Then we have to sign/zero-extend in } { case of a loc_(c)register } - if (location.size<>left.location.size) and + if (newsize<>left.location.size) and (location.loc in [LOC_REGISTER,LOC_CREGISTER]) then - location_force_reg(current_asmdata.CurrAsmList,location,location.size,true); + location_force_reg(current_asmdata.CurrAsmList,location,newsize,true) + else + location.size:=newsize; current_procinfo.CurrTrueLabel:=oldTrueLabel; current_procinfo.CurrFalseLabel:=oldFalseLabel; exit;