Переглянути джерело

* Fixed a_load_reg_reg for arm.
* Fixed sign/zero-extension in second_int_to_bool for all CPUs. x86 and pppc were not affected by this bug, but I fixed it for all CPUs for consistency.
* cg/tcnvint1 is passed on arm now.

git-svn-id: trunk@10669 -

yury 17 роки тому
батько
коміт
cf235145cb

+ 1 - 1
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

+ 6 - 3
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;

+ 7 - 4
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;
 }

+ 6 - 3
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;

+ 6 - 3
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;

+ 6 - 3
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;