aboutsummaryrefslogtreecommitdiff
path: root/math/v_cos.c
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-07 00:57:30 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-07 00:57:30 +0000
commit0edd6499aaed16bf45de92bb0ad1c729486ce6f4 (patch)
treeb6182e391304fb3a42c51d482dcf671f540f2363 /math/v_cos.c
parentf2e7d2de0fe4c2bddb59992ba401391f38627a1e (diff)
parent172d24a7ae67ee7bae413d5a8618f1b5edc002be (diff)
downloadarm-optimized-routines-0edd6499aaed16bf45de92bb0ad1c729486ce6f4.tar.gz
Change-Id: I8753ae14d61308952964b5f87c7e48044f60727c
Diffstat (limited to 'math/v_cos.c')
-rw-r--r--math/v_cos.c12
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;