[Git][ghc/ghc][wip/T23576] Fix blocks

Jaro Reinders (@Noughtmare) gitlab at gitlab.haskell.org
Mon Jul 3 08:21:31 UTC 2023



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


Commits:
1bd292d6 by Jaro Reinders at 2023-07-03T10:21:24+02:00
Fix blocks

- - - - -


1 changed file:

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


Changes:

=====================================
compiler/GHC/CmmToAsm/X86/CodeGen.hs
=====================================
@@ -646,7 +646,8 @@ iselExpr64 (CmmMachOp (MO_Shl _) [e1,e2]) = do
    RegCode64 code1 r1hi r1lo <- iselExpr64 e1
    (r2, code2) <- getSomeReg e2
    Reg64 rhi rlo <- getNewReg64
-   b <- newBlockId
+   lbl1 <- newBlockId
+   lbl2 <- newBlockId
    let
         code =  code1 `appOL`
                 code2 `appOL`
@@ -656,11 +657,13 @@ iselExpr64 (CmmMachOp (MO_Shl _) [e1,e2]) = do
                        SHLD II32 (OpReg ecx) (OpReg rlo) (OpReg rhi),
                        SAL II32 (OpReg ecx) (OpReg rlo),
                        TEST II32 (OpImm (ImmInt 32)) (OpReg ecx),
-                       JXX EQQ b,
+                       JXX EQQ lbl2,
+                       JXX ALWAYS lbl1,
+                       NEWBLOCK lbl1,
                        MOV II32 (OpReg rlo) (OpReg rhi),
                        XOR II32 (OpReg rlo) (OpReg rlo),
-                       JXX ALWAYS b,
-                       NEWBLOCK b
+                       JXX ALWAYS lbl2,
+                       NEWBLOCK lbl2
                      ]
    return (RegCode64 code rhi rlo)
 
@@ -668,7 +671,8 @@ iselExpr64 (CmmMachOp (MO_S_Shr _) [e1,e2]) = do
    RegCode64 code1 r1hi r1lo <- iselExpr64 e1
    (r2, code2) <- getSomeReg e2
    Reg64 rhi rlo <- getNewReg64
-   b <- newBlockId
+   lbl1 <- newBlockId
+   lbl2 <- newBlockId
    let
         code =  code1 `appOL`
                 code2 `appOL`
@@ -678,11 +682,13 @@ iselExpr64 (CmmMachOp (MO_S_Shr _) [e1,e2]) = do
                        SHRD II32 (OpReg ecx) (OpReg rhi) (OpReg rlo),
                        SAR II32 (OpReg ecx) (OpReg rhi),
                        TEST II32 (OpImm (ImmInt 32)) (OpReg ecx),
-                       JXX EQQ b,
+                       JXX EQQ lbl2,
+                       JXX ALWAYS lbl1,
+                       NEWBLOCK lbl1,
                        MOV II32 (OpReg rhi) (OpReg rlo),
                        SAR II32 (OpImm (ImmInt 31)) (OpReg rhi),
-                       JXX ALWAYS b,
-                       NEWBLOCK b
+                       JXX ALWAYS lbl2,
+                       NEWBLOCK lbl2
                      ]
    return (RegCode64 code rhi rlo)
 
@@ -690,7 +696,8 @@ iselExpr64 (CmmMachOp (MO_U_Shr _) [e1,e2]) = do
    RegCode64 code1 r1hi r1lo <- iselExpr64 e1
    (r2, code2) <- getSomeReg e2
    Reg64 rhi rlo <- getNewReg64
-   b <- newBlockId
+   lbl1 <- newBlockId
+   lbl2 <- newBlockId
    let
         code =  code1 `appOL`
                 code2 `appOL`
@@ -700,11 +707,13 @@ iselExpr64 (CmmMachOp (MO_U_Shr _) [e1,e2]) = do
                        SHRD II32 (OpReg ecx) (OpReg rhi) (OpReg rlo),
                        SHR II32 (OpReg ecx) (OpReg rhi),
                        TEST II32 (OpImm (ImmInt 32)) (OpReg ecx),
-                       JXX EQQ b,
+                       JXX EQQ lbl2,
+                       JXX ALWAYS lbl1,
+                       NEWBLOCK lbl1,
                        MOV II32 (OpReg rhi) (OpReg rlo),
                        XOR II32 (OpReg rhi) (OpReg rhi),
-                       JXX ALWAYS b,
-                       NEWBLOCK b
+                       JXX ALWAYS lbl2,
+                       NEWBLOCK lbl2
                      ]
    return (RegCode64 code rhi rlo)
 



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

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


More information about the ghc-commits mailing list