From 5aeb377bd4500707fc66c8f5ebae03c8489893a8 Mon Sep 17 00:00:00 2001 From: Sergey Pokhodenko Date: Thu, 5 Nov 2020 19:49:03 +0300 Subject: [PATCH] Remove unary_sqrt_extern() used for sqrt_impl This possibly could be a function required to move to upstream but also it could be a not intended function. This function was created in b4a325d59 by @DrTodd13. Then there was a long branch dedicated to PVC and in 947b40788 it was merged with master of Numba bu @reazul.hoque. It was released in 0.49.1+dppy0.4.0. --- numba/cpython/mathimpl.py | 42 +-------------------------------------- 1 file changed, 1 insertion(+), 41 deletions(-) diff --git a/numba/cpython/mathimpl.py b/numba/cpython/mathimpl.py index 9189f5f8aad..e79d7cf3956 100644 --- a/numba/cpython/mathimpl.py +++ b/numba/cpython/mathimpl.py @@ -171,45 +171,6 @@ def float_impl(context, builder, sig, args): return float_impl -def unary_sqrt_extern(fn, int_restype=False): - """ - Register implementations of Python function *fn* using the - external function named *f32extern* and *f64extern* (for float32 - and float64 inputs, respectively). - If *int_restype* is true, then the function's return value should be - integral, otherwise floating-point. - """ - f_restype = types.int64 if int_restype else None - - def float_impl(context, builder, sig, args): - """ - Implement *fn* for a types.Float input. - """ - [val] = args - mod = builder.module - input_type = sig.args[0] - lty = context.get_value_type(input_type) - sqrt32extern = getattr(context, 'sqrt32extern', "sqrtf") - sqrt64extern = getattr(context, 'sqrt64extern', "sqrt") - - func_name = { - types.float32: sqrt32extern, - types.float64: sqrt64extern, - }[input_type] - fnty = Type.function(lty, [lty]) - fn = cgutils.insert_pure_function(builder.module, fnty, name=func_name) - res = builder.call(fn, (val,)) - res = context.cast(builder, res, input_type, sig.return_type) - return impl_ret_untracked(context, builder, sig.return_type, res) - - lower(fn, types.Float)(float_impl) - - # Implement wrapper for integer inputs - unary_math_int_impl(fn, float_impl) - - return float_impl - - unary_math_intr(math.fabs, lc.INTR_FABS) #unary_math_intr(math.sqrt, lc.INTR_SQRT) @@ -244,8 +205,7 @@ def float_impl(context, builder, sig, args): floor_impl = unary_math_extern(math.floor, "floorf", "floor", True) gamma_impl = unary_math_extern(math.gamma, "numba_gammaf", "numba_gamma") # work-around -sqrt_impl = unary_sqrt_extern(math.sqrt) -#sqrt_impl = unary_math_extern(math.sqrt, "sqrtf", "sqrt") +sqrt_impl = unary_math_extern(math.sqrt, "sqrtf", "sqrt") trunc_impl = unary_math_extern(math.trunc, "truncf", "trunc", True) lgamma_impl = unary_math_extern(math.lgamma, "lgammaf", "lgamma")