Built-in NEON types work in C, but cause invalid argument error in C ++

I'm having problems using the NEON built-in assemblies and the built-in build in Android NDK.

NEON types, such as float32x4_t , give an "invalid arguments" error when compiling C ++ code with GCC 4.6 and 4.8, but the code compiles fine if compiled as C.

For example, here is some code:

 inline float32x4_t VectorAdd(float32x4_t a, float32x4_t b) { return vaddq_f32(a, b); } 

Here I get two errors:

  • In the function itself: Invalid arguments ' Candidates are: ? vaddq_f32(?, ?) ' Invalid arguments ' Candidates are: ? vaddq_f32(?, ?) ' .
  • If the function is called: Invalid arguments ' Candidates are: ? VectorAdd(?, ?) ' Invalid arguments ' Candidates are: ? VectorAdd(?, ?) ' .

Are all NEON types displayed as? in the error message, while types other than NEON are displayed correctly.

It is also strange that functions that use only NEON types as return values ​​(for example, vld1q_f32 and my abstract shell) do not suffer from an error.

I tried the same code in GCC Explorer 4.6 and 4.5, and there is no error, and the assembly is fixed and optimized, however, it does not work with Android NDK.

+8
c ++ android neon intrinsics android-ndk
source share
1 answer

As a workaround in the / Preferences / C / C ++ / Code Analysis window, set Error Severity Invalid Arguments to Warning so that these false errors do not prevent the application from starting.

+2
source share

All Articles