Browse Source
movsxd is a 64-bit only instruction. It supports both 16-bit and 32-bit destination registers. Its AT&T mnemonic is movslq which only supports 64-bit destination register. There is also a discrepancy between AMD64 and Intel64 on movsxd with 16-bit destination register. AMD64 supports 32-bit source operand and Intel64 supports 16-bit source operand. This patch updates movsxd encoding and decoding to alow 16-bit and 32-bit destination registers. It also handles movsxd with 16-bit destination register for AMD64 and Intel 64. gas/ PR binutils/25445 * config/tc-i386.c (check_long_reg): Also convert to QWORD for movsxd. * doc/c-i386.texi: Add a node for AMD64 vs. Intel64 ISA differences. Document movslq and movsxd. * testsuite/gas/i386/i386.exp: Run PR binutils/25445 tests. * testsuite/gas/i386/x86-64-movsxd-intel.d: New file. * testsuite/gas/i386/x86-64-movsxd-intel64-intel.d: Likewise. * testsuite/gas/i386/x86-64-movsxd-intel64-inval.l: Likewise. * testsuite/gas/i386/x86-64-movsxd-intel64-inval.s: Likewise. * testsuite/gas/i386/x86-64-movsxd-intel64.d: Likewise. * testsuite/gas/i386/x86-64-movsxd-intel64.s: Likewise. * testsuite/gas/i386/x86-64-movsxd-inval.l: Likewise. * testsuite/gas/i386/x86-64-movsxd-inval.s: Likewise. * testsuite/gas/i386/x86-64-movsxd.d: Likewise. * testsuite/gas/i386/x86-64-movsxd.s: Likewise. opcodes/ PR binutils/25445 * i386-dis.c (MOVSXD_Fixup): New function. (movsxd_mode): New enum. (x86_64_table): Use MOVSXD_Fixup and movsxd_mode on movsxd. (intel_operand_size): Handle movsxd_mode. (OP_E_register): Likewise. (OP_G): Likewise. * i386-opc.tbl: Remove Rex64 and allow 32-bit destination register on movsxd. Add movsxd with 16-bit destination register for AMD64 and Intel64 ISAs. * i386-tbl.h: Regenerated.binutils-2_35-branch
18 changed files with 378 additions and 7 deletions
@ -0,0 +1,26 @@ |
|||
#source: x86-64-movsxd.s |
|||
#as: |
|||
#objdump: -dw -Mintel |
|||
#name: x86-64 movsxd (AMD64) (Intel mode) |
|||
|
|||
.*: +file format .* |
|||
|
|||
Disassembly of section .text: |
|||
|
|||
0+ <_start>: |
|||
+[a-f0-9]+: 48 63 c8 movsxd rcx,eax |
|||
+[a-f0-9]+: 48 63 08 movsxd rcx,DWORD PTR \[rax\] |
|||
+[a-f0-9]+: 63 c8 movsxd ecx,eax |
|||
+[a-f0-9]+: 63 08 movsxd ecx,DWORD PTR \[rax\] |
|||
+[a-f0-9]+: 66 63 c8 movsxd cx,eax |
|||
+[a-f0-9]+: 66 63 08 movsxd cx,DWORD PTR \[rax\] |
|||
+[a-f0-9]+: 48 63 c8 movsxd rcx,eax |
|||
+[a-f0-9]+: 48 63 08 movsxd rcx,DWORD PTR \[rax\] |
|||
+[a-f0-9]+: 48 63 08 movsxd rcx,DWORD PTR \[rax\] |
|||
+[a-f0-9]+: 63 c8 movsxd ecx,eax |
|||
+[a-f0-9]+: 63 08 movsxd ecx,DWORD PTR \[rax\] |
|||
+[a-f0-9]+: 63 08 movsxd ecx,DWORD PTR \[rax\] |
|||
+[a-f0-9]+: 66 63 c8 movsxd cx,eax |
|||
+[a-f0-9]+: 63 08 movsxd ecx,DWORD PTR \[rax\] |
|||
+[a-f0-9]+: 66 63 08 movsxd cx,DWORD PTR \[rax\] |
|||
#pass |
|||
@ -0,0 +1,26 @@ |
|||
#source: x86-64-movsxd-intel64.s |
|||
#as: -mintel64 |
|||
#objdump: -dw -Mintel -Mintel64 |
|||
#name: x86-64 movsxd (Intel64) (Intel mode) |
|||
|
|||
.*: +file format .* |
|||
|
|||
Disassembly of section .text: |
|||
|
|||
0+ <_start>: |
|||
+[a-f0-9]+: 48 63 c8 movsxd rcx,eax |
|||
+[a-f0-9]+: 48 63 08 movsxd rcx,DWORD PTR \[rax\] |
|||
+[a-f0-9]+: 63 c8 movsxd ecx,eax |
|||
+[a-f0-9]+: 63 08 movsxd ecx,DWORD PTR \[rax\] |
|||
+[a-f0-9]+: 66 63 c8 movsxd cx,ax |
|||
+[a-f0-9]+: 66 63 08 movsxd cx,WORD PTR \[rax\] |
|||
+[a-f0-9]+: 48 63 c8 movsxd rcx,eax |
|||
+[a-f0-9]+: 48 63 08 movsxd rcx,DWORD PTR \[rax\] |
|||
+[a-f0-9]+: 48 63 08 movsxd rcx,DWORD PTR \[rax\] |
|||
+[a-f0-9]+: 63 c8 movsxd ecx,eax |
|||
+[a-f0-9]+: 63 08 movsxd ecx,DWORD PTR \[rax\] |
|||
+[a-f0-9]+: 63 08 movsxd ecx,DWORD PTR \[rax\] |
|||
+[a-f0-9]+: 66 63 c8 movsxd cx,ax |
|||
+[a-f0-9]+: 66 63 08 movsxd cx,WORD PTR \[rax\] |
|||
+[a-f0-9]+: 66 63 08 movsxd cx,WORD PTR \[rax\] |
|||
#pass |
|||
@ -0,0 +1,27 @@ |
|||
.*: Assembler messages: |
|||
.*:4: Error: .* |
|||
.*:5: Error: .* |
|||
.*:6: Error: .* |
|||
.*:7: Error: .* |
|||
.*:10: Error: .* |
|||
.*:11: Error: .* |
|||
.*:12: Error: .* |
|||
.*:13: Error: .* |
|||
.*:14: Error: .* |
|||
GAS LISTING .* |
|||
|
|||
|
|||
[ ]*1[ ]+\# 64-bit only invalid MOVSXD with Intel64 ISA |
|||
[ ]*2[ ]+\.text |
|||
[ ]*3[ ]+_start: |
|||
[ ]*4[ ]+movslq %eax, %cx |
|||
[ ]*5[ ]+movslq %eax, %ecx |
|||
[ ]*6[ ]+movslq \(%rax\), %ecx |
|||
[ ]*7[ ]+movsxd %ax, %ecx |
|||
[ ]*8[ ]+ |
|||
[ ]*9[ ]+\.intel_syntax noprefix |
|||
[ ]*10[ ]+movslq cx, ax |
|||
[ ]*11[ ]+movslq ecx, eax |
|||
[ ]*12[ ]+movslq ecx, \[rax\] |
|||
[ ]*13[ ]+movsxd cx, eax |
|||
[ ]*14[ ]+movsxd cx, DWORD PTR \[rax\] |
|||
@ -0,0 +1,14 @@ |
|||
# 64-bit only invalid MOVSXD with Intel64 ISA |
|||
.text |
|||
_start: |
|||
movslq %eax, %cx |
|||
movslq %eax, %ecx |
|||
movslq (%rax), %ecx |
|||
movsxd %ax, %ecx |
|||
|
|||
.intel_syntax noprefix |
|||
movslq cx, ax |
|||
movslq ecx, eax |
|||
movslq ecx, [rax] |
|||
movsxd cx, eax |
|||
movsxd cx, DWORD PTR [rax] |
|||
@ -0,0 +1,25 @@ |
|||
#as: -mintel64 |
|||
#objdump: -dw -Mintel64 |
|||
#name: x86-64 movsxd (Intel64) |
|||
|
|||
.*: +file format .* |
|||
|
|||
Disassembly of section .text: |
|||
|
|||
0+ <_start>: |
|||
+[a-f0-9]+: 48 63 c8 movslq %eax,%rcx |
|||
+[a-f0-9]+: 48 63 08 movslq \(%rax\),%rcx |
|||
+[a-f0-9]+: 63 c8 movsxd %eax,%ecx |
|||
+[a-f0-9]+: 63 08 movsxd \(%rax\),%ecx |
|||
+[a-f0-9]+: 66 63 c8 movsxd %ax,%cx |
|||
+[a-f0-9]+: 66 63 08 movsxd \(%rax\),%cx |
|||
+[a-f0-9]+: 48 63 c8 movslq %eax,%rcx |
|||
+[a-f0-9]+: 48 63 08 movslq \(%rax\),%rcx |
|||
+[a-f0-9]+: 48 63 08 movslq \(%rax\),%rcx |
|||
+[a-f0-9]+: 63 c8 movsxd %eax,%ecx |
|||
+[a-f0-9]+: 63 08 movsxd \(%rax\),%ecx |
|||
+[a-f0-9]+: 63 08 movsxd \(%rax\),%ecx |
|||
+[a-f0-9]+: 66 63 c8 movsxd %ax,%cx |
|||
+[a-f0-9]+: 66 63 08 movsxd \(%rax\),%cx |
|||
+[a-f0-9]+: 66 63 08 movsxd \(%rax\),%cx |
|||
#pass |
|||
@ -0,0 +1,20 @@ |
|||
# 64-bit only MOVSXD with Intel64 ISA |
|||
.text |
|||
_start: |
|||
movslq %eax, %rcx |
|||
movslq (%rax), %rcx |
|||
movsxd %eax, %ecx |
|||
movsxd (%rax), %ecx |
|||
movsxd %ax, %cx |
|||
movsxd (%rax), %cx |
|||
|
|||
.intel_syntax noprefix |
|||
movsxd rcx, eax |
|||
movsxd rcx, DWORD PTR [rax] |
|||
movsxd rcx, [rax] |
|||
movsxd ecx, eax |
|||
movsxd ecx, DWORD PTR [rax] |
|||
movsxd ecx, [rax] |
|||
movsxd cx, ax |
|||
movsxd cx, WORD PTR [rax] |
|||
movsxd cx, [rax] |
|||
@ -0,0 +1,27 @@ |
|||
.*: Assembler messages: |
|||
.*:4: Error: .* |
|||
.*:5: Error: .* |
|||
.*:6: Error: .* |
|||
.*:7: Error: .* |
|||
.*:10: Error: .* |
|||
.*:11: Error: .* |
|||
.*:12: Error: .* |
|||
.*:13: Error: .* |
|||
.*:14: Error: .* |
|||
GAS LISTING .* |
|||
|
|||
|
|||
[ ]*1[ ]+\# 64-bit only invalid MOVSXD with AMD64 ISA |
|||
[ ]*2[ ]+\.text |
|||
[ ]*3[ ]+_start: |
|||
[ ]*4[ ]+movslq %ax, %cx |
|||
[ ]*5[ ]+movslq %eax, %ecx |
|||
[ ]*6[ ]+movslq \(%rax\), %ecx |
|||
[ ]*7[ ]+movsxd %ax, %cx |
|||
[ ]*8[ ]+ |
|||
[ ]*9[ ]+\.intel_syntax noprefix |
|||
[ ]*10[ ]+movslq cx, eax |
|||
[ ]*11[ ]+movslq ecx, eax |
|||
[ ]*12[ ]+movslq ecx, \[rax\] |
|||
[ ]*13[ ]+movsxd cx, ax |
|||
[ ]*14[ ]+movsxd cx, WORD PTR \[rax\] |
|||
@ -0,0 +1,14 @@ |
|||
# 64-bit only invalid MOVSXD with AMD64 ISA |
|||
.text |
|||
_start: |
|||
movslq %ax, %cx |
|||
movslq %eax, %ecx |
|||
movslq (%rax), %ecx |
|||
movsxd %ax, %cx |
|||
|
|||
.intel_syntax noprefix |
|||
movslq cx, eax |
|||
movslq ecx, eax |
|||
movslq ecx, [rax] |
|||
movsxd cx, ax |
|||
movsxd cx, WORD PTR [rax] |
|||
@ -0,0 +1,25 @@ |
|||
#as: |
|||
#objdump: -dw |
|||
#name: x86-64 movsxd (AMD64) |
|||
|
|||
.*: +file format .* |
|||
|
|||
Disassembly of section .text: |
|||
|
|||
0+ <_start>: |
|||
+[a-f0-9]+: 48 63 c8 movslq %eax,%rcx |
|||
+[a-f0-9]+: 48 63 08 movslq \(%rax\),%rcx |
|||
+[a-f0-9]+: 63 c8 movsxd %eax,%ecx |
|||
+[a-f0-9]+: 63 08 movsxd \(%rax\),%ecx |
|||
+[a-f0-9]+: 66 63 c8 movsxd %eax,%cx |
|||
+[a-f0-9]+: 66 63 08 movsxd \(%rax\),%cx |
|||
+[a-f0-9]+: 48 63 c8 movslq %eax,%rcx |
|||
+[a-f0-9]+: 48 63 08 movslq \(%rax\),%rcx |
|||
+[a-f0-9]+: 48 63 08 movslq \(%rax\),%rcx |
|||
+[a-f0-9]+: 63 c8 movsxd %eax,%ecx |
|||
+[a-f0-9]+: 63 08 movsxd \(%rax\),%ecx |
|||
+[a-f0-9]+: 63 08 movsxd \(%rax\),%ecx |
|||
+[a-f0-9]+: 66 63 c8 movsxd %eax,%cx |
|||
+[a-f0-9]+: 63 08 movsxd \(%rax\),%ecx |
|||
+[a-f0-9]+: 66 63 08 movsxd \(%rax\),%cx |
|||
#pass |
|||
@ -0,0 +1,20 @@ |
|||
# 64-bit only MOVSXD with AMD64 ISA |
|||
.text |
|||
_start: |
|||
movslq %eax, %rcx |
|||
movslq (%rax), %rcx |
|||
movsxd %eax, %ecx |
|||
movsxd (%rax), %ecx |
|||
movsxd %eax, %cx |
|||
movsxd (%rax), %cx |
|||
|
|||
.intel_syntax noprefix |
|||
movsxd rcx, eax |
|||
movsxd rcx, DWORD PTR [rax] |
|||
movsxd rcx, [rax] |
|||
movsxd ecx, eax |
|||
movsxd ecx, DWORD PTR [rax] |
|||
movsxd ecx, [rax] |
|||
movsxd cx, eax |
|||
movsxd cx, DWORD PTR [rax] |
|||
movsxd cx, [rax] |
|||
Loading…
Reference in new issue