]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
x86: fold Accum checking in operand_size_match()
authorJan Beulich <jbeulich@suse.com>
Fri, 16 May 2025 08:27:20 +0000 (10:27 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 16 May 2025 08:27:20 +0000 (10:27 +0200)
There's little point invoking match_{operand,simd}_size() twice per
loop; in fact the SIMD case with D set simply doesn't exist. Amend the
checks by one looking at the given operand, just like we already have
been doing for memory ones.

gas/config/tc-i386.c

index 15f274f6e5bd4eb2dd1b4ef8f2666fd4f0880e89..7c9b94a61c424af77f247763ec1f4ad16d261473 100644 (file)
@@ -2609,27 +2609,24 @@ operand_size_match (const insn_template *t)
          && t->opcode_modifier.operandconstraint == ANY_SIZE)
        continue;
 
-      if (t->operand_types[j].bitfield.class == Reg
+      if (i.types[j].bitfield.class == Reg
+         && (t->operand_types[j].bitfield.class == Reg
+             || t->operand_types[j].bitfield.instance == Accum)
          && !match_operand_size (t, j, j))
        {
          match = 0;
          break;
        }
 
-      if (t->operand_types[j].bitfield.class == RegSIMD
+      if (i.types[j].bitfield.class == RegSIMD
+         && (t->operand_types[j].bitfield.class == RegSIMD
+             || t->operand_types[j].bitfield.instance == Accum)
          && !match_simd_size (t, j, j))
        {
          match = 0;
          break;
        }
 
-      if (t->operand_types[j].bitfield.instance == Accum
-         && (!match_operand_size (t, j, j) || !match_simd_size (t, j, j)))
-       {
-         match = 0;
-         break;
-       }
-
       if ((i.flags[j] & Operand_Mem)
          && operand_type_check (t->operand_types[j], anymem)
          && !match_mem_size (t, j, j))
@@ -2656,19 +2653,19 @@ operand_size_match (const insn_template *t)
          || is_cpu (t, CpuAPX_F))
        given = j < 2 ? 1 - j : j;
 
-      if (t->operand_types[j].bitfield.class == Reg
+      if (i.types[given].bitfield.class == Reg
+         && (t->operand_types[j].bitfield.class == Reg
+             || t->operand_types[j].bitfield.instance == Accum)
          && !match_operand_size (t, j, given))
        return match;
 
-      if (t->operand_types[j].bitfield.class == RegSIMD
+      /* No need to check for Accum here: There are no such templates with D
+        set.  */
+      if (i.types[given].bitfield.class == RegSIMD
+         && t->operand_types[j].bitfield.class == RegSIMD
          && !match_simd_size (t, j, given))
        return match;
 
-      if (t->operand_types[j].bitfield.instance == Accum
-         && (!match_operand_size (t, j, given)
-             || !match_simd_size (t, j, given)))
-       return match;
-
       if ((i.flags[given] & Operand_Mem)
          && operand_type_check (t->operand_types[j], anymem)
          && !match_mem_size (t, j, given))