diff options
Diffstat (limited to 'newlib/libc/machine/microblaze/mb_endian.h')
-rw-r--r-- | newlib/libc/machine/microblaze/mb_endian.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/newlib/libc/machine/microblaze/mb_endian.h b/newlib/libc/machine/microblaze/mb_endian.h new file mode 100644 index 000000000..fb217ec85 --- /dev/null +++ b/newlib/libc/machine/microblaze/mb_endian.h @@ -0,0 +1,15 @@ +#ifndef _MB_ENDIAN_H +#define _MB_ENDIAN_H + +/* Convenience macros for loading and store 4 bytes in a byte invariant way with + * a singe instruction. Endianess affects this and we rely on MicroBlaze + * load/store reverse instructions to do the trick on little-endian systems. + */ +#ifdef __LITTLE_ENDIAN__ +#define LOAD4BYTES(rD,rA,rB) "\tlwr\t" rD ", " rA ", " rB "\n" +#define STORE4BYTES(rD,rA,rB) "\tswr\t" rD ", " rA ", " rB "\n" +#else +#define LOAD4BYTES(rD,rA,rB) "\tlw\t" rD ", " rA ", " rB "\n" +#define STORE4BYTES(rD,rA,rB) "\tsw\t" rD ", " rA ", " rB "\n" +#endif +#endif |