(this isn't an i386 patch)
On Wed, 27 Dec 2017, Shalnov, Sergey wrote:
Should we use vector instructions if the scalar and vector costs in SLP are the
same?
According to the source line comment (already in source code) we should not
use vector instructions in this case.
"Vectorization is profitable if its cost is more than the cost of scalar
version." This existing comment clearly has a typo, it should be "less" or
"not more".
"Note that we err on the vector side for equal cost because [...]"
So this is clearly done on purpose, and you cannot change the behavior
without changing the comment as well.
I would like to propose to use scalars if costs are the same.
Why? The comment explains why the opposite makes sense (costs tend to
be overestimated in the vector case). Did you measure improvements in some
benchmark? Can you share a testcase? Did you check if it passes the
testsuite (I don't remember if there is a specific testcase for this)?
--
Marc Glisse