Commit Graph

195701 Commits

Author SHA1 Message Date
Olivier Hainque
9b8ffbb8a0 Arrange to --disable-shared by default for VxWorks
This change makes sure that shared libraries for VxWorks are
only built on explicit request, when configured with --enable-shared.

As the support to build shared libs gets in very incrementally,
this provides us with a robust way to guard the relevant pieces
and reduce the risks of accidentally breaking a platform not yet
ready for it.

2022-09-30  Olivier Hainque  <hainque@adacore.com>

	* configure.ac (*vxworks*): If enable_shared is not
	set, set to "no" and add --disable-shared to target and
	host_configargs.
	* configure: Regenerate.
2022-09-30 10:43:13 +00:00
Jason Merrill
43faf3e544 c++: reduce redundant TARGET_EXPR
An experiment led me to notice that in some cases we were ending up with
TARGET_EXPR initialized by TARGET_EXPR, which isn't useful.

The target_expr_needs_replace change won't make a difference in most cases,
since cp_genericize_init will have already expanded VEC_INIT_EXPR by the
time we consider it, but it is correct.

gcc/cp/ChangeLog:

	* cp-gimplify.cc (cp_fold_r) [TARGET_EXPR]: Collapse
	TARGET_EXPR within TARGET_EXPR.
	* constexpr.cc (cxx_eval_outermost_constant_expr): Avoid
	adding redundant TARGET_EXPR.
	* cp-tree.h (target_expr_needs_replace): VEC_INIT_EXPR doesn't.
2022-09-29 21:27:02 -04:00
GCC Administrator
bbdcdf5cc7 Daily bump. 2022-09-30 00:17:47 +00:00
Joseph Myers
3a3516bc4a c: C2x noreturn attribute
C2x adds a standard [[noreturn]] attribute (which can also be spelt
[[_Noreturn]] for use with <stdnoreturn.h>), so allowing non-returning
functions to be declared in a manner compatible with C++; the
_Noreturn function specifier remains available but is marked
obsolescent.

Implement this attribute.  It's more restricted than GNU
__attribute__ ((noreturn)) - that allows function pointers but using
the standard attribute on a function pointer is a constraint
violation.  Thus, the attribute gets its own handler that checks for a
FUNCTION_DECL before calling the handler for the GNU attribute.  Tests
for the attribute are based on those for C11 _Noreturn and for other
C2x attributes.

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

gcc/c-family/
	* c-lex.cc (c_common_has_attribute): Handle noreturn attribute for
	C.

gcc/c/
	* c-decl.cc (handle_std_noreturn_attribute): New function.
	(std_attribute_table): Add _Noreturn and noreturn.

gcc/testsuite/
	* gcc.dg/c2x-attr-noreturn-1.c, gcc.dg/c2x-attr-noreturn-2.c,
	gcc.dg/c2x-attr-noreturn-3.c: New tests.
	* gcc.dg/c2x-has-c-attribute-2.c: Also test __has_c_attribute for
	noreturn attribute.
2022-09-29 22:59:22 +00:00
Andrew MacLeod
7ea258a13a Process unsigned overflow relations for plus and minus is range-ops.
If a relation is available, calculate overflow and normal ranges. Then
apply as appropriate.

	gcc/
	* range-op.cc (plus_minus_ranges): New.
	(adjust_op1_for_overflow): New.
	(operator_plus::op1_range): Use new adjustment.
	(operator_plus::op2_range): Ditto.
	(operator_minus::op1_range): Ditto.
	* value-relation.h (relation_lt_le_gt_ge_p): New.

	gcc/testsuite/
	* gcc.dg/tree-ssa/pr79095.c: Test evrp pass rather than vrp1.
