0

I have a C function and I want to load data from array of pointers passed to assembler part. How to do this?

float *pointerToBuffer

asm volatile (
   "vld1.32 {q0},[%[buf]] \n\t" 
   : [buf]"+r"(ponterToBuffer)
);

What if the variable was pointerToPointerToBuffer

  • 2
    What are you trying to do? http://meta.stackexchange.com/a/66378/195751 – auselen Sep 18 '13 at 11:16
  • Does [this post help](http://stackoverflow.com/questions/17119201/false-positive-undefined-or-garbage-value-returned-to-caller)? – artless noise Sep 18 '13 at 14:38
  • `asm("vld1.32 {q0}, %0" : : "m"(pointerToBuffer) : "memory");` would to. If you want to pass an address / a memory location, use the `"m"(...)` constraint, and leave one level of brackets out. – FrankH. Sep 19 '13 at 09:14

1 Answers1

0

I would suggest use one more pair of brackets if the grammar permits:

asm volatile (
   "vld1.32 {q0},[[%[buf]]] \n\t" 
   : [buf]"+r"(ponterToBuffer)
);

if not:

asm volatile (
   "ldr r1,[%[pointerToBuffer]] \n\t"
   "vld1.32 {q0},[r1] \n\t"
);
TwoCode
  • 127
  • 7