Path: blob/main/contrib/arm-optimized-routines/math/aarch64/sve/expf.c
48378 views
/*1* Single-precision vector e^x function.2*3* Copyright (c) 2019-2024, Arm Limited.4* SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception5*/67#include "sv_math.h"8#include "test_sig.h"9#include "test_defs.h"10#include "sv_expf_inline.h"1112/* Roughly 87.3. For x < -Thres, the result is subnormal and not handled13correctly by FEXPA. */14#define Thres 0x1.5d5e2ap+6f1516static const struct data17{18struct sv_expf_data d;19float thres;20} data = {21.d = SV_EXPF_DATA,22.thres = Thres,23};2425static svfloat32_t NOINLINE26special_case (svfloat32_t x, svbool_t special, const struct sv_expf_data *d)27{28return sv_call_f32 (expf, x, expf_inline (x, svptrue_b32 (), d), special);29}3031/* Optimised single-precision SVE exp function.32Worst-case error is 1.04 ulp:33SV_NAME_F1 (exp)(0x1.a8eda4p+1) got 0x1.ba74bcp+434want 0x1.ba74bap+4. */35svfloat32_t SV_NAME_F1 (exp) (svfloat32_t x, const svbool_t pg)36{37const struct data *d = ptr_barrier (&data);38svbool_t is_special_case = svacgt (pg, x, d->thres);39if (unlikely (svptest_any (pg, is_special_case)))40return special_case (x, is_special_case, &d->d);41return expf_inline (x, pg, &d->d);42}4344TEST_SIG (SV, F, 1, exp, -9.9, 9.9)45TEST_ULP (SV_NAME_F1 (exp), 0.55)46TEST_DISABLE_FENV (SV_NAME_F1 (exp))47TEST_SYM_INTERVAL (SV_NAME_F1 (exp), 0, Thres, 50000)48TEST_SYM_INTERVAL (SV_NAME_F1 (exp), Thres, inf, 50000)49CLOSE_SVE_ATTR505152