From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by sourceware.org (Postfix) with ESMTPS id 2F829385B52E for ; Sun, 19 Nov 2023 05:55:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2F829385B52E 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 2F829385B52E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::632 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700373340; cv=none; b=ecB2rzadagwi9r1SxdDofmsM7YfPfDme4/A6olip0G/6zbllCeo/jV/Tk/lubGFeQwUGJrTiXdVWS5fU6l95bBloK5Bnfyh9/2nyKgimBm4acR8Dtv+cCzcC4PVn+B0rPOBQUrEn331JUT8/SdN++KJkURMq4z8kruofvyGg6RI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700373340; c=relaxed/simple; bh=oD9x+ziBxydMF7C3Ukgy767IWeyXmf3SuDFp0rZXRA8=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=uiglU/SuROp+CbL/1bLIlQPSvY2wKpTWy3PGx1pkWSaYfR1D6bF9QCKyXgzHxsjcx0xwSvX8u8VW1PLkIsIXzO6NHfCZa3+hot6o2sc6BlW+Z2aRHQ45DCxxJdl9VQoyarIj2+QrXJfcS2NlL2UfvkISIsTvMwx0Pqf+uGtpaTY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-9e62ab773f1so460907466b.0 for ; Sat, 18 Nov 2023 21:55:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700373338; x=1700978138; 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=hz6MggbOea9xLSkkGzx8MAts505YlzHNoMsW6LL6+1k=; b=h1QH6zxCyuG0XPeI99YCMv+52MUgbQzyw9prWc0MUanT2ic3pQ9NkriuwUkMp9rqZx doxWl4vemUyWKizwoPADOfTToWf0Qt9vJ+F82qxm8yYw0ErHtXIZHqjHH0gm8VwyfsFG JbCq1d33v0Wytms6qAbrByzVNZu90T+Z1yDrh3IiILTmmXe0OC2+DgI8Ctl/yA1/+t0r mSLfSPbyUq7SPbQ7irByb5rN59urrIG3TRlRcsWjxqgxUGLNkz2L4TBJmRyZ6X7rL717 Wxo41qYYj8U9b5uWZU8Zw24gsv27Iot1DpBt3HnIhJGdiJ+AKPaQF91zjdCQjOWQPFhv 8/oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700373338; x=1700978138; 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=hz6MggbOea9xLSkkGzx8MAts505YlzHNoMsW6LL6+1k=; b=HvYKbxUKqk6qblwN++OuP48Ua46o3GkO+uNOrgSSU9JM9SXp2zZXdE0ltVqT35eDoY VkQGVw9a8NfHKDBrDQ7CHy+qRnGdGODcmUiS/vFmu7AE9b9rFlxh2eofUE2sEDUlfShQ Rh8uAsB04pym4Ao4LnfeFrumGHtdHLI1caHf11atqtNwkcvJwfX7MvStUHKWo/xaXUQm GEwCeStL53mGQE7sA0AmFAMVgxTiQG4j7obWOd9p2AzdLN4sDChluDV0vOLxxhx0fi/3 rGYFbA+2MZXRjjyTM5zYBxYUkzHoBMRP60wwk7oMQOU1ZOEpe8tU1EjfV1y+ubjK0sub QMLw== X-Gm-Message-State: AOJu0YwJlc147ZF91lxGRocb31CPdM1JuCtfmB5RErNhoXon9FhLMGjP prq2dSP0N6i1lqVzx0o8EcYAhMBXT6nOj7FtBjQ= X-Google-Smtp-Source: AGHT+IGoQRAOZHMdx7q7Xhc4L+ySn7bpaeqfURnDyDKoXXrmGOheGnFRF11El+CtmZerMqV2ofr4epvnRe1tzHGW+oY= X-Received: by 2002:a17:906:158:b0:9fd:a833:996e with SMTP id 24-20020a170906015800b009fda833996emr75698ejh.77.1700373337799; Sat, 18 Nov 2023 21:55:37 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Kito Cheng Date: Sun, 19 Nov 2023 13:55:25 +0800 Message-ID: Subject: Re: [PATCH 06/44] RISC-V: Avoid repeated GET_MODE calls 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.0 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:36=E2=80=AFPM Maciej W. Rozycki wrote: > > Use `mode0' and `mode1' shorthands respectively for `GET_MODE (op0)' and > `GET_MODE (op1)' to improve code readability. > > gcc/ > * config/riscv/riscv.cc (riscv_expand_conditional_move): Use > `mode0' and `mode1' for `GET_MODE (op0)' and `GET_MODE (op1)'. > --- > gcc/config/riscv/riscv.cc | 11 +++++++---- > 1 file changed, 7 insertions(+), 4 deletions(-) > > gcc-riscv-expand-conditional-move-mode-cmp.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 > @@ -4007,12 +4007,15 @@ riscv_expand_conditional_move (rtx dest, > else if (TARGET_ZICOND_LIKE > && GET_MODE_CLASS (mode) =3D=3D MODE_INT) > { > + machine_mode mode0 =3D GET_MODE (op0); > + machine_mode mode1 =3D GET_MODE (op1); > + > /* The comparison must be comparing WORD_MODE objects. We must > enforce that so that we don't strip away a sign_extension > thinking it is unnecessary. We might consider using > riscv_extend_operands if they are not already properly extended.= */ > - if ((GET_MODE (op0) !=3D word_mode && GET_MODE (op0) !=3D VOIDmode= ) > - || (GET_MODE (op1) !=3D word_mode && GET_MODE (op1) !=3D VOIDmo= de)) > + if ((mode0 !=3D word_mode && mode0 !=3D VOIDmode) > + || (mode1 !=3D word_mode && mode1 !=3D VOIDmode)) > return false; > > /* Canonicalize the comparison. It must be an equality comparison > @@ -4032,9 +4035,9 @@ riscv_expand_conditional_move (rtx dest, > rtx tmp =3D gen_reg_rtx (word_mode); > > /* We can support both FP and integer conditional moves. */ > - if (INTEGRAL_MODE_P (GET_MODE (XEXP (op, 0)))) > + if (INTEGRAL_MODE_P (mode0)) > riscv_expand_int_scc (tmp, code, op0, op1, invert_ptr); > - else if (FLOAT_MODE_P (GET_MODE (XEXP (op, 0))) > + else if (FLOAT_MODE_P (mode0) > && fp_scc_comparison (op, GET_MODE (op))) > riscv_expand_float_scc (tmp, code, op0, op1); > else