diff options
Diffstat (limited to 'math/v_cos.c')
-rw-r--r-- | math/v_cos.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/math/v_cos.c b/math/v_cos.c index 20ba6bd..4c8787e 100644 --- a/math/v_cos.c +++ b/math/v_cos.c @@ -1,8 +1,8 @@ /* * Double-precision vector cos function. * - * Copyright (c) 2019, Arm Limited. - * SPDX-License-Identifier: MIT + * Copyright (c) 2019-2022, Arm Limited. + * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ #include "mathlib.h" @@ -55,6 +55,14 @@ V_NAME(cos) (v_f64_t x) r = v_as_f64_u64 (v_as_u64_f64 (x) & AbsMask); cmp = v_cond_u64 (v_as_u64_f64 (r) >= v_as_u64_f64 (RangeVal)); +#if WANT_SIMD_EXCEPT + if (unlikely (v_any_u64 (cmp))) + /* If fenv exceptions are to be triggered correctly, set any special lanes + to 1 (which is neutral w.r.t. fenv). These lanes will be fixed by + specialcase later. */ + r = v_sel_f64 (cmp, v_f64 (1.0), r); +#endif + /* n = rint((|x|+pi/2)/pi) - 0.5. */ n = v_fma_f64 (InvPi, r + HalfPi, Shift); odd = v_as_u64_f64 (n) << 63; |