summaryrefslogtreecommitdiff
path: root/compiler/llvmGen
diff options
context:
space:
mode:
authorJohan Tibell <johan.tibell@gmail.com>2012-12-05 19:08:48 -0800
committerJohan Tibell <johan.tibell@gmail.com>2012-12-13 13:54:22 -0800
commit2e8c769422740c001e0a247bfec61d4f78598582 (patch)
treedc9ad5736694e1c9282800d88e9a110d13290a72 /compiler/llvmGen
parent589b628be71cda75f4a225db0f1d1fd678c06368 (diff)
downloadhaskell-2e8c769422740c001e0a247bfec61d4f78598582.tar.gz
Implement word2Float# and word2Double#
Diffstat (limited to 'compiler/llvmGen')
-rw-r--r--compiler/llvmGen/LlvmCodeGen/CodeGen.hs12
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs
index fd9d7011c4..c510185191 100644
--- a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs
+++ b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs
@@ -187,6 +187,17 @@ genCall env (PrimTarget MO_WriteBarrier) _ _
genCall env (PrimTarget MO_Touch) _ _
= return (env, nilOL, [])
+genCall env (PrimTarget (MO_UF_Conv w)) [dst] [e] = do
+ let (env1, dstV, stmts1, top1) = getCmmReg env (CmmLocal dst)
+ width = widthToLlvmFloat w
+ (env2, ve, stmts2, top2) <- exprToVar env1 e
+ let stmt = Assignment dstV $ Cast LM_Uitofp ve width
+ stmts = stmts1 `appOL` stmts2 `snocOL` stmt
+ return (env2, stmts, top1 ++ top2)
+genCall _ (PrimTarget (MO_UF_Conv _)) [_] args =
+ panic $ "genCall: Too many arguments to MO_UF_Conv. " ++
+ "Can only handle 1, given" ++ show (length args) ++ "."
+
-- Handle popcnt function specifically since GHC only really has i32 and i64
-- types and things like Word8 are backed by an i32 and just present a logical
-- i8 range. So we must handle conversions from i32 to i8 explicitly as LLVM
@@ -513,6 +524,7 @@ cmmPrimOpFunctions env mop
MO_U_Mul2 {} -> unsupported
MO_WriteBarrier -> unsupported
MO_Touch -> unsupported
+ MO_UF_Conv _ -> unsupported
where
dflags = getDflags env