diff options
author | Cheng Shao <terrorjack@type.dance> | 2022-11-28 08:43:27 +0000 |
---|---|---|
committer | Cheng Shao <terrorjack@type.dance> | 2022-11-28 08:55:53 +0000 |
commit | 0eb1c3311aa01646fd19334f2541f96a701c1e20 (patch) | |
tree | 99be9f7cc17e6f58c5fb1f7a98f26d4c3979d0f9 /compiler | |
parent | 2da5c38a45fcfd9778d7d89d0946aa475ae96627 (diff) | |
download | haskell-0eb1c3311aa01646fd19334f2541f96a701c1e20.tar.gz |
Move hs_mulIntMayOflo cbits to ghc-prim
It's only used by wasm NCG at the moment, but ghc-prim is a more
reasonable place for hosting out-of-line primops. Also, we only need a
single version of hs_mulIntMayOflo.
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/GHC/CmmToAsm/Wasm/FromCmm.hs | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/compiler/GHC/CmmToAsm/Wasm/FromCmm.hs b/compiler/GHC/CmmToAsm/Wasm/FromCmm.hs index 034a75aea2..d41b95feba 100644 --- a/compiler/GHC/CmmToAsm/Wasm/FromCmm.hs +++ b/compiler/GHC/CmmToAsm/Wasm/FromCmm.hs @@ -443,27 +443,22 @@ lower_MO_S_Shr lbl w0 [x, y] = case someWasmTypeFromCmmType (cmmBits w0) of lower_MO_S_Shr _ _ _ = panic "lower_MO_S_Shr: unreachable" -- | Lower a 'MO_MulMayOflo' operation. It's translated to a ccall to --- one of the @hs_mulIntMayOflo@ functions in rts/wasm/Ops.c, +-- @hs_mulIntMayOflo@ function in @ghc-prim/cbits/mulIntMayOflo@, -- otherwise it's quite non-trivial to implement as inline assembly. lower_MO_MulMayOflo :: - CLabel -> - Width -> - [CmmExpr] -> - WasmCodeGenM - w - (SomeWasmExpr w) + CLabel -> Width -> [CmmExpr] -> WasmCodeGenM w (SomeWasmExpr w) lower_MO_MulMayOflo lbl w0 [x, y] = case someWasmTypeFromCmmType ty_cmm of SomeWasmType ty -> do WasmExpr x_instr <- lower_CmmExpr_Typed lbl ty x WasmExpr y_instr <- lower_CmmExpr_Typed lbl ty y - onFuncSym f [ty_cmm, ty_cmm] [ty_cmm] + onFuncSym "hs_mulIntMayOflo" [ty_cmm, ty_cmm] [ty_cmm] pure $ SomeWasmExpr ty $ WasmExpr $ - x_instr `WasmConcat` y_instr `WasmConcat` WasmCCall f + x_instr + `WasmConcat` y_instr + `WasmConcat` WasmCCall "hs_mulIntMayOflo" where - f = fromString $ "hs_mulIntMayOflo" <> show (widthInBits w0) - ty_cmm = cmmBits w0 lower_MO_MulMayOflo _ _ _ = panic "lower_MO_MulMayOflo: unreachable" |