Commit Graph

188995 Commits

Author SHA1 Message Date
Jonathan Wakely
0fac85a24f libstdc++: Remove constraints from std::optional monadic ops [PR102863]
The constraints on transform and and_then can cause errors when checking
satisfaction. The constraints that were present in R6 of the paper were
moved for he final F8 revision, and so should have been included in the
implementation.

libstdc++-v3/ChangeLog:

	PR libstdc++/102863
	* include/std/optional (optional::and_then, optional::transform):
	Remove requires-clause.
	* testsuite/20_util/optional/monadic/and_then.cc: Check
	overload resolution doesn't cause errors.
	* testsuite/20_util/optional/monadic/transform.cc: Likewise.
2021-10-21 01:23:22 +01:00
GCC Administrator
674dda6be0 Daily bump. 2021-10-21 00:16:29 +00:00
Jason Merrill
1c69016466 c++: tweak parsing of invalid types
cp_parser_parse_and_diagnose_invalid_type_name is called during declaration
parsing, so it should pass 'true' for the declarator_p argument.  But that
caused a diagnostic regression on template/pr84789.C due to undesired lookup
in dependent scopes.  To fix that, cp_parser_nested_name_specifier_opt needs
to respect the value of check_dependency_p.

This patch avoids a regression from Andrew Sharp's WIP patch for PR70417.

It would make more sense to test only check_dependency_p, not declarator_p,
but removing the declarator_p condition turns out to reveal complicated
interactions of cp_parser_constructor_declarator_p and caching of
nested-name-specifiers and template-ids that I've already spent too much
time trying to sort out.

gcc/cp/ChangeLog:

	* parser.c (cp_parser_parse_and_diagnose_invalid_type_name):
	Pass true for declarator_p.
	(cp_parser_nested_name_specifier_opt): Only look through
	TYPENAME_TYPE if check_dependency_p is false.
2021-10-20 17:40:13 -04:00
Alex Coplan
788483f77d calls.c: Remove some dead code and target hooks
Looking at calls.c:initialize_argument_information, I spotted some dead
code that seems to have been left behind from when MPX support was
removed.

This change removes that code as well as the associated target hooks
(which appear to be unused).

gcc/ChangeLog:

	* calls.c (initialize_argument_information): Remove some dead
	code, remove handling for function_arg returning const_int.
	* doc/tm.texi: Delete documentation for unused target hooks.
	* doc/tm.texi.in: Likewise.
	* target.def (load_bounds_for_arg): Delete.
	(store_bounds_for_arg): Delete.
	(load_returned_bounds): Delete.
	(store_returned_bounds): Delete.
	* targhooks.c (default_load_bounds_for_arg): Delete.
	(default_store_bounds_for_arg): Delete.
	(default_load_returned_bounds): Delete.
	(default_store_returned_bounds): Delete.
	* targhooks.h (default_load_bounds_for_arg): Delete.
	(default_store_bounds_for_arg): Delete.
	(default_load_returned_bounds): Delete.
	(default_store_returned_bounds): Delete.
2021-10-20 21:02:52 +01:00
Jonathan Wakely
4ba4b05315 libstdc++: Add missing test for std::optional::transform(F&&)
The test_copy_elision() function was supposed to ensure that the result
is constructed directly in the std::optional, without early temporary
materialization. But I forgot to write the test.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/optional/monadic/transform.cc: Check that
	an rvalue result is not materialized too soon.
2021-10-20 20:20:18 +01:00
Jonathan Wakely
154c6d430e doc: Fix documentation around 'asm' keyword in C++
The documentation on asm statements suggests asm is always a GNU
extension, but it's been part of ISO C++ since the first standard.

The documentation of -fno-asm is wrong for C++ as it states that it only
affects typeof, but actually it affects typeof and asm (despite asm
being part of ISO C++).

gcc/ChangeLog:

	* doc/extend.texi (Basic Asm): Clarify that asm is not an
	extension in C++.
	* doc/invoke.texi (-fno-asm): Fix description for C++.
2021-10-20 19:42:28 +01:00
Jonathan Wakely
885f9b4ad5 doc: Remove broken link to old.html docs
The target of this link was removed in r12-1061.

gcc/ChangeLog:

	* doc/install.texi: Remove link to old.html
2021-10-20 19:42:22 +01:00
Tamar Christina
3db4440d4c AArch64: Combine cmeq 0 + not into cmtst
This turns a bitwise inverse of an equality comparison with 0 into a compare of
bitwise nonzero (cmtst).

We already have one pattern for cmsts, this adds an additional one which does
not require an additional bitwise and.

i.e.

#include <arm_neon.h>

uint8x8_t bar(int16x8_t abs_row0, int16x8_t row0) {
  uint16x8_t row0_diff =
    vreinterpretq_u16_s16(veorq_s16(abs_row0, vshrq_n_s16(row0, 15)));
  uint8x8_t abs_row0_gt0 =
    vmovn_u16(vcgtq_u16(vreinterpretq_u16_s16(abs_row0), vdupq_n_u16(0)));
  return abs_row0_gt0;
}

