RE: PR target/52555: attribute optimize is overriding command line options

2013-03-01 Thread Steve Ellcey
Jakub and Aldy, It looks like I am having another problem with this patch. Jakubs earlier patch fixed things for me when building my mips-mti-elf target but I just started building glibc in mips16 mode with the latest compiler and I am running into this assert: mktime.c:147:1: internal compile

Re: PR target/52555: attribute optimize is overriding command line options

2013-02-22 Thread Richard Sandiford
Jakub Jelinek writes: > On Fri, Feb 22, 2013 at 09:31:54AM -0800, Steve Ellcey wrote: >> On Fri, 2013-02-22 at 11:03 +0100, Jakub Jelinek wrote: >> >> > The problem I believe is that Aldy has changed init_optabs and >> > insn-opinit.c >> > to use this_fn_optabs instead of this_target_optabs, but

Re: PR target/52555: attribute optimize is overriding command line options

2013-02-22 Thread Jakub Jelinek
On Fri, Feb 22, 2013 at 09:31:54AM -0800, Steve Ellcey wrote: > On Fri, 2013-02-22 at 11:03 +0100, Jakub Jelinek wrote: > > > The problem I believe is that Aldy has changed init_optabs and insn-opinit.c > > to use this_fn_optabs instead of this_target_optabs, but it is only set in > > invoke_set_c

Re: PR target/52555: attribute optimize is overriding command line options

2013-02-22 Thread Steve Ellcey
On Fri, 2013-02-22 at 11:03 +0100, Jakub Jelinek wrote: > The problem I believe is that Aldy has changed init_optabs and insn-opinit.c > to use this_fn_optabs instead of this_target_optabs, but it is only set in > invoke_set_current_function_hook. During save_target_globals we want to > init this

Re: PR target/52555: attribute optimize is overriding command line options

2013-02-22 Thread Jakub Jelinek
On Thu, Feb 21, 2013 at 11:02:56PM +, Steve Ellcey wrote: > Have you gotten any reports of problems with this patch? It seems to be > sending cc1 into an infinite > loop during the GCC testsuite for me. I am testing the mips-mti-linux-gnu > target and tests like > gcc.target/mips/call-saved

Re: PR target/52555: attribute optimize is overriding command line options

2013-02-21 Thread Aldy Hernandez
Have you gotten any reports of problems with this patch? It seems to be sending cc1 into an infinite loop during the GCC testsuite for me. I am testing the mips-mti-linux-gnu target and tests like gcc.target/mips/call-saved-1.c are causing cc1 to suck up all my memory and swap space before

RE: PR target/52555: attribute optimize is overriding command line options

