summaryrefslogtreecommitdiff
path: root/compiler/nativeGen
diff options
context:
space:
mode:
authorchessai <chessai1996@gmail.com>2019-02-01 13:01:46 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-06-09 18:41:02 -0400
commitf737033329817335bc01ab16a385b4b5ec5b3b5d (patch)
treec437a8e0f813be553bec23b6cc9e9dd960707ddd /compiler/nativeGen
parenta018c3a84c88f6208e7bd5587af1cdf40c2ae991 (diff)
downloadhaskell-f737033329817335bc01ab16a385b4b5ec5b3b5d.tar.gz
Introduce log1p and expm1 primops
Previously log and exp were primitives yet log1p and expm1 were FFI calls. Fix this non-uniformity.
Diffstat (limited to 'compiler/nativeGen')
-rw-r--r--compiler/nativeGen/PPC/CodeGen.hs4
-rw-r--r--compiler/nativeGen/SPARC/CodeGen.hs4
-rw-r--r--compiler/nativeGen/X86/CodeGen.hs4
3 files changed, 12 insertions, 0 deletions
diff --git a/compiler/nativeGen/PPC/CodeGen.hs b/compiler/nativeGen/PPC/CodeGen.hs
index 8540c780e3..03e8e42d9a 100644
--- a/compiler/nativeGen/PPC/CodeGen.hs
+++ b/compiler/nativeGen/PPC/CodeGen.hs
@@ -1955,7 +1955,9 @@ genCCall' dflags gcp target dest_regs args
where
(functionName, reduce) = case mop of
MO_F32_Exp -> (fsLit "exp", True)
+ MO_F32_ExpM1 -> (fsLit "expm1", True)
MO_F32_Log -> (fsLit "log", True)
+ MO_F32_Log1P -> (fsLit "log1p", True)
MO_F32_Sqrt -> (fsLit "sqrt", True)
MO_F32_Fabs -> unsupported
@@ -1977,7 +1979,9 @@ genCCall' dflags gcp target dest_regs args
MO_F32_Atanh -> (fsLit "atanh", True)
MO_F64_Exp -> (fsLit "exp", False)
+ MO_F64_ExpM1 -> (fsLit "expm1", False)
MO_F64_Log -> (fsLit "log", False)
+ MO_F64_Log1P -> (fsLit "log1p", False)
MO_F64_Sqrt -> (fsLit "sqrt", False)
MO_F64_Fabs -> unsupported
diff --git a/compiler/nativeGen/SPARC/CodeGen.hs b/compiler/nativeGen/SPARC/CodeGen.hs
index 851a6f2f0a..ea81219c69 100644
--- a/compiler/nativeGen/SPARC/CodeGen.hs
+++ b/compiler/nativeGen/SPARC/CodeGen.hs
@@ -616,7 +616,9 @@ outOfLineMachOp_table
outOfLineMachOp_table mop
= case mop of
MO_F32_Exp -> fsLit "expf"
+ MO_F32_ExpM1 -> fsLit "expm1f"
MO_F32_Log -> fsLit "logf"
+ MO_F32_Log1P -> fsLit "log1pf"
MO_F32_Sqrt -> fsLit "sqrtf"
MO_F32_Fabs -> unsupported
MO_F32_Pwr -> fsLit "powf"
@@ -638,7 +640,9 @@ outOfLineMachOp_table mop
MO_F32_Atanh -> fsLit "atanhf"
MO_F64_Exp -> fsLit "exp"
+ MO_F64_ExpM1 -> fsLit "expm1"
MO_F64_Log -> fsLit "log"
+ MO_F64_Log1P -> fsLit "log1p"
MO_F64_Sqrt -> fsLit "sqrt"
MO_F64_Fabs -> unsupported
MO_F64_Pwr -> fsLit "pow"
diff --git a/compiler/nativeGen/X86/CodeGen.hs b/compiler/nativeGen/X86/CodeGen.hs
index b46ef6a935..21e18ee6fd 100644
--- a/compiler/nativeGen/X86/CodeGen.hs
+++ b/compiler/nativeGen/X86/CodeGen.hs
@@ -2875,7 +2875,9 @@ outOfLineCmmOp bid mop res args
MO_F32_Cos -> fsLit "cosf"
MO_F32_Tan -> fsLit "tanf"
MO_F32_Exp -> fsLit "expf"
+ MO_F32_ExpM1 -> fsLit "expm1f"
MO_F32_Log -> fsLit "logf"
+ MO_F32_Log1P -> fsLit "log1pf"
MO_F32_Asin -> fsLit "asinf"
MO_F32_Acos -> fsLit "acosf"
@@ -2896,7 +2898,9 @@ outOfLineCmmOp bid mop res args
MO_F64_Cos -> fsLit "cos"
MO_F64_Tan -> fsLit "tan"
MO_F64_Exp -> fsLit "exp"
+ MO_F64_ExpM1 -> fsLit "expm1"
MO_F64_Log -> fsLit "log"
+ MO_F64_Log1P -> fsLit "log1p"
MO_F64_Asin -> fsLit "asin"
MO_F64_Acos -> fsLit "acos"