Path: blob/main/contrib/arm-optimized-routines/math/aarch64/advsimd/cexpi.c
48378 views
/*1* Double-precision vector sincos function - return-by-value interface.2*3* Copyright (c) 2023-2024, Arm Limited.4* SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception5*/67#include "v_sincos_common.h"8#include "v_math.h"9#include "test_defs.h"1011static float64x2x2_t VPCS_ATTR NOINLINE12special_case (float64x2_t x, uint64x2_t special, float64x2x2_t y)13{14return (float64x2x2_t){ v_call_f64 (sin, x, y.val[0], special),15v_call_f64 (cos, x, y.val[1], special) };16}1718/* Double-precision vector function allowing calculation of both sin and cos in19one function call, using shared argument reduction and separate polynomials.20Largest observed error is for sin, 3.22 ULP:21v_sincos_sin (0x1.d70eef40f39b1p+12) got -0x1.ffe9537d5dbb7p-322want -0x1.ffe9537d5dbb4p-3. */23VPCS_ATTR float64x2x2_t24_ZGVnN2v_cexpi (float64x2_t x)25{26const struct v_sincos_data *d = ptr_barrier (&v_sincos_data);27uint64x2_t special = check_ge_rangeval (x, d);2829float64x2x2_t sc = v_sincos_inline (x, d);3031if (unlikely (v_any_u64 (special)))32return special_case (x, special, sc);33return sc;34}3536TEST_DISABLE_FENV (_ZGVnN2v_cexpi_cos)37TEST_DISABLE_FENV (_ZGVnN2v_cexpi_sin)38TEST_ULP (_ZGVnN2v_cexpi_sin, 2.73)39TEST_ULP (_ZGVnN2v_cexpi_cos, 2.73)40#define V_CEXPI_INTERVAL(lo, hi, n) \41TEST_INTERVAL (_ZGVnN2v_cexpi_sin, lo, hi, n) \42TEST_INTERVAL (_ZGVnN2v_cexpi_cos, lo, hi, n)43V_CEXPI_INTERVAL (0, 0x1p23, 500000)44V_CEXPI_INTERVAL (-0, -0x1p23, 500000)45V_CEXPI_INTERVAL (0x1p23, inf, 10000)46V_CEXPI_INTERVAL (-0x1p23, -inf, 10000)474849