summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2018-03-22 08:33:38 +0100
committerJan Beulich <jbeulich@suse.com>2018-03-22 08:33:38 +0100
commit1212781b35c9e0080db6ee546cf5e7ebd45d6b09 (patch)
tree7d24149d4ea3e771f626f33ad9824c1e2b2c6be3
parent9f79e88693dae859f838bcf684158e6e6f8f3b6b (diff)
downloadbinutils-gdb-1212781b35c9e0080db6ee546cf5e7ebd45d6b09.tar.gz
ix86: allow HLE store of accumulator to absolute address
Since they're shorter to encode, the 0xa0...0xa3 encodings are preferred for moves between accumulator and absolute address outside of 64-bit mode. With HLE release semantics this encoding is unsupported though, with the assembler raising an error. The operation is valid though, we merely need to pick the longer encoding in that case.
-rw-r--r--gas/ChangeLog8
-rw-r--r--gas/config/tc-i386.c8
-rw-r--r--gas/testsuite/gas/i386/hle-intel.d3
-rw-r--r--gas/testsuite/gas/i386/hle.d3
-rw-r--r--gas/testsuite/gas/i386/hle.s3
5 files changed, 25 insertions, 0 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 6abb8532342..ace9839f508 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,13 @@
2018-03-22 Jan Beulich <jbeulich@suse.com>
+ * config/tc-i386.c (match_template): Special case base opcode
+ 0xa0 with HLE prefix.
+ * testsuite/gas/i386/hle.s: Add mov-accumulator-to-disp cases.
+ * testsuite/gas/i386/hle.d, testsuite/gas/i386/hle-intel.d:
+ Adjust expectations.
+
+2018-03-22 Jan Beulich <jbeulich@suse.com>
+
* testsuite/gas/i386/opts.s: Add bndmov cases.
* testsuite/gas/i386/opts.d, testsuite/gas/i386/opts-intel.d,
testsuite/gas/i386/sse2avx-opts.d,
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 8905de4f6a1..1a05f48e661 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -5427,6 +5427,14 @@ match_template (char mnem_suffix)
&& operand_type_equal (&i.types [0], &acc32)
&& operand_type_equal (&i.types [1], &acc32))
continue;
+ /* xrelease mov %eax, <disp> is another special case. It must not
+ match the accumulator-only encoding of mov. */
+ if (flag_code != CODE_64BIT
+ && i.hle_prefix
+ && t->base_opcode == 0xa0
+ && i.types[0].bitfield.acc
+ && operand_type_check (i.types[1], anymem))
+ continue;
/* If we want store form, we reverse direction of operands. */
if (i.dir_encoding == dir_encoding_store
&& t->opcode_modifier.d)
diff --git a/gas/testsuite/gas/i386/hle-intel.d b/gas/testsuite/gas/i386/hle-intel.d
index 0caf954beed..696e8727917 100644
--- a/gas/testsuite/gas/i386/hle-intel.d
+++ b/gas/testsuite/gas/i386/hle-intel.d
@@ -321,6 +321,7 @@ Disassembly of section .text:
[ ]*[a-f0-9]+: f0 f2 20 01 lock xacquire and BYTE PTR \[ecx\],al
[ ]*[a-f0-9]+: f0 f3 20 01 lock xrelease and BYTE PTR \[ecx\],al
[ ]*[a-f0-9]+: f3 88 01 xrelease mov BYTE PTR \[ecx\],al
+[ ]*[a-f0-9]+: f3 88 05 78 56 34 12 xrelease mov BYTE PTR ds:0x12345678,al
[ ]*[a-f0-9]+: f2 f0 08 01 xacquire lock or BYTE PTR \[ecx\],al
[ ]*[a-f0-9]+: f2 f0 08 01 xacquire lock or BYTE PTR \[ecx\],al
[ ]*[a-f0-9]+: f3 f0 08 01 xrelease lock or BYTE PTR \[ecx\],al
@@ -372,6 +373,7 @@ Disassembly of section .text:
[ ]*[a-f0-9]+: f0 f2 66 21 01 lock xacquire and WORD PTR \[ecx\],ax
[ ]*[a-f0-9]+: f0 f3 66 21 01 lock xrelease and WORD PTR \[ecx\],ax
[ ]*[a-f0-9]+: 66 f3 89 01 xrelease mov WORD PTR \[ecx\],ax
+[ ]*[a-f0-9]+: 66 f3 89 05 78 56 34 12 xrelease mov WORD PTR ds:0x12345678,ax
[ ]*[a-f0-9]+: 66 f2 f0 09 01 xacquire lock or WORD PTR \[ecx\],ax
[ ]*[a-f0-9]+: 66 f2 f0 09 01 xacquire lock or WORD PTR \[ecx\],ax
[ ]*[a-f0-9]+: 66 f3 f0 09 01 xrelease lock or WORD PTR \[ecx\],ax
@@ -423,6 +425,7 @@ Disassembly of section .text:
[ ]*[a-f0-9]+: f0 f2 21 01 lock xacquire and DWORD PTR \[ecx\],eax
[ ]*[a-f0-9]+: f0 f3 21 01 lock xrelease and DWORD PTR \[ecx\],eax
[ ]*[a-f0-9]+: f3 89 01 xrelease mov DWORD PTR \[ecx\],eax
+[ ]*[a-f0-9]+: f3 89 05 78 56 34 12 xrelease mov DWORD PTR ds:0x12345678,eax
[ ]*[a-f0-9]+: f2 f0 09 01 xacquire lock or DWORD PTR \[ecx\],eax
[ ]*[a-f0-9]+: f2 f0 09 01 xacquire lock or DWORD PTR \[ecx\],eax
[ ]*[a-f0-9]+: f3 f0 09 01 xrelease lock or DWORD PTR \[ecx\],eax
diff --git a/gas/testsuite/gas/i386/hle.d b/gas/testsuite/gas/i386/hle.d
index bf7bdcff293..96b620fc482 100644
--- a/gas/testsuite/gas/i386/hle.d
+++ b/gas/testsuite/gas/i386/hle.d
@@ -320,6 +320,7 @@ Disassembly of section .text:
[ ]*[a-f0-9]+: f0 f2 20 01 lock xacquire and %al,\(%ecx\)
[ ]*[a-f0-9]+: f0 f3 20 01 lock xrelease and %al,\(%ecx\)
[ ]*[a-f0-9]+: f3 88 01 xrelease mov %al,\(%ecx\)
+[ ]*[a-f0-9]+: f3 88 05 78 56 34 12 xrelease mov %al,0x12345678
[ ]*[a-f0-9]+: f2 f0 08 01 xacquire lock or %al,\(%ecx\)
[ ]*[a-f0-9]+: f2 f0 08 01 xacquire lock or %al,\(%ecx\)
[ ]*[a-f0-9]+: f3 f0 08 01 xrelease lock or %al,\(%ecx\)
@@ -371,6 +372,7 @@ Disassembly of section .text:
[ ]*[a-f0-9]+: f0 f2 66 21 01 lock xacquire and %ax,\(%ecx\)
[ ]*[a-f0-9]+: f0 f3 66 21 01 lock xrelease and %ax,\(%ecx\)
[ ]*[a-f0-9]+: 66 f3 89 01 xrelease mov %ax,\(%ecx\)
+[ ]*[a-f0-9]+: 66 f3 89 05 78 56 34 12 xrelease mov %ax,0x12345678
[ ]*[a-f0-9]+: 66 f2 f0 09 01 xacquire lock or %ax,\(%ecx\)
[ ]*[a-f0-9]+: 66 f2 f0 09 01 xacquire lock or %ax,\(%ecx\)
[ ]*[a-f0-9]+: 66 f3 f0 09 01 xrelease lock or %ax,\(%ecx\)
@@ -422,6 +424,7 @@ Disassembly of section .text:
[ ]*[a-f0-9]+: f0 f2 21 01 lock xacquire and %eax,\(%ecx\)
[ ]*[a-f0-9]+: f0 f3 21 01 lock xrelease and %eax,\(%ecx\)
[ ]*[a-f0-9]+: f3 89 01 xrelease mov %eax,\(%ecx\)
+[ ]*[a-f0-9]+: f3 89 05 78 56 34 12 xrelease mov %eax,0x12345678
[ ]*[a-f0-9]+: f2 f0 09 01 xacquire lock or %eax,\(%ecx\)
[ ]*[a-f0-9]+: f2 f0 09 01 xacquire lock or %eax,\(%ecx\)
[ ]*[a-f0-9]+: f3 f0 09 01 xrelease lock or %eax,\(%ecx\)
diff --git a/gas/testsuite/gas/i386/hle.s b/gas/testsuite/gas/i386/hle.s
index 1fffa9e7a4e..1beddc458f5 100644
--- a/gas/testsuite/gas/i386/hle.s
+++ b/gas/testsuite/gas/i386/hle.s
@@ -331,6 +331,7 @@ _start:
.byte 0xf0; .byte 0xf2; andb %al,(%ecx)
.byte 0xf0; .byte 0xf3; andb %al,(%ecx)
xrelease movb %al,(%ecx)
+ xrelease movb %al,0x12345678
xacquire lock orb %al,(%ecx)
lock xacquire orb %al,(%ecx)
xrelease lock orb %al,(%ecx)
@@ -385,6 +386,7 @@ _start:
.byte 0xf0; .byte 0xf2; andw %ax,(%ecx)
.byte 0xf0; .byte 0xf3; andw %ax,(%ecx)
xrelease movw %ax,(%ecx)
+ xrelease movw %ax,0x12345678
xacquire lock orw %ax,(%ecx)
lock xacquire orw %ax,(%ecx)
xrelease lock orw %ax,(%ecx)
@@ -439,6 +441,7 @@ _start:
.byte 0xf0; .byte 0xf2; andl %eax,(%ecx)
.byte 0xf0; .byte 0xf3; andl %eax,(%ecx)
xrelease movl %eax,(%ecx)
+ xrelease movl %eax,0x12345678
xacquire lock orl %eax,(%ecx)
lock xacquire orl %eax,(%ecx)
xrelease lock orl %eax,(%ecx)