public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] x86/SSE2AVX: move checking
@ 2024-03-28 10:56 Jan Beulich
  0 siblings, 0 replies; only message in thread
From: Jan Beulich @ 2024-03-28 10:56 UTC (permalink / raw)
  To: binutils-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b58829cdeff4644528ec06dfdb63ffb22910088f

commit b58829cdeff4644528ec06dfdb63ffb22910088f
Author: Jan Beulich <jbeulich@suse.com>
Date:   Thu Mar 28 11:55:53 2024 +0100

    x86/SSE2AVX: move checking
    
    It has always been looking a little odd to me that this was done deep
    in cpu_flags_match(). Move it to match_template() itself - there's no
    need to do anything complex when encountering such a template while it
    cannot possibly be used.

Diff:
---
 gas/config/tc-i386.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 9f5273f9d45..7467cef18cd 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -1980,17 +1980,7 @@ cpu_flags_match (const insn_template *t)
 
       cpu = cpu_flags_and (any, active);
       if (cpu_flags_all_zero (&any) || !cpu_flags_all_zero (&cpu))
-	{
-	  if (all.bitfield.cpuavx)
-	    {
-	      /* We need to check SSE2AVX with AVX.  */
-	      if (!t->opcode_modifier.sse2avx
-		  || (sse2avx && !i.prefix[DATA_PREFIX]))
-		match |= CPU_FLAGS_ARCH_MATCH;
-	    }
-	  else
-	    match |= CPU_FLAGS_ARCH_MATCH;
-	}
+	match |= CPU_FLAGS_ARCH_MATCH;
     }
   return match;
 }
@@ -8542,6 +8532,15 @@ match_template (char mnem_suffix)
       if (i.operands != t->operands)
 	continue;
 
+      /* Skip SSE2AVX templates when inapplicable.  */
+      if (t->opcode_modifier.sse2avx
+	  && (!sse2avx || i.prefix[DATA_PREFIX]))
+	{
+	  /* Another non-SSE2AVX template has to follow.  */
+	  gas_assert (t + 1 < current_templates.end);
+	  continue;
+	}
+
       /* Check processor support.  */
       specific_error = progress (unsupported);
       if (cpu_flags_match (t) != CPU_FLAGS_PERFECT_MATCH)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-03-28 10:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-28 10:56 [binutils-gdb] x86/SSE2AVX: move checking Jan Beulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).