3 ms·
I assume they meant throwing an exception like divisions by zero usually do, i.e. a hardware trap. I always thought that overflows should be checked in hardwar
by simias 5y ago
I assume they meant throwing an exception like divisions by zero usually do, i.e. a hardware trap.
I always thought that overflows should be checked in hardware, I suppose it's not a stretch to extend that to truncation. It's controversial though, and obviously mostly a thought experiment anyway unless we manage to convince some CPU manufacturer to extend their ISA that way.
MIPS does have (optional) trapping overflow on signed add/sub overflow, so at least there's a small precedent for it.
- ridiculous_fish 5y agoSwift checks all arithmetic by default: https://swift.godbolt.org/z/rW614G5aq https://swift.godbolt.org/z/rW614G5aq It seems obvious that future Apple CPUs will have hardware support for this, if they don't already.
- saagarjha 5y agoI don’t see this happening unless it makes it into the ARM ISA.
- gumby 5y agoI don’t know the terms of Apple’s license with ARM, do you? I’m quite interested. Given that Apple was one of the original founders of ARM it’s quite possible that their license allows much more latitude anyone else’s.
- saagarjha 5y agoAdding new instructions to userspace programs is almost certainly not going to fly. All of their extensions have been hidden behind an opaque API, or limited to use in the kernel.
- masklinn 5y agoThat… makes no architectural difference at all. As far as the architecture is concerned, these are architectural extensions either way: userspace programs can observably contain and execute instructions which are not standard ARM. If AMX is allowed under their license, there is no reason why checked extensions would not be.
- hermitdev 5y agoI'm not familiar with ARM ISA, but from the godbolt disassembly, it doesn't look like anything special going on here - just the ASM being generated. What's happening here is it just does the add, jumps on overflow flag set to an invalid opcode...
- saagarjha 5y agoThe suggestion was a custom instruction or architectural extension to have this happen in hardware, rather than needing to write out extra code for this.
- ridiculous_fish 5y agoApple benefits from compatibility with the ARM ecosystem, but there’s no downsides (from their perspective) from extending it. Their chips are “Apple Silicon”, setting the stage for forging ahead alone. I think it’s a card they hold in reserve, to be played when the time is right, like the Intel transition.