From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 EA7A438582A4 for ; Mon, 9 Jan 2023 13:25:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EA7A438582A4 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673270739; 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:in-reply-to:in-reply-to: references:references; bh=ptWNDb4wLPFEQBvb/EcdHcizTu8zhLaH/cRJKhy/8xE=; b=FOMS/ubSR5D7DXENBGBtLAE6JLaVuj4nm2nhmK25uXgieUu06+ajIqWs0/jovCmSuP8cdP cO3zSJmEfN8CPOohYeM4O3w2xcicrKcrSECmoxGGae7i/CjD7rSAMNb/J7sFZk0qaw26Xb gjCa+HNC8rY3kimjOO9h0N0EXzsiKdI= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-52-tI2fCCeUNduuH5oWXe8g6Q-1; Mon, 09 Jan 2023 08:25:36 -0500 X-MC-Unique: tI2fCCeUNduuH5oWXe8g6Q-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 104BA1C05EC4; Mon, 9 Jan 2023 13:25:36 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.223]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BE5DF175AD; Mon, 9 Jan 2023 13:25:35 +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 309DPWuN2735804 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 9 Jan 2023 14:25:33 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 309DPV1R2735802; Mon, 9 Jan 2023 14:25:31 +0100 Date: Mon, 9 Jan 2023 14:25:31 +0100 From: Jakub Jelinek To: Richard Biener Cc: "Jose E. Marchesi" , gcc-patches@gcc.gnu.org, david.faust@oracle.com Subject: Re: [PATCH] expr.cc: avoid unexpected side effects in expand_expr_divmod optimization Message-ID: Reply-To: Jakub Jelinek References: <20221208105944.660323-1-jose.marchesi@oracle.com> <87y1rixd3n.fsf@oracle.com> <87cz8ttt88.fsf@oracle.com> <87zgaysmky.fsf@oracle.com> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_STOCKGEN,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Mon, Jan 09, 2023 at 02:04:48PM +0100, Richard Biener via Gcc-patches wrote: > On Mon, Jan 9, 2023 at 10:58 AM Jakub Jelinek wrote: > > > > On Mon, Jan 09, 2023 at 09:05:26AM +0100, Richard Biener wrote: > > > On Wed, Jan 4, 2023 at 9:54 AM Jose E. Marchesi via Gcc-patches > > > wrote: > > > > > > > > > > > > ping. > > > > Would this be a good approach for fixing the issue? > > > > > > adding the is_libcall bit enlarges rtx_def by 8 bytes - there's no room for more > > > bits here. > > > > That is obviously not the way to go, sure. > > > > > I really wonder how other targets avoid the issue you are pointing out? > > > Do their assemblers prune unused (extern) .global? > > > > I think no target solves this, if they see an extern call during expansion > > and emit some directive for those, they emit the global or whatever directive > > which remains there. > > > > If all bits for CALL_INSN are taken, can't we add a flag on the CALL > > rtx inside of the CALL_INSN pattern? Or a flag on the SYMBOL_REF inside of > > it (libcalls are always direct calls, aren't they) or SYMBOL_REF_FLAGS ? > > I suppose the SYMBOL_REF would be what I'd target here. Note we already > have > > /* 1 if RTX is a symbol_ref that has been the library function in > emit_library_call. */ > #define SYMBOL_REF_USED(RTX) \ > (RTL_FLAG_CHECK1 ("SYMBOL_REF_USED", (RTX), SYMBOL_REF)->used) > > so can't we just use that during the final scan for the delayed assembling? No, this one can't, it is used to avoid emitting the external directive multiple times. We need something next to it to identify for which symbols that should be done. Or of course if we are really out of bits that could be used for it, the above could be repurposed for SYMBOL_REF_LIBCALL and the current SYMBOL_REF_USED could be handled with a hash set. Jakub