Commit Graph

181599 Commits

Author SHA1 Message Date
Jonathan Wakely
10522ed108 libstdc++: Fix some more deadlocks in tests [PR 97936]
The missed notifications fixed in r11-5383 also happen in some other
tests which have similar code.

libstdc++-v3/ChangeLog:

	PR libstdc++/97936
	* testsuite/29_atomics/atomic/wait_notify/bool.cc: Fix missed
	notifications by making the new thread wait until the parent
	thread is waiting on the condition variable.
	* testsuite/29_atomics/atomic/wait_notify/pointers.cc: Likewise.
	* testsuite/29_atomics/atomic_flag/wait_notify/1.cc: Likewise.
	* testsuite/29_atomics/atomic_ref/wait_notify.cc: Likewise.
2020-11-26 16:15:52 +00:00
Jonathan Wakely
10ee46adf4 libstdc++: Add "futex" and "gthreads" effective-target keywords
This adds a new "futex" effective-target keyword that can be used to
selectively enable/disable tests based on _GLIBCXX_HAVE_LINUX_FUTEX,
instead of checking for that macro in the code.

It also adds "gthreads" as another one, to make the result of the
dg-require-gthreads directive usable in target selectors.

With these new keywords two tests that are currently only run for linux
can also be run for targets using gthr-single.h (e.g. AIX single-thread
multilib, and targets without a gthreads implementation).

libstdc++-v3/ChangeLog:

	* testsuite/18_support/96817.cc: Use new effective-target
	keywords to select supported targets more effectively.
	* testsuite/30_threads/call_once/66146.cc: Likewise.
	* testsuite/lib/libstdc++.exp (check_effective_target_futex):
	Define new proc.
	(check_effective_target_gthreads): Define new proc to replace
	dg-require-gthreads.
2020-11-26 16:15:52 +00:00
Eric Botcazou
294e72e9ac Fix PR target/96607
After 15 years trying to find out what can go into the delay slot of
the call to __tls_get_addr with the Solaris linker, it's now time to
concede defeat and consider it as not to be filled.

gcc/ChangeLog:
	PR target/96607
	* config/sparc/sparc-protos.h (eligible_for_call_delay): Delete.
	* config/sparc/sparc.c (eligible_for_call_delay): Likewise.
	* config/sparc/sparc.md (in_call_delay): Likewise.
	(tls_delay_slot): New attribute.
	(define_delay [call]): Use in_branch_delay.
	(tgd_call<P:mode>): Set type to call_no_delay_slot when
	tls_delay_slot is false.
	(tldm_call<P:mode>): Likewise.
2020-11-26 16:42:31 +01:00
Jakub Jelinek
a3ebc13492 match.pd: Use ranges to optimize some x * y / y to x [PR97997]
For signed integers with undefined overflow we already optimize x * y / y
into x, but for signed integers with -fwrapv or unsigned integers we don't.
The following patch allows optimizing that into just x if value ranges
prove that x * y will never overflow.
It uses the global SSA_NAME_RANGE_INFO only, because like mentioned
in another PR we don't currently have a way to tell the ranger from match.pd
the use stmt (and we'd need in that case to tell ranger to only follow
SSA_NAME_DEF_STMTs + SSA_NAME_RANGE_INFO and never go in the other
direction, as following immediate uses seems forbidden in match.pd).
Another possibility would be to optimize this during vrp, but on the
other side the optimization itself is match.pd-ish.

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

	PR tree-optimization/97997
	* match.pd ((t * 2) / 2) -> t): Optimize even for defined
	overflow if ranges prove there is no overflow.

	* gcc.dg/tree-ssa/pr97997-1.c: New test.
	* gcc.dg/tree-ssa/pr97997-2.c: New test.
2020-11-26 16:24:07 +01:00
Richard Biener
c76b3f9e83 tree-optimization/97953 - fix bougs range recorded by EVRP
EVRP records some ranges from asserts into SSA_NAME_RANGE_INFO
but fails to assert that the condition the range is derived from
is always true after the SSA names definition.  The patch implements
the simplest post-dominance check, basic-block equality.

2020-11-26  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/97953
	* gimple-ssa-evrp-analyze.c
	(evrp_range_analyzer::record_ranges_from_incoming_edge): Make
	sure the condition post-dominates the SSA definition before
	recording into SSA_NAME_RANGE_INFO.

	* gcc.dg/pr97953.c: New testcase.
2020-11-26 16:18:07 +01:00
Richard Biener
5c197b83e1 tree-optimization/98015 - fix VEC_COND_EXPR lowering condition
This fixes the condition to match the comment and only lower
VECTOR_BOOLEAN_TYPE_P VEC_COND_EXPRs.

2020-11-26  Richard Biener  <rguenther@suse.de>

	* gimple-isel.cc (gimple_expand_vec_cond_expr): Only
	lower VECTOR_BOOLEAN_TYPE_P VEC_COND_EXPRs.
2020-11-26 16:17:36 +01:00
Andrew Stubbs
d24a4c8c42 Fix early-debug relocations
The relocation symbols were inadvertantly wiped when the type was set in
mkoffload.

gcc/ChangeLog

	* config/gcn/mkoffload.c (copy_early_debug_info): Don't wipe
	relocation symbols.
