[Git][ghc/ghc][wip/T23576] Implement negation

Jaro Reinders (@Noughtmare) gitlab at gitlab.haskell.org
Fri Jun 30 12:30:29 UTC 2023



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


Commits:
43921f63 by Jaro Reinders at 2023-06-30T14:30:23+02:00
Implement negation

- - - - -


1 changed file:

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


Changes:

=====================================
compiler/GHC/CmmToAsm/X86/CodeGen.hs
=====================================
@@ -610,6 +610,17 @@ iselExpr64 (CmmMachOp (MO_SS_Conv W32 W64) [expr]) = do
                           r_dst_hi
                           r_dst_lo
 
+iselExpr64 (CmmMachOp (MO_S_Neg _) [expr]) = do
+   RegCode64 code rhi rlo <- iselExpr64 expr
+   Reg64 rohi rolo <- getNewReg64
+   let
+        ocode = code `appOL`
+                toOL [ MOV II32 (OpReg rlo) (OpReg rolo), 
+                       XOR II32 (OpReg rohi) (OpReg rohi),
+                       NEGI II32 (OpReg rolo),
+                       SBB II32 (OpReg rhi) (OpReg rohi) ]
+   return (RegCode64 ocode rohi rolo)
+
 iselExpr64 expr
    = do
       platform <- getPlatform



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/43921f63e9cfff96b01e2c0bf37f71f114affcd4

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/43921f63e9cfff96b01e2c0bf37f71f114affcd4
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/2bb693b4/attachment-0001.html>


More information about the ghc-commits mailing list