All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jisheng Zhang <jszhang@kernel.org>
To: Nam Cao <namcao@linutronix.de>
Cc: Paul Walmsley <pjw@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Alexandre Ghiti <alex@ghiti.fr>,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] riscv: word-at-a-time: improve find_zero() for !RISCV_ISA_ZBB
Date: Tue, 1 Sep 2026 12:34:11 +0800	[thread overview]
Message-ID: <apZVwzxBD8Ih493W@xhacker> (raw)
In-Reply-To: <87mruh5h1m.fsf@yellow.woof>

On Thu, Aug 20, 2026 at 10:31:49AM +0200, Nam Cao wrote:
> Jisheng Zhang <jszhang@kernel.org> writes:
> > +#if !(defined(CONFIG_RISCV_ISA_ZBB) && defined(CONFIG_TOOLCHAIN_HAS_ZBB))
> > +#include <asm-generic/word-at-a-time.h>
> > +#else
> 
> Instead of this #if, would it be better to do
> 
> static inline unsigned long find_zero(unsigned long mask)
> {
>         if (IS_ENABLED(CONFIG_RISCV_ISA_ZBB) && IS_ENABLED(CONFIG_TOOLCHAIN_HAS_ZBB) &&
> 	    riscv_has_extension_likely(RISCV_ISA_EXT_ZBB))
> 		return !mask ? 0 : ((__fls(mask) + 1) >> 3);
> 
> 	return count_masked_bytes(mask);
> }
> 
> and let compiler's dead code elimination does its job?

This is impossible because the generic word-at-a-time.h implements
the generic find_zero() itself, so there will be compile error.

Thanks

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2026-09-01  4:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-13 12:24 [PATCH 0/3] riscv: word-at-a-time: improve find_zero() Jisheng Zhang
2026-01-13 12:24 ` Jisheng Zhang
2026-01-13 12:24 ` [PATCH 1/3] riscv: word-at-a-time: improve find_zero() for !RISCV_ISA_ZBB Jisheng Zhang
2026-01-13 12:24   ` Jisheng Zhang
2026-08-20  8:31   ` Nam Cao
2026-08-20  8:31     ` Nam Cao
2026-09-01  4:34     ` Jisheng Zhang [this message]
2026-09-03  9:35       ` Nam Cao
2026-01-13 12:24 ` [PATCH 2/3] riscv: word-at-a-time: improve find_zero() without Zbb Jisheng Zhang
2026-01-13 12:24   ` Jisheng Zhang
2026-01-13 12:24 ` [PATCH 3/3] riscv: word-at-a-time: improve find_zero() for Zbb Jisheng Zhang
2026-01-13 12:24   ` Jisheng Zhang
2026-08-17 15:18 ` [PATCH 0/3] riscv: word-at-a-time: improve find_zero() Jisheng Zhang
2026-08-17 15:18   ` Jisheng Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=apZVwzxBD8Ih493W@xhacker \
    --to=jszhang@kernel.org \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=namcao@linutronix.de \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.