Correct CpuMax in i386-opc.h
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 27 May 2016 13:55:42 +0000 (06:55 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Fri, 27 May 2016 13:55:53 +0000 (06:55 -0700)
CpuMax should be CpuIntel64, not CpuNo64.  i386-gen.c is updated to
verify that CpuMax is correct.  X86 assembler is updated to properly
set cpuamd64 and cpuintel64.

gas/

PR gas/20154
* config/tc-i386.c (intel64): New.
(cpu_flags_match): Set cpuamd64 and cpuintel64.
(md_parse_option): Set intel64 instead of cpuamd64 and
cpuintel64.

opcodes/

PR gas/20154
* i386-gen.c (main): Fail if CpuMax is incorrect.
* i386-opc.h (CpuMax): Set to CpuIntel64.
* i386-tbl.h: Regenerated.

gas/ChangeLog
gas/config/tc-i386.c
opcodes/ChangeLog
opcodes/i386-gen.c
opcodes/i386-opc.h
opcodes/i386-tbl.h

index 0411e675dd246ab872fed0a8fcb12e8f7269ec64..042b6985ad03093c8379a6b25b503d7c9494f995 100644 (file)
@@ -1,3 +1,11 @@
+2016-05-27  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR gas/20154
+       * config/tc-i386.c (intel64): New.
+       (cpu_flags_match): Set cpuamd64 and cpuintel64.
+       (md_parse_option): Set intel64 instead of cpuamd64 and
+       cpuintel64.
+
 2016-05-27  H.J. Lu  <hongjiu.lu@intel.com>
 
        * config/tc-i386.c (cpu_flags_match): Don't clear cpu64 nor
index fb3f369dc73b5b3b92021e8d88ec09bd3b4cfd0e..f8a3bf099953b840fc2f95472c62fd03ab71ceff 100644 (file)
@@ -535,6 +535,10 @@ static int shared = 0;
    0 if att syntax.  */
 static int intel_syntax = 0;
 
+/* 1 for Intel64 ISA,
+   0 if AMD64 ISA.  */
+static int intel64;
+
 /* 1 for intel mnemonic,
    0 if att mnemonic.  */
 static int intel_mnemonic = !SYSV386_COMPAT;
@@ -1537,6 +1541,11 @@ cpu_flags_match (const insn_template *t)
       /* This instruction is available only on some archs.  */
       i386_cpu_flags cpu = cpu_arch_flags;
 
+      /* Set cpuamd64 and cpuintel64 here since they may be changed by
+        set_cpu_arch.  */
+      cpu_arch_flags.bitfield.cpuamd64 = !intel64;
+      cpu_arch_flags.bitfield.cpuintel64 = intel64;
+
       cpu = cpu_flags_and (x, cpu);
       if (!cpu_flags_all_zero (&cpu))
        {
@@ -10107,17 +10116,11 @@ md_parse_option (int c, const char *arg)
       break;
 
     case OPTION_MAMD64:
-      cpu_arch_flags.bitfield.cpuamd64 = 1;
-      cpu_arch_flags.bitfield.cpuintel64 = 0;
-      cpu_arch_isa_flags.bitfield.cpuamd64 = 1;
-      cpu_arch_isa_flags.bitfield.cpuintel64 = 0;
+      intel64 = 0;
       break;
 
     case OPTION_MINTEL64:
-      cpu_arch_flags.bitfield.cpuamd64 = 0;
-      cpu_arch_flags.bitfield.cpuintel64 = 1;
-      cpu_arch_isa_flags.bitfield.cpuamd64 = 0;
-      cpu_arch_isa_flags.bitfield.cpuintel64 = 1;
+      intel64 = 1;
       break;
 
     default:
index 82e3143e1ed39bf9dcd71f09fdbba73e03d4a0b9..eacd10beef53a879b7977de8298a426168d19a11 100644 (file)
@@ -1,3 +1,10 @@
+2016-05-27  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR gas/20154
+       * i386-gen.c (main): Fail if CpuMax is incorrect.
+       * i386-opc.h (CpuMax): Set to CpuIntel64.
+       * i386-tbl.h: Regenerated.
+
 2016-05-27  Nick Clifton  <nickc@redhat.com>
 
        PR target/20150
index b19bbe12d7e72875b20ed4b825c6e952b65c71a0..0afdc90c716be05c36af3dfec38292414d2ec4a6 100644 (file)
@@ -1379,7 +1379,16 @@ main (int argc, char **argv)
            srcdir, xstrerror (errno));
 
   /* Check the unused bitfield in i386_cpu_flags.  */
-#ifndef CpuUnused
+#ifdef CpuUnused
+  if (cpu_flags[ARRAY_SIZE (cpu_flags) - 2].position != CpuMax)
+    fail (_("CpuMax != %d!\n"),
+         cpu_flags[ARRAY_SIZE (cpu_flags) - 2].position);
+
+#else
+  if (cpu_flags[ARRAY_SIZE (cpu_flags) - 1].position != CpuMax)
+    fail (_("CpuMax != %d!\n"),
+         cpu_flags[ARRAY_SIZE (cpu_flags) - 1].position);
+
   c = CpuNumOfBits - CpuMax - 1;
   if (c)
     fail (_("%d unused bits in i386_cpu_flags.\n"), c);
index a93c1f39084e2505ceea7d6e5530d649817945d8..0782b1a9c5d3cd8aaa772269fc98a531c78e7b69 100644 (file)
@@ -211,7 +211,7 @@ enum
   /* Intel64 support required  */
   CpuIntel64,
   /* The last bitfield in i386_cpu_flags.  */
-  CpuMax = CpuNo64
+  CpuMax = CpuIntel64
 };
 
 #define CpuNumOfUints \
index 70e10fb9b094598a08b4092c66057ca69ec42cc7..5c5a9917b067c22eb8b3382e9cf6c7b053afcc45 100644 (file)
@@ -3200,7 +3200,7 @@ const insn_template i386_optab[] =
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 1, 0, 0, 0, 1 } },
+        0, 0, 0, 0, 0, 1, 0, 0, 1, 0 } },
     { 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,
       1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -3323,7 +3323,7 @@ const insn_template i386_optab[] =
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 1, 0, 0, 0, 1 } },
+        0, 0, 0, 0, 0, 1, 0, 0, 1, 0 } },
     { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
       1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
This page took 0.075154 seconds and 4 git commands to generate.