[LLVMdev] [llvm] r206732 - Implement builtins for safe division: safe.sdiv.iN, safe.udiv.iN, safe.srem.iN,
Philip Reames
listmail at philipreames.com
Fri Apr 25 17:13:43 PDT 2014
On 04/25/2014 04:49 PM, Eric Christopher wrote:
>> You keep mentioning undefined behaviour in C++. I'm not compiling C++. Why
>> is this relevant?
>>
> This is actually my point. Everyone wants different semantics (see the
> Go link I mentioned earlier) and so a huge "meta operation" node is
> exactly the thing we don't want. It'll fit your needs, maybe
> javascript (maybe not), but is not generally useful.
>
> -eric
Just to point out, the Go semantics seem to be quite similar to the Java
semantics I posted earlier. They are not the ones originally proposed
in this thread, but the modified version I suggested in my original
response would handle them as well.
(res, status) = safe.div(x,y, on_overflow_constant, on_divzero_constant)
For anyone else who lost the link like I did:
http://golang.org/ref/spec#Arithmetic_operators
Philip
More information about the llvm-dev
mailing list