Re: [PATCH] fold-const: Handle AND, IOR, XOR with stepped vectors [PR112971].

2024-01-24 Thread Richard Sandiford
Richard Biener writes: > On Mon, 15 Jan 2024, Robin Dapp wrote: > >> I gave it another shot now by introducing a separate function as >> Richard suggested. It's probably not at the location he intended. >> >> The way I read the discussion there hasn't been any consensus >> on how (or rather

Re: [PATCH] fold-const: Handle AND, IOR, XOR with stepped vectors [PR112971].

2024-01-15 Thread Richard Biener
On Mon, 15 Jan 2024, Robin Dapp wrote: > I gave it another shot now by introducing a separate function as > Richard suggested. It's probably not at the location he intended. > > The way I read the discussion there hasn't been any consensus > on how (or rather where) to properly tackle the

Re: [PATCH] fold-const: Handle AND, IOR, XOR with stepped vectors [PR112971].

2024-01-15 Thread Robin Dapp
I gave it another shot now by introducing a separate function as Richard suggested. It's probably not at the location he intended. The way I read the discussion there hasn't been any consensus on how (or rather where) to properly tackle the problem. Any other ideas still? Regards Robin

Re: [PATCH] fold-const: Handle AND, IOR, XOR with stepped vectors [PR112971].

2023-12-20 Thread Richard Biener
On Wed, 20 Dec 2023, Richard Sandiford wrote: > Richard Biener writes: > > On Tue, 19 Dec 2023, Andrew Pinski wrote: > > > >> On Tue, Dec 19, 2023 at 2:40?AM Richard Sandiford > >> wrote: > >> > > >> > Richard Biener writes: > >> > > On Tue, 19 Dec 2023, juzhe.zh...@rivai.ai wrote: > >> > > >

Re: [PATCH] fold-const: Handle AND, IOR, XOR with stepped vectors [PR112971].

2023-12-20 Thread Richard Sandiford
Richard Biener writes: > On Tue, 19 Dec 2023, Andrew Pinski wrote: > >> On Tue, Dec 19, 2023 at 2:40?AM Richard Sandiford >> wrote: >> > >> > Richard Biener writes: >> > > On Tue, 19 Dec 2023, juzhe.zh...@rivai.ai wrote: >> > > >> > >> Hi, Richard. >> > >> >> > >> After investigating the codes:

Re: [PATCH] fold-const: Handle AND, IOR, XOR with stepped vectors [PR112971].

2023-12-19 Thread Richard Biener
ski > > > > > /* OP is the INDEXth operand to CODE (counting from zero) and OTHER_OP > > is the other operand. Try to use the value of OP to simplify the > >operation in one step, without having to process individual elements. */ > > tree > > sim

Re: Re: [PATCH] fold-const: Handle AND, IOR, XOR with stepped vectors [PR112971].

2023-12-19 Thread juzhe.zh...@rivai.ai
? juzhe.zh...@rivai.ai From: Andrew Pinski Date: 2023-12-20 10:04 To: Richard Biener; juzhe.zh...@rivai.ai; Robin Dapp; gcc-patches; pan2.li; Richard Biener; pinskia; richard.sandiford Subject: Re: [PATCH] fold-const: Handle AND, IOR, XOR with stepped vectors [PR112971]. On Tue, Dec 19, 2023

Re: [PATCH] fold-const: Handle AND, IOR, XOR with stepped vectors [PR112971].

2023-12-19 Thread Andrew Pinski
ro) and OTHER_OP >is the other operand. Try to use the value of OP to simplify the >operation in one step, without having to process individual elements. */ > tree > simplify_const_binop (tree_code code, rtx op, rtx other_op, int index) > { > ... > } > >

Re: Re: [PATCH] fold-const: Handle AND, IOR, XOR with stepped vectors [PR112971].

2023-12-19 Thread juzhe.zh...@rivai.ai
or RVV. juzhe.zh...@rivai.ai From: Richard Sandiford Date: 2023-12-19 18:40 To: Richard Biener CC: juzhe.zhong\@rivai.ai; Robin Dapp; gcc-patches; pan2.li; Richard Biener; pinskia Subject: Re: [PATCH] fold-const: Handle AND, IOR, XOR with stepped vectors [PR112971]. Richard Biener writes: > O

Re: [PATCH] fold-const: Handle AND, IOR, XOR with stepped vectors [PR112971].

2023-12-19 Thread Richard Sandiford
e simplify_const_binop (tree_code code, rtx op, rtx other_op, int index) { ... } Thanks, Richard > > Richard. > >> >> >> >> juzhe.zh...@rivai.ai >> >> From: Richard Biener >> Date: 2023-12-19 17:12 >> To: juzhe.zh...@rivai.ai >&g

Re: Re: [PATCH] fold-const: Handle AND, IOR, XOR with stepped vectors [PR112971].

2023-12-19 Thread Richard Biener
t on the whole structure. Richard. > > > > juzhe.zh...@rivai.ai > > From: Richard Biener > Date: 2023-12-19 17:12 > To: juzhe.zh...@rivai.ai > CC: Robin Dapp; gcc-patches; pan2.li; richard.sandiford; Richard Biener; > pinskia > Subject: Re: Re: [PATCH] fold-

