From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17830 invoked by alias); 25 Jul 2019 06:27:23 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 17819 invoked by uid 89); 25 Jul 2019 06:27:23 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.7 required=5.0 tests=AWL,BAYES_00,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-lj1-f170.google.com Received: from mail-lj1-f170.google.com (HELO mail-lj1-f170.google.com) (209.85.208.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 25 Jul 2019 06:27:22 +0000 Received: by mail-lj1-f170.google.com with SMTP id z28so46932991ljn.4 for ; Wed, 24 Jul 2019 23:27:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=LTOJBOmfDmM+ZxUlJ8hwMfZyaYetNnYNF3Xc1fXx2iI=; b=eQ2GBTO7B0rxVlVVYyzGizZL/Onr0SQvNM63n/OiuM/LqS5J5DSM9K6MlTEY1TuFFp atNiWCONUsABH1f9vIDB6igaAt0Y6HY29dUWPPgUVClG4PmvA6cyyCsVt53mr3mX/2OV nFsJ/V4UpjApj9JF5udA33EDUanr1uGxV/pKWtbxkXKpxSOloy+eup0hosYo38DCi1de 6Q1LC/2MDh/bpSrxlpHzRVC+EvE8JbABOjmFjAisRCdMpzxlpu+b9avanS1hDW65GFzX 5HMoyMRywzpEbrDrqJVCwqirM77DEXALDA2Afn0z03gm6m2Hkme19HjQG3D64UZ8ON64 x5gQ== MIME-Version: 1.0 References: <4e27950d-43fa-7ab3-a27f-169f91dbdabc@foss.arm.com> In-Reply-To: From: Prathamesh Kulkarni Date: Thu, 25 Jul 2019 07:50:00 -0000 Message-ID: Subject: Re: PR90724 - ICE with __sync_bool_compare_and_swap with -march=armv8.2-a To: James Greenhalgh Cc: gcc Patches , Richard Sandiford , Kyrill Tkachov Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2019-07/txt/msg01623.txt.bz2 On Wed, 17 Jul 2019 at 18:15, Prathamesh Kulkarni wrote: > > On Wed, 17 Jul 2019 at 13:45, Kyrill Tkachov > wrote: > > > > Hi Prathamesh > > > > On 7/10/19 12:24 PM, Prathamesh Kulkarni wrote: > > > 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=3Darmv8.2-a results in: > > > pr90724.c: In function =E2=80=98check_ok=E2=80=99: > > > 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=3Darmv8.2-a because, we enter if > > > (TARGET_LSE) { ... } condition > > > in aarch64_expand_compare_and_swap, while with -march=3Darmv8.a it go= es > > > 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. > > > > > This looks ok to me (but you'll need maintainer approval). > > > > Does this fail on the branches as well? > Hi Kyrill, > Thanks for the review. The test also fails on gcc-9-branch (but not on gc= c-8). Hi James, Is the patch OK to commit ? https://gcc.gnu.org/ml/gcc-patches/2019-07/msg00793.html Thanks, Prathamesh > > Thanks, > Prathamesh > > > > Thanks, > > > > Kyrill > > > > > > > Thanks, > > > Prathamesh