Re: [PATCH v2] RISC-V: Implement autovec abs, vneg, vnot.

2023-05-26 Thread Jeff Law via Gcc-patches
On 5/25/23 08:43, Robin Dapp wrote: Beside, V2 patch should change this: emit_vlmax_masked_insn (unsigned icode, int op_num, rtx *ops) change it into emit_vlmax_masked_mu_insn . V3 is inline with these changes. This patch implements abs2, vneg2 and vnot2 expanders for integer vector regist

Re: Re: [PATCH v2] RISC-V: Implement autovec abs, vneg, vnot.

2023-05-25 Thread 钟居哲
LGTM this patch. Let's wait for kito's final approval. Thanks. juzhe.zh...@rivai.ai From: Robin Dapp Date: 2023-05-25 22:43 To: 钟居哲; gcc-patches; kito.cheng; palmer; Jeff Law CC: rdapp.gcc Subject: Re: [PATCH v2] RISC-V: Implement autovec abs, vneg, vnot. > Beside, V2 patch shoul

Re: [PATCH v2] RISC-V: Implement autovec abs, vneg, vnot.

2023-05-25 Thread Robin Dapp via Gcc-patches
> Beside, V2 patch should change this: > emit_vlmax_masked_insn (unsigned icode, int op_num, rtx *ops) > > change it into emit_vlmax_masked_mu_insn . V3 is inline with these changes. This patch implements abs2, vneg2 and vnot2 expanders for integer vector registers and adds tests for them. gcc/

Re: Re: [PATCH v2] RISC-V: Implement autovec abs, vneg, vnot.

2023-05-25 Thread 钟居哲
.@rivai.ai; gcc-patches; kito.cheng; palmer; jeffreyalaw CC: rdapp.gcc Subject: Re: [PATCH v2] RISC-V: Implement autovec abs, vneg, vnot. > I think it's logically incorrect. For ABS, you want: > > operands[0] = operads[1] > 0 ? operands[1] : (-operands[1]) > So you should do this fo

Re: [PATCH v2] RISC-V: Implement autovec abs, vneg, vnot.

2023-05-25 Thread Robin Dapp via Gcc-patches
> I think it's logically incorrect.  For ABS, you want: > > operands[0] = operads[1] > 0 ? operands[1] :  (-operands[1]) > So you should do this following sequence: > > vmslt v0,v1,0 > vneg v1,v1v0.t (should use Mask undisturbed) Yes, this is the emitted sequence, but the vsetvli mask is indeed

Re: [PATCH v2] RISC-V: Implement autovec abs, vneg, vnot.

2023-05-25 Thread juzhe.zh...@rivai.ai
+(define_expand "abs2" + [(set (match_operand:VI 0 "register_operand") +(match_operand:VI 1 "register_operand"))] + "TARGET_VECTOR" +{ + rtx zero = gen_const_vec_duplicate (mode, GEN_INT (0)); + machine_mode mask_mode = riscv_vector::get_mask_mode (mode).require (); + rtx mask = gen_reg_rt