[flang-commits] [flang] 79c2a1e - [flang][runtime] Correct SELECTED_LOGICAL_KIND() (#93108)
via flang-commits
flang-commits at lists.llvm.org
Thu May 23 16:31:22 PDT 2024
Author: Peter Klausler
Date: 2024-05-23T16:31:17-07:00
New Revision: 79c2a1e4efc8a772744ae4df36622b3bbbbbdc3f
URL: https://github.com/llvm/llvm-project/commit/79c2a1e4efc8a772744ae4df36622b3bbbbbdc3f
DIFF: https://github.com/llvm/llvm-project/commit/79c2a1e4efc8a772744ae4df36622b3bbbbbdc3f.diff
LOG: [flang][runtime] Correct SELECTED_LOGICAL_KIND() (#93108)
The implementation of the runtime version of this intrinsic function in
https://github.com/llvm/llvm-project/pull/89691 was incorrect. Fix it to
interpret its argument as a bit count.
Added:
Modified:
flang/runtime/numeric.cpp
Removed:
################################################################################
diff --git a/flang/runtime/numeric.cpp b/flang/runtime/numeric.cpp
index 52b5a56894d88..2225473c4690e 100644
--- a/flang/runtime/numeric.cpp
+++ b/flang/runtime/numeric.cpp
@@ -117,13 +117,13 @@ inline RT_API_ATTRS CppTypeFor<TypeCategory::Integer, 4> SelectedIntKind(T x) {
template <typename T>
inline RT_API_ATTRS CppTypeFor<TypeCategory::Integer, 4> SelectedLogicalKind(
T x) {
- if (x <= 2) {
+ if (x <= 8) {
return 1;
- } else if (x <= 4) {
+ } else if (x <= 16) {
return 2;
- } else if (x <= 9) {
+ } else if (x <= 32) {
return 4;
- } else if (x <= 18) {
+ } else if (x <= 64) {
return 8;
}
return -1;
More information about the flang-commits
mailing list