Re: A case where PHI-OPT pessimizes the code

2012-04-23 Thread Alan Modra
On Mon, Apr 23, 2012 at 06:07:52PM +0200, Steven Bosscher wrote: > On Mon, Apr 23, 2012 at 4:43 PM, Alan Modra wrote: > > On Mon, Apr 23, 2012 at 02:50:13PM +0200, Steven Bosscher wrote: > >> csui = (ONEUL << a); > >> b = ((csui & cst) != 0); > >> if (b) > >> return 1; > >> else > >>

Re: A case where PHI-OPT pessimizes the code

2012-04-23 Thread Steven Bosscher
On Mon, Apr 23, 2012 at 2:50 PM, Steven Bosscher wrote: > I will file a PR for this later today, maybe after trying on a few > other targets to see if this is a middle-end problem or a target > issue. This is now PR target/53087 (http://gcc.gnu.org/PR53087). Actually the poor code looks to be co

Re: A case where PHI-OPT pessimizes the code

2012-04-23 Thread Steven Bosscher
On Mon, Apr 23, 2012 at 4:43 PM, Alan Modra wrote: > On Mon, Apr 23, 2012 at 02:50:13PM +0200, Steven Bosscher wrote: >> csui = (ONEUL << a); >> b = ((csui & cst) != 0); >> if (b) >> return 1; >> else >> return 0; > > We (powerpc) would be much better if this were > > csui = (ONE

Re: A case where PHI-OPT pessimizes the code

2012-04-23 Thread Jeff Law
On 04/23/2012 06:27 AM, Richard Guenther wrote: On Mon, Apr 23, 2012 at 2:15 PM, Steven Bosscher wrote: Hello, I ported the code to expand switch() statements with bit tests from stmt.c to GIMPLE, and looked at the resulting code to verify that the transformation applies correctly, when I noti

Re: A case where PHI-OPT pessimizes the code

2012-04-23 Thread Alan Modra
On Mon, Apr 23, 2012 at 02:50:13PM +0200, Steven Bosscher wrote: > csui = (ONEUL << a); > b = ((csui & cst) != 0); > if (b) > return 1; > else > return 0; We (powerpc) would be much better if this were csui = (ONEUL << a); return (csui & cst) >> a; Other targets would proba

Re: A case where PHI-OPT pessimizes the code

2012-04-23 Thread Steven Bosscher
On Mon, Apr 23, 2012 at 2:27 PM, Richard Guenther wrote: > int foo (_Bool b) > { >  if (b) >    return 1; >  else >    return 0; > } Indeed PHI-OPT performs the transformation on this code, too. But the resulting code on powerpc64 is fine: [stevenb@gcc1-power7 gcc]$ cat t.c.149t.optimized ;; Fu

Re: A case where PHI-OPT pessimizes the code

2012-04-23 Thread Richard Guenther
On Mon, Apr 23, 2012 at 2:15 PM, Steven Bosscher wrote: > Hello, > > I ported the code to expand switch() statements with bit tests from > stmt.c to GIMPLE, and looked at the resulting code to verify that the > transformation applies correctly, when I noticed this strange PHI-OPT > transformation

A case where PHI-OPT pessimizes the code

2012-04-23 Thread Steven Bosscher
Hello, I ported the code to expand switch() statements with bit tests from stmt.c to GIMPLE, and looked at the resulting code to verify that the transformation applies correctly, when I noticed this strange PHI-OPT transformation that results in worse code for the test case of PR45830 which looks