platform/upstream/gcc.git
2 years agotestsuite: Skip intrinsics test if arm
Torbjörn SVENSSON [Mon, 19 Sep 2022 16:08:46 +0000 (18:08 +0200)]
testsuite: Skip intrinsics test if arm

In the test cases, it's clearly written that intrinsics is not
implemented on arm*. A simple xfail does not help since there are
link error and that would cause an UNRESOLVED testcase rather than
XFAIL.
By changing to dg-skip-if, the entire test case is omitted.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/advsimd-intrinsics/vld1x2.c: Replace
dg-xfail-if with dg-skip-if.
* gcc.target/aarch64/advsimd-intrinsics/vld1x3.c: Likewise.
* gcc.target/aarch64/advsimd-intrinsics/vld1x4.c: Likewise.

Co-Authored-By: Yvan ROUX <yvan.roux@foss.st.com>
Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2 years agoc++: Implement __is_{nothrow_,}convertible [PR106784]
Marek Polacek [Tue, 20 Sep 2022 19:48:52 +0000 (15:48 -0400)]
c++: Implement __is_{nothrow_,}convertible [PR106784]

To improve compile times, the C++ library could use compiler built-ins
rather than implementing std::is_convertible (and _nothrow) as class
templates.  This patch adds the built-ins.  We already have
__is_constructible and __is_assignable, and the nothrow forms of those.

Microsoft (and clang, for compatibility) also provide an alias called
__is_convertible_to.  I did not add it, but it would be trivial to do
so.

I noticed that our __is_assignable doesn't implement the "Access checks
are performed as if from a context unrelated to either type" requirement,
therefore std::is_assignable / __is_assignable give two different results
here:

  class S {
    operator int();
    friend void g(); // #1
  };

  void
  g ()
  {
    // #1 doesn't matter
    static_assert(std::is_assignable<int&, S>::value, "");
    static_assert(__is_assignable(int&, S), "");
  }

This is not a problem if __is_assignable is not meant to be used by
the users.

This patch doesn't make libstdc++ use the new built-ins, but I had to
rename a class otherwise its name would clash with the new built-in.

PR c++/106784

gcc/c-family/ChangeLog:

* c-common.cc (c_common_reswords): Add __is_convertible and
__is_nothrow_convertible.
* c-common.h (enum rid): Add RID_IS_CONVERTIBLE and
RID_IS_NOTHROW_CONVERTIBLE.

gcc/cp/ChangeLog:

* constraint.cc (diagnose_trait_expr): Handle CPTK_IS_CONVERTIBLE
and CPTK_IS_NOTHROW_CONVERTIBLE.
* cp-objcp-common.cc (names_builtin_p): Handle RID_IS_CONVERTIBLE
RID_IS_NOTHROW_CONVERTIBLE.
* cp-tree.h (enum cp_trait_kind): Add CPTK_IS_CONVERTIBLE and
CPTK_IS_NOTHROW_CONVERTIBLE.
(is_convertible): Declare.
(is_nothrow_convertible): Likewise.
* cxx-pretty-print.cc (pp_cxx_trait_expression): Handle
CPTK_IS_CONVERTIBLE and CPTK_IS_NOTHROW_CONVERTIBLE.
* method.cc (is_convertible): New.
(is_nothrow_convertible): Likewise.
* parser.cc (cp_parser_primary_expression): Handle RID_IS_CONVERTIBLE
and RID_IS_NOTHROW_CONVERTIBLE.
(cp_parser_trait_expr): Likewise.
* semantics.cc (trait_expr_value): Handle CPTK_IS_CONVERTIBLE and
CPTK_IS_NOTHROW_CONVERTIBLE.
(finish_trait_expr): Likewise.

libstdc++-v3/ChangeLog:

* include/std/type_traits: Rename __is_nothrow_convertible to
__is_nothrow_convertible_lib.
* testsuite/20_util/is_nothrow_convertible/value_ext.cc: Likewise.

gcc/testsuite/ChangeLog:

* g++.dg/ext/has-builtin-1.C: Enhance to test __is_convertible and
__is_nothrow_convertible.
* g++.dg/ext/is_convertible1.C: New test.
* g++.dg/ext/is_convertible2.C: New test.
* g++.dg/ext/is_nothrow_convertible1.C: New test.
* g++.dg/ext/is_nothrow_convertible2.C: New test.

2 years agoRISC-V: make USE_LOAD_ADDRESS_MACRO easier to understand
Vineet Gupta [Fri, 2 Sep 2022 23:08:20 +0000 (16:08 -0700)]
RISC-V: make USE_LOAD_ADDRESS_MACRO easier to understand

The current macro has several && and || making it really hard to understand
the first time.

Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
gcc/ChangeLog:

* config/riscv/riscv.h (LOCAL_SYM_P): New.
(USE_LOAD_ADDRESS_MACRO): Simplify by calling LOCAL_SYM_P.

2 years agoRISC-V: Add RVV machine modes.
zhongjuzhe [Thu, 15 Sep 2022 11:39:43 +0000 (19:39 +0800)]
RISC-V: Add RVV machine modes.

gcc/ChangeLog:

* config/riscv/riscv-modes.def (VECTOR_BOOL_MODE): Add RVV mask modes.
(ADJUST_NUNITS): Adjust nunits using riscv_vector_chunks.
(ADJUST_ALIGNMENT): Adjust alignment.
(ADJUST_BYTESIZE): Adjust bytesize using riscv_vector_chunks.
(RVV_MODES): New macro.
(VECTOR_MODE_WITH_PREFIX): Add RVV vector modes.
(VECTOR_MODES_WITH_PREFIX): Add RVV vector modes.

2 years agoRISC-V: Support poly move manipulation and selftests.
zhongjuzhe [Thu, 15 Sep 2022 08:28:53 +0000 (16:28 +0800)]
RISC-V: Support poly move manipulation and selftests.

gcc/ChangeLog:

* common/config/riscv/riscv-common.cc: Change "static void" to "void".
* config.gcc: Add riscv-selftests.o
* config/riscv/predicates.md: Allow const_poly_int.
* config/riscv/riscv-protos.h (riscv_reinit): New function.
(riscv_parse_arch_string): change as exten function.
(riscv_run_selftests): New function.
* config/riscv/riscv.cc (riscv_cannot_force_const_mem): Don't allow poly
into const pool.
(riscv_report_v_required): New function.
(riscv_expand_op): New function.
(riscv_expand_mult_with_const_int): New function.
(riscv_legitimize_poly_move): Ditto.
(riscv_legitimize_move): New function.
(riscv_hard_regno_mode_ok): Add VL/VTYPE register allocation and fix
vector RA.
(riscv_convert_vector_bits): Fix riscv_vector_chunks configuration for
-marh no 'v'.
(riscv_reinit): New function.
(TARGET_RUN_TARGET_SELFTESTS): New target hook support.
* config/riscv/t-riscv: Add riscv-selftests.o.
* config/riscv/riscv-selftests.cc: New file.

gcc/testsuite/ChangeLog:

* selftests/riscv/empty-func.rtl: New test.

2 years agolibstdc++: Micro-optimizaion for std::bitset stream extraction
Jonathan Wakely [Fri, 23 Sep 2022 12:39:31 +0000 (13:39 +0100)]
libstdc++: Micro-optimizaion for std::bitset stream extraction

Don't bother trying to copy any characters for bitset<0>.

libstdc++-v3/ChangeLog:

* include/std/bitset (operator>>): Do not copy for N==0.
* testsuite/20_util/bitset/io/input.cc: Add comment.

2 years agotree-optimization/106922 - extend same-val clobber FRE
Richard Biener [Fri, 23 Sep 2022 12:28:52 +0000 (14:28 +0200)]
tree-optimization/106922 - extend same-val clobber FRE

The following extends the skipping of same valued stores to
handle an arbitrary number of them as long as they are from the
same value (which we now record).  That's an obvious extension
which allows to optimize the m_engaged member of std::optional
more reliably.

PR tree-optimization/106922
* tree-ssa-sccvn.cc (vn_reference_lookup_3): Allow
an arbitrary number of same valued skipped stores.

* g++.dg/torture/pr106922.C: New testcase.

2 years agofrange: Make the setter taking trees a wrapper.
Aldy Hernandez [Fri, 23 Sep 2022 11:05:26 +0000 (13:05 +0200)]
frange: Make the setter taking trees a wrapper.

The frange setter does all its work in trees.  This incurs a penalty
for the real_value variants because they must wrap their arguments
into a tree and pass it to the tree setter, which will then do the
opposite.  This is leftovers from the irange setter.

Even though the we still need constructors taking trees so we can
interact with the tree world, there's no sense penalizing the rest of
the implementation.

Tested on x86-64 Linux.

gcc/ChangeLog:

* value-range.cc (frange::set): Swap setters such that the one
accepting REAL_VALUE_TYPE does all the work.

2 years agolibstdc++: Enable constexpr std::bitset for debug mode
Jonathan Wakely [Fri, 23 Sep 2022 09:12:09 +0000 (10:12 +0100)]
libstdc++: Enable constexpr std::bitset for debug mode

We already disable all debug mode checks for C++11 and later, so we can
easily make everything constexpr. This fixes the FAIL results for the
new tests when using -D_GLIBCXX_DEBUG.

Also fix some other tests failing with non-default test flags.

libstdc++-v3/ChangeLog:

* include/debug/bitset (__debug::bitset): Add constexpr to all
member functions.
(operator&, operator|, operator^): Add inline and constexpr.
(operator>>, operator<<): Add inline.
* testsuite/20_util/bitset/access/constexpr.cc: Only check using
constexpr std::string for the cxx11 ABI.
* testsuite/20_util/bitset/cons/constexpr_c++23.cc: Likewise.
* testsuite/20_util/headers/bitset/synopsis.cc: Check constexpr
for C++23.

2 years agolibstdc++: Optimize std::bitset<N>::to_string
Jonathan Wakely [Thu, 22 Sep 2022 17:36:04 +0000 (18:36 +0100)]
libstdc++: Optimize std::bitset<N>::to_string

This makes to_string approximately twice as fast at any optimization
level. Instead of iterating through every bit, jump straight to the next
bit that is set, by using _Find_first and _Find_next.

libstdc++-v3/ChangeLog:

* include/std/bitset (bitset::_M_copy_to_string): Find set bits
instead of iterating over individual bits.

2 years agoaarch64: Add Arm Neoverse V2 support
Kyrylo Tkachov [Fri, 23 Sep 2022 11:12:29 +0000 (12:12 +0100)]
aarch64: Add Arm Neoverse V2 support

This patch adds -mcpu/-mtune support for the Arm Neoverse V2 core.
This updates the internal references to "demeter", but leaves "demeter" as an
accepted value to -mcpu/-mtune as it appears in the released GCC 12 series.

Bootstrapped and tested on aarch64-none-linux-gnu.

gcc/ChangeLog:

* config/aarch64/aarch64-cores.def (neoverse-v2): New entry.
(demeter): Update tunings to neoversev2.
* config/aarch64/aarch64-tune.md: Regenerate.
* config/aarch64/aarch64.cc (demeter_addrcost_table): Rename to
neoversev2_addrcost_table.
(demeter_regmove_cost): Rename to neoversev2_addrcost_table.
(demeter_advsimd_vector_cost): Rename to neoversev2_advsimd_vector_cost.
(demeter_sve_vector_cost): Rename to neoversev2_sve_vector_cost.
(demeter_scalar_issue_info): Rename to neoversev2_scalar_issue_info.
(demeter_advsimd_issue_info): Rename to neoversev2_advsimd_issue_info.
(demeter_sve_issue_info): Rename to neoversev2_sve_issue_info.
(demeter_vec_issue_info): Rename to neoversev2_vec_issue_info.
Update references to above.
(demeter_vector_cost): Rename to neoversev2_vector_cost.
(demeter_tunings): Rename to neoversev2_tunings.
(aarch64_vec_op_count::rename_cycles_per_iter): Use
neoversev2_sve_issue_info instead of demeter_sve_issue_info.
* doc/invoke.texi (AArch64 Options): Document neoverse-v2.

2 years agoMAINTAINERS: Add myself to Write After Approval
Paul-Antoine Arras [Fri, 23 Sep 2022 10:21:48 +0000 (10:21 +0000)]
MAINTAINERS: Add myself to Write After Approval

ChangeLog:

* MAINTAINERS (Write After Approval): Add myself.

2 years agotestsuite: make check-functions-body dump expected and seen cases on failure.
Tamar Christina [Fri, 23 Sep 2022 09:56:30 +0000 (10:56 +0100)]
testsuite: make check-functions-body dump expected and seen cases on failure.

Often times when a check_function_body check fails it can be quite hard to
figure out why as no additional information is provided.

This changes it so that on failures it prints out the regex expression it's
using and the text it's comparing against to the verbose log.

This makes it much easier to figure out why a test has failed.

gcc/testsuite/ChangeLog:

* lib/scanasm.exp (check_function_body): Add debug output to verbose log
on failure.

2 years agofrange: drop endpoints to min/max representable numbers for -ffinite-math-only.
Aldy Hernandez [Thu, 22 Sep 2022 16:20:39 +0000 (18:20 +0200)]
frange: drop endpoints to min/max representable numbers for -ffinite-math-only.

Similarly to how we drop NANs to UNDEFINED when -ffinite-math-only, I
think we can drop the numbers outside of the min/max representable
numbers to the representable number.

This means the endpoings to VR_VARYING for -ffinite-math-only can now
be the min/max representable, instead of -INF and +INF.

Saturating in the setter means that the upcoming implementation for
binary operators no longer have to worry about doing the right
thing for -ffinite-math-only.  If the range goes outside the limits,
it'll get chopped down.

Tested on x86-64 Linux.

gcc/ChangeLog:

* range-op-float.cc (build_le): Use vrp_val_*.
(build_lt): Same.
(build_ge): Same.
(build_gt): Same.
* value-range.cc (frange::set): Chop ranges outside of the
representable numbers for -ffinite-math-only.
(frange::normalize_kind): Use vrp_val*.
(frange::verify_range): Same.
(frange::set_nonnegative): Same.
(range_tests_floats): Remove tests that depend on -INF and +INF.
* value-range.h (real_max_representable): Add prototype.
(real_min_representable): Same.
(vrp_val_max): Set max representable number for
-ffinite-math-only.
(vrp_val_min): Same but for min.
(frange::set_varying): Use vrp_val*.

2 years agoAdd debug functions for REAL_VALUE_TYPE.
Aldy Hernandez [Thu, 22 Sep 2022 16:03:16 +0000 (18:03 +0200)]
Add debug functions for REAL_VALUE_TYPE.

We currently have no way of dumping REAL_VALUE_TYPEs when debugging.

Tested on a gdb session examining the real value 10.0:

(gdb) p min
$9 = {cl = 1, decimal = 0, sign = 0, signalling = 0, canonical = 0, uexp = 4, sig = {0, 0, 11529215046068469760}}
(gdb) p debug (min)
0x0.ap+4

gcc/ChangeLog:

* real.cc (debug): New.

2 years agofrange: dump hex values when dumping FP numbers.
Aldy Hernandez [Thu, 22 Sep 2022 16:07:03 +0000 (18:07 +0200)]
frange: dump hex values when dumping FP numbers.

It has been suggested that if we start bumping numbers by an ULP when
calculating open ranges (for example the numbers less than 3.0) that
dumping these will become increasingly harder to read, and instead we
should opt for the hex representation.  I still find the floating
point representation easier to read for most numbers, but perhaps we
could have both?

With this patch this is the representation for [15.0, 20.0]:

     [frange] float [1.5e+1 (0x0.fp+4), 2.0e+1 (0x0.ap+5)]

Would you find this useful, or should we stick to the hex
representation only?

Tested on x86-64 Linux.

gcc/ChangeLog:

* value-range-pretty-print.cc (vrange_printer::print_real_value): New.
(vrange_printer::visit): Call print_real_value.
* value-range-pretty-print.h: New print_real_value.

2 years agoopts: fix --help=common with '\t' description
Martin Liska [Thu, 22 Sep 2022 13:57:48 +0000 (15:57 +0200)]
opts: fix --help=common with '\t' description

Fixes -flto-compression option:

-  -flto-compression-level=<number> Use z Use zlib/zstd compression level <number> for IL.
+  -flto-compression-level=<0,19> Use zlib/zstd compression level <number> for IL.

gcc/ChangeLog:

* common.opt: Update -flto-compression-level documentation.
* opts.cc (print_filtered_help): Do not append range to an
  option that uses \t syntax.

2 years agotestsuite: Fix up pr106922.C test
Jakub Jelinek [Fri, 23 Sep 2022 07:46:59 +0000 (09:46 +0200)]
testsuite: Fix up pr106922.C test

On Thu, Sep 22, 2022 at 01:10:08PM +0200, Richard Biener via Gcc-patches wrote:
>       * g++.dg/tree-ssa/pr106922.C: Adjust.

> --- a/gcc/testsuite/g++.dg/tree-ssa/pr106922.C
> +++ b/gcc/testsuite/g++.dg/tree-ssa/pr106922.C
> @@ -87,5 +87,4 @@ void testfunctionfoo() {
>    }
>  }
>
> -// { dg-final { scan-tree-dump-times "Found fully redundant value" 4 "pre" { xfail { ! lp64 } } } }
> -// { dg-final { scan-tree-dump-not "m_initialized" "cddce3" { xfail { ! lp64 } } } }
> +// { dg-final { scan-tree-dump-not "m_initialized" "dce3" } }

I've noticed
+UNRESOLVED: g++.dg/tree-ssa/pr106922.C  -std=gnu++20  scan-tree-dump-not dce3 "m_initialized"
+UNRESOLVED: g++.dg/tree-ssa/pr106922.C  -std=gnu++2b  scan-tree-dump-not dce3 "m_initialized"
with this change, both on x86_64 and i686.
The dump is still cddce3, additionally as the last reference to the pre
dump is gone, not sure it is worth creating that dump.

With the following patch, there aren't FAILs nor UNRESOLVED tests with
GXX_TESTSUITE_STDS=98,11,14,17,20,2b make check-g++ RUNTESTFLAGS="--target_board=unix\{-m32,-m64\} dg.exp='pr106922.C'"

2022-09-23  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/106922
* g++.dg/tree-ssa/pr106922.C: Scan in cddce3 dump rather than
dce3.  Remove -fdump-tree-pre-details from dg-options.

2 years agoattribs: Improve diagnostics
Jakub Jelinek [Fri, 23 Sep 2022 07:10:16 +0000 (09:10 +0200)]
attribs: Improve diagnostics

When looking at the attribs code, I've noticed weird diagnostics
like
int a __attribute__((section ("foo", "bar")));
a.c:1:1: error: wrong number of arguments specified for ‘section’ attribute
    1 | int a __attribute__((section ("foo", "bar")));
      | ^~~
a.c:1:1: note: expected between 1 and 1, found 2
As roughly 50% of attributes that accept any arguments have
spec->min_length == spec->max_length, I think it is worth it to have
separate wording for such common case and just write simpler
a.c:1:1: note: expected 1, found 2

2022-09-23  Jakub Jelinek  <jakub@redhat.com>

* attribs.cc (decl_attributes): Improve diagnostics, instead of
saying expected between 1 and 1, found 2 just say expected 1, found 2.

2 years agoi386: Optimize code generation of __mm256_zextsi128_si256(__mm_set1_epi8(-1))
Hu, Lin1 [Tue, 13 Sep 2022 08:28:54 +0000 (16:28 +0800)]
i386: Optimize code generation of __mm256_zextsi128_si256(__mm_set1_epi8(-1))

gcc/ChangeLog:

PR target/94962
* config/i386/constraints.md (BH): New define_constraint.
* config/i386/i386.cc (standard_sse_constant_p): Add return
3/4 when operand matches new predicate.
(standard_sse_constant_opcode): Add new alternative branch to
return "vpcmpeqd".
* config/i386/predicates.md
(vector_all_ones_zero_extend_half_operand): New define_predicate.
(vector_all_ones_zero_extend_quarter_operand): Ditto.
* config/i386/sse.md: Add constraint to insn "mov<mode>_internal".

gcc/testsuite/ChangeLog:

PR target/94962
* gcc.target/i386/avx256-unaligned-load-1.c: Modify test.
* gcc.target/i386/avx256-unaligned-store-1.c: Ditto.
* gcc.target/i386/avx256-unaligned-store-2.c: Ditto.
* gcc.target/i386/avx256-unaligned-store-3.c: Ditto.
* gcc.target/i386/pr94962-1.c: New test.
* gcc.target/i386/pr94962-2.c: Ditto.
* gcc.target/i386/pr94962-3.c: Ditto.
* gcc.target/i386/pr94962-4.c: Ditto.

2 years agoc++: ICE-on-invalid with designated initializer [PR106983]
Marek Polacek [Tue, 20 Sep 2022 18:54:57 +0000 (14:54 -0400)]
c++: ICE-on-invalid with designated initializer [PR106983]

We ICE in the code added in r12-7117: type_build_dtor_call gets
the error_mark_node because the type of 'prev' wasn't declared.

PR c++/106983

gcc/cp/ChangeLog:

* typeck2.cc (split_nonconstant_init_1): Check TYPE_P.

gcc/testsuite/ChangeLog:

* g++.dg/other/error36.C: New test.

2 years agoDaily bump.
GCC Administrator [Fri, 23 Sep 2022 00:18:01 +0000 (00:18 +0000)]
Daily bump.

2 years agoAvoid depending on destructor order
Thomas Neumann [Mon, 19 Sep 2022 16:10:02 +0000 (18:10 +0200)]
Avoid depending on destructor order

In some scenarios (e.g., when mixing gcc and clang code), it can
happen that frames are deregistered after the lookup structure
has already been destroyed. That in itself would be fine, but
it triggers an assert in __deregister_frame_info_bases that
expects to find the frame.

To avoid that, we now remember that the btree as already been
destroyed and disable the assert in that case.

libgcc/ChangeLog:

* unwind-dw2-fde.c: (release_register_frames) Remember
when the btree has been destroyed.
(__deregister_frame_info_bases) Disable the assert when
shutting down.

2 years agoUpdate gcc fr.po
Joseph Myers [Thu, 22 Sep 2022 21:56:52 +0000 (21:56 +0000)]
Update gcc fr.po

* fr.po: Update.

2 years agoConvert CFN_BUILT_IN_PARITY to range-ops.
Andrew MacLeod [Tue, 20 Sep 2022 23:30:46 +0000 (19:30 -0400)]
Convert CFN_BUILT_IN_PARITY to range-ops.

Also, as the last builtin remaining, also remove the builtin infrastrucure
routines from fold_using_range.

* gimple-range-fold.cc (range_of_range_op): Handle no operands.
(range_of_call): Do not check for builtins.
(fold_using_range::range_of_builtin_call): Delete.
(fold_using_range::range_of_builtin_int_call): Delete.
* gimple-range-fold.h: Adjust prototypes.
* gimple-range-op.cc (class cfn_parity): New.
(gimple_range_op_handler::maybe_builtin_call): Set arguments.

2 years agoConvert CFN_BUILT_IN_GOACC_DIM_* to range-ops.
Andrew MacLeod [Tue, 20 Sep 2022 23:19:30 +0000 (19:19 -0400)]
Convert CFN_BUILT_IN_GOACC_DIM_* to range-ops.

* gimple-range-fold.cc (range_of_builtin_int_call): Remove case
for CFN_GOACC_DIM_*.
* gimple-range-op.cc (class cfn_goacc_dim): New.
(gimple_range_op_handler::maybe_builtin_call): Set arguments.

2 years agoConvert CFN_BUILT_IN_STRLEN to range-ops.
Andrew MacLeod [Tue, 20 Sep 2022 23:05:03 +0000 (19:05 -0400)]
Convert CFN_BUILT_IN_STRLEN to range-ops.

* gimple-range-fold.cc (range_of_builtin_int_call): Remove case
for CFN_BUILT_IN_STRLEN.
* gimple-range-op.cc (class cfn_strlen): New.
(gimple_range_op_handler::maybe_builtin_call): Set arguments.

2 years agoConvert CFN_BUILT_IN_UBSAN_CHECK_* to range-ops.
Andrew MacLeod [Tue, 20 Sep 2022 22:48:05 +0000 (18:48 -0400)]
Convert CFN_BUILT_IN_UBSAN_CHECK_* to range-ops.

* gimple-range-fold.cc (range_of_builtin_ubsan_call): Delete.
(range_of_builtin_int_call): Remove cases for
CFN_BUILT_IN_UBSAN_CHECK.
* gimple-range-op.cc (class cfn_ubsan): New.
(gimple_range_op_handler::maybe_builtin_call): Set arguments.

2 years agoConvert CFN_BUILT_IN_CLRSB to range-ops.
Andrew MacLeod [Tue, 20 Sep 2022 22:21:04 +0000 (18:21 -0400)]
Convert CFN_BUILT_IN_CLRSB to range-ops.

* gimple-range-fold.cc (range_of_builtin_int_call): Remove case
for CFN_BUILT_IN_CLRSB.
* gimple-range-op.cc (class cfn_clrsb): New.
(gimple_range_op_handler::maybe_builtin_call): Set arguments.

2 years agoConvert CFN_CTZ builtins to range-ops.
Andrew MacLeod [Tue, 20 Sep 2022 22:19:30 +0000 (18:19 -0400)]
Convert CFN_CTZ builtins to range-ops.

* gimple-range-fold.cc (range_of_builtin_int_call): Remove case
for CFN_CTZ.
* gimple-range-op.cc (class cfn_ctz): New.
(gimple_range_op_handler::maybe_builtin_call): Set arguments.

2 years agoConvert CFN_CLZ builtins to range-ops.
Andrew MacLeod [Tue, 20 Sep 2022 22:12:25 +0000 (18:12 -0400)]
Convert CFN_CLZ builtins to range-ops.

* gimple-range-fold.cc (range_of_builtin_int_call): Remove case
for CFN_CLZ.
* gimple-range-op.cc (class cfn_clz): New.
(gimple_range_op_handler::maybe_builtin_call): Set arguments.

2 years agoConvert CFN_BUILT_FFS and CFN_POPCOUNT to range-ops.
Andrew MacLeod [Tue, 20 Sep 2022 22:07:14 +0000 (18:07 -0400)]
Convert CFN_BUILT_FFS and CFN_POPCOUNT to range-ops.

* gimple-range-fold.cc (range_of_builtin_int_call): Remove case
for CFN_FFS and CFN_POPCOUNT.
* gimple-range-op.cc (class cfn_pocount): New.
(gimple_range_op_handler::maybe_builtin_call): Set arguments.

2 years agoConvert CFN_BUILT_IN_TOUPPER and TOLOWER to range-ops.
Andrew MacLeod [Tue, 20 Sep 2022 21:14:30 +0000 (17:14 -0400)]
Convert CFN_BUILT_IN_TOUPPER and TOLOWER to range-ops.

* gimple-range-fold.cc (get_letter_range): Move to new class.
(range_of_builtin_int_call): Remove case for CFN_BUILT_IN_TOUPPER
and CFN_BUILT_IN_TOLOWER.
* gimple-range-op.cc (class cfn_toupper_tolower): New.
(gimple_range_op_handler::maybe_builtin_call): Set arguments.

2 years agoConvert CFN_BUILT_IN_SIGNBIT to range-ops.
Andrew MacLeod [Wed, 21 Sep 2022 13:29:40 +0000 (09:29 -0400)]
Convert CFN_BUILT_IN_SIGNBIT to range-ops.

* gimple-range-fold.cc (range_of_builtin_int_call): Remove case
for CFN_BUILT_IN_SIGNBIT.
* gimple-range-op.cc (class cfn_signbit): New.
(gimple_range_op_handler::maybe_builtin_call): Set arguments.

2 years agoAdd range-ops support for builtin functions.
Andrew MacLeod [Tue, 20 Sep 2022 20:53:37 +0000 (16:53 -0400)]
Add range-ops support for builtin functions.

Convert CFN_BUILT_IN_CONSTANT_P as first POC.

* gimple-range-fold.cc
(fold_using_range::range_of_builtin_int_call): Remove case for
CFN_BUILT_IN_CONSTANT_P.
* gimple-range-op.cc (gimple_range_op_handler::supported_p):
Check if a call also creates a range-op object.
(gimple_range_op_handler): Also check builtin calls.
(class cfn_constant_float_p): New.  Float CFN_BUILT_IN_CONSTANT_P.
(class cfn_constant_p): New.  Integral CFN_BUILT_IN_CONSTANT_P.
(gimple_range_op_handler::maybe_builtin_call): Set arguments and
handler for supported built-in calls.
* gimple-range-op.h (maybe_builtin_call): New prototype.

2 years agoAlways check the return value of fold_range.
Andrew MacLeod [Wed, 21 Sep 2022 20:15:02 +0000 (16:15 -0400)]
Always check the return value of fold_range.

The fold_range routine in range-ops returns FALSE if the operation
fails.  There are a few places which assume the operation was
successful.  Fix those.

* gimple-range-fold.cc (range_of_range_op): Set result to
VARYING if the call to fold_range fails.
* tree-data-ref.cc (compute_distributive_range): Ditto.
* tree-vrp.cc (range_fold_binary_expr): Ditto.
(range_fold_unary_expr): Ditto.
* value-query.cc (range_query::get_tree_range): Ditto.

2 years agoAdd missing float fold_range prototype for floats.
Andrew MacLeod [Tue, 20 Sep 2022 16:34:08 +0000 (12:34 -0400)]
Add missing float fold_range prototype for floats.

Unary operations require op2 to be the range of the type of the LHS.
This is so the type for the LHS can be properly set.

* range-op-float.cc (range_operator_float::fold_range): New base
  method for "int = float op int".
* range-op.cc (range_op_handler::fold_range): New case.
* range-op.h: Update prototypes.

2 years agoFix calc_op1 for undefined op2_range.
Andrew MacLeod [Thu, 22 Sep 2022 14:27:17 +0000 (10:27 -0400)]
Fix calc_op1 for undefined op2_range.

Unary operations pass the type of operand 1 into op1_range.  If that
range is undefined, the routine blindly picks the type of operand 2,
which in the case of a unary op, does not exist and traps.

* gimple-range-op.cc (gimple_range_op_handler::calc_op1): Use
  operand 1 for second range if there is no operand 2.

2 years agoCreate gimple_range_op_handler in a new source file.
Andrew MacLeod [Thu, 1 Sep 2022 14:34:55 +0000 (10:34 -0400)]
Create gimple_range_op_handler in a new source file.

Range-ops is meant to be IL independent.  Some gimple processing has
be placed in range-ops, and some is located in gori.  Split it all into
a file and isolate it in a new class gimple_range_op_handler.

* Makefile.in (OBJS): Add gimple-range-op.o.
* gimple-range-edge.cc (gimple_outgoing_range_stmt_p): Use
gimple_range_op_handler.
* gimple-range-fold.cc (gimple_range_base_of_assignment): Move
to a method in gimple_range_op_handler.
(gimple_range_operand1): Ditto.
(gimple_range_operand2): Ditto.
(fold_using_range::fold_stmt): Use gimple_range_op_handler.
(fold_using_range::range_of_range_op): Ditto.
(fold_using_range::relation_fold_and_or): Ditto.
(fur_source::register_outgoing_edges): Ditto.
(gimple_range_ssa_names): Relocate to gimple-range-op.cc.
* gimple-range-fold.h: Adjust prototypes.
* gimple-range-gori.cc (gimple_range_calc_op1): Move
to a method in gimple_range_op_handler.
(gimple_range_calc_op2): Ditto.
(gori_compute::compute_operand_range): Use
gimple_range_op_handler.
(gori_compute::compute_logical_operands): Ditto.
(compute_operand1_range): Ditto.
(gori_compute::compute_operand2_range): Ditto.
(gori_compute::compute_operand1_and_operand2_range): Ditto.
* gimple-range-gori.h: Adjust protoypes.
* gimple-range-op.cc: New.  Supply gimple_range_op_handler methods.
* gimple-range-op.h: New.  Supply gimple_range_op_handler class.
* gimple-range.cc (gimple_ranger::prefill_name): Use
gimple_range_op_handler.
(gimple_ranger::prefill_stmt_dependencies): Ditto.
* gimple-range.h: Include gimple-range-op.h.
* range-op.cc (range_op_handler::range_op_handler): Adjust and
remove gimple * parameter option.
* range-op.h: Adjust prototypes.

2 years agoAdjust range_op_handler to store the handler directly.
Andrew MacLeod [Wed, 31 Aug 2022 18:07:13 +0000 (14:07 -0400)]
Adjust range_op_handler to store the handler directly.

Range_op_handler currently stores a tree code and a type.  It defers
checking to see if there is a valid handler until asked.
This change checks at constuctor time and store a pointer to
the handler if there is one.

* range-op.cc (range_op_handler::set_op_handler): Set new fields.
(ange_op_handler::range_op_handler): Likewise.
(range_op_handler::operator bool): Remove.
(range_op_handler::fold_range): Use appropriate handler.
(range_op_handler::op1_range): Likewise.
(range_op_handler::op2_range): Likewise.
(range_op_handler::lhs_op1_relation): Likewise.
(range_op_handler::lhs_op2_relation): Likewise.
(range_op_handler::op1_op2_relation): Likewise.
* range-op.h (class range_op_handler): Store handler pointers.
(range_op_handler:: operator bool): Inline.

2 years agoReplace another snippet with a call to gimple_range_ssa_names.
Andrew MacLeod [Wed, 31 Aug 2022 21:28:09 +0000 (17:28 -0400)]
Replace another snippet with a call to gimple_range_ssa_names.

When the original patch was applied, I missed a spot which could
also be rewritten to use gimple_range_ssa_names.

* tree-ssa-threadbackward.cc
  (back_threader::find_paths_to_names): Replace sequence with
  a call to gimple_range_ssa_names.

2 years agoFortran: Fix automatic reallocation inside select rank [PR100103]
José Rui Faustino de Sousa [Wed, 21 Sep 2022 20:55:02 +0000 (22:55 +0200)]
Fortran: Fix automatic reallocation inside select rank [PR100103]

gcc/fortran/ChangeLog:

PR fortran/100103
* trans-array.cc (gfc_is_reallocatable_lhs): Add select rank
temporary associate names as possible targets of automatic
reallocation.

gcc/testsuite/ChangeLog:

PR fortran/100103
* gfortran.dg/PR100103.f90: New test.

2 years agoFortran: fix ICE in generate_coarray_sym_init [PR82868]
Harald Anlauf [Wed, 21 Sep 2022 17:55:30 +0000 (19:55 +0200)]
Fortran: fix ICE in generate_coarray_sym_init [PR82868]

gcc/fortran/ChangeLog:

PR fortran/82868
* trans-decl.cc (generate_coarray_sym_init): Skip symbol
if attr.associate_var.

gcc/testsuite/ChangeLog:

PR fortran/82868
* gfortran.dg/associate_26a.f90: New test.

2 years agolibiberty: Refer to Bugzilla in README
Jonathan Wakely [Thu, 22 Sep 2022 08:33:30 +0000 (09:33 +0100)]
libiberty: Refer to Bugzilla in README

We want bugs reported to Bugzilla, not emailed to gcc-bugs.

libiberty/ChangeLog:

* README: Replace gcc-bugs email address with Bugzilla URL.

2 years agolibstdc++: Implement constexpr std::bitset for C++23 (P2417R2)
Jonathan Wakely [Thu, 22 Sep 2022 14:00:08 +0000 (15:00 +0100)]
libstdc++: Implement constexpr std::bitset for C++23 (P2417R2)

Also add _GLIBCXX_HOSTED checks to simplify making <bitset>
freestanding in the near future.

libstdc++-v3/ChangeLog:

* include/std/bitset (bitset): Add constexpr for C++23. Guard
members using std::string with _GLIBCXX_HOSTED.
* include/std/version (__cpp_lib_constexpr_bitset): Define.
* testsuite/20_util/bitset/access/constexpr.cc: New test.
* testsuite/20_util/bitset/cons/constexpr_c++23.cc: New test.
* testsuite/20_util/bitset/count/constexpr.cc: New test.
* testsuite/20_util/bitset/ext/constexpr.cc: New test.
* testsuite/20_util/bitset/operations/constexpr_c++23.cc: New test.
* testsuite/20_util/bitset/version.cc: New test.

2 years agolibstdc++: Rearrange tests for <bitset>
Jonathan Wakely [Thu, 22 Sep 2022 13:37:58 +0000 (14:37 +0100)]
libstdc++: Rearrange tests for <bitset>

In C++03 std::bitset was in the Container clause, but since C++11 it has
been in the Utilties clause. This moves the tests to the 20_util
directory, where most people probably expect to find them.

Also create 'access', 'observers', and 'io' subdirectories and group
some tests under there, rather than having one directory per function
name, and only a single test in that directory.

libstdc++-v3/ChangeLog:

* testsuite/23_containers/bitset/18604.cc: Moved to...
* testsuite/20_util/bitset/18604.cc: ...here.
* testsuite/23_containers/bitset/45713.cc: Moved to...
* testsuite/20_util/bitset/45713.cc: ...here.
* testsuite/23_containers/bitset/to_string/dr396.cc: Moved to...
* testsuite/20_util/bitset/access/dr396.cc: ...here.
* testsuite/23_containers/bitset/to_string/1.cc: Moved to...
* testsuite/20_util/bitset/access/to_string.cc: ...here.
* testsuite/23_containers/bitset/to_ullong/1.cc: Moved to...
* testsuite/20_util/bitset/access/to_ullong.cc: ...here.
* testsuite/23_containers/bitset/to_ulong/1.cc: Moved to...
* testsuite/20_util/bitset/access/to_ulong.cc: ...here.
* testsuite/23_containers/bitset/cons/1.cc: Moved to...
* testsuite/20_util/bitset/cons/1.cc: ...here.
* testsuite/23_containers/bitset/cons/16020.cc: Moved to...
* testsuite/20_util/bitset/cons/16020.cc: ...here.
* testsuite/23_containers/bitset/cons/2.cc: Moved to...
* testsuite/20_util/bitset/cons/2.cc: ...here.
* testsuite/23_containers/bitset/cons/3.cc: Moved to...
* testsuite/20_util/bitset/cons/3.cc: ...here.
* testsuite/23_containers/bitset/cons/38244.cc: Moved to...
* testsuite/20_util/bitset/cons/38244.cc: ...here.
* testsuite/23_containers/bitset/cons/50268.cc: Moved to...
* testsuite/20_util/bitset/cons/50268.cc: ...here.
* testsuite/23_containers/bitset/cons/6282.cc: Moved to...
* testsuite/20_util/bitset/cons/6282.cc: ...here.
* testsuite/23_containers/bitset/cons/constexpr.cc: Moved to...
* testsuite/20_util/bitset/cons/constexpr.cc: ...here.
* testsuite/23_containers/bitset/cons/dr1325-1.cc: Moved to...
* testsuite/20_util/bitset/cons/dr1325-1.cc: ...here.
* testsuite/23_containers/bitset/cons/dr1325-2.cc: Moved to...
* testsuite/20_util/bitset/cons/dr1325-2.cc: ...here.
* testsuite/23_containers/bitset/cons/dr396.cc: Moved to...
* testsuite/20_util/bitset/cons/dr396.cc: ...here.
* testsuite/23_containers/bitset/debug/invalidation/1.cc: Moved to...
* testsuite/20_util/bitset/debug/invalidation/1.cc: ...here.
* testsuite/23_containers/bitset/ext/15361.cc: Moved to...
* testsuite/20_util/bitset/ext/15361.cc: ...here.
* testsuite/23_containers/bitset/hash/1.cc: Moved to...
* testsuite/20_util/bitset/hash/1.cc: ...here.
* testsuite/23_containers/bitset/input/1.cc: Moved to...
* testsuite/20_util/bitset/io/input.cc: ...here.
* testsuite/23_containers/bitset/count/6124.cc: Moved to...
* testsuite/20_util/bitset/observers/6124.cc: ...here.
* testsuite/23_containers/bitset/all/1.cc: Moved to...
* testsuite/20_util/bitset/observers/all.cc: ...here.
* testsuite/23_containers/bitset/test/1.cc: Moved to...
* testsuite/20_util/bitset/observers/test.cc: ...here.
* testsuite/23_containers/bitset/operations/1.cc: Moved to...
* testsuite/20_util/bitset/operations/1.cc: ...here.
* testsuite/23_containers/bitset/operations/13838.cc: Moved to...
* testsuite/20_util/bitset/operations/13838.cc: ...here.
* testsuite/23_containers/bitset/operations/2.cc: Moved to...
* testsuite/20_util/bitset/operations/2.cc: ...here.
* testsuite/23_containers/bitset/operations/96303.cc: Moved to...
* testsuite/20_util/bitset/operations/96303.cc: ...here.
* testsuite/23_containers/bitset/operations/constexpr-2.cc: Moved to...
* testsuite/20_util/bitset/operations/constexpr-2.cc: ...here.
* testsuite/23_containers/bitset/operations/constexpr.cc: Moved to...
* testsuite/20_util/bitset/operations/constexpr.cc: ...here.
* testsuite/23_containers/bitset/requirements/constexpr_functions.cc: Moved to...
* testsuite/20_util/bitset/requirements/constexpr_functions.cc: ...here.
* testsuite/23_containers/bitset/requirements/explicit_instantiation/1.cc: Moved to...
* testsuite/20_util/bitset/requirements/explicit_instantiation/1.cc: ...here.
* testsuite/23_containers/bitset/requirements/explicit_instantiation/1_c++0x.cc: Moved to...
* testsuite/20_util/bitset/requirements/explicit_instantiation/1_c++0x.cc: ...here.
* testsuite/23_containers/headers/bitset/synopsis.cc: Moved to...
* testsuite/20_util/headers/bitset/synopsis.cc: ...here.

2 years agocmd/cgo: add and use runtime/cgo.Incomplete instead of //go:notinheap
Ian Lance Taylor [Wed, 21 Sep 2022 23:26:08 +0000 (16:26 -0700)]
cmd/cgo: add and use runtime/cgo.Incomplete instead of //go:notinheap

This ports https://go.dev/cl/421879 to libgo. This is a quick port to
update gofrontend to work with the version of cgo in gc mainline.
A more complete port will follow, changing the gc version of cmd/cgo to
choose an approach based on feature testing the gccgo in use.

Updates golang/go#46731

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/432338

2 years agotree-optimization/102801 - testcase for uninit diagnostic
Richard Biener [Thu, 22 Sep 2022 13:18:47 +0000 (15:18 +0200)]
tree-optimization/102801 - testcase for uninit diagnostic

The following testcase is fixed in GCC 12+

PR tree-optimization/102801
gcc/testsuite/
* g++.dg/warn/Wuninitialized-33.C: New testcase.

2 years agoc++ modules: partial variable template specializations [PR106826]
Patrick Palka [Thu, 22 Sep 2022 12:46:23 +0000 (08:46 -0400)]
c++ modules: partial variable template specializations [PR106826]

With partial variable template specializations, it looks like we
stream the VAR_DECL (i.e. the DECL_TEMPLATE_RESULT of the corresponding
TEMPLATE_DECL) since process_partial_specialization adds it to the
specializations table, but we end up never streaming the corresponding
TEMPLATE_DECL itself that's reachable only from the primary template's
DECL_TEMPLATE_SPECIALIZATIONS list, which leads to this list being
incomplete on stream-in.

The modules machinery already has special logic for streaming partial
specializations of class templates; this patch attempts to generalize
it to handle those of variable templates as well.

PR c++/106826

gcc/cp/ChangeLog:

* module.cc (trees_out::decl_value): Use get_template_info in
the MK_partial case to handle both VAR_DECL and TYPE_DECL.
(trees_out::key_mergeable): Likewise.
(trees_in::key_mergeable): Likewise.
(has_definition): Consider DECL_INITIAL of a partial variable
template specialization.
(depset::hash::make_dependency): Handle partial variable template
specializations too.

gcc/testsuite/ChangeLog:

* g++.dg/modules/partial-2_a.C: New test.
* g++.dg/modules/partial-2_b.C: New test.

2 years agoremove -gz=zlib-gnu option value
Martin Liska [Thu, 22 Sep 2022 11:04:57 +0000 (13:04 +0200)]
remove -gz=zlib-gnu option value

The option value is legacy and probably not used at all,
thus ignore it.

gcc/ChangeLog:

* configure: Regenerate.
* configure.ac: Simplify to gcc_cv_ld_compress_debug={0,1}
and gcc_cv_as_compress_debug={0,1}.
* doc/invoke.texi: Document the removal.
* gcc.cc (LINK_COMPRESS_DEBUG_SPEC): Simplify and ignore
  zlib-gnu.
(ASM_COMPRESS_DEBUG_SPEC): Likewise.

Co-Authored-By: Fangrui Song <i@maskray.me>
2 years agoc: fix uninitialized c_expr::m_decimal [PR106830]
David Malcolm [Thu, 22 Sep 2022 12:35:26 +0000 (08:35 -0400)]
c: fix uninitialized c_expr::m_decimal [PR106830]

I added c_expr::m_decimal in r13-2386-gbedfca647a9e9c1a as part of the
implementation of -Wxor-used-as-pow, but I missed various places where
the field needed to be initialized.

Fixed thusly.

gcc/c-family/ChangeLog:
PR c/106830
* c-warn.cc (check_for_xor_used_as_pow): Don't try checking
values that don't fit in uhwi.

gcc/c/ChangeLog:
PR c/106830
* c-parser.cc (c_parser_initelt): Initialize m_decimal.
(c_parser_cast_expression): Likewise.
(c_parser_alignof_expression): Likewise.
(c_parser_postfix_expression_after_paren_type): Likewise.
(c_parser_postfix_expression_after_primary): Likewise.
(c_parser_expression): Likewise.
(c_parser_omp_variable_list): Likewise.
(c_parser_transaction_expression): Likewise.
* c-tree.h (c_expr::set_error): Likewise.
* c-typeck.cc (c_expr_sizeof_expr): Likewise.
(parser_build_unary_op): Likewise.
(parser_build_binary_op): Likewise.
(digest_init): Likewise.
(pop_init_level): Likewise.
* gimple-parser.cc (c_parser_gimple_call_internal): Likewise.

gcc/testsuite/ChangeLog:
PR c/106830
* gcc.dg/Wxor-used-as-pow-pr106830.c: New test.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2 years agotree-optimization/106922 - missed FRE/PRE
Richard Biener [Wed, 21 Sep 2022 11:52:56 +0000 (13:52 +0200)]
tree-optimization/106922 - missed FRE/PRE

The following enhances the store-with-same-value trick in
vn_reference_lookup_3 by not only looking for

  a = val;
  *ptr = val;
  .. = a;

but also

  *ptr = val;
  other = x;
  .. = a;

where the earlier store is more than one hop away.  It does this
by queueing the actual value to compare until after the walk but
as disadvantage only allows a single such skipped store from a
constant value.

Unfortunately we cannot handle defs from non-constants this way
since we're prone to pick up values from the past loop iteration
this way and we have no good way to identify values that are
invariant in the currently iterated cycle.  That's why we keep
the single-hop lookup for those cases.  gcc.dg/tree-ssa/pr87126.c
would be a testcase that's un-XFAILed when we'd handle those
as well.

PR tree-optimization/106922
* tree-ssa-sccvn.cc (vn_walk_cb_data::same_val): New member.
(vn_walk_cb_data::finish): Perform delayed verification of
a skipped may-alias.
(vn_reference_lookup_pieces): Likewise.
(vn_reference_lookup): Likewise.
(vn_reference_lookup_3): When skipping stores of the same
value also handle constant stores that are more than a
single VDEF away by delaying the verification.

* gcc.dg/tree-ssa/ssa-fre-100.c: New testcase.
* g++.dg/tree-ssa/pr106922.C: Adjust.

2 years agoxtensa: gcc: enable section anchors support
Max Filippov [Sat, 17 Sep 2022 03:56:39 +0000 (20:56 -0700)]
xtensa: gcc: enable section anchors support

gcc/
* config/xtensa/xtensa.cc (TARGET_MAX_ANCHOR_OFFSET): New
definition.

2 years agoxtensa: gcc: implement MI thunk generation for call0 ABI
Max Filippov [Thu, 14 Jul 2022 09:39:59 +0000 (02:39 -0700)]
xtensa: gcc: implement MI thunk generation for call0 ABI

gcc/
* config/xtensa/xtensa.cc (xtensa_can_output_mi_thunk)
(xtensa_output_mi_thunk): New functions.
(TARGET_ASM_CAN_OUTPUT_MI_THUNK)
(TARGET_ASM_OUTPUT_MI_THUNK): New macro definitions.
(xtensa_prepare_expand_call): Use fixed register a8 as temporary
when called with reload_completed set to 1.

2 years agotree-optimization/99407 - DSE with data-ref analysis
Richard Biener [Thu, 22 Sep 2022 07:40:40 +0000 (09:40 +0200)]
tree-optimization/99407 - DSE with data-ref analysis

The following resolves the issue that DSE cannot handle references
with variable offsets well when identifying possible uses of a store.
Instead of just relying on ref_maybe_used_by_stmt_p we use data-ref
analysis, making sure to perform that at most once per stmt.  The
new mode is only exercised by the DSE pass before loop optimization
as specified by a new pass parameter and when expensive optimizations
are enabled, so it's disabled below -O2.

PR tree-optimization/99407
* tree-ssa-dse.cc (dse_stmt_to_dr_map): New global.
(dse_classify_store): Use data-ref analysis to disambiguate more uses.
(pass_dse::use_dr_analysis_p): New pass parameter.
(pass_dse::set_pass_param): Implement.
(pass_dse::execute): Allocate and deallocate dse_stmt_to_dr_map.
* passes.def: Allow DR analysis for the DSE pass before loop.

* gcc.dg/vect/tsvc/vect-tsvc-s243.c: Remove XFAIL.

2 years agoSome VN TLC
Richard Biener [Thu, 22 Sep 2022 07:08:47 +0000 (09:08 +0200)]
Some VN TLC

The following was prompted by review of the patch introducing
equivalences to VN.

* tree-ssa-sccvn.cc (can_track_predicate_on_edge): New
function split out from ...
(vn_nary_op_insert_pieces_predicated): ... here.

2 years agoFix typo in floorv2sf2, should be register_operand for op1, not vector_operand.
liuhongt [Wed, 21 Sep 2022 08:07:39 +0000 (16:07 +0800)]
Fix typo in floorv2sf2, should be register_operand for op1, not vector_operand.

gcc/ChangeLog:

PR target/106994
* config/i386/mmx.md (floorv2sf2): Fix typo, use
register_operand instead of vector_operand for operands[1].

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr106994.c: New test.

2 years agolibstdc++: Remove useless gdb printer registrations
François Dumont [Wed, 21 Sep 2022 16:59:43 +0000 (18:59 +0200)]
libstdc++: Remove useless gdb printer registrations

libstdc++-v3/ChangeLog:

* python/libstdcxx/v6/printers.py: Remove ptinter registration for non-existing
types std::__debug::unique_ptr, std::__debug::stack, std::__debug::queue,
std::__debug::priority_queue.

2 years agoDaily bump.
GCC Administrator [Thu, 22 Sep 2022 00:19:09 +0000 (00:19 +0000)]
Daily bump.

2 years agolibstdc++: Fix accidental duplicate test [PR91456]
Jonathan Wakely [Wed, 21 Sep 2022 13:59:18 +0000 (14:59 +0100)]
libstdc++: Fix accidental duplicate test [PR91456]

It looks like I committed the testcase for std::function twice, instead
of one for std::function and one for std::is_invocable_r. This replaces
the is_invocable_r one with the example from the PR.

libstdc++-v3/ChangeLog:

PR libstdc++/91456
* testsuite/20_util/function/91456.cc: Add comment with PR
number.
* testsuite/20_util/is_invocable/91456.cc: Likewise. Replace
std::function checks with std::is_invocable_r checks.

2 years agolibstdc++: Remove main() from some compile-only tests
Jonathan Wakely [Wed, 21 Sep 2022 08:31:14 +0000 (09:31 +0100)]
libstdc++: Remove main() from some compile-only tests

libstdc++-v3/ChangeLog:

* testsuite/17_intro/headers/c++1998/all_attributes.cc: Remove
unnecessary main function.
* testsuite/17_intro/headers/c++2011/all_attributes.cc:
Likewise.
* testsuite/17_intro/headers/c++2014/all_attributes.cc:
Likewise.
* testsuite/17_intro/headers/c++2017/all_attributes.cc:
Likewise.
* testsuite/17_intro/headers/c++2020/all_attributes.cc:
Likewise.

2 years agolibstdc++: Update <memory> synopsis test for C++11 and later
Jonathan Wakely [Wed, 21 Sep 2022 08:29:39 +0000 (09:29 +0100)]
libstdc++: Update <memory> synopsis test for C++11 and later

libstdc++-v3/ChangeLog:

* testsuite/20_util/headers/memory/synopsis.cc: Add declarations
from C++11 and later.

2 years ago[PR106967] Set known NANs to undefined for flag_finite_math_only.
Aldy Hernandez [Wed, 21 Sep 2022 09:18:48 +0000 (11:18 +0200)]
[PR106967] Set known NANs to undefined for flag_finite_math_only.

Explicit NANs in the IL can be treated as undefined for
flag_finite_math_only.  This causes all the right things to happen wrt
threading, folding, etc.  It also saves us special casing throughout.

PR tree-optimization/106967

gcc/ChangeLog:

* value-range.cc (frange::set): Set known NANs to undefined for
flag_finite_math_only.

2 years agoClear unused flags in frange for undefined ranges.
Aldy Hernandez [Wed, 21 Sep 2022 07:49:14 +0000 (09:49 +0200)]
Clear unused flags in frange for undefined ranges.

gcc/ChangeLog:

* value-range.cc (frange::combine_zeros): Call set_undefined.
(frange::intersect_nans): Same.
(frange::intersect): Same.
(frange::verify_range): Undefined ranges do not have a type.
* value-range.h (frange::set_undefined): Clear NAN flags and type.

2 years agotree-optimization/106984 - tsan and COND_EXPR GIMPLE
Richard Biener [Wed, 21 Sep 2022 09:30:57 +0000 (11:30 +0200)]
tree-optimization/106984 - tsan and COND_EXPR GIMPLE

The following adjusts a missed spot in TSAN for the RHS COND_EXPR
GIMPLE IL rework.

PR tree-optimization/106984
* tsan.cc (instrument_builtin_call): Build the COND_EXPR condition in
a separate statement.

* gcc.dg/tsan/pr106984.c: New testcase.

2 years agoFortran: handle RADIX kind in IEEE_SET_ROUNDING_MODE
Francois-Xavier Coudert [Wed, 21 Sep 2022 09:06:19 +0000 (11:06 +0200)]
Fortran: handle RADIX kind in IEEE_SET_ROUNDING_MODE

Make sure that calling IEEE_SET_ROUNDING_MODE with RADIX=10 does not
affect the binary rounding mode.

2022-09-21  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

libgfortran/

* ieee/ieee_arithmetic.F90 (IEEE_SET_ROUNDING_MODE): Handle
RADIX argument better.

gcc/testsuite/

* gfortran.dg/ieee/rounding_3.f90: New test.

2 years agoaarch64: Rewrite -march=native to -mcpu if no other -mcpu or -mtune is given
Kyrylo Tkachov [Wed, 21 Sep 2022 09:10:21 +0000 (10:10 +0100)]
aarch64: Rewrite -march=native to -mcpu if no other -mcpu or -mtune is given

We have received requests to improve the out-of-the box experience and
performance of AArch64 GCC users, particularly those porting software from other
architectures. This has many aspects. One such aspect are apps built natively
with an -march=native used as a tuning flag in the Makefile.
On AArch64 this selects the right architecture features on GNU+Linux for the
host system but tunes for the "generic" CPU target.
This patch makes GCC also tune for the host CPU, as well as selecting its
architecture. That is, it translates -march=native into -mcpu=native.
This maintains the documentation that it "causes the compiler to pick the
architecture of the host system" since -mcpu=native does that, but it also
gives a better performance experience for the user.

If the user explicitly asked for a particular CPU tuning through -mcpu or
-mtune then we don't do this rewriting so that the user option is honoured.

This would have been a one-line patch if it wasn't for --with-tune
configure-time arguments. When GCC is configured with --with-tune=<CORE> the
OPTION_DEFAULT_SPECS will insert an -mtune=<CORE> in the options if no other
-mcpu or -mtune options were given. This will spook the aforementioned desired
rewriting of -march=native into -mcpu=native, though I'd argue that we want to
do the rewrite even then. Therefore, this patch moves some specs in aarch64.h
around and refactors the --with-tune rewriting into CONFIG_TUNE_SPEC so that
the materialization of the implicit -mtune=<CORE> does not happen if -march=native
is used.

Bootstrapped and tested on aarch64-none-linux-gnu and checked with the output
of -### from the driver that the option rewriting works as expected on
aarch64-linux-gnu.

gcc/ChangeLog:

* config/aarch64/aarch64.h (HAVE_LOCAL_CPU_DETECT,
EXTRA_SPEC_FUNCTIONS, MCPU_MTUNE_NATIVE_SPECS): Move definitions up before
OPTION_DEFAULT_SPECS.
(MCPU_MTUNE_NATIVE_SPECS): Pass "cpu" to
local_cpu_detect when rewriting -march=native and no -mcpu or -mtune
is given.
(CONFIG_TUNE_SPEC): Define.
(OPTION_DEFAULT_SPECS): Use CONFIG_TUNE_SPEC for "tune".

2 years ago[PR106967] frange: revamp relational operators for NANs.
Aldy Hernandez [Tue, 20 Sep 2022 14:19:14 +0000 (16:19 +0200)]
[PR106967] frange: revamp relational operators for NANs.

Since NANs can be inserted by other passes even for -ffinite-math-only,
we can't depend on the flag to determine if a NAN is a possiblity.
Instead, we must explicitly check for them.

In the case of -ffinite-math-only, paths leading up to a NAN are
undefined and can be considered unreachable.  I have audited all the
relational code and made sure we're handling the known NAN case before
anything else, setting undefined when appropriate.

In the process, I revamped all the relational code handling NANs to
correctly notice paths that are unreachable.

The basic structure for ordered relational operators (except != of
course) is this:

If either operand is a known NAN, return FALSE.

The true side of a relop when one operand is a NAN is
unreachable.

On the false side of a relop when one operand is a NAN, we
know nothing about the other operand.

Regstrapped on x86-64 and ppc64le Linux.
lapack testing on x86-64 with and without -ffinite-math-only.

PR tree-optimization/106967

gcc/ChangeLog:

* range-op-float.cc (foperator_equal::fold_range): Adjust for NAN.
(foperator_equal::op1_range): Same.
(foperator_not_equal::fold_range): Same.
(foperator_not_equal::op1_range): Same.
(foperator_lt::fold_range): Same.
(foperator_lt::op1_range): Same.
(foperator_lt::op2_range): Same.
(foperator_le::fold_range): Same.
(foperator_le::op1_range): Same.
(foperator_le::op2_range): Same.
(foperator_gt::fold_range): Same.
(foperator_gt::op1_range): Same.
(foperator_gt::op2_range): Same.
(foperator_ge::fold_range): Same.
(foperator_ge::op1_range): Same.
(foperator_ge::op2_range): Same.
(foperator_unordered::op1_range): Same.
(foperator_ordered::fold_range): Same.
(foperator_ordered::op1_range): Same.
(build_le): Assert that we don't have a NAN.
(build_lt): Same.
(build_gt): Same.
(build_ge): Same.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/pr106967.c: New test.

2 years agoFortran: add symbols in version map for IEEE_GET_MODES and IEEE_SET_MODES
Francois-Xavier Coudert [Wed, 21 Sep 2022 08:04:22 +0000 (10:04 +0200)]
Fortran: add symbols in version map for IEEE_GET_MODES and IEEE_SET_MODES

The symbols were forgotten in the patch that added IEEE_GET_MODES
and IEEE_SET_MODES.

2022-09-21  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

libgfortran/

* gfortran.map: Add symbols for IEEE_GET_MODES
and IEEE_SET_MODES.

2 years agoDon't check can_vec_perm_const_p for nonlinear iv_init when it's constant.
liuhongt [Tue, 20 Sep 2022 05:22:28 +0000 (13:22 +0800)]
Don't check can_vec_perm_const_p for nonlinear iv_init when it's constant.

When init_expr is INTEGER_CST or REAL_CST, can_vec_perm_const_p is not
necessary since there's no real vec_perm needed, but
vec_gen_perm_mask_checked will gcc_assert (can_vec_perm_const_p). So
it's better to use vec_gen_perm_mask_any in
vect_create_nonlinear_iv_init.

