diff options
| author | Sebastian Graf <sebastian.graf@kit.edu> | 2018-05-05 13:30:32 -0400 |
|---|---|---|
| committer | Ben Gamari <ben@smart-cactus.org> | 2018-05-05 17:06:35 -0400 |
| commit | 6243bba73d14cbee4219a16d45f57d1b254a6456 (patch) | |
| tree | 56c4528dd27b7c0634ef3707adb0a47771f62011 /compiler/nativeGen/PPC | |
| parent | 418881f7181cbfa31c44f0794db65bf00916bde2 (diff) | |
| download | haskell-6243bba73d14cbee4219a16d45f57d1b254a6456.tar.gz | |
Add 'addWordC#' PrimOp
This is mostly for congruence with 'subWordC#' and '{add,sub}IntC#'.
I found 'plusWord2#' while implementing this, which both lacks
documentation and has a slightly different specification than
'addWordC#', which means the generic implementation is unnecessarily
complex.
While I was at it, I also added lacking meta-information on PrimOps
and refactored 'subWordC#'s generic implementation to be branchless.
Reviewers: bgamari, simonmar, jrtc27, dfeuer
Reviewed By: bgamari, dfeuer
Subscribers: dfeuer, thomie, carter
Differential Revision: https://phabricator.haskell.org/D4592
Diffstat (limited to 'compiler/nativeGen/PPC')
| -rw-r--r-- | compiler/nativeGen/PPC/CodeGen.hs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/nativeGen/PPC/CodeGen.hs b/compiler/nativeGen/PPC/CodeGen.hs index 7c345f2328..e53d994c25 100644 --- a/compiler/nativeGen/PPC/CodeGen.hs +++ b/compiler/nativeGen/PPC/CodeGen.hs @@ -1333,6 +1333,7 @@ genCCall target dest_regs argsAndHints PrimTarget (MO_U_Mul2 width) -> multOp2 platform width dest_regs argsAndHints PrimTarget (MO_Add2 _) -> add2Op platform dest_regs argsAndHints + PrimTarget (MO_AddWordC _) -> addcOp platform dest_regs argsAndHints PrimTarget (MO_SubWordC _) -> subcOp platform dest_regs argsAndHints PrimTarget (MO_AddIntC width) -> addSubCOp ADDO platform width dest_regs argsAndHints @@ -1523,6 +1524,11 @@ genCCall target dest_regs argsAndHints add2Op _ _ _ = panic "genCCall: Wrong number of arguments/results for add2" + addcOp platform [res_r, res_c] [arg_x, arg_y] + = add2Op platform [res_c {-hi-}, res_r {-lo-}] [arg_x, arg_y] + addcOp _ _ _ + = panic "genCCall: Wrong number of arguments/results for addc" + -- PowerPC subfc sets the carry for rT = ~(rA) + rB + 1, -- which is 0 for borrow and 1 otherwise. We need 1 and 0 -- so xor with 1. @@ -2025,6 +2031,7 @@ genCCall' dflags gcp target dest_regs args MO_U_QuotRem {} -> unsupported MO_U_QuotRem2 {} -> unsupported MO_Add2 {} -> unsupported + MO_AddWordC {} -> unsupported MO_SubWordC {} -> unsupported MO_AddIntC {} -> unsupported MO_SubIntC {} -> unsupported |
