inline assembly: improve everywhere

This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-02-25 00:00:00 +00:00
parent 7ec28d6808
commit a30ed0f047
5 changed files with 62 additions and 38 deletions

View File

@@ -2,7 +2,12 @@
#include <inttypes.h>
int main(void) {
register uint32_t x0 __asm__ ("x0");
__asm__ ("mov x0, #1;" : : : "%x0");
assert(x0 == 1);
uint32_t myvar = 1;
__asm__ (
"add %[myvar], %[myvar], 1;"
: [myvar] "=r" (myvar)
:
:
);
assert(myvar == 2);
}