2020-11-26 14:28:44 +00:00
Uros Bizjak
715a8bc8d4 i386: Cleanup argument handling in ix86_expand_*_builtin functions.
There is no need for struct with rtx and mode members since mode is never used.

2020-11-26  Uroš Bizjak  <ubizjak@gmail.com>

gcc/
	* config/i386/i386-expand.c (ix86_expand_multi_arg_builtin):
	Remove args array of structs, declare rtx xops array instead.
	Update all uses.
	(ix86_expand_args_builtin): Ditto.
	(ix86_expand_round_builtin): Ditto.
	(ix86_expand_special_args_builtin): Ditto.
2020-11-26 15:19:14 +01:00
Martin Liska
2a93fa4785 dwarf: fix language_string for C2X
gcc/ChangeLog:

	* dwarf2out.c (gen_compile_unit_die): Fix missing == 0 in a
	strcmp.
2020-11-26 14:11:08 +01:00
Rainer Orth
55ebb0d6fb ada: c++: Get rid of libposix4, librt on Solaris
I recently noticed that neither libposix4 nor librt are needed on
Solaris 11 any longer:

* libposix4 was renamed to librt in Solaris 7 back in 1998.

* librt was folded into libc in the OpenSolaris timeframe, leaving librt
  only as a filter on libc.  Thus, it's no longer needed on either
  Solaris 11 or Illumos.

The following patch removes both uses.  At the same time, Ada's use of
libthread has gone: it was folded into libc in Solaris 10 already.
TIME_LIBRARY and friends in g++ are likewise removed: Solaris was the
only user.

Bootstrapped without regressions on i386-pc-solaris2.11,
sparc-sun-solaris2.11, and x86_64-pc-linux-gnu.


2020-11-16  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	gcc/cp:
	* g++spec.c (TIMELIB, TIME_LIBRARY): Remove.
	(lang_specific_driver): Remove TIME_LIBRARY handling.

	gcc:
	* config/sol2.h (TIME_LIBRARY): Remove.

	libstdc++-v3:
	* acinclude.m4 (GLIBCXX_ENABLE_LIBSTDCXX_TIME): Remove libposix4
	references.
	<solaris*>: Don't use -lrt any longer.
	* configure: Regenerate.

	* doc/xml/manual/configure.xml (--enable-libstdcxx-time=OPTION):
	Remove libposix4 reference.

	gcc/ada:
	* Makefile.rtl <sparc*-sun-solaris*> (THREADSLIB): Remove.
	(MISCLIB): Remove -lposix4.
	<*86-*-solaris2*>: Likewise.
	* libgnarl/s-osinte__solaris.ads (System.OS_Interface): Remove
	-lposix4 -lthread.
2020-11-26 13:01:30 +01:00
Jonathan Wakely
2762cb1df6 libstdc++: Fix undefined FILE* operations in test
We only need to check that the constructor doesn't clear errno, so
there's no need to use an invalid FILE* for that.

libstdc++-v3/ChangeLog:

	PR libstdc++/98001
	* testsuite/ext/stdio_filebuf/char/79820.cc: Do not pass invalid
	FILE* to constructor.
2020-11-26 11:25:55 +00:00
Jonathan Wakely
127aa17e16 libstdc++: Add new headers to stdc++.h
libstdc++-v3/ChangeLog:

	* include/precompiled/stdc++.h: Add new headers.
	* include/std/stop_token: Include <semaphore> unconditionally.
2020-11-26 11:25:55 +00:00
Kewen Lin
f6702584aa rs6000: Set param_vect_partial_vector_usage as 1 for P10
Due to the unexpected performance on Power9 of those vector
with length instructions, we didn't enable vectorization with
partial vectors before.

Some recent testings show that they perform expectedly on
Power10 now.  This patch is to set
param_vect_partial_vector_usage as 1 for P10 or later.

The performance evaluation on the whole SPEC2017 with option
set power10/Ofast/unroll shows it can speed up 525.x264_r by
10.80% and 554.roms_r by 1.94%.

Bootstrapped/regtested on powerpc64le-linux-gnu P10.

gcc/ChangeLog:

	* config/rs6000/rs6000.c (rs6000_option_override_internal):
	Set param_vect_partial_vector_usage as 1 for Power10 and up
	by default.
2020-11-26 05:05:43 -06:00
Jakub Jelinek
a386566118 gimple-fold: Use DECL_PADDING_P in __builtin_clear_padding
On Wed, Nov 25, 2020 at 12:26:17PM -0500, Jason Merrill wrote:
> I think you want to check DECL_PADDING_P here; the C and C++ front ends set
> it on unnamed bit-fields, and that's what is_empty_type looks at.

While the above has been written in the context of __builtin_bit_cast patch,
I think it applies to __builtin_clear_padding too.

So this patch implements that.  The C FE sets DECL_PADDING_P solely on the
DECL_BIT_FIELD !DECL_NAME FIELD_DECLs, the C++ FE sets it on those and in
another spot I haven't really figured out what it is about.

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

	* gimple-fold.c (clear_padding_union): Ignore DECL_PADDING_P
	fields.
	(clear_padding_type): Ignore DECL_PADDING_P fields, rather than
	DECL_BIT_FIELD with NULL DECL_NAME.
