MIPS?
------------------
Addendum addressing your updates:
> MIPS does have a status register, and this register does have an overflow bit:
Yes, it does, but it doesn't function as a simple carry or zero bitfield. In MIPS, there are two instructions for performing addition: add and addu. add generates a trap which you can respond to in an exception handler (which is where you check for this exception code)–as opposed to addu, which overflows silently. Most programs explicitly looking to check for overflow just use addu followed by a sltu (set less than, unsigned).
“u” in “addu” means unsigned, so if I’m using it, I understand what the implication is.
What implication are you talking about?
That there is no bit used for the sign, and so I know when the registers will overflow. A lot of the assembler code I wrote exploits this very fact, since when used cleverly it’s a performance optimization.
Re:Catching integer overflows in C
by AstralStorm on Wednesday August 22, 2018 @03:57AM
(#17817106)
Unfortunately, the bit has overloaded meaning. Plus you're still injecting expensive branches which the branch slot is unlikely to fix.
You’ll never feel that penalty if you’re writing the assembler code by hand, not even on the oldest, slowest MIPS processor, and if you’re using a compiler, the compiler intrinsic has to do the same thing.
Which contemporary processors don’t have the C and Z status bits?
Post scriptum, since “Hacker News” is of the opinion that I’m posting too fast:
MIPS does have a status register, and this register does have an overflow bit:
https://www.doc.ic.ac.uk/lab/secondyear/spim/node10.html