From patchwork Wed Jan 31 08:33:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 194578 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1749260dyb; Wed, 31 Jan 2024 00:37:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IH/zcT4RZoyWT2F4KVCOnZZFK7dDAyiao3omgaN7aK3Sz4iffvNvhwwGRtcrtnCYQePLV/H X-Received: by 2002:a05:6122:4b0f:b0:4b7:6c2f:fdb0 with SMTP id fc15-20020a0561224b0f00b004b76c2ffdb0mr828314vkb.0.1706690227935; Wed, 31 Jan 2024 00:37:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706690227; cv=pass; d=google.com; s=arc-20160816; b=gE7O6Ubx+O+MSPO46cwdqEIEHzpBUjC843Dr2fxMDTGGD6FW5xMNjDZBl4m9f7+ZGX ZKGukN3t2irAX1qhWT9wbuvw3BLf7SGWjoJvrch01ZgH9FpbKoW4hbbdoLP9rUnnXml5 VgicIpD/oRLbJeVaJxMTmTDiUO7tEhiBodrzNZ12FH1eT2FdiwVNsY0Kao8LI8l/0SIe ySd8HehUqC/7gIOw6D6+t7HPNT9udLKa4rnTdJAyRT17ElNw8iGWOZqajXtgEObBdl5F V/KYQM2N+vjoGewfyhhUKMn7VqHnYzxJAHsUNkvf/oBeXkA3nYUErLQQnBv2rYVVkxHZ exQw== 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:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=tatkViHshteLtS8s8kifobEQfHixVI932s1X1lk7wxA=; fh=nzQPy5XfRVv3AKuqLvaMHLep6fY19N0Gz+W1OnrQUEI=; b=o1L4ptugKfT9BUclPqznLTMqks9OdiOLVmxLOaaKjEZPV5o84jU1+1pMH767yoONaE EgiKlAlxihanCS1z/+zkzoo9lS05U65SEyzphKJvWFPSZk9KSBMddbyIgU47JddwHrAz 9DKT4U8qqGiuqCB7cU3Z4Xxd8YHWEH++t/4P9Gk1QcA8MMFXVTLZ5+NPO4rSbSrGlK6O RuZJpGjfTGGCAGEuRIjrCAMFeRTaGQEOnH8o6Vguv8f0zMFgcz1eZZzPgv7e28bNM9ww mciCGYrxb4yEmXCHqpSG3cjgbNthXBLYfxQOIsuqf3E20+kSvzSwdJf1464ht5gUFRvZ MUXw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SwsX+d4h; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 X-Forwarded-Encrypted: i=1; AJvYcCX4DnMW4dIlOSyiRiD7M0y/fWieMV61C6BrggCZY8wRj13PGqQvx1+/zXGBPcEwDE9JCH//oOpxbz5wuBhTrThx3JKtaA== Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id gv6-20020a056214262600b0068c53953cdesi5131295qvb.527.2024.01.31.00.37.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 00:37:07 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SwsX+d4h; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 5A8073858401 for ; Wed, 31 Jan 2024 08:37:07 +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.129.124]) by sourceware.org (Postfix) with ESMTPS id 23F573858416 for ; Wed, 31 Jan 2024 08:33:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 23F573858416 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 23F573858416 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706689996; cv=none; b=T2eRn0QIPwmQITP7x/P7o7WK8W+577UakDZr19OGNHeIVHpiCBgboxn8oTlxB/gRyNMOhso9umK9Yiq/ZnoeQyxRVTWRZhLmv5+pVXDilxM16Nf1TEd+bZUWj6miVMzsMeh7FH3NURCVGWE3IVNkjjqSZzYirlOxmRRhH8E2T5o= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706689996; c=relaxed/simple; bh=8U5M0bBYVJKnDkTUiG1cHfsvqV8eaIEiGvMYJknvfug=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=n7LtrH+kDSgDxe4Xssxyeoz9ynRjWXwNqPmT01sh/21JFLnmRC192YhqwIMoUDEovxuynonGWKw8+RuhV2FVYlYunmqQDa/boBozaNV5cgXDX1+s1d7opEAPXXwwnUdb6Q99ZFpVc1kTbRwRAZ7Cs8oM+Wi2f8ULtoUB6VCKOXw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706689990; 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; bh=tatkViHshteLtS8s8kifobEQfHixVI932s1X1lk7wxA=; b=SwsX+d4hX2WSUfJ67sjj7utiOHOdXJJW6LveZ+HdL9jZqETw9XPeVzQycYqVRhCbRS2uti h8NFUwZpyM04OinGiuONgfHnsktpTav/k/f/6X33+VdPCl/j8Txyl125xSi2D7T5q/WbSR Hmou84ThbOUeRaLAIBA9vRbAWKxapk8= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-493-Y9LYfyGPMiKytIZH3t_xxg-1; Wed, 31 Jan 2024 03:33:07 -0500 X-MC-Unique: Y9LYfyGPMiKytIZH3t_xxg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (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 95A223869153; Wed, 31 Jan 2024 08:33:07 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 54F45200B2D7; Wed, 31 Jan 2024 08:33:07 +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 40V8X49F266984 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 31 Jan 2024 09:33:05 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 40V8X4Wt266983; Wed, 31 Jan 2024 09:33:04 +0100 Date: Wed, 31 Jan 2024 09:33:03 +0100 From: Jakub Jelinek To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] lower-bitint: Fix up VIEW_CONVERT_EXPR handling in handle_operand_addr [PR113639] Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-4.3 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_H4, 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: 1789594412593140589 X-GMAIL-MSGID: 1789594412593140589 Hi! Yet another spot where we need to treat VIEW_CONVERT_EXPR differently from NOP_EXPR/CONVERT_EXPR. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2024-01-31 Jakub Jelinek PR tree-optimization/113639 * gimple-lower-bitint.cc (bitint_large_huge::handle_operand_addr): For VIEW_CONVERT_EXPR set rhs1 to its operand. * gcc.dg/bitint-79.c: New test. Jakub --- gcc/gimple-lower-bitint.cc.jj 2024-01-27 13:06:49.183671155 +0100 +++ gcc/gimple-lower-bitint.cc 2024-01-30 17:06:56.829144801 +0100 @@ -2159,6 +2159,8 @@ bitint_large_huge::handle_operand_addr ( gcc_assert (gimple_assign_cast_p (g)); tree rhs1 = gimple_assign_rhs1 (g); bitint_prec_kind kind = bitint_prec_small; + if (TREE_CODE (rhs1) == VIEW_CONVERT_EXPR) + rhs1 = TREE_OPERAND (rhs1, 0); gcc_assert (INTEGRAL_TYPE_P (TREE_TYPE (rhs1))); if (TREE_CODE (TREE_TYPE (rhs1)) == BITINT_TYPE) kind = bitint_precision_kind (TREE_TYPE (rhs1)); --- gcc/testsuite/gcc.dg/bitint-79.c.jj 2024-01-30 17:18:50.711135054 +0100 +++ gcc/testsuite/gcc.dg/bitint-79.c 2024-01-30 17:18:22.986524397 +0100 @@ -0,0 +1,16 @@ +/* PR tree-optimization/113639 */ +/* { dg-do compile { target bitint } } */ +/* { dg-options "-O2 -std=c23" } */ + +int j, k; +#if __BITINT_MAXWIDTH__ >= 162 +struct S { _BitInt(162) n; }; +void bar (_BitInt(162) x); + +void +foo (struct S s) +{ + bar (s.n * j); + (void) (s.n * k); +} +#endif