now generates:

bar:
        cmtst   v0.8h, v0.8h, v0.8h
        xtn     v0.8b, v0.8h
        ret

instead of:

bar:
        cmeq    v0.8h, v0.8h, #0
        not     v0.16b, v0.16b
        xtn     v0.8b, v0.8h
        ret

gcc/ChangeLog:

	* config/aarch64/aarch64-simd.md (*aarch64_cmtst_same_<mode>): New.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/mvn-cmeq0-1.c: New test.
2021-10-20 17:11:52 +01:00
Tamar Christina
52da40ffe2 AArch64: Add pattern xtn+xtn2 to uzp1
This turns truncate operations with a hi/lo pair into a single permute of half
the bit size of the input and just ignoring the top bits (which are truncated
out).

i.e.

void d2 (short * restrict a, int *b, int n)
{
    for (int i = 0; i < n; i++)
      a[i] = b[i];
}

now generates:

.L4:
        ldp     q0, q1, [x3]
        add     x3, x3, 32
        uzp1    v0.8h, v0.8h, v1.8h
        str     q0, [x5], 16
        cmp     x4, x3
        bne     .L4

instead of

.L4:
        ldp     q0, q1, [x3]
        add     x3, x3, 32
        xtn     v0.4h, v0.4s
        xtn2    v0.8h, v1.4s
        str     q0, [x5], 16
        cmp     x4, x3
        bne     .L4

gcc/ChangeLog:

	* config/aarch64/aarch64-simd.md (*aarch64_narrow_trunc<mode>): New.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/narrow_high_combine.c: Update case.
	* gcc.target/aarch64/xtn-combine-1.c: New test.
	* gcc.target/aarch64/xtn-combine-2.c: New test.
	* gcc.target/aarch64/xtn-combine-3.c: New test.
	* gcc.target/aarch64/xtn-combine-4.c: New test.
	* gcc.target/aarch64/xtn-combine-5.c: New test.
	* gcc.target/aarch64/xtn-combine-6.c: New test.
2021-10-20 17:10:25 +01:00
Tamar Christina
ea464fd2d4 AArch64: Add pattern for sshr to cmlt
This optimizes signed right shift by BITSIZE-1 into a cmlt operation which is
more optimal because generally compares have a higher throughput than shifts.

On AArch64 the result of the shift would have been either -1 or 0 which is the
results of the compare.

i.e.

void e (int * restrict a, int *b, int n)
{
    for (int i = 0; i < n; i++)
      b[i] = a[i] >> 31;
}

now generates:

.L4:
        ldr     q0, [x0, x3]
        cmlt    v0.4s, v0.4s, #0
        str     q0, [x1, x3]
        add     x3, x3, 16
        cmp     x4, x3
        bne     .L4

instead of:

.L4:
        ldr     q0, [x0, x3]
        sshr    v0.4s, v0.4s, 31
        str     q0, [x1, x3]
        add     x3, x3, 16
        cmp     x4, x3
        bne     .L4

Thanks,
Tamar

gcc/ChangeLog:

	* config/aarch64/aarch64-simd.md (aarch64_simd_ashr<mode>): Add case cmp
	case.
	* config/aarch64/constraints.md (D1): New.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/shl-combine-2.c: New test.
	* gcc.target/aarch64/shl-combine-3.c: New test.
	* gcc.target/aarch64/shl-combine-4.c: New test.
	* gcc.target/aarch64/shl-combine-5.c: New test.
2021-10-20 17:09:00 +01:00
Tamar Christina
41812e5e35 AArch64: Add combine patterns for narrowing shift of half top bits (shuffle)
When doing a (narrowing) right shift by half the width of the original type then
we are essentially shuffling the top bits from the first number down.

If we have a hi/lo pair we can just use a single shuffle instead of needing two
shifts.

i.e.

typedef short int16_t;
typedef unsigned short uint16_t;

void foo (uint16_t * restrict a, int16_t * restrict d, int n)
{
    for( int i = 0; i < n; i++ )
      d[i] = (a[i] * a[i]) >> 16;
}

now generates:

.L4:
        ldr     q0, [x0, x3]
        umull   v1.4s, v0.4h, v0.4h
        umull2  v0.4s, v0.8h, v0.8h
        uzp2    v0.8h, v1.8h, v0.8h
        str     q0, [x1, x3]
        add     x3, x3, 16
        cmp     x4, x3
        bne     .L4

instead of

.L4:
        ldr     q0, [x0, x3]
        umull   v1.4s, v0.4h, v0.4h
        umull2  v0.4s, v0.8h, v0.8h
        sshr    v1.4s, v1.4s, 16
        sshr    v0.4s, v0.4s, 16
        xtn     v1.4h, v1.4s
        xtn2    v1.8h, v0.4s
        str     q1, [x1, x3]
        add     x3, x3, 16
        cmp     x4, x3
        bne     .L4

Thanks,
Tamar