gcc/ChangeLog:

PR tree-optimization/106963
* tree-vect-loop.cc (vect_create_nonlinear_iv_init): Use
vec_gen_perm_mask_any instead of vec_gen_perm_mask_check.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr106963.c: New test.

2 years agolibstdc++: Remove trailing whitespace in documentation sources
Jonathan Wakely [Wed, 21 Sep 2022 00:18:38 +0000 (01:18 +0100)]
libstdc++: Remove trailing whitespace in documentation sources

libstdc++-v3/ChangeLog:

* doc/xml/manual/documentation_hacking.xml: Remove trailing
whitespace.
* doc/xml/manual/policy_data_structures.xml: Likewise.

2 years agolibstdc++: Add _Exit to <stdlib.h> for freestanding
Jonathan Wakely [Tue, 20 Sep 2022 23:48:12 +0000 (00:48 +0100)]
libstdc++: Add _Exit to <stdlib.h> for freestanding

When I added std::_Exit to the freestanding declarations in <cstdlib> I
should also have added it to <stdlib.h>.

libstdc++-v3/ChangeLog:

* include/c_compatibility/stdlib.h [!_GLIBCXX_HOSTED]: Add
using-declaration for _Exit.

2 years agolibstdc++: Qualify std::abort() in test
Jonathan Wakely [Tue, 20 Sep 2022 23:39:14 +0000 (00:39 +0100)]
libstdc++: Qualify std::abort() in test

This test includes <cstdlib> so should use std::abort not ::abort.

libstdc++-v3/ChangeLog:

* testsuite/18_support/uncaught_exception/14026.cc: Qualify
call to std::abort.

2 years agolibstdc++: Add <initializer_list> to ranges_base.h header
Jonathan Wakely [Tue, 20 Sep 2022 23:46:04 +0000 (00:46 +0100)]
libstdc++: Add <initializer_list> to ranges_base.h header

The header should be included explicitly to use std::initializer_list.
With the upcoming changes to make <ranges> available for freestanding
this becomes an error, because <initializer_list> is no longer provided
by any of the other headers involved here.

libstdc++-v3/ChangeLog:

* include/bits/ranges_base.h: Include <initializer_list>.

2 years agoDaily bump.
GCC Administrator [Wed, 21 Sep 2022 00:19:14 +0000 (00:19 +0000)]
Daily bump.

2 years agoFortran: F2018 type(*),dimension(*) with scalars [PR104143]
Tobias Burnus [Tue, 20 Sep 2022 21:06:19 +0000 (23:06 +0200)]
Fortran: F2018 type(*),dimension(*) with scalars [PR104143]

Assumed-size dummy arguments accept arrays and array elements as actual
arguments. There are also a few exceptions when real scalars are permitted.
Since F2018, this includes scalar arguments to assumed-type dummies; while
type(*) was added in TS29113, this change is only in F2018 itself.

PR fortran/104143

gcc/fortran/ChangeLog:

* interface.cc (compare_parameter): Permit scalar args to
'type(*), dimension(*)'.

gcc/testsuite/ChangeLog:

* gfortran.dg/c-interop/c407b-2.f90: Remove dg-error.
* gfortran.dg/assumed_type_16.f90: New test.
* gfortran.dg/assumed_type_17.f90: New test.

2 years agoFortran: error recovery on invalid ARRAY argument to FINDLOC [PR106986]
Harald Anlauf [Tue, 20 Sep 2022 20:41:48 +0000 (22:41 +0200)]
Fortran: error recovery on invalid ARRAY argument to FINDLOC [PR106986]

gcc/fortran/ChangeLog:

PR fortran/106986
* simplify.cc (gfc_simplify_findloc): Do not try to simplify
intrinsic FINDLOC when the ARRAY argument has a NULL shape.

gcc/testsuite/ChangeLog:

PR fortran/106986
* gfortran.dg/pr106986.f90: New test.

2 years agoFortran: NULL pointer dereference in invalid simplification [PR106985]
Harald Anlauf [Tue, 20 Sep 2022 20:23:43 +0000 (22:23 +0200)]
Fortran: NULL pointer dereference in invalid simplification [PR106985]

gcc/fortran/ChangeLog:

PR fortran/106985
* expr.cc (gfc_simplify_expr): Avoid NULL pointer dereference.

gcc/testsuite/ChangeLog:

PR fortran/106985
* gfortran.dg/pr106985.f90: New test.

2 years agoc++: xtreme-header modules tests cleanups
Patrick Palka [Tue, 20 Sep 2022 20:13:48 +0000 (16:13 -0400)]
c++: xtreme-header modules tests cleanups

This adds some recently implemented C++20/23 library headers to the
xtreme-header tests as appropriate.  Also, it looks like we can safely
re-add <execution> and remove the NO_ASSOCIATED_LAMBDA workaround.

gcc/testsuite/ChangeLog:

* g++.dg/modules/xtreme-header-2.h: Include <execution>.
* g++.dg/modules/xtreme-header-6.h: Include implemented
C++20 library headers.
* g++.dg/modules/xtreme-header.h: Likewise.  Remove
NO_ASSOCIATED_LAMBDA workaround.  Include implemented C++23
library headers.

2 years agoc++: modules and non-dependent auto deduction
Patrick Palka [Tue, 20 Sep 2022 20:08:14 +0000 (16:08 -0400)]
c++: modules and non-dependent auto deduction

The modules streaming code seems to rely on the invariant that a
TEMPLATE_DECL and its DECL_TEMPLATE_RESULT have the same TREE_TYPE.
But for a non-dependent VAR_DECL with deduced type, the two TREE_TYPEs
end up diverging: cp_finish_decl deduces the type of the initializer
ahead of time and updates the TREE_TYPE of the VAR_DECL, but neglects to
update the corresponding TEMPLATE_DECL as well, which leads to a
"conflicting global module declaration" error for each of the
__phase_alignment decls in the below testcase (and for the xtreme-header
tests if we try including <barrier>).

This patch makes cp_finish_decl update the TREE_TYPE of the corresponding
TEMPLATE_DECL so that the invariant is maintained.

gcc/cp/ChangeLog:

* decl.cc (cp_finish_decl): After updating the deduced type of a
VAR_DECL, also update the corresponding TEMPLATE_DECL if there
is one.

gcc/testsuite/ChangeLog:

* g++.dg/modules/auto-3.h: New test.
* g++.dg/modules/auto-3_a.H: New test.
* g++.dg/modules/auto-3_b.C: New test.

2 years agoFortran: Fix function attributes [PR100132]
José Rui Faustino de Sousa [Mon, 19 Sep 2022 20:00:45 +0000 (22:00 +0200)]
Fortran: Fix function attributes [PR100132]

gcc/fortran/ChangeLog:

PR fortran/100132
* trans-types.cc (create_fn_spec): Fix function attributes when
passing polymorphic pointers.

gcc/testsuite/ChangeLog:

PR fortran/100132
* gfortran.dg/PR100132.f90: New test.

2 years agofrange::maybe_isnan() should return FALSE for undefined ranges.
Aldy Hernandez [Tue, 20 Sep 2022 14:09:31 +0000 (16:09 +0200)]
frange::maybe_isnan() should return FALSE for undefined ranges.

Undefined ranges have undefined NAN bits.  We can't depend on them,
as they may contain garbage.  This patch returns false from
maybe_isnan() for undefined ranges (the empty set).

gcc/ChangeLog:

* value-range.h (frange::maybe_isnan): Return false for
undefined ranges.

2 years agofrange::set_nonnegative should not contain -NAN.
Aldy Hernandez [Mon, 19 Sep 2022 07:59:01 +0000 (09:59 +0200)]
frange::set_nonnegative should not contain -NAN.

A specifically nonnegative range should not contain -NAN, otherwise
signbit_p() would return false, because we'd be unsure of the sign.

PR 68097/tree-optimization

gcc/ChangeLog:

* value-range.cc (frange::set_nonnegative): Set +NAN.
(range_tests_signed_zeros): New test.
* value-range.h (frange::update_nan): New overload to set NAN sign.

2 years agofortran: add link to ISO_VARYING_STRING module [PR106636]
Martin Liska [Tue, 20 Sep 2022 12:23:29 +0000 (14:23 +0200)]
fortran: add link to ISO_VARYING_STRING module [PR106636]

PR fortran/106636

gcc/fortran/ChangeLog:

* gfortran.texi: Add back link to ISO_VARYING_STRING.

2 years agoaarch64: Fix GTY markup for arm_sve.h [PR106491]
Richard Sandiford [Tue, 20 Sep 2022 14:27:47 +0000 (15:27 +0100)]
aarch64: Fix GTY markup for arm_sve.h [PR106491]

It turns out that GTY(()) markers in definitions like:

  GTY(()) tree scalar_types[NUM_VECTOR_TYPES];

are not effective and are silently ignored.  The GTY(()) has
to come after an extern or static.

The externs associated with the SVE ACLE GTY variables are in
aarch64-sve-builtins.h.  This file is not in tm_include_list because
we don't want every target-facing file to include it.  It therefore
isn't in the list of GC header files either.

In this case that's a blessing in disguise, since the variables
belong to a namespace and gengtype doesn't understand namespaces.
I think the fix is instead to add an extra extern before each
variable declaration, similarly to varasm.cc and vtable-verify.cc.
(This works due to a "using namespace" at the end of the file.)

gcc/
PR target/106491
* config/aarch64/aarch64-sve-builtins.cc (scalar_types)
(acle_vector_types, acle_svpattern, acle_svprfop): Add GTY
markup to (new) extern declarations instead of to the main
definition.

2 years agovect: Fix SLP layout handling of masked loads [PR106794]
Richard Sandiford [Tue, 20 Sep 2022 14:27:47 +0000 (15:27 +0100)]
vect: Fix SLP layout handling of masked loads [PR106794]

PR106794 shows that I'd forgotten about masked loads when
doing the SLP layout changes.  These loads can't currently
be permuted independently of their mask input, so during
construction they never get a load permutation.

(If we did support permuting masked loads in future, the mask
would need to be in the right order for the load, rather than in
the order implied by the result of the permutation.  Since masked
loads can't be partly or fully scalarised in the way that normal
permuted loads can be, there's probably no benefit to fusing the
permutation and the load.  Permutation after the fact is probably
good enough.)

