aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2005-10-24 07:42:50 +0000
committerJan Beulich <jbeulich@novell.com>2005-10-24 07:42:50 +0000
commit6a2375c6b276cd04a893f7d9a8cd87f3656cad65 (patch)
treed5599e1cbae544c8aa7d68843581c8a63d61b80c /gas
parent5e0bd1769ddea4d4b75770e2b9bced019ecbca2d (diff)
downloadgdb-6a2375c6b276cd04a893f7d9a8cd87f3656cad65.zip
gdb-6a2375c6b276cd04a893f7d9a8cd87f3656cad65.tar.gz
gdb-6a2375c6b276cd04a893f7d9a8cd87f3656cad65.tar.bz2
include/opcode/
2005-10-24 Jan Beulich <jbeulich@novell.com> * ia64.h (enum ia64_opnd): Move memory operand out of set of indirect operands. bfd/ 2005-10-24 Jan Beulich <jbeulich@novell.com> * cpu-ia64-opc.c (elf64_ia64_operands): Move memory operand out of set of indirect operands. gas/ 2005-10-24 Jan Beulich <jbeulich@novell.com> * config/tc-ia64.c (enum reg_symbol): Delete IND_MEM. (dot_rot): Change type of num_* variables. Check for positive count. (ia64_optimize_expr): Re-structure. (md_operand): Check for general register. gas/testsuite/ 2005-10-24 Jan Beulich <jbeulich@novell.com> * gas/ia64/index.[sl]: New. * gas/ia64/rotX.[sl]: New. * gas/ia64/ia64.exp: Run new tests. opcodes/ 2005-10-24 Jan Beulich <jbeulich@novell.com> * ia64-asmtab.c: Regenerate.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog7
-rw-r--r--gas/config/tc-ia64.c62
-rw-r--r--gas/testsuite/ChangeLog6
-rw-r--r--gas/testsuite/gas/ia64/ia64.exp2
-rw-r--r--gas/testsuite/gas/ia64/index.l42
-rw-r--r--gas/testsuite/gas/ia64/index.s63
-rw-r--r--gas/testsuite/gas/ia64/rotX.l5
-rw-r--r--gas/testsuite/gas/ia64/rotX.s4
8 files changed, 171 insertions, 20 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 897c916..eeb4ac4 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,12 @@
2005-10-24 Jan Beulich <jbeulich@novell.com>
+ * config/tc-ia64.c (enum reg_symbol): Delete IND_MEM.
+ (dot_rot): Change type of num_* variables. Check for positive count.
+ (ia64_optimize_expr): Re-structure.
+ (md_operand): Check for general register.
+
+2005-10-24 Jan Beulich <jbeulich@novell.com>
+
* config/tc-ia64.c (declare_register): Call symbol_create.
(md_begin): Remove local variables total, ar_base, and cr_base.
Start loops for registers at their respective first one. Don't
diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c
index 5da3098..b735a29 100644
--- a/gas/config/tc-ia64.c
+++ b/gas/config/tc-ia64.c
@@ -124,7 +124,6 @@ enum reg_symbol
IND_DTR,
IND_ITR,
IND_IBR,
- IND_MEM,
IND_MSR,
IND_PKR,
IND_PMC,
@@ -4772,7 +4771,8 @@ static void
dot_rot (type)
int type;
{
- unsigned num_regs, num_alloced = 0;
+ offsetT num_regs;
+ valueT num_alloced = 0;
struct dynreg **drpp, *dr;
int ch, base_reg = 0;
char *name, *start;
@@ -4817,6 +4817,11 @@ dot_rot (type)
as_bad ("Expected ']'");
goto err;
}
+ if (num_regs <= 0)
+ {
+ as_bad ("Number of elements must be positive");
+ goto err;
+ }
SKIP_WHITESPACE ();
num_alloced += num_regs;
@@ -7979,31 +7984,38 @@ ia64_optimize_expr (l, op, r)
operatorT op;
expressionS *r;
{
- unsigned num_regs;
-
- if (op == O_index)
+ if (op != O_index)
+ return 0;
+ resolve_expression (l);
+ if (l->X_op == O_register)
{
- if (l->X_op == O_register && r->X_op == O_constant)
+ unsigned num_regs = l->X_add_number >> 16;
+
+ resolve_expression (r);
+ if (num_regs)
{
- num_regs = (l->X_add_number >> 16);
- if ((unsigned) r->X_add_number >= num_regs)
+ /* Left side is a .rotX-allocated register. */
+ if (r->X_op != O_constant)
{
- if (!num_regs)
- as_bad ("No current frame");
- else
- as_bad ("Index out of range 0..%u", num_regs - 1);
+ as_bad ("Rotating register index must be a non-negative constant");
+ r->X_add_number = 0;
+ }
+ else if ((valueT) r->X_add_number >= num_regs)
+ {
+ as_bad ("Index out of range 0..%u", num_regs - 1);
r->X_add_number = 0;
}
l->X_add_number = (l->X_add_number & 0xffff) + r->X_add_number;
return 1;
}
- else if (l->X_op == O_register && r->X_op == O_register)
+ else if (l->X_add_number >= IND_CPUID && l->X_add_number <= IND_RR)
{
- if (l->X_add_number < IND_CPUID || l->X_add_number > IND_RR
- || l->X_add_number == IND_MEM)
+ if (r->X_op != O_register
+ || r->X_add_number < REG_GR
+ || r->X_add_number > REG_GR + 127)
{
- as_bad ("Indirect register set name expected");
- l->X_add_number = IND_CPUID;
+ as_bad ("Indirect register index must be a general register");
+ r->X_add_number = REG_GR;
}
l->X_op = O_index;
l->X_op_symbol = md.regsym[l->X_add_number];
@@ -8011,7 +8023,12 @@ ia64_optimize_expr (l, op, r)
return 1;
}
}
- return 0;
+ as_bad ("Index can only be applied to rotating or indirect registers");
+ /* Fall back to some register use of which has as little as possible
+ side effects, to minimize subsequent error messages. */
+ l->X_op = O_register;
+ l->X_add_number = REG_GR + 3;
+ return 1;
}
int
@@ -11020,8 +11037,13 @@ md_operand (e)
}
else
{
- if (e->X_op != O_register)
- as_bad ("Register expected as index");
+ if (e->X_op != O_register
+ || e->X_add_number < REG_GR
+ || e->X_add_number > REG_GR + 127)
+ {
+ as_bad ("Index must be a general register");
+ e->X_add_number = REG_GR;
+ }
++input_line_pointer;
e->X_op = O_index;
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index 53f85f6..dd4a891 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,5 +1,11 @@
2005-10-24 Jan Beulich <jbeulich@novell.com>
+ * gas/ia64/index.[sl]: New.
+ * gas/ia64/rotX.[sl]: New.
+ * gas/ia64/ia64.exp: Run new tests.
+
+2005-10-24 Jan Beulich <jbeulich@novell.com>
+
* gas/ia64/regs.pl: Also check tp alias of r13.
* gas/ia64/regs.s: Regenerate.
* gas/ia64/regs.d: Adjust.
diff --git a/gas/testsuite/gas/ia64/ia64.exp b/gas/testsuite/gas/ia64/ia64.exp
index a6c8646..0c75519 100644
--- a/gas/testsuite/gas/ia64/ia64.exp
+++ b/gas/testsuite/gas/ia64/ia64.exp
@@ -79,12 +79,14 @@ if [istarget "ia64-*"] then {
run_list_test "alloc" ""
run_dump_test "bundling"
run_dump_test "forward"
+ run_list_test "index" ""
run_list_test "label" ""
run_list_test "last" ""
run_list_test "no-fit" ""
run_list_test "pound" "-al"
run_list_test "proc" "-munwind-check=error"
run_list_test "radix" ""
+ run_list_test "rotX" ""
run_list_test "slot2" ""
run_dump_test "strange"
run_list_test "unwind-bad" ""
diff --git a/gas/testsuite/gas/ia64/index.l b/gas/testsuite/gas/ia64/index.l
new file mode 100644
index 0000000..41af9fd
--- /dev/null
+++ b/gas/testsuite/gas/ia64/index.l
@@ -0,0 +1,42 @@
+.*: Assembler messages:
+.*.s:6: Error: [Ii]ndex must be a general register
+.*.s:7: Error: [Ii]ndex must be a general register
+.*.s:8: Error: [Ii]ndex must be a general register
+.*.s:9: Error: [Ii]ndex must be a general register
+.*.s:13: Error: [Ii]ndirect register index must be a general register
+.*.s:14: Error: [Ii]ndirect register index must be a general register
+.*.s:15: Error: [Ii]ndirect register index must be a general register
+.*.s:16: Error: [Ii]ndirect register index must be a general register
+.*.s:20: Error: [Ii]ndex can only be applied to rotating or indirect registers
+.*.s:21: Error: [Ii]ndex can only be applied to rotating or indirect registers
+.*.s:22: Error: [Ii]ndex can only be applied to rotating or indirect registers
+.*.s:23: Error: [Ii]ndex can only be applied to rotating or indirect registers
+.*.s:24: Error: [Ii]ndex can only be applied to rotating or indirect registers
+.*.s:25: Error: [Ii]ndex can only be applied to rotating or indirect registers
+.*.s:27: Error: [Ii]ndex can only be applied to rotating or indirect registers
+.*.s:28: Error: [Ii]ndex can only be applied to rotating or indirect registers
+.*.s:29: Error: [Ii]ndex can only be applied to rotating or indirect registers
+.*.s:30: Error: [Ii]ndex can only be applied to rotating or indirect registers
+.*.s:31: Error: [Ii]ndex can only be applied to rotating or indirect registers
+.*.s:32: Error: [Ii]ndex can only be applied to rotating or indirect registers
+.*.s:37: Error: [Rr]otating register index must be a non-negative constant
+.*.s:39: Error: [Ii]ndex out of range 0\.\.[[:digit:]]+
+.*.s:40: Error: [Rr]otating register index must be a non-negative constant
+.*.s:41: Error: [Rr]otating register index must be a non-negative constant
+.*.s:42: Error: [Rr]otating register index must be a non-negative constant
+.*.s:44: Error: [Ii]ndirect register index must be a general register
+.*.s:45: Error: [Ii]ndirect register index must be a general register
+.*.s:46: Error: [Ii]ndirect register index must be a general register
+.*.s:47: Error: [Ii]ndirect register index must be a general register
+.*.s:51: Error: [Ii]ndex can only be applied to rotating or indirect registers
+.*.s:52: Error: [Ii]ndex can only be applied to rotating or indirect registers
+.*.s:53: Error: [Ii]ndex can only be applied to rotating or indirect registers
+.*.s:54: Error: [Ii]ndex can only be applied to rotating or indirect registers
+.*.s:55: Error: [Ii]ndex can only be applied to rotating or indirect registers
+.*.s:56: Error: [Ii]ndex can only be applied to rotating or indirect registers
+.*.s:58: Error: [Ii]ndex can only be applied to rotating or indirect registers
+.*.s:59: Error: [Ii]ndex can only be applied to rotating or indirect registers
+.*.s:60: Error: [Ii]ndex can only be applied to rotating or indirect registers
+.*.s:61: Error: [Ii]ndex can only be applied to rotating or indirect registers
+.*.s:62: Error: [Ii]ndex can only be applied to rotating or indirect registers
+.*.s:63: Error: [Ii]ndex can only be applied to rotating or indirect registers
diff --git a/gas/testsuite/gas/ia64/index.s b/gas/testsuite/gas/ia64/index.s
new file mode 100644
index 0000000..0a5d9f1
--- /dev/null
+++ b/gas/testsuite/gas/ia64/index.s
@@ -0,0 +1,63 @@
+z == zero
+zero == r0
+
+.text
+_start:
+ ld8 r2 = [ar.lc]
+ ld8 r3 = [1]
+ ld8 r4 = [-1]
+ ld8 r5 = [xyz]
+ ld8 r6 = [zero]
+ ld8 r7 = [z]
+
+ mov r2 = cpuid[ar.lc]
+ mov r3 = cpuid[1]
+ mov r4 = cpuid[-1]
+ mov r5 = cpuid[xyz]
+ mov r6 = cpuid[zero]
+ mov r7 = cpuid[z]
+
+ mov r2 = b0[ar.lc]
+ mov r3 = b0[1]
+ mov r4 = b0[-1]
+ mov r5 = b0[xyz]
+ mov r6 = b0[zero]
+ mov r7 = b0[z]
+
+ mov r2 = xyz[ar.lc]
+ mov r3 = xyz[1]
+ mov r4 = xyz[-1]
+ mov r5 = xyz[xyz]
+ mov r6 = xyz[zero]
+ mov r7 = xyz[z]
+
+.regstk 0, 8, 0, 8
+.rotr reg[8]
+
+ mov r2 = reg[ar.lc]
+ mov r3 = reg[1]
+ mov r4 = reg[-1]
+ mov r5 = reg[xyz]
+ mov r6 = reg[zero]
+ mov r7 = reg[z]
+
+ mov r2 = cpuid[ar.lc]
+ mov r3 = cpuid[1]
+ mov r4 = cpuid[-1]
+ mov r5 = cpuid[xyz]
+ mov r6 = cpuid[zero]
+ mov r7 = cpuid[z]
+
+ mov r2 = b0[ar.lc]
+ mov r3 = b0[1]
+ mov r4 = b0[-1]
+ mov r5 = b0[xyz]
+ mov r6 = b0[zero]
+ mov r7 = b0[z]
+
+ mov r2 = xyz[ar.lc]
+ mov r3 = xyz[1]
+ mov r4 = xyz[-1]
+ mov r5 = xyz[xyz]
+ mov r6 = xyz[zero]
+ mov r7 = xyz[z]
diff --git a/gas/testsuite/gas/ia64/rotX.l b/gas/testsuite/gas/ia64/rotX.l
new file mode 100644
index 0000000..1159774
--- /dev/null
+++ b/gas/testsuite/gas/ia64/rotX.l
@@ -0,0 +1,5 @@
+.*: Assembler messages:
+.*.s:[[:digit:]]+: Error: [Nn]umber of elements must be positive
+.*.s:[[:digit:]]+: Error: [Nn]umber of elements must be positive
+.*.s:[[:digit:]]+: Error: [Bb]ad or irreducible absolute expression
+#pass
diff --git a/gas/testsuite/gas/ia64/rotX.s b/gas/testsuite/gas/ia64/rotX.s
new file mode 100644
index 0000000..48320f6
--- /dev/null
+++ b/gas/testsuite/gas/ia64/rotX.s
@@ -0,0 +1,4 @@
+.regstk 0, 8, 0, 8
+.rotr a[8], b[-8]
+.rotp c[8], d[0]
+.rotf e[8], f[x]