4 ms·
Apple platforms diverge from Arm’s ABI in specific ways. ...and so does Microsoft with its ARM64EC ABI: https://learn.microsoft.com/en-us/cpp/build/arm64ec-wi
by userbinator 4y ago
Apple platforms diverge from Arm’s ABI in specific ways.
...and so does Microsoft with its ARM64EC ABI:
https://learn.microsoft.com/en-us/cpp/build/arm64ec-windows-abi-conventions https://learn.microsoft.com/en-us/cpp/build/arm64ec-windows-...
I've always thought it odd that a CPU manufacturer would specify an ABI, since that seems to imply preference towards certain programming languages and techniques which may or may not be ideal in all cases; Intel certainly didn't.
- monocasa 4y agoIntel probably wishes they did. That's because ultimately having code generally follow a common structure gives you as a uarch designer a bit more to work with wrt how RTL micro-optimizations affect your customers' code. Towards that end, the different AArch64 ABIs are pretty minor morphs when compared to the clusters that are x86 ABIs.
- moonchild 4y agoThis statement confuses me. There are two ABIs in common use on 64-bit x86. One is used on windows; the other is used everywhere else, and intel has been involved in its specification (I believe its current editor is an intel employee). Most concerns relating to ABI specification can be dealt with pursuant only to architecture, not microarchitecture; minimising instruction or byte counts, say. And architectures have long lives, over the course of which microarchitectures may change quite a lot. You wouldn't want your ABI to be overfit to one particular microarchitecture. Not to say that it's a bad thing for a processor or architecture vendor to supply a standard ABI. It's good to have cohesion and consistency, and furthermore, if you have designed an architecture, then you have (one really, really hopes) performed a lot of experiments to see what code for that architecture looks like, so you are in a good position to be specifying an ABI. But that's not to say a third party is per se in a worse position to be specifying an ABI. And of course, stable binary interfaces are dying (and good riddance!), but that's a separate issue.
- monocasa 4y agoYeah, they cleaned up x86-64, but x86-32 had three calling conventions on windows alone.
- deleted 4y ago[deleted]
- dmitrygr 4y ago> I've always thought it odd that a CPU manufacturer would specify an ABI Why? It we all agree to use R13 as SP, the core designers can spend a few [hundred] extra transistors optimizing accesses to [R13 + offset]. Perhaps adding such logic for ALL registers is too costly? If we all agree that R14 is the return address, the prefetcher might want to prefetch instructions there, so return is faster. The core probably cannot afford the transistors to do that for ALL regs ARM (and most other chips) will work if you do not follow those conventions, but they might not perform as well. Eg: aarch64 instruction "ret" takes a register param and you can use any reg you wish, but at least on some microarchitectures implementing the aarch64 ISA, it will be faster if the param is the X30 register, since that is the agreed-upon return address reg, and some silicon was spent optimizing this case
- userbinator 4y agoWhy even call them R13/R14 then? Intel specifically assigned a stack and frame pointer on x86, and there are even special instructions to work with the former, and addressing modes for the latter (BP/EBP/RBP uses the stack segment). Interrupts and exceptions will also implicitly use the stack pointer. It's odd because ARM seems to be trying to present itself as being a RISC, when the architecture appears to be slowly becoming something else. The allowable addressing modes with each instruction in A64 clearly shows this.
- dmitrygr 4y agowell, for example in ARMv7 and below, it was common to use LR(r14) ALSO for math during the function body if there was register pressure. So it does assist a little. And the instruction set encoding is much simpler if every reg is just ... a reg. No need for push and pop if you can store with predecrement and load with postincrement. And those stores/loads are useful ALSO for non-stack ops, if your compiler is clever. _At the time_ the design made good sense. But in modern very-OoO cpus, you are right, and having SP and PC be GPRs is of little use and of non-negilible cost design-wise, which is why in aarch64, SP and PC are special and not GPRs like they were in ARMv7 and below. LR still is a GPR though
- pm215 4y ago
- pm215 4y agoThe Arm 32 bit EABI spec acknowledgements section credits 9 other companies for their "active support" -- most of them are or were toolchain vendors. You specify an ABI so that all the different companies who are writing and selling compilers can produce object files that work together, which makes it easier for customers to develop software for the CPU, which means you can sell more chips. Nobody will come and break down your door if you choose not to follow the ABI, of course, but if you want to interoperate with others you have that option. And yes, there's an implicit bias towards C and C++ here, but that is just because that is the environment where enough toolchain developers and customers care about interoperability between different suppliers to make specification worthwhile.