181613 Commits

Author SHA1 Message Date
Ilya Leoshkevich
fbd4553d99 IBM Z: Update autovec-*-quiet-uneq expectations
Commit 229752afe315 ("VEC_COND_EXPR optimizations") has improved code
generation: we no longer need "vx x,x,-1", which turned out to be
superfluous.  Instead, we simply swap 0 and -1 arguments of the
preceding "vsel".

gcc/testsuite/ChangeLog:

2020-11-23  Ilya Leoshkevich  <iii@linux.ibm.com>

	* gcc.target/s390/zvector/autovec-double-quiet-uneq.c: Expect
	that "vx" is not emitted.
	* gcc.target/s390/zvector/autovec-float-quiet-uneq.c: Likewise.
2020-11-24 12:20:54 +01:00
Ulrich Weigand
c4fa3728ab Fix -ffast-math flags handling inconsistencies
This patch implements the following set of changes:

1. If a component flag of -ffast-math (or -funsafe-math-optimizations)
   is explicitly set (or reset) on the command line, this should override
   any implicit change due to -f(no-)fast-math, no matter in which order
   the flags come on the command line.  This change affects all flags.

2. Any component flag modified from its default by -ffast-math should
   be reset to the default by -fno-fast-math.  This was previously
   not done for the following flags:
      -fcx-limited-range
      -fexcess-precision=

3. Once -ffinite-math-only is true, the -f(no-)signaling-nans flag has
   no meaning (if we have no NaNs at all, it does not matter whether
   there is a difference between quiet and signaling NaNs).  Therefore,
   it does not make sense for -ffast-math to imply -fno-signaling-nans.
   (This is also a documentation change.)

4. -ffast-math is documented to imply -fno-rounding-math, however the
   latter setting is the default anyway; therefore it does not make
   sense to try to modify it from its default setting.

5. The __FAST_MATH__ preprocessor macro should be defined if and only
   if all the component flags of -ffast-math are set to the value that
   is documented as the effect of -ffast-math.  The following flags
   were currently *not* so tested:
     -fcx-limited-range
     -fassociative-math
     -freciprocal-math
     -frounding-math
   (Note that we should still *test* for -fno-rounding-math here even
   though it is not set as to 4.  -ffast-math -frounding-math should
   not set the __FAST_MATH__ macro.)
   This is also a documentation change.

2020-11-24  Ulrich Weigand  <uweigand@de.ibm.com>

gcc/

	* doc/invoke.texi (-ffast-math): Remove mention of -fno-signaling-nans.
	Clarify conditions when __FAST_MATH__ preprocessor macro is defined.

	* opts.c (common_handle_option): Pass OPTS_SET to set_fast_math_flags
	and set_unsafe_math_optimizations_flags.
	(set_fast_math_flags): Add OPTS_SET argument, and use it to avoid
	setting flags already explicitly set on the command line.  In the !set
	case, also reset x_flag_cx_limited_range and x_flag_excess_precision.
	Never reset x_flag_signaling_nans or x_flag_rounding_math.
	(set_unsafe_math_optimizations_flags): Add OPTS_SET argument, and use
	it to avoid setting flags already explicitly set on the command line.
	(fast_math_flags_set_p): Also test x_flag_cx_limited_range,
	x_flag_associative_math, x_flag_reciprocal_math, and
	x_flag_rounding_math.
2020-11-24 11:50:10 +01:00
Piotr Trojanek
607695354a [Ada] Fix inconsistent parameter of SPARK_Msg_NE
gcc/ada/

	* sem_prag.adb (Analyze_Global_Item): Call SPARK_Msg_NE with the
	entity, not with its identifier.
2020-11-24 05:16:07 -05:00
Arnaud Charlet
eafca96ffb [Ada] Cannot process -S -o with GNAT LLVM
gcc/ada/

	* opt.ads (Generate_Asm): New flag.
	* osint-c.adb (Set_Output_Object_File_Name): Accept any
	extension when generating assembly.
	* adabkend.adb (Scan_Compiler_Args): Recognize -S.