2020-11-26 10:51:51 +01:00
Jakub Jelinek
39f5e9aded match.pd: Avoid ICE with shifts [PR97979]
My recent wide_int_binop changes caused ICE on this testcase.
The problem is that for shift where amount has MSB set now fails to optimize
into a constant (IMHO we should treat out of bounds shifts the same later),
but there is a precedent for that already - e.g. division by zero fails
to optimize into a constant too.  I think it is better if path isolation
checks for these UBs and does something the user chooses (__builtin_trap vs.
__builtin_unreachable, and either a deferred warning about the UB or
nothing).
This patch just doesn't optimize if int_const_binop failed.

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

	PR tree-optimization/97979
	* match.pd ((X {&,^,|} C2) << C1 into (X << C1) {&,^,|} (C2 << C1)):
	Only optimize if int_const_binop returned non-NULL.

	* gcc.dg/pr97979.c: New test.
	* gcc.c-torture/compile/pr97979.c: New test.
2020-11-26 10:50:23 +01:00
liuhongt
776a37f6ac Delete dead code in ix86_expand_special_args_builtin
gcc/ChangeLog:
	* config/i386/i386-expand.c
	(ix86_expand_special_args_builtin): Delete last_arg_constant
	and match.
2020-11-26 17:43:44 +08:00
Richard Biener
5b3a8fad18 testsuite/98002 - fix gcc.dg/strncmp-2.c
This makes sure not to free() memory we have mprotected to PROT_NONE
by calling mprotect again with PROT_READ|PROT_WRITE.  This avoids
crashing the allocator when in debug mode.

2020-11-16  Richard Biener  <rguenther@suse.de>

	PR testsuite/98002
	* gcc.dg/strncmp-2.c: Call mprotect again before free.
2020-11-26 10:07:06 +01:00
Thomas Schwinge
c0c7270cc4 Don't create location wrapper nodes within OpenACC clauses
This fixes a GCC 11, 10, 9 regression introduced by commit
dfd7fdca2a (Subversion r267272) "C++: more
location wrapper nodes (PR c++/43064, PR c++/43486)".  But: this isn't
intending to blame David, because back then, the problem hasn't been visible in
the testsuite (or else I'm sure would've been addressed right away) because of
our all dear friend: missing testsuite coverage.  Thus, for GCC 8, I'm likewise
enhancing the testsuite, without the C++ front end code changes.

I actually had presumed that there may be an issue for OpenACC:
<http://mid.mail-archive.com/874lb9qr2u.fsf@euler.schwinge.homeip.net>, so here
we are, two years (and many "wasted" hours...) later...

	gcc/cp/
	* parser.c (cp_parser_omp_var_list_no_open): Assert that array
	section's 'low_bound', 'length' are not location wrapper nodes.
	(cp_parser_oacc_all_clauses, cp_parser_oacc_cache): Instantiate
	'auto_suppress_location_wrappers'.
	gcc/testsuite/
	* c-c++-common/goacc/cache-3-1.c: New.
	* c-c++-common/goacc/cache-3-2.c: Likewise.
	* c-c++-common/goacc/data-clause-1.c: Likewise.
	* c-c++-common/goacc/data-clause-2.c: Likewise.
	* c-c++-common/gomp/map-1.c: Adjust.
	* c-c++-common/gomp/map-2.c: Likewise.
	* g++.dg/goacc/cache-3-1.C: New.
	* g++.dg/goacc/cache-3-2.C: Likewise.
	* g++.dg/goacc/data-clause-1.C: Likewise.
	* g++.dg/goacc/data-clause-2.C: Likewise.
	* g++.dg/gomp/map-1.C: Adjust.
	* g++.dg/gomp/map-2.C: Likewise.

Reported-by: Sandra Loosemore <sandra@codesourcery.com>
2020-11-26 10:02:38 +01:00
Uros Bizjak
acdf30d66c i386: Use SDWIM mode iterator for abs and maxmin [PR97873]
Generate special double mode sequence also for QImode and HImode.

Without QImode and HImode patterns, middle-end extends operands to SImode
and emits SImode conditional move instruction with paradoxical SImode output
register.  This form is not recognized by STV pass, but a single abs with
input operand in a register would not be converted anyway due to relatively
high register conversion cost.

2020-11-26  Uroš Bizjak  <ubizjak@gmail.com>

	PR target/97873

gcc/
	* config/i386/i386.md (abs<mode>2): Use SDWIM mode iterator.
	(*abs<mode>2_1): Use SWI mode iterator.

	(<maxmin:code><mode>3): Use SDWIM mode iterator.
	(*<maxmin:code><mode>3_1): Use SWI mode iterator.

gcc/testsuite/
	* gcc.target/i386/pr97873-3.c: New test.
2020-11-26 09:50:33 +01:00
Arnaud Charlet
e3068952d7 [Ada] Ada.Numerics.Big_Numbers.Big_Reals.To_Big_Real looses precision
gcc/ada/

	* libgnat/a-nbnbre.adb (To_Big_Real): Do not loose precision.
2020-11-26 03:40:02 -05:00
Arnaud Charlet
678e19545e [Ada] Ada 2020 AI12-0401 Renaming of qualified expression of variable
gcc/ada/

	* sem_ch8.adb (Analyze_Object_Renaming): Check for AI12-0401.
