Hi, Kewen. I have tried to implement "decrement IV" feature and incorporate into "vect_set_loop_controls_directly". Since the implementation is quite different from vect_set_loop_controls_directly, it will make vect_set_loop_controls_directly very complicated sometimes it makes me very hard to debug when I am testing. I am not sure but I can try again. This patch isolated those implementation into a single function "vect_set_loop_controls_by_select_vl" which makes Richards easier to review codes. Well, I think I can try again to incorporate those codes into "vect_set_loop_controls_directly" when they finish the review process of "vect_set_loop_controls_by_select_vl". Thanks. juzhe.zhong@rivai.ai From: Kewen.Lin Date: 2023-05-08 15:55 To: juzhe.zhong@rivai.ai CC: gcc-patches; rguenther; richard.sandiford Subject: Re: [PATCH V4] VECT: Add decrement IV iteration loop control by variable amount support Hi Juzhe, > Hi, Kewen. > >>> Sorry for chiming in, I had some concern here. >>> We already have some handlings for partial vector in length in vect_set_loop_controls_directly >>>(actually it deals with both mask and length), the proposed vect_set_loop_controls_by_select_vl >>>for select_vl looks like a variant for partial vector in length (comparing to the normal MIN), >>>and also adopts decrement IV. IMHO, it seems better to modify/extend the current handling in >>>vect_set_loop_controls_directly for length, or factor out the handlings for length there and >>>extend the factored one. Otherwise, it means we have two sets of handlings for partial vector >>>in lengths, it looks bad to maintain. As the previous discussion, adopting decrement IV is an >>>enhancement for loop control, it's good for both cases w/ or w/o select_vl. If the above >>>understanding is correct, the possible steps seem to be: >>> - factor out the handling for length (* optional) >>> - modify it with decrement IV >>> - extend it with select_vl. >>>In future if some RVV vendor wants to degenerate select_vl to min, it can just adopt the same >>>handlings with min by not defining select_vl optab. > > You mean like this: > doing this inside vect_set_loop_controls_directly ? > if (use_while_len_p) > return vect_set_loop_controls_by_while_len(...) No, I meant either factoring out those handlings for partial vector in length in function vect_set_loop_controls_directly to one separated function like: vect_set_loop_controls_directly_length and rename the existing one to vect_set_loop_controls_directly_mask, or keep the existing vect_set_loop_controls_directly for both mask and length but modify/extend the part for length. If there is no much code to share between mask and length, the former may be better. BR, Kewen