[PATCH] x86: Do not dump DS/CS segment overrides for branch hints

Borislav Petkov bp@suse.de
Sat Nov 28 23:59:56 GMT 2020


On Sat, Nov 28, 2020 at 06:07:37AM -0800, H.J. Lu wrote:
> Please add a testcase to show that the regression is fixed.

Ok, how's that diff (ontop of the previous one)?

I've added them to x86-64-segovr because for 64-bit that test deals with
segment overrides so they kinda logically belong there.

And I couldn't find the corresponding test for i386 so I put them in
the SSE2 test because those branch hints came together with the SSE2
extensions, according to the SDM.

I can do separate files, if that is preferred though, but since that
test is only two insns, I thought I should keep it simple and not add
more files...

diff --git a/gas/testsuite/gas/i386/sse2-16bit.d b/gas/testsuite/gas/i386/sse2-16bit.d
index a0970362a508..15ab05b39964 100644
--- a/gas/testsuite/gas/i386/sse2-16bit.d
+++ b/gas/testsuite/gas/i386/sse2-16bit.d
@@ -163,6 +163,8 @@ Disassembly of section .text:
 [ 	]*[a-f0-9]+:	67 0f fb 00          	psubq  \(%eax\),%mm0
 [ 	]*[a-f0-9]+:	66 0f fb c1          	psubq  %xmm1,%xmm0
 [ 	]*[a-f0-9]+:	67 66 0f fb 00       	psubq  \(%eax\),%xmm0
+[ 	]*[a-f0-9]+:	3e 0f 84 14 fd       	je,pt  0 <foo>
+[ 	]*[a-f0-9]+:	2e 0f 84 0f fd       	je,pn  0 <foo>
 [ 	]*[a-f0-9]+:	0f 58 2f             	addps  \(%bx\),%xmm5
 [ 	]*[a-f0-9]+:	f3 0f 2a d9          	cvtsi2ss %ecx,%xmm3
 [ 	]*[a-f0-9]+:	f3 0f 2d cb          	cvtss2si %xmm3,%ecx
diff --git a/gas/testsuite/gas/i386/sse2.d b/gas/testsuite/gas/i386/sse2.d
index 23f7b430bb68..52b6878cf10c 100644
--- a/gas/testsuite/gas/i386/sse2.d
+++ b/gas/testsuite/gas/i386/sse2.d
@@ -163,4 +163,6 @@ Disassembly of section .text:
 [ 	]*[a-f0-9]+:	0f fb 00             	psubq  \(%eax\),%mm0
 [ 	]*[a-f0-9]+:	66 0f fb c1          	psubq  %xmm1,%xmm0
 [ 	]*[a-f0-9]+:	66 0f fb 00          	psubq  \(%eax\),%xmm0
+[ 	]*[a-f0-9]+:	3e 0f 84 59 fd ff ff 	je,pt  0 <foo>
+[ 	]*[a-f0-9]+:	2e 0f 84 52 fd ff ff 	je,pn  0 <foo>
 #pass
diff --git a/gas/testsuite/gas/i386/sse2.s b/gas/testsuite/gas/i386/sse2.s
index c6375dcb06e9..6b52b87c5fdc 100644
--- a/gas/testsuite/gas/i386/sse2.s
+++ b/gas/testsuite/gas/i386/sse2.s
@@ -155,3 +155,5 @@ foo:
 	psubq           (%eax),%mm0
 	psubq           %xmm1,%xmm0
 	psubq           (%eax),%xmm0
+	jz,pt foo
+	jz,pn foo
diff --git a/gas/testsuite/gas/i386/x86-64-segovr.d b/gas/testsuite/gas/i386/x86-64-segovr.d
index 2e7ebf26efa9..304d30fe00ea 100644
--- a/gas/testsuite/gas/i386/x86-64-segovr.d
+++ b/gas/testsuite/gas/i386/x86-64-segovr.d
@@ -38,4 +38,6 @@ Disassembly of section .text:
 [ 	]*[a-f0-9]+:	36 41 8b 45 00[ 	]+ss mov[ 	]+((0x)?0)?\(%r13\),%eax
 [ 	]*[a-f0-9]+:	36 41 8b 06[ 	]+ss mov[ 	]+\(%r14\),%eax
 [ 	]*[a-f0-9]+:	36 41 8b 07[ 	]+ss mov[ 	]+\(%r15\),%eax
+[ 	]*[a-f0-9]+:	3e 74 03[ 	]+je,pt[ 	]+6e <label>
+[ 	]*[a-f0-9]+:	2e 74 00[ 	]+je,pn[ 	]+6e <label>
 #pass
diff --git a/gas/testsuite/gas/i386/x86-64-segovr.s b/gas/testsuite/gas/i386/x86-64-segovr.s
index 08c045f231f5..d0386da807a0 100644
--- a/gas/testsuite/gas/i386/x86-64-segovr.s
+++ b/gas/testsuite/gas/i386/x86-64-segovr.s
@@ -7,3 +7,6 @@ segovr:
 	mov	%\seg:(%r\reg), %eax
  .endr
 .endr
+jz,pt label
+jz,pn label
+label:

---

Thx.

-- 
Regards/Gruss,
    Boris.

SUSE Software Solutions Germany GmbH, GF: Felix Imendörffer, HRB 36809, AG Nürnberg


More information about the Binutils mailing list