From 514f60231cb5a0a070712729a7c29447cae86453 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Thu, 26 Oct 2017 11:16:41 -0700 Subject: [PATCH] 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. --- 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/i386/x86-64-vgather-check-error.l | 1 + .../gas/i386/x86-64-vgather-check-none.d | 2 ++ .../gas/i386/x86-64-vgather-check-warn.d | 2 ++ .../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 64f593e13bb..231589fdc11 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,22 @@ +2017-10-26 H.J. Lu + + 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 * 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 6b5026f331e..dcc70c80455 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 a86ccd50b10..5874d6d3591 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 8abdfcbec82..634b304d214 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 985f7138907..532c4d82b9d 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 efd2e0bde30..cb88602098f 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 c3505f9ac3d..a50272f3b2d 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 b2735e75e31..73dd40a08b2 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 28fa82407c1..b65656d8193 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 a1062f77e14..3a14d1fa578 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 3d7a249113b..c89020976d3 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 b17f423091f..103ed704a88 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 d51f67076b4..dfe12971470 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 9d5872c8420..2c51d785337 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} -- 2.30.2