Commit graph

203614 commits

Author SHA1 Message Date
Steve Baird
bed30418f9 ada: Spurious warning about negative modular literal
If -gnatw.m is enabled, the compiler generates a warning if a unary
minus operator of a modular type is applied to an integer literal.
This warning was being incorrectly generated in some cases where no integer
literal is present in the source code.

gcc/ada/

	* sem_res.adb (Resolve_Unary_Op): In deciding whether to emit a
	warning about a modular type's unary minus operator being applied
	to an integer literal, ignore integer literals for which
	Comes_From_Source is False.
2023-09-05 13:05:13 +02:00
Johannes Kliemann
46644c3fd7 ada: Support setting task affinity on QNX
QNX does not support setting the thread affinity via a POSIX API.
This implementation uses QNX's native Thread_Ctl API to set the
thread affinity for Ada tasks.

gcc/ada/

	* libgnarl/s-taprop__qnx.adb: Implement Set_Task_Affinity.
2023-09-05 13:05:13 +02:00
Ghjuvan Lacambre
a5c1652d7c ada: building_executable_programs_with_gnat.rst: fix -gnatw.x index
The index for this paragraph was wrong.

gcc/ada/

	* doc/gnat_ugn/building_executable_programs_with_gnat.rst: Fix
	index.
	* gnat_ugn.texi: Regenerate.
2023-09-05 13:05:13 +02:00
Daniel King
c416d2f768 ada: Preserve capability validity in address arithmetic
On CHERI targets where System.Address is a capability, arithmetic on
addresses should avoid converting to integers and instead use the
operations defined in System.Storage_Elements to perform the arithmetic
directly on the System.Address object. This preserves the capability's
validity throughout the calculation, ensuring that the resulting capability
can be dereferenced.

gcc/ada/

	* libgnat/s-carsi8.adb: Use operations from
	System.Storage_Elements for address arithmetic.
	* libgnat/s-carun8.adb: Likewise
	* libgnat/s-casi128.adb: Likewise
	* libgnat/s-casi16.adb: Likewise
	* libgnat/s-casi32.adb: Likewise
	* libgnat/s-casi64.adb: Likewise
	* libgnat/s-caun128.adb: Likewise
	* libgnat/s-caun16.adb: Likewise
	* libgnat/s-caun32.adb: Likewise
	* libgnat/s-caun64.adb: Likewise
	* libgnat/s-geveop.adb: Likewise
2023-09-05 13:05:12 +02:00
Eric Botcazou
518f93c179 ada: Fix internal error on instantiation with private component type
First, this fixes an internal error on the instantiation of a nested generic
package taking an array type whose component type is a private type declared
in the parent package as formal type parameter. In the body of the instance,
the full view of the private type is visible and must be restored by means
of the Check_Generic_Actuals mechanism.

Second, this fixes the same internal error in the case where the component
type itself is an array type whose component type is a private type declared
in the parent package, i.e. when the formal type parameter is an array of
array type, by naturally extending the Has_Secondary_Private_View mechanism
to the array of array case.

gcc/ada/

	* sem_ch12.adb (Component_Type_For_Private_View): New function.
	(Check_Generic_Actuals): For an actual type parameter, also check
	its component type if it is an array type.
	(Check_Private_View): Use Component_Type_For_Private_View in the
	case of an array type.
	(Instantiate_Type): Likewise.
	(Save_Global_References.Set_Global_Type): Likewise.
2023-09-05 13:05:12 +02:00
Sheri Bernstein
f9a68b4547 ada: Remove GNATcheck violations
Use pragma Annotate to exempt GNATcheck violations that are related
to proof code. Specifically, exempt rules "Metrics_LSLOC" and
"Metrics_Cyclomatic_Complexity" whose limits are exceeded due to
proof code, and exempt rule "Discriminated_Records" for a variant record
that is only used in proof code.

gcc/ada/

	* libgnat/s-aridou.adb: Add pragma to exempt Metrics_LSLOC.
	(Double_Divide): Add pragma to exempt
	Metrics_Cyclomatic_Complexity.
	(Scaled_Divide): Likewise.
	* libgnat/s-vauspe.ads (Uns_Option): Add pragma to exempt
	Discriminated_Records.
2023-09-05 13:05:12 +02:00
Ronan Desplanques
17fcc7df64 ada: Add missing units to Makefile.rtl
A previous change accidently removed a-cohama and a-cohase from
`Makefile.rtl`. This patch adds these units back

gcc/ada/

	* Makefile.rtl: Add missing units.
2023-09-05 13:05:12 +02:00
Sheri Bernstein
105891ca1b ada: Handle GNATcheck violations
For the GNATcheck rule "Improper_Returns", either use pragma Annotate
to exempt the violation with the rationale "early returns for performance",
or refactor the code by replacing multiple returns by a single return
statement with a conditional expression; this is more readable and
maintainable, and also conformant with a Highly Recommended design principle
of ISO 26262-6.  For the GNATcheck rule "Discriminated_Records", use pragma
Annotate to exempt the violation with the rationale "only variant records
are disallowed".

gcc/ada/

	* libgnarl/a-reatim.adb (Time_Of): Add pragma to exempt
	Discriminated_Records.
	* libgnat/s-imguti.adb (Round, Set_Decimal_Digits): Likewise.
	* libgnat/s-multip.adb (Number_Of_CPUs): Likewise.
	* libgnarl/s-tpopsp__posix-foreign.adb (Self): Refactor multiple
	returns.
