[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdXhSQNwCU627MOONOrXdasQN=VZxSGrCZiDN7iwQSwi7Q@mail.gmail.com>
Date: Thu, 29 Apr 2021 09:23:15 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Josh Juran <jjuran@...il.com>
Cc: Laurent Vivier <laurent@...ier.eu>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-m68k <linux-m68k@...ts.linux-m68k.org>,
linux-rtc@...r.kernel.org, Alessandro Zummo <a.zummo@...ertech.it>,
Alexandre Belloni <alexandre.belloni@...tlin.com>
Subject: Re: [PATCH 2/2] m68k: introduce a virtual m68k machine
Hi Josh,
On Thu, Apr 29, 2021 at 1:06 AM Josh Juran <jjuran@...il.com> wrote:
> On Apr 28, 2021, at 8:04 AM, Geert Uytterhoeven <geert@...ux-m68k.org> wrote:
> > This can be simplified by shifting irq_pending instead of irq_bit:
> >
> > do {
> > if (irq_pending & 1)
> > generic_handle_irq(irq_num);
> >
> > ++irq_num;
> > irq_pending >>= 1;
> > } while (irq_pending);
> >
> > Unfortunately m68k doesn't have a single-instruction __ffs().
>
> The 68000 and 68010 don't, but couldn't the 68020's BFFFO do the job?
I looked at the code generated by gcc for __builtin_ffs(), and while
it did use BFFFO, it needs several other instructions.
The same can be seen in arch/m68k/include/asm/bitops.h:
static inline int ffs(int x)
{
int cnt;
__asm__ ("bfffo %1{#0:#0},%0"
: "=d" (cnt)
: "dm" (x & -x));
return 32 - cnt;
}
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Powered by blists - more mailing lists