Browse Source

* fixed not(qwordbool): take all 64 bits into account, not only the
lower 32 ones

git-svn-id: trunk@19920 -

Jonas Maebe 13 years ago
parent
commit
4d12a8b1ba
1 changed files with 13 additions and 2 deletions
  1. 13 2
      compiler/powerpc/nppcmat.pas

+ 13 - 2
compiler/powerpc/nppcmat.pas

@@ -634,7 +634,7 @@ end;
 
 
       var
       var
          hl : tasmlabel;
          hl : tasmlabel;
-
+         tmpreg: tregister;
       begin
       begin
          if is_boolean(resultdef) then
          if is_boolean(resultdef) then
           begin
           begin
@@ -668,7 +668,18 @@ end;
                   LOC_SUBSETREF, LOC_CSUBSETREF:
                   LOC_SUBSETREF, LOC_CSUBSETREF:
                     begin
                     begin
                       location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resultdef),true);
                       location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resultdef),true);
-                      current_asmdata.CurrAsmList.concat(taicpu.op_reg_const(A_CMPWI,left.location.register,0));
+                      tmpreg:=left.location.register;
+{$ifndef cpu64bitalu}
+                      { 64 bit pascal booleans have their truth value stored in
+                        the lower 32 bits; with cbools, it can be anywhere }
+                      if (left.location.size in [OS_64,OS_S64]) and
+                         not is_pasbool(left.resultdef) then
+                        begin
+                          tmpreg:=cg.getintregister(current_asmdata.CurrAsmList,OS_32);
+                          cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList,OP_OR,OS_32,left.location.register64.reglo,left.location.register64.reghi,tmpreg);
+                        end;
+{$endif not cpu64bitalu}
+                      current_asmdata.CurrAsmList.concat(taicpu.op_reg_const(A_CMPWI,tmpreg,0));
                       location_reset(location,LOC_FLAGS,OS_NO);
                       location_reset(location,LOC_FLAGS,OS_NO);
                       location.resflags.cr:=RS_CR0;
                       location.resflags.cr:=RS_CR0;
                       location.resflags.flag:=F_EQ;
                       location.resflags.flag:=F_EQ;