vect: simplify is_linear_load_p using vec_perm_builder and reject invalid [PR126592]

is_linear_load_p is supposed to test for valid permutations of lanes of complex
arithmetic.  It was written as a manual loop that iteratively discredited
what a permutation could be and returned the permute.

However the code is a bit hard to prove correct and as PR1265992 points out it
accepts at least one invalid permute [0 2 2 2].

To fix this and simplify the code to prevent other issues I have rewritten it to
use vec_perm_indices and use the convenient helper series_p ();

gcc/ChangeLog:

	PR tree-optimization/126592
	* tree-vect-slp-patterns.cc (is_linear_load_p): Rewrite using
	vec_perm_indices.

gcc/testsuite/ChangeLog:

	PR tree-optimization/126592
	* gcc.target/aarch64/pr126592.c: New test.
2 files changed