x86: permit all relational operators in insn operands
authorJan Beulich <jbeulich@suse.com>
Fri, 19 May 2023 07:19:10 +0000 (09:19 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 19 May 2023 07:19:10 +0000 (09:19 +0200)
Oddly enough == and != were not permitted, because of '=' not having
been listed in operand_special_chars[].

gas/config/tc-i386.c
gas/testsuite/gas/i386/cond.d [new file with mode: 0644]
gas/testsuite/gas/i386/cond.s [new file with mode: 0644]
gas/testsuite/gas/i386/i386.exp

index f9482a0ba4d699a5fd9ac5e3e0ea6bd3a121bd85..ca3626e30698e1a01e884580be91b27813225efd 100644 (file)
@@ -547,7 +547,7 @@ static char operand_chars[256];
 #define is_space_char(x) ((x) == ' ')
 
 /* All non-digit non-letter characters that may occur in an operand.  */
-static char operand_special_chars[] = "%$-+(,)*._~/<>|&^!:[@]";
+static char operand_special_chars[] = "%$-+(,)*._~/<>|&^!=:[@]";
 
 /* md_assemble() always leaves the strings it's passed unaltered.  To
    effect this we maintain a stack of saved characters that we've smashed
diff --git a/gas/testsuite/gas/i386/cond.d b/gas/testsuite/gas/i386/cond.d
new file mode 100644 (file)
index 0000000..8c31342
--- /dev/null
@@ -0,0 +1,17 @@
+#objdump: -dw
+#name: x86 conditional operators in insn operands
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <cond>:
+ +[a-f0-9]+:   b8 01 00 00 00 +        mov +\$(0x)?1,%eax
+ +[a-f0-9]+:   b9 ff ff ff ff +        mov +\$0xffffffff,%ecx
+ +[a-f0-9]+:   ba ff ff ff ff +        mov +\$0xffffffff,%edx
+ +[a-f0-9]+:   bb ff ff ff ff +        mov +\$0xffffffff,%ebx
+ +[a-f0-9]+:   bc ff ff ff ff +        mov +\$0xffffffff,%esp
+ +[a-f0-9]+:   bd ff ff ff ff +        mov +\$0xffffffff,%ebp
+ +[a-f0-9]+:   be ff ff ff ff +        mov +\$0xffffffff,%esi
+ +[a-f0-9]+:   bf ff ff ff ff +        mov +\$0xffffffff,%edi
+#pass
diff --git a/gas/testsuite/gas/i386/cond.s b/gas/testsuite/gas/i386/cond.s
new file mode 100644 (file)
index 0000000..8aea7cf
--- /dev/null
@@ -0,0 +1,10 @@
+       .text
+cond:
+       mov     $!0, %eax
+       mov     $1 <> 0, %ecx
+       mov     $1 != 0, %edx
+       mov     $0 == 0, %ebx
+       mov     $0 < 1, %esp
+       mov     $0 <= 0, %ebp
+       mov     $1 > 0, %esi
+       mov     $0 >= 0, %edi
index 62796c71551c30c3428853bc677458347fd1b0f6..dc29b5112ab75a9b4d296d618b3b0a0bbabda839 100644 (file)
@@ -755,6 +755,7 @@ run_dump_test pr19498
 run_list_test "nop-bad-1" ""
 run_list_test "unspec" ""
 run_dump_test "fp"
+run_dump_test "cond"
 run_dump_test pr30248
 if {[is_elf_format] || [istarget "*-*-vxworks*"]} then {
     run_list_test_stdin "list-1" "-al"