[commit: ghc] master: UNREG: PprC: add support for of W16 literals (Ticket #15237) (01c9d95)

git at git.haskell.org git at git.haskell.org
Fri Jun 15 08:10:34 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/01c9d95aca12caf5c954320a2a82335b32568554/ghc

>---------------------------------------------------------------

commit 01c9d95aca12caf5c954320a2a82335b32568554
Author: Sergei Trofimovich <slyfox at gentoo.org>
Date:   Thu Jun 14 23:13:16 2018 +0100

    UNREG: PprC: add support for of W16 literals (Ticket #15237)
    
    Fix UNREG build failure for 32-bit targets.
    
    This change is an equivalent of commit
    0238a6c78102d43dae2f56192bd3486e4f9ecf1d
    ("UNREG: PprC: add support for of W32 literals")
    
    The change allows combining two subwords into one word
    on 32-bit targets. Tested on nios2-unknown-linux-gnu.
    
    GHC Trac Issues: #15237
    
    Signed-off-by: Sergei Trofimovich <slyfox at gentoo.org>


>---------------------------------------------------------------

01c9d95aca12caf5c954320a2a82335b32568554
 compiler/cmm/PprC.hs | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/compiler/cmm/PprC.hs b/compiler/cmm/PprC.hs
index e46fff1..8b30bbf 100644
--- a/compiler/cmm/PprC.hs
+++ b/compiler/cmm/PprC.hs
@@ -546,6 +546,14 @@ pprStatics dflags (CmmStaticLit (CmmInt a W32) :
                             rest)
     else pprStatics dflags (CmmStaticLit (CmmInt ((shiftL b 32) .|. a) W64) :
                             rest)
+pprStatics dflags (CmmStaticLit (CmmInt a W16) :
+                   CmmStaticLit (CmmInt b W16) : rest)
+  | wordWidth dflags == W32
+  = if wORDS_BIGENDIAN dflags
+    then pprStatics dflags (CmmStaticLit (CmmInt ((shiftL a 16) .|. b) W32) :
+                            rest)
+    else pprStatics dflags (CmmStaticLit (CmmInt ((shiftL b 16) .|. a) W32) :
+                            rest)
 pprStatics dflags (CmmStaticLit (CmmInt _ w) : _)
   | w /= wordWidth dflags
   = pprPanic "pprStatics: cannot emit a non-word-sized static literal" (ppr w)



More information about the ghc-commits mailing list