> The x86 add_stmt_hook relies on the passed vectype to determine > the mode and whether it is FP for a scalar operation. This is > unreliable now for stmts involving patterns and in the future when > there is no vector type passed for scalar operations. > > To be least disruptive I've kept using the vector type if it is passed. > > Bootstrapped and tested on x86_64-unknown-linux-gnu. > > OK? > > Thanks > Richard. > > * config/i386/i386.cc (ix86_vector_costs::add_stmt_cost): Use > the LHS of a scalar stmt to determine mode and whether it is FP. > --- > gcc/config/i386/i386.cc | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc > index ad7360ec71a..26eefadea64 100644 > --- a/gcc/config/i386/i386.cc > +++ b/gcc/config/i386/i386.cc > @@ -25798,6 +25798,12 @@ ix86_vector_costs::add_stmt_cost (int count, > vect_cost_for_stmt kind, > if (scalar_p) > mode = TYPE_MODE (TREE_TYPE (vectype)); > } > + else if (scalar_p && stmt_info) > + if (tree lhs = gimple_get_lhs (stmt_info->stmt)) > + { > + fp = FLOAT_TYPE_P (TREE_TYPE (lhs)); > + mode = TYPE_MODE (TREE_TYPE (lhs)); > + } Makes sense to me, but perhaps it would be good idea to add a comment, since it looks odd at first glance?
Honza