From patchwork Mon Aug 19 09:24:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Newton X-Patchwork-Id: 19289 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f71.google.com (mail-qe0-f71.google.com [209.85.128.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E37422469E for ; Mon, 19 Aug 2013 09:24:11 +0000 (UTC) Received: by mail-qe0-f71.google.com with SMTP id 1sf2046315qee.2 for ; Mon, 19 Aug 2013 02:24:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:delivered-to:message-id:date:from:user-agent :mime-version:to:cc:subject:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe:content-type :content-transfer-encoding; bh=Tr1m89FJw3gUHiUfJxDRvHhC1D2k/8Zaxm2S6fgPidk=; b=Xrbk5ANysqIw3Vgn5Um1bnj7L2B/iA7Z+29LKhllb/SC/tDIwYy/LkH4zlZgr6t0LA TViTXZ5uFpWuFQUeksp5faqRPQwBTf/vJGKCzVHQTZvEHAYJRJyhQtlkSC/pTpO/Lfak +yapi3mhpOkwCFSLvIh06WF4td8CGSOeG2UMwE38jp36hDsdRxGJ1PzGQUSE96j87H9X koD+7QxyYBvJFlHslETVLpnhoQOZ6+1mxumCwOpz8t805SilDtDR83f/pkxDXXb/57yT jX19sHMbEPyrArKAmpUzPLpfX7zZrd2MLLphkauzQa3Q27f32tO7YB3+5YjrS5kqFKcX xq7Q== X-Received: by 10.236.115.198 with SMTP id e46mr4084750yhh.33.1376904251319; Mon, 19 Aug 2013 02:24:11 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.71.148 with SMTP id v20ls421264qeu.5.gmail; Mon, 19 Aug 2013 02:24:11 -0700 (PDT) X-Received: by 10.220.145.132 with SMTP id d4mr15804124vcv.9.1376904251178; Mon, 19 Aug 2013 02:24:11 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id rx10si2192261vdc.34.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 19 Aug 2013 02:24:11 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id hf12so2804798vcb.41 for ; Mon, 19 Aug 2013 02:24:11 -0700 (PDT) X-Gm-Message-State: ALoCoQmt8slwzAXMWLNZPUpQSszfXfqmv2mRofrUwnCqocHdtyXccIR2GgQ3tcP4S9MaDlhN0AbU X-Received: by 10.220.164.70 with SMTP id d6mr5017317vcy.19.1376904251034; Mon, 19 Aug 2013 02:24:11 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp85785vcz; Mon, 19 Aug 2013 02:24:10 -0700 (PDT) X-Received: by 10.14.122.132 with SMTP id t4mr21386779eeh.20.1376904249684; Mon, 19 Aug 2013 02:24:09 -0700 (PDT) Received: from mail-ea0-f182.google.com (mail-ea0-f182.google.com [209.85.215.182]) by mx.google.com with ESMTPS id o6si8805811eea.69.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 19 Aug 2013 02:24:09 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.215.182 is neither permitted nor denied by best guess record for domain of will.newton@linaro.org) client-ip=209.85.215.182; Received: by mail-ea0-f182.google.com with SMTP id o10so2178091eaj.27 for ; Mon, 19 Aug 2013 02:24:08 -0700 (PDT) X-Received: by 10.14.111.9 with SMTP id v9mr21078343eeg.35.1376904248780; Mon, 19 Aug 2013 02:24:08 -0700 (PDT) Received: from localhost.localdomain (cpc6-seac21-2-0-cust453.7-2.cable.virginmedia.com. [82.1.113.198]) by mx.google.com with ESMTPSA id i1sm2057433eeg.0.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 19 Aug 2013 02:24:07 -0700 (PDT) Message-ID: <5211E435.5080401@linaro.org> Date: Mon, 19 Aug 2013 10:24:05 +0100 From: Will Newton User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8 MIME-Version: 1.0 To: binutils@sourceware.org CC: patches@linaro.org Subject: [PATCH] gas/config/tc-arm.c: Improve validation of NEON addressing modes. X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: will.newton@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , NEON vector load and store instructions do not accept immediates or pre-indexed base plus offset addressing modes, so make sure that the assembler enforces this. gas/ChangeLog: 2013-08-19 Will Newton * config/tc-arm.c (do_neon_ldx_stx): Add extra constraints for pre-indexed addressing modes. * testsuite/gas/arm/neon-addressing-bad.l: Add test for VLDn and VSTn instructions. * testsuite/gas/arm/neon-addressing-bad.s: Likewise. --- gas/config/tc-arm.c | 16 ++++++++++++---- gas/testsuite/gas/arm/neon-addressing-bad.l | 22 +++++++++++++--------- gas/testsuite/gas/arm/neon-addressing-bad.s | 4 ++++ 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index 21369d7..50e0da7 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -16008,12 +16008,20 @@ do_neon_ldx_stx (void) _("bad register for post-index")); inst.instruction |= postreg; } - else if (inst.operands[1].writeback) + else { - inst.instruction |= 0xd; + constraint (inst.operands[1].immisreg, BAD_ADDR_MODE); + constraint (inst.reloc.exp.X_op != O_constant + || inst.reloc.exp.X_add_number != 0, + BAD_ADDR_MODE); + + if (inst.operands[1].writeback) + { + inst.instruction |= 0xd; + } + else + inst.instruction |= 0xf; } - else - inst.instruction |= 0xf; if (thumb_mode) inst.instruction |= 0xf9000000; diff --git a/gas/testsuite/gas/arm/neon-addressing-bad.l b/gas/testsuite/gas/arm/neon-addressing-bad.l index a8bc720..38e1801 100644 --- a/gas/testsuite/gas/arm/neon-addressing-bad.l +++ b/gas/testsuite/gas/arm/neon-addressing-bad.l @@ -12,12 +12,16 @@ [^:]*:14: Error: only loads support such operands -- `vst2.8 {D0\[\].* [^:]*:15: Error: only loads support such operands -- `vst3.16 {D0\[\].* [^:]*:16: Error: only loads support such operands -- `vst4.32 {D0\[\].* -[^:]*:18: Error: r15 not allowed here -- `vld1.8 {d0},2f' -[^:]*:20: Error: r15 not allowed here -- `vld1.8 {D0},R0' -[^:]*:21: Error: r15 not allowed here -- `vld1.8 {Q1},R0' -[^:]*:22: Error: r15 not allowed here -- `vld1.8 {D0},\[PC\]' -[^:]*:23: Error: r15 not allowed here -- `vld1.8 {D0},\[PC,#0\]' -[^:]*:24: Error: r15 not allowed here -- `vst1.8 {D0},R0' -[^:]*:25: Error: r15 not allowed here -- `vst1.8 {Q1},R0' -[^:]*:26: Error: r15 not allowed here -- `vst1.8 {D0},\[PC\]' -[^:]*:27: Error: r15 not allowed here -- `vst1.8 {D0},\[PC,#0\]' +[^:]*:17: Error: instruction does not accept this addressing mode -- `vld1.8 {Q0},\[R0,#8\]' +[^:]*:18: Error: instruction does not accept this addressing mode -- `vld1.8 {Q0},\[R0,#8\]!' +[^:]*:19: Error: instruction does not accept this addressing mode -- `vld1.8 {Q0},\[R0,R1\]' +[^:]*:20: Error: instruction does not accept this addressing mode -- `vld1.8 {Q0},\[R0,R1\]!' +[^:]*:22: Error: r15 not allowed here -- `vld1.8 {d0},2f' +[^:]*:24: Error: r15 not allowed here -- `vld1.8 {D0},R0' +[^:]*:25: Error: r15 not allowed here -- `vld1.8 {Q1},R0' +[^:]*:26: Error: r15 not allowed here -- `vld1.8 {D0},\[PC\]' +[^:]*:27: Error: r15 not allowed here -- `vld1.8 {D0},\[PC,#0\]' +[^:]*:28: Error: r15 not allowed here -- `vst1.8 {D0},R0' +[^:]*:29: Error: r15 not allowed here -- `vst1.8 {Q1},R0' +[^:]*:30: Error: r15 not allowed here -- `vst1.8 {D0},\[PC\]' +[^:]*:31: Error: r15 not allowed here -- `vst1.8 {D0},\[PC,#0\]' diff --git a/gas/testsuite/gas/arm/neon-addressing-bad.s b/gas/testsuite/gas/arm/neon-addressing-bad.s index c27b172..6f7e769 100644 --- a/gas/testsuite/gas/arm/neon-addressing-bad.s +++ b/gas/testsuite/gas/arm/neon-addressing-bad.s @@ -14,6 +14,10 @@ VST1.8 {D0[]}, [R0] VST2.8 {D0[], D2[]}, [R0] VST3.16 {D0[], D1[], D2[]}, [R0] VST4.32 {D0[], D1[], D2[], D3[]}, [R0] +VLD1.8 {Q0}, [R0, #8] +VLD1.8 {Q0}, [R0, #8]! +VLD1.8 {Q0}, [R0, R1] +VLD1.8 {Q0}, [R0, R1]! .thumb VLD1.8 {d0}, 2f 2: