Commit Graph

187778 Commits

Author SHA1 Message Date
Bill Schmidt
e2693a7270 rs6000: Add remaining overloads
2021-08-26  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-overload.def: Add remaining overloads.
2021-08-26 14:34:00 -05:00
Bill Schmidt
a7f13a5199 rs6000: Add Cell builtins
2021-06-07  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-builtin-new.def: Add cell stanza.
2021-08-26 14:31:19 -05:00
Bill Schmidt
2f9489a100 rs6000: Add miscellaneous builtins
2021-06-15  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-builtin-new.def: Add ieee128-hw, dfp,
	crypto, and htm stanzas.
2021-08-26 14:31:16 -05:00
Bill Schmidt
344951b639 rs6000: Add MMA builtins
2021-06-16  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-builtin-new.def: Add mma stanza.
2021-08-26 14:31:14 -05:00
Martin Sebor
4e84e381f2 Refactor warn_uninit() code.
gcc/ChangeLog:

	* tree-ssa-uninit.c (warn_uninit): Refactor and simplify.
	(warn_uninit_phi_uses): Remove argument from calls to warn_uninit.
	(warn_uninitialized_vars): Same.  Reduce visibility of locals.
	(warn_uninitialized_phi): Same.
2021-08-26 13:15:38 -06:00
Roger Sayle
b2ef23239f Improved handling of shifts/rotates in bit CCP.
This patch is the next in the series to improve bit bounds in tree-ssa's
bit CCP pass, this time: bounds for shifts and rotates by unknown amounts.
This allows us to optimize expressions such as ((x&15)<<(y&24))&64.
In this case, the expression (y&24) contains only two unknown bits,
and can therefore have only four possible values: 0, 8, 16 and 24.
From this (x&15)<<(y&24) has the nonzero bits 0x0f0f0f0f, and from
that ((x&15)<<(y&24))&64 must always be zero.

One clever use of computer science in this patch is the use of XOR
to efficiently enumerate bit patterns in Gray code order.  As the
order in which we generate values is not significant, it's faster
and more convenient to enumerate values by flipping one bit at a
time, rather than in numerical order [which would require carry
bits and additional logic].

There's a pre-existing ??? comment in tree-ssa-ccp.c that we should
eventually be able to optimize (x<<(y|8))&255, but this patch takes the
conservatively paranoid approach of only optimizing cases where the
shift/rotate is guaranteed to be less than the target precision, and
therefore avoids changing any cases that potentially might invoke
undefined behavior.  This patch does optimize (x<<((y&31)|8))&255.

2021-08-26  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
	* tree-ssa-ccp.c (get_individual_bits): Helper function to
	extract the individual bits from a widest_int constant (mask).
	(gray_code_bit_flips): New read-only table for effiently
	enumerating permutations/combinations of bits.
	(bit_value_binop) [LROTATE_EXPR, RROTATE_EXPR]: Handle rotates
	by unknown counts that are guaranteed less than the target
	precision and four or fewer unknown bits by enumeration.
	[LSHIFT_EXPR, RSHIFT_EXPR]: Likewise, also handle shifts by
	enumeration under the same conditions.  Handle remaining
	shifts as a mask based upon the minimum possible shift value.

gcc/testsuite/ChangeLog
	* gcc.dg/tree-ssa/ssa-ccp-41.c: New test case.
2021-08-26 18:57:00 +01:00
Roger Sayle
a2d9b55829 [Committed] Tidy up !POINTER_TYPE_P test in match.pd LSHIFT_EXPR folding
As suggested by Richard Biener in the comments of PR middle-end/102029,
the new test "INTEGRAL_TYPE_P (type) && !POINTER_TYPE_P (type) ..." is
redundant, and just "INTEGRAL_TYPE_P (type)" is the preferred form.

2021-08-26  Roger Sayle  <roger@nextmovesoftware.com>
	    Richard Biener  <rguenther@suse.de>

gcc/ChangeLog
	* match.pd (shift transformations): Remove a redundant
	!POINTER_TYPE_P check.
2021-08-26 18:51:46 +01:00
Uros Bizjak
226eb7ff5d [i386] Set all_regs to true in the call to replace_rtx [PR102057]
We want to replace all REGs equal to FROM.

2021-08-26  Uroš Bizjak  <ubizjak@gmail.com>

gcc/
	PR target/102057
	* config/i386/i386.md (cmove reg-reg move elimination peephole2s):
	Set all_regs to true in the call to replace_rtx.
2021-08-26 17:27:05 +02:00
Jan Hubicka
e28ac73af2 Improve handling of modref params.
this patch makes insertion to modref access tree smarter when --param
modref-max-bases and moredref-max-refs are hit.  Instead of giving up
we either give up on base alias set (make it equal to ref) or turn the
alias set to 0.  This lets us to track useful info on quite large
functions, such as ggc_free.

gcc/ChangeLog:

	* ipa-modref-tree.c (test_insert_search_collapse): Update test.
	* ipa-modref-tree.h (modref_base_node::insert): Be smarter when
	hiting --param modref-max-refs limit.
	(modref_tree:insert_base): Be smarter when hitting
	--param modref-max-bases limit. Add new parameter REF.
	(modref_tree:insert): Update.
	(modref_tree:merge): Update.
	* ipa-modref.c (read_modref_records): Update.
2021-08-26 16:57:46 +02:00
Jan Hubicka
c80d7230fb Add full stop to params.opt.
gcc/ChangeLog:

	* params.opt: (modref-max-adjustments): Add full stop.
2021-08-26 16:01:53 +02:00
Jan Hubicka
f075b8c5ad Fix off-by-one error in try_merge_with
gcc/ChangeLog:

	* ipa-modref-tree.h (modref_ref_node::verify): New member
	functoin.
	(modref_ref_node::insert): Use it.
	(modref_ref_node::try_mere_with): Fix off by one error.
2021-08-26 15:33:56 +02:00
Jonathan Wakely
cd67d138ec libstdc++: Make Networking TS headers more portable [PR100285]
Add more preprocessor conditions to check for constants being defined
before using them, so that the Networking TS headers can be compiled on
a wider range of platforms.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	PR libstdc++/100285
	* configure.ac: Check for O_NONBLOCK.
	* configure: Regenerate.
	* include/experimental/internet: Include <ws2tcpip.h> for
	Windows.  Use preprocessor conditions around more constants.
	* include/experimental/socket: Use preprocessor conditions
	around more constants.
	* testsuite/experimental/net/internet/resolver/base.cc: Only use
	constants when the corresponding C macro is defined.
	* testsuite/experimental/net/socket/basic_socket.cc: Likewise.
	* testsuite/experimental/net/socket/socket_base.cc: Likewise.
	Make preprocessor checks more fine-grained.
2021-08-26 12:41:28 +01:00
Martin Liska
e370a2482d mklog: fix renaming with version 0.7.0.
contrib/ChangeLog:

	* mklog.py: Use file.{source,target}_file for proper rename
	handling.
2021-08-26 10:20:20 +02:00
Martin Liska
bfc9250e0d Use non-numbered clones for target_clones.
gcc/ChangeLog:

	* cgraph.h (create_version_clone_with_body): Add new parameter.
	* cgraphclones.c: Likewise.
	* multiple_target.c (create_dispatcher_calls): Do not use
	numbered suffixes.
	(create_target_clone): Likewise here.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/mvc5.c: Scan assembly names.
	* gcc.target/i386/mvc7.c: Likewise.
	* gcc.target/i386/pr95778-1.c: Update scanned patterns.
	* gcc.target/i386/pr95778-2.c: Likewise.

Co-Authored-By: Stefan Kneifel <stefan.kneifel@bluewin.ch>
2021-08-26 09:51:11 +02:00
Jonathan Yong
d4b782985b extend.texi: add note about reserved ctor/dtor priorities
gcc/Changelog:

	* doc/extend.texi: Add note about reserved priorities
	to the constructor attribute.

Signed-off-by: Jonathan Yong <10walls@gmail.com>
2021-08-26 01:32:34 +00:00
Jonathan Yong
0012f921b6 cygming-crtend.c: fix build warnings
libgcc/Changelog:

	* config/i386/cygming-crtend.c: Fix register_frame_ctor
	and register_frame_dtor warnings.

Signed-off-by: Jonathan Yong <10walls@gmail.com>
2021-08-26 01:32:33 +00:00
GCC Administrator
85d77ac474 Daily bump. 2021-08-26 00:17:03 +00:00
Martin Sebor
4de346d8a2 Add -details to dump option needed after r12-3144.
gcc/testsuite:
	* gcc.dg/tree-ssa/evrp1.c: Add -details to dump option.
	* gcc.dg/tree-ssa/evrp2.c: Same.
	* gcc.dg/tree-ssa/evrp3.c: Same.
	* gcc.dg/tree-ssa/evrp4.c: Same.
	* gcc.dg/tree-ssa/evrp6.c: Same.
	* gcc.dg/tree-ssa/pr64130.c: Same.
2021-08-25 17:29:20 -06:00
Michael Meissner
4c5d76a655 Fix tests that require IBM 128-bit long double
This patch adds 3 more selections to target-supports.exp to see if we can
specify to use a particular long double format (IEEE 128-bit, IBM extended
double, 64-bit), and the library support will track the changes for the long
double.  This is needed because two of the tests in the test suite use long
double, and they are actually testing IBM extended double.

This patch also forces the two tests that explicitly require long double
to use the IBM double-double encoding to explicitly run the test.  This
requires GLIBC 2.32 or greater in order to do the switch.

I have run tests on a little endian power9 system with 3 compilers.  There were
no regressions with these patches, and the two tests in the following patches
now work if the default long double is not IBM 128-bit:

 * One compiler used the default IBM 128-bit format;
 * One compiler used the IEEE 128-bit format; (and)
 * One compiler used 64-bit long doubles.

I have also tested compilers on a big endian power8 system with a compiler
defaulting to power8 code generation and another with the default cpu
set.  There were no regressions.

2021-08-25  Michael Meissner  <meissner@linux.ibm.com>

gcc/testsuite/
	PR target/94630
	* gcc.target/powerpc/pr70117.c: Specify that we need the long double
	type to be IBM 128-bit.  Remove the code to use __ibm128.
	* c-c++-common/dfp/convert-bfp-11.c: Specify that we need the long
	double type to be IBM 128-bit.  Run the test at -O2 optimization.
	* lib/target-supports.exp (add_options_for_long_double_ibm128): New
	function.
	(check_effective_target_long_double_ibm128): New function.
	(add_options_for_long_double_ieee128): New function.
	(check_effective_target_long_double_ieee128): New function.
	(add_options_for_long_double_64bit): New function.
	(check_effective_target_long_double_64bit): New function.
2021-08-25 19:25:12 -04:00
Jonathan Wakely
ea5674687a libstdc++: Add another non-reserved name to tests
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* testsuite/17_intro/names.cc: Check 'sz'.
2021-08-26 00:09:13 +01:00
Jonathan Wakely
f1a08f4d78 libstdc++: Fix names.cc test failures on Windows
The Windows CRT headers define structs with members called f, x, y etc
so don't check those. There are also lots of unnecessary function
parameters in mingw headers using non-reserved names, e.g.

<time.h> uses p and z as parameters of mingw_gettimeofday
<inttypes.h> uses j as a parameter of imaxabs
<pthread.h> uses l, o and func as parameter names

Those should be fixed in the headers instead.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* testsuite/17_intro/names.cc: Adjust for Windows.
2021-08-25 22:29:27 +01:00
Jonathan Wakely
0163bbaaef libstdc++: Fix non-reserved names in <valarray>
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/std/valarray: Uglify 'func' parameters.
	* testsuite/17_intro/names.cc: Add 'func' to checks.
2021-08-25 22:29:26 +01:00
Jonathan Wakely
ead408529d libstdc++: Fix conditions for optimizing uninitialized algos [PR102064]
While laying some groundwork for constexpr std::vector, I noticed some
bugs in the std::uninitialized_xxx algorithms. The conditions being
checked for optimizing trivial cases were not quite right, as shown in
the examples in the PR.

This consolidates the checks into a single macro. The macro has
appropriate definitions for C++98 or for later standards, to avoid a #if
everywhere the checks are used. For C++11 and later the check makes a
call to a new function doing a static_assert to ensure we don't use
assignment in cases where construction would have been invalid.
Extracting that check to a separate function will be useful for
constexpr std::vector, as that can't use std::uninitialized_copy
directly because it isn't constexpr).

The consolidated checks mean that some slight variations in static
assert message are gone, as there is only one place that does the assert
now. That required adjusting some tests. As part of that the redundant
89164_c++17.cc test was merged into 89164.cc which is compiled as C++17
by default now, but can also use other -std options if the
C++17-specific error is made conditional with a target selector.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	PR libstdc++/102064
	* include/bits/stl_uninitialized.h (_GLIBCXX_USE_ASSIGN_FOR_INIT):
	Define macro to check conditions for optimizing trivial cases.
	(__check_constructible): New function to do static assert.
	(uninitialized_copy, uninitialized_fill, uninitialized_fill_n):
	Use new macro.
	* testsuite/20_util/specialized_algorithms/uninitialized_copy/1.cc:
	Adjust dg-error pattern.
	* testsuite/23_containers/vector/cons/89164.cc: Likewise. Add
	C++17-specific checks from 89164_c++17.cc.
	* testsuite/23_containers/vector/cons/89164_c++17.cc: Removed.
	* testsuite/20_util/specialized_algorithms/uninitialized_copy/102064.cc:
	New test.
	* testsuite/20_util/specialized_algorithms/uninitialized_copy_n/102064.cc:
	New test.
	* testsuite/20_util/specialized_algorithms/uninitialized_fill/102064.cc:
	New test.
	* testsuite/20_util/specialized_algorithms/uninitialized_fill_n/102064.cc:
	New test.
2021-08-25 22:28:47 +01:00
Jonathan Wakely
2cd229dec8 libstdc++: Remove __gnu_cxx::rope::erase(size_type) [PR102048]
This function claims to remove a single character at index p, but it
actually removes p+1 characters beginning at p. So r.erase(0) removes
the first character, but r.erase(1) removes the second and third, and
r.erase(2) removes the second, third and fourth. This is not a useful
API.

The overload is present in the SGI STL <stl_rope.h> header that we
imported, but it isn't documented in the API reference. The erase
overloads that are documented are:

erase(const iterator& p)
erase(const iterator& f, const iterator& l)
erase(size_type i, size_type n);

Having an erase(size_type p) overload that erases a single character (as
the comment says it does) might be useful, but would be inconsistent
with std::basic_string::erase(size_type p = 0, size_type n = npos),
which erases from p to the end of the string when called with a single
argument.

Since the function isn't part of the documented API, doesn't do what it
claims to do (or anything useful) and "fixing" it would leave it
inconsistent with basic_string, I'm just removing that overload.

libstdc++-v3/ChangeLog:

	PR libstdc++/102048
	* include/ext/rope (rope::erase(size_type)): Remove broken
	function.
2021-08-25 22:28:46 +01:00
Andrew Pinski
971df602e0 Fix PR c++/66590: incorrect warning "reaches end of non-void function" for switch
So the problem here is there is code in the C++ front-end not to add a
break statement (to the IR) if the previous block does not fall through.
The problem is the code which does the check to see if the block
may fallthrough does not check a CLEANUP_STMT; it assumes it is always
fall through.  Anyways this adds the code for the case of a CLEANUP_STMT
that is only for !CLEANUP_EH_ONLY (the try/finally case).

OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

gcc/cp/ChangeLog:

	PR c++/66590
	* cp-objcp-common.c (cxx_block_may_fallthru): Handle
	CLEANUP_STMT for the case which will be try/finally.

gcc/testsuite/ChangeLog:

	PR c++/66590
	* g++.dg/warn/Wreturn-5.C: New test.
2021-08-25 21:27:18 +00:00
Martin Sebor
ed3de423f1 Avoid printing range table header alone.
gcc/ChangeLog:
	* gimple-range-cache.cc (ssa_global_cache::dump): Avoid printing
	range table header alone.
	* gimple-range.cc (gimple_ranger::export_global_ranges): Same.
2021-08-25 14:37:43 -06:00
Jakub Jelinek
1ab84eda55 c++: Fix up value initialization of structs with zero width bitfields [PR102019]
The removal of remove_zero_width_bit_fields, in addition to triggering
some ABI issues that need solving anyway (ABI incompatibility between
C and C++) also resulted in UB inside of gcc, we now call build_zero_init
which calls build_int_cst on an integral type with TYPE_PRECISION of 0.

Fixed by ignoring the zero width bitfields.  I understand
build_value_init_noctor wants to initialize to 0 even unnamed bitfields
(of non-zero width), at least until we have some CONSTRUCTOR flag that says
that even all the padding bits should be cleared.

2021-08-25  Jakub Jelinek  <jakub@redhat.com>

	PR c++/102019
	* init.c (build_value_init_noctor): Ignore unnamed zero-width
	bitfields.
2021-08-25 22:35:57 +02:00
Jan Hubicka
5c85f29537 Merge load/stores in ipa-modref summaries
this patch adds logic needed to merge neighbouring accesses in ipa-modref
summaries.  This helps analyzing array initializers and similar code.  It is
bit of work, since it breaks the fact that modref tree makes a good lattice for
dataflow: the access ranges can be extended indefinitely.  For this reason I
added counter tracking number of adjustments and a cap to limit them during the
dataflow.

gcc/ChangeLog:

	* doc/invoke.texi: Document --param modref-max-adjustments.
	* ipa-modref-tree.c (test_insert_search_collapse): Update.
	(test_merge): Update.
	* ipa-modref-tree.h (struct modref_access_node): Add adjustments;
	(modref_access_node::operator==): Fix handling of access ranges.
	(modref_access_node::contains): Constify parameter; handle also
	mismatched parm offsets.
	(modref_access_node::update): New function.
	(modref_access_node::merge): New function.
	(unspecified_modref_access_node): Update constructor.
	(modref_ref_node::insert_access): Add record_adjustments parameter;
	handle merging.
	(modref_ref_node::try_merge_with): New private function.
	(modref_tree::insert): New record_adjustments parameter.
	(modref_tree::merge): New record_adjustments parameter.
	(modref_tree::copy_from): Update.
	* ipa-modref.c (dump_access): Dump adjustments field.
	(get_access): Update constructor.
	(record_access): Update call of insert.
	(record_access_lto): Update call of insert.
	(merge_call_side_effects): Add record_adjustments parameter.
	(get_access_for_fnspec): Update.
	(process_fnspec): Update.
	(analyze_call): Update.
	(analyze_function): Update.
	(read_modref_records): Update.
	(ipa_merge_modref_summary_after_inlining): Update.
	(propagate_unknown_call): Update.
	(modref_propagate_in_scc): Update.
	* params.opt (param-max-modref-adjustments=): New.

gcc/testsuite/ChangeLog:

	* gcc.dg/ipa/modref-1.c: Update testcase.
	* gcc.dg/tree-ssa/modref-4.c: Update testcase.
	* gcc.dg/tree-ssa/modref-8.c: New test.
2021-08-25 21:43:07 +02:00
Michael Meissner
bb24717e50 Make xxsplti*, xpermx, xxeval be vecperm type.
I noticed that the built-functions for xxspltiw, xxspltidp, xxsplti32dx,
xxpermx, and xxeval all used the 'vecsimple' type.  These instructions are
permute instructions (3 cycle latency) and should use 'vecperm' instead.

