https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70974

            Bug ID: 70974
           Summary: armv8-a+crc does not define __ARM_ACLE
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: noloader at gmail dot com
  Target Milestone: ---

I'm working with a HiKey dev board. It provides AArch64.

I'm trying to compile a simple program:

$ cat test.cxx
#if (defined(__ARM_NEON__) || defined(__ARM_NEON))
# define NEON_INTRINSICS_AVAILABLE 1
#else
# define NEON_INTRINSICS_AVAILABLE 0
#endif

#if BOOL_NEON_INTRINSICS_AVAILABLE
# include <arm_neon.h>
# if (__ARM_ACLE >= 200)
#  include <arm_acle.h>
# endif
#endif

#include <stdint.h>

int main(int argc, char* argv[])
{
  uint32_t crc = 0;
  crc = __crc32b(crc, (uint8_t)0);
  return 0
}

Compiling the program results in:

$ g++ -march=armv8-a+crc test.cxx -o test.exe
test.cxx: In function ‘int main(int, char**)’:
test.cxx:19:33: error: ‘__crc32b’ was not declared in this scope
   crc = __crc32b(crc, (uint8_t)0);
                                 ^
test.cxx:22:1: error: expected ‘;’ before ‘}’ token
 }
 ^

According to "ARM® C Language Extensions Release 2.0"
(http://infocenter.arm.com/help/topic/com.arm.doc.ihi0053c/IHI0053C_acle_2_0.pdf),
it looks like GCC is failing to define the necessary preprocessor macros. For
the CRC32 gear, it looks like GCC needs to -D__ARM_ACLE=200.

Also, I'm using GCC 4.9, so __has_include(x) is not available to me.

----------

$ g++ -march=armv8-a+crc -dM -E - </dev/null | egrep -i '(arm|neon|aarch)'
#define __AARCH64_CMODEL_SMALL__ 1
#define __aarch64__ 1
#define __AARCH64EL__ 1
#define __ARM_FEATURE_CRC32 1
#define __ARM_NEON 1

And:

$ clang++ -march=armv8-a+crc -dM -E - </dev/null | egrep -i '(arm|neon|aarch)'
#define __AARCH64EL__ 1
#define __ARM_64BIT_STATE 1
#define __ARM_ACLE 200
#define __ARM_ALIGN_MAX_STACK_PWR 4
#define __ARM_ARCH 8
#define __ARM_ARCH_ISA_A64 1
#define __ARM_ARCH_PROFILE 'A'
#define __ARM_FEATURE_CLZ 1
#define __ARM_FEATURE_CRC32 1
#define __ARM_FEATURE_DIV 1
#define __ARM_FEATURE_FMA 1
#define __ARM_FEATURE_UNALIGNED 1
#define __ARM_FP 0xe
#define __ARM_FP16_FORMAT_IEEE 1
#define __ARM_FP_FENV_ROUNDING 1
#define __ARM_NEON 1
#define __ARM_NEON_FP 0xe
#define __ARM_PCS_AAPCS64 1
#define __ARM_SIZEOF_MINIMAL_ENUM 4
#define __ARM_SIZEOF_WCHAR_T 4
#define __aarch64__ 1

-----

$ gcc --version
gcc (Debian/Linaro 4.9.2-10) 4.9.2

$ clang --version
Debian clang version 3.5.0-10 (tags/RELEASE_350/final) (based on LLVM 3.5.0)
Target: aarch64-unknown-linux-gnu
Thread model: posix

Reply via email to