Jakub, it looks like you did a lot of work on reassoc in the past — could you have a quick look and comment?
Thanks, Philipp. On Tue, 11 Jul 2023 at 04:59, Di Zhao OS <diz...@os.amperecomputing.com> wrote: > > Attached is an updated version of the patch. > > Based on Philipp's review, some changes: > > 1. Defined new enum fma_state to describe the state of FMA candidates > for a list of operands. (Since the tests seems simple after the > change, I didn't add predicates on it.) > 2. Changed return type of convert_mult_to_fma_1 and convert_mult_to_fma > to tree, to remove the in/out parameter. > 3. Added description of return value values of rank_ops_for_fma. > > --- > gcc/ChangeLog: > > * tree-ssa-math-opts.cc (convert_mult_to_fma_1): Added new parameter > check_only_p. Changed return type to tree. > (struct fma_transformation_info): Moved to header. > (class fma_deferring_state): Moved to header. > (convert_mult_to_fma): Added new parameter check_only_p. Changed > return type to tree. > * tree-ssa-math-opts.h (struct fma_transformation_info): Moved from > .cc. > (class fma_deferring_state): Moved from .cc. > (convert_mult_to_fma): Add function decl. > * tree-ssa-reassoc.cc (enum fma_state): Defined new enum to describe > the state of FMA candidates for a list of operands. > (rewrite_expr_tree_parallel): Changed boolean parameter to enum type. > (rank_ops_for_fma): Return enum fma_state. > (reassociate_bb): Avoid rewriting to parallel if nested FMAs are > found. > > Thanks, > Di Zhao > >