Commit graph

195673 commits

Author SHA1 Message Date
Richard Sandiford
2f52c8caa3 data-ref: Fix ranges_maybe_overlap_p test
dr_may_alias_p rightly used poly_int_tree_p to guard a use of
ranges_maybe_overlap_p, but used the non-poly extractors.
This caused a few failures in the SVE ACLE asm tests.

gcc/
	* tree-data-ref.cc (dr_may_alias_p): Use to_poly_widest instead
	of to_widest.
2022-09-29 11:32:57 +01:00
Richard Sandiford
a31641840a aarch64: Remove redundant TARGET_* checks
After previous patches, it's possible to remove TARGET_*
options that are redundant due to (IMO) obvious dependencies.

gcc/
	* config/aarch64/aarch64.h (TARGET_CRYPTO, TARGET_SHA3, TARGET_SM4)
	(TARGET_DOTPROD): Don't depend on TARGET_SIMD.
	(TARGET_AES, TARGET_SHA2): Likewise.  Remove TARGET_CRYPTO test.
	(TARGET_FP_F16INST): Don't depend on TARGET_FLOAT.
	(TARGET_SVE2, TARGET_SVE_F32MM, TARGET_SVE_F64MM): Don't depend
	on TARGET_SVE.
	(TARGET_SVE2_AES, TARGET_SVE2_BITPERM, TARGET_SVE2_SHA3)
	(TARGET_SVE2_SM4): Don't depend on TARGET_SVE2.
	(TARGET_F32MM, TARGET_F64MM): Delete.
	* config/aarch64/aarch64-c.cc (aarch64_update_cpp_builtins): Guard
	float macros with just TARGET_FLOAT rather than TARGET_FLOAT
	|| TARGET_SIMD.
	* config/aarch64/aarch64-simd.md (copysign<mode>3): Depend
	only on TARGET_SIMD, rather than TARGET_FLOAT && TARGET_SIMD.
	(aarch64_crypto_aes<aes_op>v16qi): Depend only on TARGET_AES,
	rather than TARGET_SIMD && TARGET_AES.
	(aarch64_crypto_aes<aesmc_op>v16qi): Likewise.
	(*aarch64_crypto_aese_fused): Likewise.
	(*aarch64_crypto_aesd_fused): Likewise.
	(aarch64_crypto_pmulldi): Likewise.
	(aarch64_crypto_pmullv2di): Likewise.
	(aarch64_crypto_sha1hsi): Likewise TARGET_SHA2.
	(aarch64_crypto_sha1hv4si): Likewise.
	(aarch64_be_crypto_sha1hv4si): Likewise.
	(aarch64_crypto_sha1su1v4si): Likewise.
	(aarch64_crypto_sha1<sha1_op>v4si): Likewise.
	(aarch64_crypto_sha1su0v4si): Likewise.
	(aarch64_crypto_sha256h<sha256_op>v4si): Likewise.
	(aarch64_crypto_sha256su0v4si): Likewise.
	(aarch64_crypto_sha256su1v4si): Likewise.
	(aarch64_crypto_sha512h<sha512_op>qv2di): Likewise TARGET_SHA3.
	(aarch64_crypto_sha512su0qv2di): Likewise.
	(aarch64_crypto_sha512su1qv2di, eor3q<mode>4): Likewise.
	(aarch64_rax1qv2di, aarch64_xarqv2di, bcaxq<mode>4): Likewise.
	(aarch64_sm3ss1qv4si): Likewise TARGET_SM4.
	(aarch64_sm3tt<sm3tt_op>qv4si): Likewise.
	(aarch64_sm3partw<sm3part_op>qv4si): Likewise.
	(aarch64_sm4eqv4si, aarch64_sm4ekeyqv4si): Likewise.
	* config/aarch64/aarch64.md (<FLOATUORS:optab>dihf2)
	(copysign<GPF:mode>3, copysign<GPF:mode>3_insn)
	(xorsign<mode>3): Remove redundant TARGET_FLOAT condition.
2022-09-29 11:32:57 +01:00
Richard Sandiford
2a269bda9e aarch64: Tweak handling of -mgeneral-regs-only
-mgeneral-regs-only is effectively "+nofp for the compiler without
changing the assembler's ISA flags".  Currently that's implemented
by making TARGET_FLOAT, TARGET_SIMD and TARGET_SVE depend on
!TARGET_GENERAL_REGS_ONLY and then making any feature that needs FP
registers depend (directly or indirectly) on one of those three TARGET
macros.  The problem is that it's easy to forgot to do the last bit.

This patch instead represents the distinction between "assemnbler
ISA flags" and "compiler ISA flags" more directly, funnelling
all updates through a new function that sets both sets of flags
together.

gcc/
	* config/aarch64/aarch64.opt (aarch64_asm_isa_flags): New variable.
	* config/aarch64/aarch64.h (aarch64_asm_isa_flags)
	(aarch64_isa_flags): Redefine as read-only macros.
	(TARGET_SIMD, TARGET_FLOAT, TARGET_SVE): Don't depend on
	!TARGET_GENERAL_REGS_ONLY.
	* common/config/aarch64/aarch64-common.cc
	(aarch64_set_asm_isa_flags): New function.
	(aarch64_handle_option): Call it when updating -mgeneral-regs.
	* config/aarch64/aarch64-protos.h (aarch64_simd_switcher): Replace
	m_old_isa_flags with m_old_asm_isa_flags.
	(aarch64_set_asm_isa_flags): Declare.
	* config/aarch64/aarch64-builtins.cc
	(aarch64_simd_switcher::aarch64_simd_switcher)
	(aarch64_simd_switcher::~aarch64_simd_switcher): Save and restore
	aarch64_asm_isa_flags instead of aarch64_isa_flags.
	* config/aarch64/aarch64-sve-builtins.cc
	(check_required_extensions): Use aarch64_asm_isa_flags instead
	of aarch64_isa_flags.
	* config/aarch64/aarch64.cc (aarch64_set_asm_isa_flags): New function.
	(aarch64_override_options, aarch64_handle_attr_arch)
	(aarch64_handle_attr_cpu, aarch64_handle_attr_isa_flags): Use
	aarch64_set_asm_isa_flags to set the ISA flags.
	(aarch64_option_print, aarch64_declare_function_name)
	(aarch64_start_file): Use aarch64_asm_isa_flags instead
	of aarch64_isa_flags.
	(aarch64_can_inline_p): Check aarch64_asm_isa_flags as well as
	aarch64_isa_flags.
2022-09-29 11:32:57 +01:00
Richard Sandiford
bb7f43b62a aarch64: Tweak contents of flags_on/off fields
After previous changes, it's more convenient if the flags_on and
flags_off fields of all_extensions include the feature flag itself.

gcc/
	* common/config/aarch64/aarch64-common.cc (all_extensions):
	Include the feature flag in flags_on and flags_off.
	(aarch64_parse_extension): Update accordingly.
	(aarch64_get_extension_string_for_isa_flags): Likewise.
2022-09-29 11:32:56 +01:00
Richard Sandiford
fed55a60e5 aarch64: Make more use of aarch64_feature_flags
A previous patch added a aarch64_feature_flags typedef, to abstract
the representation of the feature flags.  This patch makes existing
code use the typedef too.  Hope I've caught them all!

gcc/
	* common/config/aarch64/aarch64-common.cc: Use aarch64_feature_flags
	for feature flags throughout.
	* config/aarch64/aarch64-protos.h: Likewise.
	* config/aarch64/aarch64-sve-builtins.h: Likewise.
	* config/aarch64/aarch64-sve-builtins.cc: Likewise.
	* config/aarch64/aarch64.cc: Likewise.
	* config/aarch64/aarch64.opt: Likewise.
	* config/aarch64/driver-aarch64.cc: Likewise.
2022-09-29 11:32:56 +01:00
Richard Sandiford
60dee638c8 aarch64: Tweak constness of option-related data
Some of the option structures have all-const member variables.
That doesn't seem necessary: we can just use const on the objects
that are supposed to be read-only.

Also, with the new, more C++-heavy option handling, it seems
better to use constexpr for the static data, to make sure that
we're not adding unexpected overhead.

gcc/
	* common/config/aarch64/aarch64-common.cc (aarch64_option_extension)
	(processor_name_to_arch, arch_to_arch_name): Remove const from
	member variables.
	(all_extensions, all_cores, all_architectures): Make a constexpr.
	* config/aarch64/aarch64.cc (processor): Remove const from
	member variables.
	(all_architectures): Make a constexpr.
	* config/aarch64/driver-aarch64.cc (aarch64_core_data)
	(aarch64_arch_driver_info): Remove const from member variables.
	(aarch64_cpu_data, aarch64_arches): Make a constexpr.
	(get_arch_from_id): Return a pointer to const.
	(host_detect_local_cpu): Update accordingly.
2022-09-29 11:32:55 +01:00
Richard Sandiford
13af9e9fda aarch64: Avoid std::string in static data
Just a minor patch to avoid having to construct std::strings
in static data.

gcc/
	* common/config/aarch64/aarch64-common.cc (processor_name_to_arch)
	(arch_to_arch_name): Use const char * instead of std::string.
2022-09-29 11:32:55 +01:00
Richard Sandiford
4ebf56f283 aarch64: Simplify generation of .arch strings
aarch64-common.cc has two arrays, one maintaining the original
definition order and one sorted by population count.  Sorting
by population count was a way of ensuring topological ordering,
taking advantage of the fact that the entries are partially
ordered by the subset relation.  However, the sorting is not
needed now that the .def file is forced to have topological
order from the outset.

Other changes are:

(1) The population count used:

      uint64_t total_flags_a = opt_a->flag_canonical & opt_a->flags_on;
      uint64_t total_flags_b = opt_b->flag_canonical & opt_b->flags_on;
      int popcnt_a = popcount_hwi ((HOST_WIDE_INT)total_flags_a);
      int popcnt_b = popcount_hwi ((HOST_WIDE_INT)total_flags_b);

    where I think the & was supposed to be |.  This meant that the
    counts would always be 1 in practice, since flag_canonical is
    a single bit.  This led us to printing +nofp+nosimd even though
    GCC "knows" (and GAS agrees) that +nofp disables simd.

(2) The .arch output code converts +aes+sha2 to +crypto.  I think
    the main reason for doing this is to support assemblers that
    predate the individual per-feature crypto flags.  It therefore
    seems more natural to treat it as a special case, rather than
    as an instance of a general pattern.  Hopefully we won't do
    something similar in future!

    (There is already special handling of CRC, for different reasons.)

(3) Previously, if the /proc/cpuinfo code saw a feature like sve,
    it would assume the presence of all the features that sve
    depends on.  It would be possible to keep that behaviour
    if necessary, but it was simpler to assume the presence of
    fp16 (say) only when fphp is present.  There's an argument
    that that's more conservatively correct too.

gcc/
	* common/config/aarch64/aarch64-common.cc
	(TARGET_OPTION_INIT_STRUCT): Delete.
	(aarch64_option_extension): Remove is_synthetic_flag.
	(all_extensions): Update accordingly.
	(all_extensions_by_on, opt_ext, opt_ext_cmp): Delete.
	(aarch64_option_init_struct, aarch64_contains_opt): Delete.
	(aarch64_get_extension_string_for_isa_flags): Rewrite to use
	all_extensions instead of all_extensions_on.

gcc/testsuite/
	* gcc.target/aarch64/cpunative/info_8: Add all dependencies of sve.
	* gcc.target/aarch64/cpunative/info_9: Likewise svesm4.
	* gcc.target/aarch64/cpunative/info_15: Likewise.
	* gcc.target/aarch64/cpunative/info_16: Likewise sve2.
	* gcc.target/aarch64/cpunative/info_17: Likewise.
	* gcc.target/aarch64/cpunative/native_cpu_2.c: Expect just +nofp
	rather than +nofp+nosimd.
	* gcc.target/aarch64/cpunative/native_cpu_10.c: Likewise.
	* gcc.target/aarch64/target_attr_15.c: Likewise.
2022-09-29 11:32:55 +01:00
Richard Sandiford
11a113d501 aarch64: Simplify feature definitions
Currently the aarch64-option-extensions.def entries, the
aarch64-cores.def entries, and the AARCH64_FL_FOR_* macros
have a transitive closure of dependencies that is maintained by hand.
This is a bit error-prone and is becoming less tenable as more features
are added.  The main point of this patch is to maintain the closure
automatically instead.

For example, the +sve2-aes extension requires sve2 and aes.
This is now described using:

  AARCH64_OPT_EXTENSION("sve2-aes", SVE2_AES, (SVE2, AES), ...)

If life was simple, we could just give the name of the feature
and the list of features that it requires/depends on.  But sadly
things are more complicated.  For example:

- the legacy +crypto option enables aes and sha2 only, but +nocrypto
  disables all crypto-related extensions, including sm4.

- +fp16fml enables fp16, but armv8.4-a enables fp16fml without fp16.
  fp16fml only has an effect when fp16 is also present; see the
  comments for more details.

- +bf16 enables simd, but +bf16+nosimd is valid and enables just the
  scalar bf16 instructions.  rdma behaves similarly.

To handle cases like these, the option entries have extra fields to
specify what an explicit +foo enables and what an explicit +nofoo
disables, in addition to the absolute dependencies.

The other main changes are:

- AARCH64_FL_* are now defined automatically.

- the feature list for each architecture level moves from aarch64.h
  to aarch64-arches.def.

As a consequence, we now have a (redundant) V8A feature flag.

While there, the patch uses a new typedef, aarch64_feature_flags,
for the set of feature flags.  This should make it easier to switch
to a class if we run out of bits in the uint64_t.

For now the patch hardcodes the fact that crypto is the only
synthetic option.  A later patch will remove this field.

To test for things that might not be covered by the testsuite,
I made the driver print out the all_extensions, all_cores and
all_archs arrays before and after the patch, with the following
tweaks:

- renumber the old AARCH64_FL_* bit assignments to match the .def order
- remove the new V8A flag when printing the new tables
- treat CRYPTO and CRYPTO | AES | SHA2 the same way when printing the
  core tables

(On the last point: some cores enabled just CRYPTO while others enabled
CRYPTO, AES and SHA2.  This doesn't cause a difference in behaviour
because of how the dependent macros are defined.  With the new scheme,
all entries with CRYPTO automatically get AES and SHA2 too.)

The only difference is that +nofp now turns off dotprod.  This was
another instance of an incomplete transitive closure, but unlike the
instances fixed in a previous patch, it had no observable effect.

gcc/
	* config/aarch64/aarch64-option-extensions.def: Switch to a new format.
	* config/aarch64/aarch64-cores.def: Use the same format to specify
	lists of features.
	* config/aarch64/aarch64-arches.def: Likewise, moving that information
	from aarch64.h.
	* config/aarch64/aarch64-opts.h (aarch64_feature_flags): New typedef.
	* config/aarch64/aarch64.h (aarch64_feature): New class enum.
	Turn AARCH64_FL_* macros into constexprs, getting the definitions
	from aarch64-option-extensions.def.  Remove AARCH64_FL_FOR_* macros.
	* common/config/aarch64/aarch64-common.cc: Include
	aarch64-feature-deps.h.
	(all_extensions): Update for new .def format.
	(all_extensions_by_on, all_cores, all_architectures): Likewise.
	* config/aarch64/driver-aarch64.cc: Include aarch64-feature-deps.h.
	(aarch64_extensions): Update for new .def format.
	(aarch64_cpu_data, aarch64_arches): Likewise.
	* config/aarch64/aarch64.cc: Include aarch64-feature-deps.h.
	(all_architectures, all_cores): Update for new .def format.
	* config/aarch64/aarch64-sve-builtins.cc
	(check_required_extensions): Likewise.
2022-09-29 11:32:54 +01:00
Richard Sandiford
c067c474f8 aarch64: Reorder an entry in aarch64-option-extensions.def
aarch64-option-extensions.def was topologically sorted except
for one case: crypto came before its aes and sha2 dependencies.
This patch moves crypto after sha2 instead.

gcc/
	* config/aarch64/aarch64-option-extensions.def: Move crypto
	after sha2.

gcc/testsuite/
	* gcc.target/aarch64/cpunative/native_cpu_0.c: Expect +crypto
	to come after +crc.
	* gcc.target/aarch64/cpunative/native_cpu_13.c: Likewise.
	* gcc.target/aarch64/cpunative/native_cpu_16.c: Likewise.
	* gcc.target/aarch64/cpunative/native_cpu_17.c: Likewise.
	* gcc.target/aarch64/cpunative/native_cpu_6.c: Likewise.
	* gcc.target/aarch64/cpunative/native_cpu_7.c: Likewise.
	* gcc.target/aarch64/options_set_2.c: Likewise.
	* gcc.target/aarch64/options_set_3.c: Likewise.
	* gcc.target/aarch64/options_set_4.c: Likewise.
2022-09-29 11:32:54 +01:00
Richard Sandiford
b754d32d30 aarch64: Fix transitive closure of features
aarch64-option-extensions.def requires us to maintain the transitive
closure of options by hand.  This patch fixes a few cases where a
flag was missed.

+noaes and +nosha2 now disable +crypto, which IMO makes more
sense and is consistent with the Clang behaviour.

gcc/
	* config/aarch64/aarch64-option-extensions.def (dotprod): Depend
	on fp as well as simd.
	(sha3): Likewise.
	(aes): Likewise.  Make +noaes disable crypto.
	(sha2): Likewise +nosha2.  Also make +nosha2 disable sha3 and
	sve2-sha3.
	(sve2-sha3): Depend on sha2 as well as sha3.

gcc/testsuite/
	* gcc.target/aarch64/options_set_6.c: Expect +crypto+nosha2 to
	disable crypto but keep aes.
	* gcc.target/aarch64/pragma_cpp_predefs_4.c: New test.
2022-09-29 11:32:53 +01:00
Richard Sandiford
0f244d848c aarch64: Remove AARCH64_FL_RCPC8_4 [PR107025]
AARCH64_FL_RCPC8_4 is an odd-one-out in that it has no associated
entry in aarch64-option-extensions.def.  This means that, although
it is internally separated from AARCH64_FL_V8_4A, there is no
mechanism for turning it on and off individually, independently
of armv8.4-a.

The only place that the flag was used independently was in the
entry for thunderx3t110, which enabled it alongside V8_3A.
As noted in PR107025, this means that any use of the extension
will fail to assemble.

In the PR trail, Andrew suggested removing the core entry.
That might be best long-term, but since the barrier for removing
command-line options without a deprecation period is very high,
this patch instead just drops the flag from the core entry.
We'll still produce correct code.

gcc/
	PR target/107025
	* config/aarch64/aarch64.h (oAARCH64_FL_RCPC8_4): Delete.
	(AARCH64_FL_FOR_V8_4A): Update accordingly.
	(AARCH64_ISA_RCPC8_4): Use AARCH64_FL_V8_4A directly.
	* config/aarch64/aarch64-cores.def (thunderx3t110): Remove
	AARCH64_FL_RCPC8_4.
2022-09-29 11:32:53 +01:00
Richard Sandiford
198bb6ed32 aarch64: Avoid redundancy in aarch64-cores.def
The flags fields of the aarch64-cores.def always start with
AARCH64_FL_FOR_<ARCH>.  After previous changes, <ARCH> is always
identical to the previous field, so we can drop the explicit
AARCH64_FL_FOR_<ARCH> and derive it programmatically.

This isn't a big saving in itself, but it helps with later patches.

gcc/
	* config/aarch64/aarch64-cores.def: Remove AARCH64_FL_FOR_<ARCH>
	from the flags field.
	* common/config/aarch64/aarch64-common.cc (all_cores): Add it
	here instead.
	* config/aarch64/aarch64.cc (all_cores): Likewise.
	* config/aarch64/driver-aarch64.cc (all_cores): Likewise.
2022-09-29 11:32:53 +01:00
Richard Sandiford
0af214b447 aarch64: Small config.gcc cleanups
The aarch64-option-extensions.def parsing in config.gcc had
some code left over from when it tried to parse the whole
macro definition.  Also, config.gcc now only looks at the
first fields of the aarch64-arches.def entries.

gcc/
	* config.gcc: Remove dead aarch64-option-extensions.def code.
	* config/aarch64/aarch64-arches.def: Update comment.
2022-09-29 11:32:52 +01:00
Richard Sandiford
00c22ba69d aarch64: Add "V" to aarch64-arches.def names
This patch completes the renaming of architecture-level related
things by adding "V" to the name of the architecture in
aarch64-arches.def.  Since the "V" is predictable, we can easily
drop it when we don't need it (as when matching /proc/cpuinfo).

Having a valid C identifier is necessary for later patches.

gcc/
	* config/aarch64/aarch64-arches.def: Add a leading "V" to the
	ARCH_IDENT fields.
	* config/aarch64/aarch64-cores.def: Update accordingly.
	* common/config/aarch64/aarch64-common.cc (all_cores): Likewise.
	* config/aarch64/aarch64.cc (all_cores): Likewise.
	* config/aarch64/driver-aarch64.cc (aarch64_arches): Skip the
	leading "V".
2022-09-29 11:32:52 +01:00
Richard Sandiford
0f833d1900 aarch64: Rename AARCH64_FL_FOR_ARCH macros
This patch renames AARCH64_FL_FOR_ARCH* macros to follow the
same V<number><profile> names that we (now) use elsewhere.

The names are only temporary -- a later patch will move the
information to the .def file instead.  However, it helps with
the sequencing to do this first.

gcc/
	* config/aarch64/aarch64.h (AARCH64_FL_FOR_ARCH8): Rename to...
	(AARCH64_FL_FOR_V8A): ...this.
	(AARCH64_FL_FOR_ARCH8_1): Rename to...
	(AARCH64_FL_FOR_V8_1A): ...this.
	(AARCH64_FL_FOR_ARCH8_2): Rename to...
	(AARCH64_FL_FOR_V8_2A): ...this.
	(AARCH64_FL_FOR_ARCH8_3): Rename to...
	(AARCH64_FL_FOR_V8_3A): ...this.
	(AARCH64_FL_FOR_ARCH8_4): Rename to...
	(AARCH64_FL_FOR_V8_4A): ...this.
	(AARCH64_FL_FOR_ARCH8_5): Rename to...
	(AARCH64_FL_FOR_V8_5A): ...this.
	(AARCH64_FL_FOR_ARCH8_6): Rename to...
	(AARCH64_FL_FOR_V8_6A): ...this.
	(AARCH64_FL_FOR_ARCH8_7): Rename to...
	(AARCH64_FL_FOR_V8_7A): ...this.
	(AARCH64_FL_FOR_ARCH8_8): Rename to...
	(AARCH64_FL_FOR_V8_8A): ...this.
	(AARCH64_FL_FOR_ARCH8_R): Rename to...
	(AARCH64_FL_FOR_V8R): ...this.
	(AARCH64_FL_FOR_ARCH9): Rename to...
	(AARCH64_FL_FOR_V9A): ...this.
	(AARCH64_FL_FOR_ARCH9_1): Rename to...
	(AARCH64_FL_FOR_V9_1A): ...this.
	(AARCH64_FL_FOR_ARCH9_2): Rename to...
	(AARCH64_FL_FOR_V9_2A): ...this.
	(AARCH64_FL_FOR_ARCH9_3): Rename to...
	(AARCH64_FL_FOR_V9_3A): ...this.
	* common/config/aarch64/aarch64-common.cc (all_cores): Update
	accordingly.
	* config/aarch64/aarch64-arches.def: Likewise.
	* config/aarch64/aarch64-cores.def: Likewise.
	* config/aarch64/aarch64.cc (all_cores): Likewise.
2022-09-29 11:32:51 +01:00
Richard Sandiford
78aaafc3d4 aarch64: Rename AARCH64_FL architecture-level macros
Following on from the previous AARCH64_ISA patch, this one adds the
profile name directly to the end of architecture-level AARCH64_FL_*
macros.

gcc/
	* config/aarch64/aarch64.h (AARCH64_FL_V8_1, AARCH64_FL_V8_2)
	(AARCH64_FL_V8_3, AARCH64_FL_V8_4, AARCH64_FL_V8_5, AARCH64_FL_V8_6)
	(AARCH64_FL_V9, AARCH64_FL_V8_7, AARCH64_FL_V8_8, AARCH64_FL_V9_1)
	(AARCH64_FL_V9_2, AARCH64_FL_V9_3): Add "A" to the end of the name.
	(AARCH64_FL_V8_R): Rename to AARCH64_FL_V8R.
	(AARCH64_FL_FOR_ARCH8_1, AARCH64_FL_FOR_ARCH8_2): Update accordingly.
	(AARCH64_FL_FOR_ARCH8_3, AARCH64_FL_FOR_ARCH8_4): Likewise.
	(AARCH64_FL_FOR_ARCH8_5, AARCH64_FL_FOR_ARCH8_6): Likewise.
	(AARCH64_FL_FOR_ARCH8_7, AARCH64_FL_FOR_ARCH8_8): Likewise.
	(AARCH64_FL_FOR_ARCH8_R, AARCH64_FL_FOR_ARCH9): Likewise.
	(AARCH64_FL_FOR_ARCH9_1, AARCH64_FL_FOR_ARCH9_2): Likewise.
	(AARCH64_FL_FOR_ARCH9_3, AARCH64_ISA_V8_2A, AARCH64_ISA_V8_3A)
	(AARCH64_ISA_V8_4A, AARCH64_ISA_V8_5A, AARCH64_ISA_V8_6A): Likewise.
	(AARCH64_ISA_V8R, AARCH64_ISA_V9A, AARCH64_ISA_V9_1A): Likewise.
	(AARCH64_ISA_V9_2A, AARCH64_ISA_V9_3A): Likewise.
2022-09-29 11:32:51 +01:00
Richard Sandiford
2a4788ac3b aarch64: Rename AARCH64_ISA architecture-level macros
All AARCH64_ISA_* architecture-level macros except AARCH64_ISA_V8_R
are for the A profile: they cause __ARM_ARCH_PROFILE to be set to
'A' and they are associated with architecture names like armv8.4-a.

It's convenient for later patches if we make this explicit
by adding an "A" to the name.  Also, rather than add an underscore
(as for V8_R) it's more convenient to add the profile directly
to the number, like we already do in the ARCH_IDENT field of the
aarch64-arches.def entries.

gcc/
	* config/aarch64/aarch64.h (AARCH64_ISA_V8_2, AARCH64_ISA_V8_3)
	(AARCH64_ISA_V8_4, AARCH64_ISA_V8_5, AARCH64_ISA_V8_6)
	(AARCH64_ISA_V9, AARCH64_ISA_V9_1, AARCH64_ISA_V9_2)
	(AARCH64_ISA_V9_3): Add "A" to the end of the name.
	(AARCH64_ISA_V8_R): Rename to AARCH64_ISA_V8R.
	(TARGET_ARMV8_3, TARGET_JSCVT, TARGET_FRINT, TARGET_MEMTAG): Update
	accordingly.
	* common/config/aarch64/aarch64-common.cc
	(aarch64_get_extension_string_for_isa_flags): Likewise.
	* config/aarch64/aarch64-c.cc
	(aarch64_define_unconditional_macros): Likewise.
2022-09-29 11:32:50 +01:00
Richard Sandiford
c1e1fa0549 Add OPTIONS_H_EXTRA to GTFILES
I have a patch that adds a typedef to aarch64's <cpu>-opts.h.
The typedef is used for a TargetVariable in the .opt file,
which means that it is covered by PCH and so needs to be
visible to gengtype.

<cpu>-opts.h is not included directly in tm.h, but indirectly
by target headers (in this case aarch64.h).  There was therefore
nothing that caused it to be added to GTFILES.

gcc/
	* Makefile.in (GTFILES): Add OPTIONS_H_EXTRA.
2022-09-29 11:32:50 +01:00
Jakub Jelinek
a5a9237e2a driver, cppdefault: Unbreak bootstrap on Debian/Ubuntu [PR107059]
My recent change to enable _Float{16,32,64,128,32x,64x,128x} for C++
apparently broke bootstrap on some Debian/Ubuntu setups.
Those multiarch targets put some headers into
/usr/include/x86_64-linux-gnu/bits/ etc. subdirectory instead of
/usr/include/bits/.
This is handled by
    /* /usr/include comes dead last.  */
    { NATIVE_SYSTEM_HEADER_DIR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 2 },
    { NATIVE_SYSTEM_HEADER_DIR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 0 },
in cppdefault.cc, where the 2 in the last element of the first initializer
means the entry is ignored on non-multiarch and suffixed by the multiarch
dir otherwise, so installed gcc has search path like:
 /home/jakub/gcc/obj01inst/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/13.0.0/include
 /home/jakub/gcc/obj01inst/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/13.0.0/include-fixed
 /usr/local/include
 /usr/include/x86_64-linux-gnu
 /usr/include
(when installed with DESTDIR=/home/jakub/gcc/obj01inst).
Now, when fixincludes is run, it is processing the whole /usr/include dir
and all its subdirectories, so floatn{,-common.h} actually go into
.../include-fixed/x86_64-linux-gnu/bits/floatn{,-common.h}
because that is where they appear in /usr/include too.
In some setups, /usr/include also contains /usr/include/bits -> x86_64-linux-gnu/bits
symlink and after the r13-2896 tweak it works.
In other setups there is no /usr/include/bits symlink and when one
 #include <bits/floatn.h>
given the above search path, it doesn't find the fixincluded header,
as
/home/jakub/gcc/obj01inst/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/13.0.0/include-fixed/bits/floatn.h
doesn't exist and
/home/jakub/gcc/obj01inst/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/13.0.0/include-fixed/x86_64-linux-gnu/bits/floatn.h
isn't searched and so
/usr/include/x86_64-linux-gnu/bits/floatn.h
wins and we fail because of typedef whatever _Float128; and similar.
The following patch ought to fix this.  The first hunk by arranging that
the installed search path actually looks like:
 /home/jakub/gcc/obj01inst/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/13.0.0/include
 /home/jakub/gcc/obj01inst/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/13.0.0/include-fixed/x86_64-linux-gnu
 /home/jakub/gcc/obj01inst/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/13.0.0/include-fixed
 /usr/local/include
 /usr/include/x86_64-linux-gnu
 /usr/include
and thus for include-fixed it treats it the same as /usr/include.
The second FIXED_INCLUDE_DIR entry there is:
     { FIXED_INCLUDE_DIR, "GCC", 0, 0, 0,
       /* A multilib suffix needs adding if different multilibs use
          different headers.  */
 #ifdef SYSROOT_HEADERS_SUFFIX_SPEC
       1
 #else
       0
 #endif
     },
where SYSROOT_HEADERS_SUFFIX_SPEC is defined only on vxworks or mips*-mti-linux
and arranges for multilib path to be appended there.  Neither of those
systems is multiarch.
This isn't enough, because when using the -B option, the driver adds
-isystem .../include-fixed in another place, so the second hunk modifies
that spot the same.
/home/jakub/gcc/obj01/gcc/xgcc -B /home/jakub/gcc/obj01/gcc/
then has search path:
 /home/jakub/gcc/obj01/gcc/include
 /home/jakub/gcc/obj01/gcc/include-fixed/x86_64-linux-gnu
 /home/jakub/gcc/obj01/gcc/include-fixed
 /usr/local/include
 /usr/include/x86_64-linux-gnu
 /usr/include
which again is what I think we want to achieve.

2022-09-29  Jakub Jelinek  <jakub@redhat.com>

	PR bootstrap/107059
	* cppdefault.cc (cpp_include_defaults): If SYSROOT_HEADERS_SUFFIX_SPEC
	isn't defined, add FIXED_INCLUDE_DIR entry with multilib flag 2
	before FIXED_INCLUDE_DIR entry with multilib flag 0.
	* gcc.cc (do_spec_1): If multiarch_dir, add
	include-fixed/multiarch_dir paths before include-fixed paths.
2022-09-29 12:04:24 +02:00
Martin Liska
b7723e1353 support -gz=zstd for both linker and assembler
PR driver/106897

gcc/ChangeLog:

	* common.opt: Add -gz=zstd value.
	* configure.ac: Detect --compress-debug-sections=zstd
	for both linker and assembler.
	* configure: Regenerate.
	* gcc.cc (LINK_COMPRESS_DEBUG_SPEC): Handle -gz=zstd.
	(ASM_COMPRESS_DEBUG_SPEC): Likewise.
2022-09-29 11:26:33 +02:00
Ronan Desplanques
9b0d780514 ada: Remove duplicated doc comment section
A documentation section was duplicated by mistake in r0-110752.
This commit removes the copy that was added by r0-110752, but
integrates the small editorial change that it brought to the
original.

gcc/ada/

	* einfo.ads: remove documentation duplicate
2022-09-29 11:08:47 +02:00
Eric Botcazou
0f8a934b44 ada: Further tweak new expansion of contracts
The original extended return statement is mandatory for functions whose
result type is limited in Ada 2005 and later.

gcc/ada/

	* contracts.adb (Build_Subprogram_Contract_Wrapper): Put back the
	extended return statement if the result type is built-in-place.
	* sem_attr.adb (Analyze_Attribute_Old_Result): Also expect an
	extended return statement.
2022-09-29 11:08:47 +02:00
Bob Duff
9ebc54a8c4 ada: Improve efficiency of slice-of-component assignment
This patch improves the efficiency of slice assignment when the left- or
right-hand side is a slice of a component or a slice of a slice.
Previously, the optimization was disabled in these cases, just in
case there might be a volatile or independent component lurking.
Now we explicitly check all the relevant subcomponents of
the prefix.

The previous version said (in exp_ch5.adb):

	--  ...We could
	--  complicate this code by actually looking for such volatile and
	--  independent components.

and that's exactly what we are doing here.

gcc/ada/

	* exp_ch5.adb
	(Expand_Assign_Array_Loop_Or_Bitfield): Make the checks for
	volatile and independent objects more precise.
2022-09-29 11:08:46 +02:00
Piotr Trojanek
01ea0437ea ada: Fix checking of Refined_State with nested package renamings
When collecting package state declared in package body, we should only
recursively examine the visible part of nested packages while ignoring other
entities related to packages (e.g. package bodies or package renamings).

gcc/ada/

	* sem_util.adb (Collect_Visible_States): Ignore package renamings.
2022-09-29 11:08:46 +02:00
Richard Biener
a1cd4d52d6 tree-optimization/105646 - re-interpret always executed in uninit diag
The following fixes PR105646, not diagnosing

int f1();
int f3(){
    auto const & a = f1();
    bool v3{v3};
    return a;
}

with optimization because the early uninit diagnostic pass only
diagnoses always executed cases.  The patch does this by
re-interpreting what always executed means and choosing to
ignore exceptional and abnormal control flow for this.  At the
same time it improves things as suggested in a comment - when
the value-numbering run done without optimizing figures there's
a fallthru path, consider blocks on it as always executed.

	PR tree-optimization/105646
	* tree-ssa-uninit.cc (warn_uninitialized_vars): Pre-compute
	the set of fallthru reachable blocks from function entry
	and use that to determine wlims.always_executed.

	* g++.dg/uninit-pr105646.C: New testcase.
2022-09-29 09:34:00 +02:00
liuhongt
f758d447d7 Check nonlinear iv in vect_can_advance_ivs_p.
vectorizable_nonlinear_induction doesn't always guard
vect_peel_nonlinear_iv_init when it's called by
vect_update_ivs_after_vectorizer.
It's supposed to be guarded by vect_can_advance_ivs_p.

gcc/ChangeLog:

	PR tree-optimization/107055
	* tree-vect-loop-manip.cc (vect_can_advance_ivs_p): Check for
	nonlinear induction variables.
	* tree-vect-loop.cc (vect_can_peel_nonlinear_iv_p): New
	functions.
	(vectorizable_nonlinear_induction): Put part codes into
	vect_can_peel_nonlinear_iv_p.
	* tree-vectorizer.h (vect_can_peel_nonlinear_iv_p): Declare.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/pr107055.c: New test.
2022-09-29 15:22:47 +08:00
GCC Administrator
9e79a25b66 Daily bump. 2022-09-29 00:16:38 +00:00
Jonathan Wakely
d01f112de4 libstdc++: Disable volatile-qualified std::bind for C++20
LWG 2487 added a precondition to std::bind for C++17, making
volatile-qualified uses undefined. We still support it, but with a
deprecated warning.

P1065R2 made it explicitly ill-formed for C++20, so we should no longer
accept it as deprecated. This implements that change.

libstdc++-v3/ChangeLog:

	* doc/xml/manual/evolution.xml: Document std::bind API
	changes.
	* doc/xml/manual/intro.xml: Document LWG 2487 status.
	* doc/xml/manual/using.xml: Clarify default value of
	_GLIBCXX_USE_DEPRECATED.
	* doc/html/*: Regenerate.
	* include/std/functional (_Bind::operator()(Args&&...) volatile)
	(_Bind::operator()(Args&&...) const volatile)
	(_Bind_result::operator()(Args&&...) volatile)
	(_Bind_result::operator()(Args&&...) const volatile): Replace
	with deleted overload for C++20 and later.
	* testsuite/20_util/bind/cv_quals.cc: Check for deprecated
	warnings in C++17.
	* testsuite/20_util/bind/cv_quals_2.cc: Likewise, and check for
	ill-formed in C++20.
2022-09-29 00:33:46 +01:00
Jonathan Wakely
fa9bda3ea4 libstdc++: Make INVOKE<R> refuse to create dangling references [PR70692]
This is the next part of the library changes from P2255R2. This makes
INVOKE<R> ill-formed if converting the INVOKE expression to R would bind
a reference to a temporary object.

The is_invocable_r trait is now false if the invocation would create a
dangling reference. This is done by adding the dangling check to the
__is_invocable_impl partial specialization used for INVOKE<R>
expressions. This change also slightly simplifies the nothrow checking
recently added to that partial specialization.

This change also removes the is_invocable_r checks from the pre-C++17
implementation of std::__invoke_r, because there is no need for it to be
SFINAE-friendly. None of our C++11 and C++14 uses of INVOKE<R> require
those constraints. The std::function constructor needs to check
is_invocable_r, but that's already done explicitly, so we don't need to
recheck when calling __is_invoke_r in std::function::operator(). The
other uses of std::__is_invoke_r do not need to be constrained and can
just be ill-formed if the INVOKE<R> expression is ill-formed.

libstdc++-v3/ChangeLog:

	PR libstdc++/70692
	* include/bits/invoke.h [__cplusplus < 201703] (__invoke_r):
	Remove is_invocable and is_convertible constraints.
	* include/std/type_traits (__is_invocable_impl::_S_conv): Use
	non-deduced context for parameter.
	(__is_invocable_impl::_S_test): Remove _Check_noex template
	parameter and use deduced noexcept value in its place. Add bool
	parameter to detect dangling references.
	(__is_invocable_impl::type): Adjust call to _S_test to avoid
	deducing unnecessary noexcept property..
	(__is_invocable_impl::__nothrow_type): Rename to ...
	(__is_invocable_impl::__nothrow_conv): ... this. Adjust call
	to _S_test to deduce noexcept property.
	* testsuite/20_util/bind/dangling_ref.cc: New test.
	* testsuite/20_util/function/cons/70692.cc: New test.
	* testsuite/20_util/function_objects/invoke/dangling_ref.cc:
	New test.
	* testsuite/20_util/is_invocable/dangling_ref.cc: New test.
	* testsuite/30_threads/packaged_task/cons/dangling_ref.cc:
	New test.
2022-09-29 00:33:36 +01:00
Eugene Rozenfeld
f1adf45b17 Add instruction level discriminator support.
This is the first in a series of patches to enable discriminator support
in AutoFDO.

This patch switches to tracking discriminators per statement/instruction
instead of per basic block. Tracking per basic block was problematic since
not all statements in a basic block needed a discriminator and, also, later
optimizations could move statements between basic blocks making correlation
during AutoFDO compilation unreliable. Tracking per statement also allows
us to assign different discriminators to multiple function calls in the same
basic block. A subsequent patch will add that support.

The idea of this patch is based on commit 4c311d95cf6d9519c3c20f641cc77af7df491fdf
by Dehao Chen in vendors/google/heads/gcc-4_8 but uses a slightly different
approach. In Dehao's work special (normally unused) location ids and side tables
were used to keep track of locations with discriminators. Things have changed
since then and I don't think we have unused location ids anymore. Instead,
I made discriminators a part of ad-hoc locations.

The difference from Dehao's work also includes support for discriminator
reading/writing in lto streaming and in modules.

Tested on x86_64-pc-linux-gnu.

gcc/ChangeLog:

	* basic-block.h: Remove discriminator from basic blocks.
	* cfghooks.cc (split_block_1): Remove discriminator from basic blocks.
	* final.cc (final_start_function_1): Switch from per-bb to per statement
	discriminator.
	(final_scan_insn_1): Don't keep track of basic block discriminators.
	(compute_discriminator): Switch from basic block discriminators to
	instruction discriminators.
	(insn_discriminator): New function to return instruction discriminator.
	(notice_source_line): Use insn_discriminator.
	* gimple-pretty-print.cc (dump_gimple_bb_header): Remove dumping of
	basic block discriminators.
	* gimple-streamer-in.cc (input_bb): Remove reading of basic block
	discriminators.
	* gimple-streamer-out.cc (output_bb): Remove writing of basic block
	discriminators.
	* input.cc (make_location): Pass 0 discriminator to COMBINE_LOCATION_DATA.
	(location_with_discriminator): New function to combine locus with
	a discriminator.
	(has_discriminator): New function to check if a location has a discriminator.
	(get_discriminator_from_loc): New function to get the discriminator
	from a location.
	* input.h: Declarations of new functions.
	* lto-streamer-in.cc (cmp_loc): Use discriminators in location comparison.
	(apply_location_cache): Keep track of current discriminator.
	(input_location_and_block): Read discriminator from stream.
	* lto-streamer-out.cc (clear_line_info): Set current discriminator to
	UINT_MAX.
	(lto_output_location_1): Write discriminator to stream.
	* lto-streamer.h: Add discriminator to cached_location.
	Add current_discr to lto_location_cache.
	Add current_discr to output_block.
	* print-rtl.cc (print_rtx_operand_code_i): Print discriminator.
	* rtl.h: Add extern declaration of insn_discriminator.
	* tree-cfg.cc (assign_discriminator): New function to assign a unique
	discriminator value to all statements in a basic block that have the given
	line number.
	(assign_discriminators): Assign discriminators to statement locations.
	* tree-pretty-print.cc (dump_location): Dump discriminators.
	* tree.cc (set_block): Preserve discriminator when setting block.
	(set_source_range): Preserve discriminator when setting source range.

gcc/cp/ChangeLog:
	* module.cc (write_location): Write discriminator.
	(read_location): Read discriminator.

libcpp/ChangeLog:

	* include/line-map.h: Add discriminator to location_adhoc_data.
	(get_combined_adhoc_loc): Add discriminator parameter.
	(get_discriminator_from_adhoc_loc): Add external declaration.
	(get_discriminator_from_loc): Add external declaration.
	(COMBINE_LOCATION_DATA): Add discriminator parameter.
	* lex.cc (get_location_for_byte_range_in_cur_line) Pass 0 discriminator
	in a call to COMBINE_LOCATION_DATA.
	(warn_about_normalization): Pass 0 discriminator in a call to
	COMBINE_LOCATION_DATA.
	(_cpp_lex_direct): Pass 0 discriminator in a call to
	COMBINE_LOCATION_DATA.
	* line-map.cc (location_adhoc_data_hash): Use discriminator compute
	location_adhoc_data hash.
	(location_adhoc_data_eq): Use discriminator when comparing
	location_adhoc_data.
	(can_be_stored_compactly_p): Check discriminator to determine
	compact storage.
	(get_combined_adhoc_loc): Add discriminator parameter.
	(get_discriminator_from_adhoc_loc): New function to get the discriminator
	from an ad-hoc location.
	(get_discriminator_from_loc): New function to get the discriminator
	from a location.

gcc/testsuite/ChangeLog:

	* c-c++-common/ubsan/pr85213.c: Pass -gno-statement-frontiers.
2022-09-28 14:25:18 -07:00
Nathan Sidwell
9f65eecdbe c++: Add DECL_NTTP_OBJECT_P lang flag
VAR_DECLs for NTTPs need to be handled specially by module streaming,
in the same manner to type info decls.  This reworks their handling to
allow that work to drop in.  We use DECL_LANG_FLAG_5 to indicate such
decls (I didn't notice template_parm_object_p, which looks at the
mangled name -- anyway a bit flag on the node is better, IMHO).  We
break apart the creation routine, so there's now an entry point the
module machinery can use directly.

	gcc/cp/
	* cp-tree.h (DECL_NTTP_OBJECT_P): New.
	(template_parm_object_p): Delete.
	(build_template_parm_object): Declare.
	* cxx-pretty-print.cc (pp_cx_template_argument_list): Use DECL_NTTP_OBJECT_P.
	* error.cc (dump_simple_decl): Likewise.
	* mangle.cc (write_template_arg): Likewise.
	* pt.cc (template_parm_object_p): Delete.
	(create_template_parm_object): Separated out checking from ...
	(get_template_parm_object): ... this, new external entry point.
2022-09-28 13:43:07 -07:00
H.J. Lu
db288230db i386: Mark XMM4-XMM6 as clobbered by encodekey128/encodekey256
encodekey128 and encodekey256 operations clear XMM4-XMM6.  But it is
documented that XMM4-XMM6 are reserved for future usages and software
should not rely upon them being zeroed.  Change encodekey128 and
encodekey256 to clobber XMM4-XMM6.

gcc/

	PR target/107061
	* config/i386/predicates.md (encodekey128_operation): Check
	XMM4-XMM6 as clobbered.
	(encodekey256_operation): Likewise.
	* config/i386/sse.md (encodekey128u32): Clobber XMM4-XMM6.
	(encodekey256u32): Likewise.

gcc/testsuite/

	PR target/107061
	* gcc.target/i386/keylocker-encodekey128.c: Don't check
	XMM4-XMM6.
	* gcc.target/i386/keylocker-encodekey256.c: Likewise.
2022-09-28 11:15:31 -07:00
Ju-Zhe Zhong
03f3365742 RISC-V: Add ABI-defined RVV types.
gcc/ChangeLog:

	* config.gcc: Add riscv-vector-builtins.o.
	* config/riscv/riscv-builtins.cc (riscv_init_builtins): Add RVV builtin function.
	* config/riscv/riscv-protos.h (riscv_v_ext_enabled_vector_mode_p): New function.
	* config/riscv/riscv.cc (ENTRY): New macro.
	(riscv_v_ext_enabled_vector_mode_p): New function.
	(riscv_mangle_type): Add RVV mangle.
	(riscv_vector_mode_supported_p): Adjust RVV machine mode.
	(riscv_verify_type_context): Add context check for RVV.
	(riscv_vector_alignment): Add RVV alignment target hook support.
	(TARGET_VECTOR_MODE_SUPPORTED_P): New target hook support.
	(TARGET_VERIFY_TYPE_CONTEXT): Ditto.
	(TARGET_VECTOR_ALIGNMENT): Ditto.
	* config/riscv/t-riscv: Add riscv-vector-builtins.o
	* config/riscv/riscv-vector-builtins.cc: New file.
	* config/riscv/riscv-vector-builtins.def: New file.
	* config/riscv/riscv-vector-builtins.h: New file.
	* config/riscv/riscv-vector-switch.def: New file.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/base/abi-1.c: New test.
	* gcc.target/riscv/rvv/base/abi-2.c: New test.
	* gcc.target/riscv/rvv/base/abi-3.c: New test.
	* gcc.target/riscv/rvv/base/abi-4.c: New test.
	* gcc.target/riscv/rvv/base/abi-5.c: New test.
	* gcc.target/riscv/rvv/base/abi-6.c: New test.
	* gcc.target/riscv/rvv/base/abi-7.c: New test.
	* gcc.target/riscv/rvv/rvv.exp: New test.
2022-09-29 01:32:14 +08:00
Stefan Schulze Frielinghaus
5d7be27bf7 var-tracking: Add entry values up to max register mode
For parameter of type integer which do not consume a whole register
(modulo sign/zero extension) this patch adds entry values up to maximal
register mode.

gcc/ChangeLog:

	* var-tracking.cc (vt_add_function_parameter): Add entry values
	up to maximal register mode.
2022-09-28 17:27:11 +02:00
Stefan Schulze Frielinghaus
d0b00b63a3 cselib: Keep track of further subvalue relations
Whenever a new cselib value is created check whether a smaller value
exists which is contained in the bigger one.  If so add a subreg
relation to locs of the smaller one.

gcc/ChangeLog:

	* cselib.cc (new_cselib_val): Keep track of further subvalue
	relations.
2022-09-28 17:27:11 +02:00
Andrea Corallo
5e9c4ed903 arm: Define __ARM_FEATURE_AES and __ARM_FEATURE_SHA2 when march +crypto is selected
Hi all,

this patch fixes the missing definition of __ARM_FEATURE_AES and
__ARM_FEATURE_SHA2 when AES SHA1 & SHA2 crypto instructions are
available [1] (read when march +crypto is selected).

Okay for master?

Thanks

  Andrea

[1] <https://raw.githubusercontent.com/ARM-software/acle/main/main/acle.md>

gcc/ChangeLog

2022-09-14  Andrea Corallo  <andrea.corallo@arm.com>

	* config/arm/arm-c.cc (arm_cpu_builtins): Define
	__ARM_FEATURE_AES and __ARM_FEATURE_SHA2.

gcc/testsuite/ChangeLog

2022-09-14  Andrea Corallo  <andrea.corallo@arm.com>

	* gcc.target/arm/attr-crypto.c: Update test.
2022-09-28 15:10:17 +02:00
Xi Ruoyao
b48d7ff357
LoongArch: Use UNSPEC for fmin/fmax RTL pattern [PR105414]
I made a mistake defining fmin/fmax RTL patterns in r13-2085: I used
smin and smax in the definition mistakenly.  This causes the optimizer
to perform constant folding as if fmin/fmax was "really" smin/smax
operations even with -fsignaling-nans.  Then pr105414.c fails.

We don't have fmin/fmax RTL codes for now (PR107013) so we can only use
an UNSPEC for fmin and fmax patterns.

gcc/ChangeLog:

	PR tree-optimization/105414
	* config/loongarch/loongarch.md (UNSPEC_FMAX): New unspec.
	(UNSPEC_FMIN): Likewise.
	(fmax<mode>3): Use UNSPEC_FMAX instead of smax.
	(fmin<mode>3): Use UNSPEC_FMIN instead of smin.
2022-09-28 17:55:01 +08:00
Torbjörn SVENSSON
9a8212db2d testsuite: Skip intrinsics test if arm
In the test cases, it's clearly written that intrinsics are not
implemented on arm*. A simple xfail does not help since there are
link error and that would cause an UNRESOLVED testcase rather than
XFAIL.
By changing to dg-skip-if, the entire test case is omitted.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/advsimd-intrinsics/vld1x2.c: Rephrase
	to unimplemented.
	* gcc.target/aarch64/advsimd-intrinsics/vld1x3.c: Likewise.
	* gcc.target/aarch64/advsimd-intrinsics/vld1x4.c: Likewise.
	* gcc.target/aarch64/advsimd-intrinsics/vst1x2.c: Replace
	dg-xfail-if with dg-skip-if.
	* gcc.target/aarch64/advsimd-intrinsics/vst1x3.c: Likewise.
	* gcc.target/aarch64/advsimd-intrinsics/vst1x4.c: Likewise.

Co-Authored-By: Yvan ROUX  <yvan.roux@foss.st.com>
Signed-off-by: Torbjörn SVENSSON  <torbjorn.svensson@foss.st.com>
2022-09-28 11:03:03 +02:00
Lulu Cheng
646ce0056e LoongArch: Fixed a typo in the comment information of the function loongarch_asan_shadow_offset.
gcc/ChangeLog:

	* config/loongarch/loongarch.cc (loongarch_asan_shadow_offset):
	Fixed typo in "asan_mapping.h".
2022-09-28 16:44:27 +08:00
Tobias Burnus
175a89d123 libgomp.texi: Status 'P' for 'assume', remove duplicated line
libgomp/
	* libgomp.texi (OpenMP 5.1): Mark 'assume' as implemented
	for C/C++. Remove duplicated 'begin declare target' entry.
2022-09-28 10:24:58 +02:00
Lulu Cheng
fa4bc21bac LoongArch: Libitm add LoongArch support.
Co-Authored-By: Yang Yujie <yangyujie@loongson.cn>

libitm/ChangeLog:

	* configure.tgt: Add loongarch support.
	* config/loongarch/asm.h: New file.
	* config/loongarch/sjlj.S: New file.
	* config/loongarch/target.h: New file.
2022-09-28 15:02:14 +08:00
H.J. Lu
a25982ada5 stack-protector: Check stack canary before throwing exception
Check stack canary before throwing exception to avoid stack corruption.

gcc/

	PR middle-end/58245
	* calls.cc: Include "tree-eh.h".
	(expand_call): Check stack canary before throwing exception.

gcc/testsuite/

	PR middle-end/58245
	* g++.dg/fstack-protector-strong.C: Adjusted.
	* g++.dg/pr58245-1.C: New test.
2022-09-27 18:29:20 -07:00
Eugene Rozenfeld
28390443ff Fix AutoFDO tests to not look for hot/cold splitting.
AutoFDO counts are not reliable and we are currently not
performing hot/cold splitting based on them. This change adjusts
several tree-prof tests not to check for hot/cold splitting
when run with AutoFDO.

gcc/testsuite/ChangeLog:

	* gcc.dg/tree-prof/cold_partition_label.c: Don't check for hot/cold splitting with AutoFDO.
	* gcc.dg/tree-prof/section-attr-1.c: Don't check for hot/cold splitting with AutoFDO.
	* gcc.dg/tree-prof/section-attr-2.c: Don't check for hot/cold splitting with AutoFDO.
	* gcc.dg/tree-prof/section-attr-3.c: Don't check for hot/cold splitting with AutoFDO.
2022-09-27 17:36:19 -07:00
GCC Administrator
1f16a020ac Daily bump. 2022-09-28 00:17:27 +00:00
Eugene Rozenfeld
6bf473089f Fix profile count comparison.
The comparison was incorrect when the counts weren't PRECISE.
For example, crossmodule-indir-call-topn-1.c was failing
with AutoFDO: when count_sum is 0 with quality AFDO,
count_sum > profile_count::zero() evaluates to true. Taking that
branch then leads to an assert in the call to to_sreal().

Tested on x86_64-pc-linux-gnu.

gcc/ChangeLog:

	* ipa-cp.cc (good_cloning_opportunity_p): Fix profile count comparison.
2022-09-27 16:46:42 -07:00
Marek Polacek
772d532e0b c++: Implement C++23 P2266R1, Simpler implicit move [PR101165]
This patch implements https://wg21.link/p2266, which, once again,
changes the implicit move rules.  Here's a brief summary of various
changes in this area:

r125211: Introduced moving from certain lvalues when returning them
r171071: CWG 1148, enable move from value parameter on return
r212099: CWG 1579, it's OK to call a converting ctor taking an rvalue
r251035: CWG 1579, do maybe-rvalue overload resolution twice
r11-2411: Avoid calling const copy ctor on implicit move
r11-2412: C++20 implicit move changes, remove the fallback overload
          resolution, allow move on throw of parameters and implicit
	  move of rvalue references

P2266 enables the implicit move even for functions that return references.
That is, we will now perform a move in

  X&& foo (X&& x) {
    return x;
  }

P2266 also removes the fallback overload resolution, but this was
resolved by r11-2412: we only do convert_for_initialization with
LOOKUP_PREFER_RVALUE in C++17 and older.
P2266 also says that a returned move-eligible id-expression is always an
xvalue.  This required some further short, but nontrivial changes,
especially when it comes to deduction, because we have to pay attention
to whether we have auto, auto&& (which is like T&&), or decltype(auto)
with (un)parenthesized argument.  In C++23,

  decltype(auto) f(int&& x) { return (x); }
  auto&& f(int x) { return x; }

both should deduce to 'int&&' but

  decltype(auto) f(int x) { return x; }

should deduce to 'int'.  A cornucopia of tests attached.  I've also
verified that we behave like clang++.

xvalue_p seemed to be broken: since the introduction of clk_implicit_rval,
it cannot use '==' when checking for clk_rvalueref.

Since this change breaks code, it's only enabled in C++23.  In
particular, this code will not compile in C++23:

  int& g(int&& x) { return x; }

because x is now treated as an rvalue, and you can't bind a non-const lvalue
reference to an rvalue.

This patch also fixes PR106882 (the check_return_expr changes).

	PR c++/101165
	PR c++/106882

gcc/c-family/ChangeLog:

	* c-cppbuiltin.cc (c_cpp_builtins): Define __cpp_implicit_move.

gcc/cp/ChangeLog:

	* call.cc (reference_binding): Check clk_implicit_rval in C++20 only.
	* cp-tree.h (unparenthesized_id_or_class_member_access_p): Declare.
	* pt.cc (unparenthesized_id_or_class_member_access_p): New function,
	broken out of...
	(do_auto_deduction): ...here.  Use it.  In C++23, maybe call
	treat_lvalue_as_rvalue_p.
	* tree.cc (xvalue_p): Check & clk_rvalueref, not == clk_rvalueref.
	* typeck.cc (check_return_expr): Allow implicit move for functions
	returning a reference as well, or when the return value type is not
	a scalar type.

gcc/testsuite/ChangeLog:

	* g++.dg/conversion/pr41426.C: Add dg-error for C++23.
	* g++.dg/cpp0x/elision_weak.C: Likewise.
	* g++.dg/cpp0x/move-return3.C: Only link in c++20_down.
	* g++.dg/cpp1y/decltype-auto2.C: Add dg-error for C++23.
	* g++.dg/cpp1y/lambda-generic-89419.C: Likewise.
	* g++.dg/cpp23/feat-cxx2b.C: Test __cpp_implicit_move.
	* g++.dg/gomp/pr56217.C: Only compile in c++20_down.
	* g++.dg/warn/Wno-return-local-addr.C: Add dg-error for C++23.
	* g++.dg/warn/Wreturn-local-addr.C: Adjust dg-error.
	* g++.old-deja/g++.brendan/crash55.C: Add dg-error for C++23.
	* g++.old-deja/g++.jason/temporary2.C: Likewise.
	* g++.old-deja/g++.mike/p2846b.C: Adjust.
	* g++.dg/cpp1y/decltype-auto6.C: New test.
	* g++.dg/cpp23/decltype1.C: New test.
	* g++.dg/cpp23/decltype2.C: New test.
	* g++.dg/cpp23/elision1.C: New test.
	* g++.dg/cpp23/elision2.C: New test.
	* g++.dg/cpp23/elision3.C: New test.
	* g++.dg/cpp23/elision4.C: New test.
	* g++.dg/cpp23/elision5.C: New test.
	* g++.dg/cpp23/elision6.C: New test.
	* g++.dg/cpp23/elision7.C: New test.
2022-09-27 18:49:25 -04:00
Harald Anlauf
78bc6497fc Fortran: error recovery while simplifying intrinsic UNPACK [PR107054]
gcc/fortran/ChangeLog:

	PR fortran/107054
	* simplify.cc (gfc_simplify_unpack): Replace assert by condition
	that terminates simplification when there are not enough elements
	in the constructor of argument VECTOR.

gcc/testsuite/ChangeLog:

	PR fortran/107054
	* gfortran.dg/pr107054.f90: New test.
2022-09-27 21:39:40 +02:00
Ian Lance Taylor
e73d9fcafb runtime: portable access to sigev_notify_thread_id
Previously, libgo relied on the _sigev_un implementation-specific
field in struct sigevent, which is only available on glibc.
This patch uses the sigev_notify_thread_id macro instead which is
mandated by timer_create(2). In theory, this should work with any libc
implementation for Linux. Unfortunately, there is an open glibc bug
as glibc does not define this macro. For this reason, a glibc-specific
workaround is required. Other libcs (such as musl) define the macro
and don't require the workaround.

See https://sourceware.org/bugzilla/show_bug.cgi?id=27417

This makes libgo compatible with musl libc.

Based on patch by Sören Tempel.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/434755
2022-09-27 09:30:23 -07:00
melonedo
f38162977e runtime: synchronize empty struct field handling
In GCCGO and gollvm, the logic for allocating one byte for the last field is:
1. the last field has zero size
2. the struct itself does not have zero size
3. the last field is not blank
this commit adds the last two conditions to runtime.structToFFI.

For golang/go#55146

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/431735
2022-09-27 09:28:39 -07:00