Jakub Jelinek [Fri, 26 Aug 2022 07:52:02 +0000 (09:52 +0200)]
fortran: Expand ieee_arithmetic module's ieee_class inline [PR106579]
The following patch expands IEEE_CLASS inline in the FE, using the
__builtin_fpclassify, __builtin_signbit and the new __builtin_issignaling
builtins.
2022-08-26 Jakub Jelinek <jakub@redhat.com>
PR fortran/106579
gcc/fortran/
* f95-lang.cc (gfc_init_builtin_functions): Initialize
BUILT_IN_FPCLASSIFY.
* libgfortran.h (IEEE_OTHER_VALUE, IEEE_SIGNALING_NAN,
IEEE_QUIET_NAN, IEEE_NEGATIVE_INF, IEEE_NEGATIVE_NORMAL,
IEEE_NEGATIVE_DENORMAL, IEEE_NEGATIVE_SUBNORMAL,
IEEE_NEGATIVE_ZERO, IEEE_POSITIVE_ZERO, IEEE_POSITIVE_DENORMAL,
IEEE_POSITIVE_SUBNORMAL, IEEE_POSITIVE_NORMAL, IEEE_POSITIVE_INF):
New enum.
* trans-intrinsic.cc (conv_intrinsic_ieee_class): New function.
(gfc_conv_ieee_arithmetic_function): Handle ieee_class.
libgfortran/
* ieee/ieee_helper.c (IEEE_OTHER_VALUE, IEEE_SIGNALING_NAN,
IEEE_QUIET_NAN, IEEE_NEGATIVE_INF, IEEE_NEGATIVE_NORMAL,
IEEE_NEGATIVE_DENORMAL, IEEE_NEGATIVE_SUBNORMAL,
IEEE_NEGATIVE_ZERO, IEEE_POSITIVE_ZERO, IEEE_POSITIVE_DENORMAL,
IEEE_POSITIVE_SUBNORMAL, IEEE_POSITIVE_NORMAL, IEEE_POSITIVE_INF):
Move to gcc/fortran/libgfortran.h.
Jakub Jelinek [Fri, 26 Aug 2022 07:45:19 +0000 (09:45 +0200)]
libgfortran: Use __builtin_issignaling in libgfortran [PR105105]
The following patch makes use of the new __builtin_issignaling,
so it no longer needs the fallback implementation and can use
the builtin even where glibc provides the macro.
2022-08-26 Jakub Jelinek <jakub@redhat.com>
PR fortran/105105
* ieee/ieee_helper.c: Don't include issignaling_fallback.h.
(CLASSMACRO): Use __builtin_issignaling instead of issignaling.
* ieee/issignaling_fallback.h: Removed.
Jakub Jelinek [Fri, 26 Aug 2022 07:39:51 +0000 (09:39 +0200)]
Implement __builtin_issignaling
The following patch implements a new builtin, __builtin_issignaling,
which can be used to implement the ISO/IEC TS 18661-1 issignaling
macro.
It is implemented as type-generic function, so there is just one
builtin, not many with various suffixes.
This patch doesn't address PR56831 nor PR58416, but I think compared to
using glibc issignaling macro could make some cases better (as
the builtin is expanded always inline and for SFmode/DFmode just
reinterprets a memory or pseudo register as SImode/DImode, so could
avoid some raising of exception + turning sNaN into qNaN before the
builtin can analyze it).
For floading point modes that do not have NaNs it will return 0,
otherwise I've tried to implement this for all the other supported
real formats.
It handles both the MIPS/PA floats where a sNaN has the mantissa
MSB set and the rest where a sNaN has it cleared, with the exception
of format which are known never to be in the MIPS/PA form.
The MIPS/PA floats are handled using a test like
(x & mask) == mask,
the other usually as
((x ^ bit) & mask) > val
where bit, mask and val are some constants.
IBM double double is done by doing DFmode test on the most significant
half, and Intel/Motorola extended (12 or 16 bytes) and IEEE quad are
handled by extracting 32-bit/16-bit words or 64-bit parts from the
value and testing those.
On x86, XFmode is handled by a special optab so that even pseudo numbers
are considered signaling, like in glibc and like the i386 specific testcase
tests.
2022-08-26 Jakub Jelinek <jakub@redhat.com>
gcc/
* builtins.def (BUILT_IN_ISSIGNALING): New built-in.
* builtins.cc (expand_builtin_issignaling): New function.
(expand_builtin_signbit): Don't overwrite target.
(expand_builtin): Handle BUILT_IN_ISSIGNALING.
(fold_builtin_classify): Likewise.
(fold_builtin_1): Likewise.
* optabs.def (issignaling_optab): New.
* fold-const-call.cc (fold_const_call_ss): Handle
BUILT_IN_ISSIGNALING.
* config/i386/i386.md (issignalingxf2): New expander.
* doc/extend.texi (__builtin_issignaling): Document.
(__builtin_isinf, __builtin_isnan): Clarify behavior with
-ffinite-math-only.
* doc/md.texi (issignaling<mode>2): Likewise.
gcc/c-family/
* c-common.cc (check_builtin_function_arguments): Handle
BUILT_IN_ISSIGNALING.
gcc/c/
* c-typeck.cc (convert_arguments): Handle BUILT_IN_ISSIGNALING.
gcc/fortran/
* f95-lang.cc (gfc_init_builtin_functions): Initialize
BUILT_IN_ISSIGNALING.
gcc/testsuite/
* gcc.dg/torture/builtin-issignaling-1.c: New test.
* gcc.dg/torture/builtin-issignaling-2.c: New test.
* gcc.dg/torture/float16-builtin-issignaling-1.c: New test.
* gcc.dg/torture/float32-builtin-issignaling-1.c: New test.
* gcc.dg/torture/float32x-builtin-issignaling-1.c: New test.
* gcc.dg/torture/float64-builtin-issignaling-1.c: New test.
* gcc.dg/torture/float64x-builtin-issignaling-1.c: New test.
* gcc.dg/torture/float128-builtin-issignaling-1.c: New test.
* gcc.dg/torture/float128x-builtin-issignaling-1.c: New test.
* gcc.target/i386/builtin-issignaling-1.c: New test.
Jakub Jelinek [Fri, 26 Aug 2022 07:28:48 +0000 (09:28 +0200)]
internal-fn, tree-cfg: Fix .TRAP handling and another __builtin_trap vops issue [PR106099]
This patch fixes 2 __builtin_unreachable/__builtin_trap related issues.
One (first hunk) is that CDDCE happily removes calls to .TRAP ()
internal-fn as useless. The problem is that the internal-fn is
ECF_CONST | ECF_NORETURN, doesn't have lhs and so DCE thinks it doesn't
have side-effects and removes it. __builtin_unreachable which has
the same ECF_* flags works fine, as since PR44485 we implicitly add
ECF_LOOPING_CONST_OR_PURE to ECF_CONST | ECF_NORETURN builtins, but
do it in flags_from_decl_or_type which isn't called for internal-fns.
As IFN_TRAP is the only ifn with such flags, it seems easier to
add it explicitly.
The other issue (which on the testcase can be seen only with the
first bug unfixed) is that execute_fixup_cfg can add a __builtin_trap
which needs vops, but nothing adds it and it can appear in many passes
which don't have corresponding TODO_update_ssa_only_virtuals etc.
Fixed similarly as last time but emitting ifn there instead.
2022-08-26 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/106099
* internal-fn.def (TRAP): Add ECF_LOOPING_CONST_OR_PURE flag.
* tree-cfg.cc (execute_fixup_cfg): Add IFN_TRAP instead of
__builtin_trap to avoid the need of vops.
* gcc.dg/pr106099.c: New test.
Jakub Jelinek [Fri, 26 Aug 2022 07:24:56 +0000 (09:24 +0200)]
c++: Implement C++23 P2071R2 - Named universal character escapes [PR106648]
The following patch implements the
C++23 P2071R2 - Named universal character escapes
paper to support \N{LATIN SMALL LETTER E} etc.
I've used Unicode 14.0, there are 144803 character name properties
(including the ones generated by Unicode NR1 and NR2 rules)
and correction/control/alternate aliases, together with zero terminators
that would be 3884745 bytes, which is clearly unacceptable for libcpp.
This patch instead contains a generator which from the UnicodeData.txt
and NameAliases.txt files emits a space optimized radix tree (208765
bytes long for 14.0), a single string literal dictionary (59418 bytes),
maximum name length (currently 88 chars) and two small helper arrays
for the NR1/NR2 name generation.
The radix tree needs 2 to 9 bytes per node, the exact format is
described in the generator program. There could be ways to shrink
the dictionary size somewhat at the expense of slightly slower lookups.
Currently the patch implements strict matching (that is what is needed
to actually implement it on valid code) and Unicode UAX44-LM2 algorithm
loose matching to provide hints (that algorithm essentially ignores
hyphens in between two alphanumeric characters, spaces and underscores
(with one exception for hyphen) and does case insensitive matching).
In the attachment is a WIP patch that shows how to implement also
spellcheck.{h,cc} style discovery of misspellings, but I'll need to talk
to David Malcolm about it, as spellcheck.{h,cc} is in gcc/ subdir
(so the WIP incremental patch instead prints all the names to stderr).
2022-08-26 Jakub Jelinek <jakub@redhat.com>
PR c++/106648
libcpp/
* charset.cc: Implement C++23 P2071R2 - Named universal character
escapes. Include uname2c.h.
(hangul_syllables, hangul_count): New variables.
(struct uname2c_data): New type.
(_cpp_uname2c, _cpp_uname2c_uax44_lm2): New functions.
(_cpp_valid_ucn): Use them. Handle named universal character escapes.
(convert_ucn): Adjust comment.
(convert_escape): Call convert_ucn even for \N.
(_cpp_interpret_identifier): Handle named universal character escapes.
* lex.cc (get_bidi_ucn): Fix up function comment formatting.
(get_bidi_named): New function.
(forms_identifier_p, lex_string): Handle named universal character
escapes.
* makeuname2c.cc: New file. Small parts copied from makeucnid.cc.
* uname2c.h: New generated file.
gcc/c-family/
* c-cppbuiltin.cc (c_cpp_builtins): Predefine
__cpp_named_character_escapes to 202207L.
gcc/testsuite/
* c-c++-common/cpp/named-universal-char-escape-1.c: New test.
* c-c++-common/cpp/named-universal-char-escape-2.c: New test.
* c-c++-common/cpp/named-universal-char-escape-3.c: New test.
* c-c++-common/cpp/named-universal-char-escape-4.c: New test.
* c-c++-common/Wbidi-chars-25.c: New test.
* gcc.dg/cpp/named-universal-char-escape-1.c: New test.
* gcc.dg/cpp/named-universal-char-escape-2.c: New test.
* g++.dg/cpp/named-universal-char-escape-1.C: New test.
* g++.dg/cpp/named-universal-char-escape-2.C: New test.
* g++.dg/cpp23/feat-cxx2b.C: Test __cpp_named_character_escapes.
Richard Biener [Thu, 25 Aug 2022 11:04:43 +0000 (13:04 +0200)]
Improve compute_control_dep_chain path finding
This improves the compute_control_dep_chain path finding by first
marking the dominating region we search and then making sure to
not walk outside if it when enumerating all paths from the dominating
block to the interesting PHI edge source. I have limited the DFS
walk done for the marking in similar ways as we limit the walking
in compute_control_dep_chain, more careful limiting might be
necessary though - the --param uninit-control-dep-attempts param
I re-use has a rather high default of 1000 which we might be able
to reduce with this patch as well (I think we'll usually hit some of the
other limits before ever reaching this).
* gimple-predicate-analysis.cc (dfs_mark_dominating_region):
New helper.
(compute_control_dep_chain): Adjust to honor marked region
if provided.
(uninit_analysis::init_from_phi_def): Pre-mark the dominating
region to improve compute_control_dep_chain walking.
* vec.h (vec<T, va_heap, vl_ptr>::allocated): Add forwarder.
Richard Biener [Thu, 25 Aug 2022 14:27:12 +0000 (16:27 +0200)]
Improve uninit_analysis::collect_phi_def_edges
This avoids expanding an edge to those of a PHI def if it is not
may-undefined, reducing the number of compute_control_dep_chain calls.
* gimple-predicate-analysis.cc
(uninit_analysis::collect_phi_def_edges): Only expand a
PHI def edge when it is possibly undefined.
Martin Liska [Thu, 25 Aug 2022 08:21:20 +0000 (10:21 +0200)]
cr16: remove obsoleted port
contrib/ChangeLog:
* config-list.mk: Remove cr16.
gcc/ChangeLog:
* doc/extend.texi: Remove cr16 related stuff.
* doc/install.texi: Likewise.
* doc/invoke.texi: Likewise.
* doc/md.texi: Likewise.
* function-tests.cc (test_expansion_to_rtl): Likewise.
* common/config/cr16/cr16-common.cc: Removed.
* config/cr16/constraints.md: Removed.
* config/cr16/cr16-protos.h: Removed.
* config/cr16/cr16.cc: Removed.
* config/cr16/cr16.h: Removed.
* config/cr16/cr16.md: Removed.
* config/cr16/cr16.opt: Removed.
* config/cr16/predicates.md: Removed.
* config/cr16/t-cr16: Removed.
libgcc/ChangeLog:
* config.host: Remove cr16 related stuff.
* config/cr16/crti.S: Removed.
* config/cr16/crtlibid.S: Removed.
* config/cr16/crtn.S: Removed.
* config/cr16/divmodhi3.c: Removed.
* config/cr16/lib1funcs.S: Removed.
* config/cr16/t-cr16: Removed.
* config/cr16/t-crtlibid: Removed.
* config/cr16/unwind-cr16.c: Removed.
* config/cr16/unwind-dw2.h: Removed.
gcc/testsuite/ChangeLog:
* lib/target-supports.exp: Remove cr16 related stuff.
liuhongt [Mon, 22 Aug 2022 02:41:16 +0000 (10:41 +0800)]
Don't gimple fold ymm-version vblendvpd/vblendvps/vpblendvb w/o TARGET_AVX2
Since 256-bit vector integer comparison is under TARGET_AVX2,
and gimple folding for vblendvpd/vblendvps/vpblendvb relies on that.
Restrict gimple fold condition to TARGET_AVX2.
gcc/ChangeLog:
PR target/106704
* config/i386/i386-builtin.def (BDESC): Add
CODE_FOR_avx_blendvpd256/CODE_FOR_avx_blendvps256 to
corresponding builtins.
* config/i386/i386.cc (ix86_gimple_fold_builtin):
Don't fold IX86_BUILTIN_PBLENDVB256, IX86_BUILTIN_BLENDVPS256,
IX86_BUILTIN_BLENDVPD256 w/o TARGET_AVX2.
gcc/testsuite/ChangeLog:
* gcc.target/i386/pr106704.c: New test.
GCC Administrator [Fri, 26 Aug 2022 00:16:21 +0000 (00:16 +0000)]
Daily bump.
Marek Polacek [Wed, 10 Aug 2022 19:00:49 +0000 (15:00 -0400)]
c: Implement C23 nullptr (N3042)
This patch implements the C23 nullptr literal:
<https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3042.htm> (with
wording fixes from N3047), which is intended to replace the problematic
definition of NULL which might be either of integer type or void*.
Since C++ has had nullptr for over a decade now, it was relatively easy
to just move the built-in node definitions from the C++ FE to the C/C++
common code. Also, our DWARF emitter already handles NULLPTR_TYPE by
emitting DW_TAG_unspecified_type. However, I had to handle a lot of
contexts such as ?:, comparison, conversion, etc.
There are some minor differences, e.g. in C you can do
bool b = nullptr;
but in C++ you have to use direct-initialization:
bool b{nullptr};
And I think that
nullptr_t n = 0;
is only valid in C++.
Of course, C doesn't have to handle mangling, RTTI, substitution,
overloading, ...
This patch also defines nullptr_t in <stddef.h>. However, it does not
define __STDC_VERSION_STDDEF_H__ yet, because we don't know yet what value
it should be defined to.
gcc/c-family/ChangeLog:
* c-common.cc (c_common_reswords): Enable nullptr in C2X.
(c_common_nodes_and_builtins): Create the built-in node for nullptr.
* c-common.h (enum c_tree_index): Add CTI_NULLPTR, CTI_NULLPTR_TYPE.
(struct c_common_resword): Resize the disable member.
(D_C2X): Add.
(nullptr_node): Define.
(nullptr_type_node): Define.
(NULLPTR_TYPE_P): Define.
* c-pretty-print.cc (c_pretty_printer::simple_type_specifier): Handle
NULLPTR_TYPE.
(c_pretty_printer::direct_abstract_declarator): Likewise.
(c_pretty_printer::constant): Likewise.
gcc/c/ChangeLog:
* c-convert.cc (c_convert) <case POINTER_TYPE>: Handle NULLPTR_TYPE.
Give a better diagnostic when converting to nullptr_t.
* c-decl.cc (c_init_decl_processing): Perform C-specific nullptr
initialization.
* c-parser.cc (c_parse_init): Maybe OR D_C2X into mask.
(c_parser_postfix_expression): Handle RID_NULLPTR.
* c-typeck.cc (null_pointer_constant_p): Return true when expr is
nullptr_node.
(build_unary_op) <case TRUTH_NOT_EXPR>: Handle NULLPTR_TYPE.
(build_conditional_expr): Handle the case when the second/third operand
is NULLPTR_TYPE and third/second operand is POINTER_TYPE.
(convert_for_assignment): Handle converting an expression of type
nullptr_t to pointer/bool.
(build_binary_op) <case TRUTH_XOR_EXPR>: Handle NULLPTR_TYPE.
<case EQ_EXPR>: Handle comparing operands of type nullptr_t.
gcc/cp/ChangeLog:
* cp-tree.h (enum cp_tree_index): Remove CTI_NULLPTR, CTI_NULLPTR_TYPE.
Move it to c_tree_index.
(nullptr_node): No longer define here.
(nullptr_type_node): Likewise.
(NULLPTR_TYPE_P): Likewise.
* decl.cc (cxx_init_decl_processing): Only keep C++-specific nullptr
initialization; move the shared code to c_common_nodes_and_builtins.
gcc/ChangeLog:
* ginclude/stddef.h: Define nullptr_t.
gcc/testsuite/ChangeLog:
* gcc.dg/c11-nullptr-1.c: New test.
* gcc.dg/c17-nullptr-1.c: New test.
* gcc.dg/c17-nullptr-2.c: New test.
* gcc.dg/c2x-nullptr-1.c: New test.
* gcc.dg/c2x-nullptr-2.c: New test.
* gcc.dg/c2x-nullptr-3.c: New test.
* gcc.dg/c2x-nullptr-4.c: New test.
* gcc.dg/c2x-nullptr-5.c: New test.
Joseph Myers [Thu, 25 Aug 2022 21:02:57 +0000 (21:02 +0000)]
c: Support C2x empty initializer braces
ISO C2x standardizes empty initializer braces {}. Implement this
feature accordingly. The basic case was already supported and so just
needed diagnostic adjustments. However, the standard feature also
includes two cases that were not previously supported: empty
initializer braces for scalars, and empty initializer braces for
VLAs. Thus, add support for those features as well, updating existing
tests that expected them to be diagnosed.
There was already some gimplifier support for converting
variable-sized initializations with empty CONSTRUCTORs to memset.
However, it didn't apply here; code earlier in gimplify_modify_expr
ended up calling gimplify_init_constructor via
gimplify_modify_expr_rhs, which ended up handling the CONSTRUCTOR in a
way that generated an ICE later. Add a check for this case earlier in
gimplify_modify_expr to avoid that issue.
Bootstrapped with no regressions for x86_64-pc-linux-gnu.
gcc/
* gimplify.cc (gimplify_modify_expr): Convert initialization from
a variable-size CONSTRUCTOR to memset before call to
gimplify_modify_expr_rhs.
gcc/c/
* c-decl.cc (start_decl): Do not diagnose initialization of
variable-sized objects here.
* c-parser.cc (c_parser_braced_init): Add argument DECL. All
callers changed.
(c_parser_initializer): Diagnose initialization of variable-sized
objects other than with braced initializer.
(c_parser_braced_init): Use pedwarn_c11 for empty initializer
braces and update diagnostic text. Diagnose initialization of
variable-sized objects with nonempty braces.
* c-typeck.cc (digest_init): Update diagnostic for initialization
of variable-sized objects.
(really_start_incremental_init, set_designator)
(process_init_element): Update comments.
(pop_init_level): Allow scalar empty initializers.
gcc/testsuite/
* gcc.dg/c11-empty-init-1.c, gcc.dg/c11-empty-init-2.c,
gcc.dg/c11-empty-init-3.c, gcc.dg/c2x-empty-init-1.c,
gcc.dg/c2x-empty-init-2.c, gcc.dg/c2x-empty-init-3.c,
gcc.dg/gnu2x-empty-init-1.c, gcc.dg/gnu2x-empty-init-2.c: New
tests.
* gcc.dg/torture/dfp-default-init-1.c: Also test empty
initializers.
* gcc.dg/init-bad-1.c, gcc.dg/noncompile/pr71583.c,
gcc.dg/pr61096-1.c, gcc.dg/vla-init-2.c, gcc.dg/vla-init-3.c,
gcc.target/i386/sse2-bfloat16-scalar-typecheck.c: Update expected
diagnostics.
* gcc.dg/ubsan/c-shift-1.c: Use nonempty initializers for VLA
initializations expected to be diagnosed.
Jason Merrill [Wed, 24 Aug 2022 20:28:32 +0000 (16:28 -0400)]
c++: block copy elision in delegating ctor
CWG2403 deals with the issue that copy elision is not possible when the
initialized object is a potentially-overlapping subobject and the
initializer is a function that returns by value. Jonathan pointed out that
this also affects delegating constructors, which might be used to construct
a base subobject.
gcc/cp/ChangeLog:
* call.cc (unsafe_return_slot_p): Return 2 for *this in a
constructor.
gcc/testsuite/ChangeLog:
* g++.dg/init/elide8.C: New test.
Jason Merrill [Wed, 24 Aug 2022 20:31:04 +0000 (16:31 -0400)]
dwarf2: use DW_ATE_UTF for char8_t
While looking at the Rust changes to dwarf2out I noticed that this was
missing from the char8_t support.
gcc/ChangeLog:
* dwarf2out.cc (base_type_die): Also use DW_ATE_UTF for char8_t.
gcc/testsuite/ChangeLog:
* g++.dg/debug/dwarf2/utf-1.C: New test.
Patrick Palka [Thu, 25 Aug 2022 15:11:04 +0000 (11:11 -0400)]
libstdc++: Some minor <ranges> cleanups
libstdc++-v3/ChangeLog:
* include/std/ranges (lazy_split_view::_OuterIter::_M_current):
Remove redundant comment.
(lazy_split_view::_M_current): Likewise.
(common_view::common_view): Remove commented out view-converting
constructor as per LWG3405.
(elements_view::_Iterator::_Iterator): Uglify 'current' and 'i'.
Andreas Krebbel [Fri, 29 Jul 2022 07:55:54 +0000 (09:55 +0200)]
PR 106101: IBM zSystems: Fix strict_low_part problem
This avoids generating illegal (strict_low_part (reg ...)) RTXs. This
required two changes:
1. Do not use gen_lowpart to generate the inner expression of a
STRICT_LOW_PART. gen_lowpart might fold the SUBREG either because
there is already a paradoxical subreg or because it can directly be
applied to the register. A new wrapper function makes sure that we
always end up having an actual SUBREG.
2. Change the movstrict patterns to enforce a SUBREG as inner operand
of the STRICT_LOW_PARTs. The new predicate introduced for the
destination operand requires a SUBREG expression with a
register_operand as inner operand. However, since reload strips away
the majority of the SUBREGs we have to accept single registers as well
once we reach reload.
Bootstrapped and regression tested on IBM zSystems 64 bit.
gcc/ChangeLog:
PR target/106101
* config/s390/predicates.md (subreg_register_operand): New
predicate.
* config/s390/s390-protos.h (s390_gen_lowpart_subreg): New
function prototype.
* config/s390/s390.cc (s390_gen_lowpart_subreg): New function.
(s390_expand_insv): Use s390_gen_lowpart_subreg instead of
gen_lowpart.
* config/s390/s390.md ("*get_tp_64", "*zero_extendhisi2_31")
("*zero_extendqisi2_31", "*zero_extendqihi2_31"): Likewise.
("movstrictqi", "movstricthi", "movstrictsi"): Use the
subreg_register_operand predicate instead of register_operand.
gcc/testsuite/ChangeLog:
PR target/106101
* gcc.c-torture/compile/pr106101.c: New test.
Martin Liska [Thu, 25 Aug 2022 09:36:52 +0000 (11:36 +0200)]
regenerate configure files and config.h.in files
fixincludes/ChangeLog:
* config.h.in: Regenerate.
* configure: Regenerate.
libada/ChangeLog:
* configure: Regenerate.
libiberty/ChangeLog:
* configure: Regenerate.
libobjc/ChangeLog:
* configure: Regenerate.
liboffloadmic/ChangeLog:
* configure: Regenerate.
* plugin/configure: Regenerate.
libquadmath/ChangeLog:
* configure: Regenerate.
libssp/ChangeLog:
* configure: Regenerate.
libvtv/ChangeLog:
* configure: Regenerate.
zlib/ChangeLog:
* configure: Regenerate.
Xi Ruoyao [Fri, 29 Jul 2022 13:45:40 +0000 (21:45 +0800)]
LoongArch: add model attribute
A linker script and/or a section attribute may locate some object
specially, so we need to handle the code model for such objects
differently than the -mcmodel setting. This happens when the Linux
kernel loads a module with per-CPU variables.
Add an attribute to override the code model for a specific variable.
gcc/ChangeLog:
* config/loongarch/loongarch-protos.h (loongarch_symbol_type):
Add SYMBOL_PCREL64 and change the description for SYMBOL_PCREL.
* config/loongarch/loongarch.cc (loongarch_attribute_table):
New attribute table.
(TARGET_ATTRIBUTE_TABLE): Define the target hook.
(loongarch_handle_model_attribute): New static function.
(loongarch_classify_symbol): Take TARGET_CMODEL_EXTREME and the
model attribute of SYMBOL_REF_DECL into account returning
SYMBOL_PCREL or SYMBOL_PCREL64.
(loongarch_use_anchors_for_symbol_p): New static function.
(TARGET_USE_ANCHORS_FOR_SYMBOL_P): Define the target hook.
(loongarch_symbol_extreme_p): New static function.
(loongarch_symbolic_constant_p): Handle SYMBOL_PCREL64.
(loongarch_symbol_insns): Likewise.
(loongarch_split_symbol_type): Likewise.
(loongarch_split_symbol): Check SYMBOL_PCREL64 instead of
TARGET_CMODEL_EXTREME for PC-relative addressing.
(loongarch_print_operand_reloc): Likewise.
* doc/extend.texi (Variable Attributes): Document new
LoongArch specific attribute.
gcc/testsuite/ChangeLog:
* gcc.target/loongarch/attr-model-test.c: New test.
* gcc.target/loongarch/attr-model-1.c: New test.
* gcc.target/loongarch/attr-model-2.c: New test.
* gcc.target/loongarch/attr-model-diag.c: New test.
Xi Ruoyao [Wed, 24 Aug 2022 13:31:34 +0000 (21:31 +0800)]
LoongArch: Avoid RTL flag check failure in loongarch_classify_symbol
SYMBOL_REF_TLS_MODEL invokes SYMBOL_REF_FLAGS, and SYMBOL_REF_FLAGS
invokes RTL_FLAG_CHECK1 and aborts when RTL code is not SYMBOL_REF.
r13-1833 removed "gcc_assert (SYMBOL_REF_P (x))" before invoking
"SYMBOL_REF_TLS_MODEL (x)", indicating that it's now possible that "x"
is not a SYMBOL_REF. So we need to check if "x" is SYMBOL_REF first.
This fixes a test failure happening with r13-2173 with RTL flag
checking enabled:
pr106096.C:26:1: internal compiler error: RTL flag check:
SYMBOL_REF_FLAGS used with unexpected rtx code 'const' in
loongarch_classify_symbol
gcc/ChangeLog:
* config/loongarch/loongarch.cc (loongarch_classify_symbol):
Return early if the rtx is not SYMBOL_REF.
Richard Biener [Thu, 25 Aug 2022 08:42:30 +0000 (10:42 +0200)]
tree-optimization/106737 - remove intermediate SSA verification in autopar
The following removes intermediate SSA verification in autopar which
isn't expected to succeed after previous changes delaying (virtual)
SSA update to the end of the pass.
PR tree-optimization/106737
* tree-parloops.cc (transform_to_exit_first_loop_alt): Do not
verify SSA form.
* gcc.dg/autopar/pr106737.c: New testcase.
Tobias Burnus [Thu, 25 Aug 2022 06:34:03 +0000 (08:34 +0200)]
Fortran/OpenMP: Fix strictly structured blocks parsing
gcc/fortran/ChangeLog:
* parse.cc (parse_omp_structured_block): When parsing strictly
structured blocks, issue an error if the end-directive comes
before the 'end block'.
gcc/testsuite/ChangeLog:
* gfortran.dg/gomp/strictly-structured-block-4.f90: New test.
Chenghua Xu [Wed, 24 Aug 2022 07:34:07 +0000 (15:34 +0800)]
LoongArch: Fix pr106459 by use HWIT instead of 1UL.
gcc/ChangeLog:
PR target/106459
* config/loongarch/loongarch.cc (loongarch_build_integer):
Use HOST_WIDE_INT.
* config/loongarch/loongarch.h (IMM_REACH): Likewise.
(HWIT_1U): New Defined.
(LU12I_OPERAND): Use HOST_WIDE_INT.
(LU32I_OPERAND): Likewise.
(LU52I_OPERAND): Likewise.
(HWIT_UC_0xFFF): Likwise.
gcc/testsuite/ChangeLog:
* gcc.target/loongarch/pr106459.c: New test.
GCC Administrator [Thu, 25 Aug 2022 00:16:33 +0000 (00:16 +0000)]
Daily bump.
Patrick Palka [Wed, 24 Aug 2022 23:17:27 +0000 (19:17 -0400)]
libstdc++: Implement ranges::zip_view from P2321R2
libstdc++-v3/ChangeLog:
* include/bits/ranges_algo.h (__min_fn, min): Move to ...
* include/bits/ranges_util.h: ... here, in order to avoid
including all of ranges_algo.h from <ranges>.
* include/std/ranges (__detail::__zip_is_common): Define for
C++23 as per P2321R2.
(__detail::__tuple_or_pair): Likewise.
(__detail::__tuple_or_pair_t): Likewise.
(__detail::__tuple_transform): Likewise.
(__detail::__tuple_for_each): Likewise.
(zip_view): Likewise.
(enable_borrowed_range<zip_view>): Likewise.
(__detail::__all_random_access): Likewise.
(__detail::__all_bidirectional): Likewise.
(__detail::__all_forward): Likewise.
(__detail::__zip_view_iter_cat): Likewise.
(zip_view::_Iterator): Likewise.
(zip_view::_Sentinel): Likewise.
* testsuite/std/ranges/zip/1.cc: New test.
Jonathan Wakely [Wed, 24 Aug 2022 22:47:43 +0000 (23:47 +0100)]
Revert "libstdc++: Optimize operator+(string/char*, char*/string) equally"
This reverts commit
0b7c9254998b3fb2c39f6b86b5b196f415530205.
Patrick Palka [Wed, 24 Aug 2022 20:38:45 +0000 (16:38 -0400)]
libstdc++: Fix fallout from P2321R2 std::pair/tuple enhancements
r13-2159-g72886fcc626953 caused some testsuite regressions in C++23 mode:
FAIL: 20_util/pair/requirements/explicit_instantiation/1.cc (test for excess errors)
FAIL: 20_util/tuple/53648.cc (test for excess errors)
FAIL: 20_util/tuple/cons/noexcept_specs.cc (test for excess errors)
FAIL: 20_util/tuple/requirements/explicit_instantiation.cc (test for excess errors)
The test noexcept_specs.cc just needs to be updated to consider the
additional converting constructors of tuple in C++23 mode, which happen
to improve constructing from a const tuple rvalue that has an rvalue
reference element (for the better, as far as I can tell).
The other three tests fail because they explicitly instantiate a
specialization of pair/tuple whose elements are not all const swappable,
which in C++23 mode now results in a hard error due to the new const
swap member function. Rather than XFAILing the tests in C++23 mode,
this patch adds non-standard constraints to this member function so that
we continue to accept such explicit instantiations.
libstdc++-v3/ChangeLog:
* include/bits/stl_pair.h (pair::swap const): Add non-standard
is_swappable_v constraints.
* include/std/tuple (tuple::swap const): Likewise.
* testsuite/20_util/tuple/cons/noexcept_specs.cc: Correct some
asserts in C++23 mode.
Andrew Pinski [Mon, 15 Aug 2022 22:58:09 +0000 (22:58 +0000)]
[RISCV] Fix PR 106632 and PR 106588 a few constraints in bitmanip.md
The constraints should be n instead of i. Also there
needs to a check for out of bounds zero_extract for
*bexti.
gcc/ChangeLog:
PR target/106632
PR target/106588
* config/riscv/bitmanip.md (*shNadduw): Use n constraint
instead of i.
(*slliuw): Likewise.
(*bexti): Likewise. Also add a check for operands[2] to be less
than the mode bitsize.
Andrew Pinski [Mon, 15 Aug 2022 22:48:25 +0000 (22:48 +0000)]
[RISCV] Add constraints for not_single_bit_mask_operand/single_bit_mask_operand
Like a previous patch, just add constraints for predicates
not_single_bit_mask_operand and single_bit_mask_operand.
OK? Built and tested for riscv32-linux-gnu and riscv64-linux-gnu.
Thanks,
Andrew Pinski
gcc/ChangeLog:
* config/riscv/constraints.md (DbS): New constraint.
(DnS): New constraint.
* config/riscv/bitmanip.md (*bset<mode>_1_mask): Use new constraint.
(*bclr<mode>): Likewise.
(*binvi<mode>): Likewise.
Andrew Pinski [Mon, 15 Aug 2022 22:25:13 +0000 (22:25 +0000)]
[RISCV] Fix PR 106586: riscv32 vs ZBS
The problem here is two fold. With RISCV32, 32bit
const_int are always signed extended to 64bit in HWI.
So that means for SINGLE_BIT_MASK_OPERAND, it should
mask off the upper bits to see it is a single bit
for !TARGET_64BIT.
Plus there are a few locations which forget to call
trunc_int_for_mode when generating a SImode constant
so they are not sign extended correctly for HWI.
The predicates single_bit_mask_operand and
not_single_bit_mask_operand need get the same handling
as SINGLE_BIT_MASK_OPERAND so just use SINGLE_BIT_MASK_OPERAND.
OK? Built and tested on riscv32-linux-gnu and riscv64-linux-gnu with
--with-arch=rvNimafdc_zba_zbb_zbc_zbs where N is replaced with 32 or 64.
Thanks,
Andrew Pinski
gcc/ChangeLog:
PR target/106586
* config/riscv/predicates.md (single_bit_mask_operand):
Use SINGLE_BIT_MASK_OPERAND instead of directly calling pow2p_hwi.
(not_single_bit_mask_operand): Likewise.
* config/riscv/riscv.cc (riscv_build_integer_1): Don't special case
1<<31 for 32bits as it is already handled.
Call trunc_int_for_mode on the upper part after the subtraction.
(riscv_move_integer): Call trunc_int_for_mode before generating
the integer just make sure the constant has been sign extended
corectly.
(riscv_emit_int_compare): Call trunc_int_for_mode after doing the
addition for the new rhs.
* config/riscv/riscv.h (SINGLE_BIT_MASK_OPERAND): If !TARGET64BIT,
then mask off the upper 32bits of the HWI as it will be sign extended.
Andrew Pinski [Mon, 15 Aug 2022 18:39:17 +0000 (18:39 +0000)]
[RISCV] Use a constraint for bset<mode>_mask and bset<mode>_1_mask
A constraint here just makes it easier to understand what the
operands are.
OK? Built and tested on riscv32-linux-gnu and riscv64-linux-gnu with
--with-arch=rvNimafdc_zba_zbb_zbc_zbs (where N is 32 and 64).
Thanks,
Andrew Pinski
gcc/ChangeLog:
* config/riscv/constraints.md (DsS): New constraint.
(DsD): New constraint.
* config/riscv/iterators.md (shiftm1c): New iterator.
* config/riscv/bitmanip.md (*bset<mode>_mask):
Use shiftm1c.
(*bset<mode>_1_mask): Likewise.
Andrew Pinski [Mon, 15 Aug 2022 17:50:50 +0000 (17:50 +0000)]
[RISCV] Use constraints/predicates instead of checking const_int directly for shNadd patterns
This simplifies the code by adding a predicate and a constraint for 1/2/3.
The aarch64 backend has a similar predicate called aarch64_shift_imm_<mode>
which they use there.
OK? Built and tested on riscv32-linux-gnu and riscv64-linux-gnu with no regressions.
Thanks,
Andrew Pinski
gcc/ChangeLog:
* config/riscv/constraints.md (Ds3): New constraint.
* config/riscv/predicates.md (imm123_operand): New predicate.
* config/riscv/bitmanip.md (*shNadd): Use Ds3 and imm123_operand.
(*shNadduw): Likewise.
Andrew Pinski [Fri, 12 Aug 2022 17:46:16 +0000 (17:46 +0000)]
[RISCV] Add %~ to print w if TARGET_64BIT and use it
To make things easier and more maintainable, we need to
add support printing out w if TARGET_64BIT so this patch
adds %~ to do that, similar how the x86 backend uses %~
to print out i/f for TARGET_AVX2. We could have chosen any
punctuation symbol but ~ looks the closest to w.
OK? Build and tested for riscv64-linux-gnu and riscv32-linux-gnu with no regressions.
Thanks,
Andrew Pinski
gcc/ChangeLog:
* config/riscv/riscv.cc (riscv_print_operand):
Handle '~'.
(riscv_print_operand_punct_valid_p): New function
(TARGET_PRINT_OPERAND_PUNCT_VALID_P): Define.
* config/riscv/bitmanip.md (<bitmanip_optab>si2/clz_ctz_pcnt):
Use %~ instead of conditional the pattern on TARGET_64BIT.
(rotrsi3): Likewise.
(rotlsi3): Likewise.
* config/riscv/riscv.md: Add ~ to the list of modifiers.
(addsi3): Use %~ instead of conditional the pattern on TARGET_64BIT.
(subsi3): Likewise.
(negsi2): Likewise.
(mulsi3): Likewise.
(optab>si3/any_div): Likewise.
(*add<mode>hi3): Likewise.
(<optab>si3/any_shift): Likewise.
Andrew Pinski [Fri, 12 Aug 2022 17:19:36 +0000 (17:19 +0000)]
[RISCV] Add the list of operand modifiers to riscv.md too
To make it easier to find operands modifiers while in the md
file, add the list of modifiers to the top of the md file.
This is similar to i386 target.
OK? Built and tested for riscv32-linux-gnu and riscv64-linux-gnu.
gcc/ChangeLog:
* config/riscv/riscv.cc (riscv_print_operand): Make a mention to
keep the list in riscv.md in sync with this list.
* config/riscv/riscv.md: Add list of modifiers as comments.
Andrew Pinski [Fri, 12 Aug 2022 00:44:16 +0000 (00:44 +0000)]
[RISCV] Move iterators from sync.md to iterators.md
Like the previous two patches this moves the iterators
that are in sync.md to iterators.md.
OK? build and tested for riscv64-linux-gnu.
gcc/ChangeLog:
* config/riscv/sync.md (any_atomic, atomic_optab): Move to ...
* config/riscv/iterators.md: Here.
Andrew Pinski [Thu, 11 Aug 2022 23:52:29 +0000 (23:52 +0000)]
[RISCV] Move iterators from bitmanip.md to iterators.md
Just like the previous patch this move all of the iterators
of bitmanip.md to iterators.md. All modern backends put the
iterators in iterators.md for easier access.
OK? Built and tested for riscv32-linux-gnu with --with-arch=rv32imafdc_zba_zbb_zbc_zbs.
Thanks,
Andrew Pinski
gcc/ChangeLog:
* config/riscv/bitmanip.md
(bitmanip_bitwise, bitmanip_minmax, clz_ctz_pcna,
tbitmanip_optab, bitmanip_insn, shiftm1): Move to ...
* config/riscv/iterators.md: Here.
Andrew Pinski [Thu, 11 Aug 2022 23:29:50 +0000 (16:29 -0700)]
[RISCV] Move iterators from riscv.md to iterators.md
This moves the iterators out from riscv.md to iterators.md
like most modern backends.
I have not moved the iterators from the other .md files yet.
OK? Build and tested on riscv64-linux-gnu and riscv32-linux-gnu.
Thanks,
Andrew Pinski
gcc/ChangeLog:
* config/riscv/riscv.md (GPR): Move to new file.
(P, X, BR): Likewise.
(MOVE32, MOVE64, SHORT): Likewise.
(HISI, SUPERQI, SUBX): Likewise.
(ANYI, ANYF, SOFTF): Likewise.
(size, load, default_load): Likewise.
(softload, store, softstore): Likewise.
(reg, fmt, ifmt, amo): Likewise.
(UNITMODE, HALFMODE): Likewise.
(RINT, rint_pattern, rint_rm): Likewise.
(QUIET_COMPARISON, quiet_pattern, QUIET_PATTERN): Likewise.
(any_extend, any_shiftrt, any_shift): Likewise.
(any_bitwise): Likewise.
(any_div, any_mod): Likewise.
(any_gt, any_ge, any_lt, any_le): Likewise.
(u, su): Likewise.
(optab, insn): Likewise.
* config/riscv/iterators.md: New file.
Andrew Pinski [Fri, 19 Aug 2022 22:09:30 +0000 (22:09 +0000)]
Fix PR 106690: enable effective_target_bswap for RISCV targets with ZBB enabled by default
While looking for testcases to quickly test, I Noticed that
check_effective_target_bswap was not enabled for riscv when
ZBB is enabled. This patch checks if ZBB is enabled when
targeting RISCV* for bswap.
OK? Ran the testsuite for riscv32-linux-gnu both with and without ZBB enabled.
PR testsuite/106690
gcc/testsuite/ChangeLog:
* lib/target-supports.exp (check_effective_target_bswap):
Return true if riscv and ZBB ISA extension is enabled.
Andrew Pinski [Fri, 19 Aug 2022 17:46:40 +0000 (17:46 +0000)]
Fix PR 106601: __builtin_bswap16 code gen could be improved with ZBB enabled
The default expansion for bswap16 is two extractions (shift/and)
followed by an insertation (ior) and then a zero extend. This can be improved
with ZBB enabled to just full byteswap followed by a (logical) shift right.
This patch adds a new pattern for this which does that.
OK? Built and tested on riscv32-linux-gnu and riscv64-linux-gnu.
gcc/ChangeLog:
PR target/106601
* config/riscv/bitmanip.md (bswaphi2): New pattern.
gcc/testsuite/ChangeLog:
PR target/106601
* gcc.target/riscv/zbb_32_bswap-2.c: New test.
* gcc.target/riscv/zbb_bswap-2.c: New test.
Andrew Pinski [Fri, 19 Aug 2022 17:01:02 +0000 (17:01 +0000)]
Fix PR 106600: __builtin_bswap32 is not hooked up for ZBB for 32bit
The problem here is the bswap<mode>2 pattern had a check for TARGET_64BIT
but then used the X iterator. Since the X iterator is either SI or DI depending
on the setting TARGET_64BIT, there is no reason for the TARGET_64BIT.
OK? Built and tested on both riscv32-linux-gnu and riscv64-linux-gnu.
Thanks,
Andrew Pinski
gcc/ChangeLog:
PR target/106600
* config/riscv/bitmanip.md (bswap<mode>2): Remove
condition on TARGET_64BIT as X is already conditional there.
gcc/testsuite/ChangeLog:
PR target/106600
* gcc.target/riscv/zbb_32_bswap-1.c: New test.
* gcc.target/riscv/zbb_bswap-1.c: New test.
Harald Anlauf [Tue, 23 Aug 2022 20:16:14 +0000 (22:16 +0200)]
Fortran: improve error recovery while simplifying size of bad array [PR103694]
gcc/fortran/ChangeLog:
PR fortran/103694
* simplify.cc (simplify_size): The size expression of an array cannot
be simplified if an error occurs while resolving the array spec.
gcc/testsuite/ChangeLog:
PR fortran/103694
* gfortran.dg/pr103694.f90: New test.
Jonathan Wakely [Wed, 24 Aug 2022 12:53:27 +0000 (13:53 +0100)]
libstdc++: Fix regression in std::stable_sort
The recent change to split out the cold path of std::stable_sort caused
a regression for some Qt code. The problem is that the library now adds
a value of type ptrdiff_t to the iterator, which is ambiguous with
-pedantic. The addition could either convert the iterator to a built-in
pointer and add the ptrdiff_t to that, or it could convert the ptrdiff_t
to the iterator's difference_type and use the iterator's own operator+.
The fix is to cast the ptrdiff_t value to the difference type first.
libstdc++-v3/ChangeLog:
* include/bits/stl_algo.h (__stable_sort): Cast size to
iterator's difference type.
* testsuite/25_algorithms/stable_sort/4.cc: New test.
Will Hawkins [Wed, 24 Aug 2022 06:16:48 +0000 (02:16 -0400)]
libstdc++: Optimize operator+(string/char*, char*/string) equally
Until now operator+(char*, const string&) and operator+(const string&,
char*) had different performance characteristics. The former required a
single memory allocation and the latter required two. This patch makes
the performance equal.
libstdc++-v3/ChangeLog:
* include/bits/basic_string.h (operator+(const string&, const char*)):
Remove naive implementation.
* include/bits/basic_string.tcc (operator+(const string&, const char*)):
Add single-allocation implementation.
Signed-off-by: Will Hawkins <whh8b@obs.cr>
Joseph Myers [Wed, 24 Aug 2022 14:10:25 +0000 (14:10 +0000)]
tree.cc: Fix optimization of DFP default initialization
When an object of decimal floating-point type is default-initialized,
GCC is inconsistent about whether it is given the all-zero-bits
representation (zero with the least quantum exponent) or whether it
acts like a conversion of integer 0 to the DFP type (zero with quantum
exponent 0). In particular, the representation stored in memory can
have all zero bits, but optimization of access to the same object
based on its known constant value can then produce zero with quantum
exponent 0 instead.
C2x leaves the quantum exponent for default initialization
implementation-defined, but that doesn't allow such inconsistency in
the interpretation of a single object. All zero bits seems most
appropriate; change build_real to special-case dconst0 the same way
other constants are special-cased and ensure that the correct zero for
the type is generated.
Bootstrapped with no regressions for x86_64-pc-linux-gnu.
gcc/
* tree.cc (build_real): Give DFP dconst0 the minimum quantum
exponent for the type.
gcc/testsuite/
* gcc.dg/torture/dfp-default-init-1.c,
gcc.dg/torture/dfp-default-init-2.c,
gcc.dg/torture/dfp-default-init-3.c: New tests.
Jose E. Marchesi [Wed, 24 Aug 2022 11:07:57 +0000 (13:07 +0200)]
bpf: facilitate constant propagation of function addresses
eBPF effectively supports two kind of call instructions:
- The so called pseudo-calls ("bpf to bpf").
- External calls ("bpf to kernel").
The BPF call instruction always gets an immediate argument, whose
interpretation varies depending on the purpose of the instruction:
- For pseudo-calls, the immediate argument is interpreted as a
32-bit PC-relative displacement measured in number of 64-bit words
minus one.
- For external calls, the immediate argument is interpreted as the
identification of a kernel helper.
In order to differenciate both flavors of CALL instructions the SRC
field of the instruction (otherwise unused) is abused as an opcode;
if the field holds 0 the instruction is an external call, if it holds
BPF_PSEUDO_CALL the instruction is a pseudo-call.
C-to-BPF toolchains, including the GNU toolchain, use the following
practical heuristic at assembly time in order to determine what kind
of CALL instruction to generate: call instructions requiring a fixup
at assembly time are interpreted as pseudo-calls. This means that in
practice a call instruction involving symbols at assembly time (such
as `call foo') is assembled into a pseudo-call instruction, whereas
something like `call 12' is assembled into an external call
instruction.
In both cases, the argument of CALL is an immediate: at the time of
writing eBPF lacks support for indirect calls, i.e. there is no
call-to-register instruction.
This is the reason why BPF programs, in practice, rely on certain
optimizations to happen in order to generate calls to immediates.
This is a typical example involving a kernel helper:
static void * (*bpf_map_lookup_elem)(void *map, const void *key)
= (void *) 1;
int foo (...)
{
char *ret;
ret = bpf_map_lookup_elem (args...);
if (ret)
return 1;
return 0;
}
Note how the code above relies on the compiler to do constant
propagation so the call to bpf_map_lookup_elem can be compiled to a
`call 1' instruction.
While GCC provides a kernel_helper function declaration attribute that
can be used in a robust way to tell GCC to generate an external call
despite of optimization level and any other consideration, the Linux
kernel bpf_helpers.h file relies on tricks like the above.
This patch modifies the BPF backend to avoid SSA sparse constant
propagation to be "undone" by the expander loading the function
address into a register. A new test is also added.
Tested in bpf-unknown-linux-gnu.
No regressions.
gcc/ChangeLog:
PR target/106733
* config/bpf/bpf.cc (bpf_legitimate_address_p): Recognize integer
constants as legitimate addresses for functions.
(bpf_small_register_classes_for_mode_p): Define target hook.
gcc/testsuite/ChangeLog:
PR target/106733
* gcc.target/bpf/constant-calls.c: Rename to ...
* gcc.target/bpf/constant-calls-1.c: and modify to not expect
failure anymore.
* gcc.target/bpf/constant-calls-2.c: New test.
Jonathan Wakely [Tue, 23 Aug 2022 23:10:59 +0000 (00:10 +0100)]
libstdc++: Add check for LWG 3741 problem case
This LWG issue was closed as NAD, as it was just a bug in an
implementation, not a defect in the standard. Libstdc++ never had that
bug and always worked for the problem case. Add a test to ensure we
don't regress.
The problem occurs when abs is implemented using a ternary expression:
return d >= d.zero() ? d : -d;
If decltype(-d) is not the same as decltype(d) then this is ambiguous,
because each type can be converted to the other, so there is no common
type.
libstdc++-v3/ChangeLog:
* testsuite/20_util/duration_cast/rounding.cc: Check abs with
non-reduced duration.
Richard Biener [Wed, 24 Aug 2022 09:45:43 +0000 (11:45 +0200)]
Move things around in predicate analysis
This moves a few functions, notably normalization after a big comment
documenting it. I've left the rest unorganized for now.
* gimple-predicate-analysis.cc: Move predicate normalization
after the comment documenting it.
Richard Biener [Wed, 24 Aug 2022 09:22:55 +0000 (11:22 +0200)]
Split uninit analysis from predicate analysis
This splits the API collected in gimple-predicate-analysis.h into
what I'd call a predicate and assorted functionality plus utility
used by the uninit pass that happens to use that. I've tried to
be minimalistic with refactoring, there's still recursive
instantiation of uninit_analysis, the new class encapsulating a
series of uninit analysis queries from the uninit pass. But it
at least should make the predicate part actually reusable and
what predicate is dealt with is a little bit more clear in the
uninit_analysis part.
I will followup with moving the predicate implementation bits
together in the gimple-predicate-analysis.cc file.
* gimple-predicate-analysis.h (predicate): Split out
non-predicate related functionality into ..
(uninit_analysis): .. this new class.
* gimple-predicate-analysis.cc: Refactor into two classes.
* tree-ssa-uninit.cc (find_uninit_use): Use uninit_analysis.
Richard Biener [Wed, 24 Aug 2022 08:08:17 +0000 (10:08 +0200)]
Some more predicate analysis TLC
This limits the simple control dep also to the cd_root plus avoids
filling the lazily computed PHI def predicate in the early out path
which would leave it not simplified and normalized if it were
re-used. It also avoids computing the use predicates when the
post-dominance early out doesn't need it. It also syncs
predicate::use_cannot_happen with init_from_phi_def, adding the
missing PHI edge to the computed chains (the simple control dep
code already adds it).
* gimple-predicate-analysis.cc (predicate::use_cannot_happen):
Do simple_control_dep_chain only up to cd_root, add the PHI
operand edge to the chains like init_from_phi_def does.
(predicate::is_use_guarded): Speedup early out, avoid half-way
initializing the PHI def predicate.
Jakub Jelinek [Wed, 24 Aug 2022 07:57:09 +0000 (09:57 +0200)]
i386: Fix up mode iterators that weren't expanded [PR106721]
Currently, when md file reader sees <something> and something is valid mode
(or code) attribute but which doesn't include case for the current mode
(or code), it just keeps the <something> untouched.
I went through all cases matching <[a-zA-Z] in tmp-mddump.md after make mddump.
Most of the cases were related to the recent V*BF mode additions, some
to V*HF mode too, and there was one typo.
2022-08-24 Jakub Jelinek <jakub@redhat.com>
PR target/106721
* config/i386/sse.md (shuffletype): Add V32BF, V16BF and V8BF entries.
Change V32HF, V16HF and V8HF entries from "f" to "i".
(iptr): Add V32BF, V16BF, V8BF and BF entries.
(i128vldq): Add V16HF and V16BF entries.
(avx512er_vmrcp28<mode><mask_name><round_saeonly_name>): Fix typo,
mask_opernad3 -> mask_operand3.
* gcc.target/i386/avx512vl-pr106721.c: New test.
Jakub Jelinek [Wed, 24 Aug 2022 07:55:57 +0000 (09:55 +0200)]
preprocessor: Implement C++23 P2437R1 - Support for #warning [PR106646]
On Thu, Aug 18, 2022 at 11:02:44PM +0000, Joseph Myers wrote:
> ISO C2x standardizes the existing #warning extension. Arrange
> accordingly for it not to be diagnosed with -std=c2x -pedantic, but to
> be diagnosed with -Wc11-c2x-compat.
And here is the corresponding C++ version.
Don't pedwarn about this for C++23/GNU++23 and tweak the diagnostics
for C++ otherwise, + testsuite coverage.
The diagnostic wording is similar e.g. to the #elifdef diagnostics.
2022-08-24 Jakub Jelinek <jakub@redhat.com>
PR c++/106646
* init.cc: Implement C++23 P2437R1 - Support for #warning.
(lang_defaults): Set warning_directive for GNUCXX23 and CXX23.
* directives.cc (directive_diagnostics): Use different wording of
#warning pedwarn for C++.
* g++.dg/cpp/warning-1.C: New test.
* g++.dg/cpp/warning-2.C: New test.
* g++.dg/cpp/warning-3.C: New test.
Martin Liska [Wed, 10 Aug 2022 10:51:12 +0000 (12:51 +0200)]
gcov: fix file and function summary information
gcc/ChangeLog:
* gcov.cc (add_line_counts): Add group functions to coverage
summary.
(accumulate_line_counts): Similarly for files.
Co-Authored-By: Jørgen Kvalsvik <j@lambda.is>
Lulu Cheng [Sat, 20 Aug 2022 07:19:51 +0000 (15:19 +0800)]
LoongArch: Add new code model 'medium'.
The function jump instruction in normal mode is 'bl',
so the scope of the function jump is +-128MB.
Now we've added support for 'medium' mode, this mode is
to complete the function jump through two instructions:
pcalau12i + jirl
So in this mode the function jump range is increased to +-2GB.
Compared with 'normal' mode, 'medium' mode only affects the
jump range of functions.
gcc/ChangeLog:
* config/loongarch/genopts/loongarch-strings: Support code model medium.
* config/loongarch/genopts/loongarch.opt.in: Likewise.
* config/loongarch/loongarch-def.c: Likewise.
* config/loongarch/loongarch-def.h (CMODEL_LARGE): Likewise.
(CMODEL_EXTREME): Likewise.
(N_CMODEL_TYPES): Likewise.
(CMODEL_MEDIUM): Likewise.
* config/loongarch/loongarch-opts.cc: Likewise.
* config/loongarch/loongarch-opts.h (TARGET_CMODEL_MEDIUM): Likewise.
* config/loongarch/loongarch-str.h (STR_CMODEL_MEDIUM): Likewise.
* config/loongarch/loongarch.cc (loongarch_call_tls_get_addr):
Tls symbol Loading support medium mode.
(loongarch_legitimize_call_address): When medium mode, make a symbolic
jump with two instructions.
(loongarch_option_override_internal): Support medium.
* config/loongarch/loongarch.md (@pcalau12i<mode>): New template.
(@sibcall_internal_1<mode>): New function call templates added to support
medium mode.
(@sibcall_value_internal_1<mode>): Likewise.
(@sibcall_value_multiple_internal_1<mode>): Likewise.
(@call_internal_1<mode>): Likewise.
(@call_value_internal_1<mode>): Likewise.
(@call_value_multiple_internal_1<mode>): Likewise.
* config/loongarch/loongarch.opt: Support medium.
* config/loongarch/predicates.md: Add processing about medium mode.
* doc/invoke.texi: Document for '-mcmodel=medium'.
gcc/testsuite/ChangeLog:
* gcc.target/loongarch/func-call-medium-1.c: New test.
* gcc.target/loongarch/func-call-medium-2.c: New test.
* gcc.target/loongarch/func-call-medium-3.c: New test.
* gcc.target/loongarch/func-call-medium-4.c: New test.
* gcc.target/loongarch/func-call-medium-5.c: New test.
* gcc.target/loongarch/func-call-medium-6.c: New test.
* gcc.target/loongarch/func-call-medium-7.c: New test.
* gcc.target/loongarch/func-call-medium-8.c: New test.
* gcc.target/loongarch/tls-gd-noplt.c: Add compile parameter '-mexplicit-relocs'.
Richard Biener [Tue, 23 Aug 2022 12:05:34 +0000 (14:05 +0200)]
Speedup path discovery in predicate::use_cannot_happen
The following reverts a hunk from r8-5789-g11ef0b22d68cd1 that
made compute_control_dep_chain start from function entry rather
than the immediate dominator of the source block of the edge with
the undefined value on the PHI node. Reverting at that point
does not reveal any testsuite FAIL, in particular the added
testcase still passes. The following adjusts this to the other
function that computes predicates that hold on the PHI incoming
edges with undefined values, predicate::init_from_phi_def, which
starts at the immediate dominator of the PHI. That's much less
likely to run into the CFG walking limit.
* gimple-predicate-analysis.cc (predicate::use_cannot_happen):
Start the compute_control_dep_chain walk from the immediate
dominator of the PHI.
GCC Administrator [Wed, 24 Aug 2022 00:16:39 +0000 (00:16 +0000)]
Daily bump.
Marek Polacek [Mon, 22 Aug 2022 23:13:16 +0000 (19:13 -0400)]
c++: Quash bogus -Wredundant-move warning
This patch fixes a pretty stoopid thinko. When I added code to warn
about pessimizing std::move in initializations like
T t{std::move(T())};
I also added code to unwrap the expression from { }. But when we have
return {std::move(t)};
we cannot warn about a redundant std::move because the implicit move
wouldn't happen for "return {t};" because the expression isn't just
a name. However, we still want to warn about
return {std::move(T())};
so let's not disable the -Wpessimizing-move warning. Tests added for
both cases.
gcc/cp/ChangeLog:
* typeck.cc (maybe_warn_pessimizing_move): Don't warn about
redundant std::move when the expression was wrapped in { }.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/Wpessimizing-move10.C: New test.
* g++.dg/cpp0x/Wredundant-move12.C: New test.
H.J. Lu [Tue, 23 Aug 2022 20:32:01 +0000 (13:32 -0700)]
x86: Replace vmovdqu with movdqu in BF16 XMM ABI tests
Since XMM BF16 tests only require SSE2, replace vmovdqu with movdqu in
BF16 XMM ABI tests to support SSE2 machines without AVX.
Tested on x86-64 machines with and without AVX.
* gcc.target/x86_64/abi/bf16/asm-support.S: Replace vmovdqu with
movdqu.
Joseph Myers [Tue, 23 Aug 2022 19:18:31 +0000 (19:18 +0000)]
Update gcc .po files
* be.po, da.po, de.po, el.po, es.po, fi.po, fr.po, hr.po, id.po,
ja.po, nl.po, ru.po, sr.po, sv.po, tr.po, uk.po, vi.po, zh_CN.po,
zh_TW.po: Update.
Patrick Palka [Tue, 23 Aug 2022 17:42:37 +0000 (13:42 -0400)]
libstdc++: Implement std::pair/tuple/misc enhancements from P2321R2
This implements the non-<ranges> changes from P2321R2, which primarily
consist of additional converting constructors, assignment operator and
swap overloads for std::pair and std::tuple.
libstdc++-v3/ChangeLog:
* include/bits/stl_bvector.h (_Bit_reference::operator=): Define
const overload for C++23 as per P2321R2.
* include/bits/stl_pair.h (pair::swap): Likewise.
(pair::pair): Define additional converting constructors for
C++23 as per P2321R2.
(pair::operator=): Define const overloads for C++23 as per
P2321R2.
(swap): Define overload taking const pair& for C++23 as per
P2321R2.
(basic_common_reference): Define partial specialization for
pair for C++23 as per P2321R2.
(common_type): Likewise.
* include/bits/uses_allocator_args.h
(uses_allocator_construction_args): Define additional pair
overloads for C++23 as per P2321R2.
* include/std/tuple (_Tuple_impl::_Tuple_impl): Define
additional converting constructors for C++23 as per P2321R2.
(_Tuple_impl::_M_assign): Define const overloads for C++23
as per P2321R2.
(_Tuple_impl::_M_swap): Likewise.
(tuple::__constructible): Define as a convenient renaming of
_TCC<true>::__constructible.
(tuple::__convertible): As above but for _TCC<true>::__convertible.
(tuple::tuple): Define additional converting constructors for
C++23 as per P2321R2.
(tuple::operator=): Define const overloads for C++23 as per
P2321R2.
(tuple::swap): Likewise.
(basic_common_reference): Define partial specialization for
tuple for C++23 as per P2321R2.
(common_type): Likewise.
* testsuite/20_util/pair/p2321r2.cc: New test.
* testsuite/20_util/tuple/p2321r2.cc: New test.
* testsuite/23_containers/vector/bool/element_access/1.cc: New test.
Patrick Palka [Tue, 23 Aug 2022 17:35:49 +0000 (13:35 -0400)]
libstdc++: Separate construct/convertibility tests for std::tuple
P2321R2 adds additional conditionally explicit constructors to std::tuple
which we'll concisely implement in a subsequent patch using explicit(bool),
like in our C++20 std::pair implementation. This prerequisite patch
adds member typedefs to _TupleConstraints for testing element-wise
constructibility and convertibility separately; we'll use the first in
the new constructors' constraints, and the second in their explicit
specifier.
In passing, this patch also redefines the existing member predicates
__is_ex/implicitly_constructible in terms of these new members. This
seems to reduce compile time and memory usage by about 10% for large
tuples when using the converting constructors that're constrained by
_Explicit/_ImplicitCtor.
libstdc++-v3/ChangeLog:
* include/std/tuple (_TupleConstraints::__convertible): Define.
(_TupleConstraints::__constructible): Define.
(_TupleConstraints::__is_explicitly_constructible): Redefine this
in terms of __convertible and __constructible.
(_TupleConstraints::__is_implicitly_constructible): Likewise.
Jonathan Wakely [Tue, 23 Aug 2022 14:46:16 +0000 (15:46 +0100)]
libstdc++: Fix visit<void>(v) for non-void visitors [PR106589]
The optimization for the common case of std::visit forgot to handle the
edge case of passing zero variants to a non-void visitor and converting
the result to void.
libstdc++-v3/ChangeLog:
PR libstdc++/106589
* include/std/variant (__do_visit): Handle is_void<R> for zero
argument case.
* testsuite/20_util/variant/visit_r.cc: Check std::visit<void>(v).
H.J. Lu [Thu, 18 Aug 2022 21:17:33 +0000 (14:17 -0700)]
x86: Cast stride to __PTRDIFF_TYPE__ in AMX intrinsics
On 64-bit Windows, long is 32 bits and can't be used as stride in memory
operand when base is a pointer which is 64 bits. Cast stride to
__PTRDIFF_TYPE__, instead of long.
PR target/106714
* config/i386/amxtileintrin.h (_tile_loadd_internal): Cast to
__PTRDIFF_TYPE__.
(_tile_stream_loadd_internal): Likewise.
(_tile_stored_internal): Likewise.
Richard Biener [Tue, 23 Aug 2022 11:58:31 +0000 (13:58 +0200)]
tree-optimization/106722 - uninit analysis with long def -> use path
The following applies similar measures as r13-2133-ge66cf626c72d58
to the computation of the use predicate when the path from PHI def
to use is too long and we run into compute_control_dep_chain limits.
It also moves the preprocessor define limits internal.
This resolves the reduced testcase but not the original one.
PR tree-optimization/106722
* gimple-predicate-analysis.h (MAX_NUM_CHAINS, MAX_CHAIN_LEN,
MAX_POSTDOM_CHECK, MAX_SWITCH_CASES): Move ...
* gimple-predicate-analysis.cc: ... here and document.
(simple_control_dep_chain): New function, factored from
predicate::use_cannot_happen.
(predicate::use_cannot_happen): Adjust.
(predicate::predicate): Use simple_control_dep_chain as fallback.
* g++.dg/uninit-pr106722-1.C: New testcase.
Marek Polacek [Mon, 22 Aug 2022 16:43:30 +0000 (12:43 -0400)]
testsuite: Add test for r11-4123
r11-4123 came without a test but I happened upon a nice test case that
got fixed by that revision. So I think it'd be good to add it. The
ICE was:
phi-1.C: In constructor 'ElementManager::ElementManager()':
phi-1.C:28:1: error: missing definition
28 | ElementManager::ElementManager() : array_(makeArray()) {}
| ^~~~~~~~~~~~~~
for SSA_NAME: _12 in statement:
_10 = PHI <_12(3), _11(5)>
PHI argument
_12
for PHI node
_10 = PHI <_12(3), _11(5)>
during GIMPLE pass: fixup_cfg
phi-1.C:28:1: internal compiler error: verify_ssa failed
gcc/testsuite/ChangeLog:
* g++.dg/torture/phi-1.C: New test.
Richard Biener [Tue, 23 Aug 2022 12:30:05 +0000 (14:30 +0200)]
New uninit testcase
I've reduced the following which doesn't seem covered in a good enough
way in the testsuite.
* gcc.dg/uninit-pred-10.c: New testcase.
Tobias Burnus [Tue, 23 Aug 2022 11:14:19 +0000 (13:14 +0200)]
gfortran.dg/gomp/depend-6.f90: Minor fix
Exactly the same as previous commit for depend-4.f90, r13-2151.
gcc/testsuite/
* gfortran.dg/gomp/depend-6.f90: Fix array index use for
depobj var + update scan-tree-dump-times.
Tobias Burnus [Tue, 23 Aug 2022 10:31:43 +0000 (12:31 +0200)]
gfortran.dg/gomp/depend-4.f90: Minor fix
gcc/testsuite/
* gfortran.dg/gomp/depend-4.f90: Fix array index use for
depobj var + update scan-tree-dump-times.
Aldy Hernandez [Sat, 20 Aug 2022 10:41:27 +0000 (12:41 +0200)]
Copy range from op2 in foperator_equal::op1_range.
Like the integer version, when op1 == op2 is known to be true the
ranges are also equal.
gcc/ChangeLog:
* range-op-float.cc (foperator_equal::op1_range): Set range to
range of op2.
Richard Biener [Mon, 22 Aug 2022 13:24:23 +0000 (15:24 +0200)]
Refactor is_non_loop_exit_postdominating
That's a weird function in predicate analysis that currently looks like
/* Return true if BB1 is postdominating BB2 and BB1 is not a loop exit
bb. The loop exit bb check is simple and does not cover all cases. */
static bool
is_non_loop_exit_postdominating (basic_block bb1, basic_block bb2)
{
if (!dominated_by_p (CDI_POST_DOMINATORS, bb2, bb1))
return false;
if (single_pred_p (bb1) && !single_succ_p (bb2))
return false;
return true;
}
One can refactor this to
return (dominated_by_p (CDI_POST_DOMINATORS, bb2, bb1)
&& !(single_pred_p (bb1) && !single_succ_p (bb2)));
Notable is that the comment refers to BB1 with respect to a loop
exit but the test seems to be written with an exit edge bb1 -> bb2
in mind. None of the three callers are guaranteed to have bb1 and
bb2 connected directly with an edge.
The patch now introduces a is_loop_exit function and inlines
the post-dominance check which makes the find_control_equiv_block
case simpler because the post-dominance check can be elided.
It also avoids the double negation in compute_control_dep_chain
and makes it obvious this is the case where we do look at an edge.
For the main is_use_guarded API I chose to elide the loop exit
test, if the use block post-dominates the definition block of the
PHI node the use is always unconditional. I don't quite understand
the loop exit special-casing of the remaining two uses though.
* gimple-predicate-analysis.cc (is_loop_exit): Split out
from ...
(is_non_loop_exit_postdominating): ... here. Remove after
inlining ...
(find_control_equiv_block): ... here.
(compute_control_dep_chain): ... and here.
(predicate::is_use_guarded): Do not excempt loop exits
from short-cutting the case of the use post-dominating the
PHI definition.
Haochen Jiang [Mon, 22 Aug 2022 02:04:16 +0000 (10:04 +0800)]
Add __m128bf16/__m256bf16/__m512bf16 type for bf16 abi test
Fix the abi test fail issue caused by type missing.
gcc/testsuite/ChangeLog:
* gcc.target/x86_64/abi/bf16/bf16-helper.h:
Add _m128bf16/m256bf16/_m512bf16.
* gcc.target/x86_64/abi/bf16/m512bf16/bf16-zmm-check.h:
Include bf16-helper.h.
Andrew MacLeod [Mon, 22 Aug 2022 19:40:48 +0000 (15:40 -0400)]
Return the correct relation
With an input condition of op1 > op2, and evaluating the unsigned expression:
LHS = op1 - op2
range-ops was returning LHS < op1 , which is incorrect as op2 coould be
zero. This patch adjusts it to return LHS <= op1.
PR tree-optimization/106687
gcc/
* range-op.cc (operator_minus::lhs_op1_relation): Return VREL_LE
for the VREL_GT case as well.
gcc/testsuite/
* g++.dg/pr106687.C: New.
GCC Administrator [Tue, 23 Aug 2022 00:16:29 +0000 (00:16 +0000)]
Daily bump.
Jonathan Wakely [Mon, 22 Aug 2022 16:24:27 +0000 (17:24 +0100)]
libstdc++: Document linker option for C++23 <stacktrace> [PR105678]
libstdc++-v3/ChangeLog:
PR libstdc++/105678
* doc/xml/manual/using.xml: Document -lstdc++_libbacktrace
requirement for using std::stacktrace. Also adjust -frtti and
-fexceptions to document non-default (i.e. negative) forms.
* doc/html/*: Regenerate.
Jonathan Wakely [Mon, 22 Aug 2022 14:42:17 +0000 (15:42 +0100)]
libstdc++: Fix for explicit copy ctors in <thread> and <future> [PR106695]
When I changed std::thread and std::async to avoid unnecessary move
construction of temporaries, I introduced a regression where types with
an explicit copy constructor could not be passed to std::thread or
std::async. The fix is to add a constructor instead of using aggregate
initialization of an unnamed temporary.
libstdc++-v3/ChangeLog:
PR libstdc++/106695
* include/bits/std_thread.h (thread::_State_impl): Forward
individual arguments to _Invoker constructor.
(thread::_Invoker): Add constructor. Delete copies.
* include/std/future (__future_base::_Deferred_state): Forward
individual arguments to _Invoker constructor.
(__future_base::_Async_state_impl): Likewise.
* testsuite/30_threads/async/106695.cc: New test.
* testsuite/30_threads/thread/106695.cc: New test.
Jonathan Wakely [Mon, 22 Aug 2022 14:16:16 +0000 (15:16 +0100)]
libstdc++: Check for overflow in regex back-reference [PR106607]
Currently we fail to notice integer overflow when parsing a
back-reference expression, or when converting the parsed result from
long to int. This changes the result to be int, so no conversion is
needed, and uses the overflow-checking built-ins to detect an
out-of-range back-reference.
libstdc++-v3/ChangeLog:
PR libstdc++/106607
* include/bits/regex_compiler.tcc (_Compiler::_M_cur_int_value):
Use built-ins to check for integer overflow in back-reference
number.
* testsuite/28_regex/basic_regex/106607.cc: New test.
Dimitar Dimitrov [Sat, 20 Aug 2022 20:58:27 +0000 (23:58 +0300)]
pru: Optimize 64-bit logical operations
The earlyclobber in the pattern yields inefficient code due to
unnecessarily generated moves. Optimize by removing the earlyclobber
for two special alternatives:
- If OP2 is a small constant integer.
- If the logical bit operation has only two operands.
gcc/ChangeLog:
* config/pru/pru.md (pru_<code>di3): New alternative for
two operands but without earlyclobber.
gcc/testsuite/ChangeLog:
* gcc.target/pru/bitop-di.c: New test.
Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
Dimitar Dimitrov [Mon, 22 Aug 2022 18:49:21 +0000 (21:49 +0300)]
pru: Add mov variants to load const -1
Use the FILL instruction to efficiently load -1 constants.
gcc/ChangeLog:
* config/pru/pru.md (prumov<mode>, mov<mode>): Add
variants for loading -1 consts.
gcc/testsuite/ChangeLog:
* gcc.target/pru/mov-m1.c: New test.
Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
Dimitar Dimitrov [Sun, 14 Aug 2022 15:50:18 +0000 (18:50 +0300)]
PR target/106564: pru: Optimize 64-bit sign- and zero-extend
Add new patterns to optimize 64-bit sign- and zero-extend operations for
the PRU target.
The new 64-bit zero-extend patterns are straightforward define_insns.
The old 16/32-bit sign-extend pattern has been rewritten from scratch
in order to add 64-bit support. The new pattern expands into several
optimized insns for filling bytes with zeros or ones, and for
conditional branching on bit-test. The bulk of this patch is to
implement the patterns for those new optimized insns.
PR target/106564
gcc/ChangeLog:
* config/pru/constraints.md (Um): New constraint for -1.
(Uf): New constraint for IOR fill-bytes constants.
(Uz): New constraint for AND zero-bytes constants.
* config/pru/predicates.md (const_fillbytes_operand): New
predicate for IOR fill-bytes constants.
(const_zerobytes_operand): New predicate for AND zero-bytes
constants.
* config/pru/pru-protos.h (pru_output_sign_extend): Remove.
(struct pru_byterange): New struct to describe a byte range.
(pru_calc_byterange): New declaration.
* config/pru/pru.cc (pru_rtx_costs): Add penalty for
64-bit zero-extend.
(pru_output_sign_extend): Remove.
(pru_calc_byterange): New helper function to extract byte
range info from a constant.
(pru_print_operand): Remove 'y' and 'z' print modifiers.
* config/pru/pru.md (zero_extendqidi2): New pattern.
(zero_extendhidi2): New pattern.
(zero_extendsidi2): New pattern.
(extend<EQS0:mode><EQD:mode>2): Rewrite as an expand.
(@pru_ior_fillbytes<mode>): New pattern.
(@pru_and_zerobytes<mode>): New pattern.
(<code>di3): Rewrite as an expand and handle ZERO and FILL
special cases.
(pru_<code>di3): New name for <code>di3.
(@cbranch_qbbx_const_<BIT_TEST:code><HIDI:mode>): New pattern to
handle bit-test for 64-bit registers.
gcc/testsuite/ChangeLog:
* gcc.target/pru/pr106564-1.c: New test.
* gcc.target/pru/pr106564-2.c: New test.
* gcc.target/pru/pr106564-3.c: New test.
* gcc.target/pru/pr106564-4.c: New test.
Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
Harald Anlauf [Sat, 20 Aug 2022 18:36:28 +0000 (20:36 +0200)]
Fortran: fix simplification of intrinsics IBCLR and IBSET [PR106557]
gcc/fortran/ChangeLog:
PR fortran/106557
* simplify.cc (gfc_simplify_ibclr): Ensure consistent results of
the simplification by dropping a redundant memory representation
of argument x.
(gfc_simplify_ibset): Likewise.
gcc/testsuite/ChangeLog:
PR fortran/106557
* gfortran.dg/pr106557.f90: New test.
Richard Biener [Mon, 22 Aug 2022 12:45:38 +0000 (14:45 +0200)]
Remove dead predicate analysis GENERIC expr building code
The following removes the unused def_expr, use_expr and expr APIs
from the predicate class including the unconditional build of the
GENERIC use_expr on each uninit analysis run.
* gimple-predicate-analysis.h (predicate::m_use_expr): Remove.
(predicate::def_expr): Likewise.
(predicate::use_expr): Likewise.
(predicate::expr): Likewise.
* gimple-predicate-analysis.cc (predicate::def_expr): Remove.
(predicate::use_expr): Likewise.
(predicate::expr): Likewise.
(predicate::is_use_guarded): Do not build m_use_expr.
Martin Liska [Thu, 18 Aug 2022 11:03:42 +0000 (13:03 +0200)]
jobserver: detect properly O_NONBLOCK
PR lto/106700
gcc/ChangeLog:
* configure.ac: Detect O_NONBLOCK flag for open.
* config.in: Regenerate.
* configure: Regenerate.
* opts-common.cc (jobserver_info::connect): Set is_connected
properly based on O_NONBLOCK.
* opts-jobserver.h (struct jobserver_info): Add is_connected
member variable.
gcc/lto/ChangeLog:
* lto.cc (wait_for_child): Ask if we are connected to jobserver.
(stream_out_partitions): Likewise.
zhongjuzhe [Mon, 22 Aug 2022 09:15:31 +0000 (10:15 +0100)]
middle-end: Fix issue of poly_uint16 (1, 1) in self test
This patch fix issue of poly_uint16 (1, 1) in machine mode self test.
gcc/ChangeLog:
* simplify-rtx.cc (test_vector_subregs_fore_back): Make first value
and repeat value different.
Tobias Burnus [Mon, 22 Aug 2022 07:49:52 +0000 (09:49 +0200)]
lto-wrapper.cc: Delete offload_names temp files in case of error [PR106686]
Usually, the caller takes care of the .o files for the offload compilers
(suffix: ".target.o"). However, if an error occurs during processing
(e.g. fatal error by lto1), they were not deleted.
gcc/ChangeLog:
PR lto/106686
* lto-wrapper.cc (free_array_of_ptrs): Move before tool_cleanup.
(tool_cleanup): Unlink offload_names.
(compile_offload_image): Take filename argument to set it early.
(compile_images_for_offload_targets): Update call; set
offload_names to NULL after freeing the array.
Richard Biener [Fri, 19 Aug 2022 12:12:52 +0000 (14:12 +0200)]
tree-optimization/105937 - avoid uninit diagnostics crossing iterations
The following avoids adding PHIs to the worklist for uninit processing
if we reach them following backedges. That confuses predicate analysis
because it assumes the use is happening in the same iteration as the the
definition. For the testcase in the PR the situation is like
void foo (int val)
{
int uninit;
# val = PHI <..> (B)
for (..)
{
if (..)
{
.. = val; (C)
val = uninit;
}
# val = PHI <..> (A)
}
}
and starting from (A) with 'uninit' as argument we arrive at (B)
and from there at (C). Predicate analysis then tries to prove
the predicate of (B) (not the backedge) can prove that the
path from (B) to (C) is unreachable which isn't really what it
necessary - that's what we'd need to do when the preheader
edge of the loop were the edge with the uninitialized def.
So the following makes those cases intentionally false negatives.
PR tree-optimization/105937
* tree-ssa-uninit.cc (find_uninit_use): Do not queue PHIs
on backedges.
(execute_late_warn_uninitialized): Mark backedges.
* g++.dg/uninit-pr105937.C: New testcase.
Richard Biener [Thu, 18 Aug 2022 13:49:58 +0000 (15:49 +0200)]
Improve uninit analysis
The following reduces the number of false positives in uninit analysis
by providing fallback for situations the current analysis gives up
and thus warns because it cannot prove initialization.
The first situation is when compute_control_dep_chain gives up walking
because it runs into either param_uninit_control_dep_attempts or
MAX_CHAIN_LEN. If in the process it did not collect a single path
from function entry to the interesting PHI edge then we'll give up
and diagnose. The following patch insteads provides a sparse path
including only those predicates that always hold when the PHI edge
is reached in that case. That's cheap to produce but may in some
odd cases prove less precise than what the code tries now (enumerating
all possible paths from function entry to the PHI edge, but only
use the first N of those and only require unreachability of those N).
The second situation is when the set of predicates computed to hold
on the use stmt was formed from multiple paths (there's a similar
enumeration of all paths and their predicates from the PHI def to the
use). In that case use_preds.use_cannot_happen gives up because
it doesn't know which of the predicates from which path from PHI to
the use it can use to prove unreachability of the PHI edge that has
the uninitialized def. The patch for this case simply computes
the intersection of the predicates and uses that for further analysis,
but in a crude way since the predicate vectors are not sorted.
Fortunately the total size is limited - we have max MAX_NUM_CHAINS
number of predicates each of length MAX_CHAIN_LEN so the brute
force intersection code should behave quite reasonable in practice.
* gimple-predicate-analysis.cc (predicate::use_cannot_happen):
If the use is guarded with multiple predicate paths compute
the predicates intersection before going forward. When
compute_control_dep_chain wasn't able to come up with at
least one path from function entry to the PHI edge compute
a conservative sparse path instead.
Martin Liska [Mon, 22 Aug 2022 03:13:18 +0000 (05:13 +0200)]
analyzer: add missing final keyword
Fixes the following clang warning:
gcc/analyzer/region-model.cc:5096:8: warning: 'subclass_equal_p' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
gcc/analyzer/ChangeLog:
* region-model.cc: Add missing final keyword.
GCC Administrator [Mon, 22 Aug 2022 00:16:22 +0000 (00:16 +0000)]
Daily bump.
GCC Administrator [Sun, 21 Aug 2022 00:16:33 +0000 (00:16 +0000)]
Daily bump.
Jakub Jelinek [Sat, 20 Aug 2022 19:20:04 +0000 (21:20 +0200)]
fortran: Drop -static-lib{gfortran,quadmath} from f951 [PR46539]
As discussed earlier, all other -static-lib* options are Driver only,
these 2 are Driver in common.opt and Fortran in lang.opt.
The spec files never pass the -static-lib* options down to any compiler
(f951 etc.), so the 2 errors below are reported only when one
runs ./f951 -static-libgfortran by hand.
The following patch just removes f951 support of these options, the
gfortran driver behavior remains as before. For other -static-lib*
option (and even these because it is never passed to f951) we never
error if we can't support those options, and e.g. Darwin is actually
able to handle those options through other means.
2022-08-20 Jakub Jelinek <jakub@redhat.com>
PR fortran/46539
* lang.opt (static-libgfortran, static-libquadmath): Change Fortran
to Driver.
* options.cc (gfc_handle_option): Don't handle OPT_static_libgfortran
nor OPT_static_libquadmath here.
Lulu Cheng [Thu, 18 Aug 2022 09:26:13 +0000 (17:26 +0800)]
LoongArch: Add support code model extreme.
Use five instructions to calculate a signed 64-bit offset relative to the pc.
gcc/ChangeLog:
* config/loongarch/loongarch-opts.cc: Allow cmodel to be extreme.
* config/loongarch/loongarch.cc (loongarch_call_tls_get_addr):
Add extreme support for TLS GD and LD types.
(loongarch_legitimize_tls_address): Add extreme support for TLS LE
and IE.
(loongarch_split_symbol): When compiling with -mcmodel=extreme,
the symbol address will be obtained through five instructions.
(loongarch_print_operand_reloc): Add support.
(loongarch_print_operand): Add support.
(loongarch_print_operand_address): Add support.
(loongarch_option_override_internal): Set '-mcmodel=extreme' option
incompatible with '-mno-explicit-relocs'.
* config/loongarch/loongarch.md (@lui_l_hi20<mode>):
Loads bits 12-31 of data into registers.
(lui_h_lo20): Load bits 32-51 of the data and spell bits 0-31 of
the source register.
(lui_h_hi12): Load bits 52-63 of the data and spell bits 0-51 of
the source register.
* config/loongarch/predicates.md: Symbols need to be decomposed
when defining the macro TARGET_CMODEL_EXTREME
* doc/invoke.texi: Modify the description information of cmodel in the document.
Document -W[no-]extreme-plt.
gcc/testsuite/ChangeLog:
* gcc.target/loongarch/func-call-1.c: Add option '-mcmodel=normal'.
* gcc.target/loongarch/func-call-2.c: Likewise.
* gcc.target/loongarch/func-call-3.c: Likewise.
* gcc.target/loongarch/func-call-4.c: Likewise.
* gcc.target/loongarch/func-call-5.c: Likewise.
* gcc.target/loongarch/func-call-6.c: Likewise.
* gcc.target/loongarch/func-call-7.c: Likewise.
* gcc.target/loongarch/func-call-8.c: Likewise.
* gcc.target/loongarch/relocs-symbol-noaddend.c: Likewise.
* gcc.target/loongarch/func-call-extreme-1.c: New test.
* gcc.target/loongarch/func-call-extreme-2.c: New test.
Jakub Jelinek [Sat, 20 Aug 2022 08:26:55 +0000 (10:26 +0200)]
libcpp: Implement C++23 P2290R3 - Delimited escape sequences [PR106645]
The following patch implements the C++23 P2290R3 paper.
2022-08-20 Jakub Jelinek <jakub@redhat.com>
PR c++/106645
libcpp/
* include/cpplib.h (struct cpp_options): Implement
P2290R3 - Delimited escape sequences. Add delimite_escape_seqs
member.
* init.cc (struct lang_flags): Likewise.
(lang_defaults): Add delim column.
(cpp_set_lang): Copy over delimite_escape_seqs.
* charset.cc (extend_char_range): New function.
(_cpp_valid_ucn): Use it. Handle delimited escape sequences.
(convert_hex): Likewise.
(convert_oct): Likewise.
(convert_ucn): Use extend_char_range.
(convert_escape): Call convert_oct even for \o.
(_cpp_interpret_identifier): Handle delimited escape sequences.
* lex.cc (get_bidi_ucn_1): Likewise. Add end argument, fill it in.
(get_bidi_ucn): Adjust get_bidi_ucn_1 caller. Use end argument to
compute num_bytes.
gcc/testsuite/
* c-c++-common/cpp/delimited-escape-seq-1.c: New test.
* c-c++-common/cpp/delimited-escape-seq-2.c: New test.
* c-c++-common/cpp/delimited-escape-seq-3.c: New test.
* c-c++-common/Wbidi-chars-24.c: New test.
* gcc.dg/cpp/delimited-escape-seq-1.c: New test.
* gcc.dg/cpp/delimited-escape-seq-2.c: New test.
* g++.dg/cpp/delimited-escape-seq-1.C: New test.
* g++.dg/cpp/delimited-escape-seq-2.C: New test.
GCC Administrator [Sat, 20 Aug 2022 00:16:26 +0000 (00:16 +0000)]
Daily bump.
Tobias Burnus [Fri, 19 Aug 2022 14:09:28 +0000 (16:09 +0200)]
mkoffload: Cleanup temporary omp_requires_file
The file (suffix ".mkoffload.omp_requires") used to save the 'omp requires'
data has to be passed to maybe_unlink for cleanup or -v -save-temps stderr
diagnostic. That was missed before. - For GCN, the same has to be done for
the files with suffix ".mkoffload.dbg.o".
gcc/ChangeLog:
* config/gcn/mkoffload.cc (main): Add omp_requires_file and dbgobj to
files_to_cleanup.
* config/i386/intelmic-mkoffload.cc (prepare_target_image): Add
omp_requires_file to temp_files.
* config/nvptx/mkoffload.cc (omp_requires_file): New global static var.
(main): Remove local omp_requires_file var.
(tool_cleanup): Handle omp_requires_file.
Aldy Hernandez [Thu, 18 Aug 2022 15:55:19 +0000 (17:55 +0200)]
Remove path_range_query constructor that takes an edge.
The path_range_query constructor that takes an edge is really a
convenience function for the loop-ch pass. It feels wrong to pollute
the API with such a specialized function that could be done with
a small inline function closer to its user.
As an added benefit, we remove one use of reset_path. The last
remaining one is the forward threader one.
Tested, thread-counted, and benchmarked on x86-64 Linux.
gcc/ChangeLog:
* gimple-range-path.cc (path_range_query::path_range_query):
Remove constructor that takes edge.
* gimple-range-path.h (class path_range_query): Same.
* tree-ssa-loop-ch.cc (edge_range_query): New.
(entry_loop_condition_is_static): Call edge_range_query.
Stefan Schulze Frielinghaus [Fri, 19 Aug 2022 07:33:13 +0000 (09:33 +0200)]
Add further FOR_EACH_ macros
contrib/ChangeLog:
* clang-format: Add further FOR_EACH_ macros.
Haochen Jiang [Thu, 23 Jun 2022 06:16:43 +0000 (14:16 +0800)]
i386: Add ABI test for __bf16 type
gcc/testsuite/ChangeLog:
* gcc.target/x86_64/abi/bf16/abi-bf16.exp: New test.
* gcc.target/x86_64/abi/bf16/args.h: Ditto.
* gcc.target/x86_64/abi/bf16/asm-support.S: Ditto.
* gcc.target/x86_64/abi/bf16/bf16-check.h: Ditto.
* gcc.target/x86_64/abi/bf16/bf16-helper.h: Ditto.
* gcc.target/x86_64/abi/bf16/defines.h: Ditto.
* gcc.target/x86_64/abi/bf16/m256bf16/abi-bf16-ymm.exp: Ditto.
* gcc.target/x86_64/abi/bf16/m256bf16/args.h: Ditto.
* gcc.target/x86_64/abi/bf16/m256bf16/asm-support.S: Ditto.
* gcc.target/x86_64/abi/bf16/m256bf16/bf16-ymm-check.h: Ditto.
* gcc.target/x86_64/abi/bf16/m256bf16/test_m256_returning.c: Ditto.
* gcc.target/x86_64/abi/bf16/m256bf16/test_passing_m256.c: Ditto.
* gcc.target/x86_64/abi/bf16/m256bf16/test_passing_structs.c: Ditto.
* gcc.target/x86_64/abi/bf16/m256bf16/test_passing_unions.c: Ditto.
* gcc.target/x86_64/abi/bf16/m256bf16/test_varargs-m256.c: Ditto.
* gcc.target/x86_64/abi/bf16/m512bf16/abi-bf16-zmm.exp: Ditto.
* gcc.target/x86_64/abi/bf16/m512bf16/args.h: Ditto.
* gcc.target/x86_64/abi/bf16/m512bf16/asm-support.S: Ditto.
* gcc.target/x86_64/abi/bf16/m512bf16/bf16-zmm-check.h: Ditto.
* gcc.target/x86_64/abi/bf16/m512bf16/test_m512_returning.c: Ditto.
* gcc.target/x86_64/abi/bf16/m512bf16/test_passing_m512.c: Ditto.
* gcc.target/x86_64/abi/bf16/m512bf16/test_passing_structs.c: Ditto.
* gcc.target/x86_64/abi/bf16/m512bf16/test_passing_unions.c: Ditto.
* gcc.target/x86_64/abi/bf16/m512bf16/test_varargs-m512.c: Ditto.
* gcc.target/x86_64/abi/bf16/macros.h: Ditto.
* gcc.target/x86_64/abi/bf16/test_3_element_struct_and_unions.c: Ditto.
* gcc.target/x86_64/abi/bf16/test_basic_alignment.c: Ditto.
* gcc.target/x86_64/abi/bf16/test_basic_array_size_and_align.c: Ditto.
* gcc.target/x86_64/abi/bf16/test_basic_returning.c: Ditto.
* gcc.target/x86_64/abi/bf16/test_basic_sizes.c: Ditto.
* gcc.target/x86_64/abi/bf16/test_basic_struct_size_and_align.c: Ditto.
* gcc.target/x86_64/abi/bf16/test_basic_union_size_and_align.c: Ditto.
* gcc.target/x86_64/abi/bf16/test_m128_returning.c: Ditto.
* gcc.target/x86_64/abi/bf16/test_passing_floats.c: Ditto.
* gcc.target/x86_64/abi/bf16/test_passing_m128.c: Ditto.
* gcc.target/x86_64/abi/bf16/test_passing_structs.c: Ditto.
* gcc.target/x86_64/abi/bf16/test_passing_unions.c: Ditto.
* gcc.target/x86_64/abi/bf16/test_struct_returning.c: Ditto.
* gcc.target/x86_64/abi/bf16/test_varargs-m128.c: Ditto.
GCC Administrator [Fri, 19 Aug 2022 00:16:27 +0000 (00:16 +0000)]
Daily bump.
Joseph Myers [Thu, 18 Aug 2022 23:01:01 +0000 (23:01 +0000)]
preprocessor: Support #warning for standard C2x
ISO C2x standardizes the existing #warning extension. Arrange
accordingly for it not to be diagnosed with -std=c2x -pedantic, but to
be diagnosed with -Wc11-c2x-compat.
Bootstrapped with no regressions for x86_64-pc-linux-gnu.
gcc/testsuite/
* gcc.dg/cpp/c11-warning-1.c, gcc.dg/cpp/c11-warning-2.c,
gcc.dg/cpp/c11-warning-3.c, gcc.dg/cpp/c11-warning-4.c,
gcc.dg/cpp/c2x-warning-1.c, gcc.dg/cpp/c2x-warning-2.c,
gcc.dg/cpp/gnu11-warning-1.c, gcc.dg/cpp/gnu11-warning-2.c,
gcc.dg/cpp/gnu11-warning-3.c, gcc.dg/cpp/gnu11-warning-4.c,
gcc.dg/cpp/gnu2x-warning-1.c, gcc.dg/cpp/gnu2x-warning-2.c: New
tests.
libcpp/
* include/cpplib.h (struct cpp_options): Add warning_directive.
* init.cc (struct lang_flags, lang_defaults): Add
warning_directive.
* directives.cc (DIRECTIVE_TABLE): Mark #warning as STDC2X not
EXTENSION.
(directive_diagnostics): Diagnose #warning with -Wc11-c2x-compat,
or with -pedantic for a standard not supporting #warning.
Takayuki 'January June' Suwa [Thu, 18 Aug 2022 10:03:51 +0000 (19:03 +0900)]
xtensa: Improve indirect sibling call handling
No longer needs the dedicated hard register (A11) for the address of the
call and the split patterns for fixups, due to the introduction of appropriate
register class and constraint.
(Note: "ISC_REGS" contains a hard register A8 used as a "static chain"
pointer for nested functions, but no problem; Pointer to nested function
actually points to "trampoline", and trampoline itself doesn't receive
"static chain" pointer to its parent's stack frame from the caller.)
gcc/ChangeLog:
* config/xtensa/xtensa.h
(enum reg_class, REG_CLASS_NAMES, REG_CLASS_CONTENTS):
Add new register class "ISC_REGS".
* config/xtensa/constraints.md (c): Add new register constraint.
* config/xtensa/xtensa.md (define_constants): Remove "A11_REG".
(sibcall_internal, sibcall_value_internal):
Change to use the new register constraint, and remove two split
patterns for fixups that are no longer needed.
gcc/testsuite/ChangeLog:
* gcc.target/xtensa/sibcalls.c: Add a new test function to ensure
that registers for arguments (occupy from A2 to A7) and for indirect
sibcall (should be assigned to A8) neither conflict nor spill out.
Harald Anlauf [Thu, 18 Aug 2022 19:24:29 +0000 (21:24 +0200)]
Revert "Fortran: fix invalid rank error in ASSOCIATED when rank is remapped [PR77652]"
This reverts commit
0110cfd5449bae3a772f45ea2e4c5dab5b7a8ccd.
Maciej W. Rozycki [Thu, 18 Aug 2022 15:50:26 +0000 (16:50 +0100)]
RISC-V: Standardize formatting of SFB ALU conditional move
Standardize the formatting of SFB ALU conditional move operations from:
beq a2,zero,1f; mv a0,zero; 1: # movcc
to:
beq a2,zero,1f # movcc
mv a0,zero
1:
for consistency with other assembly code produced. No functional change.
gcc/
* config/riscv/riscv.md (*mov<GPR:mode><X:mode>cc): Fix output
pattern formatting.