From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 0E7A03836039 for ; Thu, 12 Aug 2021 09:41:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0E7A03836039 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-426-FexIz9rGNnKnmgowfPdTvQ-1; Thu, 12 Aug 2021 05:41:48 -0400 X-MC-Unique: FexIz9rGNnKnmgowfPdTvQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B16B5801B3C; Thu, 12 Aug 2021 09:41:47 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.193.120]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4EFC14536; Thu, 12 Aug 2021 09:41:47 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.16.1/8.16.1) with ESMTPS id 17C9fjYe1054916 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 12 Aug 2021 11:41:45 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.16.1/8.16.1/Submit) id 17C9fi1s1054913; Thu, 12 Aug 2021 11:41:44 +0200 Date: Thu, 12 Aug 2021 11:41:44 +0200 From: Jakub Jelinek To: liuhongt , gcc-patches@gcc.gnu.org Subject: Re: [PATCH] [i386] Optimize vec_perm_expr to match vpmov{dw,qd,wb}. Message-ID: <20210812094144.GZ2380545@tucnak> Reply-To: Jakub Jelinek References: <20210812054323.897480-1-hongtao.liu@intel.com> <20210812092248.GY2380545@tucnak> MIME-Version: 1.0 In-Reply-To: <20210812092248.GY2380545@tucnak> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP 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: Thu, 12 Aug 2021 09:41:51 -0000 On Thu, Aug 12, 2021 at 11:22:48AM +0200, Jakub Jelinek via Gcc-patches wrote: > So, I wonder if your new routine shouldn't be instead done after > in ix86_expand_vec_perm_const_1 after vec_perm_1 among other 2 insn cases > and handle the other vpmovdw etc. cases in combine splitters (see that we > only use low half or quarter of the result and transform whatever > permutation we've used into what we want). E.g. in the first function, combine tries: (set (reg:V16HI 85) (vec_select:V16HI (unspec:V32HI [ (mem/u/c:V32HI (symbol_ref/u:DI ("*.LC0") [flags 0x2]) [0 S64 A512]) (reg:V32HI 88) repeated x2 ] UNSPEC_VPERMT2) (parallel [ (const_int 0 [0]) (const_int 1 [0x1]) (const_int 2 [0x2]) (const_int 3 [0x3]) (const_int 4 [0x4]) (const_int 5 [0x5]) (const_int 6 [0x6]) (const_int 7 [0x7]) (const_int 8 [0x8]) (const_int 9 [0x9]) (const_int 10 [0xa]) (const_int 11 [0xb]) (const_int 12 [0xc]) (const_int 13 [0xd]) (const_int 14 [0xe]) (const_int 15 [0xf]) ]))) A combine splitter could run avoid_constant_pool_reference on the first UNSPEC_VPERMT2 argument and check the permutation if it can be optimized, ideally using some function call so that we wouldn't need too many splitters. Jakub