[4/6] x86: change AVX512VL handling in cpu_flags_match()

Message ID 5A9FF11802000078001AF5E3@prv-mh.provo.novell.com
State New
Headers show
Series
  • x86: fix/improve cpu_flags_match()
Related show

Commit Message

Jan Beulich March 7, 2018, 1:03 p.m.
In order to add an AVX512F counterpart to the present AVX checking, it
is better to move the AVX512VL check out of the conditional it's
currently in.

gas/
2018-03-07  Jan Beulich  <jbeulich@suse.com>

	* config/tc-i386.c (cpu_flags_match): Move AVX512VL check ahead.

Comments

H.J. Lu March 7, 2018, 1:40 p.m. | #1
On Wed, Mar 7, 2018 at 5:03 AM, Jan Beulich <JBeulich@suse.com> wrote:
> In order to add an AVX512F counterpart to the present AVX checking, it

> is better to move the AVX512VL check out of the conditional it's

> currently in.

>

> gas/

> 2018-03-07  Jan Beulich  <jbeulich@suse.com>

>

>         * config/tc-i386.c (cpu_flags_match): Move AVX512VL check ahead.

>


OK.

Thanks.

-- 
H.J.

Patch

--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -1710,6 +1710,11 @@  cpu_flags_match (const insn_template *t)
       /* This instruction is available only on some archs.  */
       i386_cpu_flags cpu = cpu_arch_flags;
 
+      /* AVX512VL is no standalone feature - match it and then strip it.  */
+      if (x.bitfield.cpuavx512vl && !cpu.bitfield.cpuavx512vl)
+	return match;
+      x.bitfield.cpuavx512vl = 0;
+
       cpu = cpu_flags_and (x, cpu);
       if (!cpu_flags_all_zero (&cpu))
 	{
@@ -1722,17 +1727,6 @@  cpu_flags_match (const insn_template *t)
 		  && (!x.bitfield.cpupclmul || cpu.bitfield.cpupclmul))
 		match |= CPU_FLAGS_ARCH_MATCH;
 	    }
-	  else if (x.bitfield.cpuavx512vl)
-	    {
-	      /* Match AVX512VL.  */
-	      if (cpu.bitfield.cpuavx512vl)
-		{
-		  /* Need another match.  */
-		  cpu.bitfield.cpuavx512vl = 0;
-		  if (!cpu_flags_all_zero (&cpu))
-		    match |= CPU_FLAGS_ARCH_MATCH;
-		}
-	    }
 	  else
 	    match |= CPU_FLAGS_ARCH_MATCH;
 	}