2020-11-26 03:40:02 -05:00
Eric Botcazou
8d87bb8f56 [Ada] Add support for 128-bit fixed-point types on 64-bit platforms
gcc/ada/

	* Makefile.rtl (GNATRTL_NONTASKING_OBJS): Likewise.
	(GNATRTL_128BIT_OBJS): Likewise.
	(GNATRTL_128BIT_PAIRS): Add new 128-bit variants.
	* cstand.adb (Create_Standard): Create Standard_Integer_128.
	* doc/gnat_rm/implementation_defined_characteristics.rst: Document
	new limits on 64-bit platforms in entry for 3.5.9(10).
	* gnat_rm.texi: Regenerate.
	* exp_attr.adb: Add with and use clauses for Urealp.
	(Expand_N_Attribute_Reference) <Attribute_Fore>: Call new routines
	for decimal fixed-point types and common ordinary fixed-point types.
	* exp_ch4.adb (Real_Range_Check): Extend conversion trick to all
	ordinary fixed-point types and use Small_Integer_Type_For.
	* exp_fixd.adb: Add with and use clauses for Ttypes.
	(Build_Divide): Add special case for 32-bit values and deal with
	128-bit types.
	(Build_Double_Divide): Deal with 128-bit types.
	(Build_Double_Divide_Code): Likewise.  Do not apply conversions
	before calling Build_Multiply.
	(Build_Multiply): Likewise.  Add special case for 32-bit values.
	(Build_Scaled_Divide): Deal with 128-bit types.
	(Build_Scaled_Divide_Code): Likewise.  Fix size computation.  Do not
	apply conversions before calling Build_Multiply.
	(Do_Multiply_Fixed_Fixed): Minor tweak.
	(Integer_Literal): Deal with 128-bit values.
	* exp_imgv.adb (Has_Decimal_Small): Delete.
	(Expand_Image_Attribute): Call new routines for common ordinary
	fixed-point types.
	(Expand_Value_Attribute): Likewise.
	(Expand_Width_Attribute): Add new expansion for fixed-point types.
	* freeze.adb (Freeze_Entity): Move error checks for ordinary
	fixed-point types to...
	(Freeze_Fixed_Point_Type): ...here.  Deal with 128-bit types and
	adjust limitations for 32-bnt and 64-bit types.
	* rtsfind.ads (RTU_Id): Add entries for new System_Fore, System_Img,
	and System_Val units and remove them for obsolete units.
	(RE_Id): Add entries for Double_Divide128, Scaled_Divide128, the new
	Fore, Image, Value routines and remove them for obsolete units.
	(RE_Unit_Table): Likewise.
	* sem_ch3.adb (Decimal_Fixed_Point_Type_Declaration): Deal with
	128-bit types.
	* stand.ads (Standard_Entity_Type): Add Standard_Integer_128.
	* uintp.ads (Uint_31): New deferred constant.
	(Uint_Minus_18): Likewise.
	(Uint_Minus_31): Likewise.
	(Uint_Minus_76): Likewise.
	(Uint_Minus_127): Likewise.
	* urealp.ads (Ureal_2_31): New function.
	(Ureal_2_63): Likewise.
	(Ureal_2_127): Likewise.
	(Ureal_2_M_127): Likewise.
	(Ureal_2_10_18): Likewise.
	(Ureal_M_2_10_18): Likewise.
	(Ureal_9_10_36): Likewise.
	(Ureal_M_9_10_36): Likewise.
	(Ureal_10_76): Likewise.
	(Ureal_M_10_76): Likewise.
	(Ureal_10_36): Delete.
	(Ureal_M_10_36): Likewise.
	* urealp.adb (UR_2_10_18): New variable.
	(UR_9_10_36): Likewise.
	(UR_10_76): Likewise.
	(UR_M_2_10_18): Likewise.
	(UR_M_9_10_36): Likewise.
	(UR_M_10_76): Likewise.
	(UR_2_31): Likewise.
	(UR_2_63): Likewise.
	(UR_2_127): Likewise.
	(UR_2_M_127): Likewise.
	(UR_10_36): Delete.
	(UR_M_10_36): Likewise.
	(Initialize): Initialize them.
	(UR_Write): Do not use awkward Ada literal style.
	(Ureal_2_10_18): New function.
	(Ureal_9_10_36): Likewise.
	(Ureal_10_76): Likewise.
	(Ureal_2_31): Likewise.
	(Ureal_2_63): Likewise.
	(Ureal_2_127): Likewise.
	(Ureal_2_M_127): Likewise.
	(Ureal_M_2_10_18): Likewise.
	(Ureal_M_9_10_36): Likewise.
	(Ureal_10_76): Likewise.
	(Ureal_M_10_76): Likewise.
	(Ureal_10_36): Delete.
	(Ureal_M_10_36): Likewise.
	* libgnat/a-decima__128.ads: New file.
	* libgnat/a-tideau.ads, libgnat/a-tideau.adb: Reimplement as
	generic unit.
	* libgnat/a-tideio.adb: Reimplement.
	* libgnat/a-tideio__128.adb: New file.
	* libgnat/a-tifiau.ads, libgnat/a-tifiau.adb: New generic unit.
	* libgnat/a-tifiio.adb: Move bulk of implementation to s-imagef
	and reimplement.
	* libgnat/a-tifiio__128.adb: New file.
	* libgnat/a-tiflau.adb (Get): Minor consistency fix.
	(Gets): Likewise.
	* libgnat/a-wtdeau.ads, libgnat/a-wtdeau.adb: Reimplement as
	generic unit.
	* libgnat/a-wtdeio.adb: Reimplement.
	* libgnat/a-wtdeio__128.adb: New file.
	* libgnat/a-wtfiau.ads, libgnat/a-wtfiau.adb: New generic unit.
	* libgnat/a-wtfiio.adb: Reimplement.
	* libgnat/a-wtfiio__128.adb: New file.
	* libgnat/a-ztdeau.ads, libgnat/a-ztdeau.adb: Reimplement as
	generic unit.
	* libgnat/a-ztdeio.adb: Reimplement.
	* libgnat/a-ztdeio__128.adb: New file.
	* libgnat/a-ztfiau.ads, libgnat/a-ztfiau.adb: New generic unit.
	* libgnat/a-ztfiio.adb: Reimplement.
	* libgnat/a-ztfiio__128.adb: New file.
	* libgnat/g-rannum.adb (Random_Decimal_Fixed): Use a subtype of the
	appropiate size for the instantiation.
	(Random_Ordinary_Fixed): Likewise.
	* libgnat/s-arit32.ads, libgnat/s-arit32.adb: New support unit.
	* libgnat/s-fode128.ads: New instantiation.
	* libgnat/s-fode32.ads: Likewise.
	* libgnat/s-fode64.ads: Likewise.
	* libgnat/s-fofi128.ads: Likewise.
	* libgnat/s-fofi32.ads: Likewise.
	* libgnat/s-fofi64.ads: Likewise.
	* libgnat/s-fore_d.ads, libgnat/s-fore_d.adb: New generic unit.
	* libgnat/s-fore_f.ads, libgnat/s-fore_f.adb: Likewise.
	* libgnat/s-fore.ads, libgnat/s-fore.adb: Rename into...
	* libgnat/s-forrea.ads, libgnat/s-forrea.adb: ...this.
	* libgnat/s-imaged.ads, libgnat/s-imaged.adb: New generic unit.
	* libgnat/s-imagef.ads, libgnat/s-imagef.adb: Likewise, taken
	from a-tifiio.adb.
	* libgnat/s-imde128.ads: New instantiation.
	* libgnat/s-imde32.ads: Likewise.
	* libgnat/s-imde64.ads: Likewise.
	* libgnat/s-imfi128.ads: Likewise.
	* libgnat/s-imfi32.ads: Likewise.
	* libgnat/s-imfi64.ads: Likewise.
	* libgnat/s-imgdec.ads, libgnat/s-imgdec.adb: Delete.
	* libgnat/s-imglld.ads, libgnat/s-imglld.adb: Likewise.
	* libgnat/s-imgrea.adb (Set_Image_Real): Replace Sign local variable
	with Minus local variable for the sake of consistency.
	* libgnat/s-imguti.ads, libgnat/s-imguti.adb: New support unit.
	* libgnat/s-vade128.ads: New instantiation.
	* libgnat/s-vade32.ads: Likewise.
	* libgnat/s-vade64.ads: Likewise.
	* libgnat/s-vafi128.ads: Likewise.
	* libgnat/s-vafi32.ads: Likewise.
	* libgnat/s-vafi64.ads: Likewise.
	* libgnat/s-valdec.ads, libgnat/s-valdec.adb: Delete.
	* libgnat/s-vallld.ads, libgnat/s-vallld.adb: Likewise.
	* libgnat/s-valued.ads, libgnat/s-valued.adb: New generic unit.
	* libgnat/s-valuef.ads, libgnat/s-valuef.adb: Likewise.
	* libgnat/s-valuei.adb: Minor rewording.
	* libgnat/s-valrea.adb: Move bulk of implementation to...
	* libgnat/s-valuer.ads, libgnat/s-valuer.adb: ...here.  New
	generic unit.
	* libgnat/system-aix.ads (Max_Mantissa): Adjust.
	* libgnat/system-darwin-arm.ads (Max_Mantissa): Likewise.
	* libgnat/system-darwin-ppc.ads (Max_Mantissa): Likewise.
	* libgnat/system-darwin-x86.ads (Max_Mantissa): Likewise.
	* libgnat/system-djgpp.ads (Max_Mantissa): Likewise.
	* libgnat/system-dragonfly-x86_64.ads (Max_Mantissa): Likewise.
	* libgnat/system-freebsd.ads (Max_Mantissa): Likewise.
	* libgnat/system-hpux-ia64.ads (Max_Mantissa): Likewise.
	* libgnat/system-hpux.ads (Max_Mantissa): Likewise.
	* libgnat/system-linux-alpha.ads (Max_Mantissa): Likewise.
	* libgnat/system-linux-arm.ads (Max_Mantissa): Likewise.
	* libgnat/system-linux-hppa.ads (Max_Mantissa): Likewise.
	* libgnat/system-linux-ia64.ads (Max_Mantissa): Likewise.
	* libgnat/system-linux-m68k.ads (Max_Mantissa): Likewise.
	* libgnat/system-linux-mips.ads (Max_Mantissa): Likewise.
	* libgnat/system-linux-ppc.ads (Max_Mantissa): Likewise.
	* libgnat/system-linux-riscv.ads (Max_Mantissa): Likewise.
	* libgnat/system-linux-s390.ads (Max_Mantissa): Likewise.
	* libgnat/system-linux-sh4.ads (Max_Mantissa): Likewise.
	* libgnat/system-linux-sparc.ads (Max_Mantissa): Likewise.
	* libgnat/system-linux-x86.ads (Max_Mantissa): Likewise.
	* libgnat/system-lynxos178-ppc.ads (Max_Mantissa): Likewise.
	* libgnat/system-lynxos178-x86.ads (Max_Mantissa): Likewise.
	* libgnat/system-mingw.ads (Max_Mantissa): Likewise.
	* libgnat/system-qnx-aarch64.ads (Max_Mantissa): Likewise.
	* libgnat/system-rtems.ads (Max_Mantissa): Likewise.
	* libgnat/system-solaris-sparc.ads (Max_Mantissa): Likewise.
	* libgnat/system-solaris-x86.ads (Max_Mantissa): Likewise.
	* libgnat/system-vxworks-arm-rtp-smp.ads (Max_Mantissa): Likewise.
	* libgnat/system-vxworks-arm-rtp.ads (Max_Mantissa): Likewise.
	* libgnat/system-vxworks-arm.ads (Max_Mantissa): Likewise.
	* libgnat/system-vxworks-e500-kernel.ads (Max_Mantissa): Likewise.
	* libgnat/system-vxworks-e500-rtp-smp.ads (Max_Mantissa): Likewise.
	* libgnat/system-vxworks-e500-rtp.ads (Max_Mantissa): Likewise.
	* libgnat/system-vxworks-e500-vthread.ads (Max_Mantissa): Likewise.
	* libgnat/system-vxworks-ppc-kernel.ads (Max_Mantissa): Likewise.
	* libgnat/system-vxworks-ppc-ravenscar.ads (Max_Mantissa): Likewise.
	* libgnat/system-vxworks-ppc-rtp-smp.ads (Max_Mantissa): Likewise.
	* libgnat/system-vxworks-ppc-rtp.ads (Max_Mantissa): Likewise.
	* libgnat/system-vxworks-ppc-vthread.ads (Max_Mantissa): Likewise.
	* libgnat/system-vxworks-ppc.ads (Max_Mantissa): Likewise.
	* libgnat/system-vxworks-x86-kernel.ads (Max_Mantissa): Likewise.
	* libgnat/system-vxworks-x86-rtp-smp.ads (Max_Mantissa): Likewise.
	* libgnat/system-vxworks-x86-rtp.ads (Max_Mantissa): Likewise.
	* libgnat/system-vxworks-x86-vthread.ads (Max_Mantissa): Likewise.
	* libgnat/system-vxworks-x86.ads (Max_Mantissa): Likewise.
	* libgnat/system-vxworks7-aarch64-rtp-smp.ads (Max_Mantissa):
	Likewise.
	* libgnat/system-vxworks7-aarch64.ads (Max_Mantissa): Likewise.
	* libgnat/system-vxworks7-arm-rtp-smp.ads (Max_Mantissa): Likewise.
	* libgnat/system-vxworks7-arm.ads (Max_Mantissa): Likewise.
	* libgnat/system-vxworks7-e500-kernel.ads (Max_Mantissa): Likewise.
	* libgnat/system-vxworks7-e500-rtp-smp.ads (Max_Mantissa): Likewise.
	* libgnat/system-vxworks7-e500-rtp.ads (Max_Mantissa): Likewise.
	* libgnat/system-vxworks7-ppc-kernel.ads (Max_Mantissa): Likewise.
	* libgnat/system-vxworks7-ppc-rtp-smp.ads (Max_Mantissa): Likewise.
	* libgnat/system-vxworks7-ppc-rtp.ads (Max_Mantissa): Likewise.
	* libgnat/system-vxworks7-ppc64-kernel.ads (Max_Mantissa): Likewise.
	* libgnat/system-vxworks7-ppc64-rtp-smp.ads (Max_Mantissa): Likewise.
	* libgnat/system-vxworks7-x86-kernel.ads (Max_Mantissa): Likewise.
	* libgnat/system-vxworks7-x86-rtp-smp.ads (Max_Mantissa): Likewise.
	* libgnat/system-vxworks7-x86-rtp.ads (Max_Mantissa): Likewise.
	* libgnat/system-vxworks7-x86_64-kernel.ads (Max_Mantissa): Likewise.
	* libgnat/system-vxworks7-x86_64-rtp-smp.ads (Max_Mantissa): Likewise.

