diff options
author | Peter Trommler <ptrommler@acm.org> | 2017-05-01 11:17:25 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-05-01 11:17:40 -0400 |
commit | 068af0162a47b1fd7809d056ccc2d80e480d53f5 (patch) | |
tree | 1ad7499a37c7a1997a628af32b38a848483ab6f7 /compiler/nativeGen/PPC/CodeGen.hs | |
parent | 667abf17dced8b4a4cd2dc6a291a6f244ffa031f (diff) | |
download | haskell-068af0162a47b1fd7809d056ccc2d80e480d53f5.tar.gz |
PPC NCG: Lower MO_*_Fabs as PowerPC fabs instruction
In Phab:D3265 we introduced MO_F32_Fabs and MO_F64_Fabs.
This patch improves code generation by generating PowerPC fabs
instructions.
Test Plan: run numeric/should_run/numrun015 or validate
Reviewers: austin, bgamari, hvr, simonmar, erikd
Reviewed By: erikd
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3512
Diffstat (limited to 'compiler/nativeGen/PPC/CodeGen.hs')
-rw-r--r-- | compiler/nativeGen/PPC/CodeGen.hs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/nativeGen/PPC/CodeGen.hs b/compiler/nativeGen/PPC/CodeGen.hs index 1467267842..a1a205bb95 100644 --- a/compiler/nativeGen/PPC/CodeGen.hs +++ b/compiler/nativeGen/PPC/CodeGen.hs @@ -1233,6 +1233,8 @@ genCCall target dest_regs argsAndHints dest_regs argsAndHints PrimTarget (MO_SubIntC width) -> addSubCOp SUBFO platform width dest_regs argsAndHints + PrimTarget MO_F64_Fabs -> fabs platform dest_regs argsAndHints + PrimTarget MO_F32_Fabs -> fabs platform dest_regs argsAndHints _ -> genCCall' dflags (platformToGCP platform) target dest_regs argsAndHints where divOp1 platform signed width [res_q, res_r] [arg_x, arg_y] @@ -1444,6 +1446,12 @@ genCCall target dest_regs argsAndHints ] addSubCOp _ _ _ _ _ = panic "genCall: Wrong number of arguments/results for addC" + fabs platform [res] [arg] + = do let res_r = getRegisterReg platform (CmmLocal res) + (arg_reg, arg_code) <- getSomeReg arg + return $ arg_code `snocOL` FABS res_r arg_reg + fabs _ _ _ + = panic "genCall: Wrong number of arguments/results for fabs" -- TODO: replace 'Int' by an enum such as 'PPC_64ABI' data GenCCallPlatform = GCPLinux | GCPDarwin | GCPLinux64ELF !Int | GCPAIX |