* [PATCH] Convert flag_finite_math_only uses in frange to HONOR_*.
@ 2022-10-25 20:59 Aldy Hernandez
2022-10-27 22:59 ` Jeff Law
0 siblings, 1 reply; 3+ messages in thread
From: Aldy Hernandez @ 2022-10-25 20:59 UTC (permalink / raw)
To: GCC patches; +Cc: Richard Biener, Andrew MacLeod, Aldy Hernandez
[As Richi, and probably Jakub, have mentioned in the past...]
As mentioned earlier, we should be using HONOR_* on types rather than
flag_finite_math_only.
Will commit pending tests.
gcc/ChangeLog:
* value-range.cc (frange::set): Use HONOR_*.
(frange::verify_range): Same.
* value-range.h (frange_val_min): Same.
(frange_val_max): Same.
---
gcc/value-range.cc | 6 +++---
gcc/value-range.h | 12 ++++++------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/gcc/value-range.cc b/gcc/value-range.cc
index d8ee6ec0d0f..77e5a2cc299 100644
--- a/gcc/value-range.cc
+++ b/gcc/value-range.cc
@@ -341,7 +341,7 @@ frange::set (tree type,
// For -ffinite-math-only we can drop ranges outside the
// representable numbers to min/max for the type.
- if (flag_finite_math_only)
+ if (!HONOR_INFINITIES (m_type))
{
REAL_VALUE_TYPE min_repr = frange_val_min (m_type);
REAL_VALUE_TYPE max_repr = frange_val_max (m_type);
@@ -712,8 +712,8 @@ frange::supports_type_p (const_tree type) const
void
frange::verify_range ()
{
- if (flag_finite_math_only)
- gcc_checking_assert (!maybe_isnan ());
+ if (!undefined_p ())
+ gcc_checking_assert (HONOR_NANS (m_type) || !maybe_isnan ());
switch (m_kind)
{
case VR_UNDEFINED:
diff --git a/gcc/value-range.h b/gcc/value-range.h
index b48542a68aa..c87734dd8cd 100644
--- a/gcc/value-range.h
+++ b/gcc/value-range.h
@@ -1201,10 +1201,10 @@ real_min_representable (const_tree type)
inline REAL_VALUE_TYPE
frange_val_min (const_tree type)
{
- if (flag_finite_math_only)
- return real_min_representable (type);
- else
+ if (HONOR_INFINITIES (type))
return dconstninf;
+ else
+ return real_min_representable (type);
}
// Return the maximum value for TYPE.
@@ -1212,10 +1212,10 @@ frange_val_min (const_tree type)
inline REAL_VALUE_TYPE
frange_val_max (const_tree type)
{
- if (flag_finite_math_only)
- return real_max_representable (type);
- else
+ if (HONOR_INFINITIES (type))
return dconstinf;
+ else
+ return real_max_representable (type);
}
// Return TRUE if R is the minimum value for TYPE.
--
2.37.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Convert flag_finite_math_only uses in frange to HONOR_*.
2022-10-25 20:59 [PATCH] Convert flag_finite_math_only uses in frange to HONOR_* Aldy Hernandez
@ 2022-10-27 22:59 ` Jeff Law
2022-10-28 6:22 ` Aldy Hernandez
0 siblings, 1 reply; 3+ messages in thread
From: Jeff Law @ 2022-10-27 22:59 UTC (permalink / raw)
To: Aldy Hernandez, GCC patches
On 10/25/22 14:59, Aldy Hernandez via Gcc-patches wrote:
> [As Richi, and probably Jakub, have mentioned in the past...]
>
> As mentioned earlier, we should be using HONOR_* on types rather than
> flag_finite_math_only.
>
> Will commit pending tests.
>
> gcc/ChangeLog:
>
> * value-range.cc (frange::set): Use HONOR_*.
> (frange::verify_range): Same.
> * value-range.h (frange_val_min): Same.
> (frange_val_max): Same.
I haven't verified it's this patch, but our friend the vax regression is
back:
cc1: internal compiler error: in fail, at selftest.cc:47
0x1686807 selftest::fail(selftest::location const&, char const*)
../../../gcc/gcc/selftest.cc:47
0x10578d2 range_tests_floats
../../../gcc/gcc/value-range.cc:4038
0x10658fd range_tests_floats_various
../../../gcc/gcc/value-range.cc:4056
0x10658fd selftest::range_tests()
../../../gcc/gcc/value-range.cc:4069
http://law-sandy.freeddns.org:8080/job/vax-unknown-linux/1458/console
Jeff
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Convert flag_finite_math_only uses in frange to HONOR_*.
2022-10-27 22:59 ` Jeff Law
@ 2022-10-28 6:22 ` Aldy Hernandez
0 siblings, 0 replies; 3+ messages in thread
From: Aldy Hernandez @ 2022-10-28 6:22 UTC (permalink / raw)
To: Jeff Law; +Cc: GCC patches
[-- Attachment #1: Type: text/plain, Size: 999 bytes --]
On Fri, Oct 28, 2022 at 1:00 AM Jeff Law <jeffreyalaw@gmail.com> wrote:
>
>
> On 10/25/22 14:59, Aldy Hernandez via Gcc-patches wrote:
> > [As Richi, and probably Jakub, have mentioned in the past...]
> >
> > As mentioned earlier, we should be using HONOR_* on types rather than
> > flag_finite_math_only.
> >
> > Will commit pending tests.
> >
> > gcc/ChangeLog:
> >
> > * value-range.cc (frange::set): Use HONOR_*.
> > (frange::verify_range): Same.
> > * value-range.h (frange_val_min): Same.
> > (frange_val_max): Same.
>
> I haven't verified it's this patch, but our friend the vax regression is
> back:
Bah. I suck. There was one remaining use of flag_finite_math_only in
the self tests. Fixed and finally done:
$ grep flag_finite *range*
value-range.cc: int save_finite_math_only = flag_finite_math_only;
value-range.cc: flag_finite_math_only = 1;
value-range.cc: flag_finite_math_only = 0;
value-range.cc: flag_finite_math_only = save_finite_math_only;
Aldy
[-- Attachment #2: 0001-Change-remaining-flag_finite_math_only-use-in-value-.patch --]
[-- Type: text/x-patch, Size: 824 bytes --]
From dc55841d9a45a2d93eaedd68841f7514723939d1 Mon Sep 17 00:00:00 2001
From: Aldy Hernandez <aldyh@redhat.com>
Date: Fri, 28 Oct 2022 08:13:38 +0200
Subject: [PATCH] Change remaining flag_finite_math_only use in value-range.cc.
gcc/ChangeLog:
* value-range.cc (range_tests_floats): Use HONOR_INFINITIES.
---
gcc/value-range.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/value-range.cc b/gcc/value-range.cc
index 77e5a2cc299..03b3c4b4a65 100644
--- a/gcc/value-range.cc
+++ b/gcc/value-range.cc
@@ -4031,7 +4031,7 @@ range_tests_floats ()
r0.intersect (r1);
ASSERT_TRUE (r0.undefined_p ());
- if (!flag_finite_math_only)
+ if (HONOR_INFINITIES (float_type_node))
{
// Make sure [-Inf, -Inf] doesn't get normalized.
r0 = frange_float ("-Inf", "-Inf");
--
2.37.3
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-10-28 6:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-25 20:59 [PATCH] Convert flag_finite_math_only uses in frange to HONOR_* Aldy Hernandez
2022-10-27 22:59 ` Jeff Law
2022-10-28 6:22 ` Aldy Hernandez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).