[Git][ghc/ghc][master] CmmToC: enable 64-bit CallishMachOp on 32-bit targets

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Thu Sep 8 21:50:06 UTC 2022



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
9c4ea90c by Cheng Shao at 2022-09-08T17:49:47-04:00
CmmToC: enable 64-bit CallishMachOp on 32-bit targets

Normally, the unregisterised builds avoid generating 64-bit
CallishMachOp in StgToCmm, so CmmToC doesn't support these. However,
there do exist cases where we'd like to invoke cmmToC for other cmm
inputs which may contain such CallishMachOps, and it's a rather low
effort to add support for these since they only require calling into
existing ghc-prim cbits.

- - - - -


1 changed file:

- compiler/GHC/CmmToC.hs


Changes:

=====================================
compiler/GHC/CmmToC.hs
=====================================
@@ -967,39 +967,37 @@ pprCallishMachOp_for_C mop
         -- Not adding it for now
         (MO_Prefetch_Data _ ) -> unsupported
 
-        MO_I64_ToI   -> dontReach64
-        MO_I64_FromI -> dontReach64
-        MO_W64_ToW   -> dontReach64
-        MO_W64_FromW -> dontReach64
-        MO_x64_Neg   -> dontReach64
-        MO_x64_Add   -> dontReach64
-        MO_x64_Sub   -> dontReach64
-        MO_x64_Mul   -> dontReach64
-        MO_I64_Quot  -> dontReach64
-        MO_I64_Rem   -> dontReach64
-        MO_W64_Quot  -> dontReach64
-        MO_W64_Rem   -> dontReach64
-        MO_x64_And   -> dontReach64
-        MO_x64_Or    -> dontReach64
-        MO_x64_Xor   -> dontReach64
-        MO_x64_Not   -> dontReach64
-        MO_x64_Shl   -> dontReach64
-        MO_I64_Shr   -> dontReach64
-        MO_W64_Shr   -> dontReach64
-        MO_x64_Eq    -> dontReach64
-        MO_x64_Ne    -> dontReach64
-        MO_I64_Ge    -> dontReach64
-        MO_I64_Gt    -> dontReach64
-        MO_I64_Le    -> dontReach64
-        MO_I64_Lt    -> dontReach64
-        MO_W64_Ge    -> dontReach64
-        MO_W64_Gt    -> dontReach64
-        MO_W64_Le    -> dontReach64
-        MO_W64_Lt    -> dontReach64
+        MO_I64_ToI   -> text "hs_int64ToInt"
+        MO_I64_FromI -> text "hs_intToInt64"
+        MO_W64_ToW   -> text "hs_word64ToWord"
+        MO_W64_FromW -> text "hs_wordToWord64"
+        MO_x64_Neg   -> text "hs_neg64"
+        MO_x64_Add   -> text "hs_add64"
+        MO_x64_Sub   -> text "hs_sub64"
+        MO_x64_Mul   -> text "hs_mul64"
+        MO_I64_Quot  -> text "hs_quotInt64"
+        MO_I64_Rem   -> text "hs_remInt64"
+        MO_W64_Quot  -> text "hs_quotWord64"
+        MO_W64_Rem   -> text "hs_remWord64"
+        MO_x64_And   -> text "hs_and64"
+        MO_x64_Or    -> text "hs_or64"
+        MO_x64_Xor   -> text "hs_xor64"
+        MO_x64_Not   -> text "hs_not64"
+        MO_x64_Shl   -> text "hs_uncheckedShiftL64"
+        MO_I64_Shr   -> text "hs_uncheckedIShiftRA64"
+        MO_W64_Shr   -> text "hs_uncheckedShiftRL64"
+        MO_x64_Eq    -> text "hs_eq64"
+        MO_x64_Ne    -> text "hs_ne64"
+        MO_I64_Ge    -> text "hs_geInt64"
+        MO_I64_Gt    -> text "hs_gtInt64"
+        MO_I64_Le    -> text "hs_leInt64"
+        MO_I64_Lt    -> text "hs_ltInt64"
+        MO_W64_Ge    -> text "hs_geWord64"
+        MO_W64_Gt    -> text "hs_gtWord64"
+        MO_W64_Le    -> text "hs_leWord64"
+        MO_W64_Lt    -> text "hs_ltWord64"
     where unsupported = panic ("pprCallishMachOp_for_C: " ++ show mop
                             ++ " not supported!")
-          dontReach64 = panic ("pprCallishMachOp_for_C: " ++ show mop
-                            ++ " should be not be encountered because the regular primop for this 64-bit operation is used instead.")
 
 -- ---------------------------------------------------------------------
 -- Useful #defines



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9c4ea90c6b493eee6df1798c63a6031cc18ae6da
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/20220908/7eeb00d5/attachment-0001.html>


More information about the ghc-commits mailing list