2023-09-05 13:05:11 +02:00
Javier Miranda
8950360830 ada: Enforce subtype conformance of interface primitives
gcc/ada/

	* sem_ch3.adb (Add_Internal_Interface_Entities): Add missing
	subtype-conformance check on primitives implementing interface
	primitives.
	(Error_Posted_In_Formals): New subprogram.
2023-09-05 13:05:11 +02:00
Ronan Desplanques
eb7c56a034 ada: Tweak comment about tasking corner case
This patch adjusts a comment that could have misleadingly suggested
that a corner case related to tasks could not exist in Ada 2012 or
Ada 2022.

gcc/ada/

	* libgnarl/s-tassta.adb: Tweak comment.
2023-09-05 13:05:11 +02:00
Marc Poulhiès
83bb096006 Revert "Adjust one Ada test"
This reverts commit d8dc61bb5a.
2023-09-05 13:05:11 +02:00
Juzhe-Zhong
509c10a625 RISC-V: Export functions as global extern preparing for dynamic LMUL patch use
Notice those functions need to be use by COST model for dynamic LMUL use.
Extract as a single patch and committed.

gcc/ChangeLog:

	* config/riscv/riscv-protos.h (lookup_vector_type_attribute): Export global.
	(get_all_predecessors): New function.
	(get_all_successors): Ditto.
	* config/riscv/riscv-v.cc (get_all_predecessors): Ditto.
	(get_all_successors): Ditto.
	* config/riscv/riscv-vector-builtins.cc (sizeless_type_p): Export global.
	* config/riscv/riscv-vsetvl.cc (get_all_predecessors): Remove it.
2023-09-05 17:04:55 +08:00
Christoph Müllner
8451fbd568 riscv: xtheadcondmov: Don't run tests with -Oz
Recently, these xtheadcondmov tests regressed with -Oz:
* FAIL: gcc.target/riscv/xtheadcondmov-mveqz-imm-eqz.c
* FAIL: gcc.target/riscv/xtheadcondmov-mveqz-imm-not.c
* FAIL: gcc.target/riscv/xtheadcondmov-mvnez-imm-cond.c
* FAIL: gcc.target/riscv/xtheadcondmov-mvnez-imm-nez.c

As -Oz stands for "Optimize aggressively for size rather than speed.",
we need to inspect the generated code, which looks like this:

  -Oz
  0000000000000000 <not_int_int>:
     0:   e199                    bnez    a1,6 <.L2>
     2:   40100513                li      a0,1025
  0000000000000006 <.L2>:
     6:   8082                    ret

  -O2:
  0000000000000000 <not_int_int>:
     0:   40100793                li      a5,1025
     4:   40b7950b                th.mveqz        a0,a5,a1
     8:   8082                    ret

As the generated code with -Oz consumes less size, there is nothing
wrong in the code generation. Instead, let's not run the xtheadcondmov
tests with -Oz.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/xtheadcondmov-mveqz-imm-eqz.c: Disable for -Oz.
	* gcc.target/riscv/xtheadcondmov-mveqz-imm-not.c: Likewise.
	* gcc.target/riscv/xtheadcondmov-mveqz-reg-eqz.c: Likewise.
	* gcc.target/riscv/xtheadcondmov-mveqz-reg-not.c: Likewise.
	* gcc.target/riscv/xtheadcondmov-mvnez-imm-cond.c: Likewise.
	* gcc.target/riscv/xtheadcondmov-mvnez-imm-nez.c: Likewise.
	* gcc.target/riscv/xtheadcondmov-mvnez-reg-cond.c: Likewise.
	* gcc.target/riscv/xtheadcondmov-mvnez-reg-nez.c: Likewise.

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
2023-09-05 10:48:30 +02:00
Claudiu Zissulescu
1cf57a14d7 arc: Cleanup addsi3 instruction pattern
This patch repurposes the code letter 's' to 'x', and 'S' to 'J'.
Also it introduces new CODE letters 'x', 's', 'S', and 'N'.

gcc/ChangeLog:

	* config/arc/arc-protos.h (arc_output_addsi): Remove declaration.
	(split_addsi): Likewise.
	* config/arc/arc.cc (arc_print_operand): Add/repurpose 's', 'S',
	'N', 'x', and 'J' code letters.
	(arc_output_addsi): Make it static.
	(split_addsi): Remove it.
	* config/arc/arc.h (UNSIGNED_INT*): New defines.
	(SINNED_INT*): Likewise.
	* config/arc/arc.md (type): Add add, sub, bxor types.
	(tst_movb): Change code letter from 's' to 'x'.
	(andsi3_i): Likewise.
	(addsi3_mixed): Refurbish the pattern.
	(call_i): Change code letter from 'S' to 'J'.
	* config/arc/arc700.md: Add newly introduced types.
	* config/arc/arcHS.md: Likewsie.
	* config/arc/arcHS4x.md: Likewise.
	* config/arc/constraints.md (Cca, CL2, Csp, C2a): Remove it.
	(CM4): Update description.
	(CP4, C6u, C6n, CIs, C4p): New constraint.

Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
2023-09-05 11:31:32 +03:00
Claudiu Zissulescu
07f7615c18 arc: Remove obsolete mbbit-peephole option and unused patterns.
gcc/

	* common/config/arc/arc-common.cc (arc_option_optimization_table):
	Remove mbbit_peephole.
	* config/arc/arc.md (UNSPEC_ARC_DIRECT): Remove.
	(store_direct): Likewise.
	(BBIT peephole2): Likewise.
	* config/arc/arc.opt (mbbit-peephole): Ignore option.
	* doc/invoke.texi (mbbit-peephole): Update document.

Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
2023-09-05 11:31:31 +03:00
Jakub Jelinek
f47fcd2a12 tree-ssa-tail-merge: Fix a comment typo
I've noticed a typo in a comment, fixed thusly.

