[PATCH 2/2] testcase: rename pr111303.c to pr111324.c

2023-09-18 Thread Jiufu Guo via Gcc-patches
Hi, When commit the fix for pr111324, the test cases was named as pr111303.c by mistake. Here, rename it to pr111324.c Is this ok for trunk? BR, Jeff (Jiufu Guo) gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/pr111303.c: Rename to ... * gcc.dg/tree-ssa/pr111324.c: ... this. ---

[PATCH 1/2] using overflow_free_p to simplify pattern

2023-09-18 Thread Jiufu Guo via Gcc-patches
Hi, In r14-3582, an "overflow_free_p" interface is added. The pattern of "(t * 2) / 2" in match.pd can be simplified by using this interface. Bootstrap & regtest pass on ppc64{,le} and x86_64. Is this ok for trunk? BR, Jeff (Jiufu) gcc/ChangeLog: * match.pd ((t * 2) / 2): Update to

Ping [PATCH V4 2/2] rs6000: use mtvsrws to move sf from si p9

2023-09-17 Thread Jiufu Guo via Gcc-patches
Hi, I would like to have a ping. BR, Jeff (Jiufu Guo) Jiufu Guo writes: > Hi, > > As mentioned in PR108338, on p9, we could use mtvsrws to implement > the bitcast from SI to SF (or lowpart DI to SF). > > For code: > *(long long*)buff = di; > float f = *(float*)(buff); > > "sldi 9,3,32

Ping [PATCH V4 1/2] rs6000: optimize moving to sf from highpart di

2023-09-17 Thread Jiufu Guo via Gcc-patches
Hi, I would like to have a ping. BR, Jeff (Jiufu Guo) Jiufu Guo writes: > Hi, > > Currently, we have the pattern "movsf_from_si2" which was trying > to support moving high part DI to SF. > > The pattern looks like: XX:SF=bitcast:SF(subreg(YY:DI>>32),0) > It only accepts the "ashiftrt" for

Ping [PATCH] rs6000: mark tieable between INT and FLOAT

2023-09-17 Thread Jiufu Guo via Gcc-patches
Hi, I would like to have a ping. BR, Jeff (Jiufu Guo) Jiufu Guo writes: > Hi, > > For PowerPC, some INT mode and FLOAT modes can be marked as tieable, > for example: DI<->DF. > One note SFmode is special, it would only tieable with itself. > > I updated previous patch more reasonable: >

Re: [PATCH] Checking undefined_p before using the vr

2023-09-14 Thread Jiufu Guo via Gcc-patches
Hi, Andrew MacLeod writes: > On 9/12/23 21:42, Jiufu Guo wrote: >> Hi, >> >> Richard Biener writes: >> >>> On Thu, 7 Sep 2023, Jiufu Guo wrote: >>> Hi, As discussed in PR111303: For pattern "(X + C) / N": "div (plus@3 @0 INTEGER_CST@1) INTEGER_CST@2)", Even if

[PATCH] use local range for one more pattern in match.pd

2023-09-14 Thread Jiufu Guo via Gcc-patches
Hi, For "get_global_range_query" SSA_NAME_RANGE_INFO can be queried. For "get_range_query", it could get more context-aware range info. And look at the implementation of "get_range_query", it returns global range if no local fun info. ATTRIBUTE_RETURNS_NONNULL inline range_query *

Re: [PATCH] Checking undefined_p before using the vr

2023-09-12 Thread Jiufu Guo via Gcc-patches
Hi, Richard Biener writes: > On Thu, 7 Sep 2023, Jiufu Guo wrote: > >> Hi, >> >> As discussed in PR111303: >> >> For pattern "(X + C) / N": "div (plus@3 @0 INTEGER_CST@1) INTEGER_CST@2)", >> Even if "X" has value-range and "X + C" does not overflow, "@3" may still >> be undefined. Like

Re: [PATCH V5 1/4] rs6000: build constant via li;rotldi

2023-09-07 Thread Jiufu Guo via Gcc-patches
Hi, Gentle ping... BR, Jeff (Jiufu Guo) Jiufu Guo writes: > Hi, > > If a constant is possible to be rotated to/from a positive or negative > value which "li" can generated, then "li;rotldi" can be used to build > the constant. > > Compare with the previous version: >

[PATCH] Checking undefined_p before using the vr

2023-09-06 Thread Jiufu Guo via Gcc-patches
Hi, As discussed in PR111303: For pattern "(X + C) / N": "div (plus@3 @0 INTEGER_CST@1) INTEGER_CST@2)", Even if "X" has value-range and "X + C" does not overflow, "@3" may still be undefined. Like below example: _3 = _2 + -5; if (0 != 0) goto ; [34.00%] else goto ; [66.00%] ;; succ:

Re: [PATCH V6] Optimize '(X - N * M) / N' to 'X / N - M' if valid

2023-09-03 Thread Jiufu Guo via Gcc-patches
Hi, Richard Biener writes: > On Fri, 1 Sep 2023, Jiufu Guo wrote: > >> Hi, >> >> Integer expression "(X - N * M) / N" can be optimized to "X / N - M" with >> the below conditions: >> 1. There is no wrap/overflow/underflow. >>wrap/overflow/underflow breaks the arithmetic operation. >> 2.

[PATCH V6] Optimize '(X - N * M) / N' to 'X / N - M' if valid

2023-09-01 Thread Jiufu Guo via Gcc-patches
Hi, Integer expression "(X - N * M) / N" can be optimized to "X / N - M" with the below conditions: 1. There is no wrap/overflow/underflow. wrap/overflow/underflow breaks the arithmetic operation. 2. "X - N * M" and "X" are not of opposite sign. Here, the operation "/" would be "trunc_div",

[PATCH V4 2/2] rs6000: use mtvsrws to move sf from si p9

