Re: [PATCH] middle-end: Improve RTL expansion in expand_mul_overflow,

2020-07-11 Thread Segher Boessenkool
Hi all, On Thu, Jul 09, 2020 at 10:29:44AM +0200, Jakub Jelinek via Gcc-patches wrote: > On Thu, Jul 09, 2020 at 09:17:46AM +0100, Richard Sandiford wrote: > > If target-independent code is going to optimise for “no subreg operand” > > targets like nvptx, I think it needs to know that the target w

Re: [PATCH] middle-end: Improve RTL expansion in expand_mul_overflow,

2020-07-10 Thread Richard Sandiford
"Roger Sayle" writes: > Hi Richard, > >> On Thu, Jul 09, 2020 at 09:17:46AM +0100, Richard Sandiford wrote: >>> > + res = force_reg (mode, res); >>> >>> In general, this can be dangerous performance-wise on targets where >>> subregs are free. If the move survives to the register allocator

RE: [PATCH] middle-end: Improve RTL expansion in expand_mul_overflow,

2020-07-10 Thread Roger Sayle
Hi Richard, > On Thu, Jul 09, 2020 at 09:17:46AM +0100, Richard Sandiford wrote: >> > +res = force_reg (mode, res); >> >> In general, this can be dangerous performance-wise on targets where >> subregs are free. If the move survives to the register allocators, >> it increases the risk

Re: [PATCH] middle-end: Improve RTL expansion in expand_mul_overflow,

2020-07-09 Thread Richard Sandiford
Jakub Jelinek writes: > On Thu, Jul 09, 2020 at 09:17:46AM +0100, Richard Sandiford wrote: >> > --- a/gcc/internal-fn.c >> > +++ b/gcc/internal-fn.c >> > @@ -1627,6 +1627,9 @@ expand_mul_overflow (location_t loc, tree lhs, tree >> > arg0, tree arg1, >> > profile_pr

Re: [PATCH] middle-end: Improve RTL expansion in expand_mul_overflow,

2020-07-09 Thread Jakub Jelinek via Gcc-patches
On Thu, Jul 09, 2020 at 09:17:46AM +0100, Richard Sandiford wrote: > > --- a/gcc/internal-fn.c > > +++ b/gcc/internal-fn.c > > @@ -1627,6 +1627,9 @@ expand_mul_overflow (location_t loc, tree lhs, tree > > arg0, tree arg1, > > profile_probability::very_likely ()); >

Re: [PATCH] middle-end: Improve RTL expansion in expand_mul_overflow,

2020-07-09 Thread Richard Sandiford
"Roger Sayle" writes: > This patch improves the RTL that the middle-end generates for testing > signed overflow following a widening multiplication. During this > expansion the middle-end generates a truncation which can get used > multiple times. Placing this intermediate value in a pseudo regi