3 ms·
Writing assembly is rarely a good choice in modern days. Whether assembly code is correct or not depends not just on the target CPU, but also on the target OS.
by Const-me 3y ago
Writing assembly is rarely a good choice in modern days. Whether assembly code is correct or not depends not just on the target CPU, but also on the target OS.
See that bug for the example what gonna happen https://bugs.chromium.org/p/chromium/issues/detail?id=1218384 https://bugs.chromium.org/p/chromium/issues/detail?id=121838...
TLDR: Windows ABI conventions say xmm6-xmm15 vector registers are non-volatile. When a function uses them, it needs to backup old data, and restore before the return. Linux ABI conventions say all vector registers are volatile and don’t need to be preserved. Chromium has non-trivial pieces written in assembly, and crashes.
When writing C or C++ with intrinsics, registers are managed by the compiler. Modern ones follow these ABI conventions very carefully.