2023-08-30 Thread Jiufu Guo via Gcc-patches
Hi, As mentioned in PR108338, on p9, we could use mtvsrws to implement the bitcast from SI to SF (or lowpart DI to SF). For code: *(long long*)buff = di; float f = *(float*)(buff); "sldi 9,3,32 ; mtvsrd 1,9 ; xscvspdpn 1,1" is generated. A better one would be "mtvsrws 1,3 ; xscvspdpn 1,1".

[PATCH V4 1/2] rs6000: optimize moving to sf from highpart di

2023-08-30 Thread Jiufu Guo via Gcc-patches
Hi, Currently, we have the pattern "movsf_from_si2" which was trying to support moving high part DI to SF. The pattern looks like: XX:SF=bitcast:SF(subreg(YY:DI>>32),0) It only accepts the "ashiftrt" for ">>", but "lshiftrt" is also ok. And the offset of "subreg" is hard code 0, which only works

Re: [PATCH V1 1/2] light expander sra v0

2023-08-30 Thread Jiufu Guo via Gcc-patches
Hi Richard, Thanks so much for your great review! Richard Biener writes: > On Wed, 23 Aug 2023, Jiufu Guo wrote: > >> >> Hi, >> >> I just updated the patch. We could review this one. >> >> Compare with previous patch: >> https://gcc.gnu.org/pipermail/gcc-patches/2023-August/627287.html

Re: Bind RTL to a TREE expr (Re: [Bug target/111166])

2023-08-29 Thread Jiufu Guo via Gcc-patches
Hi Richard, Thanks a lot for your great comments! Richard Biener writes: > On Tue, 29 Aug 2023, Jiufu Guo wrote: > >> >> Hi Richard, >> >> Thanks a lot for your quick reply! >> >> Richard Biener writes: >> >> > On Tue, 29 Aug 2023, Jiufu Guo wrote: >> > >> >> >> >> Hi All! >> >> >> >>

Re: Bind RTL to a TREE expr (Re: [Bug target/111166])

2023-08-29 Thread Jiufu Guo via Gcc-patches
Hi Richard, Thanks a lot for your quick reply! Richard Biener writes: > On Tue, 29 Aug 2023, Jiufu Guo wrote: > >> >> Hi All! >> >> "rguenth at gcc dot gnu.org" writes: >> >> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66 >> ... >> > >> > >> > At RTL expansion time we store to

Re: Ping^^ [PATCH V5 2/2] Optimize '(X - N * M) / N' to 'X / N - M' if valid

2023-08-29 Thread Jiufu Guo via Gcc-patches
Hi Richard, Thanks a lot for your review! Richard Biener writes: > On Wed, 23 Aug 2023, guojiufu wrote: > >> Hi, >> >> I would like to have a gentle ping... >> >> BR, >> Jeff (Jiufu Guo) >> >> On 2023-08-07 10:45, guojiufu via Gcc-patches wrote: >> > Hi, >> > >> > Gentle ping... >> > >>

Bind RTL to a TREE expr (Re: [Bug target/111166])

2023-08-28 Thread Jiufu Guo via Gcc-patches
Hi All! "rguenth at gcc dot gnu.org" writes: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66 ... > > > At RTL expansion time we store to D.2865 where it's DECL_RTL is r82:TI so > we can hardly fix it there. Only a later pass could figure each of the > insns fully define the reg. > >

[PATCH] rs6000: mark tieable between INT and FLOAT

2023-08-27 Thread Jiufu Guo via Gcc-patches
Hi, For PowerPC, some INT mode and FLOAT modes can be marked as tieable, for example: DI<->DF. One note SFmode is special, it would only tieable with itself. I updated previous patch more reasonable: https://gcc.gnu.org/pipermail/gcc-patches/2023-January/609504.html Bootstrap and regtest pass

[PATCH V5 1/4] rs6000: build constant via li;rotldi

2023-08-23 Thread Jiufu Guo via Gcc-patches
Hi, If a constant is possible to be rotated to/from a positive or negative value which "li" can generated, then "li;rotldi" can be used to build the constant. Compare with the previous version: https://gcc.gnu.org/pipermail/gcc-patches/2023-July/623528.html This patch just did minor changes to

[PATCH V1 1/2] light expander sra v0

2023-08-22 Thread Jiufu Guo via Gcc-patches
Hi, I just updated the patch. We could review this one. Compare with previous patch: https://gcc.gnu.org/pipermail/gcc-patches/2023-August/627287.html This version: * Supports bitfield access from one register. * Allow return scalar registers cleaned via contructor. Bootstrapped and

Re: [PATCH 1/2] light expander sra v0

2023-08-14 Thread Jiufu Guo via Gcc-patches
Hi, Jiufu Guo writes: > Hi, > > There are a few PRs about the issues on the struct parameters and > returns, like PRs 69143/65421/108073. > > we could consider introducing a light SRA in the expander to > handle those parameters and returns in aggregate type, if they > are passed through

[PATCH 2/2] combine nonconstant_array walker and expander_sra walker

2023-08-13 Thread Jiufu Guo via Gcc-patches
Hi, In the light-expander-sra, each statement in each basic-block of a function need to be analyzed, and there is a similar behavior in checking variable which need to be stored in the stack. These per-stmt analyses can be combined to improve cache locality. Bootstrapped and regtested on

[PATCH 1/2] light expander sra v0

2023-08-13 Thread Jiufu Guo via Gcc-patches
Hi, There are a few PRs about the issues on the struct parameters and returns, like PRs 69143/65421/108073. we could consider introducing a light SRA in the expander to handle those parameters and returns in aggregate type, if they are passed through registers. For access to the fields of the

Re: [RFC] light expander sra for parameters and returns

2023-08-05 Thread Jiufu Guo via Gcc-patches
7fe3b53b 100644 >> >> --- a/gcc/expr.cc >> >> +++ b/gcc/expr.cc >> >> @@ -100,6 +100,7 @@ static void do_tablejump (rtx, machine_mode, rtx, >> >> rtx, rtx, >> >> static rtx const_vector_from_tree (tree); >> >> static tree t

Re: [RFC] light expander sra for parameters and returns

2023-08-03 Thread Jiufu Guo via Gcc-patches
+ set_scalar_rtx_for_aggregate_access (parm, regs); >> +} >> } >>else if (data->stack_parm == 0 && !TYPE_EMPTY_P (data->arg.type)) >> { >> @@ -3716,6 +3735,10 @@ assign_parms (tree fndecl) >>else >> set_d

Re: [PATCH V5 1/2] Add overflow API for plus minus mult on range

2023-08-02 Thread Jiufu Guo via Gcc-patches
Hi, I would like to have a ping on this patch. BR, Jeff (Jiufu Guo) Jiufu Guo writes: > Hi, > > As discussed in previous reviews, adding overflow APIs to range-op > would be useful. Those APIs could help to check if overflow happens > when operating between two 'range's, like: plus, minus,

Re: [RFC] light expander sra for parameters and returns

2023-08-01 Thread Jiufu Guo via Gcc-patches
Hi, Jiufu Guo via Gcc-patches writes: > Hi, > > Richard Biener writes: > >> On Mon, 24 Jul 2023, Jiufu Guo wrote: >> >>> >>> Hi Martin, >>> >>> Not sure about your current option about re-using the ipa-sra code >>> in th

Re: [RFC] light expander sra for parameters and returns

2023-08-01 Thread Jiufu Guo via Gcc-patches
b/gcc/testsuite/gcc.target/powerpc/pr65421-2.c @@ -0,0 +1,32 @@ +/* PR target/65421 */ +/* { dg-options "-O2" } */ +/* { dg-require-effective-target powerpc_elfv2 } */ +/* { dg-require-effective-target has_arch_ppc64 } */ + +typedef struct FLOATS +{ + double a[3]; +} FLOATS; + +

Re: [RFC] light expander sra for parameters and returns

2023-07-23 Thread Jiufu Guo via Gcc-patches
Guo) Jiufu Guo via Gcc-patches writes: > Hi Martin, > > Jiufu Guo via Gcc-patches writes: > >> Hi, >> >> Martin Jambor writes: >> >>> Hi, >>> >>> On Tue, May 30 2023, Richard Biener wrote: >>>> On Mon, 29 May 2023, Jiufu

[PATCH V5 1/2] Add overflow API for plus minus mult on range

2023-07-18 Thread Jiufu Guo via Gcc-patches
Hi, As discussed in previous reviews, adding overflow APIs to range-op would be useful. Those APIs could help to check if overflow happens when operating between two 'range's, like: plus, minus, and mult. Previous discussions are here:

[PATCH V5 2/2] Optimize '(X - N * M) / N' to 'X / N - M' if valid

2023-07-18 Thread Jiufu Guo via Gcc-patches
Hi, Integer expression "(X - N * M) / N" can be optimized to "X / N - M" if there is no wrap/overflow/underflow and "X - N * M" has the same sign with "X". Compare the previous version: https://gcc.gnu.org/pipermail/gcc-patches/2023-July/624067.html - APIs: overflow, nonnegative_p and

Re: [PATCH V4] Optimize '(X - N * M) / N' to 'X / N - M' if valid

2023-07-18 Thread Jiufu Guo via Gcc-patches
Hi, Andrew MacLeod writes: > On 7/17/23 09:45, Jiufu Guo wrote: >> Should we decide we would like it in general, it wouldnt be hard to add to irange.  wi_fold() cuurently returns null, it could easily return a bool indicating if an overflow happened, and wi_fold_in_parts and

Re: [PATCH V4] Optimize '(X - N * M) / N' to 'X / N - M' if valid

2023-07-17 Thread Jiufu Guo via Gcc-patches
Hi, Richard Biener writes: > On Fri, 14 Jul 2023, Andrew MacLeod wrote: > >> >> On 7/14/23 09:37, Richard Biener wrote: >> > On Fri, 14 Jul 2023, Aldy Hernandez wrote: >> > >> >> I don't know what you're trying to accomplish here, as I haven't been >> >> following the PR, but adding all

Re: [PATCH V4] Optimize '(X - N * M) / N' to 'X / N - M' if valid

2023-07-17 Thread Jiufu Guo via Gcc-patches
Hi Andrew, Aldy and Richard, Thanks a lot for all your very helpful comments! Andrew MacLeod writes: > On 7/14/23 09:37, Richard Biener wrote: >> On Fri, 14 Jul 2023, Aldy Hernandez wrote: >> >>> I don't know what you're trying to accomplish here, as I haven't been >>> following the PR, but

Re: [RFC] light expander sra for parameters and returns

2023-07-13 Thread Jiufu Guo via Gcc-patches
Hi Martin, Jiufu Guo via Gcc-patches writes: > Hi, > > Martin Jambor writes: > >> Hi, >> >> On Tue, May 30 2023, Richard Biener wrote: >>> On Mon, 29 May 2023, Jiufu Guo wrote: >>> >>>> Hi, >>>> >>>> Previ

[PATCH V4] Optimize '(X - N * M) / N' to 'X / N - M' if valid

2023-07-11 Thread Jiufu Guo via Gcc-patches
Hi, Integer expression "(X - N * M) / N" can be optimized to "X / N - M" if there is no wrap/overflow/underflow and "X - N * M" has the same sign with "X". Compare the previous version: https://gcc.gnu.org/pipermail/gcc-patches/2023-June/623028.html - The APIs for checking overflow of range

Re: [PATCH V3] Optimize '(X - N * M) / N' to 'X / N - M' if valid

2023-07-04 Thread Jiufu Guo via Gcc-patches
Hi Richard/Andrew! Richard Biener writes: > On Thu, 29 Jun 2023, Jiufu Guo wrote: > >> >> Hi, >> >> Jiufu Guo writes: >> >> > Hi, >> > >> > Integer expression "(X - N * M) / N" can be optimized to "X / N - M" if >> > there is no wrap/overflow/underflow and "X - N * M" has the same sign >>

Re: ping^^^^: [PATCH V2] rs6000: Enhance lowpart/highpart DI->SF by mtvsrws/mtvsrd

2023-07-04 Thread Jiufu Guo via Gcc-patches
Hi, I just submit a new version: https://gcc.gnu.org/pipermail/gcc-patches/2023-July/623533.html So, we could ignore this ping and check the new version. BR, Jeff (Jiufu Guo) Jiufu Guo via Gcc-patches writes: > Hi, > > Gentle ping ... > > Jiufu Guo via Gcc-patches writes: &

[PATCH V3] rs6000: Enhance lowpart/highpart DI->SF by mtvsrws/mtvsrd

2023-07-04 Thread Jiufu Guo via Gcc-patches
Hi, As mentioned in PR108338, on p9, we could use mtvsrws to implement the bitcast from SI#0 to SF (or lowpart DI to SF). For code: *(long long*)buff = di; float f = *(float*)(buff); "sldi 9,3,32 ; mtvsrd 1,9 ; xscvspdpn 1,1" is generated. But "mtvsrws 1,3 ; xscvspdpn 1,1" would be better.

ping^^^^: [PATCH V2] rs6000: Enhance lowpart/highpart DI->SF by mtvsrws/mtvsrd

2023-07-03 Thread Jiufu Guo via Gcc-patches
Hi, Gentle ping ... Jiufu Guo via Gcc-patches writes: > Gentle ping... > > Jiufu Guo via Gcc-patches writes: > >> Gentle ping... >> >> Jiufu Guo via Gcc-patches writes: >> >>> Hi >>> >>> I would like to ping this patch for stag

[PATCH V4 1/4] rs6000: build constant via li;rotldi

2023-07-03 Thread Jiufu Guo via Gcc-patches
Hi, If a constant is possible to be rotated to/from a positive or negative value from "li", then "li;rotldi" can be used to build the constant. Compare with the previous version: https://gcc.gnu.org/pipermail/gcc-patches/2023-June/621961.html This patch just did minor changes to the style and

Re: [PATCH V3 1/4] rs6000: build constant via li;rotldi

2023-06-28 Thread Jiufu Guo via Gcc-patches
Hi, Jiufu Guo via Gcc-patches writes: > Hi! > > Segher Boessenkool writes: > >> Hi! >> >> On Fri, Jun 16, 2023 at 04:34:12PM +0800, Jiufu Guo wrote: >>> +/* Check if value C can be built by 2 instructions: one is 'li', another is >>>

Re: [PATCH V3] Optimize '(X - N * M) / N' to 'X / N - M' if valid

2023-06-28 Thread Jiufu Guo via Gcc-patches
Hi, Jiufu Guo writes: > Hi, > > Integer expression "(X - N * M) / N" can be optimized to "X / N - M" if > there is no wrap/overflow/underflow and "X - N * M" has the same sign > with "X". > > Compare with the previous version: > https://gcc.gnu.org/pipermail/gcc-patches/2023-June/620896.html

[PATCH V3] Optimize '(X - N * M) / N' to 'X / N - M' if valid

2023-06-28 Thread Jiufu Guo via Gcc-patches
Hi, Integer expression "(X - N * M) / N" can be optimized to "X / N - M" if there is no wrap/overflow/underflow and "X - N * M" has the same sign with "X". Compare with the previous version: https://gcc.gnu.org/pipermail/gcc-patches/2023-June/620896.html This version changes: 1. Remove the

Re: ping^^: [PATCH] rs6000: Enable const_anchor for 'addi'

2023-06-18 Thread Jiufu Guo via Gcc-patches
Hi! David Edelsohn writes: > This Message Is From an External Sender > This message came from outside your organization. > > On Tue, May 30, 2023 at 11:00 PM Jiufu Guo wrote: > > Gentle ping... > > Jiufu Guo via Gcc-patches writes: > > > Gentle pi

Re: [PATCH] Check SCALAR_INT_MODE_P in try_const_anchors

2023-06-18 Thread Jiufu Guo via Gcc-patches
Hi, Richard Biener writes: > On Fri, 16 Jun 2023, Jiufu Guo wrote: > >> Hi, >> >> The const_anchor in cse.cc supports integer constants only. >> There is a "gcc_assert (SCALAR_INT_MODE_P (mode))" in >> try_const_anchors. >> >> In the latest code, some non-integer modes are used with const

Re: [PATCH V3 1/4] rs6000: build constant via li;rotldi

2023-06-18 Thread Jiufu Guo via Gcc-patches
Hi! Segher Boessenkool writes: > Hi! > > On Fri, Jun 16, 2023 at 04:34:12PM +0800, Jiufu Guo wrote: >> +/* Check if value C can be built by 2 instructions: one is 'li', another is >> + rotldi. >> + >> + If so, *SHIFT is set to the shift operand of rotldi(rldicl), and *MASK >> + is set

[PATCH V3 1/4] rs6000: build constant via li;rotldi

2023-06-16 Thread Jiufu Guo via Gcc-patches
Hi, If a constant is possible to be rotated to/from a positive or negative value from "li", then "li;rotldi" can be used to build the constant. Compare with the previous version, those one-line abstraction codes are removed. https://gcc.gnu.org/pipermail/gcc-patches/2023-June/621001.html

[PATCH] Check SCALAR_INT_MODE_P in try_const_anchors

2023-06-16 Thread Jiufu Guo via Gcc-patches
Hi, The const_anchor in cse.cc supports integer constants only. There is a "gcc_assert (SCALAR_INT_MODE_P (mode))" in try_const_anchors. In the latest code, some non-integer modes are used with const int. For examples: "set (mem/c:BLK (xx) (const_int 0 [0])" occur in md files of rs6000, i386,

Re: [PATCH] rs6000: replace '(const_int 0)' to 'unspec:BLK [(const_int 0)]' for stack_tie

2023-06-15 Thread Jiufu Guo via Gcc-patches
Hi, Segher Boessenkool writes: > On Thu, Jun 15, 2023 at 03:00:40PM +0800, Jiufu Guo wrote: >> >> This is the existing pattern. It may be read as an action >> >> to clean an unknown-size memory block. >> > >> > Including a size zero memory block, yes. BLKmode was originally to do >> >

Re: [PATCH] rs6000: replace '(const_int 0)' to 'unspec:BLK [(const_int 0)]' for stack_tie

2023-06-15 Thread Jiufu Guo via Gcc-patches
Hi, Segher Boessenkool writes: > Hi! > > On Wed, Jun 14, 2023 at 05:18:15PM +0800, Xi Ruoyao wrote: >> The generic issue here is to fix (not "papering over") the signed >> overflow, we need to perform the addition in a target machine mode. We >> may always use Pmode (IIRC const_anchor was

Re: [PATCH] rs6000: replace '(const_int 0)' to 'unspec:BLK [(const_int 0)]' for stack_tie

2023-06-15 Thread Jiufu Guo via Gcc-patches
Hi, Segher Boessenkool writes: > Hi! > > On Wed, Jun 14, 2023 at 12:06:29PM +0800, Jiufu Guo wrote: >> Segher Boessenkool writes: >> I'm also thinking about other solutions: >> 1. "set (mem/c:BLK (reg/f:DI 1 1) (const_int 0 [0])" >> This is the existing pattern. It may be read as an

Re: [PATCH] rs6000: replace '(const_int 0)' to 'unspec:BLK [(const_int 0)]' for stack_tie

2023-06-14 Thread Jiufu Guo via Gcc-patches
Hi, Richard Sandiford writes: > Richard Biener writes: >> AFAIU this special instruction is only supposed to prevent >> code motion (of stack memory accesses?) across this instruction? >> I'd say a >> >> (may_clobber (mem:BLK (reg:DI 1 1))) >> >> might be more to the point? I've used

Re: [PATCH] rs6000: replace '(const_int 0)' to 'unspec:BLK [(const_int 0)]' for stack_tie

2023-06-14 Thread Jiufu Guo via Gcc-patches
Hi, Richard Biener writes: > On Wed, 14 Jun 2023, Jiufu Guo wrote: > >> >> Hi, >> >> Segher Boessenkool writes: >> >> > Hi! >> > >> > As I said in a reply to the original patch: not okay. Sorry. >> >> Thanks a lot for your comments! >> I'm also thinking about other solutions: >> 1. "set

Re: [PATCH] rs6000: replace '(const_int 0)' to 'unspec:BLK [(const_int 0)]' for stack_tie

2023-06-13 Thread Jiufu Guo via Gcc-patches
Hi, Segher Boessenkool writes: > Hi! > > As I said in a reply to the original patch: not okay. Sorry. Thanks a lot for your comments! I'm also thinking about other solutions: 1. "set (mem/c:BLK (reg/f:DI 1 1) (const_int 0 [0])" This is the existing pattern. It may be read as an action

Re: [PATCH] rs6000: replace '(const_int 0)' to 'unspec:BLK [(const_int 0)]' for stack_tie

2023-06-13 Thread Jiufu Guo via Gcc-patches
Hi Segher, David, David Edelsohn writes: > On Tue, Jun 13, 2023 at 2:16 PM Segher Boessenkool > wrote: >> >> Hi! >> >> On Tue, Jun 13, 2023 at 10:15:49AM +0800, Jiufu Guo wrote: >> > David Edelsohn writes: >> > > >> > > This definitely seems to be a better solution. >> > > >> > > The

Re: [PATCH] rs6000: replace '(const_int 0)' to 'unspec:BLK [(const_int 0)]' for stack_tie

2023-06-13 Thread Jiufu Guo via Gcc-patches
Hi, Xi Ruoyao writes: > On Tue, 2023-06-13 at 20:23 +0800, Jiufu Guo via Gcc-patches wrote: > >> Compare with previous version, this addes ChangeLog and removes >> const_anchor parts. >> https://gcc.gnu.org/pipermail/gcc-patches/2023-June/621356.html. > > [Off t

Re: [PATCH 1/4] rs6000: build constant via li;rotldi

2023-06-13 Thread Jiufu Guo via Gcc-patches
Hi, David Edelsohn writes: > On Mon, Jun 12, 2023 at 11:30 PM Jiufu Guo wrote: >> >> >> Hi David, >> >> David Edelsohn writes: >> > On Wed, Jun 7, 2023 at 9:55 PM Jiufu Guo wrote: >> > >> > Hi, >> > >> > This patch checks if a constant is possible to be rotated to/from a >> > positive

[PATCH] rs6000: replace '(const_int 0)' to 'unspec:BLK [(const_int 0)]' for stack_tie

2023-06-13 Thread Jiufu Guo via Gcc-patches
Hi, For stack_tie, currently below insn is generated: (insn 15 14 16 3 (parallel [ (set (mem/c:BLK (reg/f:DI 1 1) [1 A8]) (const_int 0 [0])) ]) "/home/guojiufu/temp/gdb.c":13:3 922 {stack_tie} (nil)) It is "set (mem/c:BLK (reg/f:DI 1 1) (const_int 0

Re: [PATCH 4/4] rs6000: build constant via li/lis;rldic

2023-06-13 Thread Jiufu Guo via Gcc-patches
Hi David, Thanks for your valuable comments! David Edelsohn writes: > > On Wed, Jun 7, 2023 at 9:56 PM Jiufu Guo wrote: > > Hi, > > This patch checks if a constant is possible to be built by "li;rldic". > We only need to take care of "negative li", other forms do not need to check. >

Re: [PATCH 3/4] rs6000: build constant via li/lis;rldicl/rldicr

2023-06-12 Thread Jiufu Guo via Gcc-patches
Hi, David Edelsohn writes: > > On Wed, Jun 7, 2023 at 9:56 PM Jiufu Guo wrote: > > Hi, > > This patch checks if a constant is possible left/right cleaned on a rotated > value from a negative value of "li/lis". If so, we can build the constant > through "li/lis ; rldicl/rldicr". > >

Re: [PATCH 1/4] rs6000: build constant via li;rotldi

2023-06-12 Thread Jiufu Guo via Gcc-patches
Hi David, David Edelsohn writes: > On Wed, Jun 7, 2023 at 9:55 PM Jiufu Guo wrote: > > Hi, > > This patch checks if a constant is possible to be rotated to/from a positive > or negative value from "li". If so, we could use "li;rotldi" to build it. > > Bootstrap and regtest pass on

Re: Ping^^: [PATCH V2] extract DF/SF/SI/HI/QI subreg from parameter word on stack

2023-06-12 Thread Jiufu Guo via Gcc-patches
Hi, Jeff Law writes: > On 5/10/23 19:20, Jiufu Guo wrote: >> >> Hi, >> >> I would like to ping: >> https://gcc.gnu.org/pipermail/gcc-patches/2023-January/609396.html >> >> We know there are a few issues related to aggregate parameter and >> returns. I'm thinking if it is ok for trunk to use

Re: [PATCH] Make sure SCALAR_INT_MODE_P before invoke try_const_anchors

2023-06-12 Thread Jiufu Guo via Gcc-patches
Hi, Jeff Law writes: > On 6/11/23 23:44, Jiufu Guo wrote: >> Richard Biener writes: >> >>> On Fri, 9 Jun 2023, Jiufu Guo wrote: >>> Hi, Richard Biener writes: > On Fri, 9 Jun 2023, Jiufu Guo wrote: > >> >> Hi, >> >> Richard Biener writes:

Re: [PATCH] rs6000: replace '(const_int 0)' to 'unspec:BLK [(const_int 0)]' for stack_tie

2023-06-12 Thread Jiufu Guo via Gcc-patches
Hi David, David Edelsohn writes: > Hi, Jiufu > > This definitely seems to be a better solution. > > The TARGET_CONST_ANCHOR change should not be part of this patch. Also > there is no ChangeLog for the patch. Thanks a lot for your quick review!! And sorry for the sending this patch in a

[PATCH] rs6000: replace '(const_int 0)' to 'unspec:BLK [(const_int 0)]' for stack_tie

2023-06-12 Thread Jiufu Guo via Gcc-patches
Hi, For stack_tie, currently below insn is generated: (insn 15 14 16 3 (parallel [ (set (mem/c:BLK (reg/f:DI 1 1) [1 A8]) (const_int 0 [0])) ]) "/home/guojiufu/temp/gdb.c":13:3 922 {stack_tie} (nil)) It is "set (mem/c:BLK (reg/f:DI 1 1) (const_int 0

Re: [PATCH] Make sure SCALAR_INT_MODE_P before invoke try_const_anchors

2023-06-12 Thread Jiufu Guo via Gcc-patches
Hi, Richard Biener writes: > On Mon, 12 Jun 2023, Jiufu Guo wrote: > >> Richard Biener writes: >> >> > On Fri, 9 Jun 2023, Jiufu Guo wrote: >> > >> >> >> >> Hi, >> >> >> >> Richard Biener writes: >> >> >> >> > On Fri, 9 Jun 2023, Jiufu Guo wrote: >> >> > >> >> >> >> >> >> Hi, >> >> >>

Re: [PATCH] Make sure SCALAR_INT_MODE_P before invoke try_const_anchors

2023-06-11 Thread Jiufu Guo via Gcc-patches
Richard Biener writes: > On Fri, 9 Jun 2023, Jiufu Guo wrote: > >> >> Hi, >> >> Richard Biener writes: >> >> > On Fri, 9 Jun 2023, Jiufu Guo wrote: >> > >> >> >> >> Hi, >> >> >> >> Richard Biener writes: >> >> >> >> > On Fri, 9 Jun 2023, Richard Sandiford wrote: >> >> > >> >> >> guojiufu

Re: [PATCH V2] Optimize '(X - N * M) / N' to 'X / N - M' if valid

2023-06-11 Thread Jiufu Guo via Gcc-patches
Hi, Thanks for your comments! Segher Boessenkool writes: > Hi! > > On Wed, Jun 07, 2023 at 04:21:11PM +0800, Jiufu Guo wrote: >> This patch tries to optimize "(X - N * M) / N" to "X / N - M". >> For C code, "/" towards zero (trunc_div), and "X - N * M" maybe >> wrap/overflow/underflow. So,

Re: [PATCH V2] Optimize '(X - N * M) / N' to 'X / N - M' if valid

2023-06-09 Thread Jiufu Guo via Gcc-patches
Hi, Richard Biener writes: > On Wed, 7 Jun 2023, Jiufu Guo wrote: > >> Hi, >> >> This patch tries to optimize "(X - N * M) / N" to "X / N - M". >> For C code, "/" towards zero (trunc_div), and "X - N * M" maybe >> wrap/overflow/underflow. So, it is valid that "X - N * M" does >> not cross

Re: [PATCH] Make sure SCALAR_INT_MODE_P before invoke try_const_anchors

2023-06-09 Thread Jiufu Guo via Gcc-patches
Hi, Richard Biener writes: > On Fri, 9 Jun 2023, Jiufu Guo wrote: > >> >> Hi, >> >> Richard Biener writes: >> >> > On Fri, 9 Jun 2023, Richard Sandiford wrote: >> > >> >> guojiufu writes: >> >> > Hi, >> >> > >> >> > On 2023-06-09 16:00, Richard Biener wrote: >> >> >> On Fri, 9 Jun 2023,

Re: [PATCH] Make sure SCALAR_INT_MODE_P before invoke try_const_anchors

2023-06-09 Thread Jiufu Guo via Gcc-patches
Hi, Richard Biener writes: > On Fri, 9 Jun 2023, Richard Sandiford wrote: > >> guojiufu writes: >> > Hi, >> > >> > On 2023-06-09 16:00, Richard Biener wrote: >> >> On Fri, 9 Jun 2023, Jiufu Guo wrote: >> >> >> >>> Hi, >> >>> >> >>> As checking the code, there is a "gcc_assert

[PATCH] Make sure SCALAR_INT_MODE_P before invoke try_const_anchors

2023-06-08 Thread Jiufu Guo via Gcc-patches
Hi, As checking the code, there is a "gcc_assert (SCALAR_INT_MODE_P (mode))" in "try_const_anchors". This assert seems correct because the function try_const_anchors cares about integer values currently, and modes other than SCALAR_INT_MODE_P are not needed to support. This patch makes sure

[PATCH 3/4] rs6000: build constant via li/lis;rldicl/rldicr

2023-06-07 Thread Jiufu Guo via Gcc-patches
Hi, This patch checks if a constant is possible left/right cleaned on a rotated value from a negative value of "li/lis". If so, we can build the constant through "li/lis ; rldicl/rldicr". Bootstrap and regtest pass on ppc64{,le}. Is this ok for trunk? BR, Jeff (Jiufu) gcc/ChangeLog:

[PATCH 2/4] rs6000: build constant via lis;rotldi

2023-06-07 Thread Jiufu Guo via Gcc-patches
Hi, This patch checks if a constant is possible to be rotated to/from a negative value from "lis". If so, we could use "lis;rotldi" to build it. The positive value of "lis" does not need to be analyzed. Because if a constant can be rotated from the positive value of "lis", it also can be

[PATCH 4/4] rs6000: build constant via li/lis;rldic

2023-06-07 Thread Jiufu Guo via Gcc-patches
Hi, This patch checks if a constant is possible to be built by "li;rldic". We only need to take care of "negative li", other forms do not need to check. For example, "negative lis" is just a "negative li" with an additional shift. Bootstrap and regtest pass on ppc64{,le}. Is this ok for trunk?

[PATCH 1/4] rs6000: build constant via li;rotldi

2023-06-07 Thread Jiufu Guo via Gcc-patches
Hi, This patch checks if a constant is possible to be rotated to/from a positive or negative value from "li". If so, we could use "li;rotldi" to build it. Bootstrap and regtest pass on ppc64{,le}. Is this ok for trunk? BR, Jeff (Jiufu) gcc/ChangeLog: * config/rs6000/rs6000.cc

[PATCH V2 0/4] rs6000: build constant via li/lis;rldicX

2023-06-07 Thread Jiufu Guo via Gcc-patches
Hi, These patches are just minor changes based on previous version/comments. https://gcc.gnu.org/pipermail/gcc-patches/2023-February/611286.html https://gcc.gnu.org/pipermail/gcc-patches/2023-June/620489.html And also update the wording for patches in this series. For a given constant, it would

[PATCH V2] Optimize '(X - N * M) / N' to 'X / N - M' if valid

2023-06-07 Thread Jiufu Guo via Gcc-patches
Hi, This patch tries to optimize "(X - N * M) / N" to "X / N - M". For C code, "/" towards zero (trunc_div), and "X - N * M" maybe wrap/overflow/underflow. So, it is valid that "X - N * M" does not cross zero and does not wrap/overflow/underflow. Compare with previous version:

Re: [PATCH 1/4] rs6000: build constant via li;rotldi

2023-06-07 Thread Jiufu Guo via Gcc-patches
Hi David, David Edelsohn writes: > > Hi, Jiufu > * config/rs6000/rs6000.cc (can_be_rotated_to_possitive_li): New > function. > (can_be_rotated_to_negative_li): New function. > (can_be_built_by_li_and_rotldi): New function. > (rs6000_emit_set_long_const): Call

Re: ping^^: [PATCH] rs6000: Enable const_anchor for 'addi'

2023-06-01 Thread Jiufu Guo via Gcc-patches
Hi David, Thanks! David Edelsohn writes: > This Message Is From an External Sender > This message came from outside your organization. > > On Tue, May 30, 2023 at 11:00 PM Jiufu Guo wrote: > > Gentle ping... > > Jiufu Guo via Gcc-patches writes: > > &g

Re: [RFC] light expander sra for parameters and returns

2023-06-01 Thread Jiufu Guo via Gcc-patches
Hi, Richard Biener writes: > On Mon, 29 May 2023, Jiufu Guo wrote: > >> Hi, >> >> Previously, I was investigating some struct parameters and returns related >> PRs 69143/65421/108073. >> >> Investigating the issues case by case, and drafting patches for each of >> them one by one. This

Re: [RFC] light expander sra for parameters and returns

2023-06-01 Thread Jiufu Guo via Gcc-patches
Hi, Martin Jambor writes: > Hi, > > On Tue, May 30 2023, Richard Biener wrote: >> On Mon, 29 May 2023, Jiufu Guo wrote: >> >>> Hi, >>> >>> Previously, I was investigating some struct parameters and returns related >>> PRs 69143/65421/108073. >>> >>> Investigating the issues case by case,

Re: [PATCH] Optimized "(X - N * M) / N + M" to "X / N" if valid

2023-05-31 Thread Jiufu Guo via Gcc-patches
Hi, Jiufu Guo via Gcc-patches writes: > Hi, > > Richard Biener writes: > >> On Wed, 17 May 2023, Jiufu Guo wrote: >> >>> Hi, >>> >>> This patch tries to optimize "(X - N * M) / N + M" to "X / N". >> >> But

Re: [PATCH] Optimized "(X - N * M) / N + M" to "X / N" if valid

2023-05-31 Thread Jiufu Guo via Gcc-patches
Hi, Richard Biener writes: > On Wed, 17 May 2023, Jiufu Guo wrote: > >> Hi, >> >> This patch tries to optimize "(X - N * M) / N + M" to "X / N". > > But if that's valid why not make the transform simpler and transform > (X - N * M) / N to X / N - M instead? Great catch! If "N * M" is not

ping^^: [PATCH] rs6000: Enable const_anchor for 'addi'

2023-05-30 Thread Jiufu Guo via Gcc-patches
Gentle ping... Jiufu Guo via Gcc-patches writes: > Gentle ping... > > Jiufu Guo via Gcc-patches writes: > >> Hi, >> >> I'm thinking that we may enable this patch for stage1, so ping it. >> https://gcc.gnu.org/pipermail/gcc-patches/2022-October/

Ping^^^ [PATCH 0/4] rs6000: build constant via li/lis;rldicX

2023-05-30 Thread Jiufu Guo via Gcc-patches
Gentle ping... Jiufu Guo via Gcc-patches writes: > Hi, > > I would like to ping these patches. > [0/4] > https://gcc.gnu.org/pipermail/gcc-patches/2023-February/611286.html > [1/4] > https://gcc.gnu.org/pipermail/gcc-patches/2023-February/611287.html > [2/4] > ht

ping^^^: [PATCH V2] rs6000: Enhance lowpart/highpart DI->SF by mtvsrws/mtvsrd

2023-05-30 Thread Jiufu Guo via Gcc-patches
Gentle ping... Jiufu Guo via Gcc-patches writes: > Gentle ping... > > Jiufu Guo via Gcc-patches writes: > >> Hi >> >> I would like to ping this patch for stage1: >> https://gcc.gnu.org/pipermail/gcc-patches/2023-February/612168.html >> >

[RFC] light expander sra for parameters and returns

2023-05-28 Thread Jiufu Guo via Gcc-patches
Hi, Previously, I was investigating some struct parameters and returns related PRs 69143/65421/108073. Investigating the issues case by case, and drafting patches for each of them one by one. This would help us to enhance code incrementally. While, this way, patches would interact with each

Re: ping: [PATCH] rs6000: Enable const_anchor for 'addi'

2023-05-17 Thread Jiufu Guo via Gcc-patches
Gentle ping... Jiufu Guo via Gcc-patches writes: > Hi, > > I'm thinking that we may enable this patch for stage1, so ping it. > https://gcc.gnu.org/pipermail/gcc-patches/2022-October/603530.html > > BR, > Jeff (Jiufu) > > Jiufu Guo writes: > >>

ping^^^ [PATCH] rs6000: mark tieable between INT and FLOAT

2023-05-17 Thread Jiufu Guo via Gcc-patches
Gentle ping... Jiufu Guo via Gcc-patches writes: > Hi, > > I would ping this patch for stage1: > https://gcc.gnu.org/pipermail/gcc-patches/2023-January/609504.html > > BR, > Jeff (Jiufu) > > Jiufu Guo via Gcc-patches writes: > >> Hi, >> >> G

ping^^: [PATCH V2] rs6000: Enhance lowpart/highpart DI->SF by mtvsrws/mtvsrd

2023-05-17 Thread Jiufu Guo via Gcc-patches
Gentle ping... Jiufu Guo via Gcc-patches writes: > Hi > > I would like to ping this patch for stage1: > https://gcc.gnu.org/pipermail/gcc-patches/2023-February/612168.html > > BR, > Jeff (Jiufu) > > Jiufu Guo writes: > >> Hi, >> >> Compa

[PATCH] Optimized "(X - N * M) / N + M" to "X / N" if valid

2023-05-17 Thread Jiufu Guo via Gcc-patches
Hi, This patch tries to optimize "(X - N * M) / N + M" to "X / N". As per the discussions in PR108757, we know this transformation is valid only under some conditions. For C code, "/" towards zero (trunc_div), and "X - N * M" maybe wrap/overflow/underflow. So, it is valid that "X - N * M" does

Ping^^: [PATCH V2] extract DF/SF/SI/HI/QI subreg from parameter word on stack

2023-05-10 Thread Jiufu Guo via Gcc-patches
Hi, I would like to ping: https://gcc.gnu.org/pipermail/gcc-patches/2023-January/609396.html We know there are a few issues related to aggregate parameter and returns. I'm thinking if it is ok for trunk to use this patch to resolve part of those issues. BR, Jeff (Jiufu) Jiufu Guo via Gcc

Re: [PATCH V5] Use reg mode to move sub blocks for parameters and returns

2023-05-09 Thread Jiufu Guo via Gcc-patches
Hi, Jeff Law writes: > On 5/3/23 23:49, guojiufu wrote: >> Hi, >> >> On 2023-05-01 03:00, Jeff Law wrote: >>> On 3/16/23 21:39, Jiufu Guo wrote: Hi, When assigning a parameter to a variable, or assigning a variable to return value with struct type, and the parameter/return

ping: [PATCH V2] rs6000: Add new patterns rlwinm with mask

2023-04-25 Thread Jiufu Guo via Gcc-patches
Hi, I would like to ping this for comments. https://gcc.gnu.org/pipermail/gcc-patches/2023-February/611821.html In this patch, "subreg:DI (x:SI)" is used. I' thinking that this may be a concern, while it maybe acceptable for current code. BR, Jeff (Jiufu) Jiufu Guo writes: > Hi, > > Compare

ping: [PATCH] rs6000: Enable const_anchor for 'addi'

2023-04-25 Thread Jiufu Guo via Gcc-patches
Hi, I'm thinking that we may enable this patch for stage1, so ping it. https://gcc.gnu.org/pipermail/gcc-patches/2022-October/603530.html BR, Jeff (Jiufu) Jiufu Guo writes: > Hi, > > There is a functionality as const_anchor in cse.cc. This const_anchor > supports to generate new constants

Ping^^ [PATCH 0/4] rs6000: build constant via li/lis;rldicX

2023-04-25 Thread Jiufu Guo via Gcc-patches
/gcc-patches/2023-February/611289.html [4/4] https://gcc.gnu.org/pipermail/gcc-patches/2023-February/611290.html Any sugguestions for the code functionality/style or to make it easy for review, please point out, thanks in advance! BR, Jeff (Jiufu) Jiufu Guo via Gcc-patches writes: >

  1   2   3   4   >