当我将以下内联程序集放入其中时,main()
它会直接在printf("before\n")
. 显然内联汇编块有问题,因为printf("after\n")
没有打印。当放入自己的函数run()
并在其中调用时,相同的内main()
联汇编可以完美运行mainssv();
。这块有什么问题?
int main()
{
while(1)
{
printf("before\n");
asm volatile(
".syntax unified\n"
".text\n"
".arch armv7-a\n"
".fpu neon\n"
".thumb\n"
".global mainssv\n"
".func mainssv\n"
".thumb_func\n"
"mainssv:\n"
" mov lr, pc\n"
" adds lr, lr, #63\n"
" bic lr, lr, #63\n"
" mov ip, 16\n"
" .p2align 2\n"
"0:\n"
" .rept 130\n"
" vld2.8 {q0}, [lr, :128], ip\n"
" vaba.u8 q4, q4, q3\n"
" bne 1f\n"
"1: vld2.8 {q1}, [lr, :128], ip\n"
" vaba.u8 q5, q5, q0\n"
" vld2.8 {q2}, [lr, :128], ip\n"
" vaba.u8 q6, q6, q1\n"
" bne 1f\n"
"1: vld2.8 {q3}, [lr, :128], ip\n"
" vaba.u8 q7, q7, q2\n"
" smuad r0, r1, r2\n"
" subs lr, lr, #64\n"
" .endr\n"
" bne 0b\n"
".endfunc"
);
printf("after\n");
}
}