From owner-svn-src-projects@freebsd.org Mon Aug 3 17:19:41 2020 Return-Path: Delivered-To: svn-src-projects@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 901153A20AE for ; Mon, 3 Aug 2020 17:19:41 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BL4Pn3KmTz47Tc; Mon, 3 Aug 2020 17:19:41 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:470:7a58:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "Let's Encrypt Authority X3" (verified OK)) (Authenticated sender: dim) by smtp.freebsd.org (Postfix) with ESMTPSA id 3D80D2B3D4; Mon, 3 Aug 2020 17:19:41 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:470:7a58::704a:83ae:3b05:45f6] (unknown [IPv6:2001:470:7a58:0:704a:83ae:3b05:45f6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id C382E2326; Mon, 3 Aug 2020 19:19:39 +0200 (CEST) From: Dimitry Andric Message-Id: <227068EE-C71E-4CD1-8DE0-A1CF9363D2B2@FreeBSD.org> Content-Type: multipart/signed; boundary="Apple-Mail=_5769641E-6573-4294-A0B0-FA5E655EA6B5"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.15\)) Subject: Re: svn commit: r363773 - projects/clang1100-import/contrib/llvm-project/compiler-rt/lib/builtins Date: Mon, 3 Aug 2020 19:19:29 +0200 In-Reply-To: Cc: src-committers , svn-src-projects@freebsd.org, Ed Schouten , John Baldwin To: Jessica Clarke References: <202008021807.072I7GM9059504@repo.freebsd.org> <5D6813EB-F270-412D-8C15-8A05CB6353DE@freebsd.org> X-Mailer: Apple Mail (2.3445.104.15) X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Aug 2020 17:19:41 -0000 --Apple-Mail=_5769641E-6573-4294-A0B0-FA5E655EA6B5 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii On 3 Aug 2020, at 19:05, Jessica Clarke wrote: > > On 3 Aug 2020, at 17:50, Dimitry Andric wrote: >> >> On 2 Aug 2020, at 22:50, Jessica Clarke wrote: ... >> There are indeed quite a lot of calls to __builtin_c[lt]z throughout >> compiler-rt, so removing this workaround from the int_lib.h header >> will possibly pessimize all of those. Is that going to work alright for >> all affected architectures, which appear to be mips64, riscv and >> sparc64? > > I don't think it matters much. __clzdi2 is this (the preprocessed > version of which you provided): > > dwords x; > x.all = a; > const si_int f = -(x.s.high == 0); > return __builtin_clz((x.s.high & ~f) | (x.s.low & f)) + > (f & ((si_int)(sizeof(si_int) * CHAR_BIT))); > > The implementation of __clzsi2 does a bunch more work than that (not > crazy, but still several times more), so I don't think you'll notice > all that much. Besides, Clang is our primary compiler and won't suffer > from this workaround, so I personally have no qualms about a small > performance hit when using GCC and what should be a relatively cold[1] > function. I'm of the view we should be as close to upstream as > possible, ideally with zero diffs, so personally wouldn't carry patches > like this unless it had a noticeable affect on system performance, but > even then would encourage others to patch it upstream first and > foremost. Yeah, less patches is always OK, so I'll drop this particular one, then. Thanks for the feedback! -Dimitry --Apple-Mail=_5769641E-6573-4294-A0B0-FA5E655EA6B5 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCXyhHIQAKCRCwXqMKLiCW o7aDAJ4++R0t+c59UHKfqosUN1IaQe1uAACfZHA0jFwXBuRmip0D9RzTcqbTCJc= =e5R1 -----END PGP SIGNATURE----- --Apple-Mail=_5769641E-6573-4294-A0B0-FA5E655EA6B5--