gcc/ChangeLog:

	* config/aarch64/aarch64-simd.md
	(*aarch64_<srn_op>topbits_shuffle<mode>_le): New.
	(*aarch64_topbits_shuffle<mode>_le): New.
	(*aarch64_<srn_op>topbits_shuffle<mode>_be): New.
	(*aarch64_topbits_shuffle<mode>_be): New.
	* config/aarch64/predicates.md
	(aarch64_simd_shift_imm_vec_exact_top): New.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/shrn-combine-10.c: New test.
	* gcc.target/aarch64/shrn-combine-5.c: New test.
	* gcc.target/aarch64/shrn-combine-6.c: New test.
	* gcc.target/aarch64/shrn-combine-7.c: New test.
	* gcc.target/aarch64/shrn-combine-8.c: New test.
	* gcc.target/aarch64/shrn-combine-9.c: New test.
2021-10-20 17:07:54 +01:00
Tamar Christina
e33aef11e1 aarch64: Add combine patterns for right shift and narrow
This adds a simple pattern for combining right shifts and narrows into
shifted narrows.

i.e.

typedef short int16_t;
typedef unsigned short uint16_t;

void foo (uint16_t * restrict a, int16_t * restrict d, int n)
{
    for( int i = 0; i < n; i++ )
      d[i] = (a[i] * a[i]) >> 10;
}

now generates:

.L4:
        ldr     q0, [x0, x3]
        umull   v1.4s, v0.4h, v0.4h
        umull2  v0.4s, v0.8h, v0.8h
        shrn    v1.4h, v1.4s, 10
        shrn2   v1.8h, v0.4s, 10
        str     q1, [x1, x3]
        add     x3, x3, 16
        cmp     x4, x3
        bne     .L4

instead of:

.L4:
        ldr     q0, [x0, x3]
        umull   v1.4s, v0.4h, v0.4h
        umull2  v0.4s, v0.8h, v0.8h
        sshr    v1.4s, v1.4s, 10
        sshr    v0.4s, v0.4s, 10
        xtn     v1.4h, v1.4s
        xtn2    v1.8h, v0.4s
        str     q1, [x1, x3]
        add     x3, x3, 16
        cmp     x4, x3
        bne     .L4

Thanks,
Tamar

gcc/ChangeLog:

	* config/aarch64/aarch64-simd.md (*aarch64_<srn_op>shrn<mode>_vect,
	*aarch64_<srn_op>shrn<mode>2_vect_le,
	*aarch64_<srn_op>shrn<mode>2_vect_be): New.
	* config/aarch64/iterators.md (srn_op): New.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/shrn-combine-1.c: New test.
	* gcc.target/aarch64/shrn-combine-2.c: New test.
	* gcc.target/aarch64/shrn-combine-3.c: New test.
	* gcc.target/aarch64/shrn-combine-4.c: New test.
2021-10-20 17:06:31 +01:00
Chung-Lin Tang
d98626bf45 openmp: in_reduction support for Fortran
This patch implements support for the in_reduction clause for Fortran.
It also includes more completion of the taskgroup construct inside the
Fortran front-end, thus allowing task_reduction to work for task and
target constructs.

gcc/fortran/ChangeLog:

	* openmp.c (gfc_match_omp_clause_reduction): Add 'openmp_target' default
	false parameter. Add 'always,tofrom' map for OMP_LIST_IN_REDUCTION case.
	(gfc_match_omp_clauses): Add 'openmp_target' default false parameter,
	adjust call to gfc_match_omp_clause_reduction.
	(match_omp): Adjust call to gfc_match_omp_clauses
	* trans-openmp.c (gfc_trans_omp_taskgroup): Add call to
	gfc_match_omp_clause, create and return block.

gcc/ChangeLog:

	* omp-low.c (omp_copy_decl_2): For !ctx, use record_vars to add new copy
	as local variable.
	(scan_sharing_clauses): Place copy of OMP_CLAUSE_IN_REDUCTION decl in
	ctx->outer instead of ctx.

gcc/testsuite/ChangeLog:

	* gfortran.dg/gomp/reduction4.f90: Adjust omp target in_reduction' scan
	pattern.

libgomp/ChangeLog:

	* testsuite/libgomp.fortran/target-in-reduction-1.f90: New test.
	* testsuite/libgomp.fortran/target-in-reduction-2.f90: New test.
2021-10-20 23:25:02 +08:00
H.J. Lu
90454a9008 libffi: Update ChangeLog.libffi for libffi 3.4.2
* ChangeLog.libffi: Copied from ChangeLog.old in libffi 3.4.2.
2021-10-20 05:51:33 -07:00
Martin Liska
39175be0fa Revert "target: support spaces in target attribute."
This reverts commit df592811f9.
2021-10-20 14:49:35 +02:00
Martin Liska
85d7543a22 Revert "target: Support whitespaces in target attr/pragma."
This reverts commit 6b34f5c5ec.
2021-10-20 14:49:12 +02:00
H.J. Lu
fe8ddf855e libffi: Add LOCAL_PATCHES
* LOCAL_PATCHES: New file.
2021-10-20 05:40:33 -07:00
Wilco Dijkstra
9c751b88de AArch64: Tune case-values-threshold
Tune the case-values-threshold setting for modern cores.  A value of 11 improves
SPECINT2017 by 0.2% and reduces codesize by 0.04%.  With -Os use value 8 which
reduces codesize by 0.07%.

2021-10-18  Wilco Dijkstra  <wdijkstr@arm.com>

gcc/
	* config/aarch64/aarch64.c (aarch64_case_values_threshold):
	Change to 8 with -Os, 11 otherwise.
2021-10-20 13:38:12 +01:00
Wilco Dijkstra
c437d3340d AArch64: Enable fast shifts on Neoverse V1/N2
Enable the fast shift feature in Neoverse V1 and N2 tunings as well.

2021-10-20  Wilco Dijkstra  <wdijkstr@arm.com>

gcc/
	* config/aarch64/aarch64.c (neoversev1_tunings):
	Enable AARCH64_EXTRA_TUNE_CHEAP_SHIFT_EXTEND.
	(neoversen2_tunings): Likewise.
2021-10-20 13:38:12 +01:00
Wilco Dijkstra
16ce822ed1 AArch64: Add support for __builtin_roundeven[f] (PR100966)
Enable __builtin_roundeven[f] by changing existing frintn to roundeven.

2021-10-20  Wilco Dijkstra  <wdijkstr@arm.com>

gcc/
	PR target/100966
	* config/aarch64/aarch64.md (frint_pattern): Update comment.
	* config/aarch64/aarch64-simd-builtins.def: Change frintn to roundeven.
	* config/aarch64/arm_fp16.h: Change frintn to roundeven.
	* config/aarch64/arm_neon.h: Likewise.
	* config/aarch64/iterators.md (frint_pattern): Use roundeven for FRINTN.

gcc/testsuite/
	PR target/100966
	* gcc.target/aarch64/frint.x: Add roundeven tests.
	* gcc.target/aarch64/frint_double.c: Likewise.
	* gcc.target/aarch64/frint_float.c: Likewise.
2021-10-20 13:38:12 +01:00
H.J. Lu
4824ed41ba libffi: Integrate testsuite with GCC testsuite
* testsuite/lib/libffi.exp (load_gcc_lib): Load library from GCC
	testsuite.
	Load target-supports.exp and target-supports-dg.exp.
	(libffi-init): Use libraries in GCC build tree.
	(libffi_target_compile): Link with -shared-libgcc -lstdc++ for
	C++ sources.
2021-10-20 05:35:52 -07:00
H.J. Lu
5be7b66998 libffi: Integrate build with GCC
1. Integrate with GCC build.
2. Disable static trampolines by default.
3. Support multilib.

	* Makefile.am (AUTOMAKE_OPTIONS): Add info-in-builddir.
	(ACLOCAL_AMFLAGS): Set to -I .. -I ../config.
	(SUBDIRS): Don't add doc.
	(TEXINFO_TEX): New.
	(MAKEINFOFLAGS): Likewise.
	(info_TEXINFOS): Likewise.
	(STAMP_GENINSRC): Likewise.
	(STAMP_BUILD_INFO): Likewise.
	(all-local): Likewise.
	(stamp-geninsrc): Likewise.
	(doc/libffi.info): Likewise.
	(stamp-build-info:): Likewise.
	(CLEANFILES): Likewise.
	(MAINTAINERCLEANFILES): Likewise.
	(AM_MAKEFLAGS): Likewise.
	(all-recursive): Likewise.
	(install-recursive): Likewise.
	(mostlyclean-recursive): Likewise.
	(clean-recursive): Likewise.
	(distclean-recursive): Likewise.
	(maintainer-clean-recursive): Likewise.
	(LTLDFLAGS): Replace libtool-ldflags with ../libtool-ldflags.
	(AM_CFLAGS): Add -g -fexceptions.
	(libffi.map-sun): Replace make_sunver.pl with
	../contrib/make_sunver.pl.
	(dist-hook): Removed.
	Include $(top_srcdir)/../multilib.am.
	* configure.ac: Add AM_ENABLE_MULTILIB.
	Remove the frv*-elf check.
	(AX_ENABLE_BUILDDIR): Removed.
	(AM_INIT_AUTOMAKE): Add [no-dist].
	Add --enable-generated-files-in-srcdir.
	(C_CONFIG_MACRO_DIR): Removed.
	(AX_COMPILER_VENDOR): Likewise.
	(AX_CC_MAXOPT): Likewise.
	(AX_CFLAGS_WARN_ALL): Likewise.
	Remove the GCC check.
	(SYMBOL_UNDERSCORE): Removed.
	(AX_CHECK_COMPILE_FLAG): Likewise.
	Remove --disable-docs.
	(ACX_CHECK_PROG_VER): Check makeinfo.
	(BUILD_DOCS): Updated.
	(exec-static-tramp): Don't enable use of static exec trampolines
	by default.
	Remove --disable-multi-os-directory.
	(GCC_WITH_TOOLEXECLIBDIR): New.
	Support cross host.
	Support --enable-multilib.
	* include/Makefile.am (nodist_include_HEADERS): Removed.
	(gcc_version): New.
	(toollibffidir): Likewise.
	(toollibffi_HEADERS): Likewise.
	* Makefile.in: Regenerate.
	(GCC_BASE_VER): New.
	(AC_CONFIG_FILES): Remove doc/Makefile.
	(AC_CONFIG_LINKS): New.
	* aclocal.m4: Likewise.
	* configure: Likewise.
	* fficonfig.h.in: Likewise.
	* mdate-sh: Likewise.
	* include/Makefile.in: Likewise.
	* man/Makefile.in: Likewise.
	* testsuite/Makefile.in: Likewise.
