Commit Graph

187108 Commits

Author SHA1 Message Date
Jakub Jelinek
8408d34570 expmed: Fix store_integral_bit_field [PR101562]
Our documentation says that paradoxical subregs shouldn't appear
in strict_low_part:
'(strict_low_part (subreg:M (reg:N R) 0))'
     This expression code is used in only one context: as the
     destination operand of a 'set' expression.  In addition, the
     operand of this expression must be a non-paradoxical 'subreg'
     expression.
but on the testcase below that triggers UB at runtime
store_integral_bit_field emits exactly that.

The following patch fixes it by ensuring the requirement is satisfied.

2021-07-23  Jakub Jelinek  <jakub@redhat.com>

	PR rtl-optimization/101562
	* expmed.c (store_integral_bit_field): Only use movstrict_optab
	if the operand isn't paradoxical.

	* gcc.c-torture/compile/pr101562.c: New test.
2021-07-23 19:55:16 +02:00
Aldy Hernandez
435f90187e Use range_query object in array bounds class.
Now that all dependencies of array_bounds_checker take a range_query, we
can sever the relationship with vr_values.  Changing this will allow us
to use the array_bounds_checker with VRP, evrp, or the ranger.

Tested on x86-64 Linux.

gcc/ChangeLog:

	* gimple-array-bounds.h (class array_bounds_checker): Change
	ranges type to range_query.
2021-07-23 17:39:15 +02:00
Jonathan Wright
50752b751f aarch64: Use memcpy to copy vector tables in vst1[q]_x2 intrinsics
Use __builtin_memcpy to copy vector structures instead of building
a new opaque structure one vector at a time in each of the vst1[q]_x2
Neon intrinsics in arm_neon.h. This simplifies the header file and
also improves code generation - superfluous move instructions were
emitted for every register extraction/set in this additional
structure.

Add new code generation tests to verify that superfluous move
instructions are not generated for the vst1q_x2 intrinsics.

gcc/ChangeLog:

2021-07-23  Jonathan Wright  <jonathan.wright@arm.com>

	* config/aarch64/arm_neon.h (vst1_s64_x2): Use
	__builtin_memcpy instead of constructing
	__builtin_aarch64_simd_oi one vector at a time.
	(vst1_u64_x2): Likewise.
	(vst1_f64_x2): Likewise.
	(vst1_s8_x2): Likewise.
	(vst1_p8_x2): Likewise.
	(vst1_s16_x2): Likewise.
	(vst1_p16_x2): Likewise.
	(vst1_s32_x2): Likewise.
	(vst1_u8_x2): Likewise.
	(vst1_u16_x2): Likewise.
	(vst1_u32_x2): Likewise.
	(vst1_f16_x2): Likewise.
	(vst1_f32_x2): Likewise.
	(vst1_p64_x2): Likewise.
	(vst1q_s8_x2): Likewise.
	(vst1q_p8_x2): Likewise.
	(vst1q_s16_x2): Likewise.
	(vst1q_p16_x2): Likewise.
	(vst1q_s32_x2): Likewise.
	(vst1q_s64_x2): Likewise.
	(vst1q_u8_x2): Likewise.
	(vst1q_u16_x2): Likewise.
	(vst1q_u32_x2): Likewise.
	(vst1q_u64_x2): Likewise.
	(vst1q_f16_x2): Likewise.
	(vst1q_f32_x2): Likewise.
	(vst1q_f64_x2): Likewise.
	(vst1q_p64_x2): Likewise.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/vector_structure_intrinsics.c: Add new
	tests.
2021-07-23 15:38:00 +01:00
Jonathan Wright
ccf6e2c21b aarch64: Use memcpy to copy vector tables in vst1[q]_x3 intrinsics
Use __builtin_memcpy to copy vector structures instead of building
a new opaque structure one vector at a time in each of the vst1[q]_x3
Neon intrinsics in arm_neon.h. This simplifies the header file and
also improves code generation - superfluous move instructions were
emitted for every register extraction/set in this additional
structure.

Add new code generation tests to verify that superfluous move
instructions are not generated for the vst1q_x3 intrinsics.

gcc/ChangeLog:

2021-07-23  Jonathan Wright  <jonathan.wright@arm.com>

	* config/aarch64/arm_neon.h (vst1_s64_x3): Use
	__builtin_memcpy instead of constructing
	__builtin_aarch64_simd_ci one vector at a time.
	(vst1_u64_x3): Likewise.
	(vst1_f64_x3): Likewise.
	(vst1_s8_x3): Likewise.
	(vst1_p8_x3): Likewise.
	(vst1_s16_x3): Likewise.
	(vst1_p16_x3): Likewise.
	(vst1_s32_x3): Likewise.
	(vst1_u8_x3): Likewise.
	(vst1_u16_x3): Likewise.
	(vst1_u32_x3): Likewise.
	(vst1_f16_x3): Likewise.
	(vst1_f32_x3): Likewise.
	(vst1_p64_x3): Likewise.
	(vst1q_s8_x3): Likewise.
	(vst1q_p8_x3): Likewise.
	(vst1q_s16_x3): Likewise.
	(vst1q_p16_x3): Likewise.
	(vst1q_s32_x3): Likewise.
	(vst1q_s64_x3): Likewise.
	(vst1q_u8_x3): Likewise.
	(vst1q_u16_x3): Likewise.
	(vst1q_u32_x3): Likewise.
	(vst1q_u64_x3): Likewise.
	(vst1q_f16_x3): Likewise.
	(vst1q_f32_x3): Likewise.
	(vst1q_f64_x3): Likewise.
	(vst1q_p64_x3): Likewise.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/vector_structure_intrinsics.c: Add new
	tests.
2021-07-23 15:37:43 +01:00
H.J. Lu
085666673d x86: Don't return hard register when LRA is in progress
Don't return hard register in ix86_gen_scratch_sse_rtx when LRA is in
progress to avoid ICE when there are no available hard registers for
LRA.

