summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Johnson <peter@tortall.net>2010-08-14 02:26:41 +0000
committerPeter Johnson <peter@tortall.net>2010-08-14 02:26:41 +0000
commit2678cb3c3a42b3870a209ed8de38c1a16449695a (patch)
tree816f9173882dc0c7151ae80d71633b4522e56c17
parent3ef8f426d735678d3679c76b4b98aa77e5d0e034 (diff)
downloadyasm-2678cb3c3a42b3870a209ed8de38c1a16449695a.tar.gz
gas: Fix movsw/movzw memory operand encodings.
The register versions worked okay due to size matching, but the memory versions relied on suffix matching, which wasn't being generated correctly. Reported by: Tony Goelz <cag@absoft.com> svn path=/trunk/yasm/; revision=2358
-rwxr-xr-xmodules/arch/x86/gen_x86_insn.py4
-rw-r--r--modules/arch/x86/tests/gas64/gas-movsxs.asm14
-rw-r--r--modules/arch/x86/tests/gas64/gas-movsxs.hex124
3 files changed, 127 insertions, 15 deletions
diff --git a/modules/arch/x86/gen_x86_insn.py b/modules/arch/x86/gen_x86_insn.py
index d04601e4..56af2735 100755
--- a/modules/arch/x86/gen_x86_insn.py
+++ b/modules/arch/x86/gen_x86_insn.py
@@ -560,11 +560,13 @@ def finalize_insns():
keyword = name
else:
keyword = name+suffix
+ keyword = keyword.lower()
if keyword in gas_insns:
raise ValueError("duplicate gas instruction %s" %
keyword)
newinsn = insn.copy()
- newinsn.suffix = suffix
+ if insn.suffix is None:
+ newinsn.suffix = suffix
newinsn.auto_cpu("gas")
newinsn.auto_misc_flags("gas")
gas_insns[keyword] = newinsn
diff --git a/modules/arch/x86/tests/gas64/gas-movsxs.asm b/modules/arch/x86/tests/gas64/gas-movsxs.asm
index 1aa1e97e..7216a8ca 100644
--- a/modules/arch/x86/tests/gas64/gas-movsxs.asm
+++ b/modules/arch/x86/tests/gas64/gas-movsxs.asm
@@ -16,3 +16,17 @@ movzbw %al, %ax
movzwl %ax, %eax
movzbq %al, %rax
movzwq %ax, %rax
+
+movsbw 5,%ax
+movsbl 5,%eax
+movswl 5,%eax
+movsbq 5,%rax
+movswq 5,%rax
+movsx 5,%eax
+movzbw 5,%ax
+movzbl 5,%eax
+movzwl 5,%eax
+movzbq 5,%rax
+movzwq 5,%rax
+movzx 5,%eax
+
diff --git a/modules/arch/x86/tests/gas64/gas-movsxs.hex b/modules/arch/x86/tests/gas64/gas-movsxs.hex
index dc1dfd30..50abeba2 100644
--- a/modules/arch/x86/tests/gas64/gas-movsxs.hex
+++ b/modules/arch/x86/tests/gas64/gas-movsxs.hex
@@ -38,8 +38,8 @@
00
00
00
-e0
-00
+40
+01
00
00
00
@@ -101,6 +101,110 @@ c0
0f
b7
c0
+66
+0f
+be
+04
+25
+05
+00
+00
+00
+0f
+be
+04
+25
+05
+00
+00
+00
+0f
+bf
+04
+25
+05
+00
+00
+00
+48
+0f
+be
+04
+25
+05
+00
+00
+00
+48
+0f
+bf
+04
+25
+05
+00
+00
+00
+0f
+be
+04
+25
+05
+00
+00
+00
+66
+0f
+b6
+04
+25
+05
+00
+00
+00
+0f
+b6
+04
+25
+05
+00
+00
+00
+0f
+b7
+04
+25
+05
+00
+00
+00
+48
+0f
+b6
+04
+25
+05
+00
+00
+00
+48
+0f
+b7
+04
+25
+05
+00
+00
+00
+0f
+b6
+04
+25
+05
+00
+00
+00
+00
+00
00
00
2e
@@ -278,14 +382,6 @@ ff
00
00
00
-00
-00
-00
-00
-00
-00
-00
-00
17
00
00
@@ -310,7 +406,7 @@ ff
00
00
00
-68
+d0
00
00
00
@@ -374,7 +470,7 @@ ff
00
00
00
-8c
+f4
00
00
00
@@ -438,7 +534,7 @@ ff
00
00
00
-90
+f8
00
00
00
@@ -510,7 +606,7 @@ ff
00
00
00
-27
+8d
00
00
00