2023-09-05  Jakub Jelinek  <jakub@redhat.com>

	* tree-ssa-tail-merge.cc (replace_block_by): Fix a comment typo:
	avreage -> average.
2023-09-05 09:34:09 +02:00
Yang Yujie
137d6238cc LoongArch: initial ada support on linux
gcc/ada/ChangeLog:

	* Makefile.rtl: Add LoongArch support.
	* libgnarl/s-linux__loongarch.ads: New file.
	* libgnat/system-linux-loongarch.ads: New file.

gcc/ChangeLog:

	* config/loongarch/loongarch.h (CC1_SPEC): Mark normalized
	options passed from driver to gnat1 as explicit for multilib.
2023-09-05 12:01:48 +08:00
Yang Yujie
976f4f9e47 LoongArch: support loongarch*-elf target
gcc/ChangeLog:

	* config.gcc: add loongarch*-elf target.
	* config/loongarch/elf.h: New file.
	Link against newlib by default.

libgcc/ChangeLog:

	* config.host: add loongarch*-elf target.
2023-09-05 11:48:16 +08:00
Yang Yujie
18e2e589ee LoongArch: add new configure option --with-strict-align-lib
LoongArch processors may not support memory accesses without natural
alignments.  Building libraries with -mstrict-align may help with
toolchain binary compatiblity and performance on these implementations
(e.g. Loongson 2K1000LA).

No significant performance degredation is observed on current mainstream
LoongArch processors when the option is enabled.

gcc/ChangeLog:

	* config.gcc: use -mstrict-align for building libraries
	if --with-strict-align-lib is given.
	* doc/install.texi: likewise.
2023-09-05 11:48:05 +08:00
Yang Yujie
f095da2c5a LoongArch: define preprocessing macros "__loongarch_{arch,tune}"
These are exported according to the LoongArch Toolchain Conventions[1]
as a replacement of the obsolete "_LOONGARCH_{ARCH,TUNE}" macros,
which are expanded to strings representing the actual architecture
and microarchitecture of the target.

[1] currently relased at https://github.com/loongson/LoongArch-Documentation
    /blob/main/docs/LoongArch-toolchain-conventions-EN.adoc

gcc/ChangeLog:

	* config/loongarch/loongarch-c.cc: Export macros
	"__loongarch_{arch,tune}" in the preprocessor.
2023-09-05 11:48:00 +08:00
Yang Yujie
bb4a81988c LoongArch: improved target configuration interface
The configure script and the GCC driver are updated so that
it is easier to customize and control GCC builds for targeting
different LoongArch implementations.

* Make --with-abi obsolete, since it might cause different default ABI
  under the same target triplet, which is undesirable.  The default ABI
  is now purely decided by the target triplet.

* Support options for LoongArch SIMD extensions:
  new configure options --with-simd={none,lsx,lasx};
  new compiler option -msimd={none,lsx,lasx};
  new driver options -m[no]-l[a]sx.

* Enforce the priority of configuration paths (for <parm>={fpu,tune,simd}):
  -m<parm> > -march-implied > --with-<parm> > --with-arch-implied.

* Allow the user to control the compiler options used when building
  GCC libraries for each multilib variant via --with-multilib-list
  and --with-multilib-default.  This could become more useful when
  we have 32-bit support later.

  Example 1: the following configure option
    --with-multilib-list=lp64d/la464/mno-strict-align/msimd=lsx,lp64s/mfpu=32
                          |     |            |         |
                    -mabi=ABI  -march=ARCH  a list of other options
                  (mandatory)  (optional)     (optional)

     builds two sets of libraries:
     1. lp64d/base ABI (built with "-march=la464 -mno-strict-align -msimd=lsx")
     2. lp64s/base ABI (built with "-march=abi-default -mfpu=32")

  Example 2: the following 3 configure options

    --with-arch=loongarch64
    --with-multilib-list=lp64d,lp64f,lp64s/la464
    --with-multilib-default=fixed/mno-strict-align/mfpu=64
                             |            |           |
                        -march=ARCH   a list of other options
                         (optional)        (optional)

    is equivalent to (in terms of building libraries):

    --with-multilib-list=\
    lp64d/loongarch64/mno-strict-align/mfpu=64,\
    lp64f/loongarch64/mno-strict-align/mfpu=64,\
    lp64s/la464

  Note:
    1. the GCC driver and compiler proper does not support
       "-march=fixed". "fixed" that appear here acts as a placeholder for
       "use whatever ARCH in --with-arch=ARCH" (or the default value
       of --with-arch=ARCH if --with-arch is not explicitly configured).

    2. if the ARCH part is omitted, "-march=abi-default"
       is used for building all library variants, which
       practically means enabling the minimal ISA features
       that can support the given ABI.

ChangeLog:

	* config-ml.in: Do not build the multilib library variant
	that is duplicate with the toplevel one.

