[commit: ghc] ghc-8.2: PPC NCG: Implement callish prim ops (f6289e7)
git at git.haskell.org
git at git.haskell.org
Sun Apr 30 17:26:14 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : ghc-8.2
Link : http://ghc.haskell.org/trac/ghc/changeset/f6289e72b266620606ca8d92658f429b584ffb61/ghc
>---------------------------------------------------------------
commit f6289e72b266620606ca8d92658f429b584ffb61
Author: Peter Trommler <ptrommler at acm.org>
Date: Tue Apr 25 18:37:16 2017 -0400
PPC NCG: Implement callish prim ops
Provide PowerPC optimised implementations of callish prim ops.
MO_?_QuotRem
The generic implementation of quotient remainder prim ops uses
a division and a remainder operation. There is no remainder on
PowerPC and so we need to implement remainder "by hand" which
results in a duplication of the divide operation when using the
generic code.
Avoid this duplication by implementing the prim op in the native
code generator.
MO_U_Mul2
Use PowerPC's instructions for long multiplication.
Addition and subtraction
Use PowerPC add/subtract with carry/overflow instructions
MO_Clz and MO_Ctz
Use PowerPC's CNTLZ instruction and implement count trailing
zeros using count leading zeros
MO_QuotRem2
Implement an algorithm given by Henry Warren in "Hacker's Delight"
using PowerPC divide instruction. TODO: Use long division instructions
when available (POWER7 and later).
Test Plan: validate on AIX and 32-bit Linux
Reviewers: simonmar, erikd, hvr, austin, bgamari
Reviewed By: erikd, hvr, bgamari
Subscribers: trofi, kgardas, thomie
Differential Revision: https://phabricator.haskell.org/D2973
(cherry picked from commit 89a3241f708502e8fbcfaddbbe634790ad9cd02a)
>---------------------------------------------------------------
f6289e72b266620606ca8d92658f429b584ffb61
compiler/codeGen/StgCmmPrim.hs | 28 ++-
compiler/nativeGen/PIC.hs | 5 +-
compiler/nativeGen/PPC/CodeGen.hs | 464 ++++++++++++++++++++++++++++++++------
compiler/nativeGen/PPC/Instr.hs | 102 ++++-----
compiler/nativeGen/PPC/Ppr.hs | 196 +++++++++++-----
5 files changed, 611 insertions(+), 184 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 f6289e72b266620606ca8d92658f429b584ffb61
More information about the ghc-commits
mailing list