On Tue, Jul 28, 2026 at 09:18:10AM +0200, Aldy Hernandez wrote:
> To prepare for holding more than one sub-range, move the endpoints
> m_min/m_max into a one-element array.
>
> While here, pick the low-hanging multi-range fruit so the follow-up
> patches stay small: consumers that walk every sub-range now loop over
> m_num_ranges, and the inherently single-range ones (normalize_kind,
> singleton_p, etc) gain an m_num_ranges == 1 guard. The hard cases
> (union_/intersect, etc) are left with FIXMEs for later.
>
> No change to functionality as MAX_PAIRS is 1. I'll bump this to 2 in
> a subequent patch, and implement union/intersect and all the other
> little things.
>
> Tested on ppc64le Linux. No change to assembly over the LAPACK
> preprocessed-Fortran corpus; LAPACK and GCC tests pass.
>
> p.s. I'll give folks a few days to comment, and if nothing comes up,
> I'll commit at the end of the week. We're still in the relatively
> trivial parts of the set. The hard part comes next.
>
> gcc/ChangeLog:
>
> * value-range.h (struct frange_pair): New.
> (class frange): Replace m_min and m_max with m_pairs[MAX_PAIRS]
> and m_num_ranges. Add MAX_PAIRS, num_pairs, and the indexed
> lower_bound and upper_bound. Have canonicalize_zeros take an
> frange_pair.
> (frange::lower_bound, frange::upper_bound): Adjust.
> (frange::set_varying, frange::set_undefined, frange::set_nan)
> (frange::known_isfinite, frange::known_isnormal)
> (frange::known_isdenormal_or_zero, frange::maybe_isinf)
> (frange::known_isinf, frange::signbit_p): Adjust.
> * value-range.cc (frange::flush_denormals_to_zero): Adjust.
> (frange::canonicalize_zeros): Take an frange_pair.
> (frange::set, frange::normalize_kind, frange::union_nans)
> (frange::union_, frange::intersect, frange::operator=)
> (frange::operator==, frange::contains_p)
> (frange::internal_singleton_p, frange::singleton_p)
> (frange::verify_range, frange::zero_p): Adjust.
> * value-range-storage.h (class frange_storage): Replace m_min
> and m_max with m_pairs and m_num_ranges.
> * value-range-storage.cc (frange_storage::set_frange): Adjust.
> (frange_storage::get_frange): Adjust.
LGTM, thanks for working on this.
Jakub