gcc/ChangeLog:

	* config.gcc: Make --with-abi= obsolete, decide the default ABI
	with target triplet.  Allow specifying multilib library build
	options with --with-multilib-list and --with-multilib-default.
	* config/loongarch/t-linux: Likewise.
	* config/loongarch/genopts/loongarch-strings: Likewise.
	* config/loongarch/loongarch-str.h: Likewise.
	* doc/install.texi: Likewise.
	* config/loongarch/genopts/loongarch.opt.in: Introduce
	-m[no-]l[a]sx options.  Only process -m*-float and
	-m[no-]l[a]sx in the GCC driver.
	* config/loongarch/loongarch.opt: Likewise.
	* config/loongarch/la464.md: Likewise.
	* config/loongarch/loongarch-c.cc: Likewise.
	* config/loongarch/loongarch-cpu.cc: Likewise.
	* config/loongarch/loongarch-cpu.h: Likewise.
	* config/loongarch/loongarch-def.c: Likewise.
	* config/loongarch/loongarch-def.h: Likewise.
	* config/loongarch/loongarch-driver.cc: Likewise.
	* config/loongarch/loongarch-driver.h: Likewise.
	* config/loongarch/loongarch-opts.cc: Likewise.
	* config/loongarch/loongarch-opts.h: Likewise.
	* config/loongarch/loongarch.cc: Likewise.
	* doc/invoke.texi: Likewise.
2023-09-05 11:47:55 +08:00
liuhongt
33066c903a Generate vmovsh instead of vpblendw for specific vec_merge.
On SPR, vmovsh can be execute on 3 ports, vpblendw can only be
executed on 2 ports.
On znver4, vpblendw can be executed on 4 ports, if vmovsh is similar
as vmovss, then it can also be executed on 4 ports.
So there's no difference for znver? but vmovsh is more optimized on
SPR.

gcc/ChangeLog:

	* config/i386/sse.md: (V8BFH_128): Renamed to ..
	(VHFBF_128): .. this.
	(V16BFH_256): Renamed to ..
	(VHFBF_256): .. this.
	(avx512f_mov<mode>): Extend to V_128.
	(vcvtnee<bf16_ph>2ps_<mode>): Changed to VHFBF_128.
	(vcvtneo<bf16_ph>2ps_<mode>): Ditto.
	(vcvtnee<bf16_ph>2ps_<mode>): Changed to VHFBF_256.
	(vcvtneo<bf16_ph>2ps_<mode>): Ditto.
	* config/i386/i386-expand.cc (expand_vec_perm_blend):
	Canonicalize vec_merge.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/avx512fp16-vmovsh-1a.c: Remove xfail.
2023-09-05 11:11:14 +08:00
Juzhe-Zhong
6f94ef6c86 RISC-V: Fix Dynamic LMUL compile option
gcc/ChangeLog:

	* config/riscv/riscv-opts.h (enum riscv_autovec_lmul_enum): Fix Dynamic status.
	* config/riscv/riscv-v.cc (preferred_simd_mode): Ditto.
	(autovectorize_vector_modes): Ditto.
	(vectorize_related_mode): Ditto.
2023-09-05 10:55:16 +08:00
Christophe Lyon
99ec76eb8b testsuite: Remove unwanted 'dg-do run' from gcc.dg/vect tests
Tests under gcc.dg/vect use check_vect_support_and_set_flags to set
compilation flags as appropriate for the target, but they also set
dg-do-what-default to 'run' or 'compile', depending on the actual
target hardware (or simulator) capabilities.

For instance on arm, we use options to enable Neon, but set
dg-do-what-default to 'run' only if we cam actually execute Neon
instructions.

Therefore, we would always try to link and execute tests containing
'dg-do run', although dg-do-what-default says otherwise, leading to
uninteresting failures.

Therefore, this patch removes all such unconditionnal 'dg-do run',
thus avoid link errors for instance if GCC has been configured with
multilibs disabled and some --with-{float|cpu|hard} option
incompatible with what check_vect_support_and_set_flags selects.

For exmaple, GCC configured with:
--disable-multilib --with-mode=thumb --with-cpu=cortex-m7 --with-float=hard
and check_vect_support_and_set_flags uses
-mfpu=neon -mfloat-abi=softfp -march=armv7-a
(thus incompatible float-abi options)

Tested on native aarch64-linux-gnu (no change) and several arm-eabi
cases where the FAIL/UNRESOLVED disappear (and we keep only the
'compilation' tests).

2023-09-04  Christophe Lyon  <christophe.lyon@linaro.org>

	gcc/testsuite/
	* gcc.dg/vect/bb-slp-44.c: Remove 'dg-do run'.
	* gcc.dg/vect/bb-slp-71.c: Likewise.
	* gcc.dg/vect/bb-slp-72.c: Likewise.
	* gcc.dg/vect/bb-slp-73.c: Likewise.
	* gcc.dg/vect/bb-slp-74.c: Likewise.
	* gcc.dg/vect/bb-slp-pr101207.c: Likewise.
	* gcc.dg/vect/bb-slp-pr101615-1.c: Likewise.
	* gcc.dg/vect/bb-slp-pr101615-2.c: Likewise.
	* gcc.dg/vect/bb-slp-pr101668.c: Likewise.
	* gcc.dg/vect/bb-slp-pr54400.c: Likewise.
	* gcc.dg/vect/bb-slp-pr98516-1.c: Likewise.
	* gcc.dg/vect/bb-slp-pr98516-2.c: Likewise.
	* gcc.dg/vect/bb-slp-pr98544.c: Likewise.
	* gcc.dg/vect/pr101445.c: Likewise.
	* gcc.dg/vect/pr105219.c: Likewise.
	* gcc.dg/vect/pr107160.c: Likewise.
	* gcc.dg/vect/pr107212-1.c: Likewise.
	* gcc.dg/vect/pr107212-2.c: Likewise.
	* gcc.dg/vect/pr109502.c: Likewise.
	* gcc.dg/vect/pr110381.c: Likewise.
	* gcc.dg/vect/pr110838.c: Likewise.
	* gcc.dg/vect/pr88497-1.c: Likewise.
	* gcc.dg/vect/pr88497-7.c: Likewise.
	* gcc.dg/vect/pr96783-1.c: Likewise.
	* gcc.dg/vect/pr96783-2.c: Likewise.
	* gcc.dg/vect/pr97558-2.c: Likewise.
	* gcc.dg/vect/pr99253.c: Likewise.
	* gcc.dg/vect/slp-mask-store-1.c: Likewise.
	* gcc.dg/vect/vect-bic-bitmask-10.c: Likewise.
	* gcc.dg/vect/vect-bic-bitmask-11.c: Likewise.
	* gcc.dg/vect/vect-bic-bitmask-2.c: Likewise.
	* gcc.dg/vect/vect-bic-bitmask-3.c: Likewise.
	* gcc.dg/vect/vect-bic-bitmask-4.c: Likewise.
	* gcc.dg/vect/vect-bic-bitmask-5.c: Likewise.
	* gcc.dg/vect/vect-bic-bitmask-6.c: Likewise.
	* gcc.dg/vect/vect-bic-bitmask-8.c: Likewise.
	* gcc.dg/vect/vect-bic-bitmask-9.c: Likewise.
	* gcc.dg/vect/vect-cond-13.c: Likewise.
	* gcc.dg/vect/vect-recurr-1.c: Likewise.
	* gcc.dg/vect/vect-recurr-2.c: Likewise.
	* gcc.dg/vect/vect-recurr-3.c: Likewise.
	* gcc.dg/vect/vect-recurr-4.c: Likewise.
	* gcc.dg/vect/vect-recurr-5.c: Likewise.
	* gcc.dg/vect/vect-recurr-6.c: Likewise.
