Re: [PATCH] m68k: merge mmu and non-mmu bitops.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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





--
To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Video for Linux]     [Yosemite News]     [Linux S/390]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux