Commit Graph

190600 Commits

Author SHA1 Message Date
Jakub Jelinek
a5b4ebc217 libstdc++: Poor man's case insensitive comparisons in time_get [PR71557]
This patch uses the same not completely correct case insensitive comparisons
as used elsewhere in the same header.  Proper comparisons that would handle
even multi-byte characters would be harder, but I don't see them implemented
in __ctype's methods.

2021-12-15  Jakub Jelinek  <jakub@redhat.com>

	PR libstdc++/71557
	* include/bits/locale_facets_nonio.tcc (_M_extract_via_format):
	Compare characters other than format specifiers and whitespace
	case insensitively.
	(_M_extract_name): Compare characters case insensitively.
	* testsuite/22_locale/time_get/get/char/71557.cc: New test.
	* testsuite/22_locale/time_get/get/wchar_t/71557.cc: New test.
2021-12-15 10:25:53 +01:00
Haochen Jiang
8f9fea41a7 Add combine splitter to transform vashr/vlshr/vashl_optab to ashr/lshr/ashl_optab for const vector duplicate operand.
gcc/ChangeLog:

	PR target/101796
	* config/i386/predicates.md (const_vector_operand):
	Add new predicate.
	* config/i386/sse.md(<insn><mode>3<mask_name>):
	Add new define_split below.

gcc/testsuite/ChangeLog:

	PR target/101796
	* gcc.target/i386/pr101796-1.c: New test.
2021-12-15 16:26:14 +08:00
Michael Meissner
575ad7700f Generate XXSPLTIDP for scalars on power10.
This patch implements XXSPLTIDP support for SF, and DF scalar constants.
The previous patch added support for vector constants.  This patch adds
the support for SFmode and DFmode scalar constants.

I added 2 new tests to test loading up SF and DF scalar constants.

2021-12-15  Michael Meissner  <meissner@the-meissners.org>

gcc/

	* config/rs6000/rs6000.md (UNSPEC_XXSPLTIDP_CONST): New unspec.
	(UNSPEC_XXSPLTIW_CONST): New unspec.
	(movsf_hardfloat): Add support for generating XXSPLTIDP.
	(mov<mode>_hardfloat32): Likewise.
	(mov<mode>_hardfloat64): Likewise.
	(xxspltidp_<mode>_internal): New insns.
	(xxspltiw_<mode>_internal): New insns.
	(splitters for SF/DFmode): Add new splitters for XXSPLTIDP.

gcc/testsuite/

	* gcc.target/powerpc/vec-splat-constant-df.c: New test.
	* gcc.target/powerpc/vec-splat-constant-sf.c: New test.
2021-12-15 02:30:20 -05:00
Michael Meissner
8d443ac032 Generate XXSPLTIDP for vectors on power10.
This patch implements XXSPLTIDP support for all vector constants.  The
XXSPLTIDP instruction is given a 32-bit immediate that is converted to a vector
of two DFmode constants.  The immediate is in SFmode format, so only constants
that fit as SFmode values can be loaded with XXSPLTIDP.

The constraint (eP) added in the previous patch for XXSPLTIW is also used
for XXSPLTIDP.

DImode scalar constants are not handled.  This is due to the majority of DImode
constants will be in the GPR registers.  With vector registers, you have the
problem that XXSPLTIDP splats the double word into both elements of the
vector.  However, if TImode is loaded with an integer constant, it wants a full
128-bit constant.

SFmode and DFmode scalar constants are not handled in this patch.  The
support for for those constants will be in the next patch.

I have added a temporary switch (-msplat-float-constant) to control whether or
not the XXSPLTIDP instruction is generated.

I added 2 new tests to test loading up V2DI and V2DF vector constants.

2021-12-14  Michael Meissner  <meissner@the-meissners.org>

gcc/

	* config/rs6000/predicates.md (easy_fp_constant): Add support for
	generating XXSPLTIDP.
	(vsx_prefixed_constant): Likewise.
	(easy_vector_constant): Likewise.
	* config/rs6000/rs6000-protos.h (constant_generates_xxspltidp):
	New declaration.
	* config/rs6000/rs6000.c (output_vec_const_move): Add support for
	generating XXSPLTIDP.
	(prefixed_xxsplti_p): Likewise.
	(constant_generates_xxspltidp): New function.
	* config/rs6000/rs6000.opt (-msplat-float-constant): New debug option.

gcc/testsuite/

	* gcc.target/powerpc/pr86731-fwrapv-longlong.c: Update insn
	regex for power10.
	* gcc.target/powerpc/vec-splat-constant-v2df.c: New test.
	* gcc.target/powerpc/vec-splat-constant-v2di.c: New test.
2021-12-15 02:02:24 -05:00
Michael Meissner
d730aa8a9f Generate XXSPLTIW on power10.
This patch adds support to automatically generate the ISA 3.1 XXSPLTIW
instruction for V8HImode, V4SImode, and V4SFmode vectors.  It does this by
adding support for vector constants that can be used, and adding a
VEC_DUPLICATE pattern to generate the actual XXSPLTIW instruction.

Add the eP constraint to recognize constants that can be loaded into
vector registers with a single prefixed instruction such as xxspltiw and
xxspltidp.

I added 4 new tests to test loading up V16QI, V8HI, V4SI, and V4SF vector
constants.

2021-12-14  Michael Meissner  <meissner@linux.ibm.com>

gcc/

	* config/rs6000/constraints.md (eP): Update comment.
	* config/rs6000/predicates.md (easy_fp_constant): Add support for
	generating XXSPLTIW.
	(vsx_prefixed_constant): New predicate.
	(easy_vector_constant): Add support for
	generating XXSPLTIW.
	* config/rs6000/rs6000-protos.h (prefixed_xxsplti_p): New
	declaration.
	(constant_generates_xxspltiw): Likewise.
	* config/rs6000/rs6000.c (xxspltib_constant_p): Generate XXSPLTIW
	if possible instead of XXSPLTIB and sign extending the constant.
	(output_vec_const_move): Add support for XXSPLTIW.
	(prefixed_xxsplti_p): New function.
	(constant_generates_xxspltiw): New function.
	* config/rs6000/rs6000.md (prefixed attribute): Add support to
	mark XXSPLTI* instructions as being prefixed.
	* config/rs6000/rs6000.opt (-msplat-word-constant): New debug
	switch.
	* config/rs6000/vsx.md (vsx_mov<mode>_64bit): Add support for
	generating XXSPLTIW or XXSPLTIDP.
	(vsx_mov<mode>_32bit): Likewise.
	* doc/md.texi (PowerPC and IBM RS6000 constraints): Document the
	eP constraint.

gcc/testsuite/

	* gcc.target/powerpc/vec-splat-constant-v16qi.c: New test.
	* gcc.target/powerpc/vec-splat-constant-v4sf.c: New test.
	* gcc.target/powerpc/vec-splat-constant-v4si.c: New test.
	* gcc.target/powerpc/vec-splat-constant-v8hi.c: New test.
	* gcc.target/powerpc/vec-splati-runnable.c: Update insn count.
2021-12-15 01:37:08 -05:00
Michael Meissner
8ccd8b12de Add LXVKQ support.
This patch adds support to generate the LXVKQ instruction to load specific
IEEE-128 floating point constants.

Compared to the last time I submitted this patch, I modified it so that it
uses the bit pattern of the vector to see if it can generate the LXVKQ
instruction.  This means on a little endian Power<xxx> system, the
following code will generate a LXVKQ 34,16 instruction:

    vector long long foo (void)
    {
      return (vector long long) { 0x0000000000000000, 0x8000000000000000 };
    }

because that vector pattern is the same bit pattern as -0.0F128.

2021-12-14  Michael Meissner  <meissner@the-meissners.org>

gcc/

	* config/rs6000/constraints.md (eQ): New constraint.
	* config/rs6000/predicates.md (easy_fp_constant): Add support for
	generating the LXVKQ instruction.
	(easy_vector_constant_ieee128): New predicate.
	(easy_vector_constant): Add support for generating the LXVKQ
	instruction.
	* config/rs6000/rs6000-protos.h (constant_generates_lxvkq): New
	declaration.
	* config/rs6000/rs6000.c (output_vec_const_move): Add support for
	generating LXVKQ.
	(constant_generates_lxvkq): New function.
	* config/rs6000/rs6000.opt (-mieee128-constant): New debug
	option.
	* config/rs6000/vsx.md (vsx_mov<mode>_64bit): Add support for
	generating LXVKQ.
	(vsx_mov<mode>_32bit): Likewise.
	* doc/md.texi (PowerPC and IBM RS6000 constraints): Document the
	eQ constraint.

gcc/testsuite/

	* gcc.target/powerpc/float128-constant.c: New test.
2021-12-15 00:57:44 -05:00
Michael Meissner
c6756b3bc1 Add new constant data structure.
This patch provides the data structure and function to convert a
CONST_INT, CONST_DOUBLE, CONST_VECTOR, or VEC_DUPLICATE of a constant) to
an array of bytes, half-words, words, and  double words that can be loaded
into a 128-bit vector register.

The next patches will use this data structure to generate code that
generates load of the vector/floating point registers using the XXSPLTIDP,
XXSPLTIW, and LXVKQ instructions that were added in power10.

2021-12-15  Michael Meissner  <meissner@the-meissners.org>

gcc/

	* config/rs6000/rs6000-protos.h (VECTOR_128BIT_BITS): New macro.
	(VECTOR_128BIT_BYTES): Likewise.
	(VECTOR_128BIT_HALF_WORDS): Likewise.
	(VECTOR_128BIT_WORDS): Likewise.
	(VECTOR_128BIT_DOUBLE_WORDS): Likewise.
	(vec_const_128bit_type): New structure type.
	(vec_const_128bit_to_bytes): New declaration.
	* config/rs6000/rs6000.c (constant_int_to_128bit_vector): New
	helper function.
	(constant_fp_to_128bit_vector): New helper function.
	(vec_const_128bit_to_bytes): New function.
2021-12-15 00:56:25 -05:00
Alexandre Oliva
71cc9b8c39 [PR100518] store by mult pieces: keep addr in Pmode
The conversion of a MEM address to ptr_mode in
try_store_by_multiple_pieces was misguided: copy_addr_to_reg expects
Pmode for addresses.


for  gcc/ChangeLog

	PR target/100518
	* builtins.c (try_store_by_multiple_pieces): Drop address
	conversion to ptr_mode.

for  gcc/testsuite/ChangeLog

	PR target/100518
	* gcc.target/aarch64/pr100518.c: New.
2021-12-15 02:22:34 -03:00
Alexandre Oliva
c95a9f1ee7 [PR100843] store by mult pieces: punt on max_len < min_len
The testcase confuses the code that detects min and max len for the
memset, so max_len ends up less than min_len.  That shouldn't be
possible, but the testcase requires us to handle this case.

The store-by-mult-pieces algorithm actually relies on min and max
lengths, so if we find them to be inconsistent, the best we can do is
punting.


for  gcc/ChangeLog

	PR middle-end/100843
	* builtins.c (try_store_by_multiple_pieces): Fail if min_len
	is greater than max_len.

for  gcc/testsuite/ChangeLog

	PR middle-end/100843
	* gcc.dg/pr100843.c: New.
2021-12-15 02:22:33 -03:00
GCC Administrator
9c6586bc20 Daily bump. 2021-12-15 00:16:28 +00:00
liuhongt
a2a0c91b47 Fix ICE. [PR103682]
Check is_gimple_assign before gimple_assign_rhs_code.

gcc/ChangeLog:

	PR target/103682
	* tree-ssa-ccp.c (optimize_atomic_bit_test_and): Check
	is_gimple_assign before gimple_assign_rhs_code.

gcc/testsuite/ChangeLog:

	* gcc.c-torture/compile/pr103682.c: New test.
2021-12-15 07:40:03 +08:00
Jonathan Wakely
9a4b4514bd libstdc++: Support old and new T_FMT for en_HK locale [PR103687]
This checks whether the locale data for en_HK includes %p and adjusts
the string being tested accordingly. To account for Jakub's fix to make
%I parse "12" as 0 instead of 12, we need to change the expected value
for the case where the locale format doesn't include %p. Also change the
time from 12:00:00 to 12:02:01 so we can tell if the minutes and seconds
get mixed up.

libstdc++-v3/ChangeLog:

	PR libstdc++/103687
	* testsuite/22_locale/time_get/get_date/wchar_t/4.cc: Restore
	original locale before returning.
	* testsuite/22_locale/time_get/get_time/char/2.cc: Check for %p
	in locale's T_FMT and adjust accordingly.
	* testsuite/22_locale/time_get/get_time/wchar_t/2.cc: Likewise.
2021-12-14 23:37:14 +00:00
Sören Tempel
85a438fc78 [PATCH] stddef.h: add support for musl typedef macro guards
The stddef.h header checks/sets various hardcoded toolchain/os specific
macro guards to prevent redefining types such as ptrdiff_t, wchar_t, or
size_t. However, without this patch, the file does not check/set the
typedef macro guards for musl libc. This causes types such as size_t to
be defined twice for files which include both musl's stdlib.h as well as
GCC's ginclude/stddef.h. This is, for example, the case for
libgo/sysinfo.c. If libgo/sysinfo.c has multiple typedefs for size_t
this confuses -fdump-go-spec and causes size_t not to be included in the
generated type definitions thereby causing a gcc-go compilation failure
on Alpine Linux Edge (which uses musl libc) with the following error:

	sysinfo.go:7765:13: error: use of undefined type '_size_t'
	 7765 | type Size_t _size_t
	      |             ^
	libcall_posix.go:49:35: error: non-integer len argument in make
	   49 |                 b := make([]byte, len)
	      |

This commit fixes this issue by ensuring that ptrdiff_t, wchar_t, and size_t
are only defined once in the pre-processed libgo/sysinfo.c file by enhancing
gcc/ginclude/stddef.h with musl-specific typedef macro guards.

gcc/ChangeLog:

	* ginclude/stddef.h (__DEFINED_ptrdiff_t): Add support for musl
	libc typedef macro guard.
	(__DEFINED_size_t): Ditto.
	(__DEFINED_wchar_t): Ditto.
2021-12-14 18:08:50 -05:00
JoJo R
a888259a71 regrename: Skip renaming if instruction is noop move.
gcc/
	* regrename.c (find_rename_reg): Return satisfied regno
	if instruction is noop move.
2021-12-14 16:55:57 -05:00
Jonathan Wakely
7ce3c230ed libstdc++: Fix handling of invalid ranges in std::regex [PR102447]
std::regex currently allows invalid bracket ranges such as [\w-a] which
are only allowed by ECMAScript when in web browser compatibility mode.
It should be an error, because the start of the range is a character
class, not a single character. The current implementation of
_Compiler::_M_expression_term does not provide a way to reject this,
because we only remember a previous character, not whether we just
processed a character class (or collating symbol etc.)

This patch replaces the pair<bool, CharT> used to emulate
optional<CharT> with a custom class closer to pair<tribool,CharT>. That
allows us to track three states, so that we can tell when we've just
seen a character class.

With this additional state the code in _M_expression_term for processing
the _S_token_bracket_dash can be improved to correctly reject the [\w-a]
case, without regressing for valid cases such as [\w-] and [----].

libstdc++-v3/ChangeLog:

	PR libstdc++/102447
	* include/bits/regex_compiler.h (_Compiler::_BracketState): New
	class.
	(_Compiler::_BrackeyMatcher): New alias template.
	(_Compiler::_M_expression_term): Change pair<bool, CharT>
	parameter to _BracketState. Process first character for
	ECMAScript syntax as well as POSIX.
	* include/bits/regex_compiler.tcc
	(_Compiler::_M_insert_bracket_matcher): Pass _BracketState.
	(_Compiler::_M_expression_term): Use _BracketState to store
	state between calls. Improve handling of dashes in ranges.
	* testsuite/28_regex/algorithms/regex_match/cstring_bracket_01.cc:
	Add more tests for ranges containing dashes. Check invalid
	ranges with character class at the beginning.
2021-12-14 21:45:46 +00:00
Jonathan Wakely
fda2872270 libstdc++: Simplify typedefs by using __UINTPTR_TYPE__
libstdc++-v3/ChangeLog:

	* include/ext/pointer.h (_Relative_pointer_impl::_UIntPtrType):
	Rename to uintptr_t and define as __UINTPTR_TYPE__.
2021-12-14 21:45:46 +00:00
Jonathan Wakely
63bb98e1c1 libstdc++: Simplify definition of std::regex_constants variables
This removes the __syntax_option and __match_flag enumeration types,
which are only used to define enumerators with successive values that
are then used to initialize the std::regex_constants global variables.

By defining enumerators in the syntax_option_type and match_flag_type
enumeration types with the correct values for the globals we get rid of
two useless enumeration types that just count from 0 to N, and we
improve the debugging experience. Because the enumeration types now have
enumerators defined, GDB will print values in terms of those enumerators
e.g.

$6 = (std::regex_constants::_S_ECMAScript | std::regex_constants::_S_multiline)

Previously this would have been shown as simply 0x810 because there were
no enumerators of that type.

This changes the type and value of enumerators such as _S_grep, but
users should never be referring to them directly anyway.

libstdc++-v3/ChangeLog:

	* include/bits/regex_constants.h (__syntax_option, __match_flag):
	Remove.
	(syntax_option_type, match_flag_type): Define enumerators.
	Use to initialize globals. Add constexpr to compound assignment
	operators.
	* include/bits/regex_error.h (error_type): Add comment.
	* testsuite/28_regex/constants/constexpr.cc: Remove comment.
	* testsuite/28_regex/constants/error_type.cc: Improve comment.
	* testsuite/28_regex/constants/match_flag_type.cc: Check bitmask
	requirements.
	* testsuite/28_regex/constants/syntax_option_type.cc: Likewise.
2021-12-14 21:45:45 +00:00
Bill Schmidt
926d64906a rs6000: Rename arrays to remove temporary _x suffix
While we had two sets of built-in infrastructure at once, I added _x as a
suffix to two arrays to disambiguate the old and new versions.  Time to fix
that also.

2021-12-06  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Rename
	rs6000_builtin_decls_x to rs6000_builtin_decls.
	(altivec_resolve_overloaded_builtin): Likewise.  Also rename
	rs6000_builtin_info_x to rs6000_builtin_info.
	* config/rs6000/rs6000-call.c (rs6000_invalid_builtin): Rename
	rs6000_builtin_info_x to rs6000_builtin_info.
	(rs6000_builtin_is_supported): Likewise.
	(rs6000_gimple_fold_mma_builtin): Likewise.  Also rename
	rs6000_builtin_decls_x to rs6000_builtin_decls.
	(rs6000_gimple_fold_builtin): Rename rs6000_builtin_info_x to
	rs6000_builtin_info.
	(cpu_expand_builtin): Likewise.
	(rs6000_expand_builtin): Likewise.
	(rs6000_init_builtins): Likewise.  Also rename rs6000_builtin_decls_x
	to rs6000_builtin_decls.
	(rs6000_builtin_decl): Rename rs6000_builtin_decls_x to
	rs6000_builtin_decls.
	* config/rs6000/rs6000-gen-builtins.c (write_decls): In generated code,
	rename rs6000_builtin_decls_x to rs6000_builtin_decls, and rename
	rs6000_builtin_info_x to rs6000_builtin_info.
	(write_bif_static_init): In generated code, rename
	rs6000_builtin_info_x to rs6000_builtin_info.
	(write_init_bif_table): In generated code, rename
	rs6000_builtin_decls_x to rs6000_builtin_decls, and rename
	rs6000_builtin_info_x to rs6000_builtin_info.
	(write_init_ovld_table): In generated code, rename
	rs6000_builtin_decls_x to rs6000_builtin_decls.
	(write_init_file): Likewise.
	* config/rs6000/rs6000.c (rs6000_builtin_vectorized_function):
	Likewise.
	(rs6000_builtin_md_vectorized_function): Likewise.
	(rs6000_builtin_reciprocal): Likewise.
	(add_condition_to_bb): Likewise.
	(rs6000_atomic_assign_expand_fenv): Likewise.
2021-12-14 15:42:00 -06:00
Bill Schmidt
d9421a8dca rs6000: Rename functions with "new" in their names
While we had two sets of built-in functionality at the same time, I put "new"
in the names of quite a few functions.  Time to undo that.

2021-12-02  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-c.c (altivec_resolve_new_overloaded_builtin):
	Remove forward declaration.
	(rs6000_new_builtin_type_compatible): Rename to
	rs6000_builtin_type_compatible.
	(rs6000_builtin_type_compatible): Remove.
	(altivec_resolve_overloaded_builtin): Remove.
	(altivec_build_new_resolved_builtin): Rename to
	altivec_build_resolved_builtin.
	(altivec_resolve_new_overloaded_builtin): Rename to
	altivec_resolve_overloaded_builtin.  Remove static keyword.  Adjust
	called function names.
	* config/rs6000/rs6000-call.c (rs6000_expand_new_builtin): Remove
	forward declaration.
	(rs6000_gimple_fold_new_builtin): Likewise.
	(rs6000_invalid_new_builtin): Rename to rs6000_invalid_builtin.
	(rs6000_gimple_fold_builtin): Remove.
	(rs6000_new_builtin_valid_without_lhs): Rename to
	rs6000_builtin_valid_without_lhs.
	(rs6000_new_builtin_is_supported): Rename to
	rs6000_builtin_is_supported.
	(rs6000_gimple_fold_new_mma_builtin): Rename to
	rs6000_gimple_fold_mma_builtin.
	(rs6000_gimple_fold_new_builtin): Rename to
	rs6000_gimple_fold_builtin.  Remove static keyword.  Adjust called
	function names.
	(rs6000_expand_builtin): Remove.
	(new_cpu_expand_builtin): Rename to cpu_expand_builtin.
	(new_mma_expand_builtin): Rename to mma_expand_builtin.
	(new_htm_spr_num): Rename to htm_spr_num.
	(new_htm_expand_builtin): Rename to htm_expand_builtin.  Change name
	of called function.
	(rs6000_expand_new_builtin): Rename to rs6000_expand_builtin.  Remove
	static keyword.  Adjust called function names.
	(rs6000_new_builtin_decl): Rename to rs6000_builtin_decl.  Remove
	static keyword.
	(rs6000_builtin_decl): Remove.
	* config/rs6000/rs6000-gen-builtins.c (write_decls): In gnerated code,
	rename rs6000_new_builtin_is_supported to rs6000_builtin_is_supported.
	* config/rs6000/rs6000-internal.h (rs6000_invalid_new_builtin): Rename
	to rs6000_invalid_builtin.
	* config/rs6000/rs6000.c (rs6000_new_builtin_vectorized_function):
	Rename to rs6000_builtin_vectorized_function.
	(rs6000_new_builtin_md_vectorized_function): Rename to
	rs6000_builtin_md_vectorized_function.
	(rs6000_builtin_vectorized_function): Remove.
	(rs6000_builtin_md_vectorized_function): Remove.
2021-12-14 15:41:58 -06:00
Bill Schmidt
9e855d235a rs6000: Remove rs6000-builtin.def and associated data and functions
2021-12-02  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-builtin.def: Delete.
	* config/rs6000/rs6000-call.c (builtin_compatibility): Delete.
	(builtin_description): Delete.
	(builtin_hash_struct): Delete.
	(builtin_hasher): Delete.
	(builtin_hash_table): Delete.
	(builtin_hasher::hash): Delete.
	(builtin_hasher::equal): Delete.
	(rs6000_builtin_info_type): Delete.
	(rs6000_builtin_info): Delete.
	(bdesc_compat): Delete.
	(bdesc_3arg): Delete.
	(bdesc_4arg): Delete.
	(bdesc_dst): Delete.
	(bdesc_2arg): Delete.
	(bdesc_altivec_preds): Delete.
	(bdesc_abs): Delete.
	(bdesc_1arg): Delete.
	(bdesc_0arg): Delete.
	(bdesc_htm): Delete.
	(bdesc_mma): Delete.
	(rs6000_overloaded_builtin_p): Delete.
	(rs6000_overloaded_builtin_name): Delete.
	(htm_spr_num): Delete.
	(rs6000_builtin_is_supported_p): Delete.
	(rs6000_gimple_fold_mma_builtin): Delete.
	(gt-rs6000-call.h): Remove include directive.
	* config/rs6000/rs6000-protos.h (rs6000_overloaded_builtin_p): Delete.
	(rs6000_builtin_is_supported_p): Delete.
	(rs6000_overloaded_builtin_name): Delete.
	* config/rs6000/rs6000.c (rs6000_builtin_decls): Delete.
	(rs6000_debug_reg_global): Remove reference to RS6000_BUILTIN_COUNT.
	* config/rs6000/rs6000.h (rs6000_builtins): Delete.
	(altivec_builtin_types): Delete.
	(rs6000_builtin_decls): Delete.
	* config/rs6000/t-rs6000 (TM_H): Don't add rs6000-builtin.def.
2021-12-14 15:41:57 -06:00
Bill Schmidt
9791218762 rs6000: Rename rs6000-builtin-new.def to rs6000-builtins.def
2021-12-02  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-builtin-new.def: Rename to...
	* config/rs6000/rs6000-builtins.def: ...this.
	* config/rs6000/rs6000-gen-builtins.c: Adjust header commentary.
	* config/rs6000/t-rs6000 (EXTRA_GTYPE_DEPS): Rename
	rs6000-builtin-new.def to rs6000-builtins.def.
	(rs6000-builtins.c): Likewise.
2021-12-14 15:41:55 -06:00
Bill Schmidt
84c5516e42 rs6000: Remove altivec_overloaded_builtins array and initialization
2021-12-06  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-call.c (altivec_overloaded_builtins): Remove.
	* config/rs6000/rs6000.h (altivec_overloaded_builtins): Remove.
2021-12-14 15:41:52 -06:00
Peter Bergner
15c02ab256 rs6000: Do not allow combining of multiple assemble quads [PR103548]
The compiler will gladly CSE the result of two __builtin_mma_build_acc
calls with the same four vector arguments, leading to illegal MMA
code being generated.  The fix here is to make the mma_assemble_acc
pattern use a unspec_volatile to stop the CSE from happening.

2021-12-14  Peter Bergner  <bergner@linux.ibm.com>

gcc/
	PR target/103548
	* config/rs6000/mma.md (UNSPEC_MMA_ASSEMBLE): Rename unspec from this...
	(UNSPEC_VSX_ASSEMBLE): ...to this.
	(UNSPECV_MMA_ASSEMBLE): New unspecv.
	(vsx_assemble_pair): Use UNSPEC_VSX_ASSEMBLE.
	(*vsx_assemble_pair): Likewise.
	(mma_assemble_acc): Use UNSPECV_MMA_ASSEMBLE.
	(*mma_assemble_acc): Likewise.
	* config/rs6000/rs6000.c (rs6000_split_multireg_move): Handle
	UNSPEC_VOLATILE.  Use UNSPEC_VSX_ASSEMBLE and UNSPECV_MMA_ASSEMBLE.

gcc/testsuite/
	PR target/103548
	* gcc.target/powerpc/mma-builtin-10-pair.c: New test.
	* gcc.target/powerpc/mma-builtin-10-quad.c: New test.
2021-12-14 15:00:00 -06:00
Harald Anlauf
ca39102e10 Fortran: prevent NULL pointer dereference in check of passed do-loop variable
gcc/fortran/ChangeLog:

	PR fortran/103717
	* frontend-passes.c (doloop_code): Prevent NULL pointer
	dereference when checking for passing a do-loop variable to a
	contained procedure with an interface mismatch.

gcc/testsuite/ChangeLog:

	PR fortran/103717
	* gfortran.dg/do_check_19.f90: New test.
2021-12-14 21:57:04 +01:00
Harald Anlauf
e866e1c92e Fortran: prevent NULL pointer dereferences checking do-loop contained stuff
gcc/fortran/ChangeLog:

	PR fortran/103718
	PR fortran/103719
	* frontend-passes.c (doloop_contained_procedure_code): Add several
	checks to prevent NULL pointer dereferences on valid and invalid
	code called within do-loops.

gcc/testsuite/ChangeLog:

	PR fortran/103718
	PR fortran/103719
	* gfortran.dg/do_check_18.f90: New test.
2021-12-14 21:14:08 +01:00
Uros Bizjak
7a54d3deec i386: Implement VxHF vector set/insert/extract with lower ABI levels
This is a preparation patch that moves VxHF vector set/insert/extract
expansions from AVX512FP16 ABI to lower ABIs.  There are no functional
changes for -mavx512fp16 and a follow-up patch is needed to actually
enable VxHF vector modes for lower ABIs.

2021-12-14  Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog:

	PR target/103571
	* config/i386/i386-expand.c (ix86_expand_vector_init_duplicate)
	<case E_V8HFmode>: Implement for TARGET_SSE2.
	<case E_V16HFmode>: Implement for TARGET_AVX.
	<case E_V32HFmode>: Implement for TARGET_AVX512F.
	(ix86_expand_vector_set_var): Handle V32HFmode
	without TARGET_AVX512BW.
	(ix86_expand_vector_extract)
	<case E_V8HFmode>: Implement for TARGET_SSE2.
	<case E_V16HFmode>: Implement for TARGET_AVX.
	<case E_V32HFmode>: Implement for TARGET_AVX512BW.
	(expand_vec_perm_broadcast_1) <case E_V8HFmode>: New.
	* config/i386/sse.md (VI12HF_AVX512VL): Remove
	TARGET_AVX512FP16 condition.
	(V): Ditto.
	(V_256_512): Ditto.
	(avx_vbroadcastf128_<mode>): Use V_256H mode iterator.
2021-12-14 18:28:21 +01:00
Bill Schmidt
2cf62ef5aa rs6000: Remove new_builtins_are_live and dead code it was guarding
To allow for a sane switch-over from the old built-in infrastructure to the
new, both sets of code have co-existed, with the enabled one under the control
of the boolean variable new_builtins_are_live.  As a first step in removing the
old code, remove this variable and the now-dead code it was guarding.

2021-12-06  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/darwin.h (SUBTARGET_INIT_BUILTINS): Remove
	test for new_builtins_are_live and simplify.
	* config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Remove
	dead function.
	(altivec_resolve_overloaded_builtin): Remove test for
	new_builtins_are_live and simplify.
	* config/rs6000/rs6000-call.c (altivec_init_builtins): Remove forward
	declaration.
	(builtin_function_type): Likewise.
	(rs6000_common_init_builtins): Likewise.
	(htm_init_builtins): Likewise.
	(mma_init_builtins): Likewise.
	(def_builtin): Remove dead function.
	(rs6000_expand_zeroop_builtin): Likewise.
	(rs6000_expand_mtfsf_builtin): Likewise.
	(rs6000_expand_mtfsb_builtin): Likewise.
	(rs6000_expand_set_fpscr_rn_builtin): Likewise.
	(rs6000_expand_set_fpscr_drn_builtin): Likewise.
	(rs6000_expand_unop_builtin): Likewise.
	(altivec_expand_abs_builtin): Likewise.
	(rs6000_expand_binop_builtin): Likewise.
	(altivec_expand_lxvr_builtin): Likewise.
	(altivec_expand_lv_builtin): Likewise.
	(altivec_expand_stxvl_builtin): Likewise.
	(altivec_expand_stv_builtin): Likewise.
	(mma_expand_builtin): Likewise.
	(htm_expand_builtin): Likewise.
	(cpu_expand_builtin): Likewise.
	(rs6000_expand_quaternop_builtin): Likewise.
	(rs6000_expand_ternop_builtin): Likewise.
	(altivec_expand_dst_builtin): Likewise.
	(altivec_expand_vec_sel_builtin): Likewise.
	(altivec_expand_builtin): Likewise.
	(rs6000_invalid_builtin): Likewise.
	(rs6000_builtin_valid_without_lhs): Likewise.
	(rs6000_gimple_fold_builtin): Remove test for new_builtins_are_live and
	simplify.
	(rs6000_expand_builtin): Likewise.
	(rs6000_init_builtins): Remove tests for new_builtins_are_live and
	simplify.
	(rs6000_builtin_decl): Likewise.
	(altivec_init_builtins): Remove dead function.
	(mma_init_builtins): Likewise.
	(htm_init_builtins): Likewise.
	(builtin_quaternary_function_type): Likewise.
	(builtin_function_type): Likewise.
	(rs6000_common_init_builtins): Likewise.
	* config/rs6000/rs6000-gen-builtins.c (write_header_file): Don't
	declare new_builtins_are_live.
	(write_init_bif_table): In generated code, remove test for
	new_builtins_are_live and simplify.
	(write_init_ovld_table): Likewise.
	(write_init_file): Don't initialize new_builtins_are_live.
	* config/rs6000/rs6000.c (rs6000_builtin_vectorized_function): Remove
	test for new_builtins_are_live and simplify.
	(rs6000_builtin_md_vectorized_function): Likewise.
	(rs6000_builtin_reciprocal): Likewise.
	(add_condition_to_bb): Likewise.
	(rs6000_atomic_assign_expand_fenv): Likewise.
2021-12-14 11:23:32 -06:00
Bill Schmidt
936051f924 rs6000: Builtins for doubleword compare should be in [power8-vector] (PR103625)
2021-12-13  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	PR target/103625
	* config/rs6000/rs6000-builtin-new.def (__builtin_altivec_vcmpequd):
	Move to power8-vector stanza.
	(__builtin_altivec_vcmpequd_p): Likewise.
	(__builtin_altivec_vcmpgtsd): Likewise.
	(__builtin_altivec_vcmpgtsd_p): Likewise.
	(__builtin_altivec_vcmpgtud): Likewise.
	(__builtin_altivec_vcmpgtud_p): Likewise.
2021-12-14 11:20:16 -06:00
Bill Schmidt
74aeb97267 rs6000: Some builtins require IBM-128 long double format (PR103623)
2021-12-14  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	PR target/103623
	* config/rs6000/rs6000-builtin-new.def (__builtin_pack_longdouble): Add
	ibmld attribute.
	(__builtin_unpack_longdouble): Likewise.
	* config/rs6000/rs6000-call.c (rs6000_expand_new_builtin): Add special
	handling for ibmld attribute.
	* config/rs6000/rs6000-gen-builtins.c (attrinfo): Add isibmld.
	(parse_bif_attrs): Handle ibmld.
	(write_decls): Likewise.
	(write_bif_static_init): Likewise.
2021-12-14 11:20:11 -06:00
Petter Tomner
3736837806 Add support for global rvalue initialization and constructors
This patch adds support for initialization of global variables
with rvalues and creating constructors for array, struct and
union types which can be used as rvalues.

Signed-off-by:
2021-12-14	Petter Tomner	<tomner@kth.se>

gcc/jit/
	* jit-common.h: New enum
	* jit-playback.c : Folding an setting intitial
	(global_new_decl) : Handle const global generation
	(new_global) : New flag
	(global_set_init_rvalue) : New
	(new_ctor) : New
	(new_global_initialized) : Flag
	(as_truth_value) : Fold
	(new_unary_op) : Fold
	(new_binary_op) : Fold
	(new_comparison) : Fold
	(new_array_access) : Fold
	(new_dereference) : Fold
	(get_address) : Fold
	* jit-playback.h :
	(global_set_init_rvalue) : New
	(new_ctor) : New
	* jit-recording.c :
	* jit-recording.h :
	(new_global_init_rvalue) : New
	(new_ctor) : New
	(ctor) : New, inherits rvalue
	(global_init_rvalue) : New, inherits memento
	(type::is_union) : New
	* libgccjit++.h : New entrypoints, see C-header
	* libgccjit.c : See .h
	* libgccjit.h : New entrypoints
	(gcc_jit_context_new_array_constructor) : New
	(gcc_jit_context_new_struct_constructor) : New
	(gcc_jit_context_new_union_constructor) : New
	(gcc_jit_global_set_initializer_rvalue) : New
	(LIBGCCJIT_HAVE_CTORS) : New feuture macro
	* libgccjit.map : New entrypoints added to ABI 19
	* docs/topics/expressions.rst : Updated docs

