Assembler error when compiling ARM NEON plain assembly

1,095 views
Skip to first unread message

mg

unread,
Feb 8, 2014, 8:27:29 PM2/8/14
to andro...@googlegroups.com
Hello,

I am currently porting some code from iOS to Android using the NDK.
I have a third-party optimization library for ARMv7 NEON, everything compiles fine except one instruction. 
I used the clang toolchain for compiling th .cc and .s files as I need it for C++11 support.

Application.mk
NDK_TOOLCHAIN_VERSION := clang
APP_ABI := armeabi-v7a
APP_STL := gnustl_static

Android.mk (stripped, only CFLAGS):
LOCAL_CFLAGS := -mfloat-abi=softfp -mfpu=neon -marm -march=armv7-a

Back to the issue, this instruction do not compile:

vld1.32 {q0[]},[r9]!

I want to load one 32-bit float 'x' from [r9] (increment after) to all lanes of quad register q0 so it is: q0 = { x, x, x, x }.
Note the [ ] meaning the only loaded value is duplicated across the register.
This instruction compiles and work fine on iOS (armv7). I think it's mostly a syntax problem but I followed the NEON reference document,
so I'm not sure what is wrong with it.

The error is: 

armv7_basics.s:4135: Error: only D registers may be indexed `vld1.32 {q0[]},[r9]!

It seems to expect a register index. It should compile just fine, but I might be wrong with the syntax the NDK assembler expects.
I tried with the gcc toolchain and I get the same error (plus extra comment syntax funkiness, // vs @)

Thank you !
Regards, mg.

Jeffrey Walton

unread,
Feb 10, 2014, 6:27:59 AM2/10/14
to Android NDK List
If the instruction is supported, here's what you might try.

I ran into a similar assembler encoding problem on iOS with the ADDS
instruction. I could not get the assembler to accept the add with
status instruction. I eventually hand encoded it with:

__asm__
(
"ldr r0, %[xa] ;" // R0 = a
"ldr r1, %[xb] ;" // R1 = b
".inst.w 0x1809 ;" // Issue 'adds r1, r1, r0'
...
);

You can go to the ARM manual and encode it by hand (that's what I
ended up doing). Or, in your case, you might look what the iOS
assembler generated, and then reuse it in your Android code.

Jeff
Reply all
Reply to author
Forward
0 new messages