From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua1-x92b.google.com (mail-ua1-x92b.google.com [IPv6:2607:f8b0:4864:20::92b]) by sourceware.org (Postfix) with ESMTPS id 80CD33858D39 for ; Wed, 2 Mar 2022 01:23:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 80CD33858D39 Received: by mail-ua1-x92b.google.com with SMTP id z10so166370uaa.3 for ; Tue, 01 Mar 2022 17:23:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=dzTJl2gXxs2QZ8kNM1O5Qp3dbdZdBPQDutXH8QapKMo=; b=13KZ3PNkasLK2JcM6o4u9jgLMnGbcZuX4vwEWH/XH4mDctNlw8N5VgVjExnAukbGlb juIGAF7PkuUCgjh/UUjd3OB1Bzj/SxZ9BJuS+RNwIIM6aEK7XHapxFopPqxrZ371g3HW YGSP/YJaFJSUyevGVONTreUNiHMWgd9NLGCRU2zBUrXpeByP8liW8Pgmi3AelR2OWF+u S1l+lZvK49UB2+OvWRiLyEcKxivze5qW4FmGCZCXgQlseg1cAKryb8Gt2RBijg140AeX 99CFc0Y7Sa60vzeajvEQYvPaJWiehjKX238UgqlHjzWiVNx7pX56PSberbBQkyp6PqUL sogQ== X-Gm-Message-State: AOAM5326of3xooFYYuFjyYxvdkCf9uAASseAjwp+yRo+AgURa7XkRoql jro2cinCq0SBxvv7FAMyxxeVHlso2DU7HLmK7/g= X-Google-Smtp-Source: ABdhPJxSIsum5cK32jXqnvjrdpm0UVdPcRXYyoyThx6YhqGl/LOxGEgK+2QHk3M+IiGcQNxt+481gtIUJd1KeP61mzc= X-Received: by 2002:ab0:754b:0:b0:349:1e49:cb97 with SMTP id k11-20020ab0754b000000b003491e49cb97mr2142807uaq.92.1646184222044; Tue, 01 Mar 2022 17:23:42 -0800 (PST) MIME-Version: 1.0 References: <20220301020312.8827-1-hongtao.liu@intel.com> In-Reply-To: From: Hongtao Liu Date: Wed, 2 Mar 2022 09:32:23 +0800 Message-ID: Subject: Re: [PATCH] [i386] Replace ix86_gen_scratch_sse_rtx with gen_reg_rtx. To: "H.J. Lu" Cc: liuhongt , GCC Patches Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, 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.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Mar 2022 01:23:44 -0000 On Wed, Mar 2, 2022 at 6:49 AM H.J. Lu wrote: > > On Tue, Mar 1, 2022 at 7:06 AM H.J. Lu wrote: > > > > On Mon, Feb 28, 2022 at 9:36 PM Hongtao Liu wrote: > > > > > > On Tue, Mar 1, 2022 at 10:39 AM H.J. Lu via Gcc-patches > > > wrote: > > > > > > > > On Mon, Feb 28, 2022 at 6:26 PM H.J. Lu wrote: > > > > > > > > > > On Mon, Feb 28, 2022 at 6:03 PM liuhongt wrote: > > > > > > > > > > > > .. in ix86_expand_vector_move and > > > > > > ix86_convert_const_wide_int_to_broadcast(called by the former). > > > > > > > > > > > > ix86_expand_vector_move is called by emit_move_insn which is used by > > > > > > many pre_reload passes, ix86_gen_scratch_sse_rtx will break data flow > > > > > > when there's explict usage of xmm7/xmm15/xmm31. > > > > > > > > > > > > Bootstrapped and regtested on x86_64-linux-gnu{-m32,} > > > > > > for both w/and w/o --with-cpu=native --with-arch=native. > > > > > > > > > > > > Ok for trunk? > > > > > > > > > > > > gcc/ChangeLog: > > > > > > > > > > > > PR target/104704 > > > > > > * config/i386/i386-expand.cc > > > > > > (ix86_convert_const_wide_int_to_broadcast): Replace > > > > > > ix86_gen_scratch_sse_rtx with gen_reg_rtx. > > > > > > (ix86_expand_vector_move): Ditto. > > > > > > * config/i386/sse.md (*vec_dupv4si): Add alternative $r and > > > > > > corresponding splitter after it. > > > > > > > > > > > > gcc/testsuite/ChangeLog: > > > > > > > > > > > > * gcc.target/i386/incoming-11.c: Revert r12-2665-g7f4c3943f795fd. > > > > > > * gcc.target/i386/pr100865-11b.c: Expect vmovdqa or vmovda64. > > > > > > * gcc.target/i386/pr100865-12b.c: Ditto. > > > > > > * gcc.target/i386/pr100865-8b.c: Ditto. > > > > > > * gcc.target/i386/pr100865-9b.c: Ditto. > > > > > > * gcc.target/i386/pr82941-1.c: Expect vzeroupper for ! ia32. > > > > > > * gcc.target/i386/pr82942-1.c: Ditto. > > > > > > * gcc.target/i386/pr82990-1.c: Ditto. > > > > > > * gcc.target/i386/pr82990-3.c: Ditto. > > > > > > * gcc.target/i386/pr82990-5.c: Ditto. > > > > > > --- > > > > > > gcc/config/i386/i386-expand.cc | 6 +-- > > > > > > gcc/config/i386/sse.md | 41 +++++++++++++++----- > > > > > > gcc/testsuite/gcc.target/i386/incoming-11.c | 2 +- > > > > > > gcc/testsuite/gcc.target/i386/pr100865-11b.c | 2 +- > > > > > > gcc/testsuite/gcc.target/i386/pr100865-12b.c | 2 +- > > > > > > gcc/testsuite/gcc.target/i386/pr100865-8b.c | 2 +- > > > > > > gcc/testsuite/gcc.target/i386/pr100865-9b.c | 2 +- > > > > > > gcc/testsuite/gcc.target/i386/pr82941-1.c | 3 +- > > > > > > gcc/testsuite/gcc.target/i386/pr82942-1.c | 3 +- > > > > > > gcc/testsuite/gcc.target/i386/pr82990-1.c | 3 +- > > > > > > gcc/testsuite/gcc.target/i386/pr82990-3.c | 3 +- > > > > > > gcc/testsuite/gcc.target/i386/pr82990-5.c | 3 +- > > > > > > 12 files changed, 45 insertions(+), 27 deletions(-) > > > > > > > > > > > > diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc > > > > > > index faa0191c6dd..75a28cdd89d 100644 > > > > > > --- a/gcc/config/i386/i386-expand.cc > > > > > > +++ b/gcc/config/i386/i386-expand.cc > > > > > > @@ -257,7 +257,7 @@ ix86_convert_const_wide_int_to_broadcast (machine_mode mode, rtx op) > > > > > > machine_mode vector_mode; > > > > > > if (!mode_for_vector (broadcast_mode, nunits).exists (&vector_mode)) > > > > > > gcc_unreachable (); > > > > > > - rtx target = ix86_gen_scratch_sse_rtx (vector_mode); > > > > > > + rtx target = gen_reg_rtx (vector_mode); > > > > > > > > > > I think ix86_gen_scratch_sse_rtx should check > > > > > currently_expanding_gimple_stmt == NULL > > > > > to return gen_reg_rtx (vector_mode) instead. > > > > > > > > Like this: > > > > > > > > diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc > > > > index b2bf90576d5..6c0e4929914 100644 > > > > --- a/gcc/config/i386/i386.cc > > > > +++ b/gcc/config/i386/i386.cc > > > > @@ -23786,7 +23786,7 @@ ix86_optab_supported_p (int op, machine_mode > > > > mode1, machine_mode, > > > > rtx > > > > ix86_gen_scratch_sse_rtx (machine_mode mode) > > > > { > > > > - if (TARGET_SSE && !lra_in_progress) > > > > + if (TARGET_SSE && currently_expanding_gimple_stmt) > > > > { > > > > unsigned int regno; > > > > if (TARGET_64BIT) > > > > (END) > > > Looks like it relies on PR104721. > > > > I have checked the fix for PR104721. > > > > The proposed patch doesn't fix the testcase in: > The original patch can, then i prefer my patch to currently_expanding_gimple_stmt. > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104704 > > I am testing: > > https://gitlab.com/x86-gcc/gcc/-/merge_requests/28 > > -- > H.J. -- BR, Hongtao