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.129.124]) by sourceware.org (Postfix) with ESMTPS id 58052395B06C for ; Wed, 16 Nov 2022 15:37:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 58052395B06C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668613069; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=9HH+wCnt1W1KBtwlLbuIA9E5O1aSUrvYn5++UBhMJ+M=; b=UumptSEJk5UctM+G4YiLGhnOIwgsuPVtZiXAo9mcb2L2JBoOgRSMTpLM1wC+8wzCj6LSwH ceva+FiuyE7H0hm/tEikskIyhU+BpktMr8u770TGdUaWCzy963/3a96NtTmygFm71vojR+ k6VJ+2ZuG5v4VKeE05DpeY1E4qEJVl4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-637-7KQqte1rMB2CZnid0_0CUg-1; Wed, 16 Nov 2022 10:37:46 -0500 X-MC-Unique: 7KQqte1rMB2CZnid0_0CUg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1BF0888646B; Wed, 16 Nov 2022 15:37:46 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.193.99]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B4C861121333; Wed, 16 Nov 2022 15:37:45 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 2AGFbdg12467438 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 16 Nov 2022 16:37:40 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 2AGFbcdc2467437; Wed, 16 Nov 2022 16:37:38 +0100 Date: Wed, 16 Nov 2022 16:37:37 +0100 From: Jakub Jelinek To: Richard Biener Cc: Tamar Christina , Hongyu Wang , Prathamesh Kulkarni , Richard Sandiford , Hongyu Wang , "hongtao.liu@intel.com" , "gcc-patches@gcc.gnu.org" Subject: Re: [PATCH] Optimize VEC_PERM_EXPR with same permutation index and operation [PR98167] Message-ID: Reply-To: Jakub Jelinek References: <20221104000432.15254-1-hongyu.wang@intel.com> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,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 Wed, Nov 16, 2022 at 04:30:06PM +0100, Richard Biener via Gcc-patches wrote: > On Wed, Nov 16, 2022 at 4:29 PM Richard Biener > wrote: > > > > On Wed, Nov 16, 2022 at 4:25 PM Tamar Christina wrote: > > > > > > Hi, > > > > > > This patch is causing several ICEs because it changes the permutes from a single register > > > permute to a multi register due to the lowering of the expressions to different SSA names. > > > > > > See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107717 > > > > > > I have a prototype fix which adds a new rule to CSE this back to a single register permute, > > > but would this be the right solution? It seems hard to later on during expand realize that > > > the two operands are the same. > > > > > > It's probably also ok to just block this from happening after vec_lower, however I'm worried that > > > If it wasn't CSE'd before vec_lower it'll lower it so something much less efficient. > > > > You can use > > > > (vec_perm (op@7 @0 @1) @3) > > Err, (vec_perm (op@7 @0 @1) @7) obviously. Even: --- gcc/match.pd.jj 2022-11-15 07:56:05.240348804 +0100 +++ gcc/match.pd 2022-11-16 16:35:34.854080956 +0100 @@ -8259,7 +8259,7 @@ and, (simplify (op (vec_perm @0 @0 @2) (vec_perm @1 @1 @2)) (if (VECTOR_INTEGER_TYPE_P (type)) - (vec_perm (op @0 @1) (op @0 @1) @2)))) + (vec_perm (op@3 @0 @1) @3 @2)))) /* Similar for float arithmetic when permutation constant covers all vector elements. */ @@ -8298,4 +8298,4 @@ and, } } (if (full_perm_p) - (vec_perm (op @0 @1) (op @0 @1) @2)))))) + (vec_perm (op@3 @0 @1) @3 @2)))))) >From quick look at the dumps, it seems to work fine. Jakub