logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

amiconn: firmware/export system.h,1.33,1.34: msg#00130

Subject: amiconn: firmware/export system.h,1.33,1.34
Update of /cvsroot/rockbox/firmware/export
In directory labb:/tmp/cvs-serv24530/firmware/export

Modified Files:
        system.h 
Log Message:
Coldfire: assembler optimised SWAB32() inline function. Added SWAW32() even if 
it isn't currently used.

Index: system.h
===================================================================
RCS file: /cvsroot/rockbox/firmware/export/system.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- system.h    1 Aug 2005 01:27:10 -0000       1.33
+++ system.h    21 Aug 2005 22:43:00 -0000      1.34
@@ -207,6 +207,16 @@
     return (value >> 8) | (value << 8);
 }
 
+static inline unsigned long SWAW32(unsigned long value)
+  /*
+    result[31..16] = value[15.. 0];
+    result[15.. 0] = value[31..16];
+  */
+{
+    asm ("swap    %%0" : "+r"(value));
+    return value;
+}
+
 static inline unsigned long SWAB32(unsigned long value)
   /*
     result[31..24] = value[ 7.. 0];
@@ -215,9 +225,19 @@
     result[ 7.. 0] = value[31..24];
   */
 {
-    unsigned short hi = SWAB16(value >> 16);
-    unsigned short lo = SWAB16(value & 0xffff);
-    return (lo << 16) | hi;
+    unsigned long mask = 0x00FF00FF;
+    asm (                             /* val  = ABCD */
+        "and.l   %[val],%[mask]  \n"  /* mask = .B.D */
+        "eor.l   %[mask],%[val]  \n"  /* val  = A.C. */
+        "lsl.l   #8,%[mask]      \n"  /* mask = B.D. */
+        "lsr.l   #8,%[val]       \n"  /* val  = .A.C */
+        "or.l    %[mask],%[val]  \n"  /* val  = BADC */
+        "swap    %[val]          \n"  /* val  = DCBA */
+        : /* outputs */
+        [val] "+d"(value),
+        [mask]"+d"(mask)
+    );
+    return value;
 }
 
 static inline void invalidate_icache(void)

_______________________________________________
http://cool.haxx.se/mailman/listinfo/rockbox-cvs



<Prev in Thread] Current Thread [Next in Thread>