gcc/testsuite/
	* jit.dg/all-non-failing-tests.h: Added two tests
	* jit.dg/test-error-ctor-array-wrong-obj.c: New
	* jit.dg/test-error-ctor-struct-too-big.c: New
	* jit.dg/test-error-ctor-struct-wrong-field-obj.c: New
	* jit.dg/test-error-ctor-struct-wrong-type.c: New
	* jit.dg/test-error-ctor-struct-wrong-type2.c
	* jit.dg/test-error-ctor-union-wrong-field-name.c: New
	* jit.dg/test-error-global-already-init.c: New
	* jit.dg/test-error-global-common-section.c: New
	* jit.dg/test-error-global-init-too-small-array.c: New
	* jit.dg/test-error-global-lvalue-init.c: New
	* jit.dg/test-error-global-nonconst-init.c: New
	* jit.dg/test-global-init-rvalue.c: New
	* jit.dg/test-local-init-rvalue.c: New
2021-12-14 18:18:07 +01:00
Harald Anlauf
1c613165a5 Fortran: PACK intrinsic should not try to read from zero-sized array
libgfortran/ChangeLog:

	PR libfortran/103634
	* intrinsics/pack_generic.c (pack_internal): Handle case when the
	array argument of PACK has one or more extents of size zero to
	avoid invalid reads.

gcc/testsuite/ChangeLog:

	PR libfortran/103634
	* gfortran.dg/intrinsic_pack_6.f90: New test.
2021-12-14 16:56:50 +01:00
Jan Hubicka
3305135c29 Determine global memory accesses in ipa-modref
As discussed in PR103585, fatigue2 is now only benchmark from my usual testing
set (SPEC2k6, SPEC2k17, CPP benchmarks, polyhedron, Firefox, clang) which sees
important regression when inlining functions called once is limited.  This
prevents us from solving runtime issues in roms benchmarks and elsewhere.

The problem is that there is perdida function that takes many arguments and
some of them are array descriptors.  We constant propagate most of their fields
but still keep their initialization. Because perdida is quite fast, the call
overhead dominates, since we need over 100 memory stores consuing about 35%
of the overall benchmark runtime.

The memory stores would be eliminated if perdida did not call fortran I/O which
makes modref to thin that the array descriptors could be accessed. We are
quite close discovering that they can't becuase they are non-escaping from
function.  This patch makes modref to distingush between global memory access
(only things that escapes) and unkonwn accesss (that may access also
nonescaping things reaching the function).  This makes disambiguation for
functions containing error handling better.

Unfortunately the patch hits two semi-latent issues in Fortran frontned.
First is wrong code in gfortran.dg/unlimited_polymorphic_3.f03. This can be
turned into wrong code testcase on both mainline and gcc11 if the runtime
call is removed, so I filled PR 103662 for it. There is TBAA mismatch for
structure produced in FE.

Second is issue with GOMP where Fortran marks certain parameters as non-escaping
and then makes them escape via GOMP_parallel.  For this I disabled the use of
escape info in verify_arg which also disables the useful transform on perdida
but still does useful work for e.g. GCC error handling.  I will work on this
incrementally.

Bootstrapped/regtested x86_64-linux, lto-bootstrapped and also tested with
clang build.  I plan to commit this tomorrow if there are no complains
(the patch is not completely short but conceptualy simple and handles a lot
of common cases).

gcc/ChangeLog:

2021-12-12  Jan Hubicka  <hubicka@ucw.cz>

	PR ipa/103585
	* ipa-modref-tree.c (modref_access_node::range_info_useful_p): Handle
	MODREF_GLOBAL_MEMORY_PARM.
	(modref_access_node::dump): Likewise.
	(modref_access_node::get_call_arg): Likewise.
	* ipa-modref-tree.h (enum modref_special_parms): Add
	MODREF_GLOBAL_MEMORY_PARM.
	(modref_access_node::useful_for_kill): Handle
	MODREF_GLOBAL_MEMORY_PARM.
	(modref:tree::merge): Add promote_unknown_to_global.
	* ipa-modref.c (verify_arg):New function.
	(may_access_nonescaping_parm_p): New function.
	(modref_access_analysis::record_global_memory_load): New member
	function.
	(modref_access_analysis::record_global_memory_store): Likewise.
	(modref_access_analysis::process_fnspec): Distingush global and local
	memory.
	(modref_access_analysis::analyze_call): Likewise.
	* tree-ssa-alias.c (ref_may_access_global_memory_p): New function.
	(modref_may_conflict): Use it.

gcc/testsuite/ChangeLog:

2021-12-12  Jan Hubicka  <hubicka@ucw.cz>

	* gcc.dg/analyzer/data-model-1.c: Disable ipa-modref.
	* gcc.dg/uninit-38.c: Likewise.
	* gcc.dg/uninit-pr98578.c: Liewise.
2021-12-14 16:50:27 +01:00
Manfred Schwarb
44aa890d8f testsuite: Silence conversion warnings for MIN1 and MAX1
gcc/testsuite/ChangeLog:

	PR fortran/91497
	* gfortran.dg/pr91497.f90: Adjust test to use
	dg-require-effective-target directive.
	* gfortran.dg/pr91497_2.f90: New test to cover all targets.
	Cover MAX1 and MIN1 intrinsics.
2021-12-14 16:31:29 +01:00
Manfred Schwarb
f1215db081 fortran: Silence conversion warnings for MIN1 and MAX1
gcc/fortran/ChangeLog:

	PR fortran/91497
	* simplify.c (simplify_min_max): Disable conversion warnings for
	MIN1 and MAX1.
2021-12-14 16:30:07 +01:00
Vladimir N. Makarov
973f6aedeb [PR99531] Do not scan push insn for ia32 in the test
The patch prohibits scanning push insn for ia32 as push are expected not to be generated only for x86_64 Linux ABI.

gcc/testsuite/ChangeLog:

	PR target/99531
	* gcc.target/i386/pr99531.c: Do not scan for ia32.
2021-12-14 10:04:28 -05:00
Marc Poulhiès
81fdb5d4ad MAINTAINERS: Add myself to write after approval
Changelog:

	* MAINTAINERS: Add myself to write after approval.
2021-12-14 15:59:29 +01:00
Przemyslaw Wirkus
fdcddba8f2 aarch64: Add LS64 extension and intrinsics
This patch is adding support for LS64 (Armv8.7-A Load/Store 64 Byte extension)
which is part of Armv8.7-A architecture. Changes include missing plumbing for
TARGET_LS64, LS64 data structure and intrinsics defined in ACLE. Machine
description of intrinsics is using new V8DI mode added in a separate patch.
__ARM_FEATURE_LS64 is defined if the Armv8.7-A LS64 instructions for atomic
64-byte access to device memory are supported.

New compiler internal type is added wrapping ACLE struct data512_t:

typedef struct {
  uint64_t val[8];
} __arm_data512_t;

