News for hackers. Stuff that matters.
Re:New integer types I’d like to see by rep_lodsb on Friday September 30, 2022 @12:41PM (#33037144)
The only modern architecture which does not have overflow detection is RISC-V.
Re:New integer types I’d like to see by ama5322 on Friday September 30, 2022 @03:53PM (#33039922)
Interesting. Is it a deliberate decision or just an omission?
Re:New integer types I’d like to see by snvzz on Friday September 30, 2022 @05:01PM (#33040734)
Deliberate.

RISC-V architects weighted pros and cons of having a flags register, and pros and cons of having overflow exceptions.

They concluded it is best to not have flags at all (conditional branches do their own testing, and no flag dependencies need to be tracked which simplify superscalar implementations) nor overflow checks (flow breaking and costly; if you need the check, the cost of a software check is minimal, by design).

Re:New integer types I’d like to see by ama5322 on Saturday October 01, 2022 @08:13AM (#33046024)
I understand for overflow exceptions, but I would have expected the cost of a register flag to be zero or near zero, for example, in an integer adder?

It also doesn't look like to me the cost of a software check can always be trivial. It can be for a single operation, but an advantage of an overflow register is that it allows to check for a group of operations as a whole (check/branch just once and abort), which is what is probably practical to do algorithmically. In such scenario switching to software checks for each op and/or bound check the inputs sounds by far not minimal.

Re:New integer types I’d like to see by snvzz on Saturday October 01, 2022 @07:12PM (#33051050)
Flags aren't that simple. In a superscalar microarchitecture, then you have a lot more to track re: who set the flag, as the flag is a target of every instruction that can set it.
Re:New integer types I’d like to see by renox on Saturday October 01, 2022 @07:52AM (#33045902)
Minimal.. It depends! I remember that the developpers behind GMP (a GNU library for bignum) weren't happy with the performance! But that's pretty niche..