2022-09-29 18:34:18 -04:00
Andrew MacLeod
67166c9ec3 Refine ranges using relations in GORI.
This allows GORI to recognize when a relation passed in applies to the
2 operands of the current statement.  Check to see if further range
refinement is possible before proceeding.

	* gimple-range-gori.cc (gori_compute::refine_using_relation): New.
	(gori_compute::compute_operand1_range): Invoke
	refine_using_relation when applicable.
	(gori_compute::compute_operand2_range): Ditto.
	* gimple-range-gori.h (class gori_compute): Adjust prototypes.
2022-09-29 18:34:18 -04:00
Andrew MacLeod
431cdfbea1 Track value_relations in GORI.
This allows GORI to recognize and pass relations along the calculation chain.
This will allow relations between the LHS and the operand being calculated
to be utilized in op1_range and op2_range.

	* gimple-range-gori.cc (ori_compute::compute_operand_range):
	Create a relation record and pass it along when possible.
	(gori_compute::compute_operand1_range): Pass relation along.
	(gori_compute::compute_operand2_range): Ditto.
	(gori_compute::compute_operand1_and_operand2_range): Ditto.
	* gimple-range-gori.h (class gori_compute): Adjust prototypes.
	* gimple-range-op.cc (gimple_range_op_handler::calc_op1): Pass
	relation to op1_range call.
	(gimple_range_op_handler::calc_op2): Pass relation to op2_range call.
	* gimple-range-op.h (class gimple_range_op_handler): Adjust
	prototypes.
2022-09-29 18:34:18 -04:00
Andrew MacLeod
cfa7434c4b Move class value_relation the header file.
* value-relation.cc (class value_relation): Move to .h file.
	(value_relation::set_relation): Ditto.
	(value_relation::value_relation): ditto.
	* value-relation.h (class value_relation): Move from .cc file.
	(value_relation::set_relation): Ditto
	(value_relation::value_relation): Ditto.
2022-09-29 18:34:18 -04:00
Andrew MacLeod
ef9bc3626c Audit op1_range and op2_range for undefined LHS.
If the LHS is undefined, GORI should cease looking. There are numerous
places where this happens, and a few potential traps.

	* range-op.cc (operator_minus::op2_range): Check for undefined.
	(operator_mult::op1_range): Ditto.
	(operator_exact_divide::op1_range): Ditto.
	(operator_lshift::op1_range): Ditto.
	(operator_rshift::op1_range): Ditto.
	(operator_cast::op1_range): Ditto.
	(operator_bitwise_and::op1_range): Ditto.
	(operator_bitwise_or::op1_range): Ditto.
	(operator_trunc_mod::op1_range): Ditto.
	(operator_trunc_mod::op2_range): Ditto.
	(operator_bitwise_not::op1_range): Ditto.
	(pointer_or_operator::op1_range): Ditto.
	(range_op_handler::op1_range): Ditto.
	(range_op_handler::op2_range): Ditto.
2022-09-29 18:34:18 -04:00
Andrew MacLeod
845ee38e9b Remove undefined behaviour from testscase.
There was a patch posted to remove the undefined behaviour from this
testcase, but it appear to never have been applied.

	gcc/teststuite/
	PR tree-optimization/102892
	* gcc.dg/pr102892-1.c: Remove undefined behaviour.
2022-09-29 18:34:09 -04:00
Patrick Palka
c2ee70f20d c++: implicit lookup of std::initializer_list [PR102576]
Here the lookup for the implicit use of std::initializer_list fails
because we do it using get_namespace_binding, which isn't import aware.
Fix this by using lookup_qualified_name instead.

	PR c++/102576

gcc/cp/ChangeLog:

	* pt.cc (listify): Use lookup_qualified_name instead of
	get_namespace_binding.

gcc/testsuite/ChangeLog:

	* g++.dg/modules/pr102576_a.H: New test.
	* g++.dg/modules/pr102576_b.C: New test.
2022-09-29 16:27:30 -04:00
Jason Merrill
04d54b70fe c++: fix triviality of class with unsatisfied op=
cxx20_pair is trivially copyable because it has a trivial copy constructor
and only a deleted copy assignment operator; the non-triviality of the
unsatisfied copy assignment overload is not considered.

gcc/cp/ChangeLog:

	* class.cc (check_methods): Call constraints_satisfied_p.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp2a/cond-triv3.C: New test.
2022-09-29 15:11:44 -04:00
François Dumont
13337ea9a1 libstdc++: [_GLIBCXX_INLINE_VERSION] Add gdb pretty print for _GLIBCXX_DEBUG
In _GLIBCXX_DEBUG mode containers are in std::__debug namespace but not template
parameters. In _GLIBCXX_INLINE_VERSION mode most types are in std::__8 namespace but
not std::__debug containers. We need to register specific type printers for this
combination.

libstdc++-v3/ChangeLog:

	* python/libstdcxx/v6/printers.py (add_one_template_type_printer): Register
	printer for types in std::__debug namespace with template parameters in std::__8
	namespace.
2022-09-29 20:41:37 +02:00
Olivier Hainque
61762797ba Improve comments and INITFINI macro use in vxcrtsutff.c
This change augments the comment attached to the use of auto-host.h
in vxcrtstuff.c to better describe the reason for including it and
for the associated series of #undef directives.

It also augments the comment on dso_handle and removes a redundant
guard on HAVE_INITFINI_ARRAY_SUPPORT for the shared version of the
objects, nested within a section guarded on USE_INITFINI_ARRAY.

2022-09-29  Olivier Hainque  <hainque@adacore.com>

libgcc/
	* config/vxcrtstuff.c: Improve the comment attached to the use
	of auto-host.h and of __dso_handle.  Remove redundant guard on
	HAVE_INITFINI_ARRAY_SUPPORT within a USE_INITFINI_ARRAY section.
2022-09-29 18:02:21 +00:00
Jason Merrill
73d9b0e594 c++: check DECL_INITIAL for constexpr
We were overlooking non-potentially-constant bits in variable initializer
because we didn't walk into DECL_INITIAL.

gcc/cp/ChangeLog:

	* constexpr.cc (potential_constant_expression_1): Look into
	DECL_INITIAL.  Use location wrappers.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp1y/constexpr-local4.C: Expect error sooner.
	* g++.dg/cpp2a/consteval24.C: Likewise.
	* g++.dg/cpp2a/consteval7.C: Likewise.
	* g++.dg/cpp2a/inline-asm3.C: Likewise.
2022-09-29 13:50:54 -04:00
Jason Merrill
bbdb5612f6 c++: fix class-valued ?: extension
When the gimplifier encounters the same TARGET_EXPR twice, it evaluates
TARGET_EXPR_INITIAL the first time and clears it so that the later
evaluation is just the temporary.  With this testcase, using the extension
to treat an omitted middle operand as repeating the first operand, that led
to doing a bitwise copy of the S(1) temporary on return rather than properly
calling the copy constructor.

We can't use S(1) to initialize the return value here anyway, because we
need to materialize it into a temporary so we can convert it to bool and
determine which arm we're evaluating.  So let's just treat the middle
operand as an xvalue.

	PR c++/93046

gcc/cp/ChangeLog:

	* call.cc (build_conditional_expr): For a?:c extension, treat
	a reused class prvalue as an xvalue.

gcc/testsuite/ChangeLog:

	* g++.dg/ext/cond4.C: Add runtime test.
2022-09-29 13:50:03 -04:00
Jason Merrill
32b2eb59fb c++: reduce temporaries in ?:
When the sides of ?: are class prvalues, we wrap the COND_EXPR in a
TARGET_EXPR so that both sides will initialize the same temporary.  But in
this case we were stripping the outer TARGET_EXPR and conditionally creating
different temporaries, unnecessarily using extra stack.  The
recently added TARGET_EXPR_NO_ELIDE flag avoids this.

gcc/cp/ChangeLog:

	* call.cc (build_conditional_expr): Set TARGET_EXPR_NO_ELIDE on the
	outer TARGET_EXPR.

