diff options
| author | Sebastian Berg <sebastianb@nvidia.com> | 2023-01-06 12:06:49 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-06 12:06:49 +0100 |
| commit | 307477c454e960e0f6805ead4fd545014efd3701 (patch) | |
| tree | a7cecd91adf0cc7176dfb48da5188e75ad86def5 | |
| parent | 890920e7ba611360f60e7a1dca63b6eae99c0a1b (diff) | |
| parent | d5b2ad78a4e47448a332374fde139982dddf2995 (diff) | |
| download | numpy-307477c454e960e0f6805ead4fd545014efd3701.tar.gz | |
Merge pull request #22954 from seiko2plus/issue_22933
BUG, SIMD: Fix spurious invalid exception for sin/cos on arm64/clang
| -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 |
