From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by sourceware.org (Postfix) with ESMTPS id 6B8573858D28 for ; Tue, 1 Aug 2023 08:22:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6B8573858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-3128fcd58f3so5544970f8f.1 for ; Tue, 01 Aug 2023 01:22:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690878171; x=1691482971; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=tX7R+cp2jSpt90kYZ5d+rY1D+5/hW2S+xQD4frgpH14=; b=hnaWUK0ixLtUNmPm+gF9cJkxePpX7qFXxum+cSB4eVvLqlyoIQgKxYzMJwoyEsjjpi eXlgdaUlLGAmVFw+TYZ5Ql0rlMOjNUYELK7l8G8Nt0figVwnvp6cpor9f7LLqNQ1acd+ IB5CcCcFP4HURQutnFtRw/20Q+/07Ph+zJx4qvfQGY55XsN1BD/GoTKIIfl/8ObsE33s UgEVNsYBOBqDCoRmkV2Yn10eED2vG6W1DNGX1Sa291+r3EvpPjdyysJShSy7j1rbV+MW G88PRClBVreR6o06cP0jMi8vQ+C5QkRwPI2YbC/hLHAfoQ9nHQYljNzhCeqHcgwZBj4q Y6fA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690878171; x=1691482971; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tX7R+cp2jSpt90kYZ5d+rY1D+5/hW2S+xQD4frgpH14=; b=R3Sw1hV8FuuTk2QsA7ZBURwIQ4hci4RTH4LBIxKc0nSPBFoUDECk6v9CIiZK345e3B Z5U+cRkWCgOfhY/yZUM1fAoqHnnPotgGKrQ+/dLq4GnerL0gS38O+SzWUKqMU0tHdYA9 hT+qDSm8xMub78A5OtxPZ47wRRke/mdsHtjK2NjgTYiNmW7Uhpo/pcKWeAabJixywDlE 9muG5AiVAs8SvE5xPAzevNZMG3XBZwZ0LuT6eV6r1BaJx5AiMCuwbKEKT5qs2t4reVkH 1ophdYfRaG+KZ10jX3TJwy/CjmLDjrohn+48e3PLdCO4481D4eDwtbTA02sJ04oHbJmk kJ1w== X-Gm-Message-State: ABy/qLbEyivzp8cqLM6kEqbFvDCpp8iSKoh6iINIxlyIU5VUrT7UKwmE N+6JPhkXTAYiRGZcda90w3pu8K6Se8Xszy0lWsNkz1D4o0G4tlPYxrQ= X-Google-Smtp-Source: APBJJlHdeBG1rm3d4maimupNhMf+cNCRQk7UT++w3BCVobgUwUcDJzaIeIPye4NinqfGZuKsLQAjBnM6LDD1LxSKE8Y= X-Received: by 2002:a5d:464c:0:b0:313:df08:7b7e with SMTP id j12-20020a5d464c000000b00313df087b7emr2240615wrs.14.1690878170689; Tue, 01 Aug 2023 01:22:50 -0700 (PDT) MIME-Version: 1.0 References: <20230619142356.345159-1-stefansf@linux.ibm.com> <0d598847-2fb0-7ee3-db3c-259632c9a91a@gmail.com> In-Reply-To: <0d598847-2fb0-7ee3-db3c-259632c9a91a@gmail.com> From: Prathamesh Kulkarni Date: Tue, 1 Aug 2023 13:52:16 +0530 Message-ID: Subject: Re: [PATCH v2] combine: Narrow comparison of memory and constant To: Jeff Law Cc: Stefan Schulze Frielinghaus , gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Tue, 1 Aug 2023 at 05:20, Jeff Law wrote: > > > > On 7/31/23 15:43, Prathamesh Kulkarni via Gcc-patches wrote: > > On Mon, 19 Jun 2023 at 19:59, Stefan Schulze Frielinghaus via > > Gcc-patches wrote: > >> > >> Comparisons between memory and constants might be done in a smaller mo= de > >> resulting in smaller constants which might finally end up as immediate= s > >> instead of in the literal pool. > >> > >> For example, on s390x a non-symmetric comparison like > >> x <=3D 0x3fffffffffffffff > >> results in the constant being spilled to the literal pool and an 8 byt= e > >> memory comparison is emitted. Ideally, an equivalent comparison > >> x0 <=3D 0x3f > >> where x0 is the most significant byte of x, is emitted where the > >> constant is smaller and more likely to materialize as an immediate. > >> > >> Similarly, comparisons of the form > >> x >=3D 0x4000000000000000 > >> can be shortened into x0 >=3D 0x40. > >> > >> Bootstrapped and regtested on s390x, x64, aarch64, and powerpc64le. > >> Note, the new tests show that for the mentioned little-endian targets > >> the optimization does not materialize since either the costs of the ne= w > >> instructions are higher or they do not match. Still ok for mainline? > > Hi Stefan, > > Unfortunately this patch (committed in 7cdd0860949c6c3232e6cff1d7ca37bb= 5234074c) > > caused the following ICE on armv8l-unknown-linux-gnu: > > during RTL pass: combine > > ../../../gcc/libgcc/fixed-bit.c: In function =E2=80=98__gnu_saturate1sq= =E2=80=99: > > ../../../gcc/libgcc/fixed-bit.c:210:1: internal compiler error: in > > decompose, at rtl.h:2297 > > 210 | } > > | ^ > > 0xaa23e3 wi::int_traits > >> ::decompose(long long*, unsigned int, std::pair > machine_mode> const&) > > ../../gcc/gcc/rtl.h:2297 > [ ... ] > Yea, we're seeing something very similar on nios2-linux-gnu building the > kernel. > > Prathamesh, can you extract the .i file for fixed-bit on armv8 and open > a bug for this issue, attaching the .i file as well as the right command > line options necessary to reproduce the failure. THat way Stefan can > tackle it with a cross compiler. Hi Jeff, Filed the issue in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110867 Thanks, Prathamesh > > Thanks, > jeff