2020-11-24 05:16:07 -05:00
Piotr Trojanek
bfe5f951ce [Ada] Reuse Is_Packed_Array where possible
gcc/ada/

	* exp_attr.adb, exp_ch4.adb, exp_intr.adb, sem_ch8.adb,
	sem_res.adb, sem_type.adb, sem_util.adb: Reuse Is_Packed_Array.
2020-11-24 05:16:07 -05:00
Piotr Trojanek
cb9d41eb25 [Ada] Fix minor typos in comments
gcc/ada/

	* checks.adb (Apply_Access_Check): Remove unbalanced paren.
	* exp_attr.adb (Expand_N_Attribute_Reference): Fix typo in
	comment.
2020-11-24 05:16:06 -05:00
Justin Squirek
78004c41f7 [Ada] Compiler crash on assertion pragma in ghost region
gcc/ada/

	* sem_prag.adb (Analyze_Pragma): Mark relevant pragmas as ghost
	when they are within a ghost region.
2020-11-24 05:16:06 -05:00
Piotr Trojanek
42b91d9a74 [Ada] Reuse In_Same_List where possible
gcc/ada/

	* contracts.adb, freeze.adb, sem_ch12.adb, sem_prag.adb: Reuse
	In_Same_List.
2020-11-24 05:16:05 -05:00
Piotr Trojanek
45ce230785 [Ada] Simplify Is_Loop_Pragma
gcc/ada/

	* sem_prag.adb (Is_Loop_Pragma): Avoid repeated calls to
	Original_Node; remove unnecessary IF statement.
2020-11-24 05:16:05 -05:00
Piotr Trojanek
428b1317a5 [Ada] Replace chained if-then-elsif with case stmt for attribute ids
gcc/ada/

	* exp_spark.adb (Expand_SPARK_N_Attribute_Reference): Rewrite
	with a CASE statement.
2020-11-24 05:16:05 -05:00
Piotr Trojanek
3a6fa9a81b [Ada] Cleanup expansion of attribute Constrained
gcc/ada/

	* exp_attr.adb (Expand_N_Attribute_Reference): Replace calls to
	Sloc with a local constant Loc; remove call to
	Analyze_And_Resolve and return, which is exactly what happens
	anyway (and other branches in the Constrained declare block
	appear to rely on analysis, resolution and returning happening
	in all cases).
	* sem_util.adb: Remove useless parens.
2020-11-24 05:16:04 -05:00
Piotr Trojanek
1b55b8d70f [Ada] Recognize delta and extension aggregates as objects
gcc/ada/

	* sem_util.adb (Is_Object_Reference): Delta and extension
	aggregates are objects.
2020-11-24 05:16:04 -05:00
Ghjuvan Lacambre
7883a61044 [Ada] Implement No_Unrecognized_{Aspects,Pragmas} restrictions
gcc/ada/

	* libgnat/s-rident.ads (System.Rident): Register new restriction
	IDs.
	* par-ch13.adb (Get_Aspect_Specifications): Add restriction check.
	* par-prag.adb (Process_Restrictions_Or_Restriction_Warnings):
	Register No_Unrecognized_Aspects restriction.
	* sem_prag.adb (Analyze_Pragma): Add restriction check.
	* snames.ads-tmpl: Create restriction names.
2020-11-24 05:16:04 -05:00
Piotr Trojanek
218079efc5 [Ada] Accept local objects in the prefix of attribute Loop_Entry
gcc/ada/

	* sem_attr.adb (Declared_Within): Return True for objects
	declared within the attribute Loop_Entry prefix itself.
2020-11-24 05:16:04 -05:00
Yannick Moy
4f94320340 [Ada] Fix crash in GNATprove on inlined subprogram in default expression
gcc/ada/

	* sem_ch3.adb (Process_Discriminants): Correctly set right
	context for analyzing default value of discriminant.
2020-11-24 05:16:03 -05:00
Arnaud Charlet
fa65696761 [Ada] Wrong resolution of universal_access = operators
gcc/ada/

	* sem_type.adb (Add_One_Interp.Is_Universal_Operation): Account
	for universal_access = operator.
	(Disambiguate): Take into account preference on universal_access
	= operator when relevant.
	(Disambiguate.Is_User_Defined_Anonymous_Access_Equality): New.
