Skip to content

Commit

Permalink
[flang] Allow derf as alternate spelling for erf
Browse files Browse the repository at this point in the history
This patch adds derf as an alternate spelling for the erf intrinsic.
This spelling is supported by multiple other compilers and used by WRF.
  • Loading branch information
DavidTruby committed Jun 19, 2024
1 parent 457e895 commit 0d0388d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions flang/lib/Evaluate/intrinsics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1098,6 +1098,7 @@ static const SpecificIntrinsicInterface specificIntrinsicFunction[]{
{{"ddim", {{"x", DoublePrecision}, {"y", DoublePrecision}},
DoublePrecision},
"dim"},
{{"derf", {{"x", DoublePrecision}}, DoublePrecision}, "erf"},
{{"dexp", {{"x", DoublePrecision}}, DoublePrecision}, "exp"},
{{"dfloat", {{"a", AnyInt}}, DoublePrecision}, "real", true},
{{"dim", {{"x", DefaultReal}, {"y", DefaultReal}}, DefaultReal}},
Expand Down
1 change: 1 addition & 0 deletions flang/test/Intrinsics/math-codegen.fir
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,7 @@ func.func @_QPtest_real8(%arg0: !fir.ref<f64> {fir.bindc_name = "x"}) -> f64 {
func.func private @erff(f32) -> f32
func.func private @erf(f64) -> f64


//--- exp_fast.fir
// RUN: fir-opt %t/exp_fast.fir --fir-to-llvm-ir="target=x86_64-unknown-linux-gnu" | FileCheck %t/exp_fast.fir
// CHECK: @_QPtest_real4
Expand Down
1 change: 1 addition & 0 deletions flang/unittests/Evaluate/intrinsics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ void TestIntrinsics() {
TEST(table.GetGenericIntrinsicName("dcos") == "cos");
TEST(table.GetGenericIntrinsicName("dcosh") == "cosh");
TEST(table.GetGenericIntrinsicName("ddim") == "dim");
TEST(table.GetGenericIntrinsicName("derf") == "erf");
TEST(table.GetGenericIntrinsicName("dexp") == "exp");
TEST(table.GetGenericIntrinsicName("dint") == "aint");
TEST(table.GetGenericIntrinsicName("dlog") == "log");
Expand Down

0 comments on commit 0d0388d

Please sign in to comment.