gcc/testsuite/

	* gnat.dg/multfixed.adb: Robustify.
2020-11-26 03:40:00 -05:00
Liaiss Merzougue
0938e51458 [Ada] Add the remark concerning the use of Image_Ordinary_Fixed_Point
gcc/ada/

	* libgnat/s-imgrea.ads (Image_Ordinary_Fixed_Point): Add a
	remark concerning the irrelevant use of Inf and -0.0
2020-11-26 03:39:58 -05:00
Arnaud Charlet
781fb9a006 [Ada] Add support for .c output file
gcc/ada/

	* osint-c.adb (Set_Output_Object_File_Name): Add support for
	.c output file.
2020-11-26 03:39:58 -05:00
Piotr Trojanek
aa83f3d0b7 [Ada] Reuse Is_Generic_Subprogram where possible
gcc/ada/

	* lib-writ.adb, sem_ch8.adb, sem_prag.adb: Use
	Is_Generic_Subprogram instead of low-level membership tests.
2020-11-26 03:39:57 -05:00
Gary Dismukes
ebf90d68e9 [Ada] Minor reformatting and a typo fix
gcc/ada/

	* sem_ch6.adb (Analyze_Call_And_Resolve): Reformatted a comment.
	* sem_prag.adb (Process_Restrictions_Or_Restriction_Warnings):
	Fixed a typo.
