[cfe-dev] [RFC] Introduce overflow builtins

Joerg Sonnenberger joerg at britannica.bec.de
Thu Mar 22 22:48:19 PDT 2012


On Thu, Mar 22, 2012 at 05:41:18PM -0700, Eli Friedman wrote:
> Assuming the point of these builtins is primarily performance of
> library implementations (since most projects would need some sort of
> fallback for compilers which don't provide this builtin), I'm not sure
> it makes sense to have div/rem at all; there isn't any underlying
> llvm.div.with.overflow to map it to...

Signed division can overflow (INT_MIN / -1). There is also the question
of division by 0. It seems natural to consider it as overflow in which
case both div and rem make sense.

Joerg



More information about the cfe-dev mailing list