From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb1-xb35.google.com (mail-yb1-xb35.google.com [IPv6:2607:f8b0:4864:20::b35]) by sourceware.org (Postfix) with ESMTPS id 1A5B23858D20 for ; Fri, 31 Mar 2023 05:57:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1A5B23858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-yb1-xb35.google.com with SMTP id b18so26256788ybp.1 for ; Thu, 30 Mar 2023 22:57:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680242233; 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=asA7MySsvJoaKKG13jF5kiPf9ILocrzjyVhtep4t0cw=; b=Dt0PsnelmIdvgEF/vjofLT5w45QCaSIMQIfHHXd1AMdDIvFx+a62M5Ftxsdh8bQsR8 KPcHC1IXlku8S6Ryj8OcSQb2B/rnB96y0WrZ68jbswC5NVBUL2yUyJpivUm3mvypus09 Zsf1dOAg5sArcuYOOWkpG8jzH1dOMYALLYVSQXSsYNO9CrJ3D/mGwL1DTD7ZLJ5gdBs5 xgYlPgPuuGB8V6g0KHQ6fUhLkDYDGEWL+FW/U9R4r6j75KybbqVpu1FV+mRL60nJd7yJ TubXXWHaDZIUqLolssvMaQ2CkG32tP4Jp2Co0/T/1sOEMyWYTo5p/dhUM1qwz9FGGPi+ x1qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680242233; 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=asA7MySsvJoaKKG13jF5kiPf9ILocrzjyVhtep4t0cw=; b=0u5b2iEX/suiIHbMYWDrcsaGwmO6k1oSe4VxqFhqLXQVIXiUj8cD9vp3f96SeqOzEU PDBMTgzkc+P9nC3QRlR9RbzNHSrU5ro7QKnnjzBUVvEKDiBudNH42Mx6IqHJWGfsIhkB /qePWvv6uMbQaziVLfvgEgj8mAdUDxjkEwfNtqOgZXu1kcJZJKVH0i9XaAYJxp5MuQxm gYglcPVWOAAhqAEigVHWh3Zsy+7V3D2x7o4BI0zJoKoJGxes9H3jXh3YPVe0TGNfTTat K00aG4M2S7a0UtO3PDIAoWeGkabgE/VJY+9azh2o2i8DYvBPNl+m5665fbVfXThQaWGs 2UDw== X-Gm-Message-State: AAQBX9cqhSVWVDSF8hdYOqpB5yPpSWllvsZq/dGR9WZ8xwtQ4kVwqxDB 8M51sandnprC1XckTjRhYYBCx1tzTNpi8iAotOA= X-Google-Smtp-Source: AKy350Y3h8CrRhEAVBMjVzP+IUg22q5G5IK8Xs8ks7FMEepv3wuPoM6bm1H3S50+bVcwxApOnfu5P7Euy54XNhAabB0= X-Received: by 2002:a05:6902:1586:b0:b69:fab9:de39 with SMTP id k6-20020a056902158600b00b69fab9de39mr14070326ybu.2.1680242233201; Thu, 30 Mar 2023 22:57:13 -0700 (PDT) MIME-Version: 1.0 References: <20230331051129.2691249-1-hongtao.liu@intel.com> In-Reply-To: <20230331051129.2691249-1-hongtao.liu@intel.com> From: Uros Bizjak Date: Fri, 31 Mar 2023 07:57:02 +0200 Message-ID: Subject: Re: [PATCH] Adjust memory_move_cost for MASK_REGS when MODE_SIZE > 8. To: liuhongt Cc: gcc-patches@gcc.gnu.org, crazylht@gmail.com, hjl.tools@gmail.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP 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 Fri, Mar 31, 2023 at 7:11=E2=80=AFAM liuhongt wr= ote: > > RA sometimes will use lowest the cost of the mode with all different regc= lasses > w/o check if it's hard_regno_mode_ok. > It's impossible to put modes whose size > 8 into MASK_REGS, ajdust the co= st to > avoid potential performance issue. I was going to ask to open a PR in order to fix RA instead of the proposed workaround, but the patch just prevents a theoretical issue and follows the established practice with other regclasses. Perhaps these workarounds are not needed with the current RA, but this is a tangential issue which should be fixed for all regclasses. > Bootstrapped and regtested on x86_64-pc-linux-gnu{-m32,}. > Ok for trunk? OK. Thanks, Uros. > > gcc/ChangeLog: > > * config/i386/i386.cc (inline_memory_move_cost): Return 100 > for MASK_REGS when MODE_SIZE > 8. > --- > gcc/config/i386/i386.cc | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc > index 2cc8e9548a9..2581b800a06 100644 > --- a/gcc/config/i386/i386.cc > +++ b/gcc/config/i386/i386.cc > @@ -19847,9 +19847,12 @@ inline_memory_move_cost (machine_mode mode, enum= reg_class regclass, int in) > index =3D 1; > break; > /* DImode loads and stores assumed to cost the same as SImode. *= / > - default: > + case 4: > + case 8: > index =3D 2; > break; > + default: > + return 100; > } > > if (in =3D=3D 2) > -- > 2.39.1.388.g2fc9e9ca3c >