2021-10-20 05:35:52 -07:00
H.J. Lu
92456a4e56 libffi: Sync with libffi 3.4.2
Merged commit: f9ea41683444ebe11cfa45b05223899764df28fb
2021-10-20 05:35:52 -07:00
H.J. Lu
d738405e7f libffi: Add HOWTO_MERGE, autogen.sh and merge.sh
Add scripts for syncing with libffi upstream:

1. Clone libffi repo.
2. Checkout the specific commit.
3. Remove the unused files.
4. Add new files and remove old files if needed.

	* HOWTO_MERGE: New file.
	* autogen.sh: Likewise.
	* merge.sh: Likewise.
2021-10-20 05:35:52 -07:00
Martin Liska
7113f1b54d Rename asm_out_file function arguments.
As preparation for a new global object that will encapsulate
asm_out_file, we would need to live with a macro that will
define asm_out_file as casm->out_file and thus the name
can't be used in function arguments.

gcc/ChangeLog:

	* config/arm/arm.c (arm_unwind_emit_sequence): Do not declare
	already declared global variable.
	(arm_unwind_emit_set): Use out_file as function argument.
	(arm_unwind_emit): Likewise.
	* config/darwin.c (machopic_output_data_section_indirection): Likewise.
	(machopic_output_stub_indirection): Likewise.
	(machopic_output_indirection): Likewise.
	(machopic_finish): Likewise.
	* config/i386/i386.c (ix86_asm_output_function_label): Likewise.
	* config/i386/winnt.c (i386_pe_seh_unwind_emit): Likewise.
	* config/ia64/ia64.c (process_epilogue): Likewise.
	(process_cfa_adjust_cfa): Likewise.
	(process_cfa_register): Likewise.
	(process_cfa_offset): Likewise.
	(ia64_asm_unwind_emit): Likewise.
	* config/s390/s390.c (s390_asm_output_function_label): Likewise.
2021-10-20 14:27:49 +02:00
H.J. Lu
25ab851dd3 gcc-changelog: Add libffi/ to ignored_prefixes
Add libffi/ to ignored_prefixes for syncing with libffi upstream:

commit c095f8f2e6f26bfc2ff8e3276c6af23ab153f5ff
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Aug 31 07:14:47 2021 -0700

    libffi: Sync with libffi 3.4.2

    Merged commit: f9ea41683444ebe11cfa45b05223899764df28fb

to avoid

remote: *** The following commit was rejected by your hooks.commit-extra-checker script (status: 1)
remote: *** commit: c095f8f2e6f26bfc2ff8e3276c6af23ab153f5ff
remote: *** ChangeLog format failed:
remote: *** ERR: cannot find a ChangeLog location in message
remote: ***
remote: *** Please see: https://gcc.gnu.org/codingconventions.html#ChangeLogs
remote: ***
remote: error: hook declined to update refs/heads/master

	* gcc-changelog/git_commit.py (ignored_prefixes): Add libffi/.
2021-10-20 05:25:56 -07:00
Andre Simoes Dias Vieira
ad44c6a56c [Patch][GCC][AArch64] - Lower store and load neon builtins to gimple
20-10-2021  Andre Vieira  <andre.simoesdiasvieira@arm.com>
	    Jirui Wu  <jirui.wu@arm.com>
gcc/ChangeLog:

	* config/aarch64/aarch64-builtins.c
	(aarch64_general_gimple_fold_builtin):
	lower vld1 and vst1 variants of the neon builtins
	* config/aarch64/aarch64-protos.h:
	(aarch64_general_gimple_fold_builtin): Add gsi parameter.
	* config/aarch64/aarch64.c (aarch64_general_gimple_fold_builtin):
	Likwise.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/fmla_intrinsic_1.c: prevent over optimization.
	* gcc.target/aarch64/fmls_intrinsic_1.c: Likewise.
	* gcc.target/aarch64/fmul_intrinsic_1.c: Likewise.
	* gcc.target/aarch64/mla_intrinsic_1.c: Likewise.
	* gcc.target/aarch64/mls_intrinsic_1.c: Likewise.
	* gcc.target/aarch64/mul_intrinsic_1.c: Likewise.
	* gcc.target/aarch64/simd/vmul_elem_1.c: Likewise.
	* gcc.target/aarch64/vclz.c: Likewise.
	* gcc.target/aarch64/vneg_s.c: Likewise.
