[Bug rtl-optimization/68432] [6 Regression] internal compiler error: in expand_insn, at optabs.c:6947

2015-12-02 Thread rsandifo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68432

--- Comment #16 from rsandifo at gcc dot gnu.org  
---
Author: rsandifo
Date: Wed Dec  2 09:08:49 2015
New Revision: 231161

URL: https://gcc.gnu.org/viewcvs?rev=231161=gcc=rev
Log:
PR 68432: Add a target hook to control size/speed optab choices

The problem in the PR is that some i386 optabs FAIL when
optimising for size rather than speed.  The gimple level generally
needs access to this information before calling the generator,
so this patch adds a new hook to say whether an optab should
be used when optimising for size or speed.  It also has a "both"
option for cases where we want code that is optimised for both
size and speed.

I've passed the optab to the target hook because I think in most
cases that's more useful than the instruction code.  We could pass
both if there's a use for it though.

At the moment the match-and-simplify code doesn't have direct access
to the target block, so for now I've used "both" there.

Tested on x86_64-linux-gnu and powerpc64-linux-gnu.

gcc/
PR tree-optimization/68432
* coretypes.h (optimization_type): New enum.
* doc/tm.texi.in (TARGET_OPTAB_SUPPORTED_P): New hook.
* doc/tm.texi: Regenerate.
* target.def (optab_supported_p): New hook.
* targhooks.h (default_optab_supported_p): Declare.
* targhooks.c (default_optab_supported_p): New function.
* predict.h (function_optimization_type): Declare.
(bb_optimization_type): Likewise.
* predict.c (function_optimization_type): New function.
(bb_optimization_type): Likewise.
* optabs-query.h (convert_optab_handler): Define an overload
that takes an optimization type.
(direct_optab_handler): Likewise.
* optabs-query.c (convert_optab_handler): Likewise.
(direct_optab_handler): Likewise.
* internal-fn.h (direct_internal_fn_supported_p): Take an
optimization_type argument.
* internal-fn.c (direct_optab_supported_p): Likewise.
(multi_vector_optab_supported_p): Likewise.
(direct_internal_fn_supported_p): Likewise.
* builtins.c (replacement_internal_fn): Update call to
direct_internal_fn_supported_p.
* gimple-match-head.c (build_call_internal): Likewise.
* tree-vect-patterns.c (vect_recog_pow_pattern): Likewise.
* tree-vect-stmts.c (vectorizable_internal_function): Likewise.
* tree.c (maybe_build_call_expr_loc): Likewise.
* config/i386/i386.c (ix86_optab_supported_p): New function.
(TARGET_OPTAB_SUPPORTED_P): Define.
* config/i386/i386.md (asinxf2): Remove optimize_insn_for_size_p check.
(asin2, acosxf2, acos2, log1pxf2, log1p2)
(expNcorexf3, expxf2, exp2, exp10xf2, exp102, exp2xf2)
(exp22, expm1xf2, expm12, ldexpxf3, ldexp3)
(scalbxf3, scalb3, rint2, round2)
(xf2, 2): Likewise.

gcc/testsuite/
* gcc.target/i386/pr68432-1.c: New test.
* gcc.target/i386/pr68432-2.c: Likewise.
* gcc.target/i386/pr68432-3.c: Likewise.

Added:
trunk/gcc/testsuite/gcc.target/i386/pr68432-1.c
trunk/gcc/testsuite/gcc.target/i386/pr68432-2.c
trunk/gcc/testsuite/gcc.target/i386/pr68432-3.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/builtins.c
trunk/gcc/config/i386/i386.c
trunk/gcc/config/i386/i386.md
trunk/gcc/coretypes.h
trunk/gcc/doc/tm.texi
trunk/gcc/doc/tm.texi.in
trunk/gcc/gimple-match-head.c
trunk/gcc/internal-fn.c
trunk/gcc/internal-fn.h
trunk/gcc/optabs-query.c
trunk/gcc/optabs-query.h
trunk/gcc/predict.c
trunk/gcc/predict.h
trunk/gcc/target.def
trunk/gcc/targhooks.c
trunk/gcc/targhooks.h
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-vect-patterns.c
trunk/gcc/tree-vect-stmts.c
trunk/gcc/tree.c

[Bug rtl-optimization/68432] [6 Regression] internal compiler error: in expand_insn, at optabs.c:6947

2015-12-02 Thread rsandifo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68432

rsandifo at gcc dot gnu.org  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #17 from rsandifo at gcc dot gnu.org  
---
Patch applied.

[Bug rtl-optimization/68432] [6 Regression] internal compiler error: in expand_insn, at optabs.c:6947

