From 9420679091f2b8ff96f05f4c00ccb30008fb131a Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Tue, 24 Feb 2009 04:30:30 +0000 Subject: [PATCH] * config/tc-arm.c (warn_deprecated_sp): New macro. (do_t_mov_cmp): Permit R13 as the second argument to "cmp.n". * gas/arm/thumb2_bad_reg.s: Update to allow R13 as second argument for CMP. * gas/arm/thumb2_bad_reg.l: Adjust accordingly. --- gas/ChangeLog | 6 ++++++ gas/config/tc-arm.c | 21 ++++++++++++++++++++- gas/testsuite/ChangeLog | 6 ++++++ gas/testsuite/gas/arm/thumb2_bad_reg.l | 4 ++++ gas/testsuite/gas/arm/thumb2_bad_reg.s | 4 ++++ 5 files changed, 40 insertions(+), 1 deletion(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 67161df6bb7..c1207bd9a90 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2009-02-23 Mark Mitchell + + * config/tc-arm.c (warn_deprecated_sp): New macro. + (do_t_mov_cmp): Permit R13 as the second + argument to "cmp.n". + 2009-02-23 H.J. Lu * config/tc-i386.c (type_names): Add OPERAND_TYPE_REGYMM. diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index 782d10be9d0..a1e5d12ccb0 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -6140,6 +6140,14 @@ parse_operands (char *str, const unsigned char *pattern) } \ while (0) +/* If REG is R13 (the stack pointer), warn that its use is + deprecated. */ +#define warn_deprecated_sp(reg) \ + do \ + if (warn_on_deprecated && reg == REG_SP) \ + as_warn (_("use of r13 is deprecated")); \ + while (0) + /* Functions for operand encoding. ARM, then Thumb. */ #define rotate_left(v, n) (v << n | v >> (32 - n)) @@ -9690,7 +9698,18 @@ do_t_mov_cmp (void) if (opcode == T_MNEM_cmp) { constraint (Rn == REG_PC, BAD_PC); - reject_bad_reg (Rm); + if (narrow) + { + /* In the Thumb-2 ISA, use of R13 as Rm is deprecated, + but valid. */ + warn_deprecated_sp (Rm); + /* R15 was documented as a valid choice for Rm in ARMv6, + but as UNPREDICTABLE in ARMv7. ARM's proprietary + tools reject R15, so we do too. */ + constraint (Rm == REG_PC, BAD_PC); + } + else + reject_bad_reg (Rm); } else if (opcode == T_MNEM_mov || opcode == T_MNEM_movs) diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 99ea036ae28..b1b23c261dc 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2009-02-23 Mark Mitchell + + * gas/arm/thumb2_bad_reg.s: Update to allow R13 as second argument + for CMP. + * gas/arm/thumb2_bad_reg.l: Adjust accordingly. + 2009-02-19 Peter Bergner * gas/ppc/e500mc.d ("lfdepx", "stfdepx"): Fix tests to expect a diff --git a/gas/testsuite/gas/arm/thumb2_bad_reg.l b/gas/testsuite/gas/arm/thumb2_bad_reg.l index 46b4924faff..f22df10e017 100644 --- a/gas/testsuite/gas/arm/thumb2_bad_reg.l +++ b/gas/testsuite/gas/arm/thumb2_bad_reg.l @@ -76,6 +76,10 @@ [^:]*:[0-9]+: Error: r15 not allowed here -- `cmn.w r0,r15' [^:]*:[0-9]+: Error: r15 not allowed here -- `cmp.w r15,#1' [^:]*:[0-9]+: Error: r15 not allowed here -- `cmp r15,r0' +[^:]*:[0-9]+: Warning: use of r13 is deprecated +[^:]*:[0-9]+: Error: r15 not allowed here -- `cmp r0,r15' +[^:]*:[0-9]+: Warning: use of r13 is deprecated +[^:]*:[0-9]+: Error: r15 not allowed here -- `cmp.n r0,r15' [^:]*:[0-9]+: Error: r15 not allowed here -- `cmp.w r15,r0' [^:]*:[0-9]+: Error: r13 not allowed here -- `cmp.w r0,r13' [^:]*:[0-9]+: Error: r15 not allowed here -- `cmp.w r0,r15' diff --git a/gas/testsuite/gas/arm/thumb2_bad_reg.s b/gas/testsuite/gas/arm/thumb2_bad_reg.s index 77134c3c1fe..90c82e68963 100644 --- a/gas/testsuite/gas/arm/thumb2_bad_reg.s +++ b/gas/testsuite/gas/arm/thumb2_bad_reg.s @@ -114,6 +114,10 @@ test: @ CMP (register) cmp r13, r0 @ OK cmp r15, r0 + cmp r0, r13 @ Deprecated + cmp r0, r15 + cmp.n r0, r13 @ Deprecated + cmp.n r0, r15 cmp.w r13, r0 @ OK cmp.w r15, r0 cmp.w r0, r13 -- 2.30.2