Re: [PATCH] Fix PR15346

2014-12-02 Thread Joseph Myers
On Tue, 2 Dec 2014, Joseph Myers wrote: > (y), 1)) is not the right condition for rounding away). The following Ada > testcase test_round_div.adb will generate a ROUND_DIV_EXPR which is I should add that I'm not sure if Ada requires correct rounding for fixed-point division converted to integ

Re: [PATCH] Fix PR15346

2014-12-02 Thread Joseph Myers
On Tue, 2 Dec 2014, Richard Biener wrote: > > I'm not sure if these forms of division actually occur in places where > > this could cause a problem, but it does look like Ada may enable you to > > generate ROUND_DIV_EXPR. > > Hmm. I thought I was following what extract_muldiv_1 does (but of co

Re: [PATCH] Fix PR15346

2014-12-02 Thread Richard Biener
On Mon, 1 Dec 2014, Marc Glisse wrote: > On Mon, 1 Dec 2014, Richard Biener wrote: > > > The following fixes the oldest bug in my list of assigned PRs, namely > > combining A / CST / CST' to A / (CST * CST'). extract_muldiv does > > this in fold-const.c (but it fails to optimize to zero when CST

Re: [PATCH] Fix PR15346

2014-12-02 Thread Richard Biener
On Mon, 1 Dec 2014, Joseph Myers wrote: > On Mon, 1 Dec 2014, Richard Biener wrote: > > > +/* Combine two successive divisions. */ > > +(for div (trunc_div ceil_div floor_div round_div exact_div) > > This doesn't seem correct for all kinds of division and signedness of > arguments. > > TRUNC_

Re: [PATCH] Fix PR15346

2014-12-01 Thread Joseph Myers
On Mon, 1 Dec 2014, Richard Biener wrote: > +/* Combine two successive divisions. */ > +(for div (trunc_div ceil_div floor_div round_div exact_div) This doesn't seem correct for all kinds of division and signedness of arguments. TRUNC_DIV_EXPR (C division) and EXACT_DIV_EXPR should be OK regar

Re: [PATCH] Fix PR15346

2014-12-01 Thread Marc Glisse
On Mon, 1 Dec 2014, Richard Biener wrote: The following fixes the oldest bug in my list of assigned PRs, namely combining A / CST / CST' to A / (CST * CST'). extract_muldiv does this in fold-const.c (but it fails to optimize to zero when CST * CST' overflows). Bootstrapped and tested on x86_64

Re: [PATCH] Fix PR15346

2014-12-01 Thread Jakub Jelinek
On Mon, Dec 01, 2014 at 04:10:35PM +0100, Richard Biener wrote: > On Mon, 1 Dec 2014, Ulrich Weigand wrote: > > > Richard Biener wrote: > > > > > * Makefile.in (gimple-match.o-warn): Remove -Wno-unused-parameter, > > > add -Wno-unused-but-set-variable. > > > > This seems to cause > > > > cc

Re: [PATCH] Fix PR15346

2014-12-01 Thread Richard Biener
On Mon, 1 Dec 2014, Ulrich Weigand wrote: > Richard Biener wrote: > > > * Makefile.in (gimple-match.o-warn): Remove -Wno-unused-parameter, > > add -Wno-unused-but-set-variable. > > This seems to cause > > cc1plus: error: unrecognized command line option > "-Wno-unused-but-set-variable"

Re: [PATCH] Fix PR15346

2014-12-01 Thread Ulrich Weigand
Richard Biener wrote: > * Makefile.in (gimple-match.o-warn): Remove -Wno-unused-parameter, > add -Wno-unused-but-set-variable. This seems to cause cc1plus: error: unrecognized command line option "-Wno-unused-but-set-variable"

[PATCH] Fix PR15346

2014-12-01 Thread Richard Biener
The following fixes the oldest bug in my list of assigned PRs, namely combining A / CST / CST' to A / (CST * CST'). extract_muldiv does this in fold-const.c (but it fails to optimize to zero when CST * CST' overflows). Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk. Richa