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 2593D3858C31 for ; Tue, 21 Nov 2023 08:30:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2593D3858C31 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 2593D3858C31 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=1700555436; cv=none; b=sxz+s+4MU0xfPRnN6RPtYQ1/+9Xm69sEzZvX1971+JnXDiLNKMraZELzGUHH/PYDVRtAiNW5zz3/bcCL/VcnIM/agBeNKbC7YhA54ki8p/TJr2l5QZzdgQqGZ8Ykz9SWQFpwn27lovtFQ1q5+Oge8PXWcKaHjqDLzWVpOTdmph8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700555436; c=relaxed/simple; bh=DdW68oI5pjU9JAS7d0CwnSCGYHDC5ffB8Ch/OaSfTVw=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=hIc1mLGIjfmc/+kLfaGo7y3UUK6f7Ua/q+UjaCIi+kNmK6YoIVtGDXkDoouQo+y2fZYmQFT/jJUyL0dFFIm0QCsTZDXS24eAggyaT7wcFOR1royRedH2orxiYCm/Z/SKzI4zVWnReLEUvzi0GKcPgqYzdXMze625QaF6NEriP0M= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700555434; 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=biAwF5/2xWw3TjBVTKvbAJLLynM1SMLxQTYZVJMmRZY=; b=N6KReUoVQs3laQkyHUQvVMPTjGRqw5TBzFU1tY6fT8YZZknZ/RrRQ0HB5Sn6/B0cJ/3VaA /DTg2cALthqXCy6z7xxUFZo/txY/j0ISrQYjBtQYMM7UwJellmiUQ4Sys8lvWi233NPKLk m6TpMABj0IqooFRX2MLHDXatYknBawM= 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-582-zvfm1qGtOAeQxw9T-U1New-1; Tue, 21 Nov 2023 03:30:33 -0500 X-MC-Unique: zvfm1qGtOAeQxw9T-U1New-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (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 BD02F1C07562; Tue, 21 Nov 2023 08:30:32 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.194.53]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 80B8720268CF; Tue, 21 Nov 2023 08:30:32 +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 3AL8UTgI4109075 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 21 Nov 2023 09:30:29 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 3AL8USS64109074; Tue, 21 Nov 2023 09:30:28 +0100 Date: Tue, 21 Nov 2023 09:30:28 +0100 From: Jakub Jelinek To: Joseph Myers Cc: Richard Biener , gcc-patches@gcc.gnu.org, Florian Weimer Subject: Re: [PATCH] c-family, middle-end: Add __builtin_c[lt]zg (arg, 0ULL) exception Message-ID: Reply-To: Jakub Jelinek References: MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 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_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 List-Id: On Tue, Nov 21, 2023 at 12:12:18AM +0000, Joseph Myers wrote: > On Mon, 20 Nov 2023, Jakub Jelinek wrote: > > > and be done with that. If there is an agreement we should do that > > for all 14 rather than just those 3 + the 2 ugly hacks (__builtin_c{l,t}zg with > > 0ULL second argument and __builtin_bit_complement), I can change the > > I tend to agree with the "ugly hack" description of the 0ULL second > argument special case. It could be done differently, e.g. by adding optional third argument with the meaning that if that third argument is present and constant non-zero, the return value on 0 first argument would be second argument + bitsize of the first argument, while if the third argument is not present or constant zero, it is the current behavior of second argument on constant zero. Given that I've already posted all 14 __builtin_stdc_*, that isn't strictly needed for stdbit.h, the only question is if it would be useful for users in other cases. If there is the _Generic extension or say even just a new builtin like __builtin_save_expr (x, y) which would introduce some special fixed identifier when evaluating y for the value (but not side-effects) of x, that wouldn't be needed and I agree going for something like that would be cleaner. Jakub