Skip to content

Commit 0d0388d

Browse files
committed
[flang] Allow derf as alternate spelling for erf
This patch adds derf as an alternate spelling for the erf intrinsic. This spelling is supported by multiple other compilers and used by WRF.
1 parent 457e895 commit 0d0388d

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

flang/lib/Evaluate/intrinsics.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,6 +1098,7 @@ static const SpecificIntrinsicInterface specificIntrinsicFunction[]{
10981098
{{"ddim", {{"x", DoublePrecision}, {"y", DoublePrecision}},
10991099
DoublePrecision},
11001100
"dim"},
1101+
{{"derf", {{"x", DoublePrecision}}, DoublePrecision}, "erf"},
11011102
{{"dexp", {{"x", DoublePrecision}}, DoublePrecision}, "exp"},
11021103
{{"dfloat", {{"a", AnyInt}}, DoublePrecision}, "real", true},
11031104
{{"dim", {{"x", DefaultReal}, {"y", DefaultReal}}, DefaultReal}},

flang/test/Intrinsics/math-codegen.fir

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -862,6 +862,7 @@ func.func @_QPtest_real8(%arg0: !fir.ref<f64> {fir.bindc_name = "x"}) -> f64 {
862862
func.func private @erff(f32) -> f32
863863
func.func private @erf(f64) -> f64
864864

865+
865866
//--- exp_fast.fir
866867
// RUN: fir-opt %t/exp_fast.fir --fir-to-llvm-ir="target=x86_64-unknown-linux-gnu" | FileCheck %t/exp_fast.fir
867868
// CHECK: @_QPtest_real4

flang/unittests/Evaluate/intrinsics.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ void TestIntrinsics() {
344344
TEST(table.GetGenericIntrinsicName("dcos") == "cos");
345345
TEST(table.GetGenericIntrinsicName("dcosh") == "cosh");
346346
TEST(table.GetGenericIntrinsicName("ddim") == "dim");
347+
TEST(table.GetGenericIntrinsicName("derf") == "erf");
347348
TEST(table.GetGenericIntrinsicName("dexp") == "exp");
348349
TEST(table.GetGenericIntrinsicName("dint") == "aint");
349350
TEST(table.GetGenericIntrinsicName("dlog") == "log");

0 commit comments

Comments
 (0)