ARM GCC是否对汇编"REV"指令具有内置功能? [英] Does ARM GCC have a builtin function for the assembly 'REV' instruction?
问题描述
对于编译器来说,具有处理器功能的内在函数是很常见的,但是我很难找到它们.在ARM中是否可以使用"REV"(单词的反向字节顺序)指令?
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?
推荐答案
在ARM中是否有一条指令可以实现"REV"(单词的反向字节顺序)指令?
Is there one to get at the 'REV' (reverse byte order of a word) instruction in ARM?
在所有体系结构上都有一种更便携"的形式.它是__builtin_bswap32
.例如,编译器资源管理器具有
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);
}
给予
foo(unsigned int):
rev r0, r0
bx lr
这比__builtin_rev
更好,因为它将仅在某些ARM目标(当然也只有ARM CPU)上可用.您甚至可以在PowerPC,x86等上使用__builtin_bswap32
.
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.
这篇关于ARM GCC是否对汇编"REV"指令具有内置功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!