RE: [PATCH V16] VECT: Add decrement IV iteration loop control by variable amount support
Committed, thanks Richard. Pan -Original Message- From: Gcc-patches On Behalf Of Richard Biener via Gcc-patches Sent: Thursday, May 25, 2023 9:06 PM To: Richard Sandiford Cc: juzhe.zh...@rivai.ai; gcc-patches@gcc.gnu.org Subject: Re: [PATCH V16] VECT: Add decrement IV iteration loop control by variable amount support On Thu, 25 May 2023, Richard Sandiford wrote: > This looks good to me. Just a couple of very minor cosmetic things: > > juzhe.zh...@rivai.ai writes: > > @@ -753,17 +846,35 @@ vect_set_loop_condition_partial_vectors (class loop > > *loop, > > continue; > > } > > > > - /* See whether zero-based IV would ever generate all-false masks > > - or zero length before wrapping around. */ > > - bool might_wrap_p = vect_rgroup_iv_might_wrap_p (loop_vinfo, rgc); > > - > > - /* Set up all controls for this group. */ > > - test_ctrl = vect_set_loop_controls_directly (loop, loop_vinfo, > > -&preheader_seq, > > -&header_seq, > > -loop_cond_gsi, rgc, > > -niters, niters_skip, > > -might_wrap_p); > > + if (!LOOP_VINFO_USING_DECREMENTING_IV_P (loop_vinfo) || !iv_rgc > > + || (iv_rgc->max_nscalars_per_iter * iv_rgc->factor > > + != rgc->max_nscalars_per_iter * rgc->factor)) > > Coding style is to put each subcondition on a separate line when the > whole condition doesn't fit on a single line. So: > > if (!LOOP_VINFO_USING_DECREMENTING_IV_P (loop_vinfo) > || !iv_rgc > || (iv_rgc->max_nscalars_per_iter * iv_rgc->factor > != rgc->max_nscalars_per_iter * rgc->factor)) > > > @@ -2725,6 +2726,17 @@ start_over: > >&& !vect_verify_loop_lens (loop_vinfo)) > > LOOP_VINFO_CAN_USE_PARTIAL_VECTORS_P (loop_vinfo) = false; > > > > + /* If we're vectorizing an loop that uses length "controls" and > > s/an loop/a loop/(Sorry for not noticing earlier.) > > OK for trunk from my POV with those changes; no need to repost unless > your policies require it. Please give Richi a chance to comment too > though. LGTM as well. Thanks, Richard.
Re: [PATCH V16] VECT: Add decrement IV iteration loop control by variable amount support
On Thu, 25 May 2023, Richard Sandiford wrote: > This looks good to me. Just a couple of very minor cosmetic things: > > juzhe.zh...@rivai.ai writes: > > @@ -753,17 +846,35 @@ vect_set_loop_condition_partial_vectors (class loop > > *loop, > > continue; > > } > > > > - /* See whether zero-based IV would ever generate all-false masks > > - or zero length before wrapping around. */ > > - bool might_wrap_p = vect_rgroup_iv_might_wrap_p (loop_vinfo, rgc); > > - > > - /* Set up all controls for this group. */ > > - test_ctrl = vect_set_loop_controls_directly (loop, loop_vinfo, > > -&preheader_seq, > > -&header_seq, > > -loop_cond_gsi, rgc, > > -niters, niters_skip, > > -might_wrap_p); > > + if (!LOOP_VINFO_USING_DECREMENTING_IV_P (loop_vinfo) || !iv_rgc > > + || (iv_rgc->max_nscalars_per_iter * iv_rgc->factor > > + != rgc->max_nscalars_per_iter * rgc->factor)) > > Coding style is to put each subcondition on a separate line when the > whole condition doesn't fit on a single line. So: > > if (!LOOP_VINFO_USING_DECREMENTING_IV_P (loop_vinfo) > || !iv_rgc > || (iv_rgc->max_nscalars_per_iter * iv_rgc->factor > != rgc->max_nscalars_per_iter * rgc->factor)) > > > @@ -2725,6 +2726,17 @@ start_over: > >&& !vect_verify_loop_lens (loop_vinfo)) > > LOOP_VINFO_CAN_USE_PARTIAL_VECTORS_P (loop_vinfo) = false; > > > > + /* If we're vectorizing an loop that uses length "controls" and > > s/an loop/a loop/(Sorry for not noticing earlier.) > > OK for trunk from my POV with those changes; no need to repost unless > your policies require it. Please give Richi a chance to comment too > though. LGTM as well. Thanks, Richard.
Re: Re: [PATCH V16] VECT: Add decrement IV iteration loop control by variable amount support
Thanks Richard so much. I have sent V17 patch for commit (fix format as you suggested). You don't need to reply that. I am waiting for Richi's final approval. Thanks. juzhe.zh...@rivai.ai From: Richard Sandiford Date: 2023-05-25 20:36 To: juzhe.zhong CC: gcc-patches; rguenther Subject: Re: [PATCH V16] VECT: Add decrement IV iteration loop control by variable amount support This looks good to me. Just a couple of very minor cosmetic things: juzhe.zh...@rivai.ai writes: > @@ -753,17 +846,35 @@ vect_set_loop_condition_partial_vectors (class loop > *loop, >continue; >} > > - /* See whether zero-based IV would ever generate all-false masks > -or zero length before wrapping around. */ > - bool might_wrap_p = vect_rgroup_iv_might_wrap_p (loop_vinfo, rgc); > - > - /* Set up all controls for this group. */ > - test_ctrl = vect_set_loop_controls_directly (loop, loop_vinfo, > - &preheader_seq, > - &header_seq, > - loop_cond_gsi, rgc, > - niters, niters_skip, > - might_wrap_p); > + if (!LOOP_VINFO_USING_DECREMENTING_IV_P (loop_vinfo) || !iv_rgc > + || (iv_rgc->max_nscalars_per_iter * iv_rgc->factor > + != rgc->max_nscalars_per_iter * rgc->factor)) Coding style is to put each subcondition on a separate line when the whole condition doesn't fit on a single line. So: if (!LOOP_VINFO_USING_DECREMENTING_IV_P (loop_vinfo) || !iv_rgc || (iv_rgc->max_nscalars_per_iter * iv_rgc->factor != rgc->max_nscalars_per_iter * rgc->factor)) > @@ -2725,6 +2726,17 @@ start_over: >&& !vect_verify_loop_lens (loop_vinfo)) > LOOP_VINFO_CAN_USE_PARTIAL_VECTORS_P (loop_vinfo) = false; > > + /* If we're vectorizing an loop that uses length "controls" and s/an loop/a loop/(Sorry for not noticing earlier.) OK for trunk from my POV with those changes; no need to repost unless your policies require it. Please give Richi a chance to comment too though. Thanks for your patience with the review process. The final result seems pretty clean to me. Richard
Re: [PATCH V16] VECT: Add decrement IV iteration loop control by variable amount support
This looks good to me. Just a couple of very minor cosmetic things: juzhe.zh...@rivai.ai writes: > @@ -753,17 +846,35 @@ vect_set_loop_condition_partial_vectors (class loop > *loop, > continue; > } > > - /* See whether zero-based IV would ever generate all-false masks > -or zero length before wrapping around. */ > - bool might_wrap_p = vect_rgroup_iv_might_wrap_p (loop_vinfo, rgc); > - > - /* Set up all controls for this group. */ > - test_ctrl = vect_set_loop_controls_directly (loop, loop_vinfo, > - &preheader_seq, > - &header_seq, > - loop_cond_gsi, rgc, > - niters, niters_skip, > - might_wrap_p); > + if (!LOOP_VINFO_USING_DECREMENTING_IV_P (loop_vinfo) || !iv_rgc > + || (iv_rgc->max_nscalars_per_iter * iv_rgc->factor > + != rgc->max_nscalars_per_iter * rgc->factor)) Coding style is to put each subcondition on a separate line when the whole condition doesn't fit on a single line. So: if (!LOOP_VINFO_USING_DECREMENTING_IV_P (loop_vinfo) || !iv_rgc || (iv_rgc->max_nscalars_per_iter * iv_rgc->factor != rgc->max_nscalars_per_iter * rgc->factor)) > @@ -2725,6 +2726,17 @@ start_over: >&& !vect_verify_loop_lens (loop_vinfo)) > LOOP_VINFO_CAN_USE_PARTIAL_VECTORS_P (loop_vinfo) = false; > > + /* If we're vectorizing an loop that uses length "controls" and s/an loop/a loop/(Sorry for not noticing earlier.) OK for trunk from my POV with those changes; no need to repost unless your policies require it. Please give Richi a chance to comment too though. Thanks for your patience with the review process. The final result seems pretty clean to me. Richard