gcc/ChangeLog:

	* config/aarch64/aarch64-builtins.c (enum aarch64_builtins):
	Define AARCH64_LS64_BUILTIN_LD64B, AARCH64_LS64_BUILTIN_ST64B,
	AARCH64_LS64_BUILTIN_ST64BV, AARCH64_LS64_BUILTIN_ST64BV0.
	(aarch64_init_ls64_builtin_decl): Helper function.
	(aarch64_init_ls64_builtins): Helper function.
	(aarch64_init_ls64_builtins_types): Helper function.
	(aarch64_general_init_builtins): Init LS64 intrisics for
	TARGET_LS64.
	(aarch64_expand_builtin_ls64): LS64 intrinsics expander.
	(aarch64_general_expand_builtin): Handle aarch64_expand_builtin_ls64.
	(ls64_builtins_data): New helper struct.
	(v8di_UP): New define.
	* config/aarch64/aarch64-c.c (aarch64_update_cpp_builtins): Define
	__ARM_FEATURE_LS64.
	* config/aarch64/aarch64.c (aarch64_classify_address): Enforce the
	V8DI range (7-bit signed scaled) for both ends of the range.
	* config/aarch64/aarch64-simd.md (movv8di): New pattern.
	(aarch64_movv8di): New pattern.
	* config/aarch64/aarch64.h (AARCH64_ISA_LS64): New define.
	(TARGET_LS64): New define.
	* config/aarch64/aarch64.md: Add UNSPEC_LD64B, UNSPEC_ST64B,
	UNSPEC_ST64BV and UNSPEC_ST64BV0.
	(ld64b): New define_insn.
	(st64b): New define_insn.
	(st64bv): New define_insn.
	(st64bv0): New define_insn.
	* config/aarch64/arm_acle.h (data512_t): New type derived from
	__arm_data512_t.
	(__arm_data512_t): New internal type.
	(__arm_ld64b): New intrinsic.
	(__arm_st64b): New intrinsic.
	(__arm_st64bv): New intrinsic.
	(__arm_st64bv0): New intrinsic.
	* config/arm/types.md: Add new type ls64.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/acle/ls64_asm.c: New test.
	* gcc.target/aarch64/acle/ls64_ld64b.c: New test.
	* gcc.target/aarch64/acle/ls64_ld64b-2.c: New test.
	* gcc.target/aarch64/acle/ls64_ld64b-3.c: New test.
	* gcc.target/aarch64/acle/ls64_st64b.c: New test.
	* gcc.target/aarch64/acle/ls64_ld_st_o0.c: New test.
	* gcc.target/aarch64/acle/ls64_st64b-2.c: New test.
	* gcc.target/aarch64/acle/ls64_st64bv.c: New test.
	* gcc.target/aarch64/acle/ls64_st64bv-2.c: New test.
	* gcc.target/aarch64/acle/ls64_st64bv-3.c: New test.
	* gcc.target/aarch64/acle/ls64_st64bv0.c: New test.
	* gcc.target/aarch64/acle/ls64_st64bv0-2.c: New test.
	* gcc.target/aarch64/acle/ls64_st64bv0-3.c: New test.
	* gcc.target/aarch64/pragma_cpp_predefs_2.c: Add checks
	for __ARM_FEATURE_LS64.
2021-12-14 14:52:27 +00:00
Martin Liska
0dfb1bd944 testsuite: fix ASAN errors
The tests failed on my machine as they contain out-of-bounds
access.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/avx2-psraq-1.c: Use ARRAY_SIZE.
	* gcc.target/i386/m128-check.h: Move it to the top-level
	context.
	* gcc.target/i386/sse2-psraq-1.c: Use ARRAY_SIZE.
	* gcc.target/i386/sse4_2-check.h: Include the header with
	ARRAY_SIZE definition.
2021-12-14 15:49:30 +01:00
Jonathan Wakely
b0e6a257f1 libstdc++: Fix non-reserved name in <regex> header
libstdc++-v3/ChangeLog:

	* include/bits/regex_compiler.tcc (_Compiler::_M_match_token):
	Use reserved name for parameter.
	* testsuite/17_intro/names.cc: Check "token".
2021-12-14 14:23:55 +00:00
Patrick Palka
561414cdf8 c++: processing_template_decl vs template depth [PR103408]
We use processing_template_decl in two slightly different ways: as a
flag to signal that we're dealing with templated trees, and as a measure
of the current syntactic template nesting depth.  This overloaded
meaning of p_t_d is conceptually confusing and leads to bugs that we end
up working around in an ad-hoc fashion.

This patch replaces all uses of processing_template_decl that care about
its magnitude to instead look at the depth of current_template_parms
via a new macro current_template_depth.  This allows us to eliminate 3
workarounds in the concepts code: two about non-templated
requires-expressions (in constraint.cc) and one about lambdas inside
constraints (in cp_parser_requires_clause_expression etc).  This also
fixes the testcase in PR103408 about auto(x) used inside a non-templated
requires-expression.

The replacement was mostly mechanical, aside from two issues:

  * In synthesize_implicit_template_parm, when introducing a new template
    parameter list for an abbreviated function template, we need to add
    the new level of current_template_parms sooner, before calling
    process_template_parm, since this latter function now looks at
    current_template_depth to determine the level of the new parameter.

  * In instantiate_class_template_1 after substituting a template
    friend declaration, we currently increment processing_template_decl
    around the call to make_friend_class so that the friend_depth
    computation within this subroutine yields a nonzero value.  We could
    just replace this with an equivalent manipulation of
    current_template_depth, but this patch instead rewrites the
    friend_depth calculation within make_friend_class to not depend on
    p_t_d / c_t_d at all when called from instantiate_class_template_1.

	PR c++/103408

gcc/cp/ChangeLog:

	* constraint.cc (type_deducible_p): Remove workaround for
	non-templated requires-expressions.
	(normalize_placeholder_type_constraints): Likewise.
	* cp-tree.h (current_template_depth): Define.
	(PROCESSING_REAL_TEMPLATE_DECL): Inspect current_template_depth
	instead of the magnitude of processing_template_decl.
	* decl.c (start_decl): Likewise.
	(grokfndecl): Likewise.
	(grokvardecl): Likewise.
	(grokdeclarator): Likewise.
	* friend.c (make_friend_class): Likewise.  Calculate
	friend_depth differently when called at instantiation time
	instead of parse time.
	(do_friend): Likewise.
	* parser.c (cp_parser_requires_clause_expression): Remove
	workaround for lambdas inside constraints.
	(cp_parser_constraint_expression): Likewise.
	(cp_parser_requires_expression): Likewise.
	(synthesize_implicit_template_parm): Add to current_template_parms
	before calling process_template_parm.
	* pt.c (inline_needs_template_parms): Inspect
	current_template_depth instead of the magnitude of
	processing_template_decl.
	(push_inline_template_parms_recursive): Likewise.
	(maybe_begin_member_template_processing): Likewise.
	(begin_template_parm_list): Likewise.
	(process_template_parm): Likewise.
	(end_template_parm_list): Likewise.
	(push_template_decl): Likewise.
	(add_inherited_template_parms): Likewise.
	(instantiate_class_template_1): Don't adjust
	processing_template_decl around the call to make_friend_class.
	adjust_processing_template_decl to adjust_template_depth.  Set
	current_template_parms instead of processing_template_decl when
	adjust_template_depth.
	(make_auto_1): Inspect current_template_depth instead of the
	magnitude of processing_template_decl.
	(splice_late_return_type): Likewise.
	* semantics.c (fixup_template_type): Likewise.

gcc/testsuite/ChangeLog:

	* g++.dg/concepts/diagnostic18.C: Expect a "constraints on a
	non-templated function" error.
	* g++.dg/cpp23/auto-fncast11.C: New test.
2021-12-14 08:15:52 -05:00
Olivier Hainque
d8eae5abf3 Remove fpic multilib on x86_64-vxworks
The addition of fPIC for shared libraries is performed
independently from multilibs and fpic multilibs have
no other particular purpose for VxWorks at this stage.

