https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113326
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization Component|tree-optimization |target Severity|normal |enhancement Last reconfirmed| |2024-01-11 Ever confirmed|0 |1 Status|UNCONFIRMED |NEW --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Note on aarch64 with SVE, you should be able to generate those constants without a load, using the index instruction. Though aarch64 does not generate them currently. So this is definitely target specific and all. Plus this is simplification happens after the vectorizer which produces: ``` <bb 3> [local count: 252544065]: # i_13 = PHI <i_10(5), 0(2)> # ivtmp_3 = PHI <ivtmp_2(5), 16(2)> # vect_vec_iv_.4_11 = PHI <_16(5), { 0, 1, 2, 3 }(2)> # vectp_array.6_19 = PHI <vectp_array.6_20(5), &array(2)> # ivtmp_22 = PHI <ivtmp_23(5), 0(2)> _16 = vect_vec_iv_.4_11 + { 4, 4, 4, 4 }; vect__1.5_18 = vect_cst__17 >> vect_vec_iv_.4_11; _1 = value_8(D) >> i_13; MEM <vector(4) int> [(int *)vectp_array.6_19] = vect__1.5_18; i_10 = i_13 + 1; ivtmp_2 = ivtmp_3 - 1; vectp_array.6_20 = vectp_array.6_19 + 16; ivtmp_23 = ivtmp_22 + 1; if (ivtmp_23 < 4) goto <bb 5>; [75.00%] else goto <bb 4>; [25.00%] ```