x86: permit all relational operators in insn operands

Message ID 61663a6c-a5a4-812a-1110-06e0122aabba@suse.com
State Accepted
Headers
Series x86: permit all relational operators in insn operands |

Checks

Context Check Description
snail/binutils-gdb-check success Github commit url

Commit Message

Jan Beulich May 17, 2023, 11 a.m. UTC
  Oddly enough == and != were not permitted, because of '=' not having
been listed in operand_special_chars[].
  

Patch

--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -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
--- /dev/null
+++ b/gas/testsuite/gas/i386/cond.d
@@ -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
--- /dev/null
+++ b/gas/testsuite/gas/i386/cond.s
@@ -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
--- a/gas/testsuite/gas/i386/i386.exp
+++ b/gas/testsuite/gas/i386/i386.exp
@@ -754,6 +754,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"