This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2] x86: ignore high register select bit(s) in 32- and 16-bit modes


On Wed, Nov 15, 2017 at 7:47 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Tue, Nov 14, 2017 at 11:57 PM, Jan Beulich <JBeulich@suse.com> wrote:
>> While commits 9889cbb14e ("Check invalid mask registers") and
>> abfcb414b9 ("X86: Ignore REX_B bit for 32-bit XOP instructions") went a
>> bit into the right direction, this wasn't quite enough:
>> - VEX.vvvv has its high bit ignored
>> - EVEX.vvvv has its high bit ignored together with EVEX.v'
>> - the high bits of {,E}VEX.vvvv should not be prematurely zapped, to
>>   allow proper checking of them when the fields has to hold al ones
>> - when the high bits of an immediate specify a register, bit 7 is
>>   ignored
>> ---
>> v2: Parts of the test were moved to earlier, already approved (and
>>     committed) patches.
>>
>> gas/
>> 2017-11-15  Jan Beulich  <jbeulich@suse.com>
>>
>>         * testsuite/gas/i386/noextreg.s: Add tests with register index
>>         bit 3 set.
>>         * testsuite/gas/i386/noextreg.d: Adjust expectations.
>>
>
> The new test fails on i386 when binutils is configured with:
>
> --enable-plugins --disable-gdb --disable-sim --disable-readline
> --disable-libdecnumber --enable-compressed-debug-sections=gas,ld
> i686-linux \
> \
> --prefix=/usr/local \
> --with-local-prefix=/usr/local
>
> since .code64 isn't supported:
>
> Executing on host: sh -c {../as-new  --32  -o dump.o
> /export/gnu/import/git/sources/binutils-gdb/gas/testsuite/gas/i386/noextreg.s
> 2>&1}  /dev/null gas.out (timeout = 300)
> /export/gnu/import/git/sources/binutils-gdb/gas/testsuite/gas/i386/noextreg.s:
> Assembler messages:
> /export/gnu/import/git/sources/binutils-gdb/gas/testsuite/gas/i386/noextreg.s:5:
> Error: unknown pseudo-op: `.code64'
> /export/gnu/import/git/sources/binutils-gdb/gas/testsuite/gas/i386/noextreg.s:6:
> Error: too many memory references for `andn'
> /export/gnu/import/git/sources/binutils-gdb/gas/testsuite/gas/i386/noextreg.s:10:
> Error: unknown pseudo-op: `.code64'
> /export/gnu/import/git/sources/binutils-gdb/gas/testsuite/gas/i386/noextreg.s:11:
> Error: too many memory references for `tzmsk'
> /export/gnu/import/git/sources/binutils-gdb/gas/testsuite/gas/i386/noextreg.s:15:
> Error: unknown pseudo-op: `.code64'
> /export/gnu/import/git/sources/binutils-gdb/gas/testsuite/gas/i386/noextreg.s:16:
> Error: operand size mismatch for `llwpcb'
> /export/gnu/import/git/sources/binutils-gdb/gas/testsuite/gas/i386/noextreg.s:
> Assembler messages:
> /export/gnu/import/git/sources/binutils-gdb/gas/testsuite/gas/i386/noextreg.s:5:
> Error: unknown pseudo-op: `.code64'
> /export/gnu/import/git/sources/binutils-gdb/gas/testsuite/gas/i386/noextreg.s:6:
> Error: too many memory references for `andn'
> /export/gnu/import/git/sources/binutils-gdb/gas/testsuite/gas/i386/noextreg.s:10:
> Error: unknown pseudo-op: `.code64'
> /export/gnu/import/git/sources/binutils-gdb/gas/testsuite/gas/i386/noextreg.s:11:
> Error: too many memory references for `tzmsk'
> /export/gnu/import/git/sources/binutils-gdb/gas/testsuite/gas/i386/noextreg.s:15:
> Error: unknown pseudo-op: `.code64'
> /export/gnu/import/git/sources/binutils-gdb/gas/testsuite/gas/i386/noextreg.s:16:
> Error: operand size mismatch for `llwpcb'
>
> Please fix it.
>
>

This is what I checked in.


-- 
H.J.
From 8c8cad3aa839747e368cc5db58331756a2b70e8e Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Thu, 16 Nov 2017 02:50:33 -0800
Subject: [PATCH] i386: Replace .code64/.code32 with .byte

Since .code64 directive isn't available for 32-bit BFD and ELF directive
isn't available for non-ELF directive, we should avoid them.

	* testsuite/gas/i386/noextreg.s: Replace .code64/.code32 and
	64-bit instructions with .byte.  Remove ELF directive.
---
 gas/ChangeLog                     |  5 +++++
 gas/testsuite/gas/i386/noextreg.s | 21 ++++++++-------------
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index 307fb00f29..eae7a29515 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,8 @@
+2017-11-15  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* testsuite/gas/i386/noextreg.s: Replace .code64/.code32 and
+	64-bit instructions with .byte.  Remove ELF directive.
+
 2017-11-15  Tamar Christina  <tamar.christina@arm.com>
 
 	* config/tc-arm.c (arm_ext_fp16_fml, fp16fml): New.
diff --git a/gas/testsuite/gas/i386/noextreg.s b/gas/testsuite/gas/i386/noextreg.s
index ba0c6ffa15..f1205acf22 100644
--- a/gas/testsuite/gas/i386/noextreg.s
+++ b/gas/testsuite/gas/i386/noextreg.s
@@ -2,24 +2,19 @@
 	.text
 ix86:
 	andn	eax, eax, [eax]
-	.code64
-	andn	rax, rax, [rax]
-	.code32
+	# andn rax, rax, [rax]
+	.byte	0xc4, 0xe2, 0xf8, 0xf2, 0x00
 
 	tzmsk	eax, [eax]
-	.code64
-	tzmsk	rax, [rax]
-	.code32
+	# tzmsk rax, [rax]
+	.byte	0x8f, 0xe9, 0xf8, 0x01, 0x20
 
 	llwpcb	eax
-	.code64
-	llwpcb	rax
-	.code32
+	# llwpcb rax
+	.byte	0x8f, 0xe9, 0xf8, 0x12, 0xc0
 
 	vfmaddps xmm0, xmm0, [eax], xmm0
-	.byte	0xc4, 0xe3, 0x79, 0x68, 0x00, 0x0f	# vfmaddps xmm0, xmm0, [eax], xmm0
+	# vfmaddps xmm0, xmm0, [eax], xmm0
+	.byte	0xc4, 0xe3, 0x79, 0x68, 0x00, 0x0f
 
 	ret
-
-	.type ix86, @function
-	.size ix86, . - ix86
-- 
2.13.6


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]