瀏覽代碼

* fixes assembling of mov ax,<mem16>
* fixes assembling of test <mem8>,reg8; resolves #11786

git-svn-id: trunk@12040 -

florian 16 年之前
父節點
當前提交
49195b0ac0
共有 6 個文件被更改,包括 41 次插入7 次删除
  1. 1 0
      .gitattributes
  2. 1 1
      compiler/i386/i386nop.inc
  3. 10 3
      compiler/i386/i386tab.inc
  4. 3 2
      compiler/x86/x86ins.dat
  5. 1 1
      compiler/x86_64/x8664tab.inc
  6. 25 0
      tests/webtbs/tw11786.pp

+ 1 - 0
.gitattributes

@@ -8577,6 +8577,7 @@ tests/webtbs/tw11619.pp svneol=native#text/plain
 tests/webtbs/tw11711.pp svneol=native#text/plain
 tests/webtbs/tw11762.pp svneol=native#text/plain
 tests/webtbs/tw11763.pp svneol=native#text/plain
+tests/webtbs/tw11786.pp svneol=native#text/plain
 tests/webtbs/tw1181.pp svneol=native#text/plain
 tests/webtbs/tw11846a.pp svneol=native#text/plain
 tests/webtbs/tw11846b.pp svneol=native#text/plain

+ 1 - 1
compiler/i386/i386nop.inc

@@ -1,2 +1,2 @@
 { don't edit, this file is generated from x86ins.dat }
-1379;
+1380;

+ 10 - 3
compiler/i386/i386tab.inc

@@ -2936,10 +2936,17 @@
   (
     opcode  : A_MOV;
     ops     : 2;
-    optypes : (ot_reg_ax or ot_bits32,ot_mem_offs,ot_none);
-    code    : #213#193#1#161#29;
+    optypes : (ot_reg_ax,ot_mem_offs,ot_none);
+    code    : #212#193#1#161#29;
     flags   : if_8086 or if_sm or if_nox86_64
   ),
+  (
+    opcode  : A_MOV;
+    ops     : 2;
+    optypes : (ot_reg_eax,ot_mem_offs,ot_none);
+    code    : #213#193#1#161#29;
+    flags   : if_386 or if_sm or if_nox86_64
+  ),
   (
     opcode  : A_MOV;
     ops     : 2;
@@ -6346,7 +6353,7 @@
     opcode  : A_TEST;
     ops     : 2;
     optypes : (ot_regmem or ot_bits8,ot_reg8,ot_none);
-    code    : #193#211#1#132#72;
+    code    : #193#211#1#132#65;
     flags   : if_8086 or if_sm
   ),
   (

+ 3 - 2
compiler/x86/x86ins.dat

@@ -1017,7 +1017,8 @@ reg_eax,reg_ecx,reg_edx      \3\x0F\x01\xC8           PRESCOTT,ND
 (Ch_Wop2, Ch_Rop1, Ch_None)
 mem_offs,reg_ax|32    \300\320\1\xA3\34               8086,SM,NOX86_64
 regmem,reg16|32|64    \300\320\1\x89\101              8086,SM
-reg_ax|32,mem_offs    \325\301\1\xA1\35               8086,SM,NOX86_64
+reg_ax,mem_offs       \324\301\1\xA1\35               8086,SM,NOX86_64
+reg_eax,mem_offs      \325\301\1\xA1\35               386,SM,NOX86_64
 reg16|32|64,regmem    \301\320\1\x8B\110              8086,SM
 reg32|64,imm          \320\10\xB8\35                  386,SD
 rm32|64,imm           \300\320\1\xC7\200\41           386,SD
@@ -2025,7 +2026,7 @@ void                  \2\x0F\x07                      P6,PRIV,AMD
 regmem,reg16|32|64    \300\320\1\x85\101              8086,SM
 reg16|32|64,mem       \301\320\1\x85\110              8086,SM
 reg8,reg8             \300\323\1\x84\101              8086
-rm8,reg8              \301\323\1\x84\110              8086,SM
+rm8,reg8              \301\323\1\x84\101              8086,SM
 reg_eax,imm           \325\1\xA9\41                   386,SM
 reg_ax,imm            \324\1\xA9\31                   8086,SM
 reg_al,imm            \1\xA8\21                       8086,SM

+ 1 - 1
compiler/x86_64/x8664tab.inc

@@ -6290,7 +6290,7 @@
     opcode  : A_TEST;
     ops     : 2;
     optypes : (ot_regmem or ot_bits8,ot_reg8,ot_none);
-    code    : #193#211#1#132#72;
+    code    : #193#211#1#132#65;
     flags   : if_8086 or if_sm
   ),
   (

+ 25 - 0
tests/webtbs/tw11786.pp

@@ -0,0 +1,25 @@
+{ %cpu=i386 }
+var
+  w : word;
+  b1,b2,b3 : byte;
+begin
+  b1:=$aa;
+  b2:=$55;
+  b3:=$aa;
+{$asmmode intel}
+  asm
+    mov eax,$deadbeef
+    mov ax,w
+    shr eax,16
+    mov w,ax
+    mov bl,$55
+    lea edx,b2
+    test [edx],bl
+    setnz b1
+  end;
+  if w<>$dead then
+    halt(1);
+  if b1<>1 then
+    halt(1);
+  writeln('ok');
+end.