[LLVMdev] Integer divide by zero

Joe Groff arcata at gmail.com
Sat Apr 6 06:35:14 PDT 2013


On Saturday, April 6, 2013, Cameron McInally wrote:

> All kidding aside, an instruction is an instruction. We have the
> functionality in hardware for free; it would be a shame not to use it. I
> should also mention that for our team, performance is job #1. Extra
> instructions, however insignificant, don't go over well without solid
> justification.
>

A compromise might be to add an llvm.div.or.trap intrinsic, similar to the
llvm.add.with.overflow intrinsics used to implement
Clang's optional integer overflow checks, which could be emitted
efficiently on x86 or other platforms where division by zero or INT_MAX/-1
traps natively.

-Joe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130406/aae52318/attachment.html>


More information about the llvm-dev mailing list