Move test in a specific folder
This commit is contained in:
21
example/asm.c
Normal file
21
example/asm.c
Normal file
@@ -0,0 +1,21 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int add(int a, int b)
|
||||
{
|
||||
int result;
|
||||
asm volatile (
|
||||
"addl %2, %1;" // Add b
|
||||
"movl %1, %0;"
|
||||
: "=r" (result)
|
||||
: "r" (a), "r" (b)
|
||||
: "cc"
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int x = 10, y = 20;
|
||||
printf("%d + %d = %d\n", x, y, add(x, y));
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user