https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120922
Jeffrey A. Law <law at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tamar.christina at arm dot com --- Comment #1 from Jeffrey A. Law <law at gcc dot gnu.org> --- Bisects to: 309dbcea2cabb31bde1a65cdfd30bb7f87b170a2 is the first bad commit commit 309dbcea2cabb31bde1a65cdfd30bb7f87b170a2 Author: Tamar Christina <tamar.christ...@arm.com> Date: Tue Jun 24 07:13:22 2025 +0100 middle-end: replace log_vf usages with vf to allow support for non-power of two vf This patch fixes a bug where the current code assumed that exact_log2 returns NULL on failure, but it instead returns -1. So there are some cases where the right shift could shift out the entire value. Secondly it also removes the requirement that VF be a power of two. With an uneven unroll factor we can easily end up with a non-power of two VF which SLP can handle. This replaces shifts with multiplication and division. The 32-bit x86 testcase from PR64110 was always wrong, it used to match by pure coincidence a vmovd inside the vector loop. What it intended to match was that the argument to the function isn't spilled and then reloaded from the stack for no reason. But on 32-bit x86 all arguments are passed on the stack anyway and so the match would have never worked. The patch seems to simplify the loop preheader which gets it to remove an intermediate zero extend which causes the match to now properly fail. As such I'm skipping the test on 32-bit x86. gcc/ChangeLog: * tree-vect-loop-manip.cc (vect_gen_vector_loop_niters, vect_gen_vector_loop_niters_mult_vf): Remove uses of log_vf. gcc/testsuite/ChangeLog: * gcc.target/i386/pr64110.c: Update testcase. gcc/testsuite/gcc.target/i386/pr64110.c | 2 +- gcc/tree-vect-loop-manip.cc | 36 +++++++++++++++++++-----------------