They incur extra build time, complexify the install tree
and are a bit tricky because -fpic is not supported for kernel
mode.

2021-12-14  Olivier Hainque  <hainque@adacore.com>

gcc/
	* config/i386/t-vxworks: Drop the fPIC multilibs.
2021-12-14 12:56:56 +00:00
Patrick Palka
336dc544eb c++: don't leak 'arglist' in build_new_op
gcc/cp/ChangeLog:

	* call.c (build_new_op): Use releasing_vec for arglist.  Declare
	conv in the scope it's used.
2021-12-14 07:48:54 -05:00
Patrick Palka
c5ef950d0b c++: remove COMPOUND_EXPR_OVERLOADED flag
This flag is never set because non-dependent COMPOUND_EXPRs that resolve
to an overload are expressed as a CALL_EXPR at template definition time
(in build_x_compound_expr) ever since r6-5772.

gcc/cp/ChangeLog:

	* cp-tree.h (COMPOUND_EXPR_OVERLOADED): Remove.
	* pt.c (build_non_dependent_expr): Don't inspect the flag.
	* tree.c (build_min_non_dep): Don't set the flag.
2021-12-14 07:48:05 -05:00
Frederic Konrad
dff8ae8e83 Drop the fpic multilib for powerpc*-vxworks*
The addition of fPIC for shared libraries is performed
independently from multilibs and the fpic multilibs have
no other particular purpose. They incur extra build time,
complexify the install tree and are a bit tricky because
-fpic is not supported for kernel mode.

2020-11-06  Fred Konrad  <konrad@adacore.com>

gcc/
	* config/rs6000/t-vxworks: Drop the fPIC multilib.
2021-12-14 12:28:07 +00:00
Jakub Jelinek
e163dbbc44 c: Fix ICE on deferred pragma in unknown attribute arguments [PR103587]
We ICE on the following testcase, because c_parser_balanced_token_sequence
when encountering a deferred pragma will just use c_parser_consume_token
which the FE doesn't allow for CPP_PRAGMA tokens (and if that wasn't
the case, it could ICE on CPP_PRAGMA_EOL similarly).
We don't know in what exact context the pragma appears when we don't
know what those arguments semantically mean, so I think we should just
skip over them, like e.g. the C++ FE does.  And, I think (/[/{ vs. )/]/}
from outside of the pragma shouldn't be paired with those inside of
the pragma and it doesn't seem to be necessary to check that inside of
the pragma line itself all the paren kinds are balanced.

2021-12-14  Jakub Jelinek  <jakub@redhat.com>

	PR c/103587
	* c-parser.c (c_parser_balanced_token_sequence): For CPP_PRAGMA,
	consume the pragma and silently skip to the pragma eol.

	* gcc.dg/pr103587.c: New test.
2021-12-14 12:02:55 +01:00
Thomas Schwinge
228d64af4e Adjust 'gfortran.dg/goacc/privatization-1-*' [PR103576, PR103697]
... for the recent commit 494ebfa7c9
"Fortran: Handle compare in OpenMP atomic", which changes the GIMPLE IR
such that a temporary is no longer used; 'original' dump:

             x = *a;
    -        {
    -          integer(kind=4) D.4237;
    -
    -          D.4237 = *a;
               #pragma omp atomic relaxed
    -            &y = D.4237;
    -        }
    +          &y = *a;
           }

(I'm not familiar to comment whether that's correct; but it appears that the
difference again disappears in later compiler passes.)

These OpenACC test cases verify behavior re OpenACC privatization levels, and
have to be adjusted accordingly.

	gcc/testsuite/
	PR fortran/103576
	PR testsuite/103697
	* gfortran.dg/goacc/privatization-1-compute-loop.f90: Adjust.
	* gfortran.dg/goacc/privatization-1-compute.f90: Likewise.
	* gfortran.dg/goacc/privatization-1-routine_gang-loop.f90:
	Likewise.
	* gfortran.dg/goacc/privatization-1-routine_gang.f90: Likewise.
2021-12-14 07:17:18 +01:00
GCC Administrator
7f1239cb43 Daily bump. 2021-12-14 00:16:25 +00:00
Vladimir N. Makarov
a7acb6dca9 [PR99531] Modify pseudo class cost calculation when processing move involving the pseudo and a hard register
Pseudo class calculated on the 1st iteration should not have a
special treatment in cost calculation when processing move involving
the pseudo and a hard register.

gcc/ChangeLog:

	PR target/99531
	* ira-costs.c (record_operand_costs): Do not take pseudo class
	calculated on the 1st iteration into account when processing move
	involving the pseudo and a hard register.

gcc/testsuite/ChangeLog:

	PR target/99531
	* gcc.target/i386/pr99531.c: New test.
2021-12-13 14:10:03 -05:00
Roger Sayle
149739c394 x86: Avoid generating orb $0, %ah
I'll post my proposed fix for PR target/103611 shortly, but this patch
fixes another missed optimization opportunity revealed by that PR.
Occasionally, reload materializes integer constants during register
allocation sometimes resulting in unnecessary instructions such as:

(insn 23 31 24 2 (parallel [
            (set (reg:SI 0 ax [99])
                (ior:SI (reg:SI 0 ax [99])
                    (const_int 0 [0])))
            (clobber (reg:CC 17 flags))
        ]) "pr103611.c":18:73 550 {*iorsi_1}
     (nil))

These then get "optimized" during the split2 pass, which realizes that
no bits outside of 0xff00 are set, so this operation can be implemented
by operating on just the highpart of a QIreg_operand, i.e. %ah, %bh, %ch
etc., which leads to the useless "orb $0, %ah" seen in the reported PR.

This fix catches the case of const0_rtx in relevant splitter, either
eliminating the instruction or turning it into a simple move.

2021-12-13  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
	* config/i386/i386.md (define_split any_or:SWI248 -> orb %?h):
	Optimize the case where the integer constant operand is zero.

gcc/testsuite/ChangeLog
	* gcc.target/i386/pr103611-1.c: New test case.
2021-12-13 18:51:00 +00:00
Douglas B Rupp
fc4a93eb41 Rework VXWORKS_LINK_SPEC for shared objects support
Split LINK_SPEC as BASE_LINK_SPEC + EXTRA_LINK_SPEC,
with an overridable LINK_OS component that cpu ports may
redefine.

Leverage the latter on powerpc for VxWorks 7, where we incorporate
our specific bits in the linux os configuration as the system compiler
is now very close to a standard linux one.

The split allows supporting shared objects (shared libs and
non-static rtps) on recent versions of VxWorks while retaining
compatibility with older VxWorks targets which could link with
shared libraries but not build them.

2021-12-07  Doug Rupp  <rupp@adacore.com>
	    Olivier Hainque  <hainque@adacore.com>

gcc/
	* config/vxworks.h (VXWORKS_LINK_OS_SPEC): New spec.
	(VXWORKS_BASE_LINK_SPEC): New spec, using the former.
	(VXWORKS_EXTRA_LINK_SPEC): New spec for old and new VxWorks.
	(VXWORKS_LINK_SPEC): Combo of BASE and EXTRA specs.
	* config/rs6000/vxworks.h (VXWORKS_LINK_OS_SPEC): Empty.
	(LINK_OS_EXTRA_SPEC32): Use VXWORKS_LINK_SPEC.
	(LINK_OS_EXTRA_SPEC64): Likewise.
2021-12-13 18:03:26 +00:00