[Git][ghc/ghc][wip/T23576] Add MO_UU_Conv W64 W8

Jaro Reinders (@Noughtmare) gitlab at gitlab.haskell.org
Mon Jul 3 14:29:12 UTC 2023



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


Commits:
f9b02af6 by Jaro Reinders at 2023-07-03T16:29:03+02:00
Add MO_UU_Conv W64 W8

- - - - -


1 changed file:

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


Changes:

=====================================
compiler/GHC/CmmToAsm/X86/CodeGen.hs
=====================================
@@ -837,6 +837,11 @@ getRegister' _ is32Bit (CmmMachOp (MO_SS_Conv W64 W32) [x])
   RegCode64 code _rhi rlo <- iselExpr64 x
   return $ Fixed II32 rlo code
 
+getRegister' _ is32Bit (CmmMachOp (MO_UU_Conv W64 W8) [x])
+ | is32Bit = do
+  RegCode64 code _rhi rlo <- iselExpr64 x
+  return $ Fixed II8 rlo code
+
 getRegister' _ _ (CmmLit lit@(CmmFloat f w)) =
   float_const_sse2  where
   float_const_sse2
@@ -1503,6 +1508,7 @@ getAmode e = do
       CmmLit lit
          | is32BitLit platform lit
          -> return (Amode (ImmAddr (litToImm lit) 0) nilOL)
+
       -- Literal with offsets too big (> 32 bits) fails during the linking phase
       -- (#15570). We already handled valid literals above so we don't have to
       -- test anything here.
@@ -1890,8 +1896,25 @@ condIntCode' platform cond x y = do
 --------------------------------------------------------------------------------
 condFltCode :: Cond -> CmmExpr -> CmmExpr -> NatM CondCode
 
-condFltCode cond x y
-  =  condFltCode_sse2
+-- Larger-than-native (64-bit ops on 32-bit platforms)
+condFltCode cond x y = do
+  platform <- getPlatform
+  if target32Bit platform && isFloat64 (cmmExprType platform x)
+  then panic "condFLtCode 64-bit on 32-bit platform"
+--     RegCode64 code1 r1hi r1lo <- iselExpr64 x
+--     RegCode64 code2 r2hi r2lo <- iselExpr64 y
+--     tmp <- getNewRegNat II32
+--     let
+--           code = code1 `appOL`
+--                  code2 `appOL`
+--                  toOL [ FLD FF32 (OpReg r2lo) (OpReg tmp),
+--                         FLD FF32 (OpReg tmp) (OpReg r1lo),
+--                         MOV II32 (OpReg r2hi) (OpReg tmp),
+--                         SBB II32 (OpReg r1hi) (OpReg tmp)
+--                       ]
+--                     
+--     return (CondCode False cond code)
+  else condFltCode_sse2
   where
 
 



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f9b02af6340d099b5be8b0985ba1e234b7684bf6
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/20230703/58146a45/attachment-0001.html>


More information about the ghc-commits mailing list