2020-11-26 03:39:56 -05:00
Piotr Trojanek
c9e2eeb503 [Ada] Replace warning suppression with assertion
gcc/ada/

	* sem_res.adb (Resolve_Membership_Op): Replace pragma Warnings
	with pragma Assert.
2020-11-26 03:39:55 -05:00
Ed Schonberg
4e94b2442d [Ada] Improve error message on illegal prefixed procedure call
gcc/ada/

	* sem_ch6.adb (Analyze_Call_And_Resolve): Add information to the
	error message on an illegal procedure call, when the illegality
	is due to the presence of a component of the full view of the
	target object, as well as a procedure with the same name (See RM
	4.1.3 (9.2/3)).
2020-11-26 03:39:54 -05:00
Ed Schonberg
52424b13d8 [Ada] Crash on task declaration with Restriction_Warning (No_Tasking)
gcc/ada/

	* sem_prag.adb (Process_Restrictions_Or_Restriction_Warnings):
	when the restriction is a configuration pragma and specifies
	No_Tasking, a global flag is set to reject task declarations,
	and to prevent the construction of Master entities. The flag
	must not be set if the pragma is a Restriction_Warning, in which
	case task declarationns are allowed.
2020-11-26 03:39:53 -05:00
Piotr Trojanek
9597d24c7f [Ada] Sync wide Ada.String hashing units
gcc/ada/

	* libgnat/a-stzhas.adb (Wide_Wide_Hash): Instantiate inside a
	wrapper function.
	* libgnat/a-stzhas.ads (Wide_Wide_Hash): Likewise; remove wrong
	comment, because this is indeed a RM unit, as described in Ada
	RM A.4.8 (1/3).