gcc/testsuite/ChangeLog:

	* g++.dg/tree-ssa/cond-temp1.C: New test.
2022-09-29 13:48:20 -04:00
Andrew Stubbs
af9034827e amdgcn: remove unused variable
This was left over from a previous version of the SIMD clone patch.

gcc/ChangeLog:

	* config/gcn/gcn.cc (gcn_simd_clone_compute_vecsize_and_simdlen):
	Remove unused elt_bits variable.
2022-09-29 17:26:07 +01:00
Olivier Hainque
cc09a9cf4d Comment about HAVE_INITFINI_ARRAY_SUPPORT in vxworks.h
Explain that we rely on compiler .c files
to include auto-host.h before target configuration headers.

2022-09-29  Olivier Hainque  <hainque@adacore.com>

gcc/
	* config/vxworks.h: Add comment on our use of
	HAVE_INITFINI_ARRAY_SUPPORT.
2022-09-29 15:10:57 +00:00
Olivier Hainque
64d6440ee7 Add an mcmodel=large multilib for aarch64-vxworks
This makes good sense in general anyway, and in particular
with forthcoming support for shared shared libraries, which will
work for mrtp alone but not yet for mrtp+mcmodel=large.

2022-09-29  Olivier Hainque  <hainque@adacore.com>

gcc/
	* config/aarch64/t-aarch64-vxworks: Request multilib
	variants for mcmodel=large.
2022-09-29 14:58:58 +00:00
Olivier Hainque
77ce3fbfc8 Remove TARGET_FLOAT128_ENABLE_TYPE setting for VxWorks
We have, in vxworks.h:

 /* linux64.h enables this, not supported in vxWorks.  */
 #undef TARGET_FLOAT128_ENABLE_TYPE
 #define TARGET_FLOAT128_ENABLE_TYPE 0

We inherit linux64.h for a few reasons, but don't really support
float128 for vxworks, so the setting made sense.

Many tests rely on the linux default (1) though, so resetting is
causing lots of failures on compilation tests that would pass otherwise.

Not resetting lets users write code declaring floa128
objects but linking will typically fail at some point, so
there's no real adverse effect.

Bottom line is we don't have any particular incentive to alter
the default, whatever the default, so better leave the parameter
alone.

2022-09-29  Olivier Hainque  <hainque@adacore.com>

gcc/
	* config/rs6000/vxworks.h (TARGET_FLOAT128_ENABLE_TYPE): Remove
	resetting to 0.
2022-09-29 14:58:46 +00:00
Olivier Hainque
2813f529ab Robustify DWARF2_UNWIND_INFO handling in vx-common.h
This adjusts vx-common.h to #define DWARF2_UNWIND_INFO to 0
when ARM_UNWIND_INFO is set, preventing defaults.h from
possibly setting DWARF2_UNWIND_INFO to 1 (as well) on its own
afterwards if the macro isn't defined.

2022-09-29  Olivier Hainque  <hainque@adacore.com>

gcc/
	* config/vx-common.h (DWARF2_UNWIND_INFO): #define to 0
	when ARM_UNWIND_INFO is set.
2022-09-29 14:39:10 +00:00
Julian Brown
8ace67ddb9 OpenACC: whole struct vs. component mappings (PR107028)
This patch fixes an ICE when both a complete struct variable and
components of that struct are mapped on the same directive for OpenACC,
using a modified version of the scheme used for OpenMP in the following
patch:

  https://gcc.gnu.org/pipermail/gcc-patches/2022-September/601558.html

A new function has been added to make sure that the mapping kinds of
the whole struct and the member access are compatible -- conservatively,
so as not to copy more to/from the device than the user expects.

This version of the patch uses a different method to detect duplicate
clauses for OpenACC in oacc_resolve_clause_dependencies, and removes
the now-redundant check in omp_accumulate_sibling_lists.  (The latter
check would no longer trigger when we map the whole struct on the same
directive because the component-mapping clauses are now deleted before
the check is executed.)

