Inline assemblyIt refers to directly adding assembly code to the source code, so that the compiled assembly code contains embedded assembly code to achieve code optimization.
Sometimes Programmers think that the performance of compiled assembly code is certainly better than that of compiled assembly code,
However, if the compiler optimization option is enabled, the optimized assembly code generated by the compiler generally outweighs the compiled assembly code,
This is a tragedy.
Note that,Restrained assembly is not cross-platformSo programmers need to write different inline assembly code based on different platforms to achieve cross-platform purposes.
The following documents are collected about the restrained compilation.
1.GCC compiling environment.
English:
Http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html#s2
Chinese:
Http://blog.csdn.net/wuyao721/article/details/3573598
2.Ms vc ++ EnvironmentCompiled in an restrained manner.
Http://msdn.microsoft.com/en-us/library/4ks26t93 (V = vs.71). aspx
However, the tragedy is that vs currently does not support restrained compilation under intel x64 architecture,
However, there are some alternative methods:
Http://mariusbancila.ro/blog/2010/10/17/no-more-inline-asm-in-vc-on-x64/
3. for assembly languages,Intel and at&tThere are different assembly syntaxes.
Syntax differences:
Http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html#s3