[llvm] r206732 - Implement builtins for safe division: safe.sdiv.iN, safe.udiv.iN, safe.srem.iN,

Andrew Trick atrick at apple.com
Tue Apr 22 18:45:59 PDT 2014


On Apr 22, 2014, at 8:19 AM, Eric Christopher <echristo at gmail.com> wrote:

>> One of Michael’s early implementations worked completely within the SelectionDAG. We could share that patch if it’s interesting. The goal was to mimic the rest of the llvm.arith.with.overflow intrinsics, including lowering them through the same codegen mechanism.
>> 
> 
> Right. Those are needed for correct behavior. This is not so it
> doesn't seem like a good analogy here.

I think the new division intrinsics are needed for correct behavior, as much as the other overflow intrinsics are. The only difference I can see is that architectures typically support reporting overflow on integer add/mul in the form of flags. Whereas with division we need to emit some code to do the checks.

-Andy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140422/6e8d336d/attachment.html>


More information about the llvm-commits mailing list