x86: don't play with cpu_arch_flags.cpu{,no}64
authorJan Beulich <jbeulich@suse.com>
Fri, 15 Sep 2023 07:56:33 +0000 (09:56 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 15 Sep 2023 07:56:33 +0000 (09:56 +0200)
A total four places exists where we set the two bits from flag_code, but
these values are never used. The two bits are evaluated only when coming
from insn templates.

Drop these assignments. Also make obvious that cpu_flags_check_cpu64()
is only ever used against insn templates.

gas/config/tc-i386.c

index 72e5729ce1cc18f04d64ee24f4be53f21233f4b0..f8d51afd2e41b372326406dc5ed5265742bfc61d 100644 (file)
@@ -1785,10 +1785,11 @@ cpu_flags_equal (const union i386_cpu_flags *x,
 }
 
 static INLINE int
-cpu_flags_check_cpu64 (i386_cpu_attr a)
+cpu_flags_check_cpu64 (const insn_template *t)
 {
-  return !((flag_code == CODE_64BIT && a.bitfield.cpuno64)
-          || (flag_code != CODE_64BIT && a.bitfield.cpu64));
+  return flag_code == CODE_64BIT
+        ? !t->cpu.bitfield.cpuno64
+        : !t->cpu.bitfield.cpu64;
 }
 
 static INLINE i386_cpu_flags
@@ -1883,7 +1884,7 @@ static int
 cpu_flags_match (const insn_template *t)
 {
   i386_cpu_flags x = cpu_flags_from_attr (t->cpu);
-  int match = cpu_flags_check_cpu64 (t->cpu) ? CPU_FLAGS_64BIT_MATCH : 0;
+  int match = cpu_flags_check_cpu64 (t) ? CPU_FLAGS_64BIT_MATCH : 0;
 
   x.bitfield.cpu64 = 0;
   x.bitfield.cpuno64 = 0;
@@ -2626,16 +2627,6 @@ update_code_flag (int value, int check)
     }
 
   flag_code = (enum flag_code) value;
-  if (flag_code == CODE_64BIT)
-    {
-      cpu_arch_flags.bitfield.cpu64 = 1;
-      cpu_arch_flags.bitfield.cpuno64 = 0;
-    }
-  else
-    {
-      cpu_arch_flags.bitfield.cpu64 = 0;
-      cpu_arch_flags.bitfield.cpuno64 = 1;
-    }
 
   stackop_size = '\0';
 }
@@ -2652,8 +2643,6 @@ set_16bit_gcc_code_flag (int new_code_flag)
   flag_code = (enum flag_code) new_code_flag;
   if (flag_code != CODE_16BIT)
     abort ();
-  cpu_arch_flags.bitfield.cpu64 = 0;
-  cpu_arch_flags.bitfield.cpuno64 = 1;
   stackop_size = LONG_MNEM_SUFFIX;
 }
 
@@ -2895,16 +2884,6 @@ set_cpu_arch (int dummy ATTRIBUTE_UNUSED)
          free (cpu_sub_arch_name);
          cpu_sub_arch_name = NULL;
          cpu_arch_flags = cpu_unknown_flags;
-         if (flag_code == CODE_64BIT)
-           {
-             cpu_arch_flags.bitfield.cpu64 = 1;
-             cpu_arch_flags.bitfield.cpuno64 = 0;
-           }
-         else
-           {
-             cpu_arch_flags.bitfield.cpu64 = 0;
-             cpu_arch_flags.bitfield.cpuno64 = 1;
-           }
          cpu_arch_isa = PROCESSOR_UNKNOWN;
          cpu_arch_isa_flags = cpu_arch[flag_code == CODE_64BIT].enable;
          if (!cpu_arch_tune_set)
@@ -2950,16 +2929,6 @@ set_cpu_arch (int dummy ATTRIBUTE_UNUSED)
              free (cpu_sub_arch_name);
              cpu_sub_arch_name = NULL;
              cpu_arch_flags = cpu_arch[j].enable;
-             if (flag_code == CODE_64BIT)
-               {
-                 cpu_arch_flags.bitfield.cpu64 = 1;
-                 cpu_arch_flags.bitfield.cpuno64 = 0;
-               }
-             else
-               {
-                 cpu_arch_flags.bitfield.cpu64 = 0;
-                 cpu_arch_flags.bitfield.cpuno64 = 1;
-               }
              cpu_arch_isa = cpu_arch[j].type;
              cpu_arch_isa_flags = cpu_arch[j].enable;
              if (!cpu_arch_tune_set)
@@ -5741,7 +5710,7 @@ parse_insn (const char *line, char *mnemonic, bool prefix_only)
          && current_templates
          && current_templates->start->opcode_modifier.isprefix)
        {
-         if (!cpu_flags_check_cpu64 (current_templates->start->cpu))
+         if (!cpu_flags_check_cpu64 (current_templates->start))
            {
              as_bad ((flag_code != CODE_64BIT
                       ? _("`%s' is only supported in 64-bit mode")