2021-10-20 13:22:27 +01:00
Andre Simoes Dias Vieira
914045dff1 [Patch][GCC][middle-end] - Generate FRINTZ for (double)(int) under -ffast-math on aarch64
20-10-2021  Andre Vieira  <andre.simoesdiasvieira@arm.com>
	    Jirui Wu  <jirui.wu@arm.com>
gcc/ChangeLog:

	* match.pd: Generate IFN_TRUNC.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/merge_trunc1.c: New test.
2021-10-20 13:14:39 +01:00
Richard Biener
ac5e465638 tree-optimization/102853 - avoid trapping types in split_constant_offset
This avoids running into the assert in compute_distributive_range when
starting the analysis with operations in a trapping type.

2021-10-20  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/102853
	* tree-data-ref.c (split_constant_offset_1): Bail out
	immediately if the expression traps on overflow.
2021-10-20 13:48:35 +02:00
Aldy Hernandez
6fca1761a1 Remove unused back_threader destructor.
Tested on x86-64 Linux.

gcc/ChangeLog:

	* tree-ssa-threadbackward.c (back_threader::~back_threader): Remove.
2021-10-20 12:22:55 +02:00
Aldy Hernandez
8b7f9c40ef Remove superflous debugging messages from the threading registry.
These are some random obvious cleanups to the threading dumps, since
it seems I'm not the only one looking at dumps these days.

The "just threaded" debugging message is redundant since there's
already an equivalent "Registering jump thread" message.

The "about to thread" message is actually confusing, because the source
block doesn't match the IL, since the CFG update is mid-flight.

Tested on x86-64 Linux.

gcc/ChangeLog:

	* tree-ssa-threadupdate.c (back_jt_path_registry::adjust_paths_after_duplication):
	Remove superflous debugging message.
	(back_jt_path_registry::duplicate_thread_path): Same.
2021-10-20 12:22:55 +02:00
Bob Duff
18606d7766 [Ada] Remove unnecessary call to No_Uint_To_0
gcc/ada/

	* gcc-interface/decl.c (gnat_to_gnu_entity): Remove unnecessary
	call to No_Uint_To_0.
2021-10-20 10:17:06 +00:00
Richard Kenner
4afb464e1f [Ada] Never treat intrinsic subprograms as nested
gcc/ada/

	* exp_unst.adb (Visit_Node, when N_Subprogram_Call): Never treat
	instrinsic subprograms as nested.
2021-10-20 10:17:06 +00:00
Yannick Moy
bd2560b726 [Ada] Proof of the runtime support for attribute 'Width
gcc/ada/

	* libgnat/s-widlllu.ads: Mark in SPARK.
	* libgnat/s-widllu.ads: Likewise.
	* libgnat/s-widuns.ads: Likewise.
	* libgnat/s-widthu.adb: Add ghost code and a
	pseudo-postcondition.
2021-10-20 10:17:06 +00:00
Yannick Moy
c5742a0e11 [Ada] Provide dummy body for big integers library used in reduced runtimes
gcc/ada/

	* libgnat/a-nbnbin__ghost.adb (Signed_Conversions,
	Unsigned_Conversions): Mark subprograms as not imported.
	* libgnat/a-nbnbin__ghost.ads: Provide a dummy body.
2021-10-20 10:17:06 +00:00
Eric Botcazou
723d09e889 [Ada] Fix problematic conversion of real literal in static context
gcc/ada/

	* sem_eval.adb (Eval_Type_Conversion): If the target subtype is
	a static floating-point subtype and the result is a real literal,
	consider its machine-rounded value to raise Constraint_Error.
	(Test_In_Range): Turn local variables into constants.
2021-10-20 10:17:05 +00:00
Doug Rupp
f6f8b3f95e [Ada] Delete unused runtime files
gcc/ada/

	* libgnat/g-io-put__vxworks.adb: Remove (unused)
	* libgnat/s-parame__ae653.ads: Likewise.
	* libgnat/s-thread.ads: Likewise.
	* libgnat/s-thread__ae653.adb: Likewise.
2021-10-20 10:17:05 +00:00
Eric Botcazou
60440d3cf5 [Ada] Factor out machine rounding operations
gcc/ada/

	* sem_eval.ads (Machine_Number): New inline function.
	* sem_eval.adb (Machine_Number): New function body implementing
	the machine rounding operation specified by RM 4.9(38/2).
	(Check_Non_Static_Context): Call Machine_Number and set the
	Is_Machine_Number flag consistently on the resulting node.
	* sem_attr.adb (Eval_Attribute) <Attribute_Machine>: Likewise.
	* checks.adb (Apply_Float_Conversion_Check): Call Machine_Number.
	(Round_Machine): Likewise.
