mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-28 04:25:10 +08:00
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.
This commit is contained in:
parent
0ff4e567db
commit
3fea91b17d
@ -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);
|
||||
|
28
gas/testsuite/gas/i386/curly.d
Normal file
28
gas/testsuite/gas/i386/curly.d
Normal file
@ -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
|
26
gas/testsuite/gas/i386/curly.s
Normal file
26
gas/testsuite/gas/i386/curly.s
Normal file
@ -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 }
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user