[commit: ghc] master: SPARC nativeGen: Support for MO_SS_Conv_W32_W64 (5241f29)

git at git.haskell.org git at git.haskell.org
Mon Mar 19 16:39:27 UTC 2018


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/5241f2987b3b0e791bfbe7b31529f5fbc600bdc7/ghc

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

commit 5241f2987b3b0e791bfbe7b31529f5fbc600bdc7
Author: Peter Trommler <ptrommler at acm.org>
Date:   Mon Mar 19 12:02:03 2018 -0400

    SPARC nativeGen: Support for MO_SS_Conv_W32_W64
    
    Support for signed conversion from 32 bit to 64 bit
    integers is required by D4363.
    
    Test Plan: validate (perhaps also on SPARC)
    
    Reviewers: simonmar, bgamari, kgardas, jrtc27
    
    Reviewed By: bgamari
    
    Subscribers: rwbarton, thomie, carter
    
    Differential Revision: https://phabricator.haskell.org/D4489


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

5241f2987b3b0e791bfbe7b31529f5fbc600bdc7
 compiler/nativeGen/SPARC/CodeGen/Gen64.hs | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/compiler/nativeGen/SPARC/CodeGen/Gen64.hs b/compiler/nativeGen/SPARC/CodeGen/Gen64.hs
index 8549fa0..6fa7482 100644
--- a/compiler/nativeGen/SPARC/CodeGen/Gen64.hs
+++ b/compiler/nativeGen/SPARC/CodeGen/Gen64.hs
@@ -193,6 +193,24 @@ iselExpr64 (CmmMachOp (MO_UU_Conv _ W64) [expr])
 
         return  $ ChildCode64 code r_dst_lo
 
+-- only W32 supported for now
+iselExpr64 (CmmMachOp (MO_SS_Conv W32 W64) [expr])
+ = do
+        r_dst_lo        <- getNewRegNat II32
+        let r_dst_hi    = getHiVRegFromLo r_dst_lo
+
+        -- compute expr and load it into r_dst_lo
+        (a_reg, a_code) <- getSomeReg expr
+
+        dflags          <- getDynFlags
+        let platform    = targetPlatform dflags
+            code        = a_code
+                `appOL` toOL
+                        [ SRA a_reg (RIImm (ImmInt 31)) r_dst_hi
+                        , mkRegRegMoveInstr platform a_reg r_dst_lo ]
+
+        return  $ ChildCode64 code r_dst_lo
+
 
 iselExpr64 expr
    = pprPanic "iselExpr64(sparc)" (ppr expr)



More information about the ghc-commits mailing list