+2021-06-07 Jan Beulich <jbeulich@suse.com>
+
+ * config/tc-i386.c (digit_chars, is_digit_char): Delete.
+ (md_begin): Fold digit and lower-case letter handling.
+ (starts_memory_operand): Permit more characters.
+ * testsuite/gas/i386/unary.s, testsuite/gas/i386/unary.d: New.
+ * testsuite/gas/i386/i386.exp: Run new test.
+
2021-06-07 Jan Beulich <jbeulich@suse.com>
* config/tc-i386.c (starts_memory_operand): New.
static char register_chars[256];
static char operand_chars[256];
static char identifier_chars[256];
-static char digit_chars[256];
/* Lexical macros. */
#define is_mnemonic_char(x) (mnemonic_chars[(unsigned char) x])
#define is_register_char(x) (register_chars[(unsigned char) x])
#define is_space_char(x) ((x) == ' ')
#define is_identifier_char(x) (identifier_chars[(unsigned char) x])
-#define is_digit_char(x) (digit_chars[(unsigned char) x])
/* All non-digit non-letter characters that may occur in an operand. */
static char operand_special_chars[] = "%$-+(,)*._~/<>|&^!:[@]";
for (c = 0; c < 256; c++)
{
- if (ISDIGIT (c))
- {
- digit_chars[c] = c;
- mnemonic_chars[c] = c;
- register_chars[c] = c;
- operand_chars[c] = c;
- }
- else if (ISLOWER (c))
+ if (ISDIGIT (c) || ISLOWER (c))
{
mnemonic_chars[c] = c;
register_chars[c] = c;
identifier_chars['?'] = '?';
operand_chars['?'] = '?';
#endif
- digit_chars['-'] = '-';
mnemonic_chars['_'] = '_';
mnemonic_chars['-'] = '-';
mnemonic_chars['.'] = '.';
static INLINE bool starts_memory_operand (char c)
{
- return is_digit_char (c)
+ return ISDIGIT (c)
|| is_identifier_char (c)
- || c == '"'
- || c == '(';
+ || strchr ("([\"+-!~", c);
}
/* Parse OPERAND_STRING into the i386_insn structure I. Returns zero
--- /dev/null
+#objdump: -dr
+#name: i386 memory operands w/ unary operators
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+ <unary>:
+[ ]*[a-f0-9]+:[ ]*8b 40 01[ ]+mov 0x1\(%eax\),%eax
+[ ]*[a-f0-9]+:[ ]*8b 40 ff[ ]+mov -0x1\(%eax\),%eax
+[ ]*[a-f0-9]+:[ ]*8b 00[ ]+mov \(%eax\),%eax
+[ ]*[a-f0-9]+:[ ]*8b 40 fe[ ]+mov -0x2\(%eax\),%eax
+[ ]*[a-f0-9]+:[ ]*8b 40 01[ ]+mov 0x1\(%eax\),%eax
+[ ]*[a-f0-9]+:[ ]*8b 40 ff[ ]+mov -0x1\(%eax\),%eax
+[ ]*[a-f0-9]+:[ ]*8b 00[ ]+mov \(%eax\),%eax
+[ ]*[a-f0-9]+:[ ]*8b 40 fe[ ]+mov -0x2\(%eax\),%eax
+#pass