gcc/

	PR target/101504
	* config/i386/i386.c (ix86_gen_scratch_sse_rtx): Don't return
	hard register when LRA is in progress.

gcc/testsuite/

	PR target/101504
	* gcc.target/i386/pr101504.c: New test.
2021-07-23 06:10:39 -07:00
Jonathan Wakely
3ea62a2b2e libstdc++: Reduce headers included by <future>
The <future> header only needs std::atomic_flag, so can include
<bits/atomic_base.h> instead of the whole of <atomic>.

libstdc++-v3/ChangeLog:

	* include/std/future: Include <bits/atomic_base.h> instead of
	<atomic>.
2021-07-23 13:27:45 +01:00
Jonathan Wright
1711b04582 aarch64: Use memcpy to copy vector tables in vst1[q]_x4 intrinsics
Use __builtin_memcpy to copy vector structures instead of using a
union in each of the vst1[q]_x4 Neon intrinsics in arm_neon.h.

Add new code generation tests to verify that superfluous move
instructions are not generated for the vst1q_x4 intrinsics.

gcc/ChangeLog:

2021-07-21  Jonathan Wright  <jonathan.wright@arm.com>

	* config/aarch64/arm_neon.h (vst1_s8_x4): Use
	__builtin_memcpy instead of using a union.
	(vst1q_s8_x4): Likewise.
	(vst1_s16_x4): Likewise.
	(vst1q_s16_x4): Likewise.
	(vst1_s32_x4): Likewise.
	(vst1q_s32_x4): Likewise.
	(vst1_u8_x4): Likewise.
	(vst1q_u8_x4): Likewise.
	(vst1_u16_x4): Likewise.
	(vst1q_u16_x4): Likewise.
	(vst1_u32_x4): Likewise.
	(vst1q_u32_x4): Likewise.
	(vst1_f16_x4): Likewise.
	(vst1q_f16_x4): Likewise.
	(vst1_f32_x4): Likewise.
	(vst1q_f32_x4): Likewise.
	(vst1_p8_x4): Likewise.
	(vst1q_p8_x4): Likewise.
	(vst1_p16_x4): Likewise.
	(vst1q_p16_x4): Likewise.
	(vst1_s64_x4): Likewise.
	(vst1_u64_x4): Likewise.
	(vst1_p64_x4): Likewise.
	(vst1q_s64_x4): Likewise.
	(vst1q_u64_x4): Likewise.
	(vst1q_p64_x4): Likewise.
	(vst1_f64_x4): Likewise.
	(vst1q_f64_x4): Likewise.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/vector_structure_intrinsics.c: Add new
	tests.
2021-07-23 12:16:13 +01:00
Jonathan Wright
03148b8e50 aarch64: Use memcpy to copy vector tables in vst2[q] intrinsics
Use __builtin_memcpy to copy vector structures instead of building
a new opaque structure one vector at a time in each of the vst2[q]
Neon intrinsics in arm_neon.h. This simplifies the header file and
also improves code generation - superfluous move instructions were
emitted for every register extraction/set in this additional
structure.

Add new code generation tests to verify that superfluous move
instructions are no longer generated for the vst2q intrinsics.

gcc/ChangeLog:

2021-07-21  Jonathan Wrightt  <jonathan.wright@arm.com>

	* config/aarch64/arm_neon.h (vst2_s64): Use __builtin_memcpy
	instead of constructing __builtin_aarch64_simd_oi one vector
	at a time.
	(vst2_u64): Likewise.
	(vst2_f64): Likewise.
	(vst2_s8): Likewise.
	(vst2_p8): Likewise.
	(vst2_s16): Likewise.
	(vst2_p16): Likewise.
	(vst2_s32): Likewise.
	(vst2_u8): Likewise.
	(vst2_u16): Likewise.
	(vst2_u32): Likewise.
	(vst2_f16): Likewise.
	(vst2_f32): Likewise.
	(vst2_p64): Likewise.
	(vst2q_s8): Likewise.
	(vst2q_p8): Likewise.
	(vst2q_s16): Likewise.
	(vst2q_p16): Likewise.
	(vst2q_s32): Likewise.
	(vst2q_s64): Likewise.
	(vst2q_u8): Likewise.
	(vst2q_u16): Likewise.
	(vst2q_u32): Likewise.
	(vst2q_u64): Likewise.
	(vst2q_f16): Likewise.
	(vst2q_f32): Likewise.
	(vst2q_f64): Likewise.
	(vst2q_p64): Likewise.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/vector_structure_intrinsics.c: Add new
	tests.
2021-07-23 12:15:57 +01:00
Jonathan Wright
95509ee2c1 aarch64: Use memcpy to copy vector tables in vst3[q] intrinsics
Use __builtin_memcpy to copy vector structures instead of building
a new opaque structure one vector at a time in each of the vst3[q]
Neon intrinsics in arm_neon.h. This simplifies the header file and
also improves code generation - superfluous move instructions were
emitted for every register extraction/set in this additional
structure.

Add new code generation tests to verify that superfluous move
instructions are no longer generated for the vst3q intrinsics.

gcc/ChangeLog:

2021-07-21  Jonathan Wright  <jonathan.wright@arm.com>

	* config/aarch64/arm_neon.h (vst3_s64): Use __builtin_memcpy
	instead of constructing __builtin_aarch64_simd_ci one vector
	at a time.
	(vst3_u64): Likewise.
	(vst3_f64): Likewise.
	(vst3_s8): Likewise.
	(vst3_p8): Likewise.
	(vst3_s16): Likewise.
	(vst3_p16): Likewise.
	(vst3_s32): Likewise.
	(vst3_u8): Likewise.
	(vst3_u16): Likewise.
	(vst3_u32): Likewise.
	(vst3_f16): Likewise.
	(vst3_f32): Likewise.
	(vst3_p64): Likewise.
	(vst3q_s8): Likewise.
	(vst3q_p8): Likewise.
	(vst3q_s16): Likewise.
	(vst3q_p16): Likewise.
	(vst3q_s32): Likewise.
	(vst3q_s64): Likewise.
	(vst3q_u8): Likewise.
	(vst3q_u16): Likewise.
	(vst3q_u32): Likewise.
	(vst3q_u64): Likewise.
	(vst3q_f16): Likewise.
	(vst3q_f32): Likewise.
	(vst3q_f64): Likewise.
	(vst3q_p64): Likewise.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/vector_structure_intrinsics.c: Add new
	tests.
2021-07-23 12:15:35 +01:00
Jonathan Wright
e8de7edde6 aarch64: Use memcpy to copy vector tables in vst4[q] intrinsics
Use __builtin_memcpy to copy vector structures instead of building
a new opaque structure one vector at a time in each of the vst4[q]
Neon intrinsics in arm_neon.h. This simplifies the header file and
also improves code generation - superfluous move instructions were
emitted for every register extraction/set in this additional
structure.

Add new code generation tests to verify that superfluous move
instructions are no longer generated for the vst4q intrinsics.

gcc/ChangeLog:

2021-07-20  Jonathan Wright  <jonathan.wright@arm.com>

	* config/aarch64/arm_neon.h (vst4_s64): Use __builtin_memcpy
	instead of constructing __builtin_aarch64_simd_xi one vector
	at a time.
	(vst4_u64): Likewise.
	(vst4_f64): Likewise.
	(vst4_s8): Likewise.
	(vst4_p8): Likewise.
	(vst4_s16): Likewise.
	(vst4_p16): Likewise.
	(vst4_s32): Likewise.
	(vst4_u8): Likewise.
	(vst4_u16): Likewise.
	(vst4_u32): Likewise.
	(vst4_f16): Likewise.
	(vst4_f32): Likewise.
	(vst4_p64): Likewise.
	(vst4q_s8): Likewise.
	(vst4q_p8): Likewise.
	(vst4q_s16): Likewise.
	(vst4q_p16): Likewise.
	(vst4q_s32): Likewise.
	(vst4q_s64): Likewise.
	(vst4q_u8): Likewise.
	(vst4q_u16): Likewise.
	(vst4q_u32): Likewise.
	(vst4q_u64): Likewise.
	(vst4q_f16): Likewise.
	(vst4q_f32): Likewise.
	(vst4q_f64): Likewise.
	(vst4q_p64): Likewise.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/vector_structure_intrinsics.c: Add new
	tests.
2021-07-23 12:15:20 +01:00
Jonathan Wright
4848e283cc aarch64: Use memcpy to copy vector tables in vtbx4 intrinsics
Use __builtin_memcpy to copy vector structures instead of building
a new opaque structure one vector at a time in each of the vtbx4
Neon intrinsics in arm_neon.h. This simplifies the header file and
also improves code generation - superfluous move instructions were
emitted for every register extraction/set in this additional
structure.

gcc/ChangeLog:

2021-07-19  Jonathan Wright  <jonathan.wright@arm.com>

	* config/aarch64/arm_neon.h (vtbx4_s8): Use __builtin_memcpy
	instead of constructing __builtin_aarch64_simd_oi one vector
	at a time.
	(vtbx4_u8): Likewise.
	(vtbx4_p8): Likewise.
2021-07-23 12:15:02 +01:00
Jonathan Wright
f2f04d8b9d aarch64: Use memcpy to copy vector tables in vtbl[34] intrinsics
Use __builtin_memcpy to copy vector structures instead of building
a new opaque structure one vector at a time in each of the vtbl[34]
Neon intrinsics in arm_neon.h. This simplifies the header file and
also improves code generation - superfluous move instructions were
emitted for every register extraction/set in this additional
structure.

gcc/ChangeLog:

2021-07-08  Jonathan Wright  <jonathan.wright@arm.com>

	* config/aarch64/arm_neon.h (vtbl3_s8): Use __builtin_memcpy
	instead of constructing __builtin_aarch64_simd_oi one vector
	at a time.
	(vtbl3_u8): Likewise.
	(vtbl3_p8): Likewise.
	(vtbl4_s8): Likewise.
	(vtbl4_u8): Likewise.
	(vtbl4_p8): Likewise.
2021-07-23 12:14:42 +01:00
Jonathan Wright
5f65676eba aarch64: Use memcpy to copy vector tables in vqtbx[234] intrinsics
Use __builtin_memcpy to copy vector structures instead of building
a new opaque structure one vector at a time in each of the vqtbx[234]
Neon intrinsics in arm_neon.h. This simplifies the header file and
also improves code generation - superfluous move instructions were
emitted for every register extraction/set in this additional
structure.

Add new code generation tests to verify that superfluous move
instructions are no longer generated for the vqtbx[234] intrinsics.

gcc/ChangeLog:

2021-07-08  Jonathan Wright  <jonathan.wright@arm.com>

	* config/aarch64/arm_neon.h (vqtbx2_s8): Use __builtin_memcpy
	instead of constructing __builtin_aarch64_simd_oi one vector
	at a time.
	(vqtbx2_u8): Likewise.
	(vqtbx2_p8): Likewise.
	(vqtbx2q_s8): Likewise.
	(vqtbx2q_u8): Likewise.
	(vqtbx2q_p8): Likewise.
	(vqtbx3_s8): Use __builtin_memcpy instead of constructing
	__builtin_aarch64_simd_ci one vector at a time.
	(vqtbx3_u8): Likewise.
	(vqtbx3_p8): Likewise.
	(vqtbx3q_s8): Likewise.
	(vqtbx3q_u8): Likewise.
	(vqtbx3q_p8): Likewise.
	(vqtbx4_s8): Use __builtin_memcpy instead of constructing
	__builtin_aarch64_simd_xi one vector at a time.
	(vqtbx4_u8): Likewise.
	(vqtbx4_p8): Likewise.
	(vqtbx4q_s8): Likewise.
	(vqtbx4q_u8): Likewise.
	(vqtbx4q_p8): Likewise.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/vector_structure_intrinsics.c: New tests.
2021-07-23 12:14:18 +01:00
Jonathan Wright
484acfa4cf aarch64: Use memcpy to copy vector tables in vqtbl[234] intrinsics
Use __builtin_memcpy to copy vector structures instead of building
a new opaque structure one vector at a time in each of the vqtbl[234]
Neon intrinsics in arm_neon.h. This simplifies the header file and
also improves code generation - superfluous move instructions were
emitted for every register extraction/set in this additional
structure.

Add new code generation tests to verify that superfluous move
instructions are no longer generated for the vqtbl[234] intrinsics.

gcc/ChangeLog:

2021-07-08  Jonathan Wright  <jonathan.wright@arm.com>

	* config/aarch64/arm_neon.h (vqtbl2_s8): Use __builtin_memcpy
	instead of constructing __builtin_aarch64_simd_oi one vector
	at a time.
	(vqtbl2_u8): Likewise.
	(vqtbl2_p8): Likewise.
	(vqtbl2q_s8): Likewise.
	(vqtbl2q_u8): Likewise.
	(vqtbl2q_p8): Likewise.
	(vqtbl3_s8): Use __builtin_memcpy instead of constructing
	__builtin_aarch64_simd_ci one vector at a time.
	(vqtbl3_u8): Likewise.
	(vqtbl3_p8): Likewise.
	(vqtbl3q_s8): Likewise.
	(vqtbl3q_u8): Likewise.
	(vqtbl3q_p8): Likewise.
	(vqtbl4_s8): Use __builtin_memcpy instead of constructing
	__builtin_aarch64_simd_xi one vector at a time.
	(vqtbl4_u8): Likewise.
	(vqtbl4_p8): Likewise.
	(vqtbl4q_s8): Likewise.
	(vqtbl4q_u8): Likewise.
	(vqtbl4q_p8): Likewise.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/vector_structure_intrinsics.c: New test.
2021-07-23 12:13:55 +01:00
Jonathan Wakely
5b965dc49a libstdc++: Update documentation comments for namespace rel_ops
The comments in <bits/stl_relops.h> describe problems that were solved
years ago (for GCC 3.1). The comparison operators in <iterator> are no
longer ambiguous with the rel_ops ones, so the linked mailing list
thread and FAQ entry aren't relevant now. The reference to std_utility.h
is also outdated as it's just called utility now, both in the source
tree and when installed.

The use of rel_ops is still frowned upon though, so replace the
discussion of ambiguities within libstdc++ headers with adminition about
using rel_ops in user code.

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

libstdc++-v3/ChangeLog:

	* include/bits/stl_relops.h: Update documentation comments.
2021-07-23 11:22:10 +01:00
Jakub Jelinek
7f7364108f openmp: Add support for __has_attribute(omp::directive) and __has_attribute(omp::sequence)
Now that the C++ FE supports these attributes, but not through registering
them in the attributes tables (they work quite differently from other
attributes), this teaches c_common_has_attributes about those.

2021-07-23  Jakub Jelinek  <jakub@redhat.com>

	* c-lex.c (c_common_has_attribute): Call canonicalize_attr_name also
	on attr_id.  Return 1 for omp::directive or omp::sequence in C++11
	and later.

	* c-c++-common/gomp/attrs-1.c: New test.
	* c-c++-common/gomp/attrs-2.c: New test.
	* c-c++-common/gomp/attrs-3.c: New test.
2021-07-23 09:50:15 +02:00
Jakub Jelinek
2c5d803d03 openmp: Diagnose invalid mixing of the attribute and pragma syntax directives
The OpenMP 5.1 spec says that the attribute and pragma syntax directives
should not be mixed on the same statement.  The following patch adds diagnostic
for that,
  [[omp::directive (...)]]
  #pragma omp ...
is always an error and for the other order
  #pragma omp ...
  [[omp::directive (...)]]
it depends on whether the pragma directive is an OpenMP construct
(then it is an error because it needs a structured block or loop
or statement as body) or e.g. a standalone directive (then it is fine).

Only block scope is handled for now though, namespace scope and class scope
still needs implementing even the basic support.

2021-07-23  Jakub Jelinek  <jakub@redhat.com>

gcc/c-family/
	* c-pragma.h (enum pragma_kind): Add PRAGMA_OMP__START_ and
	PRAGMA_OMP__LAST_ enumerators.
gcc/cp/
	* parser.h (struct cp_parser): Add omp_attrs_forbidden_p member.
	* parser.c (cp_parser_handle_statement_omp_attributes): Diagnose
	mixing of attribute and pragma syntax directives when seeing
	omp::directive if parser->omp_attrs_forbidden_p or if attribute syntax
	directives are followed by OpenMP pragma.
	(cp_parser_statement): Clear parser->omp_attrs_forbidden_p after
	the cp_parser_handle_statement_omp_attributes call.
	(cp_parser_omp_structured_block): Add disallow_omp_attrs argument,
	if true, set parser->omp_attrs_forbidden_p.
	(cp_parser_omp_scan_loop_body, cp_parser_omp_sections_scope): Pass
	false as disallow_omp_attrs to cp_parser_omp_structured_block.
	(cp_parser_omp_parallel, cp_parser_omp_task): Set
	parser->omp_attrs_forbidden_p.
gcc/testsuite/
	* g++.dg/gomp/attrs-4.C: New test.
	* g++.dg/gomp/attrs-5.C: New test.
2021-07-23 09:37:36 +02:00
Xi Ruoyao
19e0505879
testsuite: mips: pass -finline/-fnoinline through
gcc/testsuite/

	* gcc.target/mips/mips.exp (mips_option_groups): add
	  -finline and -fno-inline.
2021-07-23 13:55:56 +08:00
Xi Ruoyao
863737b8de
Revert "testsuite: mips: use noinline attribute instead of -fno-inline"
This reverts commit 3b33b1136d.
2021-07-23 13:54:11 +08:00
David Malcolm
60933a148a analyzer: fix feasibility false +ve with overly complex svalues
gcc/analyzer/ChangeLog:
	* diagnostic-manager.cc
	(class auto_disable_complexity_checks): New.
	(epath_finder::explore_feasible_paths): Use it to disable
	complexity checks whilst processing the worklist.
	* region-model-manager.cc
	(region_model_manager::region_model_manager): Initialize
	m_check_complexity.
	(region_model_manager::reject_if_too_complex): Bail if
	m_check_complexity is false.
	* region-model.h
	(region_model_manager::enable_complexity_check): New.
	(region_model_manager::disable_complexity_check): New.
	(region_model_manager::m_check_complexity): New.

gcc/testsuite/ChangeLog:
	* gcc.dg/analyzer/feasibility-3.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2021-07-22 22:36:05 -04:00
Haochen Gui
3382846558 Fix execution failure of parity_1.f90 on P10 [PR100952]
gcc/
	PR target/100952
	* config/rs6000/rs6000.md (cstore<mode>4): Fix wrong fall through.
2021-07-23 10:00:35 +08:00
GCC Administrator
01ac2f08b0 Daily bump. 2021-07-23 00:16:31 +00:00
Sandra Loosemore
e4966e1d1d Bind(c): signed char is not a Fortran character type
CFI_allocate and CFI_select_part were incorrectly treating
CFI_type_signed_char as a Fortran character type for the purpose of
deciding whether or not to use the elem_len argument.  It is a Fortran
integer type per table 18.2 in the 2018 Fortran standard.

Other functions in ISO_Fortran_binding.c appeared to handle this case
correctly already.

2021-07-15  Sandra Loosemore  <sandra@codesourcery.com>

libgfortran/
	* runtime/ISO_Fortran_binding.c (CFI_allocate): Don't use elem_len
	for CFI_type_signed_char.
	(CFI_select_part): Likewise.
2021-07-22 15:15:50 -07:00
Jonathan Wakely
8ed6cfbbee libstdc++: Fix non-default constructors for hash containers [PR101583]
When I added the new mixin to _Hashtable, I forgot to explicitly
construct it in each non-default constructor. That means you can't
use any constructors unless all three of the hash function, equality
function, and allocator are all default constructible.

libstdc++-v3/ChangeLog:

	PR libstdc++/101583
	* include/bits/hashtable.h (_Hashtable): Replace mixin with
	_Enable_default_ctor. Construct it explicitly in all
	non-forwarding, non-defaulted constructors.
	* testsuite/23_containers/unordered_map/cons/default.cc: Check
	non-default constructors can be used.
	* testsuite/23_containers/unordered_set/cons/default.cc:
	Likewise.
2021-07-22 19:39:58 +01:00
Martin Sebor
b362d7947b Add new test for PR65178.
gcc/testsuite/ChangeLog:
	PR tree-optimization/65178
	* gcc.dg/uninit-pr65178.c: New test.
2021-07-22 11:51:26 -06:00
Martin Sebor
50f3ac1beb Remove an invalid defintion [PR101568].
Resolves:
PR testsuite/101568 - g++.dg/ipa/pr82352.C fails

gcc/testsuite/ChangeLog:
	PR testsuite/101568
	* g++.dg/ipa/pr82352.C
2021-07-22 10:23:11 -06:00
Andrew Pinski
8819419ba1 Fix PR 10153: tail recusion for vector types.
The problem here is we try to an initialized value
from a scalar constant. For vectors we need to do
a vect_dup instead.  This fixes that issue by using
build_{one,zero}_cst instead of integer_{one,zero}_node
when calling create_tailcall_accumulator.

Changes from v1:
* v2: Use build_{one,zero}_cst and get the correct type before.

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

gcc/ChangeLog:

	PR tree-optimization/10153
	* tree-tailcall.c (create_tailcall_accumulator):
	Don't call fold_convert as the type should be correct already.
	(tree_optimize_tail_calls_1): Use build_{one,zero}_cst instead
	of integer_{one,zero}_node for the call of create_tailcall_accumulator.

gcc/testsuite/ChangeLog:

	PR tree-optimization/10153
	* gcc.c-torture/compile/pr10153-1.c: New test.
	* gcc.c-torture/compile/pr10153-2.c: New test.
2021-07-22 09:14:42 -07:00
Aldy Hernandez
4048d8a086 Allow non-null adjustments for pointers even when there is a known range.
Fix non_null_ref::adjust_range so it always adjust ranges, not just
varying ranges.  This will allow pointers that have a range, but are not
necessarily non-null, to be adjusted.

gcc/ChangeLog:

	* gimple-range-cache.cc (non_null_ref::adjust_range): Replace
	varying_p check for null/non-null check.
2021-07-22 17:29:07 +02:00
David Edelsohn
3f7a2374d3 aix: Protect AIX math.h overloads with new macro.
AIX math.h provides C++ overloaded inlined math functions, which should
not be present for G++. The definitions have been guaded by
__COMPATMATH__, but that macro had other uses in IBM xlC++. A new
macro has been introduced with the sole purpose of guarding the functions.
This patch updates libstdc++ os_defines.h to define the additional macro.
The earlier macro definition is retained to guard the functions in the
math.h header of earlier AIX releases.

libstdc++-v3/ChangeLog:

	* config/os/aix/os_defines.h (__LIBC_NO_CPP_MATH_OVERLOADS__): Define.
2021-07-22 11:30:34 -04:00
Jonathan Wakely
c9ca352186 libstdc++: Use __builtin_operator_new when available [PR94295]
Clang provides __builtin_operator_new and __builtin_operator_delete,
which have the same semantics as ::operator new and ::operator delete
except that the compiler is allowed to elide calls to them. This changes
std::allocator to use those built-in functions so that memory allocated
by std::allocator can be optimized away when using Clang. This avoids an
abstraction penalty for using std::allocator to allocate storage rather
than a new-expression.

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

libstdc++-v3/ChangeLog:

	PR libstdc++/94295
	* include/ext/new_allocator.h (_GLIBCXX_OPERATOR_NEW)
	(_GLIBCXX_OPERATOR_DELETE, _GLIBCXX_SIZED_DEALLOC): Define.
	(allocator::allocate, allocator::deallocate): Use new macros.
2021-07-22 14:38:34 +01:00
Jonathan Wakely
aca7a0253d libstdc++: Use std::addressof in ranges::uninitialized_xxx [PR101571]
Make the ranges::uninitialized_xxx algorithms use std::addressof to
protect against iterator types that overload operator&.

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

libstdc++-v3/ChangeLog:

	PR libstdc++/101571
	* include/bits/ranges_uninitialized.h (_DestroyGuard): Change
	constructor parameter to reference and use addressof.
	* testsuite/util/testsuite_iterators.h: Define deleted operator&
	overloads for test iterators.
2021-07-22 14:37:24 +01:00
Jonathan Wakely
c22bcfd2f7 libstdc++: Initialize all subobjects of std::function
The std::function::swap member swaps each data member unconditionally,
resulting in -Wmaybe-uninitialized warnings for a default constructed
object. This happens because the _M_invoker and _M_functor members are
only initialized if the function has a target.

This change ensures that all subobjects are zero-initialized on
construction.

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

libstdc++-v3/ChangeLog:

	* include/bits/std_function.h (_Function_base): Add
	default member initializers and define constructor as defaulted.
	(function::_M_invoker): Add default member initializer.
2021-07-22 13:53:57 +01:00
Jonathan Wakely
254e5d19a1 libstdc++: Restore __gnu_debug::array [PR100682]
As the PR points out, we removed the debug version of std::array without
any period of deprecation. Although std::array contains all the actual
debug checks now, removing the <debug/arrray> header breaks any code
that was using that explicitly. The manual still lists doing that as
supported.

This restores the <debug/array> header, but simply defines
__gnu_debug::array as an alias for std::array, and declares the alias
with the deprecated attribute. The docs are updated to match.

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

