From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id C4C0B3858C20 for ; Tue, 22 Nov 2022 08:48:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C4C0B3858C20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id CB32E1F86B for ; Tue, 22 Nov 2022 08:48:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1669106930; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=GHcZqIXOhyM5pXqNlF4VoQ9U2GHbxFbxjAd/MKjqpZY=; b=WktCTEdfrqm9uqOH/5YPDtsSxTgL8KdUe6I9SGZEbpxmdIkPXeC21SggYiG56bYK6jVeeb qj7HJWmGN9iqrm/FfsIr1chmbBZ6XWYLgvCNFo6fp0US5pdMf9ik0ZNHbkofZngCWOd0SZ qzVJxoLB8gvRQ/b22SM0xL5Dd4+mw4o= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1669106930; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type; bh=GHcZqIXOhyM5pXqNlF4VoQ9U2GHbxFbxjAd/MKjqpZY=; b=GLEvn6uaigd/reGRU0xC7Y9GShrFlDbZlYwMEcG0+NigV1HJO34vUcO3Lo6wS8WWc6Z024 Ez982/YYnk2ujYCA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id B6CA313B01 for ; Tue, 22 Nov 2022 08:48:50 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id r3ZrK/KMfGOZJQAAMHmgww (envelope-from ) for ; Tue, 22 Nov 2022 08:48:50 +0000 Date: Tue, 22 Nov 2022 09:48:50 +0100 (CET) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] tree-optimization/107672 - avoid vector mode type_for_mode call MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Message-Id: <20221122084850.B6CA313B01@imap2.suse-dmz.suse.de> X-Spam-Status: No, score=-11.8 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 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: The following avoids using type_for_mode on vector modes which might not work for all frontends. Instead we look for the inner mode type and use build_vector_type_for_mode instead. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. PR tree-optimization/107672 * tree-vect-stmts.cc (supportable_widening_operation): Avoid type_for_mode on vector modes. --- gcc/tree-vect-stmts.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index bc0ef136f19..b35b986889d 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -12195,9 +12195,15 @@ supportable_widening_operation (vec_info *vinfo, intermediate_type = vect_halve_mask_nunits (prev_type, intermediate_mode); else - intermediate_type - = lang_hooks.types.type_for_mode (intermediate_mode, - TYPE_UNSIGNED (prev_type)); + { + gcc_assert (VECTOR_MODE_P (intermediate_mode)); + tree intermediate_element_type + = lang_hooks.types.type_for_mode (GET_MODE_INNER (intermediate_mode), + TYPE_UNSIGNED (prev_type)); + intermediate_type + = build_vector_type_for_mode (intermediate_element_type, + intermediate_mode); + } if (VECTOR_BOOLEAN_TYPE_P (intermediate_type) && VECTOR_BOOLEAN_TYPE_P (prev_type) -- 2.35.3