From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.devel Subject: Re: master b0ba0d42b0f: * src/lisp.h (EQ): Improve generated code. Date: Thu, 28 Nov 2024 14:46:55 -0800 Message-ID: References: <173279015204.1017853.4020802222494409378@vcs3.savannah.gnu.org> <20241128103552.86CC34F4FDB@vcs3.savannah.gnu.org> <8BCABD6D-6605-438C-A62D-B7DA42D07AD4@gmail.com> <867c8ncdx4.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27374"; mail-complaints-to="usenet@ciao.gmane.io" Cc: pipcet@protonmail.com, acorallo@gnu.org, emacs-devel@gnu.org To: Eli Zaretskii , =?UTF-8?Q?Mattias_Engdeg=C3=A5rd?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Nov 28 23:47:48 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tGnIa-0006wx-KZ for ged-emacs-devel@m.gmane-mx.org; Thu, 28 Nov 2024 23:47:48 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tGnHq-0006zB-Ke; Thu, 28 Nov 2024 17:47:02 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tGnHo-0006yl-Ry for emacs-devel@gnu.org; Thu, 28 Nov 2024 17:47:01 -0500 Original-Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tGnHn-0001eq-D9; Thu, 28 Nov 2024 17:47:00 -0500 Original-Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-5ceb03aadb1so1510596a12.0; Thu, 28 Nov 2024 14:46:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732834016; x=1733438816; darn=gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:from:to:cc:subject:date :message-id:reply-to; bh=5IK6cwsp+f0fKaKziDWq+o5WOdYP0gWsj+g7LVwKQqI=; b=DEejwZ9T5lFX1UhfVdPH3pofeebrozocygGx8MHVTfWSwgWlvAib1snrbu+0eydPLW xag3tZVlk0q//uAApwGZcMQ8Zu3LXa+STZVVnfJKZvrnU9BMCzKq1JWewisOFNTbtL7y CFf2EJAXNx55kM3XvkzlwwY7uqFESWTSGNgndxum5nC8WsTBraQrKypfydmpDwGnOnOT eOdqpylMWp3nZPyPZCwDHMXoquPlHsPSP/KTf37Cs//T6uTwMFOk5W5HNsKk8cVODLyt 8hnmo3fOF8FOD5XMi+6GSVfDqEDz9sNhbbdFWOGpWlwis4w3MOgX3GTJ7N6eN3ra3JTV lcXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732834016; x=1733438816; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=5IK6cwsp+f0fKaKziDWq+o5WOdYP0gWsj+g7LVwKQqI=; b=kpS+3SuPJa47dsb6P2uNzZrYMHe3z6qpylXLM+eFPCICKES+vR8ZBXcWKKhgx+O+5s ivCCGmjLYePb9p6WhI3btMJTvWmZ+OD5EAkLS5iEhIJxPVdUQkPQOOUNiFJqiG2660++ ump73h/z+M4vc53/YmfALzuXzKSPHDZ12UHhsz6HAncF2J1uC01sf3feOOVVOzo99+4X RfJyL8hfWLuy0pDRypfgnKZL2tv626JTMmQdAA8ZfBEIIOoOkrB4hlmf0GuwbQPVkKdT gl/RwZ2I7GV4UPgew81K7wmVYGspfFoAGQeUXiGjNuB6nRmCfuiB8U4WAvaPjtOyhsz/ YmXA== X-Forwarded-Encrypted: i=1; AJvYcCVKjsyHd1dlEeJENahPMyIwf6MEMSuOJYEShoJaTyHv3koo35jAIDmWvCzHnUX3dClVxsqS60AUZg==@gnu.org, AJvYcCX5oUml/fVxeBChM/WlvSMDtIMga2Fu+WUoOMhKiYrHHKDExjkveAmOEjOb/F+/JYe4ao8uDT6i9c8ZkQE=@gnu.org X-Gm-Message-State: AOJu0YyChcvNmMmXNx8cma5qwx9iiqYIK1TG9je4SJDwImlnIqZs7R/T Yt4FapC2GtGsODeQNDdRi96T6JCdHU4Su4c0UYP4bZe+6gRP0v9KN05l1OTz8DyDP4PdF4fSk8k VaYV0NHO+Z+dmXJDZW/ISnJz/7rDLdtLp X-Gm-Gg: ASbGncuBL7ldaw6fcxeKrTWcgFdmUNktiXGqJdX5lDukrma2ubvR9Ki30OHPecqixPw mKHLwvskDywMqL30s7J3LZPvLXGYUCDsa X-Google-Smtp-Source: AGHT+IFIYNUNCrq6xClAOAaHdxZJBTgsqo3SjtsBU+oFR+XJRF0V4hQFjGaV9WYKyOEaJB+mtMO7ECrRclyy3qkETa0= X-Received: by 2002:a05:6402:3506:b0:5d0:a8ee:4781 with SMTP id 4fb4d7f45d1cf-5d0a8ee4a0dmr1194398a12.4.1732834015918; Thu, 28 Nov 2024 14:46:55 -0800 (PST) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Thu, 28 Nov 2024 14:46:55 -0800 In-Reply-To: <867c8ncdx4.fsf@gnu.org> Received-SPF: pass client-ip=2a00:1450:4864:20::52f; envelope-from=stefankangas@gmail.com; helo=mail-ed1-x52f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:325836 Archived-At: Eli Zaretskii writes: >> From: Mattias Engdeg=C3=A5rd >> Date: Thu, 28 Nov 2024 18:53:46 +0100 >> Cc: Andrea Corallo , >> Emacs Devel >> >> We should probably define some variant of likely/unlikely because those = cover most needs of __builtin_expect, rather than using it directly. Then p= ortability wouldn't be a problem. > > Portability is already not a problem, so I see no need for inventing > new macros for this purpose. Right, since this is already done for us by Gnulib. But the other reason to having such macros is readability. To be clear, the proposed macros would look something like this (copied here from the Linux kernel): #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) Andrea's code would then read like so: - return BASE_EQ ((__builtin_expect (symbols_with_pos_enabled, false) + return BASE_EQ ((unlikely (symbols_with_pos_enabled)