How Is Arm_Neon. H Generated or Maintained?

There is arm_neon.h in Android NDK:

$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/9.0.9/include/arm_neon.h

The arm_neon.h content is very long (for me), say, in NDK-r21e, with 73681 lines:

I wonder how is the arm_neon.h generated from Clang compiler ? Is it generated from some scripts? (Sorry for my poor knowledge for LLVM)

4

1 Answer

For Clang compiler, there is arm_neon.td as source file, and CMake generates arm_neon.h file.

To be precise:

  • there is llvm-project/clang/include/clang/Basic/arm_neon.td
  • there is llvm-project/clang/lib/Headers/CMakeLists.txt, providing:
# Generate header files and copy them to the build directory
if(ARM IN_LIST LLVM_TARGETS_TO_BUILD OR AArch64 IN_LIST LLVM_TARGETS_TO_BUILD)
  # Generate arm_neon.h
  clang_generate_header(-gen-arm-neon arm_neon.td arm_neon.h)
  # Generate arm_fp16.h
  clang_generate_header(-gen-arm-fp16 arm_fp16.td arm_fp16.h)
  # Generate arm_sve.h
  clang_generate_header(-gen-arm-sve-header arm_sve.td arm_sve.h)
  # Generate arm_bf16.h
  clang_generate_header(-gen-arm-bf16 arm_bf16.td arm_bf16.h)
  # Generate arm_mve.h
  clang_generate_header(-gen-arm-mve-header arm_mve.td arm_mve.h)
  # Generate arm_cde.h
  clang_generate_header(-gen-arm-cde-header arm_cde.td arm_cde.h)
endif()
  • From the git commit history, there wasn't arm_neon.td in the early times:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Maya Lin-Takahashi

Maya Lin-Takahashi

Consumer Tech & Gadget Reviewer

Maya is a hardware enthusiast who tests and reviews smart home devices, smartphones, wearables, and audio gear. She focuses on practical consumer value and build quality.

Share this article
Twitter Facebook Pinterest