2023-09-04 20:44:21 +00:00
Christophe Lyon
084a7cf9fb Revert "libstdc++: Use GLIBCXX_CHECK_LINKER_FEATURES for cross-builds (PR111238)"
This reverts commit 46c2e94ca66ed9991c45a6ba6204ed02869efc39.
2023-09-04 20:44:20 +00:00
Christophe Lyon
56d0592db1 libstdc++: Use GLIBCXX_CHECK_LINKER_FEATURES for cross-builds (PR111238)
As discussed in PR104167 (comments #8 and below), and PR111238, using
-Wl,-gc-sections in the libstdc++ testsuite for arm-eabi
(cross-toolchain) avoids link failures for a few tests:

27_io/filesystem/path/108636.cc
std/time/clock/gps/1.cc
std/time/clock/gps/io.cc
std/time/clock/tai/1.cc
std/time/clock/tai/io.cc
std/time/clock/utc/1.cc
std/time/clock/utc/io.cc
std/time/clock/utc/leap_second_info.cc
std/time/exceptions.cc
std/time/format.cc
std/time/time_zone/get_info_local.cc
std/time/time_zone/get_info_sys.cc
std/time/tzdb/1.cc
std/time/tzdb/leap_seconds.cc
std/time/tzdb_list/1.cc
std/time/zoned_time/1.cc
std/time/zoned_time/custom.cc
std/time/zoned_time/io.cc
std/time/zoned_traits.cc

This patch achieves this by calling GLIBCXX_CHECK_LINKER_FEATURES in
cross-build cases, like we already do for native builds. We keep not
doing so in Canadian-cross builds.

However, this would hide the fact that libstdc++ somehow forces the
user to use -Wl,-gc-sections to avoid undefined references to chdir,
mkdir, chmod, pathconf, ... so maybe it's better to keep the status
quo and not apply this patch?

2023-08-31  Christophe Lyon  <christophe.lyon@linaro.org>

libstdc++-v3/ChangeLog:

	PR libstdc++/111238
	* configure: Regenerate.
	* configure.ac: Call GLIBCXX_CHECK_LINKER_FEATURES in cross,
	non-Canadian builds.
2023-09-04 20:44:20 +00:00
Marc Poulhiès
f3f6ff7b16 mklog: handle Signed-off-by, minor cleanup
Consider Signed-off-by lines as part of the ending of the initial
commit to avoid having these in the middle of the log when the
changelog part is injected after.

This is particularly usefull with:

 $ git gcc-commit-mklog --amend -s

that can be used to create the changelog and add the Signed-off-by line.

Also applies most of the shellcheck suggestions on the
prepare-commit-msg hook.

contrib/ChangeLog:

	* mklog.py: Leave SOB lines after changelog.
	* prepare-commit-msg: Apply most shellcheck suggestions.

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
2023-09-04 21:43:36 +02:00
Thiago Jung Bauermann
a338c5f611 testsuite: aarch64: Adjust SVE ACLE tests to new generated code
Since commit e7a36e4715 "[PATCH] RISC-V: Support simplify (-1-x) for
vector." these tests fail on aarch64-linux:

		=== g++ tests ===

Running g++:g++.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp ...
FAIL: gcc.target/aarch64/sve/acle/asm/subr_s8.c -std=gnu++98 -O2 -fno-schedule-insns -DCHECK_ASM --save-temps -DTEST_FULL  check-function-bodies subr_m1_s8_m
FAIL: gcc.target/aarch64/sve/acle/asm/subr_s8.c -std=gnu++98 -O2 -fno-schedule-insns -DCHECK_ASM --save-temps -DTEST_OVERLOADS  check-function-bodies subr_m1_s8_m
FAIL: gcc.target/aarch64/sve/acle/asm/subr_u8.c -std=gnu++98 -O2 -fno-schedule-insns -DCHECK_ASM --save-temps -DTEST_FULL  check-function-bodies subr_m1_u8_m
FAIL: gcc.target/aarch64/sve/acle/asm/subr_u8.c -std=gnu++98 -O2 -fno-schedule-insns -DCHECK_ASM --save-temps -DTEST_OVERLOADS  check-function-bodies subr_m1_u8_m

		=== gcc tests ===

Running gcc:gcc.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp ...
FAIL: gcc.target/aarch64/sve/acle/asm/subr_s8.c -std=gnu90 -O2 -fno-schedule-insns -DCHECK_ASM --save-temps -DTEST_FULL  check-function-bodies subr_m1_s8_m
FAIL: gcc.target/aarch64/sve/acle/asm/subr_s8.c -std=gnu90 -O2 -fno-schedule-insns -DCHECK_ASM --save-temps -DTEST_OVERLOADS  check-function-bodies subr_m1_s8_m
FAIL: gcc.target/aarch64/sve/acle/asm/subr_u8.c -std=gnu90 -O2 -fno-schedule-insns -DCHECK_ASM --save-temps -DTEST_FULL  check-function-bodies subr_m1_u8_m
FAIL: gcc.target/aarch64/sve/acle/asm/subr_u8.c -std=gnu90 -O2 -fno-schedule-insns -DCHECK_ASM --save-temps -DTEST_OVERLOADS  check-function-bodies subr_m1_u8_m

Andrew Pinski's analysis in PR testsuite/111071 is that the new code is
better and the testcase should be updated. I also asked Prathamesh Kulkarni
in private and he agreed.

Here is the update. With this change, all tests in
gcc.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp pass on aarch64-linux.

Suggested-by: Andrew Pinski <apinski@marvell.com>

gcc/testsuite/
	PR testsuite/111071
	* gcc.target/aarch64/sve/acle/asm/subr_s8.c: Adjust to new code.
	* gcc.target/aarch64/sve/acle/asm/subr_u8.c: Likewise.
2023-09-04 19:57:10 +01:00
Jonathan Wakely
270e702eda libstdc++: Remove unnecessary dg-options and outdated comment
It's no longer true that 1.0if has type float _Complex when GNU
extensions are enabled, so remove the hardcoded -std option.

libstdc++-v3/ChangeLog:

	* testsuite/26_numerics/complex/literals/types.cc: Remove
	dg-options and add target selector instead.
2023-09-04 16:24:35 +01:00
Jonathan Wakely
455907564c libstdc++: Remove dg-options "-std=c++98" from TR1 tests
These tests need slight adjustments to be valid in C++11 and later, but
there's no reason that can't be done, so that we test them in more
modes.

libstdc++-v3/ChangeLog:

	* testsuite/tr1/6_containers/utility/pair.cc: Remove dg-options
	and qualify ambiguous calls to get.
	* testsuite/tr1/8_c_compatibility/cmath/pow_cmath.cc: Adjust
	expected result for std::pow(float, int) as per DR 550.
2023-09-04 16:24:35 +01:00
Jonathan Wakely
678834e9ff libstdc++: Enable std::auto_ptr tests for C++11 and later
There is no reason to only test std::auto_ptr with -std=c++03, we just
need to handle the deprecated warnings for C++11 and later.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/auto_ptr/1.cc: Remove dg-options -std=c++03
	and add dg-warning for deprecation warnings.
	* testsuite/20_util/auto_ptr/2.cc: Likewise.
	* testsuite/20_util/auto_ptr/3.cc: Likewise.
	* testsuite/20_util/auto_ptr/3946.cc: Likewise.
	* testsuite/20_util/auto_ptr/4.cc: Likewise.
	* testsuite/20_util/auto_ptr/5.cc: Likewise.
	* testsuite/20_util/auto_ptr/6.cc: Likewise.
	* testsuite/20_util/auto_ptr/7.cc: Likewise.
	* testsuite/20_util/auto_ptr/assign_neg.cc: Likewise.
	* testsuite/20_util/auto_ptr/requirements/explicit_instantiation/1.cc:
	Likewise.
	* testsuite/tr1/2_general_utilities/shared_ptr/assign/auto_ptr.cc:
	Likewise.
	* testsuite/tr1/2_general_utilities/shared_ptr/assign/auto_ptr_neg.cc:
	Likewise.
	* testsuite/tr1/2_general_utilities/shared_ptr/assign/auto_ptr_rvalue_neg.cc:
	Likewise.
	* testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc:
	Likewise.
	* testsuite/tr1/2_general_utilities/shared_ptr/cons/auto_ptr.cc:
	Likewise.
	* testsuite/tr1/2_general_utilities/shared_ptr/cons/auto_ptr_neg.cc:
	Likewise.
2023-09-04 16:24:35 +01:00
Jonathan Wakely
affbb7b432 libstdc++: Fix filenames and comments in tests [PR26142]
These tests have transposed digits in the filenames and comments.

libstdc++-v3/ChangeLog:

	PR libstdc++/26142
	* testsuite/23_containers/vector/26412-1.cc: Moved to...
	* testsuite/23_containers/vector/26142-1.cc: ...here.
	* testsuite/23_containers/vector/26412-2.cc: Moved to...
	* testsuite/23_containers/vector/26142-2.cc: ...here.
2023-09-04 16:24:35 +01:00
Jonathan Wakely
4bbe1414e1 libstdc++: Add { target c++98_only } to tests
These test behaviour only seen with -std=c++03 so the target selector
should match.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/bitset/107037.cc: Add c++98_only selector.
	* testsuite/26_numerics/complex/56111.cc: Likewise.
2023-09-04 16:24:34 +01:00
Jonathan Wakely
0eb35092de libstdc++: Add explicit -std=gnu++98 to tests that use { target c++98_only }
libstdc++-v3/ChangeLog:

	* testsuite/23_containers/deque/requirements/explicit_instantiation/2.cc:
	Add dg-options to restrict the test to C++98 mode.
	* testsuite/23_containers/list/requirements/explicit_instantiation/2.cc:
	Likewise.
2023-09-04 16:04:26 +01:00
Jonathan Wakely
c34ad4bc19 libstdc++: Add missing target selector to std::expected test
This test should use a target selector of c++23 so that the explicit
-std=gnu++23 option can be removed, to allow testing with later
standards too.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/expected/bad.cc: Add missing target
	selector.
2023-09-04 16:04:26 +01:00
Tobias Burnus
fe0f9e0941 Add 'libgomp.c-c++-common/pr100059-1.c'
For nvptx offloading, it'll FAIL its execution test until nvptx-tools updated
to include commit 1b5946d78ef5dcfb640e9f545a7c791b7f623911
"Merge commit '26095fd01232061de9f79decb3e8222ef7b46191' into HEAD [#29]",
<1b5946d78e>.

	libgomp/
	* testsuite/libgomp.c-c++-common/pr100059-1.c: New.

Co-authored-by: Thomas Schwinge <thomas@codesourcery.com>
2023-09-04 14:49:50 +02:00
Iain Sandoe
b3ab28c3e8 Darwin, ppc: Add system stubs for all 32b PPC
This is a minor adjustment to make the GCC behaviour better match the
old system tools.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

gcc/ChangeLog:

	* config/rs6000/darwin.h (LIB_SPEC): Include libSystemStubs for
	all 32b Darwin PowerPC cases.
2023-09-04 12:32:00 +01:00
Iain Sandoe
68dc3e94fd Darwin: Place global inits in the correct section.
This handles placement of global initializers into __TEXT,__StaticInit as used
by other platform toolchains.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

gcc/ChangeLog:

	* config/darwin-sections.def (static_init_section): Add the
	__TEXT,__StaticInit section.
	* config/darwin.cc (darwin_function_section): Use the static init
	section for global initializers, to match other platform toolchains.
2023-09-04 12:25:30 +01:00
Iain Sandoe
0fe7962afc Darwin: Match system sections and relocs for exception tables.
System tools from Darwin10 onwards have moved the exceptions tables from
the __DATA segment to the __TEXT one.  They also revised the relocations
used for typeinfo.  While Darwin9 was not changed at the time, in fact the
tools there are equally happy with the revised scheme - and therefore at
present there seems no reason to special-case it.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

gcc/ChangeLog:

	* config/darwin-sections.def (darwin_exception_section): Move to
	the __TEXT segment.
	* config/darwin.cc (darwin_emit_except_table_label): Align before
	the exception table label.
	* config/darwin.h (ASM_PREFERRED_EH_DATA_FORMAT): Use indirect PC-
	relative 4byte relocs.
2023-09-04 11:50:35 +01:00
Iain Sandoe
9018cd0fc6 Darwin, machopic: Debug printer for macho symbol flags.
There are now quite a few symbol flags, so it is sometimes useful to get
them in a text form, rather than decoding the hex number printed by
debug_rtx().

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

gcc/ChangeLog:

	* config/darwin.cc (dump_machopic_symref_flags): New.
	(debug_machopic_symref_flags): New.
2023-09-04 11:21:51 +01:00
Pan Li
d99a868a9b RISC-V: Support FP16 for RVV VRGATHEREI16 intrinsic
This patch would like to add FP16 support for the VRGATHEREI16
intrinsic. Aka:

* __riscv_vrgatherei16_vv_f16mf4
* __riscv_vrgatherei16_vv_f16mf4_m

As well as f16mf2 to f16m8 types.

Signed-off-by: Pan Li <pan2.li@intel.com>

gcc/ChangeLog:

	* config/riscv/riscv-vector-builtins-types.def
	(vfloat16mf4_t): Add FP16 intrinsic def.
	(vfloat16mf2_t): Ditto.
	(vfloat16m1_t): Ditto.
	(vfloat16m2_t): Ditto.
	(vfloat16m4_t): Ditto.
	(vfloat16m8_t): Ditto.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/intrisinc-vrgatherei16.c: New test.
2023-09-04 15:45:33 +08:00
Jiufu Guo
1aceceb1e2 Optimize '(X - N * M) / N' to 'X / N - M' if valid
Integer expression "(X - N * M) / N" can be optimized to "X / N - M" with
the below conditions:
1. There is no wrap/overflow/underflow.
   wrap/overflow/underflow breaks the arithmetic operation.
2. "X - N * M" and "X" are not of opposite sign.
   Here, the operation "/" would be "trunc_div", the fractional part is
   discarded. If "X - N * M" and "X" are in different signs, then trunc_div
   discards the fractional parts (of /N) in different directions.

	PR tree-optimization/108757

gcc/ChangeLog:

	* match.pd ((X - N * M) / N): New pattern.
	((X + N * M) / N): New pattern.
	((X + C) div_rshift N): New pattern.

gcc/testsuite/ChangeLog:

	* gcc.dg/pr108757-1.c: New test.
	* gcc.dg/pr108757-2.c: New test.
	* gcc.dg/pr108757.h: New test.
2023-09-04 10:36:08 +08:00
Guo Jie
828130772c LoongArch: Support storing floating-point zero into MEM[base + index].
v2: Modify commit message.

gcc/ChangeLog:

	* config/loongarch/loongarch.md: Support 'G' -> 'k' in
	movsf_hardfloat and movdf_hardfloat.

gcc/testsuite/ChangeLog:

	* gcc.target/loongarch/const-double-zero-stx.c: New test.
2023-09-04 09:45:54 +08:00
Lulu Cheng
ead6a14290 LoongArch: Optimize switch with sign-extended index.
The patch refers to the submission of RISCV
7bbce9b503.

gcc/ChangeLog:

	* config/loongarch/loongarch.cc (loongarch_extend_comparands):
	In unsigned QImode test, check for sign extended subreg and/or
	constant operands, and do a sign extension in that case.
	* config/loongarch/loongarch.md (TARGET_64BIT): Define
	template cbranchqi4.

gcc/testsuite/ChangeLog:

	* gcc.target/loongarch/switch-qi.c: New test.
2023-09-04 09:40:02 +08:00
Lulu Cheng
26aa5d9017 LoongArch: Optimize fixed-point and floating-point conversion operations.
Before optimization, the operation of taking fixed-point numbers from memory
and then forcing type conversion needs to be loaded into fixed-point registers
before conversion. After the optimization is completed, the fixed-point value
is directly transferred to the floating-point register for type conversion.

eg:
    extern int a;
    float
    test(void)
    {
      return (float)a;
    }

Assembly code before optimization:
	pcalau12i	$r12,%got_pc_hi20(a)
	ld.d	$r12,$r12,%got_pc_lo12(a)
	ldptr.w	$r12,$r12,0
	movgr2fr.w	$f0,$r12
	ffint.s.w	$f0,$f0

Optimized assembly code:
	pcalau12i	$r12,%got_pc_hi20(a)
	ld.d	$r12,$r12,%got_pc_lo12(a)
	fld.s	$f0,$r12,0
	ffint.s.w	$f0,$f0

gcc/ChangeLog:

	* config/loongarch/loongarch.md: Allows fixed-point values to be loaded
	from memory into floating-point registers.

gcc/testsuite/ChangeLog:

	* gcc.target/loongarch/float-load.c: New test.
2023-09-04 09:34:46 +08:00
GCC Administrator
124749a0f6 Daily bump. 2023-09-04 00:17:00 +00:00
Francois-Xavier Coudert
78f636d979 Testsuite: fix contructor priority test
Fix the expected warning wording for targets without constructor
priority, like Darwin, making the test pass.

gcc/testsuite/ChangeLog:

	PR testsuite/111066
	* g++.dg/special/initpri3.C: Fix wording.
2023-09-03 15:35:17 +02:00
Pan Li
a7d052b320 RISC-V: Support FP MAX/MIN autovec for VLS mode
This patch would like to allow the VLS mode autovec for the
floating-point binary operation MAX/MIN.

Given below code example:

test (float *out, float *in1, float *in2)
{
  for (int i = 0; i < 128; i++)
    out[i] = in1[i] > in2[i] ? in1[i] : in2[i];
    // Or out[i] = fmax (in1[i], in2[i]);
}

Before this patch:
test:
  csrr    a4,vlenb
  slli    a4,a4,1
  li      a5,128
  bleu    a5,a4,.L2
  mv      a5,a4
.L2:
  vsetvli zero,a5,e32,m8,ta,ma
  vle32.v v16,0(a1)
  vle32.v v8,0(a2)
  vsetvli a3,zero,e32,m8,ta,ma
  vmfgt.vv        v0,v16,v8
  vmerge.vvm      v8,v8,v16,v0
  vsetvli zero,a5,e32,m8,ta,ma
  vse32.v v8,0(a0)
  ret

After this patch:
test:
  li      a5,128
  vsetvli zero,a5,e32,m1,ta,ma
  vle32.v v1,0(a1)
  vle32.v v2,0(a2)
  vfmax.vv        v1,v1,v2
  vse32.v v1,0(a0)
  ret

This MAX/MIN autovec acts on function call like fmaxf/fmax in math.h
too. And it depends on the option -ffast-math.

Signed-off-by: Pan Li <pan2.li@intel.com>

gcc/ChangeLog:

	* config/riscv/autovec-vls.md (<optab><mode>3): New pattern for
	fmax/fmin
	* config/riscv/vector.md: Add VLS modes to vfmax/vfmin.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/autovec/vls/def.h: New macros.
	* gcc.target/riscv/rvv/autovec/vls/floating-point-max-1.c: New test.
	* gcc.target/riscv/rvv/autovec/vls/floating-point-max-2.c: New test.
	* gcc.target/riscv/rvv/autovec/vls/floating-point-max-3.c: New test.
	* gcc.target/riscv/rvv/autovec/vls/floating-point-max-4.c: New test.
	* gcc.target/riscv/rvv/autovec/vls/floating-point-max-5.c: New test.
	* gcc.target/riscv/rvv/autovec/vls/floating-point-min-1.c: New test.
	* gcc.target/riscv/rvv/autovec/vls/floating-point-min-2.c: New test.
	* gcc.target/riscv/rvv/autovec/vls/floating-point-min-3.c: New test.
	* gcc.target/riscv/rvv/autovec/vls/floating-point-min-4.c: New test.
	* gcc.target/riscv/rvv/autovec/vls/floating-point-min-5.c: New test.
2023-09-03 08:17:51 +08:00
GCC Administrator
9f48aba019 Daily bump. 2023-09-03 00:16:32 +00:00
Mikael Morin
474473f042 diagnostics: Delete config pointer before overwriting it
Delete m_client_data_hooks before it is reassigned in
tree_diagnostics_defaults.  This fixes a small memory leak in the fortran
frontend, which restores the diagnostics configurations to their default
values with a call to tree_diagnostics_defaults at the end of the main parse
hook.

gcc/ChangeLog:

	* tree-diagnostic.cc (tree_diagnostics_defaults): Delete allocated
	pointer before overwriting it.
2023-09-02 12:55:25 +02:00