summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-10-21 16:15:42 -0400
committerBen Gamari <ben@smart-cactus.org>2020-10-21 16:15:42 -0400
commit239daad8d245b582bf9bb51530f9dbbf01acd56e (patch)
tree0db5805c7e142c2c08cd84c65131afaa7593099a
parent350f0a39e535182f2cfcbc05e11b232df13f6b88 (diff)
downloadhaskell-wip/T18872.tar.gz
CmmToAsm/X86: Improve code generation for MO_UF_Conv of literalwip/T18872
Previously we would call hs_word2float which is incredibly expensive compared to just a MOV.
-rw-r--r--compiler/GHC/CmmToAsm/X86/CodeGen.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/GHC/CmmToAsm/X86/CodeGen.hs b/compiler/GHC/CmmToAsm/X86/CodeGen.hs
index aa4769f376..f466b1c56d 100644
--- a/compiler/GHC/CmmToAsm/X86/CodeGen.hs
+++ b/compiler/GHC/CmmToAsm/X86/CodeGen.hs
@@ -2511,6 +2511,13 @@ genCCall' config is32Bit (PrimTarget (MO_Clz width)) dest_regs@[dst] args@[src]
bw = widthInBits width
lbl = mkCmmCodeLabel primUnitId (fsLit (clzLabel width))
+genCCall' config _ (PrimTarget (MO_UF_Conv width)) [dst] [CmmLit arg_lit] _ = do
+ let fmt = floatFormat width
+ Amode amode amode_code <- memConstant (mkAlignment $ widthInBytes width) arg_lit
+ let platform = ncgPlatform config
+ let dst_r = getRegisterReg platform (CmmLocal dst)
+ return $ amode_code `appOL` unitOL (MOV fmt (OpAddr amode) (OpReg dst_r))
+
genCCall' config is32Bit (PrimTarget (MO_UF_Conv width)) dest_regs args bid = do
targetExpr <- cmmMakeDynamicReference config
CallReference lbl