From patchwork Tue Jan 23 11:56:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 190879 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp279046dyi; Tue, 23 Jan 2024 03:57:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IHG1Dbpnu8YZmg9mpgVeCZT/iowcfnI05C7bg+gY1Zloty6LL9lNRZtKKR/EG9C0dQ++IJK X-Received: by 2002:ac8:57d0:0:b0:42a:49e4:df with SMTP id w16-20020ac857d0000000b0042a49e400dfmr700903qta.44.1706011057159; Tue, 23 Jan 2024 03:57:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706011057; cv=pass; d=google.com; s=arc-20160816; b=MlNIsBCAy2XnE/zSkgwEBujNOkY8vQb53wBb0i3XmaM5dJsO4fsGbd7mJ0HCyGnNVk iYkwlqHfjc4NJ56VhiAnHFwNq8QWXLkz/tdGWkl8zIBMIkFO05KOCTrUtEQb2+ndY20T fMDdSXOBX3DL41JSNR+/qd9JVfxFL72XJBieJs/3K0LSexCTcIwmiWWlXwYapeht9HJL QKW9jTYHyfcjj06ay88Aeu3jvaZQ4AJSVvEuu9I5HWrYvYlLOVKjDEQh9v5m7QUayCRB 7s+eMn8d6vlwqI4ZCL5Hrwm9zrRCc0WuCN1XNHDwpy2fkvL8It2OBI2CyNom5gkCmaag N9dQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:message-id:mime-version:subject :to:from:date:dkim-signature:dkim-signature:dkim-signature :dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=2pTK6t+rWS8yi9pFwnOUwj4B+tity3NuELV226Ufi8E=; fh=hPrbWPhweUx4V0GV9uXJqbyAzg2ABmTz7kczrAQqMmM=; b=yae6aiHafZRb7d4ttGuKDLxGeasShQOUUgzmt+W50rsUqSlt7axfxQjpx+fskA7ArY mhT/YGxUXASFzFDanUNfcPFp89hIy15+EGhxMAQBgpkkyWiI0un0iGGEHynhpHDjyJDR 9QPYrJBaDj5efU7D8W43Md/dYGqpA96yzexmSciMsRC3cc4vL4qS4jFv1bJoFuJ+Ubzr BjOlqvk7SAcFJIR0rKgazjIiZD0tKoV6glBsRa3DUylBiPF8bNjeDGxUsQtxij8isBR3 u4S2gUcHUiF62dB0zeHmcB+7fvoHeWnO0RJIQ35wVDWOJ02xP3mkN+eHFDPyKHtHtMKR U1wA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=hN3yL7Hm; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=hN3yL7Hm; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id d8-20020ac85d88000000b00429f469eafbsi7641286qtx.254.2024.01.23.03.57.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 03:57:37 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=hN3yL7Hm; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=hN3yL7Hm; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D9266385801D for ; Tue, 23 Jan 2024 11:57:36 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) by sourceware.org (Postfix) with ESMTPS id 7F2803858429 for ; Tue, 23 Jan 2024 11:56:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7F2803858429 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7F2803858429 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:2 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706011016; cv=none; b=c/Nr2+yZxJ16hPCKTHBwvtQZ3GM3NcZt9WpDgyQNLJL4gttTEINjH7Ze1+nwwcBbs8ZMJxwV7CGca8yXg8zhFNtca3Dao62m/VU7wCPv2y3WgZA4YJiAwYGD/0MfWyMGNkMhPfQ+c5LVo8hMyDoJ189chqbvodht+6zSWaS8c6s= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706011016; c=relaxed/simple; bh=MbJd8coALZwEXn08BSnKEi5Af2XGkToN04jbVjIgonk=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:Date: From:To:Subject:MIME-Version:Message-Id; b=bkIcpwqofdnxSEfD/9qkqzZCMrEi1gwr71dCIDE5poDjZ3J2ZzrlwahcpwVGVwZ6Lmssq+PTtFvJfQdp8a3zkoPJIJmldl7oX/u0+PEGzARsECpOfpEXsHUojCXwQKBP48Qv4L8a1HbEhnqG8TCBjKO6OnWm0nAMLAm1pt0j19A= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 68B1A1F78D for ; Tue, 23 Jan 2024 11:56:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1706011013; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=2pTK6t+rWS8yi9pFwnOUwj4B+tity3NuELV226Ufi8E=; b=hN3yL7Hm0yeWCIhcSPHNYW65wWAA5Ke5fOL7g/cUxYeVhgTocFnLf4EvJoDW+5ZKJ034y1 5B5DLa1CinPYSkUBKU56pNzttiPvFsL5p0OzSfWUmneUmjwiUBNs2IvQsPuNkSMNmk1K1T bAc7dotR1UuIxPzrvr1qJTH9NSnwiyo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1706011013; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=2pTK6t+rWS8yi9pFwnOUwj4B+tity3NuELV226Ufi8E=; b=oVKhjWdPS1yZGl2yhztj22DzidKl+G4XH9TcZ0Mz/MrHMPdg2GTaDw3krEzr/TJG+W29VN 6Xltq5o/IthquaAQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1706011013; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=2pTK6t+rWS8yi9pFwnOUwj4B+tity3NuELV226Ufi8E=; b=hN3yL7Hm0yeWCIhcSPHNYW65wWAA5Ke5fOL7g/cUxYeVhgTocFnLf4EvJoDW+5ZKJ034y1 5B5DLa1CinPYSkUBKU56pNzttiPvFsL5p0OzSfWUmneUmjwiUBNs2IvQsPuNkSMNmk1K1T bAc7dotR1UuIxPzrvr1qJTH9NSnwiyo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1706011013; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=2pTK6t+rWS8yi9pFwnOUwj4B+tity3NuELV226Ufi8E=; b=oVKhjWdPS1yZGl2yhztj22DzidKl+G4XH9TcZ0Mz/MrHMPdg2GTaDw3krEzr/TJG+W29VN 6Xltq5o/IthquaAQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 47E5C136A4 for ; Tue, 23 Jan 2024 11:56:53 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 7dJSD4Wpr2VzNAAAD6G6ig (envelope-from ) for ; Tue, 23 Jan 2024 11:56:53 +0000 Date: Tue, 23 Jan 2024 12:56:52 +0100 (CET) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] tree-optimization/113552 - fix num_call accounting in simd clone vectorization MIME-Version: 1.0 Message-Id: <20240123115653.47E5C136A4@imap1.dmz-prg2.suse.org> Authentication-Results: smtp-out2.suse.de; none X-Spam-Level: X-Spam-Score: -4.29 X-Spamd-Result: default: False [-4.29 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[gcc-patches@gcc.gnu.org]; TO_DN_NONE(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-2.99)[99.97%] X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788882249944628792 X-GMAIL-MSGID: 1788882249944628792 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. --- gcc/tree-vect-stmts.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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);