> One thing to note is that surprisingly, compilers have no notion of 
> carry-flag or overflow-flag in their IR,

well, the builtins do: they simply return the result + carry in a tuple: 
<https://llvm.org/docs/LangRef.html#llvm-uadd-with-overflow-intrinsics> which 
is close enough as far as IR goes.

So the point of these functions is really to abstract away all the mess and 
provide functions that return precisely the information needed to implement 
"common" integer stuff based on the language primitives nim offers (which for 
how is limited to 64 bit) - they describe a perfect underlying compiler world 
towards which the underlying optimizers can strive - the focus must thus be to 
accurately and minimally describe constraints, input and outputs so the 
optimizers have the right information to work with.

Even with underlying` ExtInt` support, Nim still needs a library to "expose" it 
- stint could very well be that library and it would use either these 
primitives or C23 etc - even later though will these primitives be needed, ie 
for arbitrary / runtime precision work.

Reply via email to