2020-11-24 05:16:03 -05:00
Arnaud Charlet
13209acd64 [Ada] Premature finalization on build in place return and case expression
gcc/ada/

	* exp_util.adb (Is_Finalizable_Transient): Take into account return
	statements containing N_Expression_With_Actions. Also clean up a
	condition to make it more readable.
	* exp_ch6.adb: Fix typo.
2020-11-24 05:16:03 -05:00
Eric Botcazou
2afd55a57d [Ada] Small cleanup in the Ada.Text_IO hierarchy
gcc/ada/

	* libgnat/a-wtdeio.adb (TFT): Delete and adjust throughout.
	* libgnat/a-wtenau.adb (TFT): Likewise.
	* libgnat/a-wtfiio.adb (TFT): Likewise.
	* libgnat/a-wtflio.adb (TFT): Likewise.
	* libgnat/a-wtinio.adb (TFT): Likewise.
	* libgnat/a-wtinio__128.adb (TFT): Likewise.
	* libgnat/a-wtmoio.adb (TFT): Likewise.
	* libgnat/a-wtmoio__128.adb (TFT): Likewise.
	* libgnat/a-ztdeio.adb (TFT): Likewise.
	* libgnat/a-ztenau.adb (TFT): Likewise.
	* libgnat/a-ztfiio.adb (TFT): Likewise.
	* libgnat/a-ztflio.adb (TFT): Likewise.
	* libgnat/a-ztinio.adb (TFT): Likewise.
	* libgnat/a-ztinio__128.adb (TFT): Likewise.
	* libgnat/a-ztmoio.adb (TFT): Likewise.
	* libgnat/a-ztmoio__128.adb (TFT): Likewise.
2020-11-24 05:16:02 -05:00
Arnaud Charlet
80a09e0228 [Ada] AI12-0394 Named Numbers and User-Defined Numeric Literals
gcc/ada/

	* sem_ch13.adb (Validate_Literal_Aspect): Add support for named
	numbers and in particular overload of the Real_Literal function.
	* sem_res.adb (Resolve): Add support for named numbers in
	Real_Literal and Integer_Literal resolution.
	* einfo.adb, einfo.ads (Related_Expression,
	Set_Related_Expression): Allow E_Function.
	* uintp.ads (UI_Image_Max): Bump size of buffer to avoid loosing
	precision.
	* sem_eval.adb: Fix typo in comment.
	* libgnat/a-nbnbin.adb, libgnat/a-nbnbin.ads (From_String):
	Return a Valid_Big_Integer.
	* libgnat/a-nbnbre.adb, libgnat/a-nbnbre.ads (From_String): New
	variant taking two strings. Return a Valid_Big_Real.
2020-11-24 05:16:02 -05:00
Eric Botcazou
dcb1cad0e0 [Ada] Fix internal error on multiple nested instantiations
gcc/ada/

	* sem_ch12.adb (Analyze_Associations) <Explicit_Freeze_Check>: Test
	that the instance is in a statement sequence instead of local scope.
	(Freeze_Subprogram_Body): Use the special delayed placement with
	regard to the parent instance only if its Sloc is strictly greater.
	(Install_Body): Likewise.
2020-11-24 05:16:02 -05:00
Steve Baird
e269fedf8c [Ada] Fix String_Literal aspect spec checking problem for scalars.
gcc/ada/

	* sem_ch13.adb (Validate_Literal_Aspect): Call to Base_Type
	needed in order to correctly check result type of String_Literal
	function when the first named subtype differs from the base
	type (e.g.:
	type T is range 1 .. 10 with String_Literal => ... ;
	).
2020-11-24 05:16:01 -05:00
Yannick Moy
91592d05cd [Ada] Handle correctly current instance of PO in local subprogram Global
gcc/ada/

	* sem_prag.adb (Analyze_Global_Item): Handle specially the
	current instance of a PO.
	* sem_util.ads (Is_Effectively_Volatile,
	Is_Effectively_Volatile_For_Reading): Add parameter
	Ignore_Protected.
	* sem_util.adb (Is_Effectively_Volatile,
	Is_Effectively_Volatile_For_Reading): Add parameter
	Ignore_Protected to compute the query results ignoring protected
	objects/types.
	(Is_Effectively_Volatile_Object,
	Is_Effectively_Volatile_Object_For_Reading): Adapt to new
	signature.
