Re: [tree-tailcall] Check if function returns it's argument

2016-12-09 Thread Richard Biener
On Wed, 7 Dec 2016, Jeff Law wrote: > On 12/06/2016 03:16 AM, Richard Biener wrote: > > On Tue, 6 Dec 2016, Richard Biener wrote: > > > > > On Mon, 5 Dec 2016, Jeff Law wrote: > > > > > > > On 12/02/2016 01:33 AM, Richard Biener wrote: > > > > > > The LHS on the assignment makes it easier to ide

Re: [PATCH] Reassoc zero_one_operation fixes (PR tree-optimization/78726)

2016-12-09 Thread Richard Biener
On Thu, 8 Dec 2016, Jakub Jelinek wrote: > Hi! > > The following testcases show two bugs in zero_one_operation (used during > undistribute optimization) and functions it calls. > The first one (wrong-code) is fixed by the > + tree orig_def = *def; > and > - if (stmts_to_fix.length () > 0) > +

Re: [PATCH] Add support for Fuchsia (OS)

2016-12-09 Thread Andrew Pinski
On Thu, Dec 8, 2016 at 2:55 PM, Josh Conner wrote: > This patch adds support to gcc for the Fuchsia OS > (https://fuchsia.googlesource.com/). > > OK for mainline? A few comments: > +/* Build with PIC by default. */ > +#undef CC1_SPEC > +#define CC1_SPEC "%{!fno-pic:%{!fno-PIC:%{!fpic:%{!fPIC: -

Re: [PR tree-optimization/67955] Exploit PTA in DSE

2016-12-09 Thread Richard Biener
On Wed, Dec 7, 2016 at 12:18 AM, Jeff Law wrote: > > > So I was going through the various DSE related bugs as stumbled across > 67955. > > The basic issue in 67955 is that DSE is too simplistic when trying to > determine if two writes hit the same memory address. There are cases were > PTA analys

[Darwin, PPC] Fix PR71496 by marking pic base loads as non-copyable.

2016-12-09 Thread Iain Sandoe
Hi Segher, Working through my backlog of Darwin patches … this one is needed on trunk and 6.x (although it’s marked as rtl-optimization, it actually prevents bootstrap on the branch with Java enabled). Therefore, if possible, I’d like to get this in before the 6.3 freeze. The Darwin p

Re: Default associative containers constructors/destructor/assignment

2016-12-09 Thread Jonathan Wakely
On 08/12/16 21:40 +0100, François Dumont wrote: On 06/12/2016 12:54, Jonathan Wakely wrote: On 20/11/16 19:14 +0100, François Dumont wrote: Talking about _M_color I just realize that move semantic doesn't copy _M_color. Shouldn't we capture it along with all the other _M_header information ?

Re: libgo patch committed: Copy hash code from Go 1.7 runtime

2016-12-09 Thread Rainer Orth
Hi Ian, > This patch to libgo copies the memory hashing code from the Go 1.7 > runtime. This is particular important because we earlier copied the > hashmap code from Go 1.7, and that changed hash table sizes from prime > numbers to powers of two. The memory hashing code used before this > patch

[PATCH, testsuite] MIPS: Upgrade to R2 for -mnan=2008 and -mabs=2008.

2016-12-09 Thread Toma Tabacu
Hi, The -mnan=2008 and -mabs=2008 options are not supported on pre-R2 targets. This results in failures for tests which use these options, such as nan-2008.c, fabs-2008.c etc. This patch makes the testsuite upgrade to R2 if -mnan=2008 and -mabs=2008 are used as test options. Tested with mips-mti

[PATCH][GCC 5] Fix PR78731

2016-12-09 Thread Richard Biener
The following fixes a jump-threading bug when threading through a backedge (thus it's only applicable to GCC 5). The issue is that when we see a backedge walking the SSA value chain might end up picking up values from a previous iteration. The fix is to add backedge_seen to yet another function

Re: [Darwin, PPC] Fix PR71496 by marking pic base loads as non-copyable.

2016-12-09 Thread Segher Boessenkool
Hi Iain, On Fri, Dec 09, 2016 at 08:45:11AM +, Iain Sandoe wrote: > The Darwin pic base loads (and reloads for non-local-gotos) are not validly > copied (since the pic base label would be duplicated). Thus, this patch marks > them accordingly. > > OK for trunk? > OK for GCC-6 branch? Okay f

RE: [PATCH, testsuite] MIPS: Skip msa-builtins-err.c if there is no assembly output.

2016-12-09 Thread Matthew Fortune
Toma Tabacu writes: > The msa-builtins-err.c test is failing in the following configuration: > -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects > This is because the errors it is checking for are triggered by assembly > generation, which is prevented by -fno-fat-lto-objects. > > This patch fixe

Re: [PATCH] warn on overflow in calls to allocation functions (bugs 77531 and 78284)

2016-12-09 Thread Christophe Lyon
On 9 December 2016 at 00:54, Martin Sebor wrote: >>> +enabled with @option{-Wextra}. >> >> So I think we should in the immediate term not enable this in Wextra. >> However, I think for gcc-8 we should revisit after fixing GCC to be >> cleaner WRT alloc-zero. >> >> So disable alloc-zero by default,

Re: [PATCH] Escape non-printable chars in dumped strings.

2016-12-09 Thread Richard Biener
On Thu, Dec 8, 2016 at 4:00 PM, Martin Liška wrote: > There's a patch that adds a new test-case for that. Ok. > Martin

Re: [PATCH] Escape non-printable chars in dumped strings.

2016-12-09 Thread Richard Biener
On Thu, Dec 8, 2016 at 2:37 PM, Martin Liška wrote: > Hello. > > Following patch changes behavior in pretty_print_string, where all > non-printable > characters are encoded as \x%x. Currently, when some non-printable characters > are directly > printed to a dump file stream. That makes it compli

[PATCH] Enhance analyze_brprob script

2016-12-09 Thread Martin Liška
Following patch enhances scripts and fixed various small issues. Ready to be installed? Martin >From 626b70eb3526d848e2f1741f8b2384c518d2067b Mon Sep 17 00:00:00 2001 From: marxin Date: Fri, 9 Dec 2016 11:00:16 +0100 Subject: [PATCH] Enhance analyze_brprob script contrib/ChangeLog: 2016-12-09

Re: [PATCH] Fix 78550 ICE with bit-field initialization

2016-12-09 Thread Richard Biener
On Thu, Dec 8, 2016 at 5:38 PM, Nathan Sidwell wrote: > This patch fixes 78550, where we ICE in varasm as we discover a > code-generating NOP_EXPR of an INTEGER_CST. output_constructor (varasm.c) > has a STRIP_NOPs, but that leaves the NOP alone, as it is truncating a > regular QI mode operand to

Re: [PATCH] Escape non-printable chars in dumped strings.

2016-12-09 Thread Martin Liška
On 12/09/2016 11:00 AM, Richard Biener wrote: > On Thu, Dec 8, 2016 at 2:37 PM, Martin Liška wrote: >> Hello. >> >> Following patch changes behavior in pretty_print_string, where all >> non-printable >> characters are encoded as \x%x. Currently, when some non-printable >> characters are directly

Re: libgo patch committed: Copy hash code from Go 1.7 runtime

2016-12-09 Thread Sebastian Huber
On 08/12/16 17:37, Ian Lance Taylor wrote: +// For gccgo, use go:linkname to rename compiler-called functions to +// themselves, so that the compiler will export them. +// +//go:linkname memhash runtime.memhash + +const ( + // Constants for multiplication: four random odd 64-bit numbers. +

Re: [PATCH, middle-end]: Fix PR78738, unrecognized insn with -ffast-math

2016-12-09 Thread Richard Biener
On Thu, Dec 8, 2016 at 10:44 PM, Uros Bizjak wrote: > Hello! > > Attached patch fixes fall-out from excess-precision improvements > patch. As shown in the PR, the code throughout the compiler assumes > FLAG_PRECISION_FAST when flag_unsafe_math_optimizations flag is in > effect. The patch puts back

Re: [PATCH] Fix PR78721

2016-12-09 Thread Richard Biener
On Fri, Dec 9, 2016 at 5:25 AM, kugan wrote: > Hi, > > in propagate_vr_accross_jump_function, drop_tree_overflow should be after > fold_convert. Attached patch changes this. > > Bootstrapped and regression tested on x86_64-linux-gnu with no new > regressions. Is this OK for trunk? Ok. Richard.

Re: [PATCH] Escape non-printable chars in dumped strings.

2016-12-09 Thread Richard Biener
On Fri, Dec 9, 2016 at 11:05 AM, Martin Liška wrote: > On 12/09/2016 11:00 AM, Richard Biener wrote: >> On Thu, Dec 8, 2016 at 2:37 PM, Martin Liška wrote: >>> Hello. >>> >>> Following patch changes behavior in pretty_print_string, where all >>> non-printable >>> characters are encoded as \x%x.

Re: [RFC PATCH] avoid printing type suffix with %E (PR c/78165)

2016-12-09 Thread Rainer Orth
Jeff Law writes: > On 11/19/2016 02:04 PM, Martin Sebor wrote: >> On 10/26/2016 02:46 PM, Joseph Myers wrote: >>> On Wed, 26 Oct 2016, Martin Sebor wrote: >>> The attached patch implements one such approach by having the pretty printer recognize the space format flag to suppress the typ

Re: [PATCH] Fill bitregion_{start,end} in store_constructor (PR, tree-optimization/78428).

2016-12-09 Thread Martin Liška
On 11/23/2016 11:49 AM, Richard Biener wrote: > On Wed, Nov 23, 2016 at 11:26 AM, Martin Liška wrote: >> Following patch fixes situation where we do a store to a bitfield which >> is at boundary of a record. This leads to usage of wider store, leading >> to overwriting a following memory location.

[PATCH TEST]Add test for PR78652

2016-12-09 Thread Bin Cheng
Hi, PR78652 was fixed by patch for PR77856, this patch adds a test for it. Test result checked, is it OK? Thanks, bin gcc/testsuite/ChangeLog 2016-12-07 Bin Cheng PR rtl-optimization/78652 * gcc.c-torture/execute/pr78652.c: New test.diff --git a/gcc/testsuite/gcc.c-torture/e

RE: [PATCH, testsuite] MIPS: Upgrade to R2 for -mnan=2008 and -mabs=2008.

2016-12-09 Thread Matthew Fortune
Toma Tabacu > The -mnan=2008 and -mabs=2008 options are not supported on pre-R2 targets. > This results in failures for tests which use these options, such as > nan-2008.c, > fabs-2008.c etc. > > This patch makes the testsuite upgrade to R2 if -mnan=2008 and -mabs=2008 are > used as test options

[PATCH] rs6000: clz/ctz/ffs improvement (PR78683)

2016-12-09 Thread Segher Boessenkool
On CPUs that implement popcnt[wd] but not cnttz[wd] we can do better for the ctz sequences than we do today. CL[TZ]_DEFINED_VALUE_AT_ZERO can return 2, since we always return the same fixed value (only dependent on TARGET_* options). I originally tried to have the generic code handle this; that w

Re: [PATCH] Enhance analyze_brprob script

2016-12-09 Thread Martin Liška
On 12/09/2016 11:02 AM, Martin Liška wrote: > Following patch enhances scripts and fixed various small issues. > > Ready to be installed? > > Martin > I forgot to squash commits, this is the right patch. M. >From c64469dcdf114ab3a432a9006be3d291df62b8a1 Mon Sep 17 00:00:00 2001 From: marxin D

Re: [PR78365] ICE in determine_value_range, at tree-ssa-loo p-niter.c:413

2016-12-09 Thread Martin Jambor
Hi, On Fri, Dec 09, 2016 at 03:36:44PM +1100, kugan wrote: > On 07/12/16 21:08, Martin Jambor wrote: > > On Mon, Nov 28, 2016 at 04:25:00PM +1100, kugan wrote: > > > > ... > > > > > Here is a patch that does this. To fox PR78365, in > > > ipa_get_callee_param_type, I am now checking DECL_ARGUMENTS

[PATCH] Fix PR78742

2016-12-09 Thread Richard Biener
The following fixes the bug for the particular testcase by making cst_and_fits_in_hwi look at the actual value of the constant. There's still underlying issues in dependence analysis (using ints to store HOST_WIDE_INTs, failing to check whether the constants really fit). But this one makes us be

Re: [PATCH, Fortran, pr78672, ctp1, v1] Gfortran test suite failures with a sanitized compiler

2016-12-09 Thread Andre Vehreschild
Hi Mikael, thanks a lot for your comments. Note I also have added the reply to your latest email here. On Thu, 8 Dec 2016 23:49:57 +0100 Mikael Morin wrote: > > diff --git a/gcc/fortran/data.c b/gcc/fortran/data.c > > index 139ce88..4f835b3 100644 > > --- a/gcc/fortran/data.c > > +++ b/gcc/fo

[RFC][PATCH] Sanopt for use-after-scope ASAN_MARK internal functions

2016-12-09 Thread Martin Liška
Hello. I've spent quite some time reading sanopt pass and I eventually decided to come up with quite simplified optimization algorithm for ASAN_MARK internal functions. As the most interesting (common) cases are that an ASAN_MARK unpoison is dominated by entry block (where we unpoison all varia

Re: [PATCH] PR fortran/65173 -- kill off old_cl_list from gfc_namespace.

2016-12-09 Thread Paul Richard Thomas
Hi Steve, In doing the final regtest of the fix for PR44265, I found that charlen_15.f90 is still giving the original error for PR78350. module.c:3419 is seeing (after continuing three times) (gdb) print *e->ts.u.cl->length $12 = {expr_type = 0, ts = {type = 81, kind = 0, u = {derived = 0x20ff570

Re: PR78634: ifcvt/i386 cost updates

2016-12-09 Thread Bernd Schmidt
On 12/03/2016 10:49 AM, Uros Bizjak wrote: Based on the above explanation, the patch is OK. I'll be treating the ifcvt part of it as obvious. However, testing showed an issue with the i386 funcspec-11 test: /* PR target/36936 */ /* { dg-do compile } */ /* { dg-require-effective-target ia32

Re: [PATCH] PR fortran/65173 -- kill off old_cl_list from gfc_namespace.

2016-12-09 Thread Janne Blomqvist
On Fri, Dec 9, 2016 at 1:47 PM, Paul Richard Thomas wrote: > Hi Steve, > > In doing the final regtest of the fix for PR44265, I found that > charlen_15.f90 is still giving the original error for PR78350. > > module.c:3419 is seeing (after continuing three times) > (gdb) print *e->ts.u.cl->length >

Re: [RFC][PATCH] Sanopt for use-after-scope ASAN_MARK internal functions

2016-12-09 Thread Jakub Jelinek
On Fri, Dec 09, 2016 at 12:39:24PM +0100, Martin Liška wrote: > + if (is_gimple_call (stmt) && gimple_call_internal_p (stmt)) > + { > + enum internal_fn ifn = gimple_call_internal_fn (stmt); > + switch (ifn) > + { > + case IFN_ASAN_MARK: > +

Re: [PATCH] DWARF: make signedness explicit for enumerator const values

2016-12-09 Thread Pierre-Marie de Rodat
On 11/18/2016 06:22 PM, Pierre-Marie de Rodat wrote: I agree with you, so I’ll revise to instead add a DW_AT_type attribute to enumeration DIEs to point to a base type. Here is the patch to implement this. Bootstrapped and regtested (GCC’s testsuite) successfuly on x86_64-linux. However, it

Re: Fold strstr (s, t) eq/ne s to strcmp (s, t) eq/ne 0 if strlen (t) is known

2016-12-09 Thread Prathamesh Kulkarni
On 7 December 2016 at 17:36, Jakub Jelinek wrote: > On Wed, Dec 07, 2016 at 05:02:46PM +0530, Prathamesh Kulkarni wrote: >> + if (arg1_len == NULL_TREE) >> + { >> + gimple_stmt_iterator gsi; >> + tree

Re: [Patch, fortran] PR44265 - Link error with reference to parameter array in specification expression

2016-12-09 Thread Paul Richard Thomas
Dear All, Following a discussion on #gfortran with Andre and Dominique the patch has been committed without char_result_[16,17].f90 as revision 243478. This has been one of the most ill-starred of any patch that I have submitted. At the last moment, I found that char_result_14.f90 was suffering f

Re: [PR78365] ICE in determine_value_range, at tree-ssa-loo p-niter.c:413

2016-12-09 Thread Richard Biener
On Fri, Dec 9, 2016 at 11:51 AM, Martin Jambor wrote: > Hi, > > On Fri, Dec 09, 2016 at 03:36:44PM +1100, kugan wrote: >> On 07/12/16 21:08, Martin Jambor wrote: >> > On Mon, Nov 28, 2016 at 04:25:00PM +1100, kugan wrote: >> > >> > ... >> > >> > > Here is a patch that does this. To fox PR78365, in

Re: C++ PATCH to reject initializating flexible array members in constructors (PR c++/72775)

2016-12-09 Thread Marek Polacek
On Thu, Dec 08, 2016 at 01:42:44PM -0700, Martin Sebor wrote: > On 12/08/2016 01:28 PM, Marek Polacek wrote: > > On Thu, Dec 08, 2016 at 02:56:56PM -0500, Nathan Sidwell wrote: > > > On 12/08/2016 01:05 PM, Jason Merrill wrote: > > > > If the problem is the member initializer, we can diagnose that

Re: Fold strstr (s, t) eq/ne s to strcmp (s, t) eq/ne 0 if strlen (t) is known

2016-12-09 Thread Jakub Jelinek
On Fri, Dec 09, 2016 at 05:36:41PM +0530, Prathamesh Kulkarni wrote: > --- a/gcc/tree-ssa-strlen.c > +++ b/gcc/tree-ssa-strlen.c > @@ -2302,7 +2302,81 @@ strlen_optimize_stmt (gimple_stmt_iterator *gsi) > else if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR) > handle_pointe

Re: Ping [PATCH, Fortran, v1] Fix deallocation of nested derived typed components

2016-12-09 Thread Andre Vehreschild
Hi Jerry, thanks for the review. Committed as r243480. Regards, Andre On Thu, 8 Dec 2016 12:10:55 -0800 Jerry DeLisle wrote: > On 12/08/2016 05:42 AM, Andre Vehreschild wrote: > > Ping! > > > > On Fri, 2 Dec 2016 13:28:40 +0100 > > Andre Vehreschild wrote: > > > >> Hi all, > >> > >>

Re: C++ PATCH to reject initializating flexible array members in constructors (PR c++/72775)

2016-12-09 Thread Nathan Sidwell
On 12/08/2016 03:42 PM, Martin Sebor wrote: On 12/08/2016 01:28 PM, Marek Polacek wrote: On Thu, Dec 08, 2016 at 02:56:56PM -0500, Nathan Sidwell wrote: struct Foo { int a; char ary[]; Foo () : ary ("bob"){} Clang accepts this test case although it does reject the originally submitted test

Re: [Patch, Fortran, OOP] PR 61767: ICE in generate_finalization_wrapper at fortran/class.c:1491

2016-12-09 Thread Andre Vehreschild
Hi Janus, yes, that was what I had in mind for the testcase. Now it looks ok to me. - Andre On Thu, 8 Dec 2016 16:41:23 +0100 Janus Weil wrote: > Hi Andre, > > > so when I interpret the testcase correctly, than the finalizer should not be > > called, right? So adding a call abort() in the Fin

[PATCH] Fix PR78699

2016-12-09 Thread Richard Biener
Fixing the cost model for large permuted SLP groups broke this due to the excessive amount of garbage we create. A previous fix for this was (ab-)using the cost-model so this one simply makes a hard upper bound for SLP group sizes. Bootstrap and regtest running on x86_64-unknown-linux-gnu. Rich

Re: Ping [PATCH, Fortran, pr78505, v1] [F08] Coarray source allocation not synchronizing on oversubscribed cores

2016-12-09 Thread Andre Vehreschild
Hi Jerry, thanks for the review. Committed as r243482. Regards, Andre On Thu, 8 Dec 2016 12:12:02 -0800 Jerry DeLisle wrote: > On 12/08/2016 05:43 AM, Andre Vehreschild wrote: > > Ping! > > > > On Fri, 2 Dec 2016 16:46:29 +0100 > > Andre Vehreschild wrote: > > > >> Hi all, > >> > >>

[0/67] Add wrapper classes for machine_modes

2016-12-09 Thread Richard Sandiford
This series includes most of the changes in group C from: https://gcc.gnu.org/ml/gcc/2016-11/msg00033.html The idea is to add wrapper classes around machine_mode_enum for specific groups of modes, such as scalar integers, scalar floats, complex values, etc. This has two main benefits: one sp

[1/67] Add an E_ prefix to mode names and update case statements

2016-12-09 Thread Richard Sandiford
Later patches will add wrapper types for specific classes of mode. E.g. SImode will be a scalar_int_mode, SFmode will be a scalar_float_mode, etc. This patch prepares for that change by adding an E_ prefix to the mode enum values. It also adds #defines that map the unprefixed names to the prefixe

3 further backports to 6.3

2016-12-09 Thread Jakub Jelinek
Hi! My tree-ssa-reassoc.c fix backport for 6 branch depends on 2 other patches, where the testcases don't fail on the branch for those 2, but the issue has been just latent. Are these ok to backport to 6.3 too? Bootstrapped/regtested on x86_64-linux and i686-linux. Jakub 2016-12-09 Jak

[2/67] Make machine_mode a class

2016-12-09 Thread Richard Sandiford
This patch renames enum machine_mode to enum machine_mode_enum and adds a machine_mode wrapper class. The previous patch mechanically replaced mode names in case statements; this one updates other places that should continue to use the enum directly. The patch continues to use enums for static va

[3/67] Add GDB pretty printer for machine mode classes

2016-12-09 Thread Richard Sandiford
This patch adds gdb hooks for printing machine_modes in the natural way. gcc/ * gdbhooks.py (MachineModePrinter): New class. (build_pretty_printer): Use it for machine_modes. diff --git a/gcc/gdbhooks.py b/gcc/gdbhooks.py index 1212312..95f4b95 100644 --- a/gcc/gdbhooks.py +++ b/g

[4/67] Add FOR_EACH iterators for modes

2016-12-09 Thread Richard Sandiford
The new iterators are: - FOR_EACH_MODE_IN_CLASS: iterate over all the modes in a mode class. - FOR_EACH_MODE_FROM: iterate over all the modes in a class, starting at a given mode. - FOR_EACH_WIDER_MODE: iterate over all the modes in a class, starting at the next widest mode after a given mod

[5/67] Small tweak to array_value_type

2016-12-09 Thread Richard Sandiford
Store the type mode in a variable so that a later, more mechanical patch can change its type. gcc/ 2016-11-24 Richard Sandiford Alan Hayward David Sherwood * tree-switch-conversion.c (array_value_type): Only read TYPE_MODE once. Use get_narrowest_mo

[6/67] Make GET_MODE_WIDER return an opt_mode

2016-12-09 Thread Richard Sandiford
GET_MODE_WIDER previously returned VOIDmode if no wider mode exists. That would cause problems with stricter mode classes, since VOIDmode isn't for example a valid scalar integer or floating-point mode. This patch instead makes it return a new opt_mode class, which holds either a T or nothing. g

Re: Pretty printers for versioned namespace

2016-12-09 Thread François Dumont
On 02/12/2016 01:41, Jonathan Wakely wrote: On 01/12/16 22:51 +0100, François Dumont wrote: We needed the StdExpVerAnyPrinter just because of the loopkup for 'std::string' which has to be 'std::__7::string'. But I used similar technique exposed previously to get rid of it. But I don't see any

Re: 3 further backports to 6.3

2016-12-09 Thread Richard Biener
On Fri, 9 Dec 2016, Jakub Jelinek wrote: > Hi! > > My tree-ssa-reassoc.c fix backport for 6 branch depends on 2 other patches, > where the testcases don't fail on the branch for those 2, but the issue has > been just latent. Are these ok to backport to 6.3 too? Yes. Thanks, Richard.

[7/67] Add scalar_float_mode

2016-12-09 Thread Richard Sandiford
This patch adds a scalar_float_mode class, which wraps a mode enum that is known to satisfy SCALAR_FLOAT_MODE_P. Things like "SFmode" now give a scalar_float_mode object instead of a machine_mode. This in turn needs a change to the real.h format_helper, so that it can accept both machine_modes and

[8/67] Simplify gen_trunc/extend_conv_libfunc

2016-12-09 Thread Richard Sandiford
Replace checks of: GET_MODE_CLASS (fmode) != MODE_FLOAT && !DECIMAL_FLOAT_MODE_P (fmode) with !is_a and use MODE_CLASS equality/inequality instead of: (GET_MODE_CLASS (tmode) == MODE_FLOAT && DECIMAL_FLOAT_MODE_P (fmode)) || (GET_MODE_CLASS (fmode) == MODE_FLOAT && DECIMAL_FLOAT_MODE_P (t

[9/67] Add SCALAR_FLOAT_TYPE_MODE

2016-12-09 Thread Richard Sandiford
This patch adds a macro that extracts the TYPE_MODE and forcibly converts it to a scalar_float_mode. The forcible conversion includes a gcc_checking_assert that the mode is a SCALAR_FLOAT_MODE_P. This becomes important as more static type checking is added by later patches. It has the additional

[10/67] Make assemble_real take a scalar_float_mode

2016-12-09 Thread Richard Sandiford
As per subject. gcc/ 2016-11-24 Richard Sandiford Alan Hayward David Sherwood * output.h (assemble_real): Take a scalar_float_mode. * config/arm/arm.c (arm_assemble_integer): Update accordingly. * config/arm/arm.md (consttable_4): Likewise.

Re: [0/67] Add wrapper classes for machine_modes

2016-12-09 Thread Richard Biener
On Fri, Dec 9, 2016 at 1:48 PM, Richard Sandiford wrote: > This series includes most of the changes in group C from: > > https://gcc.gnu.org/ml/gcc/2016-11/msg00033.html > > The idea is to add wrapper classes around machine_mode_enum > for specific groups of modes, such as scalar integers, sca

Re: [PATCH] DWARF: make signedness explicit for enumerator const values

2016-12-09 Thread Mark Wielaard
On Fri, 2016-12-09 at 12:59 +0100, Pierre-Marie de Rodat wrote: > There seems to be only two legal DWARF alternatives to solve this issue: > one is to add a DW_AT_type attribute to DW_TAG_enumerator_type DIEs to > make it point to a base type that specifies the signedness. The other > is to make s

[11/67] Add a float_mode_for_size helper function

2016-12-09 Thread Richard Sandiford
This provides a type-safe way to ask for a float mode and get it as a scalar_float_mode. gcc/ 2016-11-24 Richard Sandiford Alan Hayward David Sherwood * coretypes.h (opt_scalar_float_mode): New typedef. * machmode.h (float_mode_for_size): New functio

[12/67] Use opt_scalar_float_mode when iterating over float modes

2016-12-09 Thread Richard Sandiford
This means that we know when accessing the modes that the size is a compile-time constant, even for SVE. It also enables stricter type safety in later patches. gcc/ 2016-11-24 Richard Sandiford Alan Hayward David Sherwood * machmode.h (mode_iterator::start)

[13/67] Make floatn_mode return an opt_scalar_float_mode

2016-12-09 Thread Richard Sandiford
As per subject. gcc/ 2016-11-24 Richard Sandiford Alan Hayward David Sherwood * target.def (default_floatn_mode): Return an opt_scalar_float_mode. * doc/tm.texi: Regenerate. * config/arm/arm.c (arm_floatn_mode): Return an opt_scalar_float_mod

[14/67] Make libgcc_floating_mode_supported_p take a scalar_float_mode

2016-12-09 Thread Richard Sandiford
As per subject. gcc/ 2016-11-24 Richard Sandiford Alan Hayward David Sherwood * target.def (default_libgcc_floating_mode_supported_p): Take a scalar_float_mode. * doc/tm.texi: Regenerate. * targhooks.h (default_floatn_mode): Take a sc

[15/67] Add scalar_int_mode

2016-12-09 Thread Richard Sandiford
Similar to the previous scalar_float_mode patch, but for modes that satisfy SCALAR_INT_MODE_P. There are very many uses of scalar integers, so this patch only makes one token change to the types of byte_mode, word_mode and ptr_mode. The next patches in the series gradually replace more uses. gcc

[16/67] Add scalar_int_mode_pod

2016-12-09 Thread Richard Sandiford
This patch adds a POD class for scalar integers, as an instance of a new pod_mode template. Later patches will use pod_mode in situations that really do need to be POD; in this patch we're simply using PODs to remove load-time initialisation. gcc/ 2016-11-24 Richard Sandiford Alan

[17/67] Add an int_mode_for_size helper function

2016-12-09 Thread Richard Sandiford
This patch adds a wrapper around mode_for_size for cases in which the mode class is MODE_INT (the commonest case). The return type can then be an opt_scalar_int_mode instead of a machine_mode. gcc/ 2016-11-24 Richard Sandiford Alan Hayward David Sherwood *

[18/67] Make int_mode_for_mode return an opt_scalar_int_mode

2016-12-09 Thread Richard Sandiford
Also use int_mode_for_mode instead of (int_)mode_for_size in cases where the requested size was the bitsize of an existing mode. gcc/ 2016-11-24 Richard Sandiford Alan Hayward David Sherwood * machmode.h (opt_mode::else_blk): New function. (int_mode_

[19/67] Add a smallest_int_mode_for_size helper function

2016-12-09 Thread Richard Sandiford
This patch adds a wrapper around smallest_mode_for_size for cases in which the mode class is MODE_INT. Unlike (int_)mode_for_size, smallest_mode_for_size always returns a mode of the specified class, asserting if no such mode exists. smallest_int_mode_for_size therefore returns a scalar_int_mode r

[20/67] Replace MODE_INT checks with is_int_mode

2016-12-09 Thread Richard Sandiford
Replace checks of "GET_MODE_CLASS (...) == MODE_INT" with "is_int_mode (..., &var)", in cases where it becomes useful to refer to the mode as a scalar_int_mode. gcc/ 2016-11-24 Richard Sandiford Alan Hayward David Sherwood * machmode.h (is_int_mode): New fuc

[21/67] Replace SCALAR_INT_MODE_P checks with is_a

2016-12-09 Thread Richard Sandiford
Replace checks of "SCALAR_INT_MODE_P (...)" with "is_a (..., &var)" in cases where it becomes useful to refer to the mode as a scalar_int_mode. Also: - Replace some lingering checks for the two constituent classes (MODE_INT and MODE_PARTIAL_INT) - Introduce is_a checks for some uses of HWI_

[22/67] Replace !VECTOR_MODE_P with is_a

2016-12-09 Thread Richard Sandiford
This patch replaces some checks of !VECTOR_MODE_P with checks of is_a , in cases where the scalar integer modes were the only useful alternatives left. gcc/ 2016-11-24 Richard Sandiford Alan Hayward David Sherwood * simplify-rtx.c (simplify_binary_operation_

[23/67] Replace != VOIDmode checks with is_a

2016-12-09 Thread Richard Sandiford
This patch replaces some checks against VOIDmode with checks of is_a , in cases where scalar integer modes were the only useful alternatives left. gcc/ 2016-11-24 Richard Sandiford Alan Hayward David Sherwood * cfgexpand.c (expand_debug_expr): Use is_a

[24/67] Replace a != BLKmode check with is_a

2016-12-09 Thread Richard Sandiford
This patch replaces a check against BLKmode with a check of is_a , in a case where scalar integer modes were the only useful alternatives left. gcc/ 2016-11-24 Richard Sandiford Alan Hayward David Sherwood * gimple-fold.c (gimple_fold_builtin_memory_op): Use

[25/67] Use is_a for bitmask optimisations

2016-12-09 Thread Richard Sandiford
Explicitly check for scalar_int_mode in code that checks for full-mode bit operations. These operations wouldn't work correctly for vector modes, for example. In many cases this is enforced also by checking whether an operand is CONST_INT_P, but there were other cases where the condition is more

[26/67] Use is_a in subreg/extract simplifications

2016-12-09 Thread Richard Sandiford
Add is_a checks to various places that were optimising subregs or extractions in ways that only made sense for scalar integers. Often the subreg transformations were looking for extends, truncates or shifts and trying to remove the subreg, which wouldn't be correct if the SUBREG_REG was a vector

[27/67] Use is_a before LOAD_EXTEND_OP

2016-12-09 Thread Richard Sandiford
Add is_a checks before load_extend_op/ LOAD_EXTEND_OP calls, if that becomes useful for later patches. (load_extend_op will return UNKNOWN for any other type of mode.) gcc/ 2016-11-24 Richard Sandiford Alan Hayward David Sherwood * cse.c (cse_insn): Add is_

[28/67] Use is_a for miscellaneous types of test

2016-12-09 Thread Richard Sandiford
This patch adds is_a checks to various places that were explicitly or implicitly restricted to integers already, in cases where adding an explicit is_a is useful for later patches. In simplify_if_then_else, the: GET_MODE (XEXP (XEXP (t, 0), N)) expressions were equivalent to: GET_MODE (XE

[29/67] Make some *_loc_descriptor helpers take scalar_int_mode

2016-12-09 Thread Richard Sandiford
The *_loc_descriptor routines for clz, popcount, bswap and rotate all required SCALAR_INT_MODE_P. This patch moves the checks into the caller (mem_loc_descriptor) so that the types of the mode parameters can be scalar_int_mode instead of machine_mode. The MOD handling in mem_loc_descriptor is als

[30/67] Use scalar_int_mode for doubleword splits

2016-12-09 Thread Richard Sandiford
Add is_a tests to a couple of places that were splitting doubleword integer operations into word_mode operations. Also use scalar_int_mode in the expand_expr_real_2 handling of doubleword shifts. gcc/ 2016-11-24 Richard Sandiford Alan Hayward David Sherwood

[31/67] Use scalar_int_mode for move2add

2016-12-09 Thread Richard Sandiford
The postreload move2add optimisations are specific to scalar integers. This patch adds an explicit check to the main guarding "if" and propagates the information through subroutines. gcc/ 2016-11-24 Richard Sandiford Alan Hayward David Sherwood * postreload

[32/67] Check is_a before calling valid_pointer_mode

2016-12-09 Thread Richard Sandiford
A future patch will make valid_pointer_mode take a scalar_int_mode instead of a machine_mode. is_a <...> rather than as_a <...> is needed here because we're checking a mode supplied by the user. gcc/c-family/ 2016-11-24 Richard Sandiford Alan Hayward David Sherwood

[33/67] Add a NARROWEST_INT_MODE macro

2016-12-09 Thread Richard Sandiford
Replace uses of GET_CLASS_NARROWEST_MODE (MODE_INT) with a new NARROWEST_INT_MODE macro, which has type scalar_int_mode. gcc/ 2016-11-24 Richard Sandiford Alan Hayward David Sherwood * machmode.h (NARROWEST_INT_MODE): New macro. * expr.c (alignment_f

[34/67] Add a SCALAR_INT_TYPE_MODE macro

2016-12-09 Thread Richard Sandiford
This patch adds a SCALAR_INT_TYPE_MODE macro that asserts that the type has a scalar integer mode and returns it as a scalar_int_mode. gcc/ 2016-11-24 Richard Sandiford Alan Hayward David Sherwood * tree.h (SCALAR_INT_TYPE_MODE): New macro. * builtin

[35/67] Add uses of as_a

2016-12-09 Thread Richard Sandiford
This patch adds asserting as_a conversions in contexts where the input is known to be a scalar integer mode. In expand_divmod, op1 is always a scalar_int_mode if op1_is_constant (but might not be otherwise). In expand_binop, the patch reverses a < comparison in order to avoid splitting a long li

[36/67] Use scalar_int_mode in the RTL iv routines

2016-12-09 Thread Richard Sandiford
This patch changes the iv modes in rtx_iv from machine_mode to scalar_int_mode. It also passes the mode of the iv down to subroutines; this avoids the previous situation in which the mode information was sometimes lost and had to be added by the caller on return. Some routines already took a mode

[37/67] Use scalar_int_mode when emitting cstores

2016-12-09 Thread Richard Sandiford
cstore patterns always have a scalar integer result, which has the value 0 for "false" and STORE_FLAG_VALUE for "true". This patch makes that explicit using scalar_int_mode. gcc/ 2016-11-24 Richard Sandiford Alan Hayward David Sherwood * target.def (cstore_

[38/67] Move SCALAR_INT_MODE_P out of strict_volatile_bitfield_p

2016-12-09 Thread Richard Sandiford
strict_volatile_bitfield_p returns false for any mode that isn't a scalar integer. This patch moves the check to the caller and makes strict_volatile_bitfield_p take the mode as a scalar_int_mode. The handling of a true return can then also use the mode as a scalar_int_mode. gcc/ 2016-11-24 Rich

[39/67] Two changes to the get_best_mode interface

2016-12-09 Thread Richard Sandiford
get_best_mode always returns a scalar_int_mode on success, so this patch makes that explicit in the type system. Also, the "largest_mode" argument is used simply to provide a maximum size, and in practice that size is always a compile-time constant, even when the concept of variable-sized modes is

[40/67] Use scalar_int_mode for extraction_insn fields

2016-12-09 Thread Richard Sandiford
insv, extv and eztzv modify or read a field in a register or memory. The field always has a scalar integer mode, while the register or memory either has a scalar integer mode or BLKmode. The mode of the bit position is also a scalar integer. This patch uses the type system to make that explicit.

[41/67] Split scalar integer handling out of force_to_mode

2016-12-09 Thread Richard Sandiford
force_to_mode exits partway through for modes that aren't scalar integers. This patch splits the remainder of the function out into a subroutine, force_int_to_mode, so that the modes from that point on can have type scalar_int_mode. The patch also makes sure that xmode is kept up-to-date with x a

[42/67] Use scalar_int_mode in simplify_shift_const_1

2016-12-09 Thread Richard Sandiford
This patch makes simplify_shift_const_1 use scalar_int_modes for all code that is specific to scalars rather than vectors. This includes situations in which the new shift mode is different from the original one, since the function never changes the mode of vector shifts. That in turn makes it more

[43/67] Use scalar_int_mode in simplify_comparison

2016-12-09 Thread Richard Sandiford
The main loop of simplify_comparison starts with: if (GET_MODE_CLASS (mode) != MODE_INT && ! (mode == VOIDmode && (GET_CODE (op0) == COMPARE || COMPARISON_P (op0 break; So VOIDmode is only acceptable when comparing a COMPARE, EQ, NE, etc. operand agains

[44/67] Make simplify_and_const_int take a scalar_int_mode

2016-12-09 Thread Richard Sandiford
After previous patches, top-level calls to simplify_and_const_int always pass a scalar_int_mode. The only call site that needs to be updated is the recursive one in simplify_and_const_int_1, at which point we know "varop" has a scalar integer mode. gcc/ 2016-11-24 Richard Sandiford

Re: [24/67] Replace a != BLKmode check with is_a

2016-12-09 Thread Richard Biener
On Fri, Dec 9, 2016 at 2:08 PM, Richard Sandiford wrote: > This patch replaces a check against BLKmode with a check > of is_a , in a case where scalar integer > modes were the only useful alternatives left. So why's BLKmode no longer sth valid to check against? The check is only there to guard G

Re: [Patch, Fortran, OOP] PR 61767: ICE in generate_finalization_wrapper at fortran/class.c:1491

2016-12-09 Thread Janus Weil
Hi Andre, > yes, that was what I had in mind for the testcase. Now it looks ok to me. thanks for reviewing, committed as r243483. Cheers, Janus > On Thu, 8 Dec 2016 16:41:23 +0100 > Janus Weil wrote: > >> Hi Andre, >> >> > so when I interpret the testcase correctly, than the finalizer should

[45/67] Make extract_left_shift take a scalar_int_mode

2016-12-09 Thread Richard Sandiford
This patch passes the mode of the shifted value to extract_left_shift and updates the only caller so that the mode is a scalar_int_mode. gcc/ 2016-11-24 Richard Sandiford Alan Hayward David Sherwood * combine.c (extract_left_shift): Add a mode argument and u

[46/67] Make widest_int_mode_for_size return a scalar_int_mode

2016-12-09 Thread Richard Sandiford
The comment for widest_int_mode said that it returns "the widest integer mode no wider than SIZE", but it actually returns the widest integer mode that is narrower than SIZE. In practice SIZE is always greater than 1, so it can always pick QImode in the worst case. The VOIDmode paths seem to be d

  1   2   3   >