내장 Vs 인라인 ASM 위한 SSE 코딩에서 VC++2K8
-
23-09-2019 - |
문제
나는 일부 인라인 ASM 코딩을 위한 SSE 전하지 않았 도 도에 대한을 제대로 알지 못하는 사람 ASM.그러나 내가 주 MS 도 제공합 내장 포장 같은 많은 특별 지침.
가 특정한 성과 차이를,또는 다른 강력한 이유 중 하나는 사용되어야 다른?
을 반복하는 제목에서,이것은 특히 취재 내장 노출에 의 VC++2008 년을 위해 관리되지 않는,네이티브 C++.
해결책
In general it's better to use intrinsics - it's more productive for the programmer and a good compiler (e.g. Intel ICC) will do a decent job of register allocation, instruction scheduling etc. The Microsoft compiler is not as good in this respect but it probably still does a reasonable job - you can always switch to ICC later if you need to get better performance.
다른 팁
이 없는 인라인에서 어셈블리 Visual C++x64.내장 함수에서 사용할 수 있습 64 니다.If you ever want to 포트 당신의 코드 x64,당신은 사용해야합니다 내장.
Intrinsics are identical to their equivalent assembly instructions and you should use them if possible - the compiler knows to directly translate them, there is no performance difference.
Use intrinsics.
Using assembly will usually result in several days of non-stop work, only to find out the compiler beats your best performance by 5%. (5% if you're really good; most likely 30%.)