diff options
author | Hendiadyoin1 <leon.a@serenityos.org> | 2022-04-08 17:13:11 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-05-07 20:27:05 +0200 |
commit | d4fe02152a55601be285f8e9acef04c28bb5444b (patch) | |
tree | ea70633f4bf32355ae9d3f1fced363ea09ffe5e7 /AK | |
parent | 6c41267dcfdcf5cb01aa2397bca25aa9e2ea8926 (diff) | |
download | serenity-d4fe02152a55601be285f8e9acef04c28bb5444b.zip |
AK: Add an SSE2 specific implementation of sqrt(double)
Diffstat (limited to 'AK')
-rw-r--r-- | AK/Math.h | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -130,6 +130,21 @@ constexpr float sqrt(float x) return res; } +# ifdef __SSE2__ +template<> +constexpr double sqrt(double x) +{ + if (is_constant_evaluated()) + return __builtin_sqrt(x); + + double res; + asm("sqrtsd %1, %0" + : "=x"(res) + : "x"(x)); + return res; +} +# endif + template<> constexpr float rsqrt(float x) { |