gcc提供了內嵌語法,使在 C
語言中可以直接撰寫組合語言。
: output operands
: input operands
: list of clobbered registers
);
":" : 分隔符號
assembler template: 組語部分,需存取output/input operands列表內容
%0: 輸出
%1~N:輸入
clobber: 告訴compiler,哪些register被這段code改了
- f : 是floating point register (有些 cpu 有專屬的 floating point register)
- I : 立即定址 immediate operands
- J : Indexing constants
- K : negative value in rhs
- L: negative value in rhs
- M : for shift
- r : General registers -- ARM 一般用這個
- = : Write-only (通常所有的 output operand 都會加這個符號)
- + : Read-Write (inline assemnly 不支援這個符號)
- & : Output only - 這個register 只做 output 使用
參考:
http://stenlyho.blogspot.tw/2008/08/cinline-casmasm-code-asmmovl-1eaxnt.html
沒有留言:
張貼留言