Date: Thu, 16 Jul 2020 22:52:27 +0200 From: Mateusz Guzik <mjguzik@gmail.com> To: Mitchell Horne <mhorne@freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r363242 - head/sys/amd64/include Message-ID: <CAGudoHF3qDXzMYAGNCQjVyYLBkyqJQ9cXjZBzLjA9zBoAPgYMw@mail.gmail.com> In-Reply-To: <CADeAsy1yY_CL5vSvvkgYSutN4gmJi4n1qrc_Duw2M44O%2BH-%2B4w@mail.gmail.com> References: <202007161128.06GBSPSB045345@repo.freebsd.org> <CADeAsy1yY_CL5vSvvkgYSutN4gmJi4n1qrc_Duw2M44O%2BH-%2B4w@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Sounds good, albeit true to my commit message, I'm strongly recommending you run both at the same time. I had ORIG_ and NEW_, with ffs calling both and comparing the result. But perhaps more importantly this may be a good time to create a MI-header for this stuff and do a pass with other archs. We are long past a point where hand-rolled primitives make sense in the common case. On 7/16/20, Mitchell Horne <mhorne@freebsd.org> wrote: > On Thu, Jul 16, 2020 at 8:28 AM Mateusz Guzik <mjg@freebsd.org> wrote: >> >> Author: mjg >> Date: Thu Jul 16 11:28:24 2020 >> New Revision: 363242 >> URL: https://svnweb.freebsd.org/changeset/base/363242 >> >> Log: >> amd64: patch ffsl to use the compiler builtin >> >> This shortens fdalloc by over 60 bytes. Correctness verified by running >> both >> variants at the same time and comparing the result of each call. >> >> Note someone(tm) should make a pass at converting everything else >> feasible. >> > > I have a local version of such a change. I'll see about getting it up > for review in the next little while. > > Mitchell > >> Modified: >> head/sys/amd64/include/cpufunc.h >> >> Modified: head/sys/amd64/include/cpufunc.h >> ============================================================================== >> --- head/sys/amd64/include/cpufunc.h Thu Jul 16 10:20:35 2020 >> (r363241) >> +++ head/sys/amd64/include/cpufunc.h Thu Jul 16 11:28:24 2020 >> (r363242) >> @@ -167,7 +167,8 @@ enable_intr(void) >> static __inline __pure2 int >> ffsl(long mask) >> { >> - return (mask == 0 ? mask : (int)bsfq((u_long)mask) + 1); >> + >> + return (__builtin_ffsl(mask)); >> } >> >> #define HAVE_INLINE_FFSLL > -- Mateusz Guzik <mjguzik gmail.com>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGudoHF3qDXzMYAGNCQjVyYLBkyqJQ9cXjZBzLjA9zBoAPgYMw>