[flang-commits] [flang] [flang] Allow derf as alternate spelling for erf (PR #95784)
David Truby via flang-commits
flang-commits at lists.llvm.org
Wed Jun 19 06:16:38 PDT 2024
https://github.com/DavidTruby updated https://github.com/llvm/llvm-project/pull/95784
>From 0d0388dc0260fa3870bad83bee2c59bcda043db3 Mon Sep 17 00:00:00 2001
From: David Truby <david.truby at arm.com>
Date: Mon, 17 Jun 2024 13:24:51 +0000
Subject: [PATCH] [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.
---
flang/lib/Evaluate/intrinsics.cpp | 1 +
flang/test/Intrinsics/math-codegen.fir | 1 +
flang/unittests/Evaluate/intrinsics.cpp | 1 +
3 files changed, 3 insertions(+)
diff --git a/flang/lib/Evaluate/intrinsics.cpp b/flang/lib/Evaluate/intrinsics.cpp
index ace316174a892..24f6b5a79e86e 100644
--- a/flang/lib/Evaluate/intrinsics.cpp
+++ b/flang/lib/Evaluate/intrinsics.cpp
@@ -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}},
diff --git a/flang/test/Intrinsics/math-codegen.fir b/flang/test/Intrinsics/math-codegen.fir
index 62d841253075e..c9f44a9d86565 100644
--- a/flang/test/Intrinsics/math-codegen.fir
+++ b/flang/test/Intrinsics/math-codegen.fir
@@ -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
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