From patchwork Fri Jun 23 12:14:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 112112 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp5725914vqr; Fri, 23 Jun 2023 05:15:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ60VdU3SAI5yHrJ1sHGpQXYPphPHHjNx4guiPi6Kwkh923JOpSfZ1fRvrAw2kncHQJsCCLn X-Received: by 2002:a17:907:9305:b0:96f:8666:5fc4 with SMTP id bu5-20020a170907930500b0096f86665fc4mr19815863ejc.50.1687522534130; Fri, 23 Jun 2023 05:15:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687522534; cv=none; d=google.com; s=arc-20160816; b=g/iM00uJnaJSRTNyowT4oQh9XntrQGEHRYgUCVGwrpVyuXih5yQPwuuSaL1qLg0h/8 cuR9zANoyqojF6mOvkNskgiFdcSDxIE176DYUAOuMD+0ENq899dtkBvoL2OggaKzjaP+ aMWDjCBPwYJvgK90tyDbit6UNPyFGwaXfxJ+Alc0ROI5KX0VtbncjKMAo9tDGwnGC5WL cUMAWzmpce8OuP7YIdBin4dzkBDbFZBn8XYhTbqn4EfnyCtaiooZ7Ot9Y2dpCJ1qDqPG b4SuL5CDguvPrtQJNx4mDIU3WQajx5mPeCmOq0hx41dbnuAuTE/m1CLgQ1DwAp4zQX8+ 9GEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:message-id :mime-version:subject:to:date:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=v8VS9eFGz2zBcis3lSg1ATTqNJyq5kqzHlHXqDZ8Uok=; b=AmCXvzeA/zZxr/pFILweHbwtO2g9OdPYsutkDaLISiTpKHukLrGNRxZhaz8zSIZrY6 E57sU1CDK5SrquPNROjpaxFjZpHfczs0/QBUZyEQq9h1H5jPlL2xp5xeFXSGnh3T1k4o EHs4jkOkT/QfLPM8W58Vlz+X1cBEmXYZQv5nxJpzgfXKtm5GptY9Ds7WvelK1TWKLuri n86YSb6RVlVnqCYkIRFQKI8NilgwFjvE3jUAlPC9Ep0x0aPd8O1+khixSr3gndDIvtDV XkGvNcUok1DFCm3fUiF82ZzMNDQj/szL8K4dB6XstuVtwGerW7ci6nXWBpVYJHT5uv55 rqHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=fAEGkm4u; 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=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id ju23-20020a17090798b700b00988ac7422e4si746361ejc.630.2023.06.23.05.15.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 05:15:34 -0700 (PDT) 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=@gcc.gnu.org header.s=default header.b=fAEGkm4u; 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=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E9368385771A for ; Fri, 23 Jun 2023 12:15:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E9368385771A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687522524; bh=v8VS9eFGz2zBcis3lSg1ATTqNJyq5kqzHlHXqDZ8Uok=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=fAEGkm4ut2esRRnG3hJV7b7N8hWVgpYSJG+xCd6kmxxszwbcnMsCtb1n2DJLASaUO nCc9XaQ0bsAVXdciMk4oZMcelJYUsfNYydrnirHDw/2J/XsxOrPvJftltSsJgyFh8W v7LhhAP3x0fW1694zUv9geEFjoKhlmXAbPvuySJA= 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 1F1B73858CD1 for ; Fri, 23 Jun 2023 12:14:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1F1B73858CD1 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 4E1DC21B0D for ; Fri, 23 Jun 2023 12:14:42 +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 3A967134FB for ; Fri, 23 Jun 2023 12:14:42 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id cMjlDLKMlWS2LgAAMHmgww (envelope-from ) for ; Fri, 23 Jun 2023 12:14:42 +0000 Date: Fri, 23 Jun 2023 14:14:41 +0200 (CEST) To: gcc-patches@gcc.gnu.org Subject: [PATCH] Deal with vector typed operands in conversions MIME-Version: 1.0 Message-Id: <20230623121442.3A967134FB@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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769495628748595586?= X-GMAIL-MSGID: =?utf-8?q?1769495628748595586?= The following avoids using TYPE_PRECISION on VECTOR_TYPE when looking for bit-precision changes in vectorizable_assignment. We didn't anticipate a stmt like _21 = VIEW_CONVERT_EXPR(vect__1.7_28); and the following makes sure to handle that. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. * tree-vect-stmts.cc (vectorizable_assignment): Properly handle non-integral operands when analyzing conversions. --- gcc/tree-vect-stmts.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index e6649789540..01cb19ce933 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -5833,12 +5833,15 @@ vectorizable_assignment (vec_info *vinfo, /* We do not handle bit-precision changes. */ if ((CONVERT_EXPR_CODE_P (code) || code == VIEW_CONVERT_EXPR) - && INTEGRAL_TYPE_P (TREE_TYPE (scalar_dest)) - && (!type_has_mode_precision_p (TREE_TYPE (scalar_dest)) - || !type_has_mode_precision_p (TREE_TYPE (op))) + && ((INTEGRAL_TYPE_P (TREE_TYPE (scalar_dest)) + && !type_has_mode_precision_p (TREE_TYPE (scalar_dest))) + || (INTEGRAL_TYPE_P (TREE_TYPE (op)) + && !type_has_mode_precision_p (TREE_TYPE (op)))) /* But a conversion that does not change the bit-pattern is ok. */ - && !((TYPE_PRECISION (TREE_TYPE (scalar_dest)) - > TYPE_PRECISION (TREE_TYPE (op))) + && !(INTEGRAL_TYPE_P (TREE_TYPE (scalar_dest)) + && INTEGRAL_TYPE_P (TREE_TYPE (op)) + && (TYPE_PRECISION (TREE_TYPE (scalar_dest)) + > TYPE_PRECISION (TREE_TYPE (op))) && TYPE_UNSIGNED (TREE_TYPE (op)))) { if (dump_enabled_p ())