AK/SIMD: Use __builtin_elementwise_sqrt when available

This was motivated by Clang removing `__builtin_ia32_sqrtps` for the
22.1.0 release:
https://github.com/llvm/llvm-project/pull/165682

This should also allow vectorized square root on non-x86 systems when
using Clang.
This commit is contained in:
Lucas Chollet
2026-01-21 22:14:00 +01:00
parent 7791306bf4
commit 60d92b3c3d

View File

@@ -84,7 +84,9 @@ ALWAYS_INLINE static f32x4 exp_approximate(f32x4 v)
ALWAYS_INLINE static f32x4 sqrt(f32x4 v)
{
#if ARCH(X86_64)
#if __has_builtin(__builtin_elementwise_sqrt)
return __builtin_elementwise_sqrt(v);
#elif __has_builtin(__builtin_ia32_sqrtps)
return __builtin_ia32_sqrtps(v);
#else
return f32x4 {