2021-10-20 10:17:05 +00:00
Johannes Kliemann
931d4819f7 [Ada] Define __wrs_rtp_base in linker spec
gcc/ada/

	* vxworks7-cert-rtp-link.spec: Add the definition of
	__wrs_rtp_base.
2021-10-20 10:17:05 +00:00
Piotr Trojanek
6cf01c9277 [Ada] Reject boxes in delta record aggregates
gcc/ada/

	* sem_aggr.adb (Resolve_Delta_Record_Aggregate): Reject boxes in
	record delta aggregates.
2021-10-20 10:17:05 +00:00
Justin Squirek
50cdd660b2 [Ada] Missing accessibility check when returning discriminated types
gcc/ada/

	* sem_ch6.adb (Check_Return_Construct_Accessibility): Modify
	generation of accessibility checks to be more consolidated and
	get triggered properly in required cases.
	* sem_util.adb (Accessibility_Level): Add extra check within
	condition to handle aliased formals properly in more cases.
2021-10-20 10:17:05 +00:00
Justin Squirek
9267014b35 [Ada] Crash on object of protected type with defaulted access component
gcc/ada/

	* exp_ch7.adb (Make_Final_Call): Detect expanded protected types
	and use original protected type in order to calculate
	appropriate finalization routine.
2021-10-20 10:17:05 +00:00
Johannes Kliemann
0f074aa4aa [Ada] Add ghost code version of Ada.Numerics.Big_Numbers.Big_Integers
gcc/ada/

	* libgnat/a-nbnbin__ghost.ads: Add ghost package.
2021-10-20 10:17:04 +00:00
Piotr Trojanek
2aa814cb27 [Ada] Refine type of a counter function for record delta aggregate
gcc/ada/

	* sem_aggr.adb (Variant_Depth): Refine type from Integer to
	Natural.
2021-10-20 10:17:04 +00:00
Bob Duff
36e3802212 [Ada] tech debt: Clean up Uint fields, such as Esize
gcc/ada/

	* atree.ads: Comment improvements. How is a "completely new
	node" different from a "new node"? Document default values
	corresponding to field types.
	* exp_ch7.adb (Process_Tagged_Type_Declaration): Use
	higher-level Scope_Depth instead of Scope_Depth_Value.  Remove
	confusing comment: not clear what a "true" library level package
	is.
	* uintp.adb (Image_Out): Print No_Uint in a more readable way.
	* gen_il-gen.adb, gen_il-gen-gen_entities.adb,
	gen_il-gen-gen_nodes.adb, gen_il-types.ads: Tighten up the
	subtypes of fields whose type is Uint, where possible; use
	more-constrained subtypes such as Unat.
	* einfo-utils.adb, einfo-utils.ads, exp_attr.adb,
	exp_ch3.adb, exp_intr.adb, exp_unst.adb, exp_util.adb,
	freeze.adb, repinfo.adb, sem.adb, sem_ch12.adb, sem_ch13.adb,
	sem_ch3.adb, sem_ch8.adb, sem_util.adb, sprint.adb, treepr.adb:
	No longer use Uint_0 to indicate "unknown" or "not yet known"
	for various fields whose type is Uint. Use No_Uint for that,
	except in a small number of legacy cases that cause test
	failures. Protect many queries of such fields with calls to
	Known_... functions. Improve comments.
	* exp_aggr.adb: Likewise.
	(Is_OK_Aggregate): Check whether Csiz is present.
	(Aggr_Assignment_OK_For_Backend): Ensure we do not access an
	uninitialized size.
	* exp_strm.adb (Build_Elementary_Input_Call,
	Build_Elementary_Write_Call): Check whether P_Size is present.
	* cstand.adb: Leave Component_Size of Any_Composite unknown.
	Similar for RM_Size of Standard_Exception_Type.  These should
	not be used.
	* einfo.ads: Comment improvements.
	* exp_disp.ads: Minor.
	* gen_il-internals.ads, gen_il-internals.adb: Minor.
	* sinfo-utils.adb: Take advantage of full-coverage rules.
	* types.h: Minor.
