Re: [PATCHv2, rs6000] Enable have_cbranchcc4 on rs6000

2022-11-21 Thread HAO CHEN GUI via Gcc-patches
Hi Segher, Thanks for your comments. 在 2022/11/22 7:49, Segher Boessenkool 写道: > *cbranch_2insn is not a machine insn. It generates a cror and a branch > insn. This makes no sense to have in a cbranchcc: those do a branch > based on an existing cr field, so based on the *output* of that cror.

Re: [PATCHv2, rs6000] Enable have_cbranchcc4 on rs6000

2022-11-21 Thread Kewen.Lin via Gcc-patches
Hi Haochen, on 2022/11/22 13:12, HAO CHEN GUI wrote: > Hi Kewen, > > 在 2022/11/22 11:11, Kewen.Lin 写道: >> Maybe we can adjust prepare_cmp_insn to fail if the constructed cbranchcc4 >> pattern doesn't satisfy the predicate of operand 0 rather than to assert. >> It's something like: >> >> if

Re: [PATCHv2, rs6000] Enable have_cbranchcc4 on rs6000

2022-11-21 Thread HAO CHEN GUI via Gcc-patches
Hi Kewen, 在 2022/11/22 11:11, Kewen.Lin 写道: > Maybe we can adjust prepare_cmp_insn to fail if the constructed cbranchcc4 > pattern doesn't satisfy the predicate of operand 0 rather than to assert. > It's something like: > > if (!insn_operand_matches (icode, 0, test)) > goto fail; > > or only

Re: [PATCHv2, rs6000] Enable have_cbranchcc4 on rs6000

2022-11-21 Thread Kewen.Lin via Gcc-patches
Hi Haochen, Thanks for the explanation. on 2022/11/21 14:18, HAO CHEN GUI wrote: > Hi Segher, > > 在 2022/11/18 20:18, Segher Boessenkool 写道: >> I don't think we should pretend we have any conditional jumps the >> machine does not actually have, in cbranchcc4. When would this ever be >> useful?

Re: [PATCHv2, rs6000] Enable have_cbranchcc4 on rs6000

2022-11-21 Thread Segher Boessenkool
Hi! On Mon, Nov 21, 2022 at 02:18:39PM +0800, HAO CHEN GUI wrote: > 在 2022/11/18 20:18, Segher Boessenkool 写道: > > I don't think we should pretend we have any conditional jumps the > > machine does not actually have, in cbranchcc4. When would this ever be > > useful? cror;beq can be quite

Re: [PATCHv2, rs6000] Enable have_cbranchcc4 on rs6000

2022-11-20 Thread HAO CHEN GUI via Gcc-patches
Hi Segher, 在 2022/11/18 20:18, Segher Boessenkool 写道: > I don't think we should pretend we have any conditional jumps the > machine does not actually have, in cbranchcc4. When would this ever be > useful? cror;beq can be quite expensive, compared to the code it would > replace anyway. > > If

Re: [PATCHv2, rs6000] Enable have_cbranchcc4 on rs6000

2022-11-18 Thread David Edelsohn via Gcc-patches
On Fri, Nov 18, 2022 at 7:20 AM Segher Boessenkool < seg...@kernel.crashing.org> wrote: > On Fri, Nov 18, 2022 at 02:35:30PM +0800, HAO CHEN GUI wrote: > > 在 2022/11/17 21:24, David Edelsohn 写道: > > > Why are you using zero_constant predicate instead of matching > (const_int 0) for operand 2? > >

Re: [PATCHv2, rs6000] Enable have_cbranchcc4 on rs6000

2022-11-18 Thread Segher Boessenkool
On Fri, Nov 18, 2022 at 02:35:30PM +0800, HAO CHEN GUI wrote: > 在 2022/11/17 21:24, David Edelsohn 写道: > > Why are you using zero_constant predicate instead of matching (const_int 0) > > for operand 2? > The "const_int 0" is an operand other than a predicate. We need a predicate > here. Said

Re: [PATCHv2, rs6000] Enable have_cbranchcc4 on rs6000

2022-11-17 Thread HAO CHEN GUI via Gcc-patches
Hi David, 在 2022/11/17 21:24, David Edelsohn 写道: > This is better, but the pattern should be near and after the existing > cbranch4 patterns earlier in the file, not the *cbranch pattern.  It > doesn't match the comment. Sure, I will put it after existing "cbranch4" patterns. > > Why are you

Re: [PATCHv2, rs6000] Enable have_cbranchcc4 on rs6000

2022-11-17 Thread David Edelsohn via Gcc-patches
On Thu, Nov 17, 2022 at 1:39 AM HAO CHEN GUI wrote: > Hi, > The patch enables have_cbrnachcc4 which is a flag in ifcvt.cc to > indicate if branch by CC bits is invalid or not. The new expand pattern > "cbranchcc4" is created which intend to match the pattern defined in > "*cbranch",

[PATCHv2, rs6000] Enable have_cbranchcc4 on rs6000

2022-11-16 Thread HAO CHEN GUI via Gcc-patches
Hi, The patch enables have_cbrnachcc4 which is a flag in ifcvt.cc to indicate if branch by CC bits is invalid or not. The new expand pattern "cbranchcc4" is created which intend to match the pattern defined in "*cbranch", "*cbranch_2insn" and "*creturn". The operand sequence in "cbranchcc4" is