Explorar o código

* fixed optimisation from r25067 for the generic case where a signed value
is converted to a larger unsigned value (e.g. OS_S16 -> OS_32)

git-svn-id: trunk@28251 -

Jonas Maebe %!s(int64=11) %!d(string=hai) anos
pai
achega
2c7a1b4e91
Modificáronse 1 ficheiros con 5 adicións e 5 borrados
  1. 5 5
      compiler/ncgcnv.pas

+ 5 - 5
compiler/ncgcnv.pas

@@ -120,12 +120,12 @@ interface
             { On targets without 8/16 bit register components, 8/16-bit operations
             { On targets without 8/16 bit register components, 8/16-bit operations
               always adjust high bits of result, see 'maybeadjustresult' method in
               always adjust high bits of result, see 'maybeadjustresult' method in
               respective cgcpu.pas. Therefore 8/16-bit locations are valid as larger
               respective cgcpu.pas. Therefore 8/16-bit locations are valid as larger
-              ones (except OS_S8->OS_16 which still needs high 16 bits cleared). }
+              ones (except signed->unsigned, which still needs high bits cleared). }
             else if (left.location.loc in [LOC_REGISTER,LOC_CREGISTER]) and
             else if (left.location.loc in [LOC_REGISTER,LOC_CREGISTER]) and
-              (tcgsize2size[(reg_cgsize(left.location.register))]=sizeof(aint)) and
-              (ressize>leftsize) and
-              (newsize in [OS_32,OS_S32,OS_16,OS_S16]) and
-              not ((newsize=OS_16) and (def_cgsize(left.resultdef)=OS_S8)) then
+               (tcgsize2size[(reg_cgsize(left.location.register))]=sizeof(aint)) and
+               (ressize>leftsize) and
+               (newsize in [OS_32,OS_S32,OS_16,OS_S16]) and
+               (not is_signed(left.resultdef) or is_signed(resultdef)) then
               location.size:=newsize
               location.size:=newsize
 {$endif}
 {$endif}
             else
             else