From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by sourceware.org (Postfix) with ESMTPS id 6F60A3858C39 for ; Fri, 14 Oct 2022 06:19:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6F60A3858C39 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-ed1-x529.google.com with SMTP id m16so5513506edc.4 for ; Thu, 13 Oct 2022 23:19:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=d6zPmeD8QcQwJhwT8KC3N83fowvdGaWsvYvfYq4tMAY=; b=AtAp1kS9fBe6JoGAhGtNg7oU8Jx+ZfDONWgU4sO8Y9yYXBp1hb3ps0hChs0uvQoz9q nSLjkwQcltKYKmCHSQjMxti+3A5wZCkkb4O1L7i5rb8mAKF7WOp9Xfp3OuZ6Kh1O+knz CR1O6ATl90zWoLxCjWDN4eqD6johxGJKopjHkNYlOIJmJqeH4wEFr476I6+KhlRnHDsL Miuv6DJ4DDrAK5BKlHmGAzrgkqAN9ub9hBulBa8ehBPJRHjne7qAVJcvtKsipNfU7AZ3 1FnPFEBVv2Q3xFPITAiWCO6eaGSobtb5H3/T8fMxtva6uw3/N450hYStHDqdvFIb+t/u fvtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=d6zPmeD8QcQwJhwT8KC3N83fowvdGaWsvYvfYq4tMAY=; b=gAVCwnSZmELTL01VELrzXmUra5xBk1zYxizEODH2/ybguCiy155CVp3Tqr2vDkISCC nykrvSBccwvFvP/hD+7LIpcqHljpE9yM24cLqPEJiQb0KszPhxQu9E7eOY9cdtVonKtZ NBh7JrttztXhO+zxext8DBSg5RDQfyyB2cCHeZsG034aMqOowGtLIJkrcDGYtiOBRQPP cc21hWp9AweNy8BB78GZ1giws9w/VcJ2GMVCuDxHu4pf/8QNwUgGUnkCAcLWaSCPvgRp zxPrN3tXWsOHgMKsYQELRB8wh5SrZLB5m9ehWzPN/IppplHghKStUL3qJnVGYyq7u+Sy Wa9Q== X-Gm-Message-State: ACrzQf0A9QzJHmxUW9d8NPZjnCjFieWCP+keS4LCVx6arWVOscFCMiNz bfz/6o/Pms5esfqBmP1HMR+7Dm0xLV7lkRpLcCg= X-Google-Smtp-Source: AMsMyM6KdvFuDYeTfQ+RFj6Uiug/t7vIDVCdHAsGbGsWO81H/vRoMNtWBQVwXFQ7xs8GayK+ZnJSGg/J2/HVEvvJQ8k= X-Received: by 2002:aa7:d415:0:b0:459:4c7:60ce with SMTP id z21-20020aa7d415000000b0045904c760cemr2930970edq.202.1665728351128; Thu, 13 Oct 2022 23:19:11 -0700 (PDT) MIME-Version: 1.0 References: <4D15AD37-C11D-4CDD-BFB1-37E1ECF0A0D5@levyhsu.com> <26e1323e4a0395fbd1bc71b8f7a3f016fa6df54b.camel@xry111.site> In-Reply-To: From: Richard Biener Date: Fri, 14 Oct 2022 08:18:58 +0200 Message-ID: Subject: Re: [PATCH] Optimize nested permutation to single VEC_PERM_EXPR [PR54346] To: Lulu Cheng Cc: Xi Ruoyao , Levy , wilson@tuliptree.org, gcc-patches@gcc.gnu.org, Liwei Xu 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 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, Oct 14, 2022 at 3:49 AM Lulu Cheng wrote: > > > =E5=9C=A8 2022/10/13 =E4=B8=8B=E5=8D=887:10, Richard Biener =E5=86=99=E9= =81=93: > > On Thu, Oct 13, 2022 at 10:16 AM Lulu Cheng wro= te: > >> > >> =E5=9C=A8 2022/10/13 =E4=B8=8B=E5=8D=882:44, Xi Ruoyao =E5=86=99=E9=81= =93: > >>> On Thu, 2022-10-13 at 14:15 +0800, Levy wrote: > >>>> Hi RuoYao > >>>> > >>>> It=E2=80=99s probably because loongarch64 doesn=E2=80=99t support > >>>> can_vec_perm_const_p(result_mode, op_mode, sel2, false) > >>>> > >>>> I=E2=80=99m not sure whether if loongarch will support it or should = I just > >>>> limit the test target for pr54346.c? > >>> I'm not sure if we can add TARGET_VECTORIZE_VEC_PERM_CONST when we do= n't > >>> actually support vector. (LoongArch has SIMD instructions but the > >>> support in GCC won't be added in a very recent future.) > >>> > >> If what I understand is correct, I think this might be a better soluti= on. > >> > >> /* { dg-do compile } */ > >> > >> +/* { dg-require-effective-target vect_perm } */ > >> /* { dg-options "-O -fdump-tree-dse1" } */ > > Btw, what forwprop does is check whether any of the original permutatio= ns are > > not supported and then elide the supportability check for the result. > > The reasoning > > is that the original permute(s) would be lowered during vectlower so we= can as > > well do that for the result. We should just never turn a supported per= mutation > > sequence into a not supported one. > > > > Richard. > > > Hi Richard: > > I'm very sorry. I don't fully understand what you mean. > > Could you give me some more details? The argument is that if Loongarch64 doesn't support the VEC_PERM_EXPR in th= e IL before the transform then it doesn't matter if the transform introduces ano= ther VEC_PERM_EXPR that isn't supported. Both are later (in the veclower pass) lowered to scalar operations. So instead of if (can_vec_perm_const_p (result_mode, op_mode, sel2, false)) .. you'd do if (can_vec_perm_const_p (result_mode, op_mode, sel2, false) || !can_vec_perm_const_p ( ... original vec_perm1 ...) || !can_vec_perm_const_p ( ... original vec_perm2 ...)) Richard. > > Thanks! > > Lulu Cheng > >