aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2004-07-13 17:31:15 +0000
committerNick Clifton <nickc@redhat.com>2004-07-13 17:31:15 +0000
commit0477af35bf6a93d1b215128bc2f7bdd8a90866d9 (patch)
tree5c5b2fddc6827dd1fb272645fccf992152b03555 /gas
parent6bf46641b813342f98d64efa3c367e530cb86bb9 (diff)
downloadgdb-0477af35bf6a93d1b215128bc2f7bdd8a90866d9.zip
gdb-0477af35bf6a93d1b215128bc2f7bdd8a90866d9.tar.gz
gdb-0477af35bf6a93d1b215128bc2f7bdd8a90866d9.tar.bz2
Add support for & | << >> ~ arithmetic operators in Intel mode
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog15
-rw-r--r--gas/NEWS2
-rw-r--r--gas/config/tc-i386.c42
-rw-r--r--gas/testsuite/ChangeLog6
-rw-r--r--gas/testsuite/gas/i386/intel.d7
-rw-r--r--gas/testsuite/gas/i386/intel.s10
6 files changed, 73 insertions, 9 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 777979b..271e8c9 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -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>
* config/tc-m68k.c: Convert to C90. Remove redundant
diff --git a/gas/NEWS b/gas/NEWS
index 19cbc60..87ed8c0 100644
--- a/gas/NEWS
+++ b/gas/NEWS
@@ -12,6 +12,8 @@
* Support for ColdFire EMAC instructions added and Motorola syntax for MAC/EMAC
instrucitons.
+Changes in 2.15:
+
* The MIPS -membedded-pic option (Embedded-PIC code generation) is
deprecated and will be removed in a future release.
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index cc95843..2dd834e 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -1476,7 +1476,7 @@ md_assemble (line)
{
/* In case it is "hi" register, give up. */
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);
/* Otherwise it is equivalent to the extended register.
@@ -5350,7 +5350,7 @@ tc_gen_reloc (section, fixp)
Initial production is 'expr'.
- addOp + | -
+ addOp + | - | & | \| | << | >>
alpha [a-zA-Z]
@@ -5387,6 +5387,7 @@ tc_gen_reloc (section, fixp)
| id
| $
| register
+ | ~
=> expr SHORT e05
| e05
@@ -5455,6 +5456,7 @@ tc_gen_reloc (section, fixp)
| $
| register
| id
+ | ~
| constant */
/* 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_PTR 10
#define T_ID 11
+#define T_SHIFTOP 12
/* Prototypes for intel parser functions. */
static int intel_match_token PARAMS ((int code));
@@ -5615,7 +5618,9 @@ static int
intel_e05_1 ()
{
/* 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);
intel_match_token (cur_token.code);
@@ -5717,7 +5722,7 @@ intel_e09_1 ()
else
{
- as_bad (_("Unknown operand modifier `%s'\n"), prev_token.str);
+ as_bad (_("Unknown operand modifier `%s'"), prev_token.str);
return 0;
}
@@ -5801,6 +5806,7 @@ intel_e10_1 ()
| .
| register
| id
+ | ~
| constant */
static int
intel_e11 ()
@@ -5820,6 +5826,15 @@ intel_e11 ()
return 0;
}
+ /* e11 ~ expr */
+ else if (cur_token.code == '~')
+ {
+ strcat (intel_parser.disp, "~");
+ intel_match_token ('~');
+
+ return (intel_e11 ());
+ }
+
/* e11 [ expr ] */
else if (cur_token.code == '[')
{
@@ -5965,7 +5980,7 @@ intel_e11 ()
{
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;
}
@@ -6034,7 +6049,7 @@ intel_e11 ()
intel_match_token (cur_token.code);
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);
return 0;
}
@@ -6121,7 +6136,7 @@ intel_match_token (code)
}
else
{
- as_bad (_("Unexpected token `%s'\n"), cur_token.str);
+ as_bad (_("Unexpected token `%s'"), cur_token.str);
return 0;
}
}
@@ -6182,7 +6197,16 @@ intel_get_token ()
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.str[0] = *intel_parser.op_string;
@@ -6265,7 +6289,7 @@ intel_get_token ()
}
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);
cur_token = new_token;
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index 880a52a..5e61334 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,5 +1,11 @@
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>
+
* gas/vtable: Delete directory. These tests are no longer needed
as the VTABLE_ reloc support is obsolete.
diff --git a/gas/testsuite/gas/i386/intel.d b/gas/testsuite/gas/i386/intel.d
index 7365dba..66fd1d7 100644
--- a/gas/testsuite/gas/i386/intel.d
+++ b/gas/testsuite/gas/i386/intel.d
@@ -620,4 +620,11 @@ Disassembly of section .text:
a6a: ff 20 [ ]*jmp \*\(%eax\)
a6c: ff 25 d2 09 00 00 [ ]*jmp \*0x9d2
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
[ ]*...
diff --git a/gas/testsuite/gas/i386/intel.s b/gas/testsuite/gas/i386/intel.s
index 2a4afb2..b713369 100644
--- a/gas/testsuite/gas/i386/intel.s
+++ b/gas/testsuite/gas/i386/intel.s
@@ -615,4 +615,14 @@ rot5:
jmp [eax]
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