[Git][ghc/ghc][wip/T23576] Add bitwise operations
Jaro Reinders (@Noughtmare)
gitlab at gitlab.haskell.org
Fri Jun 30 15:30:51 UTC 2023
Jaro Reinders pushed to branch wip/T23576 at Glasgow Haskell Compiler / GHC
Commits:
6d371000 by Jaro Reinders at 2023-06-30T17:30:46+02:00
Add bitwise operations
- - - - -
1 changed file:
- compiler/GHC/CmmToAsm/X86/CodeGen.hs
Changes:
=====================================
compiler/GHC/CmmToAsm/X86/CodeGen.hs
=====================================
@@ -705,6 +705,60 @@ iselExpr64 (CmmMachOp (MO_U_Shr _) [e1,e2]) = do
]
return (RegCode64 code rhi rlo)
+iselExpr64 (CmmMachOp (MO_And _) [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 rlo),
+ MOV II32 (OpReg r1hi) (OpReg rhi),
+ AND II32 (OpReg r2lo) (OpReg rlo),
+ AND II32 (OpReg r2hi) (OpReg rhi)
+ ]
+ return (RegCode64 code rhi rlo)
+
+iselExpr64 (CmmMachOp (MO_Or _) [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 rlo),
+ MOV II32 (OpReg r1hi) (OpReg rhi),
+ OR II32 (OpReg r2lo) (OpReg rlo),
+ OR II32 (OpReg r2hi) (OpReg rhi)
+ ]
+ return (RegCode64 code rhi rlo)
+
+iselExpr64 (CmmMachOp (MO_Xor _) [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 rlo),
+ MOV II32 (OpReg r1hi) (OpReg rhi),
+ XOR II32 (OpReg r2lo) (OpReg rlo),
+ XOR II32 (OpReg r2hi) (OpReg rhi)
+ ]
+ return (RegCode64 code rhi rlo)
+
+iselExpr64 (CmmMachOp (MO_Not _) [e1]) = do
+ RegCode64 code1 r1hi r1lo <- iselExpr64 e1
+ Reg64 rhi rlo <- getNewReg64
+ let
+ code = code1 `appOL`
+ toOL [ MOV II32 (OpReg r1lo) (OpReg rlo),
+ MOV II32 (OpReg r1hi) (OpReg rhi),
+ NOT II32 (OpReg rlo),
+ NOT II32 (OpReg rhi)
+ ]
+ return (RegCode64 code rhi rlo)
+
iselExpr64 expr
= do
platform <- getPlatform
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6d371000c30511957b8a82db26235edea9589c64
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6d371000c30511957b8a82db26235edea9589c64
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/fd558476/attachment-0001.html>
More information about the ghc-commits
mailing list