From de0f78b5671eb00b718f506e835d1a5d08dc4784 Mon Sep 17 00:00:00 2001 From: "William S. Moses" Date: Fri, 29 Nov 2024 02:18:34 -0500 Subject: [PATCH] add erfinv --- enzyme/Enzyme/InstructionDerivatives.td | 9 +++++++++ enzyme/Enzyme/TypeAnalysis/TypeAnalysis.cpp | 1 + 2 files changed, 10 insertions(+) diff --git a/enzyme/Enzyme/InstructionDerivatives.td b/enzyme/Enzyme/InstructionDerivatives.td index fa415cd46bc..b3fc4d4448c 100644 --- a/enzyme/Enzyme/InstructionDerivatives.td +++ b/enzyme/Enzyme/InstructionDerivatives.td @@ -691,6 +691,15 @@ def : CallPattern<(Op $x), [ReadNone, NoUnwind] >; +def : CallPattern<(Op $x), + ["erfinv","erfinvf","erfinfvl", "__nv_erfinv","__nv_erfinvf","__nv_erfinfvl", ], + [ + (FMul (FMul (ConstantFP<"0.8862269254527580136490837416705725913987747280611935641069038949264556422955160906874753283692723327"> $x), (FMul (Call<(SameFunc), [ReadNone, NoUnwind]> $x):$ei, $ei)), (DiffeRet)) + ], + (ForwardFromSummedReverse), + [ReadNone, NoUnwind] + >; + def ToStruct2 : SubRoutine<(Op (Op $re, $im):$z), (RetMultiReturnRet $re, $im) >; diff --git a/enzyme/Enzyme/TypeAnalysis/TypeAnalysis.cpp b/enzyme/Enzyme/TypeAnalysis/TypeAnalysis.cpp index fcecc69c3ec..a4384cbf4dd 100644 --- a/enzyme/Enzyme/TypeAnalysis/TypeAnalysis.cpp +++ b/enzyme/Enzyme/TypeAnalysis/TypeAnalysis.cpp @@ -162,6 +162,7 @@ const llvm::StringMap LIBM_FUNCTIONS = { {"erf", Intrinsic::not_intrinsic}, {"erfi", Intrinsic::not_intrinsic}, {"erfc", Intrinsic::not_intrinsic}, + {"erfinv", Intrinsic::not_intrinsic}, {"__fd_sincos_1", Intrinsic::not_intrinsic}, {"sincospi", Intrinsic::not_intrinsic},