Question

I have problems with using NEON intrinsics and inline assembly in Android NDK.

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

For example, here's some code:

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

I get two errors here:

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

All NEON types are displayed as ? in the error message, while non-NEON types are displayed correctly.

What is also strange is that functions which only use NEON types as return values (for example, vld1q_f32 and my abstract wrapper of it) don't suffer from the error.

I tried the same code in GCC Explorer 4.6 and 4.5, and there is no error, and correct and optimized assembly is generated, however, it doesn't work with Android NDK.

Était-ce utile?

La solution

As a workaround, in Window / Preferences / C/C++ / Code Analysis, set the Severity of "Invalid Arguments" errors to Warning, so that these bogus errors won't prevent launching the application.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top