[flang-commits] [flang] [flang] Corrected constant folding for IEEE_OTHER in IEEE_ROUNDING_SUPPORTED (PR #197534)
via flang-commits
flang-commits at lists.llvm.org
Wed May 13 12:03:18 PDT 2026
https://github.com/kwyatt-ext created https://github.com/llvm/llvm-project/pull/197534
Modified to report expected value of FALSE for constant folded IEEE_OTHER support.
This fixes issue #197486.
>From cd0507fafa985f5e270328c8dff23cbf87fcdb3e Mon Sep 17 00:00:00 2001
From: Kevin Wyatt <kwyatt at hpe.com>
Date: Wed, 13 May 2026 13:58:45 -0500
Subject: [PATCH] [flang] Corrected constant folding for IEEE_OTHER in
IEEE_ROUNDING_SUPPORTED
---
flang/lib/Evaluate/fold-logical.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/flang/lib/Evaluate/fold-logical.cpp b/flang/lib/Evaluate/fold-logical.cpp
index 457b2f6dd20b8..b685303c2a130 100644
--- a/flang/lib/Evaluate/fold-logical.cpp
+++ b/flang/lib/Evaluate/fold-logical.cpp
@@ -930,7 +930,8 @@ Expr<Type<TypeCategory::Logical, KIND>> FoldIntrinsicFunction(
if (context.targetCharacteristics().ieeeFeatures().test(
IeeeFeature::Rounding)) {
if (auto mode{GetRoundingMode(args[0])}) {
- return Expr<T>{mode != common::RoundingMode::TiesAwayFromZero};
+ return Expr<T>{mode >= common::RoundingMode::ToZero &&
+ mode < common::RoundingMode::TiesAwayFromZero};
}
}
} else if (name == "__builtin_ieee_support_sqrt") {
More information about the flang-commits
mailing list