Reputation: 41747
It's pretty common for compilers to have builtin intrinsic functions for processor features, but I'm having trouble finding them. Is there one to get at the 'REV' (reverse byte order of a word) instruction in ARM?
Where can I find the list of builtin functions?
Upvotes: 3
Views: 5309
Reputation: 22420
Is there one to get at the 'REV' (reverse byte order of a word) instruction in ARM?
There is a more 'portable' form that is available on all architectures. It is __builtin_bswap32
. For example the compiler explorer has,
unsigned int foo(unsigned int a)
{
return __builtin_bswap32(a);
}
Giving,
foo(unsigned int):
rev r0, r0
bx lr
This is better than __builtin_rev
would be as it will only be available on certain ARM targets (and certainly only ARM CPUs). You can use __builtin_bswap32
even on PowerPC, x86, etc.
Upvotes: 10