2022-09-28  Julian Brown  <julian@codesourcery.com>

gcc/
	PR middle-end/107028
	* gimplify.cc (omp_check_mapping_compatibility,
	oacc_resolve_clause_dependencies): New functions.
	(omp_accumulate_sibling_list): Remove redundant duplicate clause
	detection for OpenACC.
	(build_struct_sibling_lists): Skip deleted groups.  Don't build sibling
	list for struct variables that are fully mapped on the same directive
	for OpenACC.
	(gimplify_scan_omp_clauses): Call oacc_resolve_clause_dependencies.

gcc/testsuite/
	PR middle-end/107028
	* c-c++-common/goacc/struct-component-kind-1.c: New test.
	* g++.dg/goacc/pr107028-1.C: New test.
	* g++.dg/goacc/pr107028-2.C: New test.
	* gfortran.dg/goacc/mapping-tests-5.f90: New test.
2022-09-29 13:53:27 +00:00
Patrick Palka
9ca1471540 c++: implement __remove_cv, __remove_reference and __remove_cvref
This implements builtins for std::remove_cv, std::remove_reference and
std::remove_cvref using TRAIT_TYPE from the previous patch.

gcc/c-family/ChangeLog:

	* c-common.cc (c_common_reswords): Add __remove_cv,
	__remove_reference and __remove_cvref.
	* c-common.h (enum rid): Add RID_REMOVE_CV, RID_REMOVE_REFERENCE
	and RID_REMOVE_CVREF.

gcc/cp/ChangeLog:

	* constraint.cc (diagnose_trait_expr): Handle CPTK_REMOVE_CV,
	CPTK_REMOVE_REFERENCE and CPTK_REMOVE_CVREF.
	* cp-objcp-common.cc (names_builtin_p): Likewise.
	* cp-tree.h (enum cp_trait_kind): Add CPTK_REMOVE_CV,
	CPTK_REMOVE_REFERENCE and CPTK_REMOVE_CVREF.
	* cxx-pretty-print.cc (pp_cxx_trait): Handle CPTK_REMOVE_CV,
	CPTK_REMOVE_REFERENCE and CPTK_REMOVE_CVREF.
	* parser.cc (cp_keyword_starts_decl_specifier_p): Return true
	for RID_REMOVE_CV, RID_REMOVE_REFERENCE and RID_REMOVE_CVREF.
	(cp_parser_trait): Handle RID_REMOVE_CV, RID_REMOVE_REFERENCE
	and RID_REMOVE_CVREF.
	(cp_parser_simple_type_specifier): Likewise.
	* semantics.cc (finish_trait_type): Likewise.

libstdc++-v3/ChangeLog:

	* include/bits/unique_ptr.h (unique_ptr<_Tp[], _Dp>): Remove
	__remove_cv and use __remove_cv_t instead.

gcc/testsuite/ChangeLog:

	* g++.dg/ext/has-builtin-1.C: Test existence of __remove_cv,
	__remove_reference and __remove_cvref.
	* g++.dg/ext/remove_cv.C: New test.
	* g++.dg/ext/remove_reference.C: New test.
	* g++.dg/ext/remove_cvref.C: New test.
2022-09-29 09:18:40 -04:00
Patrick Palka
817e878a31 c++: introduce TRAIT_TYPE alongside TRAIT_EXPR
We already have generic support for predicate-like traits that yield a
boolean value via TRAIT_EXPR, but we lack the same support for traits
that yield a type instead of a value.  Such support would streamline
implementing efficient builtins for the standard library type traits.

To that end this patch implements a generic TRAIT_TYPE type alongside
TRAIT_EXPR, and reimplements the existing UNDERLYING_TYPE builtin trait
using this new TRAIT_TYPE.

