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: 393239 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 8EACA140179 for ; Thu, 25 Sep 2014 13:46:07 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=qa2gKzyb8PiOU5RxjKOfUdbwbUAYGP///w7nNbyFVho2CU 3xdOPNb4NK9zNXc9+1Uw3+0s4ss4P6/F38uLvGJYyXK5BkLbUB5c8TKT0PYLD9nm 9aidIoq0coAoSxfj6VzmnuL/eGIOguEWPh3XWlgbO6RKmUX+je+MjQGjbT6aY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=9iRW9ZUoRRkCCAYN208q9Hfo5Y0=; b=CYI2592QMNem2eQ7S5rt QFeHTVkPwYNLjX8+JTexNutmfGCJ0zToSmbE7pPvzWikgpul+4CWN8cexDyxzdMx GJGCrN4N8/By527Mx9R8nr2OhEisHLpKJFKgZEbwTbDBFYMXlLY0r/cbLzeTA5c7 89af4dk7gIuA8OLSMWQayYk= Received: (qmail 17610 invoked by alias); 25 Sep 2014 03:45:59 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk 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 Authentication-Results: sourceware.org; auth=none 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-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:organization:user-agent :mime-version:to:subject:content-type; bh=h1tMyVFlKk5Eanwp4Uw7rJF4vgP7xOTFPVcfFVRUu/Y=; b=OfIC7jdvIAj3XfRLmYemdN1s1AtG7Kb4gVqLrjuXDtVhG4RAjny08zDvAx6Jgtwrf8 Oa6L50w4eTa2BqevwQuBTna4mX+gH57eQxZle0el538i4w3c6WyEH5tjDXm/MRwqWzR/ xKvTthbobM0zUZjth0I5cmW9lhcjySM1PfSVaxyB5kXcRBdDPtVtgt7fUoqttGOdVR/Z SXQ93mK11JvR3cK1i0HeyGlBc/+418kXAuMwslP2xB40eTYrIZ841fPDPqfRWgI8PqY5 N/b6DoIuAKDIwiCsOJGHSDrvKnN/hXazFdVQx3AK5U4ynNGC7Opc+Xvyh1jR7p2C2FUU d3AA== X-Gm-Message-State: ALoCoQkDDWLbNgAHz3GIXWvA7+epv0emwN0HW4F4EoeMIGm1+KoQHV05zT87VPN0AzbTdq/+J+LP 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 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)