OK, I am no asm expert, all I've ever done before is some minimal arm/thumb and pic chip asm, and I've never used asm inside of C... anyway...
I try to load a float value into register S002 (all the VFPU registers only do floats I believe?). I am not sure what the "r" constraint means in this context, but from the gcc documentation it seems that the %0 operand will be put in any general register... so the code below means something like
load the float at offset 0 of the memory address stored in some register = indirect addressing ..into register S002
gcc will put &x into some register before executing, am I right?
Code: Select all
float x = 3.14;
asm volatile (
"lv.s S002, 0(%0)\n" : : "r"(&x)
);
Code: Select all
asm volatile (
"lv.s S002, %0\n" : : "m"(&x)
);