[Git][ghc/ghc][wip/T23576] Fix MO_SS_Conv W8/16 W64 again again again

Jaro Reinders (@Noughtmare) gitlab at gitlab.haskell.org
Thu Jul 6 08:55:23 UTC 2023



Jaro Reinders pushed to branch wip/T23576 at Glasgow Haskell Compiler / GHC


Commits:
99ca7699 by Jaro Reinders at 2023-07-06T10:55:16+02:00
Fix MO_SS_Conv W8/16 W64 again again again

- - - - -


1 changed file:

- compiler/GHC/CmmToAsm/X86/CodeGen.hs


Changes:

=====================================
compiler/GHC/CmmToAsm/X86/CodeGen.hs
=====================================
@@ -599,11 +599,21 @@ iselExpr64 (CmmMachOp (MO_UU_Conv W32 W64) [expr]) = do
                           r_dst_hi
                           r_dst_lo
 
-iselExpr64 (CmmMachOp (MO_UU_Conv w W64) [expr]) | w == W8 || w == W16 = do
+iselExpr64 (CmmMachOp (MO_UU_Conv W16 W64) [expr]) = do
      (rsrc, code) <- getByteReg expr
      Reg64 r_dst_hi r_dst_lo <- getNewReg64
      return $ RegCode64 (code `appOL` toOL [
-                          MOVZxL II32 (OpReg rsrc) (OpReg r_dst_lo),
+                          MOVZxL II16 (OpReg rsrc) (OpReg r_dst_lo),
+                          MOV    II32 (OpImm (ImmInt 0)) (OpReg r_dst_hi)
+                          ])
+                          r_dst_hi
+                          r_dst_lo
+
+iselExpr64 (CmmMachOp (MO_UU_Conv W8 W64) [expr]) = do
+     (rsrc, code) <- getByteReg expr
+     Reg64 r_dst_hi r_dst_lo <- getNewReg64
+     return $ RegCode64 (code `appOL` toOL [
+                          MOVZxL II8 (OpReg rsrc) (OpReg r_dst_lo),
                           MOV    II32 (OpImm (ImmInt 0)) (OpReg r_dst_hi)
                           ])
                           r_dst_hi
@@ -624,7 +634,7 @@ iselExpr64 (CmmMachOp (MO_SS_Conv W16 W64) [expr]) = do
      (r, code) <- getByteReg expr
      Reg64 r_dst_hi r_dst_lo <- getNewReg64
      return $ RegCode64 (code `appOL` toOL [
-                          MOVSxL II32 (OpReg r) (OpReg eax),
+                          MOVSxL II16 (OpReg r) (OpReg eax),
                           CLTD II32,
                           MOV II32 (OpReg eax) (OpReg r_dst_lo),
                           MOV II32 (OpReg edx) (OpReg r_dst_hi)])
@@ -635,7 +645,7 @@ iselExpr64 (CmmMachOp (MO_SS_Conv W8 W64) [expr]) = do
      (r, code) <- getByteReg expr
      Reg64 r_dst_hi r_dst_lo <- getNewReg64
      return $ RegCode64 (code `appOL` toOL [
-                          MOVSxL II32 (OpReg r) (OpReg eax),
+                          MOVSxL II8 (OpReg r) (OpReg eax),
                           CLTD II32,
                           MOV II32 (OpReg eax) (OpReg r_dst_lo),
                           MOV II32 (OpReg edx) (OpReg r_dst_hi)])



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/99ca7699f84350e07627c9806054985426c00ea6

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/99ca7699f84350e07627c9806054985426c00ea6
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230706/e10471fc/attachment-0001.html>


More information about the ghc-commits mailing list