Raspberry Pi 3 uses a Broadcom SoC with and ARMv8 A53 core. It also uses a 32-bit OS based on Debian Jessie. According to ARM's ARM NEON programming quick reference, Section 3.2, Instruction set:
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.
I kind of asked a similar question a while back on the GCC mailing list at How to test Aarch32 execution environment on Aarch64? But I did not quite understand the answer:
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.
My question is simple... How do I enable both CRC and Crypto extensions for the Raspberry Pi 3?
Here are some attempts that don't work.
Attempt (4) is similar to how we do it natively under Aarch64: gcc -march=armv8-a+crc+crypto -mtune=cortex-a53
. Attempt (5) actually enables CRC, but I can't seem to get anything else enabled, like PMULL
, PMULL2
, AES
, SHA1
and SHA2
.
gcc -D__ARM_FEATURE_CRYPTO -D__ARM_FEATURE_CRC -march=armv8-a+crc+crypto -mcpu=cortex-a53 -mfpu=neon test.cc -o test.exe
gcc -D__ARM_FEATURE_CRYPTO -D__ARM_FEATURE_CRC -march=armv8-a+crc -mcpu=cortex-a53 -mfpu=neon test.cc -o test.exe
gcc -D__ARM_FEATURE_CRYPTO -D__ARM_FEATURE_CRC -march=armv8-a -mcpu=cortex-a53 -mfpu=neon test.cc -o test.exe
gcc -march=armv8-a+crc+crypto -mcpu=cortex-a53 -mfpu=neon test.cc -o test.exe
gcc -march=armv8-a+crc -mcpu=cortex-a53 -mfpu=neon test.cc -o test.exe
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)