From 1e66f4c55f83ba4d27330312aefdd4fbdf56cb43 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Fri, 19 May 2023 09:19:10 +0200 Subject: [PATCH] x86: permit all relational operators in insn operands Oddly enough == and != were not permitted, because of '=' not having been listed in operand_special_chars[]. --- gas/config/tc-i386.c | 2 +- gas/testsuite/gas/i386/cond.d | 17 +++++++++++++++++ gas/testsuite/gas/i386/cond.s | 10 ++++++++++ gas/testsuite/gas/i386/i386.exp | 1 + 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 gas/testsuite/gas/i386/cond.d create mode 100644 gas/testsuite/gas/i386/cond.s diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index f9482a0ba4d..ca3626e3069 100644 --- 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 diff --git a/gas/testsuite/gas/i386/cond.d b/gas/testsuite/gas/i386/cond.d new file mode 100644 index 00000000000..8c31342ac4c --- /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+ : + +[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 index 00000000000..8aea7cfe99f --- /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 diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp index 62796c71551..dc29b5112ab 100644 --- a/gas/testsuite/gas/i386/i386.exp +++ b/gas/testsuite/gas/i386/i386.exp @@ -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" -- 2.30.2