2013-02-21 Thread Steve Ellcey
On Mon, Feb 18, 2013 at 12:50:59PM -0600, Aldy Hernandez wrote: > OK pending tests? > PR target/52555 > * genopinit.c (raw_optab_handler): Use this_fn_optabs. > (swap_optab_enable): Same. > (init_all_optabs): Use argument instead of global. > * tree.h (struct tree_op

Re: PR target/52555: attribute optimize is overriding command line options

2013-02-18 Thread Jakub Jelinek
On Mon, Feb 18, 2013 at 12:50:59PM -0600, Aldy Hernandez wrote: > OK pending tests? > PR target/52555 > * genopinit.c (raw_optab_handler): Use this_fn_optabs. > (swap_optab_enable): Same. > (init_all_optabs): Use argument instead of global. > * tree.h (struct tree_opt

Re: PR target/52555: attribute optimize is overriding command line options

2013-02-18 Thread Aldy Hernandez
On 02/16/13 05:19, Richard Sandiford wrote: Looks good to me otherwise, thanks. Implemented all your suggestions. Sorry that SWITCHABLE_TARGETS has been so much hassle. TBH, like Jakub says in the PR, I was hoping things like the optimize attribute could use the target_globals stuff too.

Re: PR target/52555: attribute optimize is overriding command line options

2013-02-16 Thread Richard Sandiford
Aldy Hernandez writes: > diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c > index b203cdd..5e98485 100644 > --- a/gcc/config/mips/mips.c > +++ b/gcc/config/mips/mips.c > @@ -16313,7 +16313,26 @@ mips_set_mips16_mode (int mips16_p) >if (mips16_p) > { >if (!mips16_global

Re: PR target/52555: attribute optimize is overriding command line options

2013-02-15 Thread Aldy Hernandez
Looks good, just a few nits. But please wait for Richard's feedback on it. Will do. + this_fn_optabs = fn->optabs ? (struct target_optabs *) fn->optabs + : this_target_optabs; I'd prefer : here be below ? on the line above it. Blame emacs. I use whatever indentation i

Re: PR target/52555: attribute optimize is overriding command line options

2013-02-15 Thread Jakub Jelinek
On Fri, Feb 15, 2013 at 11:23:01AM -0600, Aldy Hernandez wrote: > +2013-02-15 Aldy Hernandez > + Jakub Jelinek > + > + PR target/52555 > + * genopinit.c (raw_optab_handler): Use this_fn_optabs. > + (swap_optab_enable): Same. > + (init_all_optabs): Use argument instead o

Re: PR target/52555: attribute optimize is overriding command line options

2013-02-15 Thread Aldy Hernandez
Actually, thinking more about SWITCHABLE_TARGETS, I don't think this works at all on those targets. this_target_optab is some random optab from whatever has been left there by previous function, it can be either the Eeech... this significantly complicates things. After some further interacti

Re: PR target/52555: attribute optimize is overriding command line options

2013-02-13 Thread Jakub Jelinek
On Wed, Feb 13, 2013 at 12:07:52PM -0600, Aldy Hernandez wrote: > >Sorry, just noticed: > > > >>+ /* If the optabs changed, record it in the node. */ > >>+ if (memcmp (tmp_target_optabs, &default_target_optabs, > >>+ sizeof (struct target_optabs))) > > > >This should be this_target_optab

Re: PR target/52555: attribute optimize is overriding command line options

2013-02-13 Thread Aldy Hernandez
Sorry, just noticed: + /* If the optabs changed, record it in the node. */ + if (memcmp (tmp_target_optabs, &default_target_optabs, + sizeof (struct target_optabs))) This should be this_target_optabs rather than &default_target_optabs. Nothing but target code and initialisers

Re: PR target/52555: attribute optimize is overriding command line options

2013-02-13 Thread Richard Sandiford
Aldy Hernandez writes: > Richard. > > I made all the changes you suggested. > > I also changed other instances of s/this_target_optabs/this_fn_optabs/ > which I forgot in the previous iteration. And I also changed > save_optabs_if_changed() to use this_fn_optabs, since init_all_optabs() > will

Re: PR target/52555: attribute optimize is overriding command line options

2013-02-13 Thread Aldy Hernandez
Richard. I made all the changes you suggested. I also changed other instances of s/this_target_optabs/this_fn_optabs/ which I forgot in the previous iteration. And I also changed save_optabs_if_changed() to use this_fn_optabs, since init_all_optabs() will generate the optabs into this_fn_opt

Re: PR target/52555: attribute optimize is overriding command line options

2013-02-12 Thread Richard Sandiford
Aldy Hernandez writes: >> Rather than: >> >>/* Change optabs if needed. */ >>if (TREE_OPTIMIZATION_OPTABS (opts)) >> this_target_optabs >>= (struct target_optabs *) TREE_OPTIMIZATION_OPTABS (opts); >>else >> this_target_optabs = &default_targe

Re: PR target/52555: attribute optimize is overriding command line options

2013-02-12 Thread Richard Sandiford
Richard Sandiford writes: > Aldy Hernandez writes: >>> Rather than: >>> >>> /* Change optabs if needed. */ >>> if (TREE_OPTIMIZATION_OPTABS (opts)) >>> this_target_optabs >>> = (struct target_optabs *) TREE_OPTIMIZATION_OPTABS (opts); >>> else >>> this

Re: PR target/52555: attribute optimize is overriding command line options

2013-02-12 Thread Aldy Hernandez
Rather than: /* Change optabs if needed. */ if (TREE_OPTIMIZATION_OPTABS (opts)) this_target_optabs = (struct target_optabs *) TREE_OPTIMIZATION_OPTABS (opts); else this_target_optabs = &default_target_optabs; I think it'd be

Re: PR target/52555: attribute optimize is overriding command line options

2013-02-12 Thread Richard Sandiford
Jakub Jelinek writes: > On Mon, Feb 11, 2013 at 06:15:05PM -0600, Aldy Hernandez wrote: >> How does this look? > > Looks good to me. > >> Jakub, what's this you mention in the PR about caching >> __optimize__((3))? You also mention I shouldn't compare against >> this_target_optabs, but default_ta

Re: PR target/52555: attribute optimize is overriding command line options

2013-02-12 Thread Jakub Jelinek
On Tue, Feb 12, 2013 at 09:58:38AM -0600, Aldy Hernandez wrote: > OK for trunk? I'd still prefer Richard to chime in, I'm really not familiar enough with MIPS switchable target stuff. > +/* Recompute the optabs. If they have changed, save the new set of > + optabs in the optimization node OPTN

Re: PR target/52555: attribute optimize is overriding command line options

2013-02-12 Thread Aldy Hernandez
Jakub, what's this you mention in the PR about caching __optimize__((3))? You also mention I shouldn't compare against this_target_optabs, but default_target_optabs. But what if this_target_optabs has changed? (See patch). The reason for that is that this_target_optabs could at that point b

Re: PR target/52555: attribute optimize is overriding command line options

2013-02-12 Thread Jakub Jelinek
On Mon, Feb 11, 2013 at 06:15:05PM -0600, Aldy Hernandez wrote: > How does this look? Looks good to me. > Jakub, what's this you mention in the PR about caching > __optimize__((3))? You also mention I shouldn't compare against > this_target_optabs, but default_target_optabs. But what if > this_

PR target/52555: attribute optimize is overriding command line options

2013-02-11 Thread Aldy Hernandez
The problem here is that -ffast-math is overridden when switching optimization options on a per function basis with __attribute__((optimize("O"))). The x86 ceilf* instructions depend on unsafe math optimizations, but the optabs are created at the beginning of the compilation. When fast math