2020-11-24 05:16:01 -05:00
Ghjuvan Lacambre
ac9ed5cb26 [Ada] Documentation: update -gnatyk description
gcc/ada/

	* doc/gnat_ugn/building_executable_programs_with_gnat.rst:
	Update documentation on -gnatyk.
	* gnat_ugn.texi: Regenerate.
2020-11-24 05:16:01 -05:00
Yannick Moy
91edb3f66c [Ada] Fix spurious error on child library-level subprogram with aspects
gcc/ada/

	* sem_ch10.adb (Analyze_Compilation_Unit): Move aspects from
	body to the newly created spec.
2020-11-24 05:16:01 -05:00
Arnaud Charlet
1cc9ecae0a [Ada] Wrong finalization in call with if expression
gcc/ada/

	* exp_ch6.adb (Add_Cond_Expression_Extra_Actual): Simplify
	handling of function calls and remove bug in handling of
	transient objects.  Minor reformatting along the way.
2020-11-24 05:16:00 -05:00
Arnaud Charlet
7f0942424b [Ada] Implement Big_Integer.From_String fully
gcc/ada/

	* libgnat/a-nbnbin.adb (From_String): Implement fully.
2020-11-24 05:16:00 -05:00
Piotr Trojanek
3e65b68dd6 [Ada] Fix resolution of subtype_indication in delta aggregates
gcc/ada/

	* sem_aggr.adb (Resolve_Delta_Array_Aggregate): If the choice is
	a subtype_indication then call
	Resolve_Discrete_Subtype_Indication; both for choices
	immediately inside array delta aggregates and inside
	iterated_component_association within array delta aggregates.
2020-11-24 05:16:00 -05:00
Piotr Trojanek
3ac0642304 [Ada] Use high-level Present instead of low-level equality test
gcc/ada/

	* lib-load.adb, lib-writ.adb, lib.adb, par-load.adb,
	rtsfind.adb, sem_ch10.adb: Use Present where possible.
2020-11-24 05:16:00 -05:00
Yannick Moy
41273281ce [Ada] Reject Global/Depends contracts on null procedures
gcc/ada/

	* sem_prag.adb (Analyze_Depends_Global): Reject Global and
	Depends on null procedure.
2020-11-24 05:15:59 -05:00
Arnaud Charlet
9cfd2c38f3 [Ada] Wrong handling of _ in Big_Reals.From_String
gcc/ada/

	* libgnat/a-nbnbre.adb (From_String): Handle properly '_'
	characters.
2020-11-24 05:15:59 -05:00
Piotr Trojanek
02fb12801b [Ada] Remove SPARK-specific expansion of array aggregates
gcc/ada/

	* exp_spark.adb (Expand_SPARK_Array_Aggregate,
	Expand_SPARK_N_Aggregate): Remove, no longer needed.
	* sem_aggr.adb (Resolve_Iterated_Component_Association): Only
	remove references in the analyzed expression when generating
	code and the expression needs to be analyzed anew after being
	rewritten into a loop.
2020-11-24 05:15:59 -05:00
Eric Botcazou
2307a1aeb8 [Ada] Document characteristics of decimal fixed point types
gcc/ada/

	* doc/gnat_rm/implementation_defined_characteristics.rst: Complete
	entry of 3.5.9(10).
	* gnat_rm.texi: Regenerate.
2020-11-24 05:15:59 -05:00
Jakub Jelinek
a1dd66b108 i386: Add *setcc_hi_1* define_insn_and_split [PR97950]
As the following testcase shows, unlike char, int or long long sized
__builtin_*_overflow{,_p}, for short sized one in most cases the ce1 pass
doesn't optimize the jo/jno or jc/jnc jumps with setting of a pseudo to 0/1
into seto/setc.  The reason is missing *setcc_hi_1* pattern.  The following
patch implements it using mode iterators so that on i486 and pentium?
one can get the zero extension through and instead of movzbw.

