From patchwork Wed Jul 10 11:24:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Prathamesh Kulkarni X-Patchwork-Id: 168795 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp9831881ilk; Wed, 10 Jul 2019 04:25:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqyoBXeGqZ9yOX8APabMR9m8jdfGkezCMwaVPjBj153DlJzLhAOB3MyFFs2UzBzh8Qaraz+6 X-Received: by 2002:a17:902:7483:: with SMTP id h3mr38289099pll.28.1562757926650; Wed, 10 Jul 2019 04:25:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562757926; cv=none; d=google.com; s=arc-20160816; b=gysHL8C9111nlBHNw/Q6eW6mSFp8gwIHBI58zRdq1ixnIJc6BsJIrtDbxCVW2Be/nX MS1Yioob3/5lXagazU8uwZ+3MYKNF5N+nGAaMW92brURueOO4q843Ci6bCvKVU2Tbu1Y rIB6kG/JF/QtPYAksrq+Tohn+d9UwH9+poRR552ZbtoEuasscTCn3LA9gHVIy05K9Syb 26c8eUbeqsRbE+6p2Vm1rW1flI4RZKJj8OZWkiwbSsZ+2rRLl/by3ERDMO/bnqLLig4+ lBapEcQ+Yq5TYDM3PPMF8ilF1i/K1ayzLYV6G40ADcEB6gdQvjBKG3tATiUvdjjdQd/b pJcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:mime-version:dkim-signature :delivered-to:sender:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature; bh=1hNmBnoETBMh8SFgWQw9fbluC8P33NBlsNvoP1rfBG0=; b=0+o43D++H5rVjeMFpx+KaC15EEDyFckOFpt2a/Q1x4o7Iq0T8agE8DzVe6X8vfAbPu jY9WfjWytHYe3WMLzsmMJda+dyBy9MOIbxXFCMl2HG3VKg3U9BhKxTpUMl3jXzOcrHHA A57k5q3xSuyAk3r6/KRoIvZwCxn88QDT2EWPz97/+4OErgRUX1QC3C8QEwUJBrFSjiD1 Yt3e8Sttr99uavy3dgSTjMfLGbnjIQ3SnNTPERd82HKfIBCGRHUbpyTQBbBHRQvniQcM Qwt5LYB0waH+9XWOmNWBZ1ayo1puzmzLg8t09rAw9ICQLug6S6FqSSZSDNCE2L7n25kA sDKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=x8GNgEvf; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=McLj0oXd; spf=pass (google.com: domain of gcc-patches-return-504826-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gcc-patches-return-504826-patch=linaro.org@gcc.gnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id g31si1905402pld.8.2019.07.10.04.25.26 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Jul 2019 04:25:26 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-504826-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=x8GNgEvf; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=McLj0oXd; spf=pass (google.com: domain of gcc-patches-return-504826-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="gcc-patches-return-504826-patch=linaro.org@gcc.gnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:cc:content-type; q=dns; s=default; b=Ri0KcBbIaTh52x8JR3A1+inMjArXffSBZ5DmIcxhj1K WkO/LkuDoP0q9Azxc0RYuEV9XyB2W+kIChhYNh22XTmqeq45csp9mY7YqlhQtXPA HVUfBBqt6ETQf12hx12N7l1+utQ41+JfMFwG7wFfPCXX+U+IMmMKI2QfVj8SWp0o = 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 :mime-version:from:date:message-id:subject:to:cc:content-type; s=default; bh=upfIYoXpViCYwxpLuF1BFodziZY=; b=x8GNgEvf2IXlaNXf0 hdFR0iGpWiLk78AFeAJhLNZQAXCPk0iWDtw/kKo3Q/iw2I1CC/GKAnwFGq2DmJZT 72xUzQ2KOeCPPpMFyMuOIeeWnSTQ+a+Mgw9cwAMZG824GGeNPdlG5IalxAAcCj40 gIglfs6P3yYO4Vvfg/Aatl/dxk= Received: (qmail 36828 invoked by alias); 10 Jul 2019 11:25:07 -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 36480 invoked by uid 89); 10 Jul 2019 11:25:05 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-23.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-lj1-f174.google.com Received: from mail-lj1-f174.google.com (HELO mail-lj1-f174.google.com) (209.85.208.174) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 10 Jul 2019 11:25:03 +0000 Received: by mail-lj1-f174.google.com with SMTP id m23so1662100lje.12 for ; Wed, 10 Jul 2019 04:24:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:from:date:message-id:subject:to:cc; bh=BqnBOdtHnpKbvS2VXwBvyHFFGlb7rHuzErPRfBrEgPI=; b=McLj0oXdaWLUZi6BaS3tCbdDSqhyQ1sLAwm49JDEEZuqHUc8MQuKFLYYFVy2U6CbjP C1hbFmUlPK5jTJod+kHbwYvS2kh1g4DON1HF2KcStTAlbf/wNkDPXVkFITLv34hvMRbe cPPoSp21arOpcm5VYmY+ecHkqL9eRN7AqhczEx0yeLvJ+lhuSSqoY8awjdxo3BHFrHG1 SqXMQ9n3CsHiKcqwrcjkkn2m/u3UoU3uAwN/OS8xvJjl0zboMHQmIHQb9tcw1s5IJqkj lzt91nZBuh/Y6WtAzCXS7WBeLxLNFWkDF+5Ik8CPhpMgdp5DS2zfsH8jKrQ7LImTIoWe DfUA== MIME-Version: 1.0 From: Prathamesh Kulkarni Date: Wed, 10 Jul 2019 16:54:20 +0530 Message-ID: Subject: PR90724 - ICE with __sync_bool_compare_and_swap with -march=armv8.2-a To: gcc Patches , James Greenhalgh Cc: Richard Sandiford X-IsSubscribed: yes Hi, For following test-case, static long long AL[24]; int check_ok (void) { return (__sync_bool_compare_and_swap (AL+1, 0x200000003ll, 0x1234567890ll)); } Compiling with -O2 -march=armv8.2-a results in: pr90724.c: In function ‘check_ok’: pr90724.c:7:1: error: unrecognizable insn: 7 | } | ^ (insn 11 10 12 2 (set (reg:CC 66 cc) (compare:CC (reg:DI 95) (const_int 8589934595 [0x200000003]))) "pr90724.c":6:11 -1 (nil)) IIUC, the issue is that 0x200000003 falls outside the range of allowable immediate in cmp ? If it's replaced by a small constant then it works. The ICE results with -march=armv8.2-a because, we enter if (TARGET_LSE) { ... } condition in aarch64_expand_compare_and_swap, while with -march=armv8.a it goes into else, which forces oldval into register if the predicate fails to match. The attached patch checks if y (oldval) satisfies aarch64_plus_operand predicate and if not, forces it to be in register, which resolves ICE. Does it look OK ? Bootstrap+testing in progress on aarch64-linux-gnu. PS: The issue has nothing to do with SVE, which I incorrectly mentioned in bug report. Thanks, Prathamesh 2019-07-10 Prathamesh Kulkarni PR target/90724 * config/aarch64/aarch64.c (aarch64_gen_compare_reg_maybe_ze): Force y in reg if it fails aarch64_plus_operand predicate. diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index a18fbd0f0aa..22d4726e19a 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -1930,6 +1930,9 @@ aarch64_gen_compare_reg_maybe_ze (RTX_CODE code, rtx x, rtx y, } } + if (!aarch64_plus_operand (y, y_mode)) + y = force_reg (y_mode, y); + return aarch64_gen_compare_reg (code, x, y); }