Re: Re: [PATCH] fold-const: Handle AND, IOR, XOR with stepped vectors [PR112971].

2023-12-19 Thread Jakub Jelinek
On Tue, Dec 19, 2023 at 05:49:48PM +0800, juzhe.zh...@rivai.ai wrote: > >> (x & -1) == x > >>(x | -1) == -1 > >>(x ^ -1) == ~x > > Looks reasonable to me. > > Do you mean modify the code as follows ? > >if (integer_zerop (arg1) || integer_zerop (arg2)) || integer_onep > (arg1) ||

Re: Re: [PATCH] fold-const: Handle AND, IOR, XOR with stepped vectors [PR112971].

2023-12-19 Thread juzhe.zh...@rivai.ai
| code == BIT_IOR_EXPR || code == BIT_XOR_EXPR); juzhe.zh...@rivai.ai From: Jakub Jelinek Date: 2023-12-19 17:45 To: juzhe.zh...@rivai.ai CC: rguenther; Robin Dapp; gcc-patches; pan2.li; richard.sandiford; Richard Biener; pinskia Subject: Re: Re: [PATCH] fold-const: Handle AND,

Re: Re: [PATCH] fold-const: Handle AND, IOR, XOR with stepped vectors [PR112971].

2023-12-19 Thread Jakub Jelinek
On Tue, Dec 19, 2023 at 05:35:14PM +0800, juzhe.zh...@rivai.ai wrote: > I wonder whether we can simplify the codes as follows :? > if (integer_zerop (arg1) || integer_zerop (arg2)) > step_ok_p = (code == BIT_AND_EXPR || code == BIT_IOR_EXPR > || code ==

Re: Re: [PATCH] fold-const: Handle AND, IOR, XOR with stepped vectors [PR112971].

2023-12-19 Thread juzhe.zh...@rivai.ai
|| code == BIT_IOR_EXPR || code == BIT_XOR_EXPR); juzhe.zh...@rivai.ai From: Richard Biener Date: 2023-12-19 17:12 To: juzhe.zh...@rivai.ai CC: Robin Dapp; gcc-patches; pan2.li; richard.sandiford; Richard Biener; pinskia Subject: Re: Re: [PATCH] fold-const: Handle AND, IOR, XOR with st

Re: Re: [PATCH] fold-const: Handle AND, IOR, XOR with stepped vectors [PR112971].

2023-12-19 Thread Richard Biener
app.gcc; gcc-patches; pan2.li; richard.sandiford; richard.guenther; > Andrew Pinski > Subject: Re: [PATCH] fold-const: Handle AND, IOR, XOR with stepped vectors > [PR112971]. > On Tue, 19 Dec 2023, ??? wrote: > > > Thanks Robin send initial patch to fix this ICE bug. > >

Re: Re: [PATCH] fold-const: Handle AND, IOR, XOR with stepped vectors [PR112971].

2023-12-19 Thread juzhe.zh...@rivai.ai
de == BIT_XOR_EXPR); juzhe.zh...@rivai.ai From: Richard Biener Date: 2023-12-19 16:15 To: 钟居哲 CC: rdapp.gcc; gcc-patches; pan2.li; richard.sandiford; richard.guenther; Andrew Pinski Subject: Re: [PATCH] fold-const: Handle AND, IOR, XOR with stepped vectors [PR112971]. On Tue, 19 Dec 2023, ??? wrot

Re: [PATCH] fold-const: Handle AND, IOR, XOR with stepped vectors [PR112971].

2023-12-19 Thread Richard Biener
> Thanks. > > > > juzhe.zh...@rivai.ai > > From: Robin Dapp > Date: 2023-12-19 03:50 > To: gcc-patches > CC: rdapp.gcc; Li, Pan2; juzhe.zh...@rivai.ai > Subject: [PATCH] fold-const: Handle AND, IOR, XOR with stepped vectors > [PR112971]. > Hi, > > found in

Re: [PATCH] fold-const: Handle AND, IOR, XOR with stepped vectors [PR112971].

2023-12-18 Thread 钟居哲
Thanks Robin send initial patch to fix this ICE bug. CC to Richard S, Richard B, and Andrew. Thanks. juzhe.zh...@rivai.ai From: Robin Dapp Date: 2023-12-19 03:50 To: gcc-patches CC: rdapp.gcc; Li, Pan2; juzhe.zh...@rivai.ai Subject: [PATCH] fold-const: Handle AND, IOR, XOR with stepped

[PATCH] fold-const: Handle AND, IOR, XOR with stepped vectors [PR112971].

2023-12-18 Thread Robin Dapp
Hi, found in PR112971, this patch adds folding support for bitwise operations of const duplicate zero vectors and stepped vectors. On riscv we have the situation that a folding would perpetually continue without simplifying because e.g. {0, 0, 0, ...} & {7, 6, 5, ...} would not fold to {0, 0, 0,