Skip to content
This repository was archived by the owner on Jan 25, 2023. It is now read-only.

Commit 6e54b8f

Browse files
authored
Remove unary_sqrt_extern() used for sqrt_impl (#87)
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 b4a325d by @DrTodd13. Then there was a long branch dedicated to PVC and in 947b407 it was merged with master of Numba bu @reazul.hoque. It was released in 0.49.1+dppy0.4.0.
1 parent c776dce commit 6e54b8f

File tree

1 file changed

+1
-41
lines changed

1 file changed

+1
-41
lines changed

numba/cpython/mathimpl.py

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -171,45 +171,6 @@ def float_impl(context, builder, sig, args):
171171

172172
return float_impl
173173

174-
def unary_sqrt_extern(fn, int_restype=False):
175-
"""
176-
Register implementations of Python function *fn* using the
177-
external function named *f32extern* and *f64extern* (for float32
178-
and float64 inputs, respectively).
179-
If *int_restype* is true, then the function's return value should be
180-
integral, otherwise floating-point.
181-
"""
182-
f_restype = types.int64 if int_restype else None
183-
184-
def float_impl(context, builder, sig, args):
185-
"""
186-
Implement *fn* for a types.Float input.
187-
"""
188-
[val] = args
189-
mod = builder.module
190-
input_type = sig.args[0]
191-
lty = context.get_value_type(input_type)
192-
sqrt32extern = getattr(context, 'sqrt32extern', "sqrtf")
193-
sqrt64extern = getattr(context, 'sqrt64extern', "sqrt")
194-
195-
func_name = {
196-
types.float32: sqrt32extern,
197-
types.float64: sqrt64extern,
198-
}[input_type]
199-
fnty = Type.function(lty, [lty])
200-
fn = cgutils.insert_pure_function(builder.module, fnty, name=func_name)
201-
res = builder.call(fn, (val,))
202-
res = context.cast(builder, res, input_type, sig.return_type)
203-
return impl_ret_untracked(context, builder, sig.return_type, res)
204-
205-
lower(fn, types.Float)(float_impl)
206-
207-
# Implement wrapper for integer inputs
208-
unary_math_int_impl(fn, float_impl)
209-
210-
return float_impl
211-
212-
213174

214175
unary_math_intr(math.fabs, lc.INTR_FABS)
215176
#unary_math_intr(math.sqrt, lc.INTR_SQRT)
@@ -244,8 +205,7 @@ def float_impl(context, builder, sig, args):
244205
floor_impl = unary_math_extern(math.floor, "floorf", "floor", True)
245206

246207
gamma_impl = unary_math_extern(math.gamma, "numba_gammaf", "numba_gamma") # work-around
247-
sqrt_impl = unary_sqrt_extern(math.sqrt)
248-
#sqrt_impl = unary_math_extern(math.sqrt, "sqrtf", "sqrt")
208+
sqrt_impl = unary_math_extern(math.sqrt, "sqrtf", "sqrt")
249209
trunc_impl = unary_math_extern(math.trunc, "truncf", "trunc", True)
250210
lgamma_impl = unary_math_extern(math.lgamma, "lgammaf", "lgamma")
251211

0 commit comments

Comments
 (0)