2015-12-01 Thread rsandifo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68432

--- Comment #14 from rsandifo at gcc dot gnu.org  
---
(In reply to Tobias Burnus from comment #13)
> (In reply to rsand...@gcc.gnu.org from comment #10)
> > Series finally posted here:
> >   https://gcc.gnu.org/ml/gcc-patches/2015-11/msg03020.html
> 
> Part 05's gcc/genattrtab.c changes do not apply. (All other parts and the
> chunks for other files in Part 05 do with some line-offset fuzzy.)
> 
> That's a bit surprising as git lists r229184 of 2015-10-22 as latest change
> for that file while the patch set was posted on 2015-11-25. - Six of the
> gcc/genattrtab.c chunks do not apply and none of them looks trivial.
> 
> 
> For instance, the patch changes:
> @@ -4770,6 +4804,7 @@ gen_insn_reserv (md_rtx_info *info)
>memset (, 0, sizeof (attr));
>attr.name = DEF_ATTR_STRING (XSTR (def, 0));
>attr.loc = info->loc;
> +  attr.type = AT_INSN;
> 
>decl->name= DEF_ATTR_STRING (XSTR (def, 0));
>decl->default_latency = XINT (def, 1);
> 
> 
> But in the trunk, I only see:
>   4753  gen_insn_reserv (md_rtx_info *info)
>   4754  {
>   4755struct insn_reserv *decl = oballoc (struct insn_reserv);
>   4756rtx def = info->def;
>   4757
>   4758decl->name= DEF_ATTR_STRING (XSTR (def, 0));
>   4759decl->default_latency = XINT (def, 1);

Sorry, this was because I'd based it on top of r231103.

[Bug rtl-optimization/68432] [6 Regression] internal compiler error: in expand_insn, at optabs.c:6947

2015-12-01 Thread rsandifo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68432

--- Comment #15 from rsandifo at gcc dot gnu.org  
---
Created attachment 36882
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36882=edit
proposed patch

Here's an alternative to the 22-patch series, testing now.

[Bug rtl-optimization/68432] [6 Regression] internal compiler error: in expand_insn, at optabs.c:6947

2015-11-27 Thread burnus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68432

--- Comment #13 from Tobias Burnus  ---
(In reply to rsand...@gcc.gnu.org from comment #10)
> Series finally posted here:
>   https://gcc.gnu.org/ml/gcc-patches/2015-11/msg03020.html

Part 05's gcc/genattrtab.c changes do not apply. (All other parts and the
chunks for other files in Part 05 do with some line-offset fuzzy.)

That's a bit surprising as git lists r229184 of 2015-10-22 as latest change for
that file while the patch set was posted on 2015-11-25. - Six of the
gcc/genattrtab.c chunks do not apply and none of them looks trivial.


For instance, the patch changes:
@@ -4770,6 +4804,7 @@ gen_insn_reserv (md_rtx_info *info)
   memset (, 0, sizeof (attr));
   attr.name = DEF_ATTR_STRING (XSTR (def, 0));
   attr.loc = info->loc;
+  attr.type = AT_INSN;

   decl->name= DEF_ATTR_STRING (XSTR (def, 0));
   decl->default_latency = XINT (def, 1);


But in the trunk, I only see:
  4753  gen_insn_reserv (md_rtx_info *info)
  4754  {
  4755struct insn_reserv *decl = oballoc (struct insn_reserv);
  4756rtx def = info->def;
  4757
  4758decl->name= DEF_ATTR_STRING (XSTR (def, 0));
  4759decl->default_latency = XINT (def, 1);

[Bug rtl-optimization/68432] [6 Regression] internal compiler error: in expand_insn, at optabs.c:6947

2015-11-27 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68432

Markus Trippelsdorf  changed:

   What|Removed |Added

 CC||burnus at gcc dot gnu.org

--- Comment #12 from Markus Trippelsdorf  ---
*** Bug 68587 has been marked as a duplicate of this bug. ***

[Bug rtl-optimization/68432] [6 Regression] internal compiler error: in expand_insn, at optabs.c:6947

2015-11-25 Thread rsandifo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68432

rsandifo at gcc dot gnu.org  changed:

   What|Removed |Added

URL||https://gcc.gnu.org/ml/gcc-
   ||patches/2015-11/msg03020.ht
   ||ml

--- Comment #10 from rsandifo at gcc dot gnu.org  
---
Series finally posted here:

  https://gcc.gnu.org/ml/gcc-patches/2015-11/msg03020.html

Sorry for the delay.

[Bug rtl-optimization/68432] [6 Regression] internal compiler error: in expand_insn, at optabs.c:6947

2015-11-25 Thread Joost.VandeVondele at mat dot ethz.ch
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68432

--- Comment #11 from Joost VandeVondele  
---
(In reply to rsand...@gcc.gnu.org from comment #10)
> Series finally posted here:
> 
>   https://gcc.gnu.org/ml/gcc-patches/2015-11/msg03020.html
> 
> Sorry for the delay.

Many thanks for fixing this seemingly non-trivial issue!

[Bug rtl-optimization/68432] [6 Regression] internal compiler error: in expand_insn, at optabs.c:6947

2015-11-24 Thread rsandifo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68432

--- Comment #9 from rsandifo at gcc dot gnu.org  
---
Just as an update: the series is now tested and hopefully ready to post.  I
just need to clear a few things first.

[Bug rtl-optimization/68432] [6 Regression] internal compiler error: in expand_insn, at optabs.c:6947

2015-11-23 Thread rsandifo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68432

--- Comment #8 from rsandifo at gcc dot gnu.org  
---
I have a patch series that fixes the bug but I need to make sure
that it works on other targets that use the "enabled" attribute,
and run it through an all-target test.  I'm hoping to post the
patches tomorrow.

[Bug rtl-optimization/68432] [6 Regression] internal compiler error: in expand_insn, at optabs.c:6947

2015-11-22 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68432

Markus Trippelsdorf  changed:

   What|Removed |Added

 CC||hjl.tools at gmail dot com

--- Comment #7 from Markus Trippelsdorf  ---
*** Bug 68488 has been marked as a duplicate of this bug. ***

[Bug rtl-optimization/68432] [6 Regression] internal compiler error: in expand_insn, at optabs.c:6947

2015-11-21 Thread rsandifo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68432

--- Comment #6 from rsandifo at gcc dot gnu.org  
---
The problem is with the size/speed-dependent FAILs.
I've been working on a fix, but unfortunately it's going to
be quite invasive (though hopefully makes things cleaner).

[Bug rtl-optimization/68432] [6 Regression] internal compiler error: in expand_insn, at optabs.c:6947

2015-11-21 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68432

--- Comment #5 from Markus Trippelsdorf  ---
Started with r230487

[Bug rtl-optimization/68432] [6 Regression] internal compiler error: in expand_insn, at optabs.c:6947

2015-11-21 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68432

Markus Trippelsdorf  changed:

   What|Removed |Added

 CC||trippels at gcc dot gnu.org

--- Comment #4 from Markus Trippelsdorf  ---
Also happens when building ffmpeg:

markus@x4 ffmpeg % cat libvpxenc.i
unsigned a;
float b;
__attribute__((cold)) void vpx_init() { a = round(b); }

markus@x4 ffmpeg % gcc -w -O2 -ffast-math -c libvpxenc.i
libvpxenc.i: In function ‘vpx_init’:
libvpxenc.i:3:45: internal compiler error: in expand_insn, at optabs.c:6947

[Bug rtl-optimization/68432] [6 Regression] internal compiler error: in expand_insn, at optabs.c:6947

2015-11-19 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68432

Richard Biener  changed:

   What|Removed |Added

 CC||rsandifo at gcc dot gnu.org
   Target Milestone|--- |6.0

[Bug rtl-optimization/68432] [6 Regression] internal compiler error: in expand_insn, at optabs.c:6947

2015-11-19 Thread rsandifo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68432

--- Comment #1 from rsandifo at gcc dot gnu.org  
---
Just to check: is this x86_64-linux-gnu?

[Bug rtl-optimization/68432] [6 Regression] internal compiler error: in expand_insn, at optabs.c:6947

2015-11-19 Thread rsandifo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68432

rsandifo at gcc dot gnu.org  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2015-11-19
   Assignee|unassigned at gcc dot gnu.org  |rsandifo at gcc dot 
gnu.org
 Ever confirmed|0   |1

--- Comment #3 from rsandifo at gcc dot gnu.org  
---
Confirmed.  I can reproduce this with the anint_1.f90 test
when compiled with -fprofile-generate and then -fprofile-use.
The problem is the optimize_insn_for_size_p tests.

[Bug rtl-optimization/68432] [6 Regression] internal compiler error: in expand_insn, at optabs.c:6947

2015-11-19 Thread Joost.VandeVondele at mat dot ethz.ch
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68432

Joost VandeVondele  changed:

   What|Removed |Added

 CC||Joost.VandeVondele at mat dot 
ethz
   ||.ch

--- Comment #2 from Joost VandeVondele  
---
(In reply to rsand...@gcc.gnu.org from comment #1)
> Just to check: is this x86_64-linux-gnu?

yes it is.x86_64-pc-linux-gnu