Skip to content

Including <arm_neon.h> fails to compile in the sycl pass #19972

@emtKazys

Description

@emtKazys

Describe the bug

When building for ARM (cross compile or on target), including <arm_neon.h> generates compiler errors, but only in the sycl pass. Using #ifndef __SYCL_DEVICE_ONLY__ to excluding including that header will avoid the issue.

To reproduce

Example program:

// Neon.cpp
#include <arm_neon.h>

int main()
{
    return 0;
}

Command line which compiles:

clang++ neon.cpp

Command line which fails:

clang++ -fsycl neon.cpp

Example error messages:

In file included from neon.cpp:1:
/opt/intel/llvm/lib/clang/20/include/arm_neon.h:46:24: error: invalid vector element type 'poly8_t' (aka 'unsigned char')
   46 | typedef __attribute__((neon_polyvector_type(8))) poly8_t  poly8x8_t;
      |                        ^
/opt/intel/llvm/lib/clang/20/include/arm_neon.h:47:24: error: invalid vector element type 'poly8_t' (aka 'unsigned char')
   47 | typedef __attribute__((neon_polyvector_type(16))) poly8_t poly8x16_t;
      |                        ^
/opt/intel/llvm/lib/clang/20/include/arm_neon.h:48:24: error: invalid vector element type 'poly16_t' (aka 'unsigned short')
   48 | typedef __attribute__((neon_polyvector_type(4))) poly16_t poly16x4_t;
      |                        ^
/opt/intel/llvm/lib/clang/20/include/arm_neon.h:49:24: error: invalid vector element type 'poly16_t' (aka 'unsigned short')
   49 | typedef __attribute__((neon_polyvector_type(8))) poly16_t poly16x8_t;
      |                        ^
/opt/intel/llvm/lib/clang/20/include/arm_neon.h:50:24: error: invalid vector element type 'poly64_t' (aka 'unsigned long')
   50 | typedef __attribute__((neon_polyvector_type(1))) poly64_t poly64x1_t;
      |                        ^
/opt/intel/llvm/lib/clang/20/include/arm_neon.h:51:24: error: invalid vector element type 'poly64_t' (aka 'unsigned long')
   51 | typedef __attribute__((neon_polyvector_type(2))) poly64_t poly64x2_t;
      |                        ^
/opt/intel/llvm/lib/clang/20/include/arm_neon.h:7221:46: error: C-style cast from scalar 'poly8x8_t' (aka 'unsigned char') to vector 'int8x8_t' (vector of 8 'int8_t' values) of different size
 7221 |     __ret = (poly8x8_t)__builtin_neon_vadd_v((int8x8_t)__p0, (int8x8_t)__p1, 4);
      |                                              ^~~~~~~~~~~~~~
/opt/intel/llvm/lib/clang/20/include/arm_neon.h:7221:62: error: C-style cast from scalar 'poly8x8_t' (aka 'unsigned char') to vector 'int8x8_t' (vector of 8 'int8_t' values) of different size
 7221 |     __ret = (poly8x8_t)__builtin_neon_vadd_v((int8x8_t)__p0, (int8x8_t)__p1, 4);
      |                                                              ^~~~~~~~~~~~~~
/opt/intel/llvm/lib/clang/20/include/arm_neon.h:7252:47: error: C-style cast from scalar 'poly16x4_t' (aka 'unsigned short') to vector 'int8x8_t' (vector of 8 'int8_t' values) of different size
 7252 |     __ret = (poly16x4_t)__builtin_neon_vadd_v((int8x8_t)__p0, (int8x8_t)__p1, 5);
      |                                               ^~~~~~~~~~~~~~
/opt/intel/llvm/lib/clang/20/include/arm_neon.h:7252:63: error: C-style cast from scalar 'poly16x4_t' (aka 'unsigned short') to vector 'int8x8_t' (vector of 8 'int8_t' values) of different size
 7252 |     __ret = (poly16x4_t)__builtin_neon_vadd_v((int8x8_t)__p0, (int8x8_t)__p1, 5);
      |                                                               ^~~~~~~~~~~~~~
