extern int input ,result;
2
3 void test_at_t()
4 {
5 result = 0;
6 input = 1;
7 __asm__
8 __volatile__("addl%1, %0":"=r"(result):"r"(input));
9 }
~
~
~ test.c
~
2 .text
3 .globl test_at_t
4 .type test_at_t, @function
5 test_at_t:
6 pushl %ebp
7 movl %esp, %ebp
8 movl $0, result
9 movl $1, input
10 movl input, %eax
11 #APP
12 # 7 "test_at_t.c" 1
13 addl%eax, %eax
14 # 0 "" 2
15 #NO_APP
16 movl %eax, result
17 popl %ebp
18 ret
19 .size test_at_t, .-test_at_t
20 .ident "GCC: (Debian 4.4.5-8) 4.4.5"
21 .section .note.GNU-stack,"",@progbits
~
~/test_at_t.s[1] [asm] unix utf-8 2:1/21
2
3 void test_at_t()
4 {
5 result = 0;
6 input = 1;
7 __asm__
8 __volatile__("addl%1, %0":"=r"(result):"r"(input));
9 }
~
~
~ test.c
~
$gcc -S test.c
编译后产生test.s
2 .text
3 .globl test_at_t
4 .type test_at_t, @function
5 test_at_t:
6 pushl %ebp
7 movl %esp, %ebp
8 movl $0, result
9 movl $1, input
10 movl input, %eax
11 #APP
12 # 7 "test_at_t.c" 1
13 addl%eax, %eax
14 # 0 "" 2
15 #NO_APP
16 movl %eax, result
17 popl %ebp
18 ret
19 .size test_at_t, .-test_at_t
20 .ident "GCC: (Debian 4.4.5-8) 4.4.5"
21 .section .note.GNU-stack,"",@progbits
~
~/test_at_t.s[1] [asm] unix utf-8 2:1/21