2020-11-24  Jakub Jelinek  <jakub@redhat.com>

	PR target/97950
	* config/i386/i386.md (*setcc_si_1_and): Macroize into...
	(*setcc_<mode>_1_and): New define_insn_and_split with SWI24 iterator.
	(*setcc_si_1_movzbl): Macroize into...
	(*setcc_<mode>_1_movzbl): New define_insn_and_split with SWI24
	iterator.

	* gcc.target/i386/pr97950.c: New test.
2020-11-24 10:45:40 +01:00
Jakub Jelinek
4adfcea0a1 middle-end: Prefer no RMW in __builtin_clear_padding implementation where possible
Currently the __builtin_clear_padding expansion code emits no code for
full words that don't have any padding bits, and most of the time if
the only padding bytes are from the start of the word it attempts to merge
them with previous padding store (via {}) or if the only padding bytes are
from the end of the word, it attempts to merge it with following padding
bytes.  For everything else it was using a RMW, except when it found
an aligned char/short/int covering all the padding bytes and all those
padding bytes were all ones in that store.

The following patch changes it, such that we only use RMW if the padding has
any bytes which have some padding and some non-padding bits (i.e. bitfields
are involved), often it is the same amount of instructions in the end and
avoids being thread-unsafe unless necessary (and avoids having to wait for
the reads to make it into the CPU).  So, if there are no bitfields,
the function will just store some zero bytes, shorts, ints, long longs etc.
where needed.

2020-11-24  Jakub Jelinek  <jakub@redhat.com>

	* gimple-fold.c (clear_padding_flush): If a word contains only 0
	or 0xff bytes of padding other than all set, all clear, all set
	followed by all clear or all clear followed by all set, don't emit
	a RMW operation on the whole word or parts of it, but instead
	clear the individual bytes of padding.  For paddings of one byte
	size, don't use char[1] and {}, but instead just char and 0.
2020-11-24 10:44:32 +01:00
Jakub Jelinek
a40d5772ff testsuite: Add testcase for already fixed bug [PR97964]
This testcase started failing with r8-2090 and works again starting
with r11-4755.

2020-11-24  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/97964
	* gcc.dg/tree-ssa/pr97964.c: New test.
2020-11-24 10:42:56 +01:00
Thomas Schwinge
8c3aa359ce More explicit checking of which OMP constructs we're expecting, part II
In particular, more precisely highlight what applies generally vs. the special
handling for the current 'parloops'-based OpenACC 'kernels' implementation.

	gcc/
	* omp-expand.c (expand_oacc_for): More explicit checking of which
	OMP constructs we're expecting.
2020-11-24 10:28:04 +01:00
Thomas Schwinge
f72175357d [testsuite] Avoid Tcl 8.5-specific behavior
gcc/
	* doc/install.texi (Prerequisites) <Tcl>: Add comment.
	gcc/testsuite/
	* c-c++-common/goacc/kernels-decompose-1.c: Avoid Tcl 8.5-specific
	behavior.
	* c-c++-common/goacc/kernels-decompose-2.c: Likewise.
	* gfortran.dg/goacc/kernels-decompose-1.f95: Likewise.
	* gfortran.dg/goacc/kernels-decompose-2.f95: Likewise.
	libgomp/
	* testsuite/libgomp.oacc-c-c++-common/kernels-decompose-1.c: Avoid
	Tcl 8.5-specific behavior.
	* testsuite/libgomp.oacc-fortran/pr94358-1.f90: Likewise.