gcc/cp/ChangeLog:

	* cp-objcp-common.cc (cp_common_init_ts): Replace
	UNDERLYING_TYPE with TRAIT_TYPE.
	* cp-tree.def (TRAIT_TYPE): Define.
	(UNDERLYING_TYPE): Remove.
	* cp-tree.h (TRAIT_TYPE_KIND_RAW): Define.
	(TRAIT_TYPE_KIND): Define.
	(TRAIT_TYPE_TYPE1): Define.
	(TRAIT_TYPE_TYPE2): Define.
	(WILDCARD_TYPE_P): Return true for TRAIT_TYPE.
	(finish_trait_type): Declare.
	* cxx-pretty-print.cc (cxx_pretty_printer::primary_expression):
	Adjust after renaming pp_cxx_trait_expression.
	(cxx_pretty_printer::simple_type_specifier) <case TRAIT_TYPE>:
	New.
	(cxx_pretty_printer::type_id): Replace UNDERLYING_TYPE with
	TRAIT_TYPE.
	(pp_cxx_trait_expression): Rename to ...
	(pp_cxx_trait): ... this.  Handle TRAIT_TYPE as well.  Correct
	pretty printing of the trailing arguments.
	* cxx-pretty-print.h (pp_cxx_trait_expression): Rename to ...
	(pp_cxx_trait_type): ... this.
	* error.cc (dump_type) <case UNDERLYING_TYPE>: Remove.
	<case TRAIT_TYPE>: New.
	(dump_type_prefix): Replace UNDERLYING_WITH with TRAIT_TYPE.
	(dump_type_suffix): Likewise.
	* mangle.cc (write_type) <case UNDERLYING_TYPE>: Remove.
	<case TRAIT_TYPE>: New.
	* module.cc (trees_out::type_node) <case UNDERLYING_TYPE>:
	Remove.
	<case TRAIT_TYPE>: New.
	(trees_in::tree_node): Likewise.
	* parser.cc (cp_parser_primary_expression): Adjust after
	renaming cp_parser_trait_expr.
	(cp_parser_trait_expr): Rename to ...
	(cp_parser_trait): ... this.  Call finish_trait_type for traits
	that yield a type.
	(cp_parser_simple_type_specifier): Adjust after renaming
	cp_parser_trait_expr.
	* pt.cc (for_each_template_parm_r) <case UNDERLYING_TYPE>:
	Remove.
	<case TRAIT_TYPE>: New.
	(tsubst): Likewise.
	(unify): Replace UNDERLYING_TYPE with TRAIT_TYPE.
	(dependent_type_p_r): Likewise.
	* semantics.cc (finish_underlying_type): Don't return
	UNDERLYING_TYPE anymore when processing_template_decl.
	(finish_trait_type): Define.
	* tree.cc (strip_typedefs) <case UNDERLYING_TYPE>: Remove.
	<case TRAIT_TYPE>: New.
	(cp_walk_subtrees): Likewise.
	* typeck.cc (structural_comptypes): Likewise.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/alias-decl-59.C: Adjust expected error message.
	* g++.dg/ext/underlying_type7.C: Likewise.
	* g++.dg/ext/underlying_type13.C: New test.
	* g++.dg/ext/underlying_type14.C: New test.
2022-09-29 09:18:11 -04:00
Jonathan Wakely
df7f273650 libstdc++: Guard use of new built-in with __has_builtin
I forgot that non-GCC compilers don't have this built-in yet.

For Clang we could do something like the check below (as described in
P2255), but for now I'm just fixing the regression.

 #if __has_builtin((__reference_binds_to_temporary)
  bool _Dangle = __reference_binds_to_temporary(_Tp, _Res_t)
                 && __and_<is_reference<_Tp>,
                           __not_<is_reference<_Res_t>>,
                           is_convertible<__remove_cvref_t<_Res_t>*,
                                          __remove_cvref_t<_Tp>*>>::value
 #endif

libstdc++-v3/ChangeLog:

	* include/std/type_traits (__is_invocable_impl): Check
	__has_builtin(__reference_converts_from_temporary) before using
	built-in.
