[flang-commits] [flang] [flang][runtime] Correct SELECTED_LOGICAL_KIND() (PR #93108)
via flang-commits
flang-commits at lists.llvm.org
Wed May 22 16:25:57 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-runtime
Author: Peter Klausler (klausler)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/93108.diff
1 Files Affected:
- (modified) flang/runtime/numeric.cpp (+4-4)
``````````diff
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;
``````````
</details>
https://github.com/llvm/llvm-project/pull/93108
More information about the flang-commits
mailing list