ARM GCC 是否具有用于汇编“REV"指令的内置函数? [英] Does ARM GCC have a builtin function for the assembly 'REV' instruction?

查看:39
本文介绍了ARM GCC 是否具有用于汇编“REV"指令的内置函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编译器为处理器特性内置内置函数是很常见的,但我很难找到它们.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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