All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] Optimize swab operations on mips_r2 cpu
@ 2006-01-25  9:36 Franck
  2006-01-25 12:47 ` Ralf Baechle
  0 siblings, 1 reply; 44+ messages in thread
From: Franck @ 2006-01-25  9:36 UTC (permalink / raw)
  To: linux-mips; +Cc: Ralf Baechle

Here is a little patch to optimize swab operations by using "wsbh"
instruction available on mips revision 2 cpus. I do not know what
condition I should use to compile this only for mips r2 cpu though.

Comments ?

Thanks
--
               Franck

--- linux.git/include/asm-mips/byteorder.h~old	2006-01-25
09:39:33.000000000 +0100
+++ linux.git/include/asm-mips/byteorder.h	2006-01-25 10:30:10.000000000 +0100
@@ -8,15 +8,39 @@
 #ifndef _ASM_BYTEORDER_H
 #define _ASM_BYTEORDER_H

+#include <linux/compiler.h>
 #include <asm/types.h>

 #ifdef __GNUC__

+/* FIXME: MIPS_R2 only */
+static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x)
+{
+	__asm__(
+		"wsbh	%0, %1\n"
+		: "=r" (x)
+		: "r" (x));
+	return x;
+}
+
+static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
+{
+	__asm__(
+		"wsbh	%0, %1\n\t"
+		"rotr	%0, %0, 16\n"
+		: "=r" (x)
+		: "r" (x));
+	return x;
+}
+
 #if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
 #  define __BYTEORDER_HAS_U64__
 #  define __SWAB_64_THRU_32__
 #endif

+#define __arch__swab16(x)	___arch__swab16(x)
+#define __arch__swab32(x)	___arch__swab32(x)
+
 #endif /* __GNUC__ */

 #if defined (__MIPSEB__)

^ permalink raw reply	[flat|nested] 44+ messages in thread

end of thread, other threads:[~2006-01-30 14:26 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-25  9:36 [RFC] Optimize swab operations on mips_r2 cpu Franck
2006-01-25 12:47 ` Ralf Baechle
2006-01-25 13:34   ` Franck
2006-01-25 14:11     ` Kevin D. Kissell
2006-01-25 14:14       ` Ralf Baechle
2006-01-25 14:32         ` Franck
2006-01-25 15:04           ` Ralf Baechle
2006-01-25 18:03             ` Franck
2006-01-25 18:15               ` Kevin D. Kissell
2006-01-26  8:11                 ` Franck
2006-01-26  8:26                   ` Kevin D. Kissell
2006-01-26  8:47                     ` Franck
2006-01-26  9:17                       ` Kevin D. Kissell
2006-01-26  9:17                         ` Kevin D. Kissell
2006-01-26 11:56                         ` Franck
2006-01-26 15:02                 ` Franck
2006-01-26 15:23                   ` Kevin D. Kissell
2006-01-26 15:23                     ` Kevin D. Kissell
2006-01-26 15:29                     ` Franck
2006-01-26 15:51                     ` Nigel Stephens
2006-01-26 16:31                       ` Franck
2006-01-26 16:53                         ` Kevin D. Kissell
2006-01-26 16:53                           ` Kevin D. Kissell
2006-01-26 16:55                         ` Nigel Stephens
2006-01-26 18:02                           ` Franck
2006-01-26 20:25                             ` Nigel Stephens
2006-01-27  9:03                               ` Franck
2006-01-27 10:13                                 ` Kevin D. Kissell
2006-01-27 10:13                                   ` Kevin D. Kissell
2006-01-27 10:45                                   ` Franck
2006-01-27 11:31                                     ` Ralf Baechle
2006-01-27 12:53                                     ` Kevin D. Kissell
2006-01-27 12:53                                       ` Kevin D. Kissell
2006-01-27 14:44                                       ` Franck
2006-01-27 11:30                                   ` Ralf Baechle
2006-01-27 13:45                                 ` Nigel Stephens
2006-01-27 14:54                                   ` Franck
2006-01-27 15:04                                     ` Maciej W. Rozycki
2006-01-27 15:39                                     ` Kevin D. Kissell
2006-01-27 15:39                                       ` Kevin D. Kissell
2006-01-27 17:32                                       ` Franck
2006-01-29 15:07                                         ` Ralf Baechle
2006-01-30 13:08                                           ` Maciej W. Rozycki
2006-01-30 14:31                                           ` Franck

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.