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.
This commit is contained in:
Jan Beulich 2018-03-22 08:33:38 +01:00 committed by Jan Beulich
parent 9f79e88693
commit 1212781b35
5 changed files with 25 additions and 0 deletions

View File

@ -1,3 +1,11 @@
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.

View File

@ -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)

View File

@ -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

View File

@ -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\)

View File

@ -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)