libstdc++-v3/ChangeLog:

	PR libstdc++/100682
	* doc/xml/manual/debug_mode.xml: Update documentation about
	debug capability of std::array.
	* doc/html/*: Regenerate.
	* include/debug/array: New file.
2021-07-22 13:53:57 +01:00
Andrew MacLeod
d3fa77472b Allow non-symmetrical equivalences.
Don't trap if equivalences are processed out of DOM order, and aren't
completely symmetrical.  We will eventually resolve this, but its OK for now.

	gcc/
	PR tree-optimization/101511
	* value-relation.cc (relation_oracle::query_relation): Check if ssa1
	is in ssa2's equiv set, and don't trap if so.

	gcc/testsuite/
	* g++.dg/pr101511.C: New.
2021-07-22 08:51:59 -04:00
Andrew MacLeod
ea789238b2 Check for undefined on COND_EXPR before querying type.
gcc/
	PR tree-optimization/101497
	* gimple-range-fold.cc (fold_using_range::range_of_cond_expr): Check
	for undefined.

	gcc/testsuite
	* gcc.dg/pr101497.c: New.
2021-07-22 08:51:59 -04:00
Andrew MacLeod
e58093276a Only call vrp_visit_cond_stmt if range_of_stmt doesn't resolve to a const.
Eevntually all functionality will be subsumed.  Until then, call it only
if needed.

	gcc/
	PR tree-optimization/101496
	* vr-values.c (simplify_using_ranges::fold_cond): Call range_of_stmt
	first, then vrp_visit_cond_Stmt.

	gcc/testsuite
	* gcc.dg/pr101496.c: New.
2021-07-22 08:51:59 -04:00
liuhongt
a6291d88d5 Remove pass_cpb which is related to enable avx512 embedded broadcast from constant pool.
By optimizing vector movement to broadcast in ix86_expand_vector_move
during pass_expand, pass_reload/LRA can automatically generate an avx512
embedded broadcast, pass_cpb is not needed.

Considering that in the absence of avx512f, broadcast from memory is
still slightly faster than loading the entire memory, so always enable
broadcast.

benchmark:
https://gitlab.com/x86-benchmarks/microbenchmark/-/tree/vaddps/broadcast

The performance diff

strategy    : cycles
memory      : 1046611188
memory      : 1255420817
memory      : 1044720793
memory      : 1253414145
average	    : 1097868397

broadcast   : 1044430688
broadcast   : 1044477630
broadcast   : 1253554603
broadcast   : 1044561934
average	    : 1096756213

But however broadcast has larger size.

the size diff

size broadcast.o
   text	   data	    bss	    dec	    hex	filename
    137	      0	      0	    137	     89	broadcast.o

size memory.o
   text	   data	    bss	    dec	    hex	filename
    115	      0	      0	    115	     73	memory.o

gcc/ChangeLog:

	* config/i386/i386-expand.c
	(ix86_broadcast_from_integer_constant): Rename to ..
	(ix86_broadcast_from_constant): .. this, and extend it to
	handle float mode.
	(ix86_expand_vector_move): Extend to float mode.
	* config/i386/i386-features.c
	(replace_constant_pool_with_broadcast): Remove.
	(remove_partial_avx_dependency_gate): Ditto.
	(constant_pool_broadcast): Ditto.
	(class pass_constant_pool_broadcast): Ditto.
	(make_pass_constant_pool_broadcast): Ditto.
	(remove_partial_avx_dependency): Adjust gate.
	* config/i386/i386-passes.def: Remove pass_constant_pool_broadcast.
	* config/i386/i386-protos.h
	(make_pass_constant_pool_broadcast): Remove.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/fuse-caller-save-xmm.c: Adjust testcase.
2021-07-22 13:07:29 +08:00
liuhongt
a56c251898 Support logic shift left/right for avx512 mask type.
gcc/ChangeLog:

	* config/i386/constraints.md (Wb): New constraint.
	(Ww): Ditto.
	* config/i386/i386.md (*ashlhi3_1): Extend to avx512 mask
	shift.
	(*ashlqi3_1): Ditto.
	(*<insn><mode>3_1): Split to ..
	(*ashr<mode>3_1): this, ...
	(*lshr<mode>3_1): and this, also extend this pattern to avx512
	mask registers.
	(*<insn><mode>3_1): Split to ..
	(*ashr<mode>3_1): this, ...
	(*lshrqi3_1): and this, also extend this pattern to avx512
	mask registers.
	(*lshrhi3_1): And this, also extend this pattern to avx512
	mask registers.
	* config/i386/sse.md (k<code><mode>): New define_split after
	it to convert generic shift pattern to mask shift ones.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/mask-shift.c: New test.
2021-07-22 10:40:16 +08:00
GCC Administrator
419c6c68e6 Daily bump. 2021-07-22 00:16:46 +00:00
David Malcolm
893b12cc12 analyzer: bulletproof -Wanalyzer-file-leak [PR101547]
gcc/analyzer/ChangeLog:
	PR analyzer/101547
	* sm-file.cc (file_leak::emit): Handle m_arg being NULL.
	(file_leak::describe_final_event): Handle ev.m_expr being NULL.

gcc/testsuite/ChangeLog:
	PR analyzer/101547
	* gcc.dg/analyzer/pr101547.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2021-07-21 19:19:31 -04:00
David Malcolm
87bd75cd49 analyzer: fix ICE in binding_cluster::purge_state_involving [PR101522]
gcc/analyzer/ChangeLog:
	PR analyzer/101522
	* store.cc (binding_cluster::purge_state_involving): Don't change
	m_map whilst iterating through it.

gcc/testsuite/ChangeLog:
	PR analyzer/101522
	* g++.dg/analyzer/pr101522.C: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2021-07-21 19:16:08 -04:00
Thomas Schwinge
a61f6afbee OpenACC 'nohost' clause
Do not "compile a version of this procedure for the host".

	gcc/
	* tree-core.h (omp_clause_code): Add 'OMP_CLAUSE_NOHOST'.
	* tree.c (omp_clause_num_ops, omp_clause_code_name, walk_tree_1):
	Handle it.
	* tree-pretty-print.c (dump_omp_clause): Likewise.
	* omp-general.c (oacc_verify_routine_clauses): Likewise.
	* gimplify.c (gimplify_scan_omp_clauses)
	(gimplify_adjust_omp_clauses): Likewise.
	* tree-nested.c (convert_nonlocal_omp_clauses)
	(convert_local_omp_clauses): Likewise.
	* omp-low.c (scan_sharing_clauses): Likewise.
	* omp-offload.c (execute_oacc_device_lower): Update.
	gcc/c-family/
	* c-pragma.h (pragma_omp_clause): Add 'PRAGMA_OACC_CLAUSE_NOHOST'.
	gcc/c/
	* c-parser.c (c_parser_omp_clause_name): Handle 'nohost'.
	(c_parser_oacc_all_clauses): Handle 'PRAGMA_OACC_CLAUSE_NOHOST'.
	(OACC_ROUTINE_CLAUSE_MASK): Add 'PRAGMA_OACC_CLAUSE_NOHOST'.
	* c-typeck.c (c_finish_omp_clauses): Handle 'OMP_CLAUSE_NOHOST'.
	gcc/cp/
	* parser.c (cp_parser_omp_clause_name): Handle 'nohost'.
	(cp_parser_oacc_all_clauses): Handle 'PRAGMA_OACC_CLAUSE_NOHOST'.
	(OACC_ROUTINE_CLAUSE_MASK): Add 'PRAGMA_OACC_CLAUSE_NOHOST'.
	* pt.c (tsubst_omp_clauses): Handle 'OMP_CLAUSE_NOHOST'.
	* semantics.c (finish_omp_clauses): Likewise.
	gcc/fortran/
	* dump-parse-tree.c (show_attr): Update.
	* gfortran.h (symbol_attribute): Add 'oacc_routine_nohost' member.
	(gfc_omp_clauses): Add 'nohost' member.
	* module.c (ab_attribute): Add 'AB_OACC_ROUTINE_NOHOST'.
	(attr_bits, mio_symbol_attribute): Update.
	* openmp.c (omp_mask2): Add 'OMP_CLAUSE_NOHOST'.
	(gfc_match_omp_clauses): Handle 'OMP_CLAUSE_NOHOST'.
	(OACC_ROUTINE_CLAUSES): Add 'OMP_CLAUSE_NOHOST'.
	(gfc_match_oacc_routine): Update.
	* trans-decl.c (add_attributes_to_decl): Update.
	* trans-openmp.c (gfc_trans_omp_clauses): Likewise.
	gcc/testsuite/
	* c-c++-common/goacc/classify-routine-nohost.c: New file.
	* c-c++-common/goacc/classify-routine.c: Update.
	* c-c++-common/goacc/routine-2.c: Likewise.
	* c-c++-common/goacc/routine-nohost-1.c: New file.
	* c-c++-common/goacc/routine-nohost-2.c: Likewise.
	* g++.dg/goacc/template.C: Update.
	* gfortran.dg/goacc/classify-routine-nohost.f95: New file.
	* gfortran.dg/goacc/classify-routine.f95: Update.
	* gfortran.dg/goacc/pure-elemental-procedures-2.f90: Likewise.
	* gfortran.dg/goacc/routine-6.f90: Likewise.
	* gfortran.dg/goacc/routine-intrinsic-2.f: Likewise.
	* gfortran.dg/goacc/routine-module-1.f90: Likewise.
	* gfortran.dg/goacc/routine-module-2.f90: Likewise.
	* gfortran.dg/goacc/routine-module-3.f90: Likewise.
	* gfortran.dg/goacc/routine-module-mod-1.f90: Likewise.
	* gfortran.dg/goacc/routine-multiple-directives-1.f90: Likewise.
	* gfortran.dg/goacc/routine-multiple-directives-2.f90: Likewise.
	libgomp/
	* testsuite/libgomp.oacc-c-c++-common/routine-nohost-1.c: New
	file.
	* testsuite/libgomp.oacc-c-c++-common/routine-nohost-2.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/routine-nohost-2_2.c:
	Likewise.
	* testsuite/libgomp.oacc-fortran/routine-nohost-1.f90: Likewise.

Co-Authored-By: Joseph Myers <joseph@codesourcery.com>
Co-Authored-By: Cesar Philippidis <cesar@codesourcery.com>
2021-07-21 23:58:11 +02:00
Thomas Schwinge
6099b9cc8c [OpenACC] Fix '#pragma atomic update' typo in 'g++.dg/goacc/template.C'
[...]/g++.dg/goacc/template.C:58: warning: ignoring ‘#pragma atomic update’ [-Wunknown-pragmas]
       58 | #pragma atomic update
          |

Small fix-up for r229832 (commit 7a5e4956cc)
"[openacc] tile, independent, default, private and firstprivate support in
c/++".

	gcc/testsuite/
	* g++.dg/goacc/template.C: Fix '#pragma atomic update' typo.
2021-07-21 23:57:57 +02:00
David Malcolm
e0a7a6752d analyzer: fix issues with phi handling
The analyzer's state purging code was overzealously purging state
for ssa names that might be used within phi nodes, leading to
false positives from -Wanalyzer-use-of-uninitialized-value.

This patch updates phi handling in the analyzer to fix these issues.

gcc/analyzer/ChangeLog:
	* region-model.cc (region_model::handle_phi): Add "old_state"
	param and use it.
	(region_model::update_for_phis): Update so that all of the phi
	stmts are effectively handled simultaneously, rather than in
	order.
	* region-model.h (region_model::handle_phi): Add "old_state"
	param.
	* state-purge.cc (self_referential_phi_p): Replace with...
	(name_used_by_phis_p): ...this new function.
	(state_purge_per_ssa_name::process_point): Update to use the
	above, so that all phi stmts at a basic block are effectively
	considered simultaneously, and only consider the phi arguments for
	the pertinent in-edge.
	* supergraph.cc (cfg_superedge::get_phi_arg_idx): New.
	(cfg_superedge::get_phi_arg): Use the above.
	* supergraph.h (cfg_superedge::get_phi_arg_idx): New decl.

gcc/testsuite/ChangeLog:
	* gcc.dg/analyzer/explode-2.c: Remove xfail.
	* gcc.dg/analyzer/explode-2a.c: Remove expected leak warning on
	while stmt.
	* gcc.dg/analyzer/phi-2.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2021-07-21 17:24:08 -04:00
David Malcolm
6bbad96cd4 analyzer: fixes to -fdump-analyzer-state-purge for phi nodes
gcc/analyzer/ChangeLog:
	* state-purge.cc (state_purge_annotator::add_node_annotations):
	Rather than erroneously always using the NULL in-edge, determine
	each relevant in-edge, and print the appropriate data for each
	in-edge.  Use print_needed to print the data as comma-separated
	lists of SSA names.
	(print_vec_of_names): Add "within_table" param and use it.
	(state_purge_annotator::add_stmt_annotations): Factor out
	collation and printing code into...
	(state_purge_annotator::print_needed): ...this new function.
	* state-purge.h (state_purge_annotator::print_needed): New decl.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2021-07-21 17:22:45 -04:00
David Malcolm
8170358476 analyzer: show BB index in BEFORE_SUPERNODE's in-edge
This is useful for debugging how the analyzer handles phi nodes.

gcc/analyzer/ChangeLog:
	* program-point.cc (function_point::print): Show src BB index at
	BEFORE_SUPERNODE.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2021-07-21 17:21:22 -04:00
David Malcolm
dcdf6bb24e analyzer: tweak dumping of min_expr/max_expr
gcc/analyzer/ChangeLog:
	* svalue.cc (infix_p): New.
	(binop_svalue::dump_to_pp): Use it to print MIN_EXPR and MAX_EXPR
	in prefix form, rather than infix.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2021-07-21 17:19:31 -04:00
Martin Sebor
e279e32243 Fix typos in a comment.
gcc/ChangeLog:
	* tree-ssa-alias.c (walk_aliased_vdefs_1): Fix typos in a comment.
2021-07-21 14:35:56 -06:00
Bill Schmidt
133aa7e54f rs6000: Add int128 target check to pr101129.c (PR101531)
2021-07-21  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/testsuite/
	PR target/101531
	* gcc.target/powerpc/pr101129.c: Adjust.
2021-07-21 13:37:50 -05:00
Bill Schmidt
d3f5a1418b rs6000: Write output to the builtins init file, part 2 of 3
2021-07-21  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	* config/rs6000/rs6000-gen-builtins.c (write_init_bif_table):
	Implement.
2021-07-21 13:50:45 -04:00