1 /* 2 * Single-precision SVE sincospi(x, *y, *z) function. 3 * 4 * Copyright (c) 2024, Arm Limited. 5 * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception 6 */ 7 8 #include "sv_math.h" 9 #include "test_defs.h" 10 #include "mathlib.h" 11 #include "sv_sincospif_common.h" 12 13 /* Single-precision vector function allowing calculation of both sinpi and 14 cospi in one function call, using shared argument reduction and polynomials. 15 Worst-case error for sin is 3.04 ULP: 16 _ZGVsMxvl4l4_sincospif_sin(0x1.b51b8p-2) got 0x1.f28b5ep-1 want 17 0x1.f28b58p-1. 18 Worst-case error for cos is 3.18 ULP: 19 _ZGVsMxvl4l4_sincospif_cos(0x1.d341a8p-5) got 0x1.f7cd56p-1 want 20 0x1.f7cd5p-1. */ 21 void 22 _ZGVsMxvl4l4_sincospif (svfloat32_t x, float *out_sin, float *out_cos, 23 svbool_t pg) 24 { 25 const struct sv_sincospif_data *d = ptr_barrier (&sv_sincospif_data); 26 27 svfloat32x2_t sc = sv_sincospif_inline (pg, x, d); 28 29 svst1 (pg, out_sin, svget2 (sc, 0)); 30 svst1 (pg, out_cos, svget2 (sc, 1)); 31 } 32 33 #if WANT_TRIGPI_TESTS 34 TEST_DISABLE_FENV (_ZGVsMxvl4l4_sincospif_sin) 35 TEST_DISABLE_FENV (_ZGVsMxvl4l4_sincospif_cos) 36 TEST_ULP (_ZGVsMxvl4l4_sincospif_sin, 2.54) 37 TEST_ULP (_ZGVsMxvl4l4_sincospif_cos, 2.68) 38 # define SV_SINCOSPIF_INTERVAL(lo, hi, n) \ 39 TEST_SYM_INTERVAL (_ZGVsMxvl4l4_sincospif_sin, lo, hi, n) \ 40 TEST_SYM_INTERVAL (_ZGVsMxvl4l4_sincospif_cos, lo, hi, n) 41 SV_SINCOSPIF_INTERVAL (0, 0x1p-31, 10000) 42 SV_SINCOSPIF_INTERVAL (0x1p-31, 0.5, 50000) 43 SV_SINCOSPIF_INTERVAL (0.5, 0x1p31, 50000) 44 SV_SINCOSPIF_INTERVAL (0x1p31, inf, 10000) 45 #endif 46 CLOSE_SVE_ATTR 47