Hi all,
I have a problem when compiling NEON intrinsics in c++ by using ndk-
build.
Some info:
I have the NDK version r5b
I have set these makefile flags
#Application.mk:
APP_ABI := armeabi armeabi-v7a
#Android.mk:
LOCAL_CFLAGS := -DANDROID_NDK \
-DDISABLE_IMPORTGL \
-ffast-math \
-O3 \
-funroll-loops \
-mfloat-abi=softfp -mfpu=neon \
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
LOCAL_CFLAGS := -DHAVE_NEON=1
LOCAL_SRC_FILES += cParticles.cpp.neon \
cGame.cpp.neon
else
LOCAL_SRC_FILES += cParticles.cpp \
cGame.cpp
endif
GCC gives me this error:
$ ndk-build
Compile++ thumb : cppwrapper <= cParticles.cpp
SharedLibrary : libcppwrapper.so
Install : libcppwrapper.so => libs/armeabi/libcppwrapper.so
Compile++ thumb : cppwrapper <= cParticles.cpp
D:/my_projects/Android/CppWrapper/jni/cParticles.cpp: In member
function 'void cParticles::Update(float)':
D:/my_projects/Android/CppWrapper/jni/cParticles.cpp:172: internal
compiler error: in change_address_1, at emit-rtl.c:1954
Please submit a full bug report,
with preprocessed source if appropriate.
See <
http://gcc.gnu.org/bugs.html> for instructions.
make: *** [/cygdrive/d/my_projects/Android/CppWrapper/obj/local/
armeabi-v7a/objs/cppwrapper/cParticles.o] Error 1
Here is guilty code:
/*******************************************************************/
float32x4_t* VertPtr = ..some address
float32x4_t* SpeedPtr = ..some address
for( int i = 0; i < NUMCOORDS/4; ++i )
{
*SpeedPtr = vmulq_f32( *SpeedPtr, OneSmall4 );
*VertPtr = vmlaq_f32( *VertPtr, DT4, *SpeedPtr );
/* EVERYTHING WORKS FINE EXCEPT WHEN I PUT ANY INTRINSICS HERE */
*SpeedPtr = vmulq_f32( (*SpeedPtr), OneSmall4 ); // Example line.
Copy-paste from lines above (so it's perfectly valid), this gives an
internal error.
/* ------- */
*(VertPtr+NUMCOORDS/4) = vmlaq_f32( *VertPtr, *SpeedPtr,
LineLength4 );
VertPtr++;
SpeedPtr++;
}
/*******************************************************************/
It seems the compiler doesn't like it when I put intrinsics between
the two vmlaq_f32 calls
Anybody ever had this error, and found a fix?
Thanks,
FakeTruth