2021-10-20 10:17:04 +00:00
Gary Dismukes
749e01a5f3 [Ada] Warning on nonmatching subtypes in fully conforming subprogram specs and bodies
gcc/ada/

	* sem_ch6.adb: Add with and use of Warnsw.
	(Check_Conformance): Report a warning when subtypes or
	designated subtypes of formal parameters or result subtypes
	denote different declarations between the spec and body of the
	(Subprogram_Subtypes_Have_Same_Declaration): New function nested
	within Check_Conformance that determines whether two subtype
	entities referenced in a subprogram come from the same
	declaration. Returns True immediately if the subprogram is in a
	generic instantiation, or the subprogram is marked Is_Internal
	or is declared in an internal (GNAT library) unit, or GNAT_Mode
	is enabled, otherwise compares the nonlimited views of the
	entities (or their designated subtypes' nonlimited views in the
	anonymous access cases).
	(Nonlimited_View_Of_Subtype): New function nested within
	function Subprogram_Subtypes_Have_Same_Declaration that returns
	Non_Limited_View of a type or subtype that is an incomplete or
	class-wide type that comes from a limited of a
	package (From_Limited_With is True for the entity), or returns
	Full_View when the nonlimited view is an incomplete type.
	Otherwise returns the entity passed in.
	* warnsw.ads (Warn_On_Pedantic_Checks): New warning flag.
	(type Warning_Record): New component Warn_On_Pedantic_Checks.
	* warnsw.adb (All_Warnings): Set Warn_On_Pedantic_Checks from
	parameter Setting.
	(Restore_Warnings): Restore the value of the
	Warn_On_Pedantic_Checks flag.
	(Save_Warnings): Save the value of the Warn_On_Pedantic_Checks
	flag.
	(Set_Underscore_Warning_Switch): Add settings of the
	Warn_On_Pedantic flag according to the switch ("-gnatw_p" vs.
	"-gnatw_P").
	* doc/gnat_ugn/building_executable_programs_with_gnat.rst: Add
	documentation of new switches -gnatw_p and -gnatw_P (warnings
	for pedantic checks).
	* gnat_ugn.texi: Regenerate.
	* usage.adb: Add Warn_On_Pedantic_Checks.
2021-10-20 10:17:04 +00:00
Piotr Trojanek
ff27467280 [Ada] Prevent use of an uninitialized AST field with universal integer
gcc/ada/

	* exp_spark.adb (Expand_SPARK_N_Attribute_Reference): Guard
	against equality of an uninitialized RM_Size field.
2021-10-20 10:17:04 +00:00
Eric Botcazou
d24e5767fe [Ada] Expose and use type-generic GCC atomic builtins
gcc/ada/

	* sem_ch12.adb (Analyze_Subprogram_Instantiation): Also propagate an
	interface name on an intrinsic subprogram.  Remove obsolete comment.
	* libgnat/s-atopri.ads (Atomic_Load): New generic intrinsic function
	(Atomic_Load_8): Rewrite into instantiation.
	(Atomic_Load_16): Likewise.
	(Atomic_Load_32): Likewise.
	(Atomic_Load_64): Likewise.
	(Sync_Compare_And_Swap): New generic intrinsic function.
	(Sync_Compare_And_Swap_8): Rewrite into instantiation.
	(Sync_Compare_And_Swap_16): Likewise.
	(Sync_Compare_And_Swap_32): Likewise.
	(Sync_Compare_And_Swap_64): Likewise.
	(Lock_Free_Read): New generic inline function.
	(Lock_Free_Read_8): Rewrite into instantiation.
	(Lock_Free_Read_16): Likewise.
	(Lock_Free_Read_32): Likewise.
	(Lock_Free_Read_64): Likewise.
	(Lock_Free_Try_Write): New generic inline function.
	(Lock_Free_Try_Write_8): Rewrite into instantiation.
	(Lock_Free_Try_Write_16): Likewise.
	(Lock_Free_Try_Write_32): Likewise.
	(Lock_Free_Try_Write_64): Likewise.
	* libgnat/s-atopri.adb (Lock_Free_Read): New function body.
	(Lock_Free_Read_8): Delete.
	(Lock_Free_Read_16): Likewise.
	(Lock_Free_Read_32): Likewise.
	(Lock_Free_Read_64): Likewise.
	(Lock_Free_Try_Write): New function body.
	(Lock_Free_Try_Write_8): Delete.
	(Lock_Free_Try_Write_16): Likewise.
	(Lock_Free_Try_Write_32): Likewise.
	(Lock_Free_Try_Write_64): Likewise.
	* libgnat/s-aoinar.adb (Atomic_Fetch_And_Add): Use type-generic GCC
	atomic builtin and tidy up implementation.
	(Atomic_Fetch_And_Subtract): Likewise.
	* libgnat/s-aomoar.adb (Atomic_Fetch_And_Add): Likewise.
	(Atomic_Fetch_And_Subtract): Likewise.
	* libgnat/s-atopex.adb (Atomic_Exchange): Likewise.
	(Atomic_Compare_And_Exchange): Likewise.
2021-10-20 10:17:04 +00:00
Eric Botcazou
abb540a70b [Ada] Rewrite tests on Convention_Intrinsic
gcc/ada/

	* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Subprogram_Type>:
	Replace test on Convention_Intrinsic with Is_Intrinsic_Subprogram.
	(gnat_to_gnu_param): Likewise.
	(gnat_to_gnu_subprog_type): Likewise.
	* gcc-interface/trans.c (elaborate_all_entities_for_package): Ditto.
2021-10-20 10:17:03 +00:00
Eric Botcazou
4b39bab947 [Ada] Small cleanup in Eval_Integer_Literal
gcc/ada/

	* sem_eval.ads (Check_Non_Static_Context): Update documentation.
	* sem_eval.adb (In_Any_Integer_Context): Change parameter type,
	adjust accordingly and remove unreachable case.
	(Eval_Integer_Literal): Consider the node kind throughout and
	trim down verbose condition.
2021-10-20 10:17:03 +00:00