Swap operands during SLP discovery for mismatching STMT_VINFO_REDUC_IDX
When we are unlucky operand canonicalization can end up presenting
us with different order, making a possible SLP reduction group
not match up. The following allows swapping operands in this case.
* tree-vect-slp.cc (vect_get_operand_map): Handle commutative
operands when swapping is requested.
(vect_build_slp_tree_1): Allow STMT_VINFO_REDUC_IDX differences
when operand swapping makes them match and request swapping.
(vect_build_slp_instance): Indicate we have successfully
discovered a SLP reduction group.
* gcc.dg/vect/slp-reduc-13.c: New testcase.
Co-authored-by: Eric Botcazou <ebotcazou@adacore.com>