diff options
| author | Sayed Adel <seiko@imavr.com> | 2023-01-06 08:54:20 +0200 |
|---|---|---|
| committer | Sayed Adel <seiko@imavr.com> | 2023-01-06 08:54:20 +0200 |
| commit | d5b2ad78a4e47448a332374fde139982dddf2995 (patch) | |
| tree | 82b2581fe97fd8f3af21722d92750de3fd44134d /numpy | |
| parent | bdead0e1dae4f5ffbdb3db4d258a5d4b1f314580 (diff) | |
| download | numpy-d5b2ad78a4e47448a332374fde139982dddf2995.tar.gz | |
BUG, SIMD: Fix spurious invalid exception for sin/cos on arm64/clang
Diffstat (limited to 'numpy')
| -rw-r--r-- | numpy/core/src/common/simd/neon/operators.h | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/numpy/core/src/common/simd/neon/operators.h b/numpy/core/src/common/simd/neon/operators.h index 249621bd6..c7f5d2018 100644 --- a/numpy/core/src/common/simd/neon/operators.h +++ b/numpy/core/src/common/simd/neon/operators.h @@ -240,10 +240,35 @@ // check special cases NPY_FINLINE npyv_b32 npyv_notnan_f32(npyv_f32 a) -{ return vceqq_f32(a, a); } +{ +#if defined(__clang__) +/** + * To avoid signaling qNaN, workaround for clang symmetric inputs bug + * check https://github.com/numpy/numpy/issues/22933, + * for more clarification. + */ + npyv_b32 ret; + #if NPY_SIMD_F64 + asm ("fcmeq %0.4s, %1.4s, %1.4s" : "=w" (ret) : "w" (a)); + #else + asm ("vceq.f32 %q0, %q1, %q1" : "=w" (ret) : "w" (a)); + #endif + return ret; +#else + return vceqq_f32(a, a); +#endif +} #if NPY_SIMD_F64 NPY_FINLINE npyv_b64 npyv_notnan_f64(npyv_f64 a) - { return vceqq_f64(a, a); } + { + #if defined(__clang__) + npyv_b64 ret; + asm ("fcmeq %0.2d, %1.2d, %1.2d" : "=w" (ret) : "w" (a)); + return ret; + #else + return vceqq_f64(a, a); + #endif + } #endif // Test cross all vector lanes |
