Procházet zdrojové kódy

powerpc: improved version of int_to_bool casting. now both also passes the improved version of tb0625

git-svn-id: trunk@35109 -
Károly Balogh před 8 roky
rodič
revize
1dd375cd61
1 změnil soubory, kde provedl 12 přidání a 27 odebrání
  1. 12 27
      compiler/ppcgen/ngppccnv.pas

+ 12 - 27
compiler/ppcgen/ngppccnv.pas

@@ -59,7 +59,7 @@ implementation
    uses
       verbose,globtype,globals,systems,
       symconst,symdef,aasmbase,aasmtai,aasmdata,
-      defutil,
+      defutil,cutils,
       cgbase,cgutils,pass_1,pass_2,
       ncgutil,procinfo,
       cpubase,aasmcpu,
@@ -91,34 +91,19 @@ implementation
               location_copy(location,left.location);
               newsize:=def_cgsize(resultdef);
               { change of size? change sign only if location is LOC_(C)REGISTER? Then we have to sign/zero-extend }
-              if (tcgsize2size[newsize]<>tcgsize2size[left.location.size]) or
+              if (tcgsize2size[newsize]>tcgsize2size[left.location.size]) or
                  ((newsize<>left.location.size) and (location.loc in [LOC_REGISTER,LOC_CREGISTER])) then
-                begin
-{$ifndef cpu64bitalu}
-                   if (left.location.size in [OS_64,OS_S64]) and (left.location.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then
-                     begin
-                       hreg1:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT);
-                       cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,left.location.reference,hreg1);
-                       hreg2:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT);
-                       href:=left.location.reference;
-                       inc(href.offset,4);
-                       cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,href,hreg2);
-                       cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList,OP_OR,OS_32,hreg1,hreg2,hreg1);
-                       if left.location.loc<>LOC_CREGISTER then
-                         location_reset(location,LOC_REGISTER,def_cgsize(resultdef))
-                       else
-                         location_reset(location,LOC_CREGISTER,def_cgsize(resultdef));
-                       location.register:=hreg1;
-                       { Release temp if it was a reference }
-                       if left.location.loc=LOC_REFERENCE then
-                         location_freetemp(current_asmdata.CurrAsmList,left.location);
-                     end
-                   else
-{$endif not cpu64bitalu}
-                     hlcg.location_force_reg(current_asmdata.CurrAsmList,location,left.resultdef,resultdef,true)
-                end
+                hlcg.location_force_reg(current_asmdata.CurrAsmList,location,left.resultdef,resultdef,true)
               else
-                location.size:=newsize;
+                begin
+                  location.size:=newsize;
+                  if (target_info.endian = ENDIAN_BIG) and
+                     (location.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then
+                    begin
+                      inc(location.reference.offset,TCGSize2Size[left.location.size]-TCGSize2Size[location.size]);
+                      location.reference.alignment:=newalignment(location.reference.alignment,TCGSize2Size[left.location.size]-TCGSize2Size[location.size]);
+                    end;
+                end;
               exit;
            end;