I suspect this is due to the lack of an output constraint.
Try this,
uint64_t Foo::f() {
uint64_t result;
asm /* volatile */
("vldmia %1, {q0-q1} \n" // q0-1 = *this
⋮
"vstmia %0, {d0} \n" // result = d0
: "=w"(result): "r"(this) : "q0", "q1");
return result;
}
You must use an output constraint, "=w"(result)
, to tell the compiler that the assembler is setting a value. You probably don't need the volatile
if you do this. At least, this is a good issue to eliminate.