4 ms·
> Also to my great disappoitment none of those CPUs has checked overflow for arithmetic operation. Yes - we're stuck with the historically convenient collectio
by drpixie 3y ago
> Also to my great disappoitment none of those CPUs has checked overflow for arithmetic operation.
Yes - we're stuck with the historically convenient collection of operations and types. Our CPUs are amazingly fast but very little smarter than decades ago.
Backwards-compatibility pretty much locks us into the same logical space. At least when people were designing new and amazing computers using actual wire (!) they felt free to implement what they thought would be useful, not just copy the existing model.
- renox 3y agoThe only CPU I know which had integer overflow detection was MIPS. RISC V is somewhat based on MIPS but they removed this part :-(
- smallstepforman 3y ago6502/6510 had integer add overflow …
- Findecanor 3y agoIndeed it is weird to see the trend in hardware to remove overflow checking when the trend in programming languages is to have more. While MIPS can trap on overflow, most architectures can at least set flags for conditional branch. PowerPC OR's the overflow flag into another flag, so you can choose to check that flag for overflow first after a block of calculations. I really want Mill to become successful. It has "NaR" (Not A Result) - like NaN but for integers. For every arithmetic instruction, there is has a variant that can set NaR. Like a NaN it is carried through the data-flow, and there's a trap first when it reaches a store or conditional instruction.
- saagarjha 3y agoModern CPUs are plenty fast at doing overflow checks in software.