[Git][ghc/ghc][wip/T23576] Fix condIntCode' again

Jaro Reinders (@Noughtmare) gitlab at gitlab.haskell.org
Thu Jul 6 15:02:48 UTC 2023



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


Commits:
37d53159 by Jaro Reinders at 2023-07-06T17:02:41+02:00
Fix condIntCode' again

- - - - -


1 changed file:

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


Changes:

=====================================
compiler/GHC/CmmToAsm/X86/CodeGen.hs
=====================================
@@ -1875,8 +1875,8 @@ condIntCode' platform cond x y
   tmp1 <- getNewRegNat II32
   tmp2 <- getNewRegNat II32
 
-  let cmpCode = intComparison cond r1hi r1lo r2hi r2lo tmp1 tmp2
-  return $ CondCode False cond (code1 `appOL` code2 `appOL` cmpCode)
+  let (cond', cmpCode) = intComparison cond r1hi r1lo r2hi r2lo tmp1 tmp2
+  return $ CondCode False cond' (code1 `appOL` code2 `appOL` cmpCode)
 
   where
     intComparison cond r1_hi r1_lo r2_hi r2_lo tmp1 tmp2 =
@@ -1890,20 +1890,20 @@ condIntCode' platform cond x y
         PARITY  -> panic "impossible"
         NOTPARITY -> panic "impossible"
         -- Special case #1 x == y and x != y
-        EQQ -> cmpExact
-        NE  -> cmpExact
+        EQQ -> (EQQ, cmpExact)
+        NE  -> (NE, cmpExact)
         -- [x >= y]
-        GE  -> cmpG
-        GEU -> cmpG
+        GE  -> (GE, cmpGE)
+        GEU -> (GEU, cmpGE)
         -- [x >  y]
-        GTT -> cmpG
-        GU  -> cmpG
+        GTT -> (LTT, cmpLE)
+        GU  -> (LU, cmpLE)
         -- [x <= y]
-        LE  -> cmpL
-        LEU -> cmpL
+        LE  -> (GE, cmpLE)
+        LEU -> (GEU, cmpLE)
         -- [x <  y]
-        LTT -> cmpL
-        LU  -> cmpL
+        LTT -> (LTT, cmpGE)
+        LU  -> (LU, cmpGE)
       where
         cmpExact :: OrdList Instr
         cmpExact =
@@ -1914,12 +1914,12 @@ condIntCode' platform cond x y
             , XOR II32 (OpReg r2_lo) (OpReg tmp2)
             , OR  II32 (OpReg tmp1)  (OpReg tmp2)
             ]
-        cmpG = toOL
+        cmpGE = toOL
             [ MOV II32 (OpReg r1_hi) (OpReg tmp1)
             , CMP II32 (OpReg r2_lo) (OpReg r1_lo)
             , SBB II32 (OpReg r2_hi) (OpReg tmp1)
             ]
-        cmpL = toOL 
+        cmpLE = toOL 
             [ MOV II32 (OpReg r2_hi) (OpReg tmp1)
             , CMP II32 (OpReg r1_lo) (OpReg r2_lo)
             , SBB II32 (OpReg r1_hi) (OpReg tmp1)



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/37d53159387c09fdb413d479ea646dfb85bcf62f
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/a88d5ce3/attachment-0001.html>


More information about the ghc-commits mailing list