[commit: ghc] master: Generate better fp abs for X86 and llvm with default cmm otherwise (12ccf76)
git at git.haskell.org
git at git.haskell.org
Tue Mar 7 18:32:48 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/12ccf767af3373e319b75d5d61fe79df4a389e45/ghc
>---------------------------------------------------------------
commit 12ccf767af3373e319b75d5d61fe79df4a389e45
Author: Dominic Steinitz <dominic at steinitz.org>
Date: Tue Mar 7 09:26:16 2017 -0500
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
>---------------------------------------------------------------
12ccf767af3373e319b75d5d61fe79df4a389e45
compiler/cmm/CmmMachOp.hs | 2 ++
compiler/cmm/PprC.hs | 2 ++
compiler/codeGen/StgCmmPrim.hs | 34 ++++++++++++++++++++++++++
compiler/llvmGen/LlvmCodeGen/CodeGen.hs | 2 ++
compiler/nativeGen/PPC/CodeGen.hs | 2 ++
compiler/nativeGen/SPARC/CodeGen.hs | 2 ++
compiler/nativeGen/X86/CodeGen.hs | 42 +++++++++++++++++++++++++++++----
compiler/nativeGen/X86/Ppr.hs | 2 ++
compiler/prelude/primops.txt.pp | 4 ++++
libraries/base/GHC/Float.hs | 14 +++++------
10 files changed, 94 insertions(+), 12 deletions(-)
Diff suppressed because of size. To see it, use:
git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 12ccf767af3373e319b75d5d61fe79df4a389e45
More information about the ghc-commits
mailing list