From patchwork Fri Jan 19 08:55:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 189445 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp878129dyb; Fri, 19 Jan 2024 00:57:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IHs5IuGnWYO4cZXOOriS1KLcXNyiSqYLYx6mPX8qopa17MQu5T4Tc11Tj3wx4WYtwdU04tV X-Received: by 2002:a0c:9789:0:b0:681:b43c:ac6f with SMTP id l9-20020a0c9789000000b00681b43cac6fmr974157qvd.27.1705654633609; Fri, 19 Jan 2024 00:57:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705654633; cv=pass; d=google.com; s=arc-20160816; b=LA1ml/I6HJHDtqYKYddiOG/ZaoS7OWMObAqQppcz4sasRnv+zuHVGWt4HwUfFHx6HD Aanxb+Uqk7fo7PoE6qq8L4SHGbVSPRIiPBG7D/ZJ4UAEyBZ2AkRcG8wX0SbL9noETrBr 5ZJ8+ZkGePrkE+j3iChwt+HurbjdtJuSbsgiwn4D2aeaqqkKmoXfDC4znLuVzw21p1s1 EYKXHpapREOlZHectd+JSGEGsSjGq5SVlg/keEOHeIzdo2H/pSNQXZCYlrZ5eB5pWceu uYZZXfsLpN5KkbjyXDpq2L/eWOTedpPShWFRW9hGnWl9I+A0FNIli9J76+wpYP2nX/cs G/xQ== 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=ZYHcXksYVNJyqupw9aWZA8CNmuj3nrcXLTEwgwzpUKw=; fh=FCjeRajqaQYHMkQtfIia8KT5yBac53mYOLLyJhYG/AY=; b=YnIQp/oFY5g8sOyfQf/y3O+a+BqUOmSUBdv5pL0wlm7cBfUQIq8Eg/wU/WaQpIVjHe Emm3z7R13Ftk7b1Y/O/m5NJcCVDMjtYe3zipbKvyRy3hsKeBOi1yJcBSbVGPY+efBghG Qn5AiA/GzaYWAwltQno2IbhWhk4bR8UJ5KdBx5ej5VtE6v4Mo8nRcseV9Ta0T7pXt7be IRyEsVwEZgoW3pJ7etENdRwN2IZZZIWLQ7PIDY5IcoeItzPb4DtaVX2G4DvTcglUZrcF lEiTyhj0/YHWRmt7JI8MAPL5d/zV7hATZ0TrLL51wmb+zOsj49KG5JvVza5Egc3rEEAE Gd6Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IKxZX08W; 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 (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id u17-20020a0cdd11000000b0068177d8f440si6189855qvk.229.2024.01.19.00.57.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 00:57:13 -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=IKxZX08W; 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 555D2385841C for ; Fri, 19 Jan 2024 08:57:13 +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 52EEF3858C42 for ; Fri, 19 Jan 2024 08:55:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 52EEF3858C42 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 52EEF3858C42 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=1705654556; cv=none; b=UGVxKabPQVJJ1uMISn+W04QCIU9+s20A3IWCZrq+kSvpoziNJD9FBsUZLbPq1v8wb8pVHTlG/JXQqm5XcmGjriZeezuqN0zjzC5MGOrwR5oyYX/OxOb6Kepmxjb872YwsPXS+JkSbkuCKbnC95FgzQAiPZ9hTrnioz1qo1y68Jc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705654556; c=relaxed/simple; bh=VSEnJYs8HEpNQdGhS1oHP5xWeN+tD/iNSmXhKCKK+eg=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=r8Af0siWOpX+oVX09SlDT7sthi/VNi4xtwLK5nUT22dhGd79bzWKVaS1OTlqawksAYaX61yAdclqs/T6owRF96HCG4H7xAOQGFA6PxlA+ySUpgd+9/KF/nB8yKXP5A0s2akwNOpiLPCTrrJxqTtlJjS5jReXzU4pega3NpDxpE4= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705654555; 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=ZYHcXksYVNJyqupw9aWZA8CNmuj3nrcXLTEwgwzpUKw=; b=IKxZX08WQBZJhj/M4AbuoN47rOuNjdddELmVOSc1dyK1J9kQ0DKIBS8uM0/vQZtnGjHGM4 M9DyrAYItaGKQTFbTbICc2nm//ae7wREQb1qk75ERdumak1XlF8B9CiI3aEZ9cVKncj5it Mo80EBEQzf9JCi1HBbj9tG1KhTX9bt0= 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-68-CwNftnk6PbKWnjg2sgwuyQ-1; Fri, 19 Jan 2024 03:55:53 -0500 X-MC-Unique: CwNftnk6PbKWnjg2sgwuyQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (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 1553A8489AA; Fri, 19 Jan 2024 08:55:53 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CCFF3112131D; Fri, 19 Jan 2024 08:55:52 +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 40J8tocJ1212737 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 19 Jan 2024 09:55:50 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 40J8tnc81212736; Fri, 19 Jan 2024 09:55:49 +0100 Date: Fri, 19 Jan 2024 09:55:49 +0100 From: Jakub Jelinek To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] lower-bitint: Don't use m_loads for loads used in GIMPLE_ASM [PR113464] Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-4.7 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: 1788508513064201880 X-GMAIL-MSGID: 1788508513064201880 Hi! Like for GIMPLE_PHIs or calls, even for GIMPLE_ASMs we want a corresponding VAR_DECL assigned for lhs SSA_NAMEs of loads from memory, as even GIMPLE_ASM relies on those VAR_DECLs to exist. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2024-01-19 Jakub Jelinek PR tree-optimization/113464 * gimple-lower-bitint.cc (gimple_lower_bitint): Don't try to optimize loads into GIMPLE_ASM stmts. * gcc.dg/bitint-75.c: New test. Jakub --- gcc/gimple-lower-bitint.cc.jj 2024-01-18 08:44:08.337270271 +0100 +++ gcc/gimple-lower-bitint.cc 2024-01-18 19:57:11.791976322 +0100 @@ -6249,7 +6249,8 @@ gimple_lower_bitint (void) if (is_gimple_debug (use_stmt)) continue; if (gimple_code (use_stmt) == GIMPLE_PHI - || is_gimple_call (use_stmt)) + || is_gimple_call (use_stmt) + || gimple_code (use_stmt) == GIMPLE_ASM) { optimizable_load = false; break; --- gcc/testsuite/gcc.dg/bitint-75.c.jj 2024-01-18 20:08:21.710557536 +0100 +++ gcc/testsuite/gcc.dg/bitint-75.c 2024-01-18 20:07:18.017447734 +0100 @@ -0,0 +1,11 @@ +/* PR tree-optimization/113464 */ +/* { dg-do compile { target bitint65535 } } */ +/* { dg-options "-O2 -w -std=gnu23" } */ + +_BitInt(65532) i; + +void +foo (void) +{ + __asm__ ("" : "+r" (i)); /* { dg-error "impossible constraint" } */ +}