public inbox for linux-m68k@lists.linux-m68k.org
 help / color / mirror / Atom feed
From: Greg Ungerer <gerg@snapgear.com>
To: Finn Thain <fthain@telegraphics.com.au>
Cc: linux-m68k@vger.kernel.org, uclinux-dev@uclinux.org,
	Greg Ungerer <gerg@uclinux.org>
Subject: Re: [PATCH] m68k: merge mmu and non-mmu bitops.h
Date: Fri, 3 Jun 2011 21:10:56 +1000	[thread overview]
Message-ID: <4DE8C140.4010007@snapgear.com> (raw)
In-Reply-To: <alpine.OSX.2.00.1106032050380.193@ibook.intranet>


Hi Finn,

On 03/06/11 21:02, Finn Thain wrote:
>> +#if defined(CONFIG_M68000) || defined(CONFIG_MCPU32) || defined(CONFIG_COLDFIRE)
>> +
>> +/*
>> + *     The newer ColdFire family members support a "bitrev" instruction
>> + *     and we can use that to implement a fast ffs. Older Coldfire parts,
>> + *     and normal 68000 parts don't have anything special, so we use the
>> + *     generic functions for those.
>> + */
>> +#if (defined(__mcfisaaplus__) || defined(__mcfisac__))&&  \
>> +    !defined(CONFIG_M68000)&&  !defined(CONFIG_MCPU32)
>
> Aren't the !defined(CONFIG_M68000)&&  !defined(CONFIG_MCPU32) terms
> redundant?

No, not in this case.

If we were compiling an image that could be run on any of ColdFire
or 68000 or CPU32 then we cannot compile in these specific ColdFire
optimized ffs and __ffs. The bitrev instruction only exists on ColdFire
and those that implement the ISA A+ and above instruction sets.
So to use them we must be only compiling for CONFIG_COLDFIRE.

Regards
Greg


> Finn
>
>> +static inline int __ffs(int x)
>> +{
>> +        __asm__ __volatile__ ("bitrev %0; ff1 %0"
>> +               : "=d" (x)
>> +               : "0" (x));
>> +        return x;
>> +}
>> +
>> +static inline int ffs(int x)
>> +{
>> +        if (!x)
>> +                return 0;
>> +       return __ffs(x) + 1;
>> +}
>> +
>> +#else
>> +#include<asm-generic/bitops/ffs.h>
>> +#include<asm-generic/bitops/__ffs.h>
>> +#endif
>> +
>> +#include<asm-generic/bitops/fls.h>
>> +#include<asm-generic/bitops/__fls.h>
>> +
>>   #else
>>
>
>
>

  reply	other threads:[~2011-06-03 11:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-03  6:51 [PATCH] m68k: merge mmu and non-mmu bitops.h gerg
2011-06-03 11:02 ` Finn Thain
2011-06-03 11:10   ` Greg Ungerer [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-06-24  5:45 gerg
2011-06-26 12:21 ` Geert Uytterhoeven
2011-06-27  2:10   ` Greg Ungerer
2011-06-23  1:28 gerg
2011-06-23 17:30 ` Geert Uytterhoeven
2011-06-24  5:12   ` Greg Ungerer
2011-05-18  5:32 gerg

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=4DE8C140.4010007@snapgear.com \
    --to=gerg@snapgear.com \
    --cc=fthain@telegraphics.com.au \
    --cc=gerg@uclinux.org \
    --cc=linux-m68k@vger.kernel.org \
    --cc=uclinux-dev@uclinux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox