Re: [RFC] Add new flag to specify output constraint in match.pd

2020-09-02 Thread Alexander Monakov via Gcc
On Wed, 2 Sep 2020, Richard Biener via Gcc wrote: > > Or we could decide that the extra multiplication is not that bad if it > > saves an addition, simplifies the expression, possibly gains more insn > > parallelism, etc, in which case we could just drop the existing hard > > single_use check... >

Re: [RFC] Add new flag to specify output constraint in match.pd

2020-09-02 Thread Feng Xue OS via Gcc
>> >> > >> >> >> >> >> There is a match-folding issue derived from pr94234. A piece of >> >> >> code like: >> >> >> >> >> >> int foo (int n) >> >> >> { >> >> >> int t1 = 8 * n; >> >> >> int t2 = 8 * (n - 1); >> >> >> >> >> >> return t1 - t2; >> >> >> } >> >> >> >> >> >> It

Re: [RFC] Add new flag to specify output constraint in match.pd

2020-09-02 Thread Richard Biener via Gcc
On Wed, Sep 2, 2020 at 9:35 AM Feng Xue OS wrote: > > > > >> > >> >> There is a match-folding issue derived from pr94234. A piece of code > >> >> like: > >> >> > >> >> int foo (int n) > >> >> { > >> >> int t1 = 8 * n; > >> >> int t2 = 8 * (n - 1); > >> >> > >> >> return t1 -

Re: [RFC] Add new flag to specify output constraint in match.pd

2020-09-02 Thread Richard Biener via Gcc
On Wed, Sep 2, 2020 at 9:27 AM Marc Glisse wrote: > > On Wed, 2 Sep 2020, Richard Biener via Gcc wrote: > > > On Mon, Aug 24, 2020 at 8:20 AM Feng Xue OS via Gcc wrote: > >> > There is a match-folding issue derived from pr94234. A piece of code > like: > > int foo (int n

Re: [RFC] Add new flag to specify output constraint in match.pd

2020-09-02 Thread Feng Xue OS via Gcc
> >> >> >> There is a match-folding issue derived from pr94234. A piece of code >> >> like: >> >> >> >> int foo (int n) >> >> { >> >> int t1 = 8 * n; >> >> int t2 = 8 * (n - 1); >> >> >> >> return t1 - t2; >> >> } >> >> >> >> It can be perfectly caught by the rule "(A * C)

Re: [RFC] Add new flag to specify output constraint in match.pd

2020-09-02 Thread Marc Glisse
On Wed, 2 Sep 2020, Richard Biener via Gcc wrote: On Mon, Aug 24, 2020 at 8:20 AM Feng Xue OS via Gcc wrote: There is a match-folding issue derived from pr94234. A piece of code like: int foo (int n) { int t1 = 8 * n; int t2 = 8 * (n - 1); return t1 - t2; } It can

Re: [RFC] Add new flag to specify output constraint in match.pd

2020-09-01 Thread Richard Biener via Gcc
On Mon, Aug 24, 2020 at 8:20 AM Feng Xue OS via Gcc wrote: > > >> There is a match-folding issue derived from pr94234. A piece of code > >> like: > >> > >> int foo (int n) > >> { > >> int t1 = 8 * n; > >> int t2 = 8 * (n - 1); > >> > >> return t1 - t2; > >> } > >> > >> It

Re: [RFC] Add new flag to specify output constraint in match.pd

2020-08-23 Thread Feng Xue OS via Gcc
>> There is a match-folding issue derived from pr94234. A piece of code like: >> >> int foo (int n) >> { >> int t1 = 8 * n; >> int t2 = 8 * (n - 1); >> >> return t1 - t2; >> } >> >> It can be perfectly caught by the rule "(A * C) +- (B * C) -> (A +- B) * >> C", and >>

Re: [RFC] Add new flag to specify output constraint in match.pd

2020-08-23 Thread Marc Glisse
On Fri, 21 Aug 2020, Feng Xue OS via Gcc wrote: There is a match-folding issue derived from pr94234. A piece of code like: int foo (int n) { int t1 = 8 * n; int t2 = 8 * (n - 1); return t1 - t2; } It can be perfectly caught by the rule "(A * C) +- (B * C) -> (A +- B) * C", an

[RFC] Add new flag to specify output constraint in match.pd

2020-08-20 Thread Feng Xue OS via Gcc
Hi, There is a match-folding issue derived from pr94234. A piece of code like: int foo (int n) { int t1 = 8 * n; int t2 = 8 * (n - 1); return t1 - t2; } It can be perfectly caught by the rule "(A * C) +- (B * C) -> (A +- B) * C", and be folded to constant "8". But thi