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 6D9D73858431 for ; Tue, 23 Jan 2024 12:01:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6D9D73858431 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6D9D73858431 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706011307; cv=none; b=TopI/8V39LRSsBwBRNXxQtTMc0xAqxMSowBCffS1cN/HYqCUebfANFj6UloQyGOHbicOTCxpqpMPRuCh+NOxOF60stIFlNDXEtJZEWoKnE3/Fo+17co0tfbHGjg639wfgVG5YMBNIUa+Gdi+UNu8GmSkKd5W7p1AGffi3I2hG5Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706011307; c=relaxed/simple; bh=I366IkeIIGAt+hlrPDPym6KPEI6ypEZCkt/axZ0dBJw=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=Aeafwu42D84CJfct3B5aDYI7VduhEPzVU7SDnDwlpN2mqmls/Fr+V3MPNeaPPBvXzfP44YvRGjvsp5/bUbHH8q3Cnuc2DEQ9GNlvNnVlX8G9U72o2wo6sKkmacTCjPQr+4fJjNNsPCDb5eSNliaHhWVL4jBYzf2FgPOSTJnwOss= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706011306; 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=h10Ox/j7RK4/I4NSn4XiQttBMhgQLa3jhnQqp6IF4IY=; b=PDE9HZLAvwDM3XxDUQ6BopDuDpy/lUUPEah0W79SEIkx2ymcbKADUXBRnDUxdoqUs6UV0u nwmxVcm5XIZJISiqtagmp+QUHixYVDE1gvgH0pHwlMbquVqoV9QP0IGNsReWiR7DpyjZf2 Hk+hJymIv8AtEBiD9eBuZhC++zevxuQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-407-axbB2p3IOYiycp_1oIgG_A-1; Tue, 23 Jan 2024 07:01:44 -0500 X-MC-Unique: axbB2p3IOYiycp_1oIgG_A-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5C00484ACA2; Tue, 23 Jan 2024 12:01:44 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 206781C060AF; Tue, 23 Jan 2024 12:01:44 +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 40NC1fD91534242 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 23 Jan 2024 13:01:42 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 40NC1eBw1534241; Tue, 23 Jan 2024 13:01:40 +0100 Date: Tue, 23 Jan 2024 13:01:40 +0100 From: Jakub Jelinek To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] tree-optimization/113552 - fix num_call accounting in simd clone vectorization Message-ID: Reply-To: Jakub Jelinek References: <20240123115653.47E5C136A4@imap1.dmz-prg2.suse.org> MIME-Version: 1.0 In-Reply-To: <20240123115653.47E5C136A4@imap1.dmz-prg2.suse.org> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 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=-10.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE 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 Tue, Jan 23, 2024 at 12:56:52PM +0100, Richard Biener wrote: > The following avoids using exact_log2 on the number of SIMD clone calls > to be emitted when vectorizing calls since that can easily be not > a power of two in which case it will return -1. For different simd > clones the number of calls will differ by a multiply with a power of two > only so using floor_log2 is good enough here. > > Bootstrap and regtest running on x86_64-unknown-linux-gnu. > > PR tree-optimization/113552 > * tree-vect-stmts.cc (vectorizable_simd_clone_call): Use > floor_log2 instead of exact_log2 on the number of calls. Is there any target which supports non-power-of-two simdlen? If not, perhaps we should add !pow2p_hwi (num_calls) to the continue; condition a few lines earlier? > diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc > index 09749ae3817..1dbe1115da4 100644 > --- a/gcc/tree-vect-stmts.cc > +++ b/gcc/tree-vect-stmts.cc > @@ -4071,7 +4071,7 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info, > || (nargs != simd_nargs)) > continue; > if (num_calls != 1) > - this_badness += exact_log2 (num_calls) * 4096; > + this_badness += floor_log2 (num_calls) * 4096; > if (n->simdclone->inbranch) > this_badness += 8192; > int target_badness = targetm.simd_clone.usable (n); > -- > 2.35.3 Jakub