Browse Source

* more packed set operand size problems fixed (include/exclude, mantis
#9167)

git-svn-id: trunk@7833 -

Jonas Maebe 18 years ago
parent
commit
26a4f693da
3 changed files with 34 additions and 19 deletions
  1. 1 0
      .gitattributes
  2. 7 19
      compiler/x86/nx86inl.pas
  3. 26 0
      tests/webtbs/tw9167.pp

+ 1 - 0
.gitattributes

@@ -8319,6 +8319,7 @@ tests/webtbs/tw9113.pp svneol=native#text/plain
 tests/webtbs/tw9128.pp svneol=native#text/plain
 tests/webtbs/tw9128.pp svneol=native#text/plain
 tests/webtbs/tw9139.pp svneol=native#text/plain
 tests/webtbs/tw9139.pp svneol=native#text/plain
 tests/webtbs/tw9139a.pp svneol=native#text/plain
 tests/webtbs/tw9139a.pp svneol=native#text/plain
+tests/webtbs/tw9167.pp svneol=native#text/plain
 tests/webtbs/ub1873.pp svneol=native#text/plain
 tests/webtbs/ub1873.pp svneol=native#text/plain
 tests/webtbs/ub1883.pp svneol=native#text/plain
 tests/webtbs/ub1883.pp svneol=native#text/plain
 tests/webtbs/uw0555.pp svneol=native#text/plain
 tests/webtbs/uw0555.pp svneol=native#text/plain

+ 7 - 19
compiler/x86/nx86inl.pas

@@ -475,10 +475,11 @@ implementation
             opsize:=OS_32;
             opsize:=OS_32;
           bitsperop:=(8*tcgsize2size[opsize]);
           bitsperop:=(8*tcgsize2size[opsize]);
           secondpass(tcallparanode(left).left);
           secondpass(tcallparanode(left).left);
-          if tcallparanode(tcallparanode(left).right).left.nodetype=ordconstn then
+          secondpass(tcallparanode(tcallparanode(left).right).left);
+          if tcallparanode(tcallparanode(left).right).left.location.loc=LOC_CONSTANT then
             begin
             begin
               { calculate bit position }
               { calculate bit position }
-              l:=1 shl (tordconstnode(tcallparanode(tcallparanode(left).right).left).value.svalue mod bitsperop);
+              l:=1 shl (tcallparanode(tcallparanode(left).right).left.location.value mod bitsperop);
 
 
               { determine operator }
               { determine operator }
               if inlinenumber=in_include_x_y then
               if inlinenumber=in_include_x_y then
@@ -492,7 +493,7 @@ implementation
                 LOC_REFERENCE :
                 LOC_REFERENCE :
                   begin
                   begin
                     inc(tcallparanode(left).left.location.reference.offset,
                     inc(tcallparanode(left).left.location.reference.offset,
-                      (tordconstnode(tcallparanode(tcallparanode(left).right).left).value.svalue div bitsperop)*tcgsize2size[opsize]);
+                      (tcallparanode(tcallparanode(left).right).left.location.value div bitsperop)*tcgsize2size[opsize]);
                     cg.a_op_const_ref(current_asmdata.CurrAsmList,cgop,opsize,l,tcallparanode(left).left.location.reference);
                     cg.a_op_const_ref(current_asmdata.CurrAsmList,cgop,opsize,l,tcallparanode(left).left.location.reference);
                   end;
                   end;
                 LOC_CREGISTER :
                 LOC_CREGISTER :
@@ -503,29 +504,16 @@ implementation
             end
             end
           else
           else
             begin
             begin
-              if opsize=OS_8 then
+              if opsize in [OS_8,OS_S8] then
                 opsize:=OS_32;
                 opsize:=OS_32;
-              { generate code for the element to set }
-              secondpass(tcallparanode(tcallparanode(left).right).left);
               { determine asm operator }
               { determine asm operator }
               if inlinenumber=in_include_x_y then
               if inlinenumber=in_include_x_y then
                  asmop:=A_BTS
                  asmop:=A_BTS
               else
               else
                  asmop:=A_BTR;
                  asmop:=A_BTR;
 
 
-              if tcallparanode(tcallparanode(left).right).left.location.loc in [LOC_CREGISTER,LOC_REGISTER] then
-                { we don't need a mod 32 because this is done automatically  }
-                { by the bts instruction. For proper checking we would       }
-
-                { note: bts doesn't do any mod'ing, that's why we can also use }
-                { it for normalsets! (JM)                                      }
-
-                { need a cmp and jmp, but this should be done by the         }
-                { type cast code which does range checking if necessary (FK) }
-                hregister:=cg.makeregsize(current_asmdata.CurrAsmList,Tcallparanode(Tcallparanode(left).right).left.location.register,opsize)
-              else
-                hregister:=cg.getintregister(current_asmdata.CurrAsmList,opsize);
-              cg.a_load_loc_reg(current_asmdata.CurrAsmList,opsize,tcallparanode(tcallparanode(left).right).left.location,hregister);
+              location_force_reg(current_asmdata.CurrAsmList,tcallparanode(tcallparanode(left).right).left.location,opsize,true);
+              hregister:=tcallparanode(tcallparanode(left).right).left.location.register;
               if (tcallparanode(left).left.location.loc=LOC_REFERENCE) then
               if (tcallparanode(left).left.location.loc=LOC_REFERENCE) then
                 emit_reg_ref(asmop,tcgsize2opsize[opsize],hregister,tcallparanode(left).left.location.reference)
                 emit_reg_ref(asmop,tcgsize2opsize[opsize],hregister,tcallparanode(left).left.location.reference)
               else
               else

+ 26 - 0
tests/webtbs/tw9167.pp

@@ -0,0 +1,26 @@
+type
+  TShiftStateEnum = (ssShift, ssAlt, ssCtrl,
+    ssLeft, ssRight, ssMiddle, ssDouble,
+    // Extra additions
+    ssMeta, ssSuper, ssHyper, ssAltGr, ssCaps, ssNum,
+    ssScroll,ssTriple,ssQuad);
+
+{$packset 1}
+  TShiftState = set of TShiftStateEnum;
+{$packset default}
+
+var
+  s: tshiftstate;
+  ss: tshiftstateenum;
+begin
+  s := [];
+  ss:=ssShift;
+  include(s,ss);
+  include(s,ssSuper);
+  if not(ssShift in s) or
+     not(ssSuper in s) then
+    halt(1);
+  if not(ss in s) then
+    halt(2);
+end.
+