diff options
author | sheaf <sam.derbyshire@gmail.com> | 2023-04-08 13:42:58 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2023-05-11 11:55:22 -0400 |
commit | 87eebf98cb485f7c9175330051736e147ade9848 (patch) | |
tree | ffa226b3fefa8b0a03e1798fa4f55affbddf654b /rts | |
parent | 630b1fea1e41a1e00860a30742b6ab8ade8a0de0 (diff) | |
download | haskell-87eebf98cb485f7c9175330051736e147ade9848.tar.gz |
Add fused multiply-add instructions
This patch adds eight new primops that fuse a multiplication and an
addition or subtraction:
- `{fmadd,fmsub,fnmadd,fnmsub}{Float,Double}#`
fmadd x y z is x * y + z, computed with a single rounding step.
This patch implements code generation for these primops in the following
backends:
- X86, AArch64 and PowerPC NCG,
- LLVM
- C
WASM uses the C implementation. The primops are unsupported in the
JavaScript backend.
The following constant folding rules are also provided:
- compute a * b + c when a, b, c are all literals,
- x * y + 0 ==> x * y,
- ±1 * y + z ==> z ± y and x * ±1 + z ==> z ± x.
NB: the constant folding rules incorrectly handle signed zero.
This is a known limitation with GHC's floating-point constant folding
rules (#21227), which we hope to resolve in the future.
Diffstat (limited to 'rts')
-rw-r--r-- | rts/RtsSymbols.c | 1 | ||||
-rw-r--r-- | rts/StgPrimFloat.c | 1 |
2 files changed, 0 insertions, 2 deletions
diff --git a/rts/RtsSymbols.c b/rts/RtsSymbols.c index dee6c57f5e..d5ed5bb543 100644 --- a/rts/RtsSymbols.c +++ b/rts/RtsSymbols.c @@ -930,7 +930,6 @@ extern char **environ; RTS_USER_SIGNALS_SYMBOLS \ RTS_INTCHAR_SYMBOLS - // 64-bit support functions in libgcc.a #if defined(__GNUC__) && SIZEOF_VOID_P <= 4 && !defined(_ABIN32) #define RTS_LIBGCC_SYMBOLS \ diff --git a/rts/StgPrimFloat.c b/rts/StgPrimFloat.c index a8c266ae78..d105a0d76b 100644 --- a/rts/StgPrimFloat.c +++ b/rts/StgPrimFloat.c @@ -248,4 +248,3 @@ __decodeFloat_Int (I_ *man, I_ *exp, StgFloat flt) *man = - *man; } } - |