2020-11-26 03:39:52 -05:00
Piotr Trojanek
bc0c82e994 [Ada] Avoid potentially repeated calls to Prefix in Eval_Slice
gcc/ada/

	* sem_eval.adb (Eval_Slice): Refactor repeated calls to Prefix
	with a local constant (named just like in Resolve_Slice).
2020-11-26 03:39:52 -05:00
Piotr Trojanek
81c629f8f1 [Ada] Warn on slices of the form A (subtype) for all objects
gcc/ada/

	* sem_eval.adb (Eval_Slice): Emit warning not just for
	constants, but for any objects.
2020-11-26 03:39:51 -05:00
Piotr Trojanek
433b2e91f9 [Ada] Remove duplicated calls to Set_Entity
gcc/ada/

	* sem_ch4.adb (Indicate_Name_And_Type): Fix whitespace in
	comment.
	* sem_res.adb (Resolve_Call): Remove redundant parens.
	* sem_util.adb (Set_Entity_With_Checks): Remove extra call to
	Set_Entity.
2020-11-26 03:39:50 -05:00
Bob Duff
0ea529086e [Ada] Memory leak in concatenation with Initialize_Scalars
gcc/ada/

	* exp_ch4.adb (Expand_Concatenate): Call Set_No_Initialization
	on the N_Allocator node that is supposed to allocate on the
	secondary stack.
2020-11-26 03:39:49 -05:00
Piotr Trojanek
a160b4e046 [Ada] Reuse Is_Concurrent_Type when detecting protected or task types
gcc/ada/

	* exp_ch13.adb, exp_ch9.adb, sem_ch8.adb, sem_util.adb: Replace
	a combination of Is_Protected_Type and Is_Task_Type by
	Is_Concurrent_Type.
2020-11-26 03:39:48 -05:00
Arnaud Charlet
416f9a2726 [Ada] Constraint_Error in Task_Wrapper and -u0
gcc/ada/

	* libgnarl/s-tassta.adb (Task_Wrapper): Fix computation of
	Pattern_Size.
2020-11-26 03:39:47 -05:00
Bob Duff
ccd05f6c8f [Ada] Pass base type to Set_Has_Own_Invariants
gcc/ada/

	* freeze.adb (Freeze_Array_Type): Remove propagation of
	Has_Own_Invariants to the first subtype. This is a no-op,
	because the current (incorrect) version of Has_Own_Invariants
	calls Base_Type.
	* sem_prag.adb, sem_util.adb: Pass the base type to
	Set_Has_Own_Invariants.
2020-11-26 03:39:46 -05:00
Eric Botcazou
2015a575b7 [Ada] Adjust documentation of Aft_Value and Scale_Value
gcc/ada/

	* einfo.ads (Aft_Value): Adjust documentation.
	(Scale_Value): Likewise.
2020-11-26 03:39:45 -05:00
Justin Squirek
b6735a1004 [Ada] Incorrect runtime accessibility check on access discriminant
gcc/ada/

	* exp_ch4.adb (Expand_N_Type_Conversion): Use the unexpanded
	operand when generating accessibility checks.
