From patchwork Fri Jun 9 07:39:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 70810 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 E4F243857357 for ; Fri, 9 Jun 2023 07:40:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E4F243857357 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686296401; bh=pwM2Jm396AkQaXRHdaX6V5uUpfgwU2AtlYHb6LvgNVM=; h=Date:To:cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=mCraJIrmug/2YEGvIm1KCS3xLLsnaF1I/iDrf8bBLWgkswL0rgwgqmwMwbYNSBA4K +yaGgbQtK7QYUI+jOzDz1bV0V007Q/CmU5vLj8wX2qlJ46u5YkGOPAamDcL5MUavkZ lTJVcHaCdCFeeBfrxXMtxJ9UH1F+bQU2EnOMquMc= 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 [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 174AD3858C20 for ; Fri, 9 Jun 2023 07:39:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 174AD3858C20 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-out1.suse.de (Postfix) with ESMTPS id DDB93219A6; Fri, 9 Jun 2023 07:39:32 +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 C782913A47; Fri, 9 Jun 2023 07:39:32 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id jtuqLzTXgmQOTAAAMHmgww (envelope-from ); Fri, 09 Jun 2023 07:39:32 +0000 Date: Fri, 9 Jun 2023 09:39:32 +0200 (CEST) To: gcc-patches@gcc.gnu.org cc: pinskia@gmail.com Subject: [PATCH] middle-end/110182 - TYPE_PRECISION on VECTOR_TYPE causes wrong-code MIME-Version: 1.0 Message-Id: <20230609073932.C782913A47@imap2.suse-dmz.suse.de> X-Spam-Status: No, score=-11.5 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.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" When folding two conversions in a row we use TYPE_PRECISION but that's invalid for VECTOR_TYPE. The following fixes this by using element_precision instead. Bootstrap and regtest running on x86_64-unknown-linux-gnu. * match.pd (two conversions in a row): Use element_precision to DTRT for VECTOR_TYPE. --- gcc/match.pd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/match.pd b/gcc/match.pd index 4ad037d641a..4072afb474a 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -4147,19 +4147,19 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) int inside_ptr = POINTER_TYPE_P (inside_type); int inside_float = FLOAT_TYPE_P (inside_type); int inside_vec = VECTOR_TYPE_P (inside_type); - unsigned int inside_prec = TYPE_PRECISION (inside_type); + unsigned int inside_prec = element_precision (inside_type); int inside_unsignedp = TYPE_UNSIGNED (inside_type); int inter_int = INTEGRAL_TYPE_P (inter_type); int inter_ptr = POINTER_TYPE_P (inter_type); int inter_float = FLOAT_TYPE_P (inter_type); int inter_vec = VECTOR_TYPE_P (inter_type); - unsigned int inter_prec = TYPE_PRECISION (inter_type); + unsigned int inter_prec = element_precision (inter_type); int inter_unsignedp = TYPE_UNSIGNED (inter_type); int final_int = INTEGRAL_TYPE_P (type); int final_ptr = POINTER_TYPE_P (type); int final_float = FLOAT_TYPE_P (type); int final_vec = VECTOR_TYPE_P (type); - unsigned int final_prec = TYPE_PRECISION (type); + unsigned int final_prec = element_precision (type); int final_unsignedp = TYPE_UNSIGNED (type); } (switch