While I was at it, I changed the UNSPEC name for xxspltidp to be
UNSPEC_XXSPLTIDP instead of UNSPEC_XXSPLTID.

2021-08-25  Michael Meissner  <meissner@linux.ibm.com>

gcc/
	* config/rs6000/vsx.md (UNSPEC_XXSPLTIDP): Rename from
	UNSPEC_XXSPLTID.
	(xxspltiw_v4si): Use vecperm type attribute.
	(xxspltiw_v4si_inst): Use vecperm type attribute.
	(xxspltiw_v4sf_inst): Likewise.
	(xxspltidp_v2df): Use vecperm type attribute.  Use
	UNSPEC_XXSPLTIDP instead of UNSPEC_XXSPLTID.
	(xxspltidp_v2df_inst): Likewise.
	(xxsplti32dx_v4si): Use vecperm type attribute.
	(xxsplti32dx_v4si_inst): Likewise.
	(xxsplti32dx_v4sf_inst): Likewise.
	(xxblend_<mode>): Likewise.
	(xxpermx): Likewise.
	(xxpermx_inst): Likewise.
	(xxeval): Likewise.
2021-08-25 15:11:47 -04:00
Lewis Hyatt
3ac6b5cff1 diagnostics: Support for -finput-charset [PR93067]
Adds the logic to handle -finput-charset in layout_get_source_line(), so that
source lines are converted from their input encodings prior to being output by
diagnostics machinery. Also adds the ability to strip a UTF-8 BOM similarly.

gcc/c-family/ChangeLog:

	PR other/93067
	* c-opts.c (c_common_input_charset_cb): New function.
	(c_common_post_options): Call new function
	diagnostic_initialize_input_context().

gcc/d/ChangeLog:

	PR other/93067
	* d-lang.cc (d_input_charset_callback): New function.
	(d_init): Call new function
	diagnostic_initialize_input_context().

gcc/fortran/ChangeLog:

	PR other/93067
	* cpp.c (gfc_cpp_post_options): Call new function
	diagnostic_initialize_input_context().

gcc/ChangeLog:

	PR other/93067
	* coretypes.h (typedef diagnostic_input_charset_callback): Declare.
	* diagnostic.c (diagnostic_initialize_input_context): New function.
	* diagnostic.h (diagnostic_initialize_input_context): Declare.
	* input.c (default_charset_callback): New function.
	(file_cache::initialize_input_context): New function.
	(file_cache_slot::create): Added ability to convert the input
	according to the input context.
	(file_cache::file_cache): Initialize the new input context.
	(class file_cache_slot): Added new m_alloc_offset member.
	(file_cache_slot::file_cache_slot): Initialize the new member.
	(file_cache_slot::~file_cache_slot): Handle potentially offset buffer.
	(file_cache_slot::maybe_grow): Likewise.
	(file_cache_slot::needs_read_p): Handle NULL fp, which is now possible.
	(file_cache_slot::get_next_line): Likewise.
	* input.h (class file_cache): Added input context member.

libcpp/ChangeLog:

	PR other/93067
	* charset.c (init_iconv_desc): Adapt to permit PFILE argument to
	be NULL.
	(_cpp_convert_input): Likewise. Also move UTF-8 BOM logic to...
	(cpp_check_utf8_bom): ...here.  New function.
	(cpp_input_conversion_is_trivial): New function.
	* files.c (read_file_guts): Allow PFILE argument to be NULL.  Add
	INPUT_CHARSET argument as an alternate source of this information.
	(read_file): Pass the new argument to read_file_guts.
	(cpp_get_converted_source): New function.
	* include/cpplib.h (struct cpp_converted_source): Declare.
	(cpp_get_converted_source): Declare.
	(cpp_input_conversion_is_trivial): Declare.
	(cpp_check_utf8_bom): Declare.

gcc/testsuite/ChangeLog:

	PR other/93067
	* gcc.dg/diagnostic-input-charset-1.c: New test.
	* gcc.dg/diagnostic-input-utf8-bom.c: New test.
2021-08-25 11:15:28 -04:00
Ankur Saini
43a5d46fea analyzer: Impose recursion limit on indirect calls.
2021-08-25  Ankur Saini  <arsenic@sourceware.org>

gcc/analyzer/ChangeLog:
	PR analyzer/101980
	* engine.cc (exploded_graph::maybe_create_dynamic_call): Don't create
	calls if max recursion limit is reached.
2021-08-25 19:00:36 +05:30
Richard Biener
29c77454e5 tree-optimization/102046 - fix SLP build from scalars with patterns
When we swap operands for SLP builds we lose track where exactly
pattern defs are - but we fail to update the any_pattern member
of the operands info.  Do so conservatively.

2021-08-25  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/102046
	* tree-vect-slp.c (vect_build_slp_tree_2): Conservatively
	update ->any_pattern when swapping operands.

	* gcc.dg/vect/pr102046.c: New testcase.