2020-11-26 03:39:45 -05:00
Piotr Trojanek
adfa6cb8e4 [Ada] Remove extra whitespace in bounded container Read procedures
gcc/ada/

	* libgnat/a-cbhase.adb (Read): Remove extra whitespace.
	* libgnat/a-cbmutr.ads (Read): Likewise.
	* libgnat/a-cborse.adb (Read): Likewise.
2020-11-26 03:39:44 -05:00
Piotr Trojanek
5af3a22afe [Ada] Reuse Is_Access_Object_Type where possible
gcc/ada/

	* exp_ch7.adb, exp_util.adb, freeze.adb: Rewrite with
	Is_Access_Object_Type.
2020-11-26 03:39:43 -05:00
Piotr Trojanek
5f7ee28018 [Ada] Simplify checks for library unit pragmas
gcc/ada/

	* sem_prag.adb (Check_Valid_Library_Unit_Pragma): Raise
	exception.
	(Analyze_Pragma): Remove detection of rewritten pragmas.
2020-11-26 03:39:42 -05:00
Joffrey Huguet
21d66365ad [Ada] Add contracts to Ada.Strings.Maps
gcc/ada/

	* libgnat/a-strmap.ads: Add preconditions and postconditions to
	all subprograms.
2020-11-26 03:39:41 -05:00
Yannick Moy
0dd6aab195 [Ada] New warning on questionable missing parentheses
gcc/ada/

	* sem_res.adb (Resolve_Equality_Op): Warn when -gnatwq is used
	(the default) and the problematic case is encountered.
2020-11-26 03:39:40 -05:00
Yannick Moy
96ccfec029 [Ada] Issue advice for error regarding Old/Loop_Entry on unevaluated expr.
gcc/ada/

	* sem_attr.adb (Analyze_Attribute): Issue a continuation message
	to give proper recommendation here.
2020-11-26 03:39:39 -05:00
Gary Dismukes
e3946607a6 [Ada] Correct a typo, plus other minor reformatting
gcc/ada/

	* exp_util.adb (Expand_Subtype_From_Expr): A typo correction,
	plus other minor reformatting.
2020-11-26 03:39:38 -05:00
Ed Schonberg
3268fb4dac [Ada] Spurious error on formal package with overloaded subprograms
gcc/ada/

	* sem_ch12.adb (Instantiate_Formal_Package): If previous matched
	entity is overloadable, advance in the list of actuals of the
	actual package, to prevent an erroneous match of two adjacent
	overloadable homonyms with the same entity.
2020-11-26 03:39:38 -05:00
Justin Squirek
1e00c00d8a [Ada] Compiler crash on named association in return aggregate
gcc/ada/

	* sem_ch6.adb (First_Selector): Utility routine to return the
	first selector or choice in an association.
	(Check_Return_Construct_Accessibility): Modify loop to handle
	named associations when iterating through discriminants.
2020-11-26 03:39:37 -05:00
Piotr Trojanek
8593037b17 [Ada] Fix casing of "circular instantiation" error
gcc/ada/

	* sem_ch12.adb: Fix casing from "Instantiation" to
	"instantiation".
2020-11-26 03:39:36 -05:00
Jakub Jelinek
32b0abb24b i386: Optimize psubusw compared to 0 into pminuw compared to op0 [PR96906]
The following patch renames VI12_AVX2 iterator to VI12_AVX2_AVX512BW
for consistency with some other iterators, as I need VI12_AVX2 without
AVX512BW for this change.
The real meat is a combiner split which combine
can use to optimize psubusw compared to 0 into pminuw compared to op0
(and similarly for psubusb compared to 0 into pminub compared to op0).
According to Agner Fog's tables, psubus[bw] and pminu[bw] timings
are the same, but the advantage of pminu[bw] is that the comparison
doesn't need a zero operand, so e.g. for -msse4.1 it causes changes like
-       psubusw %xmm1, %xmm0
-       pxor    %xmm1, %xmm1
+       pminuw  %xmm0, %xmm1
        pcmpeqw %xmm1, %xmm0
and similarly for avx2:
-       vpsubusb        %ymm1, %ymm0, %ymm0
-       vpxor   %xmm1, %xmm1, %xmm1
-       vpcmpeqb        %ymm1, %ymm0, %ymm0
+       vpminub %ymm1, %ymm0, %ymm1
+       vpcmpeqb        %ymm0, %ymm1, %ymm0

I haven't done the AVX512{BW,VL} define_split(s), they'll need
to match the UNSPEC_PCMP which are used for avx512 comparisons.

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

	PR target/96906
	* config/i386/sse.md (VI12_AVX2): Remove V64QI/V32HI modes.
	(VI12_AVX2_AVX512BW): New mode iterator.
	(<sse2_avx2>_<plusminus_insn><mode>3<mask_name>,
	uavg<mode>3_ceil, <sse2_avx2>_uavg<mode>3<mask_name>): Use
	VI12_AVX2_AVX512BW iterator instead of VI12_AVX2.
	(*<sse2_avx2>_<plusminus_insn><mode>3<mask_name>): Likewise.
	(*<sse2_avx2>_uavg<mode>3<mask_name>): Likewise.
	(*<sse2_avx2>_<plusminus_insn><mode>3<mask_name>): Add a new
	define_split after this insn.

	* gcc.target/i386/pr96906-1.c: New test.
2020-11-26 08:46:14 +01:00