From eb9f3f001ff1b478f3ba245aab5b8f89ff76b456 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Wed, 10 Apr 2013 13:20:05 +0000 Subject: [PATCH] gas/ 2013-04-10 Jan Beulich * gas/config/tc-arm.c (encode_arm_addr_mode_3): Only reject base register being PC when is_t or writeback, and use distinct diagnostic for the latter case. gas/testsuite/ 2013-04-10 Jan Beulich * gas/testsuite/gas/arm/ldst-pc.s: Add index, non-writeback forms of various loads and stores with PC as base. * gas/testsuite/gas/arm/ldst-pc.d: Update accordingly. --- gas/ChangeLog | 6 +++++ gas/config/tc-arm.c | 4 +++- gas/testsuite/ChangeLog | 6 +++++ gas/testsuite/gas/arm/ldst-pc.d | 23 ++++++++++++------ gas/testsuite/gas/arm/ldst-pc.s | 9 +++++++ gas/testsuite/gas/arm/sp-pc-validations-bad.l | 24 +++++++++---------- 6 files changed, 52 insertions(+), 20 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 3818536c027..4419429acad 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2013-04-10 Jan Beulich + + * gas/config/tc-arm.c (encode_arm_addr_mode_3): Only reject base + register being PC when is_t or writeback, and use distinct + diagnostic for the latter case. + 2013-04-10 Jan Beulich * gas/config/tc-arm.c (parse_operands): Re-write diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index 10399d6c976..a72b0b08aad 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -7196,8 +7196,10 @@ encode_arm_addr_mode_3 (int i, bfd_boolean is_t) if (inst.operands[i].immisreg) { constraint ((inst.operands[i].imm == REG_PC - || inst.operands[i].reg == REG_PC), + || (is_t && inst.operands[i].reg == REG_PC)), BAD_PC_ADDRESSING); + constraint (inst.operands[i].reg == REG_PC && inst.operands[i].writeback, + BAD_PC_WRITEBACK); inst.instruction |= inst.operands[i].imm; if (!inst.operands[i].negative) inst.instruction |= INDEX_UP; diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 28aa94778c4..9f8c2a4ac0a 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2013-04-10 Jan Beulich + + * gas/testsuite/gas/arm/ldst-pc.s: Add index, non-writeback + forms of various loads and stores with PC as base. + * gas/testsuite/gas/arm/ldst-pc.d: Update accordingly. + 2013-04-10 Jan Beulich * gas/arm/barrier-bad.d: Change title. diff --git a/gas/testsuite/gas/arm/ldst-pc.d b/gas/testsuite/gas/arm/ldst-pc.d index 333d8a0efe4..7a745c541a4 100644 --- a/gas/testsuite/gas/arm/ldst-pc.d +++ b/gas/testsuite/gas/arm/ldst-pc.d @@ -7,10 +7,19 @@ .*: +file format .*arm.* Disassembly of section .text: -0+000 <[^>]*> e51f1008 ldr r1, \[pc, #-8\] ; 0+000 <[^>]*> -0+004 <[^>]*> e79f1002 ldr r1, \[pc, r2\] -0+008 <[^>]*> f55ff008 pld \[pc, #-8\] ; 0+008 <[^>]*> -0+00c <[^>]*> f7dff001 pld \[pc, r1\] -0+010 <[^>]*> f45ff008 pli \[pc, #-8\] ; 0+010 <[^>]*> -0+014 <[^>]*> f6dff001 pli \[pc, r1\] -0+018 <[^>]*> e58f1004 str r1, \[pc, #4\] ; 0+024 <[^>]*> +(0[0-9a-f]+) <[^>]+> e51f1008 ldr r1, \[pc, #-8\] ; \1 <[^>]*> +0[0-9a-f]+ <[^>]+> e79f1002 ldr r1, \[pc, r2\] +0[0-9a-f]+ <[^>]+> e7df1002 ldrb r1, \[pc, r2\] +0[0-9a-f]+ <[^>]+> e18f00d2 ldrd r0, \[pc, r2\] +0[0-9a-f]+ <[^>]+> e19f10b2 ldrh r1, \[pc, r2\] +0[0-9a-f]+ <[^>]+> e19f10d2 ldrsb r1, \[pc, r2\] +0[0-9a-f]+ <[^>]+> e19f10f2 ldrsh r1, \[pc, r2\] +(0[0-9a-f]+) <[^>]+> f55ff008 pld \[pc, #-8\] ; \1 <[^>]*> +0[0-9a-f]+ <[^>]+> f7dff001 pld \[pc, r1\] +(0[0-9a-f]+) <[^>]+> f45ff008 pli \[pc, #-8\] ; \1 <[^>]*> +0[0-9a-f]+ <[^>]+> f6dff001 pli \[pc, r1\] +0[0-9a-f]+ <[^>]+> e58f1004 str r1, \[pc, #4\] ; 0+038 <[^>]*> +0[0-9a-f]+ <[^>]+> e78f1002 str r1, \[pc, r2\] +0[0-9a-f]+ <[^>]+> e7cf1002 strb r1, \[pc, r2\] +0[0-9a-f]+ <[^>]+> e18f00f2 strd r0, \[pc, r2\] +0[0-9a-f]+ <[^>]+> e18f10b2 strh r1, \[pc, r2\] diff --git a/gas/testsuite/gas/arm/ldst-pc.s b/gas/testsuite/gas/arm/ldst-pc.s index eac55fa8147..2d96e3b2963 100644 --- a/gas/testsuite/gas/arm/ldst-pc.s +++ b/gas/testsuite/gas/arm/ldst-pc.s @@ -5,6 +5,11 @@ .align 2 ldr r1, [pc, #-8] ldr r1, [pc, r2] + ldrb r1, [pc, r2] + ldrd r0, r1, [pc, r2] + ldrh r1, [pc, r2] + ldrsb r1, [pc, r2] + ldrsh r1, [pc, r2] pld [pc, #-8] pld [pc, r1] @@ -13,3 +18,7 @@ pli [pc, r1] str r1, [pc, #4] + str r1, [pc, r2] + strb r1, [pc, r2] + strd r0, r1, [pc, r2] + strh r1, [pc, r2] diff --git a/gas/testsuite/gas/arm/sp-pc-validations-bad.l b/gas/testsuite/gas/arm/sp-pc-validations-bad.l index 048841faecc..6e0a52b7d33 100644 --- a/gas/testsuite/gas/arm/sp-pc-validations-bad.l +++ b/gas/testsuite/gas/arm/sp-pc-validations-bad.l @@ -33,8 +33,8 @@ [^:]*:56: Error: cannot use register index with PC-relative addressing -- `ldrd r0,r1,\[r2,pc\]' [^:]*:57: Error: cannot use register index with PC-relative addressing -- `ldrd r0,r1,\[r2,pc\]!' [^:]*:58: Error: cannot use register index with PC-relative addressing -- `ldrd r0,r1,\[r2\],pc' -[^:]*:59: Error: cannot use register index with PC-relative addressing -- `ldrd r0,r1,\[pc,r2\]!' -[^:]*:60: Error: cannot use register index with PC-relative addressing -- `ldrd r0,r1,\[pc\],r2' +[^:]*:59: Error: cannot use writeback with PC-relative addressing -- `ldrd r0,r1,\[pc,r2\]!' +[^:]*:60: Error: cannot use writeback with PC-relative addressing -- `ldrd r0,r1,\[pc\],r2' [^:]*:63: Error: r15 not allowed here -- `ldrex pc,\[r0\]' [^:]*:64: Error: instruction does not accept this addressing mode -- `ldrex r0,\[pc\]' [^:]*:67: Error: r15 not allowed here -- `ldrexb pc,\[r0\]' @@ -53,8 +53,8 @@ [^:]*:90: Error: cannot use register index with PC-relative addressing -- `ldrh r0,\[r1,pc\]' [^:]*:91: Error: cannot use register index with PC-relative addressing -- `ldrh r0,\[r1,pc\]!' [^:]*:92: Error: cannot use register index with PC-relative addressing -- `ldrh r0,\[r1\],pc' -[^:]*:93: Error: cannot use register index with PC-relative addressing -- `ldrh r0,\[pc,r1\]!' -[^:]*:94: Error: cannot use register index with PC-relative addressing -- `ldrh r0,\[pc\],r1' +[^:]*:93: Error: cannot use writeback with PC-relative addressing -- `ldrh r0,\[pc,r1\]!' +[^:]*:94: Error: cannot use writeback with PC-relative addressing -- `ldrh r0,\[pc\],r1' [^:]*:97: Error: r15 not allowed here -- `ldrht pc,\[r0\],#4' [^:]*:98: Error: cannot use writeback with PC-relative addressing -- `ldrht r0,\[pc\],#4' [^:]*:99: Error: r15 not allowed here -- `ldrht pc,\[r0\],r1' @@ -71,8 +71,8 @@ [^:]*:116: Error: cannot use register index with PC-relative addressing -- `ldrsb r0,\[r1,pc\]' [^:]*:117: Error: cannot use register index with PC-relative addressing -- `ldrsb r0,\[r1,pc\]!' [^:]*:118: Error: cannot use register index with PC-relative addressing -- `ldrsb r0,\[r1\],pc' -[^:]*:119: Error: cannot use register index with PC-relative addressing -- `ldrsb r0,\[pc,r1\]!' -[^:]*:120: Error: cannot use register index with PC-relative addressing -- `ldrsb r0,\[pc\],r1' +[^:]*:119: Error: cannot use writeback with PC-relative addressing -- `ldrsb r0,\[pc,r1\]!' +[^:]*:120: Error: cannot use writeback with PC-relative addressing -- `ldrsb r0,\[pc\],r1' [^:]*:123: Error: r15 not allowed here -- `ldrsbt pc,\[r0\],#4' [^:]*:124: Error: cannot use writeback with PC-relative addressing -- `ldrsbt r0,\[pc\],#4' [^:]*:125: Error: r15 not allowed here -- `ldrsbt pc,\[r0\],r1' @@ -89,8 +89,8 @@ [^:]*:142: Error: cannot use register index with PC-relative addressing -- `ldrsh r0,\[r1,pc\]' [^:]*:143: Error: cannot use register index with PC-relative addressing -- `ldrsh r0,\[r1,pc\]!' [^:]*:144: Error: cannot use register index with PC-relative addressing -- `ldrsh r0,\[r1\],pc' -[^:]*:145: Error: cannot use register index with PC-relative addressing -- `ldrsh r0,\[pc,r1\]!' -[^:]*:146: Error: cannot use register index with PC-relative addressing -- `ldrsh r0,\[pc\],r1' +[^:]*:145: Error: cannot use writeback with PC-relative addressing -- `ldrsh r0,\[pc,r1\]!' +[^:]*:146: Error: cannot use writeback with PC-relative addressing -- `ldrsh r0,\[pc\],r1' [^:]*:149: Error: r15 not allowed here -- `ldrsht pc,\[r0\],#4' [^:]*:150: Error: cannot use writeback with PC-relative addressing -- `ldrsht r0,\[pc\],#4' [^:]*:151: Error: r15 not allowed here -- `ldrsht pc,\[r0\],r1' @@ -135,8 +135,8 @@ [^:]*:209: Error: cannot use register index with PC-relative addressing -- `strd r0,r1,\[r2,pc\]' [^:]*:210: Error: cannot use register index with PC-relative addressing -- `strd r0,r1,\[r2,pc\]!' [^:]*:211: Error: cannot use register index with PC-relative addressing -- `strd r0,r1,\[r2\],pc' -[^:]*:212: Error: cannot use register index with PC-relative addressing -- `strd r0,r1,\[pc,r2\]!' -[^:]*:213: Error: cannot use register index with PC-relative addressing -- `strd r0,r1,\[pc\],r2' +[^:]*:212: Error: cannot use writeback with PC-relative addressing -- `strd r0,r1,\[pc,r2\]!' +[^:]*:213: Error: cannot use writeback with PC-relative addressing -- `strd r0,r1,\[pc\],r2' [^:]*:216: Error: r15 not allowed here -- `strex pc,r0,\[r1\]' [^:]*:217: Error: r15 not allowed here -- `strex r0,pc,\[r1\]' [^:]*:218: Error: instruction does not accept this addressing mode -- `strex r0,r1,\[pc\]' @@ -159,8 +159,8 @@ [^:]*:245: Error: cannot use register index with PC-relative addressing -- `strh r0,\[r1,pc\]' [^:]*:246: Error: cannot use register index with PC-relative addressing -- `strh r0,\[r1,pc\]!' [^:]*:247: Error: cannot use register index with PC-relative addressing -- `strh r0,\[r1\],pc' -[^:]*:248: Error: cannot use register index with PC-relative addressing -- `strh r0,\[pc,r1\]!' -[^:]*:249: Error: cannot use register index with PC-relative addressing -- `strh r0,\[pc\],r1' +[^:]*:248: Error: cannot use writeback with PC-relative addressing -- `strh r0,\[pc,r1\]!' +[^:]*:249: Error: cannot use writeback with PC-relative addressing -- `strh r0,\[pc\],r1' [^:]*:252: Error: r15 not allowed here -- `strht pc,\[r0\],#4' [^:]*:253: Error: cannot use writeback with PC-relative addressing -- `strht r0,\[pc\],#4' [^:]*:254: Error: r15 not allowed here -- `strht pc,\[r0\],r1' -- 2.30.2