mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-24 04:00:07 +08:00
Add support for & | << >> ~ arithmetic operators in Intel mode
This commit is contained in:
@ -1,3 +1,18 @@
|
|||||||
|
2004-07-13 Thomas Nystrom <thn@saeab.se>
|
||||||
|
|
||||||
|
* config/tc-i386.c (T_SHIFTOP): New constant.
|
||||||
|
(intel_e05_1): Handle '&', '|' and T_SHIFTOP.
|
||||||
|
(intel_el1): Handle '~'.
|
||||||
|
(intel_get_token): Handle '<>', '&', '|' and '~'.
|
||||||
|
|
||||||
|
2004-07-13 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
|
(md_assemble): Remove spurious newline from end of as_bad error
|
||||||
|
message.
|
||||||
|
(intel_e05_1): Likewise.
|
||||||
|
(intel_e11): Likewise.
|
||||||
|
(intel_match_token): Likewise.
|
||||||
|
|
||||||
2004-07-11 Andreas Schwab <schwab@suse.de>
|
2004-07-11 Andreas Schwab <schwab@suse.de>
|
||||||
|
|
||||||
* config/tc-m68k.c: Convert to C90. Remove redundant
|
* config/tc-m68k.c: Convert to C90. Remove redundant
|
||||||
|
2
gas/NEWS
2
gas/NEWS
@ -12,6 +12,8 @@
|
|||||||
* Support for ColdFire EMAC instructions added and Motorola syntax for MAC/EMAC
|
* Support for ColdFire EMAC instructions added and Motorola syntax for MAC/EMAC
|
||||||
instrucitons.
|
instrucitons.
|
||||||
|
|
||||||
|
Changes in 2.15:
|
||||||
|
|
||||||
* The MIPS -membedded-pic option (Embedded-PIC code generation) is
|
* The MIPS -membedded-pic option (Embedded-PIC code generation) is
|
||||||
deprecated and will be removed in a future release.
|
deprecated and will be removed in a future release.
|
||||||
|
|
||||||
|
@ -1476,7 +1476,7 @@ md_assemble (line)
|
|||||||
{
|
{
|
||||||
/* In case it is "hi" register, give up. */
|
/* In case it is "hi" register, give up. */
|
||||||
if (i.op[x].regs->reg_num > 3)
|
if (i.op[x].regs->reg_num > 3)
|
||||||
as_bad (_("can't encode register '%%%s' in an instruction requiring REX prefix.\n"),
|
as_bad (_("can't encode register '%%%s' in an instruction requiring REX prefix."),
|
||||||
i.op[x].regs->reg_name);
|
i.op[x].regs->reg_name);
|
||||||
|
|
||||||
/* Otherwise it is equivalent to the extended register.
|
/* Otherwise it is equivalent to the extended register.
|
||||||
@ -5350,7 +5350,7 @@ tc_gen_reloc (section, fixp)
|
|||||||
|
|
||||||
Initial production is 'expr'.
|
Initial production is 'expr'.
|
||||||
|
|
||||||
addOp + | -
|
addOp + | - | & | \| | << | >>
|
||||||
|
|
||||||
alpha [a-zA-Z]
|
alpha [a-zA-Z]
|
||||||
|
|
||||||
@ -5387,6 +5387,7 @@ tc_gen_reloc (section, fixp)
|
|||||||
| id
|
| id
|
||||||
| $
|
| $
|
||||||
| register
|
| register
|
||||||
|
| ~
|
||||||
|
|
||||||
=> expr SHORT e05
|
=> expr SHORT e05
|
||||||
| e05
|
| e05
|
||||||
@ -5455,6 +5456,7 @@ tc_gen_reloc (section, fixp)
|
|||||||
| $
|
| $
|
||||||
| register
|
| register
|
||||||
| id
|
| id
|
||||||
|
| ~
|
||||||
| constant */
|
| constant */
|
||||||
|
|
||||||
/* Parsing structure for the intel syntax parser. Used to implement the
|
/* Parsing structure for the intel syntax parser. Used to implement the
|
||||||
@ -5496,6 +5498,7 @@ static struct intel_token cur_token, prev_token;
|
|||||||
#define T_OFFSET 9
|
#define T_OFFSET 9
|
||||||
#define T_PTR 10
|
#define T_PTR 10
|
||||||
#define T_ID 11
|
#define T_ID 11
|
||||||
|
#define T_SHIFTOP 12
|
||||||
|
|
||||||
/* Prototypes for intel parser functions. */
|
/* Prototypes for intel parser functions. */
|
||||||
static int intel_match_token PARAMS ((int code));
|
static int intel_match_token PARAMS ((int code));
|
||||||
@ -5615,7 +5618,9 @@ static int
|
|||||||
intel_e05_1 ()
|
intel_e05_1 ()
|
||||||
{
|
{
|
||||||
/* e05' addOp e06 e05' */
|
/* e05' addOp e06 e05' */
|
||||||
if (cur_token.code == '+' || cur_token.code == '-')
|
if (cur_token.code == '+' || cur_token.code == '-'
|
||||||
|
|| cur_token.code == '&' || cur_token.code == '|'
|
||||||
|
|| cur_token.code == T_SHIFTOP)
|
||||||
{
|
{
|
||||||
strcat (intel_parser.disp, cur_token.str);
|
strcat (intel_parser.disp, cur_token.str);
|
||||||
intel_match_token (cur_token.code);
|
intel_match_token (cur_token.code);
|
||||||
@ -5717,7 +5722,7 @@ intel_e09_1 ()
|
|||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
as_bad (_("Unknown operand modifier `%s'\n"), prev_token.str);
|
as_bad (_("Unknown operand modifier `%s'"), prev_token.str);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5801,6 +5806,7 @@ intel_e10_1 ()
|
|||||||
| .
|
| .
|
||||||
| register
|
| register
|
||||||
| id
|
| id
|
||||||
|
| ~
|
||||||
| constant */
|
| constant */
|
||||||
static int
|
static int
|
||||||
intel_e11 ()
|
intel_e11 ()
|
||||||
@ -5820,6 +5826,15 @@ intel_e11 ()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* e11 ~ expr */
|
||||||
|
else if (cur_token.code == '~')
|
||||||
|
{
|
||||||
|
strcat (intel_parser.disp, "~");
|
||||||
|
intel_match_token ('~');
|
||||||
|
|
||||||
|
return (intel_e11 ());
|
||||||
|
}
|
||||||
|
|
||||||
/* e11 [ expr ] */
|
/* e11 [ expr ] */
|
||||||
else if (cur_token.code == '[')
|
else if (cur_token.code == '[')
|
||||||
{
|
{
|
||||||
@ -5965,7 +5980,7 @@ intel_e11 ()
|
|||||||
{
|
{
|
||||||
if (i.base_reg && i.index_reg)
|
if (i.base_reg && i.index_reg)
|
||||||
{
|
{
|
||||||
as_bad (_("Too many register references in memory operand.\n"));
|
as_bad (_("Too many register references in memory operand."));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6034,7 +6049,7 @@ intel_e11 ()
|
|||||||
intel_match_token (cur_token.code);
|
intel_match_token (cur_token.code);
|
||||||
if (cur_token.code != T_CONST)
|
if (cur_token.code != T_CONST)
|
||||||
{
|
{
|
||||||
as_bad (_("Syntax error. Expecting a constant. Got `%s'.\n"),
|
as_bad (_("Syntax error. Expecting a constant. Got `%s'."),
|
||||||
cur_token.str);
|
cur_token.str);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -6121,7 +6136,7 @@ intel_match_token (code)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
as_bad (_("Unexpected token `%s'\n"), cur_token.str);
|
as_bad (_("Unexpected token `%s'"), cur_token.str);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6182,7 +6197,16 @@ intel_get_token ()
|
|||||||
new_token.code = T_ID;
|
new_token.code = T_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (strchr ("+-/*:[]()", *intel_parser.op_string))
|
else if (strchr ("<>", *intel_parser.op_string)
|
||||||
|
&& *intel_parser.op_string == *(intel_parser.op_string + 1))
|
||||||
|
{
|
||||||
|
new_token.code = T_SHIFTOP;
|
||||||
|
new_token.str[0] = *intel_parser.op_string;
|
||||||
|
new_token.str[1] = *intel_parser.op_string;
|
||||||
|
new_token.str[2] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (strchr ("+-/*&|:[]()~", *intel_parser.op_string))
|
||||||
{
|
{
|
||||||
new_token.code = *intel_parser.op_string;
|
new_token.code = *intel_parser.op_string;
|
||||||
new_token.str[0] = *intel_parser.op_string;
|
new_token.str[0] = *intel_parser.op_string;
|
||||||
@ -6265,7 +6289,7 @@ intel_get_token ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
as_bad (_("Unrecognized token `%s'\n"), intel_parser.op_string);
|
as_bad (_("Unrecognized token `%s'"), intel_parser.op_string);
|
||||||
|
|
||||||
intel_parser.op_string += strlen (new_token.str);
|
intel_parser.op_string += strlen (new_token.str);
|
||||||
cur_token = new_token;
|
cur_token = new_token;
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
2004-07-13 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
|
* gas/i386/intel.s: Add test of newly expand arithmetic support
|
||||||
|
for Intel mode assembler.
|
||||||
|
* gas/i386/intel.d: Add expected disassmbly.
|
||||||
|
|
||||||
2004-07-13 Nick Clifton <nickc@redhat.com>
|
2004-07-13 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
* gas/vtable: Delete directory. These tests are no longer needed
|
* gas/vtable: Delete directory. These tests are no longer needed
|
||||||
|
@ -620,4 +620,11 @@ Disassembly of section .text:
|
|||||||
a6a: ff 20 [ ]*jmp \*\(%eax\)
|
a6a: ff 20 [ ]*jmp \*\(%eax\)
|
||||||
a6c: ff 25 d2 09 00 00 [ ]*jmp \*0x9d2
|
a6c: ff 25 d2 09 00 00 [ ]*jmp \*0x9d2
|
||||||
a72: e9 5b ff ff ff [ ]*jmp 9d2 <bar>
|
a72: e9 5b ff ff ff [ ]*jmp 9d2 <bar>
|
||||||
|
a77: b8 12 00 00 00 [ ]*mov \$0x12,%eax
|
||||||
|
a7c: 25 ff ff fb ff [ ]*and \$0xfffbffff,%eax
|
||||||
|
a81: 25 ff ff fb ff [ ]*and \$0xfffbffff,%eax
|
||||||
|
a86: b0 11 [ ]*mov \$0x11,%al
|
||||||
|
a88: b0 11 [ ]*mov \$0x11,%al
|
||||||
|
a8a: b3 47 [ ]*mov \$0x47,%bl
|
||||||
|
a8c: b3 47 [ ]*mov \$0x47,%bl
|
||||||
[ ]*...
|
[ ]*...
|
||||||
|
@ -615,4 +615,14 @@ rot5:
|
|||||||
jmp [eax]
|
jmp [eax]
|
||||||
jmp [bar]
|
jmp [bar]
|
||||||
jmp bar
|
jmp bar
|
||||||
|
|
||||||
|
# Check arithmetic operators
|
||||||
|
mov %eax,(( 17 ) + 1)
|
||||||
|
and %eax,~(1 << ( 18 ))
|
||||||
|
and %eax,0xFFFBFFFF
|
||||||
|
mov %al, (( 0x4711 ) & 0xff)
|
||||||
|
mov %al, 0x11
|
||||||
|
mov %bl, ((( 0x4711 ) >> 8) & 0xff)
|
||||||
|
mov %bl, 0x47
|
||||||
|
|
||||||
.p2align 4,0
|
.p2align 4,0
|
||||||
|
Reference in New Issue
Block a user