2021-08-25 11:32:05 +02:00
Hongyu Wang
87afc7b81c i386: Optimize lea with zero-extend. [PR 101716]
For ASHIFT + ZERO_EXTEND pattern, combine pass failed to
match it to lea since it will generate non-canonical
zero-extend. Adjust predicate and cost_model to allow combine
for lea.

gcc/ChangeLog:

	PR target/101716
	* config/i386/i386.c (ix86_live_on_entry): Adjust comment.
	(ix86_decompose_address): Remove retval check for ASHIFT,
	allow non-canonical zero extend if AND mask covers ASHIFT
	count.
	(ix86_legitimate_address_p): Adjust condition for decompose.
	(ix86_rtx_costs): Adjust cost for lea with non-canonical
	zero-extend.

	Co-Authored by: Uros Bizjak <ubizjak@gmail.com>

gcc/testsuite/ChangeLog:

	PR target/101716
	* gcc.target/i386/pr101716.c: New test.
2021-08-25 17:03:46 +08:00
Jiufu Guo
3673dcf6d6 Analyze niter for until-wrap condition [PR101145]
For code like:
unsigned foo(unsigned val, unsigned start)
{
  unsigned cnt = 0;
  for (unsigned i = start; i > val; ++i)
    cnt++;
  return cnt;
}

The number of iterations should be about UINT_MAX - start.

There is function adjust_cond_for_loop_until_wrap which
handles similar work for const bases.
Like adjust_cond_for_loop_until_wrap, this patch enhance
function number_of_iterations_cond/number_of_iterations_lt
to analyze number of iterations for this kind of loop.

gcc/ChangeLog:

2021-08-25  Jiufu Guo  <guojiufu@linux.ibm.com>

	PR tree-optimization/101145
	* tree-ssa-loop-niter.c (number_of_iterations_until_wrap):
	New function.
	(number_of_iterations_lt): Invoke above function.
	(adjust_cond_for_loop_until_wrap):
	Merge to number_of_iterations_until_wrap.
	(number_of_iterations_cond): Update invokes for
	adjust_cond_for_loop_until_wrap and number_of_iterations_lt.

gcc/testsuite/ChangeLog:

2021-08-25  Jiufu Guo  <guojiufu@linux.ibm.com>

	PR tree-optimization/101145
	* gcc.dg/vect/pr101145.c: New test.
	* gcc.dg/vect/pr101145.inc: New test.
	* gcc.dg/vect/pr101145_1.c: New test.
	* gcc.dg/vect/pr101145_2.c: New test.
	* gcc.dg/vect/pr101145_3.c: New test.
	* gcc.dg/vect/pr101145inf.c: New test.
	* gcc.dg/vect/pr101145inf.inc: New test.
	* gcc.dg/vect/pr101145inf_1.c: New test.
2021-08-25 16:38:12 +08:00
konglin1
db3d4129b6 i386: Fix _mm512_fpclass_ps_mask in O0 [PR 101471]
gcc/ChangeLog:

	PR target/101471
	* config/i386/avx512dqintrin.h (_mm512_fpclass_ps_mask): Fix
	macro define in O0.
	(_mm512_mask_fpclass_ps_mask): Ditto.

gcc/testsuite/ChangeLog:

	PR target/101471
	* gcc.target/i386/avx512f-pr101471.c: New test.
2021-08-25 14:35:34 +08:00
Kewen Lin
a20be0cdc0 rs6000: Add vec_unpacku_{hi,lo}_v4si
The existing vec_unpacku_{hi,lo} supports emulated unsigned
unpacking for short and char but misses the support for int.
This patch adds the support of vec_unpacku_{hi,lo}_v4si.

Meanwhile, the current implementation uses vector permutation
way, which requires one extra customized constant vector as
the permutation control vector.  It's better to use vector
merge high/low with zero constant vector, to save the space
in constant area as well as the cost to initialize pcv in
prologue.  This patch updates it with vector merging and
simplify it with iterators.

gcc/ChangeLog:

	* config/rs6000/altivec.md (vec_unpacku_hi_v16qi): Remove.
	(vec_unpacku_hi_v8hi): Likewise.
	(vec_unpacku_lo_v16qi): Likewise.
	(vec_unpacku_lo_v8hi): Likewise.
	(vec_unpacku_hi_<VP_small_lc>): New define_expand.
	(vec_unpacku_lo_<VP_small_lc>): Likewise.

gcc/testsuite/ChangeLog:

	* gcc.target/powerpc/unpack-vectorize-1.c: New test.
	* gcc.target/powerpc/unpack-vectorize-1.h: New test.
	* gcc.target/powerpc/unpack-vectorize-2.c: New test.
	* gcc.target/powerpc/unpack-vectorize-2.h: New test.
	* gcc.target/powerpc/unpack-vectorize-3.c: New test.
	* gcc.target/powerpc/unpack-vectorize-3.h: New test.
	* gcc.target/powerpc/unpack-vectorize-run-1.c: New test.
	* gcc.target/powerpc/unpack-vectorize-run-2.c: New test.
	* gcc.target/powerpc/unpack-vectorize-run-3.c: New test.
	* gcc.target/powerpc/unpack-vectorize.h: New test.
