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:
Invalid arguments ' Candidates are: ? vaddq_f32(?, ?) '
.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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With