From patchwork Thu Jul 11 08:33: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: 1959154 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=kLr+VI9d; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=E9BqLp1E; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=FzklTJ0h; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=Ze+0jzRp; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WKSh73XFdz1xqr for ; Thu, 11 Jul 2024 18:34:31 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B31E9384A456 for ; Thu, 11 Jul 2024 08:34:29 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2a07:de40:b251:101:10:150:64:1]) by sourceware.org (Postfix) with ESMTPS id 015273858D3C for ; Thu, 11 Jul 2024 08:33:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 015273858D3C 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 015273858D3C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720686839; cv=none; b=kVmQcRrzRKYr4yu3NL1dY5Gt48za45pIeR9Dcfo1BfnUfbOr2UEUXBnFI7bUUYnj5ChJyx0jxLo46Qhm7hnIp5dHsTOXUm50J5tyaWOTv1VDzxgtBluQzCGH6sm5rvUKTyi232nTfIR3DkP7xTqE151HG6J7IgcEyH1Ww7nDjpY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720686839; c=relaxed/simple; bh=vCH16KqTBrMEZMThtVH5+T4IMHudOrwlONCbzLL+jp0=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:Date: From:To:Subject:MIME-Version; b=nH2/2I2ncooSHBpTRQl5gs2OwyubCkKK1HZ3xYWIMdTWRItqRRC0gTjUP+VdFd7oNHiGNuNMAQhItps0d8KXfnzUKPUdd4SjEFX+meQ5hzSwcky1CFy00AsjqrEzaZhoJxb3GDBX6H+ycX7lj2YEcREPAcGvw3R1OURgXW7cEjA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from murzim.nue2.suse.org (unknown [10.168.4.243]) (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-out1.suse.de (Postfix) with ESMTPS id D204721AC0 for ; Thu, 11 Jul 2024 08:33:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1720686833; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=EamWijaSUJemetw6yvTAgRwaogNNxHVWyPLPp6qbQKQ=; b=kLr+VI9duN1zpcektWOtbDDxG61t6LOc+0cqvbvybMcH4Q5ZVT0LXfdmekLk7RTbBaLaYo tT8ejOWWrUkwrezl9iTXu1kaG3TJ7snMMxo97qRyg/Q0ysfcN5Y2+94EFj5NfIJeH10ukJ MImJ9bNJAsPKv4E0ljntp96Jzaaf10w= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1720686833; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=EamWijaSUJemetw6yvTAgRwaogNNxHVWyPLPp6qbQKQ=; b=E9BqLp1EkEhcxtNXScfk3McdciaKbgv7Ovbhkj4liZbkkPXC7DA4qbl8AQBE1/ZUFVuXcl YmnOAgwQNdbr+LDg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1720686832; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=EamWijaSUJemetw6yvTAgRwaogNNxHVWyPLPp6qbQKQ=; b=FzklTJ0hKrYHum8/0fLFFIt5Yr/7y2R8Aj7ZEwLOuUQ7oFBT3pzEqKF+SnHPBY3SCdWnmV pxxvnp0GWeZgZDEy1edsTw+auNv4kwOsG8FM03y6zp2OXbEe0FpCfL2XWVnRzZduOPEWag 2LRilHdjHyRIQoVWQImZDS3hjC4CWU8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1720686832; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=EamWijaSUJemetw6yvTAgRwaogNNxHVWyPLPp6qbQKQ=; b=Ze+0jzRpMq+rgQcJJFRSTnUUtH6XaJXMCFZYE2klTwNnWiFBsNdigt17k1fPtYiQjZld2T d9c8eFEPpH5j6sDw== Date: Thu, 11 Jul 2024 10:33:52 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] tree-optimization/115868 - ICE with .MASK_CALL in simdclone MIME-Version: 1.0 X-Spam-Score: 4.54 X-Spamd-Result: default: False [4.54 / 50.00]; MISSING_MID(2.50)[]; NEURAL_SPAM_SHORT(2.14)[0.715]; MIME_GOOD(-0.10)[text/plain]; RCVD_COUNT_ZERO(0.00)[0]; ARC_NA(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; MISSING_XM_UA(0.00)[]; FROM_HAS_DN(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; TO_DN_NONE(0.00)[]; MIME_TRACE(0.00)[0:+] X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, MISSING_MID, 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 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~incoming=patchwork.ozlabs.org@gcc.gnu.org Message-Id: <20240711083429.B31E9384A456@sourceware.org> The following adjusts mask recording which didn't take into account that we can merge call arguments from two vectors like _50 = {vect_d_1.253_41, vect_d_1.254_43}; _51 = VIEW_CONVERT_EXPR(mask__19.257_49); _52 = (unsigned int) _51; _53 = _Z3bazd.simdclone.7 (_50, _52); _54 = BIT_FIELD_REF <_53, 256, 0>; _55 = BIT_FIELD_REF <_53, 256, 256>; The testcase g++.dg/vect/pr68762-2.cc exercises this on x86_64 with partial vector usage enabled and AVX512 support. Bootstrap and regtest running on x86_64-unknown-linux-gnu. Richard. PR tree-optimization/115868 * tree-vect-stmts.cc (vectorizable_simd_clone_call): Adjust the number of mask copies required for vect_record_loop_mask. --- gcc/tree-vect-stmts.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index 8b5d82c005c..5c9f2329ad3 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -4349,9 +4349,14 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info, case SIMD_CLONE_ARG_TYPE_MASK: if (loop_vinfo && LOOP_VINFO_CAN_USE_PARTIAL_VECTORS_P (loop_vinfo)) - vect_record_loop_mask (loop_vinfo, - &LOOP_VINFO_MASKS (loop_vinfo), - ncopies, vectype, op); + { + unsigned mult + = exact_div (bestn->simdclone->simdlen, + TYPE_VECTOR_SUBPARTS (vectype)).to_constant (); + vect_record_loop_mask (loop_vinfo, + &LOOP_VINFO_MASKS (loop_vinfo), + ncopies * mult, vectype, op); + } break; }