From patchwork Fri Feb 2 09:40: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: 195756 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp313505dyc; Fri, 2 Feb 2024 01:41:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IF4ne6MNutr2QKdg378mueTyLZ4UvMTwDaNe3zRbwIuxTCBoI4j6yq+Tq7rv7kCSLVd4lFW X-Received: by 2002:a05:6214:5008:b0:68c:4185:6cf3 with SMTP id jo8-20020a056214500800b0068c41856cf3mr2072990qvb.52.1706866912228; Fri, 02 Feb 2024 01:41:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706866912; cv=pass; d=google.com; s=arc-20160816; b=TvKqCX8lH2MnlwRNHYAifokj9Cwu9p6eJF9YNnV4J5w5zPOl3SDINi/sUOH9qWwSEY 4kA9I6ouoGr2091vGtqPuGtAubIwTARwL06KB0NPG5mk33DmsNkTPe85Mi+4bN/t1MMV WVS/05nXOMKjuT5M0PNvqWGTNCbNKd+8jqupmTn93NKyhdGFsGIhSWf0OMjcO3+BHdjK J4suhjpyEKyqqH6Tm6/DaOn0e8P7H+1vZxY5sRuPZMIUGWV4YQUxSvCga/d9nNYsZ3qy 5bB3Rj30+y5lKYpszRNJLDHl8MkzZiw9SYV5sRL5ArsGrTb37bpvaJmFlqx6Xx0FvNFO SSvw== 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=R8clV2j1UJ5d3m1JMe6ginUwpoZ2EwoEVo30SDFjw/M=; fh=PKciWkR3o73OBrEAgNo2Y4GnVT1gnELR9fu10HXRzPA=; b=Yt6oSwjR1ZTHXkpyVHec6odYDcACaF+6vHX1KGTw0fkLMYLK2dT+c+nrNyjRHSowC8 /2fOGCm/dTi0ZAy5YJi2GOv67UfCSsQik3SyoWMdN2yRuL96bb0suMpaDa7qH8ugBrou LEPtjHDYH/OxafhG1b/mesv0EAAl7Y/GxOP1j9xP1IbxmpzgYyKePmnI7ImVLcIONK02 6LydtmVq+29Jra/YOijmRY3NXMWs8wMwmv7Qryytnf5L3wmpaTxY9Wug1bKcBVYbBvPV ctn3QMIv80c2//u/K7xGVv2ZYlcKRJk5e6M2nCkPe2YNRi+2ENxaXZhgIzbpbi6KSLIB vhdw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=X3sWwthQ; 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; AJvYcCX0HrLn0BnX8TXLAJJe3kHzysrfm34JHB22RdEq2/DWgGUuEkhnLYR7IyDu7mZY3opA+GOkXQyyOCSHS8EdXpVlyMSM6Q== Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id o14-20020a0cfa8e000000b0067f626350a6si1609117qvn.134.2024.02.02.01.41.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 01:41:52 -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=X3sWwthQ; 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 E9B613858414 for ; Fri, 2 Feb 2024 09:41:51 +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 1D7F138582AF for ; Fri, 2 Feb 2024 09:40:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1D7F138582AF 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 1D7F138582AF 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=1706866857; cv=none; b=uVnyakd/Bd+xe84dHYFdDP8lcER55E+GGZgLVFgiAmpdLnzakGLXk6ZrEddTVKge5bmEyXJGkkHpyd1u4dWHHnopR+VUPVFJ5n+6KgzWN+uB8tZnzz2VtxtqLLL5k8lzWXZ51paxJ91IKnra4fRb2PGt9rbh81V5ocvQufx+qcE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706866857; c=relaxed/simple; bh=14UTnw5HdojxQb7i0lHut8wIDFIr+sSrw5/BDvweDBQ=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=vgXgCYTwuk+ecMnE0M7d1Fcsl0wVyL6N2gV0SfzSdYS+Vpee1zWRTvXgqzrObj3Dc86hE4YsR7s6OFvS86Qn3HNekiVhQ/h8izVQC3QkjN9pcll2s3Px27U5svoqJW3PaTy7JYoWqDkwgKzMH+s50OJW4B+XLqX54qCZfNZ5yEU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706866855; 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=R8clV2j1UJ5d3m1JMe6ginUwpoZ2EwoEVo30SDFjw/M=; b=X3sWwthQxytoVJeniv3s7NhFLSKE/RIBrVnmiPcWZh0cDdiTJN8SCTIit/Ag7DDCZjoooc i0PJom8ytFnUR/T9B18p3xjJMU64P77LRmbDkozDizrak2clY1lInf9TK6Lx3Lua4nQfK7 pZC+4tpgKdUFzBrqU9Z9z2+Ir5BxO4c= 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-540-xnTOB4mOP4GbLD0T4JSXLQ-1; Fri, 02 Feb 2024 04:40:54 -0500 X-MC-Unique: xnTOB4mOP4GbLD0T4JSXLQ-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (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 0CB8A863064; Fri, 2 Feb 2024 09:40:54 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C4C7A492BE2; Fri, 2 Feb 2024 09:40:53 +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 4129elL02705530 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 2 Feb 2024 10:40:47 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 4129ekKS2705529; Fri, 2 Feb 2024 10:40:46 +0100 Date: Fri, 2 Feb 2024 10:40:46 +0100 From: Jakub Jelinek To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] lower-bitint: Handle uninitialized large/huge SSA_NAMEs as inline asm inputs [PR113699] Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-4.5 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_H5, 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: 1789779679163048000 X-GMAIL-MSGID: 1789779679163048000 Hi! Similar problem to calls with uninitialized large/huge _BitInt SSA_NAME arguments, var_to_partition will not work for those, but unlike calls where we just create a new uninitialized SSA_NAME here we need to change the inline asm input to be an uninitialized VAR_DECL. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2024-02-02 Jakub Jelinek PR middle-end/113699 * gimple-lower-bitint.cc (bitint_large_huge::lower_asm): Handle uninitialized large/huge _BitInt SSA_NAME inputs. * gcc.dg/bitint-81.c: New test. Jakub --- gcc/gimple-lower-bitint.cc.jj 2024-01-31 10:55:42.677095630 +0100 +++ gcc/gimple-lower-bitint.cc 2024-02-01 10:36:08.408867602 +0100 @@ -5200,9 +5200,18 @@ bitint_large_huge::lower_asm (gimple *st && TREE_CODE (TREE_TYPE (s)) == BITINT_TYPE && bitint_precision_kind (TREE_TYPE (s)) >= bitint_prec_large) { - int part = var_to_partition (m_map, s); - gcc_assert (m_vars[part] != NULL_TREE); - TREE_VALUE (t) = m_vars[part]; + if (SSA_NAME_IS_DEFAULT_DEF (s) + && (!SSA_NAME_VAR (s) || VAR_P (SSA_NAME_VAR (s)))) + { + TREE_VALUE (t) = create_tmp_var (TREE_TYPE (s), "bitint"); + mark_addressable (TREE_VALUE (t)); + } + else + { + int part = var_to_partition (m_map, s); + gcc_assert (m_vars[part] != NULL_TREE); + TREE_VALUE (t) = m_vars[part]; + } } } update_stmt (stmt); --- gcc/testsuite/gcc.dg/bitint-81.c.jj 2024-02-01 10:38:26.132937531 +0100 +++ gcc/testsuite/gcc.dg/bitint-81.c 2024-02-01 10:38:01.628280939 +0100 @@ -0,0 +1,12 @@ +/* PR middle-end/113699 */ +/* { dg-do compile { target bitint } } */ +/* { dg-options "-O2 -std=c23" } */ + +void +foo (void) +{ +#if __BITINT_MAXWIDTH__ >= 129 + _BitInt(129) i; + __asm__ ("" : : "rm" (i)); +#endif +}