“ARM inline Assembler”的版本间的差异
来自个人维基
free6d1823(讨论 | 贡献) (以“asm(code : output operand list : input operand list : clobber list); Referernce: http://www.ethernut.de/en/documents/arm-inline-asm.html”为内容创建页面) |
free6d1823(讨论 | 贡献) |
||
第1行: | 第1行: | ||
asm(code : output operand list : input operand list : clobber list); | asm(code : output operand list : input operand list : clobber list); | ||
+ | |||
+ | example: Rotating bits example | ||
+ | int x; | ||
+ | int y; | ||
+ | y= (x>>1); | ||
+ | |||
+ | <source lang="c"> | ||
+ | asm("mov %[result], %[value], ror #1" : [result] "=r" (y) : [value] "r" (x)); | ||
+ | </source> | ||
+ | |||
+ | register value (r1) = x | ||
+ | register result (r2) = y | ||
+ | result = (value >> 1) | ||
+ | |||
Referernce: http://www.ethernut.de/en/documents/arm-inline-asm.html | Referernce: http://www.ethernut.de/en/documents/arm-inline-asm.html |
2019年11月8日 (五) 11:41的版本
asm(code : output operand list : input operand list : clobber list);
example: Rotating bits example
int x;
int y;
y= (x>>1);
asm("mov %[result], %[value], ror #1" : [result] "=r" (y) : [value] "r" (x));
register value (r1) = x
register result (r2) = y
result = (value >> 1)
Referernce: http://www.ethernut.de/en/documents/arm-inline-asm.html