gcc/
PR tree-optimization/106794
PR tree-optimization/106914
* tree-vect-slp.cc (vect_optimize_slp_pass::internal_node_cost):
Only consider loads that already have a permutation.
(vect_optimize_slp_pass::start_choosing_layouts): Assert that
loads with permutations are leaf nodes.  Prevent any kind of grouped
access from changing layout if it doesn't have a load permutation.

gcc/testsuite/
* gcc.dg/vect/pr106914.c: New test.
* g++.dg/vect/pr106794.cc: Likewise.

2 years agovect: Fix missed gather load opportunity
Richard Sandiford [Tue, 20 Sep 2022 14:27:46 +0000 (15:27 +0100)]
vect: Fix missed gather load opportunity

While writing a testcase for PR106794, I noticed that we failed
to vectorise the testcase in the patch for SVE.  The code that
recognises gather loads tries to optimise the point at which
the offset is calculated, to avoid unnecessary extensions or
truncations:

  /* Don't include the conversion if the target is happy with
     the current offset type.  */

But breaking only makes sense if we're at an SSA_NAME (which could
then be vectorised).  We shouldn't break on a conversion embedded
in a generic expression.

gcc/
* tree-vect-data-refs.cc (vect_check_gather_scatter): Restrict
early-out optimisation to SSA_NAMEs.

gcc/testsuite/
* gcc.dg/vect/vect-gather-5.c: New test.

2 years ago[PR106970] New test for PR that has already been fixed.
Aldy Hernandez [Tue, 20 Sep 2022 14:06:05 +0000 (16:06 +0200)]
[PR106970] New test for PR that has already been fixed.

PR tree-optimization/106970

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/pr106970.c: New test.

2 years agoc++: stream PACK_EXPANSION_EXTRA_ARGS [PR106761]
Patrick Palka [Tue, 20 Sep 2022 14:19:30 +0000 (10:19 -0400)]
c++: stream PACK_EXPANSION_EXTRA_ARGS [PR106761]

It looks like after the libstdc++ commit r13-2158-g02f6b405f0e9dc
some xtreme-header-* tests are failing with "conflicting global module
declaration" errors ultimately because we're neglecting to stream
PACK_EXPANSION_EXTRA_ARGS, which leads to wrong equivalences of
different partial instantiations of _TupleConstraints::__constructible.

PR c++/106761

gcc/cp/ChangeLog:

* module.cc (trees_out::type_node) <case TYPE_PACK_EXPANSION>:
Stream PACK_EXPANSION_EXTRA_ARGS.
(trees_in::tree_node) <case TYPE_PACK_EXPANSION>: Likewise.

gcc/testsuite/ChangeLog:

* g++.dg/modules/pr106761.h: New test.
* g++.dg/modules/pr106761_a.H: New test.
* g++.dg/modules/pr106761_b.C: New test.

2 years agoreplace "the the" typos
Martin Liska [Tue, 20 Sep 2022 13:05:33 +0000 (15:05 +0200)]
replace "the the" typos

gcc/ada/ChangeLog:

* exp_ch6.adb: Replace "the the" with "the".
* sem_ch6.adb: Likewise.
* sem_disp.ads: Likewise.

gcc/ChangeLog:

* ctfc.cc (ctf_add_string): Replace "the the" with "the".
* doc/md.texi: Likewise.
* gimple-range-infer.cc (non_null_loadstore): Likewise.

gcc/fortran/ChangeLog:

* gfortran.texi: Replace "the the" with "the".

gcc/testsuite/ChangeLog:

* g++.dg/warn/Wclass-memaccess.C: Replace "the the" with "the".
* g++.dg/warn/Wconversion-real-integer2.C: Likewise.
* gcc.target/powerpc/p9-extract-1.c: Likewise.
* gcc.target/s390/s390.exp: Likewise.
* gcc.target/s390/zvector/vec-cmp-2.c: Likewise.
* gdc.dg/torture/simd_store.d: Likewise.
* gfortran.dg/actual_array_offset_1.f90: Likewise.
* gfortran.dg/pdt_15.f03: Likewise.
* gfortran.dg/pointer_array_8.f90: Likewise.

2 years agolibstdc++: Fix typo in <cstdlib> for freestanding
Jonathan Wakely [Tue, 20 Sep 2022 12:20:33 +0000 (13:20 +0100)]
libstdc++: Fix typo in <cstdlib> for freestanding

libstdc++-v3/ChangeLog:

* include/c_global/cstdlib [!_GLIBCXX_HOSTED] (quick_exit): Fix
missing space.

2 years agofortran: remove 2 dead links [PR106636]
Martin Liska [Tue, 20 Sep 2022 12:02:34 +0000 (14:02 +0200)]
fortran: remove 2 dead links [PR106636]

PR fortran/106636

gcc/fortran/ChangeLog:

* gfortran.texi: Remove 2 dead links.

2 years agocontrib: skip new egrep warning
Martin Liska [Tue, 20 Sep 2022 08:16:47 +0000 (10:16 +0200)]
contrib: skip new egrep warning

contrib/ChangeLog:

* filter-clang-warnings.py: Skip egrep: warning: egrep is
  obsolescent; using grep -E.

2 years agoSupport 64-bit vectorization for single-precision floating rounding operation.
liuhongt [Fri, 16 Sep 2022 06:28:34 +0000 (14:28 +0800)]
Support 64-bit vectorization for single-precision floating rounding operation.

Here's list the patch supported.
rint/nearbyint/ceil/floor/trunc/lrint/lceil/lfloor/round/lround.

gcc/ChangeLog:

PR target/106910
* config/i386/mmx.md (nearbyintv2sf2): New expander.
(rintv2sf2): Ditto.
(ceilv2sf2): Ditto.
(lceilv2sfv2si2): Ditto.
(floorv2sf2): Ditto.
(lfloorv2sfv2si2): Ditto.
(btruncv2sf2): Ditto.
(lrintv2sfv2si2): Ditto.
(roundv2sf2): Ditto.
(lroundv2sfv2si2): Ditto.
(*mmx_roundv2sf2): New define_insn.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr106910-1.c: New test.

2 years agomiddle-end: handle bitop with an invariant induction.[PR105735]
konglin1 [Tue, 20 Sep 2022 05:58:35 +0000 (13:58 +0800)]
middle-end: handle bitop with an invariant induction.[PR105735]

Enhance final_value_replacement_loop to handle bitop
with an invariant induction.

This patch will enable below optimization:

{
-  long unsigned int bit;
-
-  <bb 2> [local count: 32534376]:
-
-  <bb 3> [local count: 1041207449]:
-  # tmp_10 = PHI <tmp_7(5), tmp_4(D)(2)>
-  # bit_12 = PHI <bit_8(5), 0(2)>
-  tmp_7 = bit2_6(D) & tmp_10;
-  bit_8 = bit_12 + 1;
-  if (bit_8 != 32)
-    goto <bb 5>; [96.97%]
-  else
-    goto <bb 4>; [3.03%]
-
-  <bb 5> [local count: 1009658865]:
-  goto <bb 3>; [100.00%]
-
-  <bb 4> [local count: 32534376]:
-  # tmp_11 = PHI <tmp_7(3)>
-  return tmp_11;
+  tmp_11 = tmp_4 (D) & bit2_6 (D);
+  return tmp_11;

}

gcc/ChangeLog:

PR middle-end/105735
* tree-scalar-evolution.cc
(analyze_and_compute_bitop_with_inv_effect): New function.
(final_value_replacement_loop): Enhanced to handle bitop
with inv induction.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr105735-1.c: New test.
* gcc.target/i386/pr105735-2.c: New test.

2 years agoLoongArch: Prepare static PIE support
Xi Ruoyao [Tue, 13 Sep 2022 15:21:39 +0000 (23:21 +0800)]
LoongArch: Prepare static PIE support

Static PIE allows us to extend the ASLR to cover static executables and
it's not too difficult to support it.  On GCC side, we just pass a group
of options to the linker, like other ports with static PIE support.

The real implementation of static PIE (rcrt1.o) will be added into Glibc
later.

gcc/ChangeLog:

* config/loongarch/gnu-user.h (GNU_USER_TARGET_LINK_SPEC): For
-static-pie, pass -static -pie --no-dynamic-linker -z text to
the linker, and do not pass --dynamic-linker.

2 years agofrange: flush denormals to zero
Aldy Hernandez [Sat, 17 Sep 2022 08:17:13 +0000 (10:17 +0200)]
frange: flush denormals to zero

For some architectures (or for -funsafe-math-optimizations) we may
flush denormals to zero, in which case we need to be careful to
extend the ranges to the appropriate zero.  This patch does exactly that.
For a range of [x, -DENORMAL] we flush to [x, -0.0] and for [+DENORMAL, x]
we flush to [+0.0, x].

gcc/ChangeLog:

* value-range.cc (frange::flush_denormals_to_zero): New.
(frange::set): Call flush_denormals_to_zero.
* value-range.h (class frange): Add flush_denormals_to_zero.

2 years agoAdjust issue_rate for latest Intel processors.
liuhongt [Tue, 6 Sep 2022 03:04:40 +0000 (11:04 +0800)]
Adjust issue_rate for latest Intel processors.

For Skylake based processor, decoder is 4-way.
For Sunny Cove and Willow Cove, decoder is 5-way.
For Golden cove, decoder is 6-way.

gcc/ChangeLog:

* config/i386/x86-tune-sched.cc (ix86_issue_rate): Adjust for
latest Intel processors.

2 years agoi386: Fixed vec_init_dup_v16bf [PR106887]
konglin1 [Fri, 16 Sep 2022 07:59:19 +0000 (15:59 +0800)]
i386: Fixed vec_init_dup_v16bf [PR106887]

gcc/ChangeLog:

PR target/106887
* config/i386/i386-expand.cc (ix86_expand_vector_init_duplicate):
Fixed V16BF mode case.

gcc/testsuite/ChangeLog:

PR target/106887
* gcc.target/i386/vect-bfloat16-2c.c: New test.

2 years agoDaily bump.
GCC Administrator [Tue, 20 Sep 2022 00:17:49 +0000 (00:17 +0000)]
Daily bump.