2022-09-29 12:47:37 +01:00
Nathan Sidwell
a1f7f9541c c++: import/export NTTP objects
This adds smarts to the module machinery to handle NTTP object
VAR_DECLs.  Like typeinfo objects, these must be ignored in the symbol
table, streamed specially and recreated on stream in.

	gcc/cp/
	PR c++/100616
	* module.cc (enum tree_tag): Add tt_nttp_var.
	(trees_out::decl_node): Handle NTTP objects.
	(trees_in::tree_node): Handle tt_nttp_var.
	(depset:#️⃣:add_binding_entry): Skip NTTP objects.

	gcc/testsuite/
	PR c++/100616
	* g++.dg/modules/100616_a.H: New.
	* g++.dg/modules/100616_b.C: New.
	* g++.dg/modules/100616_c.C: New.
	* g++.dg/modules/100616_d.C: New.
2022-09-29 04:41:59 -07:00
Jose E. Marchesi
a0aafbc324 place `const volatile' objects in read-only sections
It is common for C BPF programs to use variables that are implicitly
set by the BPF loader and run-time.  It is also necessary for these
variables to be stored in read-only storage so the BPF verifier
recognizes them as such.  This leads to declarations using both
`const' and `volatile' qualifiers, like this:

  const volatile unsigned char is_allow_list = 0;

Where `volatile' is used to avoid the compiler to optimize out the
variable, or turn it into a constant, and `const' to make sure it is
placed in .rodata.

Now, it happens that:

- GCC places `const volatile' objects in the .data section, under the
  assumption that `volatile' somehow voids the `const'.

- LLVM places `const volatile' objects in .rodata, under the
  assumption that `volatile' is orthogonal to `const'.

So there is a divergence, that has practical consequences: it makes
BPF programs compiled with GCC to not work properly.

When looking into this, I found this bugzilla:

  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25521
  "change semantics of const volatile variables"

which was filed back in 2005, long ago.  This report was already
asking to put `const volatile' objects in .rodata, questioning the
current behavior.

While discussing this in the #gcc IRC channel I was pointed out to the
following excerpt from the C18 spec:

   6.7.3 Type qualifiers / 5 The properties associated with qualified
         types are meaningful only for expressions that are
         lval-values [note 135]

   135) The implementation may place a const object that is not
        volatile in a read-only region of storage. Moreover, the
        implementation need not allocate storage for such an object if
        its $ address is never used.

This footnote may be interpreted as if const objects that are volatile
shouldn't be put in read-only storage.  Even if I personally was not
very convinced of that interpretation (see my earlier comment in BZ
25521) I filed the following issue in the LLVM tracker in order to
discuss the matter:

  https://github.com/llvm/llvm-project/issues/56468

As you can see, Aaron Ballman, one of the LLVM hackers, asked the WG14
reflectors about this.  He reported that the reflectors don't think
footnote 135 has any normative value.

So, not having a normative mandate on either direction, there are two
options:

a) To change GCC to place `const volatile' objects in .rodata instead
   of .data.

b) To change LLVM to place `const volatile' objects in .data instead
   of .rodata.

Considering that:

- One target (bpf-unknown-none) breaks with the current GCC behavior.

- No target/platform relies on the GCC behavior, that we know.

- Changing the LLVM behavior at this point would be very severely
  traumatic for the BPF people and their users.

I think the right thing to do at this point is a).
Therefore this patch.

Regtested in x86_64-linux-gnu and bpf-unknown-none.
No regressions observed.

gcc/ChangeLog:

	PR middle-end/25521
	* varasm.cc (categorize_decl_for_section): Place `const volatile'
	objects in read-only sections.
	(default_select_section): Likewise.

gcc/testsuite/ChangeLog:

	PR middle-end/25521
	* lib/target-supports.exp (check_effective_target_elf): Define.
	* gcc.dg/pr25521.c: New test.
2022-09-29 12:39:04 +02:00
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