From patchwork Fri Jan 12 09:37:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 187630 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2614:b0:101:6a76:bbe3 with SMTP id mm20csp62846dyc; Fri, 12 Jan 2024 01:42:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IFm5RIAktgYkerTU2mp6rGynJbz/yXs5gxQrtQCNtkHhNulN0hHCFi+mMJdw+qSZ5CIk38X X-Received: by 2002:a05:620a:2119:b0:783:24dd:7c23 with SMTP id l25-20020a05620a211900b0078324dd7c23mr1178075qkl.156.1705052579526; Fri, 12 Jan 2024 01:42:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705052579; cv=pass; d=google.com; s=arc-20160816; b=khko8Xck8Kl5MXgthnbAIR1VGTzBjPEdOvS9DDfdLsWuCucUow7Xp/i/1H/UWRNWqT dq7JOQ+d3bLO+bRlkDkFRuDNAzAsQhXicDS+r+6F9exzgqlt7WNjh6H2rAKRTwt2qsGM A6ECGniZd+6+fiEQ2oBIOThf4t41fdj8mI9n2TO+madaM2eh9fpOkDpZq3vyDDHpyiZb KYMXRJtpEcqL2nWWm42ivrrx95SCt9rNibeWCpmnR7cABuHU8vYmkurCpP8nF1bGVkyx LeW5pdIpfK/pr7OLIwfFqQA5m5lu/knzFmBVxMGdHugQVNY4yVE8TwNHoAYG/SZPzMtT KcPA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:reply-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-disposition :mime-version:message-id:subject:cc:to:from:date:resent-to :resent-message-id:resent-date:resent-from:dkim-signature:arc-filter :dmarc-filter:delivered-to; bh=c78HdyDbXGA3Z/fSMXrgXV5Ezq87BGmMsME+wCaMHUs=; fh=FCjeRajqaQYHMkQtfIia8KT5yBac53mYOLLyJhYG/AY=; b=RwtrtQw7GHBm9tPsS33x+qFwnAFUPQckkiP6HOJIMWIc1ZgWJWRzPEuzNGYbHhJh6I byMTdl1MshveFt/k8BPoTKvOo9xKloRiqHuBn1iilDvGDL6zvEI3CWDXuWHnTG2bDQqV weQ1xNAX7EXLchhgfx9vuQUuhvbZBIrPCpjHv1E+LP+MqeeYPWa2U1Cev6ohBNmHlPog B8T07pRqy8Vn63k42PeZhrDiAkAC+vskX2bK6xAypVRtoS5pS5AtwnfnOpI9V8TUV4fJ S36LEgQY+Vb46GazR6kLqo1WBRIz0PNI9JIkwlxtsP7JTfbjlxdhLSLssoKpLvHmf0pK wJdg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gMYlBVVB; arc=pass (i=1); 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=redhat.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id u4-20020a05620a0c4400b0078347a0d7e2si1495532qki.101.2024.01.12.01.42.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jan 2024 01:42:59 -0800 (PST) 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=@redhat.com header.s=mimecast20190719 header.b=gMYlBVVB; arc=pass (i=1); 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=redhat.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A3EBA3858D35 for ; Fri, 12 Jan 2024 09:42:58 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 6E2253858D20 for ; Fri, 12 Jan 2024 09:42:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6E2253858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6E2253858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705052526; cv=none; b=ou0GOCTrJM7HicAhCQOcklehLXmb46msWwfhV8/QDy//XyQ9tLHGCE2NFnLkSiQVbvbCPWglHtOTajubDOxYaih73JSW044FK8+hYdA1q08dMNtkAl6gJCpr/hn1Ybj6ST4MOPfKAfQ+jMshL7//uH5mjx8+hfg+3LeYP+XXj+E= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705052526; c=relaxed/simple; bh=WugIkCfhMqAB7rIBjrJSIV5nPCNfHAXpvEyywoisxNY=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=VXw8THvQaCWkrAaozlR1Yqpb8Fjv8zq2fin6oO5nDtIOhyn+vcqKvpGOjBGipnKxvC/94YRHfPiKtXLRA5uUWbreuVqBQNzMyG5iVdw9HgLSpiUAvm50UkwZyEEp59G6qFmN8aRq6LH3qD5dzO2QjgeMlQ7ChVx1Sdz1qFe2mXU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705052524; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-to:resent-from:resent-message-id; bh=c78HdyDbXGA3Z/fSMXrgXV5Ezq87BGmMsME+wCaMHUs=; b=gMYlBVVBGOm9zqc0cF9Hc/z4ApBrXwXRX0xDS8GWEMdkA604hmxAkgwe6YOU4M/XcAkJ3j oF26HF6Cz5FdvonRLOLp3TbuHqAvzgqDJR5CLnUz8Uu1loPSqJyUkIqOrVc9eJskW06GB7 vkzH9K+BhYeRJTTU9B0Y1ouf99oDRI0= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-18-K0IkOatsNgOr2xVz-W968w-1; Fri, 12 Jan 2024 04:39:40 -0500 X-MC-Unique: K0IkOatsNgOr2xVz-W968w-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E0CD885A589; Fri, 12 Jan 2024 09:39:39 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.92]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A4BBA1C05E1A; Fri, 12 Jan 2024 09:39:39 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 40C9dbBv3307036 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 12 Jan 2024 10:39:37 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 40C9daWx3307035; Fri, 12 Jan 2024 10:39:36 +0100 Resent-From: Jakub Jelinek Resent-Date: Fri, 12 Jan 2024 10:39:36 +0100 Resent-Message-ID: Resent-To: Richard Biener , gcc-patches@gcc.gnu.org Date: Fri, 12 Jan 2024 10:37:46 +0100 From: Jakub Jelinek To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] lower-bitint: Fix a typo in a condition [PR113323] Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787877213762821054 X-GMAIL-MSGID: 1787877213762821054 Hi! The following testcase revealed a typo in condition, as the comment says the intent is /* If lhs of stmt is large/huge _BitInt SSA_NAME not in m_names it means it will be handled in a loop or straight line code at the location of its (ultimate) immediate use, so for vop checking purposes check these only at the ultimate immediate use. */ but the condition was using != BITINT_TYPE rather than == BITINT_TYPE, so e.g. it used bitint_precision_kind on non-BITINT_TYPEs (e.g. on vector types it will crash because TYPE_PRECISION means something different there, or on say INTEGER_TYPEs the precision will never be large enough to be >= bitint_prec_large). The following patch fixes that, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2024-01-12 Jakub Jelinek PR tree-optimization/113323 * gimple-lower-bitint.cc (bitint_dom_walker::before_dom_children): Fix check for lhs being large/huge _BitInt not in m_names. * gcc.dg/bitint-68.c: New test. Jakub --- gcc/gimple-lower-bitint.cc.jj 2024-01-11 13:52:46.000000000 +0100 +++ gcc/gimple-lower-bitint.cc 2024-01-11 14:27:26.011875196 +0100 @@ -5513,7 +5513,7 @@ bitint_dom_walker::before_dom_children ( tree lhs = gimple_get_lhs (stmt); if (lhs && TREE_CODE (lhs) == SSA_NAME - && TREE_CODE (TREE_TYPE (lhs)) != BITINT_TYPE + && TREE_CODE (TREE_TYPE (lhs)) == BITINT_TYPE && bitint_precision_kind (TREE_TYPE (lhs)) >= bitint_prec_large && !bitmap_bit_p (m_names, SSA_NAME_VERSION (lhs))) /* If lhs of stmt is large/huge _BitInt SSA_NAME not in m_names, --- gcc/testsuite/gcc.dg/bitint-68.c.jj 2024-01-11 14:41:21.237183889 +0100 +++ gcc/testsuite/gcc.dg/bitint-68.c 2024-01-11 14:40:35.977814727 +0100 @@ -0,0 +1,14 @@ +/* PR tree-optimization/113323 */ +/* { dg-do compile { target bitint575 } } */ +/* { dg-options "-std=c23 -O2" } */ + +typedef long __attribute__((__vector_size__ (16))) V; +V u, v; +_BitInt(535) i; + +void +foo (void) +{ + while (i) + u = v; +}