I'm working on my HiKey. I'm trying to enable CRC extension on ARMv8 in the assembler regardless of the way GCC was built, and regardless of the user's CFLAGS and CXXFLAGS. I'm encountering an assembler error: "unknown pseudo-op: `.arch_extension'".
According to [1], I can use ".arch_extension" to enable it. According to [2], ".arch_extension" is available in GCC 4.6 and GAS 2.21. My version of Linaro provides GCC 4.9.2 and GAS 2.25.90. I can also duplicate the issue on GCC113 (compiel farm), which provides GCC 4.8 and GAS 2.24.
The test program is below. Trying to compile it results in:
$ g++ test.cxx -c /tmp/ccVZ6hiq.s: Assembler messages: /tmp/ccVZ6hiq.s:24: Error: unknown pseudo-op: `.arch_extension' /tmp/ccVZ6hiq.s:25: Error: selected processor does not support `crc32b w1,w0,w0'
Trying to compile without ".arch_extension" results in:
$ g++ test.cxx -c /tmp/cci4wu6d.s: Assembler messages: /tmp/cci4wu6d.s:24: Error: selected processor does not support `crc32b w1,w0,w0'
Its almost as if ".arch_extension" is not being properly recognized or consumed.
Any ideas what might be going wrong here?
**********
The program:
$ cat test.cxx #include <arm_neon.h>
#define GCC_INLINE_ATTRIB __attribute__((__gnu_inline__, __always_inline__, __artificial__))
#if defined(__GNUC__) && !defined(__ARM_FEATURE_CRC32) __inline unsigned int GCC_INLINE_ATTRIB CRC32B(unsigned int crc, unsigned char v) { unsigned int r; asm (" \n" ".arch_extension crc \n" "\t" "crc32b %w2, %w1, %w0 \n" : "=r"(r) : "r"(crc), "r"((unsigned int)v)); return r; } #else // just use the instrinsic # define CRC32B(a,b) __crc32b(a,b) #endif
int main(int argc, char* argv[]) { return CRC32B(argc, argc); }
**********
Versions...
$ gcc --version gcc (Ubuntu/Linaro 4.8.4-2ubuntu1~14.04.3) 4.8.4
$ as -v GNU assembler version 2.24 (aarch64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.24
$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.04.5 LTS Release: 14.04 Codename: trusty
[1] https://sourceware.org/binutils/docs/as/AArch64-Directives.html#AArch64-Dire... [2] https://gcc.gnu.org/ml/gcc-help/2012-07/msg00180.html