[flang-commits] [flang] 954b692 - [flang] Allow derf as alternate spelling for erf (#95784)

via flang-commits flang-commits at lists.llvm.org
Mon Jun 24 17:24:53 PDT 2024


Author: David Truby
Date: 2024-06-25T01:24:49+01:00
New Revision: 954b692bd74b4e7571bb4a8045f4b488d504a6ba

URL: https://github.com/llvm/llvm-project/commit/954b692bd74b4e7571bb4a8045f4b488d504a6ba
DIFF: https://github.com/llvm/llvm-project/commit/954b692bd74b4e7571bb4a8045f4b488d504a6ba.diff

LOG: [flang] Allow derf as alternate spelling for erf (#95784)

This patch adds derf as an alternate spelling for the erf intrinsic.
This spelling is supported by multiple other compilers and used by WRF.

Added: 
    

Modified: 
    flang/lib/Evaluate/intrinsics.cpp
    flang/unittests/Evaluate/intrinsics.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Evaluate/intrinsics.cpp b/flang/lib/Evaluate/intrinsics.cpp
index 2733f994576a4..80752d02b5baf 100644
--- a/flang/lib/Evaluate/intrinsics.cpp
+++ b/flang/lib/Evaluate/intrinsics.cpp
@@ -1113,6 +1113,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}},

diff  --git a/flang/unittests/Evaluate/intrinsics.cpp b/flang/unittests/Evaluate/intrinsics.cpp
index 0bbc7fede699a..86c471d2c6295 100644
--- a/flang/unittests/Evaluate/intrinsics.cpp
+++ b/flang/unittests/Evaluate/intrinsics.cpp
@@ -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");


        


More information about the flang-commits mailing list