Address comments. V4 patch: https://gcc.gnu.org/pipermail/gcc-patches/2023-May/618375.html Regresion PASSED. Thanks. juzhe.zhong@rivai.ai From: Kito Cheng Date: 2023-05-12 23:19 To: juzhe.zhong CC: gcc-patches; palmer; rdapp.gcc; jeffreyalaw Subject: Re: [PATCH V2] RISC-V: Using merge approach to optimize repeating sequence in vec_init two minor comments: > + void add_ta_policy_operand (enum tail_policy vta) > + void add_ma_policy_operand (enum mask_policy vma) You could just named as add_policy_operand since the arugment type is already sufficient to distinguish. > @@ -84,40 +92,52 @@ public: > add_input_operand (gen_int_mode (type, Pmode), Pmode); > } > > - void set_dest_and_mask (rtx mask, rtx dest, machine_mode mask_mode) > + void set_dest_and_mask (rtx mask, rtx dest, machine_mode mask_mode, > + bool scalar_move = false, bool merge_op = false) > { > dest_mode = GET_MODE (dest); > has_dest = true; > > add_output_operand (dest, dest_mode); > > - if (mask) > - add_input_operand (mask, GET_MODE (mask)); > - else > - add_all_one_mask_operand (mask_mode); > + if (!merge_op) > + { > + if (mask) > + add_input_operand (mask, GET_MODE (mask)); > + else > + { > + if (scalar_move) > + add_scalar_move_mask_operand (mask_mode); > + else > + add_all_one_mask_operand (mask_mode); > + } > + } I would like to have set_dest_and_mask_merge_op to reduce the complexity of set_dest_and_mask. Accroding the code I got is: - mask and merge_op are mutual exclusion. - scalar_move will become meanless if merge_op is true. So I think they mixed those togeter is not good idea.