aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2018-04-26 08:45:35 +0200
committerJan Beulich <jbeulich@suse.com>2018-04-26 08:45:35 +0200
commit0e0eea782025d92f894f6d132aae2507c6a90a7b (patch)
tree5f39ceb89a86e72bcaf7f14070e8749f9f119b13 /gas
parentbed3d976b7a4fd111f3e291f1bd896cf441b3479 (diff)
downloadfsf-binutils-gdb-0e0eea782025d92f894f6d132aae2507c6a90a7b.zip
fsf-binutils-gdb-0e0eea782025d92f894f6d132aae2507c6a90a7b.tar.gz
fsf-binutils-gdb-0e0eea782025d92f894f6d132aae2507c6a90a7b.tar.bz2
x86: x87-related adjustments
Neither 287 wrt 8087 nor 387 wrt 287 are proper supersets - in each case some insns get removed from the ISA (they become NOPs, but code intended for newer co-processors should not use them). Furthermore with .no87, ST should not be recognized as a register name.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog8
-rw-r--r--gas/config/tc-i386.c11
-rw-r--r--gas/testsuite/gas/i386/fpu.l4
-rw-r--r--gas/testsuite/gas/i386/fpu.s12
-rw-r--r--gas/testsuite/gas/i386/i386.exp2
-rw-r--r--gas/testsuite/gas/i386/stN.l16
-rw-r--r--gas/testsuite/gas/i386/stN.s8
7 files changed, 55 insertions, 6 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index c1109a7..3131982 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,13 @@
2018-04-26 Jan Beulich <jbeulich@suse.com>
+ * config/tc-i386.c (parse_real_register): Check FPU register
+ earlier.
+ * testsuite/gas/i386/fpu.s, testsuite/gas/i386/fpu.l,
+ testsuite/gas/i386/stN.s, testsuite/gas/i386/stN.l: New.
+ * testsuite/gas/i386/i386.exp: Run new tests.
+
+2018-04-26 Jan Beulich <jbeulich@suse.com>
+
* config/tc-i386.c (build_modrm_byte): Use tabs for indentation.
2018-04-26 Jan Beulich <jbeulich@suse.com>
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 42186ff..fcd40e2 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -10109,6 +10109,11 @@ parse_real_register (char *reg_string, char **end_op)
/* Handle floating point regs, allowing spaces in the (i) part. */
if (r == i386_regtab /* %st is first entry of table */)
{
+ if (!cpu_arch_flags.bitfield.cpu8087
+ && !cpu_arch_flags.bitfield.cpu287
+ && !cpu_arch_flags.bitfield.cpu387)
+ return (const reg_entry *) NULL;
+
if (is_space_char (*s))
++s;
if (*s == '(')
@@ -10149,12 +10154,6 @@ parse_real_register (char *reg_string, char **end_op)
&& !cpu_arch_flags.bitfield.cpui386)
return (const reg_entry *) NULL;
- if (r->reg_type.bitfield.tbyte
- && !cpu_arch_flags.bitfield.cpu8087
- && !cpu_arch_flags.bitfield.cpu287
- && !cpu_arch_flags.bitfield.cpu387)
- return (const reg_entry *) NULL;
-
if (r->reg_type.bitfield.regmmx && !cpu_arch_flags.bitfield.cpuregmmx)
return (const reg_entry *) NULL;
diff --git a/gas/testsuite/gas/i386/fpu.l b/gas/testsuite/gas/i386/fpu.l
new file mode 100644
index 0000000..531884c
--- /dev/null
+++ b/gas/testsuite/gas/i386/fpu.l
@@ -0,0 +1,4 @@
+.*: Assembler messages:
+.*:6: Error: .*`fneni'.*
+.*:11: Error: .*`fneni'.*
+.*:12: Error: .*`fnsetpm'.*
diff --git a/gas/testsuite/gas/i386/fpu.s b/gas/testsuite/gas/i386/fpu.s
new file mode 100644
index 0000000..4ddcb33
--- /dev/null
+++ b/gas/testsuite/gas/i386/fpu.s
@@ -0,0 +1,12 @@
+ .text
+ .intel_syntax noprefix
+ .arch generic32
+fpu:
+ .arch .287
+ fneni
+ fnsetpm
+
+ .arch .no287
+ .arch .387
+ fneni
+ fnsetpm
diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp
index 91d91d6..95e3469 100644
--- a/gas/testsuite/gas/i386/i386.exp
+++ b/gas/testsuite/gas/i386/i386.exp
@@ -170,6 +170,8 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_32_check]]
run_list_test "no87" "-al"
run_list_test "no87-2" "-march=i686+no87 -al"
run_list_test "no87-3" "-al"
+ run_list_test "stN" "-al"
+ run_list_test "fpu"
run_list_test "nommx-1" "-al"
run_list_test "nommx-2" "-march=core+nommx -al"
run_list_test "nommx-3" "-march=+nommx -al"
diff --git a/gas/testsuite/gas/i386/stN.l b/gas/testsuite/gas/i386/stN.l
new file mode 100644
index 0000000..5885686
--- /dev/null
+++ b/gas/testsuite/gas/i386/stN.l
@@ -0,0 +1,16 @@
+.*: Assembler messages:
+.*:6: Error: .*junk.*
+.*:7: Error: .*junk.*
+.*:8: Error: .*junk.*
+GAS LISTING .*
+
+
+[ ]*1[ ]+\.text
+[ ]*2[ ]+\.intel_syntax noprefix
+[ ]*3[ ]+\.arch \.no87
+[ ]*4[ ]+stN:
+[ ]*5[ ]+\?\?\?\? A1000000[ ]+mov eax, st
+[ ]*5[ ]+00
+[ ]*6[ ]+mov eax, st\(7\)
+[ ]*7[ ]+mov eax, st \( 7 \)
+[ ]*8[ ]+mov eax, x\(7\)
diff --git a/gas/testsuite/gas/i386/stN.s b/gas/testsuite/gas/i386/stN.s
new file mode 100644
index 0000000..6a1512e
--- /dev/null
+++ b/gas/testsuite/gas/i386/stN.s
@@ -0,0 +1,8 @@
+ .text
+ .intel_syntax noprefix
+ .arch .no87
+stN:
+ mov eax, st
+ mov eax, st(7)
+ mov eax, st ( 7 )
+ mov eax, x(7)