On Sun, 5 Jul 2020, Thomas König wrote:


Am 04.07.2020 um 19:11 schrieb Richard Biener <richard.guent...@gmail.com>:

On July 4, 2020 11:30:05 AM GMT+02:00, "Thomas König" <t...@tkoenig.net> wrote:

What could be a preferred way to achieve that? Could optimization
options like -ffast-math be applied to blocks instead of functions?
Could we set flags on the TREE codes to allow certain optinizations?
Other things?

The middle end can handle those things on function granularity only.

Richard.

OK, so that will not work (or not without a disproportionate
amount of effort).  Would it be possible to set something like a
TREE_FAST_MATH flag on TREEs? An operation could then be
optimized according to these rules iff both operands
had that flag, and would also have it then.

In order to support various semantics on floating point operations, I was planning to replace some trees with internal functions, with an extra operand to specify various behaviors (rounding, exception, etc). Although at least in the beginning, I was thinking of only using those functions in safe mode, to avoid perf regressions.

https://gcc.gnu.org/pipermail/gcc-patches/2019-August/527040.html

This may never happen now, but it sounds similar to setting flags like TREE_FAST_MATH that you are suggesting. I was going with functions for more flexibility, and to avoid all the existing assumptions about trees. While I guess for fast-math, the worst the assumptions could do is clear the flag, which would make use optimize less than possible, not so bad.

--
Marc Glisse

Reply via email to