mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
AK: Add an SSE2 specific implementation of sqrt(double)
This commit is contained in:
parent
6c41267dcf
commit
d4fe02152a
Notes:
sideshowbarker
2024-07-17 11:11:37 +09:00
Author: https://github.com/Hendiadyoin1 Commit: https://github.com/SerenityOS/serenity/commit/d4fe02152a Pull-request: https://github.com/SerenityOS/serenity/pull/13573 Reviewed-by: https://github.com/awesomekling Reviewed-by: https://github.com/gmta Reviewed-by: https://github.com/kleinesfilmroellchen ✅ Reviewed-by: https://github.com/timschumi
1 changed files with 15 additions and 0 deletions
15
AK/Math.h
15
AK/Math.h
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue