def int_truediv_impl(context, builder, sig, args): [va, vb] = args [ta, tb] = sig.args a = context.cast(builder, va, ta, sig.return_type) b = context.cast(builder, vb, tb, sig.return_type) with cgutils.if_zero(builder, b): context.error_model.fp_zero_division(builder, ("division by zero", )) res = builder.fdiv(a, b) return impl_ret_untracked(context, builder, sig.return_type, res)
def maybe_fast_truediv(context, builder, sig, args): if context.fastmath: sig = typing.signature(float32, float32, float32) impl = context.get_function(libdevice.fast_fdividef, sig) return impl(builder, args) else: with cgutils.if_zero(builder, args[1]): context.error_model.fp_zero_division(builder, ("division by zero",)) res = builder.fdiv(*args) return res
def real_div_impl(context, builder, sig, args): with cgutils.if_zero(builder, args[1]): context.error_model.fp_zero_division(builder, ("division by zero", )) res = builder.fdiv(*args) return impl_ret_untracked(context, builder, sig.return_type, res)