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

@@ -5,11 +5,11 @@ int main(void) {
uint32_t in = 1;
uint32_t out = 0;
__asm__ (
"movl %1, %%eax;"
"mov %[in], %%eax;"
"inc %%eax;"
"movl %%eax, %0"
: "=m" (out)
: "m" (in)
"mov %%eax, %[out]"
: [out] "=g" (out)
: [in] "g" (in)
: "%eax"
);
assert(out == in + 1);