LKML Archive on lore.kernel.org
 help / color / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Josh Juran <jjuran@gmail.com>
Cc: Laurent Vivier <laurent@vivier.eu>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-m68k <linux-m68k@lists.linux-m68k.org>,
	linux-rtc@vger.kernel.org,
	Alessandro Zummo <a.zummo@towertech.it>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>
Subject: Re: [PATCH 2/2] m68k: introduce a virtual m68k machine
Date: Thu, 29 Apr 2021 09:23:15 +0200
Message-ID: <CAMuHMdXhSQNwCU627MOONOrXdasQN=VZxSGrCZiDN7iwQSwi7Q@mail.gmail.com> (raw)
In-Reply-To: <F9FB9B1D-3B31-452D-AD67-D1C57A302B83@gmail.com>

Hi Josh,

On Thu, Apr 29, 2021 at 1:06 AM Josh Juran <jjuran@gmail.com> wrote:
> On Apr 28, 2021, at 8:04 AM, Geert Uytterhoeven <geert@linux-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@linux-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

  reply index

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-23 22:14 [PATCH 0/2] m68k: Add Virtual M68k Machine Laurent Vivier
2021-03-23 22:14 ` [PATCH 1/2] rtc: goldfish: remove dependency to OF Laurent Vivier
2021-03-23 22:14 ` [PATCH 2/2] m68k: introduce a virtual m68k machine Laurent Vivier
2021-04-27 17:20   ` Laurent Vivier
2021-04-28 12:07     ` Geert Uytterhoeven
2021-04-28 12:15       ` Laurent Vivier
2021-04-28 12:04   ` Geert Uytterhoeven
2021-04-28 23:06     ` Josh Juran
2021-04-29  7:23       ` Geert Uytterhoeven [this message]
2021-04-16 20:26 ` [PATCH 0/2] m68k: Add Virtual M68k Machine Alexandre Belloni
2021-04-16 20:34   ` Alexandre Belloni

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='CAMuHMdXhSQNwCU627MOONOrXdasQN=VZxSGrCZiDN7iwQSwi7Q@mail.gmail.com' \
    --to=geert@linux-m68k.org \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@bootlin.com \
    --cc=jjuran@gmail.com \
    --cc=laurent@vivier.eu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    --cc=linux-rtc@vger.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

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git
	git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git
	git clone --mirror https://lore.kernel.org/lkml/9 lkml/git/9.git
	git clone --mirror https://lore.kernel.org/lkml/10 lkml/git/10.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git