Commit Graph

148140 Commits

Author SHA1 Message Date
Jonathan Wakely 4c86ffccf9 Update links to libstdc++ Doxygen pages
* doc/xml/api.xml: Replace hardcoded links for specific versions with
	link to docs for all releases.
	* doc/html/*: Regenerate.

From-SVN: r239663
2016-08-22 17:47:39 +01:00
Jonathan Wakely 94f54d47ca Add noexcept to std::function swap
PR libstdc++/77322
	* doc/xml/manual/intro.xml: Document DR 2062 change.
	* include/std/functional (function::swap): Add noexcept.
	(swap(function<Res(Args...)&, function<Res(Args...)&)): Likewise.
	* testsuite/20_util/function/77322.cc: New test.

From-SVN: r239662
2016-08-22 17:47:34 +01:00
Patrick Palka 1321723711 Improve readability of debug_tree() dumps for SSA_NAME and VECTOR_CST
gcc/ChangeLog:

	* print-tree.c (print_node) [VECTOR_CST]: Coalesce the output of
	identical consecutive elements.
	[SSA_NAME]: Print the name's def stmt on its own line.  When printing
	the node's def stmt, avoid printing an unwanted trailing newline by
	replacing the call to print_gimple_stmt() with its inlined body and
	adjusting it to not set pp_needs_newline and to call pp_flush()
	instead of pp_newline_and_flush().

From-SVN: r239661
2016-08-22 15:13:16 +00:00
Joseph Myers 6dc198e3a5 Add minimal _FloatN, _FloatNx built-in functions.
This patch adds a minimal set of built-in functions for the new
_FloatN and _FloatNx types.

The functions added are __builtin_fabs*, __builtin_copysign*,
__builtin_huge_val*, __builtin_inf*, __builtin_nan* and
__builtin_nans* (where * = fN or fNx).  That is, 42 new entries are
added to the enum of built-in functions and the associated array of
decls, where not all of them are actually supported on any one target.

These functions are believed to be sufficient for libgcc (complex
multiplication and division use __builtin_huge_val*,
__builtin_copysign* and __builtin_fabs*) and for glibc (which also
depends on complex multiplication from libgcc, as well as using such
functions itself).  The basic target-independent support for folding /
expanding calls to these built-in functions is wired up, so those for
constants can be used in static initializers, and the fabs and
copysign built-ins can always be expanded to bit-manipulation inline
(for any format setting signbit_ro and signbit_rw, which covers all
formats supported for _FloatN and _FloatNx), although insn patterns
for fabs (abs<mode>2) and copysign (copysign<mode>3) will be used when
available and may result in more optimal code.

The complex multiplication and division functions in libgcc rely on
predefined macros (defined with -fbuilding-libgcc) to say what the
built-in function suffixes to use with a particular mode are.  This
patch updates that code accordingly, where previously it involved a
hack supposing that machine-specific suffixes for constants were also
suffixes for built-in functions.

As with the main _FloatN / _FloatNx patch, this patch does not update
code dealing only with optimizations that currently has cases only
covering float, double and long double, though some such cases are
straightforward and may be covered in a followup patch.

The functions are defined with DEF_GCC_BUILTIN, so calls to the TS
18661-3 functions such as fabsf128 and copysignf128, without the
__builtin_, will not be optimized.  As noted in the original _FloatN /
_FloatNx patch submission, in principle the bulk of the libm functions
that have built-in versions should have those versions extended to
cover the new types, but that would require more consideration of the
effects of increasing the size of the enum and initializing many more
functions at startup.

I don't know whether target-specific built-in functions can readily be
made into aliases for target-independent functions, but if they can,
it would make sense to do so for the x86, ia64 and rs6000 *q functions
corresponding to these, so that they can benefit from the
architecture-independent folding logic and from any optimizations
enabled for these functions in future, and so that less
target-specific code is needed to support them.

Bootstrapped with no regressions on x86_64-pc-linux-gnu.

gcc:
	* tree.h (CASE_FLT_FN_FLOATN_NX, float16_type_node)
	(float32_type_node, float64_type_node, float32x_type_node)
	(float128x_type_node): New macros.
	* builtin-types.def (BT_FLOAT16, BT_FLOAT32, BT_FLOAT64)
	(BT_FLOAT128, BT_FLOAT32X, BT_FLOAT64X, BT_FLOAT128X)
	(BT_FN_FLOAT16, BT_FN_FLOAT32, BT_FN_FLOAT64, BT_FN_FLOAT128)
	(BT_FN_FLOAT32X, BT_FN_FLOAT64X, BT_FN_FLOAT128X)
	(BT_FN_FLOAT16_FLOAT16, BT_FN_FLOAT32_FLOAT32)
	(BT_FN_FLOAT64_FLOAT64, BT_FN_FLOAT128_FLOAT128)
	(BT_FN_FLOAT32X_FLOAT32X, BT_FN_FLOAT64X_FLOAT64X)
	(BT_FN_FLOAT128X_FLOAT128X, BT_FN_FLOAT16_CONST_STRING)
	(BT_FN_FLOAT32_CONST_STRING, BT_FN_FLOAT64_CONST_STRING)
	(BT_FN_FLOAT128_CONST_STRING, BT_FN_FLOAT32X_CONST_STRING)
	(BT_FN_FLOAT64X_CONST_STRING, BT_FN_FLOAT128X_CONST_STRING)
	(BT_FN_FLOAT16_FLOAT16_FLOAT16, BT_FN_FLOAT32_FLOAT32_FLOAT32)
	(BT_FN_FLOAT64_FLOAT64_FLOAT64, BT_FN_FLOAT128_FLOAT128_FLOAT128)
	(BT_FN_FLOAT32X_FLOAT32X_FLOAT32X)
	(BT_FN_FLOAT64X_FLOAT64X_FLOAT64X)
	(BT_FN_FLOAT128X_FLOAT128X_FLOAT128X): New type definitions.
	* builtins.def (DEF_GCC_FLOATN_NX_BUILTINS): New macro.
	(copysign, fabs, huge_val, inf, nan, nans): Use it.
	* builtins.c (expand_builtin): Use CASE_FLT_FN_FLOATN_NX for fabs
	and copysign.
	(fold_builtin_0): Use CASE_FLT_FN_FLOATN_NX for inf and huge_val.
	(fold_builtin_1): Use CASE_FLT_FN_FLOATN_NX for fabs.
	* doc/extend.texi (Other Builtins): Document these built-in
	functions.
	* fold-const-call.c (fold_const_call): Use CASE_FLT_FN_FLOATN_NX
	for nan and nans.

gcc/c-family:
	* c-family/c-cppbuiltin.c (c_cpp_builtins): Check _FloatN and
	_FloatNx types for suffixes for built-in functions.

gcc/testsuite:
	* gcc.dg/torture/float128-builtin.c,
	gcc.dg/torture/float128-ieee-nan.c,
	gcc.dg/torture/float128x-builtin.c,
	gcc.dg/torture/float128x-nan.c, gcc.dg/torture/float16-builtin.c,
	gcc.dg/torture/float16-nan.c, gcc.dg/torture/float32-builtin.c,
	gcc.dg/torture/float32-nan.c, gcc.dg/torture/float32x-builtin.c,
	gcc.dg/torture/float32x-nan.c, gcc.dg/torture/float64-builtin.c,
	gcc.dg/torture/float64-nan.c, gcc.dg/torture/float64x-builtin.c,
	gcc.dg/torture/float64x-nan.c, gcc.dg/torture/floatn-builtin.h,
	gcc.dg/torture/floatn-nan.h: New tests.

From-SVN: r239658
2016-08-22 12:57:39 +01:00
Joseph Myers 7ff4e41a19 Update TEST_I_F calls in ARM fp-int-convert tests.
gcc/testsuite:
	* gcc.dg/torture/arm-fp16-int-convert-alt.c (FP16_MAX_EXP): New
	macro.
	(main): Update calls to TEST_I_F.
	* gcc.dg/torture/arm-fp16-int-convert-ieee.c (FP16_MAX_EXP): New
	macro.
	(main): Update calls to TEST_I_F.

From-SVN: r239657
2016-08-22 12:48:14 +01:00
Gerald Pfeifer 845d9d1aa2 * doc/install.texi (Binaries): www.opencsw.org now uses https.
From-SVN: r239656
2016-08-22 11:43:35 +00:00
Joseph Myers 7078cdb635 Correct type names in fp-int-convert-float*x-timode.c tests.
gcc/testsuite:
	* gcc.dg/torture/fp-int-convert-float128x-timode.c,
	gcc.dg/torture/fp-int-convert-float32x-timode.c,
	gcc.dg/torture/fp-int-convert-float64x-timode.c: Correct type
	names in calls to TEST_I_F.

From-SVN: r239655
2016-08-22 11:45:23 +01:00
Richard Biener 43b7a57780 tree-ssa-forwprop.c (pass_forwprop::execute): Use RPO order.
2016-08-22  Richard Biener  <rguenther@suse.de>

	* tree-ssa-forwprop.c (pass_forwprop::execute): Use RPO order.

From-SVN: r239653
2016-08-22 08:25:30 +00:00
Bernd Edlinger a9d7c8234d re PR c/52952 (Wformat location info is bad (wrong column number))
2016-08-22  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        PR c/52952
        * gcc.dg/cpp/pr66415-1.c: Fix sporadic failure.

From-SVN: r239649
2016-08-22 07:34:34 +00:00
Senthil Kumar Selvaraj cd8002350e Skip tests that assume 4 byte alignment for avr
gcc/testsuite

        * gcc.dg/ipa/propalign-1.c: Skip for targets with !natural_alignment_32
        and !natural_alignment_64.
        * gcc.dg/ipa/propalign-2.c: Likewise.
        * gcc.dg/ipa/propalign-3.c: Likewise.
        * gcc.dg/ipa/propalign-4.c: Likewise.
        * gcc.dg/ipa/propalign-5.c: Likewise.
        * lib/target-supports.exp
        (check_effective_target_natural_alignment_32): Add avr-*-*.

From-SVN: r239647
2016-08-22 06:12:32 +00:00
GCC Administrator fd3cda8b87 Daily bump.
From-SVN: r239646
2016-08-22 00:16:15 +00:00
Uros Bizjak 2561f329f1 re PR target/77270 (Flag -mprftchw is shared with 3dnow for -march=k8)
PR target/77270
	* config/i386/i386.md (prefetch): When TARGET_PRFCHW or
	TARGET_PREFETCHWT1 are disabled, emit 3dNOW! write prefetches for
	non-SSE2 athlons only, otherwise prefer SSE prefetches.

From-SVN: r239643
2016-08-21 20:53:48 +02:00
GCC Administrator 21afd9113c Daily bump.
From-SVN: r239642
2016-08-21 00:16:14 +00:00
Kugan Vivekanandarajah bb9d2f4d76 tree-vrp.c (vrp_visit_assignment_or_call): Changed to Return VR.
gcc/ChangeLog:

2016-08-20  Kugan Vivekanandarajah  <kuganv@linaro.org>

	* tree-vrp.c (vrp_visit_assignment_or_call): Changed to Return VR.
	(vrp_visit_cond_stmt): Just sets TAKEN_EDGE_P.
	(vrp_visit_switch_stmt): Likewise.
	(extract_range_from_stmt): Factored out from vrp_visit_stmt.
	(extract_range_from_phi_node): Factored out from vrp_visit_phi_stmt.
	(vrp_visit_stmt): Use extract_range_from_stmt.
	(vrp_visit_phi_node): Use extract_range_from_phi_node.

From-SVN: r239639
2016-08-20 12:12:06 +00:00
Kugan Vivekanandarajah f90aa46c0f Makefile.in: Add tree-vrp.h to GTFILES.
gcc/ChangeLog:

2016-08-20  Kugan Vivekanandarajah  <kuganv@linaro.org>

	* Makefile.in: Add tree-vrp.h to GTFILES.
	* gengtype.c (open_base_files): Add tree-vrp.h.
	* asan.c: Add tree-vrp.h which now has the definition value_range_type.
	* builtins.c: Likewise.
	* fold-const.c: Likewise.
	* gimple-builder.c: Likewise.
	* gimple-laddress.c: Likewise.
	* hsa-gen.c: Likewise.
	* internal-fn.c: Likewise.
	* ssa.h: Likewise.
	* targhooks.c: Liewise,
	* tree-ssa-address.c: Likewise.
	* tree-ssanames.h (value_range_type: Move to tree-vrp.h.
	* tree-vrp.c (struct value_range): Move to tree-vrp.h
	* tree-vrp.h: New file.

From-SVN: r239638
2016-08-20 05:43:01 +00:00
Kugan Vivekanandarajah 22d12455ea re PR tree-optimization/61839 (More optimize opportunity for VRP)
gcc/testsuite/ChangeLog:

2016-08-20  Kugan Vivekanandarajah  <kuganv@linaro.org>

	PR tree-optimization/61839
	* gcc.dg/tree-ssa/pr61839_1.c: New test.
	* gcc.dg/tree-ssa/pr61839_2.c: New test.
	* gcc.dg/tree-ssa/pr61839_3.c: New test.
	* gcc.dg/tree-ssa/pr61839_4.c: New test.

gcc/ChangeLog:

2016-08-20  Kugan Vivekanandarajah  <kuganv@linaro.org>

	PR tree-optimization/61839
	* tree-vrp.c (two_valued_val_range_p): New.
	(simplify_stmt_using_ranges): Convert CST BINOP VAR where VAR is
	two-valued to VAR == VAL1 ? (CST BINOP VAL1) : (CST BINOP VAL2).
	Also Convert VAR BINOP CST where VAR is two-valued to
	VAR == VAL1 ? (VAL1 BINOP CST) : (VAL2 BINOP CST).

From-SVN: r239637
2016-08-20 01:18:09 +00:00
GCC Administrator 151d752b9e Daily bump.
From-SVN: r239636
2016-08-20 00:16:13 +00:00
David Malcolm 2ffe0809cb Reimplement removal fix-it hints in terms of replace
This patch eliminates class fixit_remove, reimplementing
rich_location::add_fixit_remove in terms of replacement with the
empty string.  Deleting the removal subclass simplifies
fixit-handling code, as we only have two concrete fixit_hint
subclasses to deal with, rather than three.

The patch also fixes some problems in diagnostic-show-locus.c for
situations where a replacement fix-it has a different range to the
range of the diagnostic, by unifying the drawing of the two kinds of
fixits.  For example, this:

  foo = bar.field;
      ^
            m_field

becomes:

  foo = bar.field;
      ^
            -----
            m_field

showing the range to be replaced.

gcc/ChangeLog:
	* diagnostic-show-locus.c
	(layout::annotation_line_showed_range_p): New method.
	(layout::print_any_fixits): Remove case fixit_hint::REMOVE.
	Reimplement case fixit_hint::REPLACE to cover removals, and
	replacements where the range of the replacement isn't one
	of the ranges in the rich_location.
	(test_one_liner_fixit_replace): Likewise.
	(selftest::test_one_liner_fixit_replace_non_equal_range): New
	function.
	(selftest::test_one_liner_fixit_replace_equal_secondary_range):
	New function.
	(selftest::test_diagnostic_show_locus_one_liner): Call the new
	functions.
	* diagnostic.c (print_parseable_fixits): Remove case
	fixit_hint::REMOVE.

libcpp/ChangeLog:
	* include/line-map.h (fixit_hint::kind): Delete REPLACE.
	(class fixit_remove): Delete.
	* line-map.c (rich_location::add_fixit_remove): Reimplement
	by calling add_fixit_replace with an empty string.
	(fixit_remove::fixit_remove): Delete.
	(fixit_remove::affects_line_p): Delete.

From-SVN: r239632
2016-08-19 21:18:05 +00:00
Joseph Myers d9056349fc Regenerate .pot files.
gcc/po:
	* gcc.pot: Regenerate.

libcpp/po:
	* cpplib.pot: Regenerate.

From-SVN: r239630
2016-08-19 22:06:53 +01:00
Uros Bizjak 9db4c25d2c re PR target/77270 (Flag -mprftchw is shared with 3dnow for -march=k8)
PR target/77270
	* config/i386/i386.c (ix86_option_override_internal): Remove
	PTA_PRFCHW from entries that also have PTA_3DNOW flag.
	Enable SSE prefetch also for TARGET_PREFETCHWT1.
	Do not try to enable TARGET_PRFCHW ISA flag here.
	* config/i386/i386.md (prefetch): Enable also for TARGET_3DNOW.
	Rewrite expander function body.
	(*prefetch_3dnow): Enable for TARGET_3DNOW and TARGET_PREFETCHWT1.

From-SVN: r239626
2016-08-19 20:14:03 +02:00
Joseph Myers c65699efcc Implement C _FloatN, _FloatNx types.
ISO/IEC TS 18661-3:2015 defines C bindings to IEEE interchange and
extended types, in the form of _FloatN and _FloatNx type names with
corresponding fN/FN and fNx/FNx constant suffixes and FLTN_* / FLTNX_*
<float.h> macros.  This patch implements support for this feature in
GCC.

The _FloatN types, for N = 16, 32, 64 or >= 128 and a multiple of 32,
are types encoded according to the corresponding IEEE interchange
format (endianness unspecified; may use either the NaN conventions
recommended in IEEE 754-2008, or the MIPS NaN conventions, since the
choice of convention is only an IEEE recommendation, not a
requirement).  The _FloatNx types, for N = 32, 64 and 128, are IEEE
"extended" types: types extending a narrower format with range and
precision at least as big as those specified in IEEE 754 for each
extended type (and with unspecified representation, but still
following IEEE semantics for their values and operations - and with
the set of values being determined by the precision and the maximum
exponent, which means that while Intel "extended" is suitable for
_Float64x, m68k "extended" is not).  These types are always distinct
from and not compatible with each other and the standard floating
types float, double, long double; thus, double, _Float64 and _Float32x
may all have the same ABI, but they are three still distinct types.
The type names may be used with _Complex to construct corresponding
complex types (unlike __float128, which acts more like a typedef name
than a keyword - thus, this patch may be considered to fix PR
c/32187).  The new suffixes can be combined with GNU "i" and "j"
suffixes for constants of complex types (e.g. 1.0if128, 2.0f64i).

The set of types supported is implementation-defined.  In this GCC
patch, _Float32 is SFmode if that is suitable; _Float32x and _Float64
are DFmode if that is suitable; _Float128 is TFmode if that is
suitable; _Float64x is XFmode if that is suitable, and otherwise
TFmode if that is suitable.  There is a target hook to override the
choices if necessary.  "Suitable" means both conforming to the
requirements of that type, and supported as a scalar type including in
libgcc.  The ABI is whatever the back end does for scalars of that
mode (but note that _Float32 is passed without promotion in variable
arguments, unlike float).  All the existing issues with exceptions and
rounding modes for existing types apply equally to the new type names.

No GCC port supports a floating-point format suitable for _Float128x.
Although there is HFmode support for ARM and AArch64, use of that for
_Float16 is not enabled.  Supporting _Float16 would require additional
work on the excess precision aspects of TS 18661-3: there are new
values of FLT_EVAL_METHOD, which are not currently supported in GCC,
and FLT_EVAL_METHOD == 0 now means that operations and constants on
types narrower than float are evaluated to the range and precision of
float.  Implementing that, so that _Float16 gets evaluated with excess
range and precision, would involve changes to the excess precision
infrastructure so that the _Float16 case is enabled by default, unlike
the x87 case which is only enabled for -fexcess-precision=standard.
Other differences between _Float16 and __fp16 would also need to be
disentangled.

GCC has some prior support for nonstandard floating-point types in the
form of __float80 and __float128.  Where these were previously types
distinct from long double, they are made by this patch into aliases
for _Float64x / _Float128 if those types have the required properties.

In principle the set of possible _FloatN types is infinite.  This
patch hardcodes the four such types for N <= 128, but with as much
code as possible using loops over types to minimize the number of
places with such hardcoding.  I don't think it's likely any further
such types will be of use in future (or indeed that formats suitable
for _Float128x will actually be implemented).  There is a corner case
that all _FloatN, for N >= 128 and a multiple of 32, should be treated
as keywords even when the corresponding type is not supported; I
intend to deal with that in a followup patch.

Tests are added for various functionality of the new types, mostly
using type-generic headers.  The tests use dg-add-options to pass any
extra options needed to enable the types; this is wired up to use the
same options as for __float128 on powerpc to enable _Float128 and
_Float64x, and effective-target keywords for runtime support do the
same hardware test as for __float128 to make sure the VSX instructions
generated by those options are supported.  (Corresponding additions
would be needed for _Float16 on ARM as well if that were enabled with
-mfp16-format=ieee required to use it rather than unconditionally
available.  Of course, -mfp16-format=alternative enables use of a
format which is not compatible with the requirements of the _Float16
type.)

C++ note: no support for the new types or constant suffixes is added
for C++.  C++ decimal floating-point support was very different from
the C support, using class types, and the same may well apply to any
future C++ bindings for IEEE interchange and extended types.  There is
a case, however, for supporting at least *f128 constants in C++, so
that code using __float128 can use the newer style for constants
throughout rather than needing to use the older *q constants in C++.
Also, if built-in functions are added that may provide a way in which
the types could leak into C++ code.

Fortran note: the float128_type_node used in the Fortran front end is
renamed to gfc_float128_type_node, since the semantics are different:
in particular, if long double has binary128 format, then the new
language-independent float128_type_node is a distinct type that also
has binary128 format, but the Fortran node is expected to be NULL in
that case.  Likewise, Fortran's complex_float128_type_node is renamed
to gfc_complex_float128_type_node.

PowerPC note: the back end had an inconsistency that if TFmode was
binary128, *q constants were TFmode instead of KFmode but __float128
was KFmode.  This patch follows the same logic as for *q constants, so
that _Float128 prefers TFmode (and __float128 becomes an alias for
_Float128).

ARM note: __fp16 is promoted to double (by convert_arguments) when
passed without a prototype / in variable arguments.  But this is only
about the argument promotion; it is not handled as promoting in
c-common.c:self_promoting_args_p / c-typeck.c:c_type_promotes_to,
meaning that a K&R function definition for an argument of type __fp16
corresponds to a prototype with an argument of that type, not to one
with an argument of type double, whereas a float argument in a K&R
function definition corresponds to a double prototype argument - and
the same functions are also what's involved in making va_arg give a
warning and generate a call to abort when called with type float.
This is preserved by this patch, while arranging for _Float16 not to
be promoted when passed without a prototype / in variable arguments
(the promotion of float being considered a legacy feature, not applied
to any new types in C99 or later).

TS 18661-3 extends the set of decimal floating-point types similarly,
and adds new constant suffixes for the existing types, but this patch
does not do anything regarding that extension.

This patch does nothing regarding built-in functions, although
type-generic functions such as __builtin_isinf work for the new types
and associated tests are included.  There are at least two levels of
built-in function support possible for these types.  The minimal
level, implemented in
<https://gcc.gnu.org/ml/gcc-patches/2016-06/msg01702.html> (which
needs updating to use dg-add-options), adds built-in functions similar
to those x86 has for __float128: __builtin_inf* __builtin_huge_val*,
__builtin_nan*, __builtin_nans*, __builtin_fabs*, __builtin_copysign*.
That would be sufficient for glibc to use the *f128 names for built-in
functions by default with *q used only for backwards compatibility
when using older GCC versions.  That would also allow c_cpp_builtins's
flag_building_libgcc code, defining __LIBGCC_%s_FUNC_EXT__, to use
such suffixes rather than the present code hardcoding logic about
target-specific constant suffixes and how those relate to function
suffixes.

Full built-in function support would cover the full range of built-in
functions for existing floating-point types, adding variants for all
the new types, except for a few obsolescent functions and
non-type-generic variants of type-generic functions.  Some but not all
references to such functions in GCC use macros such as CASE_FLT_FN to
be type-generic; a fair amount of work would be needed to identify all
places to update.  Adding all those functions would enable
optimizations (for constant arguments and otherwise) for TS 18661-3
functions, but it would also substantially expand the enum listing
built-in functions (and we've had problems with the size of that enum
in the past), and increase the amount of built-in function
initialization to do - I don't know what the startup cost involved in
built-in function initialization is, but it would be something to
consider when adding such a large set of functions.

There are also a range of optimizations, in match.pd and elsewhere,
that only operate on the three standard floating-point types.  Ideally
those would be made generic to all floating-point types, but this
patch does nothing in that regard.  Special care would be needed
regarding making sure library functions to which calls are generated
actually exist.  For example, if sqrt is called on an argument of type
_Float32, and the result converted to _Float32, this is equivalent to
doing a square root operation directly on _Float32.  But if the user's
libm does not have the sqrtf32 function, or the name is not reserved
because __STDC_WANT_IEC_60559_TYPES_EXT__ was not defined before
including <math.h>, you can only do that optimization if you convert
to a call to sqrtf instead.

DECIMAL_DIG now relates to all supported floating-point formats, not
just float, double and long double; I've raised the question with WG14
of how this relates to the formula for DECIMAL_DIG in C11 not
considering this.  TS 18661-3 says it also covers non-arithmetic
formats only supported by library conversion functions; this patch
does not add any target hooks to allow for the case where there are
such formats wider than any supported for arithmetic types (where
e.g. libc supports conversions involving the binary128 representation,
but the _Float128 type is not supported).

GCC provides its own <tgmath.h> for some targets.  No attempt is made
to adapt this to handle the new types.

Nothing is done regarding debug info for the new types (see the
"Debugger support for __float128 type?" thread on gcc@, Sep/Oct 2015).

No __SIZEOF_*__ macros are added for the new types.

Nothing is done with do_warn_double_promotion.

Nothing is done to include the new types in those determining
max_align_t, although properly it should be sufficiently aligned for
any of those types.

The logic for usual arithmetic conversions in c_common_type relies on
TYPE_PRECISION for floating-point types, which is less than ideal
(doesn't necessarily correspond to whether one type's values are
subset of another); looking in more detail at the formats might be
better.  But since I included code in build_common_tree_nodes to work
around rs6000 KFmode having precision 113 not 128, I think it should
work.  Ideally one might have errors in generic code for the case
where the two types do not have one type's values a subset of the
other (which is undefined behavior).  But the only case where this can
actually occur is mixing IBM long double with binary128 on powerpc,
and rs6000_invalid_binary_op deals with that at present.  TS 18661-3
does not fully specify the type resulting from the usual arithmetic
conversions in the case where two _FloatNx types have the same set of
values; I arranged the code to prefer the greater value of N in that
case.

The __FP_FAST_FMA* macros are not extended to cover the new types,
since there are no corresponding built-in functions (if built-in
fmafN, fmafNx are added, the macros should be extended, and the new
macros documented).  Also, only a limited set of modes is handled in
mode_has_fma.

Diagnostics relating to the use of the new types with -pedantic do not
try to distinguish them from purely nonstandard types such as __int128
and constant suffixes such as *q.

If you use an unsupported _FloatN / _FloatNx type you get a warning
about the type defaulting to int after the warning about the type not
being supported.  That's less than ideal, but it's also a pre-existing
condition if you use __int128 on a 32-bit system where it's
unsupported.

Bootstrapped with no regressions on x86_64-pc-linux-gnu.  Other
back-end changes minimally tested by building cc1 for ia64-linux-gnu,
powerpc64le-linux-gnu, pdp11-none (the last failed for unrelated
reasons).

	PR c/32187
gcc:
	* tree-core.h (TI_COMPLEX_FLOAT16_TYPE)
	(TI_COMPLEX_FLOATN_NX_TYPE_FIRST, TI_COMPLEX_FLOAT32_TYPE)
	(TI_COMPLEX_FLOAT64_TYPE, TI_COMPLEX_FLOAT128_TYPE)
	(TI_COMPLEX_FLOAT32X_TYPE, TI_COMPLEX_FLOAT64X_TYPE)
	(TI_COMPLEX_FLOAT128X_TYPE, TI_FLOAT16_TYPE, TI_FLOATN_TYPE_FIRST)
	(TI_FLOATN_NX_TYPE_FIRST, TI_FLOAT32_TYPE, TI_FLOAT64_TYPE)
	(TI_FLOAT128_TYPE, TI_FLOATN_TYPE_LAST, TI_FLOAT32X_TYPE)
	(TI_FLOATNX_TYPE_FIRST, TI_FLOAT64X_TYPE, TI_FLOAT128X_TYPE)
	(TI_FLOATNX_TYPE_LAST, TI_FLOATN_NX_TYPE_LAST): New enum
	tree_index values.
	(NUM_FLOATN_TYPES, NUM_FLOATNX_TYPES, NUM_FLOATN_NX_TYPES): New
	macros.
	(struct floatn_type_info): New structure type.
	(floatn_nx_types): New variable declaration.
	* tree.h (FLOATN_TYPE_NODE, FLOATN_NX_TYPE_NODE)
	(FLOATNX_TYPE_NODE, float128_type_node, float64x_type_node)
	(COMPLEX_FLOATN_NX_TYPE_NODE): New macros.
	* tree.c (floatn_nx_types): New variable.
	(build_common_tree_nodes): Initialize _FloatN, _FloatNx and
	corresponding complex types.
	* target.def (floatn_mode): New hook.
	* targhooks.c: Include "real.h".
	(default_floatn_mode): New function.
	* targhooks.h (default_floatn_mode): New prototype.
	* doc/extend.texi (Floating Types): Document _FloatN and _FloatNx
	types.
	* doc/sourcebuild.texi (float@var{n}, float@var{n}x): Document new
	effective-target and dg-add-options keywords.
	(float@var{n}_runtime, float@var{n}x_runtime, floatn_nx_runtime):
	Document new effective-target keywords.
	* doc/tm.texi.in (TARGET_FLOATN_MODE): New @hook.
	* doc/tm.texi: Regenerate.
	* ginclude/float.h (LDBL_DECIMAL_DIG): Define to
	__LDBL_DECIMAL_DIG__, not __DECIMAL_DIG__.
	[__STDC_WANT_IEC_60559_TYPES_EXT__]: Define macros from TS
	18661-3.
	* real.h (struct real_format): Add field ieee_bits.
	* real.c (ieee_single_format, mips_single_format)
	(motorola_single_format, spu_single_format, ieee_double_format)
	(mips_double_format, motorola_double_format)
	(ieee_extended_motorola_format, ieee_extended_intel_96_format)
	(ieee_extended_intel_128_format)
	(ieee_extended_intel_96_round_53_format, ibm_extended_format)
	(mips_extended_format, ieee_quad_format, mips_quad_format)
	(vax_f_format, vax_d_format, vax_g_format, decimal_single_format)
	(decimal_double_format, decimal_quad_format, ieee_half_format)
	(arm_half_format, real_internal_format: Initialize ieee_bits
	field.
	* config/i386/i386.c (ix86_init_builtin_types): Do not initialize
	float128_type_node.  Set float80_type_node to float64x_type_node
	if appropriate and long_double_type_node not appropriate.
	* config/ia64/ia64.c (ia64_init_builtins): Likewise.
	* config/pdp11/pdp11.c (pdp11_f_format, pdp11_d_format):
	Initialize ieee_bits field.
	* config/rs6000/rs6000.c (TARGET_FLOATN_MODE): New macro.
	(rs6000_init_builtins): Set ieee128_float_type_node to
	float128_type_node.
	(rs6000_floatn_mode): New function.

gcc/c:
	* c-tree.h (cts_floatn_nx): New enum c_typespec_keyword value.
	(struct c_declspecs): Add field floatn_nx_idx.
	* c-decl.c (declspecs_add_type, finish_declspecs): Handle _FloatN
	and _FloatNx type specifiers.
	* c-parser.c (c_keyword_starts_typename, c_token_starts_declspecs)
	(c_parser_declspecs, c_parser_attribute_any_word)
	(c_parser_objc_selector): Use CASE_RID_FLOATN_NX.
	* c-typeck.c (c_common_type): Handle _FloatN and _FloatNx types.
	(convert_arguments): Avoid promoting _FloatN and _FloatNx types
	narrower than double.

gcc/c-family:
	* c-common.h (RID_FLOAT16, RID_FLOATN_NX_FIRST, RID_FLOAT32)
	(RID_FLOAT64, RID_FLOAT128, RID_FLOAT32X, RID_FLOAT64X)
	(RID_FLOAT128X): New enum rid values.
	(CASE_RID_FLOATN_NX): New macro.
	* c-common.c (c_common_reswords): Add _FloatN and _FloatNx
	keywords.
	(c_common_type_for_mode): Check for _FloatN and _FloatNx and
	corresponding complex types.
	(c_common_nodes_and_builtins): For non-C++, register _FloatN and
	_FloatNx and corresponding complex types.
	(keyword_begins_type_specifier): Use CASE_RID_FLOATN_NX.
	* c-cppbuiltin.c (builtin_define_float_constants): Check _FloatN
	and _FloatNx types for the widest type for determining
	DECIMAL_DIG.  Define __LDBL_DECIMAL_DIG__ as well as
	__DECIMAL_DIG__ for long double.  Handle FMA_SUFFIX being NULL.
	(c_cpp_builtins): Call builtin_define_float_constants for _FloatN
	and _FloatNx types.
	* c-lex.c (interpret_float): Handle _FloatN and _FloatNx
	constants.
	* c-pretty-print.c (pp_c_floating_constant): Handle _FloatN and
	_FloatNx types.

gcc/fortran:
	* trans-types.h (float128_type_node): Rename to
	gfc_float128_type_node.
	(complex_float128_type_node): Rename to
	gfc_complex_float128_type_node.
	* iso-c-binding.def, trans-intrinsic.c, trans-types.c: All users
	changed.

gcc/testsuite:
	* lib/target-supports.exp (check_effective_target_float16)
	(check_effective_target_float32, check_effective_target_float64)
	(check_effective_target_float128, check_effective_target_float32x)
	(check_effective_target_float64x)
	(check_effective_target_float128x)
	(check_effective_target_float16_runtime)
	(check_effective_target_float32_runtime)
	(check_effective_target_float64_runtime)
	(check_effective_target_float128_runtime)
	(check_effective_target_float32x_runtime)
	(check_effective_target_float64x_runtime)
	(check_effective_target_float128x_runtime)
	(check_effective_target_floatn_nx_runtime)
	(add_options_for_float16, add_options_for_float32)
	(add_options_for_float64, add_options_for_float128)
	(add_options_for_float32x, add_options_for_float64x)
	(add_options_for_float128x): New procedures.
	* gcc.dg/dfp/floatn.c, gcc.dg/float128-typeof.c,
	gcc.dg/float128x-typeof.c, gcc.dg/float16-typeof.c,
	gcc.dg/float32-typeof.c, gcc.dg/float32x-typeof.c,
	gcc.dg/float64-typeof.c, gcc.dg/float64x-typeof.c,
	gcc.dg/floatn-arithconv.c, gcc.dg/floatn-errs.c,
	gcc.dg/floatn-typeof.h, gcc.dg/torture/float128-basic.c,
	gcc.dg/torture/float128-complex.c,
	gcc.dg/torture/float128-floath.c, gcc.dg/torture/float128-tg.c,
	gcc.dg/torture/float128x-basic.c,
	gcc.dg/torture/float128x-complex.c,
	gcc.dg/torture/float128x-floath.c, gcc.dg/torture/float128x-tg.c,
	gcc.dg/torture/float16-basic.c, gcc.dg/torture/float16-complex.c,
	gcc.dg/torture/float16-floath.c, gcc.dg/torture/float16-tg.c,
	gcc.dg/torture/float32-basic.c, gcc.dg/torture/float32-complex.c,
	gcc.dg/torture/float32-floath.c, gcc.dg/torture/float32-tg.c,
	gcc.dg/torture/float32x-basic.c,
	gcc.dg/torture/float32x-complex.c,
	gcc.dg/torture/float32x-floath.c, gcc.dg/torture/float32x-tg.c,
	gcc.dg/torture/float64-basic.c, gcc.dg/torture/float64-complex.c,
	gcc.dg/torture/float64-floath.c, gcc.dg/torture/float64-tg.c,
	gcc.dg/torture/float64x-basic.c,
	gcc.dg/torture/float64x-complex.c,
	gcc.dg/torture/float64x-floath.c, gcc.dg/torture/float64x-tg.c,
	gcc.dg/torture/floatn-basic.h, gcc.dg/torture/floatn-complex.h,
	gcc.dg/torture/floatn-convert.c, gcc.dg/torture/floatn-floath.h,
	gcc.dg/torture/floatn-tg.h,
	gcc.dg/torture/fp-int-convert-float128-ieee-timode.c,
	gcc.dg/torture/fp-int-convert-float128-ieee.c,
	gcc.dg/torture/fp-int-convert-float128x-timode.c,
	gcc.dg/torture/fp-int-convert-float128x.c,
	gcc.dg/torture/fp-int-convert-float16-timode.c,
	gcc.dg/torture/fp-int-convert-float16.c,
	gcc.dg/torture/fp-int-convert-float32-timode.c,
	gcc.dg/torture/fp-int-convert-float32.c,
	gcc.dg/torture/fp-int-convert-float32x-timode.c,
	gcc.dg/torture/fp-int-convert-float32x.c,
	gcc.dg/torture/fp-int-convert-float64-timode.c,
	gcc.dg/torture/fp-int-convert-float64.c,
	gcc.dg/torture/fp-int-convert-float64x-timode.c,
	gcc.dg/torture/fp-int-convert-float64x.c: New tests.
	* gcc.dg/torture/fp-int-convert.h (TEST_I_F): Add argument for
	maximum exponent of floating-point type.  Use it in testing
	whether 0x8...0 fits in the floating-point type.  Always treat -1
	(signed 0xf...f) as fitting in the floating-point type.
	(M_OK1): New macro.
	* gcc.dg/torture/fp-int-convert-double.c,
	gcc.dg/torture/fp-int-convert-float.c,
	gcc.dg/torture/fp-int-convert-float128-timode.c,
	gcc.dg/torture/fp-int-convert-float128.c,
	gcc.dg/torture/fp-int-convert-float80-timode.c,
	gcc.dg/torture/fp-int-convert-float80.c,
	gcc.dg/torture/fp-int-convert-long-double.c,
	gcc.dg/torture/fp-int-convert-timode.c: Update calls to TEST_I_F.

libcpp:
	* include/cpplib.h (CPP_N_FLOATN, CPP_N_FLOATNX)
	(CPP_N_WIDTH_FLOATN_NX, CPP_FLOATN_SHIFT, CPP_FLOATN_MAX): New
	macros.
	* expr.c (interpret_float_suffix): Handle fN, fNx, FN and FNx
	suffixes.

From-SVN: r239625
2016-08-19 18:43:26 +01:00
Jonathan Wakely 71c54f8ea2 Simplify dg-options for tests using pthreads
* testsuite/21_strings/basic_string/pthread18185.cc: Use -pthread for
	*-*-solaris* instead of -pthreads.
	* testsuite/21_strings/basic_string/pthread4.cc : Likewise.
	* testsuite/22_locale/locale/cons/12658_thread-1.cc: Likewise.
	* testsuite/22_locale/locale/cons/12658_thread-2.cc: Likewise.
	* testsuite/23_containers/list/pthread1.cc: Likewise.
	* testsuite/23_containers/list/pthread5.cc: Likewise.
	* testsuite/23_containers/map/pthread6.cc: Likewise.
	* testsuite/27_io/basic_ofstream/pthread2.cc: Likewise.
	* testsuite/27_io/basic_ostringstream/pthread3.cc: Likewise.
	* testsuite/30_threads/shared_mutex/*: Likewise.
	* testsuite/ext/rope/pthread7-rope.cc: Likewise.
	* testsuite/tr1/2_general_utilities/shared_ptr/thread/
	default_weaktoshared.cc: Likewise.
	* testsuite/tr1/2_general_utilities/shared_ptr/thread/
	mutex_weaktoshared.cc: Likewise.
	* testsuite/20_util/shared_ptr/atomic/3.cc: Likewise. Use
	dg-require-effective-target instead of using -std option.
	* testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc:
	Likewise.
	* testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc: Likewise.
	* testsuite/23_containers/vector/debug/multithreaded_swap.cc:
	Likewise.
	* testsuite/30_threads/async/*: Likewise.
	* testsuite/30_threads/call_once/*: Likewise.
	* testsuite/30_threads/condition_variable/*: Likewise.
	* testsuite/30_threads/condition_variable_any/*: Likewise.
	* testsuite/30_threads/future/*: Likewise.
	* testsuite/30_threads/lock/*: Likewise.
	* testsuite/30_threads/mutex/*: Likewise.
	* testsuite/30_threads/packaged_task/*: Likewise.
	* testsuite/30_threads/promise/*: Likewise.
	* testsuite/30_threads/recursive_mutex/*: Likewise.
	* testsuite/30_threads/recursive_timed_mutex/*: Likewise.
	* testsuite/30_threads/shared_future/*: Likewise.
	* testsuite/30_threads/shared_lock/*: Likewise.
	* testsuite/30_threads/shared_timed_mutex/*: Likewise.
	* testsuite/30_threads/this_thread/*: Likewise.
	* testsuite/30_threads/thread/*: Likewise.
	* testsuite/30_threads/timed_mutex/*: Likewise.
	* testsuite/30_threads/try_lock/*: Likewise.
	* testsuite/30_threads/unique_lock/*: Likewise.

From-SVN: r239624
2016-08-19 17:36:07 +01:00
Jonathan Wakely e6ee5bfd68 Define std::not_fn for C++17
* doc/xml/manual/status_cxx2017.xml: Update status of not_fn.
	* doc/html/*: Regenerate.
	* include/experimental/functional (_Not_fn, not_fn): Match C++17
	semantics.
	* include/std/functional (_Not_fn, not_fn): Define for C++17.
	* testsuite/20_util/not_fn/1.cc: New.
	* testsuite/experimental/functional/not_fn.cc: Test abstract class.
	Remove test for volatile-qualified wrapper.

From-SVN: r239623
2016-08-19 16:42:34 +01:00
Jonathan Wakely 387edf83a0 Define std::atomic<T>::is_always_lock_free for C++17
* include/std/atomic (atomic::is_always_lock_free): Define.
	* testsuite/29_atomics/atomic/60695.cc: Adjust dg-error lineno.
	* testsuite/29_atomics/atomic/is_always_lock_free.cc: New.
	* testsuite/29_atomics/atomic_integral/is_always_lock_free.cc: New.
	* doc/xml/manual/status_cxx2017.xml: Update status.
	* doc/html/*: Regenerate.

From-SVN: r239622
2016-08-19 16:42:27 +01:00
Jonathan Wakely 285ee2fb11 Fix ambiguities in C++17 mode
* include/experimental/tuple (apply): Qualify call to __apply_impl.
	* include/std/tuple (apply): Likewise.
	* testsuite/experimental/system_error/value.cc: Fix ambiguities in
	C++17 mode.
	* testsuite/experimental/tuple/tuple_size.cc: Likewise.
	* testsuite/experimental/type_traits/value.cc: Likewise.

From-SVN: r239621
2016-08-19 16:42:11 +01:00
Jakub Jelinek 1cad928453 re PR fortran/71014 (associate statement inside omp parallel do appears to disable default private attribute for inner loop indices)
PR fortran/71014
	* resolve.c (gfc_resolve): For ns->construct_entities don't save, clear
	and restore omp state around the resolving.

	* testsuite/libgomp.fortran/pr71014.f90: New test.

From-SVN: r239620
2016-08-19 17:30:33 +02:00
Jakub Jelinek fbdbd4b6d7 re PR fortran/72744 (ICE in verify_ssa, at tree-ssa.c:1039)
PR fortran/72744
	* gfortran.dg/gomp/pr72744.f90: New test.

From-SVN: r239619
2016-08-19 17:28:59 +02:00
Jakub Jelinek 94e73c7869 re PR fortran/69281 (gfortran ICE on temporary array in function call with -fstack-arrays -fopenmp)
PR fortran/69281
	* trans-openmp.c (gfc_trans_omp_parallel, gfc_trans_omp_task,
	gfc_trans_omp_target): Wrap gfc_trans_omp_code result in an extra
	BIND_EXPR with its own forced BLOCK.

	* gfortran.dg/gomp/pr69281.f90: New test.

From-SVN: r239618
2016-08-19 17:27:40 +02:00
Jakub Jelinek b5fd0b71fe rdseedintrin.h (_rdseed16_step, [...]): Uglify argument names and/or local variable names in inline functions.
* config/i386/rdseedintrin.h (_rdseed16_step, _rdseed32_step,
	_rdseed64_step): Uglify argument names and/or local variable names
	in inline functions.
	* config/i386/rtmintrin.h (_xabort): Likewise.
	* config/i386/avx512vlintrin.h (_mm256_ternarylogic_epi64,
	_mm256_mask_ternarylogic_epi64, _mm256_maskz_ternarylogic_epi64,
	_mm256_ternarylogic_epi32, _mm256_mask_ternarylogic_epi32,
	_mm256_maskz_ternarylogic_epi32, _mm_ternarylogic_epi64,
	_mm_mask_ternarylogic_epi64, _mm_maskz_ternarylogic_epi64,
	_mm_ternarylogic_epi32, _mm_mask_ternarylogic_epi32,
	_mm_maskz_ternarylogic_epi32): Likewise.
	* config/i386/lwpintrin.h (__llwpcb, __lwpval32, __lwpval64,
	__lwpins32, __lwpins64): Likewise.
	* config/i386/avx2intrin.h (_mm_i32gather_pd, _mm_mask_i32gather_pd,
	_mm256_i32gather_pd, _mm256_mask_i32gather_pd, _mm_i64gather_pd,
	_mm_mask_i64gather_pd, _mm256_i64gather_pd, _mm256_mask_i64gather_pd,
	_mm_i32gather_ps, _mm_mask_i32gather_ps, _mm256_i32gather_ps,
	_mm256_mask_i32gather_ps, _mm_i64gather_ps, _mm_mask_i64gather_ps,
	_mm256_i64gather_ps, _mm256_mask_i64gather_ps, _mm_i32gather_epi64,
	_mm_mask_i32gather_epi64, _mm256_i32gather_epi64,
	_mm256_mask_i32gather_epi64, _mm_i64gather_epi64,
	_mm_mask_i64gather_epi64, _mm256_i64gather_epi64,
	_mm256_mask_i64gather_epi64, _mm_i32gather_epi32,
	_mm_mask_i32gather_epi32, _mm256_i32gather_epi32,
	_mm256_mask_i32gather_epi32, _mm_i64gather_epi32,
	_mm_mask_i64gather_epi32, _mm256_i64gather_epi32,
	_mm256_mask_i64gather_epi32): Likewise.
	* config/i386/pmm_malloc.h (_mm_malloc, _mm_free): Likewise.
	* config/i386/ia32intrin.h (__writeeflags): Likewise.
	* config/i386/pkuintrin.h (_wrpkru): Likewise.
	* config/i386/avx512pfintrin.h (_mm512_mask_prefetch_i32gather_pd,
	_mm512_mask_prefetch_i32gather_ps, _mm512_mask_prefetch_i64gather_pd,
	_mm512_mask_prefetch_i64gather_ps, _mm512_prefetch_i32scatter_pd,
	_mm512_prefetch_i32scatter_ps, _mm512_mask_prefetch_i32scatter_pd,
	_mm512_mask_prefetch_i32scatter_ps, _mm512_prefetch_i64scatter_pd,
	_mm512_prefetch_i64scatter_ps, _mm512_mask_prefetch_i64scatter_pd,
	_mm512_mask_prefetch_i64scatter_ps): Likewise.
	* config/i386/gmm_malloc.h (_mm_malloc, _mm_free): Likewise.
	* config/i386/avx512fintrin.h (_mm512_ternarylogic_epi64,
	_mm512_mask_ternarylogic_epi64, _mm512_maskz_ternarylogic_epi64,
	_mm512_ternarylogic_epi32, _mm512_mask_ternarylogic_epi32,
	_mm512_maskz_ternarylogic_epi32, _mm512_i32gather_ps,
	_mm512_mask_i32gather_ps, _mm512_i32gather_pd, _mm512_i64gather_ps,
	_mm512_i64gather_pd, _mm512_i32gather_epi32, _mm512_i32gather_epi64,
	_mm512_i64gather_epi32, _mm512_i64gather_epi64): Likewise.

From-SVN: r239617
2016-08-19 17:25:05 +02:00
Jakub Jelinek 31c2bc2e0d fxsrintrin.h (_fxsave): Remove return keyword in inlines returning void.
* config/i386/fxsrintrin.h (_fxsave): Remove return keyword in inlines
	returning void.
	(_fxrstor, _fxsave64, _fxrstor64): Likewise.
	* config/i386/xsaveintrin.h (_xsave, _xrstor, _xsave64, _xrstor64):
	Likewise.
	* config/i386/xsaveoptintrin.h (_xsaveopt, _xsaveopt64): Likewise.
	* config/i386/pkuintrin.h (_wrpkru): Likewise.  Add space after
	function name.
	(_rdpkru_u32): Add space after function name.

From-SVN: r239616
2016-08-19 17:24:22 +02:00
Jakub Jelinek 81457d6bac t-i386 (i386-c.o): Don't depend on i386-builtin-types.inc.
* config/i386/t-i386 (i386-c.o): Don't depend on
	i386-builtin-types.inc.
	(i386.o): Depend on i386-builtin-types.inc.

From-SVN: r239615
2016-08-19 17:23:42 +02:00
Janne Blomqvist 09309e09ec Use a XOR cipher instead of byte shuffling to protect against bad seeds.
libgfortran:
2016-08-19  Janne Blomqvist  <jb@gcc.gnu.org>

        * intrinsics/random.c (xor_keys): New array with "secret" keys.
        (scramble_seed): XOR given seed with xor_keys array rather than
        shuffling bytes.
        (unscramble_seed): Remove function.
        (random_seed_i4): Use new scramble_seed.
        (random_seed_i8): Likewise.

frontend:
2016-08-19  Janne Blomqvist  <jb@gcc.gnu.org>

        * intrinsics.texi (RANDOM_NUMBER): Remove reference to
        init_random_seed in example.
        (RANDOM_SEED): Remove warning to not set all seed values to 0.

From-SVN: r239613
2016-08-19 17:19:51 +03:00
Janne Blomqvist 91151a7334 Always initialize PRNG using random data from the OS.
libgfortran:

2016-08-16  Janne Blomqvist  <jb@gcc.gnu.org>

        * intrinsics/random.c (master_init): New variable.
        (init_rand_state): Move below getosrandom (), maybe initialize
        master_state.
        (random_seed_i4): If called with no arguments, set master_init to
        false, and reinitialize. If called with PUT=, set master_init to
        true.
        (random_seed_i8): Likewise.

testsuite:

2016-08-16  Janne Blomqvist  <jb@gcc.gnu.org>

        * gfortran.dg/random_4.f90: Initialize seed before using, handle
        the last special seed value.
        * gfortran.dg/random_7.f90: Use size for last array member instead
        of hardcoded value.

From-SVN: r239611
2016-08-19 17:12:32 +03:00
Matthew Wahab f0c90610e3 [ARM] Fix an invalid check for vectors of the same floating-point constants.
2016-08-19  Matthew Wahab  <matthew.wahab@arm.com>

	PR target/77281
	* config/arm/arm.c (neon_valid_immediate): Delete declaration.
	Use const_vec_duplicate to check for duplicated elements.

From-SVN: r239610
2016-08-19 13:59:18 +00:00
Prathamesh Kulkarni fcf830abf7 expr.c (eval_token): Append "evaluates to 0" to Wundef diagnostic.
2016-08-19  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>

libcpp/
	* expr.c (eval_token): Append "evaluates to 0" to Wundef diagnostic.

testsuite/
	* gcc.dg/cpp/warn-undef.c: Append "evaluates to 0" to dg-error.
	* gcc.dg/cpp/warn-undef-2.c: Likewise.

From-SVN: r239609
2016-08-19 13:17:09 +00:00
Jonathan Wakely 1f4ed04ed8 Update C++17 library status table
* doc/xml/manual/status_cxx2017.xml: Update status of make_from_tuple
	and variant.
	* doc/html/*: Regenerate.

From-SVN: r239608
2016-08-19 09:16:13 +01:00
Richard Biener 9ca60517a0 re PR tree-optimization/77290 (test case gcc.dg/tree-ssa/pr71347.c fails starting with r239565)
2016-08-19  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/77290
	* tree-ssa-pre.c (eliminate_dom_walker::before_dom_children):
	Fix flag_tree_parallelize_loops check.

From-SVN: r239607
2016-08-19 07:43:11 +00:00
Richard Biener ca0b7ecec7 match.pd (x | 0 -> x): Add.
2016-08-19  Richard Biener  <rguenther@suse.de>

	* match.pd (x | 0 -> x): Add.

From-SVN: r239606
2016-08-19 07:03:48 +00:00
Richard Biener 1a5da5b66a re PR tree-optimization/77286 (ICE in fold_convert_loc, at fold-const.c:2248 building 435.gromacs)
2016-08-19  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/77286
	* tree-vect-loop-manip.c (slpeel_duplicate_current_defs_from_edges):
	Deal with virtual PHIs being out-of-order.

	* gcc.dg/torture/pr77286.c: New testcase.

From-SVN: r239605
2016-08-19 07:02:05 +00:00
David Malcolm 82f7214696 Add source information to -fverbose-asm
gcc/ChangeLog:
	* doc/invoke.texi (fverbose-asm): Note that source code lines
	are emitted, and provide an example.
	* final.c (asm_show_source): New function.
	(final_scan_insn): Call asm_show_source.

From-SVN: r239604
2016-08-19 00:18:18 +00:00
GCC Administrator f4e46e34a2 Daily bump.
From-SVN: r239603
2016-08-19 00:16:14 +00:00
Ville Voutilainen a577f786b6 Implement the latest proposed resolution of LWG 2756.
* include/std/optional (Optional_base(const _Tp&))
	(Optional_base(_Tp&&), using _Base::_Base): Remove.
	(optional(nullopt_t)): New.
	(optional(_Up&&)): Invoke base directly with in_place
	rather than creating a temporary, add default template
	argument, change constraints.
	(optional(const optional<_Up>&)): Invoke base directly
	with in_place, remove unnecessary constraints.
	(optional(optional<_Up>&& __t)): Likewise.
	(optional(in_place_t, _Args&&...)): New.
	(optional(in_place_t, initializer_list<_Up>, _Args&&...)): Likewise.
	(operator=(_Up&&)): Add default template argument, change constraints.
	(operator=(const optional<_Up>&)): Put is_same first in the
	constraints.
	(operator=(optional<_Up>&&)): Likewise.
	* testsuite/20_util/optional/assignment/5.cc: Add a test to
	verify assignment from something that can't be perfect-forwarded.
	* testsuite/20_util/optional/cons/value.cc: Add tests to verify
	that a nested optional is disengaged when constructed
	from a disengaged element type,	and to verify that assignments
	from an engaged element type engage the optional.

From-SVN: r239593
2016-08-18 23:33:57 +03:00
Tim Shen 197c757cb1 Implement <variant>
* include/Makefile.am: Add new file std/variant.
	* include/Makefile.in: Generated from Makefile.am.
	* include/bits/enable_special_members.h: Add a tag type to allow
	the construction in non-default constructor.
	* include/bits/uses_allocator.h: Add convenience traits to
	detect constructibility.
	* include/std/variant: Implement <variant>.
	* testsuite/20_util/variant/compile.cc: Compile-time tests.
	* testsuite/20_util/variant/run.cc: Runtime tests.

From-SVN: r239590
2016-08-18 20:31:26 +00:00
David Malcolm cc015f3abe Allow calling diagnostic_show_locus without a diagnostic_info
Much of diagnostic-show-locus.c currently expects a diagnostic_info *,
but it only uses the rich_location and the diagnostic_t.

Change the signature of diagnostic_show_locus from:

  void
  diagnostic_show_locus (diagnostic_context *,
                         const diagnostic_info *);

to:

  void
  diagnostic_show_locus (diagnostic_context *,
                         rich_location *richloc,
                         diagnostic_t diagnostic_kind);

so that it can be used for things other than diagnostics.

Use this flexibility to add selftests for diagnostic_show_locus.

gcc/c-family/ChangeLog:
	* c-opts.c (c_diagnostic_finalizer): Update for change to
	diagnostic_show_locus.

gcc/ChangeLog:
	* diagnostic-show-locus.c (colorizer::colorizer): Replace diagnostic
	param with diagnostic_kind.
	(class colorizer): Similarly replace field m_diagnostic with
	m_diagnostic_kind.
	(colorizer::colorizer): Replace diagnostic
	param with diagnostic_kind.
	(colorizer::begin_state): Update for above field change.
	(layout::layout): Replace diagnostic param with rich_location *
	and diagnostic_kind.
	(diagnostic_show_locus): Replace diagnostic param with richloc
	and diagnostic_kind.
	(class selftest::test_diagnostic_context): New class.
	(selftest::test_diagnostic_show_locus_unknown_location): New
	function.
	(selftest::test_one_liner_simple_caret): New function.
	(selftest::test_one_liner_caret_and_range): New function.
	(selftest::test_one_liner_multiple_carets_and_ranges): New
	function.
	(selftest::test_one_liner_fixit_remove): New function.
	(selftest::test_one_liner_fixit_replace): New function.
	(selftest::test_diagnostic_show_locus_one_liner): New function.
	(selftest::diagnostic_show_locus_c_tests): Call the new test
	functions.
	* diagnostic.c (diagnostic_initialize): Initialize
	colorize_source_p, show_ruler_p and parseable_fixits_p.
	(default_diagnostic_finalizer): Update for change to
	diagnostic_show_locus.
	(diagnostic_append_note): Likewise.
	* diagnostic.h (diagnostic_show_locus): Replace
	const diagnostic_info * param with location * and diagnostic_t.

gcc/fortran/ChangeLog:
	* error.c (gfc_diagnostic_starter): Update for change to
	diagnostic_show_locus.

gcc/testsuite/ChangeLog:
	* gcc.dg/plugin/diagnostic_plugin_test_show_locus.c
	(custom_diagnostic_finalizer): Update for change to
	diagnostic_show_locus.

From-SVN: r239586
2016-08-18 19:12:54 +00:00
David Malcolm cb18fd07f2 Spelling suggestions for misspelled preprocessor directives
This patch allows the preprocessor to offer suggestions for misspelled
directives, taking us from e.g.:

test.c:5:2: error: invalid preprocessing directive #endfi
 #endfi
  ^~~~~

to:

test.c:5:2: error: invalid preprocessing directive #endfi; did you mean #endif?
 #endfi
  ^~~~~
  endif

gcc/c-family/ChangeLog:
	* c-common.c: Include "spellcheck.h".
	(cb_get_suggestion): New function.
	* c-common.h (cb_get_suggestion): New decl.
	* c-lex.c (init_c_lex): Initialize cb->get_suggestion to
	cb_get_suggestion.

gcc/testsuite/ChangeLog:
	* gcc.dg/cpp/misspelled-directive-1.c: New testcase.
	* gcc.dg/cpp/misspelled-directive-2.c: New testcase.

libcpp/ChangeLog:
	* directives.c (directive_names): New array.
	(_cpp_handle_directive): Offer spelling suggestions for misspelled
	directives.
	* errors.c (cpp_diagnostic_at_richloc): New function.
	(cpp_error_at_richloc): New function.
	* include/cpplib.h (struct cpp_callbacks): Add field
	"get_suggestion".
	(cpp_error_at_richloc): New decl.

From-SVN: r239585
2016-08-18 18:52:43 +00:00
Marek Polacek a76989dc7c re PR c/71514 (ICE on C11 code with atomic exchange at -O1 and above on x86_64-linux-gnu: in copy_reference_ops_from_ref, at tree-ssa-sccvn.c:879)
PR c/71514
	* c-common.c (get_atomic_generic_size): Disallow pointer-to-function
	and pointer-to-VLA.

	* gcc.dg/pr71514.c: New test.

From-SVN: r239581
2016-08-18 16:38:49 +00:00
David Malcolm f87e22c521 selftest.h: add class line_table_test
input.c has a fixture class for running each selftest with a fresh
line_table, and logic for looping over various interesting line_table
test cases.

This patch exposes the above in selftest.h so that such
location-handling tests can be written in other files, renaming the
class from temp_line_table to line_table_test.

Also, the patch moves the stored line table ptr from being a member of
the test class to being a global GC-root, to avoid it being collected
if the GC runs during such a test.

gcc/ChangeLog:
	* input.c (saved_line_table): New global.
	(class selftest::temp_line_table): Rename to line_table_test and
	move declaration to selftest.h, and drop field m_old_line_table.
	(selftest::temp_line_table::temp_line_table): Rename ctor to...
	(selftest::line_table_test::line_table_test): ...this.  Add a
	default ctor.  Store current value of line_table within
	saved_line_table.
	(selftest::temp_line_table::~temp_line_table): Rename dtor to...
	(selftest::line_table_test::~line_table_test): ...this, and
	restore line_table from the saved_line_table, rather than
	m_old_line_table.
	(selftest::test_accessing_ordinary_linemaps): Update for above
	renaming.
	(selftest::test_lexer): Likewise.
	(struct selftest::lexer_test): Likewise.
	(selftest::lexer_test::lexer_test): Likewise.
	(selftest::input_c_tests): Move the looping over test cases from
	here into...
	(selftest::for_each_line_table_case): New function.
	* input.h (saved_line_table): New decl.
	* selftest.h (struct selftest::line_table_case): New forward decl.
	(class selftest::line_table_test): New class, moved here from
	selftest::temp_line_table in input.c, and renamed.
	(selftest::for_each_line_table_case): New decl.

From-SVN: r239580
2016-08-18 16:22:10 +00:00
H.J. Lu 89c8878092 Increase MOVE_RATIO to 17 for Lakemont
Larger MOVE_RATIO will always make code faster.  17 is the number with
smaller code sizes for Lakemont.

gcc/

	PR target/72839
	* config/i386/i386.c (lakemont_cost): Set MOVE_RATIO to 17.

gcc/testsuite/

	PR target/72839
	* gcc.target/i386/pr72839.c: New test.

From-SVN: r239578
2016-08-18 07:59:46 -07:00
Chung-Lin Tang 2c71d454eb re PR middle-end/70895 (OpenACC: loop reduction does not work. Output is zero.)
2016-08-18  Chung-Lin Tang  <cltang@codesourcery.com>

	PR middle-end/70895
	gcc/
	* gimplify.c (omp_add_variable): Adjust/add variable mapping on
	enclosing parallel construct for reduction variables on OpenACC loop
	directives.

	gcc/testsuite/
	* gfortran.dg/goacc/loop-tree-1.f90: Add gimple scan-tree-dump test.
	* c-c++-common/goacc/reduction-1.c: Likewise.
	* c-c++-common/goacc/reduction-2.c: Likewise.
	* c-c++-common/goacc/reduction-3.c: Likewise.
	* c-c++-common/goacc/reduction-4.c: Likewise.

	libgomp/
	* testsuite/libgomp.oacc-fortran/reduction-7.f90: Add explicit
	firstprivate clauses.
	* testsuite/libgomp.oacc-fortran/reduction-6.f90: Remove explicit
	copy clauses.
	* testsuite/libgomp.oacc-c-c++-common/reduction-7.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/reduction-cplx-flt.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/reduction-flt.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/collapse-2.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/loop-red-wv-1.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/collapse-4.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/reduction-cplx-dbl.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c: Likewise.
	* testsuite/libgomp.oacc-c-c++-common/reduction-dbl.c: Likewise.

From-SVN: r239576
2016-08-18 14:46:19 +00:00
Pierre-Marie de Rodat 80c5ad359f DWARF: do not emit DW_TAG_variable to materialize DWARF procedures
Hello,

For -gdwarf-3 and newer, the DWARF back-end sometimes generates DWARF
procedures to factorize complex location descriptions.  DWARF procedures
can be materialized as DW_TAG_dwarf_procedure DIEs, but actually any DIE
that can hold a DW_AT_location attribute is also accepted.

Unlike what I thought at some point, the DW_TAG_dwarf_procedure tag was
introduced in the DWARFv3 standard, not the DWARFv4 one, so the back-end
can always emit DW_TAG_dwarf_procedure DIEs, as this simplifies code and
prevents the types pruning pass from missing a DWARF procedure.

Boostrapped and regtested on x86_64-linux: no regression.  Ok to commit?
Thank you in advance!

gcc/

	* dwarf2out.c (copy_dwarf_procedure): Remove obsolete comment.
	(new_dwarf_proc_die): Emit DW_TAG_dwarf_procedure DIEs even for
	-gdwarf-3.
	(function_to_dwarf_procedure): Update comment.

From-SVN: r239575
2016-08-18 14:39:22 +00:00