This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] x86: Check invalid XMM register in AVX512 gathers
- From: H.J.Lu <hjl at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 26 Oct 2017 18:18:50 -0000
- Subject: [binutils-gdb] x86: Check invalid XMM register in AVX512 gathers
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=514f60231cb5a0a070712729a7c29447cae86453
commit 514f60231cb5a0a070712729a7c29447cae86453
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Thu Oct 26 11:16:41 2017 -0700
x86: Check invalid XMM register in AVX512 gathers
Extend invalid register check for AVX512 gathers to XMM register.
PR gas/22352
* config/tc-i386.c (check_VecOperands): Also check XMM register
for invalid register in AVX512 gathers.
* testsuite/gas/i386/vgather-check.s: Add tests for AVX512
gathers with XMM register.
* testsuite/gas/i386/x86-64-vgather-check.s: Likewise.
* testsuite/gas/i386/vgather-check-error.l: Updated.
* testsuite/gas/i386/vgather-check-none.d: Likewise.
* testsuite/gas/i386/vgather-check-warn.d: Likewise.
* testsuite/gas/i386/vgather-check-warn.e: Likewise.
* testsuite/gas/i386/vgather-check.d: Likewise.
* testsuite/gas/i386/x86-64-vgather-check-error.l: Likewise.
* testsuite/gas/i386/x86-64-vgather-check-none.d: Likewise.
* testsuite/gas/i386/x86-64-vgather-check-warn.d: Likewise.
* testsuite/gas/i386/x86-64-vgather-check-warn.e: Likewise.
* testsuite/gas/i386/x86-64-vgather-check.d: Likewise.
Diff:
---
gas/ChangeLog | 19 +++++++++++++++++++
gas/config/tc-i386.c | 3 ++-
gas/testsuite/gas/i386/vgather-check-error.l | 1 +
gas/testsuite/gas/i386/vgather-check-none.d | 2 ++
gas/testsuite/gas/i386/vgather-check-warn.d | 2 ++
gas/testsuite/gas/i386/vgather-check-warn.e | 1 +
gas/testsuite/gas/i386/vgather-check.d | 2 ++
gas/testsuite/gas/i386/vgather-check.s | 2 ++
gas/testsuite/gas/i386/x86-64-vgather-check-error.l | 1 +
gas/testsuite/gas/i386/x86-64-vgather-check-none.d | 2 ++
gas/testsuite/gas/i386/x86-64-vgather-check-warn.d | 2 ++
gas/testsuite/gas/i386/x86-64-vgather-check-warn.e | 1 +
gas/testsuite/gas/i386/x86-64-vgather-check.d | 2 ++
gas/testsuite/gas/i386/x86-64-vgather-check.s | 2 ++
14 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 64f593e..231589f 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,22 @@
+2017-10-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR gas/22352
+ * config/tc-i386.c (check_VecOperands): Also check XMM register
+ for invalid register in AVX512 gathers.
+ * testsuite/gas/i386/vgather-check.s: Add tests for AVX512
+ gathers with XMM register.
+ * testsuite/gas/i386/x86-64-vgather-check.s: Likewise.
+ * testsuite/gas/i386/vgather-check-error.l: Updated.
+ * testsuite/gas/i386/vgather-check-none.d: Likewise.
+ * testsuite/gas/i386/vgather-check-warn.d: Likewise.
+ * testsuite/gas/i386/vgather-check-warn.e: Likewise.
+ * testsuite/gas/i386/vgather-check.d: Likewise.
+ * testsuite/gas/i386/x86-64-vgather-check-error.l: Likewise.
+ * testsuite/gas/i386/x86-64-vgather-check-none.d: Likewise.
+ * testsuite/gas/i386/x86-64-vgather-check-warn.d: Likewise.
+ * testsuite/gas/i386/x86-64-vgather-check-warn.e: Likewise.
+ * testsuite/gas/i386/x86-64-vgather-check.d: Likewise.
+
2017-10-26 Hans-Peter Nilsson <hp@bitrange.com>
* testsuite/gas/all/fill-1.s: Use L2 rather than .L2.
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 6b5026f..dcc70c8 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -4658,7 +4658,8 @@ check_VecOperands (const insn_template *t)
}
else if (i.reg_operands == 1 && i.mask)
{
- if ((i.types[1].bitfield.regymm
+ if ((i.types[1].bitfield.regxmm
+ || i.types[1].bitfield.regymm
|| i.types[1].bitfield.regzmm)
&& (register_number (i.op[1].regs)
== register_number (i.index_reg)))
diff --git a/gas/testsuite/gas/i386/vgather-check-error.l b/gas/testsuite/gas/i386/vgather-check-error.l
index a86ccd5..5874d6d 100644
--- a/gas/testsuite/gas/i386/vgather-check-error.l
+++ b/gas/testsuite/gas/i386/vgather-check-error.l
@@ -10,3 +10,4 @@
.*:22: Error: .*
.*:24: Error: .*
.*:26: Error: .*
+.*:28: Error: .*
diff --git a/gas/testsuite/gas/i386/vgather-check-none.d b/gas/testsuite/gas/i386/vgather-check-none.d
index 8abdfcb..634b304 100644
--- a/gas/testsuite/gas/i386/vgather-check-none.d
+++ b/gas/testsuite/gas/i386/vgather-check-none.d
@@ -29,4 +29,6 @@ Disassembly of section .text:
[ ]+[a-f0-9]+:[ ]+62 f2 7d 49 91 b4 f5 7b 00 00 00[ ]+vpgatherqd 0x7b\(%ebp,%zmm6,8\),%ymm6\{%k1\}
[ ]+[a-f0-9]+:[ ]+62 f2 fd 49 91 b4 fd 7b 00 00 00[ ]+vpgatherqq 0x7b\(%ebp,%zmm7,8\),%zmm6\{%k1\}
[ ]+[a-f0-9]+:[ ]+62 f2 fd 49 91 b4 f5 7b 00 00 00[ ]+vpgatherqq 0x7b\(%ebp,%zmm6,8\),%zmm6\{%k1\}
+[ ]+[a-f0-9]+:[ ]+62 f2 7d 29 91 b4 fd 7b 00 00 00[ ]+vpgatherqd 0x7b\(%ebp,%ymm7,8\),%xmm6\{%k1\}
+[ ]+[a-f0-9]+:[ ]+62 f2 7d 29 91 b4 f5 7b 00 00 00[ ]+vpgatherqd 0x7b\(%ebp,%ymm6,8\),%xmm6\{%k1\}
#pass
diff --git a/gas/testsuite/gas/i386/vgather-check-warn.d b/gas/testsuite/gas/i386/vgather-check-warn.d
index 985f713..532c4d8 100644
--- a/gas/testsuite/gas/i386/vgather-check-warn.d
+++ b/gas/testsuite/gas/i386/vgather-check-warn.d
@@ -30,4 +30,6 @@ Disassembly of section .text:
[ ]+[a-f0-9]+:[ ]+62 f2 7d 49 91 b4 f5 7b 00 00 00[ ]+vpgatherqd 0x7b\(%ebp,%zmm6,8\),%ymm6\{%k1\}
[ ]+[a-f0-9]+:[ ]+62 f2 fd 49 91 b4 fd 7b 00 00 00[ ]+vpgatherqq 0x7b\(%ebp,%zmm7,8\),%zmm6\{%k1\}
[ ]+[a-f0-9]+:[ ]+62 f2 fd 49 91 b4 f5 7b 00 00 00[ ]+vpgatherqq 0x7b\(%ebp,%zmm6,8\),%zmm6\{%k1\}
+[ ]+[a-f0-9]+:[ ]+62 f2 7d 29 91 b4 fd 7b 00 00 00[ ]+vpgatherqd 0x7b\(%ebp,%ymm7,8\),%xmm6\{%k1\}
+[ ]+[a-f0-9]+:[ ]+62 f2 7d 29 91 b4 f5 7b 00 00 00[ ]+vpgatherqd 0x7b\(%ebp,%ymm6,8\),%xmm6\{%k1\}
#pass
diff --git a/gas/testsuite/gas/i386/vgather-check-warn.e b/gas/testsuite/gas/i386/vgather-check-warn.e
index efd2e0b..cb88602 100644
--- a/gas/testsuite/gas/i386/vgather-check-warn.e
+++ b/gas/testsuite/gas/i386/vgather-check-warn.e
@@ -10,3 +10,4 @@
.*:22: Warning: .*
.*:24: Warning: .*
.*:26: Warning: .*
+.*:28: Warning: .*
diff --git a/gas/testsuite/gas/i386/vgather-check.d b/gas/testsuite/gas/i386/vgather-check.d
index c3505f9..a50272f 100644
--- a/gas/testsuite/gas/i386/vgather-check.d
+++ b/gas/testsuite/gas/i386/vgather-check.d
@@ -29,4 +29,6 @@ Disassembly of section .text:
[ ]+[a-f0-9]+:[ ]+62 f2 7d 49 91 b4 f5 7b 00 00 00[ ]+vpgatherqd 0x7b\(%ebp,%zmm6,8\),%ymm6\{%k1\}
[ ]+[a-f0-9]+:[ ]+62 f2 fd 49 91 b4 fd 7b 00 00 00[ ]+vpgatherqq 0x7b\(%ebp,%zmm7,8\),%zmm6\{%k1\}
[ ]+[a-f0-9]+:[ ]+62 f2 fd 49 91 b4 f5 7b 00 00 00[ ]+vpgatherqq 0x7b\(%ebp,%zmm6,8\),%zmm6\{%k1\}
+[ ]+[a-f0-9]+:[ ]+62 f2 7d 29 91 b4 fd 7b 00 00 00[ ]+vpgatherqd 0x7b\(%ebp,%ymm7,8\),%xmm6\{%k1\}
+[ ]+[a-f0-9]+:[ ]+62 f2 7d 29 91 b4 f5 7b 00 00 00[ ]+vpgatherqd 0x7b\(%ebp,%ymm6,8\),%xmm6\{%k1\}
#pass
diff --git a/gas/testsuite/gas/i386/vgather-check.s b/gas/testsuite/gas/i386/vgather-check.s
index b2735e7..73dd40a 100644
--- a/gas/testsuite/gas/i386/vgather-check.s
+++ b/gas/testsuite/gas/i386/vgather-check.s
@@ -24,3 +24,5 @@ avx512vgather:
vpgatherqd 123(%ebp,%zmm6,8), %ymm6{%k1}
vpgatherqq 123(%ebp,%zmm7,8), %zmm6{%k1}
vpgatherqq 123(%ebp,%zmm6,8), %zmm6{%k1}
+ vpgatherqd 123(%ebp,%ymm7,8), %xmm6{%k1}
+ vpgatherqd 123(%ebp,%ymm6,8), %xmm6{%k1}
diff --git a/gas/testsuite/gas/i386/x86-64-vgather-check-error.l b/gas/testsuite/gas/i386/x86-64-vgather-check-error.l
index 28fa824..b65656d 100644
--- a/gas/testsuite/gas/i386/x86-64-vgather-check-error.l
+++ b/gas/testsuite/gas/i386/x86-64-vgather-check-error.l
@@ -10,3 +10,4 @@
.*:25: Error: .*
.*:27: Error: .*
.*:29: Error: .*
+.*:31: Error: .*
diff --git a/gas/testsuite/gas/i386/x86-64-vgather-check-none.d b/gas/testsuite/gas/i386/x86-64-vgather-check-none.d
index a1062f7..3a14d1f 100644
--- a/gas/testsuite/gas/i386/x86-64-vgather-check-none.d
+++ b/gas/testsuite/gas/i386/x86-64-vgather-check-none.d
@@ -32,4 +32,6 @@ Disassembly of section .text:
[ ]+[a-f0-9]+:[ ]+62 e2 7d 41 91 84 c5 7b 00 00 00[ ]+vpgatherqd 0x7b\(%rbp,%zmm16,8\),%ymm16\{%k1\}
[ ]+[a-f0-9]+:[ ]+62 e2 fd 41 91 84 cd 7b 00 00 00[ ]+vpgatherqq 0x7b\(%rbp,%zmm17,8\),%zmm16\{%k1\}
[ ]+[a-f0-9]+:[ ]+62 e2 fd 41 91 84 c5 7b 00 00 00[ ]+vpgatherqq 0x7b\(%rbp,%zmm16,8\),%zmm16\{%k1\}
+[ ]+[a-f0-9]+:[ ]+62 e2 7d 21 91 84 cd 7b 00 00 00[ ]+vpgatherqd 0x7b\(%rbp,%ymm17,8\),%xmm16\{%k1\}
+[ ]+[a-f0-9]+:[ ]+62 e2 7d 21 91 84 c5 7b 00 00 00[ ]+vpgatherqd 0x7b\(%rbp,%ymm16,8\),%xmm16\{%k1\}
#pass
diff --git a/gas/testsuite/gas/i386/x86-64-vgather-check-warn.d b/gas/testsuite/gas/i386/x86-64-vgather-check-warn.d
index 3d7a249..c890209 100644
--- a/gas/testsuite/gas/i386/x86-64-vgather-check-warn.d
+++ b/gas/testsuite/gas/i386/x86-64-vgather-check-warn.d
@@ -33,4 +33,6 @@ Disassembly of section .text:
[ ]+[a-f0-9]+:[ ]+62 e2 7d 41 91 84 c5 7b 00 00 00[ ]+vpgatherqd 0x7b\(%rbp,%zmm16,8\),%ymm16\{%k1\}
[ ]+[a-f0-9]+:[ ]+62 e2 fd 41 91 84 cd 7b 00 00 00[ ]+vpgatherqq 0x7b\(%rbp,%zmm17,8\),%zmm16\{%k1\}
[ ]+[a-f0-9]+:[ ]+62 e2 fd 41 91 84 c5 7b 00 00 00[ ]+vpgatherqq 0x7b\(%rbp,%zmm16,8\),%zmm16\{%k1\}
+[ ]+[a-f0-9]+:[ ]+62 e2 7d 21 91 84 cd 7b 00 00 00[ ]+vpgatherqd 0x7b\(%rbp,%ymm17,8\),%xmm16\{%k1\}
+[ ]+[a-f0-9]+:[ ]+62 e2 7d 21 91 84 c5 7b 00 00 00[ ]+vpgatherqd 0x7b\(%rbp,%ymm16,8\),%xmm16\{%k1\}
#pass
diff --git a/gas/testsuite/gas/i386/x86-64-vgather-check-warn.e b/gas/testsuite/gas/i386/x86-64-vgather-check-warn.e
index b17f423..103ed70 100644
--- a/gas/testsuite/gas/i386/x86-64-vgather-check-warn.e
+++ b/gas/testsuite/gas/i386/x86-64-vgather-check-warn.e
@@ -10,3 +10,4 @@
.*:25: Warning: .*
.*:27: Warning: .*
.*:29: Warning: .*
+.*:31: Warning: .*
diff --git a/gas/testsuite/gas/i386/x86-64-vgather-check.d b/gas/testsuite/gas/i386/x86-64-vgather-check.d
index d51f670..dfe1297 100644
--- a/gas/testsuite/gas/i386/x86-64-vgather-check.d
+++ b/gas/testsuite/gas/i386/x86-64-vgather-check.d
@@ -32,4 +32,6 @@ Disassembly of section .text:
[ ]+[a-f0-9]+:[ ]+62 e2 7d 41 91 84 c5 7b 00 00 00[ ]+vpgatherqd 0x7b\(%rbp,%zmm16,8\),%ymm16\{%k1\}
[ ]+[a-f0-9]+:[ ]+62 e2 fd 41 91 84 cd 7b 00 00 00[ ]+vpgatherqq 0x7b\(%rbp,%zmm17,8\),%zmm16\{%k1\}
[ ]+[a-f0-9]+:[ ]+62 e2 fd 41 91 84 c5 7b 00 00 00[ ]+vpgatherqq 0x7b\(%rbp,%zmm16,8\),%zmm16\{%k1\}
+[ ]+[a-f0-9]+:[ ]+62 e2 7d 21 91 84 cd 7b 00 00 00[ ]+vpgatherqd 0x7b\(%rbp,%ymm17,8\),%xmm16\{%k1\}
+[ ]+[a-f0-9]+:[ ]+62 e2 7d 21 91 84 c5 7b 00 00 00[ ]+vpgatherqd 0x7b\(%rbp,%ymm16,8\),%xmm16\{%k1\}
#pass
diff --git a/gas/testsuite/gas/i386/x86-64-vgather-check.s b/gas/testsuite/gas/i386/x86-64-vgather-check.s
index 9d5872c..2c51d78 100644
--- a/gas/testsuite/gas/i386/x86-64-vgather-check.s
+++ b/gas/testsuite/gas/i386/x86-64-vgather-check.s
@@ -27,3 +27,5 @@ avx512vgather:
vpgatherqd 123(%rbp,%zmm16,8), %ymm16{%k1}
vpgatherqq 123(%rbp,%zmm17,8), %zmm16{%k1}
vpgatherqq 123(%rbp,%zmm16,8), %zmm16{%k1}
+ vpgatherqd 123(%rbp,%ymm17,8), %xmm16{%k1}
+ vpgatherqd 123(%rbp,%ymm16,8), %xmm16{%k1}