From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by sourceware.org (Postfix) with ESMTPS id 0B6D738582B7 for ; Sun, 19 Nov 2023 05:56:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0B6D738582B7 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0B6D738582B7 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::62c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700373383; cv=none; b=OXAqNYqBl6ul4KAl+HGNOOcvDRvGCEVZppnMd5hrfIg12q6uIuZO2+SA6onzVghNa50FgQx5npo81GRn7D8okREDbH0HUB7V16SsWYxrvIllhQIor/5YwIC8wmhjgT5wm9vk/3beQpc4+FFv9sqGWhZSKaJwDvf8h6IPvszfhCI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700373383; c=relaxed/simple; bh=l2MFN39bazzfGPrZFAt6EJTD8yGEQCwbEpnKOo/yRwI=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=qlxjG6quBwvCrYM+x6bz8FCmw//tCrKMz8pUoLyb1HHPxZ2/rbVsGqfMebHexVDRJxx/lP2b/mR0XjxvLpLnzDAtI4HVt3PzUdFcwAIRVtN12u1L31G2/mHyjg39uDfbx1/Y06etcZOmAzV8B9Q0ENrrtiD3hYGOhIu9w/9Xu0g= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-991c786369cso461179466b.1 for ; Sat, 18 Nov 2023 21:56:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700373380; x=1700978180; darn=gcc.gnu.org; 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=xO/LAXShLWZj54JkLJewBcMKUricuMrxRBtD9YZnp3o=; b=Rfwb3saJZl9m2uvrf/rOgyTQtRtPrdksBLqMr9VvE+9f8Qjpzd27tMROjnjSOE/8JX q+XKRZGyfsHxeFkIeD10Ve6ual3b26Ctyrfrcgd5gxBhZ2JZfh0NOMCX95I+Bul1nkWk ZhsYHPJ31LkGxwlgj7PCaoUi6jQyWHoltNQN/RCyEgm82MURKX7Co7wzSP6FsaFHOSes qG+0vlMTZCHnE72rPYPeQ64CSVLDd0u6ncqq69ipRQlLvvKr3zyQ1yVxDfMHovnRXVf6 4k7sWgj5DUfdRpRe1MI06GrO75UUSk96zcgxsvkebe4zxwa1cymp9eDx/YaHdVqAGlbx jKjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700373380; x=1700978180; 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=xO/LAXShLWZj54JkLJewBcMKUricuMrxRBtD9YZnp3o=; b=bau1M3envkqYTKKg2Nht9heuEyRjnyRA7mNJ5X+sP3dgj5GqTdLKeA6lKH8AIfvbgf HsSj/hnyAPNWAvFd+c8hHc8WqFp6DWnbebqAw/CCIvwbML7ZvcNhBocnpCk9d4aLbSYY PnYaRz3JqPlgUxTqdScdl+J4M0r95qxHQ3o3CEvTVJjgLms/oRpSo+Q8Ma3wrirGyjJC QxoyKBYdlm8jmd4qujvEYeqPD2vEykWXgQCe2Tl+XZCkeA/RoF5s8xGoGV4bkc/OHYT9 VAk6vhNdShqMjactbhE6nyDqleAhcq7cJbXpCegLOwvWu6McGS2yxld63YVlkR7GVoTw CjAA== X-Gm-Message-State: AOJu0YztYMZuq5iV8+2UscAVpqoGyB7kkP7yN5VbPEfIz+mHl0TMo73X M/q7bR2vX0wcEVmfjbNvVGOFjs0nANhENnjayk0= X-Google-Smtp-Source: AGHT+IHng9htGxof9XpH3fFEjmigznOi1ELGk1QB9gbH972rFr6cG/8s1DYjm6p8OGwwB9BuuI67mERl5fVdYqnju6Y= X-Received: by 2002:a17:906:cd09:b0:9ad:8aac:362b with SMTP id oz9-20020a170906cd0900b009ad8aac362bmr2277552ejb.23.1700373380410; Sat, 18 Nov 2023 21:56:20 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Kito Cheng Date: Sun, 19 Nov 2023 13:56:08 +0800 Message-ID: Subject: Re: [PATCH 08/44] RISC-V: Simplify EQ vs NE selection in `riscv_expand_conditional_move' To: "Maciej W. Rozycki" Cc: gcc-patches@gcc.gnu.org, Andrew Waterman , Jim Wilson , Palmer Dabbelt Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE,URIBL_BLACK autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: LGTM On Sun, Nov 19, 2023 at 1:37=E2=80=AFPM Maciej W. Rozycki wrote: > > Just choose between EQ and NE at `gen_rtx_fmt_ee' invocation, removing > an extraneous variable only referred once and improving code clarity. > > gcc/ > * config/riscv/riscv.cc (riscv_expand_conditional_move): Remove > extraneous variable for EQ vs NE operation selection. > --- > FWIW I have no idea what "We need to know where so that we can adjust it > for our needs." refers to, but that would have to be for another change. > --- > gcc/config/riscv/riscv.cc | 12 ++++-------- > 1 file changed, 4 insertions(+), 8 deletions(-) > > gcc-riscv-expand-conditional-move-new-code.diff > Index: gcc/gcc/config/riscv/riscv.cc > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- gcc.orig/gcc/config/riscv/riscv.cc > +++ gcc/gcc/config/riscv/riscv.cc > @@ -4023,10 +4023,12 @@ riscv_expand_conditional_move (rtx dest, > we can then use an equality comparison against zero. */ > if (!equality_operator (op, VOIDmode) || op1 !=3D CONST0_RTX (mode= )) > { > - enum rtx_code new_code =3D NE; > bool *invert_ptr =3D nullptr; > bool invert =3D false; > > + /* If riscv_expand_int_scc inverts the condition, then it will > + flip the value of INVERT. We need to know where so that > + we can adjust it for our needs. */ > if (code =3D=3D LE || code =3D=3D GE) > invert_ptr =3D &invert; > > @@ -4043,13 +4045,7 @@ riscv_expand_conditional_move (rtx dest, > else > return false; > > - /* If riscv_expand_int_scc inverts the condition, then it will > - flip the value of INVERT. We need to know where so that > - we can adjust it for our needs. */ > - if (invert) > - new_code =3D EQ; > - > - op =3D gen_rtx_fmt_ee (new_code, mode, tmp, const0_rtx); > + op =3D gen_rtx_fmt_ee (invert ? EQ : NE, mode, tmp, const0_rtx)= ; > > /* We've generated a new comparison. Update the local variable= s. */ > code =3D GET_CODE (op);