Does the ARM GCC support the built-in function for the "REV" command?

It is quite common for compilers to embed built-in functions for processor functions, but it's hard for me to find them. Is there a way to get the REV command (reverse word byte order) in ARM?

Where can I find a list of built-in functions?

0
gcc arm
source share
1 answer

Is there a way to get the REV command (reverse word byte order) in ARM?

There is a more β€œportable” form available for all architectures. This is __builtin_bswap32 . For example, the compiler explorer ,

 unsigned int foo(unsigned int a) { return __builtin_bswap32(a); } 

To give

 foo(unsigned int): rev r0, r0 bx lr 

This is better than __builtin_rev , as it will be available only for specific ARM purposes (and, of course, only for ARM processors). You can use __builtin_bswap32 even on PowerPC, x86, etc.

+5
source share

All Articles