summaryrefslogtreecommitdiff
path: root/compiler/llvmGen/LlvmCodeGen/CodeGen.hs
diff options
context:
space:
mode:
authorDavid Terei <davidterei@gmail.com>2010-06-28 18:29:49 +0000
committerDavid Terei <davidterei@gmail.com>2010-06-28 18:29:49 +0000
commitf9d7e1f01042638253530db9f989fece42d7e39a (patch)
treeb0744162bbf1785a5eeffb2e5d89656544fb8794 /compiler/llvmGen/LlvmCodeGen/CodeGen.hs
parent6852de4405998e529711cdad16dd4ae280615608 (diff)
downloadhaskell-f9d7e1f01042638253530db9f989fece42d7e39a.tar.gz
LLVM: Use intrinsic functions for pow, sqrt, sin, cos
Instead of calling the C library for these Cmm functions we use intrinsic functions provided by llvm. LLVM will then either create a compile time constant if possible, or use a cpu instruction or as a last resort call the C library.
Diffstat (limited to 'compiler/llvmGen/LlvmCodeGen/CodeGen.hs')
-rw-r--r--compiler/llvmGen/LlvmCodeGen/CodeGen.hs16
1 files changed, 8 insertions, 8 deletions
diff --git a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs
index 0abc618f65..359d4925aa 100644
--- a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs
+++ b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs
@@ -351,11 +351,11 @@ cmmPrimOpFunctions mop
= case mop of
MO_F32_Exp -> fsLit "expf"
MO_F32_Log -> fsLit "logf"
- MO_F32_Sqrt -> fsLit "sqrtf"
- MO_F32_Pwr -> fsLit "powf"
+ MO_F32_Sqrt -> fsLit "llvm.sqrt.f32"
+ MO_F32_Pwr -> fsLit "llvm.pow.f32"
- MO_F32_Sin -> fsLit "sinf"
- MO_F32_Cos -> fsLit "cosf"
+ MO_F32_Sin -> fsLit "llvm.sin.f32"
+ MO_F32_Cos -> fsLit "llvm.cos.f32"
MO_F32_Tan -> fsLit "tanf"
MO_F32_Asin -> fsLit "asinf"
@@ -368,11 +368,11 @@ cmmPrimOpFunctions mop
MO_F64_Exp -> fsLit "exp"
MO_F64_Log -> fsLit "log"
- MO_F64_Sqrt -> fsLit "sqrt"
- MO_F64_Pwr -> fsLit "pow"
+ MO_F64_Sqrt -> fsLit "llvm.sqrt.f64"
+ MO_F64_Pwr -> fsLit "llvm.pow.f64"
- MO_F64_Sin -> fsLit "sin"
- MO_F64_Cos -> fsLit "cos"
+ MO_F64_Sin -> fsLit "llvm.sin.f64"
+ MO_F64_Cos -> fsLit "llvm.cos.f64"
MO_F64_Tan -> fsLit "tan"
MO_F64_Asin -> fsLit "asin"