2021-08-24 21:58:14 -05:00
liuhongt
4f5391dde1 Adjust testcases to avoid new failures brought by r12-3108 when compiled w -march=cascadelake.
gcc/testsuite/ChangeLog:

	PR target/101989
	* gcc.target/i386/avx2-shiftqihi-constant-1.c: Add -mno-avx512f.
	* gcc.target/i386/sse2-shiftqihi-constant-1.c: Add -mno-avx
2021-08-25 09:57:04 +08:00
GCC Administrator
05ace2946b Daily bump. 2021-08-25 00:16:57 +00:00
David Edelsohn
9cf3f026e2 aix: SYSTEM_IMPLICIT_EXTERN_C
AIX 7.3 system headers are C++ safe and GCC no longer needs to define
SYSTEM_IMPLICIT_EXTERN_C for AIX 7.3.  This patch moves the definition
from aix.h to the individual OS-level configuration files and does not
define the macro for AIX 7.3.

The patch also corrects the definition of TARGET_AIX_VERSION to 73.

gcc/ChangeLog:
	* config/rs6000/aix.h (SYSTEM_IMPLICIT_EXTERN_C): Delete.
	* config/rs6000/aix71.h (SYSTEM_IMPLICIT_EXTERN_C): Define.
	* config/rs6000/aix72.h (SYSTEM_IMPLICIT_EXTERN_C): Define.
	* config/rs6000/aix73.h (TARGET_AIX_VERSION): Increase to 73.
2021-08-24 18:33:21 -04:00
Roger Sayle
81e1894456 [Committed] PR middle-end/102031: Fix typo/mistake in simplify_truncation patch.
My apologies again.  My patch to simplify truncations of SUBREGs in
simplify-rtx.c contained an error where I'd accidentally compared
against a mode instead of the precision of that mode.  Grr!  It even
survived regression testing on two platforms.  Fixed below, and
committed as obvious, after a full "make bootstrap" and "make -k check"
on x86_64-pc-linux-gnu with no new regressions.

2021-08-24  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
	PR middle-end/102031
	* simplify-rtx.c (simplify_truncation): When comparing precisions
	use "subreg_prec" variable, not "subreg_mode".
2021-08-24 22:07:41 +01:00
Harald Anlauf
f95946afd1 Fortran: fix pointless warning for static variables
gcc/fortran/ChangeLog:

	PR fortran/98411
	* trans-decl.c (gfc_finish_var_decl): Adjust check to handle
	implicit SAVE as well as variables in the main program.  Improve
	warning message text.

gcc/testsuite/ChangeLog:

	PR fortran/98411
	* gfortran.dg/pr98411.f90: Adjust testcase options to restrict to
	F2008, and verify case of implicit SAVE.
2021-08-24 21:07:50 +02:00
Bill Schmidt
50cb8300d3 rs6000: Add Power10 builtins
2021-07-28  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-builtin-new.def: Add power10 and power10-64
	stanzas.
2021-08-24 13:46:07 -05:00
Bill Schmidt
19b7bf620c rs6000: Add more type nodes to support builtin processing
2021-08-24  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-call.c (rs6000_init_builtins): Initialize
	various pointer type nodes.
	* config/rs6000/rs6000.h (rs6000_builtin_type_index): Add enum
	values for various pointer types.
	(ptr_V16QI_type_node): New macro.
	(ptr_V1TI_type_node): New macro.
	(ptr_V2DI_type_node): New macro.
	(ptr_V2DF_type_node): New macro.
	(ptr_V4SI_type_node): New macro.
	(ptr_V4SF_type_node): New macro.
	(ptr_V8HI_type_node): New macro.
	(ptr_unsigned_V16QI_type_node): New macro.
	(ptr_unsigned_V1TI_type_node): New macro.
	(ptr_unsigned_V8HI_type_node): New macro.
	(ptr_unsigned_V4SI_type_node): New macro.
	(ptr_unsigned_V2DI_type_node): New macro.
	(ptr_bool_V16QI_type_node): New macro.
	(ptr_bool_V8HI_type_node): New macro.
	(ptr_bool_V4SI_type_node): New macro.
	(ptr_bool_V2DI_type_node): New macro.
	(ptr_bool_V1TI_type_node): New macro.
	(ptr_pixel_type_node): New macro.
	(ptr_intQI_type_node): New macro.
	(ptr_uintQI_type_node): New macro.
	(ptr_intHI_type_node): New macro.
	(ptr_uintHI_type_node): New macro.
	(ptr_intSI_type_node): New macro.
	(ptr_uintSI_type_node): New macro.
	(ptr_intDI_type_node): New macro.
	(ptr_uintDI_type_node): New macro.
	(ptr_intTI_type_node): New macro.
	(ptr_uintTI_type_node): New macro.
	(ptr_long_integer_type_node): New macro.
	(ptr_long_unsigned_type_node): New macro.
	(ptr_float_type_node): New macro.
	(ptr_double_type_node): New macro.
	(ptr_long_double_type_node): New macro.
	(ptr_dfloat64_type_node): New macro.
	(ptr_dfloat128_type_node): New macro.
	(ptr_ieee128_type_node): New macro.
	(ptr_ibm128_type_node): New macro.
	(ptr_vector_pair_type_node): New macro.
	(ptr_vector_quad_type_node): New macro.
	(ptr_long_long_integer_type_node): New macro.
	(ptr_long_long_unsigned_type_node): New macro.
