Question

I want to load the value of a double precision register (d8) into a C variable on ARM platform with a toolchain (gcc-4.6) that comes with the Google NDKv8b. My ARM machine is a Samsung Galaxy S2 (it has VFPv3 and NEON). The GCC documentation says that in order to use VFP double precision registers on inline assembly, the "w" constraint must be used. So I tried something like this (ok, don't look so much into the logic of the whole program):

#include <stdio.h>

int main()
{
    double dVar = 1.2345678;
    double dTmp;
    int i;
    for(i = 0; i < 100; i++ )
    {
        asm volatile(
            "vmov.f64 %[dTmp], d8\n"
            : [dTmp] "=w" (dTmp)
            :
            :
        );
        dVar *= 10.0;
        printf("d8 = %f\n", dTmp );
    }

    return 0;
}

Well, it doesn't even compile:

/tmp/cc9wQA1z.s: Assembler messages:
/tmp/cc9wQA1z.s:62: Internal error, aborting at /usr/local/google/home/andrewhsieh/ndk-andrewhsieh/src/build/../binutils/binutils-2.21/gas/config/tc-arm.c line 14709 in do_neon_mov

How can I achieve this?

Thanks!

Was it helpful?

Solution

I've changed the code part as below,

"vmov.f64 %P[dTmp2], d8\n"

after this I can compile. I didn't verify the produced code.

For P constraint please look at Hardwarebug / ARM inline asm secrets and this email thread.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top