Age | Commit message (Collapse) | Author |
|
957f89ce4abb6ad added some tweaks for serenity-on-aarch64.
It broke anythingelse-on-aarch64 hosts though, so only do these tweaks
when targeting serenity.
(I wonder if AK/Math.h should fall back to the system math routines
when not targeting serenity in general. Would probably help ladybird
performance. On the other hand, the serenity routines would see less
use and hence exposure and love.)
|
|
The {sin,cos,tan} functions in AK are used as the implementation of the
same function in libm. We cannot use the __builtin_foo functions as
these would just call the libc functions. This was causing an infinite
loop. Fix this by adding a very naive implementation of
AK::{sin, cos,tan}, that is only valid for small inputs. For the other
functions in this file, I added a TODO() such that we'll crash, instead
of infinite looping.
|
|
|
|
Without i686 we can remove some implementations for sqrt and round_to.
|
|
|
|
This patch adds the `USING_AK_GLOBALLY` macro which is enabled by
default, but can be overridden by build flags.
This is a step towards integrating Jakt and AK types.
|
|
|
|
These were incorrectly assumed to compile, but did indeed still have
a few issues.
|
|
These all require just a single instruction each, we only have to
differentiate between register prefixes accordingly.
|
|
Co-authored-by: Leon Albrecht <leon2002.la@gmail.com>
|
|
|
|
This fixes the lagom build on aarch64, as `__builtin_sincosf` doesn't
take double arguments.
|
|
This fixes the build on M1 Macs.
|
|
|
|
This uses the `fistp` and `cvts[sd]2si` respectively, to potentially
round floating point values with just one instruction.
This falls back to `llrint[fl]?` on aarch64 for now.
|
|
|
|
|
|
|
|
Calculating sin and cos at once is quite a bit cheaper than calculating
them individually.
x87 has even a dedicated instruction for it: `fsincos`.
|
|
This allows Lagom to be built successfully for Apple M1.
Fixes #12644.
|
|
|
|
For a `N` bit integer X, the log2 calculation should be as follows:
(N - 1) - ctz(X)
|
|
In order to reduce our reliance on __builtin_{ffs, clz, ctz, popcount},
this commit removes all calls to these functions and replaces them with
the equivalent functions in AK/BuiltinWrappers.h.
|
|
This is a naive implementation based on the symmetry with `asin`.
Before, I'm not really sure what we were doing, but it was returning
wildly incorrect results.
|
|
On x86, the `fprem` and `fmprem1` instructions may produce a 'partial
remainder', for which we should check by reading a FPU flag. If we don't
check for it, we may end up using values that are outside the expected
range of values.
|
|
This is to implement constexpr template based implementations for
mathematical functions
This also changes math.cpp to use these implementations.
Also adds a fastpath for floating point trucation for values smaller
than the signed 64 bit limit.
|