From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Andrea Corallo Newsgroups: gmane.emacs.bugs Subject: bug#41615: [feature/native-comp] Dump prettier C code. Date: Mon, 01 Jun 2020 07:19:34 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="83926"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Cc: 41615@debbugs.gnu.org To: Nicolas =?UTF-8?Q?B=C3=A9rtolo?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jun 01 09:20:11 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1jfejz-000Lhr-DB for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 01 Jun 2020 09:20:11 +0200 Original-Received: from localhost ([::1]:40820 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jfejx-0007oW-G7 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 01 Jun 2020 03:20:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46266) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jfejq-0007oK-J1 for bug-gnu-emacs@gnu.org; Mon, 01 Jun 2020 03:20:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51068) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jfejq-0004Jq-9C for bug-gnu-emacs@gnu.org; Mon, 01 Jun 2020 03:20:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jfejq-0005ww-5D for bug-gnu-emacs@gnu.org; Mon, 01 Jun 2020 03:20:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andrea Corallo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 01 Jun 2020 07:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41615 X-GNU-PR-Package: emacs Original-Received: via spool by 41615-submit@debbugs.gnu.org id=B41615.159099597822834 (code B ref 41615); Mon, 01 Jun 2020 07:20:02 +0000 Original-Received: (at 41615) by debbugs.gnu.org; 1 Jun 2020 07:19:38 +0000 Original-Received: from localhost ([127.0.0.1]:34381 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jfejS-0005wE-Kw for submit@debbugs.gnu.org; Mon, 01 Jun 2020 03:19:38 -0400 Original-Received: from mx.sdf.org ([205.166.94.20]:49174) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jfejR-0005w5-6T for 41615@debbugs.gnu.org; Mon, 01 Jun 2020 03:19:37 -0400 Original-Received: from sdf.org (ma.sdf.org [205.166.94.33]) by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 0517JYrJ026493 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO); Mon, 1 Jun 2020 07:19:35 GMT Original-Received: (from akrl@localhost) by sdf.org (8.15.2/8.12.8/Submit) id 0517JYvg010777; Mon, 1 Jun 2020 07:19:34 GMT In-Reply-To: ("Nicolas =?UTF-8?Q?B=C3=A9rtolo?="'s message of "Sun, 31 May 2020 16:38:15 -0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:181327 Archived-At: Nicolas B=C3=A9rtolo writes: >> The whole compilation is something like 5x faster here. > Amazing.I took a closer look at the code that uses casts to bools and > I think I found a > bug. > > Casting to bool using an enum is equivalent to taking the lowest byte usi= ng > a byte mask. This wrongly casts to "false" integers whose lowest byte is = nil. > > bool cast_from_unsigned_long_long_to_bool (unsigned long long x) > { > return (x & 0xFF); > } > > The correct way to cast to bool is to mimic C semantics: > > bool cast_from_unsigned_long_long_to_bool (unsigned long long x) > { > if (x !=3D 0) > return true; > else > return false; > } > > Am I right? > > Nico. Okay, now I recall better the whole story. I believe is okay that emit_coerce can truncate numbers (as regular cast can do). Where we have to be careful is into coercing before calling 'emit_cond_jump', again the same attention we use in C when casting values. BTW IIRC I've experienced libgccjit crashed on brances with non boolean tests. At the time I cured that directly in 'emit_cond_jump' performing a negation on the number to extract the boolean to be used as a test, this works well. Andrea --=20 akrl@sdf.org