Re: Re: [PATCH] expmed: Perform mask extraction via QImode [PR112773].

2023-12-13 Thread 钟居哲
Thanks Richard. LGTM for RISC-V part. Thanks Robin for fixing it. juzhe.zh...@rivai.ai From: Richard Sandiford Date: 2023-12-13 22:05 To: Robin Dapp CC: Richard Biener; gcc-patches; juzhe.zhong\@rivai.ai Subject: Re: [PATCH] expmed: Perform mask extraction via QImode [PR112773]. Robin Dapp

Re: [PATCH] expmed: Perform mask extraction via QImode [PR112773].

2023-12-13 Thread Richard Sandiford
Robin Dapp writes: > @@ -1758,16 +1759,19 @@ extract_bit_field_1 (rtx str_rtx, poly_uint64 > bitsize, poly_uint64 bitnum, >if (VECTOR_MODE_P (outermode) && !MEM_P (op0)) > { >scalar_mode innermode = GET_MODE_INNER (outermode); >enum insn_code icode > =

Re: [PATCH] expmed: Perform mask extraction via QImode [PR112773].

2023-12-13 Thread Robin Dapp
Thanks. The attached v2 goes with your suggestion and adds a vec_extractbi expander. Apart from that it keeps the MODE_PRECISION changes from before and uses insn_data[icode].operand[0]'s mode. Apart from that no changes on the riscv side. Bootstrapped and regtested on x86 and aarch64. On

Re: [PATCH] expmed: Perform mask extraction via QImode [PR112773].

2023-12-12 Thread Richard Sandiford
Robin Dapp writes: >> - Change the second mode to vec_extract_optab. This is only a name >> lookup, and it seems more natural to continue using the real element mode. > > Am I understanding correctly that this implies we should provide > a vec_extractbi expander? (with the innermode being

Re: [PATCH] expmed: Perform mask extraction via QImode [PR112773].

2023-12-12 Thread Robin Dapp
> - Change the second mode to vec_extract_optab. This is only a name > lookup, and it seems more natural to continue using the real element mode. Am I understanding correctly that this implies we should provide a vec_extractbi expander? (with the innermode being BImode here). Regards Robin

Re: [PATCH] expmed: Perform mask extraction via QImode [PR112773].

2023-12-12 Thread Richard Sandiford
Robin Dapp writes: > What also works is something like: > > scalar_mode extract_mode = innermode; > if (GET_MODE_CLASS (outermode) == MODE_VECTOR_BOOL) > extract_mode = smallest_int_mode_for_size > (GET_MODE_PRECISION (innermode)); > > however > >> So

Re: [PATCH] expmed: Perform mask extraction via QImode [PR112773].

2023-12-11 Thread Robin Dapp
What also works is something like: scalar_mode extract_mode = innermode; if (GET_MODE_CLASS (outermode) == MODE_VECTOR_BOOL) extract_mode = smallest_int_mode_for_size (GET_MODE_PRECISION (innermode)); however > So yes, I guess we need to answer

Re: [PATCH] expmed: Perform mask extraction via QImode [PR112773].

2023-12-05 Thread Richard Biener
On Tue, 5 Dec 2023, Robin Dapp wrote: > > But how do we know BImode fits in QImode? > > I was kind of hoping that a "bit" always fits in a "byte"/unit > but yeah, I guess we don't always know :/ But the "bit" is of constant size, so we could choose a fitting mode? > > I think the issue is more

Re: [PATCH] expmed: Perform mask extraction via QImode [PR112773].

2023-12-05 Thread Robin Dapp
> But how do we know BImode fits in QImode? I was kind of hoping that a "bit" always fits in a "byte"/unit but yeah, I guess we don't always know :/ > I think the issue is more that we try to extract an element from > the mask vector? How is element extraction defined for VLA vectors > anyway?

Re: [PATCH] expmed: Perform mask extraction via QImode [PR112773].

2023-12-04 Thread Richard Biener
On Mon, 4 Dec 2023, Robin Dapp wrote: > Hi, > > this changes the vec_extract path of extract_bit_field to use QImode > instead of BImode when extracting from mask vectors and changes > GET_MODE_BITSIZE to GET_MODE_PRECISION. This fixes an ICE on riscv > where we did not find a vec_extract optab

[PATCH] expmed: Perform mask extraction via QImode [PR112773].

2023-12-04 Thread Robin Dapp
Hi, this changes the vec_extract path of extract_bit_field to use QImode instead of BImode when extracting from mask vectors and changes GET_MODE_BITSIZE to GET_MODE_PRECISION. This fixes an ICE on riscv where we did not find a vec_extract optab and continued with the generic code that requires