[Git][ghc/ghc][wip/T23576] Add MO_Mul case in iselExpr64

Jaro Reinders (@Noughtmare) gitlab at gitlab.haskell.org
Fri Jun 30 13:09:21 UTC 2023



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


Commits:
84f415b4 by Jaro Reinders at 2023-06-30T15:09:14+02:00
Add MO_Mul case in iselExpr64

- - - - -


1 changed file:

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


Changes:

=====================================
compiler/GHC/CmmToAsm/X86/CodeGen.hs
=====================================
@@ -621,6 +621,26 @@ iselExpr64 (CmmMachOp (MO_S_Neg _) [expr]) = do
                        SBB II32 (OpReg rhi) (OpReg rohi) ]
    return (RegCode64 ocode rohi rolo)
 
+iselExpr64 (CmmMachOp (MO_Mul _) [e1,e2]) = do
+   RegCode64 code1 r1hi r1lo <- iselExpr64 e1
+   RegCode64 code2 r2hi r2lo <- iselExpr64 e2
+   Reg64 rhi rlo <- getNewReg64
+   let
+        code =  code1 `appOL`
+                code2 `appOL`
+                toOL [ MOV  II32 (OpReg r1lo) (OpReg eax),
+                       MOV  II32 (OpReg r2lo) (OpReg edx),
+                       MOV  II32 (OpReg r1hi) (OpReg rhi),
+                       IMUL II32 (OpReg edx) (OpReg rhi),
+                       MOV  II32 (OpReg r2hi) (OpReg rlo),
+                       IMUL II32 (OpReg eax) (OpReg rlo),
+                       ADD  II32 (OpReg rlo) (OpReg rhi),
+                       MUL2 II32 (OpReg edx),
+                       ADD  II32 (OpReg edx) (OpReg rhi),
+                       MOV  II32 (OpReg eax) (OpReg rlo)
+                     ]
+   return (RegCode64 code rhi rlo)
+
 iselExpr64 expr
    = do
       platform <- getPlatform



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/84f415b41eb42dd018e5a3fac79352626403b1f1

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/84f415b41eb42dd018e5a3fac79352626403b1f1
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/20230630/a32e47d0/attachment-0001.html>


More information about the ghc-commits mailing list