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: 84408 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 106643858422 for ; Fri, 19 Jan 2024 08:56:46 +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+patchwork=sourceware.org@gcc.gnu.org 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" } */ +}