2 ms·
Can you please elaborate the last paragraph? Sounds interesting that we can now legitimately write raw assemblies! I always want to do that but it's still in my
by hnthrowaway0315 3y ago
Can you please elaborate the last paragraph? Sounds interesting that we can now legitimately write raw assemblies! I always want to do that but it's still in my backlog.
- jandrewrogers 3y agoI think they mean writing code using compiler intrinsics, which are one layer above assembly (and how you should write most “assembly” these days). Many of the modern intrinsics in silicon are sufficiently complex in how they manipulate the data that it is effectively impossible for a compiler to detect applications of those instructions to normal idiomatic code. If you want to use those instructions, you will have to use them directly because the compiler can’t do it for you. The nice thing about intrinsics is that they look like C functions so they are easy to use. There is definitely a growing cottage industry for writing high-performance kernels using this increasingly rich set of intrinsics. I find myself writing a lot more intrinsics code than I used to.
- Const-me 3y agoWriting 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.