[patch] m68k/m5200
Chris Johns
cjohns at cybertec.com.au
Tue Mar 12 09:26:45 UTC 2002
Ian Caddy wrote:
>
> There is no straight forward way to implement a replacement in one
> instruction, so I have shown a patch, using C source and let the compiler
> choose the best assembler instructions, as to replace an ROR instruction takes
> 9 instructions, including the saving and restoring of a couple of temporary
> registers.
>
What about this untested patch ? Would you be able to test it and
confirm it is ok ?
A simple test I made lowers the number of instructions from the patch
you posted.
--
Chris Johns, cjohns at cybertec.com.au
-------------- next part --------------
*** m68k.h.orig Tue Mar 12 20:17:56 2002
--- m68k.h Tue Mar 12 20:22:50 2002
***************
*** 326,331 ****
--- 326,349 ----
* It must be static because it is referenced indirectly.
*/
+ #if defined(__mcf5200) || defined(__mcf5200__)
+
+ static inline unsigned int m68k_swap_u16(
+ unsigned int value
+ )
+ {
+ return((( value >> 8 ) & 0x00ff ) | (( value << 8 ) & 0xff00 ));
+ }
+
+ static inline unsigned int m68k_swap_u32(
+ unsigned int value
+ )
+ {
+ return( m68k_swap_u16 ( value & 0xffff ) << 16 ) | ( m68k_swap_u16 ( value >> 16 ));
+ }
+
+ #else
+
static inline unsigned int m68k_swap_u32(
unsigned int value
)
***************
*** 349,354 ****
--- 367,374 ----
return( swapped );
}
+
+ #endif
/* XXX this is only valid for some m68k family members and should be fixed */
More information about the users
mailing list