diff options
author | Jan Beulich <jbeulich@suse.com> | 2024-07-19 11:52:21 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2024-07-19 11:52:21 +0200 |
commit | 3fea91b17da717d19e73f073501307d2f0bbeb2b (patch) | |
tree | 446975de10fc3c478733c9246fffbd40a6ccbd72 /gas | |
parent | 0ff4e567db6c3c9da83073fe6abe27f561a2475b (diff) | |
download | gdb-3fea91b17da717d19e73f073501307d2f0bbeb2b.zip gdb-3fea91b17da717d19e73f073501307d2f0bbeb2b.tar.gz gdb-3fea91b17da717d19e73f073501307d2f0bbeb2b.tar.bz2 |
x86: accept whitespace inside curly braces
Other than documented /**/ comments currently aren't really converted to
a single space, at least not for x86 in its most common configurations.
That'll be fixed subsequently, at which point blanks may appear where so
far none were expected. Furthermore not permitting blanks immediately
inside curly braces wasn't quite logical anyway - such constructs are
composite ones, and hence components ought to have been permitted to be
separated by whitespace from the very beginning.
With this we also don't care anymore whether the scrubber would remove
whitespace around curly braces, so move them from extra_symbol_chars[]
to operand_special_chars[].
Note: The new testcase doesn't actually exercise much (if any) of the
added code. It is being put in place to ensure that subsequently, when
that code actually comes into play, behavior remains the same.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/config/tc-i386.c | 23 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/curly.d | 28 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/curly.s | 26 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/i386.exp | 1 |
4 files changed, 73 insertions, 5 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index bbc8618..f7be075 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -526,7 +526,7 @@ static const unsigned char i386_seg_prefixes[] = { /* List of chars besides those in app.c:symbol_chars that can start an operand. Used to prevent the scrubber eating vital white-space. */ -const char extra_symbol_chars[] = "*%-([{}" +const char extra_symbol_chars[] = "*%-([" #ifdef LEX_AT "@" #endif @@ -587,7 +587,7 @@ static char operand_chars[256]; /* All non-digit non-letter characters that may occur in an operand and which aren't already in extra_symbol_chars[]. */ -static const char operand_special_chars[] = "$+,)._~/<>|&^!=:@]"; +static const 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 @@ -7856,6 +7856,8 @@ parse_insn (const char *line, char *mnemonic, enum parse_mode mode) { ++mnem_p; ++l; + if (is_space_char (*l)) + ++l; } else if (mode == parse_pseudo_prefix) break; @@ -7873,6 +7875,8 @@ parse_insn (const char *line, char *mnemonic, enum parse_mode mode) l++; } /* Pseudo-prefixes end with a closing figure brace. */ + if (*mnemonic == '{' && is_space_char (*l)) + ++l; if (*mnemonic == '{' && *l == '}') { *mnem_p++ = *l++; @@ -14468,6 +14472,8 @@ check_VecOperations (char *op_string) if (*op_string == '{') { op_string++; + if (is_space_char (*op_string)) + op_string++; /* Check broadcasts. */ if (startswith (op_string, "1to")) @@ -14638,6 +14644,8 @@ check_VecOperations (char *op_string) else goto unknown_vec_op; + if (is_space_char (*op_string)) + op_string++; if (*op_string != '}') { as_bad (_("missing `}' in `%s'"), saved); @@ -14645,8 +14653,6 @@ check_VecOperations (char *op_string) } op_string++; - /* Strip whitespace since the addition of pseudo prefixes - changed how the scrubber treats '{'. */ if (is_space_char (*op_string)) ++op_string; @@ -15308,10 +15314,17 @@ RC_SAE_immediate (const char *imm_start) if (*pstr != '{') return 0; - pstr = RC_SAE_specifier (pstr + 1); + pstr++; + if (is_space_char (*pstr)) + pstr++; + + pstr = RC_SAE_specifier (pstr); if (pstr == NULL) return 0; + if (is_space_char (*pstr)) + pstr++; + if (*pstr++ != '}') { as_bad (_("Missing '}': '%s'"), imm_start); diff --git a/gas/testsuite/gas/i386/curly.d b/gas/testsuite/gas/i386/curly.d new file mode 100644 index 0000000..17418ac --- /dev/null +++ b/gas/testsuite/gas/i386/curly.d @@ -0,0 +1,28 @@ +#objdump: -dw +#name: i386 curly braces with blanks + +.*: +file format .* + +Disassembly of section .text: + +0+ <curly>: +[ ]*[a-f0-9]+: 62 f1 74 58 58 10 vaddps \(%eax\)\{1to16\},%zmm1,%zmm2 +[ ]*[a-f0-9]+: 62 f1 74 58 58 10 vaddps \(%eax\)\{1to16\},%zmm1,%zmm2 +[ ]*[a-f0-9]+: 62 f1 74 58 58 10 vaddps \(%eax\)\{1to16\},%zmm1,%zmm2 +[ ]*[a-f0-9]+: 62 f1 74 58 58 10 vaddps \(%eax\)\{1to16\},%zmm1,%zmm2 +[ ]*[a-f0-9]+: 62 f1 74 18 58 d0 vaddps \{rn-sae\},%zmm0,%zmm1,%zmm2 +[ ]*[a-f0-9]+: 62 f1 74 18 58 d0 vaddps \{rn-sae\},%zmm0,%zmm1,%zmm2 +[ ]*[a-f0-9]+: 62 f1 74 18 58 d0 vaddps \{rn-sae\},%zmm0,%zmm1,%zmm2 +[ ]*[a-f0-9]+: 62 f1 74 cb 58 d0 vaddps %zmm0,%zmm1,%zmm2\{%k3\}\{z\} +[ ]*[a-f0-9]+: 62 f1 74 cb 58 d0 vaddps %zmm0,%zmm1,%zmm2\{%k3\}\{z\} +[ ]*[a-f0-9]+: 62 f1 74 cb 58 d0 vaddps %zmm0,%zmm1,%zmm2\{%k3\}\{z\} +[ ]*[a-f0-9]+: 62 f1 74 cb 58 d0 vaddps %zmm0,%zmm1,%zmm2\{%k3\}\{z\} +[ ]*[a-f0-9]+: 62 f1 74 cb 58 d0 vaddps %zmm0,%zmm1,%zmm2\{%k3\}\{z\} +[ ]*[a-f0-9]+: 62 f1 74 cb 58 d0 vaddps %zmm0,%zmm1,%zmm2\{%k3\}\{z\} +[ ]*[a-f0-9]+: 62 f1 74 08 58 d0 \{evex\} vaddps %xmm0,%xmm1,%xmm2 +[ ]*[a-f0-9]+: 62 f1 74 08 58 d0 \{evex\} vaddps %xmm0,%xmm1,%xmm2 +[ ]*[a-f0-9]+: 62 f1 74 08 58 d0 \{evex\} vaddps %xmm0,%xmm1,%xmm2 +[ ]*[a-f0-9]+: 62 f1 74 18 58 c2 vaddps \{rn-sae\},%zmm2,%zmm1,%zmm0 +[ ]*[a-f0-9]+: 62 f1 74 18 58 c2 vaddps \{rn-sae\},%zmm2,%zmm1,%zmm0 +[ ]*[a-f0-9]+: 62 f1 74 18 58 c2 vaddps \{rn-sae\},%zmm2,%zmm1,%zmm0 +#pass diff --git a/gas/testsuite/gas/i386/curly.s b/gas/testsuite/gas/i386/curly.s new file mode 100644 index 0000000..f786f32 --- /dev/null +++ b/gas/testsuite/gas/i386/curly.s @@ -0,0 +1,26 @@ + .text +curly: + vaddps (%eax) {1to16}, %zmm1, %zmm2 + vaddps (%eax){ 1to16}, %zmm1, %zmm2 + vaddps (%eax){1to16 }, %zmm1, %zmm2 + vaddps (%eax){1to16} , %zmm1, %zmm2 + + vaddps { rn-sae}, %zmm0, %zmm1, %zmm2 + vaddps {rn-sae }, %zmm0, %zmm1, %zmm2 + vaddps {rn-sae} , %zmm0, %zmm1, %zmm2 + + vaddps %zmm0, %zmm1, %zmm2 {%k3}{z} + vaddps %zmm0, %zmm1, %zmm2{ %k3}{z} + vaddps %zmm0, %zmm1, %zmm2{%k3 }{z} + vaddps %zmm0, %zmm1, %zmm2{%k3} {z} + vaddps %zmm0, %zmm1, %zmm2{%k3}{ z} + vaddps %zmm0, %zmm1, %zmm2{%k3}{z } + + { evex} vaddps %xmm0, %xmm1, %xmm2 + {evex } vaddps %xmm0, %xmm1, %xmm2 + {evex}vaddps %xmm0, %xmm1, %xmm2 + + .intel_syntax noprefix + vaddps zmm0, zmm1, zmm2 {rn-sae} + vaddps zmm0, zmm1, zmm2{ rn-sae} + vaddps zmm0, zmm1, zmm2{rn-sae } diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp index e40b45f..facb4ed 100644 --- a/gas/testsuite/gas/i386/i386.exp +++ b/gas/testsuite/gas/i386/i386.exp @@ -105,6 +105,7 @@ if [gas_32_check] then { run_dump_test "equ" run_list_test "equ-2" "-al" run_list_test "equ-bad" + run_dump_test "curly" run_dump_test "divide" run_dump_test "quoted" run_dump_test "quoted2" |