Commit Graph

186597 Commits

Author SHA1 Message Date
Uros Bizjak
10722fb36d i386: Fix *udivmodsi4_pow2_zext_? patterns
In addition to the obvious cut-n-pasto where *udivmodsi4_pow2_zext_2
never matches, limit the range of the immediate operand to prevent
out of range immediate operand of AND instruction.

Found by inspection, the patterns rarely match (if at all), since
tree optimizers do the transformation before RTL is generated. But
according to the comment above *udivmod<mode>4_pow2, the constant can
materialize after expansion, so leave these patterns around for now.

2021-07-09  Uroš Bizjak  <ubizjak@gmail.com>

gcc/
	* config/i386/i386.md (*udivmodsi4_pow2_zext_1): Limit the
	log2 range of operands[3] to [1,31].
	(*udivmodsi4_pow2_zext_2): Ditto.  Correct insn RTX pattern.
2021-07-09 11:46:33 +02:00
Sergei Trofimovich
840fabd8e0 docs: don't split @smallexample in multiple @groups
Noticed multiple groups split in HTML documentation where example
was written in two columns:

                                                   ""
                                                   "
  (define_expand "addsi3"                          {
    [(match_operand:SI 0 "register_operand" "")      handle_add (...
     (match_operand:SI 1 "register_operand" "")      DONE;
     (match_operand:SI 2 "register_operand" "")]   }")

The change uses single @group/@endgroup to prevent such break.

gcc/ChangeLog:

	* doc/md.texi: Don't split @smallexample in multiple @groups.
2021-07-09 08:49:49 +01:00
Sergei Trofimovich
b5405babd8 docs: add missing 'see' word
gcc/ChangeLog:

	* doc/md.texi: Add missing 'see' word.
2021-07-09 08:49:44 +01:00
Andrew Pinski
5f2d3ff4e5 Improve early simplify and match for phiopt
Previously the idea was gimple_simplify_phiopt would call
resimplify with a NULL sequence but that sometimes fails
even if there was only one statement produced. The cases
where it fails is when there are two simplifications happen.
In the case of the min/max production, the first simplifcation
produces:
(convert (min @1 @2))
And then the convert is removed by a second one. The Min statement
will be in the sequence while the op will be a SSA name. This was
rejected before as could not produce something in the sequence.
So this patch changes the way resimplify is called to always passing
a pointer to the sequence and then decide based on if op is a
SSA_NAME or not.

OK? Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

	* tree-ssa-phiopt.c (phiopt_early_allow): Change arguments
	to take sequence and gimple_match_op.  Accept the case where
	op is a SSA_NAME and one statement in the sequence.
	Also allow constants.
	(gimple_simplify_phiopt): Always pass a sequence to resimplify.
	Update call to phiopt_early_allow.  Discard the sequence if not
	used.
2021-07-09 00:17:46 -07:00
Xi Ruoyao
3b33b1136d
testsuite: mips: use noinline attribute instead of -fno-inline
mips.exp does not support -fno-inline, causing the tests return "ERROR:
Unrecognised option: -fno-inline for dg-options ... ".

Use noinline attribute like other mips target tests, to workaround it.

gcc/testsuite/

	* gcc.target/mips/cfgcleanup-jalr2.c: Remove -fno-inline and add
	  __attribute__((noinline)).
	* gcc.target/mips/cfgcleanup-jalr3.c: Likewise.
2021-07-09 14:32:04 +08:00
Xi Ruoyao
82625a42e6
mips: check MSA support for vector modes [PR100760,PR100761,PR100762]
Check if the vector mode is really supported by MSA in certain cases,
instead of testing ISA_HAS_MSA.  Simply testing ISA_HAS_MSA can cause
ICE when MSA is enabled besides other MIPS SIMD extensions (notably,
Loongson MMI).

gcc/

	PR target/100760
	PR target/100761
	PR target/100762
	* config/mips/mips.c (mips_const_insns): Use MSA_SUPPORTED_MODE_P
	instead of ISA_HAS_MSA.
	(mips_expand_vec_unpack): Likewise.
	(mips_expand_vector_init): Likewise.

gcc/testsuite/

	PR target/100760
	PR target/100761
	PR target/100762
	* gcc.target/mips/pr100760.c: New test.
	* gcc.target/mips/pr100761.c: New test.
	* gcc.target/mips/pr100762.c: New test.
2021-07-09 14:25:06 +08:00
Kewen Lin
062c762ef2 rs6000: Support [u]mod<mode>3 for vector modulo insns
This patch is to make Power10 newly introduced vector
modulo instructions exploited in vectorized loops, it
just simply renames existing define_insns as standard
pattern names.

gcc/ChangeLog:

	* config/rs6000/vsx.md (mods_<mode>): Rename to...
	(mod<mode>3): ... this.
	(modu_<mode>): Rename to...
	(umod<mode>3): ... this.
	* config/rs6000/rs6000-builtin.def (MODS_V2DI, MODS_V4SI, MODU_V2DI,
	MODU_V4SI): Adjust.

gcc/testsuite/ChangeLog:

	* gcc.target/powerpc/mod-vectorize.c: New test.
2021-07-08 22:00:24 -05:00
Kewen Lin
df85baa568 test/rs6000: Add case to cover vector division
This patch is to add one test case to check if vectorizer
can exploit vector division instrutions newly introduced
by Power10.

gcc/testsuite/ChangeLog:

	* gcc.target/powerpc/div-vectorize-1.c: New test.
2021-07-08 22:00:18 -05:00
Kewen Lin
c3d1aa891c test/rs6000: Add cases to cover vector multiply
This patch is to add test cases to check if vectorizer
can exploit vector multiply instrutions on Power, some
of them are supported since Power8, the others are newly
introduced by Power10.

gcc/testsuite/ChangeLog:

	* gcc.target/powerpc/mul-vectorize-1.c: New test.
	* gcc.target/powerpc/mul-vectorize-2.c: New test.
2021-07-08 21:59:50 -05:00
GCC Administrator
fdc4d2a516 Daily bump. 2021-07-09 00:16:27 +00:00
Martin Sebor
79d3378c7d Move warning suppression to the ultimate callee.
Resolves:
PR bootstrap/101372 - -Warray-bounds in gcc/cp/module.cc causing bootstrap failure

gcc/cp/ChangeLog:

	PR bootstrap/101372
	* module.cc (identifier): Suppress warning.
	(module_state::read_macro_maps): Remove warning suppression.
	(module_state::install_macros): Ditto.
2021-07-08 16:36:15 -06:00
Martin Sebor
68b938fada testsuite: Remove an xfail.
gcc/testsuite/ChangeLog:

	* gcc.dg/Wstringop-overflow-43.c: Remove an xfail.
2021-07-08 16:22:25 -06:00
Martin Sebor
c232f07b93 Adjust expected output for LP32 [PR100451].
gcc/testsuite/ChangeLog:

	PR testsuite/100451
	* g++.dg/warn/Warray-bounds-20.C: Adjust expected output for LP32.
2021-07-08 16:08:20 -06:00
Martin Sebor
c68cac900a Avoid including <new> to make cross-compiler testing easy.
gcc/testsuite/ChangeLog:

	* g++.dg/warn/Warray-bounds-11.C: Avoid including <new>.
	* g++.dg/warn/Warray-bounds-13.C: Same.
2021-07-08 16:03:19 -06:00
Marek Polacek
dee00bf689 c++: Fix noexcept with unevaluated operand [PR101087]
It sounds plausible that this assert

  int f();
  static_assert(noexcept(sizeof(f())));

should pass: sizeof produces a std::size_t and its operand is not
evaluated, so it can't throw.  noexcept should only evaluate to
false for potentially evaluated operands.  Therefore I think that
check_noexcept_r shouldn't walk into operands of sizeof/decltype/
alignof/typeof.

	PR c++/101087

gcc/cp/ChangeLog:

	* cp-tree.h (unevaluated_p): New.
	* except.c (check_noexcept_r): Use it.  Don't walk into
	unevaluated operands.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/noexcept70.C: New test.
2021-07-08 17:38:49 -04:00
Jeff Law
b14ac7b29c Further improvements to H8 variable shift patterns
gcc/

	* config/h8300/shiftrotate.md (variable shifts): Expose condition
	code handling for the test before the loop.
2021-07-08 17:09:36 -04:00
Martin Jambor
763121ccd9
ipa-sra: Fix thinko when overriding safe_to_import_accesses (PR 101066)
The "new" IPA-SRA has a more difficult job than the previous
not-truly-IPA version when identifying situations in which a parameter
passed by reference can be passed into a third function and only thee
converted to one passed by value (and possibly "split" at the same
time).

In order to allow this, two conditions must be fulfilled.  First the
call to the third function must happen before any modifications of
memory, because it could change the value passed by reference.
Second, in order to make sure we do not introduce new (invalid)
dereferences, the call must postdominate the entry BB.

The second condition is actually not necessary if the caller function
is also certain to dereference the pointer but the first one must
still hold.  Unfortunately, the code making this overriding decision
also happen to trigger when the first condition is not fulfilled.
This is fixed in the following patch.

gcc/ChangeLog:

2021-06-16  Martin Jambor  <mjambor@suse.cz>

	PR ipa/101066
	* ipa-sra.c (class isra_call_summary): New member
	m_before_any_store, initialize it in the constructor.
	(isra_call_summary::dump): Dump the new field.
	(ipa_sra_call_summaries::duplicate): Copy it.
	(process_scan_results): Set it.
	(isra_write_edge_summary): Stream it.
	(isra_read_edge_summary): Likewise.
	(param_splitting_across_edge): Only override
	safe_to_import_accesses if m_before_any_store is set.

gcc/testsuite/ChangeLog:

2021-06-16  Martin Jambor  <mjambor@suse.cz>

	PR ipa/101066
	* gcc.dg/ipa/pr101066.c: New test.
2021-07-08 19:45:16 +02:00
Martin Sebor
9bf9f27ac6 Use Object Size Type zero for -Warray-bounds [PR101374].
Resolves:
PR bootstrap/101374 - -Warray-bounds accessing a member subobject as derived

gcc/cp/ChangeLog:
	PR bootstrap/101374
	* module.cc (module_state::read_macro_maps): Temporarily disable
	-Warray-bounds.
	(module_state::install_macros): Same.

gcc/ChangeLog:
	PR bootstrap/101374
	* gimple-array-bounds.cc (array_bounds_checker::check_mem_ref):
	Use Object Size Type 0 instead of 1.

gcc/testsuite/ChangeLog:
	PR bootstrap/101374
	* c-c++-common/Warray-bounds-3.c: Xfail assertion.
	* c-c++-common/Warray-bounds-4.c: Same.
2021-07-08 11:43:47 -06:00
Christophe Lyon
1ca642d785 testsuite: Add arm_arch_v7a_ok effective-target to pr57351.c
I've noticed that overriding cpu/arch flags when running the testsuite
can cause this test to fail rather than being skipped because of
incompatible flags combination.

Since the test forces -march=armv7-a, make sure it is accepted in
combination with the current runtestflags.

2021-07-08  Christophe Lyon  <christophe.lyon@foss.st.om>

	gcc/testsuite/
	* gcc.dg/debug/pr57351.c: Require arm_arch_v7a_ok
	effective-target.
2021-07-08 13:54:10 +00:00
Piotr Trojanek
43931c9782 [Ada] Tune detection of illegal occurrences of target_name
gcc/ada/

	* sem_ch5.adb (Analyze_Assignment): Clear Current_Assignment at
	exit.
	(Analyze_Target_Name): Prevent AST climbing from going too far.
2021-07-08 13:34:24 +00:00
Ed Schonberg
d45ee636a8 [Ada] Diagnose properly illegal uses of Target_Name
gcc/ada/

	* sem_ch5.adb (Analyze_Target_Name): Properly reject a
	Target_Name when it appears outside of an assignment statement,
	or within the left-hand side of one.
2021-07-08 13:34:24 +00:00
Bob Duff
8de68eb37c [Ada] Remove Unknown_ functions
gcc/ada/

	* einfo-utils.ads, einfo-utils.adb (Unknown_Alignment,
	Unknown_Component_Bit_Offset, Unknown_Component_Size,
	Unknown_Esize, Unknown_Normalized_First_Bit,
	Unknown_Normalized_Position, Unknown_Normalized_Position_Max,
	Unknown_RM_Size): Remove these functions.
	* exp_pakd.adb, exp_util.adb, fe.h, freeze.adb, layout.adb,
	repinfo.adb, sem_ch13.adb, sem_ch3.adb, sem_util.adb: Remove
	calls to these functions; do "not Known_..." instead.
	* gcc-interface/decl.c, gcc-interface/trans.c
	(Unknown_Alignment, Unknown_Component_Size, Unknown_Esize,
	Unknown_RM_Size): Remove calls to these functions; do
	"!Known_..." instead.
2021-07-08 13:34:23 +00:00
Eric Botcazou
4d743233ad [Ada] Use encoded names only with -fgnat-encodings=all
gcc/ada/

	* exp_dbug.adb (Get_Encoded_Name): Do not encode names of discrete
	types with custom bounds, except with -fgnat-encodings=all.
	* exp_pakd.adb (Create_Packed_Array_Impl_Type): Adjust comment.
2021-07-08 13:34:23 +00:00
Bob Duff
7c092960f0 [Ada] Transient scope cleanup
gcc/ada/

	* comperr.adb (Compiler_Abort): Call Sinput.Unlock, because if
	this is called late, then Source_Dump would crash otherwise.
	* debug.adb: Correct documentation of the -gnatd.9 switch.
	* exp_ch4.adb (Expand_Allocator_Expression): Add a comment.
	* exp_ch6.adb: Minor comment fixes.  Add assertion.
	* exp_ch6.ads (Is_Build_In_Place_Result_Type): Correct comment.
	* exp_ch7.adb, checks.ads: Minor comment fixes.
2021-07-08 13:34:23 +00:00
Doug Rupp
6e8b502cb6 [Ada] Rename sigtramp-vxworks-target.inc to sigtramp-vxworks-target.h
gcc/ada/

	* sigtramp-vxworks-target.inc: Rename to...
	* sigtramp-vxworks-target.h: ... this.
	* sigtramp-vxworks.c, Makefile.rtl: Likewise.
2021-07-08 13:34:22 +00:00
Ghjuvan Lacambre
d75dde1a72 [Ada] Duplicated D lines in ali files
gcc/ada/

	* lib-writ.ads: Mention SCOs dependency as reason for duplicates.
	* lib.ads (Units): Update documentation to mention duplicated
	units.
2021-07-08 13:34:22 +00:00
Ed Schonberg
99d6c1f8c2 [Ada] Spurious style message on missing overriding indicator
gcc/ada/

	* style.adb (Missing_Overriding): Do not emit message when
	parent of subprogram is a full type declaration.
2021-07-08 13:34:22 +00:00
Arnaud Charlet
3c18e32037 [Ada] AI12-0156 Use subtype indication in generalized iterators
gcc/ada/

	* par-ch5.adb (P_Iterator_Specification): Add support for access
	definition in loop parameter.
	* sem_ch5.adb (Check_Subtype_Indication): Renamed...
	(Check_Subtype_Definition): ... into this and check for conformance
	on access definitions, and improve error messages.
	(Analyze_Iterator_Specification): Add support for access definition
	in loop parameter.
2021-07-08 13:34:21 +00:00
Arnaud Charlet
629c82d729 [Ada] Spurious warning in generic instance
gcc/ada/

	* sem_util.ads, sem_util.adb
	(Apply_Compile_Time_Constraint_Error): New parameter
	Emit_Message.
	* sem_ch4.adb (Analyze_Selected_Component): Disable warning
	within an instance.
2021-07-08 13:34:21 +00:00
Eric Botcazou
a9c3a49750 [Ada] Fix violation of No_Implicit_Loops restriction for enumeration type
gcc/ada/

	* exp_imgv.adb: Add with and use clause for Restrict and Rident.
	(Build_Enumeration_Image_Tables): Do not generate the hash function
	if the No_Implicit_Loops restriction is active.
2021-07-08 13:34:21 +00:00
Piotr Trojanek
73f841cfca [Ada] Simplify redundant checks for non-empty lists
gcc/ada/

	* sem_ch12.adb, sem_ch6.adb, sem_ch9.adb, sprint.adb: Simplify
	checks for non-empty lists.
2021-07-08 13:34:20 +00:00
Piotr Trojanek
e959418a07 [Ada] Remove redundant condition for listing compilation units
gcc/ada/

	* par-ch10.adb (Unit_Display): Remove redundant condition; fix
	whitespace.
2021-07-08 13:34:20 +00:00
Piotr Trojanek
e581fbeab6 [Ada] Restore context on failure in loading of renamed child unit
gcc/ada/

	* lib-load.adb (Load): Replace early return with goto to properly
	restore context on failure.
2021-07-08 13:34:20 +00:00
Piotr Trojanek
df0783f81c [Ada] Replace low-level condition with a high-level call
gcc/ada/

	* lib-writ.adb (Ensure_System_Dependency): Simplify condition.
2021-07-08 13:34:20 +00:00
Piotr Trojanek
3711c2e5a0 [Ada] Fix style in comments and code related to compilation units
gcc/ada/

	* lib-load.adb (Load_Unit): Fix style in comment.
	* par-load.adb (Load): Likewise.
	* scng.adb (Initialize_Scanner): Fix whitespace.
2021-07-08 13:34:19 +00:00
Piotr Trojanek
62aae315f6 [Ada] Prevent infinite recursion when there is no expected unit
gcc/ada/

	* par-load.adb (Load): Don't remove unit, but flag it as
	erroneous and return.
2021-07-08 13:34:19 +00:00
Ghjuvan Lacambre
6105ebb782 [Ada] Fix use of single question mark in error message
gcc/ada/

	* exp_prag.adb (Expand_Pragma_Inspection_Point): Fix error
	message.
2021-07-08 13:34:19 +00:00
Yannick Moy
6cb2bcba3f [Ada] Skip types in error for test to compute array size
gcc/ada/

	* layout.adb (Layout_Type): Do not call Number_Dimensions if the
	type does not have First_Index set.
2021-07-08 13:34:19 +00:00
Ghjuvan Lacambre
cd4341ef95 [Ada] Prevent crash on inspection point for unfrozen entity
gcc/ada/

	* exp_prag.adb (Expand_Pragma_Inspection_Point): After expansion
	of the Inspection_Point pragma, check if referenced entities
	that have a freeze node are already frozen. If they aren't, emit
	a warning and turn the pragma into a no-op.
2021-07-08 13:34:18 +00:00
Yannick Moy
242c0f4772 [Ada] Fix on computation of packed array size in case of error
gcc/ada/

	* layout.adb (Layout_Type): Add guard before calling Expr_Value.
2021-07-08 13:34:18 +00:00
Yannick Moy
36fcfed88c [Ada] Compute sizes when possible for packed array with Component_Size
gcc/ada/

	* layout.adb (Layout_Type): Special case when RM_Size and Esize
	can be computed for packed arrays.
2021-07-08 13:34:18 +00:00
Steve Baird
5478d8a7ae [Ada] Unsynchronized concurrent access to a Boolean variable
gcc/ada/

	* rtsfind.ads, rtsfind.adb: Add support for finding the packages
	System.Atomic_Operations and
	System.Atomic_Operations.Test_And_Set and the declarations
	within that latter package of the type Test_And_Set_Flag and the
	function Atomic_Test_And_Set.
	* exp_ch11.adb (Expand_N_Exception_Declaration): If an exception
	is declared other than at library level, then we need to call
	Register_Exception the first time (and only the first time) the
	declaration is elaborated.  In order to decide whether to
	perform this call for a given elaboration of the declaration, we
	used to unconditionally use a (library-level) Boolean variable.
	Now we instead use a variable of type
	System.Atomic_Operations.Test_And_Set.Test_And_Set_Flag unless
	either that type is unavailable or a No_Tasking restriction is
	in effect (in which case we use a Boolean variable as before).
2021-07-08 13:34:18 +00:00
Arnaud Charlet
076c1a9157 [Ada] Add No_Tasking restriction is system.ads for bootstrap
gcc/ada/

	* gcc-interface/system.ads: Add No_Tasking restriction.
2021-07-08 13:34:17 +00:00
Ed Schonberg
b927d936e3 [Ada] Incorrect iteration over hashed containers after multiple Inserts
gcc/ada/

	* libgnat/a-cohama.ads: Introduce an equality operator over
	cursors.
	* libgnat/a-cohase.ads: Ditto.
	* libgnat/a-cohama.adb: Add body for "=" over cursors.
	(Insert): Do not set the Position component of the cursor that
	denotes the inserted element.
	* libgnat/a-cohase.adb: Ditto.
2021-07-08 13:34:17 +00:00
Arnaud Charlet
c5b1e8e9a5 [Ada] Make runtime code compatible with No_Dynamic_Accessibility_Checks
gcc/ada/

	* libgnat/a-cbdlli.adb, libgnat/a-cbhama.adb,
	libgnat/a-cbhase.adb, libgnat/a-cbmutr.adb,
	libgnat/a-cborma.adb, libgnat/a-cborse.adb,
	libgnat/a-cobove.adb, libgnat/a-textio.adb,
	libgnat/a-witeio.adb, libgnat/a-ztexio.adb: Make code compatible
	with No_Dynamic_Accessibility_Checks restriction.
2021-07-08 13:34:17 +00:00
Arnaud Charlet
a2f91a52b4 [Ada] Revert meaning of -gnatd_b
gcc/ada/

	* debug.adb, sem_util.adb: Revert meaning of -gnatd_b.
	* sem_res.adb: Minor reformatting.
2021-07-08 13:34:16 +00:00
Arnaud Charlet
3cb32058b4 [Ada] Make tools compatible with No_Dynamic_Accessibility_Checks
gcc/ada/

	* make.adb, osint.adb: Make code compatible with
	No_Dynamic_Accessibility_Checks restriction.
2021-07-08 13:34:16 +00:00
Piotr Trojanek
79a8b14237 [Ada] Avoid linear search when ensuring dependency on System
gcc/ada/

	* lib-writ.adb (Ensure_System_Dependency): Replace search in
	Lib.Units with a search in Lib.Unit_Names.
2021-07-08 13:34:16 +00:00
Piotr Trojanek
999a2dd00d [Ada] Simplify string manipulation related to preprocessing
gcc/ada/

	* sinput-l.adb (Load_File): Simplify foreword manipulation with
	concatenation; similar for filename with preprocessed output.
2021-07-08 13:34:16 +00:00
Richard Sandiford
2e9ef3929b vect: Remove always-true condition
vectorizable_reduction had code guarded by:

  if (STMT_VINFO_DEF_TYPE (stmt_info) == vect_reduction_def
      || STMT_VINFO_DEF_TYPE (stmt_info) == vect_double_reduction_def)

But that's always true after:

  if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_reduction_def
      && STMT_VINFO_DEF_TYPE (stmt_info) != vect_double_reduction_def
      && STMT_VINFO_DEF_TYPE (stmt_info) != vect_nested_cycle)
    return false;

  if (STMT_VINFO_DEF_TYPE (stmt_info) == vect_nested_cycle)
    {
      …
      return true;
    }

(I wasn't sure at first how the empty “else” for the first “if” above
was supposed to work.)

gcc/
	* tree-vect-loop.c (vectorizable_reduction): Remove always-true
	if condition.
2021-07-08 12:58:13 +01:00