https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121700
--- Comment #1 from Avinash Jayakar <avinashd at gcc dot gnu.org> --- After some investigation it seems like in powerpc, the min_profitable_estimate value is 6 for this loop. Meaning vectorization is beneficial if the number of iterations is greater than or equal to 6. In the O2 optimization flag, the value of -fvect-cost-model=very-cheap, thus the conservative analysis at tree-vect-loop.cc 1971 if (loop_cost_model (loop) == VECT_COST_MODEL_VERY_CHEAP 1972 && min_profitable_estimate > (int) vect_vf_for_cost (loop_vinfo)) 1973 { does not cause the loop to be vectorized. However, using the dynamic model as done in O3 flags, gets the loop to be vectorized. But the issue persists for FLOOR_MOD_EXPR, which reports the value of min_profitable_iters to be -1, and no other cost model will cause the loop to be vectorized. I will look into this further.