[flang-commits] [flang] 71e01d9 - [flang] Support KNINT and KIDNNT legacy intrinsic functions (#79190)
via flang-commits
flang-commits at lists.llvm.org
Thu Jan 25 16:35:22 PST 2024
Author: Peter Klausler
Date: 2024-01-25T16:35:18-08:00
New Revision: 71e01d9fd757b7330958f9ee4ef4b797b7d17a7e
URL: https://github.com/llvm/llvm-project/commit/71e01d9fd757b7330958f9ee4ef4b797b7d17a7e
DIFF: https://github.com/llvm/llvm-project/commit/71e01d9fd757b7330958f9ee4ef4b797b7d17a7e.diff
LOG: [flang] Support KNINT and KIDNNT legacy intrinsic functions (#79190)
These specific intrinsic functions are legacy names that map to the
standard generic NINT(..., KIND=8).
Added:
Modified:
flang/lib/Evaluate/intrinsics.cpp
flang/test/Evaluate/folding02.f90
Removed:
################################################################################
diff --git a/flang/lib/Evaluate/intrinsics.cpp b/flang/lib/Evaluate/intrinsics.cpp
index 85c76b11d2c453..eeea5b5773fbe5 100644
--- a/flang/lib/Evaluate/intrinsics.cpp
+++ b/flang/lib/Evaluate/intrinsics.cpp
@@ -1113,6 +1113,12 @@ static const SpecificIntrinsicInterface specificIntrinsicFunction[]{
{{"kiabs", {{"a", TypePattern{IntType, KindCode::exactKind, 8}}},
TypePattern{IntType, KindCode::exactKind, 8}},
"abs"},
+ {{"kidnnt", {{"a", DoublePrecision}},
+ TypePattern{IntType, KindCode::exactKind, 8}},
+ "nint"},
+ {{"knint", {{"a", DefaultReal}},
+ TypePattern{IntType, KindCode::exactKind, 8}},
+ "nint"},
{{"len", {{"string", DefaultChar, Rank::anyOrAssumedRank}}, DefaultInt,
Rank::scalar, IntrinsicClass::inquiryFunction}},
{{"lge", {{"string_a", DefaultChar}, {"string_b", DefaultChar}},
diff --git a/flang/test/Evaluate/folding02.f90 b/flang/test/Evaluate/folding02.f90
index 6374be35286cef..89e2a09aa31b72 100644
--- a/flang/test/Evaluate/folding02.f90
+++ b/flang/test/Evaluate/folding02.f90
@@ -277,18 +277,22 @@ module m
(1.3223499632715445262221010125358588993549346923828125_8, &
1.7371201007364975854585509296157397329807281494140625_8))
-! Extension specific intrinsic variants of ABS
- logical, parameter, test_babs1 = kind(babs(-1_1)) == 1
- logical, parameter, test_babs2 = babs(-1_1) == 1_1
- logical, parameter, test_iiabs1 = kind(iiabs(-1_2)) == 2
- logical, parameter, test_iiabs2 = iiabs(-1_2) == 1_2
- logical, parameter, test_jiabs1 = kind(jiabs(-1_4)) == 4
- logical, parameter, test_jiabs2 = jiabs(-1_4) == 1_4
- logical, parameter, test_kiabs1 = kind(kiabs(-1_8)) == 8
- logical, parameter, test_kiabs2 = kiabs(-1_8) == 1_8
- logical, parameter, test_zabs1 = kind(zabs((3._8,4._8))) == 8
- logical, parameter, test_zabs2 = zabs((3._8,4._8)) == 5_8
- logical, parameter, test_cdabs1 = kind(cdabs((3._8,4._8))) == kind(1.d0)
- logical, parameter, test_cdabs2 = cdabs((3._8,4._8)) == real(5, kind(1.d0))
+! Extension specific intrinsic variants
+ logical, parameter :: test_babs1 = kind(babs(-1_1)) == 1
+ logical, parameter :: test_babs2 = babs(-1_1) == 1_1
+ logical, parameter :: test_iiabs1 = kind(iiabs(-1_2)) == 2
+ logical, parameter :: test_iiabs2 = iiabs(-1_2) == 1_2
+ logical, parameter :: test_jiabs1 = kind(jiabs(-1_4)) == 4
+ logical, parameter :: test_jiabs2 = jiabs(-1_4) == 1_4
+ logical, parameter :: test_kiabs1 = kind(kiabs(-1_8)) == 8
+ logical, parameter :: test_kiabs2 = kiabs(-1_8) == 1_8
+ logical, parameter :: test_zabs1 = kind(zabs((3._8,4._8))) == 8
+ logical, parameter :: test_zabs2 = zabs((3._8,4._8)) == 5_8
+ logical, parameter :: test_cdabs1 = kind(cdabs((3._8,4._8))) == kind(1.d0)
+ logical, parameter :: test_cdabs2 = cdabs((3._8,4._8)) == real(5, kind(1.d0))
+ logical, parameter :: test_kidnnt1 = kind(kidnnt(2.5d0)) == 8
+ logical, parameter :: test_kidnnt2 = kidnnt(2.5d0) == 3
+ logical, parameter :: test_knint1 = kind(knint(2.5)) == 8
+ logical, parameter :: test_knint2 = knint(2.5) == 3
end
More information about the flang-commits
mailing list