From owner-svn-src-head@freebsd.org Thu Jul 16 20:50:01 2020 Return-Path: Delivered-To: svn-src-head@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 F255136D741; Thu, 16 Jul 2020 20:50:00 +0000 (UTC) (envelope-from mhorne@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 4B75wm67Lrz452N; Thu, 16 Jul 2020 20:50:00 +0000 (UTC) (envelope-from mhorne@freebsd.org) Received: from mail-yb1-f178.google.com (mail-yb1-f178.google.com [209.85.219.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: mhorne) by smtp.freebsd.org (Postfix) with ESMTPSA id ACFDE11938; Thu, 16 Jul 2020 20:50:00 +0000 (UTC) (envelope-from mhorne@freebsd.org) Received: by mail-yb1-f178.google.com with SMTP id a15so3473648ybs.8; Thu, 16 Jul 2020 13:50:00 -0700 (PDT) X-Gm-Message-State: AOAM532D/8SCLrjESdB1DOHE9qbVrm16h+ZBi8a7ODT1EkgonbhDKtcA 80lF8Y09BEyvlCoWxt4G2U/PwDXDcZituaJdq2s= X-Google-Smtp-Source: ABdhPJyqKThAxTFNvf68jjyZwMKGwNGllnwPig273+CYZy5iZVhHW2qpLD/nXTqNpHlD6ZaJ4p9Do6Uy1artqBU8EZY= X-Received: by 2002:a25:5084:: with SMTP id e126mr9492004ybb.212.1594932600102; Thu, 16 Jul 2020 13:50:00 -0700 (PDT) MIME-Version: 1.0 References: <202007161128.06GBSPSB045345@repo.freebsd.org> In-Reply-To: <202007161128.06GBSPSB045345@repo.freebsd.org> From: Mitchell Horne Date: Thu, 16 Jul 2020 17:49:48 -0300 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r363242 - head/sys/amd64/include To: Mateusz Guzik Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jul 2020 20:50:01 -0000 On Thu, Jul 16, 2020 at 8:28 AM Mateusz Guzik 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