2021-08-24 13:46:05 -05:00
Bill Schmidt
2ed356a4c9 rs6000: Add Power9 builtins
2021-08-24  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-builtin-new.def: Add power9-vector, power9,
	and power9-64 stanzas.
2021-08-24 13:46:02 -05:00
Roger Sayle
3c496e92d7 nvptx: Add a __PTX_SM__ predefined macro based on target ISA.
This patch adds a __PTX_SM__ predefined macro to the nvptx backend that
allows code to check the compute model being targeted by the compiler.
This is equivalent to the __CUDA_ARCH__ macro defined by CUDA's nvcc
compiler, but to avoid causing problems for source code that checks
for that compiler, this macro uses GCC's nomenclature; it's easy
enough for users to "#define __CUDA_ARCH__ __PTX_SM__".

What might have been a four line patch is actually a little more
complicated, as this patch takes the opportunity to upgrade the
nvptx backend to use the now preferred nvptx-c.c idiom.

2021-08-24  Roger Sayle  <roger@nextmovesoftware.com>
	    Tom de Vries  <tdevries@suse.de>

gcc/ChangeLog
	* config.gcc (nvptx-*-*): Define {c,c++}_target_objs.
	* config/nvptx/nvptx-protos.h (nvptx_cpu_cpp_builtins): Prototype.
	* config/nvptx/nvptx.h (TARGET_CPU_CPP_BUILTINS): Implement with
	a call to the new nvptx_cpu_cpp_builtins function in nvptx-c.c.
	* config/nvptx/t-nvptx (nvptx-c.o): New rule.
	* config/nvptx/nvptx-c.c: New source file.
	(nvptx_cpu_cpp_builtins): Move implementation here.
2021-08-24 18:02:18 +01:00
Martin Sebor
820f0940d7 Reset PHI base0 flag if it's clear in any argument [PR101977, ...]
Resolves:
PR middle-end/101600 - Spurious -Warray-bounds downcasting a polymorphic pointer
PR middle-end/101977 - bogus -Warray-bounds on a negative index into a parameter in conditional with null

gcc/ChangeLog:

	PR middle-end/101600
	PR middle-end/101977
	* gimple-ssa-warn-access.cc (maybe_warn_for_bound): Tighten up
	the phrasing of a warning.
	(check_access): Use the remaining size after subtracting any offset
	rather than the whole object size.
	* pointer-query.cc (access_ref::get_ref): Clear BASE0 flag if it's
	clear for any nonnull PHI argument.
	(compute_objsize): Clear argument.

gcc/testsuite/ChangeLog:

	PR middle-end/101600
	PR middle-end/101977
	* g++.dg/pr100574.C: Prune out valid warning.
	* gcc.dg/pr20126.c: Same.
	* gcc.dg/Wstringop-overread.c: Adjust text of expected warnings.
	Add new instances.
	* gcc.dg/warn-strnlen-no-nul.c: Same.
	* g++.dg/warn/Warray-bounds-26.C: New test.
	* gcc.dg/Warray-bounds-88.c: New test.
2021-08-24 10:49:11 -06:00
Jonathan Wakely
6d692ef43b libstdc++: Update C++20 status table for layout-compatibility traits
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* doc/xml/manual/status_cxx2020.xml: Update table.
	* doc/html/manual/status.html: Regenerate.
2021-08-24 16:15:48 +01:00
Jonathan Wakely
037ef219b2 libstdc++: Add std::is_layout_compatible trait for C++20
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/std/type_traits (is_layout_compatible): Define.
	(is_corresponding_member): Define.
	* include/std/version (__cpp_lib_is_layout_compatible): Define.
	* testsuite/20_util/is_layout_compatible/is_corresponding_member.cc:
	New test.
	* testsuite/20_util/is_layout_compatible/value.cc: New test.
	* testsuite/20_util/is_layout_compatible/version.cc: New test.
	* testsuite/20_util/is_pointer_interconvertible/with_class.cc:
	New test.
	* testsuite/23_containers/span/layout_compat.cc: Do not use real
	std::is_layout_compatible trait if available.
2021-08-24 16:12:44 +01:00
Bill Schmidt
8ce18a29ef rs6000: Add power8-vector builtins
2021-04-01  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-builtin-new.def: Add power8-vector stanza.
2021-08-24 09:14:44 -05:00
Bill Schmidt
fce8a52d0a rs6000: Add power7 and power7-64 builtins
2021-04-02  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-builtin-new.def: Add power7 and power7-64
	stanzas.
2021-08-24 09:14:34 -05:00