diff options
author | Dominic Steinitz <dominic@steinitz.org> | 2017-03-07 09:26:16 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-03-07 13:32:33 -0500 |
commit | 12ccf767af3373e319b75d5d61fe79df4a389e45 (patch) | |
tree | ec4bf27785be88d67617ddddd5968e4c128fb6a1 /compiler/nativeGen/PPC/CodeGen.hs | |
parent | 48759c0ef0e7ce718b52557599ebbb884c19a2ad (diff) | |
download | haskell-12ccf767af3373e319b75d5d61fe79df4a389e45.tar.gz |
Generate better fp abs for X86 and llvm with default cmm otherwise
Currently we have this in libraries/base/GHC/Float.hs:
```
abs x | x == 0 = 0 -- handles (-0.0)
| x > 0 = x
| otherwise = negateFloat x
```
But 3-4 years ago it was noted that this was inefficient:
https://mail.haskell.org/pipermail/libraries/2013-April/019690.html
We can generate better code for X86 and llvm and for others generate
some custom cmm code which is similar to what the compiler generates
now.
Reviewers: austin, simonmar, hvr, bgamari
Reviewed By: bgamari
Subscribers: dfeuer, thomie
Differential Revision: https://phabricator.haskell.org/D3265
Diffstat (limited to 'compiler/nativeGen/PPC/CodeGen.hs')
-rw-r--r-- | compiler/nativeGen/PPC/CodeGen.hs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/nativeGen/PPC/CodeGen.hs b/compiler/nativeGen/PPC/CodeGen.hs index 849516f229..1f06c7bd3e 100644 --- a/compiler/nativeGen/PPC/CodeGen.hs +++ b/compiler/nativeGen/PPC/CodeGen.hs @@ -1525,6 +1525,7 @@ genCCall' dflags gcp target dest_regs args MO_F32_Exp -> (fsLit "exp", True) MO_F32_Log -> (fsLit "log", True) MO_F32_Sqrt -> (fsLit "sqrt", True) + MO_F32_Fabs -> unsupported MO_F32_Sin -> (fsLit "sin", True) MO_F32_Cos -> (fsLit "cos", True) @@ -1542,6 +1543,7 @@ genCCall' dflags gcp target dest_regs args MO_F64_Exp -> (fsLit "exp", False) MO_F64_Log -> (fsLit "log", False) MO_F64_Sqrt -> (fsLit "sqrt", False) + MO_F64_Fabs -> unsupported MO_F64_Sin -> (fsLit "sin", False) MO_F64_Cos -> (fsLit "cos", False) |