gpt4 book ai didi

gcc - 如何在 ARMv8-a 上启用 Aarch32 指令集?

转载 作者:行者123 更新时间:2023-12-05 03:10:49 28 4
gpt4 key购买 nike

Raspberry Pi 3 uses a Broadcom SoC with and ARMv8 A53 core .它还使用基于 Debian Jessie 的 32 位操作系统。根据 ARM 的 ARM NEON programming quick reference , 第 3.2 节,指令集:

The ARMv8-A AArch32 instruction set consists of A32 (ARM instruction set, a 32-bit fixed length instruction set) and T32 (Thumb instruction set, a 16-bit fixed length instruction set; Thumb2 instruction set, 16 or 32-bit length instruction set). It is a superset of the ARMv7-A instruction set, so that it retains the backwards compatibility necessary to run existing software. There are some additions to A32 and T32 to maintain alignment with the A64 instruction set, including NEON division, and the Cryptographic Extension instructions. NEON double precision floating point (IEEE compliance) is also supported.

不久前我在 GCC 邮件列表上问了一个类似的问题 How to test Aarch32 execution environment on Aarch64?但是我不太明白答案:

Once you're compiling with an arm toolchain the CRC extension can be enabled through -march=armv8-a+crc or selecting an -mcpu option that enables it. To enable the Crypto extension you'll have to specify the right -mfpu option.

我的问题很简单...如何为 Raspberry Pi 3 启用 CRC 和加密扩展?


以下是一些无效的尝试。

尝试 (4) 类似于我们在 Aarch64 下的原生​​操作:gcc -march=armv8-a+crc+crypto -mtune=cortex-a53。尝试 (5) 实际上启用了 CRC,但我似乎无法启用任何其他功能,例如 PMULLPMULL2AESSHA1SHA2

  1. gcc -D__ARM_FEATURE_CRYPTO -D__ARM_FEATURE_CRC -march=armv8-a+crc+crypto -mcpu=cortex-a53 -mfpu=neon test.cc -o test.exe
  2. gcc -D__ARM_FEATURE_CRYPTO -D__ARM_FEATURE_CRC -march=armv8-a+crc -mcpu=cortex-a53 -mfpu=neon test.cc -o test.exe
  3. gcc -D__ARM_FEATURE_CRYPTO -D__ARM_FEATURE_CRC -march=armv8-a -mcpu=cortex-a53 -mfpu=neon test.cc -o test.exe
  4. gcc -march=armv8-a+crc+crypto -mcpu=cortex-a53 -mfpu=neon test.cc -o test.exe
  5. gcc -march=armv8-a+crc -mcpu=cortex-a53 -mfpu=neon test.cc -o test.exe
  6. gcc -march=armv8-a -mcpu=cortex-a53 -mfpu=neon test.cc -o test.exe

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/4.9/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Raspbian 4.9.2-10' --with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.9 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libitm --disable-libquadmath --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-armhf/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-armhf --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-armhf --with-arch-directory=arm --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-sjlj-exceptions --with-arch=armv6 --with-fpu=vfp --with-float=hard --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
Thread model: posix
gcc version 4.9.2 (Raspbian 4.9.2-10)

最佳答案

很简单,“正确的 -mfpu 选项”应该是 -mfpu=crypto-neon-fp-armv8 .

关于gcc - 如何在 ARMv8-a 上启用 Aarch32 指令集?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38631380/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com