x86: don't recognize bnd<N> as registers without CpuMPX
authorJan Beulich <jbeulich@novell.com>
Thu, 26 Apr 2018 06:46:39 +0000 (08:46 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 26 Apr 2018 06:46:39 +0000 (08:46 +0200)
This is just like for all other extended/optional register sets.

gas/ChangeLog
gas/config/tc-i386.c
gas/testsuite/gas/i386/bnd.l [new file with mode: 0644]
gas/testsuite/gas/i386/bnd.s [new file with mode: 0644]
gas/testsuite/gas/i386/i386.exp

index 3131982ae981e3505868b8ed9bcac6fb9d47550d..a13f86f3966ce8f8e51ff994439ac44fc6f0381f 100644 (file)
@@ -1,3 +1,10 @@
+2018-04-26  Jan Beulich  <jbeulich@suse.com>
+
+       * config/tc-i386.c (parse_real_register): Check bnd<N>
+       registers.
+       * testsuite/gas/i386/bnd.s, testsuite/gas/i386/bnd.l: New.
+       * testsuite/gas/i386/i386.exp: Run new test.
+
 2018-04-26  Jan Beulich  <jbeulich@suse.com>
 
        * config/tc-i386.c (parse_real_register): Check FPU register
index fcd40e2db3839823c86afb557a8d9769d2313885..ccecddaa16bb2b8d386a1a023f91971a29b40d37 100644 (file)
@@ -10170,6 +10170,9 @@ parse_real_register (char *reg_string, char **end_op)
       && !cpu_arch_flags.bitfield.cpuregmask)
     return (const reg_entry *) NULL;
 
+  if (r->reg_type.bitfield.regbnd && !cpu_arch_flags.bitfield.cpumpx)
+    return (const reg_entry *) NULL;
+
   /* Don't allow fake index register unless allow_index_reg isn't 0. */
   if (!allow_index_reg
       && (r->reg_num == RegEiz || r->reg_num == RegRiz))
diff --git a/gas/testsuite/gas/i386/bnd.l b/gas/testsuite/gas/i386/bnd.l
new file mode 100644 (file)
index 0000000..4222896
--- /dev/null
@@ -0,0 +1,12 @@
+.*: Assembler messages:
+.*:6: Error: .*`bndmov'.*
+GAS LISTING .*
+
+
+[      ]*1[    ]+\.text
+[      ]*2[    ]+\.intel_syntax noprefix
+[      ]*3[    ]+\.arch generic32
+[      ]*4[    ]+bnd:
+[      ]*5[    ]+\?\?\?\? A1000000[    ]+mov   eax, bnd0
+[      ]*5[    ]+00
+[      ]*6[    ]+bndmov        bnd0, bnd0
diff --git a/gas/testsuite/gas/i386/bnd.s b/gas/testsuite/gas/i386/bnd.s
new file mode 100644 (file)
index 0000000..9ca4ce7
--- /dev/null
@@ -0,0 +1,6 @@
+       .text
+       .intel_syntax noprefix
+       .arch generic32
+bnd:
+       mov     eax, bnd0
+       bndmov  bnd0, bnd0
index 95e3469e96f47f28af1b466dd0ea0597ed0828d4..62c03d815af403ebbf8f7dbf0bfe6c0b2e4c80a1 100644 (file)
@@ -294,6 +294,7 @@ if [expr ([istarget "i*86-*-*"] ||  [istarget "x86_64-*-*"]) && [gas_32_check]]
     run_list_test "mpx-inval-1" "-al"
     run_list_test "mpx-inval-2" "-al"
     run_dump_test "mpx-add-bnd-prefix"
+    run_list_test "bnd" "-al"
     run_dump_test "sha"
     run_dump_test "clflushopt"
     run_dump_test "clflushopt-intel"