Reported-by: David Edelsohn <dje.gcc@gmail.com>
2020-11-24 10:29:35 +01:00
Thomas Schwinge
54f72078fc [testsuite] Emit 'warning' instead of 'error' diagnostics for 'dg-optimized', 'dg-missed'
The diagnostics produced by 'dg-optimized', 'dg-missed' aren't error
diagnostics (fatal, meaning: causes compilation to fail) but rather warning
diagnostics (non-fatal, doesn't cause compilation to fail).  Thus, same as
'dg-message', these should use 'saved-dg-warning' instead of 'saved-dg-error',
which then prints: "(test for *warnings*, line [...]) instead of currently:
"(test for *errors*, line [...])".

This is a small bug-fix for commit ed2d9d3720adef3a260b8a55e17e744352a901fc
"dumpfile.c: use prefixes other than 'note: ' for
MSG_{OPTIMIZED_LOCATIONS|MISSED_OPTIMIZATION}", which added 'dg-optimized',
'dg-missed'.

	gcc/testsuite/
	* lib/gcc-dg.exp (dg-optimized, dg-missed): Use 'saved-dg-warning'
	instead of 'saved-dg-error'.
2020-11-24 10:28:55 +01:00
Thomas Schwinge
24b553d0f7 [testsuite] Enable column location checking for 'dg-optimized', 'dg-missed'
'process-message' would like the 'msgprefix' argument without trailing space.

This is a small bug-fix for commit ed2d9d3720adef3a260b8a55e17e744352a901fc
"dumpfile.c: use prefixes other than 'note: ' for
MSG_{OPTIMIZED_LOCATIONS|MISSED_OPTIMIZATION}", which added 'dg-optimized',
'dg-missed'.

	gcc/testsuite/
	* lib/gcc-dg.exp (dg-optimized, dg-missed): Fix 'process-message'
	call.
	* gcc.dg/vect/nodump-vect-opt-info-1.c: Demonstrate.
	* gcc.dg/vect/nodump-vect-opt-info-2.c: Likewise.
2020-11-24 10:28:04 +01:00
Jakub Jelinek
2aaf44a902 openmp: Fix C ICE on OpenMP atomics
c_parser_binary_expression was using build2 to create a temporary holder
for binary expression that c_parser_atomic and c_finish_omp_atomic can then
handle.  The latter performs then all the needed checking.

Unfortunately, build2 performs some checking too, e.g. PLUS_EXPR vs.
POINTER_PLUS_EXPR or matching types of the arguments, nothing we can guarantee
at the parsing time.  So we need something like C++ build_min_nt*.  This
patch implements that inline.

2020-11-24  Jakub Jelinek  <jakub@redhat.com>

	PR c/97958
	* c-parser.c (c_parser_binary_expression): For omp atomic binary
	expressions, use make_node instead of build2 to avoid checking build2
	performs.

	* c-c++-common/gomp/pr97958.c: New test.
2020-11-24 09:04:28 +01:00
Jakub Jelinek
4866b2f5db middle-end, c++: Treat shifts by negative as undefined [PR96929]
The PR38359 change made the -1 >> x to -1 optimization less useful by
requiring that the x must be non-negative.
Shifts by negative amount are UB, but we for historic reasons had in some
(but not all) places some hack to treat shifts by negative value as the
other direction shifts by the negated amount.

The following patch just removes that special handling, instead we punt on
optimizing those (and ideally path isolation should catch that up and turn
those into __builtin_unreachable, perhaps with __builtin_warning next to
it).  Folding the shifts in some places as if they were rotates and in other
as if they were saturating just leads to inconsistencies.

For C++ constexpr diagnostics and -fpermissive, I've added code to pretend
fold-const.c has not changed, without -fpermissive it will be an error
anyway and I think it is better not to change all the diagnostics.

During x86_64-linux and i686-linux bootstrap/regtest, my statistics
gathering patch noted 185 unique -m32/-m64 x TU x function_name x shift_kind
x fold-const/tree-ssa-ccp cases.  I have investigated the
64 ../../gcc/config/i386/i386.c x86_output_aligned_bss LSHIFT_EXPR wide_int_bitop
64 ../../gcc/config/i386/i386-expand.c emit_memmov LSHIFT_EXPR wide_int_bitop
64 ../../gcc/config/i386/i386-expand.c ix86_expand_carry_flag_compare LSHIFT_EXPR wide_int_bitop
64 ../../gcc/expmed.c expand_divmod LSHIFT_EXPR wide_int_bitop
64 ../../gcc/lra-lives.c process_bb_lives LSHIFT_EXPR wide_int_bitop
64 ../../gcc/rtlanal.c nonzero_bits1 LSHIFT_EXPR wide_int_bitop
64 ../../gcc/varasm.c optimize_constant_pool.isra LSHIFT_EXPR wide_int_bitop
cases and all of them are either during jump threading (dom) or during PRE.
For jump threading, the most common case is 1 << floor_log2 (whatever) where
floor_log2 is return HOST_BITS_PER_WIDE_INT - 1 - clz_hwi (x);
and clz_hwi is if (x == 0) return HOST_BITS_PER_WIDE_INT; return __builtin_clz* (x);
and so has range [-1, 63] and a comparison against == 0 which makes the
threader think it might be nice to jump thread the case leading to 1 << -1.
I think it is better to keep the 1 << -1 s in the IL for this and let path
isolation turn that into __builtin_unreachable () if the user wishes so.

2020-11-24  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/96929
	* fold-const.c (wide_int_binop) <case LSHIFT_EXPR, case RSHIFT_EXPR>:
	Return false on negative second argument rather than trying to handle
	it as shift in the other direction.
	* tree-ssa-ccp.c (bit_value_binop) <case LSHIFT_EXPR,
	case RSHIFT_EXPR>: Punt on negative shift count rather than trying
	to handle it as shift in the other direction.
	* match.pd (-1 >> x to -1): Remove tree_expr_nonnegative_p check.

	* constexpr.c (cxx_eval_binary_expression): For shifts by constant
	with MSB set, emulate older wide_int_binop behavior to preserve
	diagnostics and -fpermissive behavior.

	* gcc.dg/tree-ssa/pr96929.c: New test.
2020-11-24 09:03:17 +01:00
Jeff Law
4cd35cf3fd Fix expected output after recent changes
gcc/testsuite
	* gcc.dg/tree-ssa/pr23401.c: Update expected output.
	* gcc.dg/tree-ssa/pr27810.c: Update expected output.
	* gcc.dg/tree-ssa/slsr-8.c: Update expected output.
2020-11-23 21:34:24 -07:00
Kewen Lin
ab1d52b561 test: Update some cases for vect_partial_vectors_usage_1
Commit r11-3393 improved the epilogue loop handling of partial
vectors and we won't use partial vectors to vectorize a single
iteration scalar loop any more.

The affected test cases have only one single iteration in their
epilogues, so we shouldn't expect the vectorization with
partial vector there.

Tested with explicit --param=vect-partial-vector-usage=1 and
default enablement.

gcc/testsuite/ChangeLog:

	* gcc.dg/vect/slp-perm-1.c: Adjust for partial vectors.
	* gcc.dg/vect/slp-perm-5.c: Likewise.
	* gcc.dg/vect/slp-perm-6.c: Likewise.
	* gcc.dg/vect/slp-perm-7.c: Likewise.
2020-11-23 20:33:37 -06:00
Prathamesh Kulkarni
5700973f4a tree-opt: Fix segfault in tree-if-conv.c with -march=armv8.2-a+sve [PR97849]
The issue here is that rpo vn may eliminate target ssa_name referred to in
redundant_ssa_names, and thus ifcvt_local_dce may replace candidate
ssa_name with invalid ssa_name resulting in incorrect IR. The patch simply
does ssa_name replacement before calling do_rpo_vn, which fixes the issue.

gcc/
2020-11-24  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>

	PR tree-optimization/97849
	* tree-if-conv.c (tree_if_conversion): Move ssa_name
	replacement code from ifcvt_local_dce to this function
	before calling do_rpo_vn.

gcc/testsuite/
2020-11-24  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>

	PR tree-optimization/97849
	* gcc.dg/tree-ssa/pr97849.c: New test.
2020-11-24 06:57:46 +05:30
Martin Sebor
6692c400f2 Dump type attributes in dump_function_to_file.
gcc/ChangeLog:

	* tree-cfg.c (dump_function_to_file): Print type attributes
	and return type.

gcc/testsuite/ChangeLog:
	* gcc.dg/attr-access-5.c: New test.
2020-11-23 17:19:26 -07:00
GCC Administrator
8e6198d0f8 Daily bump. 2020-11-24 00:16:44 +00:00
Joseph Myers
ed431431e0 c: Allow comparison of pointers to complete and incomplete types for C11 [PR95630]
As noted in bug 95630, C11 removed a restriction in C99 on comparing
pointers to compatible complete and incomplete types (this was one of
the changes in N1439, which was largely a terminological change to
make incomplete types a subset of object types rather than a different
kind of type).  Implement that change by using pedwarn_c99 with
OPT_Wpedantic for this diagnostic.

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

gcc/c/
2020-11-23  Joseph Myers  <joseph@codesourcery.com>

	PR c/95630
	* c-typeck.c (build_binary_op): Use pedwarn_c99 with OPT_Wpedantic
	for comparisons of complete and incomplete pointers.

gcc/testsuite/
2020-11-23  Joseph Myers  <joseph@codesourcery.com>

	PR c/95630
	* gcc.dg/c11-compare-incomplete-1.c,
	gcc.dg/c11-compare-incomplete-2.c,
	gcc.dg/c99-compare-incomplete-1.c,
	gcc.dg/c99-compare-incomplete-2.c: New tests.
2020-11-23 23:28:58 +00:00
Martin Jambor
f38a33a274 ipa: special pass-through op for Fortran strides
when Fortran functions pass array descriptors they receive as a
parameter to another function, they actually rebuild it.  Thanks to
work done mainly by Feng, IPA-CP can already handle the cases when
they pass directly the values loaded from the original descriptor.
Unfortunately, perhaps the most important one, stride, is first
checked against zero and is replaced with one in that case:

  _12 = *a_11(D).dim[0].stride;
  if (_12 != 0)
    goto <bb 4>; [50.00%]
  else
    goto <bb 3>; [50.00%]

  <bb 3>
    // empty BB
  <bb 4>
  # iftmp.22_9 = PHI <_12(2), 1(3)>
   ...
   parm.6.dim[0].stride = iftmp.22_9;
   ...
   __x_MOD_foo (&parm.6, b_31(D));

in the most important and hopefully common cases, the incoming value
is already 1 and we fail to propagate it.

I would therefore like to propose the following way of encoding this
situation in pass-through jump functions using using ASSERTT_EXPR
operation code meaning that if the incoming value is the same as the
"operand" in the jump function, it is passed on, otherwise the result
is unknown.  This of course captures only the single (but most
important) case but is an improvement and does not need enlarging the
jump function structure and is simple to pattern match.  Encoding that
zero needs to be changed to one would need another field and matching
it would be slightly more complicated too.

gcc/
2020-06-12  Martin Jambor  <mjambor@suse.cz>

	* ipa-prop.h (ipa_pass_through_data): Expand comment describing
	operation.
	* ipa-prop.c (analyze_agg_content_value): Detect new special case and
	encode it as ASSERT_EXPR.
	* ipa-cp.c (values_equal_for_ipcp_p): Move before
	ipa_get_jf_arith_result.
	(ipa_get_jf_arith_result): Special case ASSERT_EXPR.

gcc/testsuite/
2020-06-12  Martin Jambor  <mjambor@suse.cz>
	* gfortran.dg/ipcp-array-2.f90: New test.
2020-11-23 23:52:29 +01:00
Jeff Law
f80565da33 Adjust rtx_costs for h8300
So the primary purpose of this patch is to make it easier to write tests for
removal of useless test/compare insns on the H8.

In simplest terms the costing model in the H8 port tends to encourage changing
something like:

  x = y + 4;
  if (x == 0)

into:

  x = y + 4;
  if (y == -4)

This is a marginal de-optimization on the H8.  So fixing it makes the code
ever-so-slightly better in isolation.   Fixing this also improves redundant
test/compare elimination and makes writing tests for redundant test/compare
elimination far easier.

gcc/
	* config/h8300/h8300.c (h8300_rtx_costs): Handle the various
	comparison rtx codes too.
2020-11-23 13:06:11 -07:00
Iain Sandoe
53a9065066 config.sub, config.guess : Import upstream 2020-11-07.
This imports from:

sha1 77632d92f25e26b95c64afd3700d51bd03587613
Date:   2020-11-07 04:46:23 +0000

ChangeLog:

	* config.guess: Import latest upstream.
	* config.sub: Import latest upstream.
2020-11-23 19:30:01 +00:00