[commit: ghc] master: [RFC] nativeGen: Add support for MO_SS_Conv_W32_W64 on i386 (d27336e)

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


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

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

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

commit d27336edcf2667c3c3908694247861beec3fc29b
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Mon Mar 19 12:02:29 2018 -0400

    [RFC] nativeGen: Add support for MO_SS_Conv_W32_W64 on i386
    
    This is required by D4288. However, this only handles i386; we will
    likely also need to do the same for PPC and SPARC, lest they break when
    D4288 is re-merged.
    
    Test Plan: Validate
    
    Reviewers: simonmar
    
    Reviewed By: simonmar
    
    Subscribers: rwbarton, thomie, carter
    
    Differential Revision: https://phabricator.haskell.org/D4362


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

d27336edcf2667c3c3908694247861beec3fc29b
 compiler/nativeGen/X86/CodeGen.hs | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/compiler/nativeGen/X86/CodeGen.hs b/compiler/nativeGen/X86/CodeGen.hs
index 09757e7..a0b0673 100644
--- a/compiler/nativeGen/X86/CodeGen.hs
+++ b/compiler/nativeGen/X86/CodeGen.hs
@@ -468,6 +468,20 @@ iselExpr64 (CmmMachOp (MO_UU_Conv _ W64) [expr]) = do
                           r_dst_lo
             )
 
+iselExpr64 (CmmMachOp (MO_SS_Conv W32 W64) [expr]) = do
+     fn <- getAnyReg expr
+     r_dst_lo <-  getNewRegNat II32
+     let r_dst_hi = getHiVRegFromLo r_dst_lo
+         code = fn r_dst_lo
+     return (
+             ChildCode64 (code `snocOL`
+                          MOV II32 (OpReg r_dst_lo) (OpReg eax) `snocOL`
+                          CLTD II32 `snocOL`
+                          MOV II32 (OpReg eax) (OpReg r_dst_lo) `snocOL`
+                          MOV II32 (OpReg edx) (OpReg r_dst_hi))
+                          r_dst_lo
+            )
+
 iselExpr64 expr
    = pprPanic "iselExpr64(i386)" (ppr expr)
 



More information about the ghc-commits mailing list