From patchwork Tue Nov 22 08:48:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 60960 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2ABA63858296 for ; Tue, 22 Nov 2022 08:49:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2ABA63858296 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669106965; bh=GHcZqIXOhyM5pXqNlF4VoQ9U2GHbxFbxjAd/MKjqpZY=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=oIOgJsi37ErwAJlfZ6bGkT53HMSTIxc1c85ehquAqzzwqde+wDh3MctDl1XU98yGb ZhCUo6uygiCYK2ufP5hUxYeyjVPRVW2eL38plrdqhZ5K7URuZ+Pp1fgct8QkWfCZMK 5GXlOB0SPLdPV92DiL8RKlyelTOqsIhjXBMxNMrE= 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 [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 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) 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) To: gcc-patches@gcc.gnu.org Subject: [PATCH] tree-optimization/107672 - avoid vector mode type_for_mode call MIME-Version: 1.0 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Richard Biener via Gcc-patches From: Richard Biener Reply-To: Richard Biener Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" 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)