[RFC] Implementing detection of saturation and rounding arithmetic
Joseph Myers
joseph@codesourcery.com
Tue May 11 17:00:35 GMT 2021
On Tue, 11 May 2021, David Brown wrote:
> It is also worth noting that gcc already has support for saturating
> types on some targets:
>
> <https://gcc.gnu.org/onlinedocs/gcc/Fixed-Point.html>
>
> My testing of these (quite a long time ago) left me with a feeling that
> it was not a feature anyone had worked hard to optimise - certainly it
The implementation isn't well-integrated with any optimizations for
arithmetic on ordinary integer types / modes, because it has its own
completely separate machine modes and operations on those. I still think
it would be better to have a GIMPLE pass that lowers from fixed-point
types to saturating etc. operations on ordinary integer types, as I said
in <https://gcc.gnu.org/legacy-ml/gcc-patches/2011-05/msg00846.html>.
Note however that such lowering should be more or less independent of
what's being discussed in this thread - this thread is about better
optimization of such operations on ordinary types (with or without
built-in functions of some kind in addition to recognition of such
operations written in generic C), which you can do independently of
what's done with fixed-point types.
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Gcc
mailing list