/opt/intel/llvm/lib/clang/20/include/arm_neon.h:7277:48: error: C-style cast from scalar 'poly8x16_t' (aka 'unsigned char') to vector 'int8x16_t' (vector of 16 'int8_t' values) of different size
 7277 |     __ret = (poly8x16_t)__builtin_neon_vaddq_v((int8x16_t)__p0, (int8x16_t)__p1, 36);
      |                                                ^~~~~~~~~~~~~~~
/opt/intel/llvm/lib/clang/20/include/arm_neon.h:7277:65: error: C-style cast from scalar 'poly8x16_t' (aka 'unsigned char') to vector 'int8x16_t' (vector of 16 'int8_t' values) of different size
 7277 |     __ret = (poly8x16_t)__builtin_neon_vaddq_v((int8x16_t)__p0, (int8x16_t)__p1, 36);
      |                                                                 ^~~~~~~~~~~~~~~
/opt/intel/llvm/lib/clang/20/include/arm_neon.h:7309:48: error: C-style cast from scalar 'poly64x2_t' (aka 'unsigned long') to vector 'int8x16_t' (vector of 16 'int8_t' values) of different size
 7309 |     __ret = (poly64x2_t)__builtin_neon_vaddq_v((int8x16_t)__p0, (int8x16_t)__p1, 38);
      |                                                ^~~~~~~~~~~~~~~
/opt/intel/llvm/lib/clang/20/include/arm_neon.h:7309:65: error: C-style cast from scalar 'poly64x2_t' (aka 'unsigned long') to vector 'int8x16_t' (vector of 16 'int8_t' values) of different size
 7309 |     __ret = (poly64x2_t)__builtin_neon_vaddq_v((int8x16_t)__p0, (int8x16_t)__p1, 38);
      |                                                                 ^~~~~~~~~~~~~~~
/opt/intel/llvm/lib/clang/20/include/arm_neon.h:7335:48: error: C-style cast from scalar 'poly16x8_t' (aka 'unsigned short') to vector 'int8x16_t' (vector of 16 'int8_t' values) of different size
 7335 |     __ret = (poly16x8_t)__builtin_neon_vaddq_v((int8x16_t)__p0, (int8x16_t)__p1, 37);
      |                                                ^~~~~~~~~~~~~~~
/opt/intel/llvm/lib/clang/20/include/arm_neon.h:7335:65: error: C-style cast from scalar 'poly16x8_t' (aka 'unsigned short') to vector 'int8x16_t' (vector of 16 'int8_t' values) of different size
 7335 |     __ret = (poly16x8_t)__builtin_neon_vaddq_v((int8x16_t)__p0, (int8x16_t)__p1, 37);
      |                                                                 ^~~~~~~~~~~~~~~
/opt/intel/llvm/lib/clang/20/include/arm_neon.h:8247:44: error: C-style cast from scalar 'poly8x8_t' (aka 'unsigned char') to vector 'int8x8_t' (vector of 8 'int8_t' values) of different size
 8247 |     )__builtin_neon_vbsl_v((int8x8_t)__p0, (int8x8_t)__p1, (int8x8_t)__p2, 4);
      |                                            ^~~~~~~~~~~~~~
/opt/intel/llvm/lib/clang/20/include/arm_neon.h:8247:60: error: C-style cast from scalar 'poly8x8_t' (aka 'unsigned char') to vector 'int8x8_t' (vector of 8 'int8_t' values) of different size
 8247 |     )__builtin_neon_vbsl_v((int8x8_t)__p0, (int8x8_t)__p1, (int8x8_t)__p2, 4);
      |                                                            ^~~~~~~~~~~~~~
/opt/intel/llvm/lib/clang/20/include/arm_neon.h:8276:44: error: C-style cast from scalar 'poly16x4_t' (aka 'unsigned short') to vector 'int8x8_t' (vector of 8 'int8_t' values) of different size
 8276 |     )__builtin_neon_vbsl_v((int8x8_t)__p0, (int8x8_t)__p1, (int8x8_t)__p2, 5);
      |                                            ^~~~~~~~~~~~~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]

Environment

  • OS: Ubuntu 22.04
  • Target device and vendor: None
  • DPC++ version: Custom build of Intel LLVM at v6.1.0
  • Dependencies version: N/A

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcompilerCompiler related issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions