From patchwork Thu Sep 25 03:45:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Collison X-Patchwork-Id: 37906 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f199.google.com (mail-we0-f199.google.com [74.125.82.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2C375202DB for ; Thu, 25 Sep 2014 03:46:17 +0000 (UTC) Received: by mail-we0-f199.google.com with SMTP id t60sf4172426wes.2 for ; Wed, 24 Sep 2014 20:46:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mailing-list:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:sender :delivered-to:message-id:date:from:user-agent:mime-version:to :subject:x-original-sender:x-original-authentication-results :content-type; bh=h1tMyVFlKk5Eanwp4Uw7rJF4vgP7xOTFPVcfFVRUu/Y=; b=WVdXfbsT9yBg0gyejngxpkEtFTDphLyB3yyYU4czAEyj4CoZAtrNiELx18483n0MDy RZz0FjQS9G6gpqjF4q3u1Wt6TdOxJ5S5qdE9tuQVy+KKijVx5AKc1HaN3Uy1VkH3sYHs GFCOhPrEHMzpBtO8k9zUjO4Da+2IhdnH+bRlyH8qO07/4DcFFSorSIQb65rfdn40vLWh sYTlHkqLBdK5hx6GJ9VKcF8E/+QYOezqoYlIfISRqsTIUPUweWYy7qsjm6/MP08q6+Bo 2kYcAUr0fneIokxQFcXfm9mC7msPVGovxcErITj8Cwwe4+pAloFVEw7oQWf1wu3eLiJG 7IWA== X-Gm-Message-State: ALoCoQlq0vx8jEu5yeYLxZN69pts+wdp3gyYjmVEhJzNNWcQTNUeL952JwVaiFl3uDmuQcyVtiGH X-Received: by 10.112.190.102 with SMTP id gp6mr1111756lbc.10.1411616776111; Wed, 24 Sep 2014 20:46:16 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.44.195 with SMTP id g3ls247466lam.59.gmail; Wed, 24 Sep 2014 20:46:15 -0700 (PDT) X-Received: by 10.152.197.35 with SMTP id ir3mr10579132lac.82.1411616775574; Wed, 24 Sep 2014 20:46:15 -0700 (PDT) Received: from mail-la0-x232.google.com (mail-la0-x232.google.com [2a00:1450:4010:c03::232]) by mx.google.com with ESMTPS id p1si1136768lap.104.2014.09.24.20.46.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 24 Sep 2014 20:46:15 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::232 as permitted sender) client-ip=2a00:1450:4010:c03::232; Received: by mail-la0-f50.google.com with SMTP id el20so153347lab.37 for ; Wed, 24 Sep 2014 20:46:15 -0700 (PDT) X-Received: by 10.152.7.193 with SMTP id l1mr10497007laa.62.1411616775401; Wed, 24 Sep 2014 20:46:15 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.130.169 with SMTP id of9csp687567lbb; Wed, 24 Sep 2014 20:46:14 -0700 (PDT) X-Received: by 10.66.234.105 with SMTP id ud9mr14562519pac.52.1411616773390; Wed, 24 Sep 2014 20:46:13 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id tr9si1276966pac.159.2014.09.24.20.46.12 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Sep 2014 20:46:13 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-378728-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 17610 invoked by alias); 25 Sep 2014 03:45:59 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 17594 invoked by uid 89); 25 Sep 2014 03:45:58 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f177.google.com Received: from mail-pd0-f177.google.com (HELO mail-pd0-f177.google.com) (209.85.192.177) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 25 Sep 2014 03:45:57 +0000 Received: by mail-pd0-f177.google.com with SMTP id v10so8004182pde.22 for ; Wed, 24 Sep 2014 20:45:55 -0700 (PDT) X-Received: by 10.70.90.72 with SMTP id bu8mr19736542pdb.78.1411616755380; Wed, 24 Sep 2014 20:45:55 -0700 (PDT) Received: from [192.168.2.118] (ip70-176-172-237.ph.ph.cox.net. [70.176.172.237]) by mx.google.com with ESMTPSA id qe9sm643380pdb.96.2014.09.24.20.45.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Sep 2014 20:45:54 -0700 (PDT) Message-ID: <54238FEF.6030006@linaro.org> Date: Wed, 24 Sep 2014 20:45:51 -0700 From: Michael Collison User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: gcc-patches@gcc.gnu.org Subject: [AArch64] Fix predicate and constraint mismatch in logical atomic operations X-Original-Sender: michael.collison@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::232 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@gcc.gnu.org X-Google-Group-Id: 836684582541 On certain patterns in atomics.md the constraint 'n' is used in combination with the predicate atomic_op_operand. The constraint is too general and allows constants that are disallowed by the predicate. This causes an ICE In final_scan_insn when the insn cannot be split because the constraint and predicate do not match. Tested on aarch64-none-elf, aarch64-linux-gnu. Additionally the originally reporter of the bug, (doko@ubuntu.com), applied the patch and successfully bootstrapped and tested with no regressions. 2014-09-23 Michael Collison * config/aarch64/iterators.md (lconst_atomic): New mode attribute to support constraints for CONST_INT in atomic operations. * config/aarch64/atomics.md (atomic_): Use lconst_atomic constraint. (atomic_nand): Likewise. (atomic_fetch_): Likewise. (atomic_fetch_nand): Likewise. (atomic__fetch): Likewise. (atomic_nand_fetch): Likewise. --- ../../../../linaro-gcc4_9_git/gcc/config/aarch64/iterators.md 2014-09-22 10:10:04.520258964 -0700 +++ iterators.md 2014-09-16 14:27:10.459050672 -0700 @@ -349,6 +349,9 @@ ;; Attribute to describe constants acceptable in logical operations (define_mode_attr lconst [(SI "K") (DI "L")]) +;; Attribute to describe constants acceptable in atomic logical operations +(define_mode_attr lconst_atomic [(QI "K") (HI "K") (SI "K") (DI "L")]) + ;; Map a mode to a specific constraint character. (define_mode_attr cmode [(QI "q") (HI "h") (SI "s") (DI "d")]) --- ../../../../linaro-gcc4_9_git/gcc/config/aarch64/atomics.md 2014-07-03 21:55:36.083476668 -0700 +++ atomics.md 2014-09-16 14:27:10.459050672 -0700 @@ -119,7 +119,7 @@ [(set (match_operand:ALLI 0 "aarch64_sync_memory_operand" "+Q") (unspec_volatile:ALLI [(atomic_op:ALLI (match_dup 0) - (match_operand:ALLI 1 "" "rn")) + (match_operand:ALLI 1 "" "r")) (match_operand:SI 2 "const_int_operand")] ;; model UNSPECV_ATOMIC_OP)) (clobber (reg:CC CC_REGNUM)) @@ -141,7 +141,7 @@ (unspec_volatile:ALLI [(not:ALLI (and:ALLI (match_dup 0) - (match_operand:ALLI 1 "aarch64_logical_operand" "rn"))) + (match_operand:ALLI 1 "aarch64_logical_operand" "r"))) (match_operand:SI 2 "const_int_operand")] ;; model UNSPECV_ATOMIC_OP)) (clobber (reg:CC CC_REGNUM)) @@ -164,7 +164,7 @@ (set (match_dup 1) (unspec_volatile:ALLI [(atomic_op:ALLI (match_dup 1) - (match_operand:ALLI 2 "" "rn")) + (match_operand:ALLI 2 "" "r")) (match_operand:SI 3 "const_int_operand")] ;; model UNSPECV_ATOMIC_OP)) (clobber (reg:CC CC_REGNUM)) @@ -188,7 +188,7 @@ (unspec_volatile:ALLI [(not:ALLI (and:ALLI (match_dup 1) - (match_operand:ALLI 2 "aarch64_logical_operand" "rn"))) + (match_operand:ALLI 2 "aarch64_logical_operand" "r"))) (match_operand:SI 3 "const_int_operand")] ;; model UNSPECV_ATOMIC_OP)) (clobber (reg:CC CC_REGNUM)) @@ -209,7 +209,7 @@ [(set (match_operand:ALLI 0 "register_operand" "=&r") (atomic_op:ALLI (match_operand:ALLI 1 "aarch64_sync_memory_operand" "+Q") - (match_operand:ALLI 2 "" "rn"))) + (match_operand:ALLI 2 "" "r"))) (set (match_dup 1) (unspec_volatile:ALLI [(match_dup 1) (match_dup 2) @@ -233,7 +233,7 @@ (not:ALLI (and:ALLI (match_operand:ALLI 1 "aarch64_sync_memory_operand" "+Q") - (match_operand:ALLI 2 "aarch64_logical_operand" "rn")))) + (match_operand:ALLI 2 "aarch64_logical_operand" "r")))) (set (match_dup 1) (unspec_volatile:ALLI [(match_dup 1) (match_dup 2)