diff options
author | Ben Gamari <bgamari.foss@gmail.com> | 2015-06-16 20:16:08 +0200 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2015-06-16 20:16:08 +0200 |
commit | 681973c31c614185229bdae4f6b7ab4f6e64753d (patch) | |
tree | 9ef8257217c05f4a05828a04e24199f42e0e2fe0 /compiler/cmm/PprC.hs | |
parent | d20031d4c88b256cdae264cb05d9d850e973d956 (diff) | |
download | haskell-681973c31c614185229bdae4f6b7ab4f6e64753d.tar.gz |
Encode alignment in MO_Memcpy and friends
Summary:
Alignment needs to be a compile-time constant. Previously the code
generators had to jump through hoops to ensure this was the case as the
alignment was passed as a CmmExpr in the arguments list. Now we take
care of this up front.
This fixes #8131.
Authored-by: Reid Barton <rwbarton@gmail.com>
Dusted-off-by: Ben Gamari <ben@smart-cactus.org>
Tests for T8131
Test Plan: Validate
Reviewers: rwbarton, austin
Reviewed By: rwbarton, austin
Subscribers: bgamari, carter, thomie
Differential Revision: https://phabricator.haskell.org/D624
GHC Trac Issues: #8131
Diffstat (limited to 'compiler/cmm/PprC.hs')
-rw-r--r-- | compiler/cmm/PprC.hs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/cmm/PprC.hs b/compiler/cmm/PprC.hs index 92c818242d..3703f0ae1f 100644 --- a/compiler/cmm/PprC.hs +++ b/compiler/cmm/PprC.hs @@ -238,13 +238,13 @@ pprStmt stmt = hargs = zip args arg_hints fn_call - -- The mem primops carry an extra alignment arg, must drop it. + -- The mem primops carry an extra alignment arg. -- We could maybe emit an alignment directive using this info. -- We also need to cast mem primops to prevent conflicts with GCC -- builtins (see bug #5967). - | op `elem` [MO_Memcpy, MO_Memset, MO_Memmove] + | Just _align <- machOpMemcpyishAlign op = (ptext (sLit ";EF_(") <> fn <> char ')' <> semi) $$ - pprForeignCall fn cconv hresults (init hargs) + pprForeignCall fn cconv hresults hargs | otherwise = pprCall fn cconv hresults hargs @@ -745,9 +745,9 @@ pprCallishMachOp_for_C mop MO_F32_Exp -> ptext (sLit "expf") MO_F32_Sqrt -> ptext (sLit "sqrtf") MO_WriteBarrier -> ptext (sLit "write_barrier") - MO_Memcpy -> ptext (sLit "memcpy") - MO_Memset -> ptext (sLit "memset") - MO_Memmove -> ptext (sLit "memmove") + MO_Memcpy _ -> ptext (sLit "memcpy") + MO_Memset _ -> ptext (sLit "memset") + MO_Memmove _ -> ptext (sLit "memmove") (MO_BSwap w) -> ptext (sLit $ bSwapLabel w) (MO_PopCnt w) -> ptext (sLit $ popCntLabel w) (MO_Clz w) -> ptext (sLit $ clzLabel w) |