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.129.124]) by sourceware.org (Postfix) with ESMTPS id 34E1D3858D3C for ; Fri, 24 Nov 2023 10:02:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 34E1D3858D3C 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 34E1D3858D3C 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=1700820130; cv=none; b=uIz8PQgBR8WrAfeetdiI8A67JlsEb+cMkplSlXaIIJbEyOUKm0C4gtGw+nN2hwWHmvKJMxALjqnOAz3T20Yd3WsOdgmT54JsTX2QcBri5mJ+vJCgNMxMiqnBvWuXlmr+72zFx+vqTjMvhA6JOHlv27LTm7twMpdKEKF1QcnxahM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700820130; c=relaxed/simple; bh=Lc8aW8estA8w4b7udcsgb7ycwp/i2wGyAgi+fmYGQDg=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=HPhEYZjt1a84XXENht5mt83Jy3ntZfUkmJ+eZ/Gz52XM3H/9Re1i+7J2jG1W0Vjuoz1oDylnH8edDOuTlJJmHClAxIRZjuSHblBnThw2UAKTAcnYLCBLCow/H0bLdwy0TqnDGp1pWXblmR7Gu3mUQd6GaY4VMyuyPazlhQiCSk0= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700820128; 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=oBKwsYOSA/WT3f5xW+31kCTGYTcGy9tKvs8r8LRj5es=; b=aEl9oJgL6i3haFiL/j2LvUTn777tmtMR+i5LsauPW9R937v6jlX/XU/CVY5NS9RfyamWnV yddUwNVpQuldjm8nzVx5+RjBfzghpCU/5rbij7no5FrQUVRqqg1vaOYKZjrEisq6zGWBZ5 Akzwfgjq5dWSTmitgJGjKpTzHsO8XPM= 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-615-C3ENENEhOvi3_7YuRYtlCQ-1; Fri, 24 Nov 2023 05:02:05 -0500 X-MC-Unique: C3ENENEhOvi3_7YuRYtlCQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (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 125873C0C485; Fri, 24 Nov 2023 10:02:05 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.194.53]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CA9391C060B5; Fri, 24 Nov 2023 10:02:04 +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 3AOA22Js3449576 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 24 Nov 2023 11:02:02 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 3AOA21Jt3449575; Fri, 24 Nov 2023 11:02:01 +0100 Date: Fri, 24 Nov 2023 11:02:01 +0100 From: Jakub Jelinek To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] lower-bitint: Lower FLOAT_EXPR from BITINT_TYPE INTEGER_CST [PR112679] Message-ID: Reply-To: Jakub Jelinek References: <0773955o-4086-35o9-o657-072349688qsp@fhfr.qr> MIME-Version: 1.0 In-Reply-To: <0773955o-4086-35o9-o657-072349688qsp@fhfr.qr> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 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.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_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 List-Id: On Fri, Nov 24, 2023 at 10:20:01AM +0100, Richard Biener wrote: > > + /* Similarly, e.g. with -frounding-math casts from _BitInt INTEGER_CSTs > > + to floating point types need to be rewritten. */ > > + else if (SCALAR_FLOAT_TYPE_P (type)) > > + { > > + gimple *g = SSA_NAME_DEF_STMT (s); > > + if (is_gimple_assign (g) && gimple_assign_rhs_code (g) == FLOAT_EXPR) > > + { > > I think this would combine with the virtual operand code up to the > is_gimle_assign () check. Only the gimple *g = SSA_NAME_DEF_STMT (s); if (is_gimple_assign (g) && part is the same between the two, but virtual operands will not be seen on FLOAT_EXPRs and stores won't be seen for the others, so I think it is cheaper to handle them separately. > But I also wonder if when you disable enough passes you could > for example see switch (bit-int-cst) or if (bit-int-cst ...) > as well? Given we have PROP_gimple_lbitint couldn't we set that > optimistically say during gimplification when we didn't see any > bit-int, making sure to clear the property during inlining when > the inlined function doesn't have it set? Or maybe require > frontends to opt-in into features that require additional > processing, indicating that with a bit in struct function > (or a flag on the decl or via a langhook)? There's other > passes that we could gate (coroutine stuff, omp stuff?) I've initially wanted to set a per-function flag somewhere, either in the FEs or during gimplification, but it turned out that ensuring the flag is set means I'd need to test it in a lot of places and slow down processing of everything in there for the checks if any operand is BITINT_TYPE. Then I came up with the idea I can just check if any SSA_NAME has non-small BITINT_TYPE; but of course the INTEGER_CST stores and now the FLOAT_EXPRs with those ruin that a little bit. What we could do perhaps cheaply at least for now is set some flag in build_bitint_type (after all, we have one only, bitint_type_cache != NULL, except it is static; just probably LTO streaming in bypasses that), so perhaps we could return early or even gate the pass on no BITINT_TYPEs created in the IL. That would help non-LTO with all non-C languages including C++. And for C could be also effective, as long as system headers don't start adding _BitInt types in there... E.g. there was a risk in one of my attempts that stdbit.h would have one, but in the end it won't. Jakub